From 781911d4f5fb82143feaf0f0ae899e6402a85b45 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Wed, 30 Mar 2022 09:25:43 +0200 Subject: [PATCH 01/15] Update React 18 test --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index fc5da08d6f4ac3f..e9c5d9cfc5f48d4 100644 --- a/package.json +++ b/package.json @@ -146,7 +146,7 @@ "pretty-ms": "7.0.0", "random-seed": "0.3.0", "react": "17.0.2", - "react-18": "npm:react@18.0.0-rc.2", + "react-18": "npm:react@18.0.0", "react-dom": "17.0.2", "react-dom-18": "npm:react-dom@18.0.0-rc.2", "react-ssr-prepass": "1.0.8", diff --git a/yarn.lock b/yarn.lock index 28727c1ec6410f4..2c7671c0f3ba865 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17778,10 +17778,10 @@ rc@^1.0.1, rc@^1.1.6, rc@^1.2.7, rc@^1.2.8: minimist "^1.2.0" strip-json-comments "~2.0.1" -"react-18@npm:react@18.0.0-rc.2": - version "18.0.0-rc.2" - resolved "https://registry.yarnpkg.com/react/-/react-18.0.0-rc.2.tgz#f54de68a912454331f7f718794fbf5e6c01eb855" - integrity sha512-q32FWyA5HvqfRCN0ZOk0gUOpzJGPPh8fqbk8DYQuh4DyiGWiNgN/BxMq3/ScY0SlwDB1HOAMU1lUgtaOr5p2Ng== +"react-18@npm:react@18.0.0": + version "18.0.0" + resolved "https://registry.yarnpkg.com/react/-/react-18.0.0.tgz#b468736d1f4a5891f38585ba8e8fb29f91c3cb96" + integrity sha512-x+VL6wbT4JRVPm7EGxXhZ8w8LTROaxPXOqhlGyVSrv0sB1jkyFGgXxJ8LVoPRLvPR6/CIZGFmfzqUa2NYeMr2A== dependencies: loose-envify "^1.1.0" From 49644b4e69266e4e14a435353b8ec67b0c0fdffe Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Wed, 30 Mar 2022 09:34:38 +0200 Subject: [PATCH 02/15] Update react-dom --- package.json | 2 +- yarn.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index e9c5d9cfc5f48d4..8f2221b5907829e 100644 --- a/package.json +++ b/package.json @@ -148,7 +148,7 @@ "react": "17.0.2", "react-18": "npm:react@18.0.0", "react-dom": "17.0.2", - "react-dom-18": "npm:react-dom@18.0.0-rc.2", + "react-dom-18": "npm:react-dom@18.0.0", "react-ssr-prepass": "1.0.8", "react-virtualized": "9.22.3", "relay-compiler": "13.0.2", diff --git a/yarn.lock b/yarn.lock index 2c7671c0f3ba865..d877bd8e6b7eee7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17785,13 +17785,13 @@ rc@^1.0.1, rc@^1.1.6, rc@^1.2.7, rc@^1.2.8: dependencies: loose-envify "^1.1.0" -"react-dom-18@npm:react-dom@18.0.0-rc.2": - version "18.0.0-rc.2" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.0.0-rc.2.tgz#b0a55afc2a2385e9e518071eaf7c89f0c214bba5" - integrity sha512-EvLlgtc/wAzAIXX5V1gnLgeK9B3wAdEGmmrXXKRoRzXM0RNNwGN+6OxQPBlACiGDUYYEOk+GT8f6u+gNWDnTtg== +"react-dom-18@npm:react-dom@18.0.0": + version "18.0.0" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.0.0.tgz#26b88534f8f1dbb80853e1eabe752f24100d8023" + integrity sha512-XqX7uzmFo0pUceWFCt7Gff6IyIMzFUn7QMZrbrQfGxtaxXZIcGQzoNpRLE3fQLnS4XzLLPMZX2T9TRcSrasicw== dependencies: loose-envify "^1.1.0" - scheduler "^0.21.0-rc.2" + scheduler "^0.21.0" react-dom@17.0.2: version "17.0.2" @@ -18801,10 +18801,10 @@ scheduler@^0.20.2: loose-envify "^1.1.0" object-assign "^4.1.1" -scheduler@^0.21.0-rc.2: - version "0.21.0-rc.1-next-f468816ef-20220225" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.21.0-rc.1-next-f468816ef-20220225.tgz#1909b9ce9e67de48f5ca06b52d98828401771e66" - integrity sha512-/maKldJ78Ba2o1e9kh2mUpqNZH7XrmSQ1o1aa3HUPN/OMotUB9+pBKX/y3Zihkjco21H4cujG9hK2sJOZUpzJw== +scheduler@^0.21.0: + version "0.21.0" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.21.0.tgz#6fd2532ff5a6d877b6edb12f00d8ab7e8f308820" + integrity sha512-1r87x5fz9MXqswA2ERLo0EbOAU74DpIUO090gIasYTqlVoJeMcl+Z1Rg7WHz+qtPujhS/hGIt9kxZOYBV3faRQ== dependencies: loose-envify "^1.1.0" From 2076af4444236a7d6bef1956a17f8aae2411713f Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Wed, 30 Mar 2022 10:07:04 +0200 Subject: [PATCH 03/15] Fix fast refresh not applying --- .../babel-packages/packages-bundle.js | 149 +- packages/next/compiled/webpack/bundle5.js | 225230 +++++++-------- packages/next/package.json | 2 +- packages/react-refresh-utils/package.json | 4 +- yarn.lock | 8 +- 5 files changed, 112734 insertions(+), 112659 deletions(-) diff --git a/packages/next/compiled/babel-packages/packages-bundle.js b/packages/next/compiled/babel-packages/packages-bundle.js index bb4d6b512b29600..2e08e4b794c84ed 100644 --- a/packages/next/compiled/babel-packages/packages-bundle.js +++ b/packages/next/compiled/babel-packages/packages-bundle.js @@ -1,15 +1,15 @@ -(()=>{var e={7043:(e,t,r)=>{e.exports=r(5619)},2119:(e,t,r)=>{e.exports=r(7286)},1498:(e,t,r)=>{"use strict";const s=r(3654);const a=Object.freeze(Object.keys(s));for(const e of a){Object.freeze(s[e])}Object.freeze(s);const n=new Set(["parent","leadingComments","trailingComments"]);function filterKey(e){return!n.has(e)&&e[0]!=="_"}e.exports=Object.freeze({KEYS:s,getKeys(e){return Object.keys(e).filter(filterKey)},unionWith(e){const t=Object.assign({},s);for(const r of Object.keys(e)){if(t.hasOwnProperty(r)){const s=new Set(e[r]);for(const e of t[r]){s.add(e)}t[r]=Object.freeze(Array.from(s))}else{t[r]=Object.freeze(Array.from(e[r]))}}return Object.freeze(t)}})},2155:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=annotateAsPure;var s=r(8622);const a="#__PURE__";const isPureAnnotated=({leadingComments:e})=>!!e&&e.some((e=>/[@#]__PURE__/.test(e.value)));function annotateAsPure(e){const t=e["node"]||e;if(isPureAnnotated(t)){return}s.addComment(t,"leading",a)}},6951:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(3223);var a=r(8622);function _default(e){const{build:t,operator:r}=e;return{AssignmentExpression(e){const{node:n,scope:o}=e;if(n.operator!==r+"=")return;const i=[];const l=(0,s.default)(n.left,i,this,o);i.push(a.assignmentExpression("=",l.ref,t(l.uid,n.right)));e.replaceWith(a.sequenceExpression(i))},BinaryExpression(e){const{node:s}=e;if(s.operator===r){e.replaceWith(t(s.left,s.right))}}}}},9750:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getInclusionReasons=getInclusionReasons;var s=r(7849);var a=r(4794);var n=r(3406);function getInclusionReasons(e,t,r){const o=r[e]||{};return Object.keys(t).reduce(((e,r)=>{const i=(0,n.getLowestImplementedVersion)(o,r);const l=t[r];if(!i){e[r]=(0,a.prettifyVersion)(l)}else{const t=(0,n.isUnreleasedVersion)(i,r);const o=(0,n.isUnreleasedVersion)(l,r);if(!o&&(t||s.lt(l.toString(),(0,n.semverify)(i)))){e[r]=(0,a.prettifyVersion)(l)}}return e}),{})}},9578:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.targetsSupported=targetsSupported;t.isRequired=isRequired;t["default"]=filterItems;var s=r(7849);var a=r(2119);var n=r(3406);function targetsSupported(e,t){const r=Object.keys(e);if(r.length===0){return false}const a=r.filter((r=>{const a=(0,n.getLowestImplementedVersion)(t,r);if(!a){return true}const o=e[r];if((0,n.isUnreleasedVersion)(o,r)){return false}if((0,n.isUnreleasedVersion)(a,r)){return true}if(!s.valid(o.toString())){throw new Error(`Invalid version passed for target "${r}": "${o}". `+"Versions must be in semver format (major.minor.patch)")}return s.gt((0,n.semverify)(a),o.toString())}));return a.length===0}function isRequired(e,t,{compatData:r=a,includes:s,excludes:n}={}){if(n!=null&&n.has(e))return false;if(s!=null&&s.has(e))return true;return!targetsSupported(t,r[e])}function filterItems(e,t,r,s,a,n,o){const i=new Set;const l={compatData:e,includes:t,excludes:r};for(const t in e){if(isRequired(t,s,l)){i.add(t)}else if(o){const e=o.get(t);if(e){i.add(e)}}}if(a){a.forEach((e=>!r.has(e)&&i.add(e)))}if(n){n.forEach((e=>!t.has(e)&&i.delete(e)))}return i}},797:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isBrowsersQueryValid=isBrowsersQueryValid;t["default"]=getTargets;Object.defineProperty(t,"unreleasedLabels",{enumerable:true,get:function(){return i.unreleasedLabels}});Object.defineProperty(t,"TargetNames",{enumerable:true,get:function(){return l.TargetNames}});Object.defineProperty(t,"prettifyTargets",{enumerable:true,get:function(){return c.prettifyTargets}});Object.defineProperty(t,"getInclusionReasons",{enumerable:true,get:function(){return u.getInclusionReasons}});Object.defineProperty(t,"filterItems",{enumerable:true,get:function(){return p.default}});Object.defineProperty(t,"isRequired",{enumerable:true,get:function(){return p.isRequired}});var s=r(4907);var a=r(7347);var n=r(7043);var o=r(3406);var i=r(6555);var l=r(5748);var c=r(4794);var u=r(9750);var p=r(9578);const f=n["es6.module"];const d=new a.OptionValidator("@babel/helper-compilation-targets");function validateTargetNames(e){const t=Object.keys(l.TargetNames);for(const r of Object.keys(e)){if(!(r in l.TargetNames)){throw new Error(d.formatMessage(`'${r}' is not a valid target\n- Did you mean '${(0,a.findSuggestion)(r,t)}'?`))}}return e}function isBrowsersQueryValid(e){return typeof e==="string"||Array.isArray(e)&&e.every((e=>typeof e==="string"))}function validateBrowsers(e){d.invariant(e===undefined||isBrowsersQueryValid(e),`'${String(e)}' is not a valid browserslist query`);return e}function getLowestVersions(e){return e.reduce(((e,t)=>{const[r,s]=t.split(" ");const a=i.browserNameMap[r];if(!a){return e}try{const t=s.split("-")[0].toLowerCase();const n=(0,o.isUnreleasedVersion)(t,r);if(!e[a]){e[a]=n?t:(0,o.semverify)(t);return e}const i=e[a];const l=(0,o.isUnreleasedVersion)(i,r);if(l&&n){e[a]=(0,o.getLowestUnreleased)(i,t,r)}else if(l){e[a]=(0,o.semverify)(t)}else if(!l&&!n){const r=(0,o.semverify)(t);e[a]=(0,o.semverMin)(i,r)}}catch(e){}return e}),{})}function outputDecimalWarning(e){if(!e.length){return}console.warn("Warning, the following targets are using a decimal version:\n");e.forEach((({target:e,value:t})=>console.warn(` ${e}: ${t}`)));console.warn(`\nWe recommend using a string for minor/patch versions to avoid numbers like 6.10\ngetting parsed as 6.1, which can lead to unexpected behavior.\n`)}function semverifyTarget(e,t){try{return(0,o.semverify)(t)}catch(r){throw new Error(d.formatMessage(`'${t}' is not a valid value for 'targets.${e}'.`))}}const m={__default(e,t){const r=(0,o.isUnreleasedVersion)(t,e)?t.toLowerCase():semverifyTarget(e,t);return[e,r]},node(e,t){const r=t===true||t==="current"?process.versions.node:semverifyTarget(e,t);return[e,r]}};function generateTargets(e){const t=Object.assign({},e);delete t.esmodules;delete t.browsers;return t}function resolveTargets(e){const t=s(e,{mobileToDesktop:true});return getLowestVersions(t)}function getTargets(e={},t={}){var r;let{browsers:a,esmodules:n}=e;const{configPath:i="."}=t;validateBrowsers(a);const l=generateTargets(e);let c=validateTargetNames(l);const u=!!a;const p=u||Object.keys(c).length>0;const d=!t.ignoreBrowserslistConfig&&!p;if(!a&&d){a=s.loadConfig({config:t.configFile,path:i,env:t.browserslistEnv});if(a==null){{a=[]}}}if(n&&(n!=="intersect"||!((r=a)!=null&&r.length))){a=Object.keys(f).map((e=>`${e} >= ${f[e]}`)).join(", ");n=false}if(a){const e=resolveTargets(a);if(n==="intersect"){for(const t of Object.keys(e)){const r=e[t];if(f[t]){e[t]=(0,o.getHighestUnreleased)(r,(0,o.semverify)(f[t]),t)}else{delete e[t]}}}c=Object.assign(e,c)}const y={};const g=[];for(const e of Object.keys(c).sort()){var h;const t=c[e];if(typeof t==="number"&&t%1!==0){g.push({target:e,value:t})}const r=(h=m[e])!=null?h:m.__default;const[s,a]=r(e,t);if(a){y[s]=a}}outputDecimalWarning(g);return y}},5748:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.TargetNames=void 0;const r={node:"node",chrome:"chrome",opera:"opera",edge:"edge",firefox:"firefox",safari:"safari",ie:"ie",ios:"ios",android:"android",electron:"electron",samsung:"samsung"};t.TargetNames=r},4794:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.prettifyVersion=prettifyVersion;t.prettifyTargets=prettifyTargets;var s=r(7849);var a=r(6555);function prettifyVersion(e){if(typeof e!=="string"){return e}const t=[s.major(e)];const r=s.minor(e);const a=s.patch(e);if(r||a){t.push(r)}if(a){t.push(a)}return t.join(".")}function prettifyTargets(e){return Object.keys(e).reduce(((t,r)=>{let s=e[r];const n=a.unreleasedLabels[r];if(typeof s==="string"&&n!==s){s=prettifyVersion(s)}t[r]=s;return t}),{})}},6555:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.browserNameMap=t.unreleasedLabels=void 0;const r={safari:"tp"};t.unreleasedLabels=r;const s={and_chr:"chrome",and_ff:"firefox",android:"android",chrome:"chrome",edge:"edge",firefox:"firefox",ie:"ie",ie_mob:"ie",ios_saf:"ios",node:"node",op_mob:"opera",opera:"opera",safari:"safari",samsung:"samsung"};t.browserNameMap=s},3406:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.semverMin=semverMin;t.semverify=semverify;t.isUnreleasedVersion=isUnreleasedVersion;t.getLowestUnreleased=getLowestUnreleased;t.getHighestUnreleased=getHighestUnreleased;t.getLowestImplementedVersion=getLowestImplementedVersion;var s=r(7849);var a=r(7347);var n=r(6555);const o=/^(\d+|\d+.\d+)$/;const i=new a.OptionValidator("@babel/helper-compilation-targets");function semverMin(e,t){return e&&s.lt(e,t)?e:t}function semverify(e){if(typeof e==="string"&&s.valid(e)){return e}i.invariant(typeof e==="number"||typeof e==="string"&&o.test(e),`'${e}' is not a valid version`);const t=e.toString().split(".");while(t.length<3){t.push("0")}return t.join(".")}function isUnreleasedVersion(e,t){const r=n.unreleasedLabels[t];return!!r&&r===e.toString().toLowerCase()}function getLowestUnreleased(e,t,r){const s=n.unreleasedLabels[r];const a=[e,t].some((e=>e===s));if(a){return e===a?t:e||t}return semverMin(e,t)}function getHighestUnreleased(e,t,r){return getLowestUnreleased(e,t,r)===e?t:e}function getLowestImplementedVersion(e,t){const r=e[t];if(!r&&t==="android"){return e.chrome}return r}},6429:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasOwnDecorators=hasOwnDecorators;t.hasDecorators=hasDecorators;t.buildDecoratedClass=buildDecoratedClass;var s=r(8304);var a=r(6833);var n=r(550);function hasOwnDecorators(e){return!!(e.decorators&&e.decorators.length)}function hasDecorators(e){return hasOwnDecorators(e)||e.body.body.some(hasOwnDecorators)}function prop(e,t){if(!t)return null;return s.types.objectProperty(s.types.identifier(e),t)}function method(e,t){return s.types.objectMethod("method",s.types.identifier(e),[],s.types.blockStatement(t))}function takeDecorators(e){let t;if(e.decorators&&e.decorators.length>0){t=s.types.arrayExpression(e.decorators.map((e=>e.expression)))}e.decorators=undefined;return t}function getKey(e){if(e.computed){return e.key}else if(s.types.isIdentifier(e.key)){return s.types.stringLiteral(e.key.name)}else{return s.types.stringLiteral(String(e.key.value))}}function extractElementDescriptor(e,t,r){const{node:o,scope:i}=r;const l=r.isClassMethod();if(r.isPrivate()){throw r.buildCodeFrameError(`Private ${l?"methods":"fields"} in decorated classes are not supported yet.`)}new a.default({methodPath:r,objectRef:e,superRef:t,file:this,refToPreserve:e}).replace();const c=[prop("kind",s.types.stringLiteral(l?o.kind:"field")),prop("decorators",takeDecorators(o)),prop("static",o.static&&s.types.booleanLiteral(true)),prop("key",getKey(o))].filter(Boolean);if(l){const e=o.computed?null:o.key;s.types.toExpression(o);c.push(prop("value",(0,n.default)({node:o,id:e,scope:i})||o))}else if(o.value){c.push(method("value",s.template.statements.ast`return ${o.value}`))}else{c.push(prop("value",i.buildUndefinedNode()))}r.remove();return s.types.objectExpression(c)}function addDecorateHelper(e){try{return e.addHelper("decorate")}catch(e){if(e.code==="BABEL_HELPER_UNKNOWN"){e.message+="\n '@babel/plugin-transform-decorators' in non-legacy mode"+" requires '@babel/core' version ^7.0.2 and you appear to be using"+" an older version."}throw e}}function buildDecoratedClass(e,t,r,a){const{node:n,scope:o}=t;const i=o.generateUidIdentifier("initialize");const l=n.id&&t.isDeclaration();const c=t.isInStrictMode();const{superClass:u}=n;n.type="ClassDeclaration";if(!n.id)n.id=s.types.cloneNode(e);let p;if(u){p=o.generateUidIdentifierBasedOnNode(n.superClass,"super");n.superClass=p}const f=takeDecorators(n);const d=s.types.arrayExpression(r.filter((e=>!e.node.abstract)).map(extractElementDescriptor.bind(a,n.id,p)));const m=s.template.expression.ast` +(()=>{var e={7548:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.codeFrameColumns=codeFrameColumns;t["default"]=_default;var s=_interopRequireWildcard(r(2421));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}let a=false;function getDefs(e){return{gutter:e.grey,marker:e.red.bold,message:e.red.bold}}const n=/\r\n|[\n\r\u2028\u2029]/;function getMarkerLines(e,t,r){const s=Object.assign({column:0,line:-1},e.start);const a=Object.assign({},s,e.end);const{linesAbove:n=2,linesBelow:o=3}=r||{};const i=s.line;const l=s.column;const c=a.line;const u=a.column;let p=Math.max(i-(n+1),0);let d=Math.min(t.length,c+o);if(i===-1){p=0}if(c===-1){d=t.length}const f=c-i;const m={};if(f){for(let e=0;e<=f;e++){const r=e+i;if(!l){m[r]=true}else if(e===0){const e=t[r-1].length;m[r]=[l,e-l+1]}else if(e===f){m[r]=[0,u]}else{const s=t[r-e].length;m[r]=[0,s]}}}else{if(l===u){if(l){m[i]=[l,0]}else{m[i]=true}}else{m[i]=[l,u-l]}}return{start:p,end:d,markerLines:m}}function codeFrameColumns(e,t,r={}){const a=(r.highlightCode||r.forceColor)&&(0,s.shouldHighlight)(r);const o=(0,s.getChalk)(r);const i=getDefs(o);const maybeHighlight=(e,t)=>a?e(t):t;const l=e.split(n);const{start:c,end:u,markerLines:p}=getMarkerLines(t,l,r);const d=t.start&&typeof t.start.column==="number";const f=String(u).length;const m=a?(0,s.default)(e,r):e;let y=m.split(n).slice(c,u).map(((e,t)=>{const s=c+1+t;const a=` ${s}`.slice(-f);const n=` ${a} | `;const o=p[s];const l=!p[s+1];if(o){let t="";if(Array.isArray(o)){const s=e.slice(0,Math.max(o[0]-1,0)).replace(/[^\t]/g," ");const a=o[1]||1;t=["\n ",maybeHighlight(i.gutter,n.replace(/\d/g," ")),s,maybeHighlight(i.marker,"^").repeat(a)].join("");if(l&&r.message){t+=" "+maybeHighlight(i.message,r.message)}}return[maybeHighlight(i.marker,">"),maybeHighlight(i.gutter,n),e,t].join("")}else{return` ${maybeHighlight(i.gutter,n)}${e}`}})).join("\n");if(r.message&&!d){y=`${" ".repeat(f+1)}${r.message}\n${y}`}if(a){return o.reset(y)}else{return y}}function _default(e,t,r,s={}){if(!a){a=true;const e="Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";if(process.emitWarning){process.emitWarning(e,"DeprecationWarning")}else{const t=new Error(e);t.name="DeprecationWarning";console.warn(new Error(e))}}r=Math.max(r,0);const n={start:{column:r,line:t}};return codeFrameColumns(e,n,s)}},7043:(e,t,r)=>{e.exports=r(5619)},2119:(e,t,r)=>{e.exports=r(7286)},1498:(e,t,r)=>{"use strict";const s=r(3654);const a=Object.freeze(Object.keys(s));for(const e of a){Object.freeze(s[e])}Object.freeze(s);const n=new Set(["parent","leadingComments","trailingComments"]);function filterKey(e){return!n.has(e)&&e[0]!=="_"}e.exports=Object.freeze({KEYS:s,getKeys(e){return Object.keys(e).filter(filterKey)},unionWith(e){const t=Object.assign({},s);for(const r of Object.keys(e)){if(t.hasOwnProperty(r)){const s=new Set(e[r]);for(const e of t[r]){s.add(e)}t[r]=Object.freeze(Array.from(s))}else{t[r]=Object.freeze(Array.from(e[r]))}}return Object.freeze(t)}})},2155:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=annotateAsPure;var s=r(8622);const a="#__PURE__";const isPureAnnotated=({leadingComments:e})=>!!e&&e.some((e=>/[@#]__PURE__/.test(e.value)));function annotateAsPure(e){const t=e["node"]||e;if(isPureAnnotated(t)){return}s.addComment(t,"leading",a)}},6951:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(3223);var a=r(8622);function _default(e){const{build:t,operator:r}=e;return{AssignmentExpression(e){const{node:n,scope:o}=e;if(n.operator!==r+"=")return;const i=[];const l=(0,s.default)(n.left,i,this,o);i.push(a.assignmentExpression("=",l.ref,t(l.uid,n.right)));e.replaceWith(a.sequenceExpression(i))},BinaryExpression(e){const{node:s}=e;if(s.operator===r){e.replaceWith(t(s.left,s.right))}}}}},9750:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getInclusionReasons=getInclusionReasons;var s=r(7849);var a=r(4794);var n=r(3406);function getInclusionReasons(e,t,r){const o=r[e]||{};return Object.keys(t).reduce(((e,r)=>{const i=(0,n.getLowestImplementedVersion)(o,r);const l=t[r];if(!i){e[r]=(0,a.prettifyVersion)(l)}else{const t=(0,n.isUnreleasedVersion)(i,r);const o=(0,n.isUnreleasedVersion)(l,r);if(!o&&(t||s.lt(l.toString(),(0,n.semverify)(i)))){e[r]=(0,a.prettifyVersion)(l)}}return e}),{})}},9578:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.targetsSupported=targetsSupported;t.isRequired=isRequired;t["default"]=filterItems;var s=r(7849);var a=r(2119);var n=r(3406);function targetsSupported(e,t){const r=Object.keys(e);if(r.length===0){return false}const a=r.filter((r=>{const a=(0,n.getLowestImplementedVersion)(t,r);if(!a){return true}const o=e[r];if((0,n.isUnreleasedVersion)(o,r)){return false}if((0,n.isUnreleasedVersion)(a,r)){return true}if(!s.valid(o.toString())){throw new Error(`Invalid version passed for target "${r}": "${o}". `+"Versions must be in semver format (major.minor.patch)")}return s.gt((0,n.semverify)(a),o.toString())}));return a.length===0}function isRequired(e,t,{compatData:r=a,includes:s,excludes:n}={}){if(n!=null&&n.has(e))return false;if(s!=null&&s.has(e))return true;return!targetsSupported(t,r[e])}function filterItems(e,t,r,s,a,n,o){const i=new Set;const l={compatData:e,includes:t,excludes:r};for(const t in e){if(isRequired(t,s,l)){i.add(t)}else if(o){const e=o.get(t);if(e){i.add(e)}}}if(a){a.forEach((e=>!r.has(e)&&i.add(e)))}if(n){n.forEach((e=>!t.has(e)&&i.delete(e)))}return i}},797:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isBrowsersQueryValid=isBrowsersQueryValid;t["default"]=getTargets;Object.defineProperty(t,"unreleasedLabels",{enumerable:true,get:function(){return i.unreleasedLabels}});Object.defineProperty(t,"TargetNames",{enumerable:true,get:function(){return l.TargetNames}});Object.defineProperty(t,"prettifyTargets",{enumerable:true,get:function(){return c.prettifyTargets}});Object.defineProperty(t,"getInclusionReasons",{enumerable:true,get:function(){return u.getInclusionReasons}});Object.defineProperty(t,"filterItems",{enumerable:true,get:function(){return p.default}});Object.defineProperty(t,"isRequired",{enumerable:true,get:function(){return p.isRequired}});var s=r(4907);var a=r(7347);var n=r(7043);var o=r(3406);var i=r(6555);var l=r(5748);var c=r(4794);var u=r(9750);var p=r(9578);const d=n["es6.module"];const f=new a.OptionValidator("@babel/helper-compilation-targets");function validateTargetNames(e){const t=Object.keys(l.TargetNames);for(const r of Object.keys(e)){if(!(r in l.TargetNames)){throw new Error(f.formatMessage(`'${r}' is not a valid target\n- Did you mean '${(0,a.findSuggestion)(r,t)}'?`))}}return e}function isBrowsersQueryValid(e){return typeof e==="string"||Array.isArray(e)&&e.every((e=>typeof e==="string"))}function validateBrowsers(e){f.invariant(e===undefined||isBrowsersQueryValid(e),`'${String(e)}' is not a valid browserslist query`);return e}function getLowestVersions(e){return e.reduce(((e,t)=>{const[r,s]=t.split(" ");const a=i.browserNameMap[r];if(!a){return e}try{const t=s.split("-")[0].toLowerCase();const n=(0,o.isUnreleasedVersion)(t,r);if(!e[a]){e[a]=n?t:(0,o.semverify)(t);return e}const i=e[a];const l=(0,o.isUnreleasedVersion)(i,r);if(l&&n){e[a]=(0,o.getLowestUnreleased)(i,t,r)}else if(l){e[a]=(0,o.semverify)(t)}else if(!l&&!n){const r=(0,o.semverify)(t);e[a]=(0,o.semverMin)(i,r)}}catch(e){}return e}),{})}function outputDecimalWarning(e){if(!e.length){return}console.warn("Warning, the following targets are using a decimal version:\n");e.forEach((({target:e,value:t})=>console.warn(` ${e}: ${t}`)));console.warn(`\nWe recommend using a string for minor/patch versions to avoid numbers like 6.10\ngetting parsed as 6.1, which can lead to unexpected behavior.\n`)}function semverifyTarget(e,t){try{return(0,o.semverify)(t)}catch(r){throw new Error(f.formatMessage(`'${t}' is not a valid value for 'targets.${e}'.`))}}const m={__default(e,t){const r=(0,o.isUnreleasedVersion)(t,e)?t.toLowerCase():semverifyTarget(e,t);return[e,r]},node(e,t){const r=t===true||t==="current"?process.versions.node:semverifyTarget(e,t);return[e,r]}};function generateTargets(e){const t=Object.assign({},e);delete t.esmodules;delete t.browsers;return t}function resolveTargets(e){const t=s(e,{mobileToDesktop:true});return getLowestVersions(t)}function getTargets(e={},t={}){var r;let{browsers:a,esmodules:n}=e;const{configPath:i="."}=t;validateBrowsers(a);const l=generateTargets(e);let c=validateTargetNames(l);const u=!!a;const p=u||Object.keys(c).length>0;const f=!t.ignoreBrowserslistConfig&&!p;if(!a&&f){a=s.loadConfig({config:t.configFile,path:i,env:t.browserslistEnv});if(a==null){{a=[]}}}if(n&&(n!=="intersect"||!((r=a)!=null&&r.length))){a=Object.keys(d).map((e=>`${e} >= ${d[e]}`)).join(", ");n=false}if(a){const e=resolveTargets(a);if(n==="intersect"){for(const t of Object.keys(e)){const r=e[t];if(d[t]){e[t]=(0,o.getHighestUnreleased)(r,(0,o.semverify)(d[t]),t)}else{delete e[t]}}}c=Object.assign(e,c)}const y={};const g=[];for(const e of Object.keys(c).sort()){var h;const t=c[e];if(typeof t==="number"&&t%1!==0){g.push({target:e,value:t})}const r=(h=m[e])!=null?h:m.__default;const[s,a]=r(e,t);if(a){y[s]=a}}outputDecimalWarning(g);return y}},5748:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.TargetNames=void 0;const r={node:"node",chrome:"chrome",opera:"opera",edge:"edge",firefox:"firefox",safari:"safari",ie:"ie",ios:"ios",android:"android",electron:"electron",samsung:"samsung"};t.TargetNames=r},4794:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.prettifyVersion=prettifyVersion;t.prettifyTargets=prettifyTargets;var s=r(7849);var a=r(6555);function prettifyVersion(e){if(typeof e!=="string"){return e}const t=[s.major(e)];const r=s.minor(e);const a=s.patch(e);if(r||a){t.push(r)}if(a){t.push(a)}return t.join(".")}function prettifyTargets(e){return Object.keys(e).reduce(((t,r)=>{let s=e[r];const n=a.unreleasedLabels[r];if(typeof s==="string"&&n!==s){s=prettifyVersion(s)}t[r]=s;return t}),{})}},6555:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.browserNameMap=t.unreleasedLabels=void 0;const r={safari:"tp"};t.unreleasedLabels=r;const s={and_chr:"chrome",and_ff:"firefox",android:"android",chrome:"chrome",edge:"edge",firefox:"firefox",ie:"ie",ie_mob:"ie",ios_saf:"ios",node:"node",op_mob:"opera",opera:"opera",safari:"safari",samsung:"samsung"};t.browserNameMap=s},3406:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.semverMin=semverMin;t.semverify=semverify;t.isUnreleasedVersion=isUnreleasedVersion;t.getLowestUnreleased=getLowestUnreleased;t.getHighestUnreleased=getHighestUnreleased;t.getLowestImplementedVersion=getLowestImplementedVersion;var s=r(7849);var a=r(7347);var n=r(6555);const o=/^(\d+|\d+.\d+)$/;const i=new a.OptionValidator("@babel/helper-compilation-targets");function semverMin(e,t){return e&&s.lt(e,t)?e:t}function semverify(e){if(typeof e==="string"&&s.valid(e)){return e}i.invariant(typeof e==="number"||typeof e==="string"&&o.test(e),`'${e}' is not a valid version`);const t=e.toString().split(".");while(t.length<3){t.push("0")}return t.join(".")}function isUnreleasedVersion(e,t){const r=n.unreleasedLabels[t];return!!r&&r===e.toString().toLowerCase()}function getLowestUnreleased(e,t,r){const s=n.unreleasedLabels[r];const a=[e,t].some((e=>e===s));if(a){return e===a?t:e||t}return semverMin(e,t)}function getHighestUnreleased(e,t,r){return getLowestUnreleased(e,t,r)===e?t:e}function getLowestImplementedVersion(e,t){const r=e[t];if(!r&&t==="android"){return e.chrome}return r}},6429:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasOwnDecorators=hasOwnDecorators;t.hasDecorators=hasDecorators;t.buildDecoratedClass=buildDecoratedClass;var s=r(8304);var a=r(6833);var n=r(550);function hasOwnDecorators(e){return!!(e.decorators&&e.decorators.length)}function hasDecorators(e){return hasOwnDecorators(e)||e.body.body.some(hasOwnDecorators)}function prop(e,t){if(!t)return null;return s.types.objectProperty(s.types.identifier(e),t)}function method(e,t){return s.types.objectMethod("method",s.types.identifier(e),[],s.types.blockStatement(t))}function takeDecorators(e){let t;if(e.decorators&&e.decorators.length>0){t=s.types.arrayExpression(e.decorators.map((e=>e.expression)))}e.decorators=undefined;return t}function getKey(e){if(e.computed){return e.key}else if(s.types.isIdentifier(e.key)){return s.types.stringLiteral(e.key.name)}else{return s.types.stringLiteral(String(e.key.value))}}function extractElementDescriptor(e,t,r){const{node:o,scope:i}=r;const l=r.isClassMethod();if(r.isPrivate()){throw r.buildCodeFrameError(`Private ${l?"methods":"fields"} in decorated classes are not supported yet.`)}new a.default({methodPath:r,objectRef:e,superRef:t,file:this,refToPreserve:e}).replace();const c=[prop("kind",s.types.stringLiteral(l?o.kind:"field")),prop("decorators",takeDecorators(o)),prop("static",o.static&&s.types.booleanLiteral(true)),prop("key",getKey(o))].filter(Boolean);if(l){const e=o.computed?null:o.key;s.types.toExpression(o);c.push(prop("value",(0,n.default)({node:o,id:e,scope:i})||o))}else if(o.value){c.push(method("value",s.template.statements.ast`return ${o.value}`))}else{c.push(prop("value",i.buildUndefinedNode()))}r.remove();return s.types.objectExpression(c)}function addDecorateHelper(e){try{return e.addHelper("decorate")}catch(e){if(e.code==="BABEL_HELPER_UNKNOWN"){e.message+="\n '@babel/plugin-transform-decorators' in non-legacy mode"+" requires '@babel/core' version ^7.0.2 and you appear to be using"+" an older version."}throw e}}function buildDecoratedClass(e,t,r,a){const{node:n,scope:o}=t;const i=o.generateUidIdentifier("initialize");const l=n.id&&t.isDeclaration();const c=t.isInStrictMode();const{superClass:u}=n;n.type="ClassDeclaration";if(!n.id)n.id=s.types.cloneNode(e);let p;if(u){p=o.generateUidIdentifierBasedOnNode(n.superClass,"super");n.superClass=p}const d=takeDecorators(n);const f=s.types.arrayExpression(r.filter((e=>!e.node.abstract)).map(extractElementDescriptor.bind(a,n.id,p)));const m=s.template.expression.ast` ${addDecorateHelper(a)}( - ${f||s.types.nullLiteral()}, + ${d||s.types.nullLiteral()}, function (${i}, ${u?s.types.cloneNode(p):null}) { ${n} - return { F: ${s.types.cloneNode(n.id)}, d: ${d} }; + return { F: ${s.types.cloneNode(n.id)}, d: ${f} }; }, ${u} ) - `;if(!c){m.arguments[1].body.directives.push(s.types.directive(s.types.directiveLiteral("use strict")))}let y=m;let g="arguments.1.body.body.0";if(l){y=s.template.statement.ast`let ${e} = ${m}`;g="declarations.0.init."+g}return{instanceNodes:[s.template.statement.ast`${s.types.cloneNode(i)}(this)`],wrapClass(e){e.replaceWith(y);return e.get(g)}}}},7497:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.enableFeature=enableFeature;t.isLoose=isLoose;t.verifyUsedFeatures=verifyUsedFeatures;t.FEATURES=void 0;var s=r(6429);const a=Object.freeze({fields:1<<1,privateMethods:1<<2,decorators:1<<3,privateIn:1<<4,staticBlocks:1<<5});t.FEATURES=a;const n=new Map([[a.fields,"@babel/plugin-proposal-class-properties"],[a.privateMethods,"@babel/plugin-proposal-private-methods"],[a.privateIn,"@babel/plugin-proposal-private-property-in-object"]]);const o="@babel/plugin-class-features/featuresKey";const i="@babel/plugin-class-features/looseKey";const l="@babel/plugin-class-features/looseLowPriorityKey/#__internal__@babel/preset-env__please-overwrite-loose-instead-of-throwing";function enableFeature(e,t,r){if(!hasFeature(e,t)||canIgnoreLoose(e,t)){e.set(o,e.get(o)|t);if(r==="#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error"){setLoose(e,t,true);e.set(l,e.get(l)|t)}else if(r==="#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"){setLoose(e,t,false);e.set(l,e.get(l)|t)}else{setLoose(e,t,r)}}let s;let a;for(const[t,r]of n){if(!hasFeature(e,t))continue;const n=isLoose(e,t);if(canIgnoreLoose(e,t)){continue}else if(s===!n){throw new Error("'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, "+"@babel/plugin-proposal-private-methods and "+"@babel/plugin-proposal-private-property-in-object (when they are enabled).")}else{s=n;a=r}}if(s!==undefined){for(const[t,r]of n){if(hasFeature(e,t)&&isLoose(e,t)!==s){setLoose(e,t,s);console.warn(`Though the "loose" option was set to "${!s}" in your @babel/preset-env `+`config, it will not be used for ${r} since the "loose" mode option was set to `+`"${s}" for ${a}.\nThe "loose" option must be the `+`same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods `+`and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can `+`silence this warning by explicitly adding\n`+`\t["${r}", { "loose": ${s} }]\n`+`to the "plugins" section of your Babel config.`)}}}}function hasFeature(e,t){return!!(e.get(o)&t)}function isLoose(e,t){return!!(e.get(i)&t)}function setLoose(e,t,r){if(r)e.set(i,e.get(i)|t);else e.set(i,e.get(i)&~t);e.set(l,e.get(l)&~t)}function canIgnoreLoose(e,t){return!!(e.get(l)&t)}function verifyUsedFeatures(e,t){if((0,s.hasOwnDecorators)(e.node)){if(!hasFeature(t,a.decorators)){throw e.buildCodeFrameError("Decorators are not enabled."+"\nIf you are using "+'["@babel/plugin-proposal-decorators", { "legacy": true }], '+'make sure it comes *before* "@babel/plugin-proposal-class-properties" '+"and enable loose mode, like so:\n"+'\t["@babel/plugin-proposal-decorators", { "legacy": true }]\n'+'\t["@babel/plugin-proposal-class-properties", { "loose": true }]')}if(e.isPrivate()){throw e.buildCodeFrameError(`Private ${e.isClassMethod()?"methods":"fields"} in decorated classes are not supported yet.`)}}if(e.isPrivateMethod!=null&&e.isPrivateMethod()){if(!hasFeature(t,a.privateMethods)){throw e.buildCodeFrameError("Class private methods are not enabled.")}}if(e.isPrivateName()&&e.parentPath.isBinaryExpression({operator:"in",left:e.node})){if(!hasFeature(t,a.privateIn)){throw e.buildCodeFrameError("Private property in checks are not enabled.")}}if(e.isProperty()){if(!hasFeature(t,a.fields)){throw e.buildCodeFrameError("Class fields are not enabled.")}}if(e.isStaticBlock!=null&&e.isStaticBlock()){if(!hasFeature(t,a.staticBlocks)){throw e.buildCodeFrameError("Static class blocks are not enabled. "+"Please add `@babel/plugin-proposal-class-static-block` to your configuration.")}}}},3647:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.buildPrivateNamesMap=buildPrivateNamesMap;t.buildPrivateNamesNodes=buildPrivateNamesNodes;t.transformPrivateNamesUsage=transformPrivateNamesUsage;t.buildFieldsInitNodes=buildFieldsInitNodes;var s=r(8304);var a=r(6833);var n=r(3316);var o=r(6721);var i=r(2155);var l=r(6339);function buildPrivateNamesMap(e){const t=new Map;for(const r of e){const e=r.isPrivate();const s=!r.isProperty();const a=!r.node.static;if(e){const{name:e}=r.node.key.id;const n=t.has(e)?t.get(e):{id:r.scope.generateUidIdentifier(e),static:!a,method:s};if(r.node.kind==="get"){n.getId=r.scope.generateUidIdentifier(`get_${e}`)}else if(r.node.kind==="set"){n.setId=r.scope.generateUidIdentifier(`set_${e}`)}else if(r.node.kind==="method"){n.methodId=r.scope.generateUidIdentifier(e)}t.set(e,n)}}return t}function buildPrivateNamesNodes(e,t,r){const a=[];for(const[n,o]of e){const{static:e,method:l,getId:c,setId:u}=o;const p=c||u;const f=s.types.cloneNode(o.id);let d;if(t){d=s.types.callExpression(r.addHelper("classPrivateFieldLooseKey"),[s.types.stringLiteral(n)])}else if(!e){d=s.types.newExpression(s.types.identifier(!l||p?"WeakMap":"WeakSet"),[])}if(d){(0,i.default)(d);a.push(s.template.statement.ast`var ${f} = ${d}`)}}return a}function privateNameVisitorFactory(e){const t=Object.assign({},e,{Class(e){const{privateNamesMap:s}=this;const a=e.get("body.body");const n=new Map(s);const o=[];for(const e of a){if(!e.isPrivate())continue;const{name:t}=e.node.key.id;n.delete(t);o.push(t)}if(!o.length){return}e.get("body").traverse(r,Object.assign({},this,{redeclared:o}));e.traverse(t,Object.assign({},this,{privateNamesMap:n}));e.skipKey("body")}});const r=s.traverse.visitors.merge([Object.assign({},e),a.environmentVisitor]);return t}const c=privateNameVisitorFactory({PrivateName(e,{noDocumentAll:t}){const{privateNamesMap:r,redeclared:s}=this;const{node:a,parentPath:n}=e;if(!n.isMemberExpression({property:a})&&!n.isOptionalMemberExpression({property:a})){return}const{name:o}=a.id;if(!r.has(o))return;if(s&&s.includes(o))return;this.handle(n,t)}});const u=privateNameVisitorFactory({BinaryExpression(e){const{operator:t,left:r,right:a}=e.node;if(t!=="in")return;if(!e.get("left").isPrivateName())return;const{privateFieldsAsProperties:n,privateNamesMap:o,redeclared:i}=this;const{name:l}=r.id;if(!o.has(l))return;if(i&&i.includes(l))return;if(n){const{id:t}=o.get(l);e.replaceWith(s.template.expression.ast` + `;if(!c){m.arguments[1].body.directives.push(s.types.directive(s.types.directiveLiteral("use strict")))}let y=m;let g="arguments.1.body.body.0";if(l){y=s.template.statement.ast`let ${e} = ${m}`;g="declarations.0.init."+g}return{instanceNodes:[s.template.statement.ast`${s.types.cloneNode(i)}(this)`],wrapClass(e){e.replaceWith(y);return e.get(g)}}}},7497:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.enableFeature=enableFeature;t.isLoose=isLoose;t.verifyUsedFeatures=verifyUsedFeatures;t.FEATURES=void 0;var s=r(6429);const a=Object.freeze({fields:1<<1,privateMethods:1<<2,decorators:1<<3,privateIn:1<<4,staticBlocks:1<<5});t.FEATURES=a;const n=new Map([[a.fields,"@babel/plugin-proposal-class-properties"],[a.privateMethods,"@babel/plugin-proposal-private-methods"],[a.privateIn,"@babel/plugin-proposal-private-property-in-object"]]);const o="@babel/plugin-class-features/featuresKey";const i="@babel/plugin-class-features/looseKey";const l="@babel/plugin-class-features/looseLowPriorityKey/#__internal__@babel/preset-env__please-overwrite-loose-instead-of-throwing";function enableFeature(e,t,r){if(!hasFeature(e,t)||canIgnoreLoose(e,t)){e.set(o,e.get(o)|t);if(r==="#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error"){setLoose(e,t,true);e.set(l,e.get(l)|t)}else if(r==="#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"){setLoose(e,t,false);e.set(l,e.get(l)|t)}else{setLoose(e,t,r)}}let s;let a;for(const[t,r]of n){if(!hasFeature(e,t))continue;const n=isLoose(e,t);if(canIgnoreLoose(e,t)){continue}else if(s===!n){throw new Error("'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, "+"@babel/plugin-proposal-private-methods and "+"@babel/plugin-proposal-private-property-in-object (when they are enabled).")}else{s=n;a=r}}if(s!==undefined){for(const[t,r]of n){if(hasFeature(e,t)&&isLoose(e,t)!==s){setLoose(e,t,s);console.warn(`Though the "loose" option was set to "${!s}" in your @babel/preset-env `+`config, it will not be used for ${r} since the "loose" mode option was set to `+`"${s}" for ${a}.\nThe "loose" option must be the `+`same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods `+`and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can `+`silence this warning by explicitly adding\n`+`\t["${r}", { "loose": ${s} }]\n`+`to the "plugins" section of your Babel config.`)}}}}function hasFeature(e,t){return!!(e.get(o)&t)}function isLoose(e,t){return!!(e.get(i)&t)}function setLoose(e,t,r){if(r)e.set(i,e.get(i)|t);else e.set(i,e.get(i)&~t);e.set(l,e.get(l)&~t)}function canIgnoreLoose(e,t){return!!(e.get(l)&t)}function verifyUsedFeatures(e,t){if((0,s.hasOwnDecorators)(e.node)){if(!hasFeature(t,a.decorators)){throw e.buildCodeFrameError("Decorators are not enabled."+"\nIf you are using "+'["@babel/plugin-proposal-decorators", { "legacy": true }], '+'make sure it comes *before* "@babel/plugin-proposal-class-properties" '+"and enable loose mode, like so:\n"+'\t["@babel/plugin-proposal-decorators", { "legacy": true }]\n'+'\t["@babel/plugin-proposal-class-properties", { "loose": true }]')}if(e.isPrivate()){throw e.buildCodeFrameError(`Private ${e.isClassMethod()?"methods":"fields"} in decorated classes are not supported yet.`)}}if(e.isPrivateMethod!=null&&e.isPrivateMethod()){if(!hasFeature(t,a.privateMethods)){throw e.buildCodeFrameError("Class private methods are not enabled.")}}if(e.isPrivateName()&&e.parentPath.isBinaryExpression({operator:"in",left:e.node})){if(!hasFeature(t,a.privateIn)){throw e.buildCodeFrameError("Private property in checks are not enabled.")}}if(e.isProperty()){if(!hasFeature(t,a.fields)){throw e.buildCodeFrameError("Class fields are not enabled.")}}if(e.isStaticBlock!=null&&e.isStaticBlock()){if(!hasFeature(t,a.staticBlocks)){throw e.buildCodeFrameError("Static class blocks are not enabled. "+"Please add `@babel/plugin-proposal-class-static-block` to your configuration.")}}}},3647:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.buildPrivateNamesMap=buildPrivateNamesMap;t.buildPrivateNamesNodes=buildPrivateNamesNodes;t.transformPrivateNamesUsage=transformPrivateNamesUsage;t.buildFieldsInitNodes=buildFieldsInitNodes;var s=r(8304);var a=r(6833);var n=r(3316);var o=r(6721);var i=r(2155);var l=r(6782);function buildPrivateNamesMap(e){const t=new Map;for(const r of e){const e=r.isPrivate();const s=!r.isProperty();const a=!r.node.static;if(e){const{name:e}=r.node.key.id;const n=t.has(e)?t.get(e):{id:r.scope.generateUidIdentifier(e),static:!a,method:s};if(r.node.kind==="get"){n.getId=r.scope.generateUidIdentifier(`get_${e}`)}else if(r.node.kind==="set"){n.setId=r.scope.generateUidIdentifier(`set_${e}`)}else if(r.node.kind==="method"){n.methodId=r.scope.generateUidIdentifier(e)}t.set(e,n)}}return t}function buildPrivateNamesNodes(e,t,r){const a=[];for(const[n,o]of e){const{static:e,method:l,getId:c,setId:u}=o;const p=c||u;const d=s.types.cloneNode(o.id);let f;if(t){f=s.types.callExpression(r.addHelper("classPrivateFieldLooseKey"),[s.types.stringLiteral(n)])}else if(!e){f=s.types.newExpression(s.types.identifier(!l||p?"WeakMap":"WeakSet"),[])}if(f){(0,i.default)(f);a.push(s.template.statement.ast`var ${d} = ${f}`)}}return a}function privateNameVisitorFactory(e){const t=Object.assign({},e,{Class(e){const{privateNamesMap:s}=this;const a=e.get("body.body");const n=new Map(s);const o=[];for(const e of a){if(!e.isPrivate())continue;const{name:t}=e.node.key.id;n.delete(t);o.push(t)}if(!o.length){return}e.get("body").traverse(r,Object.assign({},this,{redeclared:o}));e.traverse(t,Object.assign({},this,{privateNamesMap:n}));e.skipKey("body")}});const r=s.traverse.visitors.merge([Object.assign({},e),a.environmentVisitor]);return t}const c=privateNameVisitorFactory({PrivateName(e,{noDocumentAll:t}){const{privateNamesMap:r,redeclared:s}=this;const{node:a,parentPath:n}=e;if(!n.isMemberExpression({property:a})&&!n.isOptionalMemberExpression({property:a})){return}const{name:o}=a.id;if(!r.has(o))return;if(s&&s.includes(o))return;this.handle(n,t)}});const u=privateNameVisitorFactory({BinaryExpression(e){const{operator:t,left:r,right:a}=e.node;if(t!=="in")return;if(!e.get("left").isPrivateName())return;const{privateFieldsAsProperties:n,privateNamesMap:o,redeclared:i}=this;const{name:l}=r.id;if(!o.has(l))return;if(i&&i.includes(l))return;if(n){const{id:t}=o.get(l);e.replaceWith(s.template.expression.ast` Object.prototype.hasOwnProperty.call(${a}, ${s.types.cloneNode(t)}) - `);return}const{id:c,static:u}=o.get(l);if(u){e.replaceWith(s.template.expression.ast`${a} === ${this.classRef}`);return}e.replaceWith(s.template.expression.ast`${s.types.cloneNode(c)}.has(${a})`)}});const p={memoise(e,t){const{scope:r}=e;const{object:s}=e.node;const a=r.maybeGenerateMemoised(s);if(!a){return}this.memoiser.set(s,a,t)},receiver(e){const{object:t}=e.node;if(this.memoiser.has(t)){return s.types.cloneNode(this.memoiser.get(t))}return s.types.cloneNode(t)},get(e){const{classRef:t,privateNamesMap:r,file:a}=this;const{name:n}=e.node.property.id;const{id:o,static:i,method:l,methodId:c,getId:u,setId:p}=r.get(n);const f=u||p;if(i){const r=l&&!f?"classStaticPrivateMethodGet":"classStaticPrivateFieldSpecGet";return s.types.callExpression(a.addHelper(r),[this.receiver(e),s.types.cloneNode(t),s.types.cloneNode(o)])}if(l){if(f){if(!u&&p){if(a.availableHelper("writeOnlyError")){return s.types.sequenceExpression([this.receiver(e),s.types.callExpression(a.addHelper("writeOnlyError"),[s.types.stringLiteral(`#${n}`)])])}console.warn(`@babel/helpers is outdated, update it to silence this warning.`)}return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])}return s.types.callExpression(a.addHelper("classPrivateMethodGet"),[this.receiver(e),s.types.cloneNode(o),s.types.cloneNode(c)])}return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])},boundGet(e){this.memoise(e,1);return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[this.receiver(e)])},set(e,t){const{classRef:r,privateNamesMap:a,file:n}=this;const{name:o}=e.node.property.id;const{id:i,static:l,method:c,setId:u,getId:p}=a.get(o);const f=p||u;if(l){const a=c&&!f?"classStaticPrivateMethodSet":"classStaticPrivateFieldSpecSet";return s.types.callExpression(n.addHelper(a),[this.receiver(e),s.types.cloneNode(r),s.types.cloneNode(i),t])}if(c){if(u){return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])}return s.types.sequenceExpression([this.receiver(e),t,s.types.callExpression(n.addHelper("readOnlyError"),[s.types.stringLiteral(`#${o}`)])])}return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])},destructureSet(e){const{classRef:t,privateNamesMap:r,file:a}=this;const{name:n}=e.node.property.id;const{id:o,static:i}=r.get(n);if(i){try{var l=a.addHelper("classStaticPrivateFieldDestructureSet")}catch(e){throw new Error("Babel can not transpile `[C.#p] = [0]` with @babel/helpers < 7.13.10, \n"+"please update @babel/helpers to the latest version.")}return s.types.memberExpression(s.types.callExpression(l,[this.receiver(e),s.types.cloneNode(t),s.types.cloneNode(o)]),s.types.identifier("value"))}return s.types.memberExpression(s.types.callExpression(a.addHelper("classPrivateFieldDestructureSet"),[this.receiver(e),s.types.cloneNode(o)]),s.types.identifier("value"))},call(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,false)},optionalCall(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,true)}};const f={get(e){const{privateNamesMap:t,file:r}=this;const{object:a}=e.node;const{name:n}=e.node.property.id;return s.template.expression`BASE(REF, PROP)[PROP]`({BASE:r.addHelper("classPrivateFieldLooseBase"),REF:s.types.cloneNode(a),PROP:s.types.cloneNode(t.get(n).id)})},boundGet(e){return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[s.types.cloneNode(e.node.object)])},simpleSet(e){return this.get(e)},destructureSet(e){return this.get(e)},call(e,t){return s.types.callExpression(this.get(e),t)},optionalCall(e,t){return s.types.optionalCallExpression(this.get(e),t,true)}};function transformPrivateNamesUsage(e,t,r,{privateFieldsAsProperties:s,noDocumentAll:a},o){if(!r.size)return;const i=t.get("body");const l=s?f:p;(0,n.default)(i,c,Object.assign({privateNamesMap:r,classRef:e,file:o},l,{noDocumentAll:a}));i.traverse(u,{privateNamesMap:r,classRef:e,file:o,privateFieldsAsProperties:s})}function buildPrivateFieldInitLoose(e,t,r){const{id:a}=r.get(t.node.key.id.name);const n=t.node.value||t.scope.buildUndefinedNode();return s.template.statement.ast` + `);return}const{id:c,static:u}=o.get(l);if(u){e.replaceWith(s.template.expression.ast`${a} === ${this.classRef}`);return}e.replaceWith(s.template.expression.ast`${s.types.cloneNode(c)}.has(${a})`)}});const p={memoise(e,t){const{scope:r}=e;const{object:s}=e.node;const a=r.maybeGenerateMemoised(s);if(!a){return}this.memoiser.set(s,a,t)},receiver(e){const{object:t}=e.node;if(this.memoiser.has(t)){return s.types.cloneNode(this.memoiser.get(t))}return s.types.cloneNode(t)},get(e){const{classRef:t,privateNamesMap:r,file:a}=this;const{name:n}=e.node.property.id;const{id:o,static:i,method:l,methodId:c,getId:u,setId:p}=r.get(n);const d=u||p;if(i){const r=l&&!d?"classStaticPrivateMethodGet":"classStaticPrivateFieldSpecGet";return s.types.callExpression(a.addHelper(r),[this.receiver(e),s.types.cloneNode(t),s.types.cloneNode(o)])}if(l){if(d){if(!u&&p){if(a.availableHelper("writeOnlyError")){return s.types.sequenceExpression([this.receiver(e),s.types.callExpression(a.addHelper("writeOnlyError"),[s.types.stringLiteral(`#${n}`)])])}console.warn(`@babel/helpers is outdated, update it to silence this warning.`)}return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])}return s.types.callExpression(a.addHelper("classPrivateMethodGet"),[this.receiver(e),s.types.cloneNode(o),s.types.cloneNode(c)])}return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])},boundGet(e){this.memoise(e,1);return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[this.receiver(e)])},set(e,t){const{classRef:r,privateNamesMap:a,file:n}=this;const{name:o}=e.node.property.id;const{id:i,static:l,method:c,setId:u,getId:p}=a.get(o);const d=p||u;if(l){const a=c&&!d?"classStaticPrivateMethodSet":"classStaticPrivateFieldSpecSet";return s.types.callExpression(n.addHelper(a),[this.receiver(e),s.types.cloneNode(r),s.types.cloneNode(i),t])}if(c){if(u){return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])}return s.types.sequenceExpression([this.receiver(e),t,s.types.callExpression(n.addHelper("readOnlyError"),[s.types.stringLiteral(`#${o}`)])])}return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])},destructureSet(e){const{classRef:t,privateNamesMap:r,file:a}=this;const{name:n}=e.node.property.id;const{id:o,static:i}=r.get(n);if(i){try{var l=a.addHelper("classStaticPrivateFieldDestructureSet")}catch(e){throw new Error("Babel can not transpile `[C.#p] = [0]` with @babel/helpers < 7.13.10, \n"+"please update @babel/helpers to the latest version.")}return s.types.memberExpression(s.types.callExpression(l,[this.receiver(e),s.types.cloneNode(t),s.types.cloneNode(o)]),s.types.identifier("value"))}return s.types.memberExpression(s.types.callExpression(a.addHelper("classPrivateFieldDestructureSet"),[this.receiver(e),s.types.cloneNode(o)]),s.types.identifier("value"))},call(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,false)},optionalCall(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,true)}};const d={get(e){const{privateNamesMap:t,file:r}=this;const{object:a}=e.node;const{name:n}=e.node.property.id;return s.template.expression`BASE(REF, PROP)[PROP]`({BASE:r.addHelper("classPrivateFieldLooseBase"),REF:s.types.cloneNode(a),PROP:s.types.cloneNode(t.get(n).id)})},boundGet(e){return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[s.types.cloneNode(e.node.object)])},simpleSet(e){return this.get(e)},destructureSet(e){return this.get(e)},call(e,t){return s.types.callExpression(this.get(e),t)},optionalCall(e,t){return s.types.optionalCallExpression(this.get(e),t,true)}};function transformPrivateNamesUsage(e,t,r,{privateFieldsAsProperties:s,noDocumentAll:a},o){if(!r.size)return;const i=t.get("body");const l=s?d:p;(0,n.default)(i,c,Object.assign({privateNamesMap:r,classRef:e,file:o},l,{noDocumentAll:a}));i.traverse(u,{privateNamesMap:r,classRef:e,file:o,privateFieldsAsProperties:s})}function buildPrivateFieldInitLoose(e,t,r){const{id:a}=r.get(t.node.key.id.name);const n=t.node.value||t.scope.buildUndefinedNode();return s.template.statement.ast` Object.defineProperty(${e}, ${s.types.cloneNode(a)}, { // configurable is false by default // enumerable is false by default @@ -71,16 +71,91 @@ // writable is false by default value: ${i.name} }); - `}function buildPrivateMethodDeclaration(e,t,r=false){const a=t.get(e.node.key.id.name);const{id:n,methodId:o,getId:i,setId:l,getterDeclared:c,setterDeclared:u,static:p}=a;const{params:f,body:d,generator:m,async:y}=e.node;const g=i&&!c&&f.length===0;const h=l&&!u&&f.length>0;let b=o;if(g){t.set(e.node.key.id.name,Object.assign({},a,{getterDeclared:true}));b=i}else if(h){t.set(e.node.key.id.name,Object.assign({},a,{setterDeclared:true}));b=l}else if(p&&!r){b=n}return s.types.functionDeclaration(s.types.cloneNode(b),f,d,m,y)}const d=s.traverse.visitors.merge([{ThisExpression(e,t){t.needsClassRef=true;e.replaceWith(s.types.cloneNode(t.classRef))}},a.environmentVisitor]);const m={ReferencedIdentifier(e,t){if(e.scope.bindingIdentifierEquals(e.node.name,t.innerBinding)){t.needsClassRef=true;e.node.name=t.classRef.name}}};function replaceThisContext(e,t,r,n,o,i,l){var c;const u={classRef:t,needsClassRef:false,innerBinding:l};const p=new a.default({methodPath:e,constantSuper:i,file:n,refToPreserve:t,getSuperRef:r,getObjectRef(){u.needsClassRef=true;return o||e.node.static?t:s.types.memberExpression(t,s.types.identifier("prototype"))}});p.replace();if(o||e.isProperty()){e.traverse(d,u)}if((c=u.classRef)!=null&&c.name&&u.classRef.name!==(l==null?void 0:l.name)){e.traverse(m,u)}return u.needsClassRef}function buildFieldsInitNodes(e,t,r,a,n,o,i,c,u){let p=false;let f;const d=[];const m=[];const y=[];const g=s.types.isIdentifier(t)?()=>t:()=>{var e;(e=f)!=null?e:f=r[0].scope.generateUidIdentifierBasedOnNode(t);return f};for(const t of r){l.assertFieldTransformed(t);const r=t.node.static;const f=!r;const h=t.isPrivate();const b=!h;const x=t.isProperty();const v=!x;const E=t.isStaticBlock==null?void 0:t.isStaticBlock();if(r||v&&h||E){const r=replaceThisContext(t,e,g,n,E,c,u);p=p||r}switch(true){case E:d.push(s.template.statement.ast`(() => ${s.types.blockStatement(t.node.body)})()`);break;case r&&h&&x&&i:p=true;d.push(buildPrivateFieldInitLoose(s.types.cloneNode(e),t,a));break;case r&&h&&x&&!i:p=true;d.push(buildPrivateStaticFieldInitSpec(t,a));break;case r&&b&&x&&o:p=true;d.push(buildPublicFieldInitLoose(s.types.cloneNode(e),t));break;case r&&b&&x&&!o:p=true;d.push(buildPublicFieldInitSpec(s.types.cloneNode(e),t,n));break;case f&&h&&x&&i:m.push(buildPrivateFieldInitLoose(s.types.thisExpression(),t,a));break;case f&&h&&x&&!i:m.push(buildPrivateInstanceFieldInitSpec(s.types.thisExpression(),t,a));break;case f&&h&&v&&i:m.unshift(buildPrivateMethodInitLoose(s.types.thisExpression(),t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case f&&h&&v&&!i:m.unshift(buildPrivateInstanceMethodInitSpec(s.types.thisExpression(),t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case r&&h&&v&&!i:p=true;d.unshift(buildPrivateStaticFieldInitSpec(t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case r&&h&&v&&i:p=true;d.unshift(buildPrivateStaticMethodInitLoose(s.types.cloneNode(e),t,n,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case f&&b&&x&&o:m.push(buildPublicFieldInitLoose(s.types.thisExpression(),t));break;case f&&b&&x&&!o:m.push(buildPublicFieldInitSpec(s.types.thisExpression(),t,n));break;default:throw new Error("Unreachable.")}}return{staticNodes:d.filter(Boolean),instanceNodes:m.filter(Boolean),pureStaticNodes:y.filter(Boolean),wrapClass(t){for(const e of r){e.remove()}if(f){t.scope.push({id:s.types.cloneNode(f)});t.set("superClass",s.types.assignmentExpression("=",f,t.node.superClass))}if(!p)return t;if(t.isClassExpression()){t.scope.push({id:e});t.replaceWith(s.types.assignmentExpression("=",s.types.cloneNode(e),t.node))}else if(!t.node.id){t.node.id=e}return t}}}},6758:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.createClassFeaturePlugin=createClassFeaturePlugin;Object.defineProperty(t,"injectInitialization",{enumerable:true,get:function(){return l.injectInitialization}});Object.defineProperty(t,"enableFeature",{enumerable:true,get:function(){return c.enableFeature}});Object.defineProperty(t,"FEATURES",{enumerable:true,get:function(){return c.FEATURES}});var s=r(8304);var a=r(550);var n=r(7058);var o=r(3647);var i=r(6429);var l=r(5617);var c=r(7497);const u="7.14.6".split(".").reduce(((e,t)=>e*1e5+ +t),0);const p="@babel/plugin-class-features/version";function createClassFeaturePlugin({name:e,feature:t,loose:r,manipulateOptions:f,api:d={assumption:()=>{}}}){const m=d.assumption("setPublicClassFields");const y=d.assumption("privateFieldsAsProperties");const g=d.assumption("constantSuper");const h=d.assumption("noDocumentAll");if(r===true){const t=[];if(m!==undefined){t.push(`"setPublicClassFields"`)}if(y!==undefined){t.push(`"privateFieldsAsProperties"`)}if(t.length!==0){console.warn(`[${e}]: You are using the "loose: true" option and you are`+` explicitly setting a value for the ${t.join(" and ")}`+` assumption${t.length>1?"s":""}. The "loose" option`+` can cause incompatibilities with the other class features`+` plugins, so it's recommended that you replace it with the`+` following top-level option:\n`+`\t"assumptions": {\n`+`\t\t"setPublicClassFields": true,\n`+`\t\t"privateFieldsAsProperties": true\n`+`\t}`)}}return{name:e,manipulateOptions:f,pre(){(0,c.enableFeature)(this.file,t,r);if(!this.file.get(p)||this.file.get(p)0){(0,l.injectInitialization)(e,f,D,((e,t)=>{if(d)return;for(const r of b){if(r.node.static)continue;r.traverse(e,t)}}))}e=C(e);e.insertBefore([...k,...O]);if(I.length>0){e.insertAfter(I)}if(P.length>0){e.find((e=>e.isStatement()||e.isDeclaration())).insertAfter(P)}},PrivateName(e){if(this.file.get(p)!==u||e.parentPath.isPrivate({key:e.node})){return}throw e.buildCodeFrameError(`Unknown PrivateName "${e}"`)},ExportDefaultDeclaration(e){if(this.file.get(p)!==u)return;const t=e.get("declaration");if(t.isClassDeclaration()&&(0,i.hasDecorators)(t.node)){if(t.node.id){(0,n.default)(e)}else{t.node.type="ClassExpression"}}}}}}},5617:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.injectInitialization=injectInitialization;t.extractComputedKeys=extractComputedKeys;var s=r(8304);var a=r(6833);const n=s.traverse.visitors.merge([{Super(e){const{node:t,parentPath:r}=e;if(r.isCallExpression({callee:t})){this.push(r)}}},a.environmentVisitor]);const o={"TSTypeAnnotation|TypeAnnotation"(e){e.skip()},ReferencedIdentifier(e){if(this.scope.hasOwnBinding(e.node.name)){this.scope.rename(e.node.name);e.skip()}}};function handleClassTDZ(e,t){if(t.classBinding&&t.classBinding===e.scope.getBinding(e.node.name)){const r=t.file.addHelper("classNameTDZError");const a=s.types.callExpression(r,[s.types.stringLiteral(e.node.name)]);e.replaceWith(s.types.sequenceExpression([a,e.node]));e.skip()}}const i={ReferencedIdentifier:handleClassTDZ};function injectInitialization(e,t,r,a){if(!r.length)return;const i=!!e.node.superClass;if(!t){const r=s.types.classMethod("constructor",s.types.identifier("constructor"),[],s.types.blockStatement([]));if(i){r.params=[s.types.restElement(s.types.identifier("args"))];r.body.body.push(s.template.statement.ast`super(...args)`)}[t]=e.get("body").unshiftContainer("body",r)}if(a){a(o,{scope:t.scope})}if(i){const e=[];t.traverse(n,e);let a=true;for(const t of e){if(a){t.insertAfter(r);a=false}else{t.insertAfter(r.map((e=>s.types.cloneNode(e))))}}}else{t.get("body").unshiftContainer("body",r)}}function extractComputedKeys(e,t,r,a){const n=[];const o={classBinding:t.node.id&&t.scope.getBinding(t.node.id.name),file:a};for(const e of r){const r=e.get("key");if(r.isReferencedIdentifier()){handleClassTDZ(r,o)}else{r.traverse(i,o)}const a=e.node;if(!r.isConstantExpression()){const e=t.scope.generateUidIdentifierBasedOnNode(a.key);t.scope.push({id:e,kind:"let"});n.push(s.types.expressionStatement(s.types.assignmentExpression("=",s.types.cloneNode(e),a.key)));a.key=s.types.cloneNode(e)}}return n}},6339:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.assertFieldTransformed=assertFieldTransformed;function assertFieldTransformed(e){if(e.node.declare){throw e.buildCodeFrameError(`TypeScript 'declare' fields must first be transformed by `+`@babel/plugin-transform-typescript.\n`+`If you have already enabled that plugin (or '@babel/preset-typescript'), make sure `+`that it runs before any plugin related to additional class features:\n`+` - @babel/plugin-proposal-class-properties\n`+` - @babel/plugin-proposal-private-methods\n`+` - @babel/plugin-proposal-decorators`)}}},3316:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(8622);function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach((function(r){if(r!=="default"){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:true,get:function(){return e[r]}})}}))}t["default"]=e;return Object.freeze(t)}var a=_interopNamespace(s);function willPathCastToBoolean(e){const t=e;const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}class AssignmentMemoiser{constructor(){this._map=void 0;this._map=new WeakMap}has(e){return this._map.has(e)}get(e){if(!this.has(e))return;const t=this._map.get(e);const{value:r}=t;t.count--;if(t.count===0){return a.assignmentExpression("=",r,e)}return r}set(e,t,r){return this._map.set(e,{count:r,value:t})}}function toNonOptional(e,t){const{node:r}=e;if(e.isOptionalMemberExpression()){return a.memberExpression(t,r.property,r.computed)}if(e.isOptionalCallExpression()){const s=e.get("callee");if(e.node.optional&&s.isOptionalMemberExpression()){const{object:n}=s.node;const o=e.scope.maybeGenerateMemoised(n)||n;s.get("object").replaceWith(a.assignmentExpression("=",o,n));return a.callExpression(a.memberExpression(t,a.identifier("call")),[o,...r.arguments])}return a.callExpression(t,r.arguments)}return e.node}function isInDetachedTree(e){while(e){if(e.isProgram())break;const{parentPath:t,container:r,listKey:s}=e;const a=t.node;if(s){if(r!==a[s])return true}else{if(r!==a)return true}e=t}return false}const n={memoise(){},handle(e,t){const{node:r,parent:s,parentPath:n,scope:o}=e;if(e.isOptionalMemberExpression()){if(isInDetachedTree(e))return;const i=e.find((({node:t,parent:r,parentPath:s})=>{if(s.isOptionalMemberExpression()){return r.optional||r.object!==t}if(s.isOptionalCallExpression()){return t!==e.node&&r.optional||r.callee!==t}return true}));if(o.path.isPattern()){i.replaceWith(a.callExpression(a.arrowFunctionExpression([],i.node),[]));return}const l=willPathCastToBoolean(i);const c=i.parentPath;if(c.isUpdateExpression({argument:r})||c.isAssignmentExpression({left:r})){throw e.buildCodeFrameError(`can't handle assignment`)}const u=c.isUnaryExpression({operator:"delete"});if(u&&i.isOptionalMemberExpression()&&i.get("property").isPrivateName()){throw e.buildCodeFrameError(`can't delete a private class element`)}let p=e;for(;;){if(p.isOptionalMemberExpression()){if(p.node.optional)break;p=p.get("object");continue}else if(p.isOptionalCallExpression()){if(p.node.optional)break;p=p.get("callee");continue}throw new Error(`Internal error: unexpected ${p.node.type}`)}const f=p.isOptionalMemberExpression()?"object":"callee";const d=p.node[f];const m=o.maybeGenerateMemoised(d);const y=m!=null?m:d;const g=n.isOptionalCallExpression({callee:r});const h=n.isCallExpression({callee:r});p.replaceWith(toNonOptional(p,y));if(g){if(s.optional){n.replaceWith(this.optionalCall(e,s.arguments))}else{n.replaceWith(this.call(e,s.arguments))}}else if(h){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}let b=e.node;for(let t=e;t!==i;){const{parentPath:e}=t;if(e===i&&g&&s.optional){b=e.node;break}b=toNonOptional(e,b);t=e}let x;const v=i.parentPath;if(a.isMemberExpression(b)&&v.isOptionalCallExpression({callee:i.node,optional:true})){const{object:t}=b;x=e.scope.maybeGenerateMemoised(t);if(x){b.object=a.assignmentExpression("=",x,t)}}let E=i;if(u){E=v;b=v.node}const j=m?a.assignmentExpression("=",a.cloneNode(y),a.cloneNode(d)):a.cloneNode(y);if(l){let e;if(t){e=a.binaryExpression("!=",j,a.nullLiteral())}else{e=a.logicalExpression("&&",a.binaryExpression("!==",j,a.nullLiteral()),a.binaryExpression("!==",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.logicalExpression("&&",e,b))}else{let e;if(t){e=a.binaryExpression("==",j,a.nullLiteral())}else{e=a.logicalExpression("||",a.binaryExpression("===",j,a.nullLiteral()),a.binaryExpression("===",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.conditionalExpression(e,u?a.booleanLiteral(true):o.buildUndefinedNode(),b))}if(x){const e=v.node;v.replaceWith(a.optionalCallExpression(a.optionalMemberExpression(e.callee,a.identifier("call"),false,true),[a.cloneNode(x),...e.arguments],false))}return}if(n.isUpdateExpression({argument:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,prefix:o}=s;this.memoise(e,2);const i=a.binaryExpression(t[0],a.unaryExpression("+",this.get(e)),a.numericLiteral(1));if(o){n.replaceWith(this.set(e,i))}else{const{scope:t}=e;const s=t.generateUidIdentifierBasedOnNode(r);t.push({id:s});i.left=a.assignmentExpression("=",a.cloneNode(s),i.left);n.replaceWith(a.sequenceExpression([this.set(e,i),a.cloneNode(s)]))}return}if(n.isAssignmentExpression({left:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,right:r}=s;if(t==="="){n.replaceWith(this.set(e,r))}else{const s=t.slice(0,-1);if(a.LOGICAL_OPERATORS.includes(s)){this.memoise(e,1);n.replaceWith(a.logicalExpression(s,this.get(e),this.set(e,r)))}else{this.memoise(e,2);n.replaceWith(this.set(e,a.binaryExpression(s,this.get(e),r)))}}return}if(n.isCallExpression({callee:r})){n.replaceWith(this.call(e,s.arguments));return}if(n.isOptionalCallExpression({callee:r})){if(o.path.isPattern()){n.replaceWith(a.callExpression(a.arrowFunctionExpression([],n.node),[]));return}n.replaceWith(this.optionalCall(e,s.arguments));return}if(n.isForXStatement({left:r})||n.isObjectProperty({value:r})&&n.parentPath.isObjectPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isObjectProperty({value:s})&&n.parentPath.parentPath.isObjectPattern()||n.isArrayPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isArrayPattern()||n.isRestElement()){e.replaceWith(this.destructureSet(e));return}e.replaceWith(this.get(e))}};function memberExpressionToFunctions(e,t,r){e.traverse(t,Object.assign({},n,r,{memoiser:new AssignmentMemoiser}))}t["default"]=memberExpressionToFunctions},3852:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.enableFeature=enableFeature;t.hasFeature=hasFeature;t.runtimeKey=t.featuresKey=t.FEATURES=void 0;const r=Object.freeze({unicodeFlag:1<<0,dotAllFlag:1<<1,unicodePropertyEscape:1<<2,namedCaptureGroups:1<<3});t.FEATURES=r;const s="@babel/plugin-regexp-features/featuresKey";t.featuresKey=s;const a="@babel/plugin-regexp-features/runtimeKey";t.runtimeKey=a;function enableFeature(e,t){return e|t}function hasFeature(e,t){return!!(e&t)}},6550:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.createRegExpFeaturePlugin=createRegExpFeaturePlugin;var s=r(5756);var a=r(3852);var n=r(3889);var o=r(8304);var i=r(2155);function pullFlag(e,t){e.flags=e.flags.replace(t,"")}const l="7.14.5".split(".").reduce(((e,t)=>e*1e5+ +t),0);const c="@babel/plugin-regexp-features/version";function createRegExpFeaturePlugin({name:e,feature:t,options:r={}}){return{name:e,pre(){var e;const{file:s}=this;const n=(e=s.get(a.featuresKey))!=null?e:0;let o=(0,a.enableFeature)(n,a.FEATURES[t]);const{useUnicodeFlag:i,runtime:u=true}=r;if(i===false){o=(0,a.enableFeature)(o,a.FEATURES.unicodeFlag)}if(o!==n){s.set(a.featuresKey,o)}if(!u){s.set(a.runtimeKey,false)}if(!s.has(c)||s.get(c){f[e]=t}}r.pattern=s(r.pattern,r.flags,p);if(p.namedGroup&&Object.keys(f).length>0&&u&&!isRegExpTest(e)){const t=o.types.callExpression(this.addHelper("wrapRegExp"),[r,o.types.valueToNode(f)]);(0,i.default)(t);e.replaceWith(t)}if((0,a.hasFeature)(c,a.FEATURES.unicodeFlag)){pullFlag(r,"u")}if((0,a.hasFeature)(c,a.FEATURES.dotAllFlag)){pullFlag(r,"s")}}}}}function isRegExpTest(e){return e.parentPath.isMemberExpression({object:e.node,computed:false})&&e.parentPath.get("property").isIdentifier({name:"test"})}},3889:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generateRegexpuOptions=generateRegexpuOptions;var s=r(3852);function generateRegexpuOptions(e,t){let r=false,a=false,n=false,o=false;const{flags:i,pattern:l}=e;const c=i.includes("u");if(c){if(!(0,s.hasFeature)(t,s.FEATURES.unicodeFlag)){r=true}if((0,s.hasFeature)(t,s.FEATURES.unicodePropertyEscape)&&/\\[pP]{/.test(l)){n=true}}if((0,s.hasFeature)(t,s.FEATURES.dotAllFlag)&&i.indexOf("s")>=0){a=true}if((0,s.hasFeature)(t,s.FEATURES.namedCaptureGroups)&&/\(\?<(?![=!])/.test(l)){o=true}if(!o&&!n&&!a&&(!c||r)){return null}if(c&&i.indexOf("s")>=0){a=true}return{useUnicodeFlag:r,onNamedGroup:()=>{},namedGroup:o,unicodePropertyEscape:n,dotAllFlag:a,lookbehind:true}}},2062:(e,t,r)=>{"use strict";t.__esModule=true;t.stringifyTargetsMultiline=stringifyTargetsMultiline;t.stringifyTargets=stringifyTargets;t.presetEnvSilentDebugHeader=void 0;var s=r(797);const a="#__secret_key__@babel/preset-env__don't_log_debug_header_and_resolved_targets";t.presetEnvSilentDebugHeader=a;function stringifyTargetsMultiline(e){return JSON.stringify((0,s.prettifyTargets)(e),null,2)}function stringifyTargets(e){return JSON.stringify(e).replace(/,/g,", ").replace(/^\{"/,'{ "').replace(/"\}$/,'" }')}},4299:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:a}=s.default||s;class ImportsCache{constructor(e){this._imports=new WeakMap;this._anonymousImports=new WeakMap;this._lastImports=new WeakMap;this._resolver=e}storeAnonymous(e,t,r){const s=this._normalizeKey(e,t);const n=this._ensure(this._anonymousImports,e,Set);if(n.has(s))return;const o=r(e.node.sourceType==="script",a.stringLiteral(this._resolver(t)));n.add(s);this._injectImport(e,o)}storeNamed(e,t,r,s){const n=this._normalizeKey(e,t,r);const o=this._ensure(this._imports,e,Map);if(!o.has(n)){const{node:i,name:l}=s(e.node.sourceType==="script",a.stringLiteral(this._resolver(t)),a.identifier(r));o.set(n,l);this._injectImport(e,i)}return a.identifier(o.get(n))}_injectImport(e,t){let r=this._lastImports.get(e);if(r&&r.node&&r.parent===e.node&&r.container===e.node.body){r=r.insertAfter(t)}else{r=e.unshiftContainer("body",t)}r=r[r.length-1];this._lastImports.set(e,r)}_ensure(e,t,r){let s=e.get(t);if(!s){s=new r;e.set(t,s)}return s}_normalizeKey(e,t,r=""){const{sourceType:s}=e.node;return`${r&&s}::${t}::${r}`}}t["default"]=ImportsCache},8038:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=definePolyfillProvider;var s=r(1403);var a=_interopRequireWildcard(r(797));var n=r(4182);var o=_interopRequireDefault(r(4299));var i=r(2062);var l=r(1522);var c=_interopRequireWildcard(r(9313));var u=_interopRequireWildcard(r(6814));var p=_interopRequireDefault(r(8510));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var r={};var s=Object.keys(e);var a,n;for(n=0;n=0)continue;r[a]=e[a]}return r}const f=a.default.default||a.default;function resolveOptions(e,t){const{method:r,targets:s,ignoreBrowserslistConfig:a,configPath:n,debug:o,shouldInjectPolyfill:i,absoluteImports:l}=e,c=_objectWithoutPropertiesLoose(e,["method","targets","ignoreBrowserslistConfig","configPath","debug","shouldInjectPolyfill","absoluteImports"]);let u;if(r==="usage-global")u="usageGlobal";else if(r==="entry-global")u="entryGlobal";else if(r==="usage-pure")u="usagePure";else if(typeof r!=="string"){throw new Error(".method must be a string")}else{throw new Error(`.method must be one of "entry-global", "usage-global"`+` or "usage-pure" (received ${JSON.stringify(r)})`)}if(typeof i==="function"){if(e.include||e.exclude){throw new Error(`.include and .exclude are not supported when using the`+` .shouldInjectPolyfill function.`)}}else if(i!=null){throw new Error(`.shouldInjectPolyfill must be a function, or undefined`+` (received ${JSON.stringify(i)})`)}if(l!=null&&typeof l!=="boolean"&&typeof l!=="string"){throw new Error(`.absoluteImports must be a boolean, a string, or undefined`+` (received ${JSON.stringify(l)})`)}let p;if(s||n||a){const e=typeof s==="string"||Array.isArray(s)?{browsers:s}:s;p=f(e,{ignoreBrowserslistConfig:a,configPath:n})}else{p=t.targets()}return{method:r,methodName:u,targets:p,absoluteImports:l!=null?l:false,shouldInjectPolyfill:i,debug:!!o,providerOptions:c}}function instantiateProvider(e,t,r,s,i,c){const{method:f,methodName:d,targets:m,debug:y,shouldInjectPolyfill:g,providerOptions:h,absoluteImports:b}=resolveOptions(t,c);const x=(0,n.createUtilsGetter)(new o.default((e=>u.resolve(s,e,b))));let v,E;let j;let w;let _;const S=new Map;const k={babel:c,getUtils:x,method:t.method,targets:m,createMetaResolver:p.default,shouldInjectPolyfill(t){if(w===undefined){throw new Error(`Internal error in the ${e.name} provider: `+`shouldInjectPolyfill() can't be called during initialization.`)}if(!w.has(t)){console.warn(`Internal error in the ${O.name} provider: `+`unknown polyfill "${t}".`)}if(_&&!_(t))return false;let r=(0,a.isRequired)(t,m,{compatData:j,includes:v,excludes:E});if(g){r=g(t,r);if(typeof r!=="boolean"){throw new Error(`.shouldInjectPolyfill must return a boolean.`)}}return r},debug(e){i().found=true;if(!y||!e)return;if(i().polyfills.has(O.name))return;i().polyfills.set(e,j&&e&&j[e])},assertDependency(e,t="*"){if(r===false)return;if(b){return}const a=t==="*"?e:`${e}@^${t}`;const n=r.all?false:mapGetOr(S,`${e} :: ${s}`,(()=>u.has(s,e)));if(!n){i().missingDeps.add(a)}}};const O=e(k,h,s);if(typeof O[d]!=="function"){throw new Error(`The "${O.name||e.name}" provider doesn't `+`support the "${f}" polyfilling method.`)}if(Array.isArray(O.polyfills)){w=new Set(O.polyfills);_=O.filterPolyfills}else if(O.polyfills){w=new Set(Object.keys(O.polyfills));j=O.polyfills;_=O.filterPolyfills}else{w=new Set}({include:v,exclude:E}=(0,l.validateIncludeExclude)(O.name||e.name,w,h.include||[],h.exclude||[]));return{debug:y,method:f,targets:m,provider:O,callProvider(e,t){const r=x(t);O[d](e,r,t)}}}function definePolyfillProvider(e){return(0,s.declare)(((t,r,s)=>{t.assertVersion(7);const{traverse:n}=t;let o;const p=(0,l.applyMissingDependenciesDefaults)(r,t);const{debug:f,method:d,targets:m,provider:y,callProvider:g}=instantiateProvider(e,r,p,s,(()=>o),t);const h=d==="entry-global"?c.entry:c.usage;const b=y.visitor?n.visitors.merge([h(g),y.visitor]):h(g);if(f&&f!==i.presetEnvSilentDebugHeader){console.log(`${y.name}: \`DEBUG\` option`);console.log(`\nUsing targets: ${(0,i.stringifyTargetsMultiline)(m)}`);console.log(`\nUsing polyfills with \`${d}\` method:`)}return{name:"inject-polyfills",visitor:b,pre(){var e;o={polyfills:new Map,found:false,providers:new Set,missingDeps:new Set};(e=y.pre)==null?void 0:e.apply(this,arguments)},post(){var e;(e=y.post)==null?void 0:e.apply(this,arguments);if(p!==false){if(p.log==="per-file"){u.logMissing(o.missingDeps)}else{u.laterLogMissing(o.missingDeps)}}if(!f)return;if(this.filename)console.log(`\n[${this.filename}]`);if(o.polyfills.size===0){console.log(d==="entry-global"?o.found?`Based on your targets, the ${y.name} polyfill did not add any polyfill.`:`The entry point for the ${y.name} polyfill has not been found.`:`Based on your code and targets, the ${y.name} polyfill did not add any polyfill.`);return}if(d==="entry-global"){console.log(`The ${y.name} polyfill entry has been replaced with `+`the following polyfills:`)}else{console.log(`The ${y.name} polyfill added the following polyfills:`)}for(const[e,t]of o.polyfills){if(t){const r=(0,a.getInclusionReasons)(e,m,t);const s=JSON.stringify(r).replace(/,/g,", ").replace(/^\{"/,'{ "').replace(/"\}$/,'" }');console.log(` ${e} ${s}`)}else{console.log(` ${e}`)}}}}}))}function mapGetOr(e,t,r){let s=e.get(t);if(s===undefined){s=r();e.set(t,s)}return s}},8510:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=createMetaResolver;var s=r(4182);const a=new Set(["global","globalThis","self","window"]);function createMetaResolver(e){const{static:t,instance:r,global:n}=e;return e=>{if(e.kind==="global"&&n&&(0,s.has)(n,e.name)){return{kind:"global",desc:n[e.name],name:e.name}}if(e.kind==="property"||e.kind==="in"){const{placement:o,object:i,key:l}=e;if(i&&o==="static"){if(n&&a.has(i)&&(0,s.has)(n,l)){return{kind:"global",desc:n[l],name:l}}if(t&&(0,s.has)(t,i)&&(0,s.has)(t[i],l)){return{kind:"static",desc:t[i][l],name:`${i}$${l}`}}}if(r&&(0,s.has)(r,l)){return{kind:"instance",desc:r[l],name:`${l}`}}}}}},6814:(e,t,r)=>{"use strict";t.__esModule=true;t.resolve=resolve;t.has=has;t.logMissing=logMissing;t.laterLogMissing=laterLogMissing;var s=_interopRequireDefault(r(1017));var a=_interopRequireDefault(r(6240));var n=_interopRequireDefault(r(9820));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const o=parseFloat(process.versions.node)>=8.9;function resolve(e,t,r){if(r===false)return t;let a=e;if(typeof r==="string"){a=s.default.resolve(a,r)}let i,l;let c=t.indexOf("/");if(t[0]==="@"){c=t.indexOf("/",c+1)}if(c===-1){i=t;l=""}else{i=t.slice(0,c);l=t.slice(c)}try{let e;if(o){e=require.resolve(`${i}/package.json`,{paths:[a]})}else{e=n.default.sync(`${i}/package.json`,{basedir:a})}return s.default.dirname(e)+l}catch(r){if(r.code!=="MODULE_NOT_FOUND")throw r;throw Object.assign(new Error(`Failed to resolve "${t}" relative to "${e}"`),{code:"BABEL_POLYFILL_NOT_FOUND",polyfill:t,dirname:e})}}function has(e,t){try{if(o){require.resolve(t,{paths:[e]})}else{n.default.sync(t,{basedir:e})}return true}catch(e){return false}}function logMissing(e){if(e.size===0)return;const t=Array.from(e).sort().join(" ");console.warn("\nSome polyfills have been added but are not present in your dependencies.\n"+"Please run one of the following commands:\n"+`\tnpm install --save ${t}\n`+`\tyarn add ${t}\n`);process.exitCode=1}let i=new Set;const l=(0,a.default)((()=>{logMissing(i);i=new Set}),100);function laterLogMissing(e){if(e.size===0)return;e.forEach((e=>i.add(e)));l()}},1522:(e,t,r)=>{"use strict";t.__esModule=true;t.validateIncludeExclude=validateIncludeExclude;t.applyMissingDependenciesDefaults=applyMissingDependenciesDefaults;var s=r(4182);function patternToRegExp(e){if(e instanceof RegExp)return e;try{return new RegExp(`^${e}$`)}catch(e){return null}}function buildUnusedError(e,t){if(!t.length)return"";return` - The following "${e}" patterns didn't match any polyfill:\n`+t.map((e=>` ${String(e)}\n`)).join("")}function buldDuplicatesError(e){if(!e.size)return"";return` - The following polyfills were matched both by "include" and "exclude" patterns:\n`+Array.from(e,(e=>` ${e}\n`)).join("")}function validateIncludeExclude(e,t,r,a){let n;const filter=e=>{const r=patternToRegExp(e);if(!r)return false;let s=false;for(const e of t){if(r.test(e)){s=true;n.add(e)}}return!s};const o=n=new Set;const i=Array.from(r).filter(filter);const l=n=new Set;const c=Array.from(a).filter(filter);const u=(0,s.intersection)(o,l);if(u.size>0||i.length>0||c.length>0){throw new Error(`Error while validating the "${e}" provider options:\n`+buildUnusedError("include",i)+buildUnusedError("exclude",c)+buldDuplicatesError(u))}return{include:o,exclude:l}}function applyMissingDependenciesDefaults(e,t){const{missingDependencies:r={}}=e;if(r===false)return false;const s=t.caller((e=>e==null?void 0:e.name));const{log:a="deferred",inject:n=(s==="rollup-plugin-babel"?"throw":"import"),all:o=false}=r;return{log:a,inject:n,all:o}}},4182:(e,t,r)=>{"use strict";t.__esModule=true;t.intersection=intersection;t.has=has;t.resolveKey=resolveKey;t.resolveSource=resolveSource;t.getImportSource=getImportSource;t.getRequireSource=getRequireSource;t.createUtilsGetter=createUtilsGetter;var s=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:a,template:n}=s.default||s;function intersection(e,t){const r=new Set;e.forEach((e=>t.has(e)&&r.add(e)));return r}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function getType(e){return Object.prototype.toString.call(e).slice(8,-1)}function resolveId(e){if(e.isIdentifier()&&!e.scope.hasBinding(e.node.name,true)){return e.node.name}const{deopt:t}=e.evaluate();if(t&&t.isIdentifier()){return t.node.name}}function resolveKey(e,t=false){const{node:r,parent:s,scope:a}=e;if(e.isStringLiteral())return r.value;const{name:n}=r;const o=e.isIdentifier();if(o&&!(t||s.computed))return n;if(t&&e.isMemberExpression()&&e.get("object").isIdentifier({name:"Symbol"})&&!a.hasBinding("Symbol",true)){const t=resolveKey(e.get("property"),e.node.computed);if(t)return"Symbol."+t}if(!o||a.hasBinding(n,true)){const{value:t}=e.evaluate();if(typeof t==="string")return t}}function resolveSource(e){if(e.isMemberExpression()&&e.get("property").isIdentifier({name:"prototype"})){const t=resolveId(e.get("object"));if(t){return{id:t,placement:"prototype"}}return{id:null,placement:null}}const t=resolveId(e);if(t){return{id:t,placement:"static"}}const{value:r}=e.evaluate();if(r!==undefined){return{id:getType(r),placement:"prototype"}}else if(e.isRegExpLiteral()){return{id:"RegExp",placement:"prototype"}}else if(e.isFunction()){return{id:"Function",placement:"prototype"}}return{id:null,placement:null}}function getImportSource({node:e}){if(e.specifiers.length===0)return e.source.value}function getRequireSource({node:e}){if(!a.isExpressionStatement(e))return;const{expression:t}=e;const r=a.isCallExpression(t)&&a.isIdentifier(t.callee)&&t.callee.name==="require"&&t.arguments.length===1&&a.isStringLiteral(t.arguments[0]);if(r)return t.arguments[0].value}function hoist(e){e._blockHoist=3;return e}function createUtilsGetter(e){return t=>{const r=t.findParent((e=>e.isProgram()));return{injectGlobalImport(t){e.storeAnonymous(r,t,((e,t)=>e?n.statement.ast`require(${t})`:a.importDeclaration([],t)))},injectNamedImport(t,s,o=s){return e.storeNamed(r,t,s,((e,t,s)=>{const i=r.scope.generateUidIdentifier(o);return{node:e?hoist(n.statement.ast` + `}function buildPrivateMethodDeclaration(e,t,r=false){const a=t.get(e.node.key.id.name);const{id:n,methodId:o,getId:i,setId:l,getterDeclared:c,setterDeclared:u,static:p}=a;const{params:d,body:f,generator:m,async:y}=e.node;const g=i&&!c&&d.length===0;const h=l&&!u&&d.length>0;let b=o;if(g){t.set(e.node.key.id.name,Object.assign({},a,{getterDeclared:true}));b=i}else if(h){t.set(e.node.key.id.name,Object.assign({},a,{setterDeclared:true}));b=l}else if(p&&!r){b=n}return s.types.functionDeclaration(s.types.cloneNode(b),d,f,m,y)}const f=s.traverse.visitors.merge([{ThisExpression(e,t){t.needsClassRef=true;e.replaceWith(s.types.cloneNode(t.classRef))}},a.environmentVisitor]);const m={ReferencedIdentifier(e,t){if(e.scope.bindingIdentifierEquals(e.node.name,t.innerBinding)){t.needsClassRef=true;e.node.name=t.classRef.name}}};function replaceThisContext(e,t,r,n,o,i,l){var c;const u={classRef:t,needsClassRef:false,innerBinding:l};const p=new a.default({methodPath:e,constantSuper:i,file:n,refToPreserve:t,getSuperRef:r,getObjectRef(){u.needsClassRef=true;return o||e.node.static?t:s.types.memberExpression(t,s.types.identifier("prototype"))}});p.replace();if(o||e.isProperty()){e.traverse(f,u)}if((c=u.classRef)!=null&&c.name&&u.classRef.name!==(l==null?void 0:l.name)){e.traverse(m,u)}return u.needsClassRef}function buildFieldsInitNodes(e,t,r,a,n,o,i,c,u){let p=false;let d;const f=[];const m=[];const y=[];const g=s.types.isIdentifier(t)?()=>t:()=>{var e;(e=d)!=null?e:d=r[0].scope.generateUidIdentifierBasedOnNode(t);return d};for(const t of r){l.assertFieldTransformed(t);const r=t.node.static;const d=!r;const h=t.isPrivate();const b=!h;const x=t.isProperty();const v=!x;const E=t.isStaticBlock==null?void 0:t.isStaticBlock();if(r||v&&h||E){const r=replaceThisContext(t,e,g,n,E,c,u);p=p||r}switch(true){case E:f.push(s.template.statement.ast`(() => ${s.types.blockStatement(t.node.body)})()`);break;case r&&h&&x&&i:p=true;f.push(buildPrivateFieldInitLoose(s.types.cloneNode(e),t,a));break;case r&&h&&x&&!i:p=true;f.push(buildPrivateStaticFieldInitSpec(t,a));break;case r&&b&&x&&o:p=true;f.push(buildPublicFieldInitLoose(s.types.cloneNode(e),t));break;case r&&b&&x&&!o:p=true;f.push(buildPublicFieldInitSpec(s.types.cloneNode(e),t,n));break;case d&&h&&x&&i:m.push(buildPrivateFieldInitLoose(s.types.thisExpression(),t,a));break;case d&&h&&x&&!i:m.push(buildPrivateInstanceFieldInitSpec(s.types.thisExpression(),t,a));break;case d&&h&&v&&i:m.unshift(buildPrivateMethodInitLoose(s.types.thisExpression(),t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case d&&h&&v&&!i:m.unshift(buildPrivateInstanceMethodInitSpec(s.types.thisExpression(),t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case r&&h&&v&&!i:p=true;f.unshift(buildPrivateStaticFieldInitSpec(t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case r&&h&&v&&i:p=true;f.unshift(buildPrivateStaticMethodInitLoose(s.types.cloneNode(e),t,n,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case d&&b&&x&&o:m.push(buildPublicFieldInitLoose(s.types.thisExpression(),t));break;case d&&b&&x&&!o:m.push(buildPublicFieldInitSpec(s.types.thisExpression(),t,n));break;default:throw new Error("Unreachable.")}}return{staticNodes:f.filter(Boolean),instanceNodes:m.filter(Boolean),pureStaticNodes:y.filter(Boolean),wrapClass(t){for(const e of r){e.remove()}if(d){t.scope.push({id:s.types.cloneNode(d)});t.set("superClass",s.types.assignmentExpression("=",d,t.node.superClass))}if(!p)return t;if(t.isClassExpression()){t.scope.push({id:e});t.replaceWith(s.types.assignmentExpression("=",s.types.cloneNode(e),t.node))}else if(!t.node.id){t.node.id=e}return t}}}},6758:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.createClassFeaturePlugin=createClassFeaturePlugin;Object.defineProperty(t,"injectInitialization",{enumerable:true,get:function(){return l.injectInitialization}});Object.defineProperty(t,"enableFeature",{enumerable:true,get:function(){return c.enableFeature}});Object.defineProperty(t,"FEATURES",{enumerable:true,get:function(){return c.FEATURES}});var s=r(8304);var a=r(550);var n=r(7058);var o=r(3647);var i=r(6429);var l=r(5617);var c=r(7497);const u="7.14.6".split(".").reduce(((e,t)=>e*1e5+ +t),0);const p="@babel/plugin-class-features/version";function createClassFeaturePlugin({name:e,feature:t,loose:r,manipulateOptions:d,api:f={assumption:()=>{}}}){const m=f.assumption("setPublicClassFields");const y=f.assumption("privateFieldsAsProperties");const g=f.assumption("constantSuper");const h=f.assumption("noDocumentAll");if(r===true){const t=[];if(m!==undefined){t.push(`"setPublicClassFields"`)}if(y!==undefined){t.push(`"privateFieldsAsProperties"`)}if(t.length!==0){console.warn(`[${e}]: You are using the "loose: true" option and you are`+` explicitly setting a value for the ${t.join(" and ")}`+` assumption${t.length>1?"s":""}. The "loose" option`+` can cause incompatibilities with the other class features`+` plugins, so it's recommended that you replace it with the`+` following top-level option:\n`+`\t"assumptions": {\n`+`\t\t"setPublicClassFields": true,\n`+`\t\t"privateFieldsAsProperties": true\n`+`\t}`)}}return{name:e,manipulateOptions:d,pre(){(0,c.enableFeature)(this.file,t,r);if(!this.file.get(p)||this.file.get(p)0){(0,l.injectInitialization)(e,d,D,((e,t)=>{if(f)return;for(const r of b){if(r.node.static)continue;r.traverse(e,t)}}))}e=C(e);e.insertBefore([...O,...k]);if(P.length>0){e.insertAfter(P)}if(I.length>0){e.find((e=>e.isStatement()||e.isDeclaration())).insertAfter(I)}},PrivateName(e){if(this.file.get(p)!==u||e.parentPath.isPrivate({key:e.node})){return}throw e.buildCodeFrameError(`Unknown PrivateName "${e}"`)},ExportDefaultDeclaration(e){if(this.file.get(p)!==u)return;const t=e.get("declaration");if(t.isClassDeclaration()&&(0,i.hasDecorators)(t.node)){if(t.node.id){(0,n.default)(e)}else{t.node.type="ClassExpression"}}}}}}},5617:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.injectInitialization=injectInitialization;t.extractComputedKeys=extractComputedKeys;var s=r(8304);var a=r(6833);const n=s.traverse.visitors.merge([{Super(e){const{node:t,parentPath:r}=e;if(r.isCallExpression({callee:t})){this.push(r)}}},a.environmentVisitor]);const o={"TSTypeAnnotation|TypeAnnotation"(e){e.skip()},ReferencedIdentifier(e){if(this.scope.hasOwnBinding(e.node.name)){this.scope.rename(e.node.name);e.skip()}}};function handleClassTDZ(e,t){if(t.classBinding&&t.classBinding===e.scope.getBinding(e.node.name)){const r=t.file.addHelper("classNameTDZError");const a=s.types.callExpression(r,[s.types.stringLiteral(e.node.name)]);e.replaceWith(s.types.sequenceExpression([a,e.node]));e.skip()}}const i={ReferencedIdentifier:handleClassTDZ};function injectInitialization(e,t,r,a){if(!r.length)return;const i=!!e.node.superClass;if(!t){const r=s.types.classMethod("constructor",s.types.identifier("constructor"),[],s.types.blockStatement([]));if(i){r.params=[s.types.restElement(s.types.identifier("args"))];r.body.body.push(s.template.statement.ast`super(...args)`)}[t]=e.get("body").unshiftContainer("body",r)}if(a){a(o,{scope:t.scope})}if(i){const e=[];t.traverse(n,e);let a=true;for(const t of e){if(a){t.insertAfter(r);a=false}else{t.insertAfter(r.map((e=>s.types.cloneNode(e))))}}}else{t.get("body").unshiftContainer("body",r)}}function extractComputedKeys(e,t,r,a){const n=[];const o={classBinding:t.node.id&&t.scope.getBinding(t.node.id.name),file:a};for(const e of r){const r=e.get("key");if(r.isReferencedIdentifier()){handleClassTDZ(r,o)}else{r.traverse(i,o)}const a=e.node;if(!r.isConstantExpression()){const e=t.scope.generateUidIdentifierBasedOnNode(a.key);t.scope.push({id:e,kind:"let"});n.push(s.types.expressionStatement(s.types.assignmentExpression("=",s.types.cloneNode(e),a.key)));a.key=s.types.cloneNode(e)}}return n}},6782:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.assertFieldTransformed=assertFieldTransformed;function assertFieldTransformed(e){if(e.node.declare){throw e.buildCodeFrameError(`TypeScript 'declare' fields must first be transformed by `+`@babel/plugin-transform-typescript.\n`+`If you have already enabled that plugin (or '@babel/preset-typescript'), make sure `+`that it runs before any plugin related to additional class features:\n`+` - @babel/plugin-proposal-class-properties\n`+` - @babel/plugin-proposal-private-methods\n`+` - @babel/plugin-proposal-decorators`)}}},3316:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(8622);function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach((function(r){if(r!=="default"){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:true,get:function(){return e[r]}})}}))}t["default"]=e;return Object.freeze(t)}var a=_interopNamespace(s);function willPathCastToBoolean(e){const t=e;const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}class AssignmentMemoiser{constructor(){this._map=void 0;this._map=new WeakMap}has(e){return this._map.has(e)}get(e){if(!this.has(e))return;const t=this._map.get(e);const{value:r}=t;t.count--;if(t.count===0){return a.assignmentExpression("=",r,e)}return r}set(e,t,r){return this._map.set(e,{count:r,value:t})}}function toNonOptional(e,t){const{node:r}=e;if(e.isOptionalMemberExpression()){return a.memberExpression(t,r.property,r.computed)}if(e.isOptionalCallExpression()){const s=e.get("callee");if(e.node.optional&&s.isOptionalMemberExpression()){const{object:n}=s.node;const o=e.scope.maybeGenerateMemoised(n)||n;s.get("object").replaceWith(a.assignmentExpression("=",o,n));return a.callExpression(a.memberExpression(t,a.identifier("call")),[o,...r.arguments])}return a.callExpression(t,r.arguments)}return e.node}function isInDetachedTree(e){while(e){if(e.isProgram())break;const{parentPath:t,container:r,listKey:s}=e;const a=t.node;if(s){if(r!==a[s])return true}else{if(r!==a)return true}e=t}return false}const n={memoise(){},handle(e,t){const{node:r,parent:s,parentPath:n,scope:o}=e;if(e.isOptionalMemberExpression()){if(isInDetachedTree(e))return;const i=e.find((({node:t,parent:r,parentPath:s})=>{if(s.isOptionalMemberExpression()){return r.optional||r.object!==t}if(s.isOptionalCallExpression()){return t!==e.node&&r.optional||r.callee!==t}return true}));if(o.path.isPattern()){i.replaceWith(a.callExpression(a.arrowFunctionExpression([],i.node),[]));return}const l=willPathCastToBoolean(i);const c=i.parentPath;if(c.isUpdateExpression({argument:r})||c.isAssignmentExpression({left:r})){throw e.buildCodeFrameError(`can't handle assignment`)}const u=c.isUnaryExpression({operator:"delete"});if(u&&i.isOptionalMemberExpression()&&i.get("property").isPrivateName()){throw e.buildCodeFrameError(`can't delete a private class element`)}let p=e;for(;;){if(p.isOptionalMemberExpression()){if(p.node.optional)break;p=p.get("object");continue}else if(p.isOptionalCallExpression()){if(p.node.optional)break;p=p.get("callee");continue}throw new Error(`Internal error: unexpected ${p.node.type}`)}const d=p.isOptionalMemberExpression()?"object":"callee";const f=p.node[d];const m=o.maybeGenerateMemoised(f);const y=m!=null?m:f;const g=n.isOptionalCallExpression({callee:r});const h=n.isCallExpression({callee:r});p.replaceWith(toNonOptional(p,y));if(g){if(s.optional){n.replaceWith(this.optionalCall(e,s.arguments))}else{n.replaceWith(this.call(e,s.arguments))}}else if(h){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}let b=e.node;for(let t=e;t!==i;){const{parentPath:e}=t;if(e===i&&g&&s.optional){b=e.node;break}b=toNonOptional(e,b);t=e}let x;const v=i.parentPath;if(a.isMemberExpression(b)&&v.isOptionalCallExpression({callee:i.node,optional:true})){const{object:t}=b;x=e.scope.maybeGenerateMemoised(t);if(x){b.object=a.assignmentExpression("=",x,t)}}let E=i;if(u){E=v;b=v.node}const j=m?a.assignmentExpression("=",a.cloneNode(y),a.cloneNode(f)):a.cloneNode(y);if(l){let e;if(t){e=a.binaryExpression("!=",j,a.nullLiteral())}else{e=a.logicalExpression("&&",a.binaryExpression("!==",j,a.nullLiteral()),a.binaryExpression("!==",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.logicalExpression("&&",e,b))}else{let e;if(t){e=a.binaryExpression("==",j,a.nullLiteral())}else{e=a.logicalExpression("||",a.binaryExpression("===",j,a.nullLiteral()),a.binaryExpression("===",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.conditionalExpression(e,u?a.booleanLiteral(true):o.buildUndefinedNode(),b))}if(x){const e=v.node;v.replaceWith(a.optionalCallExpression(a.optionalMemberExpression(e.callee,a.identifier("call"),false,true),[a.cloneNode(x),...e.arguments],false))}return}if(n.isUpdateExpression({argument:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,prefix:o}=s;this.memoise(e,2);const i=a.binaryExpression(t[0],a.unaryExpression("+",this.get(e)),a.numericLiteral(1));if(o){n.replaceWith(this.set(e,i))}else{const{scope:t}=e;const s=t.generateUidIdentifierBasedOnNode(r);t.push({id:s});i.left=a.assignmentExpression("=",a.cloneNode(s),i.left);n.replaceWith(a.sequenceExpression([this.set(e,i),a.cloneNode(s)]))}return}if(n.isAssignmentExpression({left:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,right:r}=s;if(t==="="){n.replaceWith(this.set(e,r))}else{const s=t.slice(0,-1);if(a.LOGICAL_OPERATORS.includes(s)){this.memoise(e,1);n.replaceWith(a.logicalExpression(s,this.get(e),this.set(e,r)))}else{this.memoise(e,2);n.replaceWith(this.set(e,a.binaryExpression(s,this.get(e),r)))}}return}if(n.isCallExpression({callee:r})){n.replaceWith(this.call(e,s.arguments));return}if(n.isOptionalCallExpression({callee:r})){if(o.path.isPattern()){n.replaceWith(a.callExpression(a.arrowFunctionExpression([],n.node),[]));return}n.replaceWith(this.optionalCall(e,s.arguments));return}if(n.isForXStatement({left:r})||n.isObjectProperty({value:r})&&n.parentPath.isObjectPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isObjectProperty({value:s})&&n.parentPath.parentPath.isObjectPattern()||n.isArrayPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isArrayPattern()||n.isRestElement()){e.replaceWith(this.destructureSet(e));return}e.replaceWith(this.get(e))}};function memberExpressionToFunctions(e,t,r){e.traverse(t,Object.assign({},n,r,{memoiser:new AssignmentMemoiser}))}t["default"]=memberExpressionToFunctions},3852:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.enableFeature=enableFeature;t.hasFeature=hasFeature;t.runtimeKey=t.featuresKey=t.FEATURES=void 0;const r=Object.freeze({unicodeFlag:1<<0,dotAllFlag:1<<1,unicodePropertyEscape:1<<2,namedCaptureGroups:1<<3});t.FEATURES=r;const s="@babel/plugin-regexp-features/featuresKey";t.featuresKey=s;const a="@babel/plugin-regexp-features/runtimeKey";t.runtimeKey=a;function enableFeature(e,t){return e|t}function hasFeature(e,t){return!!(e&t)}},6550:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.createRegExpFeaturePlugin=createRegExpFeaturePlugin;var s=r(5756);var a=r(3852);var n=r(3889);var o=r(8304);var i=r(2155);function pullFlag(e,t){e.flags=e.flags.replace(t,"")}const l="7.14.5".split(".").reduce(((e,t)=>e*1e5+ +t),0);const c="@babel/plugin-regexp-features/version";function createRegExpFeaturePlugin({name:e,feature:t,options:r={}}){return{name:e,pre(){var e;const{file:s}=this;const n=(e=s.get(a.featuresKey))!=null?e:0;let o=(0,a.enableFeature)(n,a.FEATURES[t]);const{useUnicodeFlag:i,runtime:u=true}=r;if(i===false){o=(0,a.enableFeature)(o,a.FEATURES.unicodeFlag)}if(o!==n){s.set(a.featuresKey,o)}if(!u){s.set(a.runtimeKey,false)}if(!s.has(c)||s.get(c){d[e]=t}}r.pattern=s(r.pattern,r.flags,p);if(p.namedGroup&&Object.keys(d).length>0&&u&&!isRegExpTest(e)){const t=o.types.callExpression(this.addHelper("wrapRegExp"),[r,o.types.valueToNode(d)]);(0,i.default)(t);e.replaceWith(t)}if((0,a.hasFeature)(c,a.FEATURES.unicodeFlag)){pullFlag(r,"u")}if((0,a.hasFeature)(c,a.FEATURES.dotAllFlag)){pullFlag(r,"s")}}}}}function isRegExpTest(e){return e.parentPath.isMemberExpression({object:e.node,computed:false})&&e.parentPath.get("property").isIdentifier({name:"test"})}},3889:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generateRegexpuOptions=generateRegexpuOptions;var s=r(3852);function generateRegexpuOptions(e,t){let r=false,a=false,n=false,o=false;const{flags:i,pattern:l}=e;const c=i.includes("u");if(c){if(!(0,s.hasFeature)(t,s.FEATURES.unicodeFlag)){r=true}if((0,s.hasFeature)(t,s.FEATURES.unicodePropertyEscape)&&/\\[pP]{/.test(l)){n=true}}if((0,s.hasFeature)(t,s.FEATURES.dotAllFlag)&&i.indexOf("s")>=0){a=true}if((0,s.hasFeature)(t,s.FEATURES.namedCaptureGroups)&&/\(\?<(?![=!])/.test(l)){o=true}if(!o&&!n&&!a&&(!c||r)){return null}if(c&&i.indexOf("s")>=0){a=true}return{useUnicodeFlag:r,onNamedGroup:()=>{},namedGroup:o,unicodePropertyEscape:n,dotAllFlag:a,lookbehind:true}}},2062:(e,t,r)=>{"use strict";t.__esModule=true;t.stringifyTargetsMultiline=stringifyTargetsMultiline;t.stringifyTargets=stringifyTargets;t.presetEnvSilentDebugHeader=void 0;var s=r(797);const a="#__secret_key__@babel/preset-env__don't_log_debug_header_and_resolved_targets";t.presetEnvSilentDebugHeader=a;function stringifyTargetsMultiline(e){return JSON.stringify((0,s.prettifyTargets)(e),null,2)}function stringifyTargets(e){return JSON.stringify(e).replace(/,/g,", ").replace(/^\{"/,'{ "').replace(/"\}$/,'" }')}},4299:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:a}=s.default||s;class ImportsCache{constructor(e){this._imports=new WeakMap;this._anonymousImports=new WeakMap;this._lastImports=new WeakMap;this._resolver=e}storeAnonymous(e,t,r){const s=this._normalizeKey(e,t);const n=this._ensure(this._anonymousImports,e,Set);if(n.has(s))return;const o=r(e.node.sourceType==="script",a.stringLiteral(this._resolver(t)));n.add(s);this._injectImport(e,o)}storeNamed(e,t,r,s){const n=this._normalizeKey(e,t,r);const o=this._ensure(this._imports,e,Map);if(!o.has(n)){const{node:i,name:l}=s(e.node.sourceType==="script",a.stringLiteral(this._resolver(t)),a.identifier(r));o.set(n,l);this._injectImport(e,i)}return a.identifier(o.get(n))}_injectImport(e,t){let r=this._lastImports.get(e);if(r&&r.node&&r.parent===e.node&&r.container===e.node.body){r=r.insertAfter(t)}else{r=e.unshiftContainer("body",t)}r=r[r.length-1];this._lastImports.set(e,r)}_ensure(e,t,r){let s=e.get(t);if(!s){s=new r;e.set(t,s)}return s}_normalizeKey(e,t,r=""){const{sourceType:s}=e.node;return`${r&&s}::${t}::${r}`}}t["default"]=ImportsCache},8038:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=definePolyfillProvider;var s=r(1403);var a=_interopRequireWildcard(r(797));var n=r(4182);var o=_interopRequireDefault(r(4299));var i=r(2062);var l=r(1522);var c=_interopRequireWildcard(r(9313));var u=_interopRequireWildcard(r(6814));var p=_interopRequireDefault(r(8510));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var r={};var s=Object.keys(e);var a,n;for(n=0;n=0)continue;r[a]=e[a]}return r}const d=a.default.default||a.default;function resolveOptions(e,t){const{method:r,targets:s,ignoreBrowserslistConfig:a,configPath:n,debug:o,shouldInjectPolyfill:i,absoluteImports:l}=e,c=_objectWithoutPropertiesLoose(e,["method","targets","ignoreBrowserslistConfig","configPath","debug","shouldInjectPolyfill","absoluteImports"]);let u;if(r==="usage-global")u="usageGlobal";else if(r==="entry-global")u="entryGlobal";else if(r==="usage-pure")u="usagePure";else if(typeof r!=="string"){throw new Error(".method must be a string")}else{throw new Error(`.method must be one of "entry-global", "usage-global"`+` or "usage-pure" (received ${JSON.stringify(r)})`)}if(typeof i==="function"){if(e.include||e.exclude){throw new Error(`.include and .exclude are not supported when using the`+` .shouldInjectPolyfill function.`)}}else if(i!=null){throw new Error(`.shouldInjectPolyfill must be a function, or undefined`+` (received ${JSON.stringify(i)})`)}if(l!=null&&typeof l!=="boolean"&&typeof l!=="string"){throw new Error(`.absoluteImports must be a boolean, a string, or undefined`+` (received ${JSON.stringify(l)})`)}let p;if(s||n||a){const e=typeof s==="string"||Array.isArray(s)?{browsers:s}:s;p=d(e,{ignoreBrowserslistConfig:a,configPath:n})}else{p=t.targets()}return{method:r,methodName:u,targets:p,absoluteImports:l!=null?l:false,shouldInjectPolyfill:i,debug:!!o,providerOptions:c}}function instantiateProvider(e,t,r,s,i,c){const{method:d,methodName:f,targets:m,debug:y,shouldInjectPolyfill:g,providerOptions:h,absoluteImports:b}=resolveOptions(t,c);const x=(0,n.createUtilsGetter)(new o.default((e=>u.resolve(s,e,b))));let v,E;let j;let w;let _;const S=new Map;const O={babel:c,getUtils:x,method:t.method,targets:m,createMetaResolver:p.default,shouldInjectPolyfill(t){if(w===undefined){throw new Error(`Internal error in the ${e.name} provider: `+`shouldInjectPolyfill() can't be called during initialization.`)}if(!w.has(t)){console.warn(`Internal error in the ${k.name} provider: `+`unknown polyfill "${t}".`)}if(_&&!_(t))return false;let r=(0,a.isRequired)(t,m,{compatData:j,includes:v,excludes:E});if(g){r=g(t,r);if(typeof r!=="boolean"){throw new Error(`.shouldInjectPolyfill must return a boolean.`)}}return r},debug(e){i().found=true;if(!y||!e)return;if(i().polyfills.has(k.name))return;i().polyfills.set(e,j&&e&&j[e])},assertDependency(e,t="*"){if(r===false)return;if(b){return}const a=t==="*"?e:`${e}@^${t}`;const n=r.all?false:mapGetOr(S,`${e} :: ${s}`,(()=>u.has(s,e)));if(!n){i().missingDeps.add(a)}}};const k=e(O,h,s);if(typeof k[f]!=="function"){throw new Error(`The "${k.name||e.name}" provider doesn't `+`support the "${d}" polyfilling method.`)}if(Array.isArray(k.polyfills)){w=new Set(k.polyfills);_=k.filterPolyfills}else if(k.polyfills){w=new Set(Object.keys(k.polyfills));j=k.polyfills;_=k.filterPolyfills}else{w=new Set}({include:v,exclude:E}=(0,l.validateIncludeExclude)(k.name||e.name,w,h.include||[],h.exclude||[]));return{debug:y,method:d,targets:m,provider:k,callProvider(e,t){const r=x(t);k[f](e,r,t)}}}function definePolyfillProvider(e){return(0,s.declare)(((t,r,s)=>{t.assertVersion(7);const{traverse:n}=t;let o;const p=(0,l.applyMissingDependenciesDefaults)(r,t);const{debug:d,method:f,targets:m,provider:y,callProvider:g}=instantiateProvider(e,r,p,s,(()=>o),t);const h=f==="entry-global"?c.entry:c.usage;const b=y.visitor?n.visitors.merge([h(g),y.visitor]):h(g);if(d&&d!==i.presetEnvSilentDebugHeader){console.log(`${y.name}: \`DEBUG\` option`);console.log(`\nUsing targets: ${(0,i.stringifyTargetsMultiline)(m)}`);console.log(`\nUsing polyfills with \`${f}\` method:`)}return{name:"inject-polyfills",visitor:b,pre(){var e;o={polyfills:new Map,found:false,providers:new Set,missingDeps:new Set};(e=y.pre)==null?void 0:e.apply(this,arguments)},post(){var e;(e=y.post)==null?void 0:e.apply(this,arguments);if(p!==false){if(p.log==="per-file"){u.logMissing(o.missingDeps)}else{u.laterLogMissing(o.missingDeps)}}if(!d)return;if(this.filename)console.log(`\n[${this.filename}]`);if(o.polyfills.size===0){console.log(f==="entry-global"?o.found?`Based on your targets, the ${y.name} polyfill did not add any polyfill.`:`The entry point for the ${y.name} polyfill has not been found.`:`Based on your code and targets, the ${y.name} polyfill did not add any polyfill.`);return}if(f==="entry-global"){console.log(`The ${y.name} polyfill entry has been replaced with `+`the following polyfills:`)}else{console.log(`The ${y.name} polyfill added the following polyfills:`)}for(const[e,t]of o.polyfills){if(t){const r=(0,a.getInclusionReasons)(e,m,t);const s=JSON.stringify(r).replace(/,/g,", ").replace(/^\{"/,'{ "').replace(/"\}$/,'" }');console.log(` ${e} ${s}`)}else{console.log(` ${e}`)}}}}}))}function mapGetOr(e,t,r){let s=e.get(t);if(s===undefined){s=r();e.set(t,s)}return s}},8510:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=createMetaResolver;var s=r(4182);const a=new Set(["global","globalThis","self","window"]);function createMetaResolver(e){const{static:t,instance:r,global:n}=e;return e=>{if(e.kind==="global"&&n&&(0,s.has)(n,e.name)){return{kind:"global",desc:n[e.name],name:e.name}}if(e.kind==="property"||e.kind==="in"){const{placement:o,object:i,key:l}=e;if(i&&o==="static"){if(n&&a.has(i)&&(0,s.has)(n,l)){return{kind:"global",desc:n[l],name:l}}if(t&&(0,s.has)(t,i)&&(0,s.has)(t[i],l)){return{kind:"static",desc:t[i][l],name:`${i}$${l}`}}}if(r&&(0,s.has)(r,l)){return{kind:"instance",desc:r[l],name:`${l}`}}}}}},6814:(e,t,r)=>{"use strict";t.__esModule=true;t.resolve=resolve;t.has=has;t.logMissing=logMissing;t.laterLogMissing=laterLogMissing;var s=_interopRequireDefault(r(1017));var a=_interopRequireDefault(r(6240));var n=_interopRequireDefault(r(9820));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const o=parseFloat(process.versions.node)>=8.9;function resolve(e,t,r){if(r===false)return t;let a=e;if(typeof r==="string"){a=s.default.resolve(a,r)}let i,l;let c=t.indexOf("/");if(t[0]==="@"){c=t.indexOf("/",c+1)}if(c===-1){i=t;l=""}else{i=t.slice(0,c);l=t.slice(c)}try{let e;if(o){e=require.resolve(`${i}/package.json`,{paths:[a]})}else{e=n.default.sync(`${i}/package.json`,{basedir:a})}return s.default.dirname(e)+l}catch(r){if(r.code!=="MODULE_NOT_FOUND")throw r;throw Object.assign(new Error(`Failed to resolve "${t}" relative to "${e}"`),{code:"BABEL_POLYFILL_NOT_FOUND",polyfill:t,dirname:e})}}function has(e,t){try{if(o){require.resolve(t,{paths:[e]})}else{n.default.sync(t,{basedir:e})}return true}catch(e){return false}}function logMissing(e){if(e.size===0)return;const t=Array.from(e).sort().join(" ");console.warn("\nSome polyfills have been added but are not present in your dependencies.\n"+"Please run one of the following commands:\n"+`\tnpm install --save ${t}\n`+`\tyarn add ${t}\n`);process.exitCode=1}let i=new Set;const l=(0,a.default)((()=>{logMissing(i);i=new Set}),100);function laterLogMissing(e){if(e.size===0)return;e.forEach((e=>i.add(e)));l()}},1522:(e,t,r)=>{"use strict";t.__esModule=true;t.validateIncludeExclude=validateIncludeExclude;t.applyMissingDependenciesDefaults=applyMissingDependenciesDefaults;var s=r(4182);function patternToRegExp(e){if(e instanceof RegExp)return e;try{return new RegExp(`^${e}$`)}catch(e){return null}}function buildUnusedError(e,t){if(!t.length)return"";return` - The following "${e}" patterns didn't match any polyfill:\n`+t.map((e=>` ${String(e)}\n`)).join("")}function buldDuplicatesError(e){if(!e.size)return"";return` - The following polyfills were matched both by "include" and "exclude" patterns:\n`+Array.from(e,(e=>` ${e}\n`)).join("")}function validateIncludeExclude(e,t,r,a){let n;const filter=e=>{const r=patternToRegExp(e);if(!r)return false;let s=false;for(const e of t){if(r.test(e)){s=true;n.add(e)}}return!s};const o=n=new Set;const i=Array.from(r).filter(filter);const l=n=new Set;const c=Array.from(a).filter(filter);const u=(0,s.intersection)(o,l);if(u.size>0||i.length>0||c.length>0){throw new Error(`Error while validating the "${e}" provider options:\n`+buildUnusedError("include",i)+buildUnusedError("exclude",c)+buldDuplicatesError(u))}return{include:o,exclude:l}}function applyMissingDependenciesDefaults(e,t){const{missingDependencies:r={}}=e;if(r===false)return false;const s=t.caller((e=>e==null?void 0:e.name));const{log:a="deferred",inject:n=(s==="rollup-plugin-babel"?"throw":"import"),all:o=false}=r;return{log:a,inject:n,all:o}}},4182:(e,t,r)=>{"use strict";t.__esModule=true;t.intersection=intersection;t.has=has;t.resolveKey=resolveKey;t.resolveSource=resolveSource;t.getImportSource=getImportSource;t.getRequireSource=getRequireSource;t.createUtilsGetter=createUtilsGetter;var s=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:a,template:n}=s.default||s;function intersection(e,t){const r=new Set;e.forEach((e=>t.has(e)&&r.add(e)));return r}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function getType(e){return Object.prototype.toString.call(e).slice(8,-1)}function resolveId(e){if(e.isIdentifier()&&!e.scope.hasBinding(e.node.name,true)){return e.node.name}const{deopt:t}=e.evaluate();if(t&&t.isIdentifier()){return t.node.name}}function resolveKey(e,t=false){const{node:r,parent:s,scope:a}=e;if(e.isStringLiteral())return r.value;const{name:n}=r;const o=e.isIdentifier();if(o&&!(t||s.computed))return n;if(t&&e.isMemberExpression()&&e.get("object").isIdentifier({name:"Symbol"})&&!a.hasBinding("Symbol",true)){const t=resolveKey(e.get("property"),e.node.computed);if(t)return"Symbol."+t}if(!o||a.hasBinding(n,true)){const{value:t}=e.evaluate();if(typeof t==="string")return t}}function resolveSource(e){if(e.isMemberExpression()&&e.get("property").isIdentifier({name:"prototype"})){const t=resolveId(e.get("object"));if(t){return{id:t,placement:"prototype"}}return{id:null,placement:null}}const t=resolveId(e);if(t){return{id:t,placement:"static"}}const{value:r}=e.evaluate();if(r!==undefined){return{id:getType(r),placement:"prototype"}}else if(e.isRegExpLiteral()){return{id:"RegExp",placement:"prototype"}}else if(e.isFunction()){return{id:"Function",placement:"prototype"}}return{id:null,placement:null}}function getImportSource({node:e}){if(e.specifiers.length===0)return e.source.value}function getRequireSource({node:e}){if(!a.isExpressionStatement(e))return;const{expression:t}=e;const r=a.isCallExpression(t)&&a.isIdentifier(t.callee)&&t.callee.name==="require"&&t.arguments.length===1&&a.isStringLiteral(t.arguments[0]);if(r)return t.arguments[0].value}function hoist(e){e._blockHoist=3;return e}function createUtilsGetter(e){return t=>{const r=t.findParent((e=>e.isProgram()));return{injectGlobalImport(t){e.storeAnonymous(r,t,((e,t)=>e?n.statement.ast`require(${t})`:a.importDeclaration([],t)))},injectNamedImport(t,s,o=s){return e.storeNamed(r,t,s,((e,t,s)=>{const i=r.scope.generateUidIdentifier(o);return{node:e?hoist(n.statement.ast` var ${i} = require(${t}).${s} - `):a.importDeclaration([a.importSpecifier(i,s)],t),name:i.name}}))},injectDefaultImport(t,s=t){return e.storeNamed(r,t,"default",((e,t)=>{const o=r.scope.generateUidIdentifier(s);return{node:e?hoist(n.statement.ast`var ${o} = require(${t})`):a.importDeclaration([a.importDefaultSpecifier(o)],t),name:o.name}}))}}}}},8160:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=r(4182);var _default=e=>({ImportDeclaration(t){const r=(0,s.getImportSource)(t);if(!r)return;e({kind:"import",source:r},t)},Program(t){t.get("body").forEach((t=>{const r=(0,s.getRequireSource)(t);if(!r)return;e({kind:"import",source:r},t)}))}});t["default"]=_default},9313:(e,t,r)=>{"use strict";t.__esModule=true;t.entry=t.usage=void 0;var s=_interopRequireDefault(r(6527));t.usage=s.default;var a=_interopRequireDefault(r(8160));t.entry=a.default;function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}},6527:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=r(4182);var _default=e=>{function property(t,r,s,a){return e({kind:"property",object:t,key:r,placement:s},a)}return{ReferencedIdentifier(t){const{node:{name:r},scope:s}=t;if(s.getBindingIdentifier(r))return;e({kind:"global",name:r},t)},MemberExpression(e){const t=(0,s.resolveKey)(e.get("property"),e.node.computed);if(!t||t==="prototype")return;const r=e.get("object");const a=r.scope.getBinding(r.node.name);if(a&&a.path.isImportNamespaceSpecifier())return;const n=(0,s.resolveSource)(r);return property(n.id,t,n.placement,e)},ObjectPattern(e){const{parentPath:t,parent:r}=e;let a;if(t.isVariableDeclarator()){a=t.get("init")}else if(t.isAssignmentExpression()){a=t.get("right")}else if(t.isFunction()){const s=t.parentPath;if(s.isCallExpression()||s.isNewExpression()){if(s.node.callee===r){a=s.get("arguments")[e.key]}}}let n=null;let o=null;if(a)({id:n,placement:o}=(0,s.resolveSource)(a));for(const t of e.get("properties")){if(t.isObjectProperty()){const e=(0,s.resolveKey)(t.get("key"));if(e)property(n,e,o,t)}}},BinaryExpression(t){if(t.node.operator!=="in")return;const r=(0,s.resolveSource)(t.get("right"));const a=(0,s.resolveKey)(t.get("left"),true);if(!a)return;e({kind:"in",object:r.id,key:a,placement:r.placement},t)}}};t["default"]=_default},1403:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9820:(e,t,r)=>{var s=r(7462);s.core=r(9118);s.isCore=r(779);s.sync=r(5565);e.exports=s},7462:(e,t,r)=>{var s=r(7147);var a=r(1017);var n=r(7673);var o=r(7901);var i=r(7023);var l=r(8746);var c=s.realpath&&typeof s.realpath.native==="function"?s.realpath.native:s.realpath;var u=function isFile(e,t){s.stat(e,(function(e,r){if(!e){return t(null,r.isFile()||r.isFIFO())}if(e.code==="ENOENT"||e.code==="ENOTDIR")return t(null,false);return t(e)}))};var p=function isDirectory(e,t){s.stat(e,(function(e,r){if(!e){return t(null,r.isDirectory())}if(e.code==="ENOENT"||e.code==="ENOTDIR")return t(null,false);return t(e)}))};var f=function realpath(e,t){c(e,(function(r,s){if(r&&r.code!=="ENOENT")t(r);else t(null,r?e:s)}))};var d=function maybeRealpath(e,t,r,s){if(r&&r.preserveSymlinks===false){e(t,s)}else{s(null,t)}};var m=function defaultReadPackage(e,t,r){e(t,(function(e,t){if(e)r(e);else{try{var s=JSON.parse(t);r(null,s)}catch(e){r(null)}}}))};var y=function getPackageCandidates(e,t,r){var s=o(t,r,e);for(var n=0;n{e.exports=function(){var e=Error.prepareStackTrace;Error.prepareStackTrace=function(e,t){return t};var t=(new Error).stack;Error.prepareStackTrace=e;return t[2].getFileName()}},9118:(e,t,r)=>{var s=process.versions&&process.versions.node&&process.versions.node.split(".")||[];function specifierIncluded(e){var t=e.split(" ");var r=t.length>1?t[0]:"=";var a=(t.length>1?t[1]:t[0]).split(".");for(var n=0;n<3;++n){var o=parseInt(s[n]||0,10);var i=parseInt(a[n]||0,10);if(o===i){continue}if(r==="<"){return o="){return o>=i}else{return false}}return r===">="}function matchesRange(e){var t=e.split(/ ?&& ?/);if(t.length===0){return false}for(var r=0;r{var s=r(8746);e.exports=function isCore(e){return s(e)}},7901:(e,t,r)=>{var s=r(1017);var a=s.parse||r(2742);var n=function getNodeModulesDirs(e,t){var r="/";if(/^([A-Za-z]:)/.test(e)){r=""}else if(/^\\\\/.test(e)){r="\\\\"}var n=[e];var o=a(e);while(o.dir!==n[n.length-1]){n.push(o.dir);o=a(o.dir)}return n.reduce((function(e,a){return e.concat(t.map((function(e){return s.resolve(r,a,e)})))}),[])};e.exports=function nodeModulesPaths(e,t,r){var s=t&&t.moduleDirectory?[].concat(t.moduleDirectory):["node_modules"];if(t&&typeof t.paths==="function"){return t.paths(r,e,(function(){return n(e,s)}),t)}var a=n(e,s);return t&&t.paths?a.concat(t.paths):a}},7023:e=>{e.exports=function(e,t){return t||{}}},5565:(e,t,r)=>{var s=r(8746);var a=r(7147);var n=r(1017);var o=r(7673);var i=r(7901);var l=r(7023);var c=a.realpathSync&&typeof a.realpathSync.native==="function"?a.realpathSync.native:a.realpathSync;var u=function isFile(e){try{var t=a.statSync(e)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return false;throw e}return t.isFile()||t.isFIFO()};var p=function isDirectory(e){try{var t=a.statSync(e)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return false;throw e}return t.isDirectory()};var f=function realpathSync(e){try{return c(e)}catch(e){if(e.code!=="ENOENT"){throw e}}return e};var d=function maybeRealpathSync(e,t,r){if(r&&r.preserveSymlinks===false){return e(t)}return t};var m=function defaultReadPackageSync(e,t){var r=e(t);try{var s=JSON.parse(r);return s}catch(e){}};var y=function getPackageCandidates(e,t,r){var s=i(t,r,e);for(var a=0;a{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(8622);function getObjRef(e,t,r){let a;if(s.isIdentifier(e)){if(r.hasBinding(e.name)){return e}else{a=e}}else if(s.isMemberExpression(e)){a=e.object;if(s.isSuper(a)||s.isIdentifier(a)&&r.hasBinding(a.name)){return a}}else{throw new Error(`We can't explode this node type ${e["type"]}`)}const n=r.generateUidIdentifierBasedOnNode(a);r.push({id:n});t.push(s.assignmentExpression("=",s.cloneNode(n),s.cloneNode(a)));return n}function getPropRef(e,t,r){const a=e.property;if(s.isPrivateName(a)){throw new Error("We can't generate property ref for private name, please install `@babel/plugin-proposal-class-properties`")}const n=s.toComputedKey(e,a);if(s.isLiteral(n)&&s.isPureish(n))return n;const o=r.generateUidIdentifierBasedOnNode(a);r.push({id:o});t.push(s.assignmentExpression("=",s.cloneNode(o),s.cloneNode(a)));return o}function _default(e,t,r,a,n){let o;if(s.isIdentifier(e)&&n){o=e}else{o=getObjRef(e,t,a)}let i,l;if(s.isIdentifier(e)){i=s.cloneNode(e);l=o}else{const r=getPropRef(e,t,a);const n=e.computed||s.isLiteral(r);l=s.memberExpression(s.cloneNode(o),s.cloneNode(r),n);i=s.memberExpression(s.cloneNode(o),s.cloneNode(r),n)}return{uid:l,ref:i}}},550:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(3811);var a=r(153);var n=r(8622);const o=(0,a.default)(`\n (function (FUNCTION_KEY) {\n function FUNCTION_ID() {\n return FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n }\n\n return FUNCTION_ID;\n })(FUNCTION)\n`);const i=(0,a.default)(`\n (function (FUNCTION_KEY) {\n function* FUNCTION_ID() {\n return yield* FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n };\n\n return FUNCTION_ID;\n })(FUNCTION)\n`);const l={"ReferencedIdentifier|BindingIdentifier"(e,t){if(e.node.name!==t.name)return;const r=e.scope.getBindingIdentifier(t.name);if(r!==t.outerDeclar)return;t.selfReference=true;e.stop()}};function getNameFromLiteralId(e){if(n.isNullLiteral(e)){return"null"}if(n.isRegExpLiteral(e)){return`_${e.pattern}_${e.flags}`}if(n.isTemplateLiteral(e)){return e.quasis.map((e=>e.value.raw)).join("")}if(e.value!==undefined){return e.value+""}return""}function wrap(e,t,r,a){if(e.selfReference){if(a.hasBinding(r.name)&&!a.hasGlobal(r.name)){a.rename(r.name)}else{if(!n.isFunction(t))return;let e=o;if(t.generator){e=i}const l=e({FUNCTION:t,FUNCTION_ID:r,FUNCTION_KEY:a.generateUidIdentifier(r.name)}).expression;const c=l.callee.body.body[0].params;for(let e=0,r=(0,s.default)(t);e{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=hoistVariables;var s=r(8622);const a={Scope(e,t){if(t.kind==="let")e.skip()},FunctionParent(e){e.skip()},VariableDeclaration(e,t){if(t.kind&&e.node.kind!==t.kind)return;const r=[];const a=e.get("declarations");let n;for(const e of a){n=e.node.id;if(e.node.init){r.push(s.expressionStatement(s.assignmentExpression("=",e.node.id,e.node.init)))}for(const r of Object.keys(e.getBindingIdentifiers())){t.emit(s.identifier(r),r,e.node.init!==null)}}if(e.parentPath.isFor({left:e.node})){e.replaceWith(n)}else{e.replaceWithMultiple(r)}}};function hoistVariables(e,t,r="var"){e.traverse(a,{kind:r,emit:t})}},6591:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9491);var a=r(8622);class ImportBuilder{constructor(e,t,r){this._statements=[];this._resultName=null;this._scope=null;this._hub=null;this._importedSource=void 0;this._scope=t;this._hub=r;this._importedSource=e}done(){return{statements:this._statements,resultName:this._resultName}}import(){this._statements.push(a.importDeclaration([],a.stringLiteral(this._importedSource)));return this}require(){this._statements.push(a.expressionStatement(a.callExpression(a.identifier("require"),[a.stringLiteral(this._importedSource)])));return this}namespace(e="namespace"){const t=this._scope.generateUidIdentifier(e);const r=this._statements[this._statements.length-1];s(r.type==="ImportDeclaration");s(r.specifiers.length===0);r.specifiers=[a.importNamespaceSpecifier(t)];this._resultName=a.cloneNode(t);return this}default(e){e=this._scope.generateUidIdentifier(e);const t=this._statements[this._statements.length-1];s(t.type==="ImportDeclaration");s(t.specifiers.length===0);t.specifiers=[a.importDefaultSpecifier(e)];this._resultName=a.cloneNode(e);return this}named(e,t){if(t==="default")return this.default(e);e=this._scope.generateUidIdentifier(e);const r=this._statements[this._statements.length-1];s(r.type==="ImportDeclaration");s(r.specifiers.length===0);r.specifiers=[a.importSpecifier(e,a.identifier(t))];this._resultName=a.cloneNode(e);return this}var(e){e=this._scope.generateUidIdentifier(e);let t=this._statements[this._statements.length-1];if(t.type!=="ExpressionStatement"){s(this._resultName);t=a.expressionStatement(this._resultName);this._statements.push(t)}this._statements[this._statements.length-1]=a.variableDeclaration("var",[a.variableDeclarator(e,t.expression)]);this._resultName=a.cloneNode(e);return this}defaultInterop(){return this._interop(this._hub.addHelper("interopRequireDefault"))}wildcardInterop(){return this._interop(this._hub.addHelper("interopRequireWildcard"))}_interop(e){const t=this._statements[this._statements.length-1];if(t.type==="ExpressionStatement"){t.expression=a.callExpression(e,[t.expression])}else if(t.type==="VariableDeclaration"){s(t.declarations.length===1);t.declarations[0].init=a.callExpression(e,[t.declarations[0].init])}else{s.fail("Unexpected type.")}return this}prop(e){const t=this._statements[this._statements.length-1];if(t.type==="ExpressionStatement"){t.expression=a.memberExpression(t.expression,a.identifier(e))}else if(t.type==="VariableDeclaration"){s(t.declarations.length===1);t.declarations[0].init=a.memberExpression(t.declarations[0].init,a.identifier(e))}else{s.fail("Unexpected type:"+t.type)}return this}read(e){this._resultName=a.memberExpression(this._resultName,a.identifier(e))}}t["default"]=ImportBuilder},4872:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9491);var a=r(8622);var n=r(6591);var o=r(1719);class ImportInjector{constructor(e,t,r){this._defaultOpts={importedSource:null,importedType:"commonjs",importedInterop:"babel",importingInterop:"babel",ensureLiveReference:false,ensureNoContext:false,importPosition:"before"};const s=e.find((e=>e.isProgram()));this._programPath=s;this._programScope=s.scope;this._hub=s.hub;this._defaultOpts=this._applyDefaults(t,r,true)}addDefault(e,t){return this.addNamed("default",e,t)}addNamed(e,t,r){s(typeof e==="string");return this._generateImport(this._applyDefaults(t,r),e)}addNamespace(e,t){return this._generateImport(this._applyDefaults(e,t),null)}addSideEffect(e,t){return this._generateImport(this._applyDefaults(e,t),false)}_applyDefaults(e,t,r=false){const a=[];if(typeof e==="string"){a.push({importedSource:e});a.push(t)}else{s(!t,"Unexpected secondary arguments.");a.push(e)}const n=Object.assign({},this._defaultOpts);for(const e of a){if(!e)continue;Object.keys(n).forEach((t=>{if(e[t]!==undefined)n[t]=e[t]}));if(!r){if(e.nameHint!==undefined)n.nameHint=e.nameHint;if(e.blockHoist!==undefined)n.blockHoist=e.blockHoist}}return n}_generateImport(e,t){const r=t==="default";const s=!!t&&!r;const i=t===null;const{importedSource:l,importedType:c,importedInterop:u,importingInterop:p,ensureLiveReference:f,ensureNoContext:d,nameHint:m,importPosition:y,blockHoist:g}=e;let h=m||t;const b=(0,o.default)(this._programPath);const x=b&&p==="node";const v=b&&p==="babel";if(y==="after"&&!b){throw new Error(`"importPosition": "after" is only supported in modules`)}const E=new n.default(l,this._programScope,this._hub);if(c==="es6"){if(!x&&!v){throw new Error("Cannot import an ES6 module from CommonJS")}E.import();if(i){E.namespace(m||l)}else if(r||s){E.named(h,t)}}else if(c!=="commonjs"){throw new Error(`Unexpected interopType "${c}"`)}else if(u==="babel"){if(x){h=h!=="default"?h:l;const e=`${l}$es6Default`;E.import();if(i){E.default(e).var(h||l).wildcardInterop()}else if(r){if(f){E.default(e).var(h||l).defaultInterop().read("default")}else{E.default(e).var(h).defaultInterop().prop(t)}}else if(s){E.default(e).read(t)}}else if(v){E.import();if(i){E.namespace(h||l)}else if(r||s){E.named(h,t)}}else{E.require();if(i){E.var(h||l).wildcardInterop()}else if((r||s)&&f){if(r){h=h!=="default"?h:l;E.var(h).read(t);E.defaultInterop()}else{E.var(l).read(t)}}else if(r){E.var(h).defaultInterop().prop(t)}else if(s){E.var(h).prop(t)}}}else if(u==="compiled"){if(x){E.import();if(i){E.default(h||l)}else if(r||s){E.default(l).read(h)}}else if(v){E.import();if(i){E.namespace(h||l)}else if(r||s){E.named(h,t)}}else{E.require();if(i){E.var(h||l)}else if(r||s){if(f){E.var(l).read(h)}else{E.prop(t).var(h)}}}}else if(u==="uncompiled"){if(r&&f){throw new Error("No live reference for commonjs default")}if(x){E.import();if(i){E.default(h||l)}else if(r){E.default(h)}else if(s){E.default(l).read(h)}}else if(v){E.import();if(i){E.default(h||l)}else if(r){E.default(h)}else if(s){E.named(h,t)}}else{E.require();if(i){E.var(h||l)}else if(r){E.var(h)}else if(s){if(f){E.var(l).read(h)}else{E.var(h).prop(t)}}}}else{throw new Error(`Unknown importedInterop "${u}".`)}const{statements:j,resultName:w}=E.done();this._insertStatements(j,y,g);if((r||s)&&d&&w.type!=="Identifier"){return a.sequenceExpression([a.numericLiteral(0),w])}return w}_insertStatements(e,t="before",r=3){const s=this._programPath.get("body");if(t==="after"){for(let t=s.length-1;t>=0;t--){if(s[t].isImportDeclaration()){s[t].insertAfter(e);return}}}else{e.forEach((e=>{e._blockHoist=r}));const t=s.find((e=>{const t=e.node._blockHoist;return Number.isFinite(t)&&t<4}));if(t){t.insertBefore(e);return}}this._programPath.unshiftContainer("body",e)}}t["default"]=ImportInjector},9115:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.addDefault=addDefault;t.addNamed=addNamed;t.addNamespace=addNamespace;t.addSideEffect=addSideEffect;Object.defineProperty(t,"ImportInjector",{enumerable:true,get:function(){return s.default}});Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return a.default}});var s=r(4872);var a=r(1719);function addDefault(e,t,r){return new s.default(e).addDefault(t,r)}function addNamed(e,t,r,a){return new s.default(e).addNamed(t,r,a)}function addNamespace(e,t,r){return new s.default(e).addNamespace(t,r)}function addSideEffect(e,t,r){return new s.default(e).addSideEffect(t,r)}},1719:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=isModule;function isModule(e){const{sourceType:t}=e.node;if(t!=="module"&&t!=="script"){throw e.buildCodeFrameError(`Unknown sourceType "${t}", cannot transform.`)}return e.node.sourceType==="module"}},6721:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=optimiseCallExpression;var s=r(8622);function optimiseCallExpression(e,t,r,a){if(r.length===1&&s.isSpreadElement(r[0])&&s.isIdentifier(r[0].argument,{name:"arguments"})){if(a){return s.optionalCallExpression(s.optionalMemberExpression(e,s.identifier("apply"),false,true),[t,r[0].argument],false)}return s.callExpression(s.memberExpression(e,s.identifier("apply")),[t,r[0].argument])}else{if(a){return s.optionalCallExpression(s.optionalMemberExpression(e,s.identifier("call"),false,true),[t,...r],false)}return s.callExpression(s.memberExpression(e,s.identifier("call")),[t,...r])}}},9055:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,r,s)=>{if(!t.assertVersion){t=Object.assign(copyApiObject(t),{assertVersion(e){throwVersionError(e,t.version)}})}return e(t,r||{},s)}}function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7120:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(6946);var a=r(2155);var n=r(8622);const o={Function(e){e.skip()},AwaitExpression(e,{wrapAwait:t}){const r=e.get("argument");if(e.parentPath.isYieldExpression()){e.replaceWith(r.node);return}e.replaceWith(n.yieldExpression(t?n.callExpression(n.cloneNode(t),[r.node]):r.node))}};function _default(e,t,r){e.traverse(o,{wrapAwait:t.wrapAwait});const i=checkIsIIFE(e);e.node.async=false;e.node.generator=true;(0,s.default)(e,n.cloneNode(t.wrapAsync),r);const l=e.isObjectMethod()||e.isClassMethod()||e.parentPath.isObjectProperty()||e.parentPath.isClassProperty();if(!l&&!i&&e.isExpression()){(0,a.default)(e)}function checkIsIIFE(e){if(e.parentPath.isCallExpression({callee:e.node})){return true}const{parentPath:t}=e;if(t.isMemberExpression()&&n.isIdentifier(t.node.property,{name:"bind"})){const{parentPath:e}=t;return e.isCallExpression()&&e.node.arguments.length===1&&n.isThisExpression(e.node.arguments[0])&&e.parentPath.isCallExpression({callee:e.node})}return false}}},6833:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.skipAllButComputedKey=skipAllButComputedKey;t["default"]=t.environmentVisitor=void 0;var s=r(7369);var a=r(7281);var n=r(6721);var o=r(8622);function getPrototypeOfExpression(e,t,r,s){e=o.cloneNode(e);const a=t||s?e:o.memberExpression(e,o.identifier("prototype"));return o.callExpression(r.addHelper("getPrototypeOf"),[a])}function skipAllButComputedKey(e){if(!e.node.computed){e.skip();return}const t=o.VISITOR_KEYS[e.type];for(const r of t){if(r!=="key")e.skipKey(r)}}const i={[`${o.staticBlock?"StaticBlock|":""}ClassPrivateProperty|TypeAnnotation`](e){e.skip()},Function(e){if(e.isMethod())return;if(e.isArrowFunctionExpression())return;e.skip()},"Method|ClassProperty"(e){skipAllButComputedKey(e)}};t.environmentVisitor=i;const l=s.default.visitors.merge([i,{Super(e,t){const{node:r,parentPath:s}=e;if(!s.isMemberExpression({object:r}))return;t.handle(s)}}]);const c=s.default.visitors.merge([i,{Scopable(e,{refName:t}){const r=e.scope.getOwnBinding(t);if(r&&r.identifier.name===t){e.scope.rename(t)}}}]);const u={memoise(e,t){const{scope:r,node:s}=e;const{computed:a,property:n}=s;if(!a){return}const o=r.maybeGenerateMemoised(n);if(!o){return}this.memoiser.set(n,o,t)},prop(e){const{computed:t,property:r}=e.node;if(this.memoiser.has(r)){return o.cloneNode(this.memoiser.get(r))}if(t){return o.cloneNode(r)}return o.stringLiteral(r.name)},get(e){return this._get(e,this._getThisRefs())},_get(e,t){const r=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("get"),[t.memo?o.sequenceExpression([t.memo,r]):r,this.prop(e),t.this])},_getThisRefs(){if(!this.isDerivedConstructor){return{this:o.thisExpression()}}const e=this.scope.generateDeclaredUidIdentifier("thisSuper");return{memo:o.assignmentExpression("=",e,o.thisExpression()),this:o.cloneNode(e)}},set(e,t){const r=this._getThisRefs();const s=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("set"),[r.memo?o.sequenceExpression([r.memo,s]):s,this.prop(e),t,r.this,o.booleanLiteral(e.isInStrictMode())])},destructureSet(e){throw e.buildCodeFrameError(`Destructuring to a super field is not supported yet.`)},call(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,false)},optionalCall(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,true)}};const p=Object.assign({},u,{prop(e){const{property:t}=e.node;if(this.memoiser.has(t)){return o.cloneNode(this.memoiser.get(t))}return o.cloneNode(t)},get(e){const{isStatic:t,getSuperRef:r}=this;const{computed:s}=e.node;const a=this.prop(e);let n;if(t){var i;n=(i=r())!=null?i:o.memberExpression(o.identifier("Function"),o.identifier("prototype"))}else{var l;n=o.memberExpression((l=r())!=null?l:o.identifier("Object"),o.identifier("prototype"))}return o.memberExpression(n,a,s)},set(e,t){const{computed:r}=e.node;const s=this.prop(e);return o.assignmentExpression("=",o.memberExpression(o.thisExpression(),s,r),t)},destructureSet(e){const{computed:t}=e.node;const r=this.prop(e);return o.memberExpression(o.thisExpression(),r,t)},call(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,false)},optionalCall(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,true)}});class ReplaceSupers{constructor(e){var t;const r=e.methodPath;this.methodPath=r;this.isDerivedConstructor=r.isClassMethod({kind:"constructor"})&&!!e.superRef;this.isStatic=r.isObjectMethod()||r.node.static||(r.isStaticBlock==null?void 0:r.isStaticBlock());this.isPrivateMethod=r.isPrivate()&&r.isMethod();this.file=e.file;this.constantSuper=(t=e.constantSuper)!=null?t:e.isLoose;this.opts=e}getObjectRef(){return o.cloneNode(this.opts.objectRef||this.opts.getObjectRef())}getSuperRef(){if(this.opts.superRef)return o.cloneNode(this.opts.superRef);if(this.opts.getSuperRef)return o.cloneNode(this.opts.getSuperRef())}replace(){if(this.opts.refToPreserve){this.methodPath.traverse(c,{refName:this.opts.refToPreserve.name})}const e=this.constantSuper?p:u;(0,a.default)(this.methodPath,l,Object.assign({file:this.file,scope:this.methodPath.scope,isDerivedConstructor:this.isDerivedConstructor,isStatic:this.isStatic,isPrivateMethod:this.isPrivateMethod,getObjectRef:this.getObjectRef.bind(this),getSuperRef:this.getSuperRef.bind(this)},e))}}t["default"]=ReplaceSupers},7281:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(8622);function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach((function(r){if(r!=="default"){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:true,get:function(){return e[r]}})}}))}t["default"]=e;return Object.freeze(t)}var a=_interopNamespace(s);function willPathCastToBoolean(e){const t=e;const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}class AssignmentMemoiser{constructor(){this._map=void 0;this._map=new WeakMap}has(e){return this._map.has(e)}get(e){if(!this.has(e))return;const t=this._map.get(e);const{value:r}=t;t.count--;if(t.count===0){return a.assignmentExpression("=",r,e)}return r}set(e,t,r){return this._map.set(e,{count:r,value:t})}}function toNonOptional(e,t){const{node:r}=e;if(e.isOptionalMemberExpression()){return a.memberExpression(t,r.property,r.computed)}if(e.isOptionalCallExpression()){const s=e.get("callee");if(e.node.optional&&s.isOptionalMemberExpression()){const{object:n}=s.node;const o=e.scope.maybeGenerateMemoised(n)||n;s.get("object").replaceWith(a.assignmentExpression("=",o,n));return a.callExpression(a.memberExpression(t,a.identifier("call")),[o,...r.arguments])}return a.callExpression(t,r.arguments)}return e.node}function isInDetachedTree(e){while(e){if(e.isProgram())break;const{parentPath:t,container:r,listKey:s}=e;const a=t.node;if(s){if(r!==a[s])return true}else{if(r!==a)return true}e=t}return false}const n={memoise(){},handle(e,t){const{node:r,parent:s,parentPath:n,scope:o}=e;if(e.isOptionalMemberExpression()){if(isInDetachedTree(e))return;const i=e.find((({node:t,parent:r,parentPath:s})=>{if(s.isOptionalMemberExpression()){return r.optional||r.object!==t}if(s.isOptionalCallExpression()){return t!==e.node&&r.optional||r.callee!==t}return true}));if(o.path.isPattern()){i.replaceWith(a.callExpression(a.arrowFunctionExpression([],i.node),[]));return}const l=willPathCastToBoolean(i);const c=i.parentPath;if(c.isUpdateExpression({argument:r})||c.isAssignmentExpression({left:r})){throw e.buildCodeFrameError(`can't handle assignment`)}const u=c.isUnaryExpression({operator:"delete"});if(u&&i.isOptionalMemberExpression()&&i.get("property").isPrivateName()){throw e.buildCodeFrameError(`can't delete a private class element`)}let p=e;for(;;){if(p.isOptionalMemberExpression()){if(p.node.optional)break;p=p.get("object");continue}else if(p.isOptionalCallExpression()){if(p.node.optional)break;p=p.get("callee");continue}throw new Error(`Internal error: unexpected ${p.node.type}`)}const f=p.isOptionalMemberExpression()?"object":"callee";const d=p.node[f];const m=o.maybeGenerateMemoised(d);const y=m!=null?m:d;const g=n.isOptionalCallExpression({callee:r});const h=n.isCallExpression({callee:r});p.replaceWith(toNonOptional(p,y));if(g){if(s.optional){n.replaceWith(this.optionalCall(e,s.arguments))}else{n.replaceWith(this.call(e,s.arguments))}}else if(h){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}let b=e.node;for(let t=e;t!==i;){const{parentPath:e}=t;if(e===i&&g&&s.optional){b=e.node;break}b=toNonOptional(e,b);t=e}let x;const v=i.parentPath;if(a.isMemberExpression(b)&&v.isOptionalCallExpression({callee:i.node,optional:true})){const{object:t}=b;x=e.scope.maybeGenerateMemoised(t);if(x){b.object=a.assignmentExpression("=",x,t)}}let E=i;if(u){E=v;b=v.node}const j=m?a.assignmentExpression("=",a.cloneNode(y),a.cloneNode(d)):a.cloneNode(y);if(l){let e;if(t){e=a.binaryExpression("!=",j,a.nullLiteral())}else{e=a.logicalExpression("&&",a.binaryExpression("!==",j,a.nullLiteral()),a.binaryExpression("!==",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.logicalExpression("&&",e,b))}else{let e;if(t){e=a.binaryExpression("==",j,a.nullLiteral())}else{e=a.logicalExpression("||",a.binaryExpression("===",j,a.nullLiteral()),a.binaryExpression("===",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.conditionalExpression(e,u?a.booleanLiteral(true):o.buildUndefinedNode(),b))}if(x){const e=v.node;v.replaceWith(a.optionalCallExpression(a.optionalMemberExpression(e.callee,a.identifier("call"),false,true),[a.cloneNode(x),...e.arguments],false))}return}if(n.isUpdateExpression({argument:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,prefix:o}=s;this.memoise(e,2);const i=a.binaryExpression(t[0],a.unaryExpression("+",this.get(e)),a.numericLiteral(1));if(o){n.replaceWith(this.set(e,i))}else{const{scope:t}=e;const s=t.generateUidIdentifierBasedOnNode(r);t.push({id:s});i.left=a.assignmentExpression("=",a.cloneNode(s),i.left);n.replaceWith(a.sequenceExpression([this.set(e,i),a.cloneNode(s)]))}return}if(n.isAssignmentExpression({left:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,right:r}=s;if(t==="="){n.replaceWith(this.set(e,r))}else{const s=t.slice(0,-1);if(a.LOGICAL_OPERATORS.includes(s)){this.memoise(e,1);n.replaceWith(a.logicalExpression(s,this.get(e),this.set(e,r)))}else{this.memoise(e,2);n.replaceWith(this.set(e,a.binaryExpression(s,this.get(e),r)))}}return}if(n.isCallExpression({callee:r})){n.replaceWith(this.call(e,s.arguments));return}if(n.isOptionalCallExpression({callee:r})){if(o.path.isPattern()){n.replaceWith(a.callExpression(a.arrowFunctionExpression([],n.node),[]));return}n.replaceWith(this.optionalCall(e,s.arguments));return}if(n.isForXStatement({left:r})||n.isObjectProperty({value:r})&&n.parentPath.isObjectPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isObjectProperty({value:s})&&n.parentPath.parentPath.isObjectPattern()||n.isArrayPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isArrayPattern()||n.isRestElement()){e.replaceWith(this.destructureSet(e));return}e.replaceWith(this.get(e))}};function memberExpressionToFunctions(e,t,r){e.traverse(t,Object.assign({},n,r,{memoiser:new AssignmentMemoiser}))}t["default"]=memberExpressionToFunctions},5480:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isTransparentExprWrapper=isTransparentExprWrapper;t.skipTransparentExprWrappers=skipTransparentExprWrappers;var s=r(8622);function isTransparentExprWrapper(e){return s.isTSAsExpression(e)||s.isTSTypeAssertion(e)||s.isTSNonNullExpression(e)||s.isTypeCastExpression(e)||s.isParenthesizedExpression(e)}function skipTransparentExprWrappers(e){while(isTransparentExprWrapper(e.node)){e=e.get("expression")}return e}},7058:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=splitExportDeclaration;var s=r(8622);function splitExportDeclaration(e){if(!e.isExportDeclaration()){throw new Error("Only export declarations can be split.")}const t=e.isExportDefaultDeclaration();const r=e.get("declaration");const a=r.isClassDeclaration();if(t){const t=r.isFunctionDeclaration()||a;const n=r.isScope()?r.scope.parent:r.scope;let o=r.node.id;let i=false;if(!o){i=true;o=n.generateUidIdentifier("default");if(t||r.isFunctionExpression()||r.isClassExpression()){r.node.id=s.cloneNode(o)}}const l=t?r:s.variableDeclaration("var",[s.variableDeclarator(s.cloneNode(o),r.node)]);const c=s.exportNamedDeclaration(null,[s.exportSpecifier(s.cloneNode(o),s.identifier("default"))]);e.insertAfter(c);e.replaceWith(l);if(i){n.registerDeclaration(e)}return e}if(e.get("specifiers").length>0){throw new Error("It doesn't make sense to split exported specifiers.")}const n=r.getOuterBindingIdentifiers();const o=Object.keys(n).map((e=>s.exportSpecifier(s.identifier(e),s.identifier(e))));const i=s.exportNamedDeclaration(null,o);e.insertAfter(i);e.replaceWith(r.node);return e}},8785:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.findSuggestion=findSuggestion;const{min:r}=Math;function levenshtein(e,t){let s=[],a=[],n,o;const i=e.length,l=t.length;if(!i){return l}if(!l){return i}for(o=0;o<=l;o++){s[o]=o}for(n=1;n<=i;n++){for(a=[n],o=1;o<=l;o++){a[o]=e[n-1]===t[o-1]?s[o-1]:r(s[o-1],s[o],a[o-1])+1}s=a}return a[l]}function findSuggestion(e,t){const s=t.map((t=>levenshtein(t,e)));return t[s.indexOf(r(...s))]}},7347:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"OptionValidator",{enumerable:true,get:function(){return s.OptionValidator}});Object.defineProperty(t,"findSuggestion",{enumerable:true,get:function(){return a.findSuggestion}});var s=r(6885);var a=r(8785)},6885:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.OptionValidator=void 0;var s=r(8785);class OptionValidator{constructor(e){this.descriptor=e}validateTopLevelOptions(e,t){const r=Object.keys(t);for(const t of Object.keys(e)){if(!r.includes(t)){throw new Error(this.formatMessage(`'${t}' is not a valid top-level option.\n- Did you mean '${(0,s.findSuggestion)(t,r)}'?`))}}}validateBooleanOption(e,t,r){if(t===undefined){return r}else{this.invariant(typeof t==="boolean",`'${e}' option must be a boolean.`)}return t}validateStringOption(e,t,r){if(t===undefined){return r}else{this.invariant(typeof t==="string",`'${e}' option must be a string.`)}return t}invariant(e,t){if(!e){throw new Error(this.formatMessage(t))}}formatMessage(e){return`${this.descriptor}: ${e}`}}t.OptionValidator=OptionValidator},6946:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=wrapFunction;var s=r(550);var a=r(153);var n=r(8622);const o=a.default.expression(`\n (function () {\n var REF = FUNCTION;\n return function NAME(PARAMS) {\n return REF.apply(this, arguments);\n };\n })()\n`);const i=a.default.expression(`\n (function () {\n var REF = FUNCTION;\n function NAME(PARAMS) {\n return REF.apply(this, arguments);\n }\n return NAME;\n })()\n`);const l=(0,a.default)(`\n function NAME(PARAMS) { return REF.apply(this, arguments); }\n function REF() {\n REF = FUNCTION;\n return REF.apply(this, arguments);\n }\n`);function classOrObjectMethod(e,t){const r=e.node;const s=r.body;const a=n.functionExpression(null,[],n.blockStatement(s.body),true);s.body=[n.returnStatement(n.callExpression(n.callExpression(t,[a]),[]))];r.async=false;r.generator=false;e.get("body.body.0.argument.callee.arguments.0").unwrapFunctionEnvironment()}function plainFunction(e,t,r){const a=e.node;const c=e.isFunctionDeclaration();const u=a.id;const p=c?l:u?i:o;if(e.isArrowFunctionExpression()){e.arrowFunctionToExpression({noNewArrows:r})}a.id=null;if(c){a.type="FunctionExpression"}const f=n.callExpression(t,[a]);const d=p({NAME:u||null,REF:e.scope.generateUidIdentifier(u?u.name:"ref"),FUNCTION:f,PARAMS:a.params.reduce(((t,r)=>{t.done=t.done||n.isAssignmentPattern(r)||n.isRestElement(r);if(!t.done){t.params.push(e.scope.generateUidIdentifier("x"))}return t}),{params:[],done:false}).params});if(c){e.replaceWith(d[0]);e.insertAfter(d[1])}else{const t=d.callee.body.body[1].argument;if(!u){(0,s.default)({node:t,parent:e.parent,scope:e.scope})}if(!t||t.id||a.params.length){e.replaceWith(d)}else{e.replaceWith(f)}}}function wrapFunction(e,t,r=true){if(e.isMethod()){classOrObjectMethod(e,t)}else{plainFunction(e,t,r)}}},8027:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(249);var a=r(6758);var n=(0,s.declare)(((e,t)=>{e.assertVersion(7);return(0,a.createClassFeaturePlugin)({name:"proposal-class-properties",api:e,feature:a.FEATURES.fields,loose:t.loose,manipulateOptions(e,t){t.plugins.push("classProperties","classPrivateProperties")}})}));t["default"]=n},249:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},4920:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3497);var a=r(2074);const n=["commonjs","amd","systemjs"];const o=`@babel/plugin-proposal-dynamic-import depends on a modules\ntransform plugin. Supported plugins are:\n - @babel/plugin-transform-modules-commonjs ^7.4.0\n - @babel/plugin-transform-modules-amd ^7.4.0\n - @babel/plugin-transform-modules-systemjs ^7.4.0\n\nIf you are using Webpack or Rollup and thus don't want\nBabel to transpile your imports and exports, you can use\nthe @babel/plugin-syntax-dynamic-import plugin and let your\nbundler handle dynamic imports.\n`;var i=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-dynamic-import",inherits:a.default,pre(){this.file.set("@babel/plugin-proposal-dynamic-import","7.14.5")},visitor:{Program(){const e=this.file.get("@babel/plugin-transform-modules-*");if(!n.includes(e)){throw new Error(o)}}}}}));t["default"]=i},3497:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9579:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(791);var a=r(1454);var n=r(8304);var o=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-export-namespace-from",inherits:a.default,visitor:{ExportNamedDeclaration(e){var t;const{node:r,scope:s}=e;const{specifiers:a}=r;const o=n.types.isExportDefaultSpecifier(a[0])?1:0;if(!n.types.isExportNamespaceSpecifier(a[o]))return;const i=[];if(o===1){i.push(n.types.exportNamedDeclaration(null,[a.shift()],r.source))}const l=a.shift();const{exported:c}=l;const u=s.generateUidIdentifier((t=c.name)!=null?t:c.value);i.push(n.types.importDeclaration([n.types.importNamespaceSpecifier(u)],n.types.cloneNode(r.source)),n.types.exportNamedDeclaration(null,[n.types.exportSpecifier(n.types.cloneNode(u),c)]));if(r.specifiers.length>=1){i.push(r)}const[p]=e.replaceWithMultiple(i);e.scope.registerDeclaration(p)}}}}));t["default"]=o},791:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7703:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(169);var a=r(3030);var n=(0,s.declare)((e=>{e.assertVersion(7);const t=/(\\*)([\u2028\u2029])/g;function replace(e,t,r){const s=t.length%2===1;if(s)return e;return`${t}\\u${r.charCodeAt(0).toString(16)}`}return{name:"proposal-json-strings",inherits:a.default,visitor:{"DirectiveLiteral|StringLiteral"({node:e}){const{extra:r}=e;if(!(r!=null&&r.raw))return;r.raw=r.raw.replace(t,replace)}}}}));t["default"]=n},169:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1195:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(7010);var a=r(5945);var n=r(8304);var o=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-logical-assignment-operators",inherits:a.default,visitor:{AssignmentExpression(e){const{node:t,scope:r}=e;const{operator:s,left:a,right:o}=t;const i=s.slice(0,-1);if(!n.types.LOGICAL_OPERATORS.includes(i)){return}const l=n.types.cloneNode(a);if(n.types.isMemberExpression(a)){const{object:e,property:t,computed:s}=a;const o=r.maybeGenerateMemoised(e);if(o){a.object=o;l.object=n.types.assignmentExpression("=",n.types.cloneNode(o),e)}if(s){const e=r.maybeGenerateMemoised(t);if(e){a.property=e;l.property=n.types.assignmentExpression("=",n.types.cloneNode(e),t)}}}e.replaceWith(n.types.logicalExpression(i,l,n.types.assignmentExpression("=",a,o)))}}}}));t["default"]=o},7010:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5353:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6080);var a=r(5879);var n=r(8304);var o=(0,s.declare)(((e,{loose:t=false})=>{var r;e.assertVersion(7);const s=(r=e.assumption("noDocumentAll"))!=null?r:t;return{name:"proposal-nullish-coalescing-operator",inherits:a.default,visitor:{LogicalExpression(e){const{node:t,scope:r}=e;if(t.operator!=="??"){return}let a;let o;if(r.isStatic(t.left)){a=t.left;o=n.types.cloneNode(t.left)}else if(r.path.isPattern()){e.replaceWith(n.template.ast`(() => ${e.node})()`);return}else{a=r.generateUidIdentifierBasedOnNode(t.left);r.push({id:n.types.cloneNode(a)});o=n.types.assignmentExpression("=",a,t.left)}e.replaceWith(n.types.conditionalExpression(s?n.types.binaryExpression("!=",o,n.types.nullLiteral()):n.types.logicalExpression("&&",n.types.binaryExpression("!==",o,n.types.nullLiteral()),n.types.binaryExpression("!==",n.types.cloneNode(a),r.buildUndefinedNode())),n.types.cloneNode(a),t.right))}}}}));t["default"]=o},6080:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7300:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(5071);var a=r(1816);function remover({node:e}){var t;const{extra:r}=e;if(r!=null&&(t=r.raw)!=null&&t.includes("_")){r.raw=r.raw.replace(/_/g,"")}}var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-numeric-separator",inherits:a.default,visitor:{NumericLiteral:remover,BigIntLiteral:remover}}}));t["default"]=n},5071:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},6309:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8711);var a=r(4499);var n=r(8304);var o=r(3714);var i=r(797);var l=r(5732);const c=(()=>{const e=n.types.identifier("a");const t=n.types.objectProperty(n.types.identifier("key"),e);const r=n.types.objectPattern([t]);return n.types.isReferenced(e,t,r)?1:0})();var u=(0,s.declare)(((e,t)=>{var r,s,u,p;e.assertVersion(7);const f=e.targets();const d=!(0,i.isRequired)("es6.object.assign",f,{compatData:l});const{useBuiltIns:m=d,loose:y=false}=t;if(typeof y!=="boolean"){throw new Error(".loose must be a boolean, or undefined")}const g=(r=e.assumption("ignoreFunctionLength"))!=null?r:y;const h=(s=e.assumption("objectRestNoSymbols"))!=null?s:y;const b=(u=e.assumption("pureGetters"))!=null?u:y;const x=(p=e.assumption("setSpreadProperties"))!=null?p:y;function getExtendsHelper(e){return m?n.types.memberExpression(n.types.identifier("Object"),n.types.identifier("assign")):e.addHelper("extends")}function hasRestElement(e){let t=false;visitRestElements(e,(e=>{t=true;e.stop()}));return t}function hasObjectPatternRestElement(e){let t=false;visitRestElements(e,(e=>{if(e.parentPath.isObjectPattern()){t=true;e.stop()}}));return t}function visitRestElements(e,t){e.traverse({Expression(e){const t=e.parent.type;if(t==="AssignmentPattern"&&e.key==="right"||t==="ObjectProperty"&&e.parent.computed&&e.key==="key"){e.skip()}},RestElement:t})}function hasSpread(e){for(const t of e.properties){if(n.types.isSpreadElement(t)){return true}}return false}function extractNormalizedKeys(e){const t=e.node.properties;const r=[];let s=true;let a=false;for(const e of t){if(n.types.isIdentifier(e.key)&&!e.computed){r.push(n.types.stringLiteral(e.key.name))}else if(n.types.isTemplateLiteral(e.key)){r.push(n.types.cloneNode(e.key));a=true}else if(n.types.isLiteral(e.key)){r.push(n.types.stringLiteral(String(e.key.value)))}else{r.push(n.types.cloneNode(e.key));s=false}}return{keys:r,allLiteral:s,hasTemplateLiteral:a}}function replaceImpureComputedKeys(e,t){const r=[];for(const s of e){const e=s.get("key");if(s.node.computed&&!e.isPure()){const s=t.generateUidBasedOnNode(e.node);const a=n.types.variableDeclarator(n.types.identifier(s),e.node);r.push(a);e.replaceWith(n.types.identifier(s))}}return r}function removeUnusedExcludedKeys(e){const t=e.getOuterBindingIdentifierPaths();Object.keys(t).forEach((r=>{const s=t[r].parentPath;if(e.scope.getBinding(r).references>c||!s.isObjectProperty()){return}s.remove()}))}function createObjectRest(e,t,r){const s=e.get("properties");const a=s[s.length-1];n.types.assertRestElement(a.node);const o=n.types.cloneNode(a.node);a.remove();const i=replaceImpureComputedKeys(e.get("properties"),e.scope);const{keys:l,allLiteral:c,hasTemplateLiteral:u}=extractNormalizedKeys(e);if(l.length===0){return[i,o.argument,n.types.callExpression(getExtendsHelper(t),[n.types.objectExpression([]),n.types.cloneNode(r)])]}let p;if(!c){p=n.types.callExpression(n.types.memberExpression(n.types.arrayExpression(l),n.types.identifier("map")),[t.addHelper("toPropertyKey")])}else{p=n.types.arrayExpression(l);if(!u&&!n.types.isProgram(e.scope.block)){const t=e.findParent((e=>e.isProgram()));const r=e.scope.generateUidIdentifier("excluded");t.scope.push({id:r,init:p,kind:"const"});p=n.types.cloneNode(r)}}return[i,o.argument,n.types.callExpression(t.addHelper(`objectWithoutProperties${h?"Loose":""}`),[n.types.cloneNode(r),p])]}function replaceRestElement(e,t,r){if(t.isAssignmentPattern()){replaceRestElement(e,t.get("left"),r);return}if(t.isArrayPattern()&&hasRestElement(t)){const s=t.get("elements");for(let t=0;te.skip(),"ReferencedIdentifier|BindingIdentifier":IdentifierHandler},e.scope)}}}if(!a){for(let e=0;ee>=n-1||r.has(e);(0,o.convertFunctionParams)(e,g,shouldTransformParam,replaceRestElement)}},VariableDeclarator(e,t){if(!e.get("id").isObjectPattern()){return}let r=e;const s=e;visitRestElements(e.get("id"),(e=>{if(!e.parentPath.isObjectPattern()){return}if(s.node.id.properties.length>1&&!n.types.isIdentifier(s.node.init)){const t=e.scope.generateUidIdentifierBasedOnNode(s.node.init,"ref");s.insertBefore(n.types.variableDeclarator(t,s.node.init));s.replaceWith(n.types.variableDeclarator(s.node.id,n.types.cloneNode(t)));return}let a=s.node.init;const o=[];let i;e.findParent((e=>{if(e.isObjectProperty()){o.unshift(e)}else if(e.isVariableDeclarator()){i=e.parentPath.node.kind;return true}}));const l=replaceImpureComputedKeys(o,e.scope);o.forEach((e=>{const{node:t}=e;a=n.types.memberExpression(a,n.types.cloneNode(t.key),t.computed||n.types.isLiteral(t.key))}));const c=e.findParent((e=>e.isObjectPattern()));const[u,p,f]=createObjectRest(c,t,a);if(b){removeUnusedExcludedKeys(c)}n.types.assertIdentifier(p);r.insertBefore(u);r.insertBefore(l);r.insertAfter(n.types.variableDeclarator(p,f));r=r.getSibling(r.key+1);e.scope.registerBinding(i,r);if(c.node.properties.length===0){c.findParent((e=>e.isObjectProperty()||e.isVariableDeclarator())).remove()}}))},ExportNamedDeclaration(e){const t=e.get("declaration");if(!t.isVariableDeclaration())return;const r=t.get("declarations").some((e=>hasObjectPatternRestElement(e.get("id"))));if(!r)return;const s=[];for(const t of Object.keys(e.getOuterBindingIdentifiers(e))){s.push(n.types.exportSpecifier(n.types.identifier(t),n.types.identifier(t)))}e.replaceWith(t.node);e.insertAfter(n.types.exportNamedDeclaration(null,s))},CatchClause(e){const t=e.get("param");replaceRestElement(t.parentPath,t)},AssignmentExpression(e,t){const r=e.get("left");if(r.isObjectPattern()&&hasRestElement(r)){const s=[];const a=e.scope.generateUidBasedOnNode(e.node.right,"ref");s.push(n.types.variableDeclaration("var",[n.types.variableDeclarator(n.types.identifier(a),e.node.right)]));const[o,i,l]=createObjectRest(r,t,n.types.identifier(a));if(o.length>0){s.push(n.types.variableDeclaration("var",o))}const c=n.types.cloneNode(e.node);c.right=n.types.identifier(a);s.push(n.types.expressionStatement(c));s.push(n.types.toStatement(n.types.assignmentExpression("=",i,l)));s.push(n.types.expressionStatement(n.types.identifier(a)));e.replaceWithMultiple(s)}},ForXStatement(e){const{node:t,scope:r}=e;const s=e.get("left");const a=t.left;if(!hasObjectPatternRestElement(s)){return}if(!n.types.isVariableDeclaration(a)){const s=r.generateUidIdentifier("ref");t.left=n.types.variableDeclaration("var",[n.types.variableDeclarator(s)]);e.ensureBlock();if(t.body.body.length===0&&e.isCompletionRecord()){t.body.body.unshift(n.types.expressionStatement(r.buildUndefinedNode()))}t.body.body.unshift(n.types.expressionStatement(n.types.assignmentExpression("=",a,n.types.cloneNode(s))))}else{const s=a.declarations[0].id;const o=r.generateUidIdentifier("ref");t.left=n.types.variableDeclaration(a.kind,[n.types.variableDeclarator(o,null)]);e.ensureBlock();t.body.body.unshift(n.types.variableDeclaration(t.left.kind,[n.types.variableDeclarator(s,n.types.cloneNode(o))]))}},ArrayPattern(e){const t=[];visitRestElements(e,(e=>{if(!e.parentPath.isObjectPattern()){return}const r=e.parentPath;const s=e.scope.generateUidIdentifier("ref");t.push(n.types.variableDeclarator(r.node,s));r.replaceWith(n.types.cloneNode(s));e.skip()}));if(t.length>0){const r=e.getStatementParent();r.insertAfter(n.types.variableDeclaration(r.node.kind||"var",t))}},ObjectExpression(e,t){if(!hasSpread(e.node))return;let r;if(x){r=getExtendsHelper(t)}else{try{r=t.addHelper("objectSpread2")}catch(e){this.file.declarations["objectSpread2"]=null;r=t.addHelper("objectSpread")}}let s=null;let a=[];function make(){const e=a.length>0;const t=n.types.objectExpression(a);a=[];if(!s){s=n.types.callExpression(r,[t]);return}if(b){if(e){s.arguments.push(t)}return}s=n.types.callExpression(n.types.cloneNode(r),[s,...e?[n.types.objectExpression([]),t]:[]])}for(const t of e.node.properties){if(n.types.isSpreadElement(t)){make();s.arguments.push(t.argument)}else{a.push(t)}}if(a.length)make();e.replaceWith(s)}}}}));t["default"]=u},5732:(e,t,r)=>{e.exports=r(5880)},8711:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},4195:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6970);var a=r(7452);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-optional-catch-binding",inherits:a.default,visitor:{CatchClause(e){if(!e.node.param){const t=e.scope.generateUidIdentifier("unused");const r=e.get("param");r.replaceWith(t)}}}}}));t["default"]=n},6970:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7490:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(2262);var a=r(79);var n=r(8304);var o=r(5480);function _interopDefaultLegacy(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var i=_interopDefaultLegacy(a);function willPathCastToBoolean(e){const t=findOutermostTransparentParent(e);const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}function findOutermostTransparentParent(e){let t=e;e.findParent((e=>{if(!o.isTransparentExprWrapper(e))return true;t=e}));return t}const{ast:l}=n.template.expression;function isSimpleMemberExpression(e){e=o.skipTransparentExprWrappers(e);return n.types.isIdentifier(e)||n.types.isSuper(e)||n.types.isMemberExpression(e)&&!e.computed&&isSimpleMemberExpression(e.object)}function needsMemoize(e){let t=e;const{scope:r}=e;while(t.isOptionalMemberExpression()||t.isOptionalCallExpression()){const{node:e}=t;const s=t.isOptionalMemberExpression()?"object":"callee";const a=o.skipTransparentExprWrappers(t.get(s));if(e.optional){return!r.isStatic(a.node)}t=a}}function transform(e,{pureGetters:t,noDocumentAll:r}){const{scope:s}=e;const a=findOutermostTransparentParent(e);const{parentPath:i}=a;const c=willPathCastToBoolean(a);let u=false;const p=i.isCallExpression({callee:a.node})&&e.isOptionalMemberExpression();const f=[];let d=e;if(s.path.isPattern()&&needsMemoize(d)){e.replaceWith(n.template.ast`(() => ${e.node})()`);return}while(d.isOptionalMemberExpression()||d.isOptionalCallExpression()){const{node:e}=d;if(e.optional){f.push(e)}if(d.isOptionalMemberExpression()){d.node.type="MemberExpression";d=o.skipTransparentExprWrappers(d.get("object"))}else if(d.isOptionalCallExpression()){d.node.type="CallExpression";d=o.skipTransparentExprWrappers(d.get("callee"))}}let m=e;if(i.isUnaryExpression({operator:"delete"})){m=i;u=true}for(let e=f.length-1;e>=0;e--){const a=f[e];const i=n.types.isCallExpression(a);const d=i?"callee":"object";const g=a[d];let h=g;while(o.isTransparentExprWrapper(h)){h=h.expression}let b;let x;if(i&&n.types.isIdentifier(h,{name:"eval"})){x=b=h;a[d]=n.types.sequenceExpression([n.types.numericLiteral(0),b])}else if(t&&i&&isSimpleMemberExpression(h)){x=b=g}else{b=s.maybeGenerateMemoised(h);if(b){x=n.types.assignmentExpression("=",n.types.cloneNode(b),g);a[d]=b}else{x=b=g}}if(i&&n.types.isMemberExpression(h)){if(t&&isSimpleMemberExpression(h)){a.callee=g}else{const{object:e}=h;let t=s.maybeGenerateMemoised(e);if(t){h.object=n.types.assignmentExpression("=",t,e)}else if(n.types.isSuper(e)){t=n.types.thisExpression()}else{t=e}a.arguments.unshift(n.types.cloneNode(t));a.callee=n.types.memberExpression(a.callee,n.types.identifier("call"))}}let v=m.node;if(e===0&&p){var y;const e=o.skipTransparentExprWrappers(m.get("object")).node;let r;if(!t||!isSimpleMemberExpression(e)){r=s.maybeGenerateMemoised(e);if(r){v.object=n.types.assignmentExpression("=",r,e)}}v=n.types.callExpression(n.types.memberExpression(v,n.types.identifier("bind")),[n.types.cloneNode((y=r)!=null?y:e)])}if(c){const e=r?l`${n.types.cloneNode(x)} != null`:l` + `):a.importDeclaration([a.importSpecifier(i,s)],t),name:i.name}}))},injectDefaultImport(t,s=t){return e.storeNamed(r,t,"default",((e,t)=>{const o=r.scope.generateUidIdentifier(s);return{node:e?hoist(n.statement.ast`var ${o} = require(${t})`):a.importDeclaration([a.importDefaultSpecifier(o)],t),name:o.name}}))}}}}},8160:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=r(4182);var _default=e=>({ImportDeclaration(t){const r=(0,s.getImportSource)(t);if(!r)return;e({kind:"import",source:r},t)},Program(t){t.get("body").forEach((t=>{const r=(0,s.getRequireSource)(t);if(!r)return;e({kind:"import",source:r},t)}))}});t["default"]=_default},9313:(e,t,r)=>{"use strict";t.__esModule=true;t.entry=t.usage=void 0;var s=_interopRequireDefault(r(6527));t.usage=s.default;var a=_interopRequireDefault(r(8160));t.entry=a.default;function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}},6527:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=r(4182);var _default=e=>{function property(t,r,s,a){return e({kind:"property",object:t,key:r,placement:s},a)}return{ReferencedIdentifier(t){const{node:{name:r},scope:s}=t;if(s.getBindingIdentifier(r))return;e({kind:"global",name:r},t)},MemberExpression(e){const t=(0,s.resolveKey)(e.get("property"),e.node.computed);if(!t||t==="prototype")return;const r=e.get("object");const a=r.scope.getBinding(r.node.name);if(a&&a.path.isImportNamespaceSpecifier())return;const n=(0,s.resolveSource)(r);return property(n.id,t,n.placement,e)},ObjectPattern(e){const{parentPath:t,parent:r}=e;let a;if(t.isVariableDeclarator()){a=t.get("init")}else if(t.isAssignmentExpression()){a=t.get("right")}else if(t.isFunction()){const s=t.parentPath;if(s.isCallExpression()||s.isNewExpression()){if(s.node.callee===r){a=s.get("arguments")[e.key]}}}let n=null;let o=null;if(a)({id:n,placement:o}=(0,s.resolveSource)(a));for(const t of e.get("properties")){if(t.isObjectProperty()){const e=(0,s.resolveKey)(t.get("key"));if(e)property(n,e,o,t)}}},BinaryExpression(t){if(t.node.operator!=="in")return;const r=(0,s.resolveSource)(t.get("right"));const a=(0,s.resolveKey)(t.get("left"),true);if(!a)return;e({kind:"in",object:r.id,key:a,placement:r.placement},t)}}};t["default"]=_default},1403:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9820:(e,t,r)=>{var s=r(7462);s.core=r(9118);s.isCore=r(779);s.sync=r(5565);e.exports=s},7462:(e,t,r)=>{var s=r(7147);var a=r(1017);var n=r(7673);var o=r(7901);var i=r(7023);var l=r(8746);var c=s.realpath&&typeof s.realpath.native==="function"?s.realpath.native:s.realpath;var u=function isFile(e,t){s.stat(e,(function(e,r){if(!e){return t(null,r.isFile()||r.isFIFO())}if(e.code==="ENOENT"||e.code==="ENOTDIR")return t(null,false);return t(e)}))};var p=function isDirectory(e,t){s.stat(e,(function(e,r){if(!e){return t(null,r.isDirectory())}if(e.code==="ENOENT"||e.code==="ENOTDIR")return t(null,false);return t(e)}))};var d=function realpath(e,t){c(e,(function(r,s){if(r&&r.code!=="ENOENT")t(r);else t(null,r?e:s)}))};var f=function maybeRealpath(e,t,r,s){if(r&&r.preserveSymlinks===false){e(t,s)}else{s(null,t)}};var m=function defaultReadPackage(e,t,r){e(t,(function(e,t){if(e)r(e);else{try{var s=JSON.parse(t);r(null,s)}catch(e){r(null)}}}))};var y=function getPackageCandidates(e,t,r){var s=o(t,r,e);for(var n=0;n{e.exports=function(){var e=Error.prepareStackTrace;Error.prepareStackTrace=function(e,t){return t};var t=(new Error).stack;Error.prepareStackTrace=e;return t[2].getFileName()}},9118:(e,t,r)=>{var s=process.versions&&process.versions.node&&process.versions.node.split(".")||[];function specifierIncluded(e){var t=e.split(" ");var r=t.length>1?t[0]:"=";var a=(t.length>1?t[1]:t[0]).split(".");for(var n=0;n<3;++n){var o=parseInt(s[n]||0,10);var i=parseInt(a[n]||0,10);if(o===i){continue}if(r==="<"){return o="){return o>=i}else{return false}}return r===">="}function matchesRange(e){var t=e.split(/ ?&& ?/);if(t.length===0){return false}for(var r=0;r{var s=r(8746);e.exports=function isCore(e){return s(e)}},7901:(e,t,r)=>{var s=r(1017);var a=s.parse||r(2742);var n=function getNodeModulesDirs(e,t){var r="/";if(/^([A-Za-z]:)/.test(e)){r=""}else if(/^\\\\/.test(e)){r="\\\\"}var n=[e];var o=a(e);while(o.dir!==n[n.length-1]){n.push(o.dir);o=a(o.dir)}return n.reduce((function(e,a){return e.concat(t.map((function(e){return s.resolve(r,a,e)})))}),[])};e.exports=function nodeModulesPaths(e,t,r){var s=t&&t.moduleDirectory?[].concat(t.moduleDirectory):["node_modules"];if(t&&typeof t.paths==="function"){return t.paths(r,e,(function(){return n(e,s)}),t)}var a=n(e,s);return t&&t.paths?a.concat(t.paths):a}},7023:e=>{e.exports=function(e,t){return t||{}}},5565:(e,t,r)=>{var s=r(8746);var a=r(7147);var n=r(1017);var o=r(7673);var i=r(7901);var l=r(7023);var c=a.realpathSync&&typeof a.realpathSync.native==="function"?a.realpathSync.native:a.realpathSync;var u=function isFile(e){try{var t=a.statSync(e)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return false;throw e}return t.isFile()||t.isFIFO()};var p=function isDirectory(e){try{var t=a.statSync(e)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return false;throw e}return t.isDirectory()};var d=function realpathSync(e){try{return c(e)}catch(e){if(e.code!=="ENOENT"){throw e}}return e};var f=function maybeRealpathSync(e,t,r){if(r&&r.preserveSymlinks===false){return e(t)}return t};var m=function defaultReadPackageSync(e,t){var r=e(t);try{var s=JSON.parse(r);return s}catch(e){}};var y=function getPackageCandidates(e,t,r){var s=i(t,r,e);for(var a=0;a{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(8622);function getObjRef(e,t,r){let a;if(s.isIdentifier(e)){if(r.hasBinding(e.name)){return e}else{a=e}}else if(s.isMemberExpression(e)){a=e.object;if(s.isSuper(a)||s.isIdentifier(a)&&r.hasBinding(a.name)){return a}}else{throw new Error(`We can't explode this node type ${e["type"]}`)}const n=r.generateUidIdentifierBasedOnNode(a);r.push({id:n});t.push(s.assignmentExpression("=",s.cloneNode(n),s.cloneNode(a)));return n}function getPropRef(e,t,r){const a=e.property;if(s.isPrivateName(a)){throw new Error("We can't generate property ref for private name, please install `@babel/plugin-proposal-class-properties`")}const n=s.toComputedKey(e,a);if(s.isLiteral(n)&&s.isPureish(n))return n;const o=r.generateUidIdentifierBasedOnNode(a);r.push({id:o});t.push(s.assignmentExpression("=",s.cloneNode(o),s.cloneNode(a)));return o}function _default(e,t,r,a,n){let o;if(s.isIdentifier(e)&&n){o=e}else{o=getObjRef(e,t,a)}let i,l;if(s.isIdentifier(e)){i=s.cloneNode(e);l=o}else{const r=getPropRef(e,t,a);const n=e.computed||s.isLiteral(r);l=s.memberExpression(s.cloneNode(o),s.cloneNode(r),n);i=s.memberExpression(s.cloneNode(o),s.cloneNode(r),n)}return{uid:l,ref:i}}},550:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(3811);var a=r(153);var n=r(8622);const o=(0,a.default)(`\n (function (FUNCTION_KEY) {\n function FUNCTION_ID() {\n return FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n }\n\n return FUNCTION_ID;\n })(FUNCTION)\n`);const i=(0,a.default)(`\n (function (FUNCTION_KEY) {\n function* FUNCTION_ID() {\n return yield* FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n };\n\n return FUNCTION_ID;\n })(FUNCTION)\n`);const l={"ReferencedIdentifier|BindingIdentifier"(e,t){if(e.node.name!==t.name)return;const r=e.scope.getBindingIdentifier(t.name);if(r!==t.outerDeclar)return;t.selfReference=true;e.stop()}};function getNameFromLiteralId(e){if(n.isNullLiteral(e)){return"null"}if(n.isRegExpLiteral(e)){return`_${e.pattern}_${e.flags}`}if(n.isTemplateLiteral(e)){return e.quasis.map((e=>e.value.raw)).join("")}if(e.value!==undefined){return e.value+""}return""}function wrap(e,t,r,a){if(e.selfReference){if(a.hasBinding(r.name)&&!a.hasGlobal(r.name)){a.rename(r.name)}else{if(!n.isFunction(t))return;let e=o;if(t.generator){e=i}const l=e({FUNCTION:t,FUNCTION_ID:r,FUNCTION_KEY:a.generateUidIdentifier(r.name)}).expression;const c=l.callee.body.body[0].params;for(let e=0,r=(0,s.default)(t);e{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=hoistVariables;var s=r(8622);const a={Scope(e,t){if(t.kind==="let")e.skip()},FunctionParent(e){e.skip()},VariableDeclaration(e,t){if(t.kind&&e.node.kind!==t.kind)return;const r=[];const a=e.get("declarations");let n;for(const e of a){n=e.node.id;if(e.node.init){r.push(s.expressionStatement(s.assignmentExpression("=",e.node.id,e.node.init)))}for(const r of Object.keys(e.getBindingIdentifiers())){t.emit(s.identifier(r),r,e.node.init!==null)}}if(e.parentPath.isFor({left:e.node})){e.replaceWith(n)}else{e.replaceWithMultiple(r)}}};function hoistVariables(e,t,r="var"){e.traverse(a,{kind:r,emit:t})}},3546:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=memberExpressionToFunctions;var s=_interopRequireWildcard(r(8622));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}class AssignmentMemoiser{constructor(){this._map=new WeakMap}has(e){return this._map.has(e)}get(e){if(!this.has(e))return;const t=this._map.get(e);const{value:r}=t;t.count--;if(t.count===0){return s.assignmentExpression("=",r,e)}return r}set(e,t,r){return this._map.set(e,{count:r,value:t})}}function toNonOptional(e,t){const{node:r}=e;if(e.isOptionalMemberExpression()){return s.memberExpression(t,r.property,r.computed)}if(e.isOptionalCallExpression()){const a=e.get("callee");if(e.node.optional&&a.isOptionalMemberExpression()){const{object:n}=a.node;const o=e.scope.maybeGenerateMemoised(n)||n;a.get("object").replaceWith(s.assignmentExpression("=",o,n));return s.callExpression(s.memberExpression(t,s.identifier("call")),[o,...r.arguments])}return s.callExpression(t,r.arguments)}return e.node}function isInDetachedTree(e){while(e){if(e.isProgram())break;const{parentPath:t,container:r,listKey:s}=e;const a=t.node;if(s){if(r!==a[s])return true}else{if(r!==a)return true}e=t}return false}const a={memoise(){},handle(e){const{node:t,parent:r,parentPath:a,scope:n}=e;if(e.isOptionalMemberExpression()){if(isInDetachedTree(e))return;const o=e.find((({node:t,parent:r,parentPath:s})=>{if(s.isOptionalMemberExpression()){return r.optional||r.object!==t}if(s.isOptionalCallExpression()){return t!==e.node&&r.optional||r.callee!==t}return true}));if(n.path.isPattern()){o.replaceWith(s.callExpression(s.arrowFunctionExpression([],o.node),[]));return}const i=o.parentPath;if(i.isUpdateExpression({argument:t})||i.isAssignmentExpression({left:t})){throw e.buildCodeFrameError(`can't handle assignment`)}const l=i.isUnaryExpression({operator:"delete"});if(l&&o.isOptionalMemberExpression()&&o.get("property").isPrivateName()){throw e.buildCodeFrameError(`can't delete a private class element`)}let c=e;for(;;){if(c.isOptionalMemberExpression()){if(c.node.optional)break;c=c.get("object");continue}else if(c.isOptionalCallExpression()){if(c.node.optional)break;c=c.get("callee");continue}throw new Error(`Internal error: unexpected ${c.node.type}`)}const u=c.isOptionalMemberExpression()?"object":"callee";const p=c.node[u];const d=n.maybeGenerateMemoised(p);const f=d!=null?d:p;const m=a.isOptionalCallExpression({callee:t});const y=a.isCallExpression({callee:t});c.replaceWith(toNonOptional(c,f));if(m){if(r.optional){a.replaceWith(this.optionalCall(e,r.arguments))}else{a.replaceWith(this.call(e,r.arguments))}}else if(y){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}let g=e.node;for(let t=e;t!==o;){const{parentPath:e}=t;if(e===o&&m&&r.optional){g=e.node;break}g=toNonOptional(e,g);t=e}let h;const b=o.parentPath;if(s.isMemberExpression(g)&&b.isOptionalCallExpression({callee:o.node,optional:true})){const{object:t}=g;h=e.scope.maybeGenerateMemoised(t);if(h){g.object=s.assignmentExpression("=",h,t)}}let x=o;if(l){x=b;g=b.node}x.replaceWith(s.conditionalExpression(s.logicalExpression("||",s.binaryExpression("===",d?s.assignmentExpression("=",s.cloneNode(f),s.cloneNode(p)):s.cloneNode(f),s.nullLiteral()),s.binaryExpression("===",s.cloneNode(f),n.buildUndefinedNode())),l?s.booleanLiteral(true):n.buildUndefinedNode(),g));if(h){const e=b.node;b.replaceWith(s.optionalCallExpression(s.optionalMemberExpression(e.callee,s.identifier("call"),false,true),[s.cloneNode(h),...e.arguments],false))}return}if(a.isUpdateExpression({argument:t})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:n,prefix:o}=r;this.memoise(e,2);const i=s.binaryExpression(n[0],s.unaryExpression("+",this.get(e)),s.numericLiteral(1));if(o){a.replaceWith(this.set(e,i))}else{const{scope:r}=e;const n=r.generateUidIdentifierBasedOnNode(t);r.push({id:n});i.left=s.assignmentExpression("=",s.cloneNode(n),i.left);a.replaceWith(s.sequenceExpression([this.set(e,i),s.cloneNode(n)]))}return}if(a.isAssignmentExpression({left:t})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,right:n}=r;if(t==="="){a.replaceWith(this.set(e,n))}else{const r=t.slice(0,-1);if(s.LOGICAL_OPERATORS.includes(r)){this.memoise(e,1);a.replaceWith(s.logicalExpression(r,this.get(e),this.set(e,n)))}else{this.memoise(e,2);a.replaceWith(this.set(e,s.binaryExpression(r,this.get(e),n)))}}return}if(a.isCallExpression({callee:t})){a.replaceWith(this.call(e,r.arguments));return}if(a.isOptionalCallExpression({callee:t})){if(n.path.isPattern()){a.replaceWith(s.callExpression(s.arrowFunctionExpression([],a.node),[]));return}a.replaceWith(this.optionalCall(e,r.arguments));return}if(a.isForXStatement({left:t})||a.isObjectProperty({value:t})&&a.parentPath.isObjectPattern()||a.isAssignmentPattern({left:t})&&a.parentPath.isObjectProperty({value:r})&&a.parentPath.parentPath.isObjectPattern()||a.isArrayPattern()||a.isAssignmentPattern({left:t})&&a.parentPath.isArrayPattern()||a.isRestElement()){e.replaceWith(this.destructureSet(e));return}e.replaceWith(this.get(e))}};function memberExpressionToFunctions(e,t,r){e.traverse(t,Object.assign({},a,r,{memoiser:new AssignmentMemoiser}))}},6591:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9491);var a=r(8622);class ImportBuilder{constructor(e,t,r){this._statements=[];this._resultName=null;this._scope=null;this._hub=null;this._importedSource=void 0;this._scope=t;this._hub=r;this._importedSource=e}done(){return{statements:this._statements,resultName:this._resultName}}import(){this._statements.push(a.importDeclaration([],a.stringLiteral(this._importedSource)));return this}require(){this._statements.push(a.expressionStatement(a.callExpression(a.identifier("require"),[a.stringLiteral(this._importedSource)])));return this}namespace(e="namespace"){const t=this._scope.generateUidIdentifier(e);const r=this._statements[this._statements.length-1];s(r.type==="ImportDeclaration");s(r.specifiers.length===0);r.specifiers=[a.importNamespaceSpecifier(t)];this._resultName=a.cloneNode(t);return this}default(e){e=this._scope.generateUidIdentifier(e);const t=this._statements[this._statements.length-1];s(t.type==="ImportDeclaration");s(t.specifiers.length===0);t.specifiers=[a.importDefaultSpecifier(e)];this._resultName=a.cloneNode(e);return this}named(e,t){if(t==="default")return this.default(e);e=this._scope.generateUidIdentifier(e);const r=this._statements[this._statements.length-1];s(r.type==="ImportDeclaration");s(r.specifiers.length===0);r.specifiers=[a.importSpecifier(e,a.identifier(t))];this._resultName=a.cloneNode(e);return this}var(e){e=this._scope.generateUidIdentifier(e);let t=this._statements[this._statements.length-1];if(t.type!=="ExpressionStatement"){s(this._resultName);t=a.expressionStatement(this._resultName);this._statements.push(t)}this._statements[this._statements.length-1]=a.variableDeclaration("var",[a.variableDeclarator(e,t.expression)]);this._resultName=a.cloneNode(e);return this}defaultInterop(){return this._interop(this._hub.addHelper("interopRequireDefault"))}wildcardInterop(){return this._interop(this._hub.addHelper("interopRequireWildcard"))}_interop(e){const t=this._statements[this._statements.length-1];if(t.type==="ExpressionStatement"){t.expression=a.callExpression(e,[t.expression])}else if(t.type==="VariableDeclaration"){s(t.declarations.length===1);t.declarations[0].init=a.callExpression(e,[t.declarations[0].init])}else{s.fail("Unexpected type.")}return this}prop(e){const t=this._statements[this._statements.length-1];if(t.type==="ExpressionStatement"){t.expression=a.memberExpression(t.expression,a.identifier(e))}else if(t.type==="VariableDeclaration"){s(t.declarations.length===1);t.declarations[0].init=a.memberExpression(t.declarations[0].init,a.identifier(e))}else{s.fail("Unexpected type:"+t.type)}return this}read(e){this._resultName=a.memberExpression(this._resultName,a.identifier(e))}}t["default"]=ImportBuilder},4872:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9491);var a=r(8622);var n=r(6591);var o=r(1719);class ImportInjector{constructor(e,t,r){this._defaultOpts={importedSource:null,importedType:"commonjs",importedInterop:"babel",importingInterop:"babel",ensureLiveReference:false,ensureNoContext:false,importPosition:"before"};const s=e.find((e=>e.isProgram()));this._programPath=s;this._programScope=s.scope;this._hub=s.hub;this._defaultOpts=this._applyDefaults(t,r,true)}addDefault(e,t){return this.addNamed("default",e,t)}addNamed(e,t,r){s(typeof e==="string");return this._generateImport(this._applyDefaults(t,r),e)}addNamespace(e,t){return this._generateImport(this._applyDefaults(e,t),null)}addSideEffect(e,t){return this._generateImport(this._applyDefaults(e,t),false)}_applyDefaults(e,t,r=false){const a=[];if(typeof e==="string"){a.push({importedSource:e});a.push(t)}else{s(!t,"Unexpected secondary arguments.");a.push(e)}const n=Object.assign({},this._defaultOpts);for(const e of a){if(!e)continue;Object.keys(n).forEach((t=>{if(e[t]!==undefined)n[t]=e[t]}));if(!r){if(e.nameHint!==undefined)n.nameHint=e.nameHint;if(e.blockHoist!==undefined)n.blockHoist=e.blockHoist}}return n}_generateImport(e,t){const r=t==="default";const s=!!t&&!r;const i=t===null;const{importedSource:l,importedType:c,importedInterop:u,importingInterop:p,ensureLiveReference:d,ensureNoContext:f,nameHint:m,importPosition:y,blockHoist:g}=e;let h=m||t;const b=(0,o.default)(this._programPath);const x=b&&p==="node";const v=b&&p==="babel";if(y==="after"&&!b){throw new Error(`"importPosition": "after" is only supported in modules`)}const E=new n.default(l,this._programScope,this._hub);if(c==="es6"){if(!x&&!v){throw new Error("Cannot import an ES6 module from CommonJS")}E.import();if(i){E.namespace(m||l)}else if(r||s){E.named(h,t)}}else if(c!=="commonjs"){throw new Error(`Unexpected interopType "${c}"`)}else if(u==="babel"){if(x){h=h!=="default"?h:l;const e=`${l}$es6Default`;E.import();if(i){E.default(e).var(h||l).wildcardInterop()}else if(r){if(d){E.default(e).var(h||l).defaultInterop().read("default")}else{E.default(e).var(h).defaultInterop().prop(t)}}else if(s){E.default(e).read(t)}}else if(v){E.import();if(i){E.namespace(h||l)}else if(r||s){E.named(h,t)}}else{E.require();if(i){E.var(h||l).wildcardInterop()}else if((r||s)&&d){if(r){h=h!=="default"?h:l;E.var(h).read(t);E.defaultInterop()}else{E.var(l).read(t)}}else if(r){E.var(h).defaultInterop().prop(t)}else if(s){E.var(h).prop(t)}}}else if(u==="compiled"){if(x){E.import();if(i){E.default(h||l)}else if(r||s){E.default(l).read(h)}}else if(v){E.import();if(i){E.namespace(h||l)}else if(r||s){E.named(h,t)}}else{E.require();if(i){E.var(h||l)}else if(r||s){if(d){E.var(l).read(h)}else{E.prop(t).var(h)}}}}else if(u==="uncompiled"){if(r&&d){throw new Error("No live reference for commonjs default")}if(x){E.import();if(i){E.default(h||l)}else if(r){E.default(h)}else if(s){E.default(l).read(h)}}else if(v){E.import();if(i){E.default(h||l)}else if(r){E.default(h)}else if(s){E.named(h,t)}}else{E.require();if(i){E.var(h||l)}else if(r){E.var(h)}else if(s){if(d){E.var(l).read(h)}else{E.var(h).prop(t)}}}}else{throw new Error(`Unknown importedInterop "${u}".`)}const{statements:j,resultName:w}=E.done();this._insertStatements(j,y,g);if((r||s)&&f&&w.type!=="Identifier"){return a.sequenceExpression([a.numericLiteral(0),w])}return w}_insertStatements(e,t="before",r=3){const s=this._programPath.get("body");if(t==="after"){for(let t=s.length-1;t>=0;t--){if(s[t].isImportDeclaration()){s[t].insertAfter(e);return}}}else{e.forEach((e=>{e._blockHoist=r}));const t=s.find((e=>{const t=e.node._blockHoist;return Number.isFinite(t)&&t<4}));if(t){t.insertBefore(e);return}}this._programPath.unshiftContainer("body",e)}}t["default"]=ImportInjector},6039:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.addDefault=addDefault;t.addNamed=addNamed;t.addNamespace=addNamespace;t.addSideEffect=addSideEffect;Object.defineProperty(t,"ImportInjector",{enumerable:true,get:function(){return s.default}});Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return a.default}});var s=r(4872);var a=r(1719);function addDefault(e,t,r){return new s.default(e).addDefault(t,r)}function addNamed(e,t,r,a){return new s.default(e).addNamed(t,r,a)}function addNamespace(e,t,r){return new s.default(e).addNamespace(t,r)}function addSideEffect(e,t,r){return new s.default(e).addSideEffect(t,r)}},1719:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=isModule;function isModule(e){const{sourceType:t}=e.node;if(t!=="module"&&t!=="script"){throw e.buildCodeFrameError(`Unknown sourceType "${t}", cannot transform.`)}return e.node.sourceType==="module"}},6721:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=optimiseCallExpression;var s=r(8622);function optimiseCallExpression(e,t,r,a){if(r.length===1&&s.isSpreadElement(r[0])&&s.isIdentifier(r[0].argument,{name:"arguments"})){if(a){return s.optionalCallExpression(s.optionalMemberExpression(e,s.identifier("apply"),false,true),[t,r[0].argument],false)}return s.callExpression(s.memberExpression(e,s.identifier("apply")),[t,r[0].argument])}else{if(a){return s.optionalCallExpression(s.optionalMemberExpression(e,s.identifier("call"),false,true),[t,...r],false)}return s.callExpression(s.memberExpression(e,s.identifier("call")),[t,...r])}}},9055:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,r,s)=>{if(!t.assertVersion){t=Object.assign(copyApiObject(t),{assertVersion(e){throwVersionError(e,t.version)}})}return e(t,r||{},s)}}function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7120:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(6946);var a=r(2155);var n=r(8622);const o={Function(e){e.skip()},AwaitExpression(e,{wrapAwait:t}){const r=e.get("argument");if(e.parentPath.isYieldExpression()){e.replaceWith(r.node);return}e.replaceWith(n.yieldExpression(t?n.callExpression(n.cloneNode(t),[r.node]):r.node))}};function _default(e,t,r){e.traverse(o,{wrapAwait:t.wrapAwait});const i=checkIsIIFE(e);e.node.async=false;e.node.generator=true;(0,s.default)(e,n.cloneNode(t.wrapAsync),r);const l=e.isObjectMethod()||e.isClassMethod()||e.parentPath.isObjectProperty()||e.parentPath.isClassProperty();if(!l&&!i&&e.isExpression()){(0,a.default)(e)}function checkIsIIFE(e){if(e.parentPath.isCallExpression({callee:e.node})){return true}const{parentPath:t}=e;if(t.isMemberExpression()&&n.isIdentifier(t.node.property,{name:"bind"})){const{parentPath:e}=t;return e.isCallExpression()&&e.node.arguments.length===1&&n.isThisExpression(e.node.arguments[0])&&e.parentPath.isCallExpression({callee:e.node})}return false}}},6833:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.skipAllButComputedKey=skipAllButComputedKey;t["default"]=t.environmentVisitor=void 0;var s=r(7369);var a=r(7281);var n=r(6721);var o=r(8622);function getPrototypeOfExpression(e,t,r,s){e=o.cloneNode(e);const a=t||s?e:o.memberExpression(e,o.identifier("prototype"));return o.callExpression(r.addHelper("getPrototypeOf"),[a])}function skipAllButComputedKey(e){if(!e.node.computed){e.skip();return}const t=o.VISITOR_KEYS[e.type];for(const r of t){if(r!=="key")e.skipKey(r)}}const i={[`${o.staticBlock?"StaticBlock|":""}ClassPrivateProperty|TypeAnnotation`](e){e.skip()},Function(e){if(e.isMethod())return;if(e.isArrowFunctionExpression())return;e.skip()},"Method|ClassProperty"(e){skipAllButComputedKey(e)}};t.environmentVisitor=i;const l=s.default.visitors.merge([i,{Super(e,t){const{node:r,parentPath:s}=e;if(!s.isMemberExpression({object:r}))return;t.handle(s)}}]);const c=s.default.visitors.merge([i,{Scopable(e,{refName:t}){const r=e.scope.getOwnBinding(t);if(r&&r.identifier.name===t){e.scope.rename(t)}}}]);const u={memoise(e,t){const{scope:r,node:s}=e;const{computed:a,property:n}=s;if(!a){return}const o=r.maybeGenerateMemoised(n);if(!o){return}this.memoiser.set(n,o,t)},prop(e){const{computed:t,property:r}=e.node;if(this.memoiser.has(r)){return o.cloneNode(this.memoiser.get(r))}if(t){return o.cloneNode(r)}return o.stringLiteral(r.name)},get(e){return this._get(e,this._getThisRefs())},_get(e,t){const r=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("get"),[t.memo?o.sequenceExpression([t.memo,r]):r,this.prop(e),t.this])},_getThisRefs(){if(!this.isDerivedConstructor){return{this:o.thisExpression()}}const e=this.scope.generateDeclaredUidIdentifier("thisSuper");return{memo:o.assignmentExpression("=",e,o.thisExpression()),this:o.cloneNode(e)}},set(e,t){const r=this._getThisRefs();const s=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("set"),[r.memo?o.sequenceExpression([r.memo,s]):s,this.prop(e),t,r.this,o.booleanLiteral(e.isInStrictMode())])},destructureSet(e){throw e.buildCodeFrameError(`Destructuring to a super field is not supported yet.`)},call(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,false)},optionalCall(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,true)}};const p=Object.assign({},u,{prop(e){const{property:t}=e.node;if(this.memoiser.has(t)){return o.cloneNode(this.memoiser.get(t))}return o.cloneNode(t)},get(e){const{isStatic:t,getSuperRef:r}=this;const{computed:s}=e.node;const a=this.prop(e);let n;if(t){var i;n=(i=r())!=null?i:o.memberExpression(o.identifier("Function"),o.identifier("prototype"))}else{var l;n=o.memberExpression((l=r())!=null?l:o.identifier("Object"),o.identifier("prototype"))}return o.memberExpression(n,a,s)},set(e,t){const{computed:r}=e.node;const s=this.prop(e);return o.assignmentExpression("=",o.memberExpression(o.thisExpression(),s,r),t)},destructureSet(e){const{computed:t}=e.node;const r=this.prop(e);return o.memberExpression(o.thisExpression(),r,t)},call(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,false)},optionalCall(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,true)}});class ReplaceSupers{constructor(e){var t;const r=e.methodPath;this.methodPath=r;this.isDerivedConstructor=r.isClassMethod({kind:"constructor"})&&!!e.superRef;this.isStatic=r.isObjectMethod()||r.node.static||(r.isStaticBlock==null?void 0:r.isStaticBlock());this.isPrivateMethod=r.isPrivate()&&r.isMethod();this.file=e.file;this.constantSuper=(t=e.constantSuper)!=null?t:e.isLoose;this.opts=e}getObjectRef(){return o.cloneNode(this.opts.objectRef||this.opts.getObjectRef())}getSuperRef(){if(this.opts.superRef)return o.cloneNode(this.opts.superRef);if(this.opts.getSuperRef)return o.cloneNode(this.opts.getSuperRef())}replace(){if(this.opts.refToPreserve){this.methodPath.traverse(c,{refName:this.opts.refToPreserve.name})}const e=this.constantSuper?p:u;(0,a.default)(this.methodPath,l,Object.assign({file:this.file,scope:this.methodPath.scope,isDerivedConstructor:this.isDerivedConstructor,isStatic:this.isStatic,isPrivateMethod:this.isPrivateMethod,getObjectRef:this.getObjectRef.bind(this),getSuperRef:this.getSuperRef.bind(this)},e))}}t["default"]=ReplaceSupers},7281:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(8622);function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach((function(r){if(r!=="default"){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:true,get:function(){return e[r]}})}}))}t["default"]=e;return Object.freeze(t)}var a=_interopNamespace(s);function willPathCastToBoolean(e){const t=e;const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}class AssignmentMemoiser{constructor(){this._map=void 0;this._map=new WeakMap}has(e){return this._map.has(e)}get(e){if(!this.has(e))return;const t=this._map.get(e);const{value:r}=t;t.count--;if(t.count===0){return a.assignmentExpression("=",r,e)}return r}set(e,t,r){return this._map.set(e,{count:r,value:t})}}function toNonOptional(e,t){const{node:r}=e;if(e.isOptionalMemberExpression()){return a.memberExpression(t,r.property,r.computed)}if(e.isOptionalCallExpression()){const s=e.get("callee");if(e.node.optional&&s.isOptionalMemberExpression()){const{object:n}=s.node;const o=e.scope.maybeGenerateMemoised(n)||n;s.get("object").replaceWith(a.assignmentExpression("=",o,n));return a.callExpression(a.memberExpression(t,a.identifier("call")),[o,...r.arguments])}return a.callExpression(t,r.arguments)}return e.node}function isInDetachedTree(e){while(e){if(e.isProgram())break;const{parentPath:t,container:r,listKey:s}=e;const a=t.node;if(s){if(r!==a[s])return true}else{if(r!==a)return true}e=t}return false}const n={memoise(){},handle(e,t){const{node:r,parent:s,parentPath:n,scope:o}=e;if(e.isOptionalMemberExpression()){if(isInDetachedTree(e))return;const i=e.find((({node:t,parent:r,parentPath:s})=>{if(s.isOptionalMemberExpression()){return r.optional||r.object!==t}if(s.isOptionalCallExpression()){return t!==e.node&&r.optional||r.callee!==t}return true}));if(o.path.isPattern()){i.replaceWith(a.callExpression(a.arrowFunctionExpression([],i.node),[]));return}const l=willPathCastToBoolean(i);const c=i.parentPath;if(c.isUpdateExpression({argument:r})||c.isAssignmentExpression({left:r})){throw e.buildCodeFrameError(`can't handle assignment`)}const u=c.isUnaryExpression({operator:"delete"});if(u&&i.isOptionalMemberExpression()&&i.get("property").isPrivateName()){throw e.buildCodeFrameError(`can't delete a private class element`)}let p=e;for(;;){if(p.isOptionalMemberExpression()){if(p.node.optional)break;p=p.get("object");continue}else if(p.isOptionalCallExpression()){if(p.node.optional)break;p=p.get("callee");continue}throw new Error(`Internal error: unexpected ${p.node.type}`)}const d=p.isOptionalMemberExpression()?"object":"callee";const f=p.node[d];const m=o.maybeGenerateMemoised(f);const y=m!=null?m:f;const g=n.isOptionalCallExpression({callee:r});const h=n.isCallExpression({callee:r});p.replaceWith(toNonOptional(p,y));if(g){if(s.optional){n.replaceWith(this.optionalCall(e,s.arguments))}else{n.replaceWith(this.call(e,s.arguments))}}else if(h){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}let b=e.node;for(let t=e;t!==i;){const{parentPath:e}=t;if(e===i&&g&&s.optional){b=e.node;break}b=toNonOptional(e,b);t=e}let x;const v=i.parentPath;if(a.isMemberExpression(b)&&v.isOptionalCallExpression({callee:i.node,optional:true})){const{object:t}=b;x=e.scope.maybeGenerateMemoised(t);if(x){b.object=a.assignmentExpression("=",x,t)}}let E=i;if(u){E=v;b=v.node}const j=m?a.assignmentExpression("=",a.cloneNode(y),a.cloneNode(f)):a.cloneNode(y);if(l){let e;if(t){e=a.binaryExpression("!=",j,a.nullLiteral())}else{e=a.logicalExpression("&&",a.binaryExpression("!==",j,a.nullLiteral()),a.binaryExpression("!==",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.logicalExpression("&&",e,b))}else{let e;if(t){e=a.binaryExpression("==",j,a.nullLiteral())}else{e=a.logicalExpression("||",a.binaryExpression("===",j,a.nullLiteral()),a.binaryExpression("===",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.conditionalExpression(e,u?a.booleanLiteral(true):o.buildUndefinedNode(),b))}if(x){const e=v.node;v.replaceWith(a.optionalCallExpression(a.optionalMemberExpression(e.callee,a.identifier("call"),false,true),[a.cloneNode(x),...e.arguments],false))}return}if(n.isUpdateExpression({argument:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,prefix:o}=s;this.memoise(e,2);const i=a.binaryExpression(t[0],a.unaryExpression("+",this.get(e)),a.numericLiteral(1));if(o){n.replaceWith(this.set(e,i))}else{const{scope:t}=e;const s=t.generateUidIdentifierBasedOnNode(r);t.push({id:s});i.left=a.assignmentExpression("=",a.cloneNode(s),i.left);n.replaceWith(a.sequenceExpression([this.set(e,i),a.cloneNode(s)]))}return}if(n.isAssignmentExpression({left:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,right:r}=s;if(t==="="){n.replaceWith(this.set(e,r))}else{const s=t.slice(0,-1);if(a.LOGICAL_OPERATORS.includes(s)){this.memoise(e,1);n.replaceWith(a.logicalExpression(s,this.get(e),this.set(e,r)))}else{this.memoise(e,2);n.replaceWith(this.set(e,a.binaryExpression(s,this.get(e),r)))}}return}if(n.isCallExpression({callee:r})){n.replaceWith(this.call(e,s.arguments));return}if(n.isOptionalCallExpression({callee:r})){if(o.path.isPattern()){n.replaceWith(a.callExpression(a.arrowFunctionExpression([],n.node),[]));return}n.replaceWith(this.optionalCall(e,s.arguments));return}if(n.isForXStatement({left:r})||n.isObjectProperty({value:r})&&n.parentPath.isObjectPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isObjectProperty({value:s})&&n.parentPath.parentPath.isObjectPattern()||n.isArrayPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isArrayPattern()||n.isRestElement()){e.replaceWith(this.destructureSet(e));return}e.replaceWith(this.get(e))}};function memberExpressionToFunctions(e,t,r){e.traverse(t,Object.assign({},n,r,{memoiser:new AssignmentMemoiser}))}t["default"]=memberExpressionToFunctions},5480:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isTransparentExprWrapper=isTransparentExprWrapper;t.skipTransparentExprWrappers=skipTransparentExprWrappers;var s=r(8622);function isTransparentExprWrapper(e){return s.isTSAsExpression(e)||s.isTSTypeAssertion(e)||s.isTSNonNullExpression(e)||s.isTypeCastExpression(e)||s.isParenthesizedExpression(e)}function skipTransparentExprWrappers(e){while(isTransparentExprWrapper(e.node)){e=e.get("expression")}return e}},7058:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=splitExportDeclaration;var s=r(8622);function splitExportDeclaration(e){if(!e.isExportDeclaration()){throw new Error("Only export declarations can be split.")}const t=e.isExportDefaultDeclaration();const r=e.get("declaration");const a=r.isClassDeclaration();if(t){const t=r.isFunctionDeclaration()||a;const n=r.isScope()?r.scope.parent:r.scope;let o=r.node.id;let i=false;if(!o){i=true;o=n.generateUidIdentifier("default");if(t||r.isFunctionExpression()||r.isClassExpression()){r.node.id=s.cloneNode(o)}}const l=t?r:s.variableDeclaration("var",[s.variableDeclarator(s.cloneNode(o),r.node)]);const c=s.exportNamedDeclaration(null,[s.exportSpecifier(s.cloneNode(o),s.identifier("default"))]);e.insertAfter(c);e.replaceWith(l);if(i){n.registerDeclaration(e)}return e}if(e.get("specifiers").length>0){throw new Error("It doesn't make sense to split exported specifiers.")}const n=r.getOuterBindingIdentifiers();const o=Object.keys(n).map((e=>s.exportSpecifier(s.identifier(e),s.identifier(e))));const i=s.exportNamedDeclaration(null,o);e.insertAfter(i);e.replaceWith(r.node);return e}},9115:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0,s=Array.from(e);r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(9115);var a=r(5390)},5390:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},8785:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.findSuggestion=findSuggestion;const{min:r}=Math;function levenshtein(e,t){let s=[],a=[],n,o;const i=e.length,l=t.length;if(!i){return l}if(!l){return i}for(o=0;o<=l;o++){s[o]=o}for(n=1;n<=i;n++){for(a=[n],o=1;o<=l;o++){a[o]=e[n-1]===t[o-1]?s[o-1]:r(s[o-1],s[o],a[o-1])+1}s=a}return a[l]}function findSuggestion(e,t){const s=t.map((t=>levenshtein(t,e)));return t[s.indexOf(r(...s))]}},7347:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"OptionValidator",{enumerable:true,get:function(){return s.OptionValidator}});Object.defineProperty(t,"findSuggestion",{enumerable:true,get:function(){return a.findSuggestion}});var s=r(6885);var a=r(8785)},6885:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.OptionValidator=void 0;var s=r(8785);class OptionValidator{constructor(e){this.descriptor=e}validateTopLevelOptions(e,t){const r=Object.keys(t);for(const t of Object.keys(e)){if(!r.includes(t)){throw new Error(this.formatMessage(`'${t}' is not a valid top-level option.\n- Did you mean '${(0,s.findSuggestion)(t,r)}'?`))}}}validateBooleanOption(e,t,r){if(t===undefined){return r}else{this.invariant(typeof t==="boolean",`'${e}' option must be a boolean.`)}return t}validateStringOption(e,t,r){if(t===undefined){return r}else{this.invariant(typeof t==="string",`'${e}' option must be a string.`)}return t}invariant(e,t){if(!e){throw new Error(this.formatMessage(t))}}formatMessage(e){return`${this.descriptor}: ${e}`}}t.OptionValidator=OptionValidator},6946:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=wrapFunction;var s=r(550);var a=r(153);var n=r(8622);const o=a.default.expression(`\n (function () {\n var REF = FUNCTION;\n return function NAME(PARAMS) {\n return REF.apply(this, arguments);\n };\n })()\n`);const i=a.default.expression(`\n (function () {\n var REF = FUNCTION;\n function NAME(PARAMS) {\n return REF.apply(this, arguments);\n }\n return NAME;\n })()\n`);const l=(0,a.default)(`\n function NAME(PARAMS) { return REF.apply(this, arguments); }\n function REF() {\n REF = FUNCTION;\n return REF.apply(this, arguments);\n }\n`);function classOrObjectMethod(e,t){const r=e.node;const s=r.body;const a=n.functionExpression(null,[],n.blockStatement(s.body),true);s.body=[n.returnStatement(n.callExpression(n.callExpression(t,[a]),[]))];r.async=false;r.generator=false;e.get("body.body.0.argument.callee.arguments.0").unwrapFunctionEnvironment()}function plainFunction(e,t,r){const a=e.node;const c=e.isFunctionDeclaration();const u=a.id;const p=c?l:u?i:o;if(e.isArrowFunctionExpression()){e.arrowFunctionToExpression({noNewArrows:r})}a.id=null;if(c){a.type="FunctionExpression"}const d=n.callExpression(t,[a]);const f=p({NAME:u||null,REF:e.scope.generateUidIdentifier(u?u.name:"ref"),FUNCTION:d,PARAMS:a.params.reduce(((t,r)=>{t.done=t.done||n.isAssignmentPattern(r)||n.isRestElement(r);if(!t.done){t.params.push(e.scope.generateUidIdentifier("x"))}return t}),{params:[],done:false}).params});if(c){e.replaceWith(f[0]);e.insertAfter(f[1])}else{const t=f.callee.body.body[1].argument;if(!u){(0,s.default)({node:t,parent:e.parent,scope:e.scope})}if(!t||t.id||a.params.length){e.replaceWith(f)}else{e.replaceWith(d)}}}function wrapFunction(e,t,r=true){if(e.isMethod()){classOrObjectMethod(e,t)}else{plainFunction(e,t,r)}}},2421:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.shouldHighlight=shouldHighlight;t.getChalk=getChalk;t["default"]=highlight;var s=_interopRequireWildcard(r(8035));var a=r(9586);var n=_interopRequireDefault(r(8542));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function getDefs(e){return{keyword:e.cyan,capitalized:e.yellow,jsx_tag:e.yellow,punctuator:e.yellow,number:e.magenta,string:e.green,regex:e.magenta,comment:e.grey,invalid:e.white.bgRed.bold}}const o=/\r\n|[\n\r\u2028\u2029]/;const i=/^[a-z][\w-]*$/i;const l=/^[()[\]{}]$/;function getTokenType(e){const[t,r]=e.slice(-2);const n=(0,s.matchToToken)(e);if(n.type==="name"){if((0,a.isKeyword)(n.value)||(0,a.isReservedWord)(n.value)){return"keyword"}if(i.test(n.value)&&(r[t-1]==="<"||r.substr(t-2,2)=="s(e))).join("\n")}else{return t[0]}}))}function shouldHighlight(e){return n.default.supportsColor||e.forceColor}function getChalk(e){let t=n.default;if(e.forceColor){t=new n.default.constructor({enabled:true,level:1})}return t}function highlight(e,t={}){if(shouldHighlight(t)){const r=getChalk(t);const s=getDefs(r);return highlightTokens(s,e)}else{return e}}},8027:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(249);var a=r(4026);var n=(0,s.declare)(((e,t)=>{e.assertVersion(7);return(0,a.createClassFeaturePlugin)({name:"proposal-class-properties",api:e,feature:a.FEATURES.fields,loose:t.loose,manipulateOptions(e,t){t.plugins.push("classProperties","classPrivateProperties")}})}));t["default"]=n},9009:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasOwnDecorators=hasOwnDecorators;t.hasDecorators=hasDecorators;t.buildDecoratedClass=buildDecoratedClass;var s=r(8304);var a=_interopRequireDefault(r(2768));var n=_interopRequireDefault(r(8486));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function hasOwnDecorators(e){return!!(e.decorators&&e.decorators.length)}function hasDecorators(e){return hasOwnDecorators(e)||e.body.body.some(hasOwnDecorators)}function prop(e,t){if(!t)return null;return s.types.objectProperty(s.types.identifier(e),t)}function method(e,t){return s.types.objectMethod("method",s.types.identifier(e),[],s.types.blockStatement(t))}function takeDecorators(e){let t;if(e.decorators&&e.decorators.length>0){t=s.types.arrayExpression(e.decorators.map((e=>e.expression)))}e.decorators=undefined;return t}function getKey(e){if(e.computed){return e.key}else if(s.types.isIdentifier(e.key)){return s.types.stringLiteral(e.key.name)}else{return s.types.stringLiteral(String(e.key.value))}}function extractElementDescriptor(e,t,r){const{node:o,scope:i}=r;const l=r.isClassMethod();if(r.isPrivate()){throw r.buildCodeFrameError(`Private ${l?"methods":"fields"} in decorated classes are not supported yet.`)}new a.default({methodPath:r,methodNode:o,objectRef:e,isStatic:o.static,superRef:t,scope:i,file:this},true).replace();const c=[prop("kind",s.types.stringLiteral(l?o.kind:"field")),prop("decorators",takeDecorators(o)),prop("static",o.static&&s.types.booleanLiteral(true)),prop("key",getKey(o))].filter(Boolean);if(l){const e=o.computed?null:o.key;s.types.toExpression(o);c.push(prop("value",(0,n.default)({node:o,id:e,scope:i})||o))}else if(o.value){c.push(method("value",s.template.statements.ast`return ${o.value}`))}else{c.push(prop("value",i.buildUndefinedNode()))}r.remove();return s.types.objectExpression(c)}function addDecorateHelper(e){try{return e.addHelper("decorate")}catch(e){if(e.code==="BABEL_HELPER_UNKNOWN"){e.message+="\n '@babel/plugin-transform-decorators' in non-legacy mode"+" requires '@babel/core' version ^7.0.2 and you appear to be using"+" an older version."}throw e}}function buildDecoratedClass(e,t,r,a){const{node:n,scope:o}=t;const i=o.generateUidIdentifier("initialize");const l=n.id&&t.isDeclaration();const c=t.isInStrictMode();const{superClass:u}=n;n.type="ClassDeclaration";if(!n.id)n.id=s.types.cloneNode(e);let p;if(u){p=o.generateUidIdentifierBasedOnNode(n.superClass,"super");n.superClass=p}const d=takeDecorators(n);const f=s.types.arrayExpression(r.filter((e=>!e.node.abstract)).map(extractElementDescriptor.bind(a,n.id,p)));let m=s.template.expression.ast` + ${addDecorateHelper(a)}( + ${d||s.types.nullLiteral()}, + function (${i}, ${u?s.types.cloneNode(p):null}) { + ${n} + return { F: ${s.types.cloneNode(n.id)}, d: ${f} }; + }, + ${u} + ) + `;let y="arguments.1.body.body.0";if(!c){m.arguments[1].body.directives.push(s.types.directive(s.types.directiveLiteral("use strict")))}if(l){m=s.template.ast`let ${e} = ${m}`;y="declarations.0.init."+y}return{instanceNodes:[s.template.statement.ast`${s.types.cloneNode(i)}(this)`],wrapClass(e){e.replaceWith(m);return e.get(y)}}}},889:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.enableFeature=enableFeature;t.isLoose=isLoose;t.verifyUsedFeatures=verifyUsedFeatures;t.FEATURES=void 0;var s=r(9009);const a=Object.freeze({fields:1<<1,privateMethods:1<<2,decorators:1<<3,privateIn:1<<4});t.FEATURES=a;const n=new Map([[a.fields,"@babel/plugin-proposal-class-properties"],[a.privateMethods,"@babel/plugin-proposal-private-methods"],[a.privateIn,"@babel/plugin-proposal-private-private-property-in-object"]]);const o="@babel/plugin-class-features/featuresKey";const i="@babel/plugin-class-features/looseKey";const l="@babel/plugin-class-features/looseLowPriorityKey/#__internal__@babel/preset-env__please-overwrite-loose-instead-of-throwing";function enableFeature(e,t,r){if(!hasFeature(e,t)||canIgnoreLoose(e,t)){e.set(o,e.get(o)|t);if(r==="#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error"){setLoose(e,t,true);e.set(l,e.get(l)|t)}else if(r==="#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"){setLoose(e,t,false);e.set(l,e.get(l)|t)}else{setLoose(e,t,r)}}let s;let a;for(const[t,r]of n){if(!hasFeature(e,t))continue;const n=isLoose(e,t);if(canIgnoreLoose(e,t)){continue}else if(s===!n){throw new Error("'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, "+"@babel/plugin-proposal-private-methods and "+"@babel/plugin-proposal-private-property-in-object (when they are enabled).")}else{s=n;a=r}}if(s!==undefined){for(const[t,r]of n){if(hasFeature(e,t)&&isLoose(e,t)!==s){setLoose(e,t,s);console.warn(`Though the "loose" option was set to "${!s}" in your @babel/preset-env `+`config, it will not be used for ${r} since the "loose" mode option was set to `+`"${s}" for ${a}.\nThe "loose" option must be the `+`same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods `+`and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can `+`silence this warning by explicitly adding\n`+`\t["${r}", { "loose": ${s} }]\n`+`to the "plugins" section of your Babel config.`)}}}}function hasFeature(e,t){return!!(e.get(o)&t)}function isLoose(e,t){return!!(e.get(i)&t)}function setLoose(e,t,r){if(r)e.set(i,e.get(i)|t);else e.set(i,e.get(i)&~t);e.set(l,e.get(l)&~t)}function canIgnoreLoose(e,t){return!!(e.get(l)&t)}function verifyUsedFeatures(e,t){if((0,s.hasOwnDecorators)(e.node)){if(!hasFeature(t,a.decorators)){throw e.buildCodeFrameError("Decorators are not enabled."+"\nIf you are using "+'["@babel/plugin-proposal-decorators", { "legacy": true }], '+'make sure it comes *before* "@babel/plugin-proposal-class-properties" '+"and enable loose mode, like so:\n"+'\t["@babel/plugin-proposal-decorators", { "legacy": true }]\n'+'\t["@babel/plugin-proposal-class-properties", { "loose": true }]')}if(e.isPrivate()){throw e.buildCodeFrameError(`Private ${e.isClassMethod()?"methods":"fields"} in decorated classes are not supported yet.`)}}if(e.isPrivate()&&e.isMethod()){if(!hasFeature(t,a.privateMethods)){throw e.buildCodeFrameError("Class private methods are not enabled.")}}if(e.isPrivateName()&&e.parentPath.isBinaryExpression({operator:"in",left:e.node})){if(!hasFeature(t,a.privateIn)){throw e.buildCodeFrameError("Private property in checks are not enabled.")}}if(e.isProperty()){if(!hasFeature(t,a.fields)){throw e.buildCodeFrameError("Class fields are not enabled.")}}}},7988:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.buildPrivateNamesMap=buildPrivateNamesMap;t.buildPrivateNamesNodes=buildPrivateNamesNodes;t.transformPrivateNamesUsage=transformPrivateNamesUsage;t.buildFieldsInitNodes=buildFieldsInitNodes;var s=r(8304);var a=_interopRequireWildcard(r(2768));var n=_interopRequireDefault(r(3546));var o=_interopRequireDefault(r(6351));var i=_interopRequireWildcard(r(3121));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function buildPrivateNamesMap(e){const t=new Map;for(const r of e){const e=r.isPrivate();const s=!r.isProperty();const a=!r.node.static;if(e){const{name:e}=r.node.key.id;const n=t.has(e)?t.get(e):{id:r.scope.generateUidIdentifier(e),static:!a,method:s};if(r.node.kind==="get"){n.getId=r.scope.generateUidIdentifier(`get_${e}`)}else if(r.node.kind==="set"){n.setId=r.scope.generateUidIdentifier(`set_${e}`)}else if(r.node.kind==="method"){n.methodId=r.scope.generateUidIdentifier(e)}t.set(e,n)}}return t}function buildPrivateNamesNodes(e,t,r){const a=[];for(const[n,o]of e){const{static:e,method:i,getId:l,setId:c}=o;const u=l||c;const p=s.types.cloneNode(o.id);if(t){a.push(s.template.statement.ast` + var ${p} = ${r.addHelper("classPrivateFieldLooseKey")}("${n}") + `)}else if(i&&!e){if(u){a.push(s.template.statement.ast`var ${p} = new WeakMap();`)}else{a.push(s.template.statement.ast`var ${p} = new WeakSet();`)}}else if(!e){a.push(s.template.statement.ast`var ${p} = new WeakMap();`)}}return a}function privateNameVisitorFactory(e){const t=Object.assign({},e,{Class(e){const{privateNamesMap:s}=this;const a=e.get("body.body");const n=new Map(s);const o=[];for(const e of a){if(!e.isPrivate())continue;const{name:t}=e.node.key.id;n.delete(t);o.push(t)}if(!o.length){return}e.get("body").traverse(r,Object.assign({},this,{redeclared:o}));e.traverse(t,Object.assign({},this,{privateNamesMap:n}));e.skipKey("body")}});const r=s.traverse.visitors.merge([Object.assign({},e),a.environmentVisitor]);return t}const l=privateNameVisitorFactory({PrivateName(e){const{privateNamesMap:t,redeclared:r}=this;const{node:s,parentPath:a}=e;if(!a.isMemberExpression({property:s})&&!a.isOptionalMemberExpression({property:s})){return}const{name:n}=s.id;if(!t.has(n))return;if(r&&r.includes(n))return;this.handle(a)}});const c=privateNameVisitorFactory({BinaryExpression(e){const{operator:t,left:r,right:a}=e.node;if(t!=="in")return;if(!e.get("left").isPrivateName())return;const{loose:n,privateNamesMap:o,redeclared:i}=this;const{name:l}=r.id;if(!o.has(l))return;if(i&&i.includes(l))return;if(n){const{id:t}=o.get(l);e.replaceWith(s.template.expression.ast` + Object.prototype.hasOwnProperty.call(${a}, ${s.types.cloneNode(t)}) + `);return}const{id:c,static:u}=o.get(l);if(u){e.replaceWith(s.template.expression.ast`${a} === ${this.classRef}`);return}e.replaceWith(s.template.expression.ast`${s.types.cloneNode(c)}.has(${a})`)}});const u={memoise(e,t){const{scope:r}=e;const{object:s}=e.node;const a=r.maybeGenerateMemoised(s);if(!a){return}this.memoiser.set(s,a,t)},receiver(e){const{object:t}=e.node;if(this.memoiser.has(t)){return s.types.cloneNode(this.memoiser.get(t))}return s.types.cloneNode(t)},get(e){const{classRef:t,privateNamesMap:r,file:a}=this;const{name:n}=e.node.property.id;const{id:o,static:i,method:l,methodId:c,getId:u,setId:p}=r.get(n);const d=u||p;if(i){const r=l&&!d?"classStaticPrivateMethodGet":"classStaticPrivateFieldSpecGet";return s.types.callExpression(a.addHelper(r),[this.receiver(e),s.types.cloneNode(t),s.types.cloneNode(o)])}if(l){if(d){return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])}return s.types.callExpression(a.addHelper("classPrivateMethodGet"),[this.receiver(e),s.types.cloneNode(o),s.types.cloneNode(c)])}return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])},boundGet(e){this.memoise(e,1);return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[this.receiver(e)])},set(e,t){const{classRef:r,privateNamesMap:a,file:n}=this;const{name:o}=e.node.property.id;const{id:i,static:l,method:c,setId:u,getId:p}=a.get(o);const d=p||u;if(l){const a=c&&!d?"classStaticPrivateMethodSet":"classStaticPrivateFieldSpecSet";return s.types.callExpression(n.addHelper(a),[this.receiver(e),s.types.cloneNode(r),s.types.cloneNode(i),t])}if(c){if(u){return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])}return s.types.callExpression(n.addHelper("classPrivateMethodSet"),[])}return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])},destructureSet(e){const{privateNamesMap:t,file:r}=this;const{name:a}=e.node.property.id;const{id:n}=t.get(a);return s.types.memberExpression(s.types.callExpression(r.addHelper("classPrivateFieldDestructureSet"),[this.receiver(e),s.types.cloneNode(n)]),s.types.identifier("value"))},call(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,false)},optionalCall(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,true)}};const p={get(e){const{privateNamesMap:t,file:r}=this;const{object:a}=e.node;const{name:n}=e.node.property.id;return s.template.expression`BASE(REF, PROP)[PROP]`({BASE:r.addHelper("classPrivateFieldLooseBase"),REF:s.types.cloneNode(a),PROP:s.types.cloneNode(t.get(n).id)})},boundGet(e){return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[s.types.cloneNode(e.node.object)])},simpleSet(e){return this.get(e)},destructureSet(e){return this.get(e)},call(e,t){return s.types.callExpression(this.get(e),t)},optionalCall(e,t){return s.types.optionalCallExpression(this.get(e),t,true)}};function transformPrivateNamesUsage(e,t,r,s,a){if(!r.size)return;const o=t.get("body");const i=s?p:u;(0,n.default)(o,l,Object.assign({privateNamesMap:r,classRef:e,file:a},i));o.traverse(c,{privateNamesMap:r,classRef:e,file:a,loose:s})}function buildPrivateFieldInitLoose(e,t,r){const{id:a}=r.get(t.node.key.id.name);const n=t.node.value||t.scope.buildUndefinedNode();return s.template.statement.ast` + Object.defineProperty(${e}, ${s.types.cloneNode(a)}, { + // configurable is false by default + // enumerable is false by default + writable: true, + value: ${n} + }); + `}function buildPrivateInstanceFieldInitSpec(e,t,r){const{id:a}=r.get(t.node.key.id.name);const n=t.node.value||t.scope.buildUndefinedNode();return s.template.statement.ast`${s.types.cloneNode(a)}.set(${e}, { + // configurable is always false for private elements + // enumerable is always false for private elements + writable: true, + value: ${n}, + })`}function buildPrivateStaticFieldInitSpec(e,t){const r=t.get(e.node.key.id.name);const{id:a,getId:n,setId:o,initAdded:i}=r;const l=n||o;if(!e.isProperty()&&(i||!l))return;if(l){t.set(e.node.key.id.name,Object.assign({},r,{initAdded:true}));return s.template.statement.ast` + var ${s.types.cloneNode(a)} = { + // configurable is false by default + // enumerable is false by default + // writable is false by default + get: ${n?n.name:e.scope.buildUndefinedNode()}, + set: ${o?o.name:e.scope.buildUndefinedNode()} + } + `}const c=e.node.value||e.scope.buildUndefinedNode();return s.template.statement.ast` + var ${s.types.cloneNode(a)} = { + // configurable is false by default + // enumerable is false by default + writable: true, + value: ${c} + }; + `}function buildPrivateMethodInitLoose(e,t,r){const a=r.get(t.node.key.id.name);const{methodId:n,id:o,getId:i,setId:l,initAdded:c}=a;if(c)return;if(n){return s.template.statement.ast` + Object.defineProperty(${e}, ${o}, { + // configurable is false by default + // enumerable is false by default + // writable is false by default + value: ${n.name} + }); + `}const u=i||l;if(u){r.set(t.node.key.id.name,Object.assign({},a,{initAdded:true}));return s.template.statement.ast` + Object.defineProperty(${e}, ${o}, { + // configurable is false by default + // enumerable is false by default + // writable is false by default + get: ${i?i.name:t.scope.buildUndefinedNode()}, + set: ${l?l.name:t.scope.buildUndefinedNode()} + }); + `}}function buildPrivateInstanceMethodInitSpec(e,t,r){const a=r.get(t.node.key.id.name);const{id:n,getId:o,setId:i,initAdded:l}=a;if(l)return;const c=o||i;if(c){r.set(t.node.key.id.name,Object.assign({},a,{initAdded:true}));return s.template.statement.ast` + ${n}.set(${e}, { + get: ${o?o.name:t.scope.buildUndefinedNode()}, + set: ${i?i.name:t.scope.buildUndefinedNode()} + }); + `}return s.template.statement.ast`${n}.add(${e})`}function buildPublicFieldInitLoose(e,t){const{key:r,computed:a}=t.node;const n=t.node.value||t.scope.buildUndefinedNode();return s.types.expressionStatement(s.types.assignmentExpression("=",s.types.memberExpression(e,r,a||s.types.isLiteral(r)),n))}function buildPublicFieldInitSpec(e,t,r){const{key:a,computed:n}=t.node;const o=t.node.value||t.scope.buildUndefinedNode();return s.types.expressionStatement(s.types.callExpression(r.addHelper("defineProperty"),[e,n||s.types.isLiteral(a)?a:s.types.stringLiteral(a.name),o]))}function buildPrivateStaticMethodInitLoose(e,t,r,a){const n=a.get(t.node.key.id.name);const{id:o,methodId:i,getId:l,setId:c,initAdded:u}=n;if(u)return;const p=l||c;if(p){a.set(t.node.key.id.name,Object.assign({},n,{initAdded:true}));return s.template.statement.ast` + Object.defineProperty(${e}, ${o}, { + // configurable is false by default + // enumerable is false by default + // writable is false by default + get: ${l?l.name:t.scope.buildUndefinedNode()}, + set: ${c?c.name:t.scope.buildUndefinedNode()} + }) + `}return s.template.statement.ast` + Object.defineProperty(${e}, ${o}, { + // configurable is false by default + // enumerable is false by default + // writable is false by default + value: ${i.name} + }); + `}function buildPrivateMethodDeclaration(e,t,r=false){const a=t.get(e.node.key.id.name);const{id:n,methodId:o,getId:i,setId:l,getterDeclared:c,setterDeclared:u,static:p}=a;const{params:d,body:f,generator:m,async:y}=e.node;const g=s.types.functionExpression(o,d,f,m,y);const h=i&&!c&&d.length===0;const b=l&&!u&&d.length>0;if(h){t.set(e.node.key.id.name,Object.assign({},a,{getterDeclared:true}));return s.types.variableDeclaration("var",[s.types.variableDeclarator(i,g)])}if(b){t.set(e.node.key.id.name,Object.assign({},a,{setterDeclared:true}));return s.types.variableDeclaration("var",[s.types.variableDeclarator(l,g)])}if(p&&!r){return s.types.variableDeclaration("var",[s.types.variableDeclarator(s.types.cloneNode(n),s.types.functionExpression(n,d,f,m,y))])}return s.types.variableDeclaration("var",[s.types.variableDeclarator(s.types.cloneNode(o),g)])}const d=s.traverse.visitors.merge([{ThisExpression(e,t){t.needsClassRef=true;e.replaceWith(s.types.cloneNode(t.classRef))}},a.environmentVisitor]);function replaceThisContext(e,t,r,n,o){const i={classRef:t,needsClassRef:false};const l=new a.default({methodPath:e,isLoose:o,superRef:r,file:n,getObjectRef(){i.needsClassRef=true;return e.node.static?t:s.types.memberExpression(t,s.types.identifier("prototype"))}});l.replace();if(e.isProperty()){e.traverse(d,i)}return i.needsClassRef}function buildFieldsInitNodes(e,t,r,a,n,o){const l=[];const c=[];let u=false;for(const p of r){i.assertFieldTransformed(p);const r=p.node.static;const d=!r;const f=p.isPrivate();const m=!f;const y=p.isProperty();const g=!y;if(r||g&&f){const r=replaceThisContext(p,e,t,n,o);u=u||r}switch(true){case r&&f&&y&&o:u=true;l.push(buildPrivateFieldInitLoose(s.types.cloneNode(e),p,a));break;case r&&f&&y&&!o:u=true;l.push(buildPrivateStaticFieldInitSpec(p,a));break;case r&&m&&y&&o:u=true;l.push(buildPublicFieldInitLoose(s.types.cloneNode(e),p));break;case r&&m&&y&&!o:u=true;l.push(buildPublicFieldInitSpec(s.types.cloneNode(e),p,n));break;case d&&f&&y&&o:c.push(buildPrivateFieldInitLoose(s.types.thisExpression(),p,a));break;case d&&f&&y&&!o:c.push(buildPrivateInstanceFieldInitSpec(s.types.thisExpression(),p,a));break;case d&&f&&g&&o:c.unshift(buildPrivateMethodInitLoose(s.types.thisExpression(),p,a));l.push(buildPrivateMethodDeclaration(p,a,o));break;case d&&f&&g&&!o:c.unshift(buildPrivateInstanceMethodInitSpec(s.types.thisExpression(),p,a));l.push(buildPrivateMethodDeclaration(p,a,o));break;case r&&f&&g&&!o:u=true;l.push(buildPrivateStaticFieldInitSpec(p,a));l.unshift(buildPrivateMethodDeclaration(p,a,o));break;case r&&f&&g&&o:u=true;l.push(buildPrivateStaticMethodInitLoose(s.types.cloneNode(e),p,n,a));l.unshift(buildPrivateMethodDeclaration(p,a,o));break;case d&&m&&y&&o:c.push(buildPublicFieldInitLoose(s.types.thisExpression(),p));break;case d&&m&&y&&!o:c.push(buildPublicFieldInitSpec(s.types.thisExpression(),p,n));break;default:throw new Error("Unreachable.")}}return{staticNodes:l.filter(Boolean),instanceNodes:c.filter(Boolean),wrapClass(t){for(const e of r){e.remove()}if(!u)return t;if(t.isClassExpression()){t.scope.push({id:e});t.replaceWith(s.types.assignmentExpression("=",s.types.cloneNode(e),t.node))}else if(!t.node.id){t.node.id=e}return t}}}},4026:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.createClassFeaturePlugin=createClassFeaturePlugin;Object.defineProperty(t,"injectInitialization",{enumerable:true,get:function(){return l.injectInitialization}});Object.defineProperty(t,"FEATURES",{enumerable:true,get:function(){return c.FEATURES}});var s=r(8304);var a=_interopRequireDefault(r(8486));var n=_interopRequireDefault(r(2046));var o=r(7988);var i=r(9009);var l=r(751);var c=r(889);var u=_interopRequireDefault(r(6190));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const p=u.default.version.split(".").reduce(((e,t)=>e*1e5+ +t),0);const d="@babel/plugin-class-features/version";function createClassFeaturePlugin({name:e,feature:t,loose:r,manipulateOptions:u}){return{name:e,manipulateOptions:u,pre(){(0,c.enableFeature)(this.file,t,r);if(!this.file.get(d)||this.file.get(d)0){(0,l.injectInitialization)(e,u,_,((e,t)=>{if(f)return;for(const r of m){if(r.node.static)continue;r.traverse(e,t)}}))}e=S(e);e.insertBefore([...E,...j]);e.insertAfter(w)},PrivateName(e){if(this.file.get(d)!==p||e.parentPath.isPrivate({key:e.node})){return}throw e.buildCodeFrameError(`Unknown PrivateName "${e}"`)},ExportDefaultDeclaration(e){if(this.file.get(d)!==p)return;const t=e.get("declaration");if(t.isClassDeclaration()&&(0,i.hasDecorators)(t.node)){if(t.node.id){(0,n.default)(e)}else{t.node.type="ClassExpression"}}}}}}},751:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.injectInitialization=injectInitialization;t.extractComputedKeys=extractComputedKeys;var s=r(8304);var a=r(2768);const n=s.traverse.visitors.merge([{Super(e){const{node:t,parentPath:r}=e;if(r.isCallExpression({callee:t})){this.push(r)}}},a.environmentVisitor]);const o={"TSTypeAnnotation|TypeAnnotation"(e){e.skip()},ReferencedIdentifier(e){if(this.scope.hasOwnBinding(e.node.name)){this.scope.rename(e.node.name);e.skip()}}};function handleClassTDZ(e,t){if(t.classBinding&&t.classBinding===e.scope.getBinding(e.node.name)){const r=t.file.addHelper("classNameTDZError");const a=s.types.callExpression(r,[s.types.stringLiteral(e.node.name)]);e.replaceWith(s.types.sequenceExpression([a,e.node]));e.skip()}}const i={ReferencedIdentifier:handleClassTDZ};function injectInitialization(e,t,r,a){if(!r.length)return;const i=!!e.node.superClass;if(!t){const r=s.types.classMethod("constructor",s.types.identifier("constructor"),[],s.types.blockStatement([]));if(i){r.params=[s.types.restElement(s.types.identifier("args"))];r.body.body.push(s.template.statement.ast`super(...args)`)}[t]=e.get("body").unshiftContainer("body",r)}if(a){a(o,{scope:t.scope})}if(i){const e=[];t.traverse(n,e);let a=true;for(const t of e){if(a){t.insertAfter(r);a=false}else{t.insertAfter(r.map((e=>s.types.cloneNode(e))))}}}else{t.get("body").unshiftContainer("body",r)}}function extractComputedKeys(e,t,r,a){const n=[];const o={classBinding:t.node.id&&t.scope.getBinding(t.node.id.name),file:a};for(const e of r){const r=e.get("key");if(r.isReferencedIdentifier()){handleClassTDZ(r,o)}else{r.traverse(i,o)}const a=e.node;if(!r.isConstantExpression()){const e=t.scope.generateUidIdentifierBasedOnNode(a.key);t.scope.push({id:e,kind:"let"});n.push(s.types.expressionStatement(s.types.assignmentExpression("=",s.types.cloneNode(e),a.key)));a.key=s.types.cloneNode(e)}}return n}},3121:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.assertFieldTransformed=assertFieldTransformed;function assertFieldTransformed(e){if(e.node.declare){throw e.buildCodeFrameError(`TypeScript 'declare' fields must first be transformed by `+`@babel/plugin-transform-typescript.\n`+`If you have already enabled that plugin (or '@babel/preset-typescript'), make sure `+`that it runs before any plugin related to additional class features:\n`+` - @babel/plugin-proposal-class-properties\n`+` - @babel/plugin-proposal-private-methods\n`+` - @babel/plugin-proposal-decorators`)}}},8486:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=_interopRequireDefault(r(1393));var a=_interopRequireDefault(r(4489));var n=_interopRequireWildcard(r(8622));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const o=(0,a.default)(`\n (function (FUNCTION_KEY) {\n function FUNCTION_ID() {\n return FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n }\n\n return FUNCTION_ID;\n })(FUNCTION)\n`);const i=(0,a.default)(`\n (function (FUNCTION_KEY) {\n function* FUNCTION_ID() {\n return yield* FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n };\n\n return FUNCTION_ID;\n })(FUNCTION)\n`);const l={"ReferencedIdentifier|BindingIdentifier"(e,t){if(e.node.name!==t.name)return;const r=e.scope.getBindingIdentifier(t.name);if(r!==t.outerDeclar)return;t.selfReference=true;e.stop()}};function getNameFromLiteralId(e){if(n.isNullLiteral(e)){return"null"}if(n.isRegExpLiteral(e)){return`_${e.pattern}_${e.flags}`}if(n.isTemplateLiteral(e)){return e.quasis.map((e=>e.value.raw)).join("")}if(e.value!==undefined){return e.value+""}return""}function wrap(e,t,r,a){if(e.selfReference){if(a.hasBinding(r.name)&&!a.hasGlobal(r.name)){a.rename(r.name)}else{if(!n.isFunction(t))return;let e=o;if(t.generator){e=i}const l=e({FUNCTION:t,FUNCTION_ID:r,FUNCTION_KEY:a.generateUidIdentifier(r.name)}).expression;const c=l.callee.body.body[0].params;for(let e=0,r=(0,s.default)(t);e{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=_interopRequireWildcard(r(8622));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _default(e,t,r,a){if(r.length===1&&s.isSpreadElement(r[0])&&s.isIdentifier(r[0].argument,{name:"arguments"})){return s.callExpression(s.memberExpression(e,s.identifier("apply")),[t,r[0].argument])}else{if(a){return s.optionalCallExpression(s.optionalMemberExpression(e,s.identifier("call"),false,true),[t,...r],false)}return s.callExpression(s.memberExpression(e,s.identifier("call")),[t,...r])}}},249:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},2768:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.skipAllButComputedKey=skipAllButComputedKey;t["default"]=t.environmentVisitor=void 0;var s=_interopRequireDefault(r(7369));var a=_interopRequireDefault(r(3546));var n=_interopRequireDefault(r(6351));var o=_interopRequireWildcard(r(8622));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function getPrototypeOfExpression(e,t,r,s){e=o.cloneNode(e);const a=t||s?e:o.memberExpression(e,o.identifier("prototype"));return o.callExpression(r.addHelper("getPrototypeOf"),[a])}function skipAllButComputedKey(e){if(!e.node.computed){e.skip();return}const t=o.VISITOR_KEYS[e.type];for(const r of t){if(r!=="key")e.skipKey(r)}}const i={[`${o.StaticBlock?"StaticBlock|":""}ClassPrivateProperty|TypeAnnotation`](e){e.skip()},Function(e){if(e.isMethod())return;if(e.isArrowFunctionExpression())return;e.skip()},"Method|ClassProperty"(e){skipAllButComputedKey(e)}};t.environmentVisitor=i;const l=s.default.visitors.merge([i,{Super(e,t){const{node:r,parentPath:s}=e;if(!s.isMemberExpression({object:r}))return;t.handle(s)}}]);const c={memoise(e,t){const{scope:r,node:s}=e;const{computed:a,property:n}=s;if(!a){return}const o=r.maybeGenerateMemoised(n);if(!o){return}this.memoiser.set(n,o,t)},prop(e){const{computed:t,property:r}=e.node;if(this.memoiser.has(r)){return o.cloneNode(this.memoiser.get(r))}if(t){return o.cloneNode(r)}return o.stringLiteral(r.name)},get(e){return this._get(e,this._getThisRefs())},_get(e,t){const r=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("get"),[t.memo?o.sequenceExpression([t.memo,r]):r,this.prop(e),t.this])},_getThisRefs(){if(!this.isDerivedConstructor){return{this:o.thisExpression()}}const e=this.scope.generateDeclaredUidIdentifier("thisSuper");return{memo:o.assignmentExpression("=",e,o.thisExpression()),this:o.cloneNode(e)}},set(e,t){const r=this._getThisRefs();const s=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("set"),[r.memo?o.sequenceExpression([r.memo,s]):s,this.prop(e),t,r.this,o.booleanLiteral(e.isInStrictMode())])},destructureSet(e){throw e.buildCodeFrameError(`Destructuring to a super field is not supported yet.`)},call(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,false)},optionalCall(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,true)}};const u=Object.assign({},c,{prop(e){const{property:t}=e.node;if(this.memoiser.has(t)){return o.cloneNode(this.memoiser.get(t))}return o.cloneNode(t)},get(e){const{isStatic:t,superRef:r}=this;const{computed:s}=e.node;const a=this.prop(e);let n;if(t){n=r?o.cloneNode(r):o.memberExpression(o.identifier("Function"),o.identifier("prototype"))}else{n=r?o.memberExpression(o.cloneNode(r),o.identifier("prototype")):o.memberExpression(o.identifier("Object"),o.identifier("prototype"))}return o.memberExpression(n,a,s)},set(e,t){const{computed:r}=e.node;const s=this.prop(e);return o.assignmentExpression("=",o.memberExpression(o.thisExpression(),s,r),t)},destructureSet(e){const{computed:t}=e.node;const r=this.prop(e);return o.memberExpression(o.thisExpression(),r,t)},call(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,false)},optionalCall(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,true)}});class ReplaceSupers{constructor(e){const t=e.methodPath;this.methodPath=t;this.isDerivedConstructor=t.isClassMethod({kind:"constructor"})&&!!e.superRef;this.isStatic=t.isObjectMethod()||t.node.static;this.isPrivateMethod=t.isPrivate()&&t.isMethod();this.file=e.file;this.superRef=e.superRef;this.isLoose=e.isLoose;this.opts=e}getObjectRef(){return o.cloneNode(this.opts.objectRef||this.opts.getObjectRef())}replace(){const e=this.isLoose?u:c;(0,a.default)(this.methodPath,l,Object.assign({file:this.file,scope:this.methodPath.scope,isDerivedConstructor:this.isDerivedConstructor,isStatic:this.isStatic,isPrivateMethod:this.isPrivateMethod,getObjectRef:this.getObjectRef.bind(this),superRef:this.superRef},e))}}t["default"]=ReplaceSupers},2046:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=splitExportDeclaration;var s=_interopRequireWildcard(r(8622));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function splitExportDeclaration(e){if(!e.isExportDeclaration()){throw new Error("Only export declarations can be split.")}const t=e.isExportDefaultDeclaration();const r=e.get("declaration");const a=r.isClassDeclaration();if(t){const t=r.isFunctionDeclaration()||a;const n=r.isScope()?r.scope.parent:r.scope;let o=r.node.id;let i=false;if(!o){i=true;o=n.generateUidIdentifier("default");if(t||r.isFunctionExpression()||r.isClassExpression()){r.node.id=s.cloneNode(o)}}const l=t?r:s.variableDeclaration("var",[s.variableDeclarator(s.cloneNode(o),r.node)]);const c=s.exportNamedDeclaration(null,[s.exportSpecifier(s.cloneNode(o),s.identifier("default"))]);e.insertAfter(c);e.replaceWith(l);if(i){n.registerDeclaration(e)}return e}if(e.get("specifiers").length>0){throw new Error("It doesn't make sense to split exported specifiers.")}const n=r.getOuterBindingIdentifiers();const o=Object.keys(n).map((e=>s.exportSpecifier(s.identifier(e),s.identifier(e))));const i=s.exportNamedDeclaration(null,o);e.insertAfter(i);e.replaceWith(r.node);return e}},891:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=createTemplateBuilder;var s=r(4429);var a=_interopRequireDefault(r(9430));var n=_interopRequireDefault(r(9221));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const o=(0,s.validate)({placeholderPattern:false});function createTemplateBuilder(e,t){const r=new WeakMap;const i=new WeakMap;const l=t||(0,s.validate)(null);return Object.assign(((t,...o)=>{if(typeof t==="string"){if(o.length>1)throw new Error("Unexpected extra params.");return extendedTrace((0,a.default)(e,t,(0,s.merge)(l,(0,s.validate)(o[0]))))}else if(Array.isArray(t)){let s=r.get(t);if(!s){s=(0,n.default)(e,t,l);r.set(t,s)}return extendedTrace(s(o))}else if(typeof t==="object"&&t){if(o.length>0)throw new Error("Unexpected extra params.");return createTemplateBuilder(e,(0,s.merge)(l,(0,s.validate)(t)))}throw new Error(`Unexpected template param ${typeof t}`)}),{ast:(t,...r)=>{if(typeof t==="string"){if(r.length>1)throw new Error("Unexpected extra params.");return(0,a.default)(e,t,(0,s.merge)((0,s.merge)(l,(0,s.validate)(r[0])),o))()}else if(Array.isArray(t)){let a=i.get(t);if(!a){a=(0,n.default)(e,t,(0,s.merge)(l,o));i.set(t,a)}return a(r)()}throw new Error(`Unexpected template param ${typeof t}`)}})}function extendedTrace(e){let t="";try{throw new Error}catch(e){if(e.stack){t=e.stack.split("\n").slice(3).join("\n")}}return r=>{try{return e(r)}catch(e){e.stack+=`\n =============\n${t}`;throw e}}}},119:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.program=t.expression=t.statement=t.statements=t.smart=void 0;var s=_interopRequireWildcard(r(8622));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function makeStatementFormatter(e){return{code:e=>`/* @babel/template */;\n${e}`,validate:()=>{},unwrap:t=>e(t.program.body.slice(1))}}const a=makeStatementFormatter((e=>{if(e.length>1){return e}else{return e[0]}}));t.smart=a;const n=makeStatementFormatter((e=>e));t.statements=n;const o=makeStatementFormatter((e=>{if(e.length===0){throw new Error("Found nothing to return.")}if(e.length>1){throw new Error("Found multiple statements but wanted one")}return e[0]}));t.statement=o;const i={code:e=>`(\n${e}\n)`,validate:e=>{if(e.program.body.length>1){throw new Error("Found multiple statements but wanted one")}if(i.unwrap(e).start===0){throw new Error("Parse result included parens.")}},unwrap:({program:e})=>{const[t]=e.body;s.assertExpressionStatement(t);return t.expression}};t.expression=i;const l={code:e=>e,validate:()=>{},unwrap:e=>e.program};t.program=l},4489:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=t.program=t.expression=t.statements=t.statement=t.smart=void 0;var s=_interopRequireWildcard(r(119));var a=_interopRequireDefault(r(891));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const n=(0,a.default)(s.smart);t.smart=n;const o=(0,a.default)(s.statement);t.statement=o;const i=(0,a.default)(s.statements);t.statements=i;const l=(0,a.default)(s.expression);t.expression=l;const c=(0,a.default)(s.program);t.program=c;var u=Object.assign(n.bind(undefined),{smart:n,statement:o,statements:i,expression:l,program:c,ast:n.ast});t["default"]=u},9221:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=literalTemplate;var s=r(4429);var a=_interopRequireDefault(r(5475));var n=_interopRequireDefault(r(553));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function literalTemplate(e,t,r){const{metadata:a,names:o}=buildLiteralData(e,t,r);return t=>{const r={};t.forEach(((e,t)=>{r[o[t]]=e}));return t=>{const o=(0,s.normalizeReplacements)(t);if(o){Object.keys(o).forEach((e=>{if(Object.prototype.hasOwnProperty.call(r,e)){throw new Error("Unexpected replacement overlap.")}}))}return e.unwrap((0,n.default)(a,o?Object.assign(o,r):r))}}}function buildLiteralData(e,t,r){let s;let n;let o;let i="";do{i+="$";const l=buildTemplateCode(t,i);s=l.names;n=new Set(s);o=(0,a.default)(e,e.code(l.code),{parser:r.parser,placeholderWhitelist:new Set(l.names.concat(r.placeholderWhitelist?Array.from(r.placeholderWhitelist):[])),placeholderPattern:r.placeholderPattern,preserveComments:r.preserveComments,syntacticPlaceholders:r.syntacticPlaceholders})}while(o.placeholders.some((e=>e.isDuplicate&&n.has(e.name))));return{metadata:o,names:s}}function buildTemplateCode(e,t){const r=[];let s=e[0];for(let a=1;a{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.merge=merge;t.validate=validate;t.normalizeReplacements=normalizeReplacements;function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var r={};var s=Object.keys(e);var a,n;for(n=0;n=0)continue;r[a]=e[a]}return r}function merge(e,t){const{placeholderWhitelist:r=e.placeholderWhitelist,placeholderPattern:s=e.placeholderPattern,preserveComments:a=e.preserveComments,syntacticPlaceholders:n=e.syntacticPlaceholders}=t;return{parser:Object.assign({},e.parser,t.parser),placeholderWhitelist:r,placeholderPattern:s,preserveComments:a,syntacticPlaceholders:n}}function validate(e){if(e!=null&&typeof e!=="object"){throw new Error("Unknown template options.")}const t=e||{},{placeholderWhitelist:r,placeholderPattern:s,preserveComments:a,syntacticPlaceholders:n}=t,o=_objectWithoutPropertiesLoose(t,["placeholderWhitelist","placeholderPattern","preserveComments","syntacticPlaceholders"]);if(r!=null&&!(r instanceof Set)){throw new Error("'.placeholderWhitelist' must be a Set, null, or undefined")}if(s!=null&&!(s instanceof RegExp)&&s!==false){throw new Error("'.placeholderPattern' must be a RegExp, false, null, or undefined")}if(a!=null&&typeof a!=="boolean"){throw new Error("'.preserveComments' must be a boolean, null, or undefined")}if(n!=null&&typeof n!=="boolean"){throw new Error("'.syntacticPlaceholders' must be a boolean, null, or undefined")}if(n===true&&(r!=null||s!=null)){throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible"+" with '.syntacticPlaceholders: true'")}return{parser:o,placeholderWhitelist:r||undefined,placeholderPattern:s==null?undefined:s,preserveComments:a==null?undefined:a,syntacticPlaceholders:n==null?undefined:n}}function normalizeReplacements(e){if(Array.isArray(e)){return e.reduce(((e,t,r)=>{e["$"+r]=t;return e}),{})}else if(typeof e==="object"||e==null){return e||undefined}throw new Error("Template replacements must be an array, object, null, or undefined")}},5475:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=parseAndBuildMetadata;var s=_interopRequireWildcard(r(8622));var a=r(6949);var n=r(7548);function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const o=/^[_$A-Z0-9]+$/;function parseAndBuildMetadata(e,t,r){const{placeholderWhitelist:a,placeholderPattern:n,preserveComments:o,syntacticPlaceholders:i}=r;const l=parseWithCodeFrame(t,r.parser,i);s.removePropertiesDeep(l,{preserveComments:o});e.validate(l);const c={placeholders:[],placeholderNames:new Set};const u={placeholders:[],placeholderNames:new Set};const p={value:undefined};s.traverse(l,placeholderVisitorHandler,{syntactic:c,legacy:u,isLegacyRef:p,placeholderWhitelist:a,placeholderPattern:n,syntacticPlaceholders:i});return Object.assign({ast:l},p.value?u:c)}function placeholderVisitorHandler(e,t,r){var a;let n;if(s.isPlaceholder(e)){if(r.syntacticPlaceholders===false){throw new Error("%%foo%%-style placeholders can't be used when "+"'.syntacticPlaceholders' is false.")}else{n=e.name.name;r.isLegacyRef.value=false}}else if(r.isLegacyRef.value===false||r.syntacticPlaceholders){return}else if(s.isIdentifier(e)||s.isJSXIdentifier(e)){n=e.name;r.isLegacyRef.value=true}else if(s.isStringLiteral(e)){n=e.value;r.isLegacyRef.value=true}else{return}if(!r.isLegacyRef.value&&(r.placeholderPattern!=null||r.placeholderWhitelist!=null)){throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible"+" with '.syntacticPlaceholders: true'")}if(r.isLegacyRef.value&&(r.placeholderPattern===false||!(r.placeholderPattern||o).test(n))&&!((a=r.placeholderWhitelist)==null?void 0:a.has(n))){return}t=t.slice();const{node:i,key:l}=t[t.length-1];let c;if(s.isStringLiteral(e)||s.isPlaceholder(e,{expectedNode:"StringLiteral"})){c="string"}else if(s.isNewExpression(i)&&l==="arguments"||s.isCallExpression(i)&&l==="arguments"||s.isFunction(i)&&l==="params"){c="param"}else if(s.isExpressionStatement(i)&&!s.isPlaceholder(e)){c="statement";t=t.slice(0,-1)}else if(s.isStatement(e)&&s.isPlaceholder(e)){c="statement"}else{c="other"}const{placeholders:u,placeholderNames:p}=r.isLegacyRef.value?r.legacy:r.syntactic;u.push({name:n,type:c,resolve:e=>resolveAncestors(e,t),isDuplicate:p.has(n)});p.add(n)}function resolveAncestors(e,t){let r=e;for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=populatePlaceholders;var s=_interopRequireWildcard(r(8622));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function populatePlaceholders(e,t){const r=s.cloneNode(e.ast);if(t){e.placeholders.forEach((e=>{if(!Object.prototype.hasOwnProperty.call(t,e.name)){const t=e.name;throw new Error(`Error: No substitution given for "${t}". If this is not meant to be a\n placeholder you may want to consider passing one of the following options to @babel/template:\n - { placeholderPattern: false, placeholderWhitelist: new Set(['${t}'])}\n - { placeholderPattern: /^${t}$/ }`)}}));Object.keys(t).forEach((t=>{if(!e.placeholderNames.has(t)){throw new Error(`Unknown substitution "${t}" given`)}}))}e.placeholders.slice().reverse().forEach((e=>{try{applyReplacement(e,r,t&&t[e.name]||null)}catch(t){t.message=`@babel/template placeholder "${e.name}": ${t.message}`;throw t}}));return r}function applyReplacement(e,t,r){if(e.isDuplicate){if(Array.isArray(r)){r=r.map((e=>s.cloneNode(e)))}else if(typeof r==="object"){r=s.cloneNode(r)}}const{parent:a,key:n,index:o}=e.resolve(t);if(e.type==="string"){if(typeof r==="string"){r=s.stringLiteral(r)}if(!r||!s.isStringLiteral(r)){throw new Error("Expected string substitution")}}else if(e.type==="statement"){if(o===undefined){if(!r){r=s.emptyStatement()}else if(Array.isArray(r)){r=s.blockStatement(r)}else if(typeof r==="string"){r=s.expressionStatement(s.identifier(r))}else if(!s.isStatement(r)){r=s.expressionStatement(r)}}else{if(r&&!Array.isArray(r)){if(typeof r==="string"){r=s.identifier(r)}if(!s.isStatement(r)){r=s.expressionStatement(r)}}}}else if(e.type==="param"){if(typeof r==="string"){r=s.identifier(r)}if(o===undefined)throw new Error("Assertion failure.")}else{if(typeof r==="string"){r=s.identifier(r)}if(Array.isArray(r)){throw new Error("Cannot replace single expression with an array.")}}if(o===undefined){s.validate(a,n,r);a[n]=r}else{const t=a[n].slice();if(e.type==="statement"||e.type==="param"){if(r==null){t.splice(o,1)}else if(Array.isArray(r)){t.splice(o,1,...r)}else{t[o]=r}}else{t[o]=r}s.validate(a,n,t);a[n]=t}}},9430:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=stringTemplate;var s=r(4429);var a=_interopRequireDefault(r(5475));var n=_interopRequireDefault(r(553));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function stringTemplate(e,t,r){t=e.code(t);let o;return i=>{const l=(0,s.normalizeReplacements)(i);if(!o)o=(0,a.default)(e,t,r);return e.unwrap((0,n.default)(o,l))}}},4920:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3497);var a=r(2074);const n=["commonjs","amd","systemjs"];const o=`@babel/plugin-proposal-dynamic-import depends on a modules\ntransform plugin. Supported plugins are:\n - @babel/plugin-transform-modules-commonjs ^7.4.0\n - @babel/plugin-transform-modules-amd ^7.4.0\n - @babel/plugin-transform-modules-systemjs ^7.4.0\n\nIf you are using Webpack or Rollup and thus don't want\nBabel to transpile your imports and exports, you can use\nthe @babel/plugin-syntax-dynamic-import plugin and let your\nbundler handle dynamic imports.\n`;var i=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-dynamic-import",inherits:a.default,pre(){this.file.set("@babel/plugin-proposal-dynamic-import","7.14.5")},visitor:{Program(){const e=this.file.get("@babel/plugin-transform-modules-*");if(!n.includes(e)){throw new Error(o)}}}}}));t["default"]=i},3497:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9579:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(791);var a=r(1454);var n=r(8304);var o=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-export-namespace-from",inherits:a.default,visitor:{ExportNamedDeclaration(e){var t;const{node:r,scope:s}=e;const{specifiers:a}=r;const o=n.types.isExportDefaultSpecifier(a[0])?1:0;if(!n.types.isExportNamespaceSpecifier(a[o]))return;const i=[];if(o===1){i.push(n.types.exportNamedDeclaration(null,[a.shift()],r.source))}const l=a.shift();const{exported:c}=l;const u=s.generateUidIdentifier((t=c.name)!=null?t:c.value);i.push(n.types.importDeclaration([n.types.importNamespaceSpecifier(u)],n.types.cloneNode(r.source)),n.types.exportNamedDeclaration(null,[n.types.exportSpecifier(n.types.cloneNode(u),c)]));if(r.specifiers.length>=1){i.push(r)}const[p]=e.replaceWithMultiple(i);e.scope.registerDeclaration(p)}}}}));t["default"]=o},791:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7703:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(169);var a=r(3030);var n=(0,s.declare)((e=>{e.assertVersion(7);const t=/(\\*)([\u2028\u2029])/g;function replace(e,t,r){const s=t.length%2===1;if(s)return e;return`${t}\\u${r.charCodeAt(0).toString(16)}`}return{name:"proposal-json-strings",inherits:a.default,visitor:{"DirectiveLiteral|StringLiteral"({node:e}){const{extra:r}=e;if(!(r!=null&&r.raw))return;r.raw=r.raw.replace(t,replace)}}}}));t["default"]=n},169:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1195:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(7010);var a=r(5945);var n=r(8304);var o=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-logical-assignment-operators",inherits:a.default,visitor:{AssignmentExpression(e){const{node:t,scope:r}=e;const{operator:s,left:a,right:o}=t;const i=s.slice(0,-1);if(!n.types.LOGICAL_OPERATORS.includes(i)){return}const l=n.types.cloneNode(a);if(n.types.isMemberExpression(a)){const{object:e,property:t,computed:s}=a;const o=r.maybeGenerateMemoised(e);if(o){a.object=o;l.object=n.types.assignmentExpression("=",n.types.cloneNode(o),e)}if(s){const e=r.maybeGenerateMemoised(t);if(e){a.property=e;l.property=n.types.assignmentExpression("=",n.types.cloneNode(e),t)}}}e.replaceWith(n.types.logicalExpression(i,l,n.types.assignmentExpression("=",a,o)))}}}}));t["default"]=o},7010:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5353:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6080);var a=r(5879);var n=r(8304);var o=(0,s.declare)(((e,{loose:t=false})=>{var r;e.assertVersion(7);const s=(r=e.assumption("noDocumentAll"))!=null?r:t;return{name:"proposal-nullish-coalescing-operator",inherits:a.default,visitor:{LogicalExpression(e){const{node:t,scope:r}=e;if(t.operator!=="??"){return}let a;let o;if(r.isStatic(t.left)){a=t.left;o=n.types.cloneNode(t.left)}else if(r.path.isPattern()){e.replaceWith(n.template.ast`(() => ${e.node})()`);return}else{a=r.generateUidIdentifierBasedOnNode(t.left);r.push({id:n.types.cloneNode(a)});o=n.types.assignmentExpression("=",a,t.left)}e.replaceWith(n.types.conditionalExpression(s?n.types.binaryExpression("!=",o,n.types.nullLiteral()):n.types.logicalExpression("&&",n.types.binaryExpression("!==",o,n.types.nullLiteral()),n.types.binaryExpression("!==",n.types.cloneNode(a),r.buildUndefinedNode())),n.types.cloneNode(a),t.right))}}}}));t["default"]=o},6080:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7300:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(5071);var a=r(1816);function remover({node:e}){var t;const{extra:r}=e;if(r!=null&&(t=r.raw)!=null&&t.includes("_")){r.raw=r.raw.replace(/_/g,"")}}var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-numeric-separator",inherits:a.default,visitor:{NumericLiteral:remover,BigIntLiteral:remover}}}));t["default"]=n},5071:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},6309:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8711);var a=r(4499);var n=r(8304);var o=r(3714);var i=r(797);var l=r(5732);const c=(()=>{const e=n.types.identifier("a");const t=n.types.objectProperty(n.types.identifier("key"),e);const r=n.types.objectPattern([t]);return n.types.isReferenced(e,t,r)?1:0})();var u=(0,s.declare)(((e,t)=>{var r,s,u,p;e.assertVersion(7);const d=e.targets();const f=!(0,i.isRequired)("es6.object.assign",d,{compatData:l});const{useBuiltIns:m=f,loose:y=false}=t;if(typeof y!=="boolean"){throw new Error(".loose must be a boolean, or undefined")}const g=(r=e.assumption("ignoreFunctionLength"))!=null?r:y;const h=(s=e.assumption("objectRestNoSymbols"))!=null?s:y;const b=(u=e.assumption("pureGetters"))!=null?u:y;const x=(p=e.assumption("setSpreadProperties"))!=null?p:y;function getExtendsHelper(e){return m?n.types.memberExpression(n.types.identifier("Object"),n.types.identifier("assign")):e.addHelper("extends")}function hasRestElement(e){let t=false;visitRestElements(e,(e=>{t=true;e.stop()}));return t}function hasObjectPatternRestElement(e){let t=false;visitRestElements(e,(e=>{if(e.parentPath.isObjectPattern()){t=true;e.stop()}}));return t}function visitRestElements(e,t){e.traverse({Expression(e){const t=e.parent.type;if(t==="AssignmentPattern"&&e.key==="right"||t==="ObjectProperty"&&e.parent.computed&&e.key==="key"){e.skip()}},RestElement:t})}function hasSpread(e){for(const t of e.properties){if(n.types.isSpreadElement(t)){return true}}return false}function extractNormalizedKeys(e){const t=e.node.properties;const r=[];let s=true;let a=false;for(const e of t){if(n.types.isIdentifier(e.key)&&!e.computed){r.push(n.types.stringLiteral(e.key.name))}else if(n.types.isTemplateLiteral(e.key)){r.push(n.types.cloneNode(e.key));a=true}else if(n.types.isLiteral(e.key)){r.push(n.types.stringLiteral(String(e.key.value)))}else{r.push(n.types.cloneNode(e.key));s=false}}return{keys:r,allLiteral:s,hasTemplateLiteral:a}}function replaceImpureComputedKeys(e,t){const r=[];for(const s of e){const e=s.get("key");if(s.node.computed&&!e.isPure()){const s=t.generateUidBasedOnNode(e.node);const a=n.types.variableDeclarator(n.types.identifier(s),e.node);r.push(a);e.replaceWith(n.types.identifier(s))}}return r}function removeUnusedExcludedKeys(e){const t=e.getOuterBindingIdentifierPaths();Object.keys(t).forEach((r=>{const s=t[r].parentPath;if(e.scope.getBinding(r).references>c||!s.isObjectProperty()){return}s.remove()}))}function createObjectRest(e,t,r){const s=e.get("properties");const a=s[s.length-1];n.types.assertRestElement(a.node);const o=n.types.cloneNode(a.node);a.remove();const i=replaceImpureComputedKeys(e.get("properties"),e.scope);const{keys:l,allLiteral:c,hasTemplateLiteral:u}=extractNormalizedKeys(e);if(l.length===0){return[i,o.argument,n.types.callExpression(getExtendsHelper(t),[n.types.objectExpression([]),n.types.cloneNode(r)])]}let p;if(!c){p=n.types.callExpression(n.types.memberExpression(n.types.arrayExpression(l),n.types.identifier("map")),[t.addHelper("toPropertyKey")])}else{p=n.types.arrayExpression(l);if(!u&&!n.types.isProgram(e.scope.block)){const t=e.findParent((e=>e.isProgram()));const r=e.scope.generateUidIdentifier("excluded");t.scope.push({id:r,init:p,kind:"const"});p=n.types.cloneNode(r)}}return[i,o.argument,n.types.callExpression(t.addHelper(`objectWithoutProperties${h?"Loose":""}`),[n.types.cloneNode(r),p])]}function replaceRestElement(e,t,r){if(t.isAssignmentPattern()){replaceRestElement(e,t.get("left"),r);return}if(t.isArrayPattern()&&hasRestElement(t)){const s=t.get("elements");for(let t=0;te.skip(),"ReferencedIdentifier|BindingIdentifier":IdentifierHandler},e.scope)}}}if(!a){for(let e=0;ee>=n-1||r.has(e);(0,o.convertFunctionParams)(e,g,shouldTransformParam,replaceRestElement)}},VariableDeclarator(e,t){if(!e.get("id").isObjectPattern()){return}let r=e;const s=e;visitRestElements(e.get("id"),(e=>{if(!e.parentPath.isObjectPattern()){return}if(s.node.id.properties.length>1&&!n.types.isIdentifier(s.node.init)){const t=e.scope.generateUidIdentifierBasedOnNode(s.node.init,"ref");s.insertBefore(n.types.variableDeclarator(t,s.node.init));s.replaceWith(n.types.variableDeclarator(s.node.id,n.types.cloneNode(t)));return}let a=s.node.init;const o=[];let i;e.findParent((e=>{if(e.isObjectProperty()){o.unshift(e)}else if(e.isVariableDeclarator()){i=e.parentPath.node.kind;return true}}));const l=replaceImpureComputedKeys(o,e.scope);o.forEach((e=>{const{node:t}=e;a=n.types.memberExpression(a,n.types.cloneNode(t.key),t.computed||n.types.isLiteral(t.key))}));const c=e.findParent((e=>e.isObjectPattern()));const[u,p,d]=createObjectRest(c,t,a);if(b){removeUnusedExcludedKeys(c)}n.types.assertIdentifier(p);r.insertBefore(u);r.insertBefore(l);r.insertAfter(n.types.variableDeclarator(p,d));r=r.getSibling(r.key+1);e.scope.registerBinding(i,r);if(c.node.properties.length===0){c.findParent((e=>e.isObjectProperty()||e.isVariableDeclarator())).remove()}}))},ExportNamedDeclaration(e){const t=e.get("declaration");if(!t.isVariableDeclaration())return;const r=t.get("declarations").some((e=>hasObjectPatternRestElement(e.get("id"))));if(!r)return;const s=[];for(const t of Object.keys(e.getOuterBindingIdentifiers(e))){s.push(n.types.exportSpecifier(n.types.identifier(t),n.types.identifier(t)))}e.replaceWith(t.node);e.insertAfter(n.types.exportNamedDeclaration(null,s))},CatchClause(e){const t=e.get("param");replaceRestElement(t.parentPath,t)},AssignmentExpression(e,t){const r=e.get("left");if(r.isObjectPattern()&&hasRestElement(r)){const s=[];const a=e.scope.generateUidBasedOnNode(e.node.right,"ref");s.push(n.types.variableDeclaration("var",[n.types.variableDeclarator(n.types.identifier(a),e.node.right)]));const[o,i,l]=createObjectRest(r,t,n.types.identifier(a));if(o.length>0){s.push(n.types.variableDeclaration("var",o))}const c=n.types.cloneNode(e.node);c.right=n.types.identifier(a);s.push(n.types.expressionStatement(c));s.push(n.types.toStatement(n.types.assignmentExpression("=",i,l)));s.push(n.types.expressionStatement(n.types.identifier(a)));e.replaceWithMultiple(s)}},ForXStatement(e){const{node:t,scope:r}=e;const s=e.get("left");const a=t.left;if(!hasObjectPatternRestElement(s)){return}if(!n.types.isVariableDeclaration(a)){const s=r.generateUidIdentifier("ref");t.left=n.types.variableDeclaration("var",[n.types.variableDeclarator(s)]);e.ensureBlock();if(t.body.body.length===0&&e.isCompletionRecord()){t.body.body.unshift(n.types.expressionStatement(r.buildUndefinedNode()))}t.body.body.unshift(n.types.expressionStatement(n.types.assignmentExpression("=",a,n.types.cloneNode(s))))}else{const s=a.declarations[0].id;const o=r.generateUidIdentifier("ref");t.left=n.types.variableDeclaration(a.kind,[n.types.variableDeclarator(o,null)]);e.ensureBlock();t.body.body.unshift(n.types.variableDeclaration(t.left.kind,[n.types.variableDeclarator(s,n.types.cloneNode(o))]))}},ArrayPattern(e){const t=[];visitRestElements(e,(e=>{if(!e.parentPath.isObjectPattern()){return}const r=e.parentPath;const s=e.scope.generateUidIdentifier("ref");t.push(n.types.variableDeclarator(r.node,s));r.replaceWith(n.types.cloneNode(s));e.skip()}));if(t.length>0){const r=e.getStatementParent();r.insertAfter(n.types.variableDeclaration(r.node.kind||"var",t))}},ObjectExpression(e,t){if(!hasSpread(e.node))return;let r;if(x){r=getExtendsHelper(t)}else{try{r=t.addHelper("objectSpread2")}catch(e){this.file.declarations["objectSpread2"]=null;r=t.addHelper("objectSpread")}}let s=null;let a=[];function make(){const e=a.length>0;const t=n.types.objectExpression(a);a=[];if(!s){s=n.types.callExpression(r,[t]);return}if(b){if(e){s.arguments.push(t)}return}s=n.types.callExpression(n.types.cloneNode(r),[s,...e?[n.types.objectExpression([]),t]:[]])}for(const t of e.node.properties){if(n.types.isSpreadElement(t)){make();s.arguments.push(t.argument)}else{a.push(t)}}if(a.length)make();e.replaceWith(s)}}}}));t["default"]=u},5732:(e,t,r)=>{e.exports=r(5880)},8711:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},4195:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6970);var a=r(7452);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-optional-catch-binding",inherits:a.default,visitor:{CatchClause(e){if(!e.node.param){const t=e.scope.generateUidIdentifier("unused");const r=e.get("param");r.replaceWith(t)}}}}}));t["default"]=n},6970:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7490:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(2262);var a=r(79);var n=r(8304);var o=r(5480);function _interopDefaultLegacy(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var i=_interopDefaultLegacy(a);function willPathCastToBoolean(e){const t=findOutermostTransparentParent(e);const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}function findOutermostTransparentParent(e){let t=e;e.findParent((e=>{if(!o.isTransparentExprWrapper(e))return true;t=e}));return t}const{ast:l}=n.template.expression;function isSimpleMemberExpression(e){e=o.skipTransparentExprWrappers(e);return n.types.isIdentifier(e)||n.types.isSuper(e)||n.types.isMemberExpression(e)&&!e.computed&&isSimpleMemberExpression(e.object)}function needsMemoize(e){let t=e;const{scope:r}=e;while(t.isOptionalMemberExpression()||t.isOptionalCallExpression()){const{node:e}=t;const s=t.isOptionalMemberExpression()?"object":"callee";const a=o.skipTransparentExprWrappers(t.get(s));if(e.optional){return!r.isStatic(a.node)}t=a}}function transform(e,{pureGetters:t,noDocumentAll:r}){const{scope:s}=e;const a=findOutermostTransparentParent(e);const{parentPath:i}=a;const c=willPathCastToBoolean(a);let u=false;const p=i.isCallExpression({callee:a.node})&&e.isOptionalMemberExpression();const d=[];let f=e;if(s.path.isPattern()&&needsMemoize(f)){e.replaceWith(n.template.ast`(() => ${e.node})()`);return}while(f.isOptionalMemberExpression()||f.isOptionalCallExpression()){const{node:e}=f;if(e.optional){d.push(e)}if(f.isOptionalMemberExpression()){f.node.type="MemberExpression";f=o.skipTransparentExprWrappers(f.get("object"))}else if(f.isOptionalCallExpression()){f.node.type="CallExpression";f=o.skipTransparentExprWrappers(f.get("callee"))}}let m=e;if(i.isUnaryExpression({operator:"delete"})){m=i;u=true}for(let e=d.length-1;e>=0;e--){const a=d[e];const i=n.types.isCallExpression(a);const f=i?"callee":"object";const g=a[f];let h=g;while(o.isTransparentExprWrapper(h)){h=h.expression}let b;let x;if(i&&n.types.isIdentifier(h,{name:"eval"})){x=b=h;a[f]=n.types.sequenceExpression([n.types.numericLiteral(0),b])}else if(t&&i&&isSimpleMemberExpression(h)){x=b=g}else{b=s.maybeGenerateMemoised(h);if(b){x=n.types.assignmentExpression("=",n.types.cloneNode(b),g);a[f]=b}else{x=b=g}}if(i&&n.types.isMemberExpression(h)){if(t&&isSimpleMemberExpression(h)){a.callee=g}else{const{object:e}=h;let t=s.maybeGenerateMemoised(e);if(t){h.object=n.types.assignmentExpression("=",t,e)}else if(n.types.isSuper(e)){t=n.types.thisExpression()}else{t=e}a.arguments.unshift(n.types.cloneNode(t));a.callee=n.types.memberExpression(a.callee,n.types.identifier("call"))}}let v=m.node;if(e===0&&p){var y;const e=o.skipTransparentExprWrappers(m.get("object")).node;let r;if(!t||!isSimpleMemberExpression(e)){r=s.maybeGenerateMemoised(e);if(r){v.object=n.types.assignmentExpression("=",r,e)}}v=n.types.callExpression(n.types.memberExpression(v,n.types.identifier("bind")),[n.types.cloneNode((y=r)!=null?y:e)])}if(c){const e=r?l`${n.types.cloneNode(x)} != null`:l` ${n.types.cloneNode(x)} !== null && ${n.types.cloneNode(b)} !== void 0`;m.replaceWith(n.types.logicalExpression("&&",e,v));m=o.skipTransparentExprWrappers(m.get("right"))}else{const e=r?l`${n.types.cloneNode(x)} == null`:l` - ${n.types.cloneNode(x)} === null || ${n.types.cloneNode(b)} === void 0`;const t=u?l`true`:l`void 0`;m.replaceWith(n.types.conditionalExpression(e,t,v));m=o.skipTransparentExprWrappers(m.get("alternate"))}}}var c=s.declare(((e,t)=>{var r,s;e.assertVersion(7);const{loose:a=false}=t;const n=(r=e.assumption("noDocumentAll"))!=null?r:a;const o=(s=e.assumption("pureGetters"))!=null?s:a;return{name:"proposal-optional-chaining",inherits:i["default"].default,visitor:{"OptionalCallExpression|OptionalMemberExpression"(e){transform(e,{noDocumentAll:n,pureGetters:o})}}}}));t["default"]=c;t.transform=transform},2262:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9062:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(1667);var a=r(6758);var n=(0,s.declare)(((e,t)=>{e.assertVersion(7);return(0,a.createClassFeaturePlugin)({name:"proposal-private-methods",api:e,feature:a.FEATURES.privateMethods,loose:t.loose,manipulateOptions(e,t){t.plugins.push("classPrivateMethods")}})}));t["default"]=n},1667:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},2074:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-dynamic-import",manipulateOptions(e,t){t.plugins.push("dynamicImport")}}}));t["default"]=a},1454:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-export-namespace-from",manipulateOptions(e,t){t.plugins.push("exportNamespaceFrom")}}}));t["default"]=a},3030:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-json-strings",manipulateOptions(e,t){t.plugins.push("jsonStrings")}}}));t["default"]=a},8926:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(4476);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-jsx",manipulateOptions(e,t){if(t.plugins.some((e=>(Array.isArray(e)?e[0]:e)==="typescript"))){return}t.plugins.push("jsx")}}}));t["default"]=a},4476:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5945:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-logical-assignment-operators",manipulateOptions(e,t){t.plugins.push("logicalAssignment")}}}));t["default"]=a},5879:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-nullish-coalescing-operator",manipulateOptions(e,t){t.plugins.push("nullishCoalescingOperator")}}}));t["default"]=a},1816:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-numeric-separator",manipulateOptions(e,t){t.plugins.push("numericSeparator")}}}));t["default"]=a},4499:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-object-rest-spread",manipulateOptions(e,t){t.plugins.push("objectRestSpread")}}}));t["default"]=a},7452:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-optional-catch-binding",manipulateOptions(e,t){t.plugins.push("optionalCatchBinding")}}}));t["default"]=a},79:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-optional-chaining",manipulateOptions(e,t){t.plugins.push("optionalChaining")}}}));t["default"]=a},4893:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3799);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-top-level-await",manipulateOptions(e,t){t.plugins.push("topLevelAwait")}}}));t["default"]=a},3799:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},513:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8845);var a=(0,s.declare)(((e,t)=>{var r;e.assertVersion(7);const s=(r=e.assumption("noNewArrows"))!=null?r:!t.spec;return{name:"transform-arrow-functions",visitor:{ArrowFunctionExpression(e){if(!e.isArrowFunctionExpression())return;e.arrowFunctionToExpression({allowInsertArrow:false,noNewArrows:s,specCompliant:!s})}}}}));t["default"]=a},8845:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},6413:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9203);var a=r(7120);var n=r(9115);var o=r(8304);var i=(0,s.declare)(((e,t)=>{e.assertVersion(7);const{method:r,module:s}=t;const i=e.assumption("noNewArrows");if(r&&s){return{name:"transform-async-to-generator",visitor:{Function(e,t){if(!e.node.async||e.node.generator)return;let l=t.methodWrapper;if(l){l=o.types.cloneNode(l)}else{l=t.methodWrapper=(0,n.addNamed)(e,r,s)}(0,a.default)(e,{wrapAsync:l},i)}}}}return{name:"transform-async-to-generator",visitor:{Function(e,t){if(!e.node.async||e.node.generator)return;(0,a.default)(e,{wrapAsync:t.addHelper("asyncToGenerator")},i)}}}}));t["default"]=i},9203:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8363:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6014);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);function statementList(e,t){const r=t.get(e);for(const e of r){const t=e.node;if(!e.isFunctionDeclaration())continue;const r=a.types.variableDeclaration("let",[a.types.variableDeclarator(t.id,a.types.toExpression(t))]);r._blockHoist=2;t.id=null;e.replaceWith(r)}}return{name:"transform-block-scoped-functions",visitor:{BlockStatement(e){const{node:t,parent:r}=e;if(a.types.isFunction(r,{body:t})||a.types.isExportDeclaration(r)){return}statementList("body",e)},SwitchCase(e){statementList("consequent",e)}}}}));t["default"]=n},6014:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1630:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8723);var a=r(4642);var n=r(8304);const o=new WeakSet;var i=(0,s.declare)(((e,t)=>{e.assertVersion(7);const{throwIfClosureRequired:r=false,tdz:s=false}=t;if(typeof r!=="boolean"){throw new Error(`.throwIfClosureRequired must be a boolean, or undefined`)}if(typeof s!=="boolean"){throw new Error(`.tdz must be a boolean, or undefined`)}return{name:"transform-block-scoping",visitor:{VariableDeclaration(e){const{node:t,parent:r,scope:s}=e;if(!isBlockScoped(t))return;convertBlockScopedToVar(e,null,r,s,true);if(t._tdzThis){const r=[t];for(let e=0;ee.isLoop()||e.isFunction()));return t==null?void 0:t.isLoop()}function convertBlockScopedToVar(e,t,r,s,a=false){if(!t){t=e.node}if(isInLoop(e)&&!n.types.isFor(r)){for(let e=0;e0){e.traverse(u,t)}else{e.traverse(a.visitor,t)}return e.skip()}},a.visitor]);const u=n.traverse.visitors.merge([{ReferencedIdentifier(e,t){const r=t.letReferences.get(e.node.name);if(!r)return;const s=e.scope.getBindingIdentifier(e.node.name);if(s&&s!==r)return;t.closurify=true}},a.visitor]);const p={enter(e,t){const{node:r,parent:s}=e;if(e.isForStatement()){if(isVar(r.init,r)){const e=t.pushDeclar(r.init);if(e.length===1){r.init=e[0]}else{r.init=n.types.sequenceExpression(e)}}}else if(e.isFor()){if(isVar(r.left,r)){t.pushDeclar(r.left);r.left=r.left.declarations[0].id}}else if(isVar(r,s)){e.replaceWithMultiple(t.pushDeclar(r).map((e=>n.types.expressionStatement(e))))}else if(e.isFunction()){return e.skip()}}};const f={LabeledStatement({node:e},t){t.innerLabels.push(e.label.name)}};const d={enter(e,t){if(e.isAssignmentExpression()||e.isUpdateExpression()){for(const r of Object.keys(e.getBindingIdentifiers())){if(t.outsideReferences.get(r)!==e.scope.getBindingIdentifier(r)){continue}t.reassignments[r]=true}}else if(e.isReturnStatement()){t.returnStatements.push(e)}}};function loopNodeTo(e){if(n.types.isBreakStatement(e)){return"break"}else if(n.types.isContinueStatement(e)){return"continue"}}const m={Loop(e,t){const r=t.ignoreLabeless;t.ignoreLabeless=true;e.traverse(m,t);t.ignoreLabeless=r;e.skip()},Function(e){e.skip()},SwitchCase(e,t){const r=t.inSwitchCase;t.inSwitchCase=true;e.traverse(m,t);t.inSwitchCase=r;e.skip()},"BreakStatement|ContinueStatement|ReturnStatement"(e,t){const{node:r,scope:s}=e;if(r[this.LOOP_IGNORE])return;let a;let o=loopNodeTo(r);if(o){if(r.label){if(t.innerLabels.indexOf(r.label.name)>=0){return}o=`${o}|${r.label.name}`}else{if(t.ignoreLabeless)return;if(n.types.isBreakStatement(r)&&t.inSwitchCase)return}t.hasBreakContinue=true;t.map[o]=r;a=n.types.stringLiteral(o)}if(e.isReturnStatement()){t.hasReturn=true;a=n.types.objectExpression([n.types.objectProperty(n.types.identifier("v"),r.argument||s.buildUndefinedNode())])}if(a){a=n.types.returnStatement(a);a[this.LOOP_IGNORE]=true;e.skip();e.replaceWith(n.types.inherits(a,r))}}};function isStrict(e){return!!e.find((({node:e})=>{if(n.types.isProgram(e)){if(e.sourceType==="module")return true}else if(!n.types.isBlockStatement(e))return false;return e.directives.some((e=>e.value.value==="use strict"))}))}class BlockScoping{constructor(e,t,r,s,a,o,i){this.parent=r;this.scope=s;this.state=i;this.throwIfClosureRequired=a;this.tdzEnabled=o;this.blockPath=t;this.block=t.node;this.outsideLetReferences=new Map;this.hasLetReferences=false;this.letReferences=new Map;this.body=[];if(e){this.loopParent=e.parent;this.loopLabel=n.types.isLabeledStatement(this.loopParent)&&this.loopParent.label;this.loopPath=e;this.loop=e.node}}run(){const e=this.block;if(o.has(e))return;o.add(e);const t=this.getLetReferences();this.checkConstants();if(n.types.isFunction(this.parent)||n.types.isProgram(this.block)){this.updateScopeInfo();return}if(!this.hasLetReferences)return;if(t){this.wrapClosure()}else{this.remap()}this.updateScopeInfo(t);if(this.loopLabel&&!n.types.isLabeledStatement(this.loopParent)){return n.types.labeledStatement(this.loopLabel,this.loop)}}checkConstants(){const e=this.scope;const t=this.state;for(const r of Object.keys(e.bindings)){const s=e.bindings[r];if(s.kind!=="const")continue;for(const e of s.constantViolations){const s=t.addHelper("readOnlyError");const a=n.types.callExpression(s,[n.types.stringLiteral(r)]);if(e.isAssignmentExpression()){const{operator:t}=e.node;if(t==="="){e.replaceWith(n.types.sequenceExpression([e.get("right").node,a]))}else if(["&&=","||=","??="].includes(t)){e.replaceWith(n.types.logicalExpression(t.slice(0,-1),e.get("left").node,n.types.sequenceExpression([e.get("right").node,a])))}else{e.replaceWith(n.types.sequenceExpression([n.types.binaryExpression(t.slice(0,-1),e.get("left").node,e.get("right").node),a]))}}else if(e.isUpdateExpression()){e.replaceWith(n.types.sequenceExpression([n.types.unaryExpression("+",e.get("argument").node),a]))}else if(e.isForXStatement()){e.ensureBlock();e.get("left").replaceWith(n.types.variableDeclaration("var",[n.types.variableDeclarator(e.scope.generateUidIdentifier(r))]));e.node.body.body.unshift(n.types.expressionStatement(a))}}}}updateScopeInfo(e){const t=this.blockPath.scope;const r=t.getFunctionParent()||t.getProgramParent();const s=this.letReferences;for(const a of s.keys()){const n=s.get(a);const o=t.getBinding(n.name);if(!o)continue;if(o.kind==="let"||o.kind==="const"){o.kind="var";if(e){if(t.hasOwnBinding(n.name)){t.removeBinding(n.name)}}else{t.moveBindingTo(n.name,r)}}}}remap(){const e=this.letReferences;const t=this.outsideLetReferences;const r=this.scope;const s=this.blockPath.scope;for(const t of e.keys()){const a=e.get(t);if(r.parentHasBinding(t)||r.hasGlobal(t)){const e=r.getOwnBinding(t);if(e){const s=r.parent.getOwnBinding(t);if(e.kind==="hoisted"&&!e.path.node.async&&!e.path.node.generator&&(!s||isVar(s.path.parent))&&!isStrict(e.path.parentPath)){continue}r.rename(a.name)}if(s.hasOwnBinding(t)){s.rename(a.name)}}}for(const r of t.keys()){const t=e.get(r);if(isInLoop(this.blockPath)&&s.hasOwnBinding(r)){s.rename(t.name)}}}wrapClosure(){if(this.throwIfClosureRequired){throw this.blockPath.buildCodeFrameError("Compiling let/const in this block would add a closure "+"(throwIfClosureRequired).")}const e=this.block;const t=this.outsideLetReferences;if(this.loop){for(const e of Array.from(t.keys())){const r=t.get(e);if(this.scope.hasGlobal(r.name)||this.scope.parentHasBinding(r.name)){t.delete(r.name);this.letReferences.delete(r.name);this.scope.rename(r.name);this.letReferences.set(r.name,r);t.set(r.name,r)}}}this.has=this.checkLoop();this.hoistVarDeclarations();const r=Array.from(t.values(),(e=>n.types.cloneNode(e)));const s=r.map((e=>n.types.cloneNode(e)));const a=this.blockPath.isSwitchStatement();const o=n.types.functionExpression(null,s,n.types.blockStatement(a?[e]:e.body));this.addContinuations(o);let i=n.types.callExpression(n.types.nullLiteral(),r);let l=".callee";const c=n.traverse.hasType(o.body,"YieldExpression",n.types.FUNCTION_TYPES);if(c){o.generator=true;i=n.types.yieldExpression(i,true);l=".argument"+l}const u=n.traverse.hasType(o.body,"AwaitExpression",n.types.FUNCTION_TYPES);if(u){o.async=true;i=n.types.awaitExpression(i);l=".argument"+l}let p;let f;if(this.has.hasReturn||this.has.hasBreakContinue){const e=this.scope.generateUid("ret");this.body.push(n.types.variableDeclaration("var",[n.types.variableDeclarator(n.types.identifier(e),i)]));p="declarations.0.init"+l;f=this.body.length-1;this.buildHas(e)}else{this.body.push(n.types.expressionStatement(i));p="expression"+l;f=this.body.length-1}let d;if(a){const{parentPath:e,listKey:t,key:r}=this.blockPath;this.blockPath.replaceWithMultiple(this.body);d=e.get(t)[r+f]}else{e.body=this.body;d=this.blockPath.get("body")[f]}const m=d.get(p);let y;if(this.loop){const e=this.scope.generateUid("loop");const t=this.loopPath.insertBefore(n.types.variableDeclaration("var",[n.types.variableDeclarator(n.types.identifier(e),o)]));m.replaceWith(n.types.identifier(e));y=t[0].get("declarations.0.init")}else{m.replaceWith(o);y=m}y.unwrapFunctionEnvironment()}addContinuations(e){const t={reassignments:{},returnStatements:[],outsideReferences:this.outsideLetReferences};this.scope.traverse(e,d,t);for(let r=0;r{e.insertBefore(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.identifier(a),n.types.identifier(o))))}));e.body.body.push(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.identifier(a),n.types.identifier(o))))}}getLetReferences(){const e=this.block;const t=[];if(this.loop){const e=this.loop.left||this.loop.init;if(isBlockScoped(e)){t.push(e);const r=n.types.getBindingIdentifiers(e);for(const e of Object.keys(r)){this.outsideLetReferences.set(e,r[e])}}}const addDeclarationsFromChild=(r,s)=>{s=s||r.node;if(n.types.isClassDeclaration(s)||n.types.isFunctionDeclaration(s)||isBlockScoped(s)){if(isBlockScoped(s)){convertBlockScopedToVar(r,s,e,this.scope)}if(s.declarations){for(let e=0;ethis.state.addHelper(e)};if(isInLoop(this.blockPath)){r.loopDepth++}this.blockPath.traverse(c,r);return r.closurify}checkLoop(){const e={hasBreakContinue:false,ignoreLabeless:false,inSwitchCase:false,innerLabels:[],hasReturn:false,isLoop:!!this.loop,map:{},LOOP_IGNORE:Symbol()};this.blockPath.traverse(f,e);this.blockPath.traverse(m,e);return e}hoistVarDeclarations(){this.blockPath.traverse(p,this)}pushDeclar(e){const t=[];const r=n.types.getBindingIdentifiers(e);for(const e of Object.keys(r)){t.push(n.types.variableDeclarator(r[e]))}this.body.push(n.types.variableDeclaration(e.kind,t));const s=[];for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.visitor=void 0;var s=r(8304);function getTDZStatus(e,t){const r=t._guessExecutionStatusRelativeTo(e);if(r==="before"){return"outside"}else if(r==="after"){return"inside"}else{return"maybe"}}function buildTDZAssert(e,t){return s.types.callExpression(t.addHelper("temporalRef"),[e,s.types.stringLiteral(e.name)])}function isReference(e,t,r){const s=r.letReferences.get(e.name);if(!s)return false;return t.getBindingIdentifier(e.name)===s}const a=new WeakSet;const n={ReferencedIdentifier(e,t){if(!t.tdzEnabled)return;const{node:r,parent:n,scope:o}=e;if(e.parentPath.isFor({left:r}))return;if(!isReference(r,o,t))return;const i=o.getBinding(r.name).path;if(i.isFunctionDeclaration())return;const l=getTDZStatus(e,i);if(l==="outside")return;if(l==="maybe"){if(a.has(r)){return}a.add(r);const o=buildTDZAssert(r,t);i.parent._tdzThis=true;if(e.parentPath.isUpdateExpression()){if(n._ignoreBlockScopingTDZ)return;e.parentPath.replaceWith(s.types.sequenceExpression([o,n]))}else{e.replaceWith(o)}}else if(l==="inside"){e.replaceWith(s.template.ast`${t.addHelper("tdz")}("${r.name}")`)}},AssignmentExpression:{exit(e,t){if(!t.tdzEnabled)return;const{node:r}=e;if(r._ignoreBlockScopingTDZ)return;const a=[];const n=e.getBindingIdentifiers();for(const r of Object.keys(n)){const s=n[r];if(isReference(s,e.scope,t)){a.push(s)}}if(a.length){r._ignoreBlockScopingTDZ=true;a.push(r);e.replaceWithMultiple(a.map((e=>s.types.expressionStatement(e))))}}}};t.visitor=n},8723:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8120:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8432);var a=r(8304);var n=(0,s.declare)(((e,t)=>{var r;e.assertVersion(7);const s=(r=e.assumption("setComputedProperties"))!=null?r:t.loose;const n=s?pushComputedPropsLoose:pushComputedPropsSpec;const o=(0,a.template)(`\n MUTATOR_MAP_REF[KEY] = MUTATOR_MAP_REF[KEY] || {};\n MUTATOR_MAP_REF[KEY].KIND = VALUE;\n `);function getValue(e){if(a.types.isObjectProperty(e)){return e.value}else if(a.types.isObjectMethod(e)){return a.types.functionExpression(null,e.params,e.body,e.generator,e.async)}}function pushAssign(e,t,r){if(t.kind==="get"&&t.kind==="set"){pushMutatorDefine(e,t,r)}else{r.push(a.types.expressionStatement(a.types.assignmentExpression("=",a.types.memberExpression(a.types.cloneNode(e),t.key,t.computed||a.types.isLiteral(t.key)),getValue(t))))}}function pushMutatorDefine({body:e,getMutatorId:t,scope:r},s){let n=!s.computed&&a.types.isIdentifier(s.key)?a.types.stringLiteral(s.key.name):s.key;const i=r.maybeGenerateMemoised(n);if(i){e.push(a.types.expressionStatement(a.types.assignmentExpression("=",i,n)));n=i}e.push(...o({MUTATOR_MAP_REF:t(),KEY:a.types.cloneNode(n),VALUE:getValue(s),KIND:a.types.identifier(s.kind)}))}function pushComputedPropsLoose(e){for(const t of e.computedProps){if(t.kind==="get"||t.kind==="set"){pushMutatorDefine(e,t)}else{pushAssign(a.types.cloneNode(e.objId),t,e.body)}}}function pushComputedPropsSpec(e){const{objId:t,body:r,computedProps:s,state:n}=e;for(const o of s){const i=a.types.toComputedKey(o);if(o.kind==="get"||o.kind==="set"){pushMutatorDefine(e,o)}else{if(s.length===1){return a.types.callExpression(n.addHelper("defineProperty"),[e.initPropExpression,i,getValue(o)])}else{r.push(a.types.expressionStatement(a.types.callExpression(n.addHelper("defineProperty"),[a.types.cloneNode(t),i,getValue(o)])))}}}}return{name:"transform-computed-properties",visitor:{ObjectExpression:{exit(e,t){const{node:r,parent:s,scope:o}=e;let i=false;for(const e of r.properties){i=e.computed===true;if(i)break}if(!i)return;const l=[];const c=[];let u=false;for(const e of r.properties){if(e.computed){u=true}if(u){c.push(e)}else{l.push(e)}}const p=o.generateUidIdentifierBasedOnNode(s);const f=a.types.objectExpression(l);const d=[];d.push(a.types.variableDeclaration("var",[a.types.variableDeclarator(p,f)]));let m;const getMutatorId=function(){if(!m){m=o.generateUidIdentifier("mutatorMap");d.push(a.types.variableDeclaration("var",[a.types.variableDeclarator(m,a.types.objectExpression([]))]))}return a.types.cloneNode(m)};const y=n({scope:o,objId:p,body:d,computedProps:c,initPropExpression:f,getMutatorId:getMutatorId,state:t});if(m){d.push(a.types.expressionStatement(a.types.callExpression(t.addHelper("defineEnumerableProperties"),[a.types.cloneNode(p),a.types.cloneNode(m)])))}if(y){e.replaceWith(y)}else{d.push(a.types.expressionStatement(a.types.cloneNode(p)));e.replaceWithMultiple(d)}}}}}}));t["default"]=n},8432:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7850:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(4050);var a=r(8304);function getName(e){if(a.types.isIdentifier(e)){return e.name}return e.value.toString()}var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-duplicate-keys",visitor:{ObjectExpression(e){const{node:t}=e;const r=t.properties.filter((e=>!a.types.isSpreadElement(e)&&!e.computed));const s=Object.create(null);const n=Object.create(null);const o=Object.create(null);for(const e of r){const t=getName(e.key);let r=false;switch(e.kind){case"get":if(s[t]||n[t]){r=true}n[t]=true;break;case"set":if(s[t]||o[t]){r=true}o[t]=true;break;default:if(s[t]||n[t]||o[t]){r=true}s[t]=true}if(r){e.computed=true;e.key=a.types.stringLiteral(t)}}}}}}));t["default"]=n},4050:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1176:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3651);var a=r(6951);var n=r(8304);var o=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-exponentiation-operator",visitor:(0,a.default)({operator:"**",build(e,t){return n.types.callExpression(n.types.memberExpression(n.types.identifier("Math"),n.types.identifier("pow")),[e,t])}})}}));t["default"]=o},3651:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9488:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(2388);var a=r(8304);var n=r(8591);var o=(0,s.declare)(((e,t)=>{var r,s,o;e.assertVersion(7);{const{assumeArray:r,allowArrayLike:s,loose:a}=t;if(a===true&&r===true){throw new Error(`The loose and assumeArray options cannot be used together in @babel/plugin-transform-for-of`)}if(r===true&&s===true){throw new Error(`The assumeArray and allowArrayLike options cannot be used together in @babel/plugin-transform-for-of`)}if(s&&/^7\.\d\./.test(e.version)){throw new Error(`The allowArrayLike is only supported when using @babel/core@^7.10.0`)}}const i=(r=t.assumeArray)!=null?r:!t.loose&&e.assumption("iterableIsArray");const l=(s=t.allowArrayLike)!=null?s:e.assumption("arrayLikeIsIterable");const c=(o=e.assumption("skipForOfIteratorClosing"))!=null?o:t.loose;if(i&&l){throw new Error(`The "iterableIsArray" and "arrayLikeIsIterable" assumptions are not compatible.`)}if(i){return{name:"transform-for-of",visitor:{ForOfStatement(e){const{scope:t}=e;const{left:r,right:s,await:n}=e.node;if(n){return}const o=t.generateUidIdentifier("i");let i=t.maybeGenerateMemoised(s,true);const l=[a.types.variableDeclarator(o,a.types.numericLiteral(0))];if(i){l.push(a.types.variableDeclarator(i,s))}else{i=s}const c=a.types.memberExpression(a.types.cloneNode(i),a.types.cloneNode(o),true);let u;if(a.types.isVariableDeclaration(r)){u=r;u.declarations[0].init=c}else{u=a.types.expressionStatement(a.types.assignmentExpression("=",r,c))}let p;const f=e.get("body");if(f.isBlockStatement()&&Object.keys(e.getBindingIdentifiers()).some((e=>f.scope.hasOwnBinding(e)))){p=a.types.blockStatement([u,f.node])}else{p=a.types.toBlock(f.node);p.body.unshift(u)}e.replaceWith(a.types.forStatement(a.types.variableDeclaration("let",l),a.types.binaryExpression("<",a.types.cloneNode(o),a.types.memberExpression(a.types.cloneNode(i),a.types.identifier("length"))),a.types.updateExpression("++",a.types.cloneNode(o)),p))}}}}const u=(0,a.template)` + ${n.types.cloneNode(x)} === null || ${n.types.cloneNode(b)} === void 0`;const t=u?l`true`:l`void 0`;m.replaceWith(n.types.conditionalExpression(e,t,v));m=o.skipTransparentExprWrappers(m.get("alternate"))}}}var c=s.declare(((e,t)=>{var r,s;e.assertVersion(7);const{loose:a=false}=t;const n=(r=e.assumption("noDocumentAll"))!=null?r:a;const o=(s=e.assumption("pureGetters"))!=null?s:a;return{name:"proposal-optional-chaining",inherits:i["default"].default,visitor:{"OptionalCallExpression|OptionalMemberExpression"(e){transform(e,{noDocumentAll:n,pureGetters:o})}}}}));t["default"]=c;t.transform=transform},2262:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9062:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(1667);var a=r(6758);var n=(0,s.declare)(((e,t)=>{e.assertVersion(7);return(0,a.createClassFeaturePlugin)({name:"proposal-private-methods",api:e,feature:a.FEATURES.privateMethods,loose:t.loose,manipulateOptions(e,t){t.plugins.push("classPrivateMethods")}})}));t["default"]=n},1667:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},2074:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-dynamic-import",manipulateOptions(e,t){t.plugins.push("dynamicImport")}}}));t["default"]=a},1454:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-export-namespace-from",manipulateOptions(e,t){t.plugins.push("exportNamespaceFrom")}}}));t["default"]=a},3030:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-json-strings",manipulateOptions(e,t){t.plugins.push("jsonStrings")}}}));t["default"]=a},8926:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(4476);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-jsx",manipulateOptions(e,t){if(t.plugins.some((e=>(Array.isArray(e)?e[0]:e)==="typescript"))){return}t.plugins.push("jsx")}}}));t["default"]=a},4476:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5945:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-logical-assignment-operators",manipulateOptions(e,t){t.plugins.push("logicalAssignment")}}}));t["default"]=a},5879:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-nullish-coalescing-operator",manipulateOptions(e,t){t.plugins.push("nullishCoalescingOperator")}}}));t["default"]=a},1816:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-numeric-separator",manipulateOptions(e,t){t.plugins.push("numericSeparator")}}}));t["default"]=a},4499:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-object-rest-spread",manipulateOptions(e,t){t.plugins.push("objectRestSpread")}}}));t["default"]=a},7452:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-optional-catch-binding",manipulateOptions(e,t){t.plugins.push("optionalCatchBinding")}}}));t["default"]=a},79:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-optional-chaining",manipulateOptions(e,t){t.plugins.push("optionalChaining")}}}));t["default"]=a},4893:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3799);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-top-level-await",manipulateOptions(e,t){t.plugins.push("topLevelAwait")}}}));t["default"]=a},3799:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},513:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8845);var a=(0,s.declare)(((e,t)=>{var r;e.assertVersion(7);const s=(r=e.assumption("noNewArrows"))!=null?r:!t.spec;return{name:"transform-arrow-functions",visitor:{ArrowFunctionExpression(e){if(!e.isArrowFunctionExpression())return;e.arrowFunctionToExpression({allowInsertArrow:false,noNewArrows:s,specCompliant:!s})}}}}));t["default"]=a},8845:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},6413:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9203);var a=r(7120);var n=r(6039);var o=r(8304);var i=(0,s.declare)(((e,t)=>{e.assertVersion(7);const{method:r,module:s}=t;const i=e.assumption("noNewArrows");if(r&&s){return{name:"transform-async-to-generator",visitor:{Function(e,t){if(!e.node.async||e.node.generator)return;let l=t.methodWrapper;if(l){l=o.types.cloneNode(l)}else{l=t.methodWrapper=(0,n.addNamed)(e,r,s)}(0,a.default)(e,{wrapAsync:l},i)}}}}return{name:"transform-async-to-generator",visitor:{Function(e,t){if(!e.node.async||e.node.generator)return;(0,a.default)(e,{wrapAsync:t.addHelper("asyncToGenerator")},i)}}}}));t["default"]=i},9203:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8363:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6014);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);function statementList(e,t){const r=t.get(e);for(const e of r){const t=e.node;if(!e.isFunctionDeclaration())continue;const r=a.types.variableDeclaration("let",[a.types.variableDeclarator(t.id,a.types.toExpression(t))]);r._blockHoist=2;t.id=null;e.replaceWith(r)}}return{name:"transform-block-scoped-functions",visitor:{BlockStatement(e){const{node:t,parent:r}=e;if(a.types.isFunction(r,{body:t})||a.types.isExportDeclaration(r)){return}statementList("body",e)},SwitchCase(e){statementList("consequent",e)}}}}));t["default"]=n},6014:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1630:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8723);var a=r(4642);var n=r(8304);const o=new WeakSet;var i=(0,s.declare)(((e,t)=>{e.assertVersion(7);const{throwIfClosureRequired:r=false,tdz:s=false}=t;if(typeof r!=="boolean"){throw new Error(`.throwIfClosureRequired must be a boolean, or undefined`)}if(typeof s!=="boolean"){throw new Error(`.tdz must be a boolean, or undefined`)}return{name:"transform-block-scoping",visitor:{VariableDeclaration(e){const{node:t,parent:r,scope:s}=e;if(!isBlockScoped(t))return;convertBlockScopedToVar(e,null,r,s,true);if(t._tdzThis){const r=[t];for(let e=0;ee.isLoop()||e.isFunction()));return t==null?void 0:t.isLoop()}function convertBlockScopedToVar(e,t,r,s,a=false){if(!t){t=e.node}if(isInLoop(e)&&!n.types.isFor(r)){for(let e=0;e0){e.traverse(u,t)}else{e.traverse(a.visitor,t)}return e.skip()}},a.visitor]);const u=n.traverse.visitors.merge([{ReferencedIdentifier(e,t){const r=t.letReferences.get(e.node.name);if(!r)return;const s=e.scope.getBindingIdentifier(e.node.name);if(s&&s!==r)return;t.closurify=true}},a.visitor]);const p={enter(e,t){const{node:r,parent:s}=e;if(e.isForStatement()){if(isVar(r.init,r)){const e=t.pushDeclar(r.init);if(e.length===1){r.init=e[0]}else{r.init=n.types.sequenceExpression(e)}}}else if(e.isFor()){if(isVar(r.left,r)){t.pushDeclar(r.left);r.left=r.left.declarations[0].id}}else if(isVar(r,s)){e.replaceWithMultiple(t.pushDeclar(r).map((e=>n.types.expressionStatement(e))))}else if(e.isFunction()){return e.skip()}}};const d={LabeledStatement({node:e},t){t.innerLabels.push(e.label.name)}};const f={enter(e,t){if(e.isAssignmentExpression()||e.isUpdateExpression()){for(const r of Object.keys(e.getBindingIdentifiers())){if(t.outsideReferences.get(r)!==e.scope.getBindingIdentifier(r)){continue}t.reassignments[r]=true}}else if(e.isReturnStatement()){t.returnStatements.push(e)}}};function loopNodeTo(e){if(n.types.isBreakStatement(e)){return"break"}else if(n.types.isContinueStatement(e)){return"continue"}}const m={Loop(e,t){const r=t.ignoreLabeless;t.ignoreLabeless=true;e.traverse(m,t);t.ignoreLabeless=r;e.skip()},Function(e){e.skip()},SwitchCase(e,t){const r=t.inSwitchCase;t.inSwitchCase=true;e.traverse(m,t);t.inSwitchCase=r;e.skip()},"BreakStatement|ContinueStatement|ReturnStatement"(e,t){const{node:r,scope:s}=e;if(r[this.LOOP_IGNORE])return;let a;let o=loopNodeTo(r);if(o){if(r.label){if(t.innerLabels.indexOf(r.label.name)>=0){return}o=`${o}|${r.label.name}`}else{if(t.ignoreLabeless)return;if(n.types.isBreakStatement(r)&&t.inSwitchCase)return}t.hasBreakContinue=true;t.map[o]=r;a=n.types.stringLiteral(o)}if(e.isReturnStatement()){t.hasReturn=true;a=n.types.objectExpression([n.types.objectProperty(n.types.identifier("v"),r.argument||s.buildUndefinedNode())])}if(a){a=n.types.returnStatement(a);a[this.LOOP_IGNORE]=true;e.skip();e.replaceWith(n.types.inherits(a,r))}}};function isStrict(e){return!!e.find((({node:e})=>{if(n.types.isProgram(e)){if(e.sourceType==="module")return true}else if(!n.types.isBlockStatement(e))return false;return e.directives.some((e=>e.value.value==="use strict"))}))}class BlockScoping{constructor(e,t,r,s,a,o,i){this.parent=r;this.scope=s;this.state=i;this.throwIfClosureRequired=a;this.tdzEnabled=o;this.blockPath=t;this.block=t.node;this.outsideLetReferences=new Map;this.hasLetReferences=false;this.letReferences=new Map;this.body=[];if(e){this.loopParent=e.parent;this.loopLabel=n.types.isLabeledStatement(this.loopParent)&&this.loopParent.label;this.loopPath=e;this.loop=e.node}}run(){const e=this.block;if(o.has(e))return;o.add(e);const t=this.getLetReferences();this.checkConstants();if(n.types.isFunction(this.parent)||n.types.isProgram(this.block)){this.updateScopeInfo();return}if(!this.hasLetReferences)return;if(t){this.wrapClosure()}else{this.remap()}this.updateScopeInfo(t);if(this.loopLabel&&!n.types.isLabeledStatement(this.loopParent)){return n.types.labeledStatement(this.loopLabel,this.loop)}}checkConstants(){const e=this.scope;const t=this.state;for(const r of Object.keys(e.bindings)){const s=e.bindings[r];if(s.kind!=="const")continue;for(const e of s.constantViolations){const s=t.addHelper("readOnlyError");const a=n.types.callExpression(s,[n.types.stringLiteral(r)]);if(e.isAssignmentExpression()){const{operator:t}=e.node;if(t==="="){e.replaceWith(n.types.sequenceExpression([e.get("right").node,a]))}else if(["&&=","||=","??="].includes(t)){e.replaceWith(n.types.logicalExpression(t.slice(0,-1),e.get("left").node,n.types.sequenceExpression([e.get("right").node,a])))}else{e.replaceWith(n.types.sequenceExpression([n.types.binaryExpression(t.slice(0,-1),e.get("left").node,e.get("right").node),a]))}}else if(e.isUpdateExpression()){e.replaceWith(n.types.sequenceExpression([n.types.unaryExpression("+",e.get("argument").node),a]))}else if(e.isForXStatement()){e.ensureBlock();e.get("left").replaceWith(n.types.variableDeclaration("var",[n.types.variableDeclarator(e.scope.generateUidIdentifier(r))]));e.node.body.body.unshift(n.types.expressionStatement(a))}}}}updateScopeInfo(e){const t=this.blockPath.scope;const r=t.getFunctionParent()||t.getProgramParent();const s=this.letReferences;for(const a of s.keys()){const n=s.get(a);const o=t.getBinding(n.name);if(!o)continue;if(o.kind==="let"||o.kind==="const"){o.kind="var";if(e){if(t.hasOwnBinding(n.name)){t.removeBinding(n.name)}}else{t.moveBindingTo(n.name,r)}}}}remap(){const e=this.letReferences;const t=this.outsideLetReferences;const r=this.scope;const s=this.blockPath.scope;for(const t of e.keys()){const a=e.get(t);if(r.parentHasBinding(t)||r.hasGlobal(t)){const e=r.getOwnBinding(t);if(e){const s=r.parent.getOwnBinding(t);if(e.kind==="hoisted"&&!e.path.node.async&&!e.path.node.generator&&(!s||isVar(s.path.parent))&&!isStrict(e.path.parentPath)){continue}r.rename(a.name)}if(s.hasOwnBinding(t)){s.rename(a.name)}}}for(const r of t.keys()){const t=e.get(r);if(isInLoop(this.blockPath)&&s.hasOwnBinding(r)){s.rename(t.name)}}}wrapClosure(){if(this.throwIfClosureRequired){throw this.blockPath.buildCodeFrameError("Compiling let/const in this block would add a closure "+"(throwIfClosureRequired).")}const e=this.block;const t=this.outsideLetReferences;if(this.loop){for(const e of Array.from(t.keys())){const r=t.get(e);if(this.scope.hasGlobal(r.name)||this.scope.parentHasBinding(r.name)){t.delete(r.name);this.letReferences.delete(r.name);this.scope.rename(r.name);this.letReferences.set(r.name,r);t.set(r.name,r)}}}this.has=this.checkLoop();this.hoistVarDeclarations();const r=Array.from(t.values(),(e=>n.types.cloneNode(e)));const s=r.map((e=>n.types.cloneNode(e)));const a=this.blockPath.isSwitchStatement();const o=n.types.functionExpression(null,s,n.types.blockStatement(a?[e]:e.body));this.addContinuations(o);let i=n.types.callExpression(n.types.nullLiteral(),r);let l=".callee";const c=n.traverse.hasType(o.body,"YieldExpression",n.types.FUNCTION_TYPES);if(c){o.generator=true;i=n.types.yieldExpression(i,true);l=".argument"+l}const u=n.traverse.hasType(o.body,"AwaitExpression",n.types.FUNCTION_TYPES);if(u){o.async=true;i=n.types.awaitExpression(i);l=".argument"+l}let p;let d;if(this.has.hasReturn||this.has.hasBreakContinue){const e=this.scope.generateUid("ret");this.body.push(n.types.variableDeclaration("var",[n.types.variableDeclarator(n.types.identifier(e),i)]));p="declarations.0.init"+l;d=this.body.length-1;this.buildHas(e)}else{this.body.push(n.types.expressionStatement(i));p="expression"+l;d=this.body.length-1}let f;if(a){const{parentPath:e,listKey:t,key:r}=this.blockPath;this.blockPath.replaceWithMultiple(this.body);f=e.get(t)[r+d]}else{e.body=this.body;f=this.blockPath.get("body")[d]}const m=f.get(p);let y;if(this.loop){const e=this.scope.generateUid("loop");const t=this.loopPath.insertBefore(n.types.variableDeclaration("var",[n.types.variableDeclarator(n.types.identifier(e),o)]));m.replaceWith(n.types.identifier(e));y=t[0].get("declarations.0.init")}else{m.replaceWith(o);y=m}y.unwrapFunctionEnvironment()}addContinuations(e){const t={reassignments:{},returnStatements:[],outsideReferences:this.outsideLetReferences};this.scope.traverse(e,f,t);for(let r=0;r{e.insertBefore(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.identifier(a),n.types.identifier(o))))}));e.body.body.push(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.identifier(a),n.types.identifier(o))))}}getLetReferences(){const e=this.block;const t=[];if(this.loop){const e=this.loop.left||this.loop.init;if(isBlockScoped(e)){t.push(e);const r=n.types.getBindingIdentifiers(e);for(const e of Object.keys(r)){this.outsideLetReferences.set(e,r[e])}}}const addDeclarationsFromChild=(r,s)=>{s=s||r.node;if(n.types.isClassDeclaration(s)||n.types.isFunctionDeclaration(s)||isBlockScoped(s)){if(isBlockScoped(s)){convertBlockScopedToVar(r,s,e,this.scope)}if(s.declarations){for(let e=0;ethis.state.addHelper(e)};if(isInLoop(this.blockPath)){r.loopDepth++}this.blockPath.traverse(c,r);return r.closurify}checkLoop(){const e={hasBreakContinue:false,ignoreLabeless:false,inSwitchCase:false,innerLabels:[],hasReturn:false,isLoop:!!this.loop,map:{},LOOP_IGNORE:Symbol()};this.blockPath.traverse(d,e);this.blockPath.traverse(m,e);return e}hoistVarDeclarations(){this.blockPath.traverse(p,this)}pushDeclar(e){const t=[];const r=n.types.getBindingIdentifiers(e);for(const e of Object.keys(r)){t.push(n.types.variableDeclarator(r[e]))}this.body.push(n.types.variableDeclaration(e.kind,t));const s=[];for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.visitor=void 0;var s=r(8304);function getTDZStatus(e,t){const r=t._guessExecutionStatusRelativeTo(e);if(r==="before"){return"outside"}else if(r==="after"){return"inside"}else{return"maybe"}}function buildTDZAssert(e,t){return s.types.callExpression(t.addHelper("temporalRef"),[e,s.types.stringLiteral(e.name)])}function isReference(e,t,r){const s=r.letReferences.get(e.name);if(!s)return false;return t.getBindingIdentifier(e.name)===s}const a=new WeakSet;const n={ReferencedIdentifier(e,t){if(!t.tdzEnabled)return;const{node:r,parent:n,scope:o}=e;if(e.parentPath.isFor({left:r}))return;if(!isReference(r,o,t))return;const i=o.getBinding(r.name).path;if(i.isFunctionDeclaration())return;const l=getTDZStatus(e,i);if(l==="outside")return;if(l==="maybe"){if(a.has(r)){return}a.add(r);const o=buildTDZAssert(r,t);i.parent._tdzThis=true;if(e.parentPath.isUpdateExpression()){if(n._ignoreBlockScopingTDZ)return;e.parentPath.replaceWith(s.types.sequenceExpression([o,n]))}else{e.replaceWith(o)}}else if(l==="inside"){e.replaceWith(s.template.ast`${t.addHelper("tdz")}("${r.name}")`)}},AssignmentExpression:{exit(e,t){if(!t.tdzEnabled)return;const{node:r}=e;if(r._ignoreBlockScopingTDZ)return;const a=[];const n=e.getBindingIdentifiers();for(const r of Object.keys(n)){const s=n[r];if(isReference(s,e.scope,t)){a.push(s)}}if(a.length){r._ignoreBlockScopingTDZ=true;a.push(r);e.replaceWithMultiple(a.map((e=>s.types.expressionStatement(e))))}}}};t.visitor=n},8723:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8120:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8432);var a=r(8304);var n=(0,s.declare)(((e,t)=>{var r;e.assertVersion(7);const s=(r=e.assumption("setComputedProperties"))!=null?r:t.loose;const n=s?pushComputedPropsLoose:pushComputedPropsSpec;const o=(0,a.template)(`\n MUTATOR_MAP_REF[KEY] = MUTATOR_MAP_REF[KEY] || {};\n MUTATOR_MAP_REF[KEY].KIND = VALUE;\n `);function getValue(e){if(a.types.isObjectProperty(e)){return e.value}else if(a.types.isObjectMethod(e)){return a.types.functionExpression(null,e.params,e.body,e.generator,e.async)}}function pushAssign(e,t,r){if(t.kind==="get"&&t.kind==="set"){pushMutatorDefine(e,t,r)}else{r.push(a.types.expressionStatement(a.types.assignmentExpression("=",a.types.memberExpression(a.types.cloneNode(e),t.key,t.computed||a.types.isLiteral(t.key)),getValue(t))))}}function pushMutatorDefine({body:e,getMutatorId:t,scope:r},s){let n=!s.computed&&a.types.isIdentifier(s.key)?a.types.stringLiteral(s.key.name):s.key;const i=r.maybeGenerateMemoised(n);if(i){e.push(a.types.expressionStatement(a.types.assignmentExpression("=",i,n)));n=i}e.push(...o({MUTATOR_MAP_REF:t(),KEY:a.types.cloneNode(n),VALUE:getValue(s),KIND:a.types.identifier(s.kind)}))}function pushComputedPropsLoose(e){for(const t of e.computedProps){if(t.kind==="get"||t.kind==="set"){pushMutatorDefine(e,t)}else{pushAssign(a.types.cloneNode(e.objId),t,e.body)}}}function pushComputedPropsSpec(e){const{objId:t,body:r,computedProps:s,state:n}=e;for(const o of s){const i=a.types.toComputedKey(o);if(o.kind==="get"||o.kind==="set"){pushMutatorDefine(e,o)}else{if(s.length===1){return a.types.callExpression(n.addHelper("defineProperty"),[e.initPropExpression,i,getValue(o)])}else{r.push(a.types.expressionStatement(a.types.callExpression(n.addHelper("defineProperty"),[a.types.cloneNode(t),i,getValue(o)])))}}}}return{name:"transform-computed-properties",visitor:{ObjectExpression:{exit(e,t){const{node:r,parent:s,scope:o}=e;let i=false;for(const e of r.properties){i=e.computed===true;if(i)break}if(!i)return;const l=[];const c=[];let u=false;for(const e of r.properties){if(e.computed){u=true}if(u){c.push(e)}else{l.push(e)}}const p=o.generateUidIdentifierBasedOnNode(s);const d=a.types.objectExpression(l);const f=[];f.push(a.types.variableDeclaration("var",[a.types.variableDeclarator(p,d)]));let m;const getMutatorId=function(){if(!m){m=o.generateUidIdentifier("mutatorMap");f.push(a.types.variableDeclaration("var",[a.types.variableDeclarator(m,a.types.objectExpression([]))]))}return a.types.cloneNode(m)};const y=n({scope:o,objId:p,body:f,computedProps:c,initPropExpression:d,getMutatorId:getMutatorId,state:t});if(m){f.push(a.types.expressionStatement(a.types.callExpression(t.addHelper("defineEnumerableProperties"),[a.types.cloneNode(p),a.types.cloneNode(m)])))}if(y){e.replaceWith(y)}else{f.push(a.types.expressionStatement(a.types.cloneNode(p)));e.replaceWithMultiple(f)}}}}}}));t["default"]=n},8432:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7850:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(4050);var a=r(8304);function getName(e){if(a.types.isIdentifier(e)){return e.name}return e.value.toString()}var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-duplicate-keys",visitor:{ObjectExpression(e){const{node:t}=e;const r=t.properties.filter((e=>!a.types.isSpreadElement(e)&&!e.computed));const s=Object.create(null);const n=Object.create(null);const o=Object.create(null);for(const e of r){const t=getName(e.key);let r=false;switch(e.kind){case"get":if(s[t]||n[t]){r=true}n[t]=true;break;case"set":if(s[t]||o[t]){r=true}o[t]=true;break;default:if(s[t]||n[t]||o[t]){r=true}s[t]=true}if(r){e.computed=true;e.key=a.types.stringLiteral(t)}}}}}}));t["default"]=n},4050:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1176:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3651);var a=r(6951);var n=r(8304);var o=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-exponentiation-operator",visitor:(0,a.default)({operator:"**",build(e,t){return n.types.callExpression(n.types.memberExpression(n.types.identifier("Math"),n.types.identifier("pow")),[e,t])}})}}));t["default"]=o},3651:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9488:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(2388);var a=r(8304);var n=r(8591);var o=(0,s.declare)(((e,t)=>{var r,s,o;e.assertVersion(7);{const{assumeArray:r,allowArrayLike:s,loose:a}=t;if(a===true&&r===true){throw new Error(`The loose and assumeArray options cannot be used together in @babel/plugin-transform-for-of`)}if(r===true&&s===true){throw new Error(`The assumeArray and allowArrayLike options cannot be used together in @babel/plugin-transform-for-of`)}if(s&&/^7\.\d\./.test(e.version)){throw new Error(`The allowArrayLike is only supported when using @babel/core@^7.10.0`)}}const i=(r=t.assumeArray)!=null?r:!t.loose&&e.assumption("iterableIsArray");const l=(s=t.allowArrayLike)!=null?s:e.assumption("arrayLikeIsIterable");const c=(o=e.assumption("skipForOfIteratorClosing"))!=null?o:t.loose;if(i&&l){throw new Error(`The "iterableIsArray" and "arrayLikeIsIterable" assumptions are not compatible.`)}if(i){return{name:"transform-for-of",visitor:{ForOfStatement(e){const{scope:t}=e;const{left:r,right:s,await:n}=e.node;if(n){return}const o=t.generateUidIdentifier("i");let i=t.maybeGenerateMemoised(s,true);const l=[a.types.variableDeclarator(o,a.types.numericLiteral(0))];if(i){l.push(a.types.variableDeclarator(i,s))}else{i=s}const c=a.types.memberExpression(a.types.cloneNode(i),a.types.cloneNode(o),true);let u;if(a.types.isVariableDeclaration(r)){u=r;u.declarations[0].init=c}else{u=a.types.expressionStatement(a.types.assignmentExpression("=",r,c))}let p;const d=e.get("body");if(d.isBlockStatement()&&Object.keys(e.getBindingIdentifiers()).some((e=>d.scope.hasOwnBinding(e)))){p=a.types.blockStatement([u,d.node])}else{p=a.types.toBlock(d.node);p.body.unshift(u)}e.replaceWith(a.types.forStatement(a.types.variableDeclaration("let",l),a.types.binaryExpression("<",a.types.cloneNode(o),a.types.memberExpression(a.types.cloneNode(i),a.types.identifier("length"))),a.types.updateExpression("++",a.types.cloneNode(o)),p))}}}}const u=(0,a.template)` for (var KEY = 0, NAME = ARR; KEY < NAME.length; KEY++) BODY; `;const p=a.template.statements` for (var ITERATOR_HELPER = CREATE_ITERATOR_HELPER(OBJECT, ARRAY_LIKE_IS_ITERABLE), STEP_KEY; !(STEP_KEY = ITERATOR_HELPER()).done;) BODY; - `;const f=a.template.statements` + `;const d=a.template.statements` var ITERATOR_HELPER = CREATE_ITERATOR_HELPER(OBJECT, ARRAY_LIKE_IS_ITERABLE), STEP_KEY; try { for (ITERATOR_HELPER.s(); !(STEP_KEY = ITERATOR_HELPER.n()).done;) BODY; @@ -89,14 +164,14 @@ } finally { ITERATOR_HELPER.f(); } - `;const d=c?{build:p,helper:"createForOfIteratorHelperLoose",getContainer:e=>e}:{build:f,helper:"createForOfIteratorHelper",getContainer:e=>e[1].block.body};function _ForOfStatementArray(e){const{node:t,scope:r}=e;const s=r.generateUidIdentifierBasedOnNode(t.right,"arr");const n=r.generateUidIdentifier("i");const o=u({BODY:t.body,KEY:n,NAME:s,ARR:t.right});a.types.inherits(o,t);a.types.ensureBlock(o);const i=a.types.memberExpression(a.types.cloneNode(s),a.types.cloneNode(n),true);const l=t.left;if(a.types.isVariableDeclaration(l)){l.declarations[0].init=i;o.body.body.unshift(l)}else{o.body.body.unshift(a.types.expressionStatement(a.types.assignmentExpression("=",l,i)))}return o}return{name:"transform-for-of",visitor:{ForOfStatement(e,t){const r=e.get("right");if(r.isArrayExpression()||r.isGenericType("Array")||a.types.isArrayTypeAnnotation(r.getTypeAnnotation())){e.replaceWith(_ForOfStatementArray(e));return}if(!t.availableHelper(d.helper)){(0,n.default)(c,e,t);return}const{node:s,parent:o,scope:i}=e;const u=s.left;let p;const f=i.generateUid("step");const m=a.types.memberExpression(a.types.identifier(f),a.types.identifier("value"));if(a.types.isVariableDeclaration(u)){p=a.types.variableDeclaration(u.kind,[a.types.variableDeclarator(u.declarations[0].id,m)])}else{p=a.types.expressionStatement(a.types.assignmentExpression("=",u,m))}e.ensureBlock();s.body.body.unshift(p);const y=d.build({CREATE_ITERATOR_HELPER:t.addHelper(d.helper),ITERATOR_HELPER:i.generateUidIdentifier("iterator"),ARRAY_LIKE_IS_ITERABLE:l?a.types.booleanLiteral(true):null,STEP_KEY:a.types.identifier(f),OBJECT:s.right,BODY:s.body});const g=d.getContainer(y);a.types.inherits(g[0],s);a.types.inherits(g[0].body,s.body);if(a.types.isLabeledStatement(o)){g[0]=a.types.labeledStatement(o.label,g[0]);e.parentPath.replaceWithMultiple(y);e.skip()}else{e.replaceWithMultiple(y)}}}}}));t["default"]=o},8591:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transformWithoutHelper;var s=r(8304);function transformWithoutHelper(e,t,r){const a=e?pushComputedPropsLoose:pushComputedPropsSpec;const{node:n}=t;const o=a(t,r);const i=o.declar;const l=o.loop;const c=l.body;t.ensureBlock();if(i){c.body.push(i)}c.body=c.body.concat(n.body.body);s.types.inherits(l,n);s.types.inherits(l.body,n.body);if(o.replaceParent){t.parentPath.replaceWithMultiple(o.node);t.remove()}else{t.replaceWithMultiple(o.node)}}const a=(0,s.template)(`\n for (var LOOP_OBJECT = OBJECT,\n IS_ARRAY = Array.isArray(LOOP_OBJECT),\n INDEX = 0,\n LOOP_OBJECT = IS_ARRAY ? LOOP_OBJECT : LOOP_OBJECT[Symbol.iterator]();;) {\n INTERMEDIATE;\n if (IS_ARRAY) {\n if (INDEX >= LOOP_OBJECT.length) break;\n ID = LOOP_OBJECT[INDEX++];\n } else {\n INDEX = LOOP_OBJECT.next();\n if (INDEX.done) break;\n ID = INDEX.value;\n }\n }\n`);const n=(0,s.template)(`\n var ITERATOR_COMPLETION = true;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY = undefined;\n try {\n for (\n var ITERATOR_KEY = OBJECT[Symbol.iterator](), STEP_KEY;\n !(ITERATOR_COMPLETION = (STEP_KEY = ITERATOR_KEY.next()).done);\n ITERATOR_COMPLETION = true\n ) {}\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (!ITERATOR_COMPLETION && ITERATOR_KEY.return != null) {\n ITERATOR_KEY.return();\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n`);function pushComputedPropsLoose(e,t){const{node:r,scope:n,parent:o}=e;const{left:i}=r;let l,c,u;if(s.types.isIdentifier(i)||s.types.isPattern(i)||s.types.isMemberExpression(i)){c=i;u=null}else if(s.types.isVariableDeclaration(i)){c=n.generateUidIdentifier("ref");l=s.types.variableDeclaration(i.kind,[s.types.variableDeclarator(i.declarations[0].id,s.types.identifier(c.name))]);u=s.types.variableDeclaration("var",[s.types.variableDeclarator(s.types.identifier(c.name))])}else{throw t.buildCodeFrameError(i,`Unknown node type ${i.type} in ForStatement`)}const p=n.generateUidIdentifier("iterator");const f=n.generateUidIdentifier("isArray");const d=a({LOOP_OBJECT:p,IS_ARRAY:f,OBJECT:r.right,INDEX:n.generateUidIdentifier("i"),ID:c,INTERMEDIATE:u});const m=s.types.isLabeledStatement(o);let y;if(m){y=s.types.labeledStatement(o.label,d)}return{replaceParent:m,declar:l,node:y||d,loop:d}}function pushComputedPropsSpec(e,t){const{node:r,scope:a,parent:o}=e;const i=r.left;let l;const c=a.generateUid("step");const u=s.types.memberExpression(s.types.identifier(c),s.types.identifier("value"));if(s.types.isIdentifier(i)||s.types.isPattern(i)||s.types.isMemberExpression(i)){l=s.types.expressionStatement(s.types.assignmentExpression("=",i,u))}else if(s.types.isVariableDeclaration(i)){l=s.types.variableDeclaration(i.kind,[s.types.variableDeclarator(i.declarations[0].id,u)])}else{throw t.buildCodeFrameError(i,`Unknown node type ${i.type} in ForStatement`)}const p=n({ITERATOR_HAD_ERROR_KEY:a.generateUidIdentifier("didIteratorError"),ITERATOR_COMPLETION:a.generateUidIdentifier("iteratorNormalCompletion"),ITERATOR_ERROR_KEY:a.generateUidIdentifier("iteratorError"),ITERATOR_KEY:a.generateUidIdentifier("iterator"),STEP_KEY:s.types.identifier(c),OBJECT:r.right});const f=s.types.isLabeledStatement(o);const d=p[3].block.body;const m=d[0];if(f){d[0]=s.types.labeledStatement(o.label,m)}return{replaceParent:f,declar:l,loop:m,node:p}}},2388:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},715:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8566);var a=r(550);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-function-name",visitor:{FunctionExpression:{exit(e){if(e.key!=="value"&&!e.parentPath.isObjectProperty()){const t=(0,a.default)(e);if(t)e.replaceWith(t)}}},ObjectProperty(e){const t=e.get("value");if(t.isFunction()){const e=(0,a.default)(t);if(e)t.replaceWith(e)}}}}}));t["default"]=n},8566:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5072:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(5968);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-literals",visitor:{NumericLiteral({node:e}){if(e.extra&&/^0[ob]/i.test(e.extra.raw)){e.extra=undefined}},StringLiteral({node:e}){if(e.extra&&/\\[u]/gi.test(e.extra.raw)){e.extra=undefined}}}}}));t["default"]=a},5968:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},4674:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(1483);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-member-expression-literals",visitor:{MemberExpression:{exit({node:e}){const t=e.property;if(!e.computed&&a.types.isIdentifier(t)&&!a.types.isValidES3Identifier(t.name)){e.property=a.types.stringLiteral(t.name);e.computed=true}}}}}}));t["default"]=n},1483:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8657:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(1380);var a=r(9207);var n=r(8304);var o=r(7047);const i=(0,n.template)(`\n define(MODULE_NAME, AMD_ARGUMENTS, function(IMPORT_NAMES) {\n })\n`);const l=(0,n.template)(`\n define(["require"], function(REQUIRE) {\n })\n`);function injectWrapper(e,t){const{body:r,directives:s}=e.node;e.node.directives=[];e.node.body=[];const a=e.pushContainer("body",t)[0];const n=a.get("expression.arguments").filter((e=>e.isFunctionExpression()))[0].get("body");n.pushContainer("directives",s);n.pushContainer("body",r)}var c=(0,s.declare)(((e,t)=>{var r,s;e.assertVersion(7);const{allowTopLevelThis:c,strict:u,strictMode:p,importInterop:f,noInterop:d}=t;const m=(r=e.assumption("constantReexports"))!=null?r:t.loose;const y=(s=e.assumption("enumerableModuleMeta"))!=null?s:t.loose;return{name:"transform-modules-amd",pre(){this.file.set("@babel/plugin-transform-modules-*","amd")},visitor:{CallExpression(e,t){if(!this.file.has("@babel/plugin-proposal-dynamic-import"))return;if(!e.get("callee").isImport())return;let{requireId:r,resolveId:s,rejectId:i}=t;if(!r){r=e.scope.generateUidIdentifier("require");t.requireId=r}if(!s||!i){s=e.scope.generateUidIdentifier("resolve");i=e.scope.generateUidIdentifier("reject");t.resolveId=s;t.rejectId=i}let l=n.types.identifier("imported");if(!d)l=(0,a.wrapInterop)(e,l,"namespace");e.replaceWith(n.template.expression.ast` + `;const f=c?{build:p,helper:"createForOfIteratorHelperLoose",getContainer:e=>e}:{build:d,helper:"createForOfIteratorHelper",getContainer:e=>e[1].block.body};function _ForOfStatementArray(e){const{node:t,scope:r}=e;const s=r.generateUidIdentifierBasedOnNode(t.right,"arr");const n=r.generateUidIdentifier("i");const o=u({BODY:t.body,KEY:n,NAME:s,ARR:t.right});a.types.inherits(o,t);a.types.ensureBlock(o);const i=a.types.memberExpression(a.types.cloneNode(s),a.types.cloneNode(n),true);const l=t.left;if(a.types.isVariableDeclaration(l)){l.declarations[0].init=i;o.body.body.unshift(l)}else{o.body.body.unshift(a.types.expressionStatement(a.types.assignmentExpression("=",l,i)))}return o}return{name:"transform-for-of",visitor:{ForOfStatement(e,t){const r=e.get("right");if(r.isArrayExpression()||r.isGenericType("Array")||a.types.isArrayTypeAnnotation(r.getTypeAnnotation())){e.replaceWith(_ForOfStatementArray(e));return}if(!t.availableHelper(f.helper)){(0,n.default)(c,e,t);return}const{node:s,parent:o,scope:i}=e;const u=s.left;let p;const d=i.generateUid("step");const m=a.types.memberExpression(a.types.identifier(d),a.types.identifier("value"));if(a.types.isVariableDeclaration(u)){p=a.types.variableDeclaration(u.kind,[a.types.variableDeclarator(u.declarations[0].id,m)])}else{p=a.types.expressionStatement(a.types.assignmentExpression("=",u,m))}e.ensureBlock();s.body.body.unshift(p);const y=f.build({CREATE_ITERATOR_HELPER:t.addHelper(f.helper),ITERATOR_HELPER:i.generateUidIdentifier("iterator"),ARRAY_LIKE_IS_ITERABLE:l?a.types.booleanLiteral(true):null,STEP_KEY:a.types.identifier(d),OBJECT:s.right,BODY:s.body});const g=f.getContainer(y);a.types.inherits(g[0],s);a.types.inherits(g[0].body,s.body);if(a.types.isLabeledStatement(o)){g[0]=a.types.labeledStatement(o.label,g[0]);e.parentPath.replaceWithMultiple(y);e.skip()}else{e.replaceWithMultiple(y)}}}}}));t["default"]=o},8591:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transformWithoutHelper;var s=r(8304);function transformWithoutHelper(e,t,r){const a=e?pushComputedPropsLoose:pushComputedPropsSpec;const{node:n}=t;const o=a(t,r);const i=o.declar;const l=o.loop;const c=l.body;t.ensureBlock();if(i){c.body.push(i)}c.body=c.body.concat(n.body.body);s.types.inherits(l,n);s.types.inherits(l.body,n.body);if(o.replaceParent){t.parentPath.replaceWithMultiple(o.node);t.remove()}else{t.replaceWithMultiple(o.node)}}const a=(0,s.template)(`\n for (var LOOP_OBJECT = OBJECT,\n IS_ARRAY = Array.isArray(LOOP_OBJECT),\n INDEX = 0,\n LOOP_OBJECT = IS_ARRAY ? LOOP_OBJECT : LOOP_OBJECT[Symbol.iterator]();;) {\n INTERMEDIATE;\n if (IS_ARRAY) {\n if (INDEX >= LOOP_OBJECT.length) break;\n ID = LOOP_OBJECT[INDEX++];\n } else {\n INDEX = LOOP_OBJECT.next();\n if (INDEX.done) break;\n ID = INDEX.value;\n }\n }\n`);const n=(0,s.template)(`\n var ITERATOR_COMPLETION = true;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY = undefined;\n try {\n for (\n var ITERATOR_KEY = OBJECT[Symbol.iterator](), STEP_KEY;\n !(ITERATOR_COMPLETION = (STEP_KEY = ITERATOR_KEY.next()).done);\n ITERATOR_COMPLETION = true\n ) {}\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (!ITERATOR_COMPLETION && ITERATOR_KEY.return != null) {\n ITERATOR_KEY.return();\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n`);function pushComputedPropsLoose(e,t){const{node:r,scope:n,parent:o}=e;const{left:i}=r;let l,c,u;if(s.types.isIdentifier(i)||s.types.isPattern(i)||s.types.isMemberExpression(i)){c=i;u=null}else if(s.types.isVariableDeclaration(i)){c=n.generateUidIdentifier("ref");l=s.types.variableDeclaration(i.kind,[s.types.variableDeclarator(i.declarations[0].id,s.types.identifier(c.name))]);u=s.types.variableDeclaration("var",[s.types.variableDeclarator(s.types.identifier(c.name))])}else{throw t.buildCodeFrameError(i,`Unknown node type ${i.type} in ForStatement`)}const p=n.generateUidIdentifier("iterator");const d=n.generateUidIdentifier("isArray");const f=a({LOOP_OBJECT:p,IS_ARRAY:d,OBJECT:r.right,INDEX:n.generateUidIdentifier("i"),ID:c,INTERMEDIATE:u});const m=s.types.isLabeledStatement(o);let y;if(m){y=s.types.labeledStatement(o.label,f)}return{replaceParent:m,declar:l,node:y||f,loop:f}}function pushComputedPropsSpec(e,t){const{node:r,scope:a,parent:o}=e;const i=r.left;let l;const c=a.generateUid("step");const u=s.types.memberExpression(s.types.identifier(c),s.types.identifier("value"));if(s.types.isIdentifier(i)||s.types.isPattern(i)||s.types.isMemberExpression(i)){l=s.types.expressionStatement(s.types.assignmentExpression("=",i,u))}else if(s.types.isVariableDeclaration(i)){l=s.types.variableDeclaration(i.kind,[s.types.variableDeclarator(i.declarations[0].id,u)])}else{throw t.buildCodeFrameError(i,`Unknown node type ${i.type} in ForStatement`)}const p=n({ITERATOR_HAD_ERROR_KEY:a.generateUidIdentifier("didIteratorError"),ITERATOR_COMPLETION:a.generateUidIdentifier("iteratorNormalCompletion"),ITERATOR_ERROR_KEY:a.generateUidIdentifier("iteratorError"),ITERATOR_KEY:a.generateUidIdentifier("iterator"),STEP_KEY:s.types.identifier(c),OBJECT:r.right});const d=s.types.isLabeledStatement(o);const f=p[3].block.body;const m=f[0];if(d){f[0]=s.types.labeledStatement(o.label,m)}return{replaceParent:d,declar:l,loop:m,node:p}}},2388:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},715:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8566);var a=r(550);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-function-name",visitor:{FunctionExpression:{exit(e){if(e.key!=="value"&&!e.parentPath.isObjectProperty()){const t=(0,a.default)(e);if(t)e.replaceWith(t)}}},ObjectProperty(e){const t=e.get("value");if(t.isFunction()){const e=(0,a.default)(t);if(e)t.replaceWith(e)}}}}}));t["default"]=n},8566:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5072:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(5968);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-literals",visitor:{NumericLiteral({node:e}){if(e.extra&&/^0[ob]/i.test(e.extra.raw)){e.extra=undefined}},StringLiteral({node:e}){if(e.extra&&/\\[u]/gi.test(e.extra.raw)){e.extra=undefined}}}}}));t["default"]=a},5968:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},4674:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(1483);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-member-expression-literals",visitor:{MemberExpression:{exit({node:e}){const t=e.property;if(!e.computed&&a.types.isIdentifier(t)&&!a.types.isValidES3Identifier(t.name)){e.property=a.types.stringLiteral(t.name);e.computed=true}}}}}}));t["default"]=n},1483:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8657:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(1380);var a=r(9207);var n=r(8304);var o=r(7047);const i=(0,n.template)(`\n define(MODULE_NAME, AMD_ARGUMENTS, function(IMPORT_NAMES) {\n })\n`);const l=(0,n.template)(`\n define(["require"], function(REQUIRE) {\n })\n`);function injectWrapper(e,t){const{body:r,directives:s}=e.node;e.node.directives=[];e.node.body=[];const a=e.pushContainer("body",t)[0];const n=a.get("expression.arguments").filter((e=>e.isFunctionExpression()))[0].get("body");n.pushContainer("directives",s);n.pushContainer("body",r)}var c=(0,s.declare)(((e,t)=>{var r,s;e.assertVersion(7);const{allowTopLevelThis:c,strict:u,strictMode:p,importInterop:d,noInterop:f}=t;const m=(r=e.assumption("constantReexports"))!=null?r:t.loose;const y=(s=e.assumption("enumerableModuleMeta"))!=null?s:t.loose;return{name:"transform-modules-amd",pre(){this.file.set("@babel/plugin-transform-modules-*","amd")},visitor:{CallExpression(e,t){if(!this.file.has("@babel/plugin-proposal-dynamic-import"))return;if(!e.get("callee").isImport())return;let{requireId:r,resolveId:s,rejectId:i}=t;if(!r){r=e.scope.generateUidIdentifier("require");t.requireId=r}if(!s||!i){s=e.scope.generateUidIdentifier("resolve");i=e.scope.generateUidIdentifier("reject");t.resolveId=s;t.rejectId=i}let l=n.types.identifier("imported");if(!f)l=(0,a.wrapInterop)(e,l,"namespace");e.replaceWith(n.template.expression.ast` new Promise((${s}, ${i}) => ${r}( [${(0,o.getImportSource)(n.types,e.node)}], imported => ${n.types.cloneNode(s)}(${l}), ${n.types.cloneNode(i)} ) - )`)},Program:{exit(e,{requireId:r}){if(!(0,a.isModule)(e)){if(r){injectWrapper(e,l({REQUIRE:n.types.cloneNode(r)}))}return}const s=[];const o=[];if(r){s.push(n.types.stringLiteral("require"));o.push(n.types.cloneNode(r))}let g=(0,a.getModuleName)(this.file.opts,t);if(g)g=n.types.stringLiteral(g);const{meta:h,headers:b}=(0,a.rewriteModuleStatementsAndPrepareHeader)(e,{enumerableModuleMeta:y,constantReexports:m,strict:u,strictMode:p,allowTopLevelThis:c,importInterop:f,noInterop:d});if((0,a.hasExports)(h)){s.push(n.types.stringLiteral("exports"));o.push(n.types.identifier(h.exportName))}for(const[t,r]of h.source){s.push(n.types.stringLiteral(t));o.push(n.types.identifier(r.name));if(!(0,a.isSideEffectImport)(r)){const t=(0,a.wrapInterop)(e,n.types.identifier(r.name),r.interop);if(t){const e=n.types.expressionStatement(n.types.assignmentExpression("=",n.types.identifier(r.name),t));e.loc=r.loc;b.push(e)}}b.push(...(0,a.buildNamespaceInitStatements)(h,r,m))}(0,a.ensureStatementsHoisted)(b);e.unshiftContainer("body",b);injectWrapper(e,i({MODULE_NAME:g,AMD_ARGUMENTS:n.types.arrayExpression(s),IMPORT_NAMES:o}))}}}}}));t["default"]=c},3096:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=getModuleName;{const e=getModuleName;t["default"]=getModuleName=function getModuleName(t,r){var s,a,n,o;return e(t,{moduleId:(s=r.moduleId)!=null?s:t.moduleId,moduleIds:(a=r.moduleIds)!=null?a:t.moduleIds,getModuleId:(n=r.getModuleId)!=null?n:t.getModuleId,moduleRoot:(o=r.moduleRoot)!=null?o:t.moduleRoot})}}function getModuleName(e,t){const{filename:r,filenameRelative:s=r,sourceRoot:a=t.moduleRoot}=e;const{moduleId:n,moduleIds:o=!!n,getModuleId:i,moduleRoot:l=a}=t;if(!o)return null;if(n!=null&&!i){return n}let c=l!=null?l+"/":"";if(s){const e=a!=null?new RegExp("^"+a+"/?"):"";c+=s.replace(e,"").replace(/\.(\w*?)$/,"")}c=c.replace(/\\/g,"/");if(i){return i(c)||c}else{return c}}},9207:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.rewriteModuleStatementsAndPrepareHeader=rewriteModuleStatementsAndPrepareHeader;t.ensureStatementsHoisted=ensureStatementsHoisted;t.wrapInterop=wrapInterop;t.buildNamespaceInitStatements=buildNamespaceInitStatements;Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return o.isModule}});Object.defineProperty(t,"rewriteThis",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"hasExports",{enumerable:true,get:function(){return c.hasExports}});Object.defineProperty(t,"isSideEffectImport",{enumerable:true,get:function(){return c.isSideEffectImport}});Object.defineProperty(t,"getModuleName",{enumerable:true,get:function(){return u.default}});var s=r(9491);var a=r(8622);var n=r(153);var o=r(9115);var i=r(9736);var l=r(4025);var c=r(9152);var u=r(3096);function rewriteModuleStatementsAndPrepareHeader(e,{loose:t,exportName:r,strict:n,allowTopLevelThis:u,strictMode:p,noInterop:f,importInterop:d=(f?"none":"babel"),lazy:m,esNamespaceOnly:y,constantReexports:g=t,enumerableModuleMeta:h=t}){(0,c.validateImportInteropOption)(d);s((0,o.isModule)(e),"Cannot process module statements in a script");e.node.sourceType="script";const b=(0,c.default)(e,r,{importInterop:d,initializeReexports:g,lazy:m,esNamespaceOnly:y});if(!u){(0,i.default)(e)}(0,l.default)(e,b);if(p!==false){const t=e.node.directives.some((e=>e.value.value==="use strict"));if(!t){e.unshiftContainer("directives",a.directive(a.directiveLiteral("use strict")))}}const x=[];if((0,c.hasExports)(b)&&!n){x.push(buildESModuleHeader(b,h))}const v=buildExportNameListDeclaration(e,b);if(v){b.exportNameListName=v.name;x.push(v.statement)}x.push(...buildExportInitializationStatements(e,b,g));return{meta:b,headers:x}}function ensureStatementsHoisted(e){e.forEach((e=>{e._blockHoist=3}))}function wrapInterop(e,t,r){if(r==="none"){return null}if(r==="node-namespace"){return a.callExpression(e.hub.addHelper("interopRequireWildcard"),[t,a.booleanLiteral(true)])}else if(r==="node-default"){return null}let s;if(r==="default"){s="interopRequireDefault"}else if(r==="namespace"){s="interopRequireWildcard"}else{throw new Error(`Unknown interop: ${r}`)}return a.callExpression(e.hub.addHelper(s),[t])}function buildNamespaceInitStatements(e,t,r=false){const s=[];let o=a.identifier(t.name);if(t.lazy)o=a.callExpression(o,[]);for(const e of t.importsNamespace){if(e===t.name)continue;s.push(n.default.statement`var NAME = SOURCE;`({NAME:e,SOURCE:a.cloneNode(o)}))}if(r){s.push(...buildReexportsFromMeta(e,t,true))}for(const r of t.reexportNamespace){s.push((t.lazy?n.default.statement` + )`)},Program:{exit(e,{requireId:r}){if(!(0,a.isModule)(e)){if(r){injectWrapper(e,l({REQUIRE:n.types.cloneNode(r)}))}return}const s=[];const o=[];if(r){s.push(n.types.stringLiteral("require"));o.push(n.types.cloneNode(r))}let g=(0,a.getModuleName)(this.file.opts,t);if(g)g=n.types.stringLiteral(g);const{meta:h,headers:b}=(0,a.rewriteModuleStatementsAndPrepareHeader)(e,{enumerableModuleMeta:y,constantReexports:m,strict:u,strictMode:p,allowTopLevelThis:c,importInterop:d,noInterop:f});if((0,a.hasExports)(h)){s.push(n.types.stringLiteral("exports"));o.push(n.types.identifier(h.exportName))}for(const[t,r]of h.source){s.push(n.types.stringLiteral(t));o.push(n.types.identifier(r.name));if(!(0,a.isSideEffectImport)(r)){const t=(0,a.wrapInterop)(e,n.types.identifier(r.name),r.interop);if(t){const e=n.types.expressionStatement(n.types.assignmentExpression("=",n.types.identifier(r.name),t));e.loc=r.loc;b.push(e)}}b.push(...(0,a.buildNamespaceInitStatements)(h,r,m))}(0,a.ensureStatementsHoisted)(b);e.unshiftContainer("body",b);injectWrapper(e,i({MODULE_NAME:g,AMD_ARGUMENTS:n.types.arrayExpression(s),IMPORT_NAMES:o}))}}}}}));t["default"]=c},3096:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=getModuleName;{const e=getModuleName;t["default"]=getModuleName=function getModuleName(t,r){var s,a,n,o;return e(t,{moduleId:(s=r.moduleId)!=null?s:t.moduleId,moduleIds:(a=r.moduleIds)!=null?a:t.moduleIds,getModuleId:(n=r.getModuleId)!=null?n:t.getModuleId,moduleRoot:(o=r.moduleRoot)!=null?o:t.moduleRoot})}}function getModuleName(e,t){const{filename:r,filenameRelative:s=r,sourceRoot:a=t.moduleRoot}=e;const{moduleId:n,moduleIds:o=!!n,getModuleId:i,moduleRoot:l=a}=t;if(!o)return null;if(n!=null&&!i){return n}let c=l!=null?l+"/":"";if(s){const e=a!=null?new RegExp("^"+a+"/?"):"";c+=s.replace(e,"").replace(/\.(\w*?)$/,"")}c=c.replace(/\\/g,"/");if(i){return i(c)||c}else{return c}}},9207:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.rewriteModuleStatementsAndPrepareHeader=rewriteModuleStatementsAndPrepareHeader;t.ensureStatementsHoisted=ensureStatementsHoisted;t.wrapInterop=wrapInterop;t.buildNamespaceInitStatements=buildNamespaceInitStatements;Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return o.isModule}});Object.defineProperty(t,"rewriteThis",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"hasExports",{enumerable:true,get:function(){return c.hasExports}});Object.defineProperty(t,"isSideEffectImport",{enumerable:true,get:function(){return c.isSideEffectImport}});Object.defineProperty(t,"getModuleName",{enumerable:true,get:function(){return u.default}});var s=r(9491);var a=r(8622);var n=r(153);var o=r(6039);var i=r(9736);var l=r(4025);var c=r(9152);var u=r(3096);function rewriteModuleStatementsAndPrepareHeader(e,{loose:t,exportName:r,strict:n,allowTopLevelThis:u,strictMode:p,noInterop:d,importInterop:f=(d?"none":"babel"),lazy:m,esNamespaceOnly:y,constantReexports:g=t,enumerableModuleMeta:h=t}){(0,c.validateImportInteropOption)(f);s((0,o.isModule)(e),"Cannot process module statements in a script");e.node.sourceType="script";const b=(0,c.default)(e,r,{importInterop:f,initializeReexports:g,lazy:m,esNamespaceOnly:y});if(!u){(0,i.default)(e)}(0,l.default)(e,b);if(p!==false){const t=e.node.directives.some((e=>e.value.value==="use strict"));if(!t){e.unshiftContainer("directives",a.directive(a.directiveLiteral("use strict")))}}const x=[];if((0,c.hasExports)(b)&&!n){x.push(buildESModuleHeader(b,h))}const v=buildExportNameListDeclaration(e,b);if(v){b.exportNameListName=v.name;x.push(v.statement)}x.push(...buildExportInitializationStatements(e,b,g));return{meta:b,headers:x}}function ensureStatementsHoisted(e){e.forEach((e=>{e._blockHoist=3}))}function wrapInterop(e,t,r){if(r==="none"){return null}if(r==="node-namespace"){return a.callExpression(e.hub.addHelper("interopRequireWildcard"),[t,a.booleanLiteral(true)])}else if(r==="node-default"){return null}let s;if(r==="default"){s="interopRequireDefault"}else if(r==="namespace"){s="interopRequireWildcard"}else{throw new Error(`Unknown interop: ${r}`)}return a.callExpression(e.hub.addHelper(s),[t])}function buildNamespaceInitStatements(e,t,r=false){const s=[];let o=a.identifier(t.name);if(t.lazy)o=a.callExpression(o,[]);for(const e of t.importsNamespace){if(e===t.name)continue;s.push(n.default.statement`var NAME = SOURCE;`({NAME:e,SOURCE:a.cloneNode(o)}))}if(r){s.push(...buildReexportsFromMeta(e,t,true))}for(const r of t.reexportNamespace){s.push((t.lazy?n.default.statement` Object.defineProperty(EXPORTS, "NAME", { enumerable: true, get: function() { @@ -139,18 +214,18 @@ }); `)({NAMESPACE:t,EXPORTS:e.exportName,VERIFY_NAME_LIST:e.exportNameListName?(0,n.default)` if (Object.prototype.hasOwnProperty.call(EXPORTS_LIST, key)) return; - `({EXPORTS_LIST:e.exportNameListName}):null})}function buildExportNameListDeclaration(e,t){const r=Object.create(null);for(const e of t.local.values()){for(const t of e.names){r[t]=true}}let s=false;for(const e of t.source.values()){for(const t of e.reexports.keys()){r[t]=true}for(const t of e.reexportNamespace){r[t]=true}s=s||!!e.reexportAll}if(!s||Object.keys(r).length===0)return null;const n=e.scope.generateUidIdentifier("exportNames");delete r.default;return{name:n.name,statement:a.variableDeclaration("var",[a.variableDeclarator(n,a.valueToNode(r))])}}function buildExportInitializationStatements(e,t,r=false){const s=[];const n=[];for(const[e,r]of t.local){if(r.kind==="import"){}else if(r.kind==="hoisted"){s.push(buildInitStatement(t,r.names,a.identifier(e)))}else{n.push(...r.names)}}for(const e of t.source.values()){if(!r){s.push(...buildReexportsFromMeta(t,e,false))}for(const t of e.reexportNamespace){n.push(t)}}s.push(...chunk(n,100).map((r=>buildInitStatement(t,r,e.scope.buildUndefinedNode()))));return s}const f={computed:n.default.expression`EXPORTS["NAME"] = VALUE`,default:n.default.expression`EXPORTS.NAME = VALUE`};function buildInitStatement(e,t,r){const{stringSpecifiers:s,exportName:n}=e;return a.expressionStatement(t.reduce(((e,t)=>{const r={EXPORTS:n,NAME:t,VALUE:e};if(s.has(t)){return f.computed(r)}else{return f.default(r)}}),r))}function chunk(e,t){const r=[];for(let s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasExports=hasExports;t.isSideEffectImport=isSideEffectImport;t.validateImportInteropOption=validateImportInteropOption;t["default"]=normalizeModuleAndLoadMetadata;var s=r(1017);var a=r(6290);var n=r(7058);function hasExports(e){return e.hasExports}function isSideEffectImport(e){return e.imports.size===0&&e.importsNamespace.size===0&&e.reexports.size===0&&e.reexportNamespace.size===0&&!e.reexportAll}function validateImportInteropOption(e){if(typeof e!=="function"&&e!=="none"&&e!=="babel"&&e!=="node"){throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${e}).`)}return e}function resolveImportInterop(e,t){if(typeof e==="function"){return validateImportInteropOption(e(t))}return e}function normalizeModuleAndLoadMetadata(e,t,{importInterop:r,initializeReexports:s=false,lazy:a=false,esNamespaceOnly:n=false}){if(!t){t=e.scope.generateUidIdentifier("exports").name}const o=new Set;nameAnonymousExports(e);const{local:i,source:l,hasExports:c}=getModuleMetadata(e,{initializeReexports:s,lazy:a},o);removeModuleDeclarations(e);for(const[,e]of l){if(e.importsNamespace.size>0){e.name=e.importsNamespace.values().next().value}const t=resolveImportInterop(r,e.source);if(t==="none"){e.interop="none"}else if(t==="node"&&e.interop==="namespace"){e.interop="node-namespace"}else if(t==="node"&&e.interop==="default"){e.interop="node-default"}else if(n&&e.interop==="namespace"){e.interop="default"}}return{exportName:t,exportNameListName:null,hasExports:c,local:i,source:l,stringSpecifiers:o}}function getExportSpecifierName(e,t){if(e.isIdentifier()){return e.node.name}else if(e.isStringLiteral()){const r=e.node.value;if(!(0,a.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.node.type}`)}}function assertExportSpecifier(e){if(e.isExportSpecifier()){return}else if(e.isExportNamespaceSpecifier()){throw e.buildCodeFrameError("Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.")}else{throw e.buildCodeFrameError("Unexpected export specifier type")}}function getModuleMetadata(e,{lazy:t,initializeReexports:r},a){const n=getLocalExportMetadata(e,r,a);const o=new Map;const getData=t=>{const r=t.value;let a=o.get(r);if(!a){a={name:e.scope.generateUidIdentifier((0,s.basename)(r,(0,s.extname)(r))).name,interop:"none",loc:null,imports:new Map,importsNamespace:new Set,reexports:new Map,reexportNamespace:new Set,reexportAll:null,lazy:false,source:r};o.set(r,a)}return a};let i=false;e.get("body").forEach((e=>{if(e.isImportDeclaration()){const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{if(e.isImportDefaultSpecifier()){const r=e.get("local").node.name;t.imports.set(r,"default");const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexports.set(e,"default")}))}}else if(e.isImportNamespaceSpecifier()){const r=e.get("local").node.name;t.importsNamespace.add(r);const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexportNamespace.add(e)}))}}else if(e.isImportSpecifier()){const r=getExportSpecifierName(e.get("imported"),a);const s=e.get("local").node.name;t.imports.set(s,r);const o=n.get(s);if(o){n.delete(s);o.names.forEach((e=>{t.reexports.set(e,r)}))}}}))}else if(e.isExportAllDeclaration()){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;t.reexportAll={loc:e.node.loc}}else if(e.isExportNamedDeclaration()&&e.node.source){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{assertExportSpecifier(e);const r=getExportSpecifierName(e.get("local"),a);const s=getExportSpecifierName(e.get("exported"),a);t.reexports.set(s,r);if(s==="__esModule"){throw e.get("exported").buildCodeFrameError('Illegal export "__esModule".')}}))}else if(e.isExportNamedDeclaration()||e.isExportDefaultDeclaration()){i=true}}));for(const e of o.values()){let t=false;let r=false;if(e.importsNamespace.size>0){t=true;r=true}if(e.reexportAll){r=true}for(const s of e.imports.values()){if(s==="default")t=true;else r=true}for(const s of e.reexports.values()){if(s==="default")t=true;else r=true}if(t&&r){e.interop="namespace"}else if(t){e.interop="default"}}for(const[e,r]of o){if(t!==false&&!(isSideEffectImport(r)||r.reexportAll)){if(t===true){r.lazy=!/\./.test(e)}else if(Array.isArray(t)){r.lazy=t.indexOf(e)!==-1}else if(typeof t==="function"){r.lazy=t(e)}else{throw new Error(`.lazy must be a boolean, string array, or function`)}}}return{hasExports:i,local:n,source:o}}function getLocalExportMetadata(e,t,r){const s=new Map;e.get("body").forEach((e=>{let r;if(e.isImportDeclaration()){r="import"}else{if(e.isExportDefaultDeclaration())e=e.get("declaration");if(e.isExportNamedDeclaration()){if(e.node.declaration){e=e.get("declaration")}else if(t&&e.node.source&&e.get("source").isStringLiteral()){e.get("specifiers").forEach((e=>{assertExportSpecifier(e);s.set(e.get("local").node.name,"block")}));return}}if(e.isFunctionDeclaration()){r="hoisted"}else if(e.isClassDeclaration()){r="block"}else if(e.isVariableDeclaration({kind:"var"})){r="var"}else if(e.isVariableDeclaration()){r="block"}else{return}}Object.keys(e.getOuterBindingIdentifiers()).forEach((e=>{s.set(e,r)}))}));const a=new Map;const getLocalMetadata=e=>{const t=e.node.name;let r=a.get(t);if(!r){const n=s.get(t);if(n===undefined){throw e.buildCodeFrameError(`Exporting local "${t}", which is not declared.`)}r={names:[],kind:n};a.set(t,r)}return r};e.get("body").forEach((e=>{if(e.isExportNamedDeclaration()&&(t||!e.node.source)){if(e.node.declaration){const t=e.get("declaration");const r=t.getOuterBindingIdentifierPaths();Object.keys(r).forEach((e=>{if(e==="__esModule"){throw t.buildCodeFrameError('Illegal export "__esModule".')}getLocalMetadata(r[e]).names.push(e)}))}else{e.get("specifiers").forEach((e=>{const t=e.get("local");const s=e.get("exported");const a=getLocalMetadata(t);const n=getExportSpecifierName(s,r);if(n==="__esModule"){throw s.buildCodeFrameError('Illegal export "__esModule".')}a.names.push(n)}))}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){getLocalMetadata(t.get("id")).names.push("default")}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}}));return a}function nameAnonymousExports(e){e.get("body").forEach((e=>{if(!e.isExportDefaultDeclaration())return;(0,n.default)(e)}))}function removeModuleDeclarations(e){e.get("body").forEach((e=>{if(e.isImportDeclaration()){e.remove()}else if(e.isExportNamedDeclaration()){if(e.node.declaration){e.node.declaration._blockHoist=e.node._blockHoist;e.replaceWith(e.node.declaration)}else{e.remove()}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){t._blockHoist=e.node._blockHoist;e.replaceWith(t)}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}else if(e.isExportAllDeclaration()){e.remove()}}))}},4025:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteLiveReferences;var s=r(9491);var a=r(8622);var n=r(153);var o=r(3667);function rewriteLiveReferences(e,t){const r=new Map;const s=new Map;const requeueInParent=t=>{e.requeue(t)};for(const[e,s]of t.source){for(const[t,a]of s.imports){r.set(t,[e,a,null])}for(const t of s.importsNamespace){r.set(t,[e,null,t])}}for(const[e,r]of t.local){let t=s.get(e);if(!t){t=[];s.set(e,t)}t.push(...r.names)}const n={metadata:t,requeueInParent:requeueInParent,scope:e.scope,exported:s};e.traverse(i,n);(0,o.default)(e,new Set([...Array.from(r.keys()),...Array.from(s.keys())]));const c={seen:new WeakSet,metadata:t,requeueInParent:requeueInParent,scope:e.scope,imported:r,exported:s,buildImportReference:([e,r,s],n)=>{const o=t.source.get(e);if(s){if(o.lazy)n=a.callExpression(n,[]);return n}let i=a.identifier(o.name);if(o.lazy)i=a.callExpression(i,[]);if(r==="default"&&o.interop==="node-default"){return i}const l=t.stringSpecifiers.has(r);return a.memberExpression(i,l?a.stringLiteral(r):a.identifier(r),l)}};e.traverse(l,c)}const i={Scope(e){e.skip()},ClassDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;const{id:n}=e.node;if(!n)throw new Error("Expected class to have a name");const o=n.name;const i=r.get(o)||[];if(i.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,i,a.identifier(o)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}},VariableDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;Object.keys(e.getOuterBindingIdentifiers()).forEach((n=>{const o=r.get(n)||[];if(o.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,o,a.identifier(n)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}}))}};const buildBindingExportAssignmentExpression=(e,t,r)=>(t||[]).reduce(((t,r)=>{const{stringSpecifiers:s}=e;const n=s.has(r);return a.assignmentExpression("=",a.memberExpression(a.identifier(e.exportName),n?a.stringLiteral(r):a.identifier(r),n),t)}),r);const buildImportThrow=e=>n.default.expression.ast` + `({EXPORTS_LIST:e.exportNameListName}):null})}function buildExportNameListDeclaration(e,t){const r=Object.create(null);for(const e of t.local.values()){for(const t of e.names){r[t]=true}}let s=false;for(const e of t.source.values()){for(const t of e.reexports.keys()){r[t]=true}for(const t of e.reexportNamespace){r[t]=true}s=s||!!e.reexportAll}if(!s||Object.keys(r).length===0)return null;const n=e.scope.generateUidIdentifier("exportNames");delete r.default;return{name:n.name,statement:a.variableDeclaration("var",[a.variableDeclarator(n,a.valueToNode(r))])}}function buildExportInitializationStatements(e,t,r=false){const s=[];const n=[];for(const[e,r]of t.local){if(r.kind==="import"){}else if(r.kind==="hoisted"){s.push(buildInitStatement(t,r.names,a.identifier(e)))}else{n.push(...r.names)}}for(const e of t.source.values()){if(!r){s.push(...buildReexportsFromMeta(t,e,false))}for(const t of e.reexportNamespace){n.push(t)}}s.push(...chunk(n,100).map((r=>buildInitStatement(t,r,e.scope.buildUndefinedNode()))));return s}const d={computed:n.default.expression`EXPORTS["NAME"] = VALUE`,default:n.default.expression`EXPORTS.NAME = VALUE`};function buildInitStatement(e,t,r){const{stringSpecifiers:s,exportName:n}=e;return a.expressionStatement(t.reduce(((e,t)=>{const r={EXPORTS:n,NAME:t,VALUE:e};if(s.has(t)){return d.computed(r)}else{return d.default(r)}}),r))}function chunk(e,t){const r=[];for(let s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasExports=hasExports;t.isSideEffectImport=isSideEffectImport;t.validateImportInteropOption=validateImportInteropOption;t["default"]=normalizeModuleAndLoadMetadata;var s=r(1017);var a=r(6290);var n=r(7058);function hasExports(e){return e.hasExports}function isSideEffectImport(e){return e.imports.size===0&&e.importsNamespace.size===0&&e.reexports.size===0&&e.reexportNamespace.size===0&&!e.reexportAll}function validateImportInteropOption(e){if(typeof e!=="function"&&e!=="none"&&e!=="babel"&&e!=="node"){throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${e}).`)}return e}function resolveImportInterop(e,t){if(typeof e==="function"){return validateImportInteropOption(e(t))}return e}function normalizeModuleAndLoadMetadata(e,t,{importInterop:r,initializeReexports:s=false,lazy:a=false,esNamespaceOnly:n=false}){if(!t){t=e.scope.generateUidIdentifier("exports").name}const o=new Set;nameAnonymousExports(e);const{local:i,source:l,hasExports:c}=getModuleMetadata(e,{initializeReexports:s,lazy:a},o);removeModuleDeclarations(e);for(const[,e]of l){if(e.importsNamespace.size>0){e.name=e.importsNamespace.values().next().value}const t=resolveImportInterop(r,e.source);if(t==="none"){e.interop="none"}else if(t==="node"&&e.interop==="namespace"){e.interop="node-namespace"}else if(t==="node"&&e.interop==="default"){e.interop="node-default"}else if(n&&e.interop==="namespace"){e.interop="default"}}return{exportName:t,exportNameListName:null,hasExports:c,local:i,source:l,stringSpecifiers:o}}function getExportSpecifierName(e,t){if(e.isIdentifier()){return e.node.name}else if(e.isStringLiteral()){const r=e.node.value;if(!(0,a.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.node.type}`)}}function assertExportSpecifier(e){if(e.isExportSpecifier()){return}else if(e.isExportNamespaceSpecifier()){throw e.buildCodeFrameError("Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.")}else{throw e.buildCodeFrameError("Unexpected export specifier type")}}function getModuleMetadata(e,{lazy:t,initializeReexports:r},a){const n=getLocalExportMetadata(e,r,a);const o=new Map;const getData=t=>{const r=t.value;let a=o.get(r);if(!a){a={name:e.scope.generateUidIdentifier((0,s.basename)(r,(0,s.extname)(r))).name,interop:"none",loc:null,imports:new Map,importsNamespace:new Set,reexports:new Map,reexportNamespace:new Set,reexportAll:null,lazy:false,source:r};o.set(r,a)}return a};let i=false;e.get("body").forEach((e=>{if(e.isImportDeclaration()){const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{if(e.isImportDefaultSpecifier()){const r=e.get("local").node.name;t.imports.set(r,"default");const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexports.set(e,"default")}))}}else if(e.isImportNamespaceSpecifier()){const r=e.get("local").node.name;t.importsNamespace.add(r);const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexportNamespace.add(e)}))}}else if(e.isImportSpecifier()){const r=getExportSpecifierName(e.get("imported"),a);const s=e.get("local").node.name;t.imports.set(s,r);const o=n.get(s);if(o){n.delete(s);o.names.forEach((e=>{t.reexports.set(e,r)}))}}}))}else if(e.isExportAllDeclaration()){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;t.reexportAll={loc:e.node.loc}}else if(e.isExportNamedDeclaration()&&e.node.source){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{assertExportSpecifier(e);const r=getExportSpecifierName(e.get("local"),a);const s=getExportSpecifierName(e.get("exported"),a);t.reexports.set(s,r);if(s==="__esModule"){throw e.get("exported").buildCodeFrameError('Illegal export "__esModule".')}}))}else if(e.isExportNamedDeclaration()||e.isExportDefaultDeclaration()){i=true}}));for(const e of o.values()){let t=false;let r=false;if(e.importsNamespace.size>0){t=true;r=true}if(e.reexportAll){r=true}for(const s of e.imports.values()){if(s==="default")t=true;else r=true}for(const s of e.reexports.values()){if(s==="default")t=true;else r=true}if(t&&r){e.interop="namespace"}else if(t){e.interop="default"}}for(const[e,r]of o){if(t!==false&&!(isSideEffectImport(r)||r.reexportAll)){if(t===true){r.lazy=!/\./.test(e)}else if(Array.isArray(t)){r.lazy=t.indexOf(e)!==-1}else if(typeof t==="function"){r.lazy=t(e)}else{throw new Error(`.lazy must be a boolean, string array, or function`)}}}return{hasExports:i,local:n,source:o}}function getLocalExportMetadata(e,t,r){const s=new Map;e.get("body").forEach((e=>{let r;if(e.isImportDeclaration()){r="import"}else{if(e.isExportDefaultDeclaration())e=e.get("declaration");if(e.isExportNamedDeclaration()){if(e.node.declaration){e=e.get("declaration")}else if(t&&e.node.source&&e.get("source").isStringLiteral()){e.get("specifiers").forEach((e=>{assertExportSpecifier(e);s.set(e.get("local").node.name,"block")}));return}}if(e.isFunctionDeclaration()){r="hoisted"}else if(e.isClassDeclaration()){r="block"}else if(e.isVariableDeclaration({kind:"var"})){r="var"}else if(e.isVariableDeclaration()){r="block"}else{return}}Object.keys(e.getOuterBindingIdentifiers()).forEach((e=>{s.set(e,r)}))}));const a=new Map;const getLocalMetadata=e=>{const t=e.node.name;let r=a.get(t);if(!r){const n=s.get(t);if(n===undefined){throw e.buildCodeFrameError(`Exporting local "${t}", which is not declared.`)}r={names:[],kind:n};a.set(t,r)}return r};e.get("body").forEach((e=>{if(e.isExportNamedDeclaration()&&(t||!e.node.source)){if(e.node.declaration){const t=e.get("declaration");const r=t.getOuterBindingIdentifierPaths();Object.keys(r).forEach((e=>{if(e==="__esModule"){throw t.buildCodeFrameError('Illegal export "__esModule".')}getLocalMetadata(r[e]).names.push(e)}))}else{e.get("specifiers").forEach((e=>{const t=e.get("local");const s=e.get("exported");const a=getLocalMetadata(t);const n=getExportSpecifierName(s,r);if(n==="__esModule"){throw s.buildCodeFrameError('Illegal export "__esModule".')}a.names.push(n)}))}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){getLocalMetadata(t.get("id")).names.push("default")}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}}));return a}function nameAnonymousExports(e){e.get("body").forEach((e=>{if(!e.isExportDefaultDeclaration())return;(0,n.default)(e)}))}function removeModuleDeclarations(e){e.get("body").forEach((e=>{if(e.isImportDeclaration()){e.remove()}else if(e.isExportNamedDeclaration()){if(e.node.declaration){e.node.declaration._blockHoist=e.node._blockHoist;e.replaceWith(e.node.declaration)}else{e.remove()}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){t._blockHoist=e.node._blockHoist;e.replaceWith(t)}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}else if(e.isExportAllDeclaration()){e.remove()}}))}},4025:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteLiveReferences;var s=r(9491);var a=r(8622);var n=r(153);var o=r(3667);function rewriteLiveReferences(e,t){const r=new Map;const s=new Map;const requeueInParent=t=>{e.requeue(t)};for(const[e,s]of t.source){for(const[t,a]of s.imports){r.set(t,[e,a,null])}for(const t of s.importsNamespace){r.set(t,[e,null,t])}}for(const[e,r]of t.local){let t=s.get(e);if(!t){t=[];s.set(e,t)}t.push(...r.names)}const n={metadata:t,requeueInParent:requeueInParent,scope:e.scope,exported:s};e.traverse(i,n);(0,o.default)(e,new Set([...Array.from(r.keys()),...Array.from(s.keys())]));const c={seen:new WeakSet,metadata:t,requeueInParent:requeueInParent,scope:e.scope,imported:r,exported:s,buildImportReference:([e,r,s],n)=>{const o=t.source.get(e);if(s){if(o.lazy)n=a.callExpression(n,[]);return n}let i=a.identifier(o.name);if(o.lazy)i=a.callExpression(i,[]);if(r==="default"&&o.interop==="node-default"){return i}const l=t.stringSpecifiers.has(r);return a.memberExpression(i,l?a.stringLiteral(r):a.identifier(r),l)}};e.traverse(l,c)}const i={Scope(e){e.skip()},ClassDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;const{id:n}=e.node;if(!n)throw new Error("Expected class to have a name");const o=n.name;const i=r.get(o)||[];if(i.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,i,a.identifier(o)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}},VariableDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;Object.keys(e.getOuterBindingIdentifiers()).forEach((n=>{const o=r.get(n)||[];if(o.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,o,a.identifier(n)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}}))}};const buildBindingExportAssignmentExpression=(e,t,r)=>(t||[]).reduce(((t,r)=>{const{stringSpecifiers:s}=e;const n=s.has(r);return a.assignmentExpression("=",a.memberExpression(a.identifier(e.exportName),n?a.stringLiteral(r):a.identifier(r),n),t)}),r);const buildImportThrow=e=>n.default.expression.ast` (function() { throw new Error('"' + '${e}' + '" is read-only.'); })() - `;const l={ReferencedIdentifier(e){const{seen:t,buildImportReference:r,scope:s,imported:n,requeueInParent:o}=this;if(t.has(e.node))return;t.add(e.node);const i=e.node.name;const l=n.get(i);if(l){const t=e.scope.getBinding(i);const n=s.getBinding(i);if(n!==t)return;const c=r(l,e.node);c.loc=e.node.loc;if((e.parentPath.isCallExpression({callee:e.node})||e.parentPath.isOptionalCallExpression({callee:e.node})||e.parentPath.isTaggedTemplateExpression({tag:e.node}))&&a.isMemberExpression(c)){e.replaceWith(a.sequenceExpression([a.numericLiteral(0),c]))}else if(e.isJSXIdentifier()&&a.isMemberExpression(c)){const{object:t,property:r}=c;e.replaceWith(a.jsxMemberExpression(a.jsxIdentifier(t.name),a.jsxIdentifier(r.name)))}else{e.replaceWith(c)}o(e);e.skip()}},AssignmentExpression:{exit(e){const{scope:t,seen:r,imported:n,exported:o,requeueInParent:i,buildImportReference:l}=this;if(r.has(e.node))return;r.add(e.node);const c=e.get("left");if(c.isMemberExpression())return;if(c.isIdentifier()){const r=c.node.name;if(t.getBinding(r)!==e.scope.getBinding(r)){return}const u=o.get(r);const p=n.get(r);if((u==null?void 0:u.length)>0||p){s(e.node.operator==="=","Path was not simplified");const t=e.node;if(p){t.left=l(p,t.left);t.right=a.sequenceExpression([t.right,buildImportThrow(r)])}e.replaceWith(buildBindingExportAssignmentExpression(this.metadata,u,t));i(e)}}else{const r=c.getOuterBindingIdentifiers();const s=Object.keys(r).filter((r=>t.getBinding(r)===e.scope.getBinding(r)));const l=s.find((e=>n.has(e)));if(l){e.node.right=a.sequenceExpression([e.node.right,buildImportThrow(l)])}const u=[];s.forEach((e=>{const t=o.get(e)||[];if(t.length>0){u.push(buildBindingExportAssignmentExpression(this.metadata,t,a.identifier(e)))}}));if(u.length>0){let t=a.sequenceExpression(u);if(e.parentPath.isExpressionStatement()){t=a.expressionStatement(t);t._blockHoist=e.parentPath.node._blockHoist}const r=e.insertAfter(t)[0];i(r)}}}},"ForOfStatement|ForInStatement"(e){const{scope:t,node:r}=e;const{left:s}=r;const{exported:n,scope:o}=this;if(!a.isVariableDeclaration(s)){let r=false;const i=e.get("body");const l=i.scope;for(const e of Object.keys(a.getOuterBindingIdentifiers(s))){if(n.get(e)&&o.getBinding(e)===t.getBinding(e)){r=true;if(l.hasOwnBinding(e)){l.rename(e)}}}if(!r){return}const c=t.generateUidIdentifierBasedOnNode(s);i.unshiftContainer("body",a.expressionStatement(a.assignmentExpression("=",s,c)));e.get("left").replaceWith(a.variableDeclaration("let",[a.variableDeclarator(a.cloneNode(c))]));t.registerDeclaration(e.get("left"))}}}},9736:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteThis;var s=r(6833);var a=r(7369);var n=r(8622);function rewriteThis(e){(0,a.default)(e.node,Object.assign({},o,{noScope:true}))}const o=a.default.visitors.merge([s.environmentVisitor,{ThisExpression(e){e.replaceWith(n.unaryExpression("void",n.numericLiteral(0),true))}}])},1380:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},3667:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=simplifyAccess;var s=r(8622);function simplifyAccess(e,t){e.traverse(a,{scope:e.scope,bindingNames:t,seen:new WeakSet})}const a={UpdateExpression:{exit(e){const{scope:t,bindingNames:r}=this;const a=e.get("argument");if(!a.isIdentifier())return;const n=a.node.name;if(!r.has(n))return;if(t.getBinding(n)!==e.scope.getBinding(n)){return}if(e.parentPath.isExpressionStatement()&&!e.isCompletionRecord()){const t=e.node.operator=="++"?"+=":"-=";e.replaceWith(s.assignmentExpression(t,a.node,s.numericLiteral(1)))}else if(e.node.prefix){e.replaceWith(s.assignmentExpression("=",s.identifier(n),s.binaryExpression(e.node.operator[0],s.unaryExpression("+",a.node),s.numericLiteral(1))))}else{const t=e.scope.generateUidIdentifierBasedOnNode(a.node,"old");const r=t.name;e.scope.push({id:t});const n=s.binaryExpression(e.node.operator[0],s.identifier(r),s.numericLiteral(1));e.replaceWith(s.sequenceExpression([s.assignmentExpression("=",s.identifier(r),s.unaryExpression("+",a.node)),s.assignmentExpression("=",s.cloneNode(a.node),n),s.identifier(r)]))}}},AssignmentExpression:{exit(e){const{scope:t,seen:r,bindingNames:a}=this;if(e.node.operator==="=")return;if(r.has(e.node))return;r.add(e.node);const n=e.get("left");if(!n.isIdentifier())return;const o=n.node.name;if(!a.has(o))return;if(t.getBinding(o)!==e.scope.getBinding(o)){return}e.node.right=s.binaryExpression(e.node.operator.slice(0,-1),s.cloneNode(e.node.left),e.node.right);e.node.operator="="}}}},9417:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(9417);var a=r(7721)},7721:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},6186:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(457);var a=r(1056);var n=r(9553);var o=r(8304);var i=r(7047);var l=(0,s.declare)(((e,t)=>{var r,s,l;e.assertVersion(7);const c=(0,i.createDynamicImportTransform)(e);const{strictNamespace:u=false,mjsStrictNamespace:p=true,allowTopLevelThis:f,strict:d,strictMode:m,noInterop:y,importInterop:g,lazy:h=false,allowCommonJSExports:b=true}=t;const x=(r=e.assumption("constantReexports"))!=null?r:t.loose;const v=(s=e.assumption("enumerableModuleMeta"))!=null?s:t.loose;const E=(l=e.assumption("noIncompleteNsImportDetection"))!=null?l:false;if(typeof h!=="boolean"&&typeof h!=="function"&&(!Array.isArray(h)||!h.every((e=>typeof e==="string")))){throw new Error(`.lazy must be a boolean, array of strings, or a function`)}if(typeof u!=="boolean"){throw new Error(`.strictNamespace must be a boolean, or undefined`)}if(typeof p!=="boolean"){throw new Error(`.mjsStrictNamespace must be a boolean, or undefined`)}const getAssertion=e=>o.template.expression.ast` + `;const l={ReferencedIdentifier(e){const{seen:t,buildImportReference:r,scope:s,imported:n,requeueInParent:o}=this;if(t.has(e.node))return;t.add(e.node);const i=e.node.name;const l=n.get(i);if(l){const t=e.scope.getBinding(i);const n=s.getBinding(i);if(n!==t)return;const c=r(l,e.node);c.loc=e.node.loc;if((e.parentPath.isCallExpression({callee:e.node})||e.parentPath.isOptionalCallExpression({callee:e.node})||e.parentPath.isTaggedTemplateExpression({tag:e.node}))&&a.isMemberExpression(c)){e.replaceWith(a.sequenceExpression([a.numericLiteral(0),c]))}else if(e.isJSXIdentifier()&&a.isMemberExpression(c)){const{object:t,property:r}=c;e.replaceWith(a.jsxMemberExpression(a.jsxIdentifier(t.name),a.jsxIdentifier(r.name)))}else{e.replaceWith(c)}o(e);e.skip()}},AssignmentExpression:{exit(e){const{scope:t,seen:r,imported:n,exported:o,requeueInParent:i,buildImportReference:l}=this;if(r.has(e.node))return;r.add(e.node);const c=e.get("left");if(c.isMemberExpression())return;if(c.isIdentifier()){const r=c.node.name;if(t.getBinding(r)!==e.scope.getBinding(r)){return}const u=o.get(r);const p=n.get(r);if((u==null?void 0:u.length)>0||p){s(e.node.operator==="=","Path was not simplified");const t=e.node;if(p){t.left=l(p,t.left);t.right=a.sequenceExpression([t.right,buildImportThrow(r)])}e.replaceWith(buildBindingExportAssignmentExpression(this.metadata,u,t));i(e)}}else{const r=c.getOuterBindingIdentifiers();const s=Object.keys(r).filter((r=>t.getBinding(r)===e.scope.getBinding(r)));const l=s.find((e=>n.has(e)));if(l){e.node.right=a.sequenceExpression([e.node.right,buildImportThrow(l)])}const u=[];s.forEach((e=>{const t=o.get(e)||[];if(t.length>0){u.push(buildBindingExportAssignmentExpression(this.metadata,t,a.identifier(e)))}}));if(u.length>0){let t=a.sequenceExpression(u);if(e.parentPath.isExpressionStatement()){t=a.expressionStatement(t);t._blockHoist=e.parentPath.node._blockHoist}const r=e.insertAfter(t)[0];i(r)}}}},"ForOfStatement|ForInStatement"(e){const{scope:t,node:r}=e;const{left:s}=r;const{exported:n,scope:o}=this;if(!a.isVariableDeclaration(s)){let r=false;const i=e.get("body");const l=i.scope;for(const e of Object.keys(a.getOuterBindingIdentifiers(s))){if(n.get(e)&&o.getBinding(e)===t.getBinding(e)){r=true;if(l.hasOwnBinding(e)){l.rename(e)}}}if(!r){return}const c=t.generateUidIdentifierBasedOnNode(s);i.unshiftContainer("body",a.expressionStatement(a.assignmentExpression("=",s,c)));e.get("left").replaceWith(a.variableDeclaration("let",[a.variableDeclarator(a.cloneNode(c))]));t.registerDeclaration(e.get("left"))}}}},9736:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteThis;var s=r(6833);var a=r(7369);var n=r(8622);function rewriteThis(e){(0,a.default)(e.node,Object.assign({},o,{noScope:true}))}const o=a.default.visitors.merge([s.environmentVisitor,{ThisExpression(e){e.replaceWith(n.unaryExpression("void",n.numericLiteral(0),true))}}])},1380:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},3667:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=simplifyAccess;var s=r(8622);function simplifyAccess(e,t){e.traverse(a,{scope:e.scope,bindingNames:t,seen:new WeakSet})}const a={UpdateExpression:{exit(e){const{scope:t,bindingNames:r}=this;const a=e.get("argument");if(!a.isIdentifier())return;const n=a.node.name;if(!r.has(n))return;if(t.getBinding(n)!==e.scope.getBinding(n)){return}if(e.parentPath.isExpressionStatement()&&!e.isCompletionRecord()){const t=e.node.operator=="++"?"+=":"-=";e.replaceWith(s.assignmentExpression(t,a.node,s.numericLiteral(1)))}else if(e.node.prefix){e.replaceWith(s.assignmentExpression("=",s.identifier(n),s.binaryExpression(e.node.operator[0],s.unaryExpression("+",a.node),s.numericLiteral(1))))}else{const t=e.scope.generateUidIdentifierBasedOnNode(a.node,"old");const r=t.name;e.scope.push({id:t});const n=s.binaryExpression(e.node.operator[0],s.identifier(r),s.numericLiteral(1));e.replaceWith(s.sequenceExpression([s.assignmentExpression("=",s.identifier(r),s.unaryExpression("+",a.node)),s.assignmentExpression("=",s.cloneNode(a.node),n),s.identifier(r)]))}}},AssignmentExpression:{exit(e){const{scope:t,seen:r,bindingNames:a}=this;if(e.node.operator==="=")return;if(r.has(e.node))return;r.add(e.node);const n=e.get("left");if(!n.isIdentifier())return;const o=n.node.name;if(!a.has(o))return;if(t.getBinding(o)!==e.scope.getBinding(o)){return}e.node.right=s.binaryExpression(e.node.operator.slice(0,-1),s.cloneNode(e.node.left),e.node.right);e.node.operator="="}}}},9417:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(9417);var a=r(7721)},7721:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},6186:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(457);var a=r(1056);var n=r(9553);var o=r(8304);var i=r(7047);var l=(0,s.declare)(((e,t)=>{var r,s,l;e.assertVersion(7);const c=(0,i.createDynamicImportTransform)(e);const{strictNamespace:u=false,mjsStrictNamespace:p=true,allowTopLevelThis:d,strict:f,strictMode:m,noInterop:y,importInterop:g,lazy:h=false,allowCommonJSExports:b=true}=t;const x=(r=e.assumption("constantReexports"))!=null?r:t.loose;const v=(s=e.assumption("enumerableModuleMeta"))!=null?s:t.loose;const E=(l=e.assumption("noIncompleteNsImportDetection"))!=null?l:false;if(typeof h!=="boolean"&&typeof h!=="function"&&(!Array.isArray(h)||!h.every((e=>typeof e==="string")))){throw new Error(`.lazy must be a boolean, array of strings, or a function`)}if(typeof u!=="boolean"){throw new Error(`.strictNamespace must be a boolean, or undefined`)}if(typeof p!=="boolean"){throw new Error(`.mjsStrictNamespace must be a boolean, or undefined`)}const getAssertion=e=>o.template.expression.ast` (function(){ throw new Error( "The CommonJS '" + "${e}" + "' variable is not available in ES6 modules." + "Consider setting setting sourceType:script or sourceType:unambiguous in your " + "Babel config for this file."); })() - `;const j={ReferencedIdentifier(e){const t=e.node.name;if(t!=="module"&&t!=="exports")return;const r=e.scope.getBinding(t);const s=this.scope.getBinding(t);if(s!==r||e.parentPath.isObjectProperty({value:e.node})&&e.parentPath.parentPath.isObjectPattern()||e.parentPath.isAssignmentExpression({left:e.node})||e.isAssignmentExpression({left:e.node})){return}e.replaceWith(getAssertion(t))},AssignmentExpression(e){const t=e.get("left");if(t.isIdentifier()){const t=e.node.name;if(t!=="module"&&t!=="exports")return;const r=e.scope.getBinding(t);const s=this.scope.getBinding(t);if(s!==r)return;const a=e.get("right");a.replaceWith(o.types.sequenceExpression([a.node,getAssertion(t)]))}else if(t.isPattern()){const r=t.getOuterBindingIdentifiers();const s=Object.keys(r).filter((t=>{if(t!=="module"&&t!=="exports")return false;return this.scope.getBinding(t)===e.scope.getBinding(t)}))[0];if(s){const t=e.get("right");t.replaceWith(o.types.sequenceExpression([t.node,getAssertion(s)]))}}}};return{name:"transform-modules-commonjs",pre(){this.file.set("@babel/plugin-transform-modules-*","commonjs")},visitor:{CallExpression(e){if(!this.file.has("@babel/plugin-proposal-dynamic-import"))return;if(!e.get("callee").isImport())return;let{scope:t}=e;do{t.rename("require")}while(t=t.parent);c(this,e.get("callee"))},Program:{exit(e,r){if(!(0,a.isModule)(e))return;e.scope.rename("exports");e.scope.rename("module");e.scope.rename("require");e.scope.rename("__filename");e.scope.rename("__dirname");if(!b){(0,n.default)(e,new Set(["module","exports"]));e.traverse(j,{scope:e.scope})}let s=(0,a.getModuleName)(this.file.opts,t);if(s)s=o.types.stringLiteral(s);const{meta:i,headers:l}=(0,a.rewriteModuleStatementsAndPrepareHeader)(e,{exportName:"exports",constantReexports:x,enumerableModuleMeta:v,strict:d,strictMode:m,allowTopLevelThis:f,noInterop:y,importInterop:g,lazy:h,esNamespaceOnly:typeof r.filename==="string"&&/\.mjs$/.test(r.filename)?p:u,noIncompleteNsImportDetection:E});for(const[t,r]of i.source){const s=o.types.callExpression(o.types.identifier("require"),[o.types.stringLiteral(t)]);let n;if((0,a.isSideEffectImport)(r)){if(r.lazy)throw new Error("Assertion failure");n=o.types.expressionStatement(s)}else{const t=(0,a.wrapInterop)(e,s,r.interop)||s;if(r.lazy){n=o.template.ast` + `;const j={ReferencedIdentifier(e){const t=e.node.name;if(t!=="module"&&t!=="exports")return;const r=e.scope.getBinding(t);const s=this.scope.getBinding(t);if(s!==r||e.parentPath.isObjectProperty({value:e.node})&&e.parentPath.parentPath.isObjectPattern()||e.parentPath.isAssignmentExpression({left:e.node})||e.isAssignmentExpression({left:e.node})){return}e.replaceWith(getAssertion(t))},AssignmentExpression(e){const t=e.get("left");if(t.isIdentifier()){const t=e.node.name;if(t!=="module"&&t!=="exports")return;const r=e.scope.getBinding(t);const s=this.scope.getBinding(t);if(s!==r)return;const a=e.get("right");a.replaceWith(o.types.sequenceExpression([a.node,getAssertion(t)]))}else if(t.isPattern()){const r=t.getOuterBindingIdentifiers();const s=Object.keys(r).filter((t=>{if(t!=="module"&&t!=="exports")return false;return this.scope.getBinding(t)===e.scope.getBinding(t)}))[0];if(s){const t=e.get("right");t.replaceWith(o.types.sequenceExpression([t.node,getAssertion(s)]))}}}};return{name:"transform-modules-commonjs",pre(){this.file.set("@babel/plugin-transform-modules-*","commonjs")},visitor:{CallExpression(e){if(!this.file.has("@babel/plugin-proposal-dynamic-import"))return;if(!e.get("callee").isImport())return;let{scope:t}=e;do{t.rename("require")}while(t=t.parent);c(this,e.get("callee"))},Program:{exit(e,r){if(!(0,a.isModule)(e))return;e.scope.rename("exports");e.scope.rename("module");e.scope.rename("require");e.scope.rename("__filename");e.scope.rename("__dirname");if(!b){(0,n.default)(e,new Set(["module","exports"]));e.traverse(j,{scope:e.scope})}let s=(0,a.getModuleName)(this.file.opts,t);if(s)s=o.types.stringLiteral(s);const{meta:i,headers:l}=(0,a.rewriteModuleStatementsAndPrepareHeader)(e,{exportName:"exports",constantReexports:x,enumerableModuleMeta:v,strict:f,strictMode:m,allowTopLevelThis:d,noInterop:y,importInterop:g,lazy:h,esNamespaceOnly:typeof r.filename==="string"&&/\.mjs$/.test(r.filename)?p:u,noIncompleteNsImportDetection:E});for(const[t,r]of i.source){const s=o.types.callExpression(o.types.identifier("require"),[o.types.stringLiteral(t)]);let n;if((0,a.isSideEffectImport)(r)){if(r.lazy)throw new Error("Assertion failure");n=o.types.expressionStatement(s)}else{const t=(0,a.wrapInterop)(e,s,r.interop)||s;if(r.lazy){n=o.template.ast` function ${r.name}() { const data = ${t}; ${r.name} = function(){ return data; }; @@ -158,7 +233,7 @@ } `}else{n=o.template.ast` var ${r.name} = ${t}; - `}}n.loc=r.loc;l.push(n);l.push(...(0,a.buildNamespaceInitStatements)(i,r,x))}(0,a.ensureStatementsHoisted)(l);e.unshiftContainer("body",l)}}}}}));t["default"]=l},409:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(8622);function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach((function(r){if(r!=="default"){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:true,get:function(){return e[r]}})}}))}t["default"]=e;return Object.freeze(t)}var a=_interopNamespace(s);function willPathCastToBoolean(e){const t=e;const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}class AssignmentMemoiser{constructor(){this._map=void 0;this._map=new WeakMap}has(e){return this._map.has(e)}get(e){if(!this.has(e))return;const t=this._map.get(e);const{value:r}=t;t.count--;if(t.count===0){return a.assignmentExpression("=",r,e)}return r}set(e,t,r){return this._map.set(e,{count:r,value:t})}}function toNonOptional(e,t){const{node:r}=e;if(a.isOptionalMemberExpression(r)){return a.memberExpression(t,r.property,r.computed)}if(e.isOptionalCallExpression()){const r=e.get("callee");if(e.node.optional&&r.isOptionalMemberExpression()){const{object:s}=r.node;const n=e.scope.maybeGenerateMemoised(s)||s;r.get("object").replaceWith(a.assignmentExpression("=",n,s));return a.callExpression(a.memberExpression(t,a.identifier("call")),[n,...e.node.arguments])}return a.callExpression(t,e.node.arguments)}return e.node}function isInDetachedTree(e){while(e){if(e.isProgram())break;const{parentPath:t,container:r,listKey:s}=e;const a=t.node;if(s){if(r!==a[s])return true}else{if(r!==a)return true}e=t}return false}const n={memoise(){},handle(e,t){const{node:r,parent:s,parentPath:n,scope:o}=e;if(e.isOptionalMemberExpression()){if(isInDetachedTree(e))return;const i=e.find((({node:t,parent:r})=>{if(a.isOptionalMemberExpression(r)){return r.optional||r.object!==t}if(a.isOptionalCallExpression(r)){return t!==e.node&&r.optional||r.callee!==t}return true}));if(o.path.isPattern()){i.replaceWith(a.callExpression(a.arrowFunctionExpression([],i.node),[]));return}const l=willPathCastToBoolean(i);const c=i.parentPath;if(c.isUpdateExpression({argument:r})||c.isAssignmentExpression({left:r})){throw e.buildCodeFrameError(`can't handle assignment`)}const u=c.isUnaryExpression({operator:"delete"});if(u&&i.isOptionalMemberExpression()&&i.get("property").isPrivateName()){throw e.buildCodeFrameError(`can't delete a private class element`)}let p=e;for(;;){if(p.isOptionalMemberExpression()){if(p.node.optional)break;p=p.get("object");continue}else if(p.isOptionalCallExpression()){if(p.node.optional)break;p=p.get("callee");continue}throw new Error(`Internal error: unexpected ${p.node.type}`)}const f=p.isOptionalMemberExpression()?"object":"callee";const d=p.node[f];const m=o.maybeGenerateMemoised(d);const y=m!=null?m:d;const g=n.isOptionalCallExpression({callee:r});const isOptionalCall=e=>g;const h=n.isCallExpression({callee:r});p.replaceWith(toNonOptional(p,y));if(isOptionalCall()){if(s.optional){n.replaceWith(this.optionalCall(e,s.arguments))}else{n.replaceWith(this.call(e,s.arguments))}}else if(h){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}let b=e.node;for(let t=e;t!==i;){const e=t.parentPath;if(e===i&&isOptionalCall()&&s.optional){b=e.node;break}b=toNonOptional(e,b);t=e}let x;const v=i.parentPath;if(a.isMemberExpression(b)&&v.isOptionalCallExpression({callee:i.node,optional:true})){const{object:t}=b;x=e.scope.maybeGenerateMemoised(t);if(x){b.object=a.assignmentExpression("=",x,t)}}let E=i;if(u){E=v;b=v.node}const j=m?a.assignmentExpression("=",a.cloneNode(y),a.cloneNode(d)):a.cloneNode(y);if(l){let e;if(t){e=a.binaryExpression("!=",j,a.nullLiteral())}else{e=a.logicalExpression("&&",a.binaryExpression("!==",j,a.nullLiteral()),a.binaryExpression("!==",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.logicalExpression("&&",e,b))}else{let e;if(t){e=a.binaryExpression("==",j,a.nullLiteral())}else{e=a.logicalExpression("||",a.binaryExpression("===",j,a.nullLiteral()),a.binaryExpression("===",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.conditionalExpression(e,u?a.booleanLiteral(true):o.buildUndefinedNode(),b))}if(x){const e=v.node;v.replaceWith(a.optionalCallExpression(a.optionalMemberExpression(e.callee,a.identifier("call"),false,true),[a.cloneNode(x),...e.arguments],false))}return}if(a.isUpdateExpression(s,{argument:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,prefix:o}=s;this.memoise(e,2);const i=a.binaryExpression(t[0],a.unaryExpression("+",this.get(e)),a.numericLiteral(1));if(o){n.replaceWith(this.set(e,i))}else{const{scope:t}=e;const s=t.generateUidIdentifierBasedOnNode(r);t.push({id:s});i.left=a.assignmentExpression("=",a.cloneNode(s),i.left);n.replaceWith(a.sequenceExpression([this.set(e,i),a.cloneNode(s)]))}return}if(n.isAssignmentExpression({left:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,right:r}=n.node;if(t==="="){n.replaceWith(this.set(e,r))}else{const s=t.slice(0,-1);if(a.LOGICAL_OPERATORS.includes(s)){this.memoise(e,1);n.replaceWith(a.logicalExpression(s,this.get(e),this.set(e,r)))}else{this.memoise(e,2);n.replaceWith(this.set(e,a.binaryExpression(s,this.get(e),r)))}}return}if(n.isCallExpression({callee:r})){n.replaceWith(this.call(e,n.node.arguments));return}if(n.isOptionalCallExpression({callee:r})){if(o.path.isPattern()){n.replaceWith(a.callExpression(a.arrowFunctionExpression([],n.node),[]));return}n.replaceWith(this.optionalCall(e,n.node.arguments));return}if(n.isForXStatement({left:r})||n.isObjectProperty({value:r})&&n.parentPath.isObjectPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isObjectProperty({value:s})&&n.parentPath.parentPath.isObjectPattern()||n.isArrayPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isArrayPattern()||n.isRestElement()){e.replaceWith(this.destructureSet(e));return}if(n.isTaggedTemplateExpression()){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}}};function memberExpressionToFunctions(e,t,r){e.traverse(t,Object.assign({},n,r,{memoiser:new AssignmentMemoiser}))}t["default"]=memberExpressionToFunctions},939:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=getModuleName;{const e=getModuleName;t["default"]=getModuleName=function getModuleName(t,r){var s,a,n,o;return e(t,{moduleId:(s=r.moduleId)!=null?s:t.moduleId,moduleIds:(a=r.moduleIds)!=null?a:t.moduleIds,getModuleId:(n=r.getModuleId)!=null?n:t.getModuleId,moduleRoot:(o=r.moduleRoot)!=null?o:t.moduleRoot})}}function getModuleName(e,t){const{filename:r,filenameRelative:s=r,sourceRoot:a=t.moduleRoot}=e;const{moduleId:n,moduleIds:o=!!n,getModuleId:i,moduleRoot:l=a}=t;if(!o)return null;if(n!=null&&!i){return n}let c=l!=null?l+"/":"";if(s){const e=a!=null?new RegExp("^"+a+"/?"):"";c+=s.replace(e,"").replace(/\.(\w*?)$/,"")}c=c.replace(/\\/g,"/");if(i){return i(c)||c}else{return c}}},1056:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.rewriteModuleStatementsAndPrepareHeader=rewriteModuleStatementsAndPrepareHeader;t.ensureStatementsHoisted=ensureStatementsHoisted;t.wrapInterop=wrapInterop;t.buildNamespaceInitStatements=buildNamespaceInitStatements;Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return o.isModule}});Object.defineProperty(t,"rewriteThis",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"hasExports",{enumerable:true,get:function(){return c.hasExports}});Object.defineProperty(t,"isSideEffectImport",{enumerable:true,get:function(){return c.isSideEffectImport}});Object.defineProperty(t,"getModuleName",{enumerable:true,get:function(){return u.default}});var s=r(9491);var a=r(8622);var n=r(153);var o=r(9115);var i=r(8831);var l=r(9955);var c=r(6832);var u=r(939);function rewriteModuleStatementsAndPrepareHeader(e,{loose:t,exportName:r,strict:n,allowTopLevelThis:u,strictMode:p,noInterop:f,importInterop:d=(f?"none":"babel"),lazy:m,esNamespaceOnly:y,constantReexports:g=t,enumerableModuleMeta:h=t,noIncompleteNsImportDetection:b}){(0,c.validateImportInteropOption)(d);s((0,o.isModule)(e),"Cannot process module statements in a script");e.node.sourceType="script";const x=(0,c.default)(e,r,{importInterop:d,initializeReexports:g,lazy:m,esNamespaceOnly:y});if(!u){(0,i.default)(e)}(0,l.default)(e,x);if(p!==false){const t=e.node.directives.some((e=>e.value.value==="use strict"));if(!t){e.unshiftContainer("directives",a.directive(a.directiveLiteral("use strict")))}}const v=[];if((0,c.hasExports)(x)&&!n){v.push(buildESModuleHeader(x,h))}const E=buildExportNameListDeclaration(e,x);if(E){x.exportNameListName=E.name;v.push(E.statement)}v.push(...buildExportInitializationStatements(e,x,g,b));return{meta:x,headers:v}}function ensureStatementsHoisted(e){e.forEach((e=>{e._blockHoist=3}))}function wrapInterop(e,t,r){if(r==="none"){return null}if(r==="node-namespace"){return a.callExpression(e.hub.addHelper("interopRequireWildcard"),[t,a.booleanLiteral(true)])}else if(r==="node-default"){return null}let s;if(r==="default"){s="interopRequireDefault"}else if(r==="namespace"){s="interopRequireWildcard"}else{throw new Error(`Unknown interop: ${r}`)}return a.callExpression(e.hub.addHelper(s),[t])}function buildNamespaceInitStatements(e,t,r=false){const s=[];let o=a.identifier(t.name);if(t.lazy)o=a.callExpression(o,[]);for(const e of t.importsNamespace){if(e===t.name)continue;s.push(n.default.statement`var NAME = SOURCE;`({NAME:e,SOURCE:a.cloneNode(o)}))}if(r){s.push(...buildReexportsFromMeta(e,t,true))}for(const r of t.reexportNamespace){s.push((t.lazy?n.default.statement` + `}}n.loc=r.loc;l.push(n);l.push(...(0,a.buildNamespaceInitStatements)(i,r,x))}(0,a.ensureStatementsHoisted)(l);e.unshiftContainer("body",l)}}}}}));t["default"]=l},409:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(8622);function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach((function(r){if(r!=="default"){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:true,get:function(){return e[r]}})}}))}t["default"]=e;return Object.freeze(t)}var a=_interopNamespace(s);function willPathCastToBoolean(e){const t=e;const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}class AssignmentMemoiser{constructor(){this._map=void 0;this._map=new WeakMap}has(e){return this._map.has(e)}get(e){if(!this.has(e))return;const t=this._map.get(e);const{value:r}=t;t.count--;if(t.count===0){return a.assignmentExpression("=",r,e)}return r}set(e,t,r){return this._map.set(e,{count:r,value:t})}}function toNonOptional(e,t){const{node:r}=e;if(a.isOptionalMemberExpression(r)){return a.memberExpression(t,r.property,r.computed)}if(e.isOptionalCallExpression()){const r=e.get("callee");if(e.node.optional&&r.isOptionalMemberExpression()){const{object:s}=r.node;const n=e.scope.maybeGenerateMemoised(s)||s;r.get("object").replaceWith(a.assignmentExpression("=",n,s));return a.callExpression(a.memberExpression(t,a.identifier("call")),[n,...e.node.arguments])}return a.callExpression(t,e.node.arguments)}return e.node}function isInDetachedTree(e){while(e){if(e.isProgram())break;const{parentPath:t,container:r,listKey:s}=e;const a=t.node;if(s){if(r!==a[s])return true}else{if(r!==a)return true}e=t}return false}const n={memoise(){},handle(e,t){const{node:r,parent:s,parentPath:n,scope:o}=e;if(e.isOptionalMemberExpression()){if(isInDetachedTree(e))return;const i=e.find((({node:t,parent:r})=>{if(a.isOptionalMemberExpression(r)){return r.optional||r.object!==t}if(a.isOptionalCallExpression(r)){return t!==e.node&&r.optional||r.callee!==t}return true}));if(o.path.isPattern()){i.replaceWith(a.callExpression(a.arrowFunctionExpression([],i.node),[]));return}const l=willPathCastToBoolean(i);const c=i.parentPath;if(c.isUpdateExpression({argument:r})||c.isAssignmentExpression({left:r})){throw e.buildCodeFrameError(`can't handle assignment`)}const u=c.isUnaryExpression({operator:"delete"});if(u&&i.isOptionalMemberExpression()&&i.get("property").isPrivateName()){throw e.buildCodeFrameError(`can't delete a private class element`)}let p=e;for(;;){if(p.isOptionalMemberExpression()){if(p.node.optional)break;p=p.get("object");continue}else if(p.isOptionalCallExpression()){if(p.node.optional)break;p=p.get("callee");continue}throw new Error(`Internal error: unexpected ${p.node.type}`)}const d=p.isOptionalMemberExpression()?"object":"callee";const f=p.node[d];const m=o.maybeGenerateMemoised(f);const y=m!=null?m:f;const g=n.isOptionalCallExpression({callee:r});const isOptionalCall=e=>g;const h=n.isCallExpression({callee:r});p.replaceWith(toNonOptional(p,y));if(isOptionalCall()){if(s.optional){n.replaceWith(this.optionalCall(e,s.arguments))}else{n.replaceWith(this.call(e,s.arguments))}}else if(h){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}let b=e.node;for(let t=e;t!==i;){const e=t.parentPath;if(e===i&&isOptionalCall()&&s.optional){b=e.node;break}b=toNonOptional(e,b);t=e}let x;const v=i.parentPath;if(a.isMemberExpression(b)&&v.isOptionalCallExpression({callee:i.node,optional:true})){const{object:t}=b;x=e.scope.maybeGenerateMemoised(t);if(x){b.object=a.assignmentExpression("=",x,t)}}let E=i;if(u){E=v;b=v.node}const j=m?a.assignmentExpression("=",a.cloneNode(y),a.cloneNode(f)):a.cloneNode(y);if(l){let e;if(t){e=a.binaryExpression("!=",j,a.nullLiteral())}else{e=a.logicalExpression("&&",a.binaryExpression("!==",j,a.nullLiteral()),a.binaryExpression("!==",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.logicalExpression("&&",e,b))}else{let e;if(t){e=a.binaryExpression("==",j,a.nullLiteral())}else{e=a.logicalExpression("||",a.binaryExpression("===",j,a.nullLiteral()),a.binaryExpression("===",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.conditionalExpression(e,u?a.booleanLiteral(true):o.buildUndefinedNode(),b))}if(x){const e=v.node;v.replaceWith(a.optionalCallExpression(a.optionalMemberExpression(e.callee,a.identifier("call"),false,true),[a.cloneNode(x),...e.arguments],false))}return}if(a.isUpdateExpression(s,{argument:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,prefix:o}=s;this.memoise(e,2);const i=a.binaryExpression(t[0],a.unaryExpression("+",this.get(e)),a.numericLiteral(1));if(o){n.replaceWith(this.set(e,i))}else{const{scope:t}=e;const s=t.generateUidIdentifierBasedOnNode(r);t.push({id:s});i.left=a.assignmentExpression("=",a.cloneNode(s),i.left);n.replaceWith(a.sequenceExpression([this.set(e,i),a.cloneNode(s)]))}return}if(n.isAssignmentExpression({left:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,right:r}=n.node;if(t==="="){n.replaceWith(this.set(e,r))}else{const s=t.slice(0,-1);if(a.LOGICAL_OPERATORS.includes(s)){this.memoise(e,1);n.replaceWith(a.logicalExpression(s,this.get(e),this.set(e,r)))}else{this.memoise(e,2);n.replaceWith(this.set(e,a.binaryExpression(s,this.get(e),r)))}}return}if(n.isCallExpression({callee:r})){n.replaceWith(this.call(e,n.node.arguments));return}if(n.isOptionalCallExpression({callee:r})){if(o.path.isPattern()){n.replaceWith(a.callExpression(a.arrowFunctionExpression([],n.node),[]));return}n.replaceWith(this.optionalCall(e,n.node.arguments));return}if(n.isForXStatement({left:r})||n.isObjectProperty({value:r})&&n.parentPath.isObjectPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isObjectProperty({value:s})&&n.parentPath.parentPath.isObjectPattern()||n.isArrayPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isArrayPattern()||n.isRestElement()){e.replaceWith(this.destructureSet(e));return}if(n.isTaggedTemplateExpression()){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}}};function memberExpressionToFunctions(e,t,r){e.traverse(t,Object.assign({},n,r,{memoiser:new AssignmentMemoiser}))}t["default"]=memberExpressionToFunctions},939:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=getModuleName;{const e=getModuleName;t["default"]=getModuleName=function getModuleName(t,r){var s,a,n,o;return e(t,{moduleId:(s=r.moduleId)!=null?s:t.moduleId,moduleIds:(a=r.moduleIds)!=null?a:t.moduleIds,getModuleId:(n=r.getModuleId)!=null?n:t.getModuleId,moduleRoot:(o=r.moduleRoot)!=null?o:t.moduleRoot})}}function getModuleName(e,t){const{filename:r,filenameRelative:s=r,sourceRoot:a=t.moduleRoot}=e;const{moduleId:n,moduleIds:o=!!n,getModuleId:i,moduleRoot:l=a}=t;if(!o)return null;if(n!=null&&!i){return n}let c=l!=null?l+"/":"";if(s){const e=a!=null?new RegExp("^"+a+"/?"):"";c+=s.replace(e,"").replace(/\.(\w*?)$/,"")}c=c.replace(/\\/g,"/");if(i){return i(c)||c}else{return c}}},1056:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.rewriteModuleStatementsAndPrepareHeader=rewriteModuleStatementsAndPrepareHeader;t.ensureStatementsHoisted=ensureStatementsHoisted;t.wrapInterop=wrapInterop;t.buildNamespaceInitStatements=buildNamespaceInitStatements;Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return o.isModule}});Object.defineProperty(t,"rewriteThis",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"hasExports",{enumerable:true,get:function(){return c.hasExports}});Object.defineProperty(t,"isSideEffectImport",{enumerable:true,get:function(){return c.isSideEffectImport}});Object.defineProperty(t,"getModuleName",{enumerable:true,get:function(){return u.default}});var s=r(9491);var a=r(8622);var n=r(153);var o=r(6039);var i=r(8831);var l=r(9955);var c=r(6832);var u=r(939);function rewriteModuleStatementsAndPrepareHeader(e,{loose:t,exportName:r,strict:n,allowTopLevelThis:u,strictMode:p,noInterop:d,importInterop:f=(d?"none":"babel"),lazy:m,esNamespaceOnly:y,constantReexports:g=t,enumerableModuleMeta:h=t,noIncompleteNsImportDetection:b}){(0,c.validateImportInteropOption)(f);s((0,o.isModule)(e),"Cannot process module statements in a script");e.node.sourceType="script";const x=(0,c.default)(e,r,{importInterop:f,initializeReexports:g,lazy:m,esNamespaceOnly:y});if(!u){(0,i.default)(e)}(0,l.default)(e,x);if(p!==false){const t=e.node.directives.some((e=>e.value.value==="use strict"));if(!t){e.unshiftContainer("directives",a.directive(a.directiveLiteral("use strict")))}}const v=[];if((0,c.hasExports)(x)&&!n){v.push(buildESModuleHeader(x,h))}const E=buildExportNameListDeclaration(e,x);if(E){x.exportNameListName=E.name;v.push(E.statement)}v.push(...buildExportInitializationStatements(e,x,g,b));return{meta:x,headers:v}}function ensureStatementsHoisted(e){e.forEach((e=>{e._blockHoist=3}))}function wrapInterop(e,t,r){if(r==="none"){return null}if(r==="node-namespace"){return a.callExpression(e.hub.addHelper("interopRequireWildcard"),[t,a.booleanLiteral(true)])}else if(r==="node-default"){return null}let s;if(r==="default"){s="interopRequireDefault"}else if(r==="namespace"){s="interopRequireWildcard"}else{throw new Error(`Unknown interop: ${r}`)}return a.callExpression(e.hub.addHelper(s),[t])}function buildNamespaceInitStatements(e,t,r=false){const s=[];let o=a.identifier(t.name);if(t.lazy)o=a.callExpression(o,[]);for(const e of t.importsNamespace){if(e===t.name)continue;s.push(n.default.statement`var NAME = SOURCE;`({NAME:e,SOURCE:a.cloneNode(o)}))}if(r){s.push(...buildReexportsFromMeta(e,t,true))}for(const r of t.reexportNamespace){s.push((t.lazy?n.default.statement` Object.defineProperty(EXPORTS, "NAME", { enumerable: true, get: function() { @@ -201,11 +276,11 @@ }); `)({NAMESPACE:t,EXPORTS:e.exportName,VERIFY_NAME_LIST:e.exportNameListName?(0,n.default)` if (Object.prototype.hasOwnProperty.call(EXPORTS_LIST, key)) return; - `({EXPORTS_LIST:e.exportNameListName}):null})}function buildExportNameListDeclaration(e,t){const r=Object.create(null);for(const e of t.local.values()){for(const t of e.names){r[t]=true}}let s=false;for(const e of t.source.values()){for(const t of e.reexports.keys()){r[t]=true}for(const t of e.reexportNamespace){r[t]=true}s=s||!!e.reexportAll}if(!s||Object.keys(r).length===0)return null;const n=e.scope.generateUidIdentifier("exportNames");delete r.default;return{name:n.name,statement:a.variableDeclaration("var",[a.variableDeclarator(n,a.valueToNode(r))])}}function buildExportInitializationStatements(e,t,r=false,s=false){const n=[];const o=[];for(const[e,r]of t.local){if(r.kind==="import"){}else if(r.kind==="hoisted"){n.push(buildInitStatement(t,r.names,a.identifier(e)))}else{o.push(...r.names)}}for(const e of t.source.values()){if(!r){n.push(...buildReexportsFromMeta(t,e,false))}for(const t of e.reexportNamespace){o.push(t)}}if(!s){n.push(...chunk(o,100).map((r=>buildInitStatement(t,r,e.scope.buildUndefinedNode()))))}return n}const f={computed:n.default.expression`EXPORTS["NAME"] = VALUE`,default:n.default.expression`EXPORTS.NAME = VALUE`};function buildInitStatement(e,t,r){const{stringSpecifiers:s,exportName:n}=e;return a.expressionStatement(t.reduce(((e,t)=>{const r={EXPORTS:n,NAME:t,VALUE:e};if(s.has(t)){return f.computed(r)}else{return f.default(r)}}),r))}function chunk(e,t){const r=[];for(let s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasExports=hasExports;t.isSideEffectImport=isSideEffectImport;t.validateImportInteropOption=validateImportInteropOption;t["default"]=normalizeModuleAndLoadMetadata;var s=r(1017);var a=r(1826);var n=r(7058);function hasExports(e){return e.hasExports}function isSideEffectImport(e){return e.imports.size===0&&e.importsNamespace.size===0&&e.reexports.size===0&&e.reexportNamespace.size===0&&!e.reexportAll}function validateImportInteropOption(e){if(typeof e!=="function"&&e!=="none"&&e!=="babel"&&e!=="node"){throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${e}).`)}return e}function resolveImportInterop(e,t){if(typeof e==="function"){return validateImportInteropOption(e(t))}return e}function normalizeModuleAndLoadMetadata(e,t,{importInterop:r,initializeReexports:s=false,lazy:a=false,esNamespaceOnly:n=false}){if(!t){t=e.scope.generateUidIdentifier("exports").name}const o=new Set;nameAnonymousExports(e);const{local:i,source:l,hasExports:c}=getModuleMetadata(e,{initializeReexports:s,lazy:a},o);removeModuleDeclarations(e);for(const[,e]of l){if(e.importsNamespace.size>0){e.name=e.importsNamespace.values().next().value}const t=resolveImportInterop(r,e.source);if(t==="none"){e.interop="none"}else if(t==="node"&&e.interop==="namespace"){e.interop="node-namespace"}else if(t==="node"&&e.interop==="default"){e.interop="node-default"}else if(n&&e.interop==="namespace"){e.interop="default"}}return{exportName:t,exportNameListName:null,hasExports:c,local:i,source:l,stringSpecifiers:o}}function getExportSpecifierName(e,t){if(e.isIdentifier()){return e.node.name}else if(e.isStringLiteral()){const r=e.node.value;if(!(0,a.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.node.type}`)}}function assertExportSpecifier(e){if(e.isExportSpecifier()){return}else if(e.isExportNamespaceSpecifier()){throw e.buildCodeFrameError("Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.")}else{throw e.buildCodeFrameError("Unexpected export specifier type")}}function getModuleMetadata(e,{lazy:t,initializeReexports:r},a){const n=getLocalExportMetadata(e,r,a);const o=new Map;const getData=t=>{const r=t.value;let a=o.get(r);if(!a){a={name:e.scope.generateUidIdentifier((0,s.basename)(r,(0,s.extname)(r))).name,interop:"none",loc:null,imports:new Map,importsNamespace:new Set,reexports:new Map,reexportNamespace:new Set,reexportAll:null,lazy:false,source:r};o.set(r,a)}return a};let i=false;e.get("body").forEach((e=>{if(e.isImportDeclaration()){const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{if(e.isImportDefaultSpecifier()){const r=e.get("local").node.name;t.imports.set(r,"default");const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexports.set(e,"default")}))}}else if(e.isImportNamespaceSpecifier()){const r=e.get("local").node.name;t.importsNamespace.add(r);const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexportNamespace.add(e)}))}}else if(e.isImportSpecifier()){const r=getExportSpecifierName(e.get("imported"),a);const s=e.get("local").node.name;t.imports.set(s,r);const o=n.get(s);if(o){n.delete(s);o.names.forEach((e=>{t.reexports.set(e,r)}))}}}))}else if(e.isExportAllDeclaration()){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;t.reexportAll={loc:e.node.loc}}else if(e.isExportNamedDeclaration()&&e.node.source){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{assertExportSpecifier(e);const r=getExportSpecifierName(e.get("local"),a);const s=getExportSpecifierName(e.get("exported"),a);t.reexports.set(s,r);if(s==="__esModule"){throw e.get("exported").buildCodeFrameError('Illegal export "__esModule".')}}))}else if(e.isExportNamedDeclaration()||e.isExportDefaultDeclaration()){i=true}}));for(const e of o.values()){let t=false;let r=false;if(e.importsNamespace.size>0){t=true;r=true}if(e.reexportAll){r=true}for(const s of e.imports.values()){if(s==="default")t=true;else r=true}for(const s of e.reexports.values()){if(s==="default")t=true;else r=true}if(t&&r){e.interop="namespace"}else if(t){e.interop="default"}}for(const[e,r]of o){if(t!==false&&!(isSideEffectImport(r)||r.reexportAll)){if(t===true){r.lazy=!/\./.test(e)}else if(Array.isArray(t)){r.lazy=t.indexOf(e)!==-1}else if(typeof t==="function"){r.lazy=t(e)}else{throw new Error(`.lazy must be a boolean, string array, or function`)}}}return{hasExports:i,local:n,source:o}}function getLocalExportMetadata(e,t,r){const s=new Map;e.get("body").forEach((e=>{let r;if(e.isImportDeclaration()){r="import"}else{if(e.isExportDefaultDeclaration())e=e.get("declaration");if(e.isExportNamedDeclaration()){if(e.node.declaration){e=e.get("declaration")}else if(t&&e.node.source&&e.get("source").isStringLiteral()){e.get("specifiers").forEach((e=>{assertExportSpecifier(e);s.set(e.get("local").node.name,"block")}));return}}if(e.isFunctionDeclaration()){r="hoisted"}else if(e.isClassDeclaration()){r="block"}else if(e.isVariableDeclaration({kind:"var"})){r="var"}else if(e.isVariableDeclaration()){r="block"}else{return}}Object.keys(e.getOuterBindingIdentifiers()).forEach((e=>{s.set(e,r)}))}));const a=new Map;const getLocalMetadata=e=>{const t=e.node.name;let r=a.get(t);if(!r){const n=s.get(t);if(n===undefined){throw e.buildCodeFrameError(`Exporting local "${t}", which is not declared.`)}r={names:[],kind:n};a.set(t,r)}return r};e.get("body").forEach((e=>{if(e.isExportNamedDeclaration()&&(t||!e.node.source)){if(e.node.declaration){const t=e.get("declaration");const r=t.getOuterBindingIdentifierPaths();Object.keys(r).forEach((e=>{if(e==="__esModule"){throw t.buildCodeFrameError('Illegal export "__esModule".')}getLocalMetadata(r[e]).names.push(e)}))}else{e.get("specifiers").forEach((e=>{const t=e.get("local");const s=e.get("exported");const a=getLocalMetadata(t);const n=getExportSpecifierName(s,r);if(n==="__esModule"){throw s.buildCodeFrameError('Illegal export "__esModule".')}a.names.push(n)}))}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){getLocalMetadata(t.get("id")).names.push("default")}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}}));return a}function nameAnonymousExports(e){e.get("body").forEach((e=>{if(!e.isExportDefaultDeclaration())return;(0,n.default)(e)}))}function removeModuleDeclarations(e){e.get("body").forEach((e=>{if(e.isImportDeclaration()){e.remove()}else if(e.isExportNamedDeclaration()){if(e.node.declaration){e.node.declaration._blockHoist=e.node._blockHoist;e.replaceWith(e.node.declaration)}else{e.remove()}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){t._blockHoist=e.node._blockHoist;e.replaceWith(t)}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}else if(e.isExportAllDeclaration()){e.remove()}}))}},9955:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteLiveReferences;var s=r(9491);var a=r(8622);var n=r(153);var o=r(9553);function rewriteLiveReferences(e,t){const r=new Map;const s=new Map;const requeueInParent=t=>{e.requeue(t)};for(const[e,s]of t.source){for(const[t,a]of s.imports){r.set(t,[e,a,null])}for(const t of s.importsNamespace){r.set(t,[e,null,t])}}for(const[e,r]of t.local){let t=s.get(e);if(!t){t=[];s.set(e,t)}t.push(...r.names)}const n={metadata:t,requeueInParent:requeueInParent,scope:e.scope,exported:s};e.traverse(i,n);(0,o.default)(e,new Set([...Array.from(r.keys()),...Array.from(s.keys())]));const c={seen:new WeakSet,metadata:t,requeueInParent:requeueInParent,scope:e.scope,imported:r,exported:s,buildImportReference:([e,r,s],n)=>{const o=t.source.get(e);if(s){if(o.lazy)n=a.callExpression(n,[]);return n}let i=a.identifier(o.name);if(o.lazy)i=a.callExpression(i,[]);if(r==="default"&&o.interop==="node-default"){return i}const l=t.stringSpecifiers.has(r);return a.memberExpression(i,l?a.stringLiteral(r):a.identifier(r),l)}};e.traverse(l,c)}const i={Scope(e){e.skip()},ClassDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;const{id:n}=e.node;if(!n)throw new Error("Expected class to have a name");const o=n.name;const i=r.get(o)||[];if(i.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,i,a.identifier(o)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}},VariableDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;Object.keys(e.getOuterBindingIdentifiers()).forEach((n=>{const o=r.get(n)||[];if(o.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,o,a.identifier(n)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}}))}};const buildBindingExportAssignmentExpression=(e,t,r)=>(t||[]).reduce(((t,r)=>{const{stringSpecifiers:s}=e;const n=s.has(r);return a.assignmentExpression("=",a.memberExpression(a.identifier(e.exportName),n?a.stringLiteral(r):a.identifier(r),n),t)}),r);const buildImportThrow=e=>n.default.expression.ast` + `({EXPORTS_LIST:e.exportNameListName}):null})}function buildExportNameListDeclaration(e,t){const r=Object.create(null);for(const e of t.local.values()){for(const t of e.names){r[t]=true}}let s=false;for(const e of t.source.values()){for(const t of e.reexports.keys()){r[t]=true}for(const t of e.reexportNamespace){r[t]=true}s=s||!!e.reexportAll}if(!s||Object.keys(r).length===0)return null;const n=e.scope.generateUidIdentifier("exportNames");delete r.default;return{name:n.name,statement:a.variableDeclaration("var",[a.variableDeclarator(n,a.valueToNode(r))])}}function buildExportInitializationStatements(e,t,r=false,s=false){const n=[];const o=[];for(const[e,r]of t.local){if(r.kind==="import"){}else if(r.kind==="hoisted"){n.push(buildInitStatement(t,r.names,a.identifier(e)))}else{o.push(...r.names)}}for(const e of t.source.values()){if(!r){n.push(...buildReexportsFromMeta(t,e,false))}for(const t of e.reexportNamespace){o.push(t)}}if(!s){n.push(...chunk(o,100).map((r=>buildInitStatement(t,r,e.scope.buildUndefinedNode()))))}return n}const d={computed:n.default.expression`EXPORTS["NAME"] = VALUE`,default:n.default.expression`EXPORTS.NAME = VALUE`};function buildInitStatement(e,t,r){const{stringSpecifiers:s,exportName:n}=e;return a.expressionStatement(t.reduce(((e,t)=>{const r={EXPORTS:n,NAME:t,VALUE:e};if(s.has(t)){return d.computed(r)}else{return d.default(r)}}),r))}function chunk(e,t){const r=[];for(let s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasExports=hasExports;t.isSideEffectImport=isSideEffectImport;t.validateImportInteropOption=validateImportInteropOption;t["default"]=normalizeModuleAndLoadMetadata;var s=r(1017);var a=r(1826);var n=r(7058);function hasExports(e){return e.hasExports}function isSideEffectImport(e){return e.imports.size===0&&e.importsNamespace.size===0&&e.reexports.size===0&&e.reexportNamespace.size===0&&!e.reexportAll}function validateImportInteropOption(e){if(typeof e!=="function"&&e!=="none"&&e!=="babel"&&e!=="node"){throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${e}).`)}return e}function resolveImportInterop(e,t){if(typeof e==="function"){return validateImportInteropOption(e(t))}return e}function normalizeModuleAndLoadMetadata(e,t,{importInterop:r,initializeReexports:s=false,lazy:a=false,esNamespaceOnly:n=false}){if(!t){t=e.scope.generateUidIdentifier("exports").name}const o=new Set;nameAnonymousExports(e);const{local:i,source:l,hasExports:c}=getModuleMetadata(e,{initializeReexports:s,lazy:a},o);removeModuleDeclarations(e);for(const[,e]of l){if(e.importsNamespace.size>0){e.name=e.importsNamespace.values().next().value}const t=resolveImportInterop(r,e.source);if(t==="none"){e.interop="none"}else if(t==="node"&&e.interop==="namespace"){e.interop="node-namespace"}else if(t==="node"&&e.interop==="default"){e.interop="node-default"}else if(n&&e.interop==="namespace"){e.interop="default"}}return{exportName:t,exportNameListName:null,hasExports:c,local:i,source:l,stringSpecifiers:o}}function getExportSpecifierName(e,t){if(e.isIdentifier()){return e.node.name}else if(e.isStringLiteral()){const r=e.node.value;if(!(0,a.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.node.type}`)}}function assertExportSpecifier(e){if(e.isExportSpecifier()){return}else if(e.isExportNamespaceSpecifier()){throw e.buildCodeFrameError("Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.")}else{throw e.buildCodeFrameError("Unexpected export specifier type")}}function getModuleMetadata(e,{lazy:t,initializeReexports:r},a){const n=getLocalExportMetadata(e,r,a);const o=new Map;const getData=t=>{const r=t.value;let a=o.get(r);if(!a){a={name:e.scope.generateUidIdentifier((0,s.basename)(r,(0,s.extname)(r))).name,interop:"none",loc:null,imports:new Map,importsNamespace:new Set,reexports:new Map,reexportNamespace:new Set,reexportAll:null,lazy:false,source:r};o.set(r,a)}return a};let i=false;e.get("body").forEach((e=>{if(e.isImportDeclaration()){const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{if(e.isImportDefaultSpecifier()){const r=e.get("local").node.name;t.imports.set(r,"default");const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexports.set(e,"default")}))}}else if(e.isImportNamespaceSpecifier()){const r=e.get("local").node.name;t.importsNamespace.add(r);const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexportNamespace.add(e)}))}}else if(e.isImportSpecifier()){const r=getExportSpecifierName(e.get("imported"),a);const s=e.get("local").node.name;t.imports.set(s,r);const o=n.get(s);if(o){n.delete(s);o.names.forEach((e=>{t.reexports.set(e,r)}))}}}))}else if(e.isExportAllDeclaration()){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;t.reexportAll={loc:e.node.loc}}else if(e.isExportNamedDeclaration()&&e.node.source){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{assertExportSpecifier(e);const r=getExportSpecifierName(e.get("local"),a);const s=getExportSpecifierName(e.get("exported"),a);t.reexports.set(s,r);if(s==="__esModule"){throw e.get("exported").buildCodeFrameError('Illegal export "__esModule".')}}))}else if(e.isExportNamedDeclaration()||e.isExportDefaultDeclaration()){i=true}}));for(const e of o.values()){let t=false;let r=false;if(e.importsNamespace.size>0){t=true;r=true}if(e.reexportAll){r=true}for(const s of e.imports.values()){if(s==="default")t=true;else r=true}for(const s of e.reexports.values()){if(s==="default")t=true;else r=true}if(t&&r){e.interop="namespace"}else if(t){e.interop="default"}}for(const[e,r]of o){if(t!==false&&!(isSideEffectImport(r)||r.reexportAll)){if(t===true){r.lazy=!/\./.test(e)}else if(Array.isArray(t)){r.lazy=t.indexOf(e)!==-1}else if(typeof t==="function"){r.lazy=t(e)}else{throw new Error(`.lazy must be a boolean, string array, or function`)}}}return{hasExports:i,local:n,source:o}}function getLocalExportMetadata(e,t,r){const s=new Map;e.get("body").forEach((e=>{let r;if(e.isImportDeclaration()){r="import"}else{if(e.isExportDefaultDeclaration())e=e.get("declaration");if(e.isExportNamedDeclaration()){if(e.node.declaration){e=e.get("declaration")}else if(t&&e.node.source&&e.get("source").isStringLiteral()){e.get("specifiers").forEach((e=>{assertExportSpecifier(e);s.set(e.get("local").node.name,"block")}));return}}if(e.isFunctionDeclaration()){r="hoisted"}else if(e.isClassDeclaration()){r="block"}else if(e.isVariableDeclaration({kind:"var"})){r="var"}else if(e.isVariableDeclaration()){r="block"}else{return}}Object.keys(e.getOuterBindingIdentifiers()).forEach((e=>{s.set(e,r)}))}));const a=new Map;const getLocalMetadata=e=>{const t=e.node.name;let r=a.get(t);if(!r){const n=s.get(t);if(n===undefined){throw e.buildCodeFrameError(`Exporting local "${t}", which is not declared.`)}r={names:[],kind:n};a.set(t,r)}return r};e.get("body").forEach((e=>{if(e.isExportNamedDeclaration()&&(t||!e.node.source)){if(e.node.declaration){const t=e.get("declaration");const r=t.getOuterBindingIdentifierPaths();Object.keys(r).forEach((e=>{if(e==="__esModule"){throw t.buildCodeFrameError('Illegal export "__esModule".')}getLocalMetadata(r[e]).names.push(e)}))}else{e.get("specifiers").forEach((e=>{const t=e.get("local");const s=e.get("exported");const a=getLocalMetadata(t);const n=getExportSpecifierName(s,r);if(n==="__esModule"){throw s.buildCodeFrameError('Illegal export "__esModule".')}a.names.push(n)}))}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){getLocalMetadata(t.get("id")).names.push("default")}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}}));return a}function nameAnonymousExports(e){e.get("body").forEach((e=>{if(!e.isExportDefaultDeclaration())return;(0,n.default)(e)}))}function removeModuleDeclarations(e){e.get("body").forEach((e=>{if(e.isImportDeclaration()){e.remove()}else if(e.isExportNamedDeclaration()){if(e.node.declaration){e.node.declaration._blockHoist=e.node._blockHoist;e.replaceWith(e.node.declaration)}else{e.remove()}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){t._blockHoist=e.node._blockHoist;e.replaceWith(t)}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}else if(e.isExportAllDeclaration()){e.remove()}}))}},9955:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteLiveReferences;var s=r(9491);var a=r(8622);var n=r(153);var o=r(9553);function rewriteLiveReferences(e,t){const r=new Map;const s=new Map;const requeueInParent=t=>{e.requeue(t)};for(const[e,s]of t.source){for(const[t,a]of s.imports){r.set(t,[e,a,null])}for(const t of s.importsNamespace){r.set(t,[e,null,t])}}for(const[e,r]of t.local){let t=s.get(e);if(!t){t=[];s.set(e,t)}t.push(...r.names)}const n={metadata:t,requeueInParent:requeueInParent,scope:e.scope,exported:s};e.traverse(i,n);(0,o.default)(e,new Set([...Array.from(r.keys()),...Array.from(s.keys())]));const c={seen:new WeakSet,metadata:t,requeueInParent:requeueInParent,scope:e.scope,imported:r,exported:s,buildImportReference:([e,r,s],n)=>{const o=t.source.get(e);if(s){if(o.lazy)n=a.callExpression(n,[]);return n}let i=a.identifier(o.name);if(o.lazy)i=a.callExpression(i,[]);if(r==="default"&&o.interop==="node-default"){return i}const l=t.stringSpecifiers.has(r);return a.memberExpression(i,l?a.stringLiteral(r):a.identifier(r),l)}};e.traverse(l,c)}const i={Scope(e){e.skip()},ClassDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;const{id:n}=e.node;if(!n)throw new Error("Expected class to have a name");const o=n.name;const i=r.get(o)||[];if(i.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,i,a.identifier(o)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}},VariableDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;Object.keys(e.getOuterBindingIdentifiers()).forEach((n=>{const o=r.get(n)||[];if(o.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,o,a.identifier(n)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}}))}};const buildBindingExportAssignmentExpression=(e,t,r)=>(t||[]).reduce(((t,r)=>{const{stringSpecifiers:s}=e;const n=s.has(r);return a.assignmentExpression("=",a.memberExpression(a.identifier(e.exportName),n?a.stringLiteral(r):a.identifier(r),n),t)}),r);const buildImportThrow=e=>n.default.expression.ast` (function() { throw new Error('"' + '${e}' + '" is read-only.'); })() - `;const l={ReferencedIdentifier(e){const{seen:t,buildImportReference:r,scope:s,imported:n,requeueInParent:o}=this;if(t.has(e.node))return;t.add(e.node);const i=e.node.name;const l=n.get(i);if(l){const t=e.scope.getBinding(i);const n=s.getBinding(i);if(n!==t)return;const c=r(l,e.node);c.loc=e.node.loc;if((e.parentPath.isCallExpression({callee:e.node})||e.parentPath.isOptionalCallExpression({callee:e.node})||e.parentPath.isTaggedTemplateExpression({tag:e.node}))&&a.isMemberExpression(c)){e.replaceWith(a.sequenceExpression([a.numericLiteral(0),c]))}else if(e.isJSXIdentifier()&&a.isMemberExpression(c)){const{object:t,property:r}=c;e.replaceWith(a.jsxMemberExpression(a.jsxIdentifier(t.name),a.jsxIdentifier(r.name)))}else{e.replaceWith(c)}o(e);e.skip()}},AssignmentExpression:{exit(e){const{scope:t,seen:r,imported:n,exported:o,requeueInParent:i,buildImportReference:l}=this;if(r.has(e.node))return;r.add(e.node);const c=e.get("left");if(c.isMemberExpression())return;if(c.isIdentifier()){const r=c.node.name;if(t.getBinding(r)!==e.scope.getBinding(r)){return}const u=o.get(r);const p=n.get(r);if((u==null?void 0:u.length)>0||p){s(e.node.operator==="=","Path was not simplified");const t=e.node;if(p){t.left=l(p,t.left);t.right=a.sequenceExpression([t.right,buildImportThrow(r)])}e.replaceWith(buildBindingExportAssignmentExpression(this.metadata,u,t));i(e)}}else{const r=c.getOuterBindingIdentifiers();const s=Object.keys(r).filter((r=>t.getBinding(r)===e.scope.getBinding(r)));const l=s.find((e=>n.has(e)));if(l){e.node.right=a.sequenceExpression([e.node.right,buildImportThrow(l)])}const u=[];s.forEach((e=>{const t=o.get(e)||[];if(t.length>0){u.push(buildBindingExportAssignmentExpression(this.metadata,t,a.identifier(e)))}}));if(u.length>0){let t=a.sequenceExpression(u);if(e.parentPath.isExpressionStatement()){t=a.expressionStatement(t);t._blockHoist=e.parentPath.node._blockHoist}const r=e.insertAfter(t)[0];i(r)}}}},"ForOfStatement|ForInStatement"(e){const{scope:t,node:r}=e;const{left:s}=r;const{exported:n,imported:o,scope:i}=this;if(!a.isVariableDeclaration(s)){let r=false,l;const c=e.get("body").scope;for(const e of Object.keys(a.getOuterBindingIdentifiers(s))){if(i.getBinding(e)===t.getBinding(e)){if(n.has(e)){r=true;if(c.hasOwnBinding(e)){c.rename(e)}}if(o.has(e)&&!l){l=e}}}if(!r&&!l){return}e.ensureBlock();const u=e.get("body");const p=t.generateUidIdentifierBasedOnNode(s);e.get("left").replaceWith(a.variableDeclaration("let",[a.variableDeclarator(a.cloneNode(p))]));t.registerDeclaration(e.get("left"));if(r){u.unshiftContainer("body",a.expressionStatement(a.assignmentExpression("=",s,p)))}if(l){u.unshiftContainer("body",a.expressionStatement(buildImportThrow(l)))}}}}},8831:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteThis;var s=r(5438);var a=r(7369);var n=r(8622);function rewriteThis(e){(0,a.default)(e.node,Object.assign({},o,{noScope:true}))}const o=a.default.visitors.merge([s.environmentVisitor,{ThisExpression(e){e.replaceWith(n.unaryExpression("void",n.numericLiteral(0),true))}}])},457:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5438:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.skipAllButComputedKey=skipAllButComputedKey;t["default"]=t.environmentVisitor=void 0;var s=r(7369);var a=r(409);var n=r(6721);var o=r(8622);function getPrototypeOfExpression(e,t,r,s){e=o.cloneNode(e);const a=t||s?e:o.memberExpression(e,o.identifier("prototype"));return o.callExpression(r.addHelper("getPrototypeOf"),[a])}function skipAllButComputedKey(e){if(!e.node.computed){e.skip();return}const t=o.VISITOR_KEYS[e.type];for(const r of t){if(r!=="key")e.skipKey(r)}}const i={[`${o.staticBlock?"StaticBlock|":""}ClassPrivateProperty|TypeAnnotation`](e){e.skip()},Function(e){if(e.isMethod())return;if(e.isArrowFunctionExpression())return;e.skip()},"Method|ClassProperty"(e){skipAllButComputedKey(e)}};t.environmentVisitor=i;const l=s.default.visitors.merge([i,{Super(e,t){const{node:r,parentPath:s}=e;if(!s.isMemberExpression({object:r}))return;t.handle(s)}}]);const c=s.default.visitors.merge([i,{Scopable(e,{refName:t}){const r=e.scope.getOwnBinding(t);if(r&&r.identifier.name===t){e.scope.rename(t)}}}]);const u={memoise(e,t){const{scope:r,node:s}=e;const{computed:a,property:n}=s;if(!a){return}const o=r.maybeGenerateMemoised(n);if(!o){return}this.memoiser.set(n,o,t)},prop(e){const{computed:t,property:r}=e.node;if(this.memoiser.has(r)){return o.cloneNode(this.memoiser.get(r))}if(t){return o.cloneNode(r)}return o.stringLiteral(r.name)},get(e){return this._get(e,this._getThisRefs())},_get(e,t){const r=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("get"),[t.memo?o.sequenceExpression([t.memo,r]):r,this.prop(e),t.this])},_getThisRefs(){if(!this.isDerivedConstructor){return{this:o.thisExpression()}}const e=this.scope.generateDeclaredUidIdentifier("thisSuper");return{memo:o.assignmentExpression("=",e,o.thisExpression()),this:o.cloneNode(e)}},set(e,t){const r=this._getThisRefs();const s=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("set"),[r.memo?o.sequenceExpression([r.memo,s]):s,this.prop(e),t,r.this,o.booleanLiteral(e.isInStrictMode())])},destructureSet(e){throw e.buildCodeFrameError(`Destructuring to a super field is not supported yet.`)},call(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,false)},optionalCall(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,true)}};const p=Object.assign({},u,{prop(e){const{property:t}=e.node;if(this.memoiser.has(t)){return o.cloneNode(this.memoiser.get(t))}return o.cloneNode(t)},get(e){const{isStatic:t,getSuperRef:r}=this;const{computed:s}=e.node;const a=this.prop(e);let n;if(t){var i;n=(i=r())!=null?i:o.memberExpression(o.identifier("Function"),o.identifier("prototype"))}else{var l;n=o.memberExpression((l=r())!=null?l:o.identifier("Object"),o.identifier("prototype"))}return o.memberExpression(n,a,s)},set(e,t){const{computed:r}=e.node;const s=this.prop(e);return o.assignmentExpression("=",o.memberExpression(o.thisExpression(),s,r),t)},destructureSet(e){const{computed:t}=e.node;const r=this.prop(e);return o.memberExpression(o.thisExpression(),r,t)},call(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,false)},optionalCall(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,true)}});class ReplaceSupers{constructor(e){var t;const r=e.methodPath;this.methodPath=r;this.isDerivedConstructor=r.isClassMethod({kind:"constructor"})&&!!e.superRef;this.isStatic=r.isObjectMethod()||r.node.static||(r.isStaticBlock==null?void 0:r.isStaticBlock());this.isPrivateMethod=r.isPrivate()&&r.isMethod();this.file=e.file;this.constantSuper=(t=e.constantSuper)!=null?t:e.isLoose;this.opts=e}getObjectRef(){return o.cloneNode(this.opts.objectRef||this.opts.getObjectRef())}getSuperRef(){if(this.opts.superRef)return o.cloneNode(this.opts.superRef);if(this.opts.getSuperRef)return o.cloneNode(this.opts.getSuperRef())}replace(){if(this.opts.refToPreserve){this.methodPath.traverse(c,{refName:this.opts.refToPreserve.name})}const e=this.constantSuper?p:u;(0,a.default)(this.methodPath,l,Object.assign({file:this.file,scope:this.methodPath.scope,isDerivedConstructor:this.isDerivedConstructor,isStatic:this.isStatic,isPrivateMethod:this.isPrivateMethod,getObjectRef:this.getObjectRef.bind(this),getSuperRef:this.getSuperRef.bind(this),boundGet:e.get},e))}}t["default"]=ReplaceSupers},9553:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=simplifyAccess;var s=r(8622);function simplifyAccess(e,t){e.traverse(a,{scope:e.scope,bindingNames:t,seen:new WeakSet})}const a={UpdateExpression:{exit(e){const{scope:t,bindingNames:r}=this;const a=e.get("argument");if(!a.isIdentifier())return;const n=a.node.name;if(!r.has(n))return;if(t.getBinding(n)!==e.scope.getBinding(n)){return}if(e.parentPath.isExpressionStatement()&&!e.isCompletionRecord()){const t=e.node.operator=="++"?"+=":"-=";e.replaceWith(s.assignmentExpression(t,a.node,s.numericLiteral(1)))}else if(e.node.prefix){e.replaceWith(s.assignmentExpression("=",s.identifier(n),s.binaryExpression(e.node.operator[0],s.unaryExpression("+",a.node),s.numericLiteral(1))))}else{const t=e.scope.generateUidIdentifierBasedOnNode(a.node,"old");const r=t.name;e.scope.push({id:t});const n=s.binaryExpression(e.node.operator[0],s.identifier(r),s.numericLiteral(1));e.replaceWith(s.sequenceExpression([s.assignmentExpression("=",s.identifier(r),s.unaryExpression("+",a.node)),s.assignmentExpression("=",s.cloneNode(a.node),n),s.identifier(r)]))}}},AssignmentExpression:{exit(e){const{scope:t,seen:r,bindingNames:a}=this;if(e.node.operator==="=")return;if(r.has(e.node))return;r.add(e.node);const n=e.get("left");if(!n.isIdentifier())return;const o=n.node.name;if(!a.has(o))return;if(t.getBinding(o)!==e.scope.getBinding(o)){return}const i=e.node.operator.slice(0,-1);if(s.LOGICAL_OPERATORS.includes(i)){e.replaceWith(s.logicalExpression(i,e.node.left,s.assignmentExpression("=",s.cloneNode(e.node.left),e.node.right)))}else{e.node.right=s.binaryExpression(i,s.cloneNode(e.node.left),e.node.right);e.node.operator="="}}}}},199:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(199);var a=r(1683)},1683:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},730:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getExportSpecifierName=getExportSpecifierName;t["default"]=void 0;var s=r(119);var a=r(5327);var n=r(8304);var o=r(7047);var i=r(2595);var l=r(1815);const c=(0,n.template)(`\n SYSTEM_REGISTER(MODULE_NAME, SOURCES, function (EXPORT_IDENTIFIER, CONTEXT_IDENTIFIER) {\n "use strict";\n BEFORE_BODY;\n return {\n setters: SETTERS,\n execute: EXECUTE,\n };\n });\n`);const u=(0,n.template)(`\n for (var KEY in TARGET) {\n if (KEY !== "default" && KEY !== "__esModule") EXPORT_OBJ[KEY] = TARGET[KEY];\n }\n`);const p=`WARNING: Dynamic import() transformation must be enabled using the\n @babel/plugin-proposal-dynamic-import plugin. Babel 8 will\n no longer transform import() without using that plugin.\n`;const f=null&&`ERROR: Dynamic import() transformation must be enabled using the\n @babel/plugin-proposal-dynamic-import plugin. Babel 8\n no longer transforms import() without using that plugin.\n`;function getExportSpecifierName(e,t){if(e.type==="Identifier"){return e.name}else if(e.type==="StringLiteral"){const r=e.value;if(!(0,l.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.type}`)}}function constructExportCall(e,t,r,s,a,o){const i=[];if(!a){if(r.length===1){i.push(n.types.expressionStatement(n.types.callExpression(t,[n.types.stringLiteral(r[0]),s[0]])))}else{const e=[];for(let t=0;t{e.assertVersion(7);const{systemGlobal:r="System",allowTopLevelThis:s=false}=t;const l=Symbol();const u={"AssignmentExpression|UpdateExpression"(e){if(e.node[l])return;e.node[l]=true;const t=e.get(e.isAssignmentExpression()?"left":"argument");if(t.isObjectPattern()||t.isArrayPattern()){const r=[e.node];for(const s of Object.keys(t.getBindingIdentifiers())){if(this.scope.getBinding(s)!==e.scope.getBinding(s)){return}const t=this.exports[s];if(!t)return;for(const e of t){r.push(this.buildCall(e,n.types.identifier(s)).expression)}}e.replaceWith(n.types.sequenceExpression(r));return}if(!t.isIdentifier())return;const r=t.node.name;if(this.scope.getBinding(r)!==e.scope.getBinding(r))return;const s=this.exports[r];if(!s)return;let a=e.node;const o=e.isUpdateExpression({prefix:false});if(o){a=n.types.binaryExpression(a.operator[0],n.types.unaryExpression("+",n.types.cloneNode(a.argument)),n.types.numericLiteral(1))}for(const e of s){a=this.buildCall(e,a).expression}if(o){a=n.types.sequenceExpression([a,e.node])}e.replaceWith(a)}};return{name:"transform-modules-systemjs",pre(){this.file.set("@babel/plugin-transform-modules-*","systemjs")},visitor:{CallExpression(e,t){if(n.types.isImport(e.node.callee)){if(!this.file.has("@babel/plugin-proposal-dynamic-import")){{console.warn(p)}}e.replaceWith(n.types.callExpression(n.types.memberExpression(n.types.identifier(t.contextIdent),n.types.identifier("import")),[(0,o.getImportSource)(n.types,e.node)]))}},MetaProperty(e,t){if(e.node.meta.name==="import"&&e.node.property.name==="meta"){e.replaceWith(n.types.memberExpression(n.types.identifier(t.contextIdent),n.types.identifier("meta")))}},ReferencedIdentifier(e,t){if(e.node.name==="__moduleName"&&!e.scope.hasBinding("__moduleName")){e.replaceWith(n.types.memberExpression(n.types.identifier(t.contextIdent),n.types.identifier("id")))}},Program:{enter(e,t){t.contextIdent=e.scope.generateUid("context");t.stringSpecifiers=new Set;if(!s){(0,i.rewriteThis)(e)}},exit(e,s){const o=e.scope;const l=o.generateUid("export");const{contextIdent:p,stringSpecifiers:f}=s;const d=Object.create(null);const m=[];let y=[];const g=[];const h=[];const b=[];const x=[];function addExportName(e,t){d[e]=d[e]||[];d[e].push(t)}function pushModule(e,t,r){let s;m.forEach((function(t){if(t.key===e){s=t}}));if(!s){m.push(s={key:e,imports:[],exports:[]})}s[t]=s[t].concat(r)}function buildExportCall(e,t){return n.types.expressionStatement(n.types.callExpression(n.types.identifier(l),[n.types.stringLiteral(e),t]))}const v=[];const E=[];const j=e.get("body");for(const e of j){if(e.isFunctionDeclaration()){y.push(e.node);x.push(e)}else if(e.isClassDeclaration()){b.push(n.types.cloneNode(e.node.id));e.replaceWith(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.cloneNode(e.node.id),n.types.toExpression(e.node))))}else if(e.isImportDeclaration()){const t=e.node.source.value;pushModule(t,"imports",e.node.specifiers);for(const t of Object.keys(e.getBindingIdentifiers())){o.removeBinding(t);b.push(n.types.identifier(t))}e.remove()}else if(e.isExportAllDeclaration()){pushModule(e.node.source.value,"exports",e.node);e.remove()}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");const r=t.node.id;if(t.isClassDeclaration()){if(r){v.push("default");E.push(o.buildUndefinedNode());b.push(n.types.cloneNode(r));addExportName(r.name,"default");e.replaceWith(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.cloneNode(r),n.types.toExpression(t.node))))}else{v.push("default");E.push(n.types.toExpression(t.node));x.push(e)}}else if(t.isFunctionDeclaration()){if(r){y.push(t.node);v.push("default");E.push(n.types.cloneNode(r));addExportName(r.name,"default")}else{v.push("default");E.push(n.types.toExpression(t.node))}x.push(e)}else{e.replaceWith(buildExportCall("default",t.node))}}else if(e.isExportNamedDeclaration()){const t=e.get("declaration");if(t.node){e.replaceWith(t);if(e.isFunction()){const r=t.node;const s=r.id.name;addExportName(s,s);y.push(r);v.push(s);E.push(n.types.cloneNode(r.id));x.push(e)}else if(e.isClass()){const r=t.node.id.name;v.push(r);E.push(o.buildUndefinedNode());b.push(n.types.cloneNode(t.node.id));e.replaceWith(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.cloneNode(t.node.id),n.types.toExpression(t.node))));addExportName(r,r)}else{for(const e of Object.keys(t.getBindingIdentifiers())){addExportName(e,e)}}}else{const t=e.node.specifiers;if(t!=null&&t.length){if(e.node.source){pushModule(e.node.source.value,"exports",t);e.remove()}else{const r=[];for(const e of t){const{local:t,exported:s}=e;const a=o.getBinding(t.name);const i=getExportSpecifierName(s,f);if(a&&n.types.isFunctionDeclaration(a.path.node)){v.push(i);E.push(n.types.cloneNode(t))}else if(!a){r.push(buildExportCall(i,t))}addExportName(t.name,i)}e.replaceWithMultiple(r)}}else{e.remove()}}}}m.forEach((function(t){let r=[];const s=o.generateUid(t.key);for(let e of t.imports){if(n.types.isImportNamespaceSpecifier(e)){r.push(n.types.expressionStatement(n.types.assignmentExpression("=",e.local,n.types.identifier(s))))}else if(n.types.isImportDefaultSpecifier(e)){e=n.types.importSpecifier(e.local,n.types.identifier("default"))}if(n.types.isImportSpecifier(e)){const{imported:t}=e;r.push(n.types.expressionStatement(n.types.assignmentExpression("=",e.local,n.types.memberExpression(n.types.identifier(s),e.imported,t.type==="StringLiteral"))))}}if(t.exports.length){const a=[];const o=[];let i=false;for(const e of t.exports){if(n.types.isExportAllDeclaration(e)){i=true}else if(n.types.isExportSpecifier(e)){const t=getExportSpecifierName(e.exported,f);a.push(t);o.push(n.types.memberExpression(n.types.identifier(s),e.local,n.types.isStringLiteral(e.local)))}else{}}r=r.concat(constructExportCall(e,n.types.identifier(l),a,o,i?n.types.identifier(s):null,f))}h.push(n.types.stringLiteral(t.key));g.push(n.types.functionExpression(null,[n.types.identifier(s)],n.types.blockStatement(r)))}));let w=(0,i.getModuleName)(this.file.opts,t);if(w)w=n.types.stringLiteral(w);(0,a.default)(e,((e,t,r)=>{b.push(e);if(!r&&t in d){for(const e of d[t]){v.push(e);E.push(o.buildUndefinedNode())}}}),null);if(b.length){y.unshift(n.types.variableDeclaration("var",b.map((e=>n.types.variableDeclarator(e)))))}if(v.length){y=y.concat(constructExportCall(e,n.types.identifier(l),v,E,null,f))}e.traverse(u,{exports:d,buildCall:buildExportCall,scope:o});for(const e of x){e.remove()}let _=false;e.traverse({AwaitExpression(e){_=true;e.stop()},Function(e){e.skip()},noScope:true});e.node.body=[c({SYSTEM_REGISTER:n.types.memberExpression(n.types.identifier(r),n.types.identifier("register")),BEFORE_BODY:y,MODULE_NAME:w,SETTERS:n.types.arrayExpression(g),EXECUTE:n.types.functionExpression(null,[],n.types.blockStatement(e.node.body),false,_),SOURCES:n.types.arrayExpression(h),EXPORT_IDENTIFIER:n.types.identifier(l),CONTEXT_IDENTIFIER:n.types.identifier(p)})]}}}}}));t["default"]=d},5210:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=getModuleName;{const e=getModuleName;t["default"]=getModuleName=function getModuleName(t,r){var s,a,n,o;return e(t,{moduleId:(s=r.moduleId)!=null?s:t.moduleId,moduleIds:(a=r.moduleIds)!=null?a:t.moduleIds,getModuleId:(n=r.getModuleId)!=null?n:t.getModuleId,moduleRoot:(o=r.moduleRoot)!=null?o:t.moduleRoot})}}function getModuleName(e,t){const{filename:r,filenameRelative:s=r,sourceRoot:a=t.moduleRoot}=e;const{moduleId:n,moduleIds:o=!!n,getModuleId:i,moduleRoot:l=a}=t;if(!o)return null;if(n!=null&&!i){return n}let c=l!=null?l+"/":"";if(s){const e=a!=null?new RegExp("^"+a+"/?"):"";c+=s.replace(e,"").replace(/\.(\w*?)$/,"")}c=c.replace(/\\/g,"/");if(i){return i(c)||c}else{return c}}},2595:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.rewriteModuleStatementsAndPrepareHeader=rewriteModuleStatementsAndPrepareHeader;t.ensureStatementsHoisted=ensureStatementsHoisted;t.wrapInterop=wrapInterop;t.buildNamespaceInitStatements=buildNamespaceInitStatements;Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return o.isModule}});Object.defineProperty(t,"rewriteThis",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"hasExports",{enumerable:true,get:function(){return c.hasExports}});Object.defineProperty(t,"isSideEffectImport",{enumerable:true,get:function(){return c.isSideEffectImport}});Object.defineProperty(t,"getModuleName",{enumerable:true,get:function(){return u.default}});var s=r(9491);var a=r(8622);var n=r(153);var o=r(9115);var i=r(2835);var l=r(1238);var c=r(2461);var u=r(5210);function rewriteModuleStatementsAndPrepareHeader(e,{loose:t,exportName:r,strict:n,allowTopLevelThis:u,strictMode:p,noInterop:f,importInterop:d=(f?"none":"babel"),lazy:m,esNamespaceOnly:y,constantReexports:g=t,enumerableModuleMeta:h=t}){(0,c.validateImportInteropOption)(d);s((0,o.isModule)(e),"Cannot process module statements in a script");e.node.sourceType="script";const b=(0,c.default)(e,r,{importInterop:d,initializeReexports:g,lazy:m,esNamespaceOnly:y});if(!u){(0,i.default)(e)}(0,l.default)(e,b);if(p!==false){const t=e.node.directives.some((e=>e.value.value==="use strict"));if(!t){e.unshiftContainer("directives",a.directive(a.directiveLiteral("use strict")))}}const x=[];if((0,c.hasExports)(b)&&!n){x.push(buildESModuleHeader(b,h))}const v=buildExportNameListDeclaration(e,b);if(v){b.exportNameListName=v.name;x.push(v.statement)}x.push(...buildExportInitializationStatements(e,b,g));return{meta:b,headers:x}}function ensureStatementsHoisted(e){e.forEach((e=>{e._blockHoist=3}))}function wrapInterop(e,t,r){if(r==="none"){return null}if(r==="node-namespace"){return a.callExpression(e.hub.addHelper("interopRequireWildcard"),[t,a.booleanLiteral(true)])}else if(r==="node-default"){return null}let s;if(r==="default"){s="interopRequireDefault"}else if(r==="namespace"){s="interopRequireWildcard"}else{throw new Error(`Unknown interop: ${r}`)}return a.callExpression(e.hub.addHelper(s),[t])}function buildNamespaceInitStatements(e,t,r=false){const s=[];let o=a.identifier(t.name);if(t.lazy)o=a.callExpression(o,[]);for(const e of t.importsNamespace){if(e===t.name)continue;s.push(n.default.statement`var NAME = SOURCE;`({NAME:e,SOURCE:a.cloneNode(o)}))}if(r){s.push(...buildReexportsFromMeta(e,t,true))}for(const r of t.reexportNamespace){s.push((t.lazy?n.default.statement` + `;const l={ReferencedIdentifier(e){const{seen:t,buildImportReference:r,scope:s,imported:n,requeueInParent:o}=this;if(t.has(e.node))return;t.add(e.node);const i=e.node.name;const l=n.get(i);if(l){const t=e.scope.getBinding(i);const n=s.getBinding(i);if(n!==t)return;const c=r(l,e.node);c.loc=e.node.loc;if((e.parentPath.isCallExpression({callee:e.node})||e.parentPath.isOptionalCallExpression({callee:e.node})||e.parentPath.isTaggedTemplateExpression({tag:e.node}))&&a.isMemberExpression(c)){e.replaceWith(a.sequenceExpression([a.numericLiteral(0),c]))}else if(e.isJSXIdentifier()&&a.isMemberExpression(c)){const{object:t,property:r}=c;e.replaceWith(a.jsxMemberExpression(a.jsxIdentifier(t.name),a.jsxIdentifier(r.name)))}else{e.replaceWith(c)}o(e);e.skip()}},AssignmentExpression:{exit(e){const{scope:t,seen:r,imported:n,exported:o,requeueInParent:i,buildImportReference:l}=this;if(r.has(e.node))return;r.add(e.node);const c=e.get("left");if(c.isMemberExpression())return;if(c.isIdentifier()){const r=c.node.name;if(t.getBinding(r)!==e.scope.getBinding(r)){return}const u=o.get(r);const p=n.get(r);if((u==null?void 0:u.length)>0||p){s(e.node.operator==="=","Path was not simplified");const t=e.node;if(p){t.left=l(p,t.left);t.right=a.sequenceExpression([t.right,buildImportThrow(r)])}e.replaceWith(buildBindingExportAssignmentExpression(this.metadata,u,t));i(e)}}else{const r=c.getOuterBindingIdentifiers();const s=Object.keys(r).filter((r=>t.getBinding(r)===e.scope.getBinding(r)));const l=s.find((e=>n.has(e)));if(l){e.node.right=a.sequenceExpression([e.node.right,buildImportThrow(l)])}const u=[];s.forEach((e=>{const t=o.get(e)||[];if(t.length>0){u.push(buildBindingExportAssignmentExpression(this.metadata,t,a.identifier(e)))}}));if(u.length>0){let t=a.sequenceExpression(u);if(e.parentPath.isExpressionStatement()){t=a.expressionStatement(t);t._blockHoist=e.parentPath.node._blockHoist}const r=e.insertAfter(t)[0];i(r)}}}},"ForOfStatement|ForInStatement"(e){const{scope:t,node:r}=e;const{left:s}=r;const{exported:n,imported:o,scope:i}=this;if(!a.isVariableDeclaration(s)){let r=false,l;const c=e.get("body").scope;for(const e of Object.keys(a.getOuterBindingIdentifiers(s))){if(i.getBinding(e)===t.getBinding(e)){if(n.has(e)){r=true;if(c.hasOwnBinding(e)){c.rename(e)}}if(o.has(e)&&!l){l=e}}}if(!r&&!l){return}e.ensureBlock();const u=e.get("body");const p=t.generateUidIdentifierBasedOnNode(s);e.get("left").replaceWith(a.variableDeclaration("let",[a.variableDeclarator(a.cloneNode(p))]));t.registerDeclaration(e.get("left"));if(r){u.unshiftContainer("body",a.expressionStatement(a.assignmentExpression("=",s,p)))}if(l){u.unshiftContainer("body",a.expressionStatement(buildImportThrow(l)))}}}}},8831:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteThis;var s=r(5438);var a=r(7369);var n=r(8622);function rewriteThis(e){(0,a.default)(e.node,Object.assign({},o,{noScope:true}))}const o=a.default.visitors.merge([s.environmentVisitor,{ThisExpression(e){e.replaceWith(n.unaryExpression("void",n.numericLiteral(0),true))}}])},457:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5438:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.skipAllButComputedKey=skipAllButComputedKey;t["default"]=t.environmentVisitor=void 0;var s=r(7369);var a=r(409);var n=r(6721);var o=r(8622);function getPrototypeOfExpression(e,t,r,s){e=o.cloneNode(e);const a=t||s?e:o.memberExpression(e,o.identifier("prototype"));return o.callExpression(r.addHelper("getPrototypeOf"),[a])}function skipAllButComputedKey(e){if(!e.node.computed){e.skip();return}const t=o.VISITOR_KEYS[e.type];for(const r of t){if(r!=="key")e.skipKey(r)}}const i={[`${o.staticBlock?"StaticBlock|":""}ClassPrivateProperty|TypeAnnotation`](e){e.skip()},Function(e){if(e.isMethod())return;if(e.isArrowFunctionExpression())return;e.skip()},"Method|ClassProperty"(e){skipAllButComputedKey(e)}};t.environmentVisitor=i;const l=s.default.visitors.merge([i,{Super(e,t){const{node:r,parentPath:s}=e;if(!s.isMemberExpression({object:r}))return;t.handle(s)}}]);const c=s.default.visitors.merge([i,{Scopable(e,{refName:t}){const r=e.scope.getOwnBinding(t);if(r&&r.identifier.name===t){e.scope.rename(t)}}}]);const u={memoise(e,t){const{scope:r,node:s}=e;const{computed:a,property:n}=s;if(!a){return}const o=r.maybeGenerateMemoised(n);if(!o){return}this.memoiser.set(n,o,t)},prop(e){const{computed:t,property:r}=e.node;if(this.memoiser.has(r)){return o.cloneNode(this.memoiser.get(r))}if(t){return o.cloneNode(r)}return o.stringLiteral(r.name)},get(e){return this._get(e,this._getThisRefs())},_get(e,t){const r=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("get"),[t.memo?o.sequenceExpression([t.memo,r]):r,this.prop(e),t.this])},_getThisRefs(){if(!this.isDerivedConstructor){return{this:o.thisExpression()}}const e=this.scope.generateDeclaredUidIdentifier("thisSuper");return{memo:o.assignmentExpression("=",e,o.thisExpression()),this:o.cloneNode(e)}},set(e,t){const r=this._getThisRefs();const s=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("set"),[r.memo?o.sequenceExpression([r.memo,s]):s,this.prop(e),t,r.this,o.booleanLiteral(e.isInStrictMode())])},destructureSet(e){throw e.buildCodeFrameError(`Destructuring to a super field is not supported yet.`)},call(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,false)},optionalCall(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,true)}};const p=Object.assign({},u,{prop(e){const{property:t}=e.node;if(this.memoiser.has(t)){return o.cloneNode(this.memoiser.get(t))}return o.cloneNode(t)},get(e){const{isStatic:t,getSuperRef:r}=this;const{computed:s}=e.node;const a=this.prop(e);let n;if(t){var i;n=(i=r())!=null?i:o.memberExpression(o.identifier("Function"),o.identifier("prototype"))}else{var l;n=o.memberExpression((l=r())!=null?l:o.identifier("Object"),o.identifier("prototype"))}return o.memberExpression(n,a,s)},set(e,t){const{computed:r}=e.node;const s=this.prop(e);return o.assignmentExpression("=",o.memberExpression(o.thisExpression(),s,r),t)},destructureSet(e){const{computed:t}=e.node;const r=this.prop(e);return o.memberExpression(o.thisExpression(),r,t)},call(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,false)},optionalCall(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,true)}});class ReplaceSupers{constructor(e){var t;const r=e.methodPath;this.methodPath=r;this.isDerivedConstructor=r.isClassMethod({kind:"constructor"})&&!!e.superRef;this.isStatic=r.isObjectMethod()||r.node.static||(r.isStaticBlock==null?void 0:r.isStaticBlock());this.isPrivateMethod=r.isPrivate()&&r.isMethod();this.file=e.file;this.constantSuper=(t=e.constantSuper)!=null?t:e.isLoose;this.opts=e}getObjectRef(){return o.cloneNode(this.opts.objectRef||this.opts.getObjectRef())}getSuperRef(){if(this.opts.superRef)return o.cloneNode(this.opts.superRef);if(this.opts.getSuperRef)return o.cloneNode(this.opts.getSuperRef())}replace(){if(this.opts.refToPreserve){this.methodPath.traverse(c,{refName:this.opts.refToPreserve.name})}const e=this.constantSuper?p:u;(0,a.default)(this.methodPath,l,Object.assign({file:this.file,scope:this.methodPath.scope,isDerivedConstructor:this.isDerivedConstructor,isStatic:this.isStatic,isPrivateMethod:this.isPrivateMethod,getObjectRef:this.getObjectRef.bind(this),getSuperRef:this.getSuperRef.bind(this),boundGet:e.get},e))}}t["default"]=ReplaceSupers},9553:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=simplifyAccess;var s=r(8622);function simplifyAccess(e,t){e.traverse(a,{scope:e.scope,bindingNames:t,seen:new WeakSet})}const a={UpdateExpression:{exit(e){const{scope:t,bindingNames:r}=this;const a=e.get("argument");if(!a.isIdentifier())return;const n=a.node.name;if(!r.has(n))return;if(t.getBinding(n)!==e.scope.getBinding(n)){return}if(e.parentPath.isExpressionStatement()&&!e.isCompletionRecord()){const t=e.node.operator=="++"?"+=":"-=";e.replaceWith(s.assignmentExpression(t,a.node,s.numericLiteral(1)))}else if(e.node.prefix){e.replaceWith(s.assignmentExpression("=",s.identifier(n),s.binaryExpression(e.node.operator[0],s.unaryExpression("+",a.node),s.numericLiteral(1))))}else{const t=e.scope.generateUidIdentifierBasedOnNode(a.node,"old");const r=t.name;e.scope.push({id:t});const n=s.binaryExpression(e.node.operator[0],s.identifier(r),s.numericLiteral(1));e.replaceWith(s.sequenceExpression([s.assignmentExpression("=",s.identifier(r),s.unaryExpression("+",a.node)),s.assignmentExpression("=",s.cloneNode(a.node),n),s.identifier(r)]))}}},AssignmentExpression:{exit(e){const{scope:t,seen:r,bindingNames:a}=this;if(e.node.operator==="=")return;if(r.has(e.node))return;r.add(e.node);const n=e.get("left");if(!n.isIdentifier())return;const o=n.node.name;if(!a.has(o))return;if(t.getBinding(o)!==e.scope.getBinding(o)){return}const i=e.node.operator.slice(0,-1);if(s.LOGICAL_OPERATORS.includes(i)){e.replaceWith(s.logicalExpression(i,e.node.left,s.assignmentExpression("=",s.cloneNode(e.node.left),e.node.right)))}else{e.node.right=s.binaryExpression(i,s.cloneNode(e.node.left),e.node.right);e.node.operator="="}}}}},199:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(199);var a=r(1683)},1683:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},730:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getExportSpecifierName=getExportSpecifierName;t["default"]=void 0;var s=r(4141);var a=r(5327);var n=r(8304);var o=r(7047);var i=r(2595);var l=r(1815);const c=(0,n.template)(`\n SYSTEM_REGISTER(MODULE_NAME, SOURCES, function (EXPORT_IDENTIFIER, CONTEXT_IDENTIFIER) {\n "use strict";\n BEFORE_BODY;\n return {\n setters: SETTERS,\n execute: EXECUTE,\n };\n });\n`);const u=(0,n.template)(`\n for (var KEY in TARGET) {\n if (KEY !== "default" && KEY !== "__esModule") EXPORT_OBJ[KEY] = TARGET[KEY];\n }\n`);const p=`WARNING: Dynamic import() transformation must be enabled using the\n @babel/plugin-proposal-dynamic-import plugin. Babel 8 will\n no longer transform import() without using that plugin.\n`;const d=null&&`ERROR: Dynamic import() transformation must be enabled using the\n @babel/plugin-proposal-dynamic-import plugin. Babel 8\n no longer transforms import() without using that plugin.\n`;function getExportSpecifierName(e,t){if(e.type==="Identifier"){return e.name}else if(e.type==="StringLiteral"){const r=e.value;if(!(0,l.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.type}`)}}function constructExportCall(e,t,r,s,a,o){const i=[];if(!a){if(r.length===1){i.push(n.types.expressionStatement(n.types.callExpression(t,[n.types.stringLiteral(r[0]),s[0]])))}else{const e=[];for(let t=0;t{e.assertVersion(7);const{systemGlobal:r="System",allowTopLevelThis:s=false}=t;const l=Symbol();const u={"AssignmentExpression|UpdateExpression"(e){if(e.node[l])return;e.node[l]=true;const t=e.get(e.isAssignmentExpression()?"left":"argument");if(t.isObjectPattern()||t.isArrayPattern()){const r=[e.node];for(const s of Object.keys(t.getBindingIdentifiers())){if(this.scope.getBinding(s)!==e.scope.getBinding(s)){return}const t=this.exports[s];if(!t)return;for(const e of t){r.push(this.buildCall(e,n.types.identifier(s)).expression)}}e.replaceWith(n.types.sequenceExpression(r));return}if(!t.isIdentifier())return;const r=t.node.name;if(this.scope.getBinding(r)!==e.scope.getBinding(r))return;const s=this.exports[r];if(!s)return;let a=e.node;const o=e.isUpdateExpression({prefix:false});if(o){a=n.types.binaryExpression(a.operator[0],n.types.unaryExpression("+",n.types.cloneNode(a.argument)),n.types.numericLiteral(1))}for(const e of s){a=this.buildCall(e,a).expression}if(o){a=n.types.sequenceExpression([a,e.node])}e.replaceWith(a)}};return{name:"transform-modules-systemjs",pre(){this.file.set("@babel/plugin-transform-modules-*","systemjs")},visitor:{CallExpression(e,t){if(n.types.isImport(e.node.callee)){if(!this.file.has("@babel/plugin-proposal-dynamic-import")){{console.warn(p)}}e.replaceWith(n.types.callExpression(n.types.memberExpression(n.types.identifier(t.contextIdent),n.types.identifier("import")),[(0,o.getImportSource)(n.types,e.node)]))}},MetaProperty(e,t){if(e.node.meta.name==="import"&&e.node.property.name==="meta"){e.replaceWith(n.types.memberExpression(n.types.identifier(t.contextIdent),n.types.identifier("meta")))}},ReferencedIdentifier(e,t){if(e.node.name==="__moduleName"&&!e.scope.hasBinding("__moduleName")){e.replaceWith(n.types.memberExpression(n.types.identifier(t.contextIdent),n.types.identifier("id")))}},Program:{enter(e,t){t.contextIdent=e.scope.generateUid("context");t.stringSpecifiers=new Set;if(!s){(0,i.rewriteThis)(e)}},exit(e,s){const o=e.scope;const l=o.generateUid("export");const{contextIdent:p,stringSpecifiers:d}=s;const f=Object.create(null);const m=[];let y=[];const g=[];const h=[];const b=[];const x=[];function addExportName(e,t){f[e]=f[e]||[];f[e].push(t)}function pushModule(e,t,r){let s;m.forEach((function(t){if(t.key===e){s=t}}));if(!s){m.push(s={key:e,imports:[],exports:[]})}s[t]=s[t].concat(r)}function buildExportCall(e,t){return n.types.expressionStatement(n.types.callExpression(n.types.identifier(l),[n.types.stringLiteral(e),t]))}const v=[];const E=[];const j=e.get("body");for(const e of j){if(e.isFunctionDeclaration()){y.push(e.node);x.push(e)}else if(e.isClassDeclaration()){b.push(n.types.cloneNode(e.node.id));e.replaceWith(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.cloneNode(e.node.id),n.types.toExpression(e.node))))}else if(e.isImportDeclaration()){const t=e.node.source.value;pushModule(t,"imports",e.node.specifiers);for(const t of Object.keys(e.getBindingIdentifiers())){o.removeBinding(t);b.push(n.types.identifier(t))}e.remove()}else if(e.isExportAllDeclaration()){pushModule(e.node.source.value,"exports",e.node);e.remove()}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");const r=t.node.id;if(t.isClassDeclaration()){if(r){v.push("default");E.push(o.buildUndefinedNode());b.push(n.types.cloneNode(r));addExportName(r.name,"default");e.replaceWith(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.cloneNode(r),n.types.toExpression(t.node))))}else{v.push("default");E.push(n.types.toExpression(t.node));x.push(e)}}else if(t.isFunctionDeclaration()){if(r){y.push(t.node);v.push("default");E.push(n.types.cloneNode(r));addExportName(r.name,"default")}else{v.push("default");E.push(n.types.toExpression(t.node))}x.push(e)}else{e.replaceWith(buildExportCall("default",t.node))}}else if(e.isExportNamedDeclaration()){const t=e.get("declaration");if(t.node){e.replaceWith(t);if(e.isFunction()){const r=t.node;const s=r.id.name;addExportName(s,s);y.push(r);v.push(s);E.push(n.types.cloneNode(r.id));x.push(e)}else if(e.isClass()){const r=t.node.id.name;v.push(r);E.push(o.buildUndefinedNode());b.push(n.types.cloneNode(t.node.id));e.replaceWith(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.cloneNode(t.node.id),n.types.toExpression(t.node))));addExportName(r,r)}else{for(const e of Object.keys(t.getBindingIdentifiers())){addExportName(e,e)}}}else{const t=e.node.specifiers;if(t!=null&&t.length){if(e.node.source){pushModule(e.node.source.value,"exports",t);e.remove()}else{const r=[];for(const e of t){const{local:t,exported:s}=e;const a=o.getBinding(t.name);const i=getExportSpecifierName(s,d);if(a&&n.types.isFunctionDeclaration(a.path.node)){v.push(i);E.push(n.types.cloneNode(t))}else if(!a){r.push(buildExportCall(i,t))}addExportName(t.name,i)}e.replaceWithMultiple(r)}}else{e.remove()}}}}m.forEach((function(t){let r=[];const s=o.generateUid(t.key);for(let e of t.imports){if(n.types.isImportNamespaceSpecifier(e)){r.push(n.types.expressionStatement(n.types.assignmentExpression("=",e.local,n.types.identifier(s))))}else if(n.types.isImportDefaultSpecifier(e)){e=n.types.importSpecifier(e.local,n.types.identifier("default"))}if(n.types.isImportSpecifier(e)){const{imported:t}=e;r.push(n.types.expressionStatement(n.types.assignmentExpression("=",e.local,n.types.memberExpression(n.types.identifier(s),e.imported,t.type==="StringLiteral"))))}}if(t.exports.length){const a=[];const o=[];let i=false;for(const e of t.exports){if(n.types.isExportAllDeclaration(e)){i=true}else if(n.types.isExportSpecifier(e)){const t=getExportSpecifierName(e.exported,d);a.push(t);o.push(n.types.memberExpression(n.types.identifier(s),e.local,n.types.isStringLiteral(e.local)))}else{}}r=r.concat(constructExportCall(e,n.types.identifier(l),a,o,i?n.types.identifier(s):null,d))}h.push(n.types.stringLiteral(t.key));g.push(n.types.functionExpression(null,[n.types.identifier(s)],n.types.blockStatement(r)))}));let w=(0,i.getModuleName)(this.file.opts,t);if(w)w=n.types.stringLiteral(w);(0,a.default)(e,((e,t,r)=>{b.push(e);if(!r&&t in f){for(const e of f[t]){v.push(e);E.push(o.buildUndefinedNode())}}}),null);if(b.length){y.unshift(n.types.variableDeclaration("var",b.map((e=>n.types.variableDeclarator(e)))))}if(v.length){y=y.concat(constructExportCall(e,n.types.identifier(l),v,E,null,d))}e.traverse(u,{exports:f,buildCall:buildExportCall,scope:o});for(const e of x){e.remove()}let _=false;e.traverse({AwaitExpression(e){_=true;e.stop()},Function(e){e.skip()},noScope:true});e.node.body=[c({SYSTEM_REGISTER:n.types.memberExpression(n.types.identifier(r),n.types.identifier("register")),BEFORE_BODY:y,MODULE_NAME:w,SETTERS:n.types.arrayExpression(g),EXECUTE:n.types.functionExpression(null,[],n.types.blockStatement(e.node.body),false,_),SOURCES:n.types.arrayExpression(h),EXPORT_IDENTIFIER:n.types.identifier(l),CONTEXT_IDENTIFIER:n.types.identifier(p)})]}}}}}));t["default"]=f},5210:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=getModuleName;{const e=getModuleName;t["default"]=getModuleName=function getModuleName(t,r){var s,a,n,o;return e(t,{moduleId:(s=r.moduleId)!=null?s:t.moduleId,moduleIds:(a=r.moduleIds)!=null?a:t.moduleIds,getModuleId:(n=r.getModuleId)!=null?n:t.getModuleId,moduleRoot:(o=r.moduleRoot)!=null?o:t.moduleRoot})}}function getModuleName(e,t){const{filename:r,filenameRelative:s=r,sourceRoot:a=t.moduleRoot}=e;const{moduleId:n,moduleIds:o=!!n,getModuleId:i,moduleRoot:l=a}=t;if(!o)return null;if(n!=null&&!i){return n}let c=l!=null?l+"/":"";if(s){const e=a!=null?new RegExp("^"+a+"/?"):"";c+=s.replace(e,"").replace(/\.(\w*?)$/,"")}c=c.replace(/\\/g,"/");if(i){return i(c)||c}else{return c}}},2595:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.rewriteModuleStatementsAndPrepareHeader=rewriteModuleStatementsAndPrepareHeader;t.ensureStatementsHoisted=ensureStatementsHoisted;t.wrapInterop=wrapInterop;t.buildNamespaceInitStatements=buildNamespaceInitStatements;Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return o.isModule}});Object.defineProperty(t,"rewriteThis",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"hasExports",{enumerable:true,get:function(){return c.hasExports}});Object.defineProperty(t,"isSideEffectImport",{enumerable:true,get:function(){return c.isSideEffectImport}});Object.defineProperty(t,"getModuleName",{enumerable:true,get:function(){return u.default}});var s=r(9491);var a=r(8622);var n=r(153);var o=r(6039);var i=r(2835);var l=r(1238);var c=r(2461);var u=r(5210);function rewriteModuleStatementsAndPrepareHeader(e,{loose:t,exportName:r,strict:n,allowTopLevelThis:u,strictMode:p,noInterop:d,importInterop:f=(d?"none":"babel"),lazy:m,esNamespaceOnly:y,constantReexports:g=t,enumerableModuleMeta:h=t}){(0,c.validateImportInteropOption)(f);s((0,o.isModule)(e),"Cannot process module statements in a script");e.node.sourceType="script";const b=(0,c.default)(e,r,{importInterop:f,initializeReexports:g,lazy:m,esNamespaceOnly:y});if(!u){(0,i.default)(e)}(0,l.default)(e,b);if(p!==false){const t=e.node.directives.some((e=>e.value.value==="use strict"));if(!t){e.unshiftContainer("directives",a.directive(a.directiveLiteral("use strict")))}}const x=[];if((0,c.hasExports)(b)&&!n){x.push(buildESModuleHeader(b,h))}const v=buildExportNameListDeclaration(e,b);if(v){b.exportNameListName=v.name;x.push(v.statement)}x.push(...buildExportInitializationStatements(e,b,g));return{meta:b,headers:x}}function ensureStatementsHoisted(e){e.forEach((e=>{e._blockHoist=3}))}function wrapInterop(e,t,r){if(r==="none"){return null}if(r==="node-namespace"){return a.callExpression(e.hub.addHelper("interopRequireWildcard"),[t,a.booleanLiteral(true)])}else if(r==="node-default"){return null}let s;if(r==="default"){s="interopRequireDefault"}else if(r==="namespace"){s="interopRequireWildcard"}else{throw new Error(`Unknown interop: ${r}`)}return a.callExpression(e.hub.addHelper(s),[t])}function buildNamespaceInitStatements(e,t,r=false){const s=[];let o=a.identifier(t.name);if(t.lazy)o=a.callExpression(o,[]);for(const e of t.importsNamespace){if(e===t.name)continue;s.push(n.default.statement`var NAME = SOURCE;`({NAME:e,SOURCE:a.cloneNode(o)}))}if(r){s.push(...buildReexportsFromMeta(e,t,true))}for(const r of t.reexportNamespace){s.push((t.lazy?n.default.statement` Object.defineProperty(EXPORTS, "NAME", { enumerable: true, get: function() { @@ -248,11 +323,11 @@ }); `)({NAMESPACE:t,EXPORTS:e.exportName,VERIFY_NAME_LIST:e.exportNameListName?(0,n.default)` if (Object.prototype.hasOwnProperty.call(EXPORTS_LIST, key)) return; - `({EXPORTS_LIST:e.exportNameListName}):null})}function buildExportNameListDeclaration(e,t){const r=Object.create(null);for(const e of t.local.values()){for(const t of e.names){r[t]=true}}let s=false;for(const e of t.source.values()){for(const t of e.reexports.keys()){r[t]=true}for(const t of e.reexportNamespace){r[t]=true}s=s||!!e.reexportAll}if(!s||Object.keys(r).length===0)return null;const n=e.scope.generateUidIdentifier("exportNames");delete r.default;return{name:n.name,statement:a.variableDeclaration("var",[a.variableDeclarator(n,a.valueToNode(r))])}}function buildExportInitializationStatements(e,t,r=false){const s=[];const n=[];for(const[e,r]of t.local){if(r.kind==="import"){}else if(r.kind==="hoisted"){s.push(buildInitStatement(t,r.names,a.identifier(e)))}else{n.push(...r.names)}}for(const e of t.source.values()){if(!r){s.push(...buildReexportsFromMeta(t,e,false))}for(const t of e.reexportNamespace){n.push(t)}}s.push(...chunk(n,100).map((r=>buildInitStatement(t,r,e.scope.buildUndefinedNode()))));return s}const f={computed:n.default.expression`EXPORTS["NAME"] = VALUE`,default:n.default.expression`EXPORTS.NAME = VALUE`};function buildInitStatement(e,t,r){const{stringSpecifiers:s,exportName:n}=e;return a.expressionStatement(t.reduce(((e,t)=>{const r={EXPORTS:n,NAME:t,VALUE:e};if(s.has(t)){return f.computed(r)}else{return f.default(r)}}),r))}function chunk(e,t){const r=[];for(let s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasExports=hasExports;t.isSideEffectImport=isSideEffectImport;t.validateImportInteropOption=validateImportInteropOption;t["default"]=normalizeModuleAndLoadMetadata;var s=r(1017);var a=r(1815);var n=r(7058);function hasExports(e){return e.hasExports}function isSideEffectImport(e){return e.imports.size===0&&e.importsNamespace.size===0&&e.reexports.size===0&&e.reexportNamespace.size===0&&!e.reexportAll}function validateImportInteropOption(e){if(typeof e!=="function"&&e!=="none"&&e!=="babel"&&e!=="node"){throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${e}).`)}return e}function resolveImportInterop(e,t){if(typeof e==="function"){return validateImportInteropOption(e(t))}return e}function normalizeModuleAndLoadMetadata(e,t,{importInterop:r,initializeReexports:s=false,lazy:a=false,esNamespaceOnly:n=false}){if(!t){t=e.scope.generateUidIdentifier("exports").name}const o=new Set;nameAnonymousExports(e);const{local:i,source:l,hasExports:c}=getModuleMetadata(e,{initializeReexports:s,lazy:a},o);removeModuleDeclarations(e);for(const[,e]of l){if(e.importsNamespace.size>0){e.name=e.importsNamespace.values().next().value}const t=resolveImportInterop(r,e.source);if(t==="none"){e.interop="none"}else if(t==="node"&&e.interop==="namespace"){e.interop="node-namespace"}else if(t==="node"&&e.interop==="default"){e.interop="node-default"}else if(n&&e.interop==="namespace"){e.interop="default"}}return{exportName:t,exportNameListName:null,hasExports:c,local:i,source:l,stringSpecifiers:o}}function getExportSpecifierName(e,t){if(e.isIdentifier()){return e.node.name}else if(e.isStringLiteral()){const r=e.node.value;if(!(0,a.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.node.type}`)}}function assertExportSpecifier(e){if(e.isExportSpecifier()){return}else if(e.isExportNamespaceSpecifier()){throw e.buildCodeFrameError("Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.")}else{throw e.buildCodeFrameError("Unexpected export specifier type")}}function getModuleMetadata(e,{lazy:t,initializeReexports:r},a){const n=getLocalExportMetadata(e,r,a);const o=new Map;const getData=t=>{const r=t.value;let a=o.get(r);if(!a){a={name:e.scope.generateUidIdentifier((0,s.basename)(r,(0,s.extname)(r))).name,interop:"none",loc:null,imports:new Map,importsNamespace:new Set,reexports:new Map,reexportNamespace:new Set,reexportAll:null,lazy:false,source:r};o.set(r,a)}return a};let i=false;e.get("body").forEach((e=>{if(e.isImportDeclaration()){const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{if(e.isImportDefaultSpecifier()){const r=e.get("local").node.name;t.imports.set(r,"default");const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexports.set(e,"default")}))}}else if(e.isImportNamespaceSpecifier()){const r=e.get("local").node.name;t.importsNamespace.add(r);const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexportNamespace.add(e)}))}}else if(e.isImportSpecifier()){const r=getExportSpecifierName(e.get("imported"),a);const s=e.get("local").node.name;t.imports.set(s,r);const o=n.get(s);if(o){n.delete(s);o.names.forEach((e=>{t.reexports.set(e,r)}))}}}))}else if(e.isExportAllDeclaration()){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;t.reexportAll={loc:e.node.loc}}else if(e.isExportNamedDeclaration()&&e.node.source){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{assertExportSpecifier(e);const r=getExportSpecifierName(e.get("local"),a);const s=getExportSpecifierName(e.get("exported"),a);t.reexports.set(s,r);if(s==="__esModule"){throw e.get("exported").buildCodeFrameError('Illegal export "__esModule".')}}))}else if(e.isExportNamedDeclaration()||e.isExportDefaultDeclaration()){i=true}}));for(const e of o.values()){let t=false;let r=false;if(e.importsNamespace.size>0){t=true;r=true}if(e.reexportAll){r=true}for(const s of e.imports.values()){if(s==="default")t=true;else r=true}for(const s of e.reexports.values()){if(s==="default")t=true;else r=true}if(t&&r){e.interop="namespace"}else if(t){e.interop="default"}}for(const[e,r]of o){if(t!==false&&!(isSideEffectImport(r)||r.reexportAll)){if(t===true){r.lazy=!/\./.test(e)}else if(Array.isArray(t)){r.lazy=t.indexOf(e)!==-1}else if(typeof t==="function"){r.lazy=t(e)}else{throw new Error(`.lazy must be a boolean, string array, or function`)}}}return{hasExports:i,local:n,source:o}}function getLocalExportMetadata(e,t,r){const s=new Map;e.get("body").forEach((e=>{let r;if(e.isImportDeclaration()){r="import"}else{if(e.isExportDefaultDeclaration())e=e.get("declaration");if(e.isExportNamedDeclaration()){if(e.node.declaration){e=e.get("declaration")}else if(t&&e.node.source&&e.get("source").isStringLiteral()){e.get("specifiers").forEach((e=>{assertExportSpecifier(e);s.set(e.get("local").node.name,"block")}));return}}if(e.isFunctionDeclaration()){r="hoisted"}else if(e.isClassDeclaration()){r="block"}else if(e.isVariableDeclaration({kind:"var"})){r="var"}else if(e.isVariableDeclaration()){r="block"}else{return}}Object.keys(e.getOuterBindingIdentifiers()).forEach((e=>{s.set(e,r)}))}));const a=new Map;const getLocalMetadata=e=>{const t=e.node.name;let r=a.get(t);if(!r){const n=s.get(t);if(n===undefined){throw e.buildCodeFrameError(`Exporting local "${t}", which is not declared.`)}r={names:[],kind:n};a.set(t,r)}return r};e.get("body").forEach((e=>{if(e.isExportNamedDeclaration()&&(t||!e.node.source)){if(e.node.declaration){const t=e.get("declaration");const r=t.getOuterBindingIdentifierPaths();Object.keys(r).forEach((e=>{if(e==="__esModule"){throw t.buildCodeFrameError('Illegal export "__esModule".')}getLocalMetadata(r[e]).names.push(e)}))}else{e.get("specifiers").forEach((e=>{const t=e.get("local");const s=e.get("exported");const a=getLocalMetadata(t);const n=getExportSpecifierName(s,r);if(n==="__esModule"){throw s.buildCodeFrameError('Illegal export "__esModule".')}a.names.push(n)}))}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){getLocalMetadata(t.get("id")).names.push("default")}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}}));return a}function nameAnonymousExports(e){e.get("body").forEach((e=>{if(!e.isExportDefaultDeclaration())return;(0,n.default)(e)}))}function removeModuleDeclarations(e){e.get("body").forEach((e=>{if(e.isImportDeclaration()){e.remove()}else if(e.isExportNamedDeclaration()){if(e.node.declaration){e.node.declaration._blockHoist=e.node._blockHoist;e.replaceWith(e.node.declaration)}else{e.remove()}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){t._blockHoist=e.node._blockHoist;e.replaceWith(t)}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}else if(e.isExportAllDeclaration()){e.remove()}}))}},1238:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteLiveReferences;var s=r(9491);var a=r(8622);var n=r(153);var o=r(8865);function rewriteLiveReferences(e,t){const r=new Map;const s=new Map;const requeueInParent=t=>{e.requeue(t)};for(const[e,s]of t.source){for(const[t,a]of s.imports){r.set(t,[e,a,null])}for(const t of s.importsNamespace){r.set(t,[e,null,t])}}for(const[e,r]of t.local){let t=s.get(e);if(!t){t=[];s.set(e,t)}t.push(...r.names)}const n={metadata:t,requeueInParent:requeueInParent,scope:e.scope,exported:s};e.traverse(i,n);(0,o.default)(e,new Set([...Array.from(r.keys()),...Array.from(s.keys())]));const c={seen:new WeakSet,metadata:t,requeueInParent:requeueInParent,scope:e.scope,imported:r,exported:s,buildImportReference:([e,r,s],n)=>{const o=t.source.get(e);if(s){if(o.lazy)n=a.callExpression(n,[]);return n}let i=a.identifier(o.name);if(o.lazy)i=a.callExpression(i,[]);if(r==="default"&&o.interop==="node-default"){return i}const l=t.stringSpecifiers.has(r);return a.memberExpression(i,l?a.stringLiteral(r):a.identifier(r),l)}};e.traverse(l,c)}const i={Scope(e){e.skip()},ClassDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;const{id:n}=e.node;if(!n)throw new Error("Expected class to have a name");const o=n.name;const i=r.get(o)||[];if(i.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,i,a.identifier(o)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}},VariableDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;Object.keys(e.getOuterBindingIdentifiers()).forEach((n=>{const o=r.get(n)||[];if(o.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,o,a.identifier(n)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}}))}};const buildBindingExportAssignmentExpression=(e,t,r)=>(t||[]).reduce(((t,r)=>{const{stringSpecifiers:s}=e;const n=s.has(r);return a.assignmentExpression("=",a.memberExpression(a.identifier(e.exportName),n?a.stringLiteral(r):a.identifier(r),n),t)}),r);const buildImportThrow=e=>n.default.expression.ast` + `({EXPORTS_LIST:e.exportNameListName}):null})}function buildExportNameListDeclaration(e,t){const r=Object.create(null);for(const e of t.local.values()){for(const t of e.names){r[t]=true}}let s=false;for(const e of t.source.values()){for(const t of e.reexports.keys()){r[t]=true}for(const t of e.reexportNamespace){r[t]=true}s=s||!!e.reexportAll}if(!s||Object.keys(r).length===0)return null;const n=e.scope.generateUidIdentifier("exportNames");delete r.default;return{name:n.name,statement:a.variableDeclaration("var",[a.variableDeclarator(n,a.valueToNode(r))])}}function buildExportInitializationStatements(e,t,r=false){const s=[];const n=[];for(const[e,r]of t.local){if(r.kind==="import"){}else if(r.kind==="hoisted"){s.push(buildInitStatement(t,r.names,a.identifier(e)))}else{n.push(...r.names)}}for(const e of t.source.values()){if(!r){s.push(...buildReexportsFromMeta(t,e,false))}for(const t of e.reexportNamespace){n.push(t)}}s.push(...chunk(n,100).map((r=>buildInitStatement(t,r,e.scope.buildUndefinedNode()))));return s}const d={computed:n.default.expression`EXPORTS["NAME"] = VALUE`,default:n.default.expression`EXPORTS.NAME = VALUE`};function buildInitStatement(e,t,r){const{stringSpecifiers:s,exportName:n}=e;return a.expressionStatement(t.reduce(((e,t)=>{const r={EXPORTS:n,NAME:t,VALUE:e};if(s.has(t)){return d.computed(r)}else{return d.default(r)}}),r))}function chunk(e,t){const r=[];for(let s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasExports=hasExports;t.isSideEffectImport=isSideEffectImport;t.validateImportInteropOption=validateImportInteropOption;t["default"]=normalizeModuleAndLoadMetadata;var s=r(1017);var a=r(1815);var n=r(7058);function hasExports(e){return e.hasExports}function isSideEffectImport(e){return e.imports.size===0&&e.importsNamespace.size===0&&e.reexports.size===0&&e.reexportNamespace.size===0&&!e.reexportAll}function validateImportInteropOption(e){if(typeof e!=="function"&&e!=="none"&&e!=="babel"&&e!=="node"){throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${e}).`)}return e}function resolveImportInterop(e,t){if(typeof e==="function"){return validateImportInteropOption(e(t))}return e}function normalizeModuleAndLoadMetadata(e,t,{importInterop:r,initializeReexports:s=false,lazy:a=false,esNamespaceOnly:n=false}){if(!t){t=e.scope.generateUidIdentifier("exports").name}const o=new Set;nameAnonymousExports(e);const{local:i,source:l,hasExports:c}=getModuleMetadata(e,{initializeReexports:s,lazy:a},o);removeModuleDeclarations(e);for(const[,e]of l){if(e.importsNamespace.size>0){e.name=e.importsNamespace.values().next().value}const t=resolveImportInterop(r,e.source);if(t==="none"){e.interop="none"}else if(t==="node"&&e.interop==="namespace"){e.interop="node-namespace"}else if(t==="node"&&e.interop==="default"){e.interop="node-default"}else if(n&&e.interop==="namespace"){e.interop="default"}}return{exportName:t,exportNameListName:null,hasExports:c,local:i,source:l,stringSpecifiers:o}}function getExportSpecifierName(e,t){if(e.isIdentifier()){return e.node.name}else if(e.isStringLiteral()){const r=e.node.value;if(!(0,a.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.node.type}`)}}function assertExportSpecifier(e){if(e.isExportSpecifier()){return}else if(e.isExportNamespaceSpecifier()){throw e.buildCodeFrameError("Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.")}else{throw e.buildCodeFrameError("Unexpected export specifier type")}}function getModuleMetadata(e,{lazy:t,initializeReexports:r},a){const n=getLocalExportMetadata(e,r,a);const o=new Map;const getData=t=>{const r=t.value;let a=o.get(r);if(!a){a={name:e.scope.generateUidIdentifier((0,s.basename)(r,(0,s.extname)(r))).name,interop:"none",loc:null,imports:new Map,importsNamespace:new Set,reexports:new Map,reexportNamespace:new Set,reexportAll:null,lazy:false,source:r};o.set(r,a)}return a};let i=false;e.get("body").forEach((e=>{if(e.isImportDeclaration()){const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{if(e.isImportDefaultSpecifier()){const r=e.get("local").node.name;t.imports.set(r,"default");const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexports.set(e,"default")}))}}else if(e.isImportNamespaceSpecifier()){const r=e.get("local").node.name;t.importsNamespace.add(r);const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexportNamespace.add(e)}))}}else if(e.isImportSpecifier()){const r=getExportSpecifierName(e.get("imported"),a);const s=e.get("local").node.name;t.imports.set(s,r);const o=n.get(s);if(o){n.delete(s);o.names.forEach((e=>{t.reexports.set(e,r)}))}}}))}else if(e.isExportAllDeclaration()){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;t.reexportAll={loc:e.node.loc}}else if(e.isExportNamedDeclaration()&&e.node.source){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{assertExportSpecifier(e);const r=getExportSpecifierName(e.get("local"),a);const s=getExportSpecifierName(e.get("exported"),a);t.reexports.set(s,r);if(s==="__esModule"){throw e.get("exported").buildCodeFrameError('Illegal export "__esModule".')}}))}else if(e.isExportNamedDeclaration()||e.isExportDefaultDeclaration()){i=true}}));for(const e of o.values()){let t=false;let r=false;if(e.importsNamespace.size>0){t=true;r=true}if(e.reexportAll){r=true}for(const s of e.imports.values()){if(s==="default")t=true;else r=true}for(const s of e.reexports.values()){if(s==="default")t=true;else r=true}if(t&&r){e.interop="namespace"}else if(t){e.interop="default"}}for(const[e,r]of o){if(t!==false&&!(isSideEffectImport(r)||r.reexportAll)){if(t===true){r.lazy=!/\./.test(e)}else if(Array.isArray(t)){r.lazy=t.indexOf(e)!==-1}else if(typeof t==="function"){r.lazy=t(e)}else{throw new Error(`.lazy must be a boolean, string array, or function`)}}}return{hasExports:i,local:n,source:o}}function getLocalExportMetadata(e,t,r){const s=new Map;e.get("body").forEach((e=>{let r;if(e.isImportDeclaration()){r="import"}else{if(e.isExportDefaultDeclaration())e=e.get("declaration");if(e.isExportNamedDeclaration()){if(e.node.declaration){e=e.get("declaration")}else if(t&&e.node.source&&e.get("source").isStringLiteral()){e.get("specifiers").forEach((e=>{assertExportSpecifier(e);s.set(e.get("local").node.name,"block")}));return}}if(e.isFunctionDeclaration()){r="hoisted"}else if(e.isClassDeclaration()){r="block"}else if(e.isVariableDeclaration({kind:"var"})){r="var"}else if(e.isVariableDeclaration()){r="block"}else{return}}Object.keys(e.getOuterBindingIdentifiers()).forEach((e=>{s.set(e,r)}))}));const a=new Map;const getLocalMetadata=e=>{const t=e.node.name;let r=a.get(t);if(!r){const n=s.get(t);if(n===undefined){throw e.buildCodeFrameError(`Exporting local "${t}", which is not declared.`)}r={names:[],kind:n};a.set(t,r)}return r};e.get("body").forEach((e=>{if(e.isExportNamedDeclaration()&&(t||!e.node.source)){if(e.node.declaration){const t=e.get("declaration");const r=t.getOuterBindingIdentifierPaths();Object.keys(r).forEach((e=>{if(e==="__esModule"){throw t.buildCodeFrameError('Illegal export "__esModule".')}getLocalMetadata(r[e]).names.push(e)}))}else{e.get("specifiers").forEach((e=>{const t=e.get("local");const s=e.get("exported");const a=getLocalMetadata(t);const n=getExportSpecifierName(s,r);if(n==="__esModule"){throw s.buildCodeFrameError('Illegal export "__esModule".')}a.names.push(n)}))}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){getLocalMetadata(t.get("id")).names.push("default")}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}}));return a}function nameAnonymousExports(e){e.get("body").forEach((e=>{if(!e.isExportDefaultDeclaration())return;(0,n.default)(e)}))}function removeModuleDeclarations(e){e.get("body").forEach((e=>{if(e.isImportDeclaration()){e.remove()}else if(e.isExportNamedDeclaration()){if(e.node.declaration){e.node.declaration._blockHoist=e.node._blockHoist;e.replaceWith(e.node.declaration)}else{e.remove()}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){t._blockHoist=e.node._blockHoist;e.replaceWith(t)}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}else if(e.isExportAllDeclaration()){e.remove()}}))}},1238:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteLiveReferences;var s=r(9491);var a=r(8622);var n=r(153);var o=r(8865);function rewriteLiveReferences(e,t){const r=new Map;const s=new Map;const requeueInParent=t=>{e.requeue(t)};for(const[e,s]of t.source){for(const[t,a]of s.imports){r.set(t,[e,a,null])}for(const t of s.importsNamespace){r.set(t,[e,null,t])}}for(const[e,r]of t.local){let t=s.get(e);if(!t){t=[];s.set(e,t)}t.push(...r.names)}const n={metadata:t,requeueInParent:requeueInParent,scope:e.scope,exported:s};e.traverse(i,n);(0,o.default)(e,new Set([...Array.from(r.keys()),...Array.from(s.keys())]));const c={seen:new WeakSet,metadata:t,requeueInParent:requeueInParent,scope:e.scope,imported:r,exported:s,buildImportReference:([e,r,s],n)=>{const o=t.source.get(e);if(s){if(o.lazy)n=a.callExpression(n,[]);return n}let i=a.identifier(o.name);if(o.lazy)i=a.callExpression(i,[]);if(r==="default"&&o.interop==="node-default"){return i}const l=t.stringSpecifiers.has(r);return a.memberExpression(i,l?a.stringLiteral(r):a.identifier(r),l)}};e.traverse(l,c)}const i={Scope(e){e.skip()},ClassDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;const{id:n}=e.node;if(!n)throw new Error("Expected class to have a name");const o=n.name;const i=r.get(o)||[];if(i.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,i,a.identifier(o)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}},VariableDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;Object.keys(e.getOuterBindingIdentifiers()).forEach((n=>{const o=r.get(n)||[];if(o.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,o,a.identifier(n)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}}))}};const buildBindingExportAssignmentExpression=(e,t,r)=>(t||[]).reduce(((t,r)=>{const{stringSpecifiers:s}=e;const n=s.has(r);return a.assignmentExpression("=",a.memberExpression(a.identifier(e.exportName),n?a.stringLiteral(r):a.identifier(r),n),t)}),r);const buildImportThrow=e=>n.default.expression.ast` (function() { throw new Error('"' + '${e}' + '" is read-only.'); })() - `;const l={ReferencedIdentifier(e){const{seen:t,buildImportReference:r,scope:s,imported:n,requeueInParent:o}=this;if(t.has(e.node))return;t.add(e.node);const i=e.node.name;const l=n.get(i);if(l){const t=e.scope.getBinding(i);const n=s.getBinding(i);if(n!==t)return;const c=r(l,e.node);c.loc=e.node.loc;if((e.parentPath.isCallExpression({callee:e.node})||e.parentPath.isOptionalCallExpression({callee:e.node})||e.parentPath.isTaggedTemplateExpression({tag:e.node}))&&a.isMemberExpression(c)){e.replaceWith(a.sequenceExpression([a.numericLiteral(0),c]))}else if(e.isJSXIdentifier()&&a.isMemberExpression(c)){const{object:t,property:r}=c;e.replaceWith(a.jsxMemberExpression(a.jsxIdentifier(t.name),a.jsxIdentifier(r.name)))}else{e.replaceWith(c)}o(e);e.skip()}},AssignmentExpression:{exit(e){const{scope:t,seen:r,imported:n,exported:o,requeueInParent:i,buildImportReference:l}=this;if(r.has(e.node))return;r.add(e.node);const c=e.get("left");if(c.isMemberExpression())return;if(c.isIdentifier()){const r=c.node.name;if(t.getBinding(r)!==e.scope.getBinding(r)){return}const u=o.get(r);const p=n.get(r);if((u==null?void 0:u.length)>0||p){s(e.node.operator==="=","Path was not simplified");const t=e.node;if(p){t.left=l(p,t.left);t.right=a.sequenceExpression([t.right,buildImportThrow(r)])}e.replaceWith(buildBindingExportAssignmentExpression(this.metadata,u,t));i(e)}}else{const r=c.getOuterBindingIdentifiers();const s=Object.keys(r).filter((r=>t.getBinding(r)===e.scope.getBinding(r)));const l=s.find((e=>n.has(e)));if(l){e.node.right=a.sequenceExpression([e.node.right,buildImportThrow(l)])}const u=[];s.forEach((e=>{const t=o.get(e)||[];if(t.length>0){u.push(buildBindingExportAssignmentExpression(this.metadata,t,a.identifier(e)))}}));if(u.length>0){let t=a.sequenceExpression(u);if(e.parentPath.isExpressionStatement()){t=a.expressionStatement(t);t._blockHoist=e.parentPath.node._blockHoist}const r=e.insertAfter(t)[0];i(r)}}}},"ForOfStatement|ForInStatement"(e){const{scope:t,node:r}=e;const{left:s}=r;const{exported:n,scope:o}=this;if(!a.isVariableDeclaration(s)){let r=false;const i=e.get("body");const l=i.scope;for(const e of Object.keys(a.getOuterBindingIdentifiers(s))){if(n.get(e)&&o.getBinding(e)===t.getBinding(e)){r=true;if(l.hasOwnBinding(e)){l.rename(e)}}}if(!r){return}const c=t.generateUidIdentifierBasedOnNode(s);i.unshiftContainer("body",a.expressionStatement(a.assignmentExpression("=",s,c)));e.get("left").replaceWith(a.variableDeclaration("let",[a.variableDeclarator(a.cloneNode(c))]));t.registerDeclaration(e.get("left"))}}}},2835:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteThis;var s=r(6833);var a=r(7369);var n=r(8622);function rewriteThis(e){(0,a.default)(e.node,Object.assign({},o,{noScope:true}))}const o=a.default.visitors.merge([s.environmentVisitor,{ThisExpression(e){e.replaceWith(n.unaryExpression("void",n.numericLiteral(0),true))}}])},119:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8865:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=simplifyAccess;var s=r(8622);function simplifyAccess(e,t){e.traverse(a,{scope:e.scope,bindingNames:t,seen:new WeakSet})}const a={UpdateExpression:{exit(e){const{scope:t,bindingNames:r}=this;const a=e.get("argument");if(!a.isIdentifier())return;const n=a.node.name;if(!r.has(n))return;if(t.getBinding(n)!==e.scope.getBinding(n)){return}if(e.parentPath.isExpressionStatement()&&!e.isCompletionRecord()){const t=e.node.operator=="++"?"+=":"-=";e.replaceWith(s.assignmentExpression(t,a.node,s.numericLiteral(1)))}else if(e.node.prefix){e.replaceWith(s.assignmentExpression("=",s.identifier(n),s.binaryExpression(e.node.operator[0],s.unaryExpression("+",a.node),s.numericLiteral(1))))}else{const t=e.scope.generateUidIdentifierBasedOnNode(a.node,"old");const r=t.name;e.scope.push({id:t});const n=s.binaryExpression(e.node.operator[0],s.identifier(r),s.numericLiteral(1));e.replaceWith(s.sequenceExpression([s.assignmentExpression("=",s.identifier(r),s.unaryExpression("+",a.node)),s.assignmentExpression("=",s.cloneNode(a.node),n),s.identifier(r)]))}}},AssignmentExpression:{exit(e){const{scope:t,seen:r,bindingNames:a}=this;if(e.node.operator==="=")return;if(r.has(e.node))return;r.add(e.node);const n=e.get("left");if(!n.isIdentifier())return;const o=n.node.name;if(!a.has(o))return;if(t.getBinding(o)!==e.scope.getBinding(o)){return}e.node.right=s.binaryExpression(e.node.operator.slice(0,-1),s.cloneNode(e.node.left),e.node.right);e.node.operator="="}}}},397:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(397);var a=r(5085)},5085:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},9942:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3373);var a=r(1017);var n=r(9970);var o=r(8304);const i=(0,o.template)(`\n GLOBAL_REFERENCE = GLOBAL_REFERENCE || {}\n`);const l=(0,o.template)(`\n (function (global, factory) {\n if (typeof define === "function" && define.amd) {\n define(MODULE_NAME, AMD_ARGUMENTS, factory);\n } else if (typeof exports !== "undefined") {\n factory(COMMONJS_ARGUMENTS);\n } else {\n var mod = { exports: {} };\n factory(BROWSER_ARGUMENTS);\n\n GLOBAL_TO_ASSIGN;\n }\n })(\n typeof globalThis !== "undefined" ? globalThis\n : typeof self !== "undefined" ? self\n : this,\n function(IMPORT_NAMES) {\n })\n`);var c=(0,s.declare)(((e,t)=>{var r,s;e.assertVersion(7);const{globals:c,exactGlobals:u,allowTopLevelThis:p,strict:f,strictMode:d,noInterop:m,importInterop:y}=t;const g=(r=e.assumption("constantReexports"))!=null?r:t.loose;const h=(s=e.assumption("enumerableModuleMeta"))!=null?s:t.loose;function buildBrowserInit(e,t,r,s){const n=s?s.value:(0,a.basename)(r,(0,a.extname)(r));let l=o.types.memberExpression(o.types.identifier("global"),o.types.identifier(o.types.toIdentifier(n)));let c=[];if(t){const t=e[n];if(t){c=[];const e=t.split(".");l=e.slice(1).reduce(((e,t)=>{c.push(i({GLOBAL_REFERENCE:o.types.cloneNode(e)}));return o.types.memberExpression(e,o.types.identifier(t))}),o.types.memberExpression(o.types.identifier("global"),o.types.identifier(e[0])))}}c.push(o.types.expressionStatement(o.types.assignmentExpression("=",l,o.types.memberExpression(o.types.identifier("mod"),o.types.identifier("exports")))));return c}function buildBrowserArg(e,t,r){let s;if(t){const t=e[r];if(t){s=t.split(".").reduce(((e,t)=>o.types.memberExpression(e,o.types.identifier(t))),o.types.identifier("global"))}else{s=o.types.memberExpression(o.types.identifier("global"),o.types.identifier(o.types.toIdentifier(r)))}}else{const t=(0,a.basename)(r,(0,a.extname)(r));const n=e[t]||t;s=o.types.memberExpression(o.types.identifier("global"),o.types.identifier(o.types.toIdentifier(n)))}return s}return{name:"transform-modules-umd",visitor:{Program:{exit(e){if(!(0,n.isModule)(e))return;const r=c||{};let s=(0,n.getModuleName)(this.file.opts,t);if(s)s=o.types.stringLiteral(s);const{meta:a,headers:i}=(0,n.rewriteModuleStatementsAndPrepareHeader)(e,{constantReexports:g,enumerableModuleMeta:h,strict:f,strictMode:d,allowTopLevelThis:p,noInterop:m,importInterop:y});const b=[];const x=[];const v=[];const E=[];if((0,n.hasExports)(a)){b.push(o.types.stringLiteral("exports"));x.push(o.types.identifier("exports"));v.push(o.types.memberExpression(o.types.identifier("mod"),o.types.identifier("exports")));E.push(o.types.identifier(a.exportName))}for(const[t,s]of a.source){b.push(o.types.stringLiteral(t));x.push(o.types.callExpression(o.types.identifier("require"),[o.types.stringLiteral(t)]));v.push(buildBrowserArg(r,u,t));E.push(o.types.identifier(s.name));if(!(0,n.isSideEffectImport)(s)){const t=(0,n.wrapInterop)(e,o.types.identifier(s.name),s.interop);if(t){const e=o.types.expressionStatement(o.types.assignmentExpression("=",o.types.identifier(s.name),t));e.loc=a.loc;i.push(e)}}i.push(...(0,n.buildNamespaceInitStatements)(a,s,g))}(0,n.ensureStatementsHoisted)(i);e.unshiftContainer("body",i);const{body:j,directives:w}=e.node;e.node.directives=[];e.node.body=[];const _=e.pushContainer("body",[l({MODULE_NAME:s,AMD_ARGUMENTS:o.types.arrayExpression(b),COMMONJS_ARGUMENTS:x,BROWSER_ARGUMENTS:v,IMPORT_NAMES:E,GLOBAL_TO_ASSIGN:buildBrowserInit(r,u,this.filename||"unknown",s)})])[0];const S=_.get("expression.arguments")[1].get("body");S.pushContainer("directives",w);S.pushContainer("body",j)}}}}}));t["default"]=c},7945:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=getModuleName;{const e=getModuleName;t["default"]=getModuleName=function getModuleName(t,r){var s,a,n,o;return e(t,{moduleId:(s=r.moduleId)!=null?s:t.moduleId,moduleIds:(a=r.moduleIds)!=null?a:t.moduleIds,getModuleId:(n=r.getModuleId)!=null?n:t.getModuleId,moduleRoot:(o=r.moduleRoot)!=null?o:t.moduleRoot})}}function getModuleName(e,t){const{filename:r,filenameRelative:s=r,sourceRoot:a=t.moduleRoot}=e;const{moduleId:n,moduleIds:o=!!n,getModuleId:i,moduleRoot:l=a}=t;if(!o)return null;if(n!=null&&!i){return n}let c=l!=null?l+"/":"";if(s){const e=a!=null?new RegExp("^"+a+"/?"):"";c+=s.replace(e,"").replace(/\.(\w*?)$/,"")}c=c.replace(/\\/g,"/");if(i){return i(c)||c}else{return c}}},9970:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.rewriteModuleStatementsAndPrepareHeader=rewriteModuleStatementsAndPrepareHeader;t.ensureStatementsHoisted=ensureStatementsHoisted;t.wrapInterop=wrapInterop;t.buildNamespaceInitStatements=buildNamespaceInitStatements;Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return o.isModule}});Object.defineProperty(t,"rewriteThis",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"hasExports",{enumerable:true,get:function(){return c.hasExports}});Object.defineProperty(t,"isSideEffectImport",{enumerable:true,get:function(){return c.isSideEffectImport}});Object.defineProperty(t,"getModuleName",{enumerable:true,get:function(){return u.default}});var s=r(9491);var a=r(8622);var n=r(153);var o=r(9115);var i=r(5244);var l=r(4806);var c=r(7786);var u=r(7945);function rewriteModuleStatementsAndPrepareHeader(e,{loose:t,exportName:r,strict:n,allowTopLevelThis:u,strictMode:p,noInterop:f,importInterop:d=(f?"none":"babel"),lazy:m,esNamespaceOnly:y,constantReexports:g=t,enumerableModuleMeta:h=t}){(0,c.validateImportInteropOption)(d);s((0,o.isModule)(e),"Cannot process module statements in a script");e.node.sourceType="script";const b=(0,c.default)(e,r,{importInterop:d,initializeReexports:g,lazy:m,esNamespaceOnly:y});if(!u){(0,i.default)(e)}(0,l.default)(e,b);if(p!==false){const t=e.node.directives.some((e=>e.value.value==="use strict"));if(!t){e.unshiftContainer("directives",a.directive(a.directiveLiteral("use strict")))}}const x=[];if((0,c.hasExports)(b)&&!n){x.push(buildESModuleHeader(b,h))}const v=buildExportNameListDeclaration(e,b);if(v){b.exportNameListName=v.name;x.push(v.statement)}x.push(...buildExportInitializationStatements(e,b,g));return{meta:b,headers:x}}function ensureStatementsHoisted(e){e.forEach((e=>{e._blockHoist=3}))}function wrapInterop(e,t,r){if(r==="none"){return null}if(r==="node-namespace"){return a.callExpression(e.hub.addHelper("interopRequireWildcard"),[t,a.booleanLiteral(true)])}else if(r==="node-default"){return null}let s;if(r==="default"){s="interopRequireDefault"}else if(r==="namespace"){s="interopRequireWildcard"}else{throw new Error(`Unknown interop: ${r}`)}return a.callExpression(e.hub.addHelper(s),[t])}function buildNamespaceInitStatements(e,t,r=false){const s=[];let o=a.identifier(t.name);if(t.lazy)o=a.callExpression(o,[]);for(const e of t.importsNamespace){if(e===t.name)continue;s.push(n.default.statement`var NAME = SOURCE;`({NAME:e,SOURCE:a.cloneNode(o)}))}if(r){s.push(...buildReexportsFromMeta(e,t,true))}for(const r of t.reexportNamespace){s.push((t.lazy?n.default.statement` + `;const l={ReferencedIdentifier(e){const{seen:t,buildImportReference:r,scope:s,imported:n,requeueInParent:o}=this;if(t.has(e.node))return;t.add(e.node);const i=e.node.name;const l=n.get(i);if(l){const t=e.scope.getBinding(i);const n=s.getBinding(i);if(n!==t)return;const c=r(l,e.node);c.loc=e.node.loc;if((e.parentPath.isCallExpression({callee:e.node})||e.parentPath.isOptionalCallExpression({callee:e.node})||e.parentPath.isTaggedTemplateExpression({tag:e.node}))&&a.isMemberExpression(c)){e.replaceWith(a.sequenceExpression([a.numericLiteral(0),c]))}else if(e.isJSXIdentifier()&&a.isMemberExpression(c)){const{object:t,property:r}=c;e.replaceWith(a.jsxMemberExpression(a.jsxIdentifier(t.name),a.jsxIdentifier(r.name)))}else{e.replaceWith(c)}o(e);e.skip()}},AssignmentExpression:{exit(e){const{scope:t,seen:r,imported:n,exported:o,requeueInParent:i,buildImportReference:l}=this;if(r.has(e.node))return;r.add(e.node);const c=e.get("left");if(c.isMemberExpression())return;if(c.isIdentifier()){const r=c.node.name;if(t.getBinding(r)!==e.scope.getBinding(r)){return}const u=o.get(r);const p=n.get(r);if((u==null?void 0:u.length)>0||p){s(e.node.operator==="=","Path was not simplified");const t=e.node;if(p){t.left=l(p,t.left);t.right=a.sequenceExpression([t.right,buildImportThrow(r)])}e.replaceWith(buildBindingExportAssignmentExpression(this.metadata,u,t));i(e)}}else{const r=c.getOuterBindingIdentifiers();const s=Object.keys(r).filter((r=>t.getBinding(r)===e.scope.getBinding(r)));const l=s.find((e=>n.has(e)));if(l){e.node.right=a.sequenceExpression([e.node.right,buildImportThrow(l)])}const u=[];s.forEach((e=>{const t=o.get(e)||[];if(t.length>0){u.push(buildBindingExportAssignmentExpression(this.metadata,t,a.identifier(e)))}}));if(u.length>0){let t=a.sequenceExpression(u);if(e.parentPath.isExpressionStatement()){t=a.expressionStatement(t);t._blockHoist=e.parentPath.node._blockHoist}const r=e.insertAfter(t)[0];i(r)}}}},"ForOfStatement|ForInStatement"(e){const{scope:t,node:r}=e;const{left:s}=r;const{exported:n,scope:o}=this;if(!a.isVariableDeclaration(s)){let r=false;const i=e.get("body");const l=i.scope;for(const e of Object.keys(a.getOuterBindingIdentifiers(s))){if(n.get(e)&&o.getBinding(e)===t.getBinding(e)){r=true;if(l.hasOwnBinding(e)){l.rename(e)}}}if(!r){return}const c=t.generateUidIdentifierBasedOnNode(s);i.unshiftContainer("body",a.expressionStatement(a.assignmentExpression("=",s,c)));e.get("left").replaceWith(a.variableDeclaration("let",[a.variableDeclarator(a.cloneNode(c))]));t.registerDeclaration(e.get("left"))}}}},2835:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteThis;var s=r(6833);var a=r(7369);var n=r(8622);function rewriteThis(e){(0,a.default)(e.node,Object.assign({},o,{noScope:true}))}const o=a.default.visitors.merge([s.environmentVisitor,{ThisExpression(e){e.replaceWith(n.unaryExpression("void",n.numericLiteral(0),true))}}])},4141:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8865:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=simplifyAccess;var s=r(8622);function simplifyAccess(e,t){e.traverse(a,{scope:e.scope,bindingNames:t,seen:new WeakSet})}const a={UpdateExpression:{exit(e){const{scope:t,bindingNames:r}=this;const a=e.get("argument");if(!a.isIdentifier())return;const n=a.node.name;if(!r.has(n))return;if(t.getBinding(n)!==e.scope.getBinding(n)){return}if(e.parentPath.isExpressionStatement()&&!e.isCompletionRecord()){const t=e.node.operator=="++"?"+=":"-=";e.replaceWith(s.assignmentExpression(t,a.node,s.numericLiteral(1)))}else if(e.node.prefix){e.replaceWith(s.assignmentExpression("=",s.identifier(n),s.binaryExpression(e.node.operator[0],s.unaryExpression("+",a.node),s.numericLiteral(1))))}else{const t=e.scope.generateUidIdentifierBasedOnNode(a.node,"old");const r=t.name;e.scope.push({id:t});const n=s.binaryExpression(e.node.operator[0],s.identifier(r),s.numericLiteral(1));e.replaceWith(s.sequenceExpression([s.assignmentExpression("=",s.identifier(r),s.unaryExpression("+",a.node)),s.assignmentExpression("=",s.cloneNode(a.node),n),s.identifier(r)]))}}},AssignmentExpression:{exit(e){const{scope:t,seen:r,bindingNames:a}=this;if(e.node.operator==="=")return;if(r.has(e.node))return;r.add(e.node);const n=e.get("left");if(!n.isIdentifier())return;const o=n.node.name;if(!a.has(o))return;if(t.getBinding(o)!==e.scope.getBinding(o)){return}e.node.right=s.binaryExpression(e.node.operator.slice(0,-1),s.cloneNode(e.node.left),e.node.right);e.node.operator="="}}}},397:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(397);var a=r(5085)},5085:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},9942:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3373);var a=r(1017);var n=r(9970);var o=r(8304);const i=(0,o.template)(`\n GLOBAL_REFERENCE = GLOBAL_REFERENCE || {}\n`);const l=(0,o.template)(`\n (function (global, factory) {\n if (typeof define === "function" && define.amd) {\n define(MODULE_NAME, AMD_ARGUMENTS, factory);\n } else if (typeof exports !== "undefined") {\n factory(COMMONJS_ARGUMENTS);\n } else {\n var mod = { exports: {} };\n factory(BROWSER_ARGUMENTS);\n\n GLOBAL_TO_ASSIGN;\n }\n })(\n typeof globalThis !== "undefined" ? globalThis\n : typeof self !== "undefined" ? self\n : this,\n function(IMPORT_NAMES) {\n })\n`);var c=(0,s.declare)(((e,t)=>{var r,s;e.assertVersion(7);const{globals:c,exactGlobals:u,allowTopLevelThis:p,strict:d,strictMode:f,noInterop:m,importInterop:y}=t;const g=(r=e.assumption("constantReexports"))!=null?r:t.loose;const h=(s=e.assumption("enumerableModuleMeta"))!=null?s:t.loose;function buildBrowserInit(e,t,r,s){const n=s?s.value:(0,a.basename)(r,(0,a.extname)(r));let l=o.types.memberExpression(o.types.identifier("global"),o.types.identifier(o.types.toIdentifier(n)));let c=[];if(t){const t=e[n];if(t){c=[];const e=t.split(".");l=e.slice(1).reduce(((e,t)=>{c.push(i({GLOBAL_REFERENCE:o.types.cloneNode(e)}));return o.types.memberExpression(e,o.types.identifier(t))}),o.types.memberExpression(o.types.identifier("global"),o.types.identifier(e[0])))}}c.push(o.types.expressionStatement(o.types.assignmentExpression("=",l,o.types.memberExpression(o.types.identifier("mod"),o.types.identifier("exports")))));return c}function buildBrowserArg(e,t,r){let s;if(t){const t=e[r];if(t){s=t.split(".").reduce(((e,t)=>o.types.memberExpression(e,o.types.identifier(t))),o.types.identifier("global"))}else{s=o.types.memberExpression(o.types.identifier("global"),o.types.identifier(o.types.toIdentifier(r)))}}else{const t=(0,a.basename)(r,(0,a.extname)(r));const n=e[t]||t;s=o.types.memberExpression(o.types.identifier("global"),o.types.identifier(o.types.toIdentifier(n)))}return s}return{name:"transform-modules-umd",visitor:{Program:{exit(e){if(!(0,n.isModule)(e))return;const r=c||{};let s=(0,n.getModuleName)(this.file.opts,t);if(s)s=o.types.stringLiteral(s);const{meta:a,headers:i}=(0,n.rewriteModuleStatementsAndPrepareHeader)(e,{constantReexports:g,enumerableModuleMeta:h,strict:d,strictMode:f,allowTopLevelThis:p,noInterop:m,importInterop:y});const b=[];const x=[];const v=[];const E=[];if((0,n.hasExports)(a)){b.push(o.types.stringLiteral("exports"));x.push(o.types.identifier("exports"));v.push(o.types.memberExpression(o.types.identifier("mod"),o.types.identifier("exports")));E.push(o.types.identifier(a.exportName))}for(const[t,s]of a.source){b.push(o.types.stringLiteral(t));x.push(o.types.callExpression(o.types.identifier("require"),[o.types.stringLiteral(t)]));v.push(buildBrowserArg(r,u,t));E.push(o.types.identifier(s.name));if(!(0,n.isSideEffectImport)(s)){const t=(0,n.wrapInterop)(e,o.types.identifier(s.name),s.interop);if(t){const e=o.types.expressionStatement(o.types.assignmentExpression("=",o.types.identifier(s.name),t));e.loc=a.loc;i.push(e)}}i.push(...(0,n.buildNamespaceInitStatements)(a,s,g))}(0,n.ensureStatementsHoisted)(i);e.unshiftContainer("body",i);const{body:j,directives:w}=e.node;e.node.directives=[];e.node.body=[];const _=e.pushContainer("body",[l({MODULE_NAME:s,AMD_ARGUMENTS:o.types.arrayExpression(b),COMMONJS_ARGUMENTS:x,BROWSER_ARGUMENTS:v,IMPORT_NAMES:E,GLOBAL_TO_ASSIGN:buildBrowserInit(r,u,this.filename||"unknown",s)})])[0];const S=_.get("expression.arguments")[1].get("body");S.pushContainer("directives",w);S.pushContainer("body",j)}}}}}));t["default"]=c},7945:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=getModuleName;{const e=getModuleName;t["default"]=getModuleName=function getModuleName(t,r){var s,a,n,o;return e(t,{moduleId:(s=r.moduleId)!=null?s:t.moduleId,moduleIds:(a=r.moduleIds)!=null?a:t.moduleIds,getModuleId:(n=r.getModuleId)!=null?n:t.getModuleId,moduleRoot:(o=r.moduleRoot)!=null?o:t.moduleRoot})}}function getModuleName(e,t){const{filename:r,filenameRelative:s=r,sourceRoot:a=t.moduleRoot}=e;const{moduleId:n,moduleIds:o=!!n,getModuleId:i,moduleRoot:l=a}=t;if(!o)return null;if(n!=null&&!i){return n}let c=l!=null?l+"/":"";if(s){const e=a!=null?new RegExp("^"+a+"/?"):"";c+=s.replace(e,"").replace(/\.(\w*?)$/,"")}c=c.replace(/\\/g,"/");if(i){return i(c)||c}else{return c}}},9970:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.rewriteModuleStatementsAndPrepareHeader=rewriteModuleStatementsAndPrepareHeader;t.ensureStatementsHoisted=ensureStatementsHoisted;t.wrapInterop=wrapInterop;t.buildNamespaceInitStatements=buildNamespaceInitStatements;Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return o.isModule}});Object.defineProperty(t,"rewriteThis",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"hasExports",{enumerable:true,get:function(){return c.hasExports}});Object.defineProperty(t,"isSideEffectImport",{enumerable:true,get:function(){return c.isSideEffectImport}});Object.defineProperty(t,"getModuleName",{enumerable:true,get:function(){return u.default}});var s=r(9491);var a=r(8622);var n=r(153);var o=r(6039);var i=r(5244);var l=r(4806);var c=r(7786);var u=r(7945);function rewriteModuleStatementsAndPrepareHeader(e,{loose:t,exportName:r,strict:n,allowTopLevelThis:u,strictMode:p,noInterop:d,importInterop:f=(d?"none":"babel"),lazy:m,esNamespaceOnly:y,constantReexports:g=t,enumerableModuleMeta:h=t}){(0,c.validateImportInteropOption)(f);s((0,o.isModule)(e),"Cannot process module statements in a script");e.node.sourceType="script";const b=(0,c.default)(e,r,{importInterop:f,initializeReexports:g,lazy:m,esNamespaceOnly:y});if(!u){(0,i.default)(e)}(0,l.default)(e,b);if(p!==false){const t=e.node.directives.some((e=>e.value.value==="use strict"));if(!t){e.unshiftContainer("directives",a.directive(a.directiveLiteral("use strict")))}}const x=[];if((0,c.hasExports)(b)&&!n){x.push(buildESModuleHeader(b,h))}const v=buildExportNameListDeclaration(e,b);if(v){b.exportNameListName=v.name;x.push(v.statement)}x.push(...buildExportInitializationStatements(e,b,g));return{meta:b,headers:x}}function ensureStatementsHoisted(e){e.forEach((e=>{e._blockHoist=3}))}function wrapInterop(e,t,r){if(r==="none"){return null}if(r==="node-namespace"){return a.callExpression(e.hub.addHelper("interopRequireWildcard"),[t,a.booleanLiteral(true)])}else if(r==="node-default"){return null}let s;if(r==="default"){s="interopRequireDefault"}else if(r==="namespace"){s="interopRequireWildcard"}else{throw new Error(`Unknown interop: ${r}`)}return a.callExpression(e.hub.addHelper(s),[t])}function buildNamespaceInitStatements(e,t,r=false){const s=[];let o=a.identifier(t.name);if(t.lazy)o=a.callExpression(o,[]);for(const e of t.importsNamespace){if(e===t.name)continue;s.push(n.default.statement`var NAME = SOURCE;`({NAME:e,SOURCE:a.cloneNode(o)}))}if(r){s.push(...buildReexportsFromMeta(e,t,true))}for(const r of t.reexportNamespace){s.push((t.lazy?n.default.statement` Object.defineProperty(EXPORTS, "NAME", { enumerable: true, get: function() { @@ -295,15 +370,15 @@ }); `)({NAMESPACE:t,EXPORTS:e.exportName,VERIFY_NAME_LIST:e.exportNameListName?(0,n.default)` if (Object.prototype.hasOwnProperty.call(EXPORTS_LIST, key)) return; - `({EXPORTS_LIST:e.exportNameListName}):null})}function buildExportNameListDeclaration(e,t){const r=Object.create(null);for(const e of t.local.values()){for(const t of e.names){r[t]=true}}let s=false;for(const e of t.source.values()){for(const t of e.reexports.keys()){r[t]=true}for(const t of e.reexportNamespace){r[t]=true}s=s||!!e.reexportAll}if(!s||Object.keys(r).length===0)return null;const n=e.scope.generateUidIdentifier("exportNames");delete r.default;return{name:n.name,statement:a.variableDeclaration("var",[a.variableDeclarator(n,a.valueToNode(r))])}}function buildExportInitializationStatements(e,t,r=false){const s=[];const n=[];for(const[e,r]of t.local){if(r.kind==="import"){}else if(r.kind==="hoisted"){s.push(buildInitStatement(t,r.names,a.identifier(e)))}else{n.push(...r.names)}}for(const e of t.source.values()){if(!r){s.push(...buildReexportsFromMeta(t,e,false))}for(const t of e.reexportNamespace){n.push(t)}}s.push(...chunk(n,100).map((r=>buildInitStatement(t,r,e.scope.buildUndefinedNode()))));return s}const f={computed:n.default.expression`EXPORTS["NAME"] = VALUE`,default:n.default.expression`EXPORTS.NAME = VALUE`};function buildInitStatement(e,t,r){const{stringSpecifiers:s,exportName:n}=e;return a.expressionStatement(t.reduce(((e,t)=>{const r={EXPORTS:n,NAME:t,VALUE:e};if(s.has(t)){return f.computed(r)}else{return f.default(r)}}),r))}function chunk(e,t){const r=[];for(let s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasExports=hasExports;t.isSideEffectImport=isSideEffectImport;t.validateImportInteropOption=validateImportInteropOption;t["default"]=normalizeModuleAndLoadMetadata;var s=r(1017);var a=r(7442);var n=r(7058);function hasExports(e){return e.hasExports}function isSideEffectImport(e){return e.imports.size===0&&e.importsNamespace.size===0&&e.reexports.size===0&&e.reexportNamespace.size===0&&!e.reexportAll}function validateImportInteropOption(e){if(typeof e!=="function"&&e!=="none"&&e!=="babel"&&e!=="node"){throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${e}).`)}return e}function resolveImportInterop(e,t){if(typeof e==="function"){return validateImportInteropOption(e(t))}return e}function normalizeModuleAndLoadMetadata(e,t,{importInterop:r,initializeReexports:s=false,lazy:a=false,esNamespaceOnly:n=false}){if(!t){t=e.scope.generateUidIdentifier("exports").name}const o=new Set;nameAnonymousExports(e);const{local:i,source:l,hasExports:c}=getModuleMetadata(e,{initializeReexports:s,lazy:a},o);removeModuleDeclarations(e);for(const[,e]of l){if(e.importsNamespace.size>0){e.name=e.importsNamespace.values().next().value}const t=resolveImportInterop(r,e.source);if(t==="none"){e.interop="none"}else if(t==="node"&&e.interop==="namespace"){e.interop="node-namespace"}else if(t==="node"&&e.interop==="default"){e.interop="node-default"}else if(n&&e.interop==="namespace"){e.interop="default"}}return{exportName:t,exportNameListName:null,hasExports:c,local:i,source:l,stringSpecifiers:o}}function getExportSpecifierName(e,t){if(e.isIdentifier()){return e.node.name}else if(e.isStringLiteral()){const r=e.node.value;if(!(0,a.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.node.type}`)}}function assertExportSpecifier(e){if(e.isExportSpecifier()){return}else if(e.isExportNamespaceSpecifier()){throw e.buildCodeFrameError("Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.")}else{throw e.buildCodeFrameError("Unexpected export specifier type")}}function getModuleMetadata(e,{lazy:t,initializeReexports:r},a){const n=getLocalExportMetadata(e,r,a);const o=new Map;const getData=t=>{const r=t.value;let a=o.get(r);if(!a){a={name:e.scope.generateUidIdentifier((0,s.basename)(r,(0,s.extname)(r))).name,interop:"none",loc:null,imports:new Map,importsNamespace:new Set,reexports:new Map,reexportNamespace:new Set,reexportAll:null,lazy:false,source:r};o.set(r,a)}return a};let i=false;e.get("body").forEach((e=>{if(e.isImportDeclaration()){const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{if(e.isImportDefaultSpecifier()){const r=e.get("local").node.name;t.imports.set(r,"default");const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexports.set(e,"default")}))}}else if(e.isImportNamespaceSpecifier()){const r=e.get("local").node.name;t.importsNamespace.add(r);const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexportNamespace.add(e)}))}}else if(e.isImportSpecifier()){const r=getExportSpecifierName(e.get("imported"),a);const s=e.get("local").node.name;t.imports.set(s,r);const o=n.get(s);if(o){n.delete(s);o.names.forEach((e=>{t.reexports.set(e,r)}))}}}))}else if(e.isExportAllDeclaration()){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;t.reexportAll={loc:e.node.loc}}else if(e.isExportNamedDeclaration()&&e.node.source){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{assertExportSpecifier(e);const r=getExportSpecifierName(e.get("local"),a);const s=getExportSpecifierName(e.get("exported"),a);t.reexports.set(s,r);if(s==="__esModule"){throw e.get("exported").buildCodeFrameError('Illegal export "__esModule".')}}))}else if(e.isExportNamedDeclaration()||e.isExportDefaultDeclaration()){i=true}}));for(const e of o.values()){let t=false;let r=false;if(e.importsNamespace.size>0){t=true;r=true}if(e.reexportAll){r=true}for(const s of e.imports.values()){if(s==="default")t=true;else r=true}for(const s of e.reexports.values()){if(s==="default")t=true;else r=true}if(t&&r){e.interop="namespace"}else if(t){e.interop="default"}}for(const[e,r]of o){if(t!==false&&!(isSideEffectImport(r)||r.reexportAll)){if(t===true){r.lazy=!/\./.test(e)}else if(Array.isArray(t)){r.lazy=t.indexOf(e)!==-1}else if(typeof t==="function"){r.lazy=t(e)}else{throw new Error(`.lazy must be a boolean, string array, or function`)}}}return{hasExports:i,local:n,source:o}}function getLocalExportMetadata(e,t,r){const s=new Map;e.get("body").forEach((e=>{let r;if(e.isImportDeclaration()){r="import"}else{if(e.isExportDefaultDeclaration())e=e.get("declaration");if(e.isExportNamedDeclaration()){if(e.node.declaration){e=e.get("declaration")}else if(t&&e.node.source&&e.get("source").isStringLiteral()){e.get("specifiers").forEach((e=>{assertExportSpecifier(e);s.set(e.get("local").node.name,"block")}));return}}if(e.isFunctionDeclaration()){r="hoisted"}else if(e.isClassDeclaration()){r="block"}else if(e.isVariableDeclaration({kind:"var"})){r="var"}else if(e.isVariableDeclaration()){r="block"}else{return}}Object.keys(e.getOuterBindingIdentifiers()).forEach((e=>{s.set(e,r)}))}));const a=new Map;const getLocalMetadata=e=>{const t=e.node.name;let r=a.get(t);if(!r){const n=s.get(t);if(n===undefined){throw e.buildCodeFrameError(`Exporting local "${t}", which is not declared.`)}r={names:[],kind:n};a.set(t,r)}return r};e.get("body").forEach((e=>{if(e.isExportNamedDeclaration()&&(t||!e.node.source)){if(e.node.declaration){const t=e.get("declaration");const r=t.getOuterBindingIdentifierPaths();Object.keys(r).forEach((e=>{if(e==="__esModule"){throw t.buildCodeFrameError('Illegal export "__esModule".')}getLocalMetadata(r[e]).names.push(e)}))}else{e.get("specifiers").forEach((e=>{const t=e.get("local");const s=e.get("exported");const a=getLocalMetadata(t);const n=getExportSpecifierName(s,r);if(n==="__esModule"){throw s.buildCodeFrameError('Illegal export "__esModule".')}a.names.push(n)}))}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){getLocalMetadata(t.get("id")).names.push("default")}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}}));return a}function nameAnonymousExports(e){e.get("body").forEach((e=>{if(!e.isExportDefaultDeclaration())return;(0,n.default)(e)}))}function removeModuleDeclarations(e){e.get("body").forEach((e=>{if(e.isImportDeclaration()){e.remove()}else if(e.isExportNamedDeclaration()){if(e.node.declaration){e.node.declaration._blockHoist=e.node._blockHoist;e.replaceWith(e.node.declaration)}else{e.remove()}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){t._blockHoist=e.node._blockHoist;e.replaceWith(t)}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}else if(e.isExportAllDeclaration()){e.remove()}}))}},4806:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteLiveReferences;var s=r(9491);var a=r(8622);var n=r(153);var o=r(8140);function rewriteLiveReferences(e,t){const r=new Map;const s=new Map;const requeueInParent=t=>{e.requeue(t)};for(const[e,s]of t.source){for(const[t,a]of s.imports){r.set(t,[e,a,null])}for(const t of s.importsNamespace){r.set(t,[e,null,t])}}for(const[e,r]of t.local){let t=s.get(e);if(!t){t=[];s.set(e,t)}t.push(...r.names)}const n={metadata:t,requeueInParent:requeueInParent,scope:e.scope,exported:s};e.traverse(i,n);(0,o.default)(e,new Set([...Array.from(r.keys()),...Array.from(s.keys())]));const c={seen:new WeakSet,metadata:t,requeueInParent:requeueInParent,scope:e.scope,imported:r,exported:s,buildImportReference:([e,r,s],n)=>{const o=t.source.get(e);if(s){if(o.lazy)n=a.callExpression(n,[]);return n}let i=a.identifier(o.name);if(o.lazy)i=a.callExpression(i,[]);if(r==="default"&&o.interop==="node-default"){return i}const l=t.stringSpecifiers.has(r);return a.memberExpression(i,l?a.stringLiteral(r):a.identifier(r),l)}};e.traverse(l,c)}const i={Scope(e){e.skip()},ClassDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;const{id:n}=e.node;if(!n)throw new Error("Expected class to have a name");const o=n.name;const i=r.get(o)||[];if(i.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,i,a.identifier(o)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}},VariableDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;Object.keys(e.getOuterBindingIdentifiers()).forEach((n=>{const o=r.get(n)||[];if(o.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,o,a.identifier(n)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}}))}};const buildBindingExportAssignmentExpression=(e,t,r)=>(t||[]).reduce(((t,r)=>{const{stringSpecifiers:s}=e;const n=s.has(r);return a.assignmentExpression("=",a.memberExpression(a.identifier(e.exportName),n?a.stringLiteral(r):a.identifier(r),n),t)}),r);const buildImportThrow=e=>n.default.expression.ast` + `({EXPORTS_LIST:e.exportNameListName}):null})}function buildExportNameListDeclaration(e,t){const r=Object.create(null);for(const e of t.local.values()){for(const t of e.names){r[t]=true}}let s=false;for(const e of t.source.values()){for(const t of e.reexports.keys()){r[t]=true}for(const t of e.reexportNamespace){r[t]=true}s=s||!!e.reexportAll}if(!s||Object.keys(r).length===0)return null;const n=e.scope.generateUidIdentifier("exportNames");delete r.default;return{name:n.name,statement:a.variableDeclaration("var",[a.variableDeclarator(n,a.valueToNode(r))])}}function buildExportInitializationStatements(e,t,r=false){const s=[];const n=[];for(const[e,r]of t.local){if(r.kind==="import"){}else if(r.kind==="hoisted"){s.push(buildInitStatement(t,r.names,a.identifier(e)))}else{n.push(...r.names)}}for(const e of t.source.values()){if(!r){s.push(...buildReexportsFromMeta(t,e,false))}for(const t of e.reexportNamespace){n.push(t)}}s.push(...chunk(n,100).map((r=>buildInitStatement(t,r,e.scope.buildUndefinedNode()))));return s}const d={computed:n.default.expression`EXPORTS["NAME"] = VALUE`,default:n.default.expression`EXPORTS.NAME = VALUE`};function buildInitStatement(e,t,r){const{stringSpecifiers:s,exportName:n}=e;return a.expressionStatement(t.reduce(((e,t)=>{const r={EXPORTS:n,NAME:t,VALUE:e};if(s.has(t)){return d.computed(r)}else{return d.default(r)}}),r))}function chunk(e,t){const r=[];for(let s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasExports=hasExports;t.isSideEffectImport=isSideEffectImport;t.validateImportInteropOption=validateImportInteropOption;t["default"]=normalizeModuleAndLoadMetadata;var s=r(1017);var a=r(7442);var n=r(7058);function hasExports(e){return e.hasExports}function isSideEffectImport(e){return e.imports.size===0&&e.importsNamespace.size===0&&e.reexports.size===0&&e.reexportNamespace.size===0&&!e.reexportAll}function validateImportInteropOption(e){if(typeof e!=="function"&&e!=="none"&&e!=="babel"&&e!=="node"){throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${e}).`)}return e}function resolveImportInterop(e,t){if(typeof e==="function"){return validateImportInteropOption(e(t))}return e}function normalizeModuleAndLoadMetadata(e,t,{importInterop:r,initializeReexports:s=false,lazy:a=false,esNamespaceOnly:n=false}){if(!t){t=e.scope.generateUidIdentifier("exports").name}const o=new Set;nameAnonymousExports(e);const{local:i,source:l,hasExports:c}=getModuleMetadata(e,{initializeReexports:s,lazy:a},o);removeModuleDeclarations(e);for(const[,e]of l){if(e.importsNamespace.size>0){e.name=e.importsNamespace.values().next().value}const t=resolveImportInterop(r,e.source);if(t==="none"){e.interop="none"}else if(t==="node"&&e.interop==="namespace"){e.interop="node-namespace"}else if(t==="node"&&e.interop==="default"){e.interop="node-default"}else if(n&&e.interop==="namespace"){e.interop="default"}}return{exportName:t,exportNameListName:null,hasExports:c,local:i,source:l,stringSpecifiers:o}}function getExportSpecifierName(e,t){if(e.isIdentifier()){return e.node.name}else if(e.isStringLiteral()){const r=e.node.value;if(!(0,a.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.node.type}`)}}function assertExportSpecifier(e){if(e.isExportSpecifier()){return}else if(e.isExportNamespaceSpecifier()){throw e.buildCodeFrameError("Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.")}else{throw e.buildCodeFrameError("Unexpected export specifier type")}}function getModuleMetadata(e,{lazy:t,initializeReexports:r},a){const n=getLocalExportMetadata(e,r,a);const o=new Map;const getData=t=>{const r=t.value;let a=o.get(r);if(!a){a={name:e.scope.generateUidIdentifier((0,s.basename)(r,(0,s.extname)(r))).name,interop:"none",loc:null,imports:new Map,importsNamespace:new Set,reexports:new Map,reexportNamespace:new Set,reexportAll:null,lazy:false,source:r};o.set(r,a)}return a};let i=false;e.get("body").forEach((e=>{if(e.isImportDeclaration()){const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{if(e.isImportDefaultSpecifier()){const r=e.get("local").node.name;t.imports.set(r,"default");const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexports.set(e,"default")}))}}else if(e.isImportNamespaceSpecifier()){const r=e.get("local").node.name;t.importsNamespace.add(r);const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexportNamespace.add(e)}))}}else if(e.isImportSpecifier()){const r=getExportSpecifierName(e.get("imported"),a);const s=e.get("local").node.name;t.imports.set(s,r);const o=n.get(s);if(o){n.delete(s);o.names.forEach((e=>{t.reexports.set(e,r)}))}}}))}else if(e.isExportAllDeclaration()){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;t.reexportAll={loc:e.node.loc}}else if(e.isExportNamedDeclaration()&&e.node.source){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{assertExportSpecifier(e);const r=getExportSpecifierName(e.get("local"),a);const s=getExportSpecifierName(e.get("exported"),a);t.reexports.set(s,r);if(s==="__esModule"){throw e.get("exported").buildCodeFrameError('Illegal export "__esModule".')}}))}else if(e.isExportNamedDeclaration()||e.isExportDefaultDeclaration()){i=true}}));for(const e of o.values()){let t=false;let r=false;if(e.importsNamespace.size>0){t=true;r=true}if(e.reexportAll){r=true}for(const s of e.imports.values()){if(s==="default")t=true;else r=true}for(const s of e.reexports.values()){if(s==="default")t=true;else r=true}if(t&&r){e.interop="namespace"}else if(t){e.interop="default"}}for(const[e,r]of o){if(t!==false&&!(isSideEffectImport(r)||r.reexportAll)){if(t===true){r.lazy=!/\./.test(e)}else if(Array.isArray(t)){r.lazy=t.indexOf(e)!==-1}else if(typeof t==="function"){r.lazy=t(e)}else{throw new Error(`.lazy must be a boolean, string array, or function`)}}}return{hasExports:i,local:n,source:o}}function getLocalExportMetadata(e,t,r){const s=new Map;e.get("body").forEach((e=>{let r;if(e.isImportDeclaration()){r="import"}else{if(e.isExportDefaultDeclaration())e=e.get("declaration");if(e.isExportNamedDeclaration()){if(e.node.declaration){e=e.get("declaration")}else if(t&&e.node.source&&e.get("source").isStringLiteral()){e.get("specifiers").forEach((e=>{assertExportSpecifier(e);s.set(e.get("local").node.name,"block")}));return}}if(e.isFunctionDeclaration()){r="hoisted"}else if(e.isClassDeclaration()){r="block"}else if(e.isVariableDeclaration({kind:"var"})){r="var"}else if(e.isVariableDeclaration()){r="block"}else{return}}Object.keys(e.getOuterBindingIdentifiers()).forEach((e=>{s.set(e,r)}))}));const a=new Map;const getLocalMetadata=e=>{const t=e.node.name;let r=a.get(t);if(!r){const n=s.get(t);if(n===undefined){throw e.buildCodeFrameError(`Exporting local "${t}", which is not declared.`)}r={names:[],kind:n};a.set(t,r)}return r};e.get("body").forEach((e=>{if(e.isExportNamedDeclaration()&&(t||!e.node.source)){if(e.node.declaration){const t=e.get("declaration");const r=t.getOuterBindingIdentifierPaths();Object.keys(r).forEach((e=>{if(e==="__esModule"){throw t.buildCodeFrameError('Illegal export "__esModule".')}getLocalMetadata(r[e]).names.push(e)}))}else{e.get("specifiers").forEach((e=>{const t=e.get("local");const s=e.get("exported");const a=getLocalMetadata(t);const n=getExportSpecifierName(s,r);if(n==="__esModule"){throw s.buildCodeFrameError('Illegal export "__esModule".')}a.names.push(n)}))}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){getLocalMetadata(t.get("id")).names.push("default")}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}}));return a}function nameAnonymousExports(e){e.get("body").forEach((e=>{if(!e.isExportDefaultDeclaration())return;(0,n.default)(e)}))}function removeModuleDeclarations(e){e.get("body").forEach((e=>{if(e.isImportDeclaration()){e.remove()}else if(e.isExportNamedDeclaration()){if(e.node.declaration){e.node.declaration._blockHoist=e.node._blockHoist;e.replaceWith(e.node.declaration)}else{e.remove()}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){t._blockHoist=e.node._blockHoist;e.replaceWith(t)}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}else if(e.isExportAllDeclaration()){e.remove()}}))}},4806:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteLiveReferences;var s=r(9491);var a=r(8622);var n=r(153);var o=r(8140);function rewriteLiveReferences(e,t){const r=new Map;const s=new Map;const requeueInParent=t=>{e.requeue(t)};for(const[e,s]of t.source){for(const[t,a]of s.imports){r.set(t,[e,a,null])}for(const t of s.importsNamespace){r.set(t,[e,null,t])}}for(const[e,r]of t.local){let t=s.get(e);if(!t){t=[];s.set(e,t)}t.push(...r.names)}const n={metadata:t,requeueInParent:requeueInParent,scope:e.scope,exported:s};e.traverse(i,n);(0,o.default)(e,new Set([...Array.from(r.keys()),...Array.from(s.keys())]));const c={seen:new WeakSet,metadata:t,requeueInParent:requeueInParent,scope:e.scope,imported:r,exported:s,buildImportReference:([e,r,s],n)=>{const o=t.source.get(e);if(s){if(o.lazy)n=a.callExpression(n,[]);return n}let i=a.identifier(o.name);if(o.lazy)i=a.callExpression(i,[]);if(r==="default"&&o.interop==="node-default"){return i}const l=t.stringSpecifiers.has(r);return a.memberExpression(i,l?a.stringLiteral(r):a.identifier(r),l)}};e.traverse(l,c)}const i={Scope(e){e.skip()},ClassDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;const{id:n}=e.node;if(!n)throw new Error("Expected class to have a name");const o=n.name;const i=r.get(o)||[];if(i.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,i,a.identifier(o)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}},VariableDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;Object.keys(e.getOuterBindingIdentifiers()).forEach((n=>{const o=r.get(n)||[];if(o.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,o,a.identifier(n)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}}))}};const buildBindingExportAssignmentExpression=(e,t,r)=>(t||[]).reduce(((t,r)=>{const{stringSpecifiers:s}=e;const n=s.has(r);return a.assignmentExpression("=",a.memberExpression(a.identifier(e.exportName),n?a.stringLiteral(r):a.identifier(r),n),t)}),r);const buildImportThrow=e=>n.default.expression.ast` (function() { throw new Error('"' + '${e}' + '" is read-only.'); })() - `;const l={ReferencedIdentifier(e){const{seen:t,buildImportReference:r,scope:s,imported:n,requeueInParent:o}=this;if(t.has(e.node))return;t.add(e.node);const i=e.node.name;const l=n.get(i);if(l){const t=e.scope.getBinding(i);const n=s.getBinding(i);if(n!==t)return;const c=r(l,e.node);c.loc=e.node.loc;if((e.parentPath.isCallExpression({callee:e.node})||e.parentPath.isOptionalCallExpression({callee:e.node})||e.parentPath.isTaggedTemplateExpression({tag:e.node}))&&a.isMemberExpression(c)){e.replaceWith(a.sequenceExpression([a.numericLiteral(0),c]))}else if(e.isJSXIdentifier()&&a.isMemberExpression(c)){const{object:t,property:r}=c;e.replaceWith(a.jsxMemberExpression(a.jsxIdentifier(t.name),a.jsxIdentifier(r.name)))}else{e.replaceWith(c)}o(e);e.skip()}},AssignmentExpression:{exit(e){const{scope:t,seen:r,imported:n,exported:o,requeueInParent:i,buildImportReference:l}=this;if(r.has(e.node))return;r.add(e.node);const c=e.get("left");if(c.isMemberExpression())return;if(c.isIdentifier()){const r=c.node.name;if(t.getBinding(r)!==e.scope.getBinding(r)){return}const u=o.get(r);const p=n.get(r);if((u==null?void 0:u.length)>0||p){s(e.node.operator==="=","Path was not simplified");const t=e.node;if(p){t.left=l(p,t.left);t.right=a.sequenceExpression([t.right,buildImportThrow(r)])}e.replaceWith(buildBindingExportAssignmentExpression(this.metadata,u,t));i(e)}}else{const r=c.getOuterBindingIdentifiers();const s=Object.keys(r).filter((r=>t.getBinding(r)===e.scope.getBinding(r)));const l=s.find((e=>n.has(e)));if(l){e.node.right=a.sequenceExpression([e.node.right,buildImportThrow(l)])}const u=[];s.forEach((e=>{const t=o.get(e)||[];if(t.length>0){u.push(buildBindingExportAssignmentExpression(this.metadata,t,a.identifier(e)))}}));if(u.length>0){let t=a.sequenceExpression(u);if(e.parentPath.isExpressionStatement()){t=a.expressionStatement(t);t._blockHoist=e.parentPath.node._blockHoist}const r=e.insertAfter(t)[0];i(r)}}}},"ForOfStatement|ForInStatement"(e){const{scope:t,node:r}=e;const{left:s}=r;const{exported:n,scope:o}=this;if(!a.isVariableDeclaration(s)){let r=false;const i=e.get("body");const l=i.scope;for(const e of Object.keys(a.getOuterBindingIdentifiers(s))){if(n.get(e)&&o.getBinding(e)===t.getBinding(e)){r=true;if(l.hasOwnBinding(e)){l.rename(e)}}}if(!r){return}const c=t.generateUidIdentifierBasedOnNode(s);i.unshiftContainer("body",a.expressionStatement(a.assignmentExpression("=",s,c)));e.get("left").replaceWith(a.variableDeclaration("let",[a.variableDeclarator(a.cloneNode(c))]));t.registerDeclaration(e.get("left"))}}}},5244:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteThis;var s=r(6833);var a=r(7369);var n=r(8622);function rewriteThis(e){(0,a.default)(e.node,Object.assign({},o,{noScope:true}))}const o=a.default.visitors.merge([s.environmentVisitor,{ThisExpression(e){e.replaceWith(n.unaryExpression("void",n.numericLiteral(0),true))}}])},3373:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8140:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=simplifyAccess;var s=r(8622);function simplifyAccess(e,t){e.traverse(a,{scope:e.scope,bindingNames:t,seen:new WeakSet})}const a={UpdateExpression:{exit(e){const{scope:t,bindingNames:r}=this;const a=e.get("argument");if(!a.isIdentifier())return;const n=a.node.name;if(!r.has(n))return;if(t.getBinding(n)!==e.scope.getBinding(n)){return}if(e.parentPath.isExpressionStatement()&&!e.isCompletionRecord()){const t=e.node.operator=="++"?"+=":"-=";e.replaceWith(s.assignmentExpression(t,a.node,s.numericLiteral(1)))}else if(e.node.prefix){e.replaceWith(s.assignmentExpression("=",s.identifier(n),s.binaryExpression(e.node.operator[0],s.unaryExpression("+",a.node),s.numericLiteral(1))))}else{const t=e.scope.generateUidIdentifierBasedOnNode(a.node,"old");const r=t.name;e.scope.push({id:t});const n=s.binaryExpression(e.node.operator[0],s.identifier(r),s.numericLiteral(1));e.replaceWith(s.sequenceExpression([s.assignmentExpression("=",s.identifier(r),s.unaryExpression("+",a.node)),s.assignmentExpression("=",s.cloneNode(a.node),n),s.identifier(r)]))}}},AssignmentExpression:{exit(e){const{scope:t,seen:r,bindingNames:a}=this;if(e.node.operator==="=")return;if(r.has(e.node))return;r.add(e.node);const n=e.get("left");if(!n.isIdentifier())return;const o=n.node.name;if(!a.has(o))return;if(t.getBinding(o)!==e.scope.getBinding(o)){return}e.node.right=s.binaryExpression(e.node.operator.slice(0,-1),s.cloneNode(e.node.left),e.node.right);e.node.operator="="}}}},4149:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(4149);var a=r(2013)},2013:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},9545:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(2178);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-new-target",visitor:{MetaProperty(e){const t=e.get("meta");const r=e.get("property");const{scope:s}=e;if(t.isIdentifier({name:"new"})&&r.isIdentifier({name:"target"})){const t=e.findParent((e=>{if(e.isClass())return true;if(e.isFunction()&&!e.isArrowFunctionExpression()){if(e.isClassMethod({kind:"constructor"})){return false}return true}return false}));if(!t){throw e.buildCodeFrameError("new.target must be under a (non-arrow) function or a class.")}const{node:r}=t;if(!r.id){if(t.isMethod()){e.replaceWith(s.buildUndefinedNode());return}r.id=s.generateUidIdentifier("target")}const n=a.types.memberExpression(a.types.thisExpression(),a.types.identifier("constructor"));if(t.isClass()){e.replaceWith(n);return}e.replaceWith(a.types.conditionalExpression(a.types.binaryExpression("instanceof",a.types.thisExpression(),a.types.cloneNode(r.id)),n,s.buildUndefinedNode()))}}}}}));t["default"]=n},2178:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},570:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(7471);var a=r(6833);var n=r(8304);function replacePropertySuper(e,t,r){const s=new a.default({getObjectRef:t,methodPath:e,file:r});s.replace()}var o=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-object-super",visitor:{ObjectExpression(e,t){let r;const getObjectRef=()=>r=r||e.scope.generateUidIdentifier("obj");e.get("properties").forEach((e=>{if(!e.isMethod())return;replacePropertySuper(e,getObjectRef,t)}));if(r){e.scope.push({id:n.types.cloneNode(r)});e.replaceWith(n.types.assignmentExpression("=",n.types.cloneNode(r),e.node))}}}}}));t["default"]=o},7471:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},3714:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"convertFunctionParams",{enumerable:true,get:function(){return a.default}});t["default"]=void 0;var s=r(9497);var a=r(1042);var n=r(258);var o=(0,s.declare)(((e,t)=>{var r;e.assertVersion(7);const s=(r=e.assumption("ignoreFunctionLength"))!=null?r:t.loose;const o=e.assumption("noNewArrows");return{name:"transform-parameters",visitor:{Function(e){if(e.isArrowFunctionExpression()&&e.get("params").some((e=>e.isRestElement()||e.isAssignmentPattern()))){e.arrowFunctionToExpression({noNewArrows:o})}const t=(0,n.default)(e);const r=(0,a.default)(e,s);if(t||r){e.scope.crawl()}}}}}));t["default"]=o},1042:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=convertFunctionParams;var s=r(8304);const a=(0,s.template)(`\n let VARIABLE_NAME =\n arguments.length > ARGUMENT_KEY && arguments[ARGUMENT_KEY] !== undefined ?\n arguments[ARGUMENT_KEY]\n :\n DEFAULT_VALUE;\n`);const n=(0,s.template)(`\n if (ASSIGNMENT_IDENTIFIER === UNDEFINED) {\n ASSIGNMENT_IDENTIFIER = DEFAULT_VALUE;\n }\n`);const o=(0,s.template)(`\n let ASSIGNMENT_IDENTIFIER = PARAMETER_NAME === UNDEFINED ? DEFAULT_VALUE : PARAMETER_NAME ;\n`);const i=(0,s.template)(`\n let $0 = arguments.length > $1 ? arguments[$1] : undefined;\n`);const l={"ReferencedIdentifier|BindingIdentifier"(e,t){const{scope:r,node:s}=e;const{name:a}=s;if(a==="eval"||r.getBinding(a)===t.scope.parent.getBinding(a)&&t.scope.hasOwnBinding(a)){t.needsOuterBinding=true;e.stop()}},"TypeAnnotation|TSTypeAnnotation|TypeParameterDeclaration|TSTypeParameterDeclaration":e=>e.skip()};function convertFunctionParams(e,t,r,c){const u=e.get("params");const p=u.every((e=>e.isIdentifier()));if(p)return false;const{node:f,scope:d}=e;const m={stop:false,needsOuterBinding:false,scope:d};const y=[];const g=new Set;for(const e of u){for(const t of Object.keys(e.getBindingIdentifiers())){var h;const e=(h=d.bindings[t])==null?void 0:h.constantViolations;if(e){for(const r of e){const e=r.node;switch(e.type){case"VariableDeclarator":{if(e.init===null){const e=r.parentPath;if(!e.parentPath.isFor()||e.parentPath.get("body")===e){r.remove();break}}g.add(t);break}case"FunctionDeclaration":g.add(t);break}}}}}if(g.size===0){for(const e of u){if(!e.isIdentifier())e.traverse(l,m);if(m.needsOuterBinding)break}}let b=null;for(let l=0;l0){y.push(buildScopeIIFE(g,e.get("body").node));e.set("body",s.types.blockStatement(y));const t=e.get("body.body");const r=t[t.length-1].get("argument.callee");r.arrowFunctionToExpression();r.node.generator=e.node.generator;r.node.async=e.node.async;e.node.generator=false}else{e.get("body").unshiftContainer("body",y)}return true}function buildScopeIIFE(e,t){const r=[];const a=[];for(const t of e){r.push(s.types.identifier(t));a.push(s.types.identifier(t))}return s.types.returnStatement(s.types.callExpression(s.types.arrowFunctionExpression(a,t),r))}},258:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=convertFunctionRest;var s=r(8304);const a=(0,s.template)(`\n for (var LEN = ARGUMENTS.length,\n ARRAY = new Array(ARRAY_LEN),\n KEY = START;\n KEY < LEN;\n KEY++) {\n ARRAY[ARRAY_KEY] = ARGUMENTS[KEY];\n }\n`);const n=(0,s.template)(`\n (INDEX < OFFSET || ARGUMENTS.length <= INDEX) ? undefined : ARGUMENTS[INDEX]\n`);const o=(0,s.template)(`\n REF = INDEX, (REF < OFFSET || ARGUMENTS.length <= REF) ? undefined : ARGUMENTS[REF]\n`);const i=(0,s.template)(`\n ARGUMENTS.length <= OFFSET ? 0 : ARGUMENTS.length - OFFSET\n`);function referencesRest(e,t){if(e.node.name===t.name){return e.scope.bindingIdentifierEquals(t.name,t.outerBinding)}return false}const l={Scope(e,t){if(!e.scope.bindingIdentifierEquals(t.name,t.outerBinding)){e.skip()}},Flow(e){if(e.isTypeCastExpression())return;e.skip()},Function(e,t){const r=t.noOptimise;t.noOptimise=true;e.traverse(l,t);t.noOptimise=r;e.skip()},ReferencedIdentifier(e,t){const{node:r}=e;if(r.name==="arguments"){t.deopted=true}if(!referencesRest(e,t))return;if(t.noOptimise){t.deopted=true}else{const{parentPath:s}=e;if(s.listKey==="params"&&s.key0&&s.types.isIdentifier(e.params[0],{name:"this"})){t-=1}return t}function hasRest(e){const t=e.params.length;return t>0&&s.types.isRestElement(e.params[t-1])}function optimiseIndexGetter(e,t,r){const a=s.types.numericLiteral(r);let i;if(s.types.isNumericLiteral(e.parent.property)){i=s.types.numericLiteral(e.parent.property.value+r)}else if(r===0){i=e.parent.property}else{i=s.types.binaryExpression("+",e.parent.property,s.types.cloneNode(a))}const{scope:l}=e;if(!l.isPure(i)){const r=l.generateUidIdentifierBasedOnNode(i);l.push({id:r,kind:"var"});e.parentPath.replaceWith(o({ARGUMENTS:t,OFFSET:a,INDEX:i,REF:s.types.cloneNode(r)}))}else{const r=e.parentPath;r.replaceWith(n({ARGUMENTS:t,OFFSET:a,INDEX:i}));const s=r.get("test").get("left");const o=s.evaluate();if(o.confident){if(o.value===true){r.replaceWith(r.scope.buildUndefinedNode())}else{r.get("test").replaceWith(r.get("test").get("right"))}}}}function optimiseLengthGetter(e,t,r){if(r){e.parentPath.replaceWith(i({ARGUMENTS:t,OFFSET:s.types.numericLiteral(r)}))}else{e.replaceWith(t)}}function convertFunctionRest(e){const{node:t,scope:r}=e;if(!hasRest(t))return false;let n=t.params.pop().argument;const o=s.types.identifier("arguments");if(s.types.isPattern(n)){const e=n;n=r.generateUidIdentifier("ref");const a=s.types.variableDeclaration("let",[s.types.variableDeclarator(e,n)]);t.body.body.unshift(a)}const i=getParamsCount(t);const c={references:[],offset:i,argumentsNode:o,outerBinding:r.getBindingIdentifier(n.name),candidates:[],name:n.name,deopted:false};e.traverse(l,c);if(!c.deopted&&!c.references.length){for(const{path:e,cause:t}of c.candidates){const r=s.types.cloneNode(o);switch(t){case"indexGetter":optimiseIndexGetter(e,r,c.offset);break;case"lengthGetter":optimiseLengthGetter(e,r,c.offset);break;default:e.replaceWith(r)}}return true}c.references=c.references.concat(c.candidates.map((({path:e})=>e)));const u=s.types.numericLiteral(i);const p=r.generateUidIdentifier("key");const f=r.generateUidIdentifier("len");let d,m;if(i){d=s.types.binaryExpression("-",s.types.cloneNode(p),s.types.cloneNode(u));m=s.types.conditionalExpression(s.types.binaryExpression(">",s.types.cloneNode(f),s.types.cloneNode(u)),s.types.binaryExpression("-",s.types.cloneNode(f),s.types.cloneNode(u)),s.types.numericLiteral(0))}else{d=s.types.identifier(p.name);m=s.types.identifier(f.name)}const y=a({ARGUMENTS:o,ARRAY_KEY:d,ARRAY_LEN:m,START:u,ARRAY:n,KEY:p,LEN:f});if(c.deopted){t.body.body.unshift(y)}else{let t=e.getEarliestCommonAncestorFrom(c.references).getStatementParent();t.findParent((e=>{if(e.isLoop()){t=e}else{return e.isFunction()}}));t.insertBefore(y)}return true}},9497:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},2970:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3392);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-property-literals",visitor:{ObjectProperty:{exit({node:e}){const t=e.key;if(!e.computed&&a.types.isIdentifier(t)&&!a.types.isValidES3Identifier(t.name)){e.key=a.types.stringLiteral(t.name)}}}}}}));t["default"]=n},3392:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},2625:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(5875);var a=r(1017);var n=r(8304);var o=(0,s.declare)((e=>{e.assertVersion(7);function addDisplayName(e,t){const r=t.arguments[0].properties;let s=true;for(let e=0;ee.name==="createReactClass";function isCreateClass(e){if(!e||!n.types.isCallExpression(e))return false;if(!t(e.callee)&&!isCreateClassAddon(e.callee)){return false}const r=e.arguments;if(r.length!==1)return false;const s=r[0];if(!n.types.isObjectExpression(s))return false;return true}return{name:"transform-react-display-name",visitor:{ExportDefaultDeclaration({node:e},t){if(isCreateClass(e.declaration)){const r=t.filename||"unknown";let s=a.basename(r,a.extname(r));if(s==="index"){s=a.basename(a.dirname(r))}addDisplayName(s,e.declaration)}},CallExpression(e){const{node:t}=e;if(!isCreateClass(t))return;let r;e.find((function(e){if(e.isAssignmentExpression()){r=e.node.left}else if(e.isObjectProperty()){r=e.node.key}else if(e.isVariableDeclarator()){r=e.node.id}else if(e.isStatement()){return true}if(r)return true}));if(!r)return;if(n.types.isMemberExpression(r)){r=r.property}if(n.types.isIdentifier(r)){addDisplayName(r.name,t)}}}}}));t["default"]=o},5875:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9833:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"default",{enumerable:true,get:function(){return s.default}});var s=r(309)},900:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},594:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=createPlugin;var s=r(8926);var a=r(900);var n=r(8304);var o=r(9115);var i=r(2155);const l={importSource:"react",runtime:"automatic",pragma:"React.createElement",pragmaFrag:"React.Fragment"};const c=/\*?\s*@jsxImportSource\s+([^\s]+)/;const u=/\*?\s*@jsxRuntime\s+([^\s]+)/;const p=/\*?\s*@jsx\s+([^\s]+)/;const f=/\*?\s*@jsxFrag\s+([^\s]+)/;const get=(e,t)=>e.get(`@babel/plugin-react-jsx/${t}`);const set=(e,t,r)=>e.set(`@babel/plugin-react-jsx/${t}`,r);function createPlugin({name:e,development:t}){return(0,a.declare)(((r,a)=>{const{pure:o,throwIfNamespace:d=true,filter:m,runtime:y=(t?"automatic":"classic"),importSource:g=l.importSource,pragma:h=l.pragma,pragmaFrag:b=l.pragmaFrag}=a;{var{useSpread:x=false,useBuiltIns:v=false}=a;if(y==="classic"){if(typeof x!=="boolean"){throw new Error("transform-react-jsx currently only accepts a boolean option for "+"useSpread (defaults to false)")}if(typeof v!=="boolean"){throw new Error("transform-react-jsx currently only accepts a boolean option for "+"useBuiltIns (defaults to false)")}if(x&&v){throw new Error("transform-react-jsx currently only accepts useBuiltIns or useSpread "+"but not both")}}}const E={JSXOpeningElement(e,t){for(const t of e.get("attributes")){if(!t.isJSXElement())continue;const{name:r}=t.node.name;if(r==="__source"||r==="__self"){throw e.buildCodeFrameError(`__source and __self should not be defined in props and are reserved for internal usage.`)}}const r=n.types.jsxAttribute(n.types.jsxIdentifier("__self"),n.types.jsxExpressionContainer(n.types.thisExpression()));const s=n.types.jsxAttribute(n.types.jsxIdentifier("__source"),n.types.jsxExpressionContainer(makeSource(e,t)));e.pushContainer("attributes",[r,s])}};return{name:e,inherits:s.default,visitor:{JSXNamespacedName(e){if(d){throw e.buildCodeFrameError(`Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can set \`throwIfNamespace: false\` to bypass this warning.`)}},JSXSpreadChild(e){throw e.buildCodeFrameError("Spread children are not supported in React.")},Program:{enter(e,r){const{file:s}=r;let o=y;let i=g;let d=h;let m=b;let x=!!a.importSource;let v=!!a.pragma;let j=!!a.pragmaFrag;if(s.ast.comments){for(const e of s.ast.comments){const t=c.exec(e.value);if(t){i=t[1];x=true}const r=u.exec(e.value);if(r){o=r[1]}const s=p.exec(e.value);if(s){d=s[1];v=true}const a=f.exec(e.value);if(a){m=a[1];j=true}}}set(r,"runtime",o);if(o==="classic"){if(x){throw e.buildCodeFrameError(`importSource cannot be set when runtime is classic.`)}const t=toMemberExpression(d);const s=toMemberExpression(m);set(r,"id/createElement",(()=>n.types.cloneNode(t)));set(r,"id/fragment",(()=>n.types.cloneNode(s)));set(r,"defaultPure",d===l.pragma)}else if(o==="automatic"){if(v||j){throw e.buildCodeFrameError(`pragma and pragmaFrag cannot be set when runtime is automatic.`)}const define=(t,s)=>set(r,t,createImportLazily(r,e,s,i));define("id/jsx",t?"jsxDEV":"jsx");define("id/jsxs",t?"jsxDEV":"jsxs");define("id/createElement","createElement");define("id/fragment","Fragment");set(r,"defaultPure",i===l.importSource)}else{throw e.buildCodeFrameError(`Runtime must be either "classic" or "automatic".`)}if(t){e.traverse(E,r)}}},JSXElement:{exit(e,t){let r;if(get(t,"runtime")==="classic"||shouldUseCreateElement(e)){r=buildCreateElementCall(e,t)}else{r=buildJSXElementCall(e,t)}e.replaceWith(n.types.inherits(r,e.node))}},JSXFragment:{exit(e,t){let r;if(get(t,"runtime")==="classic"){r=buildCreateElementFragmentCall(e,t)}else{r=buildJSXFragmentCall(e,t)}e.replaceWith(n.types.inherits(r,e.node))}},JSXAttribute(e){if(n.types.isJSXElement(e.node.value)){e.node.value=n.types.jsxExpressionContainer(e.node.value)}}}};function call(e,t,r){const s=n.types.callExpression(get(e,`id/${t}`)(),r);if(o!=null?o:get(e,"defaultPure"))(0,i.default)(s);return s}function shouldUseCreateElement(e){const t=e.get("openingElement");const r=t.node.attributes;let s=false;for(let e=0;e1){t=n.types.arrayExpression(e)}else{return undefined}return n.types.objectProperty(n.types.identifier("children"),t)}function buildJSXElementCall(e,r){const s=e.get("openingElement");const a=[getTag(s)];const o=[];const i=Object.create(null);for(const t of s.get("attributes")){if(t.isJSXAttribute()&&n.types.isJSXIdentifier(t.node.name)){const{name:r}=t.node.name;switch(r){case"__source":case"__self":if(i[r])throw sourceSelfError(e,r);case"key":{const e=convertAttributeValue(t.node.value);if(e===null){throw t.buildCodeFrameError('Please provide an explicit key value. Using "key" as a shorthand for "key={true}" is not allowed.')}i[r]=e;break}default:o.push(t)}}else{o.push(t)}}const l=n.types.react.buildChildren(e.node);let c;if(o.length||l.length){c=buildJSXOpeningElementAttributes(o,r,l)}else{c=n.types.objectExpression([])}a.push(c);if(t){var u,p,f;a.push((u=i.key)!=null?u:e.scope.buildUndefinedNode(),n.types.booleanLiteral(l.length>1),(p=i.__source)!=null?p:e.scope.buildUndefinedNode(),(f=i.__self)!=null?f:n.types.thisExpression())}else if(i.key!==undefined){a.push(i.key)}return call(r,l.length>1?"jsxs":"jsx",a)}function buildJSXOpeningElementAttributes(e,t,r){const s=e.reduce(accumulateAttribute,[]);if((r==null?void 0:r.length)>0){s.push(buildChildrenProperty(r))}return n.types.objectExpression(s)}function buildJSXFragmentCall(e,r){const s=[get(r,"id/fragment")()];const a=n.types.react.buildChildren(e.node);s.push(n.types.objectExpression(a.length>0?[buildChildrenProperty(a)]:[]));if(t){s.push(e.scope.buildUndefinedNode(),n.types.booleanLiteral(a.length>1))}return call(r,a.length>1?"jsxs":"jsx",s)}function buildCreateElementFragmentCall(e,t){if(m&&!m(e.node,t))return;return call(t,"createElement",[get(t,"id/fragment")(),n.types.nullLiteral(),...n.types.react.buildChildren(e.node)])}function buildCreateElementCall(e,t){const r=e.get("openingElement");return call(t,"createElement",[getTag(r),buildCreateElementOpeningElementAttributes(t,e,r.get("attributes")),...n.types.react.buildChildren(e.node)])}function getTag(e){const t=convertJSXIdentifier(e.node.name,e.node);let r;if(n.types.isIdentifier(t)){r=t.name}else if(n.types.isLiteral(t)){r=t.value}if(n.types.react.isCompatTag(r)){return n.types.stringLiteral(r)}else{return t}}function buildCreateElementOpeningElementAttributes(e,t,r){const s=get(e,"runtime");{if(s!=="automatic"){const t=[];const s=r.reduce(accumulateAttribute,[]);if(!x){let e=0;s.forEach(((r,a)=>{if(n.types.isSpreadElement(r)){if(a>e){t.push(n.types.objectExpression(s.slice(e,a)))}t.push(r.argument);e=a+1}}));if(s.length>e){t.push(n.types.objectExpression(s.slice(e)))}}else if(s.length){t.push(n.types.objectExpression(s))}if(!t.length){return n.types.nullLiteral()}if(t.length===1){return t[0]}if(!n.types.isObjectExpression(t[0])){t.unshift(n.types.objectExpression([]))}const a=v?n.types.memberExpression(n.types.identifier("Object"),n.types.identifier("assign")):e.addHelper("extends");return n.types.callExpression(a,t)}}const a=[];const o=Object.create(null);for(const e of r){const r=n.types.isJSXAttribute(e)&&n.types.isJSXIdentifier(e.name)&&e.name.name;if(s==="automatic"&&(r==="__source"||r==="__self")){if(o[r])throw sourceSelfError(t,r);o[r]=true}accumulateAttribute(a,e)}return a.length===1&&n.types.isSpreadElement(a[0])?a[0].argument:a.length>0?n.types.objectExpression(a):n.types.nullLiteral()}}));function getSource(e,r){switch(r){case"Fragment":return`${e}/${t?"jsx-dev-runtime":"jsx-runtime"}`;case"jsxDEV":return`${e}/jsx-dev-runtime`;case"jsx":case"jsxs":return`${e}/jsx-runtime`;case"createElement":return e}}function createImportLazily(e,t,r,s){return()=>{const a=getSource(s,r);if((0,o.isModule)(t)){let s=get(e,`imports/${r}`);if(s)return n.types.cloneNode(s);s=(0,o.addNamed)(t,r,a,{importedInterop:"uncompiled",importPosition:"after"});set(e,`imports/${r}`,s);return s}else{let s=get(e,`requires/${a}`);if(s){s=n.types.cloneNode(s)}else{s=(0,o.addNamespace)(t,a,{importedInterop:"uncompiled"});set(e,`requires/${a}`,s)}return n.types.memberExpression(s,n.types.identifier(r))}}}}function toMemberExpression(e){return e.split(".").map((e=>n.types.identifier(e))).reduce(((e,t)=>n.types.memberExpression(e,t)))}function makeSource(e,t){const r=e.node.loc;if(!r){return e.scope.buildUndefinedNode()}if(!t.fileNameIdentifier){const{filename:r=""}=t;const s=e.scope.generateUidIdentifier("_jsxFileName");const a=e.hub.getScope();if(a){a.push({id:s,init:n.types.stringLiteral(r)})}t.fileNameIdentifier=s}return makeTrace(n.types.cloneNode(t.fileNameIdentifier),r.start.line,r.start.column)}function makeTrace(e,t,r){const s=t!=null?n.types.numericLiteral(t):n.types.nullLiteral();const a=r!=null?n.types.numericLiteral(r+1):n.types.nullLiteral();const o=n.types.objectProperty(n.types.identifier("fileName"),e);const i=n.types.objectProperty(n.types.identifier("lineNumber"),s);const l=n.types.objectProperty(n.types.identifier("columnNumber"),a);return n.types.objectExpression([o,i,l])}function sourceSelfError(e,t){const r=`transform-react-jsx-${t.slice(2)}`;return e.buildCodeFrameError(`Duplicate ${t} prop found. You are most likely using the deprecated ${r} Babel plugin. Both __source and __self are automatically set when using the automatic runtime. Please remove transform-react-jsx-source and transform-react-jsx-self from your Babel config.`)}},309:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(594);var a=(0,s.default)({name:"transform-react-jsx/development",development:true});t["default"]=a},496:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3100);var a=r(2155);var n=r(8304);const o=new Map([["react",["cloneElement","createContext","createElement","createFactory","createRef","forwardRef","isValidElement","memo","lazy"]],["react-dom",["createPortal"]]]);var i=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-react-pure-annotations",visitor:{CallExpression(e){if(isReactCall(e)){(0,a.default)(e)}}}}}));t["default"]=i;function isReactCall(e){if(!n.types.isMemberExpression(e.node.callee)){const t=e.get("callee");for(const[e,r]of o){for(const s of r){if(t.referencesImport(e,s)){return true}}}return false}for(const[t,r]of o){const s=e.get("callee.object");if(s.referencesImport(t,"default")||s.referencesImport(t,"*")){for(const t of r){if(n.types.isIdentifier(e.node.callee.property,{name:t})){return true}}return false}}return false}},3100:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8720:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8403);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-reserved-words",visitor:{"BindingIdentifier|ReferencedIdentifier"(e){if(!a.types.isValidES3Identifier(e.node.name)){e.scope.rename(e.node.name)}}}}}));t["default"]=n},8403:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8648:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9836);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-shorthand-properties",visitor:{ObjectMethod(e){const{node:t}=e;if(t.kind==="method"){const r=a.types.functionExpression(null,t.params,t.body,t.generator,t.async);r.returnType=t.returnType;const s=a.types.toComputedKey(t);if(a.types.isStringLiteral(s,{value:"__proto__"})){e.replaceWith(a.types.objectProperty(s,r,true))}else{e.replaceWith(a.types.objectProperty(t.key,r,t.computed))}}},ObjectProperty(e){const{node:t}=e;if(t.shorthand){const r=a.types.toComputedKey(t);if(a.types.isStringLiteral(r,{value:"__proto__"})){e.replaceWith(a.types.objectProperty(r,t.value,true))}else{t.shorthand=false}}}}}}));t["default"]=n},9836:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8476:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(2763);var a=r(5480);var n=r(8304);var o=(0,s.declare)(((e,t)=>{var r,s;e.assertVersion(7);const o=(r=e.assumption("iterableIsArray"))!=null?r:t.loose;const i=(s=t.allowArrayLike)!=null?s:e.assumption("arrayLikeIsIterable");function getSpreadLiteral(e,t){if(o&&!n.types.isIdentifier(e.argument,{name:"arguments"})){return e.argument}else{return t.toArray(e.argument,true,i)}}function hasHole(e){return e.elements.some((e=>e===null))}function hasSpread(e){for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1245:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(7521);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-sticky-regex",visitor:{RegExpLiteral(e){const{node:t}=e;if(!t.flags.includes("y"))return;e.replaceWith(a.types.newExpression(a.types.identifier("RegExp"),[a.types.stringLiteral(t.pattern),a.types.stringLiteral(t.flags)]))}}}}));t["default"]=n},7521:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5356:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9116);var a=r(8304);var n=(0,s.declare)(((e,t)=>{var r,s;e.assertVersion(7);const n=(r=e.assumption("ignoreToPrimitiveHint"))!=null?r:t.loose;const o=(s=e.assumption("mutableTemplateObject"))!=null?s:t.loose;let i="taggedTemplateLiteral";if(o)i+="Loose";function buildConcatCallExpressions(e){let t=true;return e.reduce((function(e,r){let s=a.types.isLiteral(r);if(!s&&t){s=true;t=false}if(s&&a.types.isCallExpression(e)){e.arguments.push(r);return e}return a.types.callExpression(a.types.memberExpression(e,a.types.identifier("concat")),[r])}))}return{name:"transform-template-literals",visitor:{TaggedTemplateExpression(e){const{node:t}=e;const{quasi:r}=t;const s=[];const n=[];let o=true;for(const t of r.quasis){const{raw:r,cooked:i}=t.value;const l=i==null?e.scope.buildUndefinedNode():a.types.stringLiteral(i);s.push(l);n.push(a.types.stringLiteral(r));if(r!==i){o=false}}const l=[a.types.arrayExpression(s)];if(!o){l.push(a.types.arrayExpression(n))}const c=e.scope.generateUidIdentifier("templateObject");e.scope.getProgramParent().push({id:a.types.cloneNode(c)});e.replaceWith(a.types.callExpression(t.tag,[a.template.expression.ast` + `;const l={ReferencedIdentifier(e){const{seen:t,buildImportReference:r,scope:s,imported:n,requeueInParent:o}=this;if(t.has(e.node))return;t.add(e.node);const i=e.node.name;const l=n.get(i);if(l){const t=e.scope.getBinding(i);const n=s.getBinding(i);if(n!==t)return;const c=r(l,e.node);c.loc=e.node.loc;if((e.parentPath.isCallExpression({callee:e.node})||e.parentPath.isOptionalCallExpression({callee:e.node})||e.parentPath.isTaggedTemplateExpression({tag:e.node}))&&a.isMemberExpression(c)){e.replaceWith(a.sequenceExpression([a.numericLiteral(0),c]))}else if(e.isJSXIdentifier()&&a.isMemberExpression(c)){const{object:t,property:r}=c;e.replaceWith(a.jsxMemberExpression(a.jsxIdentifier(t.name),a.jsxIdentifier(r.name)))}else{e.replaceWith(c)}o(e);e.skip()}},AssignmentExpression:{exit(e){const{scope:t,seen:r,imported:n,exported:o,requeueInParent:i,buildImportReference:l}=this;if(r.has(e.node))return;r.add(e.node);const c=e.get("left");if(c.isMemberExpression())return;if(c.isIdentifier()){const r=c.node.name;if(t.getBinding(r)!==e.scope.getBinding(r)){return}const u=o.get(r);const p=n.get(r);if((u==null?void 0:u.length)>0||p){s(e.node.operator==="=","Path was not simplified");const t=e.node;if(p){t.left=l(p,t.left);t.right=a.sequenceExpression([t.right,buildImportThrow(r)])}e.replaceWith(buildBindingExportAssignmentExpression(this.metadata,u,t));i(e)}}else{const r=c.getOuterBindingIdentifiers();const s=Object.keys(r).filter((r=>t.getBinding(r)===e.scope.getBinding(r)));const l=s.find((e=>n.has(e)));if(l){e.node.right=a.sequenceExpression([e.node.right,buildImportThrow(l)])}const u=[];s.forEach((e=>{const t=o.get(e)||[];if(t.length>0){u.push(buildBindingExportAssignmentExpression(this.metadata,t,a.identifier(e)))}}));if(u.length>0){let t=a.sequenceExpression(u);if(e.parentPath.isExpressionStatement()){t=a.expressionStatement(t);t._blockHoist=e.parentPath.node._blockHoist}const r=e.insertAfter(t)[0];i(r)}}}},"ForOfStatement|ForInStatement"(e){const{scope:t,node:r}=e;const{left:s}=r;const{exported:n,scope:o}=this;if(!a.isVariableDeclaration(s)){let r=false;const i=e.get("body");const l=i.scope;for(const e of Object.keys(a.getOuterBindingIdentifiers(s))){if(n.get(e)&&o.getBinding(e)===t.getBinding(e)){r=true;if(l.hasOwnBinding(e)){l.rename(e)}}}if(!r){return}const c=t.generateUidIdentifierBasedOnNode(s);i.unshiftContainer("body",a.expressionStatement(a.assignmentExpression("=",s,c)));e.get("left").replaceWith(a.variableDeclaration("let",[a.variableDeclarator(a.cloneNode(c))]));t.registerDeclaration(e.get("left"))}}}},5244:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteThis;var s=r(6833);var a=r(7369);var n=r(8622);function rewriteThis(e){(0,a.default)(e.node,Object.assign({},o,{noScope:true}))}const o=a.default.visitors.merge([s.environmentVisitor,{ThisExpression(e){e.replaceWith(n.unaryExpression("void",n.numericLiteral(0),true))}}])},3373:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8140:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=simplifyAccess;var s=r(8622);function simplifyAccess(e,t){e.traverse(a,{scope:e.scope,bindingNames:t,seen:new WeakSet})}const a={UpdateExpression:{exit(e){const{scope:t,bindingNames:r}=this;const a=e.get("argument");if(!a.isIdentifier())return;const n=a.node.name;if(!r.has(n))return;if(t.getBinding(n)!==e.scope.getBinding(n)){return}if(e.parentPath.isExpressionStatement()&&!e.isCompletionRecord()){const t=e.node.operator=="++"?"+=":"-=";e.replaceWith(s.assignmentExpression(t,a.node,s.numericLiteral(1)))}else if(e.node.prefix){e.replaceWith(s.assignmentExpression("=",s.identifier(n),s.binaryExpression(e.node.operator[0],s.unaryExpression("+",a.node),s.numericLiteral(1))))}else{const t=e.scope.generateUidIdentifierBasedOnNode(a.node,"old");const r=t.name;e.scope.push({id:t});const n=s.binaryExpression(e.node.operator[0],s.identifier(r),s.numericLiteral(1));e.replaceWith(s.sequenceExpression([s.assignmentExpression("=",s.identifier(r),s.unaryExpression("+",a.node)),s.assignmentExpression("=",s.cloneNode(a.node),n),s.identifier(r)]))}}},AssignmentExpression:{exit(e){const{scope:t,seen:r,bindingNames:a}=this;if(e.node.operator==="=")return;if(r.has(e.node))return;r.add(e.node);const n=e.get("left");if(!n.isIdentifier())return;const o=n.node.name;if(!a.has(o))return;if(t.getBinding(o)!==e.scope.getBinding(o)){return}e.node.right=s.binaryExpression(e.node.operator.slice(0,-1),s.cloneNode(e.node.left),e.node.right);e.node.operator="="}}}},4149:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(4149);var a=r(2013)},2013:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},9545:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(2178);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-new-target",visitor:{MetaProperty(e){const t=e.get("meta");const r=e.get("property");const{scope:s}=e;if(t.isIdentifier({name:"new"})&&r.isIdentifier({name:"target"})){const t=e.findParent((e=>{if(e.isClass())return true;if(e.isFunction()&&!e.isArrowFunctionExpression()){if(e.isClassMethod({kind:"constructor"})){return false}return true}return false}));if(!t){throw e.buildCodeFrameError("new.target must be under a (non-arrow) function or a class.")}const{node:r}=t;if(!r.id){if(t.isMethod()){e.replaceWith(s.buildUndefinedNode());return}r.id=s.generateUidIdentifier("target")}const n=a.types.memberExpression(a.types.thisExpression(),a.types.identifier("constructor"));if(t.isClass()){e.replaceWith(n);return}e.replaceWith(a.types.conditionalExpression(a.types.binaryExpression("instanceof",a.types.thisExpression(),a.types.cloneNode(r.id)),n,s.buildUndefinedNode()))}}}}}));t["default"]=n},2178:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},570:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(7471);var a=r(6833);var n=r(8304);function replacePropertySuper(e,t,r){const s=new a.default({getObjectRef:t,methodPath:e,file:r});s.replace()}var o=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-object-super",visitor:{ObjectExpression(e,t){let r;const getObjectRef=()=>r=r||e.scope.generateUidIdentifier("obj");e.get("properties").forEach((e=>{if(!e.isMethod())return;replacePropertySuper(e,getObjectRef,t)}));if(r){e.scope.push({id:n.types.cloneNode(r)});e.replaceWith(n.types.assignmentExpression("=",n.types.cloneNode(r),e.node))}}}}}));t["default"]=o},7471:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},3714:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"convertFunctionParams",{enumerable:true,get:function(){return a.default}});t["default"]=void 0;var s=r(9497);var a=r(1042);var n=r(258);var o=(0,s.declare)(((e,t)=>{var r;e.assertVersion(7);const s=(r=e.assumption("ignoreFunctionLength"))!=null?r:t.loose;const o=e.assumption("noNewArrows");return{name:"transform-parameters",visitor:{Function(e){if(e.isArrowFunctionExpression()&&e.get("params").some((e=>e.isRestElement()||e.isAssignmentPattern()))){e.arrowFunctionToExpression({noNewArrows:o})}const t=(0,n.default)(e);const r=(0,a.default)(e,s);if(t||r){e.scope.crawl()}}}}}));t["default"]=o},1042:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=convertFunctionParams;var s=r(8304);const a=(0,s.template)(`\n let VARIABLE_NAME =\n arguments.length > ARGUMENT_KEY && arguments[ARGUMENT_KEY] !== undefined ?\n arguments[ARGUMENT_KEY]\n :\n DEFAULT_VALUE;\n`);const n=(0,s.template)(`\n if (ASSIGNMENT_IDENTIFIER === UNDEFINED) {\n ASSIGNMENT_IDENTIFIER = DEFAULT_VALUE;\n }\n`);const o=(0,s.template)(`\n let ASSIGNMENT_IDENTIFIER = PARAMETER_NAME === UNDEFINED ? DEFAULT_VALUE : PARAMETER_NAME ;\n`);const i=(0,s.template)(`\n let $0 = arguments.length > $1 ? arguments[$1] : undefined;\n`);const l={"ReferencedIdentifier|BindingIdentifier"(e,t){const{scope:r,node:s}=e;const{name:a}=s;if(a==="eval"||r.getBinding(a)===t.scope.parent.getBinding(a)&&t.scope.hasOwnBinding(a)){t.needsOuterBinding=true;e.stop()}},"TypeAnnotation|TSTypeAnnotation|TypeParameterDeclaration|TSTypeParameterDeclaration":e=>e.skip()};function convertFunctionParams(e,t,r,c){const u=e.get("params");const p=u.every((e=>e.isIdentifier()));if(p)return false;const{node:d,scope:f}=e;const m={stop:false,needsOuterBinding:false,scope:f};const y=[];const g=new Set;for(const e of u){for(const t of Object.keys(e.getBindingIdentifiers())){var h;const e=(h=f.bindings[t])==null?void 0:h.constantViolations;if(e){for(const r of e){const e=r.node;switch(e.type){case"VariableDeclarator":{if(e.init===null){const e=r.parentPath;if(!e.parentPath.isFor()||e.parentPath.get("body")===e){r.remove();break}}g.add(t);break}case"FunctionDeclaration":g.add(t);break}}}}}if(g.size===0){for(const e of u){if(!e.isIdentifier())e.traverse(l,m);if(m.needsOuterBinding)break}}let b=null;for(let l=0;l0){y.push(buildScopeIIFE(g,e.get("body").node));e.set("body",s.types.blockStatement(y));const t=e.get("body.body");const r=t[t.length-1].get("argument.callee");r.arrowFunctionToExpression();r.node.generator=e.node.generator;r.node.async=e.node.async;e.node.generator=false}else{e.get("body").unshiftContainer("body",y)}return true}function buildScopeIIFE(e,t){const r=[];const a=[];for(const t of e){r.push(s.types.identifier(t));a.push(s.types.identifier(t))}return s.types.returnStatement(s.types.callExpression(s.types.arrowFunctionExpression(a,t),r))}},258:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=convertFunctionRest;var s=r(8304);const a=(0,s.template)(`\n for (var LEN = ARGUMENTS.length,\n ARRAY = new Array(ARRAY_LEN),\n KEY = START;\n KEY < LEN;\n KEY++) {\n ARRAY[ARRAY_KEY] = ARGUMENTS[KEY];\n }\n`);const n=(0,s.template)(`\n (INDEX < OFFSET || ARGUMENTS.length <= INDEX) ? undefined : ARGUMENTS[INDEX]\n`);const o=(0,s.template)(`\n REF = INDEX, (REF < OFFSET || ARGUMENTS.length <= REF) ? undefined : ARGUMENTS[REF]\n`);const i=(0,s.template)(`\n ARGUMENTS.length <= OFFSET ? 0 : ARGUMENTS.length - OFFSET\n`);function referencesRest(e,t){if(e.node.name===t.name){return e.scope.bindingIdentifierEquals(t.name,t.outerBinding)}return false}const l={Scope(e,t){if(!e.scope.bindingIdentifierEquals(t.name,t.outerBinding)){e.skip()}},Flow(e){if(e.isTypeCastExpression())return;e.skip()},Function(e,t){const r=t.noOptimise;t.noOptimise=true;e.traverse(l,t);t.noOptimise=r;e.skip()},ReferencedIdentifier(e,t){const{node:r}=e;if(r.name==="arguments"){t.deopted=true}if(!referencesRest(e,t))return;if(t.noOptimise){t.deopted=true}else{const{parentPath:s}=e;if(s.listKey==="params"&&s.key0&&s.types.isIdentifier(e.params[0],{name:"this"})){t-=1}return t}function hasRest(e){const t=e.params.length;return t>0&&s.types.isRestElement(e.params[t-1])}function optimiseIndexGetter(e,t,r){const a=s.types.numericLiteral(r);let i;if(s.types.isNumericLiteral(e.parent.property)){i=s.types.numericLiteral(e.parent.property.value+r)}else if(r===0){i=e.parent.property}else{i=s.types.binaryExpression("+",e.parent.property,s.types.cloneNode(a))}const{scope:l}=e;if(!l.isPure(i)){const r=l.generateUidIdentifierBasedOnNode(i);l.push({id:r,kind:"var"});e.parentPath.replaceWith(o({ARGUMENTS:t,OFFSET:a,INDEX:i,REF:s.types.cloneNode(r)}))}else{const r=e.parentPath;r.replaceWith(n({ARGUMENTS:t,OFFSET:a,INDEX:i}));const s=r.get("test").get("left");const o=s.evaluate();if(o.confident){if(o.value===true){r.replaceWith(r.scope.buildUndefinedNode())}else{r.get("test").replaceWith(r.get("test").get("right"))}}}}function optimiseLengthGetter(e,t,r){if(r){e.parentPath.replaceWith(i({ARGUMENTS:t,OFFSET:s.types.numericLiteral(r)}))}else{e.replaceWith(t)}}function convertFunctionRest(e){const{node:t,scope:r}=e;if(!hasRest(t))return false;let n=t.params.pop().argument;const o=s.types.identifier("arguments");if(s.types.isPattern(n)){const e=n;n=r.generateUidIdentifier("ref");const a=s.types.variableDeclaration("let",[s.types.variableDeclarator(e,n)]);t.body.body.unshift(a)}const i=getParamsCount(t);const c={references:[],offset:i,argumentsNode:o,outerBinding:r.getBindingIdentifier(n.name),candidates:[],name:n.name,deopted:false};e.traverse(l,c);if(!c.deopted&&!c.references.length){for(const{path:e,cause:t}of c.candidates){const r=s.types.cloneNode(o);switch(t){case"indexGetter":optimiseIndexGetter(e,r,c.offset);break;case"lengthGetter":optimiseLengthGetter(e,r,c.offset);break;default:e.replaceWith(r)}}return true}c.references=c.references.concat(c.candidates.map((({path:e})=>e)));const u=s.types.numericLiteral(i);const p=r.generateUidIdentifier("key");const d=r.generateUidIdentifier("len");let f,m;if(i){f=s.types.binaryExpression("-",s.types.cloneNode(p),s.types.cloneNode(u));m=s.types.conditionalExpression(s.types.binaryExpression(">",s.types.cloneNode(d),s.types.cloneNode(u)),s.types.binaryExpression("-",s.types.cloneNode(d),s.types.cloneNode(u)),s.types.numericLiteral(0))}else{f=s.types.identifier(p.name);m=s.types.identifier(d.name)}const y=a({ARGUMENTS:o,ARRAY_KEY:f,ARRAY_LEN:m,START:u,ARRAY:n,KEY:p,LEN:d});if(c.deopted){t.body.body.unshift(y)}else{let t=e.getEarliestCommonAncestorFrom(c.references).getStatementParent();t.findParent((e=>{if(e.isLoop()){t=e}else{return e.isFunction()}}));t.insertBefore(y)}return true}},9497:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},2970:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3392);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-property-literals",visitor:{ObjectProperty:{exit({node:e}){const t=e.key;if(!e.computed&&a.types.isIdentifier(t)&&!a.types.isValidES3Identifier(t.name)){e.key=a.types.stringLiteral(t.name)}}}}}}));t["default"]=n},3392:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},2625:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(5875);var a=r(1017);var n=r(8304);var o=(0,s.declare)((e=>{e.assertVersion(7);function addDisplayName(e,t){const r=t.arguments[0].properties;let s=true;for(let e=0;ee.name==="createReactClass";function isCreateClass(e){if(!e||!n.types.isCallExpression(e))return false;if(!t(e.callee)&&!isCreateClassAddon(e.callee)){return false}const r=e.arguments;if(r.length!==1)return false;const s=r[0];if(!n.types.isObjectExpression(s))return false;return true}return{name:"transform-react-display-name",visitor:{ExportDefaultDeclaration({node:e},t){if(isCreateClass(e.declaration)){const r=t.filename||"unknown";let s=a.basename(r,a.extname(r));if(s==="index"){s=a.basename(a.dirname(r))}addDisplayName(s,e.declaration)}},CallExpression(e){const{node:t}=e;if(!isCreateClass(t))return;let r;e.find((function(e){if(e.isAssignmentExpression()){r=e.node.left}else if(e.isObjectProperty()){r=e.node.key}else if(e.isVariableDeclarator()){r=e.node.id}else if(e.isStatement()){return true}if(r)return true}));if(!r)return;if(n.types.isMemberExpression(r)){r=r.property}if(n.types.isIdentifier(r)){addDisplayName(r.name,t)}}}}}));t["default"]=o},5875:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9833:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"default",{enumerable:true,get:function(){return s.default}});var s=r(309)},900:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},594:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=createPlugin;var s=r(8926);var a=r(900);var n=r(8304);var o=r(6039);var i=r(2155);const l={importSource:"react",runtime:"automatic",pragma:"React.createElement",pragmaFrag:"React.Fragment"};const c=/\*?\s*@jsxImportSource\s+([^\s]+)/;const u=/\*?\s*@jsxRuntime\s+([^\s]+)/;const p=/\*?\s*@jsx\s+([^\s]+)/;const d=/\*?\s*@jsxFrag\s+([^\s]+)/;const get=(e,t)=>e.get(`@babel/plugin-react-jsx/${t}`);const set=(e,t,r)=>e.set(`@babel/plugin-react-jsx/${t}`,r);function createPlugin({name:e,development:t}){return(0,a.declare)(((r,a)=>{const{pure:o,throwIfNamespace:f=true,filter:m,runtime:y=(t?"automatic":"classic"),importSource:g=l.importSource,pragma:h=l.pragma,pragmaFrag:b=l.pragmaFrag}=a;{var{useSpread:x=false,useBuiltIns:v=false}=a;if(y==="classic"){if(typeof x!=="boolean"){throw new Error("transform-react-jsx currently only accepts a boolean option for "+"useSpread (defaults to false)")}if(typeof v!=="boolean"){throw new Error("transform-react-jsx currently only accepts a boolean option for "+"useBuiltIns (defaults to false)")}if(x&&v){throw new Error("transform-react-jsx currently only accepts useBuiltIns or useSpread "+"but not both")}}}const E={JSXOpeningElement(e,t){for(const t of e.get("attributes")){if(!t.isJSXElement())continue;const{name:r}=t.node.name;if(r==="__source"||r==="__self"){throw e.buildCodeFrameError(`__source and __self should not be defined in props and are reserved for internal usage.`)}}const r=n.types.jsxAttribute(n.types.jsxIdentifier("__self"),n.types.jsxExpressionContainer(n.types.thisExpression()));const s=n.types.jsxAttribute(n.types.jsxIdentifier("__source"),n.types.jsxExpressionContainer(makeSource(e,t)));e.pushContainer("attributes",[r,s])}};return{name:e,inherits:s.default,visitor:{JSXNamespacedName(e){if(f){throw e.buildCodeFrameError(`Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can set \`throwIfNamespace: false\` to bypass this warning.`)}},JSXSpreadChild(e){throw e.buildCodeFrameError("Spread children are not supported in React.")},Program:{enter(e,r){const{file:s}=r;let o=y;let i=g;let f=h;let m=b;let x=!!a.importSource;let v=!!a.pragma;let j=!!a.pragmaFrag;if(s.ast.comments){for(const e of s.ast.comments){const t=c.exec(e.value);if(t){i=t[1];x=true}const r=u.exec(e.value);if(r){o=r[1]}const s=p.exec(e.value);if(s){f=s[1];v=true}const a=d.exec(e.value);if(a){m=a[1];j=true}}}set(r,"runtime",o);if(o==="classic"){if(x){throw e.buildCodeFrameError(`importSource cannot be set when runtime is classic.`)}const t=toMemberExpression(f);const s=toMemberExpression(m);set(r,"id/createElement",(()=>n.types.cloneNode(t)));set(r,"id/fragment",(()=>n.types.cloneNode(s)));set(r,"defaultPure",f===l.pragma)}else if(o==="automatic"){if(v||j){throw e.buildCodeFrameError(`pragma and pragmaFrag cannot be set when runtime is automatic.`)}const define=(t,s)=>set(r,t,createImportLazily(r,e,s,i));define("id/jsx",t?"jsxDEV":"jsx");define("id/jsxs",t?"jsxDEV":"jsxs");define("id/createElement","createElement");define("id/fragment","Fragment");set(r,"defaultPure",i===l.importSource)}else{throw e.buildCodeFrameError(`Runtime must be either "classic" or "automatic".`)}if(t){e.traverse(E,r)}}},JSXElement:{exit(e,t){let r;if(get(t,"runtime")==="classic"||shouldUseCreateElement(e)){r=buildCreateElementCall(e,t)}else{r=buildJSXElementCall(e,t)}e.replaceWith(n.types.inherits(r,e.node))}},JSXFragment:{exit(e,t){let r;if(get(t,"runtime")==="classic"){r=buildCreateElementFragmentCall(e,t)}else{r=buildJSXFragmentCall(e,t)}e.replaceWith(n.types.inherits(r,e.node))}},JSXAttribute(e){if(n.types.isJSXElement(e.node.value)){e.node.value=n.types.jsxExpressionContainer(e.node.value)}}}};function call(e,t,r){const s=n.types.callExpression(get(e,`id/${t}`)(),r);if(o!=null?o:get(e,"defaultPure"))(0,i.default)(s);return s}function shouldUseCreateElement(e){const t=e.get("openingElement");const r=t.node.attributes;let s=false;for(let e=0;e1){t=n.types.arrayExpression(e)}else{return undefined}return n.types.objectProperty(n.types.identifier("children"),t)}function buildJSXElementCall(e,r){const s=e.get("openingElement");const a=[getTag(s)];const o=[];const i=Object.create(null);for(const t of s.get("attributes")){if(t.isJSXAttribute()&&n.types.isJSXIdentifier(t.node.name)){const{name:r}=t.node.name;switch(r){case"__source":case"__self":if(i[r])throw sourceSelfError(e,r);case"key":{const e=convertAttributeValue(t.node.value);if(e===null){throw t.buildCodeFrameError('Please provide an explicit key value. Using "key" as a shorthand for "key={true}" is not allowed.')}i[r]=e;break}default:o.push(t)}}else{o.push(t)}}const l=n.types.react.buildChildren(e.node);let c;if(o.length||l.length){c=buildJSXOpeningElementAttributes(o,r,l)}else{c=n.types.objectExpression([])}a.push(c);if(t){var u,p,d;a.push((u=i.key)!=null?u:e.scope.buildUndefinedNode(),n.types.booleanLiteral(l.length>1),(p=i.__source)!=null?p:e.scope.buildUndefinedNode(),(d=i.__self)!=null?d:n.types.thisExpression())}else if(i.key!==undefined){a.push(i.key)}return call(r,l.length>1?"jsxs":"jsx",a)}function buildJSXOpeningElementAttributes(e,t,r){const s=e.reduce(accumulateAttribute,[]);if((r==null?void 0:r.length)>0){s.push(buildChildrenProperty(r))}return n.types.objectExpression(s)}function buildJSXFragmentCall(e,r){const s=[get(r,"id/fragment")()];const a=n.types.react.buildChildren(e.node);s.push(n.types.objectExpression(a.length>0?[buildChildrenProperty(a)]:[]));if(t){s.push(e.scope.buildUndefinedNode(),n.types.booleanLiteral(a.length>1))}return call(r,a.length>1?"jsxs":"jsx",s)}function buildCreateElementFragmentCall(e,t){if(m&&!m(e.node,t))return;return call(t,"createElement",[get(t,"id/fragment")(),n.types.nullLiteral(),...n.types.react.buildChildren(e.node)])}function buildCreateElementCall(e,t){const r=e.get("openingElement");return call(t,"createElement",[getTag(r),buildCreateElementOpeningElementAttributes(t,e,r.get("attributes")),...n.types.react.buildChildren(e.node)])}function getTag(e){const t=convertJSXIdentifier(e.node.name,e.node);let r;if(n.types.isIdentifier(t)){r=t.name}else if(n.types.isLiteral(t)){r=t.value}if(n.types.react.isCompatTag(r)){return n.types.stringLiteral(r)}else{return t}}function buildCreateElementOpeningElementAttributes(e,t,r){const s=get(e,"runtime");{if(s!=="automatic"){const t=[];const s=r.reduce(accumulateAttribute,[]);if(!x){let e=0;s.forEach(((r,a)=>{if(n.types.isSpreadElement(r)){if(a>e){t.push(n.types.objectExpression(s.slice(e,a)))}t.push(r.argument);e=a+1}}));if(s.length>e){t.push(n.types.objectExpression(s.slice(e)))}}else if(s.length){t.push(n.types.objectExpression(s))}if(!t.length){return n.types.nullLiteral()}if(t.length===1){return t[0]}if(!n.types.isObjectExpression(t[0])){t.unshift(n.types.objectExpression([]))}const a=v?n.types.memberExpression(n.types.identifier("Object"),n.types.identifier("assign")):e.addHelper("extends");return n.types.callExpression(a,t)}}const a=[];const o=Object.create(null);for(const e of r){const r=n.types.isJSXAttribute(e)&&n.types.isJSXIdentifier(e.name)&&e.name.name;if(s==="automatic"&&(r==="__source"||r==="__self")){if(o[r])throw sourceSelfError(t,r);o[r]=true}accumulateAttribute(a,e)}return a.length===1&&n.types.isSpreadElement(a[0])?a[0].argument:a.length>0?n.types.objectExpression(a):n.types.nullLiteral()}}));function getSource(e,r){switch(r){case"Fragment":return`${e}/${t?"jsx-dev-runtime":"jsx-runtime"}`;case"jsxDEV":return`${e}/jsx-dev-runtime`;case"jsx":case"jsxs":return`${e}/jsx-runtime`;case"createElement":return e}}function createImportLazily(e,t,r,s){return()=>{const a=getSource(s,r);if((0,o.isModule)(t)){let s=get(e,`imports/${r}`);if(s)return n.types.cloneNode(s);s=(0,o.addNamed)(t,r,a,{importedInterop:"uncompiled",importPosition:"after"});set(e,`imports/${r}`,s);return s}else{let s=get(e,`requires/${a}`);if(s){s=n.types.cloneNode(s)}else{s=(0,o.addNamespace)(t,a,{importedInterop:"uncompiled"});set(e,`requires/${a}`,s)}return n.types.memberExpression(s,n.types.identifier(r))}}}}function toMemberExpression(e){return e.split(".").map((e=>n.types.identifier(e))).reduce(((e,t)=>n.types.memberExpression(e,t)))}function makeSource(e,t){const r=e.node.loc;if(!r){return e.scope.buildUndefinedNode()}if(!t.fileNameIdentifier){const{filename:r=""}=t;const s=e.scope.generateUidIdentifier("_jsxFileName");const a=e.hub.getScope();if(a){a.push({id:s,init:n.types.stringLiteral(r)})}t.fileNameIdentifier=s}return makeTrace(n.types.cloneNode(t.fileNameIdentifier),r.start.line,r.start.column)}function makeTrace(e,t,r){const s=t!=null?n.types.numericLiteral(t):n.types.nullLiteral();const a=r!=null?n.types.numericLiteral(r+1):n.types.nullLiteral();const o=n.types.objectProperty(n.types.identifier("fileName"),e);const i=n.types.objectProperty(n.types.identifier("lineNumber"),s);const l=n.types.objectProperty(n.types.identifier("columnNumber"),a);return n.types.objectExpression([o,i,l])}function sourceSelfError(e,t){const r=`transform-react-jsx-${t.slice(2)}`;return e.buildCodeFrameError(`Duplicate ${t} prop found. You are most likely using the deprecated ${r} Babel plugin. Both __source and __self are automatically set when using the automatic runtime. Please remove transform-react-jsx-source and transform-react-jsx-self from your Babel config.`)}},309:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(594);var a=(0,s.default)({name:"transform-react-jsx/development",development:true});t["default"]=a},496:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3100);var a=r(2155);var n=r(8304);const o=new Map([["react",["cloneElement","createContext","createElement","createFactory","createRef","forwardRef","isValidElement","memo","lazy"]],["react-dom",["createPortal"]]]);var i=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-react-pure-annotations",visitor:{CallExpression(e){if(isReactCall(e)){(0,a.default)(e)}}}}}));t["default"]=i;function isReactCall(e){if(!n.types.isMemberExpression(e.node.callee)){const t=e.get("callee");for(const[e,r]of o){for(const s of r){if(t.referencesImport(e,s)){return true}}}return false}for(const[t,r]of o){const s=e.get("callee.object");if(s.referencesImport(t,"default")||s.referencesImport(t,"*")){for(const t of r){if(n.types.isIdentifier(e.node.callee.property,{name:t})){return true}}return false}}return false}},3100:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8720:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8403);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-reserved-words",visitor:{"BindingIdentifier|ReferencedIdentifier"(e){if(!a.types.isValidES3Identifier(e.node.name)){e.scope.rename(e.node.name)}}}}}));t["default"]=n},8403:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8648:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9836);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-shorthand-properties",visitor:{ObjectMethod(e){const{node:t}=e;if(t.kind==="method"){const r=a.types.functionExpression(null,t.params,t.body,t.generator,t.async);r.returnType=t.returnType;const s=a.types.toComputedKey(t);if(a.types.isStringLiteral(s,{value:"__proto__"})){e.replaceWith(a.types.objectProperty(s,r,true))}else{e.replaceWith(a.types.objectProperty(t.key,r,t.computed))}}},ObjectProperty(e){const{node:t}=e;if(t.shorthand){const r=a.types.toComputedKey(t);if(a.types.isStringLiteral(r,{value:"__proto__"})){e.replaceWith(a.types.objectProperty(r,t.value,true))}else{t.shorthand=false}}}}}}));t["default"]=n},9836:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8476:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(2763);var a=r(5480);var n=r(8304);var o=(0,s.declare)(((e,t)=>{var r,s;e.assertVersion(7);const o=(r=e.assumption("iterableIsArray"))!=null?r:t.loose;const i=(s=t.allowArrayLike)!=null?s:e.assumption("arrayLikeIsIterable");function getSpreadLiteral(e,t){if(o&&!n.types.isIdentifier(e.argument,{name:"arguments"})){return e.argument}else{return t.toArray(e.argument,true,i)}}function hasHole(e){return e.elements.some((e=>e===null))}function hasSpread(e){for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1245:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(7521);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-sticky-regex",visitor:{RegExpLiteral(e){const{node:t}=e;if(!t.flags.includes("y"))return;e.replaceWith(a.types.newExpression(a.types.identifier("RegExp"),[a.types.stringLiteral(t.pattern),a.types.stringLiteral(t.flags)]))}}}}));t["default"]=n},7521:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5356:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9116);var a=r(8304);var n=(0,s.declare)(((e,t)=>{var r,s;e.assertVersion(7);const n=(r=e.assumption("ignoreToPrimitiveHint"))!=null?r:t.loose;const o=(s=e.assumption("mutableTemplateObject"))!=null?s:t.loose;let i="taggedTemplateLiteral";if(o)i+="Loose";function buildConcatCallExpressions(e){let t=true;return e.reduce((function(e,r){let s=a.types.isLiteral(r);if(!s&&t){s=true;t=false}if(s&&a.types.isCallExpression(e)){e.arguments.push(r);return e}return a.types.callExpression(a.types.memberExpression(e,a.types.identifier("concat")),[r])}))}return{name:"transform-template-literals",visitor:{TaggedTemplateExpression(e){const{node:t}=e;const{quasi:r}=t;const s=[];const n=[];let o=true;for(const t of r.quasis){const{raw:r,cooked:i}=t.value;const l=i==null?e.scope.buildUndefinedNode():a.types.stringLiteral(i);s.push(l);n.push(a.types.stringLiteral(r));if(r!==i){o=false}}const l=[a.types.arrayExpression(s)];if(!o){l.push(a.types.arrayExpression(n))}const c=e.scope.generateUidIdentifier("templateObject");e.scope.getProgramParent().push({id:a.types.cloneNode(c)});e.replaceWith(a.types.callExpression(t.tag,[a.template.expression.ast` ${a.types.cloneNode(c)} || ( ${c} = ${this.addHelper(i)}(${l}) ) - `,...r.expressions]))},TemplateLiteral(e){const t=[];const r=e.get("expressions");let s=0;for(const n of e.node.quasis){if(n.value.cooked){t.push(a.types.stringLiteral(n.value.cooked))}if(s1){o=buildConcatCallExpressions(t)}e.replaceWith(o)}}}}));t["default"]=n},9116:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5502:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9001);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-typeof-symbol",visitor:{Scope({scope:e}){if(!e.getBinding("Symbol")){return}e.rename("Symbol")},UnaryExpression(e){const{node:t,parent:r}=e;if(t.operator!=="typeof")return;if(e.parentPath.isBinaryExpression()&&a.types.EQUALITY_BINARY_OPERATORS.indexOf(r.operator)>=0){const t=e.getOpposite();if(t.isLiteral()&&t.node.value!=="symbol"&&t.node.value!=="object"){return}}let s=e.findParent((e=>{if(e.isFunction()){var t;return((t=e.get("body.directives.0"))==null?void 0:t.node.value.value)==="@babel/helpers - typeof"}}));if(s)return;const n=this.addHelper("typeof");s=e.findParent((e=>e.isVariableDeclarator()&&e.node.id===n||e.isFunctionDeclaration()&&e.node.id&&e.node.id.name===n.name));if(s){return}const o=a.types.callExpression(n,[t.argument]);const i=e.get("argument");if(i.isIdentifier()&&!e.scope.hasBinding(i.node.name,true)){const r=a.types.unaryExpression("typeof",a.types.cloneNode(t.argument));e.replaceWith(a.types.conditionalExpression(a.types.binaryExpression("===",r,a.types.stringLiteral("undefined")),a.types.stringLiteral("undefined"),o))}else{e.replaceWith(o)}}}}}));t["default"]=n},9001:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},3448:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(728);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);const t=/[\ud800-\udfff]/g;const r=/(\\+)u\{([0-9a-fA-F]+)\}/g;function escape(e){let t=e.toString(16);while(t.length<4)t="0"+t;return"\\u"+t}function replacer(e,t,r){if(t.length%2===0){return e}const s=String.fromCodePoint(parseInt(r,16));const a=t.slice(0,-1)+escape(s.charCodeAt(0));return s.length===1?a:a+escape(s.charCodeAt(1))}function replaceUnicodeEscapes(e){return e.replace(r,replacer)}function getUnicodeEscape(e){let t;while(t=r.exec(e)){if(t[1].length%2===0)continue;r.lastIndex=0;return t[0]}return null}return{name:"transform-unicode-escapes",manipulateOptions({generatorOpts:e}){var t,r;if(!e.jsescOption){e.jsescOption={}}(r=(t=e.jsescOption).minimal)!=null?r:t.minimal=false},visitor:{Identifier(e){const{node:r,key:s}=e;const{name:n}=r;const o=n.replace(t,(e=>`_u${e.charCodeAt(0).toString(16)}`));if(n===o)return;const i=a.types.inherits(a.types.stringLiteral(n),r);if(s==="key"){e.replaceWith(i);return}const{parentPath:l,scope:c}=e;if(l.isMemberExpression({property:r})||l.isOptionalMemberExpression({property:r})){l.node.computed=true;e.replaceWith(i);return}const u=c.getBinding(n);if(u){c.rename(n,c.generateUid(o));return}throw e.buildCodeFrameError(`Can't reference '${n}' as a bare identifier`)},"StringLiteral|DirectiveLiteral"(e){const{node:t}=e;const{extra:r}=t;if(r!=null&&r.raw)r.raw=replaceUnicodeEscapes(r.raw)},TemplateElement(e){const{node:t,parentPath:r}=e;const{value:s}=t;const a=getUnicodeEscape(s.raw);if(!a)return;const n=r.parentPath;if(n.isTaggedTemplateExpression()){throw e.buildCodeFrameError(`Can't replace Unicode escape '${a}' inside tagged template literals. You can enable '@babel/plugin-transform-template-literals' to compile them to classic strings.`)}s.raw=replaceUnicodeEscapes(s.raw)}}}}));t["default"]=n},728:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},4122:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6550);var a=r(836);var n=(0,a.declare)((e=>{e.assertVersion(7);return(0,s.createRegExpFeaturePlugin)({name:"transform-unicode-regex",feature:"unicodeFlag"})}));t["default"]=n},836:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9453:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;const r={allowInsertArrow:false,specCompliant:false};var _default=({types:e})=>({name:"transform-async-arrows-in-class",visitor:{ArrowFunctionExpression(t){if(t.node.async&&t.findParent(e.isClassMethod)){t.arrowFunctionToExpression(r)}}}});t["default"]=_default;e.exports=t.default},489:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;var _default=({types:e})=>{const isArrowParent=t=>t.parentKey==="params"&&t.parentPath&&e.isArrowFunctionExpression(t.parentPath);return{name:"transform-edge-default-parameters",visitor:{AssignmentPattern(e){const t=e.find(isArrowParent);if(t&&e.parent.shorthand){e.parent.shorthand=false;(e.parent.extra||{}).shorthand=false;e.scope.rename(e.parent.key.name)}}}}};t["default"]=_default;e.exports=t.default},3258:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;var _default=({types:e})=>({name:"transform-edge-function-name",visitor:{FunctionExpression:{exit(t){if(!t.node.id&&e.isIdentifier(t.parent.id)){const r=e.cloneNode(t.parent.id);const s=t.scope.getBinding(r.name);if(s==null?void 0:s.constantViolations.length){t.scope.rename(r.name)}t.node.id=r}}}}});t["default"]=_default;e.exports=t.default},5899:(e,t)=>{"use strict";t.__esModule=true;t["default"]=_default;function _default({types:e}){return{name:"transform-safari-block-shadowing",visitor:{VariableDeclarator(t){const r=t.parent.kind;if(r!=="let"&&r!=="const")return;const s=t.scope.block;if(e.isFunction(s)||e.isProgram(s))return;const a=e.getOuterBindingIdentifiers(t.node.id);for(const r of Object.keys(a)){let s=t.scope;if(!s.hasOwnBinding(r))continue;while(s=s.parent){if(s.hasOwnBinding(r)){t.scope.rename(r);break}if(e.isFunction(s.block)||e.isProgram(s.block)){break}}}}}}}e.exports=t.default},6668:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;function handle(e){if(!e.isVariableDeclaration())return;const t=e.getFunctionParent();const{name:r}=e.node.declarations[0].id;if(t&&t.scope.hasOwnBinding(r)&&t.scope.getOwnBinding(r).kind==="param"){e.scope.rename(r)}}var _default=()=>({name:"transform-safari-for-shadowing",visitor:{ForXStatement(e){handle(e.get("left"))},ForStatement(e){handle(e.get("init"))}}});t["default"]=_default;e.exports=t.default},3744:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;var _default=({types:e})=>({name:"transform-tagged-template-caching",visitor:{TaggedTemplateExpression(t,r){let s=r.get("processed");if(!s){s=new Map;r.set("processed",s)}if(s.has(t.node))return t.skip();const a=t.node.quasi.expressions;let n=r.get("identity");if(!n){n=t.scope.getProgramParent().generateDeclaredUidIdentifier("_");r.set("identity",n);const s=t.scope.getBinding(n.name);s.path.get("init").replaceWith(e.arrowFunctionExpression([e.identifier("t")],e.identifier("t")))}const o=e.taggedTemplateExpression(n,e.templateLiteral(t.node.quasi.quasis,a.map((()=>e.numericLiteral(0)))));s.set(o,true);const i=t.scope.getProgramParent().generateDeclaredUidIdentifier("t");t.scope.getBinding(i.name).path.parent.kind="let";const l=e.logicalExpression("||",i,e.assignmentExpression("=",i,o));const c=e.callExpression(t.node.tag,[l,...a]);t.replaceWith(c)}}});t["default"]=_default;e.exports=t.default},8277:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(7534);var a=r(7420);var n=r(9833);var o=r(2625);var i=r(496);var l=r(7347);function _interopDefaultLegacy(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var c=_interopDefaultLegacy(a);var u=_interopDefaultLegacy(n);var p=_interopDefaultLegacy(o);var f=_interopDefaultLegacy(i);new l.OptionValidator("@babel/preset-react");function normalizeOptions(e={}){{let{pragma:t,pragmaFrag:r}=e;const{pure:s,throwIfNamespace:a=true,runtime:n="classic",importSource:o,useBuiltIns:i,useSpread:l}=e;if(n==="classic"){t=t||"React.createElement";r=r||"React.Fragment"}const c=!!e.development;return{development:c,importSource:o,pragma:t,pragmaFrag:r,pure:s,runtime:n,throwIfNamespace:a,useBuiltIns:i,useSpread:l}}}var d=s.declare(((e,t)=>{e.assertVersion(7);const{development:r,importSource:s,pragma:a,pragmaFrag:n,pure:o,runtime:i,throwIfNamespace:l}=normalizeOptions(t);return{plugins:[[r?u["default"]:c["default"],{importSource:s,pragma:a,pragmaFrag:n,runtime:i,throwIfNamespace:l,pure:o,useBuiltIns:!!t.useBuiltIns,useSpread:t.useSpread}],p["default"],o!==false&&f["default"]].filter(Boolean)}}));t["default"]=d},7534:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7005:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=createPlugin;var s=r(8926);var a=r(7534);var n=r(8304);var o=r(9115);var i=r(2155);const l={importSource:"react",runtime:"automatic",pragma:"React.createElement",pragmaFrag:"React.Fragment"};const c=/\*?\s*@jsxImportSource\s+([^\s]+)/;const u=/\*?\s*@jsxRuntime\s+([^\s]+)/;const p=/\*?\s*@jsx\s+([^\s]+)/;const f=/\*?\s*@jsxFrag\s+([^\s]+)/;const get=(e,t)=>e.get(`@babel/plugin-react-jsx/${t}`);const set=(e,t,r)=>e.set(`@babel/plugin-react-jsx/${t}`,r);function createPlugin({name:e,development:t}){return(0,a.declare)(((r,a)=>{const{pure:o,throwIfNamespace:d=true,filter:m,runtime:y=(t?"automatic":"classic"),importSource:g=l.importSource,pragma:h=l.pragma,pragmaFrag:b=l.pragmaFrag}=a;{var{useSpread:x=false,useBuiltIns:v=false}=a;if(y==="classic"){if(typeof x!=="boolean"){throw new Error("transform-react-jsx currently only accepts a boolean option for "+"useSpread (defaults to false)")}if(typeof v!=="boolean"){throw new Error("transform-react-jsx currently only accepts a boolean option for "+"useBuiltIns (defaults to false)")}if(x&&v){throw new Error("transform-react-jsx currently only accepts useBuiltIns or useSpread "+"but not both")}}}const E={JSXOpeningElement(e,t){for(const t of e.get("attributes")){if(!t.isJSXElement())continue;const{name:r}=t.node.name;if(r==="__source"||r==="__self"){throw e.buildCodeFrameError(`__source and __self should not be defined in props and are reserved for internal usage.`)}}const r=n.types.jsxAttribute(n.types.jsxIdentifier("__self"),n.types.jsxExpressionContainer(n.types.thisExpression()));const s=n.types.jsxAttribute(n.types.jsxIdentifier("__source"),n.types.jsxExpressionContainer(makeSource(e,t)));e.pushContainer("attributes",[r,s])}};return{name:e,inherits:s.default,visitor:{JSXNamespacedName(e){if(d){throw e.buildCodeFrameError(`Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can set \`throwIfNamespace: false\` to bypass this warning.`)}},JSXSpreadChild(e){throw e.buildCodeFrameError("Spread children are not supported in React.")},Program:{enter(e,r){const{file:s}=r;let o=y;let i=g;let d=h;let m=b;let x=!!a.importSource;let v=!!a.pragma;let j=!!a.pragmaFrag;if(s.ast.comments){for(const e of s.ast.comments){const t=c.exec(e.value);if(t){i=t[1];x=true}const r=u.exec(e.value);if(r){o=r[1]}const s=p.exec(e.value);if(s){d=s[1];v=true}const a=f.exec(e.value);if(a){m=a[1];j=true}}}set(r,"runtime",o);if(o==="classic"){if(x){throw e.buildCodeFrameError(`importSource cannot be set when runtime is classic.`)}const t=toMemberExpression(d);const s=toMemberExpression(m);set(r,"id/createElement",(()=>n.types.cloneNode(t)));set(r,"id/fragment",(()=>n.types.cloneNode(s)));set(r,"defaultPure",d===l.pragma)}else if(o==="automatic"){if(v||j){throw e.buildCodeFrameError(`pragma and pragmaFrag cannot be set when runtime is automatic.`)}const define=(t,s)=>set(r,t,createImportLazily(r,e,s,i));define("id/jsx",t?"jsxDEV":"jsx");define("id/jsxs",t?"jsxDEV":"jsxs");define("id/createElement","createElement");define("id/fragment","Fragment");set(r,"defaultPure",i===l.importSource)}else{throw e.buildCodeFrameError(`Runtime must be either "classic" or "automatic".`)}if(t){e.traverse(E,r)}}},JSXElement:{exit(e,t){let r;if(get(t,"runtime")==="classic"||shouldUseCreateElement(e)){r=buildCreateElementCall(e,t)}else{r=buildJSXElementCall(e,t)}e.replaceWith(n.types.inherits(r,e.node))}},JSXFragment:{exit(e,t){let r;if(get(t,"runtime")==="classic"){r=buildCreateElementFragmentCall(e,t)}else{r=buildJSXFragmentCall(e,t)}e.replaceWith(n.types.inherits(r,e.node))}},JSXAttribute(e){if(n.types.isJSXElement(e.node.value)){e.node.value=n.types.jsxExpressionContainer(e.node.value)}}}};function call(e,t,r){const s=n.types.callExpression(get(e,`id/${t}`)(),r);if(o!=null?o:get(e,"defaultPure"))(0,i.default)(s);return s}function shouldUseCreateElement(e){const t=e.get("openingElement");const r=t.node.attributes;let s=false;for(let e=0;e1){t=n.types.arrayExpression(e)}else{return undefined}return n.types.objectProperty(n.types.identifier("children"),t)}function buildJSXElementCall(e,r){const s=e.get("openingElement");const a=[getTag(s)];const o=[];const i=Object.create(null);for(const t of s.get("attributes")){if(t.isJSXAttribute()&&n.types.isJSXIdentifier(t.node.name)){const{name:r}=t.node.name;switch(r){case"__source":case"__self":if(i[r])throw sourceSelfError(e,r);case"key":{const e=convertAttributeValue(t.node.value);if(e===null){throw t.buildCodeFrameError('Please provide an explicit key value. Using "key" as a shorthand for "key={true}" is not allowed.')}i[r]=e;break}default:o.push(t)}}else{o.push(t)}}const l=n.types.react.buildChildren(e.node);let c;if(o.length||l.length){c=buildJSXOpeningElementAttributes(o,r,l)}else{c=n.types.objectExpression([])}a.push(c);if(t){var u,p,f;a.push((u=i.key)!=null?u:e.scope.buildUndefinedNode(),n.types.booleanLiteral(l.length>1),(p=i.__source)!=null?p:e.scope.buildUndefinedNode(),(f=i.__self)!=null?f:n.types.thisExpression())}else if(i.key!==undefined){a.push(i.key)}return call(r,l.length>1?"jsxs":"jsx",a)}function buildJSXOpeningElementAttributes(e,t,r){const s=e.reduce(accumulateAttribute,[]);if((r==null?void 0:r.length)>0){s.push(buildChildrenProperty(r))}return n.types.objectExpression(s)}function buildJSXFragmentCall(e,r){const s=[get(r,"id/fragment")()];const a=n.types.react.buildChildren(e.node);s.push(n.types.objectExpression(a.length>0?[buildChildrenProperty(a)]:[]));if(t){s.push(e.scope.buildUndefinedNode(),n.types.booleanLiteral(a.length>1))}return call(r,a.length>1?"jsxs":"jsx",s)}function buildCreateElementFragmentCall(e,t){if(m&&!m(e.node,t))return;return call(t,"createElement",[get(t,"id/fragment")(),n.types.nullLiteral(),...n.types.react.buildChildren(e.node)])}function buildCreateElementCall(e,t){const r=e.get("openingElement");return call(t,"createElement",[getTag(r),buildCreateElementOpeningElementAttributes(t,e,r.get("attributes")),...n.types.react.buildChildren(e.node)])}function getTag(e){const t=convertJSXIdentifier(e.node.name,e.node);let r;if(n.types.isIdentifier(t)){r=t.name}else if(n.types.isLiteral(t)){r=t.value}if(n.types.react.isCompatTag(r)){return n.types.stringLiteral(r)}else{return t}}function buildCreateElementOpeningElementAttributes(e,t,r){const s=get(e,"runtime");{if(s!=="automatic"){const t=[];const s=r.reduce(accumulateAttribute,[]);if(!x){let e=0;s.forEach(((r,a)=>{if(n.types.isSpreadElement(r)){if(a>e){t.push(n.types.objectExpression(s.slice(e,a)))}t.push(r.argument);e=a+1}}));if(s.length>e){t.push(n.types.objectExpression(s.slice(e)))}}else if(s.length){t.push(n.types.objectExpression(s))}if(!t.length){return n.types.nullLiteral()}if(t.length===1){return t[0]}if(!n.types.isObjectExpression(t[0])){t.unshift(n.types.objectExpression([]))}const a=v?n.types.memberExpression(n.types.identifier("Object"),n.types.identifier("assign")):e.addHelper("extends");return n.types.callExpression(a,t)}}const a=[];const o=Object.create(null);for(const e of r){const r=n.types.isJSXAttribute(e)&&n.types.isJSXIdentifier(e.name)&&e.name.name;if(s==="automatic"&&(r==="__source"||r==="__self")){if(o[r])throw sourceSelfError(t,r);o[r]=true}accumulateAttribute(a,e)}return a.length===1&&n.types.isSpreadElement(a[0])?a[0].argument:a.length>0?n.types.objectExpression(a):n.types.nullLiteral()}}));function getSource(e,r){switch(r){case"Fragment":return`${e}/${t?"jsx-dev-runtime":"jsx-runtime"}`;case"jsxDEV":return`${e}/jsx-dev-runtime`;case"jsx":case"jsxs":return`${e}/jsx-runtime`;case"createElement":return e}}function createImportLazily(e,t,r,s){return()=>{const a=getSource(s,r);if((0,o.isModule)(t)){let s=get(e,`imports/${r}`);if(s)return n.types.cloneNode(s);s=(0,o.addNamed)(t,r,a,{importedInterop:"uncompiled",importPosition:"after"});set(e,`imports/${r}`,s);return s}else{let s=get(e,`requires/${a}`);if(s){s=n.types.cloneNode(s)}else{s=(0,o.addNamespace)(t,a,{importedInterop:"uncompiled"});set(e,`requires/${a}`,s)}return n.types.memberExpression(s,n.types.identifier(r))}}}}function toMemberExpression(e){return e.split(".").map((e=>n.types.identifier(e))).reduce(((e,t)=>n.types.memberExpression(e,t)))}function makeSource(e,t){const r=e.node.loc;if(!r){return e.scope.buildUndefinedNode()}if(!t.fileNameIdentifier){const{filename:r=""}=t;const s=e.scope.generateUidIdentifier("_jsxFileName");const a=e.hub.getScope();if(a){a.push({id:s,init:n.types.stringLiteral(r)})}t.fileNameIdentifier=s}return makeTrace(n.types.cloneNode(t.fileNameIdentifier),r.start.line,r.start.column)}function makeTrace(e,t,r){const s=t!=null?n.types.numericLiteral(t):n.types.nullLiteral();const a=r!=null?n.types.numericLiteral(r+1):n.types.nullLiteral();const o=n.types.objectProperty(n.types.identifier("fileName"),e);const i=n.types.objectProperty(n.types.identifier("lineNumber"),s);const l=n.types.objectProperty(n.types.identifier("columnNumber"),a);return n.types.objectExpression([o,i,l])}function sourceSelfError(e,t){const r=`transform-react-jsx-${t.slice(2)}`;return e.buildCodeFrameError(`Duplicate ${t} prop found. You are most likely using the deprecated ${r} Babel plugin. Both __source and __self are automatically set when using the automatic runtime. Please remove transform-react-jsx-source and transform-react-jsx-self from your Babel config.`)}},7420:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(7005);var a=(0,s.default)({name:"transform-react-jsx",development:false});t["default"]=a},6919:e=>{function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}e.exports=_interopRequireDefault},449:(e,t,r)=>{var s=r(2810);function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function _getRequireWildcardCache(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||s(e)!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e){if(Object.prototype.hasOwnProperty.call(e,n)){var o=a?Object.getOwnPropertyDescriptor(e,n):null;if(o&&(o.get||o.set)){Object.defineProperty(r,n,o)}else{r[n]=e[n]}}}r["default"]=e;if(t){t.set(e,r)}return r}e.exports=_interopRequireWildcard},2810:e=>{function _typeof(t){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){e.exports=_typeof=function _typeof(e){return typeof e}}else{e.exports=_typeof=function _typeof(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}}return _typeof(t)}e.exports=_typeof},4309:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=createTemplateBuilder;var s=r(4578);var a=r(351);var n=r(5932);const o=(0,s.validate)({placeholderPattern:false});function createTemplateBuilder(e,t){const r=new WeakMap;const i=new WeakMap;const l=t||(0,s.validate)(null);return Object.assign(((t,...o)=>{if(typeof t==="string"){if(o.length>1)throw new Error("Unexpected extra params.");return extendedTrace((0,a.default)(e,t,(0,s.merge)(l,(0,s.validate)(o[0]))))}else if(Array.isArray(t)){let s=r.get(t);if(!s){s=(0,n.default)(e,t,l);r.set(t,s)}return extendedTrace(s(o))}else if(typeof t==="object"&&t){if(o.length>0)throw new Error("Unexpected extra params.");return createTemplateBuilder(e,(0,s.merge)(l,(0,s.validate)(t)))}throw new Error(`Unexpected template param ${typeof t}`)}),{ast:(t,...r)=>{if(typeof t==="string"){if(r.length>1)throw new Error("Unexpected extra params.");return(0,a.default)(e,t,(0,s.merge)((0,s.merge)(l,(0,s.validate)(r[0])),o))()}else if(Array.isArray(t)){let a=i.get(t);if(!a){a=(0,n.default)(e,t,(0,s.merge)(l,o));i.set(t,a)}return a(r)()}throw new Error(`Unexpected template param ${typeof t}`)}})}function extendedTrace(e){let t="";try{throw new Error}catch(e){if(e.stack){t=e.stack.split("\n").slice(3).join("\n")}}return r=>{try{return e(r)}catch(e){e.stack+=`\n =============\n${t}`;throw e}}}},7522:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.program=t.expression=t.statement=t.statements=t.smart=void 0;var s=r(8622);function makeStatementFormatter(e){return{code:e=>`/* @babel/template */;\n${e}`,validate:()=>{},unwrap:t=>e(t.program.body.slice(1))}}const a=makeStatementFormatter((e=>{if(e.length>1){return e}else{return e[0]}}));t.smart=a;const n=makeStatementFormatter((e=>e));t.statements=n;const o=makeStatementFormatter((e=>{if(e.length===0){throw new Error("Found nothing to return.")}if(e.length>1){throw new Error("Found multiple statements but wanted one")}return e[0]}));t.statement=o;const i={code:e=>`(\n${e}\n)`,validate:e=>{if(e.program.body.length>1){throw new Error("Found multiple statements but wanted one")}if(i.unwrap(e).start===0){throw new Error("Parse result included parens.")}},unwrap:({program:e})=>{const[t]=e.body;s.assertExpressionStatement(t);return t.expression}};t.expression=i;const l={code:e=>e,validate:()=>{},unwrap:e=>e.program};t.program=l},153:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=t.program=t.expression=t.statements=t.statement=t.smart=void 0;var s=r(7522);var a=r(4309);const n=(0,a.default)(s.smart);t.smart=n;const o=(0,a.default)(s.statement);t.statement=o;const i=(0,a.default)(s.statements);t.statements=i;const l=(0,a.default)(s.expression);t.expression=l;const c=(0,a.default)(s.program);t.program=c;var u=Object.assign(n.bind(undefined),{smart:n,statement:o,statements:i,expression:l,program:c,ast:n.ast});t["default"]=u},5932:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=literalTemplate;var s=r(4578);var a=r(8502);var n=r(7635);function literalTemplate(e,t,r){const{metadata:a,names:o}=buildLiteralData(e,t,r);return t=>{const r={};t.forEach(((e,t)=>{r[o[t]]=e}));return t=>{const o=(0,s.normalizeReplacements)(t);if(o){Object.keys(o).forEach((e=>{if(Object.prototype.hasOwnProperty.call(r,e)){throw new Error("Unexpected replacement overlap.")}}))}return e.unwrap((0,n.default)(a,o?Object.assign(o,r):r))}}}function buildLiteralData(e,t,r){let s;let n;let o;let i="";do{i+="$";const l=buildTemplateCode(t,i);s=l.names;n=new Set(s);o=(0,a.default)(e,e.code(l.code),{parser:r.parser,placeholderWhitelist:new Set(l.names.concat(r.placeholderWhitelist?Array.from(r.placeholderWhitelist):[])),placeholderPattern:r.placeholderPattern,preserveComments:r.preserveComments,syntacticPlaceholders:r.syntacticPlaceholders})}while(o.placeholders.some((e=>e.isDuplicate&&n.has(e.name))));return{metadata:o,names:s}}function buildTemplateCode(e,t){const r=[];let s=e[0];for(let a=1;a{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.merge=merge;t.validate=validate;t.normalizeReplacements=normalizeReplacements;function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var r={};var s=Object.keys(e);var a,n;for(n=0;n=0)continue;r[a]=e[a]}return r}function merge(e,t){const{placeholderWhitelist:r=e.placeholderWhitelist,placeholderPattern:s=e.placeholderPattern,preserveComments:a=e.preserveComments,syntacticPlaceholders:n=e.syntacticPlaceholders}=t;return{parser:Object.assign({},e.parser,t.parser),placeholderWhitelist:r,placeholderPattern:s,preserveComments:a,syntacticPlaceholders:n}}function validate(e){if(e!=null&&typeof e!=="object"){throw new Error("Unknown template options.")}const t=e||{},{placeholderWhitelist:r,placeholderPattern:s,preserveComments:a,syntacticPlaceholders:n}=t,o=_objectWithoutPropertiesLoose(t,["placeholderWhitelist","placeholderPattern","preserveComments","syntacticPlaceholders"]);if(r!=null&&!(r instanceof Set)){throw new Error("'.placeholderWhitelist' must be a Set, null, or undefined")}if(s!=null&&!(s instanceof RegExp)&&s!==false){throw new Error("'.placeholderPattern' must be a RegExp, false, null, or undefined")}if(a!=null&&typeof a!=="boolean"){throw new Error("'.preserveComments' must be a boolean, null, or undefined")}if(n!=null&&typeof n!=="boolean"){throw new Error("'.syntacticPlaceholders' must be a boolean, null, or undefined")}if(n===true&&(r!=null||s!=null)){throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible"+" with '.syntacticPlaceholders: true'")}return{parser:o,placeholderWhitelist:r||undefined,placeholderPattern:s==null?undefined:s,preserveComments:a==null?undefined:a,syntacticPlaceholders:n==null?undefined:n}}function normalizeReplacements(e){if(Array.isArray(e)){return e.reduce(((e,t,r)=>{e["$"+r]=t;return e}),{})}else if(typeof e==="object"||e==null){return e||undefined}throw new Error("Template replacements must be an array, object, null, or undefined")}},8502:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=parseAndBuildMetadata;var s=r(8622);var a=r(6949);var n=r(5694);const o=/^[_$A-Z0-9]+$/;function parseAndBuildMetadata(e,t,r){const{placeholderWhitelist:a,placeholderPattern:n,preserveComments:o,syntacticPlaceholders:i}=r;const l=parseWithCodeFrame(t,r.parser,i);s.removePropertiesDeep(l,{preserveComments:o});e.validate(l);const c={placeholders:[],placeholderNames:new Set};const u={placeholders:[],placeholderNames:new Set};const p={value:undefined};s.traverse(l,placeholderVisitorHandler,{syntactic:c,legacy:u,isLegacyRef:p,placeholderWhitelist:a,placeholderPattern:n,syntacticPlaceholders:i});return Object.assign({ast:l},p.value?u:c)}function placeholderVisitorHandler(e,t,r){var a;let n;if(s.isPlaceholder(e)){if(r.syntacticPlaceholders===false){throw new Error("%%foo%%-style placeholders can't be used when "+"'.syntacticPlaceholders' is false.")}else{n=e.name.name;r.isLegacyRef.value=false}}else if(r.isLegacyRef.value===false||r.syntacticPlaceholders){return}else if(s.isIdentifier(e)||s.isJSXIdentifier(e)){n=e.name;r.isLegacyRef.value=true}else if(s.isStringLiteral(e)){n=e.value;r.isLegacyRef.value=true}else{return}if(!r.isLegacyRef.value&&(r.placeholderPattern!=null||r.placeholderWhitelist!=null)){throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible"+" with '.syntacticPlaceholders: true'")}if(r.isLegacyRef.value&&(r.placeholderPattern===false||!(r.placeholderPattern||o).test(n))&&!((a=r.placeholderWhitelist)!=null&&a.has(n))){return}t=t.slice();const{node:i,key:l}=t[t.length-1];let c;if(s.isStringLiteral(e)||s.isPlaceholder(e,{expectedNode:"StringLiteral"})){c="string"}else if(s.isNewExpression(i)&&l==="arguments"||s.isCallExpression(i)&&l==="arguments"||s.isFunction(i)&&l==="params"){c="param"}else if(s.isExpressionStatement(i)&&!s.isPlaceholder(e)){c="statement";t=t.slice(0,-1)}else if(s.isStatement(e)&&s.isPlaceholder(e)){c="statement"}else{c="other"}const{placeholders:u,placeholderNames:p}=r.isLegacyRef.value?r.legacy:r.syntactic;u.push({name:n,type:c,resolve:e=>resolveAncestors(e,t),isDuplicate:p.has(n)});p.add(n)}function resolveAncestors(e,t){let r=e;for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=populatePlaceholders;var s=r(8622);function populatePlaceholders(e,t){const r=s.cloneNode(e.ast);if(t){e.placeholders.forEach((e=>{if(!Object.prototype.hasOwnProperty.call(t,e.name)){const t=e.name;throw new Error(`Error: No substitution given for "${t}". If this is not meant to be a\n placeholder you may want to consider passing one of the following options to @babel/template:\n - { placeholderPattern: false, placeholderWhitelist: new Set(['${t}'])}\n - { placeholderPattern: /^${t}$/ }`)}}));Object.keys(t).forEach((t=>{if(!e.placeholderNames.has(t)){throw new Error(`Unknown substitution "${t}" given`)}}))}e.placeholders.slice().reverse().forEach((e=>{try{applyReplacement(e,r,t&&t[e.name]||null)}catch(t){t.message=`@babel/template placeholder "${e.name}": ${t.message}`;throw t}}));return r}function applyReplacement(e,t,r){if(e.isDuplicate){if(Array.isArray(r)){r=r.map((e=>s.cloneNode(e)))}else if(typeof r==="object"){r=s.cloneNode(r)}}const{parent:a,key:n,index:o}=e.resolve(t);if(e.type==="string"){if(typeof r==="string"){r=s.stringLiteral(r)}if(!r||!s.isStringLiteral(r)){throw new Error("Expected string substitution")}}else if(e.type==="statement"){if(o===undefined){if(!r){r=s.emptyStatement()}else if(Array.isArray(r)){r=s.blockStatement(r)}else if(typeof r==="string"){r=s.expressionStatement(s.identifier(r))}else if(!s.isStatement(r)){r=s.expressionStatement(r)}}else{if(r&&!Array.isArray(r)){if(typeof r==="string"){r=s.identifier(r)}if(!s.isStatement(r)){r=s.expressionStatement(r)}}}}else if(e.type==="param"){if(typeof r==="string"){r=s.identifier(r)}if(o===undefined)throw new Error("Assertion failure.")}else{if(typeof r==="string"){r=s.identifier(r)}if(Array.isArray(r)){throw new Error("Cannot replace single expression with an array.")}}if(o===undefined){s.validate(a,n,r);a[n]=r}else{const t=a[n].slice();if(e.type==="statement"||e.type==="param"){if(r==null){t.splice(o,1)}else if(Array.isArray(r)){t.splice(o,1,...r)}else{t[o]=r}}else{t[o]=r}s.validate(a,n,t);a[n]=t}}},351:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=stringTemplate;var s=r(4578);var a=r(8502);var n=r(7635);function stringTemplate(e,t,r){t=e.code(t);let o;return i=>{const l=(0,s.normalizeReplacements)(i);if(!o)o=(0,a.default)(e,t,r);return e.unwrap((0,n.default)(o,l))}}},5694:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.codeFrameColumns=codeFrameColumns;t["default"]=_default;var s=r(2032);let a=false;function getDefs(e){return{gutter:e.grey,marker:e.red.bold,message:e.red.bold}}const n=/\r\n|[\n\r\u2028\u2029]/;function getMarkerLines(e,t,r){const s=Object.assign({column:0,line:-1},e.start);const a=Object.assign({},s,e.end);const{linesAbove:n=2,linesBelow:o=3}=r||{};const i=s.line;const l=s.column;const c=a.line;const u=a.column;let p=Math.max(i-(n+1),0);let f=Math.min(t.length,c+o);if(i===-1){p=0}if(c===-1){f=t.length}const d=c-i;const m={};if(d){for(let e=0;e<=d;e++){const r=e+i;if(!l){m[r]=true}else if(e===0){const e=t[r-1].length;m[r]=[l,e-l+1]}else if(e===d){m[r]=[0,u]}else{const s=t[r-e].length;m[r]=[0,s]}}}else{if(l===u){if(l){m[i]=[l,0]}else{m[i]=true}}else{m[i]=[l,u-l]}}return{start:p,end:f,markerLines:m}}function codeFrameColumns(e,t,r={}){const a=(r.highlightCode||r.forceColor)&&(0,s.shouldHighlight)(r);const o=(0,s.getChalk)(r);const i=getDefs(o);const maybeHighlight=(e,t)=>a?e(t):t;const l=e.split(n);const{start:c,end:u,markerLines:p}=getMarkerLines(t,l,r);const f=t.start&&typeof t.start.column==="number";const d=String(u).length;const m=a?(0,s.default)(e,r):e;let y=m.split(n).slice(c,u).map(((e,t)=>{const s=c+1+t;const a=` ${s}`.slice(-d);const n=` ${a} |`;const o=p[s];const l=!p[s+1];if(o){let t="";if(Array.isArray(o)){const s=e.slice(0,Math.max(o[0]-1,0)).replace(/[^\t]/g," ");const a=o[1]||1;t=["\n ",maybeHighlight(i.gutter,n.replace(/\d/g," "))," ",s,maybeHighlight(i.marker,"^").repeat(a)].join("");if(l&&r.message){t+=" "+maybeHighlight(i.message,r.message)}}return[maybeHighlight(i.marker,">"),maybeHighlight(i.gutter,n),e.length>0?` ${e}`:"",t].join("")}else{return` ${maybeHighlight(i.gutter,n)}${e.length>0?` ${e}`:""}`}})).join("\n");if(r.message&&!f){y=`${" ".repeat(d+1)}${r.message}\n${y}`}if(a){return o.reset(y)}else{return y}}function _default(e,t,r,s={}){if(!a){a=true;const e="Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";if(process.emitWarning){process.emitWarning(e,"DeprecationWarning")}else{const t=new Error(e);t.name="DeprecationWarning";console.warn(new Error(e))}}r=Math.max(r,0);const n={start:{column:r,line:t}};return codeFrameColumns(e,n,s)}},5002:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(5002);var a=r(7169)},7169:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},2032:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.shouldHighlight=shouldHighlight;t.getChalk=getChalk;t["default"]=highlight;var s=r(8035);var a=r(347);var n=r(8542);const o=new Set(["as","async","from","get","of","set"]);function getDefs(e){return{keyword:e.cyan,capitalized:e.yellow,jsxIdentifier:e.yellow,punctuator:e.yellow,number:e.magenta,string:e.green,regex:e.magenta,comment:e.grey,invalid:e.white.bgRed.bold}}const i=/\r\n|[\n\r\u2028\u2029]/;const l=/^[()[\]{}]$/;let c;{const e=/^[a-z][\w-]*$/i;const getTokenType=function(t,r,s){if(t.type==="name"){if((0,a.isKeyword)(t.value)||(0,a.isStrictReservedWord)(t.value,true)||o.has(t.value)){return"keyword"}if(e.test(t.value)&&(s[r-1]==="<"||s.substr(r-2,2)=="t(e))).join("\n")}else{r+=a}}return r}function shouldHighlight(e){return!!n.supportsColor||e.forceColor}function getChalk(e){return e.forceColor?new n.constructor({enabled:true,level:1}):n}function highlight(e,t={}){if(shouldHighlight(t)){const r=getChalk(t);const s=getDefs(r);return highlightTokens(s,e)}else{return e}}},8716:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var r=function(){function sliceIterator(e,t){var r=[];var s=true;var a=false;var n=undefined;try{for(var o=e[Symbol.iterator](),i;!(s=(i=o.next()).done);s=true){r.push(i.value);if(t&&r.length===t)break}}catch(e){a=true;n=e}finally{try{if(!s&&o["return"])o["return"]()}finally{if(a)throw n}}return r}return function(e,t){if(Array.isArray(e)){return e}else if(Symbol.iterator in Object(e)){return sliceIterator(e,t)}else{throw new TypeError("Invalid attempt to destructure non-iterable instance")}}}();t.getImportSource=getImportSource;t.createDynamicImportTransform=createDynamicImportTransform;function getImportSource(e,t){var s=t.arguments;var a=r(s,1),n=a[0];var o=e.isStringLiteral(n)||e.isTemplateLiteral(n);if(o){e.removeComments(n);return n}return e.templateLiteral([e.templateElement({raw:"",cooked:""}),e.templateElement({raw:"",cooked:""},true)],s)}function createDynamicImportTransform(e){var t=e.template,r=e.types;var s={static:{interop:t("Promise.resolve().then(() => INTEROP(require(SOURCE)))"),noInterop:t("Promise.resolve().then(() => require(SOURCE))")},dynamic:{interop:t("Promise.resolve(SOURCE).then(s => INTEROP(require(s)))"),noInterop:t("Promise.resolve(SOURCE).then(s => require(s))")}};var a=typeof WeakSet==="function"&&new WeakSet;var n=function isString(e){return r.isStringLiteral(e)||r.isTemplateLiteral(e)&&e.expressions.length===0};return function(e,t){if(a){if(a.has(t)){return}a.add(t)}var o=getImportSource(r,t.parent);var i=n(o)?s["static"]:s.dynamic;var l=e.opts.noInterop?i.noInterop({SOURCE:o}):i.interop({SOURCE:o,INTEROP:e.addHelper("interopRequireWildcard")});t.parentPath.replaceWith(l)}}},7047:(e,t,r)=>{e.exports=r(8716)},9065:(e,t,r)=>{"use strict";const s=r(1603);const{get:a,has:n,find:o}=r(8018);const getSortedObjectPaths=e=>{if(!e){return[]}return s(e).paths().filter((e=>e.length)).map((e=>e.join("."))).sort(((e,t)=>t.length-e.length))};const replaceAndEvaluateNode=(e,t,r)=>{t.replaceWith(e(r));if(t.parentPath.isBinaryExpression()){const r=t.parentPath.evaluate();if(r.confident){t.parentPath.replaceWith(e(r.value))}}};const processNode=(e,t,r,s)=>{const i=o(getSortedObjectPaths(e),(e=>s(t,e)));if(n(e,i)){replaceAndEvaluateNode(r,t,a(e,i))}};const memberExpressionComparator=(e,t)=>e.matchesPattern(t);const identifierComparator=(e,t)=>e.node.name===t;const unaryExpressionComparator=(e,t)=>e.node.argument.name===t;const i="typeof ";const plugin=function({types:e}){return{visitor:{MemberExpression(t,r){processNode(r.opts,t,e.valueToNode,memberExpressionComparator)},Identifier(t,r){processNode(r.opts,t,e.valueToNode,identifierComparator)},UnaryExpression(t,r){if(t.node.operator!=="typeof"){return}const{opts:s}=r;const a=Object.keys(s);const n={};a.forEach((e=>{if(e.substring(0,i.length)===i){n[e.substring(i.length)]=s[e]}}));processNode(n,t,e.valueToNode,unaryExpressionComparator)}}}};e.exports=plugin;e.exports["default"]=plugin;e.exports.getSortedObjectPaths=getSortedObjectPaths},6197:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=_interopRequireDefault(r(7835));var a=_interopRequireDefault(r(4640));var n=_interopRequireDefault(r(346));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectSpread(e){for(var t=1;t1&&arguments[1]!==undefined?arguments[1]:{};var o=n.as,i=o===void 0?"assignmentExpression":o;var l=t.expression('\n process.env.NODE_ENV !== "production" ? RIGHT : {}\n ',{placeholderPattern:/^(LEFT|RIGHT)$/})({RIGHT:a});switch(i){case"variableDeclarator":return r.variableDeclarator(s,l);case"assignmentExpression":return r.assignmentExpression("=",s,l);default:throw new Error("unrecognized template type ".concat(i))}},mode:p.opts.mode||"remove",ignoreFilenames:f,types:r,removeImport:p.opts.removeImport||false,libraries:(p.opts.additionalLibraries||[]).concat("prop-types"),classNameMatchers:d,createReactClassName:p.opts.createReactClassName||"createReactClass"};if(p.opts.plugins){var y=p;var g=p.opts.plugins.map((function(t){var r=typeof t==="string"?t:t[0];if(typeof t!=="string"){y.opts=_objectSpread({},y.opts,t[1])}var s=require(r);if(typeof s!=="function"){s=s.default}return s(e).visitor}));o(u.parent,o.visitors.merge(g),u.scope,y,u.parentPath)}u.traverse({ObjectProperty:{exit:function exit(e){var t=e.node;if(t.computed||t.key.name!=="propTypes"){return}var r=e.findParent((function(e){if(e.type!=="CallExpression"){return false}return e.get("callee").node.name===m.createReactClassName||e.get("callee").node.property&&e.get("callee").node.property.name==="createClass"}));if(r){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"createClass"})}}},ClassProperty:function ClassProperty(e){var t=e.node,r=e.scope;if(t.key.name==="propTypes"){var s=r.path;if(isReactClass(s.get("superClass"),r,m)){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"class static",pathClassDeclaration:s})}}},AssignmentExpression:function AssignmentExpression(e){var t=e.node,r=e.scope;if(t.left.computed||!t.left.property||t.left.property.name!=="propTypes"){return}var o=(0,s.default)(e.node.left);if(o){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"assign"});return}var i=t.left.object.name;var u=r.getBinding(i);if(!u){return}if(u.path.isClassDeclaration()){var p=u.path.get("superClass");if(isReactClass(p,r,m)){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"assign"})}}else if((0,a.default)(u.path)){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"assign"})}}});var h=0;var b={VariableDeclarator:function VariableDeclarator(e){if(e.scope.block.type!=="Program"){return}if(["ObjectPattern","ArrayPattern"].includes(e.node.id.type)){return}var t=e.node.id.name;if(!i.has(t)){return}var r=e.scope.getBinding(t),s=r.referencePaths;var a=s.some((function(e){var t=e.find((function(e){return l.has(e)}));return!t}));if(a){h+=1;return}l.add(e);i.delete(t);e.get("init").traverse(c);(0,n.default)(e,m,{type:"declarator"})}};var x=new Set;while(!areSetsEqual(i,x)&&i.size>0&&h0}));if(!n){e.remove()}}})}else{throw new Error('transform-react-remove-prop-type: removeImport = true and mode != "remove" can not be used at the same time.')}}}}}}},7835:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=isAnnotatedForRemoval;function isAnnotatedForRemoval(e){var t=e.trailingComments||[];return Boolean(t.find((function(e){var t=e.value;return t.trim()==="remove-proptypes"})))}},4640:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=isStatelessComponent;var r=Symbol("traversed");function isJSXElementOrReactCreateElement(e){var t=false;e.traverse({CallExpression:function CallExpression(e){var r=e.get("callee");if(r.matchesPattern("React.createElement")||r.matchesPattern("React.cloneElement")||r.node.name==="cloneElement"){t=true}},JSXElement:function JSXElement(){t=true}});return t}function isReturningJSXElement(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(e.node.init&&e.node.init.body&&isJSXElementOrReactCreateElement(e)){return true}if(t>20){throw new Error("transform-react-remove-prop-type: infinite loop detected.")}var s=false;e.traverse({ReturnStatement:function ReturnStatement(a){if(s){return}var n=a.get("argument");if(!n.node){return}if(isJSXElementOrReactCreateElement(a)){s=true;return}if(n.node.type==="CallExpression"){var o=n.get("callee").node.name;var i=e.scope.getBinding(o);if(!i){return}if(i.path[r]){return}i.path[r]=true;if(isReturningJSXElement(i.path,t+1)){s=true}}}});return s}var s=["VariableDeclarator","FunctionDeclaration"];function isStatelessComponent(e){if(s.indexOf(e.node.type)===-1){return false}if(isReturningJSXElement(e)){return true}return false}},346:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=remove;function isInside(e,t){if(!e.hub.file.opts){return true}var r=e.hub.file.opts.filename;if(!r){return true}if(!t){return false}return t.test(r)}function remove(e,t,r){var s=t.visitedKey,a=t.unsafeWrapTemplate,n=t.wrapTemplate,o=t.mode,i=t.ignoreFilenames,l=t.types;if(i&&isInside(e.scope,i)){return}if(e.node[s]){return}e.node[s]=true;if(o==="remove"){if(e.parentPath.type==="ConditionalExpression"){e.replaceWith(l.unaryExpression("void",l.numericLiteral(0)))}else{e.remove()}return}if(o==="wrap"||o==="unsafe-wrap"){switch(r.type){case"createClass":break;case"class static":{var c;var u=r.pathClassDeclaration;if(!u.isClassExpression()&&u.node.id){c=u.node.id}else{return}var p=l.expressionStatement(l.assignmentExpression("=",l.memberExpression(c,e.node.key),e.node.value));if(u.parentPath.isExportDeclaration()){u=u.parentPath}u.insertAfter(p);e.remove();break}case"assign":if(o==="unsafe-wrap"){e.replaceWith(a({NODE:e.node}))}else{e.replaceWith(n({LEFT:e.node.left,RIGHT:e.node.right}))}e.node[s]=true;break;case"declarator":e.replaceWith(n({LEFT:e.node.id,RIGHT:e.node.init},{as:"variableDeclarator"}));e.node[s]=true;break;default:break}return}throw new Error("transform-react-remove-prop-type: unsupported mode ".concat(o,"."))}},665:(e,t,r)=>{"use strict";const s=r(2971);class Definition{constructor(e,t,r,s,a,n){this.type=e;this.name=t;this.node=r;this.parent=s;this.index=a;this.kind=n}}class ParameterDefinition extends Definition{constructor(e,t,r,a){super(s.Parameter,e,t,null,r,null);this.rest=a}}e.exports={ParameterDefinition:ParameterDefinition,Definition:Definition}},6007:(e,t,r)=>{"use strict";const s=r(9491);const a=r(6988);const n=r(4585);const o=r(4945);const i=r(2971);const l=r(6313).Scope;const c=r(290).i8;function defaultOptions(){return{optimistic:false,directive:false,nodejsScope:false,impliedStrict:false,sourceType:"script",ecmaVersion:5,childVisitorKeys:null,fallback:"iteration"}}function updateDeeply(e,t){function isHashObject(e){return typeof e==="object"&&e instanceof Object&&!(e instanceof Array)&&!(e instanceof RegExp)}for(const r in t){if(Object.prototype.hasOwnProperty.call(t,r)){const s=t[r];if(isHashObject(s)){if(isHashObject(e[r])){updateDeeply(e[r],s)}else{e[r]=updateDeeply({},s)}}else{e[r]=s}}}return e}function analyze(e,t){const r=updateDeeply(defaultOptions(),t);const o=new a(r);const i=new n(r,o);i.visit(e);s(o.__currentScope===null,"currentScope should be null.");return o}e.exports={version:c,Reference:o,Variable:i,Scope:l,ScopeManager:a,analyze:analyze}},4162:(e,t,r)=>{"use strict";const s=r(8350).Syntax;const a=r(1217);function getLast(e){return e[e.length-1]||null}class PatternVisitor extends a.Visitor{static isPattern(e){const t=e.type;return t===s.Identifier||t===s.ObjectPattern||t===s.ArrayPattern||t===s.SpreadElement||t===s.RestElement||t===s.AssignmentPattern}constructor(e,t,r){super(null,e);this.rootPattern=t;this.callback=r;this.assignments=[];this.rightHandNodes=[];this.restElements=[]}Identifier(e){const t=getLast(this.restElements);this.callback(e,{topLevel:e===this.rootPattern,rest:t!==null&&t!==undefined&&t.argument===e,assignments:this.assignments})}Property(e){if(e.computed){this.rightHandNodes.push(e.key)}this.visit(e.value)}ArrayPattern(e){for(let t=0,r=e.elements.length;t{this.rightHandNodes.push(e)}));this.visit(e.callee)}}e.exports=PatternVisitor},4945:e=>{"use strict";const t=1;const r=2;const s=t|r;class Reference{constructor(e,t,r,s,a,n,o){this.identifier=e;this.from=t;this.tainted=false;this.resolved=null;this.flag=r;if(this.isWrite()){this.writeExpr=s;this.partial=n;this.init=o}this.__maybeImplicitGlobal=a}isStatic(){return!this.tainted&&this.resolved&&this.resolved.scope.isStatic()}isWrite(){return!!(this.flag&Reference.WRITE)}isRead(){return!!(this.flag&Reference.READ)}isReadOnly(){return this.flag===Reference.READ}isWriteOnly(){return this.flag===Reference.WRITE}isReadWrite(){return this.flag===Reference.RW}}Reference.READ=t;Reference.WRITE=r;Reference.RW=s;e.exports=Reference},4585:(e,t,r)=>{"use strict";const s=r(8350).Syntax;const a=r(1217);const n=r(4945);const o=r(2971);const i=r(4162);const l=r(665);const c=r(9491);const u=l.ParameterDefinition;const p=l.Definition;function traverseIdentifierInPattern(e,t,r,s){const a=new i(e,t,s);a.visit(t);if(r!==null&&r!==undefined){a.rightHandNodes.forEach(r.visit,r)}}class Importer extends a.Visitor{constructor(e,t){super(null,t.options);this.declaration=e;this.referencer=t}visitImport(e,t){this.referencer.visitPattern(e,(e=>{this.referencer.currentScope().__define(e,new p(o.ImportBinding,e,t,this.declaration,null,null))}))}ImportNamespaceSpecifier(e){const t=e.local||e.id;if(t){this.visitImport(t,e)}}ImportDefaultSpecifier(e){const t=e.local||e.id;this.visitImport(t,e)}ImportSpecifier(e){const t=e.local||e.id;if(e.name){this.visitImport(e.name,e)}else{this.visitImport(t,e)}}}class Referencer extends a.Visitor{constructor(e,t){super(null,e);this.options=e;this.scopeManager=t;this.parent=null;this.isInnerMethodDefinition=false}currentScope(){return this.scopeManager.__currentScope}close(e){while(this.currentScope()&&e===this.currentScope().block){this.scopeManager.__currentScope=this.currentScope().__close(this.scopeManager)}}pushInnerMethodDefinition(e){const t=this.isInnerMethodDefinition;this.isInnerMethodDefinition=e;return t}popInnerMethodDefinition(e){this.isInnerMethodDefinition=e}referencingDefaultValue(e,t,r,s){const a=this.currentScope();t.forEach((t=>{a.__referencing(e,n.WRITE,t.right,r,e!==t.left,s)}))}visitPattern(e,t,r){let s=t;let a=r;if(typeof t==="function"){a=t;s={processRightHandNodes:false}}traverseIdentifierInPattern(this.options,e,s.processRightHandNodes?this:null,a)}visitFunction(e){let t,r;if(e.type===s.FunctionDeclaration){this.currentScope().__define(e.id,new p(o.FunctionName,e.id,e,null,null,null))}if(e.type===s.FunctionExpression&&e.id){this.scopeManager.__nestFunctionExpressionNameScope(e)}this.scopeManager.__nestFunctionScope(e,this.isInnerMethodDefinition);const a=this;function visitPatternCallback(r,s){a.currentScope().__define(r,new u(r,e,t,s.rest));a.referencingDefaultValue(r,s.assignments,null,true)}for(t=0,r=e.params.length;t{this.currentScope().__define(t,new u(t,e,e.params.length,true))}))}if(e.body){if(e.body.type===s.BlockStatement){this.visitChildren(e.body)}else{this.visit(e.body)}}this.close(e)}visitClass(e){if(e.type===s.ClassDeclaration){this.currentScope().__define(e.id,new p(o.ClassName,e.id,e,null,null,null))}this.visit(e.superClass);this.scopeManager.__nestClassScope(e);if(e.id){this.currentScope().__define(e.id,new p(o.ClassName,e.id,e))}this.visit(e.body);this.close(e)}visitProperty(e){let t;if(e.computed){this.visit(e.key)}const r=e.type===s.MethodDefinition;if(r){t=this.pushInnerMethodDefinition(true)}this.visit(e.value);if(r){this.popInnerMethodDefinition(t)}}visitForIn(e){if(e.left.type===s.VariableDeclaration&&e.left.kind!=="var"){this.scopeManager.__nestForScope(e)}if(e.left.type===s.VariableDeclaration){this.visit(e.left);this.visitPattern(e.left.declarations[0].id,(t=>{this.currentScope().__referencing(t,n.WRITE,e.right,null,true,true)}))}else{this.visitPattern(e.left,{processRightHandNodes:true},((t,r)=>{let s=null;if(!this.currentScope().isStrict){s={pattern:t,node:e}}this.referencingDefaultValue(t,r.assignments,s,false);this.currentScope().__referencing(t,n.WRITE,e.right,s,true,false)}))}this.visit(e.right);this.visit(e.body);this.close(e)}visitVariableDeclaration(e,t,r,s){const a=r.declarations[s];const o=a.init;this.visitPattern(a.id,{processRightHandNodes:true},((i,l)=>{e.__define(i,new p(t,i,a,r,s,r.kind));this.referencingDefaultValue(i,l.assignments,null,true);if(o){this.currentScope().__referencing(i,n.WRITE,o,null,!l.topLevel,true)}}))}AssignmentExpression(e){if(i.isPattern(e.left)){if(e.operator==="="){this.visitPattern(e.left,{processRightHandNodes:true},((t,r)=>{let s=null;if(!this.currentScope().isStrict){s={pattern:t,node:e}}this.referencingDefaultValue(t,r.assignments,s,false);this.currentScope().__referencing(t,n.WRITE,e.right,s,!r.topLevel,false)}))}else{this.currentScope().__referencing(e.left,n.RW,e.right)}}else{this.visit(e.left)}this.visit(e.right)}CatchClause(e){this.scopeManager.__nestCatchScope(e);this.visitPattern(e.param,{processRightHandNodes:true},((t,r)=>{this.currentScope().__define(t,new p(o.CatchClause,e.param,e,null,null,null));this.referencingDefaultValue(t,r.assignments,null,true)}));this.visit(e.body);this.close(e)}Program(e){this.scopeManager.__nestGlobalScope(e);if(this.scopeManager.__isNodejsScope()){this.currentScope().isStrict=false;this.scopeManager.__nestFunctionScope(e,false)}if(this.scopeManager.__isES6()&&this.scopeManager.isModule()){this.scopeManager.__nestModuleScope(e)}if(this.scopeManager.isStrictModeSupported()&&this.scopeManager.isImpliedStrict()){this.currentScope().isStrict=true}this.visitChildren(e);this.close(e)}Identifier(e){this.currentScope().__referencing(e)}UpdateExpression(e){if(i.isPattern(e.argument)){this.currentScope().__referencing(e.argument,n.RW,null)}else{this.visitChildren(e)}}MemberExpression(e){this.visit(e.object);if(e.computed){this.visit(e.property)}}Property(e){this.visitProperty(e)}MethodDefinition(e){this.visitProperty(e)}BreakStatement(){}ContinueStatement(){}LabeledStatement(e){this.visit(e.body)}ForStatement(e){if(e.init&&e.init.type===s.VariableDeclaration&&e.init.kind!=="var"){this.scopeManager.__nestForScope(e)}this.visitChildren(e);this.close(e)}ClassExpression(e){this.visitClass(e)}ClassDeclaration(e){this.visitClass(e)}CallExpression(e){if(!this.scopeManager.__ignoreEval()&&e.callee.type===s.Identifier&&e.callee.name==="eval"){this.currentScope().variableScope.__detectEval()}this.visitChildren(e)}BlockStatement(e){if(this.scopeManager.__isES6()){this.scopeManager.__nestBlockScope(e)}this.visitChildren(e);this.close(e)}ThisExpression(){this.currentScope().variableScope.__detectThis()}WithStatement(e){this.visit(e.object);this.scopeManager.__nestWithScope(e);this.visit(e.body);this.close(e)}VariableDeclaration(e){const t=e.kind==="var"?this.currentScope().variableScope:this.currentScope();for(let r=0,s=e.declarations.length;r{"use strict";const s=r(6313);const a=r(9491);const n=s.GlobalScope;const o=s.CatchScope;const i=s.WithScope;const l=s.ModuleScope;const c=s.ClassScope;const u=s.SwitchScope;const p=s.FunctionScope;const f=s.ForScope;const d=s.FunctionExpressionNameScope;const m=s.BlockScope;class ScopeManager{constructor(e){this.scopes=[];this.globalScope=null;this.__nodeToScope=new WeakMap;this.__currentScope=null;this.__options=e;this.__declaredVariables=new WeakMap}__useDirective(){return this.__options.directive}__isOptimistic(){return this.__options.optimistic}__ignoreEval(){return this.__options.ignoreEval}__isNodejsScope(){return this.__options.nodejsScope}isModule(){return this.__options.sourceType==="module"}isImpliedStrict(){return this.__options.impliedStrict}isStrictModeSupported(){return this.__options.ecmaVersion>=5}__get(e){return this.__nodeToScope.get(e)}getDeclaredVariables(e){return this.__declaredVariables.get(e)||[]}acquire(e,t){function predicate(e){if(e.type==="function"&&e.functionExpressionScope){return false}return true}const r=this.__get(e);if(!r||r.length===0){return null}if(r.length===1){return r[0]}if(t){for(let e=r.length-1;e>=0;--e){const t=r[e];if(predicate(t)){return t}}}else{for(let e=0,t=r.length;e=6}}e.exports=ScopeManager},6313:(e,t,r)=>{"use strict";const s=r(8350).Syntax;const a=r(4945);const n=r(2971);const o=r(665).Definition;const i=r(9491);function isStrictScope(e,t,r,a){let n;if(e.upper&&e.upper.isStrict){return true}if(r){return true}if(e.type==="class"||e.type==="module"){return true}if(e.type==="block"||e.type==="switch"){return false}if(e.type==="function"){if(t.type===s.ArrowFunctionExpression&&t.body.type!==s.BlockStatement){return false}if(t.type===s.Program){n=t}else{n=t.body}if(!n){return false}}else if(e.type==="global"){n=t}else{return false}if(a){for(let e=0,t=n.body.length;e0&&s.every(shouldBeStatically)}__staticCloseRef(e){if(!this.__resolve(e)){this.__delegateToUpperScope(e)}}__dynamicCloseRef(e){let t=this;do{t.through.push(e);t=t.upper}while(t)}__globalCloseRef(e){if(this.__shouldStaticallyCloseForGlobal(e)){this.__staticCloseRef(e)}else{this.__dynamicCloseRef(e)}}__close(e){let t;if(this.__shouldStaticallyClose(e)){t=this.__staticCloseRef}else if(this.type!=="global"){t=this.__dynamicCloseRef}else{t=this.__globalCloseRef}for(let e=0,r=this.__left.length;ee.name.range[0]>=r)))}}class ForScope extends Scope{constructor(e,t,r){super(e,"for",t,r,false)}}class ClassScope extends Scope{constructor(e,t,r){super(e,"class",t,r,false)}}e.exports={Scope:Scope,GlobalScope:GlobalScope,ModuleScope:ModuleScope,FunctionExpressionNameScope:FunctionExpressionNameScope,CatchScope:CatchScope,WithScope:WithScope,BlockScope:BlockScope,SwitchScope:SwitchScope,FunctionScope:FunctionScope,ForScope:ForScope,ClassScope:ClassScope}},2971:e=>{"use strict";class Variable{constructor(e,t){this.name=e;this.identifiers=[];this.references=[];this.defs=[];this.tainted=false;this.stack=true;this.scope=t}}Variable.CatchClause="CatchClause";Variable.Parameter="Parameter";Variable.FunctionName="FunctionName";Variable.ClassName="ClassName";Variable.Variable="Variable";Variable.ImportBinding="ImportBinding";Variable.ImplicitGlobalVariable="ImplicitGlobalVariable";e.exports=Variable},1217:(e,t,r)=>{(function(){"use strict";var e=r(165);function isNode(e){if(e==null){return false}return typeof e==="object"&&typeof e.type==="string"}function isProperty(t,r){return(t===e.Syntax.ObjectExpression||t===e.Syntax.ObjectPattern)&&r==="properties"}function Visitor(t,r){r=r||{};this.__visitor=t||this;this.__childVisitorKeys=r.childVisitorKeys?Object.assign({},e.VisitorKeys,r.childVisitorKeys):e.VisitorKeys;if(r.fallback==="iteration"){this.__fallback=Object.keys}else if(typeof r.fallback==="function"){this.__fallback=r.fallback}}Visitor.prototype.visitChildren=function(t){var r,s,a,n,o,i,l;if(t==null){return}r=t.type||e.Syntax.Property;s=this.__childVisitorKeys[r];if(!s){if(this.__fallback){s=this.__fallback(t)}else{throw new Error("Unknown node type "+r+".")}}for(a=0,n=s.length;a{(function clone(e){"use strict";var t,r,s,a,n,o;function deepCopy(e){var t={},r,s;for(r in e){if(e.hasOwnProperty(r)){s=e[r];if(typeof s==="object"&&s!==null){t[r]=deepCopy(s)}else{t[r]=s}}}return t}function upperBound(e,t){var r,s,a,n;s=e.length;a=0;while(s){r=s>>>1;n=a+r;if(t(e[n])){s=r}else{a=n+1;s-=r+1}}return a}t={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ChainExpression:"ChainExpression",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"};s={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]};a={};n={};o={};r={Break:a,Skip:n,Remove:o};function Reference(e,t){this.parent=e;this.key=t}Reference.prototype.replace=function replace(e){this.parent[this.key]=e};Reference.prototype.remove=function remove(){if(Array.isArray(this.parent)){this.parent.splice(this.key,1);return true}else{this.replace(null);return false}};function Element(e,t,r,s){this.node=e;this.path=t;this.wrap=r;this.ref=s}function Controller(){}Controller.prototype.path=function path(){var e,t,r,s,a,n;function addToPath(e,t){if(Array.isArray(t)){for(r=0,s=t.length;r=0;--r){if(e[r].node===t){return true}}return false}Controller.prototype.traverse=function traverse(e,t){var r,s,o,i,l,c,u,p,f,d,m,y;this.__initialize(e,t);y={};r=this.__worklist;s=this.__leavelist;r.push(new Element(e,null,null,null));s.push(new Element(null,null,null,null));while(r.length){o=r.pop();if(o===y){o=s.pop();c=this.__execute(t.leave,o);if(this.__state===a||c===a){return}continue}if(o.node){c=this.__execute(t.enter,o);if(this.__state===a||c===a){return}r.push(y);s.push(o);if(this.__state===n||c===n){continue}i=o.node;l=i.type||o.wrap;d=this.__keys[l];if(!d){if(this.__fallback){d=this.__fallback(i)}else{throw new Error("Unknown node type "+l+".")}}p=d.length;while((p-=1)>=0){u=d[p];m=i[u];if(!m){continue}if(Array.isArray(m)){f=m.length;while((f-=1)>=0){if(!m[f]){continue}if(candidateExistsInLeaveList(s,m[f])){continue}if(isProperty(l,d[p])){o=new Element(m[f],[u,f],"Property",null)}else if(isNode(m[f])){o=new Element(m[f],[u,f],null,null)}else{continue}r.push(o)}}else if(isNode(m)){if(candidateExistsInLeaveList(s,m)){continue}r.push(new Element(m,u,null,null))}}}}};Controller.prototype.replace=function replace(e,t){var r,s,i,l,c,u,p,f,d,m,y,g,h;function removeElem(e){var t,s,a,n;if(e.ref.remove()){s=e.ref.key;n=e.ref.parent;t=r.length;while(t--){a=r[t];if(a.ref&&a.ref.parent===n){if(a.ref.key=0){h=d[p];m=i[h];if(!m){continue}if(Array.isArray(m)){f=m.length;while((f-=1)>=0){if(!m[f]){continue}if(isProperty(l,d[p])){u=new Element(m[f],[h,f],"Property",new Reference(m,f))}else if(isNode(m[f])){u=new Element(m[f],[h,f],null,new Reference(m,f))}else{continue}r.push(u)}}else if(isNode(m)){r.push(new Element(m,h,null,new Reference(i,h)))}}}return g.root};function traverse(e,t){var r=new Controller;return r.traverse(e,t)}function replace(e,t){var r=new Controller;return r.replace(e,t)}function extendCommentRange(e,t){var r;r=upperBound(t,(function search(t){return t.range[0]>e.range[0]}));e.extendedRange=[e.range[0],e.range[1]];if(r!==t.length){e.extendedRange[1]=t[r].range[0]}r-=1;if(r>=0){e.extendedRange[0]=t[r].range[1]}return e}function attachComments(e,t,s){var a=[],n,o,i,l;if(!e.range){throw new Error("attachComments needs range information")}if(!s.length){if(t.length){for(i=0,o=t.length;ie.range[0]){break}if(t.extendedRange[1]===e.range[0]){if(!e.leadingComments){e.leadingComments=[]}e.leadingComments.push(t);a.splice(l,1)}else{l+=1}}if(l===a.length){return r.Break}if(a[l].extendedRange[0]>e.range[1]){return r.Skip}}});l=0;traverse(e,{leave:function(e){var t;while(le.range[1]){return r.Skip}}});return e}e.Syntax=t;e.traverse=traverse;e.replace=replace;e.attachComments=attachComments;e.VisitorKeys=s;e.VisitorOption=r;e.Controller=Controller;e.cloneEnvironment=function(){return clone({})};return e})(t)},8350:(e,t,r)=>{(function clone(e){"use strict";var t,s,a,n,o,i;function deepCopy(e){var t={},r,s;for(r in e){if(e.hasOwnProperty(r)){s=e[r];if(typeof s==="object"&&s!==null){t[r]=deepCopy(s)}else{t[r]=s}}}return t}function upperBound(e,t){var r,s,a,n;s=e.length;a=0;while(s){r=s>>>1;n=a+r;if(t(e[n])){s=r}else{a=n+1;s-=r+1}}return a}t={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"};a={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]};n={};o={};i={};s={Break:n,Skip:o,Remove:i};function Reference(e,t){this.parent=e;this.key=t}Reference.prototype.replace=function replace(e){this.parent[this.key]=e};Reference.prototype.remove=function remove(){if(Array.isArray(this.parent)){this.parent.splice(this.key,1);return true}else{this.replace(null);return false}};function Element(e,t,r,s){this.node=e;this.path=t;this.wrap=r;this.ref=s}function Controller(){}Controller.prototype.path=function path(){var e,t,r,s,a,n;function addToPath(e,t){if(Array.isArray(t)){for(r=0,s=t.length;r=0){u=d[p];m=i[u];if(!m){continue}if(Array.isArray(m)){f=m.length;while((f-=1)>=0){if(!m[f]){continue}if(isProperty(l,d[p])){a=new Element(m[f],[u,f],"Property",null)}else if(isNode(m[f])){a=new Element(m[f],[u,f],null,null)}else{continue}r.push(a)}}else if(isNode(m)){r.push(new Element(m,u,null,null))}}}}};Controller.prototype.replace=function replace(e,t){var r,s,a,l,c,u,p,f,d,m,y,g,h;function removeElem(e){var t,s,a,n;if(e.ref.remove()){s=e.ref.key;n=e.ref.parent;t=r.length;while(t--){a=r[t];if(a.ref&&a.ref.parent===n){if(a.ref.key=0){h=d[p];m=a[h];if(!m){continue}if(Array.isArray(m)){f=m.length;while((f-=1)>=0){if(!m[f]){continue}if(isProperty(l,d[p])){u=new Element(m[f],[h,f],"Property",new Reference(m,f))}else if(isNode(m[f])){u=new Element(m[f],[h,f],null,new Reference(m,f))}else{continue}r.push(u)}}else if(isNode(m)){r.push(new Element(m,h,null,new Reference(a,h)))}}}return g.root};function traverse(e,t){var r=new Controller;return r.traverse(e,t)}function replace(e,t){var r=new Controller;return r.replace(e,t)}function extendCommentRange(e,t){var r;r=upperBound(t,(function search(t){return t.range[0]>e.range[0]}));e.extendedRange=[e.range[0],e.range[1]];if(r!==t.length){e.extendedRange[1]=t[r].range[0]}r-=1;if(r>=0){e.extendedRange[0]=t[r].range[1]}return e}function attachComments(e,t,r){var a=[],n,o,i,l;if(!e.range){throw new Error("attachComments needs range information")}if(!r.length){if(t.length){for(i=0,o=t.length;ie.range[0]){break}if(t.extendedRange[1]===e.range[0]){if(!e.leadingComments){e.leadingComments=[]}e.leadingComments.push(t);a.splice(l,1)}else{l+=1}}if(l===a.length){return s.Break}if(a[l].extendedRange[0]>e.range[1]){return s.Skip}}});l=0;traverse(e,{leave:function(e){var t;while(le.range[1]){return s.Skip}}});return e}e.version=r(5535).i8;e.Syntax=t;e.traverse=traverse;e.replace=replace;e.attachComments=attachComments;e.VisitorKeys=a;e.VisitorOption=s;e.Controller=Controller;e.cloneEnvironment=function(){return clone({})};return e})(t)},9733:e=>{"use strict";var t="Function.prototype.bind called on incompatible ";var r=Array.prototype.slice;var s=Object.prototype.toString;var a="[object Function]";e.exports=function bind(e){var n=this;if(typeof n!=="function"||s.call(n)!==a){throw new TypeError(t+n)}var o=r.call(arguments,1);var i;var binder=function(){if(this instanceof i){var t=n.apply(this,o.concat(r.call(arguments)));if(Object(t)===t){return t}return this}else{return n.apply(e,o.concat(r.call(arguments)))}};var l=Math.max(0,n.length-o.length);var c=[];for(var u=0;u{"use strict";var s=r(9733);e.exports=Function.prototype.bind||s},5548:(e,t,r)=>{"use strict";e.exports=r(964)},793:(e,t,r)=>{"use strict";var s=r(4517);e.exports=s.call(Function.call,Object.prototype.hasOwnProperty)},8746:(e,t,r)=>{"use strict";var s=r(793);function specifierIncluded(e,t){var r=e.split(".");var s=t.split(" ");var a=s.length>1?s[0]:"=";var n=(s.length>1?s[1]:s[0]).split(".");for(var o=0;o<3;++o){var i=parseInt(r[o]||0,10);var l=parseInt(n[o]||0,10);if(i===l){continue}if(a==="<"){return i="){return i>=l}return false}return a===">="}function matchesRange(e,t){var r=t.split(/ ?&& ?/);if(r.length===0){return false}for(var s=0;s{Object.defineProperty(t,"__esModule",{value:true});t["default"]=/((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;t.matchToToken=function(e){var t={type:"invalid",value:e[0],closed:undefined};if(e[1])t.type="string",t.closed=!!(e[3]||e[4]);else if(e[5])t.type="comment";else if(e[6])t.type="comment",t.closed=!!e[7];else if(e[8])t.type="regex";else if(e[9])t.type="number";else if(e[10])t.type="name";else if(e[11])t.type="punctuator";else if(e[12])t.type="whitespace";return t}},6240:e=>{var t="Expected a function";var r=0/0;var s="[object Symbol]";var a=/^\s+|\s+$/g;var n=/^[-+]0x[0-9a-f]+$/i;var o=/^0b[01]+$/i;var i=/^0o[0-7]+$/i;var l=parseInt;var c=typeof global=="object"&&global&&global.Object===Object&&global;var u=typeof self=="object"&&self&&self.Object===Object&&self;var p=c||u||Function("return this")();var f=Object.prototype;var d=f.toString;var m=Math.max,y=Math.min;var now=function(){return p.Date.now()};function debounce(e,r,s){var a,n,o,i,l,c,u=0,p=false,f=false,d=true;if(typeof e!="function"){throw new TypeError(t)}r=toNumber(r)||0;if(isObject(s)){p=!!s.leading;f="maxWait"in s;o=f?m(toNumber(s.maxWait)||0,r):o;d="trailing"in s?!!s.trailing:d}function invokeFunc(t){var r=a,s=n;a=n=undefined;u=t;i=e.apply(s,r);return i}function leadingEdge(e){u=e;l=setTimeout(timerExpired,r);return p?invokeFunc(e):i}function remainingWait(e){var t=e-c,s=e-u,a=r-t;return f?y(a,o-s):a}function shouldInvoke(e){var t=e-c,s=e-u;return c===undefined||t>=r||t<0||f&&s>=o}function timerExpired(){var e=now();if(shouldInvoke(e)){return trailingEdge(e)}l=setTimeout(timerExpired,remainingWait(e))}function trailingEdge(e){l=undefined;if(d&&a){return invokeFunc(e)}a=n=undefined;return i}function cancel(){if(l!==undefined){clearTimeout(l)}u=0;a=c=n=l=undefined}function flush(){return l===undefined?i:trailingEdge(now())}function debounced(){var e=now(),t=shouldInvoke(e);a=arguments;n=this;c=e;if(t){if(l===undefined){return leadingEdge(c)}if(f){l=setTimeout(timerExpired,r);return invokeFunc(c)}}if(l===undefined){l=setTimeout(timerExpired,r)}return i}debounced.cancel=cancel;debounced.flush=flush;return debounced}function isObject(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function isObjectLike(e){return!!e&&typeof e=="object"}function isSymbol(e){return typeof e=="symbol"||isObjectLike(e)&&d.call(e)==s}function toNumber(e){if(typeof e=="number"){return e}if(isSymbol(e)){return r}if(isObject(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=isObject(t)?t+"":t}if(typeof e!="string"){return e===0?e:+e}e=e.replace(a,"");var s=o.test(e);return s||i.test(e)?l(e.slice(2),s?2:8):n.test(e)?r:+e}e.exports=debounce},8018:function(e,t,r){e=r.nmd(e); + `,...r.expressions]))},TemplateLiteral(e){const t=[];const r=e.get("expressions");let s=0;for(const n of e.node.quasis){if(n.value.cooked){t.push(a.types.stringLiteral(n.value.cooked))}if(s1){o=buildConcatCallExpressions(t)}e.replaceWith(o)}}}}));t["default"]=n},9116:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5502:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9001);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-typeof-symbol",visitor:{Scope({scope:e}){if(!e.getBinding("Symbol")){return}e.rename("Symbol")},UnaryExpression(e){const{node:t,parent:r}=e;if(t.operator!=="typeof")return;if(e.parentPath.isBinaryExpression()&&a.types.EQUALITY_BINARY_OPERATORS.indexOf(r.operator)>=0){const t=e.getOpposite();if(t.isLiteral()&&t.node.value!=="symbol"&&t.node.value!=="object"){return}}let s=e.findParent((e=>{if(e.isFunction()){var t;return((t=e.get("body.directives.0"))==null?void 0:t.node.value.value)==="@babel/helpers - typeof"}}));if(s)return;const n=this.addHelper("typeof");s=e.findParent((e=>e.isVariableDeclarator()&&e.node.id===n||e.isFunctionDeclaration()&&e.node.id&&e.node.id.name===n.name));if(s){return}const o=a.types.callExpression(n,[t.argument]);const i=e.get("argument");if(i.isIdentifier()&&!e.scope.hasBinding(i.node.name,true)){const r=a.types.unaryExpression("typeof",a.types.cloneNode(t.argument));e.replaceWith(a.types.conditionalExpression(a.types.binaryExpression("===",r,a.types.stringLiteral("undefined")),a.types.stringLiteral("undefined"),o))}else{e.replaceWith(o)}}}}}));t["default"]=n},9001:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},3448:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(728);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);const t=/[\ud800-\udfff]/g;const r=/(\\+)u\{([0-9a-fA-F]+)\}/g;function escape(e){let t=e.toString(16);while(t.length<4)t="0"+t;return"\\u"+t}function replacer(e,t,r){if(t.length%2===0){return e}const s=String.fromCodePoint(parseInt(r,16));const a=t.slice(0,-1)+escape(s.charCodeAt(0));return s.length===1?a:a+escape(s.charCodeAt(1))}function replaceUnicodeEscapes(e){return e.replace(r,replacer)}function getUnicodeEscape(e){let t;while(t=r.exec(e)){if(t[1].length%2===0)continue;r.lastIndex=0;return t[0]}return null}return{name:"transform-unicode-escapes",manipulateOptions({generatorOpts:e}){var t,r;if(!e.jsescOption){e.jsescOption={}}(r=(t=e.jsescOption).minimal)!=null?r:t.minimal=false},visitor:{Identifier(e){const{node:r,key:s}=e;const{name:n}=r;const o=n.replace(t,(e=>`_u${e.charCodeAt(0).toString(16)}`));if(n===o)return;const i=a.types.inherits(a.types.stringLiteral(n),r);if(s==="key"){e.replaceWith(i);return}const{parentPath:l,scope:c}=e;if(l.isMemberExpression({property:r})||l.isOptionalMemberExpression({property:r})){l.node.computed=true;e.replaceWith(i);return}const u=c.getBinding(n);if(u){c.rename(n,c.generateUid(o));return}throw e.buildCodeFrameError(`Can't reference '${n}' as a bare identifier`)},"StringLiteral|DirectiveLiteral"(e){const{node:t}=e;const{extra:r}=t;if(r!=null&&r.raw)r.raw=replaceUnicodeEscapes(r.raw)},TemplateElement(e){const{node:t,parentPath:r}=e;const{value:s}=t;const a=getUnicodeEscape(s.raw);if(!a)return;const n=r.parentPath;if(n.isTaggedTemplateExpression()){throw e.buildCodeFrameError(`Can't replace Unicode escape '${a}' inside tagged template literals. You can enable '@babel/plugin-transform-template-literals' to compile them to classic strings.`)}s.raw=replaceUnicodeEscapes(s.raw)}}}}));t["default"]=n},728:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},4122:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6550);var a=r(836);var n=(0,a.declare)((e=>{e.assertVersion(7);return(0,s.createRegExpFeaturePlugin)({name:"transform-unicode-regex",feature:"unicodeFlag"})}));t["default"]=n},836:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9453:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;const r={allowInsertArrow:false,specCompliant:false};var _default=({types:e})=>({name:"transform-async-arrows-in-class",visitor:{ArrowFunctionExpression(t){if(t.node.async&&t.findParent(e.isClassMethod)){t.arrowFunctionToExpression(r)}}}});t["default"]=_default;e.exports=t.default},489:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;var _default=({types:e})=>{const isArrowParent=t=>t.parentKey==="params"&&t.parentPath&&e.isArrowFunctionExpression(t.parentPath);return{name:"transform-edge-default-parameters",visitor:{AssignmentPattern(e){const t=e.find(isArrowParent);if(t&&e.parent.shorthand){e.parent.shorthand=false;(e.parent.extra||{}).shorthand=false;e.scope.rename(e.parent.key.name)}}}}};t["default"]=_default;e.exports=t.default},3258:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;var _default=({types:e})=>({name:"transform-edge-function-name",visitor:{FunctionExpression:{exit(t){if(!t.node.id&&e.isIdentifier(t.parent.id)){const r=e.cloneNode(t.parent.id);const s=t.scope.getBinding(r.name);if(s==null?void 0:s.constantViolations.length){t.scope.rename(r.name)}t.node.id=r}}}}});t["default"]=_default;e.exports=t.default},5899:(e,t)=>{"use strict";t.__esModule=true;t["default"]=_default;function _default({types:e}){return{name:"transform-safari-block-shadowing",visitor:{VariableDeclarator(t){const r=t.parent.kind;if(r!=="let"&&r!=="const")return;const s=t.scope.block;if(e.isFunction(s)||e.isProgram(s))return;const a=e.getOuterBindingIdentifiers(t.node.id);for(const r of Object.keys(a)){let s=t.scope;if(!s.hasOwnBinding(r))continue;while(s=s.parent){if(s.hasOwnBinding(r)){t.scope.rename(r);break}if(e.isFunction(s.block)||e.isProgram(s.block)){break}}}}}}}e.exports=t.default},6668:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;function handle(e){if(!e.isVariableDeclaration())return;const t=e.getFunctionParent();const{name:r}=e.node.declarations[0].id;if(t&&t.scope.hasOwnBinding(r)&&t.scope.getOwnBinding(r).kind==="param"){e.scope.rename(r)}}var _default=()=>({name:"transform-safari-for-shadowing",visitor:{ForXStatement(e){handle(e.get("left"))},ForStatement(e){handle(e.get("init"))}}});t["default"]=_default;e.exports=t.default},3744:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;var _default=({types:e})=>({name:"transform-tagged-template-caching",visitor:{TaggedTemplateExpression(t,r){let s=r.get("processed");if(!s){s=new Map;r.set("processed",s)}if(s.has(t.node))return t.skip();const a=t.node.quasi.expressions;let n=r.get("identity");if(!n){n=t.scope.getProgramParent().generateDeclaredUidIdentifier("_");r.set("identity",n);const s=t.scope.getBinding(n.name);s.path.get("init").replaceWith(e.arrowFunctionExpression([e.identifier("t")],e.identifier("t")))}const o=e.taggedTemplateExpression(n,e.templateLiteral(t.node.quasi.quasis,a.map((()=>e.numericLiteral(0)))));s.set(o,true);const i=t.scope.getProgramParent().generateDeclaredUidIdentifier("t");t.scope.getBinding(i.name).path.parent.kind="let";const l=e.logicalExpression("||",i,e.assignmentExpression("=",i,o));const c=e.callExpression(t.node.tag,[l,...a]);t.replaceWith(c)}}});t["default"]=_default;e.exports=t.default},8277:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(7534);var a=r(7420);var n=r(9833);var o=r(2625);var i=r(496);var l=r(7347);function _interopDefaultLegacy(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var c=_interopDefaultLegacy(a);var u=_interopDefaultLegacy(n);var p=_interopDefaultLegacy(o);var d=_interopDefaultLegacy(i);new l.OptionValidator("@babel/preset-react");function normalizeOptions(e={}){{let{pragma:t,pragmaFrag:r}=e;const{pure:s,throwIfNamespace:a=true,runtime:n="classic",importSource:o,useBuiltIns:i,useSpread:l}=e;if(n==="classic"){t=t||"React.createElement";r=r||"React.Fragment"}const c=!!e.development;return{development:c,importSource:o,pragma:t,pragmaFrag:r,pure:s,runtime:n,throwIfNamespace:a,useBuiltIns:i,useSpread:l}}}var f=s.declare(((e,t)=>{e.assertVersion(7);const{development:r,importSource:s,pragma:a,pragmaFrag:n,pure:o,runtime:i,throwIfNamespace:l}=normalizeOptions(t);return{plugins:[[r?u["default"]:c["default"],{importSource:s,pragma:a,pragmaFrag:n,runtime:i,throwIfNamespace:l,pure:o,useBuiltIns:!!t.useBuiltIns,useSpread:t.useSpread}],p["default"],o!==false&&d["default"]].filter(Boolean)}}));t["default"]=f},7534:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7005:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=createPlugin;var s=r(8926);var a=r(7534);var n=r(8304);var o=r(6039);var i=r(2155);const l={importSource:"react",runtime:"automatic",pragma:"React.createElement",pragmaFrag:"React.Fragment"};const c=/\*?\s*@jsxImportSource\s+([^\s]+)/;const u=/\*?\s*@jsxRuntime\s+([^\s]+)/;const p=/\*?\s*@jsx\s+([^\s]+)/;const d=/\*?\s*@jsxFrag\s+([^\s]+)/;const get=(e,t)=>e.get(`@babel/plugin-react-jsx/${t}`);const set=(e,t,r)=>e.set(`@babel/plugin-react-jsx/${t}`,r);function createPlugin({name:e,development:t}){return(0,a.declare)(((r,a)=>{const{pure:o,throwIfNamespace:f=true,filter:m,runtime:y=(t?"automatic":"classic"),importSource:g=l.importSource,pragma:h=l.pragma,pragmaFrag:b=l.pragmaFrag}=a;{var{useSpread:x=false,useBuiltIns:v=false}=a;if(y==="classic"){if(typeof x!=="boolean"){throw new Error("transform-react-jsx currently only accepts a boolean option for "+"useSpread (defaults to false)")}if(typeof v!=="boolean"){throw new Error("transform-react-jsx currently only accepts a boolean option for "+"useBuiltIns (defaults to false)")}if(x&&v){throw new Error("transform-react-jsx currently only accepts useBuiltIns or useSpread "+"but not both")}}}const E={JSXOpeningElement(e,t){for(const t of e.get("attributes")){if(!t.isJSXElement())continue;const{name:r}=t.node.name;if(r==="__source"||r==="__self"){throw e.buildCodeFrameError(`__source and __self should not be defined in props and are reserved for internal usage.`)}}const r=n.types.jsxAttribute(n.types.jsxIdentifier("__self"),n.types.jsxExpressionContainer(n.types.thisExpression()));const s=n.types.jsxAttribute(n.types.jsxIdentifier("__source"),n.types.jsxExpressionContainer(makeSource(e,t)));e.pushContainer("attributes",[r,s])}};return{name:e,inherits:s.default,visitor:{JSXNamespacedName(e){if(f){throw e.buildCodeFrameError(`Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can set \`throwIfNamespace: false\` to bypass this warning.`)}},JSXSpreadChild(e){throw e.buildCodeFrameError("Spread children are not supported in React.")},Program:{enter(e,r){const{file:s}=r;let o=y;let i=g;let f=h;let m=b;let x=!!a.importSource;let v=!!a.pragma;let j=!!a.pragmaFrag;if(s.ast.comments){for(const e of s.ast.comments){const t=c.exec(e.value);if(t){i=t[1];x=true}const r=u.exec(e.value);if(r){o=r[1]}const s=p.exec(e.value);if(s){f=s[1];v=true}const a=d.exec(e.value);if(a){m=a[1];j=true}}}set(r,"runtime",o);if(o==="classic"){if(x){throw e.buildCodeFrameError(`importSource cannot be set when runtime is classic.`)}const t=toMemberExpression(f);const s=toMemberExpression(m);set(r,"id/createElement",(()=>n.types.cloneNode(t)));set(r,"id/fragment",(()=>n.types.cloneNode(s)));set(r,"defaultPure",f===l.pragma)}else if(o==="automatic"){if(v||j){throw e.buildCodeFrameError(`pragma and pragmaFrag cannot be set when runtime is automatic.`)}const define=(t,s)=>set(r,t,createImportLazily(r,e,s,i));define("id/jsx",t?"jsxDEV":"jsx");define("id/jsxs",t?"jsxDEV":"jsxs");define("id/createElement","createElement");define("id/fragment","Fragment");set(r,"defaultPure",i===l.importSource)}else{throw e.buildCodeFrameError(`Runtime must be either "classic" or "automatic".`)}if(t){e.traverse(E,r)}}},JSXElement:{exit(e,t){let r;if(get(t,"runtime")==="classic"||shouldUseCreateElement(e)){r=buildCreateElementCall(e,t)}else{r=buildJSXElementCall(e,t)}e.replaceWith(n.types.inherits(r,e.node))}},JSXFragment:{exit(e,t){let r;if(get(t,"runtime")==="classic"){r=buildCreateElementFragmentCall(e,t)}else{r=buildJSXFragmentCall(e,t)}e.replaceWith(n.types.inherits(r,e.node))}},JSXAttribute(e){if(n.types.isJSXElement(e.node.value)){e.node.value=n.types.jsxExpressionContainer(e.node.value)}}}};function call(e,t,r){const s=n.types.callExpression(get(e,`id/${t}`)(),r);if(o!=null?o:get(e,"defaultPure"))(0,i.default)(s);return s}function shouldUseCreateElement(e){const t=e.get("openingElement");const r=t.node.attributes;let s=false;for(let e=0;e1){t=n.types.arrayExpression(e)}else{return undefined}return n.types.objectProperty(n.types.identifier("children"),t)}function buildJSXElementCall(e,r){const s=e.get("openingElement");const a=[getTag(s)];const o=[];const i=Object.create(null);for(const t of s.get("attributes")){if(t.isJSXAttribute()&&n.types.isJSXIdentifier(t.node.name)){const{name:r}=t.node.name;switch(r){case"__source":case"__self":if(i[r])throw sourceSelfError(e,r);case"key":{const e=convertAttributeValue(t.node.value);if(e===null){throw t.buildCodeFrameError('Please provide an explicit key value. Using "key" as a shorthand for "key={true}" is not allowed.')}i[r]=e;break}default:o.push(t)}}else{o.push(t)}}const l=n.types.react.buildChildren(e.node);let c;if(o.length||l.length){c=buildJSXOpeningElementAttributes(o,r,l)}else{c=n.types.objectExpression([])}a.push(c);if(t){var u,p,d;a.push((u=i.key)!=null?u:e.scope.buildUndefinedNode(),n.types.booleanLiteral(l.length>1),(p=i.__source)!=null?p:e.scope.buildUndefinedNode(),(d=i.__self)!=null?d:n.types.thisExpression())}else if(i.key!==undefined){a.push(i.key)}return call(r,l.length>1?"jsxs":"jsx",a)}function buildJSXOpeningElementAttributes(e,t,r){const s=e.reduce(accumulateAttribute,[]);if((r==null?void 0:r.length)>0){s.push(buildChildrenProperty(r))}return n.types.objectExpression(s)}function buildJSXFragmentCall(e,r){const s=[get(r,"id/fragment")()];const a=n.types.react.buildChildren(e.node);s.push(n.types.objectExpression(a.length>0?[buildChildrenProperty(a)]:[]));if(t){s.push(e.scope.buildUndefinedNode(),n.types.booleanLiteral(a.length>1))}return call(r,a.length>1?"jsxs":"jsx",s)}function buildCreateElementFragmentCall(e,t){if(m&&!m(e.node,t))return;return call(t,"createElement",[get(t,"id/fragment")(),n.types.nullLiteral(),...n.types.react.buildChildren(e.node)])}function buildCreateElementCall(e,t){const r=e.get("openingElement");return call(t,"createElement",[getTag(r),buildCreateElementOpeningElementAttributes(t,e,r.get("attributes")),...n.types.react.buildChildren(e.node)])}function getTag(e){const t=convertJSXIdentifier(e.node.name,e.node);let r;if(n.types.isIdentifier(t)){r=t.name}else if(n.types.isLiteral(t)){r=t.value}if(n.types.react.isCompatTag(r)){return n.types.stringLiteral(r)}else{return t}}function buildCreateElementOpeningElementAttributes(e,t,r){const s=get(e,"runtime");{if(s!=="automatic"){const t=[];const s=r.reduce(accumulateAttribute,[]);if(!x){let e=0;s.forEach(((r,a)=>{if(n.types.isSpreadElement(r)){if(a>e){t.push(n.types.objectExpression(s.slice(e,a)))}t.push(r.argument);e=a+1}}));if(s.length>e){t.push(n.types.objectExpression(s.slice(e)))}}else if(s.length){t.push(n.types.objectExpression(s))}if(!t.length){return n.types.nullLiteral()}if(t.length===1){return t[0]}if(!n.types.isObjectExpression(t[0])){t.unshift(n.types.objectExpression([]))}const a=v?n.types.memberExpression(n.types.identifier("Object"),n.types.identifier("assign")):e.addHelper("extends");return n.types.callExpression(a,t)}}const a=[];const o=Object.create(null);for(const e of r){const r=n.types.isJSXAttribute(e)&&n.types.isJSXIdentifier(e.name)&&e.name.name;if(s==="automatic"&&(r==="__source"||r==="__self")){if(o[r])throw sourceSelfError(t,r);o[r]=true}accumulateAttribute(a,e)}return a.length===1&&n.types.isSpreadElement(a[0])?a[0].argument:a.length>0?n.types.objectExpression(a):n.types.nullLiteral()}}));function getSource(e,r){switch(r){case"Fragment":return`${e}/${t?"jsx-dev-runtime":"jsx-runtime"}`;case"jsxDEV":return`${e}/jsx-dev-runtime`;case"jsx":case"jsxs":return`${e}/jsx-runtime`;case"createElement":return e}}function createImportLazily(e,t,r,s){return()=>{const a=getSource(s,r);if((0,o.isModule)(t)){let s=get(e,`imports/${r}`);if(s)return n.types.cloneNode(s);s=(0,o.addNamed)(t,r,a,{importedInterop:"uncompiled",importPosition:"after"});set(e,`imports/${r}`,s);return s}else{let s=get(e,`requires/${a}`);if(s){s=n.types.cloneNode(s)}else{s=(0,o.addNamespace)(t,a,{importedInterop:"uncompiled"});set(e,`requires/${a}`,s)}return n.types.memberExpression(s,n.types.identifier(r))}}}}function toMemberExpression(e){return e.split(".").map((e=>n.types.identifier(e))).reduce(((e,t)=>n.types.memberExpression(e,t)))}function makeSource(e,t){const r=e.node.loc;if(!r){return e.scope.buildUndefinedNode()}if(!t.fileNameIdentifier){const{filename:r=""}=t;const s=e.scope.generateUidIdentifier("_jsxFileName");const a=e.hub.getScope();if(a){a.push({id:s,init:n.types.stringLiteral(r)})}t.fileNameIdentifier=s}return makeTrace(n.types.cloneNode(t.fileNameIdentifier),r.start.line,r.start.column)}function makeTrace(e,t,r){const s=t!=null?n.types.numericLiteral(t):n.types.nullLiteral();const a=r!=null?n.types.numericLiteral(r+1):n.types.nullLiteral();const o=n.types.objectProperty(n.types.identifier("fileName"),e);const i=n.types.objectProperty(n.types.identifier("lineNumber"),s);const l=n.types.objectProperty(n.types.identifier("columnNumber"),a);return n.types.objectExpression([o,i,l])}function sourceSelfError(e,t){const r=`transform-react-jsx-${t.slice(2)}`;return e.buildCodeFrameError(`Duplicate ${t} prop found. You are most likely using the deprecated ${r} Babel plugin. Both __source and __self are automatically set when using the automatic runtime. Please remove transform-react-jsx-source and transform-react-jsx-self from your Babel config.`)}},7420:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(7005);var a=(0,s.default)({name:"transform-react-jsx",development:false});t["default"]=a},6919:e=>{function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}e.exports=_interopRequireDefault},449:(e,t,r)=>{var s=r(2810);function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function _getRequireWildcardCache(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||s(e)!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e){if(Object.prototype.hasOwnProperty.call(e,n)){var o=a?Object.getOwnPropertyDescriptor(e,n):null;if(o&&(o.get||o.set)){Object.defineProperty(r,n,o)}else{r[n]=e[n]}}}r["default"]=e;if(t){t.set(e,r)}return r}e.exports=_interopRequireWildcard},2810:e=>{function _typeof(t){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){e.exports=_typeof=function _typeof(e){return typeof e}}else{e.exports=_typeof=function _typeof(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}}return _typeof(t)}e.exports=_typeof},4309:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=createTemplateBuilder;var s=r(4578);var a=r(351);var n=r(5932);const o=(0,s.validate)({placeholderPattern:false});function createTemplateBuilder(e,t){const r=new WeakMap;const i=new WeakMap;const l=t||(0,s.validate)(null);return Object.assign(((t,...o)=>{if(typeof t==="string"){if(o.length>1)throw new Error("Unexpected extra params.");return extendedTrace((0,a.default)(e,t,(0,s.merge)(l,(0,s.validate)(o[0]))))}else if(Array.isArray(t)){let s=r.get(t);if(!s){s=(0,n.default)(e,t,l);r.set(t,s)}return extendedTrace(s(o))}else if(typeof t==="object"&&t){if(o.length>0)throw new Error("Unexpected extra params.");return createTemplateBuilder(e,(0,s.merge)(l,(0,s.validate)(t)))}throw new Error(`Unexpected template param ${typeof t}`)}),{ast:(t,...r)=>{if(typeof t==="string"){if(r.length>1)throw new Error("Unexpected extra params.");return(0,a.default)(e,t,(0,s.merge)((0,s.merge)(l,(0,s.validate)(r[0])),o))()}else if(Array.isArray(t)){let a=i.get(t);if(!a){a=(0,n.default)(e,t,(0,s.merge)(l,o));i.set(t,a)}return a(r)()}throw new Error(`Unexpected template param ${typeof t}`)}})}function extendedTrace(e){let t="";try{throw new Error}catch(e){if(e.stack){t=e.stack.split("\n").slice(3).join("\n")}}return r=>{try{return e(r)}catch(e){e.stack+=`\n =============\n${t}`;throw e}}}},7522:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.program=t.expression=t.statement=t.statements=t.smart=void 0;var s=r(8622);function makeStatementFormatter(e){return{code:e=>`/* @babel/template */;\n${e}`,validate:()=>{},unwrap:t=>e(t.program.body.slice(1))}}const a=makeStatementFormatter((e=>{if(e.length>1){return e}else{return e[0]}}));t.smart=a;const n=makeStatementFormatter((e=>e));t.statements=n;const o=makeStatementFormatter((e=>{if(e.length===0){throw new Error("Found nothing to return.")}if(e.length>1){throw new Error("Found multiple statements but wanted one")}return e[0]}));t.statement=o;const i={code:e=>`(\n${e}\n)`,validate:e=>{if(e.program.body.length>1){throw new Error("Found multiple statements but wanted one")}if(i.unwrap(e).start===0){throw new Error("Parse result included parens.")}},unwrap:({program:e})=>{const[t]=e.body;s.assertExpressionStatement(t);return t.expression}};t.expression=i;const l={code:e=>e,validate:()=>{},unwrap:e=>e.program};t.program=l},153:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=t.program=t.expression=t.statements=t.statement=t.smart=void 0;var s=r(7522);var a=r(4309);const n=(0,a.default)(s.smart);t.smart=n;const o=(0,a.default)(s.statement);t.statement=o;const i=(0,a.default)(s.statements);t.statements=i;const l=(0,a.default)(s.expression);t.expression=l;const c=(0,a.default)(s.program);t.program=c;var u=Object.assign(n.bind(undefined),{smart:n,statement:o,statements:i,expression:l,program:c,ast:n.ast});t["default"]=u},5932:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=literalTemplate;var s=r(4578);var a=r(8502);var n=r(7635);function literalTemplate(e,t,r){const{metadata:a,names:o}=buildLiteralData(e,t,r);return t=>{const r={};t.forEach(((e,t)=>{r[o[t]]=e}));return t=>{const o=(0,s.normalizeReplacements)(t);if(o){Object.keys(o).forEach((e=>{if(Object.prototype.hasOwnProperty.call(r,e)){throw new Error("Unexpected replacement overlap.")}}))}return e.unwrap((0,n.default)(a,o?Object.assign(o,r):r))}}}function buildLiteralData(e,t,r){let s;let n;let o;let i="";do{i+="$";const l=buildTemplateCode(t,i);s=l.names;n=new Set(s);o=(0,a.default)(e,e.code(l.code),{parser:r.parser,placeholderWhitelist:new Set(l.names.concat(r.placeholderWhitelist?Array.from(r.placeholderWhitelist):[])),placeholderPattern:r.placeholderPattern,preserveComments:r.preserveComments,syntacticPlaceholders:r.syntacticPlaceholders})}while(o.placeholders.some((e=>e.isDuplicate&&n.has(e.name))));return{metadata:o,names:s}}function buildTemplateCode(e,t){const r=[];let s=e[0];for(let a=1;a{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.merge=merge;t.validate=validate;t.normalizeReplacements=normalizeReplacements;function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var r={};var s=Object.keys(e);var a,n;for(n=0;n=0)continue;r[a]=e[a]}return r}function merge(e,t){const{placeholderWhitelist:r=e.placeholderWhitelist,placeholderPattern:s=e.placeholderPattern,preserveComments:a=e.preserveComments,syntacticPlaceholders:n=e.syntacticPlaceholders}=t;return{parser:Object.assign({},e.parser,t.parser),placeholderWhitelist:r,placeholderPattern:s,preserveComments:a,syntacticPlaceholders:n}}function validate(e){if(e!=null&&typeof e!=="object"){throw new Error("Unknown template options.")}const t=e||{},{placeholderWhitelist:r,placeholderPattern:s,preserveComments:a,syntacticPlaceholders:n}=t,o=_objectWithoutPropertiesLoose(t,["placeholderWhitelist","placeholderPattern","preserveComments","syntacticPlaceholders"]);if(r!=null&&!(r instanceof Set)){throw new Error("'.placeholderWhitelist' must be a Set, null, or undefined")}if(s!=null&&!(s instanceof RegExp)&&s!==false){throw new Error("'.placeholderPattern' must be a RegExp, false, null, or undefined")}if(a!=null&&typeof a!=="boolean"){throw new Error("'.preserveComments' must be a boolean, null, or undefined")}if(n!=null&&typeof n!=="boolean"){throw new Error("'.syntacticPlaceholders' must be a boolean, null, or undefined")}if(n===true&&(r!=null||s!=null)){throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible"+" with '.syntacticPlaceholders: true'")}return{parser:o,placeholderWhitelist:r||undefined,placeholderPattern:s==null?undefined:s,preserveComments:a==null?undefined:a,syntacticPlaceholders:n==null?undefined:n}}function normalizeReplacements(e){if(Array.isArray(e)){return e.reduce(((e,t,r)=>{e["$"+r]=t;return e}),{})}else if(typeof e==="object"||e==null){return e||undefined}throw new Error("Template replacements must be an array, object, null, or undefined")}},8502:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=parseAndBuildMetadata;var s=r(8622);var a=r(6949);var n=r(5694);const o=/^[_$A-Z0-9]+$/;function parseAndBuildMetadata(e,t,r){const{placeholderWhitelist:a,placeholderPattern:n,preserveComments:o,syntacticPlaceholders:i}=r;const l=parseWithCodeFrame(t,r.parser,i);s.removePropertiesDeep(l,{preserveComments:o});e.validate(l);const c={placeholders:[],placeholderNames:new Set};const u={placeholders:[],placeholderNames:new Set};const p={value:undefined};s.traverse(l,placeholderVisitorHandler,{syntactic:c,legacy:u,isLegacyRef:p,placeholderWhitelist:a,placeholderPattern:n,syntacticPlaceholders:i});return Object.assign({ast:l},p.value?u:c)}function placeholderVisitorHandler(e,t,r){var a;let n;if(s.isPlaceholder(e)){if(r.syntacticPlaceholders===false){throw new Error("%%foo%%-style placeholders can't be used when "+"'.syntacticPlaceholders' is false.")}else{n=e.name.name;r.isLegacyRef.value=false}}else if(r.isLegacyRef.value===false||r.syntacticPlaceholders){return}else if(s.isIdentifier(e)||s.isJSXIdentifier(e)){n=e.name;r.isLegacyRef.value=true}else if(s.isStringLiteral(e)){n=e.value;r.isLegacyRef.value=true}else{return}if(!r.isLegacyRef.value&&(r.placeholderPattern!=null||r.placeholderWhitelist!=null)){throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible"+" with '.syntacticPlaceholders: true'")}if(r.isLegacyRef.value&&(r.placeholderPattern===false||!(r.placeholderPattern||o).test(n))&&!((a=r.placeholderWhitelist)!=null&&a.has(n))){return}t=t.slice();const{node:i,key:l}=t[t.length-1];let c;if(s.isStringLiteral(e)||s.isPlaceholder(e,{expectedNode:"StringLiteral"})){c="string"}else if(s.isNewExpression(i)&&l==="arguments"||s.isCallExpression(i)&&l==="arguments"||s.isFunction(i)&&l==="params"){c="param"}else if(s.isExpressionStatement(i)&&!s.isPlaceholder(e)){c="statement";t=t.slice(0,-1)}else if(s.isStatement(e)&&s.isPlaceholder(e)){c="statement"}else{c="other"}const{placeholders:u,placeholderNames:p}=r.isLegacyRef.value?r.legacy:r.syntactic;u.push({name:n,type:c,resolve:e=>resolveAncestors(e,t),isDuplicate:p.has(n)});p.add(n)}function resolveAncestors(e,t){let r=e;for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=populatePlaceholders;var s=r(8622);function populatePlaceholders(e,t){const r=s.cloneNode(e.ast);if(t){e.placeholders.forEach((e=>{if(!Object.prototype.hasOwnProperty.call(t,e.name)){const t=e.name;throw new Error(`Error: No substitution given for "${t}". If this is not meant to be a\n placeholder you may want to consider passing one of the following options to @babel/template:\n - { placeholderPattern: false, placeholderWhitelist: new Set(['${t}'])}\n - { placeholderPattern: /^${t}$/ }`)}}));Object.keys(t).forEach((t=>{if(!e.placeholderNames.has(t)){throw new Error(`Unknown substitution "${t}" given`)}}))}e.placeholders.slice().reverse().forEach((e=>{try{applyReplacement(e,r,t&&t[e.name]||null)}catch(t){t.message=`@babel/template placeholder "${e.name}": ${t.message}`;throw t}}));return r}function applyReplacement(e,t,r){if(e.isDuplicate){if(Array.isArray(r)){r=r.map((e=>s.cloneNode(e)))}else if(typeof r==="object"){r=s.cloneNode(r)}}const{parent:a,key:n,index:o}=e.resolve(t);if(e.type==="string"){if(typeof r==="string"){r=s.stringLiteral(r)}if(!r||!s.isStringLiteral(r)){throw new Error("Expected string substitution")}}else if(e.type==="statement"){if(o===undefined){if(!r){r=s.emptyStatement()}else if(Array.isArray(r)){r=s.blockStatement(r)}else if(typeof r==="string"){r=s.expressionStatement(s.identifier(r))}else if(!s.isStatement(r)){r=s.expressionStatement(r)}}else{if(r&&!Array.isArray(r)){if(typeof r==="string"){r=s.identifier(r)}if(!s.isStatement(r)){r=s.expressionStatement(r)}}}}else if(e.type==="param"){if(typeof r==="string"){r=s.identifier(r)}if(o===undefined)throw new Error("Assertion failure.")}else{if(typeof r==="string"){r=s.identifier(r)}if(Array.isArray(r)){throw new Error("Cannot replace single expression with an array.")}}if(o===undefined){s.validate(a,n,r);a[n]=r}else{const t=a[n].slice();if(e.type==="statement"||e.type==="param"){if(r==null){t.splice(o,1)}else if(Array.isArray(r)){t.splice(o,1,...r)}else{t[o]=r}}else{t[o]=r}s.validate(a,n,t);a[n]=t}}},351:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=stringTemplate;var s=r(4578);var a=r(8502);var n=r(7635);function stringTemplate(e,t,r){t=e.code(t);let o;return i=>{const l=(0,s.normalizeReplacements)(i);if(!o)o=(0,a.default)(e,t,r);return e.unwrap((0,n.default)(o,l))}}},5694:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.codeFrameColumns=codeFrameColumns;t["default"]=_default;var s=r(2032);let a=false;function getDefs(e){return{gutter:e.grey,marker:e.red.bold,message:e.red.bold}}const n=/\r\n|[\n\r\u2028\u2029]/;function getMarkerLines(e,t,r){const s=Object.assign({column:0,line:-1},e.start);const a=Object.assign({},s,e.end);const{linesAbove:n=2,linesBelow:o=3}=r||{};const i=s.line;const l=s.column;const c=a.line;const u=a.column;let p=Math.max(i-(n+1),0);let d=Math.min(t.length,c+o);if(i===-1){p=0}if(c===-1){d=t.length}const f=c-i;const m={};if(f){for(let e=0;e<=f;e++){const r=e+i;if(!l){m[r]=true}else if(e===0){const e=t[r-1].length;m[r]=[l,e-l+1]}else if(e===f){m[r]=[0,u]}else{const s=t[r-e].length;m[r]=[0,s]}}}else{if(l===u){if(l){m[i]=[l,0]}else{m[i]=true}}else{m[i]=[l,u-l]}}return{start:p,end:d,markerLines:m}}function codeFrameColumns(e,t,r={}){const a=(r.highlightCode||r.forceColor)&&(0,s.shouldHighlight)(r);const o=(0,s.getChalk)(r);const i=getDefs(o);const maybeHighlight=(e,t)=>a?e(t):t;const l=e.split(n);const{start:c,end:u,markerLines:p}=getMarkerLines(t,l,r);const d=t.start&&typeof t.start.column==="number";const f=String(u).length;const m=a?(0,s.default)(e,r):e;let y=m.split(n).slice(c,u).map(((e,t)=>{const s=c+1+t;const a=` ${s}`.slice(-f);const n=` ${a} |`;const o=p[s];const l=!p[s+1];if(o){let t="";if(Array.isArray(o)){const s=e.slice(0,Math.max(o[0]-1,0)).replace(/[^\t]/g," ");const a=o[1]||1;t=["\n ",maybeHighlight(i.gutter,n.replace(/\d/g," "))," ",s,maybeHighlight(i.marker,"^").repeat(a)].join("");if(l&&r.message){t+=" "+maybeHighlight(i.message,r.message)}}return[maybeHighlight(i.marker,">"),maybeHighlight(i.gutter,n),e.length>0?` ${e}`:"",t].join("")}else{return` ${maybeHighlight(i.gutter,n)}${e.length>0?` ${e}`:""}`}})).join("\n");if(r.message&&!d){y=`${" ".repeat(f+1)}${r.message}\n${y}`}if(a){return o.reset(y)}else{return y}}function _default(e,t,r,s={}){if(!a){a=true;const e="Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";if(process.emitWarning){process.emitWarning(e,"DeprecationWarning")}else{const t=new Error(e);t.name="DeprecationWarning";console.warn(new Error(e))}}r=Math.max(r,0);const n={start:{column:r,line:t}};return codeFrameColumns(e,n,s)}},5002:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(5002);var a=r(7169)},7169:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},2032:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.shouldHighlight=shouldHighlight;t.getChalk=getChalk;t["default"]=highlight;var s=r(8035);var a=r(347);var n=r(8542);const o=new Set(["as","async","from","get","of","set"]);function getDefs(e){return{keyword:e.cyan,capitalized:e.yellow,jsxIdentifier:e.yellow,punctuator:e.yellow,number:e.magenta,string:e.green,regex:e.magenta,comment:e.grey,invalid:e.white.bgRed.bold}}const i=/\r\n|[\n\r\u2028\u2029]/;const l=/^[()[\]{}]$/;let c;{const e=/^[a-z][\w-]*$/i;const getTokenType=function(t,r,s){if(t.type==="name"){if((0,a.isKeyword)(t.value)||(0,a.isStrictReservedWord)(t.value,true)||o.has(t.value)){return"keyword"}if(e.test(t.value)&&(s[r-1]==="<"||s.substr(r-2,2)=="t(e))).join("\n")}else{r+=a}}return r}function shouldHighlight(e){return!!n.supportsColor||e.forceColor}function getChalk(e){return e.forceColor?new n.constructor({enabled:true,level:1}):n}function highlight(e,t={}){if(shouldHighlight(t)){const r=getChalk(t);const s=getDefs(r);return highlightTokens(s,e)}else{return e}}},8716:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var r=function(){function sliceIterator(e,t){var r=[];var s=true;var a=false;var n=undefined;try{for(var o=e[Symbol.iterator](),i;!(s=(i=o.next()).done);s=true){r.push(i.value);if(t&&r.length===t)break}}catch(e){a=true;n=e}finally{try{if(!s&&o["return"])o["return"]()}finally{if(a)throw n}}return r}return function(e,t){if(Array.isArray(e)){return e}else if(Symbol.iterator in Object(e)){return sliceIterator(e,t)}else{throw new TypeError("Invalid attempt to destructure non-iterable instance")}}}();t.getImportSource=getImportSource;t.createDynamicImportTransform=createDynamicImportTransform;function getImportSource(e,t){var s=t.arguments;var a=r(s,1),n=a[0];var o=e.isStringLiteral(n)||e.isTemplateLiteral(n);if(o){e.removeComments(n);return n}return e.templateLiteral([e.templateElement({raw:"",cooked:""}),e.templateElement({raw:"",cooked:""},true)],s)}function createDynamicImportTransform(e){var t=e.template,r=e.types;var s={static:{interop:t("Promise.resolve().then(() => INTEROP(require(SOURCE)))"),noInterop:t("Promise.resolve().then(() => require(SOURCE))")},dynamic:{interop:t("Promise.resolve(SOURCE).then(s => INTEROP(require(s)))"),noInterop:t("Promise.resolve(SOURCE).then(s => require(s))")}};var a=typeof WeakSet==="function"&&new WeakSet;var n=function isString(e){return r.isStringLiteral(e)||r.isTemplateLiteral(e)&&e.expressions.length===0};return function(e,t){if(a){if(a.has(t)){return}a.add(t)}var o=getImportSource(r,t.parent);var i=n(o)?s["static"]:s.dynamic;var l=e.opts.noInterop?i.noInterop({SOURCE:o}):i.interop({SOURCE:o,INTEROP:e.addHelper("interopRequireWildcard")});t.parentPath.replaceWith(l)}}},7047:(e,t,r)=>{e.exports=r(8716)},9065:(e,t,r)=>{"use strict";const s=r(1603);const{get:a,has:n,find:o}=r(8018);const getSortedObjectPaths=e=>{if(!e){return[]}return s(e).paths().filter((e=>e.length)).map((e=>e.join("."))).sort(((e,t)=>t.length-e.length))};const replaceAndEvaluateNode=(e,t,r)=>{t.replaceWith(e(r));if(t.parentPath.isBinaryExpression()){const r=t.parentPath.evaluate();if(r.confident){t.parentPath.replaceWith(e(r.value))}}};const processNode=(e,t,r,s)=>{const i=o(getSortedObjectPaths(e),(e=>s(t,e)));if(n(e,i)){replaceAndEvaluateNode(r,t,a(e,i))}};const memberExpressionComparator=(e,t)=>e.matchesPattern(t);const identifierComparator=(e,t)=>e.node.name===t;const unaryExpressionComparator=(e,t)=>e.node.argument.name===t;const i="typeof ";const plugin=function({types:e}){return{visitor:{MemberExpression(t,r){processNode(r.opts,t,e.valueToNode,memberExpressionComparator)},Identifier(t,r){processNode(r.opts,t,e.valueToNode,identifierComparator)},UnaryExpression(t,r){if(t.node.operator!=="typeof"){return}const{opts:s}=r;const a=Object.keys(s);const n={};a.forEach((e=>{if(e.substring(0,i.length)===i){n[e.substring(i.length)]=s[e]}}));processNode(n,t,e.valueToNode,unaryExpressionComparator)}}}};e.exports=plugin;e.exports["default"]=plugin;e.exports.getSortedObjectPaths=getSortedObjectPaths},6197:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=_interopRequireDefault(r(7835));var a=_interopRequireDefault(r(4640));var n=_interopRequireDefault(r(346));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectSpread(e){for(var t=1;t1&&arguments[1]!==undefined?arguments[1]:{};var o=n.as,i=o===void 0?"assignmentExpression":o;var l=t.expression('\n process.env.NODE_ENV !== "production" ? RIGHT : {}\n ',{placeholderPattern:/^(LEFT|RIGHT)$/})({RIGHT:a});switch(i){case"variableDeclarator":return r.variableDeclarator(s,l);case"assignmentExpression":return r.assignmentExpression("=",s,l);default:throw new Error("unrecognized template type ".concat(i))}},mode:p.opts.mode||"remove",ignoreFilenames:d,types:r,removeImport:p.opts.removeImport||false,libraries:(p.opts.additionalLibraries||[]).concat("prop-types"),classNameMatchers:f,createReactClassName:p.opts.createReactClassName||"createReactClass"};if(p.opts.plugins){var y=p;var g=p.opts.plugins.map((function(t){var r=typeof t==="string"?t:t[0];if(typeof t!=="string"){y.opts=_objectSpread({},y.opts,t[1])}var s=require(r);if(typeof s!=="function"){s=s.default}return s(e).visitor}));o(u.parent,o.visitors.merge(g),u.scope,y,u.parentPath)}u.traverse({ObjectProperty:{exit:function exit(e){var t=e.node;if(t.computed||t.key.name!=="propTypes"){return}var r=e.findParent((function(e){if(e.type!=="CallExpression"){return false}return e.get("callee").node.name===m.createReactClassName||e.get("callee").node.property&&e.get("callee").node.property.name==="createClass"}));if(r){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"createClass"})}}},ClassProperty:function ClassProperty(e){var t=e.node,r=e.scope;if(t.key.name==="propTypes"){var s=r.path;if(isReactClass(s.get("superClass"),r,m)){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"class static",pathClassDeclaration:s})}}},AssignmentExpression:function AssignmentExpression(e){var t=e.node,r=e.scope;if(t.left.computed||!t.left.property||t.left.property.name!=="propTypes"){return}var o=(0,s.default)(e.node.left);if(o){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"assign"});return}var i=t.left.object.name;var u=r.getBinding(i);if(!u){return}if(u.path.isClassDeclaration()){var p=u.path.get("superClass");if(isReactClass(p,r,m)){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"assign"})}}else if((0,a.default)(u.path)){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"assign"})}}});var h=0;var b={VariableDeclarator:function VariableDeclarator(e){if(e.scope.block.type!=="Program"){return}if(["ObjectPattern","ArrayPattern"].includes(e.node.id.type)){return}var t=e.node.id.name;if(!i.has(t)){return}var r=e.scope.getBinding(t),s=r.referencePaths;var a=s.some((function(e){var t=e.find((function(e){return l.has(e)}));return!t}));if(a){h+=1;return}l.add(e);i.delete(t);e.get("init").traverse(c);(0,n.default)(e,m,{type:"declarator"})}};var x=new Set;while(!areSetsEqual(i,x)&&i.size>0&&h0}));if(!n){e.remove()}}})}else{throw new Error('transform-react-remove-prop-type: removeImport = true and mode != "remove" can not be used at the same time.')}}}}}}},7835:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=isAnnotatedForRemoval;function isAnnotatedForRemoval(e){var t=e.trailingComments||[];return Boolean(t.find((function(e){var t=e.value;return t.trim()==="remove-proptypes"})))}},4640:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=isStatelessComponent;var r=Symbol("traversed");function isJSXElementOrReactCreateElement(e){var t=false;e.traverse({CallExpression:function CallExpression(e){var r=e.get("callee");if(r.matchesPattern("React.createElement")||r.matchesPattern("React.cloneElement")||r.node.name==="cloneElement"){t=true}},JSXElement:function JSXElement(){t=true}});return t}function isReturningJSXElement(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(e.node.init&&e.node.init.body&&isJSXElementOrReactCreateElement(e)){return true}if(t>20){throw new Error("transform-react-remove-prop-type: infinite loop detected.")}var s=false;e.traverse({ReturnStatement:function ReturnStatement(a){if(s){return}var n=a.get("argument");if(!n.node){return}if(isJSXElementOrReactCreateElement(a)){s=true;return}if(n.node.type==="CallExpression"){var o=n.get("callee").node.name;var i=e.scope.getBinding(o);if(!i){return}if(i.path[r]){return}i.path[r]=true;if(isReturningJSXElement(i.path,t+1)){s=true}}}});return s}var s=["VariableDeclarator","FunctionDeclaration"];function isStatelessComponent(e){if(s.indexOf(e.node.type)===-1){return false}if(isReturningJSXElement(e)){return true}return false}},346:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=remove;function isInside(e,t){if(!e.hub.file.opts){return true}var r=e.hub.file.opts.filename;if(!r){return true}if(!t){return false}return t.test(r)}function remove(e,t,r){var s=t.visitedKey,a=t.unsafeWrapTemplate,n=t.wrapTemplate,o=t.mode,i=t.ignoreFilenames,l=t.types;if(i&&isInside(e.scope,i)){return}if(e.node[s]){return}e.node[s]=true;if(o==="remove"){if(e.parentPath.type==="ConditionalExpression"){e.replaceWith(l.unaryExpression("void",l.numericLiteral(0)))}else{e.remove()}return}if(o==="wrap"||o==="unsafe-wrap"){switch(r.type){case"createClass":break;case"class static":{var c;var u=r.pathClassDeclaration;if(!u.isClassExpression()&&u.node.id){c=u.node.id}else{return}var p=l.expressionStatement(l.assignmentExpression("=",l.memberExpression(c,e.node.key),e.node.value));if(u.parentPath.isExportDeclaration()){u=u.parentPath}u.insertAfter(p);e.remove();break}case"assign":if(o==="unsafe-wrap"){e.replaceWith(a({NODE:e.node}))}else{e.replaceWith(n({LEFT:e.node.left,RIGHT:e.node.right}))}e.node[s]=true;break;case"declarator":e.replaceWith(n({LEFT:e.node.id,RIGHT:e.node.init},{as:"variableDeclarator"}));e.node[s]=true;break;default:break}return}throw new Error("transform-react-remove-prop-type: unsupported mode ".concat(o,"."))}},665:(e,t,r)=>{"use strict";const s=r(2971);class Definition{constructor(e,t,r,s,a,n){this.type=e;this.name=t;this.node=r;this.parent=s;this.index=a;this.kind=n}}class ParameterDefinition extends Definition{constructor(e,t,r,a){super(s.Parameter,e,t,null,r,null);this.rest=a}}e.exports={ParameterDefinition:ParameterDefinition,Definition:Definition}},6007:(e,t,r)=>{"use strict";const s=r(9491);const a=r(6988);const n=r(4585);const o=r(4945);const i=r(2971);const l=r(6313).Scope;const c=r(290).i8;function defaultOptions(){return{optimistic:false,directive:false,nodejsScope:false,impliedStrict:false,sourceType:"script",ecmaVersion:5,childVisitorKeys:null,fallback:"iteration"}}function updateDeeply(e,t){function isHashObject(e){return typeof e==="object"&&e instanceof Object&&!(e instanceof Array)&&!(e instanceof RegExp)}for(const r in t){if(Object.prototype.hasOwnProperty.call(t,r)){const s=t[r];if(isHashObject(s)){if(isHashObject(e[r])){updateDeeply(e[r],s)}else{e[r]=updateDeeply({},s)}}else{e[r]=s}}}return e}function analyze(e,t){const r=updateDeeply(defaultOptions(),t);const o=new a(r);const i=new n(r,o);i.visit(e);s(o.__currentScope===null,"currentScope should be null.");return o}e.exports={version:c,Reference:o,Variable:i,Scope:l,ScopeManager:a,analyze:analyze}},4162:(e,t,r)=>{"use strict";const s=r(8350).Syntax;const a=r(1217);function getLast(e){return e[e.length-1]||null}class PatternVisitor extends a.Visitor{static isPattern(e){const t=e.type;return t===s.Identifier||t===s.ObjectPattern||t===s.ArrayPattern||t===s.SpreadElement||t===s.RestElement||t===s.AssignmentPattern}constructor(e,t,r){super(null,e);this.rootPattern=t;this.callback=r;this.assignments=[];this.rightHandNodes=[];this.restElements=[]}Identifier(e){const t=getLast(this.restElements);this.callback(e,{topLevel:e===this.rootPattern,rest:t!==null&&t!==undefined&&t.argument===e,assignments:this.assignments})}Property(e){if(e.computed){this.rightHandNodes.push(e.key)}this.visit(e.value)}ArrayPattern(e){for(let t=0,r=e.elements.length;t{this.rightHandNodes.push(e)}));this.visit(e.callee)}}e.exports=PatternVisitor},4945:e=>{"use strict";const t=1;const r=2;const s=t|r;class Reference{constructor(e,t,r,s,a,n,o){this.identifier=e;this.from=t;this.tainted=false;this.resolved=null;this.flag=r;if(this.isWrite()){this.writeExpr=s;this.partial=n;this.init=o}this.__maybeImplicitGlobal=a}isStatic(){return!this.tainted&&this.resolved&&this.resolved.scope.isStatic()}isWrite(){return!!(this.flag&Reference.WRITE)}isRead(){return!!(this.flag&Reference.READ)}isReadOnly(){return this.flag===Reference.READ}isWriteOnly(){return this.flag===Reference.WRITE}isReadWrite(){return this.flag===Reference.RW}}Reference.READ=t;Reference.WRITE=r;Reference.RW=s;e.exports=Reference},4585:(e,t,r)=>{"use strict";const s=r(8350).Syntax;const a=r(1217);const n=r(4945);const o=r(2971);const i=r(4162);const l=r(665);const c=r(9491);const u=l.ParameterDefinition;const p=l.Definition;function traverseIdentifierInPattern(e,t,r,s){const a=new i(e,t,s);a.visit(t);if(r!==null&&r!==undefined){a.rightHandNodes.forEach(r.visit,r)}}class Importer extends a.Visitor{constructor(e,t){super(null,t.options);this.declaration=e;this.referencer=t}visitImport(e,t){this.referencer.visitPattern(e,(e=>{this.referencer.currentScope().__define(e,new p(o.ImportBinding,e,t,this.declaration,null,null))}))}ImportNamespaceSpecifier(e){const t=e.local||e.id;if(t){this.visitImport(t,e)}}ImportDefaultSpecifier(e){const t=e.local||e.id;this.visitImport(t,e)}ImportSpecifier(e){const t=e.local||e.id;if(e.name){this.visitImport(e.name,e)}else{this.visitImport(t,e)}}}class Referencer extends a.Visitor{constructor(e,t){super(null,e);this.options=e;this.scopeManager=t;this.parent=null;this.isInnerMethodDefinition=false}currentScope(){return this.scopeManager.__currentScope}close(e){while(this.currentScope()&&e===this.currentScope().block){this.scopeManager.__currentScope=this.currentScope().__close(this.scopeManager)}}pushInnerMethodDefinition(e){const t=this.isInnerMethodDefinition;this.isInnerMethodDefinition=e;return t}popInnerMethodDefinition(e){this.isInnerMethodDefinition=e}referencingDefaultValue(e,t,r,s){const a=this.currentScope();t.forEach((t=>{a.__referencing(e,n.WRITE,t.right,r,e!==t.left,s)}))}visitPattern(e,t,r){let s=t;let a=r;if(typeof t==="function"){a=t;s={processRightHandNodes:false}}traverseIdentifierInPattern(this.options,e,s.processRightHandNodes?this:null,a)}visitFunction(e){let t,r;if(e.type===s.FunctionDeclaration){this.currentScope().__define(e.id,new p(o.FunctionName,e.id,e,null,null,null))}if(e.type===s.FunctionExpression&&e.id){this.scopeManager.__nestFunctionExpressionNameScope(e)}this.scopeManager.__nestFunctionScope(e,this.isInnerMethodDefinition);const a=this;function visitPatternCallback(r,s){a.currentScope().__define(r,new u(r,e,t,s.rest));a.referencingDefaultValue(r,s.assignments,null,true)}for(t=0,r=e.params.length;t{this.currentScope().__define(t,new u(t,e,e.params.length,true))}))}if(e.body){if(e.body.type===s.BlockStatement){this.visitChildren(e.body)}else{this.visit(e.body)}}this.close(e)}visitClass(e){if(e.type===s.ClassDeclaration){this.currentScope().__define(e.id,new p(o.ClassName,e.id,e,null,null,null))}this.visit(e.superClass);this.scopeManager.__nestClassScope(e);if(e.id){this.currentScope().__define(e.id,new p(o.ClassName,e.id,e))}this.visit(e.body);this.close(e)}visitProperty(e){let t;if(e.computed){this.visit(e.key)}const r=e.type===s.MethodDefinition;if(r){t=this.pushInnerMethodDefinition(true)}this.visit(e.value);if(r){this.popInnerMethodDefinition(t)}}visitForIn(e){if(e.left.type===s.VariableDeclaration&&e.left.kind!=="var"){this.scopeManager.__nestForScope(e)}if(e.left.type===s.VariableDeclaration){this.visit(e.left);this.visitPattern(e.left.declarations[0].id,(t=>{this.currentScope().__referencing(t,n.WRITE,e.right,null,true,true)}))}else{this.visitPattern(e.left,{processRightHandNodes:true},((t,r)=>{let s=null;if(!this.currentScope().isStrict){s={pattern:t,node:e}}this.referencingDefaultValue(t,r.assignments,s,false);this.currentScope().__referencing(t,n.WRITE,e.right,s,true,false)}))}this.visit(e.right);this.visit(e.body);this.close(e)}visitVariableDeclaration(e,t,r,s){const a=r.declarations[s];const o=a.init;this.visitPattern(a.id,{processRightHandNodes:true},((i,l)=>{e.__define(i,new p(t,i,a,r,s,r.kind));this.referencingDefaultValue(i,l.assignments,null,true);if(o){this.currentScope().__referencing(i,n.WRITE,o,null,!l.topLevel,true)}}))}AssignmentExpression(e){if(i.isPattern(e.left)){if(e.operator==="="){this.visitPattern(e.left,{processRightHandNodes:true},((t,r)=>{let s=null;if(!this.currentScope().isStrict){s={pattern:t,node:e}}this.referencingDefaultValue(t,r.assignments,s,false);this.currentScope().__referencing(t,n.WRITE,e.right,s,!r.topLevel,false)}))}else{this.currentScope().__referencing(e.left,n.RW,e.right)}}else{this.visit(e.left)}this.visit(e.right)}CatchClause(e){this.scopeManager.__nestCatchScope(e);this.visitPattern(e.param,{processRightHandNodes:true},((t,r)=>{this.currentScope().__define(t,new p(o.CatchClause,e.param,e,null,null,null));this.referencingDefaultValue(t,r.assignments,null,true)}));this.visit(e.body);this.close(e)}Program(e){this.scopeManager.__nestGlobalScope(e);if(this.scopeManager.__isNodejsScope()){this.currentScope().isStrict=false;this.scopeManager.__nestFunctionScope(e,false)}if(this.scopeManager.__isES6()&&this.scopeManager.isModule()){this.scopeManager.__nestModuleScope(e)}if(this.scopeManager.isStrictModeSupported()&&this.scopeManager.isImpliedStrict()){this.currentScope().isStrict=true}this.visitChildren(e);this.close(e)}Identifier(e){this.currentScope().__referencing(e)}UpdateExpression(e){if(i.isPattern(e.argument)){this.currentScope().__referencing(e.argument,n.RW,null)}else{this.visitChildren(e)}}MemberExpression(e){this.visit(e.object);if(e.computed){this.visit(e.property)}}Property(e){this.visitProperty(e)}MethodDefinition(e){this.visitProperty(e)}BreakStatement(){}ContinueStatement(){}LabeledStatement(e){this.visit(e.body)}ForStatement(e){if(e.init&&e.init.type===s.VariableDeclaration&&e.init.kind!=="var"){this.scopeManager.__nestForScope(e)}this.visitChildren(e);this.close(e)}ClassExpression(e){this.visitClass(e)}ClassDeclaration(e){this.visitClass(e)}CallExpression(e){if(!this.scopeManager.__ignoreEval()&&e.callee.type===s.Identifier&&e.callee.name==="eval"){this.currentScope().variableScope.__detectEval()}this.visitChildren(e)}BlockStatement(e){if(this.scopeManager.__isES6()){this.scopeManager.__nestBlockScope(e)}this.visitChildren(e);this.close(e)}ThisExpression(){this.currentScope().variableScope.__detectThis()}WithStatement(e){this.visit(e.object);this.scopeManager.__nestWithScope(e);this.visit(e.body);this.close(e)}VariableDeclaration(e){const t=e.kind==="var"?this.currentScope().variableScope:this.currentScope();for(let r=0,s=e.declarations.length;r{"use strict";const s=r(6313);const a=r(9491);const n=s.GlobalScope;const o=s.CatchScope;const i=s.WithScope;const l=s.ModuleScope;const c=s.ClassScope;const u=s.SwitchScope;const p=s.FunctionScope;const d=s.ForScope;const f=s.FunctionExpressionNameScope;const m=s.BlockScope;class ScopeManager{constructor(e){this.scopes=[];this.globalScope=null;this.__nodeToScope=new WeakMap;this.__currentScope=null;this.__options=e;this.__declaredVariables=new WeakMap}__useDirective(){return this.__options.directive}__isOptimistic(){return this.__options.optimistic}__ignoreEval(){return this.__options.ignoreEval}__isNodejsScope(){return this.__options.nodejsScope}isModule(){return this.__options.sourceType==="module"}isImpliedStrict(){return this.__options.impliedStrict}isStrictModeSupported(){return this.__options.ecmaVersion>=5}__get(e){return this.__nodeToScope.get(e)}getDeclaredVariables(e){return this.__declaredVariables.get(e)||[]}acquire(e,t){function predicate(e){if(e.type==="function"&&e.functionExpressionScope){return false}return true}const r=this.__get(e);if(!r||r.length===0){return null}if(r.length===1){return r[0]}if(t){for(let e=r.length-1;e>=0;--e){const t=r[e];if(predicate(t)){return t}}}else{for(let e=0,t=r.length;e=6}}e.exports=ScopeManager},6313:(e,t,r)=>{"use strict";const s=r(8350).Syntax;const a=r(4945);const n=r(2971);const o=r(665).Definition;const i=r(9491);function isStrictScope(e,t,r,a){let n;if(e.upper&&e.upper.isStrict){return true}if(r){return true}if(e.type==="class"||e.type==="module"){return true}if(e.type==="block"||e.type==="switch"){return false}if(e.type==="function"){if(t.type===s.ArrowFunctionExpression&&t.body.type!==s.BlockStatement){return false}if(t.type===s.Program){n=t}else{n=t.body}if(!n){return false}}else if(e.type==="global"){n=t}else{return false}if(a){for(let e=0,t=n.body.length;e0&&s.every(shouldBeStatically)}__staticCloseRef(e){if(!this.__resolve(e)){this.__delegateToUpperScope(e)}}__dynamicCloseRef(e){let t=this;do{t.through.push(e);t=t.upper}while(t)}__globalCloseRef(e){if(this.__shouldStaticallyCloseForGlobal(e)){this.__staticCloseRef(e)}else{this.__dynamicCloseRef(e)}}__close(e){let t;if(this.__shouldStaticallyClose(e)){t=this.__staticCloseRef}else if(this.type!=="global"){t=this.__dynamicCloseRef}else{t=this.__globalCloseRef}for(let e=0,r=this.__left.length;ee.name.range[0]>=r)))}}class ForScope extends Scope{constructor(e,t,r){super(e,"for",t,r,false)}}class ClassScope extends Scope{constructor(e,t,r){super(e,"class",t,r,false)}}e.exports={Scope:Scope,GlobalScope:GlobalScope,ModuleScope:ModuleScope,FunctionExpressionNameScope:FunctionExpressionNameScope,CatchScope:CatchScope,WithScope:WithScope,BlockScope:BlockScope,SwitchScope:SwitchScope,FunctionScope:FunctionScope,ForScope:ForScope,ClassScope:ClassScope}},2971:e=>{"use strict";class Variable{constructor(e,t){this.name=e;this.identifiers=[];this.references=[];this.defs=[];this.tainted=false;this.stack=true;this.scope=t}}Variable.CatchClause="CatchClause";Variable.Parameter="Parameter";Variable.FunctionName="FunctionName";Variable.ClassName="ClassName";Variable.Variable="Variable";Variable.ImportBinding="ImportBinding";Variable.ImplicitGlobalVariable="ImplicitGlobalVariable";e.exports=Variable},1217:(e,t,r)=>{(function(){"use strict";var e=r(165);function isNode(e){if(e==null){return false}return typeof e==="object"&&typeof e.type==="string"}function isProperty(t,r){return(t===e.Syntax.ObjectExpression||t===e.Syntax.ObjectPattern)&&r==="properties"}function Visitor(t,r){r=r||{};this.__visitor=t||this;this.__childVisitorKeys=r.childVisitorKeys?Object.assign({},e.VisitorKeys,r.childVisitorKeys):e.VisitorKeys;if(r.fallback==="iteration"){this.__fallback=Object.keys}else if(typeof r.fallback==="function"){this.__fallback=r.fallback}}Visitor.prototype.visitChildren=function(t){var r,s,a,n,o,i,l;if(t==null){return}r=t.type||e.Syntax.Property;s=this.__childVisitorKeys[r];if(!s){if(this.__fallback){s=this.__fallback(t)}else{throw new Error("Unknown node type "+r+".")}}for(a=0,n=s.length;a{(function clone(e){"use strict";var t,r,s,a,n,o;function deepCopy(e){var t={},r,s;for(r in e){if(e.hasOwnProperty(r)){s=e[r];if(typeof s==="object"&&s!==null){t[r]=deepCopy(s)}else{t[r]=s}}}return t}function upperBound(e,t){var r,s,a,n;s=e.length;a=0;while(s){r=s>>>1;n=a+r;if(t(e[n])){s=r}else{a=n+1;s-=r+1}}return a}t={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ChainExpression:"ChainExpression",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"};s={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]};a={};n={};o={};r={Break:a,Skip:n,Remove:o};function Reference(e,t){this.parent=e;this.key=t}Reference.prototype.replace=function replace(e){this.parent[this.key]=e};Reference.prototype.remove=function remove(){if(Array.isArray(this.parent)){this.parent.splice(this.key,1);return true}else{this.replace(null);return false}};function Element(e,t,r,s){this.node=e;this.path=t;this.wrap=r;this.ref=s}function Controller(){}Controller.prototype.path=function path(){var e,t,r,s,a,n;function addToPath(e,t){if(Array.isArray(t)){for(r=0,s=t.length;r=0;--r){if(e[r].node===t){return true}}return false}Controller.prototype.traverse=function traverse(e,t){var r,s,o,i,l,c,u,p,d,f,m,y;this.__initialize(e,t);y={};r=this.__worklist;s=this.__leavelist;r.push(new Element(e,null,null,null));s.push(new Element(null,null,null,null));while(r.length){o=r.pop();if(o===y){o=s.pop();c=this.__execute(t.leave,o);if(this.__state===a||c===a){return}continue}if(o.node){c=this.__execute(t.enter,o);if(this.__state===a||c===a){return}r.push(y);s.push(o);if(this.__state===n||c===n){continue}i=o.node;l=i.type||o.wrap;f=this.__keys[l];if(!f){if(this.__fallback){f=this.__fallback(i)}else{throw new Error("Unknown node type "+l+".")}}p=f.length;while((p-=1)>=0){u=f[p];m=i[u];if(!m){continue}if(Array.isArray(m)){d=m.length;while((d-=1)>=0){if(!m[d]){continue}if(candidateExistsInLeaveList(s,m[d])){continue}if(isProperty(l,f[p])){o=new Element(m[d],[u,d],"Property",null)}else if(isNode(m[d])){o=new Element(m[d],[u,d],null,null)}else{continue}r.push(o)}}else if(isNode(m)){if(candidateExistsInLeaveList(s,m)){continue}r.push(new Element(m,u,null,null))}}}}};Controller.prototype.replace=function replace(e,t){var r,s,i,l,c,u,p,d,f,m,y,g,h;function removeElem(e){var t,s,a,n;if(e.ref.remove()){s=e.ref.key;n=e.ref.parent;t=r.length;while(t--){a=r[t];if(a.ref&&a.ref.parent===n){if(a.ref.key=0){h=f[p];m=i[h];if(!m){continue}if(Array.isArray(m)){d=m.length;while((d-=1)>=0){if(!m[d]){continue}if(isProperty(l,f[p])){u=new Element(m[d],[h,d],"Property",new Reference(m,d))}else if(isNode(m[d])){u=new Element(m[d],[h,d],null,new Reference(m,d))}else{continue}r.push(u)}}else if(isNode(m)){r.push(new Element(m,h,null,new Reference(i,h)))}}}return g.root};function traverse(e,t){var r=new Controller;return r.traverse(e,t)}function replace(e,t){var r=new Controller;return r.replace(e,t)}function extendCommentRange(e,t){var r;r=upperBound(t,(function search(t){return t.range[0]>e.range[0]}));e.extendedRange=[e.range[0],e.range[1]];if(r!==t.length){e.extendedRange[1]=t[r].range[0]}r-=1;if(r>=0){e.extendedRange[0]=t[r].range[1]}return e}function attachComments(e,t,s){var a=[],n,o,i,l;if(!e.range){throw new Error("attachComments needs range information")}if(!s.length){if(t.length){for(i=0,o=t.length;ie.range[0]){break}if(t.extendedRange[1]===e.range[0]){if(!e.leadingComments){e.leadingComments=[]}e.leadingComments.push(t);a.splice(l,1)}else{l+=1}}if(l===a.length){return r.Break}if(a[l].extendedRange[0]>e.range[1]){return r.Skip}}});l=0;traverse(e,{leave:function(e){var t;while(le.range[1]){return r.Skip}}});return e}e.Syntax=t;e.traverse=traverse;e.replace=replace;e.attachComments=attachComments;e.VisitorKeys=s;e.VisitorOption=r;e.Controller=Controller;e.cloneEnvironment=function(){return clone({})};return e})(t)},8350:(e,t,r)=>{(function clone(e){"use strict";var t,s,a,n,o,i;function deepCopy(e){var t={},r,s;for(r in e){if(e.hasOwnProperty(r)){s=e[r];if(typeof s==="object"&&s!==null){t[r]=deepCopy(s)}else{t[r]=s}}}return t}function upperBound(e,t){var r,s,a,n;s=e.length;a=0;while(s){r=s>>>1;n=a+r;if(t(e[n])){s=r}else{a=n+1;s-=r+1}}return a}t={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"};a={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]};n={};o={};i={};s={Break:n,Skip:o,Remove:i};function Reference(e,t){this.parent=e;this.key=t}Reference.prototype.replace=function replace(e){this.parent[this.key]=e};Reference.prototype.remove=function remove(){if(Array.isArray(this.parent)){this.parent.splice(this.key,1);return true}else{this.replace(null);return false}};function Element(e,t,r,s){this.node=e;this.path=t;this.wrap=r;this.ref=s}function Controller(){}Controller.prototype.path=function path(){var e,t,r,s,a,n;function addToPath(e,t){if(Array.isArray(t)){for(r=0,s=t.length;r=0){u=f[p];m=i[u];if(!m){continue}if(Array.isArray(m)){d=m.length;while((d-=1)>=0){if(!m[d]){continue}if(isProperty(l,f[p])){a=new Element(m[d],[u,d],"Property",null)}else if(isNode(m[d])){a=new Element(m[d],[u,d],null,null)}else{continue}r.push(a)}}else if(isNode(m)){r.push(new Element(m,u,null,null))}}}}};Controller.prototype.replace=function replace(e,t){var r,s,a,l,c,u,p,d,f,m,y,g,h;function removeElem(e){var t,s,a,n;if(e.ref.remove()){s=e.ref.key;n=e.ref.parent;t=r.length;while(t--){a=r[t];if(a.ref&&a.ref.parent===n){if(a.ref.key=0){h=f[p];m=a[h];if(!m){continue}if(Array.isArray(m)){d=m.length;while((d-=1)>=0){if(!m[d]){continue}if(isProperty(l,f[p])){u=new Element(m[d],[h,d],"Property",new Reference(m,d))}else if(isNode(m[d])){u=new Element(m[d],[h,d],null,new Reference(m,d))}else{continue}r.push(u)}}else if(isNode(m)){r.push(new Element(m,h,null,new Reference(a,h)))}}}return g.root};function traverse(e,t){var r=new Controller;return r.traverse(e,t)}function replace(e,t){var r=new Controller;return r.replace(e,t)}function extendCommentRange(e,t){var r;r=upperBound(t,(function search(t){return t.range[0]>e.range[0]}));e.extendedRange=[e.range[0],e.range[1]];if(r!==t.length){e.extendedRange[1]=t[r].range[0]}r-=1;if(r>=0){e.extendedRange[0]=t[r].range[1]}return e}function attachComments(e,t,r){var a=[],n,o,i,l;if(!e.range){throw new Error("attachComments needs range information")}if(!r.length){if(t.length){for(i=0,o=t.length;ie.range[0]){break}if(t.extendedRange[1]===e.range[0]){if(!e.leadingComments){e.leadingComments=[]}e.leadingComments.push(t);a.splice(l,1)}else{l+=1}}if(l===a.length){return s.Break}if(a[l].extendedRange[0]>e.range[1]){return s.Skip}}});l=0;traverse(e,{leave:function(e){var t;while(le.range[1]){return s.Skip}}});return e}e.version=r(5535).i8;e.Syntax=t;e.traverse=traverse;e.replace=replace;e.attachComments=attachComments;e.VisitorKeys=a;e.VisitorOption=s;e.Controller=Controller;e.cloneEnvironment=function(){return clone({})};return e})(t)},9733:e=>{"use strict";var t="Function.prototype.bind called on incompatible ";var r=Array.prototype.slice;var s=Object.prototype.toString;var a="[object Function]";e.exports=function bind(e){var n=this;if(typeof n!=="function"||s.call(n)!==a){throw new TypeError(t+n)}var o=r.call(arguments,1);var i;var binder=function(){if(this instanceof i){var t=n.apply(this,o.concat(r.call(arguments)));if(Object(t)===t){return t}return this}else{return n.apply(e,o.concat(r.call(arguments)))}};var l=Math.max(0,n.length-o.length);var c=[];for(var u=0;u{"use strict";var s=r(9733);e.exports=Function.prototype.bind||s},5548:(e,t,r)=>{"use strict";e.exports=r(964)},793:(e,t,r)=>{"use strict";var s=r(4517);e.exports=s.call(Function.call,Object.prototype.hasOwnProperty)},8746:(e,t,r)=>{"use strict";var s=r(793);function specifierIncluded(e,t){var r=e.split(".");var s=t.split(" ");var a=s.length>1?s[0]:"=";var n=(s.length>1?s[1]:s[0]).split(".");for(var o=0;o<3;++o){var i=parseInt(r[o]||0,10);var l=parseInt(n[o]||0,10);if(i===l){continue}if(a==="<"){return i="){return i>=l}return false}return a===">="}function matchesRange(e,t){var r=t.split(/ ?&& ?/);if(r.length===0){return false}for(var s=0;s{Object.defineProperty(t,"__esModule",{value:true});t["default"]=/((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;t.matchToToken=function(e){var t={type:"invalid",value:e[0],closed:undefined};if(e[1])t.type="string",t.closed=!!(e[3]||e[4]);else if(e[5])t.type="comment";else if(e[6])t.type="comment",t.closed=!!e[7];else if(e[8])t.type="regex";else if(e[9])t.type="number";else if(e[10])t.type="name";else if(e[11])t.type="punctuator";else if(e[12])t.type="whitespace";return t}},6240:e=>{var t="Expected a function";var r=0/0;var s="[object Symbol]";var a=/^\s+|\s+$/g;var n=/^[-+]0x[0-9a-f]+$/i;var o=/^0b[01]+$/i;var i=/^0o[0-7]+$/i;var l=parseInt;var c=typeof global=="object"&&global&&global.Object===Object&&global;var u=typeof self=="object"&&self&&self.Object===Object&&self;var p=c||u||Function("return this")();var d=Object.prototype;var f=d.toString;var m=Math.max,y=Math.min;var now=function(){return p.Date.now()};function debounce(e,r,s){var a,n,o,i,l,c,u=0,p=false,d=false,f=true;if(typeof e!="function"){throw new TypeError(t)}r=toNumber(r)||0;if(isObject(s)){p=!!s.leading;d="maxWait"in s;o=d?m(toNumber(s.maxWait)||0,r):o;f="trailing"in s?!!s.trailing:f}function invokeFunc(t){var r=a,s=n;a=n=undefined;u=t;i=e.apply(s,r);return i}function leadingEdge(e){u=e;l=setTimeout(timerExpired,r);return p?invokeFunc(e):i}function remainingWait(e){var t=e-c,s=e-u,a=r-t;return d?y(a,o-s):a}function shouldInvoke(e){var t=e-c,s=e-u;return c===undefined||t>=r||t<0||d&&s>=o}function timerExpired(){var e=now();if(shouldInvoke(e)){return trailingEdge(e)}l=setTimeout(timerExpired,remainingWait(e))}function trailingEdge(e){l=undefined;if(f&&a){return invokeFunc(e)}a=n=undefined;return i}function cancel(){if(l!==undefined){clearTimeout(l)}u=0;a=c=n=l=undefined}function flush(){return l===undefined?i:trailingEdge(now())}function debounced(){var e=now(),t=shouldInvoke(e);a=arguments;n=this;c=e;if(t){if(l===undefined){return leadingEdge(c)}if(d){l=setTimeout(timerExpired,r);return invokeFunc(c)}}if(l===undefined){l=setTimeout(timerExpired,r)}return i}debounced.cancel=cancel;debounced.flush=flush;return debounced}function isObject(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function isObjectLike(e){return!!e&&typeof e=="object"}function isSymbol(e){return typeof e=="symbol"||isObjectLike(e)&&f.call(e)==s}function toNumber(e){if(typeof e=="number"){return e}if(isSymbol(e)){return r}if(isObject(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=isObject(t)?t+"":t}if(typeof e!="string"){return e===0?e:+e}e=e.replace(a,"");var s=o.test(e);return s||i.test(e)?l(e.slice(2),s?2:8):n.test(e)?r:+e}e.exports=debounce},8018:function(e,t,r){e=r.nmd(e); /** * @license * Lodash @@ -311,15 +386,15 @@ * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */(function(){var r;var s="4.17.20";var a=200;var n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function";var i="__lodash_hash_undefined__";var l=500;var c="__lodash_placeholder__";var u=1,p=2,f=4;var d=1,m=2;var y=1,g=2,h=4,b=8,x=16,v=32,E=64,j=128,w=256,_=512;var S=30,k="...";var O=800,I=16;var P=1,D=2,C=3;var A=1/0,R=9007199254740991,N=17976931348623157e292,M=0/0;var L=4294967295,F=L-1,B=L>>>1;var W=[["ary",j],["bind",y],["bindKey",g],["curry",b],["curryRight",x],["flip",_],["partial",v],["partialRight",E],["rearg",w]];var U="[object Arguments]",V="[object Array]",$="[object AsyncFunction]",q="[object Boolean]",G="[object Date]",H="[object DOMException]",z="[object Error]",K="[object Function]",X="[object GeneratorFunction]",Y="[object Map]",J="[object Number]",Z="[object Null]",Q="[object Object]",ee="[object Promise]",te="[object Proxy]",re="[object RegExp]",se="[object Set]",ae="[object String]",ne="[object Symbol]",oe="[object Undefined]",ie="[object WeakMap]",le="[object WeakSet]";var ce="[object ArrayBuffer]",ue="[object DataView]",pe="[object Float32Array]",fe="[object Float64Array]",de="[object Int8Array]",me="[object Int16Array]",ye="[object Int32Array]",ge="[object Uint8Array]",he="[object Uint8ClampedArray]",be="[object Uint16Array]",xe="[object Uint32Array]";var ve=/\b__p \+= '';/g,Ee=/\b(__p \+=) '' \+/g,je=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var we=/&(?:amp|lt|gt|quot|#39);/g,_e=/[&<>"']/g,Se=RegExp(we.source),ke=RegExp(_e.source);var Oe=/<%-([\s\S]+?)%>/g,Ie=/<%([\s\S]+?)%>/g,Pe=/<%=([\s\S]+?)%>/g;var De=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ce=/^\w*$/,Ae=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;var Re=/[\\^$.*+?()[\]{}|]/g,Ne=RegExp(Re.source);var Te=/^\s+|\s+$/g,Me=/^\s+/,Le=/\s+$/;var Fe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Be=/\{\n\/\* \[wrapped with (.+)\] \*/,We=/,? & /;var Ue=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var Ve=/\\(\\)?/g;var $e=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var qe=/\w*$/;var Ge=/^[-+]0x[0-9a-f]+$/i;var He=/^0b[01]+$/i;var ze=/^\[object .+?Constructor\]$/;var Ke=/^0o[0-7]+$/i;var Xe=/^(?:0|[1-9]\d*)$/;var Ye=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;var Je=/($^)/;var Ze=/['\n\r\u2028\u2029\\]/g;var Qe="\\ud800-\\udfff",et="\\u0300-\\u036f",tt="\\ufe20-\\ufe2f",rt="\\u20d0-\\u20ff",st=et+tt+rt,at="\\u2700-\\u27bf",nt="a-z\\xdf-\\xf6\\xf8-\\xff",ot="\\xac\\xb1\\xd7\\xf7",ct="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ut="\\u2000-\\u206f",pt=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ft="A-Z\\xc0-\\xd6\\xd8-\\xde",dt="\\ufe0e\\ufe0f",mt=ot+ct+ut+pt;var yt="['’]",ht="["+Qe+"]",bt="["+mt+"]",xt="["+st+"]",vt="\\d+",Et="["+at+"]",jt="["+nt+"]",wt="[^"+Qe+mt+vt+at+nt+ft+"]",_t="\\ud83c[\\udffb-\\udfff]",St="(?:"+xt+"|"+_t+")",kt="[^"+Qe+"]",Ot="(?:\\ud83c[\\udde6-\\uddff]){2}",It="[\\ud800-\\udbff][\\udc00-\\udfff]",Pt="["+ft+"]",Dt="\\u200d";var Ct="(?:"+jt+"|"+wt+")",At="(?:"+Pt+"|"+wt+")",Rt="(?:"+yt+"(?:d|ll|m|re|s|t|ve))?",Nt="(?:"+yt+"(?:D|LL|M|RE|S|T|VE))?",Tt=St+"?",Mt="["+dt+"]?",Lt="(?:"+Dt+"(?:"+[kt,Ot,It].join("|")+")"+Mt+Tt+")*",Ft="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Bt="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Wt=Mt+Tt+Lt,Ut="(?:"+[Et,Ot,It].join("|")+")"+Wt,Vt="(?:"+[kt+xt+"?",xt,Ot,It,ht].join("|")+")";var $t=RegExp(yt,"g");var qt=RegExp(xt,"g");var Gt=RegExp(_t+"(?="+_t+")|"+Vt+Wt,"g");var Ht=RegExp([Pt+"?"+jt+"+"+Rt+"(?="+[bt,Pt,"$"].join("|")+")",At+"+"+Nt+"(?="+[bt,Pt+Ct,"$"].join("|")+")",Pt+"?"+Ct+"+"+Rt,Pt+"+"+Nt,Bt,Ft,vt,Ut].join("|"),"g");var zt=RegExp("["+Dt+Qe+st+dt+"]");var Kt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var Xt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"];var Yt=-1;var Jt={};Jt[pe]=Jt[fe]=Jt[de]=Jt[me]=Jt[ye]=Jt[ge]=Jt[he]=Jt[be]=Jt[xe]=true;Jt[U]=Jt[V]=Jt[ce]=Jt[q]=Jt[ue]=Jt[G]=Jt[z]=Jt[K]=Jt[Y]=Jt[J]=Jt[Q]=Jt[re]=Jt[se]=Jt[ae]=Jt[ie]=false;var Zt={};Zt[U]=Zt[V]=Zt[ce]=Zt[ue]=Zt[q]=Zt[G]=Zt[pe]=Zt[fe]=Zt[de]=Zt[me]=Zt[ye]=Zt[Y]=Zt[J]=Zt[Q]=Zt[re]=Zt[se]=Zt[ae]=Zt[ne]=Zt[ge]=Zt[he]=Zt[be]=Zt[xe]=true;Zt[z]=Zt[K]=Zt[ie]=false;var Qt={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"};var er={"&":"&","<":"<",">":">",'"':""","'":"'"};var tr={"&":"&","<":"<",">":">",""":'"',"'":"'"};var rr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};var sr=parseFloat,ar=parseInt;var nr=typeof global=="object"&&global&&global.Object===Object&&global;var or=typeof self=="object"&&self&&self.Object===Object&&self;var ir=nr||or||Function("return this")();var lr=true&&t&&!t.nodeType&&t;var cr=lr&&"object"=="object"&&e&&!e.nodeType&&e;var ur=cr&&cr.exports===lr;var pr=ur&&nr.process;var fr=function(){try{var e=cr&&cr.require&&cr.require("util").types;if(e){return e}return pr&&pr.binding&&pr.binding("util")}catch(e){}}();var dr=fr&&fr.isArrayBuffer,mr=fr&&fr.isDate,yr=fr&&fr.isMap,gr=fr&&fr.isRegExp,hr=fr&&fr.isSet,br=fr&&fr.isTypedArray;function apply(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function arrayAggregator(e,t,r,s){var a=-1,n=e==null?0:e.length;while(++a-1}function arrayIncludesWith(e,t,r){var s=-1,a=e==null?0:e.length;while(++s-1){}return r}function charsEndIndex(e,t){var r=e.length;while(r--&&baseIndexOf(t,e[r],0)>-1){}return r}function countHolders(e,t){var r=e.length,s=0;while(r--){if(e[r]===t){++s}}return s}var vr=basePropertyOf(Qt);var Er=basePropertyOf(er);function escapeStringChar(e){return"\\"+rr[e]}function getValue(e,t){return e==null?r:e[t]}function hasUnicode(e){return zt.test(e)}function hasUnicodeWord(e){return Kt.test(e)}function iteratorToArray(e){var t,r=[];while(!(t=e.next()).done){r.push(t.value)}return r}function mapToArray(e){var t=-1,r=Array(e.size);e.forEach((function(e,s){r[++t]=[s,e]}));return r}function overArg(e,t){return function(r){return e(t(r))}}function replaceHolders(e,t){var r=-1,s=e.length,a=0,n=[];while(++r-1}function listCacheSet(e,t){var r=this.__data__,s=assocIndexOf(r,e);if(s<0){++this.size;r.push([e,t])}else{r[s][1]=t}return this}ListCache.prototype.clear=listCacheClear;ListCache.prototype["delete"]=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;function MapCache(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t=t?e:t}}return e}function baseClone(e,t,s,a,n,o){var i,l=t&u,c=t&p,d=t&f;if(s){i=n?s(e,a,n,o):s(e)}if(i!==r){return i}if(!isObject(e)){return e}var m=Ns(e);if(m){i=initCloneArray(e);if(!l){return copyArray(e,i)}}else{var y=qr(e),g=y==K||y==X;if(Ms(e)){return cloneBuffer(e,l)}if(y==Q||y==U||g&&!n){i=c||g?{}:initCloneObject(e);if(!l){return c?copySymbolsIn(e,baseAssignIn(i,e)):copySymbols(e,baseAssign(i,e))}}else{if(!Zt[y]){return n?e:{}}i=initCloneByTag(e,y,l)}}o||(o=new Stack);var h=o.get(e);if(h){return h}o.set(e,i);if(Ws(e)){e.forEach((function(r){i.add(baseClone(r,t,s,r,e,o))}))}else if(Fs(e)){e.forEach((function(r,a){i.set(a,baseClone(r,t,s,a,e,o))}))}var b=d?c?getAllKeysIn:getAllKeys:c?keysIn:keys;var x=m?r:b(e);arrayEach(x||e,(function(r,a){if(x){a=r;r=e[a]}assignValue(i,a,baseClone(r,t,s,a,e,o))}));return i}function baseConforms(e){var t=keys(e);return function(r){return baseConformsTo(r,e,t)}}function baseConformsTo(e,t,s){var a=s.length;if(e==null){return!a}e=rt(e);while(a--){var n=s[a],o=t[n],i=e[n];if(i===r&&!(n in e)||!o(i)){return false}}return true}function baseDelay(e,t,s){if(typeof e!="function"){throw new nt(o)}return zr((function(){e.apply(r,s)}),t)}function baseDifference(e,t,r,s){var n=-1,o=arrayIncludes,i=true,l=e.length,c=[],u=t.length;if(!l){return c}if(r){t=arrayMap(t,baseUnary(r))}if(s){o=arrayIncludesWith;i=false}else if(t.length>=a){o=cacheHas;i=false;t=new SetCache(t)}e:while(++nn?0:n+s}a=a===r||a>n?n:toInteger(a);if(a<0){a+=n}a=s>a?0:toLength(a);while(s0&&r(i)){if(t>1){baseFlatten(i,t-1,r,s,a)}else{arrayPush(a,i)}}else if(!s){a[a.length]=i}}return a}var Nr=createBaseFor();var Tr=createBaseFor(true);function baseForOwn(e,t){return e&&Nr(e,t,keys)}function baseForOwnRight(e,t){return e&&Tr(e,t,keys)}function baseFunctions(e,t){return arrayFilter(t,(function(t){return isFunction(e[t])}))}function baseGet(e,t){t=castPath(t,e);var s=0,a=t.length;while(e!=null&&st}function baseHas(e,t){return e!=null&&dt.call(e,t)}function baseHasIn(e,t){return e!=null&&t in rt(e)}function baseInRange(e,t,r){return e>=Ht(t,r)&&e=120&&f.length>=120)?new SetCache(l&&f):r}f=e[0];var d=-1,m=c[0];e:while(++d-1){if(i!==e){It.call(i,l,1)}It.call(e,l,1)}}return e}function basePullAt(e,t){var r=e?t.length:0,s=r-1;while(r--){var a=t[r];if(r==s||a!==n){var n=a;if(isIndex(a)){It.call(e,a,1)}else{baseUnset(e,a)}}}return e}function baseRandom(e,t){return e+Lt(Qt()*(t-e+1))}function baseRange(e,r,s,a){var n=-1,o=Gt(Mt((r-e)/(s||1)),0),i=t(o);while(o--){i[a?o:++n]=e;e+=s}return i}function baseRepeat(e,t){var r="";if(!e||t<1||t>R){return r}do{if(t%2){r+=e}t=Lt(t/2);if(t){e+=e}}while(t);return r}function baseRest(e,t){return Kr(overRest(e,t,identity),e+"")}function baseSample(e){return arraySample(values(e))}function baseSampleSize(e,t){var r=values(e);return shuffleSelf(r,baseClamp(t,0,r.length))}function baseSet(e,t,s,a){if(!isObject(e)){return e}t=castPath(t,e);var n=-1,o=t.length,i=o-1,l=e;while(l!=null&&++nn?0:n+r}s=s>n?n:s;if(s<0){s+=n}n=r>s?0:s-r>>>0;r>>>=0;var o=t(n);while(++a>>1,o=e[n];if(o!==null&&!isSymbol(o)&&(r?o<=t:o=a){var u=t?null:Wr(e);if(u){return setToArray(u)}i=false;n=cacheHas;c=new SetCache}else{c=t?[]:l}e:while(++s=a?e:baseSlice(e,t,s)}var Br=Rt||function(e){return ir.clearTimeout(e)};function cloneBuffer(e,t){if(t){return e.slice()}var r=e.length,s=_t?_t(r):new e.constructor(r);e.copy(s);return s}function cloneArrayBuffer(e){var t=new e.constructor(e.byteLength);new wt(t).set(new wt(e));return t}function cloneDataView(e,t){var r=t?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function cloneRegExp(e){var t=new e.constructor(e.source,qe.exec(e));t.lastIndex=e.lastIndex;return t}function cloneSymbol(e){return Pr?rt(Pr.call(e)):{}}function cloneTypedArray(e,t){var r=t?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function compareAscending(e,t){if(e!==t){var s=e!==r,a=e===null,n=e===e,o=isSymbol(e);var i=t!==r,l=t===null,c=t===t,u=isSymbol(t);if(!l&&!u&&!o&&e>t||o&&i&&c&&!l&&!u||a&&i&&c||!s&&c||!n){return 1}if(!a&&!o&&!u&&e=i){return l}var c=r[s];return l*(c=="desc"?-1:1)}}return e.index-t.index}function composeArgs(e,r,s,a){var n=-1,o=e.length,i=s.length,l=-1,c=r.length,u=Gt(o-i,0),p=t(c+u),f=!a;while(++l1?s[n-1]:r,i=n>2?s[2]:r;o=e.length>3&&typeof o=="function"?(n--,o):r;if(i&&isIterateeCall(s[0],s[1],i)){o=n<3?r:o;n=1}t=rt(t);while(++a-1?n[o?t[i]:i]:r}}function createFlow(e){return flatRest((function(t){var s=t.length,a=s,n=LodashWrapper.prototype.thru;if(e){t.reverse()}while(a--){var i=t[a];if(typeof i!="function"){throw new nt(o)}if(n&&!l&&getFuncName(i)=="wrapper"){var l=new LodashWrapper([],true)}}a=l?a:s;while(++a1){y.reverse()}if(f&&ul)){return false}var u=o.get(e);var p=o.get(t);if(u&&p){return u==t&&p==e}var f=-1,y=true,g=s&m?new SetCache:r;o.set(e,t);o.set(t,e);while(++f1?"& ":"")+t[s];t=t.join(r>2?", ":" ");return e.replace(Fe,"{\n/* [wrapped with "+t+"] */\n")}function isFlattenable(e){return Ns(e)||Rs(e)||!!(Pt&&e&&e[Pt])}function isIndex(e,t){var r=typeof e;t=t==null?R:t;return!!t&&(r=="number"||r!="symbol"&&Xe.test(e))&&(e>-1&&e%1==0&&e0){if(++t>=O){return arguments[0]}}else{t=0}return e.apply(r,arguments)}}function shuffleSelf(e,t){var s=-1,a=e.length,n=a-1;t=t===r?a:t;while(++s1?e[t-1]:r;s=typeof s=="function"?(e.pop(),s):r;return unzipWith(e,s)}));function chain(e){var t=lodash(e);t.__chain__=true;return t}function tap(e,t){t(e);return e}function thru(e,t){return t(e)}var ds=flatRest((function(e){var t=e.length,s=t?e[0]:0,a=this.__wrapped__,interceptor=function(t){return baseAt(t,e)};if(t>1||this.__actions__.length||!(a instanceof LazyWrapper)||!isIndex(s)){return this.thru(interceptor)}a=a.slice(s,+s+(t?1:0));a.__actions__.push({func:thru,args:[interceptor],thisArg:r});return new LodashWrapper(a,this.__chain__).thru((function(e){if(t&&!e.length){e.push(r)}return e}))}));function wrapperChain(){return chain(this)}function wrapperCommit(){return new LodashWrapper(this.value(),this.__chain__)}function wrapperNext(){if(this.__values__===r){this.__values__=toArray(this.value())}var e=this.__index__>=this.__values__.length,t=e?r:this.__values__[this.__index__++];return{done:e,value:t}}function wrapperToIterator(){return this}function wrapperPlant(e){var t,s=this;while(s instanceof baseLodash){var a=wrapperClone(s);a.__index__=0;a.__values__=r;if(t){n.__wrapped__=a}else{t=a}var n=a;s=s.__wrapped__}n.__wrapped__=e;return t}function wrapperReverse(){var e=this.__wrapped__;if(e instanceof LazyWrapper){var t=e;if(this.__actions__.length){t=new LazyWrapper(this)}t=t.reverse();t.__actions__.push({func:thru,args:[reverse],thisArg:r});return new LodashWrapper(t,this.__chain__)}return this.thru(reverse)}function wrapperValue(){return baseWrapperValue(this.__wrapped__,this.__actions__)}var ms=createAggregator((function(e,t,r){if(dt.call(e,r)){++e[r]}else{baseAssignValue(e,r,1)}}));function every(e,t,s){var a=Ns(e)?arrayEvery:baseEvery;if(s&&isIterateeCall(e,t,s)){t=r}return a(e,getIteratee(t,3))}function filter(e,t){var r=Ns(e)?arrayFilter:baseFilter;return r(e,getIteratee(t,3))}var ys=createFind(findIndex);var gs=createFind(findLastIndex);function flatMap(e,t){return baseFlatten(map(e,t),1)}function flatMapDeep(e,t){return baseFlatten(map(e,t),A)}function flatMapDepth(e,t,s){s=s===r?1:toInteger(s);return baseFlatten(map(e,t),s)}function forEach(e,t){var r=Ns(e)?arrayEach:Ar;return r(e,getIteratee(t,3))}function forEachRight(e,t){var r=Ns(e)?arrayEachRight:Rr;return r(e,getIteratee(t,3))}var hs=createAggregator((function(e,t,r){if(dt.call(e,r)){e[r].push(t)}else{baseAssignValue(e,r,[t])}}));function includes(e,t,r,s){e=isArrayLike(e)?e:values(e);r=r&&!s?toInteger(r):0;var a=e.length;if(r<0){r=Gt(a+r,0)}return isString(e)?r<=a&&e.indexOf(t,r)>-1:!!a&&baseIndexOf(e,t,r)>-1}var bs=baseRest((function(e,r,s){var a=-1,n=typeof r=="function",o=isArrayLike(e)?t(e.length):[];Ar(e,(function(e){o[++a]=n?apply(r,e,s):baseInvoke(e,r,s)}));return o}));var xs=createAggregator((function(e,t,r){baseAssignValue(e,r,t)}));function map(e,t){var r=Ns(e)?arrayMap:baseMap;return r(e,getIteratee(t,3))}function orderBy(e,t,s,a){if(e==null){return[]}if(!Ns(t)){t=t==null?[]:[t]}s=a?r:s;if(!Ns(s)){s=s==null?[]:[s]}return baseOrderBy(e,t,s)}var vs=createAggregator((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]}));function reduce(e,t,r){var s=Ns(e)?arrayReduce:baseReduce,a=arguments.length<3;return s(e,getIteratee(t,4),r,a,Ar)}function reduceRight(e,t,r){var s=Ns(e)?arrayReduceRight:baseReduce,a=arguments.length<3;return s(e,getIteratee(t,4),r,a,Rr)}function reject(e,t){var r=Ns(e)?arrayFilter:baseFilter;return r(e,negate(getIteratee(t,3)))}function sample(e){var t=Ns(e)?arraySample:baseSample;return t(e)}function sampleSize(e,t,s){if(s?isIterateeCall(e,t,s):t===r){t=1}else{t=toInteger(t)}var a=Ns(e)?arraySampleSize:baseSampleSize;return a(e,t)}function shuffle(e){var t=Ns(e)?arrayShuffle:baseShuffle;return t(e)}function size(e){if(e==null){return 0}if(isArrayLike(e)){return isString(e)?stringSize(e):e.length}var t=qr(e);if(t==Y||t==se){return e.size}return baseKeys(e).length}function some(e,t,s){var a=Ns(e)?arraySome:baseSome;if(s&&isIterateeCall(e,t,s)){t=r}return a(e,getIteratee(t,3))}var Es=baseRest((function(e,t){if(e==null){return[]}var r=t.length;if(r>1&&isIterateeCall(e,t[0],t[1])){t=[]}else if(r>2&&isIterateeCall(t[0],t[1],t[2])){t=[t[0]]}return baseOrderBy(e,baseFlatten(t,1),[])}));var js=Nt||function(){return ir.Date.now()};function after(e,t){if(typeof t!="function"){throw new nt(o)}e=toInteger(e);return function(){if(--e<1){return t.apply(this,arguments)}}}function ary(e,t,s){t=s?r:t;t=e&&t==null?e.length:t;return createWrap(e,j,r,r,r,r,t)}function before(e,t){var s;if(typeof t!="function"){throw new nt(o)}e=toInteger(e);return function(){if(--e>0){s=t.apply(this,arguments)}if(e<=1){t=r}return s}}var ws=baseRest((function(e,t,r){var s=y;if(r.length){var a=replaceHolders(r,getHolder(ws));s|=v}return createWrap(e,s,t,r,a)}));var _s=baseRest((function(e,t,r){var s=y|g;if(r.length){var a=replaceHolders(r,getHolder(_s));s|=v}return createWrap(t,s,e,r,a)}));function curry(e,t,s){t=s?r:t;var a=createWrap(e,b,r,r,r,r,r,t);a.placeholder=curry.placeholder;return a}function curryRight(e,t,s){t=s?r:t;var a=createWrap(e,x,r,r,r,r,r,t);a.placeholder=curryRight.placeholder;return a}function debounce(e,t,s){var a,n,i,l,c,u,p=0,f=false,d=false,m=true;if(typeof e!="function"){throw new nt(o)}t=toNumber(t)||0;if(isObject(s)){f=!!s.leading;d="maxWait"in s;i=d?Gt(toNumber(s.maxWait)||0,t):i;m="trailing"in s?!!s.trailing:m}function invokeFunc(t){var s=a,o=n;a=n=r;p=t;l=e.apply(o,s);return l}function leadingEdge(e){p=e;c=zr(timerExpired,t);return f?invokeFunc(e):l}function remainingWait(e){var r=e-u,s=e-p,a=t-r;return d?Ht(a,i-s):a}function shouldInvoke(e){var s=e-u,a=e-p;return u===r||s>=t||s<0||d&&a>=i}function timerExpired(){var e=js();if(shouldInvoke(e)){return trailingEdge(e)}c=zr(timerExpired,remainingWait(e))}function trailingEdge(e){c=r;if(m&&a){return invokeFunc(e)}a=n=r;return l}function cancel(){if(c!==r){Br(c)}p=0;a=u=n=c=r}function flush(){return c===r?l:trailingEdge(js())}function debounced(){var e=js(),s=shouldInvoke(e);a=arguments;n=this;u=e;if(s){if(c===r){return leadingEdge(u)}if(d){Br(c);c=zr(timerExpired,t);return invokeFunc(u)}}if(c===r){c=zr(timerExpired,t)}return l}debounced.cancel=cancel;debounced.flush=flush;return debounced}var Ss=baseRest((function(e,t){return baseDelay(e,1,t)}));var ks=baseRest((function(e,t,r){return baseDelay(e,toNumber(t)||0,r)}));function flip(e){return createWrap(e,_)}function memoize(e,t){if(typeof e!="function"||t!=null&&typeof t!="function"){throw new nt(o)}var memoized=function(){var r=arguments,s=t?t.apply(this,r):r[0],a=memoized.cache;if(a.has(s)){return a.get(s)}var n=e.apply(this,r);memoized.cache=a.set(s,n)||a;return n};memoized.cache=new(memoize.Cache||MapCache);return memoized}memoize.Cache=MapCache;function negate(e){if(typeof e!="function"){throw new nt(o)}return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function once(e){return before(2,e)}var Os=Fr((function(e,t){t=t.length==1&&Ns(t[0])?arrayMap(t[0],baseUnary(getIteratee())):arrayMap(baseFlatten(t,1),baseUnary(getIteratee()));var r=t.length;return baseRest((function(s){var a=-1,n=Ht(s.length,r);while(++a=t}));var Rs=baseIsArguments(function(){return arguments}())?baseIsArguments:function(e){return isObjectLike(e)&&dt.call(e,"callee")&&!Ot.call(e,"callee")};var Ns=t.isArray;var Ts=dr?baseUnary(dr):baseIsArrayBuffer;function isArrayLike(e){return e!=null&&isLength(e.length)&&!isFunction(e)}function isArrayLikeObject(e){return isObjectLike(e)&&isArrayLike(e)}function isBoolean(e){return e===true||e===false||isObjectLike(e)&&baseGetTag(e)==q}var Ms=Bt||stubFalse;var Ls=mr?baseUnary(mr):baseIsDate;function isElement(e){return isObjectLike(e)&&e.nodeType===1&&!isPlainObject(e)}function isEmpty(e){if(e==null){return true}if(isArrayLike(e)&&(Ns(e)||typeof e=="string"||typeof e.splice=="function"||Ms(e)||Us(e)||Rs(e))){return!e.length}var t=qr(e);if(t==Y||t==se){return!e.size}if(isPrototype(e)){return!baseKeys(e).length}for(var r in e){if(dt.call(e,r)){return false}}return true}function isEqual(e,t){return baseIsEqual(e,t)}function isEqualWith(e,t,s){s=typeof s=="function"?s:r;var a=s?s(e,t):r;return a===r?baseIsEqual(e,t,r,s):!!a}function isError(e){if(!isObjectLike(e)){return false}var t=baseGetTag(e);return t==z||t==H||typeof e.message=="string"&&typeof e.name=="string"&&!isPlainObject(e)}function isFinite(e){return typeof e=="number"&&Wt(e)}function isFunction(e){if(!isObject(e)){return false}var t=baseGetTag(e);return t==K||t==X||t==$||t==te}function isInteger(e){return typeof e=="number"&&e==toInteger(e)}function isLength(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=R}function isObject(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function isObjectLike(e){return e!=null&&typeof e=="object"}var Fs=yr?baseUnary(yr):baseIsMap;function isMatch(e,t){return e===t||baseIsMatch(e,t,getMatchData(t))}function isMatchWith(e,t,s){s=typeof s=="function"?s:r;return baseIsMatch(e,t,getMatchData(t),s)}function isNaN(e){return isNumber(e)&&e!=+e}function isNative(e){if(Gr(e)){throw new Qe(n)}return baseIsNative(e)}function isNull(e){return e===null}function isNil(e){return e==null}function isNumber(e){return typeof e=="number"||isObjectLike(e)&&baseGetTag(e)==J}function isPlainObject(e){if(!isObjectLike(e)||baseGetTag(e)!=Q){return false}var t=St(e);if(t===null){return true}var r=dt.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&ft.call(r)==bt}var Bs=gr?baseUnary(gr):baseIsRegExp;function isSafeInteger(e){return isInteger(e)&&e>=-R&&e<=R}var Ws=hr?baseUnary(hr):baseIsSet;function isString(e){return typeof e=="string"||!Ns(e)&&isObjectLike(e)&&baseGetTag(e)==ae}function isSymbol(e){return typeof e=="symbol"||isObjectLike(e)&&baseGetTag(e)==ne}var Us=br?baseUnary(br):baseIsTypedArray;function isUndefined(e){return e===r}function isWeakMap(e){return isObjectLike(e)&&qr(e)==ie}function isWeakSet(e){return isObjectLike(e)&&baseGetTag(e)==le}var Vs=createRelationalOperation(baseLt);var $s=createRelationalOperation((function(e,t){return e<=t}));function toArray(e){if(!e){return[]}if(isArrayLike(e)){return isString(e)?stringToArray(e):copyArray(e)}if(Dt&&e[Dt]){return iteratorToArray(e[Dt]())}var t=qr(e),r=t==Y?mapToArray:t==se?setToArray:values;return r(e)}function toFinite(e){if(!e){return e===0?e:0}e=toNumber(e);if(e===A||e===-A){var t=e<0?-1:1;return t*N}return e===e?e:0}function toInteger(e){var t=toFinite(e),r=t%1;return t===t?r?t-r:t:0}function toLength(e){return e?baseClamp(toInteger(e),0,L):0}function toNumber(e){if(typeof e=="number"){return e}if(isSymbol(e)){return M}if(isObject(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=isObject(t)?t+"":t}if(typeof e!="string"){return e===0?e:+e}e=e.replace(Te,"");var r=He.test(e);return r||Ke.test(e)?ar(e.slice(2),r?2:8):Ge.test(e)?M:+e}function toPlainObject(e){return copyObject(e,keysIn(e))}function toSafeInteger(e){return e?baseClamp(toInteger(e),-R,R):e===0?e:0}function toString(e){return e==null?"":baseToString(e)}var qs=createAssigner((function(e,t){if(isPrototype(t)||isArrayLike(t)){copyObject(t,keys(t),e);return}for(var r in t){if(dt.call(t,r)){assignValue(e,r,t[r])}}}));var Gs=createAssigner((function(e,t){copyObject(t,keysIn(t),e)}));var Hs=createAssigner((function(e,t,r,s){copyObject(t,keysIn(t),e,s)}));var zs=createAssigner((function(e,t,r,s){copyObject(t,keys(t),e,s)}));var Ks=flatRest(baseAt);function create(e,t){var r=Cr(e);return t==null?r:baseAssign(r,t)}var Xs=baseRest((function(e,t){e=rt(e);var s=-1;var a=t.length;var n=a>2?t[2]:r;if(n&&isIterateeCall(t[0],t[1],n)){a=1}while(++s1);return t}));copyObject(e,getAllKeysIn(e),r);if(s){r=baseClone(r,u|p|f,customOmitClone)}var a=t.length;while(a--){baseUnset(r,t[a])}return r}));function omitBy(e,t){return pickBy(e,negate(getIteratee(t)))}var sa=flatRest((function(e,t){return e==null?{}:basePick(e,t)}));function pickBy(e,t){if(e==null){return{}}var r=arrayMap(getAllKeysIn(e),(function(e){return[e]}));t=getIteratee(t);return basePickBy(e,r,(function(e,r){return t(e,r[0])}))}function result(e,t,s){t=castPath(t,e);var a=-1,n=t.length;if(!n){n=1;e=r}while(++at){var a=e;e=t;t=a}if(s||e%1||t%1){var n=Qt();return Ht(e+n*(t-e+sr("1e-"+((n+"").length-1))),t)}return baseRandom(e,t)}var oa=createCompounder((function(e,t,r){t=t.toLowerCase();return e+(r?capitalize(t):t)}));function capitalize(e){return da(toString(e).toLowerCase())}function deburr(e){e=toString(e);return e&&e.replace(Ye,vr).replace(qt,"")}function endsWith(e,t,s){e=toString(e);t=baseToString(t);var a=e.length;s=s===r?a:baseClamp(toInteger(s),0,a);var n=s;s-=t.length;return s>=0&&e.slice(s,n)==t}function escape(e){e=toString(e);return e&&ke.test(e)?e.replace(_e,Er):e}function escapeRegExp(e){e=toString(e);return e&&Ne.test(e)?e.replace(Re,"\\$&"):e}var ia=createCompounder((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}));var la=createCompounder((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}));var ca=createCaseFirst("toLowerCase");function pad(e,t,r){e=toString(e);t=toInteger(t);var s=t?stringSize(e):0;if(!t||s>=t){return e}var a=(t-s)/2;return createPadding(Lt(a),r)+e+createPadding(Mt(a),r)}function padEnd(e,t,r){e=toString(e);t=toInteger(t);var s=t?stringSize(e):0;return t&&s>>0;if(!s){return[]}e=toString(e);if(e&&(typeof t=="string"||t!=null&&!Bs(t))){t=baseToString(t);if(!t&&hasUnicode(e)){return castSlice(stringToArray(e),0,s)}}return e.split(t,s)}var pa=createCompounder((function(e,t,r){return e+(r?" ":"")+da(t)}));function startsWith(e,t,r){e=toString(e);r=r==null?0:baseClamp(toInteger(r),0,e.length);t=baseToString(t);return e.slice(r,r+t.length)==t}function template(e,t,s){var a=lodash.templateSettings;if(s&&isIterateeCall(e,t,s)){t=r}e=toString(e);t=Hs({},t,a,customDefaultsAssignIn);var n=Hs({},t.imports,a.imports,customDefaultsAssignIn),o=keys(n),i=baseValues(n,o);var l,c,u=0,p=t.interpolate||Je,f="__p += '";var d=st((t.escape||Je).source+"|"+p.source+"|"+(p===Pe?$e:Je).source+"|"+(t.evaluate||Je).source+"|$","g");var m="//# sourceURL="+(dt.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Yt+"]")+"\n";e.replace(d,(function(t,r,s,a,n,o){s||(s=a);f+=e.slice(u,o).replace(Ze,escapeStringChar);if(r){l=true;f+="' +\n__e("+r+") +\n'"}if(n){c=true;f+="';\n"+n+";\n__p += '"}if(s){f+="' +\n((__t = ("+s+")) == null ? '' : __t) +\n'"}u=o+t.length;return t}));f+="';\n";var y=dt.call(t,"variable")&&t.variable;if(!y){f="with (obj) {\n"+f+"\n}\n"}f=(c?f.replace(ve,""):f).replace(Ee,"$1").replace(je,"$1;");f="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(l?", __e = _.escape":"")+(c?", __j = Array.prototype.join;\n"+"function print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var g=ma((function(){return et(o,m+"return "+f).apply(r,i)}));g.source=f;if(isError(g)){throw g}return g}function toLower(e){return toString(e).toLowerCase()}function toUpper(e){return toString(e).toUpperCase()}function trim(e,t,s){e=toString(e);if(e&&(s||t===r)){return e.replace(Te,"")}if(!e||!(t=baseToString(t))){return e}var a=stringToArray(e),n=stringToArray(t),o=charsStartIndex(a,n),i=charsEndIndex(a,n)+1;return castSlice(a,o,i).join("")}function trimEnd(e,t,s){e=toString(e);if(e&&(s||t===r)){return e.replace(Le,"")}if(!e||!(t=baseToString(t))){return e}var a=stringToArray(e),n=charsEndIndex(a,stringToArray(t))+1;return castSlice(a,0,n).join("")}function trimStart(e,t,s){e=toString(e);if(e&&(s||t===r)){return e.replace(Me,"")}if(!e||!(t=baseToString(t))){return e}var a=stringToArray(e),n=charsStartIndex(a,stringToArray(t));return castSlice(a,n).join("")}function truncate(e,t){var s=S,a=k;if(isObject(t)){var n="separator"in t?t.separator:n;s="length"in t?toInteger(t.length):s;a="omission"in t?baseToString(t.omission):a}e=toString(e);var o=e.length;if(hasUnicode(e)){var i=stringToArray(e);o=i.length}if(s>=o){return e}var l=s-stringSize(a);if(l<1){return a}var c=i?castSlice(i,0,l).join(""):e.slice(0,l);if(n===r){return c+a}if(i){l+=c.length-l}if(Bs(n)){if(e.slice(l).search(n)){var u,p=c;if(!n.global){n=st(n.source,toString(qe.exec(n))+"g")}n.lastIndex=0;while(u=n.exec(p)){var f=u.index}c=c.slice(0,f===r?l:f)}}else if(e.indexOf(baseToString(n),l)!=l){var d=c.lastIndexOf(n);if(d>-1){c=c.slice(0,d)}}return c+a}function unescape(e){e=toString(e);return e&&Se.test(e)?e.replace(we,jr):e}var fa=createCompounder((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}));var da=createCaseFirst("toUpperCase");function words(e,t,s){e=toString(e);t=s?r:t;if(t===r){return hasUnicodeWord(e)?unicodeWords(e):asciiWords(e)}return e.match(t)||[]}var ma=baseRest((function(e,t){try{return apply(e,r,t)}catch(e){return isError(e)?e:new Qe(e)}}));var ya=flatRest((function(e,t){arrayEach(t,(function(t){t=toKey(t);baseAssignValue(e,t,ws(e[t],e))}));return e}));function cond(e){var t=e==null?0:e.length,r=getIteratee();e=!t?[]:arrayMap(e,(function(e){if(typeof e[1]!="function"){throw new nt(o)}return[r(e[0]),e[1]]}));return baseRest((function(r){var s=-1;while(++sR){return[]}var r=L,s=Ht(e,L);t=getIteratee(t);e-=L;var a=baseTimes(s,t);while(++r0||t<0)){return new LazyWrapper(s)}if(e<0){s=s.takeRight(-e)}else if(e){s=s.drop(e)}if(t!==r){t=toInteger(t);s=t<0?s.dropRight(-t):s.take(t-e)}return s};LazyWrapper.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()};LazyWrapper.prototype.toArray=function(){return this.take(L)};baseForOwn(LazyWrapper.prototype,(function(e,t){var s=/^(?:filter|find|map|reject)|While$/.test(t),a=/^(?:head|last)$/.test(t),n=lodash[a?"take"+(t=="last"?"Right":""):t],o=a||/^find/.test(t);if(!n){return}lodash.prototype[t]=function(){var t=this.__wrapped__,i=a?[1]:arguments,l=t instanceof LazyWrapper,c=i[0],u=l||Ns(t);var interceptor=function(e){var t=n.apply(lodash,arrayPush([e],i));return a&&p?t[0]:t};if(u&&s&&typeof c=="function"&&c.length!=1){l=u=false}var p=this.__chain__,f=!!this.__actions__.length,d=o&&!p,m=l&&!f;if(!o&&u){t=m?t:new LazyWrapper(this);var y=e.apply(t,i);y.__actions__.push({func:thru,args:[interceptor],thisArg:r});return new LodashWrapper(y,p)}if(d&&m){return e.apply(this,i)}y=this.thru(interceptor);return d?a?y.value()[0]:y.value():y}}));arrayEach(["pop","push","shift","sort","splice","unshift"],(function(e){var t=ot[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",s=/^(?:pop|shift)$/.test(e);lodash.prototype[e]=function(){var e=arguments;if(s&&!this.__chain__){var a=this.value();return t.apply(Ns(a)?a:[],e)}return this[r]((function(r){return t.apply(Ns(r)?r:[],e)}))}}));baseForOwn(LazyWrapper.prototype,(function(e,t){var r=lodash[t];if(r){var s=r.name+"";if(!dt.call(fr,s)){fr[s]=[]}fr[s].push({name:t,func:r})}}));fr[createHybrid(r,g).name]=[{name:"wrapper",func:r}];LazyWrapper.prototype.clone=lazyClone;LazyWrapper.prototype.reverse=lazyReverse;LazyWrapper.prototype.value=lazyValue;lodash.prototype.at=ds;lodash.prototype.chain=wrapperChain;lodash.prototype.commit=wrapperCommit;lodash.prototype.next=wrapperNext;lodash.prototype.plant=wrapperPlant;lodash.prototype.reverse=wrapperReverse;lodash.prototype.toJSON=lodash.prototype.valueOf=lodash.prototype.value=wrapperValue;lodash.prototype.first=lodash.prototype.head;if(Dt){lodash.prototype[Dt]=wrapperToIterator}return lodash};var _r=wr();if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){ir._=_r;define((function(){return _r}))}else if(cr){(cr.exports=_r)._=_r;lr._=_r}else{ir._=_r}}).call(this)},2742:e=>{"use strict";var t=process.platform==="win32";var r=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;var s=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/;var a={};function win32SplitPath(e){var t=r.exec(e),a=(t[1]||"")+(t[2]||""),n=t[3]||"";var o=s.exec(n),i=o[1],l=o[2],c=o[3];return[a,i,l,c]}a.parse=function(e){if(typeof e!=="string"){throw new TypeError("Parameter 'pathString' must be a string, not "+typeof e)}var t=win32SplitPath(e);if(!t||t.length!==4){throw new TypeError("Invalid path '"+e+"'")}return{root:t[0],dir:t[0]+t[1].slice(0,-1),base:t[2],ext:t[3],name:t[2].slice(0,t[2].length-t[3].length)}};var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var o={};function posixSplitPath(e){return n.exec(e).slice(1)}o.parse=function(e){if(typeof e!=="string"){throw new TypeError("Parameter 'pathString' must be a string, not "+typeof e)}var t=posixSplitPath(e);if(!t||t.length!==4){throw new TypeError("Invalid path '"+e+"'")}t[1]=t[1]||"";t[2]=t[2]||"";t[3]=t[3]||"";return{root:t[0],dir:t[0]+t[1].slice(0,-1),base:t[2],ext:t[3],name:t[2].slice(0,t[2].length-t[3].length)}};if(t)e.exports=a.parse;else e.exports=o.parse;e.exports.posix=o.parse;e.exports.win32=a.parse},1782:(e,t)=>{"use strict";var r=Object;var s=Object.defineProperty;var a=Object.create;function defProp(e,t,a){if(s)try{s.call(r,e,t,{value:a})}catch(r){e[t]=a}else{e[t]=a}}function makeSafeToCall(e){if(e){defProp(e,"call",e.call);defProp(e,"apply",e.apply)}return e}makeSafeToCall(s);makeSafeToCall(a);var n=makeSafeToCall(Object.prototype.hasOwnProperty);var o=makeSafeToCall(Number.prototype.toString);var i=makeSafeToCall(String.prototype.slice);var cloner=function(){};function create(e){if(a){return a.call(r,e)}cloner.prototype=e||null;return new cloner}var l=Math.random;var c=create(null);function makeUniqueKey(){do{var e=internString(i.call(o.call(l(),36),2))}while(n.call(c,e));return c[e]=e}function internString(e){var t={};t[e]=true;return Object.keys(t)[0]}t.makeUniqueKey=makeUniqueKey;var u=Object.getOwnPropertyNames;Object.getOwnPropertyNames=function getOwnPropertyNames(e){for(var t=u(e),r=0,s=0,a=t.length;rs){t[s]=t[r]}++s}}t.length=s;return t};function defaultCreatorFn(e){return create(null)}function makeAccessor(e){var t=makeUniqueKey();var r=create(null);e=e||defaultCreatorFn;function register(s){var a;function vault(t,n){if(t===r){return n?a=null:a||(a=e(s))}}defProp(s,t,vault)}function accessor(e){if(!n.call(e,t))register(e);return e[t](r)}accessor.forget=function(e){if(n.call(e,t))e[t](r,true)};return accessor}t.makeAccessor=makeAccessor},8741:function(e,t,r){e=r.nmd(e); -/*! https://mths.be/regenerate v1.3.3 by @mathias | MIT license */(function(r){var s=true&&t;var a=true&&e&&e.exports==s&&e;var n=typeof global=="object"&&global;if(n.global===n||n.window===n){r=n}var o={rangeOrder:"A range’s `stop` value must be greater than or equal "+"to the `start` value.",codePointRange:"Invalid code point value. Code points range from "+"U+000000 to U+10FFFF."};var i=55296;var l=56319;var c=56320;var u=57343;var p=/\\x00([^0123456789]|$)/g;var f={};var d=f.hasOwnProperty;var extend=function(e,t){var r;for(r in t){if(d.call(t,r)){e[r]=t[r]}}return e};var forEach=function(e,t){var r=-1;var s=e.length;while(++r=s&&tr){return e}if(t<=a&&r>=n){e.splice(s,2);continue}if(t>=a&&r=a&&t<=n){e[s+1]=t}else if(r>=a&&r<=n){e[s]=r+1;return e}s+=2}return e};var dataAdd=function(e,t){var r=0;var s;var a;var n=null;var i=e.length;if(t<0||t>1114111){throw RangeError(o.codePointRange)}while(r=s&&tt){e.splice(n!=null?n+2:0,0,t,t+1);return e}if(t==a){if(t+1==e[r+2]){e.splice(r,4,s,e[r+3]);return e}e[r+1]=t+1;return e}n=r;r+=2}e.push(t,t+1);return e};var dataAddData=function(e,t){var r=0;var s;var a;var n=e.slice();var o=t.length;while(r1114111||r<0||r>1114111){throw RangeError(o.codePointRange)}var s=0;var a;var n;var i=false;var l=e.length;while(sr){return e}if(a>=t&&a<=r){if(n>t&&n-1<=r){e.splice(s,2);s-=2}else{e.splice(s-1,2);s-=2}}}else if(a==r+1){e[s]=t;return e}else if(a>r){e.splice(s,0,t,r+1);return e}else if(t>=a&&t=a&&t=n){e[s]=t;e[s+1]=r+1;i=true}s+=2}if(!i){e.push(t,r+1)}return e};var dataContains=function(e,t){var r=0;var s=e.length;var a=e[r];var n=e[s-1];if(s>=2){if(tn){return false}}while(r=a&&t=40&&e<=43||e==46||e==47||e==63||e>=91&&e<=94||e>=123&&e<=125){t="\\"+b(e)}else if(e>=32&&e<=126){t=b(e)}else if(e<=255){t="\\x"+pad(hex(e),2)}else{t="\\u"+pad(hex(e),4)}return t};var codePointToStringUnicode=function(e){if(e<=65535){return codePointToString(e)}return"\\u{"+e.toString(16).toUpperCase()+"}"};var symbolToCodePoint=function(e){var t=e.length;var r=e.charCodeAt(0);var s;if(r>=i&&r<=l&&t>1){s=e.charCodeAt(1);return(r-i)*1024+s-c+65536}return r};var createBMPCharacterClasses=function(e){var t="";var r=0;var s;var a;var n=e.length;if(dataIsSingleton(e)){return codePointToString(e[0])}while(r=i&&p<=l){s.push(o,i);t.push(i,p+1)}if(p>=c&&p<=u){s.push(o,i);t.push(i,l+1);r.push(c,p+1)}if(p>u){s.push(o,i);t.push(i,l+1);r.push(c,u+1);if(p<=65535){s.push(u+1,p+1)}else{s.push(u+1,65535+1);a.push(65535+1,p+1)}}}else if(o>=i&&o<=l){if(p>=i&&p<=l){t.push(o,p+1)}if(p>=c&&p<=u){t.push(o,l+1);r.push(c,p+1)}if(p>u){t.push(o,l+1);r.push(c,u+1);if(p<=65535){s.push(u+1,p+1)}else{s.push(u+1,65535+1);a.push(65535+1,p+1)}}}else if(o>=c&&o<=u){if(p>=c&&p<=u){r.push(o,p+1)}if(p>u){r.push(o,u+1);if(p<=65535){s.push(u+1,p+1)}else{s.push(u+1,65535+1);a.push(65535+1,p+1)}}}else if(o>u&&o<=65535){if(p<=65535){s.push(o,p+1)}else{s.push(o,65535+1);a.push(65535+1,p+1)}}else{a.push(o,p+1)}n+=2}return{loneHighSurrogates:t,loneLowSurrogates:r,bmp:s,astral:a}};var optimizeSurrogateMappings=function(e){var t=[];var r=[];var s=false;var a;var n;var o;var i;var l;var c;var u=-1;var p=e.length;while(++u1){e=g.call(arguments)}if(this instanceof regenerate){this.data=[];return e?this.add(e):this}return(new regenerate).add(e)};regenerate.version="1.3.3";var x=regenerate.prototype;extend(x,{add:function(e){var t=this;if(e==null){return t}if(e instanceof regenerate){t.data=dataAddData(t.data,e.data);return t}if(arguments.length>1){e=g.call(arguments)}if(isArray(e)){forEach(e,(function(e){t.add(e)}));return t}t.data=dataAdd(t.data,isNumber(e)?e:symbolToCodePoint(e));return t},remove:function(e){var t=this;if(e==null){return t}if(e instanceof regenerate){t.data=dataRemoveData(t.data,e.data);return t}if(arguments.length>1){e=g.call(arguments)}if(isArray(e)){forEach(e,(function(e){t.remove(e)}));return t}t.data=dataRemove(t.data,isNumber(e)?e:symbolToCodePoint(e));return t},addRange:function(e,t){var r=this;r.data=dataAddRange(r.data,isNumber(e)?e:symbolToCodePoint(e),isNumber(t)?t:symbolToCodePoint(t));return r},removeRange:function(e,t){var r=this;var s=isNumber(e)?e:symbolToCodePoint(e);var a=isNumber(t)?t:symbolToCodePoint(t);r.data=dataRemoveRange(r.data,s,a);return r},intersection:function(e){var t=this;var r=e instanceof regenerate?dataToArray(e.data):e;t.data=dataIntersection(t.data,r);return t},contains:function(e){return dataContains(this.data,isNumber(e)?e:symbolToCodePoint(e))},clone:function(){var e=new regenerate;e.data=this.data.slice(0);return e},toString:function(e){var t=createCharacterClassesFromData(this.data,e?e.bmpOnly:false,e?e.hasUnicodeFlag:false);if(!t){return"[]"}return t.replace(p,"\\0$1")},toRegExp:function(e){var t=this.toString(e&&e.indexOf("u")!=-1?{hasUnicodeFlag:true}:null);return RegExp(t,e||"")},valueOf:function(){return dataToArray(this.data)}});x.toArray=x.valueOf;if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define((function(){return regenerate}))}else if(s&&!s.nodeType){if(a){a.exports=regenerate}else{s.regenerate=regenerate}}else{r.regenerate=regenerate}})(this)},6419:(e,t,r)=>{"use strict";var s=r(449);var a=r(6919);var n=a(r(9491));var o=s(r(9048));var i=s(r(3085));var l=s(r(6401));var c=Object.prototype.hasOwnProperty;function Emitter(e){n["default"].ok(this instanceof Emitter);l.getTypes().assertIdentifier(e);this.nextTempId=0;this.contextId=e;this.listing=[];this.marked=[true];this.insertedLocs=new Set;this.finalLoc=this.loc();this.tryEntries=[];this.leapManager=new o.LeapManager(this)}var u=Emitter.prototype;t.Emitter=Emitter;u.loc=function(){var e=l.getTypes().numericLiteral(-1);this.insertedLocs.add(e);return e};u.getInsertedLocs=function(){return this.insertedLocs};u.getContextId=function(){return l.getTypes().clone(this.contextId)};u.mark=function(e){l.getTypes().assertLiteral(e);var t=this.listing.length;if(e.value===-1){e.value=t}else{n["default"].strictEqual(e.value,t)}this.marked[t]=true;return e};u.emit=function(e){var t=l.getTypes();if(t.isExpression(e)){e=t.expressionStatement(e)}t.assertStatement(e);this.listing.push(e)};u.emitAssign=function(e,t){this.emit(this.assign(e,t));return e};u.assign=function(e,t){var r=l.getTypes();return r.expressionStatement(r.assignmentExpression("=",r.cloneDeep(e),t))};u.contextProperty=function(e,t){var r=l.getTypes();return r.memberExpression(this.getContextId(),t?r.stringLiteral(e):r.identifier(e),!!t)};u.stop=function(e){if(e){this.setReturnValue(e)}this.jump(this.finalLoc)};u.setReturnValue=function(e){l.getTypes().assertExpression(e.value);this.emitAssign(this.contextProperty("rval"),this.explodeExpression(e))};u.clearPendingException=function(e,t){var r=l.getTypes();r.assertLiteral(e);var s=r.callExpression(this.contextProperty("catch",true),[r.clone(e)]);if(t){this.emitAssign(t,s)}else{this.emit(s)}};u.jump=function(e){this.emitAssign(this.contextProperty("next"),e);this.emit(l.getTypes().breakStatement())};u.jumpIf=function(e,t){var r=l.getTypes();r.assertExpression(e);r.assertLiteral(t);this.emit(r.ifStatement(e,r.blockStatement([this.assign(this.contextProperty("next"),t),r.breakStatement()])))};u.jumpIfNot=function(e,t){var r=l.getTypes();r.assertExpression(e);r.assertLiteral(t);var s;if(r.isUnaryExpression(e)&&e.operator==="!"){s=e.argument}else{s=r.unaryExpression("!",e)}this.emit(r.ifStatement(s,r.blockStatement([this.assign(this.contextProperty("next"),t),r.breakStatement()])))};u.makeTempVar=function(){return this.contextProperty("t"+this.nextTempId++)};u.getContextFunction=function(e){var t=l.getTypes();return t.functionExpression(e||null,[this.getContextId()],t.blockStatement([this.getDispatchLoop()]),false,false)};u.getDispatchLoop=function(){var e=this;var t=l.getTypes();var r=[];var s;var a=false;e.listing.forEach((function(n,o){if(e.marked.hasOwnProperty(o)){r.push(t.switchCase(t.numericLiteral(o),s=[]));a=false}if(!a){s.push(n);if(t.isCompletionStatement(n))a=true}}));this.finalLoc.value=this.listing.length;r.push(t.switchCase(this.finalLoc,[]),t.switchCase(t.stringLiteral("end"),[t.returnStatement(t.callExpression(this.contextProperty("stop"),[]))]));return t.whileStatement(t.numericLiteral(1),t.switchStatement(t.assignmentExpression("=",this.contextProperty("prev"),this.contextProperty("next")),r))};u.getTryLocsList=function(){if(this.tryEntries.length===0){return null}var e=l.getTypes();var t=0;return e.arrayExpression(this.tryEntries.map((function(r){var s=r.firstLoc.value;n["default"].ok(s>=t,"try entries out of order");t=s;var a=r.catchEntry;var o=r.finallyEntry;var i=[r.firstLoc,a?a.firstLoc:null];if(o){i[2]=o.firstLoc;i[3]=o.afterLoc}return e.arrayExpression(i.map((function(t){return t&&e.clone(t)})))})))};u.explode=function(e,t){var r=l.getTypes();var s=e.node;var a=this;r.assertNode(s);if(r.isDeclaration(s))throw getDeclError(s);if(r.isStatement(s))return a.explodeStatement(e);if(r.isExpression(s))return a.explodeExpression(e,t);switch(s.type){case"Program":return e.get("body").map(a.explodeStatement,a);case"VariableDeclarator":throw getDeclError(s);case"Property":case"SwitchCase":case"CatchClause":throw new Error(s.type+" nodes should be handled by their parents");default:throw new Error("unknown Node of type "+JSON.stringify(s.type))}};function getDeclError(e){return new Error("all declarations should have been transformed into "+"assignments before the Exploder began its work: "+JSON.stringify(e))}u.explodeStatement=function(e,t){var r=l.getTypes();var s=e.node;var a=this;var c,u,f;r.assertStatement(s);if(t){r.assertIdentifier(t)}else{t=null}if(r.isBlockStatement(s)){e.get("body").forEach((function(e){a.explodeStatement(e)}));return}if(!i.containsLeap(s)){a.emit(s);return}switch(s.type){case"ExpressionStatement":a.explodeExpression(e.get("expression"),true);break;case"LabeledStatement":u=this.loc();a.leapManager.withEntry(new o.LabeledEntry(u,s.label),(function(){a.explodeStatement(e.get("body"),s.label)}));a.mark(u);break;case"WhileStatement":c=this.loc();u=this.loc();a.mark(c);a.jumpIfNot(a.explodeExpression(e.get("test")),u);a.leapManager.withEntry(new o.LoopEntry(u,c,t),(function(){a.explodeStatement(e.get("body"))}));a.jump(c);a.mark(u);break;case"DoWhileStatement":var d=this.loc();var m=this.loc();u=this.loc();a.mark(d);a.leapManager.withEntry(new o.LoopEntry(u,m,t),(function(){a.explode(e.get("body"))}));a.mark(m);a.jumpIf(a.explodeExpression(e.get("test")),d);a.mark(u);break;case"ForStatement":f=this.loc();var y=this.loc();u=this.loc();if(s.init){a.explode(e.get("init"),true)}a.mark(f);if(s.test){a.jumpIfNot(a.explodeExpression(e.get("test")),u)}else{}a.leapManager.withEntry(new o.LoopEntry(u,y,t),(function(){a.explodeStatement(e.get("body"))}));a.mark(y);if(s.update){a.explode(e.get("update"),true)}a.jump(f);a.mark(u);break;case"TypeCastExpression":return a.explodeExpression(e.get("expression"));case"ForInStatement":f=this.loc();u=this.loc();var g=a.makeTempVar();a.emitAssign(g,r.callExpression(l.runtimeProperty("keys"),[a.explodeExpression(e.get("right"))]));a.mark(f);var h=a.makeTempVar();a.jumpIf(r.memberExpression(r.assignmentExpression("=",h,r.callExpression(r.cloneDeep(g),[])),r.identifier("done"),false),u);a.emitAssign(s.left,r.memberExpression(r.cloneDeep(h),r.identifier("value"),false));a.leapManager.withEntry(new o.LoopEntry(u,f,t),(function(){a.explodeStatement(e.get("body"))}));a.jump(f);a.mark(u);break;case"BreakStatement":a.emitAbruptCompletion({type:"break",target:a.leapManager.getBreakLoc(s.label)});break;case"ContinueStatement":a.emitAbruptCompletion({type:"continue",target:a.leapManager.getContinueLoc(s.label)});break;case"SwitchStatement":var b=a.emitAssign(a.makeTempVar(),a.explodeExpression(e.get("discriminant")));u=this.loc();var x=this.loc();var v=x;var E=[];var j=s.cases||[];for(var w=j.length-1;w>=0;--w){var _=j[w];r.assertSwitchCase(_);if(_.test){v=r.conditionalExpression(r.binaryExpression("===",r.cloneDeep(b),_.test),E[w]=this.loc(),v)}else{E[w]=x}}var S=e.get("discriminant");l.replaceWithOrRemove(S,v);a.jump(a.explodeExpression(S));a.leapManager.withEntry(new o.SwitchEntry(u),(function(){e.get("cases").forEach((function(e){var t=e.key;a.mark(E[t]);e.get("consequent").forEach((function(e){a.explodeStatement(e)}))}))}));a.mark(u);if(x.value===-1){a.mark(x);n["default"].strictEqual(u.value,x.value)}break;case"IfStatement":var k=s.alternate&&this.loc();u=this.loc();a.jumpIfNot(a.explodeExpression(e.get("test")),k||u);a.explodeStatement(e.get("consequent"));if(k){a.jump(u);a.mark(k);a.explodeStatement(e.get("alternate"))}a.mark(u);break;case"ReturnStatement":a.emitAbruptCompletion({type:"return",value:a.explodeExpression(e.get("argument"))});break;case"WithStatement":throw new Error("WithStatement not supported in generator functions.");case"TryStatement":u=this.loc();var O=s.handler;var I=O&&this.loc();var P=I&&new o.CatchEntry(I,O.param);var D=s.finalizer&&this.loc();var C=D&&new o.FinallyEntry(D,u);var A=new o.TryEntry(a.getUnmarkedCurrentLoc(),P,C);a.tryEntries.push(A);a.updateContextPrevLoc(A.firstLoc);a.leapManager.withEntry(A,(function(){a.explodeStatement(e.get("block"));if(I){if(D){a.jump(D)}else{a.jump(u)}a.updateContextPrevLoc(a.mark(I));var t=e.get("handler.body");var s=a.makeTempVar();a.clearPendingException(A.firstLoc,s);t.traverse(p,{getSafeParam:function getSafeParam(){return r.cloneDeep(s)},catchParamName:O.param.name});a.leapManager.withEntry(P,(function(){a.explodeStatement(t)}))}if(D){a.updateContextPrevLoc(a.mark(D));a.leapManager.withEntry(C,(function(){a.explodeStatement(e.get("finalizer"))}));a.emit(r.returnStatement(r.callExpression(a.contextProperty("finish"),[C.firstLoc])))}}));a.mark(u);break;case"ThrowStatement":a.emit(r.throwStatement(a.explodeExpression(e.get("argument"))));break;default:throw new Error("unknown Statement of type "+JSON.stringify(s.type))}};var p={Identifier:function Identifier(e,t){if(e.node.name===t.catchParamName&&l.isReference(e)){l.replaceWithOrRemove(e,t.getSafeParam())}},Scope:function Scope(e,t){if(e.scope.hasOwnBinding(t.catchParamName)){e.skip()}}};u.emitAbruptCompletion=function(e){if(!isValidCompletion(e)){n["default"].ok(false,"invalid completion record: "+JSON.stringify(e))}n["default"].notStrictEqual(e.type,"normal","normal completions are not abrupt");var t=l.getTypes();var r=[t.stringLiteral(e.type)];if(e.type==="break"||e.type==="continue"){t.assertLiteral(e.target);r[1]=this.insertedLocs.has(e.target)?e.target:t.cloneDeep(e.target)}else if(e.type==="return"||e.type==="throw"){if(e.value){t.assertExpression(e.value);r[1]=this.insertedLocs.has(e.value)?e.value:t.cloneDeep(e.value)}}this.emit(t.returnStatement(t.callExpression(this.contextProperty("abrupt"),r)))};function isValidCompletion(e){var t=e.type;if(t==="normal"){return!c.call(e,"target")}if(t==="break"||t==="continue"){return!c.call(e,"value")&&l.getTypes().isLiteral(e.target)}if(t==="return"||t==="throw"){return c.call(e,"value")&&!c.call(e,"target")}return false}u.getUnmarkedCurrentLoc=function(){return l.getTypes().numericLiteral(this.listing.length)};u.updateContextPrevLoc=function(e){var t=l.getTypes();if(e){t.assertLiteral(e);if(e.value===-1){e.value=this.listing.length}else{n["default"].strictEqual(e.value,this.listing.length)}}else{e=this.getUnmarkedCurrentLoc()}this.emitAssign(this.contextProperty("prev"),e)};u.explodeExpression=function(e,t){var r=l.getTypes();var s=e.node;if(s){r.assertExpression(s)}else{return s}var a=this;var o;var c;function finish(e){r.assertExpression(e);if(t){a.emit(e)}else{return e}}if(!i.containsLeap(s)){return finish(s)}var u=i.containsLeap.onlyChildren(s);function explodeViaTempVar(e,t,s){n["default"].ok(!s||!e,"Ignoring the result of a child expression but forcing it to "+"be assigned to a temporary variable?");var o=a.explodeExpression(t,s);if(s){}else if(e||u&&!r.isLiteral(o)){o=a.emitAssign(e||a.makeTempVar(),o)}return o}switch(s.type){case"MemberExpression":return finish(r.memberExpression(a.explodeExpression(e.get("object")),s.computed?explodeViaTempVar(null,e.get("property")):s.property,s.computed));case"CallExpression":var p=e.get("callee");var f=e.get("arguments");var d;var m;var y=f.some((function(e){return i.containsLeap(e.node)}));var g=null;if(r.isMemberExpression(p.node)){if(y){var h=explodeViaTempVar(a.makeTempVar(),p.get("object"));var b=p.node.computed?explodeViaTempVar(null,p.get("property")):p.node.property;g=h;d=r.memberExpression(r.memberExpression(r.cloneDeep(h),b,p.node.computed),r.identifier("call"),false)}else{d=a.explodeExpression(p)}}else{d=explodeViaTempVar(null,p);if(r.isMemberExpression(d)){d=r.sequenceExpression([r.numericLiteral(0),r.cloneDeep(d)])}}if(y){m=f.map((function(e){return explodeViaTempVar(null,e)}));if(g)m.unshift(g);m=m.map((function(e){return r.cloneDeep(e)}))}else{m=e.node.arguments}return finish(r.callExpression(d,m));case"NewExpression":return finish(r.newExpression(explodeViaTempVar(null,e.get("callee")),e.get("arguments").map((function(e){return explodeViaTempVar(null,e)}))));case"ObjectExpression":return finish(r.objectExpression(e.get("properties").map((function(e){if(e.isObjectProperty()){return r.objectProperty(e.node.key,explodeViaTempVar(null,e.get("value")),e.node.computed)}else{return e.node}}))));case"ArrayExpression":return finish(r.arrayExpression(e.get("elements").map((function(e){if(e.isSpreadElement()){return r.spreadElement(explodeViaTempVar(null,e.get("argument")))}else{return explodeViaTempVar(null,e)}}))));case"SequenceExpression":var x=s.expressions.length-1;e.get("expressions").forEach((function(e){if(e.key===x){o=a.explodeExpression(e,t)}else{a.explodeExpression(e,true)}}));return o;case"LogicalExpression":c=this.loc();if(!t){o=a.makeTempVar()}var v=explodeViaTempVar(o,e.get("left"));if(s.operator==="&&"){a.jumpIfNot(v,c)}else{n["default"].strictEqual(s.operator,"||");a.jumpIf(v,c)}explodeViaTempVar(o,e.get("right"),t);a.mark(c);return o;case"ConditionalExpression":var E=this.loc();c=this.loc();var j=a.explodeExpression(e.get("test"));a.jumpIfNot(j,E);if(!t){o=a.makeTempVar()}explodeViaTempVar(o,e.get("consequent"),t);a.jump(c);a.mark(E);explodeViaTempVar(o,e.get("alternate"),t);a.mark(c);return o;case"UnaryExpression":return finish(r.unaryExpression(s.operator,a.explodeExpression(e.get("argument")),!!s.prefix));case"BinaryExpression":return finish(r.binaryExpression(s.operator,explodeViaTempVar(null,e.get("left")),explodeViaTempVar(null,e.get("right"))));case"AssignmentExpression":if(s.operator==="="){return finish(r.assignmentExpression(s.operator,a.explodeExpression(e.get("left")),a.explodeExpression(e.get("right"))))}var w=a.explodeExpression(e.get("left"));var _=a.emitAssign(a.makeTempVar(),w);return finish(r.assignmentExpression("=",r.cloneDeep(w),r.assignmentExpression(s.operator,r.cloneDeep(_),a.explodeExpression(e.get("right")))));case"UpdateExpression":return finish(r.updateExpression(s.operator,a.explodeExpression(e.get("argument")),s.prefix));case"YieldExpression":c=this.loc();var S=s.argument&&a.explodeExpression(e.get("argument"));if(S&&s.delegate){var k=a.makeTempVar();var O=r.returnStatement(r.callExpression(a.contextProperty("delegateYield"),[S,r.stringLiteral(k.property.name),c]));O.loc=s.loc;a.emit(O);a.mark(c);return k}a.emitAssign(a.contextProperty("next"),c);var I=r.returnStatement(r.cloneDeep(S)||null);I.loc=s.loc;a.emit(I);a.mark(c);return a.contextProperty("sent");default:throw new Error("unknown Expression of type "+JSON.stringify(s.type))}}},5604:(e,t,r)=>{"use strict";var s=r(449);var a=s(r(6401));var n=Object.prototype.hasOwnProperty;t.hoist=function(e){var t=a.getTypes();t.assertFunction(e.node);var r={};function varDeclToExpr(e,s){var a=e.node,n=e.scope;t.assertVariableDeclaration(a);var o=[];a.declarations.forEach((function(e){r[e.id.name]=t.identifier(e.id.name);n.removeBinding(e.id.name);if(e.init){o.push(t.assignmentExpression("=",e.id,e.init))}else if(s){o.push(e.id)}}));if(o.length===0)return null;if(o.length===1)return o[0];return t.sequenceExpression(o)}e.get("body").traverse({VariableDeclaration:{exit:function exit(e){var r=varDeclToExpr(e,false);if(r===null){e.remove()}else{a.replaceWithOrRemove(e,t.expressionStatement(r))}e.skip()}},ForStatement:function ForStatement(e){var t=e.get("init");if(t.isVariableDeclaration()){a.replaceWithOrRemove(t,varDeclToExpr(t,false))}},ForXStatement:function ForXStatement(e){var t=e.get("left");if(t.isVariableDeclaration()){a.replaceWithOrRemove(t,varDeclToExpr(t,true))}},FunctionDeclaration:function FunctionDeclaration(e){var s=e.node;r[s.id.name]=s.id;var n=t.expressionStatement(t.assignmentExpression("=",t.clone(s.id),t.functionExpression(e.scope.generateUidIdentifierBasedOnNode(s),s.params,s.body,s.generator,s.expression)));if(e.parentPath.isBlockStatement()){e.parentPath.unshiftContainer("body",n);e.remove()}else{a.replaceWithOrRemove(e,n)}e.scope.removeBinding(s.id.name);e.skip()},FunctionExpression:function FunctionExpression(e){e.skip()},ArrowFunctionExpression:function ArrowFunctionExpression(e){e.skip()}});var s={};e.get("params").forEach((function(e){var r=e.node;if(t.isIdentifier(r)){s[r.name]=r}else{}}));var o=[];Object.keys(r).forEach((function(e){if(!n.call(s,e)){o.push(t.variableDeclarator(r[e],null))}}));if(o.length===0){return null}return t.variableDeclaration("var",o)}},9522:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=_default;var s=r(5490);function _default(e){var t={visitor:(0,s.getVisitor)(e)};var r=e&&e.version;if(r&&parseInt(r,10)>=7){t.name="regenerator-transform"}return t}},9048:(e,t,r)=>{"use strict";var s=r(6919);var a=s(r(9491));var n=r(6419);var o=r(3837);var i=r(6401);function Entry(){a["default"].ok(this instanceof Entry)}function FunctionEntry(e){Entry.call(this);(0,i.getTypes)().assertLiteral(e);this.returnLoc=e}(0,o.inherits)(FunctionEntry,Entry);t.FunctionEntry=FunctionEntry;function LoopEntry(e,t,r){Entry.call(this);var s=(0,i.getTypes)();s.assertLiteral(e);s.assertLiteral(t);if(r){s.assertIdentifier(r)}else{r=null}this.breakLoc=e;this.continueLoc=t;this.label=r}(0,o.inherits)(LoopEntry,Entry);t.LoopEntry=LoopEntry;function SwitchEntry(e){Entry.call(this);(0,i.getTypes)().assertLiteral(e);this.breakLoc=e}(0,o.inherits)(SwitchEntry,Entry);t.SwitchEntry=SwitchEntry;function TryEntry(e,t,r){Entry.call(this);var s=(0,i.getTypes)();s.assertLiteral(e);if(t){a["default"].ok(t instanceof CatchEntry)}else{t=null}if(r){a["default"].ok(r instanceof FinallyEntry)}else{r=null}a["default"].ok(t||r);this.firstLoc=e;this.catchEntry=t;this.finallyEntry=r}(0,o.inherits)(TryEntry,Entry);t.TryEntry=TryEntry;function CatchEntry(e,t){Entry.call(this);var r=(0,i.getTypes)();r.assertLiteral(e);r.assertIdentifier(t);this.firstLoc=e;this.paramId=t}(0,o.inherits)(CatchEntry,Entry);t.CatchEntry=CatchEntry;function FinallyEntry(e,t){Entry.call(this);var r=(0,i.getTypes)();r.assertLiteral(e);r.assertLiteral(t);this.firstLoc=e;this.afterLoc=t}(0,o.inherits)(FinallyEntry,Entry);t.FinallyEntry=FinallyEntry;function LabeledEntry(e,t){Entry.call(this);var r=(0,i.getTypes)();r.assertLiteral(e);r.assertIdentifier(t);this.breakLoc=e;this.label=t}(0,o.inherits)(LabeledEntry,Entry);t.LabeledEntry=LabeledEntry;function LeapManager(e){a["default"].ok(this instanceof LeapManager);a["default"].ok(e instanceof n.Emitter);this.emitter=e;this.entryStack=[new FunctionEntry(e.finalLoc)]}var l=LeapManager.prototype;t.LeapManager=LeapManager;l.withEntry=function(e,t){a["default"].ok(e instanceof Entry);this.entryStack.push(e);try{t.call(this.emitter)}finally{var r=this.entryStack.pop();a["default"].strictEqual(r,e)}};l._findLeapLocation=function(e,t){for(var r=this.entryStack.length-1;r>=0;--r){var s=this.entryStack[r];var a=s[e];if(a){if(t){if(s.label&&s.label.name===t.name){return a}}else if(s instanceof LabeledEntry){}else{return a}}}return null};l.getBreakLoc=function(e){return this._findLeapLocation("breakLoc",e)};l.getContinueLoc=function(e){return this._findLeapLocation("continueLoc",e)}},3085:(e,t,r)=>{"use strict";var s=r(6919);var a=s(r(9491));var n=r(6401);var o=r(1782);var i=(0,o.makeAccessor)();var l=Object.prototype.hasOwnProperty;function makePredicate(e,t){function onlyChildren(e){var t=(0,n.getTypes)();t.assertNode(e);var r=false;function check(e){if(r){}else if(Array.isArray(e)){e.some(check)}else if(t.isNode(e)){a["default"].strictEqual(r,false);r=predicate(e)}return r}var s=t.VISITOR_KEYS[e.type];if(s){for(var o=0;o{"use strict";var s=r(449);t.__esModule=true;t["default"]=replaceShorthandObjectMethod;var a=s(r(6401));function replaceShorthandObjectMethod(e){var t=a.getTypes();if(!e.node||!t.isFunction(e.node)){throw new Error("replaceShorthandObjectMethod can only be called on Function AST node paths.")}if(!t.isObjectMethod(e.node)){return e}if(!e.node.generator){return e}var r=e.node.params.map((function(e){return t.cloneDeep(e)}));var s=t.functionExpression(null,r,t.cloneDeep(e.node.body),e.node.generator,e.node.async);a.replaceWithOrRemove(e,t.objectProperty(t.cloneDeep(e.node.key),s,e.node.computed,false));return e.get("value")}},6401:(e,t)=>{"use strict";t.__esModule=true;t.wrapWithTypes=wrapWithTypes;t.getTypes=getTypes;t.runtimeProperty=runtimeProperty;t.isReference=isReference;t.replaceWithOrRemove=replaceWithOrRemove;var r=null;function wrapWithTypes(e,t){return function(){var s=r;r=e;try{for(var a=arguments.length,n=new Array(a),o=0;o{"use strict";var s=r(449);var a=r(6919);var n=a(r(9491));var o=r(5604);var i=r(6419);var l=a(r(3539));var c=s(r(6401));var u=r(1782);t.getVisitor=function(e){var t=e.types;return{Method:function Method(e,r){var s=e.node;if(!shouldRegenerate(s,r))return;var a=t.functionExpression(null,[],t.cloneNode(s.body,false),s.generator,s.async);e.get("body").set("body",[t.returnStatement(t.callExpression(a,[]))]);s.async=false;s.generator=false;e.get("body.body.0.argument.callee").unwrapFunctionEnvironment()},Function:{exit:c.wrapWithTypes(t,(function(e,r){var s=e.node;if(!shouldRegenerate(s,r))return;e=(0,l["default"])(e);s=e.node;var a=e.scope.generateUidIdentifier("context");var n=e.scope.generateUidIdentifier("args");e.ensureBlock();var u=e.get("body");if(s.async){u.traverse(m)}u.traverse(d,{context:a});var p=[];var y=[];u.get("body").forEach((function(e){var r=e.node;if(t.isExpressionStatement(r)&&t.isStringLiteral(r.expression)){p.push(r)}else if(r&&r._blockHoist!=null){p.push(r)}else{y.push(r)}}));if(p.length>0){u.node.body=y}var g=getOuterFnExpr(e);t.assertIdentifier(s.id);var h=t.identifier(s.id.name+"$");var b=(0,o.hoist)(e);var x={usesThis:false,usesArguments:false,getArgsId:function getArgsId(){return t.clone(n)}};e.traverse(f,x);if(x.usesArguments){b=b||t.variableDeclaration("var",[]);b.declarations.push(t.variableDeclarator(t.clone(n),t.identifier("arguments")))}var v=new i.Emitter(a);v.explode(e.get("body"));if(b&&b.declarations.length>0){p.push(b)}var E=[v.getContextFunction(h)];var j=v.getTryLocsList();if(s.generator){E.push(g)}else if(x.usesThis||j||s.async){E.push(t.nullLiteral())}if(x.usesThis){E.push(t.thisExpression())}else if(j||s.async){E.push(t.nullLiteral())}if(j){E.push(j)}else if(s.async){E.push(t.nullLiteral())}if(s.async){var w=e.scope;do{if(w.hasOwnBinding("Promise"))w.rename("Promise")}while(w=w.parent);E.push(t.identifier("Promise"))}var _=t.callExpression(c.runtimeProperty(s.async?"async":"wrap"),E);p.push(t.returnStatement(_));s.body=t.blockStatement(p);e.get("body.body").forEach((function(e){return e.scope.registerDeclaration(e)}));var S=u.node.directives;if(S){s.body.directives=S}var k=s.generator;if(k){s.generator=false}if(s.async){s.async=false}if(k&&t.isExpression(s)){c.replaceWithOrRemove(e,t.callExpression(c.runtimeProperty("mark"),[s]));e.addComment("leading","#__PURE__")}var O=v.getInsertedLocs();e.traverse({NumericLiteral:function NumericLiteral(e){if(!O.has(e.node)){return}e.replaceWith(t.numericLiteral(e.node.value))}});e.requeue()}))}}};function shouldRegenerate(e,t){if(e.generator){if(e.async){return t.opts.asyncGenerators!==false}else{return t.opts.generators!==false}}else if(e.async){return t.opts.async!==false}else{return false}}function getOuterFnExpr(e){var t=c.getTypes();var r=e.node;t.assertFunction(r);if(!r.id){r.id=e.scope.parent.generateUidIdentifier("callee")}if(r.generator&&t.isFunctionDeclaration(r)){return getMarkedFunctionId(e)}return t.clone(r.id)}var p=(0,u.makeAccessor)();function getMarkedFunctionId(e){var t=c.getTypes();var r=e.node;t.assertIdentifier(r.id);var s=e.findParent((function(e){return e.isProgram()||e.isBlockStatement()}));if(!s){return r.id}var a=s.node;n["default"].ok(Array.isArray(a.body));var o=p(a);if(!o.decl){o.decl=t.variableDeclaration("var",[]);s.unshiftContainer("body",o.decl);o.declPath=s.get("body.0")}n["default"].strictEqual(o.declPath.node,o.decl);var i=s.scope.generateUidIdentifier("marked");var l=t.callExpression(c.runtimeProperty("mark"),[t.clone(r.id)]);var u=o.decl.declarations.push(t.variableDeclarator(i,l))-1;var f=o.declPath.get("declarations."+u+".init");n["default"].strictEqual(f.node,l);f.addComment("leading","#__PURE__");return t.clone(i)}var f={"FunctionExpression|FunctionDeclaration|Method":function FunctionExpressionFunctionDeclarationMethod(e){e.skip()},Identifier:function Identifier(e,t){if(e.node.name==="arguments"&&c.isReference(e)){c.replaceWithOrRemove(e,t.getArgsId());t.usesArguments=true}},ThisExpression:function ThisExpression(e,t){t.usesThis=true}};var d={MetaProperty:function MetaProperty(e){var t=e.node;if(t.meta.name==="function"&&t.property.name==="sent"){var r=c.getTypes();c.replaceWithOrRemove(e,r.memberExpression(r.clone(this.context),r.identifier("_sent")))}}};var m={Function:function Function(e){e.skip()},AwaitExpression:function AwaitExpression(e){var t=c.getTypes();var r=e.node.argument;c.replaceWithOrRemove(e,t.yieldExpression(t.callExpression(c.runtimeProperty("awrap"),[r]),false))}}},9924:(e,t,r)=>{"use strict";const s=r(8741);t.REGULAR=new Map([["d",s().addRange(48,57)],["D",s().addRange(0,47).addRange(58,65535)],["s",s(32,160,5760,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233)],["S",s().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,65535)],["w",s(95).addRange(48,57).addRange(65,90).addRange(97,122)],["W",s(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,65535)]]);t.UNICODE=new Map([["d",s().addRange(48,57)],["D",s().addRange(0,47).addRange(58,1114111)],["s",s(32,160,5760,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233)],["S",s().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111)],["w",s(95).addRange(48,57).addRange(65,90).addRange(97,122)],["W",s(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)]]);t.UNICODE_IGNORE_CASE=new Map([["d",s().addRange(48,57)],["D",s().addRange(0,47).addRange(58,1114111)],["s",s(32,160,5760,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233)],["S",s().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111)],["w",s(95,383,8490).addRange(48,57).addRange(65,90).addRange(97,122)],["W",s(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,382).addRange(384,8489).addRange(8491,1114111)]])},3354:e=>{e.exports=new Map([[75,8490],[83,383],[107,8490],[115,383],[181,924],[197,8491],[223,7838],[229,8491],[383,83],[452,453],[453,452],[455,456],[456,455],[458,459],[459,458],[497,498],[498,497],[837,8126],[914,976],[917,1013],[920,1012],[921,8126],[922,1008],[924,181],[928,982],[929,1009],[931,962],[934,981],[937,8486],[952,1012],[962,931],[969,8486],[976,914],[977,1012],[981,934],[982,928],[1008,922],[1009,929],[1012,[920,977,952]],[1013,917],[1042,7296],[1044,7297],[1054,7298],[1057,7299],[1058,7301],[1066,7302],[1122,7303],[7296,1042],[7297,1044],[7298,1054],[7299,1057],[7300,7301],[7301,[1058,7300]],[7302,1066],[7303,1122],[7304,42570],[7776,7835],[7835,7776],[7838,223],[8064,8072],[8065,8073],[8066,8074],[8067,8075],[8068,8076],[8069,8077],[8070,8078],[8071,8079],[8072,8064],[8073,8065],[8074,8066],[8075,8067],[8076,8068],[8077,8069],[8078,8070],[8079,8071],[8080,8088],[8081,8089],[8082,8090],[8083,8091],[8084,8092],[8085,8093],[8086,8094],[8087,8095],[8088,8080],[8089,8081],[8090,8082],[8091,8083],[8092,8084],[8093,8085],[8094,8086],[8095,8087],[8096,8104],[8097,8105],[8098,8106],[8099,8107],[8100,8108],[8101,8109],[8102,8110],[8103,8111],[8104,8096],[8105,8097],[8106,8098],[8107,8099],[8108,8100],[8109,8101],[8110,8102],[8111,8103],[8115,8124],[8124,8115],[8126,[837,921]],[8131,8140],[8140,8131],[8179,8188],[8188,8179],[8486,[937,969]],[8490,75],[8491,[197,229]],[42570,7304],[66560,66600],[66561,66601],[66562,66602],[66563,66603],[66564,66604],[66565,66605],[66566,66606],[66567,66607],[66568,66608],[66569,66609],[66570,66610],[66571,66611],[66572,66612],[66573,66613],[66574,66614],[66575,66615],[66576,66616],[66577,66617],[66578,66618],[66579,66619],[66580,66620],[66581,66621],[66582,66622],[66583,66623],[66584,66624],[66585,66625],[66586,66626],[66587,66627],[66588,66628],[66589,66629],[66590,66630],[66591,66631],[66592,66632],[66593,66633],[66594,66634],[66595,66635],[66596,66636],[66597,66637],[66598,66638],[66599,66639],[66600,66560],[66601,66561],[66602,66562],[66603,66563],[66604,66564],[66605,66565],[66606,66566],[66607,66567],[66608,66568],[66609,66569],[66610,66570],[66611,66571],[66612,66572],[66613,66573],[66614,66574],[66615,66575],[66616,66576],[66617,66577],[66618,66578],[66619,66579],[66620,66580],[66621,66581],[66622,66582],[66623,66583],[66624,66584],[66625,66585],[66626,66586],[66627,66587],[66628,66588],[66629,66589],[66630,66590],[66631,66591],[66632,66592],[66633,66593],[66634,66594],[66635,66595],[66636,66596],[66637,66597],[66638,66598],[66639,66599],[66736,66776],[66737,66777],[66738,66778],[66739,66779],[66740,66780],[66741,66781],[66742,66782],[66743,66783],[66744,66784],[66745,66785],[66746,66786],[66747,66787],[66748,66788],[66749,66789],[66750,66790],[66751,66791],[66752,66792],[66753,66793],[66754,66794],[66755,66795],[66756,66796],[66757,66797],[66758,66798],[66759,66799],[66760,66800],[66761,66801],[66762,66802],[66763,66803],[66764,66804],[66765,66805],[66766,66806],[66767,66807],[66768,66808],[66769,66809],[66770,66810],[66771,66811],[66776,66736],[66777,66737],[66778,66738],[66779,66739],[66780,66740],[66781,66741],[66782,66742],[66783,66743],[66784,66744],[66785,66745],[66786,66746],[66787,66747],[66788,66748],[66789,66749],[66790,66750],[66791,66751],[66792,66752],[66793,66753],[66794,66754],[66795,66755],[66796,66756],[66797,66757],[66798,66758],[66799,66759],[66800,66760],[66801,66761],[66802,66762],[66803,66763],[66804,66764],[66805,66765],[66806,66766],[66807,66767],[66808,66768],[66809,66769],[66810,66770],[66811,66771],[68736,68800],[68737,68801],[68738,68802],[68739,68803],[68740,68804],[68741,68805],[68742,68806],[68743,68807],[68744,68808],[68745,68809],[68746,68810],[68747,68811],[68748,68812],[68749,68813],[68750,68814],[68751,68815],[68752,68816],[68753,68817],[68754,68818],[68755,68819],[68756,68820],[68757,68821],[68758,68822],[68759,68823],[68760,68824],[68761,68825],[68762,68826],[68763,68827],[68764,68828],[68765,68829],[68766,68830],[68767,68831],[68768,68832],[68769,68833],[68770,68834],[68771,68835],[68772,68836],[68773,68837],[68774,68838],[68775,68839],[68776,68840],[68777,68841],[68778,68842],[68779,68843],[68780,68844],[68781,68845],[68782,68846],[68783,68847],[68784,68848],[68785,68849],[68786,68850],[68800,68736],[68801,68737],[68802,68738],[68803,68739],[68804,68740],[68805,68741],[68806,68742],[68807,68743],[68808,68744],[68809,68745],[68810,68746],[68811,68747],[68812,68748],[68813,68749],[68814,68750],[68815,68751],[68816,68752],[68817,68753],[68818,68754],[68819,68755],[68820,68756],[68821,68757],[68822,68758],[68823,68759],[68824,68760],[68825,68761],[68826,68762],[68827,68763],[68828,68764],[68829,68765],[68830,68766],[68831,68767],[68832,68768],[68833,68769],[68834,68770],[68835,68771],[68836,68772],[68837,68773],[68838,68774],[68839,68775],[68840,68776],[68841,68777],[68842,68778],[68843,68779],[68844,68780],[68845,68781],[68846,68782],[68847,68783],[68848,68784],[68849,68785],[68850,68786],[71840,71872],[71841,71873],[71842,71874],[71843,71875],[71844,71876],[71845,71877],[71846,71878],[71847,71879],[71848,71880],[71849,71881],[71850,71882],[71851,71883],[71852,71884],[71853,71885],[71854,71886],[71855,71887],[71856,71888],[71857,71889],[71858,71890],[71859,71891],[71860,71892],[71861,71893],[71862,71894],[71863,71895],[71864,71896],[71865,71897],[71866,71898],[71867,71899],[71868,71900],[71869,71901],[71870,71902],[71871,71903],[71872,71840],[71873,71841],[71874,71842],[71875,71843],[71876,71844],[71877,71845],[71878,71846],[71879,71847],[71880,71848],[71881,71849],[71882,71850],[71883,71851],[71884,71852],[71885,71853],[71886,71854],[71887,71855],[71888,71856],[71889,71857],[71890,71858],[71891,71859],[71892,71860],[71893,71861],[71894,71862],[71895,71863],[71896,71864],[71897,71865],[71898,71866],[71899,71867],[71900,71868],[71901,71869],[71902,71870],[71903,71871],[93760,93792],[93761,93793],[93762,93794],[93763,93795],[93764,93796],[93765,93797],[93766,93798],[93767,93799],[93768,93800],[93769,93801],[93770,93802],[93771,93803],[93772,93804],[93773,93805],[93774,93806],[93775,93807],[93776,93808],[93777,93809],[93778,93810],[93779,93811],[93780,93812],[93781,93813],[93782,93814],[93783,93815],[93784,93816],[93785,93817],[93786,93818],[93787,93819],[93788,93820],[93789,93821],[93790,93822],[93791,93823],[93792,93760],[93793,93761],[93794,93762],[93795,93763],[93796,93764],[93797,93765],[93798,93766],[93799,93767],[93800,93768],[93801,93769],[93802,93770],[93803,93771],[93804,93772],[93805,93773],[93806,93774],[93807,93775],[93808,93776],[93809,93777],[93810,93778],[93811,93779],[93812,93780],[93813,93781],[93814,93782],[93815,93783],[93816,93784],[93817,93785],[93818,93786],[93819,93787],[93820,93788],[93821,93789],[93822,93790],[93823,93791],[125184,125218],[125185,125219],[125186,125220],[125187,125221],[125188,125222],[125189,125223],[125190,125224],[125191,125225],[125192,125226],[125193,125227],[125194,125228],[125195,125229],[125196,125230],[125197,125231],[125198,125232],[125199,125233],[125200,125234],[125201,125235],[125202,125236],[125203,125237],[125204,125238],[125205,125239],[125206,125240],[125207,125241],[125208,125242],[125209,125243],[125210,125244],[125211,125245],[125212,125246],[125213,125247],[125214,125248],[125215,125249],[125216,125250],[125217,125251],[125218,125184],[125219,125185],[125220,125186],[125221,125187],[125222,125188],[125223,125189],[125224,125190],[125225,125191],[125226,125192],[125227,125193],[125228,125194],[125229,125195],[125230,125196],[125231,125197],[125232,125198],[125233,125199],[125234,125200],[125235,125201],[125236,125202],[125237,125203],[125238,125204],[125239,125205],[125240,125206],[125241,125207],[125242,125208],[125243,125209],[125244,125210],[125245,125211],[125246,125212],[125247,125213],[125248,125214],[125249,125215],[125250,125216],[125251,125217]])},5756:(e,t,r)=>{"use strict";const s=r(1770).generate;const a=r(9990).parse;const n=r(8741);const o=r(3042);const i=r(1317);const l=r(3354);const c=r(9924);const u=n().addRange(0,1114111);const p=n().addRange(0,65535);const f=u.clone().remove(10,13,8232,8233);const getCharacterClassEscapeSet=(e,t,r)=>{if(t){if(r){return c.UNICODE_IGNORE_CASE.get(e)}return c.UNICODE.get(e)}return c.REGULAR.get(e)};const getUnicodeDotSet=e=>e?u:f;const getUnicodePropertyValueSet=(e,t)=>{const r=t?`${e}/${t}`:`Binary_Property/${e}`;try{return require(`regenerate-unicode-properties/${r}.js`)}catch(r){throw new Error(`Failed to recognize value \`${t}\` for property `+`\`${e}\`.`)}};const handleLoneUnicodePropertyNameOrValue=e=>{try{const t="General_Category";const r=i(t,e);return getUnicodePropertyValueSet(t,r)}catch(e){}const t=o(e);return getUnicodePropertyValueSet(t)};const getUnicodePropertyEscapeSet=(e,t)=>{const r=e.split("=");const s=r[0];let a;if(r.length==1){a=handleLoneUnicodePropertyNameOrValue(s)}else{const e=o(s);const t=i(e,r[1]);a=getUnicodePropertyValueSet(e,t)}if(t){return u.clone().remove(a)}return a.clone()};n.prototype.iuAddRange=function(e,t){const r=this;do{const t=caseFold(e);if(t){r.add(t)}}while(++e<=t);return r};const update=(e,t)=>{let r=a(t,d.useUnicodeFlag?"u":"");switch(r.type){case"characterClass":case"group":case"value":break;default:r=wrap(r,t)}Object.assign(e,r)};const wrap=(e,t)=>({type:"group",behavior:"ignore",body:[e],raw:`(?:${t})`});const caseFold=e=>l.get(e)||false;const processCharacterClass=(e,t)=>{const r=n();for(const t of e.body){switch(t.type){case"value":r.add(t.codePoint);if(d.ignoreCase&&d.unicode&&!d.useUnicodeFlag){const e=caseFold(t.codePoint);if(e){r.add(e)}}break;case"characterClassRange":const e=t.min.codePoint;const s=t.max.codePoint;r.addRange(e,s);if(d.ignoreCase&&d.unicode&&!d.useUnicodeFlag){r.iuAddRange(e,s)}break;case"characterClassEscape":r.add(getCharacterClassEscapeSet(t.value,d.unicode,d.ignoreCase));break;case"unicodePropertyEscape":r.add(getUnicodePropertyEscapeSet(t.value,t.negative));break;default:throw new Error(`Unknown term type: ${t.type}`)}}if(e.negative){update(e,`(?!${r.toString(t)})[\\s\\S]`)}else{update(e,r.toString(t))}return e};const updateNamedReference=(e,t)=>{delete e.name;e.matchIndex=t};const assertNoUnmatchedReferences=e=>{const t=Object.keys(e.unmatchedReferences);if(t.length>0){throw new Error(`Unknown group names: ${t}`)}};const processTerm=(e,t,r)=>{switch(e.type){case"dot":if(d.useDotAllFlag){break}else if(d.unicode){update(e,getUnicodeDotSet(d.dotAll).toString(t))}else if(d.dotAll){update(e,"[\\s\\S]")}break;case"characterClass":e=processCharacterClass(e,t);break;case"unicodePropertyEscape":if(d.unicodePropertyEscape){update(e,getUnicodePropertyEscapeSet(e.value,e.negative).toString(t))}break;case"characterClassEscape":update(e,getCharacterClassEscapeSet(e.value,d.unicode,d.ignoreCase).toString(t));break;case"group":if(e.behavior=="normal"){r.lastIndex++}if(e.name&&d.namedGroup){const t=e.name.value;if(r.names[t]){throw new Error(`Multiple groups with the same name (${t}) are not allowed.`)}const s=r.lastIndex;delete e.name;r.names[t]=s;if(r.onNamedGroup){r.onNamedGroup.call(null,t,s)}if(r.unmatchedReferences[t]){r.unmatchedReferences[t].forEach((e=>{updateNamedReference(e,s)}));delete r.unmatchedReferences[t]}}case"alternative":case"disjunction":case"quantifier":e.body=e.body.map((e=>processTerm(e,t,r)));break;case"value":const s=e.codePoint;const a=n(s);if(d.ignoreCase&&d.unicode&&!d.useUnicodeFlag){const e=caseFold(s);if(e){a.add(e)}}update(e,a.toString(t));break;case"reference":if(e.name){const t=e.name.value;const s=r.names[t];if(s){updateNamedReference(e,s);break}if(!r.unmatchedReferences[t]){r.unmatchedReferences[t]=[]}r.unmatchedReferences[t].push(e)}break;case"anchor":case"empty":case"group":break;default:throw new Error(`Unknown term type: ${e.type}`)}return e};const d={ignoreCase:false,unicode:false,dotAll:false,useDotAllFlag:false,useUnicodeFlag:false,unicodePropertyEscape:false,namedGroup:false};const rewritePattern=(e,t,r)=>{d.unicode=t&&t.includes("u");const n={unicodePropertyEscape:d.unicode,namedGroups:true,lookbehind:r&&r.lookbehind};d.ignoreCase=t&&t.includes("i");const o=r&&r.dotAllFlag;d.dotAll=o&&t&&t.includes("s");d.namedGroup=r&&r.namedGroup;d.useDotAllFlag=r&&r.useDotAllFlag;d.useUnicodeFlag=r&&r.useUnicodeFlag;d.unicodePropertyEscape=r&&r.unicodePropertyEscape;if(o&&d.useDotAllFlag){throw new Error("`useDotAllFlag` and `dotAllFlag` cannot both be true!")}const i={hasUnicodeFlag:d.useUnicodeFlag,bmpOnly:!d.unicode};const l={onNamedGroup:r&&r.onNamedGroup,lastIndex:0,names:Object.create(null),unmatchedReferences:Object.create(null)};const c=a(e,t,n);processTerm(c,i,l);assertNoUnmatchedReferences(l);return s(c)};e.exports=rewritePattern},1770:function(e,t,r){e=r.nmd(e); + */(function(){var r;var s="4.17.20";var a=200;var n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function";var i="__lodash_hash_undefined__";var l=500;var c="__lodash_placeholder__";var u=1,p=2,d=4;var f=1,m=2;var y=1,g=2,h=4,b=8,x=16,v=32,E=64,j=128,w=256,_=512;var S=30,O="...";var k=800,P=16;var I=1,D=2,C=3;var A=1/0,R=9007199254740991,N=17976931348623157e292,M=0/0;var F=4294967295,L=F-1,B=F>>>1;var W=[["ary",j],["bind",y],["bindKey",g],["curry",b],["curryRight",x],["flip",_],["partial",v],["partialRight",E],["rearg",w]];var U="[object Arguments]",$="[object Array]",V="[object AsyncFunction]",q="[object Boolean]",G="[object Date]",H="[object DOMException]",z="[object Error]",K="[object Function]",X="[object GeneratorFunction]",Y="[object Map]",J="[object Number]",Z="[object Null]",Q="[object Object]",ee="[object Promise]",te="[object Proxy]",re="[object RegExp]",se="[object Set]",ae="[object String]",ne="[object Symbol]",oe="[object Undefined]",ie="[object WeakMap]",le="[object WeakSet]";var ce="[object ArrayBuffer]",ue="[object DataView]",pe="[object Float32Array]",de="[object Float64Array]",fe="[object Int8Array]",me="[object Int16Array]",ye="[object Int32Array]",ge="[object Uint8Array]",he="[object Uint8ClampedArray]",be="[object Uint16Array]",xe="[object Uint32Array]";var ve=/\b__p \+= '';/g,Ee=/\b(__p \+=) '' \+/g,je=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var we=/&(?:amp|lt|gt|quot|#39);/g,_e=/[&<>"']/g,Se=RegExp(we.source),Oe=RegExp(_e.source);var ke=/<%-([\s\S]+?)%>/g,Pe=/<%([\s\S]+?)%>/g,Ie=/<%=([\s\S]+?)%>/g;var De=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ce=/^\w*$/,Ae=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;var Re=/[\\^$.*+?()[\]{}|]/g,Ne=RegExp(Re.source);var Te=/^\s+|\s+$/g,Me=/^\s+/,Fe=/\s+$/;var Le=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Be=/\{\n\/\* \[wrapped with (.+)\] \*/,We=/,? & /;var Ue=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var $e=/\\(\\)?/g;var Ve=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var qe=/\w*$/;var Ge=/^[-+]0x[0-9a-f]+$/i;var He=/^0b[01]+$/i;var ze=/^\[object .+?Constructor\]$/;var Ke=/^0o[0-7]+$/i;var Xe=/^(?:0|[1-9]\d*)$/;var Ye=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;var Je=/($^)/;var Ze=/['\n\r\u2028\u2029\\]/g;var Qe="\\ud800-\\udfff",et="\\u0300-\\u036f",tt="\\ufe20-\\ufe2f",rt="\\u20d0-\\u20ff",st=et+tt+rt,at="\\u2700-\\u27bf",nt="a-z\\xdf-\\xf6\\xf8-\\xff",ot="\\xac\\xb1\\xd7\\xf7",ct="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ut="\\u2000-\\u206f",pt=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",dt="A-Z\\xc0-\\xd6\\xd8-\\xde",ft="\\ufe0e\\ufe0f",mt=ot+ct+ut+pt;var yt="['’]",ht="["+Qe+"]",bt="["+mt+"]",xt="["+st+"]",vt="\\d+",Et="["+at+"]",jt="["+nt+"]",wt="[^"+Qe+mt+vt+at+nt+dt+"]",_t="\\ud83c[\\udffb-\\udfff]",St="(?:"+xt+"|"+_t+")",Ot="[^"+Qe+"]",kt="(?:\\ud83c[\\udde6-\\uddff]){2}",Pt="[\\ud800-\\udbff][\\udc00-\\udfff]",It="["+dt+"]",Dt="\\u200d";var Ct="(?:"+jt+"|"+wt+")",At="(?:"+It+"|"+wt+")",Rt="(?:"+yt+"(?:d|ll|m|re|s|t|ve))?",Nt="(?:"+yt+"(?:D|LL|M|RE|S|T|VE))?",Tt=St+"?",Mt="["+ft+"]?",Ft="(?:"+Dt+"(?:"+[Ot,kt,Pt].join("|")+")"+Mt+Tt+")*",Lt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Bt="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Wt=Mt+Tt+Ft,Ut="(?:"+[Et,kt,Pt].join("|")+")"+Wt,$t="(?:"+[Ot+xt+"?",xt,kt,Pt,ht].join("|")+")";var Vt=RegExp(yt,"g");var qt=RegExp(xt,"g");var Gt=RegExp(_t+"(?="+_t+")|"+$t+Wt,"g");var Ht=RegExp([It+"?"+jt+"+"+Rt+"(?="+[bt,It,"$"].join("|")+")",At+"+"+Nt+"(?="+[bt,It+Ct,"$"].join("|")+")",It+"?"+Ct+"+"+Rt,It+"+"+Nt,Bt,Lt,vt,Ut].join("|"),"g");var zt=RegExp("["+Dt+Qe+st+ft+"]");var Kt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var Xt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"];var Yt=-1;var Jt={};Jt[pe]=Jt[de]=Jt[fe]=Jt[me]=Jt[ye]=Jt[ge]=Jt[he]=Jt[be]=Jt[xe]=true;Jt[U]=Jt[$]=Jt[ce]=Jt[q]=Jt[ue]=Jt[G]=Jt[z]=Jt[K]=Jt[Y]=Jt[J]=Jt[Q]=Jt[re]=Jt[se]=Jt[ae]=Jt[ie]=false;var Zt={};Zt[U]=Zt[$]=Zt[ce]=Zt[ue]=Zt[q]=Zt[G]=Zt[pe]=Zt[de]=Zt[fe]=Zt[me]=Zt[ye]=Zt[Y]=Zt[J]=Zt[Q]=Zt[re]=Zt[se]=Zt[ae]=Zt[ne]=Zt[ge]=Zt[he]=Zt[be]=Zt[xe]=true;Zt[z]=Zt[K]=Zt[ie]=false;var Qt={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"};var er={"&":"&","<":"<",">":">",'"':""","'":"'"};var tr={"&":"&","<":"<",">":">",""":'"',"'":"'"};var rr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};var sr=parseFloat,ar=parseInt;var nr=typeof global=="object"&&global&&global.Object===Object&&global;var or=typeof self=="object"&&self&&self.Object===Object&&self;var ir=nr||or||Function("return this")();var lr=true&&t&&!t.nodeType&&t;var cr=lr&&"object"=="object"&&e&&!e.nodeType&&e;var ur=cr&&cr.exports===lr;var pr=ur&&nr.process;var dr=function(){try{var e=cr&&cr.require&&cr.require("util").types;if(e){return e}return pr&&pr.binding&&pr.binding("util")}catch(e){}}();var fr=dr&&dr.isArrayBuffer,mr=dr&&dr.isDate,yr=dr&&dr.isMap,gr=dr&&dr.isRegExp,hr=dr&&dr.isSet,br=dr&&dr.isTypedArray;function apply(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function arrayAggregator(e,t,r,s){var a=-1,n=e==null?0:e.length;while(++a-1}function arrayIncludesWith(e,t,r){var s=-1,a=e==null?0:e.length;while(++s-1){}return r}function charsEndIndex(e,t){var r=e.length;while(r--&&baseIndexOf(t,e[r],0)>-1){}return r}function countHolders(e,t){var r=e.length,s=0;while(r--){if(e[r]===t){++s}}return s}var vr=basePropertyOf(Qt);var Er=basePropertyOf(er);function escapeStringChar(e){return"\\"+rr[e]}function getValue(e,t){return e==null?r:e[t]}function hasUnicode(e){return zt.test(e)}function hasUnicodeWord(e){return Kt.test(e)}function iteratorToArray(e){var t,r=[];while(!(t=e.next()).done){r.push(t.value)}return r}function mapToArray(e){var t=-1,r=Array(e.size);e.forEach((function(e,s){r[++t]=[s,e]}));return r}function overArg(e,t){return function(r){return e(t(r))}}function replaceHolders(e,t){var r=-1,s=e.length,a=0,n=[];while(++r-1}function listCacheSet(e,t){var r=this.__data__,s=assocIndexOf(r,e);if(s<0){++this.size;r.push([e,t])}else{r[s][1]=t}return this}ListCache.prototype.clear=listCacheClear;ListCache.prototype["delete"]=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;function MapCache(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t=t?e:t}}return e}function baseClone(e,t,s,a,n,o){var i,l=t&u,c=t&p,f=t&d;if(s){i=n?s(e,a,n,o):s(e)}if(i!==r){return i}if(!isObject(e)){return e}var m=Ns(e);if(m){i=initCloneArray(e);if(!l){return copyArray(e,i)}}else{var y=qr(e),g=y==K||y==X;if(Ms(e)){return cloneBuffer(e,l)}if(y==Q||y==U||g&&!n){i=c||g?{}:initCloneObject(e);if(!l){return c?copySymbolsIn(e,baseAssignIn(i,e)):copySymbols(e,baseAssign(i,e))}}else{if(!Zt[y]){return n?e:{}}i=initCloneByTag(e,y,l)}}o||(o=new Stack);var h=o.get(e);if(h){return h}o.set(e,i);if(Ws(e)){e.forEach((function(r){i.add(baseClone(r,t,s,r,e,o))}))}else if(Ls(e)){e.forEach((function(r,a){i.set(a,baseClone(r,t,s,a,e,o))}))}var b=f?c?getAllKeysIn:getAllKeys:c?keysIn:keys;var x=m?r:b(e);arrayEach(x||e,(function(r,a){if(x){a=r;r=e[a]}assignValue(i,a,baseClone(r,t,s,a,e,o))}));return i}function baseConforms(e){var t=keys(e);return function(r){return baseConformsTo(r,e,t)}}function baseConformsTo(e,t,s){var a=s.length;if(e==null){return!a}e=rt(e);while(a--){var n=s[a],o=t[n],i=e[n];if(i===r&&!(n in e)||!o(i)){return false}}return true}function baseDelay(e,t,s){if(typeof e!="function"){throw new nt(o)}return zr((function(){e.apply(r,s)}),t)}function baseDifference(e,t,r,s){var n=-1,o=arrayIncludes,i=true,l=e.length,c=[],u=t.length;if(!l){return c}if(r){t=arrayMap(t,baseUnary(r))}if(s){o=arrayIncludesWith;i=false}else if(t.length>=a){o=cacheHas;i=false;t=new SetCache(t)}e:while(++nn?0:n+s}a=a===r||a>n?n:toInteger(a);if(a<0){a+=n}a=s>a?0:toLength(a);while(s0&&r(i)){if(t>1){baseFlatten(i,t-1,r,s,a)}else{arrayPush(a,i)}}else if(!s){a[a.length]=i}}return a}var Nr=createBaseFor();var Tr=createBaseFor(true);function baseForOwn(e,t){return e&&Nr(e,t,keys)}function baseForOwnRight(e,t){return e&&Tr(e,t,keys)}function baseFunctions(e,t){return arrayFilter(t,(function(t){return isFunction(e[t])}))}function baseGet(e,t){t=castPath(t,e);var s=0,a=t.length;while(e!=null&&st}function baseHas(e,t){return e!=null&&ft.call(e,t)}function baseHasIn(e,t){return e!=null&&t in rt(e)}function baseInRange(e,t,r){return e>=Ht(t,r)&&e=120&&d.length>=120)?new SetCache(l&&d):r}d=e[0];var f=-1,m=c[0];e:while(++f-1){if(i!==e){Pt.call(i,l,1)}Pt.call(e,l,1)}}return e}function basePullAt(e,t){var r=e?t.length:0,s=r-1;while(r--){var a=t[r];if(r==s||a!==n){var n=a;if(isIndex(a)){Pt.call(e,a,1)}else{baseUnset(e,a)}}}return e}function baseRandom(e,t){return e+Ft(Qt()*(t-e+1))}function baseRange(e,r,s,a){var n=-1,o=Gt(Mt((r-e)/(s||1)),0),i=t(o);while(o--){i[a?o:++n]=e;e+=s}return i}function baseRepeat(e,t){var r="";if(!e||t<1||t>R){return r}do{if(t%2){r+=e}t=Ft(t/2);if(t){e+=e}}while(t);return r}function baseRest(e,t){return Kr(overRest(e,t,identity),e+"")}function baseSample(e){return arraySample(values(e))}function baseSampleSize(e,t){var r=values(e);return shuffleSelf(r,baseClamp(t,0,r.length))}function baseSet(e,t,s,a){if(!isObject(e)){return e}t=castPath(t,e);var n=-1,o=t.length,i=o-1,l=e;while(l!=null&&++nn?0:n+r}s=s>n?n:s;if(s<0){s+=n}n=r>s?0:s-r>>>0;r>>>=0;var o=t(n);while(++a>>1,o=e[n];if(o!==null&&!isSymbol(o)&&(r?o<=t:o=a){var u=t?null:Wr(e);if(u){return setToArray(u)}i=false;n=cacheHas;c=new SetCache}else{c=t?[]:l}e:while(++s=a?e:baseSlice(e,t,s)}var Br=Rt||function(e){return ir.clearTimeout(e)};function cloneBuffer(e,t){if(t){return e.slice()}var r=e.length,s=_t?_t(r):new e.constructor(r);e.copy(s);return s}function cloneArrayBuffer(e){var t=new e.constructor(e.byteLength);new wt(t).set(new wt(e));return t}function cloneDataView(e,t){var r=t?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function cloneRegExp(e){var t=new e.constructor(e.source,qe.exec(e));t.lastIndex=e.lastIndex;return t}function cloneSymbol(e){return Ir?rt(Ir.call(e)):{}}function cloneTypedArray(e,t){var r=t?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function compareAscending(e,t){if(e!==t){var s=e!==r,a=e===null,n=e===e,o=isSymbol(e);var i=t!==r,l=t===null,c=t===t,u=isSymbol(t);if(!l&&!u&&!o&&e>t||o&&i&&c&&!l&&!u||a&&i&&c||!s&&c||!n){return 1}if(!a&&!o&&!u&&e=i){return l}var c=r[s];return l*(c=="desc"?-1:1)}}return e.index-t.index}function composeArgs(e,r,s,a){var n=-1,o=e.length,i=s.length,l=-1,c=r.length,u=Gt(o-i,0),p=t(c+u),d=!a;while(++l1?s[n-1]:r,i=n>2?s[2]:r;o=e.length>3&&typeof o=="function"?(n--,o):r;if(i&&isIterateeCall(s[0],s[1],i)){o=n<3?r:o;n=1}t=rt(t);while(++a-1?n[o?t[i]:i]:r}}function createFlow(e){return flatRest((function(t){var s=t.length,a=s,n=LodashWrapper.prototype.thru;if(e){t.reverse()}while(a--){var i=t[a];if(typeof i!="function"){throw new nt(o)}if(n&&!l&&getFuncName(i)=="wrapper"){var l=new LodashWrapper([],true)}}a=l?a:s;while(++a1){y.reverse()}if(d&&ul)){return false}var u=o.get(e);var p=o.get(t);if(u&&p){return u==t&&p==e}var d=-1,y=true,g=s&m?new SetCache:r;o.set(e,t);o.set(t,e);while(++d1?"& ":"")+t[s];t=t.join(r>2?", ":" ");return e.replace(Le,"{\n/* [wrapped with "+t+"] */\n")}function isFlattenable(e){return Ns(e)||Rs(e)||!!(It&&e&&e[It])}function isIndex(e,t){var r=typeof e;t=t==null?R:t;return!!t&&(r=="number"||r!="symbol"&&Xe.test(e))&&(e>-1&&e%1==0&&e0){if(++t>=k){return arguments[0]}}else{t=0}return e.apply(r,arguments)}}function shuffleSelf(e,t){var s=-1,a=e.length,n=a-1;t=t===r?a:t;while(++s1?e[t-1]:r;s=typeof s=="function"?(e.pop(),s):r;return unzipWith(e,s)}));function chain(e){var t=lodash(e);t.__chain__=true;return t}function tap(e,t){t(e);return e}function thru(e,t){return t(e)}var fs=flatRest((function(e){var t=e.length,s=t?e[0]:0,a=this.__wrapped__,interceptor=function(t){return baseAt(t,e)};if(t>1||this.__actions__.length||!(a instanceof LazyWrapper)||!isIndex(s)){return this.thru(interceptor)}a=a.slice(s,+s+(t?1:0));a.__actions__.push({func:thru,args:[interceptor],thisArg:r});return new LodashWrapper(a,this.__chain__).thru((function(e){if(t&&!e.length){e.push(r)}return e}))}));function wrapperChain(){return chain(this)}function wrapperCommit(){return new LodashWrapper(this.value(),this.__chain__)}function wrapperNext(){if(this.__values__===r){this.__values__=toArray(this.value())}var e=this.__index__>=this.__values__.length,t=e?r:this.__values__[this.__index__++];return{done:e,value:t}}function wrapperToIterator(){return this}function wrapperPlant(e){var t,s=this;while(s instanceof baseLodash){var a=wrapperClone(s);a.__index__=0;a.__values__=r;if(t){n.__wrapped__=a}else{t=a}var n=a;s=s.__wrapped__}n.__wrapped__=e;return t}function wrapperReverse(){var e=this.__wrapped__;if(e instanceof LazyWrapper){var t=e;if(this.__actions__.length){t=new LazyWrapper(this)}t=t.reverse();t.__actions__.push({func:thru,args:[reverse],thisArg:r});return new LodashWrapper(t,this.__chain__)}return this.thru(reverse)}function wrapperValue(){return baseWrapperValue(this.__wrapped__,this.__actions__)}var ms=createAggregator((function(e,t,r){if(ft.call(e,r)){++e[r]}else{baseAssignValue(e,r,1)}}));function every(e,t,s){var a=Ns(e)?arrayEvery:baseEvery;if(s&&isIterateeCall(e,t,s)){t=r}return a(e,getIteratee(t,3))}function filter(e,t){var r=Ns(e)?arrayFilter:baseFilter;return r(e,getIteratee(t,3))}var ys=createFind(findIndex);var gs=createFind(findLastIndex);function flatMap(e,t){return baseFlatten(map(e,t),1)}function flatMapDeep(e,t){return baseFlatten(map(e,t),A)}function flatMapDepth(e,t,s){s=s===r?1:toInteger(s);return baseFlatten(map(e,t),s)}function forEach(e,t){var r=Ns(e)?arrayEach:Ar;return r(e,getIteratee(t,3))}function forEachRight(e,t){var r=Ns(e)?arrayEachRight:Rr;return r(e,getIteratee(t,3))}var hs=createAggregator((function(e,t,r){if(ft.call(e,r)){e[r].push(t)}else{baseAssignValue(e,r,[t])}}));function includes(e,t,r,s){e=isArrayLike(e)?e:values(e);r=r&&!s?toInteger(r):0;var a=e.length;if(r<0){r=Gt(a+r,0)}return isString(e)?r<=a&&e.indexOf(t,r)>-1:!!a&&baseIndexOf(e,t,r)>-1}var bs=baseRest((function(e,r,s){var a=-1,n=typeof r=="function",o=isArrayLike(e)?t(e.length):[];Ar(e,(function(e){o[++a]=n?apply(r,e,s):baseInvoke(e,r,s)}));return o}));var xs=createAggregator((function(e,t,r){baseAssignValue(e,r,t)}));function map(e,t){var r=Ns(e)?arrayMap:baseMap;return r(e,getIteratee(t,3))}function orderBy(e,t,s,a){if(e==null){return[]}if(!Ns(t)){t=t==null?[]:[t]}s=a?r:s;if(!Ns(s)){s=s==null?[]:[s]}return baseOrderBy(e,t,s)}var vs=createAggregator((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]}));function reduce(e,t,r){var s=Ns(e)?arrayReduce:baseReduce,a=arguments.length<3;return s(e,getIteratee(t,4),r,a,Ar)}function reduceRight(e,t,r){var s=Ns(e)?arrayReduceRight:baseReduce,a=arguments.length<3;return s(e,getIteratee(t,4),r,a,Rr)}function reject(e,t){var r=Ns(e)?arrayFilter:baseFilter;return r(e,negate(getIteratee(t,3)))}function sample(e){var t=Ns(e)?arraySample:baseSample;return t(e)}function sampleSize(e,t,s){if(s?isIterateeCall(e,t,s):t===r){t=1}else{t=toInteger(t)}var a=Ns(e)?arraySampleSize:baseSampleSize;return a(e,t)}function shuffle(e){var t=Ns(e)?arrayShuffle:baseShuffle;return t(e)}function size(e){if(e==null){return 0}if(isArrayLike(e)){return isString(e)?stringSize(e):e.length}var t=qr(e);if(t==Y||t==se){return e.size}return baseKeys(e).length}function some(e,t,s){var a=Ns(e)?arraySome:baseSome;if(s&&isIterateeCall(e,t,s)){t=r}return a(e,getIteratee(t,3))}var Es=baseRest((function(e,t){if(e==null){return[]}var r=t.length;if(r>1&&isIterateeCall(e,t[0],t[1])){t=[]}else if(r>2&&isIterateeCall(t[0],t[1],t[2])){t=[t[0]]}return baseOrderBy(e,baseFlatten(t,1),[])}));var js=Nt||function(){return ir.Date.now()};function after(e,t){if(typeof t!="function"){throw new nt(o)}e=toInteger(e);return function(){if(--e<1){return t.apply(this,arguments)}}}function ary(e,t,s){t=s?r:t;t=e&&t==null?e.length:t;return createWrap(e,j,r,r,r,r,t)}function before(e,t){var s;if(typeof t!="function"){throw new nt(o)}e=toInteger(e);return function(){if(--e>0){s=t.apply(this,arguments)}if(e<=1){t=r}return s}}var ws=baseRest((function(e,t,r){var s=y;if(r.length){var a=replaceHolders(r,getHolder(ws));s|=v}return createWrap(e,s,t,r,a)}));var _s=baseRest((function(e,t,r){var s=y|g;if(r.length){var a=replaceHolders(r,getHolder(_s));s|=v}return createWrap(t,s,e,r,a)}));function curry(e,t,s){t=s?r:t;var a=createWrap(e,b,r,r,r,r,r,t);a.placeholder=curry.placeholder;return a}function curryRight(e,t,s){t=s?r:t;var a=createWrap(e,x,r,r,r,r,r,t);a.placeholder=curryRight.placeholder;return a}function debounce(e,t,s){var a,n,i,l,c,u,p=0,d=false,f=false,m=true;if(typeof e!="function"){throw new nt(o)}t=toNumber(t)||0;if(isObject(s)){d=!!s.leading;f="maxWait"in s;i=f?Gt(toNumber(s.maxWait)||0,t):i;m="trailing"in s?!!s.trailing:m}function invokeFunc(t){var s=a,o=n;a=n=r;p=t;l=e.apply(o,s);return l}function leadingEdge(e){p=e;c=zr(timerExpired,t);return d?invokeFunc(e):l}function remainingWait(e){var r=e-u,s=e-p,a=t-r;return f?Ht(a,i-s):a}function shouldInvoke(e){var s=e-u,a=e-p;return u===r||s>=t||s<0||f&&a>=i}function timerExpired(){var e=js();if(shouldInvoke(e)){return trailingEdge(e)}c=zr(timerExpired,remainingWait(e))}function trailingEdge(e){c=r;if(m&&a){return invokeFunc(e)}a=n=r;return l}function cancel(){if(c!==r){Br(c)}p=0;a=u=n=c=r}function flush(){return c===r?l:trailingEdge(js())}function debounced(){var e=js(),s=shouldInvoke(e);a=arguments;n=this;u=e;if(s){if(c===r){return leadingEdge(u)}if(f){Br(c);c=zr(timerExpired,t);return invokeFunc(u)}}if(c===r){c=zr(timerExpired,t)}return l}debounced.cancel=cancel;debounced.flush=flush;return debounced}var Ss=baseRest((function(e,t){return baseDelay(e,1,t)}));var Os=baseRest((function(e,t,r){return baseDelay(e,toNumber(t)||0,r)}));function flip(e){return createWrap(e,_)}function memoize(e,t){if(typeof e!="function"||t!=null&&typeof t!="function"){throw new nt(o)}var memoized=function(){var r=arguments,s=t?t.apply(this,r):r[0],a=memoized.cache;if(a.has(s)){return a.get(s)}var n=e.apply(this,r);memoized.cache=a.set(s,n)||a;return n};memoized.cache=new(memoize.Cache||MapCache);return memoized}memoize.Cache=MapCache;function negate(e){if(typeof e!="function"){throw new nt(o)}return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function once(e){return before(2,e)}var ks=Lr((function(e,t){t=t.length==1&&Ns(t[0])?arrayMap(t[0],baseUnary(getIteratee())):arrayMap(baseFlatten(t,1),baseUnary(getIteratee()));var r=t.length;return baseRest((function(s){var a=-1,n=Ht(s.length,r);while(++a=t}));var Rs=baseIsArguments(function(){return arguments}())?baseIsArguments:function(e){return isObjectLike(e)&&ft.call(e,"callee")&&!kt.call(e,"callee")};var Ns=t.isArray;var Ts=fr?baseUnary(fr):baseIsArrayBuffer;function isArrayLike(e){return e!=null&&isLength(e.length)&&!isFunction(e)}function isArrayLikeObject(e){return isObjectLike(e)&&isArrayLike(e)}function isBoolean(e){return e===true||e===false||isObjectLike(e)&&baseGetTag(e)==q}var Ms=Bt||stubFalse;var Fs=mr?baseUnary(mr):baseIsDate;function isElement(e){return isObjectLike(e)&&e.nodeType===1&&!isPlainObject(e)}function isEmpty(e){if(e==null){return true}if(isArrayLike(e)&&(Ns(e)||typeof e=="string"||typeof e.splice=="function"||Ms(e)||Us(e)||Rs(e))){return!e.length}var t=qr(e);if(t==Y||t==se){return!e.size}if(isPrototype(e)){return!baseKeys(e).length}for(var r in e){if(ft.call(e,r)){return false}}return true}function isEqual(e,t){return baseIsEqual(e,t)}function isEqualWith(e,t,s){s=typeof s=="function"?s:r;var a=s?s(e,t):r;return a===r?baseIsEqual(e,t,r,s):!!a}function isError(e){if(!isObjectLike(e)){return false}var t=baseGetTag(e);return t==z||t==H||typeof e.message=="string"&&typeof e.name=="string"&&!isPlainObject(e)}function isFinite(e){return typeof e=="number"&&Wt(e)}function isFunction(e){if(!isObject(e)){return false}var t=baseGetTag(e);return t==K||t==X||t==V||t==te}function isInteger(e){return typeof e=="number"&&e==toInteger(e)}function isLength(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=R}function isObject(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function isObjectLike(e){return e!=null&&typeof e=="object"}var Ls=yr?baseUnary(yr):baseIsMap;function isMatch(e,t){return e===t||baseIsMatch(e,t,getMatchData(t))}function isMatchWith(e,t,s){s=typeof s=="function"?s:r;return baseIsMatch(e,t,getMatchData(t),s)}function isNaN(e){return isNumber(e)&&e!=+e}function isNative(e){if(Gr(e)){throw new Qe(n)}return baseIsNative(e)}function isNull(e){return e===null}function isNil(e){return e==null}function isNumber(e){return typeof e=="number"||isObjectLike(e)&&baseGetTag(e)==J}function isPlainObject(e){if(!isObjectLike(e)||baseGetTag(e)!=Q){return false}var t=St(e);if(t===null){return true}var r=ft.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&dt.call(r)==bt}var Bs=gr?baseUnary(gr):baseIsRegExp;function isSafeInteger(e){return isInteger(e)&&e>=-R&&e<=R}var Ws=hr?baseUnary(hr):baseIsSet;function isString(e){return typeof e=="string"||!Ns(e)&&isObjectLike(e)&&baseGetTag(e)==ae}function isSymbol(e){return typeof e=="symbol"||isObjectLike(e)&&baseGetTag(e)==ne}var Us=br?baseUnary(br):baseIsTypedArray;function isUndefined(e){return e===r}function isWeakMap(e){return isObjectLike(e)&&qr(e)==ie}function isWeakSet(e){return isObjectLike(e)&&baseGetTag(e)==le}var $s=createRelationalOperation(baseLt);var Vs=createRelationalOperation((function(e,t){return e<=t}));function toArray(e){if(!e){return[]}if(isArrayLike(e)){return isString(e)?stringToArray(e):copyArray(e)}if(Dt&&e[Dt]){return iteratorToArray(e[Dt]())}var t=qr(e),r=t==Y?mapToArray:t==se?setToArray:values;return r(e)}function toFinite(e){if(!e){return e===0?e:0}e=toNumber(e);if(e===A||e===-A){var t=e<0?-1:1;return t*N}return e===e?e:0}function toInteger(e){var t=toFinite(e),r=t%1;return t===t?r?t-r:t:0}function toLength(e){return e?baseClamp(toInteger(e),0,F):0}function toNumber(e){if(typeof e=="number"){return e}if(isSymbol(e)){return M}if(isObject(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=isObject(t)?t+"":t}if(typeof e!="string"){return e===0?e:+e}e=e.replace(Te,"");var r=He.test(e);return r||Ke.test(e)?ar(e.slice(2),r?2:8):Ge.test(e)?M:+e}function toPlainObject(e){return copyObject(e,keysIn(e))}function toSafeInteger(e){return e?baseClamp(toInteger(e),-R,R):e===0?e:0}function toString(e){return e==null?"":baseToString(e)}var qs=createAssigner((function(e,t){if(isPrototype(t)||isArrayLike(t)){copyObject(t,keys(t),e);return}for(var r in t){if(ft.call(t,r)){assignValue(e,r,t[r])}}}));var Gs=createAssigner((function(e,t){copyObject(t,keysIn(t),e)}));var Hs=createAssigner((function(e,t,r,s){copyObject(t,keysIn(t),e,s)}));var zs=createAssigner((function(e,t,r,s){copyObject(t,keys(t),e,s)}));var Ks=flatRest(baseAt);function create(e,t){var r=Cr(e);return t==null?r:baseAssign(r,t)}var Xs=baseRest((function(e,t){e=rt(e);var s=-1;var a=t.length;var n=a>2?t[2]:r;if(n&&isIterateeCall(t[0],t[1],n)){a=1}while(++s1);return t}));copyObject(e,getAllKeysIn(e),r);if(s){r=baseClone(r,u|p|d,customOmitClone)}var a=t.length;while(a--){baseUnset(r,t[a])}return r}));function omitBy(e,t){return pickBy(e,negate(getIteratee(t)))}var sa=flatRest((function(e,t){return e==null?{}:basePick(e,t)}));function pickBy(e,t){if(e==null){return{}}var r=arrayMap(getAllKeysIn(e),(function(e){return[e]}));t=getIteratee(t);return basePickBy(e,r,(function(e,r){return t(e,r[0])}))}function result(e,t,s){t=castPath(t,e);var a=-1,n=t.length;if(!n){n=1;e=r}while(++at){var a=e;e=t;t=a}if(s||e%1||t%1){var n=Qt();return Ht(e+n*(t-e+sr("1e-"+((n+"").length-1))),t)}return baseRandom(e,t)}var oa=createCompounder((function(e,t,r){t=t.toLowerCase();return e+(r?capitalize(t):t)}));function capitalize(e){return fa(toString(e).toLowerCase())}function deburr(e){e=toString(e);return e&&e.replace(Ye,vr).replace(qt,"")}function endsWith(e,t,s){e=toString(e);t=baseToString(t);var a=e.length;s=s===r?a:baseClamp(toInteger(s),0,a);var n=s;s-=t.length;return s>=0&&e.slice(s,n)==t}function escape(e){e=toString(e);return e&&Oe.test(e)?e.replace(_e,Er):e}function escapeRegExp(e){e=toString(e);return e&&Ne.test(e)?e.replace(Re,"\\$&"):e}var ia=createCompounder((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}));var la=createCompounder((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}));var ca=createCaseFirst("toLowerCase");function pad(e,t,r){e=toString(e);t=toInteger(t);var s=t?stringSize(e):0;if(!t||s>=t){return e}var a=(t-s)/2;return createPadding(Ft(a),r)+e+createPadding(Mt(a),r)}function padEnd(e,t,r){e=toString(e);t=toInteger(t);var s=t?stringSize(e):0;return t&&s>>0;if(!s){return[]}e=toString(e);if(e&&(typeof t=="string"||t!=null&&!Bs(t))){t=baseToString(t);if(!t&&hasUnicode(e)){return castSlice(stringToArray(e),0,s)}}return e.split(t,s)}var pa=createCompounder((function(e,t,r){return e+(r?" ":"")+fa(t)}));function startsWith(e,t,r){e=toString(e);r=r==null?0:baseClamp(toInteger(r),0,e.length);t=baseToString(t);return e.slice(r,r+t.length)==t}function template(e,t,s){var a=lodash.templateSettings;if(s&&isIterateeCall(e,t,s)){t=r}e=toString(e);t=Hs({},t,a,customDefaultsAssignIn);var n=Hs({},t.imports,a.imports,customDefaultsAssignIn),o=keys(n),i=baseValues(n,o);var l,c,u=0,p=t.interpolate||Je,d="__p += '";var f=st((t.escape||Je).source+"|"+p.source+"|"+(p===Ie?Ve:Je).source+"|"+(t.evaluate||Je).source+"|$","g");var m="//# sourceURL="+(ft.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Yt+"]")+"\n";e.replace(f,(function(t,r,s,a,n,o){s||(s=a);d+=e.slice(u,o).replace(Ze,escapeStringChar);if(r){l=true;d+="' +\n__e("+r+") +\n'"}if(n){c=true;d+="';\n"+n+";\n__p += '"}if(s){d+="' +\n((__t = ("+s+")) == null ? '' : __t) +\n'"}u=o+t.length;return t}));d+="';\n";var y=ft.call(t,"variable")&&t.variable;if(!y){d="with (obj) {\n"+d+"\n}\n"}d=(c?d.replace(ve,""):d).replace(Ee,"$1").replace(je,"$1;");d="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(l?", __e = _.escape":"")+(c?", __j = Array.prototype.join;\n"+"function print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=ma((function(){return et(o,m+"return "+d).apply(r,i)}));g.source=d;if(isError(g)){throw g}return g}function toLower(e){return toString(e).toLowerCase()}function toUpper(e){return toString(e).toUpperCase()}function trim(e,t,s){e=toString(e);if(e&&(s||t===r)){return e.replace(Te,"")}if(!e||!(t=baseToString(t))){return e}var a=stringToArray(e),n=stringToArray(t),o=charsStartIndex(a,n),i=charsEndIndex(a,n)+1;return castSlice(a,o,i).join("")}function trimEnd(e,t,s){e=toString(e);if(e&&(s||t===r)){return e.replace(Fe,"")}if(!e||!(t=baseToString(t))){return e}var a=stringToArray(e),n=charsEndIndex(a,stringToArray(t))+1;return castSlice(a,0,n).join("")}function trimStart(e,t,s){e=toString(e);if(e&&(s||t===r)){return e.replace(Me,"")}if(!e||!(t=baseToString(t))){return e}var a=stringToArray(e),n=charsStartIndex(a,stringToArray(t));return castSlice(a,n).join("")}function truncate(e,t){var s=S,a=O;if(isObject(t)){var n="separator"in t?t.separator:n;s="length"in t?toInteger(t.length):s;a="omission"in t?baseToString(t.omission):a}e=toString(e);var o=e.length;if(hasUnicode(e)){var i=stringToArray(e);o=i.length}if(s>=o){return e}var l=s-stringSize(a);if(l<1){return a}var c=i?castSlice(i,0,l).join(""):e.slice(0,l);if(n===r){return c+a}if(i){l+=c.length-l}if(Bs(n)){if(e.slice(l).search(n)){var u,p=c;if(!n.global){n=st(n.source,toString(qe.exec(n))+"g")}n.lastIndex=0;while(u=n.exec(p)){var d=u.index}c=c.slice(0,d===r?l:d)}}else if(e.indexOf(baseToString(n),l)!=l){var f=c.lastIndexOf(n);if(f>-1){c=c.slice(0,f)}}return c+a}function unescape(e){e=toString(e);return e&&Se.test(e)?e.replace(we,jr):e}var da=createCompounder((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}));var fa=createCaseFirst("toUpperCase");function words(e,t,s){e=toString(e);t=s?r:t;if(t===r){return hasUnicodeWord(e)?unicodeWords(e):asciiWords(e)}return e.match(t)||[]}var ma=baseRest((function(e,t){try{return apply(e,r,t)}catch(e){return isError(e)?e:new Qe(e)}}));var ya=flatRest((function(e,t){arrayEach(t,(function(t){t=toKey(t);baseAssignValue(e,t,ws(e[t],e))}));return e}));function cond(e){var t=e==null?0:e.length,r=getIteratee();e=!t?[]:arrayMap(e,(function(e){if(typeof e[1]!="function"){throw new nt(o)}return[r(e[0]),e[1]]}));return baseRest((function(r){var s=-1;while(++sR){return[]}var r=F,s=Ht(e,F);t=getIteratee(t);e-=F;var a=baseTimes(s,t);while(++r0||t<0)){return new LazyWrapper(s)}if(e<0){s=s.takeRight(-e)}else if(e){s=s.drop(e)}if(t!==r){t=toInteger(t);s=t<0?s.dropRight(-t):s.take(t-e)}return s};LazyWrapper.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()};LazyWrapper.prototype.toArray=function(){return this.take(F)};baseForOwn(LazyWrapper.prototype,(function(e,t){var s=/^(?:filter|find|map|reject)|While$/.test(t),a=/^(?:head|last)$/.test(t),n=lodash[a?"take"+(t=="last"?"Right":""):t],o=a||/^find/.test(t);if(!n){return}lodash.prototype[t]=function(){var t=this.__wrapped__,i=a?[1]:arguments,l=t instanceof LazyWrapper,c=i[0],u=l||Ns(t);var interceptor=function(e){var t=n.apply(lodash,arrayPush([e],i));return a&&p?t[0]:t};if(u&&s&&typeof c=="function"&&c.length!=1){l=u=false}var p=this.__chain__,d=!!this.__actions__.length,f=o&&!p,m=l&&!d;if(!o&&u){t=m?t:new LazyWrapper(this);var y=e.apply(t,i);y.__actions__.push({func:thru,args:[interceptor],thisArg:r});return new LodashWrapper(y,p)}if(f&&m){return e.apply(this,i)}y=this.thru(interceptor);return f?a?y.value()[0]:y.value():y}}));arrayEach(["pop","push","shift","sort","splice","unshift"],(function(e){var t=ot[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",s=/^(?:pop|shift)$/.test(e);lodash.prototype[e]=function(){var e=arguments;if(s&&!this.__chain__){var a=this.value();return t.apply(Ns(a)?a:[],e)}return this[r]((function(r){return t.apply(Ns(r)?r:[],e)}))}}));baseForOwn(LazyWrapper.prototype,(function(e,t){var r=lodash[t];if(r){var s=r.name+"";if(!ft.call(dr,s)){dr[s]=[]}dr[s].push({name:t,func:r})}}));dr[createHybrid(r,g).name]=[{name:"wrapper",func:r}];LazyWrapper.prototype.clone=lazyClone;LazyWrapper.prototype.reverse=lazyReverse;LazyWrapper.prototype.value=lazyValue;lodash.prototype.at=fs;lodash.prototype.chain=wrapperChain;lodash.prototype.commit=wrapperCommit;lodash.prototype.next=wrapperNext;lodash.prototype.plant=wrapperPlant;lodash.prototype.reverse=wrapperReverse;lodash.prototype.toJSON=lodash.prototype.valueOf=lodash.prototype.value=wrapperValue;lodash.prototype.first=lodash.prototype.head;if(Dt){lodash.prototype[Dt]=wrapperToIterator}return lodash};var _r=wr();if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){ir._=_r;define((function(){return _r}))}else if(cr){(cr.exports=_r)._=_r;lr._=_r}else{ir._=_r}}).call(this)},2742:e=>{"use strict";var t=process.platform==="win32";var r=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;var s=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/;var a={};function win32SplitPath(e){var t=r.exec(e),a=(t[1]||"")+(t[2]||""),n=t[3]||"";var o=s.exec(n),i=o[1],l=o[2],c=o[3];return[a,i,l,c]}a.parse=function(e){if(typeof e!=="string"){throw new TypeError("Parameter 'pathString' must be a string, not "+typeof e)}var t=win32SplitPath(e);if(!t||t.length!==4){throw new TypeError("Invalid path '"+e+"'")}return{root:t[0],dir:t[0]+t[1].slice(0,-1),base:t[2],ext:t[3],name:t[2].slice(0,t[2].length-t[3].length)}};var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var o={};function posixSplitPath(e){return n.exec(e).slice(1)}o.parse=function(e){if(typeof e!=="string"){throw new TypeError("Parameter 'pathString' must be a string, not "+typeof e)}var t=posixSplitPath(e);if(!t||t.length!==4){throw new TypeError("Invalid path '"+e+"'")}t[1]=t[1]||"";t[2]=t[2]||"";t[3]=t[3]||"";return{root:t[0],dir:t[0]+t[1].slice(0,-1),base:t[2],ext:t[3],name:t[2].slice(0,t[2].length-t[3].length)}};if(t)e.exports=a.parse;else e.exports=o.parse;e.exports.posix=o.parse;e.exports.win32=a.parse},1782:(e,t)=>{"use strict";var r=Object;var s=Object.defineProperty;var a=Object.create;function defProp(e,t,a){if(s)try{s.call(r,e,t,{value:a})}catch(r){e[t]=a}else{e[t]=a}}function makeSafeToCall(e){if(e){defProp(e,"call",e.call);defProp(e,"apply",e.apply)}return e}makeSafeToCall(s);makeSafeToCall(a);var n=makeSafeToCall(Object.prototype.hasOwnProperty);var o=makeSafeToCall(Number.prototype.toString);var i=makeSafeToCall(String.prototype.slice);var cloner=function(){};function create(e){if(a){return a.call(r,e)}cloner.prototype=e||null;return new cloner}var l=Math.random;var c=create(null);function makeUniqueKey(){do{var e=internString(i.call(o.call(l(),36),2))}while(n.call(c,e));return c[e]=e}function internString(e){var t={};t[e]=true;return Object.keys(t)[0]}t.makeUniqueKey=makeUniqueKey;var u=Object.getOwnPropertyNames;Object.getOwnPropertyNames=function getOwnPropertyNames(e){for(var t=u(e),r=0,s=0,a=t.length;rs){t[s]=t[r]}++s}}t.length=s;return t};function defaultCreatorFn(e){return create(null)}function makeAccessor(e){var t=makeUniqueKey();var r=create(null);e=e||defaultCreatorFn;function register(s){var a;function vault(t,n){if(t===r){return n?a=null:a||(a=e(s))}}defProp(s,t,vault)}function accessor(e){if(!n.call(e,t))register(e);return e[t](r)}accessor.forget=function(e){if(n.call(e,t))e[t](r,true)};return accessor}t.makeAccessor=makeAccessor},8741:function(e,t,r){e=r.nmd(e); +/*! https://mths.be/regenerate v1.3.3 by @mathias | MIT license */(function(r){var s=true&&t;var a=true&&e&&e.exports==s&&e;var n=typeof global=="object"&&global;if(n.global===n||n.window===n){r=n}var o={rangeOrder:"A range’s `stop` value must be greater than or equal "+"to the `start` value.",codePointRange:"Invalid code point value. Code points range from "+"U+000000 to U+10FFFF."};var i=55296;var l=56319;var c=56320;var u=57343;var p=/\\x00([^0123456789]|$)/g;var d={};var f=d.hasOwnProperty;var extend=function(e,t){var r;for(r in t){if(f.call(t,r)){e[r]=t[r]}}return e};var forEach=function(e,t){var r=-1;var s=e.length;while(++r=s&&tr){return e}if(t<=a&&r>=n){e.splice(s,2);continue}if(t>=a&&r=a&&t<=n){e[s+1]=t}else if(r>=a&&r<=n){e[s]=r+1;return e}s+=2}return e};var dataAdd=function(e,t){var r=0;var s;var a;var n=null;var i=e.length;if(t<0||t>1114111){throw RangeError(o.codePointRange)}while(r=s&&tt){e.splice(n!=null?n+2:0,0,t,t+1);return e}if(t==a){if(t+1==e[r+2]){e.splice(r,4,s,e[r+3]);return e}e[r+1]=t+1;return e}n=r;r+=2}e.push(t,t+1);return e};var dataAddData=function(e,t){var r=0;var s;var a;var n=e.slice();var o=t.length;while(r1114111||r<0||r>1114111){throw RangeError(o.codePointRange)}var s=0;var a;var n;var i=false;var l=e.length;while(sr){return e}if(a>=t&&a<=r){if(n>t&&n-1<=r){e.splice(s,2);s-=2}else{e.splice(s-1,2);s-=2}}}else if(a==r+1){e[s]=t;return e}else if(a>r){e.splice(s,0,t,r+1);return e}else if(t>=a&&t=a&&t=n){e[s]=t;e[s+1]=r+1;i=true}s+=2}if(!i){e.push(t,r+1)}return e};var dataContains=function(e,t){var r=0;var s=e.length;var a=e[r];var n=e[s-1];if(s>=2){if(tn){return false}}while(r=a&&t=40&&e<=43||e==46||e==47||e==63||e>=91&&e<=94||e>=123&&e<=125){t="\\"+b(e)}else if(e>=32&&e<=126){t=b(e)}else if(e<=255){t="\\x"+pad(hex(e),2)}else{t="\\u"+pad(hex(e),4)}return t};var codePointToStringUnicode=function(e){if(e<=65535){return codePointToString(e)}return"\\u{"+e.toString(16).toUpperCase()+"}"};var symbolToCodePoint=function(e){var t=e.length;var r=e.charCodeAt(0);var s;if(r>=i&&r<=l&&t>1){s=e.charCodeAt(1);return(r-i)*1024+s-c+65536}return r};var createBMPCharacterClasses=function(e){var t="";var r=0;var s;var a;var n=e.length;if(dataIsSingleton(e)){return codePointToString(e[0])}while(r=i&&p<=l){s.push(o,i);t.push(i,p+1)}if(p>=c&&p<=u){s.push(o,i);t.push(i,l+1);r.push(c,p+1)}if(p>u){s.push(o,i);t.push(i,l+1);r.push(c,u+1);if(p<=65535){s.push(u+1,p+1)}else{s.push(u+1,65535+1);a.push(65535+1,p+1)}}}else if(o>=i&&o<=l){if(p>=i&&p<=l){t.push(o,p+1)}if(p>=c&&p<=u){t.push(o,l+1);r.push(c,p+1)}if(p>u){t.push(o,l+1);r.push(c,u+1);if(p<=65535){s.push(u+1,p+1)}else{s.push(u+1,65535+1);a.push(65535+1,p+1)}}}else if(o>=c&&o<=u){if(p>=c&&p<=u){r.push(o,p+1)}if(p>u){r.push(o,u+1);if(p<=65535){s.push(u+1,p+1)}else{s.push(u+1,65535+1);a.push(65535+1,p+1)}}}else if(o>u&&o<=65535){if(p<=65535){s.push(o,p+1)}else{s.push(o,65535+1);a.push(65535+1,p+1)}}else{a.push(o,p+1)}n+=2}return{loneHighSurrogates:t,loneLowSurrogates:r,bmp:s,astral:a}};var optimizeSurrogateMappings=function(e){var t=[];var r=[];var s=false;var a;var n;var o;var i;var l;var c;var u=-1;var p=e.length;while(++u1){e=g.call(arguments)}if(this instanceof regenerate){this.data=[];return e?this.add(e):this}return(new regenerate).add(e)};regenerate.version="1.3.3";var x=regenerate.prototype;extend(x,{add:function(e){var t=this;if(e==null){return t}if(e instanceof regenerate){t.data=dataAddData(t.data,e.data);return t}if(arguments.length>1){e=g.call(arguments)}if(isArray(e)){forEach(e,(function(e){t.add(e)}));return t}t.data=dataAdd(t.data,isNumber(e)?e:symbolToCodePoint(e));return t},remove:function(e){var t=this;if(e==null){return t}if(e instanceof regenerate){t.data=dataRemoveData(t.data,e.data);return t}if(arguments.length>1){e=g.call(arguments)}if(isArray(e)){forEach(e,(function(e){t.remove(e)}));return t}t.data=dataRemove(t.data,isNumber(e)?e:symbolToCodePoint(e));return t},addRange:function(e,t){var r=this;r.data=dataAddRange(r.data,isNumber(e)?e:symbolToCodePoint(e),isNumber(t)?t:symbolToCodePoint(t));return r},removeRange:function(e,t){var r=this;var s=isNumber(e)?e:symbolToCodePoint(e);var a=isNumber(t)?t:symbolToCodePoint(t);r.data=dataRemoveRange(r.data,s,a);return r},intersection:function(e){var t=this;var r=e instanceof regenerate?dataToArray(e.data):e;t.data=dataIntersection(t.data,r);return t},contains:function(e){return dataContains(this.data,isNumber(e)?e:symbolToCodePoint(e))},clone:function(){var e=new regenerate;e.data=this.data.slice(0);return e},toString:function(e){var t=createCharacterClassesFromData(this.data,e?e.bmpOnly:false,e?e.hasUnicodeFlag:false);if(!t){return"[]"}return t.replace(p,"\\0$1")},toRegExp:function(e){var t=this.toString(e&&e.indexOf("u")!=-1?{hasUnicodeFlag:true}:null);return RegExp(t,e||"")},valueOf:function(){return dataToArray(this.data)}});x.toArray=x.valueOf;if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define((function(){return regenerate}))}else if(s&&!s.nodeType){if(a){a.exports=regenerate}else{s.regenerate=regenerate}}else{r.regenerate=regenerate}})(this)},6419:(e,t,r)=>{"use strict";var s=r(449);var a=r(6919);var n=a(r(9491));var o=s(r(9048));var i=s(r(3085));var l=s(r(6401));var c=Object.prototype.hasOwnProperty;function Emitter(e){n["default"].ok(this instanceof Emitter);l.getTypes().assertIdentifier(e);this.nextTempId=0;this.contextId=e;this.listing=[];this.marked=[true];this.insertedLocs=new Set;this.finalLoc=this.loc();this.tryEntries=[];this.leapManager=new o.LeapManager(this)}var u=Emitter.prototype;t.Emitter=Emitter;u.loc=function(){var e=l.getTypes().numericLiteral(-1);this.insertedLocs.add(e);return e};u.getInsertedLocs=function(){return this.insertedLocs};u.getContextId=function(){return l.getTypes().clone(this.contextId)};u.mark=function(e){l.getTypes().assertLiteral(e);var t=this.listing.length;if(e.value===-1){e.value=t}else{n["default"].strictEqual(e.value,t)}this.marked[t]=true;return e};u.emit=function(e){var t=l.getTypes();if(t.isExpression(e)){e=t.expressionStatement(e)}t.assertStatement(e);this.listing.push(e)};u.emitAssign=function(e,t){this.emit(this.assign(e,t));return e};u.assign=function(e,t){var r=l.getTypes();return r.expressionStatement(r.assignmentExpression("=",r.cloneDeep(e),t))};u.contextProperty=function(e,t){var r=l.getTypes();return r.memberExpression(this.getContextId(),t?r.stringLiteral(e):r.identifier(e),!!t)};u.stop=function(e){if(e){this.setReturnValue(e)}this.jump(this.finalLoc)};u.setReturnValue=function(e){l.getTypes().assertExpression(e.value);this.emitAssign(this.contextProperty("rval"),this.explodeExpression(e))};u.clearPendingException=function(e,t){var r=l.getTypes();r.assertLiteral(e);var s=r.callExpression(this.contextProperty("catch",true),[r.clone(e)]);if(t){this.emitAssign(t,s)}else{this.emit(s)}};u.jump=function(e){this.emitAssign(this.contextProperty("next"),e);this.emit(l.getTypes().breakStatement())};u.jumpIf=function(e,t){var r=l.getTypes();r.assertExpression(e);r.assertLiteral(t);this.emit(r.ifStatement(e,r.blockStatement([this.assign(this.contextProperty("next"),t),r.breakStatement()])))};u.jumpIfNot=function(e,t){var r=l.getTypes();r.assertExpression(e);r.assertLiteral(t);var s;if(r.isUnaryExpression(e)&&e.operator==="!"){s=e.argument}else{s=r.unaryExpression("!",e)}this.emit(r.ifStatement(s,r.blockStatement([this.assign(this.contextProperty("next"),t),r.breakStatement()])))};u.makeTempVar=function(){return this.contextProperty("t"+this.nextTempId++)};u.getContextFunction=function(e){var t=l.getTypes();return t.functionExpression(e||null,[this.getContextId()],t.blockStatement([this.getDispatchLoop()]),false,false)};u.getDispatchLoop=function(){var e=this;var t=l.getTypes();var r=[];var s;var a=false;e.listing.forEach((function(n,o){if(e.marked.hasOwnProperty(o)){r.push(t.switchCase(t.numericLiteral(o),s=[]));a=false}if(!a){s.push(n);if(t.isCompletionStatement(n))a=true}}));this.finalLoc.value=this.listing.length;r.push(t.switchCase(this.finalLoc,[]),t.switchCase(t.stringLiteral("end"),[t.returnStatement(t.callExpression(this.contextProperty("stop"),[]))]));return t.whileStatement(t.numericLiteral(1),t.switchStatement(t.assignmentExpression("=",this.contextProperty("prev"),this.contextProperty("next")),r))};u.getTryLocsList=function(){if(this.tryEntries.length===0){return null}var e=l.getTypes();var t=0;return e.arrayExpression(this.tryEntries.map((function(r){var s=r.firstLoc.value;n["default"].ok(s>=t,"try entries out of order");t=s;var a=r.catchEntry;var o=r.finallyEntry;var i=[r.firstLoc,a?a.firstLoc:null];if(o){i[2]=o.firstLoc;i[3]=o.afterLoc}return e.arrayExpression(i.map((function(t){return t&&e.clone(t)})))})))};u.explode=function(e,t){var r=l.getTypes();var s=e.node;var a=this;r.assertNode(s);if(r.isDeclaration(s))throw getDeclError(s);if(r.isStatement(s))return a.explodeStatement(e);if(r.isExpression(s))return a.explodeExpression(e,t);switch(s.type){case"Program":return e.get("body").map(a.explodeStatement,a);case"VariableDeclarator":throw getDeclError(s);case"Property":case"SwitchCase":case"CatchClause":throw new Error(s.type+" nodes should be handled by their parents");default:throw new Error("unknown Node of type "+JSON.stringify(s.type))}};function getDeclError(e){return new Error("all declarations should have been transformed into "+"assignments before the Exploder began its work: "+JSON.stringify(e))}u.explodeStatement=function(e,t){var r=l.getTypes();var s=e.node;var a=this;var c,u,d;r.assertStatement(s);if(t){r.assertIdentifier(t)}else{t=null}if(r.isBlockStatement(s)){e.get("body").forEach((function(e){a.explodeStatement(e)}));return}if(!i.containsLeap(s)){a.emit(s);return}switch(s.type){case"ExpressionStatement":a.explodeExpression(e.get("expression"),true);break;case"LabeledStatement":u=this.loc();a.leapManager.withEntry(new o.LabeledEntry(u,s.label),(function(){a.explodeStatement(e.get("body"),s.label)}));a.mark(u);break;case"WhileStatement":c=this.loc();u=this.loc();a.mark(c);a.jumpIfNot(a.explodeExpression(e.get("test")),u);a.leapManager.withEntry(new o.LoopEntry(u,c,t),(function(){a.explodeStatement(e.get("body"))}));a.jump(c);a.mark(u);break;case"DoWhileStatement":var f=this.loc();var m=this.loc();u=this.loc();a.mark(f);a.leapManager.withEntry(new o.LoopEntry(u,m,t),(function(){a.explode(e.get("body"))}));a.mark(m);a.jumpIf(a.explodeExpression(e.get("test")),f);a.mark(u);break;case"ForStatement":d=this.loc();var y=this.loc();u=this.loc();if(s.init){a.explode(e.get("init"),true)}a.mark(d);if(s.test){a.jumpIfNot(a.explodeExpression(e.get("test")),u)}else{}a.leapManager.withEntry(new o.LoopEntry(u,y,t),(function(){a.explodeStatement(e.get("body"))}));a.mark(y);if(s.update){a.explode(e.get("update"),true)}a.jump(d);a.mark(u);break;case"TypeCastExpression":return a.explodeExpression(e.get("expression"));case"ForInStatement":d=this.loc();u=this.loc();var g=a.makeTempVar();a.emitAssign(g,r.callExpression(l.runtimeProperty("keys"),[a.explodeExpression(e.get("right"))]));a.mark(d);var h=a.makeTempVar();a.jumpIf(r.memberExpression(r.assignmentExpression("=",h,r.callExpression(r.cloneDeep(g),[])),r.identifier("done"),false),u);a.emitAssign(s.left,r.memberExpression(r.cloneDeep(h),r.identifier("value"),false));a.leapManager.withEntry(new o.LoopEntry(u,d,t),(function(){a.explodeStatement(e.get("body"))}));a.jump(d);a.mark(u);break;case"BreakStatement":a.emitAbruptCompletion({type:"break",target:a.leapManager.getBreakLoc(s.label)});break;case"ContinueStatement":a.emitAbruptCompletion({type:"continue",target:a.leapManager.getContinueLoc(s.label)});break;case"SwitchStatement":var b=a.emitAssign(a.makeTempVar(),a.explodeExpression(e.get("discriminant")));u=this.loc();var x=this.loc();var v=x;var E=[];var j=s.cases||[];for(var w=j.length-1;w>=0;--w){var _=j[w];r.assertSwitchCase(_);if(_.test){v=r.conditionalExpression(r.binaryExpression("===",r.cloneDeep(b),_.test),E[w]=this.loc(),v)}else{E[w]=x}}var S=e.get("discriminant");l.replaceWithOrRemove(S,v);a.jump(a.explodeExpression(S));a.leapManager.withEntry(new o.SwitchEntry(u),(function(){e.get("cases").forEach((function(e){var t=e.key;a.mark(E[t]);e.get("consequent").forEach((function(e){a.explodeStatement(e)}))}))}));a.mark(u);if(x.value===-1){a.mark(x);n["default"].strictEqual(u.value,x.value)}break;case"IfStatement":var O=s.alternate&&this.loc();u=this.loc();a.jumpIfNot(a.explodeExpression(e.get("test")),O||u);a.explodeStatement(e.get("consequent"));if(O){a.jump(u);a.mark(O);a.explodeStatement(e.get("alternate"))}a.mark(u);break;case"ReturnStatement":a.emitAbruptCompletion({type:"return",value:a.explodeExpression(e.get("argument"))});break;case"WithStatement":throw new Error("WithStatement not supported in generator functions.");case"TryStatement":u=this.loc();var k=s.handler;var P=k&&this.loc();var I=P&&new o.CatchEntry(P,k.param);var D=s.finalizer&&this.loc();var C=D&&new o.FinallyEntry(D,u);var A=new o.TryEntry(a.getUnmarkedCurrentLoc(),I,C);a.tryEntries.push(A);a.updateContextPrevLoc(A.firstLoc);a.leapManager.withEntry(A,(function(){a.explodeStatement(e.get("block"));if(P){if(D){a.jump(D)}else{a.jump(u)}a.updateContextPrevLoc(a.mark(P));var t=e.get("handler.body");var s=a.makeTempVar();a.clearPendingException(A.firstLoc,s);t.traverse(p,{getSafeParam:function getSafeParam(){return r.cloneDeep(s)},catchParamName:k.param.name});a.leapManager.withEntry(I,(function(){a.explodeStatement(t)}))}if(D){a.updateContextPrevLoc(a.mark(D));a.leapManager.withEntry(C,(function(){a.explodeStatement(e.get("finalizer"))}));a.emit(r.returnStatement(r.callExpression(a.contextProperty("finish"),[C.firstLoc])))}}));a.mark(u);break;case"ThrowStatement":a.emit(r.throwStatement(a.explodeExpression(e.get("argument"))));break;default:throw new Error("unknown Statement of type "+JSON.stringify(s.type))}};var p={Identifier:function Identifier(e,t){if(e.node.name===t.catchParamName&&l.isReference(e)){l.replaceWithOrRemove(e,t.getSafeParam())}},Scope:function Scope(e,t){if(e.scope.hasOwnBinding(t.catchParamName)){e.skip()}}};u.emitAbruptCompletion=function(e){if(!isValidCompletion(e)){n["default"].ok(false,"invalid completion record: "+JSON.stringify(e))}n["default"].notStrictEqual(e.type,"normal","normal completions are not abrupt");var t=l.getTypes();var r=[t.stringLiteral(e.type)];if(e.type==="break"||e.type==="continue"){t.assertLiteral(e.target);r[1]=this.insertedLocs.has(e.target)?e.target:t.cloneDeep(e.target)}else if(e.type==="return"||e.type==="throw"){if(e.value){t.assertExpression(e.value);r[1]=this.insertedLocs.has(e.value)?e.value:t.cloneDeep(e.value)}}this.emit(t.returnStatement(t.callExpression(this.contextProperty("abrupt"),r)))};function isValidCompletion(e){var t=e.type;if(t==="normal"){return!c.call(e,"target")}if(t==="break"||t==="continue"){return!c.call(e,"value")&&l.getTypes().isLiteral(e.target)}if(t==="return"||t==="throw"){return c.call(e,"value")&&!c.call(e,"target")}return false}u.getUnmarkedCurrentLoc=function(){return l.getTypes().numericLiteral(this.listing.length)};u.updateContextPrevLoc=function(e){var t=l.getTypes();if(e){t.assertLiteral(e);if(e.value===-1){e.value=this.listing.length}else{n["default"].strictEqual(e.value,this.listing.length)}}else{e=this.getUnmarkedCurrentLoc()}this.emitAssign(this.contextProperty("prev"),e)};u.explodeExpression=function(e,t){var r=l.getTypes();var s=e.node;if(s){r.assertExpression(s)}else{return s}var a=this;var o;var c;function finish(e){r.assertExpression(e);if(t){a.emit(e)}else{return e}}if(!i.containsLeap(s)){return finish(s)}var u=i.containsLeap.onlyChildren(s);function explodeViaTempVar(e,t,s){n["default"].ok(!s||!e,"Ignoring the result of a child expression but forcing it to "+"be assigned to a temporary variable?");var o=a.explodeExpression(t,s);if(s){}else if(e||u&&!r.isLiteral(o)){o=a.emitAssign(e||a.makeTempVar(),o)}return o}switch(s.type){case"MemberExpression":return finish(r.memberExpression(a.explodeExpression(e.get("object")),s.computed?explodeViaTempVar(null,e.get("property")):s.property,s.computed));case"CallExpression":var p=e.get("callee");var d=e.get("arguments");var f;var m;var y=d.some((function(e){return i.containsLeap(e.node)}));var g=null;if(r.isMemberExpression(p.node)){if(y){var h=explodeViaTempVar(a.makeTempVar(),p.get("object"));var b=p.node.computed?explodeViaTempVar(null,p.get("property")):p.node.property;g=h;f=r.memberExpression(r.memberExpression(r.cloneDeep(h),b,p.node.computed),r.identifier("call"),false)}else{f=a.explodeExpression(p)}}else{f=explodeViaTempVar(null,p);if(r.isMemberExpression(f)){f=r.sequenceExpression([r.numericLiteral(0),r.cloneDeep(f)])}}if(y){m=d.map((function(e){return explodeViaTempVar(null,e)}));if(g)m.unshift(g);m=m.map((function(e){return r.cloneDeep(e)}))}else{m=e.node.arguments}return finish(r.callExpression(f,m));case"NewExpression":return finish(r.newExpression(explodeViaTempVar(null,e.get("callee")),e.get("arguments").map((function(e){return explodeViaTempVar(null,e)}))));case"ObjectExpression":return finish(r.objectExpression(e.get("properties").map((function(e){if(e.isObjectProperty()){return r.objectProperty(e.node.key,explodeViaTempVar(null,e.get("value")),e.node.computed)}else{return e.node}}))));case"ArrayExpression":return finish(r.arrayExpression(e.get("elements").map((function(e){if(e.isSpreadElement()){return r.spreadElement(explodeViaTempVar(null,e.get("argument")))}else{return explodeViaTempVar(null,e)}}))));case"SequenceExpression":var x=s.expressions.length-1;e.get("expressions").forEach((function(e){if(e.key===x){o=a.explodeExpression(e,t)}else{a.explodeExpression(e,true)}}));return o;case"LogicalExpression":c=this.loc();if(!t){o=a.makeTempVar()}var v=explodeViaTempVar(o,e.get("left"));if(s.operator==="&&"){a.jumpIfNot(v,c)}else{n["default"].strictEqual(s.operator,"||");a.jumpIf(v,c)}explodeViaTempVar(o,e.get("right"),t);a.mark(c);return o;case"ConditionalExpression":var E=this.loc();c=this.loc();var j=a.explodeExpression(e.get("test"));a.jumpIfNot(j,E);if(!t){o=a.makeTempVar()}explodeViaTempVar(o,e.get("consequent"),t);a.jump(c);a.mark(E);explodeViaTempVar(o,e.get("alternate"),t);a.mark(c);return o;case"UnaryExpression":return finish(r.unaryExpression(s.operator,a.explodeExpression(e.get("argument")),!!s.prefix));case"BinaryExpression":return finish(r.binaryExpression(s.operator,explodeViaTempVar(null,e.get("left")),explodeViaTempVar(null,e.get("right"))));case"AssignmentExpression":if(s.operator==="="){return finish(r.assignmentExpression(s.operator,a.explodeExpression(e.get("left")),a.explodeExpression(e.get("right"))))}var w=a.explodeExpression(e.get("left"));var _=a.emitAssign(a.makeTempVar(),w);return finish(r.assignmentExpression("=",r.cloneDeep(w),r.assignmentExpression(s.operator,r.cloneDeep(_),a.explodeExpression(e.get("right")))));case"UpdateExpression":return finish(r.updateExpression(s.operator,a.explodeExpression(e.get("argument")),s.prefix));case"YieldExpression":c=this.loc();var S=s.argument&&a.explodeExpression(e.get("argument"));if(S&&s.delegate){var O=a.makeTempVar();var k=r.returnStatement(r.callExpression(a.contextProperty("delegateYield"),[S,r.stringLiteral(O.property.name),c]));k.loc=s.loc;a.emit(k);a.mark(c);return O}a.emitAssign(a.contextProperty("next"),c);var P=r.returnStatement(r.cloneDeep(S)||null);P.loc=s.loc;a.emit(P);a.mark(c);return a.contextProperty("sent");default:throw new Error("unknown Expression of type "+JSON.stringify(s.type))}}},5604:(e,t,r)=>{"use strict";var s=r(449);var a=s(r(6401));var n=Object.prototype.hasOwnProperty;t.hoist=function(e){var t=a.getTypes();t.assertFunction(e.node);var r={};function varDeclToExpr(e,s){var a=e.node,n=e.scope;t.assertVariableDeclaration(a);var o=[];a.declarations.forEach((function(e){r[e.id.name]=t.identifier(e.id.name);n.removeBinding(e.id.name);if(e.init){o.push(t.assignmentExpression("=",e.id,e.init))}else if(s){o.push(e.id)}}));if(o.length===0)return null;if(o.length===1)return o[0];return t.sequenceExpression(o)}e.get("body").traverse({VariableDeclaration:{exit:function exit(e){var r=varDeclToExpr(e,false);if(r===null){e.remove()}else{a.replaceWithOrRemove(e,t.expressionStatement(r))}e.skip()}},ForStatement:function ForStatement(e){var t=e.get("init");if(t.isVariableDeclaration()){a.replaceWithOrRemove(t,varDeclToExpr(t,false))}},ForXStatement:function ForXStatement(e){var t=e.get("left");if(t.isVariableDeclaration()){a.replaceWithOrRemove(t,varDeclToExpr(t,true))}},FunctionDeclaration:function FunctionDeclaration(e){var s=e.node;r[s.id.name]=s.id;var n=t.expressionStatement(t.assignmentExpression("=",t.clone(s.id),t.functionExpression(e.scope.generateUidIdentifierBasedOnNode(s),s.params,s.body,s.generator,s.expression)));if(e.parentPath.isBlockStatement()){e.parentPath.unshiftContainer("body",n);e.remove()}else{a.replaceWithOrRemove(e,n)}e.scope.removeBinding(s.id.name);e.skip()},FunctionExpression:function FunctionExpression(e){e.skip()},ArrowFunctionExpression:function ArrowFunctionExpression(e){e.skip()}});var s={};e.get("params").forEach((function(e){var r=e.node;if(t.isIdentifier(r)){s[r.name]=r}else{}}));var o=[];Object.keys(r).forEach((function(e){if(!n.call(s,e)){o.push(t.variableDeclarator(r[e],null))}}));if(o.length===0){return null}return t.variableDeclaration("var",o)}},9522:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=_default;var s=r(5490);function _default(e){var t={visitor:(0,s.getVisitor)(e)};var r=e&&e.version;if(r&&parseInt(r,10)>=7){t.name="regenerator-transform"}return t}},9048:(e,t,r)=>{"use strict";var s=r(6919);var a=s(r(9491));var n=r(6419);var o=r(3837);var i=r(6401);function Entry(){a["default"].ok(this instanceof Entry)}function FunctionEntry(e){Entry.call(this);(0,i.getTypes)().assertLiteral(e);this.returnLoc=e}(0,o.inherits)(FunctionEntry,Entry);t.FunctionEntry=FunctionEntry;function LoopEntry(e,t,r){Entry.call(this);var s=(0,i.getTypes)();s.assertLiteral(e);s.assertLiteral(t);if(r){s.assertIdentifier(r)}else{r=null}this.breakLoc=e;this.continueLoc=t;this.label=r}(0,o.inherits)(LoopEntry,Entry);t.LoopEntry=LoopEntry;function SwitchEntry(e){Entry.call(this);(0,i.getTypes)().assertLiteral(e);this.breakLoc=e}(0,o.inherits)(SwitchEntry,Entry);t.SwitchEntry=SwitchEntry;function TryEntry(e,t,r){Entry.call(this);var s=(0,i.getTypes)();s.assertLiteral(e);if(t){a["default"].ok(t instanceof CatchEntry)}else{t=null}if(r){a["default"].ok(r instanceof FinallyEntry)}else{r=null}a["default"].ok(t||r);this.firstLoc=e;this.catchEntry=t;this.finallyEntry=r}(0,o.inherits)(TryEntry,Entry);t.TryEntry=TryEntry;function CatchEntry(e,t){Entry.call(this);var r=(0,i.getTypes)();r.assertLiteral(e);r.assertIdentifier(t);this.firstLoc=e;this.paramId=t}(0,o.inherits)(CatchEntry,Entry);t.CatchEntry=CatchEntry;function FinallyEntry(e,t){Entry.call(this);var r=(0,i.getTypes)();r.assertLiteral(e);r.assertLiteral(t);this.firstLoc=e;this.afterLoc=t}(0,o.inherits)(FinallyEntry,Entry);t.FinallyEntry=FinallyEntry;function LabeledEntry(e,t){Entry.call(this);var r=(0,i.getTypes)();r.assertLiteral(e);r.assertIdentifier(t);this.breakLoc=e;this.label=t}(0,o.inherits)(LabeledEntry,Entry);t.LabeledEntry=LabeledEntry;function LeapManager(e){a["default"].ok(this instanceof LeapManager);a["default"].ok(e instanceof n.Emitter);this.emitter=e;this.entryStack=[new FunctionEntry(e.finalLoc)]}var l=LeapManager.prototype;t.LeapManager=LeapManager;l.withEntry=function(e,t){a["default"].ok(e instanceof Entry);this.entryStack.push(e);try{t.call(this.emitter)}finally{var r=this.entryStack.pop();a["default"].strictEqual(r,e)}};l._findLeapLocation=function(e,t){for(var r=this.entryStack.length-1;r>=0;--r){var s=this.entryStack[r];var a=s[e];if(a){if(t){if(s.label&&s.label.name===t.name){return a}}else if(s instanceof LabeledEntry){}else{return a}}}return null};l.getBreakLoc=function(e){return this._findLeapLocation("breakLoc",e)};l.getContinueLoc=function(e){return this._findLeapLocation("continueLoc",e)}},3085:(e,t,r)=>{"use strict";var s=r(6919);var a=s(r(9491));var n=r(6401);var o=r(1782);var i=(0,o.makeAccessor)();var l=Object.prototype.hasOwnProperty;function makePredicate(e,t){function onlyChildren(e){var t=(0,n.getTypes)();t.assertNode(e);var r=false;function check(e){if(r){}else if(Array.isArray(e)){e.some(check)}else if(t.isNode(e)){a["default"].strictEqual(r,false);r=predicate(e)}return r}var s=t.VISITOR_KEYS[e.type];if(s){for(var o=0;o{"use strict";var s=r(449);t.__esModule=true;t["default"]=replaceShorthandObjectMethod;var a=s(r(6401));function replaceShorthandObjectMethod(e){var t=a.getTypes();if(!e.node||!t.isFunction(e.node)){throw new Error("replaceShorthandObjectMethod can only be called on Function AST node paths.")}if(!t.isObjectMethod(e.node)){return e}if(!e.node.generator){return e}var r=e.node.params.map((function(e){return t.cloneDeep(e)}));var s=t.functionExpression(null,r,t.cloneDeep(e.node.body),e.node.generator,e.node.async);a.replaceWithOrRemove(e,t.objectProperty(t.cloneDeep(e.node.key),s,e.node.computed,false));return e.get("value")}},6401:(e,t)=>{"use strict";t.__esModule=true;t.wrapWithTypes=wrapWithTypes;t.getTypes=getTypes;t.runtimeProperty=runtimeProperty;t.isReference=isReference;t.replaceWithOrRemove=replaceWithOrRemove;var r=null;function wrapWithTypes(e,t){return function(){var s=r;r=e;try{for(var a=arguments.length,n=new Array(a),o=0;o{"use strict";var s=r(449);var a=r(6919);var n=a(r(9491));var o=r(5604);var i=r(6419);var l=a(r(3539));var c=s(r(6401));var u=r(1782);t.getVisitor=function(e){var t=e.types;return{Method:function Method(e,r){var s=e.node;if(!shouldRegenerate(s,r))return;var a=t.functionExpression(null,[],t.cloneNode(s.body,false),s.generator,s.async);e.get("body").set("body",[t.returnStatement(t.callExpression(a,[]))]);s.async=false;s.generator=false;e.get("body.body.0.argument.callee").unwrapFunctionEnvironment()},Function:{exit:c.wrapWithTypes(t,(function(e,r){var s=e.node;if(!shouldRegenerate(s,r))return;e=(0,l["default"])(e);s=e.node;var a=e.scope.generateUidIdentifier("context");var n=e.scope.generateUidIdentifier("args");e.ensureBlock();var u=e.get("body");if(s.async){u.traverse(m)}u.traverse(f,{context:a});var p=[];var y=[];u.get("body").forEach((function(e){var r=e.node;if(t.isExpressionStatement(r)&&t.isStringLiteral(r.expression)){p.push(r)}else if(r&&r._blockHoist!=null){p.push(r)}else{y.push(r)}}));if(p.length>0){u.node.body=y}var g=getOuterFnExpr(e);t.assertIdentifier(s.id);var h=t.identifier(s.id.name+"$");var b=(0,o.hoist)(e);var x={usesThis:false,usesArguments:false,getArgsId:function getArgsId(){return t.clone(n)}};e.traverse(d,x);if(x.usesArguments){b=b||t.variableDeclaration("var",[]);b.declarations.push(t.variableDeclarator(t.clone(n),t.identifier("arguments")))}var v=new i.Emitter(a);v.explode(e.get("body"));if(b&&b.declarations.length>0){p.push(b)}var E=[v.getContextFunction(h)];var j=v.getTryLocsList();if(s.generator){E.push(g)}else if(x.usesThis||j||s.async){E.push(t.nullLiteral())}if(x.usesThis){E.push(t.thisExpression())}else if(j||s.async){E.push(t.nullLiteral())}if(j){E.push(j)}else if(s.async){E.push(t.nullLiteral())}if(s.async){var w=e.scope;do{if(w.hasOwnBinding("Promise"))w.rename("Promise")}while(w=w.parent);E.push(t.identifier("Promise"))}var _=t.callExpression(c.runtimeProperty(s.async?"async":"wrap"),E);p.push(t.returnStatement(_));s.body=t.blockStatement(p);e.get("body.body").forEach((function(e){return e.scope.registerDeclaration(e)}));var S=u.node.directives;if(S){s.body.directives=S}var O=s.generator;if(O){s.generator=false}if(s.async){s.async=false}if(O&&t.isExpression(s)){c.replaceWithOrRemove(e,t.callExpression(c.runtimeProperty("mark"),[s]));e.addComment("leading","#__PURE__")}var k=v.getInsertedLocs();e.traverse({NumericLiteral:function NumericLiteral(e){if(!k.has(e.node)){return}e.replaceWith(t.numericLiteral(e.node.value))}});e.requeue()}))}}};function shouldRegenerate(e,t){if(e.generator){if(e.async){return t.opts.asyncGenerators!==false}else{return t.opts.generators!==false}}else if(e.async){return t.opts.async!==false}else{return false}}function getOuterFnExpr(e){var t=c.getTypes();var r=e.node;t.assertFunction(r);if(!r.id){r.id=e.scope.parent.generateUidIdentifier("callee")}if(r.generator&&t.isFunctionDeclaration(r)){return getMarkedFunctionId(e)}return t.clone(r.id)}var p=(0,u.makeAccessor)();function getMarkedFunctionId(e){var t=c.getTypes();var r=e.node;t.assertIdentifier(r.id);var s=e.findParent((function(e){return e.isProgram()||e.isBlockStatement()}));if(!s){return r.id}var a=s.node;n["default"].ok(Array.isArray(a.body));var o=p(a);if(!o.decl){o.decl=t.variableDeclaration("var",[]);s.unshiftContainer("body",o.decl);o.declPath=s.get("body.0")}n["default"].strictEqual(o.declPath.node,o.decl);var i=s.scope.generateUidIdentifier("marked");var l=t.callExpression(c.runtimeProperty("mark"),[t.clone(r.id)]);var u=o.decl.declarations.push(t.variableDeclarator(i,l))-1;var d=o.declPath.get("declarations."+u+".init");n["default"].strictEqual(d.node,l);d.addComment("leading","#__PURE__");return t.clone(i)}var d={"FunctionExpression|FunctionDeclaration|Method":function FunctionExpressionFunctionDeclarationMethod(e){e.skip()},Identifier:function Identifier(e,t){if(e.node.name==="arguments"&&c.isReference(e)){c.replaceWithOrRemove(e,t.getArgsId());t.usesArguments=true}},ThisExpression:function ThisExpression(e,t){t.usesThis=true}};var f={MetaProperty:function MetaProperty(e){var t=e.node;if(t.meta.name==="function"&&t.property.name==="sent"){var r=c.getTypes();c.replaceWithOrRemove(e,r.memberExpression(r.clone(this.context),r.identifier("_sent")))}}};var m={Function:function Function(e){e.skip()},AwaitExpression:function AwaitExpression(e){var t=c.getTypes();var r=e.node.argument;c.replaceWithOrRemove(e,t.yieldExpression(t.callExpression(c.runtimeProperty("awrap"),[r]),false))}}},9924:(e,t,r)=>{"use strict";const s=r(8741);t.REGULAR=new Map([["d",s().addRange(48,57)],["D",s().addRange(0,47).addRange(58,65535)],["s",s(32,160,5760,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233)],["S",s().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,65535)],["w",s(95).addRange(48,57).addRange(65,90).addRange(97,122)],["W",s(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,65535)]]);t.UNICODE=new Map([["d",s().addRange(48,57)],["D",s().addRange(0,47).addRange(58,1114111)],["s",s(32,160,5760,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233)],["S",s().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111)],["w",s(95).addRange(48,57).addRange(65,90).addRange(97,122)],["W",s(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)]]);t.UNICODE_IGNORE_CASE=new Map([["d",s().addRange(48,57)],["D",s().addRange(0,47).addRange(58,1114111)],["s",s(32,160,5760,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233)],["S",s().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111)],["w",s(95,383,8490).addRange(48,57).addRange(65,90).addRange(97,122)],["W",s(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,382).addRange(384,8489).addRange(8491,1114111)]])},3354:e=>{e.exports=new Map([[75,8490],[83,383],[107,8490],[115,383],[181,924],[197,8491],[223,7838],[229,8491],[383,83],[452,453],[453,452],[455,456],[456,455],[458,459],[459,458],[497,498],[498,497],[837,8126],[914,976],[917,1013],[920,1012],[921,8126],[922,1008],[924,181],[928,982],[929,1009],[931,962],[934,981],[937,8486],[952,1012],[962,931],[969,8486],[976,914],[977,1012],[981,934],[982,928],[1008,922],[1009,929],[1012,[920,977,952]],[1013,917],[1042,7296],[1044,7297],[1054,7298],[1057,7299],[1058,7301],[1066,7302],[1122,7303],[7296,1042],[7297,1044],[7298,1054],[7299,1057],[7300,7301],[7301,[1058,7300]],[7302,1066],[7303,1122],[7304,42570],[7776,7835],[7835,7776],[7838,223],[8064,8072],[8065,8073],[8066,8074],[8067,8075],[8068,8076],[8069,8077],[8070,8078],[8071,8079],[8072,8064],[8073,8065],[8074,8066],[8075,8067],[8076,8068],[8077,8069],[8078,8070],[8079,8071],[8080,8088],[8081,8089],[8082,8090],[8083,8091],[8084,8092],[8085,8093],[8086,8094],[8087,8095],[8088,8080],[8089,8081],[8090,8082],[8091,8083],[8092,8084],[8093,8085],[8094,8086],[8095,8087],[8096,8104],[8097,8105],[8098,8106],[8099,8107],[8100,8108],[8101,8109],[8102,8110],[8103,8111],[8104,8096],[8105,8097],[8106,8098],[8107,8099],[8108,8100],[8109,8101],[8110,8102],[8111,8103],[8115,8124],[8124,8115],[8126,[837,921]],[8131,8140],[8140,8131],[8179,8188],[8188,8179],[8486,[937,969]],[8490,75],[8491,[197,229]],[42570,7304],[66560,66600],[66561,66601],[66562,66602],[66563,66603],[66564,66604],[66565,66605],[66566,66606],[66567,66607],[66568,66608],[66569,66609],[66570,66610],[66571,66611],[66572,66612],[66573,66613],[66574,66614],[66575,66615],[66576,66616],[66577,66617],[66578,66618],[66579,66619],[66580,66620],[66581,66621],[66582,66622],[66583,66623],[66584,66624],[66585,66625],[66586,66626],[66587,66627],[66588,66628],[66589,66629],[66590,66630],[66591,66631],[66592,66632],[66593,66633],[66594,66634],[66595,66635],[66596,66636],[66597,66637],[66598,66638],[66599,66639],[66600,66560],[66601,66561],[66602,66562],[66603,66563],[66604,66564],[66605,66565],[66606,66566],[66607,66567],[66608,66568],[66609,66569],[66610,66570],[66611,66571],[66612,66572],[66613,66573],[66614,66574],[66615,66575],[66616,66576],[66617,66577],[66618,66578],[66619,66579],[66620,66580],[66621,66581],[66622,66582],[66623,66583],[66624,66584],[66625,66585],[66626,66586],[66627,66587],[66628,66588],[66629,66589],[66630,66590],[66631,66591],[66632,66592],[66633,66593],[66634,66594],[66635,66595],[66636,66596],[66637,66597],[66638,66598],[66639,66599],[66736,66776],[66737,66777],[66738,66778],[66739,66779],[66740,66780],[66741,66781],[66742,66782],[66743,66783],[66744,66784],[66745,66785],[66746,66786],[66747,66787],[66748,66788],[66749,66789],[66750,66790],[66751,66791],[66752,66792],[66753,66793],[66754,66794],[66755,66795],[66756,66796],[66757,66797],[66758,66798],[66759,66799],[66760,66800],[66761,66801],[66762,66802],[66763,66803],[66764,66804],[66765,66805],[66766,66806],[66767,66807],[66768,66808],[66769,66809],[66770,66810],[66771,66811],[66776,66736],[66777,66737],[66778,66738],[66779,66739],[66780,66740],[66781,66741],[66782,66742],[66783,66743],[66784,66744],[66785,66745],[66786,66746],[66787,66747],[66788,66748],[66789,66749],[66790,66750],[66791,66751],[66792,66752],[66793,66753],[66794,66754],[66795,66755],[66796,66756],[66797,66757],[66798,66758],[66799,66759],[66800,66760],[66801,66761],[66802,66762],[66803,66763],[66804,66764],[66805,66765],[66806,66766],[66807,66767],[66808,66768],[66809,66769],[66810,66770],[66811,66771],[68736,68800],[68737,68801],[68738,68802],[68739,68803],[68740,68804],[68741,68805],[68742,68806],[68743,68807],[68744,68808],[68745,68809],[68746,68810],[68747,68811],[68748,68812],[68749,68813],[68750,68814],[68751,68815],[68752,68816],[68753,68817],[68754,68818],[68755,68819],[68756,68820],[68757,68821],[68758,68822],[68759,68823],[68760,68824],[68761,68825],[68762,68826],[68763,68827],[68764,68828],[68765,68829],[68766,68830],[68767,68831],[68768,68832],[68769,68833],[68770,68834],[68771,68835],[68772,68836],[68773,68837],[68774,68838],[68775,68839],[68776,68840],[68777,68841],[68778,68842],[68779,68843],[68780,68844],[68781,68845],[68782,68846],[68783,68847],[68784,68848],[68785,68849],[68786,68850],[68800,68736],[68801,68737],[68802,68738],[68803,68739],[68804,68740],[68805,68741],[68806,68742],[68807,68743],[68808,68744],[68809,68745],[68810,68746],[68811,68747],[68812,68748],[68813,68749],[68814,68750],[68815,68751],[68816,68752],[68817,68753],[68818,68754],[68819,68755],[68820,68756],[68821,68757],[68822,68758],[68823,68759],[68824,68760],[68825,68761],[68826,68762],[68827,68763],[68828,68764],[68829,68765],[68830,68766],[68831,68767],[68832,68768],[68833,68769],[68834,68770],[68835,68771],[68836,68772],[68837,68773],[68838,68774],[68839,68775],[68840,68776],[68841,68777],[68842,68778],[68843,68779],[68844,68780],[68845,68781],[68846,68782],[68847,68783],[68848,68784],[68849,68785],[68850,68786],[71840,71872],[71841,71873],[71842,71874],[71843,71875],[71844,71876],[71845,71877],[71846,71878],[71847,71879],[71848,71880],[71849,71881],[71850,71882],[71851,71883],[71852,71884],[71853,71885],[71854,71886],[71855,71887],[71856,71888],[71857,71889],[71858,71890],[71859,71891],[71860,71892],[71861,71893],[71862,71894],[71863,71895],[71864,71896],[71865,71897],[71866,71898],[71867,71899],[71868,71900],[71869,71901],[71870,71902],[71871,71903],[71872,71840],[71873,71841],[71874,71842],[71875,71843],[71876,71844],[71877,71845],[71878,71846],[71879,71847],[71880,71848],[71881,71849],[71882,71850],[71883,71851],[71884,71852],[71885,71853],[71886,71854],[71887,71855],[71888,71856],[71889,71857],[71890,71858],[71891,71859],[71892,71860],[71893,71861],[71894,71862],[71895,71863],[71896,71864],[71897,71865],[71898,71866],[71899,71867],[71900,71868],[71901,71869],[71902,71870],[71903,71871],[93760,93792],[93761,93793],[93762,93794],[93763,93795],[93764,93796],[93765,93797],[93766,93798],[93767,93799],[93768,93800],[93769,93801],[93770,93802],[93771,93803],[93772,93804],[93773,93805],[93774,93806],[93775,93807],[93776,93808],[93777,93809],[93778,93810],[93779,93811],[93780,93812],[93781,93813],[93782,93814],[93783,93815],[93784,93816],[93785,93817],[93786,93818],[93787,93819],[93788,93820],[93789,93821],[93790,93822],[93791,93823],[93792,93760],[93793,93761],[93794,93762],[93795,93763],[93796,93764],[93797,93765],[93798,93766],[93799,93767],[93800,93768],[93801,93769],[93802,93770],[93803,93771],[93804,93772],[93805,93773],[93806,93774],[93807,93775],[93808,93776],[93809,93777],[93810,93778],[93811,93779],[93812,93780],[93813,93781],[93814,93782],[93815,93783],[93816,93784],[93817,93785],[93818,93786],[93819,93787],[93820,93788],[93821,93789],[93822,93790],[93823,93791],[125184,125218],[125185,125219],[125186,125220],[125187,125221],[125188,125222],[125189,125223],[125190,125224],[125191,125225],[125192,125226],[125193,125227],[125194,125228],[125195,125229],[125196,125230],[125197,125231],[125198,125232],[125199,125233],[125200,125234],[125201,125235],[125202,125236],[125203,125237],[125204,125238],[125205,125239],[125206,125240],[125207,125241],[125208,125242],[125209,125243],[125210,125244],[125211,125245],[125212,125246],[125213,125247],[125214,125248],[125215,125249],[125216,125250],[125217,125251],[125218,125184],[125219,125185],[125220,125186],[125221,125187],[125222,125188],[125223,125189],[125224,125190],[125225,125191],[125226,125192],[125227,125193],[125228,125194],[125229,125195],[125230,125196],[125231,125197],[125232,125198],[125233,125199],[125234,125200],[125235,125201],[125236,125202],[125237,125203],[125238,125204],[125239,125205],[125240,125206],[125241,125207],[125242,125208],[125243,125209],[125244,125210],[125245,125211],[125246,125212],[125247,125213],[125248,125214],[125249,125215],[125250,125216],[125251,125217]])},5756:(e,t,r)=>{"use strict";const s=r(1770).generate;const a=r(9990).parse;const n=r(8741);const o=r(3042);const i=r(1317);const l=r(3354);const c=r(9924);const u=n().addRange(0,1114111);const p=n().addRange(0,65535);const d=u.clone().remove(10,13,8232,8233);const getCharacterClassEscapeSet=(e,t,r)=>{if(t){if(r){return c.UNICODE_IGNORE_CASE.get(e)}return c.UNICODE.get(e)}return c.REGULAR.get(e)};const getUnicodeDotSet=e=>e?u:d;const getUnicodePropertyValueSet=(e,t)=>{const r=t?`${e}/${t}`:`Binary_Property/${e}`;try{return require(`regenerate-unicode-properties/${r}.js`)}catch(r){throw new Error(`Failed to recognize value \`${t}\` for property `+`\`${e}\`.`)}};const handleLoneUnicodePropertyNameOrValue=e=>{try{const t="General_Category";const r=i(t,e);return getUnicodePropertyValueSet(t,r)}catch(e){}const t=o(e);return getUnicodePropertyValueSet(t)};const getUnicodePropertyEscapeSet=(e,t)=>{const r=e.split("=");const s=r[0];let a;if(r.length==1){a=handleLoneUnicodePropertyNameOrValue(s)}else{const e=o(s);const t=i(e,r[1]);a=getUnicodePropertyValueSet(e,t)}if(t){return u.clone().remove(a)}return a.clone()};n.prototype.iuAddRange=function(e,t){const r=this;do{const t=caseFold(e);if(t){r.add(t)}}while(++e<=t);return r};const update=(e,t)=>{let r=a(t,f.useUnicodeFlag?"u":"");switch(r.type){case"characterClass":case"group":case"value":break;default:r=wrap(r,t)}Object.assign(e,r)};const wrap=(e,t)=>({type:"group",behavior:"ignore",body:[e],raw:`(?:${t})`});const caseFold=e=>l.get(e)||false;const processCharacterClass=(e,t)=>{const r=n();for(const t of e.body){switch(t.type){case"value":r.add(t.codePoint);if(f.ignoreCase&&f.unicode&&!f.useUnicodeFlag){const e=caseFold(t.codePoint);if(e){r.add(e)}}break;case"characterClassRange":const e=t.min.codePoint;const s=t.max.codePoint;r.addRange(e,s);if(f.ignoreCase&&f.unicode&&!f.useUnicodeFlag){r.iuAddRange(e,s)}break;case"characterClassEscape":r.add(getCharacterClassEscapeSet(t.value,f.unicode,f.ignoreCase));break;case"unicodePropertyEscape":r.add(getUnicodePropertyEscapeSet(t.value,t.negative));break;default:throw new Error(`Unknown term type: ${t.type}`)}}if(e.negative){update(e,`(?!${r.toString(t)})[\\s\\S]`)}else{update(e,r.toString(t))}return e};const updateNamedReference=(e,t)=>{delete e.name;e.matchIndex=t};const assertNoUnmatchedReferences=e=>{const t=Object.keys(e.unmatchedReferences);if(t.length>0){throw new Error(`Unknown group names: ${t}`)}};const processTerm=(e,t,r)=>{switch(e.type){case"dot":if(f.useDotAllFlag){break}else if(f.unicode){update(e,getUnicodeDotSet(f.dotAll).toString(t))}else if(f.dotAll){update(e,"[\\s\\S]")}break;case"characterClass":e=processCharacterClass(e,t);break;case"unicodePropertyEscape":if(f.unicodePropertyEscape){update(e,getUnicodePropertyEscapeSet(e.value,e.negative).toString(t))}break;case"characterClassEscape":update(e,getCharacterClassEscapeSet(e.value,f.unicode,f.ignoreCase).toString(t));break;case"group":if(e.behavior=="normal"){r.lastIndex++}if(e.name&&f.namedGroup){const t=e.name.value;if(r.names[t]){throw new Error(`Multiple groups with the same name (${t}) are not allowed.`)}const s=r.lastIndex;delete e.name;r.names[t]=s;if(r.onNamedGroup){r.onNamedGroup.call(null,t,s)}if(r.unmatchedReferences[t]){r.unmatchedReferences[t].forEach((e=>{updateNamedReference(e,s)}));delete r.unmatchedReferences[t]}}case"alternative":case"disjunction":case"quantifier":e.body=e.body.map((e=>processTerm(e,t,r)));break;case"value":const s=e.codePoint;const a=n(s);if(f.ignoreCase&&f.unicode&&!f.useUnicodeFlag){const e=caseFold(s);if(e){a.add(e)}}update(e,a.toString(t));break;case"reference":if(e.name){const t=e.name.value;const s=r.names[t];if(s){updateNamedReference(e,s);break}if(!r.unmatchedReferences[t]){r.unmatchedReferences[t]=[]}r.unmatchedReferences[t].push(e)}break;case"anchor":case"empty":case"group":break;default:throw new Error(`Unknown term type: ${e.type}`)}return e};const f={ignoreCase:false,unicode:false,dotAll:false,useDotAllFlag:false,useUnicodeFlag:false,unicodePropertyEscape:false,namedGroup:false};const rewritePattern=(e,t,r)=>{f.unicode=t&&t.includes("u");const n={unicodePropertyEscape:f.unicode,namedGroups:true,lookbehind:r&&r.lookbehind};f.ignoreCase=t&&t.includes("i");const o=r&&r.dotAllFlag;f.dotAll=o&&t&&t.includes("s");f.namedGroup=r&&r.namedGroup;f.useDotAllFlag=r&&r.useDotAllFlag;f.useUnicodeFlag=r&&r.useUnicodeFlag;f.unicodePropertyEscape=r&&r.unicodePropertyEscape;if(o&&f.useDotAllFlag){throw new Error("`useDotAllFlag` and `dotAllFlag` cannot both be true!")}const i={hasUnicodeFlag:f.useUnicodeFlag,bmpOnly:!f.unicode};const l={onNamedGroup:r&&r.onNamedGroup,lastIndex:0,names:Object.create(null),unmatchedReferences:Object.create(null)};const c=a(e,t,n);processTerm(c,i,l);assertNoUnmatchedReferences(l);return s(c)};e.exports=rewritePattern},1770:function(e,t,r){e=r.nmd(e); /*! * regjsgen 0.5.1 * Copyright 2014-2019 Benjamin Tan * Available under MIT license - */(function(){"use strict";var r={function:true,object:true};var s=r[typeof window]&&window||this;var a=r[typeof t]&&t&&!t.nodeType&&t;var n=r["object"]&&e&&!e.nodeType;var o=a&&n&&typeof global=="object"&&global;if(o&&(o.global===o||o.window===o||o.self===o)){s=o}var i=Object.prototype.hasOwnProperty;function fromCodePoint(){var e=Number(arguments[0]);if(!isFinite(e)||e<0||e>1114111||Math.floor(e)!=e){throw RangeError("Invalid code point: "+e)}if(e<=65535){return String.fromCharCode(e)}else{e-=65536;var t=(e>>10)+55296;var r=e%1024+56320;return String.fromCharCode(t,r)}}var l={};function assertType(e,t){if(t.indexOf("|")==-1){if(e==t){return}throw Error("Invalid node type: "+e+"; expected type: "+t)}t=i.call(l,t)?l[t]:l[t]=RegExp("^(?:"+t+")$");if(t.test(e)){return}throw Error("Invalid node type: "+e+"; expected types: "+t)}function generate(e){var t=e.type;if(i.call(c,t)){return c[t](e)}throw Error("Invalid node type: "+t)}function generateAlternative(e){assertType(e.type,"alternative");var t=e.body,r=-1,s=t.length,a="";while(++r"}break;case"ignore":t+="?:";break;case"lookahead":t+="?=";break;case"negativeLookahead":t+="?!";break;case"lookbehind":t+="?<=";break;case"negativeLookbehind":t+="?"}throw new Error("Unknown reference type")}function generateTerm(e){assertType(e.type,"anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|unicodePropertyEscape|value|dot");return generate(e)}function generateValue(e){assertType(e.type,"value");var t=e.kind,r=e.codePoint;if(typeof r!="number"){throw new Error("Invalid code point: "+r)}switch(t){case"controlLetter":return"\\c"+fromCodePoint(r+64);case"hexadecimalEscape":return"\\x"+("00"+r.toString(16).toUpperCase()).slice(-2);case"identifier":return"\\"+fromCodePoint(r);case"null":return"\\"+r;case"octal":return"\\"+r.toString(8);case"singleEscape":switch(r){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r";default:throw Error("Invalid code point: "+r)}case"symbol":return fromCodePoint(r);case"unicodeEscape":return"\\u"+("0000"+r.toString(16).toUpperCase()).slice(-4);case"unicodeCodePointEscape":return"\\u{"+r.toString(16).toUpperCase()+"}";default:throw Error("Unsupported node kind: "+t)}}var c={alternative:generateAlternative,anchor:generateAnchor,characterClass:generateCharacterClass,characterClassEscape:generateCharacterClassEscape,characterClassRange:generateCharacterClassRange,unicodePropertyEscape:generateUnicodePropertyEscape,disjunction:generateDisjunction,dot:generateDot,group:generateGroup,quantifier:generateQuantifier,reference:generateReference,value:generateValue};var u={generate:generate};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define((function(){return u}));s.regjsgen=u}else if(a&&n){a.generate=generate}else{s.regjsgen=u}}).call(this)},9990:e=>{(function(){var t=String.fromCodePoint||function(){var e=String.fromCharCode;var t=Math.floor;return function fromCodePoint(){var r=16384;var s=[];var a;var n;var o=-1;var i=arguments.length;if(!i){return""}var l="";while(++o1114111||t(c)!=c){throw RangeError("Invalid code point: "+c)}if(c<=65535){s.push(c)}else{c-=65536;a=(c>>10)+55296;n=c%1024+56320;s.push(a,n)}if(o+1==i||s.length>r){l+=e.apply(null,s);s.length=0}}return l}}();function parse(e,r,s){if(!s){s={}}function addRaw(t){t.raw=e.substring(t.range[0],t.range[1]);return t}function updateRawStart(e,t){e.range[0]=t;return addRaw(e)}function createAnchor(e,t){return addRaw({type:"anchor",kind:e,range:[l-t,l]})}function createValue(e,t,r,s){return addRaw({type:"value",kind:e,codePoint:t,range:[r,s]})}function createEscaped(e,t,r,s){s=s||0;return createValue(e,t,l-(r.length+s),l)}function createCharacter(e){var t=e[0];var r=t.charCodeAt(0);if(i){var s;if(t.length===1&&r>=55296&&r<=56319){s=lookahead().charCodeAt(0);if(s>=56320&&s<=57343){l++;return createValue("symbol",(r-55296)*1024+s-56320+65536,l-2,l)}}}return createValue("symbol",r,l-1,l)}function createDisjunction(e,t,r){return addRaw({type:"disjunction",body:e,range:[t,r]})}function createDot(){return addRaw({type:"dot",range:[l-1,l]})}function createCharacterClassEscape(e){return addRaw({type:"characterClassEscape",value:e,range:[l-2,l]})}function createReference(e){return addRaw({type:"reference",matchIndex:parseInt(e,10),range:[l-1-e.length,l]})}function createNamedReference(e){return addRaw({type:"reference",name:e,range:[e.range[0]-3,l]})}function createGroup(e,t,r,s){return addRaw({type:"group",behavior:e,body:t,range:[r,s]})}function createQuantifier(e,t,r,s){if(s==null){r=l-1;s=l}return addRaw({type:"quantifier",min:e,max:t,greedy:true,body:null,range:[r,s]})}function createAlternative(e,t,r){return addRaw({type:"alternative",body:e,range:[t,r]})}function createCharacterClass(e,t,r,s){return addRaw({type:"characterClass",body:e,negative:t,range:[r,s]})}function createClassRange(e,t,r,s){if(e.codePoint>t.codePoint){bail("invalid range in character class",e.raw+"-"+t.raw,r,s)}return addRaw({type:"characterClassRange",min:e,max:t,range:[r,s]})}function flattenBody(e){if(e.type==="alternative"){return e.body}else{return[e]}}function isEmpty(e){return e.type==="empty"}function incr(t){t=t||1;var r=e.substring(l,l+t);l+=t||1;return r}function skip(e){if(!match(e)){bail("character",e)}}function match(t){if(e.indexOf(t,l)===l){return incr(t.length)}}function lookahead(){return e[l]}function current(t){return e.indexOf(t,l)===l}function next(t){return e[l+1]===t}function matchReg(t){var r=e.substring(l);var s=r.match(t);if(s){s.range=[];s.range[0]=l;incr(s[0].length);s.range[1]=l}return s}function parseDisjunction(){var e=[],t=l;e.push(parseAlternative());while(match("|")){e.push(parseAlternative())}if(e.length===1){return e[0]}return createDisjunction(e,t,l)}function parseAlternative(){var e=[],t=l;var r;while(r=parseTerm()){e.push(r)}if(e.length===1){return e[0]}return createAlternative(e,t,l)}function parseTerm(){if(l>=e.length||current("|")||current(")")){return null}var t=parseAnchor();if(t){return t}var r=parseAtomAndExtendedAtom();if(!r){bail("Expected atom")}var s=parseQuantifier()||false;if(s){s.body=flattenBody(r);updateRawStart(s,r.range[0]);return s}return r}function parseGroup(e,t,r,s){var a=null,n=l;if(match(e)){a=t}else if(match(r)){a=s}else{return false}return finishGroup(a,n)}function finishGroup(e,t){var r=parseDisjunction();if(!r){bail("Expected disjunction")}skip(")");var s=createGroup(e,flattenBody(r),t,l);if(e=="normal"){if(o){n++}}return s}function parseAnchor(){var e,t=l;if(match("^")){return createAnchor("start",1)}else if(match("$")){return createAnchor("end",1)}else if(match("\\b")){return createAnchor("boundary",2)}else if(match("\\B")){return createAnchor("not-boundary",2)}else{return parseGroup("(?=","lookahead","(?!","negativeLookahead")}}function parseQuantifier(){var e,t=l;var r;var s,a;if(match("*")){r=createQuantifier(0)}else if(match("+")){r=createQuantifier(1)}else if(match("?")){r=createQuantifier(0,1)}else if(e=matchReg(/^\{([0-9]+)\}/)){s=parseInt(e[1],10);r=createQuantifier(s,s,e.range[0],e.range[1])}else if(e=matchReg(/^\{([0-9]+),\}/)){s=parseInt(e[1],10);r=createQuantifier(s,undefined,e.range[0],e.range[1])}else if(e=matchReg(/^\{([0-9]+),([0-9]+)\}/)){s=parseInt(e[1],10);a=parseInt(e[2],10);if(s>a){bail("numbers out of order in {} quantifier","",t,l)}r=createQuantifier(s,a,e.range[0],e.range[1])}if(r){if(match("?")){r.greedy=false;r.range[1]+=1}}return r}function parseAtomAndExtendedAtom(){var e;if(e=matchReg(/^[^^$\\.*+?()[\]{}|]/)){return createCharacter(e)}else if(!i&&(e=matchReg(/^(?:]|})/))){return createCharacter(e)}else if(match(".")){return createDot()}else if(match("\\")){e=parseAtomEscape();if(!e){if(!i&&lookahead()=="c"){return createValue("symbol",92,l-1,l)}bail("atomEscape")}return e}else if(e=parseCharacterClass()){return e}else if(s.lookbehind&&(e=parseGroup("(?<=","lookbehind","(?");var r=finishGroup("normal",t.range[0]-3);r.name=t;return r}else{return parseGroup("(?:","ignore","(","normal")}}function parseUnicodeSurrogatePairEscape(e){if(i){var t,r;if(e.kind=="unicodeEscape"&&(t=e.codePoint)>=55296&&t<=56319&¤t("\\")&&next("u")){var s=l;l++;var a=parseClassEscape();if(a.kind=="unicodeEscape"&&(r=a.codePoint)>=56320&&r<=57343){e.range[1]=a.range[1];e.codePoint=(t-55296)*1024+r-56320+65536;e.type="value";e.kind="unicodeCodePointEscape";addRaw(e)}else{l=s}}}return e}function parseClassEscape(){return parseAtomEscape(true)}function parseAtomEscape(e){var t,r=l;t=parseDecimalEscape()||parseNamedReference();if(t){return t}if(e){if(match("b")){return createEscaped("singleEscape",8,"\\b")}else if(match("B")){bail("\\B not possible inside of CharacterClass","",r)}else if(!i&&(t=matchReg(/^c([0-9])/))){return createEscaped("controlLetter",t[1]+16,t[1],2)}if(match("-")&&i){return createEscaped("singleEscape",45,"\\-")}}t=parseCharacterEscape();return t}function parseDecimalEscape(){var e,t;if(e=matchReg(/^(?!0)\d+/)){t=e[0];var r=parseInt(e[0],10);if(r<=n){return createReference(e[0])}else{a.push(r);incr(-e[0].length);if(e=matchReg(/^[0-7]{1,3}/)){return createEscaped("octal",parseInt(e[0],8),e[0],1)}else{e=createCharacter(matchReg(/^[89]/));return updateRawStart(e,e.range[0]-1)}}}else if(e=matchReg(/^[0-7]{1,3}/)){t=e[0];if(/^0{1,3}$/.test(t)){return createEscaped("null",0,"0",t.length+1)}else{return createEscaped("octal",parseInt(t,8),t,1)}}else if(e=matchReg(/^[dDsSwW]/)){return createCharacterClassEscape(e[0])}return false}function parseNamedReference(){if(s.namedGroups&&matchReg(/^k<(?=.*?>)/)){var e=parseIdentifier();skip(">");return createNamedReference(e)}}function parseRegExpUnicodeEscapeSequence(){var e;if(e=matchReg(/^u([0-9a-fA-F]{4})/)){return parseUnicodeSurrogatePairEscape(createEscaped("unicodeEscape",parseInt(e[1],16),e[1],2))}else if(i&&(e=matchReg(/^u\{([0-9a-fA-F]+)\}/))){return createEscaped("unicodeCodePointEscape",parseInt(e[1],16),e[1],4)}}function parseCharacterEscape(){var e;var t=l;if(e=matchReg(/^[fnrtv]/)){var r=0;switch(e[0]){case"t":r=9;break;case"n":r=10;break;case"v":r=11;break;case"f":r=12;break;case"r":r=13;break}return createEscaped("singleEscape",r,"\\"+e[0])}else if(e=matchReg(/^c([a-zA-Z])/)){return createEscaped("controlLetter",e[1].charCodeAt(0)%32,e[1],2)}else if(e=matchReg(/^x([0-9a-fA-F]{2})/)){return createEscaped("hexadecimalEscape",parseInt(e[1],16),e[1],2)}else if(e=parseRegExpUnicodeEscapeSequence()){if(!e||e.codePoint>1114111){bail("Invalid escape sequence",null,t,l)}return e}else if(s.unicodePropertyEscape&&i&&(e=matchReg(/^([pP])\{([^\}]+)\}/))){return addRaw({type:"unicodePropertyEscape",negative:e[1]==="P",value:e[2],range:[e.range[0]-1,e.range[1]],raw:e[0]})}else{return parseIdentityEscape()}}function parseIdentifierAtom(r){var s=lookahead();var a=l;if(s==="\\"){incr();var n=parseRegExpUnicodeEscapeSequence();if(!n||!r(n.codePoint)){bail("Invalid escape sequence",null,a,l)}return t(n.codePoint)}var o=s.charCodeAt(0);if(o>=55296&&o<=56319){s+=e[l+1];var i=s.charCodeAt(1);if(i>=56320&&i<=57343){o=(o-55296)*1024+i-56320+65536}}if(!r(o))return;incr();if(o>65535)incr();return s}function parseIdentifier(){var e=l;var t=parseIdentifierAtom(isIdentifierStart);if(!t){bail("Invalid identifier")}var r;while(r=parseIdentifierAtom(isIdentifierPart)){t+=r}return addRaw({type:"identifier",value:t,range:[e,l]})}function isIdentifierStart(e){var r=/[\$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFF1]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=128&&r.test(t(e))}function isIdentifierPart(e){var r=/[0-9_\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDD30-\uDD39\uDF46-\uDF50]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC66-\uDC6F\uDC7F-\uDC82\uDCB0-\uDCBA\uDCF0-\uDCF9\uDD00-\uDD02\uDD27-\uDD34\uDD36-\uDD3F\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDD0-\uDDD9\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC50-\uDC59\uDC5E\uDCB0-\uDCC3\uDCD0-\uDCD9\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDE50-\uDE59\uDEAB-\uDEB7\uDEC0-\uDEC9\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC2C-\uDC3A\uDCE0-\uDCE9\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC50-\uDC59\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD50-\uDD59\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDDA0-\uDDA9\uDEF3-\uDEF6]|\uD81A[\uDE60-\uDE69\uDEF0-\uDEF4\uDF30-\uDF36\uDF50-\uDF59]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A\uDD50-\uDD59]|\uDB40[\uDD00-\uDDEF]/;return isIdentifierStart(e)||e>=48&&e<=57||e>=128&&r.test(t(e))}function parseIdentityEscape(){var e;var t=lookahead();if(i&&/[\^\$\.\*\+\?\(\)\\\[\]\{\}\|\/]/.test(t)||!i&&t!=="c"){if(t==="k"&&s.lookbehind){return null}e=incr();return createEscaped("identifier",e.charCodeAt(0),e,1)}return null}function parseCharacterClass(){var e,t=l;if(e=matchReg(/^\[\^/)){e=parseClassRanges();skip("]");return createCharacterClass(e,true,t,l)}else if(match("[")){e=parseClassRanges();skip("]");return createCharacterClass(e,false,t,l)}return null}function parseClassRanges(){var e;if(current("]")){return[]}else{e=parseNonemptyClassRanges();if(!e){bail("nonEmptyClassRanges")}return e}}function parseHelperClassRanges(e){var t,r,s;if(current("-")&&!next("]")){skip("-");s=parseClassAtom();if(!s){bail("classAtom")}r=l;var a=parseClassRanges();if(!a){bail("classRanges")}t=e.range[0];if(a.type==="empty"){return[createClassRange(e,s,t,r)]}return[createClassRange(e,s,t,r)].concat(a)}s=parseNonemptyClassRangesNoDash();if(!s){bail("nonEmptyClassRangesNoDash")}return[e].concat(s)}function parseNonemptyClassRanges(){var e=parseClassAtom();if(!e){bail("classAtom")}if(current("]")){return[e]}return parseHelperClassRanges(e)}function parseNonemptyClassRangesNoDash(){var e=parseClassAtom();if(!e){bail("classAtom")}if(current("]")){return e}return parseHelperClassRanges(e)}function parseClassAtom(){if(match("-")){return createCharacter("-")}else{return parseClassAtomNoDash()}}function parseClassAtomNoDash(){var e;if(e=matchReg(/^[^\\\]-]/)){return createCharacter(e[0])}else if(match("\\")){e=parseClassEscape();if(!e){bail("classEscape")}return parseUnicodeSurrogatePairEscape(e)}}function bail(t,r,s,a){s=s==null?l:s;a=a==null?s:a;var n=Math.max(0,s-10);var o=Math.min(a+10,e.length);var i=" "+e.substring(n,o);var c=" "+new Array(s-n+1).join(" ")+"^";throw SyntaxError(t+" at position "+s+(r?": "+r:"")+"\n"+i+"\n"+c)}var a=[];var n=0;var o=true;var i=(r||"").indexOf("u")!==-1;var l=0;e=String(e);if(e===""){e="(?:)"}var c=parseDisjunction();if(c.range[1]!==e.length){bail("Could not parse entire input - got stuck","",c.range[1])}for(var u=0;u{var t=e.exports=function(e){return new Traverse(e)};function Traverse(e){this.value=e}Traverse.prototype.get=function(e){var t=this.value;for(var r=0;r{e.exports=new Set(["General_Category","Script","Script_Extensions","Alphabetic","Any","ASCII","ASCII_Hex_Digit","Assigned","Bidi_Control","Bidi_Mirrored","Case_Ignorable","Cased","Changes_When_Casefolded","Changes_When_Casemapped","Changes_When_Lowercased","Changes_When_NFKC_Casefolded","Changes_When_Titlecased","Changes_When_Uppercased","Dash","Default_Ignorable_Code_Point","Deprecated","Diacritic","Emoji","Emoji_Component","Emoji_Modifier","Emoji_Modifier_Base","Emoji_Presentation","Extended_Pictographic","Extender","Grapheme_Base","Grapheme_Extend","Hex_Digit","ID_Continue","ID_Start","Ideographic","IDS_Binary_Operator","IDS_Trinary_Operator","Join_Control","Logical_Order_Exception","Lowercase","Math","Noncharacter_Code_Point","Pattern_Syntax","Pattern_White_Space","Quotation_Mark","Radical","Regional_Indicator","Sentence_Terminal","Soft_Dotted","Terminal_Punctuation","Unified_Ideograph","Uppercase","Variation_Selector","White_Space","XID_Continue","XID_Start"])},3042:(e,t,r)=>{"use strict";const s=r(7894);const a=r(864);const matchProperty=function(e){if(s.has(e)){return e}if(a.has(e)){return a.get(e)}throw new Error(`Unknown property: ${e}`)};e.exports=matchProperty},4703:e=>{e.exports=new Map([["General_Category",new Map([["C","Other"],["Cc","Control"],["cntrl","Control"],["Cf","Format"],["Cn","Unassigned"],["Co","Private_Use"],["Cs","Surrogate"],["L","Letter"],["LC","Cased_Letter"],["Ll","Lowercase_Letter"],["Lm","Modifier_Letter"],["Lo","Other_Letter"],["Lt","Titlecase_Letter"],["Lu","Uppercase_Letter"],["M","Mark"],["Combining_Mark","Mark"],["Mc","Spacing_Mark"],["Me","Enclosing_Mark"],["Mn","Nonspacing_Mark"],["N","Number"],["Nd","Decimal_Number"],["digit","Decimal_Number"],["Nl","Letter_Number"],["No","Other_Number"],["P","Punctuation"],["punct","Punctuation"],["Pc","Connector_Punctuation"],["Pd","Dash_Punctuation"],["Pe","Close_Punctuation"],["Pf","Final_Punctuation"],["Pi","Initial_Punctuation"],["Po","Other_Punctuation"],["Ps","Open_Punctuation"],["S","Symbol"],["Sc","Currency_Symbol"],["Sk","Modifier_Symbol"],["Sm","Math_Symbol"],["So","Other_Symbol"],["Z","Separator"],["Zl","Line_Separator"],["Zp","Paragraph_Separator"],["Zs","Space_Separator"],["Other","Other"],["Control","Control"],["Format","Format"],["Unassigned","Unassigned"],["Private_Use","Private_Use"],["Surrogate","Surrogate"],["Letter","Letter"],["Cased_Letter","Cased_Letter"],["Lowercase_Letter","Lowercase_Letter"],["Modifier_Letter","Modifier_Letter"],["Other_Letter","Other_Letter"],["Titlecase_Letter","Titlecase_Letter"],["Uppercase_Letter","Uppercase_Letter"],["Mark","Mark"],["Spacing_Mark","Spacing_Mark"],["Enclosing_Mark","Enclosing_Mark"],["Nonspacing_Mark","Nonspacing_Mark"],["Number","Number"],["Decimal_Number","Decimal_Number"],["Letter_Number","Letter_Number"],["Other_Number","Other_Number"],["Punctuation","Punctuation"],["Connector_Punctuation","Connector_Punctuation"],["Dash_Punctuation","Dash_Punctuation"],["Close_Punctuation","Close_Punctuation"],["Final_Punctuation","Final_Punctuation"],["Initial_Punctuation","Initial_Punctuation"],["Other_Punctuation","Other_Punctuation"],["Open_Punctuation","Open_Punctuation"],["Symbol","Symbol"],["Currency_Symbol","Currency_Symbol"],["Modifier_Symbol","Modifier_Symbol"],["Math_Symbol","Math_Symbol"],["Other_Symbol","Other_Symbol"],["Separator","Separator"],["Line_Separator","Line_Separator"],["Paragraph_Separator","Paragraph_Separator"],["Space_Separator","Space_Separator"]])],["Script",new Map([["Adlm","Adlam"],["Aghb","Caucasian_Albanian"],["Ahom","Ahom"],["Arab","Arabic"],["Armi","Imperial_Aramaic"],["Armn","Armenian"],["Avst","Avestan"],["Bali","Balinese"],["Bamu","Bamum"],["Bass","Bassa_Vah"],["Batk","Batak"],["Beng","Bengali"],["Bhks","Bhaiksuki"],["Bopo","Bopomofo"],["Brah","Brahmi"],["Brai","Braille"],["Bugi","Buginese"],["Buhd","Buhid"],["Cakm","Chakma"],["Cans","Canadian_Aboriginal"],["Cari","Carian"],["Cham","Cham"],["Cher","Cherokee"],["Chrs","Chorasmian"],["Copt","Coptic"],["Qaac","Coptic"],["Cprt","Cypriot"],["Cyrl","Cyrillic"],["Deva","Devanagari"],["Diak","Dives_Akuru"],["Dogr","Dogra"],["Dsrt","Deseret"],["Dupl","Duployan"],["Egyp","Egyptian_Hieroglyphs"],["Elba","Elbasan"],["Elym","Elymaic"],["Ethi","Ethiopic"],["Geor","Georgian"],["Glag","Glagolitic"],["Gong","Gunjala_Gondi"],["Gonm","Masaram_Gondi"],["Goth","Gothic"],["Gran","Grantha"],["Grek","Greek"],["Gujr","Gujarati"],["Guru","Gurmukhi"],["Hang","Hangul"],["Hani","Han"],["Hano","Hanunoo"],["Hatr","Hatran"],["Hebr","Hebrew"],["Hira","Hiragana"],["Hluw","Anatolian_Hieroglyphs"],["Hmng","Pahawh_Hmong"],["Hmnp","Nyiakeng_Puachue_Hmong"],["Hrkt","Katakana_Or_Hiragana"],["Hung","Old_Hungarian"],["Ital","Old_Italic"],["Java","Javanese"],["Kali","Kayah_Li"],["Kana","Katakana"],["Khar","Kharoshthi"],["Khmr","Khmer"],["Khoj","Khojki"],["Kits","Khitan_Small_Script"],["Knda","Kannada"],["Kthi","Kaithi"],["Lana","Tai_Tham"],["Laoo","Lao"],["Latn","Latin"],["Lepc","Lepcha"],["Limb","Limbu"],["Lina","Linear_A"],["Linb","Linear_B"],["Lisu","Lisu"],["Lyci","Lycian"],["Lydi","Lydian"],["Mahj","Mahajani"],["Maka","Makasar"],["Mand","Mandaic"],["Mani","Manichaean"],["Marc","Marchen"],["Medf","Medefaidrin"],["Mend","Mende_Kikakui"],["Merc","Meroitic_Cursive"],["Mero","Meroitic_Hieroglyphs"],["Mlym","Malayalam"],["Modi","Modi"],["Mong","Mongolian"],["Mroo","Mro"],["Mtei","Meetei_Mayek"],["Mult","Multani"],["Mymr","Myanmar"],["Nand","Nandinagari"],["Narb","Old_North_Arabian"],["Nbat","Nabataean"],["Newa","Newa"],["Nkoo","Nko"],["Nshu","Nushu"],["Ogam","Ogham"],["Olck","Ol_Chiki"],["Orkh","Old_Turkic"],["Orya","Oriya"],["Osge","Osage"],["Osma","Osmanya"],["Palm","Palmyrene"],["Pauc","Pau_Cin_Hau"],["Perm","Old_Permic"],["Phag","Phags_Pa"],["Phli","Inscriptional_Pahlavi"],["Phlp","Psalter_Pahlavi"],["Phnx","Phoenician"],["Plrd","Miao"],["Prti","Inscriptional_Parthian"],["Rjng","Rejang"],["Rohg","Hanifi_Rohingya"],["Runr","Runic"],["Samr","Samaritan"],["Sarb","Old_South_Arabian"],["Saur","Saurashtra"],["Sgnw","SignWriting"],["Shaw","Shavian"],["Shrd","Sharada"],["Sidd","Siddham"],["Sind","Khudawadi"],["Sinh","Sinhala"],["Sogd","Sogdian"],["Sogo","Old_Sogdian"],["Sora","Sora_Sompeng"],["Soyo","Soyombo"],["Sund","Sundanese"],["Sylo","Syloti_Nagri"],["Syrc","Syriac"],["Tagb","Tagbanwa"],["Takr","Takri"],["Tale","Tai_Le"],["Talu","New_Tai_Lue"],["Taml","Tamil"],["Tang","Tangut"],["Tavt","Tai_Viet"],["Telu","Telugu"],["Tfng","Tifinagh"],["Tglg","Tagalog"],["Thaa","Thaana"],["Thai","Thai"],["Tibt","Tibetan"],["Tirh","Tirhuta"],["Ugar","Ugaritic"],["Vaii","Vai"],["Wara","Warang_Citi"],["Wcho","Wancho"],["Xpeo","Old_Persian"],["Xsux","Cuneiform"],["Yezi","Yezidi"],["Yiii","Yi"],["Zanb","Zanabazar_Square"],["Zinh","Inherited"],["Qaai","Inherited"],["Zyyy","Common"],["Zzzz","Unknown"],["Adlam","Adlam"],["Caucasian_Albanian","Caucasian_Albanian"],["Arabic","Arabic"],["Imperial_Aramaic","Imperial_Aramaic"],["Armenian","Armenian"],["Avestan","Avestan"],["Balinese","Balinese"],["Bamum","Bamum"],["Bassa_Vah","Bassa_Vah"],["Batak","Batak"],["Bengali","Bengali"],["Bhaiksuki","Bhaiksuki"],["Bopomofo","Bopomofo"],["Brahmi","Brahmi"],["Braille","Braille"],["Buginese","Buginese"],["Buhid","Buhid"],["Chakma","Chakma"],["Canadian_Aboriginal","Canadian_Aboriginal"],["Carian","Carian"],["Cherokee","Cherokee"],["Chorasmian","Chorasmian"],["Coptic","Coptic"],["Cypriot","Cypriot"],["Cyrillic","Cyrillic"],["Devanagari","Devanagari"],["Dives_Akuru","Dives_Akuru"],["Dogra","Dogra"],["Deseret","Deseret"],["Duployan","Duployan"],["Egyptian_Hieroglyphs","Egyptian_Hieroglyphs"],["Elbasan","Elbasan"],["Elymaic","Elymaic"],["Ethiopic","Ethiopic"],["Georgian","Georgian"],["Glagolitic","Glagolitic"],["Gunjala_Gondi","Gunjala_Gondi"],["Masaram_Gondi","Masaram_Gondi"],["Gothic","Gothic"],["Grantha","Grantha"],["Greek","Greek"],["Gujarati","Gujarati"],["Gurmukhi","Gurmukhi"],["Hangul","Hangul"],["Han","Han"],["Hanunoo","Hanunoo"],["Hatran","Hatran"],["Hebrew","Hebrew"],["Hiragana","Hiragana"],["Anatolian_Hieroglyphs","Anatolian_Hieroglyphs"],["Pahawh_Hmong","Pahawh_Hmong"],["Nyiakeng_Puachue_Hmong","Nyiakeng_Puachue_Hmong"],["Katakana_Or_Hiragana","Katakana_Or_Hiragana"],["Old_Hungarian","Old_Hungarian"],["Old_Italic","Old_Italic"],["Javanese","Javanese"],["Kayah_Li","Kayah_Li"],["Katakana","Katakana"],["Kharoshthi","Kharoshthi"],["Khmer","Khmer"],["Khojki","Khojki"],["Khitan_Small_Script","Khitan_Small_Script"],["Kannada","Kannada"],["Kaithi","Kaithi"],["Tai_Tham","Tai_Tham"],["Lao","Lao"],["Latin","Latin"],["Lepcha","Lepcha"],["Limbu","Limbu"],["Linear_A","Linear_A"],["Linear_B","Linear_B"],["Lycian","Lycian"],["Lydian","Lydian"],["Mahajani","Mahajani"],["Makasar","Makasar"],["Mandaic","Mandaic"],["Manichaean","Manichaean"],["Marchen","Marchen"],["Medefaidrin","Medefaidrin"],["Mende_Kikakui","Mende_Kikakui"],["Meroitic_Cursive","Meroitic_Cursive"],["Meroitic_Hieroglyphs","Meroitic_Hieroglyphs"],["Malayalam","Malayalam"],["Mongolian","Mongolian"],["Mro","Mro"],["Meetei_Mayek","Meetei_Mayek"],["Multani","Multani"],["Myanmar","Myanmar"],["Nandinagari","Nandinagari"],["Old_North_Arabian","Old_North_Arabian"],["Nabataean","Nabataean"],["Nko","Nko"],["Nushu","Nushu"],["Ogham","Ogham"],["Ol_Chiki","Ol_Chiki"],["Old_Turkic","Old_Turkic"],["Oriya","Oriya"],["Osage","Osage"],["Osmanya","Osmanya"],["Palmyrene","Palmyrene"],["Pau_Cin_Hau","Pau_Cin_Hau"],["Old_Permic","Old_Permic"],["Phags_Pa","Phags_Pa"],["Inscriptional_Pahlavi","Inscriptional_Pahlavi"],["Psalter_Pahlavi","Psalter_Pahlavi"],["Phoenician","Phoenician"],["Miao","Miao"],["Inscriptional_Parthian","Inscriptional_Parthian"],["Rejang","Rejang"],["Hanifi_Rohingya","Hanifi_Rohingya"],["Runic","Runic"],["Samaritan","Samaritan"],["Old_South_Arabian","Old_South_Arabian"],["Saurashtra","Saurashtra"],["SignWriting","SignWriting"],["Shavian","Shavian"],["Sharada","Sharada"],["Siddham","Siddham"],["Khudawadi","Khudawadi"],["Sinhala","Sinhala"],["Sogdian","Sogdian"],["Old_Sogdian","Old_Sogdian"],["Sora_Sompeng","Sora_Sompeng"],["Soyombo","Soyombo"],["Sundanese","Sundanese"],["Syloti_Nagri","Syloti_Nagri"],["Syriac","Syriac"],["Tagbanwa","Tagbanwa"],["Takri","Takri"],["Tai_Le","Tai_Le"],["New_Tai_Lue","New_Tai_Lue"],["Tamil","Tamil"],["Tangut","Tangut"],["Tai_Viet","Tai_Viet"],["Telugu","Telugu"],["Tifinagh","Tifinagh"],["Tagalog","Tagalog"],["Thaana","Thaana"],["Tibetan","Tibetan"],["Tirhuta","Tirhuta"],["Ugaritic","Ugaritic"],["Vai","Vai"],["Warang_Citi","Warang_Citi"],["Wancho","Wancho"],["Old_Persian","Old_Persian"],["Cuneiform","Cuneiform"],["Yezidi","Yezidi"],["Yi","Yi"],["Zanabazar_Square","Zanabazar_Square"],["Inherited","Inherited"],["Common","Common"],["Unknown","Unknown"]])],["Script_Extensions",new Map([["Adlm","Adlam"],["Aghb","Caucasian_Albanian"],["Ahom","Ahom"],["Arab","Arabic"],["Armi","Imperial_Aramaic"],["Armn","Armenian"],["Avst","Avestan"],["Bali","Balinese"],["Bamu","Bamum"],["Bass","Bassa_Vah"],["Batk","Batak"],["Beng","Bengali"],["Bhks","Bhaiksuki"],["Bopo","Bopomofo"],["Brah","Brahmi"],["Brai","Braille"],["Bugi","Buginese"],["Buhd","Buhid"],["Cakm","Chakma"],["Cans","Canadian_Aboriginal"],["Cari","Carian"],["Cham","Cham"],["Cher","Cherokee"],["Chrs","Chorasmian"],["Copt","Coptic"],["Qaac","Coptic"],["Cprt","Cypriot"],["Cyrl","Cyrillic"],["Deva","Devanagari"],["Diak","Dives_Akuru"],["Dogr","Dogra"],["Dsrt","Deseret"],["Dupl","Duployan"],["Egyp","Egyptian_Hieroglyphs"],["Elba","Elbasan"],["Elym","Elymaic"],["Ethi","Ethiopic"],["Geor","Georgian"],["Glag","Glagolitic"],["Gong","Gunjala_Gondi"],["Gonm","Masaram_Gondi"],["Goth","Gothic"],["Gran","Grantha"],["Grek","Greek"],["Gujr","Gujarati"],["Guru","Gurmukhi"],["Hang","Hangul"],["Hani","Han"],["Hano","Hanunoo"],["Hatr","Hatran"],["Hebr","Hebrew"],["Hira","Hiragana"],["Hluw","Anatolian_Hieroglyphs"],["Hmng","Pahawh_Hmong"],["Hmnp","Nyiakeng_Puachue_Hmong"],["Hrkt","Katakana_Or_Hiragana"],["Hung","Old_Hungarian"],["Ital","Old_Italic"],["Java","Javanese"],["Kali","Kayah_Li"],["Kana","Katakana"],["Khar","Kharoshthi"],["Khmr","Khmer"],["Khoj","Khojki"],["Kits","Khitan_Small_Script"],["Knda","Kannada"],["Kthi","Kaithi"],["Lana","Tai_Tham"],["Laoo","Lao"],["Latn","Latin"],["Lepc","Lepcha"],["Limb","Limbu"],["Lina","Linear_A"],["Linb","Linear_B"],["Lisu","Lisu"],["Lyci","Lycian"],["Lydi","Lydian"],["Mahj","Mahajani"],["Maka","Makasar"],["Mand","Mandaic"],["Mani","Manichaean"],["Marc","Marchen"],["Medf","Medefaidrin"],["Mend","Mende_Kikakui"],["Merc","Meroitic_Cursive"],["Mero","Meroitic_Hieroglyphs"],["Mlym","Malayalam"],["Modi","Modi"],["Mong","Mongolian"],["Mroo","Mro"],["Mtei","Meetei_Mayek"],["Mult","Multani"],["Mymr","Myanmar"],["Nand","Nandinagari"],["Narb","Old_North_Arabian"],["Nbat","Nabataean"],["Newa","Newa"],["Nkoo","Nko"],["Nshu","Nushu"],["Ogam","Ogham"],["Olck","Ol_Chiki"],["Orkh","Old_Turkic"],["Orya","Oriya"],["Osge","Osage"],["Osma","Osmanya"],["Palm","Palmyrene"],["Pauc","Pau_Cin_Hau"],["Perm","Old_Permic"],["Phag","Phags_Pa"],["Phli","Inscriptional_Pahlavi"],["Phlp","Psalter_Pahlavi"],["Phnx","Phoenician"],["Plrd","Miao"],["Prti","Inscriptional_Parthian"],["Rjng","Rejang"],["Rohg","Hanifi_Rohingya"],["Runr","Runic"],["Samr","Samaritan"],["Sarb","Old_South_Arabian"],["Saur","Saurashtra"],["Sgnw","SignWriting"],["Shaw","Shavian"],["Shrd","Sharada"],["Sidd","Siddham"],["Sind","Khudawadi"],["Sinh","Sinhala"],["Sogd","Sogdian"],["Sogo","Old_Sogdian"],["Sora","Sora_Sompeng"],["Soyo","Soyombo"],["Sund","Sundanese"],["Sylo","Syloti_Nagri"],["Syrc","Syriac"],["Tagb","Tagbanwa"],["Takr","Takri"],["Tale","Tai_Le"],["Talu","New_Tai_Lue"],["Taml","Tamil"],["Tang","Tangut"],["Tavt","Tai_Viet"],["Telu","Telugu"],["Tfng","Tifinagh"],["Tglg","Tagalog"],["Thaa","Thaana"],["Thai","Thai"],["Tibt","Tibetan"],["Tirh","Tirhuta"],["Ugar","Ugaritic"],["Vaii","Vai"],["Wara","Warang_Citi"],["Wcho","Wancho"],["Xpeo","Old_Persian"],["Xsux","Cuneiform"],["Yezi","Yezidi"],["Yiii","Yi"],["Zanb","Zanabazar_Square"],["Zinh","Inherited"],["Qaai","Inherited"],["Zyyy","Common"],["Zzzz","Unknown"],["Adlam","Adlam"],["Caucasian_Albanian","Caucasian_Albanian"],["Arabic","Arabic"],["Imperial_Aramaic","Imperial_Aramaic"],["Armenian","Armenian"],["Avestan","Avestan"],["Balinese","Balinese"],["Bamum","Bamum"],["Bassa_Vah","Bassa_Vah"],["Batak","Batak"],["Bengali","Bengali"],["Bhaiksuki","Bhaiksuki"],["Bopomofo","Bopomofo"],["Brahmi","Brahmi"],["Braille","Braille"],["Buginese","Buginese"],["Buhid","Buhid"],["Chakma","Chakma"],["Canadian_Aboriginal","Canadian_Aboriginal"],["Carian","Carian"],["Cherokee","Cherokee"],["Chorasmian","Chorasmian"],["Coptic","Coptic"],["Cypriot","Cypriot"],["Cyrillic","Cyrillic"],["Devanagari","Devanagari"],["Dives_Akuru","Dives_Akuru"],["Dogra","Dogra"],["Deseret","Deseret"],["Duployan","Duployan"],["Egyptian_Hieroglyphs","Egyptian_Hieroglyphs"],["Elbasan","Elbasan"],["Elymaic","Elymaic"],["Ethiopic","Ethiopic"],["Georgian","Georgian"],["Glagolitic","Glagolitic"],["Gunjala_Gondi","Gunjala_Gondi"],["Masaram_Gondi","Masaram_Gondi"],["Gothic","Gothic"],["Grantha","Grantha"],["Greek","Greek"],["Gujarati","Gujarati"],["Gurmukhi","Gurmukhi"],["Hangul","Hangul"],["Han","Han"],["Hanunoo","Hanunoo"],["Hatran","Hatran"],["Hebrew","Hebrew"],["Hiragana","Hiragana"],["Anatolian_Hieroglyphs","Anatolian_Hieroglyphs"],["Pahawh_Hmong","Pahawh_Hmong"],["Nyiakeng_Puachue_Hmong","Nyiakeng_Puachue_Hmong"],["Katakana_Or_Hiragana","Katakana_Or_Hiragana"],["Old_Hungarian","Old_Hungarian"],["Old_Italic","Old_Italic"],["Javanese","Javanese"],["Kayah_Li","Kayah_Li"],["Katakana","Katakana"],["Kharoshthi","Kharoshthi"],["Khmer","Khmer"],["Khojki","Khojki"],["Khitan_Small_Script","Khitan_Small_Script"],["Kannada","Kannada"],["Kaithi","Kaithi"],["Tai_Tham","Tai_Tham"],["Lao","Lao"],["Latin","Latin"],["Lepcha","Lepcha"],["Limbu","Limbu"],["Linear_A","Linear_A"],["Linear_B","Linear_B"],["Lycian","Lycian"],["Lydian","Lydian"],["Mahajani","Mahajani"],["Makasar","Makasar"],["Mandaic","Mandaic"],["Manichaean","Manichaean"],["Marchen","Marchen"],["Medefaidrin","Medefaidrin"],["Mende_Kikakui","Mende_Kikakui"],["Meroitic_Cursive","Meroitic_Cursive"],["Meroitic_Hieroglyphs","Meroitic_Hieroglyphs"],["Malayalam","Malayalam"],["Mongolian","Mongolian"],["Mro","Mro"],["Meetei_Mayek","Meetei_Mayek"],["Multani","Multani"],["Myanmar","Myanmar"],["Nandinagari","Nandinagari"],["Old_North_Arabian","Old_North_Arabian"],["Nabataean","Nabataean"],["Nko","Nko"],["Nushu","Nushu"],["Ogham","Ogham"],["Ol_Chiki","Ol_Chiki"],["Old_Turkic","Old_Turkic"],["Oriya","Oriya"],["Osage","Osage"],["Osmanya","Osmanya"],["Palmyrene","Palmyrene"],["Pau_Cin_Hau","Pau_Cin_Hau"],["Old_Permic","Old_Permic"],["Phags_Pa","Phags_Pa"],["Inscriptional_Pahlavi","Inscriptional_Pahlavi"],["Psalter_Pahlavi","Psalter_Pahlavi"],["Phoenician","Phoenician"],["Miao","Miao"],["Inscriptional_Parthian","Inscriptional_Parthian"],["Rejang","Rejang"],["Hanifi_Rohingya","Hanifi_Rohingya"],["Runic","Runic"],["Samaritan","Samaritan"],["Old_South_Arabian","Old_South_Arabian"],["Saurashtra","Saurashtra"],["SignWriting","SignWriting"],["Shavian","Shavian"],["Sharada","Sharada"],["Siddham","Siddham"],["Khudawadi","Khudawadi"],["Sinhala","Sinhala"],["Sogdian","Sogdian"],["Old_Sogdian","Old_Sogdian"],["Sora_Sompeng","Sora_Sompeng"],["Soyombo","Soyombo"],["Sundanese","Sundanese"],["Syloti_Nagri","Syloti_Nagri"],["Syriac","Syriac"],["Tagbanwa","Tagbanwa"],["Takri","Takri"],["Tai_Le","Tai_Le"],["New_Tai_Lue","New_Tai_Lue"],["Tamil","Tamil"],["Tangut","Tangut"],["Tai_Viet","Tai_Viet"],["Telugu","Telugu"],["Tifinagh","Tifinagh"],["Tagalog","Tagalog"],["Thaana","Thaana"],["Tibetan","Tibetan"],["Tirhuta","Tirhuta"],["Ugaritic","Ugaritic"],["Vai","Vai"],["Warang_Citi","Warang_Citi"],["Wancho","Wancho"],["Old_Persian","Old_Persian"],["Cuneiform","Cuneiform"],["Yezidi","Yezidi"],["Yi","Yi"],["Zanabazar_Square","Zanabazar_Square"],["Inherited","Inherited"],["Common","Common"],["Unknown","Unknown"]])]])},1317:(e,t,r)=>{"use strict";const s=r(4703);const matchPropertyValue=function(e,t){const r=s.get(e);if(!r){throw new Error(`Unknown property \`${e}\`.`)}const a=r.get(t);if(a){return a}throw new Error(`Unknown value \`${t}\` for property \`${e}\`.`)};e.exports=matchPropertyValue},864:e=>{e.exports=new Map([["scx","Script_Extensions"],["sc","Script"],["gc","General_Category"],["AHex","ASCII_Hex_Digit"],["Alpha","Alphabetic"],["Bidi_C","Bidi_Control"],["Bidi_M","Bidi_Mirrored"],["Cased","Cased"],["CI","Case_Ignorable"],["CWCF","Changes_When_Casefolded"],["CWCM","Changes_When_Casemapped"],["CWKCF","Changes_When_NFKC_Casefolded"],["CWL","Changes_When_Lowercased"],["CWT","Changes_When_Titlecased"],["CWU","Changes_When_Uppercased"],["Dash","Dash"],["Dep","Deprecated"],["DI","Default_Ignorable_Code_Point"],["Dia","Diacritic"],["Ext","Extender"],["Gr_Base","Grapheme_Base"],["Gr_Ext","Grapheme_Extend"],["Hex","Hex_Digit"],["IDC","ID_Continue"],["Ideo","Ideographic"],["IDS","ID_Start"],["IDSB","IDS_Binary_Operator"],["IDST","IDS_Trinary_Operator"],["Join_C","Join_Control"],["LOE","Logical_Order_Exception"],["Lower","Lowercase"],["Math","Math"],["NChar","Noncharacter_Code_Point"],["Pat_Syn","Pattern_Syntax"],["Pat_WS","Pattern_White_Space"],["QMark","Quotation_Mark"],["Radical","Radical"],["RI","Regional_Indicator"],["SD","Soft_Dotted"],["STerm","Sentence_Terminal"],["Term","Terminal_Punctuation"],["UIdeo","Unified_Ideograph"],["Upper","Uppercase"],["VS","Variation_Selector"],["WSpace","White_Space"],["space","White_Space"],["XIDC","XID_Continue"],["XIDS","XID_Start"]])},3812:(e,t,r)=>{function eslintParser(){return r(8187)}function pluginProposalClassProperties(){return r(8027)}function pluginProposalExportNamespaceFrom(){return r(9579)}function pluginProposalNumericSeparator(){return r(7300)}function pluginProposalObjectRestSpread(){return r(6309)}function pluginSyntaxBigint(){return r(6762)}function pluginSyntaxDynamicImport(){return r(5163)}function pluginSyntaxImportAssertions(){return r(8356)}function pluginSyntaxJsx(){return r(8926)}function pluginTransformDefine(){return r(9065)}function pluginTransformModulesCommonjs(){return r(6186)}function pluginTransformReactRemovePropTypes(){return r(6197)}function pluginTransformRuntime(){return r(4722)}function presetEnv(){return r(9290)}function presetReact(){return r(8277)}function presetTypescript(){return r(1068)}e.exports={eslintParser:eslintParser,pluginProposalClassProperties:pluginProposalClassProperties,pluginProposalExportNamespaceFrom:pluginProposalExportNamespaceFrom,pluginProposalNumericSeparator:pluginProposalNumericSeparator,pluginProposalObjectRestSpread:pluginProposalObjectRestSpread,pluginSyntaxBigint:pluginSyntaxBigint,pluginSyntaxDynamicImport:pluginSyntaxDynamicImport,pluginSyntaxImportAssertions:pluginSyntaxImportAssertions,pluginSyntaxJsx:pluginSyntaxJsx,pluginTransformDefine:pluginTransformDefine,pluginTransformModulesCommonjs:pluginTransformModulesCommonjs,pluginTransformReactRemovePropTypes:pluginTransformReactRemovePropTypes,pluginTransformRuntime:pluginTransformRuntime,presetEnv:presetEnv,presetReact:presetReact,presetTypescript:presetTypescript}},2272:(e,t,r)=>{e.exports=r(4817)},9302:(e,t,r)=>{e.exports=r(8392)},7363:(e,t,r)=>{e.exports=r(5224)},3574:(e,t,r)=>{e.exports=r(4374)},5884:(e,t,r)=>{e.exports=r(7867)},6038:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getInclusionReasons=getInclusionReasons;var s=r(7849);var a=r(1610);var n=r(240);function getInclusionReasons(e,t,r){const o=r[e]||{};return Object.keys(t).reduce(((e,r)=>{const i=(0,n.getLowestImplementedVersion)(o,r);const l=t[r];if(!i){e[r]=(0,a.prettifyVersion)(l)}else{const t=(0,n.isUnreleasedVersion)(i,r);const o=(0,n.isUnreleasedVersion)(l,r);if(!o&&(t||s.lt(l.toString(),(0,n.semverify)(i)))){e[r]=(0,a.prettifyVersion)(l)}}return e}),{})}},4486:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.targetsSupported=targetsSupported;t.isRequired=isRequired;t["default"]=filterItems;var s=r(7849);var a=r(5884);var n=r(240);function targetsSupported(e,t){const r=Object.keys(e);if(r.length===0){return false}const a=r.filter((r=>{const a=(0,n.getLowestImplementedVersion)(t,r);if(!a){return true}const o=e[r];if((0,n.isUnreleasedVersion)(o,r)){return false}if((0,n.isUnreleasedVersion)(a,r)){return true}if(!s.valid(o.toString())){throw new Error(`Invalid version passed for target "${r}": "${o}". `+"Versions must be in semver format (major.minor.patch)")}return s.gt((0,n.semverify)(a),o.toString())}));return a.length===0}function isRequired(e,t,{compatData:r=a,includes:s,excludes:n}={}){if(n!=null&&n.has(e))return false;if(s!=null&&s.has(e))return true;return!targetsSupported(t,r[e])}function filterItems(e,t,r,s,a,n,o){const i=new Set;const l={compatData:e,includes:t,excludes:r};for(const t in e){if(isRequired(t,s,l)){i.add(t)}else if(o){const e=o.get(t);if(e){i.add(e)}}}if(a){a.forEach((e=>!r.has(e)&&i.add(e)))}if(n){n.forEach((e=>!t.has(e)&&i.delete(e)))}return i}},4413:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isBrowsersQueryValid=isBrowsersQueryValid;t["default"]=getTargets;Object.defineProperty(t,"unreleasedLabels",{enumerable:true,get:function(){return i.unreleasedLabels}});Object.defineProperty(t,"TargetNames",{enumerable:true,get:function(){return l.TargetNames}});Object.defineProperty(t,"prettifyTargets",{enumerable:true,get:function(){return c.prettifyTargets}});Object.defineProperty(t,"getInclusionReasons",{enumerable:true,get:function(){return u.getInclusionReasons}});Object.defineProperty(t,"filterItems",{enumerable:true,get:function(){return p.default}});Object.defineProperty(t,"isRequired",{enumerable:true,get:function(){return p.isRequired}});var s=r(4907);var a=r(7347);var n=r(9302);var o=r(240);var i=r(1915);var l=r(1888);var c=r(1610);var u=r(6038);var p=r(4486);const f=n["es6.module"];const d=new a.OptionValidator("@babel/helper-compilation-targets");function validateTargetNames(e){const t=Object.keys(l.TargetNames);for(const r of Object.keys(e)){if(!(r in l.TargetNames)){throw new Error(d.formatMessage(`'${r}' is not a valid target\n- Did you mean '${(0,a.findSuggestion)(r,t)}'?`))}}return e}function isBrowsersQueryValid(e){return typeof e==="string"||Array.isArray(e)&&e.every((e=>typeof e==="string"))}function validateBrowsers(e){d.invariant(e===undefined||isBrowsersQueryValid(e),`'${String(e)}' is not a valid browserslist query`);return e}function getLowestVersions(e){return e.reduce(((e,t)=>{const[r,s]=t.split(" ");const a=i.browserNameMap[r];if(!a){return e}try{const t=s.split("-")[0].toLowerCase();const n=(0,o.isUnreleasedVersion)(t,r);if(!e[a]){e[a]=n?t:(0,o.semverify)(t);return e}const i=e[a];const l=(0,o.isUnreleasedVersion)(i,r);if(l&&n){e[a]=(0,o.getLowestUnreleased)(i,t,r)}else if(l){e[a]=(0,o.semverify)(t)}else if(!l&&!n){const r=(0,o.semverify)(t);e[a]=(0,o.semverMin)(i,r)}}catch(e){}return e}),{})}function outputDecimalWarning(e){if(!e.length){return}console.warn("Warning, the following targets are using a decimal version:\n");e.forEach((({target:e,value:t})=>console.warn(` ${e}: ${t}`)));console.warn(`\nWe recommend using a string for minor/patch versions to avoid numbers like 6.10\ngetting parsed as 6.1, which can lead to unexpected behavior.\n`)}function semverifyTarget(e,t){try{return(0,o.semverify)(t)}catch(r){throw new Error(d.formatMessage(`'${t}' is not a valid value for 'targets.${e}'.`))}}const m={__default(e,t){const r=(0,o.isUnreleasedVersion)(t,e)?t.toLowerCase():semverifyTarget(e,t);return[e,r]},node(e,t){const r=t===true||t==="current"?process.versions.node:semverifyTarget(e,t);return[e,r]}};function generateTargets(e){const t=Object.assign({},e);delete t.esmodules;delete t.browsers;return t}function resolveTargets(e){const t=s(e,{mobileToDesktop:true});return getLowestVersions(t)}function getTargets(e={},t={}){var r;let{browsers:a,esmodules:n}=e;const{configPath:i="."}=t;validateBrowsers(a);const l=generateTargets(e);let c=validateTargetNames(l);const u=!!a;const p=u||Object.keys(c).length>0;const d=!t.ignoreBrowserslistConfig&&!p;if(!a&&d){a=s.loadConfig({config:t.configFile,path:i,env:t.browserslistEnv});if(a==null){{a=[]}}}if(n&&(n!=="intersect"||!((r=a)!=null&&r.length))){a=Object.keys(f).map((e=>`${e} >= ${f[e]}`)).join(", ");n=false}if(a){const e=resolveTargets(a);if(n==="intersect"){for(const t of Object.keys(e)){const r=e[t];if(f[t]){e[t]=(0,o.getHighestUnreleased)(r,(0,o.semverify)(f[t]),t)}else{delete e[t]}}}c=Object.assign(e,c)}const y={};const g=[];for(const e of Object.keys(c).sort()){var h;const t=c[e];if(typeof t==="number"&&t%1!==0){g.push({target:e,value:t})}const r=(h=m[e])!=null?h:m.__default;const[s,a]=r(e,t);if(a){y[s]=a}}outputDecimalWarning(g);return y}},1888:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.TargetNames=void 0;const r={node:"node",chrome:"chrome",opera:"opera",edge:"edge",firefox:"firefox",safari:"safari",ie:"ie",ios:"ios",android:"android",electron:"electron",samsung:"samsung",rhino:"rhino"};t.TargetNames=r},1610:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.prettifyVersion=prettifyVersion;t.prettifyTargets=prettifyTargets;var s=r(7849);var a=r(1915);function prettifyVersion(e){if(typeof e!=="string"){return e}const t=[s.major(e)];const r=s.minor(e);const a=s.patch(e);if(r||a){t.push(r)}if(a){t.push(a)}return t.join(".")}function prettifyTargets(e){return Object.keys(e).reduce(((t,r)=>{let s=e[r];const n=a.unreleasedLabels[r];if(typeof s==="string"&&n!==s){s=prettifyVersion(s)}t[r]=s;return t}),{})}},1915:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.browserNameMap=t.unreleasedLabels=void 0;const r={safari:"tp"};t.unreleasedLabels=r;const s={and_chr:"chrome",and_ff:"firefox",android:"android",chrome:"chrome",edge:"edge",firefox:"firefox",ie:"ie",ie_mob:"ie",ios_saf:"ios",node:"node",op_mob:"opera",opera:"opera",safari:"safari",samsung:"samsung"};t.browserNameMap=s},240:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.semverMin=semverMin;t.semverify=semverify;t.isUnreleasedVersion=isUnreleasedVersion;t.getLowestUnreleased=getLowestUnreleased;t.getHighestUnreleased=getHighestUnreleased;t.getLowestImplementedVersion=getLowestImplementedVersion;var s=r(7849);var a=r(7347);var n=r(1915);const o=/^(\d+|\d+.\d+)$/;const i=new a.OptionValidator("@babel/helper-compilation-targets");function semverMin(e,t){return e&&s.lt(e,t)?e:t}function semverify(e){if(typeof e==="string"&&s.valid(e)){return e}i.invariant(typeof e==="number"||typeof e==="string"&&o.test(e),`'${e}' is not a valid version`);const t=e.toString().split(".");while(t.length<3){t.push("0")}return t.join(".")}function isUnreleasedVersion(e,t){const r=n.unreleasedLabels[t];return!!r&&r===e.toString().toLowerCase()}function getLowestUnreleased(e,t,r){const s=n.unreleasedLabels[r];const a=[e,t].some((e=>e===s));if(a){return e===a?t:e||t}return semverMin(e,t)}function getHighestUnreleased(e,t,r){return getLowestUnreleased(e,t,r)===e?t:e}function getLowestImplementedVersion(e,t){const r=e[t];if(!r&&t==="android"){return e.chrome}return r}},5789:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(8622);function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach((function(r){if(r!=="default"){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:true,get:function(){return e[r]}})}}))}t["default"]=e;return Object.freeze(t)}var a=_interopNamespace(s);function willPathCastToBoolean(e){const t=e;const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}class AssignmentMemoiser{constructor(){this._map=void 0;this._map=new WeakMap}has(e){return this._map.has(e)}get(e){if(!this.has(e))return;const t=this._map.get(e);const{value:r}=t;t.count--;if(t.count===0){return a.assignmentExpression("=",r,e)}return r}set(e,t,r){return this._map.set(e,{count:r,value:t})}}function toNonOptional(e,t){const{node:r}=e;if(a.isOptionalMemberExpression(r)){return a.memberExpression(t,r.property,r.computed)}if(e.isOptionalCallExpression()){const r=e.get("callee");if(e.node.optional&&r.isOptionalMemberExpression()){const{object:s}=r.node;const n=e.scope.maybeGenerateMemoised(s)||s;r.get("object").replaceWith(a.assignmentExpression("=",n,s));return a.callExpression(a.memberExpression(t,a.identifier("call")),[n,...e.node.arguments])}return a.callExpression(t,e.node.arguments)}return e.node}function isInDetachedTree(e){while(e){if(e.isProgram())break;const{parentPath:t,container:r,listKey:s}=e;const a=t.node;if(s){if(r!==a[s])return true}else{if(r!==a)return true}e=t}return false}const n={memoise(){},handle(e,t){const{node:r,parent:s,parentPath:n,scope:o}=e;if(e.isOptionalMemberExpression()){if(isInDetachedTree(e))return;const i=e.find((({node:t,parent:r})=>{if(a.isOptionalMemberExpression(r)){return r.optional||r.object!==t}if(a.isOptionalCallExpression(r)){return t!==e.node&&r.optional||r.callee!==t}return true}));if(o.path.isPattern()){i.replaceWith(a.callExpression(a.arrowFunctionExpression([],i.node),[]));return}const l=willPathCastToBoolean(i);const c=i.parentPath;if(c.isUpdateExpression({argument:r})||c.isAssignmentExpression({left:r})){throw e.buildCodeFrameError(`can't handle assignment`)}const u=c.isUnaryExpression({operator:"delete"});if(u&&i.isOptionalMemberExpression()&&i.get("property").isPrivateName()){throw e.buildCodeFrameError(`can't delete a private class element`)}let p=e;for(;;){if(p.isOptionalMemberExpression()){if(p.node.optional)break;p=p.get("object");continue}else if(p.isOptionalCallExpression()){if(p.node.optional)break;p=p.get("callee");continue}throw new Error(`Internal error: unexpected ${p.node.type}`)}const f=p.isOptionalMemberExpression()?"object":"callee";const d=p.node[f];const m=o.maybeGenerateMemoised(d);const y=m!=null?m:d;const g=n.isOptionalCallExpression({callee:r});const isOptionalCall=e=>g;const h=n.isCallExpression({callee:r});p.replaceWith(toNonOptional(p,y));if(isOptionalCall()){if(s.optional){n.replaceWith(this.optionalCall(e,s.arguments))}else{n.replaceWith(this.call(e,s.arguments))}}else if(h){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}let b=e.node;for(let t=e;t!==i;){const e=t.parentPath;if(e===i&&isOptionalCall()&&s.optional){b=e.node;break}b=toNonOptional(e,b);t=e}let x;const v=i.parentPath;if(a.isMemberExpression(b)&&v.isOptionalCallExpression({callee:i.node,optional:true})){const{object:t}=b;x=e.scope.maybeGenerateMemoised(t);if(x){b.object=a.assignmentExpression("=",x,t)}}let E=i;if(u){E=v;b=v.node}const j=m?a.assignmentExpression("=",a.cloneNode(y),a.cloneNode(d)):a.cloneNode(y);if(l){let e;if(t){e=a.binaryExpression("!=",j,a.nullLiteral())}else{e=a.logicalExpression("&&",a.binaryExpression("!==",j,a.nullLiteral()),a.binaryExpression("!==",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.logicalExpression("&&",e,b))}else{let e;if(t){e=a.binaryExpression("==",j,a.nullLiteral())}else{e=a.logicalExpression("||",a.binaryExpression("===",j,a.nullLiteral()),a.binaryExpression("===",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.conditionalExpression(e,u?a.booleanLiteral(true):o.buildUndefinedNode(),b))}if(x){const e=v.node;v.replaceWith(a.optionalCallExpression(a.optionalMemberExpression(e.callee,a.identifier("call"),false,true),[a.cloneNode(x),...e.arguments],false))}return}if(a.isUpdateExpression(s,{argument:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,prefix:o}=s;this.memoise(e,2);const i=a.binaryExpression(t[0],a.unaryExpression("+",this.get(e)),a.numericLiteral(1));if(o){n.replaceWith(this.set(e,i))}else{const{scope:t}=e;const s=t.generateUidIdentifierBasedOnNode(r);t.push({id:s});i.left=a.assignmentExpression("=",a.cloneNode(s),i.left);n.replaceWith(a.sequenceExpression([this.set(e,i),a.cloneNode(s)]))}return}if(n.isAssignmentExpression({left:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,right:r}=n.node;if(t==="="){n.replaceWith(this.set(e,r))}else{const s=t.slice(0,-1);if(a.LOGICAL_OPERATORS.includes(s)){this.memoise(e,1);n.replaceWith(a.logicalExpression(s,this.get(e),this.set(e,r)))}else{this.memoise(e,2);n.replaceWith(this.set(e,a.binaryExpression(s,this.get(e),r)))}}return}if(n.isCallExpression({callee:r})){n.replaceWith(this.call(e,n.node.arguments));return}if(n.isOptionalCallExpression({callee:r})){if(o.path.isPattern()){n.replaceWith(a.callExpression(a.arrowFunctionExpression([],n.node),[]));return}n.replaceWith(this.optionalCall(e,n.node.arguments));return}if(n.isForXStatement({left:r})||n.isObjectProperty({value:r})&&n.parentPath.isObjectPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isObjectProperty({value:s})&&n.parentPath.parentPath.isObjectPattern()||n.isArrayPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isArrayPattern()||n.isRestElement()){e.replaceWith(this.destructureSet(e));return}if(n.isTaggedTemplateExpression()){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}}};function memberExpressionToFunctions(e,t,r){e.traverse(t,Object.assign({},n,r,{memoiser:new AssignmentMemoiser}))}t["default"]=memberExpressionToFunctions},558:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1626:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(558);var a=r(7490);var n=r(5480);var o=r(8304);function matchAffectedArguments(e){const t=e.findIndex((e=>o.types.isSpreadElement(e)));return t>=0&&t!==e.length-1}function shouldTransform(e){let t=e;const r=[];while(t.isOptionalMemberExpression()||t.isOptionalCallExpression()){const{node:e}=t;r.push(e);if(t.isOptionalMemberExpression()){t=n.skipTransparentExprWrappers(t.get("object"))}else if(t.isOptionalCallExpression()){t=n.skipTransparentExprWrappers(t.get("callee"))}}for(let e=0;e{e.assertVersion(7);const t=e.assumption("noDocumentAll");const r=e.assumption("pureGetters");return{name:"bugfix-v8-spread-parameters-in-optional-chaining",visitor:{"OptionalCallExpression|OptionalMemberExpression"(e){if(shouldTransform(e)){a.transform(e,{noDocumentAll:t,pureGetters:r})}}}}}));t["default"]=i},1023:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(8304);const a=(0,s.template)(`\n async function wrapper() {\n var ITERATOR_ABRUPT_COMPLETION = false;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY;\n try {\n for (\n var ITERATOR_KEY = GET_ITERATOR(OBJECT), STEP_KEY;\n ITERATOR_ABRUPT_COMPLETION = !(STEP_KEY = await ITERATOR_KEY.next()).done;\n ITERATOR_ABRUPT_COMPLETION = false\n ) {\n }\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (ITERATOR_ABRUPT_COMPLETION && ITERATOR_KEY.return != null) {\n await ITERATOR_KEY.return();\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n }\n`);function _default(e,{getAsyncIterator:t}){const{node:r,scope:n,parent:o}=e;const i=n.generateUidIdentifier("step");const l=s.types.memberExpression(i,s.types.identifier("value"));const c=r.left;let u;if(s.types.isIdentifier(c)||s.types.isPattern(c)||s.types.isMemberExpression(c)){u=s.types.expressionStatement(s.types.assignmentExpression("=",c,l))}else if(s.types.isVariableDeclaration(c)){u=s.types.variableDeclaration(c.kind,[s.types.variableDeclarator(c.declarations[0].id,l)])}let p=a({ITERATOR_HAD_ERROR_KEY:n.generateUidIdentifier("didIteratorError"),ITERATOR_ABRUPT_COMPLETION:n.generateUidIdentifier("iteratorAbruptCompletion"),ITERATOR_ERROR_KEY:n.generateUidIdentifier("iteratorError"),ITERATOR_KEY:n.generateUidIdentifier("iterator"),GET_ITERATOR:t,OBJECT:r.right,STEP_KEY:s.types.cloneNode(i)});p=p.body.body;const f=s.types.isLabeledStatement(o);const d=p[3].block.body;const m=d[0];if(f){d[0]=s.types.labeledStatement(o.label,m)}return{replaceParent:f,node:p,declar:u,loop:m}}},2271:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(7120);var n=r(1079);var o=r(8304);var i=r(1023);var l=(0,s.declare)((e=>{e.assertVersion(7);const t={Function(e){e.skip()},YieldExpression({node:e},t){if(!e.delegate)return;const r=t.addHelper("asyncGeneratorDelegate");e.argument=o.types.callExpression(r,[o.types.callExpression(t.addHelper("asyncIterator"),[e.argument]),t.addHelper("awaitAsyncGenerator")])}};const r={Function(e){e.skip()},ForOfStatement(e,{file:t}){const{node:r}=e;if(!r.await)return;const s=(0,i.default)(e,{getAsyncIterator:t.addHelper("asyncIterator")});const{declar:a,loop:n}=s;const l=n.body;e.ensureBlock();if(a){l.body.push(a)}l.body=l.body.concat(r.body.body);o.types.inherits(n,r);o.types.inherits(n.body,r.body);if(s.replaceParent){e.parentPath.replaceWithMultiple(s.node)}else{e.replaceWithMultiple(s.node)}}};const s={Function(e,s){if(!e.node.async)return;e.traverse(r,s);if(!e.node.generator)return;e.traverse(t,s);(0,a.default)(e,{wrapAsync:s.addHelper("wrapAsyncGenerator"),wrapAwait:s.addHelper("awaitAsyncGenerator")})}};return{name:"proposal-async-generator-functions",inherits:n.default,visitor:{Program(e,t){e.traverse(s,t)}}}}));t["default"]=l},5557:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(8142);var n=r(6758);function generateUid(e,t){const r="";let s;let a=1;do{s=e._generateUid(r,a);a++}while(t.has(s));return s}var o=(0,s.declare)((({types:e,template:t,assertVersion:r})=>{r("^7.12.0");return{name:"proposal-class-static-block",inherits:a.default,pre(){(0,n.enableFeature)(this.file,n.FEATURES.staticBlocks,false)},visitor:{ClassBody(r){const{scope:s}=r;const a=new Set;const n=r.get("body");for(const e of n){if(e.isPrivate()){a.add(e.get("key.id").node.name)}}for(const r of n){if(!r.isStaticBlock())continue;const n=generateUid(s,a);a.add(n);const o=e.privateName(e.identifier(n));r.replaceWith(e.classPrivateProperty(o,t.expression.ast`(() => { ${r.node.body} })()`,[],true))}}}}}));t["default"]=o},3181:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(7445);var n=r(6758);var o=r(2155);var i=(0,s.declare)((({assertVersion:e,types:t,template:r},{loose:s})=>{e(7);const i=new WeakMap;const l=new WeakMap;function unshadow(e,t,r){while(r!==t){if(r.hasOwnBinding(e))r.rename(e);r=r.parent}}function injectToFieldInit(e,r,s=false){if(e.node.value){if(s){e.get("value").insertBefore(r)}else{e.get("value").insertAfter(r)}}else{e.set("value",t.unaryExpression("void",r))}}function injectInitialization(e,r){let s;let a;for(const t of e.get("body.body")){if((t.isClassProperty()||t.isClassPrivateProperty())&&!t.node.static){s=t;break}if(!a&&t.isClassMethod({kind:"constructor"})){a=t}}if(s){injectToFieldInit(s,r,true)}else{(0,n.injectInitialization)(e,a,[t.expressionStatement(r)])}}function getWeakSetId(e,s,a,n="",l){let c=i.get(a.node);if(!c){c=s.scope.generateUidIdentifier(`${n||""} brandCheck`);i.set(a.node,c);l(a,r.expression.ast`${t.cloneNode(c)}.add(this)`);const e=t.newExpression(t.identifier("WeakSet"),[]);(0,o.default)(e);s.insertBefore(r.ast`var ${c} = ${e}`)}return t.cloneNode(c)}return{name:"proposal-private-property-in-object",inherits:a.default,pre(){(0,n.enableFeature)(this.file,n.FEATURES.privateIn,s)},visitor:{BinaryExpression(e){const{node:s}=e;if(s.operator!=="in")return;if(!t.isPrivateName(s.left))return;const{name:a}=s.left.id;let n;const o=e.findParent((e=>{if(!e.isClass())return false;n=e.get("body.body").find((({node:e})=>t.isPrivate(e)&&e.key.id.name===a));return!!n}));if(o.parentPath.scope.path.isPattern()){o.replaceWith(r.ast`(() => ${o.node})()`);return}if(n.isMethod()){if(n.node.static){if(o.node.id){unshadow(o.node.id.name,o.scope,e.scope)}else{o.set("id",e.scope.generateUidIdentifier("class"))}e.replaceWith(r.expression.ast` + */(function(){"use strict";var r={function:true,object:true};var s=r[typeof window]&&window||this;var a=r[typeof t]&&t&&!t.nodeType&&t;var n=r["object"]&&e&&!e.nodeType;var o=a&&n&&typeof global=="object"&&global;if(o&&(o.global===o||o.window===o||o.self===o)){s=o}var i=Object.prototype.hasOwnProperty;function fromCodePoint(){var e=Number(arguments[0]);if(!isFinite(e)||e<0||e>1114111||Math.floor(e)!=e){throw RangeError("Invalid code point: "+e)}if(e<=65535){return String.fromCharCode(e)}else{e-=65536;var t=(e>>10)+55296;var r=e%1024+56320;return String.fromCharCode(t,r)}}var l={};function assertType(e,t){if(t.indexOf("|")==-1){if(e==t){return}throw Error("Invalid node type: "+e+"; expected type: "+t)}t=i.call(l,t)?l[t]:l[t]=RegExp("^(?:"+t+")$");if(t.test(e)){return}throw Error("Invalid node type: "+e+"; expected types: "+t)}function generate(e){var t=e.type;if(i.call(c,t)){return c[t](e)}throw Error("Invalid node type: "+t)}function generateAlternative(e){assertType(e.type,"alternative");var t=e.body,r=-1,s=t.length,a="";while(++r"}break;case"ignore":t+="?:";break;case"lookahead":t+="?=";break;case"negativeLookahead":t+="?!";break;case"lookbehind":t+="?<=";break;case"negativeLookbehind":t+="?"}throw new Error("Unknown reference type")}function generateTerm(e){assertType(e.type,"anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|unicodePropertyEscape|value|dot");return generate(e)}function generateValue(e){assertType(e.type,"value");var t=e.kind,r=e.codePoint;if(typeof r!="number"){throw new Error("Invalid code point: "+r)}switch(t){case"controlLetter":return"\\c"+fromCodePoint(r+64);case"hexadecimalEscape":return"\\x"+("00"+r.toString(16).toUpperCase()).slice(-2);case"identifier":return"\\"+fromCodePoint(r);case"null":return"\\"+r;case"octal":return"\\"+r.toString(8);case"singleEscape":switch(r){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r";default:throw Error("Invalid code point: "+r)}case"symbol":return fromCodePoint(r);case"unicodeEscape":return"\\u"+("0000"+r.toString(16).toUpperCase()).slice(-4);case"unicodeCodePointEscape":return"\\u{"+r.toString(16).toUpperCase()+"}";default:throw Error("Unsupported node kind: "+t)}}var c={alternative:generateAlternative,anchor:generateAnchor,characterClass:generateCharacterClass,characterClassEscape:generateCharacterClassEscape,characterClassRange:generateCharacterClassRange,unicodePropertyEscape:generateUnicodePropertyEscape,disjunction:generateDisjunction,dot:generateDot,group:generateGroup,quantifier:generateQuantifier,reference:generateReference,value:generateValue};var u={generate:generate};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define((function(){return u}));s.regjsgen=u}else if(a&&n){a.generate=generate}else{s.regjsgen=u}}).call(this)},9990:e=>{(function(){var t=String.fromCodePoint||function(){var e=String.fromCharCode;var t=Math.floor;return function fromCodePoint(){var r=16384;var s=[];var a;var n;var o=-1;var i=arguments.length;if(!i){return""}var l="";while(++o1114111||t(c)!=c){throw RangeError("Invalid code point: "+c)}if(c<=65535){s.push(c)}else{c-=65536;a=(c>>10)+55296;n=c%1024+56320;s.push(a,n)}if(o+1==i||s.length>r){l+=e.apply(null,s);s.length=0}}return l}}();function parse(e,r,s){if(!s){s={}}function addRaw(t){t.raw=e.substring(t.range[0],t.range[1]);return t}function updateRawStart(e,t){e.range[0]=t;return addRaw(e)}function createAnchor(e,t){return addRaw({type:"anchor",kind:e,range:[l-t,l]})}function createValue(e,t,r,s){return addRaw({type:"value",kind:e,codePoint:t,range:[r,s]})}function createEscaped(e,t,r,s){s=s||0;return createValue(e,t,l-(r.length+s),l)}function createCharacter(e){var t=e[0];var r=t.charCodeAt(0);if(i){var s;if(t.length===1&&r>=55296&&r<=56319){s=lookahead().charCodeAt(0);if(s>=56320&&s<=57343){l++;return createValue("symbol",(r-55296)*1024+s-56320+65536,l-2,l)}}}return createValue("symbol",r,l-1,l)}function createDisjunction(e,t,r){return addRaw({type:"disjunction",body:e,range:[t,r]})}function createDot(){return addRaw({type:"dot",range:[l-1,l]})}function createCharacterClassEscape(e){return addRaw({type:"characterClassEscape",value:e,range:[l-2,l]})}function createReference(e){return addRaw({type:"reference",matchIndex:parseInt(e,10),range:[l-1-e.length,l]})}function createNamedReference(e){return addRaw({type:"reference",name:e,range:[e.range[0]-3,l]})}function createGroup(e,t,r,s){return addRaw({type:"group",behavior:e,body:t,range:[r,s]})}function createQuantifier(e,t,r,s){if(s==null){r=l-1;s=l}return addRaw({type:"quantifier",min:e,max:t,greedy:true,body:null,range:[r,s]})}function createAlternative(e,t,r){return addRaw({type:"alternative",body:e,range:[t,r]})}function createCharacterClass(e,t,r,s){return addRaw({type:"characterClass",body:e,negative:t,range:[r,s]})}function createClassRange(e,t,r,s){if(e.codePoint>t.codePoint){bail("invalid range in character class",e.raw+"-"+t.raw,r,s)}return addRaw({type:"characterClassRange",min:e,max:t,range:[r,s]})}function flattenBody(e){if(e.type==="alternative"){return e.body}else{return[e]}}function isEmpty(e){return e.type==="empty"}function incr(t){t=t||1;var r=e.substring(l,l+t);l+=t||1;return r}function skip(e){if(!match(e)){bail("character",e)}}function match(t){if(e.indexOf(t,l)===l){return incr(t.length)}}function lookahead(){return e[l]}function current(t){return e.indexOf(t,l)===l}function next(t){return e[l+1]===t}function matchReg(t){var r=e.substring(l);var s=r.match(t);if(s){s.range=[];s.range[0]=l;incr(s[0].length);s.range[1]=l}return s}function parseDisjunction(){var e=[],t=l;e.push(parseAlternative());while(match("|")){e.push(parseAlternative())}if(e.length===1){return e[0]}return createDisjunction(e,t,l)}function parseAlternative(){var e=[],t=l;var r;while(r=parseTerm()){e.push(r)}if(e.length===1){return e[0]}return createAlternative(e,t,l)}function parseTerm(){if(l>=e.length||current("|")||current(")")){return null}var t=parseAnchor();if(t){return t}var r=parseAtomAndExtendedAtom();if(!r){bail("Expected atom")}var s=parseQuantifier()||false;if(s){s.body=flattenBody(r);updateRawStart(s,r.range[0]);return s}return r}function parseGroup(e,t,r,s){var a=null,n=l;if(match(e)){a=t}else if(match(r)){a=s}else{return false}return finishGroup(a,n)}function finishGroup(e,t){var r=parseDisjunction();if(!r){bail("Expected disjunction")}skip(")");var s=createGroup(e,flattenBody(r),t,l);if(e=="normal"){if(o){n++}}return s}function parseAnchor(){var e,t=l;if(match("^")){return createAnchor("start",1)}else if(match("$")){return createAnchor("end",1)}else if(match("\\b")){return createAnchor("boundary",2)}else if(match("\\B")){return createAnchor("not-boundary",2)}else{return parseGroup("(?=","lookahead","(?!","negativeLookahead")}}function parseQuantifier(){var e,t=l;var r;var s,a;if(match("*")){r=createQuantifier(0)}else if(match("+")){r=createQuantifier(1)}else if(match("?")){r=createQuantifier(0,1)}else if(e=matchReg(/^\{([0-9]+)\}/)){s=parseInt(e[1],10);r=createQuantifier(s,s,e.range[0],e.range[1])}else if(e=matchReg(/^\{([0-9]+),\}/)){s=parseInt(e[1],10);r=createQuantifier(s,undefined,e.range[0],e.range[1])}else if(e=matchReg(/^\{([0-9]+),([0-9]+)\}/)){s=parseInt(e[1],10);a=parseInt(e[2],10);if(s>a){bail("numbers out of order in {} quantifier","",t,l)}r=createQuantifier(s,a,e.range[0],e.range[1])}if(r){if(match("?")){r.greedy=false;r.range[1]+=1}}return r}function parseAtomAndExtendedAtom(){var e;if(e=matchReg(/^[^^$\\.*+?()[\]{}|]/)){return createCharacter(e)}else if(!i&&(e=matchReg(/^(?:]|})/))){return createCharacter(e)}else if(match(".")){return createDot()}else if(match("\\")){e=parseAtomEscape();if(!e){if(!i&&lookahead()=="c"){return createValue("symbol",92,l-1,l)}bail("atomEscape")}return e}else if(e=parseCharacterClass()){return e}else if(s.lookbehind&&(e=parseGroup("(?<=","lookbehind","(?");var r=finishGroup("normal",t.range[0]-3);r.name=t;return r}else{return parseGroup("(?:","ignore","(","normal")}}function parseUnicodeSurrogatePairEscape(e){if(i){var t,r;if(e.kind=="unicodeEscape"&&(t=e.codePoint)>=55296&&t<=56319&¤t("\\")&&next("u")){var s=l;l++;var a=parseClassEscape();if(a.kind=="unicodeEscape"&&(r=a.codePoint)>=56320&&r<=57343){e.range[1]=a.range[1];e.codePoint=(t-55296)*1024+r-56320+65536;e.type="value";e.kind="unicodeCodePointEscape";addRaw(e)}else{l=s}}}return e}function parseClassEscape(){return parseAtomEscape(true)}function parseAtomEscape(e){var t,r=l;t=parseDecimalEscape()||parseNamedReference();if(t){return t}if(e){if(match("b")){return createEscaped("singleEscape",8,"\\b")}else if(match("B")){bail("\\B not possible inside of CharacterClass","",r)}else if(!i&&(t=matchReg(/^c([0-9])/))){return createEscaped("controlLetter",t[1]+16,t[1],2)}if(match("-")&&i){return createEscaped("singleEscape",45,"\\-")}}t=parseCharacterEscape();return t}function parseDecimalEscape(){var e,t;if(e=matchReg(/^(?!0)\d+/)){t=e[0];var r=parseInt(e[0],10);if(r<=n){return createReference(e[0])}else{a.push(r);incr(-e[0].length);if(e=matchReg(/^[0-7]{1,3}/)){return createEscaped("octal",parseInt(e[0],8),e[0],1)}else{e=createCharacter(matchReg(/^[89]/));return updateRawStart(e,e.range[0]-1)}}}else if(e=matchReg(/^[0-7]{1,3}/)){t=e[0];if(/^0{1,3}$/.test(t)){return createEscaped("null",0,"0",t.length+1)}else{return createEscaped("octal",parseInt(t,8),t,1)}}else if(e=matchReg(/^[dDsSwW]/)){return createCharacterClassEscape(e[0])}return false}function parseNamedReference(){if(s.namedGroups&&matchReg(/^k<(?=.*?>)/)){var e=parseIdentifier();skip(">");return createNamedReference(e)}}function parseRegExpUnicodeEscapeSequence(){var e;if(e=matchReg(/^u([0-9a-fA-F]{4})/)){return parseUnicodeSurrogatePairEscape(createEscaped("unicodeEscape",parseInt(e[1],16),e[1],2))}else if(i&&(e=matchReg(/^u\{([0-9a-fA-F]+)\}/))){return createEscaped("unicodeCodePointEscape",parseInt(e[1],16),e[1],4)}}function parseCharacterEscape(){var e;var t=l;if(e=matchReg(/^[fnrtv]/)){var r=0;switch(e[0]){case"t":r=9;break;case"n":r=10;break;case"v":r=11;break;case"f":r=12;break;case"r":r=13;break}return createEscaped("singleEscape",r,"\\"+e[0])}else if(e=matchReg(/^c([a-zA-Z])/)){return createEscaped("controlLetter",e[1].charCodeAt(0)%32,e[1],2)}else if(e=matchReg(/^x([0-9a-fA-F]{2})/)){return createEscaped("hexadecimalEscape",parseInt(e[1],16),e[1],2)}else if(e=parseRegExpUnicodeEscapeSequence()){if(!e||e.codePoint>1114111){bail("Invalid escape sequence",null,t,l)}return e}else if(s.unicodePropertyEscape&&i&&(e=matchReg(/^([pP])\{([^\}]+)\}/))){return addRaw({type:"unicodePropertyEscape",negative:e[1]==="P",value:e[2],range:[e.range[0]-1,e.range[1]],raw:e[0]})}else{return parseIdentityEscape()}}function parseIdentifierAtom(r){var s=lookahead();var a=l;if(s==="\\"){incr();var n=parseRegExpUnicodeEscapeSequence();if(!n||!r(n.codePoint)){bail("Invalid escape sequence",null,a,l)}return t(n.codePoint)}var o=s.charCodeAt(0);if(o>=55296&&o<=56319){s+=e[l+1];var i=s.charCodeAt(1);if(i>=56320&&i<=57343){o=(o-55296)*1024+i-56320+65536}}if(!r(o))return;incr();if(o>65535)incr();return s}function parseIdentifier(){var e=l;var t=parseIdentifierAtom(isIdentifierStart);if(!t){bail("Invalid identifier")}var r;while(r=parseIdentifierAtom(isIdentifierPart)){t+=r}return addRaw({type:"identifier",value:t,range:[e,l]})}function isIdentifierStart(e){var r=/[\$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFF1]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=128&&r.test(t(e))}function isIdentifierPart(e){var r=/[0-9_\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDD30-\uDD39\uDF46-\uDF50]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC66-\uDC6F\uDC7F-\uDC82\uDCB0-\uDCBA\uDCF0-\uDCF9\uDD00-\uDD02\uDD27-\uDD34\uDD36-\uDD3F\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDD0-\uDDD9\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC50-\uDC59\uDC5E\uDCB0-\uDCC3\uDCD0-\uDCD9\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDE50-\uDE59\uDEAB-\uDEB7\uDEC0-\uDEC9\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC2C-\uDC3A\uDCE0-\uDCE9\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC50-\uDC59\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD50-\uDD59\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDDA0-\uDDA9\uDEF3-\uDEF6]|\uD81A[\uDE60-\uDE69\uDEF0-\uDEF4\uDF30-\uDF36\uDF50-\uDF59]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A\uDD50-\uDD59]|\uDB40[\uDD00-\uDDEF]/;return isIdentifierStart(e)||e>=48&&e<=57||e>=128&&r.test(t(e))}function parseIdentityEscape(){var e;var t=lookahead();if(i&&/[\^\$\.\*\+\?\(\)\\\[\]\{\}\|\/]/.test(t)||!i&&t!=="c"){if(t==="k"&&s.lookbehind){return null}e=incr();return createEscaped("identifier",e.charCodeAt(0),e,1)}return null}function parseCharacterClass(){var e,t=l;if(e=matchReg(/^\[\^/)){e=parseClassRanges();skip("]");return createCharacterClass(e,true,t,l)}else if(match("[")){e=parseClassRanges();skip("]");return createCharacterClass(e,false,t,l)}return null}function parseClassRanges(){var e;if(current("]")){return[]}else{e=parseNonemptyClassRanges();if(!e){bail("nonEmptyClassRanges")}return e}}function parseHelperClassRanges(e){var t,r,s;if(current("-")&&!next("]")){skip("-");s=parseClassAtom();if(!s){bail("classAtom")}r=l;var a=parseClassRanges();if(!a){bail("classRanges")}t=e.range[0];if(a.type==="empty"){return[createClassRange(e,s,t,r)]}return[createClassRange(e,s,t,r)].concat(a)}s=parseNonemptyClassRangesNoDash();if(!s){bail("nonEmptyClassRangesNoDash")}return[e].concat(s)}function parseNonemptyClassRanges(){var e=parseClassAtom();if(!e){bail("classAtom")}if(current("]")){return[e]}return parseHelperClassRanges(e)}function parseNonemptyClassRangesNoDash(){var e=parseClassAtom();if(!e){bail("classAtom")}if(current("]")){return e}return parseHelperClassRanges(e)}function parseClassAtom(){if(match("-")){return createCharacter("-")}else{return parseClassAtomNoDash()}}function parseClassAtomNoDash(){var e;if(e=matchReg(/^[^\\\]-]/)){return createCharacter(e[0])}else if(match("\\")){e=parseClassEscape();if(!e){bail("classEscape")}return parseUnicodeSurrogatePairEscape(e)}}function bail(t,r,s,a){s=s==null?l:s;a=a==null?s:a;var n=Math.max(0,s-10);var o=Math.min(a+10,e.length);var i=" "+e.substring(n,o);var c=" "+new Array(s-n+1).join(" ")+"^";throw SyntaxError(t+" at position "+s+(r?": "+r:"")+"\n"+i+"\n"+c)}var a=[];var n=0;var o=true;var i=(r||"").indexOf("u")!==-1;var l=0;e=String(e);if(e===""){e="(?:)"}var c=parseDisjunction();if(c.range[1]!==e.length){bail("Could not parse entire input - got stuck","",c.range[1])}for(var u=0;u{var t=e.exports=function(e){return new Traverse(e)};function Traverse(e){this.value=e}Traverse.prototype.get=function(e){var t=this.value;for(var r=0;r{e.exports=new Set(["General_Category","Script","Script_Extensions","Alphabetic","Any","ASCII","ASCII_Hex_Digit","Assigned","Bidi_Control","Bidi_Mirrored","Case_Ignorable","Cased","Changes_When_Casefolded","Changes_When_Casemapped","Changes_When_Lowercased","Changes_When_NFKC_Casefolded","Changes_When_Titlecased","Changes_When_Uppercased","Dash","Default_Ignorable_Code_Point","Deprecated","Diacritic","Emoji","Emoji_Component","Emoji_Modifier","Emoji_Modifier_Base","Emoji_Presentation","Extended_Pictographic","Extender","Grapheme_Base","Grapheme_Extend","Hex_Digit","ID_Continue","ID_Start","Ideographic","IDS_Binary_Operator","IDS_Trinary_Operator","Join_Control","Logical_Order_Exception","Lowercase","Math","Noncharacter_Code_Point","Pattern_Syntax","Pattern_White_Space","Quotation_Mark","Radical","Regional_Indicator","Sentence_Terminal","Soft_Dotted","Terminal_Punctuation","Unified_Ideograph","Uppercase","Variation_Selector","White_Space","XID_Continue","XID_Start"])},3042:(e,t,r)=>{"use strict";const s=r(7894);const a=r(864);const matchProperty=function(e){if(s.has(e)){return e}if(a.has(e)){return a.get(e)}throw new Error(`Unknown property: ${e}`)};e.exports=matchProperty},4703:e=>{e.exports=new Map([["General_Category",new Map([["C","Other"],["Cc","Control"],["cntrl","Control"],["Cf","Format"],["Cn","Unassigned"],["Co","Private_Use"],["Cs","Surrogate"],["L","Letter"],["LC","Cased_Letter"],["Ll","Lowercase_Letter"],["Lm","Modifier_Letter"],["Lo","Other_Letter"],["Lt","Titlecase_Letter"],["Lu","Uppercase_Letter"],["M","Mark"],["Combining_Mark","Mark"],["Mc","Spacing_Mark"],["Me","Enclosing_Mark"],["Mn","Nonspacing_Mark"],["N","Number"],["Nd","Decimal_Number"],["digit","Decimal_Number"],["Nl","Letter_Number"],["No","Other_Number"],["P","Punctuation"],["punct","Punctuation"],["Pc","Connector_Punctuation"],["Pd","Dash_Punctuation"],["Pe","Close_Punctuation"],["Pf","Final_Punctuation"],["Pi","Initial_Punctuation"],["Po","Other_Punctuation"],["Ps","Open_Punctuation"],["S","Symbol"],["Sc","Currency_Symbol"],["Sk","Modifier_Symbol"],["Sm","Math_Symbol"],["So","Other_Symbol"],["Z","Separator"],["Zl","Line_Separator"],["Zp","Paragraph_Separator"],["Zs","Space_Separator"],["Other","Other"],["Control","Control"],["Format","Format"],["Unassigned","Unassigned"],["Private_Use","Private_Use"],["Surrogate","Surrogate"],["Letter","Letter"],["Cased_Letter","Cased_Letter"],["Lowercase_Letter","Lowercase_Letter"],["Modifier_Letter","Modifier_Letter"],["Other_Letter","Other_Letter"],["Titlecase_Letter","Titlecase_Letter"],["Uppercase_Letter","Uppercase_Letter"],["Mark","Mark"],["Spacing_Mark","Spacing_Mark"],["Enclosing_Mark","Enclosing_Mark"],["Nonspacing_Mark","Nonspacing_Mark"],["Number","Number"],["Decimal_Number","Decimal_Number"],["Letter_Number","Letter_Number"],["Other_Number","Other_Number"],["Punctuation","Punctuation"],["Connector_Punctuation","Connector_Punctuation"],["Dash_Punctuation","Dash_Punctuation"],["Close_Punctuation","Close_Punctuation"],["Final_Punctuation","Final_Punctuation"],["Initial_Punctuation","Initial_Punctuation"],["Other_Punctuation","Other_Punctuation"],["Open_Punctuation","Open_Punctuation"],["Symbol","Symbol"],["Currency_Symbol","Currency_Symbol"],["Modifier_Symbol","Modifier_Symbol"],["Math_Symbol","Math_Symbol"],["Other_Symbol","Other_Symbol"],["Separator","Separator"],["Line_Separator","Line_Separator"],["Paragraph_Separator","Paragraph_Separator"],["Space_Separator","Space_Separator"]])],["Script",new Map([["Adlm","Adlam"],["Aghb","Caucasian_Albanian"],["Ahom","Ahom"],["Arab","Arabic"],["Armi","Imperial_Aramaic"],["Armn","Armenian"],["Avst","Avestan"],["Bali","Balinese"],["Bamu","Bamum"],["Bass","Bassa_Vah"],["Batk","Batak"],["Beng","Bengali"],["Bhks","Bhaiksuki"],["Bopo","Bopomofo"],["Brah","Brahmi"],["Brai","Braille"],["Bugi","Buginese"],["Buhd","Buhid"],["Cakm","Chakma"],["Cans","Canadian_Aboriginal"],["Cari","Carian"],["Cham","Cham"],["Cher","Cherokee"],["Chrs","Chorasmian"],["Copt","Coptic"],["Qaac","Coptic"],["Cprt","Cypriot"],["Cyrl","Cyrillic"],["Deva","Devanagari"],["Diak","Dives_Akuru"],["Dogr","Dogra"],["Dsrt","Deseret"],["Dupl","Duployan"],["Egyp","Egyptian_Hieroglyphs"],["Elba","Elbasan"],["Elym","Elymaic"],["Ethi","Ethiopic"],["Geor","Georgian"],["Glag","Glagolitic"],["Gong","Gunjala_Gondi"],["Gonm","Masaram_Gondi"],["Goth","Gothic"],["Gran","Grantha"],["Grek","Greek"],["Gujr","Gujarati"],["Guru","Gurmukhi"],["Hang","Hangul"],["Hani","Han"],["Hano","Hanunoo"],["Hatr","Hatran"],["Hebr","Hebrew"],["Hira","Hiragana"],["Hluw","Anatolian_Hieroglyphs"],["Hmng","Pahawh_Hmong"],["Hmnp","Nyiakeng_Puachue_Hmong"],["Hrkt","Katakana_Or_Hiragana"],["Hung","Old_Hungarian"],["Ital","Old_Italic"],["Java","Javanese"],["Kali","Kayah_Li"],["Kana","Katakana"],["Khar","Kharoshthi"],["Khmr","Khmer"],["Khoj","Khojki"],["Kits","Khitan_Small_Script"],["Knda","Kannada"],["Kthi","Kaithi"],["Lana","Tai_Tham"],["Laoo","Lao"],["Latn","Latin"],["Lepc","Lepcha"],["Limb","Limbu"],["Lina","Linear_A"],["Linb","Linear_B"],["Lisu","Lisu"],["Lyci","Lycian"],["Lydi","Lydian"],["Mahj","Mahajani"],["Maka","Makasar"],["Mand","Mandaic"],["Mani","Manichaean"],["Marc","Marchen"],["Medf","Medefaidrin"],["Mend","Mende_Kikakui"],["Merc","Meroitic_Cursive"],["Mero","Meroitic_Hieroglyphs"],["Mlym","Malayalam"],["Modi","Modi"],["Mong","Mongolian"],["Mroo","Mro"],["Mtei","Meetei_Mayek"],["Mult","Multani"],["Mymr","Myanmar"],["Nand","Nandinagari"],["Narb","Old_North_Arabian"],["Nbat","Nabataean"],["Newa","Newa"],["Nkoo","Nko"],["Nshu","Nushu"],["Ogam","Ogham"],["Olck","Ol_Chiki"],["Orkh","Old_Turkic"],["Orya","Oriya"],["Osge","Osage"],["Osma","Osmanya"],["Palm","Palmyrene"],["Pauc","Pau_Cin_Hau"],["Perm","Old_Permic"],["Phag","Phags_Pa"],["Phli","Inscriptional_Pahlavi"],["Phlp","Psalter_Pahlavi"],["Phnx","Phoenician"],["Plrd","Miao"],["Prti","Inscriptional_Parthian"],["Rjng","Rejang"],["Rohg","Hanifi_Rohingya"],["Runr","Runic"],["Samr","Samaritan"],["Sarb","Old_South_Arabian"],["Saur","Saurashtra"],["Sgnw","SignWriting"],["Shaw","Shavian"],["Shrd","Sharada"],["Sidd","Siddham"],["Sind","Khudawadi"],["Sinh","Sinhala"],["Sogd","Sogdian"],["Sogo","Old_Sogdian"],["Sora","Sora_Sompeng"],["Soyo","Soyombo"],["Sund","Sundanese"],["Sylo","Syloti_Nagri"],["Syrc","Syriac"],["Tagb","Tagbanwa"],["Takr","Takri"],["Tale","Tai_Le"],["Talu","New_Tai_Lue"],["Taml","Tamil"],["Tang","Tangut"],["Tavt","Tai_Viet"],["Telu","Telugu"],["Tfng","Tifinagh"],["Tglg","Tagalog"],["Thaa","Thaana"],["Thai","Thai"],["Tibt","Tibetan"],["Tirh","Tirhuta"],["Ugar","Ugaritic"],["Vaii","Vai"],["Wara","Warang_Citi"],["Wcho","Wancho"],["Xpeo","Old_Persian"],["Xsux","Cuneiform"],["Yezi","Yezidi"],["Yiii","Yi"],["Zanb","Zanabazar_Square"],["Zinh","Inherited"],["Qaai","Inherited"],["Zyyy","Common"],["Zzzz","Unknown"],["Adlam","Adlam"],["Caucasian_Albanian","Caucasian_Albanian"],["Arabic","Arabic"],["Imperial_Aramaic","Imperial_Aramaic"],["Armenian","Armenian"],["Avestan","Avestan"],["Balinese","Balinese"],["Bamum","Bamum"],["Bassa_Vah","Bassa_Vah"],["Batak","Batak"],["Bengali","Bengali"],["Bhaiksuki","Bhaiksuki"],["Bopomofo","Bopomofo"],["Brahmi","Brahmi"],["Braille","Braille"],["Buginese","Buginese"],["Buhid","Buhid"],["Chakma","Chakma"],["Canadian_Aboriginal","Canadian_Aboriginal"],["Carian","Carian"],["Cherokee","Cherokee"],["Chorasmian","Chorasmian"],["Coptic","Coptic"],["Cypriot","Cypriot"],["Cyrillic","Cyrillic"],["Devanagari","Devanagari"],["Dives_Akuru","Dives_Akuru"],["Dogra","Dogra"],["Deseret","Deseret"],["Duployan","Duployan"],["Egyptian_Hieroglyphs","Egyptian_Hieroglyphs"],["Elbasan","Elbasan"],["Elymaic","Elymaic"],["Ethiopic","Ethiopic"],["Georgian","Georgian"],["Glagolitic","Glagolitic"],["Gunjala_Gondi","Gunjala_Gondi"],["Masaram_Gondi","Masaram_Gondi"],["Gothic","Gothic"],["Grantha","Grantha"],["Greek","Greek"],["Gujarati","Gujarati"],["Gurmukhi","Gurmukhi"],["Hangul","Hangul"],["Han","Han"],["Hanunoo","Hanunoo"],["Hatran","Hatran"],["Hebrew","Hebrew"],["Hiragana","Hiragana"],["Anatolian_Hieroglyphs","Anatolian_Hieroglyphs"],["Pahawh_Hmong","Pahawh_Hmong"],["Nyiakeng_Puachue_Hmong","Nyiakeng_Puachue_Hmong"],["Katakana_Or_Hiragana","Katakana_Or_Hiragana"],["Old_Hungarian","Old_Hungarian"],["Old_Italic","Old_Italic"],["Javanese","Javanese"],["Kayah_Li","Kayah_Li"],["Katakana","Katakana"],["Kharoshthi","Kharoshthi"],["Khmer","Khmer"],["Khojki","Khojki"],["Khitan_Small_Script","Khitan_Small_Script"],["Kannada","Kannada"],["Kaithi","Kaithi"],["Tai_Tham","Tai_Tham"],["Lao","Lao"],["Latin","Latin"],["Lepcha","Lepcha"],["Limbu","Limbu"],["Linear_A","Linear_A"],["Linear_B","Linear_B"],["Lycian","Lycian"],["Lydian","Lydian"],["Mahajani","Mahajani"],["Makasar","Makasar"],["Mandaic","Mandaic"],["Manichaean","Manichaean"],["Marchen","Marchen"],["Medefaidrin","Medefaidrin"],["Mende_Kikakui","Mende_Kikakui"],["Meroitic_Cursive","Meroitic_Cursive"],["Meroitic_Hieroglyphs","Meroitic_Hieroglyphs"],["Malayalam","Malayalam"],["Mongolian","Mongolian"],["Mro","Mro"],["Meetei_Mayek","Meetei_Mayek"],["Multani","Multani"],["Myanmar","Myanmar"],["Nandinagari","Nandinagari"],["Old_North_Arabian","Old_North_Arabian"],["Nabataean","Nabataean"],["Nko","Nko"],["Nushu","Nushu"],["Ogham","Ogham"],["Ol_Chiki","Ol_Chiki"],["Old_Turkic","Old_Turkic"],["Oriya","Oriya"],["Osage","Osage"],["Osmanya","Osmanya"],["Palmyrene","Palmyrene"],["Pau_Cin_Hau","Pau_Cin_Hau"],["Old_Permic","Old_Permic"],["Phags_Pa","Phags_Pa"],["Inscriptional_Pahlavi","Inscriptional_Pahlavi"],["Psalter_Pahlavi","Psalter_Pahlavi"],["Phoenician","Phoenician"],["Miao","Miao"],["Inscriptional_Parthian","Inscriptional_Parthian"],["Rejang","Rejang"],["Hanifi_Rohingya","Hanifi_Rohingya"],["Runic","Runic"],["Samaritan","Samaritan"],["Old_South_Arabian","Old_South_Arabian"],["Saurashtra","Saurashtra"],["SignWriting","SignWriting"],["Shavian","Shavian"],["Sharada","Sharada"],["Siddham","Siddham"],["Khudawadi","Khudawadi"],["Sinhala","Sinhala"],["Sogdian","Sogdian"],["Old_Sogdian","Old_Sogdian"],["Sora_Sompeng","Sora_Sompeng"],["Soyombo","Soyombo"],["Sundanese","Sundanese"],["Syloti_Nagri","Syloti_Nagri"],["Syriac","Syriac"],["Tagbanwa","Tagbanwa"],["Takri","Takri"],["Tai_Le","Tai_Le"],["New_Tai_Lue","New_Tai_Lue"],["Tamil","Tamil"],["Tangut","Tangut"],["Tai_Viet","Tai_Viet"],["Telugu","Telugu"],["Tifinagh","Tifinagh"],["Tagalog","Tagalog"],["Thaana","Thaana"],["Tibetan","Tibetan"],["Tirhuta","Tirhuta"],["Ugaritic","Ugaritic"],["Vai","Vai"],["Warang_Citi","Warang_Citi"],["Wancho","Wancho"],["Old_Persian","Old_Persian"],["Cuneiform","Cuneiform"],["Yezidi","Yezidi"],["Yi","Yi"],["Zanabazar_Square","Zanabazar_Square"],["Inherited","Inherited"],["Common","Common"],["Unknown","Unknown"]])],["Script_Extensions",new Map([["Adlm","Adlam"],["Aghb","Caucasian_Albanian"],["Ahom","Ahom"],["Arab","Arabic"],["Armi","Imperial_Aramaic"],["Armn","Armenian"],["Avst","Avestan"],["Bali","Balinese"],["Bamu","Bamum"],["Bass","Bassa_Vah"],["Batk","Batak"],["Beng","Bengali"],["Bhks","Bhaiksuki"],["Bopo","Bopomofo"],["Brah","Brahmi"],["Brai","Braille"],["Bugi","Buginese"],["Buhd","Buhid"],["Cakm","Chakma"],["Cans","Canadian_Aboriginal"],["Cari","Carian"],["Cham","Cham"],["Cher","Cherokee"],["Chrs","Chorasmian"],["Copt","Coptic"],["Qaac","Coptic"],["Cprt","Cypriot"],["Cyrl","Cyrillic"],["Deva","Devanagari"],["Diak","Dives_Akuru"],["Dogr","Dogra"],["Dsrt","Deseret"],["Dupl","Duployan"],["Egyp","Egyptian_Hieroglyphs"],["Elba","Elbasan"],["Elym","Elymaic"],["Ethi","Ethiopic"],["Geor","Georgian"],["Glag","Glagolitic"],["Gong","Gunjala_Gondi"],["Gonm","Masaram_Gondi"],["Goth","Gothic"],["Gran","Grantha"],["Grek","Greek"],["Gujr","Gujarati"],["Guru","Gurmukhi"],["Hang","Hangul"],["Hani","Han"],["Hano","Hanunoo"],["Hatr","Hatran"],["Hebr","Hebrew"],["Hira","Hiragana"],["Hluw","Anatolian_Hieroglyphs"],["Hmng","Pahawh_Hmong"],["Hmnp","Nyiakeng_Puachue_Hmong"],["Hrkt","Katakana_Or_Hiragana"],["Hung","Old_Hungarian"],["Ital","Old_Italic"],["Java","Javanese"],["Kali","Kayah_Li"],["Kana","Katakana"],["Khar","Kharoshthi"],["Khmr","Khmer"],["Khoj","Khojki"],["Kits","Khitan_Small_Script"],["Knda","Kannada"],["Kthi","Kaithi"],["Lana","Tai_Tham"],["Laoo","Lao"],["Latn","Latin"],["Lepc","Lepcha"],["Limb","Limbu"],["Lina","Linear_A"],["Linb","Linear_B"],["Lisu","Lisu"],["Lyci","Lycian"],["Lydi","Lydian"],["Mahj","Mahajani"],["Maka","Makasar"],["Mand","Mandaic"],["Mani","Manichaean"],["Marc","Marchen"],["Medf","Medefaidrin"],["Mend","Mende_Kikakui"],["Merc","Meroitic_Cursive"],["Mero","Meroitic_Hieroglyphs"],["Mlym","Malayalam"],["Modi","Modi"],["Mong","Mongolian"],["Mroo","Mro"],["Mtei","Meetei_Mayek"],["Mult","Multani"],["Mymr","Myanmar"],["Nand","Nandinagari"],["Narb","Old_North_Arabian"],["Nbat","Nabataean"],["Newa","Newa"],["Nkoo","Nko"],["Nshu","Nushu"],["Ogam","Ogham"],["Olck","Ol_Chiki"],["Orkh","Old_Turkic"],["Orya","Oriya"],["Osge","Osage"],["Osma","Osmanya"],["Palm","Palmyrene"],["Pauc","Pau_Cin_Hau"],["Perm","Old_Permic"],["Phag","Phags_Pa"],["Phli","Inscriptional_Pahlavi"],["Phlp","Psalter_Pahlavi"],["Phnx","Phoenician"],["Plrd","Miao"],["Prti","Inscriptional_Parthian"],["Rjng","Rejang"],["Rohg","Hanifi_Rohingya"],["Runr","Runic"],["Samr","Samaritan"],["Sarb","Old_South_Arabian"],["Saur","Saurashtra"],["Sgnw","SignWriting"],["Shaw","Shavian"],["Shrd","Sharada"],["Sidd","Siddham"],["Sind","Khudawadi"],["Sinh","Sinhala"],["Sogd","Sogdian"],["Sogo","Old_Sogdian"],["Sora","Sora_Sompeng"],["Soyo","Soyombo"],["Sund","Sundanese"],["Sylo","Syloti_Nagri"],["Syrc","Syriac"],["Tagb","Tagbanwa"],["Takr","Takri"],["Tale","Tai_Le"],["Talu","New_Tai_Lue"],["Taml","Tamil"],["Tang","Tangut"],["Tavt","Tai_Viet"],["Telu","Telugu"],["Tfng","Tifinagh"],["Tglg","Tagalog"],["Thaa","Thaana"],["Thai","Thai"],["Tibt","Tibetan"],["Tirh","Tirhuta"],["Ugar","Ugaritic"],["Vaii","Vai"],["Wara","Warang_Citi"],["Wcho","Wancho"],["Xpeo","Old_Persian"],["Xsux","Cuneiform"],["Yezi","Yezidi"],["Yiii","Yi"],["Zanb","Zanabazar_Square"],["Zinh","Inherited"],["Qaai","Inherited"],["Zyyy","Common"],["Zzzz","Unknown"],["Adlam","Adlam"],["Caucasian_Albanian","Caucasian_Albanian"],["Arabic","Arabic"],["Imperial_Aramaic","Imperial_Aramaic"],["Armenian","Armenian"],["Avestan","Avestan"],["Balinese","Balinese"],["Bamum","Bamum"],["Bassa_Vah","Bassa_Vah"],["Batak","Batak"],["Bengali","Bengali"],["Bhaiksuki","Bhaiksuki"],["Bopomofo","Bopomofo"],["Brahmi","Brahmi"],["Braille","Braille"],["Buginese","Buginese"],["Buhid","Buhid"],["Chakma","Chakma"],["Canadian_Aboriginal","Canadian_Aboriginal"],["Carian","Carian"],["Cherokee","Cherokee"],["Chorasmian","Chorasmian"],["Coptic","Coptic"],["Cypriot","Cypriot"],["Cyrillic","Cyrillic"],["Devanagari","Devanagari"],["Dives_Akuru","Dives_Akuru"],["Dogra","Dogra"],["Deseret","Deseret"],["Duployan","Duployan"],["Egyptian_Hieroglyphs","Egyptian_Hieroglyphs"],["Elbasan","Elbasan"],["Elymaic","Elymaic"],["Ethiopic","Ethiopic"],["Georgian","Georgian"],["Glagolitic","Glagolitic"],["Gunjala_Gondi","Gunjala_Gondi"],["Masaram_Gondi","Masaram_Gondi"],["Gothic","Gothic"],["Grantha","Grantha"],["Greek","Greek"],["Gujarati","Gujarati"],["Gurmukhi","Gurmukhi"],["Hangul","Hangul"],["Han","Han"],["Hanunoo","Hanunoo"],["Hatran","Hatran"],["Hebrew","Hebrew"],["Hiragana","Hiragana"],["Anatolian_Hieroglyphs","Anatolian_Hieroglyphs"],["Pahawh_Hmong","Pahawh_Hmong"],["Nyiakeng_Puachue_Hmong","Nyiakeng_Puachue_Hmong"],["Katakana_Or_Hiragana","Katakana_Or_Hiragana"],["Old_Hungarian","Old_Hungarian"],["Old_Italic","Old_Italic"],["Javanese","Javanese"],["Kayah_Li","Kayah_Li"],["Katakana","Katakana"],["Kharoshthi","Kharoshthi"],["Khmer","Khmer"],["Khojki","Khojki"],["Khitan_Small_Script","Khitan_Small_Script"],["Kannada","Kannada"],["Kaithi","Kaithi"],["Tai_Tham","Tai_Tham"],["Lao","Lao"],["Latin","Latin"],["Lepcha","Lepcha"],["Limbu","Limbu"],["Linear_A","Linear_A"],["Linear_B","Linear_B"],["Lycian","Lycian"],["Lydian","Lydian"],["Mahajani","Mahajani"],["Makasar","Makasar"],["Mandaic","Mandaic"],["Manichaean","Manichaean"],["Marchen","Marchen"],["Medefaidrin","Medefaidrin"],["Mende_Kikakui","Mende_Kikakui"],["Meroitic_Cursive","Meroitic_Cursive"],["Meroitic_Hieroglyphs","Meroitic_Hieroglyphs"],["Malayalam","Malayalam"],["Mongolian","Mongolian"],["Mro","Mro"],["Meetei_Mayek","Meetei_Mayek"],["Multani","Multani"],["Myanmar","Myanmar"],["Nandinagari","Nandinagari"],["Old_North_Arabian","Old_North_Arabian"],["Nabataean","Nabataean"],["Nko","Nko"],["Nushu","Nushu"],["Ogham","Ogham"],["Ol_Chiki","Ol_Chiki"],["Old_Turkic","Old_Turkic"],["Oriya","Oriya"],["Osage","Osage"],["Osmanya","Osmanya"],["Palmyrene","Palmyrene"],["Pau_Cin_Hau","Pau_Cin_Hau"],["Old_Permic","Old_Permic"],["Phags_Pa","Phags_Pa"],["Inscriptional_Pahlavi","Inscriptional_Pahlavi"],["Psalter_Pahlavi","Psalter_Pahlavi"],["Phoenician","Phoenician"],["Miao","Miao"],["Inscriptional_Parthian","Inscriptional_Parthian"],["Rejang","Rejang"],["Hanifi_Rohingya","Hanifi_Rohingya"],["Runic","Runic"],["Samaritan","Samaritan"],["Old_South_Arabian","Old_South_Arabian"],["Saurashtra","Saurashtra"],["SignWriting","SignWriting"],["Shavian","Shavian"],["Sharada","Sharada"],["Siddham","Siddham"],["Khudawadi","Khudawadi"],["Sinhala","Sinhala"],["Sogdian","Sogdian"],["Old_Sogdian","Old_Sogdian"],["Sora_Sompeng","Sora_Sompeng"],["Soyombo","Soyombo"],["Sundanese","Sundanese"],["Syloti_Nagri","Syloti_Nagri"],["Syriac","Syriac"],["Tagbanwa","Tagbanwa"],["Takri","Takri"],["Tai_Le","Tai_Le"],["New_Tai_Lue","New_Tai_Lue"],["Tamil","Tamil"],["Tangut","Tangut"],["Tai_Viet","Tai_Viet"],["Telugu","Telugu"],["Tifinagh","Tifinagh"],["Tagalog","Tagalog"],["Thaana","Thaana"],["Tibetan","Tibetan"],["Tirhuta","Tirhuta"],["Ugaritic","Ugaritic"],["Vai","Vai"],["Warang_Citi","Warang_Citi"],["Wancho","Wancho"],["Old_Persian","Old_Persian"],["Cuneiform","Cuneiform"],["Yezidi","Yezidi"],["Yi","Yi"],["Zanabazar_Square","Zanabazar_Square"],["Inherited","Inherited"],["Common","Common"],["Unknown","Unknown"]])]])},1317:(e,t,r)=>{"use strict";const s=r(4703);const matchPropertyValue=function(e,t){const r=s.get(e);if(!r){throw new Error(`Unknown property \`${e}\`.`)}const a=r.get(t);if(a){return a}throw new Error(`Unknown value \`${t}\` for property \`${e}\`.`)};e.exports=matchPropertyValue},864:e=>{e.exports=new Map([["scx","Script_Extensions"],["sc","Script"],["gc","General_Category"],["AHex","ASCII_Hex_Digit"],["Alpha","Alphabetic"],["Bidi_C","Bidi_Control"],["Bidi_M","Bidi_Mirrored"],["Cased","Cased"],["CI","Case_Ignorable"],["CWCF","Changes_When_Casefolded"],["CWCM","Changes_When_Casemapped"],["CWKCF","Changes_When_NFKC_Casefolded"],["CWL","Changes_When_Lowercased"],["CWT","Changes_When_Titlecased"],["CWU","Changes_When_Uppercased"],["Dash","Dash"],["Dep","Deprecated"],["DI","Default_Ignorable_Code_Point"],["Dia","Diacritic"],["Ext","Extender"],["Gr_Base","Grapheme_Base"],["Gr_Ext","Grapheme_Extend"],["Hex","Hex_Digit"],["IDC","ID_Continue"],["Ideo","Ideographic"],["IDS","ID_Start"],["IDSB","IDS_Binary_Operator"],["IDST","IDS_Trinary_Operator"],["Join_C","Join_Control"],["LOE","Logical_Order_Exception"],["Lower","Lowercase"],["Math","Math"],["NChar","Noncharacter_Code_Point"],["Pat_Syn","Pattern_Syntax"],["Pat_WS","Pattern_White_Space"],["QMark","Quotation_Mark"],["Radical","Radical"],["RI","Regional_Indicator"],["SD","Soft_Dotted"],["STerm","Sentence_Terminal"],["Term","Terminal_Punctuation"],["UIdeo","Unified_Ideograph"],["Upper","Uppercase"],["VS","Variation_Selector"],["WSpace","White_Space"],["space","White_Space"],["XIDC","XID_Continue"],["XIDS","XID_Start"]])},3812:(e,t,r)=>{function eslintParser(){return r(8187)}function pluginProposalClassProperties(){return r(8027)}function pluginProposalExportNamespaceFrom(){return r(9579)}function pluginProposalNumericSeparator(){return r(7300)}function pluginProposalObjectRestSpread(){return r(6309)}function pluginSyntaxBigint(){return r(6762)}function pluginSyntaxDynamicImport(){return r(5163)}function pluginSyntaxImportAssertions(){return r(8356)}function pluginSyntaxJsx(){return r(8926)}function pluginTransformDefine(){return r(9065)}function pluginTransformModulesCommonjs(){return r(6186)}function pluginTransformReactRemovePropTypes(){return r(6197)}function pluginTransformRuntime(){return r(4722)}function presetEnv(){return r(9290)}function presetReact(){return r(8277)}function presetTypescript(){return r(1068)}e.exports={eslintParser:eslintParser,pluginProposalClassProperties:pluginProposalClassProperties,pluginProposalExportNamespaceFrom:pluginProposalExportNamespaceFrom,pluginProposalNumericSeparator:pluginProposalNumericSeparator,pluginProposalObjectRestSpread:pluginProposalObjectRestSpread,pluginSyntaxBigint:pluginSyntaxBigint,pluginSyntaxDynamicImport:pluginSyntaxDynamicImport,pluginSyntaxImportAssertions:pluginSyntaxImportAssertions,pluginSyntaxJsx:pluginSyntaxJsx,pluginTransformDefine:pluginTransformDefine,pluginTransformModulesCommonjs:pluginTransformModulesCommonjs,pluginTransformReactRemovePropTypes:pluginTransformReactRemovePropTypes,pluginTransformRuntime:pluginTransformRuntime,presetEnv:presetEnv,presetReact:presetReact,presetTypescript:presetTypescript}},2272:(e,t,r)=>{e.exports=r(4817)},9302:(e,t,r)=>{e.exports=r(8392)},7363:(e,t,r)=>{e.exports=r(5224)},3574:(e,t,r)=>{e.exports=r(4374)},5884:(e,t,r)=>{e.exports=r(7867)},6038:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getInclusionReasons=getInclusionReasons;var s=r(7849);var a=r(1610);var n=r(240);function getInclusionReasons(e,t,r){const o=r[e]||{};return Object.keys(t).reduce(((e,r)=>{const i=(0,n.getLowestImplementedVersion)(o,r);const l=t[r];if(!i){e[r]=(0,a.prettifyVersion)(l)}else{const t=(0,n.isUnreleasedVersion)(i,r);const o=(0,n.isUnreleasedVersion)(l,r);if(!o&&(t||s.lt(l.toString(),(0,n.semverify)(i)))){e[r]=(0,a.prettifyVersion)(l)}}return e}),{})}},4486:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.targetsSupported=targetsSupported;t.isRequired=isRequired;t["default"]=filterItems;var s=r(7849);var a=r(5884);var n=r(240);function targetsSupported(e,t){const r=Object.keys(e);if(r.length===0){return false}const a=r.filter((r=>{const a=(0,n.getLowestImplementedVersion)(t,r);if(!a){return true}const o=e[r];if((0,n.isUnreleasedVersion)(o,r)){return false}if((0,n.isUnreleasedVersion)(a,r)){return true}if(!s.valid(o.toString())){throw new Error(`Invalid version passed for target "${r}": "${o}". `+"Versions must be in semver format (major.minor.patch)")}return s.gt((0,n.semverify)(a),o.toString())}));return a.length===0}function isRequired(e,t,{compatData:r=a,includes:s,excludes:n}={}){if(n!=null&&n.has(e))return false;if(s!=null&&s.has(e))return true;return!targetsSupported(t,r[e])}function filterItems(e,t,r,s,a,n,o){const i=new Set;const l={compatData:e,includes:t,excludes:r};for(const t in e){if(isRequired(t,s,l)){i.add(t)}else if(o){const e=o.get(t);if(e){i.add(e)}}}if(a){a.forEach((e=>!r.has(e)&&i.add(e)))}if(n){n.forEach((e=>!t.has(e)&&i.delete(e)))}return i}},4413:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isBrowsersQueryValid=isBrowsersQueryValid;t["default"]=getTargets;Object.defineProperty(t,"unreleasedLabels",{enumerable:true,get:function(){return i.unreleasedLabels}});Object.defineProperty(t,"TargetNames",{enumerable:true,get:function(){return l.TargetNames}});Object.defineProperty(t,"prettifyTargets",{enumerable:true,get:function(){return c.prettifyTargets}});Object.defineProperty(t,"getInclusionReasons",{enumerable:true,get:function(){return u.getInclusionReasons}});Object.defineProperty(t,"filterItems",{enumerable:true,get:function(){return p.default}});Object.defineProperty(t,"isRequired",{enumerable:true,get:function(){return p.isRequired}});var s=r(4907);var a=r(7347);var n=r(9302);var o=r(240);var i=r(1915);var l=r(1888);var c=r(1610);var u=r(6038);var p=r(4486);const d=n["es6.module"];const f=new a.OptionValidator("@babel/helper-compilation-targets");function validateTargetNames(e){const t=Object.keys(l.TargetNames);for(const r of Object.keys(e)){if(!(r in l.TargetNames)){throw new Error(f.formatMessage(`'${r}' is not a valid target\n- Did you mean '${(0,a.findSuggestion)(r,t)}'?`))}}return e}function isBrowsersQueryValid(e){return typeof e==="string"||Array.isArray(e)&&e.every((e=>typeof e==="string"))}function validateBrowsers(e){f.invariant(e===undefined||isBrowsersQueryValid(e),`'${String(e)}' is not a valid browserslist query`);return e}function getLowestVersions(e){return e.reduce(((e,t)=>{const[r,s]=t.split(" ");const a=i.browserNameMap[r];if(!a){return e}try{const t=s.split("-")[0].toLowerCase();const n=(0,o.isUnreleasedVersion)(t,r);if(!e[a]){e[a]=n?t:(0,o.semverify)(t);return e}const i=e[a];const l=(0,o.isUnreleasedVersion)(i,r);if(l&&n){e[a]=(0,o.getLowestUnreleased)(i,t,r)}else if(l){e[a]=(0,o.semverify)(t)}else if(!l&&!n){const r=(0,o.semverify)(t);e[a]=(0,o.semverMin)(i,r)}}catch(e){}return e}),{})}function outputDecimalWarning(e){if(!e.length){return}console.warn("Warning, the following targets are using a decimal version:\n");e.forEach((({target:e,value:t})=>console.warn(` ${e}: ${t}`)));console.warn(`\nWe recommend using a string for minor/patch versions to avoid numbers like 6.10\ngetting parsed as 6.1, which can lead to unexpected behavior.\n`)}function semverifyTarget(e,t){try{return(0,o.semverify)(t)}catch(r){throw new Error(f.formatMessage(`'${t}' is not a valid value for 'targets.${e}'.`))}}const m={__default(e,t){const r=(0,o.isUnreleasedVersion)(t,e)?t.toLowerCase():semverifyTarget(e,t);return[e,r]},node(e,t){const r=t===true||t==="current"?process.versions.node:semverifyTarget(e,t);return[e,r]}};function generateTargets(e){const t=Object.assign({},e);delete t.esmodules;delete t.browsers;return t}function resolveTargets(e){const t=s(e,{mobileToDesktop:true});return getLowestVersions(t)}function getTargets(e={},t={}){var r;let{browsers:a,esmodules:n}=e;const{configPath:i="."}=t;validateBrowsers(a);const l=generateTargets(e);let c=validateTargetNames(l);const u=!!a;const p=u||Object.keys(c).length>0;const f=!t.ignoreBrowserslistConfig&&!p;if(!a&&f){a=s.loadConfig({config:t.configFile,path:i,env:t.browserslistEnv});if(a==null){{a=[]}}}if(n&&(n!=="intersect"||!((r=a)!=null&&r.length))){a=Object.keys(d).map((e=>`${e} >= ${d[e]}`)).join(", ");n=false}if(a){const e=resolveTargets(a);if(n==="intersect"){for(const t of Object.keys(e)){const r=e[t];if(d[t]){e[t]=(0,o.getHighestUnreleased)(r,(0,o.semverify)(d[t]),t)}else{delete e[t]}}}c=Object.assign(e,c)}const y={};const g=[];for(const e of Object.keys(c).sort()){var h;const t=c[e];if(typeof t==="number"&&t%1!==0){g.push({target:e,value:t})}const r=(h=m[e])!=null?h:m.__default;const[s,a]=r(e,t);if(a){y[s]=a}}outputDecimalWarning(g);return y}},1888:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.TargetNames=void 0;const r={node:"node",chrome:"chrome",opera:"opera",edge:"edge",firefox:"firefox",safari:"safari",ie:"ie",ios:"ios",android:"android",electron:"electron",samsung:"samsung",rhino:"rhino"};t.TargetNames=r},1610:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.prettifyVersion=prettifyVersion;t.prettifyTargets=prettifyTargets;var s=r(7849);var a=r(1915);function prettifyVersion(e){if(typeof e!=="string"){return e}const t=[s.major(e)];const r=s.minor(e);const a=s.patch(e);if(r||a){t.push(r)}if(a){t.push(a)}return t.join(".")}function prettifyTargets(e){return Object.keys(e).reduce(((t,r)=>{let s=e[r];const n=a.unreleasedLabels[r];if(typeof s==="string"&&n!==s){s=prettifyVersion(s)}t[r]=s;return t}),{})}},1915:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.browserNameMap=t.unreleasedLabels=void 0;const r={safari:"tp"};t.unreleasedLabels=r;const s={and_chr:"chrome",and_ff:"firefox",android:"android",chrome:"chrome",edge:"edge",firefox:"firefox",ie:"ie",ie_mob:"ie",ios_saf:"ios",node:"node",op_mob:"opera",opera:"opera",safari:"safari",samsung:"samsung"};t.browserNameMap=s},240:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.semverMin=semverMin;t.semverify=semverify;t.isUnreleasedVersion=isUnreleasedVersion;t.getLowestUnreleased=getLowestUnreleased;t.getHighestUnreleased=getHighestUnreleased;t.getLowestImplementedVersion=getLowestImplementedVersion;var s=r(7849);var a=r(7347);var n=r(1915);const o=/^(\d+|\d+.\d+)$/;const i=new a.OptionValidator("@babel/helper-compilation-targets");function semverMin(e,t){return e&&s.lt(e,t)?e:t}function semverify(e){if(typeof e==="string"&&s.valid(e)){return e}i.invariant(typeof e==="number"||typeof e==="string"&&o.test(e),`'${e}' is not a valid version`);const t=e.toString().split(".");while(t.length<3){t.push("0")}return t.join(".")}function isUnreleasedVersion(e,t){const r=n.unreleasedLabels[t];return!!r&&r===e.toString().toLowerCase()}function getLowestUnreleased(e,t,r){const s=n.unreleasedLabels[r];const a=[e,t].some((e=>e===s));if(a){return e===a?t:e||t}return semverMin(e,t)}function getHighestUnreleased(e,t,r){return getLowestUnreleased(e,t,r)===e?t:e}function getLowestImplementedVersion(e,t){const r=e[t];if(!r&&t==="android"){return e.chrome}return r}},5789:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(8622);function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach((function(r){if(r!=="default"){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:true,get:function(){return e[r]}})}}))}t["default"]=e;return Object.freeze(t)}var a=_interopNamespace(s);function willPathCastToBoolean(e){const t=e;const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}class AssignmentMemoiser{constructor(){this._map=void 0;this._map=new WeakMap}has(e){return this._map.has(e)}get(e){if(!this.has(e))return;const t=this._map.get(e);const{value:r}=t;t.count--;if(t.count===0){return a.assignmentExpression("=",r,e)}return r}set(e,t,r){return this._map.set(e,{count:r,value:t})}}function toNonOptional(e,t){const{node:r}=e;if(a.isOptionalMemberExpression(r)){return a.memberExpression(t,r.property,r.computed)}if(e.isOptionalCallExpression()){const r=e.get("callee");if(e.node.optional&&r.isOptionalMemberExpression()){const{object:s}=r.node;const n=e.scope.maybeGenerateMemoised(s)||s;r.get("object").replaceWith(a.assignmentExpression("=",n,s));return a.callExpression(a.memberExpression(t,a.identifier("call")),[n,...e.node.arguments])}return a.callExpression(t,e.node.arguments)}return e.node}function isInDetachedTree(e){while(e){if(e.isProgram())break;const{parentPath:t,container:r,listKey:s}=e;const a=t.node;if(s){if(r!==a[s])return true}else{if(r!==a)return true}e=t}return false}const n={memoise(){},handle(e,t){const{node:r,parent:s,parentPath:n,scope:o}=e;if(e.isOptionalMemberExpression()){if(isInDetachedTree(e))return;const i=e.find((({node:t,parent:r})=>{if(a.isOptionalMemberExpression(r)){return r.optional||r.object!==t}if(a.isOptionalCallExpression(r)){return t!==e.node&&r.optional||r.callee!==t}return true}));if(o.path.isPattern()){i.replaceWith(a.callExpression(a.arrowFunctionExpression([],i.node),[]));return}const l=willPathCastToBoolean(i);const c=i.parentPath;if(c.isUpdateExpression({argument:r})||c.isAssignmentExpression({left:r})){throw e.buildCodeFrameError(`can't handle assignment`)}const u=c.isUnaryExpression({operator:"delete"});if(u&&i.isOptionalMemberExpression()&&i.get("property").isPrivateName()){throw e.buildCodeFrameError(`can't delete a private class element`)}let p=e;for(;;){if(p.isOptionalMemberExpression()){if(p.node.optional)break;p=p.get("object");continue}else if(p.isOptionalCallExpression()){if(p.node.optional)break;p=p.get("callee");continue}throw new Error(`Internal error: unexpected ${p.node.type}`)}const d=p.isOptionalMemberExpression()?"object":"callee";const f=p.node[d];const m=o.maybeGenerateMemoised(f);const y=m!=null?m:f;const g=n.isOptionalCallExpression({callee:r});const isOptionalCall=e=>g;const h=n.isCallExpression({callee:r});p.replaceWith(toNonOptional(p,y));if(isOptionalCall()){if(s.optional){n.replaceWith(this.optionalCall(e,s.arguments))}else{n.replaceWith(this.call(e,s.arguments))}}else if(h){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}let b=e.node;for(let t=e;t!==i;){const e=t.parentPath;if(e===i&&isOptionalCall()&&s.optional){b=e.node;break}b=toNonOptional(e,b);t=e}let x;const v=i.parentPath;if(a.isMemberExpression(b)&&v.isOptionalCallExpression({callee:i.node,optional:true})){const{object:t}=b;x=e.scope.maybeGenerateMemoised(t);if(x){b.object=a.assignmentExpression("=",x,t)}}let E=i;if(u){E=v;b=v.node}const j=m?a.assignmentExpression("=",a.cloneNode(y),a.cloneNode(f)):a.cloneNode(y);if(l){let e;if(t){e=a.binaryExpression("!=",j,a.nullLiteral())}else{e=a.logicalExpression("&&",a.binaryExpression("!==",j,a.nullLiteral()),a.binaryExpression("!==",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.logicalExpression("&&",e,b))}else{let e;if(t){e=a.binaryExpression("==",j,a.nullLiteral())}else{e=a.logicalExpression("||",a.binaryExpression("===",j,a.nullLiteral()),a.binaryExpression("===",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.conditionalExpression(e,u?a.booleanLiteral(true):o.buildUndefinedNode(),b))}if(x){const e=v.node;v.replaceWith(a.optionalCallExpression(a.optionalMemberExpression(e.callee,a.identifier("call"),false,true),[a.cloneNode(x),...e.arguments],false))}return}if(a.isUpdateExpression(s,{argument:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,prefix:o}=s;this.memoise(e,2);const i=a.binaryExpression(t[0],a.unaryExpression("+",this.get(e)),a.numericLiteral(1));if(o){n.replaceWith(this.set(e,i))}else{const{scope:t}=e;const s=t.generateUidIdentifierBasedOnNode(r);t.push({id:s});i.left=a.assignmentExpression("=",a.cloneNode(s),i.left);n.replaceWith(a.sequenceExpression([this.set(e,i),a.cloneNode(s)]))}return}if(n.isAssignmentExpression({left:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,right:r}=n.node;if(t==="="){n.replaceWith(this.set(e,r))}else{const s=t.slice(0,-1);if(a.LOGICAL_OPERATORS.includes(s)){this.memoise(e,1);n.replaceWith(a.logicalExpression(s,this.get(e),this.set(e,r)))}else{this.memoise(e,2);n.replaceWith(this.set(e,a.binaryExpression(s,this.get(e),r)))}}return}if(n.isCallExpression({callee:r})){n.replaceWith(this.call(e,n.node.arguments));return}if(n.isOptionalCallExpression({callee:r})){if(o.path.isPattern()){n.replaceWith(a.callExpression(a.arrowFunctionExpression([],n.node),[]));return}n.replaceWith(this.optionalCall(e,n.node.arguments));return}if(n.isForXStatement({left:r})||n.isObjectProperty({value:r})&&n.parentPath.isObjectPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isObjectProperty({value:s})&&n.parentPath.parentPath.isObjectPattern()||n.isArrayPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isArrayPattern()||n.isRestElement()){e.replaceWith(this.destructureSet(e));return}if(n.isTaggedTemplateExpression()){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}}};function memberExpressionToFunctions(e,t,r){e.traverse(t,Object.assign({},n,r,{memoiser:new AssignmentMemoiser}))}t["default"]=memberExpressionToFunctions},558:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1626:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(558);var a=r(7490);var n=r(5480);var o=r(8304);function matchAffectedArguments(e){const t=e.findIndex((e=>o.types.isSpreadElement(e)));return t>=0&&t!==e.length-1}function shouldTransform(e){let t=e;const r=[];while(t.isOptionalMemberExpression()||t.isOptionalCallExpression()){const{node:e}=t;r.push(e);if(t.isOptionalMemberExpression()){t=n.skipTransparentExprWrappers(t.get("object"))}else if(t.isOptionalCallExpression()){t=n.skipTransparentExprWrappers(t.get("callee"))}}for(let e=0;e{e.assertVersion(7);const t=e.assumption("noDocumentAll");const r=e.assumption("pureGetters");return{name:"bugfix-v8-spread-parameters-in-optional-chaining",visitor:{"OptionalCallExpression|OptionalMemberExpression"(e){if(shouldTransform(e)){a.transform(e,{noDocumentAll:t,pureGetters:r})}}}}}));t["default"]=i},1023:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(8304);const a=(0,s.template)(`\n async function wrapper() {\n var ITERATOR_ABRUPT_COMPLETION = false;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY;\n try {\n for (\n var ITERATOR_KEY = GET_ITERATOR(OBJECT), STEP_KEY;\n ITERATOR_ABRUPT_COMPLETION = !(STEP_KEY = await ITERATOR_KEY.next()).done;\n ITERATOR_ABRUPT_COMPLETION = false\n ) {\n }\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (ITERATOR_ABRUPT_COMPLETION && ITERATOR_KEY.return != null) {\n await ITERATOR_KEY.return();\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n }\n`);function _default(e,{getAsyncIterator:t}){const{node:r,scope:n,parent:o}=e;const i=n.generateUidIdentifier("step");const l=s.types.memberExpression(i,s.types.identifier("value"));const c=r.left;let u;if(s.types.isIdentifier(c)||s.types.isPattern(c)||s.types.isMemberExpression(c)){u=s.types.expressionStatement(s.types.assignmentExpression("=",c,l))}else if(s.types.isVariableDeclaration(c)){u=s.types.variableDeclaration(c.kind,[s.types.variableDeclarator(c.declarations[0].id,l)])}let p=a({ITERATOR_HAD_ERROR_KEY:n.generateUidIdentifier("didIteratorError"),ITERATOR_ABRUPT_COMPLETION:n.generateUidIdentifier("iteratorAbruptCompletion"),ITERATOR_ERROR_KEY:n.generateUidIdentifier("iteratorError"),ITERATOR_KEY:n.generateUidIdentifier("iterator"),GET_ITERATOR:t,OBJECT:r.right,STEP_KEY:s.types.cloneNode(i)});p=p.body.body;const d=s.types.isLabeledStatement(o);const f=p[3].block.body;const m=f[0];if(d){f[0]=s.types.labeledStatement(o.label,m)}return{replaceParent:d,node:p,declar:u,loop:m}}},2271:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(7120);var n=r(1079);var o=r(8304);var i=r(1023);var l=(0,s.declare)((e=>{e.assertVersion(7);const t={Function(e){e.skip()},YieldExpression({node:e},t){if(!e.delegate)return;const r=t.addHelper("asyncGeneratorDelegate");e.argument=o.types.callExpression(r,[o.types.callExpression(t.addHelper("asyncIterator"),[e.argument]),t.addHelper("awaitAsyncGenerator")])}};const r={Function(e){e.skip()},ForOfStatement(e,{file:t}){const{node:r}=e;if(!r.await)return;const s=(0,i.default)(e,{getAsyncIterator:t.addHelper("asyncIterator")});const{declar:a,loop:n}=s;const l=n.body;e.ensureBlock();if(a){l.body.push(a)}l.body=l.body.concat(r.body.body);o.types.inherits(n,r);o.types.inherits(n.body,r.body);if(s.replaceParent){e.parentPath.replaceWithMultiple(s.node)}else{e.replaceWithMultiple(s.node)}}};const s={Function(e,s){if(!e.node.async)return;e.traverse(r,s);if(!e.node.generator)return;e.traverse(t,s);(0,a.default)(e,{wrapAsync:s.addHelper("wrapAsyncGenerator"),wrapAwait:s.addHelper("awaitAsyncGenerator")})}};return{name:"proposal-async-generator-functions",inherits:n.default,visitor:{Program(e,t){e.traverse(s,t)}}}}));t["default"]=l},5557:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(8142);var n=r(6758);function generateUid(e,t){const r="";let s;let a=1;do{s=e._generateUid(r,a);a++}while(t.has(s));return s}var o=(0,s.declare)((({types:e,template:t,assertVersion:r})=>{r("^7.12.0");return{name:"proposal-class-static-block",inherits:a.default,pre(){(0,n.enableFeature)(this.file,n.FEATURES.staticBlocks,false)},visitor:{ClassBody(r){const{scope:s}=r;const a=new Set;const n=r.get("body");for(const e of n){if(e.isPrivate()){a.add(e.get("key.id").node.name)}}for(const r of n){if(!r.isStaticBlock())continue;const n=generateUid(s,a);a.add(n);const o=e.privateName(e.identifier(n));r.replaceWith(e.classPrivateProperty(o,t.expression.ast`(() => { ${r.node.body} })()`,[],true))}}}}}));t["default"]=o},3181:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(7445);var n=r(6758);var o=r(2155);var i=(0,s.declare)((({assertVersion:e,types:t,template:r},{loose:s})=>{e(7);const i=new WeakMap;const l=new WeakMap;function unshadow(e,t,r){while(r!==t){if(r.hasOwnBinding(e))r.rename(e);r=r.parent}}function injectToFieldInit(e,r,s=false){if(e.node.value){if(s){e.get("value").insertBefore(r)}else{e.get("value").insertAfter(r)}}else{e.set("value",t.unaryExpression("void",r))}}function injectInitialization(e,r){let s;let a;for(const t of e.get("body.body")){if((t.isClassProperty()||t.isClassPrivateProperty())&&!t.node.static){s=t;break}if(!a&&t.isClassMethod({kind:"constructor"})){a=t}}if(s){injectToFieldInit(s,r,true)}else{(0,n.injectInitialization)(e,a,[t.expressionStatement(r)])}}function getWeakSetId(e,s,a,n="",l){let c=i.get(a.node);if(!c){c=s.scope.generateUidIdentifier(`${n||""} brandCheck`);i.set(a.node,c);l(a,r.expression.ast`${t.cloneNode(c)}.add(this)`);const e=t.newExpression(t.identifier("WeakSet"),[]);(0,o.default)(e);s.insertBefore(r.ast`var ${c} = ${e}`)}return t.cloneNode(c)}return{name:"proposal-private-property-in-object",inherits:a.default,pre(){(0,n.enableFeature)(this.file,n.FEATURES.privateIn,s)},visitor:{BinaryExpression(e){const{node:s}=e;if(s.operator!=="in")return;if(!t.isPrivateName(s.left))return;const{name:a}=s.left.id;let n;const o=e.findParent((e=>{if(!e.isClass())return false;n=e.get("body.body").find((({node:e})=>t.isPrivate(e)&&e.key.id.name===a));return!!n}));if(o.parentPath.scope.path.isPattern()){o.replaceWith(r.ast`(() => ${o.node})()`);return}if(n.isMethod()){if(n.node.static){if(o.node.id){unshadow(o.node.id.name,o.scope,e.scope)}else{o.set("id",e.scope.generateUidIdentifier("class"))}e.replaceWith(r.expression.ast` ${t.cloneNode(o.node.id)} === ${e.node.right} - `)}else{var c;const t=getWeakSetId(i,o,o,(c=o.node.id)==null?void 0:c.name,injectInitialization);e.replaceWith(r.expression.ast`${t}.has(${e.node.right})`)}}else{const t=getWeakSetId(l,o,n,n.node.key.id.name,injectToFieldInit);e.replaceWith(r.expression.ast`${t}.has(${e.node.right})`)}}}}}));t["default"]=i},6092:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6550);var a=r(558);var n=(0,a.declare)(((e,t)=>{e.assertVersion(7);const{useUnicodeFlag:r=true}=t;if(typeof r!=="boolean"){throw new Error(".useUnicodeFlag must be a boolean, or undefined")}return(0,s.createRegExpFeaturePlugin)({name:"proposal-unicode-property-regex",feature:"unicodePropertyEscape",options:{useUnicodeFlag:r}})}));t["default"]=n},1079:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(631);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-async-generators",manipulateOptions(e,t){t.plugins.push("asyncGenerators")}}}));t["default"]=a},631:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,r,s)=>{if(!t.assertVersion){t=Object.assign(copyApiObject(t),{assertVersion(e){throwVersionError(e,t.version)}})}return e(t,r||{},s)}}function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},6762:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8853);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-bigint",manipulateOptions(e,t){t.plugins.push("bigInt")}}}));t["default"]=a},8853:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,r,s)=>{if(!t.assertVersion){t=Object.assign(copyApiObject(t),{assertVersion(e){throwVersionError(e,t.version)}})}return e(t,r||{},s)}}function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},947:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(93);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-class-properties",manipulateOptions(e,t){t.plugins.push("classProperties","classPrivateProperties","classPrivateMethods")}}}));t["default"]=a},93:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8142:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-class-static-block",manipulateOptions(e,t){t.plugins.push("classStaticBlock")}}}));t["default"]=a},5163:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(2083);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-dynamic-import",manipulateOptions(e,t){t.plugins.push("dynamicImport")}}}));t["default"]=a},2083:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,r,s)=>{if(!t.assertVersion){t=Object.assign(copyApiObject(t),{assertVersion(e){throwVersionError(e,t.version)}})}return e(t,r||{},s)}}function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8356:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9692);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-import-assertions",manipulateOptions(e,t){t.plugins.push(["importAssertions"])}}}));t["default"]=a},9692:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7445:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-private-property-in-object",manipulateOptions(e,t){t.plugins.push("privateIn")}}}));t["default"]=a},6050:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);function removePlugin(e,t){const r=[];e.forEach(((e,s)=>{const a=Array.isArray(e)?e[0]:e;if(a===t){r.unshift(s)}}));for(const t of r){e.splice(t,1)}}var a=(0,s.declare)(((e,{isTSX:t})=>{e.assertVersion(7);return{name:"syntax-typescript",manipulateOptions(e,r){const{plugins:s}=r;removePlugin(s,"flow");removePlugin(s,"jsx");r.plugins.push("typescript","classProperties");{r.plugins.push("objectRestSpread")}if(t){r.plugins.push("jsx")}}}}));t["default"]=a},6408:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(2155);var n=r(550);var o=r(7058);var i=r(8304);var l=r(5548);var c=r(4546);const getBuiltinClasses=e=>Object.keys(l[e]).filter((e=>/^[A-Z]/.test(e)));const u=new Set([...getBuiltinClasses("builtin"),...getBuiltinClasses("browser")]);var p=(0,s.declare)(((e,t)=>{var r,s,l,p;e.assertVersion(7);const{loose:f}=t;const d=(r=e.assumption("setClassMethods"))!=null?r:t.loose;const m=(s=e.assumption("constantSuper"))!=null?s:t.loose;const y=(l=e.assumption("superIsCallableConstructor"))!=null?l:t.loose;const g=(p=e.assumption("noClassCalls"))!=null?p:t.loose;const h=Symbol();return{name:"transform-classes",visitor:{ExportDefaultDeclaration(e){if(!e.get("declaration").isClassDeclaration())return;(0,o.default)(e)},ClassDeclaration(e){const{node:t}=e;const r=t.id||e.scope.generateUidIdentifier("class");e.replaceWith(i.types.variableDeclaration("let",[i.types.variableDeclarator(r,i.types.toExpression(t))]))},ClassExpression(e,t){const{node:r}=e;if(r[h])return;const s=(0,n.default)(e);if(s&&s!==r){e.replaceWith(s);return}r[h]=true;e.replaceWith((0,c.default)(e,t.file,u,f,{setClassMethods:d,constantSuper:m,superIsCallableConstructor:y,noClassCalls:g}));if(e.isCallExpression()){(0,a.default)(e);const t=e.get("callee");if(t.isArrowFunctionExpression()){t.arrowFunctionToExpression()}}}}}}));t["default"]=p},7677:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=addCreateSuperHelper;var s=r(8304);const a=new WeakMap;function addCreateSuperHelper(e){if(a.has(e)){return(s.types.cloneNode||s.types.clone)(a.get(e))}try{return e.addHelper("createSuper")}catch(e){}const t=e.scope.generateUidIdentifier("createSuper");a.set(e,t);const r=n({CREATE_SUPER:t,GET_PROTOTYPE_OF:e.addHelper("getPrototypeOf"),POSSIBLE_CONSTRUCTOR_RETURN:e.addHelper("possibleConstructorReturn")});e.path.unshiftContainer("body",[r]);e.scope.registerDeclaration(e.path.get("body.0"));return s.types.cloneNode(t)}const n=s.template.statement` + `)}else{var c;const t=getWeakSetId(i,o,o,(c=o.node.id)==null?void 0:c.name,injectInitialization);e.replaceWith(r.expression.ast`${t}.has(${e.node.right})`)}}else{const t=getWeakSetId(l,o,n,n.node.key.id.name,injectToFieldInit);e.replaceWith(r.expression.ast`${t}.has(${e.node.right})`)}}}}}));t["default"]=i},6092:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6550);var a=r(558);var n=(0,a.declare)(((e,t)=>{e.assertVersion(7);const{useUnicodeFlag:r=true}=t;if(typeof r!=="boolean"){throw new Error(".useUnicodeFlag must be a boolean, or undefined")}return(0,s.createRegExpFeaturePlugin)({name:"proposal-unicode-property-regex",feature:"unicodePropertyEscape",options:{useUnicodeFlag:r}})}));t["default"]=n},1079:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(631);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-async-generators",manipulateOptions(e,t){t.plugins.push("asyncGenerators")}}}));t["default"]=a},631:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,r,s)=>{if(!t.assertVersion){t=Object.assign(copyApiObject(t),{assertVersion(e){throwVersionError(e,t.version)}})}return e(t,r||{},s)}}function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},6762:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8853);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-bigint",manipulateOptions(e,t){t.plugins.push("bigInt")}}}));t["default"]=a},8853:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,r,s)=>{if(!t.assertVersion){t=Object.assign(copyApiObject(t),{assertVersion(e){throwVersionError(e,t.version)}})}return e(t,r||{},s)}}function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},947:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(93);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-class-properties",manipulateOptions(e,t){t.plugins.push("classProperties","classPrivateProperties","classPrivateMethods")}}}));t["default"]=a},93:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8142:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-class-static-block",manipulateOptions(e,t){t.plugins.push("classStaticBlock")}}}));t["default"]=a},5163:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(2083);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-dynamic-import",manipulateOptions(e,t){t.plugins.push("dynamicImport")}}}));t["default"]=a},2083:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,r,s)=>{if(!t.assertVersion){t=Object.assign(copyApiObject(t),{assertVersion(e){throwVersionError(e,t.version)}})}return e(t,r||{},s)}}function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8356:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9692);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-import-assertions",manipulateOptions(e,t){t.plugins.push(["importAssertions"])}}}));t["default"]=a},9692:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7445:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-private-property-in-object",manipulateOptions(e,t){t.plugins.push("privateIn")}}}));t["default"]=a},6050:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);function removePlugin(e,t){const r=[];e.forEach(((e,s)=>{const a=Array.isArray(e)?e[0]:e;if(a===t){r.unshift(s)}}));for(const t of r){e.splice(t,1)}}var a=(0,s.declare)(((e,{isTSX:t})=>{e.assertVersion(7);return{name:"syntax-typescript",manipulateOptions(e,r){const{plugins:s}=r;removePlugin(s,"flow");removePlugin(s,"jsx");r.plugins.push("typescript","classProperties");{r.plugins.push("objectRestSpread")}if(t){r.plugins.push("jsx")}}}}));t["default"]=a},6408:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(2155);var n=r(550);var o=r(7058);var i=r(8304);var l=r(5548);var c=r(4546);const getBuiltinClasses=e=>Object.keys(l[e]).filter((e=>/^[A-Z]/.test(e)));const u=new Set([...getBuiltinClasses("builtin"),...getBuiltinClasses("browser")]);var p=(0,s.declare)(((e,t)=>{var r,s,l,p;e.assertVersion(7);const{loose:d}=t;const f=(r=e.assumption("setClassMethods"))!=null?r:t.loose;const m=(s=e.assumption("constantSuper"))!=null?s:t.loose;const y=(l=e.assumption("superIsCallableConstructor"))!=null?l:t.loose;const g=(p=e.assumption("noClassCalls"))!=null?p:t.loose;const h=Symbol();return{name:"transform-classes",visitor:{ExportDefaultDeclaration(e){if(!e.get("declaration").isClassDeclaration())return;(0,o.default)(e)},ClassDeclaration(e){const{node:t}=e;const r=t.id||e.scope.generateUidIdentifier("class");e.replaceWith(i.types.variableDeclaration("let",[i.types.variableDeclarator(r,i.types.toExpression(t))]))},ClassExpression(e,t){const{node:r}=e;if(r[h])return;const s=(0,n.default)(e);if(s&&s!==r){e.replaceWith(s);return}r[h]=true;e.replaceWith((0,c.default)(e,t.file,u,d,{setClassMethods:f,constantSuper:m,superIsCallableConstructor:y,noClassCalls:g}));if(e.isCallExpression()){(0,a.default)(e);const t=e.get("callee");if(t.isArrowFunctionExpression()){t.arrowFunctionToExpression()}}}}}}));t["default"]=p},7677:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=addCreateSuperHelper;var s=r(8304);const a=new WeakMap;function addCreateSuperHelper(e){if(a.has(e)){return(s.types.cloneNode||s.types.clone)(a.get(e))}try{return e.addHelper("createSuper")}catch(e){}const t=e.scope.generateUidIdentifier("createSuper");a.set(e,t);const r=n({CREATE_SUPER:t,GET_PROTOTYPE_OF:e.addHelper("getPrototypeOf"),POSSIBLE_CONSTRUCTOR_RETURN:e.addHelper("possibleConstructorReturn")});e.path.unshiftContainer("body",[r]);e.scope.registerDeclaration(e.path.get("body.0"));return s.types.cloneNode(t)}const n=s.template.statement` function CREATE_SUPER(Derived) { function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; @@ -358,30 +433,30 @@ return POSSIBLE_CONSTRUCTOR_RETURN(this, result); } } -`},4546:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transformClass;var s=r(550);var a=r(6833);var n=r(6721);var o=r(8304);var i=r(2155);var l=r(7677);function buildConstructor(e,t,r){const s=o.types.functionDeclaration(o.types.cloneNode(e),[],t);o.types.inherits(s,r);return s}function transformClass(e,t,r,c,u){const p={parent:undefined,scope:undefined,node:undefined,path:undefined,file:undefined,classId:undefined,classRef:undefined,superFnId:undefined,superName:undefined,superReturns:[],isDerived:false,extendsNative:false,construct:undefined,constructorBody:undefined,userConstructor:undefined,userConstructorPath:undefined,hasConstructor:false,staticPropBody:[],body:[],superThises:[],pushedConstructor:false,pushedInherits:false,protoAlias:null,isLoose:false,dynamicKeys:new Map,methods:{instance:{hasComputed:false,list:[],map:new Map},static:{hasComputed:false,list:[],map:new Map}}};const setState=e=>{Object.assign(p,e)};const f=o.traverse.visitors.merge([a.environmentVisitor,{ThisExpression(e){p.superThises.push(e)}}]);function maybeCreateConstructor(){let e=false;const t=p.path.get("body.body");for(const r of t){e=r.equals("kind","constructor");if(e)break}if(e)return;let r,s;if(p.isDerived){const e=o.template.expression.ast` +`},4546:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transformClass;var s=r(550);var a=r(6833);var n=r(6721);var o=r(8304);var i=r(2155);var l=r(7677);function buildConstructor(e,t,r){const s=o.types.functionDeclaration(o.types.cloneNode(e),[],t);o.types.inherits(s,r);return s}function transformClass(e,t,r,c,u){const p={parent:undefined,scope:undefined,node:undefined,path:undefined,file:undefined,classId:undefined,classRef:undefined,superFnId:undefined,superName:undefined,superReturns:[],isDerived:false,extendsNative:false,construct:undefined,constructorBody:undefined,userConstructor:undefined,userConstructorPath:undefined,hasConstructor:false,staticPropBody:[],body:[],superThises:[],pushedConstructor:false,pushedInherits:false,protoAlias:null,isLoose:false,dynamicKeys:new Map,methods:{instance:{hasComputed:false,list:[],map:new Map},static:{hasComputed:false,list:[],map:new Map}}};const setState=e=>{Object.assign(p,e)};const d=o.traverse.visitors.merge([a.environmentVisitor,{ThisExpression(e){p.superThises.push(e)}}]);function maybeCreateConstructor(){let e=false;const t=p.path.get("body.body");for(const r of t){e=r.equals("kind","constructor");if(e)break}if(e)return;let r,s;if(p.isDerived){const e=o.template.expression.ast` (function () { super(...arguments); }) - `;r=e.params;s=e.body}else{r=[];s=o.types.blockStatement([])}p.path.get("body").unshiftContainer("body",o.types.classMethod("constructor",o.types.identifier("constructor"),r,s))}function buildBody(){maybeCreateConstructor();pushBody();verifyConstructor();if(p.userConstructor){const{constructorBody:e,userConstructor:t,construct:r}=p;e.body=e.body.concat(t.body.body);o.types.inherits(r,t);o.types.inherits(e,t.body)}pushDescriptors()}function pushBody(){const e=p.path.get("body.body");for(const t of e){const e=t.node;if(t.isClassProperty()){throw t.buildCodeFrameError("Missing class properties transform.")}if(e.decorators){throw t.buildCodeFrameError("Method has decorators, put the decorator plugin before the classes one.")}if(o.types.isClassMethod(e)){const r=e.kind==="constructor";const s=new a.default({methodPath:t,objectRef:p.classRef,superRef:p.superName,constantSuper:u.constantSuper,file:p.file,refToPreserve:p.classRef});s.replace();const n=[];t.traverse(o.traverse.visitors.merge([a.environmentVisitor,{ReturnStatement(e){if(!e.getFunctionParent().isArrowFunctionExpression()){n.push(e)}}}]));if(r){pushConstructor(n,e,t)}else{pushMethod(e,t)}}}}function pushDescriptors(){pushInheritsToBody();const{body:e}=p;const t={instance:null,static:null};for(const e of["static","instance"]){if(p.methods[e].list.length){t[e]=p.methods[e].list.map((e=>{const t=o.types.objectExpression([o.types.objectProperty(o.types.identifier("key"),e.key)]);for(const r of["get","set","value"]){if(e[r]!=null){t.properties.push(o.types.objectProperty(o.types.identifier(r),e[r]))}}return t}))}}if(t.instance||t.static){let r=[o.types.cloneNode(p.classRef),t.instance?o.types.arrayExpression(t.instance):o.types.nullLiteral(),t.static?o.types.arrayExpression(t.static):o.types.nullLiteral()];let s=0;for(let e=0;eo.types.cloneNode(t);return t};for(const e of p.superThises){const{node:t,parentPath:r}=e;if(r.isMemberExpression({object:t})){e.replaceWith(thisRef());continue}e.replaceWith(o.types.callExpression(p.file.addHelper("assertThisInitialized"),[thisRef()]))}const r=new Set;e.traverse(o.traverse.visitors.merge([a.environmentVisitor,{Super(e){const{node:t,parentPath:s}=e;if(s.isCallExpression({callee:t})){r.add(s)}}}]));let s=!!r.size;for(const a of r){wrapSuperCall(a,p.superName,thisRef,t);if(s){a.find((function(t){if(t===e){return true}if(t.isLoop()||t.isConditional()||t.isArrowFunctionExpression()){s=false;return true}}))}}let n;if(p.isLoose){n=e=>{const t=o.types.callExpression(p.file.addHelper("assertThisInitialized"),[thisRef()]);return e?o.types.logicalExpression("||",e,t):t}}else{n=e=>o.types.callExpression(p.file.addHelper("possibleConstructorReturn"),[thisRef()].concat(e||[]))}const i=t.get("body");if(!i.length||!i.pop().isReturnStatement()){t.pushContainer("body",o.types.returnStatement(s?thisRef():n()))}for(const e of p.superReturns){e.get("argument").replaceWith(n(e.node.argument))}}function pushMethod(e,t){const r=t?t.scope:p.scope;if(e.kind==="method"){if(processMethod(e,r))return}const a=e.static?"static":"instance";const n=p.methods[a];const i=e.kind==="method"?"value":e.kind;const l=o.types.isNumericLiteral(e.key)||o.types.isBigIntLiteral(e.key)?o.types.stringLiteral(String(e.key.value)):o.types.toComputedKey(e);let c=o.types.toExpression(e);if(o.types.isStringLiteral(l)){if(e.kind==="method"){c=(0,s.default)({id:l,node:e,scope:r})}}else{n.hasComputed=true}let u;if(!n.hasComputed&&n.map.has(l.value)){u=n.map.get(l.value);u[i]=c;if(i==="value"){u.get=null;u.set=null}else{u.value=null}}else{u={key:l,[i]:c};n.list.push(u);if(!n.hasComputed){n.map.set(l.value,u)}}}function processMethod(e,t){if(u.setClassMethods&&!e.decorators){let{classRef:r}=p;if(!e.static){insertProtoAliasOnce();r=p.protoAlias}const a=o.types.memberExpression(o.types.cloneNode(r),e.key,e.computed||o.types.isLiteral(e.key));let n=o.types.functionExpression(null,e.params,e.body,e.generator,e.async);o.types.inherits(n,e);const i=o.types.toComputedKey(e,e.key);if(o.types.isStringLiteral(i)){n=(0,s.default)({node:n,id:i,scope:t})}const l=o.types.expressionStatement(o.types.assignmentExpression("=",a,n));o.types.inheritsComments(l,e);p.body.push(l);return true}return false}function insertProtoAliasOnce(){if(p.protoAlias===null){setState({protoAlias:p.scope.generateUidIdentifier("proto")});const e=o.types.memberExpression(p.classRef,o.types.identifier("prototype"));const t=o.types.variableDeclaration("var",[o.types.variableDeclarator(p.protoAlias,e)]);p.body.push(t)}}function pushConstructor(e,t,r){setState({userConstructorPath:r,userConstructor:t,hasConstructor:true,superReturns:e});const{construct:s}=p;o.types.inheritsComments(s,t);s.params=t.params;o.types.inherits(s.body,t.body);s.body.directives=t.body.directives;pushConstructorToBody()}function pushConstructorToBody(){if(p.pushedConstructor)return;p.pushedConstructor=true;if(p.hasInstanceDescriptors||p.hasStaticDescriptors){pushDescriptors()}p.body.push(p.construct);pushInheritsToBody()}function pushInheritsToBody(){if(!p.isDerived||p.pushedInherits)return;const t=e.scope.generateUidIdentifier("super");setState({pushedInherits:true,superFnId:t});if(!u.superIsCallableConstructor){p.body.unshift(o.types.variableDeclaration("var",[o.types.variableDeclarator(t,o.types.callExpression((0,l.default)(p.file),[o.types.cloneNode(p.classRef)]))]))}p.body.unshift(o.types.expressionStatement(o.types.callExpression(p.file.addHelper(p.isLoose?"inheritsLoose":"inherits"),[o.types.cloneNode(p.classRef),o.types.cloneNode(p.superName)])))}function extractDynamicKeys(){const{dynamicKeys:e,node:t,scope:r}=p;for(const s of t.body.body){if(!o.types.isClassMethod(s)||!s.computed)continue;if(r.isPure(s.key,true))continue;const t=r.generateUidIdentifierBasedOnNode(s.key);e.set(t.name,s.key);s.key=t}}function setupClosureParamsArgs(){const{superName:e,dynamicKeys:t}=p;const r=[];const s=[];if(p.isDerived){let t=o.types.cloneNode(e);if(p.extendsNative){t=o.types.callExpression(p.file.addHelper("wrapNativeSuper"),[t]);(0,i.default)(t)}const a=p.scope.generateUidIdentifierBasedOnNode(e);r.push(a);s.push(t);setState({superName:o.types.cloneNode(a)})}for(const[e,a]of t){r.push(o.types.identifier(e));s.push(a)}return{closureParams:r,closureArgs:s}}function classTransformer(e,t,r,s){setState({parent:e.parent,scope:e.scope,node:e.node,path:e,file:t,isLoose:s});setState({classId:p.node.id,classRef:p.node.id?o.types.identifier(p.node.id.name):p.scope.generateUidIdentifier("class"),superName:p.node.superClass,isDerived:!!p.node.superClass,constructorBody:o.types.blockStatement([])});setState({extendsNative:p.isDerived&&r.has(p.superName.name)&&!p.scope.hasBinding(p.superName.name,true)});const{classRef:a,node:n,constructorBody:i}=p;setState({construct:buildConstructor(a,i,n)});extractDynamicKeys();let{body:l}=p;const{closureParams:c,closureArgs:f}=setupClosureParamsArgs();buildBody();if(!u.noClassCalls){i.body.unshift(o.types.expressionStatement(o.types.callExpression(p.file.addHelper("classCallCheck"),[o.types.thisExpression(),o.types.cloneNode(p.classRef)])))}l=l.concat(p.staticPropBody.map((e=>e(o.types.cloneNode(p.classRef)))));const d=e.isInStrictMode();let m=p.classId&&l.length===1;if(m&&!d){for(const e of p.construct.params){if(!o.types.isIdentifier(e)){m=false;break}}}const y=m?l[0].body.directives:[];if(!d){y.push(o.types.directive(o.types.directiveLiteral("use strict")))}if(m){return o.types.toExpression(l[0])}l.push(o.types.returnStatement(o.types.cloneNode(p.classRef)));const g=o.types.arrowFunctionExpression(c,o.types.blockStatement(l,y));return o.types.callExpression(g,f)}return classTransformer(e,t,r,c)}},5157:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(8304);var n=(0,s.declare)(((e,t)=>{var r,s,n;e.assertVersion(7);const{useBuiltIns:o=false}=t;const i=(r=e.assumption("iterableIsArray"))!=null?r:t.loose;const l=(s=t.allowArrayLike)!=null?s:e.assumption("arrayLikeIsIterable");const c=(n=e.assumption("objectRestNoSymbols"))!=null?n:t.loose;function getExtendsHelper(e){return o?a.types.memberExpression(a.types.identifier("Object"),a.types.identifier("assign")):e.addHelper("extends")}function variableDeclarationHasPattern(e){for(const t of e.declarations){if(a.types.isPattern(t.id)){return true}}return false}function hasRest(e){for(const t of e.elements){if(a.types.isRestElement(t)){return true}}return false}function hasObjectRest(e){for(const t of e.properties){if(a.types.isRestElement(t)){return true}}return false}const u={};const arrayUnpackVisitor=(e,t,r)=>{if(!t.length){return}if(a.types.isIdentifier(e)&&a.types.isReferenced(e,t[t.length-1])&&r.bindings[e.name]){r.deopt=true;throw u}};class DestructuringTransformer{constructor(e){this.blockHoist=e.blockHoist;this.operator=e.operator;this.arrays={};this.nodes=e.nodes||[];this.scope=e.scope;this.kind=e.kind;this.iterableIsArray=e.iterableIsArray;this.arrayLikeIsIterable=e.arrayLikeIsIterable;this.addHelper=e.addHelper}buildVariableAssignment(e,t){let r=this.operator;if(a.types.isMemberExpression(e))r="=";let s;if(r){s=a.types.expressionStatement(a.types.assignmentExpression(r,e,a.types.cloneNode(t)||this.scope.buildUndefinedNode()))}else{s=a.types.variableDeclaration(this.kind,[a.types.variableDeclarator(e,a.types.cloneNode(t))])}s._blockHoist=this.blockHoist;return s}buildVariableDeclaration(e,t){const r=a.types.variableDeclaration("var",[a.types.variableDeclarator(a.types.cloneNode(e),a.types.cloneNode(t))]);r._blockHoist=this.blockHoist;return r}push(e,t){const r=a.types.cloneNode(t);if(a.types.isObjectPattern(e)){this.pushObjectPattern(e,r)}else if(a.types.isArrayPattern(e)){this.pushArrayPattern(e,r)}else if(a.types.isAssignmentPattern(e)){this.pushAssignmentPattern(e,r)}else{this.nodes.push(this.buildVariableAssignment(e,r))}}toArray(e,t){if(this.iterableIsArray||a.types.isIdentifier(e)&&this.arrays[e.name]){return e}else{return this.scope.toArray(e,t,this.arrayLikeIsIterable)}}pushAssignmentPattern({left:e,right:t},r){const s=this.scope.generateUidIdentifierBasedOnNode(r);this.nodes.push(this.buildVariableDeclaration(s,r));const n=a.types.conditionalExpression(a.types.binaryExpression("===",a.types.cloneNode(s),this.scope.buildUndefinedNode()),t,a.types.cloneNode(s));if(a.types.isPattern(e)){let t;let r;if(this.kind==="const"||this.kind==="let"){t=this.scope.generateUidIdentifier(s.name);r=this.buildVariableDeclaration(t,n)}else{t=s;r=a.types.expressionStatement(a.types.assignmentExpression("=",a.types.cloneNode(s),n))}this.nodes.push(r);this.push(e,t)}else{this.nodes.push(this.buildVariableAssignment(e,n))}}pushObjectRest(e,t,r,s){const n=[];let o=true;let i=false;for(let t=0;t=s)break;if(a.types.isRestElement(r))continue;const l=r.key;if(a.types.isIdentifier(l)&&!r.computed){n.push(a.types.stringLiteral(l.name))}else if(a.types.isTemplateLiteral(l)){n.push(a.types.cloneNode(l));i=true}else if(a.types.isLiteral(l)){n.push(a.types.stringLiteral(String(l.value)))}else{n.push(a.types.cloneNode(l));o=false}}let l;if(n.length===0){l=a.types.callExpression(getExtendsHelper(this),[a.types.objectExpression([]),a.types.cloneNode(t)])}else{let e=a.types.arrayExpression(n);if(!o){e=a.types.callExpression(a.types.memberExpression(e,a.types.identifier("map")),[this.addHelper("toPropertyKey")])}else if(!i&&!a.types.isProgram(this.scope.block)){const t=this.scope.path.findParent((e=>e.isProgram()));const r=this.scope.generateUidIdentifier("excluded");t.scope.push({id:r,init:e,kind:"const"});e=a.types.cloneNode(r)}l=a.types.callExpression(this.addHelper(`objectWithoutProperties${c?"Loose":""}`),[a.types.cloneNode(t),e])}this.nodes.push(this.buildVariableAssignment(r.argument,l))}pushObjectProperty(e,t){if(a.types.isLiteral(e.key))e.computed=true;const r=e.value;const s=a.types.memberExpression(a.types.cloneNode(t),e.key,e.computed);if(a.types.isPattern(r)){this.push(r,s)}else{this.nodes.push(this.buildVariableAssignment(r,s))}}pushObjectPattern(e,t){if(!e.properties.length){this.nodes.push(a.types.expressionStatement(a.types.callExpression(this.addHelper("objectDestructuringEmpty"),[t])))}if(e.properties.length>1&&!this.scope.isStatic(t)){const e=this.scope.generateUidIdentifierBasedOnNode(t);this.nodes.push(this.buildVariableDeclaration(e,t));t=e}if(hasObjectRest(e)){let t;for(let r=0;rt.elements.length)return;if(e.elements.lengththis.addHelper(e)});u.init(n,o);e.ensureBlock();const p=t.body;p.body=c.concat(p.body)},CatchClause({node:e,scope:t}){const r=e.param;if(!a.types.isPattern(r))return;const s=t.generateUidIdentifier("ref");e.param=s;const n=[];const o=new DestructuringTransformer({kind:"let",scope:t,nodes:n,iterableIsArray:i,arrayLikeIsIterable:l,addHelper:e=>this.addHelper(e)});o.init(r,s);e.body.body=n.concat(e.body.body)},AssignmentExpression(e){const{node:t,scope:r}=e;if(!a.types.isPattern(t.left))return;const s=[];const n=new DestructuringTransformer({operator:t.operator,scope:r,nodes:s,iterableIsArray:i,arrayLikeIsIterable:l,addHelper:e=>this.addHelper(e)});let o;if(e.isCompletionRecord()||!e.parentPath.isExpressionStatement()){o=r.generateUidIdentifierBasedOnNode(t.right,"ref");s.push(a.types.variableDeclaration("var",[a.types.variableDeclarator(o,t.right)]));if(a.types.isArrayExpression(t.right)){n.arrays[o.name]=true}}n.init(t.left,o||t.right);if(o){if(e.parentPath.isArrowFunctionExpression()){e.replaceWith(a.types.blockStatement([]));s.push(a.types.returnStatement(a.types.cloneNode(o)))}else{s.push(a.types.expressionStatement(a.types.cloneNode(o)))}}e.replaceWithMultiple(s);e.scope.crawl()},VariableDeclaration(e){const{node:t,scope:r,parent:s}=e;if(a.types.isForXStatement(s))return;if(!s||!e.container)return;if(!variableDeclarationHasPattern(t))return;const n=t.kind;const o=t.loc;const c=[];let u;for(let e=0;ethis.addHelper(e)});if(a.types.isPattern(n)){o.init(n,s);if(+e!==t.declarations.length-1){a.types.inherits(c[c.length-1],u)}}else{c.push(a.types.inherits(o.buildVariableAssignment(u.id,a.types.cloneNode(u.init)),u))}}let p=null;const f=[];for(const e of c){if(p!==null&&a.types.isVariableDeclaration(e)){p.declarations.push(...e.declarations)}else{e.kind=n;if(!e.loc){e.loc=o}f.push(e);p=a.types.isVariableDeclaration(e)?e:null}}for(const e of f){if(!e.declarations)continue;for(const t of e.declarations){const{name:s}=t.id;if(r.bindings[s]){r.bindings[s].kind=e.kind}}}if(f.length===1){e.replaceWith(f[0])}else{e.replaceWithMultiple(f)}}}}}));t["default"]=n},5843:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6550);var a=r(558);var n=(0,a.declare)((e=>{e.assertVersion(7);return(0,s.createRegExpFeaturePlugin)({name:"transform-dotall-regex",feature:"dotAllFlag"})}));t["default"]=n},8447:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(6550);function _default(e,t){const{runtime:r=true}=t;if(typeof r!=="boolean"){throw new Error("The 'runtime' option must be boolean")}return(0,s.createRegExpFeaturePlugin)({name:"transform-named-capturing-groups-regex",feature:"namedCaptureGroups",options:{runtime:r}})}},5628:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9522);var a=s.default;t["default"]=a},2228:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(1017);var a=r(8188);function _default(e,t,r){if(r===false)return e;return resolveAbsoluteRuntime(e,s.resolve(t,r===true?".":r))}function resolveAbsoluteRuntime(e,t){try{return s.dirname((((e,t)=>(e=e.split("."),t=t.split("."),+e[0]>+t[0]||e[0]==t[0]&&+e[1]>=+t[1]))(process.versions.node,"8.9")?require.resolve:(e,{paths:[t]},s=r(8188))=>{let a=s._findPath(e,s._nodeModulePaths(t).concat(t));if(a)return a;a=new Error(`Cannot resolve module '${e}'`);a.code="MODULE_NOT_FOUND";throw a})(`${e}/package.json`,{paths:[t]})).replace(/\\/g,"/")}catch(r){if(r.code!=="MODULE_NOT_FOUND")throw r;throw Object.assign(new Error(`Failed to resolve "${e}" relative to "${t}"`),{code:"BABEL_RUNTIME_NOT_FOUND",runtime:e,dirname:t})}}},3286:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasMinVersion=hasMinVersion;var s=r(7849);function hasMinVersion(e,t){if(!t)return true;if(s.valid(t))t=`^${t}`;return!s.intersects(`<${e}`,t)&&!s.intersects(`>=8.0.0`,t)}},4722:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(9115);var n=r(8304);var o=r(3286);var i=r(2228);var l=r(9897);var c=r(5825);var u=r(7973);const p=l.default||l;const f=c.default||c;const d=u.default||u;const m="#__secret_key__@babel/runtime__compatibility";function supportsStaticESM(e){return!!(e!=null&&e.supportsStaticESM)}var y=(0,s.declare)(((e,t,r)=>{e.assertVersion(7);const{corejs:s,helpers:l=true,regenerator:c=true,useESModules:u=false,version:y="7.0.0-beta.0",absoluteRuntime:g=false}=t;let h=false;let b;if(typeof s==="object"&&s!==null){b=s.version;h=Boolean(s.proposals)}else{b=s}const x=b?Number(b):false;if(![false,2,3].includes(x)){throw new Error(`The \`core-js\` version must be false, 2 or 3, but got ${JSON.stringify(b)}.`)}if(h&&(!x||x<3)){throw new Error("The 'proposals' option is only supported when using 'corejs: 3'")}if(typeof c!=="boolean"){throw new Error("The 'regenerator' option must be undefined, or a boolean.")}if(typeof l!=="boolean"){throw new Error("The 'helpers' option must be undefined, or a boolean.")}if(typeof u!=="boolean"&&u!=="auto"){throw new Error("The 'useESModules' option must be undefined, or a boolean, or 'auto'.")}if(typeof g!=="boolean"&&typeof g!=="string"){throw new Error("The 'absoluteRuntime' option must be undefined, a boolean, or a string.")}if(typeof y!=="string"){throw new Error(`The 'version' option must be a version string.`)}const v="7.13.0";const E=(0,o.hasMinVersion)(v,y);function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}if(has(t,"useBuiltIns")){if(t.useBuiltIns){throw new Error("The 'useBuiltIns' option has been removed. The @babel/runtime "+"module now uses builtins by default.")}else{throw new Error("The 'useBuiltIns' option has been removed. Use the 'corejs'"+"option to polyfill with `core-js` via @babel/runtime.")}}if(has(t,"polyfill")){if(t.polyfill===false){throw new Error("The 'polyfill' option has been removed. The @babel/runtime "+"module now skips polyfilling by default.")}else{throw new Error("The 'polyfill' option has been removed. Use the 'corejs'"+"option to polyfill with `core-js` via @babel/runtime.")}}if(has(t,"moduleName")){throw new Error("The 'moduleName' option has been removed. @babel/transform-runtime "+"no longer supports arbitrary runtimes. If you were using this to "+"set an absolute path for Babel's standard runtimes, please use the "+"'absoluteRuntime' option.")}const j=u==="auto"?e.caller(supportsStaticESM):u;const w=x===2;const _=x===3;const S=_?"@babel/runtime-corejs3":w?"@babel/runtime-corejs2":"@babel/runtime";const k=["interopRequireWildcard","interopRequireDefault"];const O=(0,i.default)(S,r,g);function createCorejsPlgin(e,t,r){return(s,a,n)=>Object.assign({},e(s,t,n),{inherits:r})}function createRegeneratorPlugin(e){if(!c)return undefined;return(t,r,s)=>d(t,e,s)}const I=g?".js":"";return{name:"transform-runtime",inherits:w?createCorejsPlgin(p,{method:"usage-pure",[m]:{runtimeVersion:y,useBabelRuntime:O,ext:I}},createRegeneratorPlugin({method:"usage-pure",[m]:{useBabelRuntime:O}})):_?createCorejsPlgin(f,{method:"usage-pure",version:3,proposals:h,[m]:{useBabelRuntime:O,ext:I}},createRegeneratorPlugin({method:"usage-pure",[m]:{useBabelRuntime:O}})):createRegeneratorPlugin({method:"usage-pure",[m]:{useBabelRuntime:O}}),pre(e){if(!l)return;e.set("helperGenerator",(t=>{if(e.availableHelper&&!e.availableHelper(t,y)){return}const r=k.indexOf(t)!==-1;const s=r&&!(0,a.isModule)(e.path)?4:undefined;const n=j&&e.path.node.sourceType==="module"?"helpers/esm":"helpers";return addDefaultImport(`${O}/${n}/${t}`,t,s,true)}));const t=new Map;function addDefaultImport(r,s,o,i=false){const l=(0,a.isModule)(e.path);const c=`${r}:${s}:${l||""}`;let u=t.get(c);if(u){u=n.types.cloneNode(u)}else{u=(0,a.addDefault)(e.path,r,{importedInterop:i&&E?"compiled":"uncompiled",nameHint:s,blockHoist:o});t.set(c,u)}return u}}}}));t["default"]=y},749:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transpileConstEnum;var s=r(3803);function transpileConstEnum(e,t){const{name:r}=e.node.id;const a=e.parentPath.isExportNamedDeclaration();let n=a;if(!n&&t.isProgram(e.parent)){n=e.parent.body.some((e=>t.isExportNamedDeclaration(e)&&!e.source&&e.specifiers.some((e=>t.isExportSpecifier(e)&&e.local.name===r))))}const o=(0,s.translateEnumValues)(e,t);if(n){const s=t.objectExpression(o.map((([e,r])=>t.objectProperty(t.isValidIdentifier(e)?t.identifier(e):t.stringLiteral(e),r))));if(e.scope.hasOwnBinding(r)){(a?e.parentPath:e).replaceWith(t.expressionStatement(t.callExpression(t.memberExpression(t.identifier("Object"),t.identifier("assign")),[e.node.id,s])))}else{e.replaceWith(t.variableDeclaration("var",[t.variableDeclarator(e.node.id,s)]));e.scope.registerDeclaration(e)}return}const i=new Map(o);e.scope.path.traverse({Scope(e){if(e.scope.hasOwnBinding(r))e.skip()},MemberExpression(e){if(!t.isIdentifier(e.node.object,{name:r}))return;let s;if(e.node.computed){if(t.isStringLiteral(e.node.property)){s=e.node.property.value}else{return}}else if(t.isIdentifier(e.node.property)){s=e.node.property.name}else{return}if(!i.has(s))return;e.replaceWith(t.cloneNode(i.get(s)))}});e.remove()}},3803:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transpileEnum;t.translateEnumValues=translateEnumValues;var s=r(9491);var a=r(8304);function transpileEnum(e,t){const{node:r}=e;if(r.declare){e.remove();return}const s=r.id.name;const a=enumFill(e,t,r.id);switch(e.parent.type){case"BlockStatement":case"ExportNamedDeclaration":case"Program":{e.insertAfter(a);if(seen(e.parentPath)){e.remove()}else{const s=t.isProgram(e.parent);e.scope.registerDeclaration(e.replaceWith(makeVar(r.id,t,s?"var":"let"))[0])}break}default:throw new Error(`Unexpected enum parent '${e.parent.type}`)}function seen(e){if(e.isExportDeclaration()){return seen(e.parentPath)}if(e.getData(s)){return true}else{e.setData(s,true);return false}}}function makeVar(e,t,r){return t.variableDeclaration(r,[t.variableDeclarator(e)])}const n=(0,a.template)(`\n (function (ID) {\n ASSIGNMENTS;\n })(ID || (ID = {}));\n`);const o=(0,a.template)(`\n ENUM["NAME"] = VALUE;\n`);const i=(0,a.template)(`\n ENUM[ENUM["NAME"] = VALUE] = "NAME";\n`);const buildEnumMember=(e,t)=>(e?o:i)(t);function enumFill(e,t,r){const s=translateEnumValues(e,t);const a=s.map((([e,s])=>buildEnumMember(t.isStringLiteral(s),{ENUM:t.cloneNode(r),NAME:e,VALUE:s})));return n({ID:t.cloneNode(r),ASSIGNMENTS:a})}function translateEnumValues(e,t){const r=Object.create(null);let a=-1;return e.node.members.map((n=>{const o=t.isIdentifier(n.id)?n.id.name:n.id.value;const i=n.initializer;let l;if(i){const e=evaluate(i,r);if(e!==undefined){r[o]=e;if(typeof e==="number"){l=t.numericLiteral(e);a=e}else{s(typeof e==="string");l=t.stringLiteral(e);a=undefined}}else{l=i;a=undefined}}else{if(a!==undefined){a++;l=t.numericLiteral(a);r[o]=a}else{throw e.buildCodeFrameError("Enum member must have initializer.")}}return[o,l]}))}function evaluate(e,t){return evalConstant(e);function evalConstant(e){switch(e.type){case"StringLiteral":return e.value;case"UnaryExpression":return evalUnaryExpression(e);case"BinaryExpression":return evalBinaryExpression(e);case"NumericLiteral":return e.value;case"ParenthesizedExpression":return evalConstant(e.expression);case"Identifier":return t[e.name];case"TemplateLiteral":if(e.quasis.length===1){return e.quasis[0].value.cooked}default:return undefined}}function evalUnaryExpression({argument:e,operator:t}){const r=evalConstant(e);if(r===undefined){return undefined}switch(t){case"+":return r;case"-":return-r;case"~":return~r;default:return undefined}}function evalBinaryExpression(e){const t=evalConstant(e.left);if(t===undefined){return undefined}const r=evalConstant(e.right);if(r===undefined){return undefined}switch(e.operator){case"|":return t|r;case"&":return t&r;case">>":return t>>r;case">>>":return t>>>r;case"<<":return t<{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(6050);var n=r(8304);var o=r(738);var i=r(749);var l=r(3803);var c=r(8820);function isInType(e){switch(e.parent.type){case"TSTypeReference":case"TSQualifiedName":case"TSExpressionWithTypeArguments":case"TSTypeQuery":return true;case"ExportSpecifier":return e.parentPath.parent.exportKind==="type";default:return false}}const u=new WeakMap;const p=new WeakMap;const f=new WeakSet;function isGlobalType(e,t){const r=e.find((e=>e.isProgram())).node;if(e.scope.hasOwnBinding(t))return false;if(u.get(r).has(t))return true;console.warn(`The exported identifier "${t}" is not declared in Babel's scope tracker\n`+`as a JavaScript value binding, and "@babel/plugin-transform-typescript"\n`+`never encountered it as a TypeScript type declaration.\n`+`It will be treated as a JavaScript value.\n\n`+`This problem is likely caused by another plugin injecting\n`+`"${t}" without registering it in the scope tracker. If you are the author\n`+` of that plugin, please use "scope.registerDeclaration(declarationPath)".`);return false}function registerGlobalType(e,t){u.get(e.path.node).add(t)}var d=(0,s.declare)(((e,t)=>{e.assertVersion(7);const r=/\*?\s*@jsx((?:Frag)?)\s+([^\s]+)/;const{allowNamespaces:s=true,jsxPragma:d="React.createElement",jsxPragmaFrag:m="React.Fragment",onlyRemoveTypeImports:y=false,optimizeConstEnums:g=false}=t;{var{allowDeclareFields:h=false}=t}const b={field(e){const{node:t}=e;{if(!h&&t.declare){throw e.buildCodeFrameError(`The 'declare' modifier is only allowed when the 'allowDeclareFields' option of `+`@babel/plugin-transform-typescript or @babel/preset-typescript is enabled.`)}}if(t.declare){if(t.value){throw e.buildCodeFrameError(`Fields with the 'declare' modifier cannot be initialized here, but only in the constructor`)}if(!t.decorators){e.remove()}}else if(t.definite){if(t.value){throw e.buildCodeFrameError(`Definitely assigned fields cannot be initialized here, but only in the constructor`)}{if(!h&&!t.decorators){e.remove()}}}else{if(!h&&!t.value&&!t.decorators&&!n.types.isClassPrivateProperty(t)){e.remove()}}if(t.accessibility)t.accessibility=null;if(t.abstract)t.abstract=null;if(t.readonly)t.readonly=null;if(t.optional)t.optional=null;if(t.typeAnnotation)t.typeAnnotation=null;if(t.definite)t.definite=null;if(t.declare)t.declare=null;if(t.override)t.override=null},method({node:e}){if(e.accessibility)e.accessibility=null;if(e.abstract)e.abstract=null;if(e.optional)e.optional=null;if(e.override)e.override=null},constructor(e,t){if(e.node.accessibility)e.node.accessibility=null;const r=[];for(const t of e.node.params){if(t.type==="TSParameterProperty"&&!f.has(t.parameter)){f.add(t.parameter);r.push(t.parameter)}}if(r.length){const s=r.map((t=>{let r;if(n.types.isIdentifier(t)){r=t}else if(n.types.isAssignmentPattern(t)&&n.types.isIdentifier(t.left)){r=t.left}else{throw e.buildCodeFrameError("Parameter properties can not be destructuring patterns.")}return n.template.statement.ast` - this.${n.types.cloneNode(r)} = ${n.types.cloneNode(r)}`}));(0,o.injectInitialization)(t,e,s)}}};return{name:"transform-typescript",inherits:a.default,visitor:{Pattern:visitPattern,Identifier:visitPattern,RestElement:visitPattern,Program:{enter(e,t){const{file:s}=t;let a=null;let n=null;if(!u.has(e.node)){u.set(e.node,new Set)}if(s.ast.comments){for(const e of s.ast.comments){const t=r.exec(e.value);if(t){if(t[1]){n=t[2]}else{a=t[2]}}}}let o=a||d;if(o){[o]=o.split(".")}let i=n||m;if(i){[i]=i.split(".")}for(let r of e.get("body")){if(r.isImportDeclaration()){if(!p.has(t.file.ast.program)){p.set(t.file.ast.program,true)}if(r.node.importKind==="type"){r.remove();continue}if(y){p.set(e.node,false)}else{if(r.node.specifiers.length===0){p.set(e.node,false);continue}let t=true;const s=[];for(const a of r.node.specifiers){const n=r.scope.getBinding(a.local.name);if(n&&isImportTypeOnly({binding:n,programPath:e,pragmaImportName:o,pragmaFragImportName:i})){s.push(n.path)}else{t=false;p.set(e.node,false)}}if(t){r.remove()}else{for(const e of s){e.remove()}}}continue}if(r.isExportDeclaration()){r=r.get("declaration")}if(r.isVariableDeclaration({declare:true})){for(const t of Object.keys(r.getBindingIdentifiers())){registerGlobalType(e.scope,t)}}else if(r.isTSTypeAliasDeclaration()||r.isTSDeclareFunction()&&r.get("id").isIdentifier()||r.isTSInterfaceDeclaration()||r.isClassDeclaration({declare:true})||r.isTSEnumDeclaration({declare:true})||r.isTSModuleDeclaration({declare:true})&&r.get("id").isIdentifier()){registerGlobalType(e.scope,r.node.id.name)}}},exit(e){if(e.node.sourceType==="module"&&p.get(e.node)){e.pushContainer("body",n.types.exportNamedDeclaration())}}},ExportNamedDeclaration(e,t){if(!p.has(t.file.ast.program)){p.set(t.file.ast.program,true)}if(e.node.exportKind==="type"){e.remove();return}if(!e.node.source&&e.node.specifiers.length>0&&e.node.specifiers.every((({local:t})=>isGlobalType(e,t.name)))){e.remove();return}p.set(t.file.ast.program,false)},ExportSpecifier(e){if(!e.parent.source&&isGlobalType(e,e.node.local.name)){e.remove()}},ExportDefaultDeclaration(e,t){if(!p.has(t.file.ast.program)){p.set(t.file.ast.program,true)}if(n.types.isIdentifier(e.node.declaration)&&isGlobalType(e,e.node.declaration.name)){e.remove();return}p.set(t.file.ast.program,false)},TSDeclareFunction(e){e.remove()},TSDeclareMethod(e){e.remove()},VariableDeclaration(e){if(e.node.declare){e.remove()}},VariableDeclarator({node:e}){if(e.definite)e.definite=null},TSIndexSignature(e){e.remove()},ClassDeclaration(e){const{node:t}=e;if(t.declare){e.remove();return}},Class(e){const{node:t}=e;if(t.typeParameters)t.typeParameters=null;if(t.superTypeParameters)t.superTypeParameters=null;if(t.implements)t.implements=null;if(t.abstract)t.abstract=null;e.get("body.body").forEach((t=>{if(t.isClassMethod()||t.isClassPrivateMethod()){if(t.node.kind==="constructor"){b.constructor(t,e)}else{b.method(t)}}else if(t.isClassProperty()||t.isClassPrivateProperty()){b.field(t)}}))},Function(e){const{node:t,scope:r}=e;if(t.typeParameters)t.typeParameters=null;if(t.returnType)t.returnType=null;const s=t.params;if(s.length>0&&n.types.isIdentifier(s[0],{name:"this"})){s.shift()}const a=e.get("params");for(const e of a){if(e.type==="TSParameterProperty"){e.replaceWith(e.get("parameter"));r.registerBinding("param",e)}}},TSModuleDeclaration(e){(0,c.default)(e,n.types,s)},TSInterfaceDeclaration(e){e.remove()},TSTypeAliasDeclaration(e){e.remove()},TSEnumDeclaration(e){if(g&&e.node.const){(0,i.default)(e,n.types)}else{(0,l.default)(e,n.types)}},TSImportEqualsDeclaration(e){if(n.types.isTSExternalModuleReference(e.node.moduleReference)){throw e.buildCodeFrameError(`\`import ${e.node.id.name} = require('${e.node.moduleReference.expression.value}')\` `+"is not supported by @babel/plugin-transform-typescript\n"+"Please consider using "+`\`import ${e.node.id.name} from '${e.node.moduleReference.expression.value}';\` alongside `+"Typescript's --allowSyntheticDefaultImports option.")}e.replaceWith(n.types.variableDeclaration("var",[n.types.variableDeclarator(e.node.id,entityNameToExpr(e.node.moduleReference))]))},TSExportAssignment(e){throw e.buildCodeFrameError("`export =` is not supported by @babel/plugin-transform-typescript\n"+"Please consider using `export ;`.")},TSTypeAssertion(e){e.replaceWith(e.node.expression)},TSAsExpression(e){let{node:t}=e;do{t=t.expression}while(n.types.isTSAsExpression(t));e.replaceWith(t)},TSNonNullExpression(e){e.replaceWith(e.node.expression)},CallExpression(e){e.node.typeParameters=null},OptionalCallExpression(e){e.node.typeParameters=null},NewExpression(e){e.node.typeParameters=null},JSXOpeningElement(e){e.node.typeParameters=null},TaggedTemplateExpression(e){e.node.typeParameters=null}}};function entityNameToExpr(e){if(n.types.isTSQualifiedName(e)){return n.types.memberExpression(entityNameToExpr(e.left),e.right)}return e}function visitPattern({node:e}){if(e.typeAnnotation)e.typeAnnotation=null;if(n.types.isIdentifier(e)&&e.optional)e.optional=null}function isImportTypeOnly({binding:e,programPath:t,pragmaImportName:r,pragmaFragImportName:s}){for(const t of e.referencePaths){if(!isInType(t)){return false}}if(e.identifier.name!==r&&e.identifier.name!==s){return true}let a=false;t.traverse({"JSXElement|JSXFragment"(e){a=true;e.stop()}});return!a}}));t["default"]=d},8820:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transpileNamespace;var s=r(8304);function transpileNamespace(e,t,r){if(e.node.declare||e.node.id.type==="StringLiteral"){e.remove();return}if(!r){throw e.hub.file.buildCodeFrameError(e.node.id,"Namespace not marked type-only declare."+" Non-declarative namespaces are only supported experimentally in Babel."+" To enable and review caveats see:"+" https://babeljs.io/docs/en/babel-plugin-transform-typescript")}const s=e.node.id.name;const a=handleNested(e,t,t.cloneDeep(e.node));const n=e.scope.hasOwnBinding(s);if(e.parent.type==="ExportNamedDeclaration"){if(!n){e.parentPath.insertAfter(a);e.replaceWith(getDeclaration(t,s));e.scope.registerDeclaration(e.parentPath)}else{e.parentPath.replaceWith(a)}}else if(n){e.replaceWith(a)}else{e.scope.registerDeclaration(e.replaceWithMultiple([getDeclaration(t,s),a])[0])}}function getDeclaration(e,t){return e.variableDeclaration("let",[e.variableDeclarator(e.identifier(t))])}function getMemberExpression(e,t,r){return e.memberExpression(e.identifier(t),e.identifier(r))}function handleVariableDeclaration(e,t,r){if(e.kind!=="const"){throw r.file.buildCodeFrameError(e,"Namespaces exporting non-const are not supported by Babel."+" Change to const or see:"+" https://babeljs.io/docs/en/babel-plugin-transform-typescript")}const{declarations:a}=e;if(a.every((e=>s.types.isIdentifier(e.id)))){for(const e of a){e.init=s.types.assignmentExpression("=",getMemberExpression(s.types,t,e.id.name),e.init)}return[e]}const n=s.types.getBindingIdentifiers(e);const o=[];for(const e in n){o.push(s.types.assignmentExpression("=",getMemberExpression(s.types,t,e),s.types.cloneNode(n[e])))}return[e,s.types.expressionStatement(s.types.sequenceExpression(o))]}function handleNested(e,t,r,a){const n=new Set;const o=r.id;const i=e.scope.generateUid(o.name);const l=r.body.body;for(let r=0;r{const t=o.types.objectExpression([o.types.objectProperty(o.types.identifier("key"),e.key)]);for(const r of["get","set","value"]){if(e[r]!=null){t.properties.push(o.types.objectProperty(o.types.identifier(r),e[r]))}}return t}))}}if(t.instance||t.static){let r=[o.types.cloneNode(p.classRef),t.instance?o.types.arrayExpression(t.instance):o.types.nullLiteral(),t.static?o.types.arrayExpression(t.static):o.types.nullLiteral()];let s=0;for(let e=0;eo.types.cloneNode(t);return t};for(const e of p.superThises){const{node:t,parentPath:r}=e;if(r.isMemberExpression({object:t})){e.replaceWith(thisRef());continue}e.replaceWith(o.types.callExpression(p.file.addHelper("assertThisInitialized"),[thisRef()]))}const r=new Set;e.traverse(o.traverse.visitors.merge([a.environmentVisitor,{Super(e){const{node:t,parentPath:s}=e;if(s.isCallExpression({callee:t})){r.add(s)}}}]));let s=!!r.size;for(const a of r){wrapSuperCall(a,p.superName,thisRef,t);if(s){a.find((function(t){if(t===e){return true}if(t.isLoop()||t.isConditional()||t.isArrowFunctionExpression()){s=false;return true}}))}}let n;if(p.isLoose){n=e=>{const t=o.types.callExpression(p.file.addHelper("assertThisInitialized"),[thisRef()]);return e?o.types.logicalExpression("||",e,t):t}}else{n=e=>o.types.callExpression(p.file.addHelper("possibleConstructorReturn"),[thisRef()].concat(e||[]))}const i=t.get("body");if(!i.length||!i.pop().isReturnStatement()){t.pushContainer("body",o.types.returnStatement(s?thisRef():n()))}for(const e of p.superReturns){e.get("argument").replaceWith(n(e.node.argument))}}function pushMethod(e,t){const r=t?t.scope:p.scope;if(e.kind==="method"){if(processMethod(e,r))return}const a=e.static?"static":"instance";const n=p.methods[a];const i=e.kind==="method"?"value":e.kind;const l=o.types.isNumericLiteral(e.key)||o.types.isBigIntLiteral(e.key)?o.types.stringLiteral(String(e.key.value)):o.types.toComputedKey(e);let c=o.types.toExpression(e);if(o.types.isStringLiteral(l)){if(e.kind==="method"){c=(0,s.default)({id:l,node:e,scope:r})}}else{n.hasComputed=true}let u;if(!n.hasComputed&&n.map.has(l.value)){u=n.map.get(l.value);u[i]=c;if(i==="value"){u.get=null;u.set=null}else{u.value=null}}else{u={key:l,[i]:c};n.list.push(u);if(!n.hasComputed){n.map.set(l.value,u)}}}function processMethod(e,t){if(u.setClassMethods&&!e.decorators){let{classRef:r}=p;if(!e.static){insertProtoAliasOnce();r=p.protoAlias}const a=o.types.memberExpression(o.types.cloneNode(r),e.key,e.computed||o.types.isLiteral(e.key));let n=o.types.functionExpression(null,e.params,e.body,e.generator,e.async);o.types.inherits(n,e);const i=o.types.toComputedKey(e,e.key);if(o.types.isStringLiteral(i)){n=(0,s.default)({node:n,id:i,scope:t})}const l=o.types.expressionStatement(o.types.assignmentExpression("=",a,n));o.types.inheritsComments(l,e);p.body.push(l);return true}return false}function insertProtoAliasOnce(){if(p.protoAlias===null){setState({protoAlias:p.scope.generateUidIdentifier("proto")});const e=o.types.memberExpression(p.classRef,o.types.identifier("prototype"));const t=o.types.variableDeclaration("var",[o.types.variableDeclarator(p.protoAlias,e)]);p.body.push(t)}}function pushConstructor(e,t,r){setState({userConstructorPath:r,userConstructor:t,hasConstructor:true,superReturns:e});const{construct:s}=p;o.types.inheritsComments(s,t);s.params=t.params;o.types.inherits(s.body,t.body);s.body.directives=t.body.directives;pushConstructorToBody()}function pushConstructorToBody(){if(p.pushedConstructor)return;p.pushedConstructor=true;if(p.hasInstanceDescriptors||p.hasStaticDescriptors){pushDescriptors()}p.body.push(p.construct);pushInheritsToBody()}function pushInheritsToBody(){if(!p.isDerived||p.pushedInherits)return;const t=e.scope.generateUidIdentifier("super");setState({pushedInherits:true,superFnId:t});if(!u.superIsCallableConstructor){p.body.unshift(o.types.variableDeclaration("var",[o.types.variableDeclarator(t,o.types.callExpression((0,l.default)(p.file),[o.types.cloneNode(p.classRef)]))]))}p.body.unshift(o.types.expressionStatement(o.types.callExpression(p.file.addHelper(p.isLoose?"inheritsLoose":"inherits"),[o.types.cloneNode(p.classRef),o.types.cloneNode(p.superName)])))}function extractDynamicKeys(){const{dynamicKeys:e,node:t,scope:r}=p;for(const s of t.body.body){if(!o.types.isClassMethod(s)||!s.computed)continue;if(r.isPure(s.key,true))continue;const t=r.generateUidIdentifierBasedOnNode(s.key);e.set(t.name,s.key);s.key=t}}function setupClosureParamsArgs(){const{superName:e,dynamicKeys:t}=p;const r=[];const s=[];if(p.isDerived){let t=o.types.cloneNode(e);if(p.extendsNative){t=o.types.callExpression(p.file.addHelper("wrapNativeSuper"),[t]);(0,i.default)(t)}const a=p.scope.generateUidIdentifierBasedOnNode(e);r.push(a);s.push(t);setState({superName:o.types.cloneNode(a)})}for(const[e,a]of t){r.push(o.types.identifier(e));s.push(a)}return{closureParams:r,closureArgs:s}}function classTransformer(e,t,r,s){setState({parent:e.parent,scope:e.scope,node:e.node,path:e,file:t,isLoose:s});setState({classId:p.node.id,classRef:p.node.id?o.types.identifier(p.node.id.name):p.scope.generateUidIdentifier("class"),superName:p.node.superClass,isDerived:!!p.node.superClass,constructorBody:o.types.blockStatement([])});setState({extendsNative:p.isDerived&&r.has(p.superName.name)&&!p.scope.hasBinding(p.superName.name,true)});const{classRef:a,node:n,constructorBody:i}=p;setState({construct:buildConstructor(a,i,n)});extractDynamicKeys();let{body:l}=p;const{closureParams:c,closureArgs:d}=setupClosureParamsArgs();buildBody();if(!u.noClassCalls){i.body.unshift(o.types.expressionStatement(o.types.callExpression(p.file.addHelper("classCallCheck"),[o.types.thisExpression(),o.types.cloneNode(p.classRef)])))}l=l.concat(p.staticPropBody.map((e=>e(o.types.cloneNode(p.classRef)))));const f=e.isInStrictMode();let m=p.classId&&l.length===1;if(m&&!f){for(const e of p.construct.params){if(!o.types.isIdentifier(e)){m=false;break}}}const y=m?l[0].body.directives:[];if(!f){y.push(o.types.directive(o.types.directiveLiteral("use strict")))}if(m){return o.types.toExpression(l[0])}l.push(o.types.returnStatement(o.types.cloneNode(p.classRef)));const g=o.types.arrowFunctionExpression(c,o.types.blockStatement(l,y));return o.types.callExpression(g,d)}return classTransformer(e,t,r,c)}},5157:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(8304);var n=(0,s.declare)(((e,t)=>{var r,s,n;e.assertVersion(7);const{useBuiltIns:o=false}=t;const i=(r=e.assumption("iterableIsArray"))!=null?r:t.loose;const l=(s=t.allowArrayLike)!=null?s:e.assumption("arrayLikeIsIterable");const c=(n=e.assumption("objectRestNoSymbols"))!=null?n:t.loose;function getExtendsHelper(e){return o?a.types.memberExpression(a.types.identifier("Object"),a.types.identifier("assign")):e.addHelper("extends")}function variableDeclarationHasPattern(e){for(const t of e.declarations){if(a.types.isPattern(t.id)){return true}}return false}function hasRest(e){for(const t of e.elements){if(a.types.isRestElement(t)){return true}}return false}function hasObjectRest(e){for(const t of e.properties){if(a.types.isRestElement(t)){return true}}return false}const u={};const arrayUnpackVisitor=(e,t,r)=>{if(!t.length){return}if(a.types.isIdentifier(e)&&a.types.isReferenced(e,t[t.length-1])&&r.bindings[e.name]){r.deopt=true;throw u}};class DestructuringTransformer{constructor(e){this.blockHoist=e.blockHoist;this.operator=e.operator;this.arrays={};this.nodes=e.nodes||[];this.scope=e.scope;this.kind=e.kind;this.iterableIsArray=e.iterableIsArray;this.arrayLikeIsIterable=e.arrayLikeIsIterable;this.addHelper=e.addHelper}buildVariableAssignment(e,t){let r=this.operator;if(a.types.isMemberExpression(e))r="=";let s;if(r){s=a.types.expressionStatement(a.types.assignmentExpression(r,e,a.types.cloneNode(t)||this.scope.buildUndefinedNode()))}else{s=a.types.variableDeclaration(this.kind,[a.types.variableDeclarator(e,a.types.cloneNode(t))])}s._blockHoist=this.blockHoist;return s}buildVariableDeclaration(e,t){const r=a.types.variableDeclaration("var",[a.types.variableDeclarator(a.types.cloneNode(e),a.types.cloneNode(t))]);r._blockHoist=this.blockHoist;return r}push(e,t){const r=a.types.cloneNode(t);if(a.types.isObjectPattern(e)){this.pushObjectPattern(e,r)}else if(a.types.isArrayPattern(e)){this.pushArrayPattern(e,r)}else if(a.types.isAssignmentPattern(e)){this.pushAssignmentPattern(e,r)}else{this.nodes.push(this.buildVariableAssignment(e,r))}}toArray(e,t){if(this.iterableIsArray||a.types.isIdentifier(e)&&this.arrays[e.name]){return e}else{return this.scope.toArray(e,t,this.arrayLikeIsIterable)}}pushAssignmentPattern({left:e,right:t},r){const s=this.scope.generateUidIdentifierBasedOnNode(r);this.nodes.push(this.buildVariableDeclaration(s,r));const n=a.types.conditionalExpression(a.types.binaryExpression("===",a.types.cloneNode(s),this.scope.buildUndefinedNode()),t,a.types.cloneNode(s));if(a.types.isPattern(e)){let t;let r;if(this.kind==="const"||this.kind==="let"){t=this.scope.generateUidIdentifier(s.name);r=this.buildVariableDeclaration(t,n)}else{t=s;r=a.types.expressionStatement(a.types.assignmentExpression("=",a.types.cloneNode(s),n))}this.nodes.push(r);this.push(e,t)}else{this.nodes.push(this.buildVariableAssignment(e,n))}}pushObjectRest(e,t,r,s){const n=[];let o=true;let i=false;for(let t=0;t=s)break;if(a.types.isRestElement(r))continue;const l=r.key;if(a.types.isIdentifier(l)&&!r.computed){n.push(a.types.stringLiteral(l.name))}else if(a.types.isTemplateLiteral(l)){n.push(a.types.cloneNode(l));i=true}else if(a.types.isLiteral(l)){n.push(a.types.stringLiteral(String(l.value)))}else{n.push(a.types.cloneNode(l));o=false}}let l;if(n.length===0){l=a.types.callExpression(getExtendsHelper(this),[a.types.objectExpression([]),a.types.cloneNode(t)])}else{let e=a.types.arrayExpression(n);if(!o){e=a.types.callExpression(a.types.memberExpression(e,a.types.identifier("map")),[this.addHelper("toPropertyKey")])}else if(!i&&!a.types.isProgram(this.scope.block)){const t=this.scope.path.findParent((e=>e.isProgram()));const r=this.scope.generateUidIdentifier("excluded");t.scope.push({id:r,init:e,kind:"const"});e=a.types.cloneNode(r)}l=a.types.callExpression(this.addHelper(`objectWithoutProperties${c?"Loose":""}`),[a.types.cloneNode(t),e])}this.nodes.push(this.buildVariableAssignment(r.argument,l))}pushObjectProperty(e,t){if(a.types.isLiteral(e.key))e.computed=true;const r=e.value;const s=a.types.memberExpression(a.types.cloneNode(t),e.key,e.computed);if(a.types.isPattern(r)){this.push(r,s)}else{this.nodes.push(this.buildVariableAssignment(r,s))}}pushObjectPattern(e,t){if(!e.properties.length){this.nodes.push(a.types.expressionStatement(a.types.callExpression(this.addHelper("objectDestructuringEmpty"),[t])))}if(e.properties.length>1&&!this.scope.isStatic(t)){const e=this.scope.generateUidIdentifierBasedOnNode(t);this.nodes.push(this.buildVariableDeclaration(e,t));t=e}if(hasObjectRest(e)){let t;for(let r=0;rt.elements.length)return;if(e.elements.lengththis.addHelper(e)});u.init(n,o);e.ensureBlock();const p=t.body;p.body=c.concat(p.body)},CatchClause({node:e,scope:t}){const r=e.param;if(!a.types.isPattern(r))return;const s=t.generateUidIdentifier("ref");e.param=s;const n=[];const o=new DestructuringTransformer({kind:"let",scope:t,nodes:n,iterableIsArray:i,arrayLikeIsIterable:l,addHelper:e=>this.addHelper(e)});o.init(r,s);e.body.body=n.concat(e.body.body)},AssignmentExpression(e){const{node:t,scope:r}=e;if(!a.types.isPattern(t.left))return;const s=[];const n=new DestructuringTransformer({operator:t.operator,scope:r,nodes:s,iterableIsArray:i,arrayLikeIsIterable:l,addHelper:e=>this.addHelper(e)});let o;if(e.isCompletionRecord()||!e.parentPath.isExpressionStatement()){o=r.generateUidIdentifierBasedOnNode(t.right,"ref");s.push(a.types.variableDeclaration("var",[a.types.variableDeclarator(o,t.right)]));if(a.types.isArrayExpression(t.right)){n.arrays[o.name]=true}}n.init(t.left,o||t.right);if(o){if(e.parentPath.isArrowFunctionExpression()){e.replaceWith(a.types.blockStatement([]));s.push(a.types.returnStatement(a.types.cloneNode(o)))}else{s.push(a.types.expressionStatement(a.types.cloneNode(o)))}}e.replaceWithMultiple(s);e.scope.crawl()},VariableDeclaration(e){const{node:t,scope:r,parent:s}=e;if(a.types.isForXStatement(s))return;if(!s||!e.container)return;if(!variableDeclarationHasPattern(t))return;const n=t.kind;const o=t.loc;const c=[];let u;for(let e=0;ethis.addHelper(e)});if(a.types.isPattern(n)){o.init(n,s);if(+e!==t.declarations.length-1){a.types.inherits(c[c.length-1],u)}}else{c.push(a.types.inherits(o.buildVariableAssignment(u.id,a.types.cloneNode(u.init)),u))}}let p=null;const d=[];for(const e of c){if(p!==null&&a.types.isVariableDeclaration(e)){p.declarations.push(...e.declarations)}else{e.kind=n;if(!e.loc){e.loc=o}d.push(e);p=a.types.isVariableDeclaration(e)?e:null}}for(const e of d){if(!e.declarations)continue;for(const t of e.declarations){const{name:s}=t.id;if(r.bindings[s]){r.bindings[s].kind=e.kind}}}if(d.length===1){e.replaceWith(d[0])}else{e.replaceWithMultiple(d)}}}}}));t["default"]=n},5843:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6550);var a=r(558);var n=(0,a.declare)((e=>{e.assertVersion(7);return(0,s.createRegExpFeaturePlugin)({name:"transform-dotall-regex",feature:"dotAllFlag"})}));t["default"]=n},8447:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(6550);function _default(e,t){const{runtime:r=true}=t;if(typeof r!=="boolean"){throw new Error("The 'runtime' option must be boolean")}return(0,s.createRegExpFeaturePlugin)({name:"transform-named-capturing-groups-regex",feature:"namedCaptureGroups",options:{runtime:r}})}},5628:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9522);var a=s.default;t["default"]=a},2228:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(1017);var a=r(8188);function _default(e,t,r){if(r===false)return e;return resolveAbsoluteRuntime(e,s.resolve(t,r===true?".":r))}function resolveAbsoluteRuntime(e,t){try{return s.dirname((((e,t)=>(e=e.split("."),t=t.split("."),+e[0]>+t[0]||e[0]==t[0]&&+e[1]>=+t[1]))(process.versions.node,"8.9")?require.resolve:(e,{paths:[t]},s=r(8188))=>{let a=s._findPath(e,s._nodeModulePaths(t).concat(t));if(a)return a;a=new Error(`Cannot resolve module '${e}'`);a.code="MODULE_NOT_FOUND";throw a})(`${e}/package.json`,{paths:[t]})).replace(/\\/g,"/")}catch(r){if(r.code!=="MODULE_NOT_FOUND")throw r;throw Object.assign(new Error(`Failed to resolve "${e}" relative to "${t}"`),{code:"BABEL_RUNTIME_NOT_FOUND",runtime:e,dirname:t})}}},6339:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasMinVersion=hasMinVersion;var s=r(7849);function hasMinVersion(e,t){if(!t)return true;if(s.valid(t))t=`^${t}`;return!s.intersects(`<${e}`,t)&&!s.intersects(`>=8.0.0`,t)}},4722:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(6039);var n=r(8304);var o=r(6339);var i=r(2228);var l=r(9897);var c=r(5825);var u=r(7973);const p=l.default||l;const d=c.default||c;const f=u.default||u;const m="#__secret_key__@babel/runtime__compatibility";function supportsStaticESM(e){return!!(e!=null&&e.supportsStaticESM)}var y=(0,s.declare)(((e,t,r)=>{e.assertVersion(7);const{corejs:s,helpers:l=true,regenerator:c=true,useESModules:u=false,version:y="7.0.0-beta.0",absoluteRuntime:g=false}=t;let h=false;let b;if(typeof s==="object"&&s!==null){b=s.version;h=Boolean(s.proposals)}else{b=s}const x=b?Number(b):false;if(![false,2,3].includes(x)){throw new Error(`The \`core-js\` version must be false, 2 or 3, but got ${JSON.stringify(b)}.`)}if(h&&(!x||x<3)){throw new Error("The 'proposals' option is only supported when using 'corejs: 3'")}if(typeof c!=="boolean"){throw new Error("The 'regenerator' option must be undefined, or a boolean.")}if(typeof l!=="boolean"){throw new Error("The 'helpers' option must be undefined, or a boolean.")}if(typeof u!=="boolean"&&u!=="auto"){throw new Error("The 'useESModules' option must be undefined, or a boolean, or 'auto'.")}if(typeof g!=="boolean"&&typeof g!=="string"){throw new Error("The 'absoluteRuntime' option must be undefined, a boolean, or a string.")}if(typeof y!=="string"){throw new Error(`The 'version' option must be a version string.`)}const v="7.13.0";const E=(0,o.hasMinVersion)(v,y);function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}if(has(t,"useBuiltIns")){if(t.useBuiltIns){throw new Error("The 'useBuiltIns' option has been removed. The @babel/runtime "+"module now uses builtins by default.")}else{throw new Error("The 'useBuiltIns' option has been removed. Use the 'corejs'"+"option to polyfill with `core-js` via @babel/runtime.")}}if(has(t,"polyfill")){if(t.polyfill===false){throw new Error("The 'polyfill' option has been removed. The @babel/runtime "+"module now skips polyfilling by default.")}else{throw new Error("The 'polyfill' option has been removed. Use the 'corejs'"+"option to polyfill with `core-js` via @babel/runtime.")}}if(has(t,"moduleName")){throw new Error("The 'moduleName' option has been removed. @babel/transform-runtime "+"no longer supports arbitrary runtimes. If you were using this to "+"set an absolute path for Babel's standard runtimes, please use the "+"'absoluteRuntime' option.")}const j=u==="auto"?e.caller(supportsStaticESM):u;const w=x===2;const _=x===3;const S=_?"@babel/runtime-corejs3":w?"@babel/runtime-corejs2":"@babel/runtime";const O=["interopRequireWildcard","interopRequireDefault"];const k=(0,i.default)(S,r,g);function createCorejsPlgin(e,t,r){return(s,a,n)=>Object.assign({},e(s,t,n),{inherits:r})}function createRegeneratorPlugin(e){if(!c)return undefined;return(t,r,s)=>f(t,e,s)}const P=g?".js":"";return{name:"transform-runtime",inherits:w?createCorejsPlgin(p,{method:"usage-pure",[m]:{runtimeVersion:y,useBabelRuntime:k,ext:P}},createRegeneratorPlugin({method:"usage-pure",[m]:{useBabelRuntime:k}})):_?createCorejsPlgin(d,{method:"usage-pure",version:3,proposals:h,[m]:{useBabelRuntime:k,ext:P}},createRegeneratorPlugin({method:"usage-pure",[m]:{useBabelRuntime:k}})):createRegeneratorPlugin({method:"usage-pure",[m]:{useBabelRuntime:k}}),pre(e){if(!l)return;e.set("helperGenerator",(t=>{if(e.availableHelper&&!e.availableHelper(t,y)){return}const r=O.indexOf(t)!==-1;const s=r&&!(0,a.isModule)(e.path)?4:undefined;const n=j&&e.path.node.sourceType==="module"?"helpers/esm":"helpers";return addDefaultImport(`${k}/${n}/${t}`,t,s,true)}));const t=new Map;function addDefaultImport(r,s,o,i=false){const l=(0,a.isModule)(e.path);const c=`${r}:${s}:${l||""}`;let u=t.get(c);if(u){u=n.types.cloneNode(u)}else{u=(0,a.addDefault)(e.path,r,{importedInterop:i&&E?"compiled":"uncompiled",nameHint:s,blockHoist:o});t.set(c,u)}return u}}}}));t["default"]=y},749:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transpileConstEnum;var s=r(3803);function transpileConstEnum(e,t){const{name:r}=e.node.id;const a=e.parentPath.isExportNamedDeclaration();let n=a;if(!n&&t.isProgram(e.parent)){n=e.parent.body.some((e=>t.isExportNamedDeclaration(e)&&!e.source&&e.specifiers.some((e=>t.isExportSpecifier(e)&&e.local.name===r))))}const o=(0,s.translateEnumValues)(e,t);if(n){const s=t.objectExpression(o.map((([e,r])=>t.objectProperty(t.isValidIdentifier(e)?t.identifier(e):t.stringLiteral(e),r))));if(e.scope.hasOwnBinding(r)){(a?e.parentPath:e).replaceWith(t.expressionStatement(t.callExpression(t.memberExpression(t.identifier("Object"),t.identifier("assign")),[e.node.id,s])))}else{e.replaceWith(t.variableDeclaration("var",[t.variableDeclarator(e.node.id,s)]));e.scope.registerDeclaration(e)}return}const i=new Map(o);e.scope.path.traverse({Scope(e){if(e.scope.hasOwnBinding(r))e.skip()},MemberExpression(e){if(!t.isIdentifier(e.node.object,{name:r}))return;let s;if(e.node.computed){if(t.isStringLiteral(e.node.property)){s=e.node.property.value}else{return}}else if(t.isIdentifier(e.node.property)){s=e.node.property.name}else{return}if(!i.has(s))return;e.replaceWith(t.cloneNode(i.get(s)))}});e.remove()}},3803:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transpileEnum;t.translateEnumValues=translateEnumValues;var s=r(9491);var a=r(8304);function transpileEnum(e,t){const{node:r}=e;if(r.declare){e.remove();return}const s=r.id.name;const a=enumFill(e,t,r.id);switch(e.parent.type){case"BlockStatement":case"ExportNamedDeclaration":case"Program":{e.insertAfter(a);if(seen(e.parentPath)){e.remove()}else{const s=t.isProgram(e.parent);e.scope.registerDeclaration(e.replaceWith(makeVar(r.id,t,s?"var":"let"))[0])}break}default:throw new Error(`Unexpected enum parent '${e.parent.type}`)}function seen(e){if(e.isExportDeclaration()){return seen(e.parentPath)}if(e.getData(s)){return true}else{e.setData(s,true);return false}}}function makeVar(e,t,r){return t.variableDeclaration(r,[t.variableDeclarator(e)])}const n=(0,a.template)(`\n (function (ID) {\n ASSIGNMENTS;\n })(ID || (ID = {}));\n`);const o=(0,a.template)(`\n ENUM["NAME"] = VALUE;\n`);const i=(0,a.template)(`\n ENUM[ENUM["NAME"] = VALUE] = "NAME";\n`);const buildEnumMember=(e,t)=>(e?o:i)(t);function enumFill(e,t,r){const s=translateEnumValues(e,t);const a=s.map((([e,s])=>buildEnumMember(t.isStringLiteral(s),{ENUM:t.cloneNode(r),NAME:e,VALUE:s})));return n({ID:t.cloneNode(r),ASSIGNMENTS:a})}function translateEnumValues(e,t){const r=Object.create(null);let a=-1;return e.node.members.map((n=>{const o=t.isIdentifier(n.id)?n.id.name:n.id.value;const i=n.initializer;let l;if(i){const e=evaluate(i,r);if(e!==undefined){r[o]=e;if(typeof e==="number"){l=t.numericLiteral(e);a=e}else{s(typeof e==="string");l=t.stringLiteral(e);a=undefined}}else{l=i;a=undefined}}else{if(a!==undefined){a++;l=t.numericLiteral(a);r[o]=a}else{throw e.buildCodeFrameError("Enum member must have initializer.")}}return[o,l]}))}function evaluate(e,t){return evalConstant(e);function evalConstant(e){switch(e.type){case"StringLiteral":return e.value;case"UnaryExpression":return evalUnaryExpression(e);case"BinaryExpression":return evalBinaryExpression(e);case"NumericLiteral":return e.value;case"ParenthesizedExpression":return evalConstant(e.expression);case"Identifier":return t[e.name];case"TemplateLiteral":if(e.quasis.length===1){return e.quasis[0].value.cooked}default:return undefined}}function evalUnaryExpression({argument:e,operator:t}){const r=evalConstant(e);if(r===undefined){return undefined}switch(t){case"+":return r;case"-":return-r;case"~":return~r;default:return undefined}}function evalBinaryExpression(e){const t=evalConstant(e.left);if(t===undefined){return undefined}const r=evalConstant(e.right);if(r===undefined){return undefined}switch(e.operator){case"|":return t|r;case"&":return t&r;case">>":return t>>r;case">>>":return t>>>r;case"<<":return t<{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(6050);var n=r(8304);var o=r(738);var i=r(749);var l=r(3803);var c=r(8820);function isInType(e){switch(e.parent.type){case"TSTypeReference":case"TSQualifiedName":case"TSExpressionWithTypeArguments":case"TSTypeQuery":return true;case"ExportSpecifier":return e.parentPath.parent.exportKind==="type";default:return false}}const u=new WeakMap;const p=new WeakMap;const d=new WeakSet;function isGlobalType(e,t){const r=e.find((e=>e.isProgram())).node;if(e.scope.hasOwnBinding(t))return false;if(u.get(r).has(t))return true;console.warn(`The exported identifier "${t}" is not declared in Babel's scope tracker\n`+`as a JavaScript value binding, and "@babel/plugin-transform-typescript"\n`+`never encountered it as a TypeScript type declaration.\n`+`It will be treated as a JavaScript value.\n\n`+`This problem is likely caused by another plugin injecting\n`+`"${t}" without registering it in the scope tracker. If you are the author\n`+` of that plugin, please use "scope.registerDeclaration(declarationPath)".`);return false}function registerGlobalType(e,t){u.get(e.path.node).add(t)}var f=(0,s.declare)(((e,t)=>{e.assertVersion(7);const r=/\*?\s*@jsx((?:Frag)?)\s+([^\s]+)/;const{allowNamespaces:s=true,jsxPragma:f="React.createElement",jsxPragmaFrag:m="React.Fragment",onlyRemoveTypeImports:y=false,optimizeConstEnums:g=false}=t;{var{allowDeclareFields:h=false}=t}const b={field(e){const{node:t}=e;{if(!h&&t.declare){throw e.buildCodeFrameError(`The 'declare' modifier is only allowed when the 'allowDeclareFields' option of `+`@babel/plugin-transform-typescript or @babel/preset-typescript is enabled.`)}}if(t.declare){if(t.value){throw e.buildCodeFrameError(`Fields with the 'declare' modifier cannot be initialized here, but only in the constructor`)}if(!t.decorators){e.remove()}}else if(t.definite){if(t.value){throw e.buildCodeFrameError(`Definitely assigned fields cannot be initialized here, but only in the constructor`)}{if(!h&&!t.decorators){e.remove()}}}else{if(!h&&!t.value&&!t.decorators&&!n.types.isClassPrivateProperty(t)){e.remove()}}if(t.accessibility)t.accessibility=null;if(t.abstract)t.abstract=null;if(t.readonly)t.readonly=null;if(t.optional)t.optional=null;if(t.typeAnnotation)t.typeAnnotation=null;if(t.definite)t.definite=null;if(t.declare)t.declare=null;if(t.override)t.override=null},method({node:e}){if(e.accessibility)e.accessibility=null;if(e.abstract)e.abstract=null;if(e.optional)e.optional=null;if(e.override)e.override=null},constructor(e,t){if(e.node.accessibility)e.node.accessibility=null;const r=[];for(const t of e.node.params){if(t.type==="TSParameterProperty"&&!d.has(t.parameter)){d.add(t.parameter);r.push(t.parameter)}}if(r.length){const s=r.map((t=>{let r;if(n.types.isIdentifier(t)){r=t}else if(n.types.isAssignmentPattern(t)&&n.types.isIdentifier(t.left)){r=t.left}else{throw e.buildCodeFrameError("Parameter properties can not be destructuring patterns.")}return n.template.statement.ast` + this.${n.types.cloneNode(r)} = ${n.types.cloneNode(r)}`}));(0,o.injectInitialization)(t,e,s)}}};return{name:"transform-typescript",inherits:a.default,visitor:{Pattern:visitPattern,Identifier:visitPattern,RestElement:visitPattern,Program:{enter(e,t){const{file:s}=t;let a=null;let n=null;if(!u.has(e.node)){u.set(e.node,new Set)}if(s.ast.comments){for(const e of s.ast.comments){const t=r.exec(e.value);if(t){if(t[1]){n=t[2]}else{a=t[2]}}}}let o=a||f;if(o){[o]=o.split(".")}let i=n||m;if(i){[i]=i.split(".")}for(let r of e.get("body")){if(r.isImportDeclaration()){if(!p.has(t.file.ast.program)){p.set(t.file.ast.program,true)}if(r.node.importKind==="type"){r.remove();continue}if(y){p.set(e.node,false)}else{if(r.node.specifiers.length===0){p.set(e.node,false);continue}let t=true;const s=[];for(const a of r.node.specifiers){const n=r.scope.getBinding(a.local.name);if(n&&isImportTypeOnly({binding:n,programPath:e,pragmaImportName:o,pragmaFragImportName:i})){s.push(n.path)}else{t=false;p.set(e.node,false)}}if(t){r.remove()}else{for(const e of s){e.remove()}}}continue}if(r.isExportDeclaration()){r=r.get("declaration")}if(r.isVariableDeclaration({declare:true})){for(const t of Object.keys(r.getBindingIdentifiers())){registerGlobalType(e.scope,t)}}else if(r.isTSTypeAliasDeclaration()||r.isTSDeclareFunction()&&r.get("id").isIdentifier()||r.isTSInterfaceDeclaration()||r.isClassDeclaration({declare:true})||r.isTSEnumDeclaration({declare:true})||r.isTSModuleDeclaration({declare:true})&&r.get("id").isIdentifier()){registerGlobalType(e.scope,r.node.id.name)}}},exit(e){if(e.node.sourceType==="module"&&p.get(e.node)){e.pushContainer("body",n.types.exportNamedDeclaration())}}},ExportNamedDeclaration(e,t){if(!p.has(t.file.ast.program)){p.set(t.file.ast.program,true)}if(e.node.exportKind==="type"){e.remove();return}if(!e.node.source&&e.node.specifiers.length>0&&e.node.specifiers.every((({local:t})=>isGlobalType(e,t.name)))){e.remove();return}p.set(t.file.ast.program,false)},ExportSpecifier(e){if(!e.parent.source&&isGlobalType(e,e.node.local.name)){e.remove()}},ExportDefaultDeclaration(e,t){if(!p.has(t.file.ast.program)){p.set(t.file.ast.program,true)}if(n.types.isIdentifier(e.node.declaration)&&isGlobalType(e,e.node.declaration.name)){e.remove();return}p.set(t.file.ast.program,false)},TSDeclareFunction(e){e.remove()},TSDeclareMethod(e){e.remove()},VariableDeclaration(e){if(e.node.declare){e.remove()}},VariableDeclarator({node:e}){if(e.definite)e.definite=null},TSIndexSignature(e){e.remove()},ClassDeclaration(e){const{node:t}=e;if(t.declare){e.remove();return}},Class(e){const{node:t}=e;if(t.typeParameters)t.typeParameters=null;if(t.superTypeParameters)t.superTypeParameters=null;if(t.implements)t.implements=null;if(t.abstract)t.abstract=null;e.get("body.body").forEach((t=>{if(t.isClassMethod()||t.isClassPrivateMethod()){if(t.node.kind==="constructor"){b.constructor(t,e)}else{b.method(t)}}else if(t.isClassProperty()||t.isClassPrivateProperty()){b.field(t)}}))},Function(e){const{node:t,scope:r}=e;if(t.typeParameters)t.typeParameters=null;if(t.returnType)t.returnType=null;const s=t.params;if(s.length>0&&n.types.isIdentifier(s[0],{name:"this"})){s.shift()}const a=e.get("params");for(const e of a){if(e.type==="TSParameterProperty"){e.replaceWith(e.get("parameter"));r.registerBinding("param",e)}}},TSModuleDeclaration(e){(0,c.default)(e,n.types,s)},TSInterfaceDeclaration(e){e.remove()},TSTypeAliasDeclaration(e){e.remove()},TSEnumDeclaration(e){if(g&&e.node.const){(0,i.default)(e,n.types)}else{(0,l.default)(e,n.types)}},TSImportEqualsDeclaration(e){if(n.types.isTSExternalModuleReference(e.node.moduleReference)){throw e.buildCodeFrameError(`\`import ${e.node.id.name} = require('${e.node.moduleReference.expression.value}')\` `+"is not supported by @babel/plugin-transform-typescript\n"+"Please consider using "+`\`import ${e.node.id.name} from '${e.node.moduleReference.expression.value}';\` alongside `+"Typescript's --allowSyntheticDefaultImports option.")}e.replaceWith(n.types.variableDeclaration("var",[n.types.variableDeclarator(e.node.id,entityNameToExpr(e.node.moduleReference))]))},TSExportAssignment(e){throw e.buildCodeFrameError("`export =` is not supported by @babel/plugin-transform-typescript\n"+"Please consider using `export ;`.")},TSTypeAssertion(e){e.replaceWith(e.node.expression)},TSAsExpression(e){let{node:t}=e;do{t=t.expression}while(n.types.isTSAsExpression(t));e.replaceWith(t)},TSNonNullExpression(e){e.replaceWith(e.node.expression)},CallExpression(e){e.node.typeParameters=null},OptionalCallExpression(e){e.node.typeParameters=null},NewExpression(e){e.node.typeParameters=null},JSXOpeningElement(e){e.node.typeParameters=null},TaggedTemplateExpression(e){e.node.typeParameters=null}}};function entityNameToExpr(e){if(n.types.isTSQualifiedName(e)){return n.types.memberExpression(entityNameToExpr(e.left),e.right)}return e}function visitPattern({node:e}){if(e.typeAnnotation)e.typeAnnotation=null;if(n.types.isIdentifier(e)&&e.optional)e.optional=null}function isImportTypeOnly({binding:e,programPath:t,pragmaImportName:r,pragmaFragImportName:s}){for(const t of e.referencePaths){if(!isInType(t)){return false}}if(e.identifier.name!==r&&e.identifier.name!==s){return true}let a=false;t.traverse({"JSXElement|JSXFragment"(e){a=true;e.stop()}});return!a}}));t["default"]=f},8820:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transpileNamespace;var s=r(8304);function transpileNamespace(e,t,r){if(e.node.declare||e.node.id.type==="StringLiteral"){e.remove();return}if(!r){throw e.hub.file.buildCodeFrameError(e.node.id,"Namespace not marked type-only declare."+" Non-declarative namespaces are only supported experimentally in Babel."+" To enable and review caveats see:"+" https://babeljs.io/docs/en/babel-plugin-transform-typescript")}const s=e.node.id.name;const a=handleNested(e,t,t.cloneDeep(e.node));const n=e.scope.hasOwnBinding(s);if(e.parent.type==="ExportNamedDeclaration"){if(!n){e.parentPath.insertAfter(a);e.replaceWith(getDeclaration(t,s));e.scope.registerDeclaration(e.parentPath)}else{e.parentPath.replaceWith(a)}}else if(n){e.replaceWith(a)}else{e.scope.registerDeclaration(e.replaceWithMultiple([getDeclaration(t,s),a])[0])}}function getDeclaration(e,t){return e.variableDeclaration("let",[e.variableDeclarator(e.identifier(t))])}function getMemberExpression(e,t,r){return e.memberExpression(e.identifier(t),e.identifier(r))}function handleVariableDeclaration(e,t,r){if(e.kind!=="const"){throw r.file.buildCodeFrameError(e,"Namespaces exporting non-const are not supported by Babel."+" Change to const or see:"+" https://babeljs.io/docs/en/babel-plugin-transform-typescript")}const{declarations:a}=e;if(a.every((e=>s.types.isIdentifier(e.id)))){for(const e of a){e.init=s.types.assignmentExpression("=",getMemberExpression(s.types,t,e.id.name),e.init)}return[e]}const n=s.types.getBindingIdentifiers(e);const o=[];for(const e in n){o.push(s.types.assignmentExpression("=",getMemberExpression(s.types,t,e),s.types.cloneNode(n[e])))}return[e,s.types.expressionStatement(s.types.sequenceExpression(o))]}function handleNested(e,t,r,a){const n=new Set;const o=r.id;const i=e.scope.generateUid(o.name);const l=r.body.body;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasOwnDecorators=hasOwnDecorators;t.hasDecorators=hasDecorators;t.buildDecoratedClass=buildDecoratedClass;var s=r(8304);var a=r(4725);var n=r(550);function hasOwnDecorators(e){return!!(e.decorators&&e.decorators.length)}function hasDecorators(e){return hasOwnDecorators(e)||e.body.body.some(hasOwnDecorators)}function prop(e,t){if(!t)return null;return s.types.objectProperty(s.types.identifier(e),t)}function method(e,t){return s.types.objectMethod("method",s.types.identifier(e),[],s.types.blockStatement(t))}function takeDecorators(e){let t;if(e.decorators&&e.decorators.length>0){t=s.types.arrayExpression(e.decorators.map((e=>e.expression)))}e.decorators=undefined;return t}function getKey(e){if(e.computed){return e.key}else if(s.types.isIdentifier(e.key)){return s.types.stringLiteral(e.key.name)}else{return s.types.stringLiteral(String(e.key.value))}}function extractElementDescriptor(e,t,r){const{node:o,scope:i}=r;const l=r.isClassMethod();if(r.isPrivate()){throw r.buildCodeFrameError(`Private ${l?"methods":"fields"} in decorated classes are not supported yet.`)}new a.default({methodPath:r,objectRef:e,superRef:t,file:this,refToPreserve:e}).replace();const c=[prop("kind",s.types.stringLiteral(s.types.isClassMethod(o)?o.kind:"field")),prop("decorators",takeDecorators(o)),prop("static",o.static&&s.types.booleanLiteral(true)),prop("key",getKey(o))].filter(Boolean);if(s.types.isClassMethod(o)){const e=o.computed?null:o.key;s.types.toExpression(o);c.push(prop("value",(0,n.default)({node:o,id:e,scope:i})||o))}else if(s.types.isClassProperty(o)&&o.value){c.push(method("value",s.template.statements.ast`return ${o.value}`))}else{c.push(prop("value",i.buildUndefinedNode()))}r.remove();return s.types.objectExpression(c)}function addDecorateHelper(e){try{return e.addHelper("decorate")}catch(e){if(e.code==="BABEL_HELPER_UNKNOWN"){e.message+="\n '@babel/plugin-transform-decorators' in non-legacy mode"+" requires '@babel/core' version ^7.0.2 and you appear to be using"+" an older version."}throw e}}function buildDecoratedClass(e,t,r,a){const{node:n,scope:o}=t;const i=o.generateUidIdentifier("initialize");const l=n.id&&t.isDeclaration();const c=t.isInStrictMode();const{superClass:u}=n;n.type="ClassDeclaration";if(!n.id)n.id=s.types.cloneNode(e);let p;if(u){p=o.generateUidIdentifierBasedOnNode(n.superClass,"super");n.superClass=p}const f=takeDecorators(n);const d=s.types.arrayExpression(r.filter((e=>!e.node.abstract)).map(extractElementDescriptor.bind(a,n.id,p)));const m=s.template.expression.ast` + `}},7055:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasOwnDecorators=hasOwnDecorators;t.hasDecorators=hasDecorators;t.buildDecoratedClass=buildDecoratedClass;var s=r(8304);var a=r(4725);var n=r(550);function hasOwnDecorators(e){return!!(e.decorators&&e.decorators.length)}function hasDecorators(e){return hasOwnDecorators(e)||e.body.body.some(hasOwnDecorators)}function prop(e,t){if(!t)return null;return s.types.objectProperty(s.types.identifier(e),t)}function method(e,t){return s.types.objectMethod("method",s.types.identifier(e),[],s.types.blockStatement(t))}function takeDecorators(e){let t;if(e.decorators&&e.decorators.length>0){t=s.types.arrayExpression(e.decorators.map((e=>e.expression)))}e.decorators=undefined;return t}function getKey(e){if(e.computed){return e.key}else if(s.types.isIdentifier(e.key)){return s.types.stringLiteral(e.key.name)}else{return s.types.stringLiteral(String(e.key.value))}}function extractElementDescriptor(e,t,r){const{node:o,scope:i}=r;const l=r.isClassMethod();if(r.isPrivate()){throw r.buildCodeFrameError(`Private ${l?"methods":"fields"} in decorated classes are not supported yet.`)}new a.default({methodPath:r,objectRef:e,superRef:t,file:this,refToPreserve:e}).replace();const c=[prop("kind",s.types.stringLiteral(s.types.isClassMethod(o)?o.kind:"field")),prop("decorators",takeDecorators(o)),prop("static",o.static&&s.types.booleanLiteral(true)),prop("key",getKey(o))].filter(Boolean);if(s.types.isClassMethod(o)){const e=o.computed?null:o.key;s.types.toExpression(o);c.push(prop("value",(0,n.default)({node:o,id:e,scope:i})||o))}else if(s.types.isClassProperty(o)&&o.value){c.push(method("value",s.template.statements.ast`return ${o.value}`))}else{c.push(prop("value",i.buildUndefinedNode()))}r.remove();return s.types.objectExpression(c)}function addDecorateHelper(e){try{return e.addHelper("decorate")}catch(e){if(e.code==="BABEL_HELPER_UNKNOWN"){e.message+="\n '@babel/plugin-transform-decorators' in non-legacy mode"+" requires '@babel/core' version ^7.0.2 and you appear to be using"+" an older version."}throw e}}function buildDecoratedClass(e,t,r,a){const{node:n,scope:o}=t;const i=o.generateUidIdentifier("initialize");const l=n.id&&t.isDeclaration();const c=t.isInStrictMode();const{superClass:u}=n;n.type="ClassDeclaration";if(!n.id)n.id=s.types.cloneNode(e);let p;if(u){p=o.generateUidIdentifierBasedOnNode(n.superClass,"super");n.superClass=p}const d=takeDecorators(n);const f=s.types.arrayExpression(r.filter((e=>!e.node.abstract)).map(extractElementDescriptor.bind(a,n.id,p)));const m=s.template.expression.ast` ${addDecorateHelper(a)}( - ${f||s.types.nullLiteral()}, + ${d||s.types.nullLiteral()}, function (${i}, ${u?s.types.cloneNode(p):null}) { ${n} - return { F: ${s.types.cloneNode(n.id)}, d: ${d} }; + return { F: ${s.types.cloneNode(n.id)}, d: ${f} }; }, ${u} ) - `;if(!c){m.arguments[1].body.directives.push(s.types.directive(s.types.directiveLiteral("use strict")))}let y=m;let g="arguments.1.body.body.0";if(l){y=s.template.statement.ast`let ${e} = ${m}`;g="declarations.0.init."+g}return{instanceNodes:[s.template.statement.ast`${s.types.cloneNode(i)}(this)`],wrapClass(e){e.replaceWith(y);return e.get(g)}}}},5123:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.enableFeature=enableFeature;t.isLoose=isLoose;t.verifyUsedFeatures=verifyUsedFeatures;t.FEATURES=void 0;var s=r(7055);const a=Object.freeze({fields:1<<1,privateMethods:1<<2,decorators:1<<3,privateIn:1<<4,staticBlocks:1<<5});t.FEATURES=a;const n=new Map([[a.fields,"@babel/plugin-proposal-class-properties"],[a.privateMethods,"@babel/plugin-proposal-private-methods"],[a.privateIn,"@babel/plugin-proposal-private-property-in-object"]]);const o="@babel/plugin-class-features/featuresKey";const i="@babel/plugin-class-features/looseKey";const l="@babel/plugin-class-features/looseLowPriorityKey/#__internal__@babel/preset-env__please-overwrite-loose-instead-of-throwing";function enableFeature(e,t,r){if(!hasFeature(e,t)||canIgnoreLoose(e,t)){e.set(o,e.get(o)|t);if(r==="#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error"){setLoose(e,t,true);e.set(l,e.get(l)|t)}else if(r==="#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"){setLoose(e,t,false);e.set(l,e.get(l)|t)}else{setLoose(e,t,r)}}let s;let a;for(const[t,r]of n){if(!hasFeature(e,t))continue;const n=isLoose(e,t);if(canIgnoreLoose(e,t)){continue}else if(s===!n){throw new Error("'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, "+"@babel/plugin-proposal-private-methods and "+"@babel/plugin-proposal-private-property-in-object (when they are enabled).")}else{s=n;a=r}}if(s!==undefined){for(const[t,r]of n){if(hasFeature(e,t)&&isLoose(e,t)!==s){setLoose(e,t,s);console.warn(`Though the "loose" option was set to "${!s}" in your @babel/preset-env `+`config, it will not be used for ${r} since the "loose" mode option was set to `+`"${s}" for ${a}.\nThe "loose" option must be the `+`same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods `+`and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can `+`silence this warning by explicitly adding\n`+`\t["${r}", { "loose": ${s} }]\n`+`to the "plugins" section of your Babel config.`)}}}}function hasFeature(e,t){return!!(e.get(o)&t)}function isLoose(e,t){return!!(e.get(i)&t)}function setLoose(e,t,r){if(r)e.set(i,e.get(i)|t);else e.set(i,e.get(i)&~t);e.set(l,e.get(l)&~t)}function canIgnoreLoose(e,t){return!!(e.get(l)&t)}function verifyUsedFeatures(e,t){if((0,s.hasOwnDecorators)(e.node)){if(!hasFeature(t,a.decorators)){throw e.buildCodeFrameError("Decorators are not enabled."+"\nIf you are using "+'["@babel/plugin-proposal-decorators", { "legacy": true }], '+'make sure it comes *before* "@babel/plugin-proposal-class-properties" '+"and enable loose mode, like so:\n"+'\t["@babel/plugin-proposal-decorators", { "legacy": true }]\n'+'\t["@babel/plugin-proposal-class-properties", { "loose": true }]')}if(e.isPrivate()){throw e.buildCodeFrameError(`Private ${e.isClassMethod()?"methods":"fields"} in decorated classes are not supported yet.`)}}if(e.isClassPrivateMethod!=null&&e.isClassPrivateMethod()){if(!hasFeature(t,a.privateMethods)){throw e.buildCodeFrameError("Class private methods are not enabled.")}}if(e.isPrivateName()&&e.parentPath.isBinaryExpression({operator:"in",left:e.node})){if(!hasFeature(t,a.privateIn)){throw e.buildCodeFrameError("Private property in checks are not enabled.")}}if(e.isProperty()){if(!hasFeature(t,a.fields)){throw e.buildCodeFrameError("Class fields are not enabled.")}}if(e.isStaticBlock!=null&&e.isStaticBlock()){if(!hasFeature(t,a.staticBlocks)){throw e.buildCodeFrameError("Static class blocks are not enabled. "+"Please add `@babel/plugin-proposal-class-static-block` to your configuration.")}}}},196:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.buildPrivateNamesMap=buildPrivateNamesMap;t.buildPrivateNamesNodes=buildPrivateNamesNodes;t.transformPrivateNamesUsage=transformPrivateNamesUsage;t.buildFieldsInitNodes=buildFieldsInitNodes;var s=r(8304);var a=r(4725);var n=r(5789);var o=r(6721);var i=r(2155);var l=r(5464);function buildPrivateNamesMap(e){const t=new Map;for(const r of e){if(r.isPrivate()){const{name:e}=r.node.key.id;const s=t.has(e)?t.get(e):{id:r.scope.generateUidIdentifier(e),static:r.node.static,method:!r.isProperty()};if(r.isClassPrivateMethod()){if(r.node.kind==="get"){s.getId=r.scope.generateUidIdentifier(`get_${e}`)}else if(r.node.kind==="set"){s.setId=r.scope.generateUidIdentifier(`set_${e}`)}else if(r.node.kind==="method"){s.methodId=r.scope.generateUidIdentifier(e)}}t.set(e,s)}}return t}function buildPrivateNamesNodes(e,t,r){const a=[];for(const[n,o]of e){const{static:e,method:l,getId:c,setId:u}=o;const p=c||u;const f=s.types.cloneNode(o.id);let d;if(t){d=s.types.callExpression(r.addHelper("classPrivateFieldLooseKey"),[s.types.stringLiteral(n)])}else if(!e){d=s.types.newExpression(s.types.identifier(!l||p?"WeakMap":"WeakSet"),[])}if(d){(0,i.default)(d);a.push(s.template.statement.ast`var ${f} = ${d}`)}}return a}function privateNameVisitorFactory(e){const t=Object.assign({},e,{Class(e){const{privateNamesMap:s}=this;const a=e.get("body.body");const n=new Map(s);const o=[];for(const e of a){if(!e.isPrivate())continue;const{name:t}=e.node.key.id;n.delete(t);o.push(t)}if(!o.length){return}e.get("body").traverse(r,Object.assign({},this,{redeclared:o}));e.traverse(t,Object.assign({},this,{privateNamesMap:n}));e.skipKey("body")}});const r=s.traverse.visitors.merge([Object.assign({},e),a.environmentVisitor]);return t}const c=privateNameVisitorFactory({PrivateName(e,{noDocumentAll:t}){const{privateNamesMap:r,redeclared:s}=this;const{node:a,parentPath:n}=e;if(!n.isMemberExpression({property:a})&&!n.isOptionalMemberExpression({property:a})){return}const{name:o}=a.id;if(!r.has(o))return;if(s&&s.includes(o))return;this.handle(n,t)}});const u=privateNameVisitorFactory({BinaryExpression(e){const{operator:t,left:r,right:a}=e.node;if(t!=="in")return;if(!s.types.isPrivateName(r))return;const{privateFieldsAsProperties:n,privateNamesMap:o,redeclared:i}=this;const{name:l}=r.id;if(!o.has(l))return;if(i&&i.includes(l))return;if(n){const{id:t}=o.get(l);e.replaceWith(s.template.expression.ast` + `;if(!c){m.arguments[1].body.directives.push(s.types.directive(s.types.directiveLiteral("use strict")))}let y=m;let g="arguments.1.body.body.0";if(l){y=s.template.statement.ast`let ${e} = ${m}`;g="declarations.0.init."+g}return{instanceNodes:[s.template.statement.ast`${s.types.cloneNode(i)}(this)`],wrapClass(e){e.replaceWith(y);return e.get(g)}}}},5123:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.enableFeature=enableFeature;t.isLoose=isLoose;t.verifyUsedFeatures=verifyUsedFeatures;t.FEATURES=void 0;var s=r(7055);const a=Object.freeze({fields:1<<1,privateMethods:1<<2,decorators:1<<3,privateIn:1<<4,staticBlocks:1<<5});t.FEATURES=a;const n=new Map([[a.fields,"@babel/plugin-proposal-class-properties"],[a.privateMethods,"@babel/plugin-proposal-private-methods"],[a.privateIn,"@babel/plugin-proposal-private-property-in-object"]]);const o="@babel/plugin-class-features/featuresKey";const i="@babel/plugin-class-features/looseKey";const l="@babel/plugin-class-features/looseLowPriorityKey/#__internal__@babel/preset-env__please-overwrite-loose-instead-of-throwing";function enableFeature(e,t,r){if(!hasFeature(e,t)||canIgnoreLoose(e,t)){e.set(o,e.get(o)|t);if(r==="#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error"){setLoose(e,t,true);e.set(l,e.get(l)|t)}else if(r==="#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"){setLoose(e,t,false);e.set(l,e.get(l)|t)}else{setLoose(e,t,r)}}let s;let a;for(const[t,r]of n){if(!hasFeature(e,t))continue;const n=isLoose(e,t);if(canIgnoreLoose(e,t)){continue}else if(s===!n){throw new Error("'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, "+"@babel/plugin-proposal-private-methods and "+"@babel/plugin-proposal-private-property-in-object (when they are enabled).")}else{s=n;a=r}}if(s!==undefined){for(const[t,r]of n){if(hasFeature(e,t)&&isLoose(e,t)!==s){setLoose(e,t,s);console.warn(`Though the "loose" option was set to "${!s}" in your @babel/preset-env `+`config, it will not be used for ${r} since the "loose" mode option was set to `+`"${s}" for ${a}.\nThe "loose" option must be the `+`same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods `+`and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can `+`silence this warning by explicitly adding\n`+`\t["${r}", { "loose": ${s} }]\n`+`to the "plugins" section of your Babel config.`)}}}}function hasFeature(e,t){return!!(e.get(o)&t)}function isLoose(e,t){return!!(e.get(i)&t)}function setLoose(e,t,r){if(r)e.set(i,e.get(i)|t);else e.set(i,e.get(i)&~t);e.set(l,e.get(l)&~t)}function canIgnoreLoose(e,t){return!!(e.get(l)&t)}function verifyUsedFeatures(e,t){if((0,s.hasOwnDecorators)(e.node)){if(!hasFeature(t,a.decorators)){throw e.buildCodeFrameError("Decorators are not enabled."+"\nIf you are using "+'["@babel/plugin-proposal-decorators", { "legacy": true }], '+'make sure it comes *before* "@babel/plugin-proposal-class-properties" '+"and enable loose mode, like so:\n"+'\t["@babel/plugin-proposal-decorators", { "legacy": true }]\n'+'\t["@babel/plugin-proposal-class-properties", { "loose": true }]')}if(e.isPrivate()){throw e.buildCodeFrameError(`Private ${e.isClassMethod()?"methods":"fields"} in decorated classes are not supported yet.`)}}if(e.isClassPrivateMethod!=null&&e.isClassPrivateMethod()){if(!hasFeature(t,a.privateMethods)){throw e.buildCodeFrameError("Class private methods are not enabled.")}}if(e.isPrivateName()&&e.parentPath.isBinaryExpression({operator:"in",left:e.node})){if(!hasFeature(t,a.privateIn)){throw e.buildCodeFrameError("Private property in checks are not enabled.")}}if(e.isProperty()){if(!hasFeature(t,a.fields)){throw e.buildCodeFrameError("Class fields are not enabled.")}}if(e.isStaticBlock!=null&&e.isStaticBlock()){if(!hasFeature(t,a.staticBlocks)){throw e.buildCodeFrameError("Static class blocks are not enabled. "+"Please add `@babel/plugin-proposal-class-static-block` to your configuration.")}}}},196:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.buildPrivateNamesMap=buildPrivateNamesMap;t.buildPrivateNamesNodes=buildPrivateNamesNodes;t.transformPrivateNamesUsage=transformPrivateNamesUsage;t.buildFieldsInitNodes=buildFieldsInitNodes;var s=r(8304);var a=r(4725);var n=r(5789);var o=r(6721);var i=r(2155);var l=r(5464);function buildPrivateNamesMap(e){const t=new Map;for(const r of e){if(r.isPrivate()){const{name:e}=r.node.key.id;const s=t.has(e)?t.get(e):{id:r.scope.generateUidIdentifier(e),static:r.node.static,method:!r.isProperty()};if(r.isClassPrivateMethod()){if(r.node.kind==="get"){s.getId=r.scope.generateUidIdentifier(`get_${e}`)}else if(r.node.kind==="set"){s.setId=r.scope.generateUidIdentifier(`set_${e}`)}else if(r.node.kind==="method"){s.methodId=r.scope.generateUidIdentifier(e)}}t.set(e,s)}}return t}function buildPrivateNamesNodes(e,t,r){const a=[];for(const[n,o]of e){const{static:e,method:l,getId:c,setId:u}=o;const p=c||u;const d=s.types.cloneNode(o.id);let f;if(t){f=s.types.callExpression(r.addHelper("classPrivateFieldLooseKey"),[s.types.stringLiteral(n)])}else if(!e){f=s.types.newExpression(s.types.identifier(!l||p?"WeakMap":"WeakSet"),[])}if(f){(0,i.default)(f);a.push(s.template.statement.ast`var ${d} = ${f}`)}}return a}function privateNameVisitorFactory(e){const t=Object.assign({},e,{Class(e){const{privateNamesMap:s}=this;const a=e.get("body.body");const n=new Map(s);const o=[];for(const e of a){if(!e.isPrivate())continue;const{name:t}=e.node.key.id;n.delete(t);o.push(t)}if(!o.length){return}e.get("body").traverse(r,Object.assign({},this,{redeclared:o}));e.traverse(t,Object.assign({},this,{privateNamesMap:n}));e.skipKey("body")}});const r=s.traverse.visitors.merge([Object.assign({},e),a.environmentVisitor]);return t}const c=privateNameVisitorFactory({PrivateName(e,{noDocumentAll:t}){const{privateNamesMap:r,redeclared:s}=this;const{node:a,parentPath:n}=e;if(!n.isMemberExpression({property:a})&&!n.isOptionalMemberExpression({property:a})){return}const{name:o}=a.id;if(!r.has(o))return;if(s&&s.includes(o))return;this.handle(n,t)}});const u=privateNameVisitorFactory({BinaryExpression(e){const{operator:t,left:r,right:a}=e.node;if(t!=="in")return;if(!s.types.isPrivateName(r))return;const{privateFieldsAsProperties:n,privateNamesMap:o,redeclared:i}=this;const{name:l}=r.id;if(!o.has(l))return;if(i&&i.includes(l))return;if(n){const{id:t}=o.get(l);e.replaceWith(s.template.expression.ast` Object.prototype.hasOwnProperty.call(${a}, ${s.types.cloneNode(t)}) - `);return}const{id:c,static:u}=o.get(l);if(u){e.replaceWith(s.template.expression.ast`${a} === ${this.classRef}`);return}e.replaceWith(s.template.expression.ast`${s.types.cloneNode(c)}.has(${a})`)}});const p={memoise(e,t){const{scope:r}=e;const{object:s}=e.node;const a=r.maybeGenerateMemoised(s);if(!a){return}this.memoiser.set(s,a,t)},receiver(e){const{object:t}=e.node;if(this.memoiser.has(t)){return s.types.cloneNode(this.memoiser.get(t))}return s.types.cloneNode(t)},get(e){const{classRef:t,privateNamesMap:r,file:a}=this;const{name:n}=e.node.property.id;const{id:o,static:i,method:l,methodId:c,getId:u,setId:p}=r.get(n);const f=u||p;if(i){const r=l&&!f?"classStaticPrivateMethodGet":"classStaticPrivateFieldSpecGet";return s.types.callExpression(a.addHelper(r),[this.receiver(e),s.types.cloneNode(t),s.types.cloneNode(o)])}if(l){if(f){if(!u&&p){if(a.availableHelper("writeOnlyError")){return s.types.sequenceExpression([this.receiver(e),s.types.callExpression(a.addHelper("writeOnlyError"),[s.types.stringLiteral(`#${n}`)])])}console.warn(`@babel/helpers is outdated, update it to silence this warning.`)}return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])}return s.types.callExpression(a.addHelper("classPrivateMethodGet"),[this.receiver(e),s.types.cloneNode(o),s.types.cloneNode(c)])}return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])},boundGet(e){this.memoise(e,1);return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[this.receiver(e)])},set(e,t){const{classRef:r,privateNamesMap:a,file:n}=this;const{name:o}=e.node.property.id;const{id:i,static:l,method:c,setId:u,getId:p}=a.get(o);const f=p||u;if(l){const a=c&&!f?"classStaticPrivateMethodSet":"classStaticPrivateFieldSpecSet";return s.types.callExpression(n.addHelper(a),[this.receiver(e),s.types.cloneNode(r),s.types.cloneNode(i),t])}if(c){if(u){return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])}return s.types.sequenceExpression([this.receiver(e),t,s.types.callExpression(n.addHelper("readOnlyError"),[s.types.stringLiteral(`#${o}`)])])}return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])},destructureSet(e){const{classRef:t,privateNamesMap:r,file:a}=this;const{name:n}=e.node.property.id;const{id:o,static:i}=r.get(n);if(i){try{var l=a.addHelper("classStaticPrivateFieldDestructureSet")}catch(e){throw new Error("Babel can not transpile `[C.#p] = [0]` with @babel/helpers < 7.13.10, \n"+"please update @babel/helpers to the latest version.")}return s.types.memberExpression(s.types.callExpression(l,[this.receiver(e),s.types.cloneNode(t),s.types.cloneNode(o)]),s.types.identifier("value"))}return s.types.memberExpression(s.types.callExpression(a.addHelper("classPrivateFieldDestructureSet"),[this.receiver(e),s.types.cloneNode(o)]),s.types.identifier("value"))},call(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,false)},optionalCall(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,true)}};const f={get(e){const{privateNamesMap:t,file:r}=this;const{object:a}=e.node;const{name:n}=e.node.property.id;return s.template.expression`BASE(REF, PROP)[PROP]`({BASE:r.addHelper("classPrivateFieldLooseBase"),REF:s.types.cloneNode(a),PROP:s.types.cloneNode(t.get(n).id)})},set(){throw new Error("private name handler with loose = true don't need set()")},boundGet(e){return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[s.types.cloneNode(e.node.object)])},simpleSet(e){return this.get(e)},destructureSet(e){return this.get(e)},call(e,t){return s.types.callExpression(this.get(e),t)},optionalCall(e,t){return s.types.optionalCallExpression(this.get(e),t,true)}};function transformPrivateNamesUsage(e,t,r,{privateFieldsAsProperties:s,noDocumentAll:a},o){if(!r.size)return;const i=t.get("body");const l=s?f:p;(0,n.default)(i,c,Object.assign({privateNamesMap:r,classRef:e,file:o},l,{noDocumentAll:a}));i.traverse(u,{privateNamesMap:r,classRef:e,file:o,privateFieldsAsProperties:s})}function buildPrivateFieldInitLoose(e,t,r){const{id:a}=r.get(t.node.key.id.name);const n=t.node.value||t.scope.buildUndefinedNode();return s.template.statement.ast` + `);return}const{id:c,static:u}=o.get(l);if(u){e.replaceWith(s.template.expression.ast`${a} === ${this.classRef}`);return}e.replaceWith(s.template.expression.ast`${s.types.cloneNode(c)}.has(${a})`)}});const p={memoise(e,t){const{scope:r}=e;const{object:s}=e.node;const a=r.maybeGenerateMemoised(s);if(!a){return}this.memoiser.set(s,a,t)},receiver(e){const{object:t}=e.node;if(this.memoiser.has(t)){return s.types.cloneNode(this.memoiser.get(t))}return s.types.cloneNode(t)},get(e){const{classRef:t,privateNamesMap:r,file:a}=this;const{name:n}=e.node.property.id;const{id:o,static:i,method:l,methodId:c,getId:u,setId:p}=r.get(n);const d=u||p;if(i){const r=l&&!d?"classStaticPrivateMethodGet":"classStaticPrivateFieldSpecGet";return s.types.callExpression(a.addHelper(r),[this.receiver(e),s.types.cloneNode(t),s.types.cloneNode(o)])}if(l){if(d){if(!u&&p){if(a.availableHelper("writeOnlyError")){return s.types.sequenceExpression([this.receiver(e),s.types.callExpression(a.addHelper("writeOnlyError"),[s.types.stringLiteral(`#${n}`)])])}console.warn(`@babel/helpers is outdated, update it to silence this warning.`)}return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])}return s.types.callExpression(a.addHelper("classPrivateMethodGet"),[this.receiver(e),s.types.cloneNode(o),s.types.cloneNode(c)])}return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])},boundGet(e){this.memoise(e,1);return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[this.receiver(e)])},set(e,t){const{classRef:r,privateNamesMap:a,file:n}=this;const{name:o}=e.node.property.id;const{id:i,static:l,method:c,setId:u,getId:p}=a.get(o);const d=p||u;if(l){const a=c&&!d?"classStaticPrivateMethodSet":"classStaticPrivateFieldSpecSet";return s.types.callExpression(n.addHelper(a),[this.receiver(e),s.types.cloneNode(r),s.types.cloneNode(i),t])}if(c){if(u){return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])}return s.types.sequenceExpression([this.receiver(e),t,s.types.callExpression(n.addHelper("readOnlyError"),[s.types.stringLiteral(`#${o}`)])])}return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])},destructureSet(e){const{classRef:t,privateNamesMap:r,file:a}=this;const{name:n}=e.node.property.id;const{id:o,static:i}=r.get(n);if(i){try{var l=a.addHelper("classStaticPrivateFieldDestructureSet")}catch(e){throw new Error("Babel can not transpile `[C.#p] = [0]` with @babel/helpers < 7.13.10, \n"+"please update @babel/helpers to the latest version.")}return s.types.memberExpression(s.types.callExpression(l,[this.receiver(e),s.types.cloneNode(t),s.types.cloneNode(o)]),s.types.identifier("value"))}return s.types.memberExpression(s.types.callExpression(a.addHelper("classPrivateFieldDestructureSet"),[this.receiver(e),s.types.cloneNode(o)]),s.types.identifier("value"))},call(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,false)},optionalCall(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,true)}};const d={get(e){const{privateNamesMap:t,file:r}=this;const{object:a}=e.node;const{name:n}=e.node.property.id;return s.template.expression`BASE(REF, PROP)[PROP]`({BASE:r.addHelper("classPrivateFieldLooseBase"),REF:s.types.cloneNode(a),PROP:s.types.cloneNode(t.get(n).id)})},set(){throw new Error("private name handler with loose = true don't need set()")},boundGet(e){return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[s.types.cloneNode(e.node.object)])},simpleSet(e){return this.get(e)},destructureSet(e){return this.get(e)},call(e,t){return s.types.callExpression(this.get(e),t)},optionalCall(e,t){return s.types.optionalCallExpression(this.get(e),t,true)}};function transformPrivateNamesUsage(e,t,r,{privateFieldsAsProperties:s,noDocumentAll:a},o){if(!r.size)return;const i=t.get("body");const l=s?d:p;(0,n.default)(i,c,Object.assign({privateNamesMap:r,classRef:e,file:o},l,{noDocumentAll:a}));i.traverse(u,{privateNamesMap:r,classRef:e,file:o,privateFieldsAsProperties:s})}function buildPrivateFieldInitLoose(e,t,r){const{id:a}=r.get(t.node.key.id.name);const n=t.node.value||t.scope.buildUndefinedNode();return s.template.statement.ast` Object.defineProperty(${e}, ${s.types.cloneNode(a)}, { // configurable is false by default // enumerable is false by default @@ -443,7 +518,7 @@ // writable is false by default value: ${i.name} }); - `}function buildPrivateMethodDeclaration(e,t,r=false){const a=t.get(e.node.key.id.name);const{id:n,methodId:o,getId:i,setId:l,getterDeclared:c,setterDeclared:u,static:p}=a;const{params:f,body:d,generator:m,async:y}=e.node;const g=i&&!c&&f.length===0;const h=l&&!u&&f.length>0;let b=o;if(g){t.set(e.node.key.id.name,Object.assign({},a,{getterDeclared:true}));b=i}else if(h){t.set(e.node.key.id.name,Object.assign({},a,{setterDeclared:true}));b=l}else if(p&&!r){b=n}return s.types.functionDeclaration(s.types.cloneNode(b),f,d,m,y)}const d=s.traverse.visitors.merge([{ThisExpression(e,t){t.needsClassRef=true;e.replaceWith(s.types.cloneNode(t.classRef))},MetaProperty(e){const t=e.get("meta");const r=e.get("property");const{scope:s}=e;if(t.isIdentifier({name:"new"})&&r.isIdentifier({name:"target"})){e.replaceWith(s.buildUndefinedNode())}}},a.environmentVisitor]);const m={ReferencedIdentifier(e,t){if(e.scope.bindingIdentifierEquals(e.node.name,t.innerBinding)){t.needsClassRef=true;e.node.name=t.classRef.name}}};function replaceThisContext(e,t,r,n,o,i,l){var c;const u={classRef:t,needsClassRef:false,innerBinding:l};const p=new a.default({methodPath:e,constantSuper:i,file:n,refToPreserve:t,getSuperRef:r,getObjectRef(){u.needsClassRef=true;return o||e.node.static?t:s.types.memberExpression(t,s.types.identifier("prototype"))}});p.replace();if(o||e.isProperty()){e.traverse(d,u)}if((c=u.classRef)!=null&&c.name&&u.classRef.name!==(l==null?void 0:l.name)){e.traverse(m,u)}return u.needsClassRef}function buildFieldsInitNodes(e,t,r,a,n,o,i,c,u){let p=false;let f;const d=[];const m=[];const y=[];const g=s.types.isIdentifier(t)?()=>t:()=>{var e;(e=f)!=null?e:f=r[0].scope.generateUidIdentifierBasedOnNode(t);return f};for(const t of r){t.isClassProperty()&&l.assertFieldTransformed(t);const r=t.node.static;const f=!r;const h=t.isPrivate();const b=!h;const x=t.isProperty();const v=!x;const E=t.isStaticBlock==null?void 0:t.isStaticBlock();if(r||v&&h||E){const r=replaceThisContext(t,e,g,n,E,c,u);p=p||r}switch(true){case E:d.push(s.template.statement.ast`(() => ${s.types.blockStatement(t.node.body)})()`);break;case r&&h&&x&&i:p=true;d.push(buildPrivateFieldInitLoose(s.types.cloneNode(e),t,a));break;case r&&h&&x&&!i:p=true;d.push(buildPrivateStaticFieldInitSpec(t,a));break;case r&&b&&x&&o:p=true;d.push(buildPublicFieldInitLoose(s.types.cloneNode(e),t));break;case r&&b&&x&&!o:p=true;d.push(buildPublicFieldInitSpec(s.types.cloneNode(e),t,n));break;case f&&h&&x&&i:m.push(buildPrivateFieldInitLoose(s.types.thisExpression(),t,a));break;case f&&h&&x&&!i:m.push(buildPrivateInstanceFieldInitSpec(s.types.thisExpression(),t,a));break;case f&&h&&v&&i:m.unshift(buildPrivateMethodInitLoose(s.types.thisExpression(),t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case f&&h&&v&&!i:m.unshift(buildPrivateInstanceMethodInitSpec(s.types.thisExpression(),t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case r&&h&&v&&!i:p=true;d.unshift(buildPrivateStaticFieldInitSpec(t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case r&&h&&v&&i:p=true;d.unshift(buildPrivateStaticMethodInitLoose(s.types.cloneNode(e),t,n,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case f&&b&&x&&o:m.push(buildPublicFieldInitLoose(s.types.thisExpression(),t));break;case f&&b&&x&&!o:m.push(buildPublicFieldInitSpec(s.types.thisExpression(),t,n));break;default:throw new Error("Unreachable.")}}return{staticNodes:d.filter(Boolean),instanceNodes:m.filter(Boolean),pureStaticNodes:y.filter(Boolean),wrapClass(t){for(const e of r){e.remove()}if(f){t.scope.push({id:s.types.cloneNode(f)});t.set("superClass",s.types.assignmentExpression("=",f,t.node.superClass))}if(!p)return t;if(t.isClassExpression()){t.scope.push({id:e});t.replaceWith(s.types.assignmentExpression("=",s.types.cloneNode(e),t.node))}else if(!t.node.id){t.node.id=e}return t}}}},738:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.createClassFeaturePlugin=createClassFeaturePlugin;Object.defineProperty(t,"injectInitialization",{enumerable:true,get:function(){return l.injectInitialization}});Object.defineProperty(t,"enableFeature",{enumerable:true,get:function(){return c.enableFeature}});Object.defineProperty(t,"FEATURES",{enumerable:true,get:function(){return c.FEATURES}});var s=r(8304);var a=r(550);var n=r(7058);var o=r(196);var i=r(7055);var l=r(3235);var c=r(5123);const u="7.15.0".split(".").reduce(((e,t)=>e*1e5+ +t),0);const p="@babel/plugin-class-features/version";function createClassFeaturePlugin({name:e,feature:t,loose:r,manipulateOptions:f,api:d={assumption:()=>void 0}}){const m=d.assumption("setPublicClassFields");const y=d.assumption("privateFieldsAsProperties");const g=d.assumption("constantSuper");const h=d.assumption("noDocumentAll");if(r===true){const t=[];if(m!==undefined){t.push(`"setPublicClassFields"`)}if(y!==undefined){t.push(`"privateFieldsAsProperties"`)}if(t.length!==0){console.warn(`[${e}]: You are using the "loose: true" option and you are`+` explicitly setting a value for the ${t.join(" and ")}`+` assumption${t.length>1?"s":""}. The "loose" option`+` can cause incompatibilities with the other class features`+` plugins, so it's recommended that you replace it with the`+` following top-level option:\n`+`\t"assumptions": {\n`+`\t\t"setPublicClassFields": true,\n`+`\t\t"privateFieldsAsProperties": true\n`+`\t}`)}}return{name:e,manipulateOptions:f,pre(){(0,c.enableFeature)(this.file,t,r);if(!this.file.get(p)||this.file.get(p)0){(0,l.injectInitialization)(e,f,P,((e,t)=>{if(d)return;for(const r of b){if(r.node.static)continue;r.traverse(e,t)}}))}const A=C(e);A.insertBefore([...k,...O]);if(I.length>0){A.insertAfter(I)}if(D.length>0){A.find((e=>e.isStatement()||e.isDeclaration())).insertAfter(D)}},PrivateName(e){if(this.file.get(p)!==u||e.parentPath.isPrivate({key:e.node})){return}throw e.buildCodeFrameError(`Unknown PrivateName "${e}"`)},ExportDefaultDeclaration(e){if(this.file.get(p)!==u)return;const t=e.get("declaration");if(t.isClassDeclaration()&&(0,i.hasDecorators)(t.node)){if(t.node.id){(0,n.default)(e)}else{t.node.type="ClassExpression"}}}}}}},3235:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.injectInitialization=injectInitialization;t.extractComputedKeys=extractComputedKeys;var s=r(8304);var a=r(4725);const n=s.traverse.visitors.merge([{Super(e){const{node:t,parentPath:r}=e;if(r.isCallExpression({callee:t})){this.push(r)}}},a.environmentVisitor]);const o={"TSTypeAnnotation|TypeAnnotation"(e){e.skip()},ReferencedIdentifier(e){if(this.scope.hasOwnBinding(e.node.name)){this.scope.rename(e.node.name);e.skip()}}};function handleClassTDZ(e,t){if(t.classBinding&&t.classBinding===e.scope.getBinding(e.node.name)){const r=t.file.addHelper("classNameTDZError");const a=s.types.callExpression(r,[s.types.stringLiteral(e.node.name)]);e.replaceWith(s.types.sequenceExpression([a,e.node]));e.skip()}}const i={ReferencedIdentifier:handleClassTDZ};function injectInitialization(e,t,r,a){if(!r.length)return;const i=!!e.node.superClass;if(!t){const r=s.types.classMethod("constructor",s.types.identifier("constructor"),[],s.types.blockStatement([]));if(i){r.params=[s.types.restElement(s.types.identifier("args"))];r.body.body.push(s.template.statement.ast`super(...args)`)}[t]=e.get("body").unshiftContainer("body",r)}if(a){a(o,{scope:t.scope})}if(i){const e=[];t.traverse(n,e);let a=true;for(const t of e){if(a){t.insertAfter(r);a=false}else{t.insertAfter(r.map((e=>s.types.cloneNode(e))))}}}else{t.get("body").unshiftContainer("body",r)}}function extractComputedKeys(e,t,r,a){const n=[];const o={classBinding:t.node.id&&t.scope.getBinding(t.node.id.name),file:a};for(const e of r){const r=e.get("key");if(r.isReferencedIdentifier()){handleClassTDZ(r,o)}else{r.traverse(i,o)}const a=e.node;if(!r.isConstantExpression()){const e=t.scope.generateUidIdentifierBasedOnNode(a.key);t.scope.push({id:e,kind:"let"});n.push(s.types.expressionStatement(s.types.assignmentExpression("=",s.types.cloneNode(e),a.key)));a.key=s.types.cloneNode(e)}}return n}},5464:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.assertFieldTransformed=assertFieldTransformed;function assertFieldTransformed(e){if(e.node.declare){throw e.buildCodeFrameError(`TypeScript 'declare' fields must first be transformed by `+`@babel/plugin-transform-typescript.\n`+`If you have already enabled that plugin (or '@babel/preset-typescript'), make sure `+`that it runs before any plugin related to additional class features:\n`+` - @babel/plugin-proposal-class-properties\n`+` - @babel/plugin-proposal-private-methods\n`+` - @babel/plugin-proposal-decorators`)}}},4725:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.skipAllButComputedKey=skipAllButComputedKey;t["default"]=t.environmentVisitor=void 0;var s=r(7369);var a=r(5789);var n=r(6721);var o=r(8622);function getPrototypeOfExpression(e,t,r,s){e=o.cloneNode(e);const a=t||s?e:o.memberExpression(e,o.identifier("prototype"));return o.callExpression(r.addHelper("getPrototypeOf"),[a])}function skipAllButComputedKey(e){if(!e.node.computed){e.skip();return}const t=o.VISITOR_KEYS[e.type];for(const r of t){if(r!=="key")e.skipKey(r)}}const i={[`${o.staticBlock?"StaticBlock|":""}ClassPrivateProperty|TypeAnnotation`](e){e.skip()},Function(e){if(e.isMethod())return;if(e.isArrowFunctionExpression())return;e.skip()},"Method|ClassProperty"(e){skipAllButComputedKey(e)}};t.environmentVisitor=i;const l=s.default.visitors.merge([i,{Super(e,t){const{node:r,parentPath:s}=e;if(!s.isMemberExpression({object:r}))return;t.handle(s)}}]);const c=s.default.visitors.merge([i,{Scopable(e,{refName:t}){const r=e.scope.getOwnBinding(t);if(r&&r.identifier.name===t){e.scope.rename(t)}}}]);const u={memoise(e,t){const{scope:r,node:s}=e;const{computed:a,property:n}=s;if(!a){return}const o=r.maybeGenerateMemoised(n);if(!o){return}this.memoiser.set(n,o,t)},prop(e){const{computed:t,property:r}=e.node;if(this.memoiser.has(r)){return o.cloneNode(this.memoiser.get(r))}if(t){return o.cloneNode(r)}return o.stringLiteral(r.name)},get(e){return this._get(e,this._getThisRefs())},_get(e,t){const r=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("get"),[t.memo?o.sequenceExpression([t.memo,r]):r,this.prop(e),t.this])},_getThisRefs(){if(!this.isDerivedConstructor){return{this:o.thisExpression()}}const e=this.scope.generateDeclaredUidIdentifier("thisSuper");return{memo:o.assignmentExpression("=",e,o.thisExpression()),this:o.cloneNode(e)}},set(e,t){const r=this._getThisRefs();const s=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("set"),[r.memo?o.sequenceExpression([r.memo,s]):s,this.prop(e),t,r.this,o.booleanLiteral(e.isInStrictMode())])},destructureSet(e){throw e.buildCodeFrameError(`Destructuring to a super field is not supported yet.`)},call(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,false)},optionalCall(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,true)}};const p=Object.assign({},u,{prop(e){const{property:t}=e.node;if(this.memoiser.has(t)){return o.cloneNode(this.memoiser.get(t))}return o.cloneNode(t)},get(e){const{isStatic:t,getSuperRef:r}=this;const{computed:s}=e.node;const a=this.prop(e);let n;if(t){var i;n=(i=r())!=null?i:o.memberExpression(o.identifier("Function"),o.identifier("prototype"))}else{var l;n=o.memberExpression((l=r())!=null?l:o.identifier("Object"),o.identifier("prototype"))}return o.memberExpression(n,a,s)},set(e,t){const{computed:r}=e.node;const s=this.prop(e);return o.assignmentExpression("=",o.memberExpression(o.thisExpression(),s,r),t)},destructureSet(e){const{computed:t}=e.node;const r=this.prop(e);return o.memberExpression(o.thisExpression(),r,t)},call(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,false)},optionalCall(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,true)}});class ReplaceSupers{constructor(e){var t;const r=e.methodPath;this.methodPath=r;this.isDerivedConstructor=r.isClassMethod({kind:"constructor"})&&!!e.superRef;this.isStatic=r.isObjectMethod()||r.node.static||(r.isStaticBlock==null?void 0:r.isStaticBlock());this.isPrivateMethod=r.isPrivate()&&r.isMethod();this.file=e.file;this.constantSuper=(t=e.constantSuper)!=null?t:e.isLoose;this.opts=e}getObjectRef(){return o.cloneNode(this.opts.objectRef||this.opts.getObjectRef())}getSuperRef(){if(this.opts.superRef)return o.cloneNode(this.opts.superRef);if(this.opts.getSuperRef)return o.cloneNode(this.opts.getSuperRef())}replace(){if(this.opts.refToPreserve){this.methodPath.traverse(c,{refName:this.opts.refToPreserve.name})}const e=this.constantSuper?p:u;(0,a.default)(this.methodPath,l,Object.assign({file:this.file,scope:this.methodPath.scope,isDerivedConstructor:this.isDerivedConstructor,isStatic:this.isStatic,isPrivateMethod:this.isPrivateMethod,getObjectRef:this.getObjectRef.bind(this),getSuperRef:this.getSuperRef.bind(this),boundGet:e.get},e))}}t["default"]=ReplaceSupers},4951:e=>{const t=new Set(["proposal-class-static-block"]);const r={"proposal-async-generator-functions":"syntax-async-generators","proposal-class-properties":"syntax-class-properties","proposal-class-static-block":"syntax-class-static-block","proposal-json-strings":"syntax-json-strings","proposal-nullish-coalescing-operator":"syntax-nullish-coalescing-operator","proposal-numeric-separator":"syntax-numeric-separator","proposal-object-rest-spread":"syntax-object-rest-spread","proposal-optional-catch-binding":"syntax-optional-catch-binding","proposal-optional-chaining":"syntax-optional-chaining","proposal-private-methods":"syntax-class-properties","proposal-private-property-in-object":"syntax-private-property-in-object","proposal-unicode-property-regex":null};const s=Object.keys(r).map((function(e){return[e,r[e]]}));const a=new Map(s);e.exports={pluginSyntaxMap:a,proposalPlugins:t}},9199:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.minVersions=t["default"]=void 0;var s=r(1079);var a=r(947);var n=r(8142);var o=r(5163);var i=r(1454);var l=r(3030);var c=r(5945);var u=r(5879);var p=r(1816);var f=r(4499);var d=r(7452);var m=r(79);var y=r(7445);var g=r(4893);var h=r(2271);var b=r(8027);var x=r(5557);var v=r(4920);var E=r(9579);var j=r(7703);var w=r(1195);var _=r(5353);var S=r(7300);var k=r(6309);var O=r(4195);var I=r(7490);var P=r(9062);var D=r(3181);var C=r(6092);var A=r(6413);var R=r(513);var N=r(8363);var M=r(1630);var L=r(6408);var F=r(8120);var B=r(5157);var W=r(5843);var U=r(7850);var V=r(1176);var $=r(9488);var q=r(715);var G=r(5072);var H=r(4674);var z=r(8657);var K=r(6186);var X=r(730);var Y=r(9942);var J=r(8447);var Z=r(9545);var Q=r(570);var ee=r(3714);var te=r(2970);var re=r(5628);var se=r(8720);var ae=r(8648);var ne=r(8476);var oe=r(1245);var ie=r(5356);var le=r(5502);var ce=r(3448);var ue=r(4122);var pe=r(9453);var fe=r(489);var de=r(3258);var me=r(3744);var ye=r(5899);var ge=r(6668);var he=r(1626);var be={"bugfix/transform-async-arrows-in-class":()=>pe,"bugfix/transform-edge-default-parameters":()=>fe,"bugfix/transform-edge-function-name":()=>de,"bugfix/transform-safari-block-shadowing":()=>ye,"bugfix/transform-safari-for-shadowing":()=>ge,"bugfix/transform-tagged-template-caching":()=>me,"bugfix/transform-v8-spread-parameters-in-optional-chaining":()=>he.default,"proposal-async-generator-functions":()=>h.default,"proposal-class-properties":()=>b.default,"proposal-class-static-block":()=>x.default,"proposal-dynamic-import":()=>v.default,"proposal-export-namespace-from":()=>E.default,"proposal-json-strings":()=>j.default,"proposal-logical-assignment-operators":()=>w.default,"proposal-nullish-coalescing-operator":()=>_.default,"proposal-numeric-separator":()=>S.default,"proposal-object-rest-spread":()=>k.default,"proposal-optional-catch-binding":()=>O.default,"proposal-optional-chaining":()=>I.default,"proposal-private-methods":()=>P.default,"proposal-private-property-in-object":()=>D.default,"proposal-unicode-property-regex":()=>C.default,"syntax-async-generators":()=>s,"syntax-class-properties":()=>a,"syntax-class-static-block":()=>n.default,"syntax-dynamic-import":()=>o,"syntax-export-namespace-from":()=>i,"syntax-json-strings":()=>l,"syntax-logical-assignment-operators":()=>c,"syntax-nullish-coalescing-operator":()=>u,"syntax-numeric-separator":()=>p,"syntax-object-rest-spread":()=>f,"syntax-optional-catch-binding":()=>d,"syntax-optional-chaining":()=>m,"syntax-private-property-in-object":()=>y.default,"syntax-top-level-await":()=>g.default,"transform-arrow-functions":()=>R.default,"transform-async-to-generator":()=>A.default,"transform-block-scoped-functions":()=>N.default,"transform-block-scoping":()=>M.default,"transform-classes":()=>L.default,"transform-computed-properties":()=>F.default,"transform-destructuring":()=>B.default,"transform-dotall-regex":()=>W.default,"transform-duplicate-keys":()=>U.default,"transform-exponentiation-operator":()=>V.default,"transform-for-of":()=>$.default,"transform-function-name":()=>q.default,"transform-literals":()=>G.default,"transform-member-expression-literals":()=>H.default,"transform-modules-amd":()=>z.default,"transform-modules-commonjs":()=>K.default,"transform-modules-systemjs":()=>X.default,"transform-modules-umd":()=>Y.default,"transform-named-capturing-groups-regex":()=>J.default,"transform-new-target":()=>Z.default,"transform-object-super":()=>Q.default,"transform-parameters":()=>ee.default,"transform-property-literals":()=>te.default,"transform-regenerator":()=>re.default,"transform-reserved-words":()=>se.default,"transform-shorthand-properties":()=>ae.default,"transform-spread":()=>ne.default,"transform-sticky-regex":()=>oe.default,"transform-template-literals":()=>ie.default,"transform-typeof-symbol":()=>le.default,"transform-unicode-escapes":()=>ce.default,"transform-unicode-regex":()=>ue.default};t["default"]=be;const xe={"proposal-class-static-block":"7.12.0","proposal-private-property-in-object":"7.10.0"};t.minVersions=xe},4188:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.logPlugin=void 0;var s=r(4413);const logPlugin=(e,t,r)=>{const a=(0,s.getInclusionReasons)(e,t,r);const n=r[e];if(!n){console.log(` ${e}`);return}let o=`{`;let i=true;for(const e of Object.keys(a)){if(!i)o+=`,`;i=false;o+=` ${e}`;if(n[e])o+=` < ${n[e]}`}o+=` }`;console.log(` ${e} ${o}`)};t.logPlugin=logPlugin},2709:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.removeUnnecessaryItems=removeUnnecessaryItems;t.removeUnsupportedItems=removeUnsupportedItems;var s=r(7849);var a=r(9199);const n=Function.call.bind(Object.hasOwnProperty);function removeUnnecessaryItems(e,t){e.forEach((r=>{var s;(s=t[r])==null?void 0:s.forEach((t=>e.delete(t)))}))}function removeUnsupportedItems(e,t){e.forEach((r=>{if(n(a.minVersions,r)&&(0,s.lt)(t,a.minVersions[r])){e.delete(r)}}))}},2196:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;const r=["transform-typeof-symbol"];function _default({loose:e}){return e?r:null}},9290:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isPluginRequired=isPluginRequired;t["default"]=t.getPolyfillPlugins=t.getModulesPluginNames=t.transformIncludesAndExcludes=void 0;var s=r(7849);var a=r(4188);var n=r(2196);var o=r(2709);var i=r(7538);var l=r(4820);var c=r(4951);var u=r(1119);var p=r(7363);var f=r(8170);var d=r(3867);var m=r(9897);var y=r(5825);var g=r(7973);var h=r(4413);var b=r(9199);var x=r(558);const v=m.default||m;const E=y.default||y;const j=g.default||g;function isPluginRequired(e,t){return(0,h.isRequired)("fake-name",e,{compatData:{"fake-name":t}})}function filterStageFromList(e,t){return Object.keys(e).reduce(((r,s)=>{if(!t.has(s)){r[s]=e[s]}return r}),{})}const w={withProposals:{withoutBugfixes:u.plugins,withBugfixes:Object.assign({},u.plugins,u.pluginsBugfixes)},withoutProposals:{withoutBugfixes:filterStageFromList(u.plugins,c.proposalPlugins),withBugfixes:filterStageFromList(Object.assign({},u.plugins,u.pluginsBugfixes),c.proposalPlugins)}};function getPluginList(e,t){if(e){if(t)return w.withProposals.withBugfixes;else return w.withProposals.withoutBugfixes}else{if(t)return w.withoutProposals.withBugfixes;else return w.withoutProposals.withoutBugfixes}}const getPlugin=e=>{const t=b.default[e]();if(!t){throw new Error(`Could not find plugin "${e}". Ensure there is an entry in ./available-plugins.js for it.`)}return t};const transformIncludesAndExcludes=e=>e.reduce(((e,t)=>{const r=t.match(/^(es|es6|es7|esnext|web)\./)?"builtIns":"plugins";e[r].add(t);return e}),{all:e,plugins:new Set,builtIns:new Set});t.transformIncludesAndExcludes=transformIncludesAndExcludes;const getModulesPluginNames=({modules:e,transformations:t,shouldTransformESM:r,shouldTransformDynamicImport:s,shouldTransformExportNamespaceFrom:a,shouldParseTopLevelAwait:n})=>{const o=[];if(e!==false&&t[e]){if(r){o.push(t[e])}if(s&&r&&e!=="umd"){o.push("proposal-dynamic-import")}else{if(s){console.warn("Dynamic import can only be supported when transforming ES modules"+" to AMD, CommonJS or SystemJS. Only the parser plugin will be enabled.")}o.push("syntax-dynamic-import")}}else{o.push("syntax-dynamic-import")}if(a){o.push("proposal-export-namespace-from")}else{o.push("syntax-export-namespace-from")}if(n){o.push("syntax-top-level-await")}return o};t.getModulesPluginNames=getModulesPluginNames;const getPolyfillPlugins=({useBuiltIns:e,corejs:t,polyfillTargets:r,include:s,exclude:a,proposals:n,shippedProposals:o,regenerator:i,debug:l})=>{const c=[];if(e==="usage"||e==="entry"){const u={method:`${e}-global`,version:t?t.toString():undefined,targets:r,include:s,exclude:a,proposals:n,shippedProposals:o,debug:l};if(t){if(e==="usage"){if(t.major===2){c.push([v,u],[d.default,{usage:true}])}else{c.push([E,u],[d.default,{usage:true,deprecated:true}])}if(i){c.push([j,{method:"usage-global",debug:l}])}}else{if(t.major===2){c.push([d.default,{regenerator:i}],[v,u])}else{c.push([E,u],[d.default,{deprecated:true}]);if(!i){c.push([f.default,u])}}}}}return c};t.getPolyfillPlugins=getPolyfillPlugins;function getLocalTargets(e,t,r,s){if(e!=null&&e.esmodules&&e.browsers){console.warn(`\n@babel/preset-env: esmodules and browsers targets have been specified together.\n\`browsers\` target, \`${e.browsers.toString()}\` will be ignored.\n`)}return(0,h.default)(e,{ignoreBrowserslistConfig:t,configPath:r,browserslistEnv:s})}function supportsStaticESM(e){return!!(e!=null&&e.supportsStaticESM)}function supportsDynamicImport(e){return!!(e!=null&&e.supportsDynamicImport)}function supportsExportNamespaceFrom(e){return!!(e!=null&&e.supportsExportNamespaceFrom)}function supportsTopLevelAwait(e){return!!(e!=null&&e.supportsTopLevelAwait)}var _=(0,x.declare)(((e,t)=>{e.assertVersion(7);const r=e.targets();const{bugfixes:u,configPath:f,debug:d,exclude:m,forceAllTransforms:y,ignoreBrowserslistConfig:g,include:b,loose:x,modules:v,shippedProposals:E,spec:j,targets:w,useBuiltIns:_,corejs:{version:S,proposals:k},browserslistEnv:O}=(0,l.default)(t);let I=r;if((0,s.lt)(e.version,"7.13.0")||t.targets||t.configPath||t.browserslistEnv||t.ignoreBrowserslistConfig){{var P=false;if(w!=null&&w.uglify){P=true;delete w.uglify;console.warn(`\nThe uglify target has been deprecated. Set the top level\noption \`forceAllTransforms: true\` instead.\n`)}}I=getLocalTargets(w,g,f,O)}const D=y||P?{}:I;const C=transformIncludesAndExcludes(b);const A=transformIncludesAndExcludes(m);const R=getPluginList(E,u);const N=v==="auto"&&(e.caller==null?void 0:e.caller(supportsExportNamespaceFrom))||v===false&&!(0,h.isRequired)("proposal-export-namespace-from",D,{compatData:R,includes:C.plugins,excludes:A.plugins});const M=getModulesPluginNames({modules:v,transformations:i.default,shouldTransformESM:v!=="auto"||!(e.caller!=null&&e.caller(supportsStaticESM)),shouldTransformDynamicImport:v!=="auto"||!(e.caller!=null&&e.caller(supportsDynamicImport)),shouldTransformExportNamespaceFrom:!N,shouldParseTopLevelAwait:!e.caller||e.caller(supportsTopLevelAwait)});const L=(0,h.filterItems)(R,C.plugins,A.plugins,D,M,(0,n.default)({loose:x}),c.pluginSyntaxMap);(0,o.removeUnnecessaryItems)(L,p);(0,o.removeUnsupportedItems)(L,e.version);const F=getPolyfillPlugins({useBuiltIns:_,corejs:S,polyfillTargets:I,include:C.builtIns,exclude:A.builtIns,proposals:k,shippedProposals:E,regenerator:L.has("transform-regenerator"),debug:d});const B=_!==false;const W=Array.from(L).map((e=>{if(e==="proposal-class-properties"||e==="proposal-private-methods"||e==="proposal-private-property-in-object"){return[getPlugin(e),{loose:x?"#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error":"#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"}]}return[getPlugin(e),{spec:j,loose:x,useBuiltIns:B}]})).concat(F);if(d){console.log("@babel/preset-env: `DEBUG` option");console.log("\nUsing targets:");console.log(JSON.stringify((0,h.prettifyTargets)(I),null,2));console.log(`\nUsing modules transform: ${v.toString()}`);console.log("\nUsing plugins:");L.forEach((e=>{(0,a.logPlugin)(e,I,R)}));if(!_){console.log("\nUsing polyfills: No polyfills were added, since the `useBuiltIns` option was not set.")}}return{plugins:W}}));t["default"]=_},7538:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var r={auto:"transform-modules-commonjs",amd:"transform-modules-amd",commonjs:"transform-modules-commonjs",cjs:"transform-modules-commonjs",systemjs:"transform-modules-systemjs",umd:"transform-modules-umd"};t["default"]=r},4820:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.normalizeCoreJSOption=normalizeCoreJSOption;t["default"]=normalizeOptions;t.validateUseBuiltInsOption=t.validateModulesOption=t.checkDuplicateIncludeExcludes=t.normalizePluginName=void 0;var s=r(6578);var a=r(7849);var n=r(2272);var o=r(1119);var i=r(7538);var l=r(7619);var c=r(7347);const u=["web.timers","web.immediate","web.dom.iterable"];const p=new c.OptionValidator("@babel/preset-env");const f=Object.keys(o.plugins);const d=["proposal-dynamic-import",...Object.keys(i.default).map((e=>i.default[e]))];const getValidIncludesAndExcludes=(e,t)=>new Set([...f,...e==="exclude"?d:[],...t?t==2?[...Object.keys(n),...u]:Object.keys(s):[]]);const pluginToRegExp=e=>{if(e instanceof RegExp)return e;try{return new RegExp(`^${normalizePluginName(e)}$`)}catch(e){return null}};const selectPlugins=(e,t,r)=>Array.from(getValidIncludesAndExcludes(t,r)).filter((t=>e instanceof RegExp&&e.test(t)));const flatten=e=>[].concat(...e);const expandIncludesAndExcludes=(e=[],t,r)=>{if(e.length===0)return[];const s=e.map((e=>selectPlugins(pluginToRegExp(e),t,r)));const a=e.filter(((e,t)=>s[t].length===0));p.invariant(a.length===0,`The plugins/built-ins '${a.join(", ")}' passed to the '${t}' option are not\n valid. Please check data/[plugin-features|built-in-features].js in babel-preset-env`);return flatten(s)};const normalizePluginName=e=>e.replace(/^(@babel\/|babel-)(plugin-)?/,"");t.normalizePluginName=normalizePluginName;const checkDuplicateIncludeExcludes=(e=[],t=[])=>{const r=e.filter((e=>t.indexOf(e)>=0));p.invariant(r.length===0,`The plugins/built-ins '${r.join(", ")}' were found in both the "include" and\n "exclude" options.`)};t.checkDuplicateIncludeExcludes=checkDuplicateIncludeExcludes;const normalizeTargets=e=>{if(typeof e==="string"||Array.isArray(e)){return{browsers:e}}return Object.assign({},e)};const validateModulesOption=(e=l.ModulesOption.auto)=>{p.invariant(l.ModulesOption[e.toString()]||e===l.ModulesOption.false,`The 'modules' option must be one of \n`+` - 'false' to indicate no module processing\n`+` - a specific module type: 'commonjs', 'amd', 'umd', 'systemjs'`+` - 'auto' (default) which will automatically select 'false' if the current\n`+` process is known to support ES module syntax, or "commonjs" otherwise\n`);return e};t.validateModulesOption=validateModulesOption;const validateUseBuiltInsOption=(e=false)=>{p.invariant(l.UseBuiltInsOption[e.toString()]||e===l.UseBuiltInsOption.false,`The 'useBuiltIns' option must be either\n 'false' (default) to indicate no polyfill,\n '"entry"' to indicate replacing the entry polyfill, or\n '"usage"' to import only used polyfills per file`);return e};t.validateUseBuiltInsOption=validateUseBuiltInsOption;function normalizeCoreJSOption(e,t){let r=false;let s;if(t&&e===undefined){s=2;console.warn("\nWARNING (@babel/preset-env): We noticed you're using the `useBuiltIns` option without declaring a "+"core-js version. Currently, we assume version 2.x when no version "+"is passed. Since this default version will likely change in future "+"versions of Babel, we recommend explicitly setting the core-js version "+"you are using via the `corejs` option.\n"+"\nYou should also be sure that the version you pass to the `corejs` "+"option matches the version specified in your `package.json`'s "+"`dependencies` section. If it doesn't, you need to run one of the "+"following commands:\n\n"+" npm install --save core-js@2 npm install --save core-js@3\n"+" yarn add core-js@2 yarn add core-js@3\n\n"+"More info about useBuiltIns: https://babeljs.io/docs/en/babel-preset-env#usebuiltins\n"+"More info about core-js: https://babeljs.io/docs/en/babel-preset-env#corejs")}else if(typeof e==="object"&&e!==null){s=e.version;r=Boolean(e.proposals)}else{s=e}const n=s?(0,a.coerce)(String(s)):false;if(!t&&n){console.warn("\nWARNING (@babel/preset-env): The `corejs` option only has an effect when the `useBuiltIns` option is not `false`\n")}if(t&&(!n||n.major<2||n.major>3)){throw new RangeError("Invalid Option: The version passed to `corejs` is invalid. Currently, "+"only core-js@2 and core-js@3 are supported.")}return{version:n,proposals:r}}function normalizeOptions(e){p.validateTopLevelOptions(e,l.TopLevelOptions);const t=validateUseBuiltInsOption(e.useBuiltIns);const r=normalizeCoreJSOption(e.corejs,t);const s=expandIncludesAndExcludes(e.include,l.TopLevelOptions.include,!!r.version&&r.version.major);const a=expandIncludesAndExcludes(e.exclude,l.TopLevelOptions.exclude,!!r.version&&r.version.major);checkDuplicateIncludeExcludes(s,a);return{bugfixes:p.validateBooleanOption(l.TopLevelOptions.bugfixes,e.bugfixes,false),configPath:p.validateStringOption(l.TopLevelOptions.configPath,e.configPath,process.cwd()),corejs:r,debug:p.validateBooleanOption(l.TopLevelOptions.debug,e.debug,false),include:s,exclude:a,forceAllTransforms:p.validateBooleanOption(l.TopLevelOptions.forceAllTransforms,e.forceAllTransforms,false),ignoreBrowserslistConfig:p.validateBooleanOption(l.TopLevelOptions.ignoreBrowserslistConfig,e.ignoreBrowserslistConfig,false),loose:p.validateBooleanOption(l.TopLevelOptions.loose,e.loose),modules:validateModulesOption(e.modules),shippedProposals:p.validateBooleanOption(l.TopLevelOptions.shippedProposals,e.shippedProposals,false),spec:p.validateBooleanOption(l.TopLevelOptions.spec,e.spec,false),targets:normalizeTargets(e.targets),useBuiltIns:t,browserslistEnv:p.validateStringOption(l.TopLevelOptions.browserslistEnv,e.browserslistEnv)}}},7619:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.UseBuiltInsOption=t.ModulesOption=t.TopLevelOptions=void 0;const r={bugfixes:"bugfixes",configPath:"configPath",corejs:"corejs",debug:"debug",exclude:"exclude",forceAllTransforms:"forceAllTransforms",ignoreBrowserslistConfig:"ignoreBrowserslistConfig",include:"include",loose:"loose",modules:"modules",shippedProposals:"shippedProposals",spec:"spec",targets:"targets",useBuiltIns:"useBuiltIns",browserslistEnv:"browserslistEnv"};t.TopLevelOptions=r;const s={false:false,auto:"auto",amd:"amd",commonjs:"commonjs",cjs:"cjs",systemjs:"systemjs",umd:"umd"};t.ModulesOption=s;const a={false:false,entry:"entry",usage:"usage"};t.UseBuiltInsOption=a},1119:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.pluginsBugfixes=t.plugins=void 0;var s=r(5884);var a=r(3574);var n=r(9199);const o={};t.plugins=o;const i={};t.pluginsBugfixes=i;for(const e of Object.keys(s)){if(Object.hasOwnProperty.call(n.default,e)){o[e]=s[e]}}for(const e of Object.keys(a)){if(Object.hasOwnProperty.call(n.default,e)){i[e]=a[e]}}o["proposal-class-properties"]=o["proposal-private-methods"]},3867:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(3931);var a=r(8622);const n=`\n \`@babel/polyfill\` is deprecated. Please, use required parts of \`core-js\`\n and \`regenerator-runtime/runtime\` separately`;const o=`\n When setting \`useBuiltIns: 'usage'\`, polyfills are automatically imported when needed.\n Please remove the direct import of \`SPECIFIER\` or use \`useBuiltIns: 'entry'\` instead.`;function _default({template:e},{regenerator:t,deprecated:r,usage:a}){return{name:"preset-env/replace-babel-polyfill",visitor:{ImportDeclaration(i){const l=(0,s.getImportSource)(i);if(a&&(0,s.isPolyfillSource)(l)){console.warn(o.replace("SPECIFIER",l));if(!r)i.remove()}else if(l==="@babel/polyfill"){if(r){console.warn(n)}else if(t){i.replaceWithMultiple(e.ast` + `}function buildPrivateMethodDeclaration(e,t,r=false){const a=t.get(e.node.key.id.name);const{id:n,methodId:o,getId:i,setId:l,getterDeclared:c,setterDeclared:u,static:p}=a;const{params:d,body:f,generator:m,async:y}=e.node;const g=i&&!c&&d.length===0;const h=l&&!u&&d.length>0;let b=o;if(g){t.set(e.node.key.id.name,Object.assign({},a,{getterDeclared:true}));b=i}else if(h){t.set(e.node.key.id.name,Object.assign({},a,{setterDeclared:true}));b=l}else if(p&&!r){b=n}return s.types.functionDeclaration(s.types.cloneNode(b),d,f,m,y)}const f=s.traverse.visitors.merge([{ThisExpression(e,t){t.needsClassRef=true;e.replaceWith(s.types.cloneNode(t.classRef))},MetaProperty(e){const t=e.get("meta");const r=e.get("property");const{scope:s}=e;if(t.isIdentifier({name:"new"})&&r.isIdentifier({name:"target"})){e.replaceWith(s.buildUndefinedNode())}}},a.environmentVisitor]);const m={ReferencedIdentifier(e,t){if(e.scope.bindingIdentifierEquals(e.node.name,t.innerBinding)){t.needsClassRef=true;e.node.name=t.classRef.name}}};function replaceThisContext(e,t,r,n,o,i,l){var c;const u={classRef:t,needsClassRef:false,innerBinding:l};const p=new a.default({methodPath:e,constantSuper:i,file:n,refToPreserve:t,getSuperRef:r,getObjectRef(){u.needsClassRef=true;return o||e.node.static?t:s.types.memberExpression(t,s.types.identifier("prototype"))}});p.replace();if(o||e.isProperty()){e.traverse(f,u)}if((c=u.classRef)!=null&&c.name&&u.classRef.name!==(l==null?void 0:l.name)){e.traverse(m,u)}return u.needsClassRef}function buildFieldsInitNodes(e,t,r,a,n,o,i,c,u){let p=false;let d;const f=[];const m=[];const y=[];const g=s.types.isIdentifier(t)?()=>t:()=>{var e;(e=d)!=null?e:d=r[0].scope.generateUidIdentifierBasedOnNode(t);return d};for(const t of r){t.isClassProperty()&&l.assertFieldTransformed(t);const r=t.node.static;const d=!r;const h=t.isPrivate();const b=!h;const x=t.isProperty();const v=!x;const E=t.isStaticBlock==null?void 0:t.isStaticBlock();if(r||v&&h||E){const r=replaceThisContext(t,e,g,n,E,c,u);p=p||r}switch(true){case E:f.push(s.template.statement.ast`(() => ${s.types.blockStatement(t.node.body)})()`);break;case r&&h&&x&&i:p=true;f.push(buildPrivateFieldInitLoose(s.types.cloneNode(e),t,a));break;case r&&h&&x&&!i:p=true;f.push(buildPrivateStaticFieldInitSpec(t,a));break;case r&&b&&x&&o:p=true;f.push(buildPublicFieldInitLoose(s.types.cloneNode(e),t));break;case r&&b&&x&&!o:p=true;f.push(buildPublicFieldInitSpec(s.types.cloneNode(e),t,n));break;case d&&h&&x&&i:m.push(buildPrivateFieldInitLoose(s.types.thisExpression(),t,a));break;case d&&h&&x&&!i:m.push(buildPrivateInstanceFieldInitSpec(s.types.thisExpression(),t,a));break;case d&&h&&v&&i:m.unshift(buildPrivateMethodInitLoose(s.types.thisExpression(),t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case d&&h&&v&&!i:m.unshift(buildPrivateInstanceMethodInitSpec(s.types.thisExpression(),t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case r&&h&&v&&!i:p=true;f.unshift(buildPrivateStaticFieldInitSpec(t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case r&&h&&v&&i:p=true;f.unshift(buildPrivateStaticMethodInitLoose(s.types.cloneNode(e),t,n,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case d&&b&&x&&o:m.push(buildPublicFieldInitLoose(s.types.thisExpression(),t));break;case d&&b&&x&&!o:m.push(buildPublicFieldInitSpec(s.types.thisExpression(),t,n));break;default:throw new Error("Unreachable.")}}return{staticNodes:f.filter(Boolean),instanceNodes:m.filter(Boolean),pureStaticNodes:y.filter(Boolean),wrapClass(t){for(const e of r){e.remove()}if(d){t.scope.push({id:s.types.cloneNode(d)});t.set("superClass",s.types.assignmentExpression("=",d,t.node.superClass))}if(!p)return t;if(t.isClassExpression()){t.scope.push({id:e});t.replaceWith(s.types.assignmentExpression("=",s.types.cloneNode(e),t.node))}else if(!t.node.id){t.node.id=e}return t}}}},738:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.createClassFeaturePlugin=createClassFeaturePlugin;Object.defineProperty(t,"injectInitialization",{enumerable:true,get:function(){return l.injectInitialization}});Object.defineProperty(t,"enableFeature",{enumerable:true,get:function(){return c.enableFeature}});Object.defineProperty(t,"FEATURES",{enumerable:true,get:function(){return c.FEATURES}});var s=r(8304);var a=r(550);var n=r(7058);var o=r(196);var i=r(7055);var l=r(3235);var c=r(5123);const u="7.15.0".split(".").reduce(((e,t)=>e*1e5+ +t),0);const p="@babel/plugin-class-features/version";function createClassFeaturePlugin({name:e,feature:t,loose:r,manipulateOptions:d,api:f={assumption:()=>void 0}}){const m=f.assumption("setPublicClassFields");const y=f.assumption("privateFieldsAsProperties");const g=f.assumption("constantSuper");const h=f.assumption("noDocumentAll");if(r===true){const t=[];if(m!==undefined){t.push(`"setPublicClassFields"`)}if(y!==undefined){t.push(`"privateFieldsAsProperties"`)}if(t.length!==0){console.warn(`[${e}]: You are using the "loose: true" option and you are`+` explicitly setting a value for the ${t.join(" and ")}`+` assumption${t.length>1?"s":""}. The "loose" option`+` can cause incompatibilities with the other class features`+` plugins, so it's recommended that you replace it with the`+` following top-level option:\n`+`\t"assumptions": {\n`+`\t\t"setPublicClassFields": true,\n`+`\t\t"privateFieldsAsProperties": true\n`+`\t}`)}}return{name:e,manipulateOptions:d,pre(){(0,c.enableFeature)(this.file,t,r);if(!this.file.get(p)||this.file.get(p)0){(0,l.injectInitialization)(e,d,I,((e,t)=>{if(f)return;for(const r of b){if(r.node.static)continue;r.traverse(e,t)}}))}const A=C(e);A.insertBefore([...O,...k]);if(P.length>0){A.insertAfter(P)}if(D.length>0){A.find((e=>e.isStatement()||e.isDeclaration())).insertAfter(D)}},PrivateName(e){if(this.file.get(p)!==u||e.parentPath.isPrivate({key:e.node})){return}throw e.buildCodeFrameError(`Unknown PrivateName "${e}"`)},ExportDefaultDeclaration(e){if(this.file.get(p)!==u)return;const t=e.get("declaration");if(t.isClassDeclaration()&&(0,i.hasDecorators)(t.node)){if(t.node.id){(0,n.default)(e)}else{t.node.type="ClassExpression"}}}}}}},3235:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.injectInitialization=injectInitialization;t.extractComputedKeys=extractComputedKeys;var s=r(8304);var a=r(4725);const n=s.traverse.visitors.merge([{Super(e){const{node:t,parentPath:r}=e;if(r.isCallExpression({callee:t})){this.push(r)}}},a.environmentVisitor]);const o={"TSTypeAnnotation|TypeAnnotation"(e){e.skip()},ReferencedIdentifier(e){if(this.scope.hasOwnBinding(e.node.name)){this.scope.rename(e.node.name);e.skip()}}};function handleClassTDZ(e,t){if(t.classBinding&&t.classBinding===e.scope.getBinding(e.node.name)){const r=t.file.addHelper("classNameTDZError");const a=s.types.callExpression(r,[s.types.stringLiteral(e.node.name)]);e.replaceWith(s.types.sequenceExpression([a,e.node]));e.skip()}}const i={ReferencedIdentifier:handleClassTDZ};function injectInitialization(e,t,r,a){if(!r.length)return;const i=!!e.node.superClass;if(!t){const r=s.types.classMethod("constructor",s.types.identifier("constructor"),[],s.types.blockStatement([]));if(i){r.params=[s.types.restElement(s.types.identifier("args"))];r.body.body.push(s.template.statement.ast`super(...args)`)}[t]=e.get("body").unshiftContainer("body",r)}if(a){a(o,{scope:t.scope})}if(i){const e=[];t.traverse(n,e);let a=true;for(const t of e){if(a){t.insertAfter(r);a=false}else{t.insertAfter(r.map((e=>s.types.cloneNode(e))))}}}else{t.get("body").unshiftContainer("body",r)}}function extractComputedKeys(e,t,r,a){const n=[];const o={classBinding:t.node.id&&t.scope.getBinding(t.node.id.name),file:a};for(const e of r){const r=e.get("key");if(r.isReferencedIdentifier()){handleClassTDZ(r,o)}else{r.traverse(i,o)}const a=e.node;if(!r.isConstantExpression()){const e=t.scope.generateUidIdentifierBasedOnNode(a.key);t.scope.push({id:e,kind:"let"});n.push(s.types.expressionStatement(s.types.assignmentExpression("=",s.types.cloneNode(e),a.key)));a.key=s.types.cloneNode(e)}}return n}},5464:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.assertFieldTransformed=assertFieldTransformed;function assertFieldTransformed(e){if(e.node.declare){throw e.buildCodeFrameError(`TypeScript 'declare' fields must first be transformed by `+`@babel/plugin-transform-typescript.\n`+`If you have already enabled that plugin (or '@babel/preset-typescript'), make sure `+`that it runs before any plugin related to additional class features:\n`+` - @babel/plugin-proposal-class-properties\n`+` - @babel/plugin-proposal-private-methods\n`+` - @babel/plugin-proposal-decorators`)}}},4725:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.skipAllButComputedKey=skipAllButComputedKey;t["default"]=t.environmentVisitor=void 0;var s=r(7369);var a=r(5789);var n=r(6721);var o=r(8622);function getPrototypeOfExpression(e,t,r,s){e=o.cloneNode(e);const a=t||s?e:o.memberExpression(e,o.identifier("prototype"));return o.callExpression(r.addHelper("getPrototypeOf"),[a])}function skipAllButComputedKey(e){if(!e.node.computed){e.skip();return}const t=o.VISITOR_KEYS[e.type];for(const r of t){if(r!=="key")e.skipKey(r)}}const i={[`${o.staticBlock?"StaticBlock|":""}ClassPrivateProperty|TypeAnnotation`](e){e.skip()},Function(e){if(e.isMethod())return;if(e.isArrowFunctionExpression())return;e.skip()},"Method|ClassProperty"(e){skipAllButComputedKey(e)}};t.environmentVisitor=i;const l=s.default.visitors.merge([i,{Super(e,t){const{node:r,parentPath:s}=e;if(!s.isMemberExpression({object:r}))return;t.handle(s)}}]);const c=s.default.visitors.merge([i,{Scopable(e,{refName:t}){const r=e.scope.getOwnBinding(t);if(r&&r.identifier.name===t){e.scope.rename(t)}}}]);const u={memoise(e,t){const{scope:r,node:s}=e;const{computed:a,property:n}=s;if(!a){return}const o=r.maybeGenerateMemoised(n);if(!o){return}this.memoiser.set(n,o,t)},prop(e){const{computed:t,property:r}=e.node;if(this.memoiser.has(r)){return o.cloneNode(this.memoiser.get(r))}if(t){return o.cloneNode(r)}return o.stringLiteral(r.name)},get(e){return this._get(e,this._getThisRefs())},_get(e,t){const r=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("get"),[t.memo?o.sequenceExpression([t.memo,r]):r,this.prop(e),t.this])},_getThisRefs(){if(!this.isDerivedConstructor){return{this:o.thisExpression()}}const e=this.scope.generateDeclaredUidIdentifier("thisSuper");return{memo:o.assignmentExpression("=",e,o.thisExpression()),this:o.cloneNode(e)}},set(e,t){const r=this._getThisRefs();const s=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("set"),[r.memo?o.sequenceExpression([r.memo,s]):s,this.prop(e),t,r.this,o.booleanLiteral(e.isInStrictMode())])},destructureSet(e){throw e.buildCodeFrameError(`Destructuring to a super field is not supported yet.`)},call(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,false)},optionalCall(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,true)}};const p=Object.assign({},u,{prop(e){const{property:t}=e.node;if(this.memoiser.has(t)){return o.cloneNode(this.memoiser.get(t))}return o.cloneNode(t)},get(e){const{isStatic:t,getSuperRef:r}=this;const{computed:s}=e.node;const a=this.prop(e);let n;if(t){var i;n=(i=r())!=null?i:o.memberExpression(o.identifier("Function"),o.identifier("prototype"))}else{var l;n=o.memberExpression((l=r())!=null?l:o.identifier("Object"),o.identifier("prototype"))}return o.memberExpression(n,a,s)},set(e,t){const{computed:r}=e.node;const s=this.prop(e);return o.assignmentExpression("=",o.memberExpression(o.thisExpression(),s,r),t)},destructureSet(e){const{computed:t}=e.node;const r=this.prop(e);return o.memberExpression(o.thisExpression(),r,t)},call(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,false)},optionalCall(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,true)}});class ReplaceSupers{constructor(e){var t;const r=e.methodPath;this.methodPath=r;this.isDerivedConstructor=r.isClassMethod({kind:"constructor"})&&!!e.superRef;this.isStatic=r.isObjectMethod()||r.node.static||(r.isStaticBlock==null?void 0:r.isStaticBlock());this.isPrivateMethod=r.isPrivate()&&r.isMethod();this.file=e.file;this.constantSuper=(t=e.constantSuper)!=null?t:e.isLoose;this.opts=e}getObjectRef(){return o.cloneNode(this.opts.objectRef||this.opts.getObjectRef())}getSuperRef(){if(this.opts.superRef)return o.cloneNode(this.opts.superRef);if(this.opts.getSuperRef)return o.cloneNode(this.opts.getSuperRef())}replace(){if(this.opts.refToPreserve){this.methodPath.traverse(c,{refName:this.opts.refToPreserve.name})}const e=this.constantSuper?p:u;(0,a.default)(this.methodPath,l,Object.assign({file:this.file,scope:this.methodPath.scope,isDerivedConstructor:this.isDerivedConstructor,isStatic:this.isStatic,isPrivateMethod:this.isPrivateMethod,getObjectRef:this.getObjectRef.bind(this),getSuperRef:this.getSuperRef.bind(this),boundGet:e.get},e))}}t["default"]=ReplaceSupers},4951:e=>{const t=new Set(["proposal-class-static-block"]);const r={"proposal-async-generator-functions":"syntax-async-generators","proposal-class-properties":"syntax-class-properties","proposal-class-static-block":"syntax-class-static-block","proposal-json-strings":"syntax-json-strings","proposal-nullish-coalescing-operator":"syntax-nullish-coalescing-operator","proposal-numeric-separator":"syntax-numeric-separator","proposal-object-rest-spread":"syntax-object-rest-spread","proposal-optional-catch-binding":"syntax-optional-catch-binding","proposal-optional-chaining":"syntax-optional-chaining","proposal-private-methods":"syntax-class-properties","proposal-private-property-in-object":"syntax-private-property-in-object","proposal-unicode-property-regex":null};const s=Object.keys(r).map((function(e){return[e,r[e]]}));const a=new Map(s);e.exports={pluginSyntaxMap:a,proposalPlugins:t}},9199:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.minVersions=t["default"]=void 0;var s=r(1079);var a=r(947);var n=r(8142);var o=r(5163);var i=r(1454);var l=r(3030);var c=r(5945);var u=r(5879);var p=r(1816);var d=r(4499);var f=r(7452);var m=r(79);var y=r(7445);var g=r(4893);var h=r(2271);var b=r(8027);var x=r(5557);var v=r(4920);var E=r(9579);var j=r(7703);var w=r(1195);var _=r(5353);var S=r(7300);var O=r(6309);var k=r(4195);var P=r(7490);var I=r(9062);var D=r(3181);var C=r(6092);var A=r(6413);var R=r(513);var N=r(8363);var M=r(1630);var F=r(6408);var L=r(8120);var B=r(5157);var W=r(5843);var U=r(7850);var $=r(1176);var V=r(9488);var q=r(715);var G=r(5072);var H=r(4674);var z=r(8657);var K=r(6186);var X=r(730);var Y=r(9942);var J=r(8447);var Z=r(9545);var Q=r(570);var ee=r(3714);var te=r(2970);var re=r(5628);var se=r(8720);var ae=r(8648);var ne=r(8476);var oe=r(1245);var ie=r(5356);var le=r(5502);var ce=r(3448);var ue=r(4122);var pe=r(9453);var de=r(489);var fe=r(3258);var me=r(3744);var ye=r(5899);var ge=r(6668);var he=r(1626);var be={"bugfix/transform-async-arrows-in-class":()=>pe,"bugfix/transform-edge-default-parameters":()=>de,"bugfix/transform-edge-function-name":()=>fe,"bugfix/transform-safari-block-shadowing":()=>ye,"bugfix/transform-safari-for-shadowing":()=>ge,"bugfix/transform-tagged-template-caching":()=>me,"bugfix/transform-v8-spread-parameters-in-optional-chaining":()=>he.default,"proposal-async-generator-functions":()=>h.default,"proposal-class-properties":()=>b.default,"proposal-class-static-block":()=>x.default,"proposal-dynamic-import":()=>v.default,"proposal-export-namespace-from":()=>E.default,"proposal-json-strings":()=>j.default,"proposal-logical-assignment-operators":()=>w.default,"proposal-nullish-coalescing-operator":()=>_.default,"proposal-numeric-separator":()=>S.default,"proposal-object-rest-spread":()=>O.default,"proposal-optional-catch-binding":()=>k.default,"proposal-optional-chaining":()=>P.default,"proposal-private-methods":()=>I.default,"proposal-private-property-in-object":()=>D.default,"proposal-unicode-property-regex":()=>C.default,"syntax-async-generators":()=>s,"syntax-class-properties":()=>a,"syntax-class-static-block":()=>n.default,"syntax-dynamic-import":()=>o,"syntax-export-namespace-from":()=>i,"syntax-json-strings":()=>l,"syntax-logical-assignment-operators":()=>c,"syntax-nullish-coalescing-operator":()=>u,"syntax-numeric-separator":()=>p,"syntax-object-rest-spread":()=>d,"syntax-optional-catch-binding":()=>f,"syntax-optional-chaining":()=>m,"syntax-private-property-in-object":()=>y.default,"syntax-top-level-await":()=>g.default,"transform-arrow-functions":()=>R.default,"transform-async-to-generator":()=>A.default,"transform-block-scoped-functions":()=>N.default,"transform-block-scoping":()=>M.default,"transform-classes":()=>F.default,"transform-computed-properties":()=>L.default,"transform-destructuring":()=>B.default,"transform-dotall-regex":()=>W.default,"transform-duplicate-keys":()=>U.default,"transform-exponentiation-operator":()=>$.default,"transform-for-of":()=>V.default,"transform-function-name":()=>q.default,"transform-literals":()=>G.default,"transform-member-expression-literals":()=>H.default,"transform-modules-amd":()=>z.default,"transform-modules-commonjs":()=>K.default,"transform-modules-systemjs":()=>X.default,"transform-modules-umd":()=>Y.default,"transform-named-capturing-groups-regex":()=>J.default,"transform-new-target":()=>Z.default,"transform-object-super":()=>Q.default,"transform-parameters":()=>ee.default,"transform-property-literals":()=>te.default,"transform-regenerator":()=>re.default,"transform-reserved-words":()=>se.default,"transform-shorthand-properties":()=>ae.default,"transform-spread":()=>ne.default,"transform-sticky-regex":()=>oe.default,"transform-template-literals":()=>ie.default,"transform-typeof-symbol":()=>le.default,"transform-unicode-escapes":()=>ce.default,"transform-unicode-regex":()=>ue.default};t["default"]=be;const xe={"proposal-class-static-block":"7.12.0","proposal-private-property-in-object":"7.10.0"};t.minVersions=xe},4188:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.logPlugin=void 0;var s=r(4413);const logPlugin=(e,t,r)=>{const a=(0,s.getInclusionReasons)(e,t,r);const n=r[e];if(!n){console.log(` ${e}`);return}let o=`{`;let i=true;for(const e of Object.keys(a)){if(!i)o+=`,`;i=false;o+=` ${e}`;if(n[e])o+=` < ${n[e]}`}o+=` }`;console.log(` ${e} ${o}`)};t.logPlugin=logPlugin},2709:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.removeUnnecessaryItems=removeUnnecessaryItems;t.removeUnsupportedItems=removeUnsupportedItems;var s=r(7849);var a=r(9199);const n=Function.call.bind(Object.hasOwnProperty);function removeUnnecessaryItems(e,t){e.forEach((r=>{var s;(s=t[r])==null?void 0:s.forEach((t=>e.delete(t)))}))}function removeUnsupportedItems(e,t){e.forEach((r=>{if(n(a.minVersions,r)&&(0,s.lt)(t,a.minVersions[r])){e.delete(r)}}))}},2196:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;const r=["transform-typeof-symbol"];function _default({loose:e}){return e?r:null}},9290:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isPluginRequired=isPluginRequired;t["default"]=t.getPolyfillPlugins=t.getModulesPluginNames=t.transformIncludesAndExcludes=void 0;var s=r(7849);var a=r(4188);var n=r(2196);var o=r(2709);var i=r(7538);var l=r(4820);var c=r(4951);var u=r(1119);var p=r(7363);var d=r(8170);var f=r(3867);var m=r(9897);var y=r(5825);var g=r(7973);var h=r(4413);var b=r(9199);var x=r(558);const v=m.default||m;const E=y.default||y;const j=g.default||g;function isPluginRequired(e,t){return(0,h.isRequired)("fake-name",e,{compatData:{"fake-name":t}})}function filterStageFromList(e,t){return Object.keys(e).reduce(((r,s)=>{if(!t.has(s)){r[s]=e[s]}return r}),{})}const w={withProposals:{withoutBugfixes:u.plugins,withBugfixes:Object.assign({},u.plugins,u.pluginsBugfixes)},withoutProposals:{withoutBugfixes:filterStageFromList(u.plugins,c.proposalPlugins),withBugfixes:filterStageFromList(Object.assign({},u.plugins,u.pluginsBugfixes),c.proposalPlugins)}};function getPluginList(e,t){if(e){if(t)return w.withProposals.withBugfixes;else return w.withProposals.withoutBugfixes}else{if(t)return w.withoutProposals.withBugfixes;else return w.withoutProposals.withoutBugfixes}}const getPlugin=e=>{const t=b.default[e]();if(!t){throw new Error(`Could not find plugin "${e}". Ensure there is an entry in ./available-plugins.js for it.`)}return t};const transformIncludesAndExcludes=e=>e.reduce(((e,t)=>{const r=t.match(/^(es|es6|es7|esnext|web)\./)?"builtIns":"plugins";e[r].add(t);return e}),{all:e,plugins:new Set,builtIns:new Set});t.transformIncludesAndExcludes=transformIncludesAndExcludes;const getModulesPluginNames=({modules:e,transformations:t,shouldTransformESM:r,shouldTransformDynamicImport:s,shouldTransformExportNamespaceFrom:a,shouldParseTopLevelAwait:n})=>{const o=[];if(e!==false&&t[e]){if(r){o.push(t[e])}if(s&&r&&e!=="umd"){o.push("proposal-dynamic-import")}else{if(s){console.warn("Dynamic import can only be supported when transforming ES modules"+" to AMD, CommonJS or SystemJS. Only the parser plugin will be enabled.")}o.push("syntax-dynamic-import")}}else{o.push("syntax-dynamic-import")}if(a){o.push("proposal-export-namespace-from")}else{o.push("syntax-export-namespace-from")}if(n){o.push("syntax-top-level-await")}return o};t.getModulesPluginNames=getModulesPluginNames;const getPolyfillPlugins=({useBuiltIns:e,corejs:t,polyfillTargets:r,include:s,exclude:a,proposals:n,shippedProposals:o,regenerator:i,debug:l})=>{const c=[];if(e==="usage"||e==="entry"){const u={method:`${e}-global`,version:t?t.toString():undefined,targets:r,include:s,exclude:a,proposals:n,shippedProposals:o,debug:l};if(t){if(e==="usage"){if(t.major===2){c.push([v,u],[f.default,{usage:true}])}else{c.push([E,u],[f.default,{usage:true,deprecated:true}])}if(i){c.push([j,{method:"usage-global",debug:l}])}}else{if(t.major===2){c.push([f.default,{regenerator:i}],[v,u])}else{c.push([E,u],[f.default,{deprecated:true}]);if(!i){c.push([d.default,u])}}}}}return c};t.getPolyfillPlugins=getPolyfillPlugins;function getLocalTargets(e,t,r,s){if(e!=null&&e.esmodules&&e.browsers){console.warn(`\n@babel/preset-env: esmodules and browsers targets have been specified together.\n\`browsers\` target, \`${e.browsers.toString()}\` will be ignored.\n`)}return(0,h.default)(e,{ignoreBrowserslistConfig:t,configPath:r,browserslistEnv:s})}function supportsStaticESM(e){return!!(e!=null&&e.supportsStaticESM)}function supportsDynamicImport(e){return!!(e!=null&&e.supportsDynamicImport)}function supportsExportNamespaceFrom(e){return!!(e!=null&&e.supportsExportNamespaceFrom)}function supportsTopLevelAwait(e){return!!(e!=null&&e.supportsTopLevelAwait)}var _=(0,x.declare)(((e,t)=>{e.assertVersion(7);const r=e.targets();const{bugfixes:u,configPath:d,debug:f,exclude:m,forceAllTransforms:y,ignoreBrowserslistConfig:g,include:b,loose:x,modules:v,shippedProposals:E,spec:j,targets:w,useBuiltIns:_,corejs:{version:S,proposals:O},browserslistEnv:k}=(0,l.default)(t);let P=r;if((0,s.lt)(e.version,"7.13.0")||t.targets||t.configPath||t.browserslistEnv||t.ignoreBrowserslistConfig){{var I=false;if(w!=null&&w.uglify){I=true;delete w.uglify;console.warn(`\nThe uglify target has been deprecated. Set the top level\noption \`forceAllTransforms: true\` instead.\n`)}}P=getLocalTargets(w,g,d,k)}const D=y||I?{}:P;const C=transformIncludesAndExcludes(b);const A=transformIncludesAndExcludes(m);const R=getPluginList(E,u);const N=v==="auto"&&(e.caller==null?void 0:e.caller(supportsExportNamespaceFrom))||v===false&&!(0,h.isRequired)("proposal-export-namespace-from",D,{compatData:R,includes:C.plugins,excludes:A.plugins});const M=getModulesPluginNames({modules:v,transformations:i.default,shouldTransformESM:v!=="auto"||!(e.caller!=null&&e.caller(supportsStaticESM)),shouldTransformDynamicImport:v!=="auto"||!(e.caller!=null&&e.caller(supportsDynamicImport)),shouldTransformExportNamespaceFrom:!N,shouldParseTopLevelAwait:!e.caller||e.caller(supportsTopLevelAwait)});const F=(0,h.filterItems)(R,C.plugins,A.plugins,D,M,(0,n.default)({loose:x}),c.pluginSyntaxMap);(0,o.removeUnnecessaryItems)(F,p);(0,o.removeUnsupportedItems)(F,e.version);const L=getPolyfillPlugins({useBuiltIns:_,corejs:S,polyfillTargets:P,include:C.builtIns,exclude:A.builtIns,proposals:O,shippedProposals:E,regenerator:F.has("transform-regenerator"),debug:f});const B=_!==false;const W=Array.from(F).map((e=>{if(e==="proposal-class-properties"||e==="proposal-private-methods"||e==="proposal-private-property-in-object"){return[getPlugin(e),{loose:x?"#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error":"#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"}]}return[getPlugin(e),{spec:j,loose:x,useBuiltIns:B}]})).concat(L);if(f){console.log("@babel/preset-env: `DEBUG` option");console.log("\nUsing targets:");console.log(JSON.stringify((0,h.prettifyTargets)(P),null,2));console.log(`\nUsing modules transform: ${v.toString()}`);console.log("\nUsing plugins:");F.forEach((e=>{(0,a.logPlugin)(e,P,R)}));if(!_){console.log("\nUsing polyfills: No polyfills were added, since the `useBuiltIns` option was not set.")}}return{plugins:W}}));t["default"]=_},7538:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var r={auto:"transform-modules-commonjs",amd:"transform-modules-amd",commonjs:"transform-modules-commonjs",cjs:"transform-modules-commonjs",systemjs:"transform-modules-systemjs",umd:"transform-modules-umd"};t["default"]=r},4820:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.normalizeCoreJSOption=normalizeCoreJSOption;t["default"]=normalizeOptions;t.validateUseBuiltInsOption=t.validateModulesOption=t.checkDuplicateIncludeExcludes=t.normalizePluginName=void 0;var s=r(6578);var a=r(7849);var n=r(2272);var o=r(1119);var i=r(7538);var l=r(7619);var c=r(7347);const u=["web.timers","web.immediate","web.dom.iterable"];const p=new c.OptionValidator("@babel/preset-env");const d=Object.keys(o.plugins);const f=["proposal-dynamic-import",...Object.keys(i.default).map((e=>i.default[e]))];const getValidIncludesAndExcludes=(e,t)=>new Set([...d,...e==="exclude"?f:[],...t?t==2?[...Object.keys(n),...u]:Object.keys(s):[]]);const pluginToRegExp=e=>{if(e instanceof RegExp)return e;try{return new RegExp(`^${normalizePluginName(e)}$`)}catch(e){return null}};const selectPlugins=(e,t,r)=>Array.from(getValidIncludesAndExcludes(t,r)).filter((t=>e instanceof RegExp&&e.test(t)));const flatten=e=>[].concat(...e);const expandIncludesAndExcludes=(e=[],t,r)=>{if(e.length===0)return[];const s=e.map((e=>selectPlugins(pluginToRegExp(e),t,r)));const a=e.filter(((e,t)=>s[t].length===0));p.invariant(a.length===0,`The plugins/built-ins '${a.join(", ")}' passed to the '${t}' option are not\n valid. Please check data/[plugin-features|built-in-features].js in babel-preset-env`);return flatten(s)};const normalizePluginName=e=>e.replace(/^(@babel\/|babel-)(plugin-)?/,"");t.normalizePluginName=normalizePluginName;const checkDuplicateIncludeExcludes=(e=[],t=[])=>{const r=e.filter((e=>t.indexOf(e)>=0));p.invariant(r.length===0,`The plugins/built-ins '${r.join(", ")}' were found in both the "include" and\n "exclude" options.`)};t.checkDuplicateIncludeExcludes=checkDuplicateIncludeExcludes;const normalizeTargets=e=>{if(typeof e==="string"||Array.isArray(e)){return{browsers:e}}return Object.assign({},e)};const validateModulesOption=(e=l.ModulesOption.auto)=>{p.invariant(l.ModulesOption[e.toString()]||e===l.ModulesOption.false,`The 'modules' option must be one of \n`+` - 'false' to indicate no module processing\n`+` - a specific module type: 'commonjs', 'amd', 'umd', 'systemjs'`+` - 'auto' (default) which will automatically select 'false' if the current\n`+` process is known to support ES module syntax, or "commonjs" otherwise\n`);return e};t.validateModulesOption=validateModulesOption;const validateUseBuiltInsOption=(e=false)=>{p.invariant(l.UseBuiltInsOption[e.toString()]||e===l.UseBuiltInsOption.false,`The 'useBuiltIns' option must be either\n 'false' (default) to indicate no polyfill,\n '"entry"' to indicate replacing the entry polyfill, or\n '"usage"' to import only used polyfills per file`);return e};t.validateUseBuiltInsOption=validateUseBuiltInsOption;function normalizeCoreJSOption(e,t){let r=false;let s;if(t&&e===undefined){s=2;console.warn("\nWARNING (@babel/preset-env): We noticed you're using the `useBuiltIns` option without declaring a "+"core-js version. Currently, we assume version 2.x when no version "+"is passed. Since this default version will likely change in future "+"versions of Babel, we recommend explicitly setting the core-js version "+"you are using via the `corejs` option.\n"+"\nYou should also be sure that the version you pass to the `corejs` "+"option matches the version specified in your `package.json`'s "+"`dependencies` section. If it doesn't, you need to run one of the "+"following commands:\n\n"+" npm install --save core-js@2 npm install --save core-js@3\n"+" yarn add core-js@2 yarn add core-js@3\n\n"+"More info about useBuiltIns: https://babeljs.io/docs/en/babel-preset-env#usebuiltins\n"+"More info about core-js: https://babeljs.io/docs/en/babel-preset-env#corejs")}else if(typeof e==="object"&&e!==null){s=e.version;r=Boolean(e.proposals)}else{s=e}const n=s?(0,a.coerce)(String(s)):false;if(!t&&n){console.warn("\nWARNING (@babel/preset-env): The `corejs` option only has an effect when the `useBuiltIns` option is not `false`\n")}if(t&&(!n||n.major<2||n.major>3)){throw new RangeError("Invalid Option: The version passed to `corejs` is invalid. Currently, "+"only core-js@2 and core-js@3 are supported.")}return{version:n,proposals:r}}function normalizeOptions(e){p.validateTopLevelOptions(e,l.TopLevelOptions);const t=validateUseBuiltInsOption(e.useBuiltIns);const r=normalizeCoreJSOption(e.corejs,t);const s=expandIncludesAndExcludes(e.include,l.TopLevelOptions.include,!!r.version&&r.version.major);const a=expandIncludesAndExcludes(e.exclude,l.TopLevelOptions.exclude,!!r.version&&r.version.major);checkDuplicateIncludeExcludes(s,a);return{bugfixes:p.validateBooleanOption(l.TopLevelOptions.bugfixes,e.bugfixes,false),configPath:p.validateStringOption(l.TopLevelOptions.configPath,e.configPath,process.cwd()),corejs:r,debug:p.validateBooleanOption(l.TopLevelOptions.debug,e.debug,false),include:s,exclude:a,forceAllTransforms:p.validateBooleanOption(l.TopLevelOptions.forceAllTransforms,e.forceAllTransforms,false),ignoreBrowserslistConfig:p.validateBooleanOption(l.TopLevelOptions.ignoreBrowserslistConfig,e.ignoreBrowserslistConfig,false),loose:p.validateBooleanOption(l.TopLevelOptions.loose,e.loose),modules:validateModulesOption(e.modules),shippedProposals:p.validateBooleanOption(l.TopLevelOptions.shippedProposals,e.shippedProposals,false),spec:p.validateBooleanOption(l.TopLevelOptions.spec,e.spec,false),targets:normalizeTargets(e.targets),useBuiltIns:t,browserslistEnv:p.validateStringOption(l.TopLevelOptions.browserslistEnv,e.browserslistEnv)}}},7619:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.UseBuiltInsOption=t.ModulesOption=t.TopLevelOptions=void 0;const r={bugfixes:"bugfixes",configPath:"configPath",corejs:"corejs",debug:"debug",exclude:"exclude",forceAllTransforms:"forceAllTransforms",ignoreBrowserslistConfig:"ignoreBrowserslistConfig",include:"include",loose:"loose",modules:"modules",shippedProposals:"shippedProposals",spec:"spec",targets:"targets",useBuiltIns:"useBuiltIns",browserslistEnv:"browserslistEnv"};t.TopLevelOptions=r;const s={false:false,auto:"auto",amd:"amd",commonjs:"commonjs",cjs:"cjs",systemjs:"systemjs",umd:"umd"};t.ModulesOption=s;const a={false:false,entry:"entry",usage:"usage"};t.UseBuiltInsOption=a},1119:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.pluginsBugfixes=t.plugins=void 0;var s=r(5884);var a=r(3574);var n=r(9199);const o={};t.plugins=o;const i={};t.pluginsBugfixes=i;for(const e of Object.keys(s)){if(Object.hasOwnProperty.call(n.default,e)){o[e]=s[e]}}for(const e of Object.keys(a)){if(Object.hasOwnProperty.call(n.default,e)){i[e]=a[e]}}o["proposal-class-properties"]=o["proposal-private-methods"]},3867:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(3931);var a=r(8622);const n=`\n \`@babel/polyfill\` is deprecated. Please, use required parts of \`core-js\`\n and \`regenerator-runtime/runtime\` separately`;const o=`\n When setting \`useBuiltIns: 'usage'\`, polyfills are automatically imported when needed.\n Please remove the direct import of \`SPECIFIER\` or use \`useBuiltIns: 'entry'\` instead.`;function _default({template:e},{regenerator:t,deprecated:r,usage:a}){return{name:"preset-env/replace-babel-polyfill",visitor:{ImportDeclaration(i){const l=(0,s.getImportSource)(i);if(a&&(0,s.isPolyfillSource)(l)){console.warn(o.replace("SPECIFIER",l));if(!r)i.remove()}else if(l==="@babel/polyfill"){if(r){console.warn(n)}else if(t){i.replaceWithMultiple(e.ast` import "core-js"; import "regenerator-runtime/runtime.js"; `)}else{i.replaceWith(e.ast` @@ -453,6 +528,6 @@ require("regenerator-runtime/runtime.js"); `)}else{i.replaceWith(e.ast` require("core-js"); - `)}}}))}}}}},8170:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(3931);function isRegeneratorSource(e){return e==="regenerator-runtime/runtime"||e==="regenerator-runtime/runtime.js"}function _default(){const e={ImportDeclaration(e){if(isRegeneratorSource((0,s.getImportSource)(e))){this.regeneratorImportExcluded=true;e.remove()}},Program(e){e.get("body").forEach((e=>{if(isRegeneratorSource((0,s.getRequireSource)(e))){this.regeneratorImportExcluded=true;e.remove()}}))}};return{name:"preset-env/remove-regenerator",visitor:e,pre(){this.regeneratorImportExcluded=false},post(){if(this.opts.debug&&this.regeneratorImportExcluded){let e=this.file.opts.filename;if(process.env.BABEL_ENV==="test"){e=e.replace(/\\/g,"/")}console.log(`\n[${e}] Based on your targets, regenerator-runtime import excluded.`)}}}}},3931:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getImportSource=getImportSource;t.getRequireSource=getRequireSource;t.isPolyfillSource=isPolyfillSource;var s=r(8622);function getImportSource({node:e}){if(e.specifiers.length===0)return e.source.value}function getRequireSource({node:e}){if(!s.isExpressionStatement(e))return;const{expression:t}=e;if(s.isCallExpression(t)&&s.isIdentifier(t.callee)&&t.callee.name==="require"&&t.arguments.length===1&&s.isStringLiteral(t.arguments[0])){return t.arguments[0].value}}function isPolyfillSource(e){return e==="@babel/polyfill"||e==="core-js"}},1068:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(558);var a=r(4350);var n=r(7347);function _interopDefaultLegacy(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var o=_interopDefaultLegacy(a);const i=new n.OptionValidator("@babel/preset-typescript");function normalizeOptions(e={}){let{allowNamespaces:t=true,jsxPragma:r,onlyRemoveTypeImports:s}=e;const a={allExtensions:"allExtensions",allowNamespaces:"allowNamespaces",isTSX:"isTSX",jsxPragma:"jsxPragma",jsxPragmaFrag:"jsxPragmaFrag",onlyRemoveTypeImports:"onlyRemoveTypeImports",optimizeConstEnums:"optimizeConstEnums"};const n=i.validateStringOption(a.jsxPragmaFrag,e.jsxPragmaFrag,"React.Fragment");const o=i.validateBooleanOption(a.allExtensions,e.allExtensions,false);const l=i.validateBooleanOption(a.isTSX,e.isTSX,false);if(l){i.invariant(o,"isTSX:true requires allExtensions:true")}const c=i.validateBooleanOption(a.optimizeConstEnums,e.optimizeConstEnums,false);return{allExtensions:o,allowNamespaces:t,isTSX:l,jsxPragma:r,jsxPragmaFrag:n,onlyRemoveTypeImports:s,optimizeConstEnums:c}}var l=s.declare(((e,t)=>{e.assertVersion(7);const{allExtensions:r,allowNamespaces:s,isTSX:a,jsxPragma:n,jsxPragmaFrag:i,onlyRemoveTypeImports:l,optimizeConstEnums:c}=normalizeOptions(t);const pluginOptions=e=>({allowDeclareFields:t.allowDeclareFields,allowNamespaces:s,isTSX:e,jsxPragma:n,jsxPragmaFrag:i,onlyRemoveTypeImports:l,optimizeConstEnums:c});return{overrides:r?[{plugins:[[o["default"],pluginOptions(a)]]}]:[{test:/\.ts$/,plugins:[[o["default"],pluginOptions(false)]]},{test:/\.tsx$/,plugins:[[o["default"],pluginOptions(true)]]}]}}));t["default"]=l},372:(e,t)=>{"use strict";t.__esModule=true;t["default"]=_default;function _extends(){_extends=Object.assign||function(e){for(var t=1;te!=="node"));return _extends({},a,t==="usage-pure"?s:null,o||i?r:null)}},2816:(e,t,r)=>{"use strict";t.__esModule=true;t.StaticProperties=t.InstanceProperties=t.BuiltIns=t.CommonIterators=void 0;var s=_interopRequireDefault(r(1268));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const define=(e,t,r=[],s)=>({name:e,pure:t,global:r,meta:s});const pureAndGlobal=(e,t,r=null)=>define(t[0],e,t,{minRuntimeVersion:r});const globalOnly=e=>define(e[0],null,e);const pureOnly=(e,t)=>define(t,e,[]);const a=["es6.object.to-string","es6.array.iterator","web.dom.iterable"];const n=["es6.string.iterator",...a];t.CommonIterators=n;const o=["es6.object.to-string","es6.promise"];const i={DataView:globalOnly(["es6.typed.data-view"]),Float32Array:globalOnly(["es6.typed.float32-array"]),Float64Array:globalOnly(["es6.typed.float64-array"]),Int8Array:globalOnly(["es6.typed.int8-array"]),Int16Array:globalOnly(["es6.typed.int16-array"]),Int32Array:globalOnly(["es6.typed.int32-array"]),Map:pureAndGlobal("map",["es6.map",...n]),Number:globalOnly(["es6.number.constructor"]),Promise:pureAndGlobal("promise",o),RegExp:globalOnly(["es6.regexp.constructor"]),Set:pureAndGlobal("set",["es6.set",...n]),Symbol:pureAndGlobal("symbol",["es6.symbol"]),Uint8Array:globalOnly(["es6.typed.uint8-array"]),Uint8ClampedArray:globalOnly(["es6.typed.uint8-clamped-array"]),Uint16Array:globalOnly(["es6.typed.uint16-array"]),Uint32Array:globalOnly(["es6.typed.uint32-array"]),WeakMap:pureAndGlobal("weak-map",["es6.weak-map",...n]),WeakSet:pureAndGlobal("weak-set",["es6.weak-set",...n]),setImmediate:pureOnly("set-immediate","web.immediate"),clearImmediate:pureOnly("clear-immediate","web.immediate"),parseFloat:pureOnly("parse-float","es6.parse-float"),parseInt:pureOnly("parse-int","es6.parse-int")};t.BuiltIns=i;const l={__defineGetter__:globalOnly(["es7.object.define-getter"]),__defineSetter__:globalOnly(["es7.object.define-setter"]),__lookupGetter__:globalOnly(["es7.object.lookup-getter"]),__lookupSetter__:globalOnly(["es7.object.lookup-setter"]),anchor:globalOnly(["es6.string.anchor"]),big:globalOnly(["es6.string.big"]),bind:globalOnly(["es6.function.bind"]),blink:globalOnly(["es6.string.blink"]),bold:globalOnly(["es6.string.bold"]),codePointAt:globalOnly(["es6.string.code-point-at"]),copyWithin:globalOnly(["es6.array.copy-within"]),endsWith:globalOnly(["es6.string.ends-with"]),entries:globalOnly(a),every:globalOnly(["es6.array.every"]),fill:globalOnly(["es6.array.fill"]),filter:globalOnly(["es6.array.filter"]),finally:globalOnly(["es7.promise.finally",...o]),find:globalOnly(["es6.array.find"]),findIndex:globalOnly(["es6.array.find-index"]),fixed:globalOnly(["es6.string.fixed"]),flags:globalOnly(["es6.regexp.flags"]),flatMap:globalOnly(["es7.array.flat-map"]),fontcolor:globalOnly(["es6.string.fontcolor"]),fontsize:globalOnly(["es6.string.fontsize"]),forEach:globalOnly(["es6.array.for-each"]),includes:globalOnly(["es6.string.includes","es7.array.includes"]),indexOf:globalOnly(["es6.array.index-of"]),italics:globalOnly(["es6.string.italics"]),keys:globalOnly(a),lastIndexOf:globalOnly(["es6.array.last-index-of"]),link:globalOnly(["es6.string.link"]),map:globalOnly(["es6.array.map"]),match:globalOnly(["es6.regexp.match"]),name:globalOnly(["es6.function.name"]),padStart:globalOnly(["es7.string.pad-start"]),padEnd:globalOnly(["es7.string.pad-end"]),reduce:globalOnly(["es6.array.reduce"]),reduceRight:globalOnly(["es6.array.reduce-right"]),repeat:globalOnly(["es6.string.repeat"]),replace:globalOnly(["es6.regexp.replace"]),search:globalOnly(["es6.regexp.search"]),small:globalOnly(["es6.string.small"]),some:globalOnly(["es6.array.some"]),sort:globalOnly(["es6.array.sort"]),split:globalOnly(["es6.regexp.split"]),startsWith:globalOnly(["es6.string.starts-with"]),strike:globalOnly(["es6.string.strike"]),sub:globalOnly(["es6.string.sub"]),sup:globalOnly(["es6.string.sup"]),toISOString:globalOnly(["es6.date.to-iso-string"]),toJSON:globalOnly(["es6.date.to-json"]),toString:globalOnly(["es6.object.to-string","es6.date.to-string","es6.regexp.to-string"]),trim:globalOnly(["es6.string.trim"]),trimEnd:globalOnly(["es7.string.trim-right"]),trimLeft:globalOnly(["es7.string.trim-left"]),trimRight:globalOnly(["es7.string.trim-right"]),trimStart:globalOnly(["es7.string.trim-left"]),values:globalOnly(a)};t.InstanceProperties=l;if("es6.array.slice"in s.default){l.slice=globalOnly(["es6.array.slice"])}const c={Array:{from:pureAndGlobal("array/from",["es6.symbol","es6.array.from",...n]),isArray:pureAndGlobal("array/is-array",["es6.array.is-array"]),of:pureAndGlobal("array/of",["es6.array.of"])},Date:{now:pureAndGlobal("date/now",["es6.date.now"])},JSON:{stringify:pureOnly("json/stringify","es6.symbol")},Math:{acosh:pureAndGlobal("math/acosh",["es6.math.acosh"],"7.0.1"),asinh:pureAndGlobal("math/asinh",["es6.math.asinh"],"7.0.1"),atanh:pureAndGlobal("math/atanh",["es6.math.atanh"],"7.0.1"),cbrt:pureAndGlobal("math/cbrt",["es6.math.cbrt"],"7.0.1"),clz32:pureAndGlobal("math/clz32",["es6.math.clz32"],"7.0.1"),cosh:pureAndGlobal("math/cosh",["es6.math.cosh"],"7.0.1"),expm1:pureAndGlobal("math/expm1",["es6.math.expm1"],"7.0.1"),fround:pureAndGlobal("math/fround",["es6.math.fround"],"7.0.1"),hypot:pureAndGlobal("math/hypot",["es6.math.hypot"],"7.0.1"),imul:pureAndGlobal("math/imul",["es6.math.imul"],"7.0.1"),log1p:pureAndGlobal("math/log1p",["es6.math.log1p"],"7.0.1"),log10:pureAndGlobal("math/log10",["es6.math.log10"],"7.0.1"),log2:pureAndGlobal("math/log2",["es6.math.log2"],"7.0.1"),sign:pureAndGlobal("math/sign",["es6.math.sign"],"7.0.1"),sinh:pureAndGlobal("math/sinh",["es6.math.sinh"],"7.0.1"),tanh:pureAndGlobal("math/tanh",["es6.math.tanh"],"7.0.1"),trunc:pureAndGlobal("math/trunc",["es6.math.trunc"],"7.0.1")},Number:{EPSILON:pureAndGlobal("number/epsilon",["es6.number.epsilon"]),MIN_SAFE_INTEGER:pureAndGlobal("number/min-safe-integer",["es6.number.min-safe-integer"]),MAX_SAFE_INTEGER:pureAndGlobal("number/max-safe-integer",["es6.number.max-safe-integer"]),isFinite:pureAndGlobal("number/is-finite",["es6.number.is-finite"]),isInteger:pureAndGlobal("number/is-integer",["es6.number.is-integer"]),isSafeInteger:pureAndGlobal("number/is-safe-integer",["es6.number.is-safe-integer"]),isNaN:pureAndGlobal("number/is-nan",["es6.number.is-nan"]),parseFloat:pureAndGlobal("number/parse-float",["es6.number.parse-float"]),parseInt:pureAndGlobal("number/parse-int",["es6.number.parse-int"])},Object:{assign:pureAndGlobal("object/assign",["es6.object.assign"]),create:pureAndGlobal("object/create",["es6.object.create"]),defineProperties:pureAndGlobal("object/define-properties",["es6.object.define-properties"]),defineProperty:pureAndGlobal("object/define-property",["es6.object.define-property"]),entries:pureAndGlobal("object/entries",["es7.object.entries"]),freeze:pureAndGlobal("object/freeze",["es6.object.freeze"]),getOwnPropertyDescriptor:pureAndGlobal("object/get-own-property-descriptor",["es6.object.get-own-property-descriptor"]),getOwnPropertyDescriptors:pureAndGlobal("object/get-own-property-descriptors",["es7.object.get-own-property-descriptors"]),getOwnPropertyNames:pureAndGlobal("object/get-own-property-names",["es6.object.get-own-property-names"]),getOwnPropertySymbols:pureAndGlobal("object/get-own-property-symbols",["es6.symbol"]),getPrototypeOf:pureAndGlobal("object/get-prototype-of",["es6.object.get-prototype-of"]),is:pureAndGlobal("object/is",["es6.object.is"]),isExtensible:pureAndGlobal("object/is-extensible",["es6.object.is-extensible"]),isFrozen:pureAndGlobal("object/is-frozen",["es6.object.is-frozen"]),isSealed:pureAndGlobal("object/is-sealed",["es6.object.is-sealed"]),keys:pureAndGlobal("object/keys",["es6.object.keys"]),preventExtensions:pureAndGlobal("object/prevent-extensions",["es6.object.prevent-extensions"]),seal:pureAndGlobal("object/seal",["es6.object.seal"]),setPrototypeOf:pureAndGlobal("object/set-prototype-of",["es6.object.set-prototype-of"]),values:pureAndGlobal("object/values",["es7.object.values"])},Promise:{all:globalOnly(n),race:globalOnly(n)},Reflect:{apply:pureAndGlobal("reflect/apply",["es6.reflect.apply"]),construct:pureAndGlobal("reflect/construct",["es6.reflect.construct"]),defineProperty:pureAndGlobal("reflect/define-property",["es6.reflect.define-property"]),deleteProperty:pureAndGlobal("reflect/delete-property",["es6.reflect.delete-property"]),get:pureAndGlobal("reflect/get",["es6.reflect.get"]),getOwnPropertyDescriptor:pureAndGlobal("reflect/get-own-property-descriptor",["es6.reflect.get-own-property-descriptor"]),getPrototypeOf:pureAndGlobal("reflect/get-prototype-of",["es6.reflect.get-prototype-of"]),has:pureAndGlobal("reflect/has",["es6.reflect.has"]),isExtensible:pureAndGlobal("reflect/is-extensible",["es6.reflect.is-extensible"]),ownKeys:pureAndGlobal("reflect/own-keys",["es6.reflect.own-keys"]),preventExtensions:pureAndGlobal("reflect/prevent-extensions",["es6.reflect.prevent-extensions"]),set:pureAndGlobal("reflect/set",["es6.reflect.set"]),setPrototypeOf:pureAndGlobal("reflect/set-prototype-of",["es6.reflect.set-prototype-of"])},String:{at:pureOnly("string/at","es7.string.at"),fromCodePoint:pureAndGlobal("string/from-code-point",["es6.string.from-code-point"]),raw:pureAndGlobal("string/raw",["es6.string.raw"])},Symbol:{asyncIterator:globalOnly(["es6.symbol","es7.symbol.async-iterator"]),for:pureOnly("symbol/for","es6.symbol"),hasInstance:pureOnly("symbol/has-instance","es6.symbol"),isConcatSpreadable:pureOnly("symbol/is-concat-spreadable","es6.symbol"),iterator:define("es6.symbol","symbol/iterator",n),keyFor:pureOnly("symbol/key-for","es6.symbol"),match:pureAndGlobal("symbol/match",["es6.regexp.match"]),replace:pureOnly("symbol/replace","es6.symbol"),search:pureOnly("symbol/search","es6.symbol"),species:pureOnly("symbol/species","es6.symbol"),split:pureOnly("symbol/split","es6.symbol"),toPrimitive:pureOnly("symbol/to-primitive","es6.symbol"),toStringTag:pureOnly("symbol/to-string-tag","es6.symbol"),unscopables:pureOnly("symbol/unscopables","es6.symbol")}};t.StaticProperties=c},400:(e,t,r)=>{"use strict";t.__esModule=true;t.hasMinVersion=hasMinVersion;var s=_interopRequireDefault(r(7849));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function hasMinVersion(e,t){if(!t||!e)return true;if(s.default.valid(t))t=`^${t}`;return!s.default.intersects(`<${e}`,t)&&!s.default.intersects(`>=8.0.0`,t)}},9897:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireDefault(r(1268));var a=r(2816);var n=_interopRequireDefault(r(372));var o=r(400);var i=_interopRequireDefault(r(6389));var l=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const{types:c}=l.default||l;const u="#__secret_key__@babel/preset-env__compatibility";const p="#__secret_key__@babel/runtime__compatibility";const f=Function.call.bind(Object.hasOwnProperty);var d=(0,i.default)((function(e,{[u]:{entryInjectRegenerator:t}={},[p]:{useBabelRuntime:r,runtimeVersion:i,ext:l=".js"}={}}){const d=e.createMetaResolver({global:a.BuiltIns,static:a.StaticProperties,instance:a.InstanceProperties});const{debug:m,shouldInjectPolyfill:y,method:g}=e;const h=(0,n.default)(e.targets,g,s.default);const b=r?`${r}/core-js`:g==="usage-pure"?"core-js/library/fn":"core-js/modules";function inject(e,t){if(typeof e==="string"){if(f(h,e)&&y(e)){m(e);t.injectGlobalImport(`${b}/${e}.js`)}return}e.forEach((e=>inject(e,t)))}function maybeInjectPure(e,t,r){const{pure:s,meta:a,name:n}=e;if(!s||!y(n))return;if(i&&a&&a.minRuntimeVersion&&!(0,o.hasMinVersion)(a&&a.minRuntimeVersion,i)){return}return r.injectDefaultImport(`${b}/${s}${l}`,t)}return{name:"corejs2",polyfills:h,entryGlobal(e,r,s){if(e.kind==="import"&&e.source==="core-js"){m(null);inject(Object.keys(h),r);if(t){r.injectGlobalImport("regenerator-runtime/runtime.js")}s.remove()}},usageGlobal(e,t){const r=d(e);if(!r)return;let s=r.desc.global;if(r.kind!=="global"&&e.object&&e.placement==="prototype"){const t=e.object.toLowerCase();s=s.filter((e=>e.includes(t)))}inject(s,t)},usagePure(e,t,r){if(e.kind==="in"){if(e.key==="Symbol.iterator"){r.replaceWith(c.callExpression(t.injectDefaultImport(`${b}/is-iterable${l}`,"isIterable"),[r.node.right]))}return}if(r.parentPath.isUnaryExpression({operator:"delete"}))return;if(e.kind==="property"){if(!r.isMemberExpression())return;if(!r.isReferenced())return;if(e.key==="Symbol.iterator"&&y("es6.symbol")&&r.parentPath.isCallExpression({callee:r.node})&&r.parent.arguments.length===0){r.parentPath.replaceWith(c.callExpression(t.injectDefaultImport(`${b}/get-iterator${l}`,"getIterator"),[r.node.object]));r.skip();return}}const s=d(e);if(!s)return;const a=maybeInjectPure(s.desc,s.name,t);if(a)r.replaceWith(a)},visitor:g==="usage-global"&&{YieldExpression(t){if(t.node.delegate){inject("web.dom.iterable",e.getUtils(t))}},"ForOfStatement|ArrayPattern"(t){a.CommonIterators.forEach((r=>inject(r,e.getUtils(t))))}}}}));t["default"]=d},1268:(e,t,r)=>{e.exports=r(516)},9270:(e,t,r)=>{e.exports=r(5246)},559:(e,t,r)=>{e.exports=r(4812)},4245:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getInclusionReasons=getInclusionReasons;var s=r(7849);var a=r(834);var n=r(4208);function getInclusionReasons(e,t,r){const o=r[e]||{};return Object.keys(t).reduce(((e,r)=>{const i=(0,n.getLowestImplementedVersion)(o,r);const l=t[r];if(!i){e[r]=(0,a.prettifyVersion)(l)}else{const t=(0,n.isUnreleasedVersion)(i,r);const o=(0,n.isUnreleasedVersion)(l,r);if(!o&&(t||s.lt(l.toString(),(0,n.semverify)(i)))){e[r]=(0,a.prettifyVersion)(l)}}return e}),{})}},425:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.targetsSupported=targetsSupported;t.isRequired=isRequired;t["default"]=filterItems;var s=r(7849);var a=r(559);var n=r(4208);function targetsSupported(e,t){const r=Object.keys(e);if(r.length===0){return false}const a=r.filter((r=>{const a=(0,n.getLowestImplementedVersion)(t,r);if(!a){return true}const o=e[r];if((0,n.isUnreleasedVersion)(o,r)){return false}if((0,n.isUnreleasedVersion)(a,r)){return true}if(!s.valid(o.toString())){throw new Error(`Invalid version passed for target "${r}": "${o}". `+"Versions must be in semver format (major.minor.patch)")}return s.gt((0,n.semverify)(a),o.toString())}));return a.length===0}function isRequired(e,t,{compatData:r=a,includes:s,excludes:n}={}){if(n!=null&&n.has(e))return false;if(s!=null&&s.has(e))return true;return!targetsSupported(t,r[e])}function filterItems(e,t,r,s,a,n,o){const i=new Set;const l={compatData:e,includes:t,excludes:r};for(const t in e){if(isRequired(t,s,l)){i.add(t)}else if(o){const e=o.get(t);if(e){i.add(e)}}}if(a){a.forEach((e=>!r.has(e)&&i.add(e)))}if(n){n.forEach((e=>!t.has(e)&&i.delete(e)))}return i}},8097:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isBrowsersQueryValid=isBrowsersQueryValid;t["default"]=getTargets;Object.defineProperty(t,"unreleasedLabels",{enumerable:true,get:function(){return i.unreleasedLabels}});Object.defineProperty(t,"TargetNames",{enumerable:true,get:function(){return l.TargetNames}});Object.defineProperty(t,"prettifyTargets",{enumerable:true,get:function(){return c.prettifyTargets}});Object.defineProperty(t,"getInclusionReasons",{enumerable:true,get:function(){return u.getInclusionReasons}});Object.defineProperty(t,"filterItems",{enumerable:true,get:function(){return p.default}});Object.defineProperty(t,"isRequired",{enumerable:true,get:function(){return p.isRequired}});var s=r(4907);var a=r(7347);var n=r(9270);var o=r(4208);var i=r(6124);var l=r(7891);var c=r(834);var u=r(4245);var p=r(425);const f=n["es6.module"];const d=new a.OptionValidator("@babel/helper-compilation-targets");function validateTargetNames(e){const t=Object.keys(l.TargetNames);for(const r of Object.keys(e)){if(!(r in l.TargetNames)){throw new Error(d.formatMessage(`'${r}' is not a valid target\n- Did you mean '${(0,a.findSuggestion)(r,t)}'?`))}}return e}function isBrowsersQueryValid(e){return typeof e==="string"||Array.isArray(e)&&e.every((e=>typeof e==="string"))}function validateBrowsers(e){d.invariant(e===undefined||isBrowsersQueryValid(e),`'${String(e)}' is not a valid browserslist query`);return e}function getLowestVersions(e){return e.reduce(((e,t)=>{const[r,s]=t.split(" ");const a=i.browserNameMap[r];if(!a){return e}try{const t=s.split("-")[0].toLowerCase();const n=(0,o.isUnreleasedVersion)(t,r);if(!e[a]){e[a]=n?t:(0,o.semverify)(t);return e}const i=e[a];const l=(0,o.isUnreleasedVersion)(i,r);if(l&&n){e[a]=(0,o.getLowestUnreleased)(i,t,r)}else if(l){e[a]=(0,o.semverify)(t)}else if(!l&&!n){const r=(0,o.semverify)(t);e[a]=(0,o.semverMin)(i,r)}}catch(e){}return e}),{})}function outputDecimalWarning(e){if(!e.length){return}console.warn("Warning, the following targets are using a decimal version:\n");e.forEach((({target:e,value:t})=>console.warn(` ${e}: ${t}`)));console.warn(`\nWe recommend using a string for minor/patch versions to avoid numbers like 6.10\ngetting parsed as 6.1, which can lead to unexpected behavior.\n`)}function semverifyTarget(e,t){try{return(0,o.semverify)(t)}catch(r){throw new Error(d.formatMessage(`'${t}' is not a valid value for 'targets.${e}'.`))}}const m={__default(e,t){const r=(0,o.isUnreleasedVersion)(t,e)?t.toLowerCase():semverifyTarget(e,t);return[e,r]},node(e,t){const r=t===true||t==="current"?process.versions.node:semverifyTarget(e,t);return[e,r]}};function generateTargets(e){const t=Object.assign({},e);delete t.esmodules;delete t.browsers;return t}function resolveTargets(e){const t=s(e,{mobileToDesktop:true});return getLowestVersions(t)}function getTargets(e={},t={}){var r;let{browsers:a,esmodules:n}=e;const{configPath:i="."}=t;validateBrowsers(a);const l=generateTargets(e);let c=validateTargetNames(l);const u=!!a;const p=u||Object.keys(c).length>0;const d=!t.ignoreBrowserslistConfig&&!p;if(!a&&d){a=s.loadConfig({config:t.configFile,path:i,env:t.browserslistEnv});if(a==null){{a=[]}}}if(n&&(n!=="intersect"||!((r=a)!=null&&r.length))){a=Object.keys(f).map((e=>`${e} >= ${f[e]}`)).join(", ");n=false}if(a){const e=resolveTargets(a);if(n==="intersect"){for(const t of Object.keys(e)){const r=e[t];if(f[t]){e[t]=(0,o.getHighestUnreleased)(r,(0,o.semverify)(f[t]),t)}else{delete e[t]}}}c=Object.assign(e,c)}const y={};const g=[];for(const e of Object.keys(c).sort()){var h;const t=c[e];if(typeof t==="number"&&t%1!==0){g.push({target:e,value:t})}const r=(h=m[e])!=null?h:m.__default;const[s,a]=r(e,t);if(a){y[s]=a}}outputDecimalWarning(g);return y}},7891:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.TargetNames=void 0;const r={node:"node",chrome:"chrome",opera:"opera",edge:"edge",firefox:"firefox",safari:"safari",ie:"ie",ios:"ios",android:"android",electron:"electron",samsung:"samsung"};t.TargetNames=r},834:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.prettifyVersion=prettifyVersion;t.prettifyTargets=prettifyTargets;var s=r(7849);var a=r(6124);function prettifyVersion(e){if(typeof e!=="string"){return e}const t=[s.major(e)];const r=s.minor(e);const a=s.patch(e);if(r||a){t.push(r)}if(a){t.push(a)}return t.join(".")}function prettifyTargets(e){return Object.keys(e).reduce(((t,r)=>{let s=e[r];const n=a.unreleasedLabels[r];if(typeof s==="string"&&n!==s){s=prettifyVersion(s)}t[r]=s;return t}),{})}},6124:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.browserNameMap=t.unreleasedLabels=void 0;const r={safari:"tp"};t.unreleasedLabels=r;const s={and_chr:"chrome",and_ff:"firefox",android:"android",chrome:"chrome",edge:"edge",firefox:"firefox",ie:"ie",ie_mob:"ie",ios_saf:"ios",node:"node",op_mob:"opera",opera:"opera",safari:"safari",samsung:"samsung"};t.browserNameMap=s},4208:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.semverMin=semverMin;t.semverify=semverify;t.isUnreleasedVersion=isUnreleasedVersion;t.getLowestUnreleased=getLowestUnreleased;t.getHighestUnreleased=getHighestUnreleased;t.getLowestImplementedVersion=getLowestImplementedVersion;var s=r(7849);var a=r(7347);var n=r(6124);const o=/^(\d+|\d+.\d+)$/;const i=new a.OptionValidator("@babel/helper-compilation-targets");function semverMin(e,t){return e&&s.lt(e,t)?e:t}function semverify(e){if(typeof e==="string"&&s.valid(e)){return e}i.invariant(typeof e==="number"||typeof e==="string"&&o.test(e),`'${e}' is not a valid version`);const t=e.toString().split(".");while(t.length<3){t.push("0")}return t.join(".")}function isUnreleasedVersion(e,t){const r=n.unreleasedLabels[t];return!!r&&r===e.toString().toLowerCase()}function getLowestUnreleased(e,t,r){const s=n.unreleasedLabels[r];const a=[e,t].some((e=>e===s));if(a){return e===a?t:e||t}return semverMin(e,t)}function getHighestUnreleased(e,t,r){return getLowestUnreleased(e,t,r)===e?t:e}function getLowestImplementedVersion(e,t){const r=e[t];if(!r&&t==="android"){return e.chrome}return r}},3318:(e,t,r)=>{"use strict";t.__esModule=true;t.stringifyTargetsMultiline=stringifyTargetsMultiline;t.stringifyTargets=stringifyTargets;t.presetEnvSilentDebugHeader=void 0;var s=r(8097);const a="#__secret_key__@babel/preset-env__don't_log_debug_header_and_resolved_targets";t.presetEnvSilentDebugHeader=a;function stringifyTargetsMultiline(e){return JSON.stringify((0,s.prettifyTargets)(e),null,2)}function stringifyTargets(e){return JSON.stringify(e).replace(/,/g,", ").replace(/^\{"/,'{ "').replace(/"\}$/,'" }')}},2551:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:a}=s.default||s;class ImportsCache{constructor(e){this._imports=new WeakMap;this._anonymousImports=new WeakMap;this._lastImports=new WeakMap;this._resolver=e}storeAnonymous(e,t,r){const s=this._normalizeKey(e,t);const n=this._ensure(this._anonymousImports,e,Set);if(n.has(s))return;const o=r(e.node.sourceType==="script",a.stringLiteral(this._resolver(t)));n.add(s);this._injectImport(e,o)}storeNamed(e,t,r,s){const n=this._normalizeKey(e,t,r);const o=this._ensure(this._imports,e,Map);if(!o.has(n)){const{node:i,name:l}=s(e.node.sourceType==="script",a.stringLiteral(this._resolver(t)),a.identifier(r));o.set(n,l);this._injectImport(e,i)}return a.identifier(o.get(n))}_injectImport(e,t){let r=this._lastImports.get(e);if(r&&r.node&&r.parent===e.node&&r.container===e.node.body){r=r.insertAfter(t)}else{r=e.unshiftContainer("body",t)}r=r[r.length-1];this._lastImports.set(e,r)}_ensure(e,t,r){let s=e.get(t);if(!s){s=new r;e.set(t,s)}return s}_normalizeKey(e,t,r=""){const{sourceType:s}=e.node;return`${r&&s}::${t}::${r}`}}t["default"]=ImportsCache},6389:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=definePolyfillProvider;var s=r(558);var a=_interopRequireWildcard(r(8097));var n=r(3508);var o=_interopRequireDefault(r(2551));var i=r(3318);var l=r(8083);var c=_interopRequireWildcard(r(7107));var u=_interopRequireWildcard(r(3229));var p=_interopRequireDefault(r(4219));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var r={};var s=Object.keys(e);var a,n;for(n=0;n=0)continue;r[a]=e[a]}return r}const f=a.default.default||a.default;function resolveOptions(e,t){const{method:r,targets:s,ignoreBrowserslistConfig:a,configPath:n,debug:o,shouldInjectPolyfill:i,absoluteImports:l}=e,c=_objectWithoutPropertiesLoose(e,["method","targets","ignoreBrowserslistConfig","configPath","debug","shouldInjectPolyfill","absoluteImports"]);let u;if(r==="usage-global")u="usageGlobal";else if(r==="entry-global")u="entryGlobal";else if(r==="usage-pure")u="usagePure";else if(typeof r!=="string"){throw new Error(".method must be a string")}else{throw new Error(`.method must be one of "entry-global", "usage-global"`+` or "usage-pure" (received ${JSON.stringify(r)})`)}if(typeof i==="function"){if(e.include||e.exclude){throw new Error(`.include and .exclude are not supported when using the`+` .shouldInjectPolyfill function.`)}}else if(i!=null){throw new Error(`.shouldInjectPolyfill must be a function, or undefined`+` (received ${JSON.stringify(i)})`)}if(l!=null&&typeof l!=="boolean"&&typeof l!=="string"){throw new Error(`.absoluteImports must be a boolean, a string, or undefined`+` (received ${JSON.stringify(l)})`)}let p;if(s||n||a){const e=typeof s==="string"||Array.isArray(s)?{browsers:s}:s;p=f(e,{ignoreBrowserslistConfig:a,configPath:n})}else{p=t.targets()}return{method:r,methodName:u,targets:p,absoluteImports:l!=null?l:false,shouldInjectPolyfill:i,debug:!!o,providerOptions:c}}function instantiateProvider(e,t,r,s,i,c){const{method:f,methodName:d,targets:m,debug:y,shouldInjectPolyfill:g,providerOptions:h,absoluteImports:b}=resolveOptions(t,c);const x=(0,n.createUtilsGetter)(new o.default((e=>u.resolve(s,e,b))));let v,E;let j;let w;let _;const S=new Map;const k={babel:c,getUtils:x,method:t.method,targets:m,createMetaResolver:p.default,shouldInjectPolyfill(t){if(w===undefined){throw new Error(`Internal error in the ${e.name} provider: `+`shouldInjectPolyfill() can't be called during initialization.`)}if(!w.has(t)){console.warn(`Internal error in the ${O.name} provider: `+`unknown polyfill "${t}".`)}if(_&&!_(t))return false;let r=(0,a.isRequired)(t,m,{compatData:j,includes:v,excludes:E});if(g){r=g(t,r);if(typeof r!=="boolean"){throw new Error(`.shouldInjectPolyfill must return a boolean.`)}}return r},debug(e){i().found=true;if(!y||!e)return;if(i().polyfills.has(O.name))return;i().polyfills.set(e,j&&e&&j[e])},assertDependency(e,t="*"){if(r===false)return;if(b){return}const a=t==="*"?e:`${e}@^${t}`;const n=r.all?false:mapGetOr(S,`${e} :: ${s}`,(()=>u.has(s,e)));if(!n){i().missingDeps.add(a)}}};const O=e(k,h,s);if(typeof O[d]!=="function"){throw new Error(`The "${O.name||e.name}" provider doesn't `+`support the "${f}" polyfilling method.`)}if(Array.isArray(O.polyfills)){w=new Set(O.polyfills);_=O.filterPolyfills}else if(O.polyfills){w=new Set(Object.keys(O.polyfills));j=O.polyfills;_=O.filterPolyfills}else{w=new Set}({include:v,exclude:E}=(0,l.validateIncludeExclude)(O.name||e.name,w,h.include||[],h.exclude||[]));return{debug:y,method:f,targets:m,provider:O,callProvider(e,t){const r=x(t);O[d](e,r,t)}}}function definePolyfillProvider(e){return(0,s.declare)(((t,r,s)=>{t.assertVersion(7);const{traverse:n}=t;let o;const p=(0,l.applyMissingDependenciesDefaults)(r,t);const{debug:f,method:d,targets:m,provider:y,callProvider:g}=instantiateProvider(e,r,p,s,(()=>o),t);const h=d==="entry-global"?c.entry:c.usage;const b=y.visitor?n.visitors.merge([h(g),y.visitor]):h(g);if(f&&f!==i.presetEnvSilentDebugHeader){console.log(`${y.name}: \`DEBUG\` option`);console.log(`\nUsing targets: ${(0,i.stringifyTargetsMultiline)(m)}`);console.log(`\nUsing polyfills with \`${d}\` method:`)}return{name:"inject-polyfills",visitor:b,pre(){var e;o={polyfills:new Map,found:false,providers:new Set,missingDeps:new Set};(e=y.pre)==null?void 0:e.apply(this,arguments)},post(){var e;(e=y.post)==null?void 0:e.apply(this,arguments);if(p!==false){if(p.log==="per-file"){u.logMissing(o.missingDeps)}else{u.laterLogMissing(o.missingDeps)}}if(!f)return;if(this.filename)console.log(`\n[${this.filename}]`);if(o.polyfills.size===0){console.log(d==="entry-global"?o.found?`Based on your targets, the ${y.name} polyfill did not add any polyfill.`:`The entry point for the ${y.name} polyfill has not been found.`:`Based on your code and targets, the ${y.name} polyfill did not add any polyfill.`);return}if(d==="entry-global"){console.log(`The ${y.name} polyfill entry has been replaced with `+`the following polyfills:`)}else{console.log(`The ${y.name} polyfill added the following polyfills:`)}for(const[e,t]of o.polyfills){if(t){const r=(0,a.getInclusionReasons)(e,m,t);const s=JSON.stringify(r).replace(/,/g,", ").replace(/^\{"/,'{ "').replace(/"\}$/,'" }');console.log(` ${e} ${s}`)}else{console.log(` ${e}`)}}}}}))}function mapGetOr(e,t,r){let s=e.get(t);if(s===undefined){s=r();e.set(t,s)}return s}},4219:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=createMetaResolver;var s=r(3508);const a=new Set(["global","globalThis","self","window"]);function createMetaResolver(e){const{static:t,instance:r,global:n}=e;return e=>{if(e.kind==="global"&&n&&(0,s.has)(n,e.name)){return{kind:"global",desc:n[e.name],name:e.name}}if(e.kind==="property"||e.kind==="in"){const{placement:o,object:i,key:l}=e;if(i&&o==="static"){if(n&&a.has(i)&&(0,s.has)(n,l)){return{kind:"global",desc:n[l],name:l}}if(t&&(0,s.has)(t,i)&&(0,s.has)(t[i],l)){return{kind:"static",desc:t[i][l],name:`${i}$${l}`}}}if(r&&(0,s.has)(r,l)){return{kind:"instance",desc:r[l],name:`${l}`}}}}}},3229:(e,t,r)=>{"use strict";t.__esModule=true;t.resolve=resolve;t.has=has;t.logMissing=logMissing;t.laterLogMissing=laterLogMissing;var s=_interopRequireDefault(r(1017));var a=_interopRequireDefault(r(6240));var n=_interopRequireDefault(r(9485));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const o=parseFloat(process.versions.node)>=8.9;function resolve(e,t,r){if(r===false)return t;let a=e;if(typeof r==="string"){a=s.default.resolve(a,r)}let i,l;let c=t.indexOf("/");if(t[0]==="@"){c=t.indexOf("/",c+1)}if(c===-1){i=t;l=""}else{i=t.slice(0,c);l=t.slice(c)}try{let e;if(o){e=require.resolve(`${i}/package.json`,{paths:[a]})}else{e=n.default.sync(`${i}/package.json`,{basedir:a})}return s.default.dirname(e)+l}catch(r){if(r.code!=="MODULE_NOT_FOUND")throw r;throw Object.assign(new Error(`Failed to resolve "${t}" relative to "${e}"`),{code:"BABEL_POLYFILL_NOT_FOUND",polyfill:t,dirname:e})}}function has(e,t){try{if(o){require.resolve(t,{paths:[e]})}else{n.default.sync(t,{basedir:e})}return true}catch(e){return false}}function logMissing(e){if(e.size===0)return;const t=Array.from(e).sort().join(" ");console.warn("\nSome polyfills have been added but are not present in your dependencies.\n"+"Please run one of the following commands:\n"+`\tnpm install --save ${t}\n`+`\tyarn add ${t}\n`);process.exitCode=1}let i=new Set;const l=(0,a.default)((()=>{logMissing(i);i=new Set}),100);function laterLogMissing(e){if(e.size===0)return;e.forEach((e=>i.add(e)));l()}},8083:(e,t,r)=>{"use strict";t.__esModule=true;t.validateIncludeExclude=validateIncludeExclude;t.applyMissingDependenciesDefaults=applyMissingDependenciesDefaults;var s=r(3508);function patternToRegExp(e){if(e instanceof RegExp)return e;try{return new RegExp(`^${e}$`)}catch(e){return null}}function buildUnusedError(e,t){if(!t.length)return"";return` - The following "${e}" patterns didn't match any polyfill:\n`+t.map((e=>` ${String(e)}\n`)).join("")}function buldDuplicatesError(e){if(!e.size)return"";return` - The following polyfills were matched both by "include" and "exclude" patterns:\n`+Array.from(e,(e=>` ${e}\n`)).join("")}function validateIncludeExclude(e,t,r,a){let n;const filter=e=>{const r=patternToRegExp(e);if(!r)return false;let s=false;for(const e of t){if(r.test(e)){s=true;n.add(e)}}return!s};const o=n=new Set;const i=Array.from(r).filter(filter);const l=n=new Set;const c=Array.from(a).filter(filter);const u=(0,s.intersection)(o,l);if(u.size>0||i.length>0||c.length>0){throw new Error(`Error while validating the "${e}" provider options:\n`+buildUnusedError("include",i)+buildUnusedError("exclude",c)+buldDuplicatesError(u))}return{include:o,exclude:l}}function applyMissingDependenciesDefaults(e,t){const{missingDependencies:r={}}=e;if(r===false)return false;const s=t.caller((e=>e==null?void 0:e.name));const{log:a="deferred",inject:n=(s==="rollup-plugin-babel"?"throw":"import"),all:o=false}=r;return{log:a,inject:n,all:o}}},3508:(e,t,r)=>{"use strict";t.__esModule=true;t.intersection=intersection;t.has=has;t.resolveKey=resolveKey;t.resolveSource=resolveSource;t.getImportSource=getImportSource;t.getRequireSource=getRequireSource;t.createUtilsGetter=createUtilsGetter;var s=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:a,template:n}=s.default||s;function intersection(e,t){const r=new Set;e.forEach((e=>t.has(e)&&r.add(e)));return r}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function getType(e){return Object.prototype.toString.call(e).slice(8,-1)}function resolveId(e){if(e.isIdentifier()&&!e.scope.hasBinding(e.node.name,true)){return e.node.name}const{deopt:t}=e.evaluate();if(t&&t.isIdentifier()){return t.node.name}}function resolveKey(e,t=false){const{node:r,parent:s,scope:a}=e;if(e.isStringLiteral())return r.value;const{name:n}=r;const o=e.isIdentifier();if(o&&!(t||s.computed))return n;if(t&&e.isMemberExpression()&&e.get("object").isIdentifier({name:"Symbol"})&&!a.hasBinding("Symbol",true)){const t=resolveKey(e.get("property"),e.node.computed);if(t)return"Symbol."+t}if(!o||a.hasBinding(n,true)){const{value:t}=e.evaluate();if(typeof t==="string")return t}}function resolveSource(e){if(e.isMemberExpression()&&e.get("property").isIdentifier({name:"prototype"})){const t=resolveId(e.get("object"));if(t){return{id:t,placement:"prototype"}}return{id:null,placement:null}}const t=resolveId(e);if(t){return{id:t,placement:"static"}}const{value:r}=e.evaluate();if(r!==undefined){return{id:getType(r),placement:"prototype"}}else if(e.isRegExpLiteral()){return{id:"RegExp",placement:"prototype"}}else if(e.isFunction()){return{id:"Function",placement:"prototype"}}return{id:null,placement:null}}function getImportSource({node:e}){if(e.specifiers.length===0)return e.source.value}function getRequireSource({node:e}){if(!a.isExpressionStatement(e))return;const{expression:t}=e;const r=a.isCallExpression(t)&&a.isIdentifier(t.callee)&&t.callee.name==="require"&&t.arguments.length===1&&a.isStringLiteral(t.arguments[0]);if(r)return t.arguments[0].value}function hoist(e){e._blockHoist=3;return e}function createUtilsGetter(e){return t=>{const r=t.findParent((e=>e.isProgram()));return{injectGlobalImport(t){e.storeAnonymous(r,t,((e,t)=>e?n.statement.ast`require(${t})`:a.importDeclaration([],t)))},injectNamedImport(t,s,o=s){return e.storeNamed(r,t,s,((e,t,s)=>{const i=r.scope.generateUidIdentifier(o);return{node:e?hoist(n.statement.ast` + `)}}}))}}}}},8170:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(3931);function isRegeneratorSource(e){return e==="regenerator-runtime/runtime"||e==="regenerator-runtime/runtime.js"}function _default(){const e={ImportDeclaration(e){if(isRegeneratorSource((0,s.getImportSource)(e))){this.regeneratorImportExcluded=true;e.remove()}},Program(e){e.get("body").forEach((e=>{if(isRegeneratorSource((0,s.getRequireSource)(e))){this.regeneratorImportExcluded=true;e.remove()}}))}};return{name:"preset-env/remove-regenerator",visitor:e,pre(){this.regeneratorImportExcluded=false},post(){if(this.opts.debug&&this.regeneratorImportExcluded){let e=this.file.opts.filename;if(process.env.BABEL_ENV==="test"){e=e.replace(/\\/g,"/")}console.log(`\n[${e}] Based on your targets, regenerator-runtime import excluded.`)}}}}},3931:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getImportSource=getImportSource;t.getRequireSource=getRequireSource;t.isPolyfillSource=isPolyfillSource;var s=r(8622);function getImportSource({node:e}){if(e.specifiers.length===0)return e.source.value}function getRequireSource({node:e}){if(!s.isExpressionStatement(e))return;const{expression:t}=e;if(s.isCallExpression(t)&&s.isIdentifier(t.callee)&&t.callee.name==="require"&&t.arguments.length===1&&s.isStringLiteral(t.arguments[0])){return t.arguments[0].value}}function isPolyfillSource(e){return e==="@babel/polyfill"||e==="core-js"}},1068:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(558);var a=r(4350);var n=r(7347);function _interopDefaultLegacy(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var o=_interopDefaultLegacy(a);const i=new n.OptionValidator("@babel/preset-typescript");function normalizeOptions(e={}){let{allowNamespaces:t=true,jsxPragma:r,onlyRemoveTypeImports:s}=e;const a={allExtensions:"allExtensions",allowNamespaces:"allowNamespaces",isTSX:"isTSX",jsxPragma:"jsxPragma",jsxPragmaFrag:"jsxPragmaFrag",onlyRemoveTypeImports:"onlyRemoveTypeImports",optimizeConstEnums:"optimizeConstEnums"};const n=i.validateStringOption(a.jsxPragmaFrag,e.jsxPragmaFrag,"React.Fragment");const o=i.validateBooleanOption(a.allExtensions,e.allExtensions,false);const l=i.validateBooleanOption(a.isTSX,e.isTSX,false);if(l){i.invariant(o,"isTSX:true requires allExtensions:true")}const c=i.validateBooleanOption(a.optimizeConstEnums,e.optimizeConstEnums,false);return{allExtensions:o,allowNamespaces:t,isTSX:l,jsxPragma:r,jsxPragmaFrag:n,onlyRemoveTypeImports:s,optimizeConstEnums:c}}var l=s.declare(((e,t)=>{e.assertVersion(7);const{allExtensions:r,allowNamespaces:s,isTSX:a,jsxPragma:n,jsxPragmaFrag:i,onlyRemoveTypeImports:l,optimizeConstEnums:c}=normalizeOptions(t);const pluginOptions=e=>({allowDeclareFields:t.allowDeclareFields,allowNamespaces:s,isTSX:e,jsxPragma:n,jsxPragmaFrag:i,onlyRemoveTypeImports:l,optimizeConstEnums:c});return{overrides:r?[{plugins:[[o["default"],pluginOptions(a)]]}]:[{test:/\.ts$/,plugins:[[o["default"],pluginOptions(false)]]},{test:/\.tsx$/,plugins:[[o["default"],pluginOptions(true)]]}]}}));t["default"]=l},372:(e,t)=>{"use strict";t.__esModule=true;t["default"]=_default;function _extends(){_extends=Object.assign||function(e){for(var t=1;te!=="node"));return _extends({},a,t==="usage-pure"?s:null,o||i?r:null)}},2816:(e,t,r)=>{"use strict";t.__esModule=true;t.StaticProperties=t.InstanceProperties=t.BuiltIns=t.CommonIterators=void 0;var s=_interopRequireDefault(r(1268));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const define=(e,t,r=[],s)=>({name:e,pure:t,global:r,meta:s});const pureAndGlobal=(e,t,r=null)=>define(t[0],e,t,{minRuntimeVersion:r});const globalOnly=e=>define(e[0],null,e);const pureOnly=(e,t)=>define(t,e,[]);const a=["es6.object.to-string","es6.array.iterator","web.dom.iterable"];const n=["es6.string.iterator",...a];t.CommonIterators=n;const o=["es6.object.to-string","es6.promise"];const i={DataView:globalOnly(["es6.typed.data-view"]),Float32Array:globalOnly(["es6.typed.float32-array"]),Float64Array:globalOnly(["es6.typed.float64-array"]),Int8Array:globalOnly(["es6.typed.int8-array"]),Int16Array:globalOnly(["es6.typed.int16-array"]),Int32Array:globalOnly(["es6.typed.int32-array"]),Map:pureAndGlobal("map",["es6.map",...n]),Number:globalOnly(["es6.number.constructor"]),Promise:pureAndGlobal("promise",o),RegExp:globalOnly(["es6.regexp.constructor"]),Set:pureAndGlobal("set",["es6.set",...n]),Symbol:pureAndGlobal("symbol",["es6.symbol"]),Uint8Array:globalOnly(["es6.typed.uint8-array"]),Uint8ClampedArray:globalOnly(["es6.typed.uint8-clamped-array"]),Uint16Array:globalOnly(["es6.typed.uint16-array"]),Uint32Array:globalOnly(["es6.typed.uint32-array"]),WeakMap:pureAndGlobal("weak-map",["es6.weak-map",...n]),WeakSet:pureAndGlobal("weak-set",["es6.weak-set",...n]),setImmediate:pureOnly("set-immediate","web.immediate"),clearImmediate:pureOnly("clear-immediate","web.immediate"),parseFloat:pureOnly("parse-float","es6.parse-float"),parseInt:pureOnly("parse-int","es6.parse-int")};t.BuiltIns=i;const l={__defineGetter__:globalOnly(["es7.object.define-getter"]),__defineSetter__:globalOnly(["es7.object.define-setter"]),__lookupGetter__:globalOnly(["es7.object.lookup-getter"]),__lookupSetter__:globalOnly(["es7.object.lookup-setter"]),anchor:globalOnly(["es6.string.anchor"]),big:globalOnly(["es6.string.big"]),bind:globalOnly(["es6.function.bind"]),blink:globalOnly(["es6.string.blink"]),bold:globalOnly(["es6.string.bold"]),codePointAt:globalOnly(["es6.string.code-point-at"]),copyWithin:globalOnly(["es6.array.copy-within"]),endsWith:globalOnly(["es6.string.ends-with"]),entries:globalOnly(a),every:globalOnly(["es6.array.every"]),fill:globalOnly(["es6.array.fill"]),filter:globalOnly(["es6.array.filter"]),finally:globalOnly(["es7.promise.finally",...o]),find:globalOnly(["es6.array.find"]),findIndex:globalOnly(["es6.array.find-index"]),fixed:globalOnly(["es6.string.fixed"]),flags:globalOnly(["es6.regexp.flags"]),flatMap:globalOnly(["es7.array.flat-map"]),fontcolor:globalOnly(["es6.string.fontcolor"]),fontsize:globalOnly(["es6.string.fontsize"]),forEach:globalOnly(["es6.array.for-each"]),includes:globalOnly(["es6.string.includes","es7.array.includes"]),indexOf:globalOnly(["es6.array.index-of"]),italics:globalOnly(["es6.string.italics"]),keys:globalOnly(a),lastIndexOf:globalOnly(["es6.array.last-index-of"]),link:globalOnly(["es6.string.link"]),map:globalOnly(["es6.array.map"]),match:globalOnly(["es6.regexp.match"]),name:globalOnly(["es6.function.name"]),padStart:globalOnly(["es7.string.pad-start"]),padEnd:globalOnly(["es7.string.pad-end"]),reduce:globalOnly(["es6.array.reduce"]),reduceRight:globalOnly(["es6.array.reduce-right"]),repeat:globalOnly(["es6.string.repeat"]),replace:globalOnly(["es6.regexp.replace"]),search:globalOnly(["es6.regexp.search"]),small:globalOnly(["es6.string.small"]),some:globalOnly(["es6.array.some"]),sort:globalOnly(["es6.array.sort"]),split:globalOnly(["es6.regexp.split"]),startsWith:globalOnly(["es6.string.starts-with"]),strike:globalOnly(["es6.string.strike"]),sub:globalOnly(["es6.string.sub"]),sup:globalOnly(["es6.string.sup"]),toISOString:globalOnly(["es6.date.to-iso-string"]),toJSON:globalOnly(["es6.date.to-json"]),toString:globalOnly(["es6.object.to-string","es6.date.to-string","es6.regexp.to-string"]),trim:globalOnly(["es6.string.trim"]),trimEnd:globalOnly(["es7.string.trim-right"]),trimLeft:globalOnly(["es7.string.trim-left"]),trimRight:globalOnly(["es7.string.trim-right"]),trimStart:globalOnly(["es7.string.trim-left"]),values:globalOnly(a)};t.InstanceProperties=l;if("es6.array.slice"in s.default){l.slice=globalOnly(["es6.array.slice"])}const c={Array:{from:pureAndGlobal("array/from",["es6.symbol","es6.array.from",...n]),isArray:pureAndGlobal("array/is-array",["es6.array.is-array"]),of:pureAndGlobal("array/of",["es6.array.of"])},Date:{now:pureAndGlobal("date/now",["es6.date.now"])},JSON:{stringify:pureOnly("json/stringify","es6.symbol")},Math:{acosh:pureAndGlobal("math/acosh",["es6.math.acosh"],"7.0.1"),asinh:pureAndGlobal("math/asinh",["es6.math.asinh"],"7.0.1"),atanh:pureAndGlobal("math/atanh",["es6.math.atanh"],"7.0.1"),cbrt:pureAndGlobal("math/cbrt",["es6.math.cbrt"],"7.0.1"),clz32:pureAndGlobal("math/clz32",["es6.math.clz32"],"7.0.1"),cosh:pureAndGlobal("math/cosh",["es6.math.cosh"],"7.0.1"),expm1:pureAndGlobal("math/expm1",["es6.math.expm1"],"7.0.1"),fround:pureAndGlobal("math/fround",["es6.math.fround"],"7.0.1"),hypot:pureAndGlobal("math/hypot",["es6.math.hypot"],"7.0.1"),imul:pureAndGlobal("math/imul",["es6.math.imul"],"7.0.1"),log1p:pureAndGlobal("math/log1p",["es6.math.log1p"],"7.0.1"),log10:pureAndGlobal("math/log10",["es6.math.log10"],"7.0.1"),log2:pureAndGlobal("math/log2",["es6.math.log2"],"7.0.1"),sign:pureAndGlobal("math/sign",["es6.math.sign"],"7.0.1"),sinh:pureAndGlobal("math/sinh",["es6.math.sinh"],"7.0.1"),tanh:pureAndGlobal("math/tanh",["es6.math.tanh"],"7.0.1"),trunc:pureAndGlobal("math/trunc",["es6.math.trunc"],"7.0.1")},Number:{EPSILON:pureAndGlobal("number/epsilon",["es6.number.epsilon"]),MIN_SAFE_INTEGER:pureAndGlobal("number/min-safe-integer",["es6.number.min-safe-integer"]),MAX_SAFE_INTEGER:pureAndGlobal("number/max-safe-integer",["es6.number.max-safe-integer"]),isFinite:pureAndGlobal("number/is-finite",["es6.number.is-finite"]),isInteger:pureAndGlobal("number/is-integer",["es6.number.is-integer"]),isSafeInteger:pureAndGlobal("number/is-safe-integer",["es6.number.is-safe-integer"]),isNaN:pureAndGlobal("number/is-nan",["es6.number.is-nan"]),parseFloat:pureAndGlobal("number/parse-float",["es6.number.parse-float"]),parseInt:pureAndGlobal("number/parse-int",["es6.number.parse-int"])},Object:{assign:pureAndGlobal("object/assign",["es6.object.assign"]),create:pureAndGlobal("object/create",["es6.object.create"]),defineProperties:pureAndGlobal("object/define-properties",["es6.object.define-properties"]),defineProperty:pureAndGlobal("object/define-property",["es6.object.define-property"]),entries:pureAndGlobal("object/entries",["es7.object.entries"]),freeze:pureAndGlobal("object/freeze",["es6.object.freeze"]),getOwnPropertyDescriptor:pureAndGlobal("object/get-own-property-descriptor",["es6.object.get-own-property-descriptor"]),getOwnPropertyDescriptors:pureAndGlobal("object/get-own-property-descriptors",["es7.object.get-own-property-descriptors"]),getOwnPropertyNames:pureAndGlobal("object/get-own-property-names",["es6.object.get-own-property-names"]),getOwnPropertySymbols:pureAndGlobal("object/get-own-property-symbols",["es6.symbol"]),getPrototypeOf:pureAndGlobal("object/get-prototype-of",["es6.object.get-prototype-of"]),is:pureAndGlobal("object/is",["es6.object.is"]),isExtensible:pureAndGlobal("object/is-extensible",["es6.object.is-extensible"]),isFrozen:pureAndGlobal("object/is-frozen",["es6.object.is-frozen"]),isSealed:pureAndGlobal("object/is-sealed",["es6.object.is-sealed"]),keys:pureAndGlobal("object/keys",["es6.object.keys"]),preventExtensions:pureAndGlobal("object/prevent-extensions",["es6.object.prevent-extensions"]),seal:pureAndGlobal("object/seal",["es6.object.seal"]),setPrototypeOf:pureAndGlobal("object/set-prototype-of",["es6.object.set-prototype-of"]),values:pureAndGlobal("object/values",["es7.object.values"])},Promise:{all:globalOnly(n),race:globalOnly(n)},Reflect:{apply:pureAndGlobal("reflect/apply",["es6.reflect.apply"]),construct:pureAndGlobal("reflect/construct",["es6.reflect.construct"]),defineProperty:pureAndGlobal("reflect/define-property",["es6.reflect.define-property"]),deleteProperty:pureAndGlobal("reflect/delete-property",["es6.reflect.delete-property"]),get:pureAndGlobal("reflect/get",["es6.reflect.get"]),getOwnPropertyDescriptor:pureAndGlobal("reflect/get-own-property-descriptor",["es6.reflect.get-own-property-descriptor"]),getPrototypeOf:pureAndGlobal("reflect/get-prototype-of",["es6.reflect.get-prototype-of"]),has:pureAndGlobal("reflect/has",["es6.reflect.has"]),isExtensible:pureAndGlobal("reflect/is-extensible",["es6.reflect.is-extensible"]),ownKeys:pureAndGlobal("reflect/own-keys",["es6.reflect.own-keys"]),preventExtensions:pureAndGlobal("reflect/prevent-extensions",["es6.reflect.prevent-extensions"]),set:pureAndGlobal("reflect/set",["es6.reflect.set"]),setPrototypeOf:pureAndGlobal("reflect/set-prototype-of",["es6.reflect.set-prototype-of"])},String:{at:pureOnly("string/at","es7.string.at"),fromCodePoint:pureAndGlobal("string/from-code-point",["es6.string.from-code-point"]),raw:pureAndGlobal("string/raw",["es6.string.raw"])},Symbol:{asyncIterator:globalOnly(["es6.symbol","es7.symbol.async-iterator"]),for:pureOnly("symbol/for","es6.symbol"),hasInstance:pureOnly("symbol/has-instance","es6.symbol"),isConcatSpreadable:pureOnly("symbol/is-concat-spreadable","es6.symbol"),iterator:define("es6.symbol","symbol/iterator",n),keyFor:pureOnly("symbol/key-for","es6.symbol"),match:pureAndGlobal("symbol/match",["es6.regexp.match"]),replace:pureOnly("symbol/replace","es6.symbol"),search:pureOnly("symbol/search","es6.symbol"),species:pureOnly("symbol/species","es6.symbol"),split:pureOnly("symbol/split","es6.symbol"),toPrimitive:pureOnly("symbol/to-primitive","es6.symbol"),toStringTag:pureOnly("symbol/to-string-tag","es6.symbol"),unscopables:pureOnly("symbol/unscopables","es6.symbol")}};t.StaticProperties=c},400:(e,t,r)=>{"use strict";t.__esModule=true;t.hasMinVersion=hasMinVersion;var s=_interopRequireDefault(r(7849));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function hasMinVersion(e,t){if(!t||!e)return true;if(s.default.valid(t))t=`^${t}`;return!s.default.intersects(`<${e}`,t)&&!s.default.intersects(`>=8.0.0`,t)}},9897:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireDefault(r(1268));var a=r(2816);var n=_interopRequireDefault(r(372));var o=r(400);var i=_interopRequireDefault(r(6389));var l=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const{types:c}=l.default||l;const u="#__secret_key__@babel/preset-env__compatibility";const p="#__secret_key__@babel/runtime__compatibility";const d=Function.call.bind(Object.hasOwnProperty);var f=(0,i.default)((function(e,{[u]:{entryInjectRegenerator:t}={},[p]:{useBabelRuntime:r,runtimeVersion:i,ext:l=".js"}={}}){const f=e.createMetaResolver({global:a.BuiltIns,static:a.StaticProperties,instance:a.InstanceProperties});const{debug:m,shouldInjectPolyfill:y,method:g}=e;const h=(0,n.default)(e.targets,g,s.default);const b=r?`${r}/core-js`:g==="usage-pure"?"core-js/library/fn":"core-js/modules";function inject(e,t){if(typeof e==="string"){if(d(h,e)&&y(e)){m(e);t.injectGlobalImport(`${b}/${e}.js`)}return}e.forEach((e=>inject(e,t)))}function maybeInjectPure(e,t,r){const{pure:s,meta:a,name:n}=e;if(!s||!y(n))return;if(i&&a&&a.minRuntimeVersion&&!(0,o.hasMinVersion)(a&&a.minRuntimeVersion,i)){return}return r.injectDefaultImport(`${b}/${s}${l}`,t)}return{name:"corejs2",polyfills:h,entryGlobal(e,r,s){if(e.kind==="import"&&e.source==="core-js"){m(null);inject(Object.keys(h),r);if(t){r.injectGlobalImport("regenerator-runtime/runtime.js")}s.remove()}},usageGlobal(e,t){const r=f(e);if(!r)return;let s=r.desc.global;if(r.kind!=="global"&&e.object&&e.placement==="prototype"){const t=e.object.toLowerCase();s=s.filter((e=>e.includes(t)))}inject(s,t)},usagePure(e,t,r){if(e.kind==="in"){if(e.key==="Symbol.iterator"){r.replaceWith(c.callExpression(t.injectDefaultImport(`${b}/is-iterable${l}`,"isIterable"),[r.node.right]))}return}if(r.parentPath.isUnaryExpression({operator:"delete"}))return;if(e.kind==="property"){if(!r.isMemberExpression())return;if(!r.isReferenced())return;if(e.key==="Symbol.iterator"&&y("es6.symbol")&&r.parentPath.isCallExpression({callee:r.node})&&r.parent.arguments.length===0){r.parentPath.replaceWith(c.callExpression(t.injectDefaultImport(`${b}/get-iterator${l}`,"getIterator"),[r.node.object]));r.skip();return}}const s=f(e);if(!s)return;const a=maybeInjectPure(s.desc,s.name,t);if(a)r.replaceWith(a)},visitor:g==="usage-global"&&{YieldExpression(t){if(t.node.delegate){inject("web.dom.iterable",e.getUtils(t))}},"ForOfStatement|ArrayPattern"(t){a.CommonIterators.forEach((r=>inject(r,e.getUtils(t))))}}}}));t["default"]=f},1268:(e,t,r)=>{e.exports=r(516)},9270:(e,t,r)=>{e.exports=r(5246)},559:(e,t,r)=>{e.exports=r(4812)},4245:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getInclusionReasons=getInclusionReasons;var s=r(7849);var a=r(834);var n=r(4208);function getInclusionReasons(e,t,r){const o=r[e]||{};return Object.keys(t).reduce(((e,r)=>{const i=(0,n.getLowestImplementedVersion)(o,r);const l=t[r];if(!i){e[r]=(0,a.prettifyVersion)(l)}else{const t=(0,n.isUnreleasedVersion)(i,r);const o=(0,n.isUnreleasedVersion)(l,r);if(!o&&(t||s.lt(l.toString(),(0,n.semverify)(i)))){e[r]=(0,a.prettifyVersion)(l)}}return e}),{})}},425:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.targetsSupported=targetsSupported;t.isRequired=isRequired;t["default"]=filterItems;var s=r(7849);var a=r(559);var n=r(4208);function targetsSupported(e,t){const r=Object.keys(e);if(r.length===0){return false}const a=r.filter((r=>{const a=(0,n.getLowestImplementedVersion)(t,r);if(!a){return true}const o=e[r];if((0,n.isUnreleasedVersion)(o,r)){return false}if((0,n.isUnreleasedVersion)(a,r)){return true}if(!s.valid(o.toString())){throw new Error(`Invalid version passed for target "${r}": "${o}". `+"Versions must be in semver format (major.minor.patch)")}return s.gt((0,n.semverify)(a),o.toString())}));return a.length===0}function isRequired(e,t,{compatData:r=a,includes:s,excludes:n}={}){if(n!=null&&n.has(e))return false;if(s!=null&&s.has(e))return true;return!targetsSupported(t,r[e])}function filterItems(e,t,r,s,a,n,o){const i=new Set;const l={compatData:e,includes:t,excludes:r};for(const t in e){if(isRequired(t,s,l)){i.add(t)}else if(o){const e=o.get(t);if(e){i.add(e)}}}if(a){a.forEach((e=>!r.has(e)&&i.add(e)))}if(n){n.forEach((e=>!t.has(e)&&i.delete(e)))}return i}},8097:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isBrowsersQueryValid=isBrowsersQueryValid;t["default"]=getTargets;Object.defineProperty(t,"unreleasedLabels",{enumerable:true,get:function(){return i.unreleasedLabels}});Object.defineProperty(t,"TargetNames",{enumerable:true,get:function(){return l.TargetNames}});Object.defineProperty(t,"prettifyTargets",{enumerable:true,get:function(){return c.prettifyTargets}});Object.defineProperty(t,"getInclusionReasons",{enumerable:true,get:function(){return u.getInclusionReasons}});Object.defineProperty(t,"filterItems",{enumerable:true,get:function(){return p.default}});Object.defineProperty(t,"isRequired",{enumerable:true,get:function(){return p.isRequired}});var s=r(4907);var a=r(7347);var n=r(9270);var o=r(4208);var i=r(6124);var l=r(7891);var c=r(834);var u=r(4245);var p=r(425);const d=n["es6.module"];const f=new a.OptionValidator("@babel/helper-compilation-targets");function validateTargetNames(e){const t=Object.keys(l.TargetNames);for(const r of Object.keys(e)){if(!(r in l.TargetNames)){throw new Error(f.formatMessage(`'${r}' is not a valid target\n- Did you mean '${(0,a.findSuggestion)(r,t)}'?`))}}return e}function isBrowsersQueryValid(e){return typeof e==="string"||Array.isArray(e)&&e.every((e=>typeof e==="string"))}function validateBrowsers(e){f.invariant(e===undefined||isBrowsersQueryValid(e),`'${String(e)}' is not a valid browserslist query`);return e}function getLowestVersions(e){return e.reduce(((e,t)=>{const[r,s]=t.split(" ");const a=i.browserNameMap[r];if(!a){return e}try{const t=s.split("-")[0].toLowerCase();const n=(0,o.isUnreleasedVersion)(t,r);if(!e[a]){e[a]=n?t:(0,o.semverify)(t);return e}const i=e[a];const l=(0,o.isUnreleasedVersion)(i,r);if(l&&n){e[a]=(0,o.getLowestUnreleased)(i,t,r)}else if(l){e[a]=(0,o.semverify)(t)}else if(!l&&!n){const r=(0,o.semverify)(t);e[a]=(0,o.semverMin)(i,r)}}catch(e){}return e}),{})}function outputDecimalWarning(e){if(!e.length){return}console.warn("Warning, the following targets are using a decimal version:\n");e.forEach((({target:e,value:t})=>console.warn(` ${e}: ${t}`)));console.warn(`\nWe recommend using a string for minor/patch versions to avoid numbers like 6.10\ngetting parsed as 6.1, which can lead to unexpected behavior.\n`)}function semverifyTarget(e,t){try{return(0,o.semverify)(t)}catch(r){throw new Error(f.formatMessage(`'${t}' is not a valid value for 'targets.${e}'.`))}}const m={__default(e,t){const r=(0,o.isUnreleasedVersion)(t,e)?t.toLowerCase():semverifyTarget(e,t);return[e,r]},node(e,t){const r=t===true||t==="current"?process.versions.node:semverifyTarget(e,t);return[e,r]}};function generateTargets(e){const t=Object.assign({},e);delete t.esmodules;delete t.browsers;return t}function resolveTargets(e){const t=s(e,{mobileToDesktop:true});return getLowestVersions(t)}function getTargets(e={},t={}){var r;let{browsers:a,esmodules:n}=e;const{configPath:i="."}=t;validateBrowsers(a);const l=generateTargets(e);let c=validateTargetNames(l);const u=!!a;const p=u||Object.keys(c).length>0;const f=!t.ignoreBrowserslistConfig&&!p;if(!a&&f){a=s.loadConfig({config:t.configFile,path:i,env:t.browserslistEnv});if(a==null){{a=[]}}}if(n&&(n!=="intersect"||!((r=a)!=null&&r.length))){a=Object.keys(d).map((e=>`${e} >= ${d[e]}`)).join(", ");n=false}if(a){const e=resolveTargets(a);if(n==="intersect"){for(const t of Object.keys(e)){const r=e[t];if(d[t]){e[t]=(0,o.getHighestUnreleased)(r,(0,o.semverify)(d[t]),t)}else{delete e[t]}}}c=Object.assign(e,c)}const y={};const g=[];for(const e of Object.keys(c).sort()){var h;const t=c[e];if(typeof t==="number"&&t%1!==0){g.push({target:e,value:t})}const r=(h=m[e])!=null?h:m.__default;const[s,a]=r(e,t);if(a){y[s]=a}}outputDecimalWarning(g);return y}},7891:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.TargetNames=void 0;const r={node:"node",chrome:"chrome",opera:"opera",edge:"edge",firefox:"firefox",safari:"safari",ie:"ie",ios:"ios",android:"android",electron:"electron",samsung:"samsung"};t.TargetNames=r},834:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.prettifyVersion=prettifyVersion;t.prettifyTargets=prettifyTargets;var s=r(7849);var a=r(6124);function prettifyVersion(e){if(typeof e!=="string"){return e}const t=[s.major(e)];const r=s.minor(e);const a=s.patch(e);if(r||a){t.push(r)}if(a){t.push(a)}return t.join(".")}function prettifyTargets(e){return Object.keys(e).reduce(((t,r)=>{let s=e[r];const n=a.unreleasedLabels[r];if(typeof s==="string"&&n!==s){s=prettifyVersion(s)}t[r]=s;return t}),{})}},6124:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.browserNameMap=t.unreleasedLabels=void 0;const r={safari:"tp"};t.unreleasedLabels=r;const s={and_chr:"chrome",and_ff:"firefox",android:"android",chrome:"chrome",edge:"edge",firefox:"firefox",ie:"ie",ie_mob:"ie",ios_saf:"ios",node:"node",op_mob:"opera",opera:"opera",safari:"safari",samsung:"samsung"};t.browserNameMap=s},4208:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.semverMin=semverMin;t.semverify=semverify;t.isUnreleasedVersion=isUnreleasedVersion;t.getLowestUnreleased=getLowestUnreleased;t.getHighestUnreleased=getHighestUnreleased;t.getLowestImplementedVersion=getLowestImplementedVersion;var s=r(7849);var a=r(7347);var n=r(6124);const o=/^(\d+|\d+.\d+)$/;const i=new a.OptionValidator("@babel/helper-compilation-targets");function semverMin(e,t){return e&&s.lt(e,t)?e:t}function semverify(e){if(typeof e==="string"&&s.valid(e)){return e}i.invariant(typeof e==="number"||typeof e==="string"&&o.test(e),`'${e}' is not a valid version`);const t=e.toString().split(".");while(t.length<3){t.push("0")}return t.join(".")}function isUnreleasedVersion(e,t){const r=n.unreleasedLabels[t];return!!r&&r===e.toString().toLowerCase()}function getLowestUnreleased(e,t,r){const s=n.unreleasedLabels[r];const a=[e,t].some((e=>e===s));if(a){return e===a?t:e||t}return semverMin(e,t)}function getHighestUnreleased(e,t,r){return getLowestUnreleased(e,t,r)===e?t:e}function getLowestImplementedVersion(e,t){const r=e[t];if(!r&&t==="android"){return e.chrome}return r}},3318:(e,t,r)=>{"use strict";t.__esModule=true;t.stringifyTargetsMultiline=stringifyTargetsMultiline;t.stringifyTargets=stringifyTargets;t.presetEnvSilentDebugHeader=void 0;var s=r(8097);const a="#__secret_key__@babel/preset-env__don't_log_debug_header_and_resolved_targets";t.presetEnvSilentDebugHeader=a;function stringifyTargetsMultiline(e){return JSON.stringify((0,s.prettifyTargets)(e),null,2)}function stringifyTargets(e){return JSON.stringify(e).replace(/,/g,", ").replace(/^\{"/,'{ "').replace(/"\}$/,'" }')}},2551:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:a}=s.default||s;class ImportsCache{constructor(e){this._imports=new WeakMap;this._anonymousImports=new WeakMap;this._lastImports=new WeakMap;this._resolver=e}storeAnonymous(e,t,r){const s=this._normalizeKey(e,t);const n=this._ensure(this._anonymousImports,e,Set);if(n.has(s))return;const o=r(e.node.sourceType==="script",a.stringLiteral(this._resolver(t)));n.add(s);this._injectImport(e,o)}storeNamed(e,t,r,s){const n=this._normalizeKey(e,t,r);const o=this._ensure(this._imports,e,Map);if(!o.has(n)){const{node:i,name:l}=s(e.node.sourceType==="script",a.stringLiteral(this._resolver(t)),a.identifier(r));o.set(n,l);this._injectImport(e,i)}return a.identifier(o.get(n))}_injectImport(e,t){let r=this._lastImports.get(e);if(r&&r.node&&r.parent===e.node&&r.container===e.node.body){r=r.insertAfter(t)}else{r=e.unshiftContainer("body",t)}r=r[r.length-1];this._lastImports.set(e,r)}_ensure(e,t,r){let s=e.get(t);if(!s){s=new r;e.set(t,s)}return s}_normalizeKey(e,t,r=""){const{sourceType:s}=e.node;return`${r&&s}::${t}::${r}`}}t["default"]=ImportsCache},6389:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=definePolyfillProvider;var s=r(558);var a=_interopRequireWildcard(r(8097));var n=r(3508);var o=_interopRequireDefault(r(2551));var i=r(3318);var l=r(8083);var c=_interopRequireWildcard(r(7107));var u=_interopRequireWildcard(r(3229));var p=_interopRequireDefault(r(4219));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var r={};var s=Object.keys(e);var a,n;for(n=0;n=0)continue;r[a]=e[a]}return r}const d=a.default.default||a.default;function resolveOptions(e,t){const{method:r,targets:s,ignoreBrowserslistConfig:a,configPath:n,debug:o,shouldInjectPolyfill:i,absoluteImports:l}=e,c=_objectWithoutPropertiesLoose(e,["method","targets","ignoreBrowserslistConfig","configPath","debug","shouldInjectPolyfill","absoluteImports"]);let u;if(r==="usage-global")u="usageGlobal";else if(r==="entry-global")u="entryGlobal";else if(r==="usage-pure")u="usagePure";else if(typeof r!=="string"){throw new Error(".method must be a string")}else{throw new Error(`.method must be one of "entry-global", "usage-global"`+` or "usage-pure" (received ${JSON.stringify(r)})`)}if(typeof i==="function"){if(e.include||e.exclude){throw new Error(`.include and .exclude are not supported when using the`+` .shouldInjectPolyfill function.`)}}else if(i!=null){throw new Error(`.shouldInjectPolyfill must be a function, or undefined`+` (received ${JSON.stringify(i)})`)}if(l!=null&&typeof l!=="boolean"&&typeof l!=="string"){throw new Error(`.absoluteImports must be a boolean, a string, or undefined`+` (received ${JSON.stringify(l)})`)}let p;if(s||n||a){const e=typeof s==="string"||Array.isArray(s)?{browsers:s}:s;p=d(e,{ignoreBrowserslistConfig:a,configPath:n})}else{p=t.targets()}return{method:r,methodName:u,targets:p,absoluteImports:l!=null?l:false,shouldInjectPolyfill:i,debug:!!o,providerOptions:c}}function instantiateProvider(e,t,r,s,i,c){const{method:d,methodName:f,targets:m,debug:y,shouldInjectPolyfill:g,providerOptions:h,absoluteImports:b}=resolveOptions(t,c);const x=(0,n.createUtilsGetter)(new o.default((e=>u.resolve(s,e,b))));let v,E;let j;let w;let _;const S=new Map;const O={babel:c,getUtils:x,method:t.method,targets:m,createMetaResolver:p.default,shouldInjectPolyfill(t){if(w===undefined){throw new Error(`Internal error in the ${e.name} provider: `+`shouldInjectPolyfill() can't be called during initialization.`)}if(!w.has(t)){console.warn(`Internal error in the ${k.name} provider: `+`unknown polyfill "${t}".`)}if(_&&!_(t))return false;let r=(0,a.isRequired)(t,m,{compatData:j,includes:v,excludes:E});if(g){r=g(t,r);if(typeof r!=="boolean"){throw new Error(`.shouldInjectPolyfill must return a boolean.`)}}return r},debug(e){i().found=true;if(!y||!e)return;if(i().polyfills.has(k.name))return;i().polyfills.set(e,j&&e&&j[e])},assertDependency(e,t="*"){if(r===false)return;if(b){return}const a=t==="*"?e:`${e}@^${t}`;const n=r.all?false:mapGetOr(S,`${e} :: ${s}`,(()=>u.has(s,e)));if(!n){i().missingDeps.add(a)}}};const k=e(O,h,s);if(typeof k[f]!=="function"){throw new Error(`The "${k.name||e.name}" provider doesn't `+`support the "${d}" polyfilling method.`)}if(Array.isArray(k.polyfills)){w=new Set(k.polyfills);_=k.filterPolyfills}else if(k.polyfills){w=new Set(Object.keys(k.polyfills));j=k.polyfills;_=k.filterPolyfills}else{w=new Set}({include:v,exclude:E}=(0,l.validateIncludeExclude)(k.name||e.name,w,h.include||[],h.exclude||[]));return{debug:y,method:d,targets:m,provider:k,callProvider(e,t){const r=x(t);k[f](e,r,t)}}}function definePolyfillProvider(e){return(0,s.declare)(((t,r,s)=>{t.assertVersion(7);const{traverse:n}=t;let o;const p=(0,l.applyMissingDependenciesDefaults)(r,t);const{debug:d,method:f,targets:m,provider:y,callProvider:g}=instantiateProvider(e,r,p,s,(()=>o),t);const h=f==="entry-global"?c.entry:c.usage;const b=y.visitor?n.visitors.merge([h(g),y.visitor]):h(g);if(d&&d!==i.presetEnvSilentDebugHeader){console.log(`${y.name}: \`DEBUG\` option`);console.log(`\nUsing targets: ${(0,i.stringifyTargetsMultiline)(m)}`);console.log(`\nUsing polyfills with \`${f}\` method:`)}return{name:"inject-polyfills",visitor:b,pre(){var e;o={polyfills:new Map,found:false,providers:new Set,missingDeps:new Set};(e=y.pre)==null?void 0:e.apply(this,arguments)},post(){var e;(e=y.post)==null?void 0:e.apply(this,arguments);if(p!==false){if(p.log==="per-file"){u.logMissing(o.missingDeps)}else{u.laterLogMissing(o.missingDeps)}}if(!d)return;if(this.filename)console.log(`\n[${this.filename}]`);if(o.polyfills.size===0){console.log(f==="entry-global"?o.found?`Based on your targets, the ${y.name} polyfill did not add any polyfill.`:`The entry point for the ${y.name} polyfill has not been found.`:`Based on your code and targets, the ${y.name} polyfill did not add any polyfill.`);return}if(f==="entry-global"){console.log(`The ${y.name} polyfill entry has been replaced with `+`the following polyfills:`)}else{console.log(`The ${y.name} polyfill added the following polyfills:`)}for(const[e,t]of o.polyfills){if(t){const r=(0,a.getInclusionReasons)(e,m,t);const s=JSON.stringify(r).replace(/,/g,", ").replace(/^\{"/,'{ "').replace(/"\}$/,'" }');console.log(` ${e} ${s}`)}else{console.log(` ${e}`)}}}}}))}function mapGetOr(e,t,r){let s=e.get(t);if(s===undefined){s=r();e.set(t,s)}return s}},4219:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=createMetaResolver;var s=r(3508);const a=new Set(["global","globalThis","self","window"]);function createMetaResolver(e){const{static:t,instance:r,global:n}=e;return e=>{if(e.kind==="global"&&n&&(0,s.has)(n,e.name)){return{kind:"global",desc:n[e.name],name:e.name}}if(e.kind==="property"||e.kind==="in"){const{placement:o,object:i,key:l}=e;if(i&&o==="static"){if(n&&a.has(i)&&(0,s.has)(n,l)){return{kind:"global",desc:n[l],name:l}}if(t&&(0,s.has)(t,i)&&(0,s.has)(t[i],l)){return{kind:"static",desc:t[i][l],name:`${i}$${l}`}}}if(r&&(0,s.has)(r,l)){return{kind:"instance",desc:r[l],name:`${l}`}}}}}},3229:(e,t,r)=>{"use strict";t.__esModule=true;t.resolve=resolve;t.has=has;t.logMissing=logMissing;t.laterLogMissing=laterLogMissing;var s=_interopRequireDefault(r(1017));var a=_interopRequireDefault(r(6240));var n=_interopRequireDefault(r(9485));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const o=parseFloat(process.versions.node)>=8.9;function resolve(e,t,r){if(r===false)return t;let a=e;if(typeof r==="string"){a=s.default.resolve(a,r)}let i,l;let c=t.indexOf("/");if(t[0]==="@"){c=t.indexOf("/",c+1)}if(c===-1){i=t;l=""}else{i=t.slice(0,c);l=t.slice(c)}try{let e;if(o){e=require.resolve(`${i}/package.json`,{paths:[a]})}else{e=n.default.sync(`${i}/package.json`,{basedir:a})}return s.default.dirname(e)+l}catch(r){if(r.code!=="MODULE_NOT_FOUND")throw r;throw Object.assign(new Error(`Failed to resolve "${t}" relative to "${e}"`),{code:"BABEL_POLYFILL_NOT_FOUND",polyfill:t,dirname:e})}}function has(e,t){try{if(o){require.resolve(t,{paths:[e]})}else{n.default.sync(t,{basedir:e})}return true}catch(e){return false}}function logMissing(e){if(e.size===0)return;const t=Array.from(e).sort().join(" ");console.warn("\nSome polyfills have been added but are not present in your dependencies.\n"+"Please run one of the following commands:\n"+`\tnpm install --save ${t}\n`+`\tyarn add ${t}\n`);process.exitCode=1}let i=new Set;const l=(0,a.default)((()=>{logMissing(i);i=new Set}),100);function laterLogMissing(e){if(e.size===0)return;e.forEach((e=>i.add(e)));l()}},8083:(e,t,r)=>{"use strict";t.__esModule=true;t.validateIncludeExclude=validateIncludeExclude;t.applyMissingDependenciesDefaults=applyMissingDependenciesDefaults;var s=r(3508);function patternToRegExp(e){if(e instanceof RegExp)return e;try{return new RegExp(`^${e}$`)}catch(e){return null}}function buildUnusedError(e,t){if(!t.length)return"";return` - The following "${e}" patterns didn't match any polyfill:\n`+t.map((e=>` ${String(e)}\n`)).join("")}function buldDuplicatesError(e){if(!e.size)return"";return` - The following polyfills were matched both by "include" and "exclude" patterns:\n`+Array.from(e,(e=>` ${e}\n`)).join("")}function validateIncludeExclude(e,t,r,a){let n;const filter=e=>{const r=patternToRegExp(e);if(!r)return false;let s=false;for(const e of t){if(r.test(e)){s=true;n.add(e)}}return!s};const o=n=new Set;const i=Array.from(r).filter(filter);const l=n=new Set;const c=Array.from(a).filter(filter);const u=(0,s.intersection)(o,l);if(u.size>0||i.length>0||c.length>0){throw new Error(`Error while validating the "${e}" provider options:\n`+buildUnusedError("include",i)+buildUnusedError("exclude",c)+buldDuplicatesError(u))}return{include:o,exclude:l}}function applyMissingDependenciesDefaults(e,t){const{missingDependencies:r={}}=e;if(r===false)return false;const s=t.caller((e=>e==null?void 0:e.name));const{log:a="deferred",inject:n=(s==="rollup-plugin-babel"?"throw":"import"),all:o=false}=r;return{log:a,inject:n,all:o}}},3508:(e,t,r)=>{"use strict";t.__esModule=true;t.intersection=intersection;t.has=has;t.resolveKey=resolveKey;t.resolveSource=resolveSource;t.getImportSource=getImportSource;t.getRequireSource=getRequireSource;t.createUtilsGetter=createUtilsGetter;var s=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:a,template:n}=s.default||s;function intersection(e,t){const r=new Set;e.forEach((e=>t.has(e)&&r.add(e)));return r}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function getType(e){return Object.prototype.toString.call(e).slice(8,-1)}function resolveId(e){if(e.isIdentifier()&&!e.scope.hasBinding(e.node.name,true)){return e.node.name}const{deopt:t}=e.evaluate();if(t&&t.isIdentifier()){return t.node.name}}function resolveKey(e,t=false){const{node:r,parent:s,scope:a}=e;if(e.isStringLiteral())return r.value;const{name:n}=r;const o=e.isIdentifier();if(o&&!(t||s.computed))return n;if(t&&e.isMemberExpression()&&e.get("object").isIdentifier({name:"Symbol"})&&!a.hasBinding("Symbol",true)){const t=resolveKey(e.get("property"),e.node.computed);if(t)return"Symbol."+t}if(!o||a.hasBinding(n,true)){const{value:t}=e.evaluate();if(typeof t==="string")return t}}function resolveSource(e){if(e.isMemberExpression()&&e.get("property").isIdentifier({name:"prototype"})){const t=resolveId(e.get("object"));if(t){return{id:t,placement:"prototype"}}return{id:null,placement:null}}const t=resolveId(e);if(t){return{id:t,placement:"static"}}const{value:r}=e.evaluate();if(r!==undefined){return{id:getType(r),placement:"prototype"}}else if(e.isRegExpLiteral()){return{id:"RegExp",placement:"prototype"}}else if(e.isFunction()){return{id:"Function",placement:"prototype"}}return{id:null,placement:null}}function getImportSource({node:e}){if(e.specifiers.length===0)return e.source.value}function getRequireSource({node:e}){if(!a.isExpressionStatement(e))return;const{expression:t}=e;const r=a.isCallExpression(t)&&a.isIdentifier(t.callee)&&t.callee.name==="require"&&t.arguments.length===1&&a.isStringLiteral(t.arguments[0]);if(r)return t.arguments[0].value}function hoist(e){e._blockHoist=3;return e}function createUtilsGetter(e){return t=>{const r=t.findParent((e=>e.isProgram()));return{injectGlobalImport(t){e.storeAnonymous(r,t,((e,t)=>e?n.statement.ast`require(${t})`:a.importDeclaration([],t)))},injectNamedImport(t,s,o=s){return e.storeNamed(r,t,s,((e,t,s)=>{const i=r.scope.generateUidIdentifier(o);return{node:e?hoist(n.statement.ast` var ${i} = require(${t}).${s} - `):a.importDeclaration([a.importSpecifier(i,s)],t),name:i.name}}))},injectDefaultImport(t,s=t){return e.storeNamed(r,t,"default",((e,t)=>{const o=r.scope.generateUidIdentifier(s);return{node:e?hoist(n.statement.ast`var ${o} = require(${t})`):a.importDeclaration([a.importDefaultSpecifier(o)],t),name:o.name}}))}}}}},1783:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=r(3508);var _default=e=>({ImportDeclaration(t){const r=(0,s.getImportSource)(t);if(!r)return;e({kind:"import",source:r},t)},Program(t){t.get("body").forEach((t=>{const r=(0,s.getRequireSource)(t);if(!r)return;e({kind:"import",source:r},t)}))}});t["default"]=_default},7107:(e,t,r)=>{"use strict";t.__esModule=true;t.entry=t.usage=void 0;var s=_interopRequireDefault(r(8985));t.usage=s.default;var a=_interopRequireDefault(r(1783));t.entry=a.default;function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}},8985:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=r(3508);var _default=e=>{function property(t,r,s,a){return e({kind:"property",object:t,key:r,placement:s},a)}return{ReferencedIdentifier(t){const{node:{name:r},scope:s}=t;if(s.getBindingIdentifier(r))return;e({kind:"global",name:r},t)},MemberExpression(e){const t=(0,s.resolveKey)(e.get("property"),e.node.computed);if(!t||t==="prototype")return;const r=e.get("object");const a=r.scope.getBinding(r.node.name);if(a&&a.path.isImportNamespaceSpecifier())return;const n=(0,s.resolveSource)(r);return property(n.id,t,n.placement,e)},ObjectPattern(e){const{parentPath:t,parent:r}=e;let a;if(t.isVariableDeclarator()){a=t.get("init")}else if(t.isAssignmentExpression()){a=t.get("right")}else if(t.isFunction()){const s=t.parentPath;if(s.isCallExpression()||s.isNewExpression()){if(s.node.callee===r){a=s.get("arguments")[e.key]}}}let n=null;let o=null;if(a)({id:n,placement:o}=(0,s.resolveSource)(a));for(const t of e.get("properties")){if(t.isObjectProperty()){const e=(0,s.resolveKey)(t.get("key"));if(e)property(n,e,o,t)}}},BinaryExpression(t){if(t.node.operator!=="in")return;const r=(0,s.resolveSource)(t.get("right"));const a=(0,s.resolveKey)(t.get("left"),true);if(!a)return;e({kind:"in",object:r.id,key:a,placement:r.placement},t)}}};t["default"]=_default},8828:(e,t,r)=>{e.exports=r(935)},3039:(e,t,r)=>{e.exports=r(4323)},1532:(e,t,r)=>{e.exports=r(8374)},9396:(e,t,r)=>{"use strict";t.__esModule=true;t.CommonInstanceDependencies=t.InstanceProperties=t.StaticProperties=t.BuiltIns=t.PromiseDependenciesWithIterators=t.PromiseDependencies=t.CommonIterators=void 0;var s=_interopRequireDefault(r(8828));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const a={};Object.keys(s.default).forEach(((e,t)=>{a[e]=t}));const define=(e,t,r=t[0],s)=>({name:r,pure:e,global:t.sort(((e,t)=>a[e]-a[t])),exclude:s});const typed=e=>define(null,[e,...c]);const n=["es.array.iterator","web.dom-collections.iterator"];const o=["es.string.iterator",...n];t.CommonIterators=o;const i=["es.object.to-string",...n];const l=["es.object.to-string",...o];const c=["es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.object.to-string","es.array.iterator","es.array-buffer.slice"];const u={from:define(null,["es.typed-array.from"]),of:define(null,["es.typed-array.of"])};const p=["es.promise","es.object.to-string"];t.PromiseDependencies=p;const f=[...p,...o];t.PromiseDependenciesWithIterators=f;const d=["es.symbol","es.symbol.description","es.object.to-string"];const m=["es.map","esnext.map.delete-all","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.includes","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.reduce","esnext.map.some","esnext.map.update",...l];const y=["es.set","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union",...l];const g=["es.weak-map","esnext.weak-map.delete-all",...l];const h=["es.weak-set","esnext.weak-set.add-all","esnext.weak-set.delete-all",...l];const b=["web.url",...l];const x={AggregateError:define("aggregate-error",["esnext.aggregate-error",...o]),ArrayBuffer:define(null,["es.array-buffer.constructor","es.array-buffer.slice","es.object.to-string"]),DataView:define(null,["es.data-view","es.array-buffer.slice","es.object.to-string"]),Date:define(null,["es.date.to-string"]),Float32Array:typed("es.typed-array.float32-array"),Float64Array:typed("es.typed-array.float64-array"),Int8Array:typed("es.typed-array.int8-array"),Int16Array:typed("es.typed-array.int16-array"),Int32Array:typed("es.typed-array.int32-array"),Uint8Array:typed("es.typed-array.uint8-array"),Uint8ClampedArray:typed("es.typed-array.uint8-clamped-array"),Uint16Array:typed("es.typed-array.uint16-array"),Uint32Array:typed("es.typed-array.uint32-array"),Map:define("map/index",m),Number:define(null,["es.number.constructor"]),Observable:define("observable/index",["esnext.observable","esnext.symbol.observable","es.object.to-string",...l]),Promise:define("promise/index",p),RegExp:define(null,["es.regexp.constructor","es.regexp.exec","es.regexp.to-string"]),Set:define("set/index",y),Symbol:define("symbol/index",d),URL:define("url/index",["web.url",...b]),URLSearchParams:define("url-search-params/index",b),WeakMap:define("weak-map/index",g),WeakSet:define("weak-set/index",h),clearImmediate:define("clear-immediate",["web.immediate"]),compositeKey:define("composite-key",["esnext.composite-key"]),compositeSymbol:define("composite-symbol",["esnext.composite-symbol"]),fetch:define(null,p),globalThis:define("global-this",["es.global-this"]),parseFloat:define("parse-float",["es.parse-float"]),parseInt:define("parse-int",["es.parse-int"]),queueMicrotask:define("queue-microtask",["web.queue-microtask"]),setImmediate:define("set-immediate",["web.immediate"]),setInterval:define("set-interval",["web.timers"]),setTimeout:define("set-timeout",["web.timers"])};t.BuiltIns=x;const v={Array:{from:define("array/from",["es.array.from","es.string.iterator"]),isArray:define("array/is-array",["es.array.is-array"]),of:define("array/of",["es.array.of"])},ArrayBuffer:{isView:define(null,["es.array-buffer.is-view"])},Date:{now:define("date/now",["es.date.now"])},JSON:{stringify:define("json/stringify",[],"es.symbol")},Math:{DEG_PER_RAD:define("math/deg-per-rad",["esnext.math.deg-per-rad"]),RAD_PER_DEG:define("math/rad-per-deg",["esnext.math.rad-per-deg"]),acosh:define("math/acosh",["es.math.acosh"]),asinh:define("math/asinh",["es.math.asinh"]),atanh:define("math/atanh",["es.math.atanh"]),cbrt:define("math/cbrt",["es.math.cbrt"]),clamp:define("math/clamp",["esnext.math.clamp"]),clz32:define("math/clz32",["es.math.clz32"]),cosh:define("math/cosh",["es.math.cosh"]),degrees:define("math/degrees",["esnext.math.degrees"]),expm1:define("math/expm1",["es.math.expm1"]),fround:define("math/fround",["es.math.fround"]),fscale:define("math/fscale",["esnext.math.fscale"]),hypot:define("math/hypot",["es.math.hypot"]),iaddh:define("math/iaddh",["esnext.math.iaddh"]),imul:define("math/imul",["es.math.imul"]),imulh:define("math/imulh",["esnext.math.imulh"]),isubh:define("math/isubh",["esnext.math.isubh"]),log10:define("math/log10",["es.math.log10"]),log1p:define("math/log1p",["es.math.log1p"]),log2:define("math/log2",["es.math.log2"]),radians:define("math/radians",["esnext.math.radians"]),scale:define("math/scale",["esnext.math.scale"]),seededPRNG:define("math/seeded-prng",["esnext.math.seeded-prng"]),sign:define("math/sign",["es.math.sign"]),signbit:define("math/signbit",["esnext.math.signbit"]),sinh:define("math/sinh",["es.math.sinh"]),tanh:define("math/tanh",["es.math.tanh"]),trunc:define("math/trunc",["es.math.trunc"]),umulh:define("math/umulh",["esnext.math.umulh"])},Map:{from:define(null,["esnext.map.from",...m]),groupBy:define(null,["esnext.map.group-by",...m]),keyBy:define(null,["esnext.map.key-by",...m]),of:define(null,["esnext.map.of",...m])},Number:{EPSILON:define("number/epsilon",["es.number.epsilon"]),MAX_SAFE_INTEGER:define("number/max-safe-integer",["es.number.max-safe-integer"]),MIN_SAFE_INTEGER:define("number/min-safe-integer",["es.number.min-safe-integer"]),fromString:define("number/from-string",["esnext.number.from-string"]),isFinite:define("number/is-finite",["es.number.is-finite"]),isInteger:define("number/is-integer",["es.number.is-integer"]),isNaN:define("number/is-nan",["es.number.is-nan"]),isSafeInteger:define("number/is-safe-integer",["es.number.is-safe-integer"]),parseFloat:define("number/parse-float",["es.number.parse-float"]),parseInt:define("number/parse-int",["es.number.parse-int"])},Object:{assign:define("object/assign",["es.object.assign"]),create:define("object/create",["es.object.create"]),defineProperties:define("object/define-properties",["es.object.define-properties"]),defineProperty:define("object/define-property",["es.object.define-property"]),entries:define("object/entries",["es.object.entries"]),freeze:define("object/freeze",["es.object.freeze"]),fromEntries:define("object/from-entries",["es.object.from-entries","es.array.iterator"]),getOwnPropertyDescriptor:define("object/get-own-property-descriptor",["es.object.get-own-property-descriptor"]),getOwnPropertyDescriptors:define("object/get-own-property-descriptors",["es.object.get-own-property-descriptors"]),getOwnPropertyNames:define("object/get-own-property-names",["es.object.get-own-property-names"]),getOwnPropertySymbols:define("object/get-own-property-symbols",["es.symbol"]),getPrototypeOf:define("object/get-prototype-of",["es.object.get-prototype-of"]),hasOwn:define("object/has-own",["esnext.object.has-own"]),is:define("object/is",["es.object.is"]),isExtensible:define("object/is-extensible",["es.object.is-extensible"]),isFrozen:define("object/is-frozen",["es.object.is-frozen"]),isSealed:define("object/is-sealed",["es.object.is-sealed"]),keys:define("object/keys",["es.object.keys"]),preventExtensions:define("object/prevent-extensions",["es.object.prevent-extensions"]),seal:define("object/seal",["es.object.seal"]),setPrototypeOf:define("object/set-prototype-of",["es.object.set-prototype-of"]),values:define("object/values",["es.object.values"])},Promise:{all:define(null,f),allSettled:define(null,["es.promise.all-settled",...f]),any:define(null,["esnext.promise.any",...f]),race:define(null,f),try:define(null,["esnext.promise.try",...f])},Reflect:{apply:define("reflect/apply",["es.reflect.apply"]),construct:define("reflect/construct",["es.reflect.construct"]),defineMetadata:define("reflect/define-metadata",["esnext.reflect.define-metadata"]),defineProperty:define("reflect/define-property",["es.reflect.define-property"]),deleteMetadata:define("reflect/delete-metadata",["esnext.reflect.delete-metadata"]),deleteProperty:define("reflect/delete-property",["es.reflect.delete-property"]),get:define("reflect/get",["es.reflect.get"]),getMetadata:define("reflect/get-metadata",["esnext.reflect.get-metadata"]),getMetadataKeys:define("reflect/get-metadata-keys",["esnext.reflect.get-metadata-keys"]),getOwnMetadata:define("reflect/get-own-metadata",["esnext.reflect.get-own-metadata"]),getOwnMetadataKeys:define("reflect/get-own-metadata-keys",["esnext.reflect.get-own-metadata-keys"]),getOwnPropertyDescriptor:define("reflect/get-own-property-descriptor",["es.reflect.get-own-property-descriptor"]),getPrototypeOf:define("reflect/get-prototype-of",["es.reflect.get-prototype-of"]),has:define("reflect/has",["es.reflect.has"]),hasMetadata:define("reflect/has-metadata",["esnext.reflect.has-metadata"]),hasOwnMetadata:define("reflect/has-own-metadata",["esnext.reflect.has-own-metadata"]),isExtensible:define("reflect/is-extensible",["es.reflect.is-extensible"]),metadata:define("reflect/metadata",["esnext.reflect.metadata"]),ownKeys:define("reflect/own-keys",["es.reflect.own-keys"]),preventExtensions:define("reflect/prevent-extensions",["es.reflect.prevent-extensions"]),set:define("reflect/set",["es.reflect.set"]),setPrototypeOf:define("reflect/set-prototype-of",["es.reflect.set-prototype-of"])},Set:{from:define(null,["esnext.set.from",...y]),of:define(null,["esnext.set.of",...y])},String:{fromCodePoint:define("string/from-code-point",["es.string.from-code-point"]),raw:define("string/raw",["es.string.raw"])},Symbol:{asyncIterator:define("symbol/async-iterator",["es.symbol.async-iterator"]),dispose:define("symbol/dispose",["esnext.symbol.dispose"]),for:define("symbol/for",[],"es.symbol"),hasInstance:define("symbol/has-instance",["es.symbol.has-instance","es.function.has-instance"]),isConcatSpreadable:define("symbol/is-concat-spreadable",["es.symbol.is-concat-spreadable","es.array.concat"]),iterator:define("symbol/iterator",["es.symbol.iterator",...l]),keyFor:define("symbol/key-for",[],"es.symbol"),match:define("symbol/match",["es.symbol.match","es.string.match"]),observable:define("symbol/observable",["esnext.symbol.observable"]),patternMatch:define("symbol/pattern-match",["esnext.symbol.pattern-match"]),replace:define("symbol/replace",["es.symbol.replace","es.string.replace"]),search:define("symbol/search",["es.symbol.search","es.string.search"]),species:define("symbol/species",["es.symbol.species","es.array.species"]),split:define("symbol/split",["es.symbol.split","es.string.split"]),toPrimitive:define("symbol/to-primitive",["es.symbol.to-primitive","es.date.to-primitive"]),toStringTag:define("symbol/to-string-tag",["es.symbol.to-string-tag","es.object.to-string","es.math.to-string-tag","es.json.to-string-tag"]),unscopables:define("symbol/unscopables",["es.symbol.unscopables"])},WeakMap:{from:define(null,["esnext.weak-map.from",...g]),of:define(null,["esnext.weak-map.of",...g])},WeakSet:{from:define(null,["esnext.weak-set.from",...h]),of:define(null,["esnext.weak-set.of",...h])},Int8Array:u,Uint8Array:u,Uint8ClampedArray:u,Int16Array:u,Uint16Array:u,Int32Array:u,Uint32Array:u,Float32Array:u,Float64Array:u};t.StaticProperties=v;const E={at:define("instance/at",["esnext.string.at"]),anchor:define(null,["es.string.anchor"]),big:define(null,["es.string.big"]),bind:define("instance/bind",["es.function.bind"]),blink:define(null,["es.string.blink"]),bold:define(null,["es.string.bold"]),codePointAt:define("instance/code-point-at",["es.string.code-point-at"]),codePoints:define("instance/code-points",["esnext.string.code-points"]),concat:define("instance/concat",["es.array.concat"],undefined,["String"]),copyWithin:define("instance/copy-within",["es.array.copy-within"]),description:define(null,["es.symbol","es.symbol.description"]),endsWith:define("instance/ends-with",["es.string.ends-with"]),entries:define("instance/entries",i),every:define("instance/every",["es.array.every"]),exec:define(null,["es.regexp.exec"]),fill:define("instance/fill",["es.array.fill"]),filter:define("instance/filter",["es.array.filter"]),finally:define(null,["es.promise.finally",...p]),find:define("instance/find",["es.array.find"]),findIndex:define("instance/find-index",["es.array.find-index"]),fixed:define(null,["es.string.fixed"]),flags:define("instance/flags",["es.regexp.flags"]),flatMap:define("instance/flat-map",["es.array.flat-map","es.array.unscopables.flat-map"]),flat:define("instance/flat",["es.array.flat"]),fontcolor:define(null,["es.string.fontcolor"]),fontsize:define(null,["es.string.fontsize"]),forEach:define("instance/for-each",["es.array.for-each","web.dom-collections.for-each"]),includes:define("instance/includes",["es.array.includes","es.string.includes"]),indexOf:define("instance/index-of",["es.array.index-of"]),italic:define(null,["es.string.italics"]),join:define(null,["es.array.join"]),keys:define("instance/keys",i),lastIndex:define(null,["esnext.array.last-index"]),lastIndexOf:define("instance/last-index-of",["es.array.last-index-of"]),lastItem:define(null,["esnext.array.last-item"]),link:define(null,["es.string.link"]),map:define("instance/map",["es.array.map"]),match:define(null,["es.string.match","es.regexp.exec"]),matchAll:define("instance/match-all",["es.string.match-all"]),name:define(null,["es.function.name"]),padEnd:define("instance/pad-end",["es.string.pad-end"]),padStart:define("instance/pad-start",["es.string.pad-start"]),reduce:define("instance/reduce",["es.array.reduce"]),reduceRight:define("instance/reduce-right",["es.array.reduce-right"]),repeat:define("instance/repeat",["es.string.repeat"]),replace:define(null,["es.string.replace","es.regexp.exec"]),replaceAll:define("instance/replace-all",["esnext.string.replace-all"]),reverse:define("instance/reverse",["es.array.reverse"]),search:define(null,["es.string.search","es.regexp.exec"]),slice:define("instance/slice",["es.array.slice"]),small:define(null,["es.string.small"]),some:define("instance/some",["es.array.some"]),sort:define("instance/sort",["es.array.sort"]),splice:define("instance/splice",["es.array.splice"]),split:define(null,["es.string.split","es.regexp.exec"]),startsWith:define("instance/starts-with",["es.string.starts-with"]),strike:define(null,["es.string.strike"]),sub:define(null,["es.string.sub"]),sup:define(null,["es.string.sup"]),toFixed:define(null,["es.number.to-fixed"]),toISOString:define(null,["es.date.to-iso-string"]),toJSON:define(null,["es.date.to-json","web.url.to-json"]),toPrecision:define(null,["es.number.to-precision"]),toString:define(null,["es.object.to-string","es.regexp.to-string","es.date.to-string"]),trim:define("instance/trim",["es.string.trim"]),trimEnd:define("instance/trim-end",["es.string.trim-end"]),trimLeft:define("instance/trim-left",["es.string.trim-start"]),trimRight:define("instance/trim-right",["es.string.trim-end"]),trimStart:define("instance/trim-start",["es.string.trim-start"]),values:define("instance/values",i),__defineGetter__:define(null,["es.object.define-getter"]),__defineSetter__:define(null,["es.object.define-setter"]),__lookupGetter__:define(null,["es.object.lookup-getter"]),__lookupSetter__:define(null,["es.object.lookup-setter"])};t.InstanceProperties=E;const j=new Set(["es.object.to-string","es.object.define-getter","es.object.define-setter","es.object.lookup-getter","es.object.lookup-setter","es.regexp.exec"]);t.CommonInstanceDependencies=j},5825:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireDefault(r(8828));var a=_interopRequireDefault(r(6265));var n=_interopRequireDefault(r(1532));var o=r(9396);var i=_interopRequireWildcard(r(8304));var l=r(8520);var c=_interopRequireDefault(r(8038));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _extends(){_extends=Object.assign||function(e){for(var t=1;t{if(t(e))return true;if(!e.startsWith("es."))return false;const r=`esnext.${e.slice(3)}`;if(!s.default[r])return false;return t(r)};var f=(0,c.default)((function({getUtils:e,method:t,shouldInjectPolyfill:r,createMetaResolver:i,debug:c,babel:f},{version:d=3,proposals:m,shippedProposals:y,[p]:{useBabelRuntime:g,ext:h=".js"}={}}){const b=f.caller((e=>(e==null?void 0:e.name)==="babel-loader"));const x=i({global:o.BuiltIns,static:o.StaticProperties,instance:o.InstanceProperties});const v=new Set((0,n.default)(d));const E=g?m?`${g}/core-js`:`${g}/core-js-stable`:m?"core-js-pure/features":"core-js-pure/stable";function maybeInjectGlobalImpl(e,t){if(r(e)){c(e);t.injectGlobalImport((0,l.coreJSModule)(e));return true}return false}function maybeInjectGlobal(e,t,r=true){for(const s of e){if(r){esnextFallback(s,(e=>maybeInjectGlobalImpl(e,t)))}else{maybeInjectGlobalImpl(s,t)}}}function maybeInjectPure(e,t,s,a){if(e.pure&&!(a&&e.exclude&&e.exclude.includes(a))&&esnextFallback(e.name,r)){return s.injectDefaultImport(`${E}/${e.pure}${h}`,t)}}return{name:"corejs3",polyfills:s.default,filterPolyfills(e){if(!v.has(e))return false;if(m||t==="entry-global")return true;if(y&&a.default.has(e)){return true}return!e.startsWith("esnext.")},entryGlobal(e,t,s){if(e.kind!=="import")return;const a=(0,l.isCoreJSSource)(e.source);if(!a)return;if(a.length===1&&e.source===(0,l.coreJSModule)(a[0])&&r(a[0])){c(null);return}maybeInjectGlobal(a,t,false);s.remove()},usageGlobal(e,t){const r=x(e);if(!r)return;let s=r.desc.global;if(r.kind!=="global"&&e.object&&e.placement==="prototype"){const t=e.object.toLowerCase();s=s.filter((e=>e.includes(t)||o.CommonInstanceDependencies.has(e)))}maybeInjectGlobal(s,t)},usagePure(e,t,s){if(e.kind==="in"){if(e.key==="Symbol.iterator"){s.replaceWith(u.callExpression(t.injectDefaultImport((0,l.coreJSPureHelper)("is-iterable",g,h),"isIterable"),[s.node.right]))}return}if(s.parentPath.isUnaryExpression({operator:"delete"}))return;let a;if(e.kind==="property"){if(!s.isMemberExpression())return;if(!s.isReferenced())return;a=s.parentPath.isCallExpression({callee:s.node});if(e.key==="Symbol.iterator"){if(!r("es.symbol.iterator"))return;if(a){if(s.parent.arguments.length===0){s.parentPath.replaceWith(u.callExpression(t.injectDefaultImport((0,l.coreJSPureHelper)("get-iterator",g,h),"getIterator"),[s.node.object]));s.skip()}else{(0,l.callMethod)(s,t.injectDefaultImport((0,l.coreJSPureHelper)("get-iterator-method",g,h),"getIteratorMethod"))}}else{s.replaceWith(u.callExpression(t.injectDefaultImport((0,l.coreJSPureHelper)("get-iterator-method",g,h),"getIteratorMethod"),[s.node.object]))}return}}let n=x(e);if(!n)return;if(g&&n.desc.pure&&n.desc.pure.slice(-6)==="/index"){n=_extends({},n,{desc:_extends({},n.desc,{pure:n.desc.pure.slice(0,-6)})})}if(n.kind==="global"){const e=maybeInjectPure(n.desc,n.name,t);if(e)s.replaceWith(e)}else if(n.kind==="static"){const r=maybeInjectPure(n.desc,n.name,t,e.object);if(r)s.replaceWith(r)}else if(n.kind==="instance"){const r=maybeInjectPure(n.desc,`${n.name}InstanceProperty`,t,e.object);if(!r)return;if(a){(0,l.callMethod)(s,r)}else{s.replaceWith(u.callExpression(r,[s.node.object]))}}},visitor:t==="usage-global"&&{CallExpression(t){if(t.get("callee").isImport()){const r=e(t);if(b){maybeInjectGlobal(o.PromiseDependenciesWithIterators,r)}else{maybeInjectGlobal(o.PromiseDependencies,r)}}},Function(t){if(t.node.async){maybeInjectGlobal(o.PromiseDependencies,e(t))}},"ForOfStatement|ArrayPattern"(t){maybeInjectGlobal(o.CommonIterators,e(t))},SpreadElement(t){if(!t.parentPath.isObjectExpression()){maybeInjectGlobal(o.CommonIterators,e(t))}},YieldExpression(t){if(t.node.delegate){maybeInjectGlobal(o.CommonIterators,e(t))}}}}}));t["default"]=f},6265:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;var r=new Set(["esnext.global-this","esnext.string.match-all"]);t["default"]=r},8520:(e,t,r)=>{"use strict";t.__esModule=true;t.callMethod=callMethod;t.isCoreJSSource=isCoreJSSource;t.coreJSModule=coreJSModule;t.coreJSPureHelper=coreJSPureHelper;var s=_interopRequireWildcard(r(8304));var a=_interopRequireDefault(r(3039));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:n}=s.default||s;function callMethod(e,t){const{object:r}=e.node;let s,a;if(n.isIdentifier(r)){s=r;a=n.cloneNode(r)}else{s=e.scope.generateDeclaredUidIdentifier("context");a=n.assignmentExpression("=",n.cloneNode(s),r)}e.replaceWith(n.memberExpression(n.callExpression(t,[a]),n.identifier("call")));e.parentPath.unshiftContainer("arguments",s)}function isCoreJSSource(e){if(typeof e==="string"){e=e.replace(/\\/g,"/").replace(/(\/(index)?)?(\.js)?$/i,"").toLowerCase()}return hasOwnProperty.call(a.default,e)&&a.default[e]}function coreJSModule(e){return`core-js/modules/${e}.js`}function coreJSPureHelper(e,t,r){return t?`${t}/core-js/${e}${r}`:`core-js-pure/features/${e}.js`}},8374:(e,t,r)=>{"use strict";const{compare:s,intersection:a,semver:n}=r(2732);const o=r(4970);const i=r(2885);e.exports=function(e){const t=n(e);if(t.major!==3){throw RangeError("This version of `core-js-compat` works only with `core-js@3`.")}const r=[];for(const e of Object.keys(o)){if(s(e,"<=",t)){r.push(...o[e])}}return a(r,i)}},2732:(e,t,r)=>{"use strict";const s=r(3464);const a=r(6784);const n=Function.call.bind({}.hasOwnProperty);function compare(e,t,r){return s(a(e),t,a(r))}function intersection(e,t){const r=e instanceof Set?e:new Set(e);return t.filter((e=>r.has(e)))}function sortObjectByKey(e,t){return Object.keys(e).sort(t).reduce(((t,r)=>{t[r]=e[r];return t}),{})}e.exports={compare:compare,has:n,intersection:intersection,semver:a,sortObjectByKey:sortObjectByKey}},5620:(e,t,r)=>{const s=r(6766);const{MAX_LENGTH:a,MAX_SAFE_INTEGER:n}=r(6648);const{re:o,t:i}=r(3567);const{compareIdentifiers:l}=r(6736);class SemVer{constructor(e,t){if(!t||typeof t!=="object"){t={loose:!!t,includePrerelease:false}}if(e instanceof SemVer){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease){return e}else{e=e.version}}else if(typeof e!=="string"){throw new TypeError(`Invalid Version: ${e}`)}if(e.length>a){throw new TypeError(`version is longer than ${a} characters`)}s("SemVer",e,t);this.options=t;this.loose=!!t.loose;this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?o[i.LOOSE]:o[i.FULL]);if(!r){throw new TypeError(`Invalid Version: ${e}`)}this.raw=e;this.major=+r[1];this.minor=+r[2];this.patch=+r[3];if(this.major>n||this.major<0){throw new TypeError("Invalid major version")}if(this.minor>n||this.minor<0){throw new TypeError("Invalid minor version")}if(this.patch>n||this.patch<0){throw new TypeError("Invalid patch version")}if(!r[4]){this.prerelease=[]}else{this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0){if(typeof this.prerelease[e]==="number"){this.prerelease[e]++;e=-2}}if(e===-1){this.prerelease.push(0)}}if(t){if(this.prerelease[0]===t){if(isNaN(this.prerelease[1])){this.prerelease=[t,0]}}else{this.prerelease=[t,0]}}break;default:throw new Error(`invalid increment argument: ${e}`)}this.format();this.raw=this.version;return this}}e.exports=SemVer},3464:(e,t,r)=>{const s=r(1673);const a=r(532);const n=r(3547);const o=r(5478);const i=r(5401);const l=r(2568);const cmp=(e,t,r,c)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return s(e,r,c);case"!=":return a(e,r,c);case">":return n(e,r,c);case">=":return o(e,r,c);case"<":return i(e,r,c);case"<=":return l(e,r,c);default:throw new TypeError(`Invalid operator: ${t}`)}};e.exports=cmp},6784:(e,t,r)=>{const s=r(5620);const a=r(5032);const{re:n,t:o}=r(3567);const coerce=(e,t)=>{if(e instanceof s){return e}if(typeof e==="number"){e=String(e)}if(typeof e!=="string"){return null}t=t||{};let r=null;if(!t.rtl){r=e.match(n[o.COERCE])}else{let t;while((t=n[o.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||t.index+t[0].length!==r.index+r[0].length){r=t}n[o.COERCERTL].lastIndex=t.index+t[1].length+t[2].length}n[o.COERCERTL].lastIndex=-1}if(r===null)return null;return a(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};e.exports=coerce},8796:(e,t,r)=>{const s=r(5620);const compare=(e,t,r)=>new s(e,r).compare(new s(t,r));e.exports=compare},1673:(e,t,r)=>{const s=r(8796);const eq=(e,t,r)=>s(e,t,r)===0;e.exports=eq},3547:(e,t,r)=>{const s=r(8796);const gt=(e,t,r)=>s(e,t,r)>0;e.exports=gt},5478:(e,t,r)=>{const s=r(8796);const gte=(e,t,r)=>s(e,t,r)>=0;e.exports=gte},5401:(e,t,r)=>{const s=r(8796);const lt=(e,t,r)=>s(e,t,r)<0;e.exports=lt},2568:(e,t,r)=>{const s=r(8796);const lte=(e,t,r)=>s(e,t,r)<=0;e.exports=lte},532:(e,t,r)=>{const s=r(8796);const neq=(e,t,r)=>s(e,t,r)!==0;e.exports=neq},5032:(e,t,r)=>{const{MAX_LENGTH:s}=r(6648);const{re:a,t:n}=r(3567);const o=r(5620);const parse=(e,t)=>{if(!t||typeof t!=="object"){t={loose:!!t,includePrerelease:false}}if(e instanceof o){return e}if(typeof e!=="string"){return null}if(e.length>s){return null}const r=t.loose?a[n.LOOSE]:a[n.FULL];if(!r.test(e)){return null}try{return new o(e,t)}catch(e){return null}};e.exports=parse},6648:e=>{const t="2.0.0";const r=256;const s=Number.MAX_SAFE_INTEGER||9007199254740991;const a=16;e.exports={SEMVER_SPEC_VERSION:t,MAX_LENGTH:r,MAX_SAFE_INTEGER:s,MAX_SAFE_COMPONENT_LENGTH:a}},6766:e=>{const t=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},6736:e=>{const t=/^[0-9]+$/;const compareIdentifiers=(e,r)=>{const s=t.test(e);const a=t.test(r);if(s&&a){e=+e;r=+r}return e===r?0:s&&!a?-1:a&&!s?1:ecompareIdentifiers(t,e);e.exports={compareIdentifiers:compareIdentifiers,rcompareIdentifiers:rcompareIdentifiers}},3567:(e,t,r)=>{const{MAX_SAFE_COMPONENT_LENGTH:s}=r(6648);const a=r(6766);t=e.exports={};const n=t.re=[];const o=t.src=[];const i=t.t={};let l=0;const createToken=(e,t,r)=>{const s=l++;a(s,t);i[e]=s;o[s]=t;n[s]=new RegExp(t,r?"g":undefined)};createToken("NUMERICIDENTIFIER","0|[1-9]\\d*");createToken("NUMERICIDENTIFIERLOOSE","[0-9]+");createToken("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*");createToken("MAINVERSION",`(${o[i.NUMERICIDENTIFIER]})\\.`+`(${o[i.NUMERICIDENTIFIER]})\\.`+`(${o[i.NUMERICIDENTIFIER]})`);createToken("MAINVERSIONLOOSE",`(${o[i.NUMERICIDENTIFIERLOOSE]})\\.`+`(${o[i.NUMERICIDENTIFIERLOOSE]})\\.`+`(${o[i.NUMERICIDENTIFIERLOOSE]})`);createToken("PRERELEASEIDENTIFIER",`(?:${o[i.NUMERICIDENTIFIER]}|${o[i.NONNUMERICIDENTIFIER]})`);createToken("PRERELEASEIDENTIFIERLOOSE",`(?:${o[i.NUMERICIDENTIFIERLOOSE]}|${o[i.NONNUMERICIDENTIFIER]})`);createToken("PRERELEASE",`(?:-(${o[i.PRERELEASEIDENTIFIER]}(?:\\.${o[i.PRERELEASEIDENTIFIER]})*))`);createToken("PRERELEASELOOSE",`(?:-?(${o[i.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[i.PRERELEASEIDENTIFIERLOOSE]})*))`);createToken("BUILDIDENTIFIER","[0-9A-Za-z-]+");createToken("BUILD",`(?:\\+(${o[i.BUILDIDENTIFIER]}(?:\\.${o[i.BUILDIDENTIFIER]})*))`);createToken("FULLPLAIN",`v?${o[i.MAINVERSION]}${o[i.PRERELEASE]}?${o[i.BUILD]}?`);createToken("FULL",`^${o[i.FULLPLAIN]}$`);createToken("LOOSEPLAIN",`[v=\\s]*${o[i.MAINVERSIONLOOSE]}${o[i.PRERELEASELOOSE]}?${o[i.BUILD]}?`);createToken("LOOSE",`^${o[i.LOOSEPLAIN]}$`);createToken("GTLT","((?:<|>)?=?)");createToken("XRANGEIDENTIFIERLOOSE",`${o[i.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);createToken("XRANGEIDENTIFIER",`${o[i.NUMERICIDENTIFIER]}|x|X|\\*`);createToken("XRANGEPLAIN",`[v=\\s]*(${o[i.XRANGEIDENTIFIER]})`+`(?:\\.(${o[i.XRANGEIDENTIFIER]})`+`(?:\\.(${o[i.XRANGEIDENTIFIER]})`+`(?:${o[i.PRERELEASE]})?${o[i.BUILD]}?`+`)?)?`);createToken("XRANGEPLAINLOOSE",`[v=\\s]*(${o[i.XRANGEIDENTIFIERLOOSE]})`+`(?:\\.(${o[i.XRANGEIDENTIFIERLOOSE]})`+`(?:\\.(${o[i.XRANGEIDENTIFIERLOOSE]})`+`(?:${o[i.PRERELEASELOOSE]})?${o[i.BUILD]}?`+`)?)?`);createToken("XRANGE",`^${o[i.GTLT]}\\s*${o[i.XRANGEPLAIN]}$`);createToken("XRANGELOOSE",`^${o[i.GTLT]}\\s*${o[i.XRANGEPLAINLOOSE]}$`);createToken("COERCE",`${"(^|[^\\d])"+"(\\d{1,"}${s}})`+`(?:\\.(\\d{1,${s}}))?`+`(?:\\.(\\d{1,${s}}))?`+`(?:$|[^\\d])`);createToken("COERCERTL",o[i.COERCE],true);createToken("LONETILDE","(?:~>?)");createToken("TILDETRIM",`(\\s*)${o[i.LONETILDE]}\\s+`,true);t.tildeTrimReplace="$1~";createToken("TILDE",`^${o[i.LONETILDE]}${o[i.XRANGEPLAIN]}$`);createToken("TILDELOOSE",`^${o[i.LONETILDE]}${o[i.XRANGEPLAINLOOSE]}$`);createToken("LONECARET","(?:\\^)");createToken("CARETTRIM",`(\\s*)${o[i.LONECARET]}\\s+`,true);t.caretTrimReplace="$1^";createToken("CARET",`^${o[i.LONECARET]}${o[i.XRANGEPLAIN]}$`);createToken("CARETLOOSE",`^${o[i.LONECARET]}${o[i.XRANGEPLAINLOOSE]}$`);createToken("COMPARATORLOOSE",`^${o[i.GTLT]}\\s*(${o[i.LOOSEPLAIN]})$|^$`);createToken("COMPARATOR",`^${o[i.GTLT]}\\s*(${o[i.FULLPLAIN]})$|^$`);createToken("COMPARATORTRIM",`(\\s*)${o[i.GTLT]}\\s*(${o[i.LOOSEPLAIN]}|${o[i.XRANGEPLAIN]})`,true);t.comparatorTrimReplace="$1$2$3";createToken("HYPHENRANGE",`^\\s*(${o[i.XRANGEPLAIN]})`+`\\s+-\\s+`+`(${o[i.XRANGEPLAIN]})`+`\\s*$`);createToken("HYPHENRANGELOOSE",`^\\s*(${o[i.XRANGEPLAINLOOSE]})`+`\\s+-\\s+`+`(${o[i.XRANGEPLAINLOOSE]})`+`\\s*$`);createToken("STAR","(<|>)?=?\\s*\\*")},7973:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireDefault(r(8038));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const a="#__secret_key__@babel/runtime__compatibility";var n=(0,s.default)((({debug:e},t)=>{const{[a]:{useBabelRuntime:r}={}}=t;const s=r?`${r}/regenerator`:"regenerator-runtime";return{name:"regenerator",polyfills:["regenerator-runtime"],usageGlobal(t,r){if(isRegenerator(t)){e("regenerator-runtime");r.injectGlobalImport("regenerator-runtime/runtime.js")}},usagePure(e,t,r){if(isRegenerator(e)){r.replaceWith(t.injectDefaultImport(s,"regenerator-runtime"))}}}}));t["default"]=n;const isRegenerator=e=>e.kind==="global"&&e.name==="regeneratorRuntime"},9485:(e,t,r)=>{var s=r(3818);s.core=r(3011);s.isCore=r(7320);s.sync=r(7252);e.exports=s},3818:(e,t,r)=>{var s=r(7147);var a=r(1017);var n=r(4029);var o=r(1177);var i=r(607);var l=r(8746);var c=s.realpath&&typeof s.realpath.native==="function"?s.realpath.native:s.realpath;var u=function isFile(e,t){s.stat(e,(function(e,r){if(!e){return t(null,r.isFile()||r.isFIFO())}if(e.code==="ENOENT"||e.code==="ENOTDIR")return t(null,false);return t(e)}))};var p=function isDirectory(e,t){s.stat(e,(function(e,r){if(!e){return t(null,r.isDirectory())}if(e.code==="ENOENT"||e.code==="ENOTDIR")return t(null,false);return t(e)}))};var f=function realpath(e,t){c(e,(function(r,s){if(r&&r.code!=="ENOENT")t(r);else t(null,r?e:s)}))};var d=function maybeRealpath(e,t,r,s){if(r&&r.preserveSymlinks===false){e(t,s)}else{s(null,t)}};var m=function defaultReadPackage(e,t,r){e(t,(function(e,t){if(e)r(e);else{try{var s=JSON.parse(t);r(null,s)}catch(e){r(null)}}}))};var y=function getPackageCandidates(e,t,r){var s=o(t,r,e);for(var n=0;n{e.exports=function(){var e=Error.prepareStackTrace;Error.prepareStackTrace=function(e,t){return t};var t=(new Error).stack;Error.prepareStackTrace=e;return t[2].getFileName()}},3011:(e,t,r)=>{var s=process.versions&&process.versions.node&&process.versions.node.split(".")||[];function specifierIncluded(e){var t=e.split(" ");var r=t.length>1?t[0]:"=";var a=(t.length>1?t[1]:t[0]).split(".");for(var n=0;n<3;++n){var o=parseInt(s[n]||0,10);var i=parseInt(a[n]||0,10);if(o===i){continue}if(r==="<"){return o="){return o>=i}else{return false}}return r===">="}function matchesRange(e){var t=e.split(/ ?&& ?/);if(t.length===0){return false}for(var r=0;r{var s=r(8746);e.exports=function isCore(e){return s(e)}},1177:(e,t,r)=>{var s=r(1017);var a=s.parse||r(2742);var n=function getNodeModulesDirs(e,t){var r="/";if(/^([A-Za-z]:)/.test(e)){r=""}else if(/^\\\\/.test(e)){r="\\\\"}var n=[e];var o=a(e);while(o.dir!==n[n.length-1]){n.push(o.dir);o=a(o.dir)}return n.reduce((function(e,a){return e.concat(t.map((function(e){return s.resolve(r,a,e)})))}),[])};e.exports=function nodeModulesPaths(e,t,r){var s=t&&t.moduleDirectory?[].concat(t.moduleDirectory):["node_modules"];if(t&&typeof t.paths==="function"){return t.paths(r,e,(function(){return n(e,s)}),t)}var a=n(e,s);return t&&t.paths?a.concat(t.paths):a}},607:e=>{e.exports=function(e,t){return t||{}}},7252:(e,t,r)=>{var s=r(8746);var a=r(7147);var n=r(1017);var o=r(4029);var i=r(1177);var l=r(607);var c=a.realpathSync&&typeof a.realpathSync.native==="function"?a.realpathSync.native:a.realpathSync;var u=function isFile(e){try{var t=a.statSync(e)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return false;throw e}return t.isFile()||t.isFIFO()};var p=function isDirectory(e){try{var t=a.statSync(e)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return false;throw e}return t.isDirectory()};var f=function realpathSync(e){try{return c(e)}catch(e){if(e.code!=="ENOENT"){throw e}}return e};var d=function maybeRealpathSync(e,t,r){if(r&&r.preserveSymlinks===false){return e(t)}return t};var m=function defaultReadPackageSync(e,t){var r=e(t);try{var s=JSON.parse(r);return s}catch(e){}};var y=function getPackageCandidates(e,t,r){var s=i(t,r,e);for(var a=0;a{"use strict";e.exports=require("assert")},7147:e=>{"use strict";e.exports=require("fs")},8188:e=>{"use strict";e.exports=require("module")},8304:e=>{"use strict";e.exports=require("next/dist/compiled/babel/core")},6949:e=>{"use strict";e.exports=require("next/dist/compiled/babel/parser")},7369:e=>{"use strict";e.exports=require("next/dist/compiled/babel/traverse")},8622:e=>{"use strict";e.exports=require("next/dist/compiled/babel/types")},4907:e=>{"use strict";e.exports=require("next/dist/compiled/browserslist")},8542:e=>{"use strict";e.exports=require("next/dist/compiled/chalk")},7849:e=>{"use strict";e.exports=require("next/dist/compiled/semver")},1017:e=>{"use strict";e.exports=require("path")},3837:e=>{"use strict";e.exports=require("util")},1267:e=>{"use strict";e.exports=require("worker_threads")},614:(e,t,r)=>{function _classPrivateFieldGet(e,t){var r=_classExtractFieldDescriptor(e,t,"get");return _classApplyDescriptorGet(e,r)}function _classApplyDescriptorGet(e,t){if(t.get){return t.get.call(e)}return t.value}function _classPrivateFieldSet(e,t,r){var s=_classExtractFieldDescriptor(e,t,"set");_classApplyDescriptorSet(e,s,r);return r}function _classExtractFieldDescriptor(e,t,r){if(!t.has(e)){throw new TypeError("attempted to "+r+" private field on non-instance")}return t.get(e)}function _classApplyDescriptorSet(e,t,r){if(t.set){t.set.call(e,r)}else{if(!t.writable){throw new TypeError("attempted to set read only private field")}t.value=r}}const s=r(6007);const{Definition:a}=r(665);const n=r(4162);const o=r(4585);const{getKeys:i}=r(1498);let l;function getVisitorValues(e,t){if(l)return l[e];const{FLOW_FLIPPED_ALIAS_KEYS:r,VISITOR_KEYS:s}=t.getTypesInfo();const a=r.concat(["ArrayPattern","ClassDeclaration","ClassExpression","FunctionDeclaration","FunctionExpression","Identifier","ObjectPattern","RestElement"]);l=Object.entries(s).reduce(((e,[t,r])=>{if(!a.includes(r)){e[t]=r}return e}),{});return l[e]}const c={callProperties:{type:"loop",values:["value"]},indexers:{type:"loop",values:["key","value"]},properties:{type:"loop",values:["argument","value"]},types:{type:"loop"},params:{type:"loop"},argument:{type:"single"},elementType:{type:"single"},qualification:{type:"single"},rest:{type:"single"},returnType:{type:"single"},typeAnnotation:{type:"typeAnnotation"},typeParameters:{type:"typeParameters"},id:{type:"id"}};class PatternVisitor extends n{ArrayPattern(e){e.elements.forEach(this.visit,this)}ObjectPattern(e){e.properties.forEach(this.visit,this)}}var u=new WeakMap;class Referencer extends o{constructor(e,t,r){super(e,t);u.set(this,{writable:true,value:void 0});_classPrivateFieldSet(this,u,r)}visitPattern(e,t,r){if(!e){return}this._checkIdentifierOrVisit(e.typeAnnotation);if(e.type==="AssignmentPattern"){this._checkIdentifierOrVisit(e.left.typeAnnotation)}if(typeof t==="function"){r=t;t={processRightHandNodes:false}}const s=new PatternVisitor(this.options,e,r);s.visit(e);if(t.processRightHandNodes){s.rightHandNodes.forEach(this.visit,this)}}visitClass(e){this._visitArray(e.decorators);const t=this._nestTypeParamScope(e);this._visitTypeAnnotation(e.implements);this._visitTypeAnnotation(e.superTypeParameters&&e.superTypeParameters.params);super.visitClass(e);if(t){this.close(e)}}visitFunction(e){const t=this._nestTypeParamScope(e);this._checkIdentifierOrVisit(e.returnType);super.visitFunction(e);if(t){this.close(e)}}visitProperty(e){var t;if(((t=e.value)==null?void 0:t.type)==="TypeCastExpression"){this._visitTypeAnnotation(e.value)}this._visitArray(e.decorators);super.visitProperty(e)}InterfaceDeclaration(e){this._createScopeVariable(e,e.id);const t=this._nestTypeParamScope(e);this._visitArray(e.extends);this.visit(e.body);if(t){this.close(e)}}TypeAlias(e){this._createScopeVariable(e,e.id);const t=this._nestTypeParamScope(e);this.visit(e.right);if(t){this.close(e)}}ClassProperty(e){this._visitClassProperty(e)}ClassPrivateProperty(e){this._visitClassProperty(e)}PropertyDefinition(e){this._visitClassProperty(e)}ClassPrivateMethod(e){super.MethodDefinition(e)}DeclareModule(e){this._visitDeclareX(e)}DeclareFunction(e){this._visitDeclareX(e)}DeclareVariable(e){this._visitDeclareX(e)}DeclareClass(e){this._visitDeclareX(e)}OptionalMemberExpression(e){super.MemberExpression(e)}_visitClassProperty(e){this._visitTypeAnnotation(e.typeAnnotation);this.visitProperty(e)}_visitDeclareX(e){if(e.id){this._createScopeVariable(e,e.id)}const t=this._nestTypeParamScope(e);if(t){this.close(e)}}_createScopeVariable(e,t){this.currentScope().variableScope.__define(t,new a("Variable",t,e,null,null,null))}_nestTypeParamScope(e){if(!e.typeParameters){return null}const t=this.scopeManager.__currentScope;const r=new s.Scope(this.scopeManager,"type-parameters",t,e,false);this.scopeManager.__nestScope(r);for(let t=0;t{var s,a,n,o,i,l;function _classStaticPrivateFieldSpecSet(e,t,r,s){_classCheckPrivateStaticAccess(e,t);_classCheckPrivateStaticFieldDescriptor(r,"set");_classApplyDescriptorSet(e,r,s);return s}function _classStaticPrivateFieldSpecGet(e,t,r){_classCheckPrivateStaticAccess(e,t);_classCheckPrivateStaticFieldDescriptor(r,"get");return _classApplyDescriptorGet(e,r)}function _classCheckPrivateStaticFieldDescriptor(e,t){if(e===undefined){throw new TypeError("attempted to "+t+" private static field before its declaration")}}function _classCheckPrivateStaticAccess(e,t){if(e!==t){throw new TypeError("Private static access of wrong provenance")}}function _classPrivateFieldGet(e,t){var r=_classExtractFieldDescriptor(e,t,"get");return _classApplyDescriptorGet(e,r)}function _classApplyDescriptorGet(e,t){if(t.get){return t.get.call(e)}return t.value}function _classPrivateFieldSet(e,t,r){var s=_classExtractFieldDescriptor(e,t,"set");_classApplyDescriptorSet(e,s,r);return r}function _classExtractFieldDescriptor(e,t,r){if(!t.has(e)){throw new TypeError("attempted to "+r+" private field on non-instance")}return t.get(e)}function _classApplyDescriptorSet(e,t,r){if(t.set){t.set.call(e,r)}else{if(!t.writable){throw new TypeError("attempted to set read only private field")}t.value=r}}const c=r(1017);const u={GET_VERSION:"GET_VERSION",GET_TYPES_INFO:"GET_TYPES_INFO",GET_VISITOR_KEYS:"GET_VISITOR_KEYS",GET_TOKEN_LABELS:"GET_TOKEN_LABELS",MAYBE_PARSE:"MAYBE_PARSE",MAYBE_PARSE_SYNC:"MAYBE_PARSE_SYNC"};var p=new WeakMap;var f=new WeakMap;var d=new WeakMap;var m=new WeakMap;var y=new WeakMap;class Client{constructor(e){p.set(this,{writable:true,value:void 0});f.set(this,{writable:true,value:void 0});d.set(this,{writable:true,value:void 0});m.set(this,{writable:true,value:void 0});y.set(this,{writable:true,value:void 0});_classPrivateFieldSet(this,p,e)}getVersion(){var e;return(e=_classPrivateFieldGet(this,f))!=null?e:_classPrivateFieldSet(this,f,_classPrivateFieldGet(this,p).call(this,u.GET_VERSION,undefined))}getTypesInfo(){var e;return(e=_classPrivateFieldGet(this,d))!=null?e:_classPrivateFieldSet(this,d,_classPrivateFieldGet(this,p).call(this,u.GET_TYPES_INFO,undefined))}getVisitorKeys(){var e;return(e=_classPrivateFieldGet(this,m))!=null?e:_classPrivateFieldSet(this,m,_classPrivateFieldGet(this,p).call(this,u.GET_VISITOR_KEYS,undefined))}getTokLabels(){var e;return(e=_classPrivateFieldGet(this,y))!=null?e:_classPrivateFieldSet(this,y,_classPrivateFieldGet(this,p).call(this,u.GET_TOKEN_LABELS,undefined))}maybeParse(e,t){return _classPrivateFieldGet(this,p).call(this,u.MAYBE_PARSE,{code:e,options:t})}}t.WorkerClient=(o=(a=new WeakMap,n=new WeakMap,s=class WorkerClient extends Client{constructor(){super(((e,t)=>{_classPrivateFieldGet(this,n)[0]=0;const r=new(_classStaticPrivateFieldSpecGet(WorkerClient,s,i).MessageChannel);_classPrivateFieldGet(this,a).postMessage({signal:_classPrivateFieldGet(this,n),port:r.port1,action:e,payload:t},[r.port1]);Atomics.wait(_classPrivateFieldGet(this,n),0,0);const{message:o}=_classStaticPrivateFieldSpecGet(WorkerClient,s,i).receiveMessageOnPort(r.port2);if(o.error)throw Object.assign(o.error,o.errorData);else return o.result}));a.set(this,{writable:true,value:new(_classStaticPrivateFieldSpecGet(WorkerClient,s,i).Worker)(c.resolve(__dirname,"../lib/worker/index.cjs"),{env:_classStaticPrivateFieldSpecGet(WorkerClient,s,i).SHARE_ENV})});n.set(this,{writable:true,value:new Int32Array(new SharedArrayBuffer(4))});_classPrivateFieldGet(this,a).unref()}}),i={get:_get_worker_threads,set:void 0},l={writable:true,value:void 0},o);function _get_worker_threads(){var e;return(e=_classStaticPrivateFieldSpecGet(s,s,l))!=null?e:_classStaticPrivateFieldSpecSet(s,s,l,r(1267))}{var g,h,b;t.LocalClient=(h=g=class LocalClient extends Client{constructor(){var e;(e=_classStaticPrivateFieldSpecGet(LocalClient,g,b))!=null?e:_classStaticPrivateFieldSpecSet(LocalClient,g,b,r(2100));super(((e,t)=>_classStaticPrivateFieldSpecGet(LocalClient,g,b).call(LocalClient,e===u.MAYBE_PARSE?u.MAYBE_PARSE_SYNC:e,t)))}},b={writable:true,value:void 0},h)}},244:(e,t)=>{const r=["babelOptions","ecmaVersion","sourceType","allowImportExportEverywhere","requireConfigFile"];function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var r={};var s=Object.keys(e);var a,n;for(n=0;n=0)continue;r[a]=e[a]}return r}t.normalizeESLintConfig=function(e){const{babelOptions:t={},ecmaVersion:s=2020,sourceType:a="module",allowImportExportEverywhere:n=false,requireConfigFile:o=true}=e,i=_objectWithoutPropertiesLoose(e,r);return Object.assign({babelOptions:Object.assign({cwd:process.cwd()},t),ecmaVersion:s,sourceType:a,allowImportExportEverywhere:n,requireConfigFile:o},i)}},1527:e=>{function*it(e){if(Array.isArray(e))yield*e;else yield e}function traverse(e,t,r){const{type:s}=e;if(!s)return;const a=t[s];if(!a)return;for(const s of a){for(const a of it(e[s])){if(a&&typeof a==="object"){r.enter(a);traverse(a,t,r);r.exit(a)}}}}const t={enter(e){if(e.innerComments){delete e.innerComments}if(e.trailingComments){delete e.trailingComments}if(e.leadingComments){delete e.leadingComments}},exit(e){if(e.extra){delete e.extra}if(e!=null&&e.loc.identifierName){delete e.loc.identifierName}if(e.type==="TypeParameter"){e.type="Identifier";e.typeAnnotation=e.bound;delete e.bound}if(e.type==="QualifiedTypeIdentifier"){delete e.id}if(e.type==="ObjectTypeProperty"){delete e.key}if(e.type==="ObjectTypeIndexer"){delete e.id}if(e.type==="FunctionTypeParam"){delete e.name}if(e.type==="ImportDeclaration"){delete e.isType}if(e.type==="TemplateLiteral"){for(let t=0;tr.end){e.range[1]=r.end;e.loc.end.line=r.loc.end.line;e.loc.end.column=r.loc.end.column}}}else{if(!e.tokens.length){e.loc.start.line=1;e.loc.end.line=1}}if(e.body&&e.body.length>0){e.loc.start.line=e.body[0].loc.start.line;e.range[0]=e.body[0].start}}e.exports=function convertAST(e,t){convertNodes(e,t);convertProgramNode(e)}},5926:e=>{e.exports=function convertComments(e){for(const t of e){if(t.type==="CommentBlock"){t.type="Block"}else if(t.type==="CommentLine"){t.type="Line"}if(!t.range){t.range=[t.start,t.end]}}}},9530:e=>{function convertTemplateType(e,t){let r=null;let s=[];const a=[];function addTemplateType(){const e=s[0];const r=s[s.length-1];const n=s.reduce(((e,r)=>{if(r.value){e+=r.value}else if(r.type.label!==t.template){e+=r.type.label}return e}),"");a.push({type:"Template",value:n,start:e.start,end:r.end,loc:{start:e.loc.start,end:r.loc.end}});s=[]}e.forEach((e=>{switch(e.type.label){case t.backQuote:if(r){a.push(r);r=null}s.push(e);if(s.length>1){addTemplateType()}break;case t.dollarBraceL:s.push(e);addTemplateType();break;case t.braceR:if(r){a.push(r)}r=e;break;case t.template:if(r){s.push(r);r=null}s.push(e);break;case t.eof:if(r){a.push(r)}break;default:if(r){a.push(r);r=null}a.push(e)}}));return a}function convertToken(e,t,r){const{type:s}=e;const{label:a}=s;e.range=[e.start,e.end];if(a===r.name){e.type="Identifier"}else if(a===r.semi||a===r.comma||a===r.parenL||a===r.parenR||a===r.braceL||a===r.braceR||a===r.slash||a===r.dot||a===r.bracketL||a===r.bracketR||a===r.ellipsis||a===r.arrow||a===r.pipeline||a===r.star||a===r.incDec||a===r.colon||a===r.question||a===r.template||a===r.backQuote||a===r.dollarBraceL||a===r.at||a===r.logicalOR||a===r.logicalAND||a===r.nullishCoalescing||a===r.bitwiseOR||a===r.bitwiseXOR||a===r.bitwiseAND||a===r.equality||a===r.relational||a===r.bitShift||a===r.plusMin||a===r.modulo||a===r.exponent||a===r.bang||a===r.tilde||a===r.doubleColon||a===r.hash||a===r.questionDot||a===r.braceHashL||a===r.braceBarL||a===r.braceBarR||a===r.bracketHashL||a===r.bracketBarL||a===r.bracketBarR||s.isAssign){var n;e.type="Punctuator";(n=e.value)!=null?n:e.value=a}else if(a===r.jsxTagStart){e.type="Punctuator";e.value="<"}else if(a===r.jsxTagEnd){e.type="Punctuator";e.value=">"}else if(a===r.jsxName){e.type="JSXIdentifier"}else if(a===r.jsxText){e.type="JSXText"}else if(s.keyword==="null"){e.type="Null"}else if(s.keyword==="false"||s.keyword==="true"){e.type="Boolean"}else if(s.keyword){e.type="Keyword"}else if(a===r.num){e.type="Numeric";e.value=t.slice(e.start,e.end)}else if(a===r.string){e.type="String";e.value=t.slice(e.start,e.end)}else if(a===r.regexp){e.type="RegularExpression";const t=e.value;e.regex={pattern:t.pattern,flags:t.flags};e.value=`/${t.pattern}/${t.flags}`}else if(a===r.bigint){e.type="Numeric";e.value=`${e.value}n`}else if(a===r.privateName){e.type="PrivateIdentifier"}if(typeof e.type!=="string"){delete e.type.rightAssociative}return e}e.exports=function convertTokens(e,t,r){return convertTemplateType(e,r).filter((e=>e.type!=="CommentLine"&&e.type!=="CommentBlock")).map((e=>convertToken(e,t,r)))}},3773:(e,t,r)=>{const s=r(9530);const a=r(5926);const n=r(1527);t.ast=function convert(e,t,r,o){e.tokens=s(e.tokens,t,r);a(e.comments);n(e,o);return e};t.error=function convertError(e){if(e instanceof SyntaxError){e.lineNumber=e.loc.line;e.column=e.loc.column}return e}},8187:(e,t,r)=>{const{normalizeESLintConfig:s}=r(244);const a=r(614);const n=r(7854);const{LocalClient:o,WorkerClient:i}=r(7571);const l=new o;t.parse=function(e,t={}){return n(e,s(t),l)};t.parseForESLint=function(e,t={}){const r=s(t);const o=n(e,r,l);const i=a(o,r,l);return{ast:o,scopeManager:i,visitorKeys:l.getVisitorKeys()}}},7854:(e,t,r)=>{"use strict";const s=r(7849);const a=r(3773);function noop(){}const n=r(6949);noop((((e,t)=>(e=e.split("."),t=t.split("."),+e[0]>+t[0]||e[0]==t[0]&&+e[1]>=+t[1]))(process.versions.node,"8.9")?noop:(e,{paths:[t]},s=r(8188))=>{let a=s._findPath(e,s._nodeModulePaths(t).concat(t));if(a)return a;a=new Error(`Cannot resolve module '${e}'`);a.code="MODULE_NOT_FOUND";throw a})("@babel/parser",{paths:[noop("@babel/core/package.json")]}));let o=null;e.exports=function parse(e,t,r){const i=">=7.2.0";if(typeof o!=="boolean"){o=s.satisfies(r.getVersion(),i)}if(!o){throw new Error(`@babel/eslint-parser@${"7.15.0"} does not support @babel/core@${r.getVersion()}. Please upgrade to @babel/core@${i}.`)}const{ast:l,parserOptions:c}=r.maybeParse(e,t);if(l)return l;try{return a.ast(n.parse(e,c),e,r.getTokLabels(),r.getVisitorKeys())}catch(e){throw a.error(e)}}},76:(e,t,r)=>{const s=r(1498).KEYS;const a=r(6130);let n;t.getVisitorKeys=function getVisitorKeys(){if(!n){const e={ChainExpression:s.ChainExpression,ImportExpression:s.ImportExpression,Literal:s.Literal,MethodDefinition:["decorators"].concat(s.MethodDefinition),Property:["decorators"].concat(s.Property),PropertyDefinition:["decorators"].concat(s.PropertyDefinition)};const t={ClassPrivateMethod:["decorators"].concat(s.MethodDefinition),ExportAllDeclaration:s.ExportAllDeclaration};n=Object.assign({},e,a.types.VISITOR_KEYS,t)}return n};let o;t.getTokLabels=function getTokLabels(){return o||(o=(e=>e.reduce(((e,[t,r])=>Object.assign({},e,{[t]:r})),{}))(Object.entries(a.tokTypes).map((([e,t])=>[e,t.label]))))}},6130:(e,t,r)=>{function initialize(e){t.init=null;t.version=e.version;t.traverse=e.traverse;t.types=e.types;t.tokTypes=e.tokTypes;t.parseSync=e.parseSync;t.loadPartialConfigSync=e.loadPartialConfigSync;t.loadPartialConfigAsync=e.loadPartialConfigAsync;t.createConfigItem=e.createConfigItem}{initialize(r(8304))}},1542:(e,t,r)=>{function asyncGeneratorStep(e,t,r,s,a,n,o){try{var i=e[n](o);var l=i.value}catch(e){r(e);return}if(i.done){t(l)}else{Promise.resolve(l).then(s,a)}}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(s,a){var n=e.apply(t,r);function _next(e){asyncGeneratorStep(n,s,a,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(n,s,a,_next,_throw,"throw",e)}_next(undefined)}))}}const s=r(6130);function getParserPlugins(e){var t,r;const s=(t=(r=e.parserOpts)==null?void 0:r.plugins)!=null?t:[];const a={classFeatures:false};for(const e of s){if(Array.isArray(e)&&e[0]==="estree"){Object.assign(a,e[1]);break}}return[["estree",a],...s]}function normalizeParserOptions(e){return Object.assign({sourceType:e.sourceType,filename:e.filePath},e.babelOptions,{parserOpts:Object.assign({allowImportExportEverywhere:e.allowImportExportEverywhere,allowReturnOutsideFunction:true,allowSuperOutsideMethod:true},e.babelOptions.parserOpts,{plugins:getParserPlugins(e.babelOptions),attachComment:false,ranges:true,tokens:true}),caller:Object.assign({name:"@babel/eslint-parser"},e.babelOptions.caller)})}function validateResolvedConfig(e,t,r){if(e!==null){if(t.requireConfigFile!==false){if(!e.hasFilesystemConfig()){let t=`No Babel config file detected for ${e.options.filename}. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.`;if(e.options.filename.includes("node_modules")){t+=`\nIf you have a .babelrc.js file or use package.json#babel, keep in mind that it's not used when parsing dependencies. If you want your config to be applied to your whole app, consider using babel.config.js or babel.config.json instead.`}throw new Error(t)}}if(e.options)return e.options}return getDefaultParserOptions(r)}function getDefaultParserOptions(e){return Object.assign({plugins:[]},e,{babelrc:false,configFile:false,browserslistConfigFile:false,ignore:null,only:null})}t.normalizeBabelParseConfig=function(){var e=_asyncToGenerator((function*(e){const t=normalizeParserOptions(e);const r=yield s.loadPartialConfigAsync(t);return validateResolvedConfig(r,e,t)}));return function(t){return e.apply(this,arguments)}}();t.normalizeBabelParseConfigSync=function(e){const t=normalizeParserOptions(e);const r=s.loadPartialConfigSync(t);return validateResolvedConfig(r,e,t)}},2355:e=>{e.exports=function extractParserOptionsPlugin(){return{parserOverride(e,t){return t}}}},2100:(e,t,r)=>{const s=r(6130);const a=r(7495);const{getVisitorKeys:n,getTokLabels:o}=r(76);const{normalizeBabelParseConfig:i,normalizeBabelParseConfigSync:l}=r(1542);e.exports=function handleMessage(e,t){switch(e){case"GET_VERSION":return s.version;case"GET_TYPES_INFO":return{FLOW_FLIPPED_ALIAS_KEYS:s.types.FLIPPED_ALIAS_KEYS.Flow,VISITOR_KEYS:s.types.VISITOR_KEYS};case"GET_TOKEN_LABELS":return o();case"GET_VISITOR_KEYS":return n();case"MAYBE_PARSE":return i(t.options).then((e=>a(t.code,e)));case"MAYBE_PARSE_SYNC":{return a(t.code,l(t.options))}}throw new Error(`Unknown internal parser worker action: ${e}`)}},7495:(e,t,r)=>{const s=r(6130);const a=r(3773);const{getVisitorKeys:n,getTokLabels:o}=r(76);const i=r(2355);const l={};let c;const u=/More than one plugin attempted to override parsing/;e.exports=function maybeParse(e,t){if(!c){c=s.createConfigItem([i,l],{dirname:__dirname,type:"plugin"})}t.plugins.push(c);try{return{parserOptions:s.parseSync(e,t),ast:null}}catch(e){if(!u.test(e.message)){throw e}}let r;try{r=s.parseSync(e,t)}catch(e){throw a.error(e)}return{ast:a.ast(r,e,o(),n()),parserOptions:null}}},5619:e=>{"use strict";e.exports=JSON.parse('{"es6.module":{"chrome":"61","and_chr":"61","edge":"16","firefox":"60","and_ff":"60","node":"13.2.0","opera":"48","op_mob":"48","safari":"10.1","ios":"10.3","samsung":"8.2","android":"61","electron":"2.0","ios_saf":"10.3"}}')},7286:e=>{"use strict";e.exports=JSON.parse('{"proposal-class-static-block":{"chrome":"91","electron":"13.0"},"proposal-private-property-in-object":{"chrome":"91","firefox":"90","electron":"13.0"},"proposal-class-properties":{"chrome":"74","opera":"62","edge":"79","firefox":"90","safari":"14.1","node":"12","samsung":"11","electron":"6.0"},"proposal-private-methods":{"chrome":"84","opera":"70","edge":"84","firefox":"90","safari":"15","node":"14.6","electron":"10.0"},"proposal-numeric-separator":{"chrome":"75","opera":"62","edge":"79","firefox":"70","safari":"13","node":"12.5","ios":"13","samsung":"11","electron":"6.0"},"proposal-logical-assignment-operators":{"chrome":"85","opera":"71","edge":"85","firefox":"79","safari":"14","node":"15","ios":"14","electron":"10.0"},"proposal-nullish-coalescing-operator":{"chrome":"80","opera":"67","edge":"80","firefox":"72","safari":"13.1","node":"14","ios":"13.4","samsung":"13","electron":"8.0"},"proposal-optional-chaining":{"firefox":"74","safari":"13.1","ios":"13.4"},"proposal-json-strings":{"chrome":"66","opera":"53","edge":"79","firefox":"62","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"proposal-optional-catch-binding":{"chrome":"66","opera":"53","edge":"79","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-parameters":{"chrome":"49","opera":"36","edge":"18","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"proposal-async-generator-functions":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"proposal-object-rest-spread":{"chrome":"60","opera":"47","edge":"79","firefox":"55","safari":"11.1","node":"8.3","ios":"11.3","samsung":"8","electron":"2.0"},"transform-dotall-regex":{"chrome":"62","opera":"49","edge":"79","firefox":"78","safari":"11.1","node":"8.10","ios":"11.3","samsung":"8","electron":"3.0"},"proposal-unicode-property-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-named-capturing-groups-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-async-to-generator":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"11","node":"7.6","ios":"11","samsung":"6","electron":"1.6"},"transform-exponentiation-operator":{"chrome":"52","opera":"39","edge":"14","firefox":"52","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.3"},"transform-template-literals":{"chrome":"41","opera":"28","edge":"13","firefox":"34","safari":"13","node":"4","ios":"13","samsung":"3.4","electron":"0.21"},"transform-literals":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-function-name":{"chrome":"51","opera":"38","edge":"79","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-arrow-functions":{"chrome":"47","opera":"34","edge":"13","firefox":"45","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"transform-block-scoped-functions":{"chrome":"41","opera":"28","edge":"12","firefox":"46","safari":"10","node":"4","ie":"11","ios":"10","samsung":"3.4","electron":"0.21"},"transform-classes":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-object-super":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-shorthand-properties":{"chrome":"43","opera":"30","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.27"},"transform-duplicate-keys":{"chrome":"42","opera":"29","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.25"},"transform-computed-properties":{"chrome":"44","opera":"31","edge":"12","firefox":"34","safari":"7.1","node":"4","ios":"8","samsung":"4","electron":"0.30"},"transform-for-of":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-sticky-regex":{"chrome":"49","opera":"36","edge":"13","firefox":"3","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"transform-unicode-escapes":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-unicode-regex":{"chrome":"50","opera":"37","edge":"13","firefox":"46","safari":"12","node":"6","ios":"12","samsung":"5","electron":"1.1"},"transform-spread":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-destructuring":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-block-scoping":{"chrome":"49","opera":"36","edge":"14","firefox":"51","safari":"11","node":"6","ios":"11","samsung":"5","electron":"0.37"},"transform-typeof-symbol":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"transform-new-target":{"chrome":"46","opera":"33","edge":"14","firefox":"41","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-regenerator":{"chrome":"50","opera":"37","edge":"13","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"transform-member-expression-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"transform-property-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"transform-reserved-words":{"chrome":"13","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4.4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"proposal-export-namespace-from":{"chrome":"72","and_chr":"72","edge":"79","firefox":"80","and_ff":"80","node":"13.2","opera":"60","op_mob":"51","samsung":"11.0","android":"72","electron":"5.0"}}')},3654:e=>{"use strict";e.exports=JSON.parse('{"AssignmentExpression":["left","right"],"AssignmentPattern":["left","right"],"ArrayExpression":["elements"],"ArrayPattern":["elements"],"ArrowFunctionExpression":["params","body"],"AwaitExpression":["argument"],"BlockStatement":["body"],"BinaryExpression":["left","right"],"BreakStatement":["label"],"CallExpression":["callee","arguments"],"CatchClause":["param","body"],"ChainExpression":["expression"],"ClassBody":["body"],"ClassDeclaration":["id","superClass","body"],"ClassExpression":["id","superClass","body"],"ConditionalExpression":["test","consequent","alternate"],"ContinueStatement":["label"],"DebuggerStatement":[],"DoWhileStatement":["body","test"],"EmptyStatement":[],"ExportAllDeclaration":["exported","source"],"ExportDefaultDeclaration":["declaration"],"ExportNamedDeclaration":["declaration","specifiers","source"],"ExportSpecifier":["exported","local"],"ExpressionStatement":["expression"],"ExperimentalRestProperty":["argument"],"ExperimentalSpreadProperty":["argument"],"ForStatement":["init","test","update","body"],"ForInStatement":["left","right","body"],"ForOfStatement":["left","right","body"],"FunctionDeclaration":["id","params","body"],"FunctionExpression":["id","params","body"],"Identifier":[],"IfStatement":["test","consequent","alternate"],"ImportDeclaration":["specifiers","source"],"ImportDefaultSpecifier":["local"],"ImportExpression":["source"],"ImportNamespaceSpecifier":["local"],"ImportSpecifier":["imported","local"],"JSXAttribute":["name","value"],"JSXClosingElement":["name"],"JSXElement":["openingElement","children","closingElement"],"JSXEmptyExpression":[],"JSXExpressionContainer":["expression"],"JSXIdentifier":[],"JSXMemberExpression":["object","property"],"JSXNamespacedName":["namespace","name"],"JSXOpeningElement":["name","attributes"],"JSXSpreadAttribute":["argument"],"JSXText":[],"JSXFragment":["openingFragment","children","closingFragment"],"Literal":[],"LabeledStatement":["label","body"],"LogicalExpression":["left","right"],"MemberExpression":["object","property"],"MetaProperty":["meta","property"],"MethodDefinition":["key","value"],"NewExpression":["callee","arguments"],"ObjectExpression":["properties"],"ObjectPattern":["properties"],"PrivateIdentifier":[],"Program":["body"],"Property":["key","value"],"PropertyDefinition":["key","value"],"RestElement":["argument"],"ReturnStatement":["argument"],"SequenceExpression":["expressions"],"SpreadElement":["argument"],"Super":[],"SwitchStatement":["discriminant","cases"],"SwitchCase":["test","consequent"],"TaggedTemplateExpression":["tag","quasi"],"TemplateElement":[],"TemplateLiteral":["quasis","expressions"],"ThisExpression":[],"ThrowStatement":["argument"],"TryStatement":["block","handler","finalizer"],"UnaryExpression":["argument"],"UpdateExpression":["argument"],"VariableDeclaration":["declarations"],"VariableDeclarator":["id","init"],"WhileStatement":["test","body"],"WithStatement":["object","body"],"YieldExpression":["argument"]}')},5676:e=>{"use strict";e.exports=JSON.parse('{"assert":true,"assert/strict":">= 15","async_hooks":">= 8","buffer_ieee754":"< 0.9.7","buffer":true,"child_process":true,"cluster":true,"console":true,"constants":true,"crypto":true,"_debug_agent":">= 1 && < 8","_debugger":"< 8","dgram":true,"diagnostics_channel":">= 15.1","dns":true,"dns/promises":">= 15","domain":">= 0.7.12","events":true,"freelist":"< 6","fs":true,"fs/promises":[">= 10 && < 10.1",">= 14"],"_http_agent":">= 0.11.1","_http_client":">= 0.11.1","_http_common":">= 0.11.1","_http_incoming":">= 0.11.1","_http_outgoing":">= 0.11.1","_http_server":">= 0.11.1","http":true,"http2":">= 8.8","https":true,"inspector":">= 8.0.0","_linklist":"< 8","module":true,"net":true,"node-inspect/lib/_inspect":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6.0 && < 12","os":true,"path":true,"path/posix":">= 15.3","path/win32":">= 15.3","perf_hooks":">= 8.5","process":">= 1","punycode":true,"querystring":true,"readline":true,"repl":true,"smalloc":">= 0.11.5 && < 3","_stream_duplex":">= 0.9.4","_stream_transform":">= 0.9.4","_stream_wrap":">= 1.4.1","_stream_passthrough":">= 0.9.4","_stream_readable":">= 0.9.4","_stream_writable":">= 0.9.4","stream":true,"stream/promises":">= 15","string_decoder":true,"sys":[">= 0.6 && < 0.7",">= 0.8"],"timers":true,"timers/promises":">= 15","_tls_common":">= 0.11.13","_tls_legacy":">= 0.11.3 && < 10","_tls_wrap":">= 0.11.3","tls":true,"trace_events":">= 10","tty":true,"url":true,"util":true,"util/types":">= 15.3","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/consarray":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/csvparser":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/logreader":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/profile_view":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/splaytree":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8":">= 1","vm":true,"wasi":">= 13.4 && < 13.5","worker_threads":">= 11.7","zlib":true}')},5880:e=>{"use strict";e.exports=JSON.parse('{"es6.array.copy-within":{"chrome":"45","opera":"32","edge":"12","firefox":"32","safari":"9","node":"4","ios":"9","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.every":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.fill":{"chrome":"45","opera":"32","edge":"12","firefox":"31","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.filter":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.find":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.find-index":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es7.array.flat-map":{"chrome":"69","opera":"56","edge":"79","firefox":"62","safari":"12","node":"11","ios":"12","samsung":"10","electron":"4.0"},"es6.array.for-each":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.from":{"chrome":"51","opera":"38","edge":"15","firefox":"36","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.array.includes":{"chrome":"47","opera":"34","edge":"14","firefox":"43","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.array.index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.is-array":{"chrome":"5","opera":"10.50","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.iterator":{"chrome":"66","opera":"53","edge":"12","firefox":"60","safari":"9","node":"10","ios":"9","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es6.array.last-index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.map":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.of":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"9","node":"4","ios":"9","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.reduce":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.reduce-right":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.slice":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.some":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.sort":{"chrome":"63","opera":"50","edge":"12","firefox":"5","safari":"12","node":"10","ie":"9","ios":"12","samsung":"8","rhino":"1.7.13","electron":"3.0"},"es6.array.species":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.date.now":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-iso-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-json":{"chrome":"5","opera":"12.10","edge":"12","firefox":"4","safari":"10","node":"0.10","ie":"9","android":"4","ios":"10","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-primitive":{"chrome":"47","opera":"34","edge":"15","firefox":"44","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.date.to-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.function.bind":{"chrome":"7","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.function.has-instance":{"chrome":"51","opera":"38","edge":"15","firefox":"50","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.function.name":{"chrome":"5","opera":"10.50","edge":"14","firefox":"2","safari":"4","node":"0.10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.math.acosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.asinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.atanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.cbrt":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.clz32":{"chrome":"38","opera":"25","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.cosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.expm1":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.fround":{"chrome":"38","opera":"25","edge":"12","firefox":"26","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.hypot":{"chrome":"38","opera":"25","edge":"12","firefox":"27","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.imul":{"chrome":"30","opera":"17","edge":"12","firefox":"23","safari":"7","node":"0.12","android":"4.4","ios":"7","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.math.log1p":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.log10":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.log2":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.sign":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.sinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.tanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.trunc":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.number.constructor":{"chrome":"41","opera":"28","edge":"12","firefox":"36","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.number.epsilon":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.is-finite":{"chrome":"19","opera":"15","edge":"12","firefox":"16","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.number.is-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"16","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.is-nan":{"chrome":"19","opera":"15","edge":"12","firefox":"15","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.number.is-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"32","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.max-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.min-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.parse-float":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.parse-int":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.object.assign":{"chrome":"49","opera":"36","edge":"13","firefox":"36","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.object.create":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.object.define-getter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.define-setter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.define-property":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.object.define-properties":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.object.entries":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.freeze":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.get-own-property-descriptor":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es7.object.get-own-property-descriptors":{"chrome":"54","opera":"41","edge":"15","firefox":"50","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.get-own-property-names":{"chrome":"40","opera":"27","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.object.get-prototype-of":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es7.object.lookup-getter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.lookup-setter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.prevent-extensions":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.to-string":{"chrome":"57","opera":"44","edge":"15","firefox":"51","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es6.object.is":{"chrome":"19","opera":"15","edge":"12","firefox":"22","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.object.is-frozen":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.is-sealed":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.is-extensible":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.keys":{"chrome":"40","opera":"27","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.object.seal":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.set-prototype-of":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ie":"11","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es7.object.values":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.promise":{"chrome":"51","opera":"38","edge":"14","firefox":"45","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.promise.finally":{"chrome":"63","opera":"50","edge":"18","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"8","electron":"3.0"},"es6.reflect.apply":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.construct":{"chrome":"49","opera":"36","edge":"13","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.define-property":{"chrome":"49","opera":"36","edge":"13","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.delete-property":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-own-property-descriptor":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.has":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.is-extensible":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.own-keys":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.prevent-extensions":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.regexp.constructor":{"chrome":"50","opera":"37","edge":"79","firefox":"40","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.flags":{"chrome":"49","opera":"36","edge":"79","firefox":"37","safari":"9","node":"6","ios":"9","samsung":"5","electron":"0.37"},"es6.regexp.match":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"1.1"},"es6.regexp.replace":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.split":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.search":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"1.1"},"es6.regexp.to-string":{"chrome":"50","opera":"37","edge":"79","firefox":"39","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.symbol":{"chrome":"51","opera":"38","edge":"79","firefox":"51","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.symbol.async-iterator":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"es6.string.anchor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.big":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.blink":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.bold":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.code-point-at":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.ends-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.fixed":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontcolor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontsize":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.from-code-point":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.includes":{"chrome":"41","opera":"28","edge":"12","firefox":"40","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.italics":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.iterator":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.string.link":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es7.string.pad-start":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","rhino":"1.7.13","electron":"1.7"},"es7.string.pad-end":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","rhino":"1.7.13","electron":"1.7"},"es6.string.raw":{"chrome":"41","opera":"28","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.repeat":{"chrome":"41","opera":"28","edge":"12","firefox":"24","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.small":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.starts-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.strike":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sub":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sup":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.trim":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.string.trim-left":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es7.string.trim-right":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es6.typed.array-buffer":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.data-view":{"chrome":"5","opera":"12","edge":"12","firefox":"15","safari":"5.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.typed.int8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-clamped-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float64-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.weak-map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"},"es6.weak-set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"}}')},2166:e=>{"use strict";e.exports={version:"4.3.0"}},290:e=>{"use strict";e.exports={i8:"5.1.1"}},5535:e=>{"use strict";e.exports={i8:"4.3.0"}},964:e=>{"use strict";e.exports=JSON.parse('{"builtin":{"Array":false,"ArrayBuffer":false,"Atomics":false,"BigInt":false,"BigInt64Array":false,"BigUint64Array":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"globalThis":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"es5":{"Array":false,"Boolean":false,"constructor":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"propertyIsEnumerable":false,"RangeError":false,"ReferenceError":false,"RegExp":false,"String":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false},"es2015":{"Array":false,"ArrayBuffer":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"es2017":{"Array":false,"ArrayBuffer":false,"Atomics":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"browser":{"AbortController":false,"AbortSignal":false,"addEventListener":false,"alert":false,"AnalyserNode":false,"Animation":false,"AnimationEffectReadOnly":false,"AnimationEffectTiming":false,"AnimationEffectTimingReadOnly":false,"AnimationEvent":false,"AnimationPlaybackEvent":false,"AnimationTimeline":false,"applicationCache":false,"ApplicationCache":false,"ApplicationCacheErrorEvent":false,"atob":false,"Attr":false,"Audio":false,"AudioBuffer":false,"AudioBufferSourceNode":false,"AudioContext":false,"AudioDestinationNode":false,"AudioListener":false,"AudioNode":false,"AudioParam":false,"AudioProcessingEvent":false,"AudioScheduledSourceNode":false,"AudioWorkletGlobalScope ":false,"AudioWorkletNode":false,"AudioWorkletProcessor":false,"BarProp":false,"BaseAudioContext":false,"BatteryManager":false,"BeforeUnloadEvent":false,"BiquadFilterNode":false,"Blob":false,"BlobEvent":false,"blur":false,"BroadcastChannel":false,"btoa":false,"BudgetService":false,"ByteLengthQueuingStrategy":false,"Cache":false,"caches":false,"CacheStorage":false,"cancelAnimationFrame":false,"cancelIdleCallback":false,"CanvasCaptureMediaStreamTrack":false,"CanvasGradient":false,"CanvasPattern":false,"CanvasRenderingContext2D":false,"ChannelMergerNode":false,"ChannelSplitterNode":false,"CharacterData":false,"clearInterval":false,"clearTimeout":false,"clientInformation":false,"ClipboardEvent":false,"close":false,"closed":false,"CloseEvent":false,"Comment":false,"CompositionEvent":false,"confirm":false,"console":false,"ConstantSourceNode":false,"ConvolverNode":false,"CountQueuingStrategy":false,"createImageBitmap":false,"Credential":false,"CredentialsContainer":false,"crypto":false,"Crypto":false,"CryptoKey":false,"CSS":false,"CSSConditionRule":false,"CSSFontFaceRule":false,"CSSGroupingRule":false,"CSSImportRule":false,"CSSKeyframeRule":false,"CSSKeyframesRule":false,"CSSMediaRule":false,"CSSNamespaceRule":false,"CSSPageRule":false,"CSSRule":false,"CSSRuleList":false,"CSSStyleDeclaration":false,"CSSStyleRule":false,"CSSStyleSheet":false,"CSSSupportsRule":false,"CustomElementRegistry":false,"customElements":false,"CustomEvent":false,"DataTransfer":false,"DataTransferItem":false,"DataTransferItemList":false,"defaultstatus":false,"defaultStatus":false,"DelayNode":false,"DeviceMotionEvent":false,"DeviceOrientationEvent":false,"devicePixelRatio":false,"dispatchEvent":false,"document":false,"Document":false,"DocumentFragment":false,"DocumentType":false,"DOMError":false,"DOMException":false,"DOMImplementation":false,"DOMMatrix":false,"DOMMatrixReadOnly":false,"DOMParser":false,"DOMPoint":false,"DOMPointReadOnly":false,"DOMQuad":false,"DOMRect":false,"DOMRectReadOnly":false,"DOMStringList":false,"DOMStringMap":false,"DOMTokenList":false,"DragEvent":false,"DynamicsCompressorNode":false,"Element":false,"ErrorEvent":false,"event":false,"Event":false,"EventSource":false,"EventTarget":false,"external":false,"fetch":false,"File":false,"FileList":false,"FileReader":false,"find":false,"focus":false,"FocusEvent":false,"FontFace":false,"FontFaceSetLoadEvent":false,"FormData":false,"frameElement":false,"frames":false,"GainNode":false,"Gamepad":false,"GamepadButton":false,"GamepadEvent":false,"getComputedStyle":false,"getSelection":false,"HashChangeEvent":false,"Headers":false,"history":false,"History":false,"HTMLAllCollection":false,"HTMLAnchorElement":false,"HTMLAreaElement":false,"HTMLAudioElement":false,"HTMLBaseElement":false,"HTMLBodyElement":false,"HTMLBRElement":false,"HTMLButtonElement":false,"HTMLCanvasElement":false,"HTMLCollection":false,"HTMLContentElement":false,"HTMLDataElement":false,"HTMLDataListElement":false,"HTMLDetailsElement":false,"HTMLDialogElement":false,"HTMLDirectoryElement":false,"HTMLDivElement":false,"HTMLDListElement":false,"HTMLDocument":false,"HTMLElement":false,"HTMLEmbedElement":false,"HTMLFieldSetElement":false,"HTMLFontElement":false,"HTMLFormControlsCollection":false,"HTMLFormElement":false,"HTMLFrameElement":false,"HTMLFrameSetElement":false,"HTMLHeadElement":false,"HTMLHeadingElement":false,"HTMLHRElement":false,"HTMLHtmlElement":false,"HTMLIFrameElement":false,"HTMLImageElement":false,"HTMLInputElement":false,"HTMLLabelElement":false,"HTMLLegendElement":false,"HTMLLIElement":false,"HTMLLinkElement":false,"HTMLMapElement":false,"HTMLMarqueeElement":false,"HTMLMediaElement":false,"HTMLMenuElement":false,"HTMLMetaElement":false,"HTMLMeterElement":false,"HTMLModElement":false,"HTMLObjectElement":false,"HTMLOListElement":false,"HTMLOptGroupElement":false,"HTMLOptionElement":false,"HTMLOptionsCollection":false,"HTMLOutputElement":false,"HTMLParagraphElement":false,"HTMLParamElement":false,"HTMLPictureElement":false,"HTMLPreElement":false,"HTMLProgressElement":false,"HTMLQuoteElement":false,"HTMLScriptElement":false,"HTMLSelectElement":false,"HTMLShadowElement":false,"HTMLSlotElement":false,"HTMLSourceElement":false,"HTMLSpanElement":false,"HTMLStyleElement":false,"HTMLTableCaptionElement":false,"HTMLTableCellElement":false,"HTMLTableColElement":false,"HTMLTableElement":false,"HTMLTableRowElement":false,"HTMLTableSectionElement":false,"HTMLTemplateElement":false,"HTMLTextAreaElement":false,"HTMLTimeElement":false,"HTMLTitleElement":false,"HTMLTrackElement":false,"HTMLUListElement":false,"HTMLUnknownElement":false,"HTMLVideoElement":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"IdleDeadline":false,"IIRFilterNode":false,"Image":false,"ImageBitmap":false,"ImageBitmapRenderingContext":false,"ImageCapture":false,"ImageData":false,"indexedDB":false,"innerHeight":false,"innerWidth":false,"InputEvent":false,"IntersectionObserver":false,"IntersectionObserverEntry":false,"Intl":false,"isSecureContext":false,"KeyboardEvent":false,"KeyframeEffect":false,"KeyframeEffectReadOnly":false,"length":false,"localStorage":false,"location":true,"Location":false,"locationbar":false,"matchMedia":false,"MediaDeviceInfo":false,"MediaDevices":false,"MediaElementAudioSourceNode":false,"MediaEncryptedEvent":false,"MediaError":false,"MediaKeyMessageEvent":false,"MediaKeySession":false,"MediaKeyStatusMap":false,"MediaKeySystemAccess":false,"MediaList":false,"MediaQueryList":false,"MediaQueryListEvent":false,"MediaRecorder":false,"MediaSettingsRange":false,"MediaSource":false,"MediaStream":false,"MediaStreamAudioDestinationNode":false,"MediaStreamAudioSourceNode":false,"MediaStreamEvent":false,"MediaStreamTrack":false,"MediaStreamTrackEvent":false,"menubar":false,"MessageChannel":false,"MessageEvent":false,"MessagePort":false,"MIDIAccess":false,"MIDIConnectionEvent":false,"MIDIInput":false,"MIDIInputMap":false,"MIDIMessageEvent":false,"MIDIOutput":false,"MIDIOutputMap":false,"MIDIPort":false,"MimeType":false,"MimeTypeArray":false,"MouseEvent":false,"moveBy":false,"moveTo":false,"MutationEvent":false,"MutationObserver":false,"MutationRecord":false,"name":false,"NamedNodeMap":false,"NavigationPreloadManager":false,"navigator":false,"Navigator":false,"NetworkInformation":false,"Node":false,"NodeFilter":false,"NodeIterator":false,"NodeList":false,"Notification":false,"OfflineAudioCompletionEvent":false,"OfflineAudioContext":false,"offscreenBuffering":false,"OffscreenCanvas":true,"onabort":true,"onafterprint":true,"onanimationend":true,"onanimationiteration":true,"onanimationstart":true,"onappinstalled":true,"onauxclick":true,"onbeforeinstallprompt":true,"onbeforeprint":true,"onbeforeunload":true,"onblur":true,"oncancel":true,"oncanplay":true,"oncanplaythrough":true,"onchange":true,"onclick":true,"onclose":true,"oncontextmenu":true,"oncuechange":true,"ondblclick":true,"ondevicemotion":true,"ondeviceorientation":true,"ondeviceorientationabsolute":true,"ondrag":true,"ondragend":true,"ondragenter":true,"ondragleave":true,"ondragover":true,"ondragstart":true,"ondrop":true,"ondurationchange":true,"onemptied":true,"onended":true,"onerror":true,"onfocus":true,"ongotpointercapture":true,"onhashchange":true,"oninput":true,"oninvalid":true,"onkeydown":true,"onkeypress":true,"onkeyup":true,"onlanguagechange":true,"onload":true,"onloadeddata":true,"onloadedmetadata":true,"onloadstart":true,"onlostpointercapture":true,"onmessage":true,"onmessageerror":true,"onmousedown":true,"onmouseenter":true,"onmouseleave":true,"onmousemove":true,"onmouseout":true,"onmouseover":true,"onmouseup":true,"onmousewheel":true,"onoffline":true,"ononline":true,"onpagehide":true,"onpageshow":true,"onpause":true,"onplay":true,"onplaying":true,"onpointercancel":true,"onpointerdown":true,"onpointerenter":true,"onpointerleave":true,"onpointermove":true,"onpointerout":true,"onpointerover":true,"onpointerup":true,"onpopstate":true,"onprogress":true,"onratechange":true,"onrejectionhandled":true,"onreset":true,"onresize":true,"onscroll":true,"onsearch":true,"onseeked":true,"onseeking":true,"onselect":true,"onstalled":true,"onstorage":true,"onsubmit":true,"onsuspend":true,"ontimeupdate":true,"ontoggle":true,"ontransitionend":true,"onunhandledrejection":true,"onunload":true,"onvolumechange":true,"onwaiting":true,"onwheel":true,"open":false,"openDatabase":false,"opener":false,"Option":false,"origin":false,"OscillatorNode":false,"outerHeight":false,"outerWidth":false,"PageTransitionEvent":false,"pageXOffset":false,"pageYOffset":false,"PannerNode":false,"parent":false,"Path2D":false,"PaymentAddress":false,"PaymentRequest":false,"PaymentRequestUpdateEvent":false,"PaymentResponse":false,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceLongTaskTiming":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceNavigationTiming":false,"PerformanceObserver":false,"PerformanceObserverEntryList":false,"PerformancePaintTiming":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"PeriodicWave":false,"Permissions":false,"PermissionStatus":false,"personalbar":false,"PhotoCapabilities":false,"Plugin":false,"PluginArray":false,"PointerEvent":false,"PopStateEvent":false,"postMessage":false,"Presentation":false,"PresentationAvailability":false,"PresentationConnection":false,"PresentationConnectionAvailableEvent":false,"PresentationConnectionCloseEvent":false,"PresentationConnectionList":false,"PresentationReceiver":false,"PresentationRequest":false,"print":false,"ProcessingInstruction":false,"ProgressEvent":false,"PromiseRejectionEvent":false,"prompt":false,"PushManager":false,"PushSubscription":false,"PushSubscriptionOptions":false,"queueMicrotask":false,"RadioNodeList":false,"Range":false,"ReadableStream":false,"registerProcessor":false,"RemotePlayback":false,"removeEventListener":false,"Request":false,"requestAnimationFrame":false,"requestIdleCallback":false,"resizeBy":false,"ResizeObserver":false,"ResizeObserverEntry":false,"resizeTo":false,"Response":false,"RTCCertificate":false,"RTCDataChannel":false,"RTCDataChannelEvent":false,"RTCDtlsTransport":false,"RTCIceCandidate":false,"RTCIceGatherer":false,"RTCIceTransport":false,"RTCPeerConnection":false,"RTCPeerConnectionIceEvent":false,"RTCRtpContributingSource":false,"RTCRtpReceiver":false,"RTCRtpSender":false,"RTCSctpTransport":false,"RTCSessionDescription":false,"RTCStatsReport":false,"RTCTrackEvent":false,"screen":false,"Screen":false,"screenLeft":false,"ScreenOrientation":false,"screenTop":false,"screenX":false,"screenY":false,"ScriptProcessorNode":false,"scroll":false,"scrollbars":false,"scrollBy":false,"scrollTo":false,"scrollX":false,"scrollY":false,"SecurityPolicyViolationEvent":false,"Selection":false,"self":false,"ServiceWorker":false,"ServiceWorkerContainer":false,"ServiceWorkerRegistration":false,"sessionStorage":false,"setInterval":false,"setTimeout":false,"ShadowRoot":false,"SharedWorker":false,"SourceBuffer":false,"SourceBufferList":false,"speechSynthesis":false,"SpeechSynthesisEvent":false,"SpeechSynthesisUtterance":false,"StaticRange":false,"status":false,"statusbar":false,"StereoPannerNode":false,"stop":false,"Storage":false,"StorageEvent":false,"StorageManager":false,"styleMedia":false,"StyleSheet":false,"StyleSheetList":false,"SubtleCrypto":false,"SVGAElement":false,"SVGAngle":false,"SVGAnimatedAngle":false,"SVGAnimatedBoolean":false,"SVGAnimatedEnumeration":false,"SVGAnimatedInteger":false,"SVGAnimatedLength":false,"SVGAnimatedLengthList":false,"SVGAnimatedNumber":false,"SVGAnimatedNumberList":false,"SVGAnimatedPreserveAspectRatio":false,"SVGAnimatedRect":false,"SVGAnimatedString":false,"SVGAnimatedTransformList":false,"SVGAnimateElement":false,"SVGAnimateMotionElement":false,"SVGAnimateTransformElement":false,"SVGAnimationElement":false,"SVGCircleElement":false,"SVGClipPathElement":false,"SVGComponentTransferFunctionElement":false,"SVGDefsElement":false,"SVGDescElement":false,"SVGDiscardElement":false,"SVGElement":false,"SVGEllipseElement":false,"SVGFEBlendElement":false,"SVGFEColorMatrixElement":false,"SVGFEComponentTransferElement":false,"SVGFECompositeElement":false,"SVGFEConvolveMatrixElement":false,"SVGFEDiffuseLightingElement":false,"SVGFEDisplacementMapElement":false,"SVGFEDistantLightElement":false,"SVGFEDropShadowElement":false,"SVGFEFloodElement":false,"SVGFEFuncAElement":false,"SVGFEFuncBElement":false,"SVGFEFuncGElement":false,"SVGFEFuncRElement":false,"SVGFEGaussianBlurElement":false,"SVGFEImageElement":false,"SVGFEMergeElement":false,"SVGFEMergeNodeElement":false,"SVGFEMorphologyElement":false,"SVGFEOffsetElement":false,"SVGFEPointLightElement":false,"SVGFESpecularLightingElement":false,"SVGFESpotLightElement":false,"SVGFETileElement":false,"SVGFETurbulenceElement":false,"SVGFilterElement":false,"SVGForeignObjectElement":false,"SVGGElement":false,"SVGGeometryElement":false,"SVGGradientElement":false,"SVGGraphicsElement":false,"SVGImageElement":false,"SVGLength":false,"SVGLengthList":false,"SVGLinearGradientElement":false,"SVGLineElement":false,"SVGMarkerElement":false,"SVGMaskElement":false,"SVGMatrix":false,"SVGMetadataElement":false,"SVGMPathElement":false,"SVGNumber":false,"SVGNumberList":false,"SVGPathElement":false,"SVGPatternElement":false,"SVGPoint":false,"SVGPointList":false,"SVGPolygonElement":false,"SVGPolylineElement":false,"SVGPreserveAspectRatio":false,"SVGRadialGradientElement":false,"SVGRect":false,"SVGRectElement":false,"SVGScriptElement":false,"SVGSetElement":false,"SVGStopElement":false,"SVGStringList":false,"SVGStyleElement":false,"SVGSVGElement":false,"SVGSwitchElement":false,"SVGSymbolElement":false,"SVGTextContentElement":false,"SVGTextElement":false,"SVGTextPathElement":false,"SVGTextPositioningElement":false,"SVGTitleElement":false,"SVGTransform":false,"SVGTransformList":false,"SVGTSpanElement":false,"SVGUnitTypes":false,"SVGUseElement":false,"SVGViewElement":false,"TaskAttributionTiming":false,"Text":false,"TextDecoder":false,"TextEncoder":false,"TextEvent":false,"TextMetrics":false,"TextTrack":false,"TextTrackCue":false,"TextTrackCueList":false,"TextTrackList":false,"TimeRanges":false,"toolbar":false,"top":false,"Touch":false,"TouchEvent":false,"TouchList":false,"TrackEvent":false,"TransitionEvent":false,"TreeWalker":false,"UIEvent":false,"URL":false,"URLSearchParams":false,"ValidityState":false,"visualViewport":false,"VisualViewport":false,"VTTCue":false,"WaveShaperNode":false,"WebAssembly":false,"WebGL2RenderingContext":false,"WebGLActiveInfo":false,"WebGLBuffer":false,"WebGLContextEvent":false,"WebGLFramebuffer":false,"WebGLProgram":false,"WebGLQuery":false,"WebGLRenderbuffer":false,"WebGLRenderingContext":false,"WebGLSampler":false,"WebGLShader":false,"WebGLShaderPrecisionFormat":false,"WebGLSync":false,"WebGLTexture":false,"WebGLTransformFeedback":false,"WebGLUniformLocation":false,"WebGLVertexArrayObject":false,"WebSocket":false,"WheelEvent":false,"window":false,"Window":false,"Worker":false,"WritableStream":false,"XMLDocument":false,"XMLHttpRequest":false,"XMLHttpRequestEventTarget":false,"XMLHttpRequestUpload":false,"XMLSerializer":false,"XPathEvaluator":false,"XPathExpression":false,"XPathResult":false,"XSLTProcessor":false},"worker":{"addEventListener":false,"applicationCache":false,"atob":false,"Blob":false,"BroadcastChannel":false,"btoa":false,"Cache":false,"caches":false,"clearInterval":false,"clearTimeout":false,"close":true,"console":false,"fetch":false,"FileReaderSync":false,"FormData":false,"Headers":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"ImageData":false,"importScripts":true,"indexedDB":false,"location":false,"MessageChannel":false,"MessagePort":false,"name":false,"navigator":false,"Notification":false,"onclose":true,"onconnect":true,"onerror":true,"onlanguagechange":true,"onmessage":true,"onoffline":true,"ononline":true,"onrejectionhandled":true,"onunhandledrejection":true,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"postMessage":true,"Promise":false,"queueMicrotask":false,"removeEventListener":false,"Request":false,"Response":false,"self":true,"ServiceWorkerRegistration":false,"setInterval":false,"setTimeout":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false,"WebSocket":false,"Worker":false,"WorkerGlobalScope":false,"XMLHttpRequest":false},"node":{"__dirname":false,"__filename":false,"Buffer":false,"clearImmediate":false,"clearInterval":false,"clearTimeout":false,"console":false,"exports":true,"global":false,"Intl":false,"module":false,"process":false,"queueMicrotask":false,"require":false,"setImmediate":false,"setInterval":false,"setTimeout":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false},"commonjs":{"exports":true,"global":false,"module":false,"require":false},"amd":{"define":false,"require":false},"mocha":{"after":false,"afterEach":false,"before":false,"beforeEach":false,"context":false,"describe":false,"it":false,"mocha":false,"run":false,"setup":false,"specify":false,"suite":false,"suiteSetup":false,"suiteTeardown":false,"teardown":false,"test":false,"xcontext":false,"xdescribe":false,"xit":false,"xspecify":false},"jasmine":{"afterAll":false,"afterEach":false,"beforeAll":false,"beforeEach":false,"describe":false,"expect":false,"fail":false,"fdescribe":false,"fit":false,"it":false,"jasmine":false,"pending":false,"runs":false,"spyOn":false,"spyOnProperty":false,"waits":false,"waitsFor":false,"xdescribe":false,"xit":false},"jest":{"afterAll":false,"afterEach":false,"beforeAll":false,"beforeEach":false,"describe":false,"expect":false,"fdescribe":false,"fit":false,"it":false,"jest":false,"pit":false,"require":false,"test":false,"xdescribe":false,"xit":false,"xtest":false},"qunit":{"asyncTest":false,"deepEqual":false,"equal":false,"expect":false,"module":false,"notDeepEqual":false,"notEqual":false,"notOk":false,"notPropEqual":false,"notStrictEqual":false,"ok":false,"propEqual":false,"QUnit":false,"raises":false,"start":false,"stop":false,"strictEqual":false,"test":false,"throws":false},"phantomjs":{"console":true,"exports":true,"phantom":true,"require":true,"WebPage":true},"couch":{"emit":false,"exports":false,"getRow":false,"log":false,"module":false,"provides":false,"require":false,"respond":false,"send":false,"start":false,"sum":false},"rhino":{"defineClass":false,"deserialize":false,"gc":false,"help":false,"importClass":false,"importPackage":false,"java":false,"load":false,"loadClass":false,"Packages":false,"print":false,"quit":false,"readFile":false,"readUrl":false,"runCommand":false,"seal":false,"serialize":false,"spawn":false,"sync":false,"toint32":false,"version":false},"nashorn":{"__DIR__":false,"__FILE__":false,"__LINE__":false,"com":false,"edu":false,"exit":false,"java":false,"Java":false,"javafx":false,"JavaImporter":false,"javax":false,"JSAdapter":false,"load":false,"loadWithNewGlobal":false,"org":false,"Packages":false,"print":false,"quit":false},"wsh":{"ActiveXObject":true,"Enumerator":true,"GetObject":true,"ScriptEngine":true,"ScriptEngineBuildVersion":true,"ScriptEngineMajorVersion":true,"ScriptEngineMinorVersion":true,"VBArray":true,"WScript":true,"WSH":true,"XDomainRequest":true},"jquery":{"$":false,"jQuery":false},"yui":{"YAHOO":false,"YAHOO_config":false,"YUI":false,"YUI_config":false},"shelljs":{"cat":false,"cd":false,"chmod":false,"config":false,"cp":false,"dirs":false,"echo":false,"env":false,"error":false,"exec":false,"exit":false,"find":false,"grep":false,"ln":false,"ls":false,"mkdir":false,"mv":false,"popd":false,"pushd":false,"pwd":false,"rm":false,"sed":false,"set":false,"target":false,"tempdir":false,"test":false,"touch":false,"which":false},"prototypejs":{"$":false,"$$":false,"$A":false,"$break":false,"$continue":false,"$F":false,"$H":false,"$R":false,"$w":false,"Abstract":false,"Ajax":false,"Autocompleter":false,"Builder":false,"Class":false,"Control":false,"Draggable":false,"Draggables":false,"Droppables":false,"Effect":false,"Element":false,"Enumerable":false,"Event":false,"Field":false,"Form":false,"Hash":false,"Insertion":false,"ObjectRange":false,"PeriodicalExecuter":false,"Position":false,"Prototype":false,"Scriptaculous":false,"Selector":false,"Sortable":false,"SortableObserver":false,"Sound":false,"Template":false,"Toggle":false,"Try":false},"meteor":{"_":false,"$":false,"Accounts":false,"AccountsClient":false,"AccountsCommon":false,"AccountsServer":false,"App":false,"Assets":false,"Blaze":false,"check":false,"Cordova":false,"DDP":false,"DDPRateLimiter":false,"DDPServer":false,"Deps":false,"EJSON":false,"Email":false,"HTTP":false,"Log":false,"Match":false,"Meteor":false,"Mongo":false,"MongoInternals":false,"Npm":false,"Package":false,"Plugin":false,"process":false,"Random":false,"ReactiveDict":false,"ReactiveVar":false,"Router":false,"ServiceConfiguration":false,"Session":false,"share":false,"Spacebars":false,"Template":false,"Tinytest":false,"Tracker":false,"UI":false,"Utils":false,"WebApp":false,"WebAppInternals":false},"mongo":{"_isWindows":false,"_rand":false,"BulkWriteResult":false,"cat":false,"cd":false,"connect":false,"db":false,"getHostName":false,"getMemInfo":false,"hostname":false,"ISODate":false,"listFiles":false,"load":false,"ls":false,"md5sumFile":false,"mkdir":false,"Mongo":false,"NumberInt":false,"NumberLong":false,"ObjectId":false,"PlanCache":false,"print":false,"printjson":false,"pwd":false,"quit":false,"removeFile":false,"rs":false,"sh":false,"UUID":false,"version":false,"WriteResult":false},"applescript":{"$":false,"Application":false,"Automation":false,"console":false,"delay":false,"Library":false,"ObjC":false,"ObjectSpecifier":false,"Path":false,"Progress":false,"Ref":false},"serviceworker":{"addEventListener":false,"applicationCache":false,"atob":false,"Blob":false,"BroadcastChannel":false,"btoa":false,"Cache":false,"caches":false,"CacheStorage":false,"clearInterval":false,"clearTimeout":false,"Client":false,"clients":false,"Clients":false,"close":true,"console":false,"ExtendableEvent":false,"ExtendableMessageEvent":false,"fetch":false,"FetchEvent":false,"FileReaderSync":false,"FormData":false,"Headers":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"ImageData":false,"importScripts":false,"indexedDB":false,"location":false,"MessageChannel":false,"MessagePort":false,"name":false,"navigator":false,"Notification":false,"onclose":true,"onconnect":true,"onerror":true,"onfetch":true,"oninstall":true,"onlanguagechange":true,"onmessage":true,"onmessageerror":true,"onnotificationclick":true,"onnotificationclose":true,"onoffline":true,"ononline":true,"onpush":true,"onpushsubscriptionchange":true,"onrejectionhandled":true,"onsync":true,"onunhandledrejection":true,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"postMessage":true,"Promise":false,"queueMicrotask":false,"registration":false,"removeEventListener":false,"Request":false,"Response":false,"self":false,"ServiceWorker":false,"ServiceWorkerContainer":false,"ServiceWorkerGlobalScope":false,"ServiceWorkerMessageEvent":false,"ServiceWorkerRegistration":false,"setInterval":false,"setTimeout":false,"skipWaiting":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false,"WebSocket":false,"WindowClient":false,"Worker":false,"WorkerGlobalScope":false,"XMLHttpRequest":false},"atomtest":{"advanceClock":false,"fakeClearInterval":false,"fakeClearTimeout":false,"fakeSetInterval":false,"fakeSetTimeout":false,"resetTimeouts":false,"waitsForPromise":false},"embertest":{"andThen":false,"click":false,"currentPath":false,"currentRouteName":false,"currentURL":false,"fillIn":false,"find":false,"findAll":false,"findWithAssert":false,"keyEvent":false,"pauseTest":false,"resumeTest":false,"triggerEvent":false,"visit":false,"wait":false},"protractor":{"$":false,"$$":false,"browser":false,"by":false,"By":false,"DartObject":false,"element":false,"protractor":false},"shared-node-browser":{"clearInterval":false,"clearTimeout":false,"console":false,"setInterval":false,"setTimeout":false,"URL":false,"URLSearchParams":false},"webextensions":{"browser":false,"chrome":false,"opr":false},"greasemonkey":{"cloneInto":false,"createObjectIn":false,"exportFunction":false,"GM":false,"GM_addStyle":false,"GM_deleteValue":false,"GM_getResourceText":false,"GM_getResourceURL":false,"GM_getValue":false,"GM_info":false,"GM_listValues":false,"GM_log":false,"GM_openInTab":false,"GM_registerMenuCommand":false,"GM_setClipboard":false,"GM_setValue":false,"GM_xmlhttpRequest":false,"unsafeWindow":false},"devtools":{"$":false,"$_":false,"$$":false,"$0":false,"$1":false,"$2":false,"$3":false,"$4":false,"$x":false,"chrome":false,"clear":false,"copy":false,"debug":false,"dir":false,"dirxml":false,"getEventListeners":false,"inspect":false,"keys":false,"monitor":false,"monitorEvents":false,"profile":false,"profileEnd":false,"queryObjects":false,"table":false,"undebug":false,"unmonitor":false,"unmonitorEvents":false,"values":false}}')},4651:e=>{"use strict";e.exports=JSON.parse('{"assert":true,"assert/strict":">= 15","async_hooks":">= 8","buffer_ieee754":"< 0.9.7","buffer":true,"child_process":true,"cluster":true,"console":true,"constants":true,"crypto":true,"_debug_agent":">= 1 && < 8","_debugger":"< 8","dgram":true,"diagnostics_channel":">= 15.1","dns":true,"dns/promises":">= 15","domain":">= 0.7.12","events":true,"freelist":"< 6","fs":true,"fs/promises":[">= 10 && < 10.1",">= 14"],"_http_agent":">= 0.11.1","_http_client":">= 0.11.1","_http_common":">= 0.11.1","_http_incoming":">= 0.11.1","_http_outgoing":">= 0.11.1","_http_server":">= 0.11.1","http":true,"http2":">= 8.8","https":true,"inspector":">= 8.0.0","_linklist":"< 8","module":true,"net":true,"node-inspect/lib/_inspect":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6.0 && < 12","os":true,"path":true,"path/posix":">= 15.3","path/win32":">= 15.3","perf_hooks":">= 8.5","process":">= 1","punycode":true,"querystring":true,"readline":true,"repl":true,"smalloc":">= 0.11.5 && < 3","_stream_duplex":">= 0.9.4","_stream_transform":">= 0.9.4","_stream_wrap":">= 1.4.1","_stream_passthrough":">= 0.9.4","_stream_readable":">= 0.9.4","_stream_writable":">= 0.9.4","stream":true,"stream/promises":">= 15","string_decoder":true,"sys":[">= 0.6 && < 0.7",">= 0.8"],"timers":true,"timers/promises":">= 15","_tls_common":">= 0.11.13","_tls_legacy":">= 0.11.3 && < 10","_tls_wrap":">= 0.11.3","tls":true,"trace_events":">= 10","tty":true,"url":true,"util":true,"util/types":">= 15.3","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/consarray":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/csvparser":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/logreader":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/profile_view":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/splaytree":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8":">= 1","vm":true,"wasi":">= 13.4 && < 13.5","worker_threads":">= 11.7","zlib":true}')},4817:e=>{"use strict";e.exports=JSON.parse('{"es6.array.copy-within":{"chrome":"45","opera":"32","edge":"12","firefox":"32","safari":"9","node":"4","ios":"9","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.every":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.fill":{"chrome":"45","opera":"32","edge":"12","firefox":"31","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.filter":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.find":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.find-index":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es7.array.flat-map":{"chrome":"69","opera":"56","edge":"79","firefox":"62","safari":"12","node":"11","ios":"12","samsung":"10","electron":"4.0"},"es6.array.for-each":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.from":{"chrome":"51","opera":"38","edge":"15","firefox":"36","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.array.includes":{"chrome":"47","opera":"34","edge":"14","firefox":"43","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.array.index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.is-array":{"chrome":"5","opera":"10.50","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.iterator":{"chrome":"66","opera":"53","edge":"12","firefox":"60","safari":"9","node":"10","ios":"9","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es6.array.last-index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.map":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.of":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"9","node":"4","ios":"9","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.reduce":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.reduce-right":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.slice":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.some":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.sort":{"chrome":"63","opera":"50","edge":"12","firefox":"5","safari":"12","node":"10","ie":"9","ios":"12","samsung":"8","rhino":"1.7.13","electron":"3.0"},"es6.array.species":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.date.now":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-iso-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-json":{"chrome":"5","opera":"12.10","edge":"12","firefox":"4","safari":"10","node":"0.10","ie":"9","android":"4","ios":"10","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-primitive":{"chrome":"47","opera":"34","edge":"15","firefox":"44","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.date.to-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.function.bind":{"chrome":"7","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.function.has-instance":{"chrome":"51","opera":"38","edge":"15","firefox":"50","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.function.name":{"chrome":"5","opera":"10.50","edge":"14","firefox":"2","safari":"4","node":"0.10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.math.acosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.asinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.atanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.cbrt":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.clz32":{"chrome":"38","opera":"25","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.cosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.expm1":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.fround":{"chrome":"38","opera":"25","edge":"12","firefox":"26","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.hypot":{"chrome":"38","opera":"25","edge":"12","firefox":"27","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.imul":{"chrome":"30","opera":"17","edge":"12","firefox":"23","safari":"7","node":"0.12","android":"4.4","ios":"7","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.math.log1p":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.log10":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.log2":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.sign":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.sinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.tanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.trunc":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.number.constructor":{"chrome":"41","opera":"28","edge":"12","firefox":"36","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.number.epsilon":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.is-finite":{"chrome":"19","opera":"15","edge":"12","firefox":"16","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.number.is-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"16","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.is-nan":{"chrome":"19","opera":"15","edge":"12","firefox":"15","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.number.is-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"32","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.max-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.min-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.parse-float":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.parse-int":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.object.assign":{"chrome":"49","opera":"36","edge":"13","firefox":"36","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.object.create":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.object.define-getter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.define-setter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.define-property":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.object.define-properties":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.object.entries":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.freeze":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.get-own-property-descriptor":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es7.object.get-own-property-descriptors":{"chrome":"54","opera":"41","edge":"15","firefox":"50","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.get-own-property-names":{"chrome":"40","opera":"27","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.object.get-prototype-of":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es7.object.lookup-getter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.lookup-setter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.prevent-extensions":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.to-string":{"chrome":"57","opera":"44","edge":"15","firefox":"51","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es6.object.is":{"chrome":"19","opera":"15","edge":"12","firefox":"22","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.object.is-frozen":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.is-sealed":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.is-extensible":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.keys":{"chrome":"40","opera":"27","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.object.seal":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.set-prototype-of":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ie":"11","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es7.object.values":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.promise":{"chrome":"51","opera":"38","edge":"14","firefox":"45","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.promise.finally":{"chrome":"63","opera":"50","edge":"18","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"8","electron":"3.0"},"es6.reflect.apply":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.construct":{"chrome":"49","opera":"36","edge":"13","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.define-property":{"chrome":"49","opera":"36","edge":"13","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.delete-property":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-own-property-descriptor":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.has":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.is-extensible":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.own-keys":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.prevent-extensions":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.regexp.constructor":{"chrome":"50","opera":"37","edge":"79","firefox":"40","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.flags":{"chrome":"49","opera":"36","edge":"79","firefox":"37","safari":"9","node":"6","ios":"9","samsung":"5","electron":"0.37"},"es6.regexp.match":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"1.1"},"es6.regexp.replace":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.split":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.search":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"1.1"},"es6.regexp.to-string":{"chrome":"50","opera":"37","edge":"79","firefox":"39","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.symbol":{"chrome":"51","opera":"38","edge":"79","firefox":"51","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.symbol.async-iterator":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"es6.string.anchor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.big":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.blink":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.bold":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.code-point-at":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.ends-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.fixed":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontcolor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontsize":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.from-code-point":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.includes":{"chrome":"41","opera":"28","edge":"12","firefox":"40","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.italics":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.iterator":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.string.link":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es7.string.pad-start":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","rhino":"1.7.13","electron":"1.7"},"es7.string.pad-end":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","rhino":"1.7.13","electron":"1.7"},"es6.string.raw":{"chrome":"41","opera":"28","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.repeat":{"chrome":"41","opera":"28","edge":"12","firefox":"24","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.small":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.starts-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.strike":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sub":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sup":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.trim":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.string.trim-left":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es7.string.trim-right":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es6.typed.array-buffer":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.data-view":{"chrome":"5","opera":"12","edge":"12","firefox":"15","safari":"5.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.typed.int8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-clamped-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float64-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.weak-map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"},"es6.weak-set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"}}')},8392:e=>{"use strict";e.exports=JSON.parse('{"es6.module":{"chrome":"61","and_chr":"61","edge":"16","firefox":"60","and_ff":"60","node":"13.2.0","opera":"48","op_mob":"48","safari":"10.1","ios":"10.3","samsung":"8.2","android":"61","electron":"2.0","ios_saf":"10.3"}}')},5224:e=>{"use strict";e.exports=JSON.parse('{"transform-async-to-generator":["bugfix/transform-async-arrows-in-class"],"transform-parameters":["bugfix/transform-edge-default-parameters"],"transform-function-name":["bugfix/transform-edge-function-name"],"transform-block-scoping":["bugfix/transform-safari-block-shadowing","bugfix/transform-safari-for-shadowing"],"transform-template-literals":["bugfix/transform-tagged-template-caching"],"proposal-optional-chaining":["bugfix/transform-v8-spread-parameters-in-optional-chaining"]}')},4374:e=>{"use strict";e.exports=JSON.parse('{"transform-async-to-generator":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"10.1","node":"7.6","ios":"10.3","samsung":"6","electron":"1.6"},"bugfix/transform-async-arrows-in-class":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"11","node":"7.6","ios":"11","samsung":"6","electron":"1.6"},"transform-parameters":{"chrome":"49","opera":"36","edge":"15","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"bugfix/transform-edge-default-parameters":{"chrome":"49","opera":"36","edge":"18","firefox":"52","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"transform-function-name":{"chrome":"51","opera":"38","edge":"14","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"bugfix/transform-edge-function-name":{"chrome":"51","opera":"38","edge":"79","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-block-scoping":{"chrome":"49","opera":"36","edge":"14","firefox":"51","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"bugfix/transform-safari-block-shadowing":{"chrome":"49","opera":"36","edge":"12","firefox":"44","safari":"11","node":"6","ie":"11","ios":"11","samsung":"5","electron":"0.37"},"bugfix/transform-safari-for-shadowing":{"chrome":"49","opera":"36","edge":"12","firefox":"4","safari":"11","node":"6","ie":"11","ios":"11","samsung":"5","rhino":"1.7.13","electron":"0.37"},"transform-template-literals":{"chrome":"41","opera":"28","edge":"13","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"bugfix/transform-tagged-template-caching":{"chrome":"41","opera":"28","edge":"12","firefox":"34","safari":"13","node":"4","ios":"13","samsung":"3.4","electron":"0.21"},"proposal-optional-chaining":{"chrome":"80","opera":"67","edge":"80","firefox":"74","safari":"13.1","node":"14","ios":"13.4","samsung":"13","electron":"8.0"},"bugfix/transform-v8-spread-parameters-in-optional-chaining":{"firefox":"74","safari":"13.1","ios":"13.4"}}')},7867:e=>{"use strict";e.exports=JSON.parse('{"proposal-class-static-block":{"chrome":"91","electron":"13.0"},"proposal-private-property-in-object":{"chrome":"91","firefox":"90","electron":"13.0"},"proposal-class-properties":{"chrome":"74","opera":"62","edge":"79","firefox":"90","safari":"14.1","node":"12","samsung":"11","electron":"6.0"},"proposal-private-methods":{"chrome":"84","opera":"70","edge":"84","firefox":"90","safari":"15","node":"14.6","electron":"10.0"},"proposal-numeric-separator":{"chrome":"75","opera":"62","edge":"79","firefox":"70","safari":"13","node":"12.5","ios":"13","samsung":"11","electron":"6.0"},"proposal-logical-assignment-operators":{"chrome":"85","opera":"71","edge":"85","firefox":"79","safari":"14","node":"15","ios":"14","electron":"10.0"},"proposal-nullish-coalescing-operator":{"chrome":"80","opera":"67","edge":"80","firefox":"72","safari":"13.1","node":"14","ios":"13.4","samsung":"13","electron":"8.0"},"proposal-optional-chaining":{"firefox":"74","safari":"13.1","ios":"13.4"},"proposal-json-strings":{"chrome":"66","opera":"53","edge":"79","firefox":"62","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"proposal-optional-catch-binding":{"chrome":"66","opera":"53","edge":"79","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-parameters":{"chrome":"49","opera":"36","edge":"18","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"proposal-async-generator-functions":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"proposal-object-rest-spread":{"chrome":"60","opera":"47","edge":"79","firefox":"55","safari":"11.1","node":"8.3","ios":"11.3","samsung":"8","electron":"2.0"},"transform-dotall-regex":{"chrome":"62","opera":"49","edge":"79","firefox":"78","safari":"11.1","node":"8.10","ios":"11.3","samsung":"8","electron":"3.0"},"proposal-unicode-property-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-named-capturing-groups-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-async-to-generator":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"11","node":"7.6","ios":"11","samsung":"6","electron":"1.6"},"transform-exponentiation-operator":{"chrome":"52","opera":"39","edge":"14","firefox":"52","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.3"},"transform-template-literals":{"chrome":"41","opera":"28","edge":"13","firefox":"34","safari":"13","node":"4","ios":"13","samsung":"3.4","electron":"0.21"},"transform-literals":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-function-name":{"chrome":"51","opera":"38","edge":"79","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-arrow-functions":{"chrome":"47","opera":"34","edge":"13","firefox":"43","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"0.36"},"transform-block-scoped-functions":{"chrome":"41","opera":"28","edge":"12","firefox":"46","safari":"10","node":"4","ie":"11","ios":"10","samsung":"3.4","electron":"0.21"},"transform-classes":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-object-super":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-shorthand-properties":{"chrome":"43","opera":"30","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.27"},"transform-duplicate-keys":{"chrome":"42","opera":"29","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.25"},"transform-computed-properties":{"chrome":"44","opera":"31","edge":"12","firefox":"34","safari":"7.1","node":"4","ios":"8","samsung":"4","electron":"0.30"},"transform-for-of":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-sticky-regex":{"chrome":"49","opera":"36","edge":"13","firefox":"3","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"transform-unicode-escapes":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-unicode-regex":{"chrome":"50","opera":"37","edge":"13","firefox":"46","safari":"12","node":"6","ios":"12","samsung":"5","electron":"1.1"},"transform-spread":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-destructuring":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-block-scoping":{"chrome":"49","opera":"36","edge":"14","firefox":"51","safari":"11","node":"6","ios":"11","samsung":"5","electron":"0.37"},"transform-typeof-symbol":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"transform-new-target":{"chrome":"46","opera":"33","edge":"14","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-regenerator":{"chrome":"50","opera":"37","edge":"13","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"transform-member-expression-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"transform-property-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"transform-reserved-words":{"chrome":"13","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4.4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"proposal-export-namespace-from":{"chrome":"72","and_chr":"72","edge":"79","firefox":"80","and_ff":"80","node":"13.2","opera":"60","op_mob":"51","samsung":"11.0","android":"72","electron":"5.0"}}')},516:e=>{"use strict";e.exports=JSON.parse('{"es6.array.copy-within":{"chrome":"45","opera":"32","edge":"12","firefox":"32","safari":"9","node":"4","ios":"9","samsung":"5","electron":"0.31"},"es6.array.every":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.fill":{"chrome":"45","opera":"32","edge":"12","firefox":"31","safari":"7.1","node":"4","ios":"8","samsung":"5","electron":"0.31"},"es6.array.filter":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.find":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","electron":"0.31"},"es6.array.find-index":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","electron":"0.31"},"es7.array.flat-map":{"chrome":"69","opera":"56","edge":"79","firefox":"62","safari":"12","node":"11","ios":"12","samsung":"10","electron":"4.0"},"es6.array.for-each":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.from":{"chrome":"51","opera":"38","edge":"15","firefox":"36","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.array.includes":{"chrome":"47","opera":"34","edge":"14","firefox":"43","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.array.index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.is-array":{"chrome":"5","opera":"10.50","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.iterator":{"chrome":"66","opera":"53","edge":"12","firefox":"60","safari":"9","node":"10","ios":"9","samsung":"9","electron":"3.0"},"es6.array.last-index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.map":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.of":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"9","node":"4","ios":"9","samsung":"5","electron":"0.31"},"es6.array.reduce":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.reduce-right":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.slice":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.some":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.sort":{"chrome":"63","opera":"50","edge":"12","firefox":"5","safari":"12","node":"10","ie":"9","ios":"12","samsung":"8","electron":"3.0"},"es6.array.species":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.date.now":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.date.to-iso-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.date.to-json":{"chrome":"5","opera":"12.10","edge":"12","firefox":"4","safari":"10","node":"0.10","ie":"9","android":"4","ios":"10","samsung":"1","electron":"0.20"},"es6.date.to-primitive":{"chrome":"47","opera":"34","edge":"15","firefox":"44","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.date.to-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.function.bind":{"chrome":"7","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.function.has-instance":{"chrome":"51","opera":"38","edge":"15","firefox":"50","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.function.name":{"chrome":"5","opera":"10.50","edge":"14","firefox":"2","safari":"4","node":"0.10","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.math.acosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.asinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.atanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.cbrt":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.clz32":{"chrome":"38","opera":"25","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"es6.math.cosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.expm1":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.fround":{"chrome":"38","opera":"25","edge":"12","firefox":"26","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.hypot":{"chrome":"38","opera":"25","edge":"12","firefox":"27","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.imul":{"chrome":"30","opera":"17","edge":"12","firefox":"23","safari":"7","node":"0.12","android":"4.4","ios":"7","samsung":"2","electron":"0.20"},"es6.math.log1p":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.log10":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.log2":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.sign":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"es6.math.sinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.tanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.trunc":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.number.constructor":{"chrome":"41","opera":"28","edge":"12","firefox":"36","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.number.epsilon":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.is-finite":{"chrome":"19","opera":"15","edge":"12","firefox":"16","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","electron":"0.20"},"es6.number.is-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"16","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.is-nan":{"chrome":"19","opera":"15","edge":"12","firefox":"15","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","electron":"0.20"},"es6.number.is-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"32","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.max-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.min-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.parse-float":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.parse-int":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.object.assign":{"chrome":"49","opera":"36","edge":"13","firefox":"36","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.object.create":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es7.object.define-getter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.define-setter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.define-property":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.object.define-properties":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es7.object.entries":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.freeze":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.get-own-property-descriptor":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es7.object.get-own-property-descriptors":{"chrome":"54","opera":"41","edge":"15","firefox":"50","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.get-own-property-names":{"chrome":"40","opera":"27","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.object.get-prototype-of":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es7.object.lookup-getter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.lookup-setter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.prevent-extensions":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.to-string":{"chrome":"57","opera":"44","edge":"15","firefox":"51","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es6.object.is":{"chrome":"19","opera":"15","edge":"12","firefox":"22","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","electron":"0.20"},"es6.object.is-frozen":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.is-sealed":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.is-extensible":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.keys":{"chrome":"40","opera":"27","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.object.seal":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.set-prototype-of":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ie":"11","ios":"9","samsung":"2","electron":"0.20"},"es7.object.values":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.promise":{"chrome":"51","opera":"38","edge":"14","firefox":"45","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.promise.finally":{"chrome":"63","opera":"50","edge":"18","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"8","electron":"3.0"},"es6.reflect.apply":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.construct":{"chrome":"49","opera":"36","edge":"13","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.define-property":{"chrome":"49","opera":"36","edge":"13","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.delete-property":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-own-property-descriptor":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.has":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.is-extensible":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.own-keys":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.prevent-extensions":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.regexp.constructor":{"chrome":"50","opera":"37","edge":"79","firefox":"40","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.flags":{"chrome":"49","opera":"36","edge":"79","firefox":"37","safari":"9","node":"6","ios":"9","samsung":"5","electron":"0.37"},"es6.regexp.match":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.replace":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.split":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.search":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.to-string":{"chrome":"50","opera":"37","edge":"79","firefox":"39","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.symbol":{"chrome":"51","opera":"38","edge":"79","firefox":"51","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.symbol.async-iterator":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"es6.string.anchor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.big":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.blink":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.bold":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.code-point-at":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.ends-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.fixed":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontcolor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontsize":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.from-code-point":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.includes":{"chrome":"41","opera":"28","edge":"12","firefox":"40","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.italics":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.iterator":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"es6.string.link":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es7.string.pad-start":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es7.string.pad-end":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es6.string.raw":{"chrome":"41","opera":"28","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.repeat":{"chrome":"41","opera":"28","edge":"12","firefox":"24","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.small":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.starts-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.strike":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sub":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sup":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.trim":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es7.string.trim-left":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"es7.string.trim-right":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"es6.typed.array-buffer":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.data-view":{"chrome":"5","opera":"12","edge":"12","firefox":"15","safari":"5.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.typed.int8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-clamped-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float64-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.weak-map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"},"es6.weak-set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"}}')},5246:e=>{"use strict";e.exports=JSON.parse('{"es6.module":{"chrome":"61","and_chr":"61","edge":"16","firefox":"60","and_ff":"60","node":"13.2.0","opera":"48","op_mob":"48","safari":"10.1","ios":"10.3","samsung":"8.2","android":"61","electron":"2.0","ios_saf":"10.3"}}')},4812:e=>{"use strict";e.exports=JSON.parse('{"proposal-class-static-block":{"chrome":"91","electron":"13.0"},"proposal-private-property-in-object":{"chrome":"91","firefox":"90","electron":"13.0"},"proposal-class-properties":{"chrome":"74","opera":"62","edge":"79","firefox":"90","safari":"14.1","node":"12","samsung":"11","electron":"6.0"},"proposal-private-methods":{"chrome":"84","opera":"70","edge":"84","firefox":"90","safari":"15","node":"14.6","electron":"10.0"},"proposal-numeric-separator":{"chrome":"75","opera":"62","edge":"79","firefox":"70","safari":"13","node":"12.5","ios":"13","samsung":"11","electron":"6.0"},"proposal-logical-assignment-operators":{"chrome":"85","opera":"71","edge":"85","firefox":"79","safari":"14","node":"15","ios":"14","electron":"10.0"},"proposal-nullish-coalescing-operator":{"chrome":"80","opera":"67","edge":"80","firefox":"72","safari":"13.1","node":"14","ios":"13.4","samsung":"13","electron":"8.0"},"proposal-optional-chaining":{"firefox":"74","safari":"13.1","ios":"13.4"},"proposal-json-strings":{"chrome":"66","opera":"53","edge":"79","firefox":"62","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"proposal-optional-catch-binding":{"chrome":"66","opera":"53","edge":"79","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-parameters":{"chrome":"49","opera":"36","edge":"18","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"proposal-async-generator-functions":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"proposal-object-rest-spread":{"chrome":"60","opera":"47","edge":"79","firefox":"55","safari":"11.1","node":"8.3","ios":"11.3","samsung":"8","electron":"2.0"},"transform-dotall-regex":{"chrome":"62","opera":"49","edge":"79","firefox":"78","safari":"11.1","node":"8.10","ios":"11.3","samsung":"8","electron":"3.0"},"proposal-unicode-property-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-named-capturing-groups-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-async-to-generator":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"11","node":"7.6","ios":"11","samsung":"6","electron":"1.6"},"transform-exponentiation-operator":{"chrome":"52","opera":"39","edge":"14","firefox":"52","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.3"},"transform-template-literals":{"chrome":"41","opera":"28","edge":"13","firefox":"34","safari":"13","node":"4","ios":"13","samsung":"3.4","electron":"0.21"},"transform-literals":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-function-name":{"chrome":"51","opera":"38","edge":"79","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-arrow-functions":{"chrome":"47","opera":"34","edge":"13","firefox":"45","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"transform-block-scoped-functions":{"chrome":"41","opera":"28","edge":"12","firefox":"46","safari":"10","node":"4","ie":"11","ios":"10","samsung":"3.4","electron":"0.21"},"transform-classes":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-object-super":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-shorthand-properties":{"chrome":"43","opera":"30","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.27"},"transform-duplicate-keys":{"chrome":"42","opera":"29","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.25"},"transform-computed-properties":{"chrome":"44","opera":"31","edge":"12","firefox":"34","safari":"7.1","node":"4","ios":"8","samsung":"4","electron":"0.30"},"transform-for-of":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-sticky-regex":{"chrome":"49","opera":"36","edge":"13","firefox":"3","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"transform-unicode-escapes":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-unicode-regex":{"chrome":"50","opera":"37","edge":"13","firefox":"46","safari":"12","node":"6","ios":"12","samsung":"5","electron":"1.1"},"transform-spread":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-destructuring":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-block-scoping":{"chrome":"49","opera":"36","edge":"14","firefox":"51","safari":"11","node":"6","ios":"11","samsung":"5","electron":"0.37"},"transform-typeof-symbol":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"transform-new-target":{"chrome":"46","opera":"33","edge":"14","firefox":"41","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-regenerator":{"chrome":"50","opera":"37","edge":"13","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"transform-member-expression-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"transform-property-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"transform-reserved-words":{"chrome":"13","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4.4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"proposal-export-namespace-from":{"chrome":"72","and_chr":"72","edge":"79","firefox":"80","and_ff":"80","node":"13.2","opera":"60","op_mob":"51","samsung":"11.0","android":"72","electron":"5.0"}}')},935:e=>{"use strict";e.exports=JSON.parse('{"es.symbol":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.symbol.description":{"android":"70","chrome":"70","edge":"74","electron":"5.0","firefox":"63","ios":"12.2","node":"11.0","opera":"57","opera_mobile":"49","safari":"12.1","samsung":"10.0"},"es.symbol.async-iterator":{"android":"63","chrome":"63","edge":"74","electron":"3.0","firefox":"55","ios":"12.0","node":"10.0","opera":"50","opera_mobile":"46","safari":"12.0","samsung":"8.0"},"es.symbol.has-instance":{"android":"50","chrome":"50","edge":"15","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.is-concat-spreadable":{"android":"48","chrome":"48","edge":"15","electron":"0.37","firefox":"48","ios":"10.0","node":"6.0","opera":"35","opera_mobile":"35","safari":"10.0","samsung":"5.0"},"es.symbol.iterator":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"36","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.symbol.match":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"40","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.match-all":{"android":"73","chrome":"73","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.symbol.replace":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.search":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.species":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"41","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.symbol.split":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.to-primitive":{"android":"47","chrome":"47","edge":"15","electron":"0.36","firefox":"44","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.symbol.to-string-tag":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.symbol.unscopables":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"48","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.aggregate-error":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"es.array.concat":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.copy-within":{"android":"45","chrome":"45","edge":"12","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.every":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"9.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"8.0","samsung":"1.5"},"es.array.fill":{"android":"45","chrome":"45","edge":"12","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.filter":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.find":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.find-index":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.flat":{"android":"69","chrome":"69","edge":"74","electron":"4.0","firefox":"62","ios":"12.0","node":"11.0","opera":"56","opera_mobile":"48","safari":"12.0","samsung":"10.0"},"es.array.flat-map":{"android":"69","chrome":"69","edge":"74","electron":"4.0","firefox":"62","ios":"12.0","node":"11.0","opera":"56","opera_mobile":"48","safari":"12.0","samsung":"10.0"},"es.array.for-each":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"9.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"8.0","samsung":"1.5"},"es.array.from":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"9.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"9.0","samsung":"5.0"},"es.array.includes":{"android":"53","chrome":"53","edge":"14","electron":"1.4","firefox":"48","ios":"10.0","node":"7.0","opera":"40","opera_mobile":"40","safari":"10.0","samsung":"6.0"},"es.array.index-of":{"android":"51","chrome":"51","edge":"12","electron":"1.2","firefox":"4","ie":"9","ios":"9.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"8.0","samsung":"5.0"},"es.array.is-array":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"4.0","samsung":"1.0"},"es.array.iterator":{"android":"66","chrome":"66","edge":"15","electron":"3.0","firefox":"60","ios":"10.0","node":"10.0","opera":"53","opera_mobile":"47","safari":"10.0","samsung":"9.0"},"es.array.join":{"android":"4.4","chrome":"26","edge":"13","electron":"0.20","firefox":"4","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.array.last-index-of":{"android":"51","chrome":"51","edge":"12","electron":"1.2","firefox":"4","ie":"9","ios":"9.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"8.0","samsung":"5.0"},"es.array.map":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"50","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.of":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"25","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.reduce":{"android":"83","chrome":"83","edge":"12","electron":"9.0","firefox":"4","ie":"9","ios":"9.0","node":"6.0","opera":"69","opera_mobile":"59","safari":"8.0","samsung":"13.0"},"es.array.reduce-right":{"android":"83","chrome":"83","edge":"12","electron":"9.0","firefox":"4","ie":"9","ios":"9.0","node":"6.0","opera":"69","opera_mobile":"59","safari":"8.0","samsung":"13.0"},"es.array.reverse":{"android":"3.0","chrome":"1","edge":"12","electron":"0.20","firefox":"1","ie":"5.5","ios":"12.2","node":"0.0.3","opera":"10.50","opera_mobile":"10.50","safari":"12.0.2","samsung":"1.0"},"es.array.slice":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.some":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"9.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"8.0","samsung":"1.5"},"es.array.sort":{"android":"70","chrome":"70","edge":"74","electron":"5.0","firefox":"4","ios":"12.0","node":"11.0","opera":"57","opera_mobile":"49","safari":"12.0","samsung":"10.0"},"es.array.species":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.splice":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.unscopables.flat":{"android":"73","chrome":"73","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.array.unscopables.flat-map":{"android":"73","chrome":"73","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.array-buffer.constructor":{"android":"4.4","chrome":"26","edge":"14","electron":"0.20","firefox":"44","ios":"12.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"12.0","samsung":"1.5"},"es.array-buffer.is-view":{"android":"4.4.3","chrome":"32","edge":"12","electron":"0.20","firefox":"29","ie":"11","ios":"8.0","node":"0.11.9","opera":"19","opera_mobile":"19","safari":"7.1","samsung":"2.0"},"es.array-buffer.slice":{"android":"4.4.3","chrome":"31","edge":"12","electron":"0.20","firefox":"46","ie":"11","ios":"12.2","node":"0.11.8","opera":"18","opera_mobile":"18","safari":"12.1","samsung":"2.0"},"es.data-view":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"15","ie":"10","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.date.now":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ie":"9","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"4.0","samsung":"1.0"},"es.date.to-iso-string":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"7","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.date.to-json":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"10.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"10.0","samsung":"1.5"},"es.date.to-primitive":{"android":"47","chrome":"47","edge":"15","electron":"0.36","firefox":"44","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.date.to-string":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ie":"9","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.function.bind":{"android":"3.0","chrome":"7","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.101","opera":"12","opera_mobile":"12","phantom":"2.0","safari":"5.1","samsung":"1.0"},"es.function.has-instance":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"50","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.function.name":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"4.0","samsung":"1.0"},"es.global-this":{"android":"71","chrome":"71","edge":"74","electron":"5.0","firefox":"65","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"es.json.stringify":{"android":"72","chrome":"72","edge":"74","electron":"5.0","firefox":"64","ios":"12.2","node":"12.0","opera":"59","opera_mobile":"51","safari":"12.1","samsung":"11.0"},"es.json.to-string-tag":{"android":"50","chrome":"50","edge":"15","electron":"1.1","firefox":"51","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.map":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.math.acosh":{"android":"54","chrome":"54","edge":"13","electron":"1.4","firefox":"25","ios":"8.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"7.1","samsung":"6.0"},"es.math.asinh":{"android":"38","chrome":"38","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.atanh":{"android":"38","chrome":"38","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.cbrt":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.clz32":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"9.0","samsung":"3.0"},"es.math.cosh":{"android":"39","chrome":"39","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","safari":"7.1","samsung":"3.4"},"es.math.expm1":{"android":"39","chrome":"39","edge":"13","electron":"0.20","firefox":"46","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","safari":"7.1","samsung":"3.4"},"es.math.fround":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"26","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.hypot":{"android":"78","chrome":"78","edge":"12","electron":"7.0","firefox":"27","ios":"8.0","node":"13.0","opera":"65","opera_mobile":"56","safari":"7.1","samsung":"12.0"},"es.math.imul":{"android":"4.4","chrome":"28","edge":"13","electron":"0.20","firefox":"20","ios":"9.0","node":"0.11.1","opera":"16","opera_mobile":"16","safari":"9.0","samsung":"1.5"},"es.math.log10":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.log1p":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.log2":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.sign":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"9.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"9.0","samsung":"3.0"},"es.math.sinh":{"android":"39","chrome":"39","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","safari":"7.1","samsung":"3.4"},"es.math.tanh":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.to-string-tag":{"android":"50","chrome":"50","edge":"15","electron":"1.1","firefox":"51","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.math.trunc":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.number.constructor":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"46","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.number.epsilon":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"25","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.is-finite":{"android":"4.1","chrome":"19","edge":"12","electron":"0.20","firefox":"16","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","safari":"9.0","samsung":"1.5"},"es.number.is-integer":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"16","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.is-nan":{"android":"4.1","chrome":"19","edge":"12","electron":"0.20","firefox":"15","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","safari":"9.0","samsung":"1.5"},"es.number.is-safe-integer":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"32","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.max-safe-integer":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.min-safe-integer":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.parse-float":{"android":"37","chrome":"35","edge":"13","electron":"0.20","firefox":"39","ios":"11.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"11.0","samsung":"3.0"},"es.number.parse-int":{"android":"37","chrome":"35","edge":"13","electron":"0.20","firefox":"39","ios":"9.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"9.0","samsung":"3.0"},"es.number.to-fixed":{"android":"4.4","chrome":"26","edge":"74","electron":"0.20","firefox":"4","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.number.to-precision":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"8","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.object.assign":{"android":"49","chrome":"49","edge":"74","electron":"0.37","firefox":"36","ios":"9.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"9.0","samsung":"5.0"},"es.object.create":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"3.2","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"1.9","safari":"4.0","samsung":"1.0"},"es.object.define-getter":{"android":"62","chrome":"62","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","safari":"7.1","samsung":"8.0"},"es.object.define-properties":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"2.0","safari":"5.1","samsung":"1.0"},"es.object.define-property":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"2.0","safari":"5.1","samsung":"1.0"},"es.object.define-setter":{"android":"62","chrome":"62","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","safari":"7.1","samsung":"8.0"},"es.object.entries":{"android":"54","chrome":"54","edge":"14","electron":"1.4","firefox":"47","ios":"10.3","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.1","samsung":"6.0"},"es.object.freeze":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.from-entries":{"android":"73","chrome":"73","edge":"74","electron":"5.0","firefox":"63","ios":"12.2","node":"12.0","opera":"60","opera_mobile":"52","safari":"12.1","samsung":"11.0"},"es.object.get-own-property-descriptor":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.get-own-property-descriptors":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"50","ios":"10.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.0","samsung":"6.0"},"es.object.get-own-property-names":{"android":"40","chrome":"40","edge":"13","electron":"0.21","firefox":"34","ios":"9.0","node":"1.0","opera":"27","opera_mobile":"27","safari":"9.0","samsung":"3.4"},"es.object.get-prototype-of":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.is":{"android":"4.1","chrome":"19","edge":"12","electron":"0.20","firefox":"22","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","safari":"9.0","samsung":"1.5"},"es.object.is-extensible":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.is-frozen":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.is-sealed":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.keys":{"android":"40","chrome":"40","edge":"13","electron":"0.21","firefox":"35","ios":"9.0","node":"1.0","opera":"27","opera_mobile":"27","safari":"9.0","samsung":"3.4"},"es.object.lookup-getter":{"android":"62","chrome":"62","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","safari":"7.1","samsung":"8.0"},"es.object.lookup-setter":{"android":"62","chrome":"62","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","safari":"7.1","samsung":"8.0"},"es.object.prevent-extensions":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.seal":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.set-prototype-of":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"31","ie":"11","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.object.to-string":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.object.values":{"android":"54","chrome":"54","edge":"14","electron":"1.4","firefox":"47","ios":"10.3","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.1","samsung":"6.0"},"es.parse-float":{"android":"37","chrome":"35","edge":"12","electron":"0.20","firefox":"8","ie":"8","ios":"8.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"7.1","samsung":"3.0"},"es.parse-int":{"android":"37","chrome":"35","edge":"12","electron":"0.20","firefox":"21","ie":"9","ios":"8.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"7.1","samsung":"3.0"},"es.promise":{"android":"67","chrome":"67","edge":"74","electron":"4.0","firefox":"69","ios":"11.0","node":"10.4","opera":"54","opera_mobile":"48","safari":"11.0","samsung":"9.0"},"es.promise.all-settled":{"android":"76","chrome":"76","edge":"76","electron":"6.0","firefox":"71","ios":"13.0","node":"12.9","opera":"63","opera_mobile":"54","safari":"13","samsung":"12.0"},"es.promise.any":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"es.promise.finally":{"android":"67","chrome":"67","edge":"74","electron":"4.0","firefox":"69","ios":"13.2.3","node":"10.4","opera":"54","opera_mobile":"48","safari":"13.0.3","samsung":"9.0"},"es.reflect.apply":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.construct":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"44","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.define-property":{"android":"49","chrome":"49","edge":"13","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.delete-property":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get-own-property-descriptor":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get-prototype-of":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.has":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.is-extensible":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.own-keys":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.prevent-extensions":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.set":{"android":"49","chrome":"49","edge":"74","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.set-prototype-of":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.to-string-tag":{"android":"86","chrome":"86","edge":"86","electron":"11.0","firefox":"82","ios":"14.0","node":"15.0","opera":"72","opera_mobile":"61","safari":"14.0","samsung":"14.0"},"es.regexp.constructor":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.regexp.exec":{"android":"4.4","chrome":"26","edge":"13","electron":"0.20","firefox":"44","ios":"10.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"10.0","samsung":"1.5"},"es.regexp.flags":{"android":"49","chrome":"49","edge":"74","electron":"0.37","firefox":"37","ios":"9.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"9.0","samsung":"5.0"},"es.regexp.sticky":{"android":"49","chrome":"49","edge":"13","electron":"0.37","firefox":"3","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.regexp.test":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"46","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.regexp.to-string":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"46","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.set":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.code-point-at":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"29","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.ends-with":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.from-code-point":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"29","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.includes":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.iterator":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"36","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.match":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.match-all":{"android":"80","chrome":"80","edge":"80","electron":"8.0","firefox":"73","ios":"13.4","node":"14.0","opera":"67","opera_mobile":"57","safari":"13.1","samsung":"13.0"},"es.string.pad-end":{"android":"57","chrome":"57","edge":"15","electron":"1.7","firefox":"48","ios":"11.0","node":"8.0","opera":"44","opera_mobile":"43","safari":"11.0","samsung":"7.0"},"es.string.pad-start":{"android":"57","chrome":"57","edge":"15","electron":"1.7","firefox":"48","ios":"11.0","node":"8.0","opera":"44","opera_mobile":"43","safari":"11.0","samsung":"7.0"},"es.string.raw":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"34","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.repeat":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"24","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.replace":{"android":"64","chrome":"64","edge":"74","electron":"3.0","firefox":"78","ios":"14.0","node":"10.0","opera":"51","opera_mobile":"47","safari":"14.0","samsung":"9.0"},"es.string.replace-all":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"77","ios":"13.4","node":"15.0","opera":"71","opera_mobile":"60","safari":"13.1","samsung":"14.0"},"es.string.search":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.split":{"android":"54","chrome":"54","edge":"74","electron":"1.4","firefox":"49","ios":"10.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.0","samsung":"6.0"},"es.string.starts-with":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.trim":{"android":"59","chrome":"59","edge":"15","electron":"1.8","firefox":"52","ios":"12.2","node":"8.3","opera":"46","opera_mobile":"43","safari":"12.1","samsung":"7.0"},"es.string.trim-end":{"android":"66","chrome":"66","edge":"74","electron":"3.0","firefox":"61","ios":"12.2","node":"10.0","opera":"53","opera_mobile":"47","safari":"12.1","samsung":"9.0"},"es.string.trim-start":{"android":"66","chrome":"66","edge":"74","electron":"3.0","firefox":"61","ios":"12.0","node":"10.0","opera":"53","opera_mobile":"47","safari":"12.0","samsung":"9.0"},"es.string.anchor":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.big":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.blink":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.bold":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.fixed":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.fontcolor":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.fontsize":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.italics":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.link":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.small":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.strike":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.sub":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.sup":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.typed-array.float32-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.float64-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int8-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int16-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int32-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint8-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint8-clamped-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint16-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint32-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.copy-within":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"34","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.every":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.fill":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.filter":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.find":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.find-index":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.for-each":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.from":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.includes":{"android":"49","chrome":"49","edge":"14","electron":"0.37","firefox":"43","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.typed-array.index-of":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.iterator":{"android":"47","chrome":"47","edge":"13","electron":"0.36","firefox":"37","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.typed-array.join":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.last-index-of":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.map":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.of":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.reduce":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.reduce-right":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.reverse":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.set":{"android":"4.4","chrome":"26","edge":"13","electron":"0.20","firefox":"15","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.typed-array.slice":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.some":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.sort":{"android":"74","chrome":"74","edge":"74","electron":"6.0","firefox":"67","ios":"14.5","node":"12.0","opera":"61","opera_mobile":"53","safari":"14.1","samsung":"11.0"},"es.typed-array.subarray":{"android":"4.4","chrome":"26","edge":"13","electron":"0.20","firefox":"15","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.typed-array.to-locale-string":{"android":"45","chrome":"45","edge":"74","electron":"0.31","firefox":"51","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.to-string":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"51","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.weak-map":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.weak-set":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"esnext.aggregate-error":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"esnext.array.at":{"android":"92","chrome":"92","edge":"92","electron":"14.0","opera":"78"},"esnext.array.filter-out":{},"esnext.array.find-last":{},"esnext.array.find-last-index":{},"esnext.array.is-template-object":{},"esnext.array.last-index":{},"esnext.array.last-item":{},"esnext.array.unique-by":{},"esnext.async-iterator.constructor":{},"esnext.async-iterator.as-indexed-pairs":{},"esnext.async-iterator.drop":{},"esnext.async-iterator.every":{},"esnext.async-iterator.filter":{},"esnext.async-iterator.find":{},"esnext.async-iterator.flat-map":{},"esnext.async-iterator.for-each":{},"esnext.async-iterator.from":{},"esnext.async-iterator.map":{},"esnext.async-iterator.reduce":{},"esnext.async-iterator.some":{},"esnext.async-iterator.take":{},"esnext.async-iterator.to-array":{},"esnext.bigint.range":{},"esnext.composite-key":{},"esnext.composite-symbol":{},"esnext.global-this":{"android":"71","chrome":"71","edge":"74","electron":"5.0","firefox":"65","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"esnext.iterator.constructor":{},"esnext.iterator.as-indexed-pairs":{},"esnext.iterator.drop":{},"esnext.iterator.every":{},"esnext.iterator.filter":{},"esnext.iterator.find":{},"esnext.iterator.flat-map":{},"esnext.iterator.for-each":{},"esnext.iterator.from":{},"esnext.iterator.map":{},"esnext.iterator.reduce":{},"esnext.iterator.some":{},"esnext.iterator.take":{},"esnext.iterator.to-array":{},"esnext.map.delete-all":{},"esnext.map.emplace":{},"esnext.map.every":{},"esnext.map.filter":{},"esnext.map.find":{},"esnext.map.find-key":{},"esnext.map.from":{},"esnext.map.group-by":{},"esnext.map.includes":{},"esnext.map.key-by":{},"esnext.map.key-of":{},"esnext.map.map-keys":{},"esnext.map.map-values":{},"esnext.map.merge":{},"esnext.map.of":{},"esnext.map.reduce":{},"esnext.map.some":{},"esnext.map.update":{},"esnext.map.update-or-insert":{},"esnext.map.upsert":{},"esnext.math.clamp":{},"esnext.math.deg-per-rad":{},"esnext.math.degrees":{},"esnext.math.fscale":{},"esnext.math.iaddh":{},"esnext.math.imulh":{},"esnext.math.isubh":{},"esnext.math.rad-per-deg":{},"esnext.math.radians":{},"esnext.math.scale":{},"esnext.math.seeded-prng":{},"esnext.math.signbit":{},"esnext.math.umulh":{},"esnext.number.from-string":{},"esnext.number.range":{},"esnext.object.has-own":{},"esnext.object.iterate-entries":{},"esnext.object.iterate-keys":{},"esnext.object.iterate-values":{},"esnext.observable":{},"esnext.promise.all-settled":{"android":"76","chrome":"76","edge":"76","electron":"6.0","firefox":"71","ios":"13.0","node":"12.9","opera":"63","opera_mobile":"54","safari":"13","samsung":"12.0"},"esnext.promise.any":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"esnext.promise.try":{},"esnext.reflect.define-metadata":{},"esnext.reflect.delete-metadata":{},"esnext.reflect.get-metadata":{},"esnext.reflect.get-metadata-keys":{},"esnext.reflect.get-own-metadata":{},"esnext.reflect.get-own-metadata-keys":{},"esnext.reflect.has-metadata":{},"esnext.reflect.has-own-metadata":{},"esnext.reflect.metadata":{},"esnext.set.add-all":{},"esnext.set.delete-all":{},"esnext.set.difference":{},"esnext.set.every":{},"esnext.set.filter":{},"esnext.set.find":{},"esnext.set.from":{},"esnext.set.intersection":{},"esnext.set.is-disjoint-from":{},"esnext.set.is-subset-of":{},"esnext.set.is-superset-of":{},"esnext.set.join":{},"esnext.set.map":{},"esnext.set.of":{},"esnext.set.reduce":{},"esnext.set.some":{},"esnext.set.symmetric-difference":{},"esnext.set.union":{},"esnext.string.at":{},"esnext.string.code-points":{},"esnext.string.match-all":{"android":"80","chrome":"80","edge":"80","electron":"8.0","firefox":"73","ios":"13.4","node":"14.0","opera":"67","opera_mobile":"57","safari":"13.1","samsung":"13.0"},"esnext.string.replace-all":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"77","ios":"13.4","node":"15.0","opera":"71","opera_mobile":"60","safari":"13.1","samsung":"14.0"},"esnext.symbol.async-dispose":{},"esnext.symbol.dispose":{},"esnext.symbol.matcher":{},"esnext.symbol.metadata":{},"esnext.symbol.observable":{},"esnext.symbol.pattern-match":{},"esnext.symbol.replace-all":{},"esnext.typed-array.at":{"android":"92","chrome":"92","edge":"92","electron":"14.0","opera":"78"},"esnext.typed-array.filter-out":{},"esnext.typed-array.find-last":{},"esnext.typed-array.find-last-index":{},"esnext.typed-array.unique-by":{},"esnext.weak-map.delete-all":{},"esnext.weak-map.from":{},"esnext.weak-map.of":{},"esnext.weak-map.emplace":{},"esnext.weak-map.upsert":{},"esnext.weak-set.add-all":{},"esnext.weak-set.delete-all":{},"esnext.weak-set.from":{},"esnext.weak-set.of":{},"web.dom-collections.for-each":{"android":"58","chrome":"58","edge":"16","electron":"1.7","firefox":"50","ios":"10.0","node":"0.0.1","opera":"45","opera_mobile":"43","safari":"10.0","samsung":"7.0"},"web.dom-collections.iterator":{"android":"66","chrome":"66","edge":"74","electron":"3.0","firefox":"60","ios":"13.4","node":"0.0.1","opera":"53","opera_mobile":"47","safari":"13.1","samsung":"9.0"},"web.immediate":{"ie":"10","node":"0.9.1"},"web.queue-microtask":{"android":"71","chrome":"71","edge":"74","electron":"5.0","firefox":"69","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"web.timers":{"android":"1.5","chrome":"1","edge":"12","electron":"0.20","firefox":"1","ie":"10","ios":"1.0","node":"0.0.1","opera":"7","opera_mobile":"7","phantom":"1.9","safari":"1.0","samsung":"1.0"},"web.url":{"android":"67","chrome":"67","edge":"74","electron":"4.0","firefox":"57","ios":"14.0","node":"10.0","opera":"54","opera_mobile":"48","safari":"14.0","samsung":"9.0"},"web.url.to-json":{"android":"71","chrome":"71","edge":"74","electron":"5.0","firefox":"57","ios":"14.0","node":"10.0","opera":"58","opera_mobile":"50","safari":"14.0","samsung":"10.0"},"web.url-search-params":{"android":"67","chrome":"67","edge":"74","electron":"4.0","firefox":"57","ios":"14.0","node":"10.0","opera":"54","opera_mobile":"48","safari":"14.0","samsung":"9.0"}}')},4323:e=>{"use strict";e.exports=JSON.parse('{"core-js":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"core-js/es":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set"],"core-js/es/aggregate-error":["es.aggregate-error","es.string.iterator","web.dom-collections.iterator"],"core-js/es/array":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.string.iterator"],"core-js/es/array-buffer":["es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.object.to-string"],"core-js/es/array-buffer/constructor":["es.array-buffer.constructor","es.object.to-string"],"core-js/es/array-buffer/is-view":["es.array-buffer.is-view"],"core-js/es/array-buffer/slice":["es.array-buffer.slice"],"core-js/es/array/concat":["es.array.concat"],"core-js/es/array/copy-within":["es.array.copy-within"],"core-js/es/array/entries":["es.array.iterator"],"core-js/es/array/every":["es.array.every"],"core-js/es/array/fill":["es.array.fill"],"core-js/es/array/filter":["es.array.filter"],"core-js/es/array/find":["es.array.find"],"core-js/es/array/find-index":["es.array.find-index"],"core-js/es/array/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/es/array/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/es/array/for-each":["es.array.for-each"],"core-js/es/array/from":["es.array.from","es.string.iterator"],"core-js/es/array/includes":["es.array.includes"],"core-js/es/array/index-of":["es.array.index-of"],"core-js/es/array/is-array":["es.array.is-array"],"core-js/es/array/iterator":["es.array.iterator"],"core-js/es/array/join":["es.array.join"],"core-js/es/array/keys":["es.array.iterator"],"core-js/es/array/last-index-of":["es.array.last-index-of"],"core-js/es/array/map":["es.array.map"],"core-js/es/array/of":["es.array.of"],"core-js/es/array/reduce":["es.array.reduce"],"core-js/es/array/reduce-right":["es.array.reduce-right"],"core-js/es/array/reverse":["es.array.reverse"],"core-js/es/array/slice":["es.array.slice"],"core-js/es/array/some":["es.array.some"],"core-js/es/array/sort":["es.array.sort"],"core-js/es/array/splice":["es.array.splice"],"core-js/es/array/values":["es.array.iterator"],"core-js/es/array/virtual":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.includes","es.array.index-of","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map"],"core-js/es/array/virtual/concat":["es.array.concat"],"core-js/es/array/virtual/copy-within":["es.array.copy-within"],"core-js/es/array/virtual/entries":["es.array.iterator"],"core-js/es/array/virtual/every":["es.array.every"],"core-js/es/array/virtual/fill":["es.array.fill"],"core-js/es/array/virtual/filter":["es.array.filter"],"core-js/es/array/virtual/filter-out":["esnext.array.filter-out"],"core-js/es/array/virtual/find":["es.array.find"],"core-js/es/array/virtual/find-index":["es.array.find-index"],"core-js/es/array/virtual/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/es/array/virtual/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/es/array/virtual/for-each":["es.array.for-each"],"core-js/es/array/virtual/includes":["es.array.includes"],"core-js/es/array/virtual/index-of":["es.array.index-of"],"core-js/es/array/virtual/iterator":["es.array.iterator"],"core-js/es/array/virtual/join":["es.array.join"],"core-js/es/array/virtual/keys":["es.array.iterator"],"core-js/es/array/virtual/last-index-of":["es.array.last-index-of"],"core-js/es/array/virtual/map":["es.array.map"],"core-js/es/array/virtual/reduce":["es.array.reduce"],"core-js/es/array/virtual/reduce-right":["es.array.reduce-right"],"core-js/es/array/virtual/reverse":["es.array.reverse"],"core-js/es/array/virtual/slice":["es.array.slice"],"core-js/es/array/virtual/some":["es.array.some"],"core-js/es/array/virtual/sort":["es.array.sort"],"core-js/es/array/virtual/splice":["es.array.splice"],"core-js/es/array/virtual/values":["es.array.iterator"],"core-js/es/data-view":["es.data-view","es.object.to-string"],"core-js/es/date":["es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string"],"core-js/es/date/now":["es.date.now"],"core-js/es/date/to-iso-string":["es.date.to-iso-string","es.date.to-json"],"core-js/es/date/to-json":["es.date.to-json"],"core-js/es/date/to-primitive":["es.date.to-primitive"],"core-js/es/date/to-string":["es.date.to-string"],"core-js/es/function":["es.function.bind","es.function.has-instance","es.function.name"],"core-js/es/function/bind":["es.function.bind"],"core-js/es/function/has-instance":["es.function.has-instance"],"core-js/es/function/name":["es.function.name"],"core-js/es/function/virtual":["es.function.bind"],"core-js/es/function/virtual/bind":["es.function.bind"],"core-js/es/global-this":["es.global-this"],"core-js/es/instance/bind":["es.function.bind"],"core-js/es/instance/code-point-at":["es.string.code-point-at"],"core-js/es/instance/concat":["es.array.concat"],"core-js/es/instance/copy-within":["es.array.copy-within"],"core-js/es/instance/ends-with":["es.string.ends-with"],"core-js/es/instance/entries":["es.array.iterator"],"core-js/es/instance/every":["es.array.every"],"core-js/es/instance/fill":["es.array.fill"],"core-js/es/instance/filter":["es.array.filter"],"core-js/es/instance/find":["es.array.find"],"core-js/es/instance/find-index":["es.array.find-index"],"core-js/es/instance/flags":["es.regexp.flags"],"core-js/es/instance/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/es/instance/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/es/instance/for-each":["es.array.for-each"],"core-js/es/instance/includes":["es.array.includes","es.string.includes"],"core-js/es/instance/index-of":["es.array.index-of"],"core-js/es/instance/keys":["es.array.iterator"],"core-js/es/instance/last-index-of":["es.array.last-index-of"],"core-js/es/instance/map":["es.array.map"],"core-js/es/instance/match-all":["es.string.match-all"],"core-js/es/instance/pad-end":["es.string.pad-end"],"core-js/es/instance/pad-start":["es.string.pad-start"],"core-js/es/instance/reduce":["es.array.reduce"],"core-js/es/instance/reduce-right":["es.array.reduce-right"],"core-js/es/instance/repeat":["es.string.repeat"],"core-js/es/instance/replace-all":["es.string.replace-all"],"core-js/es/instance/reverse":["es.array.reverse"],"core-js/es/instance/slice":["es.array.slice"],"core-js/es/instance/some":["es.array.some"],"core-js/es/instance/sort":["es.array.sort"],"core-js/es/instance/splice":["es.array.splice"],"core-js/es/instance/starts-with":["es.string.starts-with"],"core-js/es/instance/trim":["es.string.trim"],"core-js/es/instance/trim-end":["es.string.trim-end"],"core-js/es/instance/trim-left":["es.string.trim-start"],"core-js/es/instance/trim-right":["es.string.trim-end"],"core-js/es/instance/trim-start":["es.string.trim-start"],"core-js/es/instance/values":["es.array.iterator"],"core-js/es/json":["es.json.stringify","es.json.to-string-tag"],"core-js/es/json/stringify":["es.json.stringify"],"core-js/es/json/to-string-tag":["es.json.to-string-tag"],"core-js/es/map":["es.map","es.object.to-string","es.string.iterator","web.dom-collections.iterator"],"core-js/es/math":["es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc"],"core-js/es/math/acosh":["es.math.acosh"],"core-js/es/math/asinh":["es.math.asinh"],"core-js/es/math/atanh":["es.math.atanh"],"core-js/es/math/cbrt":["es.math.cbrt"],"core-js/es/math/clz32":["es.math.clz32"],"core-js/es/math/cosh":["es.math.cosh"],"core-js/es/math/expm1":["es.math.expm1"],"core-js/es/math/fround":["es.math.fround"],"core-js/es/math/hypot":["es.math.hypot"],"core-js/es/math/imul":["es.math.imul"],"core-js/es/math/log10":["es.math.log10"],"core-js/es/math/log1p":["es.math.log1p"],"core-js/es/math/log2":["es.math.log2"],"core-js/es/math/sign":["es.math.sign"],"core-js/es/math/sinh":["es.math.sinh"],"core-js/es/math/tanh":["es.math.tanh"],"core-js/es/math/to-string-tag":["es.math.to-string-tag"],"core-js/es/math/trunc":["es.math.trunc"],"core-js/es/number":["es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision"],"core-js/es/number/constructor":["es.number.constructor"],"core-js/es/number/epsilon":["es.number.epsilon"],"core-js/es/number/is-finite":["es.number.is-finite"],"core-js/es/number/is-integer":["es.number.is-integer"],"core-js/es/number/is-nan":["es.number.is-nan"],"core-js/es/number/is-safe-integer":["es.number.is-safe-integer"],"core-js/es/number/max-safe-integer":["es.number.max-safe-integer"],"core-js/es/number/min-safe-integer":["es.number.min-safe-integer"],"core-js/es/number/parse-float":["es.number.parse-float"],"core-js/es/number/parse-int":["es.number.parse-int"],"core-js/es/number/to-fixed":["es.number.to-fixed"],"core-js/es/number/to-precision":["es.number.to-precision"],"core-js/es/number/virtual":["es.number.to-fixed","es.number.to-precision"],"core-js/es/number/virtual/to-fixed":["es.number.to-fixed"],"core-js/es/number/virtual/to-precision":["es.number.to-precision"],"core-js/es/object":["es.symbol","es.json.to-string-tag","es.math.to-string-tag","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.reflect.to-string-tag"],"core-js/es/object/assign":["es.object.assign"],"core-js/es/object/create":["es.object.create"],"core-js/es/object/define-getter":["es.object.define-getter"],"core-js/es/object/define-properties":["es.object.define-properties"],"core-js/es/object/define-property":["es.object.define-property"],"core-js/es/object/define-setter":["es.object.define-setter"],"core-js/es/object/entries":["es.object.entries"],"core-js/es/object/freeze":["es.object.freeze"],"core-js/es/object/from-entries":["es.array.iterator","es.object.from-entries"],"core-js/es/object/get-own-property-descriptor":["es.object.get-own-property-descriptor"],"core-js/es/object/get-own-property-descriptors":["es.object.get-own-property-descriptors"],"core-js/es/object/get-own-property-names":["es.object.get-own-property-names"],"core-js/es/object/get-own-property-symbols":["es.symbol"],"core-js/es/object/get-prototype-of":["es.object.get-prototype-of"],"core-js/es/object/is":["es.object.is"],"core-js/es/object/is-extensible":["es.object.is-extensible"],"core-js/es/object/is-frozen":["es.object.is-frozen"],"core-js/es/object/is-sealed":["es.object.is-sealed"],"core-js/es/object/keys":["es.object.keys"],"core-js/es/object/lookup-getter":["es.object.lookup-setter"],"core-js/es/object/lookup-setter":["es.object.lookup-setter"],"core-js/es/object/prevent-extensions":["es.object.prevent-extensions"],"core-js/es/object/seal":["es.object.seal"],"core-js/es/object/set-prototype-of":["es.object.set-prototype-of"],"core-js/es/object/to-string":["es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/es/object/values":["es.object.values"],"core-js/es/parse-float":["es.parse-float"],"core-js/es/parse-int":["es.parse-int"],"core-js/es/promise":["es.aggregate-error","es.object.to-string","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.string.iterator","web.dom-collections.iterator"],"core-js/es/promise/all-settled":["es.promise","es.promise.all-settled","es.string.iterator","web.dom-collections.iterator"],"core-js/es/promise/any":["es.aggregate-error","es.promise","es.promise.any","es.string.iterator","web.dom-collections.iterator"],"core-js/es/promise/finally":["es.promise","es.promise.finally"],"core-js/es/reflect":["es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag"],"core-js/es/reflect/apply":["es.reflect.apply"],"core-js/es/reflect/construct":["es.reflect.construct"],"core-js/es/reflect/define-property":["es.reflect.define-property"],"core-js/es/reflect/delete-property":["es.reflect.delete-property"],"core-js/es/reflect/get":["es.reflect.get"],"core-js/es/reflect/get-own-property-descriptor":["es.reflect.get-own-property-descriptor"],"core-js/es/reflect/get-prototype-of":["es.reflect.get-prototype-of"],"core-js/es/reflect/has":["es.reflect.has"],"core-js/es/reflect/is-extensible":["es.reflect.is-extensible"],"core-js/es/reflect/own-keys":["es.reflect.own-keys"],"core-js/es/reflect/prevent-extensions":["es.reflect.prevent-extensions"],"core-js/es/reflect/set":["es.reflect.set"],"core-js/es/reflect/set-prototype-of":["es.reflect.set-prototype-of"],"core-js/es/reflect/to-string-tag":["es.reflect.to-string-tag"],"core-js/es/regexp":["es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.string.match","es.string.replace","es.string.search","es.string.split"],"core-js/es/regexp/constructor":["es.regexp.constructor"],"core-js/es/regexp/flags":["es.regexp.flags"],"core-js/es/regexp/match":["es.string.match"],"core-js/es/regexp/replace":["es.string.replace"],"core-js/es/regexp/search":["es.string.search"],"core-js/es/regexp/split":["es.string.split"],"core-js/es/regexp/sticky":["es.regexp.sticky"],"core-js/es/regexp/test":["es.regexp.exec","es.regexp.test"],"core-js/es/regexp/to-string":["es.regexp.to-string"],"core-js/es/set":["es.object.to-string","es.set","es.string.iterator","web.dom-collections.iterator"],"core-js/es/string":["es.regexp.exec","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup"],"core-js/es/string/anchor":["es.string.anchor"],"core-js/es/string/big":["es.string.big"],"core-js/es/string/blink":["es.string.blink"],"core-js/es/string/bold":["es.string.bold"],"core-js/es/string/code-point-at":["es.string.code-point-at"],"core-js/es/string/ends-with":["es.string.ends-with"],"core-js/es/string/fixed":["es.string.fixed"],"core-js/es/string/fontcolor":["es.string.fontcolor"],"core-js/es/string/fontsize":["es.string.fontsize"],"core-js/es/string/from-code-point":["es.string.from-code-point"],"core-js/es/string/includes":["es.string.includes"],"core-js/es/string/italics":["es.string.italics"],"core-js/es/string/iterator":["es.string.iterator"],"core-js/es/string/link":["es.string.link"],"core-js/es/string/match":["es.regexp.exec","es.string.match"],"core-js/es/string/match-all":["es.string.match-all"],"core-js/es/string/pad-end":["es.string.pad-end"],"core-js/es/string/pad-start":["es.string.pad-start"],"core-js/es/string/raw":["es.string.raw"],"core-js/es/string/repeat":["es.string.repeat"],"core-js/es/string/replace":["es.regexp.exec","es.string.replace"],"core-js/es/string/replace-all":["es.string.replace-all"],"core-js/es/string/search":["es.regexp.exec","es.string.search"],"core-js/es/string/small":["es.string.small"],"core-js/es/string/split":["es.regexp.exec","es.string.split"],"core-js/es/string/starts-with":["es.string.starts-with"],"core-js/es/string/strike":["es.string.strike"],"core-js/es/string/sub":["es.string.sub"],"core-js/es/string/sup":["es.string.sup"],"core-js/es/string/trim":["es.string.trim"],"core-js/es/string/trim-end":["es.string.trim-end"],"core-js/es/string/trim-left":["es.string.trim-start"],"core-js/es/string/trim-right":["es.string.trim-end"],"core-js/es/string/trim-start":["es.string.trim-start"],"core-js/es/string/virtual":["es.string.code-point-at","es.string.ends-with","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup"],"core-js/es/string/virtual/anchor":["es.string.anchor"],"core-js/es/string/virtual/big":["es.string.big"],"core-js/es/string/virtual/blink":["es.string.blink"],"core-js/es/string/virtual/bold":["es.string.bold"],"core-js/es/string/virtual/code-point-at":["es.string.code-point-at"],"core-js/es/string/virtual/ends-with":["es.string.ends-with"],"core-js/es/string/virtual/fixed":["es.string.fixed"],"core-js/es/string/virtual/fontcolor":["es.string.fontcolor"],"core-js/es/string/virtual/fontsize":["es.string.fontsize"],"core-js/es/string/virtual/includes":["es.string.includes"],"core-js/es/string/virtual/italics":["es.string.italics"],"core-js/es/string/virtual/iterator":["es.string.iterator"],"core-js/es/string/virtual/link":["es.string.link"],"core-js/es/string/virtual/match-all":["es.string.match-all"],"core-js/es/string/virtual/pad-end":["es.string.pad-end"],"core-js/es/string/virtual/pad-start":["es.string.pad-start"],"core-js/es/string/virtual/repeat":["es.string.repeat"],"core-js/es/string/virtual/replace-all":["es.string.replace-all"],"core-js/es/string/virtual/small":["es.string.small"],"core-js/es/string/virtual/starts-with":["es.string.starts-with"],"core-js/es/string/virtual/strike":["es.string.strike"],"core-js/es/string/virtual/sub":["es.string.sub"],"core-js/es/string/virtual/sup":["es.string.sup"],"core-js/es/string/virtual/trim":["es.string.trim"],"core-js/es/string/virtual/trim-end":["es.string.trim-end"],"core-js/es/string/virtual/trim-left":["es.string.trim-start"],"core-js/es/string/virtual/trim-right":["es.string.trim-end"],"core-js/es/string/virtual/trim-start":["es.string.trim-start"],"core-js/es/symbol":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.array.concat","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/es/symbol/async-iterator":["es.symbol.async-iterator"],"core-js/es/symbol/description":["es.symbol.description"],"core-js/es/symbol/for":["es.symbol"],"core-js/es/symbol/has-instance":["es.symbol.has-instance","es.function.has-instance"],"core-js/es/symbol/is-concat-spreadable":["es.symbol.is-concat-spreadable","es.array.concat"],"core-js/es/symbol/iterator":["es.symbol.iterator","es.string.iterator","web.dom-collections.iterator"],"core-js/es/symbol/key-for":["es.symbol"],"core-js/es/symbol/match":["es.symbol.match","es.string.match"],"core-js/es/symbol/match-all":["es.symbol.match-all","es.string.match-all"],"core-js/es/symbol/replace":["es.symbol.replace","es.string.replace"],"core-js/es/symbol/search":["es.symbol.search","es.string.search"],"core-js/es/symbol/species":["es.symbol.species"],"core-js/es/symbol/split":["es.symbol.split","es.string.split"],"core-js/es/symbol/to-primitive":["es.symbol.to-primitive"],"core-js/es/symbol/to-string-tag":["es.symbol.to-string-tag","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/es/symbol/unscopables":["es.symbol.unscopables"],"core-js/es/typed-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/copy-within":["es.typed-array.copy-within"],"core-js/es/typed-array/entries":["es.typed-array.iterator"],"core-js/es/typed-array/every":["es.typed-array.every"],"core-js/es/typed-array/fill":["es.typed-array.fill"],"core-js/es/typed-array/filter":["es.typed-array.filter"],"core-js/es/typed-array/find":["es.typed-array.find"],"core-js/es/typed-array/find-index":["es.typed-array.find-index"],"core-js/es/typed-array/float32-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/float64-array":["es.object.to-string","es.typed-array.float64-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/for-each":["es.typed-array.for-each"],"core-js/es/typed-array/from":["es.typed-array.from"],"core-js/es/typed-array/includes":["es.typed-array.includes"],"core-js/es/typed-array/index-of":["es.typed-array.index-of"],"core-js/es/typed-array/int16-array":["es.object.to-string","es.typed-array.int16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/int32-array":["es.object.to-string","es.typed-array.int32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/int8-array":["es.object.to-string","es.typed-array.int8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/iterator":["es.typed-array.iterator"],"core-js/es/typed-array/join":["es.typed-array.join"],"core-js/es/typed-array/keys":["es.typed-array.iterator"],"core-js/es/typed-array/last-index-of":["es.typed-array.last-index-of"],"core-js/es/typed-array/map":["es.typed-array.map"],"core-js/es/typed-array/methods":["es.object.to-string","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/of":["es.typed-array.of"],"core-js/es/typed-array/reduce":["es.typed-array.reduce"],"core-js/es/typed-array/reduce-right":["es.typed-array.reduce-right"],"core-js/es/typed-array/reverse":["es.typed-array.reverse"],"core-js/es/typed-array/set":["es.typed-array.set"],"core-js/es/typed-array/slice":["es.typed-array.slice"],"core-js/es/typed-array/some":["es.typed-array.some"],"core-js/es/typed-array/sort":["es.typed-array.sort"],"core-js/es/typed-array/subarray":["es.typed-array.subarray"],"core-js/es/typed-array/to-locale-string":["es.typed-array.to-locale-string"],"core-js/es/typed-array/to-string":["es.typed-array.to-string"],"core-js/es/typed-array/uint16-array":["es.object.to-string","es.typed-array.uint16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/uint32-array":["es.object.to-string","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/uint8-array":["es.object.to-string","es.typed-array.uint8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/uint8-clamped-array":["es.object.to-string","es.typed-array.uint8-clamped-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/values":["es.typed-array.iterator"],"core-js/es/weak-map":["es.object.to-string","es.weak-map","web.dom-collections.iterator"],"core-js/es/weak-set":["es.object.to-string","es.weak-set","web.dom-collections.iterator"],"core-js/features":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"core-js/features/aggregate-error":["es.aggregate-error","es.string.iterator","esnext.aggregate-error","web.dom-collections.iterator"],"core-js/features/array":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.map","es.string.iterator","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by"],"core-js/features/array-buffer":["es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.object.to-string"],"core-js/features/array-buffer/constructor":["es.array-buffer.constructor","es.object.to-string"],"core-js/features/array-buffer/is-view":["es.array-buffer.is-view"],"core-js/features/array-buffer/slice":["es.array-buffer.slice"],"core-js/features/array/at":["esnext.array.at"],"core-js/features/array/concat":["es.array.concat"],"core-js/features/array/copy-within":["es.array.copy-within"],"core-js/features/array/entries":["es.array.iterator"],"core-js/features/array/every":["es.array.every"],"core-js/features/array/fill":["es.array.fill"],"core-js/features/array/filter":["es.array.filter"],"core-js/features/array/filter-out":["esnext.array.filter-out"],"core-js/features/array/find":["es.array.find"],"core-js/features/array/find-index":["es.array.find-index"],"core-js/features/array/find-last":["esnext.array.find-last"],"core-js/features/array/find-last-index":["esnext.array.find-last-index"],"core-js/features/array/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/features/array/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/features/array/for-each":["es.array.for-each"],"core-js/features/array/from":["es.array.from","es.string.iterator"],"core-js/features/array/includes":["es.array.includes"],"core-js/features/array/index-of":["es.array.index-of"],"core-js/features/array/is-array":["es.array.is-array"],"core-js/features/array/is-template-object":["esnext.array.is-template-object"],"core-js/features/array/iterator":["es.array.iterator"],"core-js/features/array/join":["es.array.join"],"core-js/features/array/keys":["es.array.iterator"],"core-js/features/array/last-index":["esnext.array.last-index"],"core-js/features/array/last-index-of":["es.array.last-index-of"],"core-js/features/array/last-item":["esnext.array.last-item"],"core-js/features/array/map":["es.array.map"],"core-js/features/array/of":["es.array.of"],"core-js/features/array/reduce":["es.array.reduce"],"core-js/features/array/reduce-right":["es.array.reduce-right"],"core-js/features/array/reverse":["es.array.reverse"],"core-js/features/array/slice":["es.array.slice"],"core-js/features/array/some":["es.array.some"],"core-js/features/array/sort":["es.array.sort"],"core-js/features/array/splice":["es.array.splice"],"core-js/features/array/unique-by":["es.map","esnext.array.unique-by"],"core-js/features/array/values":["es.array.iterator"],"core-js/features/array/virtual":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.includes","es.array.index-of","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.map","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.unique-by"],"core-js/features/array/virtual/at":["esnext.array.at"],"core-js/features/array/virtual/concat":["es.array.concat"],"core-js/features/array/virtual/copy-within":["es.array.copy-within"],"core-js/features/array/virtual/entries":["es.array.iterator"],"core-js/features/array/virtual/every":["es.array.every"],"core-js/features/array/virtual/fill":["es.array.fill"],"core-js/features/array/virtual/filter":["es.array.filter"],"core-js/features/array/virtual/filter-out":["esnext.array.filter-out"],"core-js/features/array/virtual/find":["es.array.find"],"core-js/features/array/virtual/find-index":["es.array.find-index"],"core-js/features/array/virtual/find-last":["esnext.array.find-last"],"core-js/features/array/virtual/find-last-index":["esnext.array.find-last-index"],"core-js/features/array/virtual/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/features/array/virtual/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/features/array/virtual/for-each":["es.array.for-each"],"core-js/features/array/virtual/includes":["es.array.includes"],"core-js/features/array/virtual/index-of":["es.array.index-of"],"core-js/features/array/virtual/iterator":["es.array.iterator"],"core-js/features/array/virtual/join":["es.array.join"],"core-js/features/array/virtual/keys":["es.array.iterator"],"core-js/features/array/virtual/last-index-of":["es.array.last-index-of"],"core-js/features/array/virtual/map":["es.array.map"],"core-js/features/array/virtual/reduce":["es.array.reduce"],"core-js/features/array/virtual/reduce-right":["es.array.reduce-right"],"core-js/features/array/virtual/reverse":["es.array.reverse"],"core-js/features/array/virtual/slice":["es.array.slice"],"core-js/features/array/virtual/some":["es.array.some"],"core-js/features/array/virtual/sort":["es.array.sort"],"core-js/features/array/virtual/splice":["es.array.splice"],"core-js/features/array/virtual/unique-by":["es.map","esnext.array.unique-by"],"core-js/features/array/virtual/values":["es.array.iterator"],"core-js/features/async-iterator":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","web.dom-collections.iterator"],"core-js/features/async-iterator/as-indexed-pairs":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","web.dom-collections.iterator"],"core-js/features/async-iterator/drop":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.drop","web.dom-collections.iterator"],"core-js/features/async-iterator/every":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.every","web.dom-collections.iterator"],"core-js/features/async-iterator/filter":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.filter","web.dom-collections.iterator"],"core-js/features/async-iterator/find":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.find","web.dom-collections.iterator"],"core-js/features/async-iterator/flat-map":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.flat-map","web.dom-collections.iterator"],"core-js/features/async-iterator/for-each":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.for-each","web.dom-collections.iterator"],"core-js/features/async-iterator/from":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.from","web.dom-collections.iterator"],"core-js/features/async-iterator/map":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.map","web.dom-collections.iterator"],"core-js/features/async-iterator/reduce":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.reduce","web.dom-collections.iterator"],"core-js/features/async-iterator/some":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.some","web.dom-collections.iterator"],"core-js/features/async-iterator/take":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.take","web.dom-collections.iterator"],"core-js/features/async-iterator/to-array":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.to-array","web.dom-collections.iterator"],"core-js/features/bigint":["esnext.bigint.range"],"core-js/features/bigint/range":["esnext.bigint.range"],"core-js/features/clear-immediate":["web.immediate"],"core-js/features/composite-key":["esnext.composite-key"],"core-js/features/composite-symbol":["es.symbol","esnext.composite-symbol"],"core-js/features/data-view":["es.data-view","es.object.to-string"],"core-js/features/date":["es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string"],"core-js/features/date/now":["es.date.now"],"core-js/features/date/to-iso-string":["es.date.to-iso-string","es.date.to-json"],"core-js/features/date/to-json":["es.date.to-json"],"core-js/features/date/to-primitive":["es.date.to-primitive"],"core-js/features/date/to-string":["es.date.to-string"],"core-js/features/dom-collections":["es.array.iterator","web.dom-collections.for-each","web.dom-collections.iterator"],"core-js/features/dom-collections/for-each":["web.dom-collections.for-each"],"core-js/features/dom-collections/iterator":["web.dom-collections.iterator"],"core-js/features/function":["es.function.bind","es.function.has-instance","es.function.name"],"core-js/features/function/bind":["es.function.bind"],"core-js/features/function/has-instance":["es.function.has-instance"],"core-js/features/function/name":["es.function.name"],"core-js/features/function/virtual":["es.function.bind"],"core-js/features/function/virtual/bind":["es.function.bind"],"core-js/features/get-iterator":["es.string.iterator","web.dom-collections.iterator"],"core-js/features/get-iterator-method":["es.string.iterator","web.dom-collections.iterator"],"core-js/features/global-this":["es.global-this","esnext.global-this"],"core-js/features/instance/at":["esnext.array.at","esnext.string.at"],"core-js/features/instance/bind":["es.function.bind"],"core-js/features/instance/code-point-at":["es.string.code-point-at"],"core-js/features/instance/code-points":["esnext.string.code-points"],"core-js/features/instance/concat":["es.array.concat"],"core-js/features/instance/copy-within":["es.array.copy-within"],"core-js/features/instance/ends-with":["es.string.ends-with"],"core-js/features/instance/entries":["es.array.iterator","web.dom-collections.iterator"],"core-js/features/instance/every":["es.array.every"],"core-js/features/instance/fill":["es.array.fill"],"core-js/features/instance/filter":["es.array.filter"],"core-js/features/instance/filter-out":["esnext.array.filter-out"],"core-js/features/instance/find":["es.array.find"],"core-js/features/instance/find-index":["es.array.find-index"],"core-js/features/instance/find-last":["esnext.array.find-last"],"core-js/features/instance/find-last-index":["esnext.array.find-last-index"],"core-js/features/instance/flags":["es.regexp.flags"],"core-js/features/instance/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/features/instance/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/features/instance/for-each":["es.array.for-each","web.dom-collections.iterator"],"core-js/features/instance/includes":["es.array.includes","es.string.includes"],"core-js/features/instance/index-of":["es.array.index-of"],"core-js/features/instance/keys":["es.array.iterator","web.dom-collections.iterator"],"core-js/features/instance/last-index-of":["es.array.last-index-of"],"core-js/features/instance/map":["es.array.map"],"core-js/features/instance/match-all":["es.string.match-all","esnext.string.match-all"],"core-js/features/instance/pad-end":["es.string.pad-end"],"core-js/features/instance/pad-start":["es.string.pad-start"],"core-js/features/instance/reduce":["es.array.reduce"],"core-js/features/instance/reduce-right":["es.array.reduce-right"],"core-js/features/instance/repeat":["es.string.repeat"],"core-js/features/instance/replace-all":["es.string.replace-all"],"core-js/features/instance/reverse":["es.array.reverse"],"core-js/features/instance/slice":["es.array.slice"],"core-js/features/instance/some":["es.array.some"],"core-js/features/instance/sort":["es.array.sort"],"core-js/features/instance/splice":["es.array.splice"],"core-js/features/instance/starts-with":["es.string.starts-with"],"core-js/features/instance/trim":["es.string.trim"],"core-js/features/instance/trim-end":["es.string.trim-end"],"core-js/features/instance/trim-left":["es.string.trim-start"],"core-js/features/instance/trim-right":["es.string.trim-end"],"core-js/features/instance/trim-start":["es.string.trim-start"],"core-js/features/instance/unique-by":["es.map","esnext.array.unique-by"],"core-js/features/instance/values":["es.array.iterator","web.dom-collections.iterator"],"core-js/features/is-iterable":["es.string.iterator","web.dom-collections.iterator"],"core-js/features/iterator":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","web.dom-collections.iterator"],"core-js/features/iterator/as-indexed-pairs":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","web.dom-collections.iterator"],"core-js/features/iterator/drop":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.drop","web.dom-collections.iterator"],"core-js/features/iterator/every":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.every","web.dom-collections.iterator"],"core-js/features/iterator/filter":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.filter","web.dom-collections.iterator"],"core-js/features/iterator/find":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.find","web.dom-collections.iterator"],"core-js/features/iterator/flat-map":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.flat-map","web.dom-collections.iterator"],"core-js/features/iterator/for-each":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.for-each","web.dom-collections.iterator"],"core-js/features/iterator/from":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.from","web.dom-collections.iterator"],"core-js/features/iterator/map":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.map","web.dom-collections.iterator"],"core-js/features/iterator/reduce":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.reduce","web.dom-collections.iterator"],"core-js/features/iterator/some":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.some","web.dom-collections.iterator"],"core-js/features/iterator/take":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.take","web.dom-collections.iterator"],"core-js/features/iterator/to-array":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.to-array","web.dom-collections.iterator"],"core-js/features/json":["es.json.stringify","es.json.to-string-tag"],"core-js/features/json/stringify":["es.json.stringify"],"core-js/features/json/to-string-tag":["es.json.to-string-tag"],"core-js/features/map":["es.map","es.object.to-string","es.string.iterator","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","web.dom-collections.iterator"],"core-js/features/map/delete-all":["es.map","esnext.map.delete-all"],"core-js/features/map/emplace":["es.map","esnext.map.emplace"],"core-js/features/map/every":["es.map","esnext.map.every"],"core-js/features/map/filter":["es.map","esnext.map.filter"],"core-js/features/map/find":["es.map","esnext.map.find"],"core-js/features/map/find-key":["es.map","esnext.map.find-key"],"core-js/features/map/from":["es.map","es.string.iterator","esnext.map.from","web.dom-collections.iterator"],"core-js/features/map/group-by":["es.map","esnext.map.group-by"],"core-js/features/map/includes":["es.map","esnext.map.includes"],"core-js/features/map/key-by":["es.map","esnext.map.key-by"],"core-js/features/map/key-of":["es.map","esnext.map.key-of"],"core-js/features/map/map-keys":["es.map","esnext.map.map-keys"],"core-js/features/map/map-values":["es.map","esnext.map.map-values"],"core-js/features/map/merge":["es.map","esnext.map.merge"],"core-js/features/map/of":["es.map","es.string.iterator","esnext.map.of","web.dom-collections.iterator"],"core-js/features/map/reduce":["es.map","esnext.map.reduce"],"core-js/features/map/some":["es.map","esnext.map.some"],"core-js/features/map/update":["es.map","esnext.map.update"],"core-js/features/map/update-or-insert":["es.map","esnext.map.update-or-insert"],"core-js/features/map/upsert":["es.map","esnext.map.upsert"],"core-js/features/math":["es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh"],"core-js/features/math/acosh":["es.math.acosh"],"core-js/features/math/asinh":["es.math.asinh"],"core-js/features/math/atanh":["es.math.atanh"],"core-js/features/math/cbrt":["es.math.cbrt"],"core-js/features/math/clamp":["esnext.math.clamp"],"core-js/features/math/clz32":["es.math.clz32"],"core-js/features/math/cosh":["es.math.cosh"],"core-js/features/math/deg-per-rad":["esnext.math.deg-per-rad"],"core-js/features/math/degrees":["esnext.math.degrees"],"core-js/features/math/expm1":["es.math.expm1"],"core-js/features/math/fround":["es.math.fround"],"core-js/features/math/fscale":["esnext.math.fscale"],"core-js/features/math/hypot":["es.math.hypot"],"core-js/features/math/iaddh":["esnext.math.iaddh"],"core-js/features/math/imul":["es.math.imul"],"core-js/features/math/imulh":["esnext.math.imulh"],"core-js/features/math/isubh":["esnext.math.isubh"],"core-js/features/math/log10":["es.math.log10"],"core-js/features/math/log1p":["es.math.log1p"],"core-js/features/math/log2":["es.math.log2"],"core-js/features/math/rad-per-deg":["esnext.math.rad-per-deg"],"core-js/features/math/radians":["esnext.math.radians"],"core-js/features/math/scale":["esnext.math.scale"],"core-js/features/math/seeded-prng":["esnext.math.seeded-prng"],"core-js/features/math/sign":["es.math.sign"],"core-js/features/math/signbit":["esnext.math.signbit"],"core-js/features/math/sinh":["es.math.sinh"],"core-js/features/math/tanh":["es.math.tanh"],"core-js/features/math/to-string-tag":["es.math.to-string-tag"],"core-js/features/math/trunc":["es.math.trunc"],"core-js/features/math/umulh":["esnext.math.umulh"],"core-js/features/number":["es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","esnext.number.from-string","esnext.number.range"],"core-js/features/number/constructor":["es.number.constructor"],"core-js/features/number/epsilon":["es.number.epsilon"],"core-js/features/number/from-string":["esnext.number.from-string"],"core-js/features/number/is-finite":["es.number.is-finite"],"core-js/features/number/is-integer":["es.number.is-integer"],"core-js/features/number/is-nan":["es.number.is-nan"],"core-js/features/number/is-safe-integer":["es.number.is-safe-integer"],"core-js/features/number/max-safe-integer":["es.number.max-safe-integer"],"core-js/features/number/min-safe-integer":["es.number.min-safe-integer"],"core-js/features/number/parse-float":["es.number.parse-float"],"core-js/features/number/parse-int":["es.number.parse-int"],"core-js/features/number/range":["esnext.number.range"],"core-js/features/number/to-fixed":["es.number.to-fixed"],"core-js/features/number/to-precision":["es.number.to-precision"],"core-js/features/number/virtual":["es.number.to-fixed","es.number.to-precision"],"core-js/features/number/virtual/to-fixed":["es.number.to-fixed"],"core-js/features/number/virtual/to-precision":["es.number.to-precision"],"core-js/features/object":["es.symbol","es.json.to-string-tag","es.math.to-string-tag","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.reflect.to-string-tag","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values"],"core-js/features/object/assign":["es.object.assign"],"core-js/features/object/create":["es.object.create"],"core-js/features/object/define-getter":["es.object.define-getter"],"core-js/features/object/define-properties":["es.object.define-properties"],"core-js/features/object/define-property":["es.object.define-property"],"core-js/features/object/define-setter":["es.object.define-setter"],"core-js/features/object/entries":["es.object.entries"],"core-js/features/object/freeze":["es.object.freeze"],"core-js/features/object/from-entries":["es.array.iterator","es.object.from-entries"],"core-js/features/object/get-own-property-descriptor":["es.object.get-own-property-descriptor"],"core-js/features/object/get-own-property-descriptors":["es.object.get-own-property-descriptors"],"core-js/features/object/get-own-property-names":["es.object.get-own-property-names"],"core-js/features/object/get-own-property-symbols":["es.symbol"],"core-js/features/object/get-prototype-of":["es.object.get-prototype-of"],"core-js/features/object/has-own":["esnext.object.has-own"],"core-js/features/object/is":["es.object.is"],"core-js/features/object/is-extensible":["es.object.is-extensible"],"core-js/features/object/is-frozen":["es.object.is-frozen"],"core-js/features/object/is-sealed":["es.object.is-sealed"],"core-js/features/object/iterate-entries":["esnext.object.iterate-entries"],"core-js/features/object/iterate-keys":["esnext.object.iterate-keys"],"core-js/features/object/iterate-values":["esnext.object.iterate-values"],"core-js/features/object/keys":["es.object.keys"],"core-js/features/object/lookup-getter":["es.object.lookup-setter"],"core-js/features/object/lookup-setter":["es.object.lookup-setter"],"core-js/features/object/prevent-extensions":["es.object.prevent-extensions"],"core-js/features/object/seal":["es.object.seal"],"core-js/features/object/set-prototype-of":["es.object.set-prototype-of"],"core-js/features/object/to-string":["es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/features/object/values":["es.object.values"],"core-js/features/observable":["es.object.to-string","es.string.iterator","esnext.observable","esnext.symbol.observable","web.dom-collections.iterator"],"core-js/features/parse-float":["es.parse-float"],"core-js/features/parse-int":["es.parse-int"],"core-js/features/promise":["es.aggregate-error","es.object.to-string","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.string.iterator","esnext.aggregate-error","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","web.dom-collections.iterator"],"core-js/features/promise/all-settled":["es.promise","es.promise.all-settled","es.string.iterator","esnext.promise.all-settled","web.dom-collections.iterator"],"core-js/features/promise/any":["es.aggregate-error","es.promise","es.promise.any","es.string.iterator","esnext.aggregate-error","esnext.promise.any","web.dom-collections.iterator"],"core-js/features/promise/finally":["es.promise","es.promise.finally"],"core-js/features/promise/try":["es.promise","esnext.promise.try"],"core-js/features/queue-microtask":["web.queue-microtask"],"core-js/features/reflect":["es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata"],"core-js/features/reflect/apply":["es.reflect.apply"],"core-js/features/reflect/construct":["es.reflect.construct"],"core-js/features/reflect/define-metadata":["esnext.reflect.define-metadata"],"core-js/features/reflect/define-property":["es.reflect.define-property"],"core-js/features/reflect/delete-metadata":["esnext.reflect.delete-metadata"],"core-js/features/reflect/delete-property":["es.reflect.delete-property"],"core-js/features/reflect/get":["es.reflect.get"],"core-js/features/reflect/get-metadata":["esnext.reflect.get-metadata"],"core-js/features/reflect/get-metadata-keys":["esnext.reflect.get-metadata-keys"],"core-js/features/reflect/get-own-metadata":["esnext.reflect.get-own-metadata"],"core-js/features/reflect/get-own-metadata-keys":["esnext.reflect.get-own-metadata-keys"],"core-js/features/reflect/get-own-property-descriptor":["es.reflect.get-own-property-descriptor"],"core-js/features/reflect/get-prototype-of":["es.reflect.get-prototype-of"],"core-js/features/reflect/has":["es.reflect.has"],"core-js/features/reflect/has-metadata":["esnext.reflect.has-metadata"],"core-js/features/reflect/has-own-metadata":["esnext.reflect.has-own-metadata"],"core-js/features/reflect/is-extensible":["es.reflect.is-extensible"],"core-js/features/reflect/metadata":["esnext.reflect.metadata"],"core-js/features/reflect/own-keys":["es.reflect.own-keys"],"core-js/features/reflect/prevent-extensions":["es.reflect.prevent-extensions"],"core-js/features/reflect/set":["es.reflect.set"],"core-js/features/reflect/set-prototype-of":["es.reflect.set-prototype-of"],"core-js/features/reflect/to-string-tag":["es.reflect.to-string-tag"],"core-js/features/regexp":["es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.string.match","es.string.replace","es.string.search","es.string.split"],"core-js/features/regexp/constructor":["es.regexp.constructor"],"core-js/features/regexp/flags":["es.regexp.flags"],"core-js/features/regexp/match":["es.string.match"],"core-js/features/regexp/replace":["es.string.replace"],"core-js/features/regexp/search":["es.string.search"],"core-js/features/regexp/split":["es.string.split"],"core-js/features/regexp/sticky":["es.regexp.sticky"],"core-js/features/regexp/test":["es.regexp.exec","es.regexp.test"],"core-js/features/regexp/to-string":["es.regexp.to-string"],"core-js/features/set":["es.object.to-string","es.set","es.string.iterator","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","web.dom-collections.iterator"],"core-js/features/set-immediate":["web.immediate"],"core-js/features/set-interval":["web.timers"],"core-js/features/set-timeout":["web.timers"],"core-js/features/set/add-all":["es.set","esnext.set.add-all"],"core-js/features/set/delete-all":["es.set","esnext.set.delete-all"],"core-js/features/set/difference":["es.set","es.string.iterator","esnext.set.difference","web.dom-collections.iterator"],"core-js/features/set/every":["es.set","esnext.set.every"],"core-js/features/set/filter":["es.set","esnext.set.filter"],"core-js/features/set/find":["es.set","esnext.set.find"],"core-js/features/set/from":["es.set","es.string.iterator","esnext.set.from","web.dom-collections.iterator"],"core-js/features/set/intersection":["es.set","esnext.set.intersection"],"core-js/features/set/is-disjoint-from":["es.set","esnext.set.is-disjoint-from"],"core-js/features/set/is-subset-of":["es.set","es.string.iterator","esnext.set.is-subset-of","web.dom-collections.iterator"],"core-js/features/set/is-superset-of":["es.set","esnext.set.is-superset-of"],"core-js/features/set/join":["es.set","esnext.set.join"],"core-js/features/set/map":["es.set","esnext.set.map"],"core-js/features/set/of":["es.set","es.string.iterator","esnext.set.of","web.dom-collections.iterator"],"core-js/features/set/reduce":["es.set","esnext.set.reduce"],"core-js/features/set/some":["es.set","esnext.set.some"],"core-js/features/set/symmetric-difference":["es.set","es.string.iterator","esnext.set.symmetric-difference","web.dom-collections.iterator"],"core-js/features/set/union":["es.set","es.string.iterator","esnext.set.union","web.dom-collections.iterator"],"core-js/features/string":["es.regexp.exec","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all"],"core-js/features/string/anchor":["es.string.anchor"],"core-js/features/string/at":["esnext.string.at"],"core-js/features/string/big":["es.string.big"],"core-js/features/string/blink":["es.string.blink"],"core-js/features/string/bold":["es.string.bold"],"core-js/features/string/code-point-at":["es.string.code-point-at"],"core-js/features/string/code-points":["esnext.string.code-points"],"core-js/features/string/ends-with":["es.string.ends-with"],"core-js/features/string/fixed":["es.string.fixed"],"core-js/features/string/fontcolor":["es.string.fontcolor"],"core-js/features/string/fontsize":["es.string.fontsize"],"core-js/features/string/from-code-point":["es.string.from-code-point"],"core-js/features/string/includes":["es.string.includes"],"core-js/features/string/italics":["es.string.italics"],"core-js/features/string/iterator":["es.string.iterator"],"core-js/features/string/link":["es.string.link"],"core-js/features/string/match":["es.regexp.exec","es.string.match"],"core-js/features/string/match-all":["es.string.match-all","esnext.string.match-all"],"core-js/features/string/pad-end":["es.string.pad-end"],"core-js/features/string/pad-start":["es.string.pad-start"],"core-js/features/string/raw":["es.string.raw"],"core-js/features/string/repeat":["es.string.repeat"],"core-js/features/string/replace":["es.regexp.exec","es.string.replace"],"core-js/features/string/replace-all":["es.string.replace-all","esnext.string.replace-all"],"core-js/features/string/search":["es.regexp.exec","es.string.search"],"core-js/features/string/small":["es.string.small"],"core-js/features/string/split":["es.regexp.exec","es.string.split"],"core-js/features/string/starts-with":["es.string.starts-with"],"core-js/features/string/strike":["es.string.strike"],"core-js/features/string/sub":["es.string.sub"],"core-js/features/string/sup":["es.string.sup"],"core-js/features/string/trim":["es.string.trim"],"core-js/features/string/trim-end":["es.string.trim-end"],"core-js/features/string/trim-left":["es.string.trim-start"],"core-js/features/string/trim-right":["es.string.trim-end"],"core-js/features/string/trim-start":["es.string.trim-start"],"core-js/features/string/virtual":["es.string.code-point-at","es.string.ends-with","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all"],"core-js/features/string/virtual/anchor":["es.string.anchor"],"core-js/features/string/virtual/at":["esnext.string.at"],"core-js/features/string/virtual/big":["es.string.big"],"core-js/features/string/virtual/blink":["es.string.blink"],"core-js/features/string/virtual/bold":["es.string.bold"],"core-js/features/string/virtual/code-point-at":["es.string.code-point-at"],"core-js/features/string/virtual/code-points":["esnext.string.code-points"],"core-js/features/string/virtual/ends-with":["es.string.ends-with"],"core-js/features/string/virtual/fixed":["es.string.fixed"],"core-js/features/string/virtual/fontcolor":["es.string.fontcolor"],"core-js/features/string/virtual/fontsize":["es.string.fontsize"],"core-js/features/string/virtual/includes":["es.string.includes"],"core-js/features/string/virtual/italics":["es.string.italics"],"core-js/features/string/virtual/iterator":["es.string.iterator"],"core-js/features/string/virtual/link":["es.string.link"],"core-js/features/string/virtual/match-all":["es.string.match-all","esnext.string.match-all"],"core-js/features/string/virtual/pad-end":["es.string.pad-end"],"core-js/features/string/virtual/pad-start":["es.string.pad-start"],"core-js/features/string/virtual/repeat":["es.string.repeat"],"core-js/features/string/virtual/replace-all":["es.string.replace-all","esnext.string.replace-all"],"core-js/features/string/virtual/small":["es.string.small"],"core-js/features/string/virtual/starts-with":["es.string.starts-with"],"core-js/features/string/virtual/strike":["es.string.strike"],"core-js/features/string/virtual/sub":["es.string.sub"],"core-js/features/string/virtual/sup":["es.string.sup"],"core-js/features/string/virtual/trim":["es.string.trim"],"core-js/features/string/virtual/trim-end":["es.string.trim-end"],"core-js/features/string/virtual/trim-left":["es.string.trim-start"],"core-js/features/string/virtual/trim-right":["es.string.trim-end"],"core-js/features/string/virtual/trim-start":["es.string.trim-start"],"core-js/features/symbol":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.array.concat","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all"],"core-js/features/symbol/async-dispose":["esnext.symbol.async-dispose"],"core-js/features/symbol/async-iterator":["es.symbol.async-iterator"],"core-js/features/symbol/description":["es.symbol.description"],"core-js/features/symbol/dispose":["esnext.symbol.dispose"],"core-js/features/symbol/for":["es.symbol"],"core-js/features/symbol/has-instance":["es.symbol.has-instance","es.function.has-instance"],"core-js/features/symbol/is-concat-spreadable":["es.symbol.is-concat-spreadable","es.array.concat"],"core-js/features/symbol/iterator":["es.symbol.iterator","es.string.iterator","web.dom-collections.iterator"],"core-js/features/symbol/key-for":["es.symbol"],"core-js/features/symbol/match":["es.symbol.match","es.string.match"],"core-js/features/symbol/match-all":["es.symbol.match-all","es.string.match-all"],"core-js/features/symbol/matcher":["esnext.symbol.matcher"],"core-js/features/symbol/metadata":["esnext.symbol.metadata"],"core-js/features/symbol/observable":["esnext.symbol.observable"],"core-js/features/symbol/pattern-match":["esnext.symbol.pattern-match"],"core-js/features/symbol/replace":["es.symbol.replace","es.string.replace"],"core-js/features/symbol/replace-all":["esnext.symbol.replace-all"],"core-js/features/symbol/search":["es.symbol.search","es.string.search"],"core-js/features/symbol/species":["es.symbol.species"],"core-js/features/symbol/split":["es.symbol.split","es.string.split"],"core-js/features/symbol/to-primitive":["es.symbol.to-primitive"],"core-js/features/symbol/to-string-tag":["es.symbol.to-string-tag","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/features/symbol/unscopables":["es.symbol.unscopables"],"core-js/features/typed-array":["es.map","es.object.to-string","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by"],"core-js/features/typed-array/at":["esnext.typed-array.at"],"core-js/features/typed-array/copy-within":["es.typed-array.copy-within"],"core-js/features/typed-array/entries":["es.typed-array.iterator"],"core-js/features/typed-array/every":["es.typed-array.every"],"core-js/features/typed-array/fill":["es.typed-array.fill"],"core-js/features/typed-array/filter":["es.typed-array.filter"],"core-js/features/typed-array/filter-out":["esnext.typed-array.filter-out"],"core-js/features/typed-array/find":["es.typed-array.find"],"core-js/features/typed-array/find-index":["es.typed-array.find-index"],"core-js/features/typed-array/find-last":["esnext.typed-array.find-last"],"core-js/features/typed-array/find-last-index":["esnext.typed-array.find-last-index"],"core-js/features/typed-array/float32-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/float64-array":["es.object.to-string","es.typed-array.float64-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/for-each":["es.typed-array.for-each"],"core-js/features/typed-array/from":["es.typed-array.from"],"core-js/features/typed-array/includes":["es.typed-array.includes"],"core-js/features/typed-array/index-of":["es.typed-array.index-of"],"core-js/features/typed-array/int16-array":["es.object.to-string","es.typed-array.int16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/int32-array":["es.object.to-string","es.typed-array.int32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/int8-array":["es.object.to-string","es.typed-array.int8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/iterator":["es.typed-array.iterator"],"core-js/features/typed-array/join":["es.typed-array.join"],"core-js/features/typed-array/keys":["es.typed-array.iterator"],"core-js/features/typed-array/last-index-of":["es.typed-array.last-index-of"],"core-js/features/typed-array/map":["es.typed-array.map"],"core-js/features/typed-array/of":["es.typed-array.of"],"core-js/features/typed-array/reduce":["es.typed-array.reduce"],"core-js/features/typed-array/reduce-right":["es.typed-array.reduce-right"],"core-js/features/typed-array/reverse":["es.typed-array.reverse"],"core-js/features/typed-array/set":["es.typed-array.set"],"core-js/features/typed-array/slice":["es.typed-array.slice"],"core-js/features/typed-array/some":["es.typed-array.some"],"core-js/features/typed-array/sort":["es.typed-array.sort"],"core-js/features/typed-array/subarray":["es.typed-array.subarray"],"core-js/features/typed-array/to-locale-string":["es.typed-array.to-locale-string"],"core-js/features/typed-array/to-string":["es.typed-array.to-string"],"core-js/features/typed-array/uint16-array":["es.object.to-string","es.typed-array.uint16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/uint32-array":["es.object.to-string","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/uint8-array":["es.object.to-string","es.typed-array.uint8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/uint8-clamped-array":["es.object.to-string","es.typed-array.uint8-clamped-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/unique-by":["es.map","esnext.typed-array.unique-by"],"core-js/features/typed-array/values":["es.typed-array.iterator"],"core-js/features/url":["web.url","web.url.to-json","web.url-search-params"],"core-js/features/url-search-params":["web.url-search-params"],"core-js/features/url/to-json":["web.url.to-json"],"core-js/features/weak-map":["es.object.to-string","es.weak-map","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","web.dom-collections.iterator"],"core-js/features/weak-map/delete-all":["es.weak-map","esnext.weak-map.delete-all"],"core-js/features/weak-map/emplace":["es.weak-map","esnext.weak-map.emplace"],"core-js/features/weak-map/from":["es.string.iterator","es.weak-map","esnext.weak-map.from","web.dom-collections.iterator"],"core-js/features/weak-map/of":["es.string.iterator","es.weak-map","esnext.weak-map.of","web.dom-collections.iterator"],"core-js/features/weak-map/upsert":["es.weak-map","esnext.weak-map.upsert"],"core-js/features/weak-set":["es.object.to-string","es.weak-set","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.iterator"],"core-js/features/weak-set/add-all":["es.weak-set","esnext.weak-set.add-all"],"core-js/features/weak-set/delete-all":["es.weak-set","esnext.weak-set.delete-all"],"core-js/features/weak-set/from":["es.string.iterator","es.weak-set","esnext.weak-set.from","web.dom-collections.iterator"],"core-js/features/weak-set/of":["es.string.iterator","es.weak-set","esnext.weak-set.of","web.dom-collections.iterator"],"core-js/modules/es.aggregate-error":["es.aggregate-error"],"core-js/modules/es.array-buffer.constructor":["es.array-buffer.constructor"],"core-js/modules/es.array-buffer.is-view":["es.array-buffer.is-view"],"core-js/modules/es.array-buffer.slice":["es.array-buffer.slice"],"core-js/modules/es.array.concat":["es.array.concat"],"core-js/modules/es.array.copy-within":["es.array.copy-within"],"core-js/modules/es.array.every":["es.array.every"],"core-js/modules/es.array.fill":["es.array.fill"],"core-js/modules/es.array.filter":["es.array.filter"],"core-js/modules/es.array.find":["es.array.find"],"core-js/modules/es.array.find-index":["es.array.find-index"],"core-js/modules/es.array.flat":["es.array.flat"],"core-js/modules/es.array.flat-map":["es.array.flat-map"],"core-js/modules/es.array.for-each":["es.array.for-each"],"core-js/modules/es.array.from":["es.array.from"],"core-js/modules/es.array.includes":["es.array.includes"],"core-js/modules/es.array.index-of":["es.array.index-of"],"core-js/modules/es.array.is-array":["es.array.is-array"],"core-js/modules/es.array.iterator":["es.array.iterator"],"core-js/modules/es.array.join":["es.array.join"],"core-js/modules/es.array.last-index-of":["es.array.last-index-of"],"core-js/modules/es.array.map":["es.array.map"],"core-js/modules/es.array.of":["es.array.of"],"core-js/modules/es.array.reduce":["es.array.reduce"],"core-js/modules/es.array.reduce-right":["es.array.reduce-right"],"core-js/modules/es.array.reverse":["es.array.reverse"],"core-js/modules/es.array.slice":["es.array.slice"],"core-js/modules/es.array.some":["es.array.some"],"core-js/modules/es.array.sort":["es.array.sort"],"core-js/modules/es.array.species":["es.array.species"],"core-js/modules/es.array.splice":["es.array.splice"],"core-js/modules/es.array.unscopables.flat":["es.array.unscopables.flat"],"core-js/modules/es.array.unscopables.flat-map":["es.array.unscopables.flat-map"],"core-js/modules/es.data-view":["es.data-view"],"core-js/modules/es.date.now":["es.date.now"],"core-js/modules/es.date.to-iso-string":["es.date.to-iso-string"],"core-js/modules/es.date.to-json":["es.date.to-json"],"core-js/modules/es.date.to-primitive":["es.date.to-primitive"],"core-js/modules/es.date.to-string":["es.date.to-string"],"core-js/modules/es.function.bind":["es.function.bind"],"core-js/modules/es.function.has-instance":["es.function.has-instance"],"core-js/modules/es.function.name":["es.function.name"],"core-js/modules/es.global-this":["es.global-this"],"core-js/modules/es.json.stringify":["es.json.stringify"],"core-js/modules/es.json.to-string-tag":["es.json.to-string-tag"],"core-js/modules/es.map":["es.map"],"core-js/modules/es.math.acosh":["es.math.acosh"],"core-js/modules/es.math.asinh":["es.math.asinh"],"core-js/modules/es.math.atanh":["es.math.atanh"],"core-js/modules/es.math.cbrt":["es.math.cbrt"],"core-js/modules/es.math.clz32":["es.math.clz32"],"core-js/modules/es.math.cosh":["es.math.cosh"],"core-js/modules/es.math.expm1":["es.math.expm1"],"core-js/modules/es.math.fround":["es.math.fround"],"core-js/modules/es.math.hypot":["es.math.hypot"],"core-js/modules/es.math.imul":["es.math.imul"],"core-js/modules/es.math.log10":["es.math.log10"],"core-js/modules/es.math.log1p":["es.math.log1p"],"core-js/modules/es.math.log2":["es.math.log2"],"core-js/modules/es.math.sign":["es.math.sign"],"core-js/modules/es.math.sinh":["es.math.sinh"],"core-js/modules/es.math.tanh":["es.math.tanh"],"core-js/modules/es.math.to-string-tag":["es.math.to-string-tag"],"core-js/modules/es.math.trunc":["es.math.trunc"],"core-js/modules/es.number.constructor":["es.number.constructor"],"core-js/modules/es.number.epsilon":["es.number.epsilon"],"core-js/modules/es.number.is-finite":["es.number.is-finite"],"core-js/modules/es.number.is-integer":["es.number.is-integer"],"core-js/modules/es.number.is-nan":["es.number.is-nan"],"core-js/modules/es.number.is-safe-integer":["es.number.is-safe-integer"],"core-js/modules/es.number.max-safe-integer":["es.number.max-safe-integer"],"core-js/modules/es.number.min-safe-integer":["es.number.min-safe-integer"],"core-js/modules/es.number.parse-float":["es.number.parse-float"],"core-js/modules/es.number.parse-int":["es.number.parse-int"],"core-js/modules/es.number.to-fixed":["es.number.to-fixed"],"core-js/modules/es.number.to-precision":["es.number.to-precision"],"core-js/modules/es.object.assign":["es.object.assign"],"core-js/modules/es.object.create":["es.object.create"],"core-js/modules/es.object.define-getter":["es.object.define-getter"],"core-js/modules/es.object.define-properties":["es.object.define-properties"],"core-js/modules/es.object.define-property":["es.object.define-property"],"core-js/modules/es.object.define-setter":["es.object.define-setter"],"core-js/modules/es.object.entries":["es.object.entries"],"core-js/modules/es.object.freeze":["es.object.freeze"],"core-js/modules/es.object.from-entries":["es.object.from-entries"],"core-js/modules/es.object.get-own-property-descriptor":["es.object.get-own-property-descriptor"],"core-js/modules/es.object.get-own-property-descriptors":["es.object.get-own-property-descriptors"],"core-js/modules/es.object.get-own-property-names":["es.object.get-own-property-names"],"core-js/modules/es.object.get-prototype-of":["es.object.get-prototype-of"],"core-js/modules/es.object.is":["es.object.is"],"core-js/modules/es.object.is-extensible":["es.object.is-extensible"],"core-js/modules/es.object.is-frozen":["es.object.is-frozen"],"core-js/modules/es.object.is-sealed":["es.object.is-sealed"],"core-js/modules/es.object.keys":["es.object.keys"],"core-js/modules/es.object.lookup-getter":["es.object.lookup-getter"],"core-js/modules/es.object.lookup-setter":["es.object.lookup-setter"],"core-js/modules/es.object.prevent-extensions":["es.object.prevent-extensions"],"core-js/modules/es.object.seal":["es.object.seal"],"core-js/modules/es.object.set-prototype-of":["es.object.set-prototype-of"],"core-js/modules/es.object.to-string":["es.object.to-string"],"core-js/modules/es.object.values":["es.object.values"],"core-js/modules/es.parse-float":["es.parse-float"],"core-js/modules/es.parse-int":["es.parse-int"],"core-js/modules/es.promise":["es.promise"],"core-js/modules/es.promise.all-settled":["es.promise.all-settled"],"core-js/modules/es.promise.any":["es.promise.any"],"core-js/modules/es.promise.finally":["es.promise.finally"],"core-js/modules/es.reflect.apply":["es.reflect.apply"],"core-js/modules/es.reflect.construct":["es.reflect.construct"],"core-js/modules/es.reflect.define-property":["es.reflect.define-property"],"core-js/modules/es.reflect.delete-property":["es.reflect.delete-property"],"core-js/modules/es.reflect.get":["es.reflect.get"],"core-js/modules/es.reflect.get-own-property-descriptor":["es.reflect.get-own-property-descriptor"],"core-js/modules/es.reflect.get-prototype-of":["es.reflect.get-prototype-of"],"core-js/modules/es.reflect.has":["es.reflect.has"],"core-js/modules/es.reflect.is-extensible":["es.reflect.is-extensible"],"core-js/modules/es.reflect.own-keys":["es.reflect.own-keys"],"core-js/modules/es.reflect.prevent-extensions":["es.reflect.prevent-extensions"],"core-js/modules/es.reflect.set":["es.reflect.set"],"core-js/modules/es.reflect.set-prototype-of":["es.reflect.set-prototype-of"],"core-js/modules/es.reflect.to-string-tag":["es.reflect.to-string-tag"],"core-js/modules/es.regexp.constructor":["es.regexp.constructor"],"core-js/modules/es.regexp.exec":["es.regexp.exec"],"core-js/modules/es.regexp.flags":["es.regexp.flags"],"core-js/modules/es.regexp.sticky":["es.regexp.sticky"],"core-js/modules/es.regexp.test":["es.regexp.test"],"core-js/modules/es.regexp.to-string":["es.regexp.to-string"],"core-js/modules/es.set":["es.set"],"core-js/modules/es.string.anchor":["es.string.anchor"],"core-js/modules/es.string.big":["es.string.big"],"core-js/modules/es.string.blink":["es.string.blink"],"core-js/modules/es.string.bold":["es.string.bold"],"core-js/modules/es.string.code-point-at":["es.string.code-point-at"],"core-js/modules/es.string.ends-with":["es.string.ends-with"],"core-js/modules/es.string.fixed":["es.string.fixed"],"core-js/modules/es.string.fontcolor":["es.string.fontcolor"],"core-js/modules/es.string.fontsize":["es.string.fontsize"],"core-js/modules/es.string.from-code-point":["es.string.from-code-point"],"core-js/modules/es.string.includes":["es.string.includes"],"core-js/modules/es.string.italics":["es.string.italics"],"core-js/modules/es.string.iterator":["es.string.iterator"],"core-js/modules/es.string.link":["es.string.link"],"core-js/modules/es.string.match":["es.string.match"],"core-js/modules/es.string.match-all":["es.string.match-all"],"core-js/modules/es.string.pad-end":["es.string.pad-end"],"core-js/modules/es.string.pad-start":["es.string.pad-start"],"core-js/modules/es.string.raw":["es.string.raw"],"core-js/modules/es.string.repeat":["es.string.repeat"],"core-js/modules/es.string.replace":["es.string.replace"],"core-js/modules/es.string.replace-all":["es.string.replace-all"],"core-js/modules/es.string.search":["es.string.search"],"core-js/modules/es.string.small":["es.string.small"],"core-js/modules/es.string.split":["es.string.split"],"core-js/modules/es.string.starts-with":["es.string.starts-with"],"core-js/modules/es.string.strike":["es.string.strike"],"core-js/modules/es.string.sub":["es.string.sub"],"core-js/modules/es.string.sup":["es.string.sup"],"core-js/modules/es.string.trim":["es.string.trim"],"core-js/modules/es.string.trim-end":["es.string.trim-end"],"core-js/modules/es.string.trim-start":["es.string.trim-start"],"core-js/modules/es.symbol":["es.symbol"],"core-js/modules/es.symbol.async-iterator":["es.symbol.async-iterator"],"core-js/modules/es.symbol.description":["es.symbol.description"],"core-js/modules/es.symbol.has-instance":["es.symbol.has-instance"],"core-js/modules/es.symbol.is-concat-spreadable":["es.symbol.is-concat-spreadable"],"core-js/modules/es.symbol.iterator":["es.symbol.iterator"],"core-js/modules/es.symbol.match":["es.symbol.match"],"core-js/modules/es.symbol.match-all":["es.symbol.match-all"],"core-js/modules/es.symbol.replace":["es.symbol.replace"],"core-js/modules/es.symbol.search":["es.symbol.search"],"core-js/modules/es.symbol.species":["es.symbol.species"],"core-js/modules/es.symbol.split":["es.symbol.split"],"core-js/modules/es.symbol.to-primitive":["es.symbol.to-primitive"],"core-js/modules/es.symbol.to-string-tag":["es.symbol.to-string-tag"],"core-js/modules/es.symbol.unscopables":["es.symbol.unscopables"],"core-js/modules/es.typed-array.copy-within":["es.typed-array.copy-within"],"core-js/modules/es.typed-array.every":["es.typed-array.every"],"core-js/modules/es.typed-array.fill":["es.typed-array.fill"],"core-js/modules/es.typed-array.filter":["es.typed-array.filter"],"core-js/modules/es.typed-array.find":["es.typed-array.find"],"core-js/modules/es.typed-array.find-index":["es.typed-array.find-index"],"core-js/modules/es.typed-array.float32-array":["es.typed-array.float32-array"],"core-js/modules/es.typed-array.float64-array":["es.typed-array.float64-array"],"core-js/modules/es.typed-array.for-each":["es.typed-array.for-each"],"core-js/modules/es.typed-array.from":["es.typed-array.from"],"core-js/modules/es.typed-array.includes":["es.typed-array.includes"],"core-js/modules/es.typed-array.index-of":["es.typed-array.index-of"],"core-js/modules/es.typed-array.int16-array":["es.typed-array.int16-array"],"core-js/modules/es.typed-array.int32-array":["es.typed-array.int32-array"],"core-js/modules/es.typed-array.int8-array":["es.typed-array.int8-array"],"core-js/modules/es.typed-array.iterator":["es.typed-array.iterator"],"core-js/modules/es.typed-array.join":["es.typed-array.join"],"core-js/modules/es.typed-array.last-index-of":["es.typed-array.last-index-of"],"core-js/modules/es.typed-array.map":["es.typed-array.map"],"core-js/modules/es.typed-array.of":["es.typed-array.of"],"core-js/modules/es.typed-array.reduce":["es.typed-array.reduce"],"core-js/modules/es.typed-array.reduce-right":["es.typed-array.reduce-right"],"core-js/modules/es.typed-array.reverse":["es.typed-array.reverse"],"core-js/modules/es.typed-array.set":["es.typed-array.set"],"core-js/modules/es.typed-array.slice":["es.typed-array.slice"],"core-js/modules/es.typed-array.some":["es.typed-array.some"],"core-js/modules/es.typed-array.sort":["es.typed-array.sort"],"core-js/modules/es.typed-array.subarray":["es.typed-array.subarray"],"core-js/modules/es.typed-array.to-locale-string":["es.typed-array.to-locale-string"],"core-js/modules/es.typed-array.to-string":["es.typed-array.to-string"],"core-js/modules/es.typed-array.uint16-array":["es.typed-array.uint16-array"],"core-js/modules/es.typed-array.uint32-array":["es.typed-array.uint32-array"],"core-js/modules/es.typed-array.uint8-array":["es.typed-array.uint8-array"],"core-js/modules/es.typed-array.uint8-clamped-array":["es.typed-array.uint8-clamped-array"],"core-js/modules/es.weak-map":["es.weak-map"],"core-js/modules/es.weak-set":["es.weak-set"],"core-js/modules/esnext.aggregate-error":["esnext.aggregate-error"],"core-js/modules/esnext.array.at":["esnext.array.at"],"core-js/modules/esnext.array.filter-out":["esnext.array.filter-out"],"core-js/modules/esnext.array.find-last":["esnext.array.find-last"],"core-js/modules/esnext.array.find-last-index":["esnext.array.find-last-index"],"core-js/modules/esnext.array.is-template-object":["esnext.array.is-template-object"],"core-js/modules/esnext.array.last-index":["esnext.array.last-index"],"core-js/modules/esnext.array.last-item":["esnext.array.last-item"],"core-js/modules/esnext.array.unique-by":["esnext.array.unique-by"],"core-js/modules/esnext.async-iterator.as-indexed-pairs":["esnext.async-iterator.as-indexed-pairs"],"core-js/modules/esnext.async-iterator.constructor":["esnext.async-iterator.constructor"],"core-js/modules/esnext.async-iterator.drop":["esnext.async-iterator.drop"],"core-js/modules/esnext.async-iterator.every":["esnext.async-iterator.every"],"core-js/modules/esnext.async-iterator.filter":["esnext.async-iterator.filter"],"core-js/modules/esnext.async-iterator.find":["esnext.async-iterator.find"],"core-js/modules/esnext.async-iterator.flat-map":["esnext.async-iterator.flat-map"],"core-js/modules/esnext.async-iterator.for-each":["esnext.async-iterator.for-each"],"core-js/modules/esnext.async-iterator.from":["esnext.async-iterator.from"],"core-js/modules/esnext.async-iterator.map":["esnext.async-iterator.map"],"core-js/modules/esnext.async-iterator.reduce":["esnext.async-iterator.reduce"],"core-js/modules/esnext.async-iterator.some":["esnext.async-iterator.some"],"core-js/modules/esnext.async-iterator.take":["esnext.async-iterator.take"],"core-js/modules/esnext.async-iterator.to-array":["esnext.async-iterator.to-array"],"core-js/modules/esnext.bigint.range":["esnext.bigint.range"],"core-js/modules/esnext.composite-key":["esnext.composite-key"],"core-js/modules/esnext.composite-symbol":["esnext.composite-symbol"],"core-js/modules/esnext.global-this":["esnext.global-this"],"core-js/modules/esnext.iterator.as-indexed-pairs":["esnext.iterator.as-indexed-pairs"],"core-js/modules/esnext.iterator.constructor":["esnext.iterator.constructor"],"core-js/modules/esnext.iterator.drop":["esnext.iterator.drop"],"core-js/modules/esnext.iterator.every":["esnext.iterator.every"],"core-js/modules/esnext.iterator.filter":["esnext.iterator.filter"],"core-js/modules/esnext.iterator.find":["esnext.iterator.find"],"core-js/modules/esnext.iterator.flat-map":["esnext.iterator.flat-map"],"core-js/modules/esnext.iterator.for-each":["esnext.iterator.for-each"],"core-js/modules/esnext.iterator.from":["esnext.iterator.from"],"core-js/modules/esnext.iterator.map":["esnext.iterator.map"],"core-js/modules/esnext.iterator.reduce":["esnext.iterator.reduce"],"core-js/modules/esnext.iterator.some":["esnext.iterator.some"],"core-js/modules/esnext.iterator.take":["esnext.iterator.take"],"core-js/modules/esnext.iterator.to-array":["esnext.iterator.to-array"],"core-js/modules/esnext.map.delete-all":["esnext.map.delete-all"],"core-js/modules/esnext.map.emplace":["esnext.map.emplace"],"core-js/modules/esnext.map.every":["esnext.map.every"],"core-js/modules/esnext.map.filter":["esnext.map.filter"],"core-js/modules/esnext.map.find":["esnext.map.find"],"core-js/modules/esnext.map.find-key":["esnext.map.find-key"],"core-js/modules/esnext.map.from":["esnext.map.from"],"core-js/modules/esnext.map.group-by":["esnext.map.group-by"],"core-js/modules/esnext.map.includes":["esnext.map.includes"],"core-js/modules/esnext.map.key-by":["esnext.map.key-by"],"core-js/modules/esnext.map.key-of":["esnext.map.key-of"],"core-js/modules/esnext.map.map-keys":["esnext.map.map-keys"],"core-js/modules/esnext.map.map-values":["esnext.map.map-values"],"core-js/modules/esnext.map.merge":["esnext.map.merge"],"core-js/modules/esnext.map.of":["esnext.map.of"],"core-js/modules/esnext.map.reduce":["esnext.map.reduce"],"core-js/modules/esnext.map.some":["esnext.map.some"],"core-js/modules/esnext.map.update":["esnext.map.update"],"core-js/modules/esnext.map.update-or-insert":["esnext.map.update-or-insert"],"core-js/modules/esnext.map.upsert":["esnext.map.upsert"],"core-js/modules/esnext.math.clamp":["esnext.math.clamp"],"core-js/modules/esnext.math.deg-per-rad":["esnext.math.deg-per-rad"],"core-js/modules/esnext.math.degrees":["esnext.math.degrees"],"core-js/modules/esnext.math.fscale":["esnext.math.fscale"],"core-js/modules/esnext.math.iaddh":["esnext.math.iaddh"],"core-js/modules/esnext.math.imulh":["esnext.math.imulh"],"core-js/modules/esnext.math.isubh":["esnext.math.isubh"],"core-js/modules/esnext.math.rad-per-deg":["esnext.math.rad-per-deg"],"core-js/modules/esnext.math.radians":["esnext.math.radians"],"core-js/modules/esnext.math.scale":["esnext.math.scale"],"core-js/modules/esnext.math.seeded-prng":["esnext.math.seeded-prng"],"core-js/modules/esnext.math.signbit":["esnext.math.signbit"],"core-js/modules/esnext.math.umulh":["esnext.math.umulh"],"core-js/modules/esnext.number.from-string":["esnext.number.from-string"],"core-js/modules/esnext.number.range":["esnext.number.range"],"core-js/modules/esnext.object.has-own":["esnext.object.has-own"],"core-js/modules/esnext.object.iterate-entries":["esnext.object.iterate-entries"],"core-js/modules/esnext.object.iterate-keys":["esnext.object.iterate-keys"],"core-js/modules/esnext.object.iterate-values":["esnext.object.iterate-values"],"core-js/modules/esnext.observable":["esnext.observable"],"core-js/modules/esnext.promise.all-settled":["esnext.promise.all-settled"],"core-js/modules/esnext.promise.any":["esnext.promise.any"],"core-js/modules/esnext.promise.try":["esnext.promise.try"],"core-js/modules/esnext.reflect.define-metadata":["esnext.reflect.define-metadata"],"core-js/modules/esnext.reflect.delete-metadata":["esnext.reflect.delete-metadata"],"core-js/modules/esnext.reflect.get-metadata":["esnext.reflect.get-metadata"],"core-js/modules/esnext.reflect.get-metadata-keys":["esnext.reflect.get-metadata-keys"],"core-js/modules/esnext.reflect.get-own-metadata":["esnext.reflect.get-own-metadata"],"core-js/modules/esnext.reflect.get-own-metadata-keys":["esnext.reflect.get-own-metadata-keys"],"core-js/modules/esnext.reflect.has-metadata":["esnext.reflect.has-metadata"],"core-js/modules/esnext.reflect.has-own-metadata":["esnext.reflect.has-own-metadata"],"core-js/modules/esnext.reflect.metadata":["esnext.reflect.metadata"],"core-js/modules/esnext.set.add-all":["esnext.set.add-all"],"core-js/modules/esnext.set.delete-all":["esnext.set.delete-all"],"core-js/modules/esnext.set.difference":["esnext.set.difference"],"core-js/modules/esnext.set.every":["esnext.set.every"],"core-js/modules/esnext.set.filter":["esnext.set.filter"],"core-js/modules/esnext.set.find":["esnext.set.find"],"core-js/modules/esnext.set.from":["esnext.set.from"],"core-js/modules/esnext.set.intersection":["esnext.set.intersection"],"core-js/modules/esnext.set.is-disjoint-from":["esnext.set.is-disjoint-from"],"core-js/modules/esnext.set.is-subset-of":["esnext.set.is-subset-of"],"core-js/modules/esnext.set.is-superset-of":["esnext.set.is-superset-of"],"core-js/modules/esnext.set.join":["esnext.set.join"],"core-js/modules/esnext.set.map":["esnext.set.map"],"core-js/modules/esnext.set.of":["esnext.set.of"],"core-js/modules/esnext.set.reduce":["esnext.set.reduce"],"core-js/modules/esnext.set.some":["esnext.set.some"],"core-js/modules/esnext.set.symmetric-difference":["esnext.set.symmetric-difference"],"core-js/modules/esnext.set.union":["esnext.set.union"],"core-js/modules/esnext.string.at":["esnext.string.at"],"core-js/modules/esnext.string.at-alternative":["esnext.string.at-alternative"],"core-js/modules/esnext.string.code-points":["esnext.string.code-points"],"core-js/modules/esnext.string.match-all":["esnext.string.match-all"],"core-js/modules/esnext.string.replace-all":["esnext.string.replace-all"],"core-js/modules/esnext.symbol.async-dispose":["esnext.symbol.async-dispose"],"core-js/modules/esnext.symbol.dispose":["esnext.symbol.dispose"],"core-js/modules/esnext.symbol.matcher":["esnext.symbol.matcher"],"core-js/modules/esnext.symbol.metadata":["esnext.symbol.metadata"],"core-js/modules/esnext.symbol.observable":["esnext.symbol.observable"],"core-js/modules/esnext.symbol.pattern-match":["esnext.symbol.pattern-match"],"core-js/modules/esnext.symbol.replace-all":["esnext.symbol.replace-all"],"core-js/modules/esnext.typed-array.at":["esnext.typed-array.at"],"core-js/modules/esnext.typed-array.filter-out":["esnext.typed-array.filter-out"],"core-js/modules/esnext.typed-array.find-last":["esnext.typed-array.find-last"],"core-js/modules/esnext.typed-array.find-last-index":["esnext.typed-array.find-last-index"],"core-js/modules/esnext.typed-array.unique-by":["esnext.typed-array.unique-by"],"core-js/modules/esnext.weak-map.delete-all":["esnext.weak-map.delete-all"],"core-js/modules/esnext.weak-map.emplace":["esnext.weak-map.emplace"],"core-js/modules/esnext.weak-map.from":["esnext.weak-map.from"],"core-js/modules/esnext.weak-map.of":["esnext.weak-map.of"],"core-js/modules/esnext.weak-map.upsert":["esnext.weak-map.upsert"],"core-js/modules/esnext.weak-set.add-all":["esnext.weak-set.add-all"],"core-js/modules/esnext.weak-set.delete-all":["esnext.weak-set.delete-all"],"core-js/modules/esnext.weak-set.from":["esnext.weak-set.from"],"core-js/modules/esnext.weak-set.of":["esnext.weak-set.of"],"core-js/modules/web.dom-collections.for-each":["web.dom-collections.for-each"],"core-js/modules/web.dom-collections.iterator":["web.dom-collections.iterator"],"core-js/modules/web.immediate":["web.immediate"],"core-js/modules/web.queue-microtask":["web.queue-microtask"],"core-js/modules/web.timers":["web.timers"],"core-js/modules/web.url":["web.url"],"core-js/modules/web.url-search-params":["web.url-search-params"],"core-js/modules/web.url.to-json":["web.url.to-json"],"core-js/proposals":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.url","web.url.to-json","web.url-search-params"],"core-js/proposals/accessible-object-hasownproperty":["esnext.object.has-own"],"core-js/proposals/array-filtering":["esnext.array.filter-out","esnext.typed-array.filter-out"],"core-js/proposals/array-find-from-last":["esnext.array.find-last","esnext.array.find-last-index","esnext.typed-array.find-last","esnext.typed-array.find-last-index"],"core-js/proposals/array-is-template-object":["esnext.array.is-template-object"],"core-js/proposals/array-last":["esnext.array.last-index","esnext.array.last-item"],"core-js/proposals/array-unique":["es.map","esnext.array.unique-by","esnext.typed-array.unique-by"],"core-js/proposals/collection-methods":["esnext.map.delete-all","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.set.add-all","esnext.set.delete-all","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.join","esnext.set.map","esnext.set.reduce","esnext.set.some","esnext.weak-map.delete-all","esnext.weak-set.add-all","esnext.weak-set.delete-all"],"core-js/proposals/collection-of-from":["esnext.map.from","esnext.map.of","esnext.set.from","esnext.set.of","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-set.from","esnext.weak-set.of"],"core-js/proposals/decorators":["esnext.symbol.metadata"],"core-js/proposals/efficient-64-bit-arithmetic":["esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.umulh"],"core-js/proposals/global-this":["esnext.global-this"],"core-js/proposals/iterator-helpers":["esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array"],"core-js/proposals/keys-composition":["esnext.composite-key","esnext.composite-symbol"],"core-js/proposals/map-update-or-insert":["esnext.map.emplace","esnext.map.update-or-insert","esnext.map.upsert","esnext.weak-map.emplace","esnext.weak-map.upsert"],"core-js/proposals/map-upsert":["esnext.map.emplace","esnext.map.update-or-insert","esnext.map.upsert","esnext.weak-map.emplace","esnext.weak-map.upsert"],"core-js/proposals/math-extensions":["esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale"],"core-js/proposals/math-signbit":["esnext.math.signbit"],"core-js/proposals/number-from-string":["esnext.number.from-string"],"core-js/proposals/number-range":["esnext.bigint.range","esnext.number.range"],"core-js/proposals/object-iteration":["esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values"],"core-js/proposals/observable":["esnext.observable","esnext.symbol.observable"],"core-js/proposals/pattern-matching":["esnext.symbol.matcher","esnext.symbol.pattern-match"],"core-js/proposals/promise-all-settled":["esnext.promise.all-settled"],"core-js/proposals/promise-any":["esnext.aggregate-error","esnext.promise.any"],"core-js/proposals/promise-try":["esnext.promise.try"],"core-js/proposals/reflect-metadata":["esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata"],"core-js/proposals/relative-indexing-method":["esnext.array.at","esnext.typed-array.at"],"core-js/proposals/seeded-random":["esnext.math.seeded-prng"],"core-js/proposals/set-methods":["esnext.set.difference","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.symmetric-difference","esnext.set.union"],"core-js/proposals/string-at":["esnext.string.at"],"core-js/proposals/string-code-points":["esnext.string.code-points"],"core-js/proposals/string-match-all":["esnext.string.match-all"],"core-js/proposals/string-replace-all":["esnext.string.replace-all","esnext.symbol.replace-all"],"core-js/proposals/url":["web.url","web.url.to-json","web.url-search-params"],"core-js/proposals/using-statement":["esnext.symbol.async-dispose","esnext.symbol.dispose"],"core-js/stable":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"core-js/stable/aggregate-error":["es.aggregate-error","es.string.iterator","esnext.aggregate-error","web.dom-collections.iterator"],"core-js/stable/array":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.string.iterator"],"core-js/stable/array-buffer":["es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.object.to-string"],"core-js/stable/array-buffer/constructor":["es.array-buffer.constructor","es.object.to-string"],"core-js/stable/array-buffer/is-view":["es.array-buffer.is-view"],"core-js/stable/array-buffer/slice":["es.array-buffer.slice"],"core-js/stable/array/concat":["es.array.concat"],"core-js/stable/array/copy-within":["es.array.copy-within"],"core-js/stable/array/entries":["es.array.iterator"],"core-js/stable/array/every":["es.array.every"],"core-js/stable/array/fill":["es.array.fill"],"core-js/stable/array/filter":["es.array.filter"],"core-js/stable/array/find":["es.array.find"],"core-js/stable/array/find-index":["es.array.find-index"],"core-js/stable/array/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/stable/array/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/stable/array/for-each":["es.array.for-each"],"core-js/stable/array/from":["es.array.from","es.string.iterator"],"core-js/stable/array/includes":["es.array.includes"],"core-js/stable/array/index-of":["es.array.index-of"],"core-js/stable/array/is-array":["es.array.is-array"],"core-js/stable/array/iterator":["es.array.iterator"],"core-js/stable/array/join":["es.array.join"],"core-js/stable/array/keys":["es.array.iterator"],"core-js/stable/array/last-index-of":["es.array.last-index-of"],"core-js/stable/array/map":["es.array.map"],"core-js/stable/array/of":["es.array.of"],"core-js/stable/array/reduce":["es.array.reduce"],"core-js/stable/array/reduce-right":["es.array.reduce-right"],"core-js/stable/array/reverse":["es.array.reverse"],"core-js/stable/array/slice":["es.array.slice"],"core-js/stable/array/some":["es.array.some"],"core-js/stable/array/sort":["es.array.sort"],"core-js/stable/array/splice":["es.array.splice"],"core-js/stable/array/values":["es.array.iterator"],"core-js/stable/array/virtual":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.includes","es.array.index-of","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map"],"core-js/stable/array/virtual/concat":["es.array.concat"],"core-js/stable/array/virtual/copy-within":["es.array.copy-within"],"core-js/stable/array/virtual/entries":["es.array.iterator"],"core-js/stable/array/virtual/every":["es.array.every"],"core-js/stable/array/virtual/fill":["es.array.fill"],"core-js/stable/array/virtual/filter":["es.array.filter"],"core-js/stable/array/virtual/find":["es.array.find"],"core-js/stable/array/virtual/find-index":["es.array.find-index"],"core-js/stable/array/virtual/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/stable/array/virtual/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/stable/array/virtual/for-each":["es.array.for-each"],"core-js/stable/array/virtual/includes":["es.array.includes"],"core-js/stable/array/virtual/index-of":["es.array.index-of"],"core-js/stable/array/virtual/iterator":["es.array.iterator"],"core-js/stable/array/virtual/join":["es.array.join"],"core-js/stable/array/virtual/keys":["es.array.iterator"],"core-js/stable/array/virtual/last-index-of":["es.array.last-index-of"],"core-js/stable/array/virtual/map":["es.array.map"],"core-js/stable/array/virtual/reduce":["es.array.reduce"],"core-js/stable/array/virtual/reduce-right":["es.array.reduce-right"],"core-js/stable/array/virtual/reverse":["es.array.reverse"],"core-js/stable/array/virtual/slice":["es.array.slice"],"core-js/stable/array/virtual/some":["es.array.some"],"core-js/stable/array/virtual/sort":["es.array.sort"],"core-js/stable/array/virtual/splice":["es.array.splice"],"core-js/stable/array/virtual/values":["es.array.iterator"],"core-js/stable/clear-immediate":["web.immediate"],"core-js/stable/data-view":["es.data-view","es.object.to-string"],"core-js/stable/date":["es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string"],"core-js/stable/date/now":["es.date.now"],"core-js/stable/date/to-iso-string":["es.date.to-iso-string","es.date.to-json"],"core-js/stable/date/to-json":["es.date.to-json"],"core-js/stable/date/to-primitive":["es.date.to-primitive"],"core-js/stable/date/to-string":["es.date.to-string"],"core-js/stable/dom-collections":["es.array.iterator","web.dom-collections.for-each","web.dom-collections.iterator"],"core-js/stable/dom-collections/for-each":["web.dom-collections.for-each"],"core-js/stable/dom-collections/iterator":["web.dom-collections.iterator"],"core-js/stable/function":["es.function.bind","es.function.has-instance","es.function.name"],"core-js/stable/function/bind":["es.function.bind"],"core-js/stable/function/has-instance":["es.function.has-instance"],"core-js/stable/function/name":["es.function.name"],"core-js/stable/function/virtual":["es.function.bind"],"core-js/stable/function/virtual/bind":["es.function.bind"],"core-js/stable/global-this":["es.global-this"],"core-js/stable/instance/bind":["es.function.bind"],"core-js/stable/instance/code-point-at":["es.string.code-point-at"],"core-js/stable/instance/concat":["es.array.concat"],"core-js/stable/instance/copy-within":["es.array.copy-within"],"core-js/stable/instance/ends-with":["es.string.ends-with"],"core-js/stable/instance/entries":["es.array.iterator","web.dom-collections.iterator"],"core-js/stable/instance/every":["es.array.every"],"core-js/stable/instance/fill":["es.array.fill"],"core-js/stable/instance/filter":["es.array.filter"],"core-js/stable/instance/find":["es.array.find"],"core-js/stable/instance/find-index":["es.array.find-index"],"core-js/stable/instance/flags":["es.regexp.flags"],"core-js/stable/instance/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/stable/instance/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/stable/instance/for-each":["es.array.for-each","web.dom-collections.iterator"],"core-js/stable/instance/includes":["es.array.includes","es.string.includes"],"core-js/stable/instance/index-of":["es.array.index-of"],"core-js/stable/instance/keys":["es.array.iterator","web.dom-collections.iterator"],"core-js/stable/instance/last-index-of":["es.array.last-index-of"],"core-js/stable/instance/map":["es.array.map"],"core-js/stable/instance/match-all":["es.string.match-all"],"core-js/stable/instance/pad-end":["es.string.pad-end"],"core-js/stable/instance/pad-start":["es.string.pad-start"],"core-js/stable/instance/reduce":["es.array.reduce"],"core-js/stable/instance/reduce-right":["es.array.reduce-right"],"core-js/stable/instance/repeat":["es.string.repeat"],"core-js/stable/instance/replace-all":["es.string.replace-all"],"core-js/stable/instance/reverse":["es.array.reverse"],"core-js/stable/instance/slice":["es.array.slice"],"core-js/stable/instance/some":["es.array.some"],"core-js/stable/instance/sort":["es.array.sort"],"core-js/stable/instance/splice":["es.array.splice"],"core-js/stable/instance/starts-with":["es.string.starts-with"],"core-js/stable/instance/trim":["es.string.trim"],"core-js/stable/instance/trim-end":["es.string.trim-end"],"core-js/stable/instance/trim-left":["es.string.trim-start"],"core-js/stable/instance/trim-right":["es.string.trim-end"],"core-js/stable/instance/trim-start":["es.string.trim-start"],"core-js/stable/instance/values":["es.array.iterator","web.dom-collections.iterator"],"core-js/stable/json":["es.json.stringify","es.json.to-string-tag"],"core-js/stable/json/stringify":["es.json.stringify"],"core-js/stable/json/to-string-tag":["es.json.to-string-tag"],"core-js/stable/map":["es.map","es.object.to-string","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/math":["es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc"],"core-js/stable/math/acosh":["es.math.acosh"],"core-js/stable/math/asinh":["es.math.asinh"],"core-js/stable/math/atanh":["es.math.atanh"],"core-js/stable/math/cbrt":["es.math.cbrt"],"core-js/stable/math/clz32":["es.math.clz32"],"core-js/stable/math/cosh":["es.math.cosh"],"core-js/stable/math/expm1":["es.math.expm1"],"core-js/stable/math/fround":["es.math.fround"],"core-js/stable/math/hypot":["es.math.hypot"],"core-js/stable/math/imul":["es.math.imul"],"core-js/stable/math/log10":["es.math.log10"],"core-js/stable/math/log1p":["es.math.log1p"],"core-js/stable/math/log2":["es.math.log2"],"core-js/stable/math/sign":["es.math.sign"],"core-js/stable/math/sinh":["es.math.sinh"],"core-js/stable/math/tanh":["es.math.tanh"],"core-js/stable/math/to-string-tag":["es.math.to-string-tag"],"core-js/stable/math/trunc":["es.math.trunc"],"core-js/stable/number":["es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision"],"core-js/stable/number/constructor":["es.number.constructor"],"core-js/stable/number/epsilon":["es.number.epsilon"],"core-js/stable/number/is-finite":["es.number.is-finite"],"core-js/stable/number/is-integer":["es.number.is-integer"],"core-js/stable/number/is-nan":["es.number.is-nan"],"core-js/stable/number/is-safe-integer":["es.number.is-safe-integer"],"core-js/stable/number/max-safe-integer":["es.number.max-safe-integer"],"core-js/stable/number/min-safe-integer":["es.number.min-safe-integer"],"core-js/stable/number/parse-float":["es.number.parse-float"],"core-js/stable/number/parse-int":["es.number.parse-int"],"core-js/stable/number/to-fixed":["es.number.to-fixed"],"core-js/stable/number/to-precision":["es.number.to-precision"],"core-js/stable/number/virtual":["es.number.to-fixed","es.number.to-precision"],"core-js/stable/number/virtual/to-fixed":["es.number.to-fixed"],"core-js/stable/number/virtual/to-precision":["es.number.to-precision"],"core-js/stable/object":["es.symbol","es.json.to-string-tag","es.math.to-string-tag","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.reflect.to-string-tag"],"core-js/stable/object/assign":["es.object.assign"],"core-js/stable/object/create":["es.object.create"],"core-js/stable/object/define-getter":["es.object.define-getter"],"core-js/stable/object/define-properties":["es.object.define-properties"],"core-js/stable/object/define-property":["es.object.define-property"],"core-js/stable/object/define-setter":["es.object.define-setter"],"core-js/stable/object/entries":["es.object.entries"],"core-js/stable/object/freeze":["es.object.freeze"],"core-js/stable/object/from-entries":["es.array.iterator","es.object.from-entries"],"core-js/stable/object/get-own-property-descriptor":["es.object.get-own-property-descriptor"],"core-js/stable/object/get-own-property-descriptors":["es.object.get-own-property-descriptors"],"core-js/stable/object/get-own-property-names":["es.object.get-own-property-names"],"core-js/stable/object/get-own-property-symbols":["es.symbol"],"core-js/stable/object/get-prototype-of":["es.object.get-prototype-of"],"core-js/stable/object/is":["es.object.is"],"core-js/stable/object/is-extensible":["es.object.is-extensible"],"core-js/stable/object/is-frozen":["es.object.is-frozen"],"core-js/stable/object/is-sealed":["es.object.is-sealed"],"core-js/stable/object/keys":["es.object.keys"],"core-js/stable/object/lookup-getter":["es.object.lookup-setter"],"core-js/stable/object/lookup-setter":["es.object.lookup-setter"],"core-js/stable/object/prevent-extensions":["es.object.prevent-extensions"],"core-js/stable/object/seal":["es.object.seal"],"core-js/stable/object/set-prototype-of":["es.object.set-prototype-of"],"core-js/stable/object/to-string":["es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/stable/object/values":["es.object.values"],"core-js/stable/parse-float":["es.parse-float"],"core-js/stable/parse-int":["es.parse-int"],"core-js/stable/promise":["es.aggregate-error","es.object.to-string","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/promise/all-settled":["es.promise","es.promise.all-settled","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/promise/any":["es.aggregate-error","es.promise","es.promise.any","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/promise/finally":["es.promise","es.promise.finally"],"core-js/stable/queue-microtask":["web.queue-microtask"],"core-js/stable/reflect":["es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag"],"core-js/stable/reflect/apply":["es.reflect.apply"],"core-js/stable/reflect/construct":["es.reflect.construct"],"core-js/stable/reflect/define-property":["es.reflect.define-property"],"core-js/stable/reflect/delete-property":["es.reflect.delete-property"],"core-js/stable/reflect/get":["es.reflect.get"],"core-js/stable/reflect/get-own-property-descriptor":["es.reflect.get-own-property-descriptor"],"core-js/stable/reflect/get-prototype-of":["es.reflect.get-prototype-of"],"core-js/stable/reflect/has":["es.reflect.has"],"core-js/stable/reflect/is-extensible":["es.reflect.is-extensible"],"core-js/stable/reflect/own-keys":["es.reflect.own-keys"],"core-js/stable/reflect/prevent-extensions":["es.reflect.prevent-extensions"],"core-js/stable/reflect/set":["es.reflect.set"],"core-js/stable/reflect/set-prototype-of":["es.reflect.set-prototype-of"],"core-js/stable/reflect/to-string-tag":["es.reflect.to-string-tag"],"core-js/stable/regexp":["es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.string.match","es.string.replace","es.string.search","es.string.split"],"core-js/stable/regexp/constructor":["es.regexp.constructor"],"core-js/stable/regexp/flags":["es.regexp.flags"],"core-js/stable/regexp/match":["es.string.match"],"core-js/stable/regexp/replace":["es.string.replace"],"core-js/stable/regexp/search":["es.string.search"],"core-js/stable/regexp/split":["es.string.split"],"core-js/stable/regexp/sticky":["es.regexp.sticky"],"core-js/stable/regexp/test":["es.regexp.exec","es.regexp.test"],"core-js/stable/regexp/to-string":["es.regexp.to-string"],"core-js/stable/set":["es.object.to-string","es.set","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/set-immediate":["web.immediate"],"core-js/stable/set-interval":["web.timers"],"core-js/stable/set-timeout":["web.timers"],"core-js/stable/string":["es.regexp.exec","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup"],"core-js/stable/string/anchor":["es.string.anchor"],"core-js/stable/string/big":["es.string.big"],"core-js/stable/string/blink":["es.string.blink"],"core-js/stable/string/bold":["es.string.bold"],"core-js/stable/string/code-point-at":["es.string.code-point-at"],"core-js/stable/string/ends-with":["es.string.ends-with"],"core-js/stable/string/fixed":["es.string.fixed"],"core-js/stable/string/fontcolor":["es.string.fontcolor"],"core-js/stable/string/fontsize":["es.string.fontsize"],"core-js/stable/string/from-code-point":["es.string.from-code-point"],"core-js/stable/string/includes":["es.string.includes"],"core-js/stable/string/italics":["es.string.italics"],"core-js/stable/string/iterator":["es.string.iterator"],"core-js/stable/string/link":["es.string.link"],"core-js/stable/string/match":["es.regexp.exec","es.string.match"],"core-js/stable/string/match-all":["es.string.match-all"],"core-js/stable/string/pad-end":["es.string.pad-end"],"core-js/stable/string/pad-start":["es.string.pad-start"],"core-js/stable/string/raw":["es.string.raw"],"core-js/stable/string/repeat":["es.string.repeat"],"core-js/stable/string/replace":["es.regexp.exec","es.string.replace"],"core-js/stable/string/replace-all":["es.string.replace-all"],"core-js/stable/string/search":["es.regexp.exec","es.string.search"],"core-js/stable/string/small":["es.string.small"],"core-js/stable/string/split":["es.regexp.exec","es.string.split"],"core-js/stable/string/starts-with":["es.string.starts-with"],"core-js/stable/string/strike":["es.string.strike"],"core-js/stable/string/sub":["es.string.sub"],"core-js/stable/string/sup":["es.string.sup"],"core-js/stable/string/trim":["es.string.trim"],"core-js/stable/string/trim-end":["es.string.trim-end"],"core-js/stable/string/trim-left":["es.string.trim-start"],"core-js/stable/string/trim-right":["es.string.trim-end"],"core-js/stable/string/trim-start":["es.string.trim-start"],"core-js/stable/string/virtual":["es.string.code-point-at","es.string.ends-with","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup"],"core-js/stable/string/virtual/anchor":["es.string.anchor"],"core-js/stable/string/virtual/big":["es.string.big"],"core-js/stable/string/virtual/blink":["es.string.blink"],"core-js/stable/string/virtual/bold":["es.string.bold"],"core-js/stable/string/virtual/code-point-at":["es.string.code-point-at"],"core-js/stable/string/virtual/ends-with":["es.string.ends-with"],"core-js/stable/string/virtual/fixed":["es.string.fixed"],"core-js/stable/string/virtual/fontcolor":["es.string.fontcolor"],"core-js/stable/string/virtual/fontsize":["es.string.fontsize"],"core-js/stable/string/virtual/includes":["es.string.includes"],"core-js/stable/string/virtual/italics":["es.string.italics"],"core-js/stable/string/virtual/iterator":["es.string.iterator"],"core-js/stable/string/virtual/link":["es.string.link"],"core-js/stable/string/virtual/match-all":["es.string.match-all"],"core-js/stable/string/virtual/pad-end":["es.string.pad-end"],"core-js/stable/string/virtual/pad-start":["es.string.pad-start"],"core-js/stable/string/virtual/repeat":["es.string.repeat"],"core-js/stable/string/virtual/replace-all":["es.string.replace-all"],"core-js/stable/string/virtual/small":["es.string.small"],"core-js/stable/string/virtual/starts-with":["es.string.starts-with"],"core-js/stable/string/virtual/strike":["es.string.strike"],"core-js/stable/string/virtual/sub":["es.string.sub"],"core-js/stable/string/virtual/sup":["es.string.sup"],"core-js/stable/string/virtual/trim":["es.string.trim"],"core-js/stable/string/virtual/trim-end":["es.string.trim-end"],"core-js/stable/string/virtual/trim-left":["es.string.trim-start"],"core-js/stable/string/virtual/trim-right":["es.string.trim-end"],"core-js/stable/string/virtual/trim-start":["es.string.trim-start"],"core-js/stable/symbol":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.array.concat","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/stable/symbol/async-iterator":["es.symbol.async-iterator"],"core-js/stable/symbol/description":["es.symbol.description"],"core-js/stable/symbol/for":["es.symbol"],"core-js/stable/symbol/has-instance":["es.symbol.has-instance","es.function.has-instance"],"core-js/stable/symbol/is-concat-spreadable":["es.symbol.is-concat-spreadable","es.array.concat"],"core-js/stable/symbol/iterator":["es.symbol.iterator","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/symbol/key-for":["es.symbol"],"core-js/stable/symbol/match":["es.symbol.match","es.string.match"],"core-js/stable/symbol/match-all":["es.symbol.match-all","es.string.match-all"],"core-js/stable/symbol/replace":["es.symbol.replace","es.string.replace"],"core-js/stable/symbol/search":["es.symbol.search","es.string.search"],"core-js/stable/symbol/species":["es.symbol.species"],"core-js/stable/symbol/split":["es.symbol.split","es.string.split"],"core-js/stable/symbol/to-primitive":["es.symbol.to-primitive"],"core-js/stable/symbol/to-string-tag":["es.symbol.to-string-tag","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/stable/symbol/unscopables":["es.symbol.unscopables"],"core-js/stable/typed-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/copy-within":["es.typed-array.copy-within"],"core-js/stable/typed-array/entries":["es.typed-array.iterator"],"core-js/stable/typed-array/every":["es.typed-array.every"],"core-js/stable/typed-array/fill":["es.typed-array.fill"],"core-js/stable/typed-array/filter":["es.typed-array.filter"],"core-js/stable/typed-array/find":["es.typed-array.find"],"core-js/stable/typed-array/find-index":["es.typed-array.find-index"],"core-js/stable/typed-array/float32-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/float64-array":["es.object.to-string","es.typed-array.float64-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/for-each":["es.typed-array.for-each"],"core-js/stable/typed-array/from":["es.typed-array.from"],"core-js/stable/typed-array/includes":["es.typed-array.includes"],"core-js/stable/typed-array/index-of":["es.typed-array.index-of"],"core-js/stable/typed-array/int16-array":["es.object.to-string","es.typed-array.int16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/int32-array":["es.object.to-string","es.typed-array.int32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/int8-array":["es.object.to-string","es.typed-array.int8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/iterator":["es.typed-array.iterator"],"core-js/stable/typed-array/join":["es.typed-array.join"],"core-js/stable/typed-array/keys":["es.typed-array.iterator"],"core-js/stable/typed-array/last-index-of":["es.typed-array.last-index-of"],"core-js/stable/typed-array/map":["es.typed-array.map"],"core-js/stable/typed-array/of":["es.typed-array.of"],"core-js/stable/typed-array/reduce":["es.typed-array.reduce"],"core-js/stable/typed-array/reduce-right":["es.typed-array.reduce-right"],"core-js/stable/typed-array/reverse":["es.typed-array.reverse"],"core-js/stable/typed-array/set":["es.typed-array.set"],"core-js/stable/typed-array/slice":["es.typed-array.slice"],"core-js/stable/typed-array/some":["es.typed-array.some"],"core-js/stable/typed-array/sort":["es.typed-array.sort"],"core-js/stable/typed-array/subarray":["es.typed-array.subarray"],"core-js/stable/typed-array/to-locale-string":["es.typed-array.to-locale-string"],"core-js/stable/typed-array/to-string":["es.typed-array.to-string"],"core-js/stable/typed-array/uint16-array":["es.object.to-string","es.typed-array.uint16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/uint32-array":["es.object.to-string","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/uint8-array":["es.object.to-string","es.typed-array.uint8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/uint8-clamped-array":["es.object.to-string","es.typed-array.uint8-clamped-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/values":["es.typed-array.iterator"],"core-js/stable/url":["web.url","web.url.to-json","web.url-search-params"],"core-js/stable/url-search-params":["web.url-search-params"],"core-js/stable/url/to-json":["web.url.to-json"],"core-js/stable/weak-map":["es.object.to-string","es.weak-map","web.dom-collections.iterator"],"core-js/stable/weak-set":["es.object.to-string","es.weak-set","web.dom-collections.iterator"],"core-js/stage":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.url","web.url.to-json","web.url-search-params"],"core-js/stage/0":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.url","web.url.to-json","web.url-search-params"],"core-js/stage/1":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of"],"core-js/stage/2":["esnext.aggregate-error","esnext.array.at","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.emplace","esnext.map.update-or-insert","esnext.map.upsert","esnext.object.has-own","esnext.promise.all-settled","esnext.promise.any","esnext.set.difference","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.symmetric-difference","esnext.set.union","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.metadata","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.weak-map.emplace","esnext.weak-map.upsert"],"core-js/stage/3":["esnext.aggregate-error","esnext.array.at","esnext.global-this","esnext.object.has-own","esnext.promise.all-settled","esnext.promise.any","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.replace-all","esnext.typed-array.at"],"core-js/stage/4":["esnext.aggregate-error","esnext.global-this","esnext.promise.all-settled","esnext.promise.any","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.replace-all"],"core-js/stage/pre":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.url","web.url.to-json","web.url-search-params"],"core-js/web":["web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"core-js/web/dom-collections":["web.dom-collections.for-each","web.dom-collections.iterator"],"core-js/web/immediate":["web.immediate"],"core-js/web/queue-microtask":["web.queue-microtask"],"core-js/web/timers":["web.timers"],"core-js/web/url":["web.url","web.url.to-json","web.url-search-params"],"core-js/web/url-search-params":["web.url-search-params"]}')},4970:e=>{"use strict";e.exports=JSON.parse('{"3.0":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","esnext.aggregate-error","esnext.array.last-index","esnext.array.last-item","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.map.delete-all","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.dispose","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"3.1":["es.string.match-all","es.symbol.match-all","esnext.symbol.replace-all"],"3.2":["es.promise.all-settled","esnext.array.is-template-object","esnext.map.update-or-insert","esnext.symbol.async-dispose"],"3.3":["es.global-this","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.upsert","esnext.weak-map.upsert"],"3.4":["es.json.stringify"],"3.5":["esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values"],"3.6":["es.regexp.sticky","es.regexp.test"],"3.7":["es.aggregate-error","es.promise.any","es.reflect.to-string-tag","es.string.replace-all","esnext.map.emplace","esnext.weak-map.emplace"],"3.8":["esnext.array.at","esnext.array.filter-out","esnext.array.unique-by","esnext.bigint.range","esnext.number.range","esnext.typed-array.at","esnext.typed-array.filter-out"],"3.9":["esnext.array.find-last","esnext.array.find-last-index","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by"],"3.11":["esnext.object.has-own"],"3.12":["esnext.symbol.matcher","esnext.symbol.metadata"]}')},2885:e=>{"use strict";e.exports=JSON.parse('["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"]')},6578:e=>{"use strict";e.exports=JSON.parse('{"es.symbol":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.symbol.description":{"android":"70","chrome":"70","deno":"1.0","edge":"74","electron":"5.0","firefox":"63","ios":"12.2","node":"11.0","opera":"57","opera_mobile":"49","safari":"12.1","samsung":"10.0"},"es.symbol.async-iterator":{"android":"63","chrome":"63","deno":"1.0","edge":"74","electron":"3.0","firefox":"55","ios":"12.0","node":"10.0","opera":"50","opera_mobile":"46","safari":"12.0","samsung":"8.0"},"es.symbol.has-instance":{"android":"50","chrome":"50","deno":"1.0","edge":"15","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.is-concat-spreadable":{"android":"48","chrome":"48","deno":"1.0","edge":"15","electron":"0.37","firefox":"48","ios":"10.0","node":"6.0","opera":"35","opera_mobile":"35","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.iterator":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"36","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.symbol.match":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"40","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.match-all":{"android":"73","chrome":"73","deno":"1.0","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.symbol.replace":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.search":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.species":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"41","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.split":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.to-primitive":{"android":"47","chrome":"47","deno":"1.0","edge":"15","electron":"0.36","firefox":"44","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.to-string-tag":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.unscopables":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"48","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.aggregate-error":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"es.array.concat":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.copy-within":{"android":"45","chrome":"45","deno":"1.0","edge":"12","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.every":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.array.fill":{"android":"45","chrome":"45","deno":"1.0","edge":"12","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.filter":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.find":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.find-index":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.flat":{"android":"69","chrome":"69","deno":"1.0","edge":"74","electron":"4.0","firefox":"62","ios":"12.0","node":"11.0","opera":"56","opera_mobile":"48","safari":"12.0","samsung":"10.0"},"es.array.flat-map":{"android":"69","chrome":"69","deno":"1.0","edge":"74","electron":"4.0","firefox":"62","ios":"12.0","node":"11.0","opera":"56","opera_mobile":"48","safari":"12.0","samsung":"10.0"},"es.array.for-each":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.array.from":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"9.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"9.0","samsung":"5.0"},"es.array.includes":{"android":"53","chrome":"53","deno":"1.0","edge":"14","electron":"1.4","firefox":"48","ios":"10.0","node":"7.0","opera":"40","opera_mobile":"40","safari":"10.0","samsung":"6.0"},"es.array.index-of":{"android":"51","chrome":"51","deno":"1.0","edge":"12","electron":"1.2","firefox":"4","ie":"9","ios":"8.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"7.1","samsung":"5.0"},"es.array.is-array":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"4.0","samsung":"1.0"},"es.array.iterator":{"android":"66","chrome":"66","deno":"1.0","edge":"15","electron":"3.0","firefox":"60","ios":"10.0","node":"10.0","opera":"53","opera_mobile":"47","safari":"10.0","samsung":"9.0"},"es.array.join":{"android":"4.4","chrome":"26","deno":"1.0","edge":"13","electron":"0.20","firefox":"4","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.array.last-index-of":{"android":"51","chrome":"51","deno":"1.0","edge":"12","electron":"1.2","firefox":"4","ie":"9","ios":"8.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"7.1","samsung":"5.0"},"es.array.map":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"50","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.of":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"25","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","rhino":"1.7.13","safari":"9.0","samsung":"5.0"},"es.array.reduce":{"android":"83","chrome":"83","deno":"1.0","edge":"12","electron":"9.0","firefox":"4","ie":"9","ios":"8.0","node":"6.0","opera":"69","opera_mobile":"59","rhino":"1.7.13","safari":"7.1","samsung":"13.0"},"es.array.reduce-right":{"android":"83","chrome":"83","deno":"1.0","edge":"12","electron":"9.0","firefox":"4","ie":"9","ios":"8.0","node":"6.0","opera":"69","opera_mobile":"59","rhino":"1.7.13","safari":"7.1","samsung":"13.0"},"es.array.reverse":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"5.5","ios":"12.2","node":"0.0.3","opera":"10.50","opera_mobile":"10.50","rhino":"1.7.13","safari":"12.0.2","samsung":"1.0"},"es.array.slice":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.some":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.array.sort":{"android":"70","chrome":"70","deno":"1.0","edge":"74","electron":"5.0","firefox":"4","ios":"12.0","node":"11.0","opera":"57","opera_mobile":"49","safari":"12.0","samsung":"10.0"},"es.array.species":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.splice":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.unscopables.flat":{"android":"73","chrome":"73","deno":"1.0","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.array.unscopables.flat-map":{"android":"73","chrome":"73","deno":"1.0","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.array-buffer.constructor":{"android":"4.4","chrome":"26","deno":"1.0","edge":"14","electron":"0.20","firefox":"44","ios":"12.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"12.0","samsung":"1.5"},"es.array-buffer.is-view":{"android":"4.4.3","chrome":"32","deno":"1.0","edge":"12","electron":"0.20","firefox":"29","ie":"11","ios":"8.0","node":"0.11.9","opera":"19","opera_mobile":"19","safari":"7.1","samsung":"2.0"},"es.array-buffer.slice":{"android":"4.4.3","chrome":"31","deno":"1.0","edge":"12","electron":"0.20","firefox":"46","ie":"11","ios":"12.2","node":"0.11.8","opera":"18","opera_mobile":"18","rhino":"1.7.13","safari":"12.1","samsung":"2.0"},"es.data-view":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"15","ie":"10","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.date.get-year":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"9","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.date.now":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ie":"9","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"4.0","samsung":"1.0"},"es.date.set-year":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"3","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.date.to-gmt-string":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"3","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.date.to-iso-string":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"7","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.date.to-json":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"10.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"10.0","samsung":"1.5"},"es.date.to-primitive":{"android":"47","chrome":"47","deno":"1.0","edge":"15","electron":"0.36","firefox":"44","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.date.to-string":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ie":"9","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.escape":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"3","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.function.bind":{"android":"3.0","chrome":"7","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.101","opera":"12","opera_mobile":"12","phantom":"2.0","rhino":"1.7.13","safari":"5.1","samsung":"1.0"},"es.function.has-instance":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"50","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.function.name":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"4.0","samsung":"1.0"},"es.global-this":{"android":"71","chrome":"71","deno":"1.0","edge":"74","electron":"5.0","firefox":"65","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"es.json.stringify":{"android":"72","chrome":"72","deno":"1.0","edge":"74","electron":"5.0","firefox":"64","ios":"12.2","node":"12.0","opera":"59","opera_mobile":"51","safari":"12.1","samsung":"11.0"},"es.json.to-string-tag":{"android":"50","chrome":"50","deno":"1.0","edge":"15","electron":"1.1","firefox":"51","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.map":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.math.acosh":{"android":"54","chrome":"54","deno":"1.0","edge":"13","electron":"1.4","firefox":"25","ios":"8.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"7.1","samsung":"6.0"},"es.math.asinh":{"android":"38","chrome":"38","deno":"1.0","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.atanh":{"android":"38","chrome":"38","deno":"1.0","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.cbrt":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.clz32":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"9.0","samsung":"3.0"},"es.math.cosh":{"android":"39","chrome":"39","deno":"1.0","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","rhino":"1.7.13","safari":"7.1","samsung":"3.4"},"es.math.expm1":{"android":"39","chrome":"39","deno":"1.0","edge":"13","electron":"0.20","firefox":"46","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","rhino":"1.7.13","safari":"7.1","samsung":"3.4"},"es.math.fround":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"26","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.hypot":{"android":"78","chrome":"78","deno":"1.0","edge":"12","electron":"7.0","firefox":"27","ios":"8.0","node":"13.0","opera":"65","opera_mobile":"56","rhino":"1.7.13","safari":"7.1","samsung":"12.0"},"es.math.imul":{"android":"4.4","chrome":"28","deno":"1.0","edge":"13","electron":"0.20","firefox":"20","ios":"9.0","node":"0.11.1","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"9.0","samsung":"1.5"},"es.math.log10":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.log1p":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.log2":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.sign":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"9.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"9.0","samsung":"3.0"},"es.math.sinh":{"android":"39","chrome":"39","deno":"1.0","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","rhino":"1.7.13","safari":"7.1","samsung":"3.4"},"es.math.tanh":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.to-string-tag":{"android":"50","chrome":"50","deno":"1.0","edge":"15","electron":"1.1","firefox":"51","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.math.trunc":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.number.constructor":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"46","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.number.epsilon":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.is-finite":{"android":"4.1","chrome":"19","deno":"1.0","edge":"12","electron":"0.20","firefox":"16","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","rhino":"1.7.13","safari":"9.0","samsung":"1.5"},"es.number.is-integer":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"16","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.number.is-nan":{"android":"4.1","chrome":"19","deno":"1.0","edge":"12","electron":"0.20","firefox":"15","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","rhino":"1.7.13","safari":"9.0","samsung":"1.5"},"es.number.is-safe-integer":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"32","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.number.max-safe-integer":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.number.min-safe-integer":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.number.parse-float":{"android":"37","chrome":"35","deno":"1.0","edge":"13","electron":"0.20","firefox":"39","ios":"11.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"11.0","samsung":"3.0"},"es.number.parse-int":{"android":"37","chrome":"35","deno":"1.0","edge":"13","electron":"0.20","firefox":"39","ios":"9.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"9.0","samsung":"3.0"},"es.number.to-fixed":{"android":"4.4","chrome":"26","deno":"1.0","edge":"74","electron":"0.20","firefox":"4","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.number.to-precision":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"8","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.object.assign":{"android":"49","chrome":"49","deno":"1.0","edge":"74","electron":"0.37","firefox":"36","ios":"9.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"9.0","samsung":"5.0"},"es.object.create":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"3.2","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"1.9","rhino":"1.7.13","safari":"4.0","samsung":"1.0"},"es.object.define-getter":{"android":"62","chrome":"62","deno":"1.0","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","rhino":"1.7.13","safari":"7.1","samsung":"8.0"},"es.object.define-properties":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"2.0","rhino":"1.7.13","safari":"5.1","samsung":"1.0"},"es.object.define-property":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"2.0","rhino":"1.7.13","safari":"5.1","samsung":"1.0"},"es.object.define-setter":{"android":"62","chrome":"62","deno":"1.0","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","rhino":"1.7.13","safari":"7.1","samsung":"8.0"},"es.object.entries":{"android":"54","chrome":"54","deno":"1.0","edge":"14","electron":"1.4","firefox":"47","ios":"10.3","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.1","samsung":"6.0"},"es.object.freeze":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.from-entries":{"android":"73","chrome":"73","deno":"1.0","edge":"74","electron":"5.0","firefox":"63","ios":"12.2","node":"12.0","opera":"60","opera_mobile":"52","safari":"12.1","samsung":"11.0"},"es.object.get-own-property-descriptor":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.get-own-property-descriptors":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"50","ios":"10.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.0","samsung":"6.0"},"es.object.get-own-property-names":{"android":"40","chrome":"40","deno":"1.0","edge":"13","electron":"0.21","firefox":"34","ios":"9.0","node":"1.0","opera":"27","opera_mobile":"27","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.object.get-prototype-of":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.is":{"android":"4.1","chrome":"19","deno":"1.0","edge":"12","electron":"0.20","firefox":"22","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","rhino":"1.7.13","safari":"9.0","samsung":"1.5"},"es.object.is-extensible":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.is-frozen":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.is-sealed":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.keys":{"android":"40","chrome":"40","deno":"1.0","edge":"13","electron":"0.21","firefox":"35","ios":"9.0","node":"1.0","opera":"27","opera_mobile":"27","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.object.lookup-getter":{"android":"62","chrome":"62","deno":"1.0","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","rhino":"1.7.13","safari":"7.1","samsung":"8.0"},"es.object.lookup-setter":{"android":"62","chrome":"62","deno":"1.0","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","rhino":"1.7.13","safari":"7.1","samsung":"8.0"},"es.object.prevent-extensions":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.seal":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.set-prototype-of":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"31","ie":"11","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.object.to-string":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.object.values":{"android":"54","chrome":"54","deno":"1.0","edge":"14","electron":"1.4","firefox":"47","ios":"10.3","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.1","samsung":"6.0"},"es.parse-float":{"android":"37","chrome":"35","deno":"1.0","edge":"12","electron":"0.20","firefox":"8","ie":"8","ios":"8.0","node":"0.11.13","opera":"22","opera_mobile":"22","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.parse-int":{"android":"37","chrome":"35","deno":"1.0","edge":"12","electron":"0.20","firefox":"21","ie":"9","ios":"8.0","node":"0.11.13","opera":"22","opera_mobile":"22","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.promise":{"android":"67","chrome":"67","deno":"1.0","edge":"74","electron":"4.0","firefox":"69","ios":"11.0","node":"10.4","opera":"54","opera_mobile":"48","safari":"11.0","samsung":"9.0"},"es.promise.all-settled":{"android":"76","chrome":"76","deno":"1.0","edge":"76","electron":"6.0","firefox":"71","ios":"13.0","node":"12.9","opera":"63","opera_mobile":"54","safari":"13","samsung":"12.0"},"es.promise.any":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"es.promise.finally":{"android":"67","chrome":"67","deno":"1.0","edge":"74","electron":"4.0","firefox":"69","ios":"13.2.3","node":"10.4","opera":"54","opera_mobile":"48","safari":"13.0.3","samsung":"9.0"},"es.reflect.apply":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.construct":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"44","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.define-property":{"android":"49","chrome":"49","deno":"1.0","edge":"13","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.delete-property":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get-own-property-descriptor":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get-prototype-of":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.has":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.is-extensible":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.own-keys":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.prevent-extensions":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.set":{"android":"49","chrome":"49","deno":"1.0","edge":"74","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.set-prototype-of":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.to-string-tag":{"android":"86","chrome":"86","deno":"1.3","edge":"86","electron":"11.0","firefox":"82","ios":"14.0","node":"15.0","opera":"72","opera_mobile":"61","safari":"14.0","samsung":"14.0"},"es.regexp.constructor":{"android":"64","chrome":"64","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"11.3","node":"10.0","opera":"51","opera_mobile":"47","safari":"11.1","samsung":"9.0"},"es.regexp.dot-all":{"android":"62","chrome":"62","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"11.3","node":"8.10","opera":"49","opera_mobile":"46","safari":"11.1","samsung":"8.0"},"es.regexp.exec":{"android":"64","chrome":"64","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"11.3","node":"10.0","opera":"51","opera_mobile":"47","safari":"11.1","samsung":"9.0"},"es.regexp.flags":{"android":"62","chrome":"62","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"11.3","node":"8.10","opera":"49","opera_mobile":"46","safari":"11.1","samsung":"8.0"},"es.regexp.sticky":{"android":"49","chrome":"49","deno":"1.0","edge":"13","electron":"0.37","firefox":"3","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.regexp.test":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"46","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.regexp.to-string":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"46","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.set":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.string.code-point-at":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"29","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.string.ends-with":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.from-code-point":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"29","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.string.includes":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.iterator":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"36","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.string.match":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.match-all":{"android":"80","chrome":"80","deno":"1.0","edge":"80","electron":"8.0","firefox":"73","ios":"13.4","node":"14.0","opera":"67","opera_mobile":"57","safari":"13.1","samsung":"13.0"},"es.string.pad-end":{"android":"57","chrome":"57","deno":"1.0","edge":"15","electron":"1.7","firefox":"48","ios":"11.0","node":"8.0","opera":"44","opera_mobile":"43","rhino":"1.7.13","safari":"11.0","samsung":"7.0"},"es.string.pad-start":{"android":"57","chrome":"57","deno":"1.0","edge":"15","electron":"1.7","firefox":"48","ios":"11.0","node":"8.0","opera":"44","opera_mobile":"43","rhino":"1.7.13","safari":"11.0","samsung":"7.0"},"es.string.raw":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"34","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.repeat":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"24","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.string.replace":{"android":"64","chrome":"64","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"14.0","node":"10.0","opera":"51","opera_mobile":"47","safari":"14.0","samsung":"9.0"},"es.string.replace-all":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"77","ios":"13.4","node":"15.0","opera":"71","opera_mobile":"60","safari":"13.1","samsung":"14.0"},"es.string.search":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.split":{"android":"54","chrome":"54","deno":"1.0","edge":"74","electron":"1.4","firefox":"49","ios":"10.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.0","samsung":"6.0"},"es.string.starts-with":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.substr":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"4","ios":"1.0","node":"0.0.3","opera":"4","opera_mobile":"4","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.string.trim":{"android":"59","chrome":"59","deno":"1.0","edge":"15","electron":"1.8","firefox":"52","ios":"12.2","node":"8.3","opera":"46","opera_mobile":"43","rhino":"1.7.13","safari":"12.1","samsung":"7.0"},"es.string.trim-end":{"android":"66","chrome":"66","deno":"1.0","edge":"74","electron":"3.0","firefox":"61","ios":"12.2","node":"10.0","opera":"53","opera_mobile":"47","safari":"12.1","samsung":"9.0"},"es.string.trim-start":{"android":"66","chrome":"66","deno":"1.0","edge":"74","electron":"3.0","firefox":"61","ios":"12.0","node":"10.0","opera":"53","opera_mobile":"47","safari":"12.0","samsung":"9.0"},"es.string.anchor":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.big":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.blink":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.bold":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.fixed":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.fontcolor":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.fontsize":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.italics":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.link":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.small":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.strike":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.sub":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.sup":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.typed-array.float32-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.float64-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int8-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int16-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int32-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint8-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint8-clamped-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint16-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint32-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.copy-within":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"34","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.every":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.fill":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.filter":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.find":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.find-index":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.for-each":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.from":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.includes":{"android":"49","chrome":"49","deno":"1.0","edge":"14","electron":"0.37","firefox":"43","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.typed-array.index-of":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.iterator":{"android":"47","chrome":"47","deno":"1.0","edge":"13","electron":"0.36","firefox":"37","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.typed-array.join":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.last-index-of":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.map":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.of":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.reduce":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.reduce-right":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.reverse":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.set":{"android":"4.4","chrome":"26","deno":"1.0","edge":"13","electron":"0.20","firefox":"15","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.typed-array.slice":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.some":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.sort":{"android":"74","chrome":"74","deno":"1.0","edge":"74","electron":"6.0","firefox":"67","ios":"14.5","node":"12.0","opera":"61","opera_mobile":"53","safari":"14.1","samsung":"11.0"},"es.typed-array.subarray":{"android":"4.4","chrome":"26","deno":"1.0","edge":"13","electron":"0.20","firefox":"15","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.typed-array.to-locale-string":{"android":"45","chrome":"45","deno":"1.0","edge":"74","electron":"0.31","firefox":"51","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.to-string":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"51","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.unescape":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"3","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.weak-map":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.weak-set":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"esnext.aggregate-error":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"esnext.array.at":{"android":"92","chrome":"92","deno":"1.12","edge":"92","electron":"14.0","firefox":"90","node":"16.6","opera":"78"},"esnext.array.filter-out":{},"esnext.array.filter-reject":{},"esnext.array.find-last":{},"esnext.array.find-last-index":{},"esnext.array.group-by":{},"esnext.array.is-template-object":{},"esnext.array.last-index":{},"esnext.array.last-item":{},"esnext.array.unique-by":{},"esnext.async-iterator.constructor":{},"esnext.async-iterator.as-indexed-pairs":{},"esnext.async-iterator.drop":{},"esnext.async-iterator.every":{},"esnext.async-iterator.filter":{},"esnext.async-iterator.find":{},"esnext.async-iterator.flat-map":{},"esnext.async-iterator.for-each":{},"esnext.async-iterator.from":{},"esnext.async-iterator.map":{},"esnext.async-iterator.reduce":{},"esnext.async-iterator.some":{},"esnext.async-iterator.take":{},"esnext.async-iterator.to-array":{},"esnext.bigint.range":{},"esnext.composite-key":{},"esnext.composite-symbol":{},"esnext.global-this":{"android":"71","chrome":"71","deno":"1.0","edge":"74","electron":"5.0","firefox":"65","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"esnext.iterator.constructor":{},"esnext.iterator.as-indexed-pairs":{},"esnext.iterator.drop":{},"esnext.iterator.every":{},"esnext.iterator.filter":{},"esnext.iterator.find":{},"esnext.iterator.flat-map":{},"esnext.iterator.for-each":{},"esnext.iterator.from":{},"esnext.iterator.map":{},"esnext.iterator.reduce":{},"esnext.iterator.some":{},"esnext.iterator.take":{},"esnext.iterator.to-array":{},"esnext.map.delete-all":{},"esnext.map.emplace":{},"esnext.map.every":{},"esnext.map.filter":{},"esnext.map.find":{},"esnext.map.find-key":{},"esnext.map.from":{},"esnext.map.group-by":{},"esnext.map.includes":{},"esnext.map.key-by":{},"esnext.map.key-of":{},"esnext.map.map-keys":{},"esnext.map.map-values":{},"esnext.map.merge":{},"esnext.map.of":{},"esnext.map.reduce":{},"esnext.map.some":{},"esnext.map.update":{},"esnext.map.update-or-insert":{},"esnext.map.upsert":{},"esnext.math.clamp":{},"esnext.math.deg-per-rad":{},"esnext.math.degrees":{},"esnext.math.fscale":{},"esnext.math.iaddh":{},"esnext.math.imulh":{},"esnext.math.isubh":{},"esnext.math.rad-per-deg":{},"esnext.math.radians":{},"esnext.math.scale":{},"esnext.math.seeded-prng":{},"esnext.math.signbit":{},"esnext.math.umulh":{},"esnext.number.from-string":{},"esnext.number.range":{},"esnext.object.has-own":{"android":"93","chrome":"93","deno":"1.13","edge":"93","electron":"14.0","firefox":"92","opera":"79"},"esnext.object.iterate-entries":{},"esnext.object.iterate-keys":{},"esnext.object.iterate-values":{},"esnext.observable":{},"esnext.promise.all-settled":{"android":"76","chrome":"76","deno":"1.0","edge":"76","electron":"6.0","firefox":"71","ios":"13.0","node":"12.9","opera":"63","opera_mobile":"54","safari":"13","samsung":"12.0"},"esnext.promise.any":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"esnext.promise.try":{},"esnext.reflect.define-metadata":{},"esnext.reflect.delete-metadata":{},"esnext.reflect.get-metadata":{},"esnext.reflect.get-metadata-keys":{},"esnext.reflect.get-own-metadata":{},"esnext.reflect.get-own-metadata-keys":{},"esnext.reflect.has-metadata":{},"esnext.reflect.has-own-metadata":{},"esnext.reflect.metadata":{},"esnext.set.add-all":{},"esnext.set.delete-all":{},"esnext.set.difference":{},"esnext.set.every":{},"esnext.set.filter":{},"esnext.set.find":{},"esnext.set.from":{},"esnext.set.intersection":{},"esnext.set.is-disjoint-from":{},"esnext.set.is-subset-of":{},"esnext.set.is-superset-of":{},"esnext.set.join":{},"esnext.set.map":{},"esnext.set.of":{},"esnext.set.reduce":{},"esnext.set.some":{},"esnext.set.symmetric-difference":{},"esnext.set.union":{},"esnext.string.at":{},"esnext.string.code-points":{},"esnext.string.match-all":{"android":"80","chrome":"80","deno":"1.0","edge":"80","electron":"8.0","firefox":"73","ios":"13.4","node":"14.0","opera":"67","opera_mobile":"57","safari":"13.1","samsung":"13.0"},"esnext.string.replace-all":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"77","ios":"13.4","node":"15.0","opera":"71","opera_mobile":"60","safari":"13.1","samsung":"14.0"},"esnext.symbol.async-dispose":{},"esnext.symbol.dispose":{},"esnext.symbol.matcher":{},"esnext.symbol.metadata":{},"esnext.symbol.observable":{},"esnext.symbol.pattern-match":{},"esnext.symbol.replace-all":{},"esnext.typed-array.at":{"android":"92","chrome":"92","deno":"1.12","edge":"92","electron":"14.0","firefox":"90","node":"16.6","opera":"78"},"esnext.typed-array.filter-out":{},"esnext.typed-array.filter-reject":{},"esnext.typed-array.find-last":{},"esnext.typed-array.find-last-index":{},"esnext.typed-array.group-by":{},"esnext.typed-array.unique-by":{},"esnext.weak-map.delete-all":{},"esnext.weak-map.from":{},"esnext.weak-map.of":{},"esnext.weak-map.emplace":{},"esnext.weak-map.upsert":{},"esnext.weak-set.add-all":{},"esnext.weak-set.delete-all":{},"esnext.weak-set.from":{},"esnext.weak-set.of":{},"web.dom-collections.for-each":{"android":"58","chrome":"58","deno":"1.0","edge":"16","electron":"1.7","firefox":"50","ios":"10.0","node":"0.0.1","opera":"45","opera_mobile":"43","rhino":"1.7.13","safari":"10.0","samsung":"7.0"},"web.dom-collections.iterator":{"android":"66","chrome":"66","deno":"1.0","edge":"74","electron":"3.0","firefox":"60","ios":"13.4","node":"0.0.1","opera":"53","opera_mobile":"47","rhino":"1.7.13","safari":"13.1","samsung":"9.0"},"web.immediate":{"ie":"10","node":"0.9.1"},"web.queue-microtask":{"android":"71","chrome":"71","deno":"1.0","edge":"74","electron":"5.0","firefox":"69","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"web.timers":{"android":"1.5","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"10","ios":"1.0","node":"0.0.1","opera":"7","opera_mobile":"7","phantom":"1.9","rhino":"1.7.13","safari":"1.0","samsung":"1.0"},"web.url":{"android":"67","chrome":"67","deno":"1.0","edge":"74","electron":"4.0","firefox":"57","ios":"14.0","node":"10.0","opera":"54","opera_mobile":"48","safari":"14.0","samsung":"9.0"},"web.url.to-json":{"android":"71","chrome":"71","deno":"1.0","edge":"74","electron":"5.0","firefox":"57","ios":"14.0","node":"10.0","opera":"58","opera_mobile":"50","safari":"14.0","samsung":"10.0"},"web.url-search-params":{"android":"67","chrome":"67","deno":"1.0","edge":"74","electron":"4.0","firefox":"57","ios":"14.0","node":"10.0","opera":"54","opera_mobile":"48","safari":"14.0","samsung":"9.0"}}')},4503:e=>{"use strict";e.exports=JSON.parse('{"assert":true,"assert/strict":">= 15","async_hooks":">= 8","buffer_ieee754":"< 0.9.7","buffer":true,"child_process":true,"cluster":true,"console":true,"constants":true,"crypto":true,"_debug_agent":">= 1 && < 8","_debugger":"< 8","dgram":true,"diagnostics_channel":">= 15.1","dns":true,"dns/promises":">= 15","domain":">= 0.7.12","events":true,"freelist":"< 6","fs":true,"fs/promises":[">= 10 && < 10.1",">= 14"],"_http_agent":">= 0.11.1","_http_client":">= 0.11.1","_http_common":">= 0.11.1","_http_incoming":">= 0.11.1","_http_outgoing":">= 0.11.1","_http_server":">= 0.11.1","http":true,"http2":">= 8.8","https":true,"inspector":">= 8.0.0","_linklist":"< 8","module":true,"net":true,"node-inspect/lib/_inspect":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6.0 && < 12","os":true,"path":true,"path/posix":">= 15.3","path/win32":">= 15.3","perf_hooks":">= 8.5","process":">= 1","punycode":true,"querystring":true,"readline":true,"repl":true,"smalloc":">= 0.11.5 && < 3","_stream_duplex":">= 0.9.4","_stream_transform":">= 0.9.4","_stream_wrap":">= 1.4.1","_stream_passthrough":">= 0.9.4","_stream_readable":">= 0.9.4","_stream_writable":">= 0.9.4","stream":true,"stream/promises":">= 15","string_decoder":true,"sys":[">= 0.6 && < 0.7",">= 0.8"],"timers":true,"timers/promises":">= 15","_tls_common":">= 0.11.13","_tls_legacy":">= 0.11.3 && < 10","_tls_wrap":">= 0.11.3","tls":true,"trace_events":">= 10","tty":true,"url":true,"util":true,"util/types":">= 15.3","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/consarray":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/csvparser":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/logreader":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/profile_view":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/splaytree":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8":">= 1","vm":true,"wasi":">= 13.4 && < 13.5","worker_threads":">= 11.7","zlib":true}')}};var t={};function __nccwpck_require__(r){var s=t[r];if(s!==undefined){return s.exports}var a=t[r]={id:r,loaded:false,exports:{}};var n=true;try{e[r].call(a.exports,a,a.exports,__nccwpck_require__);n=false}finally{if(n)delete t[r]}a.loaded=true;return a.exports}(()=>{__nccwpck_require__.nmd=e=>{e.paths=[];if(!e.children)e.children=[];return e}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(3812);module.exports=r})(); \ No newline at end of file + `):a.importDeclaration([a.importSpecifier(i,s)],t),name:i.name}}))},injectDefaultImport(t,s=t){return e.storeNamed(r,t,"default",((e,t)=>{const o=r.scope.generateUidIdentifier(s);return{node:e?hoist(n.statement.ast`var ${o} = require(${t})`):a.importDeclaration([a.importDefaultSpecifier(o)],t),name:o.name}}))}}}}},1783:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=r(3508);var _default=e=>({ImportDeclaration(t){const r=(0,s.getImportSource)(t);if(!r)return;e({kind:"import",source:r},t)},Program(t){t.get("body").forEach((t=>{const r=(0,s.getRequireSource)(t);if(!r)return;e({kind:"import",source:r},t)}))}});t["default"]=_default},7107:(e,t,r)=>{"use strict";t.__esModule=true;t.entry=t.usage=void 0;var s=_interopRequireDefault(r(8985));t.usage=s.default;var a=_interopRequireDefault(r(1783));t.entry=a.default;function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}},8985:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=r(3508);var _default=e=>{function property(t,r,s,a){return e({kind:"property",object:t,key:r,placement:s},a)}return{ReferencedIdentifier(t){const{node:{name:r},scope:s}=t;if(s.getBindingIdentifier(r))return;e({kind:"global",name:r},t)},MemberExpression(e){const t=(0,s.resolveKey)(e.get("property"),e.node.computed);if(!t||t==="prototype")return;const r=e.get("object");const a=r.scope.getBinding(r.node.name);if(a&&a.path.isImportNamespaceSpecifier())return;const n=(0,s.resolveSource)(r);return property(n.id,t,n.placement,e)},ObjectPattern(e){const{parentPath:t,parent:r}=e;let a;if(t.isVariableDeclarator()){a=t.get("init")}else if(t.isAssignmentExpression()){a=t.get("right")}else if(t.isFunction()){const s=t.parentPath;if(s.isCallExpression()||s.isNewExpression()){if(s.node.callee===r){a=s.get("arguments")[e.key]}}}let n=null;let o=null;if(a)({id:n,placement:o}=(0,s.resolveSource)(a));for(const t of e.get("properties")){if(t.isObjectProperty()){const e=(0,s.resolveKey)(t.get("key"));if(e)property(n,e,o,t)}}},BinaryExpression(t){if(t.node.operator!=="in")return;const r=(0,s.resolveSource)(t.get("right"));const a=(0,s.resolveKey)(t.get("left"),true);if(!a)return;e({kind:"in",object:r.id,key:a,placement:r.placement},t)}}};t["default"]=_default},8828:(e,t,r)=>{e.exports=r(935)},3039:(e,t,r)=>{e.exports=r(4323)},1532:(e,t,r)=>{e.exports=r(8374)},9396:(e,t,r)=>{"use strict";t.__esModule=true;t.CommonInstanceDependencies=t.InstanceProperties=t.StaticProperties=t.BuiltIns=t.PromiseDependenciesWithIterators=t.PromiseDependencies=t.CommonIterators=void 0;var s=_interopRequireDefault(r(8828));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const a={};Object.keys(s.default).forEach(((e,t)=>{a[e]=t}));const define=(e,t,r=t[0],s)=>({name:r,pure:e,global:t.sort(((e,t)=>a[e]-a[t])),exclude:s});const typed=e=>define(null,[e,...c]);const n=["es.array.iterator","web.dom-collections.iterator"];const o=["es.string.iterator",...n];t.CommonIterators=o;const i=["es.object.to-string",...n];const l=["es.object.to-string",...o];const c=["es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.object.to-string","es.array.iterator","es.array-buffer.slice"];const u={from:define(null,["es.typed-array.from"]),of:define(null,["es.typed-array.of"])};const p=["es.promise","es.object.to-string"];t.PromiseDependencies=p;const d=[...p,...o];t.PromiseDependenciesWithIterators=d;const f=["es.symbol","es.symbol.description","es.object.to-string"];const m=["es.map","esnext.map.delete-all","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.includes","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.reduce","esnext.map.some","esnext.map.update",...l];const y=["es.set","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union",...l];const g=["es.weak-map","esnext.weak-map.delete-all",...l];const h=["es.weak-set","esnext.weak-set.add-all","esnext.weak-set.delete-all",...l];const b=["web.url",...l];const x={AggregateError:define("aggregate-error",["esnext.aggregate-error",...o]),ArrayBuffer:define(null,["es.array-buffer.constructor","es.array-buffer.slice","es.object.to-string"]),DataView:define(null,["es.data-view","es.array-buffer.slice","es.object.to-string"]),Date:define(null,["es.date.to-string"]),Float32Array:typed("es.typed-array.float32-array"),Float64Array:typed("es.typed-array.float64-array"),Int8Array:typed("es.typed-array.int8-array"),Int16Array:typed("es.typed-array.int16-array"),Int32Array:typed("es.typed-array.int32-array"),Uint8Array:typed("es.typed-array.uint8-array"),Uint8ClampedArray:typed("es.typed-array.uint8-clamped-array"),Uint16Array:typed("es.typed-array.uint16-array"),Uint32Array:typed("es.typed-array.uint32-array"),Map:define("map/index",m),Number:define(null,["es.number.constructor"]),Observable:define("observable/index",["esnext.observable","esnext.symbol.observable","es.object.to-string",...l]),Promise:define("promise/index",p),RegExp:define(null,["es.regexp.constructor","es.regexp.exec","es.regexp.to-string"]),Set:define("set/index",y),Symbol:define("symbol/index",f),URL:define("url/index",["web.url",...b]),URLSearchParams:define("url-search-params/index",b),WeakMap:define("weak-map/index",g),WeakSet:define("weak-set/index",h),clearImmediate:define("clear-immediate",["web.immediate"]),compositeKey:define("composite-key",["esnext.composite-key"]),compositeSymbol:define("composite-symbol",["esnext.composite-symbol"]),fetch:define(null,p),globalThis:define("global-this",["es.global-this"]),parseFloat:define("parse-float",["es.parse-float"]),parseInt:define("parse-int",["es.parse-int"]),queueMicrotask:define("queue-microtask",["web.queue-microtask"]),setImmediate:define("set-immediate",["web.immediate"]),setInterval:define("set-interval",["web.timers"]),setTimeout:define("set-timeout",["web.timers"])};t.BuiltIns=x;const v={Array:{from:define("array/from",["es.array.from","es.string.iterator"]),isArray:define("array/is-array",["es.array.is-array"]),of:define("array/of",["es.array.of"])},ArrayBuffer:{isView:define(null,["es.array-buffer.is-view"])},Date:{now:define("date/now",["es.date.now"])},JSON:{stringify:define("json/stringify",[],"es.symbol")},Math:{DEG_PER_RAD:define("math/deg-per-rad",["esnext.math.deg-per-rad"]),RAD_PER_DEG:define("math/rad-per-deg",["esnext.math.rad-per-deg"]),acosh:define("math/acosh",["es.math.acosh"]),asinh:define("math/asinh",["es.math.asinh"]),atanh:define("math/atanh",["es.math.atanh"]),cbrt:define("math/cbrt",["es.math.cbrt"]),clamp:define("math/clamp",["esnext.math.clamp"]),clz32:define("math/clz32",["es.math.clz32"]),cosh:define("math/cosh",["es.math.cosh"]),degrees:define("math/degrees",["esnext.math.degrees"]),expm1:define("math/expm1",["es.math.expm1"]),fround:define("math/fround",["es.math.fround"]),fscale:define("math/fscale",["esnext.math.fscale"]),hypot:define("math/hypot",["es.math.hypot"]),iaddh:define("math/iaddh",["esnext.math.iaddh"]),imul:define("math/imul",["es.math.imul"]),imulh:define("math/imulh",["esnext.math.imulh"]),isubh:define("math/isubh",["esnext.math.isubh"]),log10:define("math/log10",["es.math.log10"]),log1p:define("math/log1p",["es.math.log1p"]),log2:define("math/log2",["es.math.log2"]),radians:define("math/radians",["esnext.math.radians"]),scale:define("math/scale",["esnext.math.scale"]),seededPRNG:define("math/seeded-prng",["esnext.math.seeded-prng"]),sign:define("math/sign",["es.math.sign"]),signbit:define("math/signbit",["esnext.math.signbit"]),sinh:define("math/sinh",["es.math.sinh"]),tanh:define("math/tanh",["es.math.tanh"]),trunc:define("math/trunc",["es.math.trunc"]),umulh:define("math/umulh",["esnext.math.umulh"])},Map:{from:define(null,["esnext.map.from",...m]),groupBy:define(null,["esnext.map.group-by",...m]),keyBy:define(null,["esnext.map.key-by",...m]),of:define(null,["esnext.map.of",...m])},Number:{EPSILON:define("number/epsilon",["es.number.epsilon"]),MAX_SAFE_INTEGER:define("number/max-safe-integer",["es.number.max-safe-integer"]),MIN_SAFE_INTEGER:define("number/min-safe-integer",["es.number.min-safe-integer"]),fromString:define("number/from-string",["esnext.number.from-string"]),isFinite:define("number/is-finite",["es.number.is-finite"]),isInteger:define("number/is-integer",["es.number.is-integer"]),isNaN:define("number/is-nan",["es.number.is-nan"]),isSafeInteger:define("number/is-safe-integer",["es.number.is-safe-integer"]),parseFloat:define("number/parse-float",["es.number.parse-float"]),parseInt:define("number/parse-int",["es.number.parse-int"])},Object:{assign:define("object/assign",["es.object.assign"]),create:define("object/create",["es.object.create"]),defineProperties:define("object/define-properties",["es.object.define-properties"]),defineProperty:define("object/define-property",["es.object.define-property"]),entries:define("object/entries",["es.object.entries"]),freeze:define("object/freeze",["es.object.freeze"]),fromEntries:define("object/from-entries",["es.object.from-entries","es.array.iterator"]),getOwnPropertyDescriptor:define("object/get-own-property-descriptor",["es.object.get-own-property-descriptor"]),getOwnPropertyDescriptors:define("object/get-own-property-descriptors",["es.object.get-own-property-descriptors"]),getOwnPropertyNames:define("object/get-own-property-names",["es.object.get-own-property-names"]),getOwnPropertySymbols:define("object/get-own-property-symbols",["es.symbol"]),getPrototypeOf:define("object/get-prototype-of",["es.object.get-prototype-of"]),hasOwn:define("object/has-own",["esnext.object.has-own"]),is:define("object/is",["es.object.is"]),isExtensible:define("object/is-extensible",["es.object.is-extensible"]),isFrozen:define("object/is-frozen",["es.object.is-frozen"]),isSealed:define("object/is-sealed",["es.object.is-sealed"]),keys:define("object/keys",["es.object.keys"]),preventExtensions:define("object/prevent-extensions",["es.object.prevent-extensions"]),seal:define("object/seal",["es.object.seal"]),setPrototypeOf:define("object/set-prototype-of",["es.object.set-prototype-of"]),values:define("object/values",["es.object.values"])},Promise:{all:define(null,d),allSettled:define(null,["es.promise.all-settled",...d]),any:define(null,["esnext.promise.any",...d]),race:define(null,d),try:define(null,["esnext.promise.try",...d])},Reflect:{apply:define("reflect/apply",["es.reflect.apply"]),construct:define("reflect/construct",["es.reflect.construct"]),defineMetadata:define("reflect/define-metadata",["esnext.reflect.define-metadata"]),defineProperty:define("reflect/define-property",["es.reflect.define-property"]),deleteMetadata:define("reflect/delete-metadata",["esnext.reflect.delete-metadata"]),deleteProperty:define("reflect/delete-property",["es.reflect.delete-property"]),get:define("reflect/get",["es.reflect.get"]),getMetadata:define("reflect/get-metadata",["esnext.reflect.get-metadata"]),getMetadataKeys:define("reflect/get-metadata-keys",["esnext.reflect.get-metadata-keys"]),getOwnMetadata:define("reflect/get-own-metadata",["esnext.reflect.get-own-metadata"]),getOwnMetadataKeys:define("reflect/get-own-metadata-keys",["esnext.reflect.get-own-metadata-keys"]),getOwnPropertyDescriptor:define("reflect/get-own-property-descriptor",["es.reflect.get-own-property-descriptor"]),getPrototypeOf:define("reflect/get-prototype-of",["es.reflect.get-prototype-of"]),has:define("reflect/has",["es.reflect.has"]),hasMetadata:define("reflect/has-metadata",["esnext.reflect.has-metadata"]),hasOwnMetadata:define("reflect/has-own-metadata",["esnext.reflect.has-own-metadata"]),isExtensible:define("reflect/is-extensible",["es.reflect.is-extensible"]),metadata:define("reflect/metadata",["esnext.reflect.metadata"]),ownKeys:define("reflect/own-keys",["es.reflect.own-keys"]),preventExtensions:define("reflect/prevent-extensions",["es.reflect.prevent-extensions"]),set:define("reflect/set",["es.reflect.set"]),setPrototypeOf:define("reflect/set-prototype-of",["es.reflect.set-prototype-of"])},Set:{from:define(null,["esnext.set.from",...y]),of:define(null,["esnext.set.of",...y])},String:{fromCodePoint:define("string/from-code-point",["es.string.from-code-point"]),raw:define("string/raw",["es.string.raw"])},Symbol:{asyncIterator:define("symbol/async-iterator",["es.symbol.async-iterator"]),dispose:define("symbol/dispose",["esnext.symbol.dispose"]),for:define("symbol/for",[],"es.symbol"),hasInstance:define("symbol/has-instance",["es.symbol.has-instance","es.function.has-instance"]),isConcatSpreadable:define("symbol/is-concat-spreadable",["es.symbol.is-concat-spreadable","es.array.concat"]),iterator:define("symbol/iterator",["es.symbol.iterator",...l]),keyFor:define("symbol/key-for",[],"es.symbol"),match:define("symbol/match",["es.symbol.match","es.string.match"]),observable:define("symbol/observable",["esnext.symbol.observable"]),patternMatch:define("symbol/pattern-match",["esnext.symbol.pattern-match"]),replace:define("symbol/replace",["es.symbol.replace","es.string.replace"]),search:define("symbol/search",["es.symbol.search","es.string.search"]),species:define("symbol/species",["es.symbol.species","es.array.species"]),split:define("symbol/split",["es.symbol.split","es.string.split"]),toPrimitive:define("symbol/to-primitive",["es.symbol.to-primitive","es.date.to-primitive"]),toStringTag:define("symbol/to-string-tag",["es.symbol.to-string-tag","es.object.to-string","es.math.to-string-tag","es.json.to-string-tag"]),unscopables:define("symbol/unscopables",["es.symbol.unscopables"])},WeakMap:{from:define(null,["esnext.weak-map.from",...g]),of:define(null,["esnext.weak-map.of",...g])},WeakSet:{from:define(null,["esnext.weak-set.from",...h]),of:define(null,["esnext.weak-set.of",...h])},Int8Array:u,Uint8Array:u,Uint8ClampedArray:u,Int16Array:u,Uint16Array:u,Int32Array:u,Uint32Array:u,Float32Array:u,Float64Array:u};t.StaticProperties=v;const E={at:define("instance/at",["esnext.string.at"]),anchor:define(null,["es.string.anchor"]),big:define(null,["es.string.big"]),bind:define("instance/bind",["es.function.bind"]),blink:define(null,["es.string.blink"]),bold:define(null,["es.string.bold"]),codePointAt:define("instance/code-point-at",["es.string.code-point-at"]),codePoints:define("instance/code-points",["esnext.string.code-points"]),concat:define("instance/concat",["es.array.concat"],undefined,["String"]),copyWithin:define("instance/copy-within",["es.array.copy-within"]),description:define(null,["es.symbol","es.symbol.description"]),endsWith:define("instance/ends-with",["es.string.ends-with"]),entries:define("instance/entries",i),every:define("instance/every",["es.array.every"]),exec:define(null,["es.regexp.exec"]),fill:define("instance/fill",["es.array.fill"]),filter:define("instance/filter",["es.array.filter"]),finally:define(null,["es.promise.finally",...p]),find:define("instance/find",["es.array.find"]),findIndex:define("instance/find-index",["es.array.find-index"]),fixed:define(null,["es.string.fixed"]),flags:define("instance/flags",["es.regexp.flags"]),flatMap:define("instance/flat-map",["es.array.flat-map","es.array.unscopables.flat-map"]),flat:define("instance/flat",["es.array.flat"]),fontcolor:define(null,["es.string.fontcolor"]),fontsize:define(null,["es.string.fontsize"]),forEach:define("instance/for-each",["es.array.for-each","web.dom-collections.for-each"]),includes:define("instance/includes",["es.array.includes","es.string.includes"]),indexOf:define("instance/index-of",["es.array.index-of"]),italic:define(null,["es.string.italics"]),join:define(null,["es.array.join"]),keys:define("instance/keys",i),lastIndex:define(null,["esnext.array.last-index"]),lastIndexOf:define("instance/last-index-of",["es.array.last-index-of"]),lastItem:define(null,["esnext.array.last-item"]),link:define(null,["es.string.link"]),map:define("instance/map",["es.array.map"]),match:define(null,["es.string.match","es.regexp.exec"]),matchAll:define("instance/match-all",["es.string.match-all"]),name:define(null,["es.function.name"]),padEnd:define("instance/pad-end",["es.string.pad-end"]),padStart:define("instance/pad-start",["es.string.pad-start"]),reduce:define("instance/reduce",["es.array.reduce"]),reduceRight:define("instance/reduce-right",["es.array.reduce-right"]),repeat:define("instance/repeat",["es.string.repeat"]),replace:define(null,["es.string.replace","es.regexp.exec"]),replaceAll:define("instance/replace-all",["esnext.string.replace-all"]),reverse:define("instance/reverse",["es.array.reverse"]),search:define(null,["es.string.search","es.regexp.exec"]),slice:define("instance/slice",["es.array.slice"]),small:define(null,["es.string.small"]),some:define("instance/some",["es.array.some"]),sort:define("instance/sort",["es.array.sort"]),splice:define("instance/splice",["es.array.splice"]),split:define(null,["es.string.split","es.regexp.exec"]),startsWith:define("instance/starts-with",["es.string.starts-with"]),strike:define(null,["es.string.strike"]),sub:define(null,["es.string.sub"]),sup:define(null,["es.string.sup"]),toFixed:define(null,["es.number.to-fixed"]),toISOString:define(null,["es.date.to-iso-string"]),toJSON:define(null,["es.date.to-json","web.url.to-json"]),toPrecision:define(null,["es.number.to-precision"]),toString:define(null,["es.object.to-string","es.regexp.to-string","es.date.to-string"]),trim:define("instance/trim",["es.string.trim"]),trimEnd:define("instance/trim-end",["es.string.trim-end"]),trimLeft:define("instance/trim-left",["es.string.trim-start"]),trimRight:define("instance/trim-right",["es.string.trim-end"]),trimStart:define("instance/trim-start",["es.string.trim-start"]),values:define("instance/values",i),__defineGetter__:define(null,["es.object.define-getter"]),__defineSetter__:define(null,["es.object.define-setter"]),__lookupGetter__:define(null,["es.object.lookup-getter"]),__lookupSetter__:define(null,["es.object.lookup-setter"])};t.InstanceProperties=E;const j=new Set(["es.object.to-string","es.object.define-getter","es.object.define-setter","es.object.lookup-getter","es.object.lookup-setter","es.regexp.exec"]);t.CommonInstanceDependencies=j},5825:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireDefault(r(8828));var a=_interopRequireDefault(r(6265));var n=_interopRequireDefault(r(1532));var o=r(9396);var i=_interopRequireWildcard(r(8304));var l=r(8520);var c=_interopRequireDefault(r(8038));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _extends(){_extends=Object.assign||function(e){for(var t=1;t{if(t(e))return true;if(!e.startsWith("es."))return false;const r=`esnext.${e.slice(3)}`;if(!s.default[r])return false;return t(r)};var d=(0,c.default)((function({getUtils:e,method:t,shouldInjectPolyfill:r,createMetaResolver:i,debug:c,babel:d},{version:f=3,proposals:m,shippedProposals:y,[p]:{useBabelRuntime:g,ext:h=".js"}={}}){const b=d.caller((e=>(e==null?void 0:e.name)==="babel-loader"));const x=i({global:o.BuiltIns,static:o.StaticProperties,instance:o.InstanceProperties});const v=new Set((0,n.default)(f));const E=g?m?`${g}/core-js`:`${g}/core-js-stable`:m?"core-js-pure/features":"core-js-pure/stable";function maybeInjectGlobalImpl(e,t){if(r(e)){c(e);t.injectGlobalImport((0,l.coreJSModule)(e));return true}return false}function maybeInjectGlobal(e,t,r=true){for(const s of e){if(r){esnextFallback(s,(e=>maybeInjectGlobalImpl(e,t)))}else{maybeInjectGlobalImpl(s,t)}}}function maybeInjectPure(e,t,s,a){if(e.pure&&!(a&&e.exclude&&e.exclude.includes(a))&&esnextFallback(e.name,r)){return s.injectDefaultImport(`${E}/${e.pure}${h}`,t)}}return{name:"corejs3",polyfills:s.default,filterPolyfills(e){if(!v.has(e))return false;if(m||t==="entry-global")return true;if(y&&a.default.has(e)){return true}return!e.startsWith("esnext.")},entryGlobal(e,t,s){if(e.kind!=="import")return;const a=(0,l.isCoreJSSource)(e.source);if(!a)return;if(a.length===1&&e.source===(0,l.coreJSModule)(a[0])&&r(a[0])){c(null);return}maybeInjectGlobal(a,t,false);s.remove()},usageGlobal(e,t){const r=x(e);if(!r)return;let s=r.desc.global;if(r.kind!=="global"&&e.object&&e.placement==="prototype"){const t=e.object.toLowerCase();s=s.filter((e=>e.includes(t)||o.CommonInstanceDependencies.has(e)))}maybeInjectGlobal(s,t)},usagePure(e,t,s){if(e.kind==="in"){if(e.key==="Symbol.iterator"){s.replaceWith(u.callExpression(t.injectDefaultImport((0,l.coreJSPureHelper)("is-iterable",g,h),"isIterable"),[s.node.right]))}return}if(s.parentPath.isUnaryExpression({operator:"delete"}))return;let a;if(e.kind==="property"){if(!s.isMemberExpression())return;if(!s.isReferenced())return;a=s.parentPath.isCallExpression({callee:s.node});if(e.key==="Symbol.iterator"){if(!r("es.symbol.iterator"))return;if(a){if(s.parent.arguments.length===0){s.parentPath.replaceWith(u.callExpression(t.injectDefaultImport((0,l.coreJSPureHelper)("get-iterator",g,h),"getIterator"),[s.node.object]));s.skip()}else{(0,l.callMethod)(s,t.injectDefaultImport((0,l.coreJSPureHelper)("get-iterator-method",g,h),"getIteratorMethod"))}}else{s.replaceWith(u.callExpression(t.injectDefaultImport((0,l.coreJSPureHelper)("get-iterator-method",g,h),"getIteratorMethod"),[s.node.object]))}return}}let n=x(e);if(!n)return;if(g&&n.desc.pure&&n.desc.pure.slice(-6)==="/index"){n=_extends({},n,{desc:_extends({},n.desc,{pure:n.desc.pure.slice(0,-6)})})}if(n.kind==="global"){const e=maybeInjectPure(n.desc,n.name,t);if(e)s.replaceWith(e)}else if(n.kind==="static"){const r=maybeInjectPure(n.desc,n.name,t,e.object);if(r)s.replaceWith(r)}else if(n.kind==="instance"){const r=maybeInjectPure(n.desc,`${n.name}InstanceProperty`,t,e.object);if(!r)return;if(a){(0,l.callMethod)(s,r)}else{s.replaceWith(u.callExpression(r,[s.node.object]))}}},visitor:t==="usage-global"&&{CallExpression(t){if(t.get("callee").isImport()){const r=e(t);if(b){maybeInjectGlobal(o.PromiseDependenciesWithIterators,r)}else{maybeInjectGlobal(o.PromiseDependencies,r)}}},Function(t){if(t.node.async){maybeInjectGlobal(o.PromiseDependencies,e(t))}},"ForOfStatement|ArrayPattern"(t){maybeInjectGlobal(o.CommonIterators,e(t))},SpreadElement(t){if(!t.parentPath.isObjectExpression()){maybeInjectGlobal(o.CommonIterators,e(t))}},YieldExpression(t){if(t.node.delegate){maybeInjectGlobal(o.CommonIterators,e(t))}}}}}));t["default"]=d},6265:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;var r=new Set(["esnext.global-this","esnext.string.match-all"]);t["default"]=r},8520:(e,t,r)=>{"use strict";t.__esModule=true;t.callMethod=callMethod;t.isCoreJSSource=isCoreJSSource;t.coreJSModule=coreJSModule;t.coreJSPureHelper=coreJSPureHelper;var s=_interopRequireWildcard(r(8304));var a=_interopRequireDefault(r(3039));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:n}=s.default||s;function callMethod(e,t){const{object:r}=e.node;let s,a;if(n.isIdentifier(r)){s=r;a=n.cloneNode(r)}else{s=e.scope.generateDeclaredUidIdentifier("context");a=n.assignmentExpression("=",n.cloneNode(s),r)}e.replaceWith(n.memberExpression(n.callExpression(t,[a]),n.identifier("call")));e.parentPath.unshiftContainer("arguments",s)}function isCoreJSSource(e){if(typeof e==="string"){e=e.replace(/\\/g,"/").replace(/(\/(index)?)?(\.js)?$/i,"").toLowerCase()}return hasOwnProperty.call(a.default,e)&&a.default[e]}function coreJSModule(e){return`core-js/modules/${e}.js`}function coreJSPureHelper(e,t,r){return t?`${t}/core-js/${e}${r}`:`core-js-pure/features/${e}.js`}},8374:(e,t,r)=>{"use strict";const{compare:s,intersection:a,semver:n}=r(2732);const o=r(4970);const i=r(2885);e.exports=function(e){const t=n(e);if(t.major!==3){throw RangeError("This version of `core-js-compat` works only with `core-js@3`.")}const r=[];for(const e of Object.keys(o)){if(s(e,"<=",t)){r.push(...o[e])}}return a(r,i)}},2732:(e,t,r)=>{"use strict";const s=r(3464);const a=r(6784);const n=Function.call.bind({}.hasOwnProperty);function compare(e,t,r){return s(a(e),t,a(r))}function intersection(e,t){const r=e instanceof Set?e:new Set(e);return t.filter((e=>r.has(e)))}function sortObjectByKey(e,t){return Object.keys(e).sort(t).reduce(((t,r)=>{t[r]=e[r];return t}),{})}e.exports={compare:compare,has:n,intersection:intersection,semver:a,sortObjectByKey:sortObjectByKey}},5620:(e,t,r)=>{const s=r(6766);const{MAX_LENGTH:a,MAX_SAFE_INTEGER:n}=r(6648);const{re:o,t:i}=r(3567);const{compareIdentifiers:l}=r(6736);class SemVer{constructor(e,t){if(!t||typeof t!=="object"){t={loose:!!t,includePrerelease:false}}if(e instanceof SemVer){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease){return e}else{e=e.version}}else if(typeof e!=="string"){throw new TypeError(`Invalid Version: ${e}`)}if(e.length>a){throw new TypeError(`version is longer than ${a} characters`)}s("SemVer",e,t);this.options=t;this.loose=!!t.loose;this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?o[i.LOOSE]:o[i.FULL]);if(!r){throw new TypeError(`Invalid Version: ${e}`)}this.raw=e;this.major=+r[1];this.minor=+r[2];this.patch=+r[3];if(this.major>n||this.major<0){throw new TypeError("Invalid major version")}if(this.minor>n||this.minor<0){throw new TypeError("Invalid minor version")}if(this.patch>n||this.patch<0){throw new TypeError("Invalid patch version")}if(!r[4]){this.prerelease=[]}else{this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0){if(typeof this.prerelease[e]==="number"){this.prerelease[e]++;e=-2}}if(e===-1){this.prerelease.push(0)}}if(t){if(this.prerelease[0]===t){if(isNaN(this.prerelease[1])){this.prerelease=[t,0]}}else{this.prerelease=[t,0]}}break;default:throw new Error(`invalid increment argument: ${e}`)}this.format();this.raw=this.version;return this}}e.exports=SemVer},3464:(e,t,r)=>{const s=r(1673);const a=r(532);const n=r(3547);const o=r(5478);const i=r(5401);const l=r(2568);const cmp=(e,t,r,c)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return s(e,r,c);case"!=":return a(e,r,c);case">":return n(e,r,c);case">=":return o(e,r,c);case"<":return i(e,r,c);case"<=":return l(e,r,c);default:throw new TypeError(`Invalid operator: ${t}`)}};e.exports=cmp},6784:(e,t,r)=>{const s=r(5620);const a=r(5032);const{re:n,t:o}=r(3567);const coerce=(e,t)=>{if(e instanceof s){return e}if(typeof e==="number"){e=String(e)}if(typeof e!=="string"){return null}t=t||{};let r=null;if(!t.rtl){r=e.match(n[o.COERCE])}else{let t;while((t=n[o.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||t.index+t[0].length!==r.index+r[0].length){r=t}n[o.COERCERTL].lastIndex=t.index+t[1].length+t[2].length}n[o.COERCERTL].lastIndex=-1}if(r===null)return null;return a(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};e.exports=coerce},8796:(e,t,r)=>{const s=r(5620);const compare=(e,t,r)=>new s(e,r).compare(new s(t,r));e.exports=compare},1673:(e,t,r)=>{const s=r(8796);const eq=(e,t,r)=>s(e,t,r)===0;e.exports=eq},3547:(e,t,r)=>{const s=r(8796);const gt=(e,t,r)=>s(e,t,r)>0;e.exports=gt},5478:(e,t,r)=>{const s=r(8796);const gte=(e,t,r)=>s(e,t,r)>=0;e.exports=gte},5401:(e,t,r)=>{const s=r(8796);const lt=(e,t,r)=>s(e,t,r)<0;e.exports=lt},2568:(e,t,r)=>{const s=r(8796);const lte=(e,t,r)=>s(e,t,r)<=0;e.exports=lte},532:(e,t,r)=>{const s=r(8796);const neq=(e,t,r)=>s(e,t,r)!==0;e.exports=neq},5032:(e,t,r)=>{const{MAX_LENGTH:s}=r(6648);const{re:a,t:n}=r(3567);const o=r(5620);const parse=(e,t)=>{if(!t||typeof t!=="object"){t={loose:!!t,includePrerelease:false}}if(e instanceof o){return e}if(typeof e!=="string"){return null}if(e.length>s){return null}const r=t.loose?a[n.LOOSE]:a[n.FULL];if(!r.test(e)){return null}try{return new o(e,t)}catch(e){return null}};e.exports=parse},6648:e=>{const t="2.0.0";const r=256;const s=Number.MAX_SAFE_INTEGER||9007199254740991;const a=16;e.exports={SEMVER_SPEC_VERSION:t,MAX_LENGTH:r,MAX_SAFE_INTEGER:s,MAX_SAFE_COMPONENT_LENGTH:a}},6766:e=>{const t=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},6736:e=>{const t=/^[0-9]+$/;const compareIdentifiers=(e,r)=>{const s=t.test(e);const a=t.test(r);if(s&&a){e=+e;r=+r}return e===r?0:s&&!a?-1:a&&!s?1:ecompareIdentifiers(t,e);e.exports={compareIdentifiers:compareIdentifiers,rcompareIdentifiers:rcompareIdentifiers}},3567:(e,t,r)=>{const{MAX_SAFE_COMPONENT_LENGTH:s}=r(6648);const a=r(6766);t=e.exports={};const n=t.re=[];const o=t.src=[];const i=t.t={};let l=0;const createToken=(e,t,r)=>{const s=l++;a(s,t);i[e]=s;o[s]=t;n[s]=new RegExp(t,r?"g":undefined)};createToken("NUMERICIDENTIFIER","0|[1-9]\\d*");createToken("NUMERICIDENTIFIERLOOSE","[0-9]+");createToken("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*");createToken("MAINVERSION",`(${o[i.NUMERICIDENTIFIER]})\\.`+`(${o[i.NUMERICIDENTIFIER]})\\.`+`(${o[i.NUMERICIDENTIFIER]})`);createToken("MAINVERSIONLOOSE",`(${o[i.NUMERICIDENTIFIERLOOSE]})\\.`+`(${o[i.NUMERICIDENTIFIERLOOSE]})\\.`+`(${o[i.NUMERICIDENTIFIERLOOSE]})`);createToken("PRERELEASEIDENTIFIER",`(?:${o[i.NUMERICIDENTIFIER]}|${o[i.NONNUMERICIDENTIFIER]})`);createToken("PRERELEASEIDENTIFIERLOOSE",`(?:${o[i.NUMERICIDENTIFIERLOOSE]}|${o[i.NONNUMERICIDENTIFIER]})`);createToken("PRERELEASE",`(?:-(${o[i.PRERELEASEIDENTIFIER]}(?:\\.${o[i.PRERELEASEIDENTIFIER]})*))`);createToken("PRERELEASELOOSE",`(?:-?(${o[i.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[i.PRERELEASEIDENTIFIERLOOSE]})*))`);createToken("BUILDIDENTIFIER","[0-9A-Za-z-]+");createToken("BUILD",`(?:\\+(${o[i.BUILDIDENTIFIER]}(?:\\.${o[i.BUILDIDENTIFIER]})*))`);createToken("FULLPLAIN",`v?${o[i.MAINVERSION]}${o[i.PRERELEASE]}?${o[i.BUILD]}?`);createToken("FULL",`^${o[i.FULLPLAIN]}$`);createToken("LOOSEPLAIN",`[v=\\s]*${o[i.MAINVERSIONLOOSE]}${o[i.PRERELEASELOOSE]}?${o[i.BUILD]}?`);createToken("LOOSE",`^${o[i.LOOSEPLAIN]}$`);createToken("GTLT","((?:<|>)?=?)");createToken("XRANGEIDENTIFIERLOOSE",`${o[i.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);createToken("XRANGEIDENTIFIER",`${o[i.NUMERICIDENTIFIER]}|x|X|\\*`);createToken("XRANGEPLAIN",`[v=\\s]*(${o[i.XRANGEIDENTIFIER]})`+`(?:\\.(${o[i.XRANGEIDENTIFIER]})`+`(?:\\.(${o[i.XRANGEIDENTIFIER]})`+`(?:${o[i.PRERELEASE]})?${o[i.BUILD]}?`+`)?)?`);createToken("XRANGEPLAINLOOSE",`[v=\\s]*(${o[i.XRANGEIDENTIFIERLOOSE]})`+`(?:\\.(${o[i.XRANGEIDENTIFIERLOOSE]})`+`(?:\\.(${o[i.XRANGEIDENTIFIERLOOSE]})`+`(?:${o[i.PRERELEASELOOSE]})?${o[i.BUILD]}?`+`)?)?`);createToken("XRANGE",`^${o[i.GTLT]}\\s*${o[i.XRANGEPLAIN]}$`);createToken("XRANGELOOSE",`^${o[i.GTLT]}\\s*${o[i.XRANGEPLAINLOOSE]}$`);createToken("COERCE",`${"(^|[^\\d])"+"(\\d{1,"}${s}})`+`(?:\\.(\\d{1,${s}}))?`+`(?:\\.(\\d{1,${s}}))?`+`(?:$|[^\\d])`);createToken("COERCERTL",o[i.COERCE],true);createToken("LONETILDE","(?:~>?)");createToken("TILDETRIM",`(\\s*)${o[i.LONETILDE]}\\s+`,true);t.tildeTrimReplace="$1~";createToken("TILDE",`^${o[i.LONETILDE]}${o[i.XRANGEPLAIN]}$`);createToken("TILDELOOSE",`^${o[i.LONETILDE]}${o[i.XRANGEPLAINLOOSE]}$`);createToken("LONECARET","(?:\\^)");createToken("CARETTRIM",`(\\s*)${o[i.LONECARET]}\\s+`,true);t.caretTrimReplace="$1^";createToken("CARET",`^${o[i.LONECARET]}${o[i.XRANGEPLAIN]}$`);createToken("CARETLOOSE",`^${o[i.LONECARET]}${o[i.XRANGEPLAINLOOSE]}$`);createToken("COMPARATORLOOSE",`^${o[i.GTLT]}\\s*(${o[i.LOOSEPLAIN]})$|^$`);createToken("COMPARATOR",`^${o[i.GTLT]}\\s*(${o[i.FULLPLAIN]})$|^$`);createToken("COMPARATORTRIM",`(\\s*)${o[i.GTLT]}\\s*(${o[i.LOOSEPLAIN]}|${o[i.XRANGEPLAIN]})`,true);t.comparatorTrimReplace="$1$2$3";createToken("HYPHENRANGE",`^\\s*(${o[i.XRANGEPLAIN]})`+`\\s+-\\s+`+`(${o[i.XRANGEPLAIN]})`+`\\s*$`);createToken("HYPHENRANGELOOSE",`^\\s*(${o[i.XRANGEPLAINLOOSE]})`+`\\s+-\\s+`+`(${o[i.XRANGEPLAINLOOSE]})`+`\\s*$`);createToken("STAR","(<|>)?=?\\s*\\*")},7973:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireDefault(r(8038));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const a="#__secret_key__@babel/runtime__compatibility";var n=(0,s.default)((({debug:e},t)=>{const{[a]:{useBabelRuntime:r}={}}=t;const s=r?`${r}/regenerator`:"regenerator-runtime";return{name:"regenerator",polyfills:["regenerator-runtime"],usageGlobal(t,r){if(isRegenerator(t)){e("regenerator-runtime");r.injectGlobalImport("regenerator-runtime/runtime.js")}},usagePure(e,t,r){if(isRegenerator(e)){r.replaceWith(t.injectDefaultImport(s,"regenerator-runtime"))}}}}));t["default"]=n;const isRegenerator=e=>e.kind==="global"&&e.name==="regeneratorRuntime"},9485:(e,t,r)=>{var s=r(3818);s.core=r(3011);s.isCore=r(7320);s.sync=r(7252);e.exports=s},3818:(e,t,r)=>{var s=r(7147);var a=r(1017);var n=r(4029);var o=r(1177);var i=r(607);var l=r(8746);var c=s.realpath&&typeof s.realpath.native==="function"?s.realpath.native:s.realpath;var u=function isFile(e,t){s.stat(e,(function(e,r){if(!e){return t(null,r.isFile()||r.isFIFO())}if(e.code==="ENOENT"||e.code==="ENOTDIR")return t(null,false);return t(e)}))};var p=function isDirectory(e,t){s.stat(e,(function(e,r){if(!e){return t(null,r.isDirectory())}if(e.code==="ENOENT"||e.code==="ENOTDIR")return t(null,false);return t(e)}))};var d=function realpath(e,t){c(e,(function(r,s){if(r&&r.code!=="ENOENT")t(r);else t(null,r?e:s)}))};var f=function maybeRealpath(e,t,r,s){if(r&&r.preserveSymlinks===false){e(t,s)}else{s(null,t)}};var m=function defaultReadPackage(e,t,r){e(t,(function(e,t){if(e)r(e);else{try{var s=JSON.parse(t);r(null,s)}catch(e){r(null)}}}))};var y=function getPackageCandidates(e,t,r){var s=o(t,r,e);for(var n=0;n{e.exports=function(){var e=Error.prepareStackTrace;Error.prepareStackTrace=function(e,t){return t};var t=(new Error).stack;Error.prepareStackTrace=e;return t[2].getFileName()}},3011:(e,t,r)=>{var s=process.versions&&process.versions.node&&process.versions.node.split(".")||[];function specifierIncluded(e){var t=e.split(" ");var r=t.length>1?t[0]:"=";var a=(t.length>1?t[1]:t[0]).split(".");for(var n=0;n<3;++n){var o=parseInt(s[n]||0,10);var i=parseInt(a[n]||0,10);if(o===i){continue}if(r==="<"){return o="){return o>=i}else{return false}}return r===">="}function matchesRange(e){var t=e.split(/ ?&& ?/);if(t.length===0){return false}for(var r=0;r{var s=r(8746);e.exports=function isCore(e){return s(e)}},1177:(e,t,r)=>{var s=r(1017);var a=s.parse||r(2742);var n=function getNodeModulesDirs(e,t){var r="/";if(/^([A-Za-z]:)/.test(e)){r=""}else if(/^\\\\/.test(e)){r="\\\\"}var n=[e];var o=a(e);while(o.dir!==n[n.length-1]){n.push(o.dir);o=a(o.dir)}return n.reduce((function(e,a){return e.concat(t.map((function(e){return s.resolve(r,a,e)})))}),[])};e.exports=function nodeModulesPaths(e,t,r){var s=t&&t.moduleDirectory?[].concat(t.moduleDirectory):["node_modules"];if(t&&typeof t.paths==="function"){return t.paths(r,e,(function(){return n(e,s)}),t)}var a=n(e,s);return t&&t.paths?a.concat(t.paths):a}},607:e=>{e.exports=function(e,t){return t||{}}},7252:(e,t,r)=>{var s=r(8746);var a=r(7147);var n=r(1017);var o=r(4029);var i=r(1177);var l=r(607);var c=a.realpathSync&&typeof a.realpathSync.native==="function"?a.realpathSync.native:a.realpathSync;var u=function isFile(e){try{var t=a.statSync(e)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return false;throw e}return t.isFile()||t.isFIFO()};var p=function isDirectory(e){try{var t=a.statSync(e)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return false;throw e}return t.isDirectory()};var d=function realpathSync(e){try{return c(e)}catch(e){if(e.code!=="ENOENT"){throw e}}return e};var f=function maybeRealpathSync(e,t,r){if(r&&r.preserveSymlinks===false){return e(t)}return t};var m=function defaultReadPackageSync(e,t){var r=e(t);try{var s=JSON.parse(r);return s}catch(e){}};var y=function getPackageCandidates(e,t,r){var s=i(t,r,e);for(var a=0;a{"use strict";e.exports=require("assert")},7147:e=>{"use strict";e.exports=require("fs")},8188:e=>{"use strict";e.exports=require("module")},8304:e=>{"use strict";e.exports=require("next/dist/compiled/babel/core")},6949:e=>{"use strict";e.exports=require("next/dist/compiled/babel/parser")},7369:e=>{"use strict";e.exports=require("next/dist/compiled/babel/traverse")},8622:e=>{"use strict";e.exports=require("next/dist/compiled/babel/types")},4907:e=>{"use strict";e.exports=require("next/dist/compiled/browserslist")},8542:e=>{"use strict";e.exports=require("next/dist/compiled/chalk")},7849:e=>{"use strict";e.exports=require("next/dist/compiled/semver")},1017:e=>{"use strict";e.exports=require("path")},3837:e=>{"use strict";e.exports=require("util")},1267:e=>{"use strict";e.exports=require("worker_threads")},614:(e,t,r)=>{function _classPrivateFieldGet(e,t){var r=_classExtractFieldDescriptor(e,t,"get");return _classApplyDescriptorGet(e,r)}function _classApplyDescriptorGet(e,t){if(t.get){return t.get.call(e)}return t.value}function _classPrivateFieldSet(e,t,r){var s=_classExtractFieldDescriptor(e,t,"set");_classApplyDescriptorSet(e,s,r);return r}function _classExtractFieldDescriptor(e,t,r){if(!t.has(e)){throw new TypeError("attempted to "+r+" private field on non-instance")}return t.get(e)}function _classApplyDescriptorSet(e,t,r){if(t.set){t.set.call(e,r)}else{if(!t.writable){throw new TypeError("attempted to set read only private field")}t.value=r}}const s=r(6007);const{Definition:a}=r(665);const n=r(4162);const o=r(4585);const{getKeys:i}=r(1498);let l;function getVisitorValues(e,t){if(l)return l[e];const{FLOW_FLIPPED_ALIAS_KEYS:r,VISITOR_KEYS:s}=t.getTypesInfo();const a=r.concat(["ArrayPattern","ClassDeclaration","ClassExpression","FunctionDeclaration","FunctionExpression","Identifier","ObjectPattern","RestElement"]);l=Object.entries(s).reduce(((e,[t,r])=>{if(!a.includes(r)){e[t]=r}return e}),{});return l[e]}const c={callProperties:{type:"loop",values:["value"]},indexers:{type:"loop",values:["key","value"]},properties:{type:"loop",values:["argument","value"]},types:{type:"loop"},params:{type:"loop"},argument:{type:"single"},elementType:{type:"single"},qualification:{type:"single"},rest:{type:"single"},returnType:{type:"single"},typeAnnotation:{type:"typeAnnotation"},typeParameters:{type:"typeParameters"},id:{type:"id"}};class PatternVisitor extends n{ArrayPattern(e){e.elements.forEach(this.visit,this)}ObjectPattern(e){e.properties.forEach(this.visit,this)}}var u=new WeakMap;class Referencer extends o{constructor(e,t,r){super(e,t);u.set(this,{writable:true,value:void 0});_classPrivateFieldSet(this,u,r)}visitPattern(e,t,r){if(!e){return}this._checkIdentifierOrVisit(e.typeAnnotation);if(e.type==="AssignmentPattern"){this._checkIdentifierOrVisit(e.left.typeAnnotation)}if(typeof t==="function"){r=t;t={processRightHandNodes:false}}const s=new PatternVisitor(this.options,e,r);s.visit(e);if(t.processRightHandNodes){s.rightHandNodes.forEach(this.visit,this)}}visitClass(e){this._visitArray(e.decorators);const t=this._nestTypeParamScope(e);this._visitTypeAnnotation(e.implements);this._visitTypeAnnotation(e.superTypeParameters&&e.superTypeParameters.params);super.visitClass(e);if(t){this.close(e)}}visitFunction(e){const t=this._nestTypeParamScope(e);this._checkIdentifierOrVisit(e.returnType);super.visitFunction(e);if(t){this.close(e)}}visitProperty(e){var t;if(((t=e.value)==null?void 0:t.type)==="TypeCastExpression"){this._visitTypeAnnotation(e.value)}this._visitArray(e.decorators);super.visitProperty(e)}InterfaceDeclaration(e){this._createScopeVariable(e,e.id);const t=this._nestTypeParamScope(e);this._visitArray(e.extends);this.visit(e.body);if(t){this.close(e)}}TypeAlias(e){this._createScopeVariable(e,e.id);const t=this._nestTypeParamScope(e);this.visit(e.right);if(t){this.close(e)}}ClassProperty(e){this._visitClassProperty(e)}ClassPrivateProperty(e){this._visitClassProperty(e)}PropertyDefinition(e){this._visitClassProperty(e)}ClassPrivateMethod(e){super.MethodDefinition(e)}DeclareModule(e){this._visitDeclareX(e)}DeclareFunction(e){this._visitDeclareX(e)}DeclareVariable(e){this._visitDeclareX(e)}DeclareClass(e){this._visitDeclareX(e)}OptionalMemberExpression(e){super.MemberExpression(e)}_visitClassProperty(e){this._visitTypeAnnotation(e.typeAnnotation);this.visitProperty(e)}_visitDeclareX(e){if(e.id){this._createScopeVariable(e,e.id)}const t=this._nestTypeParamScope(e);if(t){this.close(e)}}_createScopeVariable(e,t){this.currentScope().variableScope.__define(t,new a("Variable",t,e,null,null,null))}_nestTypeParamScope(e){if(!e.typeParameters){return null}const t=this.scopeManager.__currentScope;const r=new s.Scope(this.scopeManager,"type-parameters",t,e,false);this.scopeManager.__nestScope(r);for(let t=0;t{var s,a,n,o,i,l;function _classStaticPrivateFieldSpecSet(e,t,r,s){_classCheckPrivateStaticAccess(e,t);_classCheckPrivateStaticFieldDescriptor(r,"set");_classApplyDescriptorSet(e,r,s);return s}function _classStaticPrivateFieldSpecGet(e,t,r){_classCheckPrivateStaticAccess(e,t);_classCheckPrivateStaticFieldDescriptor(r,"get");return _classApplyDescriptorGet(e,r)}function _classCheckPrivateStaticFieldDescriptor(e,t){if(e===undefined){throw new TypeError("attempted to "+t+" private static field before its declaration")}}function _classCheckPrivateStaticAccess(e,t){if(e!==t){throw new TypeError("Private static access of wrong provenance")}}function _classPrivateFieldGet(e,t){var r=_classExtractFieldDescriptor(e,t,"get");return _classApplyDescriptorGet(e,r)}function _classApplyDescriptorGet(e,t){if(t.get){return t.get.call(e)}return t.value}function _classPrivateFieldSet(e,t,r){var s=_classExtractFieldDescriptor(e,t,"set");_classApplyDescriptorSet(e,s,r);return r}function _classExtractFieldDescriptor(e,t,r){if(!t.has(e)){throw new TypeError("attempted to "+r+" private field on non-instance")}return t.get(e)}function _classApplyDescriptorSet(e,t,r){if(t.set){t.set.call(e,r)}else{if(!t.writable){throw new TypeError("attempted to set read only private field")}t.value=r}}const c=r(1017);const u={GET_VERSION:"GET_VERSION",GET_TYPES_INFO:"GET_TYPES_INFO",GET_VISITOR_KEYS:"GET_VISITOR_KEYS",GET_TOKEN_LABELS:"GET_TOKEN_LABELS",MAYBE_PARSE:"MAYBE_PARSE",MAYBE_PARSE_SYNC:"MAYBE_PARSE_SYNC"};var p=new WeakMap;var d=new WeakMap;var f=new WeakMap;var m=new WeakMap;var y=new WeakMap;class Client{constructor(e){p.set(this,{writable:true,value:void 0});d.set(this,{writable:true,value:void 0});f.set(this,{writable:true,value:void 0});m.set(this,{writable:true,value:void 0});y.set(this,{writable:true,value:void 0});_classPrivateFieldSet(this,p,e)}getVersion(){var e;return(e=_classPrivateFieldGet(this,d))!=null?e:_classPrivateFieldSet(this,d,_classPrivateFieldGet(this,p).call(this,u.GET_VERSION,undefined))}getTypesInfo(){var e;return(e=_classPrivateFieldGet(this,f))!=null?e:_classPrivateFieldSet(this,f,_classPrivateFieldGet(this,p).call(this,u.GET_TYPES_INFO,undefined))}getVisitorKeys(){var e;return(e=_classPrivateFieldGet(this,m))!=null?e:_classPrivateFieldSet(this,m,_classPrivateFieldGet(this,p).call(this,u.GET_VISITOR_KEYS,undefined))}getTokLabels(){var e;return(e=_classPrivateFieldGet(this,y))!=null?e:_classPrivateFieldSet(this,y,_classPrivateFieldGet(this,p).call(this,u.GET_TOKEN_LABELS,undefined))}maybeParse(e,t){return _classPrivateFieldGet(this,p).call(this,u.MAYBE_PARSE,{code:e,options:t})}}t.WorkerClient=(o=(a=new WeakMap,n=new WeakMap,s=class WorkerClient extends Client{constructor(){super(((e,t)=>{_classPrivateFieldGet(this,n)[0]=0;const r=new(_classStaticPrivateFieldSpecGet(WorkerClient,s,i).MessageChannel);_classPrivateFieldGet(this,a).postMessage({signal:_classPrivateFieldGet(this,n),port:r.port1,action:e,payload:t},[r.port1]);Atomics.wait(_classPrivateFieldGet(this,n),0,0);const{message:o}=_classStaticPrivateFieldSpecGet(WorkerClient,s,i).receiveMessageOnPort(r.port2);if(o.error)throw Object.assign(o.error,o.errorData);else return o.result}));a.set(this,{writable:true,value:new(_classStaticPrivateFieldSpecGet(WorkerClient,s,i).Worker)(c.resolve(__dirname,"../lib/worker/index.cjs"),{env:_classStaticPrivateFieldSpecGet(WorkerClient,s,i).SHARE_ENV})});n.set(this,{writable:true,value:new Int32Array(new SharedArrayBuffer(4))});_classPrivateFieldGet(this,a).unref()}}),i={get:_get_worker_threads,set:void 0},l={writable:true,value:void 0},o);function _get_worker_threads(){var e;return(e=_classStaticPrivateFieldSpecGet(s,s,l))!=null?e:_classStaticPrivateFieldSpecSet(s,s,l,r(1267))}{var g,h,b;t.LocalClient=(h=g=class LocalClient extends Client{constructor(){var e;(e=_classStaticPrivateFieldSpecGet(LocalClient,g,b))!=null?e:_classStaticPrivateFieldSpecSet(LocalClient,g,b,r(2100));super(((e,t)=>_classStaticPrivateFieldSpecGet(LocalClient,g,b).call(LocalClient,e===u.MAYBE_PARSE?u.MAYBE_PARSE_SYNC:e,t)))}},b={writable:true,value:void 0},h)}},244:(e,t)=>{const r=["babelOptions","ecmaVersion","sourceType","allowImportExportEverywhere","requireConfigFile"];function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var r={};var s=Object.keys(e);var a,n;for(n=0;n=0)continue;r[a]=e[a]}return r}t.normalizeESLintConfig=function(e){const{babelOptions:t={},ecmaVersion:s=2020,sourceType:a="module",allowImportExportEverywhere:n=false,requireConfigFile:o=true}=e,i=_objectWithoutPropertiesLoose(e,r);return Object.assign({babelOptions:Object.assign({cwd:process.cwd()},t),ecmaVersion:s,sourceType:a,allowImportExportEverywhere:n,requireConfigFile:o},i)}},1527:e=>{function*it(e){if(Array.isArray(e))yield*e;else yield e}function traverse(e,t,r){const{type:s}=e;if(!s)return;const a=t[s];if(!a)return;for(const s of a){for(const a of it(e[s])){if(a&&typeof a==="object"){r.enter(a);traverse(a,t,r);r.exit(a)}}}}const t={enter(e){if(e.innerComments){delete e.innerComments}if(e.trailingComments){delete e.trailingComments}if(e.leadingComments){delete e.leadingComments}},exit(e){if(e.extra){delete e.extra}if(e!=null&&e.loc.identifierName){delete e.loc.identifierName}if(e.type==="TypeParameter"){e.type="Identifier";e.typeAnnotation=e.bound;delete e.bound}if(e.type==="QualifiedTypeIdentifier"){delete e.id}if(e.type==="ObjectTypeProperty"){delete e.key}if(e.type==="ObjectTypeIndexer"){delete e.id}if(e.type==="FunctionTypeParam"){delete e.name}if(e.type==="ImportDeclaration"){delete e.isType}if(e.type==="TemplateLiteral"){for(let t=0;tr.end){e.range[1]=r.end;e.loc.end.line=r.loc.end.line;e.loc.end.column=r.loc.end.column}}}else{if(!e.tokens.length){e.loc.start.line=1;e.loc.end.line=1}}if(e.body&&e.body.length>0){e.loc.start.line=e.body[0].loc.start.line;e.range[0]=e.body[0].start}}e.exports=function convertAST(e,t){convertNodes(e,t);convertProgramNode(e)}},5926:e=>{e.exports=function convertComments(e){for(const t of e){if(t.type==="CommentBlock"){t.type="Block"}else if(t.type==="CommentLine"){t.type="Line"}if(!t.range){t.range=[t.start,t.end]}}}},9530:e=>{function convertTemplateType(e,t){let r=null;let s=[];const a=[];function addTemplateType(){const e=s[0];const r=s[s.length-1];const n=s.reduce(((e,r)=>{if(r.value){e+=r.value}else if(r.type.label!==t.template){e+=r.type.label}return e}),"");a.push({type:"Template",value:n,start:e.start,end:r.end,loc:{start:e.loc.start,end:r.loc.end}});s=[]}e.forEach((e=>{switch(e.type.label){case t.backQuote:if(r){a.push(r);r=null}s.push(e);if(s.length>1){addTemplateType()}break;case t.dollarBraceL:s.push(e);addTemplateType();break;case t.braceR:if(r){a.push(r)}r=e;break;case t.template:if(r){s.push(r);r=null}s.push(e);break;case t.eof:if(r){a.push(r)}break;default:if(r){a.push(r);r=null}a.push(e)}}));return a}function convertToken(e,t,r){const{type:s}=e;const{label:a}=s;e.range=[e.start,e.end];if(a===r.name){e.type="Identifier"}else if(a===r.semi||a===r.comma||a===r.parenL||a===r.parenR||a===r.braceL||a===r.braceR||a===r.slash||a===r.dot||a===r.bracketL||a===r.bracketR||a===r.ellipsis||a===r.arrow||a===r.pipeline||a===r.star||a===r.incDec||a===r.colon||a===r.question||a===r.template||a===r.backQuote||a===r.dollarBraceL||a===r.at||a===r.logicalOR||a===r.logicalAND||a===r.nullishCoalescing||a===r.bitwiseOR||a===r.bitwiseXOR||a===r.bitwiseAND||a===r.equality||a===r.relational||a===r.bitShift||a===r.plusMin||a===r.modulo||a===r.exponent||a===r.bang||a===r.tilde||a===r.doubleColon||a===r.hash||a===r.questionDot||a===r.braceHashL||a===r.braceBarL||a===r.braceBarR||a===r.bracketHashL||a===r.bracketBarL||a===r.bracketBarR||s.isAssign){var n;e.type="Punctuator";(n=e.value)!=null?n:e.value=a}else if(a===r.jsxTagStart){e.type="Punctuator";e.value="<"}else if(a===r.jsxTagEnd){e.type="Punctuator";e.value=">"}else if(a===r.jsxName){e.type="JSXIdentifier"}else if(a===r.jsxText){e.type="JSXText"}else if(s.keyword==="null"){e.type="Null"}else if(s.keyword==="false"||s.keyword==="true"){e.type="Boolean"}else if(s.keyword){e.type="Keyword"}else if(a===r.num){e.type="Numeric";e.value=t.slice(e.start,e.end)}else if(a===r.string){e.type="String";e.value=t.slice(e.start,e.end)}else if(a===r.regexp){e.type="RegularExpression";const t=e.value;e.regex={pattern:t.pattern,flags:t.flags};e.value=`/${t.pattern}/${t.flags}`}else if(a===r.bigint){e.type="Numeric";e.value=`${e.value}n`}else if(a===r.privateName){e.type="PrivateIdentifier"}if(typeof e.type!=="string"){delete e.type.rightAssociative}return e}e.exports=function convertTokens(e,t,r){return convertTemplateType(e,r).filter((e=>e.type!=="CommentLine"&&e.type!=="CommentBlock")).map((e=>convertToken(e,t,r)))}},3773:(e,t,r)=>{const s=r(9530);const a=r(5926);const n=r(1527);t.ast=function convert(e,t,r,o){e.tokens=s(e.tokens,t,r);a(e.comments);n(e,o);return e};t.error=function convertError(e){if(e instanceof SyntaxError){e.lineNumber=e.loc.line;e.column=e.loc.column}return e}},8187:(e,t,r)=>{const{normalizeESLintConfig:s}=r(244);const a=r(614);const n=r(7854);const{LocalClient:o,WorkerClient:i}=r(7571);const l=new o;t.parse=function(e,t={}){return n(e,s(t),l)};t.parseForESLint=function(e,t={}){const r=s(t);const o=n(e,r,l);const i=a(o,r,l);return{ast:o,scopeManager:i,visitorKeys:l.getVisitorKeys()}}},7854:(e,t,r)=>{"use strict";const s=r(7849);const a=r(3773);function noop(){}const n=r(6949);noop((((e,t)=>(e=e.split("."),t=t.split("."),+e[0]>+t[0]||e[0]==t[0]&&+e[1]>=+t[1]))(process.versions.node,"8.9")?noop:(e,{paths:[t]},s=r(8188))=>{let a=s._findPath(e,s._nodeModulePaths(t).concat(t));if(a)return a;a=new Error(`Cannot resolve module '${e}'`);a.code="MODULE_NOT_FOUND";throw a})("@babel/parser",{paths:[noop("@babel/core/package.json")]}));let o=null;e.exports=function parse(e,t,r){const i=">=7.2.0";if(typeof o!=="boolean"){o=s.satisfies(r.getVersion(),i)}if(!o){throw new Error(`@babel/eslint-parser@${"7.15.0"} does not support @babel/core@${r.getVersion()}. Please upgrade to @babel/core@${i}.`)}const{ast:l,parserOptions:c}=r.maybeParse(e,t);if(l)return l;try{return a.ast(n.parse(e,c),e,r.getTokLabels(),r.getVisitorKeys())}catch(e){throw a.error(e)}}},76:(e,t,r)=>{const s=r(1498).KEYS;const a=r(6130);let n;t.getVisitorKeys=function getVisitorKeys(){if(!n){const e={ChainExpression:s.ChainExpression,ImportExpression:s.ImportExpression,Literal:s.Literal,MethodDefinition:["decorators"].concat(s.MethodDefinition),Property:["decorators"].concat(s.Property),PropertyDefinition:["decorators"].concat(s.PropertyDefinition)};const t={ClassPrivateMethod:["decorators"].concat(s.MethodDefinition),ExportAllDeclaration:s.ExportAllDeclaration};n=Object.assign({},e,a.types.VISITOR_KEYS,t)}return n};let o;t.getTokLabels=function getTokLabels(){return o||(o=(e=>e.reduce(((e,[t,r])=>Object.assign({},e,{[t]:r})),{}))(Object.entries(a.tokTypes).map((([e,t])=>[e,t.label]))))}},6130:(e,t,r)=>{function initialize(e){t.init=null;t.version=e.version;t.traverse=e.traverse;t.types=e.types;t.tokTypes=e.tokTypes;t.parseSync=e.parseSync;t.loadPartialConfigSync=e.loadPartialConfigSync;t.loadPartialConfigAsync=e.loadPartialConfigAsync;t.createConfigItem=e.createConfigItem}{initialize(r(8304))}},1542:(e,t,r)=>{function asyncGeneratorStep(e,t,r,s,a,n,o){try{var i=e[n](o);var l=i.value}catch(e){r(e);return}if(i.done){t(l)}else{Promise.resolve(l).then(s,a)}}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(s,a){var n=e.apply(t,r);function _next(e){asyncGeneratorStep(n,s,a,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(n,s,a,_next,_throw,"throw",e)}_next(undefined)}))}}const s=r(6130);function getParserPlugins(e){var t,r;const s=(t=(r=e.parserOpts)==null?void 0:r.plugins)!=null?t:[];const a={classFeatures:false};for(const e of s){if(Array.isArray(e)&&e[0]==="estree"){Object.assign(a,e[1]);break}}return[["estree",a],...s]}function normalizeParserOptions(e){return Object.assign({sourceType:e.sourceType,filename:e.filePath},e.babelOptions,{parserOpts:Object.assign({allowImportExportEverywhere:e.allowImportExportEverywhere,allowReturnOutsideFunction:true,allowSuperOutsideMethod:true},e.babelOptions.parserOpts,{plugins:getParserPlugins(e.babelOptions),attachComment:false,ranges:true,tokens:true}),caller:Object.assign({name:"@babel/eslint-parser"},e.babelOptions.caller)})}function validateResolvedConfig(e,t,r){if(e!==null){if(t.requireConfigFile!==false){if(!e.hasFilesystemConfig()){let t=`No Babel config file detected for ${e.options.filename}. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.`;if(e.options.filename.includes("node_modules")){t+=`\nIf you have a .babelrc.js file or use package.json#babel, keep in mind that it's not used when parsing dependencies. If you want your config to be applied to your whole app, consider using babel.config.js or babel.config.json instead.`}throw new Error(t)}}if(e.options)return e.options}return getDefaultParserOptions(r)}function getDefaultParserOptions(e){return Object.assign({plugins:[]},e,{babelrc:false,configFile:false,browserslistConfigFile:false,ignore:null,only:null})}t.normalizeBabelParseConfig=function(){var e=_asyncToGenerator((function*(e){const t=normalizeParserOptions(e);const r=yield s.loadPartialConfigAsync(t);return validateResolvedConfig(r,e,t)}));return function(t){return e.apply(this,arguments)}}();t.normalizeBabelParseConfigSync=function(e){const t=normalizeParserOptions(e);const r=s.loadPartialConfigSync(t);return validateResolvedConfig(r,e,t)}},2355:e=>{e.exports=function extractParserOptionsPlugin(){return{parserOverride(e,t){return t}}}},2100:(e,t,r)=>{const s=r(6130);const a=r(7495);const{getVisitorKeys:n,getTokLabels:o}=r(76);const{normalizeBabelParseConfig:i,normalizeBabelParseConfigSync:l}=r(1542);e.exports=function handleMessage(e,t){switch(e){case"GET_VERSION":return s.version;case"GET_TYPES_INFO":return{FLOW_FLIPPED_ALIAS_KEYS:s.types.FLIPPED_ALIAS_KEYS.Flow,VISITOR_KEYS:s.types.VISITOR_KEYS};case"GET_TOKEN_LABELS":return o();case"GET_VISITOR_KEYS":return n();case"MAYBE_PARSE":return i(t.options).then((e=>a(t.code,e)));case"MAYBE_PARSE_SYNC":{return a(t.code,l(t.options))}}throw new Error(`Unknown internal parser worker action: ${e}`)}},7495:(e,t,r)=>{const s=r(6130);const a=r(3773);const{getVisitorKeys:n,getTokLabels:o}=r(76);const i=r(2355);const l={};let c;const u=/More than one plugin attempted to override parsing/;e.exports=function maybeParse(e,t){if(!c){c=s.createConfigItem([i,l],{dirname:__dirname,type:"plugin"})}t.plugins.push(c);try{return{parserOptions:s.parseSync(e,t),ast:null}}catch(e){if(!u.test(e.message)){throw e}}let r;try{r=s.parseSync(e,t)}catch(e){throw a.error(e)}return{ast:a.ast(r,e,o(),n()),parserOptions:null}}},5619:e=>{"use strict";e.exports=JSON.parse('{"es6.module":{"chrome":"61","and_chr":"61","edge":"16","firefox":"60","and_ff":"60","node":"13.2.0","opera":"48","op_mob":"48","safari":"10.1","ios":"10.3","samsung":"8.2","android":"61","electron":"2.0","ios_saf":"10.3"}}')},7286:e=>{"use strict";e.exports=JSON.parse('{"proposal-class-static-block":{"chrome":"91","electron":"13.0"},"proposal-private-property-in-object":{"chrome":"91","firefox":"90","electron":"13.0"},"proposal-class-properties":{"chrome":"74","opera":"62","edge":"79","firefox":"90","safari":"14.1","node":"12","samsung":"11","electron":"6.0"},"proposal-private-methods":{"chrome":"84","opera":"70","edge":"84","firefox":"90","safari":"15","node":"14.6","electron":"10.0"},"proposal-numeric-separator":{"chrome":"75","opera":"62","edge":"79","firefox":"70","safari":"13","node":"12.5","ios":"13","samsung":"11","electron":"6.0"},"proposal-logical-assignment-operators":{"chrome":"85","opera":"71","edge":"85","firefox":"79","safari":"14","node":"15","ios":"14","electron":"10.0"},"proposal-nullish-coalescing-operator":{"chrome":"80","opera":"67","edge":"80","firefox":"72","safari":"13.1","node":"14","ios":"13.4","samsung":"13","electron":"8.0"},"proposal-optional-chaining":{"firefox":"74","safari":"13.1","ios":"13.4"},"proposal-json-strings":{"chrome":"66","opera":"53","edge":"79","firefox":"62","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"proposal-optional-catch-binding":{"chrome":"66","opera":"53","edge":"79","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-parameters":{"chrome":"49","opera":"36","edge":"18","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"proposal-async-generator-functions":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"proposal-object-rest-spread":{"chrome":"60","opera":"47","edge":"79","firefox":"55","safari":"11.1","node":"8.3","ios":"11.3","samsung":"8","electron":"2.0"},"transform-dotall-regex":{"chrome":"62","opera":"49","edge":"79","firefox":"78","safari":"11.1","node":"8.10","ios":"11.3","samsung":"8","electron":"3.0"},"proposal-unicode-property-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-named-capturing-groups-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-async-to-generator":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"11","node":"7.6","ios":"11","samsung":"6","electron":"1.6"},"transform-exponentiation-operator":{"chrome":"52","opera":"39","edge":"14","firefox":"52","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.3"},"transform-template-literals":{"chrome":"41","opera":"28","edge":"13","firefox":"34","safari":"13","node":"4","ios":"13","samsung":"3.4","electron":"0.21"},"transform-literals":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-function-name":{"chrome":"51","opera":"38","edge":"79","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-arrow-functions":{"chrome":"47","opera":"34","edge":"13","firefox":"45","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"transform-block-scoped-functions":{"chrome":"41","opera":"28","edge":"12","firefox":"46","safari":"10","node":"4","ie":"11","ios":"10","samsung":"3.4","electron":"0.21"},"transform-classes":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-object-super":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-shorthand-properties":{"chrome":"43","opera":"30","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.27"},"transform-duplicate-keys":{"chrome":"42","opera":"29","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.25"},"transform-computed-properties":{"chrome":"44","opera":"31","edge":"12","firefox":"34","safari":"7.1","node":"4","ios":"8","samsung":"4","electron":"0.30"},"transform-for-of":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-sticky-regex":{"chrome":"49","opera":"36","edge":"13","firefox":"3","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"transform-unicode-escapes":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-unicode-regex":{"chrome":"50","opera":"37","edge":"13","firefox":"46","safari":"12","node":"6","ios":"12","samsung":"5","electron":"1.1"},"transform-spread":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-destructuring":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-block-scoping":{"chrome":"49","opera":"36","edge":"14","firefox":"51","safari":"11","node":"6","ios":"11","samsung":"5","electron":"0.37"},"transform-typeof-symbol":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"transform-new-target":{"chrome":"46","opera":"33","edge":"14","firefox":"41","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-regenerator":{"chrome":"50","opera":"37","edge":"13","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"transform-member-expression-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"transform-property-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"transform-reserved-words":{"chrome":"13","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4.4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"proposal-export-namespace-from":{"chrome":"72","and_chr":"72","edge":"79","firefox":"80","and_ff":"80","node":"13.2","opera":"60","op_mob":"51","samsung":"11.0","android":"72","electron":"5.0"}}')},3654:e=>{"use strict";e.exports=JSON.parse('{"AssignmentExpression":["left","right"],"AssignmentPattern":["left","right"],"ArrayExpression":["elements"],"ArrayPattern":["elements"],"ArrowFunctionExpression":["params","body"],"AwaitExpression":["argument"],"BlockStatement":["body"],"BinaryExpression":["left","right"],"BreakStatement":["label"],"CallExpression":["callee","arguments"],"CatchClause":["param","body"],"ChainExpression":["expression"],"ClassBody":["body"],"ClassDeclaration":["id","superClass","body"],"ClassExpression":["id","superClass","body"],"ConditionalExpression":["test","consequent","alternate"],"ContinueStatement":["label"],"DebuggerStatement":[],"DoWhileStatement":["body","test"],"EmptyStatement":[],"ExportAllDeclaration":["exported","source"],"ExportDefaultDeclaration":["declaration"],"ExportNamedDeclaration":["declaration","specifiers","source"],"ExportSpecifier":["exported","local"],"ExpressionStatement":["expression"],"ExperimentalRestProperty":["argument"],"ExperimentalSpreadProperty":["argument"],"ForStatement":["init","test","update","body"],"ForInStatement":["left","right","body"],"ForOfStatement":["left","right","body"],"FunctionDeclaration":["id","params","body"],"FunctionExpression":["id","params","body"],"Identifier":[],"IfStatement":["test","consequent","alternate"],"ImportDeclaration":["specifiers","source"],"ImportDefaultSpecifier":["local"],"ImportExpression":["source"],"ImportNamespaceSpecifier":["local"],"ImportSpecifier":["imported","local"],"JSXAttribute":["name","value"],"JSXClosingElement":["name"],"JSXElement":["openingElement","children","closingElement"],"JSXEmptyExpression":[],"JSXExpressionContainer":["expression"],"JSXIdentifier":[],"JSXMemberExpression":["object","property"],"JSXNamespacedName":["namespace","name"],"JSXOpeningElement":["name","attributes"],"JSXSpreadAttribute":["argument"],"JSXText":[],"JSXFragment":["openingFragment","children","closingFragment"],"Literal":[],"LabeledStatement":["label","body"],"LogicalExpression":["left","right"],"MemberExpression":["object","property"],"MetaProperty":["meta","property"],"MethodDefinition":["key","value"],"NewExpression":["callee","arguments"],"ObjectExpression":["properties"],"ObjectPattern":["properties"],"PrivateIdentifier":[],"Program":["body"],"Property":["key","value"],"PropertyDefinition":["key","value"],"RestElement":["argument"],"ReturnStatement":["argument"],"SequenceExpression":["expressions"],"SpreadElement":["argument"],"Super":[],"SwitchStatement":["discriminant","cases"],"SwitchCase":["test","consequent"],"TaggedTemplateExpression":["tag","quasi"],"TemplateElement":[],"TemplateLiteral":["quasis","expressions"],"ThisExpression":[],"ThrowStatement":["argument"],"TryStatement":["block","handler","finalizer"],"UnaryExpression":["argument"],"UpdateExpression":["argument"],"VariableDeclaration":["declarations"],"VariableDeclarator":["id","init"],"WhileStatement":["test","body"],"WithStatement":["object","body"],"YieldExpression":["argument"]}')},5676:e=>{"use strict";e.exports=JSON.parse('{"assert":true,"assert/strict":">= 15","async_hooks":">= 8","buffer_ieee754":"< 0.9.7","buffer":true,"child_process":true,"cluster":true,"console":true,"constants":true,"crypto":true,"_debug_agent":">= 1 && < 8","_debugger":"< 8","dgram":true,"diagnostics_channel":">= 15.1","dns":true,"dns/promises":">= 15","domain":">= 0.7.12","events":true,"freelist":"< 6","fs":true,"fs/promises":[">= 10 && < 10.1",">= 14"],"_http_agent":">= 0.11.1","_http_client":">= 0.11.1","_http_common":">= 0.11.1","_http_incoming":">= 0.11.1","_http_outgoing":">= 0.11.1","_http_server":">= 0.11.1","http":true,"http2":">= 8.8","https":true,"inspector":">= 8.0.0","_linklist":"< 8","module":true,"net":true,"node-inspect/lib/_inspect":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6.0 && < 12","os":true,"path":true,"path/posix":">= 15.3","path/win32":">= 15.3","perf_hooks":">= 8.5","process":">= 1","punycode":true,"querystring":true,"readline":true,"repl":true,"smalloc":">= 0.11.5 && < 3","_stream_duplex":">= 0.9.4","_stream_transform":">= 0.9.4","_stream_wrap":">= 1.4.1","_stream_passthrough":">= 0.9.4","_stream_readable":">= 0.9.4","_stream_writable":">= 0.9.4","stream":true,"stream/promises":">= 15","string_decoder":true,"sys":[">= 0.6 && < 0.7",">= 0.8"],"timers":true,"timers/promises":">= 15","_tls_common":">= 0.11.13","_tls_legacy":">= 0.11.3 && < 10","_tls_wrap":">= 0.11.3","tls":true,"trace_events":">= 10","tty":true,"url":true,"util":true,"util/types":">= 15.3","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/consarray":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/csvparser":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/logreader":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/profile_view":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/splaytree":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8":">= 1","vm":true,"wasi":">= 13.4 && < 13.5","worker_threads":">= 11.7","zlib":true}')},6190:e=>{"use strict";e.exports=JSON.parse('{"name":"@babel/helper-create-class-features-plugin","version":"7.12.1","author":"The Babel Team (https://babeljs.io/team)","license":"MIT","description":"Compile class public and private fields, private methods and decorators to ES6","repository":{"type":"git","url":"https://github.com/babel/babel.git","directory":"packages/babel-helper-create-class-features-plugin"},"main":"lib/index.js","publishConfig":{"access":"public"},"keywords":["babel","babel-plugin"],"dependencies":{"@babel/helper-function-name":"^7.10.4","@babel/helper-member-expression-to-functions":"^7.12.1","@babel/helper-optimise-call-expression":"^7.10.4","@babel/helper-replace-supers":"^7.12.1","@babel/helper-split-export-declaration":"^7.10.4"},"peerDependencies":{"@babel/core":"^7.0.0"},"devDependencies":{"@babel/core":"^7.12.1","@babel/helper-plugin-test-runner":"7.10.4"}}')},5880:e=>{"use strict";e.exports=JSON.parse('{"es6.array.copy-within":{"chrome":"45","opera":"32","edge":"12","firefox":"32","safari":"9","node":"4","ios":"9","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.every":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.fill":{"chrome":"45","opera":"32","edge":"12","firefox":"31","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.filter":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.find":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.find-index":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es7.array.flat-map":{"chrome":"69","opera":"56","edge":"79","firefox":"62","safari":"12","node":"11","ios":"12","samsung":"10","electron":"4.0"},"es6.array.for-each":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.from":{"chrome":"51","opera":"38","edge":"15","firefox":"36","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.array.includes":{"chrome":"47","opera":"34","edge":"14","firefox":"43","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.array.index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.is-array":{"chrome":"5","opera":"10.50","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.iterator":{"chrome":"66","opera":"53","edge":"12","firefox":"60","safari":"9","node":"10","ios":"9","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es6.array.last-index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.map":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.of":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"9","node":"4","ios":"9","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.reduce":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.reduce-right":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.slice":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.some":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.sort":{"chrome":"63","opera":"50","edge":"12","firefox":"5","safari":"12","node":"10","ie":"9","ios":"12","samsung":"8","rhino":"1.7.13","electron":"3.0"},"es6.array.species":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.date.now":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-iso-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-json":{"chrome":"5","opera":"12.10","edge":"12","firefox":"4","safari":"10","node":"0.10","ie":"9","android":"4","ios":"10","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-primitive":{"chrome":"47","opera":"34","edge":"15","firefox":"44","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.date.to-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.function.bind":{"chrome":"7","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.function.has-instance":{"chrome":"51","opera":"38","edge":"15","firefox":"50","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.function.name":{"chrome":"5","opera":"10.50","edge":"14","firefox":"2","safari":"4","node":"0.10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.math.acosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.asinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.atanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.cbrt":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.clz32":{"chrome":"38","opera":"25","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.cosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.expm1":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.fround":{"chrome":"38","opera":"25","edge":"12","firefox":"26","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.hypot":{"chrome":"38","opera":"25","edge":"12","firefox":"27","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.imul":{"chrome":"30","opera":"17","edge":"12","firefox":"23","safari":"7","node":"0.12","android":"4.4","ios":"7","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.math.log1p":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.log10":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.log2":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.sign":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.sinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.tanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.trunc":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.number.constructor":{"chrome":"41","opera":"28","edge":"12","firefox":"36","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.number.epsilon":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.is-finite":{"chrome":"19","opera":"15","edge":"12","firefox":"16","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.number.is-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"16","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.is-nan":{"chrome":"19","opera":"15","edge":"12","firefox":"15","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.number.is-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"32","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.max-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.min-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.parse-float":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.parse-int":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.object.assign":{"chrome":"49","opera":"36","edge":"13","firefox":"36","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.object.create":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.object.define-getter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.define-setter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.define-property":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.object.define-properties":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.object.entries":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.freeze":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.get-own-property-descriptor":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es7.object.get-own-property-descriptors":{"chrome":"54","opera":"41","edge":"15","firefox":"50","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.get-own-property-names":{"chrome":"40","opera":"27","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.object.get-prototype-of":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es7.object.lookup-getter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.lookup-setter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.prevent-extensions":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.to-string":{"chrome":"57","opera":"44","edge":"15","firefox":"51","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es6.object.is":{"chrome":"19","opera":"15","edge":"12","firefox":"22","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.object.is-frozen":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.is-sealed":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.is-extensible":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.keys":{"chrome":"40","opera":"27","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.object.seal":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.set-prototype-of":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ie":"11","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es7.object.values":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.promise":{"chrome":"51","opera":"38","edge":"14","firefox":"45","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.promise.finally":{"chrome":"63","opera":"50","edge":"18","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"8","electron":"3.0"},"es6.reflect.apply":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.construct":{"chrome":"49","opera":"36","edge":"13","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.define-property":{"chrome":"49","opera":"36","edge":"13","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.delete-property":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-own-property-descriptor":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.has":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.is-extensible":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.own-keys":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.prevent-extensions":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.regexp.constructor":{"chrome":"50","opera":"37","edge":"79","firefox":"40","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.flags":{"chrome":"49","opera":"36","edge":"79","firefox":"37","safari":"9","node":"6","ios":"9","samsung":"5","electron":"0.37"},"es6.regexp.match":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"1.1"},"es6.regexp.replace":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.split":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.search":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"1.1"},"es6.regexp.to-string":{"chrome":"50","opera":"37","edge":"79","firefox":"39","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.symbol":{"chrome":"51","opera":"38","edge":"79","firefox":"51","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.symbol.async-iterator":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"es6.string.anchor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.big":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.blink":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.bold":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.code-point-at":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.ends-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.fixed":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontcolor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontsize":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.from-code-point":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.includes":{"chrome":"41","opera":"28","edge":"12","firefox":"40","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.italics":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.iterator":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.string.link":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es7.string.pad-start":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","rhino":"1.7.13","electron":"1.7"},"es7.string.pad-end":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","rhino":"1.7.13","electron":"1.7"},"es6.string.raw":{"chrome":"41","opera":"28","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.repeat":{"chrome":"41","opera":"28","edge":"12","firefox":"24","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.small":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.starts-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.strike":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sub":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sup":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.trim":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.string.trim-left":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es7.string.trim-right":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es6.typed.array-buffer":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.data-view":{"chrome":"5","opera":"12","edge":"12","firefox":"15","safari":"5.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.typed.int8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-clamped-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float64-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.weak-map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"},"es6.weak-set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"}}')},2166:e=>{"use strict";e.exports={version:"4.3.0"}},290:e=>{"use strict";e.exports={i8:"5.1.1"}},5535:e=>{"use strict";e.exports={i8:"4.3.0"}},964:e=>{"use strict";e.exports=JSON.parse('{"builtin":{"Array":false,"ArrayBuffer":false,"Atomics":false,"BigInt":false,"BigInt64Array":false,"BigUint64Array":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"globalThis":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"es5":{"Array":false,"Boolean":false,"constructor":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"propertyIsEnumerable":false,"RangeError":false,"ReferenceError":false,"RegExp":false,"String":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false},"es2015":{"Array":false,"ArrayBuffer":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"es2017":{"Array":false,"ArrayBuffer":false,"Atomics":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"browser":{"AbortController":false,"AbortSignal":false,"addEventListener":false,"alert":false,"AnalyserNode":false,"Animation":false,"AnimationEffectReadOnly":false,"AnimationEffectTiming":false,"AnimationEffectTimingReadOnly":false,"AnimationEvent":false,"AnimationPlaybackEvent":false,"AnimationTimeline":false,"applicationCache":false,"ApplicationCache":false,"ApplicationCacheErrorEvent":false,"atob":false,"Attr":false,"Audio":false,"AudioBuffer":false,"AudioBufferSourceNode":false,"AudioContext":false,"AudioDestinationNode":false,"AudioListener":false,"AudioNode":false,"AudioParam":false,"AudioProcessingEvent":false,"AudioScheduledSourceNode":false,"AudioWorkletGlobalScope ":false,"AudioWorkletNode":false,"AudioWorkletProcessor":false,"BarProp":false,"BaseAudioContext":false,"BatteryManager":false,"BeforeUnloadEvent":false,"BiquadFilterNode":false,"Blob":false,"BlobEvent":false,"blur":false,"BroadcastChannel":false,"btoa":false,"BudgetService":false,"ByteLengthQueuingStrategy":false,"Cache":false,"caches":false,"CacheStorage":false,"cancelAnimationFrame":false,"cancelIdleCallback":false,"CanvasCaptureMediaStreamTrack":false,"CanvasGradient":false,"CanvasPattern":false,"CanvasRenderingContext2D":false,"ChannelMergerNode":false,"ChannelSplitterNode":false,"CharacterData":false,"clearInterval":false,"clearTimeout":false,"clientInformation":false,"ClipboardEvent":false,"close":false,"closed":false,"CloseEvent":false,"Comment":false,"CompositionEvent":false,"confirm":false,"console":false,"ConstantSourceNode":false,"ConvolverNode":false,"CountQueuingStrategy":false,"createImageBitmap":false,"Credential":false,"CredentialsContainer":false,"crypto":false,"Crypto":false,"CryptoKey":false,"CSS":false,"CSSConditionRule":false,"CSSFontFaceRule":false,"CSSGroupingRule":false,"CSSImportRule":false,"CSSKeyframeRule":false,"CSSKeyframesRule":false,"CSSMediaRule":false,"CSSNamespaceRule":false,"CSSPageRule":false,"CSSRule":false,"CSSRuleList":false,"CSSStyleDeclaration":false,"CSSStyleRule":false,"CSSStyleSheet":false,"CSSSupportsRule":false,"CustomElementRegistry":false,"customElements":false,"CustomEvent":false,"DataTransfer":false,"DataTransferItem":false,"DataTransferItemList":false,"defaultstatus":false,"defaultStatus":false,"DelayNode":false,"DeviceMotionEvent":false,"DeviceOrientationEvent":false,"devicePixelRatio":false,"dispatchEvent":false,"document":false,"Document":false,"DocumentFragment":false,"DocumentType":false,"DOMError":false,"DOMException":false,"DOMImplementation":false,"DOMMatrix":false,"DOMMatrixReadOnly":false,"DOMParser":false,"DOMPoint":false,"DOMPointReadOnly":false,"DOMQuad":false,"DOMRect":false,"DOMRectReadOnly":false,"DOMStringList":false,"DOMStringMap":false,"DOMTokenList":false,"DragEvent":false,"DynamicsCompressorNode":false,"Element":false,"ErrorEvent":false,"event":false,"Event":false,"EventSource":false,"EventTarget":false,"external":false,"fetch":false,"File":false,"FileList":false,"FileReader":false,"find":false,"focus":false,"FocusEvent":false,"FontFace":false,"FontFaceSetLoadEvent":false,"FormData":false,"frameElement":false,"frames":false,"GainNode":false,"Gamepad":false,"GamepadButton":false,"GamepadEvent":false,"getComputedStyle":false,"getSelection":false,"HashChangeEvent":false,"Headers":false,"history":false,"History":false,"HTMLAllCollection":false,"HTMLAnchorElement":false,"HTMLAreaElement":false,"HTMLAudioElement":false,"HTMLBaseElement":false,"HTMLBodyElement":false,"HTMLBRElement":false,"HTMLButtonElement":false,"HTMLCanvasElement":false,"HTMLCollection":false,"HTMLContentElement":false,"HTMLDataElement":false,"HTMLDataListElement":false,"HTMLDetailsElement":false,"HTMLDialogElement":false,"HTMLDirectoryElement":false,"HTMLDivElement":false,"HTMLDListElement":false,"HTMLDocument":false,"HTMLElement":false,"HTMLEmbedElement":false,"HTMLFieldSetElement":false,"HTMLFontElement":false,"HTMLFormControlsCollection":false,"HTMLFormElement":false,"HTMLFrameElement":false,"HTMLFrameSetElement":false,"HTMLHeadElement":false,"HTMLHeadingElement":false,"HTMLHRElement":false,"HTMLHtmlElement":false,"HTMLIFrameElement":false,"HTMLImageElement":false,"HTMLInputElement":false,"HTMLLabelElement":false,"HTMLLegendElement":false,"HTMLLIElement":false,"HTMLLinkElement":false,"HTMLMapElement":false,"HTMLMarqueeElement":false,"HTMLMediaElement":false,"HTMLMenuElement":false,"HTMLMetaElement":false,"HTMLMeterElement":false,"HTMLModElement":false,"HTMLObjectElement":false,"HTMLOListElement":false,"HTMLOptGroupElement":false,"HTMLOptionElement":false,"HTMLOptionsCollection":false,"HTMLOutputElement":false,"HTMLParagraphElement":false,"HTMLParamElement":false,"HTMLPictureElement":false,"HTMLPreElement":false,"HTMLProgressElement":false,"HTMLQuoteElement":false,"HTMLScriptElement":false,"HTMLSelectElement":false,"HTMLShadowElement":false,"HTMLSlotElement":false,"HTMLSourceElement":false,"HTMLSpanElement":false,"HTMLStyleElement":false,"HTMLTableCaptionElement":false,"HTMLTableCellElement":false,"HTMLTableColElement":false,"HTMLTableElement":false,"HTMLTableRowElement":false,"HTMLTableSectionElement":false,"HTMLTemplateElement":false,"HTMLTextAreaElement":false,"HTMLTimeElement":false,"HTMLTitleElement":false,"HTMLTrackElement":false,"HTMLUListElement":false,"HTMLUnknownElement":false,"HTMLVideoElement":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"IdleDeadline":false,"IIRFilterNode":false,"Image":false,"ImageBitmap":false,"ImageBitmapRenderingContext":false,"ImageCapture":false,"ImageData":false,"indexedDB":false,"innerHeight":false,"innerWidth":false,"InputEvent":false,"IntersectionObserver":false,"IntersectionObserverEntry":false,"Intl":false,"isSecureContext":false,"KeyboardEvent":false,"KeyframeEffect":false,"KeyframeEffectReadOnly":false,"length":false,"localStorage":false,"location":true,"Location":false,"locationbar":false,"matchMedia":false,"MediaDeviceInfo":false,"MediaDevices":false,"MediaElementAudioSourceNode":false,"MediaEncryptedEvent":false,"MediaError":false,"MediaKeyMessageEvent":false,"MediaKeySession":false,"MediaKeyStatusMap":false,"MediaKeySystemAccess":false,"MediaList":false,"MediaQueryList":false,"MediaQueryListEvent":false,"MediaRecorder":false,"MediaSettingsRange":false,"MediaSource":false,"MediaStream":false,"MediaStreamAudioDestinationNode":false,"MediaStreamAudioSourceNode":false,"MediaStreamEvent":false,"MediaStreamTrack":false,"MediaStreamTrackEvent":false,"menubar":false,"MessageChannel":false,"MessageEvent":false,"MessagePort":false,"MIDIAccess":false,"MIDIConnectionEvent":false,"MIDIInput":false,"MIDIInputMap":false,"MIDIMessageEvent":false,"MIDIOutput":false,"MIDIOutputMap":false,"MIDIPort":false,"MimeType":false,"MimeTypeArray":false,"MouseEvent":false,"moveBy":false,"moveTo":false,"MutationEvent":false,"MutationObserver":false,"MutationRecord":false,"name":false,"NamedNodeMap":false,"NavigationPreloadManager":false,"navigator":false,"Navigator":false,"NetworkInformation":false,"Node":false,"NodeFilter":false,"NodeIterator":false,"NodeList":false,"Notification":false,"OfflineAudioCompletionEvent":false,"OfflineAudioContext":false,"offscreenBuffering":false,"OffscreenCanvas":true,"onabort":true,"onafterprint":true,"onanimationend":true,"onanimationiteration":true,"onanimationstart":true,"onappinstalled":true,"onauxclick":true,"onbeforeinstallprompt":true,"onbeforeprint":true,"onbeforeunload":true,"onblur":true,"oncancel":true,"oncanplay":true,"oncanplaythrough":true,"onchange":true,"onclick":true,"onclose":true,"oncontextmenu":true,"oncuechange":true,"ondblclick":true,"ondevicemotion":true,"ondeviceorientation":true,"ondeviceorientationabsolute":true,"ondrag":true,"ondragend":true,"ondragenter":true,"ondragleave":true,"ondragover":true,"ondragstart":true,"ondrop":true,"ondurationchange":true,"onemptied":true,"onended":true,"onerror":true,"onfocus":true,"ongotpointercapture":true,"onhashchange":true,"oninput":true,"oninvalid":true,"onkeydown":true,"onkeypress":true,"onkeyup":true,"onlanguagechange":true,"onload":true,"onloadeddata":true,"onloadedmetadata":true,"onloadstart":true,"onlostpointercapture":true,"onmessage":true,"onmessageerror":true,"onmousedown":true,"onmouseenter":true,"onmouseleave":true,"onmousemove":true,"onmouseout":true,"onmouseover":true,"onmouseup":true,"onmousewheel":true,"onoffline":true,"ononline":true,"onpagehide":true,"onpageshow":true,"onpause":true,"onplay":true,"onplaying":true,"onpointercancel":true,"onpointerdown":true,"onpointerenter":true,"onpointerleave":true,"onpointermove":true,"onpointerout":true,"onpointerover":true,"onpointerup":true,"onpopstate":true,"onprogress":true,"onratechange":true,"onrejectionhandled":true,"onreset":true,"onresize":true,"onscroll":true,"onsearch":true,"onseeked":true,"onseeking":true,"onselect":true,"onstalled":true,"onstorage":true,"onsubmit":true,"onsuspend":true,"ontimeupdate":true,"ontoggle":true,"ontransitionend":true,"onunhandledrejection":true,"onunload":true,"onvolumechange":true,"onwaiting":true,"onwheel":true,"open":false,"openDatabase":false,"opener":false,"Option":false,"origin":false,"OscillatorNode":false,"outerHeight":false,"outerWidth":false,"PageTransitionEvent":false,"pageXOffset":false,"pageYOffset":false,"PannerNode":false,"parent":false,"Path2D":false,"PaymentAddress":false,"PaymentRequest":false,"PaymentRequestUpdateEvent":false,"PaymentResponse":false,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceLongTaskTiming":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceNavigationTiming":false,"PerformanceObserver":false,"PerformanceObserverEntryList":false,"PerformancePaintTiming":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"PeriodicWave":false,"Permissions":false,"PermissionStatus":false,"personalbar":false,"PhotoCapabilities":false,"Plugin":false,"PluginArray":false,"PointerEvent":false,"PopStateEvent":false,"postMessage":false,"Presentation":false,"PresentationAvailability":false,"PresentationConnection":false,"PresentationConnectionAvailableEvent":false,"PresentationConnectionCloseEvent":false,"PresentationConnectionList":false,"PresentationReceiver":false,"PresentationRequest":false,"print":false,"ProcessingInstruction":false,"ProgressEvent":false,"PromiseRejectionEvent":false,"prompt":false,"PushManager":false,"PushSubscription":false,"PushSubscriptionOptions":false,"queueMicrotask":false,"RadioNodeList":false,"Range":false,"ReadableStream":false,"registerProcessor":false,"RemotePlayback":false,"removeEventListener":false,"Request":false,"requestAnimationFrame":false,"requestIdleCallback":false,"resizeBy":false,"ResizeObserver":false,"ResizeObserverEntry":false,"resizeTo":false,"Response":false,"RTCCertificate":false,"RTCDataChannel":false,"RTCDataChannelEvent":false,"RTCDtlsTransport":false,"RTCIceCandidate":false,"RTCIceGatherer":false,"RTCIceTransport":false,"RTCPeerConnection":false,"RTCPeerConnectionIceEvent":false,"RTCRtpContributingSource":false,"RTCRtpReceiver":false,"RTCRtpSender":false,"RTCSctpTransport":false,"RTCSessionDescription":false,"RTCStatsReport":false,"RTCTrackEvent":false,"screen":false,"Screen":false,"screenLeft":false,"ScreenOrientation":false,"screenTop":false,"screenX":false,"screenY":false,"ScriptProcessorNode":false,"scroll":false,"scrollbars":false,"scrollBy":false,"scrollTo":false,"scrollX":false,"scrollY":false,"SecurityPolicyViolationEvent":false,"Selection":false,"self":false,"ServiceWorker":false,"ServiceWorkerContainer":false,"ServiceWorkerRegistration":false,"sessionStorage":false,"setInterval":false,"setTimeout":false,"ShadowRoot":false,"SharedWorker":false,"SourceBuffer":false,"SourceBufferList":false,"speechSynthesis":false,"SpeechSynthesisEvent":false,"SpeechSynthesisUtterance":false,"StaticRange":false,"status":false,"statusbar":false,"StereoPannerNode":false,"stop":false,"Storage":false,"StorageEvent":false,"StorageManager":false,"styleMedia":false,"StyleSheet":false,"StyleSheetList":false,"SubtleCrypto":false,"SVGAElement":false,"SVGAngle":false,"SVGAnimatedAngle":false,"SVGAnimatedBoolean":false,"SVGAnimatedEnumeration":false,"SVGAnimatedInteger":false,"SVGAnimatedLength":false,"SVGAnimatedLengthList":false,"SVGAnimatedNumber":false,"SVGAnimatedNumberList":false,"SVGAnimatedPreserveAspectRatio":false,"SVGAnimatedRect":false,"SVGAnimatedString":false,"SVGAnimatedTransformList":false,"SVGAnimateElement":false,"SVGAnimateMotionElement":false,"SVGAnimateTransformElement":false,"SVGAnimationElement":false,"SVGCircleElement":false,"SVGClipPathElement":false,"SVGComponentTransferFunctionElement":false,"SVGDefsElement":false,"SVGDescElement":false,"SVGDiscardElement":false,"SVGElement":false,"SVGEllipseElement":false,"SVGFEBlendElement":false,"SVGFEColorMatrixElement":false,"SVGFEComponentTransferElement":false,"SVGFECompositeElement":false,"SVGFEConvolveMatrixElement":false,"SVGFEDiffuseLightingElement":false,"SVGFEDisplacementMapElement":false,"SVGFEDistantLightElement":false,"SVGFEDropShadowElement":false,"SVGFEFloodElement":false,"SVGFEFuncAElement":false,"SVGFEFuncBElement":false,"SVGFEFuncGElement":false,"SVGFEFuncRElement":false,"SVGFEGaussianBlurElement":false,"SVGFEImageElement":false,"SVGFEMergeElement":false,"SVGFEMergeNodeElement":false,"SVGFEMorphologyElement":false,"SVGFEOffsetElement":false,"SVGFEPointLightElement":false,"SVGFESpecularLightingElement":false,"SVGFESpotLightElement":false,"SVGFETileElement":false,"SVGFETurbulenceElement":false,"SVGFilterElement":false,"SVGForeignObjectElement":false,"SVGGElement":false,"SVGGeometryElement":false,"SVGGradientElement":false,"SVGGraphicsElement":false,"SVGImageElement":false,"SVGLength":false,"SVGLengthList":false,"SVGLinearGradientElement":false,"SVGLineElement":false,"SVGMarkerElement":false,"SVGMaskElement":false,"SVGMatrix":false,"SVGMetadataElement":false,"SVGMPathElement":false,"SVGNumber":false,"SVGNumberList":false,"SVGPathElement":false,"SVGPatternElement":false,"SVGPoint":false,"SVGPointList":false,"SVGPolygonElement":false,"SVGPolylineElement":false,"SVGPreserveAspectRatio":false,"SVGRadialGradientElement":false,"SVGRect":false,"SVGRectElement":false,"SVGScriptElement":false,"SVGSetElement":false,"SVGStopElement":false,"SVGStringList":false,"SVGStyleElement":false,"SVGSVGElement":false,"SVGSwitchElement":false,"SVGSymbolElement":false,"SVGTextContentElement":false,"SVGTextElement":false,"SVGTextPathElement":false,"SVGTextPositioningElement":false,"SVGTitleElement":false,"SVGTransform":false,"SVGTransformList":false,"SVGTSpanElement":false,"SVGUnitTypes":false,"SVGUseElement":false,"SVGViewElement":false,"TaskAttributionTiming":false,"Text":false,"TextDecoder":false,"TextEncoder":false,"TextEvent":false,"TextMetrics":false,"TextTrack":false,"TextTrackCue":false,"TextTrackCueList":false,"TextTrackList":false,"TimeRanges":false,"toolbar":false,"top":false,"Touch":false,"TouchEvent":false,"TouchList":false,"TrackEvent":false,"TransitionEvent":false,"TreeWalker":false,"UIEvent":false,"URL":false,"URLSearchParams":false,"ValidityState":false,"visualViewport":false,"VisualViewport":false,"VTTCue":false,"WaveShaperNode":false,"WebAssembly":false,"WebGL2RenderingContext":false,"WebGLActiveInfo":false,"WebGLBuffer":false,"WebGLContextEvent":false,"WebGLFramebuffer":false,"WebGLProgram":false,"WebGLQuery":false,"WebGLRenderbuffer":false,"WebGLRenderingContext":false,"WebGLSampler":false,"WebGLShader":false,"WebGLShaderPrecisionFormat":false,"WebGLSync":false,"WebGLTexture":false,"WebGLTransformFeedback":false,"WebGLUniformLocation":false,"WebGLVertexArrayObject":false,"WebSocket":false,"WheelEvent":false,"window":false,"Window":false,"Worker":false,"WritableStream":false,"XMLDocument":false,"XMLHttpRequest":false,"XMLHttpRequestEventTarget":false,"XMLHttpRequestUpload":false,"XMLSerializer":false,"XPathEvaluator":false,"XPathExpression":false,"XPathResult":false,"XSLTProcessor":false},"worker":{"addEventListener":false,"applicationCache":false,"atob":false,"Blob":false,"BroadcastChannel":false,"btoa":false,"Cache":false,"caches":false,"clearInterval":false,"clearTimeout":false,"close":true,"console":false,"fetch":false,"FileReaderSync":false,"FormData":false,"Headers":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"ImageData":false,"importScripts":true,"indexedDB":false,"location":false,"MessageChannel":false,"MessagePort":false,"name":false,"navigator":false,"Notification":false,"onclose":true,"onconnect":true,"onerror":true,"onlanguagechange":true,"onmessage":true,"onoffline":true,"ononline":true,"onrejectionhandled":true,"onunhandledrejection":true,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"postMessage":true,"Promise":false,"queueMicrotask":false,"removeEventListener":false,"Request":false,"Response":false,"self":true,"ServiceWorkerRegistration":false,"setInterval":false,"setTimeout":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false,"WebSocket":false,"Worker":false,"WorkerGlobalScope":false,"XMLHttpRequest":false},"node":{"__dirname":false,"__filename":false,"Buffer":false,"clearImmediate":false,"clearInterval":false,"clearTimeout":false,"console":false,"exports":true,"global":false,"Intl":false,"module":false,"process":false,"queueMicrotask":false,"require":false,"setImmediate":false,"setInterval":false,"setTimeout":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false},"commonjs":{"exports":true,"global":false,"module":false,"require":false},"amd":{"define":false,"require":false},"mocha":{"after":false,"afterEach":false,"before":false,"beforeEach":false,"context":false,"describe":false,"it":false,"mocha":false,"run":false,"setup":false,"specify":false,"suite":false,"suiteSetup":false,"suiteTeardown":false,"teardown":false,"test":false,"xcontext":false,"xdescribe":false,"xit":false,"xspecify":false},"jasmine":{"afterAll":false,"afterEach":false,"beforeAll":false,"beforeEach":false,"describe":false,"expect":false,"fail":false,"fdescribe":false,"fit":false,"it":false,"jasmine":false,"pending":false,"runs":false,"spyOn":false,"spyOnProperty":false,"waits":false,"waitsFor":false,"xdescribe":false,"xit":false},"jest":{"afterAll":false,"afterEach":false,"beforeAll":false,"beforeEach":false,"describe":false,"expect":false,"fdescribe":false,"fit":false,"it":false,"jest":false,"pit":false,"require":false,"test":false,"xdescribe":false,"xit":false,"xtest":false},"qunit":{"asyncTest":false,"deepEqual":false,"equal":false,"expect":false,"module":false,"notDeepEqual":false,"notEqual":false,"notOk":false,"notPropEqual":false,"notStrictEqual":false,"ok":false,"propEqual":false,"QUnit":false,"raises":false,"start":false,"stop":false,"strictEqual":false,"test":false,"throws":false},"phantomjs":{"console":true,"exports":true,"phantom":true,"require":true,"WebPage":true},"couch":{"emit":false,"exports":false,"getRow":false,"log":false,"module":false,"provides":false,"require":false,"respond":false,"send":false,"start":false,"sum":false},"rhino":{"defineClass":false,"deserialize":false,"gc":false,"help":false,"importClass":false,"importPackage":false,"java":false,"load":false,"loadClass":false,"Packages":false,"print":false,"quit":false,"readFile":false,"readUrl":false,"runCommand":false,"seal":false,"serialize":false,"spawn":false,"sync":false,"toint32":false,"version":false},"nashorn":{"__DIR__":false,"__FILE__":false,"__LINE__":false,"com":false,"edu":false,"exit":false,"java":false,"Java":false,"javafx":false,"JavaImporter":false,"javax":false,"JSAdapter":false,"load":false,"loadWithNewGlobal":false,"org":false,"Packages":false,"print":false,"quit":false},"wsh":{"ActiveXObject":true,"Enumerator":true,"GetObject":true,"ScriptEngine":true,"ScriptEngineBuildVersion":true,"ScriptEngineMajorVersion":true,"ScriptEngineMinorVersion":true,"VBArray":true,"WScript":true,"WSH":true,"XDomainRequest":true},"jquery":{"$":false,"jQuery":false},"yui":{"YAHOO":false,"YAHOO_config":false,"YUI":false,"YUI_config":false},"shelljs":{"cat":false,"cd":false,"chmod":false,"config":false,"cp":false,"dirs":false,"echo":false,"env":false,"error":false,"exec":false,"exit":false,"find":false,"grep":false,"ln":false,"ls":false,"mkdir":false,"mv":false,"popd":false,"pushd":false,"pwd":false,"rm":false,"sed":false,"set":false,"target":false,"tempdir":false,"test":false,"touch":false,"which":false},"prototypejs":{"$":false,"$$":false,"$A":false,"$break":false,"$continue":false,"$F":false,"$H":false,"$R":false,"$w":false,"Abstract":false,"Ajax":false,"Autocompleter":false,"Builder":false,"Class":false,"Control":false,"Draggable":false,"Draggables":false,"Droppables":false,"Effect":false,"Element":false,"Enumerable":false,"Event":false,"Field":false,"Form":false,"Hash":false,"Insertion":false,"ObjectRange":false,"PeriodicalExecuter":false,"Position":false,"Prototype":false,"Scriptaculous":false,"Selector":false,"Sortable":false,"SortableObserver":false,"Sound":false,"Template":false,"Toggle":false,"Try":false},"meteor":{"_":false,"$":false,"Accounts":false,"AccountsClient":false,"AccountsCommon":false,"AccountsServer":false,"App":false,"Assets":false,"Blaze":false,"check":false,"Cordova":false,"DDP":false,"DDPRateLimiter":false,"DDPServer":false,"Deps":false,"EJSON":false,"Email":false,"HTTP":false,"Log":false,"Match":false,"Meteor":false,"Mongo":false,"MongoInternals":false,"Npm":false,"Package":false,"Plugin":false,"process":false,"Random":false,"ReactiveDict":false,"ReactiveVar":false,"Router":false,"ServiceConfiguration":false,"Session":false,"share":false,"Spacebars":false,"Template":false,"Tinytest":false,"Tracker":false,"UI":false,"Utils":false,"WebApp":false,"WebAppInternals":false},"mongo":{"_isWindows":false,"_rand":false,"BulkWriteResult":false,"cat":false,"cd":false,"connect":false,"db":false,"getHostName":false,"getMemInfo":false,"hostname":false,"ISODate":false,"listFiles":false,"load":false,"ls":false,"md5sumFile":false,"mkdir":false,"Mongo":false,"NumberInt":false,"NumberLong":false,"ObjectId":false,"PlanCache":false,"print":false,"printjson":false,"pwd":false,"quit":false,"removeFile":false,"rs":false,"sh":false,"UUID":false,"version":false,"WriteResult":false},"applescript":{"$":false,"Application":false,"Automation":false,"console":false,"delay":false,"Library":false,"ObjC":false,"ObjectSpecifier":false,"Path":false,"Progress":false,"Ref":false},"serviceworker":{"addEventListener":false,"applicationCache":false,"atob":false,"Blob":false,"BroadcastChannel":false,"btoa":false,"Cache":false,"caches":false,"CacheStorage":false,"clearInterval":false,"clearTimeout":false,"Client":false,"clients":false,"Clients":false,"close":true,"console":false,"ExtendableEvent":false,"ExtendableMessageEvent":false,"fetch":false,"FetchEvent":false,"FileReaderSync":false,"FormData":false,"Headers":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"ImageData":false,"importScripts":false,"indexedDB":false,"location":false,"MessageChannel":false,"MessagePort":false,"name":false,"navigator":false,"Notification":false,"onclose":true,"onconnect":true,"onerror":true,"onfetch":true,"oninstall":true,"onlanguagechange":true,"onmessage":true,"onmessageerror":true,"onnotificationclick":true,"onnotificationclose":true,"onoffline":true,"ononline":true,"onpush":true,"onpushsubscriptionchange":true,"onrejectionhandled":true,"onsync":true,"onunhandledrejection":true,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"postMessage":true,"Promise":false,"queueMicrotask":false,"registration":false,"removeEventListener":false,"Request":false,"Response":false,"self":false,"ServiceWorker":false,"ServiceWorkerContainer":false,"ServiceWorkerGlobalScope":false,"ServiceWorkerMessageEvent":false,"ServiceWorkerRegistration":false,"setInterval":false,"setTimeout":false,"skipWaiting":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false,"WebSocket":false,"WindowClient":false,"Worker":false,"WorkerGlobalScope":false,"XMLHttpRequest":false},"atomtest":{"advanceClock":false,"fakeClearInterval":false,"fakeClearTimeout":false,"fakeSetInterval":false,"fakeSetTimeout":false,"resetTimeouts":false,"waitsForPromise":false},"embertest":{"andThen":false,"click":false,"currentPath":false,"currentRouteName":false,"currentURL":false,"fillIn":false,"find":false,"findAll":false,"findWithAssert":false,"keyEvent":false,"pauseTest":false,"resumeTest":false,"triggerEvent":false,"visit":false,"wait":false},"protractor":{"$":false,"$$":false,"browser":false,"by":false,"By":false,"DartObject":false,"element":false,"protractor":false},"shared-node-browser":{"clearInterval":false,"clearTimeout":false,"console":false,"setInterval":false,"setTimeout":false,"URL":false,"URLSearchParams":false},"webextensions":{"browser":false,"chrome":false,"opr":false},"greasemonkey":{"cloneInto":false,"createObjectIn":false,"exportFunction":false,"GM":false,"GM_addStyle":false,"GM_deleteValue":false,"GM_getResourceText":false,"GM_getResourceURL":false,"GM_getValue":false,"GM_info":false,"GM_listValues":false,"GM_log":false,"GM_openInTab":false,"GM_registerMenuCommand":false,"GM_setClipboard":false,"GM_setValue":false,"GM_xmlhttpRequest":false,"unsafeWindow":false},"devtools":{"$":false,"$_":false,"$$":false,"$0":false,"$1":false,"$2":false,"$3":false,"$4":false,"$x":false,"chrome":false,"clear":false,"copy":false,"debug":false,"dir":false,"dirxml":false,"getEventListeners":false,"inspect":false,"keys":false,"monitor":false,"monitorEvents":false,"profile":false,"profileEnd":false,"queryObjects":false,"table":false,"undebug":false,"unmonitor":false,"unmonitorEvents":false,"values":false}}')},4651:e=>{"use strict";e.exports=JSON.parse('{"assert":true,"assert/strict":">= 15","async_hooks":">= 8","buffer_ieee754":"< 0.9.7","buffer":true,"child_process":true,"cluster":true,"console":true,"constants":true,"crypto":true,"_debug_agent":">= 1 && < 8","_debugger":"< 8","dgram":true,"diagnostics_channel":">= 15.1","dns":true,"dns/promises":">= 15","domain":">= 0.7.12","events":true,"freelist":"< 6","fs":true,"fs/promises":[">= 10 && < 10.1",">= 14"],"_http_agent":">= 0.11.1","_http_client":">= 0.11.1","_http_common":">= 0.11.1","_http_incoming":">= 0.11.1","_http_outgoing":">= 0.11.1","_http_server":">= 0.11.1","http":true,"http2":">= 8.8","https":true,"inspector":">= 8.0.0","_linklist":"< 8","module":true,"net":true,"node-inspect/lib/_inspect":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6.0 && < 12","os":true,"path":true,"path/posix":">= 15.3","path/win32":">= 15.3","perf_hooks":">= 8.5","process":">= 1","punycode":true,"querystring":true,"readline":true,"repl":true,"smalloc":">= 0.11.5 && < 3","_stream_duplex":">= 0.9.4","_stream_transform":">= 0.9.4","_stream_wrap":">= 1.4.1","_stream_passthrough":">= 0.9.4","_stream_readable":">= 0.9.4","_stream_writable":">= 0.9.4","stream":true,"stream/promises":">= 15","string_decoder":true,"sys":[">= 0.6 && < 0.7",">= 0.8"],"timers":true,"timers/promises":">= 15","_tls_common":">= 0.11.13","_tls_legacy":">= 0.11.3 && < 10","_tls_wrap":">= 0.11.3","tls":true,"trace_events":">= 10","tty":true,"url":true,"util":true,"util/types":">= 15.3","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/consarray":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/csvparser":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/logreader":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/profile_view":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/splaytree":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8":">= 1","vm":true,"wasi":">= 13.4 && < 13.5","worker_threads":">= 11.7","zlib":true}')},4817:e=>{"use strict";e.exports=JSON.parse('{"es6.array.copy-within":{"chrome":"45","opera":"32","edge":"12","firefox":"32","safari":"9","node":"4","ios":"9","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.every":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.fill":{"chrome":"45","opera":"32","edge":"12","firefox":"31","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.filter":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.find":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.find-index":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es7.array.flat-map":{"chrome":"69","opera":"56","edge":"79","firefox":"62","safari":"12","node":"11","ios":"12","samsung":"10","electron":"4.0"},"es6.array.for-each":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.from":{"chrome":"51","opera":"38","edge":"15","firefox":"36","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.array.includes":{"chrome":"47","opera":"34","edge":"14","firefox":"43","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.array.index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.is-array":{"chrome":"5","opera":"10.50","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.iterator":{"chrome":"66","opera":"53","edge":"12","firefox":"60","safari":"9","node":"10","ios":"9","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es6.array.last-index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.map":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.of":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"9","node":"4","ios":"9","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.reduce":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.reduce-right":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.slice":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.some":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.sort":{"chrome":"63","opera":"50","edge":"12","firefox":"5","safari":"12","node":"10","ie":"9","ios":"12","samsung":"8","rhino":"1.7.13","electron":"3.0"},"es6.array.species":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.date.now":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-iso-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-json":{"chrome":"5","opera":"12.10","edge":"12","firefox":"4","safari":"10","node":"0.10","ie":"9","android":"4","ios":"10","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-primitive":{"chrome":"47","opera":"34","edge":"15","firefox":"44","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.date.to-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.function.bind":{"chrome":"7","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.function.has-instance":{"chrome":"51","opera":"38","edge":"15","firefox":"50","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.function.name":{"chrome":"5","opera":"10.50","edge":"14","firefox":"2","safari":"4","node":"0.10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.math.acosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.asinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.atanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.cbrt":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.clz32":{"chrome":"38","opera":"25","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.cosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.expm1":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.fround":{"chrome":"38","opera":"25","edge":"12","firefox":"26","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.hypot":{"chrome":"38","opera":"25","edge":"12","firefox":"27","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.imul":{"chrome":"30","opera":"17","edge":"12","firefox":"23","safari":"7","node":"0.12","android":"4.4","ios":"7","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.math.log1p":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.log10":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.log2":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.sign":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.sinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.tanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.trunc":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.number.constructor":{"chrome":"41","opera":"28","edge":"12","firefox":"36","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.number.epsilon":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.is-finite":{"chrome":"19","opera":"15","edge":"12","firefox":"16","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.number.is-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"16","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.is-nan":{"chrome":"19","opera":"15","edge":"12","firefox":"15","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.number.is-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"32","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.max-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.min-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.parse-float":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.parse-int":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.object.assign":{"chrome":"49","opera":"36","edge":"13","firefox":"36","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.object.create":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.object.define-getter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.define-setter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.define-property":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.object.define-properties":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.object.entries":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.freeze":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.get-own-property-descriptor":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es7.object.get-own-property-descriptors":{"chrome":"54","opera":"41","edge":"15","firefox":"50","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.get-own-property-names":{"chrome":"40","opera":"27","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.object.get-prototype-of":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es7.object.lookup-getter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.lookup-setter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.prevent-extensions":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.to-string":{"chrome":"57","opera":"44","edge":"15","firefox":"51","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es6.object.is":{"chrome":"19","opera":"15","edge":"12","firefox":"22","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.object.is-frozen":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.is-sealed":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.is-extensible":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.keys":{"chrome":"40","opera":"27","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.object.seal":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.set-prototype-of":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ie":"11","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es7.object.values":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.promise":{"chrome":"51","opera":"38","edge":"14","firefox":"45","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.promise.finally":{"chrome":"63","opera":"50","edge":"18","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"8","electron":"3.0"},"es6.reflect.apply":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.construct":{"chrome":"49","opera":"36","edge":"13","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.define-property":{"chrome":"49","opera":"36","edge":"13","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.delete-property":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-own-property-descriptor":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.has":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.is-extensible":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.own-keys":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.prevent-extensions":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.regexp.constructor":{"chrome":"50","opera":"37","edge":"79","firefox":"40","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.flags":{"chrome":"49","opera":"36","edge":"79","firefox":"37","safari":"9","node":"6","ios":"9","samsung":"5","electron":"0.37"},"es6.regexp.match":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"1.1"},"es6.regexp.replace":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.split":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.search":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"1.1"},"es6.regexp.to-string":{"chrome":"50","opera":"37","edge":"79","firefox":"39","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.symbol":{"chrome":"51","opera":"38","edge":"79","firefox":"51","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.symbol.async-iterator":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"es6.string.anchor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.big":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.blink":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.bold":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.code-point-at":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.ends-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.fixed":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontcolor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontsize":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.from-code-point":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.includes":{"chrome":"41","opera":"28","edge":"12","firefox":"40","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.italics":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.iterator":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.string.link":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es7.string.pad-start":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","rhino":"1.7.13","electron":"1.7"},"es7.string.pad-end":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","rhino":"1.7.13","electron":"1.7"},"es6.string.raw":{"chrome":"41","opera":"28","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.repeat":{"chrome":"41","opera":"28","edge":"12","firefox":"24","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.small":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.starts-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.strike":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sub":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sup":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.trim":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.string.trim-left":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es7.string.trim-right":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es6.typed.array-buffer":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.data-view":{"chrome":"5","opera":"12","edge":"12","firefox":"15","safari":"5.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.typed.int8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-clamped-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float64-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.weak-map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"},"es6.weak-set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"}}')},8392:e=>{"use strict";e.exports=JSON.parse('{"es6.module":{"chrome":"61","and_chr":"61","edge":"16","firefox":"60","and_ff":"60","node":"13.2.0","opera":"48","op_mob":"48","safari":"10.1","ios":"10.3","samsung":"8.2","android":"61","electron":"2.0","ios_saf":"10.3"}}')},5224:e=>{"use strict";e.exports=JSON.parse('{"transform-async-to-generator":["bugfix/transform-async-arrows-in-class"],"transform-parameters":["bugfix/transform-edge-default-parameters"],"transform-function-name":["bugfix/transform-edge-function-name"],"transform-block-scoping":["bugfix/transform-safari-block-shadowing","bugfix/transform-safari-for-shadowing"],"transform-template-literals":["bugfix/transform-tagged-template-caching"],"proposal-optional-chaining":["bugfix/transform-v8-spread-parameters-in-optional-chaining"]}')},4374:e=>{"use strict";e.exports=JSON.parse('{"transform-async-to-generator":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"10.1","node":"7.6","ios":"10.3","samsung":"6","electron":"1.6"},"bugfix/transform-async-arrows-in-class":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"11","node":"7.6","ios":"11","samsung":"6","electron":"1.6"},"transform-parameters":{"chrome":"49","opera":"36","edge":"15","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"bugfix/transform-edge-default-parameters":{"chrome":"49","opera":"36","edge":"18","firefox":"52","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"transform-function-name":{"chrome":"51","opera":"38","edge":"14","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"bugfix/transform-edge-function-name":{"chrome":"51","opera":"38","edge":"79","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-block-scoping":{"chrome":"49","opera":"36","edge":"14","firefox":"51","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"bugfix/transform-safari-block-shadowing":{"chrome":"49","opera":"36","edge":"12","firefox":"44","safari":"11","node":"6","ie":"11","ios":"11","samsung":"5","electron":"0.37"},"bugfix/transform-safari-for-shadowing":{"chrome":"49","opera":"36","edge":"12","firefox":"4","safari":"11","node":"6","ie":"11","ios":"11","samsung":"5","rhino":"1.7.13","electron":"0.37"},"transform-template-literals":{"chrome":"41","opera":"28","edge":"13","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"bugfix/transform-tagged-template-caching":{"chrome":"41","opera":"28","edge":"12","firefox":"34","safari":"13","node":"4","ios":"13","samsung":"3.4","electron":"0.21"},"proposal-optional-chaining":{"chrome":"80","opera":"67","edge":"80","firefox":"74","safari":"13.1","node":"14","ios":"13.4","samsung":"13","electron":"8.0"},"bugfix/transform-v8-spread-parameters-in-optional-chaining":{"firefox":"74","safari":"13.1","ios":"13.4"}}')},7867:e=>{"use strict";e.exports=JSON.parse('{"proposal-class-static-block":{"chrome":"91","electron":"13.0"},"proposal-private-property-in-object":{"chrome":"91","firefox":"90","electron":"13.0"},"proposal-class-properties":{"chrome":"74","opera":"62","edge":"79","firefox":"90","safari":"14.1","node":"12","samsung":"11","electron":"6.0"},"proposal-private-methods":{"chrome":"84","opera":"70","edge":"84","firefox":"90","safari":"15","node":"14.6","electron":"10.0"},"proposal-numeric-separator":{"chrome":"75","opera":"62","edge":"79","firefox":"70","safari":"13","node":"12.5","ios":"13","samsung":"11","electron":"6.0"},"proposal-logical-assignment-operators":{"chrome":"85","opera":"71","edge":"85","firefox":"79","safari":"14","node":"15","ios":"14","electron":"10.0"},"proposal-nullish-coalescing-operator":{"chrome":"80","opera":"67","edge":"80","firefox":"72","safari":"13.1","node":"14","ios":"13.4","samsung":"13","electron":"8.0"},"proposal-optional-chaining":{"firefox":"74","safari":"13.1","ios":"13.4"},"proposal-json-strings":{"chrome":"66","opera":"53","edge":"79","firefox":"62","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"proposal-optional-catch-binding":{"chrome":"66","opera":"53","edge":"79","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-parameters":{"chrome":"49","opera":"36","edge":"18","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"proposal-async-generator-functions":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"proposal-object-rest-spread":{"chrome":"60","opera":"47","edge":"79","firefox":"55","safari":"11.1","node":"8.3","ios":"11.3","samsung":"8","electron":"2.0"},"transform-dotall-regex":{"chrome":"62","opera":"49","edge":"79","firefox":"78","safari":"11.1","node":"8.10","ios":"11.3","samsung":"8","electron":"3.0"},"proposal-unicode-property-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-named-capturing-groups-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-async-to-generator":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"11","node":"7.6","ios":"11","samsung":"6","electron":"1.6"},"transform-exponentiation-operator":{"chrome":"52","opera":"39","edge":"14","firefox":"52","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.3"},"transform-template-literals":{"chrome":"41","opera":"28","edge":"13","firefox":"34","safari":"13","node":"4","ios":"13","samsung":"3.4","electron":"0.21"},"transform-literals":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-function-name":{"chrome":"51","opera":"38","edge":"79","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-arrow-functions":{"chrome":"47","opera":"34","edge":"13","firefox":"43","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"0.36"},"transform-block-scoped-functions":{"chrome":"41","opera":"28","edge":"12","firefox":"46","safari":"10","node":"4","ie":"11","ios":"10","samsung":"3.4","electron":"0.21"},"transform-classes":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-object-super":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-shorthand-properties":{"chrome":"43","opera":"30","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.27"},"transform-duplicate-keys":{"chrome":"42","opera":"29","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.25"},"transform-computed-properties":{"chrome":"44","opera":"31","edge":"12","firefox":"34","safari":"7.1","node":"4","ios":"8","samsung":"4","electron":"0.30"},"transform-for-of":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-sticky-regex":{"chrome":"49","opera":"36","edge":"13","firefox":"3","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"transform-unicode-escapes":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-unicode-regex":{"chrome":"50","opera":"37","edge":"13","firefox":"46","safari":"12","node":"6","ios":"12","samsung":"5","electron":"1.1"},"transform-spread":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-destructuring":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-block-scoping":{"chrome":"49","opera":"36","edge":"14","firefox":"51","safari":"11","node":"6","ios":"11","samsung":"5","electron":"0.37"},"transform-typeof-symbol":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"transform-new-target":{"chrome":"46","opera":"33","edge":"14","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-regenerator":{"chrome":"50","opera":"37","edge":"13","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"transform-member-expression-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"transform-property-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"transform-reserved-words":{"chrome":"13","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4.4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"proposal-export-namespace-from":{"chrome":"72","and_chr":"72","edge":"79","firefox":"80","and_ff":"80","node":"13.2","opera":"60","op_mob":"51","samsung":"11.0","android":"72","electron":"5.0"}}')},516:e=>{"use strict";e.exports=JSON.parse('{"es6.array.copy-within":{"chrome":"45","opera":"32","edge":"12","firefox":"32","safari":"9","node":"4","ios":"9","samsung":"5","electron":"0.31"},"es6.array.every":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.fill":{"chrome":"45","opera":"32","edge":"12","firefox":"31","safari":"7.1","node":"4","ios":"8","samsung":"5","electron":"0.31"},"es6.array.filter":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.find":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","electron":"0.31"},"es6.array.find-index":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","electron":"0.31"},"es7.array.flat-map":{"chrome":"69","opera":"56","edge":"79","firefox":"62","safari":"12","node":"11","ios":"12","samsung":"10","electron":"4.0"},"es6.array.for-each":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.from":{"chrome":"51","opera":"38","edge":"15","firefox":"36","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.array.includes":{"chrome":"47","opera":"34","edge":"14","firefox":"43","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.array.index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.is-array":{"chrome":"5","opera":"10.50","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.iterator":{"chrome":"66","opera":"53","edge":"12","firefox":"60","safari":"9","node":"10","ios":"9","samsung":"9","electron":"3.0"},"es6.array.last-index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.map":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.of":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"9","node":"4","ios":"9","samsung":"5","electron":"0.31"},"es6.array.reduce":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.reduce-right":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.slice":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.some":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.sort":{"chrome":"63","opera":"50","edge":"12","firefox":"5","safari":"12","node":"10","ie":"9","ios":"12","samsung":"8","electron":"3.0"},"es6.array.species":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.date.now":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.date.to-iso-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.date.to-json":{"chrome":"5","opera":"12.10","edge":"12","firefox":"4","safari":"10","node":"0.10","ie":"9","android":"4","ios":"10","samsung":"1","electron":"0.20"},"es6.date.to-primitive":{"chrome":"47","opera":"34","edge":"15","firefox":"44","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.date.to-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.function.bind":{"chrome":"7","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.function.has-instance":{"chrome":"51","opera":"38","edge":"15","firefox":"50","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.function.name":{"chrome":"5","opera":"10.50","edge":"14","firefox":"2","safari":"4","node":"0.10","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.math.acosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.asinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.atanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.cbrt":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.clz32":{"chrome":"38","opera":"25","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"es6.math.cosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.expm1":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.fround":{"chrome":"38","opera":"25","edge":"12","firefox":"26","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.hypot":{"chrome":"38","opera":"25","edge":"12","firefox":"27","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.imul":{"chrome":"30","opera":"17","edge":"12","firefox":"23","safari":"7","node":"0.12","android":"4.4","ios":"7","samsung":"2","electron":"0.20"},"es6.math.log1p":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.log10":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.log2":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.sign":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"es6.math.sinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.tanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.trunc":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.number.constructor":{"chrome":"41","opera":"28","edge":"12","firefox":"36","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.number.epsilon":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.is-finite":{"chrome":"19","opera":"15","edge":"12","firefox":"16","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","electron":"0.20"},"es6.number.is-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"16","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.is-nan":{"chrome":"19","opera":"15","edge":"12","firefox":"15","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","electron":"0.20"},"es6.number.is-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"32","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.max-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.min-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.parse-float":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.parse-int":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.object.assign":{"chrome":"49","opera":"36","edge":"13","firefox":"36","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.object.create":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es7.object.define-getter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.define-setter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.define-property":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.object.define-properties":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es7.object.entries":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.freeze":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.get-own-property-descriptor":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es7.object.get-own-property-descriptors":{"chrome":"54","opera":"41","edge":"15","firefox":"50","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.get-own-property-names":{"chrome":"40","opera":"27","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.object.get-prototype-of":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es7.object.lookup-getter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.lookup-setter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.prevent-extensions":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.to-string":{"chrome":"57","opera":"44","edge":"15","firefox":"51","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es6.object.is":{"chrome":"19","opera":"15","edge":"12","firefox":"22","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","electron":"0.20"},"es6.object.is-frozen":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.is-sealed":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.is-extensible":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.keys":{"chrome":"40","opera":"27","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.object.seal":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.set-prototype-of":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ie":"11","ios":"9","samsung":"2","electron":"0.20"},"es7.object.values":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.promise":{"chrome":"51","opera":"38","edge":"14","firefox":"45","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.promise.finally":{"chrome":"63","opera":"50","edge":"18","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"8","electron":"3.0"},"es6.reflect.apply":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.construct":{"chrome":"49","opera":"36","edge":"13","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.define-property":{"chrome":"49","opera":"36","edge":"13","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.delete-property":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-own-property-descriptor":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.has":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.is-extensible":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.own-keys":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.prevent-extensions":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.regexp.constructor":{"chrome":"50","opera":"37","edge":"79","firefox":"40","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.flags":{"chrome":"49","opera":"36","edge":"79","firefox":"37","safari":"9","node":"6","ios":"9","samsung":"5","electron":"0.37"},"es6.regexp.match":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.replace":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.split":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.search":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.to-string":{"chrome":"50","opera":"37","edge":"79","firefox":"39","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.symbol":{"chrome":"51","opera":"38","edge":"79","firefox":"51","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.symbol.async-iterator":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"es6.string.anchor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.big":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.blink":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.bold":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.code-point-at":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.ends-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.fixed":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontcolor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontsize":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.from-code-point":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.includes":{"chrome":"41","opera":"28","edge":"12","firefox":"40","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.italics":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.iterator":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"es6.string.link":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es7.string.pad-start":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es7.string.pad-end":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es6.string.raw":{"chrome":"41","opera":"28","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.repeat":{"chrome":"41","opera":"28","edge":"12","firefox":"24","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.small":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.starts-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.strike":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sub":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sup":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.trim":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es7.string.trim-left":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"es7.string.trim-right":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"es6.typed.array-buffer":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.data-view":{"chrome":"5","opera":"12","edge":"12","firefox":"15","safari":"5.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.typed.int8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-clamped-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float64-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.weak-map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"},"es6.weak-set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"}}')},5246:e=>{"use strict";e.exports=JSON.parse('{"es6.module":{"chrome":"61","and_chr":"61","edge":"16","firefox":"60","and_ff":"60","node":"13.2.0","opera":"48","op_mob":"48","safari":"10.1","ios":"10.3","samsung":"8.2","android":"61","electron":"2.0","ios_saf":"10.3"}}')},4812:e=>{"use strict";e.exports=JSON.parse('{"proposal-class-static-block":{"chrome":"91","electron":"13.0"},"proposal-private-property-in-object":{"chrome":"91","firefox":"90","electron":"13.0"},"proposal-class-properties":{"chrome":"74","opera":"62","edge":"79","firefox":"90","safari":"14.1","node":"12","samsung":"11","electron":"6.0"},"proposal-private-methods":{"chrome":"84","opera":"70","edge":"84","firefox":"90","safari":"15","node":"14.6","electron":"10.0"},"proposal-numeric-separator":{"chrome":"75","opera":"62","edge":"79","firefox":"70","safari":"13","node":"12.5","ios":"13","samsung":"11","electron":"6.0"},"proposal-logical-assignment-operators":{"chrome":"85","opera":"71","edge":"85","firefox":"79","safari":"14","node":"15","ios":"14","electron":"10.0"},"proposal-nullish-coalescing-operator":{"chrome":"80","opera":"67","edge":"80","firefox":"72","safari":"13.1","node":"14","ios":"13.4","samsung":"13","electron":"8.0"},"proposal-optional-chaining":{"firefox":"74","safari":"13.1","ios":"13.4"},"proposal-json-strings":{"chrome":"66","opera":"53","edge":"79","firefox":"62","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"proposal-optional-catch-binding":{"chrome":"66","opera":"53","edge":"79","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-parameters":{"chrome":"49","opera":"36","edge":"18","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"proposal-async-generator-functions":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"proposal-object-rest-spread":{"chrome":"60","opera":"47","edge":"79","firefox":"55","safari":"11.1","node":"8.3","ios":"11.3","samsung":"8","electron":"2.0"},"transform-dotall-regex":{"chrome":"62","opera":"49","edge":"79","firefox":"78","safari":"11.1","node":"8.10","ios":"11.3","samsung":"8","electron":"3.0"},"proposal-unicode-property-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-named-capturing-groups-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-async-to-generator":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"11","node":"7.6","ios":"11","samsung":"6","electron":"1.6"},"transform-exponentiation-operator":{"chrome":"52","opera":"39","edge":"14","firefox":"52","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.3"},"transform-template-literals":{"chrome":"41","opera":"28","edge":"13","firefox":"34","safari":"13","node":"4","ios":"13","samsung":"3.4","electron":"0.21"},"transform-literals":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-function-name":{"chrome":"51","opera":"38","edge":"79","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-arrow-functions":{"chrome":"47","opera":"34","edge":"13","firefox":"45","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"transform-block-scoped-functions":{"chrome":"41","opera":"28","edge":"12","firefox":"46","safari":"10","node":"4","ie":"11","ios":"10","samsung":"3.4","electron":"0.21"},"transform-classes":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-object-super":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-shorthand-properties":{"chrome":"43","opera":"30","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.27"},"transform-duplicate-keys":{"chrome":"42","opera":"29","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.25"},"transform-computed-properties":{"chrome":"44","opera":"31","edge":"12","firefox":"34","safari":"7.1","node":"4","ios":"8","samsung":"4","electron":"0.30"},"transform-for-of":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-sticky-regex":{"chrome":"49","opera":"36","edge":"13","firefox":"3","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"transform-unicode-escapes":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-unicode-regex":{"chrome":"50","opera":"37","edge":"13","firefox":"46","safari":"12","node":"6","ios":"12","samsung":"5","electron":"1.1"},"transform-spread":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-destructuring":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-block-scoping":{"chrome":"49","opera":"36","edge":"14","firefox":"51","safari":"11","node":"6","ios":"11","samsung":"5","electron":"0.37"},"transform-typeof-symbol":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"transform-new-target":{"chrome":"46","opera":"33","edge":"14","firefox":"41","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-regenerator":{"chrome":"50","opera":"37","edge":"13","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"transform-member-expression-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"transform-property-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"transform-reserved-words":{"chrome":"13","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4.4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"proposal-export-namespace-from":{"chrome":"72","and_chr":"72","edge":"79","firefox":"80","and_ff":"80","node":"13.2","opera":"60","op_mob":"51","samsung":"11.0","android":"72","electron":"5.0"}}')},935:e=>{"use strict";e.exports=JSON.parse('{"es.symbol":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.symbol.description":{"android":"70","chrome":"70","edge":"74","electron":"5.0","firefox":"63","ios":"12.2","node":"11.0","opera":"57","opera_mobile":"49","safari":"12.1","samsung":"10.0"},"es.symbol.async-iterator":{"android":"63","chrome":"63","edge":"74","electron":"3.0","firefox":"55","ios":"12.0","node":"10.0","opera":"50","opera_mobile":"46","safari":"12.0","samsung":"8.0"},"es.symbol.has-instance":{"android":"50","chrome":"50","edge":"15","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.is-concat-spreadable":{"android":"48","chrome":"48","edge":"15","electron":"0.37","firefox":"48","ios":"10.0","node":"6.0","opera":"35","opera_mobile":"35","safari":"10.0","samsung":"5.0"},"es.symbol.iterator":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"36","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.symbol.match":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"40","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.match-all":{"android":"73","chrome":"73","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.symbol.replace":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.search":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.species":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"41","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.symbol.split":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.to-primitive":{"android":"47","chrome":"47","edge":"15","electron":"0.36","firefox":"44","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.symbol.to-string-tag":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.symbol.unscopables":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"48","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.aggregate-error":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"es.array.concat":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.copy-within":{"android":"45","chrome":"45","edge":"12","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.every":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"9.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"8.0","samsung":"1.5"},"es.array.fill":{"android":"45","chrome":"45","edge":"12","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.filter":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.find":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.find-index":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.flat":{"android":"69","chrome":"69","edge":"74","electron":"4.0","firefox":"62","ios":"12.0","node":"11.0","opera":"56","opera_mobile":"48","safari":"12.0","samsung":"10.0"},"es.array.flat-map":{"android":"69","chrome":"69","edge":"74","electron":"4.0","firefox":"62","ios":"12.0","node":"11.0","opera":"56","opera_mobile":"48","safari":"12.0","samsung":"10.0"},"es.array.for-each":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"9.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"8.0","samsung":"1.5"},"es.array.from":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"9.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"9.0","samsung":"5.0"},"es.array.includes":{"android":"53","chrome":"53","edge":"14","electron":"1.4","firefox":"48","ios":"10.0","node":"7.0","opera":"40","opera_mobile":"40","safari":"10.0","samsung":"6.0"},"es.array.index-of":{"android":"51","chrome":"51","edge":"12","electron":"1.2","firefox":"4","ie":"9","ios":"9.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"8.0","samsung":"5.0"},"es.array.is-array":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"4.0","samsung":"1.0"},"es.array.iterator":{"android":"66","chrome":"66","edge":"15","electron":"3.0","firefox":"60","ios":"10.0","node":"10.0","opera":"53","opera_mobile":"47","safari":"10.0","samsung":"9.0"},"es.array.join":{"android":"4.4","chrome":"26","edge":"13","electron":"0.20","firefox":"4","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.array.last-index-of":{"android":"51","chrome":"51","edge":"12","electron":"1.2","firefox":"4","ie":"9","ios":"9.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"8.0","samsung":"5.0"},"es.array.map":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"50","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.of":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"25","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.reduce":{"android":"83","chrome":"83","edge":"12","electron":"9.0","firefox":"4","ie":"9","ios":"9.0","node":"6.0","opera":"69","opera_mobile":"59","safari":"8.0","samsung":"13.0"},"es.array.reduce-right":{"android":"83","chrome":"83","edge":"12","electron":"9.0","firefox":"4","ie":"9","ios":"9.0","node":"6.0","opera":"69","opera_mobile":"59","safari":"8.0","samsung":"13.0"},"es.array.reverse":{"android":"3.0","chrome":"1","edge":"12","electron":"0.20","firefox":"1","ie":"5.5","ios":"12.2","node":"0.0.3","opera":"10.50","opera_mobile":"10.50","safari":"12.0.2","samsung":"1.0"},"es.array.slice":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.some":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"9.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"8.0","samsung":"1.5"},"es.array.sort":{"android":"70","chrome":"70","edge":"74","electron":"5.0","firefox":"4","ios":"12.0","node":"11.0","opera":"57","opera_mobile":"49","safari":"12.0","samsung":"10.0"},"es.array.species":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.splice":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.unscopables.flat":{"android":"73","chrome":"73","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.array.unscopables.flat-map":{"android":"73","chrome":"73","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.array-buffer.constructor":{"android":"4.4","chrome":"26","edge":"14","electron":"0.20","firefox":"44","ios":"12.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"12.0","samsung":"1.5"},"es.array-buffer.is-view":{"android":"4.4.3","chrome":"32","edge":"12","electron":"0.20","firefox":"29","ie":"11","ios":"8.0","node":"0.11.9","opera":"19","opera_mobile":"19","safari":"7.1","samsung":"2.0"},"es.array-buffer.slice":{"android":"4.4.3","chrome":"31","edge":"12","electron":"0.20","firefox":"46","ie":"11","ios":"12.2","node":"0.11.8","opera":"18","opera_mobile":"18","safari":"12.1","samsung":"2.0"},"es.data-view":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"15","ie":"10","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.date.now":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ie":"9","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"4.0","samsung":"1.0"},"es.date.to-iso-string":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"7","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.date.to-json":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"10.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"10.0","samsung":"1.5"},"es.date.to-primitive":{"android":"47","chrome":"47","edge":"15","electron":"0.36","firefox":"44","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.date.to-string":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ie":"9","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.function.bind":{"android":"3.0","chrome":"7","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.101","opera":"12","opera_mobile":"12","phantom":"2.0","safari":"5.1","samsung":"1.0"},"es.function.has-instance":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"50","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.function.name":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"4.0","samsung":"1.0"},"es.global-this":{"android":"71","chrome":"71","edge":"74","electron":"5.0","firefox":"65","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"es.json.stringify":{"android":"72","chrome":"72","edge":"74","electron":"5.0","firefox":"64","ios":"12.2","node":"12.0","opera":"59","opera_mobile":"51","safari":"12.1","samsung":"11.0"},"es.json.to-string-tag":{"android":"50","chrome":"50","edge":"15","electron":"1.1","firefox":"51","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.map":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.math.acosh":{"android":"54","chrome":"54","edge":"13","electron":"1.4","firefox":"25","ios":"8.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"7.1","samsung":"6.0"},"es.math.asinh":{"android":"38","chrome":"38","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.atanh":{"android":"38","chrome":"38","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.cbrt":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.clz32":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"9.0","samsung":"3.0"},"es.math.cosh":{"android":"39","chrome":"39","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","safari":"7.1","samsung":"3.4"},"es.math.expm1":{"android":"39","chrome":"39","edge":"13","electron":"0.20","firefox":"46","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","safari":"7.1","samsung":"3.4"},"es.math.fround":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"26","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.hypot":{"android":"78","chrome":"78","edge":"12","electron":"7.0","firefox":"27","ios":"8.0","node":"13.0","opera":"65","opera_mobile":"56","safari":"7.1","samsung":"12.0"},"es.math.imul":{"android":"4.4","chrome":"28","edge":"13","electron":"0.20","firefox":"20","ios":"9.0","node":"0.11.1","opera":"16","opera_mobile":"16","safari":"9.0","samsung":"1.5"},"es.math.log10":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.log1p":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.log2":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.sign":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"9.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"9.0","samsung":"3.0"},"es.math.sinh":{"android":"39","chrome":"39","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","safari":"7.1","samsung":"3.4"},"es.math.tanh":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.to-string-tag":{"android":"50","chrome":"50","edge":"15","electron":"1.1","firefox":"51","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.math.trunc":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.number.constructor":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"46","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.number.epsilon":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"25","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.is-finite":{"android":"4.1","chrome":"19","edge":"12","electron":"0.20","firefox":"16","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","safari":"9.0","samsung":"1.5"},"es.number.is-integer":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"16","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.is-nan":{"android":"4.1","chrome":"19","edge":"12","electron":"0.20","firefox":"15","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","safari":"9.0","samsung":"1.5"},"es.number.is-safe-integer":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"32","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.max-safe-integer":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.min-safe-integer":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.parse-float":{"android":"37","chrome":"35","edge":"13","electron":"0.20","firefox":"39","ios":"11.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"11.0","samsung":"3.0"},"es.number.parse-int":{"android":"37","chrome":"35","edge":"13","electron":"0.20","firefox":"39","ios":"9.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"9.0","samsung":"3.0"},"es.number.to-fixed":{"android":"4.4","chrome":"26","edge":"74","electron":"0.20","firefox":"4","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.number.to-precision":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"8","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.object.assign":{"android":"49","chrome":"49","edge":"74","electron":"0.37","firefox":"36","ios":"9.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"9.0","samsung":"5.0"},"es.object.create":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"3.2","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"1.9","safari":"4.0","samsung":"1.0"},"es.object.define-getter":{"android":"62","chrome":"62","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","safari":"7.1","samsung":"8.0"},"es.object.define-properties":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"2.0","safari":"5.1","samsung":"1.0"},"es.object.define-property":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"2.0","safari":"5.1","samsung":"1.0"},"es.object.define-setter":{"android":"62","chrome":"62","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","safari":"7.1","samsung":"8.0"},"es.object.entries":{"android":"54","chrome":"54","edge":"14","electron":"1.4","firefox":"47","ios":"10.3","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.1","samsung":"6.0"},"es.object.freeze":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.from-entries":{"android":"73","chrome":"73","edge":"74","electron":"5.0","firefox":"63","ios":"12.2","node":"12.0","opera":"60","opera_mobile":"52","safari":"12.1","samsung":"11.0"},"es.object.get-own-property-descriptor":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.get-own-property-descriptors":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"50","ios":"10.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.0","samsung":"6.0"},"es.object.get-own-property-names":{"android":"40","chrome":"40","edge":"13","electron":"0.21","firefox":"34","ios":"9.0","node":"1.0","opera":"27","opera_mobile":"27","safari":"9.0","samsung":"3.4"},"es.object.get-prototype-of":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.is":{"android":"4.1","chrome":"19","edge":"12","electron":"0.20","firefox":"22","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","safari":"9.0","samsung":"1.5"},"es.object.is-extensible":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.is-frozen":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.is-sealed":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.keys":{"android":"40","chrome":"40","edge":"13","electron":"0.21","firefox":"35","ios":"9.0","node":"1.0","opera":"27","opera_mobile":"27","safari":"9.0","samsung":"3.4"},"es.object.lookup-getter":{"android":"62","chrome":"62","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","safari":"7.1","samsung":"8.0"},"es.object.lookup-setter":{"android":"62","chrome":"62","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","safari":"7.1","samsung":"8.0"},"es.object.prevent-extensions":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.seal":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.set-prototype-of":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"31","ie":"11","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.object.to-string":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.object.values":{"android":"54","chrome":"54","edge":"14","electron":"1.4","firefox":"47","ios":"10.3","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.1","samsung":"6.0"},"es.parse-float":{"android":"37","chrome":"35","edge":"12","electron":"0.20","firefox":"8","ie":"8","ios":"8.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"7.1","samsung":"3.0"},"es.parse-int":{"android":"37","chrome":"35","edge":"12","electron":"0.20","firefox":"21","ie":"9","ios":"8.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"7.1","samsung":"3.0"},"es.promise":{"android":"67","chrome":"67","edge":"74","electron":"4.0","firefox":"69","ios":"11.0","node":"10.4","opera":"54","opera_mobile":"48","safari":"11.0","samsung":"9.0"},"es.promise.all-settled":{"android":"76","chrome":"76","edge":"76","electron":"6.0","firefox":"71","ios":"13.0","node":"12.9","opera":"63","opera_mobile":"54","safari":"13","samsung":"12.0"},"es.promise.any":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"es.promise.finally":{"android":"67","chrome":"67","edge":"74","electron":"4.0","firefox":"69","ios":"13.2.3","node":"10.4","opera":"54","opera_mobile":"48","safari":"13.0.3","samsung":"9.0"},"es.reflect.apply":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.construct":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"44","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.define-property":{"android":"49","chrome":"49","edge":"13","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.delete-property":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get-own-property-descriptor":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get-prototype-of":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.has":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.is-extensible":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.own-keys":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.prevent-extensions":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.set":{"android":"49","chrome":"49","edge":"74","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.set-prototype-of":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.to-string-tag":{"android":"86","chrome":"86","edge":"86","electron":"11.0","firefox":"82","ios":"14.0","node":"15.0","opera":"72","opera_mobile":"61","safari":"14.0","samsung":"14.0"},"es.regexp.constructor":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.regexp.exec":{"android":"4.4","chrome":"26","edge":"13","electron":"0.20","firefox":"44","ios":"10.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"10.0","samsung":"1.5"},"es.regexp.flags":{"android":"49","chrome":"49","edge":"74","electron":"0.37","firefox":"37","ios":"9.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"9.0","samsung":"5.0"},"es.regexp.sticky":{"android":"49","chrome":"49","edge":"13","electron":"0.37","firefox":"3","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.regexp.test":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"46","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.regexp.to-string":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"46","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.set":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.code-point-at":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"29","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.ends-with":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.from-code-point":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"29","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.includes":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.iterator":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"36","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.match":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.match-all":{"android":"80","chrome":"80","edge":"80","electron":"8.0","firefox":"73","ios":"13.4","node":"14.0","opera":"67","opera_mobile":"57","safari":"13.1","samsung":"13.0"},"es.string.pad-end":{"android":"57","chrome":"57","edge":"15","electron":"1.7","firefox":"48","ios":"11.0","node":"8.0","opera":"44","opera_mobile":"43","safari":"11.0","samsung":"7.0"},"es.string.pad-start":{"android":"57","chrome":"57","edge":"15","electron":"1.7","firefox":"48","ios":"11.0","node":"8.0","opera":"44","opera_mobile":"43","safari":"11.0","samsung":"7.0"},"es.string.raw":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"34","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.repeat":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"24","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.replace":{"android":"64","chrome":"64","edge":"74","electron":"3.0","firefox":"78","ios":"14.0","node":"10.0","opera":"51","opera_mobile":"47","safari":"14.0","samsung":"9.0"},"es.string.replace-all":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"77","ios":"13.4","node":"15.0","opera":"71","opera_mobile":"60","safari":"13.1","samsung":"14.0"},"es.string.search":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.split":{"android":"54","chrome":"54","edge":"74","electron":"1.4","firefox":"49","ios":"10.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.0","samsung":"6.0"},"es.string.starts-with":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.trim":{"android":"59","chrome":"59","edge":"15","electron":"1.8","firefox":"52","ios":"12.2","node":"8.3","opera":"46","opera_mobile":"43","safari":"12.1","samsung":"7.0"},"es.string.trim-end":{"android":"66","chrome":"66","edge":"74","electron":"3.0","firefox":"61","ios":"12.2","node":"10.0","opera":"53","opera_mobile":"47","safari":"12.1","samsung":"9.0"},"es.string.trim-start":{"android":"66","chrome":"66","edge":"74","electron":"3.0","firefox":"61","ios":"12.0","node":"10.0","opera":"53","opera_mobile":"47","safari":"12.0","samsung":"9.0"},"es.string.anchor":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.big":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.blink":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.bold":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.fixed":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.fontcolor":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.fontsize":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.italics":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.link":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.small":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.strike":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.sub":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.sup":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.typed-array.float32-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.float64-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int8-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int16-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int32-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint8-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint8-clamped-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint16-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint32-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.copy-within":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"34","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.every":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.fill":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.filter":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.find":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.find-index":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.for-each":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.from":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.includes":{"android":"49","chrome":"49","edge":"14","electron":"0.37","firefox":"43","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.typed-array.index-of":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.iterator":{"android":"47","chrome":"47","edge":"13","electron":"0.36","firefox":"37","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.typed-array.join":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.last-index-of":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.map":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.of":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.reduce":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.reduce-right":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.reverse":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.set":{"android":"4.4","chrome":"26","edge":"13","electron":"0.20","firefox":"15","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.typed-array.slice":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.some":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.sort":{"android":"74","chrome":"74","edge":"74","electron":"6.0","firefox":"67","ios":"14.5","node":"12.0","opera":"61","opera_mobile":"53","safari":"14.1","samsung":"11.0"},"es.typed-array.subarray":{"android":"4.4","chrome":"26","edge":"13","electron":"0.20","firefox":"15","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.typed-array.to-locale-string":{"android":"45","chrome":"45","edge":"74","electron":"0.31","firefox":"51","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.to-string":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"51","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.weak-map":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.weak-set":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"esnext.aggregate-error":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"esnext.array.at":{"android":"92","chrome":"92","edge":"92","electron":"14.0","opera":"78"},"esnext.array.filter-out":{},"esnext.array.find-last":{},"esnext.array.find-last-index":{},"esnext.array.is-template-object":{},"esnext.array.last-index":{},"esnext.array.last-item":{},"esnext.array.unique-by":{},"esnext.async-iterator.constructor":{},"esnext.async-iterator.as-indexed-pairs":{},"esnext.async-iterator.drop":{},"esnext.async-iterator.every":{},"esnext.async-iterator.filter":{},"esnext.async-iterator.find":{},"esnext.async-iterator.flat-map":{},"esnext.async-iterator.for-each":{},"esnext.async-iterator.from":{},"esnext.async-iterator.map":{},"esnext.async-iterator.reduce":{},"esnext.async-iterator.some":{},"esnext.async-iterator.take":{},"esnext.async-iterator.to-array":{},"esnext.bigint.range":{},"esnext.composite-key":{},"esnext.composite-symbol":{},"esnext.global-this":{"android":"71","chrome":"71","edge":"74","electron":"5.0","firefox":"65","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"esnext.iterator.constructor":{},"esnext.iterator.as-indexed-pairs":{},"esnext.iterator.drop":{},"esnext.iterator.every":{},"esnext.iterator.filter":{},"esnext.iterator.find":{},"esnext.iterator.flat-map":{},"esnext.iterator.for-each":{},"esnext.iterator.from":{},"esnext.iterator.map":{},"esnext.iterator.reduce":{},"esnext.iterator.some":{},"esnext.iterator.take":{},"esnext.iterator.to-array":{},"esnext.map.delete-all":{},"esnext.map.emplace":{},"esnext.map.every":{},"esnext.map.filter":{},"esnext.map.find":{},"esnext.map.find-key":{},"esnext.map.from":{},"esnext.map.group-by":{},"esnext.map.includes":{},"esnext.map.key-by":{},"esnext.map.key-of":{},"esnext.map.map-keys":{},"esnext.map.map-values":{},"esnext.map.merge":{},"esnext.map.of":{},"esnext.map.reduce":{},"esnext.map.some":{},"esnext.map.update":{},"esnext.map.update-or-insert":{},"esnext.map.upsert":{},"esnext.math.clamp":{},"esnext.math.deg-per-rad":{},"esnext.math.degrees":{},"esnext.math.fscale":{},"esnext.math.iaddh":{},"esnext.math.imulh":{},"esnext.math.isubh":{},"esnext.math.rad-per-deg":{},"esnext.math.radians":{},"esnext.math.scale":{},"esnext.math.seeded-prng":{},"esnext.math.signbit":{},"esnext.math.umulh":{},"esnext.number.from-string":{},"esnext.number.range":{},"esnext.object.has-own":{},"esnext.object.iterate-entries":{},"esnext.object.iterate-keys":{},"esnext.object.iterate-values":{},"esnext.observable":{},"esnext.promise.all-settled":{"android":"76","chrome":"76","edge":"76","electron":"6.0","firefox":"71","ios":"13.0","node":"12.9","opera":"63","opera_mobile":"54","safari":"13","samsung":"12.0"},"esnext.promise.any":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"esnext.promise.try":{},"esnext.reflect.define-metadata":{},"esnext.reflect.delete-metadata":{},"esnext.reflect.get-metadata":{},"esnext.reflect.get-metadata-keys":{},"esnext.reflect.get-own-metadata":{},"esnext.reflect.get-own-metadata-keys":{},"esnext.reflect.has-metadata":{},"esnext.reflect.has-own-metadata":{},"esnext.reflect.metadata":{},"esnext.set.add-all":{},"esnext.set.delete-all":{},"esnext.set.difference":{},"esnext.set.every":{},"esnext.set.filter":{},"esnext.set.find":{},"esnext.set.from":{},"esnext.set.intersection":{},"esnext.set.is-disjoint-from":{},"esnext.set.is-subset-of":{},"esnext.set.is-superset-of":{},"esnext.set.join":{},"esnext.set.map":{},"esnext.set.of":{},"esnext.set.reduce":{},"esnext.set.some":{},"esnext.set.symmetric-difference":{},"esnext.set.union":{},"esnext.string.at":{},"esnext.string.code-points":{},"esnext.string.match-all":{"android":"80","chrome":"80","edge":"80","electron":"8.0","firefox":"73","ios":"13.4","node":"14.0","opera":"67","opera_mobile":"57","safari":"13.1","samsung":"13.0"},"esnext.string.replace-all":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"77","ios":"13.4","node":"15.0","opera":"71","opera_mobile":"60","safari":"13.1","samsung":"14.0"},"esnext.symbol.async-dispose":{},"esnext.symbol.dispose":{},"esnext.symbol.matcher":{},"esnext.symbol.metadata":{},"esnext.symbol.observable":{},"esnext.symbol.pattern-match":{},"esnext.symbol.replace-all":{},"esnext.typed-array.at":{"android":"92","chrome":"92","edge":"92","electron":"14.0","opera":"78"},"esnext.typed-array.filter-out":{},"esnext.typed-array.find-last":{},"esnext.typed-array.find-last-index":{},"esnext.typed-array.unique-by":{},"esnext.weak-map.delete-all":{},"esnext.weak-map.from":{},"esnext.weak-map.of":{},"esnext.weak-map.emplace":{},"esnext.weak-map.upsert":{},"esnext.weak-set.add-all":{},"esnext.weak-set.delete-all":{},"esnext.weak-set.from":{},"esnext.weak-set.of":{},"web.dom-collections.for-each":{"android":"58","chrome":"58","edge":"16","electron":"1.7","firefox":"50","ios":"10.0","node":"0.0.1","opera":"45","opera_mobile":"43","safari":"10.0","samsung":"7.0"},"web.dom-collections.iterator":{"android":"66","chrome":"66","edge":"74","electron":"3.0","firefox":"60","ios":"13.4","node":"0.0.1","opera":"53","opera_mobile":"47","safari":"13.1","samsung":"9.0"},"web.immediate":{"ie":"10","node":"0.9.1"},"web.queue-microtask":{"android":"71","chrome":"71","edge":"74","electron":"5.0","firefox":"69","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"web.timers":{"android":"1.5","chrome":"1","edge":"12","electron":"0.20","firefox":"1","ie":"10","ios":"1.0","node":"0.0.1","opera":"7","opera_mobile":"7","phantom":"1.9","safari":"1.0","samsung":"1.0"},"web.url":{"android":"67","chrome":"67","edge":"74","electron":"4.0","firefox":"57","ios":"14.0","node":"10.0","opera":"54","opera_mobile":"48","safari":"14.0","samsung":"9.0"},"web.url.to-json":{"android":"71","chrome":"71","edge":"74","electron":"5.0","firefox":"57","ios":"14.0","node":"10.0","opera":"58","opera_mobile":"50","safari":"14.0","samsung":"10.0"},"web.url-search-params":{"android":"67","chrome":"67","edge":"74","electron":"4.0","firefox":"57","ios":"14.0","node":"10.0","opera":"54","opera_mobile":"48","safari":"14.0","samsung":"9.0"}}')},4323:e=>{"use strict";e.exports=JSON.parse('{"core-js":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"core-js/es":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set"],"core-js/es/aggregate-error":["es.aggregate-error","es.string.iterator","web.dom-collections.iterator"],"core-js/es/array":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.string.iterator"],"core-js/es/array-buffer":["es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.object.to-string"],"core-js/es/array-buffer/constructor":["es.array-buffer.constructor","es.object.to-string"],"core-js/es/array-buffer/is-view":["es.array-buffer.is-view"],"core-js/es/array-buffer/slice":["es.array-buffer.slice"],"core-js/es/array/concat":["es.array.concat"],"core-js/es/array/copy-within":["es.array.copy-within"],"core-js/es/array/entries":["es.array.iterator"],"core-js/es/array/every":["es.array.every"],"core-js/es/array/fill":["es.array.fill"],"core-js/es/array/filter":["es.array.filter"],"core-js/es/array/find":["es.array.find"],"core-js/es/array/find-index":["es.array.find-index"],"core-js/es/array/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/es/array/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/es/array/for-each":["es.array.for-each"],"core-js/es/array/from":["es.array.from","es.string.iterator"],"core-js/es/array/includes":["es.array.includes"],"core-js/es/array/index-of":["es.array.index-of"],"core-js/es/array/is-array":["es.array.is-array"],"core-js/es/array/iterator":["es.array.iterator"],"core-js/es/array/join":["es.array.join"],"core-js/es/array/keys":["es.array.iterator"],"core-js/es/array/last-index-of":["es.array.last-index-of"],"core-js/es/array/map":["es.array.map"],"core-js/es/array/of":["es.array.of"],"core-js/es/array/reduce":["es.array.reduce"],"core-js/es/array/reduce-right":["es.array.reduce-right"],"core-js/es/array/reverse":["es.array.reverse"],"core-js/es/array/slice":["es.array.slice"],"core-js/es/array/some":["es.array.some"],"core-js/es/array/sort":["es.array.sort"],"core-js/es/array/splice":["es.array.splice"],"core-js/es/array/values":["es.array.iterator"],"core-js/es/array/virtual":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.includes","es.array.index-of","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map"],"core-js/es/array/virtual/concat":["es.array.concat"],"core-js/es/array/virtual/copy-within":["es.array.copy-within"],"core-js/es/array/virtual/entries":["es.array.iterator"],"core-js/es/array/virtual/every":["es.array.every"],"core-js/es/array/virtual/fill":["es.array.fill"],"core-js/es/array/virtual/filter":["es.array.filter"],"core-js/es/array/virtual/filter-out":["esnext.array.filter-out"],"core-js/es/array/virtual/find":["es.array.find"],"core-js/es/array/virtual/find-index":["es.array.find-index"],"core-js/es/array/virtual/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/es/array/virtual/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/es/array/virtual/for-each":["es.array.for-each"],"core-js/es/array/virtual/includes":["es.array.includes"],"core-js/es/array/virtual/index-of":["es.array.index-of"],"core-js/es/array/virtual/iterator":["es.array.iterator"],"core-js/es/array/virtual/join":["es.array.join"],"core-js/es/array/virtual/keys":["es.array.iterator"],"core-js/es/array/virtual/last-index-of":["es.array.last-index-of"],"core-js/es/array/virtual/map":["es.array.map"],"core-js/es/array/virtual/reduce":["es.array.reduce"],"core-js/es/array/virtual/reduce-right":["es.array.reduce-right"],"core-js/es/array/virtual/reverse":["es.array.reverse"],"core-js/es/array/virtual/slice":["es.array.slice"],"core-js/es/array/virtual/some":["es.array.some"],"core-js/es/array/virtual/sort":["es.array.sort"],"core-js/es/array/virtual/splice":["es.array.splice"],"core-js/es/array/virtual/values":["es.array.iterator"],"core-js/es/data-view":["es.data-view","es.object.to-string"],"core-js/es/date":["es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string"],"core-js/es/date/now":["es.date.now"],"core-js/es/date/to-iso-string":["es.date.to-iso-string","es.date.to-json"],"core-js/es/date/to-json":["es.date.to-json"],"core-js/es/date/to-primitive":["es.date.to-primitive"],"core-js/es/date/to-string":["es.date.to-string"],"core-js/es/function":["es.function.bind","es.function.has-instance","es.function.name"],"core-js/es/function/bind":["es.function.bind"],"core-js/es/function/has-instance":["es.function.has-instance"],"core-js/es/function/name":["es.function.name"],"core-js/es/function/virtual":["es.function.bind"],"core-js/es/function/virtual/bind":["es.function.bind"],"core-js/es/global-this":["es.global-this"],"core-js/es/instance/bind":["es.function.bind"],"core-js/es/instance/code-point-at":["es.string.code-point-at"],"core-js/es/instance/concat":["es.array.concat"],"core-js/es/instance/copy-within":["es.array.copy-within"],"core-js/es/instance/ends-with":["es.string.ends-with"],"core-js/es/instance/entries":["es.array.iterator"],"core-js/es/instance/every":["es.array.every"],"core-js/es/instance/fill":["es.array.fill"],"core-js/es/instance/filter":["es.array.filter"],"core-js/es/instance/find":["es.array.find"],"core-js/es/instance/find-index":["es.array.find-index"],"core-js/es/instance/flags":["es.regexp.flags"],"core-js/es/instance/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/es/instance/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/es/instance/for-each":["es.array.for-each"],"core-js/es/instance/includes":["es.array.includes","es.string.includes"],"core-js/es/instance/index-of":["es.array.index-of"],"core-js/es/instance/keys":["es.array.iterator"],"core-js/es/instance/last-index-of":["es.array.last-index-of"],"core-js/es/instance/map":["es.array.map"],"core-js/es/instance/match-all":["es.string.match-all"],"core-js/es/instance/pad-end":["es.string.pad-end"],"core-js/es/instance/pad-start":["es.string.pad-start"],"core-js/es/instance/reduce":["es.array.reduce"],"core-js/es/instance/reduce-right":["es.array.reduce-right"],"core-js/es/instance/repeat":["es.string.repeat"],"core-js/es/instance/replace-all":["es.string.replace-all"],"core-js/es/instance/reverse":["es.array.reverse"],"core-js/es/instance/slice":["es.array.slice"],"core-js/es/instance/some":["es.array.some"],"core-js/es/instance/sort":["es.array.sort"],"core-js/es/instance/splice":["es.array.splice"],"core-js/es/instance/starts-with":["es.string.starts-with"],"core-js/es/instance/trim":["es.string.trim"],"core-js/es/instance/trim-end":["es.string.trim-end"],"core-js/es/instance/trim-left":["es.string.trim-start"],"core-js/es/instance/trim-right":["es.string.trim-end"],"core-js/es/instance/trim-start":["es.string.trim-start"],"core-js/es/instance/values":["es.array.iterator"],"core-js/es/json":["es.json.stringify","es.json.to-string-tag"],"core-js/es/json/stringify":["es.json.stringify"],"core-js/es/json/to-string-tag":["es.json.to-string-tag"],"core-js/es/map":["es.map","es.object.to-string","es.string.iterator","web.dom-collections.iterator"],"core-js/es/math":["es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc"],"core-js/es/math/acosh":["es.math.acosh"],"core-js/es/math/asinh":["es.math.asinh"],"core-js/es/math/atanh":["es.math.atanh"],"core-js/es/math/cbrt":["es.math.cbrt"],"core-js/es/math/clz32":["es.math.clz32"],"core-js/es/math/cosh":["es.math.cosh"],"core-js/es/math/expm1":["es.math.expm1"],"core-js/es/math/fround":["es.math.fround"],"core-js/es/math/hypot":["es.math.hypot"],"core-js/es/math/imul":["es.math.imul"],"core-js/es/math/log10":["es.math.log10"],"core-js/es/math/log1p":["es.math.log1p"],"core-js/es/math/log2":["es.math.log2"],"core-js/es/math/sign":["es.math.sign"],"core-js/es/math/sinh":["es.math.sinh"],"core-js/es/math/tanh":["es.math.tanh"],"core-js/es/math/to-string-tag":["es.math.to-string-tag"],"core-js/es/math/trunc":["es.math.trunc"],"core-js/es/number":["es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision"],"core-js/es/number/constructor":["es.number.constructor"],"core-js/es/number/epsilon":["es.number.epsilon"],"core-js/es/number/is-finite":["es.number.is-finite"],"core-js/es/number/is-integer":["es.number.is-integer"],"core-js/es/number/is-nan":["es.number.is-nan"],"core-js/es/number/is-safe-integer":["es.number.is-safe-integer"],"core-js/es/number/max-safe-integer":["es.number.max-safe-integer"],"core-js/es/number/min-safe-integer":["es.number.min-safe-integer"],"core-js/es/number/parse-float":["es.number.parse-float"],"core-js/es/number/parse-int":["es.number.parse-int"],"core-js/es/number/to-fixed":["es.number.to-fixed"],"core-js/es/number/to-precision":["es.number.to-precision"],"core-js/es/number/virtual":["es.number.to-fixed","es.number.to-precision"],"core-js/es/number/virtual/to-fixed":["es.number.to-fixed"],"core-js/es/number/virtual/to-precision":["es.number.to-precision"],"core-js/es/object":["es.symbol","es.json.to-string-tag","es.math.to-string-tag","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.reflect.to-string-tag"],"core-js/es/object/assign":["es.object.assign"],"core-js/es/object/create":["es.object.create"],"core-js/es/object/define-getter":["es.object.define-getter"],"core-js/es/object/define-properties":["es.object.define-properties"],"core-js/es/object/define-property":["es.object.define-property"],"core-js/es/object/define-setter":["es.object.define-setter"],"core-js/es/object/entries":["es.object.entries"],"core-js/es/object/freeze":["es.object.freeze"],"core-js/es/object/from-entries":["es.array.iterator","es.object.from-entries"],"core-js/es/object/get-own-property-descriptor":["es.object.get-own-property-descriptor"],"core-js/es/object/get-own-property-descriptors":["es.object.get-own-property-descriptors"],"core-js/es/object/get-own-property-names":["es.object.get-own-property-names"],"core-js/es/object/get-own-property-symbols":["es.symbol"],"core-js/es/object/get-prototype-of":["es.object.get-prototype-of"],"core-js/es/object/is":["es.object.is"],"core-js/es/object/is-extensible":["es.object.is-extensible"],"core-js/es/object/is-frozen":["es.object.is-frozen"],"core-js/es/object/is-sealed":["es.object.is-sealed"],"core-js/es/object/keys":["es.object.keys"],"core-js/es/object/lookup-getter":["es.object.lookup-setter"],"core-js/es/object/lookup-setter":["es.object.lookup-setter"],"core-js/es/object/prevent-extensions":["es.object.prevent-extensions"],"core-js/es/object/seal":["es.object.seal"],"core-js/es/object/set-prototype-of":["es.object.set-prototype-of"],"core-js/es/object/to-string":["es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/es/object/values":["es.object.values"],"core-js/es/parse-float":["es.parse-float"],"core-js/es/parse-int":["es.parse-int"],"core-js/es/promise":["es.aggregate-error","es.object.to-string","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.string.iterator","web.dom-collections.iterator"],"core-js/es/promise/all-settled":["es.promise","es.promise.all-settled","es.string.iterator","web.dom-collections.iterator"],"core-js/es/promise/any":["es.aggregate-error","es.promise","es.promise.any","es.string.iterator","web.dom-collections.iterator"],"core-js/es/promise/finally":["es.promise","es.promise.finally"],"core-js/es/reflect":["es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag"],"core-js/es/reflect/apply":["es.reflect.apply"],"core-js/es/reflect/construct":["es.reflect.construct"],"core-js/es/reflect/define-property":["es.reflect.define-property"],"core-js/es/reflect/delete-property":["es.reflect.delete-property"],"core-js/es/reflect/get":["es.reflect.get"],"core-js/es/reflect/get-own-property-descriptor":["es.reflect.get-own-property-descriptor"],"core-js/es/reflect/get-prototype-of":["es.reflect.get-prototype-of"],"core-js/es/reflect/has":["es.reflect.has"],"core-js/es/reflect/is-extensible":["es.reflect.is-extensible"],"core-js/es/reflect/own-keys":["es.reflect.own-keys"],"core-js/es/reflect/prevent-extensions":["es.reflect.prevent-extensions"],"core-js/es/reflect/set":["es.reflect.set"],"core-js/es/reflect/set-prototype-of":["es.reflect.set-prototype-of"],"core-js/es/reflect/to-string-tag":["es.reflect.to-string-tag"],"core-js/es/regexp":["es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.string.match","es.string.replace","es.string.search","es.string.split"],"core-js/es/regexp/constructor":["es.regexp.constructor"],"core-js/es/regexp/flags":["es.regexp.flags"],"core-js/es/regexp/match":["es.string.match"],"core-js/es/regexp/replace":["es.string.replace"],"core-js/es/regexp/search":["es.string.search"],"core-js/es/regexp/split":["es.string.split"],"core-js/es/regexp/sticky":["es.regexp.sticky"],"core-js/es/regexp/test":["es.regexp.exec","es.regexp.test"],"core-js/es/regexp/to-string":["es.regexp.to-string"],"core-js/es/set":["es.object.to-string","es.set","es.string.iterator","web.dom-collections.iterator"],"core-js/es/string":["es.regexp.exec","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup"],"core-js/es/string/anchor":["es.string.anchor"],"core-js/es/string/big":["es.string.big"],"core-js/es/string/blink":["es.string.blink"],"core-js/es/string/bold":["es.string.bold"],"core-js/es/string/code-point-at":["es.string.code-point-at"],"core-js/es/string/ends-with":["es.string.ends-with"],"core-js/es/string/fixed":["es.string.fixed"],"core-js/es/string/fontcolor":["es.string.fontcolor"],"core-js/es/string/fontsize":["es.string.fontsize"],"core-js/es/string/from-code-point":["es.string.from-code-point"],"core-js/es/string/includes":["es.string.includes"],"core-js/es/string/italics":["es.string.italics"],"core-js/es/string/iterator":["es.string.iterator"],"core-js/es/string/link":["es.string.link"],"core-js/es/string/match":["es.regexp.exec","es.string.match"],"core-js/es/string/match-all":["es.string.match-all"],"core-js/es/string/pad-end":["es.string.pad-end"],"core-js/es/string/pad-start":["es.string.pad-start"],"core-js/es/string/raw":["es.string.raw"],"core-js/es/string/repeat":["es.string.repeat"],"core-js/es/string/replace":["es.regexp.exec","es.string.replace"],"core-js/es/string/replace-all":["es.string.replace-all"],"core-js/es/string/search":["es.regexp.exec","es.string.search"],"core-js/es/string/small":["es.string.small"],"core-js/es/string/split":["es.regexp.exec","es.string.split"],"core-js/es/string/starts-with":["es.string.starts-with"],"core-js/es/string/strike":["es.string.strike"],"core-js/es/string/sub":["es.string.sub"],"core-js/es/string/sup":["es.string.sup"],"core-js/es/string/trim":["es.string.trim"],"core-js/es/string/trim-end":["es.string.trim-end"],"core-js/es/string/trim-left":["es.string.trim-start"],"core-js/es/string/trim-right":["es.string.trim-end"],"core-js/es/string/trim-start":["es.string.trim-start"],"core-js/es/string/virtual":["es.string.code-point-at","es.string.ends-with","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup"],"core-js/es/string/virtual/anchor":["es.string.anchor"],"core-js/es/string/virtual/big":["es.string.big"],"core-js/es/string/virtual/blink":["es.string.blink"],"core-js/es/string/virtual/bold":["es.string.bold"],"core-js/es/string/virtual/code-point-at":["es.string.code-point-at"],"core-js/es/string/virtual/ends-with":["es.string.ends-with"],"core-js/es/string/virtual/fixed":["es.string.fixed"],"core-js/es/string/virtual/fontcolor":["es.string.fontcolor"],"core-js/es/string/virtual/fontsize":["es.string.fontsize"],"core-js/es/string/virtual/includes":["es.string.includes"],"core-js/es/string/virtual/italics":["es.string.italics"],"core-js/es/string/virtual/iterator":["es.string.iterator"],"core-js/es/string/virtual/link":["es.string.link"],"core-js/es/string/virtual/match-all":["es.string.match-all"],"core-js/es/string/virtual/pad-end":["es.string.pad-end"],"core-js/es/string/virtual/pad-start":["es.string.pad-start"],"core-js/es/string/virtual/repeat":["es.string.repeat"],"core-js/es/string/virtual/replace-all":["es.string.replace-all"],"core-js/es/string/virtual/small":["es.string.small"],"core-js/es/string/virtual/starts-with":["es.string.starts-with"],"core-js/es/string/virtual/strike":["es.string.strike"],"core-js/es/string/virtual/sub":["es.string.sub"],"core-js/es/string/virtual/sup":["es.string.sup"],"core-js/es/string/virtual/trim":["es.string.trim"],"core-js/es/string/virtual/trim-end":["es.string.trim-end"],"core-js/es/string/virtual/trim-left":["es.string.trim-start"],"core-js/es/string/virtual/trim-right":["es.string.trim-end"],"core-js/es/string/virtual/trim-start":["es.string.trim-start"],"core-js/es/symbol":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.array.concat","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/es/symbol/async-iterator":["es.symbol.async-iterator"],"core-js/es/symbol/description":["es.symbol.description"],"core-js/es/symbol/for":["es.symbol"],"core-js/es/symbol/has-instance":["es.symbol.has-instance","es.function.has-instance"],"core-js/es/symbol/is-concat-spreadable":["es.symbol.is-concat-spreadable","es.array.concat"],"core-js/es/symbol/iterator":["es.symbol.iterator","es.string.iterator","web.dom-collections.iterator"],"core-js/es/symbol/key-for":["es.symbol"],"core-js/es/symbol/match":["es.symbol.match","es.string.match"],"core-js/es/symbol/match-all":["es.symbol.match-all","es.string.match-all"],"core-js/es/symbol/replace":["es.symbol.replace","es.string.replace"],"core-js/es/symbol/search":["es.symbol.search","es.string.search"],"core-js/es/symbol/species":["es.symbol.species"],"core-js/es/symbol/split":["es.symbol.split","es.string.split"],"core-js/es/symbol/to-primitive":["es.symbol.to-primitive"],"core-js/es/symbol/to-string-tag":["es.symbol.to-string-tag","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/es/symbol/unscopables":["es.symbol.unscopables"],"core-js/es/typed-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/copy-within":["es.typed-array.copy-within"],"core-js/es/typed-array/entries":["es.typed-array.iterator"],"core-js/es/typed-array/every":["es.typed-array.every"],"core-js/es/typed-array/fill":["es.typed-array.fill"],"core-js/es/typed-array/filter":["es.typed-array.filter"],"core-js/es/typed-array/find":["es.typed-array.find"],"core-js/es/typed-array/find-index":["es.typed-array.find-index"],"core-js/es/typed-array/float32-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/float64-array":["es.object.to-string","es.typed-array.float64-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/for-each":["es.typed-array.for-each"],"core-js/es/typed-array/from":["es.typed-array.from"],"core-js/es/typed-array/includes":["es.typed-array.includes"],"core-js/es/typed-array/index-of":["es.typed-array.index-of"],"core-js/es/typed-array/int16-array":["es.object.to-string","es.typed-array.int16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/int32-array":["es.object.to-string","es.typed-array.int32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/int8-array":["es.object.to-string","es.typed-array.int8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/iterator":["es.typed-array.iterator"],"core-js/es/typed-array/join":["es.typed-array.join"],"core-js/es/typed-array/keys":["es.typed-array.iterator"],"core-js/es/typed-array/last-index-of":["es.typed-array.last-index-of"],"core-js/es/typed-array/map":["es.typed-array.map"],"core-js/es/typed-array/methods":["es.object.to-string","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/of":["es.typed-array.of"],"core-js/es/typed-array/reduce":["es.typed-array.reduce"],"core-js/es/typed-array/reduce-right":["es.typed-array.reduce-right"],"core-js/es/typed-array/reverse":["es.typed-array.reverse"],"core-js/es/typed-array/set":["es.typed-array.set"],"core-js/es/typed-array/slice":["es.typed-array.slice"],"core-js/es/typed-array/some":["es.typed-array.some"],"core-js/es/typed-array/sort":["es.typed-array.sort"],"core-js/es/typed-array/subarray":["es.typed-array.subarray"],"core-js/es/typed-array/to-locale-string":["es.typed-array.to-locale-string"],"core-js/es/typed-array/to-string":["es.typed-array.to-string"],"core-js/es/typed-array/uint16-array":["es.object.to-string","es.typed-array.uint16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/uint32-array":["es.object.to-string","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/uint8-array":["es.object.to-string","es.typed-array.uint8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/uint8-clamped-array":["es.object.to-string","es.typed-array.uint8-clamped-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/values":["es.typed-array.iterator"],"core-js/es/weak-map":["es.object.to-string","es.weak-map","web.dom-collections.iterator"],"core-js/es/weak-set":["es.object.to-string","es.weak-set","web.dom-collections.iterator"],"core-js/features":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"core-js/features/aggregate-error":["es.aggregate-error","es.string.iterator","esnext.aggregate-error","web.dom-collections.iterator"],"core-js/features/array":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.map","es.string.iterator","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by"],"core-js/features/array-buffer":["es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.object.to-string"],"core-js/features/array-buffer/constructor":["es.array-buffer.constructor","es.object.to-string"],"core-js/features/array-buffer/is-view":["es.array-buffer.is-view"],"core-js/features/array-buffer/slice":["es.array-buffer.slice"],"core-js/features/array/at":["esnext.array.at"],"core-js/features/array/concat":["es.array.concat"],"core-js/features/array/copy-within":["es.array.copy-within"],"core-js/features/array/entries":["es.array.iterator"],"core-js/features/array/every":["es.array.every"],"core-js/features/array/fill":["es.array.fill"],"core-js/features/array/filter":["es.array.filter"],"core-js/features/array/filter-out":["esnext.array.filter-out"],"core-js/features/array/find":["es.array.find"],"core-js/features/array/find-index":["es.array.find-index"],"core-js/features/array/find-last":["esnext.array.find-last"],"core-js/features/array/find-last-index":["esnext.array.find-last-index"],"core-js/features/array/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/features/array/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/features/array/for-each":["es.array.for-each"],"core-js/features/array/from":["es.array.from","es.string.iterator"],"core-js/features/array/includes":["es.array.includes"],"core-js/features/array/index-of":["es.array.index-of"],"core-js/features/array/is-array":["es.array.is-array"],"core-js/features/array/is-template-object":["esnext.array.is-template-object"],"core-js/features/array/iterator":["es.array.iterator"],"core-js/features/array/join":["es.array.join"],"core-js/features/array/keys":["es.array.iterator"],"core-js/features/array/last-index":["esnext.array.last-index"],"core-js/features/array/last-index-of":["es.array.last-index-of"],"core-js/features/array/last-item":["esnext.array.last-item"],"core-js/features/array/map":["es.array.map"],"core-js/features/array/of":["es.array.of"],"core-js/features/array/reduce":["es.array.reduce"],"core-js/features/array/reduce-right":["es.array.reduce-right"],"core-js/features/array/reverse":["es.array.reverse"],"core-js/features/array/slice":["es.array.slice"],"core-js/features/array/some":["es.array.some"],"core-js/features/array/sort":["es.array.sort"],"core-js/features/array/splice":["es.array.splice"],"core-js/features/array/unique-by":["es.map","esnext.array.unique-by"],"core-js/features/array/values":["es.array.iterator"],"core-js/features/array/virtual":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.includes","es.array.index-of","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.map","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.unique-by"],"core-js/features/array/virtual/at":["esnext.array.at"],"core-js/features/array/virtual/concat":["es.array.concat"],"core-js/features/array/virtual/copy-within":["es.array.copy-within"],"core-js/features/array/virtual/entries":["es.array.iterator"],"core-js/features/array/virtual/every":["es.array.every"],"core-js/features/array/virtual/fill":["es.array.fill"],"core-js/features/array/virtual/filter":["es.array.filter"],"core-js/features/array/virtual/filter-out":["esnext.array.filter-out"],"core-js/features/array/virtual/find":["es.array.find"],"core-js/features/array/virtual/find-index":["es.array.find-index"],"core-js/features/array/virtual/find-last":["esnext.array.find-last"],"core-js/features/array/virtual/find-last-index":["esnext.array.find-last-index"],"core-js/features/array/virtual/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/features/array/virtual/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/features/array/virtual/for-each":["es.array.for-each"],"core-js/features/array/virtual/includes":["es.array.includes"],"core-js/features/array/virtual/index-of":["es.array.index-of"],"core-js/features/array/virtual/iterator":["es.array.iterator"],"core-js/features/array/virtual/join":["es.array.join"],"core-js/features/array/virtual/keys":["es.array.iterator"],"core-js/features/array/virtual/last-index-of":["es.array.last-index-of"],"core-js/features/array/virtual/map":["es.array.map"],"core-js/features/array/virtual/reduce":["es.array.reduce"],"core-js/features/array/virtual/reduce-right":["es.array.reduce-right"],"core-js/features/array/virtual/reverse":["es.array.reverse"],"core-js/features/array/virtual/slice":["es.array.slice"],"core-js/features/array/virtual/some":["es.array.some"],"core-js/features/array/virtual/sort":["es.array.sort"],"core-js/features/array/virtual/splice":["es.array.splice"],"core-js/features/array/virtual/unique-by":["es.map","esnext.array.unique-by"],"core-js/features/array/virtual/values":["es.array.iterator"],"core-js/features/async-iterator":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","web.dom-collections.iterator"],"core-js/features/async-iterator/as-indexed-pairs":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","web.dom-collections.iterator"],"core-js/features/async-iterator/drop":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.drop","web.dom-collections.iterator"],"core-js/features/async-iterator/every":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.every","web.dom-collections.iterator"],"core-js/features/async-iterator/filter":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.filter","web.dom-collections.iterator"],"core-js/features/async-iterator/find":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.find","web.dom-collections.iterator"],"core-js/features/async-iterator/flat-map":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.flat-map","web.dom-collections.iterator"],"core-js/features/async-iterator/for-each":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.for-each","web.dom-collections.iterator"],"core-js/features/async-iterator/from":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.from","web.dom-collections.iterator"],"core-js/features/async-iterator/map":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.map","web.dom-collections.iterator"],"core-js/features/async-iterator/reduce":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.reduce","web.dom-collections.iterator"],"core-js/features/async-iterator/some":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.some","web.dom-collections.iterator"],"core-js/features/async-iterator/take":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.take","web.dom-collections.iterator"],"core-js/features/async-iterator/to-array":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.to-array","web.dom-collections.iterator"],"core-js/features/bigint":["esnext.bigint.range"],"core-js/features/bigint/range":["esnext.bigint.range"],"core-js/features/clear-immediate":["web.immediate"],"core-js/features/composite-key":["esnext.composite-key"],"core-js/features/composite-symbol":["es.symbol","esnext.composite-symbol"],"core-js/features/data-view":["es.data-view","es.object.to-string"],"core-js/features/date":["es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string"],"core-js/features/date/now":["es.date.now"],"core-js/features/date/to-iso-string":["es.date.to-iso-string","es.date.to-json"],"core-js/features/date/to-json":["es.date.to-json"],"core-js/features/date/to-primitive":["es.date.to-primitive"],"core-js/features/date/to-string":["es.date.to-string"],"core-js/features/dom-collections":["es.array.iterator","web.dom-collections.for-each","web.dom-collections.iterator"],"core-js/features/dom-collections/for-each":["web.dom-collections.for-each"],"core-js/features/dom-collections/iterator":["web.dom-collections.iterator"],"core-js/features/function":["es.function.bind","es.function.has-instance","es.function.name"],"core-js/features/function/bind":["es.function.bind"],"core-js/features/function/has-instance":["es.function.has-instance"],"core-js/features/function/name":["es.function.name"],"core-js/features/function/virtual":["es.function.bind"],"core-js/features/function/virtual/bind":["es.function.bind"],"core-js/features/get-iterator":["es.string.iterator","web.dom-collections.iterator"],"core-js/features/get-iterator-method":["es.string.iterator","web.dom-collections.iterator"],"core-js/features/global-this":["es.global-this","esnext.global-this"],"core-js/features/instance/at":["esnext.array.at","esnext.string.at"],"core-js/features/instance/bind":["es.function.bind"],"core-js/features/instance/code-point-at":["es.string.code-point-at"],"core-js/features/instance/code-points":["esnext.string.code-points"],"core-js/features/instance/concat":["es.array.concat"],"core-js/features/instance/copy-within":["es.array.copy-within"],"core-js/features/instance/ends-with":["es.string.ends-with"],"core-js/features/instance/entries":["es.array.iterator","web.dom-collections.iterator"],"core-js/features/instance/every":["es.array.every"],"core-js/features/instance/fill":["es.array.fill"],"core-js/features/instance/filter":["es.array.filter"],"core-js/features/instance/filter-out":["esnext.array.filter-out"],"core-js/features/instance/find":["es.array.find"],"core-js/features/instance/find-index":["es.array.find-index"],"core-js/features/instance/find-last":["esnext.array.find-last"],"core-js/features/instance/find-last-index":["esnext.array.find-last-index"],"core-js/features/instance/flags":["es.regexp.flags"],"core-js/features/instance/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/features/instance/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/features/instance/for-each":["es.array.for-each","web.dom-collections.iterator"],"core-js/features/instance/includes":["es.array.includes","es.string.includes"],"core-js/features/instance/index-of":["es.array.index-of"],"core-js/features/instance/keys":["es.array.iterator","web.dom-collections.iterator"],"core-js/features/instance/last-index-of":["es.array.last-index-of"],"core-js/features/instance/map":["es.array.map"],"core-js/features/instance/match-all":["es.string.match-all","esnext.string.match-all"],"core-js/features/instance/pad-end":["es.string.pad-end"],"core-js/features/instance/pad-start":["es.string.pad-start"],"core-js/features/instance/reduce":["es.array.reduce"],"core-js/features/instance/reduce-right":["es.array.reduce-right"],"core-js/features/instance/repeat":["es.string.repeat"],"core-js/features/instance/replace-all":["es.string.replace-all"],"core-js/features/instance/reverse":["es.array.reverse"],"core-js/features/instance/slice":["es.array.slice"],"core-js/features/instance/some":["es.array.some"],"core-js/features/instance/sort":["es.array.sort"],"core-js/features/instance/splice":["es.array.splice"],"core-js/features/instance/starts-with":["es.string.starts-with"],"core-js/features/instance/trim":["es.string.trim"],"core-js/features/instance/trim-end":["es.string.trim-end"],"core-js/features/instance/trim-left":["es.string.trim-start"],"core-js/features/instance/trim-right":["es.string.trim-end"],"core-js/features/instance/trim-start":["es.string.trim-start"],"core-js/features/instance/unique-by":["es.map","esnext.array.unique-by"],"core-js/features/instance/values":["es.array.iterator","web.dom-collections.iterator"],"core-js/features/is-iterable":["es.string.iterator","web.dom-collections.iterator"],"core-js/features/iterator":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","web.dom-collections.iterator"],"core-js/features/iterator/as-indexed-pairs":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","web.dom-collections.iterator"],"core-js/features/iterator/drop":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.drop","web.dom-collections.iterator"],"core-js/features/iterator/every":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.every","web.dom-collections.iterator"],"core-js/features/iterator/filter":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.filter","web.dom-collections.iterator"],"core-js/features/iterator/find":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.find","web.dom-collections.iterator"],"core-js/features/iterator/flat-map":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.flat-map","web.dom-collections.iterator"],"core-js/features/iterator/for-each":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.for-each","web.dom-collections.iterator"],"core-js/features/iterator/from":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.from","web.dom-collections.iterator"],"core-js/features/iterator/map":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.map","web.dom-collections.iterator"],"core-js/features/iterator/reduce":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.reduce","web.dom-collections.iterator"],"core-js/features/iterator/some":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.some","web.dom-collections.iterator"],"core-js/features/iterator/take":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.take","web.dom-collections.iterator"],"core-js/features/iterator/to-array":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.to-array","web.dom-collections.iterator"],"core-js/features/json":["es.json.stringify","es.json.to-string-tag"],"core-js/features/json/stringify":["es.json.stringify"],"core-js/features/json/to-string-tag":["es.json.to-string-tag"],"core-js/features/map":["es.map","es.object.to-string","es.string.iterator","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","web.dom-collections.iterator"],"core-js/features/map/delete-all":["es.map","esnext.map.delete-all"],"core-js/features/map/emplace":["es.map","esnext.map.emplace"],"core-js/features/map/every":["es.map","esnext.map.every"],"core-js/features/map/filter":["es.map","esnext.map.filter"],"core-js/features/map/find":["es.map","esnext.map.find"],"core-js/features/map/find-key":["es.map","esnext.map.find-key"],"core-js/features/map/from":["es.map","es.string.iterator","esnext.map.from","web.dom-collections.iterator"],"core-js/features/map/group-by":["es.map","esnext.map.group-by"],"core-js/features/map/includes":["es.map","esnext.map.includes"],"core-js/features/map/key-by":["es.map","esnext.map.key-by"],"core-js/features/map/key-of":["es.map","esnext.map.key-of"],"core-js/features/map/map-keys":["es.map","esnext.map.map-keys"],"core-js/features/map/map-values":["es.map","esnext.map.map-values"],"core-js/features/map/merge":["es.map","esnext.map.merge"],"core-js/features/map/of":["es.map","es.string.iterator","esnext.map.of","web.dom-collections.iterator"],"core-js/features/map/reduce":["es.map","esnext.map.reduce"],"core-js/features/map/some":["es.map","esnext.map.some"],"core-js/features/map/update":["es.map","esnext.map.update"],"core-js/features/map/update-or-insert":["es.map","esnext.map.update-or-insert"],"core-js/features/map/upsert":["es.map","esnext.map.upsert"],"core-js/features/math":["es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh"],"core-js/features/math/acosh":["es.math.acosh"],"core-js/features/math/asinh":["es.math.asinh"],"core-js/features/math/atanh":["es.math.atanh"],"core-js/features/math/cbrt":["es.math.cbrt"],"core-js/features/math/clamp":["esnext.math.clamp"],"core-js/features/math/clz32":["es.math.clz32"],"core-js/features/math/cosh":["es.math.cosh"],"core-js/features/math/deg-per-rad":["esnext.math.deg-per-rad"],"core-js/features/math/degrees":["esnext.math.degrees"],"core-js/features/math/expm1":["es.math.expm1"],"core-js/features/math/fround":["es.math.fround"],"core-js/features/math/fscale":["esnext.math.fscale"],"core-js/features/math/hypot":["es.math.hypot"],"core-js/features/math/iaddh":["esnext.math.iaddh"],"core-js/features/math/imul":["es.math.imul"],"core-js/features/math/imulh":["esnext.math.imulh"],"core-js/features/math/isubh":["esnext.math.isubh"],"core-js/features/math/log10":["es.math.log10"],"core-js/features/math/log1p":["es.math.log1p"],"core-js/features/math/log2":["es.math.log2"],"core-js/features/math/rad-per-deg":["esnext.math.rad-per-deg"],"core-js/features/math/radians":["esnext.math.radians"],"core-js/features/math/scale":["esnext.math.scale"],"core-js/features/math/seeded-prng":["esnext.math.seeded-prng"],"core-js/features/math/sign":["es.math.sign"],"core-js/features/math/signbit":["esnext.math.signbit"],"core-js/features/math/sinh":["es.math.sinh"],"core-js/features/math/tanh":["es.math.tanh"],"core-js/features/math/to-string-tag":["es.math.to-string-tag"],"core-js/features/math/trunc":["es.math.trunc"],"core-js/features/math/umulh":["esnext.math.umulh"],"core-js/features/number":["es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","esnext.number.from-string","esnext.number.range"],"core-js/features/number/constructor":["es.number.constructor"],"core-js/features/number/epsilon":["es.number.epsilon"],"core-js/features/number/from-string":["esnext.number.from-string"],"core-js/features/number/is-finite":["es.number.is-finite"],"core-js/features/number/is-integer":["es.number.is-integer"],"core-js/features/number/is-nan":["es.number.is-nan"],"core-js/features/number/is-safe-integer":["es.number.is-safe-integer"],"core-js/features/number/max-safe-integer":["es.number.max-safe-integer"],"core-js/features/number/min-safe-integer":["es.number.min-safe-integer"],"core-js/features/number/parse-float":["es.number.parse-float"],"core-js/features/number/parse-int":["es.number.parse-int"],"core-js/features/number/range":["esnext.number.range"],"core-js/features/number/to-fixed":["es.number.to-fixed"],"core-js/features/number/to-precision":["es.number.to-precision"],"core-js/features/number/virtual":["es.number.to-fixed","es.number.to-precision"],"core-js/features/number/virtual/to-fixed":["es.number.to-fixed"],"core-js/features/number/virtual/to-precision":["es.number.to-precision"],"core-js/features/object":["es.symbol","es.json.to-string-tag","es.math.to-string-tag","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.reflect.to-string-tag","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values"],"core-js/features/object/assign":["es.object.assign"],"core-js/features/object/create":["es.object.create"],"core-js/features/object/define-getter":["es.object.define-getter"],"core-js/features/object/define-properties":["es.object.define-properties"],"core-js/features/object/define-property":["es.object.define-property"],"core-js/features/object/define-setter":["es.object.define-setter"],"core-js/features/object/entries":["es.object.entries"],"core-js/features/object/freeze":["es.object.freeze"],"core-js/features/object/from-entries":["es.array.iterator","es.object.from-entries"],"core-js/features/object/get-own-property-descriptor":["es.object.get-own-property-descriptor"],"core-js/features/object/get-own-property-descriptors":["es.object.get-own-property-descriptors"],"core-js/features/object/get-own-property-names":["es.object.get-own-property-names"],"core-js/features/object/get-own-property-symbols":["es.symbol"],"core-js/features/object/get-prototype-of":["es.object.get-prototype-of"],"core-js/features/object/has-own":["esnext.object.has-own"],"core-js/features/object/is":["es.object.is"],"core-js/features/object/is-extensible":["es.object.is-extensible"],"core-js/features/object/is-frozen":["es.object.is-frozen"],"core-js/features/object/is-sealed":["es.object.is-sealed"],"core-js/features/object/iterate-entries":["esnext.object.iterate-entries"],"core-js/features/object/iterate-keys":["esnext.object.iterate-keys"],"core-js/features/object/iterate-values":["esnext.object.iterate-values"],"core-js/features/object/keys":["es.object.keys"],"core-js/features/object/lookup-getter":["es.object.lookup-setter"],"core-js/features/object/lookup-setter":["es.object.lookup-setter"],"core-js/features/object/prevent-extensions":["es.object.prevent-extensions"],"core-js/features/object/seal":["es.object.seal"],"core-js/features/object/set-prototype-of":["es.object.set-prototype-of"],"core-js/features/object/to-string":["es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/features/object/values":["es.object.values"],"core-js/features/observable":["es.object.to-string","es.string.iterator","esnext.observable","esnext.symbol.observable","web.dom-collections.iterator"],"core-js/features/parse-float":["es.parse-float"],"core-js/features/parse-int":["es.parse-int"],"core-js/features/promise":["es.aggregate-error","es.object.to-string","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.string.iterator","esnext.aggregate-error","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","web.dom-collections.iterator"],"core-js/features/promise/all-settled":["es.promise","es.promise.all-settled","es.string.iterator","esnext.promise.all-settled","web.dom-collections.iterator"],"core-js/features/promise/any":["es.aggregate-error","es.promise","es.promise.any","es.string.iterator","esnext.aggregate-error","esnext.promise.any","web.dom-collections.iterator"],"core-js/features/promise/finally":["es.promise","es.promise.finally"],"core-js/features/promise/try":["es.promise","esnext.promise.try"],"core-js/features/queue-microtask":["web.queue-microtask"],"core-js/features/reflect":["es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata"],"core-js/features/reflect/apply":["es.reflect.apply"],"core-js/features/reflect/construct":["es.reflect.construct"],"core-js/features/reflect/define-metadata":["esnext.reflect.define-metadata"],"core-js/features/reflect/define-property":["es.reflect.define-property"],"core-js/features/reflect/delete-metadata":["esnext.reflect.delete-metadata"],"core-js/features/reflect/delete-property":["es.reflect.delete-property"],"core-js/features/reflect/get":["es.reflect.get"],"core-js/features/reflect/get-metadata":["esnext.reflect.get-metadata"],"core-js/features/reflect/get-metadata-keys":["esnext.reflect.get-metadata-keys"],"core-js/features/reflect/get-own-metadata":["esnext.reflect.get-own-metadata"],"core-js/features/reflect/get-own-metadata-keys":["esnext.reflect.get-own-metadata-keys"],"core-js/features/reflect/get-own-property-descriptor":["es.reflect.get-own-property-descriptor"],"core-js/features/reflect/get-prototype-of":["es.reflect.get-prototype-of"],"core-js/features/reflect/has":["es.reflect.has"],"core-js/features/reflect/has-metadata":["esnext.reflect.has-metadata"],"core-js/features/reflect/has-own-metadata":["esnext.reflect.has-own-metadata"],"core-js/features/reflect/is-extensible":["es.reflect.is-extensible"],"core-js/features/reflect/metadata":["esnext.reflect.metadata"],"core-js/features/reflect/own-keys":["es.reflect.own-keys"],"core-js/features/reflect/prevent-extensions":["es.reflect.prevent-extensions"],"core-js/features/reflect/set":["es.reflect.set"],"core-js/features/reflect/set-prototype-of":["es.reflect.set-prototype-of"],"core-js/features/reflect/to-string-tag":["es.reflect.to-string-tag"],"core-js/features/regexp":["es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.string.match","es.string.replace","es.string.search","es.string.split"],"core-js/features/regexp/constructor":["es.regexp.constructor"],"core-js/features/regexp/flags":["es.regexp.flags"],"core-js/features/regexp/match":["es.string.match"],"core-js/features/regexp/replace":["es.string.replace"],"core-js/features/regexp/search":["es.string.search"],"core-js/features/regexp/split":["es.string.split"],"core-js/features/regexp/sticky":["es.regexp.sticky"],"core-js/features/regexp/test":["es.regexp.exec","es.regexp.test"],"core-js/features/regexp/to-string":["es.regexp.to-string"],"core-js/features/set":["es.object.to-string","es.set","es.string.iterator","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","web.dom-collections.iterator"],"core-js/features/set-immediate":["web.immediate"],"core-js/features/set-interval":["web.timers"],"core-js/features/set-timeout":["web.timers"],"core-js/features/set/add-all":["es.set","esnext.set.add-all"],"core-js/features/set/delete-all":["es.set","esnext.set.delete-all"],"core-js/features/set/difference":["es.set","es.string.iterator","esnext.set.difference","web.dom-collections.iterator"],"core-js/features/set/every":["es.set","esnext.set.every"],"core-js/features/set/filter":["es.set","esnext.set.filter"],"core-js/features/set/find":["es.set","esnext.set.find"],"core-js/features/set/from":["es.set","es.string.iterator","esnext.set.from","web.dom-collections.iterator"],"core-js/features/set/intersection":["es.set","esnext.set.intersection"],"core-js/features/set/is-disjoint-from":["es.set","esnext.set.is-disjoint-from"],"core-js/features/set/is-subset-of":["es.set","es.string.iterator","esnext.set.is-subset-of","web.dom-collections.iterator"],"core-js/features/set/is-superset-of":["es.set","esnext.set.is-superset-of"],"core-js/features/set/join":["es.set","esnext.set.join"],"core-js/features/set/map":["es.set","esnext.set.map"],"core-js/features/set/of":["es.set","es.string.iterator","esnext.set.of","web.dom-collections.iterator"],"core-js/features/set/reduce":["es.set","esnext.set.reduce"],"core-js/features/set/some":["es.set","esnext.set.some"],"core-js/features/set/symmetric-difference":["es.set","es.string.iterator","esnext.set.symmetric-difference","web.dom-collections.iterator"],"core-js/features/set/union":["es.set","es.string.iterator","esnext.set.union","web.dom-collections.iterator"],"core-js/features/string":["es.regexp.exec","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all"],"core-js/features/string/anchor":["es.string.anchor"],"core-js/features/string/at":["esnext.string.at"],"core-js/features/string/big":["es.string.big"],"core-js/features/string/blink":["es.string.blink"],"core-js/features/string/bold":["es.string.bold"],"core-js/features/string/code-point-at":["es.string.code-point-at"],"core-js/features/string/code-points":["esnext.string.code-points"],"core-js/features/string/ends-with":["es.string.ends-with"],"core-js/features/string/fixed":["es.string.fixed"],"core-js/features/string/fontcolor":["es.string.fontcolor"],"core-js/features/string/fontsize":["es.string.fontsize"],"core-js/features/string/from-code-point":["es.string.from-code-point"],"core-js/features/string/includes":["es.string.includes"],"core-js/features/string/italics":["es.string.italics"],"core-js/features/string/iterator":["es.string.iterator"],"core-js/features/string/link":["es.string.link"],"core-js/features/string/match":["es.regexp.exec","es.string.match"],"core-js/features/string/match-all":["es.string.match-all","esnext.string.match-all"],"core-js/features/string/pad-end":["es.string.pad-end"],"core-js/features/string/pad-start":["es.string.pad-start"],"core-js/features/string/raw":["es.string.raw"],"core-js/features/string/repeat":["es.string.repeat"],"core-js/features/string/replace":["es.regexp.exec","es.string.replace"],"core-js/features/string/replace-all":["es.string.replace-all","esnext.string.replace-all"],"core-js/features/string/search":["es.regexp.exec","es.string.search"],"core-js/features/string/small":["es.string.small"],"core-js/features/string/split":["es.regexp.exec","es.string.split"],"core-js/features/string/starts-with":["es.string.starts-with"],"core-js/features/string/strike":["es.string.strike"],"core-js/features/string/sub":["es.string.sub"],"core-js/features/string/sup":["es.string.sup"],"core-js/features/string/trim":["es.string.trim"],"core-js/features/string/trim-end":["es.string.trim-end"],"core-js/features/string/trim-left":["es.string.trim-start"],"core-js/features/string/trim-right":["es.string.trim-end"],"core-js/features/string/trim-start":["es.string.trim-start"],"core-js/features/string/virtual":["es.string.code-point-at","es.string.ends-with","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all"],"core-js/features/string/virtual/anchor":["es.string.anchor"],"core-js/features/string/virtual/at":["esnext.string.at"],"core-js/features/string/virtual/big":["es.string.big"],"core-js/features/string/virtual/blink":["es.string.blink"],"core-js/features/string/virtual/bold":["es.string.bold"],"core-js/features/string/virtual/code-point-at":["es.string.code-point-at"],"core-js/features/string/virtual/code-points":["esnext.string.code-points"],"core-js/features/string/virtual/ends-with":["es.string.ends-with"],"core-js/features/string/virtual/fixed":["es.string.fixed"],"core-js/features/string/virtual/fontcolor":["es.string.fontcolor"],"core-js/features/string/virtual/fontsize":["es.string.fontsize"],"core-js/features/string/virtual/includes":["es.string.includes"],"core-js/features/string/virtual/italics":["es.string.italics"],"core-js/features/string/virtual/iterator":["es.string.iterator"],"core-js/features/string/virtual/link":["es.string.link"],"core-js/features/string/virtual/match-all":["es.string.match-all","esnext.string.match-all"],"core-js/features/string/virtual/pad-end":["es.string.pad-end"],"core-js/features/string/virtual/pad-start":["es.string.pad-start"],"core-js/features/string/virtual/repeat":["es.string.repeat"],"core-js/features/string/virtual/replace-all":["es.string.replace-all","esnext.string.replace-all"],"core-js/features/string/virtual/small":["es.string.small"],"core-js/features/string/virtual/starts-with":["es.string.starts-with"],"core-js/features/string/virtual/strike":["es.string.strike"],"core-js/features/string/virtual/sub":["es.string.sub"],"core-js/features/string/virtual/sup":["es.string.sup"],"core-js/features/string/virtual/trim":["es.string.trim"],"core-js/features/string/virtual/trim-end":["es.string.trim-end"],"core-js/features/string/virtual/trim-left":["es.string.trim-start"],"core-js/features/string/virtual/trim-right":["es.string.trim-end"],"core-js/features/string/virtual/trim-start":["es.string.trim-start"],"core-js/features/symbol":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.array.concat","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all"],"core-js/features/symbol/async-dispose":["esnext.symbol.async-dispose"],"core-js/features/symbol/async-iterator":["es.symbol.async-iterator"],"core-js/features/symbol/description":["es.symbol.description"],"core-js/features/symbol/dispose":["esnext.symbol.dispose"],"core-js/features/symbol/for":["es.symbol"],"core-js/features/symbol/has-instance":["es.symbol.has-instance","es.function.has-instance"],"core-js/features/symbol/is-concat-spreadable":["es.symbol.is-concat-spreadable","es.array.concat"],"core-js/features/symbol/iterator":["es.symbol.iterator","es.string.iterator","web.dom-collections.iterator"],"core-js/features/symbol/key-for":["es.symbol"],"core-js/features/symbol/match":["es.symbol.match","es.string.match"],"core-js/features/symbol/match-all":["es.symbol.match-all","es.string.match-all"],"core-js/features/symbol/matcher":["esnext.symbol.matcher"],"core-js/features/symbol/metadata":["esnext.symbol.metadata"],"core-js/features/symbol/observable":["esnext.symbol.observable"],"core-js/features/symbol/pattern-match":["esnext.symbol.pattern-match"],"core-js/features/symbol/replace":["es.symbol.replace","es.string.replace"],"core-js/features/symbol/replace-all":["esnext.symbol.replace-all"],"core-js/features/symbol/search":["es.symbol.search","es.string.search"],"core-js/features/symbol/species":["es.symbol.species"],"core-js/features/symbol/split":["es.symbol.split","es.string.split"],"core-js/features/symbol/to-primitive":["es.symbol.to-primitive"],"core-js/features/symbol/to-string-tag":["es.symbol.to-string-tag","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/features/symbol/unscopables":["es.symbol.unscopables"],"core-js/features/typed-array":["es.map","es.object.to-string","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by"],"core-js/features/typed-array/at":["esnext.typed-array.at"],"core-js/features/typed-array/copy-within":["es.typed-array.copy-within"],"core-js/features/typed-array/entries":["es.typed-array.iterator"],"core-js/features/typed-array/every":["es.typed-array.every"],"core-js/features/typed-array/fill":["es.typed-array.fill"],"core-js/features/typed-array/filter":["es.typed-array.filter"],"core-js/features/typed-array/filter-out":["esnext.typed-array.filter-out"],"core-js/features/typed-array/find":["es.typed-array.find"],"core-js/features/typed-array/find-index":["es.typed-array.find-index"],"core-js/features/typed-array/find-last":["esnext.typed-array.find-last"],"core-js/features/typed-array/find-last-index":["esnext.typed-array.find-last-index"],"core-js/features/typed-array/float32-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/float64-array":["es.object.to-string","es.typed-array.float64-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/for-each":["es.typed-array.for-each"],"core-js/features/typed-array/from":["es.typed-array.from"],"core-js/features/typed-array/includes":["es.typed-array.includes"],"core-js/features/typed-array/index-of":["es.typed-array.index-of"],"core-js/features/typed-array/int16-array":["es.object.to-string","es.typed-array.int16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/int32-array":["es.object.to-string","es.typed-array.int32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/int8-array":["es.object.to-string","es.typed-array.int8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/iterator":["es.typed-array.iterator"],"core-js/features/typed-array/join":["es.typed-array.join"],"core-js/features/typed-array/keys":["es.typed-array.iterator"],"core-js/features/typed-array/last-index-of":["es.typed-array.last-index-of"],"core-js/features/typed-array/map":["es.typed-array.map"],"core-js/features/typed-array/of":["es.typed-array.of"],"core-js/features/typed-array/reduce":["es.typed-array.reduce"],"core-js/features/typed-array/reduce-right":["es.typed-array.reduce-right"],"core-js/features/typed-array/reverse":["es.typed-array.reverse"],"core-js/features/typed-array/set":["es.typed-array.set"],"core-js/features/typed-array/slice":["es.typed-array.slice"],"core-js/features/typed-array/some":["es.typed-array.some"],"core-js/features/typed-array/sort":["es.typed-array.sort"],"core-js/features/typed-array/subarray":["es.typed-array.subarray"],"core-js/features/typed-array/to-locale-string":["es.typed-array.to-locale-string"],"core-js/features/typed-array/to-string":["es.typed-array.to-string"],"core-js/features/typed-array/uint16-array":["es.object.to-string","es.typed-array.uint16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/uint32-array":["es.object.to-string","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/uint8-array":["es.object.to-string","es.typed-array.uint8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/uint8-clamped-array":["es.object.to-string","es.typed-array.uint8-clamped-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/unique-by":["es.map","esnext.typed-array.unique-by"],"core-js/features/typed-array/values":["es.typed-array.iterator"],"core-js/features/url":["web.url","web.url.to-json","web.url-search-params"],"core-js/features/url-search-params":["web.url-search-params"],"core-js/features/url/to-json":["web.url.to-json"],"core-js/features/weak-map":["es.object.to-string","es.weak-map","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","web.dom-collections.iterator"],"core-js/features/weak-map/delete-all":["es.weak-map","esnext.weak-map.delete-all"],"core-js/features/weak-map/emplace":["es.weak-map","esnext.weak-map.emplace"],"core-js/features/weak-map/from":["es.string.iterator","es.weak-map","esnext.weak-map.from","web.dom-collections.iterator"],"core-js/features/weak-map/of":["es.string.iterator","es.weak-map","esnext.weak-map.of","web.dom-collections.iterator"],"core-js/features/weak-map/upsert":["es.weak-map","esnext.weak-map.upsert"],"core-js/features/weak-set":["es.object.to-string","es.weak-set","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.iterator"],"core-js/features/weak-set/add-all":["es.weak-set","esnext.weak-set.add-all"],"core-js/features/weak-set/delete-all":["es.weak-set","esnext.weak-set.delete-all"],"core-js/features/weak-set/from":["es.string.iterator","es.weak-set","esnext.weak-set.from","web.dom-collections.iterator"],"core-js/features/weak-set/of":["es.string.iterator","es.weak-set","esnext.weak-set.of","web.dom-collections.iterator"],"core-js/modules/es.aggregate-error":["es.aggregate-error"],"core-js/modules/es.array-buffer.constructor":["es.array-buffer.constructor"],"core-js/modules/es.array-buffer.is-view":["es.array-buffer.is-view"],"core-js/modules/es.array-buffer.slice":["es.array-buffer.slice"],"core-js/modules/es.array.concat":["es.array.concat"],"core-js/modules/es.array.copy-within":["es.array.copy-within"],"core-js/modules/es.array.every":["es.array.every"],"core-js/modules/es.array.fill":["es.array.fill"],"core-js/modules/es.array.filter":["es.array.filter"],"core-js/modules/es.array.find":["es.array.find"],"core-js/modules/es.array.find-index":["es.array.find-index"],"core-js/modules/es.array.flat":["es.array.flat"],"core-js/modules/es.array.flat-map":["es.array.flat-map"],"core-js/modules/es.array.for-each":["es.array.for-each"],"core-js/modules/es.array.from":["es.array.from"],"core-js/modules/es.array.includes":["es.array.includes"],"core-js/modules/es.array.index-of":["es.array.index-of"],"core-js/modules/es.array.is-array":["es.array.is-array"],"core-js/modules/es.array.iterator":["es.array.iterator"],"core-js/modules/es.array.join":["es.array.join"],"core-js/modules/es.array.last-index-of":["es.array.last-index-of"],"core-js/modules/es.array.map":["es.array.map"],"core-js/modules/es.array.of":["es.array.of"],"core-js/modules/es.array.reduce":["es.array.reduce"],"core-js/modules/es.array.reduce-right":["es.array.reduce-right"],"core-js/modules/es.array.reverse":["es.array.reverse"],"core-js/modules/es.array.slice":["es.array.slice"],"core-js/modules/es.array.some":["es.array.some"],"core-js/modules/es.array.sort":["es.array.sort"],"core-js/modules/es.array.species":["es.array.species"],"core-js/modules/es.array.splice":["es.array.splice"],"core-js/modules/es.array.unscopables.flat":["es.array.unscopables.flat"],"core-js/modules/es.array.unscopables.flat-map":["es.array.unscopables.flat-map"],"core-js/modules/es.data-view":["es.data-view"],"core-js/modules/es.date.now":["es.date.now"],"core-js/modules/es.date.to-iso-string":["es.date.to-iso-string"],"core-js/modules/es.date.to-json":["es.date.to-json"],"core-js/modules/es.date.to-primitive":["es.date.to-primitive"],"core-js/modules/es.date.to-string":["es.date.to-string"],"core-js/modules/es.function.bind":["es.function.bind"],"core-js/modules/es.function.has-instance":["es.function.has-instance"],"core-js/modules/es.function.name":["es.function.name"],"core-js/modules/es.global-this":["es.global-this"],"core-js/modules/es.json.stringify":["es.json.stringify"],"core-js/modules/es.json.to-string-tag":["es.json.to-string-tag"],"core-js/modules/es.map":["es.map"],"core-js/modules/es.math.acosh":["es.math.acosh"],"core-js/modules/es.math.asinh":["es.math.asinh"],"core-js/modules/es.math.atanh":["es.math.atanh"],"core-js/modules/es.math.cbrt":["es.math.cbrt"],"core-js/modules/es.math.clz32":["es.math.clz32"],"core-js/modules/es.math.cosh":["es.math.cosh"],"core-js/modules/es.math.expm1":["es.math.expm1"],"core-js/modules/es.math.fround":["es.math.fround"],"core-js/modules/es.math.hypot":["es.math.hypot"],"core-js/modules/es.math.imul":["es.math.imul"],"core-js/modules/es.math.log10":["es.math.log10"],"core-js/modules/es.math.log1p":["es.math.log1p"],"core-js/modules/es.math.log2":["es.math.log2"],"core-js/modules/es.math.sign":["es.math.sign"],"core-js/modules/es.math.sinh":["es.math.sinh"],"core-js/modules/es.math.tanh":["es.math.tanh"],"core-js/modules/es.math.to-string-tag":["es.math.to-string-tag"],"core-js/modules/es.math.trunc":["es.math.trunc"],"core-js/modules/es.number.constructor":["es.number.constructor"],"core-js/modules/es.number.epsilon":["es.number.epsilon"],"core-js/modules/es.number.is-finite":["es.number.is-finite"],"core-js/modules/es.number.is-integer":["es.number.is-integer"],"core-js/modules/es.number.is-nan":["es.number.is-nan"],"core-js/modules/es.number.is-safe-integer":["es.number.is-safe-integer"],"core-js/modules/es.number.max-safe-integer":["es.number.max-safe-integer"],"core-js/modules/es.number.min-safe-integer":["es.number.min-safe-integer"],"core-js/modules/es.number.parse-float":["es.number.parse-float"],"core-js/modules/es.number.parse-int":["es.number.parse-int"],"core-js/modules/es.number.to-fixed":["es.number.to-fixed"],"core-js/modules/es.number.to-precision":["es.number.to-precision"],"core-js/modules/es.object.assign":["es.object.assign"],"core-js/modules/es.object.create":["es.object.create"],"core-js/modules/es.object.define-getter":["es.object.define-getter"],"core-js/modules/es.object.define-properties":["es.object.define-properties"],"core-js/modules/es.object.define-property":["es.object.define-property"],"core-js/modules/es.object.define-setter":["es.object.define-setter"],"core-js/modules/es.object.entries":["es.object.entries"],"core-js/modules/es.object.freeze":["es.object.freeze"],"core-js/modules/es.object.from-entries":["es.object.from-entries"],"core-js/modules/es.object.get-own-property-descriptor":["es.object.get-own-property-descriptor"],"core-js/modules/es.object.get-own-property-descriptors":["es.object.get-own-property-descriptors"],"core-js/modules/es.object.get-own-property-names":["es.object.get-own-property-names"],"core-js/modules/es.object.get-prototype-of":["es.object.get-prototype-of"],"core-js/modules/es.object.is":["es.object.is"],"core-js/modules/es.object.is-extensible":["es.object.is-extensible"],"core-js/modules/es.object.is-frozen":["es.object.is-frozen"],"core-js/modules/es.object.is-sealed":["es.object.is-sealed"],"core-js/modules/es.object.keys":["es.object.keys"],"core-js/modules/es.object.lookup-getter":["es.object.lookup-getter"],"core-js/modules/es.object.lookup-setter":["es.object.lookup-setter"],"core-js/modules/es.object.prevent-extensions":["es.object.prevent-extensions"],"core-js/modules/es.object.seal":["es.object.seal"],"core-js/modules/es.object.set-prototype-of":["es.object.set-prototype-of"],"core-js/modules/es.object.to-string":["es.object.to-string"],"core-js/modules/es.object.values":["es.object.values"],"core-js/modules/es.parse-float":["es.parse-float"],"core-js/modules/es.parse-int":["es.parse-int"],"core-js/modules/es.promise":["es.promise"],"core-js/modules/es.promise.all-settled":["es.promise.all-settled"],"core-js/modules/es.promise.any":["es.promise.any"],"core-js/modules/es.promise.finally":["es.promise.finally"],"core-js/modules/es.reflect.apply":["es.reflect.apply"],"core-js/modules/es.reflect.construct":["es.reflect.construct"],"core-js/modules/es.reflect.define-property":["es.reflect.define-property"],"core-js/modules/es.reflect.delete-property":["es.reflect.delete-property"],"core-js/modules/es.reflect.get":["es.reflect.get"],"core-js/modules/es.reflect.get-own-property-descriptor":["es.reflect.get-own-property-descriptor"],"core-js/modules/es.reflect.get-prototype-of":["es.reflect.get-prototype-of"],"core-js/modules/es.reflect.has":["es.reflect.has"],"core-js/modules/es.reflect.is-extensible":["es.reflect.is-extensible"],"core-js/modules/es.reflect.own-keys":["es.reflect.own-keys"],"core-js/modules/es.reflect.prevent-extensions":["es.reflect.prevent-extensions"],"core-js/modules/es.reflect.set":["es.reflect.set"],"core-js/modules/es.reflect.set-prototype-of":["es.reflect.set-prototype-of"],"core-js/modules/es.reflect.to-string-tag":["es.reflect.to-string-tag"],"core-js/modules/es.regexp.constructor":["es.regexp.constructor"],"core-js/modules/es.regexp.exec":["es.regexp.exec"],"core-js/modules/es.regexp.flags":["es.regexp.flags"],"core-js/modules/es.regexp.sticky":["es.regexp.sticky"],"core-js/modules/es.regexp.test":["es.regexp.test"],"core-js/modules/es.regexp.to-string":["es.regexp.to-string"],"core-js/modules/es.set":["es.set"],"core-js/modules/es.string.anchor":["es.string.anchor"],"core-js/modules/es.string.big":["es.string.big"],"core-js/modules/es.string.blink":["es.string.blink"],"core-js/modules/es.string.bold":["es.string.bold"],"core-js/modules/es.string.code-point-at":["es.string.code-point-at"],"core-js/modules/es.string.ends-with":["es.string.ends-with"],"core-js/modules/es.string.fixed":["es.string.fixed"],"core-js/modules/es.string.fontcolor":["es.string.fontcolor"],"core-js/modules/es.string.fontsize":["es.string.fontsize"],"core-js/modules/es.string.from-code-point":["es.string.from-code-point"],"core-js/modules/es.string.includes":["es.string.includes"],"core-js/modules/es.string.italics":["es.string.italics"],"core-js/modules/es.string.iterator":["es.string.iterator"],"core-js/modules/es.string.link":["es.string.link"],"core-js/modules/es.string.match":["es.string.match"],"core-js/modules/es.string.match-all":["es.string.match-all"],"core-js/modules/es.string.pad-end":["es.string.pad-end"],"core-js/modules/es.string.pad-start":["es.string.pad-start"],"core-js/modules/es.string.raw":["es.string.raw"],"core-js/modules/es.string.repeat":["es.string.repeat"],"core-js/modules/es.string.replace":["es.string.replace"],"core-js/modules/es.string.replace-all":["es.string.replace-all"],"core-js/modules/es.string.search":["es.string.search"],"core-js/modules/es.string.small":["es.string.small"],"core-js/modules/es.string.split":["es.string.split"],"core-js/modules/es.string.starts-with":["es.string.starts-with"],"core-js/modules/es.string.strike":["es.string.strike"],"core-js/modules/es.string.sub":["es.string.sub"],"core-js/modules/es.string.sup":["es.string.sup"],"core-js/modules/es.string.trim":["es.string.trim"],"core-js/modules/es.string.trim-end":["es.string.trim-end"],"core-js/modules/es.string.trim-start":["es.string.trim-start"],"core-js/modules/es.symbol":["es.symbol"],"core-js/modules/es.symbol.async-iterator":["es.symbol.async-iterator"],"core-js/modules/es.symbol.description":["es.symbol.description"],"core-js/modules/es.symbol.has-instance":["es.symbol.has-instance"],"core-js/modules/es.symbol.is-concat-spreadable":["es.symbol.is-concat-spreadable"],"core-js/modules/es.symbol.iterator":["es.symbol.iterator"],"core-js/modules/es.symbol.match":["es.symbol.match"],"core-js/modules/es.symbol.match-all":["es.symbol.match-all"],"core-js/modules/es.symbol.replace":["es.symbol.replace"],"core-js/modules/es.symbol.search":["es.symbol.search"],"core-js/modules/es.symbol.species":["es.symbol.species"],"core-js/modules/es.symbol.split":["es.symbol.split"],"core-js/modules/es.symbol.to-primitive":["es.symbol.to-primitive"],"core-js/modules/es.symbol.to-string-tag":["es.symbol.to-string-tag"],"core-js/modules/es.symbol.unscopables":["es.symbol.unscopables"],"core-js/modules/es.typed-array.copy-within":["es.typed-array.copy-within"],"core-js/modules/es.typed-array.every":["es.typed-array.every"],"core-js/modules/es.typed-array.fill":["es.typed-array.fill"],"core-js/modules/es.typed-array.filter":["es.typed-array.filter"],"core-js/modules/es.typed-array.find":["es.typed-array.find"],"core-js/modules/es.typed-array.find-index":["es.typed-array.find-index"],"core-js/modules/es.typed-array.float32-array":["es.typed-array.float32-array"],"core-js/modules/es.typed-array.float64-array":["es.typed-array.float64-array"],"core-js/modules/es.typed-array.for-each":["es.typed-array.for-each"],"core-js/modules/es.typed-array.from":["es.typed-array.from"],"core-js/modules/es.typed-array.includes":["es.typed-array.includes"],"core-js/modules/es.typed-array.index-of":["es.typed-array.index-of"],"core-js/modules/es.typed-array.int16-array":["es.typed-array.int16-array"],"core-js/modules/es.typed-array.int32-array":["es.typed-array.int32-array"],"core-js/modules/es.typed-array.int8-array":["es.typed-array.int8-array"],"core-js/modules/es.typed-array.iterator":["es.typed-array.iterator"],"core-js/modules/es.typed-array.join":["es.typed-array.join"],"core-js/modules/es.typed-array.last-index-of":["es.typed-array.last-index-of"],"core-js/modules/es.typed-array.map":["es.typed-array.map"],"core-js/modules/es.typed-array.of":["es.typed-array.of"],"core-js/modules/es.typed-array.reduce":["es.typed-array.reduce"],"core-js/modules/es.typed-array.reduce-right":["es.typed-array.reduce-right"],"core-js/modules/es.typed-array.reverse":["es.typed-array.reverse"],"core-js/modules/es.typed-array.set":["es.typed-array.set"],"core-js/modules/es.typed-array.slice":["es.typed-array.slice"],"core-js/modules/es.typed-array.some":["es.typed-array.some"],"core-js/modules/es.typed-array.sort":["es.typed-array.sort"],"core-js/modules/es.typed-array.subarray":["es.typed-array.subarray"],"core-js/modules/es.typed-array.to-locale-string":["es.typed-array.to-locale-string"],"core-js/modules/es.typed-array.to-string":["es.typed-array.to-string"],"core-js/modules/es.typed-array.uint16-array":["es.typed-array.uint16-array"],"core-js/modules/es.typed-array.uint32-array":["es.typed-array.uint32-array"],"core-js/modules/es.typed-array.uint8-array":["es.typed-array.uint8-array"],"core-js/modules/es.typed-array.uint8-clamped-array":["es.typed-array.uint8-clamped-array"],"core-js/modules/es.weak-map":["es.weak-map"],"core-js/modules/es.weak-set":["es.weak-set"],"core-js/modules/esnext.aggregate-error":["esnext.aggregate-error"],"core-js/modules/esnext.array.at":["esnext.array.at"],"core-js/modules/esnext.array.filter-out":["esnext.array.filter-out"],"core-js/modules/esnext.array.find-last":["esnext.array.find-last"],"core-js/modules/esnext.array.find-last-index":["esnext.array.find-last-index"],"core-js/modules/esnext.array.is-template-object":["esnext.array.is-template-object"],"core-js/modules/esnext.array.last-index":["esnext.array.last-index"],"core-js/modules/esnext.array.last-item":["esnext.array.last-item"],"core-js/modules/esnext.array.unique-by":["esnext.array.unique-by"],"core-js/modules/esnext.async-iterator.as-indexed-pairs":["esnext.async-iterator.as-indexed-pairs"],"core-js/modules/esnext.async-iterator.constructor":["esnext.async-iterator.constructor"],"core-js/modules/esnext.async-iterator.drop":["esnext.async-iterator.drop"],"core-js/modules/esnext.async-iterator.every":["esnext.async-iterator.every"],"core-js/modules/esnext.async-iterator.filter":["esnext.async-iterator.filter"],"core-js/modules/esnext.async-iterator.find":["esnext.async-iterator.find"],"core-js/modules/esnext.async-iterator.flat-map":["esnext.async-iterator.flat-map"],"core-js/modules/esnext.async-iterator.for-each":["esnext.async-iterator.for-each"],"core-js/modules/esnext.async-iterator.from":["esnext.async-iterator.from"],"core-js/modules/esnext.async-iterator.map":["esnext.async-iterator.map"],"core-js/modules/esnext.async-iterator.reduce":["esnext.async-iterator.reduce"],"core-js/modules/esnext.async-iterator.some":["esnext.async-iterator.some"],"core-js/modules/esnext.async-iterator.take":["esnext.async-iterator.take"],"core-js/modules/esnext.async-iterator.to-array":["esnext.async-iterator.to-array"],"core-js/modules/esnext.bigint.range":["esnext.bigint.range"],"core-js/modules/esnext.composite-key":["esnext.composite-key"],"core-js/modules/esnext.composite-symbol":["esnext.composite-symbol"],"core-js/modules/esnext.global-this":["esnext.global-this"],"core-js/modules/esnext.iterator.as-indexed-pairs":["esnext.iterator.as-indexed-pairs"],"core-js/modules/esnext.iterator.constructor":["esnext.iterator.constructor"],"core-js/modules/esnext.iterator.drop":["esnext.iterator.drop"],"core-js/modules/esnext.iterator.every":["esnext.iterator.every"],"core-js/modules/esnext.iterator.filter":["esnext.iterator.filter"],"core-js/modules/esnext.iterator.find":["esnext.iterator.find"],"core-js/modules/esnext.iterator.flat-map":["esnext.iterator.flat-map"],"core-js/modules/esnext.iterator.for-each":["esnext.iterator.for-each"],"core-js/modules/esnext.iterator.from":["esnext.iterator.from"],"core-js/modules/esnext.iterator.map":["esnext.iterator.map"],"core-js/modules/esnext.iterator.reduce":["esnext.iterator.reduce"],"core-js/modules/esnext.iterator.some":["esnext.iterator.some"],"core-js/modules/esnext.iterator.take":["esnext.iterator.take"],"core-js/modules/esnext.iterator.to-array":["esnext.iterator.to-array"],"core-js/modules/esnext.map.delete-all":["esnext.map.delete-all"],"core-js/modules/esnext.map.emplace":["esnext.map.emplace"],"core-js/modules/esnext.map.every":["esnext.map.every"],"core-js/modules/esnext.map.filter":["esnext.map.filter"],"core-js/modules/esnext.map.find":["esnext.map.find"],"core-js/modules/esnext.map.find-key":["esnext.map.find-key"],"core-js/modules/esnext.map.from":["esnext.map.from"],"core-js/modules/esnext.map.group-by":["esnext.map.group-by"],"core-js/modules/esnext.map.includes":["esnext.map.includes"],"core-js/modules/esnext.map.key-by":["esnext.map.key-by"],"core-js/modules/esnext.map.key-of":["esnext.map.key-of"],"core-js/modules/esnext.map.map-keys":["esnext.map.map-keys"],"core-js/modules/esnext.map.map-values":["esnext.map.map-values"],"core-js/modules/esnext.map.merge":["esnext.map.merge"],"core-js/modules/esnext.map.of":["esnext.map.of"],"core-js/modules/esnext.map.reduce":["esnext.map.reduce"],"core-js/modules/esnext.map.some":["esnext.map.some"],"core-js/modules/esnext.map.update":["esnext.map.update"],"core-js/modules/esnext.map.update-or-insert":["esnext.map.update-or-insert"],"core-js/modules/esnext.map.upsert":["esnext.map.upsert"],"core-js/modules/esnext.math.clamp":["esnext.math.clamp"],"core-js/modules/esnext.math.deg-per-rad":["esnext.math.deg-per-rad"],"core-js/modules/esnext.math.degrees":["esnext.math.degrees"],"core-js/modules/esnext.math.fscale":["esnext.math.fscale"],"core-js/modules/esnext.math.iaddh":["esnext.math.iaddh"],"core-js/modules/esnext.math.imulh":["esnext.math.imulh"],"core-js/modules/esnext.math.isubh":["esnext.math.isubh"],"core-js/modules/esnext.math.rad-per-deg":["esnext.math.rad-per-deg"],"core-js/modules/esnext.math.radians":["esnext.math.radians"],"core-js/modules/esnext.math.scale":["esnext.math.scale"],"core-js/modules/esnext.math.seeded-prng":["esnext.math.seeded-prng"],"core-js/modules/esnext.math.signbit":["esnext.math.signbit"],"core-js/modules/esnext.math.umulh":["esnext.math.umulh"],"core-js/modules/esnext.number.from-string":["esnext.number.from-string"],"core-js/modules/esnext.number.range":["esnext.number.range"],"core-js/modules/esnext.object.has-own":["esnext.object.has-own"],"core-js/modules/esnext.object.iterate-entries":["esnext.object.iterate-entries"],"core-js/modules/esnext.object.iterate-keys":["esnext.object.iterate-keys"],"core-js/modules/esnext.object.iterate-values":["esnext.object.iterate-values"],"core-js/modules/esnext.observable":["esnext.observable"],"core-js/modules/esnext.promise.all-settled":["esnext.promise.all-settled"],"core-js/modules/esnext.promise.any":["esnext.promise.any"],"core-js/modules/esnext.promise.try":["esnext.promise.try"],"core-js/modules/esnext.reflect.define-metadata":["esnext.reflect.define-metadata"],"core-js/modules/esnext.reflect.delete-metadata":["esnext.reflect.delete-metadata"],"core-js/modules/esnext.reflect.get-metadata":["esnext.reflect.get-metadata"],"core-js/modules/esnext.reflect.get-metadata-keys":["esnext.reflect.get-metadata-keys"],"core-js/modules/esnext.reflect.get-own-metadata":["esnext.reflect.get-own-metadata"],"core-js/modules/esnext.reflect.get-own-metadata-keys":["esnext.reflect.get-own-metadata-keys"],"core-js/modules/esnext.reflect.has-metadata":["esnext.reflect.has-metadata"],"core-js/modules/esnext.reflect.has-own-metadata":["esnext.reflect.has-own-metadata"],"core-js/modules/esnext.reflect.metadata":["esnext.reflect.metadata"],"core-js/modules/esnext.set.add-all":["esnext.set.add-all"],"core-js/modules/esnext.set.delete-all":["esnext.set.delete-all"],"core-js/modules/esnext.set.difference":["esnext.set.difference"],"core-js/modules/esnext.set.every":["esnext.set.every"],"core-js/modules/esnext.set.filter":["esnext.set.filter"],"core-js/modules/esnext.set.find":["esnext.set.find"],"core-js/modules/esnext.set.from":["esnext.set.from"],"core-js/modules/esnext.set.intersection":["esnext.set.intersection"],"core-js/modules/esnext.set.is-disjoint-from":["esnext.set.is-disjoint-from"],"core-js/modules/esnext.set.is-subset-of":["esnext.set.is-subset-of"],"core-js/modules/esnext.set.is-superset-of":["esnext.set.is-superset-of"],"core-js/modules/esnext.set.join":["esnext.set.join"],"core-js/modules/esnext.set.map":["esnext.set.map"],"core-js/modules/esnext.set.of":["esnext.set.of"],"core-js/modules/esnext.set.reduce":["esnext.set.reduce"],"core-js/modules/esnext.set.some":["esnext.set.some"],"core-js/modules/esnext.set.symmetric-difference":["esnext.set.symmetric-difference"],"core-js/modules/esnext.set.union":["esnext.set.union"],"core-js/modules/esnext.string.at":["esnext.string.at"],"core-js/modules/esnext.string.at-alternative":["esnext.string.at-alternative"],"core-js/modules/esnext.string.code-points":["esnext.string.code-points"],"core-js/modules/esnext.string.match-all":["esnext.string.match-all"],"core-js/modules/esnext.string.replace-all":["esnext.string.replace-all"],"core-js/modules/esnext.symbol.async-dispose":["esnext.symbol.async-dispose"],"core-js/modules/esnext.symbol.dispose":["esnext.symbol.dispose"],"core-js/modules/esnext.symbol.matcher":["esnext.symbol.matcher"],"core-js/modules/esnext.symbol.metadata":["esnext.symbol.metadata"],"core-js/modules/esnext.symbol.observable":["esnext.symbol.observable"],"core-js/modules/esnext.symbol.pattern-match":["esnext.symbol.pattern-match"],"core-js/modules/esnext.symbol.replace-all":["esnext.symbol.replace-all"],"core-js/modules/esnext.typed-array.at":["esnext.typed-array.at"],"core-js/modules/esnext.typed-array.filter-out":["esnext.typed-array.filter-out"],"core-js/modules/esnext.typed-array.find-last":["esnext.typed-array.find-last"],"core-js/modules/esnext.typed-array.find-last-index":["esnext.typed-array.find-last-index"],"core-js/modules/esnext.typed-array.unique-by":["esnext.typed-array.unique-by"],"core-js/modules/esnext.weak-map.delete-all":["esnext.weak-map.delete-all"],"core-js/modules/esnext.weak-map.emplace":["esnext.weak-map.emplace"],"core-js/modules/esnext.weak-map.from":["esnext.weak-map.from"],"core-js/modules/esnext.weak-map.of":["esnext.weak-map.of"],"core-js/modules/esnext.weak-map.upsert":["esnext.weak-map.upsert"],"core-js/modules/esnext.weak-set.add-all":["esnext.weak-set.add-all"],"core-js/modules/esnext.weak-set.delete-all":["esnext.weak-set.delete-all"],"core-js/modules/esnext.weak-set.from":["esnext.weak-set.from"],"core-js/modules/esnext.weak-set.of":["esnext.weak-set.of"],"core-js/modules/web.dom-collections.for-each":["web.dom-collections.for-each"],"core-js/modules/web.dom-collections.iterator":["web.dom-collections.iterator"],"core-js/modules/web.immediate":["web.immediate"],"core-js/modules/web.queue-microtask":["web.queue-microtask"],"core-js/modules/web.timers":["web.timers"],"core-js/modules/web.url":["web.url"],"core-js/modules/web.url-search-params":["web.url-search-params"],"core-js/modules/web.url.to-json":["web.url.to-json"],"core-js/proposals":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.url","web.url.to-json","web.url-search-params"],"core-js/proposals/accessible-object-hasownproperty":["esnext.object.has-own"],"core-js/proposals/array-filtering":["esnext.array.filter-out","esnext.typed-array.filter-out"],"core-js/proposals/array-find-from-last":["esnext.array.find-last","esnext.array.find-last-index","esnext.typed-array.find-last","esnext.typed-array.find-last-index"],"core-js/proposals/array-is-template-object":["esnext.array.is-template-object"],"core-js/proposals/array-last":["esnext.array.last-index","esnext.array.last-item"],"core-js/proposals/array-unique":["es.map","esnext.array.unique-by","esnext.typed-array.unique-by"],"core-js/proposals/collection-methods":["esnext.map.delete-all","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.set.add-all","esnext.set.delete-all","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.join","esnext.set.map","esnext.set.reduce","esnext.set.some","esnext.weak-map.delete-all","esnext.weak-set.add-all","esnext.weak-set.delete-all"],"core-js/proposals/collection-of-from":["esnext.map.from","esnext.map.of","esnext.set.from","esnext.set.of","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-set.from","esnext.weak-set.of"],"core-js/proposals/decorators":["esnext.symbol.metadata"],"core-js/proposals/efficient-64-bit-arithmetic":["esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.umulh"],"core-js/proposals/global-this":["esnext.global-this"],"core-js/proposals/iterator-helpers":["esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array"],"core-js/proposals/keys-composition":["esnext.composite-key","esnext.composite-symbol"],"core-js/proposals/map-update-or-insert":["esnext.map.emplace","esnext.map.update-or-insert","esnext.map.upsert","esnext.weak-map.emplace","esnext.weak-map.upsert"],"core-js/proposals/map-upsert":["esnext.map.emplace","esnext.map.update-or-insert","esnext.map.upsert","esnext.weak-map.emplace","esnext.weak-map.upsert"],"core-js/proposals/math-extensions":["esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale"],"core-js/proposals/math-signbit":["esnext.math.signbit"],"core-js/proposals/number-from-string":["esnext.number.from-string"],"core-js/proposals/number-range":["esnext.bigint.range","esnext.number.range"],"core-js/proposals/object-iteration":["esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values"],"core-js/proposals/observable":["esnext.observable","esnext.symbol.observable"],"core-js/proposals/pattern-matching":["esnext.symbol.matcher","esnext.symbol.pattern-match"],"core-js/proposals/promise-all-settled":["esnext.promise.all-settled"],"core-js/proposals/promise-any":["esnext.aggregate-error","esnext.promise.any"],"core-js/proposals/promise-try":["esnext.promise.try"],"core-js/proposals/reflect-metadata":["esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata"],"core-js/proposals/relative-indexing-method":["esnext.array.at","esnext.typed-array.at"],"core-js/proposals/seeded-random":["esnext.math.seeded-prng"],"core-js/proposals/set-methods":["esnext.set.difference","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.symmetric-difference","esnext.set.union"],"core-js/proposals/string-at":["esnext.string.at"],"core-js/proposals/string-code-points":["esnext.string.code-points"],"core-js/proposals/string-match-all":["esnext.string.match-all"],"core-js/proposals/string-replace-all":["esnext.string.replace-all","esnext.symbol.replace-all"],"core-js/proposals/url":["web.url","web.url.to-json","web.url-search-params"],"core-js/proposals/using-statement":["esnext.symbol.async-dispose","esnext.symbol.dispose"],"core-js/stable":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"core-js/stable/aggregate-error":["es.aggregate-error","es.string.iterator","esnext.aggregate-error","web.dom-collections.iterator"],"core-js/stable/array":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.string.iterator"],"core-js/stable/array-buffer":["es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.object.to-string"],"core-js/stable/array-buffer/constructor":["es.array-buffer.constructor","es.object.to-string"],"core-js/stable/array-buffer/is-view":["es.array-buffer.is-view"],"core-js/stable/array-buffer/slice":["es.array-buffer.slice"],"core-js/stable/array/concat":["es.array.concat"],"core-js/stable/array/copy-within":["es.array.copy-within"],"core-js/stable/array/entries":["es.array.iterator"],"core-js/stable/array/every":["es.array.every"],"core-js/stable/array/fill":["es.array.fill"],"core-js/stable/array/filter":["es.array.filter"],"core-js/stable/array/find":["es.array.find"],"core-js/stable/array/find-index":["es.array.find-index"],"core-js/stable/array/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/stable/array/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/stable/array/for-each":["es.array.for-each"],"core-js/stable/array/from":["es.array.from","es.string.iterator"],"core-js/stable/array/includes":["es.array.includes"],"core-js/stable/array/index-of":["es.array.index-of"],"core-js/stable/array/is-array":["es.array.is-array"],"core-js/stable/array/iterator":["es.array.iterator"],"core-js/stable/array/join":["es.array.join"],"core-js/stable/array/keys":["es.array.iterator"],"core-js/stable/array/last-index-of":["es.array.last-index-of"],"core-js/stable/array/map":["es.array.map"],"core-js/stable/array/of":["es.array.of"],"core-js/stable/array/reduce":["es.array.reduce"],"core-js/stable/array/reduce-right":["es.array.reduce-right"],"core-js/stable/array/reverse":["es.array.reverse"],"core-js/stable/array/slice":["es.array.slice"],"core-js/stable/array/some":["es.array.some"],"core-js/stable/array/sort":["es.array.sort"],"core-js/stable/array/splice":["es.array.splice"],"core-js/stable/array/values":["es.array.iterator"],"core-js/stable/array/virtual":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.includes","es.array.index-of","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map"],"core-js/stable/array/virtual/concat":["es.array.concat"],"core-js/stable/array/virtual/copy-within":["es.array.copy-within"],"core-js/stable/array/virtual/entries":["es.array.iterator"],"core-js/stable/array/virtual/every":["es.array.every"],"core-js/stable/array/virtual/fill":["es.array.fill"],"core-js/stable/array/virtual/filter":["es.array.filter"],"core-js/stable/array/virtual/find":["es.array.find"],"core-js/stable/array/virtual/find-index":["es.array.find-index"],"core-js/stable/array/virtual/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/stable/array/virtual/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/stable/array/virtual/for-each":["es.array.for-each"],"core-js/stable/array/virtual/includes":["es.array.includes"],"core-js/stable/array/virtual/index-of":["es.array.index-of"],"core-js/stable/array/virtual/iterator":["es.array.iterator"],"core-js/stable/array/virtual/join":["es.array.join"],"core-js/stable/array/virtual/keys":["es.array.iterator"],"core-js/stable/array/virtual/last-index-of":["es.array.last-index-of"],"core-js/stable/array/virtual/map":["es.array.map"],"core-js/stable/array/virtual/reduce":["es.array.reduce"],"core-js/stable/array/virtual/reduce-right":["es.array.reduce-right"],"core-js/stable/array/virtual/reverse":["es.array.reverse"],"core-js/stable/array/virtual/slice":["es.array.slice"],"core-js/stable/array/virtual/some":["es.array.some"],"core-js/stable/array/virtual/sort":["es.array.sort"],"core-js/stable/array/virtual/splice":["es.array.splice"],"core-js/stable/array/virtual/values":["es.array.iterator"],"core-js/stable/clear-immediate":["web.immediate"],"core-js/stable/data-view":["es.data-view","es.object.to-string"],"core-js/stable/date":["es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string"],"core-js/stable/date/now":["es.date.now"],"core-js/stable/date/to-iso-string":["es.date.to-iso-string","es.date.to-json"],"core-js/stable/date/to-json":["es.date.to-json"],"core-js/stable/date/to-primitive":["es.date.to-primitive"],"core-js/stable/date/to-string":["es.date.to-string"],"core-js/stable/dom-collections":["es.array.iterator","web.dom-collections.for-each","web.dom-collections.iterator"],"core-js/stable/dom-collections/for-each":["web.dom-collections.for-each"],"core-js/stable/dom-collections/iterator":["web.dom-collections.iterator"],"core-js/stable/function":["es.function.bind","es.function.has-instance","es.function.name"],"core-js/stable/function/bind":["es.function.bind"],"core-js/stable/function/has-instance":["es.function.has-instance"],"core-js/stable/function/name":["es.function.name"],"core-js/stable/function/virtual":["es.function.bind"],"core-js/stable/function/virtual/bind":["es.function.bind"],"core-js/stable/global-this":["es.global-this"],"core-js/stable/instance/bind":["es.function.bind"],"core-js/stable/instance/code-point-at":["es.string.code-point-at"],"core-js/stable/instance/concat":["es.array.concat"],"core-js/stable/instance/copy-within":["es.array.copy-within"],"core-js/stable/instance/ends-with":["es.string.ends-with"],"core-js/stable/instance/entries":["es.array.iterator","web.dom-collections.iterator"],"core-js/stable/instance/every":["es.array.every"],"core-js/stable/instance/fill":["es.array.fill"],"core-js/stable/instance/filter":["es.array.filter"],"core-js/stable/instance/find":["es.array.find"],"core-js/stable/instance/find-index":["es.array.find-index"],"core-js/stable/instance/flags":["es.regexp.flags"],"core-js/stable/instance/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/stable/instance/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/stable/instance/for-each":["es.array.for-each","web.dom-collections.iterator"],"core-js/stable/instance/includes":["es.array.includes","es.string.includes"],"core-js/stable/instance/index-of":["es.array.index-of"],"core-js/stable/instance/keys":["es.array.iterator","web.dom-collections.iterator"],"core-js/stable/instance/last-index-of":["es.array.last-index-of"],"core-js/stable/instance/map":["es.array.map"],"core-js/stable/instance/match-all":["es.string.match-all"],"core-js/stable/instance/pad-end":["es.string.pad-end"],"core-js/stable/instance/pad-start":["es.string.pad-start"],"core-js/stable/instance/reduce":["es.array.reduce"],"core-js/stable/instance/reduce-right":["es.array.reduce-right"],"core-js/stable/instance/repeat":["es.string.repeat"],"core-js/stable/instance/replace-all":["es.string.replace-all"],"core-js/stable/instance/reverse":["es.array.reverse"],"core-js/stable/instance/slice":["es.array.slice"],"core-js/stable/instance/some":["es.array.some"],"core-js/stable/instance/sort":["es.array.sort"],"core-js/stable/instance/splice":["es.array.splice"],"core-js/stable/instance/starts-with":["es.string.starts-with"],"core-js/stable/instance/trim":["es.string.trim"],"core-js/stable/instance/trim-end":["es.string.trim-end"],"core-js/stable/instance/trim-left":["es.string.trim-start"],"core-js/stable/instance/trim-right":["es.string.trim-end"],"core-js/stable/instance/trim-start":["es.string.trim-start"],"core-js/stable/instance/values":["es.array.iterator","web.dom-collections.iterator"],"core-js/stable/json":["es.json.stringify","es.json.to-string-tag"],"core-js/stable/json/stringify":["es.json.stringify"],"core-js/stable/json/to-string-tag":["es.json.to-string-tag"],"core-js/stable/map":["es.map","es.object.to-string","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/math":["es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc"],"core-js/stable/math/acosh":["es.math.acosh"],"core-js/stable/math/asinh":["es.math.asinh"],"core-js/stable/math/atanh":["es.math.atanh"],"core-js/stable/math/cbrt":["es.math.cbrt"],"core-js/stable/math/clz32":["es.math.clz32"],"core-js/stable/math/cosh":["es.math.cosh"],"core-js/stable/math/expm1":["es.math.expm1"],"core-js/stable/math/fround":["es.math.fround"],"core-js/stable/math/hypot":["es.math.hypot"],"core-js/stable/math/imul":["es.math.imul"],"core-js/stable/math/log10":["es.math.log10"],"core-js/stable/math/log1p":["es.math.log1p"],"core-js/stable/math/log2":["es.math.log2"],"core-js/stable/math/sign":["es.math.sign"],"core-js/stable/math/sinh":["es.math.sinh"],"core-js/stable/math/tanh":["es.math.tanh"],"core-js/stable/math/to-string-tag":["es.math.to-string-tag"],"core-js/stable/math/trunc":["es.math.trunc"],"core-js/stable/number":["es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision"],"core-js/stable/number/constructor":["es.number.constructor"],"core-js/stable/number/epsilon":["es.number.epsilon"],"core-js/stable/number/is-finite":["es.number.is-finite"],"core-js/stable/number/is-integer":["es.number.is-integer"],"core-js/stable/number/is-nan":["es.number.is-nan"],"core-js/stable/number/is-safe-integer":["es.number.is-safe-integer"],"core-js/stable/number/max-safe-integer":["es.number.max-safe-integer"],"core-js/stable/number/min-safe-integer":["es.number.min-safe-integer"],"core-js/stable/number/parse-float":["es.number.parse-float"],"core-js/stable/number/parse-int":["es.number.parse-int"],"core-js/stable/number/to-fixed":["es.number.to-fixed"],"core-js/stable/number/to-precision":["es.number.to-precision"],"core-js/stable/number/virtual":["es.number.to-fixed","es.number.to-precision"],"core-js/stable/number/virtual/to-fixed":["es.number.to-fixed"],"core-js/stable/number/virtual/to-precision":["es.number.to-precision"],"core-js/stable/object":["es.symbol","es.json.to-string-tag","es.math.to-string-tag","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.reflect.to-string-tag"],"core-js/stable/object/assign":["es.object.assign"],"core-js/stable/object/create":["es.object.create"],"core-js/stable/object/define-getter":["es.object.define-getter"],"core-js/stable/object/define-properties":["es.object.define-properties"],"core-js/stable/object/define-property":["es.object.define-property"],"core-js/stable/object/define-setter":["es.object.define-setter"],"core-js/stable/object/entries":["es.object.entries"],"core-js/stable/object/freeze":["es.object.freeze"],"core-js/stable/object/from-entries":["es.array.iterator","es.object.from-entries"],"core-js/stable/object/get-own-property-descriptor":["es.object.get-own-property-descriptor"],"core-js/stable/object/get-own-property-descriptors":["es.object.get-own-property-descriptors"],"core-js/stable/object/get-own-property-names":["es.object.get-own-property-names"],"core-js/stable/object/get-own-property-symbols":["es.symbol"],"core-js/stable/object/get-prototype-of":["es.object.get-prototype-of"],"core-js/stable/object/is":["es.object.is"],"core-js/stable/object/is-extensible":["es.object.is-extensible"],"core-js/stable/object/is-frozen":["es.object.is-frozen"],"core-js/stable/object/is-sealed":["es.object.is-sealed"],"core-js/stable/object/keys":["es.object.keys"],"core-js/stable/object/lookup-getter":["es.object.lookup-setter"],"core-js/stable/object/lookup-setter":["es.object.lookup-setter"],"core-js/stable/object/prevent-extensions":["es.object.prevent-extensions"],"core-js/stable/object/seal":["es.object.seal"],"core-js/stable/object/set-prototype-of":["es.object.set-prototype-of"],"core-js/stable/object/to-string":["es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/stable/object/values":["es.object.values"],"core-js/stable/parse-float":["es.parse-float"],"core-js/stable/parse-int":["es.parse-int"],"core-js/stable/promise":["es.aggregate-error","es.object.to-string","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/promise/all-settled":["es.promise","es.promise.all-settled","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/promise/any":["es.aggregate-error","es.promise","es.promise.any","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/promise/finally":["es.promise","es.promise.finally"],"core-js/stable/queue-microtask":["web.queue-microtask"],"core-js/stable/reflect":["es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag"],"core-js/stable/reflect/apply":["es.reflect.apply"],"core-js/stable/reflect/construct":["es.reflect.construct"],"core-js/stable/reflect/define-property":["es.reflect.define-property"],"core-js/stable/reflect/delete-property":["es.reflect.delete-property"],"core-js/stable/reflect/get":["es.reflect.get"],"core-js/stable/reflect/get-own-property-descriptor":["es.reflect.get-own-property-descriptor"],"core-js/stable/reflect/get-prototype-of":["es.reflect.get-prototype-of"],"core-js/stable/reflect/has":["es.reflect.has"],"core-js/stable/reflect/is-extensible":["es.reflect.is-extensible"],"core-js/stable/reflect/own-keys":["es.reflect.own-keys"],"core-js/stable/reflect/prevent-extensions":["es.reflect.prevent-extensions"],"core-js/stable/reflect/set":["es.reflect.set"],"core-js/stable/reflect/set-prototype-of":["es.reflect.set-prototype-of"],"core-js/stable/reflect/to-string-tag":["es.reflect.to-string-tag"],"core-js/stable/regexp":["es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.string.match","es.string.replace","es.string.search","es.string.split"],"core-js/stable/regexp/constructor":["es.regexp.constructor"],"core-js/stable/regexp/flags":["es.regexp.flags"],"core-js/stable/regexp/match":["es.string.match"],"core-js/stable/regexp/replace":["es.string.replace"],"core-js/stable/regexp/search":["es.string.search"],"core-js/stable/regexp/split":["es.string.split"],"core-js/stable/regexp/sticky":["es.regexp.sticky"],"core-js/stable/regexp/test":["es.regexp.exec","es.regexp.test"],"core-js/stable/regexp/to-string":["es.regexp.to-string"],"core-js/stable/set":["es.object.to-string","es.set","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/set-immediate":["web.immediate"],"core-js/stable/set-interval":["web.timers"],"core-js/stable/set-timeout":["web.timers"],"core-js/stable/string":["es.regexp.exec","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup"],"core-js/stable/string/anchor":["es.string.anchor"],"core-js/stable/string/big":["es.string.big"],"core-js/stable/string/blink":["es.string.blink"],"core-js/stable/string/bold":["es.string.bold"],"core-js/stable/string/code-point-at":["es.string.code-point-at"],"core-js/stable/string/ends-with":["es.string.ends-with"],"core-js/stable/string/fixed":["es.string.fixed"],"core-js/stable/string/fontcolor":["es.string.fontcolor"],"core-js/stable/string/fontsize":["es.string.fontsize"],"core-js/stable/string/from-code-point":["es.string.from-code-point"],"core-js/stable/string/includes":["es.string.includes"],"core-js/stable/string/italics":["es.string.italics"],"core-js/stable/string/iterator":["es.string.iterator"],"core-js/stable/string/link":["es.string.link"],"core-js/stable/string/match":["es.regexp.exec","es.string.match"],"core-js/stable/string/match-all":["es.string.match-all"],"core-js/stable/string/pad-end":["es.string.pad-end"],"core-js/stable/string/pad-start":["es.string.pad-start"],"core-js/stable/string/raw":["es.string.raw"],"core-js/stable/string/repeat":["es.string.repeat"],"core-js/stable/string/replace":["es.regexp.exec","es.string.replace"],"core-js/stable/string/replace-all":["es.string.replace-all"],"core-js/stable/string/search":["es.regexp.exec","es.string.search"],"core-js/stable/string/small":["es.string.small"],"core-js/stable/string/split":["es.regexp.exec","es.string.split"],"core-js/stable/string/starts-with":["es.string.starts-with"],"core-js/stable/string/strike":["es.string.strike"],"core-js/stable/string/sub":["es.string.sub"],"core-js/stable/string/sup":["es.string.sup"],"core-js/stable/string/trim":["es.string.trim"],"core-js/stable/string/trim-end":["es.string.trim-end"],"core-js/stable/string/trim-left":["es.string.trim-start"],"core-js/stable/string/trim-right":["es.string.trim-end"],"core-js/stable/string/trim-start":["es.string.trim-start"],"core-js/stable/string/virtual":["es.string.code-point-at","es.string.ends-with","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup"],"core-js/stable/string/virtual/anchor":["es.string.anchor"],"core-js/stable/string/virtual/big":["es.string.big"],"core-js/stable/string/virtual/blink":["es.string.blink"],"core-js/stable/string/virtual/bold":["es.string.bold"],"core-js/stable/string/virtual/code-point-at":["es.string.code-point-at"],"core-js/stable/string/virtual/ends-with":["es.string.ends-with"],"core-js/stable/string/virtual/fixed":["es.string.fixed"],"core-js/stable/string/virtual/fontcolor":["es.string.fontcolor"],"core-js/stable/string/virtual/fontsize":["es.string.fontsize"],"core-js/stable/string/virtual/includes":["es.string.includes"],"core-js/stable/string/virtual/italics":["es.string.italics"],"core-js/stable/string/virtual/iterator":["es.string.iterator"],"core-js/stable/string/virtual/link":["es.string.link"],"core-js/stable/string/virtual/match-all":["es.string.match-all"],"core-js/stable/string/virtual/pad-end":["es.string.pad-end"],"core-js/stable/string/virtual/pad-start":["es.string.pad-start"],"core-js/stable/string/virtual/repeat":["es.string.repeat"],"core-js/stable/string/virtual/replace-all":["es.string.replace-all"],"core-js/stable/string/virtual/small":["es.string.small"],"core-js/stable/string/virtual/starts-with":["es.string.starts-with"],"core-js/stable/string/virtual/strike":["es.string.strike"],"core-js/stable/string/virtual/sub":["es.string.sub"],"core-js/stable/string/virtual/sup":["es.string.sup"],"core-js/stable/string/virtual/trim":["es.string.trim"],"core-js/stable/string/virtual/trim-end":["es.string.trim-end"],"core-js/stable/string/virtual/trim-left":["es.string.trim-start"],"core-js/stable/string/virtual/trim-right":["es.string.trim-end"],"core-js/stable/string/virtual/trim-start":["es.string.trim-start"],"core-js/stable/symbol":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.array.concat","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/stable/symbol/async-iterator":["es.symbol.async-iterator"],"core-js/stable/symbol/description":["es.symbol.description"],"core-js/stable/symbol/for":["es.symbol"],"core-js/stable/symbol/has-instance":["es.symbol.has-instance","es.function.has-instance"],"core-js/stable/symbol/is-concat-spreadable":["es.symbol.is-concat-spreadable","es.array.concat"],"core-js/stable/symbol/iterator":["es.symbol.iterator","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/symbol/key-for":["es.symbol"],"core-js/stable/symbol/match":["es.symbol.match","es.string.match"],"core-js/stable/symbol/match-all":["es.symbol.match-all","es.string.match-all"],"core-js/stable/symbol/replace":["es.symbol.replace","es.string.replace"],"core-js/stable/symbol/search":["es.symbol.search","es.string.search"],"core-js/stable/symbol/species":["es.symbol.species"],"core-js/stable/symbol/split":["es.symbol.split","es.string.split"],"core-js/stable/symbol/to-primitive":["es.symbol.to-primitive"],"core-js/stable/symbol/to-string-tag":["es.symbol.to-string-tag","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/stable/symbol/unscopables":["es.symbol.unscopables"],"core-js/stable/typed-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/copy-within":["es.typed-array.copy-within"],"core-js/stable/typed-array/entries":["es.typed-array.iterator"],"core-js/stable/typed-array/every":["es.typed-array.every"],"core-js/stable/typed-array/fill":["es.typed-array.fill"],"core-js/stable/typed-array/filter":["es.typed-array.filter"],"core-js/stable/typed-array/find":["es.typed-array.find"],"core-js/stable/typed-array/find-index":["es.typed-array.find-index"],"core-js/stable/typed-array/float32-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/float64-array":["es.object.to-string","es.typed-array.float64-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/for-each":["es.typed-array.for-each"],"core-js/stable/typed-array/from":["es.typed-array.from"],"core-js/stable/typed-array/includes":["es.typed-array.includes"],"core-js/stable/typed-array/index-of":["es.typed-array.index-of"],"core-js/stable/typed-array/int16-array":["es.object.to-string","es.typed-array.int16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/int32-array":["es.object.to-string","es.typed-array.int32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/int8-array":["es.object.to-string","es.typed-array.int8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/iterator":["es.typed-array.iterator"],"core-js/stable/typed-array/join":["es.typed-array.join"],"core-js/stable/typed-array/keys":["es.typed-array.iterator"],"core-js/stable/typed-array/last-index-of":["es.typed-array.last-index-of"],"core-js/stable/typed-array/map":["es.typed-array.map"],"core-js/stable/typed-array/of":["es.typed-array.of"],"core-js/stable/typed-array/reduce":["es.typed-array.reduce"],"core-js/stable/typed-array/reduce-right":["es.typed-array.reduce-right"],"core-js/stable/typed-array/reverse":["es.typed-array.reverse"],"core-js/stable/typed-array/set":["es.typed-array.set"],"core-js/stable/typed-array/slice":["es.typed-array.slice"],"core-js/stable/typed-array/some":["es.typed-array.some"],"core-js/stable/typed-array/sort":["es.typed-array.sort"],"core-js/stable/typed-array/subarray":["es.typed-array.subarray"],"core-js/stable/typed-array/to-locale-string":["es.typed-array.to-locale-string"],"core-js/stable/typed-array/to-string":["es.typed-array.to-string"],"core-js/stable/typed-array/uint16-array":["es.object.to-string","es.typed-array.uint16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/uint32-array":["es.object.to-string","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/uint8-array":["es.object.to-string","es.typed-array.uint8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/uint8-clamped-array":["es.object.to-string","es.typed-array.uint8-clamped-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/values":["es.typed-array.iterator"],"core-js/stable/url":["web.url","web.url.to-json","web.url-search-params"],"core-js/stable/url-search-params":["web.url-search-params"],"core-js/stable/url/to-json":["web.url.to-json"],"core-js/stable/weak-map":["es.object.to-string","es.weak-map","web.dom-collections.iterator"],"core-js/stable/weak-set":["es.object.to-string","es.weak-set","web.dom-collections.iterator"],"core-js/stage":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.url","web.url.to-json","web.url-search-params"],"core-js/stage/0":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.url","web.url.to-json","web.url-search-params"],"core-js/stage/1":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of"],"core-js/stage/2":["esnext.aggregate-error","esnext.array.at","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.emplace","esnext.map.update-or-insert","esnext.map.upsert","esnext.object.has-own","esnext.promise.all-settled","esnext.promise.any","esnext.set.difference","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.symmetric-difference","esnext.set.union","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.metadata","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.weak-map.emplace","esnext.weak-map.upsert"],"core-js/stage/3":["esnext.aggregate-error","esnext.array.at","esnext.global-this","esnext.object.has-own","esnext.promise.all-settled","esnext.promise.any","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.replace-all","esnext.typed-array.at"],"core-js/stage/4":["esnext.aggregate-error","esnext.global-this","esnext.promise.all-settled","esnext.promise.any","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.replace-all"],"core-js/stage/pre":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.url","web.url.to-json","web.url-search-params"],"core-js/web":["web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"core-js/web/dom-collections":["web.dom-collections.for-each","web.dom-collections.iterator"],"core-js/web/immediate":["web.immediate"],"core-js/web/queue-microtask":["web.queue-microtask"],"core-js/web/timers":["web.timers"],"core-js/web/url":["web.url","web.url.to-json","web.url-search-params"],"core-js/web/url-search-params":["web.url-search-params"]}')},4970:e=>{"use strict";e.exports=JSON.parse('{"3.0":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","esnext.aggregate-error","esnext.array.last-index","esnext.array.last-item","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.map.delete-all","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.dispose","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"3.1":["es.string.match-all","es.symbol.match-all","esnext.symbol.replace-all"],"3.2":["es.promise.all-settled","esnext.array.is-template-object","esnext.map.update-or-insert","esnext.symbol.async-dispose"],"3.3":["es.global-this","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.upsert","esnext.weak-map.upsert"],"3.4":["es.json.stringify"],"3.5":["esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values"],"3.6":["es.regexp.sticky","es.regexp.test"],"3.7":["es.aggregate-error","es.promise.any","es.reflect.to-string-tag","es.string.replace-all","esnext.map.emplace","esnext.weak-map.emplace"],"3.8":["esnext.array.at","esnext.array.filter-out","esnext.array.unique-by","esnext.bigint.range","esnext.number.range","esnext.typed-array.at","esnext.typed-array.filter-out"],"3.9":["esnext.array.find-last","esnext.array.find-last-index","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by"],"3.11":["esnext.object.has-own"],"3.12":["esnext.symbol.matcher","esnext.symbol.metadata"]}')},2885:e=>{"use strict";e.exports=JSON.parse('["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"]')},6578:e=>{"use strict";e.exports=JSON.parse('{"es.symbol":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.symbol.description":{"android":"70","chrome":"70","deno":"1.0","edge":"74","electron":"5.0","firefox":"63","ios":"12.2","node":"11.0","opera":"57","opera_mobile":"49","safari":"12.1","samsung":"10.0"},"es.symbol.async-iterator":{"android":"63","chrome":"63","deno":"1.0","edge":"74","electron":"3.0","firefox":"55","ios":"12.0","node":"10.0","opera":"50","opera_mobile":"46","safari":"12.0","samsung":"8.0"},"es.symbol.has-instance":{"android":"50","chrome":"50","deno":"1.0","edge":"15","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.is-concat-spreadable":{"android":"48","chrome":"48","deno":"1.0","edge":"15","electron":"0.37","firefox":"48","ios":"10.0","node":"6.0","opera":"35","opera_mobile":"35","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.iterator":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"36","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.symbol.match":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"40","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.match-all":{"android":"73","chrome":"73","deno":"1.0","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.symbol.replace":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.search":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.species":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"41","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.split":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.to-primitive":{"android":"47","chrome":"47","deno":"1.0","edge":"15","electron":"0.36","firefox":"44","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.to-string-tag":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.unscopables":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"48","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.aggregate-error":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"es.array.concat":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.copy-within":{"android":"45","chrome":"45","deno":"1.0","edge":"12","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.every":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.array.fill":{"android":"45","chrome":"45","deno":"1.0","edge":"12","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.filter":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.find":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.find-index":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.flat":{"android":"69","chrome":"69","deno":"1.0","edge":"74","electron":"4.0","firefox":"62","ios":"12.0","node":"11.0","opera":"56","opera_mobile":"48","safari":"12.0","samsung":"10.0"},"es.array.flat-map":{"android":"69","chrome":"69","deno":"1.0","edge":"74","electron":"4.0","firefox":"62","ios":"12.0","node":"11.0","opera":"56","opera_mobile":"48","safari":"12.0","samsung":"10.0"},"es.array.for-each":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.array.from":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"9.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"9.0","samsung":"5.0"},"es.array.includes":{"android":"53","chrome":"53","deno":"1.0","edge":"14","electron":"1.4","firefox":"48","ios":"10.0","node":"7.0","opera":"40","opera_mobile":"40","safari":"10.0","samsung":"6.0"},"es.array.index-of":{"android":"51","chrome":"51","deno":"1.0","edge":"12","electron":"1.2","firefox":"4","ie":"9","ios":"8.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"7.1","samsung":"5.0"},"es.array.is-array":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"4.0","samsung":"1.0"},"es.array.iterator":{"android":"66","chrome":"66","deno":"1.0","edge":"15","electron":"3.0","firefox":"60","ios":"10.0","node":"10.0","opera":"53","opera_mobile":"47","safari":"10.0","samsung":"9.0"},"es.array.join":{"android":"4.4","chrome":"26","deno":"1.0","edge":"13","electron":"0.20","firefox":"4","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.array.last-index-of":{"android":"51","chrome":"51","deno":"1.0","edge":"12","electron":"1.2","firefox":"4","ie":"9","ios":"8.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"7.1","samsung":"5.0"},"es.array.map":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"50","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.of":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"25","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","rhino":"1.7.13","safari":"9.0","samsung":"5.0"},"es.array.reduce":{"android":"83","chrome":"83","deno":"1.0","edge":"12","electron":"9.0","firefox":"4","ie":"9","ios":"8.0","node":"6.0","opera":"69","opera_mobile":"59","rhino":"1.7.13","safari":"7.1","samsung":"13.0"},"es.array.reduce-right":{"android":"83","chrome":"83","deno":"1.0","edge":"12","electron":"9.0","firefox":"4","ie":"9","ios":"8.0","node":"6.0","opera":"69","opera_mobile":"59","rhino":"1.7.13","safari":"7.1","samsung":"13.0"},"es.array.reverse":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"5.5","ios":"12.2","node":"0.0.3","opera":"10.50","opera_mobile":"10.50","rhino":"1.7.13","safari":"12.0.2","samsung":"1.0"},"es.array.slice":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.some":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.array.sort":{"android":"70","chrome":"70","deno":"1.0","edge":"74","electron":"5.0","firefox":"4","ios":"12.0","node":"11.0","opera":"57","opera_mobile":"49","safari":"12.0","samsung":"10.0"},"es.array.species":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.splice":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.unscopables.flat":{"android":"73","chrome":"73","deno":"1.0","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.array.unscopables.flat-map":{"android":"73","chrome":"73","deno":"1.0","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.array-buffer.constructor":{"android":"4.4","chrome":"26","deno":"1.0","edge":"14","electron":"0.20","firefox":"44","ios":"12.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"12.0","samsung":"1.5"},"es.array-buffer.is-view":{"android":"4.4.3","chrome":"32","deno":"1.0","edge":"12","electron":"0.20","firefox":"29","ie":"11","ios":"8.0","node":"0.11.9","opera":"19","opera_mobile":"19","safari":"7.1","samsung":"2.0"},"es.array-buffer.slice":{"android":"4.4.3","chrome":"31","deno":"1.0","edge":"12","electron":"0.20","firefox":"46","ie":"11","ios":"12.2","node":"0.11.8","opera":"18","opera_mobile":"18","rhino":"1.7.13","safari":"12.1","samsung":"2.0"},"es.data-view":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"15","ie":"10","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.date.get-year":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"9","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.date.now":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ie":"9","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"4.0","samsung":"1.0"},"es.date.set-year":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"3","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.date.to-gmt-string":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"3","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.date.to-iso-string":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"7","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.date.to-json":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"10.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"10.0","samsung":"1.5"},"es.date.to-primitive":{"android":"47","chrome":"47","deno":"1.0","edge":"15","electron":"0.36","firefox":"44","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.date.to-string":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ie":"9","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.escape":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"3","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.function.bind":{"android":"3.0","chrome":"7","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.101","opera":"12","opera_mobile":"12","phantom":"2.0","rhino":"1.7.13","safari":"5.1","samsung":"1.0"},"es.function.has-instance":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"50","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.function.name":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"4.0","samsung":"1.0"},"es.global-this":{"android":"71","chrome":"71","deno":"1.0","edge":"74","electron":"5.0","firefox":"65","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"es.json.stringify":{"android":"72","chrome":"72","deno":"1.0","edge":"74","electron":"5.0","firefox":"64","ios":"12.2","node":"12.0","opera":"59","opera_mobile":"51","safari":"12.1","samsung":"11.0"},"es.json.to-string-tag":{"android":"50","chrome":"50","deno":"1.0","edge":"15","electron":"1.1","firefox":"51","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.map":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.math.acosh":{"android":"54","chrome":"54","deno":"1.0","edge":"13","electron":"1.4","firefox":"25","ios":"8.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"7.1","samsung":"6.0"},"es.math.asinh":{"android":"38","chrome":"38","deno":"1.0","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.atanh":{"android":"38","chrome":"38","deno":"1.0","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.cbrt":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.clz32":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"9.0","samsung":"3.0"},"es.math.cosh":{"android":"39","chrome":"39","deno":"1.0","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","rhino":"1.7.13","safari":"7.1","samsung":"3.4"},"es.math.expm1":{"android":"39","chrome":"39","deno":"1.0","edge":"13","electron":"0.20","firefox":"46","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","rhino":"1.7.13","safari":"7.1","samsung":"3.4"},"es.math.fround":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"26","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.hypot":{"android":"78","chrome":"78","deno":"1.0","edge":"12","electron":"7.0","firefox":"27","ios":"8.0","node":"13.0","opera":"65","opera_mobile":"56","rhino":"1.7.13","safari":"7.1","samsung":"12.0"},"es.math.imul":{"android":"4.4","chrome":"28","deno":"1.0","edge":"13","electron":"0.20","firefox":"20","ios":"9.0","node":"0.11.1","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"9.0","samsung":"1.5"},"es.math.log10":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.log1p":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.log2":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.sign":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"9.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"9.0","samsung":"3.0"},"es.math.sinh":{"android":"39","chrome":"39","deno":"1.0","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","rhino":"1.7.13","safari":"7.1","samsung":"3.4"},"es.math.tanh":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.to-string-tag":{"android":"50","chrome":"50","deno":"1.0","edge":"15","electron":"1.1","firefox":"51","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.math.trunc":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.number.constructor":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"46","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.number.epsilon":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.is-finite":{"android":"4.1","chrome":"19","deno":"1.0","edge":"12","electron":"0.20","firefox":"16","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","rhino":"1.7.13","safari":"9.0","samsung":"1.5"},"es.number.is-integer":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"16","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.number.is-nan":{"android":"4.1","chrome":"19","deno":"1.0","edge":"12","electron":"0.20","firefox":"15","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","rhino":"1.7.13","safari":"9.0","samsung":"1.5"},"es.number.is-safe-integer":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"32","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.number.max-safe-integer":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.number.min-safe-integer":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.number.parse-float":{"android":"37","chrome":"35","deno":"1.0","edge":"13","electron":"0.20","firefox":"39","ios":"11.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"11.0","samsung":"3.0"},"es.number.parse-int":{"android":"37","chrome":"35","deno":"1.0","edge":"13","electron":"0.20","firefox":"39","ios":"9.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"9.0","samsung":"3.0"},"es.number.to-fixed":{"android":"4.4","chrome":"26","deno":"1.0","edge":"74","electron":"0.20","firefox":"4","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.number.to-precision":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"8","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.object.assign":{"android":"49","chrome":"49","deno":"1.0","edge":"74","electron":"0.37","firefox":"36","ios":"9.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"9.0","samsung":"5.0"},"es.object.create":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"3.2","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"1.9","rhino":"1.7.13","safari":"4.0","samsung":"1.0"},"es.object.define-getter":{"android":"62","chrome":"62","deno":"1.0","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","rhino":"1.7.13","safari":"7.1","samsung":"8.0"},"es.object.define-properties":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"2.0","rhino":"1.7.13","safari":"5.1","samsung":"1.0"},"es.object.define-property":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"2.0","rhino":"1.7.13","safari":"5.1","samsung":"1.0"},"es.object.define-setter":{"android":"62","chrome":"62","deno":"1.0","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","rhino":"1.7.13","safari":"7.1","samsung":"8.0"},"es.object.entries":{"android":"54","chrome":"54","deno":"1.0","edge":"14","electron":"1.4","firefox":"47","ios":"10.3","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.1","samsung":"6.0"},"es.object.freeze":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.from-entries":{"android":"73","chrome":"73","deno":"1.0","edge":"74","electron":"5.0","firefox":"63","ios":"12.2","node":"12.0","opera":"60","opera_mobile":"52","safari":"12.1","samsung":"11.0"},"es.object.get-own-property-descriptor":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.get-own-property-descriptors":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"50","ios":"10.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.0","samsung":"6.0"},"es.object.get-own-property-names":{"android":"40","chrome":"40","deno":"1.0","edge":"13","electron":"0.21","firefox":"34","ios":"9.0","node":"1.0","opera":"27","opera_mobile":"27","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.object.get-prototype-of":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.is":{"android":"4.1","chrome":"19","deno":"1.0","edge":"12","electron":"0.20","firefox":"22","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","rhino":"1.7.13","safari":"9.0","samsung":"1.5"},"es.object.is-extensible":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.is-frozen":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.is-sealed":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.keys":{"android":"40","chrome":"40","deno":"1.0","edge":"13","electron":"0.21","firefox":"35","ios":"9.0","node":"1.0","opera":"27","opera_mobile":"27","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.object.lookup-getter":{"android":"62","chrome":"62","deno":"1.0","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","rhino":"1.7.13","safari":"7.1","samsung":"8.0"},"es.object.lookup-setter":{"android":"62","chrome":"62","deno":"1.0","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","rhino":"1.7.13","safari":"7.1","samsung":"8.0"},"es.object.prevent-extensions":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.seal":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.set-prototype-of":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"31","ie":"11","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.object.to-string":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.object.values":{"android":"54","chrome":"54","deno":"1.0","edge":"14","electron":"1.4","firefox":"47","ios":"10.3","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.1","samsung":"6.0"},"es.parse-float":{"android":"37","chrome":"35","deno":"1.0","edge":"12","electron":"0.20","firefox":"8","ie":"8","ios":"8.0","node":"0.11.13","opera":"22","opera_mobile":"22","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.parse-int":{"android":"37","chrome":"35","deno":"1.0","edge":"12","electron":"0.20","firefox":"21","ie":"9","ios":"8.0","node":"0.11.13","opera":"22","opera_mobile":"22","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.promise":{"android":"67","chrome":"67","deno":"1.0","edge":"74","electron":"4.0","firefox":"69","ios":"11.0","node":"10.4","opera":"54","opera_mobile":"48","safari":"11.0","samsung":"9.0"},"es.promise.all-settled":{"android":"76","chrome":"76","deno":"1.0","edge":"76","electron":"6.0","firefox":"71","ios":"13.0","node":"12.9","opera":"63","opera_mobile":"54","safari":"13","samsung":"12.0"},"es.promise.any":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"es.promise.finally":{"android":"67","chrome":"67","deno":"1.0","edge":"74","electron":"4.0","firefox":"69","ios":"13.2.3","node":"10.4","opera":"54","opera_mobile":"48","safari":"13.0.3","samsung":"9.0"},"es.reflect.apply":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.construct":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"44","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.define-property":{"android":"49","chrome":"49","deno":"1.0","edge":"13","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.delete-property":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get-own-property-descriptor":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get-prototype-of":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.has":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.is-extensible":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.own-keys":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.prevent-extensions":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.set":{"android":"49","chrome":"49","deno":"1.0","edge":"74","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.set-prototype-of":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.to-string-tag":{"android":"86","chrome":"86","deno":"1.3","edge":"86","electron":"11.0","firefox":"82","ios":"14.0","node":"15.0","opera":"72","opera_mobile":"61","safari":"14.0","samsung":"14.0"},"es.regexp.constructor":{"android":"64","chrome":"64","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"11.3","node":"10.0","opera":"51","opera_mobile":"47","safari":"11.1","samsung":"9.0"},"es.regexp.dot-all":{"android":"62","chrome":"62","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"11.3","node":"8.10","opera":"49","opera_mobile":"46","safari":"11.1","samsung":"8.0"},"es.regexp.exec":{"android":"64","chrome":"64","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"11.3","node":"10.0","opera":"51","opera_mobile":"47","safari":"11.1","samsung":"9.0"},"es.regexp.flags":{"android":"62","chrome":"62","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"11.3","node":"8.10","opera":"49","opera_mobile":"46","safari":"11.1","samsung":"8.0"},"es.regexp.sticky":{"android":"49","chrome":"49","deno":"1.0","edge":"13","electron":"0.37","firefox":"3","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.regexp.test":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"46","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.regexp.to-string":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"46","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.set":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.string.code-point-at":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"29","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.string.ends-with":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.from-code-point":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"29","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.string.includes":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.iterator":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"36","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.string.match":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.match-all":{"android":"80","chrome":"80","deno":"1.0","edge":"80","electron":"8.0","firefox":"73","ios":"13.4","node":"14.0","opera":"67","opera_mobile":"57","safari":"13.1","samsung":"13.0"},"es.string.pad-end":{"android":"57","chrome":"57","deno":"1.0","edge":"15","electron":"1.7","firefox":"48","ios":"11.0","node":"8.0","opera":"44","opera_mobile":"43","rhino":"1.7.13","safari":"11.0","samsung":"7.0"},"es.string.pad-start":{"android":"57","chrome":"57","deno":"1.0","edge":"15","electron":"1.7","firefox":"48","ios":"11.0","node":"8.0","opera":"44","opera_mobile":"43","rhino":"1.7.13","safari":"11.0","samsung":"7.0"},"es.string.raw":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"34","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.repeat":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"24","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.string.replace":{"android":"64","chrome":"64","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"14.0","node":"10.0","opera":"51","opera_mobile":"47","safari":"14.0","samsung":"9.0"},"es.string.replace-all":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"77","ios":"13.4","node":"15.0","opera":"71","opera_mobile":"60","safari":"13.1","samsung":"14.0"},"es.string.search":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.split":{"android":"54","chrome":"54","deno":"1.0","edge":"74","electron":"1.4","firefox":"49","ios":"10.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.0","samsung":"6.0"},"es.string.starts-with":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.substr":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"4","ios":"1.0","node":"0.0.3","opera":"4","opera_mobile":"4","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.string.trim":{"android":"59","chrome":"59","deno":"1.0","edge":"15","electron":"1.8","firefox":"52","ios":"12.2","node":"8.3","opera":"46","opera_mobile":"43","rhino":"1.7.13","safari":"12.1","samsung":"7.0"},"es.string.trim-end":{"android":"66","chrome":"66","deno":"1.0","edge":"74","electron":"3.0","firefox":"61","ios":"12.2","node":"10.0","opera":"53","opera_mobile":"47","safari":"12.1","samsung":"9.0"},"es.string.trim-start":{"android":"66","chrome":"66","deno":"1.0","edge":"74","electron":"3.0","firefox":"61","ios":"12.0","node":"10.0","opera":"53","opera_mobile":"47","safari":"12.0","samsung":"9.0"},"es.string.anchor":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.big":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.blink":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.bold":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.fixed":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.fontcolor":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.fontsize":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.italics":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.link":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.small":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.strike":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.sub":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.sup":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.typed-array.float32-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.float64-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int8-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int16-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int32-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint8-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint8-clamped-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint16-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint32-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.copy-within":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"34","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.every":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.fill":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.filter":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.find":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.find-index":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.for-each":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.from":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.includes":{"android":"49","chrome":"49","deno":"1.0","edge":"14","electron":"0.37","firefox":"43","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.typed-array.index-of":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.iterator":{"android":"47","chrome":"47","deno":"1.0","edge":"13","electron":"0.36","firefox":"37","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.typed-array.join":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.last-index-of":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.map":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.of":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.reduce":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.reduce-right":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.reverse":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.set":{"android":"4.4","chrome":"26","deno":"1.0","edge":"13","electron":"0.20","firefox":"15","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.typed-array.slice":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.some":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.sort":{"android":"74","chrome":"74","deno":"1.0","edge":"74","electron":"6.0","firefox":"67","ios":"14.5","node":"12.0","opera":"61","opera_mobile":"53","safari":"14.1","samsung":"11.0"},"es.typed-array.subarray":{"android":"4.4","chrome":"26","deno":"1.0","edge":"13","electron":"0.20","firefox":"15","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.typed-array.to-locale-string":{"android":"45","chrome":"45","deno":"1.0","edge":"74","electron":"0.31","firefox":"51","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.to-string":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"51","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.unescape":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"3","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.weak-map":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.weak-set":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"esnext.aggregate-error":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"esnext.array.at":{"android":"92","chrome":"92","deno":"1.12","edge":"92","electron":"14.0","firefox":"90","node":"16.6","opera":"78"},"esnext.array.filter-out":{},"esnext.array.filter-reject":{},"esnext.array.find-last":{},"esnext.array.find-last-index":{},"esnext.array.group-by":{},"esnext.array.is-template-object":{},"esnext.array.last-index":{},"esnext.array.last-item":{},"esnext.array.unique-by":{},"esnext.async-iterator.constructor":{},"esnext.async-iterator.as-indexed-pairs":{},"esnext.async-iterator.drop":{},"esnext.async-iterator.every":{},"esnext.async-iterator.filter":{},"esnext.async-iterator.find":{},"esnext.async-iterator.flat-map":{},"esnext.async-iterator.for-each":{},"esnext.async-iterator.from":{},"esnext.async-iterator.map":{},"esnext.async-iterator.reduce":{},"esnext.async-iterator.some":{},"esnext.async-iterator.take":{},"esnext.async-iterator.to-array":{},"esnext.bigint.range":{},"esnext.composite-key":{},"esnext.composite-symbol":{},"esnext.global-this":{"android":"71","chrome":"71","deno":"1.0","edge":"74","electron":"5.0","firefox":"65","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"esnext.iterator.constructor":{},"esnext.iterator.as-indexed-pairs":{},"esnext.iterator.drop":{},"esnext.iterator.every":{},"esnext.iterator.filter":{},"esnext.iterator.find":{},"esnext.iterator.flat-map":{},"esnext.iterator.for-each":{},"esnext.iterator.from":{},"esnext.iterator.map":{},"esnext.iterator.reduce":{},"esnext.iterator.some":{},"esnext.iterator.take":{},"esnext.iterator.to-array":{},"esnext.map.delete-all":{},"esnext.map.emplace":{},"esnext.map.every":{},"esnext.map.filter":{},"esnext.map.find":{},"esnext.map.find-key":{},"esnext.map.from":{},"esnext.map.group-by":{},"esnext.map.includes":{},"esnext.map.key-by":{},"esnext.map.key-of":{},"esnext.map.map-keys":{},"esnext.map.map-values":{},"esnext.map.merge":{},"esnext.map.of":{},"esnext.map.reduce":{},"esnext.map.some":{},"esnext.map.update":{},"esnext.map.update-or-insert":{},"esnext.map.upsert":{},"esnext.math.clamp":{},"esnext.math.deg-per-rad":{},"esnext.math.degrees":{},"esnext.math.fscale":{},"esnext.math.iaddh":{},"esnext.math.imulh":{},"esnext.math.isubh":{},"esnext.math.rad-per-deg":{},"esnext.math.radians":{},"esnext.math.scale":{},"esnext.math.seeded-prng":{},"esnext.math.signbit":{},"esnext.math.umulh":{},"esnext.number.from-string":{},"esnext.number.range":{},"esnext.object.has-own":{"android":"93","chrome":"93","deno":"1.13","edge":"93","electron":"14.0","firefox":"92","opera":"79"},"esnext.object.iterate-entries":{},"esnext.object.iterate-keys":{},"esnext.object.iterate-values":{},"esnext.observable":{},"esnext.promise.all-settled":{"android":"76","chrome":"76","deno":"1.0","edge":"76","electron":"6.0","firefox":"71","ios":"13.0","node":"12.9","opera":"63","opera_mobile":"54","safari":"13","samsung":"12.0"},"esnext.promise.any":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"esnext.promise.try":{},"esnext.reflect.define-metadata":{},"esnext.reflect.delete-metadata":{},"esnext.reflect.get-metadata":{},"esnext.reflect.get-metadata-keys":{},"esnext.reflect.get-own-metadata":{},"esnext.reflect.get-own-metadata-keys":{},"esnext.reflect.has-metadata":{},"esnext.reflect.has-own-metadata":{},"esnext.reflect.metadata":{},"esnext.set.add-all":{},"esnext.set.delete-all":{},"esnext.set.difference":{},"esnext.set.every":{},"esnext.set.filter":{},"esnext.set.find":{},"esnext.set.from":{},"esnext.set.intersection":{},"esnext.set.is-disjoint-from":{},"esnext.set.is-subset-of":{},"esnext.set.is-superset-of":{},"esnext.set.join":{},"esnext.set.map":{},"esnext.set.of":{},"esnext.set.reduce":{},"esnext.set.some":{},"esnext.set.symmetric-difference":{},"esnext.set.union":{},"esnext.string.at":{},"esnext.string.code-points":{},"esnext.string.match-all":{"android":"80","chrome":"80","deno":"1.0","edge":"80","electron":"8.0","firefox":"73","ios":"13.4","node":"14.0","opera":"67","opera_mobile":"57","safari":"13.1","samsung":"13.0"},"esnext.string.replace-all":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"77","ios":"13.4","node":"15.0","opera":"71","opera_mobile":"60","safari":"13.1","samsung":"14.0"},"esnext.symbol.async-dispose":{},"esnext.symbol.dispose":{},"esnext.symbol.matcher":{},"esnext.symbol.metadata":{},"esnext.symbol.observable":{},"esnext.symbol.pattern-match":{},"esnext.symbol.replace-all":{},"esnext.typed-array.at":{"android":"92","chrome":"92","deno":"1.12","edge":"92","electron":"14.0","firefox":"90","node":"16.6","opera":"78"},"esnext.typed-array.filter-out":{},"esnext.typed-array.filter-reject":{},"esnext.typed-array.find-last":{},"esnext.typed-array.find-last-index":{},"esnext.typed-array.group-by":{},"esnext.typed-array.unique-by":{},"esnext.weak-map.delete-all":{},"esnext.weak-map.from":{},"esnext.weak-map.of":{},"esnext.weak-map.emplace":{},"esnext.weak-map.upsert":{},"esnext.weak-set.add-all":{},"esnext.weak-set.delete-all":{},"esnext.weak-set.from":{},"esnext.weak-set.of":{},"web.dom-collections.for-each":{"android":"58","chrome":"58","deno":"1.0","edge":"16","electron":"1.7","firefox":"50","ios":"10.0","node":"0.0.1","opera":"45","opera_mobile":"43","rhino":"1.7.13","safari":"10.0","samsung":"7.0"},"web.dom-collections.iterator":{"android":"66","chrome":"66","deno":"1.0","edge":"74","electron":"3.0","firefox":"60","ios":"13.4","node":"0.0.1","opera":"53","opera_mobile":"47","rhino":"1.7.13","safari":"13.1","samsung":"9.0"},"web.immediate":{"ie":"10","node":"0.9.1"},"web.queue-microtask":{"android":"71","chrome":"71","deno":"1.0","edge":"74","electron":"5.0","firefox":"69","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"web.timers":{"android":"1.5","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"10","ios":"1.0","node":"0.0.1","opera":"7","opera_mobile":"7","phantom":"1.9","rhino":"1.7.13","safari":"1.0","samsung":"1.0"},"web.url":{"android":"67","chrome":"67","deno":"1.0","edge":"74","electron":"4.0","firefox":"57","ios":"14.0","node":"10.0","opera":"54","opera_mobile":"48","safari":"14.0","samsung":"9.0"},"web.url.to-json":{"android":"71","chrome":"71","deno":"1.0","edge":"74","electron":"5.0","firefox":"57","ios":"14.0","node":"10.0","opera":"58","opera_mobile":"50","safari":"14.0","samsung":"10.0"},"web.url-search-params":{"android":"67","chrome":"67","deno":"1.0","edge":"74","electron":"4.0","firefox":"57","ios":"14.0","node":"10.0","opera":"54","opera_mobile":"48","safari":"14.0","samsung":"9.0"}}')},4503:e=>{"use strict";e.exports=JSON.parse('{"assert":true,"assert/strict":">= 15","async_hooks":">= 8","buffer_ieee754":"< 0.9.7","buffer":true,"child_process":true,"cluster":true,"console":true,"constants":true,"crypto":true,"_debug_agent":">= 1 && < 8","_debugger":"< 8","dgram":true,"diagnostics_channel":">= 15.1","dns":true,"dns/promises":">= 15","domain":">= 0.7.12","events":true,"freelist":"< 6","fs":true,"fs/promises":[">= 10 && < 10.1",">= 14"],"_http_agent":">= 0.11.1","_http_client":">= 0.11.1","_http_common":">= 0.11.1","_http_incoming":">= 0.11.1","_http_outgoing":">= 0.11.1","_http_server":">= 0.11.1","http":true,"http2":">= 8.8","https":true,"inspector":">= 8.0.0","_linklist":"< 8","module":true,"net":true,"node-inspect/lib/_inspect":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6.0 && < 12","os":true,"path":true,"path/posix":">= 15.3","path/win32":">= 15.3","perf_hooks":">= 8.5","process":">= 1","punycode":true,"querystring":true,"readline":true,"repl":true,"smalloc":">= 0.11.5 && < 3","_stream_duplex":">= 0.9.4","_stream_transform":">= 0.9.4","_stream_wrap":">= 1.4.1","_stream_passthrough":">= 0.9.4","_stream_readable":">= 0.9.4","_stream_writable":">= 0.9.4","stream":true,"stream/promises":">= 15","string_decoder":true,"sys":[">= 0.6 && < 0.7",">= 0.8"],"timers":true,"timers/promises":">= 15","_tls_common":">= 0.11.13","_tls_legacy":">= 0.11.3 && < 10","_tls_wrap":">= 0.11.3","tls":true,"trace_events":">= 10","tty":true,"url":true,"util":true,"util/types":">= 15.3","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/consarray":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/csvparser":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/logreader":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/profile_view":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/splaytree":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8":">= 1","vm":true,"wasi":">= 13.4 && < 13.5","worker_threads":">= 11.7","zlib":true}')}};var t={};function __nccwpck_require__(r){var s=t[r];if(s!==undefined){return s.exports}var a=t[r]={id:r,loaded:false,exports:{}};var n=true;try{e[r].call(a.exports,a,a.exports,__nccwpck_require__);n=false}finally{if(n)delete t[r]}a.loaded=true;return a.exports}(()=>{__nccwpck_require__.nmd=e=>{e.paths=[];if(!e.children)e.children=[];return e}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(3812);module.exports=r})(); \ No newline at end of file diff --git a/packages/next/compiled/webpack/bundle5.js b/packages/next/compiled/webpack/bundle5.js index fd1d6d65a405ddf..1480da205100d7b 100644 --- a/packages/next/compiled/webpack/bundle5.js +++ b/packages/next/compiled/webpack/bundle5.js @@ -10139,17434 +10139,13902 @@ var __classPrivateFieldSet; /***/ }), -/***/ 70665: +/***/ 42752: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* - Copyright (C) 2015 Yusuke Suzuki - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const Variable = __webpack_require__(82971); - -/** - * @class Definition - */ -class Definition { - constructor(type, name, node, parent, index, kind) { - - /** - * @member {String} Definition#type - type of the occurrence (e.g. "Parameter", "Variable", ...). - */ - this.type = type; - - /** - * @member {espree.Identifier} Definition#name - the identifier AST node of the occurrence. - */ - this.name = name; - - /** - * @member {espree.Node} Definition#node - the enclosing node of the identifier. - */ - this.node = node; - - /** - * @member {espree.Node?} Definition#parent - the enclosing statement node of the identifier. - */ - this.parent = parent; - /** - * @member {Number?} Definition#index - the index in the declaration statement. - */ - this.index = index; +const DescriptionFileUtils = __webpack_require__(702); +const getInnerRequest = __webpack_require__(50290); - /** - * @member {String?} Definition#kind - the kind of the declaration statement. - */ - this.kind = kind; - } -} +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -/** - * @class ParameterDefinition - */ -class ParameterDefinition extends Definition { - constructor(name, node, index, rest) { - super(Variable.Parameter, name, node, null, index, null); +module.exports = class AliasFieldPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string | Array} field field + * @param {string | ResolveStepHook} target target + */ + constructor(source, field, target) { + this.source = source; + this.field = field; + this.target = target; + } - /** - * Whether the parameter definition is a part of a rest parameter. - * @member {boolean} ParameterDefinition#rest - */ - this.rest = rest; - } -} + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("AliasFieldPlugin", (request, resolveContext, callback) => { + if (!request.descriptionFileData) return callback(); + const innerRequest = getInnerRequest(resolver, request); + if (!innerRequest) return callback(); + const fieldData = DescriptionFileUtils.getField( + request.descriptionFileData, + this.field + ); + if (fieldData === null || typeof fieldData !== "object") { + if (resolveContext.log) + resolveContext.log( + "Field '" + + this.field + + "' doesn't contain a valid alias configuration" + ); + return callback(); + } + const data1 = fieldData[innerRequest]; + const data2 = fieldData[innerRequest.replace(/^\.\//, "")]; + const data = typeof data1 !== "undefined" ? data1 : data2; + if (data === innerRequest) return callback(); + if (data === undefined) return callback(); + if (data === false) { + /** @type {ResolveRequest} */ + const ignoreObj = { + ...request, + path: false + }; + return callback(null, ignoreObj); + } + const obj = { + ...request, + path: request.descriptionFileRoot, + request: data, + fullySpecified: false + }; + resolver.doResolve( + target, + obj, + "aliased from description file " + + request.descriptionFilePath + + " with mapping '" + + innerRequest + + "' to '" + + data + + "'", + resolveContext, + (err, result) => { + if (err) return callback(err); -module.exports = { - ParameterDefinition, - Definition + // Don't allow other aliasing or raw request + if (result === undefined) return callback(null, null); + callback(null, result); + } + ); + }); + } }; -/* vim: set sw=4 ts=4 et tw=80 : */ - /***/ }), -/***/ 36007: +/***/ 51547: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* - Copyright (C) 2012-2014 Yusuke Suzuki - Copyright (C) 2013 Alex Seville - Copyright (C) 2014 Thiago de Arruda - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -/** - * Escope (escope) is an ECMAScript - * scope analyzer extracted from the esmangle project. - *

- * escope finds lexical scopes in a source program, i.e. areas of that - * program where different occurrences of the same identifier refer to the same - * variable. With each scope the contained variables are collected, and each - * identifier reference in code is linked to its corresponding variable (if - * possible). - *

- * escope works on a syntax tree of the parsed source code which has - * to adhere to the - * Mozilla Parser API. E.g. espree is a parser - * that produces such syntax trees. - *

- * The main interface is the {@link analyze} function. - * @module escope - */ - - -/* eslint no-underscore-dangle: ["error", { "allow": ["__currentScope"] }] */ - -const assert = __webpack_require__(39491); - -const ScopeManager = __webpack_require__(96988); -const Referencer = __webpack_require__(44585); -const Reference = __webpack_require__(64945); -const Variable = __webpack_require__(82971); -const Scope = (__webpack_require__(16313).Scope); -const version = (__webpack_require__(30290)/* .version */ .i8); -/** - * Set the default options - * @returns {Object} options - */ -function defaultOptions() { - return { - optimistic: false, - directive: false, - nodejsScope: false, - impliedStrict: false, - sourceType: "script", // one of ['script', 'module'] - ecmaVersion: 5, - childVisitorKeys: null, - fallback: "iteration" - }; -} -/** - * Preform deep update on option object - * @param {Object} target - Options - * @param {Object} override - Updates - * @returns {Object} Updated options - */ -function updateDeeply(target, override) { +const forEachBail = __webpack_require__(8266); - /** - * Is hash object - * @param {Object} value - Test value - * @returns {boolean} Result - */ - function isHashObject(value) { - return typeof value === "object" && value instanceof Object && !(value instanceof Array) && !(value instanceof RegExp); - } +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +/** @typedef {{alias: string|Array|false, name: string, onlyModule?: boolean}} AliasOption */ - for (const key in override) { - if (Object.prototype.hasOwnProperty.call(override, key)) { - const val = override[key]; +module.exports = class AliasPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {AliasOption | Array} options options + * @param {string | ResolveStepHook} target target + */ + constructor(source, options, target) { + this.source = source; + this.options = Array.isArray(options) ? options : [options]; + this.target = target; + } - if (isHashObject(val)) { - if (isHashObject(target[key])) { - updateDeeply(target[key], val); - } else { - target[key] = updateDeeply({}, val); - } - } else { - target[key] = val; - } - } - } - return target; -} + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("AliasPlugin", (request, resolveContext, callback) => { + const innerRequest = request.request || request.path; + if (!innerRequest) return callback(); + forEachBail( + this.options, + (item, callback) => { + let shouldStop = false; + if ( + innerRequest === item.name || + (!item.onlyModule && innerRequest.startsWith(item.name + "/")) + ) { + const remainingRequest = innerRequest.substr(item.name.length); + const resolveWithAlias = (alias, callback) => { + if (alias === false) { + const ignoreObj = { + ...request, + path: false + }; + return callback(null, ignoreObj); + } + if ( + innerRequest !== alias && + !innerRequest.startsWith(alias + "/") + ) { + shouldStop = true; + const newRequestStr = alias + remainingRequest; + const obj = { + ...request, + request: newRequestStr, + fullySpecified: false + }; + return resolver.doResolve( + target, + obj, + "aliased with mapping '" + + item.name + + "': '" + + alias + + "' to '" + + newRequestStr + + "'", + resolveContext, + (err, result) => { + if (err) return callback(err); + if (result) return callback(null, result); + return callback(); + } + ); + } + return callback(); + }; + const stoppingCallback = (err, result) => { + if (err) return callback(err); -/** - * Main interface function. Takes an Espree syntax tree and returns the - * analyzed scopes. - * @function analyze - * @param {espree.Tree} tree - Abstract Syntax Tree - * @param {Object} providedOptions - Options that tailor the scope analysis - * @param {boolean} [providedOptions.optimistic=false] - the optimistic flag - * @param {boolean} [providedOptions.directive=false]- the directive flag - * @param {boolean} [providedOptions.ignoreEval=false]- whether to check 'eval()' calls - * @param {boolean} [providedOptions.nodejsScope=false]- whether the whole - * script is executed under node.js environment. When enabled, escope adds - * a function scope immediately following the global scope. - * @param {boolean} [providedOptions.impliedStrict=false]- implied strict mode - * (if ecmaVersion >= 5). - * @param {string} [providedOptions.sourceType='script']- the source type of the script. one of 'script' and 'module' - * @param {number} [providedOptions.ecmaVersion=5]- which ECMAScript version is considered - * @param {Object} [providedOptions.childVisitorKeys=null] - Additional known visitor keys. See [esrecurse](https://github.com/estools/esrecurse)'s the `childVisitorKeys` option. - * @param {string} [providedOptions.fallback='iteration'] - A kind of the fallback in order to encounter with unknown node. See [esrecurse](https://github.com/estools/esrecurse)'s the `fallback` option. - * @returns {ScopeManager} ScopeManager - */ -function analyze(tree, providedOptions) { - const options = updateDeeply(defaultOptions(), providedOptions); - const scopeManager = new ScopeManager(options); - const referencer = new Referencer(options, scopeManager); + if (result) return callback(null, result); + // Don't allow other aliasing or raw request + if (shouldStop) return callback(null, null); + return callback(); + }; + if (Array.isArray(item.alias)) { + return forEachBail( + item.alias, + resolveWithAlias, + stoppingCallback + ); + } else { + return resolveWithAlias(item.alias, stoppingCallback); + } + } + return callback(); + }, + callback + ); + }); + } +}; - referencer.visit(tree); - assert(scopeManager.__currentScope === null, "currentScope should be null."); +/***/ }), - return scopeManager; -} +/***/ 66477: +/***/ (function(module) { -module.exports = { +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** @name module:escope.version */ - version, - /** @name module:escope.Reference */ - Reference, - /** @name module:escope.Variable */ - Variable, +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - /** @name module:escope.Scope */ - Scope, +module.exports = class AppendPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string} appending appending + * @param {string | ResolveStepHook} target target + */ + constructor(source, appending, target) { + this.source = source; + this.appending = appending; + this.target = target; + } - /** @name module:escope.ScopeManager */ - ScopeManager, - analyze + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("AppendPlugin", (request, resolveContext, callback) => { + const obj = { + ...request, + path: request.path + this.appending, + relativePath: + request.relativePath && request.relativePath + this.appending + }; + resolver.doResolve( + target, + obj, + this.appending, + resolveContext, + callback + ); + }); + } }; -/* vim: set sw=4 ts=4 et tw=80 : */ - - /***/ }), -/***/ 54162: +/***/ 89429: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* - Copyright (C) 2015 Yusuke Suzuki - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -/* eslint-disable no-undefined */ - -const Syntax = (__webpack_require__(18350).Syntax); -const esrecurse = __webpack_require__(81217); -/** - * Get last array element - * @param {array} xs - array - * @returns {any} Last elment - */ -function getLast(xs) { - return xs[xs.length - 1] || null; -} +const nextTick = (__webpack_require__(77282).nextTick); -class PatternVisitor extends esrecurse.Visitor { - static isPattern(node) { - const nodeType = node.type; +/** @typedef {import("./Resolver").FileSystem} FileSystem */ +/** @typedef {import("./Resolver").SyncFileSystem} SyncFileSystem */ - return ( - nodeType === Syntax.Identifier || - nodeType === Syntax.ObjectPattern || - nodeType === Syntax.ArrayPattern || - nodeType === Syntax.SpreadElement || - nodeType === Syntax.RestElement || - nodeType === Syntax.AssignmentPattern - ); - } +const dirname = path => { + let idx = path.length - 1; + while (idx >= 0) { + const c = path.charCodeAt(idx); + // slash or backslash + if (c === 47 || c === 92) break; + idx--; + } + if (idx < 0) return ""; + return path.slice(0, idx); +}; - constructor(options, rootPattern, callback) { - super(null, options); - this.rootPattern = rootPattern; - this.callback = callback; - this.assignments = []; - this.rightHandNodes = []; - this.restElements = []; - } +const runCallbacks = (callbacks, err, result) => { + if (callbacks.length === 1) { + callbacks[0](err, result); + callbacks.length = 0; + return; + } + let error; + for (const callback of callbacks) { + try { + callback(err, result); + } catch (e) { + if (!error) error = e; + } + } + callbacks.length = 0; + if (error) throw error; +}; - Identifier(pattern) { - const lastRestElement = getLast(this.restElements); +class OperationMergerBackend { + /** + * @param {any} provider async method + * @param {any} syncProvider sync method + * @param {any} providerContext call context for the provider methods + */ + constructor(provider, syncProvider, providerContext) { + this._provider = provider; + this._syncProvider = syncProvider; + this._providerContext = providerContext; + this._activeAsyncOperations = new Map(); - this.callback(pattern, { - topLevel: pattern === this.rootPattern, - rest: lastRestElement !== null && lastRestElement !== undefined && lastRestElement.argument === pattern, - assignments: this.assignments - }); - } + this.provide = this._provider + ? (path, options, callback) => { + if (typeof options === "function") { + callback = options; + options = undefined; + } + if (options) { + return this._provider.call( + this._providerContext, + path, + options, + callback + ); + } + if (typeof path !== "string") { + callback(new TypeError("path must be a string")); + return; + } + let callbacks = this._activeAsyncOperations.get(path); + if (callbacks) { + callbacks.push(callback); + return; + } + this._activeAsyncOperations.set(path, (callbacks = [callback])); + provider(path, (err, result) => { + this._activeAsyncOperations.delete(path); + runCallbacks(callbacks, err, result); + }); + } + : null; + this.provideSync = this._syncProvider + ? (path, options) => { + return this._syncProvider.call(this._providerContext, path, options); + } + : null; + } - Property(property) { + purge() {} + purgeParent() {} +} - // Computed property's key is a right hand node. - if (property.computed) { - this.rightHandNodes.push(property.key); - } +/* - // If it's shorthand, its key is same as its value. - // If it's shorthand and has its default value, its key is same as its value.left (the value is AssignmentPattern). - // If it's not shorthand, the name of new variable is its value's. - this.visit(property.value); - } +IDLE: + insert data: goto SYNC - ArrayPattern(pattern) { - for (let i = 0, iz = pattern.elements.length; i < iz; ++i) { - const element = pattern.elements[i]; +SYNC: + before provide: run ticks + event loop tick: goto ASYNC_ACTIVE - this.visit(element); - } - } +ASYNC: + timeout: run tick, goto ASYNC_PASSIVE - AssignmentPattern(pattern) { - this.assignments.push(pattern); - this.visit(pattern.left); - this.rightHandNodes.push(pattern.right); - this.assignments.pop(); - } +ASYNC_PASSIVE: + before provide: run ticks - RestElement(pattern) { - this.restElements.push(pattern); - this.visit(pattern.argument); - this.restElements.pop(); - } +IDLE --[insert data]--> SYNC --[event loop tick]--> ASYNC_ACTIVE --[interval tick]-> ASYNC_PASSIVE + ^ | + +---------[insert data]-------+ +*/ - MemberExpression(node) { +const STORAGE_MODE_IDLE = 0; +const STORAGE_MODE_SYNC = 1; +const STORAGE_MODE_ASYNC = 2; - // Computed property's key is a right hand node. - if (node.computed) { - this.rightHandNodes.push(node.property); - } +class CacheBackend { + /** + * @param {number} duration max cache duration of items + * @param {any} provider async method + * @param {any} syncProvider sync method + * @param {any} providerContext call context for the provider methods + */ + constructor(duration, provider, syncProvider, providerContext) { + this._duration = duration; + this._provider = provider; + this._syncProvider = syncProvider; + this._providerContext = providerContext; + /** @type {Map} */ + this._activeAsyncOperations = new Map(); + /** @type {Map }>} */ + this._data = new Map(); + /** @type {Set[]} */ + this._levels = []; + for (let i = 0; i < 10; i++) this._levels.push(new Set()); + for (let i = 5000; i < duration; i += 500) this._levels.push(new Set()); + this._currentLevel = 0; + this._tickInterval = Math.floor(duration / this._levels.length); + /** @type {STORAGE_MODE_IDLE | STORAGE_MODE_SYNC | STORAGE_MODE_ASYNC} */ + this._mode = STORAGE_MODE_IDLE; - // the object is only read, write to its property. - this.rightHandNodes.push(node.object); - } + /** @type {NodeJS.Timeout | undefined} */ + this._timeout = undefined; + /** @type {number | undefined} */ + this._nextDecay = undefined; - // - // ForInStatement.left and AssignmentExpression.left are LeftHandSideExpression. - // By spec, LeftHandSideExpression is Pattern or MemberExpression. - // (see also: https://github.com/estree/estree/pull/20#issuecomment-74584758) - // But espree 2.0 parses to ArrayExpression, ObjectExpression, etc... - // + this.provide = provider ? this.provide.bind(this) : null; + this.provideSync = syncProvider ? this.provideSync.bind(this) : null; + } - SpreadElement(node) { - this.visit(node.argument); - } + provide(path, options, callback) { + if (typeof options === "function") { + callback = options; + options = undefined; + } + if (typeof path !== "string") { + callback(new TypeError("path must be a string")); + return; + } + if (options) { + return this._provider.call( + this._providerContext, + path, + options, + callback + ); + } - ArrayExpression(node) { - node.elements.forEach(this.visit, this); - } + // When in sync mode we can move to async mode + if (this._mode === STORAGE_MODE_SYNC) { + this._enterAsyncMode(); + } - AssignmentExpression(node) { - this.assignments.push(node); - this.visit(node.left); - this.rightHandNodes.push(node.right); - this.assignments.pop(); - } + // Check in cache + let cacheEntry = this._data.get(path); + if (cacheEntry !== undefined) { + if (cacheEntry.err) return nextTick(callback, cacheEntry.err); + return nextTick(callback, null, cacheEntry.result); + } - CallExpression(node) { + // Check if there is already the same operation running + let callbacks = this._activeAsyncOperations.get(path); + if (callbacks !== undefined) { + callbacks.push(callback); + return; + } + this._activeAsyncOperations.set(path, (callbacks = [callback])); - // arguments are right hand nodes. - node.arguments.forEach(a => { - this.rightHandNodes.push(a); - }); - this.visit(node.callee); - } -} + // Run the operation + this._provider.call(this._providerContext, path, (err, result) => { + this._activeAsyncOperations.delete(path); + this._storeResult(path, err, result); -module.exports = PatternVisitor; + // Enter async mode if not yet done + this._enterAsyncMode(); -/* vim: set sw=4 ts=4 et tw=80 : */ + runCallbacks(callbacks, err, result); + }); + } + provideSync(path, options) { + if (typeof path !== "string") { + throw new TypeError("path must be a string"); + } + if (options) { + return this._syncProvider.call(this._providerContext, path, options); + } -/***/ }), + // In sync mode we may have to decay some cache items + if (this._mode === STORAGE_MODE_SYNC) { + this._runDecays(); + } -/***/ 64945: -/***/ (function(module) { + // Check in cache + let cacheEntry = this._data.get(path); + if (cacheEntry !== undefined) { + if (cacheEntry.err) throw cacheEntry.err; + return cacheEntry.result; + } -"use strict"; -/* - Copyright (C) 2015 Yusuke Suzuki + // Get all active async operations + // This sync operation will also complete them + const callbacks = this._activeAsyncOperations.get(path); + this._activeAsyncOperations.delete(path); - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + // Run the operation + // When in idle mode, we will enter sync mode + let result; + try { + result = this._syncProvider.call(this._providerContext, path); + } catch (err) { + this._storeResult(path, err, undefined); + this._enterSyncModeWhenIdle(); + if (callbacks) runCallbacks(callbacks, err, undefined); + throw err; + } + this._storeResult(path, undefined, result); + this._enterSyncModeWhenIdle(); + if (callbacks) runCallbacks(callbacks, undefined, result); + return result; + } - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + purge(what) { + if (!what) { + if (this._mode !== STORAGE_MODE_IDLE) { + this._data.clear(); + for (const level of this._levels) { + level.clear(); + } + this._enterIdleMode(); + } + } else if (typeof what === "string") { + for (let [key, data] of this._data) { + if (key.startsWith(what)) { + this._data.delete(key); + data.level.delete(key); + } + } + if (this._data.size === 0) { + this._enterIdleMode(); + } + } else { + for (let [key, data] of this._data) { + for (const item of what) { + if (key.startsWith(item)) { + this._data.delete(key); + data.level.delete(key); + break; + } + } + } + if (this._data.size === 0) { + this._enterIdleMode(); + } + } + } - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ + purgeParent(what) { + if (!what) { + this.purge(); + } else if (typeof what === "string") { + this.purge(dirname(what)); + } else { + const set = new Set(); + for (const item of what) { + set.add(dirname(item)); + } + this.purge(set); + } + } + _storeResult(path, err, result) { + if (this._data.has(path)) return; + const level = this._levels[this._currentLevel]; + this._data.set(path, { err, result, level }); + level.add(path); + } -const READ = 0x1; -const WRITE = 0x2; -const RW = READ | WRITE; + _decayLevel() { + const nextLevel = (this._currentLevel + 1) % this._levels.length; + const decay = this._levels[nextLevel]; + this._currentLevel = nextLevel; + for (let item of decay) { + this._data.delete(item); + } + decay.clear(); + if (this._data.size === 0) { + this._enterIdleMode(); + } else { + // @ts-ignore _nextDecay is always a number in sync mode + this._nextDecay += this._tickInterval; + } + } -/** - * A Reference represents a single occurrence of an identifier in code. - * @class Reference - */ -class Reference { - constructor(ident, scope, flag, writeExpr, maybeImplicitGlobal, partial, init) { + _runDecays() { + while ( + /** @type {number} */ (this._nextDecay) <= Date.now() && + this._mode !== STORAGE_MODE_IDLE + ) { + this._decayLevel(); + } + } - /** - * Identifier syntax node. - * @member {espreeIdentifier} Reference#identifier - */ - this.identifier = ident; + _enterAsyncMode() { + let timeout = 0; + switch (this._mode) { + case STORAGE_MODE_ASYNC: + return; + case STORAGE_MODE_IDLE: + this._nextDecay = Date.now() + this._tickInterval; + timeout = this._tickInterval; + break; + case STORAGE_MODE_SYNC: + this._runDecays(); + // @ts-ignore _runDecays may change the mode + if (this._mode === STORAGE_MODE_IDLE) return; + timeout = Math.max( + 0, + /** @type {number} */ (this._nextDecay) - Date.now() + ); + break; + } + this._mode = STORAGE_MODE_ASYNC; + const ref = setTimeout(() => { + this._mode = STORAGE_MODE_SYNC; + this._runDecays(); + }, timeout); + if (ref.unref) ref.unref(); + this._timeout = ref; + } - /** - * Reference to the enclosing Scope. - * @member {Scope} Reference#from - */ - this.from = scope; + _enterSyncModeWhenIdle() { + if (this._mode === STORAGE_MODE_IDLE) { + this._mode = STORAGE_MODE_SYNC; + this._nextDecay = Date.now() + this._tickInterval; + } + } - /** - * Whether the reference comes from a dynamic scope (such as 'eval', - * 'with', etc.), and may be trapped by dynamic scopes. - * @member {boolean} Reference#tainted - */ - this.tainted = false; + _enterIdleMode() { + this._mode = STORAGE_MODE_IDLE; + this._nextDecay = undefined; + if (this._timeout) clearTimeout(this._timeout); + } +} - /** - * The variable this reference is resolved with. - * @member {Variable} Reference#resolved - */ - this.resolved = null; +const createBackend = (duration, provider, syncProvider, providerContext) => { + if (duration > 0) { + return new CacheBackend(duration, provider, syncProvider, providerContext); + } + return new OperationMergerBackend(provider, syncProvider, providerContext); +}; - /** - * The read-write mode of the reference. (Value is one of {@link - * Reference.READ}, {@link Reference.RW}, {@link Reference.WRITE}). - * @member {number} Reference#flag - * @private - */ - this.flag = flag; - if (this.isWrite()) { +module.exports = class CachedInputFileSystem { + constructor(fileSystem, duration) { + this.fileSystem = fileSystem; - /** - * If reference is writeable, this is the tree being written to it. - * @member {espreeNode} Reference#writeExpr - */ - this.writeExpr = writeExpr; + this._lstatBackend = createBackend( + duration, + this.fileSystem.lstat, + this.fileSystem.lstatSync, + this.fileSystem + ); + const lstat = this._lstatBackend.provide; + this.lstat = /** @type {FileSystem["lstat"]} */ (lstat); + const lstatSync = this._lstatBackend.provideSync; + this.lstatSync = /** @type {SyncFileSystem["lstatSync"]} */ (lstatSync); - /** - * Whether the Reference might refer to a partial value of writeExpr. - * @member {boolean} Reference#partial - */ - this.partial = partial; + this._statBackend = createBackend( + duration, + this.fileSystem.stat, + this.fileSystem.statSync, + this.fileSystem + ); + const stat = this._statBackend.provide; + this.stat = /** @type {FileSystem["stat"]} */ (stat); + const statSync = this._statBackend.provideSync; + this.statSync = /** @type {SyncFileSystem["statSync"]} */ (statSync); - /** - * Whether the Reference is to write of initialization. - * @member {boolean} Reference#init - */ - this.init = init; - } - this.__maybeImplicitGlobal = maybeImplicitGlobal; - } + this._readdirBackend = createBackend( + duration, + this.fileSystem.readdir, + this.fileSystem.readdirSync, + this.fileSystem + ); + const readdir = this._readdirBackend.provide; + this.readdir = /** @type {FileSystem["readdir"]} */ (readdir); + const readdirSync = this._readdirBackend.provideSync; + this.readdirSync = /** @type {SyncFileSystem["readdirSync"]} */ (readdirSync); - /** - * Whether the reference is static. - * @method Reference#isStatic - * @returns {boolean} static - */ - isStatic() { - return !this.tainted && this.resolved && this.resolved.scope.isStatic(); - } - - /** - * Whether the reference is writeable. - * @method Reference#isWrite - * @returns {boolean} write - */ - isWrite() { - return !!(this.flag & Reference.WRITE); - } - - /** - * Whether the reference is readable. - * @method Reference#isRead - * @returns {boolean} read - */ - isRead() { - return !!(this.flag & Reference.READ); - } - - /** - * Whether the reference is read-only. - * @method Reference#isReadOnly - * @returns {boolean} read only - */ - isReadOnly() { - return this.flag === Reference.READ; - } - - /** - * Whether the reference is write-only. - * @method Reference#isWriteOnly - * @returns {boolean} write only - */ - isWriteOnly() { - return this.flag === Reference.WRITE; - } - - /** - * Whether the reference is read-write. - * @method Reference#isReadWrite - * @returns {boolean} read write - */ - isReadWrite() { - return this.flag === Reference.RW; - } -} - -/** - * @constant Reference.READ - * @private - */ -Reference.READ = READ; - -/** - * @constant Reference.WRITE - * @private - */ -Reference.WRITE = WRITE; + this._readFileBackend = createBackend( + duration, + this.fileSystem.readFile, + this.fileSystem.readFileSync, + this.fileSystem + ); + const readFile = this._readFileBackend.provide; + this.readFile = /** @type {FileSystem["readFile"]} */ (readFile); + const readFileSync = this._readFileBackend.provideSync; + this.readFileSync = /** @type {SyncFileSystem["readFileSync"]} */ (readFileSync); -/** - * @constant Reference.RW - * @private - */ -Reference.RW = RW; + this._readJsonBackend = createBackend( + duration, + this.fileSystem.readJson || + (this.readFile && + ((path, callback) => { + // @ts-ignore + this.readFile(path, (err, buffer) => { + if (err) return callback(err); + if (!buffer || buffer.length === 0) + return callback(new Error("No file content")); + let data; + try { + data = JSON.parse(buffer.toString("utf-8")); + } catch (e) { + return callback(e); + } + callback(null, data); + }); + })), + this.fileSystem.readJsonSync || + (this.readFileSync && + (path => { + const buffer = this.readFileSync(path); + const data = JSON.parse(buffer.toString("utf-8")); + return data; + })), + this.fileSystem + ); + const readJson = this._readJsonBackend.provide; + this.readJson = /** @type {FileSystem["readJson"]} */ (readJson); + const readJsonSync = this._readJsonBackend.provideSync; + this.readJsonSync = /** @type {SyncFileSystem["readJsonSync"]} */ (readJsonSync); -module.exports = Reference; + this._readlinkBackend = createBackend( + duration, + this.fileSystem.readlink, + this.fileSystem.readlinkSync, + this.fileSystem + ); + const readlink = this._readlinkBackend.provide; + this.readlink = /** @type {FileSystem["readlink"]} */ (readlink); + const readlinkSync = this._readlinkBackend.provideSync; + this.readlinkSync = /** @type {SyncFileSystem["readlinkSync"]} */ (readlinkSync); + } -/* vim: set sw=4 ts=4 et tw=80 : */ + purge(what) { + this._statBackend.purge(what); + this._lstatBackend.purge(what); + this._readdirBackend.purgeParent(what); + this._readFileBackend.purge(what); + this._readlinkBackend.purge(what); + this._readJsonBackend.purge(what); + } +}; /***/ }), -/***/ 44585: +/***/ 2020: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* - Copyright (C) 2015 Yusuke Suzuki - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -/* eslint-disable no-underscore-dangle */ -/* eslint-disable no-undefined */ -const Syntax = (__webpack_require__(18350).Syntax); -const esrecurse = __webpack_require__(81217); -const Reference = __webpack_require__(64945); -const Variable = __webpack_require__(82971); -const PatternVisitor = __webpack_require__(54162); -const definition = __webpack_require__(70665); -const assert = __webpack_require__(39491); +const basename = (__webpack_require__(48608).basename); -const ParameterDefinition = definition.ParameterDefinition; -const Definition = definition.Definition; +/** @typedef {import("./Resolver")} Resolver */ -/** - * Traverse identifier in pattern - * @param {Object} options - options - * @param {pattern} rootPattern - root pattern - * @param {Refencer} referencer - referencer - * @param {callback} callback - callback - * @returns {void} - */ -function traverseIdentifierInPattern(options, rootPattern, referencer, callback) { +module.exports = class CloneBasenamePlugin { + constructor(source, target) { + this.source = source; + this.target = target; + } - // Call the callback at left hand identifier nodes, and Collect right hand nodes. - const visitor = new PatternVisitor(options, rootPattern, callback); + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("CloneBasenamePlugin", (request, resolveContext, callback) => { + const filename = basename(request.path); + const filePath = resolver.join(request.path, filename); + const obj = { + ...request, + path: filePath, + relativePath: + request.relativePath && + resolver.join(request.relativePath, filename) + }; + resolver.doResolve( + target, + obj, + "using path: " + filePath, + resolveContext, + callback + ); + }); + } +}; - visitor.visit(rootPattern); - // Process the right hand nodes recursively. - if (referencer !== null && referencer !== undefined) { - visitor.rightHandNodes.forEach(referencer.visit, referencer); - } -} +/***/ }), -// Importing ImportDeclaration. -// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-moduledeclarationinstantiation -// https://github.com/estree/estree/blob/master/es6.md#importdeclaration -// FIXME: Now, we don't create module environment, because the context is -// implementation dependent. +/***/ 44193: +/***/ (function(module) { -class Importer extends esrecurse.Visitor { - constructor(declaration, referencer) { - super(null, referencer.options); - this.declaration = declaration; - this.referencer = referencer; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - visitImport(id, specifier) { - this.referencer.visitPattern(id, pattern => { - this.referencer.currentScope().__define(pattern, - new Definition( - Variable.ImportBinding, - pattern, - specifier, - this.declaration, - null, - null - )); - }); - } - ImportNamespaceSpecifier(node) { - const local = (node.local || node.id); - if (local) { - this.visitImport(local, node); - } - } +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - ImportDefaultSpecifier(node) { - const local = (node.local || node.id); +module.exports = class ConditionalPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {Partial} test compare object + * @param {string | null} message log message + * @param {boolean} allowAlternatives when false, do not continue with the current step when "test" matches + * @param {string | ResolveStepHook} target target + */ + constructor(source, test, message, allowAlternatives, target) { + this.source = source; + this.test = test; + this.message = message; + this.allowAlternatives = allowAlternatives; + this.target = target; + } - this.visitImport(local, node); - } + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + const { test, message, allowAlternatives } = this; + const keys = Object.keys(test); + resolver + .getHook(this.source) + .tapAsync("ConditionalPlugin", (request, resolveContext, callback) => { + for (const prop of keys) { + if (request[prop] !== test[prop]) return callback(); + } + resolver.doResolve( + target, + request, + message, + resolveContext, + allowAlternatives + ? callback + : (err, result) => { + if (err) return callback(err); - ImportSpecifier(node) { - const local = (node.local || node.id); + // Don't allow other alternatives + if (result === undefined) return callback(null, null); + callback(null, result); + } + ); + }); + } +}; - if (node.name) { - this.visitImport(node.name, node); - } else { - this.visitImport(local, node); - } - } -} -// Referencing variables and creating bindings. -class Referencer extends esrecurse.Visitor { - constructor(options, scopeManager) { - super(null, options); - this.options = options; - this.scopeManager = scopeManager; - this.parent = null; - this.isInnerMethodDefinition = false; - } +/***/ }), - currentScope() { - return this.scopeManager.__currentScope; - } +/***/ 66826: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - close(node) { - while (this.currentScope() && node === this.currentScope().block) { - this.scopeManager.__currentScope = this.currentScope().__close(this.scopeManager); - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - pushInnerMethodDefinition(isInnerMethodDefinition) { - const previous = this.isInnerMethodDefinition; - this.isInnerMethodDefinition = isInnerMethodDefinition; - return previous; - } - popInnerMethodDefinition(isInnerMethodDefinition) { - this.isInnerMethodDefinition = isInnerMethodDefinition; - } +const DescriptionFileUtils = __webpack_require__(702); - referencingDefaultValue(pattern, assignments, maybeImplicitGlobal, init) { - const scope = this.currentScope(); +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - assignments.forEach(assignment => { - scope.__referencing( - pattern, - Reference.WRITE, - assignment.right, - maybeImplicitGlobal, - pattern !== assignment.left, - init - ); - }); - } +module.exports = class DescriptionFilePlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string[]} filenames filenames + * @param {boolean} pathIsFile pathIsFile + * @param {string | ResolveStepHook} target target + */ + constructor(source, filenames, pathIsFile, target) { + this.source = source; + this.filenames = filenames; + this.pathIsFile = pathIsFile; + this.target = target; + } - visitPattern(node, options, callback) { - let visitPatternOptions = options; - let visitPatternCallback = callback; + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync( + "DescriptionFilePlugin", + (request, resolveContext, callback) => { + const path = request.path; + if (!path) return callback(); + const directory = this.pathIsFile + ? DescriptionFileUtils.cdUp(path) + : path; + if (!directory) return callback(); + DescriptionFileUtils.loadDescriptionFile( + resolver, + directory, + this.filenames, + request.descriptionFilePath + ? { + path: request.descriptionFilePath, + content: request.descriptionFileData, + directory: /** @type {string} */ (request.descriptionFileRoot) + } + : undefined, + resolveContext, + (err, result) => { + if (err) return callback(err); + if (!result) { + if (resolveContext.log) + resolveContext.log( + `No description file found in ${directory} or above` + ); + return callback(); + } + const relativePath = + "." + path.substr(result.directory.length).replace(/\\/g, "/"); + const obj = { + ...request, + descriptionFilePath: result.path, + descriptionFileData: result.content, + descriptionFileRoot: result.directory, + relativePath: relativePath + }; + resolver.doResolve( + target, + obj, + "using description file: " + + result.path + + " (relative path: " + + relativePath + + ")", + resolveContext, + (err, result) => { + if (err) return callback(err); - if (typeof options === "function") { - visitPatternCallback = options; - visitPatternOptions = { processRightHandNodes: false }; - } + // Don't allow other processing + if (result === undefined) return callback(null, null); + callback(null, result); + } + ); + } + ); + } + ); + } +}; - traverseIdentifierInPattern( - this.options, - node, - visitPatternOptions.processRightHandNodes ? this : null, - visitPatternCallback - ); - } - visitFunction(node) { - let i, iz; +/***/ }), - // FunctionDeclaration name is defined in upper scope - // NOTE: Not referring variableScope. It is intended. - // Since - // in ES5, FunctionDeclaration should be in FunctionBody. - // in ES6, FunctionDeclaration should be block scoped. +/***/ 702: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - if (node.type === Syntax.FunctionDeclaration) { +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // id is defined in upper scope - this.currentScope().__define(node.id, - new Definition( - Variable.FunctionName, - node.id, - node, - null, - null, - null - )); - } - // FunctionExpression with name creates its special scope; - // FunctionExpressionNameScope. - if (node.type === Syntax.FunctionExpression && node.id) { - this.scopeManager.__nestFunctionExpressionNameScope(node); - } - // Consider this function is in the MethodDefinition. - this.scopeManager.__nestFunctionScope(node, this.isInnerMethodDefinition); +const forEachBail = __webpack_require__(8266); - const that = this; +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveContext} ResolveContext */ - /** - * Visit pattern callback - * @param {pattern} pattern - pattern - * @param {Object} info - info - * @returns {void} - */ - function visitPatternCallback(pattern, info) { - that.currentScope().__define(pattern, - new ParameterDefinition( - pattern, - node, - i, - info.rest - )); +/** + * @typedef {Object} DescriptionFileInfo + * @property {any=} content + * @property {string} path + * @property {string} directory + */ - that.referencingDefaultValue(pattern, info.assignments, null, true); - } - - // Process parameter declarations. - for (i = 0, iz = node.params.length; i < iz; ++i) { - this.visitPattern(node.params[i], { processRightHandNodes: true }, visitPatternCallback); - } - - // if there's a rest argument, add that - if (node.rest) { - this.visitPattern({ - type: "RestElement", - argument: node.rest - }, pattern => { - this.currentScope().__define(pattern, - new ParameterDefinition( - pattern, - node, - node.params.length, - true - )); - }); - } - - // In TypeScript there are a number of function-like constructs which have no body, - // so check it exists before traversing - if (node.body) { - - // Skip BlockStatement to prevent creating BlockStatement scope. - if (node.body.type === Syntax.BlockStatement) { - this.visitChildren(node.body); - } else { - this.visit(node.body); - } - } +/** + * @callback ErrorFirstCallback + * @param {Error|null=} error + * @param {DescriptionFileInfo=} result + */ - this.close(node); - } +/** + * @param {Resolver} resolver resolver + * @param {string} directory directory + * @param {string[]} filenames filenames + * @param {DescriptionFileInfo|undefined} oldInfo oldInfo + * @param {ResolveContext} resolveContext resolveContext + * @param {ErrorFirstCallback} callback callback + */ +function loadDescriptionFile( + resolver, + directory, + filenames, + oldInfo, + resolveContext, + callback +) { + (function findDescriptionFile() { + if (oldInfo && oldInfo.directory === directory) { + // We already have info for this directory and can reuse it + return callback(null, oldInfo); + } + forEachBail( + filenames, + (filename, callback) => { + const descriptionFilePath = resolver.join(directory, filename); + if (resolver.fileSystem.readJson) { + resolver.fileSystem.readJson(descriptionFilePath, (err, content) => { + if (err) { + if (typeof err.code !== "undefined") { + if (resolveContext.missingDependencies) { + resolveContext.missingDependencies.add(descriptionFilePath); + } + return callback(); + } + if (resolveContext.fileDependencies) { + resolveContext.fileDependencies.add(descriptionFilePath); + } + return onJson(err); + } + if (resolveContext.fileDependencies) { + resolveContext.fileDependencies.add(descriptionFilePath); + } + onJson(null, content); + }); + } else { + resolver.fileSystem.readFile(descriptionFilePath, (err, content) => { + if (err) { + if (resolveContext.missingDependencies) { + resolveContext.missingDependencies.add(descriptionFilePath); + } + return callback(); + } + if (resolveContext.fileDependencies) { + resolveContext.fileDependencies.add(descriptionFilePath); + } + let json; - visitClass(node) { - if (node.type === Syntax.ClassDeclaration) { - this.currentScope().__define(node.id, - new Definition( - Variable.ClassName, - node.id, - node, - null, - null, - null - )); - } + if (content) { + try { + json = JSON.parse(content.toString()); + } catch (e) { + return onJson(e); + } + } else { + return onJson(new Error("No content in file")); + } - this.visit(node.superClass); + onJson(null, json); + }); + } - this.scopeManager.__nestClassScope(node); + function onJson(err, content) { + if (err) { + if (resolveContext.log) + resolveContext.log( + descriptionFilePath + " (directory description file): " + err + ); + else + err.message = + descriptionFilePath + " (directory description file): " + err; + return callback(err); + } + callback(null, { + content, + directory, + path: descriptionFilePath + }); + } + }, + (err, result) => { + if (err) return callback(err); + if (result) { + return callback(null, result); + } else { + const dir = cdUp(directory); + if (!dir) { + return callback(); + } else { + directory = dir; + return findDescriptionFile(); + } + } + } + ); + })(); +} - if (node.id) { - this.currentScope().__define(node.id, - new Definition( - Variable.ClassName, - node.id, - node - )); - } - this.visit(node.body); +/** + * @param {any} content content + * @param {string|string[]} field field + * @returns {object|string|number|boolean|undefined} field data + */ +function getField(content, field) { + if (!content) return undefined; + if (Array.isArray(field)) { + let current = content; + for (let j = 0; j < field.length; j++) { + if (current === null || typeof current !== "object") { + current = null; + break; + } + current = current[field[j]]; + } + return current; + } else { + return content[field]; + } +} - this.close(node); - } +/** + * @param {string} directory directory + * @returns {string|null} parent directory or null + */ +function cdUp(directory) { + if (directory === "/") return null; + const i = directory.lastIndexOf("/"), + j = directory.lastIndexOf("\\"); + const p = i < 0 ? j : j < 0 ? i : i < j ? j : i; + if (p < 0) return null; + return directory.substr(0, p || 1); +} - visitProperty(node) { - let previous; +exports.loadDescriptionFile = loadDescriptionFile; +exports.getField = getField; +exports.cdUp = cdUp; - if (node.computed) { - this.visit(node.key); - } - const isMethodDefinition = node.type === Syntax.MethodDefinition; +/***/ }), - if (isMethodDefinition) { - previous = this.pushInnerMethodDefinition(true); - } - this.visit(node.value); - if (isMethodDefinition) { - this.popInnerMethodDefinition(previous); - } - } +/***/ 73688: +/***/ (function(module) { - visitForIn(node) { - if (node.left.type === Syntax.VariableDeclaration && node.left.kind !== "var") { - this.scopeManager.__nestForScope(node); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (node.left.type === Syntax.VariableDeclaration) { - this.visit(node.left); - this.visitPattern(node.left.declarations[0].id, pattern => { - this.currentScope().__referencing(pattern, Reference.WRITE, node.right, null, true, true); - }); - } else { - this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => { - let maybeImplicitGlobal = null; - if (!this.currentScope().isStrict) { - maybeImplicitGlobal = { - pattern, - node - }; - } - this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false); - this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, true, false); - }); - } - this.visit(node.right); - this.visit(node.body); - this.close(node); - } +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - visitVariableDeclaration(variableTargetScope, type, node, index) { +module.exports = class DirectoryExistsPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string | ResolveStepHook} target target + */ + constructor(source, target) { + this.source = source; + this.target = target; + } - const decl = node.declarations[index]; - const init = decl.init; + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync( + "DirectoryExistsPlugin", + (request, resolveContext, callback) => { + const fs = resolver.fileSystem; + const directory = request.path; + if (!directory) return callback(); + fs.stat(directory, (err, stat) => { + if (err || !stat) { + if (resolveContext.missingDependencies) + resolveContext.missingDependencies.add(directory); + if (resolveContext.log) + resolveContext.log(directory + " doesn't exist"); + return callback(); + } + if (!stat.isDirectory()) { + if (resolveContext.missingDependencies) + resolveContext.missingDependencies.add(directory); + if (resolveContext.log) + resolveContext.log(directory + " is not a directory"); + return callback(); + } + if (resolveContext.fileDependencies) + resolveContext.fileDependencies.add(directory); + resolver.doResolve( + target, + request, + `existing directory ${directory}`, + resolveContext, + callback + ); + }); + } + ); + } +}; - this.visitPattern(decl.id, { processRightHandNodes: true }, (pattern, info) => { - variableTargetScope.__define( - pattern, - new Definition( - type, - pattern, - decl, - node, - index, - node.kind - ) - ); - this.referencingDefaultValue(pattern, info.assignments, null, true); - if (init) { - this.currentScope().__referencing(pattern, Reference.WRITE, init, null, !info.topLevel, true); - } - }); - } +/***/ }), - AssignmentExpression(node) { - if (PatternVisitor.isPattern(node.left)) { - if (node.operator === "=") { - this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => { - let maybeImplicitGlobal = null; +/***/ 80163: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (!this.currentScope().isStrict) { - maybeImplicitGlobal = { - pattern, - node - }; - } - this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false); - this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, !info.topLevel, false); - }); - } else { - this.currentScope().__referencing(node.left, Reference.RW, node.right); - } - } else { - this.visit(node.left); - } - this.visit(node.right); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ - CatchClause(node) { - this.scopeManager.__nestCatchScope(node); - this.visitPattern(node.param, { processRightHandNodes: true }, (pattern, info) => { - this.currentScope().__define(pattern, - new Definition( - Variable.CatchClause, - node.param, - node, - null, - null, - null - )); - this.referencingDefaultValue(pattern, info.assignments, null, true); - }); - this.visit(node.body); - this.close(node); - } +const path = __webpack_require__(71017); +const DescriptionFileUtils = __webpack_require__(702); +const forEachBail = __webpack_require__(8266); +const { processExportsField } = __webpack_require__(28348); +const { parseIdentifier } = __webpack_require__(7780); +const { checkExportsFieldTarget } = __webpack_require__(3011); - Program(node) { - this.scopeManager.__nestGlobalScope(node); +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +/** @typedef {import("./util/entrypoints").ExportsField} ExportsField */ +/** @typedef {import("./util/entrypoints").FieldProcessor} FieldProcessor */ - if (this.scopeManager.__isNodejsScope()) { +module.exports = class ExportsFieldPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {Set} conditionNames condition names + * @param {string | string[]} fieldNamePath name path + * @param {string | ResolveStepHook} target target + */ + constructor(source, conditionNames, fieldNamePath, target) { + this.source = source; + this.target = target; + this.conditionNames = conditionNames; + this.fieldName = fieldNamePath; + /** @type {WeakMap} */ + this.fieldProcessorCache = new WeakMap(); + } - // Force strictness of GlobalScope to false when using node.js scope. - this.currentScope().isStrict = false; - this.scopeManager.__nestFunctionScope(node, false); - } + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("ExportsFieldPlugin", (request, resolveContext, callback) => { + // When there is no description file, abort + if (!request.descriptionFilePath) return callback(); + if ( + // When the description file is inherited from parent, abort + // (There is no description file inside of this package) + request.relativePath !== "." || + request.request === undefined + ) + return callback(); - if (this.scopeManager.__isES6() && this.scopeManager.isModule()) { - this.scopeManager.__nestModuleScope(node); - } + const remainingRequest = + request.query || request.fragment + ? (request.request === "." ? "./" : request.request) + + request.query + + request.fragment + : request.request; + /** @type {ExportsField|null} */ + const exportsField = DescriptionFileUtils.getField( + request.descriptionFileData, + this.fieldName + ); + if (!exportsField) return callback(); - if (this.scopeManager.isStrictModeSupported() && this.scopeManager.isImpliedStrict()) { - this.currentScope().isStrict = true; - } + if (request.directory) { + return callback( + new Error( + `Resolving to directories is not possible with the exports field (request was ${remainingRequest}/)` + ) + ); + } - this.visitChildren(node); - this.close(node); - } + let paths; - Identifier(node) { - this.currentScope().__referencing(node); - } + try { + // We attach the cache to the description file instead of the exportsField value + // because we use a WeakMap and the exportsField could be a string too. + // Description file is always an object when exports field can be accessed. + let fieldProcessor = this.fieldProcessorCache.get( + request.descriptionFileData + ); + if (fieldProcessor === undefined) { + fieldProcessor = processExportsField(exportsField); + this.fieldProcessorCache.set( + request.descriptionFileData, + fieldProcessor + ); + } + paths = fieldProcessor(remainingRequest, this.conditionNames); + } catch (err) { + if (resolveContext.log) { + resolveContext.log( + `Exports field in ${request.descriptionFilePath} can't be processed: ${err}` + ); + } + return callback(err); + } - UpdateExpression(node) { - if (PatternVisitor.isPattern(node.argument)) { - this.currentScope().__referencing(node.argument, Reference.RW, null); - } else { - this.visitChildren(node); - } - } + if (paths.length === 0) { + return callback( + new Error( + `Package path ${remainingRequest} is not exported from package ${request.descriptionFileRoot} (see exports field in ${request.descriptionFilePath})` + ) + ); + } - MemberExpression(node) { - this.visit(node.object); - if (node.computed) { - this.visit(node.property); - } - } + forEachBail( + paths, + (p, callback) => { + const parsedIdentifier = parseIdentifier(p); - Property(node) { - this.visitProperty(node); - } + if (!parsedIdentifier) return callback(); - MethodDefinition(node) { - this.visitProperty(node); - } + const [relativePath, query, fragment] = parsedIdentifier; - BreakStatement() {} // eslint-disable-line class-methods-use-this + const error = checkExportsFieldTarget(relativePath); - ContinueStatement() {} // eslint-disable-line class-methods-use-this + if (error) { + return callback(error); + } - LabeledStatement(node) { - this.visit(node.body); - } + const obj = { + ...request, + request: undefined, + path: path.join( + /** @type {string} */ (request.descriptionFileRoot), + relativePath + ), + relativePath, + query, + fragment + }; - ForStatement(node) { + resolver.doResolve( + target, + obj, + "using exports field: " + p, + resolveContext, + callback + ); + }, + (err, result) => callback(err, result || null) + ); + }); + } +}; - // Create ForStatement declaration. - // NOTE: In ES6, ForStatement dynamically generates - // per iteration environment. However, escope is - // a static analyzer, we only generate one scope for ForStatement. - if (node.init && node.init.type === Syntax.VariableDeclaration && node.init.kind !== "var") { - this.scopeManager.__nestForScope(node); - } - this.visitChildren(node); +/***/ }), - this.close(node); - } +/***/ 98699: +/***/ (function(module) { - ClassExpression(node) { - this.visitClass(node); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - ClassDeclaration(node) { - this.visitClass(node); - } - CallExpression(node) { - // Check this is direct call to eval - if (!this.scopeManager.__ignoreEval() && node.callee.type === Syntax.Identifier && node.callee.name === "eval") { +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - // NOTE: This should be `variableScope`. Since direct eval call always creates Lexical environment and - // let / const should be enclosed into it. Only VariableDeclaration affects on the caller's environment. - this.currentScope().variableScope.__detectEval(); - } - this.visitChildren(node); - } +module.exports = class FileExistsPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string | ResolveStepHook} target target + */ + constructor(source, target) { + this.source = source; + this.target = target; + } - BlockStatement(node) { - if (this.scopeManager.__isES6()) { - this.scopeManager.__nestBlockScope(node); - } + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + const fs = resolver.fileSystem; + resolver + .getHook(this.source) + .tapAsync("FileExistsPlugin", (request, resolveContext, callback) => { + const file = request.path; + if (!file) return callback(); + fs.stat(file, (err, stat) => { + if (err || !stat) { + if (resolveContext.missingDependencies) + resolveContext.missingDependencies.add(file); + if (resolveContext.log) resolveContext.log(file + " doesn't exist"); + return callback(); + } + if (!stat.isFile()) { + if (resolveContext.missingDependencies) + resolveContext.missingDependencies.add(file); + if (resolveContext.log) resolveContext.log(file + " is not a file"); + return callback(); + } + if (resolveContext.fileDependencies) + resolveContext.fileDependencies.add(file); + resolver.doResolve( + target, + request, + "existing file: " + file, + resolveContext, + callback + ); + }); + }); + } +}; - this.visitChildren(node); - this.close(node); - } +/***/ }), - ThisExpression() { - this.currentScope().variableScope.__detectThis(); - } +/***/ 86058: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - WithStatement(node) { - this.visit(node.object); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ - // Then nest scope for WithStatement. - this.scopeManager.__nestWithScope(node); - this.visit(node.body); - this.close(node); - } +const path = __webpack_require__(71017); +const DescriptionFileUtils = __webpack_require__(702); +const forEachBail = __webpack_require__(8266); +const { processImportsField } = __webpack_require__(28348); +const { parseIdentifier } = __webpack_require__(7780); - VariableDeclaration(node) { - const variableTargetScope = (node.kind === "var") ? this.currentScope().variableScope : this.currentScope(); +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +/** @typedef {import("./util/entrypoints").FieldProcessor} FieldProcessor */ +/** @typedef {import("./util/entrypoints").ImportsField} ImportsField */ - for (let i = 0, iz = node.declarations.length; i < iz; ++i) { - const decl = node.declarations[i]; +const dotCode = ".".charCodeAt(0); - this.visitVariableDeclaration(variableTargetScope, Variable.Variable, node, i); - if (decl.init) { - this.visit(decl.init); - } - } - } +module.exports = class ImportsFieldPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {Set} conditionNames condition names + * @param {string | string[]} fieldNamePath name path + * @param {string | ResolveStepHook} targetFile target file + * @param {string | ResolveStepHook} targetPackage target package + */ + constructor( + source, + conditionNames, + fieldNamePath, + targetFile, + targetPackage + ) { + this.source = source; + this.targetFile = targetFile; + this.targetPackage = targetPackage; + this.conditionNames = conditionNames; + this.fieldName = fieldNamePath; + /** @type {WeakMap} */ + this.fieldProcessorCache = new WeakMap(); + } - // sec 13.11.8 - SwitchStatement(node) { - this.visit(node.discriminant); + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const targetFile = resolver.ensureHook(this.targetFile); + const targetPackage = resolver.ensureHook(this.targetPackage); - if (this.scopeManager.__isES6()) { - this.scopeManager.__nestSwitchScope(node); - } + resolver + .getHook(this.source) + .tapAsync("ImportsFieldPlugin", (request, resolveContext, callback) => { + // When there is no description file, abort + if (!request.descriptionFilePath || request.request === undefined) { + return callback(); + } - for (let i = 0, iz = node.cases.length; i < iz; ++i) { - this.visit(node.cases[i]); - } + const remainingRequest = + request.request + request.query + request.fragment; + /** @type {ImportsField|null} */ + const importsField = DescriptionFileUtils.getField( + request.descriptionFileData, + this.fieldName + ); + if (!importsField) return callback(); - this.close(node); - } + if (request.directory) { + return callback( + new Error( + `Resolving to directories is not possible with the imports field (request was ${remainingRequest}/)` + ) + ); + } - FunctionDeclaration(node) { - this.visitFunction(node); - } + let paths; - FunctionExpression(node) { - this.visitFunction(node); - } + try { + // We attach the cache to the description file instead of the importsField value + // because we use a WeakMap and the importsField could be a string too. + // Description file is always an object when exports field can be accessed. + let fieldProcessor = this.fieldProcessorCache.get( + request.descriptionFileData + ); + if (fieldProcessor === undefined) { + fieldProcessor = processImportsField(importsField); + this.fieldProcessorCache.set( + request.descriptionFileData, + fieldProcessor + ); + } + paths = fieldProcessor(remainingRequest, this.conditionNames); + } catch (err) { + if (resolveContext.log) { + resolveContext.log( + `Imports field in ${request.descriptionFilePath} can't be processed: ${err}` + ); + } + return callback(err); + } - ForOfStatement(node) { - this.visitForIn(node); - } + if (paths.length === 0) { + return callback( + new Error( + `Package import ${remainingRequest} is not imported from package ${request.descriptionFileRoot} (see imports field in ${request.descriptionFilePath})` + ) + ); + } - ForInStatement(node) { - this.visitForIn(node); - } + forEachBail( + paths, + (p, callback) => { + const parsedIdentifier = parseIdentifier(p); - ArrowFunctionExpression(node) { - this.visitFunction(node); - } + if (!parsedIdentifier) return callback(); - ImportDeclaration(node) { - assert(this.scopeManager.__isES6() && this.scopeManager.isModule(), "ImportDeclaration should appear when the mode is ES6 and in the module context."); + const [path_, query, fragment] = parsedIdentifier; - const importer = new Importer(node, this); + switch (path_.charCodeAt(0)) { + // should be relative + case dotCode: { + const obj = { + ...request, + request: undefined, + path: path.join( + /** @type {string} */ (request.descriptionFileRoot), + path_ + ), + relativePath: path_, + query, + fragment + }; - importer.visit(node); - } + resolver.doResolve( + targetFile, + obj, + "using imports field: " + p, + resolveContext, + callback + ); + break; + } - visitExportDeclaration(node) { - if (node.source) { - return; - } - if (node.declaration) { - this.visit(node.declaration); - return; - } + // package resolving + default: { + const obj = { + ...request, + request: path_, + relativePath: path_, + fullySpecified: true, + query, + fragment + }; - this.visitChildren(node); - } + resolver.doResolve( + targetPackage, + obj, + "using imports field: " + p, + resolveContext, + callback + ); + } + } + }, + (err, result) => callback(err, result || null) + ); + }); + } +}; - // TODO: ExportDeclaration doesn't exist. for bc? - ExportDeclaration(node) { - this.visitExportDeclaration(node); - } - ExportAllDeclaration(node) { - this.visitExportDeclaration(node); - } +/***/ }), - ExportDefaultDeclaration(node) { - this.visitExportDeclaration(node); - } +/***/ 20879: +/***/ (function(module) { - ExportNamedDeclaration(node) { - this.visitExportDeclaration(node); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - ExportSpecifier(node) { - // TODO: `node.id` doesn't exist. for bc? - const local = (node.id || node.local); - this.visit(local); - } +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - MetaProperty() { // eslint-disable-line class-methods-use-this +const namespaceStartCharCode = "@".charCodeAt(0); - // do nothing. - } -} +module.exports = class JoinRequestPartPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string | ResolveStepHook} target target + */ + constructor(source, target) { + this.source = source; + this.target = target; + } -module.exports = Referencer; + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync( + "JoinRequestPartPlugin", + (request, resolveContext, callback) => { + const req = request.request || ""; + let i = req.indexOf("/", 3); -/* vim: set sw=4 ts=4 et tw=80 : */ + if (i >= 0 && req.charCodeAt(2) === namespaceStartCharCode) { + i = req.indexOf("/", i + 1); + } + + let moduleName, remainingRequest, fullySpecified; + if (i < 0) { + moduleName = req; + remainingRequest = "."; + fullySpecified = false; + } else { + moduleName = req.slice(0, i); + remainingRequest = "." + req.slice(i); + fullySpecified = request.fullySpecified; + } + const obj = { + ...request, + path: resolver.join(request.path, moduleName), + relativePath: + request.relativePath && + resolver.join(request.relativePath, moduleName), + request: remainingRequest, + fullySpecified + }; + resolver.doResolve(target, obj, null, resolveContext, callback); + } + ); + } +}; /***/ }), -/***/ 96988: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 71474: +/***/ (function(module) { "use strict"; /* - Copyright (C) 2015 Yusuke Suzuki + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +module.exports = class JoinRequestPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string | ResolveStepHook} target target + */ + constructor(source, target) { + this.source = source; + this.target = target; + } -/* eslint-disable no-underscore-dangle */ + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("JoinRequestPlugin", (request, resolveContext, callback) => { + const obj = { + ...request, + path: resolver.join(request.path, request.request), + relativePath: + request.relativePath && + resolver.join(request.relativePath, request.request), + request: undefined + }; + resolver.doResolve(target, obj, null, resolveContext, callback); + }); + } +}; -const Scope = __webpack_require__(16313); -const assert = __webpack_require__(39491); -const GlobalScope = Scope.GlobalScope; -const CatchScope = Scope.CatchScope; -const WithScope = Scope.WithScope; -const ModuleScope = Scope.ModuleScope; -const ClassScope = Scope.ClassScope; -const SwitchScope = Scope.SwitchScope; -const FunctionScope = Scope.FunctionScope; -const ForScope = Scope.ForScope; -const FunctionExpressionNameScope = Scope.FunctionExpressionNameScope; -const BlockScope = Scope.BlockScope; +/***/ }), -/** - * @class ScopeManager - */ -class ScopeManager { - constructor(options) { - this.scopes = []; - this.globalScope = null; - this.__nodeToScope = new WeakMap(); - this.__currentScope = null; - this.__options = options; - this.__declaredVariables = new WeakMap(); - } +/***/ 47032: +/***/ (function(module) { - __useDirective() { - return this.__options.directive; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - __isOptimistic() { - return this.__options.optimistic; - } - __ignoreEval() { - return this.__options.ignoreEval; - } - __isNodejsScope() { - return this.__options.nodejsScope; - } - - isModule() { - return this.__options.sourceType === "module"; - } +/** @typedef {import("./Resolver")} Resolver */ - isImpliedStrict() { - return this.__options.impliedStrict; - } +module.exports = class LogInfoPlugin { + constructor(source) { + this.source = source; + } - isStrictModeSupported() { - return this.__options.ecmaVersion >= 5; - } + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const source = this.source; + resolver + .getHook(this.source) + .tapAsync("LogInfoPlugin", (request, resolveContext, callback) => { + if (!resolveContext.log) return callback(); + const log = resolveContext.log; + const prefix = "[" + source + "] "; + if (request.path) + log(prefix + "Resolving in directory: " + request.path); + if (request.request) + log(prefix + "Resolving request: " + request.request); + if (request.module) log(prefix + "Request is an module request."); + if (request.directory) log(prefix + "Request is a directory request."); + if (request.query) + log(prefix + "Resolving request query: " + request.query); + if (request.fragment) + log(prefix + "Resolving request fragment: " + request.fragment); + if (request.descriptionFilePath) + log( + prefix + "Has description data from " + request.descriptionFilePath + ); + if (request.relativePath) + log( + prefix + + "Relative path from description file is: " + + request.relativePath + ); + callback(); + }); + } +}; - // Returns appropriate scope for this node. - __get(node) { - return this.__nodeToScope.get(node); - } - /** - * Get variables that are declared by the node. - * - * "are declared by the node" means the node is same as `Variable.defs[].node` or `Variable.defs[].parent`. - * If the node declares nothing, this method returns an empty array. - * CAUTION: This API is experimental. See https://github.com/estools/escope/pull/69 for more details. - * - * @param {Espree.Node} node - a node to get. - * @returns {Variable[]} variables that declared by the node. - */ - getDeclaredVariables(node) { - return this.__declaredVariables.get(node) || []; - } +/***/ }), - /** - * acquire scope from node. - * @method ScopeManager#acquire - * @param {Espree.Node} node - node for the acquired scope. - * @param {boolean=} inner - look up the most inner scope, default value is false. - * @returns {Scope?} Scope from node - */ - acquire(node, inner) { +/***/ 73507: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * predicate - * @param {Scope} testScope - scope to test - * @returns {boolean} predicate - */ - function predicate(testScope) { - if (testScope.type === "function" && testScope.functionExpressionScope) { - return false; - } - return true; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - const scopes = this.__get(node); - if (!scopes || scopes.length === 0) { - return null; - } - // Heuristic selection from all scopes. - // If you would like to get all scopes, please use ScopeManager#acquireAll. - if (scopes.length === 1) { - return scopes[0]; - } +const path = __webpack_require__(71017); +const DescriptionFileUtils = __webpack_require__(702); - if (inner) { - for (let i = scopes.length - 1; i >= 0; --i) { - const scope = scopes[i]; +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +/** @typedef {{name: string|Array, forceRelative: boolean}} MainFieldOptions */ - if (predicate(scope)) { - return scope; - } - } - } else { - for (let i = 0, iz = scopes.length; i < iz; ++i) { - const scope = scopes[i]; +const alreadyTriedMainField = Symbol("alreadyTriedMainField"); - if (predicate(scope)) { - return scope; - } - } - } +module.exports = class MainFieldPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {MainFieldOptions} options options + * @param {string | ResolveStepHook} target target + */ + constructor(source, options, target) { + this.source = source; + this.options = options; + this.target = target; + } - return null; - } + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("MainFieldPlugin", (request, resolveContext, callback) => { + if ( + request.path !== request.descriptionFileRoot || + request[alreadyTriedMainField] === request.descriptionFilePath || + !request.descriptionFilePath + ) + return callback(); + const filename = path.basename(request.descriptionFilePath); + let mainModule = DescriptionFileUtils.getField( + request.descriptionFileData, + this.options.name + ); - /** - * acquire all scopes from node. - * @method ScopeManager#acquireAll - * @param {Espree.Node} node - node for the acquired scope. - * @returns {Scopes?} Scope array - */ - acquireAll(node) { - return this.__get(node); - } + if ( + !mainModule || + typeof mainModule !== "string" || + mainModule === "." || + mainModule === "./" + ) { + return callback(); + } + if (this.options.forceRelative && !/^\.\.?\//.test(mainModule)) + mainModule = "./" + mainModule; + const obj = { + ...request, + request: mainModule, + module: false, + directory: mainModule.endsWith("/"), + [alreadyTriedMainField]: request.descriptionFilePath + }; + return resolver.doResolve( + target, + obj, + "use " + + mainModule + + " from " + + this.options.name + + " in " + + filename, + resolveContext, + callback + ); + }); + } +}; - /** - * release the node. - * @method ScopeManager#release - * @param {Espree.Node} node - releasing node. - * @param {boolean=} inner - look up the most inner scope, default value is false. - * @returns {Scope?} upper scope for the node. - */ - release(node, inner) { - const scopes = this.__get(node); - if (scopes && scopes.length) { - const scope = scopes[0].upper; +/***/ }), - if (!scope) { - return null; - } - return this.acquire(scope.block, inner); - } - return null; - } +/***/ 32942: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - attach() { } // eslint-disable-line class-methods-use-this +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - detach() { } // eslint-disable-line class-methods-use-this - __nestScope(scope) { - if (scope instanceof GlobalScope) { - assert(this.__currentScope === null); - this.globalScope = scope; - } - this.__currentScope = scope; - return scope; - } - __nestGlobalScope(node) { - return this.__nestScope(new GlobalScope(this, node)); - } +const forEachBail = __webpack_require__(8266); +const getPaths = __webpack_require__(48608); - __nestBlockScope(node) { - return this.__nestScope(new BlockScope(this, this.__currentScope, node)); - } +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - __nestFunctionScope(node, isMethodDefinition) { - return this.__nestScope(new FunctionScope(this, this.__currentScope, node, isMethodDefinition)); - } +module.exports = class ModulesInHierarchicalDirectoriesPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string | Array} directories directories + * @param {string | ResolveStepHook} target target + */ + constructor(source, directories, target) { + this.source = source; + this.directories = /** @type {Array} */ ([]).concat(directories); + this.target = target; + } - __nestForScope(node) { - return this.__nestScope(new ForScope(this, this.__currentScope, node)); - } + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync( + "ModulesInHierarchicalDirectoriesPlugin", + (request, resolveContext, callback) => { + const fs = resolver.fileSystem; + const addrs = getPaths(request.path) + .paths.map(p => { + return this.directories.map(d => resolver.join(p, d)); + }) + .reduce((array, p) => { + array.push.apply(array, p); + return array; + }, []); + forEachBail( + addrs, + (addr, callback) => { + fs.stat(addr, (err, stat) => { + if (!err && stat && stat.isDirectory()) { + const obj = { + ...request, + path: addr, + request: "./" + request.request, + module: false + }; + const message = "looking for modules in " + addr; + return resolver.doResolve( + target, + obj, + message, + resolveContext, + callback + ); + } + if (resolveContext.log) + resolveContext.log( + addr + " doesn't exist or is not a directory" + ); + if (resolveContext.missingDependencies) + resolveContext.missingDependencies.add(addr); + return callback(); + }); + }, + callback + ); + } + ); + } +}; - __nestCatchScope(node) { - return this.__nestScope(new CatchScope(this, this.__currentScope, node)); - } - __nestWithScope(node) { - return this.__nestScope(new WithScope(this, this.__currentScope, node)); - } +/***/ }), - __nestClassScope(node) { - return this.__nestScope(new ClassScope(this, this.__currentScope, node)); - } +/***/ 48952: +/***/ (function(module) { - __nestSwitchScope(node) { - return this.__nestScope(new SwitchScope(this, this.__currentScope, node)); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - __nestModuleScope(node) { - return this.__nestScope(new ModuleScope(this, this.__currentScope, node)); - } - __nestFunctionExpressionNameScope(node) { - return this.__nestScope(new FunctionExpressionNameScope(this, this.__currentScope, node)); - } - __isES6() { - return this.__options.ecmaVersion >= 6; - } -} +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -module.exports = ScopeManager; +module.exports = class ModulesInRootPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string} path path + * @param {string | ResolveStepHook} target target + */ + constructor(source, path, target) { + this.source = source; + this.path = path; + this.target = target; + } -/* vim: set sw=4 ts=4 et tw=80 : */ + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("ModulesInRootPlugin", (request, resolveContext, callback) => { + const obj = { + ...request, + path: this.path, + request: "./" + request.request, + module: false + }; + resolver.doResolve( + target, + obj, + "looking for modules in " + this.path, + resolveContext, + callback + ); + }); + } +}; /***/ }), -/***/ 16313: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 79135: +/***/ (function(module) { "use strict"; /* - Copyright (C) 2015 Yusuke Suzuki - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -/* eslint-disable no-underscore-dangle */ -/* eslint-disable no-undefined */ -const Syntax = (__webpack_require__(18350).Syntax); +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -const Reference = __webpack_require__(64945); -const Variable = __webpack_require__(82971); -const Definition = (__webpack_require__(70665).Definition); -const assert = __webpack_require__(39491); +module.exports = class NextPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string | ResolveStepHook} target target + */ + constructor(source, target) { + this.source = source; + this.target = target; + } -/** - * Test if scope is struct - * @param {Scope} scope - scope - * @param {Block} block - block - * @param {boolean} isMethodDefinition - is method definition - * @param {boolean} useDirective - use directive - * @returns {boolean} is strict scope - */ -function isStrictScope(scope, block, isMethodDefinition, useDirective) { - let body; + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("NextPlugin", (request, resolveContext, callback) => { + resolver.doResolve(target, request, null, resolveContext, callback); + }); + } +}; - // When upper scope is exists and strict, inner scope is also strict. - if (scope.upper && scope.upper.isStrict) { - return true; - } - if (isMethodDefinition) { - return true; - } +/***/ }), - if (scope.type === "class" || scope.type === "module") { - return true; - } +/***/ 15234: +/***/ (function(module) { - if (scope.type === "block" || scope.type === "switch") { - return false; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (scope.type === "function") { - if (block.type === Syntax.ArrowFunctionExpression && block.body.type !== Syntax.BlockStatement) { - return false; - } - if (block.type === Syntax.Program) { - body = block; - } else { - body = block.body; - } - if (!body) { - return false; - } - } else if (scope.type === "global") { - body = block; - } else { - return false; - } +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - // Search 'use strict' directive. - if (useDirective) { - for (let i = 0, iz = body.body.length; i < iz; ++i) { - const stmt = body.body[i]; +module.exports = class ParsePlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {Partial} requestOptions request options + * @param {string | ResolveStepHook} target target + */ + constructor(source, requestOptions, target) { + this.source = source; + this.requestOptions = requestOptions; + this.target = target; + } - if (stmt.type !== Syntax.DirectiveStatement) { - break; - } - if (stmt.raw === "\"use strict\"" || stmt.raw === "'use strict'") { - return true; - } - } - } else { - for (let i = 0, iz = body.body.length; i < iz; ++i) { - const stmt = body.body[i]; + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("ParsePlugin", (request, resolveContext, callback) => { + const parsed = resolver.parse(/** @type {string} */ (request.request)); + const obj = { ...request, ...parsed, ...this.requestOptions }; + if (request.query && !parsed.query) { + obj.query = request.query; + } + if (request.fragment && !parsed.fragment) { + obj.fragment = request.fragment; + } + if (parsed && resolveContext.log) { + if (parsed.module) resolveContext.log("Parsed request is a module"); + if (parsed.directory) + resolveContext.log("Parsed request is a directory"); + } + // There is an edge-case where a request with # can be a path or a fragment -> try both + if (obj.request && !obj.query && obj.fragment) { + const directory = obj.fragment.endsWith("/"); + const alternative = { + ...obj, + directory, + request: + obj.request + + (obj.directory ? "/" : "") + + (directory ? obj.fragment.slice(0, -1) : obj.fragment), + fragment: "" + }; + resolver.doResolve( + target, + alternative, + null, + resolveContext, + (err, result) => { + if (err) return callback(err); + if (result) return callback(null, result); + resolver.doResolve(target, obj, null, resolveContext, callback); + } + ); + return; + } + resolver.doResolve(target, obj, null, resolveContext, callback); + }); + } +}; - if (stmt.type !== Syntax.ExpressionStatement) { - break; - } - const expr = stmt.expression; - if (expr.type !== Syntax.Literal || typeof expr.value !== "string") { - break; - } - if (expr.raw !== null && expr.raw !== undefined) { - if (expr.raw === "\"use strict\"" || expr.raw === "'use strict'") { - return true; - } - } else { - if (expr.value === "use strict") { - return true; - } - } - } - } - return false; -} +/***/ }), -/** - * Register scope - * @param {ScopeManager} scopeManager - scope manager - * @param {Scope} scope - scope - * @returns {void} - */ -function registerScope(scopeManager, scope) { - scopeManager.scopes.push(scope); +/***/ 71488: +/***/ (function(module) { - const scopes = scopeManager.__nodeToScope.get(scope.block); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Maël Nison @arcanis +*/ - if (scopes) { - scopes.push(scope); - } else { - scopeManager.__nodeToScope.set(scope.block, [scope]); - } -} -/** - * Should be statically - * @param {Object} def - def - * @returns {boolean} should be statically - */ -function shouldBeStatically(def) { - return ( - (def.type === Variable.ClassName) || - (def.type === Variable.Variable && def.parent.kind !== "var") - ); -} +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ /** - * @class Scope + * @typedef {Object} PnpApiImpl + * @property {function(string, string, object): string} resolveToUnqualified */ -class Scope { - constructor(scopeManager, type, upperScope, block, isMethodDefinition) { - /** - * One of 'module', 'block', 'switch', 'function', 'catch', 'with', 'function', 'class', 'global'. - * @member {String} Scope#type - */ - this.type = type; +module.exports = class PnpPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {PnpApiImpl} pnpApi pnpApi + * @param {string | ResolveStepHook} target target + */ + constructor(source, pnpApi, target) { + this.source = source; + this.pnpApi = pnpApi; + this.target = target; + } - /** - * The scoped {@link Variable}s of this scope, as { Variable.name - * : Variable }. - * @member {Map} Scope#set - */ - this.set = new Map(); + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("PnpPlugin", (request, resolveContext, callback) => { + const req = request.request; + if (!req) return callback(); - /** - * The tainted variables of this scope, as { Variable.name : - * boolean }. - * @member {Map} Scope#taints */ - this.taints = new Map(); + // The trailing slash indicates to PnP that this value is a folder rather than a file + const issuer = `${request.path}/`; - /** - * Generally, through the lexical scoping of JS you can always know - * which variable an identifier in the source code refers to. There are - * a few exceptions to this rule. With 'global' and 'with' scopes you - * can only decide at runtime which variable a reference refers to. - * Moreover, if 'eval()' is used in a scope, it might introduce new - * bindings in this or its parent scopes. - * All those scopes are considered 'dynamic'. - * @member {boolean} Scope#dynamic - */ - this.dynamic = this.type === "global" || this.type === "with"; + const packageMatch = /^(@[^/]+\/)?[^/]+/.exec(req); + if (!packageMatch) return callback(); - /** - * A reference to the scope-defining syntax node. - * @member {espree.Node} Scope#block - */ - this.block = block; + const packageName = packageMatch[0]; + const innerRequest = `.${req.slice(packageName.length)}`; - /** - * The {@link Reference|references} that are not resolved with this scope. - * @member {Reference[]} Scope#through - */ - this.through = []; + let resolution; + let apiResolution; + try { + resolution = this.pnpApi.resolveToUnqualified(packageName, issuer, { + considerBuiltins: false + }); + if (resolveContext.fileDependencies) { + apiResolution = this.pnpApi.resolveToUnqualified("pnpapi", issuer, { + considerBuiltins: false + }); + } + } catch (error) { + if ( + error.code === "MODULE_NOT_FOUND" && + error.pnpCode === "UNDECLARED_DEPENDENCY" + ) { + // This is not a PnP managed dependency. + // Try to continue resolving with our alternatives + if (resolveContext.log) { + resolveContext.log(`request is not managed by the pnpapi`); + for (const line of error.message.split("\n").filter(Boolean)) + resolveContext.log(` ${line}`); + } + return callback(); + } + return callback(error); + } - /** - * The scoped {@link Variable}s of this scope. In the case of a - * 'function' scope this includes the automatic argument arguments as - * its first element, as well as all further formal arguments. - * @member {Variable[]} Scope#variables - */ - this.variables = []; + if (resolution === packageName) return callback(); - /** - * Any variable {@link Reference|reference} found in this scope. This - * includes occurrences of local variables as well as variables from - * parent scopes (including the global scope). For local variables - * this also includes defining occurrences (like in a 'var' statement). - * In a 'function' scope this does not include the occurrences of the - * formal parameter in the parameter list. - * @member {Reference[]} Scope#references - */ - this.references = []; + if (apiResolution && resolveContext.fileDependencies) { + resolveContext.fileDependencies.add(apiResolution); + } - /** - * For 'global' and 'function' scopes, this is a self-reference. For - * other scope types this is the variableScope value of the - * parent scope. - * @member {Scope} Scope#variableScope - */ - this.variableScope = - (this.type === "global" || this.type === "function" || this.type === "module") ? this : upperScope.variableScope; + const obj = { + ...request, + path: resolution, + request: innerRequest, + ignoreSymlinks: true, + fullySpecified: request.fullySpecified && innerRequest !== "." + }; + resolver.doResolve( + target, + obj, + `resolved by pnp to ${resolution}`, + resolveContext, + (err, result) => { + if (err) return callback(err); + if (result) return callback(null, result); + // Skip alternatives + return callback(null, null); + } + ); + }); + } +}; - /** - * Whether this scope is created by a FunctionExpression. - * @member {boolean} Scope#functionExpressionScope - */ - this.functionExpressionScope = false; - /** - * Whether this is a scope that contains an 'eval()' invocation. - * @member {boolean} Scope#directCallToEvalScope - */ - this.directCallToEvalScope = false; +/***/ }), - /** - * @member {boolean} Scope#thisFound - */ - this.thisFound = false; +/***/ 37432: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - this.__left = []; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * Reference to the parent {@link Scope|scope}. - * @member {Scope} Scope#upper - */ - this.upper = upperScope; - /** - * Whether 'use strict' is in effect in this scope. - * @member {boolean} Scope#isStrict - */ - this.isStrict = isStrictScope(this, block, isMethodDefinition, scopeManager.__useDirective()); - /** - * List of nested {@link Scope}s. - * @member {Scope[]} Scope#childScopes - */ - this.childScopes = []; - if (this.upper) { - this.upper.childScopes.push(this); - } +const { AsyncSeriesBailHook, AsyncSeriesHook, SyncHook } = __webpack_require__(41242); +const createInnerContext = __webpack_require__(95478); +const { parseIdentifier } = __webpack_require__(7780); +const { + normalize, + cachedJoin: join, + getType, + PathType +} = __webpack_require__(3011); - this.__declaredVariables = scopeManager.__declaredVariables; +/** @typedef {import("./ResolverFactory").ResolveOptions} ResolveOptions */ - registerScope(scopeManager, this); - } +/** + * @typedef {Object} FileSystemStats + * @property {function(): boolean} isDirectory + * @property {function(): boolean} isFile + */ - __shouldStaticallyClose(scopeManager) { - return (!this.dynamic || scopeManager.__isOptimistic()); - } +/** + * @typedef {Object} FileSystemDirent + * @property {Buffer | string} name + * @property {function(): boolean} isDirectory + * @property {function(): boolean} isFile + */ - __shouldStaticallyCloseForGlobal(ref) { +/** + * @typedef {Object} PossibleFileSystemError + * @property {string=} code + * @property {number=} errno + * @property {string=} path + * @property {string=} syscall + */ - // On global scope, let/const/class declarations should be resolved statically. - const name = ref.identifier.name; +/** + * @template T + * @callback FileSystemCallback + * @param {PossibleFileSystemError & Error | null | undefined} err + * @param {T=} result + */ - if (!this.set.has(name)) { - return false; - } +/** + * @typedef {Object} FileSystem + * @property {(function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void} readFile + * @property {(function(string, FileSystemCallback<(Buffer | string)[] | FileSystemDirent[]>): void) & function(string, object, FileSystemCallback<(Buffer | string)[] | FileSystemDirent[]>): void} readdir + * @property {((function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void)=} readJson + * @property {(function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void} readlink + * @property {(function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void=} lstat + * @property {(function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void} stat + */ - const variable = this.set.get(name); - const defs = variable.defs; +/** + * @typedef {Object} SyncFileSystem + * @property {function(string, object=): Buffer | string} readFileSync + * @property {function(string, object=): (Buffer | string)[] | FileSystemDirent[]} readdirSync + * @property {(function(string, object=): object)=} readJsonSync + * @property {function(string, object=): Buffer | string} readlinkSync + * @property {function(string, object=): FileSystemStats=} lstatSync + * @property {function(string, object=): FileSystemStats} statSync + */ - return defs.length > 0 && defs.every(shouldBeStatically); - } +/** + * @typedef {Object} ParsedIdentifier + * @property {string} request + * @property {string} query + * @property {string} fragment + * @property {boolean} directory + * @property {boolean} module + * @property {boolean} file + * @property {boolean} internal + */ - __staticCloseRef(ref) { - if (!this.__resolve(ref)) { - this.__delegateToUpperScope(ref); - } - } +/** + * @typedef {Object} BaseResolveRequest + * @property {string | false} path + * @property {string=} descriptionFilePath + * @property {string=} descriptionFileRoot + * @property {object=} descriptionFileData + * @property {string=} relativePath + * @property {boolean=} ignoreSymlinks + * @property {boolean=} fullySpecified + */ - __dynamicCloseRef(ref) { +/** @typedef {BaseResolveRequest & Partial} ResolveRequest */ - // notify all names are through to global - let current = this; +/** + * String with special formatting + * @typedef {string} StackEntry + */ - do { - current.through.push(ref); - current = current.upper; - } while (current); - } +/** @template T @typedef {{ add: (T) => void }} WriteOnlySet */ - __globalCloseRef(ref) { +/** + * Resolve context + * @typedef {Object} ResolveContext + * @property {WriteOnlySet=} contextDependencies + * @property {WriteOnlySet=} fileDependencies files that was found on file system + * @property {WriteOnlySet=} missingDependencies dependencies that was not found on file system + * @property {Set=} stack set of hooks' calls. For instance, `resolve → parsedResolve → describedResolve`, + * @property {(function(string): void)=} log log function + * @property {(function (ResolveRequest): void)=} yield yield result, if provided plugins can return several results + */ - // let/const/class declarations should be resolved statically. - // others should be resolved dynamically. - if (this.__shouldStaticallyCloseForGlobal(ref)) { - this.__staticCloseRef(ref); - } else { - this.__dynamicCloseRef(ref); - } - } +/** @typedef {AsyncSeriesBailHook<[ResolveRequest, ResolveContext], ResolveRequest | null>} ResolveStepHook */ - __close(scopeManager) { - let closeRef; +/** + * @param {string} str input string + * @returns {string} in camel case + */ +function toCamelCase(str) { + return str.replace(/-([a-z])/g, str => str.substr(1).toUpperCase()); +} - if (this.__shouldStaticallyClose(scopeManager)) { - closeRef = this.__staticCloseRef; - } else if (this.type !== "global") { - closeRef = this.__dynamicCloseRef; - } else { - closeRef = this.__globalCloseRef; - } +class Resolver { + /** + * @param {ResolveStepHook} hook hook + * @param {ResolveRequest} request request + * @returns {StackEntry} stack entry + */ + static createStackEntry(hook, request) { + return ( + hook.name + + ": (" + + request.path + + ") " + + (request.request || "") + + (request.query || "") + + (request.fragment || "") + + (request.directory ? " directory" : "") + + (request.module ? " module" : "") + ); + } - // Try Resolving all references in this scope. - for (let i = 0, iz = this.__left.length; i < iz; ++i) { - const ref = this.__left[i]; + /** + * @param {FileSystem} fileSystem a filesystem + * @param {ResolveOptions} options options + */ + constructor(fileSystem, options) { + this.fileSystem = fileSystem; + this.options = options; + this.hooks = { + /** @type {SyncHook<[ResolveStepHook, ResolveRequest], void>} */ + resolveStep: new SyncHook(["hook", "request"], "resolveStep"), + /** @type {SyncHook<[ResolveRequest, Error]>} */ + noResolve: new SyncHook(["request", "error"], "noResolve"), + /** @type {ResolveStepHook} */ + resolve: new AsyncSeriesBailHook( + ["request", "resolveContext"], + "resolve" + ), + /** @type {AsyncSeriesHook<[ResolveRequest, ResolveContext]>} */ + result: new AsyncSeriesHook(["result", "resolveContext"], "result") + }; + } - closeRef.call(this, ref); - } - this.__left = null; + /** + * @param {string | ResolveStepHook} name hook name or hook itself + * @returns {ResolveStepHook} the hook + */ + ensureHook(name) { + if (typeof name !== "string") { + return name; + } + name = toCamelCase(name); + if (/^before/.test(name)) { + return /** @type {ResolveStepHook} */ (this.ensureHook( + name[6].toLowerCase() + name.substr(7) + ).withOptions({ + stage: -10 + })); + } + if (/^after/.test(name)) { + return /** @type {ResolveStepHook} */ (this.ensureHook( + name[5].toLowerCase() + name.substr(6) + ).withOptions({ + stage: 10 + })); + } + const hook = this.hooks[name]; + if (!hook) { + return (this.hooks[name] = new AsyncSeriesBailHook( + ["request", "resolveContext"], + name + )); + } + return hook; + } - return this.upper; - } - - // To override by function scopes. - // References in default parameters isn't resolved to variables which are in their function body. - __isValidResolution(ref, variable) { // eslint-disable-line class-methods-use-this, no-unused-vars - return true; - } + /** + * @param {string | ResolveStepHook} name hook name or hook itself + * @returns {ResolveStepHook} the hook + */ + getHook(name) { + if (typeof name !== "string") { + return name; + } + name = toCamelCase(name); + if (/^before/.test(name)) { + return /** @type {ResolveStepHook} */ (this.getHook( + name[6].toLowerCase() + name.substr(7) + ).withOptions({ + stage: -10 + })); + } + if (/^after/.test(name)) { + return /** @type {ResolveStepHook} */ (this.getHook( + name[5].toLowerCase() + name.substr(6) + ).withOptions({ + stage: 10 + })); + } + const hook = this.hooks[name]; + if (!hook) { + throw new Error(`Hook ${name} doesn't exist`); + } + return hook; + } - __resolve(ref) { - const name = ref.identifier.name; + /** + * @param {object} context context information object + * @param {string} path context path + * @param {string} request request string + * @returns {string | false} result + */ + resolveSync(context, path, request) { + /** @type {Error | null | undefined} */ + let err = undefined; + /** @type {string | false | undefined} */ + let result = undefined; + let sync = false; + this.resolve(context, path, request, {}, (e, r) => { + err = e; + result = r; + sync = true; + }); + if (!sync) { + throw new Error( + "Cannot 'resolveSync' because the fileSystem is not sync. Use 'resolve'!" + ); + } + if (err) throw err; + if (result === undefined) throw new Error("No result"); + return result; + } - if (!this.set.has(name)) { - return false; - } - const variable = this.set.get(name); + /** + * @param {object} context context information object + * @param {string} path context path + * @param {string} request request string + * @param {ResolveContext} resolveContext resolve context + * @param {function(Error | null, (string|false)=, ResolveRequest=): void} callback callback function + * @returns {void} + */ + resolve(context, path, request, resolveContext, callback) { + if (!context || typeof context !== "object") + return callback(new Error("context argument is not an object")); + if (typeof path !== "string") + return callback(new Error("path argument is not a string")); + if (typeof request !== "string") + return callback(new Error("path argument is not a string")); + if (!resolveContext) + return callback(new Error("resolveContext argument is not set")); - if (!this.__isValidResolution(ref, variable)) { - return false; - } - variable.references.push(ref); - variable.stack = variable.stack && ref.from.variableScope === this.variableScope; - if (ref.tainted) { - variable.tainted = true; - this.taints.set(variable.name, true); - } - ref.resolved = variable; + const obj = { + context: context, + path: path, + request: request + }; - return true; - } + let yield_; + let yieldCalled = false; + if (typeof resolveContext.yield === "function") { + const old = resolveContext.yield; + yield_ = obj => { + yieldCalled = true; + old(obj); + }; + } - __delegateToUpperScope(ref) { - if (this.upper) { - this.upper.__left.push(ref); - } - this.through.push(ref); - } + const message = `resolve '${request}' in '${path}'`; - __addDeclaredVariablesOfNode(variable, node) { - if (node === null || node === undefined) { - return; - } + const finishResolved = result => { + return callback( + null, + result.path === false + ? false + : `${result.path.replace(/#/g, "\0#")}${ + result.query ? result.query.replace(/#/g, "\0#") : "" + }${result.fragment || ""}`, + result + ); + }; - let variables = this.__declaredVariables.get(node); + const finishWithoutResolve = log => { + /** + * @type {Error & {details?: string}} + */ + const error = new Error("Can't " + message); + error.details = log.join("\n"); + this.hooks.noResolve.call(obj, error); + return callback(error); + }; - if (variables === null || variables === undefined) { - variables = []; - this.__declaredVariables.set(node, variables); - } - if (variables.indexOf(variable) === -1) { - variables.push(variable); - } - } + if (resolveContext.log) { + // We need log anyway to capture it in case of an error + const parentLog = resolveContext.log; + const log = []; + return this.doResolve( + this.hooks.resolve, + obj, + message, + { + log: msg => { + parentLog(msg); + log.push(msg); + }, + yield: yield_, + fileDependencies: resolveContext.fileDependencies, + contextDependencies: resolveContext.contextDependencies, + missingDependencies: resolveContext.missingDependencies, + stack: resolveContext.stack + }, + (err, result) => { + if (err) return callback(err); - __defineGeneric(name, set, variables, node, def) { - let variable; + if (result) return finishResolved(result); + if (yieldCalled) return callback(null); - variable = set.get(name); - if (!variable) { - variable = new Variable(name, this); - set.set(name, variable); - variables.push(variable); - } + return finishWithoutResolve(log); + } + ); + } else { + // Try to resolve assuming there is no error + // We don't log stuff in this case + return this.doResolve( + this.hooks.resolve, + obj, + message, + { + log: undefined, + yield: yield_, + fileDependencies: resolveContext.fileDependencies, + contextDependencies: resolveContext.contextDependencies, + missingDependencies: resolveContext.missingDependencies, + stack: resolveContext.stack + }, + (err, result) => { + if (err) return callback(err); - if (def) { - variable.defs.push(def); - this.__addDeclaredVariablesOfNode(variable, def.node); - this.__addDeclaredVariablesOfNode(variable, def.parent); - } - if (node) { - variable.identifiers.push(node); - } - } + if (result) return finishResolved(result); + if (yieldCalled) return callback(null); - __define(node, def) { - if (node && node.type === Syntax.Identifier) { - this.__defineGeneric( - node.name, - this.set, - this.variables, - node, - def - ); - } - } + // log is missing for the error details + // so we redo the resolving for the log info + // this is more expensive to the success case + // is assumed by default - __referencing(node, assign, writeExpr, maybeImplicitGlobal, partial, init) { + const log = []; - // because Array element may be null - if (!node || node.type !== Syntax.Identifier) { - return; - } + return this.doResolve( + this.hooks.resolve, + obj, + message, + { + log: msg => log.push(msg), + yield: yield_, + stack: resolveContext.stack + }, + err => { + if (err) return callback(err); - // Specially handle like `this`. - if (node.name === "super") { - return; - } + // In a case that there is a race condition and yield will be called + if (yieldCalled) return callback(null); - const ref = new Reference(node, this, assign || Reference.READ, writeExpr, maybeImplicitGlobal, !!partial, !!init); + return finishWithoutResolve(log); + } + ); + } + ); + } + } - this.references.push(ref); - this.__left.push(ref); - } + doResolve(hook, request, message, resolveContext, callback) { + const stackEntry = Resolver.createStackEntry(hook, request); - __detectEval() { - let current = this; + let newStack; + if (resolveContext.stack) { + newStack = new Set(resolveContext.stack); + if (resolveContext.stack.has(stackEntry)) { + /** + * Prevent recursion + * @type {Error & {recursion?: boolean}} + */ + const recursionError = new Error( + "Recursion in resolving\nStack:\n " + + Array.from(newStack).join("\n ") + ); + recursionError.recursion = true; + if (resolveContext.log) + resolveContext.log("abort resolving because of recursion"); + return callback(recursionError); + } + newStack.add(stackEntry); + } else { + newStack = new Set([stackEntry]); + } + this.hooks.resolveStep.call(hook, request); - this.directCallToEvalScope = true; - do { - current.dynamic = true; - current = current.upper; - } while (current); - } + if (hook.isUsed()) { + const innerContext = createInnerContext( + { + log: resolveContext.log, + yield: resolveContext.yield, + fileDependencies: resolveContext.fileDependencies, + contextDependencies: resolveContext.contextDependencies, + missingDependencies: resolveContext.missingDependencies, + stack: newStack + }, + message + ); + return hook.callAsync(request, innerContext, (err, result) => { + if (err) return callback(err); + if (result) return callback(null, result); + callback(); + }); + } else { + callback(); + } + } - __detectThis() { - this.thisFound = true; - } + /** + * @param {string} identifier identifier + * @returns {ParsedIdentifier} parsed identifier + */ + parse(identifier) { + const part = { + request: "", + query: "", + fragment: "", + module: false, + directory: false, + file: false, + internal: false + }; - __isClosed() { - return this.__left === null; - } + const parsedIdentifier = parseIdentifier(identifier); - /** - * returns resolved {Reference} - * @method Scope#resolve - * @param {Espree.Identifier} ident - identifier to be resolved. - * @returns {Reference} reference - */ - resolve(ident) { - let ref, i, iz; + if (!parsedIdentifier) return part; - assert(this.__isClosed(), "Scope should be closed."); - assert(ident.type === Syntax.Identifier, "Target should be identifier."); - for (i = 0, iz = this.references.length; i < iz; ++i) { - ref = this.references[i]; - if (ref.identifier === ident) { - return ref; - } - } - return null; - } + [part.request, part.query, part.fragment] = parsedIdentifier; - /** - * returns this scope is static - * @method Scope#isStatic - * @returns {boolean} static - */ - isStatic() { - return !this.dynamic; - } + if (part.request.length > 0) { + part.internal = this.isPrivate(identifier); + part.module = this.isModule(part.request); + part.directory = this.isDirectory(part.request); + if (part.directory) { + part.request = part.request.substr(0, part.request.length - 1); + } + } - /** - * returns this scope has materialized arguments - * @method Scope#isArgumentsMaterialized - * @returns {boolean} arguemnts materialized - */ - isArgumentsMaterialized() { // eslint-disable-line class-methods-use-this - return true; - } + return part; + } - /** - * returns this scope has materialized `this` reference - * @method Scope#isThisMaterialized - * @returns {boolean} this materialized - */ - isThisMaterialized() { // eslint-disable-line class-methods-use-this - return true; - } + isModule(path) { + return getType(path) === PathType.Normal; + } - isUsedName(name) { - if (this.set.has(name)) { - return true; - } - for (let i = 0, iz = this.through.length; i < iz; ++i) { - if (this.through[i].identifier.name === name) { - return true; - } - } - return false; - } -} + isPrivate(path) { + return getType(path) === PathType.Internal; + } -class GlobalScope extends Scope { - constructor(scopeManager, block) { - super(scopeManager, "global", null, block, false); - this.implicit = { - set: new Map(), - variables: [], + /** + * @param {string} path a path + * @returns {boolean} true, if the path is a directory path + */ + isDirectory(path) { + return path.endsWith("/"); + } - /** - * List of {@link Reference}s that are left to be resolved (i.e. which - * need to be linked to the variable they refer to). - * @member {Reference[]} Scope#implicit#left - */ - left: [] - }; - } + join(path, request) { + return join(path, request); + } - __close(scopeManager) { - const implicit = []; + normalize(path) { + return normalize(path); + } +} - for (let i = 0, iz = this.__left.length; i < iz; ++i) { - const ref = this.__left[i]; +module.exports = Resolver; - if (ref.__maybeImplicitGlobal && !this.set.has(ref.identifier.name)) { - implicit.push(ref.__maybeImplicitGlobal); - } - } - // create an implicit global variable from assignment expression - for (let i = 0, iz = implicit.length; i < iz; ++i) { - const info = implicit[i]; +/***/ }), - this.__defineImplicit(info.pattern, - new Definition( - Variable.ImplicitGlobalVariable, - info.pattern, - info.node, - null, - null, - null - )); +/***/ 53990: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - this.implicit.left = this.__left; - return super.__close(scopeManager); - } - __defineImplicit(node, def) { - if (node && node.type === Syntax.Identifier) { - this.__defineGeneric( - node.name, - this.implicit.set, - this.implicit.variables, - node, - def - ); - } - } -} +const versions = (__webpack_require__(77282).versions); +const Resolver = __webpack_require__(37432); +const { getType, PathType } = __webpack_require__(3011); + +const SyncAsyncFileSystemDecorator = __webpack_require__(57746); + +const AliasFieldPlugin = __webpack_require__(42752); +const AliasPlugin = __webpack_require__(51547); +const AppendPlugin = __webpack_require__(66477); +const ConditionalPlugin = __webpack_require__(44193); +const DescriptionFilePlugin = __webpack_require__(66826); +const DirectoryExistsPlugin = __webpack_require__(73688); +const ExportsFieldPlugin = __webpack_require__(80163); +const FileExistsPlugin = __webpack_require__(98699); +const ImportsFieldPlugin = __webpack_require__(86058); +const JoinRequestPartPlugin = __webpack_require__(20879); +const JoinRequestPlugin = __webpack_require__(71474); +const MainFieldPlugin = __webpack_require__(73507); +const ModulesInHierarchicalDirectoriesPlugin = __webpack_require__(32942); +const ModulesInRootPlugin = __webpack_require__(48952); +const NextPlugin = __webpack_require__(79135); +const ParsePlugin = __webpack_require__(15234); +const PnpPlugin = __webpack_require__(71488); +const RestrictionsPlugin = __webpack_require__(39222); +const ResultPlugin = __webpack_require__(10615); +const RootsPlugin = __webpack_require__(34403); +const SelfReferencePlugin = __webpack_require__(32317); +const SymlinkPlugin = __webpack_require__(21300); +const TryNextPlugin = __webpack_require__(16442); +const UnsafeCachePlugin = __webpack_require__(3501); +const UseFilePlugin = __webpack_require__(50318); -class ModuleScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "module", upperScope, block, false); - } -} +/** @typedef {import("./AliasPlugin").AliasOption} AliasOptionEntry */ +/** @typedef {import("./PnpPlugin").PnpApiImpl} PnpApi */ +/** @typedef {import("./Resolver").FileSystem} FileSystem */ +/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ +/** @typedef {import("./Resolver").SyncFileSystem} SyncFileSystem */ -class FunctionExpressionNameScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "function-expression-name", upperScope, block, false); - this.__define(block.id, - new Definition( - Variable.FunctionName, - block.id, - block, - null, - null, - null - )); - this.functionExpressionScope = true; - } -} +/** @typedef {string|string[]|false} AliasOptionNewRequest */ +/** @typedef {{[k: string]: AliasOptionNewRequest}} AliasOptions */ +/** @typedef {{apply: function(Resolver): void} | function(this: Resolver, Resolver): void} Plugin */ -class CatchScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "catch", upperScope, block, false); - } -} +/** + * @typedef {Object} UserResolveOptions + * @property {(AliasOptions | AliasOptionEntry[])=} alias A list of module alias configurations or an object which maps key to value + * @property {(AliasOptions | AliasOptionEntry[])=} fallback A list of module alias configurations or an object which maps key to value, applied only after modules option + * @property {(string | string[])[]=} aliasFields A list of alias fields in description files + * @property {(function(ResolveRequest): boolean)=} cachePredicate A function which decides whether a request should be cached or not. An object is passed with at least `path` and `request` properties. + * @property {boolean=} cacheWithContext Whether or not the unsafeCache should include request context as part of the cache key. + * @property {string[]=} descriptionFiles A list of description files to read from + * @property {string[]=} conditionNames A list of exports field condition names. + * @property {boolean=} enforceExtension Enforce that a extension from extensions must be used + * @property {(string | string[])[]=} exportsFields A list of exports fields in description files + * @property {(string | string[])[]=} importsFields A list of imports fields in description files + * @property {string[]=} extensions A list of extensions which should be tried for files + * @property {FileSystem} fileSystem The file system which should be used + * @property {(object | boolean)=} unsafeCache Use this cache object to unsafely cache the successful requests + * @property {boolean=} symlinks Resolve symlinks to their symlinked location + * @property {Resolver=} resolver A prepared Resolver to which the plugins are attached + * @property {string[] | string=} modules A list of directories to resolve modules from, can be absolute path or folder name + * @property {(string | string[] | {name: string | string[], forceRelative: boolean})[]=} mainFields A list of main fields in description files + * @property {string[]=} mainFiles A list of main files in directories + * @property {Plugin[]=} plugins A list of additional resolve plugins which should be applied + * @property {PnpApi | null=} pnpApi A PnP API that should be used - null is "never", undefined is "auto" + * @property {string[]=} roots A list of root paths + * @property {boolean=} fullySpecified The request is already fully specified and no extensions or directories are resolved for it + * @property {boolean=} resolveToContext Resolve to a context instead of a file + * @property {(string|RegExp)[]=} restrictions A list of resolve restrictions + * @property {boolean=} useSyncFileSystemCalls Use only the sync constraints of the file system calls + * @property {boolean=} preferRelative Prefer to resolve module requests as relative requests before falling back to modules + * @property {boolean=} preferAbsolute Prefer to resolve server-relative urls as absolute paths before falling back to resolve in roots + */ -class WithScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "with", upperScope, block, false); - } +/** + * @typedef {Object} ResolveOptions + * @property {AliasOptionEntry[]} alias + * @property {AliasOptionEntry[]} fallback + * @property {Set} aliasFields + * @property {(function(ResolveRequest): boolean)} cachePredicate + * @property {boolean} cacheWithContext + * @property {Set} conditionNames A list of exports field condition names. + * @property {string[]} descriptionFiles + * @property {boolean} enforceExtension + * @property {Set} exportsFields + * @property {Set} importsFields + * @property {Set} extensions + * @property {FileSystem} fileSystem + * @property {object | false} unsafeCache + * @property {boolean} symlinks + * @property {Resolver=} resolver + * @property {Array} modules + * @property {{name: string[], forceRelative: boolean}[]} mainFields + * @property {Set} mainFiles + * @property {Plugin[]} plugins + * @property {PnpApi | null} pnpApi + * @property {Set} roots + * @property {boolean} fullySpecified + * @property {boolean} resolveToContext + * @property {Set} restrictions + * @property {boolean} preferRelative + * @property {boolean} preferAbsolute + */ - __close(scopeManager) { - if (this.__shouldStaticallyClose(scopeManager)) { - return super.__close(scopeManager); - } +/** + * @param {PnpApi | null=} option option + * @returns {PnpApi | null} processed option + */ +function processPnpApiOption(option) { + if ( + option === undefined && + /** @type {NodeJS.ProcessVersions & {pnp: string}} */ versions.pnp + ) { + // @ts-ignore + return __webpack_require__(35125); // eslint-disable-line node/no-missing-require + } - for (let i = 0, iz = this.__left.length; i < iz; ++i) { - const ref = this.__left[i]; + return option || null; +} - ref.tainted = true; - this.__delegateToUpperScope(ref); - } - this.__left = null; +/** + * @param {AliasOptions | AliasOptionEntry[] | undefined} alias alias + * @returns {AliasOptionEntry[]} normalized aliases + */ +function normalizeAlias(alias) { + return typeof alias === "object" && !Array.isArray(alias) && alias !== null + ? Object.keys(alias).map(key => { + /** @type {AliasOptionEntry} */ + const obj = { name: key, onlyModule: false, alias: alias[key] }; - return this.upper; - } -} + if (/\$$/.test(key)) { + obj.onlyModule = true; + obj.name = key.substr(0, key.length - 1); + } -class BlockScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "block", upperScope, block, false); - } + return obj; + }) + : /** @type {Array} */ (alias) || []; } -class SwitchScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "switch", upperScope, block, false); - } -} +/** + * @param {UserResolveOptions} options input options + * @returns {ResolveOptions} output options + */ +function createOptions(options) { + const mainFieldsSet = new Set(options.mainFields || ["main"]); + const mainFields = []; -class FunctionScope extends Scope { - constructor(scopeManager, upperScope, block, isMethodDefinition) { - super(scopeManager, "function", upperScope, block, isMethodDefinition); + for (const item of mainFieldsSet) { + if (typeof item === "string") { + mainFields.push({ + name: [item], + forceRelative: true + }); + } else if (Array.isArray(item)) { + mainFields.push({ + name: item, + forceRelative: true + }); + } else { + mainFields.push({ + name: Array.isArray(item.name) ? item.name : [item.name], + forceRelative: item.forceRelative + }); + } + } - // section 9.2.13, FunctionDeclarationInstantiation. - // NOTE Arrow functions never have an arguments objects. - if (this.block.type !== Syntax.ArrowFunctionExpression) { - this.__defineArguments(); - } - } + return { + alias: normalizeAlias(options.alias), + fallback: normalizeAlias(options.fallback), + aliasFields: new Set(options.aliasFields), + cachePredicate: + options.cachePredicate || + function () { + return true; + }, + cacheWithContext: + typeof options.cacheWithContext !== "undefined" + ? options.cacheWithContext + : true, + exportsFields: new Set(options.exportsFields || ["exports"]), + importsFields: new Set(options.importsFields || ["imports"]), + conditionNames: new Set(options.conditionNames), + descriptionFiles: Array.from( + new Set(options.descriptionFiles || ["package.json"]) + ), + enforceExtension: + options.enforceExtension === undefined + ? options.extensions && options.extensions.includes("") + ? true + : false + : options.enforceExtension, + extensions: new Set(options.extensions || [".js", ".json", ".node"]), + fileSystem: options.useSyncFileSystemCalls + ? new SyncAsyncFileSystemDecorator( + /** @type {SyncFileSystem} */ ( + /** @type {unknown} */ (options.fileSystem) + ) + ) + : options.fileSystem, + unsafeCache: + options.unsafeCache && typeof options.unsafeCache !== "object" + ? {} + : options.unsafeCache || false, + symlinks: typeof options.symlinks !== "undefined" ? options.symlinks : true, + resolver: options.resolver, + modules: mergeFilteredToArray( + Array.isArray(options.modules) + ? options.modules + : options.modules + ? [options.modules] + : ["node_modules"], + item => { + const type = getType(item); + return type === PathType.Normal || type === PathType.Relative; + } + ), + mainFields, + mainFiles: new Set(options.mainFiles || ["index"]), + plugins: options.plugins || [], + pnpApi: processPnpApiOption(options.pnpApi), + roots: new Set(options.roots || undefined), + fullySpecified: options.fullySpecified || false, + resolveToContext: options.resolveToContext || false, + preferRelative: options.preferRelative || false, + preferAbsolute: options.preferAbsolute || false, + restrictions: new Set(options.restrictions) + }; +} - isArgumentsMaterialized() { +/** + * @param {UserResolveOptions} options resolve options + * @returns {Resolver} created resolver + */ +exports.createResolver = function (options) { + const normalizedOptions = createOptions(options); - // TODO(Constellation) - // We can more aggressive on this condition like this. - // - // function t() { - // // arguments of t is always hidden. - // function arguments() { - // } - // } - if (this.block.type === Syntax.ArrowFunctionExpression) { - return false; - } + const { + alias, + fallback, + aliasFields, + cachePredicate, + cacheWithContext, + conditionNames, + descriptionFiles, + enforceExtension, + exportsFields, + importsFields, + extensions, + fileSystem, + fullySpecified, + mainFields, + mainFiles, + modules, + plugins: userPlugins, + pnpApi, + resolveToContext, + preferRelative, + preferAbsolute, + symlinks, + unsafeCache, + resolver: customResolver, + restrictions, + roots + } = normalizedOptions; - if (!this.isStatic()) { - return true; - } + const plugins = userPlugins.slice(); - const variable = this.set.get("arguments"); + const resolver = customResolver + ? customResolver + : new Resolver(fileSystem, normalizedOptions); - assert(variable, "Always have arguments variable."); - return variable.tainted || variable.references.length !== 0; - } + //// pipeline //// - isThisMaterialized() { - if (!this.isStatic()) { - return true; - } - return this.thisFound; - } + resolver.ensureHook("resolve"); + resolver.ensureHook("internalResolve"); + resolver.ensureHook("newInternalResolve"); + resolver.ensureHook("parsedResolve"); + resolver.ensureHook("describedResolve"); + resolver.ensureHook("internal"); + resolver.ensureHook("rawModule"); + resolver.ensureHook("module"); + resolver.ensureHook("resolveAsModule"); + resolver.ensureHook("undescribedResolveInPackage"); + resolver.ensureHook("resolveInPackage"); + resolver.ensureHook("resolveInExistingDirectory"); + resolver.ensureHook("relative"); + resolver.ensureHook("describedRelative"); + resolver.ensureHook("directory"); + resolver.ensureHook("undescribedExistingDirectory"); + resolver.ensureHook("existingDirectory"); + resolver.ensureHook("undescribedRawFile"); + resolver.ensureHook("rawFile"); + resolver.ensureHook("file"); + resolver.ensureHook("finalFile"); + resolver.ensureHook("existingFile"); + resolver.ensureHook("resolved"); - __defineArguments() { - this.__defineGeneric( - "arguments", - this.set, - this.variables, - null, - null - ); - this.taints.set("arguments", true); - } + // TODO remove in next major + // cspell:word Interal + // Backward-compat + resolver.hooks.newInteralResolve = resolver.hooks.newInternalResolve; - // References in default parameters isn't resolved to variables which are in their function body. - // const x = 1 - // function f(a = x) { // This `x` is resolved to the `x` in the outer scope. - // const x = 2 - // console.log(a) - // } - __isValidResolution(ref, variable) { + // resolve + for (const { source, resolveOptions } of [ + { source: "resolve", resolveOptions: { fullySpecified } }, + { source: "internal-resolve", resolveOptions: { fullySpecified: false } } + ]) { + if (unsafeCache) { + plugins.push( + new UnsafeCachePlugin( + source, + cachePredicate, + unsafeCache, + cacheWithContext, + `new-${source}` + ) + ); + plugins.push( + new ParsePlugin(`new-${source}`, resolveOptions, "parsed-resolve") + ); + } else { + plugins.push(new ParsePlugin(source, resolveOptions, "parsed-resolve")); + } + } - // If `options.nodejsScope` is true, `this.block` becomes a Program node. - if (this.block.type === "Program") { - return true; - } + // parsed-resolve + plugins.push( + new DescriptionFilePlugin( + "parsed-resolve", + descriptionFiles, + false, + "described-resolve" + ) + ); + plugins.push(new NextPlugin("after-parsed-resolve", "described-resolve")); - const bodyStart = this.block.body.range[0]; + // described-resolve + plugins.push(new NextPlugin("described-resolve", "normal-resolve")); + if (fallback.length > 0) { + plugins.push( + new AliasPlugin("described-resolve", fallback, "internal-resolve") + ); + } - // It's invalid resolution in the following case: - return !( - variable.scope === this && - ref.identifier.range[0] < bodyStart && // the reference is in the parameter part. - variable.defs.every(d => d.name.range[0] >= bodyStart) // the variable is in the body. - ); - } -} + // normal-resolve + if (alias.length > 0) + plugins.push(new AliasPlugin("normal-resolve", alias, "internal-resolve")); + aliasFields.forEach(item => { + plugins.push( + new AliasFieldPlugin("normal-resolve", item, "internal-resolve") + ); + }); + if (preferRelative) { + plugins.push(new JoinRequestPlugin("after-normal-resolve", "relative")); + } + plugins.push( + new ConditionalPlugin( + "after-normal-resolve", + { module: true }, + "resolve as module", + false, + "raw-module" + ) + ); + plugins.push( + new ConditionalPlugin( + "after-normal-resolve", + { internal: true }, + "resolve as internal import", + false, + "internal" + ) + ); + if (preferAbsolute) { + plugins.push(new JoinRequestPlugin("after-normal-resolve", "relative")); + } + if (roots.size > 0) { + plugins.push(new RootsPlugin("after-normal-resolve", roots, "relative")); + } + if (!preferRelative && !preferAbsolute) { + plugins.push(new JoinRequestPlugin("after-normal-resolve", "relative")); + } -class ForScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "for", upperScope, block, false); - } -} + // internal + importsFields.forEach(importsField => { + plugins.push( + new ImportsFieldPlugin( + "internal", + conditionNames, + importsField, + "relative", + "internal-resolve" + ) + ); + }); -class ClassScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "class", upperScope, block, false); - } -} + // raw-module + exportsFields.forEach(exportsField => { + plugins.push( + new SelfReferencePlugin("raw-module", exportsField, "resolve-as-module") + ); + }); + modules.forEach(item => { + if (Array.isArray(item)) { + if (item.includes("node_modules") && pnpApi) { + plugins.push( + new ModulesInHierarchicalDirectoriesPlugin( + "raw-module", + item.filter(i => i !== "node_modules"), + "module" + ) + ); + plugins.push( + new PnpPlugin("raw-module", pnpApi, "undescribed-resolve-in-package") + ); + } else { + plugins.push( + new ModulesInHierarchicalDirectoriesPlugin( + "raw-module", + item, + "module" + ) + ); + } + } else { + plugins.push(new ModulesInRootPlugin("raw-module", item, "module")); + } + }); -module.exports = { - Scope, - GlobalScope, - ModuleScope, - FunctionExpressionNameScope, - CatchScope, - WithScope, - BlockScope, - SwitchScope, - FunctionScope, - ForScope, - ClassScope -}; + // module + plugins.push(new JoinRequestPartPlugin("module", "resolve-as-module")); -/* vim: set sw=4 ts=4 et tw=80 : */ + // resolve-as-module + if (!resolveToContext) { + plugins.push( + new ConditionalPlugin( + "resolve-as-module", + { directory: false, request: "." }, + "single file module", + true, + "undescribed-raw-file" + ) + ); + } + plugins.push( + new DirectoryExistsPlugin( + "resolve-as-module", + "undescribed-resolve-in-package" + ) + ); + // undescribed-resolve-in-package + plugins.push( + new DescriptionFilePlugin( + "undescribed-resolve-in-package", + descriptionFiles, + false, + "resolve-in-package" + ) + ); + plugins.push( + new NextPlugin("after-undescribed-resolve-in-package", "resolve-in-package") + ); -/***/ }), + // resolve-in-package + exportsFields.forEach(exportsField => { + plugins.push( + new ExportsFieldPlugin( + "resolve-in-package", + conditionNames, + exportsField, + "relative" + ) + ); + }); + plugins.push( + new NextPlugin("resolve-in-package", "resolve-in-existing-directory") + ); -/***/ 82971: -/***/ (function(module) { + // resolve-in-existing-directory + plugins.push( + new JoinRequestPlugin("resolve-in-existing-directory", "relative") + ); -"use strict"; -/* - Copyright (C) 2015 Yusuke Suzuki + // relative + plugins.push( + new DescriptionFilePlugin( + "relative", + descriptionFiles, + true, + "described-relative" + ) + ); + plugins.push(new NextPlugin("after-relative", "described-relative")); - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + // described-relative + if (resolveToContext) { + plugins.push(new NextPlugin("described-relative", "directory")); + } else { + plugins.push( + new ConditionalPlugin( + "described-relative", + { directory: false }, + null, + true, + "raw-file" + ) + ); + plugins.push( + new ConditionalPlugin( + "described-relative", + { fullySpecified: false }, + "as directory", + true, + "directory" + ) + ); + } - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + // directory + plugins.push( + new DirectoryExistsPlugin("directory", "undescribed-existing-directory") + ); - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ + if (resolveToContext) { + // undescribed-existing-directory + plugins.push(new NextPlugin("undescribed-existing-directory", "resolved")); + } else { + // undescribed-existing-directory + plugins.push( + new DescriptionFilePlugin( + "undescribed-existing-directory", + descriptionFiles, + false, + "existing-directory" + ) + ); + mainFiles.forEach(item => { + plugins.push( + new UseFilePlugin( + "undescribed-existing-directory", + item, + "undescribed-raw-file" + ) + ); + }); + // described-existing-directory + mainFields.forEach(item => { + plugins.push( + new MainFieldPlugin( + "existing-directory", + item, + "resolve-in-existing-directory" + ) + ); + }); + mainFiles.forEach(item => { + plugins.push( + new UseFilePlugin("existing-directory", item, "undescribed-raw-file") + ); + }); -/** - * A Variable represents a locally scoped identifier. These include arguments to - * functions. - * @class Variable - */ -class Variable { - constructor(name, scope) { + // undescribed-raw-file + plugins.push( + new DescriptionFilePlugin( + "undescribed-raw-file", + descriptionFiles, + true, + "raw-file" + ) + ); + plugins.push(new NextPlugin("after-undescribed-raw-file", "raw-file")); - /** - * The variable name, as given in the source code. - * @member {String} Variable#name - */ - this.name = name; + // raw-file + plugins.push( + new ConditionalPlugin( + "raw-file", + { fullySpecified: true }, + null, + false, + "file" + ) + ); + if (!enforceExtension) { + plugins.push(new TryNextPlugin("raw-file", "no extension", "file")); + } + extensions.forEach(item => { + plugins.push(new AppendPlugin("raw-file", item, "file")); + }); - /** - * List of defining occurrences of this variable (like in 'var ...' - * statements or as parameter), as AST nodes. - * @member {espree.Identifier[]} Variable#identifiers - */ - this.identifiers = []; + // file + if (alias.length > 0) + plugins.push(new AliasPlugin("file", alias, "internal-resolve")); + aliasFields.forEach(item => { + plugins.push(new AliasFieldPlugin("file", item, "internal-resolve")); + }); + plugins.push(new NextPlugin("file", "final-file")); - /** - * List of {@link Reference|references} of this variable (excluding parameter entries) - * in its defining scope and all nested scopes. For defining - * occurrences only see {@link Variable#defs}. - * @member {Reference[]} Variable#references - */ - this.references = []; + // final-file + plugins.push(new FileExistsPlugin("final-file", "existing-file")); - /** - * List of defining occurrences of this variable (like in 'var ...' - * statements or as parameter), as custom objects. - * @member {Definition[]} Variable#defs - */ - this.defs = []; + // existing-file + if (symlinks) + plugins.push(new SymlinkPlugin("existing-file", "existing-file")); + plugins.push(new NextPlugin("existing-file", "resolved")); + } - this.tainted = false; + // resolved + if (restrictions.size > 0) { + plugins.push(new RestrictionsPlugin(resolver.hooks.resolved, restrictions)); + } + plugins.push(new ResultPlugin(resolver.hooks.resolved)); - /** - * Whether this is a stack variable. - * @member {boolean} Variable#stack - */ - this.stack = true; + //// RESOLVER //// - /** - * Reference to the enclosing Scope. - * @member {Scope} Variable#scope - */ - this.scope = scope; - } -} + for (const plugin of plugins) { + if (typeof plugin === "function") { + plugin.call(resolver, resolver); + } else { + plugin.apply(resolver); + } + } -Variable.CatchClause = "CatchClause"; -Variable.Parameter = "Parameter"; -Variable.FunctionName = "FunctionName"; -Variable.ClassName = "ClassName"; -Variable.Variable = "Variable"; -Variable.ImportBinding = "ImportBinding"; -Variable.ImplicitGlobalVariable = "ImplicitGlobalVariable"; + return resolver; +}; -module.exports = Variable; +/** + * Merging filtered elements + * @param {string[]} array source array + * @param {function(string): boolean} filter predicate + * @returns {Array} merge result + */ +function mergeFilteredToArray(array, filter) { + /** @type {Array} */ + const result = []; + const set = new Set(array); -/* vim: set sw=4 ts=4 et tw=80 : */ + for (const item of set) { + if (filter(item)) { + const lastElement = + result.length > 0 ? result[result.length - 1] : undefined; + if (Array.isArray(lastElement)) { + lastElement.push(item); + } else { + result.push([item]); + } + } else { + result.push(item); + } + } + + return result; +} /***/ }), -/***/ 81217: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 39222: +/***/ (function(module) { +"use strict"; /* - Copyright (C) 2014 Yusuke Suzuki + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -(function () { - 'use strict'; +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - var estraverse = __webpack_require__(50165); +const slashCode = "/".charCodeAt(0); +const backslashCode = "\\".charCodeAt(0); - function isNode(node) { - if (node == null) { - return false; - } - return typeof node === 'object' && typeof node.type === 'string'; - } +const isInside = (path, parent) => { + if (!path.startsWith(parent)) return false; + if (path.length === parent.length) return true; + const charCode = path.charCodeAt(parent.length); + return charCode === slashCode || charCode === backslashCode; +}; - function isProperty(nodeType, key) { - return (nodeType === estraverse.Syntax.ObjectExpression || nodeType === estraverse.Syntax.ObjectPattern) && key === 'properties'; - } +module.exports = class RestrictionsPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {Set} restrictions restrictions + */ + constructor(source, restrictions) { + this.source = source; + this.restrictions = restrictions; + } - function Visitor(visitor, options) { - options = options || {}; + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + resolver + .getHook(this.source) + .tapAsync("RestrictionsPlugin", (request, resolveContext, callback) => { + if (typeof request.path === "string") { + const path = request.path; + for (const rule of this.restrictions) { + if (typeof rule === "string") { + if (!isInside(path, rule)) { + if (resolveContext.log) { + resolveContext.log( + `${path} is not inside of the restriction ${rule}` + ); + } + return callback(null, null); + } + } else if (!rule.test(path)) { + if (resolveContext.log) { + resolveContext.log( + `${path} doesn't match the restriction ${rule}` + ); + } + return callback(null, null); + } + } + } - this.__visitor = visitor || this; - this.__childVisitorKeys = options.childVisitorKeys - ? Object.assign({}, estraverse.VisitorKeys, options.childVisitorKeys) - : estraverse.VisitorKeys; - if (options.fallback === 'iteration') { - this.__fallback = Object.keys; - } else if (typeof options.fallback === 'function') { - this.__fallback = options.fallback; - } - } + callback(); + }); + } +}; - /* Default method for visiting children. - * When you need to call default visiting operation inside custom visiting - * operation, you can use it with `this.visitChildren(node)`. - */ - Visitor.prototype.visitChildren = function (node) { - var type, children, i, iz, j, jz, child; - if (node == null) { - return; - } +/***/ }), - type = node.type || estraverse.Syntax.Property; +/***/ 10615: +/***/ (function(module) { - children = this.__childVisitorKeys[type]; - if (!children) { - if (this.__fallback) { - children = this.__fallback(node); - } else { - throw new Error('Unknown node type ' + type + '.'); - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - for (i = 0, iz = children.length; i < iz; ++i) { - child = node[children[i]]; - if (child) { - if (Array.isArray(child)) { - for (j = 0, jz = child.length; j < jz; ++j) { - if (child[j]) { - if (isNode(child[j]) || isProperty(type, children[i])) { - this.visit(child[j]); - } - } - } - } else if (isNode(child)) { - this.visit(child); - } - } - } - }; - /* Dispatching node. */ - Visitor.prototype.visit = function (node) { - var type; - if (node == null) { - return; - } +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - type = node.type || estraverse.Syntax.Property; - if (this.__visitor[type]) { - this.__visitor[type].call(this, node); - return; - } - this.visitChildren(node); - }; +module.exports = class ResultPlugin { + /** + * @param {ResolveStepHook} source source + */ + constructor(source) { + this.source = source; + } - exports.version = __webpack_require__(12166).version; - exports.Visitor = Visitor; - exports.visit = function (node, visitor, options) { - var v = new Visitor(visitor, options); - v.visit(node); - }; -}()); -/* vim: set sw=4 ts=4 et tw=80 : */ + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + this.source.tapAsync( + "ResultPlugin", + (request, resolverContext, callback) => { + const obj = { ...request }; + if (resolverContext.log) + resolverContext.log("reporting result " + obj.path); + resolver.hooks.result.callAsync(obj, resolverContext, err => { + if (err) return callback(err); + if (typeof resolverContext.yield === "function") { + resolverContext.yield(obj); + callback(null, null); + } else { + callback(null, obj); + } + }); + } + ); + } +}; /***/ }), -/***/ 50165: -/***/ (function(__unused_webpack_module, exports) { +/***/ 34403: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +"use strict"; /* - Copyright (C) 2012-2013 Yusuke Suzuki - Copyright (C) 2012 Ariya Hidayat - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop */ -/*jslint vars:false, bitwise:true*/ -/*jshint indent:4*/ -/*global exports:true*/ -(function clone(exports) { - 'use strict'; - - var Syntax, - VisitorOption, - VisitorKeys, - BREAK, - SKIP, - REMOVE; - function deepCopy(obj) { - var ret = {}, key, val; - for (key in obj) { - if (obj.hasOwnProperty(key)) { - val = obj[key]; - if (typeof val === 'object' && val !== null) { - ret[key] = deepCopy(val); - } else { - ret[key] = val; - } - } - } - return ret; - } - // based on LLVM libc++ upper_bound / lower_bound - // MIT License - function upperBound(array, func) { - var diff, len, i, current; +const forEachBail = __webpack_require__(8266); - len = array.length; - i = 0; +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - while (len) { - diff = len >>> 1; - current = i + diff; - if (func(array[current])) { - len = diff; - } else { - i = current + 1; - len -= diff + 1; - } - } - return i; - } - - Syntax = { - AssignmentExpression: 'AssignmentExpression', - AssignmentPattern: 'AssignmentPattern', - ArrayExpression: 'ArrayExpression', - ArrayPattern: 'ArrayPattern', - ArrowFunctionExpression: 'ArrowFunctionExpression', - AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7. - BlockStatement: 'BlockStatement', - BinaryExpression: 'BinaryExpression', - BreakStatement: 'BreakStatement', - CallExpression: 'CallExpression', - CatchClause: 'CatchClause', - ChainExpression: 'ChainExpression', - ClassBody: 'ClassBody', - ClassDeclaration: 'ClassDeclaration', - ClassExpression: 'ClassExpression', - ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7. - ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7. - ConditionalExpression: 'ConditionalExpression', - ContinueStatement: 'ContinueStatement', - DebuggerStatement: 'DebuggerStatement', - DirectiveStatement: 'DirectiveStatement', - DoWhileStatement: 'DoWhileStatement', - EmptyStatement: 'EmptyStatement', - ExportAllDeclaration: 'ExportAllDeclaration', - ExportDefaultDeclaration: 'ExportDefaultDeclaration', - ExportNamedDeclaration: 'ExportNamedDeclaration', - ExportSpecifier: 'ExportSpecifier', - ExpressionStatement: 'ExpressionStatement', - ForStatement: 'ForStatement', - ForInStatement: 'ForInStatement', - ForOfStatement: 'ForOfStatement', - FunctionDeclaration: 'FunctionDeclaration', - FunctionExpression: 'FunctionExpression', - GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7. - Identifier: 'Identifier', - IfStatement: 'IfStatement', - ImportExpression: 'ImportExpression', - ImportDeclaration: 'ImportDeclaration', - ImportDefaultSpecifier: 'ImportDefaultSpecifier', - ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', - ImportSpecifier: 'ImportSpecifier', - Literal: 'Literal', - LabeledStatement: 'LabeledStatement', - LogicalExpression: 'LogicalExpression', - MemberExpression: 'MemberExpression', - MetaProperty: 'MetaProperty', - MethodDefinition: 'MethodDefinition', - ModuleSpecifier: 'ModuleSpecifier', - NewExpression: 'NewExpression', - ObjectExpression: 'ObjectExpression', - ObjectPattern: 'ObjectPattern', - Program: 'Program', - Property: 'Property', - RestElement: 'RestElement', - ReturnStatement: 'ReturnStatement', - SequenceExpression: 'SequenceExpression', - SpreadElement: 'SpreadElement', - Super: 'Super', - SwitchStatement: 'SwitchStatement', - SwitchCase: 'SwitchCase', - TaggedTemplateExpression: 'TaggedTemplateExpression', - TemplateElement: 'TemplateElement', - TemplateLiteral: 'TemplateLiteral', - ThisExpression: 'ThisExpression', - ThrowStatement: 'ThrowStatement', - TryStatement: 'TryStatement', - UnaryExpression: 'UnaryExpression', - UpdateExpression: 'UpdateExpression', - VariableDeclaration: 'VariableDeclaration', - VariableDeclarator: 'VariableDeclarator', - WhileStatement: 'WhileStatement', - WithStatement: 'WithStatement', - YieldExpression: 'YieldExpression' - }; - - VisitorKeys = { - AssignmentExpression: ['left', 'right'], - AssignmentPattern: ['left', 'right'], - ArrayExpression: ['elements'], - ArrayPattern: ['elements'], - ArrowFunctionExpression: ['params', 'body'], - AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7. - BlockStatement: ['body'], - BinaryExpression: ['left', 'right'], - BreakStatement: ['label'], - CallExpression: ['callee', 'arguments'], - CatchClause: ['param', 'body'], - ChainExpression: ['expression'], - ClassBody: ['body'], - ClassDeclaration: ['id', 'superClass', 'body'], - ClassExpression: ['id', 'superClass', 'body'], - ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7. - ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. - ConditionalExpression: ['test', 'consequent', 'alternate'], - ContinueStatement: ['label'], - DebuggerStatement: [], - DirectiveStatement: [], - DoWhileStatement: ['body', 'test'], - EmptyStatement: [], - ExportAllDeclaration: ['source'], - ExportDefaultDeclaration: ['declaration'], - ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], - ExportSpecifier: ['exported', 'local'], - ExpressionStatement: ['expression'], - ForStatement: ['init', 'test', 'update', 'body'], - ForInStatement: ['left', 'right', 'body'], - ForOfStatement: ['left', 'right', 'body'], - FunctionDeclaration: ['id', 'params', 'body'], - FunctionExpression: ['id', 'params', 'body'], - GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. - Identifier: [], - IfStatement: ['test', 'consequent', 'alternate'], - ImportExpression: ['source'], - ImportDeclaration: ['specifiers', 'source'], - ImportDefaultSpecifier: ['local'], - ImportNamespaceSpecifier: ['local'], - ImportSpecifier: ['imported', 'local'], - Literal: [], - LabeledStatement: ['label', 'body'], - LogicalExpression: ['left', 'right'], - MemberExpression: ['object', 'property'], - MetaProperty: ['meta', 'property'], - MethodDefinition: ['key', 'value'], - ModuleSpecifier: [], - NewExpression: ['callee', 'arguments'], - ObjectExpression: ['properties'], - ObjectPattern: ['properties'], - Program: ['body'], - Property: ['key', 'value'], - RestElement: [ 'argument' ], - ReturnStatement: ['argument'], - SequenceExpression: ['expressions'], - SpreadElement: ['argument'], - Super: [], - SwitchStatement: ['discriminant', 'cases'], - SwitchCase: ['test', 'consequent'], - TaggedTemplateExpression: ['tag', 'quasi'], - TemplateElement: [], - TemplateLiteral: ['quasis', 'expressions'], - ThisExpression: [], - ThrowStatement: ['argument'], - TryStatement: ['block', 'handler', 'finalizer'], - UnaryExpression: ['argument'], - UpdateExpression: ['argument'], - VariableDeclaration: ['declarations'], - VariableDeclarator: ['id', 'init'], - WhileStatement: ['test', 'body'], - WithStatement: ['object', 'body'], - YieldExpression: ['argument'] - }; - - // unique id - BREAK = {}; - SKIP = {}; - REMOVE = {}; - - VisitorOption = { - Break: BREAK, - Skip: SKIP, - Remove: REMOVE - }; - - function Reference(parent, key) { - this.parent = parent; - this.key = key; - } - - Reference.prototype.replace = function replace(node) { - this.parent[this.key] = node; - }; - - Reference.prototype.remove = function remove() { - if (Array.isArray(this.parent)) { - this.parent.splice(this.key, 1); - return true; - } else { - this.replace(null); - return false; - } - }; - - function Element(node, path, wrap, ref) { - this.node = node; - this.path = path; - this.wrap = wrap; - this.ref = ref; - } - - function Controller() { } - - // API: - // return property path array from root to current node - Controller.prototype.path = function path() { - var i, iz, j, jz, result, element; - - function addToPath(result, path) { - if (Array.isArray(path)) { - for (j = 0, jz = path.length; j < jz; ++j) { - result.push(path[j]); - } - } else { - result.push(path); - } - } - - // root node - if (!this.__current.path) { - return null; - } - - // first node is sentinel, second node is root element - result = []; - for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { - element = this.__leavelist[i]; - addToPath(result, element.path); - } - addToPath(result, this.__current.path); - return result; - }; +class RootsPlugin { + /** + * @param {string | ResolveStepHook} source source hook + * @param {Set} roots roots + * @param {string | ResolveStepHook} target target hook + */ + constructor(source, roots, target) { + this.roots = Array.from(roots); + this.source = source; + this.target = target; + } - // API: - // return type of current node - Controller.prototype.type = function () { - var node = this.current(); - return node.type || this.__current.wrap; - }; + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); - // API: - // return array of parent elements - Controller.prototype.parents = function parents() { - var i, iz, result; + resolver + .getHook(this.source) + .tapAsync("RootsPlugin", (request, resolveContext, callback) => { + const req = request.request; + if (!req) return callback(); + if (!req.startsWith("/")) return callback(); - // first node is sentinel - result = []; - for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { - result.push(this.__leavelist[i].node); - } + forEachBail( + this.roots, + (root, callback) => { + const path = resolver.join(root, req.slice(1)); + const obj = { + ...request, + path, + relativePath: request.relativePath && path + }; + resolver.doResolve( + target, + obj, + `root path ${root}`, + resolveContext, + callback + ); + }, + callback + ); + }); + } +} - return result; - }; +module.exports = RootsPlugin; - // API: - // return current node - Controller.prototype.current = function current() { - return this.__current.node; - }; - Controller.prototype.__execute = function __execute(callback, element) { - var previous, result; +/***/ }), - result = undefined; +/***/ 32317: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - previous = this.__current; - this.__current = element; - this.__state = null; - if (callback) { - result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); - } - this.__current = previous; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - return result; - }; - // API: - // notify control skip / break - Controller.prototype.notify = function notify(flag) { - this.__state = flag; - }; - // API: - // skip child nodes of current node - Controller.prototype.skip = function () { - this.notify(SKIP); - }; +const DescriptionFileUtils = __webpack_require__(702); - // API: - // break traversals - Controller.prototype['break'] = function () { - this.notify(BREAK); - }; +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - // API: - // remove node - Controller.prototype.remove = function () { - this.notify(REMOVE); - }; +const slashCode = "/".charCodeAt(0); - Controller.prototype.__initialize = function(root, visitor) { - this.visitor = visitor; - this.root = root; - this.__worklist = []; - this.__leavelist = []; - this.__current = null; - this.__state = null; - this.__fallback = null; - if (visitor.fallback === 'iteration') { - this.__fallback = Object.keys; - } else if (typeof visitor.fallback === 'function') { - this.__fallback = visitor.fallback; - } +module.exports = class SelfReferencePlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string | string[]} fieldNamePath name path + * @param {string | ResolveStepHook} target target + */ + constructor(source, fieldNamePath, target) { + this.source = source; + this.target = target; + this.fieldName = fieldNamePath; + } - this.__keys = VisitorKeys; - if (visitor.keys) { - this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); - } - }; + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("SelfReferencePlugin", (request, resolveContext, callback) => { + if (!request.descriptionFilePath) return callback(); - function isNode(node) { - if (node == null) { - return false; - } - return typeof node === 'object' && typeof node.type === 'string'; - } + const req = request.request; + if (!req) return callback(); - function isProperty(nodeType, key) { - return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; - } - - function candidateExistsInLeaveList(leavelist, candidate) { - for (var i = leavelist.length - 1; i >= 0; --i) { - if (leavelist[i].node === candidate) { - return true; - } - } - return false; - } + // Feature is only enabled when an exports field is present + const exportsField = DescriptionFileUtils.getField( + request.descriptionFileData, + this.fieldName + ); + if (!exportsField) return callback(); - Controller.prototype.traverse = function traverse(root, visitor) { - var worklist, - leavelist, - element, - node, - nodeType, - ret, - key, - current, - current2, - candidates, - candidate, - sentinel; + const name = DescriptionFileUtils.getField( + request.descriptionFileData, + "name" + ); + if (typeof name !== "string") return callback(); - this.__initialize(root, visitor); + if ( + req.startsWith(name) && + (req.length === name.length || + req.charCodeAt(name.length) === slashCode) + ) { + const remainingRequest = `.${req.slice(name.length)}`; - sentinel = {}; + const obj = { + ...request, + request: remainingRequest, + path: /** @type {string} */ (request.descriptionFileRoot), + relativePath: "." + }; - // reference - worklist = this.__worklist; - leavelist = this.__leavelist; + resolver.doResolve( + target, + obj, + "self reference", + resolveContext, + callback + ); + } else { + return callback(); + } + }); + } +}; - // initialize - worklist.push(new Element(root, null, null, null)); - leavelist.push(new Element(null, null, null, null)); - while (worklist.length) { - element = worklist.pop(); +/***/ }), - if (element === sentinel) { - element = leavelist.pop(); +/***/ 21300: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - ret = this.__execute(visitor.leave, element); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (this.__state === BREAK || ret === BREAK) { - return; - } - continue; - } - if (element.node) { - ret = this.__execute(visitor.enter, element); +const forEachBail = __webpack_require__(8266); +const getPaths = __webpack_require__(48608); +const { getType, PathType } = __webpack_require__(3011); - if (this.__state === BREAK || ret === BREAK) { - return; - } +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - worklist.push(sentinel); - leavelist.push(element); +module.exports = class SymlinkPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string | ResolveStepHook} target target + */ + constructor(source, target) { + this.source = source; + this.target = target; + } - if (this.__state === SKIP || ret === SKIP) { - continue; - } + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + const fs = resolver.fileSystem; + resolver + .getHook(this.source) + .tapAsync("SymlinkPlugin", (request, resolveContext, callback) => { + if (request.ignoreSymlinks) return callback(); + const pathsResult = getPaths(request.path); + const pathSegments = pathsResult.segments; + const paths = pathsResult.paths; - node = element.node; - nodeType = node.type || element.wrap; - candidates = this.__keys[nodeType]; - if (!candidates) { - if (this.__fallback) { - candidates = this.__fallback(node); - } else { - throw new Error('Unknown node type ' + nodeType + '.'); - } - } + let containsSymlink = false; + let idx = -1; + forEachBail( + paths, + (path, callback) => { + idx++; + if (resolveContext.fileDependencies) + resolveContext.fileDependencies.add(path); + fs.readlink(path, (err, result) => { + if (!err && result) { + pathSegments[idx] = result; + containsSymlink = true; + // Shortcut when absolute symlink found + const resultType = getType(result.toString()); + if ( + resultType === PathType.AbsoluteWin || + resultType === PathType.AbsolutePosix + ) { + return callback(null, idx); + } + } + callback(); + }); + }, + (err, idx) => { + if (!containsSymlink) return callback(); + const resultSegments = + typeof idx === "number" + ? pathSegments.slice(0, idx + 1) + : pathSegments.slice(); + const result = resultSegments.reduceRight((a, b) => { + return resolver.join(a, b); + }); + const obj = { + ...request, + path: result + }; + resolver.doResolve( + target, + obj, + "resolved symlink to " + result, + resolveContext, + callback + ); + } + ); + }); + } +}; - current = candidates.length; - while ((current -= 1) >= 0) { - key = candidates[current]; - candidate = node[key]; - if (!candidate) { - continue; - } - if (Array.isArray(candidate)) { - current2 = candidate.length; - while ((current2 -= 1) >= 0) { - if (!candidate[current2]) { - continue; - } +/***/ }), - if (candidateExistsInLeaveList(leavelist, candidate[current2])) { - continue; - } +/***/ 57746: +/***/ (function(module) { - if (isProperty(nodeType, candidates[current])) { - element = new Element(candidate[current2], [key, current2], 'Property', null); - } else if (isNode(candidate[current2])) { - element = new Element(candidate[current2], [key, current2], null, null); - } else { - continue; - } - worklist.push(element); - } - } else if (isNode(candidate)) { - if (candidateExistsInLeaveList(leavelist, candidate)) { - continue; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - worklist.push(new Element(candidate, key, null, null)); - } - } - } - } - }; - Controller.prototype.replace = function replace(root, visitor) { - var worklist, - leavelist, - node, - nodeType, - target, - element, - current, - current2, - candidates, - candidate, - sentinel, - outer, - key; - function removeElem(element) { - var i, - key, - nextElem, - parent; +/** @typedef {import("./Resolver").FileSystem} FileSystem */ +/** @typedef {import("./Resolver").SyncFileSystem} SyncFileSystem */ - if (element.ref.remove()) { - // When the reference is an element of an array. - key = element.ref.key; - parent = element.ref.parent; +/** + * @param {SyncFileSystem} fs file system implementation + * @constructor + */ +function SyncAsyncFileSystemDecorator(fs) { + this.fs = fs; - // If removed from array, then decrease following items' keys. - i = worklist.length; - while (i--) { - nextElem = worklist[i]; - if (nextElem.ref && nextElem.ref.parent === parent) { - if (nextElem.ref.key < key) { - break; - } - --nextElem.ref.key; - } - } - } - } + this.lstat = undefined; + this.lstatSync = undefined; + const lstatSync = fs.lstatSync; + if (lstatSync) { + this.lstat = (arg, options, callback) => { + let result; + try { + result = lstatSync.call(fs, arg); + } catch (e) { + return (callback || options)(e); + } + (callback || options)(null, result); + }; + this.lstatSync = (arg, options) => lstatSync.call(fs, arg, options); + } - this.__initialize(root, visitor); + this.stat = (arg, options, callback) => { + let result; + try { + result = callback ? fs.statSync(arg, options) : fs.statSync(arg); + } catch (e) { + return (callback || options)(e); + } + (callback || options)(null, result); + }; + this.statSync = (arg, options) => fs.statSync(arg, options); - sentinel = {}; + this.readdir = (arg, options, callback) => { + let result; + try { + result = fs.readdirSync(arg); + } catch (e) { + return (callback || options)(e); + } + (callback || options)(null, result); + }; + this.readdirSync = (arg, options) => fs.readdirSync(arg, options); - // reference - worklist = this.__worklist; - leavelist = this.__leavelist; + this.readFile = (arg, options, callback) => { + let result; + try { + result = fs.readFileSync(arg); + } catch (e) { + return (callback || options)(e); + } + (callback || options)(null, result); + }; + this.readFileSync = (arg, options) => fs.readFileSync(arg, options); - // initialize - outer = { - root: root - }; - element = new Element(root, null, null, new Reference(outer, 'root')); - worklist.push(element); - leavelist.push(element); + this.readlink = (arg, options, callback) => { + let result; + try { + result = fs.readlinkSync(arg); + } catch (e) { + return (callback || options)(e); + } + (callback || options)(null, result); + }; + this.readlinkSync = (arg, options) => fs.readlinkSync(arg, options); - while (worklist.length) { - element = worklist.pop(); + this.readJson = undefined; + this.readJsonSync = undefined; + const readJsonSync = fs.readJsonSync; + if (readJsonSync) { + this.readJson = (arg, options, callback) => { + let result; + try { + result = readJsonSync.call(fs, arg); + } catch (e) { + return (callback || options)(e); + } + (callback || options)(null, result); + }; - if (element === sentinel) { - element = leavelist.pop(); + this.readJsonSync = (arg, options) => readJsonSync.call(fs, arg, options); + } +} +module.exports = SyncAsyncFileSystemDecorator; - target = this.__execute(visitor.leave, element); - // node may be replaced with null, - // so distinguish between undefined and null in this place - if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { - // replace - element.ref.replace(target); - } +/***/ }), - if (this.__state === REMOVE || target === REMOVE) { - removeElem(element); - } +/***/ 16442: +/***/ (function(module) { - if (this.__state === BREAK || target === BREAK) { - return outer.root; - } - continue; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - target = this.__execute(visitor.enter, element); - // node may be replaced with null, - // so distinguish between undefined and null in this place - if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { - // replace - element.ref.replace(target); - element.node = target; - } - if (this.__state === REMOVE || target === REMOVE) { - removeElem(element); - element.node = null; - } +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - if (this.__state === BREAK || target === BREAK) { - return outer.root; - } +module.exports = class TryNextPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string} message message + * @param {string | ResolveStepHook} target target + */ + constructor(source, message, target) { + this.source = source; + this.message = message; + this.target = target; + } - // node may be null - node = element.node; - if (!node) { - continue; - } + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("TryNextPlugin", (request, resolveContext, callback) => { + resolver.doResolve( + target, + request, + this.message, + resolveContext, + callback + ); + }); + } +}; - worklist.push(sentinel); - leavelist.push(element); - if (this.__state === SKIP || target === SKIP) { - continue; - } +/***/ }), - nodeType = node.type || element.wrap; - candidates = this.__keys[nodeType]; - if (!candidates) { - if (this.__fallback) { - candidates = this.__fallback(node); - } else { - throw new Error('Unknown node type ' + nodeType + '.'); - } - } +/***/ 3501: +/***/ (function(module) { - current = candidates.length; - while ((current -= 1) >= 0) { - key = candidates[current]; - candidate = node[key]; - if (!candidate) { - continue; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (Array.isArray(candidate)) { - current2 = candidate.length; - while ((current2 -= 1) >= 0) { - if (!candidate[current2]) { - continue; - } - if (isProperty(nodeType, candidates[current])) { - element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); - } else if (isNode(candidate[current2])) { - element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); - } else { - continue; - } - worklist.push(element); - } - } else if (isNode(candidate)) { - worklist.push(new Element(candidate, key, null, new Reference(node, key))); - } - } - } - return outer.root; - }; - function traverse(root, visitor) { - var controller = new Controller(); - return controller.traverse(root, visitor); - } +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +/** @typedef {{[k: string]: any}} Cache */ - function replace(root, visitor) { - var controller = new Controller(); - return controller.replace(root, visitor); - } +function getCacheId(request, withContext) { + return JSON.stringify({ + context: withContext ? request.context : "", + path: request.path, + query: request.query, + fragment: request.fragment, + request: request.request + }); +} - function extendCommentRange(comment, tokens) { - var target; +module.exports = class UnsafeCachePlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {function(ResolveRequest): boolean} filterPredicate filterPredicate + * @param {Cache} cache cache + * @param {boolean} withContext withContext + * @param {string | ResolveStepHook} target target + */ + constructor(source, filterPredicate, cache, withContext, target) { + this.source = source; + this.filterPredicate = filterPredicate; + this.withContext = withContext; + this.cache = cache; + this.target = target; + } - target = upperBound(tokens, function search(token) { - return token.range[0] > comment.range[0]; - }); + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("UnsafeCachePlugin", (request, resolveContext, callback) => { + if (!this.filterPredicate(request)) return callback(); + const cacheId = getCacheId(request, this.withContext); + const cacheEntry = this.cache[cacheId]; + if (cacheEntry) { + return callback(null, cacheEntry); + } + resolver.doResolve( + target, + request, + null, + resolveContext, + (err, result) => { + if (err) return callback(err); + if (result) return callback(null, (this.cache[cacheId] = result)); + callback(); + } + ); + }); + } +}; - comment.extendedRange = [comment.range[0], comment.range[1]]; - if (target !== tokens.length) { - comment.extendedRange[1] = tokens[target].range[0]; - } +/***/ }), - target -= 1; - if (target >= 0) { - comment.extendedRange[0] = tokens[target].range[1]; - } +/***/ 50318: +/***/ (function(module) { - return comment; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - function attachComments(tree, providedComments, tokens) { - // At first, we should calculate extended comment ranges. - var comments = [], comment, len, i, cursor; - if (!tree.range) { - throw new Error('attachComments needs range information'); - } - // tokens array is empty, we attach comments to tree as 'leadingComments' - if (!tokens.length) { - if (providedComments.length) { - for (i = 0, len = providedComments.length; i < len; i += 1) { - comment = deepCopy(providedComments[i]); - comment.extendedRange = [0, tree.range[0]]; - comments.push(comment); - } - tree.leadingComments = comments; - } - return tree; - } +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - for (i = 0, len = providedComments.length; i < len; i += 1) { - comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); - } +module.exports = class UseFilePlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string} filename filename + * @param {string | ResolveStepHook} target target + */ + constructor(source, filename, target) { + this.source = source; + this.filename = filename; + this.target = target; + } - // This is based on John Freeman's implementation. - cursor = 0; - traverse(tree, { - enter: function (node) { - var comment; + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("UseFilePlugin", (request, resolveContext, callback) => { + const filePath = resolver.join(request.path, this.filename); + const obj = { + ...request, + path: filePath, + relativePath: + request.relativePath && + resolver.join(request.relativePath, this.filename) + }; + resolver.doResolve( + target, + obj, + "using path: " + filePath, + resolveContext, + callback + ); + }); + } +}; - while (cursor < comments.length) { - comment = comments[cursor]; - if (comment.extendedRange[1] > node.range[0]) { - break; - } - - if (comment.extendedRange[1] === node.range[0]) { - if (!node.leadingComments) { - node.leadingComments = []; - } - node.leadingComments.push(comment); - comments.splice(cursor, 1); - } else { - cursor += 1; - } - } - - // already out of owned node - if (cursor === comments.length) { - return VisitorOption.Break; - } - - if (comments[cursor].extendedRange[0] > node.range[1]) { - return VisitorOption.Skip; - } - } - }); - - cursor = 0; - traverse(tree, { - leave: function (node) { - var comment; - - while (cursor < comments.length) { - comment = comments[cursor]; - if (node.range[1] < comment.extendedRange[0]) { - break; - } - if (node.range[1] === comment.extendedRange[0]) { - if (!node.trailingComments) { - node.trailingComments = []; - } - node.trailingComments.push(comment); - comments.splice(cursor, 1); - } else { - cursor += 1; - } - } +/***/ }), - // already out of owned node - if (cursor === comments.length) { - return VisitorOption.Break; - } +/***/ 95478: +/***/ (function(module) { - if (comments[cursor].extendedRange[0] > node.range[1]) { - return VisitorOption.Skip; - } - } - }); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - return tree; - } - exports.Syntax = Syntax; - exports.traverse = traverse; - exports.replace = replace; - exports.attachComments = attachComments; - exports.VisitorKeys = VisitorKeys; - exports.VisitorOption = VisitorOption; - exports.Controller = Controller; - exports.cloneEnvironment = function () { return clone({}); }; - return exports; -}(exports)); -/* vim: set sw=4 ts=4 et tw=80 : */ +module.exports = function createInnerContext( + options, + message, + messageOptional +) { + let messageReported = false; + let innerLog = undefined; + if (options.log) { + if (message) { + innerLog = msg => { + if (!messageReported) { + options.log(message); + messageReported = true; + } + options.log(" " + msg); + }; + } else { + innerLog = options.log; + } + } + const childContext = { + log: innerLog, + yield: options.yield, + fileDependencies: options.fileDependencies, + contextDependencies: options.contextDependencies, + missingDependencies: options.missingDependencies, + stack: options.stack + }; + return childContext; +}; /***/ }), -/***/ 18350: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 8266: +/***/ (function(module) { +"use strict"; /* - Copyright (C) 2012-2013 Yusuke Suzuki - Copyright (C) 2012 Ariya Hidayat - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -/*jslint vars:false, bitwise:true*/ -/*jshint indent:4*/ -/*global exports:true*/ -(function clone(exports) { - 'use strict'; - var Syntax, - VisitorOption, - VisitorKeys, - BREAK, - SKIP, - REMOVE; - function deepCopy(obj) { - var ret = {}, key, val; - for (key in obj) { - if (obj.hasOwnProperty(key)) { - val = obj[key]; - if (typeof val === 'object' && val !== null) { - ret[key] = deepCopy(val); - } else { - ret[key] = val; - } - } - } - return ret; - } - // based on LLVM libc++ upper_bound / lower_bound - // MIT License +module.exports = function forEachBail(array, iterator, callback) { + if (array.length === 0) return callback(); - function upperBound(array, func) { - var diff, len, i, current; + let i = 0; + const next = () => { + let loop = undefined; + iterator(array[i++], (err, result) => { + if (err || result !== undefined || i >= array.length) { + return callback(err, result); + } + if (loop === false) while (next()); + loop = true; + }); + if (!loop) loop = false; + return loop; + }; + while (next()); +}; - len = array.length; - i = 0; - while (len) { - diff = len >>> 1; - current = i + diff; - if (func(array[current])) { - len = diff; - } else { - i = current + 1; - len -= diff + 1; - } - } - return i; - } +/***/ }), - Syntax = { - AssignmentExpression: 'AssignmentExpression', - AssignmentPattern: 'AssignmentPattern', - ArrayExpression: 'ArrayExpression', - ArrayPattern: 'ArrayPattern', - ArrowFunctionExpression: 'ArrowFunctionExpression', - AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7. - BlockStatement: 'BlockStatement', - BinaryExpression: 'BinaryExpression', - BreakStatement: 'BreakStatement', - CallExpression: 'CallExpression', - CatchClause: 'CatchClause', - ClassBody: 'ClassBody', - ClassDeclaration: 'ClassDeclaration', - ClassExpression: 'ClassExpression', - ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7. - ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7. - ConditionalExpression: 'ConditionalExpression', - ContinueStatement: 'ContinueStatement', - DebuggerStatement: 'DebuggerStatement', - DirectiveStatement: 'DirectiveStatement', - DoWhileStatement: 'DoWhileStatement', - EmptyStatement: 'EmptyStatement', - ExportAllDeclaration: 'ExportAllDeclaration', - ExportDefaultDeclaration: 'ExportDefaultDeclaration', - ExportNamedDeclaration: 'ExportNamedDeclaration', - ExportSpecifier: 'ExportSpecifier', - ExpressionStatement: 'ExpressionStatement', - ForStatement: 'ForStatement', - ForInStatement: 'ForInStatement', - ForOfStatement: 'ForOfStatement', - FunctionDeclaration: 'FunctionDeclaration', - FunctionExpression: 'FunctionExpression', - GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7. - Identifier: 'Identifier', - IfStatement: 'IfStatement', - ImportExpression: 'ImportExpression', - ImportDeclaration: 'ImportDeclaration', - ImportDefaultSpecifier: 'ImportDefaultSpecifier', - ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', - ImportSpecifier: 'ImportSpecifier', - Literal: 'Literal', - LabeledStatement: 'LabeledStatement', - LogicalExpression: 'LogicalExpression', - MemberExpression: 'MemberExpression', - MetaProperty: 'MetaProperty', - MethodDefinition: 'MethodDefinition', - ModuleSpecifier: 'ModuleSpecifier', - NewExpression: 'NewExpression', - ObjectExpression: 'ObjectExpression', - ObjectPattern: 'ObjectPattern', - Program: 'Program', - Property: 'Property', - RestElement: 'RestElement', - ReturnStatement: 'ReturnStatement', - SequenceExpression: 'SequenceExpression', - SpreadElement: 'SpreadElement', - Super: 'Super', - SwitchStatement: 'SwitchStatement', - SwitchCase: 'SwitchCase', - TaggedTemplateExpression: 'TaggedTemplateExpression', - TemplateElement: 'TemplateElement', - TemplateLiteral: 'TemplateLiteral', - ThisExpression: 'ThisExpression', - ThrowStatement: 'ThrowStatement', - TryStatement: 'TryStatement', - UnaryExpression: 'UnaryExpression', - UpdateExpression: 'UpdateExpression', - VariableDeclaration: 'VariableDeclaration', - VariableDeclarator: 'VariableDeclarator', - WhileStatement: 'WhileStatement', - WithStatement: 'WithStatement', - YieldExpression: 'YieldExpression' - }; +/***/ 50290: +/***/ (function(module) { - VisitorKeys = { - AssignmentExpression: ['left', 'right'], - AssignmentPattern: ['left', 'right'], - ArrayExpression: ['elements'], - ArrayPattern: ['elements'], - ArrowFunctionExpression: ['params', 'body'], - AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7. - BlockStatement: ['body'], - BinaryExpression: ['left', 'right'], - BreakStatement: ['label'], - CallExpression: ['callee', 'arguments'], - CatchClause: ['param', 'body'], - ClassBody: ['body'], - ClassDeclaration: ['id', 'superClass', 'body'], - ClassExpression: ['id', 'superClass', 'body'], - ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7. - ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. - ConditionalExpression: ['test', 'consequent', 'alternate'], - ContinueStatement: ['label'], - DebuggerStatement: [], - DirectiveStatement: [], - DoWhileStatement: ['body', 'test'], - EmptyStatement: [], - ExportAllDeclaration: ['source'], - ExportDefaultDeclaration: ['declaration'], - ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], - ExportSpecifier: ['exported', 'local'], - ExpressionStatement: ['expression'], - ForStatement: ['init', 'test', 'update', 'body'], - ForInStatement: ['left', 'right', 'body'], - ForOfStatement: ['left', 'right', 'body'], - FunctionDeclaration: ['id', 'params', 'body'], - FunctionExpression: ['id', 'params', 'body'], - GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. - Identifier: [], - IfStatement: ['test', 'consequent', 'alternate'], - ImportExpression: ['source'], - ImportDeclaration: ['specifiers', 'source'], - ImportDefaultSpecifier: ['local'], - ImportNamespaceSpecifier: ['local'], - ImportSpecifier: ['imported', 'local'], - Literal: [], - LabeledStatement: ['label', 'body'], - LogicalExpression: ['left', 'right'], - MemberExpression: ['object', 'property'], - MetaProperty: ['meta', 'property'], - MethodDefinition: ['key', 'value'], - ModuleSpecifier: [], - NewExpression: ['callee', 'arguments'], - ObjectExpression: ['properties'], - ObjectPattern: ['properties'], - Program: ['body'], - Property: ['key', 'value'], - RestElement: [ 'argument' ], - ReturnStatement: ['argument'], - SequenceExpression: ['expressions'], - SpreadElement: ['argument'], - Super: [], - SwitchStatement: ['discriminant', 'cases'], - SwitchCase: ['test', 'consequent'], - TaggedTemplateExpression: ['tag', 'quasi'], - TemplateElement: [], - TemplateLiteral: ['quasis', 'expressions'], - ThisExpression: [], - ThrowStatement: ['argument'], - TryStatement: ['block', 'handler', 'finalizer'], - UnaryExpression: ['argument'], - UpdateExpression: ['argument'], - VariableDeclaration: ['declarations'], - VariableDeclarator: ['id', 'init'], - WhileStatement: ['test', 'body'], - WithStatement: ['object', 'body'], - YieldExpression: ['argument'] - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // unique id - BREAK = {}; - SKIP = {}; - REMOVE = {}; - VisitorOption = { - Break: BREAK, - Skip: SKIP, - Remove: REMOVE - }; - function Reference(parent, key) { - this.parent = parent; - this.key = key; - } +module.exports = function getInnerRequest(resolver, request) { + if ( + typeof request.__innerRequest === "string" && + request.__innerRequest_request === request.request && + request.__innerRequest_relativePath === request.relativePath + ) + return request.__innerRequest; + let innerRequest; + if (request.request) { + innerRequest = request.request; + if (/^\.\.?(?:\/|$)/.test(innerRequest) && request.relativePath) { + innerRequest = resolver.join(request.relativePath, innerRequest); + } + } else { + innerRequest = request.relativePath; + } + request.__innerRequest_request = request.request; + request.__innerRequest_relativePath = request.relativePath; + return (request.__innerRequest = innerRequest); +}; - Reference.prototype.replace = function replace(node) { - this.parent[this.key] = node; - }; - Reference.prototype.remove = function remove() { - if (Array.isArray(this.parent)) { - this.parent.splice(this.key, 1); - return true; - } else { - this.replace(null); - return false; - } - }; +/***/ }), - function Element(node, path, wrap, ref) { - this.node = node; - this.path = path; - this.wrap = wrap; - this.ref = ref; - } +/***/ 48608: +/***/ (function(module) { - function Controller() { } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // API: - // return property path array from root to current node - Controller.prototype.path = function path() { - var i, iz, j, jz, result, element; - function addToPath(result, path) { - if (Array.isArray(path)) { - for (j = 0, jz = path.length; j < jz; ++j) { - result.push(path[j]); - } - } else { - result.push(path); - } - } - // root node - if (!this.__current.path) { - return null; - } +module.exports = function getPaths(path) { + if (path === "/") return { paths: ["/"], segments: [""] }; + const parts = path.split(/(.*?[\\/]+)/); + const paths = [path]; + const segments = [parts[parts.length - 1]]; + let part = parts[parts.length - 1]; + path = path.substr(0, path.length - part.length - 1); + for (let i = parts.length - 2; i > 2; i -= 2) { + paths.push(path); + part = parts[i]; + path = path.substr(0, path.length - part.length) || "/"; + segments.push(part.substr(0, part.length - 1)); + } + part = parts[1]; + segments.push(part); + paths.push(part); + return { + paths: paths, + segments: segments + }; +}; - // first node is sentinel, second node is root element - result = []; - for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { - element = this.__leavelist[i]; - addToPath(result, element.path); - } - addToPath(result, this.__current.path); - return result; - }; +module.exports.basename = function basename(path) { + const i = path.lastIndexOf("/"), + j = path.lastIndexOf("\\"); + const p = i < 0 ? j : j < 0 ? i : i < j ? j : i; + if (p < 0) return null; + const s = path.substr(p + 1); + return s; +}; - // API: - // return type of current node - Controller.prototype.type = function () { - var node = this.current(); - return node.type || this.__current.wrap; - }; - // API: - // return array of parent elements - Controller.prototype.parents = function parents() { - var i, iz, result; +/***/ }), - // first node is sentinel - result = []; - for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { - result.push(this.__leavelist[i].node); - } +/***/ 30662: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - return result; - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // API: - // return current node - Controller.prototype.current = function current() { - return this.__current.node; - }; - Controller.prototype.__execute = function __execute(callback, element) { - var previous, result; - result = undefined; +const fs = __webpack_require__(90552); +const CachedInputFileSystem = __webpack_require__(89429); +const ResolverFactory = __webpack_require__(53990); - previous = this.__current; - this.__current = element; - this.__state = null; - if (callback) { - result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); - } - this.__current = previous; +/** @typedef {import("./PnpPlugin").PnpApiImpl} PnpApi */ +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").FileSystem} FileSystem */ +/** @typedef {import("./Resolver").ResolveContext} ResolveContext */ +/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ +/** @typedef {import("./ResolverFactory").Plugin} Plugin */ +/** @typedef {import("./ResolverFactory").UserResolveOptions} ResolveOptions */ - return result; - }; +const nodeFileSystem = new CachedInputFileSystem(fs, 4000); - // API: - // notify control skip / break - Controller.prototype.notify = function notify(flag) { - this.__state = flag; - }; +const nodeContext = { + environments: ["node+es3+es5+process+native"] +}; - // API: - // skip child nodes of current node - Controller.prototype.skip = function () { - this.notify(SKIP); - }; +const asyncResolver = ResolverFactory.createResolver({ + conditionNames: ["node"], + extensions: [".js", ".json", ".node"], + fileSystem: nodeFileSystem +}); +function resolve(context, path, request, resolveContext, callback) { + if (typeof context === "string") { + callback = resolveContext; + resolveContext = request; + request = path; + path = context; + context = nodeContext; + } + if (typeof callback !== "function") { + callback = resolveContext; + } + asyncResolver.resolve(context, path, request, resolveContext, callback); +} - // API: - // break traversals - Controller.prototype['break'] = function () { - this.notify(BREAK); - }; +const syncResolver = ResolverFactory.createResolver({ + conditionNames: ["node"], + extensions: [".js", ".json", ".node"], + useSyncFileSystemCalls: true, + fileSystem: nodeFileSystem +}); +function resolveSync(context, path, request) { + if (typeof context === "string") { + request = path; + path = context; + context = nodeContext; + } + return syncResolver.resolveSync(context, path, request); +} - // API: - // remove node - Controller.prototype.remove = function () { - this.notify(REMOVE); - }; +function create(options) { + options = { + fileSystem: nodeFileSystem, + ...options + }; + const resolver = ResolverFactory.createResolver(options); + return function (context, path, request, resolveContext, callback) { + if (typeof context === "string") { + callback = resolveContext; + resolveContext = request; + request = path; + path = context; + context = nodeContext; + } + if (typeof callback !== "function") { + callback = resolveContext; + } + resolver.resolve(context, path, request, resolveContext, callback); + }; +} - Controller.prototype.__initialize = function(root, visitor) { - this.visitor = visitor; - this.root = root; - this.__worklist = []; - this.__leavelist = []; - this.__current = null; - this.__state = null; - this.__fallback = null; - if (visitor.fallback === 'iteration') { - this.__fallback = Object.keys; - } else if (typeof visitor.fallback === 'function') { - this.__fallback = visitor.fallback; - } +function createSync(options) { + options = { + useSyncFileSystemCalls: true, + fileSystem: nodeFileSystem, + ...options + }; + const resolver = ResolverFactory.createResolver(options); + return function (context, path, request) { + if (typeof context === "string") { + request = path; + path = context; + context = nodeContext; + } + return resolver.resolveSync(context, path, request); + }; +} - this.__keys = VisitorKeys; - if (visitor.keys) { - this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); - } - }; +/** + * @template A + * @template B + * @param {A} obj input a + * @param {B} exports input b + * @returns {A & B} merged + */ +const mergeExports = (obj, exports) => { + const descriptors = Object.getOwnPropertyDescriptors(exports); + Object.defineProperties(obj, descriptors); + return /** @type {A & B} */ (Object.freeze(obj)); +}; - function isNode(node) { - if (node == null) { - return false; - } - return typeof node === 'object' && typeof node.type === 'string'; - } +module.exports = mergeExports(resolve, { + get sync() { + return resolveSync; + }, + create: mergeExports(create, { + get sync() { + return createSync; + } + }), + ResolverFactory, + CachedInputFileSystem, + get CloneBasenamePlugin() { + return __webpack_require__(2020); + }, + get LogInfoPlugin() { + return __webpack_require__(47032); + }, + get forEachBail() { + return __webpack_require__(8266); + } +}); - function isProperty(nodeType, key) { - return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; - } - Controller.prototype.traverse = function traverse(root, visitor) { - var worklist, - leavelist, - element, - node, - nodeType, - ret, - key, - current, - current2, - candidates, - candidate, - sentinel; +/***/ }), - this.__initialize(root, visitor); +/***/ 28348: +/***/ (function(module) { - sentinel = {}; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ - // reference - worklist = this.__worklist; - leavelist = this.__leavelist; - // initialize - worklist.push(new Element(root, null, null, null)); - leavelist.push(new Element(null, null, null, null)); - while (worklist.length) { - element = worklist.pop(); +/** @typedef {string|(string|ConditionalMapping)[]} DirectMapping */ +/** @typedef {{[k: string]: MappingValue}} ConditionalMapping */ +/** @typedef {ConditionalMapping|DirectMapping|null} MappingValue */ +/** @typedef {Record|ConditionalMapping|DirectMapping} ExportsField */ +/** @typedef {Record} ImportsField */ - if (element === sentinel) { - element = leavelist.pop(); +/** + * @typedef {Object} PathTreeNode + * @property {Map|null} children + * @property {MappingValue} folder + * @property {Map|null} wildcards + * @property {Map} files + */ - ret = this.__execute(visitor.leave, element); +/** + * Processing exports/imports field + * @callback FieldProcessor + * @param {string} request request + * @param {Set} conditionNames condition names + * @returns {string[]} resolved paths + */ - if (this.__state === BREAK || ret === BREAK) { - return; - } - continue; - } +/* +Example exports field: +{ + ".": "./main.js", + "./feature": { + "browser": "./feature-browser.js", + "default": "./feature.js" + } +} +Terminology: - if (element.node) { +Enhanced-resolve name keys ("." and "./feature") as exports field keys. - ret = this.__execute(visitor.enter, element); +If value is string or string[], mapping is called as a direct mapping +and value called as a direct export. - if (this.__state === BREAK || ret === BREAK) { - return; - } +If value is key-value object, mapping is called as a conditional mapping +and value called as a conditional export. - worklist.push(sentinel); - leavelist.push(element); +Key in conditional mapping is called condition name. - if (this.__state === SKIP || ret === SKIP) { - continue; - } +Conditional mapping nested in another conditional mapping is called nested mapping. - node = element.node; - nodeType = node.type || element.wrap; - candidates = this.__keys[nodeType]; - if (!candidates) { - if (this.__fallback) { - candidates = this.__fallback(node); - } else { - throw new Error('Unknown node type ' + nodeType + '.'); - } - } +---------- - current = candidates.length; - while ((current -= 1) >= 0) { - key = candidates[current]; - candidate = node[key]; - if (!candidate) { - continue; - } +Example imports field: +{ + "#a": "./main.js", + "#moment": { + "browser": "./moment/index.js", + "default": "moment" + }, + "#moment/": { + "browser": "./moment/", + "default": "moment/" + } +} +Terminology: - if (Array.isArray(candidate)) { - current2 = candidate.length; - while ((current2 -= 1) >= 0) { - if (!candidate[current2]) { - continue; - } - if (isProperty(nodeType, candidates[current])) { - element = new Element(candidate[current2], [key, current2], 'Property', null); - } else if (isNode(candidate[current2])) { - element = new Element(candidate[current2], [key, current2], null, null); - } else { - continue; - } - worklist.push(element); - } - } else if (isNode(candidate)) { - worklist.push(new Element(candidate, key, null, null)); - } - } - } - } - }; +Enhanced-resolve name keys ("#a" and "#moment/", "#moment") as imports field keys. - Controller.prototype.replace = function replace(root, visitor) { - var worklist, - leavelist, - node, - nodeType, - target, - element, - current, - current2, - candidates, - candidate, - sentinel, - outer, - key; +If value is string or string[], mapping is called as a direct mapping +and value called as a direct export. - function removeElem(element) { - var i, - key, - nextElem, - parent; +If value is key-value object, mapping is called as a conditional mapping +and value called as a conditional export. - if (element.ref.remove()) { - // When the reference is an element of an array. - key = element.ref.key; - parent = element.ref.parent; +Key in conditional mapping is called condition name. - // If removed from array, then decrease following items' keys. - i = worklist.length; - while (i--) { - nextElem = worklist[i]; - if (nextElem.ref && nextElem.ref.parent === parent) { - if (nextElem.ref.key < key) { - break; - } - --nextElem.ref.key; - } - } - } - } +Conditional mapping nested in another conditional mapping is called nested mapping. - this.__initialize(root, visitor); +*/ - sentinel = {}; +const slashCode = "/".charCodeAt(0); +const dotCode = ".".charCodeAt(0); +const hashCode = "#".charCodeAt(0); - // reference - worklist = this.__worklist; - leavelist = this.__leavelist; +/** + * @param {ExportsField} exportsField the exports field + * @returns {FieldProcessor} process callback + */ +module.exports.processExportsField = function processExportsField( + exportsField +) { + return createFieldProcessor( + buildExportsFieldPathTree(exportsField), + assertExportsFieldRequest, + assertExportTarget + ); +}; - // initialize - outer = { - root: root - }; - element = new Element(root, null, null, new Reference(outer, 'root')); - worklist.push(element); - leavelist.push(element); +/** + * @param {ImportsField} importsField the exports field + * @returns {FieldProcessor} process callback + */ +module.exports.processImportsField = function processImportsField( + importsField +) { + return createFieldProcessor( + buildImportsFieldPathTree(importsField), + assertImportsFieldRequest, + assertImportTarget + ); +}; - while (worklist.length) { - element = worklist.pop(); +/** + * @param {PathTreeNode} treeRoot root + * @param {(s: string) => string} assertRequest assertRequest + * @param {(s: string, f: boolean) => void} assertTarget assertTarget + * @returns {FieldProcessor} field processor + */ +function createFieldProcessor(treeRoot, assertRequest, assertTarget) { + return function fieldProcessor(request, conditionNames) { + request = assertRequest(request); - if (element === sentinel) { - element = leavelist.pop(); + const match = findMatch(request, treeRoot); - target = this.__execute(visitor.leave, element); + if (match === null) return []; - // node may be replaced with null, - // so distinguish between undefined and null in this place - if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { - // replace - element.ref.replace(target); - } + const [mapping, remainRequestIndex] = match; - if (this.__state === REMOVE || target === REMOVE) { - removeElem(element); - } + /** @type {DirectMapping|null} */ + let direct = null; - if (this.__state === BREAK || target === BREAK) { - return outer.root; - } - continue; - } + if (isConditionalMapping(mapping)) { + direct = conditionalMapping( + /** @type {ConditionalMapping} */ (mapping), + conditionNames + ); - target = this.__execute(visitor.enter, element); + // matching not found + if (direct === null) return []; + } else { + direct = /** @type {DirectMapping} */ (mapping); + } - // node may be replaced with null, - // so distinguish between undefined and null in this place - if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { - // replace - element.ref.replace(target); - element.node = target; - } + const remainingRequest = + remainRequestIndex === request.length + 1 + ? undefined + : remainRequestIndex < 0 + ? request.slice(-remainRequestIndex - 1) + : request.slice(remainRequestIndex); - if (this.__state === REMOVE || target === REMOVE) { - removeElem(element); - element.node = null; - } + return directMapping( + remainingRequest, + remainRequestIndex < 0, + direct, + conditionNames, + assertTarget + ); + }; +} - if (this.__state === BREAK || target === BREAK) { - return outer.root; - } +/** + * @param {string} request request + * @returns {string} updated request + */ +function assertExportsFieldRequest(request) { + if (request.charCodeAt(0) !== dotCode) { + throw new Error('Request should be relative path and start with "."'); + } + if (request.length === 1) return ""; + if (request.charCodeAt(1) !== slashCode) { + throw new Error('Request should be relative path and start with "./"'); + } + if (request.charCodeAt(request.length - 1) === slashCode) { + throw new Error("Only requesting file allowed"); + } - // node may be null - node = element.node; - if (!node) { - continue; - } + return request.slice(2); +} - worklist.push(sentinel); - leavelist.push(element); +/** + * @param {string} request request + * @returns {string} updated request + */ +function assertImportsFieldRequest(request) { + if (request.charCodeAt(0) !== hashCode) { + throw new Error('Request should start with "#"'); + } + if (request.length === 1) { + throw new Error("Request should have at least 2 characters"); + } + if (request.charCodeAt(1) === slashCode) { + throw new Error('Request should not start with "#/"'); + } + if (request.charCodeAt(request.length - 1) === slashCode) { + throw new Error("Only requesting file allowed"); + } - if (this.__state === SKIP || target === SKIP) { - continue; - } + return request.slice(1); +} - nodeType = node.type || element.wrap; - candidates = this.__keys[nodeType]; - if (!candidates) { - if (this.__fallback) { - candidates = this.__fallback(node); - } else { - throw new Error('Unknown node type ' + nodeType + '.'); - } - } +/** + * @param {string} exp export target + * @param {boolean} expectFolder is folder expected + */ +function assertExportTarget(exp, expectFolder) { + if ( + exp.charCodeAt(0) === slashCode || + (exp.charCodeAt(0) === dotCode && exp.charCodeAt(1) !== slashCode) + ) { + throw new Error( + `Export should be relative path and start with "./", got ${JSON.stringify( + exp + )}.` + ); + } - current = candidates.length; - while ((current -= 1) >= 0) { - key = candidates[current]; - candidate = node[key]; - if (!candidate) { - continue; - } + const isFolder = exp.charCodeAt(exp.length - 1) === slashCode; - if (Array.isArray(candidate)) { - current2 = candidate.length; - while ((current2 -= 1) >= 0) { - if (!candidate[current2]) { - continue; - } - if (isProperty(nodeType, candidates[current])) { - element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); - } else if (isNode(candidate[current2])) { - element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); - } else { - continue; - } - worklist.push(element); - } - } else if (isNode(candidate)) { - worklist.push(new Element(candidate, key, null, new Reference(node, key))); - } - } - } + if (isFolder !== expectFolder) { + throw new Error( + expectFolder + ? `Expecting folder to folder mapping. ${JSON.stringify( + exp + )} should end with "/"` + : `Expecting file to file mapping. ${JSON.stringify( + exp + )} should not end with "/"` + ); + } +} - return outer.root; - }; +/** + * @param {string} imp import target + * @param {boolean} expectFolder is folder expected + */ +function assertImportTarget(imp, expectFolder) { + const isFolder = imp.charCodeAt(imp.length - 1) === slashCode; - function traverse(root, visitor) { - var controller = new Controller(); - return controller.traverse(root, visitor); - } + if (isFolder !== expectFolder) { + throw new Error( + expectFolder + ? `Expecting folder to folder mapping. ${JSON.stringify( + imp + )} should end with "/"` + : `Expecting file to file mapping. ${JSON.stringify( + imp + )} should not end with "/"` + ); + } +} - function replace(root, visitor) { - var controller = new Controller(); - return controller.replace(root, visitor); - } +/** + * Trying to match request to field + * @param {string} request request + * @param {PathTreeNode} treeRoot path tree root + * @returns {[MappingValue, number]|null} match or null, number is negative and one less when it's a folder mapping, number is request.length + 1 for direct mappings + */ +function findMatch(request, treeRoot) { + if (request.length === 0) { + const value = treeRoot.files.get(""); - function extendCommentRange(comment, tokens) { - var target; + return value ? [value, 1] : null; + } - target = upperBound(tokens, function search(token) { - return token.range[0] > comment.range[0]; - }); + if ( + treeRoot.children === null && + treeRoot.folder === null && + treeRoot.wildcards === null + ) { + const value = treeRoot.files.get(request); - comment.extendedRange = [comment.range[0], comment.range[1]]; + return value ? [value, request.length + 1] : null; + } - if (target !== tokens.length) { - comment.extendedRange[1] = tokens[target].range[0]; - } + let node = treeRoot; + let lastNonSlashIndex = 0; + let slashIndex = request.indexOf("/", 0); - target -= 1; - if (target >= 0) { - comment.extendedRange[0] = tokens[target].range[1]; - } + /** @type {[MappingValue, number]|null} */ + let lastFolderMatch = null; - return comment; - } + const applyFolderMapping = () => { + const folderMapping = node.folder; + if (folderMapping) { + if (lastFolderMatch) { + lastFolderMatch[0] = folderMapping; + lastFolderMatch[1] = -lastNonSlashIndex - 1; + } else { + lastFolderMatch = [folderMapping, -lastNonSlashIndex - 1]; + } + } + }; - function attachComments(tree, providedComments, tokens) { - // At first, we should calculate extended comment ranges. - var comments = [], comment, len, i, cursor; + const applyWildcardMappings = (wildcardMappings, remainingRequest) => { + if (wildcardMappings) { + for (const [key, target] of wildcardMappings) { + if (remainingRequest.startsWith(key)) { + if (!lastFolderMatch) { + lastFolderMatch = [target, lastNonSlashIndex + key.length]; + } else if (lastFolderMatch[1] < lastNonSlashIndex + key.length) { + lastFolderMatch[0] = target; + lastFolderMatch[1] = lastNonSlashIndex + key.length; + } + } + } + } + }; - if (!tree.range) { - throw new Error('attachComments needs range information'); - } + while (slashIndex !== -1) { + applyFolderMapping(); - // tokens array is empty, we attach comments to tree as 'leadingComments' - if (!tokens.length) { - if (providedComments.length) { - for (i = 0, len = providedComments.length; i < len; i += 1) { - comment = deepCopy(providedComments[i]); - comment.extendedRange = [0, tree.range[0]]; - comments.push(comment); - } - tree.leadingComments = comments; - } - return tree; - } + const wildcardMappings = node.wildcards; - for (i = 0, len = providedComments.length; i < len; i += 1) { - comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); - } + if (!wildcardMappings && node.children === null) return lastFolderMatch; - // This is based on John Freeman's implementation. - cursor = 0; - traverse(tree, { - enter: function (node) { - var comment; + const folder = request.slice(lastNonSlashIndex, slashIndex); - while (cursor < comments.length) { - comment = comments[cursor]; - if (comment.extendedRange[1] > node.range[0]) { - break; - } + applyWildcardMappings(wildcardMappings, folder); - if (comment.extendedRange[1] === node.range[0]) { - if (!node.leadingComments) { - node.leadingComments = []; - } - node.leadingComments.push(comment); - comments.splice(cursor, 1); - } else { - cursor += 1; - } - } + if (node.children === null) return lastFolderMatch; - // already out of owned node - if (cursor === comments.length) { - return VisitorOption.Break; - } + const newNode = node.children.get(folder); - if (comments[cursor].extendedRange[0] > node.range[1]) { - return VisitorOption.Skip; - } - } - }); + if (!newNode) { + return lastFolderMatch; + } - cursor = 0; - traverse(tree, { - leave: function (node) { - var comment; + node = newNode; + lastNonSlashIndex = slashIndex + 1; + slashIndex = request.indexOf("/", lastNonSlashIndex); + } - while (cursor < comments.length) { - comment = comments[cursor]; - if (node.range[1] < comment.extendedRange[0]) { - break; - } + const remainingRequest = + lastNonSlashIndex > 0 ? request.slice(lastNonSlashIndex) : request; - if (node.range[1] === comment.extendedRange[0]) { - if (!node.trailingComments) { - node.trailingComments = []; - } - node.trailingComments.push(comment); - comments.splice(cursor, 1); - } else { - cursor += 1; - } - } + const value = node.files.get(remainingRequest); - // already out of owned node - if (cursor === comments.length) { - return VisitorOption.Break; - } + if (value) { + return [value, request.length + 1]; + } - if (comments[cursor].extendedRange[0] > node.range[1]) { - return VisitorOption.Skip; - } - } - }); + applyFolderMapping(); - return tree; - } + applyWildcardMappings(node.wildcards, remainingRequest); - exports.version = (__webpack_require__(15535)/* .version */ .i8); - exports.Syntax = Syntax; - exports.traverse = traverse; - exports.replace = replace; - exports.attachComments = attachComments; - exports.VisitorKeys = VisitorKeys; - exports.VisitorOption = VisitorOption; - exports.Controller = Controller; - exports.cloneEnvironment = function () { return clone({}); }; + return lastFolderMatch; +} - return exports; -}(exports)); -/* vim: set sw=4 ts=4 et tw=80 : */ +/** + * @param {ConditionalMapping|DirectMapping|null} mapping mapping + * @returns {boolean} is conditional mapping + */ +function isConditionalMapping(mapping) { + return ( + mapping !== null && typeof mapping === "object" && !Array.isArray(mapping) + ); +} +/** + * @param {string|undefined} remainingRequest remaining request when folder mapping, undefined for file mappings + * @param {boolean} subpathMapping true, for subpath mappings + * @param {DirectMapping|null} mappingTarget direct export + * @param {Set} conditionNames condition names + * @param {(d: string, f: boolean) => void} assert asserting direct value + * @returns {string[]} mapping result + */ +function directMapping( + remainingRequest, + subpathMapping, + mappingTarget, + conditionNames, + assert +) { + if (mappingTarget === null) return []; -/***/ }), + if (typeof mappingTarget === "string") { + return [ + targetMapping(remainingRequest, subpathMapping, mappingTarget, assert) + ]; + } -/***/ 86140: -/***/ (function(module) { + const targets = []; -module.exports = function (glob, opts) { - if (typeof glob !== 'string') { - throw new TypeError('Expected a string'); - } + for (const exp of mappingTarget) { + if (typeof exp === "string") { + targets.push( + targetMapping(remainingRequest, subpathMapping, exp, assert) + ); + continue; + } - var str = String(glob); + const mapping = conditionalMapping(exp, conditionNames); + if (!mapping) continue; + const innerExports = directMapping( + remainingRequest, + subpathMapping, + mapping, + conditionNames, + assert + ); + for (const innerExport of innerExports) { + targets.push(innerExport); + } + } - // The regexp we are building, as a string. - var reStr = ""; + return targets; +} - // Whether we are matching so called "extended" globs (like bash) and should - // support single character matching, matching ranges of characters, group - // matching, etc. - var extended = opts ? !!opts.extended : false; +/** + * @param {string|undefined} remainingRequest remaining request when folder mapping, undefined for file mappings + * @param {boolean} subpathMapping true, for subpath mappings + * @param {string} mappingTarget direct export + * @param {(d: string, f: boolean) => void} assert asserting direct value + * @returns {string} mapping result + */ +function targetMapping( + remainingRequest, + subpathMapping, + mappingTarget, + assert +) { + if (remainingRequest === undefined) { + assert(mappingTarget, false); + return mappingTarget; + } + if (subpathMapping) { + assert(mappingTarget, true); + return mappingTarget + remainingRequest; + } + assert(mappingTarget, false); + return mappingTarget.replace(/\*/g, remainingRequest.replace(/\$/g, "$$")); +} - // When globstar is _false_ (default), '/foo/*' is translated a regexp like - // '^\/foo\/.*$' which will match any string beginning with '/foo/' - // When globstar is _true_, '/foo/*' is translated to regexp like - // '^\/foo\/[^/]*$' which will match any string beginning with '/foo/' BUT - // which does not have a '/' to the right of it. - // E.g. with '/foo/*' these will match: '/foo/bar', '/foo/bar.txt' but - // these will not '/foo/bar/baz', '/foo/bar/baz.txt' - // Lastely, when globstar is _true_, '/foo/**' is equivelant to '/foo/*' when - // globstar is _false_ - var globstar = opts ? !!opts.globstar : false; +/** + * @param {ConditionalMapping} conditionalMapping_ conditional mapping + * @param {Set} conditionNames condition names + * @returns {DirectMapping|null} direct mapping if found + */ +function conditionalMapping(conditionalMapping_, conditionNames) { + /** @type {[ConditionalMapping, string[], number][]} */ + let lookup = [[conditionalMapping_, Object.keys(conditionalMapping_), 0]]; - // If we are doing extended matching, this boolean is true when we are inside - // a group (eg {*.html,*.js}), and false otherwise. - var inGroup = false; + loop: while (lookup.length > 0) { + const [mapping, conditions, j] = lookup[lookup.length - 1]; + const last = conditions.length - 1; - // RegExp flags (eg "i" ) to pass in to RegExp constructor. - var flags = opts && typeof( opts.flags ) === "string" ? opts.flags : ""; + for (let i = j; i < conditions.length; i++) { + const condition = conditions[i]; - var c; - for (var i = 0, len = str.length; i < len; i++) { - c = str[i]; + // assert default. Could be last only + if (i !== last) { + if (condition === "default") { + throw new Error("Default condition should be last one"); + } + } else if (condition === "default") { + const innerMapping = mapping[condition]; + // is nested + if (isConditionalMapping(innerMapping)) { + const conditionalMapping = /** @type {ConditionalMapping} */ (innerMapping); + lookup[lookup.length - 1][2] = i + 1; + lookup.push([conditionalMapping, Object.keys(conditionalMapping), 0]); + continue loop; + } - switch (c) { - case "/": - case "$": - case "^": - case "+": - case ".": - case "(": - case ")": - case "=": - case "!": - case "|": - reStr += "\\" + c; - break; + return /** @type {DirectMapping} */ (innerMapping); + } - case "?": - if (extended) { - reStr += "."; - break; - } + if (conditionNames.has(condition)) { + const innerMapping = mapping[condition]; + // is nested + if (isConditionalMapping(innerMapping)) { + const conditionalMapping = /** @type {ConditionalMapping} */ (innerMapping); + lookup[lookup.length - 1][2] = i + 1; + lookup.push([conditionalMapping, Object.keys(conditionalMapping), 0]); + continue loop; + } - case "[": - case "]": - if (extended) { - reStr += c; - break; - } + return /** @type {DirectMapping} */ (innerMapping); + } + } - case "{": - if (extended) { - inGroup = true; - reStr += "("; - break; - } + lookup.pop(); + } - case "}": - if (extended) { - inGroup = false; - reStr += ")"; - break; - } + return null; +} - case ",": - if (inGroup) { - reStr += "|"; - break; - } - reStr += "\\" + c; - break; +/** + * Internal helper to create path tree node + * to ensure that each node gets the same hidden class + * @returns {PathTreeNode} node + */ +function createNode() { + return { + children: null, + folder: null, + wildcards: null, + files: new Map() + }; +} - case "*": - // Move over all consecutive "*"'s. - // Also store the previous and next characters - var prevChar = str[i - 1]; - var starCount = 1; - while(str[i + 1] === "*") { - starCount++; - i++; - } - var nextChar = str[i + 1]; +/** + * Internal helper for building path tree + * @param {PathTreeNode} root root + * @param {string} path path + * @param {MappingValue} target target + */ +function walkPath(root, path, target) { + if (path.length === 0) { + root.folder = target; + return; + } - if (!globstar) { - // globstar is disabled, so treat any number of "*" as one - reStr += ".*"; - } else { - // globstar is enabled, so determine if this is a globstar segment - var isGlobstar = starCount > 1 // multiple "*"'s - && (prevChar === "/" || prevChar === undefined) // from the start of the segment - && (nextChar === "/" || nextChar === undefined) // to the end of the segment + let node = root; + // Typical path tree can looks like + // root + // - files: ["a.js", "b.js"] + // - children: + // node1: + // - files: ["a.js", "b.js"] + let lastNonSlashIndex = 0; + let slashIndex = path.indexOf("/", 0); - if (isGlobstar) { - // it's a globstar, so match zero or more path segments - reStr += "((?:[^/]*(?:\/|$))*)"; - i++; // move over the "/" - } else { - // it's not a globstar, so only match one path segment - reStr += "([^/]*)"; - } - } - break; + while (slashIndex !== -1) { + const folder = path.slice(lastNonSlashIndex, slashIndex); + let newNode; - default: - reStr += c; - } - } - - // When regexp 'g' flag is specified don't - // constrain the regular expression with ^ & $ - if (!flags || !~flags.indexOf('g')) { - reStr = "^" + reStr + "$"; - } - - return new RegExp(reStr, flags); -}; - - -/***/ }), - -/***/ 89132: -/***/ (function(module) { - -"use strict"; + if (node.children === null) { + newNode = createNode(); + node.children = new Map(); + node.children.set(folder, newNode); + } else { + newNode = node.children.get(folder); + if (!newNode) { + newNode = createNode(); + node.children.set(folder, newNode); + } + } -module.exports = clone + node = newNode; + lastNonSlashIndex = slashIndex + 1; + slashIndex = path.indexOf("/", lastNonSlashIndex); + } -var getPrototypeOf = Object.getPrototypeOf || function (obj) { - return obj.__proto__ + if (lastNonSlashIndex >= path.length) { + node.folder = target; + } else { + const file = lastNonSlashIndex > 0 ? path.slice(lastNonSlashIndex) : path; + if (file.endsWith("*")) { + if (node.wildcards === null) node.wildcards = new Map(); + node.wildcards.set(file.slice(0, -1), target); + } else { + node.files.set(file, target); + } + } } -function clone (obj) { - if (obj === null || typeof obj !== 'object') - return obj +/** + * @param {ExportsField} field exports field + * @returns {PathTreeNode} tree root + */ +function buildExportsFieldPathTree(field) { + const root = createNode(); - if (obj instanceof Object) - var copy = { __proto__: getPrototypeOf(obj) } - else - var copy = Object.create(null) + // handle syntax sugar, if exports field is direct mapping for "." + if (typeof field === "string") { + root.files.set("", field); - Object.getOwnPropertyNames(obj).forEach(function (key) { - Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) - }) + return root; + } else if (Array.isArray(field)) { + root.files.set("", field.slice()); - return copy -} + return root; + } + const keys = Object.keys(field); -/***/ }), + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; -/***/ 90552: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (key.charCodeAt(0) !== dotCode) { + // handle syntax sugar, if exports field is conditional mapping for "." + if (i === 0) { + while (i < keys.length) { + const charCode = keys[i].charCodeAt(0); + if (charCode === dotCode || charCode === slashCode) { + throw new Error( + `Exports field key should be relative path and start with "." (key: ${JSON.stringify( + key + )})` + ); + } + i++; + } -var fs = __webpack_require__(57147) -var polyfills = __webpack_require__(11290) -var legacy = __webpack_require__(54410) -var clone = __webpack_require__(89132) + root.files.set("", field); + return root; + } -var util = __webpack_require__(73837) + throw new Error( + `Exports field key should be relative path and start with "." (key: ${JSON.stringify( + key + )})` + ); + } -/* istanbul ignore next - node 0.x polyfill */ -var gracefulQueue -var previousSymbol + if (key.length === 1) { + root.files.set("", field[key]); + continue; + } -/* istanbul ignore else - node 0.x polyfill */ -if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { - gracefulQueue = Symbol.for('graceful-fs.queue') - // This is used in testing by future versions - previousSymbol = Symbol.for('graceful-fs.previous') -} else { - gracefulQueue = '___graceful-fs.queue' - previousSymbol = '___graceful-fs.previous' -} + if (key.charCodeAt(1) !== slashCode) { + throw new Error( + `Exports field key should be relative path and start with "./" (key: ${JSON.stringify( + key + )})` + ); + } -function noop () {} + walkPath(root, key.slice(2), field[key]); + } -function publishQueue(context, queue) { - Object.defineProperty(context, gracefulQueue, { - get: function() { - return queue - } - }) + return root; } -var debug = noop -if (util.debuglog) - debug = util.debuglog('gfs4') -else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) - debug = function() { - var m = util.format.apply(util, arguments) - m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') - console.error(m) - } +/** + * @param {ImportsField} field imports field + * @returns {PathTreeNode} root + */ +function buildImportsFieldPathTree(field) { + const root = createNode(); -// Once time initialization -if (!fs[gracefulQueue]) { - // This queue can be shared by multiple loaded instances - var queue = global[gracefulQueue] || [] - publishQueue(fs, queue) + const keys = Object.keys(field); - // Patch fs.close/closeSync to shared queue version, because we need - // to retry() whenever a close happens *anywhere* in the program. - // This is essential when multiple graceful-fs instances are - // in play at the same time. - fs.close = (function (fs$close) { - function close (fd, cb) { - return fs$close.call(fs, fd, function (err) { - // This function uses the graceful-fs shared queue - if (!err) { - resetQueue() - } + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; - if (typeof cb === 'function') - cb.apply(this, arguments) - }) - } + if (key.charCodeAt(0) !== hashCode) { + throw new Error( + `Imports field key should start with "#" (key: ${JSON.stringify(key)})` + ); + } - Object.defineProperty(close, previousSymbol, { - value: fs$close - }) - return close - })(fs.close) + if (key.length === 1) { + throw new Error( + `Imports field key should have at least 2 characters (key: ${JSON.stringify( + key + )})` + ); + } - fs.closeSync = (function (fs$closeSync) { - function closeSync (fd) { - // This function uses the graceful-fs shared queue - fs$closeSync.apply(fs, arguments) - resetQueue() - } + if (key.charCodeAt(1) === slashCode) { + throw new Error( + `Imports field key should not start with "#/" (key: ${JSON.stringify( + key + )})` + ); + } - Object.defineProperty(closeSync, previousSymbol, { - value: fs$closeSync - }) - return closeSync - })(fs.closeSync) + walkPath(root, key.slice(1), field[key]); + } - if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { - process.on('exit', function() { - debug(fs[gracefulQueue]) - __webpack_require__(39491).equal(fs[gracefulQueue].length, 0) - }) - } + return root; } -if (!global[gracefulQueue]) { - publishQueue(global, fs[gracefulQueue]); -} -module.exports = patch(clone(fs)) -if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { - module.exports = patch(fs) - fs.__patched = true; -} +/***/ }), -function patch (fs) { - // Everything that references the open() function needs to be in here - polyfills(fs) - fs.gracefulify = patch +/***/ 7780: +/***/ (function(module) { - fs.createReadStream = createReadStream - fs.createWriteStream = createWriteStream - var fs$readFile = fs.readFile - fs.readFile = readFile - function readFile (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ - return go$readFile(path, options, cb) - function go$readFile (path, options, cb, startTime) { - return fs$readFile(path, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - var fs$writeFile = fs.writeFile - fs.writeFile = writeFile - function writeFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null +const PATH_QUERY_FRAGMENT_REGEXP = /^(#?(?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/; - return go$writeFile(path, data, options, cb) +/** + * @param {string} identifier identifier + * @returns {[string, string, string]|null} parsed identifier + */ +function parseIdentifier(identifier) { + const match = PATH_QUERY_FRAGMENT_REGEXP.exec(identifier); - function go$writeFile (path, data, options, cb, startTime) { - return fs$writeFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } + if (!match) return null; - var fs$appendFile = fs.appendFile - if (fs$appendFile) - fs.appendFile = appendFile - function appendFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null + return [ + match[1].replace(/\0(.)/g, "$1"), + match[2] ? match[2].replace(/\0(.)/g, "$1") : "", + match[3] || "" + ]; +} - return go$appendFile(path, data, options, cb) +module.exports.parseIdentifier = parseIdentifier; - function go$appendFile (path, data, options, cb, startTime) { - return fs$appendFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - var fs$copyFile = fs.copyFile - if (fs$copyFile) - fs.copyFile = copyFile - function copyFile (src, dest, flags, cb) { - if (typeof flags === 'function') { - cb = flags - flags = 0 - } - return go$copyFile(src, dest, flags, cb) +/***/ }), - function go$copyFile (src, dest, flags, cb, startTime) { - return fs$copyFile(src, dest, flags, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } +/***/ 3011: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - var fs$readdir = fs.readdir - fs.readdir = readdir - function readdir (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - return go$readdir(path, options, cb) - function go$readdir (path, options, cb, startTime) { - return fs$readdir(path, options, function (err, files) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readdir, [path, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (files && files.sort) - files.sort() - if (typeof cb === 'function') - cb.call(this, err, files) - } - }) - } - } +const path = __webpack_require__(71017); - if (process.version.substr(0, 4) === 'v0.8') { - var legStreams = legacy(fs) - ReadStream = legStreams.ReadStream - WriteStream = legStreams.WriteStream - } +const CHAR_HASH = "#".charCodeAt(0); +const CHAR_SLASH = "/".charCodeAt(0); +const CHAR_BACKSLASH = "\\".charCodeAt(0); +const CHAR_A = "A".charCodeAt(0); +const CHAR_Z = "Z".charCodeAt(0); +const CHAR_LOWER_A = "a".charCodeAt(0); +const CHAR_LOWER_Z = "z".charCodeAt(0); +const CHAR_DOT = ".".charCodeAt(0); +const CHAR_COLON = ":".charCodeAt(0); - var fs$ReadStream = fs.ReadStream - if (fs$ReadStream) { - ReadStream.prototype = Object.create(fs$ReadStream.prototype) - ReadStream.prototype.open = ReadStream$open - } +const posixNormalize = path.posix.normalize; +const winNormalize = path.win32.normalize; - var fs$WriteStream = fs.WriteStream - if (fs$WriteStream) { - WriteStream.prototype = Object.create(fs$WriteStream.prototype) - WriteStream.prototype.open = WriteStream$open - } +/** + * @enum {number} + */ +const PathType = Object.freeze({ + Empty: 0, + Normal: 1, + Relative: 2, + AbsoluteWin: 3, + AbsolutePosix: 4, + Internal: 5 +}); +exports.PathType = PathType; - Object.defineProperty(fs, 'ReadStream', { - get: function () { - return ReadStream - }, - set: function (val) { - ReadStream = val - }, - enumerable: true, - configurable: true - }) - Object.defineProperty(fs, 'WriteStream', { - get: function () { - return WriteStream - }, - set: function (val) { - WriteStream = val - }, - enumerable: true, - configurable: true - }) +/** + * @param {string} p a path + * @returns {PathType} type of path + */ +const getType = p => { + switch (p.length) { + case 0: + return PathType.Empty; + case 1: { + const c0 = p.charCodeAt(0); + switch (c0) { + case CHAR_DOT: + return PathType.Relative; + case CHAR_SLASH: + return PathType.AbsolutePosix; + case CHAR_HASH: + return PathType.Internal; + } + return PathType.Normal; + } + case 2: { + const c0 = p.charCodeAt(0); + switch (c0) { + case CHAR_DOT: { + const c1 = p.charCodeAt(1); + switch (c1) { + case CHAR_DOT: + case CHAR_SLASH: + return PathType.Relative; + } + return PathType.Normal; + } + case CHAR_SLASH: + return PathType.AbsolutePosix; + case CHAR_HASH: + return PathType.Internal; + } + const c1 = p.charCodeAt(1); + if (c1 === CHAR_COLON) { + if ( + (c0 >= CHAR_A && c0 <= CHAR_Z) || + (c0 >= CHAR_LOWER_A && c0 <= CHAR_LOWER_Z) + ) { + return PathType.AbsoluteWin; + } + } + return PathType.Normal; + } + } + const c0 = p.charCodeAt(0); + switch (c0) { + case CHAR_DOT: { + const c1 = p.charCodeAt(1); + switch (c1) { + case CHAR_SLASH: + return PathType.Relative; + case CHAR_DOT: { + const c2 = p.charCodeAt(2); + if (c2 === CHAR_SLASH) return PathType.Relative; + return PathType.Normal; + } + } + return PathType.Normal; + } + case CHAR_SLASH: + return PathType.AbsolutePosix; + case CHAR_HASH: + return PathType.Internal; + } + const c1 = p.charCodeAt(1); + if (c1 === CHAR_COLON) { + const c2 = p.charCodeAt(2); + if ( + (c2 === CHAR_BACKSLASH || c2 === CHAR_SLASH) && + ((c0 >= CHAR_A && c0 <= CHAR_Z) || + (c0 >= CHAR_LOWER_A && c0 <= CHAR_LOWER_Z)) + ) { + return PathType.AbsoluteWin; + } + } + return PathType.Normal; +}; +exports.getType = getType; - // legacy names - var FileReadStream = ReadStream - Object.defineProperty(fs, 'FileReadStream', { - get: function () { - return FileReadStream - }, - set: function (val) { - FileReadStream = val - }, - enumerable: true, - configurable: true - }) - var FileWriteStream = WriteStream - Object.defineProperty(fs, 'FileWriteStream', { - get: function () { - return FileWriteStream - }, - set: function (val) { - FileWriteStream = val - }, - enumerable: true, - configurable: true - }) - - function ReadStream (path, options) { - if (this instanceof ReadStream) - return fs$ReadStream.apply(this, arguments), this - else - return ReadStream.apply(Object.create(ReadStream.prototype), arguments) - } - - function ReadStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - if (that.autoClose) - that.destroy() - - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - that.read() - } - }) - } - - function WriteStream (path, options) { - if (this instanceof WriteStream) - return fs$WriteStream.apply(this, arguments), this - else - return WriteStream.apply(Object.create(WriteStream.prototype), arguments) - } - - function WriteStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - that.destroy() - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - } - }) - } +/** + * @param {string} p a path + * @returns {string} the normalized path + */ +const normalize = p => { + switch (getType(p)) { + case PathType.Empty: + return p; + case PathType.AbsoluteWin: + return winNormalize(p); + case PathType.Relative: { + const r = posixNormalize(p); + return getType(r) === PathType.Relative ? r : `./${r}`; + } + } + return posixNormalize(p); +}; +exports.normalize = normalize; - function createReadStream (path, options) { - return new fs.ReadStream(path, options) - } +/** + * @param {string} rootPath the root path + * @param {string | undefined} request the request path + * @returns {string} the joined path + */ +const join = (rootPath, request) => { + if (!request) return normalize(rootPath); + const requestType = getType(request); + switch (requestType) { + case PathType.AbsolutePosix: + return posixNormalize(request); + case PathType.AbsoluteWin: + return winNormalize(request); + } + switch (getType(rootPath)) { + case PathType.Normal: + case PathType.Relative: + case PathType.AbsolutePosix: + return posixNormalize(`${rootPath}/${request}`); + case PathType.AbsoluteWin: + return winNormalize(`${rootPath}\\${request}`); + } + switch (requestType) { + case PathType.Empty: + return rootPath; + case PathType.Relative: { + const r = posixNormalize(rootPath); + return getType(r) === PathType.Relative ? r : `./${r}`; + } + } + return posixNormalize(rootPath); +}; +exports.join = join; - function createWriteStream (path, options) { - return new fs.WriteStream(path, options) - } +const joinCache = new Map(); - var fs$open = fs.open - fs.open = open - function open (path, flags, mode, cb) { - if (typeof mode === 'function') - cb = mode, mode = null +/** + * @param {string} rootPath the root path + * @param {string | undefined} request the request path + * @returns {string} the joined path + */ +const cachedJoin = (rootPath, request) => { + let cacheEntry; + let cache = joinCache.get(rootPath); + if (cache === undefined) { + joinCache.set(rootPath, (cache = new Map())); + } else { + cacheEntry = cache.get(request); + if (cacheEntry !== undefined) return cacheEntry; + } + cacheEntry = join(rootPath, request); + cache.set(request, cacheEntry); + return cacheEntry; +}; +exports.cachedJoin = cachedJoin; - return go$open(path, flags, mode, cb) +const checkExportsFieldTarget = relativePath => { + let lastNonSlashIndex = 2; + let slashIndex = relativePath.indexOf("/", 2); + let cd = 0; - function go$open (path, flags, mode, cb, startTime) { - return fs$open(path, flags, mode, function (err, fd) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } + while (slashIndex !== -1) { + const folder = relativePath.slice(lastNonSlashIndex, slashIndex); - return fs -} + switch (folder) { + case "..": { + cd--; + if (cd < 0) + return new Error( + `Trying to access out of package scope. Requesting ${relativePath}` + ); + break; + } + default: + cd++; + break; + } -function enqueue (elem) { - debug('ENQUEUE', elem[0].name, elem[1]) - fs[gracefulQueue].push(elem) - retry() -} + lastNonSlashIndex = slashIndex + 1; + slashIndex = relativePath.indexOf("/", lastNonSlashIndex); + } +}; +exports.checkExportsFieldTarget = checkExportsFieldTarget; -// keep track of the timeout between retry() calls -var retryTimer -// reset the startTime and lastTime to now -// this resets the start of the 60 second overall timeout as well as the -// delay between attempts so that we'll retry these jobs sooner -function resetQueue () { - var now = Date.now() - for (var i = 0; i < fs[gracefulQueue].length; ++i) { - // entries that are only a length of 2 are from an older version, don't - // bother modifying those since they'll be retried anyway. - if (fs[gracefulQueue][i].length > 2) { - fs[gracefulQueue][i][3] = now // startTime - fs[gracefulQueue][i][4] = now // lastTime - } - } - // call retry to make sure we're actively processing the queue - retry() -} +/***/ }), -function retry () { - // clear the timer and remove it to help prevent unintended concurrency - clearTimeout(retryTimer) - retryTimer = undefined +/***/ 70665: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (fs[gracefulQueue].length === 0) - return +"use strict"; +/* + Copyright (C) 2015 Yusuke Suzuki - var elem = fs[gracefulQueue].shift() - var fn = elem[0] - var args = elem[1] - // these items may be unset if they were added by an older graceful-fs - var err = elem[2] - var startTime = elem[3] - var lastTime = elem[4] + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: - // if we don't have a startTime we have no way of knowing if we've waited - // long enough, so go ahead and retry this item now - if (startTime === undefined) { - debug('RETRY', fn.name, args) - fn.apply(null, args) - } else if (Date.now() - startTime >= 60000) { - // it's been more than 60 seconds total, bail now - debug('TIMEOUT', fn.name, args) - var cb = args.pop() - if (typeof cb === 'function') - cb.call(null, err) - } else { - // the amount of time between the last attempt and right now - var sinceAttempt = Date.now() - lastTime - // the amount of time between when we first tried, and when we last tried - // rounded up to at least 1 - var sinceStart = Math.max(lastTime - startTime, 1) - // backoff. wait longer than the total time we've been retrying, but only - // up to a maximum of 100ms - var desiredDelay = Math.min(sinceStart * 1.2, 100) - // it's been long enough since the last retry, do it again - if (sinceAttempt >= desiredDelay) { - debug('RETRY', fn.name, args) - fn.apply(null, args.concat([startTime])) - } else { - // if we can't do this job yet, push it to the end of the queue - // and let the next iteration check again - fs[gracefulQueue].push(elem) - } - } + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - // schedule our next run if one isn't already scheduled - if (retryTimer === undefined) { - retryTimer = setTimeout(retry, 0) - } -} + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ -/***/ }), +const Variable = __webpack_require__(82971); -/***/ 54410: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * @class Definition + */ +class Definition { + constructor(type, name, node, parent, index, kind) { -var Stream = (__webpack_require__(12781).Stream) + /** + * @member {String} Definition#type - type of the occurrence (e.g. "Parameter", "Variable", ...). + */ + this.type = type; -module.exports = legacy + /** + * @member {espree.Identifier} Definition#name - the identifier AST node of the occurrence. + */ + this.name = name; -function legacy (fs) { - return { - ReadStream: ReadStream, - WriteStream: WriteStream - } + /** + * @member {espree.Node} Definition#node - the enclosing node of the identifier. + */ + this.node = node; - function ReadStream (path, options) { - if (!(this instanceof ReadStream)) return new ReadStream(path, options); + /** + * @member {espree.Node?} Definition#parent - the enclosing statement node of the identifier. + */ + this.parent = parent; - Stream.call(this); + /** + * @member {Number?} Definition#index - the index in the declaration statement. + */ + this.index = index; - var self = this; + /** + * @member {String?} Definition#kind - the kind of the declaration statement. + */ + this.kind = kind; + } +} - this.path = path; - this.fd = null; - this.readable = true; - this.paused = false; +/** + * @class ParameterDefinition + */ +class ParameterDefinition extends Definition { + constructor(name, node, index, rest) { + super(Variable.Parameter, name, node, null, index, null); - this.flags = 'r'; - this.mode = 438; /*=0666*/ - this.bufferSize = 64 * 1024; + /** + * Whether the parameter definition is a part of a rest parameter. + * @member {boolean} ParameterDefinition#rest + */ + this.rest = rest; + } +} - options = options || {}; +module.exports = { + ParameterDefinition, + Definition +}; - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } +/* vim: set sw=4 ts=4 et tw=80 : */ - if (this.encoding) this.setEncoding(this.encoding); - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.end === undefined) { - this.end = Infinity; - } else if ('number' !== typeof this.end) { - throw TypeError('end must be a Number'); - } +/***/ }), - if (this.start > this.end) { - throw new Error('start must be <= end'); - } +/***/ 36007: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - this.pos = this.start; - } +"use strict"; +/* + Copyright (C) 2012-2014 Yusuke Suzuki + Copyright (C) 2013 Alex Seville + Copyright (C) 2014 Thiago de Arruda - if (this.fd !== null) { - process.nextTick(function() { - self._read(); - }); - return; - } + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: - fs.open(this.path, this.flags, this.mode, function (err, fd) { - if (err) { - self.emit('error', err); - self.readable = false; - return; - } + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - self.fd = fd; - self.emit('open', fd); - self._read(); - }) - } + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ - function WriteStream (path, options) { - if (!(this instanceof WriteStream)) return new WriteStream(path, options); +/** + * Escope (escope) is an ECMAScript + * scope analyzer extracted from the esmangle project. + *

+ * escope finds lexical scopes in a source program, i.e. areas of that + * program where different occurrences of the same identifier refer to the same + * variable. With each scope the contained variables are collected, and each + * identifier reference in code is linked to its corresponding variable (if + * possible). + *

+ * escope works on a syntax tree of the parsed source code which has + * to adhere to the + * Mozilla Parser API. E.g. espree is a parser + * that produces such syntax trees. + *

+ * The main interface is the {@link analyze} function. + * @module escope + */ - Stream.call(this); - this.path = path; - this.fd = null; - this.writable = true; +/* eslint no-underscore-dangle: ["error", { "allow": ["__currentScope"] }] */ - this.flags = 'w'; - this.encoding = 'binary'; - this.mode = 438; /*=0666*/ - this.bytesWritten = 0; +const assert = __webpack_require__(39491); - options = options || {}; +const ScopeManager = __webpack_require__(96988); +const Referencer = __webpack_require__(44585); +const Reference = __webpack_require__(64945); +const Variable = __webpack_require__(82971); +const Scope = (__webpack_require__(16313).Scope); +const version = (__webpack_require__(30290)/* .version */ .i8); - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } +/** + * Set the default options + * @returns {Object} options + */ +function defaultOptions() { + return { + optimistic: false, + directive: false, + nodejsScope: false, + impliedStrict: false, + sourceType: "script", // one of ['script', 'module'] + ecmaVersion: 5, + childVisitorKeys: null, + fallback: "iteration" + }; +} - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.start < 0) { - throw new Error('start must be >= zero'); - } +/** + * Preform deep update on option object + * @param {Object} target - Options + * @param {Object} override - Updates + * @returns {Object} Updated options + */ +function updateDeeply(target, override) { - this.pos = this.start; + /** + * Is hash object + * @param {Object} value - Test value + * @returns {boolean} Result + */ + function isHashObject(value) { + return typeof value === "object" && value instanceof Object && !(value instanceof Array) && !(value instanceof RegExp); } - this.busy = false; - this._queue = []; + for (const key in override) { + if (Object.prototype.hasOwnProperty.call(override, key)) { + const val = override[key]; - if (this.fd === null) { - this._open = fs.open; - this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); - this.flush(); + if (isHashObject(val)) { + if (isHashObject(target[key])) { + updateDeeply(target[key], val); + } else { + target[key] = updateDeeply({}, val); + } + } else { + target[key] = val; + } + } } - } + return target; } +/** + * Main interface function. Takes an Espree syntax tree and returns the + * analyzed scopes. + * @function analyze + * @param {espree.Tree} tree - Abstract Syntax Tree + * @param {Object} providedOptions - Options that tailor the scope analysis + * @param {boolean} [providedOptions.optimistic=false] - the optimistic flag + * @param {boolean} [providedOptions.directive=false]- the directive flag + * @param {boolean} [providedOptions.ignoreEval=false]- whether to check 'eval()' calls + * @param {boolean} [providedOptions.nodejsScope=false]- whether the whole + * script is executed under node.js environment. When enabled, escope adds + * a function scope immediately following the global scope. + * @param {boolean} [providedOptions.impliedStrict=false]- implied strict mode + * (if ecmaVersion >= 5). + * @param {string} [providedOptions.sourceType='script']- the source type of the script. one of 'script' and 'module' + * @param {number} [providedOptions.ecmaVersion=5]- which ECMAScript version is considered + * @param {Object} [providedOptions.childVisitorKeys=null] - Additional known visitor keys. See [esrecurse](https://github.com/estools/esrecurse)'s the `childVisitorKeys` option. + * @param {string} [providedOptions.fallback='iteration'] - A kind of the fallback in order to encounter with unknown node. See [esrecurse](https://github.com/estools/esrecurse)'s the `fallback` option. + * @returns {ScopeManager} ScopeManager + */ +function analyze(tree, providedOptions) { + const options = updateDeeply(defaultOptions(), providedOptions); + const scopeManager = new ScopeManager(options); + const referencer = new Referencer(options, scopeManager); -/***/ }), - -/***/ 11290: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -var constants = __webpack_require__(22057) - -var origCwd = process.cwd -var cwd = null + referencer.visit(tree); -var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform + assert(scopeManager.__currentScope === null, "currentScope should be null."); -process.cwd = function() { - if (!cwd) - cwd = origCwd.call(process) - return cwd + return scopeManager; } -try { - process.cwd() -} catch (er) {} -// This check is needed until node.js 12 is required -if (typeof process.chdir === 'function') { - var chdir = process.chdir - process.chdir = function (d) { - cwd = null - chdir.call(process, d) - } - if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) -} +module.exports = { -module.exports = patch + /** @name module:escope.version */ + version, -function patch (fs) { - // (re-)implement some things that are known busted or missing. + /** @name module:escope.Reference */ + Reference, - // lchmod, broken prior to 0.6.2 - // back-port the fix here. - if (constants.hasOwnProperty('O_SYMLINK') && - process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs) - } + /** @name module:escope.Variable */ + Variable, - // lutimes implementation, or no-op - if (!fs.lutimes) { - patchLutimes(fs) - } + /** @name module:escope.Scope */ + Scope, - // https://github.com/isaacs/node-graceful-fs/issues/4 - // Chown should not fail on einval or eperm if non-root. - // It should not fail on enosys ever, as this just indicates - // that a fs doesn't support the intended operation. + /** @name module:escope.ScopeManager */ + ScopeManager, + analyze +}; - fs.chown = chownFix(fs.chown) - fs.fchown = chownFix(fs.fchown) - fs.lchown = chownFix(fs.lchown) - fs.chmod = chmodFix(fs.chmod) - fs.fchmod = chmodFix(fs.fchmod) - fs.lchmod = chmodFix(fs.lchmod) +/* vim: set sw=4 ts=4 et tw=80 : */ - fs.chownSync = chownFixSync(fs.chownSync) - fs.fchownSync = chownFixSync(fs.fchownSync) - fs.lchownSync = chownFixSync(fs.lchownSync) - fs.chmodSync = chmodFixSync(fs.chmodSync) - fs.fchmodSync = chmodFixSync(fs.fchmodSync) - fs.lchmodSync = chmodFixSync(fs.lchmodSync) +/***/ }), - fs.stat = statFix(fs.stat) - fs.fstat = statFix(fs.fstat) - fs.lstat = statFix(fs.lstat) +/***/ 54162: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - fs.statSync = statFixSync(fs.statSync) - fs.fstatSync = statFixSync(fs.fstatSync) - fs.lstatSync = statFixSync(fs.lstatSync) +"use strict"; +/* + Copyright (C) 2015 Yusuke Suzuki - // if lchmod/lchown do not exist, then make them no-ops - if (!fs.lchmod) { - fs.lchmod = function (path, mode, cb) { - if (cb) process.nextTick(cb) - } - fs.lchmodSync = function () {} - } - if (!fs.lchown) { - fs.lchown = function (path, uid, gid, cb) { - if (cb) process.nextTick(cb) - } - fs.lchownSync = function () {} - } + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: - // on Windows, A/V software can lock the directory, causing this - // to fail with an EACCES or EPERM if the directory contains newly - // created files. Try again on failure, for up to 60 seconds. + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - // Set the timeout this long because some Windows Anti-Virus, such as Parity - // bit9, may lock files for up to a minute, causing npm package install - // failures. Also, take care to yield the scheduler. Windows scheduling gives - // CPU to a busy looping process, which can cause the program causing the lock - // contention to be starved of CPU by node, so the contention doesn't resolve. - if (platform === "win32") { - fs.rename = (function (fs$rename) { return function (from, to, cb) { - var start = Date.now() - var backoff = 0; - fs$rename(from, to, function CB (er) { - if (er - && (er.code === "EACCES" || er.code === "EPERM") - && Date.now() - start < 60000) { - setTimeout(function() { - fs.stat(to, function (stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er) - }) - }, backoff) - if (backoff < 100) - backoff += 10; - return; - } - if (cb) cb(er) - }) - }})(fs.rename) - } + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ - // if read() returns EAGAIN, then just try it again. - fs.read = (function (fs$read) { - function read (fd, buffer, offset, length, position, callback_) { - var callback - if (callback_ && typeof callback_ === 'function') { - var eagCounter = 0 - callback = function (er, _, __) { - if (er && er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - callback_.apply(this, arguments) - } - } - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - // This ensures `util.promisify` works as it does for native `fs.read`. - if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) - return read - })(fs.read) +/* eslint-disable no-undefined */ - fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { - var eagCounter = 0 - while (true) { - try { - return fs$readSync.call(fs, fd, buffer, offset, length, position) - } catch (er) { - if (er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - continue - } - throw er - } +const Syntax = (__webpack_require__(18350).Syntax); +const esrecurse = __webpack_require__(81217); + +/** + * Get last array element + * @param {array} xs - array + * @returns {any} Last elment + */ +function getLast(xs) { + return xs[xs.length - 1] || null; +} + +class PatternVisitor extends esrecurse.Visitor { + static isPattern(node) { + const nodeType = node.type; + + return ( + nodeType === Syntax.Identifier || + nodeType === Syntax.ObjectPattern || + nodeType === Syntax.ArrayPattern || + nodeType === Syntax.SpreadElement || + nodeType === Syntax.RestElement || + nodeType === Syntax.AssignmentPattern + ); } - }})(fs.readSync) - function patchLchmod (fs) { - fs.lchmod = function (path, mode, callback) { - fs.open( path - , constants.O_WRONLY | constants.O_SYMLINK - , mode - , function (err, fd) { - if (err) { - if (callback) callback(err) - return - } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - fs.fchmod(fd, mode, function (err) { - fs.close(fd, function(err2) { - if (callback) callback(err || err2) - }) - }) - }) + constructor(options, rootPattern, callback) { + super(null, options); + this.rootPattern = rootPattern; + this.callback = callback; + this.assignments = []; + this.rightHandNodes = []; + this.restElements = []; } - fs.lchmodSync = function (path, mode) { - var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + Identifier(pattern) { + const lastRestElement = getLast(this.restElements); - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - var threw = true - var ret - try { - ret = fs.fchmodSync(fd, mode) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret + this.callback(pattern, { + topLevel: pattern === this.rootPattern, + rest: lastRestElement !== null && lastRestElement !== undefined && lastRestElement.argument === pattern, + assignments: this.assignments + }); } - } - function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK")) { - fs.lutimes = function (path, at, mt, cb) { - fs.open(path, constants.O_SYMLINK, function (er, fd) { - if (er) { - if (cb) cb(er) - return - } - fs.futimes(fd, at, mt, function (er) { - fs.close(fd, function (er2) { - if (cb) cb(er || er2) - }) - }) - }) - } + Property(property) { - fs.lutimesSync = function (path, at, mt) { - var fd = fs.openSync(path, constants.O_SYMLINK) - var ret - var threw = true - try { - ret = fs.futimesSync(fd, at, mt) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } + // Computed property's key is a right hand node. + if (property.computed) { + this.rightHandNodes.push(property.key); } - return ret - } - } else { - fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } - fs.lutimesSync = function () {} + // If it's shorthand, its key is same as its value. + // If it's shorthand and has its default value, its key is same as its value.left (the value is AssignmentPattern). + // If it's not shorthand, the name of new variable is its value's. + this.visit(property.value); } - } - function chmodFix (orig) { - if (!orig) return orig - return function (target, mode, cb) { - return orig.call(fs, target, mode, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } + ArrayPattern(pattern) { + for (let i = 0, iz = pattern.elements.length; i < iz; ++i) { + const element = pattern.elements[i]; - function chmodFixSync (orig) { - if (!orig) return orig - return function (target, mode) { - try { - return orig.call(fs, target, mode) - } catch (er) { - if (!chownErOk(er)) throw er - } + this.visit(element); + } } - } - - function chownFix (orig) { - if (!orig) return orig - return function (target, uid, gid, cb) { - return orig.call(fs, target, uid, gid, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) + AssignmentPattern(pattern) { + this.assignments.push(pattern); + this.visit(pattern.left); + this.rightHandNodes.push(pattern.right); + this.assignments.pop(); } - } - function chownFixSync (orig) { - if (!orig) return orig - return function (target, uid, gid) { - try { - return orig.call(fs, target, uid, gid) - } catch (er) { - if (!chownErOk(er)) throw er - } + RestElement(pattern) { + this.restElements.push(pattern); + this.visit(pattern.argument); + this.restElements.pop(); } - } - function statFix (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options, cb) { - if (typeof options === 'function') { - cb = options - options = null - } - function callback (er, stats) { - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 + MemberExpression(node) { + + // Computed property's key is a right hand node. + if (node.computed) { + this.rightHandNodes.push(node.property); } - if (cb) cb.apply(this, arguments) - } - return options ? orig.call(fs, target, options, callback) - : orig.call(fs, target, callback) - } - } - function statFixSync (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options) { - var stats = options ? orig.call(fs, target, options) - : orig.call(fs, target) - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - return stats; + // the object is only read, write to its property. + this.rightHandNodes.push(node.object); } - } - - // ENOSYS means that the fs doesn't support the op. Just ignore - // that, because it doesn't matter. - // - // if there's no getuid, or if getuid() is something other - // than 0, and the error is EINVAL or EPERM, then just ignore - // it. - // - // This specific case is a silent failure in cp, install, tar, - // and most other unix tools that manage permissions. - // - // When running as root, or if other types of errors are - // encountered, then it's strict. - function chownErOk (er) { - if (!er) - return true - if (er.code === "ENOSYS") - return true + // + // ForInStatement.left and AssignmentExpression.left are LeftHandSideExpression. + // By spec, LeftHandSideExpression is Pattern or MemberExpression. + // (see also: https://github.com/estree/estree/pull/20#issuecomment-74584758) + // But espree 2.0 parses to ArrayExpression, ObjectExpression, etc... + // - var nonroot = !process.getuid || process.getuid() !== 0 - if (nonroot) { - if (er.code === "EINVAL" || er.code === "EPERM") - return true + SpreadElement(node) { + this.visit(node.argument); } - return false - } -} - - -/***/ }), - -/***/ 15235: -/***/ (function(module) { + ArrayExpression(node) { + node.elements.forEach(this.visit, this); + } -"use strict"; + AssignmentExpression(node) { + this.assignments.push(node); + this.visit(node.left); + this.rightHandNodes.push(node.right); + this.assignments.pop(); + } + CallExpression(node) { -module.exports = parseJson -function parseJson (txt, reviver, context) { - context = context || 20 - try { - return JSON.parse(txt, reviver) - } catch (e) { - if (typeof txt !== 'string') { - const isEmptyArray = Array.isArray(txt) && txt.length === 0 - const errorMessage = 'Cannot parse ' + - (isEmptyArray ? 'an empty array' : String(txt)) - throw new TypeError(errorMessage) - } - const syntaxErr = e.message.match(/^Unexpected token.*position\s+(\d+)/i) - const errIdx = syntaxErr - ? +syntaxErr[1] - : e.message.match(/^Unexpected end of JSON.*/i) - ? txt.length - 1 - : null - if (errIdx != null) { - const start = errIdx <= context - ? 0 - : errIdx - context - const end = errIdx + context >= txt.length - ? txt.length - : errIdx + context - e.message += ` while parsing near '${ - start === 0 ? '' : '...' - }${txt.slice(start, end)}${ - end === txt.length ? '' : '...' - }'` - } else { - e.message += ` while parsing '${txt.slice(0, context * 2)}'` + // arguments are right hand nodes. + node.arguments.forEach(a => { + this.rightHandNodes.push(a); + }); + this.visit(node.callee); } - throw e - } } +module.exports = PatternVisitor; + +/* vim: set sw=4 ts=4 et tw=80 : */ + /***/ }), -/***/ 54983: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 64945: +/***/ (function(module) { "use strict"; -var __webpack_unused_export__; +/* + Copyright (C) 2015 Yusuke Suzuki + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: -__webpack_unused_export__ = ({ - value: true -}); -exports.Z = void 0; - -const { - stringHints, - numberHints -} = __webpack_require__(79926); -/** @typedef {import("json-schema").JSONSchema6} JSONSchema6 */ - -/** @typedef {import("json-schema").JSONSchema7} JSONSchema7 */ - -/** @typedef {import("./validate").Schema} Schema */ - -/** @typedef {import("./validate").ValidationErrorConfiguration} ValidationErrorConfiguration */ - -/** @typedef {import("./validate").PostFormatter} PostFormatter */ - -/** @typedef {import("./validate").SchemaUtilErrorObject} SchemaUtilErrorObject */ - -/** @enum {number} */ - + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. -const SPECIFICITY = { - type: 1, - not: 1, - oneOf: 1, - anyOf: 1, - if: 1, - enum: 1, - const: 1, - instanceof: 1, - required: 2, - pattern: 2, - patternRequired: 2, - format: 2, - formatMinimum: 2, - formatMaximum: 2, - minimum: 2, - exclusiveMinimum: 2, - maximum: 2, - exclusiveMaximum: 2, - multipleOf: 2, - uniqueItems: 2, - contains: 2, - minLength: 2, - maxLength: 2, - minItems: 2, - maxItems: 2, - minProperties: 2, - maxProperties: 2, - dependencies: 2, - propertyNames: 2, - additionalItems: 2, - additionalProperties: 2, - absolutePath: 2 -}; -/** - * - * @param {Array} array - * @param {(item: SchemaUtilErrorObject) => number} fn - * @returns {Array} - */ + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ -function filterMax(array, fn) { - const evaluatedMax = array.reduce((max, item) => Math.max(max, fn(item)), 0); - return array.filter(item => fn(item) === evaluatedMax); -} -/** - * - * @param {Array} children - * @returns {Array} - */ +const READ = 0x1; +const WRITE = 0x2; +const RW = READ | WRITE; -function filterChildren(children) { - let newChildren = children; - newChildren = filterMax(newChildren, - /** - * - * @param {SchemaUtilErrorObject} error - * @returns {number} - */ - error => error.dataPath ? error.dataPath.length : 0); - newChildren = filterMax(newChildren, - /** - * @param {SchemaUtilErrorObject} error - * @returns {number} - */ - error => SPECIFICITY[ - /** @type {keyof typeof SPECIFICITY} */ - error.keyword] || 2); - return newChildren; -} /** - * Find all children errors - * @param {Array} children - * @param {Array} schemaPaths - * @return {number} returns index of first child + * A Reference represents a single occurrence of an identifier in code. + * @class Reference */ +class Reference { + constructor(ident, scope, flag, writeExpr, maybeImplicitGlobal, partial, init) { + /** + * Identifier syntax node. + * @member {espreeIdentifier} Reference#identifier + */ + this.identifier = ident; -function findAllChildren(children, schemaPaths) { - let i = children.length - 1; - - const predicate = - /** - * @param {string} schemaPath - * @returns {boolean} - */ - schemaPath => children[i].schemaPath.indexOf(schemaPath) !== 0; - - while (i > -1 && !schemaPaths.every(predicate)) { - if (children[i].keyword === "anyOf" || children[i].keyword === "oneOf") { - const refs = extractRefs(children[i]); - const childrenStart = findAllChildren(children.slice(0, i), refs.concat(children[i].schemaPath)); - i = childrenStart - 1; - } else { - i -= 1; - } - } - - return i + 1; -} -/** - * Extracts all refs from schema - * @param {SchemaUtilErrorObject} error - * @return {Array} - */ + /** + * Reference to the enclosing Scope. + * @member {Scope} Reference#from + */ + this.from = scope; + /** + * Whether the reference comes from a dynamic scope (such as 'eval', + * 'with', etc.), and may be trapped by dynamic scopes. + * @member {boolean} Reference#tainted + */ + this.tainted = false; -function extractRefs(error) { - const { - schema - } = error; + /** + * The variable this reference is resolved with. + * @member {Variable} Reference#resolved + */ + this.resolved = null; - if (!Array.isArray(schema)) { - return []; - } + /** + * The read-write mode of the reference. (Value is one of {@link + * Reference.READ}, {@link Reference.RW}, {@link Reference.WRITE}). + * @member {number} Reference#flag + * @private + */ + this.flag = flag; + if (this.isWrite()) { - return schema.map(({ - $ref - }) => $ref).filter(s => s); -} -/** - * Groups children by their first level parent (assuming that error is root) - * @param {Array} children - * @return {Array} - */ + /** + * If reference is writeable, this is the tree being written to it. + * @member {espreeNode} Reference#writeExpr + */ + this.writeExpr = writeExpr; + /** + * Whether the Reference might refer to a partial value of writeExpr. + * @member {boolean} Reference#partial + */ + this.partial = partial; -function groupChildrenByFirstChild(children) { - const result = []; - let i = children.length - 1; + /** + * Whether the Reference is to write of initialization. + * @member {boolean} Reference#init + */ + this.init = init; + } + this.__maybeImplicitGlobal = maybeImplicitGlobal; + } - while (i > 0) { - const child = children[i]; + /** + * Whether the reference is static. + * @method Reference#isStatic + * @returns {boolean} static + */ + isStatic() { + return !this.tainted && this.resolved && this.resolved.scope.isStatic(); + } - if (child.keyword === "anyOf" || child.keyword === "oneOf") { - const refs = extractRefs(child); - const childrenStart = findAllChildren(children.slice(0, i), refs.concat(child.schemaPath)); + /** + * Whether the reference is writeable. + * @method Reference#isWrite + * @returns {boolean} write + */ + isWrite() { + return !!(this.flag & Reference.WRITE); + } - if (childrenStart !== i) { - result.push(Object.assign({}, child, { - children: children.slice(childrenStart, i) - })); - i = childrenStart; - } else { - result.push(child); - } - } else { - result.push(child); + /** + * Whether the reference is readable. + * @method Reference#isRead + * @returns {boolean} read + */ + isRead() { + return !!(this.flag & Reference.READ); } - i -= 1; - } + /** + * Whether the reference is read-only. + * @method Reference#isReadOnly + * @returns {boolean} read only + */ + isReadOnly() { + return this.flag === Reference.READ; + } - if (i === 0) { - result.push(children[i]); - } + /** + * Whether the reference is write-only. + * @method Reference#isWriteOnly + * @returns {boolean} write only + */ + isWriteOnly() { + return this.flag === Reference.WRITE; + } - return result.reverse(); + /** + * Whether the reference is read-write. + * @method Reference#isReadWrite + * @returns {boolean} read write + */ + isReadWrite() { + return this.flag === Reference.RW; + } } -/** - * @param {string} str - * @param {string} prefix - * @returns {string} - */ - -function indent(str, prefix) { - return str.replace(/\n(?!$)/g, `\n${prefix}`); -} /** - * @param {Schema} schema - * @returns {schema is (Schema & {not: Schema})} + * @constant Reference.READ + * @private */ +Reference.READ = READ; - -function hasNotInSchema(schema) { - return !!schema.not; -} /** - * @param {Schema} schema - * @return {Schema} + * @constant Reference.WRITE + * @private */ +Reference.WRITE = WRITE; - -function findFirstTypedSchema(schema) { - if (hasNotInSchema(schema)) { - return findFirstTypedSchema(schema.not); - } - - return schema; -} /** - * @param {Schema} schema - * @return {boolean} + * @constant Reference.RW + * @private */ +Reference.RW = RW; +module.exports = Reference; -function canApplyNot(schema) { - const typedSchema = findFirstTypedSchema(schema); - return likeNumber(typedSchema) || likeInteger(typedSchema) || likeString(typedSchema) || likeNull(typedSchema) || likeBoolean(typedSchema); -} -/** - * @param {any} maybeObj - * @returns {boolean} - */ +/* vim: set sw=4 ts=4 et tw=80 : */ -function isObject(maybeObj) { - return typeof maybeObj === "object" && maybeObj !== null; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ +/***/ }), +/***/ 44585: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -function likeNumber(schema) { - return schema.type === "number" || typeof schema.minimum !== "undefined" || typeof schema.exclusiveMinimum !== "undefined" || typeof schema.maximum !== "undefined" || typeof schema.exclusiveMaximum !== "undefined" || typeof schema.multipleOf !== "undefined"; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ +"use strict"; +/* + Copyright (C) 2015 Yusuke Suzuki + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: -function likeInteger(schema) { - return schema.type === "integer" || typeof schema.minimum !== "undefined" || typeof schema.exclusiveMinimum !== "undefined" || typeof schema.maximum !== "undefined" || typeof schema.exclusiveMaximum !== "undefined" || typeof schema.multipleOf !== "undefined"; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ -function likeString(schema) { - return schema.type === "string" || typeof schema.minLength !== "undefined" || typeof schema.maxLength !== "undefined" || typeof schema.pattern !== "undefined" || typeof schema.format !== "undefined" || typeof schema.formatMinimum !== "undefined" || typeof schema.formatMaximum !== "undefined"; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable no-undefined */ -function likeBoolean(schema) { - return schema.type === "boolean"; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ +const Syntax = (__webpack_require__(18350).Syntax); +const esrecurse = __webpack_require__(81217); +const Reference = __webpack_require__(64945); +const Variable = __webpack_require__(82971); +const PatternVisitor = __webpack_require__(54162); +const definition = __webpack_require__(70665); +const assert = __webpack_require__(39491); +const ParameterDefinition = definition.ParameterDefinition; +const Definition = definition.Definition; -function likeArray(schema) { - return schema.type === "array" || typeof schema.minItems === "number" || typeof schema.maxItems === "number" || typeof schema.uniqueItems !== "undefined" || typeof schema.items !== "undefined" || typeof schema.additionalItems !== "undefined" || typeof schema.contains !== "undefined"; -} /** - * @param {Schema & {patternRequired?: Array}} schema - * @returns {boolean} + * Traverse identifier in pattern + * @param {Object} options - options + * @param {pattern} rootPattern - root pattern + * @param {Refencer} referencer - referencer + * @param {callback} callback - callback + * @returns {void} */ +function traverseIdentifierInPattern(options, rootPattern, referencer, callback) { + + // Call the callback at left hand identifier nodes, and Collect right hand nodes. + const visitor = new PatternVisitor(options, rootPattern, callback); + visitor.visit(rootPattern); -function likeObject(schema) { - return schema.type === "object" || typeof schema.minProperties !== "undefined" || typeof schema.maxProperties !== "undefined" || typeof schema.required !== "undefined" || typeof schema.properties !== "undefined" || typeof schema.patternProperties !== "undefined" || typeof schema.additionalProperties !== "undefined" || typeof schema.dependencies !== "undefined" || typeof schema.propertyNames !== "undefined" || typeof schema.patternRequired !== "undefined"; + // Process the right hand nodes recursively. + if (referencer !== null && referencer !== undefined) { + visitor.rightHandNodes.forEach(referencer.visit, referencer); + } } -/** - * @param {Schema} schema - * @returns {boolean} - */ +// Importing ImportDeclaration. +// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-moduledeclarationinstantiation +// https://github.com/estree/estree/blob/master/es6.md#importdeclaration +// FIXME: Now, we don't create module environment, because the context is +// implementation dependent. -function likeNull(schema) { - return schema.type === "null"; -} -/** - * @param {string} type - * @returns {string} - */ +class Importer extends esrecurse.Visitor { + constructor(declaration, referencer) { + super(null, referencer.options); + this.declaration = declaration; + this.referencer = referencer; + } + + visitImport(id, specifier) { + this.referencer.visitPattern(id, pattern => { + this.referencer.currentScope().__define(pattern, + new Definition( + Variable.ImportBinding, + pattern, + specifier, + this.declaration, + null, + null + )); + }); + } + ImportNamespaceSpecifier(node) { + const local = (node.local || node.id); -function getArticle(type) { - if (/^[aeiou]/i.test(type)) { - return "an"; - } + if (local) { + this.visitImport(local, node); + } + } - return "a"; -} -/** - * @param {Schema=} schema - * @returns {string} - */ + ImportDefaultSpecifier(node) { + const local = (node.local || node.id); + this.visitImport(local, node); + } -function getSchemaNonTypes(schema) { - if (!schema) { - return ""; - } + ImportSpecifier(node) { + const local = (node.local || node.id); - if (!schema.type) { - if (likeNumber(schema) || likeInteger(schema)) { - return " | should be any non-number"; + if (node.name) { + this.visitImport(node.name, node); + } else { + this.visitImport(local, node); + } } +} - if (likeString(schema)) { - return " | should be any non-string"; +// Referencing variables and creating bindings. +class Referencer extends esrecurse.Visitor { + constructor(options, scopeManager) { + super(null, options); + this.options = options; + this.scopeManager = scopeManager; + this.parent = null; + this.isInnerMethodDefinition = false; } - if (likeArray(schema)) { - return " | should be any non-array"; + currentScope() { + return this.scopeManager.__currentScope; } - if (likeObject(schema)) { - return " | should be any non-object"; + close(node) { + while (this.currentScope() && node === this.currentScope().block) { + this.scopeManager.__currentScope = this.currentScope().__close(this.scopeManager); + } } - } - return ""; -} -/** - * @param {Array} hints - * @returns {string} - */ + pushInnerMethodDefinition(isInnerMethodDefinition) { + const previous = this.isInnerMethodDefinition; + this.isInnerMethodDefinition = isInnerMethodDefinition; + return previous; + } -function formatHints(hints) { - return hints.length > 0 ? `(${hints.join(", ")})` : ""; -} -/** - * @param {Schema} schema - * @param {boolean} logic - * @returns {string[]} - */ + popInnerMethodDefinition(isInnerMethodDefinition) { + this.isInnerMethodDefinition = isInnerMethodDefinition; + } + referencingDefaultValue(pattern, assignments, maybeImplicitGlobal, init) { + const scope = this.currentScope(); -function getHints(schema, logic) { - if (likeNumber(schema) || likeInteger(schema)) { - return numberHints(schema, logic); - } else if (likeString(schema)) { - return stringHints(schema, logic); - } + assignments.forEach(assignment => { + scope.__referencing( + pattern, + Reference.WRITE, + assignment.right, + maybeImplicitGlobal, + pattern !== assignment.left, + init + ); + }); + } - return []; -} + visitPattern(node, options, callback) { + let visitPatternOptions = options; + let visitPatternCallback = callback; -class ValidationError extends Error { - /** - * @param {Array} errors - * @param {Schema} schema - * @param {ValidationErrorConfiguration} configuration - */ - constructor(errors, schema, configuration = {}) { - super(); - /** @type {string} */ + if (typeof options === "function") { + visitPatternCallback = options; + visitPatternOptions = { processRightHandNodes: false }; + } - this.name = "ValidationError"; - /** @type {Array} */ + traverseIdentifierInPattern( + this.options, + node, + visitPatternOptions.processRightHandNodes ? this : null, + visitPatternCallback + ); + } - this.errors = errors; - /** @type {Schema} */ + visitFunction(node) { + let i, iz; - this.schema = schema; - let headerNameFromSchema; - let baseDataPathFromSchema; + // FunctionDeclaration name is defined in upper scope + // NOTE: Not referring variableScope. It is intended. + // Since + // in ES5, FunctionDeclaration should be in FunctionBody. + // in ES6, FunctionDeclaration should be block scoped. - if (schema.title && (!configuration.name || !configuration.baseDataPath)) { - const splittedTitleFromSchema = schema.title.match(/^(.+) (.+)$/); + if (node.type === Syntax.FunctionDeclaration) { - if (splittedTitleFromSchema) { - if (!configuration.name) { - [, headerNameFromSchema] = splittedTitleFromSchema; + // id is defined in upper scope + this.currentScope().__define(node.id, + new Definition( + Variable.FunctionName, + node.id, + node, + null, + null, + null + )); } - if (!configuration.baseDataPath) { - [,, baseDataPathFromSchema] = splittedTitleFromSchema; + // FunctionExpression with name creates its special scope; + // FunctionExpressionNameScope. + if (node.type === Syntax.FunctionExpression && node.id) { + this.scopeManager.__nestFunctionExpressionNameScope(node); } - } - } - /** @type {string} */ + // Consider this function is in the MethodDefinition. + this.scopeManager.__nestFunctionScope(node, this.isInnerMethodDefinition); - this.headerName = configuration.name || headerNameFromSchema || "Object"; - /** @type {string} */ - - this.baseDataPath = configuration.baseDataPath || baseDataPathFromSchema || "configuration"; - /** @type {PostFormatter | null} */ + const that = this; - this.postFormatter = configuration.postFormatter || null; - const header = `Invalid ${this.baseDataPath} object. ${this.headerName} has been initialized using ${getArticle(this.baseDataPath)} ${this.baseDataPath} object that does not match the API schema.\n`; - /** @type {string} */ + /** + * Visit pattern callback + * @param {pattern} pattern - pattern + * @param {Object} info - info + * @returns {void} + */ + function visitPatternCallback(pattern, info) { + that.currentScope().__define(pattern, + new ParameterDefinition( + pattern, + node, + i, + info.rest + )); - this.message = `${header}${this.formatValidationErrors(errors)}`; - Error.captureStackTrace(this, this.constructor); - } - /** - * @param {string} path - * @returns {Schema} - */ + that.referencingDefaultValue(pattern, info.assignments, null, true); + } + // Process parameter declarations. + for (i = 0, iz = node.params.length; i < iz; ++i) { + this.visitPattern(node.params[i], { processRightHandNodes: true }, visitPatternCallback); + } - getSchemaPart(path) { - const newPath = path.split("/"); - let schemaPart = this.schema; + // if there's a rest argument, add that + if (node.rest) { + this.visitPattern({ + type: "RestElement", + argument: node.rest + }, pattern => { + this.currentScope().__define(pattern, + new ParameterDefinition( + pattern, + node, + node.params.length, + true + )); + }); + } - for (let i = 1; i < newPath.length; i++) { - const inner = schemaPart[ - /** @type {keyof Schema} */ - newPath[i]]; + // In TypeScript there are a number of function-like constructs which have no body, + // so check it exists before traversing + if (node.body) { - if (!inner) { - break; - } + // Skip BlockStatement to prevent creating BlockStatement scope. + if (node.body.type === Syntax.BlockStatement) { + this.visitChildren(node.body); + } else { + this.visit(node.body); + } + } - schemaPart = inner; + this.close(node); } - return schemaPart; - } - /** - * @param {Schema} schema - * @param {boolean} logic - * @param {Array} prevSchemas - * @returns {string} - */ + visitClass(node) { + if (node.type === Syntax.ClassDeclaration) { + this.currentScope().__define(node.id, + new Definition( + Variable.ClassName, + node.id, + node, + null, + null, + null + )); + } + this.visit(node.superClass); - formatSchema(schema, logic = true, prevSchemas = []) { - let newLogic = logic; + this.scopeManager.__nestClassScope(node); - const formatInnerSchema = - /** - * - * @param {Object} innerSchema - * @param {boolean=} addSelf - * @returns {string} - */ - (innerSchema, addSelf) => { - if (!addSelf) { - return this.formatSchema(innerSchema, newLogic, prevSchemas); - } + if (node.id) { + this.currentScope().__define(node.id, + new Definition( + Variable.ClassName, + node.id, + node + )); + } + this.visit(node.body); - if (prevSchemas.includes(innerSchema)) { - return "(recursive)"; - } + this.close(node); + } - return this.formatSchema(innerSchema, newLogic, prevSchemas.concat(schema)); - }; + visitProperty(node) { + let previous; - if (hasNotInSchema(schema) && !likeObject(schema)) { - if (canApplyNot(schema.not)) { - newLogic = !logic; - return formatInnerSchema(schema.not); - } + if (node.computed) { + this.visit(node.key); + } - const needApplyLogicHere = !schema.not.not; - const prefix = logic ? "" : "non "; - newLogic = !logic; - return needApplyLogicHere ? prefix + formatInnerSchema(schema.not) : formatInnerSchema(schema.not); - } + const isMethodDefinition = node.type === Syntax.MethodDefinition; - if ( - /** @type {Schema & {instanceof: string | Array}} */ - schema.instanceof) { - const { - instanceof: value - } = - /** @type {Schema & {instanceof: string | Array}} */ - schema; - const values = !Array.isArray(value) ? [value] : value; - return values.map( - /** - * @param {string} item - * @returns {string} - */ - item => item === "Function" ? "function" : item).join(" | "); + if (isMethodDefinition) { + previous = this.pushInnerMethodDefinition(true); + } + this.visit(node.value); + if (isMethodDefinition) { + this.popInnerMethodDefinition(previous); + } } - if (schema.enum) { - return ( - /** @type {Array} */ - schema.enum.map(item => JSON.stringify(item)).join(" | ") - ); - } + visitForIn(node) { + if (node.left.type === Syntax.VariableDeclaration && node.left.kind !== "var") { + this.scopeManager.__nestForScope(node); + } - if (typeof schema.const !== "undefined") { - return JSON.stringify(schema.const); - } + if (node.left.type === Syntax.VariableDeclaration) { + this.visit(node.left); + this.visitPattern(node.left.declarations[0].id, pattern => { + this.currentScope().__referencing(pattern, Reference.WRITE, node.right, null, true, true); + }); + } else { + this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => { + let maybeImplicitGlobal = null; - if (schema.oneOf) { - return ( - /** @type {Array} */ - schema.oneOf.map(item => formatInnerSchema(item, true)).join(" | ") - ); + if (!this.currentScope().isStrict) { + maybeImplicitGlobal = { + pattern, + node + }; + } + this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false); + this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, true, false); + }); + } + this.visit(node.right); + this.visit(node.body); + + this.close(node); } - if (schema.anyOf) { - return ( - /** @type {Array} */ - schema.anyOf.map(item => formatInnerSchema(item, true)).join(" | ") - ); + visitVariableDeclaration(variableTargetScope, type, node, index) { + + const decl = node.declarations[index]; + const init = decl.init; + + this.visitPattern(decl.id, { processRightHandNodes: true }, (pattern, info) => { + variableTargetScope.__define( + pattern, + new Definition( + type, + pattern, + decl, + node, + index, + node.kind + ) + ); + + this.referencingDefaultValue(pattern, info.assignments, null, true); + if (init) { + this.currentScope().__referencing(pattern, Reference.WRITE, init, null, !info.topLevel, true); + } + }); } - if (schema.allOf) { - return ( - /** @type {Array} */ - schema.allOf.map(item => formatInnerSchema(item, true)).join(" & ") - ); + AssignmentExpression(node) { + if (PatternVisitor.isPattern(node.left)) { + if (node.operator === "=") { + this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => { + let maybeImplicitGlobal = null; + + if (!this.currentScope().isStrict) { + maybeImplicitGlobal = { + pattern, + node + }; + } + this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false); + this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, !info.topLevel, false); + }); + } else { + this.currentScope().__referencing(node.left, Reference.RW, node.right); + } + } else { + this.visit(node.left); + } + this.visit(node.right); } - if ( - /** @type {JSONSchema7} */ - schema.if) { - const { - if: ifValue, - then: thenValue, - else: elseValue - } = - /** @type {JSONSchema7} */ - schema; - return `${ifValue ? `if ${formatInnerSchema(ifValue)}` : ""}${thenValue ? ` then ${formatInnerSchema(thenValue)}` : ""}${elseValue ? ` else ${formatInnerSchema(elseValue)}` : ""}`; + CatchClause(node) { + this.scopeManager.__nestCatchScope(node); + + this.visitPattern(node.param, { processRightHandNodes: true }, (pattern, info) => { + this.currentScope().__define(pattern, + new Definition( + Variable.CatchClause, + node.param, + node, + null, + null, + null + )); + this.referencingDefaultValue(pattern, info.assignments, null, true); + }); + this.visit(node.body); + + this.close(node); } - if (schema.$ref) { - return formatInnerSchema(this.getSchemaPart(schema.$ref), true); + Program(node) { + this.scopeManager.__nestGlobalScope(node); + + if (this.scopeManager.__isNodejsScope()) { + + // Force strictness of GlobalScope to false when using node.js scope. + this.currentScope().isStrict = false; + this.scopeManager.__nestFunctionScope(node, false); + } + + if (this.scopeManager.__isES6() && this.scopeManager.isModule()) { + this.scopeManager.__nestModuleScope(node); + } + + if (this.scopeManager.isStrictModeSupported() && this.scopeManager.isImpliedStrict()) { + this.currentScope().isStrict = true; + } + + this.visitChildren(node); + this.close(node); } - if (likeNumber(schema) || likeInteger(schema)) { - const [type, ...hints] = getHints(schema, logic); - const str = `${type}${hints.length > 0 ? ` ${formatHints(hints)}` : ""}`; - return logic ? str : hints.length > 0 ? `non-${type} | ${str}` : `non-${type}`; + Identifier(node) { + this.currentScope().__referencing(node); } - if (likeString(schema)) { - const [type, ...hints] = getHints(schema, logic); - const str = `${type}${hints.length > 0 ? ` ${formatHints(hints)}` : ""}`; - return logic ? str : str === "string" ? "non-string" : `non-string | ${str}`; + UpdateExpression(node) { + if (PatternVisitor.isPattern(node.argument)) { + this.currentScope().__referencing(node.argument, Reference.RW, null); + } else { + this.visitChildren(node); + } } - if (likeBoolean(schema)) { - return `${logic ? "" : "non-"}boolean`; + MemberExpression(node) { + this.visit(node.object); + if (node.computed) { + this.visit(node.property); + } } - if (likeArray(schema)) { - // not logic already applied in formatValidationError - newLogic = true; - const hints = []; + Property(node) { + this.visitProperty(node); + } - if (typeof schema.minItems === "number") { - hints.push(`should not have fewer than ${schema.minItems} item${schema.minItems > 1 ? "s" : ""}`); - } + MethodDefinition(node) { + this.visitProperty(node); + } - if (typeof schema.maxItems === "number") { - hints.push(`should not have more than ${schema.maxItems} item${schema.maxItems > 1 ? "s" : ""}`); - } + BreakStatement() {} // eslint-disable-line class-methods-use-this - if (schema.uniqueItems) { - hints.push("should not have duplicate items"); - } + ContinueStatement() {} // eslint-disable-line class-methods-use-this - const hasAdditionalItems = typeof schema.additionalItems === "undefined" || Boolean(schema.additionalItems); - let items = ""; + LabeledStatement(node) { + this.visit(node.body); + } - if (schema.items) { - if (Array.isArray(schema.items) && schema.items.length > 0) { - items = `${ - /** @type {Array} */ - schema.items.map(item => formatInnerSchema(item)).join(", ")}`; + ForStatement(node) { - if (hasAdditionalItems) { - if (schema.additionalItems && isObject(schema.additionalItems) && Object.keys(schema.additionalItems).length > 0) { - hints.push(`additional items should be ${formatInnerSchema(schema.additionalItems)}`); - } - } - } else if (schema.items && Object.keys(schema.items).length > 0) { - // "additionalItems" is ignored - items = `${formatInnerSchema(schema.items)}`; - } else { - // Fallback for empty `items` value - items = "any"; + // Create ForStatement declaration. + // NOTE: In ES6, ForStatement dynamically generates + // per iteration environment. However, escope is + // a static analyzer, we only generate one scope for ForStatement. + if (node.init && node.init.type === Syntax.VariableDeclaration && node.init.kind !== "var") { + this.scopeManager.__nestForScope(node); } - } else { - // "additionalItems" is ignored - items = "any"; - } - if (schema.contains && Object.keys(schema.contains).length > 0) { - hints.push(`should contains at least one ${this.formatSchema(schema.contains)} item`); - } + this.visitChildren(node); - return `[${items}${hasAdditionalItems ? ", ..." : ""}]${hints.length > 0 ? ` (${hints.join(", ")})` : ""}`; + this.close(node); } - if (likeObject(schema)) { - // not logic already applied in formatValidationError - newLogic = true; - const hints = []; + ClassExpression(node) { + this.visitClass(node); + } - if (typeof schema.minProperties === "number") { - hints.push(`should not have fewer than ${schema.minProperties} ${schema.minProperties > 1 ? "properties" : "property"}`); - } + ClassDeclaration(node) { + this.visitClass(node); + } - if (typeof schema.maxProperties === "number") { - hints.push(`should not have more than ${schema.maxProperties} ${schema.minProperties && schema.minProperties > 1 ? "properties" : "property"}`); - } + CallExpression(node) { - if (schema.patternProperties && Object.keys(schema.patternProperties).length > 0) { - const patternProperties = Object.keys(schema.patternProperties); - hints.push(`additional property names should match pattern${patternProperties.length > 1 ? "s" : ""} ${patternProperties.map(pattern => JSON.stringify(pattern)).join(" | ")}`); - } + // Check this is direct call to eval + if (!this.scopeManager.__ignoreEval() && node.callee.type === Syntax.Identifier && node.callee.name === "eval") { - const properties = schema.properties ? Object.keys(schema.properties) : []; - const required = schema.required ? schema.required : []; - const allProperties = [...new Set( - /** @type {Array} */ - [].concat(required).concat(properties))]; - const objectStructure = allProperties.map(property => { - const isRequired = required.includes(property); // Some properties need quotes, maybe we should add check - // Maybe we should output type of property (`foo: string`), but it is looks very unreadable + // NOTE: This should be `variableScope`. Since direct eval call always creates Lexical environment and + // let / const should be enclosed into it. Only VariableDeclaration affects on the caller's environment. + this.currentScope().variableScope.__detectEval(); + } + this.visitChildren(node); + } - return `${property}${isRequired ? "" : "?"}`; - }).concat(typeof schema.additionalProperties === "undefined" || Boolean(schema.additionalProperties) ? schema.additionalProperties && isObject(schema.additionalProperties) ? [`: ${formatInnerSchema(schema.additionalProperties)}`] : ["…"] : []).join(", "); - const { - dependencies, - propertyNames, - patternRequired - } = - /** @type {Schema & {patternRequired?: Array;}} */ - schema; + BlockStatement(node) { + if (this.scopeManager.__isES6()) { + this.scopeManager.__nestBlockScope(node); + } - if (dependencies) { - Object.keys(dependencies).forEach(dependencyName => { - const dependency = dependencies[dependencyName]; + this.visitChildren(node); - if (Array.isArray(dependency)) { - hints.push(`should have ${dependency.length > 1 ? "properties" : "property"} ${dependency.map(dep => `'${dep}'`).join(", ")} when property '${dependencyName}' is present`); - } else { - hints.push(`should be valid according to the schema ${formatInnerSchema(dependency)} when property '${dependencyName}' is present`); - } - }); - } + this.close(node); + } - if (propertyNames && Object.keys(propertyNames).length > 0) { - hints.push(`each property name should match format ${JSON.stringify(schema.propertyNames.format)}`); - } + ThisExpression() { + this.currentScope().variableScope.__detectThis(); + } - if (patternRequired && patternRequired.length > 0) { - hints.push(`should have property matching pattern ${patternRequired.map( - /** - * @param {string} item - * @returns {string} - */ - item => JSON.stringify(item))}`); - } + WithStatement(node) { + this.visit(node.object); - return `object {${objectStructure ? ` ${objectStructure} ` : ""}}${hints.length > 0 ? ` (${hints.join(", ")})` : ""}`; + // Then nest scope for WithStatement. + this.scopeManager.__nestWithScope(node); + + this.visit(node.body); + + this.close(node); } - if (likeNull(schema)) { - return `${logic ? "" : "non-"}null`; + VariableDeclaration(node) { + const variableTargetScope = (node.kind === "var") ? this.currentScope().variableScope : this.currentScope(); + + for (let i = 0, iz = node.declarations.length; i < iz; ++i) { + const decl = node.declarations[i]; + + this.visitVariableDeclaration(variableTargetScope, Variable.Variable, node, i); + if (decl.init) { + this.visit(decl.init); + } + } } - if (Array.isArray(schema.type)) { - // not logic already applied in formatValidationError - return `${schema.type.join(" | ")}`; - } // Fallback for unknown keywords - // not logic already applied in formatValidationError + // sec 13.11.8 + SwitchStatement(node) { + this.visit(node.discriminant); - /* istanbul ignore next */ + if (this.scopeManager.__isES6()) { + this.scopeManager.__nestSwitchScope(node); + } + for (let i = 0, iz = node.cases.length; i < iz; ++i) { + this.visit(node.cases[i]); + } - return JSON.stringify(schema, null, 2); - } - /** - * @param {Schema=} schemaPart - * @param {(boolean | Array)=} additionalPath - * @param {boolean=} needDot - * @param {boolean=} logic - * @returns {string} - */ + this.close(node); + } + FunctionDeclaration(node) { + this.visitFunction(node); + } - getSchemaPartText(schemaPart, additionalPath, needDot = false, logic = true) { - if (!schemaPart) { - return ""; + FunctionExpression(node) { + this.visitFunction(node); } - if (Array.isArray(additionalPath)) { - for (let i = 0; i < additionalPath.length; i++) { - /** @type {Schema | undefined} */ - const inner = schemaPart[ - /** @type {keyof Schema} */ - additionalPath[i]]; + ForOfStatement(node) { + this.visitForIn(node); + } - if (inner) { - // eslint-disable-next-line no-param-reassign - schemaPart = inner; - } else { - break; - } - } + ForInStatement(node) { + this.visitForIn(node); } - while (schemaPart.$ref) { - // eslint-disable-next-line no-param-reassign - schemaPart = this.getSchemaPart(schemaPart.$ref); + ArrowFunctionExpression(node) { + this.visitFunction(node); } - let schemaText = `${this.formatSchema(schemaPart, logic)}${needDot ? "." : ""}`; + ImportDeclaration(node) { + assert(this.scopeManager.__isES6() && this.scopeManager.isModule(), "ImportDeclaration should appear when the mode is ES6 and in the module context."); - if (schemaPart.description) { - schemaText += `\n-> ${schemaPart.description}`; + const importer = new Importer(node, this); + + importer.visit(node); } - if (schemaPart.link) { - schemaText += `\n-> Read more at ${schemaPart.link}`; + visitExportDeclaration(node) { + if (node.source) { + return; + } + if (node.declaration) { + this.visit(node.declaration); + return; + } + + this.visitChildren(node); } - return schemaText; - } - /** - * @param {Schema=} schemaPart - * @returns {string} - */ + // TODO: ExportDeclaration doesn't exist. for bc? + ExportDeclaration(node) { + this.visitExportDeclaration(node); + } + ExportAllDeclaration(node) { + this.visitExportDeclaration(node); + } - getSchemaPartDescription(schemaPart) { - if (!schemaPart) { - return ""; + ExportDefaultDeclaration(node) { + this.visitExportDeclaration(node); } - while (schemaPart.$ref) { - // eslint-disable-next-line no-param-reassign - schemaPart = this.getSchemaPart(schemaPart.$ref); + ExportNamedDeclaration(node) { + this.visitExportDeclaration(node); } - let schemaText = ""; + ExportSpecifier(node) { - if (schemaPart.description) { - schemaText += `\n-> ${schemaPart.description}`; + // TODO: `node.id` doesn't exist. for bc? + const local = (node.id || node.local); + + this.visit(local); } - if (schemaPart.link) { - schemaText += `\n-> Read more at ${schemaPart.link}`; + MetaProperty() { // eslint-disable-line class-methods-use-this + + // do nothing. } +} - return schemaText; - } - /** - * @param {SchemaUtilErrorObject} error - * @returns {string} - */ +module.exports = Referencer; +/* vim: set sw=4 ts=4 et tw=80 : */ - formatValidationError(error) { - const { - keyword, - dataPath: errorDataPath - } = error; - const dataPath = `${this.baseDataPath}${errorDataPath}`; - switch (keyword) { - case "type": - { - const { - parentSchema, - params - } = error; // eslint-disable-next-line default-case +/***/ }), - switch ( - /** @type {import("ajv").TypeParams} */ - params.type) { - case "number": - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; +/***/ 96988: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - case "integer": - return `${dataPath} should be an ${this.getSchemaPartText(parentSchema, false, true)}`; +"use strict"; +/* + Copyright (C) 2015 Yusuke Suzuki - case "string": - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: - case "boolean": - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - case "array": - return `${dataPath} should be an array:\n${this.getSchemaPartText(parentSchema)}`; + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ - case "object": - return `${dataPath} should be an object:\n${this.getSchemaPartText(parentSchema)}`; - case "null": - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; +/* eslint-disable no-underscore-dangle */ - default: - return `${dataPath} should be:\n${this.getSchemaPartText(parentSchema)}`; - } - } +const Scope = __webpack_require__(16313); +const assert = __webpack_require__(39491); - case "instanceof": - { - const { - parentSchema - } = error; - return `${dataPath} should be an instance of ${this.getSchemaPartText(parentSchema, false, true)}`; - } +const GlobalScope = Scope.GlobalScope; +const CatchScope = Scope.CatchScope; +const WithScope = Scope.WithScope; +const ModuleScope = Scope.ModuleScope; +const ClassScope = Scope.ClassScope; +const SwitchScope = Scope.SwitchScope; +const FunctionScope = Scope.FunctionScope; +const ForScope = Scope.ForScope; +const FunctionExpressionNameScope = Scope.FunctionExpressionNameScope; +const BlockScope = Scope.BlockScope; - case "pattern": - { - const { - params, - parentSchema - } = error; - const { - pattern - } = - /** @type {import("ajv").PatternParams} */ - params; - return `${dataPath} should match pattern ${JSON.stringify(pattern)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } +/** + * @class ScopeManager + */ +class ScopeManager { + constructor(options) { + this.scopes = []; + this.globalScope = null; + this.__nodeToScope = new WeakMap(); + this.__currentScope = null; + this.__options = options; + this.__declaredVariables = new WeakMap(); + } - case "format": - { - const { - params, - parentSchema - } = error; - const { - format - } = - /** @type {import("ajv").FormatParams} */ - params; - return `${dataPath} should match format ${JSON.stringify(format)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + __useDirective() { + return this.__options.directive; + } - case "formatMinimum": - case "formatMaximum": - { - const { - params, - parentSchema - } = error; - const { - comparison, - limit - } = - /** @type {import("ajv").ComparisonParams} */ - params; - return `${dataPath} should be ${comparison} ${JSON.stringify(limit)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + __isOptimistic() { + return this.__options.optimistic; + } - case "minimum": - case "maximum": - case "exclusiveMinimum": - case "exclusiveMaximum": - { - const { - parentSchema, - params - } = error; - const { - comparison, - limit - } = - /** @type {import("ajv").ComparisonParams} */ - params; - const [, ...hints] = getHints( - /** @type {Schema} */ - parentSchema, true); + __ignoreEval() { + return this.__options.ignoreEval; + } - if (hints.length === 0) { - hints.push(`should be ${comparison} ${limit}`); - } + __isNodejsScope() { + return this.__options.nodejsScope; + } - return `${dataPath} ${hints.join(" ")}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + isModule() { + return this.__options.sourceType === "module"; + } - case "multipleOf": - { - const { - params, - parentSchema - } = error; - const { - multipleOf - } = - /** @type {import("ajv").MultipleOfParams} */ - params; - return `${dataPath} should be multiple of ${multipleOf}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + isImpliedStrict() { + return this.__options.impliedStrict; + } - case "patternRequired": - { - const { - params, - parentSchema - } = error; - const { - missingPattern - } = - /** @type {import("ajv").PatternRequiredParams} */ - params; - return `${dataPath} should have property matching pattern ${JSON.stringify(missingPattern)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + isStrictModeSupported() { + return this.__options.ecmaVersion >= 5; + } - case "minLength": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; + // Returns appropriate scope for this node. + __get(node) { + return this.__nodeToScope.get(node); + } - if (limit === 1) { - return `${dataPath} should be a non-empty string${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + /** + * Get variables that are declared by the node. + * + * "are declared by the node" means the node is same as `Variable.defs[].node` or `Variable.defs[].parent`. + * If the node declares nothing, this method returns an empty array. + * CAUTION: This API is experimental. See https://github.com/estools/escope/pull/69 for more details. + * + * @param {Espree.Node} node - a node to get. + * @returns {Variable[]} variables that declared by the node. + */ + getDeclaredVariables(node) { + return this.__declaredVariables.get(node) || []; + } - const length = limit - 1; - return `${dataPath} should be longer than ${length} character${length > 1 ? "s" : ""}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + /** + * acquire scope from node. + * @method ScopeManager#acquire + * @param {Espree.Node} node - node for the acquired scope. + * @param {boolean=} inner - look up the most inner scope, default value is false. + * @returns {Scope?} Scope from node + */ + acquire(node, inner) { + + /** + * predicate + * @param {Scope} testScope - scope to test + * @returns {boolean} predicate + */ + function predicate(testScope) { + if (testScope.type === "function" && testScope.functionExpressionScope) { + return false; + } + return true; } - case "minItems": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; + const scopes = this.__get(node); - if (limit === 1) { - return `${dataPath} should be a non-empty array${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + if (!scopes || scopes.length === 0) { + return null; + } - return `${dataPath} should not have fewer than ${limit} items${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + // Heuristic selection from all scopes. + // If you would like to get all scopes, please use ScopeManager#acquireAll. + if (scopes.length === 1) { + return scopes[0]; } - case "minProperties": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; + if (inner) { + for (let i = scopes.length - 1; i >= 0; --i) { + const scope = scopes[i]; - if (limit === 1) { - return `${dataPath} should be a non-empty object${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + if (predicate(scope)) { + return scope; + } + } + } else { + for (let i = 0, iz = scopes.length; i < iz; ++i) { + const scope = scopes[i]; - return `${dataPath} should not have fewer than ${limit} properties${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + if (predicate(scope)) { + return scope; + } + } } - case "maxLength": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - const max = limit + 1; - return `${dataPath} should be shorter than ${max} character${max > 1 ? "s" : ""}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "maxItems": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - return `${dataPath} should not have more than ${limit} items${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "maxProperties": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - return `${dataPath} should not have more than ${limit} properties${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "uniqueItems": - { - const { - params, - parentSchema - } = error; - const { - i - } = - /** @type {import("ajv").UniqueItemsParams} */ - params; - return `${dataPath} should not contain the item '${error.data[i]}' twice${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "additionalItems": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - return `${dataPath} should not have more than ${limit} items${getSchemaNonTypes(parentSchema)}. These items are valid:\n${this.getSchemaPartText(parentSchema)}`; - } - - case "contains": - { - const { - parentSchema - } = error; - return `${dataPath} should contains at least one ${this.getSchemaPartText(parentSchema, ["contains"])} item${getSchemaNonTypes(parentSchema)}.`; - } + return null; + } - case "required": - { - const { - parentSchema, - params - } = error; - const missingProperty = - /** @type {import("ajv").DependenciesParams} */ - params.missingProperty.replace(/^\./, ""); - const hasProperty = parentSchema && Boolean( - /** @type {Schema} */ - parentSchema.properties && - /** @type {Schema} */ - parentSchema.properties[missingProperty]); - return `${dataPath} misses the property '${missingProperty}'${getSchemaNonTypes(parentSchema)}.${hasProperty ? ` Should be:\n${this.getSchemaPartText(parentSchema, ["properties", missingProperty])}` : this.getSchemaPartDescription(parentSchema)}`; - } + /** + * acquire all scopes from node. + * @method ScopeManager#acquireAll + * @param {Espree.Node} node - node for the acquired scope. + * @returns {Scopes?} Scope array + */ + acquireAll(node) { + return this.__get(node); + } - case "additionalProperties": - { - const { - params, - parentSchema - } = error; - const { - additionalProperty - } = - /** @type {import("ajv").AdditionalPropertiesParams} */ - params; - return `${dataPath} has an unknown property '${additionalProperty}'${getSchemaNonTypes(parentSchema)}. These properties are valid:\n${this.getSchemaPartText(parentSchema)}`; - } + /** + * release the node. + * @method ScopeManager#release + * @param {Espree.Node} node - releasing node. + * @param {boolean=} inner - look up the most inner scope, default value is false. + * @returns {Scope?} upper scope for the node. + */ + release(node, inner) { + const scopes = this.__get(node); - case "dependencies": - { - const { - params, - parentSchema - } = error; - const { - property, - deps - } = - /** @type {import("ajv").DependenciesParams} */ - params; - const dependencies = deps.split(",").map( - /** - * @param {string} dep - * @returns {string} - */ - dep => `'${dep.trim()}'`).join(", "); - return `${dataPath} should have properties ${dependencies} when property '${property}' is present${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + if (scopes && scopes.length) { + const scope = scopes[0].upper; - case "propertyNames": - { - const { - params, - parentSchema, - schema - } = error; - const { - propertyName - } = - /** @type {import("ajv").PropertyNamesParams} */ - params; - return `${dataPath} property name '${propertyName}' is invalid${getSchemaNonTypes(parentSchema)}. Property names should be match format ${JSON.stringify(schema.format)}.${this.getSchemaPartDescription(parentSchema)}`; + if (!scope) { + return null; + } + return this.acquire(scope.block, inner); } + return null; + } - case "enum": - { - const { - parentSchema - } = error; - - if (parentSchema && - /** @type {Schema} */ - parentSchema.enum && - /** @type {Schema} */ - parentSchema.enum.length === 1) { - return `${dataPath} should be ${this.getSchemaPartText(parentSchema, false, true)}`; - } + attach() { } // eslint-disable-line class-methods-use-this - return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}`; - } + detach() { } // eslint-disable-line class-methods-use-this - case "const": - { - const { - parentSchema - } = error; - return `${dataPath} should be equal to constant ${this.getSchemaPartText(parentSchema, false, true)}`; + __nestScope(scope) { + if (scope instanceof GlobalScope) { + assert(this.__currentScope === null); + this.globalScope = scope; } + this.__currentScope = scope; + return scope; + } - case "not": - { - const postfix = likeObject( - /** @type {Schema} */ - error.parentSchema) ? `\n${this.getSchemaPartText(error.parentSchema)}` : ""; - const schemaOutput = this.getSchemaPartText(error.schema, false, false, false); + __nestGlobalScope(node) { + return this.__nestScope(new GlobalScope(this, node)); + } - if (canApplyNot(error.schema)) { - return `${dataPath} should be any ${schemaOutput}${postfix}.`; - } + __nestBlockScope(node) { + return this.__nestScope(new BlockScope(this, this.__currentScope, node)); + } - const { - schema, - parentSchema - } = error; - return `${dataPath} should not be ${this.getSchemaPartText(schema, false, true)}${parentSchema && likeObject(parentSchema) ? `\n${this.getSchemaPartText(parentSchema)}` : ""}`; - } + __nestFunctionScope(node, isMethodDefinition) { + return this.__nestScope(new FunctionScope(this, this.__currentScope, node, isMethodDefinition)); + } - case "oneOf": - case "anyOf": - { - const { - parentSchema, - children - } = error; + __nestForScope(node) { + return this.__nestScope(new ForScope(this, this.__currentScope, node)); + } - if (children && children.length > 0) { - if (error.schema.length === 1) { - const lastChild = children[children.length - 1]; - const remainingChildren = children.slice(0, children.length - 1); - return this.formatValidationError(Object.assign({}, lastChild, { - children: remainingChildren, - parentSchema: Object.assign({}, parentSchema, lastChild.parentSchema) - })); - } + __nestCatchScope(node) { + return this.__nestScope(new CatchScope(this, this.__currentScope, node)); + } - let filteredChildren = filterChildren(children); + __nestWithScope(node) { + return this.__nestScope(new WithScope(this, this.__currentScope, node)); + } - if (filteredChildren.length === 1) { - return this.formatValidationError(filteredChildren[0]); - } + __nestClassScope(node) { + return this.__nestScope(new ClassScope(this, this.__currentScope, node)); + } - filteredChildren = groupChildrenByFirstChild(filteredChildren); - return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}\nDetails:\n${filteredChildren.map( - /** - * @param {SchemaUtilErrorObject} nestedError - * @returns {string} - */ - nestedError => ` * ${indent(this.formatValidationError(nestedError), " ")}`).join("\n")}`; - } + __nestSwitchScope(node) { + return this.__nestScope(new SwitchScope(this, this.__currentScope, node)); + } - return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}`; - } + __nestModuleScope(node) { + return this.__nestScope(new ModuleScope(this, this.__currentScope, node)); + } - case "if": - { - const { - params, - parentSchema - } = error; - const { - failingKeyword - } = - /** @type {import("ajv").IfParams} */ - params; - return `${dataPath} should match "${failingKeyword}" schema:\n${this.getSchemaPartText(parentSchema, [failingKeyword])}`; - } + __nestFunctionExpressionNameScope(node) { + return this.__nestScope(new FunctionExpressionNameScope(this, this.__currentScope, node)); + } - case "absolutePath": - { - const { - message, - parentSchema - } = error; - return `${dataPath}: ${message}${this.getSchemaPartDescription(parentSchema)}`; - } + __isES6() { + return this.__options.ecmaVersion >= 6; + } +} - /* istanbul ignore next */ +module.exports = ScopeManager; - default: - { - const { - message, - parentSchema - } = error; - const ErrorInJSON = JSON.stringify(error, null, 2); // For `custom`, `false schema`, `$ref` keywords - // Fallback for unknown keywords +/* vim: set sw=4 ts=4 et tw=80 : */ - return `${dataPath} ${message} (${ErrorInJSON}).\n${this.getSchemaPartText(parentSchema, false)}`; - } - } - } - /** - * @param {Array} errors - * @returns {string} - */ +/***/ }), - formatValidationErrors(errors) { - return errors.map(error => { - let formattedError = this.formatValidationError(error); +/***/ 16313: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (this.postFormatter) { - formattedError = this.postFormatter(formattedError, error); - } +"use strict"; +/* + Copyright (C) 2015 Yusuke Suzuki - return ` - ${indent(formattedError, " ")}`; - }).join("\n"); - } + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: -} + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. -var _default = ValidationError; -exports.Z = _default; + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ -/***/ }), -/***/ 81184: -/***/ (function(module) { +/* eslint-disable no-underscore-dangle */ +/* eslint-disable no-undefined */ -"use strict"; +const Syntax = (__webpack_require__(18350).Syntax); +const Reference = __webpack_require__(64945); +const Variable = __webpack_require__(82971); +const Definition = (__webpack_require__(70665).Definition); +const assert = __webpack_require__(39491); /** - * @typedef {[number, boolean]} RangeValue + * Test if scope is struct + * @param {Scope} scope - scope + * @param {Block} block - block + * @param {boolean} isMethodDefinition - is method definition + * @param {boolean} useDirective - use directive + * @returns {boolean} is strict scope */ +function isStrictScope(scope, block, isMethodDefinition, useDirective) { + let body; -/** - * @callback RangeValueCallback - * @param {RangeValue} rangeValue - * @returns {boolean} - */ -class Range { - /** - * @param {"left" | "right"} side - * @param {boolean} exclusive - * @returns {">" | ">=" | "<" | "<="} - */ - static getOperator(side, exclusive) { - if (side === "left") { - return exclusive ? ">" : ">="; + // When upper scope is exists and strict, inner scope is also strict. + if (scope.upper && scope.upper.isStrict) { + return true; } - return exclusive ? "<" : "<="; - } - /** - * @param {number} value - * @param {boolean} logic is not logic applied - * @param {boolean} exclusive is range exclusive - * @returns {string} - */ + if (isMethodDefinition) { + return true; + } + if (scope.type === "class" || scope.type === "module") { + return true; + } - static formatRight(value, logic, exclusive) { - if (logic === false) { - return Range.formatLeft(value, !logic, !exclusive); + if (scope.type === "block" || scope.type === "switch") { + return false; } - return `should be ${Range.getOperator("right", exclusive)} ${value}`; - } - /** - * @param {number} value - * @param {boolean} logic is not logic applied - * @param {boolean} exclusive is range exclusive - * @returns {string} - */ + if (scope.type === "function") { + if (block.type === Syntax.ArrowFunctionExpression && block.body.type !== Syntax.BlockStatement) { + return false; + } + if (block.type === Syntax.Program) { + body = block; + } else { + body = block.body; + } - static formatLeft(value, logic, exclusive) { - if (logic === false) { - return Range.formatRight(value, !logic, !exclusive); + if (!body) { + return false; + } + } else if (scope.type === "global") { + body = block; + } else { + return false; } - return `should be ${Range.getOperator("left", exclusive)} ${value}`; - } - /** - * @param {number} start left side value - * @param {number} end right side value - * @param {boolean} startExclusive is range exclusive from left side - * @param {boolean} endExclusive is range exclusive from right side - * @param {boolean} logic is not logic applied - * @returns {string} - */ + // Search 'use strict' directive. + if (useDirective) { + for (let i = 0, iz = body.body.length; i < iz; ++i) { + const stmt = body.body[i]; + if (stmt.type !== Syntax.DirectiveStatement) { + break; + } + if (stmt.raw === "\"use strict\"" || stmt.raw === "'use strict'") { + return true; + } + } + } else { + for (let i = 0, iz = body.body.length; i < iz; ++i) { + const stmt = body.body[i]; - static formatRange(start, end, startExclusive, endExclusive, logic) { - let result = "should be"; - result += ` ${Range.getOperator(logic ? "left" : "right", logic ? startExclusive : !startExclusive)} ${start} `; - result += logic ? "and" : "or"; - result += ` ${Range.getOperator(logic ? "right" : "left", logic ? endExclusive : !endExclusive)} ${end}`; - return result; - } - /** - * @param {Array} values - * @param {boolean} logic is not logic applied - * @return {RangeValue} computed value and it's exclusive flag - */ + if (stmt.type !== Syntax.ExpressionStatement) { + break; + } + const expr = stmt.expression; + if (expr.type !== Syntax.Literal || typeof expr.value !== "string") { + break; + } + if (expr.raw !== null && expr.raw !== undefined) { + if (expr.raw === "\"use strict\"" || expr.raw === "'use strict'") { + return true; + } + } else { + if (expr.value === "use strict") { + return true; + } + } + } + } + return false; +} - static getRangeValue(values, logic) { - let minMax = logic ? Infinity : -Infinity; - let j = -1; - const predicate = logic ? - /** @type {RangeValueCallback} */ - ([value]) => value <= minMax : - /** @type {RangeValueCallback} */ - ([value]) => value >= minMax; +/** + * Register scope + * @param {ScopeManager} scopeManager - scope manager + * @param {Scope} scope - scope + * @returns {void} + */ +function registerScope(scopeManager, scope) { + scopeManager.scopes.push(scope); - for (let i = 0; i < values.length; i++) { - if (predicate(values[i])) { - [minMax] = values[i]; - j = i; - } - } + const scopes = scopeManager.__nodeToScope.get(scope.block); - if (j > -1) { - return values[j]; + if (scopes) { + scopes.push(scope); + } else { + scopeManager.__nodeToScope.set(scope.block, [scope]); } +} - return [Infinity, true]; - } +/** + * Should be statically + * @param {Object} def - def + * @returns {boolean} should be statically + */ +function shouldBeStatically(def) { + return ( + (def.type === Variable.ClassName) || + (def.type === Variable.Variable && def.parent.kind !== "var") + ); +} - constructor() { - /** @type {Array} */ - this._left = []; - /** @type {Array} */ +/** + * @class Scope + */ +class Scope { + constructor(scopeManager, type, upperScope, block, isMethodDefinition) { - this._right = []; - } - /** - * @param {number} value - * @param {boolean=} exclusive - */ + /** + * One of 'module', 'block', 'switch', 'function', 'catch', 'with', 'function', 'class', 'global'. + * @member {String} Scope#type + */ + this.type = type; + /** + * The scoped {@link Variable}s of this scope, as { Variable.name + * : Variable }. + * @member {Map} Scope#set + */ + this.set = new Map(); - left(value, exclusive = false) { - this._left.push([value, exclusive]); - } - /** - * @param {number} value - * @param {boolean=} exclusive - */ + /** + * The tainted variables of this scope, as { Variable.name : + * boolean }. + * @member {Map} Scope#taints */ + this.taints = new Map(); + + /** + * Generally, through the lexical scoping of JS you can always know + * which variable an identifier in the source code refers to. There are + * a few exceptions to this rule. With 'global' and 'with' scopes you + * can only decide at runtime which variable a reference refers to. + * Moreover, if 'eval()' is used in a scope, it might introduce new + * bindings in this or its parent scopes. + * All those scopes are considered 'dynamic'. + * @member {boolean} Scope#dynamic + */ + this.dynamic = this.type === "global" || this.type === "with"; + /** + * A reference to the scope-defining syntax node. + * @member {espree.Node} Scope#block + */ + this.block = block; - right(value, exclusive = false) { - this._right.push([value, exclusive]); - } - /** - * @param {boolean} logic is not logic applied - * @return {string} "smart" range string representation - */ + /** + * The {@link Reference|references} that are not resolved with this scope. + * @member {Reference[]} Scope#through + */ + this.through = []; + /** + * The scoped {@link Variable}s of this scope. In the case of a + * 'function' scope this includes the automatic argument arguments as + * its first element, as well as all further formal arguments. + * @member {Variable[]} Scope#variables + */ + this.variables = []; - format(logic = true) { - const [start, leftExclusive] = Range.getRangeValue(this._left, logic); - const [end, rightExclusive] = Range.getRangeValue(this._right, !logic); + /** + * Any variable {@link Reference|reference} found in this scope. This + * includes occurrences of local variables as well as variables from + * parent scopes (including the global scope). For local variables + * this also includes defining occurrences (like in a 'var' statement). + * In a 'function' scope this does not include the occurrences of the + * formal parameter in the parameter list. + * @member {Reference[]} Scope#references + */ + this.references = []; - if (!Number.isFinite(start) && !Number.isFinite(end)) { - return ""; + /** + * For 'global' and 'function' scopes, this is a self-reference. For + * other scope types this is the variableScope value of the + * parent scope. + * @member {Scope} Scope#variableScope + */ + this.variableScope = + (this.type === "global" || this.type === "function" || this.type === "module") ? this : upperScope.variableScope; + + /** + * Whether this scope is created by a FunctionExpression. + * @member {boolean} Scope#functionExpressionScope + */ + this.functionExpressionScope = false; + + /** + * Whether this is a scope that contains an 'eval()' invocation. + * @member {boolean} Scope#directCallToEvalScope + */ + this.directCallToEvalScope = false; + + /** + * @member {boolean} Scope#thisFound + */ + this.thisFound = false; + + this.__left = []; + + /** + * Reference to the parent {@link Scope|scope}. + * @member {Scope} Scope#upper + */ + this.upper = upperScope; + + /** + * Whether 'use strict' is in effect in this scope. + * @member {boolean} Scope#isStrict + */ + this.isStrict = isStrictScope(this, block, isMethodDefinition, scopeManager.__useDirective()); + + /** + * List of nested {@link Scope}s. + * @member {Scope[]} Scope#childScopes + */ + this.childScopes = []; + if (this.upper) { + this.upper.childScopes.push(this); + } + + this.__declaredVariables = scopeManager.__declaredVariables; + + registerScope(scopeManager, this); } - const realStart = leftExclusive ? start + 1 : start; - const realEnd = rightExclusive ? end - 1 : end; // e.g. 5 < x < 7, 5 < x <= 6, 6 <= x <= 6 + __shouldStaticallyClose(scopeManager) { + return (!this.dynamic || scopeManager.__isOptimistic()); + } - if (realStart === realEnd) { - return `should be ${logic ? "" : "!"}= ${realStart}`; - } // e.g. 4 < x < ∞ + __shouldStaticallyCloseForGlobal(ref) { + // On global scope, let/const/class declarations should be resolved statically. + const name = ref.identifier.name; - if (Number.isFinite(start) && !Number.isFinite(end)) { - return Range.formatLeft(start, logic, leftExclusive); - } // e.g. ∞ < x < 4 + if (!this.set.has(name)) { + return false; + } + const variable = this.set.get(name); + const defs = variable.defs; - if (!Number.isFinite(start) && Number.isFinite(end)) { - return Range.formatRight(end, logic, rightExclusive); + return defs.length > 0 && defs.every(shouldBeStatically); } - return Range.formatRange(start, end, leftExclusive, rightExclusive, logic); - } + __staticCloseRef(ref) { + if (!this.__resolve(ref)) { + this.__delegateToUpperScope(ref); + } + } -} + __dynamicCloseRef(ref) { -module.exports = Range; + // notify all names are through to global + let current = this; -/***/ }), + do { + current.through.push(ref); + current = current.upper; + } while (current); + } -/***/ 79926: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + __globalCloseRef(ref) { -"use strict"; + // let/const/class declarations should be resolved statically. + // others should be resolved dynamically. + if (this.__shouldStaticallyCloseForGlobal(ref)) { + this.__staticCloseRef(ref); + } else { + this.__dynamicCloseRef(ref); + } + } + __close(scopeManager) { + let closeRef; -const Range = __webpack_require__(81184); -/** @typedef {import("../validate").Schema} Schema */ + if (this.__shouldStaticallyClose(scopeManager)) { + closeRef = this.__staticCloseRef; + } else if (this.type !== "global") { + closeRef = this.__dynamicCloseRef; + } else { + closeRef = this.__globalCloseRef; + } -/** - * @param {Schema} schema - * @param {boolean} logic - * @return {string[]} - */ + // Try Resolving all references in this scope. + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref = this.__left[i]; + closeRef.call(this, ref); + } + this.__left = null; -module.exports.stringHints = function stringHints(schema, logic) { - const hints = []; - let type = "string"; - const currentSchema = { ...schema - }; + return this.upper; + } - if (!logic) { - const tmpLength = currentSchema.minLength; - const tmpFormat = currentSchema.formatMinimum; - const tmpExclusive = currentSchema.formatExclusiveMaximum; - currentSchema.minLength = currentSchema.maxLength; - currentSchema.maxLength = tmpLength; - currentSchema.formatMinimum = currentSchema.formatMaximum; - currentSchema.formatMaximum = tmpFormat; - currentSchema.formatExclusiveMaximum = !currentSchema.formatExclusiveMinimum; - currentSchema.formatExclusiveMinimum = !tmpExclusive; - } + // To override by function scopes. + // References in default parameters isn't resolved to variables which are in their function body. + __isValidResolution(ref, variable) { // eslint-disable-line class-methods-use-this, no-unused-vars + return true; + } - if (typeof currentSchema.minLength === "number") { - if (currentSchema.minLength === 1) { - type = "non-empty string"; - } else { - const length = Math.max(currentSchema.minLength - 1, 0); - hints.push(`should be longer than ${length} character${length > 1 ? "s" : ""}`); + __resolve(ref) { + const name = ref.identifier.name; + + if (!this.set.has(name)) { + return false; + } + const variable = this.set.get(name); + + if (!this.__isValidResolution(ref, variable)) { + return false; + } + variable.references.push(ref); + variable.stack = variable.stack && ref.from.variableScope === this.variableScope; + if (ref.tainted) { + variable.tainted = true; + this.taints.set(variable.name, true); + } + ref.resolved = variable; + + return true; } - } - if (typeof currentSchema.maxLength === "number") { - if (currentSchema.maxLength === 0) { - type = "empty string"; - } else { - const length = currentSchema.maxLength + 1; - hints.push(`should be shorter than ${length} character${length > 1 ? "s" : ""}`); + __delegateToUpperScope(ref) { + if (this.upper) { + this.upper.__left.push(ref); + } + this.through.push(ref); } - } - if (currentSchema.pattern) { - hints.push(`should${logic ? "" : " not"} match pattern ${JSON.stringify(currentSchema.pattern)}`); - } + __addDeclaredVariablesOfNode(variable, node) { + if (node === null || node === undefined) { + return; + } - if (currentSchema.format) { - hints.push(`should${logic ? "" : " not"} match format ${JSON.stringify(currentSchema.format)}`); - } + let variables = this.__declaredVariables.get(node); - if (currentSchema.formatMinimum) { - hints.push(`should be ${currentSchema.formatExclusiveMinimum ? ">" : ">="} ${JSON.stringify(currentSchema.formatMinimum)}`); - } + if (variables === null || variables === undefined) { + variables = []; + this.__declaredVariables.set(node, variables); + } + if (variables.indexOf(variable) === -1) { + variables.push(variable); + } + } - if (currentSchema.formatMaximum) { - hints.push(`should be ${currentSchema.formatExclusiveMaximum ? "<" : "<="} ${JSON.stringify(currentSchema.formatMaximum)}`); - } + __defineGeneric(name, set, variables, node, def) { + let variable; - return [type].concat(hints); -}; -/** - * @param {Schema} schema - * @param {boolean} logic - * @return {string[]} - */ + variable = set.get(name); + if (!variable) { + variable = new Variable(name, this); + set.set(name, variable); + variables.push(variable); + } + if (def) { + variable.defs.push(def); + this.__addDeclaredVariablesOfNode(variable, def.node); + this.__addDeclaredVariablesOfNode(variable, def.parent); + } + if (node) { + variable.identifiers.push(node); + } + } -module.exports.numberHints = function numberHints(schema, logic) { - const hints = [schema.type === "integer" ? "integer" : "number"]; - const range = new Range(); + __define(node, def) { + if (node && node.type === Syntax.Identifier) { + this.__defineGeneric( + node.name, + this.set, + this.variables, + node, + def + ); + } + } - if (typeof schema.minimum === "number") { - range.left(schema.minimum); - } + __referencing(node, assign, writeExpr, maybeImplicitGlobal, partial, init) { - if (typeof schema.exclusiveMinimum === "number") { - range.left(schema.exclusiveMinimum, true); - } + // because Array element may be null + if (!node || node.type !== Syntax.Identifier) { + return; + } - if (typeof schema.maximum === "number") { - range.right(schema.maximum); - } + // Specially handle like `this`. + if (node.name === "super") { + return; + } - if (typeof schema.exclusiveMaximum === "number") { - range.right(schema.exclusiveMaximum, true); - } + const ref = new Reference(node, this, assign || Reference.READ, writeExpr, maybeImplicitGlobal, !!partial, !!init); - const rangeFormat = range.format(logic); + this.references.push(ref); + this.__left.push(ref); + } - if (rangeFormat) { - hints.push(rangeFormat); - } + __detectEval() { + let current = this; - if (typeof schema.multipleOf === "number") { - hints.push(`should${logic ? "" : " not"} be multiple of ${schema.multipleOf}`); - } + this.directCallToEvalScope = true; + do { + current.dynamic = true; + current = current.upper; + } while (current); + } - return hints; -}; + __detectThis() { + this.thisFound = true; + } -/***/ }), + __isClosed() { + return this.__left === null; + } -/***/ 74315: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * returns resolved {Reference} + * @method Scope#resolve + * @param {Espree.Identifier} ident - identifier to be resolved. + * @returns {Reference} reference + */ + resolve(ident) { + let ref, i, iz; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + assert(this.__isClosed(), "Scope should be closed."); + assert(ident.type === Syntax.Identifier, "Target should be identifier."); + for (i = 0, iz = this.references.length; i < iz; ++i) { + ref = this.references[i]; + if (ref.identifier === ident) { + return ref; + } + } + return null; + } + /** + * returns this scope is static + * @method Scope#isStatic + * @returns {boolean} static + */ + isStatic() { + return !this.dynamic; + } + /** + * returns this scope has materialized arguments + * @method Scope#isArgumentsMaterialized + * @returns {boolean} arguemnts materialized + */ + isArgumentsMaterialized() { // eslint-disable-line class-methods-use-this + return true; + } -const RuntimeGlobals = __webpack_require__(16475); -const WebpackError = __webpack_require__(53799); -const ConstDependency = __webpack_require__(76911); -const BasicEvaluatedExpression = __webpack_require__(950); -const { - toConstantDependency, - evaluateToString -} = __webpack_require__(93998); -const ChunkNameRuntimeModule = __webpack_require__(84519); -const GetFullHashRuntimeModule = __webpack_require__(88732); + /** + * returns this scope has materialized `this` reference + * @method Scope#isThisMaterialized + * @returns {boolean} this materialized + */ + isThisMaterialized() { // eslint-disable-line class-methods-use-this + return true; + } -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ + isUsedName(name) { + if (this.set.has(name)) { + return true; + } + for (let i = 0, iz = this.through.length; i < iz; ++i) { + if (this.through[i].identifier.name === name) { + return true; + } + } + return false; + } +} -/* eslint-disable camelcase */ -const REPLACEMENTS = { - __webpack_require__: { - expr: RuntimeGlobals.require, - req: [RuntimeGlobals.require], - type: "function", - assign: false - }, - __webpack_public_path__: { - expr: RuntimeGlobals.publicPath, - req: [RuntimeGlobals.publicPath], - type: "string", - assign: true - }, - __webpack_base_uri__: { - expr: RuntimeGlobals.baseURI, - req: [RuntimeGlobals.baseURI], - type: "string", - assign: true - }, - __webpack_modules__: { - expr: RuntimeGlobals.moduleFactories, - req: [RuntimeGlobals.moduleFactories], - type: "object", - assign: false - }, - __webpack_chunk_load__: { - expr: RuntimeGlobals.ensureChunk, - req: [RuntimeGlobals.ensureChunk], - type: "function", - assign: true - }, - __non_webpack_require__: { - expr: "require", - req: null, - type: undefined, // type is not known, depends on environment - assign: true - }, - __webpack_nonce__: { - expr: RuntimeGlobals.scriptNonce, - req: [RuntimeGlobals.scriptNonce], - type: "string", - assign: true - }, - __webpack_hash__: { - expr: `${RuntimeGlobals.getFullHash}()`, - req: [RuntimeGlobals.getFullHash], - type: "string", - assign: false - }, - __webpack_chunkname__: { - expr: RuntimeGlobals.chunkName, - req: [RuntimeGlobals.chunkName], - type: "string", - assign: false - }, - __webpack_get_script_filename__: { - expr: RuntimeGlobals.getChunkScriptFilename, - req: [RuntimeGlobals.getChunkScriptFilename], - type: "function", - assign: true - }, - __webpack_runtime_id__: { - expr: RuntimeGlobals.runtimeId, - req: [RuntimeGlobals.runtimeId], - assign: false - }, - "require.onError": { - expr: RuntimeGlobals.uncaughtErrorHandler, - req: [RuntimeGlobals.uncaughtErrorHandler], - type: undefined, // type is not known, could be function or undefined - assign: true // is never a pattern - }, - __system_context__: { - expr: RuntimeGlobals.systemContext, - req: [RuntimeGlobals.systemContext], - type: "object", - assign: false - }, - __webpack_share_scopes__: { - expr: RuntimeGlobals.shareScopeMap, - req: [RuntimeGlobals.shareScopeMap], - type: "object", - assign: false - }, - __webpack_init_sharing__: { - expr: RuntimeGlobals.initializeSharing, - req: [RuntimeGlobals.initializeSharing], - type: "function", - assign: true - } -}; -/* eslint-enable camelcase */ +class GlobalScope extends Scope { + constructor(scopeManager, block) { + super(scopeManager, "global", null, block, false); + this.implicit = { + set: new Map(), + variables: [], -class APIPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "APIPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyTemplates.set( - ConstDependency, - new ConstDependency.Template() - ); + /** + * List of {@link Reference}s that are left to be resolved (i.e. which + * need to be linked to the variable they refer to). + * @member {Reference[]} Scope#implicit#left + */ + left: [] + }; + } - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.chunkName) - .tap("APIPlugin", chunk => { - compilation.addRuntimeModule( - chunk, - new ChunkNameRuntimeModule(chunk.name) - ); - return true; - }); + __close(scopeManager) { + const implicit = []; - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.getFullHash) - .tap("APIPlugin", (chunk, set) => { - compilation.addRuntimeModule(chunk, new GetFullHashRuntimeModule()); - return true; - }); + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref = this.__left[i]; - /** - * @param {JavascriptParser} parser the parser - */ - const handler = parser => { - Object.keys(REPLACEMENTS).forEach(key => { - const info = REPLACEMENTS[key]; - parser.hooks.expression - .for(key) - .tap( - "APIPlugin", - toConstantDependency(parser, info.expr, info.req) - ); - if (info.assign === false) { - parser.hooks.assign.for(key).tap("APIPlugin", expr => { - const err = new WebpackError(`${key} must not be assigned`); - err.loc = expr.loc; - throw err; - }); - } - if (info.type) { - parser.hooks.evaluateTypeof - .for(key) - .tap("APIPlugin", evaluateToString(info.type)); - } - }); + if (ref.__maybeImplicitGlobal && !this.set.has(ref.identifier.name)) { + implicit.push(ref.__maybeImplicitGlobal); + } + } - parser.hooks.expression - .for("__webpack_layer__") - .tap("APIPlugin", expr => { - const dep = new ConstDependency( - JSON.stringify(parser.state.module.layer), - expr.range - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - parser.hooks.evaluateIdentifier - .for("__webpack_layer__") - .tap("APIPlugin", expr => - (parser.state.module.layer === null - ? new BasicEvaluatedExpression().setNull() - : new BasicEvaluatedExpression().setString( - parser.state.module.layer - ) - ).setRange(expr.range) - ); - parser.hooks.evaluateTypeof - .for("__webpack_layer__") - .tap("APIPlugin", expr => - new BasicEvaluatedExpression() - .setString( - parser.state.module.layer === null ? "object" : "string" - ) - .setRange(expr.range) - ); + // create an implicit global variable from assignment expression + for (let i = 0, iz = implicit.length; i < iz; ++i) { + const info = implicit[i]; - parser.hooks.expression - .for("__webpack_module__.id") - .tap("APIPlugin", expr => { - parser.state.module.buildInfo.moduleConcatenationBailout = - "__webpack_module__.id"; - const dep = new ConstDependency( - parser.state.module.moduleArgument + ".id", - expr.range, - [RuntimeGlobals.moduleId] - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); + this.__defineImplicit(info.pattern, + new Definition( + Variable.ImplicitGlobalVariable, + info.pattern, + info.node, + null, + null, + null + )); - parser.hooks.expression - .for("__webpack_module__") - .tap("APIPlugin", expr => { - parser.state.module.buildInfo.moduleConcatenationBailout = - "__webpack_module__"; - const dep = new ConstDependency( - parser.state.module.moduleArgument, - expr.range, - [RuntimeGlobals.module] - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - parser.hooks.evaluateTypeof - .for("__webpack_module__") - .tap("APIPlugin", evaluateToString("object")); - }; + } - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("APIPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("APIPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("APIPlugin", handler); - } - ); - } -} + this.implicit.left = this.__left; -module.exports = APIPlugin; + return super.__close(scopeManager); + } + __defineImplicit(node, def) { + if (node && node.type === Syntax.Identifier) { + this.__defineGeneric( + node.name, + this.implicit.set, + this.implicit.variables, + node, + def + ); + } + } +} -/***/ }), +class ModuleScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "module", upperScope, block, false); + } +} -/***/ 77198: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +class FunctionExpressionNameScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "function-expression-name", upperScope, block, false); + this.__define(block.id, + new Definition( + Variable.FunctionName, + block.id, + block, + null, + null, + null + )); + this.functionExpressionScope = true; + } +} -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ +class CatchScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "catch", upperScope, block, false); + } +} +class WithScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "with", upperScope, block, false); + } + __close(scopeManager) { + if (this.__shouldStaticallyClose(scopeManager)) { + return super.__close(scopeManager); + } -const WebpackError = __webpack_require__(53799); -const CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/; + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref = this.__left[i]; -/** - * @param {string=} method method name - * @returns {string} message - */ -function createMessage(method) { - return `Abstract method${method ? " " + method : ""}. Must be overridden.`; -} + ref.tainted = true; + this.__delegateToUpperScope(ref); + } + this.__left = null; -/** - * @constructor - */ -function Message() { - /** @type {string} */ - this.stack = undefined; - Error.captureStackTrace(this); - /** @type {RegExpMatchArray} */ - const match = this.stack.split("\n")[3].match(CURRENT_METHOD_REGEXP); + return this.upper; + } +} - this.message = match && match[1] ? createMessage(match[1]) : createMessage(); +class BlockScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "block", upperScope, block, false); + } } -/** - * Error for abstract method - * @example - * class FooClass { - * abstractMethod() { - * throw new AbstractMethodError(); // error message: Abstract method FooClass.abstractMethod. Must be overridden. - * } - * } - * - */ -class AbstractMethodError extends WebpackError { - constructor() { - super(new Message().message); - this.name = "AbstractMethodError"; - } +class SwitchScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "switch", upperScope, block, false); + } } -module.exports = AbstractMethodError; +class FunctionScope extends Scope { + constructor(scopeManager, upperScope, block, isMethodDefinition) { + super(scopeManager, "function", upperScope, block, isMethodDefinition); + // section 9.2.13, FunctionDeclarationInstantiation. + // NOTE Arrow functions never have an arguments objects. + if (this.block.type !== Syntax.ArrowFunctionExpression) { + this.__defineArguments(); + } + } -/***/ }), + isArgumentsMaterialized() { -/***/ 47736: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // TODO(Constellation) + // We can more aggressive on this condition like this. + // + // function t() { + // // arguments of t is always hidden. + // function arguments() { + // } + // } + if (this.block.type === Syntax.ArrowFunctionExpression) { + return false; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (!this.isStatic()) { + return true; + } + const variable = this.set.get("arguments"); + assert(variable, "Always have arguments variable."); + return variable.tainted || variable.references.length !== 0; + } -const DependenciesBlock = __webpack_require__(71040); -const makeSerializable = __webpack_require__(33032); + isThisMaterialized() { + if (!this.isStatic()) { + return true; + } + return this.thisFound; + } -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./ChunkGroup")} ChunkGroup */ -/** @typedef {import("./ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */ -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./util/Hash")} Hash */ + __defineArguments() { + this.__defineGeneric( + "arguments", + this.set, + this.variables, + null, + null + ); + this.taints.set("arguments", true); + } -class AsyncDependenciesBlock extends DependenciesBlock { - /** - * @param {ChunkGroupOptions & { entryOptions?: EntryOptions }} groupOptions options for the group - * @param {DependencyLocation=} loc the line of code - * @param {string=} request the request - */ - constructor(groupOptions, loc, request) { - super(); - if (typeof groupOptions === "string") { - groupOptions = { name: groupOptions }; - } else if (!groupOptions) { - groupOptions = { name: undefined }; - } - this.groupOptions = groupOptions; - this.loc = loc; - this.request = request; - this._stringifiedGroupOptions = undefined; - } + // References in default parameters isn't resolved to variables which are in their function body. + // const x = 1 + // function f(a = x) { // This `x` is resolved to the `x` in the outer scope. + // const x = 2 + // console.log(a) + // } + __isValidResolution(ref, variable) { - /** - * @returns {string} The name of the chunk - */ - get chunkName() { - return this.groupOptions.name; - } + // If `options.nodejsScope` is true, `this.block` becomes a Program node. + if (this.block.type === "Program") { + return true; + } - /** - * @param {string} value The new chunk name - * @returns {void} - */ - set chunkName(value) { - if (this.groupOptions.name !== value) { - this.groupOptions.name = value; - this._stringifiedGroupOptions = undefined; - } - } + const bodyStart = this.block.body.range[0]; - /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - const { chunkGraph } = context; - if (this._stringifiedGroupOptions === undefined) { - this._stringifiedGroupOptions = JSON.stringify(this.groupOptions); - } - const chunkGroup = chunkGraph.getBlockChunkGroup(this); - hash.update( - `${this._stringifiedGroupOptions}${chunkGroup ? chunkGroup.id : ""}` - ); - super.updateHash(hash, context); - } + // It's invalid resolution in the following case: + return !( + variable.scope === this && + ref.identifier.range[0] < bodyStart && // the reference is in the parameter part. + variable.defs.every(d => d.name.range[0] >= bodyStart) // the variable is in the body. + ); + } +} - serialize(context) { - const { write } = context; - write(this.groupOptions); - write(this.loc); - write(this.request); - super.serialize(context); - } +class ForScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "for", upperScope, block, false); + } +} - deserialize(context) { - const { read } = context; - this.groupOptions = read(); - this.loc = read(); - this.request = read(); - super.deserialize(context); - } +class ClassScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "class", upperScope, block, false); + } } -makeSerializable(AsyncDependenciesBlock, "webpack/lib/AsyncDependenciesBlock"); +module.exports = { + Scope, + GlobalScope, + ModuleScope, + FunctionExpressionNameScope, + CatchScope, + WithScope, + BlockScope, + SwitchScope, + FunctionScope, + ForScope, + ClassScope +}; -Object.defineProperty(AsyncDependenciesBlock.prototype, "module", { - get() { - throw new Error( - "module property was removed from AsyncDependenciesBlock (it's not needed)" - ); - }, - set() { - throw new Error( - "module property was removed from AsyncDependenciesBlock (it's not needed)" - ); - } -}); - -module.exports = AsyncDependenciesBlock; +/* vim: set sw=4 ts=4 et tw=80 : */ /***/ }), -/***/ 30111: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 82971: +/***/ (function(module) { "use strict"; /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sean Larkin @thelarkinn -*/ - - + Copyright (C) 2015 Yusuke Suzuki -const WebpackError = __webpack_require__(53799); + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("./Module")} Module */ + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. -class AsyncDependencyToInitialChunkError extends WebpackError { - /** - * Creates an instance of AsyncDependencyToInitialChunkError. - * @param {string} chunkName Name of Chunk - * @param {Module} module module tied to dependency - * @param {DependencyLocation} loc location of dependency - */ - constructor(chunkName, module, loc) { - super( - `It's not allowed to load an initial chunk on demand. The chunk name "${chunkName}" is already used by an entrypoint.` - ); + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ - this.name = "AsyncDependencyToInitialChunkError"; - this.module = module; - this.loc = loc; - } -} -module.exports = AsyncDependencyToInitialChunkError; +/** + * A Variable represents a locally scoped identifier. These include arguments to + * functions. + * @class Variable + */ +class Variable { + constructor(name, scope) { + /** + * The variable name, as given in the source code. + * @member {String} Variable#name + */ + this.name = name; -/***/ }), + /** + * List of defining occurrences of this variable (like in 'var ...' + * statements or as parameter), as AST nodes. + * @member {espree.Identifier[]} Variable#identifiers + */ + this.identifiers = []; -/***/ 17714: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * List of {@link Reference|references} of this variable (excluding parameter entries) + * in its defining scope and all nested scopes. For defining + * occurrences only see {@link Variable#defs}. + * @member {Reference[]} Variable#references + */ + this.references = []; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * List of defining occurrences of this variable (like in 'var ...' + * statements or as parameter), as custom objects. + * @member {Definition[]} Variable#defs + */ + this.defs = []; + this.tainted = false; + /** + * Whether this is a stack variable. + * @member {boolean} Variable#stack + */ + this.stack = true; -const asyncLib = __webpack_require__(78175); -const NormalModule = __webpack_require__(39); -const PrefetchDependency = __webpack_require__(31618); + /** + * Reference to the enclosing Scope. + * @member {Scope} Variable#scope + */ + this.scope = scope; + } +} -/** @typedef {import("./Compiler")} Compiler */ +Variable.CatchClause = "CatchClause"; +Variable.Parameter = "Parameter"; +Variable.FunctionName = "FunctionName"; +Variable.ClassName = "ClassName"; +Variable.Variable = "Variable"; +Variable.ImportBinding = "ImportBinding"; +Variable.ImplicitGlobalVariable = "ImplicitGlobalVariable"; -class AutomaticPrefetchPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "AutomaticPrefetchPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - PrefetchDependency, - normalModuleFactory - ); - } - ); - let lastModules = null; - compiler.hooks.afterCompile.tap("AutomaticPrefetchPlugin", compilation => { - lastModules = []; +module.exports = Variable; - for (const m of compilation.modules) { - if (m instanceof NormalModule) { - lastModules.push({ - context: m.context, - request: m.request - }); - } - } - }); - compiler.hooks.make.tapAsync( - "AutomaticPrefetchPlugin", - (compilation, callback) => { - if (!lastModules) return callback(); - asyncLib.forEach( - lastModules, - (m, callback) => { - compilation.addModuleChain( - m.context || compiler.context, - new PrefetchDependency(`!!${m.request}`), - callback - ); - }, - err => { - lastModules = null; - callback(err); - } - ); - } - ); - } -} -module.exports = AutomaticPrefetchPlugin; +/* vim: set sw=4 ts=4 et tw=80 : */ /***/ }), -/***/ 21242: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 81217: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -"use strict"; /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + Copyright (C) 2014 Yusuke Suzuki + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. -const { ConcatSource } = __webpack_require__(51255); -const Compilation = __webpack_require__(85720); -const ModuleFilenameHelpers = __webpack_require__(88821); -const Template = __webpack_require__(1626); -const createSchemaValidation = __webpack_require__(32540); + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +(function () { + 'use strict'; -/** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginArgument} BannerPluginArgument */ -/** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginOptions} BannerPluginOptions */ -/** @typedef {import("./Compiler")} Compiler */ + var estraverse = __webpack_require__(50165); -const validate = createSchemaValidation( - __webpack_require__(42173), - () => __webpack_require__(49052), - { - name: "Banner Plugin", - baseDataPath: "options" - } -); + function isNode(node) { + if (node == null) { + return false; + } + return typeof node === 'object' && typeof node.type === 'string'; + } -const wrapComment = str => { - if (!str.includes("\n")) { - return Template.toComment(str); - } - return `/*!\n * ${str - .replace(/\*\//g, "* /") - .split("\n") - .join("\n * ") - .replace(/\s+\n/g, "\n") - .trimRight()}\n */`; -}; + function isProperty(nodeType, key) { + return (nodeType === estraverse.Syntax.ObjectExpression || nodeType === estraverse.Syntax.ObjectPattern) && key === 'properties'; + } -class BannerPlugin { - /** - * @param {BannerPluginArgument} options options object - */ - constructor(options) { - if (typeof options === "string" || typeof options === "function") { - options = { - banner: options - }; - } + function Visitor(visitor, options) { + options = options || {}; - validate(options); + this.__visitor = visitor || this; + this.__childVisitorKeys = options.childVisitorKeys + ? Object.assign({}, estraverse.VisitorKeys, options.childVisitorKeys) + : estraverse.VisitorKeys; + if (options.fallback === 'iteration') { + this.__fallback = Object.keys; + } else if (typeof options.fallback === 'function') { + this.__fallback = options.fallback; + } + } - this.options = options; + /* Default method for visiting children. + * When you need to call default visiting operation inside custom visiting + * operation, you can use it with `this.visitChildren(node)`. + */ + Visitor.prototype.visitChildren = function (node) { + var type, children, i, iz, j, jz, child; - const bannerOption = options.banner; - if (typeof bannerOption === "function") { - const getBanner = bannerOption; - this.banner = this.options.raw - ? getBanner - : data => wrapComment(getBanner(data)); - } else { - const banner = this.options.raw - ? bannerOption - : wrapComment(bannerOption); - this.banner = () => banner; - } - } + if (node == null) { + return; + } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const options = this.options; - const banner = this.banner; - const matchObject = ModuleFilenameHelpers.matchObject.bind( - undefined, - options - ); + type = node.type || estraverse.Syntax.Property; - compiler.hooks.compilation.tap("BannerPlugin", compilation => { - compilation.hooks.processAssets.tap( - { - name: "BannerPlugin", - stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS - }, - () => { - for (const chunk of compilation.chunks) { - if (options.entryOnly && !chunk.canBeInitial()) { - continue; - } + children = this.__childVisitorKeys[type]; + if (!children) { + if (this.__fallback) { + children = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + type + '.'); + } + } - for (const file of chunk.files) { - if (!matchObject(file)) { - continue; - } + for (i = 0, iz = children.length; i < iz; ++i) { + child = node[children[i]]; + if (child) { + if (Array.isArray(child)) { + for (j = 0, jz = child.length; j < jz; ++j) { + if (child[j]) { + if (isNode(child[j]) || isProperty(type, children[i])) { + this.visit(child[j]); + } + } + } + } else if (isNode(child)) { + this.visit(child); + } + } + } + }; - const data = { - chunk, - filename: file - }; + /* Dispatching node. */ + Visitor.prototype.visit = function (node) { + var type; - const comment = compilation.getPath(banner, data); + if (node == null) { + return; + } - compilation.updateAsset( - file, - old => new ConcatSource(comment, "\n", old) - ); - } - } - } - ); - }); - } -} + type = node.type || estraverse.Syntax.Property; + if (this.__visitor[type]) { + this.__visitor[type].call(this, node); + return; + } + this.visitChildren(node); + }; -module.exports = BannerPlugin; + exports.version = __webpack_require__(12166).version; + exports.Visitor = Visitor; + exports.visit = function (node, visitor, options) { + var v = new Visitor(visitor, options); + v.visit(node); + }; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ /***/ }), -/***/ 7592: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 50165: +/***/ (function(__unused_webpack_module, exports) { -"use strict"; /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + Copyright (C) 2012-2013 Yusuke Suzuki + Copyright (C) 2012 Ariya Hidayat + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. -const { AsyncParallelHook, AsyncSeriesBailHook, SyncHook } = __webpack_require__(6967); -const { - makeWebpackError, - makeWebpackErrorCallback -} = __webpack_require__(11351); + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/*jslint vars:false, bitwise:true*/ +/*jshint indent:4*/ +/*global exports:true*/ +(function clone(exports) { + 'use strict'; -/** @typedef {import("./WebpackError")} WebpackError */ + var Syntax, + VisitorOption, + VisitorKeys, + BREAK, + SKIP, + REMOVE; -/** - * @typedef {Object} Etag - * @property {function(): string} toString - */ + function deepCopy(obj) { + var ret = {}, key, val; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + val = obj[key]; + if (typeof val === 'object' && val !== null) { + ret[key] = deepCopy(val); + } else { + ret[key] = val; + } + } + } + return ret; + } -/** - * @template T - * @callback CallbackCache - * @param {(WebpackError | null)=} err - * @param {T=} result - * @returns {void} - */ + // based on LLVM libc++ upper_bound / lower_bound + // MIT License -/** - * @callback GotHandler - * @param {any} result - * @param {function(Error=): void} callback - * @returns {void} - */ + function upperBound(array, func) { + var diff, len, i, current; -const needCalls = (times, callback) => { - return err => { - if (--times === 0) { - return callback(err); - } - if (err && times > 0) { - times = 0; - return callback(err); - } - }; -}; + len = array.length; + i = 0; -class Cache { - constructor() { - this.hooks = { - /** @type {AsyncSeriesBailHook<[string, Etag | null, GotHandler[]], any>} */ - get: new AsyncSeriesBailHook(["identifier", "etag", "gotHandlers"]), - /** @type {AsyncParallelHook<[string, Etag | null, any]>} */ - store: new AsyncParallelHook(["identifier", "etag", "data"]), - /** @type {AsyncParallelHook<[Iterable]>} */ - storeBuildDependencies: new AsyncParallelHook(["dependencies"]), - /** @type {SyncHook<[]>} */ - beginIdle: new SyncHook([]), - /** @type {AsyncParallelHook<[]>} */ - endIdle: new AsyncParallelHook([]), - /** @type {AsyncParallelHook<[]>} */ - shutdown: new AsyncParallelHook([]) - }; - } + while (len) { + diff = len >>> 1; + current = i + diff; + if (func(array[current])) { + len = diff; + } else { + i = current + 1; + len -= diff + 1; + } + } + return i; + } - /** - * @template T - * @param {string} identifier the cache identifier - * @param {Etag | null} etag the etag - * @param {CallbackCache} callback signals when the value is retrieved - * @returns {void} - */ - get(identifier, etag, callback) { - const gotHandlers = []; - this.hooks.get.callAsync(identifier, etag, gotHandlers, (err, result) => { - if (err) { - callback(makeWebpackError(err, "Cache.hooks.get")); - return; - } - if (result === null) { - result = undefined; - } - if (gotHandlers.length > 1) { - const innerCallback = needCalls(gotHandlers.length, () => - callback(null, result) - ); - for (const gotHandler of gotHandlers) { - gotHandler(result, innerCallback); - } - } else if (gotHandlers.length === 1) { - gotHandlers[0](result, () => callback(null, result)); - } else { - callback(null, result); - } - }); - } + Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7. + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ChainExpression: 'ChainExpression', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7. + ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7. + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DebuggerStatement: 'DebuggerStatement', + DirectiveStatement: 'DirectiveStatement', + DoWhileStatement: 'DoWhileStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + ForOfStatement: 'ForOfStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7. + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportExpression: 'ImportExpression', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + ModuleSpecifier: 'ModuleSpecifier', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' + }; - /** - * @template T - * @param {string} identifier the cache identifier - * @param {Etag | null} etag the etag - * @param {T} data the value to store - * @param {CallbackCache} callback signals when the value is stored - * @returns {void} - */ - store(identifier, etag, data, callback) { - this.hooks.store.callAsync( - identifier, - etag, - data, - makeWebpackErrorCallback(callback, "Cache.hooks.store") - ); - } + VisitorKeys = { + AssignmentExpression: ['left', 'right'], + AssignmentPattern: ['left', 'right'], + ArrayExpression: ['elements'], + ArrayPattern: ['elements'], + ArrowFunctionExpression: ['params', 'body'], + AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7. + BlockStatement: ['body'], + BinaryExpression: ['left', 'right'], + BreakStatement: ['label'], + CallExpression: ['callee', 'arguments'], + CatchClause: ['param', 'body'], + ChainExpression: ['expression'], + ClassBody: ['body'], + ClassDeclaration: ['id', 'superClass', 'body'], + ClassExpression: ['id', 'superClass', 'body'], + ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7. + ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + ConditionalExpression: ['test', 'consequent', 'alternate'], + ContinueStatement: ['label'], + DebuggerStatement: [], + DirectiveStatement: [], + DoWhileStatement: ['body', 'test'], + EmptyStatement: [], + ExportAllDeclaration: ['source'], + ExportDefaultDeclaration: ['declaration'], + ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], + ExportSpecifier: ['exported', 'local'], + ExpressionStatement: ['expression'], + ForStatement: ['init', 'test', 'update', 'body'], + ForInStatement: ['left', 'right', 'body'], + ForOfStatement: ['left', 'right', 'body'], + FunctionDeclaration: ['id', 'params', 'body'], + FunctionExpression: ['id', 'params', 'body'], + GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + Identifier: [], + IfStatement: ['test', 'consequent', 'alternate'], + ImportExpression: ['source'], + ImportDeclaration: ['specifiers', 'source'], + ImportDefaultSpecifier: ['local'], + ImportNamespaceSpecifier: ['local'], + ImportSpecifier: ['imported', 'local'], + Literal: [], + LabeledStatement: ['label', 'body'], + LogicalExpression: ['left', 'right'], + MemberExpression: ['object', 'property'], + MetaProperty: ['meta', 'property'], + MethodDefinition: ['key', 'value'], + ModuleSpecifier: [], + NewExpression: ['callee', 'arguments'], + ObjectExpression: ['properties'], + ObjectPattern: ['properties'], + Program: ['body'], + Property: ['key', 'value'], + RestElement: [ 'argument' ], + ReturnStatement: ['argument'], + SequenceExpression: ['expressions'], + SpreadElement: ['argument'], + Super: [], + SwitchStatement: ['discriminant', 'cases'], + SwitchCase: ['test', 'consequent'], + TaggedTemplateExpression: ['tag', 'quasi'], + TemplateElement: [], + TemplateLiteral: ['quasis', 'expressions'], + ThisExpression: [], + ThrowStatement: ['argument'], + TryStatement: ['block', 'handler', 'finalizer'], + UnaryExpression: ['argument'], + UpdateExpression: ['argument'], + VariableDeclaration: ['declarations'], + VariableDeclarator: ['id', 'init'], + WhileStatement: ['test', 'body'], + WithStatement: ['object', 'body'], + YieldExpression: ['argument'] + }; - /** - * After this method has succeeded the cache can only be restored when build dependencies are - * @param {Iterable} dependencies list of all build dependencies - * @param {CallbackCache} callback signals when the dependencies are stored - * @returns {void} - */ - storeBuildDependencies(dependencies, callback) { - this.hooks.storeBuildDependencies.callAsync( - dependencies, - makeWebpackErrorCallback(callback, "Cache.hooks.storeBuildDependencies") - ); - } + // unique id + BREAK = {}; + SKIP = {}; + REMOVE = {}; - /** - * @returns {void} - */ - beginIdle() { - this.hooks.beginIdle.call(); - } + VisitorOption = { + Break: BREAK, + Skip: SKIP, + Remove: REMOVE + }; - /** - * @param {CallbackCache} callback signals when the call finishes - * @returns {void} - */ - endIdle(callback) { - this.hooks.endIdle.callAsync( - makeWebpackErrorCallback(callback, "Cache.hooks.endIdle") - ); - } + function Reference(parent, key) { + this.parent = parent; + this.key = key; + } - /** - * @param {CallbackCache} callback signals when the call finishes - * @returns {void} - */ - shutdown(callback) { - this.hooks.shutdown.callAsync( - makeWebpackErrorCallback(callback, "Cache.hooks.shutdown") - ); - } -} + Reference.prototype.replace = function replace(node) { + this.parent[this.key] = node; + }; -Cache.STAGE_MEMORY = -10; -Cache.STAGE_DEFAULT = 0; -Cache.STAGE_DISK = 10; -Cache.STAGE_NETWORK = 20; + Reference.prototype.remove = function remove() { + if (Array.isArray(this.parent)) { + this.parent.splice(this.key, 1); + return true; + } else { + this.replace(null); + return false; + } + }; -module.exports = Cache; + function Element(node, path, wrap, ref) { + this.node = node; + this.path = path; + this.wrap = wrap; + this.ref = ref; + } + function Controller() { } -/***/ }), + // API: + // return property path array from root to current node + Controller.prototype.path = function path() { + var i, iz, j, jz, result, element; -/***/ 55392: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + function addToPath(result, path) { + if (Array.isArray(path)) { + for (j = 0, jz = path.length; j < jz; ++j) { + result.push(path[j]); + } + } else { + result.push(path); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // root node + if (!this.__current.path) { + return null; + } + // first node is sentinel, second node is root element + result = []; + for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { + element = this.__leavelist[i]; + addToPath(result, element.path); + } + addToPath(result, this.__current.path); + return result; + }; + // API: + // return type of current node + Controller.prototype.type = function () { + var node = this.current(); + return node.type || this.__current.wrap; + }; -const { forEachBail } = __webpack_require__(9256); -const asyncLib = __webpack_require__(78175); -const getLazyHashedEtag = __webpack_require__(94075); -const mergeEtags = __webpack_require__(54980); + // API: + // return array of parent elements + Controller.prototype.parents = function parents() { + var i, iz, result; -/** @typedef {import("./Cache")} Cache */ -/** @typedef {import("./Cache").Etag} Etag */ -/** @typedef {import("./WebpackError")} WebpackError */ -/** @typedef {import("./cache/getLazyHashedEtag").HashableObject} HashableObject */ -/** @typedef {typeof import("./util/Hash")} HashConstructor */ + // first node is sentinel + result = []; + for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { + result.push(this.__leavelist[i].node); + } -/** - * @template T - * @callback CallbackCache - * @param {(WebpackError | null)=} err - * @param {T=} result - * @returns {void} - */ + return result; + }; -/** - * @template T - * @callback CallbackNormalErrorCache - * @param {(Error | null)=} err - * @param {T=} result - * @returns {void} - */ + // API: + // return current node + Controller.prototype.current = function current() { + return this.__current.node; + }; -class MultiItemCache { - /** - * @param {ItemCacheFacade[]} items item caches - */ - constructor(items) { - this._items = items; - if (items.length === 1) return /** @type {any} */ (items[0]); - } + Controller.prototype.__execute = function __execute(callback, element) { + var previous, result; - /** - * @template T - * @param {CallbackCache} callback signals when the value is retrieved - * @returns {void} - */ - get(callback) { - forEachBail(this._items, (item, callback) => item.get(callback), callback); - } + result = undefined; - /** - * @template T - * @returns {Promise} promise with the data - */ - getPromise() { - const next = i => { - return this._items[i].getPromise().then(result => { - if (result !== undefined) return result; - if (++i < this._items.length) return next(i); - }); - }; - return next(0); - } + previous = this.__current; + this.__current = element; + this.__state = null; + if (callback) { + result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); + } + this.__current = previous; - /** - * @template T - * @param {T} data the value to store - * @param {CallbackCache} callback signals when the value is stored - * @returns {void} - */ - store(data, callback) { - asyncLib.each( - this._items, - (item, callback) => item.store(data, callback), - callback - ); - } + return result; + }; - /** - * @template T - * @param {T} data the value to store - * @returns {Promise} promise signals when the value is stored - */ - storePromise(data) { - return Promise.all(this._items.map(item => item.storePromise(data))).then( - () => {} - ); - } -} + // API: + // notify control skip / break + Controller.prototype.notify = function notify(flag) { + this.__state = flag; + }; -class ItemCacheFacade { - /** - * @param {Cache} cache the root cache - * @param {string} name the child cache item name - * @param {Etag | null} etag the etag - */ - constructor(cache, name, etag) { - this._cache = cache; - this._name = name; - this._etag = etag; - } + // API: + // skip child nodes of current node + Controller.prototype.skip = function () { + this.notify(SKIP); + }; - /** - * @template T - * @param {CallbackCache} callback signals when the value is retrieved - * @returns {void} - */ - get(callback) { - this._cache.get(this._name, this._etag, callback); - } + // API: + // break traversals + Controller.prototype['break'] = function () { + this.notify(BREAK); + }; - /** - * @template T - * @returns {Promise} promise with the data - */ - getPromise() { - return new Promise((resolve, reject) => { - this._cache.get(this._name, this._etag, (err, data) => { - if (err) { - reject(err); - } else { - resolve(data); - } - }); - }); - } + // API: + // remove node + Controller.prototype.remove = function () { + this.notify(REMOVE); + }; - /** - * @template T - * @param {T} data the value to store - * @param {CallbackCache} callback signals when the value is stored - * @returns {void} - */ - store(data, callback) { - this._cache.store(this._name, this._etag, data, callback); - } + Controller.prototype.__initialize = function(root, visitor) { + this.visitor = visitor; + this.root = root; + this.__worklist = []; + this.__leavelist = []; + this.__current = null; + this.__state = null; + this.__fallback = null; + if (visitor.fallback === 'iteration') { + this.__fallback = Object.keys; + } else if (typeof visitor.fallback === 'function') { + this.__fallback = visitor.fallback; + } - /** - * @template T - * @param {T} data the value to store - * @returns {Promise} promise signals when the value is stored - */ - storePromise(data) { - return new Promise((resolve, reject) => { - this._cache.store(this._name, this._etag, data, err => { - if (err) { - reject(err); - } else { - resolve(); - } - }); - }); - } + this.__keys = VisitorKeys; + if (visitor.keys) { + this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); + } + }; - /** - * @template T - * @param {function(CallbackNormalErrorCache): void} computer function to compute the value if not cached - * @param {CallbackNormalErrorCache} callback signals when the value is retrieved - * @returns {void} - */ - provide(computer, callback) { - this.get((err, cacheEntry) => { - if (err) return callback(err); - if (cacheEntry !== undefined) return cacheEntry; - computer((err, result) => { - if (err) return callback(err); - this.store(result, err => { - if (err) return callback(err); - callback(null, result); - }); - }); - }); - } + function isNode(node) { + if (node == null) { + return false; + } + return typeof node === 'object' && typeof node.type === 'string'; + } - /** - * @template T - * @param {function(): Promise | T} computer function to compute the value if not cached - * @returns {Promise} promise with the data - */ - async providePromise(computer) { - const cacheEntry = await this.getPromise(); - if (cacheEntry !== undefined) return cacheEntry; - const result = await computer(); - await this.storePromise(result); - return result; - } -} + function isProperty(nodeType, key) { + return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; + } + + function candidateExistsInLeaveList(leavelist, candidate) { + for (var i = leavelist.length - 1; i >= 0; --i) { + if (leavelist[i].node === candidate) { + return true; + } + } + return false; + } -class CacheFacade { - /** - * @param {Cache} cache the root cache - * @param {string} name the child cache name - * @param {string | HashConstructor} hashFunction the hash function to use - */ - constructor(cache, name, hashFunction) { - this._cache = cache; - this._name = name; - this._hashFunction = hashFunction; - } + Controller.prototype.traverse = function traverse(root, visitor) { + var worklist, + leavelist, + element, + node, + nodeType, + ret, + key, + current, + current2, + candidates, + candidate, + sentinel; - /** - * @param {string} name the child cache name# - * @returns {CacheFacade} child cache - */ - getChildCache(name) { - return new CacheFacade( - this._cache, - `${this._name}|${name}`, - this._hashFunction - ); - } + this.__initialize(root, visitor); - /** - * @param {string} identifier the cache identifier - * @param {Etag | null} etag the etag - * @returns {ItemCacheFacade} item cache - */ - getItemCache(identifier, etag) { - return new ItemCacheFacade( - this._cache, - `${this._name}|${identifier}`, - etag - ); - } + sentinel = {}; - /** - * @param {HashableObject} obj an hashable object - * @returns {Etag} an etag that is lazy hashed - */ - getLazyHashedEtag(obj) { - return getLazyHashedEtag(obj, this._hashFunction); - } + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; - /** - * @param {Etag} a an etag - * @param {Etag} b another etag - * @returns {Etag} an etag that represents both - */ - mergeEtags(a, b) { - return mergeEtags(a, b); - } + // initialize + worklist.push(new Element(root, null, null, null)); + leavelist.push(new Element(null, null, null, null)); - /** - * @template T - * @param {string} identifier the cache identifier - * @param {Etag | null} etag the etag - * @param {CallbackCache} callback signals when the value is retrieved - * @returns {void} - */ - get(identifier, etag, callback) { - this._cache.get(`${this._name}|${identifier}`, etag, callback); - } + while (worklist.length) { + element = worklist.pop(); - /** - * @template T - * @param {string} identifier the cache identifier - * @param {Etag | null} etag the etag - * @returns {Promise} promise with the data - */ - getPromise(identifier, etag) { - return new Promise((resolve, reject) => { - this._cache.get(`${this._name}|${identifier}`, etag, (err, data) => { - if (err) { - reject(err); - } else { - resolve(data); - } - }); - }); - } + if (element === sentinel) { + element = leavelist.pop(); - /** - * @template T - * @param {string} identifier the cache identifier - * @param {Etag | null} etag the etag - * @param {T} data the value to store - * @param {CallbackCache} callback signals when the value is stored - * @returns {void} - */ - store(identifier, etag, data, callback) { - this._cache.store(`${this._name}|${identifier}`, etag, data, callback); - } + ret = this.__execute(visitor.leave, element); - /** - * @template T - * @param {string} identifier the cache identifier - * @param {Etag | null} etag the etag - * @param {T} data the value to store - * @returns {Promise} promise signals when the value is stored - */ - storePromise(identifier, etag, data) { - return new Promise((resolve, reject) => { - this._cache.store(`${this._name}|${identifier}`, etag, data, err => { - if (err) { - reject(err); - } else { - resolve(); - } - }); - }); - } + if (this.__state === BREAK || ret === BREAK) { + return; + } + continue; + } - /** - * @template T - * @param {string} identifier the cache identifier - * @param {Etag | null} etag the etag - * @param {function(CallbackNormalErrorCache): void} computer function to compute the value if not cached - * @param {CallbackNormalErrorCache} callback signals when the value is retrieved - * @returns {void} - */ - provide(identifier, etag, computer, callback) { - this.get(identifier, etag, (err, cacheEntry) => { - if (err) return callback(err); - if (cacheEntry !== undefined) return cacheEntry; - computer((err, result) => { - if (err) return callback(err); - this.store(identifier, etag, result, err => { - if (err) return callback(err); - callback(null, result); - }); - }); - }); - } + if (element.node) { - /** - * @template T - * @param {string} identifier the cache identifier - * @param {Etag | null} etag the etag - * @param {function(): Promise | T} computer function to compute the value if not cached - * @returns {Promise} promise with the data - */ - async providePromise(identifier, etag, computer) { - const cacheEntry = await this.getPromise(identifier, etag); - if (cacheEntry !== undefined) return cacheEntry; - const result = await computer(); - await this.storePromise(identifier, etag, result); - return result; - } -} + ret = this.__execute(visitor.enter, element); -module.exports = CacheFacade; -module.exports.ItemCacheFacade = ItemCacheFacade; -module.exports.MultiItemCache = MultiItemCache; + if (this.__state === BREAK || ret === BREAK) { + return; + } + worklist.push(sentinel); + leavelist.push(element); -/***/ }), + if (this.__state === SKIP || ret === SKIP) { + continue; + } -/***/ 77975: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + node = element.node; + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (candidateExistsInLeaveList(leavelist, candidate[current2])) { + continue; + } -const WebpackError = __webpack_require__(53799); + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', null); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, null); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + if (candidateExistsInLeaveList(leavelist, candidate)) { + continue; + } -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ + worklist.push(new Element(candidate, key, null, null)); + } + } + } + } + }; -/** - * @param {Module[]} modules the modules to be sorted - * @returns {Module[]} sorted version of original modules - */ -const sortModules = modules => { - return modules.sort((a, b) => { - const aIdent = a.identifier(); - const bIdent = b.identifier(); - /* istanbul ignore next */ - if (aIdent < bIdent) return -1; - /* istanbul ignore next */ - if (aIdent > bIdent) return 1; - /* istanbul ignore next */ - return 0; - }); -}; + Controller.prototype.replace = function replace(root, visitor) { + var worklist, + leavelist, + node, + nodeType, + target, + element, + current, + current2, + candidates, + candidate, + sentinel, + outer, + key; -/** - * @param {Module[]} modules each module from throw - * @param {ModuleGraph} moduleGraph the module graph - * @returns {string} each message from provided modules - */ -const createModulesListMessage = (modules, moduleGraph) => { - return modules - .map(m => { - let message = `* ${m.identifier()}`; - const validReasons = Array.from( - moduleGraph.getIncomingConnectionsByOriginModule(m).keys() - ).filter(x => x); + function removeElem(element) { + var i, + key, + nextElem, + parent; - if (validReasons.length > 0) { - message += `\n Used by ${validReasons.length} module(s), i. e.`; - message += `\n ${validReasons[0].identifier()}`; - } - return message; - }) - .join("\n"); -}; + if (element.ref.remove()) { + // When the reference is an element of an array. + key = element.ref.key; + parent = element.ref.parent; -class CaseSensitiveModulesWarning extends WebpackError { - /** - * Creates an instance of CaseSensitiveModulesWarning. - * @param {Iterable} modules modules that were detected - * @param {ModuleGraph} moduleGraph the module graph - */ - constructor(modules, moduleGraph) { - const sortedModules = sortModules(Array.from(modules)); - const modulesList = createModulesListMessage(sortedModules, moduleGraph); - super(`There are multiple modules with names that only differ in casing. -This can lead to unexpected behavior when compiling on a filesystem with other case-semantic. -Use equal casing. Compare these module identifiers: -${modulesList}`); + // If removed from array, then decrease following items' keys. + i = worklist.length; + while (i--) { + nextElem = worklist[i]; + if (nextElem.ref && nextElem.ref.parent === parent) { + if (nextElem.ref.key < key) { + break; + } + --nextElem.ref.key; + } + } + } + } - this.name = "CaseSensitiveModulesWarning"; - this.module = sortedModules[0]; - } -} + this.__initialize(root, visitor); -module.exports = CaseSensitiveModulesWarning; + sentinel = {}; + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; -/***/ }), + // initialize + outer = { + root: root + }; + element = new Element(root, null, null, new Reference(outer, 'root')); + worklist.push(element); + leavelist.push(element); -/***/ 39385: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + while (worklist.length) { + element = worklist.pop(); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (element === sentinel) { + element = leavelist.pop(); + target = this.__execute(visitor.leave, element); + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + } -const ChunkGraph = __webpack_require__(64971); -const Entrypoint = __webpack_require__(13795); -const { intersect } = __webpack_require__(93347); -const SortableSet = __webpack_require__(13098); -const StringXor = __webpack_require__(40293); -const { - compareModulesByIdentifier, - compareChunkGroupsByIndex, - compareModulesById -} = __webpack_require__(29579); -const { createArrayToSetDeprecationSet } = __webpack_require__(64518); -const { mergeRuntime } = __webpack_require__(17156); + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + } -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("./ChunkGraph").ChunkFilterPredicate} ChunkFilterPredicate */ -/** @typedef {import("./ChunkGraph").ChunkSizeOptions} ChunkSizeOptions */ -/** @typedef {import("./ChunkGraph").ModuleFilterPredicate} ModuleFilterPredicate */ -/** @typedef {import("./ChunkGroup")} ChunkGroup */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("./Compilation").PathData} PathData */ -/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./util/Hash")} Hash */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + continue; + } -const ChunkFilesSet = createArrayToSetDeprecationSet("chunk.files"); + target = this.__execute(visitor.enter, element); -/** - * @typedef {Object} WithId an object who has an id property * - * @property {string | number} id the id of the object - */ + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + element.node = target; + } -/** - * @deprecated - * @typedef {Object} ChunkMaps - * @property {Record} hash - * @property {Record>} contentHash - * @property {Record} name - */ + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + element.node = null; + } -/** - * @deprecated - * @typedef {Object} ChunkModuleMaps - * @property {Record} id - * @property {Record} hash - */ + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } -let debugId = 1000; + // node may be null + node = element.node; + if (!node) { + continue; + } -/** - * A Chunk is a unit of encapsulation for Modules. - * Chunks are "rendered" into bundles that get emitted when the build completes. - */ -class Chunk { - /** - * @param {string=} name of chunk being created, is optional (for subclasses) - * @param {boolean} backCompat enable backward-compatibility - */ - constructor(name, backCompat = true) { - /** @type {number | string | null} */ - this.id = null; - /** @type {(number|string)[] | null} */ - this.ids = null; - /** @type {number} */ - this.debugId = debugId++; - /** @type {string} */ - this.name = name; - /** @type {SortableSet} */ - this.idNameHints = new SortableSet(); - /** @type {boolean} */ - this.preventIntegration = false; - /** @type {(string | function(PathData, AssetInfo=): string)?} */ - this.filenameTemplate = undefined; - /** @type {(string | function(PathData, AssetInfo=): string)?} */ - this.cssFilenameTemplate = undefined; - /** @private @type {SortableSet} */ - this._groups = new SortableSet(undefined, compareChunkGroupsByIndex); - /** @type {RuntimeSpec} */ - this.runtime = undefined; - /** @type {Set} */ - this.files = backCompat ? new ChunkFilesSet() : new Set(); - /** @type {Set} */ - this.auxiliaryFiles = new Set(); - /** @type {boolean} */ - this.rendered = false; - /** @type {string=} */ - this.hash = undefined; - /** @type {Record} */ - this.contentHash = Object.create(null); - /** @type {string=} */ - this.renderedHash = undefined; - /** @type {string=} */ - this.chunkReason = undefined; - /** @type {boolean} */ - this.extraAsync = false; - } + worklist.push(sentinel); + leavelist.push(element); - // TODO remove in webpack 6 - // BACKWARD-COMPAT START - get entryModule() { - const entryModules = Array.from( - ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.entryModule", - "DEP_WEBPACK_CHUNK_ENTRY_MODULE" - ).getChunkEntryModulesIterable(this) - ); - if (entryModules.length === 0) { - return undefined; - } else if (entryModules.length === 1) { - return entryModules[0]; - } else { - throw new Error( - "Module.entryModule: Multiple entry modules are not supported by the deprecated API (Use the new ChunkGroup API)" - ); - } - } + if (this.__state === SKIP || target === SKIP) { + continue; + } - /** - * @returns {boolean} true, if the chunk contains an entry module - */ - hasEntryModule() { - return ( - ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.hasEntryModule", - "DEP_WEBPACK_CHUNK_HAS_ENTRY_MODULE" - ).getNumberOfEntryModules(this) > 0 - ); - } + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } - /** - * @param {Module} module the module - * @returns {boolean} true, if the chunk could be added - */ - addModule(module) { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.addModule", - "DEP_WEBPACK_CHUNK_ADD_MODULE" - ); - if (chunkGraph.isModuleInChunk(module, this)) return false; - chunkGraph.connectChunkAndModule(this, module); - return true; - } + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } - /** - * @param {Module} module the module - * @returns {void} - */ - removeModule(module) { - ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.removeModule", - "DEP_WEBPACK_CHUNK_REMOVE_MODULE" - ).disconnectChunkAndModule(this, module); - } + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, new Reference(node, key))); + } + } + } - /** - * @returns {number} the number of module which are contained in this chunk - */ - getNumberOfModules() { - return ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.getNumberOfModules", - "DEP_WEBPACK_CHUNK_GET_NUMBER_OF_MODULES" - ).getNumberOfChunkModules(this); - } + return outer.root; + }; - get modulesIterable() { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.modulesIterable", - "DEP_WEBPACK_CHUNK_MODULES_ITERABLE" - ); - return chunkGraph.getOrderedChunkModulesIterable( - this, - compareModulesByIdentifier - ); - } + function traverse(root, visitor) { + var controller = new Controller(); + return controller.traverse(root, visitor); + } - /** - * @param {Chunk} otherChunk the chunk to compare with - * @returns {-1|0|1} the comparison result - */ - compareTo(otherChunk) { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.compareTo", - "DEP_WEBPACK_CHUNK_COMPARE_TO" - ); - return chunkGraph.compareChunks(this, otherChunk); - } + function replace(root, visitor) { + var controller = new Controller(); + return controller.replace(root, visitor); + } - /** - * @param {Module} module the module - * @returns {boolean} true, if the chunk contains the module - */ - containsModule(module) { - return ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.containsModule", - "DEP_WEBPACK_CHUNK_CONTAINS_MODULE" - ).isModuleInChunk(module, this); - } + function extendCommentRange(comment, tokens) { + var target; - /** - * @returns {Module[]} the modules for this chunk - */ - getModules() { - return ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.getModules", - "DEP_WEBPACK_CHUNK_GET_MODULES" - ).getChunkModules(this); - } + target = upperBound(tokens, function search(token) { + return token.range[0] > comment.range[0]; + }); - /** - * @returns {void} - */ - remove() { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.remove", - "DEP_WEBPACK_CHUNK_REMOVE" - ); - chunkGraph.disconnectChunk(this); - this.disconnectFromGroups(); - } + comment.extendedRange = [comment.range[0], comment.range[1]]; - /** - * @param {Module} module the module - * @param {Chunk} otherChunk the target chunk - * @returns {void} - */ - moveModule(module, otherChunk) { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.moveModule", - "DEP_WEBPACK_CHUNK_MOVE_MODULE" - ); - chunkGraph.disconnectChunkAndModule(this, module); - chunkGraph.connectChunkAndModule(otherChunk, module); - } + if (target !== tokens.length) { + comment.extendedRange[1] = tokens[target].range[0]; + } - /** - * @param {Chunk} otherChunk the other chunk - * @returns {boolean} true, if the specified chunk has been integrated - */ - integrate(otherChunk) { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.integrate", - "DEP_WEBPACK_CHUNK_INTEGRATE" - ); - if (chunkGraph.canChunksBeIntegrated(this, otherChunk)) { - chunkGraph.integrateChunks(this, otherChunk); - return true; - } else { - return false; - } - } + target -= 1; + if (target >= 0) { + comment.extendedRange[0] = tokens[target].range[1]; + } - /** - * @param {Chunk} otherChunk the other chunk - * @returns {boolean} true, if chunks could be integrated - */ - canBeIntegrated(otherChunk) { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.canBeIntegrated", - "DEP_WEBPACK_CHUNK_CAN_BE_INTEGRATED" - ); - return chunkGraph.canChunksBeIntegrated(this, otherChunk); - } + return comment; + } - /** - * @returns {boolean} true, if this chunk contains no module - */ - isEmpty() { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.isEmpty", - "DEP_WEBPACK_CHUNK_IS_EMPTY" - ); - return chunkGraph.getNumberOfChunkModules(this) === 0; - } + function attachComments(tree, providedComments, tokens) { + // At first, we should calculate extended comment ranges. + var comments = [], comment, len, i, cursor; - /** - * @returns {number} total size of all modules in this chunk - */ - modulesSize() { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.modulesSize", - "DEP_WEBPACK_CHUNK_MODULES_SIZE" - ); - return chunkGraph.getChunkModulesSize(this); - } + if (!tree.range) { + throw new Error('attachComments needs range information'); + } - /** - * @param {ChunkSizeOptions} options options object - * @returns {number} total size of this chunk - */ - size(options = {}) { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.size", - "DEP_WEBPACK_CHUNK_SIZE" - ); - return chunkGraph.getChunkSize(this, options); - } + // tokens array is empty, we attach comments to tree as 'leadingComments' + if (!tokens.length) { + if (providedComments.length) { + for (i = 0, len = providedComments.length; i < len; i += 1) { + comment = deepCopy(providedComments[i]); + comment.extendedRange = [0, tree.range[0]]; + comments.push(comment); + } + tree.leadingComments = comments; + } + return tree; + } - /** - * @param {Chunk} otherChunk the other chunk - * @param {ChunkSizeOptions} options options object - * @returns {number} total size of the chunk or false if the chunk can't be integrated - */ - integratedSize(otherChunk, options) { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.integratedSize", - "DEP_WEBPACK_CHUNK_INTEGRATED_SIZE" - ); - return chunkGraph.getIntegratedChunksSize(this, otherChunk, options); - } + for (i = 0, len = providedComments.length; i < len; i += 1) { + comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); + } - /** - * @param {ModuleFilterPredicate} filterFn function used to filter modules - * @returns {ChunkModuleMaps} module map information - */ - getChunkModuleMaps(filterFn) { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.getChunkModuleMaps", - "DEP_WEBPACK_CHUNK_GET_CHUNK_MODULE_MAPS" - ); - /** @type {Record} */ - const chunkModuleIdMap = Object.create(null); - /** @type {Record} */ - const chunkModuleHashMap = Object.create(null); + // This is based on John Freeman's implementation. + cursor = 0; + traverse(tree, { + enter: function (node) { + var comment; - for (const asyncChunk of this.getAllAsyncChunks()) { - /** @type {(string|number)[]} */ - let array; - for (const module of chunkGraph.getOrderedChunkModulesIterable( - asyncChunk, - compareModulesById(chunkGraph) - )) { - if (filterFn(module)) { - if (array === undefined) { - array = []; - chunkModuleIdMap[asyncChunk.id] = array; - } - const moduleId = chunkGraph.getModuleId(module); - array.push(moduleId); - chunkModuleHashMap[moduleId] = chunkGraph.getRenderedModuleHash( - module, - undefined - ); - } - } - } + while (cursor < comments.length) { + comment = comments[cursor]; + if (comment.extendedRange[1] > node.range[0]) { + break; + } - return { - id: chunkModuleIdMap, - hash: chunkModuleHashMap - }; - } + if (comment.extendedRange[1] === node.range[0]) { + if (!node.leadingComments) { + node.leadingComments = []; + } + node.leadingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } - /** - * @param {ModuleFilterPredicate} filterFn predicate function used to filter modules - * @param {ChunkFilterPredicate=} filterChunkFn predicate function used to filter chunks - * @returns {boolean} return true if module exists in graph - */ - hasModuleInGraph(filterFn, filterChunkFn) { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.hasModuleInGraph", - "DEP_WEBPACK_CHUNK_HAS_MODULE_IN_GRAPH" - ); - return chunkGraph.hasModuleInGraph(this, filterFn, filterChunkFn); - } + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } - /** - * @deprecated - * @param {boolean} realHash whether the full hash or the rendered hash is to be used - * @returns {ChunkMaps} the chunk map information - */ - getChunkMaps(realHash) { - /** @type {Record} */ - const chunkHashMap = Object.create(null); - /** @type {Record>} */ - const chunkContentHashMap = Object.create(null); - /** @type {Record} */ - const chunkNameMap = Object.create(null); + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); - for (const chunk of this.getAllAsyncChunks()) { - chunkHashMap[chunk.id] = realHash ? chunk.hash : chunk.renderedHash; - for (const key of Object.keys(chunk.contentHash)) { - if (!chunkContentHashMap[key]) { - chunkContentHashMap[key] = Object.create(null); - } - chunkContentHashMap[key][chunk.id] = chunk.contentHash[key]; - } - if (chunk.name) { - chunkNameMap[chunk.id] = chunk.name; - } - } + cursor = 0; + traverse(tree, { + leave: function (node) { + var comment; - return { - hash: chunkHashMap, - contentHash: chunkContentHashMap, - name: chunkNameMap - }; - } - // BACKWARD-COMPAT END + while (cursor < comments.length) { + comment = comments[cursor]; + if (node.range[1] < comment.extendedRange[0]) { + break; + } - /** - * @returns {boolean} whether or not the Chunk will have a runtime - */ - hasRuntime() { - for (const chunkGroup of this._groups) { - if ( - chunkGroup instanceof Entrypoint && - chunkGroup.getRuntimeChunk() === this - ) { - return true; - } - } - return false; - } + if (node.range[1] === comment.extendedRange[0]) { + if (!node.trailingComments) { + node.trailingComments = []; + } + node.trailingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } - /** - * @returns {boolean} whether or not this chunk can be an initial chunk - */ - canBeInitial() { - for (const chunkGroup of this._groups) { - if (chunkGroup.isInitial()) return true; - } - return false; - } + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } - /** - * @returns {boolean} whether this chunk can only be an initial chunk - */ - isOnlyInitial() { - if (this._groups.size <= 0) return false; - for (const chunkGroup of this._groups) { - if (!chunkGroup.isInitial()) return false; - } - return true; - } + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); - /** - * @returns {EntryOptions | undefined} the entry options for this chunk - */ - getEntryOptions() { - for (const chunkGroup of this._groups) { - if (chunkGroup instanceof Entrypoint) { - return chunkGroup.options; - } - } - return undefined; - } + return tree; + } - /** - * @param {ChunkGroup} chunkGroup the chunkGroup the chunk is being added - * @returns {void} - */ - addGroup(chunkGroup) { - this._groups.add(chunkGroup); - } + exports.Syntax = Syntax; + exports.traverse = traverse; + exports.replace = replace; + exports.attachComments = attachComments; + exports.VisitorKeys = VisitorKeys; + exports.VisitorOption = VisitorOption; + exports.Controller = Controller; + exports.cloneEnvironment = function () { return clone({}); }; - /** - * @param {ChunkGroup} chunkGroup the chunkGroup the chunk is being removed from - * @returns {void} - */ - removeGroup(chunkGroup) { - this._groups.delete(chunkGroup); - } + return exports; +}(exports)); +/* vim: set sw=4 ts=4 et tw=80 : */ - /** - * @param {ChunkGroup} chunkGroup the chunkGroup to check - * @returns {boolean} returns true if chunk has chunkGroup reference and exists in chunkGroup - */ - isInGroup(chunkGroup) { - return this._groups.has(chunkGroup); - } - /** - * @returns {number} the amount of groups that the said chunk is in - */ - getNumberOfGroups() { - return this._groups.size; - } +/***/ }), - /** - * @returns {Iterable} the chunkGroups that the said chunk is referenced in - */ - get groupsIterable() { - this._groups.sort(); - return this._groups; - } +/***/ 18350: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - /** - * @returns {void} - */ - disconnectFromGroups() { - for (const chunkGroup of this._groups) { - chunkGroup.removeChunk(this); - } - } +/* + Copyright (C) 2012-2013 Yusuke Suzuki + Copyright (C) 2012 Ariya Hidayat - /** - * @param {Chunk} newChunk the new chunk that will be split out of - * @returns {void} - */ - split(newChunk) { - for (const chunkGroup of this._groups) { - chunkGroup.insertChunk(newChunk, this); - newChunk.addGroup(chunkGroup); - } - for (const idHint of this.idNameHints) { - newChunk.idNameHints.add(idHint); - } - newChunk.runtime = mergeRuntime(newChunk.runtime, this.runtime); - } + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: - /** - * @param {Hash} hash hash (will be modified) - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {void} - */ - updateHash(hash, chunkGraph) { - hash.update( - `${this.id} ${this.ids ? this.ids.join() : ""} ${this.name || ""} ` - ); - const xor = new StringXor(); - for (const m of chunkGraph.getChunkModulesIterable(this)) { - xor.add(chunkGraph.getModuleHash(m, this.runtime)); - } - xor.updateHash(hash); - const entryModules = - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(this); - for (const [m, chunkGroup] of entryModules) { - hash.update(`entry${chunkGraph.getModuleId(m)}${chunkGroup.id}`); - } - } + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - /** - * @returns {Set} a set of all the async chunks - */ - getAllAsyncChunks() { - const queue = new Set(); - const chunks = new Set(); + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/*jslint vars:false, bitwise:true*/ +/*jshint indent:4*/ +/*global exports:true*/ +(function clone(exports) { + 'use strict'; - const initialChunks = intersect( - Array.from(this.groupsIterable, g => new Set(g.chunks)) - ); + var Syntax, + VisitorOption, + VisitorKeys, + BREAK, + SKIP, + REMOVE; - const initialQueue = new Set(this.groupsIterable); + function deepCopy(obj) { + var ret = {}, key, val; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + val = obj[key]; + if (typeof val === 'object' && val !== null) { + ret[key] = deepCopy(val); + } else { + ret[key] = val; + } + } + } + return ret; + } - for (const chunkGroup of initialQueue) { - for (const child of chunkGroup.childrenIterable) { - if (child instanceof Entrypoint) { - initialQueue.add(child); - } else { - queue.add(child); - } - } - } + // based on LLVM libc++ upper_bound / lower_bound + // MIT License - for (const chunkGroup of queue) { - for (const chunk of chunkGroup.chunks) { - if (!initialChunks.has(chunk)) { - chunks.add(chunk); - } - } - for (const child of chunkGroup.childrenIterable) { - queue.add(child); - } - } + function upperBound(array, func) { + var diff, len, i, current; - return chunks; - } + len = array.length; + i = 0; - /** - * @returns {Set} a set of all the initial chunks (including itself) - */ - getAllInitialChunks() { - const chunks = new Set(); - const queue = new Set(this.groupsIterable); - for (const group of queue) { - if (group.isInitial()) { - for (const c of group.chunks) chunks.add(c); - for (const g of group.childrenIterable) queue.add(g); - } - } - return chunks; - } + while (len) { + diff = len >>> 1; + current = i + diff; + if (func(array[current])) { + len = diff; + } else { + i = current + 1; + len -= diff + 1; + } + } + return i; + } - /** - * @returns {Set} a set of all the referenced chunks (including itself) - */ - getAllReferencedChunks() { - const queue = new Set(this.groupsIterable); - const chunks = new Set(); + Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7. + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7. + ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7. + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DebuggerStatement: 'DebuggerStatement', + DirectiveStatement: 'DirectiveStatement', + DoWhileStatement: 'DoWhileStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + ForOfStatement: 'ForOfStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7. + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportExpression: 'ImportExpression', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + ModuleSpecifier: 'ModuleSpecifier', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' + }; - for (const chunkGroup of queue) { - for (const chunk of chunkGroup.chunks) { - chunks.add(chunk); - } - for (const child of chunkGroup.childrenIterable) { - queue.add(child); - } - } + VisitorKeys = { + AssignmentExpression: ['left', 'right'], + AssignmentPattern: ['left', 'right'], + ArrayExpression: ['elements'], + ArrayPattern: ['elements'], + ArrowFunctionExpression: ['params', 'body'], + AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7. + BlockStatement: ['body'], + BinaryExpression: ['left', 'right'], + BreakStatement: ['label'], + CallExpression: ['callee', 'arguments'], + CatchClause: ['param', 'body'], + ClassBody: ['body'], + ClassDeclaration: ['id', 'superClass', 'body'], + ClassExpression: ['id', 'superClass', 'body'], + ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7. + ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + ConditionalExpression: ['test', 'consequent', 'alternate'], + ContinueStatement: ['label'], + DebuggerStatement: [], + DirectiveStatement: [], + DoWhileStatement: ['body', 'test'], + EmptyStatement: [], + ExportAllDeclaration: ['source'], + ExportDefaultDeclaration: ['declaration'], + ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], + ExportSpecifier: ['exported', 'local'], + ExpressionStatement: ['expression'], + ForStatement: ['init', 'test', 'update', 'body'], + ForInStatement: ['left', 'right', 'body'], + ForOfStatement: ['left', 'right', 'body'], + FunctionDeclaration: ['id', 'params', 'body'], + FunctionExpression: ['id', 'params', 'body'], + GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + Identifier: [], + IfStatement: ['test', 'consequent', 'alternate'], + ImportExpression: ['source'], + ImportDeclaration: ['specifiers', 'source'], + ImportDefaultSpecifier: ['local'], + ImportNamespaceSpecifier: ['local'], + ImportSpecifier: ['imported', 'local'], + Literal: [], + LabeledStatement: ['label', 'body'], + LogicalExpression: ['left', 'right'], + MemberExpression: ['object', 'property'], + MetaProperty: ['meta', 'property'], + MethodDefinition: ['key', 'value'], + ModuleSpecifier: [], + NewExpression: ['callee', 'arguments'], + ObjectExpression: ['properties'], + ObjectPattern: ['properties'], + Program: ['body'], + Property: ['key', 'value'], + RestElement: [ 'argument' ], + ReturnStatement: ['argument'], + SequenceExpression: ['expressions'], + SpreadElement: ['argument'], + Super: [], + SwitchStatement: ['discriminant', 'cases'], + SwitchCase: ['test', 'consequent'], + TaggedTemplateExpression: ['tag', 'quasi'], + TemplateElement: [], + TemplateLiteral: ['quasis', 'expressions'], + ThisExpression: [], + ThrowStatement: ['argument'], + TryStatement: ['block', 'handler', 'finalizer'], + UnaryExpression: ['argument'], + UpdateExpression: ['argument'], + VariableDeclaration: ['declarations'], + VariableDeclarator: ['id', 'init'], + WhileStatement: ['test', 'body'], + WithStatement: ['object', 'body'], + YieldExpression: ['argument'] + }; - return chunks; - } + // unique id + BREAK = {}; + SKIP = {}; + REMOVE = {}; - /** - * @returns {Set} a set of all the referenced entrypoints - */ - getAllReferencedAsyncEntrypoints() { - const queue = new Set(this.groupsIterable); - const entrypoints = new Set(); + VisitorOption = { + Break: BREAK, + Skip: SKIP, + Remove: REMOVE + }; - for (const chunkGroup of queue) { - for (const entrypoint of chunkGroup.asyncEntrypointsIterable) { - entrypoints.add(entrypoint); - } - for (const child of chunkGroup.childrenIterable) { - queue.add(child); - } - } + function Reference(parent, key) { + this.parent = parent; + this.key = key; + } - return entrypoints; - } + Reference.prototype.replace = function replace(node) { + this.parent[this.key] = node; + }; - /** - * @returns {boolean} true, if the chunk references async chunks - */ - hasAsyncChunks() { - const queue = new Set(); + Reference.prototype.remove = function remove() { + if (Array.isArray(this.parent)) { + this.parent.splice(this.key, 1); + return true; + } else { + this.replace(null); + return false; + } + }; - const initialChunks = intersect( - Array.from(this.groupsIterable, g => new Set(g.chunks)) - ); + function Element(node, path, wrap, ref) { + this.node = node; + this.path = path; + this.wrap = wrap; + this.ref = ref; + } - for (const chunkGroup of this.groupsIterable) { - for (const child of chunkGroup.childrenIterable) { - queue.add(child); - } - } + function Controller() { } - for (const chunkGroup of queue) { - for (const chunk of chunkGroup.chunks) { - if (!initialChunks.has(chunk)) { - return true; - } - } - for (const child of chunkGroup.childrenIterable) { - queue.add(child); - } - } + // API: + // return property path array from root to current node + Controller.prototype.path = function path() { + var i, iz, j, jz, result, element; - return false; - } + function addToPath(result, path) { + if (Array.isArray(path)) { + for (j = 0, jz = path.length; j < jz; ++j) { + result.push(path[j]); + } + } else { + result.push(path); + } + } - /** - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {ChunkFilterPredicate=} filterFn function used to filter chunks - * @returns {Record} a record object of names to lists of child ids(?) - */ - getChildIdsByOrders(chunkGraph, filterFn) { - /** @type {Map} */ - const lists = new Map(); - for (const group of this.groupsIterable) { - if (group.chunks[group.chunks.length - 1] === this) { - for (const childGroup of group.childrenIterable) { - for (const key of Object.keys(childGroup.options)) { - if (key.endsWith("Order")) { - const name = key.substr(0, key.length - "Order".length); - let list = lists.get(name); - if (list === undefined) { - list = []; - lists.set(name, list); - } - list.push({ - order: childGroup.options[key], - group: childGroup - }); - } - } - } - } - } - /** @type {Record} */ - const result = Object.create(null); - for (const [name, list] of lists) { - list.sort((a, b) => { - const cmp = b.order - a.order; - if (cmp !== 0) return cmp; - return a.group.compareTo(chunkGraph, b.group); - }); - /** @type {Set} */ - const chunkIdSet = new Set(); - for (const item of list) { - for (const chunk of item.group.chunks) { - if (filterFn && !filterFn(chunk, chunkGraph)) continue; - chunkIdSet.add(chunk.id); - } - } - if (chunkIdSet.size > 0) { - result[name] = Array.from(chunkIdSet); - } - } - return result; - } + // root node + if (!this.__current.path) { + return null; + } - /** - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {string} type option name - * @returns {{ onChunks: Chunk[], chunks: Set }[]} referenced chunks for a specific type - */ - getChildrenOfTypeInOrder(chunkGraph, type) { - const list = []; - for (const group of this.groupsIterable) { - for (const childGroup of group.childrenIterable) { - const order = childGroup.options[type]; - if (order === undefined) continue; - list.push({ - order, - group, - childGroup - }); - } - } - if (list.length === 0) return undefined; - list.sort((a, b) => { - const cmp = b.order - a.order; - if (cmp !== 0) return cmp; - return a.group.compareTo(chunkGraph, b.group); - }); - const result = []; - let lastEntry; - for (const { group, childGroup } of list) { - if (lastEntry && lastEntry.onChunks === group.chunks) { - for (const chunk of childGroup.chunks) { - lastEntry.chunks.add(chunk); - } - } else { - result.push( - (lastEntry = { - onChunks: group.chunks, - chunks: new Set(childGroup.chunks) - }) - ); - } - } - return result; - } - - /** - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {boolean=} includeDirectChildren include direct children (by default only children of async children are included) - * @param {ChunkFilterPredicate=} filterFn function used to filter chunks - * @returns {Record>} a record object of names to lists of child ids(?) by chunk id - */ - getChildIdsByOrdersMap(chunkGraph, includeDirectChildren, filterFn) { - /** @type {Record>} */ - const chunkMaps = Object.create(null); + // first node is sentinel, second node is root element + result = []; + for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { + element = this.__leavelist[i]; + addToPath(result, element.path); + } + addToPath(result, this.__current.path); + return result; + }; - /** - * @param {Chunk} chunk a chunk - * @returns {void} - */ - const addChildIdsByOrdersToMap = chunk => { - const data = chunk.getChildIdsByOrders(chunkGraph, filterFn); - for (const key of Object.keys(data)) { - let chunkMap = chunkMaps[key]; - if (chunkMap === undefined) { - chunkMaps[key] = chunkMap = Object.create(null); - } - chunkMap[chunk.id] = data[key]; - } - }; + // API: + // return type of current node + Controller.prototype.type = function () { + var node = this.current(); + return node.type || this.__current.wrap; + }; - if (includeDirectChildren) { - /** @type {Set} */ - const chunks = new Set(); - for (const chunkGroup of this.groupsIterable) { - for (const chunk of chunkGroup.chunks) { - chunks.add(chunk); - } - } - for (const chunk of chunks) { - addChildIdsByOrdersToMap(chunk); - } - } + // API: + // return array of parent elements + Controller.prototype.parents = function parents() { + var i, iz, result; - for (const chunk of this.getAllAsyncChunks()) { - addChildIdsByOrdersToMap(chunk); - } + // first node is sentinel + result = []; + for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { + result.push(this.__leavelist[i].node); + } - return chunkMaps; - } -} + return result; + }; -module.exports = Chunk; + // API: + // return current node + Controller.prototype.current = function current() { + return this.__current.node; + }; + Controller.prototype.__execute = function __execute(callback, element) { + var previous, result; -/***/ }), + result = undefined; -/***/ 64971: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + previous = this.__current; + this.__current = element; + this.__state = null; + if (callback) { + result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); + } + this.__current = previous; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + return result; + }; + // API: + // notify control skip / break + Controller.prototype.notify = function notify(flag) { + this.__state = flag; + }; + // API: + // skip child nodes of current node + Controller.prototype.skip = function () { + this.notify(SKIP); + }; -const util = __webpack_require__(73837); -const Entrypoint = __webpack_require__(13795); -const ModuleGraphConnection = __webpack_require__(40639); -const { first } = __webpack_require__(93347); -const SortableSet = __webpack_require__(13098); -const { - compareModulesById, - compareIterables, - compareModulesByIdentifier, - concatComparators, - compareSelect, - compareIds -} = __webpack_require__(29579); -const createHash = __webpack_require__(49835); -const findGraphRoots = __webpack_require__(6261); -const { - RuntimeSpecMap, - RuntimeSpecSet, - runtimeToString, - mergeRuntime, - forEachRuntime -} = __webpack_require__(17156); + // API: + // break traversals + Controller.prototype['break'] = function () { + this.notify(BREAK); + }; -/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGroup")} ChunkGroup */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./RuntimeModule")} RuntimeModule */ -/** @typedef {typeof import("./util/Hash")} Hash */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ + // API: + // remove node + Controller.prototype.remove = function () { + this.notify(REMOVE); + }; -/** @type {ReadonlySet} */ -const EMPTY_SET = new Set(); + Controller.prototype.__initialize = function(root, visitor) { + this.visitor = visitor; + this.root = root; + this.__worklist = []; + this.__leavelist = []; + this.__current = null; + this.__state = null; + this.__fallback = null; + if (visitor.fallback === 'iteration') { + this.__fallback = Object.keys; + } else if (typeof visitor.fallback === 'function') { + this.__fallback = visitor.fallback; + } -const ZERO_BIG_INT = BigInt(0); + this.__keys = VisitorKeys; + if (visitor.keys) { + this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); + } + }; -const compareModuleIterables = compareIterables(compareModulesByIdentifier); + function isNode(node) { + if (node == null) { + return false; + } + return typeof node === 'object' && typeof node.type === 'string'; + } -/** @typedef {(c: Chunk, chunkGraph: ChunkGraph) => boolean} ChunkFilterPredicate */ -/** @typedef {(m: Module) => boolean} ModuleFilterPredicate */ -/** @typedef {[Module, Entrypoint | undefined]} EntryModuleWithChunkGroup */ + function isProperty(nodeType, key) { + return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; + } -/** - * @typedef {Object} ChunkSizeOptions - * @property {number=} chunkOverhead constant overhead for a chunk - * @property {number=} entryChunkMultiplicator multiplicator for initial chunks - */ + Controller.prototype.traverse = function traverse(root, visitor) { + var worklist, + leavelist, + element, + node, + nodeType, + ret, + key, + current, + current2, + candidates, + candidate, + sentinel; -class ModuleHashInfo { - constructor(hash, renderedHash) { - this.hash = hash; - this.renderedHash = renderedHash; - } -} + this.__initialize(root, visitor); -/** @template T @typedef {(set: SortableSet) => T[]} SetToArrayFunction */ + sentinel = {}; -/** - * @template T - * @param {SortableSet} set the set - * @returns {T[]} set as array - */ -const getArray = set => { - return Array.from(set); -}; + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; -/** - * @param {SortableSet} chunks the chunks - * @returns {RuntimeSpecSet} runtimes - */ -const getModuleRuntimes = chunks => { - const runtimes = new RuntimeSpecSet(); - for (const chunk of chunks) { - runtimes.add(chunk.runtime); - } - return runtimes; -}; + // initialize + worklist.push(new Element(root, null, null, null)); + leavelist.push(new Element(null, null, null, null)); -/** - * @param {SortableSet} set the set - * @returns {Map>} modules by source type - */ -const modulesBySourceType = set => { - /** @type {Map>} */ - const map = new Map(); - for (const module of set) { - for (const sourceType of module.getSourceTypes()) { - let innerSet = map.get(sourceType); - if (innerSet === undefined) { - innerSet = new SortableSet(); - map.set(sourceType, innerSet); - } - innerSet.add(module); - } - } - for (const [key, innerSet] of map) { - // When all modules have the source type, we reuse the original SortableSet - // to benefit from the shared cache (especially for sorting) - if (innerSet.size === set.size) { - map.set(key, set); - } - } - return map; -}; + while (worklist.length) { + element = worklist.pop(); -/** @type {WeakMap} */ -const createOrderedArrayFunctionMap = new WeakMap(); + if (element === sentinel) { + element = leavelist.pop(); -/** - * @template T - * @param {function(T, T): -1|0|1} comparator comparator function - * @returns {SetToArrayFunction} set as ordered array - */ -const createOrderedArrayFunction = comparator => { - /** @type {SetToArrayFunction} */ - let fn = createOrderedArrayFunctionMap.get(comparator); - if (fn !== undefined) return fn; - fn = set => { - set.sortWith(comparator); - return Array.from(set); - }; - createOrderedArrayFunctionMap.set(comparator, fn); - return fn; -}; + ret = this.__execute(visitor.leave, element); -/** - * @param {Iterable} modules the modules to get the count/size of - * @returns {number} the size of the modules - */ -const getModulesSize = modules => { - let size = 0; - for (const module of modules) { - for (const type of module.getSourceTypes()) { - size += module.size(type); - } - } - return size; -}; + if (this.__state === BREAK || ret === BREAK) { + return; + } + continue; + } -/** - * @param {Iterable} modules the sortable Set to get the size of - * @returns {Record} the sizes of the modules - */ -const getModulesSizes = modules => { - let sizes = Object.create(null); - for (const module of modules) { - for (const type of module.getSourceTypes()) { - sizes[type] = (sizes[type] || 0) + module.size(type); - } - } - return sizes; -}; + if (element.node) { -/** - * @param {Chunk} a chunk - * @param {Chunk} b chunk - * @returns {boolean} true, if a is always a parent of b - */ -const isAvailableChunk = (a, b) => { - const queue = new Set(b.groupsIterable); - for (const chunkGroup of queue) { - if (a.isInGroup(chunkGroup)) continue; - if (chunkGroup.isInitial()) return false; - for (const parent of chunkGroup.parentsIterable) { - queue.add(parent); - } - } - return true; -}; + ret = this.__execute(visitor.enter, element); -class ChunkGraphModule { - constructor() { - /** @type {SortableSet} */ - this.chunks = new SortableSet(); - /** @type {Set | undefined} */ - this.entryInChunks = undefined; - /** @type {Set | undefined} */ - this.runtimeInChunks = undefined; - /** @type {RuntimeSpecMap} */ - this.hashes = undefined; - /** @type {string | number} */ - this.id = null; - /** @type {RuntimeSpecMap> | undefined} */ - this.runtimeRequirements = undefined; - /** @type {RuntimeSpecMap} */ - this.graphHashes = undefined; - /** @type {RuntimeSpecMap} */ - this.graphHashesWithConnections = undefined; - } -} + if (this.__state === BREAK || ret === BREAK) { + return; + } -class ChunkGraphChunk { - constructor() { - /** @type {SortableSet} */ - this.modules = new SortableSet(); - /** @type {Map} */ - this.entryModules = new Map(); - /** @type {SortableSet} */ - this.runtimeModules = new SortableSet(); - /** @type {Set | undefined} */ - this.fullHashModules = undefined; - /** @type {Set | undefined} */ - this.dependentHashModules = undefined; - /** @type {Set | undefined} */ - this.runtimeRequirements = undefined; - /** @type {Set} */ - this.runtimeRequirementsInTree = new Set(); - } -} + worklist.push(sentinel); + leavelist.push(element); -class ChunkGraph { - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {string | Hash} hashFunction the hash function to use - */ - constructor(moduleGraph, hashFunction = "md4") { - /** @private @type {WeakMap} */ - this._modules = new WeakMap(); - /** @private @type {WeakMap} */ - this._chunks = new WeakMap(); - /** @private @type {WeakMap} */ - this._blockChunkGroups = new WeakMap(); - /** @private @type {Map} */ - this._runtimeIds = new Map(); - /** @type {ModuleGraph} */ - this.moduleGraph = moduleGraph; + if (this.__state === SKIP || ret === SKIP) { + continue; + } - this._hashFunction = hashFunction; + node = element.node; + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } - this._getGraphRoots = this._getGraphRoots.bind(this); - } + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } - /** - * @private - * @param {Module} module the module - * @returns {ChunkGraphModule} internal module - */ - _getChunkGraphModule(module) { - let cgm = this._modules.get(module); - if (cgm === undefined) { - cgm = new ChunkGraphModule(); - this._modules.set(module, cgm); - } - return cgm; - } + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', null); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, null); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, null)); + } + } + } + } + }; - /** - * @private - * @param {Chunk} chunk the chunk - * @returns {ChunkGraphChunk} internal chunk - */ - _getChunkGraphChunk(chunk) { - let cgc = this._chunks.get(chunk); - if (cgc === undefined) { - cgc = new ChunkGraphChunk(); - this._chunks.set(chunk, cgc); - } - return cgc; - } + Controller.prototype.replace = function replace(root, visitor) { + var worklist, + leavelist, + node, + nodeType, + target, + element, + current, + current2, + candidates, + candidate, + sentinel, + outer, + key; - /** - * @param {SortableSet} set the sortable Set to get the roots of - * @returns {Module[]} the graph roots - */ - _getGraphRoots(set) { - const { moduleGraph } = this; - return Array.from( - findGraphRoots(set, module => { - /** @type {Set} */ - const set = new Set(); - const addDependencies = module => { - for (const connection of moduleGraph.getOutgoingConnections(module)) { - if (!connection.module) continue; - const activeState = connection.getActiveState(undefined); - if (activeState === false) continue; - if (activeState === ModuleGraphConnection.TRANSITIVE_ONLY) { - addDependencies(connection.module); - continue; - } - set.add(connection.module); - } - }; - addDependencies(module); - return set; - }) - ).sort(compareModulesByIdentifier); - } + function removeElem(element) { + var i, + key, + nextElem, + parent; - /** - * @param {Chunk} chunk the new chunk - * @param {Module} module the module - * @returns {void} - */ - connectChunkAndModule(chunk, module) { - const cgm = this._getChunkGraphModule(module); - const cgc = this._getChunkGraphChunk(chunk); - cgm.chunks.add(chunk); - cgc.modules.add(module); - } + if (element.ref.remove()) { + // When the reference is an element of an array. + key = element.ref.key; + parent = element.ref.parent; - /** - * @param {Chunk} chunk the chunk - * @param {Module} module the module - * @returns {void} - */ - disconnectChunkAndModule(chunk, module) { - const cgm = this._getChunkGraphModule(module); - const cgc = this._getChunkGraphChunk(chunk); - cgc.modules.delete(module); - cgm.chunks.delete(chunk); - } + // If removed from array, then decrease following items' keys. + i = worklist.length; + while (i--) { + nextElem = worklist[i]; + if (nextElem.ref && nextElem.ref.parent === parent) { + if (nextElem.ref.key < key) { + break; + } + --nextElem.ref.key; + } + } + } + } - /** - * @param {Chunk} chunk the chunk which will be disconnected - * @returns {void} - */ - disconnectChunk(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - for (const module of cgc.modules) { - const cgm = this._getChunkGraphModule(module); - cgm.chunks.delete(chunk); - } - cgc.modules.clear(); - chunk.disconnectFromGroups(); - ChunkGraph.clearChunkGraphForChunk(chunk); - } + this.__initialize(root, visitor); - /** - * @param {Chunk} chunk the chunk - * @param {Iterable} modules the modules - * @returns {void} - */ - attachModules(chunk, modules) { - const cgc = this._getChunkGraphChunk(chunk); - for (const module of modules) { - cgc.modules.add(module); - } - } + sentinel = {}; - /** - * @param {Chunk} chunk the chunk - * @param {Iterable} modules the runtime modules - * @returns {void} - */ - attachRuntimeModules(chunk, modules) { - const cgc = this._getChunkGraphChunk(chunk); - for (const module of modules) { - cgc.runtimeModules.add(module); - } - } + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; - /** - * @param {Chunk} chunk the chunk - * @param {Iterable} modules the modules that require a full hash - * @returns {void} - */ - attachFullHashModules(chunk, modules) { - const cgc = this._getChunkGraphChunk(chunk); - if (cgc.fullHashModules === undefined) cgc.fullHashModules = new Set(); - for (const module of modules) { - cgc.fullHashModules.add(module); - } - } + // initialize + outer = { + root: root + }; + element = new Element(root, null, null, new Reference(outer, 'root')); + worklist.push(element); + leavelist.push(element); - /** - * @param {Chunk} chunk the chunk - * @param {Iterable} modules the modules that require a full hash - * @returns {void} - */ - attachDependentHashModules(chunk, modules) { - const cgc = this._getChunkGraphChunk(chunk); - if (cgc.dependentHashModules === undefined) - cgc.dependentHashModules = new Set(); - for (const module of modules) { - cgc.dependentHashModules.add(module); - } - } + while (worklist.length) { + element = worklist.pop(); - /** - * @param {Module} oldModule the replaced module - * @param {Module} newModule the replacing module - * @returns {void} - */ - replaceModule(oldModule, newModule) { - const oldCgm = this._getChunkGraphModule(oldModule); - const newCgm = this._getChunkGraphModule(newModule); + if (element === sentinel) { + element = leavelist.pop(); - for (const chunk of oldCgm.chunks) { - const cgc = this._getChunkGraphChunk(chunk); - cgc.modules.delete(oldModule); - cgc.modules.add(newModule); - newCgm.chunks.add(chunk); - } - oldCgm.chunks.clear(); + target = this.__execute(visitor.leave, element); - if (oldCgm.entryInChunks !== undefined) { - if (newCgm.entryInChunks === undefined) { - newCgm.entryInChunks = new Set(); - } - for (const chunk of oldCgm.entryInChunks) { - const cgc = this._getChunkGraphChunk(chunk); - const old = cgc.entryModules.get(oldModule); - /** @type {Map} */ - const newEntryModules = new Map(); - for (const [m, cg] of cgc.entryModules) { - if (m === oldModule) { - newEntryModules.set(newModule, old); - } else { - newEntryModules.set(m, cg); - } - } - cgc.entryModules = newEntryModules; - newCgm.entryInChunks.add(chunk); - } - oldCgm.entryInChunks = undefined; - } + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + } - if (oldCgm.runtimeInChunks !== undefined) { - if (newCgm.runtimeInChunks === undefined) { - newCgm.runtimeInChunks = new Set(); - } - for (const chunk of oldCgm.runtimeInChunks) { - const cgc = this._getChunkGraphChunk(chunk); - cgc.runtimeModules.delete(/** @type {RuntimeModule} */ (oldModule)); - cgc.runtimeModules.add(/** @type {RuntimeModule} */ (newModule)); - newCgm.runtimeInChunks.add(chunk); - if ( - cgc.fullHashModules !== undefined && - cgc.fullHashModules.has(/** @type {RuntimeModule} */ (oldModule)) - ) { - cgc.fullHashModules.delete(/** @type {RuntimeModule} */ (oldModule)); - cgc.fullHashModules.add(/** @type {RuntimeModule} */ (newModule)); - } - if ( - cgc.dependentHashModules !== undefined && - cgc.dependentHashModules.has(/** @type {RuntimeModule} */ (oldModule)) - ) { - cgc.dependentHashModules.delete( - /** @type {RuntimeModule} */ (oldModule) - ); - cgc.dependentHashModules.add( - /** @type {RuntimeModule} */ (newModule) - ); - } - } - oldCgm.runtimeInChunks = undefined; - } - } + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + } - /** - * @param {Module} module the checked module - * @param {Chunk} chunk the checked chunk - * @returns {boolean} true, if the chunk contains the module - */ - isModuleInChunk(module, chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.modules.has(module); - } + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + continue; + } - /** - * @param {Module} module the checked module - * @param {ChunkGroup} chunkGroup the checked chunk group - * @returns {boolean} true, if the chunk contains the module - */ - isModuleInChunkGroup(module, chunkGroup) { - for (const chunk of chunkGroup.chunks) { - if (this.isModuleInChunk(module, chunk)) return true; - } - return false; - } + target = this.__execute(visitor.enter, element); - /** - * @param {Module} module the checked module - * @returns {boolean} true, if the module is entry of any chunk - */ - isEntryModule(module) { - const cgm = this._getChunkGraphModule(module); - return cgm.entryInChunks !== undefined; - } + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + element.node = target; + } - /** - * @param {Module} module the module - * @returns {Iterable} iterable of chunks (do not modify) - */ - getModuleChunksIterable(module) { - const cgm = this._getChunkGraphModule(module); - return cgm.chunks; - } + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + element.node = null; + } - /** - * @param {Module} module the module - * @param {function(Chunk, Chunk): -1|0|1} sortFn sort function - * @returns {Iterable} iterable of chunks (do not modify) - */ - getOrderedModuleChunksIterable(module, sortFn) { - const cgm = this._getChunkGraphModule(module); - cgm.chunks.sortWith(sortFn); - return cgm.chunks; - } + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } - /** - * @param {Module} module the module - * @returns {Chunk[]} array of chunks (cached, do not modify) - */ - getModuleChunks(module) { - const cgm = this._getChunkGraphModule(module); - return cgm.chunks.getFromCache(getArray); - } + // node may be null + node = element.node; + if (!node) { + continue; + } - /** - * @param {Module} module the module - * @returns {number} the number of chunk which contain the module - */ - getNumberOfModuleChunks(module) { - const cgm = this._getChunkGraphModule(module); - return cgm.chunks.size; - } + worklist.push(sentinel); + leavelist.push(element); - /** - * @param {Module} module the module - * @returns {RuntimeSpecSet} runtimes - */ - getModuleRuntimes(module) { - const cgm = this._getChunkGraphModule(module); - return cgm.chunks.getFromUnorderedCache(getModuleRuntimes); - } + if (this.__state === SKIP || target === SKIP) { + continue; + } - /** - * @param {Chunk} chunk the chunk - * @returns {number} the number of modules which are contained in this chunk - */ - getNumberOfChunkModules(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.modules.size; - } + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } - /** - * @param {Chunk} chunk the chunk - * @returns {number} the number of full hash modules which are contained in this chunk - */ - getNumberOfChunkFullHashModules(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.fullHashModules === undefined ? 0 : cgc.fullHashModules.size; - } + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } - /** - * @param {Chunk} chunk the chunk - * @returns {Iterable} return the modules for this chunk - */ - getChunkModulesIterable(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.modules; - } + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, new Reference(node, key))); + } + } + } - /** - * @param {Chunk} chunk the chunk - * @param {string} sourceType source type - * @returns {Iterable | undefined} return the modules for this chunk - */ - getChunkModulesIterableBySourceType(chunk, sourceType) { - const cgc = this._getChunkGraphChunk(chunk); - const modulesWithSourceType = cgc.modules - .getFromUnorderedCache(modulesBySourceType) - .get(sourceType); - return modulesWithSourceType; - } + return outer.root; + }; - /** - * @param {Chunk} chunk the chunk - * @param {function(Module, Module): -1|0|1} comparator comparator function - * @returns {Iterable} return the modules for this chunk - */ - getOrderedChunkModulesIterable(chunk, comparator) { - const cgc = this._getChunkGraphChunk(chunk); - cgc.modules.sortWith(comparator); - return cgc.modules; - } + function traverse(root, visitor) { + var controller = new Controller(); + return controller.traverse(root, visitor); + } - /** - * @param {Chunk} chunk the chunk - * @param {string} sourceType source type - * @param {function(Module, Module): -1|0|1} comparator comparator function - * @returns {Iterable | undefined} return the modules for this chunk - */ - getOrderedChunkModulesIterableBySourceType(chunk, sourceType, comparator) { - const cgc = this._getChunkGraphChunk(chunk); - const modulesWithSourceType = cgc.modules - .getFromUnorderedCache(modulesBySourceType) - .get(sourceType); - if (modulesWithSourceType === undefined) return undefined; - modulesWithSourceType.sortWith(comparator); - return modulesWithSourceType; - } + function replace(root, visitor) { + var controller = new Controller(); + return controller.replace(root, visitor); + } - /** - * @param {Chunk} chunk the chunk - * @returns {Module[]} return the modules for this chunk (cached, do not modify) - */ - getChunkModules(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.modules.getFromUnorderedCache(getArray); - } + function extendCommentRange(comment, tokens) { + var target; - /** - * @param {Chunk} chunk the chunk - * @param {function(Module, Module): -1|0|1} comparator comparator function - * @returns {Module[]} return the modules for this chunk (cached, do not modify) - */ - getOrderedChunkModules(chunk, comparator) { - const cgc = this._getChunkGraphChunk(chunk); - const arrayFunction = createOrderedArrayFunction(comparator); - return cgc.modules.getFromUnorderedCache(arrayFunction); - } + target = upperBound(tokens, function search(token) { + return token.range[0] > comment.range[0]; + }); - /** - * @param {Chunk} chunk the chunk - * @param {ModuleFilterPredicate} filterFn function used to filter modules - * @param {boolean} includeAllChunks all chunks or only async chunks - * @returns {Record} chunk to module ids object - */ - getChunkModuleIdMap(chunk, filterFn, includeAllChunks = false) { - /** @type {Record} */ - const chunkModuleIdMap = Object.create(null); + comment.extendedRange = [comment.range[0], comment.range[1]]; - for (const asyncChunk of includeAllChunks - ? chunk.getAllReferencedChunks() - : chunk.getAllAsyncChunks()) { - /** @type {(string|number)[]} */ - let array; - for (const module of this.getOrderedChunkModulesIterable( - asyncChunk, - compareModulesById(this) - )) { - if (filterFn(module)) { - if (array === undefined) { - array = []; - chunkModuleIdMap[asyncChunk.id] = array; - } - const moduleId = this.getModuleId(module); - array.push(moduleId); - } - } - } + if (target !== tokens.length) { + comment.extendedRange[1] = tokens[target].range[0]; + } - return chunkModuleIdMap; - } + target -= 1; + if (target >= 0) { + comment.extendedRange[0] = tokens[target].range[1]; + } - /** - * @param {Chunk} chunk the chunk - * @param {ModuleFilterPredicate} filterFn function used to filter modules - * @param {number} hashLength length of the hash - * @param {boolean} includeAllChunks all chunks or only async chunks - * @returns {Record>} chunk to module id to module hash object - */ - getChunkModuleRenderedHashMap( - chunk, - filterFn, - hashLength = 0, - includeAllChunks = false - ) { - /** @type {Record>} */ - const chunkModuleHashMap = Object.create(null); + return comment; + } - for (const asyncChunk of includeAllChunks - ? chunk.getAllReferencedChunks() - : chunk.getAllAsyncChunks()) { - /** @type {Record} */ - let idToHashMap; - for (const module of this.getOrderedChunkModulesIterable( - asyncChunk, - compareModulesById(this) - )) { - if (filterFn(module)) { - if (idToHashMap === undefined) { - idToHashMap = Object.create(null); - chunkModuleHashMap[asyncChunk.id] = idToHashMap; - } - const moduleId = this.getModuleId(module); - const hash = this.getRenderedModuleHash(module, asyncChunk.runtime); - idToHashMap[moduleId] = hashLength ? hash.slice(0, hashLength) : hash; - } - } - } + function attachComments(tree, providedComments, tokens) { + // At first, we should calculate extended comment ranges. + var comments = [], comment, len, i, cursor; - return chunkModuleHashMap; - } + if (!tree.range) { + throw new Error('attachComments needs range information'); + } - /** - * @param {Chunk} chunk the chunk - * @param {ChunkFilterPredicate} filterFn function used to filter chunks - * @returns {Record} chunk map - */ - getChunkConditionMap(chunk, filterFn) { - const map = Object.create(null); - for (const c of chunk.getAllReferencedChunks()) { - map[c.id] = filterFn(c, this); - } - return map; - } - - /** - * @param {Chunk} chunk the chunk - * @param {ModuleFilterPredicate} filterFn predicate function used to filter modules - * @param {ChunkFilterPredicate=} filterChunkFn predicate function used to filter chunks - * @returns {boolean} return true if module exists in graph - */ - hasModuleInGraph(chunk, filterFn, filterChunkFn) { - const queue = new Set(chunk.groupsIterable); - const chunksProcessed = new Set(); + // tokens array is empty, we attach comments to tree as 'leadingComments' + if (!tokens.length) { + if (providedComments.length) { + for (i = 0, len = providedComments.length; i < len; i += 1) { + comment = deepCopy(providedComments[i]); + comment.extendedRange = [0, tree.range[0]]; + comments.push(comment); + } + tree.leadingComments = comments; + } + return tree; + } - for (const chunkGroup of queue) { - for (const innerChunk of chunkGroup.chunks) { - if (!chunksProcessed.has(innerChunk)) { - chunksProcessed.add(innerChunk); - if (!filterChunkFn || filterChunkFn(innerChunk, this)) { - for (const module of this.getChunkModulesIterable(innerChunk)) { - if (filterFn(module)) { - return true; - } - } - } - } - } - for (const child of chunkGroup.childrenIterable) { - queue.add(child); - } - } - return false; - } + for (i = 0, len = providedComments.length; i < len; i += 1) { + comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); + } - /** - * @param {Chunk} chunkA first chunk - * @param {Chunk} chunkB second chunk - * @returns {-1|0|1} this is a comparator function like sort and returns -1, 0, or 1 based on sort order - */ - compareChunks(chunkA, chunkB) { - const cgcA = this._getChunkGraphChunk(chunkA); - const cgcB = this._getChunkGraphChunk(chunkB); - if (cgcA.modules.size > cgcB.modules.size) return -1; - if (cgcA.modules.size < cgcB.modules.size) return 1; - cgcA.modules.sortWith(compareModulesByIdentifier); - cgcB.modules.sortWith(compareModulesByIdentifier); - return compareModuleIterables(cgcA.modules, cgcB.modules); - } + // This is based on John Freeman's implementation. + cursor = 0; + traverse(tree, { + enter: function (node) { + var comment; - /** - * @param {Chunk} chunk the chunk - * @returns {number} total size of all modules in the chunk - */ - getChunkModulesSize(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.modules.getFromUnorderedCache(getModulesSize); - } + while (cursor < comments.length) { + comment = comments[cursor]; + if (comment.extendedRange[1] > node.range[0]) { + break; + } - /** - * @param {Chunk} chunk the chunk - * @returns {Record} total sizes of all modules in the chunk by source type - */ - getChunkModulesSizes(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.modules.getFromUnorderedCache(getModulesSizes); - } + if (comment.extendedRange[1] === node.range[0]) { + if (!node.leadingComments) { + node.leadingComments = []; + } + node.leadingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } - /** - * @param {Chunk} chunk the chunk - * @returns {Module[]} root modules of the chunks (ordered by identifier) - */ - getChunkRootModules(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.modules.getFromUnorderedCache(this._getGraphRoots); - } + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } - /** - * @param {Chunk} chunk the chunk - * @param {ChunkSizeOptions} options options object - * @returns {number} total size of the chunk - */ - getChunkSize(chunk, options = {}) { - const cgc = this._getChunkGraphChunk(chunk); - const modulesSize = cgc.modules.getFromUnorderedCache(getModulesSize); - const chunkOverhead = - typeof options.chunkOverhead === "number" ? options.chunkOverhead : 10000; - const entryChunkMultiplicator = - typeof options.entryChunkMultiplicator === "number" - ? options.entryChunkMultiplicator - : 10; - return ( - chunkOverhead + - modulesSize * (chunk.canBeInitial() ? entryChunkMultiplicator : 1) - ); - } + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); - /** - * @param {Chunk} chunkA chunk - * @param {Chunk} chunkB chunk - * @param {ChunkSizeOptions} options options object - * @returns {number} total size of the chunk or false if chunks can't be integrated - */ - getIntegratedChunksSize(chunkA, chunkB, options = {}) { - const cgcA = this._getChunkGraphChunk(chunkA); - const cgcB = this._getChunkGraphChunk(chunkB); - const allModules = new Set(cgcA.modules); - for (const m of cgcB.modules) allModules.add(m); - let modulesSize = getModulesSize(allModules); - const chunkOverhead = - typeof options.chunkOverhead === "number" ? options.chunkOverhead : 10000; - const entryChunkMultiplicator = - typeof options.entryChunkMultiplicator === "number" - ? options.entryChunkMultiplicator - : 10; - return ( - chunkOverhead + - modulesSize * - (chunkA.canBeInitial() || chunkB.canBeInitial() - ? entryChunkMultiplicator - : 1) - ); - } + cursor = 0; + traverse(tree, { + leave: function (node) { + var comment; - /** - * @param {Chunk} chunkA chunk - * @param {Chunk} chunkB chunk - * @returns {boolean} true, if chunks could be integrated - */ - canChunksBeIntegrated(chunkA, chunkB) { - if (chunkA.preventIntegration || chunkB.preventIntegration) { - return false; - } + while (cursor < comments.length) { + comment = comments[cursor]; + if (node.range[1] < comment.extendedRange[0]) { + break; + } - const hasRuntimeA = chunkA.hasRuntime(); - const hasRuntimeB = chunkB.hasRuntime(); + if (node.range[1] === comment.extendedRange[0]) { + if (!node.trailingComments) { + node.trailingComments = []; + } + node.trailingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } - if (hasRuntimeA !== hasRuntimeB) { - if (hasRuntimeA) { - return isAvailableChunk(chunkA, chunkB); - } else if (hasRuntimeB) { - return isAvailableChunk(chunkB, chunkA); - } else { - return false; - } - } + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } - if ( - this.getNumberOfEntryModules(chunkA) > 0 || - this.getNumberOfEntryModules(chunkB) > 0 - ) { - return false; - } + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); - return true; - } + return tree; + } - /** - * @param {Chunk} chunkA the target chunk - * @param {Chunk} chunkB the chunk to integrate - * @returns {void} - */ - integrateChunks(chunkA, chunkB) { - // Decide for one name (deterministic) - if (chunkA.name && chunkB.name) { - if ( - this.getNumberOfEntryModules(chunkA) > 0 === - this.getNumberOfEntryModules(chunkB) > 0 - ) { - // When both chunks have entry modules or none have one, use - // shortest name - if (chunkA.name.length !== chunkB.name.length) { - chunkA.name = - chunkA.name.length < chunkB.name.length ? chunkA.name : chunkB.name; - } else { - chunkA.name = chunkA.name < chunkB.name ? chunkA.name : chunkB.name; - } - } else if (this.getNumberOfEntryModules(chunkB) > 0) { - // Pick the name of the chunk with the entry module - chunkA.name = chunkB.name; - } - } else if (chunkB.name) { - chunkA.name = chunkB.name; - } + exports.version = (__webpack_require__(15535)/* .version */ .i8); + exports.Syntax = Syntax; + exports.traverse = traverse; + exports.replace = replace; + exports.attachComments = attachComments; + exports.VisitorKeys = VisitorKeys; + exports.VisitorOption = VisitorOption; + exports.Controller = Controller; + exports.cloneEnvironment = function () { return clone({}); }; - // Merge id name hints - for (const hint of chunkB.idNameHints) { - chunkA.idNameHints.add(hint); - } + return exports; +}(exports)); +/* vim: set sw=4 ts=4 et tw=80 : */ - // Merge runtime - chunkA.runtime = mergeRuntime(chunkA.runtime, chunkB.runtime); - // getChunkModules is used here to create a clone, because disconnectChunkAndModule modifies - for (const module of this.getChunkModules(chunkB)) { - this.disconnectChunkAndModule(chunkB, module); - this.connectChunkAndModule(chunkA, module); - } +/***/ }), - for (const [module, chunkGroup] of Array.from( - this.getChunkEntryModulesWithChunkGroupIterable(chunkB) - )) { - this.disconnectChunkAndEntryModule(chunkB, module); - this.connectChunkAndEntryModule(chunkA, module, chunkGroup); - } +/***/ 86140: +/***/ (function(module) { - for (const chunkGroup of chunkB.groupsIterable) { - chunkGroup.replaceChunk(chunkB, chunkA); - chunkA.addGroup(chunkGroup); - chunkB.removeGroup(chunkGroup); - } - ChunkGraph.clearChunkGraphForChunk(chunkB); - } +module.exports = function (glob, opts) { + if (typeof glob !== 'string') { + throw new TypeError('Expected a string'); + } - /** - * @param {Chunk} chunk the chunk to upgrade - * @returns {void} - */ - upgradeDependentToFullHashModules(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - if (cgc.dependentHashModules === undefined) return; - if (cgc.fullHashModules === undefined) { - cgc.fullHashModules = cgc.dependentHashModules; - } else { - for (const m of cgc.dependentHashModules) { - cgc.fullHashModules.add(m); - } - cgc.dependentHashModules = undefined; - } - } + var str = String(glob); - /** - * @param {Module} module the checked module - * @param {Chunk} chunk the checked chunk - * @returns {boolean} true, if the chunk contains the module as entry - */ - isEntryModuleInChunk(module, chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.entryModules.has(module); - } + // The regexp we are building, as a string. + var reStr = ""; - /** - * @param {Chunk} chunk the new chunk - * @param {Module} module the entry module - * @param {Entrypoint=} entrypoint the chunk group which must be loaded before the module is executed - * @returns {void} - */ - connectChunkAndEntryModule(chunk, module, entrypoint) { - const cgm = this._getChunkGraphModule(module); - const cgc = this._getChunkGraphChunk(chunk); - if (cgm.entryInChunks === undefined) { - cgm.entryInChunks = new Set(); - } - cgm.entryInChunks.add(chunk); - cgc.entryModules.set(module, entrypoint); - } + // Whether we are matching so called "extended" globs (like bash) and should + // support single character matching, matching ranges of characters, group + // matching, etc. + var extended = opts ? !!opts.extended : false; - /** - * @param {Chunk} chunk the new chunk - * @param {RuntimeModule} module the runtime module - * @returns {void} - */ - connectChunkAndRuntimeModule(chunk, module) { - const cgm = this._getChunkGraphModule(module); - const cgc = this._getChunkGraphChunk(chunk); - if (cgm.runtimeInChunks === undefined) { - cgm.runtimeInChunks = new Set(); - } - cgm.runtimeInChunks.add(chunk); - cgc.runtimeModules.add(module); - } + // When globstar is _false_ (default), '/foo/*' is translated a regexp like + // '^\/foo\/.*$' which will match any string beginning with '/foo/' + // When globstar is _true_, '/foo/*' is translated to regexp like + // '^\/foo\/[^/]*$' which will match any string beginning with '/foo/' BUT + // which does not have a '/' to the right of it. + // E.g. with '/foo/*' these will match: '/foo/bar', '/foo/bar.txt' but + // these will not '/foo/bar/baz', '/foo/bar/baz.txt' + // Lastely, when globstar is _true_, '/foo/**' is equivelant to '/foo/*' when + // globstar is _false_ + var globstar = opts ? !!opts.globstar : false; - /** - * @param {Chunk} chunk the new chunk - * @param {RuntimeModule} module the module that require a full hash - * @returns {void} - */ - addFullHashModuleToChunk(chunk, module) { - const cgc = this._getChunkGraphChunk(chunk); - if (cgc.fullHashModules === undefined) cgc.fullHashModules = new Set(); - cgc.fullHashModules.add(module); - } + // If we are doing extended matching, this boolean is true when we are inside + // a group (eg {*.html,*.js}), and false otherwise. + var inGroup = false; - /** - * @param {Chunk} chunk the new chunk - * @param {RuntimeModule} module the module that require a full hash - * @returns {void} - */ - addDependentHashModuleToChunk(chunk, module) { - const cgc = this._getChunkGraphChunk(chunk); - if (cgc.dependentHashModules === undefined) - cgc.dependentHashModules = new Set(); - cgc.dependentHashModules.add(module); - } + // RegExp flags (eg "i" ) to pass in to RegExp constructor. + var flags = opts && typeof( opts.flags ) === "string" ? opts.flags : ""; - /** - * @param {Chunk} chunk the new chunk - * @param {Module} module the entry module - * @returns {void} - */ - disconnectChunkAndEntryModule(chunk, module) { - const cgm = this._getChunkGraphModule(module); - const cgc = this._getChunkGraphChunk(chunk); - cgm.entryInChunks.delete(chunk); - if (cgm.entryInChunks.size === 0) { - cgm.entryInChunks = undefined; - } - cgc.entryModules.delete(module); - } + var c; + for (var i = 0, len = str.length; i < len; i++) { + c = str[i]; - /** - * @param {Chunk} chunk the new chunk - * @param {RuntimeModule} module the runtime module - * @returns {void} - */ - disconnectChunkAndRuntimeModule(chunk, module) { - const cgm = this._getChunkGraphModule(module); - const cgc = this._getChunkGraphChunk(chunk); - cgm.runtimeInChunks.delete(chunk); - if (cgm.runtimeInChunks.size === 0) { - cgm.runtimeInChunks = undefined; - } - cgc.runtimeModules.delete(module); - } + switch (c) { + case "/": + case "$": + case "^": + case "+": + case ".": + case "(": + case ")": + case "=": + case "!": + case "|": + reStr += "\\" + c; + break; - /** - * @param {Module} module the entry module, it will no longer be entry - * @returns {void} - */ - disconnectEntryModule(module) { - const cgm = this._getChunkGraphModule(module); - for (const chunk of cgm.entryInChunks) { - const cgc = this._getChunkGraphChunk(chunk); - cgc.entryModules.delete(module); - } - cgm.entryInChunks = undefined; - } + case "?": + if (extended) { + reStr += "."; + break; + } - /** - * @param {Chunk} chunk the chunk, for which all entries will be removed - * @returns {void} - */ - disconnectEntries(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - for (const module of cgc.entryModules.keys()) { - const cgm = this._getChunkGraphModule(module); - cgm.entryInChunks.delete(chunk); - if (cgm.entryInChunks.size === 0) { - cgm.entryInChunks = undefined; - } - } - cgc.entryModules.clear(); - } + case "[": + case "]": + if (extended) { + reStr += c; + break; + } - /** - * @param {Chunk} chunk the chunk - * @returns {number} the amount of entry modules in chunk - */ - getNumberOfEntryModules(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.entryModules.size; - } + case "{": + if (extended) { + inGroup = true; + reStr += "("; + break; + } - /** - * @param {Chunk} chunk the chunk - * @returns {number} the amount of entry modules in chunk - */ - getNumberOfRuntimeModules(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.runtimeModules.size; - } + case "}": + if (extended) { + inGroup = false; + reStr += ")"; + break; + } - /** - * @param {Chunk} chunk the chunk - * @returns {Iterable} iterable of modules (do not modify) - */ - getChunkEntryModulesIterable(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.entryModules.keys(); - } + case ",": + if (inGroup) { + reStr += "|"; + break; + } + reStr += "\\" + c; + break; - /** - * @param {Chunk} chunk the chunk - * @returns {Iterable} iterable of chunks - */ - getChunkEntryDependentChunksIterable(chunk) { - /** @type {Set} */ - const set = new Set(); - for (const chunkGroup of chunk.groupsIterable) { - if (chunkGroup instanceof Entrypoint) { - const entrypointChunk = chunkGroup.getEntrypointChunk(); - const cgc = this._getChunkGraphChunk(entrypointChunk); - for (const chunkGroup of cgc.entryModules.values()) { - for (const c of chunkGroup.chunks) { - if (c !== chunk && c !== entrypointChunk && !c.hasRuntime()) { - set.add(c); - } - } - } - } - } + case "*": + // Move over all consecutive "*"'s. + // Also store the previous and next characters + var prevChar = str[i - 1]; + var starCount = 1; + while(str[i + 1] === "*") { + starCount++; + i++; + } + var nextChar = str[i + 1]; - return set; - } + if (!globstar) { + // globstar is disabled, so treat any number of "*" as one + reStr += ".*"; + } else { + // globstar is enabled, so determine if this is a globstar segment + var isGlobstar = starCount > 1 // multiple "*"'s + && (prevChar === "/" || prevChar === undefined) // from the start of the segment + && (nextChar === "/" || nextChar === undefined) // to the end of the segment - /** - * @param {Chunk} chunk the chunk - * @returns {boolean} true, when it has dependent chunks - */ - hasChunkEntryDependentChunks(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - for (const chunkGroup of cgc.entryModules.values()) { - for (const c of chunkGroup.chunks) { - if (c !== chunk) { - return true; - } - } - } - return false; - } + if (isGlobstar) { + // it's a globstar, so match zero or more path segments + reStr += "((?:[^/]*(?:\/|$))*)"; + i++; // move over the "/" + } else { + // it's not a globstar, so only match one path segment + reStr += "([^/]*)"; + } + } + break; - /** - * @param {Chunk} chunk the chunk - * @returns {Iterable} iterable of modules (do not modify) - */ - getChunkRuntimeModulesIterable(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.runtimeModules; - } + default: + reStr += c; + } + } - /** - * @param {Chunk} chunk the chunk - * @returns {RuntimeModule[]} array of modules in order of execution - */ - getChunkRuntimeModulesInOrder(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - const array = Array.from(cgc.runtimeModules); - array.sort( - concatComparators( - compareSelect( - /** - * @param {RuntimeModule} r runtime module - * @returns {number=} stage - */ - r => r.stage, - compareIds - ), - compareModulesByIdentifier - ) - ); - return array; - } + // When regexp 'g' flag is specified don't + // constrain the regular expression with ^ & $ + if (!flags || !~flags.indexOf('g')) { + reStr = "^" + reStr + "$"; + } - /** - * @param {Chunk} chunk the chunk - * @returns {Iterable | undefined} iterable of modules (do not modify) - */ - getChunkFullHashModulesIterable(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.fullHashModules; - } + return new RegExp(reStr, flags); +}; - /** - * @param {Chunk} chunk the chunk - * @returns {ReadonlySet | undefined} set of modules (do not modify) - */ - getChunkFullHashModulesSet(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.fullHashModules; - } - /** - * @param {Chunk} chunk the chunk - * @returns {Iterable | undefined} iterable of modules (do not modify) - */ - getChunkDependentHashModulesIterable(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.dependentHashModules; - } +/***/ }), - /** - * @param {Chunk} chunk the chunk - * @returns {Iterable} iterable of modules (do not modify) - */ - getChunkEntryModulesWithChunkGroupIterable(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.entryModules; - } +/***/ 89132: +/***/ (function(module) { - /** - * @param {AsyncDependenciesBlock} depBlock the async block - * @returns {ChunkGroup} the chunk group - */ - getBlockChunkGroup(depBlock) { - return this._blockChunkGroups.get(depBlock); - } +"use strict"; - /** - * @param {AsyncDependenciesBlock} depBlock the async block - * @param {ChunkGroup} chunkGroup the chunk group - * @returns {void} - */ - connectBlockAndChunkGroup(depBlock, chunkGroup) { - this._blockChunkGroups.set(depBlock, chunkGroup); - chunkGroup.addBlock(depBlock); - } - /** - * @param {ChunkGroup} chunkGroup the chunk group - * @returns {void} - */ - disconnectChunkGroup(chunkGroup) { - for (const block of chunkGroup.blocksIterable) { - this._blockChunkGroups.delete(block); - } - // TODO refactor by moving blocks list into ChunkGraph - chunkGroup._blocks.clear(); - } +module.exports = clone - /** - * @param {Module} module the module - * @returns {string | number} the id of the module - */ - getModuleId(module) { - const cgm = this._getChunkGraphModule(module); - return cgm.id; - } +var getPrototypeOf = Object.getPrototypeOf || function (obj) { + return obj.__proto__ +} - /** - * @param {Module} module the module - * @param {string | number} id the id of the module - * @returns {void} - */ - setModuleId(module, id) { - const cgm = this._getChunkGraphModule(module); - cgm.id = id; - } +function clone (obj) { + if (obj === null || typeof obj !== 'object') + return obj - /** - * @param {string} runtime runtime - * @returns {string | number} the id of the runtime - */ - getRuntimeId(runtime) { - return this._runtimeIds.get(runtime); - } + if (obj instanceof Object) + var copy = { __proto__: getPrototypeOf(obj) } + else + var copy = Object.create(null) - /** - * @param {string} runtime runtime - * @param {string | number} id the id of the runtime - * @returns {void} - */ - setRuntimeId(runtime, id) { - this._runtimeIds.set(runtime, id); - } + Object.getOwnPropertyNames(obj).forEach(function (key) { + Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) + }) - /** - * @template T - * @param {Module} module the module - * @param {RuntimeSpecMap} hashes hashes data - * @param {RuntimeSpec} runtime the runtime - * @returns {T} hash - */ - _getModuleHashInfo(module, hashes, runtime) { - if (!hashes) { - throw new Error( - `Module ${module.identifier()} has no hash info for runtime ${runtimeToString( - runtime - )} (hashes not set at all)` - ); - } else if (runtime === undefined) { - const hashInfoItems = new Set(hashes.values()); - if (hashInfoItems.size !== 1) { - throw new Error( - `No unique hash info entry for unspecified runtime for ${module.identifier()} (existing runtimes: ${Array.from( - hashes.keys(), - r => runtimeToString(r) - ).join(", ")}). -Caller might not support runtime-dependent code generation (opt-out via optimization.usedExports: "global").` - ); - } - return first(hashInfoItems); - } else { - const hashInfo = hashes.get(runtime); - if (!hashInfo) { - throw new Error( - `Module ${module.identifier()} has no hash info for runtime ${runtimeToString( - runtime - )} (available runtimes ${Array.from( - hashes.keys(), - runtimeToString - ).join(", ")})` - ); - } - return hashInfo; - } - } + return copy +} - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true, if the module has hashes for this runtime - */ - hasModuleHashes(module, runtime) { - const cgm = this._getChunkGraphModule(module); - const hashes = cgm.hashes; - return hashes && hashes.has(runtime); - } - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @returns {string} hash - */ - getModuleHash(module, runtime) { - const cgm = this._getChunkGraphModule(module); - const hashes = cgm.hashes; - return this._getModuleHashInfo(module, hashes, runtime).hash; - } +/***/ }), - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @returns {string} hash - */ - getRenderedModuleHash(module, runtime) { - const cgm = this._getChunkGraphModule(module); - const hashes = cgm.hashes; - return this._getModuleHashInfo(module, hashes, runtime).renderedHash; - } +/***/ 90552: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @param {string} hash the full hash - * @param {string} renderedHash the shortened hash for rendering - * @returns {void} - */ - setModuleHashes(module, runtime, hash, renderedHash) { - const cgm = this._getChunkGraphModule(module); - if (cgm.hashes === undefined) { - cgm.hashes = new RuntimeSpecMap(); - } - cgm.hashes.set(runtime, new ModuleHashInfo(hash, renderedHash)); - } +var fs = __webpack_require__(57147) +var polyfills = __webpack_require__(11290) +var legacy = __webpack_require__(54410) +var clone = __webpack_require__(89132) - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @param {Set} items runtime requirements to be added (ownership of this Set is given to ChunkGraph when transferOwnership not false) - * @param {boolean} transferOwnership true: transfer ownership of the items object, false: items is immutable and shared and won't be modified - * @returns {void} - */ - addModuleRuntimeRequirements( - module, - runtime, - items, - transferOwnership = true - ) { - const cgm = this._getChunkGraphModule(module); - const runtimeRequirementsMap = cgm.runtimeRequirements; - if (runtimeRequirementsMap === undefined) { - const map = new RuntimeSpecMap(); - // TODO avoid cloning item and track ownership instead - map.set(runtime, transferOwnership ? items : new Set(items)); - cgm.runtimeRequirements = map; - return; - } - runtimeRequirementsMap.update(runtime, runtimeRequirements => { - if (runtimeRequirements === undefined) { - return transferOwnership ? items : new Set(items); - } else if (!transferOwnership || runtimeRequirements.size >= items.size) { - for (const item of items) runtimeRequirements.add(item); - return runtimeRequirements; - } else { - for (const item of runtimeRequirements) items.add(item); - return items; - } - }); - } +var util = __webpack_require__(73837) - /** - * @param {Chunk} chunk the chunk - * @param {Set} items runtime requirements to be added (ownership of this Set is given to ChunkGraph) - * @returns {void} - */ - addChunkRuntimeRequirements(chunk, items) { - const cgc = this._getChunkGraphChunk(chunk); - const runtimeRequirements = cgc.runtimeRequirements; - if (runtimeRequirements === undefined) { - cgc.runtimeRequirements = items; - } else if (runtimeRequirements.size >= items.size) { - for (const item of items) runtimeRequirements.add(item); - } else { - for (const item of runtimeRequirements) items.add(item); - cgc.runtimeRequirements = items; - } - } +/* istanbul ignore next - node 0.x polyfill */ +var gracefulQueue +var previousSymbol - /** - * @param {Chunk} chunk the chunk - * @param {Iterable} items runtime requirements to be added - * @returns {void} - */ - addTreeRuntimeRequirements(chunk, items) { - const cgc = this._getChunkGraphChunk(chunk); - const runtimeRequirements = cgc.runtimeRequirementsInTree; - for (const item of items) runtimeRequirements.add(item); - } +/* istanbul ignore else - node 0.x polyfill */ +if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { + gracefulQueue = Symbol.for('graceful-fs.queue') + // This is used in testing by future versions + previousSymbol = Symbol.for('graceful-fs.previous') +} else { + gracefulQueue = '___graceful-fs.queue' + previousSymbol = '___graceful-fs.previous' +} - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @returns {ReadonlySet} runtime requirements - */ - getModuleRuntimeRequirements(module, runtime) { - const cgm = this._getChunkGraphModule(module); - const runtimeRequirements = - cgm.runtimeRequirements && cgm.runtimeRequirements.get(runtime); - return runtimeRequirements === undefined ? EMPTY_SET : runtimeRequirements; - } +function noop () {} - /** - * @param {Chunk} chunk the chunk - * @returns {ReadonlySet} runtime requirements - */ - getChunkRuntimeRequirements(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - const runtimeRequirements = cgc.runtimeRequirements; - return runtimeRequirements === undefined ? EMPTY_SET : runtimeRequirements; - } +function publishQueue(context, queue) { + Object.defineProperty(context, gracefulQueue, { + get: function() { + return queue + } + }) +} - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @param {boolean} withConnections include connections - * @returns {string} hash - */ - getModuleGraphHash(module, runtime, withConnections = true) { - const cgm = this._getChunkGraphModule(module); - return withConnections - ? this._getModuleGraphHashWithConnections(cgm, module, runtime) - : this._getModuleGraphHashBigInt(cgm, module, runtime).toString(16); - } +var debug = noop +if (util.debuglog) + debug = util.debuglog('gfs4') +else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) + debug = function() { + var m = util.format.apply(util, arguments) + m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') + console.error(m) + } - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @param {boolean} withConnections include connections - * @returns {bigint} hash - */ - getModuleGraphHashBigInt(module, runtime, withConnections = true) { - const cgm = this._getChunkGraphModule(module); - return withConnections - ? BigInt( - `0x${this._getModuleGraphHashWithConnections(cgm, module, runtime)}` - ) - : this._getModuleGraphHashBigInt(cgm, module, runtime); - } +// Once time initialization +if (!fs[gracefulQueue]) { + // This queue can be shared by multiple loaded instances + var queue = global[gracefulQueue] || [] + publishQueue(fs, queue) - /** - * @param {ChunkGraphModule} cgm the ChunkGraphModule - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @returns {bigint} hash as big int - */ - _getModuleGraphHashBigInt(cgm, module, runtime) { - if (cgm.graphHashes === undefined) { - cgm.graphHashes = new RuntimeSpecMap(); - } - const graphHash = cgm.graphHashes.provide(runtime, () => { - const hash = createHash(this._hashFunction); - hash.update(`${cgm.id}${this.moduleGraph.isAsync(module)}`); - this.moduleGraph.getExportsInfo(module).updateHash(hash, runtime); - return BigInt(`0x${/** @type {string} */ (hash.digest("hex"))}`); - }); - return graphHash; - } + // Patch fs.close/closeSync to shared queue version, because we need + // to retry() whenever a close happens *anywhere* in the program. + // This is essential when multiple graceful-fs instances are + // in play at the same time. + fs.close = (function (fs$close) { + function close (fd, cb) { + return fs$close.call(fs, fd, function (err) { + // This function uses the graceful-fs shared queue + if (!err) { + resetQueue() + } - /** - * @param {ChunkGraphModule} cgm the ChunkGraphModule - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @returns {string} hash - */ - _getModuleGraphHashWithConnections(cgm, module, runtime) { - if (cgm.graphHashesWithConnections === undefined) { - cgm.graphHashesWithConnections = new RuntimeSpecMap(); - } - const activeStateToString = state => { - if (state === false) return "F"; - if (state === true) return "T"; - if (state === ModuleGraphConnection.TRANSITIVE_ONLY) return "O"; - throw new Error("Not implemented active state"); - }; - const strict = module.buildMeta && module.buildMeta.strictHarmonyModule; - return cgm.graphHashesWithConnections.provide(runtime, () => { - const graphHash = this._getModuleGraphHashBigInt( - cgm, - module, - runtime - ).toString(16); - const connections = this.moduleGraph.getOutgoingConnections(module); - /** @type {Set} */ - const activeNamespaceModules = new Set(); - /** @type {Map>} */ - const connectedModules = new Map(); - const processConnection = (connection, stateInfo) => { - const module = connection.module; - stateInfo += module.getExportsType(this.moduleGraph, strict); - // cspell:word Tnamespace - if (stateInfo === "Tnamespace") activeNamespaceModules.add(module); - else { - const oldModule = connectedModules.get(stateInfo); - if (oldModule === undefined) { - connectedModules.set(stateInfo, module); - } else if (oldModule instanceof Set) { - oldModule.add(module); - } else if (oldModule !== module) { - connectedModules.set(stateInfo, new Set([oldModule, module])); - } - } - }; - if (runtime === undefined || typeof runtime === "string") { - for (const connection of connections) { - const state = connection.getActiveState(runtime); - if (state === false) continue; - processConnection(connection, state === true ? "T" : "O"); - } - } else { - // cspell:word Tnamespace - for (const connection of connections) { - const states = new Set(); - let stateInfo = ""; - forEachRuntime( - runtime, - runtime => { - const state = connection.getActiveState(runtime); - states.add(state); - stateInfo += activeStateToString(state) + runtime; - }, - true - ); - if (states.size === 1) { - const state = first(states); - if (state === false) continue; - stateInfo = activeStateToString(state); - } - processConnection(connection, stateInfo); - } - } - // cspell:word Tnamespace - if (activeNamespaceModules.size === 0 && connectedModules.size === 0) - return graphHash; - const connectedModulesInOrder = - connectedModules.size > 1 - ? Array.from(connectedModules).sort(([a], [b]) => (a < b ? -1 : 1)) - : connectedModules; - const hash = createHash(this._hashFunction); - const addModuleToHash = module => { - hash.update( - this._getModuleGraphHashBigInt( - this._getChunkGraphModule(module), - module, - runtime - ).toString(16) - ); - }; - const addModulesToHash = modules => { - let xor = ZERO_BIG_INT; - for (const m of modules) { - xor = - xor ^ - this._getModuleGraphHashBigInt( - this._getChunkGraphModule(m), - m, - runtime - ); - } - hash.update(xor.toString(16)); - }; - if (activeNamespaceModules.size === 1) - addModuleToHash(activeNamespaceModules.values().next().value); - else if (activeNamespaceModules.size > 1) - addModulesToHash(activeNamespaceModules); - for (const [stateInfo, modules] of connectedModulesInOrder) { - hash.update(stateInfo); - if (modules instanceof Set) { - addModulesToHash(modules); - } else { - addModuleToHash(modules); - } - } - hash.update(graphHash); - return /** @type {string} */ (hash.digest("hex")); - }); - } - - /** - * @param {Chunk} chunk the chunk - * @returns {ReadonlySet} runtime requirements - */ - getTreeRuntimeRequirements(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.runtimeRequirementsInTree; - } + if (typeof cb === 'function') + cb.apply(this, arguments) + }) + } - // TODO remove in webpack 6 - /** - * @param {Module} module the module - * @param {string} deprecateMessage message for the deprecation message - * @param {string} deprecationCode code for the deprecation - * @returns {ChunkGraph} the chunk graph - */ - static getChunkGraphForModule(module, deprecateMessage, deprecationCode) { - const fn = deprecateGetChunkGraphForModuleMap.get(deprecateMessage); - if (fn) return fn(module); - const newFn = util.deprecate( - /** - * @param {Module} module the module - * @returns {ChunkGraph} the chunk graph - */ - module => { - const chunkGraph = chunkGraphForModuleMap.get(module); - if (!chunkGraph) - throw new Error( - deprecateMessage + - ": There was no ChunkGraph assigned to the Module for backward-compat (Use the new API)" - ); - return chunkGraph; - }, - deprecateMessage + ": Use new ChunkGraph API", - deprecationCode - ); - deprecateGetChunkGraphForModuleMap.set(deprecateMessage, newFn); - return newFn(module); - } + Object.defineProperty(close, previousSymbol, { + value: fs$close + }) + return close + })(fs.close) - // TODO remove in webpack 6 - /** - * @param {Module} module the module - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {void} - */ - static setChunkGraphForModule(module, chunkGraph) { - chunkGraphForModuleMap.set(module, chunkGraph); - } + fs.closeSync = (function (fs$closeSync) { + function closeSync (fd) { + // This function uses the graceful-fs shared queue + fs$closeSync.apply(fs, arguments) + resetQueue() + } - // TODO remove in webpack 6 - /** - * @param {Module} module the module - * @returns {void} - */ - static clearChunkGraphForModule(module) { - chunkGraphForModuleMap.delete(module); - } + Object.defineProperty(closeSync, previousSymbol, { + value: fs$closeSync + }) + return closeSync + })(fs.closeSync) - // TODO remove in webpack 6 - /** - * @param {Chunk} chunk the chunk - * @param {string} deprecateMessage message for the deprecation message - * @param {string} deprecationCode code for the deprecation - * @returns {ChunkGraph} the chunk graph - */ - static getChunkGraphForChunk(chunk, deprecateMessage, deprecationCode) { - const fn = deprecateGetChunkGraphForChunkMap.get(deprecateMessage); - if (fn) return fn(chunk); - const newFn = util.deprecate( - /** - * @param {Chunk} chunk the chunk - * @returns {ChunkGraph} the chunk graph - */ - chunk => { - const chunkGraph = chunkGraphForChunkMap.get(chunk); - if (!chunkGraph) - throw new Error( - deprecateMessage + - "There was no ChunkGraph assigned to the Chunk for backward-compat (Use the new API)" - ); - return chunkGraph; - }, - deprecateMessage + ": Use new ChunkGraph API", - deprecationCode - ); - deprecateGetChunkGraphForChunkMap.set(deprecateMessage, newFn); - return newFn(chunk); - } + if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { + process.on('exit', function() { + debug(fs[gracefulQueue]) + __webpack_require__(39491).equal(fs[gracefulQueue].length, 0) + }) + } +} - // TODO remove in webpack 6 - /** - * @param {Chunk} chunk the chunk - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {void} - */ - static setChunkGraphForChunk(chunk, chunkGraph) { - chunkGraphForChunkMap.set(chunk, chunkGraph); - } +if (!global[gracefulQueue]) { + publishQueue(global, fs[gracefulQueue]); +} - // TODO remove in webpack 6 - /** - * @param {Chunk} chunk the chunk - * @returns {void} - */ - static clearChunkGraphForChunk(chunk) { - chunkGraphForChunkMap.delete(chunk); - } +module.exports = patch(clone(fs)) +if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { + module.exports = patch(fs) + fs.__patched = true; } -// TODO remove in webpack 6 -/** @type {WeakMap} */ -const chunkGraphForModuleMap = new WeakMap(); +function patch (fs) { + // Everything that references the open() function needs to be in here + polyfills(fs) + fs.gracefulify = patch -// TODO remove in webpack 6 -/** @type {WeakMap} */ -const chunkGraphForChunkMap = new WeakMap(); + fs.createReadStream = createReadStream + fs.createWriteStream = createWriteStream + var fs$readFile = fs.readFile + fs.readFile = readFile + function readFile (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null -// TODO remove in webpack 6 -/** @type {Map ChunkGraph>} */ -const deprecateGetChunkGraphForModuleMap = new Map(); + return go$readFile(path, options, cb) -// TODO remove in webpack 6 -/** @type {Map ChunkGraph>} */ -const deprecateGetChunkGraphForChunkMap = new Map(); + function go$readFile (path, options, cb, startTime) { + return fs$readFile(path, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } -module.exports = ChunkGraph; + var fs$writeFile = fs.writeFile + fs.writeFile = writeFile + function writeFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + return go$writeFile(path, data, options, cb) -/***/ }), + function go$writeFile (path, data, options, cb, startTime) { + return fs$writeFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } -/***/ 15626: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + var fs$appendFile = fs.appendFile + if (fs$appendFile) + fs.appendFile = appendFile + function appendFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + return go$appendFile(path, data, options, cb) + function go$appendFile (path, data, options, cb, startTime) { + return fs$appendFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + var fs$copyFile = fs.copyFile + if (fs$copyFile) + fs.copyFile = copyFile + function copyFile (src, dest, flags, cb) { + if (typeof flags === 'function') { + cb = flags + flags = 0 + } + return go$copyFile(src, dest, flags, cb) -const util = __webpack_require__(73837); -const SortableSet = __webpack_require__(13098); -const { - compareLocations, - compareChunks, - compareIterables -} = __webpack_require__(29579); + function go$copyFile (src, dest, flags, cb, startTime) { + return fs$copyFile(src, dest, flags, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } -/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("./Entrypoint")} Entrypoint */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ + var fs$readdir = fs.readdir + fs.readdir = readdir + function readdir (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null -/** @typedef {{id: number}} HasId */ -/** @typedef {{module: Module, loc: DependencyLocation, request: string}} OriginRecord */ + return go$readdir(path, options, cb) -/** - * @typedef {Object} RawChunkGroupOptions - * @property {number=} preloadOrder - * @property {number=} prefetchOrder - */ + function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, options, function (err, files) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readdir, [path, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (files && files.sort) + files.sort() -/** @typedef {RawChunkGroupOptions & { name?: string }} ChunkGroupOptions */ + if (typeof cb === 'function') + cb.call(this, err, files) + } + }) + } + } -let debugId = 5000; + if (process.version.substr(0, 4) === 'v0.8') { + var legStreams = legacy(fs) + ReadStream = legStreams.ReadStream + WriteStream = legStreams.WriteStream + } -/** - * @template T - * @param {SortableSet} set set to convert to array. - * @returns {T[]} the array format of existing set - */ -const getArray = set => Array.from(set); + var fs$ReadStream = fs.ReadStream + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype) + ReadStream.prototype.open = ReadStream$open + } -/** - * A convenience method used to sort chunks based on their id's - * @param {ChunkGroup} a first sorting comparator - * @param {ChunkGroup} b second sorting comparator - * @returns {1|0|-1} a sorting index to determine order - */ -const sortById = (a, b) => { - if (a.id < b.id) return -1; - if (b.id < a.id) return 1; - return 0; -}; + var fs$WriteStream = fs.WriteStream + if (fs$WriteStream) { + WriteStream.prototype = Object.create(fs$WriteStream.prototype) + WriteStream.prototype.open = WriteStream$open + } -/** - * @param {OriginRecord} a the first comparator in sort - * @param {OriginRecord} b the second comparator in sort - * @returns {1|-1|0} returns sorting order as index - */ -const sortOrigin = (a, b) => { - const aIdent = a.module ? a.module.identifier() : ""; - const bIdent = b.module ? b.module.identifier() : ""; - if (aIdent < bIdent) return -1; - if (aIdent > bIdent) return 1; - return compareLocations(a.loc, b.loc); -}; + Object.defineProperty(fs, 'ReadStream', { + get: function () { + return ReadStream + }, + set: function (val) { + ReadStream = val + }, + enumerable: true, + configurable: true + }) + Object.defineProperty(fs, 'WriteStream', { + get: function () { + return WriteStream + }, + set: function (val) { + WriteStream = val + }, + enumerable: true, + configurable: true + }) -class ChunkGroup { - /** - * Creates an instance of ChunkGroup. - * @param {string|ChunkGroupOptions=} options chunk group options passed to chunkGroup - */ - constructor(options) { - if (typeof options === "string") { - options = { name: options }; - } else if (!options) { - options = { name: undefined }; - } - /** @type {number} */ - this.groupDebugId = debugId++; - this.options = options; - /** @type {SortableSet} */ - this._children = new SortableSet(undefined, sortById); - /** @type {SortableSet} */ - this._parents = new SortableSet(undefined, sortById); - /** @type {SortableSet} */ - this._asyncEntrypoints = new SortableSet(undefined, sortById); - this._blocks = new SortableSet(); - /** @type {Chunk[]} */ - this.chunks = []; - /** @type {OriginRecord[]} */ - this.origins = []; - /** Indices in top-down order */ - /** @private @type {Map} */ - this._modulePreOrderIndices = new Map(); - /** Indices in bottom-up order */ - /** @private @type {Map} */ - this._modulePostOrderIndices = new Map(); - /** @type {number} */ - this.index = undefined; - } + // legacy names + var FileReadStream = ReadStream + Object.defineProperty(fs, 'FileReadStream', { + get: function () { + return FileReadStream + }, + set: function (val) { + FileReadStream = val + }, + enumerable: true, + configurable: true + }) + var FileWriteStream = WriteStream + Object.defineProperty(fs, 'FileWriteStream', { + get: function () { + return FileWriteStream + }, + set: function (val) { + FileWriteStream = val + }, + enumerable: true, + configurable: true + }) - /** - * when a new chunk is added to a chunkGroup, addingOptions will occur. - * @param {ChunkGroupOptions} options the chunkGroup options passed to addOptions - * @returns {void} - */ - addOptions(options) { - for (const key of Object.keys(options)) { - if (this.options[key] === undefined) { - this.options[key] = options[key]; - } else if (this.options[key] !== options[key]) { - if (key.endsWith("Order")) { - this.options[key] = Math.max(this.options[key], options[key]); - } else { - throw new Error( - `ChunkGroup.addOptions: No option merge strategy for ${key}` - ); - } - } - } - } + function ReadStream (path, options) { + if (this instanceof ReadStream) + return fs$ReadStream.apply(this, arguments), this + else + return ReadStream.apply(Object.create(ReadStream.prototype), arguments) + } - /** - * returns the name of current ChunkGroup - * @returns {string|undefined} returns the ChunkGroup name - */ - get name() { - return this.options.name; - } + function ReadStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + if (that.autoClose) + that.destroy() - /** - * sets a new name for current ChunkGroup - * @param {string} value the new name for ChunkGroup - * @returns {void} - */ - set name(value) { - this.options.name = value; - } + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + that.read() + } + }) + } - /* istanbul ignore next */ - /** - * get a uniqueId for ChunkGroup, made up of its member Chunk debugId's - * @returns {string} a unique concatenation of chunk debugId's - */ - get debugId() { - return Array.from(this.chunks, x => x.debugId).join("+"); - } + function WriteStream (path, options) { + if (this instanceof WriteStream) + return fs$WriteStream.apply(this, arguments), this + else + return WriteStream.apply(Object.create(WriteStream.prototype), arguments) + } - /** - * get a unique id for ChunkGroup, made up of its member Chunk id's - * @returns {string} a unique concatenation of chunk ids - */ - get id() { - return Array.from(this.chunks, x => x.id).join("+"); - } + function WriteStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + that.destroy() + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + } + }) + } - /** - * Performs an unshift of a specific chunk - * @param {Chunk} chunk chunk being unshifted - * @returns {boolean} returns true if attempted chunk shift is accepted - */ - unshiftChunk(chunk) { - const oldIdx = this.chunks.indexOf(chunk); - if (oldIdx > 0) { - this.chunks.splice(oldIdx, 1); - this.chunks.unshift(chunk); - } else if (oldIdx < 0) { - this.chunks.unshift(chunk); - return true; - } - return false; - } + function createReadStream (path, options) { + return new fs.ReadStream(path, options) + } - /** - * inserts a chunk before another existing chunk in group - * @param {Chunk} chunk Chunk being inserted - * @param {Chunk} before Placeholder/target chunk marking new chunk insertion point - * @returns {boolean} return true if insertion was successful - */ - insertChunk(chunk, before) { - const oldIdx = this.chunks.indexOf(chunk); - const idx = this.chunks.indexOf(before); - if (idx < 0) { - throw new Error("before chunk not found"); - } - if (oldIdx >= 0 && oldIdx > idx) { - this.chunks.splice(oldIdx, 1); - this.chunks.splice(idx, 0, chunk); - } else if (oldIdx < 0) { - this.chunks.splice(idx, 0, chunk); - return true; - } - return false; - } + function createWriteStream (path, options) { + return new fs.WriteStream(path, options) + } - /** - * add a chunk into ChunkGroup. Is pushed on or prepended - * @param {Chunk} chunk chunk being pushed into ChunkGroupS - * @returns {boolean} returns true if chunk addition was successful. - */ - pushChunk(chunk) { - const oldIdx = this.chunks.indexOf(chunk); - if (oldIdx >= 0) { - return false; - } - this.chunks.push(chunk); - return true; - } + var fs$open = fs.open + fs.open = open + function open (path, flags, mode, cb) { + if (typeof mode === 'function') + cb = mode, mode = null - /** - * @param {Chunk} oldChunk chunk to be replaced - * @param {Chunk} newChunk New chunk that will be replaced with - * @returns {boolean} returns true if the replacement was successful - */ - replaceChunk(oldChunk, newChunk) { - const oldIdx = this.chunks.indexOf(oldChunk); - if (oldIdx < 0) return false; - const newIdx = this.chunks.indexOf(newChunk); - if (newIdx < 0) { - this.chunks[oldIdx] = newChunk; - return true; - } - if (newIdx < oldIdx) { - this.chunks.splice(oldIdx, 1); - return true; - } else if (newIdx !== oldIdx) { - this.chunks[oldIdx] = newChunk; - this.chunks.splice(newIdx, 1); - return true; - } - } + return go$open(path, flags, mode, cb) - /** - * @param {Chunk} chunk chunk to remove - * @returns {boolean} returns true if chunk was removed - */ - removeChunk(chunk) { - const idx = this.chunks.indexOf(chunk); - if (idx >= 0) { - this.chunks.splice(idx, 1); - return true; - } - return false; - } + function go$open (path, flags, mode, cb, startTime) { + return fs$open(path, flags, mode, function (err, fd) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } - /** - * @returns {boolean} true, when this chunk group will be loaded on initial page load - */ - isInitial() { - return false; - } + return fs +} - /** - * @param {ChunkGroup} group chunk group to add - * @returns {boolean} returns true if chunk group was added - */ - addChild(group) { - const size = this._children.size; - this._children.add(group); - return size !== this._children.size; - } +function enqueue (elem) { + debug('ENQUEUE', elem[0].name, elem[1]) + fs[gracefulQueue].push(elem) + retry() +} - /** - * @returns {ChunkGroup[]} returns the children of this group - */ - getChildren() { - return this._children.getFromCache(getArray); - } +// keep track of the timeout between retry() calls +var retryTimer - getNumberOfChildren() { - return this._children.size; - } +// reset the startTime and lastTime to now +// this resets the start of the 60 second overall timeout as well as the +// delay between attempts so that we'll retry these jobs sooner +function resetQueue () { + var now = Date.now() + for (var i = 0; i < fs[gracefulQueue].length; ++i) { + // entries that are only a length of 2 are from an older version, don't + // bother modifying those since they'll be retried anyway. + if (fs[gracefulQueue][i].length > 2) { + fs[gracefulQueue][i][3] = now // startTime + fs[gracefulQueue][i][4] = now // lastTime + } + } + // call retry to make sure we're actively processing the queue + retry() +} - get childrenIterable() { - return this._children; - } +function retry () { + // clear the timer and remove it to help prevent unintended concurrency + clearTimeout(retryTimer) + retryTimer = undefined - /** - * @param {ChunkGroup} group the chunk group to remove - * @returns {boolean} returns true if the chunk group was removed - */ - removeChild(group) { - if (!this._children.has(group)) { - return false; - } + if (fs[gracefulQueue].length === 0) + return - this._children.delete(group); - group.removeParent(this); - return true; - } + var elem = fs[gracefulQueue].shift() + var fn = elem[0] + var args = elem[1] + // these items may be unset if they were added by an older graceful-fs + var err = elem[2] + var startTime = elem[3] + var lastTime = elem[4] - /** - * @param {ChunkGroup} parentChunk the parent group to be added into - * @returns {boolean} returns true if this chunk group was added to the parent group - */ - addParent(parentChunk) { - if (!this._parents.has(parentChunk)) { - this._parents.add(parentChunk); - return true; - } - return false; - } + // if we don't have a startTime we have no way of knowing if we've waited + // long enough, so go ahead and retry this item now + if (startTime === undefined) { + debug('RETRY', fn.name, args) + fn.apply(null, args) + } else if (Date.now() - startTime >= 60000) { + // it's been more than 60 seconds total, bail now + debug('TIMEOUT', fn.name, args) + var cb = args.pop() + if (typeof cb === 'function') + cb.call(null, err) + } else { + // the amount of time between the last attempt and right now + var sinceAttempt = Date.now() - lastTime + // the amount of time between when we first tried, and when we last tried + // rounded up to at least 1 + var sinceStart = Math.max(lastTime - startTime, 1) + // backoff. wait longer than the total time we've been retrying, but only + // up to a maximum of 100ms + var desiredDelay = Math.min(sinceStart * 1.2, 100) + // it's been long enough since the last retry, do it again + if (sinceAttempt >= desiredDelay) { + debug('RETRY', fn.name, args) + fn.apply(null, args.concat([startTime])) + } else { + // if we can't do this job yet, push it to the end of the queue + // and let the next iteration check again + fs[gracefulQueue].push(elem) + } + } - /** - * @returns {ChunkGroup[]} returns the parents of this group - */ - getParents() { - return this._parents.getFromCache(getArray); - } + // schedule our next run if one isn't already scheduled + if (retryTimer === undefined) { + retryTimer = setTimeout(retry, 0) + } +} - getNumberOfParents() { - return this._parents.size; - } - /** - * @param {ChunkGroup} parent the parent group - * @returns {boolean} returns true if the parent group contains this group - */ - hasParent(parent) { - return this._parents.has(parent); - } +/***/ }), - get parentsIterable() { - return this._parents; - } +/***/ 54410: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {ChunkGroup} chunkGroup the parent group - * @returns {boolean} returns true if this group has been removed from the parent - */ - removeParent(chunkGroup) { - if (this._parents.delete(chunkGroup)) { - chunkGroup.removeChild(this); - return true; - } - return false; - } +var Stream = (__webpack_require__(12781).Stream) - /** - * @param {Entrypoint} entrypoint entrypoint to add - * @returns {boolean} returns true if entrypoint was added - */ - addAsyncEntrypoint(entrypoint) { - const size = this._asyncEntrypoints.size; - this._asyncEntrypoints.add(entrypoint); - return size !== this._asyncEntrypoints.size; - } +module.exports = legacy - get asyncEntrypointsIterable() { - return this._asyncEntrypoints; - } +function legacy (fs) { + return { + ReadStream: ReadStream, + WriteStream: WriteStream + } - /** - * @returns {Array} an array containing the blocks - */ - getBlocks() { - return this._blocks.getFromCache(getArray); - } + function ReadStream (path, options) { + if (!(this instanceof ReadStream)) return new ReadStream(path, options); - getNumberOfBlocks() { - return this._blocks.size; - } + Stream.call(this); - hasBlock(block) { - return this._blocks.has(block); - } + var self = this; - /** - * @returns {Iterable} blocks - */ - get blocksIterable() { - return this._blocks; - } + this.path = path; + this.fd = null; + this.readable = true; + this.paused = false; - /** - * @param {AsyncDependenciesBlock} block a block - * @returns {boolean} false, if block was already added - */ - addBlock(block) { - if (!this._blocks.has(block)) { - this._blocks.add(block); - return true; - } - return false; - } + this.flags = 'r'; + this.mode = 438; /*=0666*/ + this.bufferSize = 64 * 1024; - /** - * @param {Module} module origin module - * @param {DependencyLocation} loc location of the reference in the origin module - * @param {string} request request name of the reference - * @returns {void} - */ - addOrigin(module, loc, request) { - this.origins.push({ - module, - loc, - request - }); - } + options = options || {}; - /** - * @returns {string[]} the files contained this chunk group - */ - getFiles() { - const files = new Set(); + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } - for (const chunk of this.chunks) { - for (const file of chunk.files) { - files.add(file); - } - } + if (this.encoding) this.setEncoding(this.encoding); - return Array.from(files); - } + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.end === undefined) { + this.end = Infinity; + } else if ('number' !== typeof this.end) { + throw TypeError('end must be a Number'); + } - /** - * @returns {void} - */ - remove() { - // cleanup parents - for (const parentChunkGroup of this._parents) { - // remove this chunk from its parents - parentChunkGroup._children.delete(this); + if (this.start > this.end) { + throw new Error('start must be <= end'); + } - // cleanup "sub chunks" - for (const chunkGroup of this._children) { - /** - * remove this chunk as "intermediary" and connect - * it "sub chunks" and parents directly - */ - // add parent to each "sub chunk" - chunkGroup.addParent(parentChunkGroup); - // add "sub chunk" to parent - parentChunkGroup.addChild(chunkGroup); - } - } + this.pos = this.start; + } - /** - * we need to iterate again over the children - * to remove this from the child's parents. - * This can not be done in the above loop - * as it is not guaranteed that `this._parents` contains anything. - */ - for (const chunkGroup of this._children) { - // remove this as parent of every "sub chunk" - chunkGroup._parents.delete(this); - } + if (this.fd !== null) { + process.nextTick(function() { + self._read(); + }); + return; + } - // remove chunks - for (const chunk of this.chunks) { - chunk.removeGroup(this); - } - } + fs.open(this.path, this.flags, this.mode, function (err, fd) { + if (err) { + self.emit('error', err); + self.readable = false; + return; + } - sortItems() { - this.origins.sort(sortOrigin); - } + self.fd = fd; + self.emit('open', fd); + self._read(); + }) + } - /** - * Sorting predicate which allows current ChunkGroup to be compared against another. - * Sorting values are based off of number of chunks in ChunkGroup. - * - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {ChunkGroup} otherGroup the chunkGroup to compare this against - * @returns {-1|0|1} sort position for comparison - */ - compareTo(chunkGraph, otherGroup) { - if (this.chunks.length > otherGroup.chunks.length) return -1; - if (this.chunks.length < otherGroup.chunks.length) return 1; - return compareIterables(compareChunks(chunkGraph))( - this.chunks, - otherGroup.chunks - ); - } + function WriteStream (path, options) { + if (!(this instanceof WriteStream)) return new WriteStream(path, options); - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {Record} mapping from children type to ordered list of ChunkGroups - */ - getChildrenByOrders(moduleGraph, chunkGraph) { - /** @type {Map} */ - const lists = new Map(); - for (const childGroup of this._children) { - for (const key of Object.keys(childGroup.options)) { - if (key.endsWith("Order")) { - const name = key.substr(0, key.length - "Order".length); - let list = lists.get(name); - if (list === undefined) { - lists.set(name, (list = [])); - } - list.push({ - order: childGroup.options[key], - group: childGroup - }); - } - } - } - /** @type {Record} */ - const result = Object.create(null); - for (const [name, list] of lists) { - list.sort((a, b) => { - const cmp = b.order - a.order; - if (cmp !== 0) return cmp; - return a.group.compareTo(chunkGraph, b.group); - }); - result[name] = list.map(i => i.group); - } - return result; - } + Stream.call(this); - /** - * Sets the top-down index of a module in this ChunkGroup - * @param {Module} module module for which the index should be set - * @param {number} index the index of the module - * @returns {void} - */ - setModulePreOrderIndex(module, index) { - this._modulePreOrderIndices.set(module, index); - } + this.path = path; + this.fd = null; + this.writable = true; - /** - * Gets the top-down index of a module in this ChunkGroup - * @param {Module} module the module - * @returns {number} index - */ - getModulePreOrderIndex(module) { - return this._modulePreOrderIndices.get(module); - } + this.flags = 'w'; + this.encoding = 'binary'; + this.mode = 438; /*=0666*/ + this.bytesWritten = 0; - /** - * Sets the bottom-up index of a module in this ChunkGroup - * @param {Module} module module for which the index should be set - * @param {number} index the index of the module - * @returns {void} - */ - setModulePostOrderIndex(module, index) { - this._modulePostOrderIndices.set(module, index); - } + options = options || {}; - /** - * Gets the bottom-up index of a module in this ChunkGroup - * @param {Module} module the module - * @returns {number} index - */ - getModulePostOrderIndex(module) { - return this._modulePostOrderIndices.get(module); - } + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } - /* istanbul ignore next */ - checkConstraints() { - const chunk = this; - for (const child of chunk._children) { - if (!child._parents.has(chunk)) { - throw new Error( - `checkConstraints: child missing parent ${chunk.debugId} -> ${child.debugId}` - ); - } - } - for (const parentChunk of chunk._parents) { - if (!parentChunk._children.has(chunk)) { - throw new Error( - `checkConstraints: parent missing child ${parentChunk.debugId} <- ${chunk.debugId}` - ); - } - } - } -} + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.start < 0) { + throw new Error('start must be >= zero'); + } -ChunkGroup.prototype.getModuleIndex = util.deprecate( - ChunkGroup.prototype.getModulePreOrderIndex, - "ChunkGroup.getModuleIndex was renamed to getModulePreOrderIndex", - "DEP_WEBPACK_CHUNK_GROUP_GET_MODULE_INDEX" -); + this.pos = this.start; + } -ChunkGroup.prototype.getModuleIndex2 = util.deprecate( - ChunkGroup.prototype.getModulePostOrderIndex, - "ChunkGroup.getModuleIndex2 was renamed to getModulePostOrderIndex", - "DEP_WEBPACK_CHUNK_GROUP_GET_MODULE_INDEX_2" -); + this.busy = false; + this._queue = []; -module.exports = ChunkGroup; + if (this.fd === null) { + this._open = fs.open; + this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); + this.flush(); + } + } +} /***/ }), -/***/ 918: +/***/ 11290: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - +var constants = __webpack_require__(22057) -const WebpackError = __webpack_require__(53799); +var origCwd = process.cwd +var cwd = null -/** @typedef {import("./Chunk")} Chunk */ +var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform -class ChunkRenderError extends WebpackError { - /** - * Create a new ChunkRenderError - * @param {Chunk} chunk A chunk - * @param {string} file Related file - * @param {Error} error Original error - */ - constructor(chunk, file, error) { - super(); +process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process) + return cwd +} +try { + process.cwd() +} catch (er) {} - this.name = "ChunkRenderError"; - this.error = error; - this.message = error.message; - this.details = error.stack; - this.file = file; - this.chunk = chunk; - } +// This check is needed until node.js 12 is required +if (typeof process.chdir === 'function') { + var chdir = process.chdir + process.chdir = function (d) { + cwd = null + chdir.call(process, d) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) } -module.exports = ChunkRenderError; +module.exports = patch +function patch (fs) { + // (re-)implement some things that are known busted or missing. -/***/ }), + // lchmod, broken prior to 0.6.2 + // back-port the fix here. + if (constants.hasOwnProperty('O_SYMLINK') && + process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs) + } -/***/ 46341: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // lutimes implementation, or no-op + if (!fs.lutimes) { + patchLutimes(fs) + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // https://github.com/isaacs/node-graceful-fs/issues/4 + // Chown should not fail on einval or eperm if non-root. + // It should not fail on enosys ever, as this just indicates + // that a fs doesn't support the intended operation. + fs.chown = chownFix(fs.chown) + fs.fchown = chownFix(fs.fchown) + fs.lchown = chownFix(fs.lchown) + fs.chmod = chmodFix(fs.chmod) + fs.fchmod = chmodFix(fs.fchmod) + fs.lchmod = chmodFix(fs.lchmod) -const util = __webpack_require__(73837); -const memoize = __webpack_require__(78676); + fs.chownSync = chownFixSync(fs.chownSync) + fs.fchownSync = chownFixSync(fs.fchownSync) + fs.lchownSync = chownFixSync(fs.lchownSync) -/** @typedef {import("../declarations/WebpackOptions").Output} OutputOptions */ -/** @typedef {import("./Compilation")} Compilation */ + fs.chmodSync = chmodFixSync(fs.chmodSync) + fs.fchmodSync = chmodFixSync(fs.fchmodSync) + fs.lchmodSync = chmodFixSync(fs.lchmodSync) -const getJavascriptModulesPlugin = memoize(() => - __webpack_require__(89464) -); + fs.stat = statFix(fs.stat) + fs.fstat = statFix(fs.fstat) + fs.lstat = statFix(fs.lstat) -// TODO webpack 6 remove this class -class ChunkTemplate { - /** - * @param {OutputOptions} outputOptions output options - * @param {Compilation} compilation the compilation - */ - constructor(outputOptions, compilation) { - this._outputOptions = outputOptions || {}; - this.hooks = Object.freeze({ - renderManifest: { - tap: util.deprecate( - (options, fn) => { - compilation.hooks.renderManifest.tap( - options, - (entries, options) => { - if (options.chunk.hasRuntime()) return entries; - return fn(entries, options); - } - ); - }, - "ChunkTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)", - "DEP_WEBPACK_CHUNK_TEMPLATE_RENDER_MANIFEST" - ) - }, - modules: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .renderChunk.tap(options, (source, renderContext) => - fn( - source, - compilation.moduleTemplates.javascript, - renderContext - ) - ); - }, - "ChunkTemplate.hooks.modules is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderChunk instead)", - "DEP_WEBPACK_CHUNK_TEMPLATE_MODULES" - ) - }, - render: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .renderChunk.tap(options, (source, renderContext) => - fn( - source, - compilation.moduleTemplates.javascript, - renderContext - ) - ); - }, - "ChunkTemplate.hooks.render is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderChunk instead)", - "DEP_WEBPACK_CHUNK_TEMPLATE_RENDER" - ) - }, - renderWithEntry: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .render.tap(options, (source, renderContext) => { - if ( - renderContext.chunkGraph.getNumberOfEntryModules( - renderContext.chunk - ) === 0 || - renderContext.chunk.hasRuntime() - ) { - return source; - } - return fn(source, renderContext.chunk); - }); - }, - "ChunkTemplate.hooks.renderWithEntry is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)", - "DEP_WEBPACK_CHUNK_TEMPLATE_RENDER_WITH_ENTRY" - ) - }, - hash: { - tap: util.deprecate( - (options, fn) => { - compilation.hooks.fullHash.tap(options, fn); - }, - "ChunkTemplate.hooks.hash is deprecated (use Compilation.hooks.fullHash instead)", - "DEP_WEBPACK_CHUNK_TEMPLATE_HASH" - ) - }, - hashForChunk: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .chunkHash.tap(options, (chunk, hash, context) => { - if (chunk.hasRuntime()) return; - fn(hash, chunk, context); - }); - }, - "ChunkTemplate.hooks.hashForChunk is deprecated (use JavascriptModulesPlugin.getCompilationHooks().chunkHash instead)", - "DEP_WEBPACK_CHUNK_TEMPLATE_HASH_FOR_CHUNK" - ) - } - }); - } -} + fs.statSync = statFixSync(fs.statSync) + fs.fstatSync = statFixSync(fs.fstatSync) + fs.lstatSync = statFixSync(fs.lstatSync) -Object.defineProperty(ChunkTemplate.prototype, "outputOptions", { - get: util.deprecate( - /** - * @this {ChunkTemplate} - * @returns {OutputOptions} output options - */ - function () { - return this._outputOptions; - }, - "ChunkTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)", - "DEP_WEBPACK_CHUNK_TEMPLATE_OUTPUT_OPTIONS" - ) -}); + // if lchmod/lchown do not exist, then make them no-ops + if (!fs.lchmod) { + fs.lchmod = function (path, mode, cb) { + if (cb) process.nextTick(cb) + } + fs.lchmodSync = function () {} + } + if (!fs.lchown) { + fs.lchown = function (path, uid, gid, cb) { + if (cb) process.nextTick(cb) + } + fs.lchownSync = function () {} + } -module.exports = ChunkTemplate; + // on Windows, A/V software can lock the directory, causing this + // to fail with an EACCES or EPERM if the directory contains newly + // created files. Try again on failure, for up to 60 seconds. + // Set the timeout this long because some Windows Anti-Virus, such as Parity + // bit9, may lock files for up to a minute, causing npm package install + // failures. Also, take care to yield the scheduler. Windows scheduling gives + // CPU to a busy looping process, which can cause the program causing the lock + // contention to be starved of CPU by node, so the contention doesn't resolve. + if (platform === "win32") { + fs.rename = (function (fs$rename) { return function (from, to, cb) { + var start = Date.now() + var backoff = 0; + fs$rename(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM") + && Date.now() - start < 60000) { + setTimeout(function() { + fs.stat(to, function (stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er) + }) + }, backoff) + if (backoff < 100) + backoff += 10; + return; + } + if (cb) cb(er) + }) + }})(fs.rename) + } -/***/ }), + // if read() returns EAGAIN, then just try it again. + fs.read = (function (fs$read) { + function read (fd, buffer, offset, length, position, callback_) { + var callback + if (callback_ && typeof callback_ === 'function') { + var eagCounter = 0 + callback = function (er, _, __) { + if (er && er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + callback_.apply(this, arguments) + } + } + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } -/***/ 31085: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // This ensures `util.promisify` works as it does for native `fs.read`. + if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) + return read + })(fs.read) -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sergey Melyukov @smelukov -*/ + fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { + var eagCounter = 0 + while (true) { + try { + return fs$readSync.call(fs, fd, buffer, offset, length, position) + } catch (er) { + if (er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + continue + } + throw er + } + } + }})(fs.readSync) + function patchLchmod (fs) { + fs.lchmod = function (path, mode, callback) { + fs.open( path + , constants.O_WRONLY | constants.O_SYMLINK + , mode + , function (err, fd) { + if (err) { + if (callback) callback(err) + return + } + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + fs.fchmod(fd, mode, function (err) { + fs.close(fd, function(err2) { + if (callback) callback(err || err2) + }) + }) + }) + } + fs.lchmodSync = function (path, mode) { + var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) -const asyncLib = __webpack_require__(78175); -const { SyncBailHook } = __webpack_require__(6967); -const Compilation = __webpack_require__(85720); -const createSchemaValidation = __webpack_require__(32540); -const { join } = __webpack_require__(17139); -const processAsyncTree = __webpack_require__(42791); + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + var threw = true + var ret + try { + ret = fs.fchmodSync(fd, mode) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + } -/** @typedef {import("../declarations/WebpackOptions").CleanOptions} CleanOptions */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./logging/Logger").Logger} Logger */ -/** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */ -/** @typedef {import("./util/fs").StatsCallback} StatsCallback */ + function patchLutimes (fs) { + if (constants.hasOwnProperty("O_SYMLINK")) { + fs.lutimes = function (path, at, mt, cb) { + fs.open(path, constants.O_SYMLINK, function (er, fd) { + if (er) { + if (cb) cb(er) + return + } + fs.futimes(fd, at, mt, function (er) { + fs.close(fd, function (er2) { + if (cb) cb(er || er2) + }) + }) + }) + } -/** @typedef {(function(string):boolean)|RegExp} IgnoreItem */ -/** @typedef {function(IgnoreItem): void} AddToIgnoreCallback */ + fs.lutimesSync = function (path, at, mt) { + var fd = fs.openSync(path, constants.O_SYMLINK) + var ret + var threw = true + try { + ret = fs.futimesSync(fd, at, mt) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } -/** - * @typedef {Object} CleanPluginCompilationHooks - * @property {SyncBailHook<[string], boolean>} keep when returning true the file/directory will be kept during cleaning, returning false will clean it and ignore the following plugins and config - */ - -const validate = createSchemaValidation( - undefined, - () => { - const { definitions } = __webpack_require__(73342); - return { - definitions, - oneOf: [{ $ref: "#/definitions/CleanOptions" }] - }; - }, - { - name: "Clean Plugin", - baseDataPath: "options" - } -); - -/** - * @param {OutputFileSystem} fs filesystem - * @param {string} outputPath output path - * @param {Set} currentAssets filename of the current assets (must not start with .. or ., must only use / as path separator) - * @param {function((Error | null)=, Set=): void} callback returns the filenames of the assets that shouldn't be there - * @returns {void} - */ -const getDiffToFs = (fs, outputPath, currentAssets, callback) => { - const directories = new Set(); - // get directories of assets - for (const asset of currentAssets) { - directories.add(asset.replace(/(^|\/)[^/]*$/, "")); - } - // and all parent directories - for (const directory of directories) { - directories.add(directory.replace(/(^|\/)[^/]*$/, "")); - } - const diff = new Set(); - asyncLib.forEachLimit( - directories, - 10, - (directory, callback) => { - fs.readdir(join(fs, outputPath, directory), (err, entries) => { - if (err) { - if (err.code === "ENOENT") return callback(); - if (err.code === "ENOTDIR") { - diff.add(directory); - return callback(); - } - return callback(err); - } - for (const entry of entries) { - const file = /** @type {string} */ (entry); - const filename = directory ? `${directory}/${file}` : file; - if (!directories.has(filename) && !currentAssets.has(filename)) { - diff.add(filename); - } - } - callback(); - }); - }, - err => { - if (err) return callback(err); + } else { + fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } + fs.lutimesSync = function () {} + } + } - callback(null, diff); - } - ); -}; + function chmodFix (orig) { + if (!orig) return orig + return function (target, mode, cb) { + return orig.call(fs, target, mode, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } -/** - * @param {Set} currentAssets assets list - * @param {Set} oldAssets old assets list - * @returns {Set} diff - */ -const getDiffToOldAssets = (currentAssets, oldAssets) => { - const diff = new Set(); - for (const asset of oldAssets) { - if (!currentAssets.has(asset)) diff.add(asset); - } - return diff; -}; + function chmodFixSync (orig) { + if (!orig) return orig + return function (target, mode) { + try { + return orig.call(fs, target, mode) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } -/** - * @param {OutputFileSystem} fs filesystem - * @param {string} filename path to file - * @param {StatsCallback} callback callback for provided filename - * @returns {void} - */ -const doStat = (fs, filename, callback) => { - if ("lstat" in fs) { - fs.lstat(filename, callback); - } else { - fs.stat(filename, callback); - } -}; -/** - * @param {OutputFileSystem} fs filesystem - * @param {string} outputPath output path - * @param {boolean} dry only log instead of fs modification - * @param {Logger} logger logger - * @param {Set} diff filenames of the assets that shouldn't be there - * @param {function(string): boolean} isKept check if the entry is ignored - * @param {function(Error=): void} callback callback - * @returns {void} - */ -const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => { - const log = msg => { - if (dry) { - logger.info(msg); - } else { - logger.log(msg); - } - }; - /** @typedef {{ type: "check" | "unlink" | "rmdir", filename: string, parent: { remaining: number, job: Job } | undefined }} Job */ - /** @type {Job[]} */ - const jobs = Array.from(diff, filename => ({ - type: "check", - filename, - parent: undefined - })); - processAsyncTree( - jobs, - 10, - ({ type, filename, parent }, push, callback) => { - const handleError = err => { - if (err.code === "ENOENT") { - log(`${filename} was removed during cleaning by something else`); - handleParent(); - return callback(); - } - return callback(err); - }; - const handleParent = () => { - if (parent && --parent.remaining === 0) push(parent.job); - }; - const path = join(fs, outputPath, filename); - switch (type) { - case "check": - if (isKept(filename)) { - // do not decrement parent entry as we don't want to delete the parent - log(`${filename} will be kept`); - return process.nextTick(callback); - } - doStat(fs, path, (err, stats) => { - if (err) return handleError(err); - if (!stats.isDirectory()) { - push({ - type: "unlink", - filename, - parent - }); - return callback(); - } - fs.readdir(path, (err, entries) => { - if (err) return handleError(err); - /** @type {Job} */ - const deleteJob = { - type: "rmdir", - filename, - parent - }; - if (entries.length === 0) { - push(deleteJob); - } else { - const parentToken = { - remaining: entries.length, - job: deleteJob - }; - for (const entry of entries) { - const file = /** @type {string} */ (entry); - if (file.startsWith(".")) { - log( - `${filename} will be kept (dot-files will never be removed)` - ); - continue; - } - push({ - type: "check", - filename: `${filename}/${file}`, - parent: parentToken - }); - } - } - return callback(); - }); - }); - break; - case "rmdir": - log(`${filename} will be removed`); - if (dry) { - handleParent(); - return process.nextTick(callback); - } - if (!fs.rmdir) { - logger.warn( - `${filename} can't be removed because output file system doesn't support removing directories (rmdir)` - ); - return process.nextTick(callback); - } - fs.rmdir(path, err => { - if (err) return handleError(err); - handleParent(); - callback(); - }); - break; - case "unlink": - log(`${filename} will be removed`); - if (dry) { - handleParent(); - return process.nextTick(callback); - } - if (!fs.unlink) { - logger.warn( - `${filename} can't be removed because output file system doesn't support removing files (rmdir)` - ); - return process.nextTick(callback); - } - fs.unlink(path, err => { - if (err) return handleError(err); - handleParent(); - callback(); - }); - break; - } - }, - callback - ); -}; + function chownFix (orig) { + if (!orig) return orig + return function (target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } -/** @type {WeakMap} */ -const compilationHooksMap = new WeakMap(); + function chownFixSync (orig) { + if (!orig) return orig + return function (target, uid, gid) { + try { + return orig.call(fs, target, uid, gid) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } -class CleanPlugin { - /** - * @param {Compilation} compilation the compilation - * @returns {CleanPluginCompilationHooks} the attached hooks - */ - static getCompilationHooks(compilation) { - if (!(compilation instanceof Compilation)) { - throw new TypeError( - "The 'compilation' argument must be an instance of Compilation" - ); - } - let hooks = compilationHooksMap.get(compilation); - if (hooks === undefined) { - hooks = { - /** @type {SyncBailHook<[string], boolean>} */ - keep: new SyncBailHook(["ignore"]) - }; - compilationHooksMap.set(compilation, hooks); - } - return hooks; - } + function statFix (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + function callback (er, stats) { + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + if (cb) cb.apply(this, arguments) + } + return options ? orig.call(fs, target, options, callback) + : orig.call(fs, target, callback) + } + } - /** @param {CleanOptions} options options */ - constructor(options = {}) { - validate(options); - this.options = { dry: false, ...options }; - } + function statFixSync (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options) { + var stats = options ? orig.call(fs, target, options) + : orig.call(fs, target) + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + return stats; + } + } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const { dry, keep } = this.options; + // ENOSYS means that the fs doesn't support the op. Just ignore + // that, because it doesn't matter. + // + // if there's no getuid, or if getuid() is something other + // than 0, and the error is EINVAL or EPERM, then just ignore + // it. + // + // This specific case is a silent failure in cp, install, tar, + // and most other unix tools that manage permissions. + // + // When running as root, or if other types of errors are + // encountered, then it's strict. + function chownErOk (er) { + if (!er) + return true - const keepFn = - typeof keep === "function" - ? keep - : typeof keep === "string" - ? path => path.startsWith(keep) - : typeof keep === "object" && keep.test - ? path => keep.test(path) - : () => false; + if (er.code === "ENOSYS") + return true - // We assume that no external modification happens while the compiler is active - // So we can store the old assets and only diff to them to avoid fs access on - // incremental builds - let oldAssets; + var nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true + } - compiler.hooks.emit.tapAsync( - { - name: "CleanPlugin", - stage: 100 - }, - (compilation, callback) => { - const hooks = CleanPlugin.getCompilationHooks(compilation); - const logger = compilation.getLogger("webpack.CleanPlugin"); - const fs = compiler.outputFileSystem; + return false + } +} - if (!fs.readdir) { - return callback( - new Error( - "CleanPlugin: Output filesystem doesn't support listing directories (readdir)" - ) - ); - } - const currentAssets = new Set(); - for (const asset of Object.keys(compilation.assets)) { - if (/^[A-Za-z]:\\|^\/|^\\\\/.test(asset)) continue; - let normalizedAsset; - let newNormalizedAsset = asset.replace(/\\/g, "/"); - do { - normalizedAsset = newNormalizedAsset; - newNormalizedAsset = normalizedAsset.replace( - /(^|\/)(?!\.\.)[^/]+\/\.\.\//g, - "$1" - ); - } while (newNormalizedAsset !== normalizedAsset); - if (normalizedAsset.startsWith("../")) continue; - currentAssets.add(normalizedAsset); - } +/***/ }), - const outputPath = compilation.getPath(compiler.outputPath, {}); +/***/ 15235: +/***/ (function(module) { - const isKept = path => { - const result = hooks.keep.call(path); - if (result !== undefined) return result; - return keepFn(path); - }; +"use strict"; - const diffCallback = (err, diff) => { - if (err) { - oldAssets = undefined; - return callback(err); - } - applyDiff(fs, outputPath, dry, logger, diff, isKept, err => { - if (err) { - oldAssets = undefined; - } else { - oldAssets = currentAssets; - } - callback(err); - }); - }; - if (oldAssets) { - diffCallback(null, getDiffToOldAssets(currentAssets, oldAssets)); - } else { - getDiffToFs(fs, outputPath, currentAssets, diffCallback); - } - } - ); - } +module.exports = parseJson +function parseJson (txt, reviver, context) { + context = context || 20 + try { + return JSON.parse(txt, reviver) + } catch (e) { + if (typeof txt !== 'string') { + const isEmptyArray = Array.isArray(txt) && txt.length === 0 + const errorMessage = 'Cannot parse ' + + (isEmptyArray ? 'an empty array' : String(txt)) + throw new TypeError(errorMessage) + } + const syntaxErr = e.message.match(/^Unexpected token.*position\s+(\d+)/i) + const errIdx = syntaxErr + ? +syntaxErr[1] + : e.message.match(/^Unexpected end of JSON.*/i) + ? txt.length - 1 + : null + if (errIdx != null) { + const start = errIdx <= context + ? 0 + : errIdx - context + const end = errIdx + context >= txt.length + ? txt.length + : errIdx + context + e.message += ` while parsing near '${ + start === 0 ? '' : '...' + }${txt.slice(start, end)}${ + end === txt.length ? '' : '...' + }'` + } else { + e.message += ` while parsing '${txt.slice(0, context * 2)}'` + } + throw e + } } -module.exports = CleanPlugin; - /***/ }), -/***/ 2102: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 49448: +/***/ (function(module) { "use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const WebpackError = __webpack_require__(53799); - -/** @typedef {import("./Module")} Module */ -class CodeGenerationError extends WebpackError { - /** - * Create a new CodeGenerationError - * @param {Module} module related module - * @param {Error} error Original error - */ - constructor(module, error) { - super(); - this.name = "CodeGenerationError"; - this.error = error; - this.message = error.message; - this.details = error.stack; - this.module = module; +class LoadingLoaderError extends Error { + constructor(message) { + super(message); + this.name = "LoaderRunnerError"; + Error.captureStackTrace(this, this.constructor); } } -module.exports = CodeGenerationError; +module.exports = LoadingLoaderError; /***/ }), -/***/ 71426: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 68318: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -"use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ +var fs = __webpack_require__(57147); +var readFile = fs.readFile.bind(fs); +var loadLoader = __webpack_require__(55102); +function utf8BufferToString(buf) { + var str = buf.toString("utf-8"); + if(str.charCodeAt(0) === 0xFEFF) { + return str.substr(1); + } else { + return str; + } +} +const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/; -const { provide } = __webpack_require__(82482); -const { first } = __webpack_require__(93347); -const createHash = __webpack_require__(49835); -const { runtimeToString, RuntimeSpecMap } = __webpack_require__(17156); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {typeof import("./util/Hash")} Hash */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ +/** + * @param {string} str the path with query and fragment + * @returns {{ path: string, query: string, fragment: string }} parsed parts + */ +function parsePathQueryFragment(str) { + var match = PATH_QUERY_FRAGMENT_REGEXP.exec(str); + return { + path: match[1].replace(/\0(.)/g, "$1"), + query: match[2] ? match[2].replace(/\0(.)/g, "$1") : "", + fragment: match[3] || "" + }; +} -class CodeGenerationResults { - /** - * @param {string | Hash} hashFunction the hash function to use - */ - constructor(hashFunction = "md4") { - /** @type {Map>} */ - this.map = new Map(); - this._hashFunction = hashFunction; - } +function dirname(path) { + if(path === "/") return "/"; + var i = path.lastIndexOf("/"); + var j = path.lastIndexOf("\\"); + var i2 = path.indexOf("/"); + var j2 = path.indexOf("\\"); + var idx = i > j ? i : j; + var idx2 = i > j ? i2 : j2; + if(idx < 0) return path; + if(idx === idx2) return path.substr(0, idx + 1); + return path.substr(0, idx); +} - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime runtime(s) - * @returns {CodeGenerationResult} the CodeGenerationResult - */ - get(module, runtime) { - const entry = this.map.get(module); - if (entry === undefined) { - throw new Error( - `No code generation entry for ${module.identifier()} (existing entries: ${Array.from( - this.map.keys(), - m => m.identifier() - ).join(", ")})` - ); - } - if (runtime === undefined) { - if (entry.size > 1) { - const results = new Set(entry.values()); - if (results.size !== 1) { - throw new Error( - `No unique code generation entry for unspecified runtime for ${module.identifier()} (existing runtimes: ${Array.from( - entry.keys(), - r => runtimeToString(r) - ).join(", ")}). -Caller might not support runtime-dependent code generation (opt-out via optimization.usedExports: "global").` - ); - } - return first(results); +function createLoaderObject(loader) { + var obj = { + path: null, + query: null, + fragment: null, + options: null, + ident: null, + normal: null, + pitch: null, + raw: null, + data: null, + pitchExecuted: false, + normalExecuted: false + }; + Object.defineProperty(obj, "request", { + enumerable: true, + get: function() { + return obj.path.replace(/#/g, "\0#") + obj.query.replace(/#/g, "\0#") + obj.fragment; + }, + set: function(value) { + if(typeof value === "string") { + var splittedRequest = parsePathQueryFragment(value); + obj.path = splittedRequest.path; + obj.query = splittedRequest.query; + obj.fragment = splittedRequest.fragment; + obj.options = undefined; + obj.ident = undefined; + } else { + if(!value.loader) + throw new Error("request should be a string or object with loader and options (" + JSON.stringify(value) + ")"); + obj.path = value.loader; + obj.fragment = value.fragment || ""; + obj.type = value.type; + obj.options = value.options; + obj.ident = value.ident; + if(obj.options === null) + obj.query = ""; + else if(obj.options === undefined) + obj.query = ""; + else if(typeof obj.options === "string") + obj.query = "?" + obj.options; + else if(obj.ident) + obj.query = "??" + obj.ident; + else if(typeof obj.options === "object" && obj.options.ident) + obj.query = "??" + obj.options.ident; + else + obj.query = "?" + JSON.stringify(obj.options); } - return entry.values().next().value; - } - const result = entry.get(runtime); - if (result === undefined) { - throw new Error( - `No code generation entry for runtime ${runtimeToString( - runtime - )} for ${module.identifier()} (existing runtimes: ${Array.from( - entry.keys(), - r => runtimeToString(r) - ).join(", ")})` - ); } - return result; + }); + obj.request = loader; + if(Object.preventExtensions) { + Object.preventExtensions(obj); } + return obj; +} - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime runtime(s) - * @returns {boolean} true, when we have data for this - */ - has(module, runtime) { - const entry = this.map.get(module); - if (entry === undefined) { - return false; +function runSyncOrAsync(fn, context, args, callback) { + var isSync = true; + var isDone = false; + var isError = false; // internal error + var reportedError = false; + context.async = function async() { + if(isDone) { + if(reportedError) return; // ignore + throw new Error("async(): The callback was already called."); } - if (runtime !== undefined) { - return entry.has(runtime); - } else if (entry.size > 1) { - const results = new Set(entry.values()); - return results.size === 1; - } else { - return entry.size === 1; + isSync = false; + return innerCallback; + }; + var innerCallback = context.callback = function() { + if(isDone) { + if(reportedError) return; // ignore + throw new Error("callback(): The callback was already called."); } - } - - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime runtime(s) - * @param {string} sourceType the source type - * @returns {Source} a source - */ - getSource(module, runtime, sourceType) { - return this.get(module, runtime).sources.get(sourceType); - } - - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime runtime(s) - * @returns {ReadonlySet} runtime requirements - */ - getRuntimeRequirements(module, runtime) { - return this.get(module, runtime).runtimeRequirements; - } - - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime runtime(s) - * @param {string} key data key - * @returns {any} data generated by code generation - */ - getData(module, runtime, key) { - const data = this.get(module, runtime).data; - return data === undefined ? undefined : data.get(key); - } - - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime runtime(s) - * @returns {any} hash of the code generation - */ - getHash(module, runtime) { - const info = this.get(module, runtime); - if (info.hash !== undefined) return info.hash; - const hash = createHash(this._hashFunction); - for (const [type, source] of info.sources) { - hash.update(type); - source.updateHash(hash); + isDone = true; + isSync = false; + try { + callback.apply(null, arguments); + } catch(e) { + isError = true; + throw e; } - if (info.runtimeRequirements) { - for (const rr of info.runtimeRequirements) hash.update(rr); + }; + try { + var result = (function LOADER_EXECUTION() { + return fn.apply(context, args); + }()); + if(isSync) { + isDone = true; + if(result === undefined) + return callback(); + if(result && typeof result === "object" && typeof result.then === "function") { + return result.then(function(r) { + callback(null, r); + }, callback); + } + return callback(null, result); } - return (info.hash = /** @type {string} */ (hash.digest("hex"))); + } catch(e) { + if(isError) throw e; + if(isDone) { + // loader is already "done", so we cannot use the callback function + // for better debugging we print the error on the console + if(typeof e === "object" && e.stack) console.error(e.stack); + else console.error(e); + return; + } + isDone = true; + reportedError = true; + callback(e); } - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime runtime(s) - * @param {CodeGenerationResult} result result from module - * @returns {void} - */ - add(module, runtime, result) { - const map = provide(this.map, module, () => new RuntimeSpecMap()); - map.set(runtime, result); - } } -module.exports = CodeGenerationResults; - - -/***/ }), - -/***/ 98427: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +function convertArgs(args, raw) { + if(!raw && Buffer.isBuffer(args[0])) + args[0] = utf8BufferToString(args[0]); + else if(raw && typeof args[0] === "string") + args[0] = Buffer.from(args[0], "utf-8"); +} +function iteratePitchingLoaders(options, loaderContext, callback) { + // abort after last loader + if(loaderContext.loaderIndex >= loaderContext.loaders.length) + return processResource(options, loaderContext, callback); + var currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex]; -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); + // iterate + if(currentLoaderObject.pitchExecuted) { + loaderContext.loaderIndex++; + return iteratePitchingLoaders(options, loaderContext, callback); + } -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ + // load loader module + loadLoader(currentLoaderObject, function(err) { + if(err) { + loaderContext.cacheable(false); + return callback(err); + } + var fn = currentLoaderObject.pitch; + currentLoaderObject.pitchExecuted = true; + if(!fn) return iteratePitchingLoaders(options, loaderContext, callback); -class CommentCompilationWarning extends WebpackError { - /** - * - * @param {string} message warning message - * @param {DependencyLocation} loc affected lines of code - */ - constructor(message, loc) { - super(message); + runSyncOrAsync( + fn, + loaderContext, [loaderContext.remainingRequest, loaderContext.previousRequest, currentLoaderObject.data = {}], + function(err) { + if(err) return callback(err); + var args = Array.prototype.slice.call(arguments, 1); + // Determine whether to continue the pitching process based on + // argument values (as opposed to argument presence) in order + // to support synchronous and asynchronous usages. + var hasArg = args.some(function(value) { + return value !== undefined; + }); + if(hasArg) { + loaderContext.loaderIndex--; + iterateNormalLoaders(options, loaderContext, args, callback); + } else { + iteratePitchingLoaders(options, loaderContext, callback); + } + } + ); + }); +} - this.name = "CommentCompilationWarning"; +function processResource(options, loaderContext, callback) { + // set loader index to last loader + loaderContext.loaderIndex = loaderContext.loaders.length - 1; - this.loc = loc; + var resourcePath = loaderContext.resourcePath; + if(resourcePath) { + options.processResource(loaderContext, resourcePath, function(err, buffer) { + if(err) return callback(err); + options.resourceBuffer = buffer; + iterateNormalLoaders(options, loaderContext, [buffer], callback); + }); + } else { + iterateNormalLoaders(options, loaderContext, [null], callback); } } -makeSerializable( - CommentCompilationWarning, - "webpack/lib/CommentCompilationWarning" -); - -module.exports = CommentCompilationWarning; - +function iterateNormalLoaders(options, loaderContext, args, callback) { + if(loaderContext.loaderIndex < 0) + return callback(null, args); -/***/ }), + var currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex]; -/***/ 94258: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // iterate + if(currentLoaderObject.normalExecuted) { + loaderContext.loaderIndex--; + return iterateNormalLoaders(options, loaderContext, args, callback); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + var fn = currentLoaderObject.normal; + currentLoaderObject.normalExecuted = true; + if(!fn) { + return iterateNormalLoaders(options, loaderContext, args, callback); + } + convertArgs(args, currentLoaderObject.raw); + runSyncOrAsync(fn, loaderContext, args, function(err) { + if(err) return callback(err); -const ConstDependency = __webpack_require__(76911); + var args = Array.prototype.slice.call(arguments, 1); + iterateNormalLoaders(options, loaderContext, args, callback); + }); +} -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ +exports.getContext = function getContext(resource) { + var path = parsePathQueryFragment(resource).path; + return dirname(path); +}; -const nestedWebpackRequireTag = Symbol("nested __webpack_require__"); +exports.runLoaders = function runLoaders(options, callback) { + // read options + var resource = options.resource || ""; + var loaders = options.loaders || []; + var loaderContext = options.context || {}; + var processResource = options.processResource || ((readResource, context, resource, callback) => { + context.addDependency(resource); + readResource(resource, callback); + }).bind(null, options.readResource || readFile); -class CompatibilityPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "CompatibilityPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyTemplates.set( - ConstDependency, - new ConstDependency.Template() - ); + // + var splittedResource = resource && parsePathQueryFragment(resource); + var resourcePath = splittedResource ? splittedResource.path : undefined; + var resourceQuery = splittedResource ? splittedResource.query : undefined; + var resourceFragment = splittedResource ? splittedResource.fragment : undefined; + var contextDirectory = resourcePath ? dirname(resourcePath) : null; - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("CompatibilityPlugin", (parser, parserOptions) => { - if ( - parserOptions.browserify !== undefined && - !parserOptions.browserify - ) - return; + // execution state + var requestCacheable = true; + var fileDependencies = []; + var contextDependencies = []; + var missingDependencies = []; - parser.hooks.call - .for("require") - .tap("CompatibilityPlugin", expr => { - // support for browserify style require delegator: "require(o, !0)" - if (expr.arguments.length !== 2) return; - const second = parser.evaluateExpression(expr.arguments[1]); - if (!second.isBoolean()) return; - if (second.asBool() !== true) return; - const dep = new ConstDependency("require", expr.callee.range); - dep.loc = expr.loc; - if (parser.state.current.dependencies.length > 0) { - const last = - parser.state.current.dependencies[ - parser.state.current.dependencies.length - 1 - ]; - if ( - last.critical && - last.options && - last.options.request === "." && - last.userRequest === "." && - last.options.recursive - ) - parser.state.current.dependencies.pop(); - } - parser.state.module.addPresentationalDependency(dep); - return true; - }); - }); + // prepare loader objects + loaders = loaders.map(createLoaderObject); - /** - * @param {JavascriptParser} parser the parser - * @returns {void} - */ - const handler = parser => { - // Handle nested requires - parser.hooks.preStatement.tap("CompatibilityPlugin", statement => { - if ( - statement.type === "FunctionDeclaration" && - statement.id && - statement.id.name === "__webpack_require__" - ) { - const newName = `__nested_webpack_require_${statement.range[0]}__`; - parser.tagVariable(statement.id.name, nestedWebpackRequireTag, { - name: newName, - declaration: { - updated: false, - loc: statement.id.loc, - range: statement.id.range - } - }); - return true; - } - }); - parser.hooks.pattern - .for("__webpack_require__") - .tap("CompatibilityPlugin", pattern => { - const newName = `__nested_webpack_require_${pattern.range[0]}__`; - parser.tagVariable(pattern.name, nestedWebpackRequireTag, { - name: newName, - declaration: { - updated: false, - loc: pattern.loc, - range: pattern.range - } - }); - return true; - }); - parser.hooks.expression - .for(nestedWebpackRequireTag) - .tap("CompatibilityPlugin", expr => { - const { name, declaration } = parser.currentTagData; - if (!declaration.updated) { - const dep = new ConstDependency(name, declaration.range); - dep.loc = declaration.loc; - parser.state.module.addPresentationalDependency(dep); - declaration.updated = true; - } - const dep = new ConstDependency(name, expr.range); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); + loaderContext.context = contextDirectory; + loaderContext.loaderIndex = 0; + loaderContext.loaders = loaders; + loaderContext.resourcePath = resourcePath; + loaderContext.resourceQuery = resourceQuery; + loaderContext.resourceFragment = resourceFragment; + loaderContext.async = null; + loaderContext.callback = null; + loaderContext.cacheable = function cacheable(flag) { + if(flag === false) { + requestCacheable = false; + } + }; + loaderContext.dependency = loaderContext.addDependency = function addDependency(file) { + fileDependencies.push(file); + }; + loaderContext.addContextDependency = function addContextDependency(context) { + contextDependencies.push(context); + }; + loaderContext.addMissingDependency = function addMissingDependency(context) { + missingDependencies.push(context); + }; + loaderContext.getDependencies = function getDependencies() { + return fileDependencies.slice(); + }; + loaderContext.getContextDependencies = function getContextDependencies() { + return contextDependencies.slice(); + }; + loaderContext.getMissingDependencies = function getMissingDependencies() { + return missingDependencies.slice(); + }; + loaderContext.clearDependencies = function clearDependencies() { + fileDependencies.length = 0; + contextDependencies.length = 0; + missingDependencies.length = 0; + requestCacheable = true; + }; + Object.defineProperty(loaderContext, "resource", { + enumerable: true, + get: function() { + if(loaderContext.resourcePath === undefined) + return undefined; + return loaderContext.resourcePath.replace(/#/g, "\0#") + loaderContext.resourceQuery.replace(/#/g, "\0#") + loaderContext.resourceFragment; + }, + set: function(value) { + var splittedResource = value && parsePathQueryFragment(value); + loaderContext.resourcePath = splittedResource ? splittedResource.path : undefined; + loaderContext.resourceQuery = splittedResource ? splittedResource.query : undefined; + loaderContext.resourceFragment = splittedResource ? splittedResource.fragment : undefined; + } + }); + Object.defineProperty(loaderContext, "request", { + enumerable: true, + get: function() { + return loaderContext.loaders.map(function(o) { + return o.request; + }).concat(loaderContext.resource || "").join("!"); + } + }); + Object.defineProperty(loaderContext, "remainingRequest", { + enumerable: true, + get: function() { + if(loaderContext.loaderIndex >= loaderContext.loaders.length - 1 && !loaderContext.resource) + return ""; + return loaderContext.loaders.slice(loaderContext.loaderIndex + 1).map(function(o) { + return o.request; + }).concat(loaderContext.resource || "").join("!"); + } + }); + Object.defineProperty(loaderContext, "currentRequest", { + enumerable: true, + get: function() { + return loaderContext.loaders.slice(loaderContext.loaderIndex).map(function(o) { + return o.request; + }).concat(loaderContext.resource || "").join("!"); + } + }); + Object.defineProperty(loaderContext, "previousRequest", { + enumerable: true, + get: function() { + return loaderContext.loaders.slice(0, loaderContext.loaderIndex).map(function(o) { + return o.request; + }).join("!"); + } + }); + Object.defineProperty(loaderContext, "query", { + enumerable: true, + get: function() { + var entry = loaderContext.loaders[loaderContext.loaderIndex]; + return entry.options && typeof entry.options === "object" ? entry.options : entry.query; + } + }); + Object.defineProperty(loaderContext, "data", { + enumerable: true, + get: function() { + return loaderContext.loaders[loaderContext.loaderIndex].data; + } + }); - // Handle hashbang - parser.hooks.program.tap( - "CompatibilityPlugin", - (program, comments) => { - if (comments.length === 0) return; - const c = comments[0]; - if (c.type === "Line" && c.range[0] === 0) { - if (parser.state.source.slice(0, 2).toString() !== "#!") return; - // this is a hashbang comment - const dep = new ConstDependency("//", 0); - dep.loc = c.loc; - parser.state.module.addPresentationalDependency(dep); - } - } - ); - }; + // finish loader context + if(Object.preventExtensions) { + Object.preventExtensions(loaderContext); + } - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("CompatibilityPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("CompatibilityPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("CompatibilityPlugin", handler); + var processOptions = { + resourceBuffer: null, + processResource: processResource + }; + iteratePitchingLoaders(processOptions, loaderContext, function(err, result) { + if(err) { + return callback(err, { + cacheable: requestCacheable, + fileDependencies: fileDependencies, + contextDependencies: contextDependencies, + missingDependencies: missingDependencies + }); + } + callback(null, { + result: result, + resourceBuffer: processOptions.resourceBuffer, + cacheable: requestCacheable, + fileDependencies: fileDependencies, + contextDependencies: contextDependencies, + missingDependencies: missingDependencies + }); + }); +}; + + +/***/ }), + +/***/ 55102: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var LoaderLoadingError = __webpack_require__(49448); +var url; + +module.exports = function loadLoader(loader, callback) { + if(loader.type === "module") { + try { + if(url === undefined) url = __webpack_require__(57310); + var loaderUrl = url.pathToFileURL(loader.path); + var modulePromise = eval("import(" + JSON.stringify(loaderUrl.toString()) + ")"); + modulePromise.then(function(module) { + handleResult(loader, module, callback); + }, callback); + return; + } catch(e) { + callback(e); + } + } else { + try { + var module = require(loader.path); + } catch(e) { + // it is possible for node to choke on a require if the FD descriptor + // limit has been reached. give it a chance to recover. + if(e instanceof Error && e.code === "EMFILE") { + var retry = loadLoader.bind(null, loader, callback); + if(typeof setImmediate === "function") { + // node >= 0.9.0 + return setImmediate(retry); + } else { + // node < 0.9.0 + return process.nextTick(retry); + } } - ); + return callback(e); + } + return handleResult(loader, module, callback); + } +}; + +function handleResult(loader, module, callback) { + if(typeof module !== "function" && typeof module !== "object") { + return callback(new LoaderLoadingError( + "Module '" + loader.path + "' is not a loader (export function or es6 module)" + )); + } + loader.normal = typeof module === "function" ? module : module.default; + loader.pitch = module.pitch; + loader.raw = module.raw; + if(typeof loader.normal !== "function" && typeof loader.pitch !== "function") { + return callback(new LoaderLoadingError( + "Module '" + loader.path + "' is not a loader (must have normal or pitch function)" + )); } + callback(); } -module.exports = CompatibilityPlugin; /***/ }), -/***/ 85720: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 54983: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +var __webpack_unused_export__; +__webpack_unused_export__ = ({ + value: true +}); +exports.Z = void 0; -const asyncLib = __webpack_require__(78175); -const { - HookMap, - SyncHook, - SyncBailHook, - SyncWaterfallHook, - AsyncSeriesHook, - AsyncSeriesBailHook, - AsyncParallelHook -} = __webpack_require__(6967); -const util = __webpack_require__(73837); -const { CachedSource } = __webpack_require__(51255); -const { MultiItemCache } = __webpack_require__(55392); -const Chunk = __webpack_require__(39385); -const ChunkGraph = __webpack_require__(64971); -const ChunkGroup = __webpack_require__(15626); -const ChunkRenderError = __webpack_require__(918); -const ChunkTemplate = __webpack_require__(46341); -const CodeGenerationError = __webpack_require__(2102); -const CodeGenerationResults = __webpack_require__(71426); -const Dependency = __webpack_require__(54912); -const DependencyTemplates = __webpack_require__(9163); -const Entrypoint = __webpack_require__(13795); -const ErrorHelpers = __webpack_require__(59985); -const FileSystemInfo = __webpack_require__(79453); -const { - connectChunkGroupAndChunk, - connectChunkGroupParentAndChild -} = __webpack_require__(37234); -const { - makeWebpackError, - tryRunOrWebpackError -} = __webpack_require__(11351); -const MainTemplate = __webpack_require__(12856); -const Module = __webpack_require__(73208); -const ModuleDependencyError = __webpack_require__(67409); -const ModuleDependencyWarning = __webpack_require__(29656); -const ModuleGraph = __webpack_require__(99988); -const ModuleNotFoundError = __webpack_require__(32882); -const ModuleProfile = __webpack_require__(36418); -const ModuleRestoreError = __webpack_require__(94560); -const ModuleStoreError = __webpack_require__(59001); -const ModuleTemplate = __webpack_require__(62677); -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeTemplate = __webpack_require__(18777); -const Stats = __webpack_require__(31743); -const WebpackError = __webpack_require__(53799); -const buildChunkGraph = __webpack_require__(79233); -const BuildCycleError = __webpack_require__(22273); -const { Logger, LogType } = __webpack_require__(32597); -const StatsFactory = __webpack_require__(92629); -const StatsPrinter = __webpack_require__(30198); -const { equals: arrayEquals } = __webpack_require__(84953); -const AsyncQueue = __webpack_require__(12260); -const LazySet = __webpack_require__(38938); -const { provide } = __webpack_require__(82482); -const WeakTupleMap = __webpack_require__(28745); -const { cachedCleverMerge } = __webpack_require__(60839); -const { - compareLocations, - concatComparators, - compareSelect, - compareIds, - compareStringsNumeric, - compareModulesByIdentifier -} = __webpack_require__(29579); -const createHash = __webpack_require__(49835); const { - arrayToSetDeprecation, - soonFrozenObjectDeprecation, - createFakeHook -} = __webpack_require__(64518); -const processAsyncTree = __webpack_require__(42791); -const { getRuntimeKey } = __webpack_require__(17156); -const { isSourceEqual } = __webpack_require__(41245); + stringHints, + numberHints +} = __webpack_require__(79926); +/** @typedef {import("json-schema").JSONSchema6} JSONSchema6 */ -/** @template T @typedef {import("tapable").AsArray} AsArray */ -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescription */ -/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */ -/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */ -/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */ -/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */ -/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ -/** @typedef {import("./Cache")} Cache */ -/** @typedef {import("./CacheFacade")} CacheFacade */ -/** @typedef {import("./ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Compiler").CompilationParams} CompilationParams */ -/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("./Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("./DependencyTemplate")} DependencyTemplate */ -/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ -/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("./ModuleFactory")} ModuleFactory */ -/** @typedef {import("./ModuleFactory").ModuleFactoryCreateDataContextInfo} ModuleFactoryCreateDataContextInfo */ -/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./RuntimeModule")} RuntimeModule */ -/** @typedef {import("./Template").RenderManifestEntry} RenderManifestEntry */ -/** @typedef {import("./Template").RenderManifestOptions} RenderManifestOptions */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsError} StatsError */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModule} StatsModule */ -/** @typedef {import("./util/Hash")} Hash */ -/** @template T @typedef {import("./util/deprecation").FakeHook} FakeHook */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ +/** @typedef {import("json-schema").JSONSchema7} JSONSchema7 */ -/** - * @callback Callback - * @param {(WebpackError | null)=} err - * @returns {void} - */ +/** @typedef {import("./validate").Schema} Schema */ -/** - * @callback ModuleCallback - * @param {(WebpackError | null)=} err - * @param {Module=} result - * @returns {void} - */ +/** @typedef {import("./validate").ValidationErrorConfiguration} ValidationErrorConfiguration */ -/** - * @callback ModuleFactoryResultCallback - * @param {(WebpackError | null)=} err - * @param {ModuleFactoryResult=} result - * @returns {void} - */ +/** @typedef {import("./validate").PostFormatter} PostFormatter */ -/** - * @callback ModuleOrFactoryResultCallback - * @param {(WebpackError | null)=} err - * @param {Module | ModuleFactoryResult=} result - * @returns {void} - */ +/** @typedef {import("./validate").SchemaUtilErrorObject} SchemaUtilErrorObject */ + +/** @enum {number} */ + +const SPECIFICITY = { + type: 1, + not: 1, + oneOf: 1, + anyOf: 1, + if: 1, + enum: 1, + const: 1, + instanceof: 1, + required: 2, + pattern: 2, + patternRequired: 2, + format: 2, + formatMinimum: 2, + formatMaximum: 2, + minimum: 2, + exclusiveMinimum: 2, + maximum: 2, + exclusiveMaximum: 2, + multipleOf: 2, + uniqueItems: 2, + contains: 2, + minLength: 2, + maxLength: 2, + minItems: 2, + maxItems: 2, + minProperties: 2, + maxProperties: 2, + dependencies: 2, + propertyNames: 2, + additionalItems: 2, + additionalProperties: 2, + absolutePath: 2 +}; /** - * @callback ExecuteModuleCallback - * @param {(WebpackError | null)=} err - * @param {ExecuteModuleResult=} result - * @returns {void} + * + * @param {Array} array + * @param {(item: SchemaUtilErrorObject) => number} fn + * @returns {Array} */ +function filterMax(array, fn) { + const evaluatedMax = array.reduce((max, item) => Math.max(max, fn(item)), 0); + return array.filter(item => fn(item) === evaluatedMax); +} /** - * @callback DepBlockVarDependenciesCallback - * @param {Dependency} dependency - * @returns {any} + * + * @param {Array} children + * @returns {Array} */ -/** @typedef {new (...args: any[]) => Dependency} DepConstructor */ -/** @typedef {Record} CompilationAssets */ +function filterChildren(children) { + let newChildren = children; + newChildren = filterMax(newChildren, + /** + * + * @param {SchemaUtilErrorObject} error + * @returns {number} + */ + error => error.dataPath ? error.dataPath.length : 0); + newChildren = filterMax(newChildren, + /** + * @param {SchemaUtilErrorObject} error + * @returns {number} + */ + error => SPECIFICITY[ + /** @type {keyof typeof SPECIFICITY} */ + error.keyword] || 2); + return newChildren; +} /** - * @typedef {Object} AvailableModulesChunkGroupMapping - * @property {ChunkGroup} chunkGroup - * @property {Set} availableModules - * @property {boolean} needCopy + * Find all children errors + * @param {Array} children + * @param {Array} schemaPaths + * @return {number} returns index of first child */ -/** - * @typedef {Object} DependenciesBlockLike - * @property {Dependency[]} dependencies - * @property {AsyncDependenciesBlock[]} blocks - */ -/** - * @typedef {Object} ChunkPathData - * @property {string|number} id - * @property {string=} name - * @property {string} hash - * @property {function(number): string=} hashWithLength - * @property {(Record)=} contentHash - * @property {(Record string>)=} contentHashWithLength - */ +function findAllChildren(children, schemaPaths) { + let i = children.length - 1; -/** - * @typedef {Object} ChunkHashContext - * @property {CodeGenerationResults} codeGenerationResults results of code generation - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - */ + const predicate = + /** + * @param {string} schemaPath + * @returns {boolean} + */ + schemaPath => children[i].schemaPath.indexOf(schemaPath) !== 0; -/** - * @typedef {Object} RuntimeRequirementsContext - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {CodeGenerationResults} codeGenerationResults the code generation results - */ + while (i > -1 && !schemaPaths.every(predicate)) { + if (children[i].keyword === "anyOf" || children[i].keyword === "oneOf") { + const refs = extractRefs(children[i]); + const childrenStart = findAllChildren(children.slice(0, i), refs.concat(children[i].schemaPath)); + i = childrenStart - 1; + } else { + i -= 1; + } + } + return i + 1; +} /** - * @typedef {Object} ExecuteModuleOptions - * @property {EntryOptions=} entryOptions + * Extracts all refs from schema + * @param {SchemaUtilErrorObject} error + * @return {Array} */ -/** - * @typedef {Object} ExecuteModuleResult - * @property {any} exports - * @property {boolean} cacheable - * @property {Map} assets - * @property {LazySet} fileDependencies - * @property {LazySet} contextDependencies - * @property {LazySet} missingDependencies - * @property {LazySet} buildDependencies + +function extractRefs(error) { + const { + schema + } = error; + + if (!Array.isArray(schema)) { + return []; + } + + return schema.map(({ + $ref + }) => $ref).filter(s => s); +} +/** + * Groups children by their first level parent (assuming that error is root) + * @param {Array} children + * @return {Array} */ + +function groupChildrenByFirstChild(children) { + const result = []; + let i = children.length - 1; + + while (i > 0) { + const child = children[i]; + + if (child.keyword === "anyOf" || child.keyword === "oneOf") { + const refs = extractRefs(child); + const childrenStart = findAllChildren(children.slice(0, i), refs.concat(child.schemaPath)); + + if (childrenStart !== i) { + result.push(Object.assign({}, child, { + children: children.slice(childrenStart, i) + })); + i = childrenStart; + } else { + result.push(child); + } + } else { + result.push(child); + } + + i -= 1; + } + + if (i === 0) { + result.push(children[i]); + } + + return result.reverse(); +} /** - * @typedef {Object} ExecuteModuleArgument - * @property {Module} module - * @property {{ id: string, exports: any, loaded: boolean }=} moduleObject - * @property {any} preparedInfo - * @property {CodeGenerationResult} codeGenerationResult + * @param {string} str + * @param {string} prefix + * @returns {string} */ + +function indent(str, prefix) { + return str.replace(/\n(?!$)/g, `\n${prefix}`); +} /** - * @typedef {Object} ExecuteModuleContext - * @property {Map} assets - * @property {Chunk} chunk - * @property {ChunkGraph} chunkGraph - * @property {function(string): any=} __webpack_require__ + * @param {Schema} schema + * @returns {schema is (Schema & {not: Schema})} */ + +function hasNotInSchema(schema) { + return !!schema.not; +} /** - * @typedef {Object} EntryData - * @property {Dependency[]} dependencies dependencies of the entrypoint that should be evaluated at startup - * @property {Dependency[]} includeDependencies dependencies of the entrypoint that should be included but not evaluated - * @property {EntryOptions} options options of the entrypoint + * @param {Schema} schema + * @return {Schema} */ + +function findFirstTypedSchema(schema) { + if (hasNotInSchema(schema)) { + return findFirstTypedSchema(schema.not); + } + + return schema; +} /** - * @typedef {Object} LogEntry - * @property {string} type - * @property {any[]} args - * @property {number} time - * @property {string[]=} trace + * @param {Schema} schema + * @return {boolean} */ + +function canApplyNot(schema) { + const typedSchema = findFirstTypedSchema(schema); + return likeNumber(typedSchema) || likeInteger(typedSchema) || likeString(typedSchema) || likeNull(typedSchema) || likeBoolean(typedSchema); +} /** - * @typedef {Object} KnownAssetInfo - * @property {boolean=} immutable true, if the asset can be long term cached forever (contains a hash) - * @property {boolean=} minimized whether the asset is minimized - * @property {string | string[]=} fullhash the value(s) of the full hash used for this asset - * @property {string | string[]=} chunkhash the value(s) of the chunk hash used for this asset - * @property {string | string[]=} modulehash the value(s) of the module hash used for this asset - * @property {string | string[]=} contenthash the value(s) of the content hash used for this asset - * @property {string=} sourceFilename when asset was created from a source file (potentially transformed), the original filename relative to compilation context - * @property {number=} size size in bytes, only set after asset has been emitted - * @property {boolean=} development true, when asset is only used for development and doesn't count towards user-facing assets - * @property {boolean=} hotModuleReplacement true, when asset ships data for updating an existing application (HMR) - * @property {boolean=} javascriptModule true, when asset is javascript and an ESM - * @property {Record=} related object of pointers to other assets, keyed by type of relation (only points from parent to child) + * @param {any} maybeObj + * @returns {boolean} */ -/** @typedef {KnownAssetInfo & Record} AssetInfo */ +function isObject(maybeObj) { + return typeof maybeObj === "object" && maybeObj !== null; +} /** - * @typedef {Object} Asset - * @property {string} name the filename of the asset - * @property {Source} source source of the asset - * @property {AssetInfo} info info about the asset + * @param {Schema} schema + * @returns {boolean} */ + +function likeNumber(schema) { + return schema.type === "number" || typeof schema.minimum !== "undefined" || typeof schema.exclusiveMinimum !== "undefined" || typeof schema.maximum !== "undefined" || typeof schema.exclusiveMaximum !== "undefined" || typeof schema.multipleOf !== "undefined"; +} /** - * @typedef {Object} ModulePathData - * @property {string|number} id - * @property {string} hash - * @property {function(number): string=} hashWithLength + * @param {Schema} schema + * @returns {boolean} */ + +function likeInteger(schema) { + return schema.type === "integer" || typeof schema.minimum !== "undefined" || typeof schema.exclusiveMinimum !== "undefined" || typeof schema.maximum !== "undefined" || typeof schema.exclusiveMaximum !== "undefined" || typeof schema.multipleOf !== "undefined"; +} /** - * @typedef {Object} PathData - * @property {ChunkGraph=} chunkGraph - * @property {string=} hash - * @property {function(number): string=} hashWithLength - * @property {(Chunk|ChunkPathData)=} chunk - * @property {(Module|ModulePathData)=} module - * @property {RuntimeSpec=} runtime - * @property {string=} filename - * @property {string=} basename - * @property {string=} query - * @property {string=} contentHashType - * @property {string=} contentHash - * @property {function(number): string=} contentHashWithLength - * @property {boolean=} noChunkHash - * @property {string=} url + * @param {Schema} schema + * @returns {boolean} */ + +function likeString(schema) { + return schema.type === "string" || typeof schema.minLength !== "undefined" || typeof schema.maxLength !== "undefined" || typeof schema.pattern !== "undefined" || typeof schema.format !== "undefined" || typeof schema.formatMinimum !== "undefined" || typeof schema.formatMaximum !== "undefined"; +} /** - * @typedef {Object} KnownNormalizedStatsOptions - * @property {string} context - * @property {RequestShortener} requestShortener - * @property {string} chunksSort - * @property {string} modulesSort - * @property {string} chunkModulesSort - * @property {string} nestedModulesSort - * @property {string} assetsSort - * @property {boolean} ids - * @property {boolean} cachedAssets - * @property {boolean} groupAssetsByEmitStatus - * @property {boolean} groupAssetsByPath - * @property {boolean} groupAssetsByExtension - * @property {number} assetsSpace - * @property {((value: string, asset: StatsAsset) => boolean)[]} excludeAssets - * @property {((name: string, module: StatsModule, type: "module" | "chunk" | "root-of-chunk" | "nested") => boolean)[]} excludeModules - * @property {((warning: StatsError, textValue: string) => boolean)[]} warningsFilter - * @property {boolean} cachedModules - * @property {boolean} orphanModules - * @property {boolean} dependentModules - * @property {boolean} runtimeModules - * @property {boolean} groupModulesByCacheStatus - * @property {boolean} groupModulesByLayer - * @property {boolean} groupModulesByAttributes - * @property {boolean} groupModulesByPath - * @property {boolean} groupModulesByExtension - * @property {boolean} groupModulesByType - * @property {boolean | "auto"} entrypoints - * @property {boolean} chunkGroups - * @property {boolean} chunkGroupAuxiliary - * @property {boolean} chunkGroupChildren - * @property {number} chunkGroupMaxAssets - * @property {number} modulesSpace - * @property {number} chunkModulesSpace - * @property {number} nestedModulesSpace - * @property {false|"none"|"error"|"warn"|"info"|"log"|"verbose"} logging - * @property {((value: string) => boolean)[]} loggingDebug - * @property {boolean} loggingTrace - * @property {any} _env + * @param {Schema} schema + * @returns {boolean} */ -/** @typedef {KnownNormalizedStatsOptions & Omit & Record} NormalizedStatsOptions */ +function likeBoolean(schema) { + return schema.type === "boolean"; +} /** - * @typedef {Object} KnownCreateStatsOptionsContext - * @property {boolean=} forToString + * @param {Schema} schema + * @returns {boolean} */ -/** @typedef {KnownCreateStatsOptionsContext & Record} CreateStatsOptionsContext */ -/** @type {AssetInfo} */ -const EMPTY_ASSET_INFO = Object.freeze({}); +function likeArray(schema) { + return schema.type === "array" || typeof schema.minItems === "number" || typeof schema.maxItems === "number" || typeof schema.uniqueItems !== "undefined" || typeof schema.items !== "undefined" || typeof schema.additionalItems !== "undefined" || typeof schema.contains !== "undefined"; +} +/** + * @param {Schema & {patternRequired?: Array}} schema + * @returns {boolean} + */ -const esmDependencyCategory = "esm"; -// TODO webpack 6: remove -const deprecatedNormalModuleLoaderHook = util.deprecate( - compilation => { - return (__webpack_require__(39).getCompilationHooks)(compilation).loader; - }, - "Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader", - "DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK" -); -// TODO webpack 6: remove -const defineRemovedModuleTemplates = moduleTemplates => { - Object.defineProperties(moduleTemplates, { - asset: { - enumerable: false, - configurable: false, - get: () => { - throw new WebpackError( - "Compilation.moduleTemplates.asset has been removed" - ); - } - }, - webassembly: { - enumerable: false, - configurable: false, - get: () => { - throw new WebpackError( - "Compilation.moduleTemplates.webassembly has been removed" - ); - } - } - }); - moduleTemplates = undefined; -}; +function likeObject(schema) { + return schema.type === "object" || typeof schema.minProperties !== "undefined" || typeof schema.maxProperties !== "undefined" || typeof schema.required !== "undefined" || typeof schema.properties !== "undefined" || typeof schema.patternProperties !== "undefined" || typeof schema.additionalProperties !== "undefined" || typeof schema.dependencies !== "undefined" || typeof schema.propertyNames !== "undefined" || typeof schema.patternRequired !== "undefined"; +} +/** + * @param {Schema} schema + * @returns {boolean} + */ -const byId = compareSelect( - /** - * @param {Chunk} c chunk - * @returns {number | string} id - */ c => c.id, - compareIds -); -const byNameOrHash = concatComparators( - compareSelect( - /** - * @param {Compilation} c compilation - * @returns {string} name - */ - c => c.name, - compareIds - ), - compareSelect( - /** - * @param {Compilation} c compilation - * @returns {string} hash - */ c => c.fullHash, - compareIds - ) -); +function likeNull(schema) { + return schema.type === "null"; +} +/** + * @param {string} type + * @returns {string} + */ -const byMessage = compareSelect(err => `${err.message}`, compareStringsNumeric); -const byModule = compareSelect( - err => (err.module && err.module.identifier()) || "", - compareStringsNumeric -); +function getArticle(type) { + if (/^[aeiou]/i.test(type)) { + return "an"; + } -const byLocation = compareSelect(err => err.loc, compareLocations); + return "a"; +} +/** + * @param {Schema=} schema + * @returns {string} + */ -const compareErrors = concatComparators(byModule, byLocation, byMessage); -/** @type {WeakMap} */ -const unsafeCacheDependencies = new WeakMap(); +function getSchemaNonTypes(schema) { + if (!schema) { + return ""; + } -/** @type {WeakMap} */ -const unsafeCacheData = new WeakMap(); + if (!schema.type) { + if (likeNumber(schema) || likeInteger(schema)) { + return " | should be any non-number"; + } -class Compilation { - /** - * Creates an instance of Compilation. - * @param {Compiler} compiler the compiler which created the compilation - * @param {CompilationParams} params the compilation parameters - */ - constructor(compiler, params) { - this._backCompat = compiler._backCompat; + if (likeString(schema)) { + return " | should be any non-string"; + } - const getNormalModuleLoader = () => deprecatedNormalModuleLoaderHook(this); - /** @typedef {{ additionalAssets?: true | Function }} ProcessAssetsAdditionalOptions */ - /** @type {AsyncSeriesHook<[CompilationAssets], ProcessAssetsAdditionalOptions>} */ - const processAssetsHook = new AsyncSeriesHook(["assets"]); + if (likeArray(schema)) { + return " | should be any non-array"; + } - let savedAssets = new Set(); - const popNewAssets = assets => { - let newAssets = undefined; - for (const file of Object.keys(assets)) { - if (savedAssets.has(file)) continue; - if (newAssets === undefined) { - newAssets = Object.create(null); - } - newAssets[file] = assets[file]; - savedAssets.add(file); - } - return newAssets; - }; - processAssetsHook.intercept({ - name: "Compilation", - call: () => { - savedAssets = new Set(Object.keys(this.assets)); - }, - register: tap => { - const { type, name } = tap; - const { fn, additionalAssets, ...remainingTap } = tap; - const additionalAssetsFn = - additionalAssets === true ? fn : additionalAssets; - const processedAssets = additionalAssetsFn ? new WeakSet() : undefined; - switch (type) { - case "sync": - if (additionalAssetsFn) { - this.hooks.processAdditionalAssets.tap(name, assets => { - if (processedAssets.has(this.assets)) - additionalAssetsFn(assets); - }); - } - return { - ...remainingTap, - type: "async", - fn: (assets, callback) => { - try { - fn(assets); - } catch (e) { - return callback(e); - } - if (processedAssets !== undefined) - processedAssets.add(this.assets); - const newAssets = popNewAssets(assets); - if (newAssets !== undefined) { - this.hooks.processAdditionalAssets.callAsync( - newAssets, - callback - ); - return; - } - callback(); - } - }; - case "async": - if (additionalAssetsFn) { - this.hooks.processAdditionalAssets.tapAsync( - name, - (assets, callback) => { - if (processedAssets.has(this.assets)) - return additionalAssetsFn(assets, callback); - callback(); - } - ); - } - return { - ...remainingTap, - fn: (assets, callback) => { - fn(assets, err => { - if (err) return callback(err); - if (processedAssets !== undefined) - processedAssets.add(this.assets); - const newAssets = popNewAssets(assets); - if (newAssets !== undefined) { - this.hooks.processAdditionalAssets.callAsync( - newAssets, - callback - ); - return; - } - callback(); - }); - } - }; - case "promise": - if (additionalAssetsFn) { - this.hooks.processAdditionalAssets.tapPromise(name, assets => { - if (processedAssets.has(this.assets)) - return additionalAssetsFn(assets); - return Promise.resolve(); - }); - } - return { - ...remainingTap, - fn: assets => { - const p = fn(assets); - if (!p || !p.then) return p; - return p.then(() => { - if (processedAssets !== undefined) - processedAssets.add(this.assets); - const newAssets = popNewAssets(assets); - if (newAssets !== undefined) { - return this.hooks.processAdditionalAssets.promise( - newAssets - ); - } - }); - } - }; - } - } - }); + if (likeObject(schema)) { + return " | should be any non-object"; + } + } - /** @type {SyncHook<[CompilationAssets]>} */ - const afterProcessAssetsHook = new SyncHook(["assets"]); + return ""; +} +/** + * @param {Array} hints + * @returns {string} + */ - /** - * @template T - * @param {string} name name of the hook - * @param {number} stage new stage - * @param {function(): AsArray} getArgs get old hook function args - * @param {string=} code deprecation code (not deprecated when unset) - * @returns {FakeHook, "tap" | "tapAsync" | "tapPromise" | "name">>} fake hook which redirects - */ - const createProcessAssetsHook = (name, stage, getArgs, code) => { - if (!this._backCompat && code) return undefined; - const errorMessage = - reason => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}. -BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`; - const getOptions = options => { - if (typeof options === "string") options = { name: options }; - if (options.stage) { - throw new Error(errorMessage("it's using the 'stage' option")); - } - return { ...options, stage: stage }; - }; - return createFakeHook( - { - name, - /** @type {AsyncSeriesHook["intercept"]} */ - intercept(interceptor) { - throw new Error(errorMessage("it's using 'intercept'")); - }, - /** @type {AsyncSeriesHook["tap"]} */ - tap: (options, fn) => { - processAssetsHook.tap(getOptions(options), () => fn(...getArgs())); - }, - /** @type {AsyncSeriesHook["tapAsync"]} */ - tapAsync: (options, fn) => { - processAssetsHook.tapAsync( - getOptions(options), - (assets, callback) => - /** @type {any} */ (fn)(...getArgs(), callback) - ); - }, - /** @type {AsyncSeriesHook["tapPromise"]} */ - tapPromise: (options, fn) => { - processAssetsHook.tapPromise(getOptions(options), () => - fn(...getArgs()) - ); - } - }, - `${name} is deprecated (use Compilation.hooks.processAssets instead and use one of Compilation.PROCESS_ASSETS_STAGE_* as stage option)`, - code - ); - }; - this.hooks = Object.freeze({ - /** @type {SyncHook<[Module]>} */ - buildModule: new SyncHook(["module"]), - /** @type {SyncHook<[Module]>} */ - rebuildModule: new SyncHook(["module"]), - /** @type {SyncHook<[Module, WebpackError]>} */ - failedModule: new SyncHook(["module", "error"]), - /** @type {SyncHook<[Module]>} */ - succeedModule: new SyncHook(["module"]), - /** @type {SyncHook<[Module]>} */ - stillValidModule: new SyncHook(["module"]), - /** @type {SyncHook<[Dependency, EntryOptions]>} */ - addEntry: new SyncHook(["entry", "options"]), - /** @type {SyncHook<[Dependency, EntryOptions, Error]>} */ - failedEntry: new SyncHook(["entry", "options", "error"]), - /** @type {SyncHook<[Dependency, EntryOptions, Module]>} */ - succeedEntry: new SyncHook(["entry", "options", "module"]), +function formatHints(hints) { + return hints.length > 0 ? `(${hints.join(", ")})` : ""; +} +/** + * @param {Schema} schema + * @param {boolean} logic + * @returns {string[]} + */ - /** @type {SyncWaterfallHook<[(string[] | ReferencedExport)[], Dependency, RuntimeSpec]>} */ - dependencyReferencedExports: new SyncWaterfallHook([ - "referencedExports", - "dependency", - "runtime" - ]), - /** @type {SyncHook<[ExecuteModuleArgument, ExecuteModuleContext]>} */ - executeModule: new SyncHook(["options", "context"]), - /** @type {AsyncParallelHook<[ExecuteModuleArgument, ExecuteModuleContext]>} */ - prepareModuleExecution: new AsyncParallelHook(["options", "context"]), +function getHints(schema, logic) { + if (likeNumber(schema) || likeInteger(schema)) { + return numberHints(schema, logic); + } else if (likeString(schema)) { + return stringHints(schema, logic); + } - /** @type {AsyncSeriesHook<[Iterable]>} */ - finishModules: new AsyncSeriesHook(["modules"]), - /** @type {AsyncSeriesHook<[Module]>} */ - finishRebuildingModule: new AsyncSeriesHook(["module"]), - /** @type {SyncHook<[]>} */ - unseal: new SyncHook([]), - /** @type {SyncHook<[]>} */ - seal: new SyncHook([]), + return []; +} - /** @type {SyncHook<[]>} */ - beforeChunks: new SyncHook([]), - /** @type {SyncHook<[Iterable]>} */ - afterChunks: new SyncHook(["chunks"]), +class ValidationError extends Error { + /** + * @param {Array} errors + * @param {Schema} schema + * @param {ValidationErrorConfiguration} configuration + */ + constructor(errors, schema, configuration = {}) { + super(); + /** @type {string} */ - /** @type {SyncBailHook<[Iterable]>} */ - optimizeDependencies: new SyncBailHook(["modules"]), - /** @type {SyncHook<[Iterable]>} */ - afterOptimizeDependencies: new SyncHook(["modules"]), + this.name = "ValidationError"; + /** @type {Array} */ - /** @type {SyncHook<[]>} */ - optimize: new SyncHook([]), - /** @type {SyncBailHook<[Iterable]>} */ - optimizeModules: new SyncBailHook(["modules"]), - /** @type {SyncHook<[Iterable]>} */ - afterOptimizeModules: new SyncHook(["modules"]), + this.errors = errors; + /** @type {Schema} */ - /** @type {SyncBailHook<[Iterable, ChunkGroup[]]>} */ - optimizeChunks: new SyncBailHook(["chunks", "chunkGroups"]), - /** @type {SyncHook<[Iterable, ChunkGroup[]]>} */ - afterOptimizeChunks: new SyncHook(["chunks", "chunkGroups"]), + this.schema = schema; + let headerNameFromSchema; + let baseDataPathFromSchema; - /** @type {AsyncSeriesHook<[Iterable, Iterable]>} */ - optimizeTree: new AsyncSeriesHook(["chunks", "modules"]), - /** @type {SyncHook<[Iterable, Iterable]>} */ - afterOptimizeTree: new SyncHook(["chunks", "modules"]), + if (schema.title && (!configuration.name || !configuration.baseDataPath)) { + const splittedTitleFromSchema = schema.title.match(/^(.+) (.+)$/); - /** @type {AsyncSeriesBailHook<[Iterable, Iterable]>} */ - optimizeChunkModules: new AsyncSeriesBailHook(["chunks", "modules"]), - /** @type {SyncHook<[Iterable, Iterable]>} */ - afterOptimizeChunkModules: new SyncHook(["chunks", "modules"]), - /** @type {SyncBailHook<[], boolean>} */ - shouldRecord: new SyncBailHook([]), + if (splittedTitleFromSchema) { + if (!configuration.name) { + [, headerNameFromSchema] = splittedTitleFromSchema; + } - /** @type {SyncHook<[Chunk, Set, RuntimeRequirementsContext]>} */ - additionalChunkRuntimeRequirements: new SyncHook([ - "chunk", - "runtimeRequirements", - "context" - ]), - /** @type {HookMap, RuntimeRequirementsContext]>>} */ - runtimeRequirementInChunk: new HookMap( - () => new SyncBailHook(["chunk", "runtimeRequirements", "context"]) - ), - /** @type {SyncHook<[Module, Set, RuntimeRequirementsContext]>} */ - additionalModuleRuntimeRequirements: new SyncHook([ - "module", - "runtimeRequirements", - "context" - ]), - /** @type {HookMap, RuntimeRequirementsContext]>>} */ - runtimeRequirementInModule: new HookMap( - () => new SyncBailHook(["module", "runtimeRequirements", "context"]) - ), - /** @type {SyncHook<[Chunk, Set, RuntimeRequirementsContext]>} */ - additionalTreeRuntimeRequirements: new SyncHook([ - "chunk", - "runtimeRequirements", - "context" - ]), - /** @type {HookMap, RuntimeRequirementsContext]>>} */ - runtimeRequirementInTree: new HookMap( - () => new SyncBailHook(["chunk", "runtimeRequirements", "context"]) - ), + if (!configuration.baseDataPath) { + [,, baseDataPathFromSchema] = splittedTitleFromSchema; + } + } + } + /** @type {string} */ - /** @type {SyncHook<[RuntimeModule, Chunk]>} */ - runtimeModule: new SyncHook(["module", "chunk"]), - /** @type {SyncHook<[Iterable, any]>} */ - reviveModules: new SyncHook(["modules", "records"]), - /** @type {SyncHook<[Iterable]>} */ - beforeModuleIds: new SyncHook(["modules"]), - /** @type {SyncHook<[Iterable]>} */ - moduleIds: new SyncHook(["modules"]), - /** @type {SyncHook<[Iterable]>} */ - optimizeModuleIds: new SyncHook(["modules"]), - /** @type {SyncHook<[Iterable]>} */ - afterOptimizeModuleIds: new SyncHook(["modules"]), + this.headerName = configuration.name || headerNameFromSchema || "Object"; + /** @type {string} */ - /** @type {SyncHook<[Iterable, any]>} */ - reviveChunks: new SyncHook(["chunks", "records"]), - /** @type {SyncHook<[Iterable]>} */ - beforeChunkIds: new SyncHook(["chunks"]), - /** @type {SyncHook<[Iterable]>} */ - chunkIds: new SyncHook(["chunks"]), - /** @type {SyncHook<[Iterable]>} */ - optimizeChunkIds: new SyncHook(["chunks"]), - /** @type {SyncHook<[Iterable]>} */ - afterOptimizeChunkIds: new SyncHook(["chunks"]), + this.baseDataPath = configuration.baseDataPath || baseDataPathFromSchema || "configuration"; + /** @type {PostFormatter | null} */ - /** @type {SyncHook<[Iterable, any]>} */ - recordModules: new SyncHook(["modules", "records"]), - /** @type {SyncHook<[Iterable, any]>} */ - recordChunks: new SyncHook(["chunks", "records"]), + this.postFormatter = configuration.postFormatter || null; + const header = `Invalid ${this.baseDataPath} object. ${this.headerName} has been initialized using ${getArticle(this.baseDataPath)} ${this.baseDataPath} object that does not match the API schema.\n`; + /** @type {string} */ - /** @type {SyncHook<[Iterable]>} */ - optimizeCodeGeneration: new SyncHook(["modules"]), + this.message = `${header}${this.formatValidationErrors(errors)}`; + Error.captureStackTrace(this, this.constructor); + } + /** + * @param {string} path + * @returns {Schema} + */ - /** @type {SyncHook<[]>} */ - beforeModuleHash: new SyncHook([]), - /** @type {SyncHook<[]>} */ - afterModuleHash: new SyncHook([]), - /** @type {SyncHook<[]>} */ - beforeCodeGeneration: new SyncHook([]), - /** @type {SyncHook<[]>} */ - afterCodeGeneration: new SyncHook([]), + getSchemaPart(path) { + const newPath = path.split("/"); + let schemaPart = this.schema; - /** @type {SyncHook<[]>} */ - beforeRuntimeRequirements: new SyncHook([]), - /** @type {SyncHook<[]>} */ - afterRuntimeRequirements: new SyncHook([]), + for (let i = 1; i < newPath.length; i++) { + const inner = schemaPart[ + /** @type {keyof Schema} */ + newPath[i]]; - /** @type {SyncHook<[]>} */ - beforeHash: new SyncHook([]), - /** @type {SyncHook<[Chunk]>} */ - contentHash: new SyncHook(["chunk"]), - /** @type {SyncHook<[]>} */ - afterHash: new SyncHook([]), - /** @type {SyncHook<[any]>} */ - recordHash: new SyncHook(["records"]), - /** @type {SyncHook<[Compilation, any]>} */ - record: new SyncHook(["compilation", "records"]), + if (!inner) { + break; + } - /** @type {SyncHook<[]>} */ - beforeModuleAssets: new SyncHook([]), - /** @type {SyncBailHook<[], boolean>} */ - shouldGenerateChunkAssets: new SyncBailHook([]), - /** @type {SyncHook<[]>} */ - beforeChunkAssets: new SyncHook([]), - // TODO webpack 6 remove - /** @deprecated */ - additionalChunkAssets: createProcessAssetsHook( - "additionalChunkAssets", - Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL, - () => [this.chunks], - "DEP_WEBPACK_COMPILATION_ADDITIONAL_CHUNK_ASSETS" - ), + schemaPart = inner; + } - // TODO webpack 6 deprecate - /** @deprecated */ - additionalAssets: createProcessAssetsHook( - "additionalAssets", - Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL, - () => [] - ), - // TODO webpack 6 remove - /** @deprecated */ - optimizeChunkAssets: createProcessAssetsHook( - "optimizeChunkAssets", - Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE, - () => [this.chunks], - "DEP_WEBPACK_COMPILATION_OPTIMIZE_CHUNK_ASSETS" - ), - // TODO webpack 6 remove - /** @deprecated */ - afterOptimizeChunkAssets: createProcessAssetsHook( - "afterOptimizeChunkAssets", - Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE + 1, - () => [this.chunks], - "DEP_WEBPACK_COMPILATION_AFTER_OPTIMIZE_CHUNK_ASSETS" - ), - // TODO webpack 6 deprecate - /** @deprecated */ - optimizeAssets: processAssetsHook, - // TODO webpack 6 deprecate - /** @deprecated */ - afterOptimizeAssets: afterProcessAssetsHook, + return schemaPart; + } + /** + * @param {Schema} schema + * @param {boolean} logic + * @param {Array} prevSchemas + * @returns {string} + */ - processAssets: processAssetsHook, - afterProcessAssets: afterProcessAssetsHook, - /** @type {AsyncSeriesHook<[CompilationAssets]>} */ - processAdditionalAssets: new AsyncSeriesHook(["assets"]), - /** @type {SyncBailHook<[], boolean>} */ - needAdditionalSeal: new SyncBailHook([]), - /** @type {AsyncSeriesHook<[]>} */ - afterSeal: new AsyncSeriesHook([]), + formatSchema(schema, logic = true, prevSchemas = []) { + let newLogic = logic; - /** @type {SyncWaterfallHook<[RenderManifestEntry[], RenderManifestOptions]>} */ - renderManifest: new SyncWaterfallHook(["result", "options"]), + const formatInnerSchema = + /** + * + * @param {Object} innerSchema + * @param {boolean=} addSelf + * @returns {string} + */ + (innerSchema, addSelf) => { + if (!addSelf) { + return this.formatSchema(innerSchema, newLogic, prevSchemas); + } - /** @type {SyncHook<[Hash]>} */ - fullHash: new SyncHook(["hash"]), - /** @type {SyncHook<[Chunk, Hash, ChunkHashContext]>} */ - chunkHash: new SyncHook(["chunk", "chunkHash", "ChunkHashContext"]), + if (prevSchemas.includes(innerSchema)) { + return "(recursive)"; + } - /** @type {SyncHook<[Module, string]>} */ - moduleAsset: new SyncHook(["module", "filename"]), - /** @type {SyncHook<[Chunk, string]>} */ - chunkAsset: new SyncHook(["chunk", "filename"]), + return this.formatSchema(innerSchema, newLogic, prevSchemas.concat(schema)); + }; - /** @type {SyncWaterfallHook<[string, object, AssetInfo]>} */ - assetPath: new SyncWaterfallHook(["path", "options", "assetInfo"]), + if (hasNotInSchema(schema) && !likeObject(schema)) { + if (canApplyNot(schema.not)) { + newLogic = !logic; + return formatInnerSchema(schema.not); + } - /** @type {SyncBailHook<[], boolean>} */ - needAdditionalPass: new SyncBailHook([]), + const needApplyLogicHere = !schema.not.not; + const prefix = logic ? "" : "non "; + newLogic = !logic; + return needApplyLogicHere ? prefix + formatInnerSchema(schema.not) : formatInnerSchema(schema.not); + } - /** @type {SyncHook<[Compiler, string, number]>} */ - childCompiler: new SyncHook([ - "childCompiler", - "compilerName", - "compilerIndex" - ]), + if ( + /** @type {Schema & {instanceof: string | Array}} */ + schema.instanceof) { + const { + instanceof: value + } = + /** @type {Schema & {instanceof: string | Array}} */ + schema; + const values = !Array.isArray(value) ? [value] : value; + return values.map( + /** + * @param {string} item + * @returns {string} + */ + item => item === "Function" ? "function" : item).join(" | "); + } - /** @type {SyncBailHook<[string, LogEntry], true>} */ - log: new SyncBailHook(["origin", "logEntry"]), + if (schema.enum) { + return ( + /** @type {Array} */ + schema.enum.map(item => JSON.stringify(item)).join(" | ") + ); + } - /** @type {SyncWaterfallHook<[WebpackError[]]>} */ - processWarnings: new SyncWaterfallHook(["warnings"]), - /** @type {SyncWaterfallHook<[WebpackError[]]>} */ - processErrors: new SyncWaterfallHook(["errors"]), + if (typeof schema.const !== "undefined") { + return JSON.stringify(schema.const); + } - /** @type {HookMap, CreateStatsOptionsContext]>>} */ - statsPreset: new HookMap(() => new SyncHook(["options", "context"])), - /** @type {SyncHook<[Partial, CreateStatsOptionsContext]>} */ - statsNormalize: new SyncHook(["options", "context"]), - /** @type {SyncHook<[StatsFactory, NormalizedStatsOptions]>} */ - statsFactory: new SyncHook(["statsFactory", "options"]), - /** @type {SyncHook<[StatsPrinter, NormalizedStatsOptions]>} */ - statsPrinter: new SyncHook(["statsPrinter", "options"]), + if (schema.oneOf) { + return ( + /** @type {Array} */ + schema.oneOf.map(item => formatInnerSchema(item, true)).join(" | ") + ); + } - get normalModuleLoader() { - return getNormalModuleLoader(); - } - }); - /** @type {string=} */ - this.name = undefined; - this.startTime = undefined; - this.endTime = undefined; - /** @type {Compiler} */ - this.compiler = compiler; - this.resolverFactory = compiler.resolverFactory; - this.inputFileSystem = compiler.inputFileSystem; - this.fileSystemInfo = new FileSystemInfo(this.inputFileSystem, { - managedPaths: compiler.managedPaths, - immutablePaths: compiler.immutablePaths, - logger: this.getLogger("webpack.FileSystemInfo"), - hashFunction: compiler.options.output.hashFunction - }); - if (compiler.fileTimestamps) { - this.fileSystemInfo.addFileTimestamps(compiler.fileTimestamps, true); - } - if (compiler.contextTimestamps) { - this.fileSystemInfo.addContextTimestamps( - compiler.contextTimestamps, - true - ); - } - /** @type {Map>} */ - this.valueCacheVersions = new Map(); - this.requestShortener = compiler.requestShortener; - this.compilerPath = compiler.compilerPath; + if (schema.anyOf) { + return ( + /** @type {Array} */ + schema.anyOf.map(item => formatInnerSchema(item, true)).join(" | ") + ); + } - this.logger = this.getLogger("webpack.Compilation"); + if (schema.allOf) { + return ( + /** @type {Array} */ + schema.allOf.map(item => formatInnerSchema(item, true)).join(" & ") + ); + } - const options = compiler.options; - this.options = options; - this.outputOptions = options && options.output; - /** @type {boolean} */ - this.bail = (options && options.bail) || false; - /** @type {boolean} */ - this.profile = (options && options.profile) || false; + if ( + /** @type {JSONSchema7} */ + schema.if) { + const { + if: ifValue, + then: thenValue, + else: elseValue + } = + /** @type {JSONSchema7} */ + schema; + return `${ifValue ? `if ${formatInnerSchema(ifValue)}` : ""}${thenValue ? ` then ${formatInnerSchema(thenValue)}` : ""}${elseValue ? ` else ${formatInnerSchema(elseValue)}` : ""}`; + } - this.params = params; - this.mainTemplate = new MainTemplate(this.outputOptions, this); - this.chunkTemplate = new ChunkTemplate(this.outputOptions, this); - this.runtimeTemplate = new RuntimeTemplate( - this, - this.outputOptions, - this.requestShortener - ); - /** @type {{javascript: ModuleTemplate}} */ - this.moduleTemplates = { - javascript: new ModuleTemplate(this.runtimeTemplate, this) - }; - defineRemovedModuleTemplates(this.moduleTemplates); + if (schema.$ref) { + return formatInnerSchema(this.getSchemaPart(schema.$ref), true); + } - /** @type {Map> | undefined} */ - this.moduleMemCaches = undefined; - /** @type {Map> | undefined} */ - this.moduleMemCaches2 = undefined; - this.moduleGraph = new ModuleGraph(); - /** @type {ChunkGraph} */ - this.chunkGraph = undefined; - /** @type {CodeGenerationResults} */ - this.codeGenerationResults = undefined; + if (likeNumber(schema) || likeInteger(schema)) { + const [type, ...hints] = getHints(schema, logic); + const str = `${type}${hints.length > 0 ? ` ${formatHints(hints)}` : ""}`; + return logic ? str : hints.length > 0 ? `non-${type} | ${str}` : `non-${type}`; + } - /** @type {AsyncQueue} */ - this.processDependenciesQueue = new AsyncQueue({ - name: "processDependencies", - parallelism: options.parallelism || 100, - processor: this._processModuleDependencies.bind(this) - }); - /** @type {AsyncQueue} */ - this.addModuleQueue = new AsyncQueue({ - name: "addModule", - parent: this.processDependenciesQueue, - getKey: module => module.identifier(), - processor: this._addModule.bind(this) - }); - /** @type {AsyncQueue} */ - this.factorizeQueue = new AsyncQueue({ - name: "factorize", - parent: this.addModuleQueue, - processor: this._factorizeModule.bind(this) - }); - /** @type {AsyncQueue} */ - this.buildQueue = new AsyncQueue({ - name: "build", - parent: this.factorizeQueue, - processor: this._buildModule.bind(this) - }); - /** @type {AsyncQueue} */ - this.rebuildQueue = new AsyncQueue({ - name: "rebuild", - parallelism: options.parallelism || 100, - processor: this._rebuildModule.bind(this) - }); + if (likeString(schema)) { + const [type, ...hints] = getHints(schema, logic); + const str = `${type}${hints.length > 0 ? ` ${formatHints(hints)}` : ""}`; + return logic ? str : str === "string" ? "non-string" : `non-string | ${str}`; + } - /** - * Modules in value are building during the build of Module in key. - * Means value blocking key from finishing. - * Needed to detect build cycles. - * @type {WeakMap>} - */ - this.creatingModuleDuringBuild = new WeakMap(); + if (likeBoolean(schema)) { + return `${logic ? "" : "non-"}boolean`; + } - /** @type {Map} */ - this.entries = new Map(); - /** @type {EntryData} */ - this.globalEntry = { - dependencies: [], - includeDependencies: [], - options: { - name: undefined - } - }; - /** @type {Map} */ - this.entrypoints = new Map(); - /** @type {Entrypoint[]} */ - this.asyncEntrypoints = []; - /** @type {Set} */ - this.chunks = new Set(); - /** @type {ChunkGroup[]} */ - this.chunkGroups = []; - /** @type {Map} */ - this.namedChunkGroups = new Map(); - /** @type {Map} */ - this.namedChunks = new Map(); - /** @type {Set} */ - this.modules = new Set(); - if (this._backCompat) { - arrayToSetDeprecation(this.chunks, "Compilation.chunks"); - arrayToSetDeprecation(this.modules, "Compilation.modules"); - } - /** @private @type {Map} */ - this._modules = new Map(); - this.records = null; - /** @type {string[]} */ - this.additionalChunkAssets = []; - /** @type {CompilationAssets} */ - this.assets = {}; - /** @type {Map} */ - this.assetsInfo = new Map(); - /** @type {Map>>} */ - this._assetsRelatedIn = new Map(); - /** @type {WebpackError[]} */ - this.errors = []; - /** @type {WebpackError[]} */ - this.warnings = []; - /** @type {Compilation[]} */ - this.children = []; - /** @type {Map} */ - this.logging = new Map(); - /** @type {Map} */ - this.dependencyFactories = new Map(); - /** @type {DependencyTemplates} */ - this.dependencyTemplates = new DependencyTemplates( - this.outputOptions.hashFunction - ); - this.childrenCounters = {}; - /** @type {Set} */ - this.usedChunkIds = null; - /** @type {Set} */ - this.usedModuleIds = null; - /** @type {boolean} */ - this.needAdditionalPass = false; - /** @type {Set} */ - this._restoredUnsafeCacheModuleEntries = new Set(); - /** @type {Map} */ - this._restoredUnsafeCacheEntries = new Map(); - /** @type {WeakSet} */ - this.builtModules = new WeakSet(); - /** @type {WeakSet} */ - this.codeGeneratedModules = new WeakSet(); - /** @type {WeakSet} */ - this.buildTimeExecutedModules = new WeakSet(); - /** @private @type {Map} */ - this._rebuildingModules = new Map(); - /** @type {Set} */ - this.emittedAssets = new Set(); - /** @type {Set} */ - this.comparedForEmitAssets = new Set(); - /** @type {LazySet} */ - this.fileDependencies = new LazySet(); - /** @type {LazySet} */ - this.contextDependencies = new LazySet(); - /** @type {LazySet} */ - this.missingDependencies = new LazySet(); - /** @type {LazySet} */ - this.buildDependencies = new LazySet(); - // TODO webpack 6 remove - this.compilationDependencies = { - add: util.deprecate( - item => this.fileDependencies.add(item), - "Compilation.compilationDependencies is deprecated (used Compilation.fileDependencies instead)", - "DEP_WEBPACK_COMPILATION_COMPILATION_DEPENDENCIES" - ) - }; + if (likeArray(schema)) { + // not logic already applied in formatValidationError + newLogic = true; + const hints = []; - this._modulesCache = this.getCache("Compilation/modules"); - this._assetsCache = this.getCache("Compilation/assets"); - this._codeGenerationCache = this.getCache("Compilation/codeGeneration"); + if (typeof schema.minItems === "number") { + hints.push(`should not have fewer than ${schema.minItems} item${schema.minItems > 1 ? "s" : ""}`); + } - const unsafeCache = options.module.unsafeCache; - this._unsafeCache = !!unsafeCache; - this._unsafeCachePredicate = - typeof unsafeCache === "function" ? unsafeCache : () => true; - } + if (typeof schema.maxItems === "number") { + hints.push(`should not have more than ${schema.maxItems} item${schema.maxItems > 1 ? "s" : ""}`); + } - getStats() { - return new Stats(this); - } + if (schema.uniqueItems) { + hints.push("should not have duplicate items"); + } - /** - * @param {StatsOptions | string} optionsOrPreset stats option value - * @param {CreateStatsOptionsContext} context context - * @returns {NormalizedStatsOptions} normalized options - */ - createStatsOptions(optionsOrPreset, context = {}) { - if ( - typeof optionsOrPreset === "boolean" || - typeof optionsOrPreset === "string" - ) { - optionsOrPreset = { preset: optionsOrPreset }; - } - if (typeof optionsOrPreset === "object" && optionsOrPreset !== null) { - // We use this method of shallow cloning this object to include - // properties in the prototype chain - /** @type {Partial} */ - const options = {}; - for (const key in optionsOrPreset) { - options[key] = optionsOrPreset[key]; - } - if (options.preset !== undefined) { - this.hooks.statsPreset.for(options.preset).call(options, context); - } - this.hooks.statsNormalize.call(options, context); - return /** @type {NormalizedStatsOptions} */ (options); - } else { - /** @type {Partial} */ - const options = {}; - this.hooks.statsNormalize.call(options, context); - return /** @type {NormalizedStatsOptions} */ (options); - } - } + const hasAdditionalItems = typeof schema.additionalItems === "undefined" || Boolean(schema.additionalItems); + let items = ""; - createStatsFactory(options) { - const statsFactory = new StatsFactory(); - this.hooks.statsFactory.call(statsFactory, options); - return statsFactory; - } + if (schema.items) { + if (Array.isArray(schema.items) && schema.items.length > 0) { + items = `${ + /** @type {Array} */ + schema.items.map(item => formatInnerSchema(item)).join(", ")}`; - createStatsPrinter(options) { - const statsPrinter = new StatsPrinter(); - this.hooks.statsPrinter.call(statsPrinter, options); - return statsPrinter; - } + if (hasAdditionalItems) { + if (schema.additionalItems && isObject(schema.additionalItems) && Object.keys(schema.additionalItems).length > 0) { + hints.push(`additional items should be ${formatInnerSchema(schema.additionalItems)}`); + } + } + } else if (schema.items && Object.keys(schema.items).length > 0) { + // "additionalItems" is ignored + items = `${formatInnerSchema(schema.items)}`; + } else { + // Fallback for empty `items` value + items = "any"; + } + } else { + // "additionalItems" is ignored + items = "any"; + } - /** - * @param {string} name cache name - * @returns {CacheFacade} the cache facade instance - */ - getCache(name) { - return this.compiler.getCache(name); - } + if (schema.contains && Object.keys(schema.contains).length > 0) { + hints.push(`should contains at least one ${this.formatSchema(schema.contains)} item`); + } - /** - * @param {string | (function(): string)} name name of the logger, or function called once to get the logger name - * @returns {Logger} a logger with that name - */ - getLogger(name) { - if (!name) { - throw new TypeError("Compilation.getLogger(name) called without a name"); - } - /** @type {LogEntry[] | undefined} */ - let logEntries; - return new Logger( - (type, args) => { - if (typeof name === "function") { - name = name(); - if (!name) { - throw new TypeError( - "Compilation.getLogger(name) called with a function not returning a name" - ); - } - } - let trace; - switch (type) { - case LogType.warn: - case LogType.error: - case LogType.trace: - trace = ErrorHelpers.cutOffLoaderExecution(new Error("Trace").stack) - .split("\n") - .slice(3); - break; - } - /** @type {LogEntry} */ - const logEntry = { - time: Date.now(), - type, - args, - trace - }; - if (this.hooks.log.call(name, logEntry) === undefined) { - if (logEntry.type === LogType.profileEnd) { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - if (typeof console.profileEnd === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.profileEnd(`[${name}] ${logEntry.args[0]}`); - } - } - if (logEntries === undefined) { - logEntries = this.logging.get(name); - if (logEntries === undefined) { - logEntries = []; - this.logging.set(name, logEntries); - } - } - logEntries.push(logEntry); - if (logEntry.type === LogType.profile) { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - if (typeof console.profile === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.profile(`[${name}] ${logEntry.args[0]}`); - } - } - } - }, - childName => { - if (typeof name === "function") { - if (typeof childName === "function") { - return this.getLogger(() => { - if (typeof name === "function") { - name = name(); - if (!name) { - throw new TypeError( - "Compilation.getLogger(name) called with a function not returning a name" - ); - } - } - if (typeof childName === "function") { - childName = childName(); - if (!childName) { - throw new TypeError( - "Logger.getChildLogger(name) called with a function not returning a name" - ); - } - } - return `${name}/${childName}`; - }); - } else { - return this.getLogger(() => { - if (typeof name === "function") { - name = name(); - if (!name) { - throw new TypeError( - "Compilation.getLogger(name) called with a function not returning a name" - ); - } - } - return `${name}/${childName}`; - }); - } - } else { - if (typeof childName === "function") { - return this.getLogger(() => { - if (typeof childName === "function") { - childName = childName(); - if (!childName) { - throw new TypeError( - "Logger.getChildLogger(name) called with a function not returning a name" - ); - } - } - return `${name}/${childName}`; - }); - } else { - return this.getLogger(`${name}/${childName}`); - } - } - } - ); - } + return `[${items}${hasAdditionalItems ? ", ..." : ""}]${hints.length > 0 ? ` (${hints.join(", ")})` : ""}`; + } - /** - * @param {Module} module module to be added that was created - * @param {ModuleCallback} callback returns the module in the compilation, - * it could be the passed one (if new), or an already existing in the compilation - * @returns {void} - */ - addModule(module, callback) { - this.addModuleQueue.add(module, callback); - } + if (likeObject(schema)) { + // not logic already applied in formatValidationError + newLogic = true; + const hints = []; - /** - * @param {Module} module module to be added that was created - * @param {ModuleCallback} callback returns the module in the compilation, - * it could be the passed one (if new), or an already existing in the compilation - * @returns {void} - */ - _addModule(module, callback) { - const identifier = module.identifier(); - const alreadyAddedModule = this._modules.get(identifier); - if (alreadyAddedModule) { - return callback(null, alreadyAddedModule); - } + if (typeof schema.minProperties === "number") { + hints.push(`should not have fewer than ${schema.minProperties} ${schema.minProperties > 1 ? "properties" : "property"}`); + } - const currentProfile = this.profile - ? this.moduleGraph.getProfile(module) - : undefined; - if (currentProfile !== undefined) { - currentProfile.markRestoringStart(); - } + if (typeof schema.maxProperties === "number") { + hints.push(`should not have more than ${schema.maxProperties} ${schema.minProperties && schema.minProperties > 1 ? "properties" : "property"}`); + } - this._modulesCache.get(identifier, null, (err, cacheModule) => { - if (err) return callback(new ModuleRestoreError(module, err)); + if (schema.patternProperties && Object.keys(schema.patternProperties).length > 0) { + const patternProperties = Object.keys(schema.patternProperties); + hints.push(`additional property names should match pattern${patternProperties.length > 1 ? "s" : ""} ${patternProperties.map(pattern => JSON.stringify(pattern)).join(" | ")}`); + } - if (currentProfile !== undefined) { - currentProfile.markRestoringEnd(); - currentProfile.markIntegrationStart(); - } + const properties = schema.properties ? Object.keys(schema.properties) : []; + const required = schema.required ? schema.required : []; + const allProperties = [...new Set( + /** @type {Array} */ + [].concat(required).concat(properties))]; + const objectStructure = allProperties.map(property => { + const isRequired = required.includes(property); // Some properties need quotes, maybe we should add check + // Maybe we should output type of property (`foo: string`), but it is looks very unreadable - if (cacheModule) { - cacheModule.updateCacheModule(module); + return `${property}${isRequired ? "" : "?"}`; + }).concat(typeof schema.additionalProperties === "undefined" || Boolean(schema.additionalProperties) ? schema.additionalProperties && isObject(schema.additionalProperties) ? [`: ${formatInnerSchema(schema.additionalProperties)}`] : ["…"] : []).join(", "); + const { + dependencies, + propertyNames, + patternRequired + } = + /** @type {Schema & {patternRequired?: Array;}} */ + schema; - module = cacheModule; - } - this._modules.set(identifier, module); - this.modules.add(module); - if (this._backCompat) - ModuleGraph.setModuleGraphForModule(module, this.moduleGraph); - if (currentProfile !== undefined) { - currentProfile.markIntegrationEnd(); - } - callback(null, module); - }); - } + if (dependencies) { + Object.keys(dependencies).forEach(dependencyName => { + const dependency = dependencies[dependencyName]; - /** - * Fetches a module from a compilation by its identifier - * @param {Module} module the module provided - * @returns {Module} the module requested - */ - getModule(module) { - const identifier = module.identifier(); - return this._modules.get(identifier); - } + if (Array.isArray(dependency)) { + hints.push(`should have ${dependency.length > 1 ? "properties" : "property"} ${dependency.map(dep => `'${dep}'`).join(", ")} when property '${dependencyName}' is present`); + } else { + hints.push(`should be valid according to the schema ${formatInnerSchema(dependency)} when property '${dependencyName}' is present`); + } + }); + } - /** - * Attempts to search for a module by its identifier - * @param {string} identifier identifier (usually path) for module - * @returns {Module|undefined} attempt to search for module and return it, else undefined - */ - findModule(identifier) { - return this._modules.get(identifier); - } + if (propertyNames && Object.keys(propertyNames).length > 0) { + hints.push(`each property name should match format ${JSON.stringify(schema.propertyNames.format)}`); + } - /** - * Schedules a build of the module object - * - * @param {Module} module module to be built - * @param {ModuleCallback} callback the callback - * @returns {void} - */ - buildModule(module, callback) { - this.buildQueue.add(module, callback); - } + if (patternRequired && patternRequired.length > 0) { + hints.push(`should have property matching pattern ${patternRequired.map( + /** + * @param {string} item + * @returns {string} + */ + item => JSON.stringify(item))}`); + } - /** - * Builds the module object - * - * @param {Module} module module to be built - * @param {ModuleCallback} callback the callback - * @returns {void} - */ - _buildModule(module, callback) { - const currentProfile = this.profile - ? this.moduleGraph.getProfile(module) - : undefined; - if (currentProfile !== undefined) { - currentProfile.markBuildingStart(); - } + return `object {${objectStructure ? ` ${objectStructure} ` : ""}}${hints.length > 0 ? ` (${hints.join(", ")})` : ""}`; + } - module.needBuild( - { - compilation: this, - fileSystemInfo: this.fileSystemInfo, - valueCacheVersions: this.valueCacheVersions - }, - (err, needBuild) => { - if (err) return callback(err); + if (likeNull(schema)) { + return `${logic ? "" : "non-"}null`; + } - if (!needBuild) { - if (currentProfile !== undefined) { - currentProfile.markBuildingEnd(); - } - this.hooks.stillValidModule.call(module); - return callback(); - } + if (Array.isArray(schema.type)) { + // not logic already applied in formatValidationError + return `${schema.type.join(" | ")}`; + } // Fallback for unknown keywords + // not logic already applied in formatValidationError - this.hooks.buildModule.call(module); - this.builtModules.add(module); - module.build( - this.options, - this, - this.resolverFactory.get("normal", module.resolveOptions), - this.inputFileSystem, - err => { - if (currentProfile !== undefined) { - currentProfile.markBuildingEnd(); - } - if (err) { - this.hooks.failedModule.call(module, err); - return callback(err); - } - if (currentProfile !== undefined) { - currentProfile.markStoringStart(); - } - this._modulesCache.store(module.identifier(), null, module, err => { - if (currentProfile !== undefined) { - currentProfile.markStoringEnd(); - } - if (err) { - this.hooks.failedModule.call(module, err); - return callback(new ModuleStoreError(module, err)); - } - this.hooks.succeedModule.call(module); - return callback(); - }); - } - ); - } - ); - } + /* istanbul ignore next */ - /** - * @param {Module} module to be processed for deps - * @param {ModuleCallback} callback callback to be triggered - * @returns {void} - */ - processModuleDependencies(module, callback) { - this.processDependenciesQueue.add(module, callback); - } - /** - * @param {Module} module to be processed for deps - * @returns {void} - */ - processModuleDependenciesNonRecursive(module) { - const processDependenciesBlock = block => { - if (block.dependencies) { - let i = 0; - for (const dep of block.dependencies) { - this.moduleGraph.setParents(dep, block, module, i++); - } - } - if (block.blocks) { - for (const b of block.blocks) processDependenciesBlock(b); - } - }; - - processDependenciesBlock(module); - } + return JSON.stringify(schema, null, 2); + } + /** + * @param {Schema=} schemaPart + * @param {(boolean | Array)=} additionalPath + * @param {boolean=} needDot + * @param {boolean=} logic + * @returns {string} + */ - /** - * @param {Module} module to be processed for deps - * @param {ModuleCallback} callback callback to be triggered - * @returns {void} - */ - _processModuleDependencies(module, callback) { - /** @type {Array<{factory: ModuleFactory, dependencies: Dependency[], originModule: Module|null}>} */ - const sortedDependencies = []; - /** @type {DependenciesBlock} */ - let currentBlock; + getSchemaPartText(schemaPart, additionalPath, needDot = false, logic = true) { + if (!schemaPart) { + return ""; + } - /** @type {Map>} */ - let dependencies; - /** @type {DepConstructor} */ - let factoryCacheKey; - /** @type {ModuleFactory} */ - let factoryCacheKey2; - /** @type {Map} */ - let factoryCacheValue; - /** @type {string} */ - let listCacheKey1; - /** @type {string} */ - let listCacheKey2; - /** @type {Dependency[]} */ - let listCacheValue; + if (Array.isArray(additionalPath)) { + for (let i = 0; i < additionalPath.length; i++) { + /** @type {Schema | undefined} */ + const inner = schemaPart[ + /** @type {keyof Schema} */ + additionalPath[i]]; - let inProgressSorting = 1; - let inProgressTransitive = 1; + if (inner) { + // eslint-disable-next-line no-param-reassign + schemaPart = inner; + } else { + break; + } + } + } - const onDependenciesSorted = err => { - if (err) return callback(err); + while (schemaPart.$ref) { + // eslint-disable-next-line no-param-reassign + schemaPart = this.getSchemaPart(schemaPart.$ref); + } - // early exit without changing parallelism back and forth - if (sortedDependencies.length === 0 && inProgressTransitive === 1) { - return callback(); - } + let schemaText = `${this.formatSchema(schemaPart, logic)}${needDot ? "." : ""}`; - // This is nested so we need to allow one additional task - this.processDependenciesQueue.increaseParallelism(); + if (schemaPart.description) { + schemaText += `\n-> ${schemaPart.description}`; + } - for (const item of sortedDependencies) { - inProgressTransitive++; - this.handleModuleCreation(item, err => { - // In V8, the Error objects keep a reference to the functions on the stack. These warnings & - // errors are created inside closures that keep a reference to the Compilation, so errors are - // leaking the Compilation object. - if (err && this.bail) { - if (inProgressTransitive <= 0) return; - inProgressTransitive = -1; - // eslint-disable-next-line no-self-assign - err.stack = err.stack; - onTransitiveTasksFinished(err); - return; - } - if (--inProgressTransitive === 0) onTransitiveTasksFinished(); - }); - } - if (--inProgressTransitive === 0) onTransitiveTasksFinished(); - }; + if (schemaPart.link) { + schemaText += `\n-> Read more at ${schemaPart.link}`; + } - const onTransitiveTasksFinished = err => { - if (err) return callback(err); - this.processDependenciesQueue.decreaseParallelism(); + return schemaText; + } + /** + * @param {Schema=} schemaPart + * @returns {string} + */ - return callback(); - }; - /** - * @param {Dependency} dep dependency - * @param {number} index index in block - * @returns {void} - */ - const processDependency = (dep, index) => { - this.moduleGraph.setParents(dep, currentBlock, module, index); - if (this._unsafeCache) { - try { - const unsafeCachedModule = unsafeCacheDependencies.get(dep); - if (unsafeCachedModule === null) return; - if (unsafeCachedModule !== undefined) { - if ( - this._restoredUnsafeCacheModuleEntries.has(unsafeCachedModule) - ) { - this._handleExistingModuleFromUnsafeCache( - module, - dep, - unsafeCachedModule - ); - return; - } - const identifier = unsafeCachedModule.identifier(); - const cachedModule = - this._restoredUnsafeCacheEntries.get(identifier); - if (cachedModule !== undefined) { - // update unsafe cache to new module - unsafeCacheDependencies.set(dep, cachedModule); - this._handleExistingModuleFromUnsafeCache( - module, - dep, - cachedModule - ); - return; - } - inProgressSorting++; - this._modulesCache.get(identifier, null, (err, cachedModule) => { - if (err) { - if (inProgressSorting <= 0) return; - inProgressSorting = -1; - onDependenciesSorted(err); - return; - } - try { - if (!this._restoredUnsafeCacheEntries.has(identifier)) { - const data = unsafeCacheData.get(cachedModule); - if (data === undefined) { - processDependencyForResolving(dep); - if (--inProgressSorting === 0) onDependenciesSorted(); - return; - } - if (cachedModule !== unsafeCachedModule) { - unsafeCacheDependencies.set(dep, cachedModule); - } - cachedModule.restoreFromUnsafeCache( - data, - this.params.normalModuleFactory, - this.params - ); - this._restoredUnsafeCacheEntries.set( - identifier, - cachedModule - ); - this._restoredUnsafeCacheModuleEntries.add(cachedModule); - if (!this.modules.has(cachedModule)) { - inProgressTransitive++; - this._handleNewModuleFromUnsafeCache( - module, - dep, - cachedModule, - err => { - if (err) { - if (inProgressTransitive <= 0) return; - inProgressTransitive = -1; - onTransitiveTasksFinished(err); - } - if (--inProgressTransitive === 0) - return onTransitiveTasksFinished(); - } - ); - if (--inProgressSorting === 0) onDependenciesSorted(); - return; - } - } - if (unsafeCachedModule !== cachedModule) { - unsafeCacheDependencies.set(dep, cachedModule); - } - this._handleExistingModuleFromUnsafeCache( - module, - dep, - cachedModule - ); // a3 - } catch (err) { - if (inProgressSorting <= 0) return; - inProgressSorting = -1; - onDependenciesSorted(err); - return; - } - if (--inProgressSorting === 0) onDependenciesSorted(); - }); - return; - } - } catch (e) { - console.error(e); - } - } - processDependencyForResolving(dep); - }; + getSchemaPartDescription(schemaPart) { + if (!schemaPart) { + return ""; + } - /** - * @param {Dependency} dep dependency - * @returns {void} - */ - const processDependencyForResolving = dep => { - const resourceIdent = dep.getResourceIdentifier(); - if (resourceIdent !== undefined && resourceIdent !== null) { - const category = dep.category; - const constructor = /** @type {DepConstructor} */ (dep.constructor); - if (factoryCacheKey === constructor) { - // Fast path 1: same constructor as prev item - if (listCacheKey1 === category && listCacheKey2 === resourceIdent) { - // Super fast path 1: also same resource - listCacheValue.push(dep); - return; - } - } else { - const factory = this.dependencyFactories.get(constructor); - if (factory === undefined) { - throw new Error( - `No module factory available for dependency type: ${constructor.name}` - ); - } - if (factoryCacheKey2 === factory) { - // Fast path 2: same factory as prev item - factoryCacheKey = constructor; - if (listCacheKey1 === category && listCacheKey2 === resourceIdent) { - // Super fast path 2: also same resource - listCacheValue.push(dep); - return; - } - } else { - // Slow path - if (factoryCacheKey2 !== undefined) { - // Archive last cache entry - if (dependencies === undefined) dependencies = new Map(); - dependencies.set(factoryCacheKey2, factoryCacheValue); - factoryCacheValue = dependencies.get(factory); - if (factoryCacheValue === undefined) { - factoryCacheValue = new Map(); - } - } else { - factoryCacheValue = new Map(); - } - factoryCacheKey = constructor; - factoryCacheKey2 = factory; - } - } - // Here webpack is using heuristic that assumes - // mostly esm dependencies would be used - // so we don't allocate extra string for them - const cacheKey = - category === esmDependencyCategory - ? resourceIdent - : `${category}${resourceIdent}`; - let list = factoryCacheValue.get(cacheKey); - if (list === undefined) { - factoryCacheValue.set(cacheKey, (list = [])); - sortedDependencies.push({ - factory: factoryCacheKey2, - dependencies: list, - originModule: module - }); - } - list.push(dep); - listCacheKey1 = category; - listCacheKey2 = resourceIdent; - listCacheValue = list; - } - }; + while (schemaPart.$ref) { + // eslint-disable-next-line no-param-reassign + schemaPart = this.getSchemaPart(schemaPart.$ref); + } - try { - /** @type {DependenciesBlock[]} */ - const queue = [module]; - do { - const block = queue.pop(); - if (block.dependencies) { - currentBlock = block; - let i = 0; - for (const dep of block.dependencies) processDependency(dep, i++); - } - if (block.blocks) { - for (const b of block.blocks) queue.push(b); - } - } while (queue.length !== 0); - } catch (e) { - return callback(e); - } + let schemaText = ""; - if (--inProgressSorting === 0) onDependenciesSorted(); - } + if (schemaPart.description) { + schemaText += `\n-> ${schemaPart.description}`; + } - _handleNewModuleFromUnsafeCache(originModule, dependency, module, callback) { - const moduleGraph = this.moduleGraph; + if (schemaPart.link) { + schemaText += `\n-> Read more at ${schemaPart.link}`; + } - moduleGraph.setResolvedModule(originModule, dependency, module); + return schemaText; + } + /** + * @param {SchemaUtilErrorObject} error + * @returns {string} + */ - moduleGraph.setIssuerIfUnset( - module, - originModule !== undefined ? originModule : null - ); - this._modules.set(module.identifier(), module); - this.modules.add(module); - if (this._backCompat) - ModuleGraph.setModuleGraphForModule(module, this.moduleGraph); + formatValidationError(error) { + const { + keyword, + dataPath: errorDataPath + } = error; + const dataPath = `${this.baseDataPath}${errorDataPath}`; - this._handleModuleBuildAndDependencies( - originModule, - module, - true, - callback - ); - } + switch (keyword) { + case "type": + { + const { + parentSchema, + params + } = error; // eslint-disable-next-line default-case - _handleExistingModuleFromUnsafeCache(originModule, dependency, module) { - const moduleGraph = this.moduleGraph; + switch ( + /** @type {import("ajv").TypeParams} */ + params.type) { + case "number": + return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - moduleGraph.setResolvedModule(originModule, dependency, module); - } + case "integer": + return `${dataPath} should be an ${this.getSchemaPartText(parentSchema, false, true)}`; - /** - * @typedef {Object} HandleModuleCreationOptions - * @property {ModuleFactory} factory - * @property {Dependency[]} dependencies - * @property {Module | null} originModule - * @property {Partial=} contextInfo - * @property {string=} context - * @property {boolean=} recursive recurse into dependencies of the created module - * @property {boolean=} connectOrigin connect the resolved module with the origin module - */ + case "string": + return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - /** - * @param {HandleModuleCreationOptions} options options object - * @param {ModuleCallback} callback callback - * @returns {void} - */ - handleModuleCreation( - { - factory, - dependencies, - originModule, - contextInfo, - context, - recursive = true, - connectOrigin = recursive - }, - callback - ) { - const moduleGraph = this.moduleGraph; + case "boolean": + return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - const currentProfile = this.profile ? new ModuleProfile() : undefined; + case "array": + return `${dataPath} should be an array:\n${this.getSchemaPartText(parentSchema)}`; - this.factorizeModule( - { - currentProfile, - factory, - dependencies, - factoryResult: true, - originModule, - contextInfo, - context - }, - (err, factoryResult) => { - const applyFactoryResultDependencies = () => { - const { fileDependencies, contextDependencies, missingDependencies } = - factoryResult; - if (fileDependencies) { - this.fileDependencies.addAll(fileDependencies); - } - if (contextDependencies) { - this.contextDependencies.addAll(contextDependencies); - } - if (missingDependencies) { - this.missingDependencies.addAll(missingDependencies); - } - }; - if (err) { - if (factoryResult) applyFactoryResultDependencies(); - if (dependencies.every(d => d.optional)) { - this.warnings.push(err); - return callback(); - } else { - this.errors.push(err); - return callback(err); - } - } + case "object": + return `${dataPath} should be an object:\n${this.getSchemaPartText(parentSchema)}`; - const newModule = factoryResult.module; + case "null": + return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - if (!newModule) { - applyFactoryResultDependencies(); - return callback(); - } + default: + return `${dataPath} should be:\n${this.getSchemaPartText(parentSchema)}`; + } + } - if (currentProfile !== undefined) { - moduleGraph.setProfile(newModule, currentProfile); - } + case "instanceof": + { + const { + parentSchema + } = error; + return `${dataPath} should be an instance of ${this.getSchemaPartText(parentSchema, false, true)}`; + } - this.addModule(newModule, (err, module) => { - if (err) { - applyFactoryResultDependencies(); - if (!err.module) { - err.module = module; - } - this.errors.push(err); + case "pattern": + { + const { + params, + parentSchema + } = error; + const { + pattern + } = + /** @type {import("ajv").PatternParams} */ + params; + return `${dataPath} should match pattern ${JSON.stringify(pattern)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - return callback(err); - } + case "format": + { + const { + params, + parentSchema + } = error; + const { + format + } = + /** @type {import("ajv").FormatParams} */ + params; + return `${dataPath} should match format ${JSON.stringify(format)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - if ( - this._unsafeCache && - factoryResult.cacheable !== false && - /** @type {any} */ (module).restoreFromUnsafeCache && - this._unsafeCachePredicate(module) - ) { - const unsafeCacheableModule = - /** @type {Module & { restoreFromUnsafeCache: Function }} */ ( - module - ); - for (let i = 0; i < dependencies.length; i++) { - const dependency = dependencies[i]; - moduleGraph.setResolvedModule( - connectOrigin ? originModule : null, - dependency, - unsafeCacheableModule - ); - unsafeCacheDependencies.set(dependency, unsafeCacheableModule); - } - if (!unsafeCacheData.has(unsafeCacheableModule)) { - unsafeCacheData.set( - unsafeCacheableModule, - unsafeCacheableModule.getUnsafeCacheData() - ); - } - } else { - applyFactoryResultDependencies(); - for (let i = 0; i < dependencies.length; i++) { - const dependency = dependencies[i]; - moduleGraph.setResolvedModule( - connectOrigin ? originModule : null, - dependency, - module - ); - } - } + case "formatMinimum": + case "formatMaximum": + { + const { + params, + parentSchema + } = error; + const { + comparison, + limit + } = + /** @type {import("ajv").ComparisonParams} */ + params; + return `${dataPath} should be ${comparison} ${JSON.stringify(limit)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - moduleGraph.setIssuerIfUnset( - module, - originModule !== undefined ? originModule : null - ); - if (module !== newModule) { - if (currentProfile !== undefined) { - const otherProfile = moduleGraph.getProfile(module); - if (otherProfile !== undefined) { - currentProfile.mergeInto(otherProfile); - } else { - moduleGraph.setProfile(module, currentProfile); - } - } - } + case "minimum": + case "maximum": + case "exclusiveMinimum": + case "exclusiveMaximum": + { + const { + parentSchema, + params + } = error; + const { + comparison, + limit + } = + /** @type {import("ajv").ComparisonParams} */ + params; + const [, ...hints] = getHints( + /** @type {Schema} */ + parentSchema, true); - this._handleModuleBuildAndDependencies( - originModule, - module, - recursive, - callback - ); - }); - } - ); - } + if (hints.length === 0) { + hints.push(`should be ${comparison} ${limit}`); + } - _handleModuleBuildAndDependencies(originModule, module, recursive, callback) { - // Check for cycles when build is trigger inside another build - let creatingModuleDuringBuildSet = undefined; - if (!recursive && this.buildQueue.isProcessing(originModule)) { - // Track build dependency - creatingModuleDuringBuildSet = - this.creatingModuleDuringBuild.get(originModule); - if (creatingModuleDuringBuildSet === undefined) { - creatingModuleDuringBuildSet = new Set(); - this.creatingModuleDuringBuild.set( - originModule, - creatingModuleDuringBuildSet - ); - } - creatingModuleDuringBuildSet.add(module); + return `${dataPath} ${hints.join(" ")}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - // When building is blocked by another module - // search for a cycle, cancel the cycle by throwing - // an error (otherwise this would deadlock) - const blockReasons = this.creatingModuleDuringBuild.get(module); - if (blockReasons !== undefined) { - const set = new Set(blockReasons); - for (const item of set) { - const blockReasons = this.creatingModuleDuringBuild.get(item); - if (blockReasons !== undefined) { - for (const m of blockReasons) { - if (m === module) { - return callback(new BuildCycleError(module)); - } - set.add(m); - } - } - } - } - } + case "multipleOf": + { + const { + params, + parentSchema + } = error; + const { + multipleOf + } = + /** @type {import("ajv").MultipleOfParams} */ + params; + return `${dataPath} should be multiple of ${multipleOf}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - this.buildModule(module, err => { - if (creatingModuleDuringBuildSet !== undefined) { - creatingModuleDuringBuildSet.delete(module); - } - if (err) { - if (!err.module) { - err.module = module; - } - this.errors.push(err); + case "patternRequired": + { + const { + params, + parentSchema + } = error; + const { + missingPattern + } = + /** @type {import("ajv").PatternRequiredParams} */ + params; + return `${dataPath} should have property matching pattern ${JSON.stringify(missingPattern)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - return callback(err); - } + case "minLength": + { + const { + params, + parentSchema + } = error; + const { + limit + } = + /** @type {import("ajv").LimitParams} */ + params; - if (!recursive) { - this.processModuleDependenciesNonRecursive(module); - callback(null, module); - return; - } + if (limit === 1) { + return `${dataPath} should be a non-empty string${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - // This avoids deadlocks for circular dependencies - if (this.processDependenciesQueue.isProcessing(module)) { - return callback(); - } + const length = limit - 1; + return `${dataPath} should be longer than ${length} character${length > 1 ? "s" : ""}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - this.processModuleDependencies(module, err => { - if (err) { - return callback(err); - } - callback(null, module); - }); - }); - } + case "minItems": + { + const { + params, + parentSchema + } = error; + const { + limit + } = + /** @type {import("ajv").LimitParams} */ + params; - /** - * @param {FactorizeModuleOptions} options options object - * @param {ModuleOrFactoryResultCallback} callback callback - * @returns {void} - */ - _factorizeModule( - { - currentProfile, - factory, - dependencies, - originModule, - factoryResult, - contextInfo, - context - }, - callback - ) { - if (currentProfile !== undefined) { - currentProfile.markFactoryStart(); - } - factory.create( - { - contextInfo: { - issuer: originModule ? originModule.nameForCondition() : "", - issuerLayer: originModule ? originModule.layer : null, - compiler: this.compiler.name, - ...contextInfo - }, - resolveOptions: originModule ? originModule.resolveOptions : undefined, - context: context - ? context - : originModule - ? originModule.context - : this.compiler.context, - dependencies: dependencies - }, - (err, result) => { - if (result) { - // TODO webpack 6: remove - // For backward-compat - if (result.module === undefined && result instanceof Module) { - result = { - module: result - }; - } - if (!factoryResult) { - const { - fileDependencies, - contextDependencies, - missingDependencies - } = result; - if (fileDependencies) { - this.fileDependencies.addAll(fileDependencies); - } - if (contextDependencies) { - this.contextDependencies.addAll(contextDependencies); - } - if (missingDependencies) { - this.missingDependencies.addAll(missingDependencies); - } - } - } - if (err) { - const notFoundError = new ModuleNotFoundError( - originModule, - err, - dependencies.map(d => d.loc).filter(Boolean)[0] - ); - return callback(notFoundError, factoryResult ? result : undefined); - } - if (!result) { - return callback(); - } + if (limit === 1) { + return `${dataPath} should be a non-empty array${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - if (currentProfile !== undefined) { - currentProfile.markFactoryEnd(); - } + return `${dataPath} should not have fewer than ${limit} items${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - callback(null, factoryResult ? result : result.module); - } - ); - } + case "minProperties": + { + const { + params, + parentSchema + } = error; + const { + limit + } = + /** @type {import("ajv").LimitParams} */ + params; - /** - * @param {string} context context string path - * @param {Dependency} dependency dependency used to create Module chain - * @param {ModuleCallback} callback callback for when module chain is complete - * @returns {void} will throw if dependency instance is not a valid Dependency - */ - addModuleChain(context, dependency, callback) { - return this.addModuleTree({ context, dependency }, callback); - } + if (limit === 1) { + return `${dataPath} should be a non-empty object${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - /** - * @param {Object} options options - * @param {string} options.context context string path - * @param {Dependency} options.dependency dependency used to create Module chain - * @param {Partial=} options.contextInfo additional context info for the root module - * @param {ModuleCallback} callback callback for when module chain is complete - * @returns {void} will throw if dependency instance is not a valid Dependency - */ - addModuleTree({ context, dependency, contextInfo }, callback) { - if ( - typeof dependency !== "object" || - dependency === null || - !dependency.constructor - ) { - return callback( - new WebpackError("Parameter 'dependency' must be a Dependency") - ); - } - const Dep = /** @type {DepConstructor} */ (dependency.constructor); - const moduleFactory = this.dependencyFactories.get(Dep); - if (!moduleFactory) { - return callback( - new WebpackError( - `No dependency factory available for this dependency type: ${dependency.constructor.name}` - ) - ); - } + return `${dataPath} should not have fewer than ${limit} properties${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - this.handleModuleCreation( - { - factory: moduleFactory, - dependencies: [dependency], - originModule: null, - contextInfo, - context - }, - (err, result) => { - if (err && this.bail) { - callback(err); - this.buildQueue.stop(); - this.rebuildQueue.stop(); - this.processDependenciesQueue.stop(); - this.factorizeQueue.stop(); - } else if (!err && result) { - callback(null, result); - } else { - callback(); - } - } - ); - } + case "maxLength": + { + const { + params, + parentSchema + } = error; + const { + limit + } = + /** @type {import("ajv").LimitParams} */ + params; + const max = limit + 1; + return `${dataPath} should be shorter than ${max} character${max > 1 ? "s" : ""}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - /** - * @param {string} context context path for entry - * @param {Dependency} entry entry dependency that should be followed - * @param {string | EntryOptions} optionsOrName options or deprecated name of entry - * @param {ModuleCallback} callback callback function - * @returns {void} returns - */ - addEntry(context, entry, optionsOrName, callback) { - // TODO webpack 6 remove - const options = - typeof optionsOrName === "object" - ? optionsOrName - : { name: optionsOrName }; + case "maxItems": + { + const { + params, + parentSchema + } = error; + const { + limit + } = + /** @type {import("ajv").LimitParams} */ + params; + return `${dataPath} should not have more than ${limit} items${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - this._addEntryItem(context, entry, "dependencies", options, callback); - } + case "maxProperties": + { + const { + params, + parentSchema + } = error; + const { + limit + } = + /** @type {import("ajv").LimitParams} */ + params; + return `${dataPath} should not have more than ${limit} properties${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - /** - * @param {string} context context path for entry - * @param {Dependency} dependency dependency that should be followed - * @param {EntryOptions} options options - * @param {ModuleCallback} callback callback function - * @returns {void} returns - */ - addInclude(context, dependency, options, callback) { - this._addEntryItem( - context, - dependency, - "includeDependencies", - options, - callback - ); - } + case "uniqueItems": + { + const { + params, + parentSchema + } = error; + const { + i + } = + /** @type {import("ajv").UniqueItemsParams} */ + params; + return `${dataPath} should not contain the item '${error.data[i]}' twice${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - /** - * @param {string} context context path for entry - * @param {Dependency} entry entry dependency that should be followed - * @param {"dependencies" | "includeDependencies"} target type of entry - * @param {EntryOptions} options options - * @param {ModuleCallback} callback callback function - * @returns {void} returns - */ - _addEntryItem(context, entry, target, options, callback) { - const { name } = options; - let entryData = - name !== undefined ? this.entries.get(name) : this.globalEntry; - if (entryData === undefined) { - entryData = { - dependencies: [], - includeDependencies: [], - options: { - name: undefined, - ...options - } - }; - entryData[target].push(entry); - this.entries.set(name, entryData); - } else { - entryData[target].push(entry); - for (const key of Object.keys(options)) { - if (options[key] === undefined) continue; - if (entryData.options[key] === options[key]) continue; - if ( - Array.isArray(entryData.options[key]) && - Array.isArray(options[key]) && - arrayEquals(entryData.options[key], options[key]) - ) { - continue; - } - if (entryData.options[key] === undefined) { - entryData.options[key] = options[key]; - } else { - return callback( - new WebpackError( - `Conflicting entry option ${key} = ${entryData.options[key]} vs ${options[key]}` - ) - ); - } - } - } + case "additionalItems": + { + const { + params, + parentSchema + } = error; + const { + limit + } = + /** @type {import("ajv").LimitParams} */ + params; + return `${dataPath} should not have more than ${limit} items${getSchemaNonTypes(parentSchema)}. These items are valid:\n${this.getSchemaPartText(parentSchema)}`; + } - this.hooks.addEntry.call(entry, options); + case "contains": + { + const { + parentSchema + } = error; + return `${dataPath} should contains at least one ${this.getSchemaPartText(parentSchema, ["contains"])} item${getSchemaNonTypes(parentSchema)}.`; + } - this.addModuleTree( - { - context, - dependency: entry, - contextInfo: entryData.options.layer - ? { issuerLayer: entryData.options.layer } - : undefined - }, - (err, module) => { - if (err) { - this.hooks.failedEntry.call(entry, options, err); - return callback(err); - } - this.hooks.succeedEntry.call(entry, options, module); - return callback(null, module); - } - ); - } + case "required": + { + const { + parentSchema, + params + } = error; + const missingProperty = + /** @type {import("ajv").DependenciesParams} */ + params.missingProperty.replace(/^\./, ""); + const hasProperty = parentSchema && Boolean( + /** @type {Schema} */ + parentSchema.properties && + /** @type {Schema} */ + parentSchema.properties[missingProperty]); + return `${dataPath} misses the property '${missingProperty}'${getSchemaNonTypes(parentSchema)}.${hasProperty ? ` Should be:\n${this.getSchemaPartText(parentSchema, ["properties", missingProperty])}` : this.getSchemaPartDescription(parentSchema)}`; + } - /** - * @param {Module} module module to be rebuilt - * @param {ModuleCallback} callback callback when module finishes rebuilding - * @returns {void} - */ - rebuildModule(module, callback) { - this.rebuildQueue.add(module, callback); - } + case "additionalProperties": + { + const { + params, + parentSchema + } = error; + const { + additionalProperty + } = + /** @type {import("ajv").AdditionalPropertiesParams} */ + params; + return `${dataPath} has an unknown property '${additionalProperty}'${getSchemaNonTypes(parentSchema)}. These properties are valid:\n${this.getSchemaPartText(parentSchema)}`; + } - /** - * @param {Module} module module to be rebuilt - * @param {ModuleCallback} callback callback when module finishes rebuilding - * @returns {void} - */ - _rebuildModule(module, callback) { - this.hooks.rebuildModule.call(module); - const oldDependencies = module.dependencies.slice(); - const oldBlocks = module.blocks.slice(); - module.invalidateBuild(); - this.buildQueue.invalidate(module); - this.buildModule(module, err => { - if (err) { - return this.hooks.finishRebuildingModule.callAsync(module, err2 => { - if (err2) { - callback( - makeWebpackError(err2, "Compilation.hooks.finishRebuildingModule") - ); - return; - } - callback(err); - }); - } + case "dependencies": + { + const { + params, + parentSchema + } = error; + const { + property, + deps + } = + /** @type {import("ajv").DependenciesParams} */ + params; + const dependencies = deps.split(",").map( + /** + * @param {string} dep + * @returns {string} + */ + dep => `'${dep.trim()}'`).join(", "); + return `${dataPath} should have properties ${dependencies} when property '${property}' is present${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - this.processDependenciesQueue.invalidate(module); - this.moduleGraph.unfreeze(); - this.processModuleDependencies(module, err => { - if (err) return callback(err); - this.removeReasonsOfDependencyBlock(module, { - dependencies: oldDependencies, - blocks: oldBlocks - }); - this.hooks.finishRebuildingModule.callAsync(module, err2 => { - if (err2) { - callback( - makeWebpackError(err2, "Compilation.hooks.finishRebuildingModule") - ); - return; - } - callback(null, module); - }); - }); - }); - } + case "propertyNames": + { + const { + params, + parentSchema, + schema + } = error; + const { + propertyName + } = + /** @type {import("ajv").PropertyNamesParams} */ + params; + return `${dataPath} property name '${propertyName}' is invalid${getSchemaNonTypes(parentSchema)}. Property names should be match format ${JSON.stringify(schema.format)}.${this.getSchemaPartDescription(parentSchema)}`; + } - _computeAffectedModules(modules) { - const moduleMemCacheCache = this.compiler.moduleMemCaches; - if (!moduleMemCacheCache) return; - if (!this.moduleMemCaches) { - this.moduleMemCaches = new Map(); - this.moduleGraph.setModuleMemCaches(this.moduleMemCaches); - } - const { moduleGraph, moduleMemCaches } = this; - const affectedModules = new Set(); - const infectedModules = new Set(); - let statNew = 0; - let statChanged = 0; - let statUnchanged = 0; - let statReferencesChanged = 0; - let statWithoutBuild = 0; + case "enum": + { + const { + parentSchema + } = error; - const computeReferences = module => { - /** @type {WeakMap} */ - let references = undefined; - for (const connection of moduleGraph.getOutgoingConnections(module)) { - const d = connection.dependency; - const m = connection.module; - if (!d || !m || unsafeCacheDependencies.has(d)) continue; - if (references === undefined) references = new WeakMap(); - references.set(d, m); - } - return references; - }; + if (parentSchema && + /** @type {Schema} */ + parentSchema.enum && + /** @type {Schema} */ + parentSchema.enum.length === 1) { + return `${dataPath} should be ${this.getSchemaPartText(parentSchema, false, true)}`; + } - /** - * @param {Module} module the module - * @param {WeakMap} references references - * @returns {boolean} true, when the references differ - */ - const compareReferences = (module, references) => { - if (references === undefined) return true; - for (const connection of moduleGraph.getOutgoingConnections(module)) { - const d = connection.dependency; - if (!d) continue; - const entry = references.get(d); - if (entry === undefined) continue; - if (entry !== connection.module) return false; - } - return true; - }; + return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}`; + } - const modulesWithoutCache = new Set(modules); - for (const [module, cachedMemCache] of moduleMemCacheCache) { - if (modulesWithoutCache.has(module)) { - const buildInfo = module.buildInfo; - if (buildInfo) { - if (cachedMemCache.buildInfo !== buildInfo) { - // use a new one - const memCache = new WeakTupleMap(); - moduleMemCaches.set(module, memCache); - affectedModules.add(module); - cachedMemCache.buildInfo = buildInfo; - cachedMemCache.references = computeReferences(module); - cachedMemCache.memCache = memCache; - statChanged++; - } else if (!compareReferences(module, cachedMemCache.references)) { - // use a new one - const memCache = new WeakTupleMap(); - moduleMemCaches.set(module, memCache); - affectedModules.add(module); - cachedMemCache.references = computeReferences(module); - cachedMemCache.memCache = memCache; - statReferencesChanged++; - } else { - // keep the old mem cache - moduleMemCaches.set(module, cachedMemCache.memCache); - statUnchanged++; - } - } else { - infectedModules.add(module); - moduleMemCacheCache.delete(module); - statWithoutBuild++; - } - modulesWithoutCache.delete(module); - } else { - moduleMemCacheCache.delete(module); - } - } + case "const": + { + const { + parentSchema + } = error; + return `${dataPath} should be equal to constant ${this.getSchemaPartText(parentSchema, false, true)}`; + } - for (const module of modulesWithoutCache) { - const buildInfo = module.buildInfo; - if (buildInfo) { - // create a new entry - const memCache = new WeakTupleMap(); - moduleMemCacheCache.set(module, { - buildInfo, - references: computeReferences(module), - memCache - }); - moduleMemCaches.set(module, memCache); - affectedModules.add(module); - statNew++; - } else { - infectedModules.add(module); - statWithoutBuild++; - } - } + case "not": + { + const postfix = likeObject( + /** @type {Schema} */ + error.parentSchema) ? `\n${this.getSchemaPartText(error.parentSchema)}` : ""; + const schemaOutput = this.getSchemaPartText(error.schema, false, false, false); - const reduceAffectType = connections => { - let affected = false; - for (const { dependency } of connections) { - if (!dependency) continue; - const type = dependency.couldAffectReferencingModule(); - if (type === Dependency.TRANSITIVE) return Dependency.TRANSITIVE; - if (type === false) continue; - affected = true; - } - return affected; - }; - const directOnlyInfectedModules = new Set(); - for (const module of infectedModules) { - for (const [ - referencingModule, - connections - ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { - if (!referencingModule) continue; - if (infectedModules.has(referencingModule)) continue; - const type = reduceAffectType(connections); - if (!type) continue; - if (type === true) { - directOnlyInfectedModules.add(referencingModule); - } else { - infectedModules.add(referencingModule); - } - } - } - for (const module of directOnlyInfectedModules) infectedModules.add(module); - const directOnlyAffectModules = new Set(); - for (const module of affectedModules) { - for (const [ - referencingModule, - connections - ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { - if (!referencingModule) continue; - if (infectedModules.has(referencingModule)) continue; - if (affectedModules.has(referencingModule)) continue; - const type = reduceAffectType(connections); - if (!type) continue; - if (type === true) { - directOnlyAffectModules.add(referencingModule); - } else { - affectedModules.add(referencingModule); - } - const memCache = new WeakTupleMap(); - const cache = moduleMemCacheCache.get(referencingModule); - cache.memCache = memCache; - moduleMemCaches.set(referencingModule, memCache); - } - } - for (const module of directOnlyAffectModules) affectedModules.add(module); - this.logger.log( - `${Math.round( - (100 * (affectedModules.size + infectedModules.size)) / - this.modules.size - )}% (${affectedModules.size} affected + ${ - infectedModules.size - } infected of ${ - this.modules.size - }) modules flagged as affected (${statNew} new modules, ${statChanged} changed, ${statReferencesChanged} references changed, ${statUnchanged} unchanged, ${statWithoutBuild} were not built)` - ); - } + if (canApplyNot(error.schema)) { + return `${dataPath} should be any ${schemaOutput}${postfix}.`; + } - _computeAffectedModulesWithChunkGraph() { - const { moduleMemCaches } = this; - if (!moduleMemCaches) return; - const moduleMemCaches2 = (this.moduleMemCaches2 = new Map()); - const { moduleGraph, chunkGraph } = this; - const key = "memCache2"; - let statUnchanged = 0; - let statChanged = 0; - let statNew = 0; - /** - * @param {Module} module module - * @returns {{ id: string | number, modules?: Map, blocks?: (string | number)[] }} references - */ - const computeReferences = module => { - const id = chunkGraph.getModuleId(module); - /** @type {Map} */ - let modules = undefined; - /** @type {(string | number)[] | undefined} */ - let blocks = undefined; - const outgoing = moduleGraph.getOutgoingConnectionsByModule(module); - if (outgoing !== undefined) { - for (const m of outgoing.keys()) { - if (!m) continue; - if (modules === undefined) modules = new Map(); - modules.set(m, chunkGraph.getModuleId(m)); - } - } - if (module.blocks.length > 0) { - blocks = []; - const queue = Array.from(module.blocks); - for (const block of queue) { - const chunkGroup = chunkGraph.getBlockChunkGroup(block); - if (chunkGroup) { - for (const chunk of chunkGroup.chunks) { - blocks.push(chunk.id); - } - } else { - blocks.push(null); - } - queue.push.apply(queue, block.blocks); - } - } - return { id, modules, blocks }; - }; - /** - * @param {Module} module module - * @param {Object} references references - * @param {string | number} references.id id - * @param {Map=} references.modules modules - * @param {(string | number)[]=} references.blocks blocks - * @returns {boolean} ok? - */ - const compareReferences = (module, { id, modules, blocks }) => { - if (id !== chunkGraph.getModuleId(module)) return false; - if (modules !== undefined) { - for (const [module, id] of modules) { - if (chunkGraph.getModuleId(module) !== id) return false; - } - } - if (blocks !== undefined) { - const queue = Array.from(module.blocks); - let i = 0; - for (const block of queue) { - const chunkGroup = chunkGraph.getBlockChunkGroup(block); - if (chunkGroup) { - for (const chunk of chunkGroup.chunks) { - if (i >= blocks.length || blocks[i++] !== chunk.id) return false; - } - } else { - if (i >= blocks.length || blocks[i++] !== null) return false; - } - queue.push.apply(queue, block.blocks); - } - if (i !== blocks.length) return false; - } - return true; - }; + const { + schema, + parentSchema + } = error; + return `${dataPath} should not be ${this.getSchemaPartText(schema, false, true)}${parentSchema && likeObject(parentSchema) ? `\n${this.getSchemaPartText(parentSchema)}` : ""}`; + } - for (const [module, memCache] of moduleMemCaches) { - /** @type {{ references: { id: string | number, modules?: Map, blocks?: (string | number)[]}, memCache: WeakTupleMap }} */ - const cache = memCache.get(key); - if (cache === undefined) { - const memCache2 = new WeakTupleMap(); - memCache.set(key, { - references: computeReferences(module), - memCache: memCache2 - }); - moduleMemCaches2.set(module, memCache2); - statNew++; - } else if (!compareReferences(module, cache.references)) { - const memCache = new WeakTupleMap(); - cache.references = computeReferences(module); - cache.memCache = memCache; - moduleMemCaches2.set(module, memCache); - statChanged++; - } else { - moduleMemCaches2.set(module, cache.memCache); - statUnchanged++; - } - } + case "oneOf": + case "anyOf": + { + const { + parentSchema, + children + } = error; - this.logger.log( - `${Math.round( - (100 * statChanged) / (statNew + statChanged + statUnchanged) - )}% modules flagged as affected by chunk graph (${statNew} new modules, ${statChanged} changed, ${statUnchanged} unchanged)` - ); - } + if (children && children.length > 0) { + if (error.schema.length === 1) { + const lastChild = children[children.length - 1]; + const remainingChildren = children.slice(0, children.length - 1); + return this.formatValidationError(Object.assign({}, lastChild, { + children: remainingChildren, + parentSchema: Object.assign({}, parentSchema, lastChild.parentSchema) + })); + } - finish(callback) { - this.factorizeQueue.clear(); - if (this.profile) { - this.logger.time("finish module profiles"); - const ParallelismFactorCalculator = __webpack_require__(50780); - const p = new ParallelismFactorCalculator(); - const moduleGraph = this.moduleGraph; - const modulesWithProfiles = new Map(); - for (const module of this.modules) { - const profile = moduleGraph.getProfile(module); - if (!profile) continue; - modulesWithProfiles.set(module, profile); - p.range( - profile.buildingStartTime, - profile.buildingEndTime, - f => (profile.buildingParallelismFactor = f) - ); - p.range( - profile.factoryStartTime, - profile.factoryEndTime, - f => (profile.factoryParallelismFactor = f) - ); - p.range( - profile.integrationStartTime, - profile.integrationEndTime, - f => (profile.integrationParallelismFactor = f) - ); - p.range( - profile.storingStartTime, - profile.storingEndTime, - f => (profile.storingParallelismFactor = f) - ); - p.range( - profile.restoringStartTime, - profile.restoringEndTime, - f => (profile.restoringParallelismFactor = f) - ); - if (profile.additionalFactoryTimes) { - for (const { start, end } of profile.additionalFactoryTimes) { - const influence = (end - start) / profile.additionalFactories; - p.range( - start, - end, - f => - (profile.additionalFactoriesParallelismFactor += f * influence) - ); - } - } - } - p.calculate(); + let filteredChildren = filterChildren(children); - const logger = this.getLogger("webpack.Compilation.ModuleProfile"); - const logByValue = (value, msg) => { - if (value > 1000) { - logger.error(msg); - } else if (value > 500) { - logger.warn(msg); - } else if (value > 200) { - logger.info(msg); - } else if (value > 30) { - logger.log(msg); - } else { - logger.debug(msg); - } - }; - const logNormalSummary = (category, getDuration, getParallelism) => { - let sum = 0; - let max = 0; - for (const [module, profile] of modulesWithProfiles) { - const p = getParallelism(profile); - const d = getDuration(profile); - if (d === 0 || p === 0) continue; - const t = d / p; - sum += t; - if (t <= 10) continue; - logByValue( - t, - ` | ${Math.round(t)} ms${ - p >= 1.1 ? ` (parallelism ${Math.round(p * 10) / 10})` : "" - } ${category} > ${module.readableIdentifier(this.requestShortener)}` - ); - max = Math.max(max, t); - } - if (sum <= 10) return; - logByValue( - Math.max(sum / 10, max), - `${Math.round(sum)} ms ${category}` - ); - }; - const logByLoadersSummary = (category, getDuration, getParallelism) => { - const map = new Map(); - for (const [module, profile] of modulesWithProfiles) { - const list = provide( - map, - module.type + "!" + module.identifier().replace(/(!|^)[^!]*$/, ""), - () => [] - ); - list.push({ module, profile }); - } + if (filteredChildren.length === 1) { + return this.formatValidationError(filteredChildren[0]); + } - let sum = 0; - let max = 0; - for (const [key, modules] of map) { - let innerSum = 0; - let innerMax = 0; - for (const { module, profile } of modules) { - const p = getParallelism(profile); - const d = getDuration(profile); - if (d === 0 || p === 0) continue; - const t = d / p; - innerSum += t; - if (t <= 10) continue; - logByValue( - t, - ` | | ${Math.round(t)} ms${ - p >= 1.1 ? ` (parallelism ${Math.round(p * 10) / 10})` : "" - } ${category} > ${module.readableIdentifier( - this.requestShortener - )}` - ); - innerMax = Math.max(innerMax, t); - } - sum += innerSum; - if (innerSum <= 10) continue; - const idx = key.indexOf("!"); - const loaders = key.slice(idx + 1); - const moduleType = key.slice(0, idx); - const t = Math.max(innerSum / 10, innerMax); - logByValue( - t, - ` | ${Math.round(innerSum)} ms ${category} > ${ - loaders - ? `${ - modules.length - } x ${moduleType} with ${this.requestShortener.shorten( - loaders - )}` - : `${modules.length} x ${moduleType}` - }` - ); - max = Math.max(max, t); - } - if (sum <= 10) return; - logByValue( - Math.max(sum / 10, max), - `${Math.round(sum)} ms ${category}` - ); - }; - logNormalSummary( - "resolve to new modules", - p => p.factory, - p => p.factoryParallelismFactor - ); - logNormalSummary( - "resolve to existing modules", - p => p.additionalFactories, - p => p.additionalFactoriesParallelismFactor - ); - logNormalSummary( - "integrate modules", - p => p.restoring, - p => p.restoringParallelismFactor - ); - logByLoadersSummary( - "build modules", - p => p.building, - p => p.buildingParallelismFactor - ); - logNormalSummary( - "store modules", - p => p.storing, - p => p.storingParallelismFactor - ); - logNormalSummary( - "restore modules", - p => p.restoring, - p => p.restoringParallelismFactor - ); - this.logger.timeEnd("finish module profiles"); - } - this.logger.time("compute affected modules"); - this._computeAffectedModules(this.modules); - this.logger.timeEnd("compute affected modules"); - this.logger.time("finish modules"); - const { modules, moduleMemCaches } = this; - this.hooks.finishModules.callAsync(modules, err => { - this.logger.timeEnd("finish modules"); - if (err) return callback(err); + filteredChildren = groupChildrenByFirstChild(filteredChildren); + return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}\nDetails:\n${filteredChildren.map( + /** + * @param {SchemaUtilErrorObject} nestedError + * @returns {string} + */ + nestedError => ` * ${indent(this.formatValidationError(nestedError), " ")}`).join("\n")}`; + } - // extract warnings and errors from modules - this.moduleGraph.freeze("dependency errors"); - // TODO keep a cacheToken (= {}) for each module in the graph - // create a new one per compilation and flag all updated files - // and parents with it - this.logger.time("report dependency errors and warnings"); - for (const module of modules) { - // TODO only run for modules with changed cacheToken - // global WeakMap> to keep modules without errors/warnings - const memCache = moduleMemCaches && moduleMemCaches.get(module); - if (memCache && memCache.get("noWarningsOrErrors")) continue; - let hasProblems = this.reportDependencyErrorsAndWarnings(module, [ - module - ]); - const errors = module.getErrors(); - if (errors !== undefined) { - for (const error of errors) { - if (!error.module) { - error.module = module; - } - this.errors.push(error); - hasProblems = true; - } - } - const warnings = module.getWarnings(); - if (warnings !== undefined) { - for (const warning of warnings) { - if (!warning.module) { - warning.module = module; - } - this.warnings.push(warning); - hasProblems = true; - } - } - if (!hasProblems && memCache) memCache.set("noWarningsOrErrors", true); - } - this.moduleGraph.unfreeze(); - this.logger.timeEnd("report dependency errors and warnings"); + return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}`; + } - callback(); - }); - } + case "if": + { + const { + params, + parentSchema + } = error; + const { + failingKeyword + } = + /** @type {import("ajv").IfParams} */ + params; + return `${dataPath} should match "${failingKeyword}" schema:\n${this.getSchemaPartText(parentSchema, [failingKeyword])}`; + } - unseal() { - this.hooks.unseal.call(); - this.chunks.clear(); - this.chunkGroups.length = 0; - this.namedChunks.clear(); - this.namedChunkGroups.clear(); - this.entrypoints.clear(); - this.additionalChunkAssets.length = 0; - this.assets = {}; - this.assetsInfo.clear(); - this.moduleGraph.removeAllModuleAttributes(); - this.moduleGraph.unfreeze(); - this.moduleMemCaches2 = undefined; - } + case "absolutePath": + { + const { + message, + parentSchema + } = error; + return `${dataPath}: ${message}${this.getSchemaPartDescription(parentSchema)}`; + } - /** - * @param {Callback} callback signals when the call finishes - * @returns {void} - */ - seal(callback) { - const finalCallback = err => { - this.factorizeQueue.clear(); - this.buildQueue.clear(); - this.rebuildQueue.clear(); - this.processDependenciesQueue.clear(); - this.addModuleQueue.clear(); - return callback(err); - }; - const chunkGraph = new ChunkGraph( - this.moduleGraph, - this.outputOptions.hashFunction - ); - this.chunkGraph = chunkGraph; + /* istanbul ignore next */ - if (this._backCompat) { - for (const module of this.modules) { - ChunkGraph.setChunkGraphForModule(module, chunkGraph); - } - } + default: + { + const { + message, + parentSchema + } = error; + const ErrorInJSON = JSON.stringify(error, null, 2); // For `custom`, `false schema`, `$ref` keywords + // Fallback for unknown keywords - this.hooks.seal.call(); + return `${dataPath} ${message} (${ErrorInJSON}).\n${this.getSchemaPartText(parentSchema, false)}`; + } + } + } + /** + * @param {Array} errors + * @returns {string} + */ - this.logger.time("optimize dependencies"); - while (this.hooks.optimizeDependencies.call(this.modules)) { - /* empty */ - } - this.hooks.afterOptimizeDependencies.call(this.modules); - this.logger.timeEnd("optimize dependencies"); - this.logger.time("create chunks"); - this.hooks.beforeChunks.call(); - this.moduleGraph.freeze("seal"); - /** @type {Map} */ - const chunkGraphInit = new Map(); - for (const [name, { dependencies, includeDependencies, options }] of this - .entries) { - const chunk = this.addChunk(name); - if (options.filename) { - chunk.filenameTemplate = options.filename; - } - const entrypoint = new Entrypoint(options); - if (!options.dependOn && !options.runtime) { - entrypoint.setRuntimeChunk(chunk); - } - entrypoint.setEntrypointChunk(chunk); - this.namedChunkGroups.set(name, entrypoint); - this.entrypoints.set(name, entrypoint); - this.chunkGroups.push(entrypoint); - connectChunkGroupAndChunk(entrypoint, chunk); + formatValidationErrors(errors) { + return errors.map(error => { + let formattedError = this.formatValidationError(error); - const entryModules = new Set(); - for (const dep of [...this.globalEntry.dependencies, ...dependencies]) { - entrypoint.addOrigin(null, { name }, /** @type {any} */ (dep).request); + if (this.postFormatter) { + formattedError = this.postFormatter(formattedError, error); + } - const module = this.moduleGraph.getModule(dep); - if (module) { - chunkGraph.connectChunkAndEntryModule(chunk, module, entrypoint); - entryModules.add(module); - const modulesList = chunkGraphInit.get(entrypoint); - if (modulesList === undefined) { - chunkGraphInit.set(entrypoint, [module]); - } else { - modulesList.push(module); - } - } - } + return ` - ${indent(formattedError, " ")}`; + }).join("\n"); + } - this.assignDepths(entryModules); +} - const mapAndSort = deps => - deps - .map(dep => this.moduleGraph.getModule(dep)) - .filter(Boolean) - .sort(compareModulesByIdentifier); - const includedModules = [ - ...mapAndSort(this.globalEntry.includeDependencies), - ...mapAndSort(includeDependencies) - ]; +var _default = ValidationError; +exports.Z = _default; - let modulesList = chunkGraphInit.get(entrypoint); - if (modulesList === undefined) { - chunkGraphInit.set(entrypoint, (modulesList = [])); - } - for (const module of includedModules) { - this.assignDepth(module); - modulesList.push(module); - } - } - const runtimeChunks = new Set(); - outer: for (const [ - name, - { - options: { dependOn, runtime } - } - ] of this.entries) { - if (dependOn && runtime) { - const err = - new WebpackError(`Entrypoint '${name}' has 'dependOn' and 'runtime' specified. This is not valid. -Entrypoints that depend on other entrypoints do not have their own runtime. -They will use the runtime(s) from referenced entrypoints instead. -Remove the 'runtime' option from the entrypoint.`); - const entry = this.entrypoints.get(name); - err.chunk = entry.getEntrypointChunk(); - this.errors.push(err); - } - if (dependOn) { - const entry = this.entrypoints.get(name); - const referencedChunks = entry - .getEntrypointChunk() - .getAllReferencedChunks(); - const dependOnEntries = []; - for (const dep of dependOn) { - const dependency = this.entrypoints.get(dep); - if (!dependency) { - throw new Error( - `Entry ${name} depends on ${dep}, but this entry was not found` - ); - } - if (referencedChunks.has(dependency.getEntrypointChunk())) { - const err = new WebpackError( - `Entrypoints '${name}' and '${dep}' use 'dependOn' to depend on each other in a circular way.` - ); - const entryChunk = entry.getEntrypointChunk(); - err.chunk = entryChunk; - this.errors.push(err); - entry.setRuntimeChunk(entryChunk); - continue outer; - } - dependOnEntries.push(dependency); - } - for (const dependency of dependOnEntries) { - connectChunkGroupParentAndChild(dependency, entry); - } - } else if (runtime) { - const entry = this.entrypoints.get(name); - let chunk = this.namedChunks.get(runtime); - if (chunk) { - if (!runtimeChunks.has(chunk)) { - const err = - new WebpackError(`Entrypoint '${name}' has a 'runtime' option which points to another entrypoint named '${runtime}'. -It's not valid to use other entrypoints as runtime chunk. -Did you mean to use 'dependOn: ${JSON.stringify( - runtime - )}' instead to allow using entrypoint '${name}' within the runtime of entrypoint '${runtime}'? For this '${runtime}' must always be loaded when '${name}' is used. -Or do you want to use the entrypoints '${name}' and '${runtime}' independently on the same page with a shared runtime? In this case give them both the same value for the 'runtime' option. It must be a name not already used by an entrypoint.`); - const entryChunk = entry.getEntrypointChunk(); - err.chunk = entryChunk; - this.errors.push(err); - entry.setRuntimeChunk(entryChunk); - continue; - } - } else { - chunk = this.addChunk(runtime); - chunk.preventIntegration = true; - runtimeChunks.add(chunk); - } - entry.unshiftChunk(chunk); - chunk.addGroup(entry); - entry.setRuntimeChunk(chunk); - } - } - buildChunkGraph(this, chunkGraphInit); - this.hooks.afterChunks.call(this.chunks); - this.logger.timeEnd("create chunks"); +/***/ }), - this.logger.time("optimize"); - this.hooks.optimize.call(); +/***/ 81184: +/***/ (function(module) { - while (this.hooks.optimizeModules.call(this.modules)) { - /* empty */ - } - this.hooks.afterOptimizeModules.call(this.modules); +"use strict"; - while (this.hooks.optimizeChunks.call(this.chunks, this.chunkGroups)) { - /* empty */ - } - this.hooks.afterOptimizeChunks.call(this.chunks, this.chunkGroups); - this.hooks.optimizeTree.callAsync(this.chunks, this.modules, err => { - if (err) { - return finalCallback( - makeWebpackError(err, "Compilation.hooks.optimizeTree") - ); - } +/** + * @typedef {[number, boolean]} RangeValue + */ - this.hooks.afterOptimizeTree.call(this.chunks, this.modules); +/** + * @callback RangeValueCallback + * @param {RangeValue} rangeValue + * @returns {boolean} + */ +class Range { + /** + * @param {"left" | "right"} side + * @param {boolean} exclusive + * @returns {">" | ">=" | "<" | "<="} + */ + static getOperator(side, exclusive) { + if (side === "left") { + return exclusive ? ">" : ">="; + } - this.hooks.optimizeChunkModules.callAsync( - this.chunks, - this.modules, - err => { - if (err) { - return finalCallback( - makeWebpackError(err, "Compilation.hooks.optimizeChunkModules") - ); - } + return exclusive ? "<" : "<="; + } + /** + * @param {number} value + * @param {boolean} logic is not logic applied + * @param {boolean} exclusive is range exclusive + * @returns {string} + */ - this.hooks.afterOptimizeChunkModules.call(this.chunks, this.modules); - const shouldRecord = this.hooks.shouldRecord.call() !== false; + static formatRight(value, logic, exclusive) { + if (logic === false) { + return Range.formatLeft(value, !logic, !exclusive); + } - this.hooks.reviveModules.call(this.modules, this.records); - this.hooks.beforeModuleIds.call(this.modules); - this.hooks.moduleIds.call(this.modules); - this.hooks.optimizeModuleIds.call(this.modules); - this.hooks.afterOptimizeModuleIds.call(this.modules); + return `should be ${Range.getOperator("right", exclusive)} ${value}`; + } + /** + * @param {number} value + * @param {boolean} logic is not logic applied + * @param {boolean} exclusive is range exclusive + * @returns {string} + */ - this.hooks.reviveChunks.call(this.chunks, this.records); - this.hooks.beforeChunkIds.call(this.chunks); - this.hooks.chunkIds.call(this.chunks); - this.hooks.optimizeChunkIds.call(this.chunks); - this.hooks.afterOptimizeChunkIds.call(this.chunks); - this.assignRuntimeIds(); + static formatLeft(value, logic, exclusive) { + if (logic === false) { + return Range.formatRight(value, !logic, !exclusive); + } - this.logger.time("compute affected modules with chunk graph"); - this._computeAffectedModulesWithChunkGraph(); - this.logger.timeEnd("compute affected modules with chunk graph"); + return `should be ${Range.getOperator("left", exclusive)} ${value}`; + } + /** + * @param {number} start left side value + * @param {number} end right side value + * @param {boolean} startExclusive is range exclusive from left side + * @param {boolean} endExclusive is range exclusive from right side + * @param {boolean} logic is not logic applied + * @returns {string} + */ - this.sortItemsWithChunkIds(); - if (shouldRecord) { - this.hooks.recordModules.call(this.modules, this.records); - this.hooks.recordChunks.call(this.chunks, this.records); - } + static formatRange(start, end, startExclusive, endExclusive, logic) { + let result = "should be"; + result += ` ${Range.getOperator(logic ? "left" : "right", logic ? startExclusive : !startExclusive)} ${start} `; + result += logic ? "and" : "or"; + result += ` ${Range.getOperator(logic ? "right" : "left", logic ? endExclusive : !endExclusive)} ${end}`; + return result; + } + /** + * @param {Array} values + * @param {boolean} logic is not logic applied + * @return {RangeValue} computed value and it's exclusive flag + */ - this.hooks.optimizeCodeGeneration.call(this.modules); - this.logger.timeEnd("optimize"); - this.logger.time("module hashing"); - this.hooks.beforeModuleHash.call(); - this.createModuleHashes(); - this.hooks.afterModuleHash.call(); - this.logger.timeEnd("module hashing"); + static getRangeValue(values, logic) { + let minMax = logic ? Infinity : -Infinity; + let j = -1; + const predicate = logic ? + /** @type {RangeValueCallback} */ + ([value]) => value <= minMax : + /** @type {RangeValueCallback} */ + ([value]) => value >= minMax; - this.logger.time("code generation"); - this.hooks.beforeCodeGeneration.call(); - this.codeGeneration(err => { - if (err) { - return finalCallback(err); - } - this.hooks.afterCodeGeneration.call(); - this.logger.timeEnd("code generation"); + for (let i = 0; i < values.length; i++) { + if (predicate(values[i])) { + [minMax] = values[i]; + j = i; + } + } - this.logger.time("runtime requirements"); - this.hooks.beforeRuntimeRequirements.call(); - this.processRuntimeRequirements(); - this.hooks.afterRuntimeRequirements.call(); - this.logger.timeEnd("runtime requirements"); + if (j > -1) { + return values[j]; + } - this.logger.time("hashing"); - this.hooks.beforeHash.call(); - const codeGenerationJobs = this.createHash(); - this.hooks.afterHash.call(); - this.logger.timeEnd("hashing"); + return [Infinity, true]; + } - this._runCodeGenerationJobs(codeGenerationJobs, err => { - if (err) { - return finalCallback(err); - } + constructor() { + /** @type {Array} */ + this._left = []; + /** @type {Array} */ - if (shouldRecord) { - this.logger.time("record hash"); - this.hooks.recordHash.call(this.records); - this.logger.timeEnd("record hash"); - } + this._right = []; + } + /** + * @param {number} value + * @param {boolean=} exclusive + */ - this.logger.time("module assets"); - this.clearAssets(); - this.hooks.beforeModuleAssets.call(); - this.createModuleAssets(); - this.logger.timeEnd("module assets"); + left(value, exclusive = false) { + this._left.push([value, exclusive]); + } + /** + * @param {number} value + * @param {boolean=} exclusive + */ - const cont = () => { - this.logger.time("process assets"); - this.hooks.processAssets.callAsync(this.assets, err => { - if (err) { - return finalCallback( - makeWebpackError(err, "Compilation.hooks.processAssets") - ); - } - this.hooks.afterProcessAssets.call(this.assets); - this.logger.timeEnd("process assets"); - this.assets = this._backCompat - ? soonFrozenObjectDeprecation( - this.assets, - "Compilation.assets", - "DEP_WEBPACK_COMPILATION_ASSETS", - `BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation. - Do changes to assets earlier, e. g. in Compilation.hooks.processAssets. - Make sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_*.` - ) - : Object.freeze(this.assets); - this.summarizeDependencies(); - if (shouldRecord) { - this.hooks.record.call(this, this.records); - } + right(value, exclusive = false) { + this._right.push([value, exclusive]); + } + /** + * @param {boolean} logic is not logic applied + * @return {string} "smart" range string representation + */ - if (this.hooks.needAdditionalSeal.call()) { - this.unseal(); - return this.seal(callback); - } - return this.hooks.afterSeal.callAsync(err => { - if (err) { - return finalCallback( - makeWebpackError(err, "Compilation.hooks.afterSeal") - ); - } - this.fileSystemInfo.logStatistics(); - finalCallback(); - }); - }); - }; - this.logger.time("create chunk assets"); - if (this.hooks.shouldGenerateChunkAssets.call() !== false) { - this.hooks.beforeChunkAssets.call(); - this.createChunkAssets(err => { - this.logger.timeEnd("create chunk assets"); - if (err) { - return finalCallback(err); - } - cont(); - }); - } else { - this.logger.timeEnd("create chunk assets"); - cont(); - } - }); - }); - } - ); - }); - } + format(logic = true) { + const [start, leftExclusive] = Range.getRangeValue(this._left, logic); + const [end, rightExclusive] = Range.getRangeValue(this._right, !logic); - /** - * @param {Module} module module to report from - * @param {DependenciesBlock[]} blocks blocks to report from - * @returns {boolean} true, when it has warnings or errors - */ - reportDependencyErrorsAndWarnings(module, blocks) { - let hasProblems = false; - for (let indexBlock = 0; indexBlock < blocks.length; indexBlock++) { - const block = blocks[indexBlock]; - const dependencies = block.dependencies; + if (!Number.isFinite(start) && !Number.isFinite(end)) { + return ""; + } - for (let indexDep = 0; indexDep < dependencies.length; indexDep++) { - const d = dependencies[indexDep]; + const realStart = leftExclusive ? start + 1 : start; + const realEnd = rightExclusive ? end - 1 : end; // e.g. 5 < x < 7, 5 < x <= 6, 6 <= x <= 6 - const warnings = d.getWarnings(this.moduleGraph); - if (warnings) { - for (let indexWar = 0; indexWar < warnings.length; indexWar++) { - const w = warnings[indexWar]; + if (realStart === realEnd) { + return `should be ${logic ? "" : "!"}= ${realStart}`; + } // e.g. 4 < x < ∞ - const warning = new ModuleDependencyWarning(module, w, d.loc); - this.warnings.push(warning); - hasProblems = true; - } - } - const errors = d.getErrors(this.moduleGraph); - if (errors) { - for (let indexErr = 0; indexErr < errors.length; indexErr++) { - const e = errors[indexErr]; - const error = new ModuleDependencyError(module, e, d.loc); - this.errors.push(error); - hasProblems = true; - } - } - } + if (Number.isFinite(start) && !Number.isFinite(end)) { + return Range.formatLeft(start, logic, leftExclusive); + } // e.g. ∞ < x < 4 - if (this.reportDependencyErrorsAndWarnings(module, block.blocks)) - hasProblems = true; - } - return hasProblems; - } - codeGeneration(callback) { - const { chunkGraph } = this; - this.codeGenerationResults = new CodeGenerationResults( - this.outputOptions.hashFunction - ); - /** @type {{module: Module, hash: string, runtime: RuntimeSpec, runtimes: RuntimeSpec[]}[]} */ - const jobs = []; - for (const module of this.modules) { - const runtimes = chunkGraph.getModuleRuntimes(module); - if (runtimes.size === 1) { - for (const runtime of runtimes) { - const hash = chunkGraph.getModuleHash(module, runtime); - jobs.push({ module, hash, runtime, runtimes: [runtime] }); - } - } else if (runtimes.size > 1) { - /** @type {Map} */ - const map = new Map(); - for (const runtime of runtimes) { - const hash = chunkGraph.getModuleHash(module, runtime); - const job = map.get(hash); - if (job === undefined) { - const newJob = { module, hash, runtime, runtimes: [runtime] }; - jobs.push(newJob); - map.set(hash, newJob); - } else { - job.runtimes.push(runtime); - } - } - } - } + if (!Number.isFinite(start) && Number.isFinite(end)) { + return Range.formatRight(end, logic, rightExclusive); + } - this._runCodeGenerationJobs(jobs, callback); - } + return Range.formatRange(start, end, leftExclusive, rightExclusive, logic); + } - _runCodeGenerationJobs(jobs, callback) { - let statModulesFromCache = 0; - let statModulesGenerated = 0; - const { chunkGraph, moduleGraph, dependencyTemplates, runtimeTemplate } = - this; - const results = this.codeGenerationResults; - const errors = []; - /** @type {Set | undefined} */ - let notCodeGeneratedModules = undefined; - const runIteration = () => { - let delayedJobs = []; - let delayedModules = new Set(); - asyncLib.eachLimit( - jobs, - this.options.parallelism, - (job, callback) => { - const { module } = job; - const { codeGenerationDependencies } = module; - if (codeGenerationDependencies !== undefined) { - if ( - notCodeGeneratedModules === undefined || - codeGenerationDependencies.some(dep => { - const referencedModule = moduleGraph.getModule(dep); - return notCodeGeneratedModules.has(referencedModule); - }) - ) { - delayedJobs.push(job); - delayedModules.add(module); - return callback(); - } - } - const { hash, runtime, runtimes } = job; - this._codeGenerationModule( - module, - runtime, - runtimes, - hash, - dependencyTemplates, - chunkGraph, - moduleGraph, - runtimeTemplate, - errors, - results, - (err, codeGenerated) => { - if (codeGenerated) statModulesGenerated++; - else statModulesFromCache++; - callback(err); - } - ); - }, - err => { - if (err) return callback(err); - if (delayedJobs.length > 0) { - if (delayedJobs.length === jobs.length) { - return callback( - new Error( - `Unable to make progress during code generation because of circular code generation dependency: ${Array.from( - delayedModules, - m => m.identifier() - ).join(", ")}` - ) - ); - } - jobs = delayedJobs; - delayedJobs = []; - notCodeGeneratedModules = delayedModules; - delayedModules = new Set(); - return runIteration(); - } - if (errors.length > 0) { - errors.sort( - compareSelect(err => err.module, compareModulesByIdentifier) - ); - for (const error of errors) { - this.errors.push(error); - } - } - this.logger.log( - `${Math.round( - (100 * statModulesGenerated) / - (statModulesGenerated + statModulesFromCache) - )}% code generated (${statModulesGenerated} generated, ${statModulesFromCache} from cache)` - ); - callback(); - } - ); - }; - runIteration(); - } +} - /** - * @param {Module} module module - * @param {RuntimeSpec} runtime runtime - * @param {RuntimeSpec[]} runtimes runtimes - * @param {string} hash hash - * @param {DependencyTemplates} dependencyTemplates dependencyTemplates - * @param {ChunkGraph} chunkGraph chunkGraph - * @param {ModuleGraph} moduleGraph moduleGraph - * @param {RuntimeTemplate} runtimeTemplate runtimeTemplate - * @param {WebpackError[]} errors errors - * @param {CodeGenerationResults} results results - * @param {function(WebpackError=, boolean=): void} callback callback - */ - _codeGenerationModule( - module, - runtime, - runtimes, - hash, - dependencyTemplates, - chunkGraph, - moduleGraph, - runtimeTemplate, - errors, - results, - callback - ) { - let codeGenerated = false; - const cache = new MultiItemCache( - runtimes.map(runtime => - this._codeGenerationCache.getItemCache( - `${module.identifier()}|${getRuntimeKey(runtime)}`, - `${hash}|${dependencyTemplates.getHash()}` - ) - ) - ); - cache.get((err, cachedResult) => { - if (err) return callback(err); - let result; - if (!cachedResult) { - try { - codeGenerated = true; - this.codeGeneratedModules.add(module); - result = module.codeGeneration({ - chunkGraph, - moduleGraph, - dependencyTemplates, - runtimeTemplate, - runtime, - codeGenerationResults: results - }); - } catch (err) { - errors.push(new CodeGenerationError(module, err)); - result = cachedResult = { - sources: new Map(), - runtimeRequirements: null - }; - } - } else { - result = cachedResult; - } - for (const runtime of runtimes) { - results.add(module, runtime, result); - } - if (!cachedResult) { - cache.store(result, err => callback(err, codeGenerated)); - } else { - callback(null, codeGenerated); - } - }); - } +module.exports = Range; - _getChunkGraphEntries() { - /** @type {Set} */ - const treeEntries = new Set(); - for (const ep of this.entrypoints.values()) { - const chunk = ep.getRuntimeChunk(); - if (chunk) treeEntries.add(chunk); - } - for (const ep of this.asyncEntrypoints) { - const chunk = ep.getRuntimeChunk(); - if (chunk) treeEntries.add(chunk); - } - return treeEntries; - } +/***/ }), - /** - * @param {Object} options options - * @param {ChunkGraph=} options.chunkGraph the chunk graph - * @param {Iterable=} options.modules modules - * @param {Iterable=} options.chunks chunks - * @param {CodeGenerationResults=} options.codeGenerationResults codeGenerationResults - * @param {Iterable=} options.chunkGraphEntries chunkGraphEntries - * @returns {void} - */ - processRuntimeRequirements({ - chunkGraph = this.chunkGraph, - modules = this.modules, - chunks = this.chunks, - codeGenerationResults = this.codeGenerationResults, - chunkGraphEntries = this._getChunkGraphEntries() - } = {}) { - const context = { chunkGraph, codeGenerationResults }; - const { moduleMemCaches2 } = this; - this.logger.time("runtime requirements.modules"); - const additionalModuleRuntimeRequirements = - this.hooks.additionalModuleRuntimeRequirements; - const runtimeRequirementInModule = this.hooks.runtimeRequirementInModule; - for (const module of modules) { - if (chunkGraph.getNumberOfModuleChunks(module) > 0) { - const memCache = moduleMemCaches2 && moduleMemCaches2.get(module); - for (const runtime of chunkGraph.getModuleRuntimes(module)) { - if (memCache) { - const cached = memCache.get( - `moduleRuntimeRequirements-${getRuntimeKey(runtime)}` - ); - if (cached !== undefined) { - if (cached !== null) { - chunkGraph.addModuleRuntimeRequirements( - module, - runtime, - cached, - false - ); - } - continue; - } - } - let set; - const runtimeRequirements = - codeGenerationResults.getRuntimeRequirements(module, runtime); - if (runtimeRequirements && runtimeRequirements.size > 0) { - set = new Set(runtimeRequirements); - } else if (additionalModuleRuntimeRequirements.isUsed()) { - set = new Set(); - } else { - if (memCache) { - memCache.set( - `moduleRuntimeRequirements-${getRuntimeKey(runtime)}`, - null - ); - } - continue; - } - additionalModuleRuntimeRequirements.call(module, set, context); +/***/ 79926: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - for (const r of set) { - const hook = runtimeRequirementInModule.get(r); - if (hook !== undefined) hook.call(module, set, context); - } - if (set.size === 0) { - if (memCache) { - memCache.set( - `moduleRuntimeRequirements-${getRuntimeKey(runtime)}`, - null - ); - } - } else { - if (memCache) { - memCache.set( - `moduleRuntimeRequirements-${getRuntimeKey(runtime)}`, - set - ); - chunkGraph.addModuleRuntimeRequirements( - module, - runtime, - set, - false - ); - } else { - chunkGraph.addModuleRuntimeRequirements(module, runtime, set); - } - } - } - } - } - this.logger.timeEnd("runtime requirements.modules"); +"use strict"; - this.logger.time("runtime requirements.chunks"); - for (const chunk of chunks) { - const set = new Set(); - for (const module of chunkGraph.getChunkModulesIterable(chunk)) { - const runtimeRequirements = chunkGraph.getModuleRuntimeRequirements( - module, - chunk.runtime - ); - for (const r of runtimeRequirements) set.add(r); - } - this.hooks.additionalChunkRuntimeRequirements.call(chunk, set, context); - for (const r of set) { - this.hooks.runtimeRequirementInChunk.for(r).call(chunk, set, context); - } +const Range = __webpack_require__(81184); +/** @typedef {import("../validate").Schema} Schema */ - chunkGraph.addChunkRuntimeRequirements(chunk, set); - } - this.logger.timeEnd("runtime requirements.chunks"); +/** + * @param {Schema} schema + * @param {boolean} logic + * @return {string[]} + */ - this.logger.time("runtime requirements.entries"); - for (const treeEntry of chunkGraphEntries) { - const set = new Set(); - for (const chunk of treeEntry.getAllReferencedChunks()) { - const runtimeRequirements = - chunkGraph.getChunkRuntimeRequirements(chunk); - for (const r of runtimeRequirements) set.add(r); - } - this.hooks.additionalTreeRuntimeRequirements.call( - treeEntry, - set, - context - ); +module.exports.stringHints = function stringHints(schema, logic) { + const hints = []; + let type = "string"; + const currentSchema = { ...schema + }; - for (const r of set) { - this.hooks.runtimeRequirementInTree - .for(r) - .call(treeEntry, set, context); - } + if (!logic) { + const tmpLength = currentSchema.minLength; + const tmpFormat = currentSchema.formatMinimum; + const tmpExclusive = currentSchema.formatExclusiveMaximum; + currentSchema.minLength = currentSchema.maxLength; + currentSchema.maxLength = tmpLength; + currentSchema.formatMinimum = currentSchema.formatMaximum; + currentSchema.formatMaximum = tmpFormat; + currentSchema.formatExclusiveMaximum = !currentSchema.formatExclusiveMinimum; + currentSchema.formatExclusiveMinimum = !tmpExclusive; + } - chunkGraph.addTreeRuntimeRequirements(treeEntry, set); - } - this.logger.timeEnd("runtime requirements.entries"); - } + if (typeof currentSchema.minLength === "number") { + if (currentSchema.minLength === 1) { + type = "non-empty string"; + } else { + const length = Math.max(currentSchema.minLength - 1, 0); + hints.push(`should be longer than ${length} character${length > 1 ? "s" : ""}`); + } + } - // TODO webpack 6 make chunkGraph argument non-optional - /** - * @param {Chunk} chunk target chunk - * @param {RuntimeModule} module runtime module - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {void} - */ - addRuntimeModule(chunk, module, chunkGraph = this.chunkGraph) { - // Deprecated ModuleGraph association - if (this._backCompat) - ModuleGraph.setModuleGraphForModule(module, this.moduleGraph); + if (typeof currentSchema.maxLength === "number") { + if (currentSchema.maxLength === 0) { + type = "empty string"; + } else { + const length = currentSchema.maxLength + 1; + hints.push(`should be shorter than ${length} character${length > 1 ? "s" : ""}`); + } + } - // add it to the list - this.modules.add(module); - this._modules.set(module.identifier(), module); + if (currentSchema.pattern) { + hints.push(`should${logic ? "" : " not"} match pattern ${JSON.stringify(currentSchema.pattern)}`); + } - // connect to the chunk graph - chunkGraph.connectChunkAndModule(chunk, module); - chunkGraph.connectChunkAndRuntimeModule(chunk, module); - if (module.fullHash) { - chunkGraph.addFullHashModuleToChunk(chunk, module); - } else if (module.dependentHash) { - chunkGraph.addDependentHashModuleToChunk(chunk, module); - } + if (currentSchema.format) { + hints.push(`should${logic ? "" : " not"} match format ${JSON.stringify(currentSchema.format)}`); + } - // attach runtime module - module.attach(this, chunk, chunkGraph); + if (currentSchema.formatMinimum) { + hints.push(`should be ${currentSchema.formatExclusiveMinimum ? ">" : ">="} ${JSON.stringify(currentSchema.formatMinimum)}`); + } - // Setup internals - const exportsInfo = this.moduleGraph.getExportsInfo(module); - exportsInfo.setHasProvideInfo(); - if (typeof chunk.runtime === "string") { - exportsInfo.setUsedForSideEffectsOnly(chunk.runtime); - } else if (chunk.runtime === undefined) { - exportsInfo.setUsedForSideEffectsOnly(undefined); - } else { - for (const runtime of chunk.runtime) { - exportsInfo.setUsedForSideEffectsOnly(runtime); - } - } - chunkGraph.addModuleRuntimeRequirements( - module, - chunk.runtime, - new Set([RuntimeGlobals.requireScope]) - ); + if (currentSchema.formatMaximum) { + hints.push(`should be ${currentSchema.formatExclusiveMaximum ? "<" : "<="} ${JSON.stringify(currentSchema.formatMaximum)}`); + } - // runtime modules don't need ids - chunkGraph.setModuleId(module, ""); + return [type].concat(hints); +}; +/** + * @param {Schema} schema + * @param {boolean} logic + * @return {string[]} + */ - // Call hook - this.hooks.runtimeModule.call(module, chunk); - } - /** - * If `module` is passed, `loc` and `request` must also be passed. - * @param {string | ChunkGroupOptions} groupOptions options for the chunk group - * @param {Module=} module the module the references the chunk group - * @param {DependencyLocation=} loc the location from with the chunk group is referenced (inside of module) - * @param {string=} request the request from which the the chunk group is referenced - * @returns {ChunkGroup} the new or existing chunk group - */ - addChunkInGroup(groupOptions, module, loc, request) { - if (typeof groupOptions === "string") { - groupOptions = { name: groupOptions }; - } - const name = groupOptions.name; +module.exports.numberHints = function numberHints(schema, logic) { + const hints = [schema.type === "integer" ? "integer" : "number"]; + const range = new Range(); - if (name) { - const chunkGroup = this.namedChunkGroups.get(name); - if (chunkGroup !== undefined) { - chunkGroup.addOptions(groupOptions); - if (module) { - chunkGroup.addOrigin(module, loc, request); - } - return chunkGroup; - } - } - const chunkGroup = new ChunkGroup(groupOptions); - if (module) chunkGroup.addOrigin(module, loc, request); - const chunk = this.addChunk(name); + if (typeof schema.minimum === "number") { + range.left(schema.minimum); + } - connectChunkGroupAndChunk(chunkGroup, chunk); + if (typeof schema.exclusiveMinimum === "number") { + range.left(schema.exclusiveMinimum, true); + } - this.chunkGroups.push(chunkGroup); - if (name) { - this.namedChunkGroups.set(name, chunkGroup); - } - return chunkGroup; - } + if (typeof schema.maximum === "number") { + range.right(schema.maximum); + } - /** - * @param {EntryOptions} options options for the entrypoint - * @param {Module} module the module the references the chunk group - * @param {DependencyLocation} loc the location from with the chunk group is referenced (inside of module) - * @param {string} request the request from which the the chunk group is referenced - * @returns {Entrypoint} the new or existing entrypoint - */ - addAsyncEntrypoint(options, module, loc, request) { - const name = options.name; - if (name) { - const entrypoint = this.namedChunkGroups.get(name); - if (entrypoint instanceof Entrypoint) { - if (entrypoint !== undefined) { - if (module) { - entrypoint.addOrigin(module, loc, request); - } - return entrypoint; - } - } else if (entrypoint) { - throw new Error( - `Cannot add an async entrypoint with the name '${name}', because there is already an chunk group with this name` - ); - } - } - const chunk = this.addChunk(name); - if (options.filename) { - chunk.filenameTemplate = options.filename; - } - const entrypoint = new Entrypoint(options, false); - entrypoint.setRuntimeChunk(chunk); - entrypoint.setEntrypointChunk(chunk); - if (name) { - this.namedChunkGroups.set(name, entrypoint); - } - this.chunkGroups.push(entrypoint); - this.asyncEntrypoints.push(entrypoint); - connectChunkGroupAndChunk(entrypoint, chunk); - if (module) { - entrypoint.addOrigin(module, loc, request); - } - return entrypoint; - } + if (typeof schema.exclusiveMaximum === "number") { + range.right(schema.exclusiveMaximum, true); + } - /** - * This method first looks to see if a name is provided for a new chunk, - * and first looks to see if any named chunks already exist and reuse that chunk instead. - * - * @param {string=} name optional chunk name to be provided - * @returns {Chunk} create a chunk (invoked during seal event) - */ - addChunk(name) { - if (name) { - const chunk = this.namedChunks.get(name); - if (chunk !== undefined) { - return chunk; - } - } - const chunk = new Chunk(name, this._backCompat); - this.chunks.add(chunk); - if (this._backCompat) - ChunkGraph.setChunkGraphForChunk(chunk, this.chunkGraph); - if (name) { - this.namedChunks.set(name, chunk); - } - return chunk; - } + const rangeFormat = range.format(logic); - /** - * @deprecated - * @param {Module} module module to assign depth - * @returns {void} - */ - assignDepth(module) { - const moduleGraph = this.moduleGraph; + if (rangeFormat) { + hints.push(rangeFormat); + } - const queue = new Set([module]); - let depth; + if (typeof schema.multipleOf === "number") { + hints.push(`should${logic ? "" : " not"} be multiple of ${schema.multipleOf}`); + } - moduleGraph.setDepth(module, 0); + return hints; +}; - /** - * @param {Module} module module for processing - * @returns {void} - */ - const processModule = module => { - if (!moduleGraph.setDepthIfLower(module, depth)) return; - queue.add(module); - }; +/***/ }), - for (module of queue) { - queue.delete(module); - depth = moduleGraph.getDepth(module) + 1; +/***/ 18151: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - for (const connection of moduleGraph.getOutgoingConnections(module)) { - const refModule = connection.module; - if (refModule) { - processModule(refModule); - } - } - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {Set} modules module to assign depth - * @returns {void} - */ - assignDepths(modules) { - const moduleGraph = this.moduleGraph; - /** @type {Set} */ - const queue = new Set(modules); - queue.add(1); - let depth = 0; +const Hook = __webpack_require__(21468); +const HookCodeFactory = __webpack_require__(66443); - let i = 0; - for (const module of queue) { - i++; - if (typeof module === "number") { - depth = module; - if (queue.size === i) return; - queue.add(depth + 1); - } else { - moduleGraph.setDepth(module, depth); - for (const { module: refModule } of moduleGraph.getOutgoingConnections( - module - )) { - if (refModule) { - queue.add(refModule); - } +class AsyncParallelBailHookCodeFactory extends HookCodeFactory { + content({ onError, onResult, onDone }) { + let code = ""; + code += `var _results = new Array(${this.options.taps.length});\n`; + code += "var _checkDone = function() {\n"; + code += "for(var i = 0; i < _results.length; i++) {\n"; + code += "var item = _results[i];\n"; + code += "if(item === undefined) return false;\n"; + code += "if(item.result !== undefined) {\n"; + code += onResult("item.result"); + code += "return true;\n"; + code += "}\n"; + code += "if(item.error) {\n"; + code += onError("item.error"); + code += "return true;\n"; + code += "}\n"; + code += "}\n"; + code += "return false;\n"; + code += "}\n"; + code += this.callTapsParallel({ + onError: (i, err, done, doneBreak) => { + let code = ""; + code += `if(${i} < _results.length && ((_results.length = ${i + + 1}), (_results[${i}] = { error: ${err} }), _checkDone())) {\n`; + code += doneBreak(true); + code += "} else {\n"; + code += done(); + code += "}\n"; + return code; + }, + onResult: (i, result, done, doneBreak) => { + let code = ""; + code += `if(${i} < _results.length && (${result} !== undefined && (_results.length = ${i + + 1}), (_results[${i}] = { result: ${result} }), _checkDone())) {\n`; + code += doneBreak(true); + code += "} else {\n"; + code += done(); + code += "}\n"; + return code; + }, + onTap: (i, run, done, doneBreak) => { + let code = ""; + if (i > 0) { + code += `if(${i} >= _results.length) {\n`; + code += done(); + code += "} else {\n"; } - } - } + code += run(); + if (i > 0) code += "}\n"; + return code; + }, + onDone + }); + return code; } +} - /** - * @param {Dependency} dependency the dependency - * @param {RuntimeSpec} runtime the runtime - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getDependencyReferencedExports(dependency, runtime) { - const referencedExports = dependency.getReferencedExports( - this.moduleGraph, - runtime - ); - return this.hooks.dependencyReferencedExports.call( - referencedExports, - dependency, - runtime - ); - } +const factory = new AsyncParallelBailHookCodeFactory(); - /** - * - * @param {Module} module module relationship for removal - * @param {DependenciesBlockLike} block //TODO: good description - * @returns {void} - */ - removeReasonsOfDependencyBlock(module, block) { - if (block.blocks) { - for (const b of block.blocks) { - this.removeReasonsOfDependencyBlock(module, b); - } - } +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; - if (block.dependencies) { - for (const dep of block.dependencies) { - const originalModule = this.moduleGraph.getModule(dep); - if (originalModule) { - this.moduleGraph.removeConnection(dep); +function AsyncParallelBailHook(args = [], name = undefined) { + const hook = new Hook(args, name); + hook.constructor = AsyncParallelBailHook; + hook.compile = COMPILE; + hook._call = undefined; + hook.call = undefined; + return hook; +} - if (this.chunkGraph) { - for (const chunk of this.chunkGraph.getModuleChunks( - originalModule - )) { - this.patchChunksAfterReasonRemoval(originalModule, chunk); - } - } - } - } - } - } +AsyncParallelBailHook.prototype = null; - /** - * @param {Module} module module to patch tie - * @param {Chunk} chunk chunk to patch tie - * @returns {void} - */ - patchChunksAfterReasonRemoval(module, chunk) { - if (!module.hasReasons(this.moduleGraph, chunk.runtime)) { - this.removeReasonsOfDependencyBlock(module, module); - } - if (!module.hasReasonForChunk(chunk, this.moduleGraph, this.chunkGraph)) { - if (this.chunkGraph.isModuleInChunk(module, chunk)) { - this.chunkGraph.disconnectChunkAndModule(chunk, module); - this.removeChunkFromDependencies(module, chunk); - } - } - } +module.exports = AsyncParallelBailHook; - /** - * - * @param {DependenciesBlock} block block tie for Chunk - * @param {Chunk} chunk chunk to remove from dep - * @returns {void} - */ - removeChunkFromDependencies(block, chunk) { - /** - * @param {Dependency} d dependency to (maybe) patch up - */ - const iteratorDependency = d => { - const depModule = this.moduleGraph.getModule(d); - if (!depModule) { - return; - } - this.patchChunksAfterReasonRemoval(depModule, chunk); - }; - const blocks = block.blocks; - for (let indexBlock = 0; indexBlock < blocks.length; indexBlock++) { - const asyncBlock = blocks[indexBlock]; - const chunkGroup = this.chunkGraph.getBlockChunkGroup(asyncBlock); - // Grab all chunks from the first Block's AsyncDepBlock - const chunks = chunkGroup.chunks; - // For each chunk in chunkGroup - for (let indexChunk = 0; indexChunk < chunks.length; indexChunk++) { - const iteratedChunk = chunks[indexChunk]; - chunkGroup.removeChunk(iteratedChunk); - // Recurse - this.removeChunkFromDependencies(block, iteratedChunk); - } - } +/***/ }), - if (block.dependencies) { - for (const dep of block.dependencies) iteratorDependency(dep); - } - } +/***/ 31684: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - assignRuntimeIds() { - const { chunkGraph } = this; - const processEntrypoint = ep => { - const runtime = ep.options.runtime || ep.name; - const chunk = ep.getRuntimeChunk(); - chunkGraph.setRuntimeId(runtime, chunk.id); - }; - for (const ep of this.entrypoints.values()) { - processEntrypoint(ep); - } - for (const ep of this.asyncEntrypoints) { - processEntrypoint(ep); - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - sortItemsWithChunkIds() { - for (const chunkGroup of this.chunkGroups) { - chunkGroup.sortItems(); - } - this.errors.sort(compareErrors); - this.warnings.sort(compareErrors); - this.children.sort(byNameOrHash); +const Hook = __webpack_require__(21468); +const HookCodeFactory = __webpack_require__(66443); + +class AsyncParallelHookCodeFactory extends HookCodeFactory { + content({ onError, onDone }) { + return this.callTapsParallel({ + onError: (i, err, done, doneBreak) => onError(err) + doneBreak(true), + onDone + }); } +} - summarizeDependencies() { - for ( - let indexChildren = 0; - indexChildren < this.children.length; - indexChildren++ - ) { - const child = this.children[indexChildren]; +const factory = new AsyncParallelHookCodeFactory(); - this.fileDependencies.addAll(child.fileDependencies); - this.contextDependencies.addAll(child.contextDependencies); - this.missingDependencies.addAll(child.missingDependencies); - this.buildDependencies.addAll(child.buildDependencies); - } +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; - for (const module of this.modules) { - module.addCacheDependencies( - this.fileDependencies, - this.contextDependencies, - this.missingDependencies, - this.buildDependencies - ); - } +function AsyncParallelHook(args = [], name = undefined) { + const hook = new Hook(args, name); + hook.constructor = AsyncParallelHook; + hook.compile = COMPILE; + hook._call = undefined; + hook.call = undefined; + return hook; +} + +AsyncParallelHook.prototype = null; + +module.exports = AsyncParallelHook; + + +/***/ }), + +/***/ 95734: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + +const Hook = __webpack_require__(21468); +const HookCodeFactory = __webpack_require__(66443); + +class AsyncSeriesBailHookCodeFactory extends HookCodeFactory { + content({ onError, onResult, resultReturns, onDone }) { + return this.callTapsSeries({ + onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), + onResult: (i, result, next) => + `if(${result} !== undefined) {\n${onResult( + result + )}\n} else {\n${next()}}\n`, + resultReturns, + onDone + }); } +} - createModuleHashes() { - let statModulesHashed = 0; - let statModulesFromCache = 0; - const { chunkGraph, runtimeTemplate, moduleMemCaches2 } = this; - const { hashFunction, hashDigest, hashDigestLength } = this.outputOptions; - for (const module of this.modules) { - const memCache = moduleMemCaches2 && moduleMemCaches2.get(module); - for (const runtime of chunkGraph.getModuleRuntimes(module)) { - if (memCache) { - const digest = memCache.get(`moduleHash-${getRuntimeKey(runtime)}`); - if (digest !== undefined) { - chunkGraph.setModuleHashes( - module, - runtime, - digest, - digest.substr(0, hashDigestLength) - ); - statModulesFromCache++; - continue; - } - } - statModulesHashed++; - const digest = this._createModuleHash( - module, - chunkGraph, - runtime, - hashFunction, - runtimeTemplate, - hashDigest, - hashDigestLength - ); - if (memCache) { - memCache.set(`moduleHash-${getRuntimeKey(runtime)}`, digest); - } - } - } - this.logger.log( - `${statModulesHashed} modules hashed, ${statModulesFromCache} from cache (${ - Math.round( - (100 * (statModulesHashed + statModulesFromCache)) / this.modules.size - ) / 100 - } variants per module in average)` - ); +const factory = new AsyncSeriesBailHookCodeFactory(); + +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; + +function AsyncSeriesBailHook(args = [], name = undefined) { + const hook = new Hook(args, name); + hook.constructor = AsyncSeriesBailHook; + hook.compile = COMPILE; + hook._call = undefined; + hook.call = undefined; + return hook; +} + +AsyncSeriesBailHook.prototype = null; + +module.exports = AsyncSeriesBailHook; + + +/***/ }), + +/***/ 96496: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + +const Hook = __webpack_require__(21468); +const HookCodeFactory = __webpack_require__(66443); + +class AsyncSeriesHookCodeFactory extends HookCodeFactory { + content({ onError, onDone }) { + return this.callTapsSeries({ + onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), + onDone + }); } +} - _createModuleHash( - module, - chunkGraph, - runtime, - hashFunction, - runtimeTemplate, - hashDigest, - hashDigestLength - ) { - const moduleHash = createHash(hashFunction); - module.updateHash(moduleHash, { - chunkGraph, - runtime, - runtimeTemplate +const factory = new AsyncSeriesHookCodeFactory(); + +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; + +function AsyncSeriesHook(args = [], name = undefined) { + const hook = new Hook(args, name); + hook.constructor = AsyncSeriesHook; + hook.compile = COMPILE; + hook._call = undefined; + hook.call = undefined; + return hook; +} + +AsyncSeriesHook.prototype = null; + +module.exports = AsyncSeriesHook; + + +/***/ }), + +/***/ 95999: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + +const Hook = __webpack_require__(21468); +const HookCodeFactory = __webpack_require__(66443); + +class AsyncSeriesLoopHookCodeFactory extends HookCodeFactory { + content({ onError, onDone }) { + return this.callTapsLooping({ + onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), + onDone }); - const moduleHashDigest = /** @type {string} */ ( - moduleHash.digest(hashDigest) - ); - chunkGraph.setModuleHashes( - module, - runtime, - moduleHashDigest, - moduleHashDigest.substr(0, hashDigestLength) - ); - return moduleHashDigest; } +} - createHash() { - this.logger.time("hashing: initialize hash"); - const chunkGraph = this.chunkGraph; - const runtimeTemplate = this.runtimeTemplate; - const outputOptions = this.outputOptions; - const hashFunction = outputOptions.hashFunction; - const hashDigest = outputOptions.hashDigest; - const hashDigestLength = outputOptions.hashDigestLength; - const hash = createHash(hashFunction); - if (outputOptions.hashSalt) { - hash.update(outputOptions.hashSalt); +const factory = new AsyncSeriesLoopHookCodeFactory(); + +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; + +function AsyncSeriesLoopHook(args = [], name = undefined) { + const hook = new Hook(args, name); + hook.constructor = AsyncSeriesLoopHook; + hook.compile = COMPILE; + hook._call = undefined; + hook.call = undefined; + return hook; +} + +AsyncSeriesLoopHook.prototype = null; + +module.exports = AsyncSeriesLoopHook; + + +/***/ }), + +/***/ 58118: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + +const Hook = __webpack_require__(21468); +const HookCodeFactory = __webpack_require__(66443); + +class AsyncSeriesWaterfallHookCodeFactory extends HookCodeFactory { + content({ onError, onResult, onDone }) { + return this.callTapsSeries({ + onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), + onResult: (i, result, next) => { + let code = ""; + code += `if(${result} !== undefined) {\n`; + code += `${this._args[0]} = ${result};\n`; + code += `}\n`; + code += next(); + return code; + }, + onDone: () => onResult(this._args[0]) + }); + } +} + +const factory = new AsyncSeriesWaterfallHookCodeFactory(); + +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; + +function AsyncSeriesWaterfallHook(args = [], name = undefined) { + if (args.length < 1) + throw new Error("Waterfall hooks must have at least one argument"); + const hook = new Hook(args, name); + hook.constructor = AsyncSeriesWaterfallHook; + hook.compile = COMPILE; + hook._call = undefined; + hook.call = undefined; + return hook; +} + +AsyncSeriesWaterfallHook.prototype = null; + +module.exports = AsyncSeriesWaterfallHook; + + +/***/ }), + +/***/ 21468: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + +const util = __webpack_require__(73837); + +const deprecateContext = util.deprecate(() => {}, +"Hook.context is deprecated and will be removed"); + +const CALL_DELEGATE = function(...args) { + this.call = this._createCall("sync"); + return this.call(...args); +}; +const CALL_ASYNC_DELEGATE = function(...args) { + this.callAsync = this._createCall("async"); + return this.callAsync(...args); +}; +const PROMISE_DELEGATE = function(...args) { + this.promise = this._createCall("promise"); + return this.promise(...args); +}; + +class Hook { + constructor(args = [], name = undefined) { + this._args = args; + this.name = name; + this.taps = []; + this.interceptors = []; + this._call = CALL_DELEGATE; + this.call = CALL_DELEGATE; + this._callAsync = CALL_ASYNC_DELEGATE; + this.callAsync = CALL_ASYNC_DELEGATE; + this._promise = PROMISE_DELEGATE; + this.promise = PROMISE_DELEGATE; + this._x = undefined; + + this.compile = this.compile; + this.tap = this.tap; + this.tapAsync = this.tapAsync; + this.tapPromise = this.tapPromise; + } + + compile(options) { + throw new Error("Abstract: should be overridden"); + } + + _createCall(type) { + return this.compile({ + taps: this.taps, + interceptors: this.interceptors, + args: this._args, + type: type + }); + } + + _tap(type, options, fn) { + if (typeof options === "string") { + options = { + name: options.trim() + }; + } else if (typeof options !== "object" || options === null) { + throw new Error("Invalid tap options"); } - this.logger.timeEnd("hashing: initialize hash"); - if (this.children.length > 0) { - this.logger.time("hashing: hash child compilations"); - for (const child of this.children) { - hash.update(child.hash); - } - this.logger.timeEnd("hashing: hash child compilations"); + if (typeof options.name !== "string" || options.name === "") { + throw new Error("Missing name for tap"); } - if (this.warnings.length > 0) { - this.logger.time("hashing: hash warnings"); - for (const warning of this.warnings) { - hash.update(`${warning.message}`); - } - this.logger.timeEnd("hashing: hash warnings"); + if (typeof options.context !== "undefined") { + deprecateContext(); } - if (this.errors.length > 0) { - this.logger.time("hashing: hash errors"); - for (const error of this.errors) { - hash.update(`${error.message}`); + options = Object.assign({ type, fn }, options); + options = this._runRegisterInterceptors(options); + this._insert(options); + } + + tap(options, fn) { + this._tap("sync", options, fn); + } + + tapAsync(options, fn) { + this._tap("async", options, fn); + } + + tapPromise(options, fn) { + this._tap("promise", options, fn); + } + + _runRegisterInterceptors(options) { + for (const interceptor of this.interceptors) { + if (interceptor.register) { + const newOptions = interceptor.register(options); + if (newOptions !== undefined) { + options = newOptions; + } } - this.logger.timeEnd("hashing: hash errors"); } + return options; + } - this.logger.time("hashing: sort chunks"); - /* - * all non-runtime chunks need to be hashes first, - * since runtime chunk might use their hashes. - * runtime chunks need to be hashed in the correct order - * since they may depend on each other (for async entrypoints). - * So we put all non-runtime chunks first and hash them in any order. - * And order runtime chunks according to referenced between each other. - * Chunks need to be in deterministic order since we add hashes to full chunk - * during these hashing. - */ - /** @type {Chunk[]} */ - const unorderedRuntimeChunks = []; - /** @type {Chunk[]} */ - const otherChunks = []; - for (const c of this.chunks) { - if (c.hasRuntime()) { - unorderedRuntimeChunks.push(c); - } else { - otherChunks.push(c); + withOptions(options) { + const mergeOptions = opt => + Object.assign({}, options, typeof opt === "string" ? { name: opt } : opt); + + return { + name: this.name, + tap: (opt, fn) => this.tap(mergeOptions(opt), fn), + tapAsync: (opt, fn) => this.tapAsync(mergeOptions(opt), fn), + tapPromise: (opt, fn) => this.tapPromise(mergeOptions(opt), fn), + intercept: interceptor => this.intercept(interceptor), + isUsed: () => this.isUsed(), + withOptions: opt => this.withOptions(mergeOptions(opt)) + }; + } + + isUsed() { + return this.taps.length > 0 || this.interceptors.length > 0; + } + + intercept(interceptor) { + this._resetCompilation(); + this.interceptors.push(Object.assign({}, interceptor)); + if (interceptor.register) { + for (let i = 0; i < this.taps.length; i++) { + this.taps[i] = interceptor.register(this.taps[i]); } } - unorderedRuntimeChunks.sort(byId); - otherChunks.sort(byId); + } - /** @typedef {{ chunk: Chunk, referencedBy: RuntimeChunkInfo[], remaining: number }} RuntimeChunkInfo */ - /** @type {Map} */ - const runtimeChunksMap = new Map(); - for (const chunk of unorderedRuntimeChunks) { - runtimeChunksMap.set(chunk, { - chunk, - referencedBy: [], - remaining: 0 - }); + _resetCompilation() { + this.call = this._call; + this.callAsync = this._callAsync; + this.promise = this._promise; + } + + _insert(item) { + this._resetCompilation(); + let before; + if (typeof item.before === "string") { + before = new Set([item.before]); + } else if (Array.isArray(item.before)) { + before = new Set(item.before); } - let remaining = 0; - for (const info of runtimeChunksMap.values()) { - for (const other of new Set( - Array.from(info.chunk.getAllReferencedAsyncEntrypoints()).map( - e => e.chunks[e.chunks.length - 1] - ) - )) { - const otherInfo = runtimeChunksMap.get(other); - otherInfo.referencedBy.push(info); - info.remaining++; - remaining++; - } + let stage = 0; + if (typeof item.stage === "number") { + stage = item.stage; } - /** @type {Chunk[]} */ - const runtimeChunks = []; - for (const info of runtimeChunksMap.values()) { - if (info.remaining === 0) { - runtimeChunks.push(info.chunk); - } - } - // If there are any references between chunks - // make sure to follow these chains - if (remaining > 0) { - const readyChunks = []; - for (const chunk of runtimeChunks) { - const hasFullHashModules = - chunkGraph.getNumberOfChunkFullHashModules(chunk) !== 0; - const info = runtimeChunksMap.get(chunk); - for (const otherInfo of info.referencedBy) { - if (hasFullHashModules) { - chunkGraph.upgradeDependentToFullHashModules(otherInfo.chunk); - } - remaining--; - if (--otherInfo.remaining === 0) { - readyChunks.push(otherInfo.chunk); - } + let i = this.taps.length; + while (i > 0) { + i--; + const x = this.taps[i]; + this.taps[i + 1] = x; + const xStage = x.stage || 0; + if (before) { + if (before.has(x.name)) { + before.delete(x.name); + continue; } - if (readyChunks.length > 0) { - // This ensures deterministic ordering, since referencedBy is non-deterministic - readyChunks.sort(byId); - for (const c of readyChunks) runtimeChunks.push(c); - readyChunks.length = 0; + if (before.size > 0) { + continue; } } - } - // If there are still remaining references we have cycles and want to create a warning - if (remaining > 0) { - let circularRuntimeChunkInfo = []; - for (const info of runtimeChunksMap.values()) { - if (info.remaining !== 0) { - circularRuntimeChunkInfo.push(info); - } + if (xStage > stage) { + continue; } - circularRuntimeChunkInfo.sort(compareSelect(i => i.chunk, byId)); - const err = - new WebpackError(`Circular dependency between chunks with runtime (${Array.from( - circularRuntimeChunkInfo, - c => c.chunk.name || c.chunk.id - ).join(", ")}) -This prevents using hashes of each other and should be avoided.`); - err.chunk = circularRuntimeChunkInfo[0].chunk; - this.warnings.push(err); - for (const i of circularRuntimeChunkInfo) runtimeChunks.push(i.chunk); + i++; + break; } - this.logger.timeEnd("hashing: sort chunks"); + this.taps[i] = item; + } +} - const fullHashChunks = new Set(); - /** @type {{module: Module, hash: string, runtime: RuntimeSpec, runtimes: RuntimeSpec[]}[]} */ - const codeGenerationJobs = []; - /** @type {Map>} */ - const codeGenerationJobsMap = new Map(); +Object.setPrototypeOf(Hook.prototype, null); - const processChunk = chunk => { - // Last minute module hash generation for modules that depend on chunk hashes - this.logger.time("hashing: hash runtime modules"); - const runtime = chunk.runtime; - for (const module of chunkGraph.getChunkModulesIterable(chunk)) { - if (!chunkGraph.hasModuleHashes(module, runtime)) { - const hash = this._createModuleHash( - module, - chunkGraph, - runtime, - hashFunction, - runtimeTemplate, - hashDigest, - hashDigestLength - ); - let hashMap = codeGenerationJobsMap.get(hash); - if (hashMap) { - const moduleJob = hashMap.get(module); - if (moduleJob) { - moduleJob.runtimes.push(runtime); - continue; - } - } else { - hashMap = new Map(); - codeGenerationJobsMap.set(hash, hashMap); - } - const job = { - module, - hash, - runtime, - runtimes: [runtime] - }; - hashMap.set(module, job); - codeGenerationJobs.push(job); - } - } - this.logger.timeAggregate("hashing: hash runtime modules"); - this.logger.time("hashing: hash chunks"); - const chunkHash = createHash(hashFunction); - try { - if (outputOptions.hashSalt) { - chunkHash.update(outputOptions.hashSalt); - } - chunk.updateHash(chunkHash, chunkGraph); - this.hooks.chunkHash.call(chunk, chunkHash, { - chunkGraph, - codeGenerationResults: this.codeGenerationResults, - moduleGraph: this.moduleGraph, - runtimeTemplate: this.runtimeTemplate - }); - const chunkHashDigest = /** @type {string} */ ( - chunkHash.digest(hashDigest) - ); - hash.update(chunkHashDigest); - chunk.hash = chunkHashDigest; - chunk.renderedHash = chunk.hash.substr(0, hashDigestLength); - const fullHashModules = - chunkGraph.getChunkFullHashModulesIterable(chunk); - if (fullHashModules) { - fullHashChunks.add(chunk); - } else { - this.hooks.contentHash.call(chunk); - } - } catch (err) { - this.errors.push(new ChunkRenderError(chunk, "", err)); - } - this.logger.timeAggregate("hashing: hash chunks"); - }; - otherChunks.forEach(processChunk); - for (const chunk of runtimeChunks) processChunk(chunk); +module.exports = Hook; - this.logger.timeAggregateEnd("hashing: hash runtime modules"); - this.logger.timeAggregateEnd("hashing: hash chunks"); - this.logger.time("hashing: hash digest"); - this.hooks.fullHash.call(hash); - this.fullHash = /** @type {string} */ (hash.digest(hashDigest)); - this.hash = this.fullHash.substr(0, hashDigestLength); - this.logger.timeEnd("hashing: hash digest"); - this.logger.time("hashing: process full hash modules"); - for (const chunk of fullHashChunks) { - for (const module of chunkGraph.getChunkFullHashModulesIterable(chunk)) { - const moduleHash = createHash(hashFunction); - module.updateHash(moduleHash, { - chunkGraph, - runtime: chunk.runtime, - runtimeTemplate - }); - const moduleHashDigest = /** @type {string} */ ( - moduleHash.digest(hashDigest) +/***/ }), + +/***/ 66443: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + +class HookCodeFactory { + constructor(config) { + this.config = config; + this.options = undefined; + this._args = undefined; + } + + create(options) { + this.init(options); + let fn; + switch (this.options.type) { + case "sync": + fn = new Function( + this.args(), + '"use strict";\n' + + this.header() + + this.contentWithInterceptors({ + onError: err => `throw ${err};\n`, + onResult: result => `return ${result};\n`, + resultReturns: true, + onDone: () => "", + rethrowIfPossible: true + }) ); - const oldHash = chunkGraph.getModuleHash(module, chunk.runtime); - chunkGraph.setModuleHashes( - module, - chunk.runtime, - moduleHashDigest, - moduleHashDigest.substr(0, hashDigestLength) + break; + case "async": + fn = new Function( + this.args({ + after: "_callback" + }), + '"use strict";\n' + + this.header() + + this.contentWithInterceptors({ + onError: err => `_callback(${err});\n`, + onResult: result => `_callback(null, ${result});\n`, + onDone: () => "_callback();\n" + }) ); - codeGenerationJobsMap.get(oldHash).get(module).hash = moduleHashDigest; - } - const chunkHash = createHash(hashFunction); - chunkHash.update(chunk.hash); - chunkHash.update(this.hash); - const chunkHashDigest = /** @type {string} */ ( - chunkHash.digest(hashDigest) - ); - chunk.hash = chunkHashDigest; - chunk.renderedHash = chunk.hash.substr(0, hashDigestLength); - this.hooks.contentHash.call(chunk); + break; + case "promise": + let errorHelperUsed = false; + const content = this.contentWithInterceptors({ + onError: err => { + errorHelperUsed = true; + return `_error(${err});\n`; + }, + onResult: result => `_resolve(${result});\n`, + onDone: () => "_resolve();\n" + }); + let code = ""; + code += '"use strict";\n'; + code += this.header(); + code += "return new Promise((function(_resolve, _reject) {\n"; + if (errorHelperUsed) { + code += "var _sync = true;\n"; + code += "function _error(_err) {\n"; + code += "if(_sync)\n"; + code += + "_resolve(Promise.resolve().then((function() { throw _err; })));\n"; + code += "else\n"; + code += "_reject(_err);\n"; + code += "};\n"; + } + code += content; + if (errorHelperUsed) { + code += "_sync = false;\n"; + } + code += "}));\n"; + fn = new Function(this.args(), code); + break; } - this.logger.timeEnd("hashing: process full hash modules"); - return codeGenerationJobs; + this.deinit(); + return fn; + } + + setup(instance, options) { + instance._x = options.taps.map(t => t.fn); } /** - * @param {string} file file name - * @param {Source} source asset source - * @param {AssetInfo} assetInfo extra asset information - * @returns {void} + * @param {{ type: "sync" | "promise" | "async", taps: Array, interceptors: Array }} options */ - emitAsset(file, source, assetInfo = {}) { - if (this.assets[file]) { - if (!isSourceEqual(this.assets[file], source)) { - this.errors.push( - new WebpackError( - `Conflict: Multiple assets emit different content to the same filename ${file}` - ) - ); - this.assets[file] = source; - this._setAssetInfo(file, assetInfo); - return; - } - const oldInfo = this.assetsInfo.get(file); - const newInfo = Object.assign({}, oldInfo, assetInfo); - this._setAssetInfo(file, newInfo, oldInfo); - return; - } - this.assets[file] = source; - this._setAssetInfo(file, assetInfo, undefined); + init(options) { + this.options = options; + this._args = options.args.slice(); } - _setAssetInfo(file, newInfo, oldInfo = this.assetsInfo.get(file)) { - if (newInfo === undefined) { - this.assetsInfo.delete(file); - } else { - this.assetsInfo.set(file, newInfo); - } - const oldRelated = oldInfo && oldInfo.related; - const newRelated = newInfo && newInfo.related; - if (oldRelated) { - for (const key of Object.keys(oldRelated)) { - const remove = name => { - const relatedIn = this._assetsRelatedIn.get(name); - if (relatedIn === undefined) return; - const entry = relatedIn.get(key); - if (entry === undefined) return; - entry.delete(file); - if (entry.size !== 0) return; - relatedIn.delete(key); - if (relatedIn.size === 0) this._assetsRelatedIn.delete(name); - }; - const entry = oldRelated[key]; - if (Array.isArray(entry)) { - entry.forEach(remove); - } else if (entry) { - remove(entry); - } - } - } - if (newRelated) { - for (const key of Object.keys(newRelated)) { - const add = name => { - let relatedIn = this._assetsRelatedIn.get(name); - if (relatedIn === undefined) { - this._assetsRelatedIn.set(name, (relatedIn = new Map())); - } - let entry = relatedIn.get(key); - if (entry === undefined) { - relatedIn.set(key, (entry = new Set())); - } - entry.add(file); - }; - const entry = newRelated[key]; - if (Array.isArray(entry)) { - entry.forEach(add); - } else if (entry) { - add(entry); + deinit() { + this.options = undefined; + this._args = undefined; + } + + contentWithInterceptors(options) { + if (this.options.interceptors.length > 0) { + const onError = options.onError; + const onResult = options.onResult; + const onDone = options.onDone; + let code = ""; + for (let i = 0; i < this.options.interceptors.length; i++) { + const interceptor = this.options.interceptors[i]; + if (interceptor.call) { + code += `${this.getInterceptor(i)}.call(${this.args({ + before: interceptor.context ? "_context" : undefined + })});\n`; } } + code += this.content( + Object.assign(options, { + onError: + onError && + (err => { + let code = ""; + for (let i = 0; i < this.options.interceptors.length; i++) { + const interceptor = this.options.interceptors[i]; + if (interceptor.error) { + code += `${this.getInterceptor(i)}.error(${err});\n`; + } + } + code += onError(err); + return code; + }), + onResult: + onResult && + (result => { + let code = ""; + for (let i = 0; i < this.options.interceptors.length; i++) { + const interceptor = this.options.interceptors[i]; + if (interceptor.result) { + code += `${this.getInterceptor(i)}.result(${result});\n`; + } + } + code += onResult(result); + return code; + }), + onDone: + onDone && + (() => { + let code = ""; + for (let i = 0; i < this.options.interceptors.length; i++) { + const interceptor = this.options.interceptors[i]; + if (interceptor.done) { + code += `${this.getInterceptor(i)}.done();\n`; + } + } + code += onDone(); + return code; + }) + }) + ); + return code; + } else { + return this.content(options); } } - /** - * @param {string} file file name - * @param {Source | function(Source): Source} newSourceOrFunction new asset source or function converting old to new - * @param {AssetInfo | function(AssetInfo | undefined): AssetInfo} assetInfoUpdateOrFunction new asset info or function converting old to new - */ - updateAsset( - file, - newSourceOrFunction, - assetInfoUpdateOrFunction = undefined - ) { - if (!this.assets[file]) { - throw new Error( - `Called Compilation.updateAsset for not existing filename ${file}` - ); - } - if (typeof newSourceOrFunction === "function") { - this.assets[file] = newSourceOrFunction(this.assets[file]); + header() { + let code = ""; + if (this.needContext()) { + code += "var _context = {};\n"; } else { - this.assets[file] = newSourceOrFunction; + code += "var _context;\n"; } - if (assetInfoUpdateOrFunction !== undefined) { - const oldInfo = this.assetsInfo.get(file) || EMPTY_ASSET_INFO; - if (typeof assetInfoUpdateOrFunction === "function") { - this._setAssetInfo(file, assetInfoUpdateOrFunction(oldInfo), oldInfo); - } else { - this._setAssetInfo( - file, - cachedCleverMerge(oldInfo, assetInfoUpdateOrFunction), - oldInfo - ); - } + code += "var _x = this._x;\n"; + if (this.options.interceptors.length > 0) { + code += "var _taps = this.taps;\n"; + code += "var _interceptors = this.interceptors;\n"; } + return code; } - renameAsset(file, newFile) { - const source = this.assets[file]; - if (!source) { - throw new Error( - `Called Compilation.renameAsset for not existing filename ${file}` - ); - } - if (this.assets[newFile]) { - if (!isSourceEqual(this.assets[file], source)) { - this.errors.push( - new WebpackError( - `Conflict: Called Compilation.renameAsset for already existing filename ${newFile} with different content` - ) - ); - } - } - const assetInfo = this.assetsInfo.get(file); - // Update related in all other assets - const relatedInInfo = this._assetsRelatedIn.get(file); - if (relatedInInfo) { - for (const [key, assets] of relatedInInfo) { - for (const name of assets) { - const info = this.assetsInfo.get(name); - if (!info) continue; - const related = info.related; - if (!related) continue; - const entry = related[key]; - let newEntry; - if (Array.isArray(entry)) { - newEntry = entry.map(x => (x === file ? newFile : x)); - } else if (entry === file) { - newEntry = newFile; - } else continue; - this.assetsInfo.set(name, { - ...info, - related: { - ...related, - [key]: newEntry - } - }); + needContext() { + for (const tap of this.options.taps) if (tap.context) return true; + return false; + } + + callTap(tapIndex, { onError, onResult, onDone, rethrowIfPossible }) { + let code = ""; + let hasTapCached = false; + for (let i = 0; i < this.options.interceptors.length; i++) { + const interceptor = this.options.interceptors[i]; + if (interceptor.tap) { + if (!hasTapCached) { + code += `var _tap${tapIndex} = ${this.getTap(tapIndex)};\n`; + hasTapCached = true; } + code += `${this.getInterceptor(i)}.tap(${ + interceptor.context ? "_context, " : "" + }_tap${tapIndex});\n`; } } - this._setAssetInfo(file, undefined, assetInfo); - this._setAssetInfo(newFile, assetInfo); - delete this.assets[file]; - this.assets[newFile] = source; - for (const chunk of this.chunks) { - { - const size = chunk.files.size; - chunk.files.delete(file); - if (size !== chunk.files.size) { - chunk.files.add(newFile); + code += `var _fn${tapIndex} = ${this.getTapFn(tapIndex)};\n`; + const tap = this.options.taps[tapIndex]; + switch (tap.type) { + case "sync": + if (!rethrowIfPossible) { + code += `var _hasError${tapIndex} = false;\n`; + code += "try {\n"; } - } - { - const size = chunk.auxiliaryFiles.size; - chunk.auxiliaryFiles.delete(file); - if (size !== chunk.auxiliaryFiles.size) { - chunk.auxiliaryFiles.add(newFile); + if (onResult) { + code += `var _result${tapIndex} = _fn${tapIndex}(${this.args({ + before: tap.context ? "_context" : undefined + })});\n`; + } else { + code += `_fn${tapIndex}(${this.args({ + before: tap.context ? "_context" : undefined + })});\n`; } - } + if (!rethrowIfPossible) { + code += "} catch(_err) {\n"; + code += `_hasError${tapIndex} = true;\n`; + code += onError("_err"); + code += "}\n"; + code += `if(!_hasError${tapIndex}) {\n`; + } + if (onResult) { + code += onResult(`_result${tapIndex}`); + } + if (onDone) { + code += onDone(); + } + if (!rethrowIfPossible) { + code += "}\n"; + } + break; + case "async": + let cbCode = ""; + if (onResult) + cbCode += `(function(_err${tapIndex}, _result${tapIndex}) {\n`; + else cbCode += `(function(_err${tapIndex}) {\n`; + cbCode += `if(_err${tapIndex}) {\n`; + cbCode += onError(`_err${tapIndex}`); + cbCode += "} else {\n"; + if (onResult) { + cbCode += onResult(`_result${tapIndex}`); + } + if (onDone) { + cbCode += onDone(); + } + cbCode += "}\n"; + cbCode += "})"; + code += `_fn${tapIndex}(${this.args({ + before: tap.context ? "_context" : undefined, + after: cbCode + })});\n`; + break; + case "promise": + code += `var _hasResult${tapIndex} = false;\n`; + code += `var _promise${tapIndex} = _fn${tapIndex}(${this.args({ + before: tap.context ? "_context" : undefined + })});\n`; + code += `if (!_promise${tapIndex} || !_promise${tapIndex}.then)\n`; + code += ` throw new Error('Tap function (tapPromise) did not return promise (returned ' + _promise${tapIndex} + ')');\n`; + code += `_promise${tapIndex}.then((function(_result${tapIndex}) {\n`; + code += `_hasResult${tapIndex} = true;\n`; + if (onResult) { + code += onResult(`_result${tapIndex}`); + } + if (onDone) { + code += onDone(); + } + code += `}), function(_err${tapIndex}) {\n`; + code += `if(_hasResult${tapIndex}) throw _err${tapIndex};\n`; + code += onError(`_err${tapIndex}`); + code += "});\n"; + break; } + return code; } - /** - * @param {string} file file name - */ - deleteAsset(file) { - if (!this.assets[file]) { - return; - } - delete this.assets[file]; - const assetInfo = this.assetsInfo.get(file); - this._setAssetInfo(file, undefined, assetInfo); - const related = assetInfo && assetInfo.related; - if (related) { - for (const key of Object.keys(related)) { - const checkUsedAndDelete = file => { - if (!this._assetsRelatedIn.has(file)) { - this.deleteAsset(file); - } - }; - const items = related[key]; - if (Array.isArray(items)) { - items.forEach(checkUsedAndDelete); - } else if (items) { - checkUsedAndDelete(items); - } + callTapsSeries({ + onError, + onResult, + resultReturns, + onDone, + doneReturns, + rethrowIfPossible + }) { + if (this.options.taps.length === 0) return onDone(); + const firstAsync = this.options.taps.findIndex(t => t.type !== "sync"); + const somethingReturns = resultReturns || doneReturns; + let code = ""; + let current = onDone; + let unrollCounter = 0; + for (let j = this.options.taps.length - 1; j >= 0; j--) { + const i = j; + const unroll = + current !== onDone && + (this.options.taps[i].type !== "sync" || unrollCounter++ > 20); + if (unroll) { + unrollCounter = 0; + code += `function _next${i}() {\n`; + code += current(); + code += `}\n`; + current = () => `${somethingReturns ? "return " : ""}_next${i}();\n`; } + const done = current; + const doneBreak = skipDone => { + if (skipDone) return ""; + return onDone(); + }; + const content = this.callTap(i, { + onError: error => onError(i, error, done, doneBreak), + onResult: + onResult && + (result => { + return onResult(i, result, done, doneBreak); + }), + onDone: !onResult && done, + rethrowIfPossible: + rethrowIfPossible && (firstAsync < 0 || i < firstAsync) + }); + current = () => content; } - // TODO If this becomes a performance problem - // store a reverse mapping from asset to chunk - for (const chunk of this.chunks) { - chunk.files.delete(file); - chunk.auxiliaryFiles.delete(file); - } + code += current(); + return code; } - getAssets() { - /** @type {Readonly[]} */ - const array = []; - for (const assetName of Object.keys(this.assets)) { - if (Object.prototype.hasOwnProperty.call(this.assets, assetName)) { - array.push({ - name: assetName, - source: this.assets[assetName], - info: this.assetsInfo.get(assetName) || EMPTY_ASSET_INFO - }); + callTapsLooping({ onError, onDone, rethrowIfPossible }) { + if (this.options.taps.length === 0) return onDone(); + const syncOnly = this.options.taps.every(t => t.type === "sync"); + let code = ""; + if (!syncOnly) { + code += "var _looper = (function() {\n"; + code += "var _loopAsync = false;\n"; + } + code += "var _loop;\n"; + code += "do {\n"; + code += "_loop = false;\n"; + for (let i = 0; i < this.options.interceptors.length; i++) { + const interceptor = this.options.interceptors[i]; + if (interceptor.loop) { + code += `${this.getInterceptor(i)}.loop(${this.args({ + before: interceptor.context ? "_context" : undefined + })});\n`; } } - return array; - } - - /** - * @param {string} name the name of the asset - * @returns {Readonly | undefined} the asset or undefined when not found - */ - getAsset(name) { - if (!Object.prototype.hasOwnProperty.call(this.assets, name)) - return undefined; - return { - name, - source: this.assets[name], - info: this.assetsInfo.get(name) || EMPTY_ASSET_INFO - }; + code += this.callTapsSeries({ + onError, + onResult: (i, result, next, doneBreak) => { + let code = ""; + code += `if(${result} !== undefined) {\n`; + code += "_loop = true;\n"; + if (!syncOnly) code += "if(_loopAsync) _looper();\n"; + code += doneBreak(true); + code += `} else {\n`; + code += next(); + code += `}\n`; + return code; + }, + onDone: + onDone && + (() => { + let code = ""; + code += "if(!_loop) {\n"; + code += onDone(); + code += "}\n"; + return code; + }), + rethrowIfPossible: rethrowIfPossible && syncOnly + }); + code += "} while(_loop);\n"; + if (!syncOnly) { + code += "_loopAsync = true;\n"; + code += "});\n"; + code += "_looper();\n"; + } + return code; } - clearAssets() { - for (const chunk of this.chunks) { - chunk.files.clear(); - chunk.auxiliaryFiles.clear(); + callTapsParallel({ + onError, + onResult, + onDone, + rethrowIfPossible, + onTap = (i, run) => run() + }) { + if (this.options.taps.length <= 1) { + return this.callTapsSeries({ + onError, + onResult, + onDone, + rethrowIfPossible + }); + } + let code = ""; + code += "do {\n"; + code += `var _counter = ${this.options.taps.length};\n`; + if (onDone) { + code += "var _done = (function() {\n"; + code += onDone(); + code += "});\n"; + } + for (let i = 0; i < this.options.taps.length; i++) { + const done = () => { + if (onDone) return "if(--_counter === 0) _done();\n"; + else return "--_counter;"; + }; + const doneBreak = skipDone => { + if (skipDone || !onDone) return "_counter = 0;\n"; + else return "_counter = 0;\n_done();\n"; + }; + code += "if(_counter <= 0) break;\n"; + code += onTap( + i, + () => + this.callTap(i, { + onError: error => { + let code = ""; + code += "if(_counter > 0) {\n"; + code += onError(i, error, done, doneBreak); + code += "}\n"; + return code; + }, + onResult: + onResult && + (result => { + let code = ""; + code += "if(_counter > 0) {\n"; + code += onResult(i, result, done, doneBreak); + code += "}\n"; + return code; + }), + onDone: + !onResult && + (() => { + return done(); + }), + rethrowIfPossible + }), + done, + doneBreak + ); } + code += "} while(false);\n"; + return code; } - createModuleAssets() { - const { chunkGraph } = this; - for (const module of this.modules) { - if (module.buildInfo.assets) { - const assetsInfo = module.buildInfo.assetsInfo; - for (const assetName of Object.keys(module.buildInfo.assets)) { - const fileName = this.getPath(assetName, { - chunkGraph: this.chunkGraph, - module - }); - for (const chunk of chunkGraph.getModuleChunksIterable(module)) { - chunk.auxiliaryFiles.add(fileName); - } - this.emitAsset( - fileName, - module.buildInfo.assets[assetName], - assetsInfo ? assetsInfo.get(assetName) : undefined - ); - this.hooks.moduleAsset.call(module, fileName); - } - } + args({ before, after } = {}) { + let allArgs = this._args; + if (before) allArgs = [before].concat(allArgs); + if (after) allArgs = allArgs.concat(after); + if (allArgs.length === 0) { + return ""; + } else { + return allArgs.join(", "); } } - /** - * @param {RenderManifestOptions} options options object - * @returns {RenderManifestEntry[]} manifest entries - */ - getRenderManifest(options) { - return this.hooks.renderManifest.call([], options); + getTapFn(idx) { + return `_x[${idx}]`; } - /** - * @param {Callback} callback signals when the call finishes - * @returns {void} - */ - createChunkAssets(callback) { - const outputOptions = this.outputOptions; - const cachedSourceMap = new WeakMap(); - /** @type {Map} */ - const alreadyWrittenFiles = new Map(); + getTap(idx) { + return `_taps[${idx}]`; + } - asyncLib.forEachLimit( - this.chunks, - 15, - (chunk, callback) => { - /** @type {RenderManifestEntry[]} */ - let manifest; - try { - manifest = this.getRenderManifest({ - chunk, - hash: this.hash, - fullHash: this.fullHash, - outputOptions, - codeGenerationResults: this.codeGenerationResults, - moduleTemplates: this.moduleTemplates, - dependencyTemplates: this.dependencyTemplates, - chunkGraph: this.chunkGraph, - moduleGraph: this.moduleGraph, - runtimeTemplate: this.runtimeTemplate - }); - } catch (err) { - this.errors.push(new ChunkRenderError(chunk, "", err)); - return callback(); - } - asyncLib.forEach( - manifest, - (fileManifest, callback) => { - const ident = fileManifest.identifier; - const usedHash = fileManifest.hash; + getInterceptor(idx) { + return `_interceptors[${idx}]`; + } +} - const assetCacheItem = this._assetsCache.getItemCache( - ident, - usedHash - ); +module.exports = HookCodeFactory; - assetCacheItem.get((err, sourceFromCache) => { - /** @type {string | function(PathData, AssetInfo=): string} */ - let filenameTemplate; - /** @type {string} */ - let file; - /** @type {AssetInfo} */ - let assetInfo; - let inTry = true; - const errorAndCallback = err => { - const filename = - file || - (typeof file === "string" - ? file - : typeof filenameTemplate === "string" - ? filenameTemplate - : ""); +/***/ }), - this.errors.push(new ChunkRenderError(chunk, filename, err)); - inTry = false; - return callback(); - }; +/***/ 77079: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - try { - if ("filename" in fileManifest) { - file = fileManifest.filename; - assetInfo = fileManifest.info; - } else { - filenameTemplate = fileManifest.filenameTemplate; - const pathAndInfo = this.getPathWithInfo( - filenameTemplate, - fileManifest.pathOptions - ); - file = pathAndInfo.path; - assetInfo = fileManifest.info - ? { - ...pathAndInfo.info, - ...fileManifest.info - } - : pathAndInfo.info; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (err) { - return errorAndCallback(err); - } - let source = sourceFromCache; +const util = __webpack_require__(73837); - // check if the same filename was already written by another chunk - const alreadyWritten = alreadyWrittenFiles.get(file); - if (alreadyWritten !== undefined) { - if (alreadyWritten.hash !== usedHash) { - inTry = false; - return callback( - new WebpackError( - `Conflict: Multiple chunks emit assets to the same filename ${file}` + - ` (chunks ${alreadyWritten.chunk.id} and ${chunk.id})` - ) - ); - } else { - source = alreadyWritten.source; - } - } else if (!source) { - // render the asset - source = fileManifest.render(); +const defaultFactory = (key, hook) => hook; - // Ensure that source is a cached source to avoid additional cost because of repeated access - if (!(source instanceof CachedSource)) { - const cacheEntry = cachedSourceMap.get(source); - if (cacheEntry) { - source = cacheEntry; - } else { - const cachedSource = new CachedSource(source); - cachedSourceMap.set(source, cachedSource); - source = cachedSource; - } - } - } - this.emitAsset(file, source, assetInfo); - if (fileManifest.auxiliary) { - chunk.auxiliaryFiles.add(file); - } else { - chunk.files.add(file); - } - this.hooks.chunkAsset.call(chunk, file); - alreadyWrittenFiles.set(file, { - hash: usedHash, - source, - chunk - }); - if (source !== sourceFromCache) { - assetCacheItem.store(source, err => { - if (err) return errorAndCallback(err); - inTry = false; - return callback(); - }); - } else { - inTry = false; - callback(); - } - } catch (err) { - if (!inTry) throw err; - errorAndCallback(err); - } - }); - }, - callback - ); - }, - callback - ); +class HookMap { + constructor(factory, name = undefined) { + this._map = new Map(); + this.name = name; + this._factory = factory; + this._interceptors = []; } - /** - * @param {string | function(PathData, AssetInfo=): string} filename used to get asset path with hash - * @param {PathData} data context data - * @returns {string} interpolated path - */ - getPath(filename, data = {}) { - if (!data.hash) { - data = { - hash: this.hash, - ...data - }; - } - return this.getAssetPath(filename, data); + get(key) { + return this._map.get(key); } - /** - * @param {string | function(PathData, AssetInfo=): string} filename used to get asset path with hash - * @param {PathData} data context data - * @returns {{ path: string, info: AssetInfo }} interpolated path and asset info - */ - getPathWithInfo(filename, data = {}) { - if (!data.hash) { - data = { - hash: this.hash, - ...data - }; + for(key) { + const hook = this.get(key); + if (hook !== undefined) { + return hook; } - return this.getAssetPathWithInfo(filename, data); + let newHook = this._factory(key); + const interceptors = this._interceptors; + for (let i = 0; i < interceptors.length; i++) { + newHook = interceptors[i].factory(key, newHook); + } + this._map.set(key, newHook); + return newHook; } - /** - * @param {string | function(PathData, AssetInfo=): string} filename used to get asset path with hash - * @param {PathData} data context data - * @returns {string} interpolated path - */ - getAssetPath(filename, data) { - return this.hooks.assetPath.call( - typeof filename === "function" ? filename(data) : filename, - data, - undefined + intercept(interceptor) { + this._interceptors.push( + Object.assign( + { + factory: defaultFactory + }, + interceptor + ) ); } +} - /** - * @param {string | function(PathData, AssetInfo=): string} filename used to get asset path with hash - * @param {PathData} data context data - * @returns {{ path: string, info: AssetInfo }} interpolated path and asset info - */ - getAssetPathWithInfo(filename, data) { - const assetInfo = {}; - // TODO webpack 5: refactor assetPath hook to receive { path, info } object - const newPath = this.hooks.assetPath.call( - typeof filename === "function" ? filename(data, assetInfo) : filename, - data, - assetInfo - ); - return { path: newPath, info: assetInfo }; +HookMap.prototype.tap = util.deprecate(function(key, options, fn) { + return this.for(key).tap(options, fn); +}, "HookMap#tap(key,…) is deprecated. Use HookMap#for(key).tap(…) instead."); + +HookMap.prototype.tapAsync = util.deprecate(function(key, options, fn) { + return this.for(key).tapAsync(options, fn); +}, "HookMap#tapAsync(key,…) is deprecated. Use HookMap#for(key).tapAsync(…) instead."); + +HookMap.prototype.tapPromise = util.deprecate(function(key, options, fn) { + return this.for(key).tapPromise(options, fn); +}, "HookMap#tapPromise(key,…) is deprecated. Use HookMap#for(key).tapPromise(…) instead."); + +module.exports = HookMap; + + +/***/ }), + +/***/ 13103: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + +const Hook = __webpack_require__(21468); + +class MultiHook { + constructor(hooks, name = undefined) { + this.hooks = hooks; + this.name = name; } - getWarnings() { - return this.hooks.processWarnings.call(this.warnings); + tap(options, fn) { + for (const hook of this.hooks) { + hook.tap(options, fn); + } } - getErrors() { - return this.hooks.processErrors.call(this.errors); + tapAsync(options, fn) { + for (const hook of this.hooks) { + hook.tapAsync(options, fn); + } } - /** - * This function allows you to run another instance of webpack inside of webpack however as - * a child with different settings and configurations (if desired) applied. It copies all hooks, plugins - * from parent (or top level compiler) and creates a child Compilation - * - * @param {string} name name of the child compiler - * @param {OutputOptions=} outputOptions // Need to convert config schema to types for this - * @param {Array=} plugins webpack plugins that will be applied - * @returns {Compiler} creates a child Compiler instance - */ - createChildCompiler(name, outputOptions, plugins) { - const idx = this.childrenCounters[name] || 0; - this.childrenCounters[name] = idx + 1; - return this.compiler.createChildCompiler( - this, - name, - idx, - outputOptions, - plugins + tapPromise(options, fn) { + for (const hook of this.hooks) { + hook.tapPromise(options, fn); + } + } + + isUsed() { + for (const hook of this.hooks) { + if (hook.isUsed()) return true; + } + return false; + } + + intercept(interceptor) { + for (const hook of this.hooks) { + hook.intercept(interceptor); + } + } + + withOptions(options) { + return new MultiHook( + this.hooks.map(h => h.withOptions(options)), + this.name ); } +} - /** - * @param {Module} module the module - * @param {ExecuteModuleOptions} options options - * @param {ExecuteModuleCallback} callback callback - */ - executeModule(module, options, callback) { - // Aggregate all referenced modules and ensure they are ready - const modules = new Set([module]); - processAsyncTree( - modules, - 10, - /** - * @param {Module} module the module - * @param {function(Module): void} push push more jobs - * @param {Callback} callback callback - * @returns {void} - */ - (module, push, callback) => { - this.buildQueue.waitFor(module, err => { - if (err) return callback(err); - this.processDependenciesQueue.waitFor(module, err => { - if (err) return callback(err); - for (const { module: m } of this.moduleGraph.getOutgoingConnections( - module - )) { - const size = modules.size; - modules.add(m); - if (modules.size !== size) push(m); - } - callback(); - }); - }); - }, - err => { - if (err) return callback(err); +module.exports = MultiHook; - // Create new chunk graph, chunk and entrypoint for the build time execution - const chunkGraph = new ChunkGraph( - this.moduleGraph, - this.outputOptions.hashFunction - ); - const runtime = "build time"; - const { hashFunction, hashDigest, hashDigestLength } = - this.outputOptions; - const runtimeTemplate = this.runtimeTemplate; - const chunk = new Chunk("build time chunk", this._backCompat); - chunk.id = chunk.name; - chunk.ids = [chunk.id]; - chunk.runtime = runtime; +/***/ }), - const entrypoint = new Entrypoint({ - runtime, - chunkLoading: false, - ...options.entryOptions - }); - chunkGraph.connectChunkAndEntryModule(chunk, module, entrypoint); - connectChunkGroupAndChunk(entrypoint, chunk); - entrypoint.setRuntimeChunk(chunk); - entrypoint.setEntrypointChunk(chunk); +/***/ 1626: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const chunks = new Set([chunk]); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // Assign ids to modules and modules to the chunk - for (const module of modules) { - const id = module.identifier(); - chunkGraph.setModuleId(module, id); - chunkGraph.connectChunkAndModule(chunk, module); - } - // Hash modules - for (const module of modules) { - this._createModuleHash( - module, - chunkGraph, - runtime, - hashFunction, - runtimeTemplate, - hashDigest, - hashDigestLength - ); - } +const Hook = __webpack_require__(21468); +const HookCodeFactory = __webpack_require__(66443); - const codeGenerationResults = new CodeGenerationResults( - this.outputOptions.hashFunction - ); - /** @type {WebpackError[]} */ - const errors = []; - /** - * @param {Module} module the module - * @param {Callback} callback callback - * @returns {void} - */ - const codeGen = (module, callback) => { - this._codeGenerationModule( - module, - runtime, - [runtime], - chunkGraph.getModuleHash(module, runtime), - this.dependencyTemplates, - chunkGraph, - this.moduleGraph, - runtimeTemplate, - errors, - codeGenerationResults, - (err, codeGenerated) => { - callback(err); - } - ); - }; +class SyncBailHookCodeFactory extends HookCodeFactory { + content({ onError, onResult, resultReturns, onDone, rethrowIfPossible }) { + return this.callTapsSeries({ + onError: (i, err) => onError(err), + onResult: (i, result, next) => + `if(${result} !== undefined) {\n${onResult( + result + )};\n} else {\n${next()}}\n`, + resultReturns, + onDone, + rethrowIfPossible + }); + } +} - const reportErrors = () => { - if (errors.length > 0) { - errors.sort( - compareSelect(err => err.module, compareModulesByIdentifier) - ); - for (const error of errors) { - this.errors.push(error); - } - errors.length = 0; - } - }; +const factory = new SyncBailHookCodeFactory(); - // Generate code for all aggregated modules - asyncLib.eachLimit(modules, 10, codeGen, err => { - if (err) return callback(err); - reportErrors(); +const TAP_ASYNC = () => { + throw new Error("tapAsync is not supported on a SyncBailHook"); +}; - // for backward-compat temporary set the chunk graph - // TODO webpack 6 - const old = this.chunkGraph; - this.chunkGraph = chunkGraph; - this.processRuntimeRequirements({ - chunkGraph, - modules, - chunks, - codeGenerationResults, - chunkGraphEntries: chunks - }); - this.chunkGraph = old; +const TAP_PROMISE = () => { + throw new Error("tapPromise is not supported on a SyncBailHook"); +}; - const runtimeModules = - chunkGraph.getChunkRuntimeModulesIterable(chunk); +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; - // Hash runtime modules - for (const module of runtimeModules) { - modules.add(module); - this._createModuleHash( - module, - chunkGraph, - runtime, - hashFunction, - runtimeTemplate, - hashDigest, - hashDigestLength - ); - } +function SyncBailHook(args = [], name = undefined) { + const hook = new Hook(args, name); + hook.constructor = SyncBailHook; + hook.tapAsync = TAP_ASYNC; + hook.tapPromise = TAP_PROMISE; + hook.compile = COMPILE; + return hook; +} - // Generate code for all runtime modules - asyncLib.eachLimit(runtimeModules, 10, codeGen, err => { - if (err) return callback(err); - reportErrors(); +SyncBailHook.prototype = null; - /** @type {Map} */ - const moduleArgumentsMap = new Map(); - /** @type {Map} */ - const moduleArgumentsById = new Map(); +module.exports = SyncBailHook; - /** @type {ExecuteModuleResult["fileDependencies"]} */ - const fileDependencies = new LazySet(); - /** @type {ExecuteModuleResult["contextDependencies"]} */ - const contextDependencies = new LazySet(); - /** @type {ExecuteModuleResult["missingDependencies"]} */ - const missingDependencies = new LazySet(); - /** @type {ExecuteModuleResult["buildDependencies"]} */ - const buildDependencies = new LazySet(); - /** @type {ExecuteModuleResult["assets"]} */ - const assets = new Map(); +/***/ }), - let cacheable = true; +/***/ 69689: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** @type {ExecuteModuleContext} */ - const context = { - assets, - __webpack_require__: undefined, - chunk, - chunkGraph - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // Prepare execution - asyncLib.eachLimit( - modules, - 10, - (module, callback) => { - const codeGenerationResult = codeGenerationResults.get( - module, - runtime - ); - /** @type {ExecuteModuleArgument} */ - const moduleArgument = { - module, - codeGenerationResult, - preparedInfo: undefined, - moduleObject: undefined - }; - moduleArgumentsMap.set(module, moduleArgument); - moduleArgumentsById.set(module.identifier(), moduleArgument); - module.addCacheDependencies( - fileDependencies, - contextDependencies, - missingDependencies, - buildDependencies - ); - if (module.buildInfo.cacheable === false) { - cacheable = false; - } - if (module.buildInfo && module.buildInfo.assets) { - const { assets: moduleAssets, assetsInfo } = module.buildInfo; - for (const assetName of Object.keys(moduleAssets)) { - assets.set(assetName, { - source: moduleAssets[assetName], - info: assetsInfo ? assetsInfo.get(assetName) : undefined - }); - } - } - this.hooks.prepareModuleExecution.callAsync( - moduleArgument, - context, - callback - ); - }, - err => { - if (err) return callback(err); - let exports; - try { - const { - strictModuleErrorHandling, - strictModuleExceptionHandling - } = this.outputOptions; - const __nested_webpack_require_152432__ = id => { - const cached = moduleCache[id]; - if (cached !== undefined) { - if (cached.error) throw cached.error; - return cached.exports; - } - const moduleArgument = moduleArgumentsById.get(id); - return __webpack_require_module__(moduleArgument, id); - }; - const interceptModuleExecution = (__nested_webpack_require_152432__[ - RuntimeGlobals.interceptModuleExecution.replace( - "__webpack_require__.", - "" - ) - ] = []); - const moduleCache = (__nested_webpack_require_152432__[ - RuntimeGlobals.moduleCache.replace( - "__webpack_require__.", - "" - ) - ] = {}); +const Hook = __webpack_require__(21468); +const HookCodeFactory = __webpack_require__(66443); - context.__webpack_require__ = __nested_webpack_require_152432__; +class SyncHookCodeFactory extends HookCodeFactory { + content({ onError, onDone, rethrowIfPossible }) { + return this.callTapsSeries({ + onError: (i, err) => onError(err), + onDone, + rethrowIfPossible + }); + } +} - /** - * @param {ExecuteModuleArgument} moduleArgument the module argument - * @param {string=} id id - * @returns {any} exports - */ - const __webpack_require_module__ = (moduleArgument, id) => { - var execOptions = { - id, - module: { - id, - exports: {}, - loaded: false, - error: undefined - }, - require: __nested_webpack_require_152432__ - }; - interceptModuleExecution.forEach(handler => - handler(execOptions) - ); - const module = moduleArgument.module; - this.buildTimeExecutedModules.add(module); - const moduleObject = execOptions.module; - moduleArgument.moduleObject = moduleObject; - try { - if (id) moduleCache[id] = moduleObject; +const factory = new SyncHookCodeFactory(); - tryRunOrWebpackError( - () => - this.hooks.executeModule.call( - moduleArgument, - context - ), - "Compilation.hooks.executeModule" - ); - moduleObject.loaded = true; - return moduleObject.exports; - } catch (e) { - if (strictModuleExceptionHandling) { - if (id) delete moduleCache[id]; - } else if (strictModuleErrorHandling) { - moduleObject.error = e; - } - if (!e.module) e.module = module; - throw e; - } - }; +const TAP_ASYNC = () => { + throw new Error("tapAsync is not supported on a SyncHook"); +}; - for (const runtimeModule of chunkGraph.getChunkRuntimeModulesInOrder( - chunk - )) { - __webpack_require_module__( - moduleArgumentsMap.get(runtimeModule) - ); - } - exports = __nested_webpack_require_152432__(module.identifier()); - } catch (e) { - const err = new WebpackError( - `Execution of module code from module graph (${module.readableIdentifier( - this.requestShortener - )}) failed: ${e.message}` - ); - err.stack = e.stack; - err.module = e.module; - return callback(err); - } +const TAP_PROMISE = () => { + throw new Error("tapPromise is not supported on a SyncHook"); +}; - callback(null, { - exports, - assets, - cacheable, - fileDependencies, - contextDependencies, - missingDependencies, - buildDependencies - }); - } - ); - }); - }); - } - ); - } - - checkConstraints() { - const chunkGraph = this.chunkGraph; - - /** @type {Set} */ - const usedIds = new Set(); - - for (const module of this.modules) { - if (module.type === "runtime") continue; - const moduleId = chunkGraph.getModuleId(module); - if (moduleId === null) continue; - if (usedIds.has(moduleId)) { - throw new Error(`checkConstraints: duplicate module id ${moduleId}`); - } - usedIds.add(moduleId); - } - - for (const chunk of this.chunks) { - for (const module of chunkGraph.getChunkModulesIterable(chunk)) { - if (!this.modules.has(module)) { - throw new Error( - "checkConstraints: module in chunk but not in compilation " + - ` ${chunk.debugId} ${module.debugId}` - ); - } - } - for (const module of chunkGraph.getChunkEntryModulesIterable(chunk)) { - if (!this.modules.has(module)) { - throw new Error( - "checkConstraints: entry module in chunk but not in compilation " + - ` ${chunk.debugId} ${module.debugId}` - ); - } - } - } +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; - for (const chunkGroup of this.chunkGroups) { - chunkGroup.checkConstraints(); - } - } +function SyncHook(args = [], name = undefined) { + const hook = new Hook(args, name); + hook.constructor = SyncHook; + hook.tapAsync = TAP_ASYNC; + hook.tapPromise = TAP_PROMISE; + hook.compile = COMPILE; + return hook; } -/** - * @typedef {Object} FactorizeModuleOptions - * @property {ModuleProfile} currentProfile - * @property {ModuleFactory} factory - * @property {Dependency[]} dependencies - * @property {boolean=} factoryResult return full ModuleFactoryResult instead of only module - * @property {Module | null} originModule - * @property {Partial=} contextInfo - * @property {string=} context - */ - -/** - * @param {FactorizeModuleOptions} options options object - * @param {ModuleCallback | ModuleFactoryResultCallback} callback callback - * @returns {void} - */ - -// Workaround for typescript as it doesn't support function overloading in jsdoc within a class -Compilation.prototype.factorizeModule = /** @type {{ - (options: FactorizeModuleOptions & { factoryResult?: false }, callback: ModuleCallback): void; - (options: FactorizeModuleOptions & { factoryResult: true }, callback: ModuleFactoryResultCallback): void; -}} */ ( - function (options, callback) { - this.factorizeQueue.add(options, callback); - } -); - -// Hide from typescript -const compilationPrototype = Compilation.prototype; - -// TODO webpack 6 remove -Object.defineProperty(compilationPrototype, "modifyHash", { - writable: false, - enumerable: false, - configurable: false, - value: () => { - throw new Error( - "Compilation.modifyHash was removed in favor of Compilation.hooks.fullHash" - ); - } -}); - -// TODO webpack 6 remove -Object.defineProperty(compilationPrototype, "cache", { - enumerable: false, - configurable: false, - get: util.deprecate( - /** - * @this {Compilation} the compilation - * @returns {Cache} the cache - */ - function () { - return this.compiler.cache; - }, - "Compilation.cache was removed in favor of Compilation.getCache()", - "DEP_WEBPACK_COMPILATION_CACHE" - ), - set: util.deprecate( - v => {}, - "Compilation.cache was removed in favor of Compilation.getCache()", - "DEP_WEBPACK_COMPILATION_CACHE" - ) -}); - -/** - * Add additional assets to the compilation. - */ -Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL = -2000; +SyncHook.prototype = null; -/** - * Basic preprocessing of assets. - */ -Compilation.PROCESS_ASSETS_STAGE_PRE_PROCESS = -1000; +module.exports = SyncHook; -/** - * Derive new assets from existing assets. - * Existing assets should not be treated as complete. - */ -Compilation.PROCESS_ASSETS_STAGE_DERIVED = -200; -/** - * Add additional sections to existing assets, like a banner or initialization code. - */ -Compilation.PROCESS_ASSETS_STAGE_ADDITIONS = -100; +/***/ }), -/** - * Optimize existing assets in a general way. - */ -Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE = 100; +/***/ 50179: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** - * Optimize the count of existing assets, e. g. by merging them. - * Only assets of the same type should be merged. - * For assets of different types see PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE. - */ -Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT = 200; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/** - * Optimize the compatibility of existing assets, e. g. add polyfills or vendor-prefixes. - */ -Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY = 300; -/** - * Optimize the size of existing assets, e. g. by minimizing or omitting whitespace. - */ -Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE = 400; +const Hook = __webpack_require__(21468); +const HookCodeFactory = __webpack_require__(66443); -/** - * Add development tooling to assets, e. g. by extracting a SourceMap. - */ -Compilation.PROCESS_ASSETS_STAGE_DEV_TOOLING = 500; +class SyncLoopHookCodeFactory extends HookCodeFactory { + content({ onError, onDone, rethrowIfPossible }) { + return this.callTapsLooping({ + onError: (i, err) => onError(err), + onDone, + rethrowIfPossible + }); + } +} -/** - * Optimize the count of existing assets, e. g. by inlining assets of into other assets. - * Only assets of different types should be inlined. - * For assets of the same type see PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT. - */ -Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE = 700; +const factory = new SyncLoopHookCodeFactory(); -/** - * Summarize the list of existing assets - * e. g. creating an assets manifest of Service Workers. - */ -Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE = 1000; +const TAP_ASYNC = () => { + throw new Error("tapAsync is not supported on a SyncLoopHook"); +}; -/** - * Optimize the hashes of the assets, e. g. by generating real hashes of the asset content. - */ -Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH = 2500; +const TAP_PROMISE = () => { + throw new Error("tapPromise is not supported on a SyncLoopHook"); +}; -/** - * Optimize the transfer of existing assets, e. g. by preparing a compressed (gzip) file as separate asset. - */ -Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER = 3000; +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; -/** - * Analyse existing assets. - */ -Compilation.PROCESS_ASSETS_STAGE_ANALYSE = 4000; +function SyncLoopHook(args = [], name = undefined) { + const hook = new Hook(args, name); + hook.constructor = SyncLoopHook; + hook.tapAsync = TAP_ASYNC; + hook.tapPromise = TAP_PROMISE; + hook.compile = COMPILE; + return hook; +} -/** - * Creating assets for reporting purposes. - */ -Compilation.PROCESS_ASSETS_STAGE_REPORT = 5000; +SyncLoopHook.prototype = null; -module.exports = Compilation; +module.exports = SyncLoopHook; /***/ }), -/***/ 70845: +/***/ 36093: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -27576,1223 +24044,759 @@ module.exports = Compilation; */ +const Hook = __webpack_require__(21468); +const HookCodeFactory = __webpack_require__(66443); -const parseJson = __webpack_require__(15235); -const asyncLib = __webpack_require__(78175); -const { - SyncHook, - SyncBailHook, - AsyncParallelHook, - AsyncSeriesHook -} = __webpack_require__(6967); -const { SizeOnlySource } = __webpack_require__(51255); -const webpack = __webpack_require__(91919); -const Cache = __webpack_require__(7592); -const CacheFacade = __webpack_require__(55392); -const ChunkGraph = __webpack_require__(64971); -const Compilation = __webpack_require__(85720); -const ConcurrentCompilationError = __webpack_require__(95735); -const ContextModuleFactory = __webpack_require__(62471); -const ModuleGraph = __webpack_require__(99988); -const NormalModuleFactory = __webpack_require__(68860); -const RequestShortener = __webpack_require__(73406); -const ResolverFactory = __webpack_require__(30217); -const Stats = __webpack_require__(31743); -const Watching = __webpack_require__(84275); -const WebpackError = __webpack_require__(53799); -const { Logger } = __webpack_require__(32597); -const { join, dirname, mkdirp } = __webpack_require__(17139); -const { makePathsRelative } = __webpack_require__(82186); -const { isSourceEqual } = __webpack_require__(41245); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").EntryNormalized} Entry */ -/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */ -/** @typedef {import("../declarations/WebpackOptions").WatchOptions} WatchOptions */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./util/WeakTupleMap")} WeakTupleMap */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ -/** @typedef {import("./util/fs").IntermediateFileSystem} IntermediateFileSystem */ -/** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */ -/** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */ - -/** - * @typedef {Object} CompilationParams - * @property {NormalModuleFactory} normalModuleFactory - * @property {ContextModuleFactory} contextModuleFactory - */ - -/** - * @template T - * @callback Callback - * @param {(Error | null)=} err - * @param {T=} result - */ - -/** - * @callback RunAsChildCallback - * @param {(Error | null)=} err - * @param {Chunk[]=} entries - * @param {Compilation=} compilation - */ +class SyncWaterfallHookCodeFactory extends HookCodeFactory { + content({ onError, onResult, resultReturns, rethrowIfPossible }) { + return this.callTapsSeries({ + onError: (i, err) => onError(err), + onResult: (i, result, next) => { + let code = ""; + code += `if(${result} !== undefined) {\n`; + code += `${this._args[0]} = ${result};\n`; + code += `}\n`; + code += next(); + return code; + }, + onDone: () => onResult(this._args[0]), + doneReturns: resultReturns, + rethrowIfPossible + }); + } +} -/** - * @typedef {Object} AssetEmittedInfo - * @property {Buffer} content - * @property {Source} source - * @property {Compilation} compilation - * @property {string} outputPath - * @property {string} targetPath - */ +const factory = new SyncWaterfallHookCodeFactory(); -/** - * @param {string[]} array an array - * @returns {boolean} true, if the array is sorted - */ -const isSorted = array => { - for (let i = 1; i < array.length; i++) { - if (array[i - 1] > array[i]) return false; - } - return true; +const TAP_ASYNC = () => { + throw new Error("tapAsync is not supported on a SyncWaterfallHook"); }; -/** - * @param {Object} obj an object - * @param {string[]} keys the keys of the object - * @returns {Object} the object with properties sorted by property name - */ -const sortObject = (obj, keys) => { - const o = {}; - for (const k of keys.sort()) { - o[k] = obj[k]; - } - return o; +const TAP_PROMISE = () => { + throw new Error("tapPromise is not supported on a SyncWaterfallHook"); }; -/** - * @param {string} filename filename - * @param {string | string[] | undefined} hashes list of hashes - * @returns {boolean} true, if the filename contains any hash - */ -const includesHash = (filename, hashes) => { - if (!hashes) return false; - if (Array.isArray(hashes)) { - return hashes.some(hash => filename.includes(hash)); - } else { - return filename.includes(hashes); - } +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); }; -class Compiler { - /** - * @param {string} context the compilation path - * @param {WebpackOptions} options options - */ - constructor(context, options = /** @type {WebpackOptions} */ ({})) { - this.hooks = Object.freeze({ - /** @type {SyncHook<[]>} */ - initialize: new SyncHook([]), - - /** @type {SyncBailHook<[Compilation], boolean>} */ - shouldEmit: new SyncBailHook(["compilation"]), - /** @type {AsyncSeriesHook<[Stats]>} */ - done: new AsyncSeriesHook(["stats"]), - /** @type {SyncHook<[Stats]>} */ - afterDone: new SyncHook(["stats"]), - /** @type {AsyncSeriesHook<[]>} */ - additionalPass: new AsyncSeriesHook([]), - /** @type {AsyncSeriesHook<[Compiler]>} */ - beforeRun: new AsyncSeriesHook(["compiler"]), - /** @type {AsyncSeriesHook<[Compiler]>} */ - run: new AsyncSeriesHook(["compiler"]), - /** @type {AsyncSeriesHook<[Compilation]>} */ - emit: new AsyncSeriesHook(["compilation"]), - /** @type {AsyncSeriesHook<[string, AssetEmittedInfo]>} */ - assetEmitted: new AsyncSeriesHook(["file", "info"]), - /** @type {AsyncSeriesHook<[Compilation]>} */ - afterEmit: new AsyncSeriesHook(["compilation"]), - - /** @type {SyncHook<[Compilation, CompilationParams]>} */ - thisCompilation: new SyncHook(["compilation", "params"]), - /** @type {SyncHook<[Compilation, CompilationParams]>} */ - compilation: new SyncHook(["compilation", "params"]), - /** @type {SyncHook<[NormalModuleFactory]>} */ - normalModuleFactory: new SyncHook(["normalModuleFactory"]), - /** @type {SyncHook<[ContextModuleFactory]>} */ - contextModuleFactory: new SyncHook(["contextModuleFactory"]), +function SyncWaterfallHook(args = [], name = undefined) { + if (args.length < 1) + throw new Error("Waterfall hooks must have at least one argument"); + const hook = new Hook(args, name); + hook.constructor = SyncWaterfallHook; + hook.tapAsync = TAP_ASYNC; + hook.tapPromise = TAP_PROMISE; + hook.compile = COMPILE; + return hook; +} - /** @type {AsyncSeriesHook<[CompilationParams]>} */ - beforeCompile: new AsyncSeriesHook(["params"]), - /** @type {SyncHook<[CompilationParams]>} */ - compile: new SyncHook(["params"]), - /** @type {AsyncParallelHook<[Compilation]>} */ - make: new AsyncParallelHook(["compilation"]), - /** @type {AsyncParallelHook<[Compilation]>} */ - finishMake: new AsyncSeriesHook(["compilation"]), - /** @type {AsyncSeriesHook<[Compilation]>} */ - afterCompile: new AsyncSeriesHook(["compilation"]), +SyncWaterfallHook.prototype = null; - /** @type {AsyncSeriesHook<[]>} */ - readRecords: new AsyncSeriesHook([]), - /** @type {AsyncSeriesHook<[]>} */ - emitRecords: new AsyncSeriesHook([]), +module.exports = SyncWaterfallHook; - /** @type {AsyncSeriesHook<[Compiler]>} */ - watchRun: new AsyncSeriesHook(["compiler"]), - /** @type {SyncHook<[Error]>} */ - failed: new SyncHook(["error"]), - /** @type {SyncHook<[string | null, number]>} */ - invalid: new SyncHook(["filename", "changeTime"]), - /** @type {SyncHook<[]>} */ - watchClose: new SyncHook([]), - /** @type {AsyncSeriesHook<[]>} */ - shutdown: new AsyncSeriesHook([]), - /** @type {SyncBailHook<[string, string, any[]], true>} */ - infrastructureLog: new SyncBailHook(["origin", "type", "args"]), +/***/ }), - // TODO the following hooks are weirdly located here - // TODO move them for webpack 5 - /** @type {SyncHook<[]>} */ - environment: new SyncHook([]), - /** @type {SyncHook<[]>} */ - afterEnvironment: new SyncHook([]), - /** @type {SyncHook<[Compiler]>} */ - afterPlugins: new SyncHook(["compiler"]), - /** @type {SyncHook<[Compiler]>} */ - afterResolvers: new SyncHook(["compiler"]), - /** @type {SyncBailHook<[string, Entry], boolean>} */ - entryOption: new SyncBailHook(["context", "entry"]) - }); +/***/ 41242: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - this.webpack = webpack; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** @type {string=} */ - this.name = undefined; - /** @type {Compilation=} */ - this.parentCompilation = undefined; - /** @type {Compiler} */ - this.root = this; - /** @type {string} */ - this.outputPath = ""; - /** @type {Watching} */ - this.watching = undefined; - /** @type {OutputFileSystem} */ - this.outputFileSystem = null; - /** @type {IntermediateFileSystem} */ - this.intermediateFileSystem = null; - /** @type {InputFileSystem} */ - this.inputFileSystem = null; - /** @type {WatchFileSystem} */ - this.watchFileSystem = null; +exports.__esModule = true; +exports.SyncHook = __webpack_require__(69689); +exports.SyncBailHook = __webpack_require__(1626); +exports.SyncWaterfallHook = __webpack_require__(36093); +exports.SyncLoopHook = __webpack_require__(50179); +exports.AsyncParallelHook = __webpack_require__(31684); +exports.AsyncParallelBailHook = __webpack_require__(18151); +exports.AsyncSeriesHook = __webpack_require__(96496); +exports.AsyncSeriesBailHook = __webpack_require__(95734); +exports.AsyncSeriesLoopHook = __webpack_require__(95999); +exports.AsyncSeriesWaterfallHook = __webpack_require__(58118); +exports.HookMap = __webpack_require__(77079); +exports.MultiHook = __webpack_require__(13103); - /** @type {string|null} */ - this.recordsInputPath = null; - /** @type {string|null} */ - this.recordsOutputPath = null; - this.records = {}; - /** @type {Set} */ - this.managedPaths = new Set(); - /** @type {Set} */ - this.immutablePaths = new Set(); - /** @type {ReadonlySet} */ - this.modifiedFiles = undefined; - /** @type {ReadonlySet} */ - this.removedFiles = undefined; - /** @type {ReadonlyMap} */ - this.fileTimestamps = undefined; - /** @type {ReadonlyMap} */ - this.contextTimestamps = undefined; - /** @type {number} */ - this.fsStartTime = undefined; +/***/ }), - /** @type {ResolverFactory} */ - this.resolverFactory = new ResolverFactory(); +/***/ 74315: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - this.infrastructureLogger = undefined; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - this.options = options; - this.context = context; - this.requestShortener = new RequestShortener(context, this.root); - - this.cache = new Cache(); - - /** @type {Map, memCache: WeakTupleMap }> | undefined} */ - this.moduleMemCaches = undefined; - - this.compilerPath = ""; - - /** @type {boolean} */ - this.running = false; - - /** @type {boolean} */ - this.idle = false; - - /** @type {boolean} */ - this.watchMode = false; - - this._backCompat = this.options.experiments.backCompat !== false; +const RuntimeGlobals = __webpack_require__(16475); +const WebpackError = __webpack_require__(53799); +const ConstDependency = __webpack_require__(76911); +const BasicEvaluatedExpression = __webpack_require__(950); +const { + toConstantDependency, + evaluateToString +} = __webpack_require__(93998); +const ChunkNameRuntimeModule = __webpack_require__(84519); +const GetFullHashRuntimeModule = __webpack_require__(88732); - /** @type {Compilation} */ - this._lastCompilation = undefined; - /** @type {NormalModuleFactory} */ - this._lastNormalModuleFactory = undefined; +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ - /** @private @type {WeakMap }>} */ - this._assetEmittingSourceCache = new WeakMap(); - /** @private @type {Map} */ - this._assetEmittingWrittenFiles = new Map(); - /** @private @type {Set} */ - this._assetEmittingPreviousFiles = new Set(); +/* eslint-disable camelcase */ +const REPLACEMENTS = { + __webpack_require__: { + expr: RuntimeGlobals.require, + req: [RuntimeGlobals.require], + type: "function", + assign: false + }, + __webpack_public_path__: { + expr: RuntimeGlobals.publicPath, + req: [RuntimeGlobals.publicPath], + type: "string", + assign: true + }, + __webpack_base_uri__: { + expr: RuntimeGlobals.baseURI, + req: [RuntimeGlobals.baseURI], + type: "string", + assign: true + }, + __webpack_modules__: { + expr: RuntimeGlobals.moduleFactories, + req: [RuntimeGlobals.moduleFactories], + type: "object", + assign: false + }, + __webpack_chunk_load__: { + expr: RuntimeGlobals.ensureChunk, + req: [RuntimeGlobals.ensureChunk], + type: "function", + assign: true + }, + __non_webpack_require__: { + expr: "require", + req: null, + type: undefined, // type is not known, depends on environment + assign: true + }, + __webpack_nonce__: { + expr: RuntimeGlobals.scriptNonce, + req: [RuntimeGlobals.scriptNonce], + type: "string", + assign: true + }, + __webpack_hash__: { + expr: `${RuntimeGlobals.getFullHash}()`, + req: [RuntimeGlobals.getFullHash], + type: "string", + assign: false + }, + __webpack_chunkname__: { + expr: RuntimeGlobals.chunkName, + req: [RuntimeGlobals.chunkName], + type: "string", + assign: false + }, + __webpack_get_script_filename__: { + expr: RuntimeGlobals.getChunkScriptFilename, + req: [RuntimeGlobals.getChunkScriptFilename], + type: "function", + assign: true + }, + __webpack_runtime_id__: { + expr: RuntimeGlobals.runtimeId, + req: [RuntimeGlobals.runtimeId], + assign: false + }, + "require.onError": { + expr: RuntimeGlobals.uncaughtErrorHandler, + req: [RuntimeGlobals.uncaughtErrorHandler], + type: undefined, // type is not known, could be function or undefined + assign: true // is never a pattern + }, + __system_context__: { + expr: RuntimeGlobals.systemContext, + req: [RuntimeGlobals.systemContext], + type: "object", + assign: false + }, + __webpack_share_scopes__: { + expr: RuntimeGlobals.shareScopeMap, + req: [RuntimeGlobals.shareScopeMap], + type: "object", + assign: false + }, + __webpack_init_sharing__: { + expr: RuntimeGlobals.initializeSharing, + req: [RuntimeGlobals.initializeSharing], + type: "function", + assign: true } +}; +/* eslint-enable camelcase */ +class APIPlugin { /** - * @param {string} name cache name - * @returns {CacheFacade} the cache facade instance + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - getCache(name) { - return new CacheFacade( - this.cache, - `${this.compilerPath}${name}`, - this.options.output.hashFunction - ); - } + apply(compiler) { + compiler.hooks.compilation.tap( + "APIPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyTemplates.set( + ConstDependency, + new ConstDependency.Template() + ); - /** - * @param {string | (function(): string)} name name of the logger, or function called once to get the logger name - * @returns {Logger} a logger with that name - */ - getInfrastructureLogger(name) { - if (!name) { - throw new TypeError( - "Compiler.getInfrastructureLogger(name) called without a name" - ); - } - return new Logger( - (type, args) => { - if (typeof name === "function") { - name = name(); - if (!name) { - throw new TypeError( - "Compiler.getInfrastructureLogger(name) called with a function not returning a name" + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.chunkName) + .tap("APIPlugin", chunk => { + compilation.addRuntimeModule( + chunk, + new ChunkNameRuntimeModule(chunk.name) ); - } - } - if (this.hooks.infrastructureLog.call(name, type, args) === undefined) { - if (this.infrastructureLogger !== undefined) { - this.infrastructureLogger(name, type, args); - } - } - }, - childName => { - if (typeof name === "function") { - if (typeof childName === "function") { - return this.getInfrastructureLogger(() => { - if (typeof name === "function") { - name = name(); - if (!name) { - throw new TypeError( - "Compiler.getInfrastructureLogger(name) called with a function not returning a name" - ); - } - } - if (typeof childName === "function") { - childName = childName(); - if (!childName) { - throw new TypeError( - "Logger.getChildLogger(name) called with a function not returning a name" - ); - } - } - return `${name}/${childName}`; + return true; + }); + + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.getFullHash) + .tap("APIPlugin", (chunk, set) => { + compilation.addRuntimeModule(chunk, new GetFullHashRuntimeModule()); + return true; + }); + + /** + * @param {JavascriptParser} parser the parser + */ + const handler = parser => { + Object.keys(REPLACEMENTS).forEach(key => { + const info = REPLACEMENTS[key]; + parser.hooks.expression + .for(key) + .tap( + "APIPlugin", + toConstantDependency(parser, info.expr, info.req) + ); + if (info.assign === false) { + parser.hooks.assign.for(key).tap("APIPlugin", expr => { + const err = new WebpackError(`${key} must not be assigned`); + err.loc = expr.loc; + throw err; + }); + } + if (info.type) { + parser.hooks.evaluateTypeof + .for(key) + .tap("APIPlugin", evaluateToString(info.type)); + } + }); + + parser.hooks.expression + .for("__webpack_layer__") + .tap("APIPlugin", expr => { + const dep = new ConstDependency( + JSON.stringify(parser.state.module.layer), + expr.range + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; }); - } else { - return this.getInfrastructureLogger(() => { - if (typeof name === "function") { - name = name(); - if (!name) { - throw new TypeError( - "Compiler.getInfrastructureLogger(name) called with a function not returning a name" - ); - } - } - return `${name}/${childName}`; + parser.hooks.evaluateIdentifier + .for("__webpack_layer__") + .tap("APIPlugin", expr => + (parser.state.module.layer === null + ? new BasicEvaluatedExpression().setNull() + : new BasicEvaluatedExpression().setString( + parser.state.module.layer + ) + ).setRange(expr.range) + ); + parser.hooks.evaluateTypeof + .for("__webpack_layer__") + .tap("APIPlugin", expr => + new BasicEvaluatedExpression() + .setString( + parser.state.module.layer === null ? "object" : "string" + ) + .setRange(expr.range) + ); + + parser.hooks.expression + .for("__webpack_module__.id") + .tap("APIPlugin", expr => { + parser.state.module.buildInfo.moduleConcatenationBailout = + "__webpack_module__.id"; + const dep = new ConstDependency( + parser.state.module.moduleArgument + ".id", + expr.range, + [RuntimeGlobals.moduleId] + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; }); - } - } else { - if (typeof childName === "function") { - return this.getInfrastructureLogger(() => { - if (typeof childName === "function") { - childName = childName(); - if (!childName) { - throw new TypeError( - "Logger.getChildLogger(name) called with a function not returning a name" - ); - } - } - return `${name}/${childName}`; + + parser.hooks.expression + .for("__webpack_module__") + .tap("APIPlugin", expr => { + parser.state.module.buildInfo.moduleConcatenationBailout = + "__webpack_module__"; + const dep = new ConstDependency( + parser.state.module.moduleArgument, + expr.range, + [RuntimeGlobals.module] + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; }); - } else { - return this.getInfrastructureLogger(`${name}/${childName}`); - } - } + parser.hooks.evaluateTypeof + .for("__webpack_module__") + .tap("APIPlugin", evaluateToString("object")); + }; + + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("APIPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("APIPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("APIPlugin", handler); } ); } +} - // TODO webpack 6: solve this in a better way - // e.g. move compilation specific info from Modules into ModuleGraph - _cleanupLastCompilation() { - if (this._lastCompilation !== undefined) { - for (const module of this._lastCompilation.modules) { - ChunkGraph.clearChunkGraphForModule(module); - ModuleGraph.clearModuleGraphForModule(module); - module.cleanupForCache(); - } - for (const chunk of this._lastCompilation.chunks) { - ChunkGraph.clearChunkGraphForChunk(chunk); - } - this._lastCompilation = undefined; - } - } +module.exports = APIPlugin; - // TODO webpack 6: solve this in a better way - _cleanupLastNormalModuleFactory() { - if (this._lastNormalModuleFactory !== undefined) { - this._lastNormalModuleFactory.cleanupForCache(); - this._lastNormalModuleFactory = undefined; - } - } - /** - * @param {WatchOptions} watchOptions the watcher's options - * @param {Callback} handler signals when the call finishes - * @returns {Watching} a compiler watcher - */ - watch(watchOptions, handler) { - if (this.running) { - return handler(new ConcurrentCompilationError()); - } +/***/ }), - this.running = true; - this.watchMode = true; - this.watching = new Watching(this, watchOptions, handler); - return this.watching; - } +/***/ 77198: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {Callback} callback signals when the call finishes - * @returns {void} - */ - run(callback) { - if (this.running) { - return callback(new ConcurrentCompilationError()); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ - let logger; - const finalCallback = (err, stats) => { - if (logger) logger.time("beginIdle"); - this.idle = true; - this.cache.beginIdle(); - this.idle = true; - if (logger) logger.timeEnd("beginIdle"); - this.running = false; - if (err) { - this.hooks.failed.call(err); - } - if (callback !== undefined) callback(err, stats); - this.hooks.afterDone.call(stats); - }; - const startTime = Date.now(); +const WebpackError = __webpack_require__(53799); +const CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/; - this.running = true; +/** + * @param {string=} method method name + * @returns {string} message + */ +function createMessage(method) { + return `Abstract method${method ? " " + method : ""}. Must be overridden.`; +} - const onCompiled = (err, compilation) => { - if (err) return finalCallback(err); +/** + * @constructor + */ +function Message() { + /** @type {string} */ + this.stack = undefined; + Error.captureStackTrace(this); + /** @type {RegExpMatchArray} */ + const match = this.stack.split("\n")[3].match(CURRENT_METHOD_REGEXP); - if (this.hooks.shouldEmit.call(compilation) === false) { - compilation.startTime = startTime; - compilation.endTime = Date.now(); - const stats = new Stats(compilation); - this.hooks.done.callAsync(stats, err => { - if (err) return finalCallback(err); - return finalCallback(null, stats); - }); - return; - } + this.message = match && match[1] ? createMessage(match[1]) : createMessage(); +} - process.nextTick(() => { - logger = compilation.getLogger("webpack.Compiler"); - logger.time("emitAssets"); - this.emitAssets(compilation, err => { - logger.timeEnd("emitAssets"); - if (err) return finalCallback(err); +/** + * Error for abstract method + * @example + * class FooClass { + * abstractMethod() { + * throw new AbstractMethodError(); // error message: Abstract method FooClass.abstractMethod. Must be overridden. + * } + * } + * + */ +class AbstractMethodError extends WebpackError { + constructor() { + super(new Message().message); + this.name = "AbstractMethodError"; + } +} - if (compilation.hooks.needAdditionalPass.call()) { - compilation.needAdditionalPass = true; +module.exports = AbstractMethodError; - compilation.startTime = startTime; - compilation.endTime = Date.now(); - logger.time("done hook"); - const stats = new Stats(compilation); - this.hooks.done.callAsync(stats, err => { - logger.timeEnd("done hook"); - if (err) return finalCallback(err); - this.hooks.additionalPass.callAsync(err => { - if (err) return finalCallback(err); - this.compile(onCompiled); - }); - }); - return; - } +/***/ }), - logger.time("emitRecords"); - this.emitRecords(err => { - logger.timeEnd("emitRecords"); - if (err) return finalCallback(err); +/***/ 47736: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - compilation.startTime = startTime; - compilation.endTime = Date.now(); - logger.time("done hook"); - const stats = new Stats(compilation); - this.hooks.done.callAsync(stats, err => { - logger.timeEnd("done hook"); - if (err) return finalCallback(err); - this.cache.storeBuildDependencies( - compilation.buildDependencies, - err => { - if (err) return finalCallback(err); - return finalCallback(null, stats); - } - ); - }); - }); - }); - }); - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - const run = () => { - this.hooks.beforeRun.callAsync(this, err => { - if (err) return finalCallback(err); - - this.hooks.run.callAsync(this, err => { - if (err) return finalCallback(err); - this.readRecords(err => { - if (err) return finalCallback(err); - this.compile(onCompiled); - }); - }); - }); - }; +const DependenciesBlock = __webpack_require__(71040); +const makeSerializable = __webpack_require__(33032); - if (this.idle) { - this.cache.endIdle(err => { - if (err) return finalCallback(err); +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./ChunkGroup")} ChunkGroup */ +/** @typedef {import("./ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */ +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./util/Hash")} Hash */ - this.idle = false; - run(); - }); - } else { - run(); +class AsyncDependenciesBlock extends DependenciesBlock { + /** + * @param {ChunkGroupOptions & { entryOptions?: EntryOptions }} groupOptions options for the group + * @param {DependencyLocation=} loc the line of code + * @param {string=} request the request + */ + constructor(groupOptions, loc, request) { + super(); + if (typeof groupOptions === "string") { + groupOptions = { name: groupOptions }; + } else if (!groupOptions) { + groupOptions = { name: undefined }; } + this.groupOptions = groupOptions; + this.loc = loc; + this.request = request; + this._stringifiedGroupOptions = undefined; } /** - * @param {RunAsChildCallback} callback signals when the call finishes - * @returns {void} + * @returns {string} The name of the chunk */ - runAsChild(callback) { - const startTime = Date.now(); - this.compile((err, compilation) => { - if (err) return callback(err); - - this.parentCompilation.children.push(compilation); - for (const { name, source, info } of compilation.getAssets()) { - this.parentCompilation.emitAsset(name, source, info); - } - - const entries = []; - for (const ep of compilation.entrypoints.values()) { - entries.push(...ep.chunks); - } - - compilation.startTime = startTime; - compilation.endTime = Date.now(); - - return callback(null, entries, compilation); - }); + get chunkName() { + return this.groupOptions.name; } - purgeInputFileSystem() { - if (this.inputFileSystem && this.inputFileSystem.purge) { - this.inputFileSystem.purge(); + /** + * @param {string} value The new chunk name + * @returns {void} + */ + set chunkName(value) { + if (this.groupOptions.name !== value) { + this.groupOptions.name = value; + this._stringifiedGroupOptions = undefined; } } /** - * @param {Compilation} compilation the compilation - * @param {Callback} callback signals when the assets are emitted + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context * @returns {void} */ - emitAssets(compilation, callback) { - let outputPath; - - const emitFiles = err => { - if (err) return callback(err); - - const assets = compilation.getAssets(); - compilation.assets = { ...compilation.assets }; - /** @type {Map} */ - const caseInsensitiveMap = new Map(); - /** @type {Set} */ - const allTargetPaths = new Set(); - asyncLib.forEachLimit( - assets, - 15, - ({ name: file, source, info }, callback) => { - let targetFile = file; - let immutable = info.immutable; - const queryStringIdx = targetFile.indexOf("?"); - if (queryStringIdx >= 0) { - targetFile = targetFile.substr(0, queryStringIdx); - // We may remove the hash, which is in the query string - // So we recheck if the file is immutable - // This doesn't cover all cases, but immutable is only a performance optimization anyway - immutable = - immutable && - (includesHash(targetFile, info.contenthash) || - includesHash(targetFile, info.chunkhash) || - includesHash(targetFile, info.modulehash) || - includesHash(targetFile, info.fullhash)); - } - - const writeOut = err => { - if (err) return callback(err); - const targetPath = join( - this.outputFileSystem, - outputPath, - targetFile - ); - allTargetPaths.add(targetPath); - - // check if the target file has already been written by this Compiler - const targetFileGeneration = - this._assetEmittingWrittenFiles.get(targetPath); - - // create an cache entry for this Source if not already existing - let cacheEntry = this._assetEmittingSourceCache.get(source); - if (cacheEntry === undefined) { - cacheEntry = { - sizeOnlySource: undefined, - writtenTo: new Map() - }; - this._assetEmittingSourceCache.set(source, cacheEntry); - } - - let similarEntry; - - const checkSimilarFile = () => { - const caseInsensitiveTargetPath = targetPath.toLowerCase(); - similarEntry = caseInsensitiveMap.get(caseInsensitiveTargetPath); - if (similarEntry !== undefined) { - const { path: other, source: otherSource } = similarEntry; - if (isSourceEqual(otherSource, source)) { - // Size may or may not be available at this point. - // If it's not available add to "waiting" list and it will be updated once available - if (similarEntry.size !== undefined) { - updateWithReplacementSource(similarEntry.size); - } else { - if (!similarEntry.waiting) similarEntry.waiting = []; - similarEntry.waiting.push({ file, cacheEntry }); - } - alreadyWritten(); - } else { - const err = - new WebpackError(`Prevent writing to file that only differs in casing or query string from already written file. -This will lead to a race-condition and corrupted files on case-insensitive file systems. -${targetPath} -${other}`); - err.file = file; - callback(err); - } - return true; - } else { - caseInsensitiveMap.set( - caseInsensitiveTargetPath, - (similarEntry = { - path: targetPath, - source, - size: undefined, - waiting: undefined - }) - ); - return false; - } - }; - - /** - * get the binary (Buffer) content from the Source - * @returns {Buffer} content for the source - */ - const getContent = () => { - if (typeof source.buffer === "function") { - return source.buffer(); - } else { - const bufferOrString = source.source(); - if (Buffer.isBuffer(bufferOrString)) { - return bufferOrString; - } else { - return Buffer.from(bufferOrString, "utf8"); - } - } - }; + updateHash(hash, context) { + const { chunkGraph } = context; + if (this._stringifiedGroupOptions === undefined) { + this._stringifiedGroupOptions = JSON.stringify(this.groupOptions); + } + const chunkGroup = chunkGraph.getBlockChunkGroup(this); + hash.update( + `${this._stringifiedGroupOptions}${chunkGroup ? chunkGroup.id : ""}` + ); + super.updateHash(hash, context); + } - const alreadyWritten = () => { - // cache the information that the Source has been already been written to that location - if (targetFileGeneration === undefined) { - const newGeneration = 1; - this._assetEmittingWrittenFiles.set(targetPath, newGeneration); - cacheEntry.writtenTo.set(targetPath, newGeneration); - } else { - cacheEntry.writtenTo.set(targetPath, targetFileGeneration); - } - callback(); - }; + serialize(context) { + const { write } = context; + write(this.groupOptions); + write(this.loc); + write(this.request); + super.serialize(context); + } - /** - * Write the file to output file system - * @param {Buffer} content content to be written - * @returns {void} - */ - const doWrite = content => { - this.outputFileSystem.writeFile(targetPath, content, err => { - if (err) return callback(err); + deserialize(context) { + const { read } = context; + this.groupOptions = read(); + this.loc = read(); + this.request = read(); + super.deserialize(context); + } +} - // information marker that the asset has been emitted - compilation.emittedAssets.add(file); +makeSerializable(AsyncDependenciesBlock, "webpack/lib/AsyncDependenciesBlock"); - // cache the information that the Source has been written to that location - const newGeneration = - targetFileGeneration === undefined - ? 1 - : targetFileGeneration + 1; - cacheEntry.writtenTo.set(targetPath, newGeneration); - this._assetEmittingWrittenFiles.set(targetPath, newGeneration); - this.hooks.assetEmitted.callAsync( - file, - { - content, - source, - outputPath, - compilation, - targetPath - }, - callback - ); - }); - }; +Object.defineProperty(AsyncDependenciesBlock.prototype, "module", { + get() { + throw new Error( + "module property was removed from AsyncDependenciesBlock (it's not needed)" + ); + }, + set() { + throw new Error( + "module property was removed from AsyncDependenciesBlock (it's not needed)" + ); + } +}); - const updateWithReplacementSource = size => { - updateFileWithReplacementSource(file, cacheEntry, size); - similarEntry.size = size; - if (similarEntry.waiting !== undefined) { - for (const { file, cacheEntry } of similarEntry.waiting) { - updateFileWithReplacementSource(file, cacheEntry, size); - } - } - }; +module.exports = AsyncDependenciesBlock; - const updateFileWithReplacementSource = ( - file, - cacheEntry, - size - ) => { - // Create a replacement resource which only allows to ask for size - // This allows to GC all memory allocated by the Source - // (expect when the Source is stored in any other cache) - if (!cacheEntry.sizeOnlySource) { - cacheEntry.sizeOnlySource = new SizeOnlySource(size); - } - compilation.updateAsset(file, cacheEntry.sizeOnlySource, { - size - }); - }; - const processExistingFile = stats => { - // skip emitting if it's already there and an immutable file - if (immutable) { - updateWithReplacementSource(stats.size); - return alreadyWritten(); - } +/***/ }), - const content = getContent(); +/***/ 30111: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - updateWithReplacementSource(content.length); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Sean Larkin @thelarkinn +*/ - // if it exists and content on disk matches content - // skip writing the same content again - // (to keep mtime and don't trigger watchers) - // for a fast negative match file size is compared first - if (content.length === stats.size) { - compilation.comparedForEmitAssets.add(file); - return this.outputFileSystem.readFile( - targetPath, - (err, existingContent) => { - if ( - err || - !content.equals(/** @type {Buffer} */ (existingContent)) - ) { - return doWrite(content); - } else { - return alreadyWritten(); - } - } - ); - } - return doWrite(content); - }; - const processMissingFile = () => { - const content = getContent(); +const WebpackError = __webpack_require__(53799); - updateWithReplacementSource(content.length); +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Module")} Module */ - return doWrite(content); - }; +class AsyncDependencyToInitialChunkError extends WebpackError { + /** + * Creates an instance of AsyncDependencyToInitialChunkError. + * @param {string} chunkName Name of Chunk + * @param {Module} module module tied to dependency + * @param {DependencyLocation} loc location of dependency + */ + constructor(chunkName, module, loc) { + super( + `It's not allowed to load an initial chunk on demand. The chunk name "${chunkName}" is already used by an entrypoint.` + ); - // if the target file has already been written - if (targetFileGeneration !== undefined) { - // check if the Source has been written to this target file - const writtenGeneration = cacheEntry.writtenTo.get(targetPath); - if (writtenGeneration === targetFileGeneration) { - // if yes, we may skip writing the file - // if it's already there - // (we assume one doesn't modify files while the Compiler is running, other then removing them) + this.name = "AsyncDependencyToInitialChunkError"; + this.module = module; + this.loc = loc; + } +} - if (this._assetEmittingPreviousFiles.has(targetPath)) { - // We assume that assets from the last compilation say intact on disk (they are not removed) - compilation.updateAsset(file, cacheEntry.sizeOnlySource, { - size: cacheEntry.sizeOnlySource.size() - }); +module.exports = AsyncDependencyToInitialChunkError; - return callback(); - } else { - // Settings immutable will make it accept file content without comparing when file exist - immutable = true; - } - } else if (!immutable) { - if (checkSimilarFile()) return; - // We wrote to this file before which has very likely a different content - // skip comparing and assume content is different for performance - // This case happens often during watch mode. - return processMissingFile(); - } - } - if (checkSimilarFile()) return; - if (this.options.output.compareBeforeEmit) { - this.outputFileSystem.stat(targetPath, (err, stats) => { - const exists = !err && stats.isFile(); +/***/ }), - if (exists) { - processExistingFile(stats); - } else { - processMissingFile(); - } - }); - } else { - processMissingFile(); - } - }; +/***/ 17714: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (targetFile.match(/\/|\\/)) { - const fs = this.outputFileSystem; - const dir = dirname(fs, join(fs, outputPath, targetFile)); - mkdirp(fs, dir, writeOut); - } else { - writeOut(); - } - }, - err => { - // Clear map to free up memory - caseInsensitiveMap.clear(); - if (err) { - this._assetEmittingPreviousFiles.clear(); - return callback(err); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - this._assetEmittingPreviousFiles = allTargetPaths; - this.hooks.afterEmit.callAsync(compilation, err => { - if (err) return callback(err); - return callback(); - }); - } - ); - }; +const asyncLib = __webpack_require__(78175); +const NormalModule = __webpack_require__(39); +const PrefetchDependency = __webpack_require__(31618); - this.hooks.emit.callAsync(compilation, err => { - if (err) return callback(err); - outputPath = compilation.getPath(this.outputPath, {}); - mkdirp(this.outputFileSystem, outputPath, emitFiles); - }); - } +/** @typedef {import("./Compiler")} Compiler */ +class AutomaticPrefetchPlugin { /** - * @param {Callback} callback signals when the call finishes + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - emitRecords(callback) { - if (this.hooks.emitRecords.isUsed()) { - if (this.recordsOutputPath) { - asyncLib.parallel( - [ - cb => this.hooks.emitRecords.callAsync(cb), - this._emitRecords.bind(this) - ], - err => callback(err) + apply(compiler) { + compiler.hooks.compilation.tap( + "AutomaticPrefetchPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + PrefetchDependency, + normalModuleFactory ); - } else { - this.hooks.emitRecords.callAsync(callback); } - } else { - if (this.recordsOutputPath) { - this._emitRecords(callback); - } else { - callback(); + ); + let lastModules = null; + compiler.hooks.afterCompile.tap("AutomaticPrefetchPlugin", compilation => { + lastModules = []; + + for (const m of compilation.modules) { + if (m instanceof NormalModule) { + lastModules.push({ + context: m.context, + request: m.request + }); + } } - } + }); + compiler.hooks.make.tapAsync( + "AutomaticPrefetchPlugin", + (compilation, callback) => { + if (!lastModules) return callback(); + asyncLib.forEach( + lastModules, + (m, callback) => { + compilation.addModuleChain( + m.context || compiler.context, + new PrefetchDependency(`!!${m.request}`), + callback + ); + }, + err => { + lastModules = null; + callback(err); + } + ); + } + ); } +} +module.exports = AutomaticPrefetchPlugin; - /** - * @param {Callback} callback signals when the call finishes - * @returns {void} - */ - _emitRecords(callback) { - const writeFile = () => { - this.outputFileSystem.writeFile( - this.recordsOutputPath, - JSON.stringify( - this.records, - (n, value) => { - if ( - typeof value === "object" && - value !== null && - !Array.isArray(value) - ) { - const keys = Object.keys(value); - if (!isSorted(keys)) { - return sortObject(value, keys); - } - } - return value; - }, - 2 - ), - callback - ); - }; - - const recordsOutputPathDirectory = dirname( - this.outputFileSystem, - this.recordsOutputPath - ); - if (!recordsOutputPathDirectory) { - return writeFile(); - } - mkdirp(this.outputFileSystem, recordsOutputPathDirectory, err => { - if (err) return callback(err); - writeFile(); - }); - } - - /** - * @param {Callback} callback signals when the call finishes - * @returns {void} - */ - readRecords(callback) { - if (this.hooks.readRecords.isUsed()) { - if (this.recordsInputPath) { - asyncLib.parallel([ - cb => this.hooks.readRecords.callAsync(cb), - this._readRecords.bind(this) - ]); - } else { - this.records = {}; - this.hooks.readRecords.callAsync(callback); - } - } else { - if (this.recordsInputPath) { - this._readRecords(callback); - } else { - this.records = {}; - callback(); - } - } - } - - /** - * @param {Callback} callback signals when the call finishes - * @returns {void} - */ - _readRecords(callback) { - if (!this.recordsInputPath) { - this.records = {}; - return callback(); - } - this.inputFileSystem.stat(this.recordsInputPath, err => { - // It doesn't exist - // We can ignore this. - if (err) return callback(); - - this.inputFileSystem.readFile(this.recordsInputPath, (err, content) => { - if (err) return callback(err); - try { - this.records = parseJson(content.toString("utf-8")); - } catch (e) { - e.message = "Cannot parse records: " + e.message; - return callback(e); - } +/***/ }), - return callback(); - }); - }); - } +/***/ 21242: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {Compilation} compilation the compilation - * @param {string} compilerName the compiler's name - * @param {number} compilerIndex the compiler's index - * @param {OutputOptions=} outputOptions the output options - * @param {WebpackPluginInstance[]=} plugins the plugins to apply - * @returns {Compiler} a child compiler - */ - createChildCompiler( - compilation, - compilerName, - compilerIndex, - outputOptions, - plugins - ) { - const childCompiler = new Compiler(this.context, { - ...this.options, - output: { - ...this.options.output, - ...outputOptions - } - }); - childCompiler.name = compilerName; - childCompiler.outputPath = this.outputPath; - childCompiler.inputFileSystem = this.inputFileSystem; - childCompiler.outputFileSystem = null; - childCompiler.resolverFactory = this.resolverFactory; - childCompiler.modifiedFiles = this.modifiedFiles; - childCompiler.removedFiles = this.removedFiles; - childCompiler.fileTimestamps = this.fileTimestamps; - childCompiler.contextTimestamps = this.contextTimestamps; - childCompiler.fsStartTime = this.fsStartTime; - childCompiler.cache = this.cache; - childCompiler.compilerPath = `${this.compilerPath}${compilerName}|${compilerIndex}|`; - childCompiler._backCompat = this._backCompat; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - const relativeCompilerName = makePathsRelative( - this.context, - compilerName, - this.root - ); - if (!this.records[relativeCompilerName]) { - this.records[relativeCompilerName] = []; - } - if (this.records[relativeCompilerName][compilerIndex]) { - childCompiler.records = this.records[relativeCompilerName][compilerIndex]; - } else { - this.records[relativeCompilerName].push((childCompiler.records = {})); - } - childCompiler.parentCompilation = compilation; - childCompiler.root = this.root; - if (Array.isArray(plugins)) { - for (const plugin of plugins) { - plugin.apply(childCompiler); - } - } - for (const name in this.hooks) { - if ( - ![ - "make", - "compile", - "emit", - "afterEmit", - "invalid", - "done", - "thisCompilation" - ].includes(name) - ) { - if (childCompiler.hooks[name]) { - childCompiler.hooks[name].taps = this.hooks[name].taps.slice(); - } - } - } - compilation.hooks.childCompiler.call( - childCompiler, - compilerName, - compilerIndex - ); +const { ConcatSource } = __webpack_require__(51255); +const Compilation = __webpack_require__(85720); +const ModuleFilenameHelpers = __webpack_require__(88821); +const Template = __webpack_require__(39722); +const createSchemaValidation = __webpack_require__(32540); - return childCompiler; - } +/** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginArgument} BannerPluginArgument */ +/** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginOptions} BannerPluginOptions */ +/** @typedef {import("./Compiler")} Compiler */ - isChild() { - return !!this.parentCompilation; +const validate = createSchemaValidation( + __webpack_require__(42173), + () => __webpack_require__(49052), + { + name: "Banner Plugin", + baseDataPath: "options" } +); - createCompilation(params) { - this._cleanupLastCompilation(); - return (this._lastCompilation = new Compilation(this, params)); +const wrapComment = str => { + if (!str.includes("\n")) { + return Template.toComment(str); } + return `/*!\n * ${str + .replace(/\*\//g, "* /") + .split("\n") + .join("\n * ") + .replace(/\s+\n/g, "\n") + .trimRight()}\n */`; +}; +class BannerPlugin { /** - * @param {CompilationParams} params the compilation parameters - * @returns {Compilation} the created compilation + * @param {BannerPluginArgument} options options object */ - newCompilation(params) { - const compilation = this.createCompilation(params); - compilation.name = this.name; - compilation.records = this.records; - this.hooks.thisCompilation.call(compilation, params); - this.hooks.compilation.call(compilation, params); - return compilation; - } + constructor(options) { + if (typeof options === "string" || typeof options === "function") { + options = { + banner: options + }; + } - createNormalModuleFactory() { - this._cleanupLastNormalModuleFactory(); - const normalModuleFactory = new NormalModuleFactory({ - context: this.options.context, - fs: this.inputFileSystem, - resolverFactory: this.resolverFactory, - options: this.options.module, - associatedObjectForCache: this.root, - layers: this.options.experiments.layers - }); - this._lastNormalModuleFactory = normalModuleFactory; - this.hooks.normalModuleFactory.call(normalModuleFactory); - return normalModuleFactory; - } + validate(options); - createContextModuleFactory() { - const contextModuleFactory = new ContextModuleFactory(this.resolverFactory); - this.hooks.contextModuleFactory.call(contextModuleFactory); - return contextModuleFactory; - } + this.options = options; - newCompilationParams() { - const params = { - normalModuleFactory: this.createNormalModuleFactory(), - contextModuleFactory: this.createContextModuleFactory() - }; - return params; + const bannerOption = options.banner; + if (typeof bannerOption === "function") { + const getBanner = bannerOption; + this.banner = this.options.raw + ? getBanner + : data => wrapComment(getBanner(data)); + } else { + const banner = this.options.raw + ? bannerOption + : wrapComment(bannerOption); + this.banner = () => banner; + } } /** - * @param {Callback} callback signals when the compilation finishes + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - compile(callback) { - const params = this.newCompilationParams(); - this.hooks.beforeCompile.callAsync(params, err => { - if (err) return callback(err); - - this.hooks.compile.call(params); - - const compilation = this.newCompilation(params); - - const logger = compilation.getLogger("webpack.Compiler"); - - logger.time("make hook"); - this.hooks.make.callAsync(compilation, err => { - logger.timeEnd("make hook"); - if (err) return callback(err); - - logger.time("finish make hook"); - this.hooks.finishMake.callAsync(compilation, err => { - logger.timeEnd("finish make hook"); - if (err) return callback(err); + apply(compiler) { + const options = this.options; + const banner = this.banner; + const matchObject = ModuleFilenameHelpers.matchObject.bind( + undefined, + options + ); - process.nextTick(() => { - logger.time("finish compilation"); - compilation.finish(err => { - logger.timeEnd("finish compilation"); - if (err) return callback(err); + compiler.hooks.compilation.tap("BannerPlugin", compilation => { + compilation.hooks.processAssets.tap( + { + name: "BannerPlugin", + stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS + }, + () => { + for (const chunk of compilation.chunks) { + if (options.entryOnly && !chunk.canBeInitial()) { + continue; + } - logger.time("seal compilation"); - compilation.seal(err => { - logger.timeEnd("seal compilation"); - if (err) return callback(err); + for (const file of chunk.files) { + if (!matchObject(file)) { + continue; + } - logger.time("afterCompile hook"); - this.hooks.afterCompile.callAsync(compilation, err => { - logger.timeEnd("afterCompile hook"); - if (err) return callback(err); + const data = { + chunk, + filename: file + }; - return callback(null, compilation); - }); - }); - }); - }); - }); - }); - }); - } + const comment = compilation.getPath(banner, data); - /** - * @param {Callback} callback signals when the compiler closes - * @returns {void} - */ - close(callback) { - if (this.watching) { - // When there is still an active watching, close this first - this.watching.close(err => { - this.close(callback); - }); - return; - } - this.hooks.shutdown.callAsync(err => { - if (err) return callback(err); - // Get rid of reference to last compilation to avoid leaking memory - // We can't run this._cleanupLastCompilation() as the Stats to this compilation - // might be still in use. We try to get rid of the reference to the cache instead. - this._lastCompilation = undefined; - this._lastNormalModuleFactory = undefined; - this.cache.shutdown(callback); + compilation.updateAsset( + file, + old => new ConcatSource(comment, "\n", old) + ); + } + } + } + ); }); } } -module.exports = Compiler; +module.exports = BannerPlugin; /***/ }), -/***/ 98229: -/***/ (function(module) { +/***/ 7592: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -28802,309 +24806,518 @@ module.exports = Compiler; -/** @typedef {import("./Module")} Module */ - -const MODULE_REFERENCE_REGEXP = - /^__WEBPACK_MODULE_REFERENCE__(\d+)_([\da-f]+|ns)(_call)?(_directImport)?(?:_asiSafe(\d))?__$/; +const { AsyncParallelHook, AsyncSeriesBailHook, SyncHook } = __webpack_require__(41242); +const { + makeWebpackError, + makeWebpackErrorCallback +} = __webpack_require__(11351); -const DEFAULT_EXPORT = "__WEBPACK_DEFAULT_EXPORT__"; -const NAMESPACE_OBJECT_EXPORT = "__WEBPACK_NAMESPACE_OBJECT__"; +/** @typedef {import("./WebpackError")} WebpackError */ /** - * @typedef {Object} ExternalModuleInfo - * @property {number} index - * @property {Module} module + * @typedef {Object} Etag + * @property {function(): string} toString */ /** - * @typedef {Object} ConcatenatedModuleInfo - * @property {number} index - * @property {Module} module - * @property {Map} exportMap mapping from export name to symbol - * @property {Map} rawExportMap mapping from export name to symbol - * @property {string=} namespaceExportSymbol + * @template T + * @callback CallbackCache + * @param {(WebpackError | null)=} err + * @param {T=} result + * @returns {void} */ -/** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo} ModuleInfo */ - /** - * @typedef {Object} ModuleReferenceOptions - * @property {string[]} ids the properties/exports of the module - * @property {boolean} call true, when this referenced export is called - * @property {boolean} directImport true, when this referenced export is directly imported (not via property access) - * @property {boolean | undefined} asiSafe if the position is ASI safe or unknown + * @callback GotHandler + * @param {any} result + * @param {function(Error=): void} callback + * @returns {void} */ -class ConcatenationScope { - /** - * @param {ModuleInfo[] | Map} modulesMap all module info by module - * @param {ConcatenatedModuleInfo} currentModule the current module info - */ - constructor(modulesMap, currentModule) { - this._currentModule = currentModule; - if (Array.isArray(modulesMap)) { - const map = new Map(); - for (const info of modulesMap) { - map.set(info.module, info); - } - modulesMap = map; +const needCalls = (times, callback) => { + return err => { + if (--times === 0) { + return callback(err); } - this._modulesMap = modulesMap; + if (err && times > 0) { + times = 0; + return callback(err); + } + }; +}; + +class Cache { + constructor() { + this.hooks = { + /** @type {AsyncSeriesBailHook<[string, Etag | null, GotHandler[]], any>} */ + get: new AsyncSeriesBailHook(["identifier", "etag", "gotHandlers"]), + /** @type {AsyncParallelHook<[string, Etag | null, any]>} */ + store: new AsyncParallelHook(["identifier", "etag", "data"]), + /** @type {AsyncParallelHook<[Iterable]>} */ + storeBuildDependencies: new AsyncParallelHook(["dependencies"]), + /** @type {SyncHook<[]>} */ + beginIdle: new SyncHook([]), + /** @type {AsyncParallelHook<[]>} */ + endIdle: new AsyncParallelHook([]), + /** @type {AsyncParallelHook<[]>} */ + shutdown: new AsyncParallelHook([]) + }; } /** - * @param {Module} module the referenced module - * @returns {boolean} true, when it's in the scope + * @template T + * @param {string} identifier the cache identifier + * @param {Etag | null} etag the etag + * @param {CallbackCache} callback signals when the value is retrieved + * @returns {void} */ - isModuleInScope(module) { - return this._modulesMap.has(module); + get(identifier, etag, callback) { + const gotHandlers = []; + this.hooks.get.callAsync(identifier, etag, gotHandlers, (err, result) => { + if (err) { + callback(makeWebpackError(err, "Cache.hooks.get")); + return; + } + if (result === null) { + result = undefined; + } + if (gotHandlers.length > 1) { + const innerCallback = needCalls(gotHandlers.length, () => + callback(null, result) + ); + for (const gotHandler of gotHandlers) { + gotHandler(result, innerCallback); + } + } else if (gotHandlers.length === 1) { + gotHandlers[0](result, () => callback(null, result)); + } else { + callback(null, result); + } + }); } /** - * - * @param {string} exportName name of the export - * @param {string} symbol identifier of the export in source code + * @template T + * @param {string} identifier the cache identifier + * @param {Etag | null} etag the etag + * @param {T} data the value to store + * @param {CallbackCache} callback signals when the value is stored + * @returns {void} */ - registerExport(exportName, symbol) { - if (!this._currentModule.exportMap) { - this._currentModule.exportMap = new Map(); - } - if (!this._currentModule.exportMap.has(exportName)) { - this._currentModule.exportMap.set(exportName, symbol); - } + store(identifier, etag, data, callback) { + this.hooks.store.callAsync( + identifier, + etag, + data, + makeWebpackErrorCallback(callback, "Cache.hooks.store") + ); } /** - * - * @param {string} exportName name of the export - * @param {string} expression expression to be used + * After this method has succeeded the cache can only be restored when build dependencies are + * @param {Iterable} dependencies list of all build dependencies + * @param {CallbackCache} callback signals when the dependencies are stored + * @returns {void} */ - registerRawExport(exportName, expression) { - if (!this._currentModule.rawExportMap) { - this._currentModule.rawExportMap = new Map(); - } - if (!this._currentModule.rawExportMap.has(exportName)) { - this._currentModule.rawExportMap.set(exportName, expression); - } - } - - /** - * @param {string} symbol identifier of the export in source code - */ - registerNamespaceExport(symbol) { - this._currentModule.namespaceExportSymbol = symbol; + storeBuildDependencies(dependencies, callback) { + this.hooks.storeBuildDependencies.callAsync( + dependencies, + makeWebpackErrorCallback(callback, "Cache.hooks.storeBuildDependencies") + ); } /** - * - * @param {Module} module the referenced module - * @param {Partial} options options - * @returns {string} the reference as identifier + * @returns {void} */ - createModuleReference( - module, - { ids = undefined, call = false, directImport = false, asiSafe = false } - ) { - const info = this._modulesMap.get(module); - const callFlag = call ? "_call" : ""; - const directImportFlag = directImport ? "_directImport" : ""; - const asiSafeFlag = asiSafe - ? "_asiSafe1" - : asiSafe === false - ? "_asiSafe0" - : ""; - const exportData = ids - ? Buffer.from(JSON.stringify(ids), "utf-8").toString("hex") - : "ns"; - // a "._" is appended to allow "delete ...", which would cause a SyntaxError in strict mode - return `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportData}${callFlag}${directImportFlag}${asiSafeFlag}__._`; + beginIdle() { + this.hooks.beginIdle.call(); } /** - * @param {string} name the identifier - * @returns {boolean} true, when it's an module reference + * @param {CallbackCache} callback signals when the call finishes + * @returns {void} */ - static isModuleReference(name) { - return MODULE_REFERENCE_REGEXP.test(name); + endIdle(callback) { + this.hooks.endIdle.callAsync( + makeWebpackErrorCallback(callback, "Cache.hooks.endIdle") + ); } /** - * @param {string} name the identifier - * @returns {ModuleReferenceOptions & { index: number }} parsed options and index + * @param {CallbackCache} callback signals when the call finishes + * @returns {void} */ - static matchModuleReference(name) { - const match = MODULE_REFERENCE_REGEXP.exec(name); - if (!match) return null; - const index = +match[1]; - const asiSafe = match[5]; - return { - index, - ids: - match[2] === "ns" - ? [] - : JSON.parse(Buffer.from(match[2], "hex").toString("utf-8")), - call: !!match[3], - directImport: !!match[4], - asiSafe: asiSafe ? asiSafe === "1" : undefined - }; + shutdown(callback) { + this.hooks.shutdown.callAsync( + makeWebpackErrorCallback(callback, "Cache.hooks.shutdown") + ); } } -ConcatenationScope.DEFAULT_EXPORT = DEFAULT_EXPORT; -ConcatenationScope.NAMESPACE_OBJECT_EXPORT = NAMESPACE_OBJECT_EXPORT; +Cache.STAGE_MEMORY = -10; +Cache.STAGE_DEFAULT = 0; +Cache.STAGE_DISK = 10; +Cache.STAGE_NETWORK = 20; -module.exports = ConcatenationScope; +module.exports = Cache; /***/ }), -/***/ 95735: +/***/ 55392: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Maksim Nazarjev @acupofspirt + Author Tobias Koppers @sokra */ -const WebpackError = __webpack_require__(53799); +const { forEachBail } = __webpack_require__(30662); +const asyncLib = __webpack_require__(78175); +const getLazyHashedEtag = __webpack_require__(94075); +const mergeEtags = __webpack_require__(54980); -module.exports = class ConcurrentCompilationError extends WebpackError { - constructor() { - super(); +/** @typedef {import("./Cache")} Cache */ +/** @typedef {import("./Cache").Etag} Etag */ +/** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./cache/getLazyHashedEtag").HashableObject} HashableObject */ +/** @typedef {typeof import("./util/Hash")} HashConstructor */ - this.name = "ConcurrentCompilationError"; - this.message = - "You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."; - } -}; +/** + * @template T + * @callback CallbackCache + * @param {(WebpackError | null)=} err + * @param {T=} result + * @returns {void} + */ +/** + * @template T + * @callback CallbackNormalErrorCache + * @param {(Error | null)=} err + * @param {T=} result + * @returns {void} + */ -/***/ }), +class MultiItemCache { + /** + * @param {ItemCacheFacade[]} items item caches + */ + constructor(items) { + this._items = items; + if (items.length === 1) return /** @type {any} */ (items[0]); + } -/***/ 61333: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * @template T + * @param {CallbackCache} callback signals when the value is retrieved + * @returns {void} + */ + get(callback) { + forEachBail(this._items, (item, callback) => item.get(callback), callback); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @template T + * @returns {Promise} promise with the data + */ + getPromise() { + const next = i => { + return this._items[i].getPromise().then(result => { + if (result !== undefined) return result; + if (++i < this._items.length) return next(i); + }); + }; + return next(0); + } + /** + * @template T + * @param {T} data the value to store + * @param {CallbackCache} callback signals when the value is stored + * @returns {void} + */ + store(data, callback) { + asyncLib.each( + this._items, + (item, callback) => item.store(data, callback), + callback + ); + } + /** + * @template T + * @param {T} data the value to store + * @returns {Promise} promise signals when the value is stored + */ + storePromise(data) { + return Promise.all(this._items.map(item => item.storePromise(data))).then( + () => {} + ); + } +} -const { ConcatSource, PrefixSource } = __webpack_require__(51255); -const InitFragment = __webpack_require__(55870); -const Template = __webpack_require__(1626); -const { mergeRuntime } = __webpack_require__(17156); +class ItemCacheFacade { + /** + * @param {Cache} cache the root cache + * @param {string} name the child cache item name + * @param {Etag | null} etag the etag + */ + constructor(cache, name, etag) { + this._cache = cache; + this._name = name; + this._etag = etag; + } -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("./Generator").GenerateContext} GenerateContext */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ + /** + * @template T + * @param {CallbackCache} callback signals when the value is retrieved + * @returns {void} + */ + get(callback) { + this._cache.get(this._name, this._etag, callback); + } -const wrapInCondition = (condition, source) => { - if (typeof source === "string") { - return Template.asString([ - `if (${condition}) {`, - Template.indent(source), - "}", - "" - ]); - } else { - return new ConcatSource( - `if (${condition}) {\n`, - new PrefixSource("\t", source), - "}\n" - ); + /** + * @template T + * @returns {Promise} promise with the data + */ + getPromise() { + return new Promise((resolve, reject) => { + this._cache.get(this._name, this._etag, (err, data) => { + if (err) { + reject(err); + } else { + resolve(data); + } + }); + }); } -}; -/** - * @typedef {GenerateContext} Context - */ -class ConditionalInitFragment extends InitFragment { /** - * @param {string|Source} content the source code that will be included as initialization code - * @param {number} stage category of initialization code (contribute to order) - * @param {number} position position in the category (contribute to order) - * @param {string} key unique key to avoid emitting the same initialization code twice - * @param {RuntimeSpec | boolean} runtimeCondition in which runtime this fragment should be executed - * @param {string|Source=} endContent the source code that will be included at the end of the module + * @template T + * @param {T} data the value to store + * @param {CallbackCache} callback signals when the value is stored + * @returns {void} */ - constructor( - content, - stage, - position, - key, - runtimeCondition = true, - endContent - ) { - super(content, stage, position, key, endContent); - this.runtimeCondition = runtimeCondition; + store(data, callback) { + this._cache.store(this._name, this._etag, data, callback); } /** - * @param {Context} context context - * @returns {string|Source} the source code that will be included as initialization code + * @template T + * @param {T} data the value to store + * @returns {Promise} promise signals when the value is stored */ - getContent(context) { - if (this.runtimeCondition === false || !this.content) return ""; - if (this.runtimeCondition === true) return this.content; - const expr = context.runtimeTemplate.runtimeConditionExpression({ - chunkGraph: context.chunkGraph, - runtimeRequirements: context.runtimeRequirements, - runtime: context.runtime, - runtimeCondition: this.runtimeCondition + storePromise(data) { + return new Promise((resolve, reject) => { + this._cache.store(this._name, this._etag, data, err => { + if (err) { + reject(err); + } else { + resolve(); + } + }); }); - if (expr === "true") return this.content; - return wrapInCondition(expr, this.content); } /** - * @param {Context} context context - * @returns {string|Source=} the source code that will be included at the end of the module + * @template T + * @param {function(CallbackNormalErrorCache): void} computer function to compute the value if not cached + * @param {CallbackNormalErrorCache} callback signals when the value is retrieved + * @returns {void} */ - getEndContent(context) { - if (this.runtimeCondition === false || !this.endContent) return ""; - if (this.runtimeCondition === true) return this.endContent; - const expr = context.runtimeTemplate.runtimeConditionExpression({ - chunkGraph: context.chunkGraph, - runtimeRequirements: context.runtimeRequirements, - runtime: context.runtime, - runtimeCondition: this.runtimeCondition + provide(computer, callback) { + this.get((err, cacheEntry) => { + if (err) return callback(err); + if (cacheEntry !== undefined) return cacheEntry; + computer((err, result) => { + if (err) return callback(err); + this.store(result, err => { + if (err) return callback(err); + callback(null, result); + }); + }); }); - if (expr === "true") return this.endContent; - return wrapInCondition(expr, this.endContent); } - merge(other) { - if (this.runtimeCondition === true) return this; - if (other.runtimeCondition === true) return other; - if (this.runtimeCondition === false) return other; - if (other.runtimeCondition === false) return this; - const runtimeCondition = mergeRuntime( - this.runtimeCondition, - other.runtimeCondition + /** + * @template T + * @param {function(): Promise | T} computer function to compute the value if not cached + * @returns {Promise} promise with the data + */ + async providePromise(computer) { + const cacheEntry = await this.getPromise(); + if (cacheEntry !== undefined) return cacheEntry; + const result = await computer(); + await this.storePromise(result); + return result; + } +} + +class CacheFacade { + /** + * @param {Cache} cache the root cache + * @param {string} name the child cache name + * @param {string | HashConstructor} hashFunction the hash function to use + */ + constructor(cache, name, hashFunction) { + this._cache = cache; + this._name = name; + this._hashFunction = hashFunction; + } + + /** + * @param {string} name the child cache name# + * @returns {CacheFacade} child cache + */ + getChildCache(name) { + return new CacheFacade( + this._cache, + `${this._name}|${name}`, + this._hashFunction ); - return new ConditionalInitFragment( - this.content, - this.stage, - this.position, - this.key, - runtimeCondition, - this.endContent + } + + /** + * @param {string} identifier the cache identifier + * @param {Etag | null} etag the etag + * @returns {ItemCacheFacade} item cache + */ + getItemCache(identifier, etag) { + return new ItemCacheFacade( + this._cache, + `${this._name}|${identifier}`, + etag ); } + + /** + * @param {HashableObject} obj an hashable object + * @returns {Etag} an etag that is lazy hashed + */ + getLazyHashedEtag(obj) { + return getLazyHashedEtag(obj, this._hashFunction); + } + + /** + * @param {Etag} a an etag + * @param {Etag} b another etag + * @returns {Etag} an etag that represents both + */ + mergeEtags(a, b) { + return mergeEtags(a, b); + } + + /** + * @template T + * @param {string} identifier the cache identifier + * @param {Etag | null} etag the etag + * @param {CallbackCache} callback signals when the value is retrieved + * @returns {void} + */ + get(identifier, etag, callback) { + this._cache.get(`${this._name}|${identifier}`, etag, callback); + } + + /** + * @template T + * @param {string} identifier the cache identifier + * @param {Etag | null} etag the etag + * @returns {Promise} promise with the data + */ + getPromise(identifier, etag) { + return new Promise((resolve, reject) => { + this._cache.get(`${this._name}|${identifier}`, etag, (err, data) => { + if (err) { + reject(err); + } else { + resolve(data); + } + }); + }); + } + + /** + * @template T + * @param {string} identifier the cache identifier + * @param {Etag | null} etag the etag + * @param {T} data the value to store + * @param {CallbackCache} callback signals when the value is stored + * @returns {void} + */ + store(identifier, etag, data, callback) { + this._cache.store(`${this._name}|${identifier}`, etag, data, callback); + } + + /** + * @template T + * @param {string} identifier the cache identifier + * @param {Etag | null} etag the etag + * @param {T} data the value to store + * @returns {Promise} promise signals when the value is stored + */ + storePromise(identifier, etag, data) { + return new Promise((resolve, reject) => { + this._cache.store(`${this._name}|${identifier}`, etag, data, err => { + if (err) { + reject(err); + } else { + resolve(); + } + }); + }); + } + + /** + * @template T + * @param {string} identifier the cache identifier + * @param {Etag | null} etag the etag + * @param {function(CallbackNormalErrorCache): void} computer function to compute the value if not cached + * @param {CallbackNormalErrorCache} callback signals when the value is retrieved + * @returns {void} + */ + provide(identifier, etag, computer, callback) { + this.get(identifier, etag, (err, cacheEntry) => { + if (err) return callback(err); + if (cacheEntry !== undefined) return cacheEntry; + computer((err, result) => { + if (err) return callback(err); + this.store(identifier, etag, result, err => { + if (err) return callback(err); + callback(null, result); + }); + }); + }); + } + + /** + * @template T + * @param {string} identifier the cache identifier + * @param {Etag | null} etag the etag + * @param {function(): Promise | T} computer function to compute the value if not cached + * @returns {Promise} promise with the data + */ + async providePromise(identifier, etag, computer) { + const cacheEntry = await this.getPromise(identifier, etag); + if (cacheEntry !== undefined) return cacheEntry; + const result = await computer(); + await this.storePromise(identifier, etag, result); + return result; + } } -module.exports = ConditionalInitFragment; +module.exports = CacheFacade; +module.exports.ItemCacheFacade = ItemCacheFacade; +module.exports.MultiItemCache = MultiItemCache; /***/ }), -/***/ 11146: +/***/ 77975: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -29115,1632 +25328,903 @@ module.exports = ConditionalInitFragment; -const CachedConstDependency = __webpack_require__(57403); -const ConstDependency = __webpack_require__(76911); -const { evaluateToString } = __webpack_require__(93998); -const { parseResource } = __webpack_require__(82186); +const WebpackError = __webpack_require__(53799); -/** @typedef {import("estree").Expression} ExpressionNode */ -/** @typedef {import("estree").Super} SuperNode */ -/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ -const collectDeclaration = (declarations, pattern) => { - const stack = [pattern]; - while (stack.length > 0) { - const node = stack.pop(); - switch (node.type) { - case "Identifier": - declarations.add(node.name); - break; - case "ArrayPattern": - for (const element of node.elements) { - if (element) { - stack.push(element); - } - } - break; - case "AssignmentPattern": - stack.push(node.left); - break; - case "ObjectPattern": - for (const property of node.properties) { - stack.push(property.value); - } - break; - case "RestElement": - stack.push(node.argument); - break; - } - } +/** + * @param {Module[]} modules the modules to be sorted + * @returns {Module[]} sorted version of original modules + */ +const sortModules = modules => { + return modules.sort((a, b) => { + const aIdent = a.identifier(); + const bIdent = b.identifier(); + /* istanbul ignore next */ + if (aIdent < bIdent) return -1; + /* istanbul ignore next */ + if (aIdent > bIdent) return 1; + /* istanbul ignore next */ + return 0; + }); }; -const getHoistedDeclarations = (branch, includeFunctionDeclarations) => { - const declarations = new Set(); - const stack = [branch]; - while (stack.length > 0) { - const node = stack.pop(); - // Some node could be `null` or `undefined`. - if (!node) continue; - switch (node.type) { - // Walk through control statements to look for hoisted declarations. - // Some branches are skipped since they do not allow declarations. - case "BlockStatement": - for (const stmt of node.body) { - stack.push(stmt); - } - break; - case "IfStatement": - stack.push(node.consequent); - stack.push(node.alternate); - break; - case "ForStatement": - stack.push(node.init); - stack.push(node.body); - break; - case "ForInStatement": - case "ForOfStatement": - stack.push(node.left); - stack.push(node.body); - break; - case "DoWhileStatement": - case "WhileStatement": - case "LabeledStatement": - stack.push(node.body); - break; - case "SwitchStatement": - for (const cs of node.cases) { - for (const consequent of cs.consequent) { - stack.push(consequent); - } - } - break; - case "TryStatement": - stack.push(node.block); - if (node.handler) { - stack.push(node.handler.body); - } - stack.push(node.finalizer); - break; - case "FunctionDeclaration": - if (includeFunctionDeclarations) { - collectDeclaration(declarations, node.id); - } - break; - case "VariableDeclaration": - if (node.kind === "var") { - for (const decl of node.declarations) { - collectDeclaration(declarations, decl.id); - } - } - break; - } - } - return Array.from(declarations); +/** + * @param {Module[]} modules each module from throw + * @param {ModuleGraph} moduleGraph the module graph + * @returns {string} each message from provided modules + */ +const createModulesListMessage = (modules, moduleGraph) => { + return modules + .map(m => { + let message = `* ${m.identifier()}`; + const validReasons = Array.from( + moduleGraph.getIncomingConnectionsByOriginModule(m).keys() + ).filter(x => x); + + if (validReasons.length > 0) { + message += `\n Used by ${validReasons.length} module(s), i. e.`; + message += `\n ${validReasons[0].identifier()}`; + } + return message; + }) + .join("\n"); }; -class ConstPlugin { +class CaseSensitiveModulesWarning extends WebpackError { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * Creates an instance of CaseSensitiveModulesWarning. + * @param {Iterable} modules modules that were detected + * @param {ModuleGraph} moduleGraph the module graph */ - apply(compiler) { - const cachedParseResource = parseResource.bindCache(compiler.root); - compiler.hooks.compilation.tap( - "ConstPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyTemplates.set( - ConstDependency, - new ConstDependency.Template() - ); + constructor(modules, moduleGraph) { + const sortedModules = sortModules(Array.from(modules)); + const modulesList = createModulesListMessage(sortedModules, moduleGraph); + super(`There are multiple modules with names that only differ in casing. +This can lead to unexpected behavior when compiling on a filesystem with other case-semantic. +Use equal casing. Compare these module identifiers: +${modulesList}`); - compilation.dependencyTemplates.set( - CachedConstDependency, - new CachedConstDependency.Template() - ); + this.name = "CaseSensitiveModulesWarning"; + this.module = sortedModules[0]; + } +} - const handler = parser => { - parser.hooks.statementIf.tap("ConstPlugin", statement => { - if (parser.scope.isAsmJs) return; - const param = parser.evaluateExpression(statement.test); - const bool = param.asBool(); - if (typeof bool === "boolean") { - if (!param.couldHaveSideEffects()) { - const dep = new ConstDependency(`${bool}`, param.range); - dep.loc = statement.loc; - parser.state.module.addPresentationalDependency(dep); - } else { - parser.walkExpression(statement.test); - } - const branchToRemove = bool - ? statement.alternate - : statement.consequent; - if (branchToRemove) { - // Before removing the dead branch, the hoisted declarations - // must be collected. - // - // Given the following code: - // - // if (true) f() else g() - // if (false) { - // function f() {} - // const g = function g() {} - // if (someTest) { - // let a = 1 - // var x, {y, z} = obj - // } - // } else { - // … - // } - // - // the generated code is: - // - // if (true) f() else {} - // if (false) { - // var f, x, y, z; (in loose mode) - // var x, y, z; (in strict mode) - // } else { - // … - // } - // - // NOTE: When code runs in strict mode, `var` declarations - // are hoisted but `function` declarations don't. - // - let declarations; - if (parser.scope.isStrict) { - // If the code runs in strict mode, variable declarations - // using `var` must be hoisted. - declarations = getHoistedDeclarations(branchToRemove, false); - } else { - // Otherwise, collect all hoisted declaration. - declarations = getHoistedDeclarations(branchToRemove, true); - } - let replacement; - if (declarations.length > 0) { - replacement = `{ var ${declarations.join(", ")}; }`; - } else { - replacement = "{}"; - } - const dep = new ConstDependency( - replacement, - branchToRemove.range - ); - dep.loc = branchToRemove.loc; - parser.state.module.addPresentationalDependency(dep); - } - return bool; - } - }); - parser.hooks.expressionConditionalOperator.tap( - "ConstPlugin", - expression => { - if (parser.scope.isAsmJs) return; - const param = parser.evaluateExpression(expression.test); - const bool = param.asBool(); - if (typeof bool === "boolean") { - if (!param.couldHaveSideEffects()) { - const dep = new ConstDependency(` ${bool}`, param.range); - dep.loc = expression.loc; - parser.state.module.addPresentationalDependency(dep); - } else { - parser.walkExpression(expression.test); - } - // Expressions do not hoist. - // It is safe to remove the dead branch. - // - // Given the following code: - // - // false ? someExpression() : otherExpression(); - // - // the generated code is: - // - // false ? 0 : otherExpression(); - // - const branchToRemove = bool - ? expression.alternate - : expression.consequent; - const dep = new ConstDependency("0", branchToRemove.range); - dep.loc = branchToRemove.loc; - parser.state.module.addPresentationalDependency(dep); - return bool; - } - } - ); - parser.hooks.expressionLogicalOperator.tap( - "ConstPlugin", - expression => { - if (parser.scope.isAsmJs) return; - if ( - expression.operator === "&&" || - expression.operator === "||" - ) { - const param = parser.evaluateExpression(expression.left); - const bool = param.asBool(); - if (typeof bool === "boolean") { - // Expressions do not hoist. - // It is safe to remove the dead branch. - // - // ------------------------------------------ - // - // Given the following code: - // - // falsyExpression() && someExpression(); - // - // the generated code is: - // - // falsyExpression() && false; - // - // ------------------------------------------ - // - // Given the following code: - // - // truthyExpression() && someExpression(); - // - // the generated code is: - // - // true && someExpression(); - // - // ------------------------------------------ - // - // Given the following code: - // - // truthyExpression() || someExpression(); - // - // the generated code is: - // - // truthyExpression() || false; - // - // ------------------------------------------ - // - // Given the following code: - // - // falsyExpression() || someExpression(); - // - // the generated code is: - // - // false && someExpression(); - // - const keepRight = - (expression.operator === "&&" && bool) || - (expression.operator === "||" && !bool); +module.exports = CaseSensitiveModulesWarning; - if ( - !param.couldHaveSideEffects() && - (param.isBoolean() || keepRight) - ) { - // for case like - // - // return'development'===process.env.NODE_ENV&&'foo' - // - // we need a space before the bool to prevent result like - // - // returnfalse&&'foo' - // - const dep = new ConstDependency(` ${bool}`, param.range); - dep.loc = expression.loc; - parser.state.module.addPresentationalDependency(dep); - } else { - parser.walkExpression(expression.left); - } - if (!keepRight) { - const dep = new ConstDependency( - "0", - expression.right.range - ); - dep.loc = expression.loc; - parser.state.module.addPresentationalDependency(dep); - } - return keepRight; - } - } else if (expression.operator === "??") { - const param = parser.evaluateExpression(expression.left); - const keepRight = param && param.asNullish(); - if (typeof keepRight === "boolean") { - // ------------------------------------------ - // - // Given the following code: - // - // nonNullish ?? someExpression(); - // - // the generated code is: - // - // nonNullish ?? 0; - // - // ------------------------------------------ - // - // Given the following code: - // - // nullish ?? someExpression(); - // - // the generated code is: - // - // null ?? someExpression(); - // - if (!param.couldHaveSideEffects() && keepRight) { - // cspell:word returnnull - // for case like - // - // return('development'===process.env.NODE_ENV&&null)??'foo' - // - // we need a space before the bool to prevent result like - // - // returnnull??'foo' - // - const dep = new ConstDependency(" null", param.range); - dep.loc = expression.loc; - parser.state.module.addPresentationalDependency(dep); - } else { - const dep = new ConstDependency( - "0", - expression.right.range - ); - dep.loc = expression.loc; - parser.state.module.addPresentationalDependency(dep); - parser.walkExpression(expression.left); - } - return keepRight; - } - } - } - ); - parser.hooks.optionalChaining.tap("ConstPlugin", expr => { - /** @type {ExpressionNode[]} */ - const optionalExpressionsStack = []; - /** @type {ExpressionNode|SuperNode} */ - let next = expr.expression; +/***/ }), - while ( - next.type === "MemberExpression" || - next.type === "CallExpression" - ) { - if (next.type === "MemberExpression") { - if (next.optional) { - // SuperNode can not be optional - optionalExpressionsStack.push( - /** @type {ExpressionNode} */ (next.object) - ); - } - next = next.object; - } else { - if (next.optional) { - // SuperNode can not be optional - optionalExpressionsStack.push( - /** @type {ExpressionNode} */ (next.callee) - ); - } - next = next.callee; - } - } +/***/ 39385: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - while (optionalExpressionsStack.length) { - const expression = optionalExpressionsStack.pop(); - const evaluated = parser.evaluateExpression(expression); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (evaluated && evaluated.asNullish()) { - // ------------------------------------------ - // - // Given the following code: - // - // nullishMemberChain?.a.b(); - // - // the generated code is: - // - // undefined; - // - // ------------------------------------------ - // - const dep = new ConstDependency(" undefined", expr.range); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - } - } - }); - parser.hooks.evaluateIdentifier - .for("__resourceQuery") - .tap("ConstPlugin", expr => { - if (parser.scope.isAsmJs) return; - if (!parser.state.module) return; - return evaluateToString( - cachedParseResource(parser.state.module.resource).query - )(expr); - }); - parser.hooks.expression - .for("__resourceQuery") - .tap("ConstPlugin", expr => { - if (parser.scope.isAsmJs) return; - if (!parser.state.module) return; - const dep = new CachedConstDependency( - JSON.stringify( - cachedParseResource(parser.state.module.resource).query - ), - expr.range, - "__resourceQuery" - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - parser.hooks.evaluateIdentifier - .for("__resourceFragment") - .tap("ConstPlugin", expr => { - if (parser.scope.isAsmJs) return; - if (!parser.state.module) return; - return evaluateToString( - cachedParseResource(parser.state.module.resource).fragment - )(expr); - }); - parser.hooks.expression - .for("__resourceFragment") - .tap("ConstPlugin", expr => { - if (parser.scope.isAsmJs) return; - if (!parser.state.module) return; - const dep = new CachedConstDependency( - JSON.stringify( - cachedParseResource(parser.state.module.resource).fragment - ), - expr.range, - "__resourceFragment" - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - }; - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("ConstPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("ConstPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("ConstPlugin", handler); - } - ); - } -} - -module.exports = ConstPlugin; - - -/***/ }), - -/***/ 21411: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - - -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./ContextModuleFactory")} ContextModuleFactory */ - -class ContextExclusionPlugin { - /** - * @param {RegExp} negativeMatcher Matcher regular expression - */ - constructor(negativeMatcher) { - this.negativeMatcher = negativeMatcher; - } - - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.contextModuleFactory.tap("ContextExclusionPlugin", cmf => { - cmf.hooks.contextModuleFiles.tap("ContextExclusionPlugin", files => { - return files.filter(filePath => !this.negativeMatcher.test(filePath)); - }); - }); - } -} - -module.exports = ContextExclusionPlugin; - - -/***/ }), - -/***/ 76729: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { OriginalSource, RawSource } = __webpack_require__(51255); -const AsyncDependenciesBlock = __webpack_require__(47736); -const { makeWebpackError } = __webpack_require__(11351); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const WebpackError = __webpack_require__(53799); +const ChunkGraph = __webpack_require__(64971); +const Entrypoint = __webpack_require__(13795); +const { intersect } = __webpack_require__(93347); +const SortableSet = __webpack_require__(13098); +const StringXor = __webpack_require__(40293); const { - compareLocations, - concatComparators, - compareSelect, - keepOriginalOrder, + compareModulesByIdentifier, + compareChunkGroupsByIndex, compareModulesById } = __webpack_require__(29579); -const { contextify, parseResource } = __webpack_require__(82186); -const makeSerializable = __webpack_require__(33032); +const { createArrayToSetDeprecationSet } = __webpack_require__(64518); +const { mergeRuntime } = __webpack_require__(17156); /** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./ChunkGroup").RawChunkGroupOptions} RawChunkGroupOptions */ +/** @typedef {import("./ChunkGraph").ChunkFilterPredicate} ChunkFilterPredicate */ +/** @typedef {import("./ChunkGraph").ChunkSizeOptions} ChunkSizeOptions */ +/** @typedef {import("./ChunkGraph").ModuleFilterPredicate} ModuleFilterPredicate */ +/** @typedef {import("./ChunkGroup")} ChunkGroup */ /** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./Module").BuildMeta} BuildMeta */ -/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("./Compilation").PathData} PathData */ +/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ +/** @typedef {import("./Module")} Module */ /** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./dependencies/ContextElementDependency")} ContextElementDependency */ -/** @template T @typedef {import("./util/LazySet")} LazySet */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("./util/Hash")} Hash */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ -/** @typedef {"sync" | "eager" | "weak" | "async-weak" | "lazy" | "lazy-once"} ContextMode Context mode */ +const ChunkFilesSet = createArrayToSetDeprecationSet("chunk.files"); /** - * @typedef {Object} ContextOptions - * @property {ContextMode} mode - * @property {boolean} recursive - * @property {RegExp} regExp - * @property {"strict"|boolean=} namespaceObject - * @property {string=} addon - * @property {string=} chunkName - * @property {RegExp=} include - * @property {RegExp=} exclude - * @property {RawChunkGroupOptions=} groupOptions - * @property {string=} typePrefix - * @property {string=} category - * @property {string[][]=} referencedExports exports referenced from modules (won't be mangled) + * @typedef {Object} WithId an object who has an id property * + * @property {string | number} id the id of the object */ /** - * @typedef {Object} ContextModuleOptionsExtras - * @property {string} resource - * @property {string=} resourceQuery - * @property {string=} resourceFragment - * @property {TODO} resolveOptions + * @deprecated + * @typedef {Object} ChunkMaps + * @property {Record} hash + * @property {Record>} contentHash + * @property {Record} name */ -/** @typedef {ContextOptions & ContextModuleOptionsExtras} ContextModuleOptions */ - /** - * @callback ResolveDependenciesCallback - * @param {(Error | null)=} err - * @param {ContextElementDependency[]=} dependencies + * @deprecated + * @typedef {Object} ChunkModuleMaps + * @property {Record} id + * @property {Record} hash */ +let debugId = 1000; + /** - * @callback ResolveDependencies - * @param {InputFileSystem} fs - * @param {ContextModuleOptions} options - * @param {ResolveDependenciesCallback} callback + * A Chunk is a unit of encapsulation for Modules. + * Chunks are "rendered" into bundles that get emitted when the build completes. */ - -const SNAPSHOT_OPTIONS = { timestamp: true }; - -const TYPES = new Set(["javascript"]); - -class ContextModule extends Module { +class Chunk { /** - * @param {ResolveDependencies} resolveDependencies function to get dependencies in this context - * @param {ContextModuleOptions} options options object + * @param {string=} name of chunk being created, is optional (for subclasses) + * @param {boolean} backCompat enable backward-compatibility */ - constructor(resolveDependencies, options) { - const parsed = parseResource(options ? options.resource : ""); - const resource = parsed.path; - const resourceQuery = (options && options.resourceQuery) || parsed.query; - const resourceFragment = - (options && options.resourceFragment) || parsed.fragment; - - super("javascript/dynamic", resource); - - // Info from Factory - this.resolveDependencies = resolveDependencies; - /** @type {ContextModuleOptions} */ - this.options = { - ...options, - resource, - resourceQuery, - resourceFragment - }; - if (options && options.resolveOptions !== undefined) { - this.resolveOptions = options.resolveOptions; - } + constructor(name, backCompat = true) { + /** @type {number | string | null} */ + this.id = null; + /** @type {(number|string)[] | null} */ + this.ids = null; + /** @type {number} */ + this.debugId = debugId++; + /** @type {string} */ + this.name = name; + /** @type {SortableSet} */ + this.idNameHints = new SortableSet(); + /** @type {boolean} */ + this.preventIntegration = false; + /** @type {(string | function(PathData, AssetInfo=): string)?} */ + this.filenameTemplate = undefined; + /** @type {(string | function(PathData, AssetInfo=): string)?} */ + this.cssFilenameTemplate = undefined; + /** @private @type {SortableSet} */ + this._groups = new SortableSet(undefined, compareChunkGroupsByIndex); + /** @type {RuntimeSpec} */ + this.runtime = undefined; + /** @type {Set} */ + this.files = backCompat ? new ChunkFilesSet() : new Set(); + /** @type {Set} */ + this.auxiliaryFiles = new Set(); + /** @type {boolean} */ + this.rendered = false; + /** @type {string=} */ + this.hash = undefined; + /** @type {Record} */ + this.contentHash = Object.create(null); + /** @type {string=} */ + this.renderedHash = undefined; + /** @type {string=} */ + this.chunkReason = undefined; + /** @type {boolean} */ + this.extraAsync = false; + } - if (options && typeof options.mode !== "string") { - throw new Error("options.mode is a required option"); + // TODO remove in webpack 6 + // BACKWARD-COMPAT START + get entryModule() { + const entryModules = Array.from( + ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.entryModule", + "DEP_WEBPACK_CHUNK_ENTRY_MODULE" + ).getChunkEntryModulesIterable(this) + ); + if (entryModules.length === 0) { + return undefined; + } else if (entryModules.length === 1) { + return entryModules[0]; + } else { + throw new Error( + "Module.entryModule: Multiple entry modules are not supported by the deprecated API (Use the new ChunkGroup API)" + ); } - - this._identifier = this._createIdentifier(); - this._forceBuild = true; } /** - * @returns {Set} types available (do not mutate) + * @returns {boolean} true, if the chunk contains an entry module */ - getSourceTypes() { - return TYPES; + hasEntryModule() { + return ( + ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.hasEntryModule", + "DEP_WEBPACK_CHUNK_HAS_ENTRY_MODULE" + ).getNumberOfEntryModules(this) > 0 + ); } /** - * Assuming this module is in the cache. Update the (cached) module with - * the fresh module from the factory. Usually updates internal references - * and properties. - * @param {Module} module fresh module - * @returns {void} + * @param {Module} module the module + * @returns {boolean} true, if the chunk could be added */ - updateCacheModule(module) { - const m = /** @type {ContextModule} */ (module); - this.resolveDependencies = m.resolveDependencies; - this.options = m.options; + addModule(module) { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.addModule", + "DEP_WEBPACK_CHUNK_ADD_MODULE" + ); + if (chunkGraph.isModuleInChunk(module, this)) return false; + chunkGraph.connectChunkAndModule(this, module); + return true; } /** - * Assuming this module is in the cache. Remove internal references to allow freeing some memory. + * @param {Module} module the module + * @returns {void} */ - cleanupForCache() { - super.cleanupForCache(); - this.resolveDependencies = undefined; + removeModule(module) { + ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.removeModule", + "DEP_WEBPACK_CHUNK_REMOVE_MODULE" + ).disconnectChunkAndModule(this, module); } - _prettyRegExp(regexString, stripSlash = true) { - const str = (regexString + "").replace(/!/g, "%21").replace(/\|/g, "%7C"); - return stripSlash ? str.substring(1, str.length - 1) : str; + /** + * @returns {number} the number of module which are contained in this chunk + */ + getNumberOfModules() { + return ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.getNumberOfModules", + "DEP_WEBPACK_CHUNK_GET_NUMBER_OF_MODULES" + ).getNumberOfChunkModules(this); } - _createIdentifier() { - let identifier = this.context; - if (this.options.resourceQuery) { - identifier += `|${this.options.resourceQuery}`; - } - if (this.options.resourceFragment) { - identifier += `|${this.options.resourceFragment}`; - } - if (this.options.mode) { - identifier += `|${this.options.mode}`; - } - if (!this.options.recursive) { - identifier += "|nonrecursive"; - } - if (this.options.addon) { - identifier += `|${this.options.addon}`; - } - if (this.options.regExp) { - identifier += `|${this._prettyRegExp(this.options.regExp, false)}`; - } - if (this.options.include) { - identifier += `|include: ${this._prettyRegExp( - this.options.include, - false - )}`; - } - if (this.options.exclude) { - identifier += `|exclude: ${this._prettyRegExp( - this.options.exclude, - false - )}`; - } - if (this.options.referencedExports) { - identifier += `|referencedExports: ${JSON.stringify( - this.options.referencedExports - )}`; - } - if (this.options.chunkName) { - identifier += `|chunkName: ${this.options.chunkName}`; - } - if (this.options.groupOptions) { - identifier += `|groupOptions: ${JSON.stringify( - this.options.groupOptions - )}`; - } - if (this.options.namespaceObject === "strict") { - identifier += "|strict namespace object"; - } else if (this.options.namespaceObject) { - identifier += "|namespace object"; - } - - return identifier; + get modulesIterable() { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.modulesIterable", + "DEP_WEBPACK_CHUNK_MODULES_ITERABLE" + ); + return chunkGraph.getOrderedChunkModulesIterable( + this, + compareModulesByIdentifier + ); } /** - * @returns {string} a unique identifier of the module + * @param {Chunk} otherChunk the chunk to compare with + * @returns {-1|0|1} the comparison result */ - identifier() { - return this._identifier; + compareTo(otherChunk) { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.compareTo", + "DEP_WEBPACK_CHUNK_COMPARE_TO" + ); + return chunkGraph.compareChunks(this, otherChunk); } /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module + * @param {Module} module the module + * @returns {boolean} true, if the chunk contains the module */ - readableIdentifier(requestShortener) { - let identifier = requestShortener.shorten(this.context) + "/"; - if (this.options.resourceQuery) { - identifier += ` ${this.options.resourceQuery}`; - } - if (this.options.mode) { - identifier += ` ${this.options.mode}`; - } - if (!this.options.recursive) { - identifier += " nonrecursive"; - } - if (this.options.addon) { - identifier += ` ${requestShortener.shorten(this.options.addon)}`; - } - if (this.options.regExp) { - identifier += ` ${this._prettyRegExp(this.options.regExp)}`; - } - if (this.options.include) { - identifier += ` include: ${this._prettyRegExp(this.options.include)}`; - } - if (this.options.exclude) { - identifier += ` exclude: ${this._prettyRegExp(this.options.exclude)}`; - } - if (this.options.referencedExports) { - identifier += ` referencedExports: ${this.options.referencedExports - .map(e => e.join(".")) - .join(", ")}`; - } - if (this.options.chunkName) { - identifier += ` chunkName: ${this.options.chunkName}`; - } - if (this.options.groupOptions) { - const groupOptions = this.options.groupOptions; - for (const key of Object.keys(groupOptions)) { - identifier += ` ${key}: ${groupOptions[key]}`; - } - } - if (this.options.namespaceObject === "strict") { - identifier += " strict namespace object"; - } else if (this.options.namespaceObject) { - identifier += " namespace object"; - } - - return identifier; + containsModule(module) { + return ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.containsModule", + "DEP_WEBPACK_CHUNK_CONTAINS_MODULE" + ).isModuleInChunk(module, this); } /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion + * @returns {Module[]} the modules for this chunk */ - libIdent(options) { - let identifier = contextify( - options.context, - this.context, - options.associatedObjectForCache - ); - if (this.layer) identifier = `(${this.layer})/${identifier}`; - if (this.options.mode) { - identifier += ` ${this.options.mode}`; - } - if (this.options.recursive) { - identifier += " recursive"; - } - if (this.options.addon) { - identifier += ` ${contextify( - options.context, - this.options.addon, - options.associatedObjectForCache - )}`; - } - if (this.options.regExp) { - identifier += ` ${this._prettyRegExp(this.options.regExp)}`; - } - if (this.options.include) { - identifier += ` include: ${this._prettyRegExp(this.options.include)}`; - } - if (this.options.exclude) { - identifier += ` exclude: ${this._prettyRegExp(this.options.exclude)}`; - } - if (this.options.referencedExports) { - identifier += ` referencedExports: ${this.options.referencedExports - .map(e => e.join(".")) - .join(", ")}`; - } - - return identifier; + getModules() { + return ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.getModules", + "DEP_WEBPACK_CHUNK_GET_MODULES" + ).getChunkModules(this); } /** * @returns {void} */ - invalidateBuild() { - this._forceBuild = true; + remove() { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.remove", + "DEP_WEBPACK_CHUNK_REMOVE" + ); + chunkGraph.disconnectChunk(this); + this.disconnectFromGroups(); } /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @param {Module} module the module + * @param {Chunk} otherChunk the target chunk * @returns {void} */ - needBuild({ fileSystemInfo }, callback) { - // build if enforced - if (this._forceBuild) return callback(null, true); - - // always build when we have no snapshot - if (!this.buildInfo.snapshot) return callback(null, true); - - fileSystemInfo.checkSnapshotValid(this.buildInfo.snapshot, (err, valid) => { - callback(err, !valid); - }); + moveModule(module, otherChunk) { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.moveModule", + "DEP_WEBPACK_CHUNK_MOVE_MODULE" + ); + chunkGraph.disconnectChunkAndModule(this, module); + chunkGraph.connectChunkAndModule(otherChunk, module); } /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} + * @param {Chunk} otherChunk the other chunk + * @returns {boolean} true, if the specified chunk has been integrated */ - build(options, compilation, resolver, fs, callback) { - this._forceBuild = false; - /** @type {BuildMeta} */ - this.buildMeta = { - exportsType: "default", - defaultObject: "redirect-warn" - }; - this.buildInfo = { - snapshot: undefined - }; - this.dependencies.length = 0; - this.blocks.length = 0; - const startTime = Date.now(); - this.resolveDependencies(fs, this.options, (err, dependencies) => { - if (err) { - return callback( - makeWebpackError(err, "ContextModule.resolveDependencies") - ); - } + integrate(otherChunk) { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.integrate", + "DEP_WEBPACK_CHUNK_INTEGRATE" + ); + if (chunkGraph.canChunksBeIntegrated(this, otherChunk)) { + chunkGraph.integrateChunks(this, otherChunk); + return true; + } else { + return false; + } + } - // abort if something failed - // this will create an empty context - if (!dependencies) { - callback(); - return; - } + /** + * @param {Chunk} otherChunk the other chunk + * @returns {boolean} true, if chunks could be integrated + */ + canBeIntegrated(otherChunk) { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.canBeIntegrated", + "DEP_WEBPACK_CHUNK_CAN_BE_INTEGRATED" + ); + return chunkGraph.canChunksBeIntegrated(this, otherChunk); + } - // enhance dependencies with meta info - for (const dep of dependencies) { - dep.loc = { - name: dep.userRequest - }; - dep.request = this.options.addon + dep.request; - } - dependencies.sort( - concatComparators( - compareSelect(a => a.loc, compareLocations), - keepOriginalOrder(this.dependencies) - ) - ); + /** + * @returns {boolean} true, if this chunk contains no module + */ + isEmpty() { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.isEmpty", + "DEP_WEBPACK_CHUNK_IS_EMPTY" + ); + return chunkGraph.getNumberOfChunkModules(this) === 0; + } - if (this.options.mode === "sync" || this.options.mode === "eager") { - // if we have an sync or eager context - // just add all dependencies and continue - this.dependencies = dependencies; - } else if (this.options.mode === "lazy-once") { - // for the lazy-once mode create a new async dependency block - // and add that block to this context - if (dependencies.length > 0) { - const block = new AsyncDependenciesBlock({ - ...this.options.groupOptions, - name: this.options.chunkName - }); - for (const dep of dependencies) { - block.addDependency(dep); - } - this.addBlock(block); - } - } else if ( - this.options.mode === "weak" || - this.options.mode === "async-weak" - ) { - // we mark all dependencies as weak - for (const dep of dependencies) { - dep.weak = true; - } - this.dependencies = dependencies; - } else if (this.options.mode === "lazy") { - // if we are lazy create a new async dependency block per dependency - // and add all blocks to this context - let index = 0; - for (const dep of dependencies) { - let chunkName = this.options.chunkName; - if (chunkName) { - if (!/\[(index|request)\]/.test(chunkName)) { - chunkName += "[index]"; - } - chunkName = chunkName.replace(/\[index\]/g, `${index++}`); - chunkName = chunkName.replace( - /\[request\]/g, - Template.toPath(dep.userRequest) - ); + /** + * @returns {number} total size of all modules in this chunk + */ + modulesSize() { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.modulesSize", + "DEP_WEBPACK_CHUNK_MODULES_SIZE" + ); + return chunkGraph.getChunkModulesSize(this); + } + + /** + * @param {ChunkSizeOptions} options options object + * @returns {number} total size of this chunk + */ + size(options = {}) { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.size", + "DEP_WEBPACK_CHUNK_SIZE" + ); + return chunkGraph.getChunkSize(this, options); + } + + /** + * @param {Chunk} otherChunk the other chunk + * @param {ChunkSizeOptions} options options object + * @returns {number} total size of the chunk or false if the chunk can't be integrated + */ + integratedSize(otherChunk, options) { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.integratedSize", + "DEP_WEBPACK_CHUNK_INTEGRATED_SIZE" + ); + return chunkGraph.getIntegratedChunksSize(this, otherChunk, options); + } + + /** + * @param {ModuleFilterPredicate} filterFn function used to filter modules + * @returns {ChunkModuleMaps} module map information + */ + getChunkModuleMaps(filterFn) { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.getChunkModuleMaps", + "DEP_WEBPACK_CHUNK_GET_CHUNK_MODULE_MAPS" + ); + /** @type {Record} */ + const chunkModuleIdMap = Object.create(null); + /** @type {Record} */ + const chunkModuleHashMap = Object.create(null); + + for (const asyncChunk of this.getAllAsyncChunks()) { + /** @type {(string|number)[]} */ + let array; + for (const module of chunkGraph.getOrderedChunkModulesIterable( + asyncChunk, + compareModulesById(chunkGraph) + )) { + if (filterFn(module)) { + if (array === undefined) { + array = []; + chunkModuleIdMap[asyncChunk.id] = array; } - const block = new AsyncDependenciesBlock( - { - ...this.options.groupOptions, - name: chunkName - }, - dep.loc, - dep.userRequest + const moduleId = chunkGraph.getModuleId(module); + array.push(moduleId); + chunkModuleHashMap[moduleId] = chunkGraph.getRenderedModuleHash( + module, + undefined ); - block.addDependency(dep); - this.addBlock(block); } - } else { - callback( - new WebpackError(`Unsupported mode "${this.options.mode}" in context`) - ); - return; } - compilation.fileSystemInfo.createSnapshot( - startTime, - null, - [this.context], - null, - SNAPSHOT_OPTIONS, - (err, snapshot) => { - if (err) return callback(err); - this.buildInfo.snapshot = snapshot; - callback(); - } - ); - }); + } + + return { + id: chunkModuleIdMap, + hash: chunkModuleHashMap + }; } /** - * @param {LazySet} fileDependencies set where file dependencies are added to - * @param {LazySet} contextDependencies set where context dependencies are added to - * @param {LazySet} missingDependencies set where missing dependencies are added to - * @param {LazySet} buildDependencies set where build dependencies are added to + * @param {ModuleFilterPredicate} filterFn predicate function used to filter modules + * @param {ChunkFilterPredicate=} filterChunkFn predicate function used to filter chunks + * @returns {boolean} return true if module exists in graph */ - addCacheDependencies( - fileDependencies, - contextDependencies, - missingDependencies, - buildDependencies - ) { - contextDependencies.add(this.context); + hasModuleInGraph(filterFn, filterChunkFn) { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.hasModuleInGraph", + "DEP_WEBPACK_CHUNK_HAS_MODULE_IN_GRAPH" + ); + return chunkGraph.hasModuleInGraph(this, filterFn, filterChunkFn); } /** - * @param {ContextElementDependency[]} dependencies all dependencies - * @param {ChunkGraph} chunkGraph chunk graph - * @returns {TODO} TODO + * @deprecated + * @param {boolean} realHash whether the full hash or the rendered hash is to be used + * @returns {ChunkMaps} the chunk map information */ - getUserRequestMap(dependencies, chunkGraph) { - const moduleGraph = chunkGraph.moduleGraph; - // if we filter first we get a new array - // therefore we don't need to create a clone of dependencies explicitly - // therefore the order of this is !important! - const sortedDependencies = dependencies - .filter(dependency => moduleGraph.getModule(dependency)) - .sort((a, b) => { - if (a.userRequest === b.userRequest) { - return 0; + getChunkMaps(realHash) { + /** @type {Record} */ + const chunkHashMap = Object.create(null); + /** @type {Record>} */ + const chunkContentHashMap = Object.create(null); + /** @type {Record} */ + const chunkNameMap = Object.create(null); + + for (const chunk of this.getAllAsyncChunks()) { + chunkHashMap[chunk.id] = realHash ? chunk.hash : chunk.renderedHash; + for (const key of Object.keys(chunk.contentHash)) { + if (!chunkContentHashMap[key]) { + chunkContentHashMap[key] = Object.create(null); } - return a.userRequest < b.userRequest ? -1 : 1; - }); - const map = Object.create(null); - for (const dep of sortedDependencies) { - const module = moduleGraph.getModule(dep); - map[dep.userRequest] = chunkGraph.getModuleId(module); + chunkContentHashMap[key][chunk.id] = chunk.contentHash[key]; + } + if (chunk.name) { + chunkNameMap[chunk.id] = chunk.name; + } } - return map; + + return { + hash: chunkHashMap, + contentHash: chunkContentHashMap, + name: chunkNameMap + }; } + // BACKWARD-COMPAT END /** - * @param {ContextElementDependency[]} dependencies all dependencies - * @param {ChunkGraph} chunkGraph chunk graph - * @returns {TODO} TODO + * @returns {boolean} whether or not the Chunk will have a runtime */ - getFakeMap(dependencies, chunkGraph) { - if (!this.options.namespaceObject) { - return 9; - } - const moduleGraph = chunkGraph.moduleGraph; - // bitfield - let hasType = 0; - const comparator = compareModulesById(chunkGraph); - // if we filter first we get a new array - // therefore we don't need to create a clone of dependencies explicitly - // therefore the order of this is !important! - const sortedModules = dependencies - .map(dependency => moduleGraph.getModule(dependency)) - .filter(Boolean) - .sort(comparator); - const fakeMap = Object.create(null); - for (const module of sortedModules) { - const exportsType = module.getExportsType( - moduleGraph, - this.options.namespaceObject === "strict" - ); - const id = chunkGraph.getModuleId(module); - switch (exportsType) { - case "namespace": - fakeMap[id] = 9; - hasType |= 1; - break; - case "dynamic": - fakeMap[id] = 7; - hasType |= 2; - break; - case "default-only": - fakeMap[id] = 1; - hasType |= 4; - break; - case "default-with-named": - fakeMap[id] = 3; - hasType |= 8; - break; - default: - throw new Error(`Unexpected exports type ${exportsType}`); + hasRuntime() { + for (const chunkGroup of this._groups) { + if ( + chunkGroup instanceof Entrypoint && + chunkGroup.getRuntimeChunk() === this + ) { + return true; } } - if (hasType === 1) { - return 9; - } - if (hasType === 2) { - return 7; - } - if (hasType === 4) { - return 1; - } - if (hasType === 8) { - return 3; - } - if (hasType === 0) { - return 9; - } - return fakeMap; + return false; } - getFakeMapInitStatement(fakeMap) { - return typeof fakeMap === "object" - ? `var fakeMap = ${JSON.stringify(fakeMap, null, "\t")};` - : ""; + /** + * @returns {boolean} whether or not this chunk can be an initial chunk + */ + canBeInitial() { + for (const chunkGroup of this._groups) { + if (chunkGroup.isInitial()) return true; + } + return false; } - getReturn(type, asyncModule) { - if (type === 9) { - return "__webpack_require__(id)"; + /** + * @returns {boolean} whether this chunk can only be an initial chunk + */ + isOnlyInitial() { + if (this._groups.size <= 0) return false; + for (const chunkGroup of this._groups) { + if (!chunkGroup.isInitial()) return false; } - return `${RuntimeGlobals.createFakeNamespaceObject}(id, ${type}${ - asyncModule ? " | 16" : "" - })`; + return true; } - getReturnModuleObjectSource( - fakeMap, - asyncModule, - fakeMapDataExpression = "fakeMap[id]" - ) { - if (typeof fakeMap === "number") { - return `return ${this.getReturn(fakeMap, asyncModule)};`; + /** + * @returns {EntryOptions | undefined} the entry options for this chunk + */ + getEntryOptions() { + for (const chunkGroup of this._groups) { + if (chunkGroup instanceof Entrypoint) { + return chunkGroup.options; + } } - return `return ${ - RuntimeGlobals.createFakeNamespaceObject - }(id, ${fakeMapDataExpression}${asyncModule ? " | 16" : ""})`; + return undefined; } /** - * @param {TODO} dependencies TODO - * @param {TODO} id TODO - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {string} source code + * @param {ChunkGroup} chunkGroup the chunkGroup the chunk is being added + * @returns {void} */ - getSyncSource(dependencies, id, chunkGraph) { - const map = this.getUserRequestMap(dependencies, chunkGraph); - const fakeMap = this.getFakeMap(dependencies, chunkGraph); - const returnModuleObject = this.getReturnModuleObjectSource(fakeMap); - - return `var map = ${JSON.stringify(map, null, "\t")}; -${this.getFakeMapInitStatement(fakeMap)} - -function webpackContext(req) { - var id = webpackContextResolve(req); - ${returnModuleObject} -} -function webpackContextResolve(req) { - if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; - } - return map[req]; -} -webpackContext.keys = function webpackContextKeys() { - return Object.keys(map); -}; -webpackContext.resolve = webpackContextResolve; -module.exports = webpackContext; -webpackContext.id = ${JSON.stringify(id)};`; + addGroup(chunkGroup) { + this._groups.add(chunkGroup); } /** - * @param {TODO} dependencies TODO - * @param {TODO} id TODO - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {string} source code + * @param {ChunkGroup} chunkGroup the chunkGroup the chunk is being removed from + * @returns {void} */ - getWeakSyncSource(dependencies, id, chunkGraph) { - const map = this.getUserRequestMap(dependencies, chunkGraph); - const fakeMap = this.getFakeMap(dependencies, chunkGraph); - const returnModuleObject = this.getReturnModuleObjectSource(fakeMap); - - return `var map = ${JSON.stringify(map, null, "\t")}; -${this.getFakeMapInitStatement(fakeMap)} - -function webpackContext(req) { - var id = webpackContextResolve(req); - if(!${RuntimeGlobals.moduleFactories}[id]) { - var e = new Error("Module '" + req + "' ('" + id + "') is not available (weak dependency)"); - e.code = 'MODULE_NOT_FOUND'; - throw e; + removeGroup(chunkGroup) { + this._groups.delete(chunkGroup); } - ${returnModuleObject} -} -function webpackContextResolve(req) { - if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; + + /** + * @param {ChunkGroup} chunkGroup the chunkGroup to check + * @returns {boolean} returns true if chunk has chunkGroup reference and exists in chunkGroup + */ + isInGroup(chunkGroup) { + return this._groups.has(chunkGroup); } - return map[req]; -} -webpackContext.keys = function webpackContextKeys() { - return Object.keys(map); -}; -webpackContext.resolve = webpackContextResolve; -webpackContext.id = ${JSON.stringify(id)}; -module.exports = webpackContext;`; + + /** + * @returns {number} the amount of groups that the said chunk is in + */ + getNumberOfGroups() { + return this._groups.size; } /** - * @param {TODO} dependencies TODO - * @param {TODO} id TODO - * @param {Object} context context - * @param {ChunkGraph} context.chunkGraph the chunk graph - * @param {RuntimeTemplate} context.runtimeTemplate the chunk graph - * @returns {string} source code + * @returns {Iterable} the chunkGroups that the said chunk is referenced in */ - getAsyncWeakSource(dependencies, id, { chunkGraph, runtimeTemplate }) { - const arrow = runtimeTemplate.supportsArrowFunction(); - const map = this.getUserRequestMap(dependencies, chunkGraph); - const fakeMap = this.getFakeMap(dependencies, chunkGraph); - const returnModuleObject = this.getReturnModuleObjectSource(fakeMap, true); + get groupsIterable() { + this._groups.sort(); + return this._groups; + } - return `var map = ${JSON.stringify(map, null, "\t")}; -${this.getFakeMapInitStatement(fakeMap)} + /** + * @returns {void} + */ + disconnectFromGroups() { + for (const chunkGroup of this._groups) { + chunkGroup.removeChunk(this); + } + } -function webpackAsyncContext(req) { - return webpackAsyncContextResolve(req).then(${ - arrow ? "id =>" : "function(id)" - } { - if(!${RuntimeGlobals.moduleFactories}[id]) { - var e = new Error("Module '" + req + "' ('" + id + "') is not available (weak dependency)"); - e.code = 'MODULE_NOT_FOUND'; - throw e; + /** + * @param {Chunk} newChunk the new chunk that will be split out of + * @returns {void} + */ + split(newChunk) { + for (const chunkGroup of this._groups) { + chunkGroup.insertChunk(newChunk, this); + newChunk.addGroup(chunkGroup); } - ${returnModuleObject} - }); -} -function webpackAsyncContextResolve(req) { - // Here Promise.resolve().then() is used instead of new Promise() to prevent - // uncaught exception popping up in devtools - return Promise.resolve().then(${arrow ? "() =>" : "function()"} { - if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; + for (const idHint of this.idNameHints) { + newChunk.idNameHints.add(idHint); } - return map[req]; - }); -} -webpackAsyncContext.keys = ${runtimeTemplate.returningFunction( - "Object.keys(map)" - )}; -webpackAsyncContext.resolve = webpackAsyncContextResolve; -webpackAsyncContext.id = ${JSON.stringify(id)}; -module.exports = webpackAsyncContext;`; + newChunk.runtime = mergeRuntime(newChunk.runtime, this.runtime); } /** - * @param {TODO} dependencies TODO - * @param {TODO} id TODO - * @param {Object} context context - * @param {ChunkGraph} context.chunkGraph the chunk graph - * @param {RuntimeTemplate} context.runtimeTemplate the chunk graph - * @returns {string} source code + * @param {Hash} hash hash (will be modified) + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {void} */ - getEagerSource(dependencies, id, { chunkGraph, runtimeTemplate }) { - const arrow = runtimeTemplate.supportsArrowFunction(); - const map = this.getUserRequestMap(dependencies, chunkGraph); - const fakeMap = this.getFakeMap(dependencies, chunkGraph); - const thenFunction = - fakeMap !== 9 - ? `${arrow ? "id =>" : "function(id)"} { - ${this.getReturnModuleObjectSource(fakeMap)} - }` - : "__webpack_require__"; - return `var map = ${JSON.stringify(map, null, "\t")}; -${this.getFakeMapInitStatement(fakeMap)} - -function webpackAsyncContext(req) { - return webpackAsyncContextResolve(req).then(${thenFunction}); -} -function webpackAsyncContextResolve(req) { - // Here Promise.resolve().then() is used instead of new Promise() to prevent - // uncaught exception popping up in devtools - return Promise.resolve().then(${arrow ? "() =>" : "function()"} { - if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; + updateHash(hash, chunkGraph) { + hash.update( + `${this.id} ${this.ids ? this.ids.join() : ""} ${this.name || ""} ` + ); + const xor = new StringXor(); + for (const m of chunkGraph.getChunkModulesIterable(this)) { + xor.add(chunkGraph.getModuleHash(m, this.runtime)); + } + xor.updateHash(hash); + const entryModules = + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(this); + for (const [m, chunkGroup] of entryModules) { + hash.update(`entry${chunkGraph.getModuleId(m)}${chunkGroup.id}`); } - return map[req]; - }); -} -webpackAsyncContext.keys = ${runtimeTemplate.returningFunction( - "Object.keys(map)" - )}; -webpackAsyncContext.resolve = webpackAsyncContextResolve; -webpackAsyncContext.id = ${JSON.stringify(id)}; -module.exports = webpackAsyncContext;`; } /** - * @param {TODO} block TODO - * @param {TODO} dependencies TODO - * @param {TODO} id TODO - * @param {Object} options options object - * @param {RuntimeTemplate} options.runtimeTemplate the runtime template - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @returns {string} source code + * @returns {Set} a set of all the async chunks */ - getLazyOnceSource(block, dependencies, id, { runtimeTemplate, chunkGraph }) { - const promise = runtimeTemplate.blockPromise({ - chunkGraph, - block, - message: "lazy-once context", - runtimeRequirements: new Set() - }); - const arrow = runtimeTemplate.supportsArrowFunction(); - const map = this.getUserRequestMap(dependencies, chunkGraph); - const fakeMap = this.getFakeMap(dependencies, chunkGraph); - const thenFunction = - fakeMap !== 9 - ? `${arrow ? "id =>" : "function(id)"} { - ${this.getReturnModuleObjectSource(fakeMap, true)}; - }` - : "__webpack_require__"; + getAllAsyncChunks() { + const queue = new Set(); + const chunks = new Set(); - return `var map = ${JSON.stringify(map, null, "\t")}; -${this.getFakeMapInitStatement(fakeMap)} + const initialChunks = intersect( + Array.from(this.groupsIterable, g => new Set(g.chunks)) + ); -function webpackAsyncContext(req) { - return webpackAsyncContextResolve(req).then(${thenFunction}); -} -function webpackAsyncContextResolve(req) { - return ${promise}.then(${arrow ? "() =>" : "function()"} { - if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; - } - return map[req]; - }); -} -webpackAsyncContext.keys = ${runtimeTemplate.returningFunction( - "Object.keys(map)" - )}; -webpackAsyncContext.resolve = webpackAsyncContextResolve; -webpackAsyncContext.id = ${JSON.stringify(id)}; -module.exports = webpackAsyncContext;`; - } + const initialQueue = new Set(this.groupsIterable); - /** - * @param {TODO} blocks TODO - * @param {TODO} id TODO - * @param {Object} context context - * @param {ChunkGraph} context.chunkGraph the chunk graph - * @param {RuntimeTemplate} context.runtimeTemplate the chunk graph - * @returns {string} source code - */ - getLazySource(blocks, id, { chunkGraph, runtimeTemplate }) { - const moduleGraph = chunkGraph.moduleGraph; - const arrow = runtimeTemplate.supportsArrowFunction(); - let hasMultipleOrNoChunks = false; - let hasNoChunk = true; - const fakeMap = this.getFakeMap( - blocks.map(b => b.dependencies[0]), - chunkGraph - ); - const hasFakeMap = typeof fakeMap === "object"; - const items = blocks - .map(block => { - const dependency = block.dependencies[0]; - return { - dependency: dependency, - module: moduleGraph.getModule(dependency), - block: block, - userRequest: dependency.userRequest, - chunks: undefined - }; - }) - .filter(item => item.module); - for (const item of items) { - const chunkGroup = chunkGraph.getBlockChunkGroup(item.block); - const chunks = (chunkGroup && chunkGroup.chunks) || []; - item.chunks = chunks; - if (chunks.length > 0) { - hasNoChunk = false; - } - if (chunks.length !== 1) { - hasMultipleOrNoChunks = true; + for (const chunkGroup of initialQueue) { + for (const child of chunkGroup.childrenIterable) { + if (child instanceof Entrypoint) { + initialQueue.add(child); + } else { + queue.add(child); + } } } - const shortMode = hasNoChunk && !hasFakeMap; - const sortedItems = items.sort((a, b) => { - if (a.userRequest === b.userRequest) return 0; - return a.userRequest < b.userRequest ? -1 : 1; - }); - const map = Object.create(null); - for (const item of sortedItems) { - const moduleId = chunkGraph.getModuleId(item.module); - if (shortMode) { - map[item.userRequest] = moduleId; - } else { - const arrayStart = [moduleId]; - if (hasFakeMap) { - arrayStart.push(fakeMap[moduleId]); + + for (const chunkGroup of queue) { + for (const chunk of chunkGroup.chunks) { + if (!initialChunks.has(chunk)) { + chunks.add(chunk); } - map[item.userRequest] = arrayStart.concat( - item.chunks.map(chunk => chunk.id) - ); + } + for (const child of chunkGroup.childrenIterable) { + queue.add(child); } } - const chunksStartPosition = hasFakeMap ? 2 : 1; - const requestPrefix = hasNoChunk - ? "Promise.resolve()" - : hasMultipleOrNoChunks - ? `Promise.all(ids.slice(${chunksStartPosition}).map(${RuntimeGlobals.ensureChunk}))` - : `${RuntimeGlobals.ensureChunk}(ids[${chunksStartPosition}])`; - const returnModuleObject = this.getReturnModuleObjectSource( - fakeMap, - true, - shortMode ? "invalid" : "ids[1]" - ); + return chunks; + } - const webpackAsyncContext = - requestPrefix === "Promise.resolve()" - ? ` -function webpackAsyncContext(req) { - return Promise.resolve().then(${arrow ? "() =>" : "function()"} { - if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; + /** + * @returns {Set} a set of all the initial chunks (including itself) + */ + getAllInitialChunks() { + const chunks = new Set(); + const queue = new Set(this.groupsIterable); + for (const group of queue) { + if (group.isInitial()) { + for (const c of group.chunks) chunks.add(c); + for (const g of group.childrenIterable) queue.add(g); + } } - - ${shortMode ? "var id = map[req];" : "var ids = map[req], id = ids[0];"} - ${returnModuleObject} - }); -}` - : `function webpackAsyncContext(req) { - if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { - return Promise.resolve().then(${arrow ? "() =>" : "function()"} { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; - }); + return chunks; } - var ids = map[req], id = ids[0]; - return ${requestPrefix}.then(${arrow ? "() =>" : "function()"} { - ${returnModuleObject} - }); -}`; - - return `var map = ${JSON.stringify(map, null, "\t")}; -${webpackAsyncContext} -webpackAsyncContext.keys = ${runtimeTemplate.returningFunction( - "Object.keys(map)" - )}; -webpackAsyncContext.id = ${JSON.stringify(id)}; -module.exports = webpackAsyncContext;`; - } + /** + * @returns {Set} a set of all the referenced chunks (including itself) + */ + getAllReferencedChunks() { + const queue = new Set(this.groupsIterable); + const chunks = new Set(); - getSourceForEmptyContext(id, runtimeTemplate) { - return `function webpackEmptyContext(req) { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; -} -webpackEmptyContext.keys = ${runtimeTemplate.returningFunction("[]")}; -webpackEmptyContext.resolve = webpackEmptyContext; -webpackEmptyContext.id = ${JSON.stringify(id)}; -module.exports = webpackEmptyContext;`; - } + for (const chunkGroup of queue) { + for (const chunk of chunkGroup.chunks) { + chunks.add(chunk); + } + for (const child of chunkGroup.childrenIterable) { + queue.add(child); + } + } - getSourceForEmptyAsyncContext(id, runtimeTemplate) { - const arrow = runtimeTemplate.supportsArrowFunction(); - return `function webpackEmptyAsyncContext(req) { - // Here Promise.resolve().then() is used instead of new Promise() to prevent - // uncaught exception popping up in devtools - return Promise.resolve().then(${arrow ? "() =>" : "function()"} { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; - }); -} -webpackEmptyAsyncContext.keys = ${runtimeTemplate.returningFunction("[]")}; -webpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext; -webpackEmptyAsyncContext.id = ${JSON.stringify(id)}; -module.exports = webpackEmptyAsyncContext;`; + return chunks; } /** - * @param {string} asyncMode module mode - * @param {CodeGenerationContext} context context info - * @returns {string} the source code + * @returns {Set} a set of all the referenced entrypoints */ - getSourceString(asyncMode, { runtimeTemplate, chunkGraph }) { - const id = chunkGraph.getModuleId(this); - if (asyncMode === "lazy") { - if (this.blocks && this.blocks.length > 0) { - return this.getLazySource(this.blocks, id, { - runtimeTemplate, - chunkGraph - }); + getAllReferencedAsyncEntrypoints() { + const queue = new Set(this.groupsIterable); + const entrypoints = new Set(); + + for (const chunkGroup of queue) { + for (const entrypoint of chunkGroup.asyncEntrypointsIterable) { + entrypoints.add(entrypoint); } - return this.getSourceForEmptyAsyncContext(id, runtimeTemplate); - } - if (asyncMode === "eager") { - if (this.dependencies && this.dependencies.length > 0) { - return this.getEagerSource(this.dependencies, id, { - chunkGraph, - runtimeTemplate - }); + for (const child of chunkGroup.childrenIterable) { + queue.add(child); } - return this.getSourceForEmptyAsyncContext(id, runtimeTemplate); } - if (asyncMode === "lazy-once") { - const block = this.blocks[0]; - if (block) { - return this.getLazyOnceSource(block, block.dependencies, id, { - runtimeTemplate, - chunkGraph - }); + + return entrypoints; + } + + /** + * @returns {boolean} true, if the chunk references async chunks + */ + hasAsyncChunks() { + const queue = new Set(); + + const initialChunks = intersect( + Array.from(this.groupsIterable, g => new Set(g.chunks)) + ); + + for (const chunkGroup of this.groupsIterable) { + for (const child of chunkGroup.childrenIterable) { + queue.add(child); } - return this.getSourceForEmptyAsyncContext(id, runtimeTemplate); } - if (asyncMode === "async-weak") { - if (this.dependencies && this.dependencies.length > 0) { - return this.getAsyncWeakSource(this.dependencies, id, { - chunkGraph, - runtimeTemplate - }); + + for (const chunkGroup of queue) { + for (const chunk of chunkGroup.chunks) { + if (!initialChunks.has(chunk)) { + return true; + } } - return this.getSourceForEmptyAsyncContext(id, runtimeTemplate); - } - if (asyncMode === "weak") { - if (this.dependencies && this.dependencies.length > 0) { - return this.getWeakSyncSource(this.dependencies, id, chunkGraph); + for (const child of chunkGroup.childrenIterable) { + queue.add(child); } } - if (this.dependencies && this.dependencies.length > 0) { - return this.getSyncSource(this.dependencies, id, chunkGraph); - } - return this.getSourceForEmptyContext(id, runtimeTemplate); - } - getSource(sourceString) { - if (this.useSourceMap || this.useSimpleSourceMap) { - return new OriginalSource(sourceString, this.identifier()); - } - return new RawSource(sourceString); + return false; } /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {ChunkFilterPredicate=} filterFn function used to filter chunks + * @returns {Record} a record object of names to lists of child ids(?) */ - codeGeneration(context) { - const { chunkGraph } = context; - const sources = new Map(); - sources.set( - "javascript", - this.getSource(this.getSourceString(this.options.mode, context)) - ); - const set = new Set(); - const allDeps = /** @type {ContextElementDependency[]} */ ( - this.dependencies.concat(this.blocks.map(b => b.dependencies[0])) - ); - set.add(RuntimeGlobals.module); - set.add(RuntimeGlobals.hasOwnProperty); - if (allDeps.length > 0) { - const asyncMode = this.options.mode; - set.add(RuntimeGlobals.require); - if (asyncMode === "weak") { - set.add(RuntimeGlobals.moduleFactories); - } else if (asyncMode === "async-weak") { - set.add(RuntimeGlobals.moduleFactories); - set.add(RuntimeGlobals.ensureChunk); - } else if (asyncMode === "lazy" || asyncMode === "lazy-once") { - set.add(RuntimeGlobals.ensureChunk); + getChildIdsByOrders(chunkGraph, filterFn) { + /** @type {Map} */ + const lists = new Map(); + for (const group of this.groupsIterable) { + if (group.chunks[group.chunks.length - 1] === this) { + for (const childGroup of group.childrenIterable) { + for (const key of Object.keys(childGroup.options)) { + if (key.endsWith("Order")) { + const name = key.substr(0, key.length - "Order".length); + let list = lists.get(name); + if (list === undefined) { + list = []; + lists.set(name, list); + } + list.push({ + order: childGroup.options[key], + group: childGroup + }); + } + } + } } - if (this.getFakeMap(allDeps, chunkGraph) !== 9) { - set.add(RuntimeGlobals.createFakeNamespaceObject); + } + /** @type {Record} */ + const result = Object.create(null); + for (const [name, list] of lists) { + list.sort((a, b) => { + const cmp = b.order - a.order; + if (cmp !== 0) return cmp; + return a.group.compareTo(chunkGraph, b.group); + }); + /** @type {Set} */ + const chunkIdSet = new Set(); + for (const item of list) { + for (const chunk of item.group.chunks) { + if (filterFn && !filterFn(chunk, chunkGraph)) continue; + chunkIdSet.add(chunk.id); + } + } + if (chunkIdSet.size > 0) { + result[name] = Array.from(chunkIdSet); } } - return { - sources, - runtimeRequirements: set - }; + return result; } /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {string} type option name + * @returns {{ onChunks: Chunk[], chunks: Set }[]} referenced chunks for a specific type */ - size(type) { - // base penalty - let size = 160; - - // if we don't have dependencies we stop here. - for (const dependency of this.dependencies) { - const element = /** @type {ContextElementDependency} */ (dependency); - size += 5 + element.userRequest.length; + getChildrenOfTypeInOrder(chunkGraph, type) { + const list = []; + for (const group of this.groupsIterable) { + for (const childGroup of group.childrenIterable) { + const order = childGroup.options[type]; + if (order === undefined) continue; + list.push({ + order, + group, + childGroup + }); + } } - return size; - } - - serialize(context) { - const { write } = context; - write(this._identifier); - write(this._forceBuild); - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - this._identifier = read(); - this._forceBuild = read(); - super.deserialize(context); + if (list.length === 0) return undefined; + list.sort((a, b) => { + const cmp = b.order - a.order; + if (cmp !== 0) return cmp; + return a.group.compareTo(chunkGraph, b.group); + }); + const result = []; + let lastEntry; + for (const { group, childGroup } of list) { + if (lastEntry && lastEntry.onChunks === group.chunks) { + for (const chunk of childGroup.chunks) { + lastEntry.chunks.add(chunk); + } + } else { + result.push( + (lastEntry = { + onChunks: group.chunks, + chunks: new Set(childGroup.chunks) + }) + ); + } + } + return result; } -} -makeSerializable(ContextModule, "webpack/lib/ContextModule"); + /** + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {boolean=} includeDirectChildren include direct children (by default only children of async children are included) + * @param {ChunkFilterPredicate=} filterFn function used to filter chunks + * @returns {Record>} a record object of names to lists of child ids(?) by chunk id + */ + getChildIdsByOrdersMap(chunkGraph, includeDirectChildren, filterFn) { + /** @type {Record>} */ + const chunkMaps = Object.create(null); -module.exports = ContextModule; + /** + * @param {Chunk} chunk a chunk + * @returns {void} + */ + const addChildIdsByOrdersToMap = chunk => { + const data = chunk.getChildIdsByOrders(chunkGraph, filterFn); + for (const key of Object.keys(data)) { + let chunkMap = chunkMaps[key]; + if (chunkMap === undefined) { + chunkMaps[key] = chunkMap = Object.create(null); + } + chunkMap[chunk.id] = data[key]; + } + }; + + if (includeDirectChildren) { + /** @type {Set} */ + const chunks = new Set(); + for (const chunkGroup of this.groupsIterable) { + for (const chunk of chunkGroup.chunks) { + chunks.add(chunk); + } + } + for (const chunk of chunks) { + addChildIdsByOrdersToMap(chunk); + } + } + + for (const chunk of this.getAllAsyncChunks()) { + addChildIdsByOrdersToMap(chunk); + } + + return chunkMaps; + } +} + +module.exports = Chunk; /***/ }), -/***/ 62471: +/***/ 64971: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -30751,2242 +26235,1731 @@ module.exports = ContextModule; -const asyncLib = __webpack_require__(78175); -const { AsyncSeriesWaterfallHook, SyncWaterfallHook } = __webpack_require__(6967); -const ContextModule = __webpack_require__(76729); -const ModuleFactory = __webpack_require__(51010); -const ContextElementDependency = __webpack_require__(58477); -const LazySet = __webpack_require__(38938); -const { cachedSetProperty } = __webpack_require__(60839); -const { createFakeHook } = __webpack_require__(64518); -const { join } = __webpack_require__(17139); +const util = __webpack_require__(73837); +const Entrypoint = __webpack_require__(13795); +const ModuleGraphConnection = __webpack_require__(40639); +const { first } = __webpack_require__(93347); +const SortableSet = __webpack_require__(13098); +const { + compareModulesById, + compareIterables, + compareModulesByIdentifier, + concatComparators, + compareSelect, + compareIds +} = __webpack_require__(29579); +const createHash = __webpack_require__(49835); +const findGraphRoots = __webpack_require__(6261); +const { + RuntimeSpecMap, + RuntimeSpecSet, + runtimeToString, + mergeRuntime, + forEachRuntime +} = __webpack_require__(17156); -/** @typedef {import("./ContextModule").ContextModuleOptions} ContextModuleOptions */ -/** @typedef {import("./ContextModule").ResolveDependenciesCallback} ResolveDependenciesCallback */ +/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./ChunkGroup")} ChunkGroup */ /** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ -/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ -/** @typedef {import("./ResolverFactory")} ResolverFactory */ -/** @typedef {import("./dependencies/ContextDependency")} ContextDependency */ -/** @template T @typedef {import("./util/deprecation").FakeHook} FakeHook */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ - -const EMPTY_RESOLVE_OPTIONS = {}; +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./RuntimeModule")} RuntimeModule */ +/** @typedef {typeof import("./util/Hash")} Hash */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ -module.exports = class ContextModuleFactory extends ModuleFactory { - /** - * @param {ResolverFactory} resolverFactory resolverFactory - */ - constructor(resolverFactory) { - super(); - /** @type {AsyncSeriesWaterfallHook<[TODO[], ContextModuleOptions]>} */ - const alternativeRequests = new AsyncSeriesWaterfallHook([ - "modules", - "options" - ]); - this.hooks = Object.freeze({ - /** @type {AsyncSeriesWaterfallHook<[TODO]>} */ - beforeResolve: new AsyncSeriesWaterfallHook(["data"]), - /** @type {AsyncSeriesWaterfallHook<[TODO]>} */ - afterResolve: new AsyncSeriesWaterfallHook(["data"]), - /** @type {SyncWaterfallHook<[string[]]>} */ - contextModuleFiles: new SyncWaterfallHook(["files"]), - /** @type {FakeHook, "tap" | "tapAsync" | "tapPromise" | "name">>} */ - alternatives: createFakeHook( - { - name: "alternatives", - /** @type {AsyncSeriesWaterfallHook<[TODO[]]>["intercept"]} */ - intercept: interceptor => { - throw new Error( - "Intercepting fake hook ContextModuleFactory.hooks.alternatives is not possible, use ContextModuleFactory.hooks.alternativeRequests instead" - ); - }, - /** @type {AsyncSeriesWaterfallHook<[TODO[]]>["tap"]} */ - tap: (options, fn) => { - alternativeRequests.tap(options, fn); - }, - /** @type {AsyncSeriesWaterfallHook<[TODO[]]>["tapAsync"]} */ - tapAsync: (options, fn) => { - alternativeRequests.tapAsync(options, (items, _options, callback) => - fn(items, callback) - ); - }, - /** @type {AsyncSeriesWaterfallHook<[TODO[]]>["tapPromise"]} */ - tapPromise: (options, fn) => { - alternativeRequests.tapPromise(options, fn); - } - }, - "ContextModuleFactory.hooks.alternatives has deprecated in favor of ContextModuleFactory.hooks.alternativeRequests with an additional options argument.", - "DEP_WEBPACK_CONTEXT_MODULE_FACTORY_ALTERNATIVES" - ), - alternativeRequests - }); - this.resolverFactory = resolverFactory; - } +/** @type {ReadonlySet} */ +const EMPTY_SET = new Set(); - /** - * @param {ModuleFactoryCreateData} data data object - * @param {function(Error=, ModuleFactoryResult=): void} callback callback - * @returns {void} - */ - create(data, callback) { - const context = data.context; - const dependencies = data.dependencies; - const resolveOptions = data.resolveOptions; - const dependency = /** @type {ContextDependency} */ (dependencies[0]); - const fileDependencies = new LazySet(); - const missingDependencies = new LazySet(); - const contextDependencies = new LazySet(); - this.hooks.beforeResolve.callAsync( - { - context: context, - dependencies: dependencies, - resolveOptions, - fileDependencies, - missingDependencies, - contextDependencies, - ...dependency.options - }, - (err, beforeResolveResult) => { - if (err) { - return callback(err, { - fileDependencies, - missingDependencies, - contextDependencies - }); - } +const ZERO_BIG_INT = BigInt(0); - // Ignored - if (!beforeResolveResult) { - return callback(null, { - fileDependencies, - missingDependencies, - contextDependencies - }); - } +const compareModuleIterables = compareIterables(compareModulesByIdentifier); - const context = beforeResolveResult.context; - const request = beforeResolveResult.request; - const resolveOptions = beforeResolveResult.resolveOptions; +/** @typedef {(c: Chunk, chunkGraph: ChunkGraph) => boolean} ChunkFilterPredicate */ +/** @typedef {(m: Module) => boolean} ModuleFilterPredicate */ +/** @typedef {[Module, Entrypoint | undefined]} EntryModuleWithChunkGroup */ - let loaders, - resource, - loadersPrefix = ""; - const idx = request.lastIndexOf("!"); - if (idx >= 0) { - let loadersRequest = request.substr(0, idx + 1); - let i; - for ( - i = 0; - i < loadersRequest.length && loadersRequest[i] === "!"; - i++ - ) { - loadersPrefix += "!"; - } - loadersRequest = loadersRequest - .substr(i) - .replace(/!+$/, "") - .replace(/!!+/g, "!"); - if (loadersRequest === "") { - loaders = []; - } else { - loaders = loadersRequest.split("!"); - } - resource = request.substr(idx + 1); - } else { - loaders = []; - resource = request; - } +/** + * @typedef {Object} ChunkSizeOptions + * @property {number=} chunkOverhead constant overhead for a chunk + * @property {number=} entryChunkMultiplicator multiplicator for initial chunks + */ - const contextResolver = this.resolverFactory.get( - "context", - dependencies.length > 0 - ? cachedSetProperty( - resolveOptions || EMPTY_RESOLVE_OPTIONS, - "dependencyType", - dependencies[0].category - ) - : resolveOptions - ); - const loaderResolver = this.resolverFactory.get("loader"); +class ModuleHashInfo { + constructor(hash, renderedHash) { + this.hash = hash; + this.renderedHash = renderedHash; + } +} - asyncLib.parallel( - [ - callback => { - contextResolver.resolve( - {}, - context, - resource, - { - fileDependencies, - missingDependencies, - contextDependencies - }, - (err, result) => { - if (err) return callback(err); - callback(null, result); - } - ); - }, - callback => { - asyncLib.map( - loaders, - (loader, callback) => { - loaderResolver.resolve( - {}, - context, - loader, - { - fileDependencies, - missingDependencies, - contextDependencies - }, - (err, result) => { - if (err) return callback(err); - callback(null, result); - } - ); - }, - callback - ); - } - ], - (err, result) => { - if (err) { - return callback(err, { - fileDependencies, - missingDependencies, - contextDependencies - }); - } +/** @template T @typedef {(set: SortableSet) => T[]} SetToArrayFunction */ - this.hooks.afterResolve.callAsync( - { - addon: - loadersPrefix + - result[1].join("!") + - (result[1].length > 0 ? "!" : ""), - resource: result[0], - resolveDependencies: this.resolveDependencies.bind(this), - ...beforeResolveResult - }, - (err, result) => { - if (err) { - return callback(err, { - fileDependencies, - missingDependencies, - contextDependencies - }); - } +/** + * @template T + * @param {SortableSet} set the set + * @returns {T[]} set as array + */ +const getArray = set => { + return Array.from(set); +}; - // Ignored - if (!result) { - return callback(null, { - fileDependencies, - missingDependencies, - contextDependencies - }); - } +/** + * @param {SortableSet} chunks the chunks + * @returns {RuntimeSpecSet} runtimes + */ +const getModuleRuntimes = chunks => { + const runtimes = new RuntimeSpecSet(); + for (const chunk of chunks) { + runtimes.add(chunk.runtime); + } + return runtimes; +}; - return callback(null, { - module: new ContextModule(result.resolveDependencies, result), - fileDependencies, - missingDependencies, - contextDependencies - }); - } - ); - } - ); +/** + * @param {SortableSet} set the set + * @returns {Map>} modules by source type + */ +const modulesBySourceType = set => { + /** @type {Map>} */ + const map = new Map(); + for (const module of set) { + for (const sourceType of module.getSourceTypes()) { + let innerSet = map.get(sourceType); + if (innerSet === undefined) { + innerSet = new SortableSet(); + map.set(sourceType, innerSet); } - ); + innerSet.add(module); + } + } + for (const [key, innerSet] of map) { + // When all modules have the source type, we reuse the original SortableSet + // to benefit from the shared cache (especially for sorting) + if (innerSet.size === set.size) { + map.set(key, set); + } } + return map; +}; - /** - * @param {InputFileSystem} fs file system - * @param {ContextModuleOptions} options options - * @param {ResolveDependenciesCallback} callback callback function - * @returns {void} - */ - resolveDependencies(fs, options, callback) { - const cmf = this; - const { - resource, - resourceQuery, - resourceFragment, - recursive, - regExp, - include, - exclude, - referencedExports, - category, - typePrefix - } = options; - if (!regExp || !resource) return callback(null, []); +/** @type {WeakMap} */ +const createOrderedArrayFunctionMap = new WeakMap(); - const addDirectoryChecked = (directory, visited, callback) => { - fs.realpath(directory, (err, realPath) => { - if (err) return callback(err); - if (visited.has(realPath)) return callback(null, []); - let recursionStack; - addDirectory( - directory, - (dir, callback) => { - if (recursionStack === undefined) { - recursionStack = new Set(visited); - recursionStack.add(realPath); - } - addDirectoryChecked(dir, recursionStack, callback); - }, - callback - ); - }); - }; +/** + * @template T + * @param {function(T, T): -1|0|1} comparator comparator function + * @returns {SetToArrayFunction} set as ordered array + */ +const createOrderedArrayFunction = comparator => { + /** @type {SetToArrayFunction} */ + let fn = createOrderedArrayFunctionMap.get(comparator); + if (fn !== undefined) return fn; + fn = set => { + set.sortWith(comparator); + return Array.from(set); + }; + createOrderedArrayFunctionMap.set(comparator, fn); + return fn; +}; - const addDirectory = (directory, addSubDirectory, callback) => { - fs.readdir(directory, (err, files) => { - if (err) return callback(err); - const processedFiles = cmf.hooks.contextModuleFiles.call( - /** @type {string[]} */ (files).map(file => file.normalize("NFC")) - ); - if (!processedFiles || processedFiles.length === 0) - return callback(null, []); - asyncLib.map( - processedFiles.filter(p => p.indexOf(".") !== 0), - (segment, callback) => { - const subResource = join(fs, directory, segment); +/** + * @param {Iterable} modules the modules to get the count/size of + * @returns {number} the size of the modules + */ +const getModulesSize = modules => { + let size = 0; + for (const module of modules) { + for (const type of module.getSourceTypes()) { + size += module.size(type); + } + } + return size; +}; - if (!exclude || !subResource.match(exclude)) { - fs.stat(subResource, (err, stat) => { - if (err) { - if (err.code === "ENOENT") { - // ENOENT is ok here because the file may have been deleted between - // the readdir and stat calls. - return callback(); - } else { - return callback(err); - } - } +/** + * @param {Iterable} modules the sortable Set to get the size of + * @returns {Record} the sizes of the modules + */ +const getModulesSizes = modules => { + let sizes = Object.create(null); + for (const module of modules) { + for (const type of module.getSourceTypes()) { + sizes[type] = (sizes[type] || 0) + module.size(type); + } + } + return sizes; +}; - if (stat.isDirectory()) { - if (!recursive) return callback(); - addSubDirectory(subResource, callback); - } else if ( - stat.isFile() && - (!include || subResource.match(include)) - ) { - const obj = { - context: resource, - request: - "." + - subResource.substr(resource.length).replace(/\\/g, "/") - }; - - this.hooks.alternativeRequests.callAsync( - [obj], - options, - (err, alternatives) => { - if (err) return callback(err); - alternatives = alternatives - .filter(obj => regExp.test(obj.request)) - .map(obj => { - const dep = new ContextElementDependency( - obj.request + resourceQuery + resourceFragment, - obj.request, - typePrefix, - category, - referencedExports - ); - dep.optional = true; - return dep; - }); - callback(null, alternatives); - } - ); - } else { - callback(); - } - }); - } else { - callback(); - } - }, - (err, result) => { - if (err) return callback(err); - - if (!result) return callback(null, []); - - const flattenedResult = []; - - for (const item of result) { - if (item) flattenedResult.push(...item); - } - - callback(null, flattenedResult); - } - ); - }); - }; - - if (typeof fs.realpath === "function") { - addDirectoryChecked(resource, new Set(), callback); - } else { - const addSubDirectory = (dir, callback) => - addDirectory(dir, addSubDirectory, callback); - addDirectory(resource, addSubDirectory, callback); +/** + * @param {Chunk} a chunk + * @param {Chunk} b chunk + * @returns {boolean} true, if a is always a parent of b + */ +const isAvailableChunk = (a, b) => { + const queue = new Set(b.groupsIterable); + for (const chunkGroup of queue) { + if (a.isInGroup(chunkGroup)) continue; + if (chunkGroup.isInitial()) return false; + for (const parent of chunkGroup.parentsIterable) { + queue.add(parent); } } + return true; }; +class ChunkGraphModule { + constructor() { + /** @type {SortableSet} */ + this.chunks = new SortableSet(); + /** @type {Set | undefined} */ + this.entryInChunks = undefined; + /** @type {Set | undefined} */ + this.runtimeInChunks = undefined; + /** @type {RuntimeSpecMap} */ + this.hashes = undefined; + /** @type {string | number} */ + this.id = null; + /** @type {RuntimeSpecMap> | undefined} */ + this.runtimeRequirements = undefined; + /** @type {RuntimeSpecMap} */ + this.graphHashes = undefined; + /** @type {RuntimeSpecMap} */ + this.graphHashesWithConnections = undefined; + } +} -/***/ }), - -/***/ 12206: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - +class ChunkGraphChunk { + constructor() { + /** @type {SortableSet} */ + this.modules = new SortableSet(); + /** @type {Map} */ + this.entryModules = new Map(); + /** @type {SortableSet} */ + this.runtimeModules = new SortableSet(); + /** @type {Set | undefined} */ + this.fullHashModules = undefined; + /** @type {Set | undefined} */ + this.dependentHashModules = undefined; + /** @type {Set | undefined} */ + this.runtimeRequirements = undefined; + /** @type {Set} */ + this.runtimeRequirementsInTree = new Set(); + } +} +class ChunkGraph { + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {string | Hash} hashFunction the hash function to use + */ + constructor(moduleGraph, hashFunction = "md4") { + /** @private @type {WeakMap} */ + this._modules = new WeakMap(); + /** @private @type {WeakMap} */ + this._chunks = new WeakMap(); + /** @private @type {WeakMap} */ + this._blockChunkGroups = new WeakMap(); + /** @private @type {Map} */ + this._runtimeIds = new Map(); + /** @type {ModuleGraph} */ + this.moduleGraph = moduleGraph; -const ContextElementDependency = __webpack_require__(58477); -const { join } = __webpack_require__(17139); + this._hashFunction = hashFunction; -class ContextReplacementPlugin { - constructor( - resourceRegExp, - newContentResource, - newContentRecursive, - newContentRegExp - ) { - this.resourceRegExp = resourceRegExp; + this._getGraphRoots = this._getGraphRoots.bind(this); + } - if (typeof newContentResource === "function") { - this.newContentCallback = newContentResource; - } else if ( - typeof newContentResource === "string" && - typeof newContentRecursive === "object" - ) { - this.newContentResource = newContentResource; - this.newContentCreateContextMap = (fs, callback) => { - callback(null, newContentRecursive); - }; - } else if ( - typeof newContentResource === "string" && - typeof newContentRecursive === "function" - ) { - this.newContentResource = newContentResource; - this.newContentCreateContextMap = newContentRecursive; - } else { - if (typeof newContentResource !== "string") { - newContentRegExp = newContentRecursive; - newContentRecursive = newContentResource; - newContentResource = undefined; - } - if (typeof newContentRecursive !== "boolean") { - newContentRegExp = newContentRecursive; - newContentRecursive = undefined; - } - this.newContentResource = newContentResource; - this.newContentRecursive = newContentRecursive; - this.newContentRegExp = newContentRegExp; + /** + * @private + * @param {Module} module the module + * @returns {ChunkGraphModule} internal module + */ + _getChunkGraphModule(module) { + let cgm = this._modules.get(module); + if (cgm === undefined) { + cgm = new ChunkGraphModule(); + this._modules.set(module, cgm); } + return cgm; } - apply(compiler) { - const resourceRegExp = this.resourceRegExp; - const newContentCallback = this.newContentCallback; - const newContentResource = this.newContentResource; - const newContentRecursive = this.newContentRecursive; - const newContentRegExp = this.newContentRegExp; - const newContentCreateContextMap = this.newContentCreateContextMap; + /** + * @private + * @param {Chunk} chunk the chunk + * @returns {ChunkGraphChunk} internal chunk + */ + _getChunkGraphChunk(chunk) { + let cgc = this._chunks.get(chunk); + if (cgc === undefined) { + cgc = new ChunkGraphChunk(); + this._chunks.set(chunk, cgc); + } + return cgc; + } - compiler.hooks.contextModuleFactory.tap("ContextReplacementPlugin", cmf => { - cmf.hooks.beforeResolve.tap("ContextReplacementPlugin", result => { - if (!result) return; - if (resourceRegExp.test(result.request)) { - if (newContentResource !== undefined) { - result.request = newContentResource; - } - if (newContentRecursive !== undefined) { - result.recursive = newContentRecursive; - } - if (newContentRegExp !== undefined) { - result.regExp = newContentRegExp; - } - if (typeof newContentCallback === "function") { - newContentCallback(result); - } else { - for (const d of result.dependencies) { - if (d.critical) d.critical = false; - } - } - } - return result; - }); - cmf.hooks.afterResolve.tap("ContextReplacementPlugin", result => { - if (!result) return; - if (resourceRegExp.test(result.resource)) { - if (newContentResource !== undefined) { - if ( - newContentResource.startsWith("/") || - (newContentResource.length > 1 && newContentResource[1] === ":") - ) { - result.resource = newContentResource; - } else { - result.resource = join( - compiler.inputFileSystem, - result.resource, - newContentResource - ); - } - } - if (newContentRecursive !== undefined) { - result.recursive = newContentRecursive; - } - if (newContentRegExp !== undefined) { - result.regExp = newContentRegExp; - } - if (typeof newContentCreateContextMap === "function") { - result.resolveDependencies = - createResolveDependenciesFromContextMap( - newContentCreateContextMap - ); - } - if (typeof newContentCallback === "function") { - const origResource = result.resource; - newContentCallback(result); - if ( - result.resource !== origResource && - !result.resource.startsWith("/") && - (result.resource.length <= 1 || result.resource[1] !== ":") - ) { - // When the function changed it to an relative path - result.resource = join( - compiler.inputFileSystem, - origResource, - result.resource - ); - } - } else { - for (const d of result.dependencies) { - if (d.critical) d.critical = false; + /** + * @param {SortableSet} set the sortable Set to get the roots of + * @returns {Module[]} the graph roots + */ + _getGraphRoots(set) { + const { moduleGraph } = this; + return Array.from( + findGraphRoots(set, module => { + /** @type {Set} */ + const set = new Set(); + const addDependencies = module => { + for (const connection of moduleGraph.getOutgoingConnections(module)) { + if (!connection.module) continue; + const activeState = connection.getActiveState(undefined); + if (activeState === false) continue; + if (activeState === ModuleGraphConnection.TRANSITIVE_ONLY) { + addDependencies(connection.module); + continue; } + set.add(connection.module); } - } - return result; - }); - }); + }; + addDependencies(module); + return set; + }) + ).sort(compareModulesByIdentifier); } -} - -const createResolveDependenciesFromContextMap = createContextMap => { - const resolveDependenciesFromContextMap = (fs, options, callback) => { - createContextMap(fs, (err, map) => { - if (err) return callback(err); - const dependencies = Object.keys(map).map(key => { - return new ContextElementDependency( - map[key] + options.resourceQuery + options.resourceFragment, - key, - options.category, - options.referencedExports - ); - }); - callback(null, dependencies); - }); - }; - return resolveDependenciesFromContextMap; -}; - -module.exports = ContextReplacementPlugin; - - -/***/ }), - -/***/ 79065: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const WebpackError = __webpack_require__(53799); -const ConstDependency = __webpack_require__(76911); -const BasicEvaluatedExpression = __webpack_require__(950); -const { - evaluateToString, - toConstantDependency -} = __webpack_require__(93998); -const createHash = __webpack_require__(49835); - -/** @typedef {import("estree").Expression} Expression */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./NormalModule")} NormalModule */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ -/** @typedef {null|undefined|RegExp|Function|string|number|boolean|bigint|undefined} CodeValuePrimitive */ -/** @typedef {RecursiveArrayOrRecord} CodeValue */ + /** + * @param {Chunk} chunk the new chunk + * @param {Module} module the module + * @returns {void} + */ + connectChunkAndModule(chunk, module) { + const cgm = this._getChunkGraphModule(module); + const cgc = this._getChunkGraphChunk(chunk); + cgm.chunks.add(chunk); + cgc.modules.add(module); + } -/** - * @typedef {Object} RuntimeValueOptions - * @property {string[]=} fileDependencies - * @property {string[]=} contextDependencies - * @property {string[]=} missingDependencies - * @property {string[]=} buildDependencies - * @property {string|function(): string=} version - */ + /** + * @param {Chunk} chunk the chunk + * @param {Module} module the module + * @returns {void} + */ + disconnectChunkAndModule(chunk, module) { + const cgm = this._getChunkGraphModule(module); + const cgc = this._getChunkGraphChunk(chunk); + cgc.modules.delete(module); + cgm.chunks.delete(chunk); + } -class RuntimeValue { /** - * @param {function({ module: NormalModule, key: string, readonly version: string | undefined }): CodeValuePrimitive} fn generator function - * @param {true | string[] | RuntimeValueOptions=} options options + * @param {Chunk} chunk the chunk which will be disconnected + * @returns {void} */ - constructor(fn, options) { - this.fn = fn; - if (Array.isArray(options)) { - options = { - fileDependencies: options - }; + disconnectChunk(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + for (const module of cgc.modules) { + const cgm = this._getChunkGraphModule(module); + cgm.chunks.delete(chunk); } - this.options = options || {}; + cgc.modules.clear(); + chunk.disconnectFromGroups(); + ChunkGraph.clearChunkGraphForChunk(chunk); } - get fileDependencies() { - return this.options === true ? true : this.options.fileDependencies; + /** + * @param {Chunk} chunk the chunk + * @param {Iterable} modules the modules + * @returns {void} + */ + attachModules(chunk, modules) { + const cgc = this._getChunkGraphChunk(chunk); + for (const module of modules) { + cgc.modules.add(module); + } } /** - * @param {JavascriptParser} parser the parser - * @param {Map>} valueCacheVersions valueCacheVersions - * @param {string} key the defined key - * @returns {CodeValuePrimitive} code + * @param {Chunk} chunk the chunk + * @param {Iterable} modules the runtime modules + * @returns {void} */ - exec(parser, valueCacheVersions, key) { - const buildInfo = parser.state.module.buildInfo; - if (this.options === true) { - buildInfo.cacheable = false; - } else { - if (this.options.fileDependencies) { - for (const dep of this.options.fileDependencies) { - buildInfo.fileDependencies.add(dep); - } - } - if (this.options.contextDependencies) { - for (const dep of this.options.contextDependencies) { - buildInfo.contextDependencies.add(dep); - } - } - if (this.options.missingDependencies) { - for (const dep of this.options.missingDependencies) { - buildInfo.missingDependencies.add(dep); - } - } - if (this.options.buildDependencies) { - for (const dep of this.options.buildDependencies) { - buildInfo.buildDependencies.add(dep); - } - } + attachRuntimeModules(chunk, modules) { + const cgc = this._getChunkGraphChunk(chunk); + for (const module of modules) { + cgc.runtimeModules.add(module); } + } - return this.fn({ - module: parser.state.module, - key, - get version() { - return /** @type {string} */ ( - valueCacheVersions.get(VALUE_DEP_PREFIX + key) - ); - } - }); + /** + * @param {Chunk} chunk the chunk + * @param {Iterable} modules the modules that require a full hash + * @returns {void} + */ + attachFullHashModules(chunk, modules) { + const cgc = this._getChunkGraphChunk(chunk); + if (cgc.fullHashModules === undefined) cgc.fullHashModules = new Set(); + for (const module of modules) { + cgc.fullHashModules.add(module); + } } - getCacheVersion() { - return this.options === true - ? undefined - : (typeof this.options.version === "function" - ? this.options.version() - : this.options.version) || "unset"; + /** + * @param {Chunk} chunk the chunk + * @param {Iterable} modules the modules that require a full hash + * @returns {void} + */ + attachDependentHashModules(chunk, modules) { + const cgc = this._getChunkGraphChunk(chunk); + if (cgc.dependentHashModules === undefined) + cgc.dependentHashModules = new Set(); + for (const module of modules) { + cgc.dependentHashModules.add(module); + } } -} -/** - * @param {any[]|{[k: string]: any}} obj obj - * @param {JavascriptParser} parser Parser - * @param {Map>} valueCacheVersions valueCacheVersions - * @param {string} key the defined key - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @param {boolean|undefined|null=} asiSafe asi safe (undefined: unknown, null: unneeded) - * @returns {string} code converted to string that evaluates - */ -const stringifyObj = ( - obj, - parser, - valueCacheVersions, - key, - runtimeTemplate, - asiSafe -) => { - let code; - let arr = Array.isArray(obj); - if (arr) { - code = `[${obj - .map(code => - toCode(code, parser, valueCacheVersions, key, runtimeTemplate, null) - ) - .join(",")}]`; - } else { - code = `{${Object.keys(obj) - .map(key => { - const code = obj[key]; - return ( - JSON.stringify(key) + - ":" + - toCode(code, parser, valueCacheVersions, key, runtimeTemplate, null) - ); - }) - .join(",")}}`; - } + /** + * @param {Module} oldModule the replaced module + * @param {Module} newModule the replacing module + * @returns {void} + */ + replaceModule(oldModule, newModule) { + const oldCgm = this._getChunkGraphModule(oldModule); + const newCgm = this._getChunkGraphModule(newModule); - switch (asiSafe) { - case null: - return code; - case true: - return arr ? code : `(${code})`; - case false: - return arr ? `;${code}` : `;(${code})`; - default: - return `/*#__PURE__*/Object(${code})`; - } -}; + for (const chunk of oldCgm.chunks) { + const cgc = this._getChunkGraphChunk(chunk); + cgc.modules.delete(oldModule); + cgc.modules.add(newModule); + newCgm.chunks.add(chunk); + } + oldCgm.chunks.clear(); -/** - * Convert code to a string that evaluates - * @param {CodeValue} code Code to evaluate - * @param {JavascriptParser} parser Parser - * @param {Map>} valueCacheVersions valueCacheVersions - * @param {string} key the defined key - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @param {boolean|undefined|null=} asiSafe asi safe (undefined: unknown, null: unneeded) - * @returns {string} code converted to string that evaluates - */ -const toCode = ( - code, - parser, - valueCacheVersions, - key, - runtimeTemplate, - asiSafe -) => { - if (code === null) { - return "null"; - } - if (code === undefined) { - return "undefined"; + if (oldCgm.entryInChunks !== undefined) { + if (newCgm.entryInChunks === undefined) { + newCgm.entryInChunks = new Set(); + } + for (const chunk of oldCgm.entryInChunks) { + const cgc = this._getChunkGraphChunk(chunk); + const old = cgc.entryModules.get(oldModule); + /** @type {Map} */ + const newEntryModules = new Map(); + for (const [m, cg] of cgc.entryModules) { + if (m === oldModule) { + newEntryModules.set(newModule, old); + } else { + newEntryModules.set(m, cg); + } + } + cgc.entryModules = newEntryModules; + newCgm.entryInChunks.add(chunk); + } + oldCgm.entryInChunks = undefined; + } + + if (oldCgm.runtimeInChunks !== undefined) { + if (newCgm.runtimeInChunks === undefined) { + newCgm.runtimeInChunks = new Set(); + } + for (const chunk of oldCgm.runtimeInChunks) { + const cgc = this._getChunkGraphChunk(chunk); + cgc.runtimeModules.delete(/** @type {RuntimeModule} */ (oldModule)); + cgc.runtimeModules.add(/** @type {RuntimeModule} */ (newModule)); + newCgm.runtimeInChunks.add(chunk); + if ( + cgc.fullHashModules !== undefined && + cgc.fullHashModules.has(/** @type {RuntimeModule} */ (oldModule)) + ) { + cgc.fullHashModules.delete(/** @type {RuntimeModule} */ (oldModule)); + cgc.fullHashModules.add(/** @type {RuntimeModule} */ (newModule)); + } + if ( + cgc.dependentHashModules !== undefined && + cgc.dependentHashModules.has(/** @type {RuntimeModule} */ (oldModule)) + ) { + cgc.dependentHashModules.delete( + /** @type {RuntimeModule} */ (oldModule) + ); + cgc.dependentHashModules.add( + /** @type {RuntimeModule} */ (newModule) + ); + } + } + oldCgm.runtimeInChunks = undefined; + } } - if (Object.is(code, -0)) { - return "-0"; + + /** + * @param {Module} module the checked module + * @param {Chunk} chunk the checked chunk + * @returns {boolean} true, if the chunk contains the module + */ + isModuleInChunk(module, chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.modules.has(module); } - if (code instanceof RuntimeValue) { - return toCode( - code.exec(parser, valueCacheVersions, key), - parser, - valueCacheVersions, - key, - runtimeTemplate, - asiSafe - ); + + /** + * @param {Module} module the checked module + * @param {ChunkGroup} chunkGroup the checked chunk group + * @returns {boolean} true, if the chunk contains the module + */ + isModuleInChunkGroup(module, chunkGroup) { + for (const chunk of chunkGroup.chunks) { + if (this.isModuleInChunk(module, chunk)) return true; + } + return false; } - if (code instanceof RegExp && code.toString) { - return code.toString(); + + /** + * @param {Module} module the checked module + * @returns {boolean} true, if the module is entry of any chunk + */ + isEntryModule(module) { + const cgm = this._getChunkGraphModule(module); + return cgm.entryInChunks !== undefined; } - if (typeof code === "function" && code.toString) { - return "(" + code.toString() + ")"; + + /** + * @param {Module} module the module + * @returns {Iterable} iterable of chunks (do not modify) + */ + getModuleChunksIterable(module) { + const cgm = this._getChunkGraphModule(module); + return cgm.chunks; } - if (typeof code === "object") { - return stringifyObj( - code, - parser, - valueCacheVersions, - key, - runtimeTemplate, - asiSafe - ); + + /** + * @param {Module} module the module + * @param {function(Chunk, Chunk): -1|0|1} sortFn sort function + * @returns {Iterable} iterable of chunks (do not modify) + */ + getOrderedModuleChunksIterable(module, sortFn) { + const cgm = this._getChunkGraphModule(module); + cgm.chunks.sortWith(sortFn); + return cgm.chunks; } - if (typeof code === "bigint") { - return runtimeTemplate.supportsBigIntLiteral() - ? `${code}n` - : `BigInt("${code}")`; + + /** + * @param {Module} module the module + * @returns {Chunk[]} array of chunks (cached, do not modify) + */ + getModuleChunks(module) { + const cgm = this._getChunkGraphModule(module); + return cgm.chunks.getFromCache(getArray); } - return code + ""; -}; -const toCacheVersion = code => { - if (code === null) { - return "null"; + /** + * @param {Module} module the module + * @returns {number} the number of chunk which contain the module + */ + getNumberOfModuleChunks(module) { + const cgm = this._getChunkGraphModule(module); + return cgm.chunks.size; } - if (code === undefined) { - return "undefined"; + + /** + * @param {Module} module the module + * @returns {RuntimeSpecSet} runtimes + */ + getModuleRuntimes(module) { + const cgm = this._getChunkGraphModule(module); + return cgm.chunks.getFromUnorderedCache(getModuleRuntimes); } - if (Object.is(code, -0)) { - return "-0"; + + /** + * @param {Chunk} chunk the chunk + * @returns {number} the number of modules which are contained in this chunk + */ + getNumberOfChunkModules(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.modules.size; } - if (code instanceof RuntimeValue) { - return code.getCacheVersion(); + + /** + * @param {Chunk} chunk the chunk + * @returns {number} the number of full hash modules which are contained in this chunk + */ + getNumberOfChunkFullHashModules(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.fullHashModules === undefined ? 0 : cgc.fullHashModules.size; } - if (code instanceof RegExp && code.toString) { - return code.toString(); + + /** + * @param {Chunk} chunk the chunk + * @returns {Iterable} return the modules for this chunk + */ + getChunkModulesIterable(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.modules; } - if (typeof code === "function" && code.toString) { - return "(" + code.toString() + ")"; + + /** + * @param {Chunk} chunk the chunk + * @param {string} sourceType source type + * @returns {Iterable | undefined} return the modules for this chunk + */ + getChunkModulesIterableBySourceType(chunk, sourceType) { + const cgc = this._getChunkGraphChunk(chunk); + const modulesWithSourceType = cgc.modules + .getFromUnorderedCache(modulesBySourceType) + .get(sourceType); + return modulesWithSourceType; } - if (typeof code === "object") { - const items = Object.keys(code).map(key => ({ - key, - value: toCacheVersion(code[key]) - })); - if (items.some(({ value }) => value === undefined)) return undefined; - return `{${items.map(({ key, value }) => `${key}: ${value}`).join(", ")}}`; + + /** + * @param {Chunk} chunk the chunk + * @param {function(Module, Module): -1|0|1} comparator comparator function + * @returns {Iterable} return the modules for this chunk + */ + getOrderedChunkModulesIterable(chunk, comparator) { + const cgc = this._getChunkGraphChunk(chunk); + cgc.modules.sortWith(comparator); + return cgc.modules; } - if (typeof code === "bigint") { - return `${code}n`; + + /** + * @param {Chunk} chunk the chunk + * @param {string} sourceType source type + * @param {function(Module, Module): -1|0|1} comparator comparator function + * @returns {Iterable | undefined} return the modules for this chunk + */ + getOrderedChunkModulesIterableBySourceType(chunk, sourceType, comparator) { + const cgc = this._getChunkGraphChunk(chunk); + const modulesWithSourceType = cgc.modules + .getFromUnorderedCache(modulesBySourceType) + .get(sourceType); + if (modulesWithSourceType === undefined) return undefined; + modulesWithSourceType.sortWith(comparator); + return modulesWithSourceType; } - return code + ""; -}; -const VALUE_DEP_PREFIX = "webpack/DefinePlugin "; -const VALUE_DEP_MAIN = "webpack/DefinePlugin_hash"; + /** + * @param {Chunk} chunk the chunk + * @returns {Module[]} return the modules for this chunk (cached, do not modify) + */ + getChunkModules(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.modules.getFromUnorderedCache(getArray); + } -class DefinePlugin { /** - * Create a new define plugin - * @param {Record} definitions A map of global object definitions + * @param {Chunk} chunk the chunk + * @param {function(Module, Module): -1|0|1} comparator comparator function + * @returns {Module[]} return the modules for this chunk (cached, do not modify) */ - constructor(definitions) { - this.definitions = definitions; + getOrderedChunkModules(chunk, comparator) { + const cgc = this._getChunkGraphChunk(chunk); + const arrayFunction = createOrderedArrayFunction(comparator); + return cgc.modules.getFromUnorderedCache(arrayFunction); } /** - * @param {function({ module: NormalModule, key: string, readonly version: string | undefined }): CodeValuePrimitive} fn generator function - * @param {true | string[] | RuntimeValueOptions=} options options - * @returns {RuntimeValue} runtime value + * @param {Chunk} chunk the chunk + * @param {ModuleFilterPredicate} filterFn function used to filter modules + * @param {boolean} includeAllChunks all chunks or only async chunks + * @returns {Record} chunk to module ids object */ - static runtimeValue(fn, options) { - return new RuntimeValue(fn, options); + getChunkModuleIdMap(chunk, filterFn, includeAllChunks = false) { + /** @type {Record} */ + const chunkModuleIdMap = Object.create(null); + + for (const asyncChunk of includeAllChunks + ? chunk.getAllReferencedChunks() + : chunk.getAllAsyncChunks()) { + /** @type {(string|number)[]} */ + let array; + for (const module of this.getOrderedChunkModulesIterable( + asyncChunk, + compareModulesById(this) + )) { + if (filterFn(module)) { + if (array === undefined) { + array = []; + chunkModuleIdMap[asyncChunk.id] = array; + } + const moduleId = this.getModuleId(module); + array.push(moduleId); + } + } + } + + return chunkModuleIdMap; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {Chunk} chunk the chunk + * @param {ModuleFilterPredicate} filterFn function used to filter modules + * @param {number} hashLength length of the hash + * @param {boolean} includeAllChunks all chunks or only async chunks + * @returns {Record>} chunk to module id to module hash object */ - apply(compiler) { - const definitions = this.definitions; - compiler.hooks.compilation.tap( - "DefinePlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyTemplates.set( - ConstDependency, - new ConstDependency.Template() - ); - const { runtimeTemplate } = compilation; + getChunkModuleRenderedHashMap( + chunk, + filterFn, + hashLength = 0, + includeAllChunks = false + ) { + /** @type {Record>} */ + const chunkModuleHashMap = Object.create(null); - const mainHash = createHash(compilation.outputOptions.hashFunction); - mainHash.update( - /** @type {string} */ ( - compilation.valueCacheVersions.get(VALUE_DEP_MAIN) - ) || "" - ); + for (const asyncChunk of includeAllChunks + ? chunk.getAllReferencedChunks() + : chunk.getAllAsyncChunks()) { + /** @type {Record} */ + let idToHashMap; + for (const module of this.getOrderedChunkModulesIterable( + asyncChunk, + compareModulesById(this) + )) { + if (filterFn(module)) { + if (idToHashMap === undefined) { + idToHashMap = Object.create(null); + chunkModuleHashMap[asyncChunk.id] = idToHashMap; + } + const moduleId = this.getModuleId(module); + const hash = this.getRenderedModuleHash(module, asyncChunk.runtime); + idToHashMap[moduleId] = hashLength ? hash.slice(0, hashLength) : hash; + } + } + } - /** - * Handler - * @param {JavascriptParser} parser Parser - * @returns {void} - */ - const handler = parser => { - const mainValue = compilation.valueCacheVersions.get(VALUE_DEP_MAIN); - parser.hooks.program.tap("DefinePlugin", () => { - const { buildInfo } = parser.state.module; - if (!buildInfo.valueDependencies) - buildInfo.valueDependencies = new Map(); - buildInfo.valueDependencies.set(VALUE_DEP_MAIN, mainValue); - }); + return chunkModuleHashMap; + } - const addValueDependency = key => { - const { buildInfo } = parser.state.module; - buildInfo.valueDependencies.set( - VALUE_DEP_PREFIX + key, - compilation.valueCacheVersions.get(VALUE_DEP_PREFIX + key) - ); - }; + /** + * @param {Chunk} chunk the chunk + * @param {ChunkFilterPredicate} filterFn function used to filter chunks + * @returns {Record} chunk map + */ + getChunkConditionMap(chunk, filterFn) { + const map = Object.create(null); + for (const c of chunk.getAllReferencedChunks()) { + map[c.id] = filterFn(c, this); + } + return map; + } - const withValueDependency = - (key, fn) => - (...args) => { - addValueDependency(key); - return fn(...args); - }; + /** + * @param {Chunk} chunk the chunk + * @param {ModuleFilterPredicate} filterFn predicate function used to filter modules + * @param {ChunkFilterPredicate=} filterChunkFn predicate function used to filter chunks + * @returns {boolean} return true if module exists in graph + */ + hasModuleInGraph(chunk, filterFn, filterChunkFn) { + const queue = new Set(chunk.groupsIterable); + const chunksProcessed = new Set(); - /** - * Walk definitions - * @param {Object} definitions Definitions map - * @param {string} prefix Prefix string - * @returns {void} - */ - const walkDefinitions = (definitions, prefix) => { - Object.keys(definitions).forEach(key => { - const code = definitions[key]; - if ( - code && - typeof code === "object" && - !(code instanceof RuntimeValue) && - !(code instanceof RegExp) - ) { - walkDefinitions(code, prefix + key + "."); - applyObjectDefine(prefix + key, code); - return; + for (const chunkGroup of queue) { + for (const innerChunk of chunkGroup.chunks) { + if (!chunksProcessed.has(innerChunk)) { + chunksProcessed.add(innerChunk); + if (!filterChunkFn || filterChunkFn(innerChunk, this)) { + for (const module of this.getChunkModulesIterable(innerChunk)) { + if (filterFn(module)) { + return true; } - applyDefineKey(prefix, key); - applyDefine(prefix + key, code); - }); - }; - - /** - * Apply define key - * @param {string} prefix Prefix - * @param {string} key Key - * @returns {void} - */ - const applyDefineKey = (prefix, key) => { - const splittedKey = key.split("."); - splittedKey.slice(1).forEach((_, i) => { - const fullKey = prefix + splittedKey.slice(0, i + 1).join("."); - parser.hooks.canRename.for(fullKey).tap("DefinePlugin", () => { - addValueDependency(key); - return true; - }); - }); - }; - - /** - * Apply Code - * @param {string} key Key - * @param {CodeValue} code Code - * @returns {void} - */ - const applyDefine = (key, code) => { - const originalKey = key; - const isTypeof = /^typeof\s+/.test(key); - if (isTypeof) key = key.replace(/^typeof\s+/, ""); - let recurse = false; - let recurseTypeof = false; - if (!isTypeof) { - parser.hooks.canRename.for(key).tap("DefinePlugin", () => { - addValueDependency(originalKey); - return true; - }); - parser.hooks.evaluateIdentifier - .for(key) - .tap("DefinePlugin", expr => { - /** - * this is needed in case there is a recursion in the DefinePlugin - * to prevent an endless recursion - * e.g.: new DefinePlugin({ - * "a": "b", - * "b": "a" - * }); - */ - if (recurse) return; - addValueDependency(originalKey); - recurse = true; - const res = parser.evaluate( - toCode( - code, - parser, - compilation.valueCacheVersions, - key, - runtimeTemplate, - null - ) - ); - recurse = false; - res.setRange(expr.range); - return res; - }); - parser.hooks.expression.for(key).tap("DefinePlugin", expr => { - addValueDependency(originalKey); - const strCode = toCode( - code, - parser, - compilation.valueCacheVersions, - originalKey, - runtimeTemplate, - !parser.isAsiPosition(expr.range[0]) - ); - if (/__webpack_require__\s*(!?\.)/.test(strCode)) { - return toConstantDependency(parser, strCode, [ - RuntimeGlobals.require - ])(expr); - } else if (/__webpack_require__/.test(strCode)) { - return toConstantDependency(parser, strCode, [ - RuntimeGlobals.requireScope - ])(expr); - } else { - return toConstantDependency(parser, strCode)(expr); - } - }); - } - parser.hooks.evaluateTypeof.for(key).tap("DefinePlugin", expr => { - /** - * this is needed in case there is a recursion in the DefinePlugin - * to prevent an endless recursion - * e.g.: new DefinePlugin({ - * "typeof a": "typeof b", - * "typeof b": "typeof a" - * }); - */ - if (recurseTypeof) return; - recurseTypeof = true; - addValueDependency(originalKey); - const codeCode = toCode( - code, - parser, - compilation.valueCacheVersions, - originalKey, - runtimeTemplate, - null - ); - const typeofCode = isTypeof - ? codeCode - : "typeof (" + codeCode + ")"; - const res = parser.evaluate(typeofCode); - recurseTypeof = false; - res.setRange(expr.range); - return res; - }); - parser.hooks.typeof.for(key).tap("DefinePlugin", expr => { - addValueDependency(originalKey); - const codeCode = toCode( - code, - parser, - compilation.valueCacheVersions, - originalKey, - runtimeTemplate, - null - ); - const typeofCode = isTypeof - ? codeCode - : "typeof (" + codeCode + ")"; - const res = parser.evaluate(typeofCode); - if (!res.isString()) return; - return toConstantDependency( - parser, - JSON.stringify(res.string) - ).bind(parser)(expr); - }); - }; - - /** - * Apply Object - * @param {string} key Key - * @param {Object} obj Object - * @returns {void} - */ - const applyObjectDefine = (key, obj) => { - parser.hooks.canRename.for(key).tap("DefinePlugin", () => { - addValueDependency(key); - return true; - }); - parser.hooks.evaluateIdentifier - .for(key) - .tap("DefinePlugin", expr => { - addValueDependency(key); - return new BasicEvaluatedExpression() - .setTruthy() - .setSideEffects(false) - .setRange(expr.range); - }); - parser.hooks.evaluateTypeof - .for(key) - .tap( - "DefinePlugin", - withValueDependency(key, evaluateToString("object")) - ); - parser.hooks.expression.for(key).tap("DefinePlugin", expr => { - addValueDependency(key); - const strCode = stringifyObj( - obj, - parser, - compilation.valueCacheVersions, - key, - runtimeTemplate, - !parser.isAsiPosition(expr.range[0]) - ); - - if (/__webpack_require__\s*(!?\.)/.test(strCode)) { - return toConstantDependency(parser, strCode, [ - RuntimeGlobals.require - ])(expr); - } else if (/__webpack_require__/.test(strCode)) { - return toConstantDependency(parser, strCode, [ - RuntimeGlobals.requireScope - ])(expr); - } else { - return toConstantDependency(parser, strCode)(expr); - } - }); - parser.hooks.typeof - .for(key) - .tap( - "DefinePlugin", - withValueDependency( - key, - toConstantDependency(parser, JSON.stringify("object")) - ) - ); - }; - - walkDefinitions(definitions, ""); - }; - - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("DefinePlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("DefinePlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("DefinePlugin", handler); - - /** - * Walk definitions - * @param {Object} definitions Definitions map - * @param {string} prefix Prefix string - * @returns {void} - */ - const walkDefinitionsForValues = (definitions, prefix) => { - Object.keys(definitions).forEach(key => { - const code = definitions[key]; - const version = toCacheVersion(code); - const name = VALUE_DEP_PREFIX + prefix + key; - mainHash.update("|" + prefix + key); - const oldVersion = compilation.valueCacheVersions.get(name); - if (oldVersion === undefined) { - compilation.valueCacheVersions.set(name, version); - } else if (oldVersion !== version) { - const warning = new WebpackError( - `DefinePlugin\nConflicting values for '${prefix + key}'` - ); - warning.details = `'${oldVersion}' !== '${version}'`; - warning.hideStack = true; - compilation.warnings.push(warning); - } - if ( - code && - typeof code === "object" && - !(code instanceof RuntimeValue) && - !(code instanceof RegExp) - ) { - walkDefinitionsForValues(code, prefix + key + "."); - } - }); - }; - - walkDefinitionsForValues(definitions, ""); - - compilation.valueCacheVersions.set( - VALUE_DEP_MAIN, - /** @type {string} */ (mainHash.digest("hex").slice(0, 8)) - ); - } - ); - } -} -module.exports = DefinePlugin; - - -/***/ }), - -/***/ 28623: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { OriginalSource, RawSource } = __webpack_require__(51255); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const DelegatedSourceDependency = __webpack_require__(22914); -const StaticExportsDependency = __webpack_require__(91418); -const makeSerializable = __webpack_require__(33032); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./LibManifestPlugin").ManifestModuleData} ManifestModuleData */ -/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("./Module").SourceContext} SourceContext */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./WebpackError")} WebpackError */ -/** @typedef {import("./dependencies/ModuleDependency")} ModuleDependency */ -/** @typedef {import("./util/Hash")} Hash */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ - -const TYPES = new Set(["javascript"]); -const RUNTIME_REQUIREMENTS = new Set([ - RuntimeGlobals.module, - RuntimeGlobals.require -]); - -class DelegatedModule extends Module { - constructor(sourceRequest, data, type, userRequest, originalRequest) { - super("javascript/dynamic", null); - - // Info from Factory - this.sourceRequest = sourceRequest; - this.request = data.id; - this.delegationType = type; - this.userRequest = userRequest; - this.originalRequest = originalRequest; - /** @type {ManifestModuleData} */ - this.delegateData = data; - - // Build info - this.delegatedSourceDependency = undefined; - } + } + } + } + } + for (const child of chunkGroup.childrenIterable) { + queue.add(child); + } + } + return false; + } /** - * @returns {Set} types available (do not mutate) + * @param {Chunk} chunkA first chunk + * @param {Chunk} chunkB second chunk + * @returns {-1|0|1} this is a comparator function like sort and returns -1, 0, or 1 based on sort order */ - getSourceTypes() { - return TYPES; + compareChunks(chunkA, chunkB) { + const cgcA = this._getChunkGraphChunk(chunkA); + const cgcB = this._getChunkGraphChunk(chunkB); + if (cgcA.modules.size > cgcB.modules.size) return -1; + if (cgcA.modules.size < cgcB.modules.size) return 1; + cgcA.modules.sortWith(compareModulesByIdentifier); + cgcB.modules.sortWith(compareModulesByIdentifier); + return compareModuleIterables(cgcA.modules, cgcB.modules); } /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion + * @param {Chunk} chunk the chunk + * @returns {number} total size of all modules in the chunk */ - libIdent(options) { - return typeof this.originalRequest === "string" - ? this.originalRequest - : this.originalRequest.libIdent(options); + getChunkModulesSize(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.modules.getFromUnorderedCache(getModulesSize); } /** - * @returns {string} a unique identifier of the module + * @param {Chunk} chunk the chunk + * @returns {Record} total sizes of all modules in the chunk by source type */ - identifier() { - return `delegated ${JSON.stringify(this.request)} from ${ - this.sourceRequest - }`; + getChunkModulesSizes(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.modules.getFromUnorderedCache(getModulesSizes); } /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module + * @param {Chunk} chunk the chunk + * @returns {Module[]} root modules of the chunks (ordered by identifier) */ - readableIdentifier(requestShortener) { - return `delegated ${this.userRequest} from ${this.sourceRequest}`; + getChunkRootModules(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.modules.getFromUnorderedCache(this._getGraphRoots); } /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} + * @param {Chunk} chunk the chunk + * @param {ChunkSizeOptions} options options object + * @returns {number} total size of the chunk */ - needBuild(context, callback) { - return callback(null, !this.buildMeta); + getChunkSize(chunk, options = {}) { + const cgc = this._getChunkGraphChunk(chunk); + const modulesSize = cgc.modules.getFromUnorderedCache(getModulesSize); + const chunkOverhead = + typeof options.chunkOverhead === "number" ? options.chunkOverhead : 10000; + const entryChunkMultiplicator = + typeof options.entryChunkMultiplicator === "number" + ? options.entryChunkMultiplicator + : 10; + return ( + chunkOverhead + + modulesSize * (chunk.canBeInitial() ? entryChunkMultiplicator : 1) + ); } /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} + * @param {Chunk} chunkA chunk + * @param {Chunk} chunkB chunk + * @param {ChunkSizeOptions} options options object + * @returns {number} total size of the chunk or false if chunks can't be integrated */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = { ...this.delegateData.buildMeta }; - this.buildInfo = {}; - this.dependencies.length = 0; - this.delegatedSourceDependency = new DelegatedSourceDependency( - this.sourceRequest - ); - this.addDependency(this.delegatedSourceDependency); - this.addDependency( - new StaticExportsDependency(this.delegateData.exports || true, false) + getIntegratedChunksSize(chunkA, chunkB, options = {}) { + const cgcA = this._getChunkGraphChunk(chunkA); + const cgcB = this._getChunkGraphChunk(chunkB); + const allModules = new Set(cgcA.modules); + for (const m of cgcB.modules) allModules.add(m); + let modulesSize = getModulesSize(allModules); + const chunkOverhead = + typeof options.chunkOverhead === "number" ? options.chunkOverhead : 10000; + const entryChunkMultiplicator = + typeof options.entryChunkMultiplicator === "number" + ? options.entryChunkMultiplicator + : 10; + return ( + chunkOverhead + + modulesSize * + (chunkA.canBeInitial() || chunkB.canBeInitial() + ? entryChunkMultiplicator + : 1) ); - callback(); } /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result + * @param {Chunk} chunkA chunk + * @param {Chunk} chunkB chunk + * @returns {boolean} true, if chunks could be integrated */ - codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { - const dep = /** @type {DelegatedSourceDependency} */ (this.dependencies[0]); - const sourceModule = moduleGraph.getModule(dep); - let str; + canChunksBeIntegrated(chunkA, chunkB) { + if (chunkA.preventIntegration || chunkB.preventIntegration) { + return false; + } - if (!sourceModule) { - str = runtimeTemplate.throwMissingModuleErrorBlock({ - request: this.sourceRequest - }); - } else { - str = `module.exports = (${runtimeTemplate.moduleExports({ - module: sourceModule, - chunkGraph, - request: dep.request, - runtimeRequirements: new Set() - })})`; + const hasRuntimeA = chunkA.hasRuntime(); + const hasRuntimeB = chunkB.hasRuntime(); - switch (this.delegationType) { - case "require": - str += `(${JSON.stringify(this.request)})`; - break; - case "object": - str += `[${JSON.stringify(this.request)}]`; - break; + if (hasRuntimeA !== hasRuntimeB) { + if (hasRuntimeA) { + return isAvailableChunk(chunkA, chunkB); + } else if (hasRuntimeB) { + return isAvailableChunk(chunkB, chunkA); + } else { + return false; } - - str += ";"; } - const sources = new Map(); - if (this.useSourceMap || this.useSimpleSourceMap) { - sources.set("javascript", new OriginalSource(str, this.identifier())); - } else { - sources.set("javascript", new RawSource(str)); + if ( + this.getNumberOfEntryModules(chunkA) > 0 || + this.getNumberOfEntryModules(chunkB) > 0 + ) { + return false; } - return { - sources, - runtimeRequirements: RUNTIME_REQUIREMENTS - }; - } - - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - return 42; + return true; } /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context + * @param {Chunk} chunkA the target chunk + * @param {Chunk} chunkB the chunk to integrate * @returns {void} */ - updateHash(hash, context) { - hash.update(this.delegationType); - hash.update(JSON.stringify(this.request)); - super.updateHash(hash, context); - } - - serialize(context) { - const { write } = context; - // constructor - write(this.sourceRequest); - write(this.delegateData); - write(this.delegationType); - write(this.userRequest); - write(this.originalRequest); - super.serialize(context); - } - - static deserialize(context) { - const { read } = context; - const obj = new DelegatedModule( - read(), // sourceRequest - read(), // delegateData - read(), // delegationType - read(), // userRequest - read() // originalRequest - ); - obj.deserialize(context); - return obj; - } - - /** - * Assuming this module is in the cache. Update the (cached) module with - * the fresh module from the factory. Usually updates internal references - * and properties. - * @param {Module} module fresh module - * @returns {void} - */ - updateCacheModule(module) { - super.updateCacheModule(module); - const m = /** @type {DelegatedModule} */ (module); - this.delegationType = m.delegationType; - this.userRequest = m.userRequest; - this.originalRequest = m.originalRequest; - this.delegateData = m.delegateData; - } - - /** - * Assuming this module is in the cache. Remove internal references to allow freeing some memory. - */ - cleanupForCache() { - super.cleanupForCache(); - this.delegateData = undefined; - } -} - -makeSerializable(DelegatedModule, "webpack/lib/DelegatedModule"); - -module.exports = DelegatedModule; - - -/***/ }), - -/***/ 51387: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + integrateChunks(chunkA, chunkB) { + // Decide for one name (deterministic) + if (chunkA.name && chunkB.name) { + if ( + this.getNumberOfEntryModules(chunkA) > 0 === + this.getNumberOfEntryModules(chunkB) > 0 + ) { + // When both chunks have entry modules or none have one, use + // shortest name + if (chunkA.name.length !== chunkB.name.length) { + chunkA.name = + chunkA.name.length < chunkB.name.length ? chunkA.name : chunkB.name; + } else { + chunkA.name = chunkA.name < chunkB.name ? chunkA.name : chunkB.name; + } + } else if (this.getNumberOfEntryModules(chunkB) > 0) { + // Pick the name of the chunk with the entry module + chunkA.name = chunkB.name; + } + } else if (chunkB.name) { + chunkA.name = chunkB.name; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // Merge id name hints + for (const hint of chunkB.idNameHints) { + chunkA.idNameHints.add(hint); + } + // Merge runtime + chunkA.runtime = mergeRuntime(chunkA.runtime, chunkB.runtime); + // getChunkModules is used here to create a clone, because disconnectChunkAndModule modifies + for (const module of this.getChunkModules(chunkB)) { + this.disconnectChunkAndModule(chunkB, module); + this.connectChunkAndModule(chunkA, module); + } -const DelegatedModule = __webpack_require__(28623); + for (const [module, chunkGroup] of Array.from( + this.getChunkEntryModulesWithChunkGroupIterable(chunkB) + )) { + this.disconnectChunkAndEntryModule(chunkB, module); + this.connectChunkAndEntryModule(chunkA, module, chunkGroup); + } -// options.source -// options.type -// options.context -// options.scope -// options.content -// options.associatedObjectForCache -class DelegatedModuleFactoryPlugin { - constructor(options) { - this.options = options; - options.type = options.type || "require"; - options.extensions = options.extensions || ["", ".js", ".json", ".wasm"]; + for (const chunkGroup of chunkB.groupsIterable) { + chunkGroup.replaceChunk(chunkB, chunkA); + chunkA.addGroup(chunkGroup); + chunkB.removeGroup(chunkGroup); + } + ChunkGraph.clearChunkGraphForChunk(chunkB); } - apply(normalModuleFactory) { - const scope = this.options.scope; - if (scope) { - normalModuleFactory.hooks.factorize.tapAsync( - "DelegatedModuleFactoryPlugin", - (data, callback) => { - const [dependency] = data.dependencies; - const { request } = dependency; - if (request && request.startsWith(`${scope}/`)) { - const innerRequest = "." + request.substr(scope.length); - let resolved; - if (innerRequest in this.options.content) { - resolved = this.options.content[innerRequest]; - return callback( - null, - new DelegatedModule( - this.options.source, - resolved, - this.options.type, - innerRequest, - request - ) - ); - } - for (let i = 0; i < this.options.extensions.length; i++) { - const extension = this.options.extensions[i]; - const requestPlusExt = innerRequest + extension; - if (requestPlusExt in this.options.content) { - resolved = this.options.content[requestPlusExt]; - return callback( - null, - new DelegatedModule( - this.options.source, - resolved, - this.options.type, - requestPlusExt, - request + extension - ) - ); - } - } - } - return callback(); - } - ); + /** + * @param {Chunk} chunk the chunk to upgrade + * @returns {void} + */ + upgradeDependentToFullHashModules(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + if (cgc.dependentHashModules === undefined) return; + if (cgc.fullHashModules === undefined) { + cgc.fullHashModules = cgc.dependentHashModules; } else { - normalModuleFactory.hooks.module.tap( - "DelegatedModuleFactoryPlugin", - module => { - const request = module.libIdent(this.options); - if (request) { - if (request in this.options.content) { - const resolved = this.options.content[request]; - return new DelegatedModule( - this.options.source, - resolved, - this.options.type, - request, - module - ); - } - } - return module; - } - ); + for (const m of cgc.dependentHashModules) { + cgc.fullHashModules.add(m); + } + cgc.dependentHashModules = undefined; } } -} -module.exports = DelegatedModuleFactoryPlugin; - - -/***/ }), - -/***/ 80632: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const DelegatedModuleFactoryPlugin = __webpack_require__(51387); -const DelegatedSourceDependency = __webpack_require__(22914); - -/** @typedef {import("./Compiler")} Compiler */ -class DelegatedPlugin { - constructor(options) { - this.options = options; + /** + * @param {Module} module the checked module + * @param {Chunk} chunk the checked chunk + * @returns {boolean} true, if the chunk contains the module as entry + */ + isEntryModuleInChunk(module, chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.entryModules.has(module); } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {Chunk} chunk the new chunk + * @param {Module} module the entry module + * @param {Entrypoint=} entrypoint the chunk group which must be loaded before the module is executed * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap( - "DelegatedPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - DelegatedSourceDependency, - normalModuleFactory - ); - } - ); - - compiler.hooks.compile.tap("DelegatedPlugin", ({ normalModuleFactory }) => { - new DelegatedModuleFactoryPlugin({ - associatedObjectForCache: compiler.root, - ...this.options - }).apply(normalModuleFactory); - }); + connectChunkAndEntryModule(chunk, module, entrypoint) { + const cgm = this._getChunkGraphModule(module); + const cgc = this._getChunkGraphChunk(chunk); + if (cgm.entryInChunks === undefined) { + cgm.entryInChunks = new Set(); + } + cgm.entryInChunks.add(chunk); + cgc.entryModules.set(module, entrypoint); } -} - -module.exports = DelegatedPlugin; - - -/***/ }), - -/***/ 71040: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const makeSerializable = __webpack_require__(33032); - -/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./ChunkGroup")} ChunkGroup */ -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("./util/Hash")} Hash */ - -/** @typedef {(d: Dependency) => boolean} DependencyFilterFunction */ -class DependenciesBlock { - constructor() { - /** @type {Dependency[]} */ - this.dependencies = []; - /** @type {AsyncDependenciesBlock[]} */ - this.blocks = []; - /** @type {DependenciesBlock} */ - this.parent = undefined; + /** + * @param {Chunk} chunk the new chunk + * @param {RuntimeModule} module the runtime module + * @returns {void} + */ + connectChunkAndRuntimeModule(chunk, module) { + const cgm = this._getChunkGraphModule(module); + const cgc = this._getChunkGraphChunk(chunk); + if (cgm.runtimeInChunks === undefined) { + cgm.runtimeInChunks = new Set(); + } + cgm.runtimeInChunks.add(chunk); + cgc.runtimeModules.add(module); } - getRootBlock() { - /** @type {DependenciesBlock} */ - let current = this; - while (current.parent) current = current.parent; - return current; + /** + * @param {Chunk} chunk the new chunk + * @param {RuntimeModule} module the module that require a full hash + * @returns {void} + */ + addFullHashModuleToChunk(chunk, module) { + const cgc = this._getChunkGraphChunk(chunk); + if (cgc.fullHashModules === undefined) cgc.fullHashModules = new Set(); + cgc.fullHashModules.add(module); } /** - * Adds a DependencyBlock to DependencyBlock relationship. - * This is used for when a Module has a AsyncDependencyBlock tie (for code-splitting) - * - * @param {AsyncDependenciesBlock} block block being added + * @param {Chunk} chunk the new chunk + * @param {RuntimeModule} module the module that require a full hash * @returns {void} */ - addBlock(block) { - this.blocks.push(block); - block.parent = this; + addDependentHashModuleToChunk(chunk, module) { + const cgc = this._getChunkGraphChunk(chunk); + if (cgc.dependentHashModules === undefined) + cgc.dependentHashModules = new Set(); + cgc.dependentHashModules.add(module); } /** - * @param {Dependency} dependency dependency being tied to block. - * This is an "edge" pointing to another "node" on module graph. + * @param {Chunk} chunk the new chunk + * @param {Module} module the entry module * @returns {void} */ - addDependency(dependency) { - this.dependencies.push(dependency); + disconnectChunkAndEntryModule(chunk, module) { + const cgm = this._getChunkGraphModule(module); + const cgc = this._getChunkGraphChunk(chunk); + cgm.entryInChunks.delete(chunk); + if (cgm.entryInChunks.size === 0) { + cgm.entryInChunks = undefined; + } + cgc.entryModules.delete(module); } /** - * @param {Dependency} dependency dependency being removed + * @param {Chunk} chunk the new chunk + * @param {RuntimeModule} module the runtime module * @returns {void} */ - removeDependency(dependency) { - const idx = this.dependencies.indexOf(dependency); - if (idx >= 0) { - this.dependencies.splice(idx, 1); + disconnectChunkAndRuntimeModule(chunk, module) { + const cgm = this._getChunkGraphModule(module); + const cgc = this._getChunkGraphChunk(chunk); + cgm.runtimeInChunks.delete(chunk); + if (cgm.runtimeInChunks.size === 0) { + cgm.runtimeInChunks = undefined; } + cgc.runtimeModules.delete(module); } /** - * Removes all dependencies and blocks + * @param {Module} module the entry module, it will no longer be entry * @returns {void} */ - clearDependenciesAndBlocks() { - this.dependencies.length = 0; - this.blocks.length = 0; + disconnectEntryModule(module) { + const cgm = this._getChunkGraphModule(module); + for (const chunk of cgm.entryInChunks) { + const cgc = this._getChunkGraphChunk(chunk); + cgc.entryModules.delete(module); + } + cgm.entryInChunks = undefined; } /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context + * @param {Chunk} chunk the chunk, for which all entries will be removed * @returns {void} */ - updateHash(hash, context) { - for (const dep of this.dependencies) { - dep.updateHash(hash, context); - } - for (const block of this.blocks) { - block.updateHash(hash, context); + disconnectEntries(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + for (const module of cgc.entryModules.keys()) { + const cgm = this._getChunkGraphModule(module); + cgm.entryInChunks.delete(chunk); + if (cgm.entryInChunks.size === 0) { + cgm.entryInChunks = undefined; + } } + cgc.entryModules.clear(); } - serialize({ write }) { - write(this.dependencies); - write(this.blocks); + /** + * @param {Chunk} chunk the chunk + * @returns {number} the amount of entry modules in chunk + */ + getNumberOfEntryModules(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.entryModules.size; } - deserialize({ read }) { - this.dependencies = read(); - this.blocks = read(); - for (const block of this.blocks) { - block.parent = this; - } + /** + * @param {Chunk} chunk the chunk + * @returns {number} the amount of entry modules in chunk + */ + getNumberOfRuntimeModules(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.runtimeModules.size; } -} - -makeSerializable(DependenciesBlock, "webpack/lib/DependenciesBlock"); -module.exports = DependenciesBlock; + /** + * @param {Chunk} chunk the chunk + * @returns {Iterable} iterable of modules (do not modify) + */ + getChunkEntryModulesIterable(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.entryModules.keys(); + } + /** + * @param {Chunk} chunk the chunk + * @returns {Iterable} iterable of chunks + */ + getChunkEntryDependentChunksIterable(chunk) { + /** @type {Set} */ + const set = new Set(); + for (const chunkGroup of chunk.groupsIterable) { + if (chunkGroup instanceof Entrypoint) { + const entrypointChunk = chunkGroup.getEntrypointChunk(); + const cgc = this._getChunkGraphChunk(entrypointChunk); + for (const chunkGroup of cgc.entryModules.values()) { + for (const c of chunkGroup.chunks) { + if (c !== chunk && c !== entrypointChunk && !c.hasRuntime()) { + set.add(c); + } + } + } + } + } -/***/ }), + return set; + } -/***/ 54912: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * @param {Chunk} chunk the chunk + * @returns {boolean} true, when it has dependent chunks + */ + hasChunkEntryDependentChunks(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + for (const chunkGroup of cgc.entryModules.values()) { + for (const c of chunkGroup.chunks) { + if (c !== chunk) { + return true; + } + } + } + return false; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {Chunk} chunk the chunk + * @returns {Iterable} iterable of modules (do not modify) + */ + getChunkRuntimeModulesIterable(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.runtimeModules; + } + /** + * @param {Chunk} chunk the chunk + * @returns {RuntimeModule[]} array of modules in order of execution + */ + getChunkRuntimeModulesInOrder(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + const array = Array.from(cgc.runtimeModules); + array.sort( + concatComparators( + compareSelect( + /** + * @param {RuntimeModule} r runtime module + * @returns {number=} stage + */ + r => r.stage, + compareIds + ), + compareModulesByIdentifier + ) + ); + return array; + } + /** + * @param {Chunk} chunk the chunk + * @returns {Iterable | undefined} iterable of modules (do not modify) + */ + getChunkFullHashModulesIterable(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.fullHashModules; + } -const memoize = __webpack_require__(78676); + /** + * @param {Chunk} chunk the chunk + * @returns {ReadonlySet | undefined} set of modules (do not modify) + */ + getChunkFullHashModulesSet(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.fullHashModules; + } -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./WebpackError")} WebpackError */ -/** @typedef {import("./util/Hash")} Hash */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - -/** - * @typedef {Object} UpdateHashContext - * @property {ChunkGraph} chunkGraph - * @property {RuntimeSpec} runtime - * @property {RuntimeTemplate=} runtimeTemplate - */ - -/** - * @typedef {Object} SourcePosition - * @property {number} line - * @property {number=} column - */ - -/** - * @typedef {Object} RealDependencyLocation - * @property {SourcePosition} start - * @property {SourcePosition=} end - * @property {number=} index - */ - -/** - * @typedef {Object} SyntheticDependencyLocation - * @property {string} name - * @property {number=} index - */ - -/** @typedef {SyntheticDependencyLocation|RealDependencyLocation} DependencyLocation */ - -/** - * @typedef {Object} ExportSpec - * @property {string} name the name of the export - * @property {boolean=} canMangle can the export be renamed (defaults to true) - * @property {boolean=} terminalBinding is the export a terminal binding that should be checked for export star conflicts - * @property {(string | ExportSpec)[]=} exports nested exports - * @property {ModuleGraphConnection=} from when reexported: from which module - * @property {string[] | null=} export when reexported: from which export - * @property {number=} priority when reexported: with which priority - * @property {boolean=} hidden export is not visible, because another export blends over it - */ - -/** - * @typedef {Object} ExportsSpec - * @property {(string | ExportSpec)[] | true | null} exports exported names, true for unknown exports or null for no exports - * @property {Set=} excludeExports when exports = true, list of unaffected exports - * @property {Set=} hideExports list of maybe prior exposed, but now hidden exports - * @property {ModuleGraphConnection=} from when reexported: from which module - * @property {number=} priority when reexported: with which priority - * @property {boolean=} canMangle can the export be renamed (defaults to true) - * @property {boolean=} terminalBinding are the exports terminal bindings that should be checked for export star conflicts - * @property {Module[]=} dependencies module on which the result depends on - */ - -/** - * @typedef {Object} ReferencedExport - * @property {string[]} name name of the referenced export - * @property {boolean=} canMangle when false, referenced export can not be mangled, defaults to true - */ - -const TRANSITIVE = Symbol("transitive"); - -const getIgnoredModule = memoize(() => { - const RawModule = __webpack_require__(84929); - return new RawModule("/* (ignored) */", `ignored`, `(ignored)`); -}); - -class Dependency { - constructor() { - /** @type {Module} */ - this._parentModule = undefined; - /** @type {DependenciesBlock} */ - this._parentDependenciesBlock = undefined; - /** @type {number} */ - this._parentDependenciesBlockIndex = -1; - // TODO check if this can be moved into ModuleDependency - /** @type {boolean} */ - this.weak = false; - // TODO check if this can be moved into ModuleDependency - /** @type {boolean} */ - this.optional = false; - this._locSL = 0; - this._locSC = 0; - this._locEL = 0; - this._locEC = 0; - this._locI = undefined; - this._locN = undefined; - this._loc = undefined; + /** + * @param {Chunk} chunk the chunk + * @returns {Iterable | undefined} iterable of modules (do not modify) + */ + getChunkDependentHashModulesIterable(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.dependentHashModules; } /** - * @returns {string} a display name for the type of dependency + * @param {Chunk} chunk the chunk + * @returns {Iterable} iterable of modules (do not modify) */ - get type() { - return "unknown"; + getChunkEntryModulesWithChunkGroupIterable(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.entryModules; } /** - * @returns {string} a dependency category, typical categories are "commonjs", "amd", "esm" + * @param {AsyncDependenciesBlock} depBlock the async block + * @returns {ChunkGroup} the chunk group */ - get category() { - return "unknown"; + getBlockChunkGroup(depBlock) { + return this._blockChunkGroups.get(depBlock); } /** - * @returns {DependencyLocation} location + * @param {AsyncDependenciesBlock} depBlock the async block + * @param {ChunkGroup} chunkGroup the chunk group + * @returns {void} */ - get loc() { - if (this._loc !== undefined) return this._loc; - /** @type {SyntheticDependencyLocation & RealDependencyLocation} */ - const loc = {}; - if (this._locSL > 0) { - loc.start = { line: this._locSL, column: this._locSC }; - } - if (this._locEL > 0) { - loc.end = { line: this._locEL, column: this._locEC }; - } - if (this._locN !== undefined) { - loc.name = this._locN; - } - if (this._locI !== undefined) { - loc.index = this._locI; - } - return (this._loc = loc); + connectBlockAndChunkGroup(depBlock, chunkGroup) { + this._blockChunkGroups.set(depBlock, chunkGroup); + chunkGroup.addBlock(depBlock); } - set loc(loc) { - if ("start" in loc && typeof loc.start === "object") { - this._locSL = loc.start.line || 0; - this._locSC = loc.start.column || 0; - } else { - this._locSL = 0; - this._locSC = 0; - } - if ("end" in loc && typeof loc.end === "object") { - this._locEL = loc.end.line || 0; - this._locEC = loc.end.column || 0; - } else { - this._locEL = 0; - this._locEC = 0; - } - if ("index" in loc) { - this._locI = loc.index; - } else { - this._locI = undefined; - } - if ("name" in loc) { - this._locN = loc.name; - } else { - this._locN = undefined; + /** + * @param {ChunkGroup} chunkGroup the chunk group + * @returns {void} + */ + disconnectChunkGroup(chunkGroup) { + for (const block of chunkGroup.blocksIterable) { + this._blockChunkGroups.delete(block); } - this._loc = loc; - } - - setLoc(startLine, startColumn, endLine, endColumn) { - this._locSL = startLine; - this._locSC = startColumn; - this._locEL = endLine; - this._locEC = endColumn; - this._locI = undefined; - this._locN = undefined; - this._loc = undefined; + // TODO refactor by moving blocks list into ChunkGraph + chunkGroup._blocks.clear(); } /** - * @returns {string | null} an identifier to merge equal requests + * @param {Module} module the module + * @returns {string | number} the id of the module */ - getResourceIdentifier() { - return null; + getModuleId(module) { + const cgm = this._getChunkGraphModule(module); + return cgm.id; } /** - * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + * @param {Module} module the module + * @param {string | number} id the id of the module + * @returns {void} */ - couldAffectReferencingModule() { - return TRANSITIVE; + setModuleId(module, id) { + const cgm = this._getChunkGraphModule(module); + cgm.id = id; } /** - * Returns the referenced module and export - * @deprecated - * @param {ModuleGraph} moduleGraph module graph - * @returns {never} throws error + * @param {string} runtime runtime + * @returns {string | number} the id of the runtime */ - getReference(moduleGraph) { - throw new Error( - "Dependency.getReference was removed in favor of Dependency.getReferencedExports, ModuleGraph.getModule and ModuleGraph.getConnection().active" - ); + getRuntimeId(runtime) { + return this._runtimeIds.get(runtime); } /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports + * @param {string} runtime runtime + * @param {string | number} id the id of the runtime + * @returns {void} */ - getReferencedExports(moduleGraph, runtime) { - return Dependency.EXPORTS_OBJECT_REFERENCED; + setRuntimeId(runtime, id) { + this._runtimeIds.set(runtime, id); } /** - * @param {ModuleGraph} moduleGraph module graph - * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active + * @template T + * @param {Module} module the module + * @param {RuntimeSpecMap} hashes hashes data + * @param {RuntimeSpec} runtime the runtime + * @returns {T} hash */ - getCondition(moduleGraph) { - return null; + _getModuleHashInfo(module, hashes, runtime) { + if (!hashes) { + throw new Error( + `Module ${module.identifier()} has no hash info for runtime ${runtimeToString( + runtime + )} (hashes not set at all)` + ); + } else if (runtime === undefined) { + const hashInfoItems = new Set(hashes.values()); + if (hashInfoItems.size !== 1) { + throw new Error( + `No unique hash info entry for unspecified runtime for ${module.identifier()} (existing runtimes: ${Array.from( + hashes.keys(), + r => runtimeToString(r) + ).join(", ")}). +Caller might not support runtime-dependent code generation (opt-out via optimization.usedExports: "global").` + ); + } + return first(hashInfoItems); + } else { + const hashInfo = hashes.get(runtime); + if (!hashInfo) { + throw new Error( + `Module ${module.identifier()} has no hash info for runtime ${runtimeToString( + runtime + )} (available runtimes ${Array.from( + hashes.keys(), + runtimeToString + ).join(", ")})` + ); + } + return hashInfo; + } } /** - * Returns the exported names - * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true, if the module has hashes for this runtime */ - getExports(moduleGraph) { - return undefined; + hasModuleHashes(module, runtime) { + const cgm = this._getChunkGraphModule(module); + const hashes = cgm.hashes; + return hashes && hashes.has(runtime); } /** - * Returns warnings - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[]} warnings + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @returns {string} hash */ - getWarnings(moduleGraph) { - return null; + getModuleHash(module, runtime) { + const cgm = this._getChunkGraphModule(module); + const hashes = cgm.hashes; + return this._getModuleHashInfo(module, hashes, runtime).hash; } /** - * Returns errors - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[]} errors + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @returns {string} hash */ - getErrors(moduleGraph) { - return null; + getRenderedModuleHash(module, runtime) { + const cgm = this._getChunkGraphModule(module); + const hashes = cgm.hashes; + return this._getModuleHashInfo(module, hashes, runtime).renderedHash; } /** - * Update the hash - * @param {Hash} hash hash to be updated - * @param {UpdateHashContext} context context + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @param {string} hash the full hash + * @param {string} renderedHash the shortened hash for rendering * @returns {void} */ - updateHash(hash, context) {} + setModuleHashes(module, runtime, hash, renderedHash) { + const cgm = this._getChunkGraphModule(module); + if (cgm.hashes === undefined) { + cgm.hashes = new RuntimeSpecMap(); + } + cgm.hashes.set(runtime, new ModuleHashInfo(hash, renderedHash)); + } /** - * implement this method to allow the occurrence order plugin to count correctly - * @returns {number} count how often the id is used in this dependency + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @param {Set} items runtime requirements to be added (ownership of this Set is given to ChunkGraph when transferOwnership not false) + * @param {boolean} transferOwnership true: transfer ownership of the items object, false: items is immutable and shared and won't be modified + * @returns {void} */ - getNumberOfIdOccurrences() { - return 1; + addModuleRuntimeRequirements( + module, + runtime, + items, + transferOwnership = true + ) { + const cgm = this._getChunkGraphModule(module); + const runtimeRequirementsMap = cgm.runtimeRequirements; + if (runtimeRequirementsMap === undefined) { + const map = new RuntimeSpecMap(); + // TODO avoid cloning item and track ownership instead + map.set(runtime, transferOwnership ? items : new Set(items)); + cgm.runtimeRequirements = map; + return; + } + runtimeRequirementsMap.update(runtime, runtimeRequirements => { + if (runtimeRequirements === undefined) { + return transferOwnership ? items : new Set(items); + } else if (!transferOwnership || runtimeRequirements.size >= items.size) { + for (const item of items) runtimeRequirements.add(item); + return runtimeRequirements; + } else { + for (const item of runtimeRequirements) items.add(item); + return items; + } + }); } /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this dependency connects the module to referencing modules + * @param {Chunk} chunk the chunk + * @param {Set} items runtime requirements to be added (ownership of this Set is given to ChunkGraph) + * @returns {void} */ - getModuleEvaluationSideEffectsState(moduleGraph) { - return true; + addChunkRuntimeRequirements(chunk, items) { + const cgc = this._getChunkGraphChunk(chunk); + const runtimeRequirements = cgc.runtimeRequirements; + if (runtimeRequirements === undefined) { + cgc.runtimeRequirements = items; + } else if (runtimeRequirements.size >= items.size) { + for (const item of items) runtimeRequirements.add(item); + } else { + for (const item of runtimeRequirements) items.add(item); + cgc.runtimeRequirements = items; + } } /** - * @param {string} context context directory - * @returns {Module} a module + * @param {Chunk} chunk the chunk + * @param {Iterable} items runtime requirements to be added + * @returns {void} */ - createIgnoredModule(context) { - return getIgnoredModule(); + addTreeRuntimeRequirements(chunk, items) { + const cgc = this._getChunkGraphChunk(chunk); + const runtimeRequirements = cgc.runtimeRequirementsInTree; + for (const item of items) runtimeRequirements.add(item); } - serialize({ write }) { - write(this.weak); - write(this.optional); - write(this._locSL); - write(this._locSC); - write(this._locEL); - write(this._locEC); - write(this._locI); - write(this._locN); + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @returns {ReadonlySet} runtime requirements + */ + getModuleRuntimeRequirements(module, runtime) { + const cgm = this._getChunkGraphModule(module); + const runtimeRequirements = + cgm.runtimeRequirements && cgm.runtimeRequirements.get(runtime); + return runtimeRequirements === undefined ? EMPTY_SET : runtimeRequirements; } - deserialize({ read }) { - this.weak = read(); - this.optional = read(); - this._locSL = read(); - this._locSC = read(); - this._locEL = read(); - this._locEC = read(); - this._locI = read(); - this._locN = read(); + /** + * @param {Chunk} chunk the chunk + * @returns {ReadonlySet} runtime requirements + */ + getChunkRuntimeRequirements(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + const runtimeRequirements = cgc.runtimeRequirements; + return runtimeRequirements === undefined ? EMPTY_SET : runtimeRequirements; } -} - -/** @type {string[][]} */ -Dependency.NO_EXPORTS_REFERENCED = []; -/** @type {string[][]} */ -Dependency.EXPORTS_OBJECT_REFERENCED = [[]]; -Object.defineProperty(Dependency.prototype, "module", { /** - * @deprecated - * @returns {never} throws + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @param {boolean} withConnections include connections + * @returns {string} hash */ - get() { - throw new Error( - "module property was removed from Dependency (use compilation.moduleGraph.getModule(dependency) instead)" - ); - }, + getModuleGraphHash(module, runtime, withConnections = true) { + const cgm = this._getChunkGraphModule(module); + return withConnections + ? this._getModuleGraphHashWithConnections(cgm, module, runtime) + : this._getModuleGraphHashBigInt(cgm, module, runtime).toString(16); + } /** - * @deprecated - * @returns {never} throws + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @param {boolean} withConnections include connections + * @returns {bigint} hash */ - set() { - throw new Error( - "module property was removed from Dependency (use compilation.moduleGraph.updateModule(dependency, module) instead)" - ); + getModuleGraphHashBigInt(module, runtime, withConnections = true) { + const cgm = this._getChunkGraphModule(module); + return withConnections + ? BigInt( + `0x${this._getModuleGraphHashWithConnections(cgm, module, runtime)}` + ) + : this._getModuleGraphHashBigInt(cgm, module, runtime); } -}); -Object.defineProperty(Dependency.prototype, "disconnect", { - get() { - throw new Error( - "disconnect was removed from Dependency (Dependency no longer carries graph specific information)" - ); + /** + * @param {ChunkGraphModule} cgm the ChunkGraphModule + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @returns {bigint} hash as big int + */ + _getModuleGraphHashBigInt(cgm, module, runtime) { + if (cgm.graphHashes === undefined) { + cgm.graphHashes = new RuntimeSpecMap(); + } + const graphHash = cgm.graphHashes.provide(runtime, () => { + const hash = createHash(this._hashFunction); + hash.update(`${cgm.id}${this.moduleGraph.isAsync(module)}`); + this.moduleGraph.getExportsInfo(module).updateHash(hash, runtime); + return BigInt(`0x${/** @type {string} */ (hash.digest("hex"))}`); + }); + return graphHash; } -}); - -Dependency.TRANSITIVE = TRANSITIVE; - -module.exports = Dependency; - - -/***/ }), - -/***/ 5160: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ -/** @typedef {import("./ConcatenationScope")} ConcatenationScope */ -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./Dependency").RuntimeSpec} RuntimeSpec */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./Generator").GenerateContext} GenerateContext */ -/** @template T @typedef {import("./InitFragment")} InitFragment */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** - * @typedef {Object} DependencyTemplateContext - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {DependencyTemplates} dependencyTemplates the dependency templates - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {Set} runtimeRequirements the requirements for runtime - * @property {Module} module current module - * @property {RuntimeSpec} runtime current runtimes, for which code is generated - * @property {InitFragment[]} initFragments mutable array of init fragments for the current module - * @property {ConcatenationScope=} concatenationScope when in a concatenated module, information about other concatenated modules - * @property {CodeGenerationResults} codeGenerationResults the code generation results - */ - -/** - * @typedef {Object} CssDependencyTemplateContextExtras - * @property {Map} cssExports the css exports - */ - -/** @typedef {DependencyTemplateContext & CssDependencyTemplateContextExtras} CssDependencyTemplateContext */ - -class DependencyTemplate { - /* istanbul ignore next */ /** - * @abstract - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} + * @param {ChunkGraphModule} cgm the ChunkGraphModule + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @returns {string} hash */ - apply(dependency, source, templateContext) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + _getModuleGraphHashWithConnections(cgm, module, runtime) { + if (cgm.graphHashesWithConnections === undefined) { + cgm.graphHashesWithConnections = new RuntimeSpecMap(); + } + const activeStateToString = state => { + if (state === false) return "F"; + if (state === true) return "T"; + if (state === ModuleGraphConnection.TRANSITIVE_ONLY) return "O"; + throw new Error("Not implemented active state"); + }; + const strict = module.buildMeta && module.buildMeta.strictHarmonyModule; + return cgm.graphHashesWithConnections.provide(runtime, () => { + const graphHash = this._getModuleGraphHashBigInt( + cgm, + module, + runtime + ).toString(16); + const connections = this.moduleGraph.getOutgoingConnections(module); + /** @type {Set} */ + const activeNamespaceModules = new Set(); + /** @type {Map>} */ + const connectedModules = new Map(); + const processConnection = (connection, stateInfo) => { + const module = connection.module; + stateInfo += module.getExportsType(this.moduleGraph, strict); + // cspell:word Tnamespace + if (stateInfo === "Tnamespace") activeNamespaceModules.add(module); + else { + const oldModule = connectedModules.get(stateInfo); + if (oldModule === undefined) { + connectedModules.set(stateInfo, module); + } else if (oldModule instanceof Set) { + oldModule.add(module); + } else if (oldModule !== module) { + connectedModules.set(stateInfo, new Set([oldModule, module])); + } + } + }; + if (runtime === undefined || typeof runtime === "string") { + for (const connection of connections) { + const state = connection.getActiveState(runtime); + if (state === false) continue; + processConnection(connection, state === true ? "T" : "O"); + } + } else { + // cspell:word Tnamespace + for (const connection of connections) { + const states = new Set(); + let stateInfo = ""; + forEachRuntime( + runtime, + runtime => { + const state = connection.getActiveState(runtime); + states.add(state); + stateInfo += activeStateToString(state) + runtime; + }, + true + ); + if (states.size === 1) { + const state = first(states); + if (state === false) continue; + stateInfo = activeStateToString(state); + } + processConnection(connection, stateInfo); + } + } + // cspell:word Tnamespace + if (activeNamespaceModules.size === 0 && connectedModules.size === 0) + return graphHash; + const connectedModulesInOrder = + connectedModules.size > 1 + ? Array.from(connectedModules).sort(([a], [b]) => (a < b ? -1 : 1)) + : connectedModules; + const hash = createHash(this._hashFunction); + const addModuleToHash = module => { + hash.update( + this._getModuleGraphHashBigInt( + this._getChunkGraphModule(module), + module, + runtime + ).toString(16) + ); + }; + const addModulesToHash = modules => { + let xor = ZERO_BIG_INT; + for (const m of modules) { + xor = + xor ^ + this._getModuleGraphHashBigInt( + this._getChunkGraphModule(m), + m, + runtime + ); + } + hash.update(xor.toString(16)); + }; + if (activeNamespaceModules.size === 1) + addModuleToHash(activeNamespaceModules.values().next().value); + else if (activeNamespaceModules.size > 1) + addModulesToHash(activeNamespaceModules); + for (const [stateInfo, modules] of connectedModulesInOrder) { + hash.update(stateInfo); + if (modules instanceof Set) { + addModulesToHash(modules); + } else { + addModuleToHash(modules); + } + } + hash.update(graphHash); + return /** @type {string} */ (hash.digest("hex")); + }); } -} - -module.exports = DependencyTemplate; - - -/***/ }), - -/***/ 9163: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const createHash = __webpack_require__(49835); - -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./DependencyTemplate")} DependencyTemplate */ -/** @typedef {typeof import("./util/Hash")} Hash */ - -/** @typedef {new (...args: any[]) => Dependency} DependencyConstructor */ -class DependencyTemplates { /** - * @param {string | Hash} hashFunction the hash function to use + * @param {Chunk} chunk the chunk + * @returns {ReadonlySet} runtime requirements */ - constructor(hashFunction = "md4") { - /** @type {Map} */ - this._map = new Map(); - /** @type {string} */ - this._hash = "31d6cfe0d16ae931b73c59d7e0c089c0"; - this._hashFunction = hashFunction; + getTreeRuntimeRequirements(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.runtimeRequirementsInTree; } + // TODO remove in webpack 6 /** - * @param {DependencyConstructor} dependency Constructor of Dependency - * @returns {DependencyTemplate} template for this dependency + * @param {Module} module the module + * @param {string} deprecateMessage message for the deprecation message + * @param {string} deprecationCode code for the deprecation + * @returns {ChunkGraph} the chunk graph */ - get(dependency) { - return this._map.get(dependency); + static getChunkGraphForModule(module, deprecateMessage, deprecationCode) { + const fn = deprecateGetChunkGraphForModuleMap.get(deprecateMessage); + if (fn) return fn(module); + const newFn = util.deprecate( + /** + * @param {Module} module the module + * @returns {ChunkGraph} the chunk graph + */ + module => { + const chunkGraph = chunkGraphForModuleMap.get(module); + if (!chunkGraph) + throw new Error( + deprecateMessage + + ": There was no ChunkGraph assigned to the Module for backward-compat (Use the new API)" + ); + return chunkGraph; + }, + deprecateMessage + ": Use new ChunkGraph API", + deprecationCode + ); + deprecateGetChunkGraphForModuleMap.set(deprecateMessage, newFn); + return newFn(module); } + // TODO remove in webpack 6 /** - * @param {DependencyConstructor} dependency Constructor of Dependency - * @param {DependencyTemplate} dependencyTemplate template for this dependency + * @param {Module} module the module + * @param {ChunkGraph} chunkGraph the chunk graph * @returns {void} */ - set(dependency, dependencyTemplate) { - this._map.set(dependency, dependencyTemplate); + static setChunkGraphForModule(module, chunkGraph) { + chunkGraphForModuleMap.set(module, chunkGraph); } + // TODO remove in webpack 6 /** - * @param {string} part additional hash contributor + * @param {Module} module the module * @returns {void} */ - updateHash(part) { - const hash = createHash(this._hashFunction); - hash.update(`${this._hash}${part}`); - this._hash = /** @type {string} */ (hash.digest("hex")); + static clearChunkGraphForModule(module) { + chunkGraphForModuleMap.delete(module); } - getHash() { - return this._hash; + // TODO remove in webpack 6 + /** + * @param {Chunk} chunk the chunk + * @param {string} deprecateMessage message for the deprecation message + * @param {string} deprecationCode code for the deprecation + * @returns {ChunkGraph} the chunk graph + */ + static getChunkGraphForChunk(chunk, deprecateMessage, deprecationCode) { + const fn = deprecateGetChunkGraphForChunkMap.get(deprecateMessage); + if (fn) return fn(chunk); + const newFn = util.deprecate( + /** + * @param {Chunk} chunk the chunk + * @returns {ChunkGraph} the chunk graph + */ + chunk => { + const chunkGraph = chunkGraphForChunkMap.get(chunk); + if (!chunkGraph) + throw new Error( + deprecateMessage + + "There was no ChunkGraph assigned to the Chunk for backward-compat (Use the new API)" + ); + return chunkGraph; + }, + deprecateMessage + ": Use new ChunkGraph API", + deprecationCode + ); + deprecateGetChunkGraphForChunkMap.set(deprecateMessage, newFn); + return newFn(chunk); } - clone() { - const newInstance = new DependencyTemplates(this._hashFunction); - newInstance._map = new Map(this._map); - newInstance._hash = this._hash; - return newInstance; + // TODO remove in webpack 6 + /** + * @param {Chunk} chunk the chunk + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {void} + */ + static setChunkGraphForChunk(chunk, chunkGraph) { + chunkGraphForChunkMap.set(chunk, chunkGraph); } -} - -module.exports = DependencyTemplates; - - -/***/ }), - -/***/ 62790: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // TODO remove in webpack 6 + /** + * @param {Chunk} chunk the chunk + * @returns {void} + */ + static clearChunkGraphForChunk(chunk) { + chunkGraphForChunkMap.delete(chunk); + } +} +// TODO remove in webpack 6 +/** @type {WeakMap} */ +const chunkGraphForModuleMap = new WeakMap(); -const DllModuleFactory = __webpack_require__(68703); -const DllEntryDependency = __webpack_require__(95666); -const EntryDependency = __webpack_require__(3979); +// TODO remove in webpack 6 +/** @type {WeakMap} */ +const chunkGraphForChunkMap = new WeakMap(); -class DllEntryPlugin { - constructor(context, entries, options) { - this.context = context; - this.entries = entries; - this.options = options; - } +// TODO remove in webpack 6 +/** @type {Map ChunkGraph>} */ +const deprecateGetChunkGraphForModuleMap = new Map(); - apply(compiler) { - compiler.hooks.compilation.tap( - "DllEntryPlugin", - (compilation, { normalModuleFactory }) => { - const dllModuleFactory = new DllModuleFactory(); - compilation.dependencyFactories.set( - DllEntryDependency, - dllModuleFactory - ); - compilation.dependencyFactories.set( - EntryDependency, - normalModuleFactory - ); - } - ); - compiler.hooks.make.tapAsync("DllEntryPlugin", (compilation, callback) => { - compilation.addEntry( - this.context, - new DllEntryDependency( - this.entries.map((e, idx) => { - const dep = new EntryDependency(e); - dep.loc = { - name: this.options.name, - index: idx - }; - return dep; - }), - this.options.name - ), - this.options, - callback - ); - }); - } -} +// TODO remove in webpack 6 +/** @type {Map ChunkGraph>} */ +const deprecateGetChunkGraphForChunkMap = new Map(); -module.exports = DllEntryPlugin; +module.exports = ChunkGraph; /***/ }), -/***/ 28280: +/***/ 15626: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -32997,539 +27970,588 @@ module.exports = DllEntryPlugin; -const { RawSource } = __webpack_require__(51255); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); +const util = __webpack_require__(73837); +const SortableSet = __webpack_require__(13098); +const { + compareLocations, + compareChunks, + compareIterables +} = __webpack_require__(29579); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("./Chunk")} Chunk */ /** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("./Module").SourceContext} SourceContext */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./WebpackError")} WebpackError */ -/** @typedef {import("./util/Hash")} Hash */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Entrypoint")} Entrypoint */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ -const TYPES = new Set(["javascript"]); -const RUNTIME_REQUIREMENTS = new Set([ - RuntimeGlobals.require, - RuntimeGlobals.module -]); +/** @typedef {{id: number}} HasId */ +/** @typedef {{module: Module, loc: DependencyLocation, request: string}} OriginRecord */ -class DllModule extends Module { - constructor(context, dependencies, name) { - super("javascript/dynamic", context); +/** + * @typedef {Object} RawChunkGroupOptions + * @property {number=} preloadOrder + * @property {number=} prefetchOrder + */ - // Info from Factory - this.dependencies = dependencies; - this.name = name; - } +/** @typedef {RawChunkGroupOptions & { name?: string }} ChunkGroupOptions */ + +let debugId = 5000; + +/** + * @template T + * @param {SortableSet} set set to convert to array. + * @returns {T[]} the array format of existing set + */ +const getArray = set => Array.from(set); + +/** + * A convenience method used to sort chunks based on their id's + * @param {ChunkGroup} a first sorting comparator + * @param {ChunkGroup} b second sorting comparator + * @returns {1|0|-1} a sorting index to determine order + */ +const sortById = (a, b) => { + if (a.id < b.id) return -1; + if (b.id < a.id) return 1; + return 0; +}; + +/** + * @param {OriginRecord} a the first comparator in sort + * @param {OriginRecord} b the second comparator in sort + * @returns {1|-1|0} returns sorting order as index + */ +const sortOrigin = (a, b) => { + const aIdent = a.module ? a.module.identifier() : ""; + const bIdent = b.module ? b.module.identifier() : ""; + if (aIdent < bIdent) return -1; + if (aIdent > bIdent) return 1; + return compareLocations(a.loc, b.loc); +}; +class ChunkGroup { /** - * @returns {Set} types available (do not mutate) + * Creates an instance of ChunkGroup. + * @param {string|ChunkGroupOptions=} options chunk group options passed to chunkGroup */ - getSourceTypes() { - return TYPES; + constructor(options) { + if (typeof options === "string") { + options = { name: options }; + } else if (!options) { + options = { name: undefined }; + } + /** @type {number} */ + this.groupDebugId = debugId++; + this.options = options; + /** @type {SortableSet} */ + this._children = new SortableSet(undefined, sortById); + /** @type {SortableSet} */ + this._parents = new SortableSet(undefined, sortById); + /** @type {SortableSet} */ + this._asyncEntrypoints = new SortableSet(undefined, sortById); + this._blocks = new SortableSet(); + /** @type {Chunk[]} */ + this.chunks = []; + /** @type {OriginRecord[]} */ + this.origins = []; + /** Indices in top-down order */ + /** @private @type {Map} */ + this._modulePreOrderIndices = new Map(); + /** Indices in bottom-up order */ + /** @private @type {Map} */ + this._modulePostOrderIndices = new Map(); + /** @type {number} */ + this.index = undefined; } /** - * @returns {string} a unique identifier of the module + * when a new chunk is added to a chunkGroup, addingOptions will occur. + * @param {ChunkGroupOptions} options the chunkGroup options passed to addOptions + * @returns {void} */ - identifier() { - return `dll ${this.name}`; + addOptions(options) { + for (const key of Object.keys(options)) { + if (this.options[key] === undefined) { + this.options[key] = options[key]; + } else if (this.options[key] !== options[key]) { + if (key.endsWith("Order")) { + this.options[key] = Math.max(this.options[key], options[key]); + } else { + throw new Error( + `ChunkGroup.addOptions: No option merge strategy for ${key}` + ); + } + } + } } /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module + * returns the name of current ChunkGroup + * @returns {string|undefined} returns the ChunkGroup name */ - readableIdentifier(requestShortener) { - return `dll ${this.name}`; + get name() { + return this.options.name; } /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function + * sets a new name for current ChunkGroup + * @param {string} value the new name for ChunkGroup * @returns {void} */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = {}; - this.buildInfo = {}; - return callback(); + set name(value) { + this.options.name = value; } + /* istanbul ignore next */ /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result + * get a uniqueId for ChunkGroup, made up of its member Chunk debugId's + * @returns {string} a unique concatenation of chunk debugId's */ - codeGeneration(context) { - const sources = new Map(); - sources.set( - "javascript", - new RawSource("module.exports = __webpack_require__;") - ); - return { - sources, - runtimeRequirements: RUNTIME_REQUIREMENTS - }; + get debugId() { + return Array.from(this.chunks, x => x.debugId).join("+"); } /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} + * get a unique id for ChunkGroup, made up of its member Chunk id's + * @returns {string} a unique concatenation of chunk ids */ - needBuild(context, callback) { - return callback(null, !this.buildMeta); + get id() { + return Array.from(this.chunks, x => x.id).join("+"); } /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) + * Performs an unshift of a specific chunk + * @param {Chunk} chunk chunk being unshifted + * @returns {boolean} returns true if attempted chunk shift is accepted */ - size(type) { - return 12; + unshiftChunk(chunk) { + const oldIdx = this.chunks.indexOf(chunk); + if (oldIdx > 0) { + this.chunks.splice(oldIdx, 1); + this.chunks.unshift(chunk); + } else if (oldIdx < 0) { + this.chunks.unshift(chunk); + return true; + } + return false; } /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} + * inserts a chunk before another existing chunk in group + * @param {Chunk} chunk Chunk being inserted + * @param {Chunk} before Placeholder/target chunk marking new chunk insertion point + * @returns {boolean} return true if insertion was successful */ - updateHash(hash, context) { - hash.update(`dll module${this.name || ""}`); - super.updateHash(hash, context); + insertChunk(chunk, before) { + const oldIdx = this.chunks.indexOf(chunk); + const idx = this.chunks.indexOf(before); + if (idx < 0) { + throw new Error("before chunk not found"); + } + if (oldIdx >= 0 && oldIdx > idx) { + this.chunks.splice(oldIdx, 1); + this.chunks.splice(idx, 0, chunk); + } else if (oldIdx < 0) { + this.chunks.splice(idx, 0, chunk); + return true; + } + return false; } - serialize(context) { - context.write(this.name); - super.serialize(context); + /** + * add a chunk into ChunkGroup. Is pushed on or prepended + * @param {Chunk} chunk chunk being pushed into ChunkGroupS + * @returns {boolean} returns true if chunk addition was successful. + */ + pushChunk(chunk) { + const oldIdx = this.chunks.indexOf(chunk); + if (oldIdx >= 0) { + return false; + } + this.chunks.push(chunk); + return true; } - deserialize(context) { - this.name = context.read(); - super.deserialize(context); + /** + * @param {Chunk} oldChunk chunk to be replaced + * @param {Chunk} newChunk New chunk that will be replaced with + * @returns {boolean} returns true if the replacement was successful + */ + replaceChunk(oldChunk, newChunk) { + const oldIdx = this.chunks.indexOf(oldChunk); + if (oldIdx < 0) return false; + const newIdx = this.chunks.indexOf(newChunk); + if (newIdx < 0) { + this.chunks[oldIdx] = newChunk; + return true; + } + if (newIdx < oldIdx) { + this.chunks.splice(oldIdx, 1); + return true; + } else if (newIdx !== oldIdx) { + this.chunks[oldIdx] = newChunk; + this.chunks.splice(newIdx, 1); + return true; + } } /** - * Assuming this module is in the cache. Update the (cached) module with - * the fresh module from the factory. Usually updates internal references - * and properties. - * @param {Module} module fresh module - * @returns {void} + * @param {Chunk} chunk chunk to remove + * @returns {boolean} returns true if chunk was removed */ - updateCacheModule(module) { - super.updateCacheModule(module); - this.dependencies = module.dependencies; + removeChunk(chunk) { + const idx = this.chunks.indexOf(chunk); + if (idx >= 0) { + this.chunks.splice(idx, 1); + return true; + } + return false; } /** - * Assuming this module is in the cache. Remove internal references to allow freeing some memory. + * @returns {boolean} true, when this chunk group will be loaded on initial page load */ - cleanupForCache() { - super.cleanupForCache(); - this.dependencies = undefined; + isInitial() { + return false; } -} - -makeSerializable(DllModule, "webpack/lib/DllModule"); - -module.exports = DllModule; - - -/***/ }), -/***/ 68703: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {ChunkGroup} group chunk group to add + * @returns {boolean} returns true if chunk group was added + */ + addChild(group) { + const size = this._children.size; + this._children.add(group); + return size !== this._children.size; + } + /** + * @returns {ChunkGroup[]} returns the children of this group + */ + getChildren() { + return this._children.getFromCache(getArray); + } + getNumberOfChildren() { + return this._children.size; + } -const DllModule = __webpack_require__(28280); -const ModuleFactory = __webpack_require__(51010); + get childrenIterable() { + return this._children; + } -/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ -/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ -/** @typedef {import("./dependencies/DllEntryDependency")} DllEntryDependency */ + /** + * @param {ChunkGroup} group the chunk group to remove + * @returns {boolean} returns true if the chunk group was removed + */ + removeChild(group) { + if (!this._children.has(group)) { + return false; + } -class DllModuleFactory extends ModuleFactory { - constructor() { - super(); - this.hooks = Object.freeze({}); + this._children.delete(group); + group.removeParent(this); + return true; } + /** - * @param {ModuleFactoryCreateData} data data object - * @param {function(Error=, ModuleFactoryResult=): void} callback callback - * @returns {void} + * @param {ChunkGroup} parentChunk the parent group to be added into + * @returns {boolean} returns true if this chunk group was added to the parent group */ - create(data, callback) { - const dependency = /** @type {DllEntryDependency} */ (data.dependencies[0]); - callback(null, { - module: new DllModule( - data.context, - dependency.dependencies, - dependency.name - ) - }); + addParent(parentChunk) { + if (!this._parents.has(parentChunk)) { + this._parents.add(parentChunk); + return true; + } + return false; } -} -module.exports = DllModuleFactory; + /** + * @returns {ChunkGroup[]} returns the parents of this group + */ + getParents() { + return this._parents.getFromCache(getArray); + } + getNumberOfParents() { + return this._parents.size; + } -/***/ }), + /** + * @param {ChunkGroup} parent the parent group + * @returns {boolean} returns true if the parent group contains this group + */ + hasParent(parent) { + return this._parents.has(parent); + } -/***/ 40038: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + get parentsIterable() { + return this._parents; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {ChunkGroup} chunkGroup the parent group + * @returns {boolean} returns true if this group has been removed from the parent + */ + removeParent(chunkGroup) { + if (this._parents.delete(chunkGroup)) { + chunkGroup.removeChild(this); + return true; + } + return false; + } + /** + * @param {Entrypoint} entrypoint entrypoint to add + * @returns {boolean} returns true if entrypoint was added + */ + addAsyncEntrypoint(entrypoint) { + const size = this._asyncEntrypoints.size; + this._asyncEntrypoints.add(entrypoint); + return size !== this._asyncEntrypoints.size; + } + get asyncEntrypointsIterable() { + return this._asyncEntrypoints; + } -const DllEntryPlugin = __webpack_require__(62790); -const FlagAllModulesAsUsedPlugin = __webpack_require__(58727); -const LibManifestPlugin = __webpack_require__(93837); -const createSchemaValidation = __webpack_require__(32540); + /** + * @returns {Array} an array containing the blocks + */ + getBlocks() { + return this._blocks.getFromCache(getArray); + } -/** @typedef {import("../declarations/plugins/DllPlugin").DllPluginOptions} DllPluginOptions */ -/** @typedef {import("./Compiler")} Compiler */ + getNumberOfBlocks() { + return this._blocks.size; + } -const validate = createSchemaValidation( - __webpack_require__(9667), - () => __webpack_require__(99926), - { - name: "Dll Plugin", - baseDataPath: "options" + hasBlock(block) { + return this._blocks.has(block); } -); -class DllPlugin { /** - * @param {DllPluginOptions} options options object + * @returns {Iterable} blocks */ - constructor(options) { - validate(options); - this.options = { - ...options, - entryOnly: options.entryOnly !== false - }; + get blocksIterable() { + return this._blocks; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {AsyncDependenciesBlock} block a block + * @returns {boolean} false, if block was already added */ - apply(compiler) { - compiler.hooks.entryOption.tap("DllPlugin", (context, entry) => { - if (typeof entry !== "function") { - for (const name of Object.keys(entry)) { - const options = { - name, - filename: entry.filename - }; - new DllEntryPlugin(context, entry[name].import, options).apply( - compiler - ); - } - } else { - throw new Error( - "DllPlugin doesn't support dynamic entry (function) yet" - ); - } + addBlock(block) { + if (!this._blocks.has(block)) { + this._blocks.add(block); return true; - }); - new LibManifestPlugin(this.options).apply(compiler); - if (!this.options.entryOnly) { - new FlagAllModulesAsUsedPlugin("DllPlugin").apply(compiler); } + return false; } -} - -module.exports = DllPlugin; + /** + * @param {Module} module origin module + * @param {DependencyLocation} loc location of the reference in the origin module + * @param {string} request request name of the reference + * @returns {void} + */ + addOrigin(module, loc, request) { + this.origins.push({ + module, + loc, + request + }); + } -/***/ }), + /** + * @returns {string[]} the files contained this chunk group + */ + getFiles() { + const files = new Set(); -/***/ 90999: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + for (const chunk of this.chunks) { + for (const file of chunk.files) { + files.add(file); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + return Array.from(files); + } + /** + * @returns {void} + */ + remove() { + // cleanup parents + for (const parentChunkGroup of this._parents) { + // remove this chunk from its parents + parentChunkGroup._children.delete(this); + // cleanup "sub chunks" + for (const chunkGroup of this._children) { + /** + * remove this chunk as "intermediary" and connect + * it "sub chunks" and parents directly + */ + // add parent to each "sub chunk" + chunkGroup.addParent(parentChunkGroup); + // add "sub chunk" to parent + parentChunkGroup.addChild(chunkGroup); + } + } -const parseJson = __webpack_require__(15235); -const DelegatedModuleFactoryPlugin = __webpack_require__(51387); -const ExternalModuleFactoryPlugin = __webpack_require__(62153); -const WebpackError = __webpack_require__(53799); -const DelegatedSourceDependency = __webpack_require__(22914); -const createSchemaValidation = __webpack_require__(32540); -const makePathsRelative = (__webpack_require__(82186).makePathsRelative); + /** + * we need to iterate again over the children + * to remove this from the child's parents. + * This can not be done in the above loop + * as it is not guaranteed that `this._parents` contains anything. + */ + for (const chunkGroup of this._children) { + // remove this as parent of every "sub chunk" + chunkGroup._parents.delete(this); + } -/** @typedef {import("../declarations/WebpackOptions").Externals} Externals */ -/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptions} DllReferencePluginOptions */ -/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptionsManifest} DllReferencePluginOptionsManifest */ + // remove chunks + for (const chunk of this.chunks) { + chunk.removeGroup(this); + } + } -const validate = createSchemaValidation( - __webpack_require__(28534), - () => __webpack_require__(46552), - { - name: "Dll Reference Plugin", - baseDataPath: "options" + sortItems() { + this.origins.sort(sortOrigin); } -); -class DllReferencePlugin { /** - * @param {DllReferencePluginOptions} options options object + * Sorting predicate which allows current ChunkGroup to be compared against another. + * Sorting values are based off of number of chunks in ChunkGroup. + * + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {ChunkGroup} otherGroup the chunkGroup to compare this against + * @returns {-1|0|1} sort position for comparison */ - constructor(options) { - validate(options); - this.options = options; - /** @type {WeakMap} */ - this._compilationData = new WeakMap(); - } - - apply(compiler) { - compiler.hooks.compilation.tap( - "DllReferencePlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - DelegatedSourceDependency, - normalModuleFactory - ); - } + compareTo(chunkGraph, otherGroup) { + if (this.chunks.length > otherGroup.chunks.length) return -1; + if (this.chunks.length < otherGroup.chunks.length) return 1; + return compareIterables(compareChunks(chunkGraph))( + this.chunks, + otherGroup.chunks ); + } - compiler.hooks.beforeCompile.tapAsync( - "DllReferencePlugin", - (params, callback) => { - if ("manifest" in this.options) { - const manifest = this.options.manifest; - if (typeof manifest === "string") { - compiler.inputFileSystem.readFile(manifest, (err, result) => { - if (err) return callback(err); - const data = { - path: manifest, - data: undefined, - error: undefined - }; - // Catch errors parsing the manifest so that blank - // or malformed manifest files don't kill the process. - try { - data.data = parseJson(result.toString("utf-8")); - } catch (e) { - // Store the error in the params so that it can - // be added as a compilation error later on. - const manifestPath = makePathsRelative( - compiler.options.context, - manifest, - compiler.root - ); - data.error = new DllManifestError(manifestPath, e.message); - } - this._compilationData.set(params, data); - return callback(); - }); - return; + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {Record} mapping from children type to ordered list of ChunkGroups + */ + getChildrenByOrders(moduleGraph, chunkGraph) { + /** @type {Map} */ + const lists = new Map(); + for (const childGroup of this._children) { + for (const key of Object.keys(childGroup.options)) { + if (key.endsWith("Order")) { + const name = key.substr(0, key.length - "Order".length); + let list = lists.get(name); + if (list === undefined) { + lists.set(name, (list = [])); } + list.push({ + order: childGroup.options[key], + group: childGroup + }); } - return callback(); } - ); - - compiler.hooks.compile.tap("DllReferencePlugin", params => { - let name = this.options.name; - let sourceType = this.options.sourceType; - let content = - "content" in this.options ? this.options.content : undefined; - if ("manifest" in this.options) { - let manifestParameter = this.options.manifest; - let manifest; - if (typeof manifestParameter === "string") { - const data = this._compilationData.get(params); - // If there was an error parsing the manifest - // file, exit now because the error will be added - // as a compilation error in the "compilation" hook. - if (data.error) { - return; - } - manifest = data.data; - } else { - manifest = manifestParameter; - } - if (manifest) { - if (!name) name = manifest.name; - if (!sourceType) sourceType = manifest.type; - if (!content) content = manifest.content; - } - } - /** @type {Externals} */ - const externals = {}; - const source = "dll-reference " + name; - externals[source] = name; - const normalModuleFactory = params.normalModuleFactory; - new ExternalModuleFactoryPlugin(sourceType || "var", externals).apply( - normalModuleFactory - ); - new DelegatedModuleFactoryPlugin({ - source: source, - type: this.options.type, - scope: this.options.scope, - context: this.options.context || compiler.options.context, - content, - extensions: this.options.extensions, - associatedObjectForCache: compiler.root - }).apply(normalModuleFactory); - }); - - compiler.hooks.compilation.tap( - "DllReferencePlugin", - (compilation, params) => { - if ("manifest" in this.options) { - let manifest = this.options.manifest; - if (typeof manifest === "string") { - const data = this._compilationData.get(params); - // If there was an error parsing the manifest file, add the - // error as a compilation error to make the compilation fail. - if (data.error) { - compilation.errors.push(data.error); - } - compilation.fileDependencies.add(manifest); - } - } - } - ); + } + /** @type {Record} */ + const result = Object.create(null); + for (const [name, list] of lists) { + list.sort((a, b) => { + const cmp = b.order - a.order; + if (cmp !== 0) return cmp; + return a.group.compareTo(chunkGraph, b.group); + }); + result[name] = list.map(i => i.group); + } + return result; } -} -class DllManifestError extends WebpackError { - constructor(filename, message) { - super(); - - this.name = "DllManifestError"; - this.message = `Dll manifest ${filename}\n${message}`; + /** + * Sets the top-down index of a module in this ChunkGroup + * @param {Module} module module for which the index should be set + * @param {number} index the index of the module + * @returns {void} + */ + setModulePreOrderIndex(module, index) { + this._modulePreOrderIndices.set(module, index); } -} - -module.exports = DllReferencePlugin; - - -/***/ }), - -/***/ 96475: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Naoyuki Kanezawa @nkzawa -*/ - - - -const EntryOptionPlugin = __webpack_require__(9909); -const EntryPlugin = __webpack_require__(96953); -const EntryDependency = __webpack_require__(3979); - -/** @typedef {import("../declarations/WebpackOptions").EntryDynamicNormalized} EntryDynamic */ -/** @typedef {import("../declarations/WebpackOptions").EntryItem} EntryItem */ -/** @typedef {import("../declarations/WebpackOptions").EntryStaticNormalized} EntryStatic */ -/** @typedef {import("./Compiler")} Compiler */ -class DynamicEntryPlugin { /** - * @param {string} context the context path - * @param {EntryDynamic} entry the entry value + * Gets the top-down index of a module in this ChunkGroup + * @param {Module} module the module + * @returns {number} index */ - constructor(context, entry) { - this.context = context; - this.entry = entry; + getModulePreOrderIndex(module) { + return this._modulePreOrderIndices.get(module); } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * Sets the bottom-up index of a module in this ChunkGroup + * @param {Module} module module for which the index should be set + * @param {number} index the index of the module * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap( - "DynamicEntryPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - EntryDependency, - normalModuleFactory + setModulePostOrderIndex(module, index) { + this._modulePostOrderIndices.set(module, index); + } + + /** + * Gets the bottom-up index of a module in this ChunkGroup + * @param {Module} module the module + * @returns {number} index + */ + getModulePostOrderIndex(module) { + return this._modulePostOrderIndices.get(module); + } + + /* istanbul ignore next */ + checkConstraints() { + const chunk = this; + for (const child of chunk._children) { + if (!child._parents.has(chunk)) { + throw new Error( + `checkConstraints: child missing parent ${chunk.debugId} -> ${child.debugId}` ); } - ); - - compiler.hooks.make.tapPromise( - "DynamicEntryPlugin", - (compilation, callback) => - Promise.resolve(this.entry()) - .then(entry => { - const promises = []; - for (const name of Object.keys(entry)) { - const desc = entry[name]; - const options = EntryOptionPlugin.entryDescriptionToOptions( - compiler, - name, - desc - ); - for (const entry of desc.import) { - promises.push( - new Promise((resolve, reject) => { - compilation.addEntry( - this.context, - EntryPlugin.createDependency(entry, options), - options, - err => { - if (err) return reject(err); - resolve(); - } - ); - }) - ); - } - } - return Promise.all(promises); - }) - .then(x => {}) - ); + } + for (const parentChunk of chunk._parents) { + if (!parentChunk._children.has(chunk)) { + throw new Error( + `checkConstraints: parent missing child ${parentChunk.debugId} <- ${chunk.debugId}` + ); + } + } } } -module.exports = DynamicEntryPlugin; +ChunkGroup.prototype.getModuleIndex = util.deprecate( + ChunkGroup.prototype.getModulePreOrderIndex, + "ChunkGroup.getModuleIndex was renamed to getModulePreOrderIndex", + "DEP_WEBPACK_CHUNK_GROUP_GET_MODULE_INDEX" +); + +ChunkGroup.prototype.getModuleIndex2 = util.deprecate( + ChunkGroup.prototype.getModulePostOrderIndex, + "ChunkGroup.getModuleIndex2 was renamed to getModulePostOrderIndex", + "DEP_WEBPACK_CHUNK_GROUP_GET_MODULE_INDEX_2" +); + +module.exports = ChunkGroup; /***/ }), -/***/ 9909: +/***/ 918: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -33540,96 +28562,35 @@ module.exports = DynamicEntryPlugin; -/** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescription */ -/** @typedef {import("../declarations/WebpackOptions").EntryNormalized} Entry */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ +const WebpackError = __webpack_require__(53799); -class EntryOptionPlugin { - /** - * @param {Compiler} compiler the compiler instance one is tapping into - * @returns {void} - */ - apply(compiler) { - compiler.hooks.entryOption.tap("EntryOptionPlugin", (context, entry) => { - EntryOptionPlugin.applyEntryOption(compiler, context, entry); - return true; - }); - } +/** @typedef {import("./Chunk")} Chunk */ +class ChunkRenderError extends WebpackError { /** - * @param {Compiler} compiler the compiler - * @param {string} context context directory - * @param {Entry} entry request - * @returns {void} + * Create a new ChunkRenderError + * @param {Chunk} chunk A chunk + * @param {string} file Related file + * @param {Error} error Original error */ - static applyEntryOption(compiler, context, entry) { - if (typeof entry === "function") { - const DynamicEntryPlugin = __webpack_require__(96475); - new DynamicEntryPlugin(context, entry).apply(compiler); - } else { - const EntryPlugin = __webpack_require__(96953); - for (const name of Object.keys(entry)) { - const desc = entry[name]; - const options = EntryOptionPlugin.entryDescriptionToOptions( - compiler, - name, - desc - ); - for (const entry of desc.import) { - new EntryPlugin(context, entry, options).apply(compiler); - } - } - } - } + constructor(chunk, file, error) { + super(); - /** - * @param {Compiler} compiler the compiler - * @param {string} name entry name - * @param {EntryDescription} desc entry description - * @returns {EntryOptions} options for the entry - */ - static entryDescriptionToOptions(compiler, name, desc) { - /** @type {EntryOptions} */ - const options = { - name, - filename: desc.filename, - runtime: desc.runtime, - layer: desc.layer, - dependOn: desc.dependOn, - publicPath: desc.publicPath, - chunkLoading: desc.chunkLoading, - asyncChunks: desc.asyncChunks, - wasmLoading: desc.wasmLoading, - library: desc.library - }; - if (desc.layer !== undefined && !compiler.options.experiments.layers) { - throw new Error( - "'entryOptions.layer' is only allowed when 'experiments.layers' is enabled" - ); - } - if (desc.chunkLoading) { - const EnableChunkLoadingPlugin = __webpack_require__(61291); - EnableChunkLoadingPlugin.checkEnabled(compiler, desc.chunkLoading); - } - if (desc.wasmLoading) { - const EnableWasmLoadingPlugin = __webpack_require__(78613); - EnableWasmLoadingPlugin.checkEnabled(compiler, desc.wasmLoading); - } - if (desc.library) { - const EnableLibraryPlugin = __webpack_require__(91452); - EnableLibraryPlugin.checkEnabled(compiler, desc.library.type); - } - return options; + this.name = "ChunkRenderError"; + this.error = error; + this.message = error.message; + this.details = error.stack; + this.file = file; + this.chunk = chunk; } } -module.exports = EntryOptionPlugin; +module.exports = ChunkRenderError; /***/ }), -/***/ 96953: +/***/ 46341: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -33640,208 +28601,427 @@ module.exports = EntryOptionPlugin; -const EntryDependency = __webpack_require__(3979); +const util = __webpack_require__(73837); +const memoize = __webpack_require__(78676); -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ +/** @typedef {import("../declarations/WebpackOptions").Output} OutputOptions */ +/** @typedef {import("./Compilation")} Compilation */ -class EntryPlugin { - /** - * An entry plugin which will handle - * creation of the EntryDependency - * - * @param {string} context context path - * @param {string} entry entry path - * @param {EntryOptions | string=} options entry options (passing a string is deprecated) - */ - constructor(context, entry, options) { - this.context = context; - this.entry = entry; - this.options = options || ""; - } +const getJavascriptModulesPlugin = memoize(() => + __webpack_require__(89464) +); +// TODO webpack 6 remove this class +class ChunkTemplate { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {OutputOptions} outputOptions output options + * @param {Compilation} compilation the compilation */ - apply(compiler) { - compiler.hooks.compilation.tap( - "EntryPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - EntryDependency, - normalModuleFactory - ); + constructor(outputOptions, compilation) { + this._outputOptions = outputOptions || {}; + this.hooks = Object.freeze({ + renderManifest: { + tap: util.deprecate( + (options, fn) => { + compilation.hooks.renderManifest.tap( + options, + (entries, options) => { + if (options.chunk.hasRuntime()) return entries; + return fn(entries, options); + } + ); + }, + "ChunkTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)", + "DEP_WEBPACK_CHUNK_TEMPLATE_RENDER_MANIFEST" + ) + }, + modules: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .renderChunk.tap(options, (source, renderContext) => + fn( + source, + compilation.moduleTemplates.javascript, + renderContext + ) + ); + }, + "ChunkTemplate.hooks.modules is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderChunk instead)", + "DEP_WEBPACK_CHUNK_TEMPLATE_MODULES" + ) + }, + render: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .renderChunk.tap(options, (source, renderContext) => + fn( + source, + compilation.moduleTemplates.javascript, + renderContext + ) + ); + }, + "ChunkTemplate.hooks.render is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderChunk instead)", + "DEP_WEBPACK_CHUNK_TEMPLATE_RENDER" + ) + }, + renderWithEntry: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .render.tap(options, (source, renderContext) => { + if ( + renderContext.chunkGraph.getNumberOfEntryModules( + renderContext.chunk + ) === 0 || + renderContext.chunk.hasRuntime() + ) { + return source; + } + return fn(source, renderContext.chunk); + }); + }, + "ChunkTemplate.hooks.renderWithEntry is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)", + "DEP_WEBPACK_CHUNK_TEMPLATE_RENDER_WITH_ENTRY" + ) + }, + hash: { + tap: util.deprecate( + (options, fn) => { + compilation.hooks.fullHash.tap(options, fn); + }, + "ChunkTemplate.hooks.hash is deprecated (use Compilation.hooks.fullHash instead)", + "DEP_WEBPACK_CHUNK_TEMPLATE_HASH" + ) + }, + hashForChunk: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .chunkHash.tap(options, (chunk, hash, context) => { + if (chunk.hasRuntime()) return; + fn(hash, chunk, context); + }); + }, + "ChunkTemplate.hooks.hashForChunk is deprecated (use JavascriptModulesPlugin.getCompilationHooks().chunkHash instead)", + "DEP_WEBPACK_CHUNK_TEMPLATE_HASH_FOR_CHUNK" + ) } - ); - - const { entry, options, context } = this; - const dep = EntryPlugin.createDependency(entry, options); - - compiler.hooks.make.tapAsync("EntryPlugin", (compilation, callback) => { - compilation.addEntry(context, dep, options, err => { - callback(err); - }); }); } - - /** - * @param {string} entry entry request - * @param {EntryOptions | string} options entry options (passing string is deprecated) - * @returns {EntryDependency} the dependency - */ - static createDependency(entry, options) { - const dep = new EntryDependency(entry); - // TODO webpack 6 remove string option - dep.loc = { name: typeof options === "object" ? options.name : options }; - return dep; - } } -module.exports = EntryPlugin; +Object.defineProperty(ChunkTemplate.prototype, "outputOptions", { + get: util.deprecate( + /** + * @this {ChunkTemplate} + * @returns {OutputOptions} output options + */ + function () { + return this._outputOptions; + }, + "ChunkTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)", + "DEP_WEBPACK_CHUNK_TEMPLATE_OUTPUT_OPTIONS" + ) +}); + +module.exports = ChunkTemplate; /***/ }), -/***/ 13795: +/***/ 31085: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Sergey Melyukov @smelukov */ -const ChunkGroup = __webpack_require__(15626); +const asyncLib = __webpack_require__(78175); +const { SyncBailHook } = __webpack_require__(41242); +const Compilation = __webpack_require__(85720); +const createSchemaValidation = __webpack_require__(32540); +const { join } = __webpack_require__(17139); +const processAsyncTree = __webpack_require__(42791); -/** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescription */ -/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("../declarations/WebpackOptions").CleanOptions} CleanOptions */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./logging/Logger").Logger} Logger */ +/** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */ +/** @typedef {import("./util/fs").StatsCallback} StatsCallback */ -/** @typedef {{ name?: string } & Omit} EntryOptions */ +/** @typedef {(function(string):boolean)|RegExp} IgnoreItem */ +/** @typedef {function(IgnoreItem): void} AddToIgnoreCallback */ /** - * Entrypoint serves as an encapsulation primitive for chunks that are - * a part of a single ChunkGroup. They represent all bundles that need to be loaded for a - * single instance of a page. Multi-page application architectures will typically yield multiple Entrypoint objects - * inside of the compilation, whereas a Single Page App may only contain one with many lazy-loaded chunks. + * @typedef {Object} CleanPluginCompilationHooks + * @property {SyncBailHook<[string], boolean>} keep when returning true the file/directory will be kept during cleaning, returning false will clean it and ignore the following plugins and config */ -class Entrypoint extends ChunkGroup { - /** - * Creates an instance of Entrypoint. - * @param {EntryOptions | string} entryOptions the options for the entrypoint (or name) - * @param {boolean=} initial false, when the entrypoint is not initial loaded - */ - constructor(entryOptions, initial = true) { - if (typeof entryOptions === "string") { - entryOptions = { name: entryOptions }; - } - super({ - name: entryOptions.name - }); - this.options = entryOptions; - /** @type {Chunk=} */ - this._runtimeChunk = undefined; - /** @type {Chunk=} */ - this._entrypointChunk = undefined; - /** @type {boolean} */ - this._initial = initial; - } - /** - * @returns {boolean} true, when this chunk group will be loaded on initial page load - */ - isInitial() { - return this._initial; +const validate = createSchemaValidation( + undefined, + () => { + const { definitions } = __webpack_require__(73342); + return { + definitions, + oneOf: [{ $ref: "#/definitions/CleanOptions" }] + }; + }, + { + name: "Clean Plugin", + baseDataPath: "options" } +); - /** - * Sets the runtimeChunk for an entrypoint. - * @param {Chunk} chunk the chunk being set as the runtime chunk. - * @returns {void} - */ - setRuntimeChunk(chunk) { - this._runtimeChunk = chunk; +/** + * @param {OutputFileSystem} fs filesystem + * @param {string} outputPath output path + * @param {Set} currentAssets filename of the current assets (must not start with .. or ., must only use / as path separator) + * @param {function((Error | null)=, Set=): void} callback returns the filenames of the assets that shouldn't be there + * @returns {void} + */ +const getDiffToFs = (fs, outputPath, currentAssets, callback) => { + const directories = new Set(); + // get directories of assets + for (const asset of currentAssets) { + directories.add(asset.replace(/(^|\/)[^/]*$/, "")); + } + // and all parent directories + for (const directory of directories) { + directories.add(directory.replace(/(^|\/)[^/]*$/, "")); } + const diff = new Set(); + asyncLib.forEachLimit( + directories, + 10, + (directory, callback) => { + fs.readdir(join(fs, outputPath, directory), (err, entries) => { + if (err) { + if (err.code === "ENOENT") return callback(); + if (err.code === "ENOTDIR") { + diff.add(directory); + return callback(); + } + return callback(err); + } + for (const entry of entries) { + const file = /** @type {string} */ (entry); + const filename = directory ? `${directory}/${file}` : file; + if (!directories.has(filename) && !currentAssets.has(filename)) { + diff.add(filename); + } + } + callback(); + }); + }, + err => { + if (err) return callback(err); - /** - * Fetches the chunk reference containing the webpack bootstrap code - * @returns {Chunk | null} returns the runtime chunk or null if there is none - */ - getRuntimeChunk() { - if (this._runtimeChunk) return this._runtimeChunk; - for (const parent of this.parentsIterable) { - if (parent instanceof Entrypoint) return parent.getRuntimeChunk(); + callback(null, diff); } - return null; - } + ); +}; - /** - * Sets the chunk with the entrypoint modules for an entrypoint. - * @param {Chunk} chunk the chunk being set as the entrypoint chunk. - * @returns {void} - */ - setEntrypointChunk(chunk) { - this._entrypointChunk = chunk; +/** + * @param {Set} currentAssets assets list + * @param {Set} oldAssets old assets list + * @returns {Set} diff + */ +const getDiffToOldAssets = (currentAssets, oldAssets) => { + const diff = new Set(); + for (const asset of oldAssets) { + if (!currentAssets.has(asset)) diff.add(asset); } + return diff; +}; - /** - * Returns the chunk which contains the entrypoint modules - * (or at least the execution of them) - * @returns {Chunk} chunk - */ - getEntrypointChunk() { - return this._entrypointChunk; +/** + * @param {OutputFileSystem} fs filesystem + * @param {string} filename path to file + * @param {StatsCallback} callback callback for provided filename + * @returns {void} + */ +const doStat = (fs, filename, callback) => { + if ("lstat" in fs) { + fs.lstat(filename, callback); + } else { + fs.stat(filename, callback); } +}; + +/** + * @param {OutputFileSystem} fs filesystem + * @param {string} outputPath output path + * @param {boolean} dry only log instead of fs modification + * @param {Logger} logger logger + * @param {Set} diff filenames of the assets that shouldn't be there + * @param {function(string): boolean} isKept check if the entry is ignored + * @param {function(Error=): void} callback callback + * @returns {void} + */ +const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => { + const log = msg => { + if (dry) { + logger.info(msg); + } else { + logger.log(msg); + } + }; + /** @typedef {{ type: "check" | "unlink" | "rmdir", filename: string, parent: { remaining: number, job: Job } | undefined }} Job */ + /** @type {Job[]} */ + const jobs = Array.from(diff, filename => ({ + type: "check", + filename, + parent: undefined + })); + processAsyncTree( + jobs, + 10, + ({ type, filename, parent }, push, callback) => { + const handleError = err => { + if (err.code === "ENOENT") { + log(`${filename} was removed during cleaning by something else`); + handleParent(); + return callback(); + } + return callback(err); + }; + const handleParent = () => { + if (parent && --parent.remaining === 0) push(parent.job); + }; + const path = join(fs, outputPath, filename); + switch (type) { + case "check": + if (isKept(filename)) { + // do not decrement parent entry as we don't want to delete the parent + log(`${filename} will be kept`); + return process.nextTick(callback); + } + doStat(fs, path, (err, stats) => { + if (err) return handleError(err); + if (!stats.isDirectory()) { + push({ + type: "unlink", + filename, + parent + }); + return callback(); + } + fs.readdir(path, (err, entries) => { + if (err) return handleError(err); + /** @type {Job} */ + const deleteJob = { + type: "rmdir", + filename, + parent + }; + if (entries.length === 0) { + push(deleteJob); + } else { + const parentToken = { + remaining: entries.length, + job: deleteJob + }; + for (const entry of entries) { + const file = /** @type {string} */ (entry); + if (file.startsWith(".")) { + log( + `${filename} will be kept (dot-files will never be removed)` + ); + continue; + } + push({ + type: "check", + filename: `${filename}/${file}`, + parent: parentToken + }); + } + } + return callback(); + }); + }); + break; + case "rmdir": + log(`${filename} will be removed`); + if (dry) { + handleParent(); + return process.nextTick(callback); + } + if (!fs.rmdir) { + logger.warn( + `${filename} can't be removed because output file system doesn't support removing directories (rmdir)` + ); + return process.nextTick(callback); + } + fs.rmdir(path, err => { + if (err) return handleError(err); + handleParent(); + callback(); + }); + break; + case "unlink": + log(`${filename} will be removed`); + if (dry) { + handleParent(); + return process.nextTick(callback); + } + if (!fs.unlink) { + logger.warn( + `${filename} can't be removed because output file system doesn't support removing files (rmdir)` + ); + return process.nextTick(callback); + } + fs.unlink(path, err => { + if (err) return handleError(err); + handleParent(); + callback(); + }); + break; + } + }, + callback + ); +}; + +/** @type {WeakMap} */ +const compilationHooksMap = new WeakMap(); +class CleanPlugin { /** - * @param {Chunk} oldChunk chunk to be replaced - * @param {Chunk} newChunk New chunk that will be replaced with - * @returns {boolean} returns true if the replacement was successful + * @param {Compilation} compilation the compilation + * @returns {CleanPluginCompilationHooks} the attached hooks */ - replaceChunk(oldChunk, newChunk) { - if (this._runtimeChunk === oldChunk) this._runtimeChunk = newChunk; - if (this._entrypointChunk === oldChunk) this._entrypointChunk = newChunk; - return super.replaceChunk(oldChunk, newChunk); + static getCompilationHooks(compilation) { + if (!(compilation instanceof Compilation)) { + throw new TypeError( + "The 'compilation' argument must be an instance of Compilation" + ); + } + let hooks = compilationHooksMap.get(compilation); + if (hooks === undefined) { + hooks = { + /** @type {SyncBailHook<[string], boolean>} */ + keep: new SyncBailHook(["ignore"]) + }; + compilationHooksMap.set(compilation, hooks); + } + return hooks; } -} - -module.exports = Entrypoint; - - -/***/ }), - -/***/ 22070: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Authors Simen Brekken @simenbrekken, Einar Löve @einarlove -*/ - - - -const DefinePlugin = __webpack_require__(79065); -const WebpackError = __webpack_require__(53799); - -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./DefinePlugin").CodeValue} CodeValue */ -class EnvironmentPlugin { - constructor(...keys) { - if (keys.length === 1 && Array.isArray(keys[0])) { - this.keys = keys[0]; - this.defaultValues = {}; - } else if (keys.length === 1 && keys[0] && typeof keys[0] === "object") { - this.keys = Object.keys(keys[0]); - this.defaultValues = keys[0]; - } else { - this.keys = keys; - this.defaultValues = {}; - } + /** @param {CleanOptions} options options */ + constructor(options = {}) { + validate(options); + this.options = { dry: false, ...options }; } /** @@ -33850,42 +29030,96 @@ class EnvironmentPlugin { * @returns {void} */ apply(compiler) { - /** @type {Record} */ - const definitions = {}; - for (const key of this.keys) { - const value = - process.env[key] !== undefined - ? process.env[key] - : this.defaultValues[key]; + const { dry, keep } = this.options; - if (value === undefined) { - compiler.hooks.thisCompilation.tap("EnvironmentPlugin", compilation => { - const error = new WebpackError( - `EnvironmentPlugin - ${key} environment variable is undefined.\n\n` + - "You can pass an object with default values to suppress this warning.\n" + - "See https://webpack.js.org/plugins/environment-plugin for example." + const keepFn = + typeof keep === "function" + ? keep + : typeof keep === "string" + ? path => path.startsWith(keep) + : typeof keep === "object" && keep.test + ? path => keep.test(path) + : () => false; + + // We assume that no external modification happens while the compiler is active + // So we can store the old assets and only diff to them to avoid fs access on + // incremental builds + let oldAssets; + + compiler.hooks.emit.tapAsync( + { + name: "CleanPlugin", + stage: 100 + }, + (compilation, callback) => { + const hooks = CleanPlugin.getCompilationHooks(compilation); + const logger = compilation.getLogger("webpack.CleanPlugin"); + const fs = compiler.outputFileSystem; + + if (!fs.readdir) { + return callback( + new Error( + "CleanPlugin: Output filesystem doesn't support listing directories (readdir)" + ) ); + } - error.name = "EnvVariableNotDefinedError"; - compilation.errors.push(error); - }); - } + const currentAssets = new Set(); + for (const asset of Object.keys(compilation.assets)) { + if (/^[A-Za-z]:\\|^\/|^\\\\/.test(asset)) continue; + let normalizedAsset; + let newNormalizedAsset = asset.replace(/\\/g, "/"); + do { + normalizedAsset = newNormalizedAsset; + newNormalizedAsset = normalizedAsset.replace( + /(^|\/)(?!\.\.)[^/]+\/\.\.\//g, + "$1" + ); + } while (newNormalizedAsset !== normalizedAsset); + if (normalizedAsset.startsWith("../")) continue; + currentAssets.add(normalizedAsset); + } - definitions[`process.env.${key}`] = - value === undefined ? "undefined" : JSON.stringify(value); - } + const outputPath = compilation.getPath(compiler.outputPath, {}); - new DefinePlugin(definitions).apply(compiler); + const isKept = path => { + const result = hooks.keep.call(path); + if (result !== undefined) return result; + return keepFn(path); + }; + + const diffCallback = (err, diff) => { + if (err) { + oldAssets = undefined; + return callback(err); + } + applyDiff(fs, outputPath, dry, logger, diff, isKept, err => { + if (err) { + oldAssets = undefined; + } else { + oldAssets = currentAssets; + } + callback(err); + }); + }; + + if (oldAssets) { + diffCallback(null, getDiffToOldAssets(currentAssets, oldAssets)); + } else { + getDiffToFs(fs, outputPath, currentAssets, diffCallback); + } + } + ); } } -module.exports = EnvironmentPlugin; +module.exports = CleanPlugin; /***/ }), -/***/ 59985: -/***/ (function(__unused_webpack_module, exports) { +/***/ 2102: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -33895,65 +29129,33 @@ module.exports = EnvironmentPlugin; -const loaderFlag = "LOADER_EXECUTION"; - -const webpackOptionsFlag = "WEBPACK_OPTIONS"; - -exports.cutOffByFlag = (stack, flag) => { - stack = stack.split("\n"); - for (let i = 0; i < stack.length; i++) { - if (stack[i].includes(flag)) { - stack.length = i; - } - } - return stack.join("\n"); -}; - -exports.cutOffLoaderExecution = stack => - exports.cutOffByFlag(stack, loaderFlag); - -exports.cutOffWebpackOptions = stack => - exports.cutOffByFlag(stack, webpackOptionsFlag); - -exports.cutOffMultilineMessage = (stack, message) => { - stack = stack.split("\n"); - message = message.split("\n"); - - const result = []; +const WebpackError = __webpack_require__(53799); - stack.forEach((line, idx) => { - if (!line.includes(message[idx])) result.push(line); - }); +/** @typedef {import("./Module")} Module */ - return result.join("\n"); -}; +class CodeGenerationError extends WebpackError { + /** + * Create a new CodeGenerationError + * @param {Module} module related module + * @param {Error} error Original error + */ + constructor(module, error) { + super(); -exports.cutOffMessage = (stack, message) => { - const nextLine = stack.indexOf("\n"); - if (nextLine === -1) { - return stack === message ? "" : stack; - } else { - const firstLine = stack.substr(0, nextLine); - return firstLine === message ? stack.substr(nextLine + 1) : stack; + this.name = "CodeGenerationError"; + this.error = error; + this.message = error.message; + this.details = error.stack; + this.module = module; } -}; - -exports.cleanUp = (stack, message) => { - stack = exports.cutOffLoaderExecution(stack); - stack = exports.cutOffMessage(stack, message); - return stack; -}; +} -exports.cleanUpWebpackOptions = (stack, message) => { - stack = exports.cutOffWebpackOptions(stack); - stack = exports.cutOffMultilineMessage(stack, message); - return stack; -}; +module.exports = CodeGenerationError; /***/ }), -/***/ 65218: +/***/ 71426: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -33964,121 +29166,159 @@ exports.cleanUpWebpackOptions = (stack, message) => { -const { ConcatSource, RawSource } = __webpack_require__(51255); -const ExternalModule = __webpack_require__(73071); -const ModuleFilenameHelpers = __webpack_require__(88821); -const RuntimeGlobals = __webpack_require__(16475); -const JavascriptModulesPlugin = __webpack_require__(89464); +const { provide } = __webpack_require__(82482); +const { first } = __webpack_require__(93347); +const createHash = __webpack_require__(49835); +const { runtimeToString, RuntimeSpecMap } = __webpack_require__(17156); /** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("./Compiler")} Compiler */ - -/** @type {WeakMap} */ -const cache = new WeakMap(); - -const devtoolWarning = new RawSource(`/* - * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). - * This devtool is neither made for production nor for readable output files. - * It uses "eval()" calls to create a separate source file in the browser devtools. - * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) - * or disable the default devtool with "devtool: false". - * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). - */ -`); +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {typeof import("./util/Hash")} Hash */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ -class EvalDevToolModulePlugin { - constructor(options) { - this.namespace = options.namespace || ""; - this.sourceUrlComment = options.sourceUrlComment || "\n//# sourceURL=[url]"; - this.moduleFilenameTemplate = - options.moduleFilenameTemplate || - "webpack://[namespace]/[resourcePath]?[loaders]"; +class CodeGenerationResults { + /** + * @param {string | Hash} hashFunction the hash function to use + */ + constructor(hashFunction = "md4") { + /** @type {Map>} */ + this.map = new Map(); + this._hashFunction = hashFunction; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {Module} module the module + * @param {RuntimeSpec} runtime runtime(s) + * @returns {CodeGenerationResult} the CodeGenerationResult */ - apply(compiler) { - compiler.hooks.compilation.tap("EvalDevToolModulePlugin", compilation => { - const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); - hooks.renderModuleContent.tap( - "EvalDevToolModulePlugin", - (source, module, { runtimeTemplate, chunkGraph }) => { - const cacheEntry = cache.get(source); - if (cacheEntry !== undefined) return cacheEntry; - if (module instanceof ExternalModule) { - cache.set(source, source); - return source; - } - const content = source.source(); - const str = ModuleFilenameHelpers.createFilename( - module, - { - moduleFilenameTemplate: this.moduleFilenameTemplate, - namespace: this.namespace - }, - { - requestShortener: runtimeTemplate.requestShortener, - chunkGraph, - hashFunction: compilation.outputOptions.hashFunction - } - ); - const footer = - "\n" + - this.sourceUrlComment.replace( - /\[url\]/g, - encodeURI(str) - .replace(/%2F/g, "/") - .replace(/%20/g, "_") - .replace(/%5E/g, "^") - .replace(/%5C/g, "\\") - .replace(/^\//, "") - ); - const result = new RawSource( - `eval(${ - compilation.outputOptions.trustedTypes - ? `${RuntimeGlobals.createScript}(${JSON.stringify( - content + footer - )})` - : JSON.stringify(content + footer) - });` + get(module, runtime) { + const entry = this.map.get(module); + if (entry === undefined) { + throw new Error( + `No code generation entry for ${module.identifier()} (existing entries: ${Array.from( + this.map.keys(), + m => m.identifier() + ).join(", ")})` + ); + } + if (runtime === undefined) { + if (entry.size > 1) { + const results = new Set(entry.values()); + if (results.size !== 1) { + throw new Error( + `No unique code generation entry for unspecified runtime for ${module.identifier()} (existing runtimes: ${Array.from( + entry.keys(), + r => runtimeToString(r) + ).join(", ")}). +Caller might not support runtime-dependent code generation (opt-out via optimization.usedExports: "global").` ); - cache.set(source, result); - return result; } - ); - hooks.inlineInRuntimeBailout.tap( - "EvalDevToolModulePlugin", - () => "the eval devtool is used." - ); - hooks.render.tap( - "EvalDevToolModulePlugin", - source => new ConcatSource(devtoolWarning, source) - ); - hooks.chunkHash.tap("EvalDevToolModulePlugin", (chunk, hash) => { - hash.update("EvalDevToolModulePlugin"); - hash.update("2"); - }); - if (compilation.outputOptions.trustedTypes) { - compilation.hooks.additionalModuleRuntimeRequirements.tap( - "EvalDevToolModulePlugin", - (module, set, context) => { - set.add(RuntimeGlobals.createScript); - } - ); + return first(results); } - }); + return entry.values().next().value; + } + const result = entry.get(runtime); + if (result === undefined) { + throw new Error( + `No code generation entry for runtime ${runtimeToString( + runtime + )} for ${module.identifier()} (existing runtimes: ${Array.from( + entry.keys(), + r => runtimeToString(r) + ).join(", ")})` + ); + } + return result; + } + + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime runtime(s) + * @returns {boolean} true, when we have data for this + */ + has(module, runtime) { + const entry = this.map.get(module); + if (entry === undefined) { + return false; + } + if (runtime !== undefined) { + return entry.has(runtime); + } else if (entry.size > 1) { + const results = new Set(entry.values()); + return results.size === 1; + } else { + return entry.size === 1; + } + } + + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime runtime(s) + * @param {string} sourceType the source type + * @returns {Source} a source + */ + getSource(module, runtime, sourceType) { + return this.get(module, runtime).sources.get(sourceType); + } + + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime runtime(s) + * @returns {ReadonlySet} runtime requirements + */ + getRuntimeRequirements(module, runtime) { + return this.get(module, runtime).runtimeRequirements; + } + + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime runtime(s) + * @param {string} key data key + * @returns {any} data generated by code generation + */ + getData(module, runtime, key) { + const data = this.get(module, runtime).data; + return data === undefined ? undefined : data.get(key); + } + + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime runtime(s) + * @returns {any} hash of the code generation + */ + getHash(module, runtime) { + const info = this.get(module, runtime); + if (info.hash !== undefined) return info.hash; + const hash = createHash(this._hashFunction); + for (const [type, source] of info.sources) { + hash.update(type); + source.updateHash(hash); + } + if (info.runtimeRequirements) { + for (const rr of info.runtimeRequirements) hash.update(rr); + } + return (info.hash = /** @type {string} */ (hash.digest("hex"))); + } + + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime runtime(s) + * @param {CodeGenerationResult} result result from module + * @returns {void} + */ + add(module, runtime, result) { + const map = provide(this.map, module, () => new RuntimeSpecMap()); + map.set(runtime, result); } } -module.exports = EvalDevToolModulePlugin; +module.exports = CodeGenerationResults; /***/ }), -/***/ 14790: +/***/ 98427: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -34089,210 +29329,37 @@ module.exports = EvalDevToolModulePlugin; -const { ConcatSource, RawSource } = __webpack_require__(51255); -const ModuleFilenameHelpers = __webpack_require__(88821); -const NormalModule = __webpack_require__(39); -const RuntimeGlobals = __webpack_require__(16475); -const SourceMapDevToolModuleOptionsPlugin = __webpack_require__(97513); -const JavascriptModulesPlugin = __webpack_require__(89464); -const ConcatenatedModule = __webpack_require__(97198); -const { makePathsAbsolute } = __webpack_require__(82186); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").DevTool} DevToolOptions */ -/** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */ -/** @typedef {import("./Compiler")} Compiler */ - -/** @type {WeakMap} */ -const cache = new WeakMap(); - -const devtoolWarning = new RawSource(`/* - * ATTENTION: An "eval-source-map" devtool has been used. - * This devtool is neither made for production nor for readable output files. - * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools. - * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) - * or disable the default devtool with "devtool: false". - * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). - */ -`); +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); -class EvalSourceMapDevToolPlugin { - /** - * @param {SourceMapDevToolPluginOptions|string} inputOptions Options object - */ - constructor(inputOptions) { - /** @type {SourceMapDevToolPluginOptions} */ - let options; - if (typeof inputOptions === "string") { - options = { - append: inputOptions - }; - } else { - options = inputOptions; - } - this.sourceMapComment = - options.append || "//# sourceURL=[module]\n//# sourceMappingURL=[url]"; - this.moduleFilenameTemplate = - options.moduleFilenameTemplate || - "webpack://[namespace]/[resource-path]?[hash]"; - this.namespace = options.namespace || ""; - this.options = options; - } +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +class CommentCompilationWarning extends WebpackError { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * + * @param {string} message warning message + * @param {DependencyLocation} loc affected lines of code */ - apply(compiler) { - const options = this.options; - compiler.hooks.compilation.tap( - "EvalSourceMapDevToolPlugin", - compilation => { - const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); - new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation); - const matchModule = ModuleFilenameHelpers.matchObject.bind( - ModuleFilenameHelpers, - options - ); - hooks.renderModuleContent.tap( - "EvalSourceMapDevToolPlugin", - (source, m, { runtimeTemplate, chunkGraph }) => { - const cachedSource = cache.get(source); - if (cachedSource !== undefined) { - return cachedSource; - } - - const result = r => { - cache.set(source, r); - return r; - }; - - if (m instanceof NormalModule) { - const module = /** @type {NormalModule} */ (m); - if (!matchModule(module.resource)) { - return result(source); - } - } else if (m instanceof ConcatenatedModule) { - const concatModule = /** @type {ConcatenatedModule} */ (m); - if (concatModule.rootModule instanceof NormalModule) { - const module = /** @type {NormalModule} */ ( - concatModule.rootModule - ); - if (!matchModule(module.resource)) { - return result(source); - } - } else { - return result(source); - } - } else { - return result(source); - } - - /** @type {{ [key: string]: TODO; }} */ - let sourceMap; - let content; - if (source.sourceAndMap) { - const sourceAndMap = source.sourceAndMap(options); - sourceMap = sourceAndMap.map; - content = sourceAndMap.source; - } else { - sourceMap = source.map(options); - content = source.source(); - } - if (!sourceMap) { - return result(source); - } - - // Clone (flat) the sourcemap to ensure that the mutations below do not persist. - sourceMap = { ...sourceMap }; - const context = compiler.options.context; - const root = compiler.root; - const modules = sourceMap.sources.map(source => { - if (!source.startsWith("webpack://")) return source; - source = makePathsAbsolute(context, source.slice(10), root); - const module = compilation.findModule(source); - return module || source; - }); - let moduleFilenames = modules.map(module => { - return ModuleFilenameHelpers.createFilename( - module, - { - moduleFilenameTemplate: this.moduleFilenameTemplate, - namespace: this.namespace - }, - { - requestShortener: runtimeTemplate.requestShortener, - chunkGraph, - hashFunction: compilation.outputOptions.hashFunction - } - ); - }); - moduleFilenames = ModuleFilenameHelpers.replaceDuplicates( - moduleFilenames, - (filename, i, n) => { - for (let j = 0; j < n; j++) filename += "*"; - return filename; - } - ); - sourceMap.sources = moduleFilenames; - sourceMap.sourceRoot = options.sourceRoot || ""; - const moduleId = chunkGraph.getModuleId(m); - sourceMap.file = `${moduleId}.js`; + constructor(message, loc) { + super(message); - const footer = - this.sourceMapComment.replace( - /\[url\]/g, - `data:application/json;charset=utf-8;base64,${Buffer.from( - JSON.stringify(sourceMap), - "utf8" - ).toString("base64")}` - ) + `\n//# sourceURL=webpack-internal:///${moduleId}\n`; // workaround for chrome bug + this.name = "CommentCompilationWarning"; - return result( - new RawSource( - `eval(${ - compilation.outputOptions.trustedTypes - ? `${RuntimeGlobals.createScript}(${JSON.stringify( - content + footer - )})` - : JSON.stringify(content + footer) - });` - ) - ); - } - ); - hooks.inlineInRuntimeBailout.tap( - "EvalDevToolModulePlugin", - () => "the eval-source-map devtool is used." - ); - hooks.render.tap( - "EvalSourceMapDevToolPlugin", - source => new ConcatSource(devtoolWarning, source) - ); - hooks.chunkHash.tap("EvalSourceMapDevToolPlugin", (chunk, hash) => { - hash.update("EvalSourceMapDevToolPlugin"); - hash.update("2"); - }); - if (compilation.outputOptions.trustedTypes) { - compilation.hooks.additionalModuleRuntimeRequirements.tap( - "EvalSourceMapDevToolPlugin", - (module, set, context) => { - set.add(RuntimeGlobals.createScript); - } - ); - } - } - ); + this.loc = loc; } } -module.exports = EvalSourceMapDevToolPlugin; +makeSerializable( + CommentCompilationWarning, + "webpack/lib/CommentCompilationWarning" +); + +module.exports = CommentCompilationWarning; /***/ }), -/***/ 63686: +/***/ 94258: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -34303,7246 +29370,6658 @@ module.exports = EvalSourceMapDevToolPlugin; -const { equals } = __webpack_require__(84953); -const SortableSet = __webpack_require__(13098); -const makeSerializable = __webpack_require__(33032); -const { forEachRuntime } = __webpack_require__(17156); +const ConstDependency = __webpack_require__(76911); -/** @typedef {import("./Dependency").RuntimeSpec} RuntimeSpec */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("./util/Hash")} Hash */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ -/** @typedef {typeof UsageState.OnlyPropertiesUsed | typeof UsageState.NoInfo | typeof UsageState.Unknown | typeof UsageState.Used} RuntimeUsageStateType */ -/** @typedef {typeof UsageState.Unused | RuntimeUsageStateType} UsageStateType */ +const nestedWebpackRequireTag = Symbol("nested __webpack_require__"); -const UsageState = Object.freeze({ - Unused: /** @type {0} */ (0), - OnlyPropertiesUsed: /** @type {1} */ (1), - NoInfo: /** @type {2} */ (2), - Unknown: /** @type {3} */ (3), - Used: /** @type {4} */ (4) -}); +class CompatibilityPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "CompatibilityPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyTemplates.set( + ConstDependency, + new ConstDependency.Template() + ); -const RETURNS_TRUE = () => true; + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("CompatibilityPlugin", (parser, parserOptions) => { + if ( + parserOptions.browserify !== undefined && + !parserOptions.browserify + ) + return; -const CIRCULAR = Symbol("circular target"); + parser.hooks.call + .for("require") + .tap("CompatibilityPlugin", expr => { + // support for browserify style require delegator: "require(o, !0)" + if (expr.arguments.length !== 2) return; + const second = parser.evaluateExpression(expr.arguments[1]); + if (!second.isBoolean()) return; + if (second.asBool() !== true) return; + const dep = new ConstDependency("require", expr.callee.range); + dep.loc = expr.loc; + if (parser.state.current.dependencies.length > 0) { + const last = + parser.state.current.dependencies[ + parser.state.current.dependencies.length - 1 + ]; + if ( + last.critical && + last.options && + last.options.request === "." && + last.userRequest === "." && + last.options.recursive + ) + parser.state.current.dependencies.pop(); + } + parser.state.module.addPresentationalDependency(dep); + return true; + }); + }); -class RestoreProvidedData { - constructor( - exports, - otherProvided, - otherCanMangleProvide, - otherTerminalBinding - ) { - this.exports = exports; - this.otherProvided = otherProvided; - this.otherCanMangleProvide = otherCanMangleProvide; - this.otherTerminalBinding = otherTerminalBinding; - } + /** + * @param {JavascriptParser} parser the parser + * @returns {void} + */ + const handler = parser => { + // Handle nested requires + parser.hooks.preStatement.tap("CompatibilityPlugin", statement => { + if ( + statement.type === "FunctionDeclaration" && + statement.id && + statement.id.name === "__webpack_require__" + ) { + const newName = `__nested_webpack_require_${statement.range[0]}__`; + parser.tagVariable(statement.id.name, nestedWebpackRequireTag, { + name: newName, + declaration: { + updated: false, + loc: statement.id.loc, + range: statement.id.range + } + }); + return true; + } + }); + parser.hooks.pattern + .for("__webpack_require__") + .tap("CompatibilityPlugin", pattern => { + const newName = `__nested_webpack_require_${pattern.range[0]}__`; + parser.tagVariable(pattern.name, nestedWebpackRequireTag, { + name: newName, + declaration: { + updated: false, + loc: pattern.loc, + range: pattern.range + } + }); + return true; + }); + parser.hooks.expression + .for(nestedWebpackRequireTag) + .tap("CompatibilityPlugin", expr => { + const { name, declaration } = parser.currentTagData; + if (!declaration.updated) { + const dep = new ConstDependency(name, declaration.range); + dep.loc = declaration.loc; + parser.state.module.addPresentationalDependency(dep); + declaration.updated = true; + } + const dep = new ConstDependency(name, expr.range); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); - serialize({ write }) { - write(this.exports); - write(this.otherProvided); - write(this.otherCanMangleProvide); - write(this.otherTerminalBinding); - } + // Handle hashbang + parser.hooks.program.tap( + "CompatibilityPlugin", + (program, comments) => { + if (comments.length === 0) return; + const c = comments[0]; + if (c.type === "Line" && c.range[0] === 0) { + if (parser.state.source.slice(0, 2).toString() !== "#!") return; + // this is a hashbang comment + const dep = new ConstDependency("//", 0); + dep.loc = c.loc; + parser.state.module.addPresentationalDependency(dep); + } + } + ); + }; - static deserialize({ read }) { - return new RestoreProvidedData(read(), read(), read(), read()); + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("CompatibilityPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("CompatibilityPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("CompatibilityPlugin", handler); + } + ); } } +module.exports = CompatibilityPlugin; -makeSerializable( - RestoreProvidedData, - "webpack/lib/ModuleGraph", - "RestoreProvidedData" -); -class ExportsInfo { - constructor() { - /** @type {Map} */ - this._exports = new Map(); - this._otherExportsInfo = new ExportInfo(null); - this._sideEffectsOnlyInfo = new ExportInfo("*side effects only*"); - this._exportsAreOrdered = false; - /** @type {ExportsInfo=} */ - this._redirectTo = undefined; - } +/***/ }), - /** - * @returns {Iterable} all owned exports in any order - */ - get ownedExports() { - return this._exports.values(); - } +/***/ 85720: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @returns {Iterable} all owned exports in order - */ - get orderedOwnedExports() { - if (!this._exportsAreOrdered) { - this._sortExports(); - } - return this._exports.values(); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @returns {Iterable} all exports in any order - */ - get exports() { - if (this._redirectTo !== undefined) { - const map = new Map(this._redirectTo._exports); - for (const [key, value] of this._exports) { - map.set(key, value); - } - return map.values(); - } - return this._exports.values(); - } - /** - * @returns {Iterable} all exports in order - */ - get orderedExports() { - if (!this._exportsAreOrdered) { - this._sortExports(); - } - if (this._redirectTo !== undefined) { - const map = new Map( - Array.from(this._redirectTo.orderedExports, item => [item.name, item]) - ); - for (const [key, value] of this._exports) { - map.set(key, value); - } - // sorting should be pretty fast as map contains - // a lot of presorted items - this._sortExportsMap(map); - return map.values(); - } - return this._exports.values(); - } - /** - * @returns {ExportInfo} the export info of unlisted exports - */ - get otherExportsInfo() { - if (this._redirectTo !== undefined) - return this._redirectTo.otherExportsInfo; - return this._otherExportsInfo; - } +const asyncLib = __webpack_require__(78175); +const { + HookMap, + SyncHook, + SyncBailHook, + SyncWaterfallHook, + AsyncSeriesHook, + AsyncSeriesBailHook, + AsyncParallelHook +} = __webpack_require__(41242); +const util = __webpack_require__(73837); +const { CachedSource } = __webpack_require__(51255); +const { MultiItemCache } = __webpack_require__(55392); +const Chunk = __webpack_require__(39385); +const ChunkGraph = __webpack_require__(64971); +const ChunkGroup = __webpack_require__(15626); +const ChunkRenderError = __webpack_require__(918); +const ChunkTemplate = __webpack_require__(46341); +const CodeGenerationError = __webpack_require__(2102); +const CodeGenerationResults = __webpack_require__(71426); +const Dependency = __webpack_require__(54912); +const DependencyTemplates = __webpack_require__(9163); +const Entrypoint = __webpack_require__(13795); +const ErrorHelpers = __webpack_require__(59985); +const FileSystemInfo = __webpack_require__(79453); +const { + connectChunkGroupAndChunk, + connectChunkGroupParentAndChild +} = __webpack_require__(37234); +const { + makeWebpackError, + tryRunOrWebpackError +} = __webpack_require__(11351); +const MainTemplate = __webpack_require__(12856); +const Module = __webpack_require__(73208); +const ModuleDependencyError = __webpack_require__(67409); +const ModuleDependencyWarning = __webpack_require__(29656); +const ModuleGraph = __webpack_require__(99988); +const ModuleNotFoundError = __webpack_require__(32882); +const ModuleProfile = __webpack_require__(36418); +const ModuleRestoreError = __webpack_require__(94560); +const ModuleStoreError = __webpack_require__(59001); +const ModuleTemplate = __webpack_require__(62677); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeTemplate = __webpack_require__(18777); +const Stats = __webpack_require__(31743); +const WebpackError = __webpack_require__(53799); +const buildChunkGraph = __webpack_require__(79233); +const BuildCycleError = __webpack_require__(22273); +const { Logger, LogType } = __webpack_require__(32597); +const StatsFactory = __webpack_require__(92629); +const StatsPrinter = __webpack_require__(30198); +const { equals: arrayEquals } = __webpack_require__(84953); +const AsyncQueue = __webpack_require__(12260); +const LazySet = __webpack_require__(38938); +const { provide } = __webpack_require__(82482); +const WeakTupleMap = __webpack_require__(28745); +const { cachedCleverMerge } = __webpack_require__(60839); +const { + compareLocations, + concatComparators, + compareSelect, + compareIds, + compareStringsNumeric, + compareModulesByIdentifier +} = __webpack_require__(29579); +const createHash = __webpack_require__(49835); +const { + arrayToSetDeprecation, + soonFrozenObjectDeprecation, + createFakeHook +} = __webpack_require__(64518); +const processAsyncTree = __webpack_require__(42791); +const { getRuntimeKey } = __webpack_require__(17156); +const { isSourceEqual } = __webpack_require__(41245); - _sortExportsMap(exports) { - if (exports.size > 1) { - const namesInOrder = []; - for (const entry of exports.values()) { - namesInOrder.push(entry.name); - } - namesInOrder.sort(); - let i = 0; - for (const entry of exports.values()) { - const name = namesInOrder[i]; - if (entry.name !== name) break; - i++; - } - for (; i < namesInOrder.length; i++) { - const name = namesInOrder[i]; - const correctEntry = exports.get(name); - exports.delete(name); - exports.set(name, correctEntry); - } - } - } +/** @template T @typedef {import("tapable").AsArray} AsArray */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescription */ +/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */ +/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */ +/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */ +/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */ +/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("./Cache")} Cache */ +/** @typedef {import("./CacheFacade")} CacheFacade */ +/** @typedef {import("./ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Compiler").CompilationParams} CompilationParams */ +/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("./DependencyTemplate")} DependencyTemplate */ +/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("./ModuleFactory")} ModuleFactory */ +/** @typedef {import("./ModuleFactory").ModuleFactoryCreateDataContextInfo} ModuleFactoryCreateDataContextInfo */ +/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./RuntimeModule")} RuntimeModule */ +/** @typedef {import("./Template").RenderManifestEntry} RenderManifestEntry */ +/** @typedef {import("./Template").RenderManifestOptions} RenderManifestOptions */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsError} StatsError */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModule} StatsModule */ +/** @typedef {import("./util/Hash")} Hash */ +/** @template T @typedef {import("./util/deprecation").FakeHook} FakeHook */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - _sortExports() { - this._sortExportsMap(this._exports); - this._exportsAreOrdered = true; - } +/** + * @callback Callback + * @param {(WebpackError | null)=} err + * @returns {void} + */ - setRedirectNamedTo(exportsInfo) { - if (this._redirectTo === exportsInfo) return false; - this._redirectTo = exportsInfo; - return true; - } +/** + * @callback ModuleCallback + * @param {(WebpackError | null)=} err + * @param {Module=} result + * @returns {void} + */ - setHasProvideInfo() { - for (const exportInfo of this._exports.values()) { - if (exportInfo.provided === undefined) { - exportInfo.provided = false; - } - if (exportInfo.canMangleProvide === undefined) { - exportInfo.canMangleProvide = true; - } - } - if (this._redirectTo !== undefined) { - this._redirectTo.setHasProvideInfo(); - } else { - if (this._otherExportsInfo.provided === undefined) { - this._otherExportsInfo.provided = false; - } - if (this._otherExportsInfo.canMangleProvide === undefined) { - this._otherExportsInfo.canMangleProvide = true; - } - } - } +/** + * @callback ModuleFactoryResultCallback + * @param {(WebpackError | null)=} err + * @param {ModuleFactoryResult=} result + * @returns {void} + */ - setHasUseInfo() { - for (const exportInfo of this._exports.values()) { - exportInfo.setHasUseInfo(); - } - this._sideEffectsOnlyInfo.setHasUseInfo(); - if (this._redirectTo !== undefined) { - this._redirectTo.setHasUseInfo(); - } else { - this._otherExportsInfo.setHasUseInfo(); - if (this._otherExportsInfo.canMangleUse === undefined) { - this._otherExportsInfo.canMangleUse = true; - } - } - } +/** + * @callback ModuleOrFactoryResultCallback + * @param {(WebpackError | null)=} err + * @param {Module | ModuleFactoryResult=} result + * @returns {void} + */ - /** - * @param {string} name export name - * @returns {ExportInfo} export info for this name - */ - getOwnExportInfo(name) { - const info = this._exports.get(name); - if (info !== undefined) return info; - const newInfo = new ExportInfo(name, this._otherExportsInfo); - this._exports.set(name, newInfo); - this._exportsAreOrdered = false; - return newInfo; - } +/** + * @callback ExecuteModuleCallback + * @param {(WebpackError | null)=} err + * @param {ExecuteModuleResult=} result + * @returns {void} + */ - /** - * @param {string} name export name - * @returns {ExportInfo} export info for this name - */ - getExportInfo(name) { - const info = this._exports.get(name); - if (info !== undefined) return info; - if (this._redirectTo !== undefined) - return this._redirectTo.getExportInfo(name); - const newInfo = new ExportInfo(name, this._otherExportsInfo); - this._exports.set(name, newInfo); - this._exportsAreOrdered = false; - return newInfo; - } +/** + * @callback DepBlockVarDependenciesCallback + * @param {Dependency} dependency + * @returns {any} + */ - /** - * @param {string} name export name - * @returns {ExportInfo} export info for this name - */ - getReadOnlyExportInfo(name) { - const info = this._exports.get(name); - if (info !== undefined) return info; - if (this._redirectTo !== undefined) - return this._redirectTo.getReadOnlyExportInfo(name); - return this._otherExportsInfo; - } +/** @typedef {new (...args: any[]) => Dependency} DepConstructor */ +/** @typedef {Record} CompilationAssets */ - /** - * @param {string[]} name export name - * @returns {ExportInfo | undefined} export info for this name - */ - getReadOnlyExportInfoRecursive(name) { - const exportInfo = this.getReadOnlyExportInfo(name[0]); - if (name.length === 1) return exportInfo; - if (!exportInfo.exportsInfo) return undefined; - return exportInfo.exportsInfo.getReadOnlyExportInfoRecursive(name.slice(1)); - } +/** + * @typedef {Object} AvailableModulesChunkGroupMapping + * @property {ChunkGroup} chunkGroup + * @property {Set} availableModules + * @property {boolean} needCopy + */ - /** - * @param {string[]=} name the export name - * @returns {ExportsInfo | undefined} the nested exports info - */ - getNestedExportsInfo(name) { - if (Array.isArray(name) && name.length > 0) { - const info = this.getReadOnlyExportInfo(name[0]); - if (!info.exportsInfo) return undefined; - return info.exportsInfo.getNestedExportsInfo(name.slice(1)); - } - return this; - } +/** + * @typedef {Object} DependenciesBlockLike + * @property {Dependency[]} dependencies + * @property {AsyncDependenciesBlock[]} blocks + */ - /** - * @param {boolean=} canMangle true, if exports can still be mangled (defaults to false) - * @param {Set=} excludeExports list of unaffected exports - * @param {any=} targetKey use this as key for the target - * @param {ModuleGraphConnection=} targetModule set this module as target - * @param {number=} priority priority - * @returns {boolean} true, if this call changed something - */ - setUnknownExportsProvided( - canMangle, - excludeExports, - targetKey, - targetModule, - priority - ) { - let changed = false; - if (excludeExports) { - for (const name of excludeExports) { - // Make sure these entries exist, so they can get different info - this.getExportInfo(name); - } - } - for (const exportInfo of this._exports.values()) { - if (!canMangle && exportInfo.canMangleProvide !== false) { - exportInfo.canMangleProvide = false; - changed = true; - } - if (excludeExports && excludeExports.has(exportInfo.name)) continue; - if (exportInfo.provided !== true && exportInfo.provided !== null) { - exportInfo.provided = null; - changed = true; - } - if (targetKey) { - exportInfo.setTarget(targetKey, targetModule, [exportInfo.name], -1); - } - } - if (this._redirectTo !== undefined) { - if ( - this._redirectTo.setUnknownExportsProvided( - canMangle, - excludeExports, - targetKey, - targetModule, - priority - ) - ) { - changed = true; - } - } else { - if ( - this._otherExportsInfo.provided !== true && - this._otherExportsInfo.provided !== null - ) { - this._otherExportsInfo.provided = null; - changed = true; - } - if (!canMangle && this._otherExportsInfo.canMangleProvide !== false) { - this._otherExportsInfo.canMangleProvide = false; - changed = true; - } - if (targetKey) { - this._otherExportsInfo.setTarget( - targetKey, - targetModule, - undefined, - priority - ); - } - } - return changed; - } +/** + * @typedef {Object} ChunkPathData + * @property {string|number} id + * @property {string=} name + * @property {string} hash + * @property {function(number): string=} hashWithLength + * @property {(Record)=} contentHash + * @property {(Record string>)=} contentHashWithLength + */ - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true, when something changed - */ - setUsedInUnknownWay(runtime) { - let changed = false; - for (const exportInfo of this._exports.values()) { - if (exportInfo.setUsedInUnknownWay(runtime)) { - changed = true; - } - } - if (this._redirectTo !== undefined) { - if (this._redirectTo.setUsedInUnknownWay(runtime)) { - changed = true; - } - } else { - if ( - this._otherExportsInfo.setUsedConditionally( - used => used < UsageState.Unknown, - UsageState.Unknown, - runtime - ) - ) { - changed = true; - } - if (this._otherExportsInfo.canMangleUse !== false) { - this._otherExportsInfo.canMangleUse = false; - changed = true; - } - } - return changed; - } +/** + * @typedef {Object} ChunkHashContext + * @property {CodeGenerationResults} codeGenerationResults results of code generation + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + */ - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true, when something changed - */ - setUsedWithoutInfo(runtime) { - let changed = false; - for (const exportInfo of this._exports.values()) { - if (exportInfo.setUsedWithoutInfo(runtime)) { - changed = true; - } - } - if (this._redirectTo !== undefined) { - if (this._redirectTo.setUsedWithoutInfo(runtime)) { - changed = true; - } - } else { - if (this._otherExportsInfo.setUsed(UsageState.NoInfo, runtime)) { - changed = true; - } - if (this._otherExportsInfo.canMangleUse !== false) { - this._otherExportsInfo.canMangleUse = false; - changed = true; - } - } - return changed; - } +/** + * @typedef {Object} RuntimeRequirementsContext + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {CodeGenerationResults} codeGenerationResults the code generation results + */ - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true, when something changed - */ - setAllKnownExportsUsed(runtime) { - let changed = false; - for (const exportInfo of this._exports.values()) { - if (!exportInfo.provided) continue; - if (exportInfo.setUsed(UsageState.Used, runtime)) { - changed = true; - } - } - return changed; - } +/** + * @typedef {Object} ExecuteModuleOptions + * @property {EntryOptions=} entryOptions + */ - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true, when something changed - */ - setUsedForSideEffectsOnly(runtime) { - return this._sideEffectsOnlyInfo.setUsedConditionally( - used => used === UsageState.Unused, - UsageState.Used, - runtime - ); - } +/** + * @typedef {Object} ExecuteModuleResult + * @property {any} exports + * @property {boolean} cacheable + * @property {Map} assets + * @property {LazySet} fileDependencies + * @property {LazySet} contextDependencies + * @property {LazySet} missingDependencies + * @property {LazySet} buildDependencies + */ - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true, when the module exports are used in any way - */ - isUsed(runtime) { - if (this._redirectTo !== undefined) { - if (this._redirectTo.isUsed(runtime)) { - return true; - } - } else { - if (this._otherExportsInfo.getUsed(runtime) !== UsageState.Unused) { - return true; - } - } - for (const exportInfo of this._exports.values()) { - if (exportInfo.getUsed(runtime) !== UsageState.Unused) { - return true; - } - } - return false; - } +/** + * @typedef {Object} ExecuteModuleArgument + * @property {Module} module + * @property {{ id: string, exports: any, loaded: boolean }=} moduleObject + * @property {any} preparedInfo + * @property {CodeGenerationResult} codeGenerationResult + */ - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true, when the module is used in any way - */ - isModuleUsed(runtime) { - if (this.isUsed(runtime)) return true; - if (this._sideEffectsOnlyInfo.getUsed(runtime) !== UsageState.Unused) - return true; - return false; - } +/** + * @typedef {Object} ExecuteModuleContext + * @property {Map} assets + * @property {Chunk} chunk + * @property {ChunkGraph} chunkGraph + * @property {function(string): any=} __webpack_require__ + */ - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {SortableSet | boolean | null} set of used exports, or true (when namespace object is used), or false (when unused), or null (when unknown) - */ - getUsedExports(runtime) { - if (!this._redirectTo !== undefined) { - switch (this._otherExportsInfo.getUsed(runtime)) { - case UsageState.NoInfo: - return null; - case UsageState.Unknown: - case UsageState.OnlyPropertiesUsed: - case UsageState.Used: - return true; - } - } - const array = []; - if (!this._exportsAreOrdered) this._sortExports(); - for (const exportInfo of this._exports.values()) { - switch (exportInfo.getUsed(runtime)) { - case UsageState.NoInfo: - return null; - case UsageState.Unknown: - return true; - case UsageState.OnlyPropertiesUsed: - case UsageState.Used: - array.push(exportInfo.name); - } - } - if (this._redirectTo !== undefined) { - const inner = this._redirectTo.getUsedExports(runtime); - if (inner === null) return null; - if (inner === true) return true; - if (inner !== false) { - for (const item of inner) { - array.push(item); - } - } - } - if (array.length === 0) { - switch (this._sideEffectsOnlyInfo.getUsed(runtime)) { - case UsageState.NoInfo: - return null; - case UsageState.Unused: - return false; - } - } - return new SortableSet(array); - } +/** + * @typedef {Object} EntryData + * @property {Dependency[]} dependencies dependencies of the entrypoint that should be evaluated at startup + * @property {Dependency[]} includeDependencies dependencies of the entrypoint that should be included but not evaluated + * @property {EntryOptions} options options of the entrypoint + */ - /** - * @returns {null | true | string[]} list of exports when known - */ - getProvidedExports() { - if (!this._redirectTo !== undefined) { - switch (this._otherExportsInfo.provided) { - case undefined: - return null; - case null: - return true; - case true: - return true; - } - } - const array = []; - if (!this._exportsAreOrdered) this._sortExports(); - for (const exportInfo of this._exports.values()) { - switch (exportInfo.provided) { - case undefined: - return null; - case null: - return true; - case true: - array.push(exportInfo.name); +/** + * @typedef {Object} LogEntry + * @property {string} type + * @property {any[]} args + * @property {number} time + * @property {string[]=} trace + */ + +/** + * @typedef {Object} KnownAssetInfo + * @property {boolean=} immutable true, if the asset can be long term cached forever (contains a hash) + * @property {boolean=} minimized whether the asset is minimized + * @property {string | string[]=} fullhash the value(s) of the full hash used for this asset + * @property {string | string[]=} chunkhash the value(s) of the chunk hash used for this asset + * @property {string | string[]=} modulehash the value(s) of the module hash used for this asset + * @property {string | string[]=} contenthash the value(s) of the content hash used for this asset + * @property {string=} sourceFilename when asset was created from a source file (potentially transformed), the original filename relative to compilation context + * @property {number=} size size in bytes, only set after asset has been emitted + * @property {boolean=} development true, when asset is only used for development and doesn't count towards user-facing assets + * @property {boolean=} hotModuleReplacement true, when asset ships data for updating an existing application (HMR) + * @property {boolean=} javascriptModule true, when asset is javascript and an ESM + * @property {Record=} related object of pointers to other assets, keyed by type of relation (only points from parent to child) + */ + +/** @typedef {KnownAssetInfo & Record} AssetInfo */ + +/** + * @typedef {Object} Asset + * @property {string} name the filename of the asset + * @property {Source} source source of the asset + * @property {AssetInfo} info info about the asset + */ + +/** + * @typedef {Object} ModulePathData + * @property {string|number} id + * @property {string} hash + * @property {function(number): string=} hashWithLength + */ + +/** + * @typedef {Object} PathData + * @property {ChunkGraph=} chunkGraph + * @property {string=} hash + * @property {function(number): string=} hashWithLength + * @property {(Chunk|ChunkPathData)=} chunk + * @property {(Module|ModulePathData)=} module + * @property {RuntimeSpec=} runtime + * @property {string=} filename + * @property {string=} basename + * @property {string=} query + * @property {string=} contentHashType + * @property {string=} contentHash + * @property {function(number): string=} contentHashWithLength + * @property {boolean=} noChunkHash + * @property {string=} url + */ + +/** + * @typedef {Object} KnownNormalizedStatsOptions + * @property {string} context + * @property {RequestShortener} requestShortener + * @property {string} chunksSort + * @property {string} modulesSort + * @property {string} chunkModulesSort + * @property {string} nestedModulesSort + * @property {string} assetsSort + * @property {boolean} ids + * @property {boolean} cachedAssets + * @property {boolean} groupAssetsByEmitStatus + * @property {boolean} groupAssetsByPath + * @property {boolean} groupAssetsByExtension + * @property {number} assetsSpace + * @property {((value: string, asset: StatsAsset) => boolean)[]} excludeAssets + * @property {((name: string, module: StatsModule, type: "module" | "chunk" | "root-of-chunk" | "nested") => boolean)[]} excludeModules + * @property {((warning: StatsError, textValue: string) => boolean)[]} warningsFilter + * @property {boolean} cachedModules + * @property {boolean} orphanModules + * @property {boolean} dependentModules + * @property {boolean} runtimeModules + * @property {boolean} groupModulesByCacheStatus + * @property {boolean} groupModulesByLayer + * @property {boolean} groupModulesByAttributes + * @property {boolean} groupModulesByPath + * @property {boolean} groupModulesByExtension + * @property {boolean} groupModulesByType + * @property {boolean | "auto"} entrypoints + * @property {boolean} chunkGroups + * @property {boolean} chunkGroupAuxiliary + * @property {boolean} chunkGroupChildren + * @property {number} chunkGroupMaxAssets + * @property {number} modulesSpace + * @property {number} chunkModulesSpace + * @property {number} nestedModulesSpace + * @property {false|"none"|"error"|"warn"|"info"|"log"|"verbose"} logging + * @property {((value: string) => boolean)[]} loggingDebug + * @property {boolean} loggingTrace + * @property {any} _env + */ + +/** @typedef {KnownNormalizedStatsOptions & Omit & Record} NormalizedStatsOptions */ + +/** + * @typedef {Object} KnownCreateStatsOptionsContext + * @property {boolean=} forToString + */ + +/** @typedef {KnownCreateStatsOptionsContext & Record} CreateStatsOptionsContext */ + +/** @type {AssetInfo} */ +const EMPTY_ASSET_INFO = Object.freeze({}); + +const esmDependencyCategory = "esm"; +// TODO webpack 6: remove +const deprecatedNormalModuleLoaderHook = util.deprecate( + compilation => { + return (__webpack_require__(39).getCompilationHooks)(compilation).loader; + }, + "Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader", + "DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK" +); + +// TODO webpack 6: remove +const defineRemovedModuleTemplates = moduleTemplates => { + Object.defineProperties(moduleTemplates, { + asset: { + enumerable: false, + configurable: false, + get: () => { + throw new WebpackError( + "Compilation.moduleTemplates.asset has been removed" + ); } - } - if (this._redirectTo !== undefined) { - const inner = this._redirectTo.getProvidedExports(); - if (inner === null) return null; - if (inner === true) return true; - for (const item of inner) { - if (!array.includes(item)) { - array.push(item); - } + }, + webassembly: { + enumerable: false, + configurable: false, + get: () => { + throw new WebpackError( + "Compilation.moduleTemplates.webassembly has been removed" + ); } } - return array; - } + }); + moduleTemplates = undefined; +}; +const byId = compareSelect( /** - * @param {RuntimeSpec} runtime the runtime - * @returns {ExportInfo[]} exports that are relevant (not unused and potential provided) - */ - getRelevantExports(runtime) { - const list = []; - for (const exportInfo of this._exports.values()) { - const used = exportInfo.getUsed(runtime); - if (used === UsageState.Unused) continue; - if (exportInfo.provided === false) continue; - list.push(exportInfo); - } - if (this._redirectTo !== undefined) { - for (const exportInfo of this._redirectTo.getRelevantExports(runtime)) { - if (!this._exports.has(exportInfo.name)) list.push(exportInfo); - } - } - if ( - this._otherExportsInfo.provided !== false && - this._otherExportsInfo.getUsed(runtime) !== UsageState.Unused - ) { - list.push(this._otherExportsInfo); - } - return list; - } + * @param {Chunk} c chunk + * @returns {number | string} id + */ c => c.id, + compareIds +); - /** - * @param {string | string[]} name the name of the export - * @returns {boolean | undefined | null} if the export is provided - */ - isExportProvided(name) { - if (Array.isArray(name)) { - const info = this.getReadOnlyExportInfo(name[0]); - if (info.exportsInfo && name.length > 1) { - return info.exportsInfo.isExportProvided(name.slice(1)); - } - return info.provided; - } - const info = this.getReadOnlyExportInfo(name); - return info.provided; - } +const byNameOrHash = concatComparators( + compareSelect( + /** + * @param {Compilation} c compilation + * @returns {string} name + */ + c => c.name, + compareIds + ), + compareSelect( + /** + * @param {Compilation} c compilation + * @returns {string} hash + */ c => c.fullHash, + compareIds + ) +); - /** - * @param {RuntimeSpec} runtime runtime - * @returns {string} key representing the usage - */ - getUsageKey(runtime) { - const key = []; - if (this._redirectTo !== undefined) { - key.push(this._redirectTo.getUsageKey(runtime)); - } else { - key.push(this._otherExportsInfo.getUsed(runtime)); - } - key.push(this._sideEffectsOnlyInfo.getUsed(runtime)); - for (const exportInfo of this.orderedOwnedExports) { - key.push(exportInfo.getUsed(runtime)); - } - return key.join("|"); - } +const byMessage = compareSelect(err => `${err.message}`, compareStringsNumeric); + +const byModule = compareSelect( + err => (err.module && err.module.identifier()) || "", + compareStringsNumeric +); + +const byLocation = compareSelect(err => err.loc, compareLocations); + +const compareErrors = concatComparators(byModule, byLocation, byMessage); +/** @type {WeakMap} */ +const unsafeCacheDependencies = new WeakMap(); + +/** @type {WeakMap} */ +const unsafeCacheData = new WeakMap(); + +class Compilation { /** - * @param {RuntimeSpec} runtimeA first runtime - * @param {RuntimeSpec} runtimeB second runtime - * @returns {boolean} true, when equally used + * Creates an instance of Compilation. + * @param {Compiler} compiler the compiler which created the compilation + * @param {CompilationParams} params the compilation parameters */ - isEquallyUsed(runtimeA, runtimeB) { - if (this._redirectTo !== undefined) { - if (!this._redirectTo.isEquallyUsed(runtimeA, runtimeB)) return false; - } else { - if ( - this._otherExportsInfo.getUsed(runtimeA) !== - this._otherExportsInfo.getUsed(runtimeB) - ) { - return false; - } - } - if ( - this._sideEffectsOnlyInfo.getUsed(runtimeA) !== - this._sideEffectsOnlyInfo.getUsed(runtimeB) - ) { - return false; - } - for (const exportInfo of this.ownedExports) { - if (exportInfo.getUsed(runtimeA) !== exportInfo.getUsed(runtimeB)) - return false; - } - return true; - } - - /** - * @param {string | string[]} name export name - * @param {RuntimeSpec} runtime check usage for this runtime only - * @returns {UsageStateType} usage status - */ - getUsed(name, runtime) { - if (Array.isArray(name)) { - if (name.length === 0) return this.otherExportsInfo.getUsed(runtime); - let info = this.getReadOnlyExportInfo(name[0]); - if (info.exportsInfo && name.length > 1) { - return info.exportsInfo.getUsed(name.slice(1), runtime); - } - return info.getUsed(runtime); - } - let info = this.getReadOnlyExportInfo(name); - return info.getUsed(runtime); - } - - /** - * @param {string | string[]} name the export name - * @param {RuntimeSpec} runtime check usage for this runtime only - * @returns {string | string[] | false} the used name - */ - getUsedName(name, runtime) { - if (Array.isArray(name)) { - // TODO improve this - if (name.length === 0) { - if (!this.isUsed(runtime)) return false; - return name; - } - let info = this.getReadOnlyExportInfo(name[0]); - const x = info.getUsedName(name[0], runtime); - if (x === false) return false; - const arr = x === name[0] && name.length === 1 ? name : [x]; - if (name.length === 1) { - return arr; - } - if ( - info.exportsInfo && - info.getUsed(runtime) === UsageState.OnlyPropertiesUsed - ) { - const nested = info.exportsInfo.getUsedName(name.slice(1), runtime); - if (!nested) return false; - return arr.concat(nested); - } else { - return arr.concat(name.slice(1)); - } - } else { - let info = this.getReadOnlyExportInfo(name); - const usedName = info.getUsedName(name, runtime); - return usedName; - } - } + constructor(compiler, params) { + this._backCompat = compiler._backCompat; - /** - * @param {Hash} hash the hash - * @param {RuntimeSpec} runtime the runtime - * @returns {void} - */ - updateHash(hash, runtime) { - this._updateHash(hash, runtime, new Set()); - } + const getNormalModuleLoader = () => deprecatedNormalModuleLoaderHook(this); + /** @typedef {{ additionalAssets?: true | Function }} ProcessAssetsAdditionalOptions */ + /** @type {AsyncSeriesHook<[CompilationAssets], ProcessAssetsAdditionalOptions>} */ + const processAssetsHook = new AsyncSeriesHook(["assets"]); - /** - * @param {Hash} hash the hash - * @param {RuntimeSpec} runtime the runtime - * @param {Set} alreadyVisitedExportsInfo for circular references - * @returns {void} - */ - _updateHash(hash, runtime, alreadyVisitedExportsInfo) { - const set = new Set(alreadyVisitedExportsInfo); - set.add(this); - for (const exportInfo of this.orderedExports) { - if (exportInfo.hasInfo(this._otherExportsInfo, runtime)) { - exportInfo._updateHash(hash, runtime, set); + let savedAssets = new Set(); + const popNewAssets = assets => { + let newAssets = undefined; + for (const file of Object.keys(assets)) { + if (savedAssets.has(file)) continue; + if (newAssets === undefined) { + newAssets = Object.create(null); + } + newAssets[file] = assets[file]; + savedAssets.add(file); } - } - this._sideEffectsOnlyInfo._updateHash(hash, runtime, set); - this._otherExportsInfo._updateHash(hash, runtime, set); - if (this._redirectTo !== undefined) { - this._redirectTo._updateHash(hash, runtime, set); - } - } - - getRestoreProvidedData() { - const otherProvided = this._otherExportsInfo.provided; - const otherCanMangleProvide = this._otherExportsInfo.canMangleProvide; - const otherTerminalBinding = this._otherExportsInfo.terminalBinding; - const exports = []; - for (const exportInfo of this.orderedExports) { - if ( - exportInfo.provided !== otherProvided || - exportInfo.canMangleProvide !== otherCanMangleProvide || - exportInfo.terminalBinding !== otherTerminalBinding || - exportInfo.exportsInfoOwned - ) { - exports.push({ - name: exportInfo.name, - provided: exportInfo.provided, - canMangleProvide: exportInfo.canMangleProvide, - terminalBinding: exportInfo.terminalBinding, - exportsInfo: exportInfo.exportsInfoOwned - ? exportInfo.exportsInfo.getRestoreProvidedData() - : undefined - }); + return newAssets; + }; + processAssetsHook.intercept({ + name: "Compilation", + call: () => { + savedAssets = new Set(Object.keys(this.assets)); + }, + register: tap => { + const { type, name } = tap; + const { fn, additionalAssets, ...remainingTap } = tap; + const additionalAssetsFn = + additionalAssets === true ? fn : additionalAssets; + const processedAssets = additionalAssetsFn ? new WeakSet() : undefined; + switch (type) { + case "sync": + if (additionalAssetsFn) { + this.hooks.processAdditionalAssets.tap(name, assets => { + if (processedAssets.has(this.assets)) + additionalAssetsFn(assets); + }); + } + return { + ...remainingTap, + type: "async", + fn: (assets, callback) => { + try { + fn(assets); + } catch (e) { + return callback(e); + } + if (processedAssets !== undefined) + processedAssets.add(this.assets); + const newAssets = popNewAssets(assets); + if (newAssets !== undefined) { + this.hooks.processAdditionalAssets.callAsync( + newAssets, + callback + ); + return; + } + callback(); + } + }; + case "async": + if (additionalAssetsFn) { + this.hooks.processAdditionalAssets.tapAsync( + name, + (assets, callback) => { + if (processedAssets.has(this.assets)) + return additionalAssetsFn(assets, callback); + callback(); + } + ); + } + return { + ...remainingTap, + fn: (assets, callback) => { + fn(assets, err => { + if (err) return callback(err); + if (processedAssets !== undefined) + processedAssets.add(this.assets); + const newAssets = popNewAssets(assets); + if (newAssets !== undefined) { + this.hooks.processAdditionalAssets.callAsync( + newAssets, + callback + ); + return; + } + callback(); + }); + } + }; + case "promise": + if (additionalAssetsFn) { + this.hooks.processAdditionalAssets.tapPromise(name, assets => { + if (processedAssets.has(this.assets)) + return additionalAssetsFn(assets); + return Promise.resolve(); + }); + } + return { + ...remainingTap, + fn: assets => { + const p = fn(assets); + if (!p || !p.then) return p; + return p.then(() => { + if (processedAssets !== undefined) + processedAssets.add(this.assets); + const newAssets = popNewAssets(assets); + if (newAssets !== undefined) { + return this.hooks.processAdditionalAssets.promise( + newAssets + ); + } + }); + } + }; + } } - } - return new RestoreProvidedData( - exports, - otherProvided, - otherCanMangleProvide, - otherTerminalBinding - ); - } + }); - restoreProvided({ - otherProvided, - otherCanMangleProvide, - otherTerminalBinding, - exports - }) { - let wasEmpty = true; - for (const exportInfo of this._exports.values()) { - wasEmpty = false; - exportInfo.provided = otherProvided; - exportInfo.canMangleProvide = otherCanMangleProvide; - exportInfo.terminalBinding = otherTerminalBinding; - } - this._otherExportsInfo.provided = otherProvided; - this._otherExportsInfo.canMangleProvide = otherCanMangleProvide; - this._otherExportsInfo.terminalBinding = otherTerminalBinding; - for (const exp of exports) { - const exportInfo = this.getExportInfo(exp.name); - exportInfo.provided = exp.provided; - exportInfo.canMangleProvide = exp.canMangleProvide; - exportInfo.terminalBinding = exp.terminalBinding; - if (exp.exportsInfo) { - const exportsInfo = exportInfo.createNestedExportsInfo(); - exportsInfo.restoreProvided(exp.exportsInfo); - } - } - if (wasEmpty) this._exportsAreOrdered = true; - } -} + /** @type {SyncHook<[CompilationAssets]>} */ + const afterProcessAssetsHook = new SyncHook(["assets"]); -class ExportInfo { - /** - * @param {string} name the original name of the export - * @param {ExportInfo=} initFrom init values from this ExportInfo - */ - constructor(name, initFrom) { - /** @type {string} */ - this.name = name; - /** @private @type {string | null} */ - this._usedName = initFrom ? initFrom._usedName : null; - /** @private @type {UsageStateType} */ - this._globalUsed = initFrom ? initFrom._globalUsed : undefined; - /** @private @type {Map} */ - this._usedInRuntime = - initFrom && initFrom._usedInRuntime - ? new Map(initFrom._usedInRuntime) - : undefined; - /** @private @type {boolean} */ - this._hasUseInRuntimeInfo = initFrom - ? initFrom._hasUseInRuntimeInfo - : false; - /** - * true: it is provided - * false: it is not provided - * null: only the runtime knows if it is provided - * undefined: it was not determined if it is provided - * @type {boolean | null | undefined} - */ - this.provided = initFrom ? initFrom.provided : undefined; - /** - * is the export a terminal binding that should be checked for export star conflicts - * @type {boolean} - */ - this.terminalBinding = initFrom ? initFrom.terminalBinding : false; /** - * true: it can be mangled - * false: is can not be mangled - * undefined: it was not determined if it can be mangled - * @type {boolean | undefined} - */ - this.canMangleProvide = initFrom ? initFrom.canMangleProvide : undefined; - /** - * true: it can be mangled - * false: is can not be mangled - * undefined: it was not determined if it can be mangled - * @type {boolean | undefined} + * @template T + * @param {string} name name of the hook + * @param {number} stage new stage + * @param {function(): AsArray} getArgs get old hook function args + * @param {string=} code deprecation code (not deprecated when unset) + * @returns {FakeHook, "tap" | "tapAsync" | "tapPromise" | "name">>} fake hook which redirects */ - this.canMangleUse = initFrom ? initFrom.canMangleUse : undefined; - /** @type {boolean} */ - this.exportsInfoOwned = false; - /** @type {ExportsInfo=} */ - this.exportsInfo = undefined; - /** @type {Map=} */ - this._target = undefined; - if (initFrom && initFrom._target) { - this._target = new Map(); - for (const [key, value] of initFrom._target) { - this._target.set(key, { - connection: value.connection, - export: value.export || [name], - priority: value.priority - }); - } - } - /** @type {Map=} */ - this._maxTarget = undefined; - } - - // TODO webpack 5 remove - /** @private */ - get used() { - throw new Error("REMOVED"); - } - /** @private */ - get usedName() { - throw new Error("REMOVED"); - } - /** - * @private - * @param {*} v v - */ - set used(v) { - throw new Error("REMOVED"); - } - /** - * @private - * @param {*} v v - */ - set usedName(v) { - throw new Error("REMOVED"); - } - - get canMangle() { - switch (this.canMangleProvide) { - case undefined: - return this.canMangleUse === false ? false : undefined; - case false: - return false; - case true: - switch (this.canMangleUse) { - case undefined: - return undefined; - case false: - return false; - case true: - return true; + const createProcessAssetsHook = (name, stage, getArgs, code) => { + if (!this._backCompat && code) return undefined; + const errorMessage = + reason => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}. +BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`; + const getOptions = options => { + if (typeof options === "string") options = { name: options }; + if (options.stage) { + throw new Error(errorMessage("it's using the 'stage' option")); } - } - throw new Error( - `Unexpected flags for canMangle ${this.canMangleProvide} ${this.canMangleUse}` - ); - } + return { ...options, stage: stage }; + }; + return createFakeHook( + { + name, + /** @type {AsyncSeriesHook["intercept"]} */ + intercept(interceptor) { + throw new Error(errorMessage("it's using 'intercept'")); + }, + /** @type {AsyncSeriesHook["tap"]} */ + tap: (options, fn) => { + processAssetsHook.tap(getOptions(options), () => fn(...getArgs())); + }, + /** @type {AsyncSeriesHook["tapAsync"]} */ + tapAsync: (options, fn) => { + processAssetsHook.tapAsync( + getOptions(options), + (assets, callback) => + /** @type {any} */ (fn)(...getArgs(), callback) + ); + }, + /** @type {AsyncSeriesHook["tapPromise"]} */ + tapPromise: (options, fn) => { + processAssetsHook.tapPromise(getOptions(options), () => + fn(...getArgs()) + ); + } + }, + `${name} is deprecated (use Compilation.hooks.processAssets instead and use one of Compilation.PROCESS_ASSETS_STAGE_* as stage option)`, + code + ); + }; + this.hooks = Object.freeze({ + /** @type {SyncHook<[Module]>} */ + buildModule: new SyncHook(["module"]), + /** @type {SyncHook<[Module]>} */ + rebuildModule: new SyncHook(["module"]), + /** @type {SyncHook<[Module, WebpackError]>} */ + failedModule: new SyncHook(["module", "error"]), + /** @type {SyncHook<[Module]>} */ + succeedModule: new SyncHook(["module"]), + /** @type {SyncHook<[Module]>} */ + stillValidModule: new SyncHook(["module"]), - /** - * @param {RuntimeSpec} runtime only apply to this runtime - * @returns {boolean} true, when something changed - */ - setUsedInUnknownWay(runtime) { - let changed = false; - if ( - this.setUsedConditionally( - used => used < UsageState.Unknown, - UsageState.Unknown, - runtime - ) - ) { - changed = true; - } - if (this.canMangleUse !== false) { - this.canMangleUse = false; - changed = true; - } - return changed; - } + /** @type {SyncHook<[Dependency, EntryOptions]>} */ + addEntry: new SyncHook(["entry", "options"]), + /** @type {SyncHook<[Dependency, EntryOptions, Error]>} */ + failedEntry: new SyncHook(["entry", "options", "error"]), + /** @type {SyncHook<[Dependency, EntryOptions, Module]>} */ + succeedEntry: new SyncHook(["entry", "options", "module"]), - /** - * @param {RuntimeSpec} runtime only apply to this runtime - * @returns {boolean} true, when something changed - */ - setUsedWithoutInfo(runtime) { - let changed = false; - if (this.setUsed(UsageState.NoInfo, runtime)) { - changed = true; - } - if (this.canMangleUse !== false) { - this.canMangleUse = false; - changed = true; - } - return changed; - } + /** @type {SyncWaterfallHook<[(string[] | ReferencedExport)[], Dependency, RuntimeSpec]>} */ + dependencyReferencedExports: new SyncWaterfallHook([ + "referencedExports", + "dependency", + "runtime" + ]), - setHasUseInfo() { - if (!this._hasUseInRuntimeInfo) { - this._hasUseInRuntimeInfo = true; - } - if (this.canMangleUse === undefined) { - this.canMangleUse = true; - } - if (this.exportsInfoOwned) { - this.exportsInfo.setHasUseInfo(); - } - } + /** @type {SyncHook<[ExecuteModuleArgument, ExecuteModuleContext]>} */ + executeModule: new SyncHook(["options", "context"]), + /** @type {AsyncParallelHook<[ExecuteModuleArgument, ExecuteModuleContext]>} */ + prepareModuleExecution: new AsyncParallelHook(["options", "context"]), - /** - * @param {function(UsageStateType): boolean} condition compare with old value - * @param {UsageStateType} newValue set when condition is true - * @param {RuntimeSpec} runtime only apply to this runtime - * @returns {boolean} true when something has changed - */ - setUsedConditionally(condition, newValue, runtime) { - if (runtime === undefined) { - if (this._globalUsed === undefined) { - this._globalUsed = newValue; - return true; - } else { - if (this._globalUsed !== newValue && condition(this._globalUsed)) { - this._globalUsed = newValue; - return true; - } - } - } else if (this._usedInRuntime === undefined) { - if (newValue !== UsageState.Unused && condition(UsageState.Unused)) { - this._usedInRuntime = new Map(); - forEachRuntime(runtime, runtime => - this._usedInRuntime.set(runtime, newValue) - ); - return true; - } - } else { - let changed = false; - forEachRuntime(runtime, runtime => { - /** @type {UsageStateType} */ - let oldValue = this._usedInRuntime.get(runtime); - if (oldValue === undefined) oldValue = UsageState.Unused; - if (newValue !== oldValue && condition(oldValue)) { - if (newValue === UsageState.Unused) { - this._usedInRuntime.delete(runtime); - } else { - this._usedInRuntime.set(runtime, newValue); - } - changed = true; - } - }); - if (changed) { - if (this._usedInRuntime.size === 0) this._usedInRuntime = undefined; - return true; - } - } - return false; - } + /** @type {AsyncSeriesHook<[Iterable]>} */ + finishModules: new AsyncSeriesHook(["modules"]), + /** @type {AsyncSeriesHook<[Module]>} */ + finishRebuildingModule: new AsyncSeriesHook(["module"]), + /** @type {SyncHook<[]>} */ + unseal: new SyncHook([]), + /** @type {SyncHook<[]>} */ + seal: new SyncHook([]), - /** - * @param {UsageStateType} newValue new value of the used state - * @param {RuntimeSpec} runtime only apply to this runtime - * @returns {boolean} true when something has changed - */ - setUsed(newValue, runtime) { - if (runtime === undefined) { - if (this._globalUsed !== newValue) { - this._globalUsed = newValue; - return true; - } - } else if (this._usedInRuntime === undefined) { - if (newValue !== UsageState.Unused) { - this._usedInRuntime = new Map(); - forEachRuntime(runtime, runtime => - this._usedInRuntime.set(runtime, newValue) - ); - return true; - } - } else { - let changed = false; - forEachRuntime(runtime, runtime => { - /** @type {UsageStateType} */ - let oldValue = this._usedInRuntime.get(runtime); - if (oldValue === undefined) oldValue = UsageState.Unused; - if (newValue !== oldValue) { - if (newValue === UsageState.Unused) { - this._usedInRuntime.delete(runtime); - } else { - this._usedInRuntime.set(runtime, newValue); - } - changed = true; - } - }); - if (changed) { - if (this._usedInRuntime.size === 0) this._usedInRuntime = undefined; - return true; - } - } - return false; - } + /** @type {SyncHook<[]>} */ + beforeChunks: new SyncHook([]), + /** @type {SyncHook<[Iterable]>} */ + afterChunks: new SyncHook(["chunks"]), - /** - * @param {any} key the key - * @returns {boolean} true, if something has changed - */ - unsetTarget(key) { - if (!this._target) return false; - if (this._target.delete(key)) { - this._maxTarget = undefined; - return true; - } - return false; - } + /** @type {SyncBailHook<[Iterable]>} */ + optimizeDependencies: new SyncBailHook(["modules"]), + /** @type {SyncHook<[Iterable]>} */ + afterOptimizeDependencies: new SyncHook(["modules"]), - /** - * @param {any} key the key - * @param {ModuleGraphConnection} connection the target module if a single one - * @param {string[]=} exportName the exported name - * @param {number=} priority priority - * @returns {boolean} true, if something has changed - */ - setTarget(key, connection, exportName, priority = 0) { - if (exportName) exportName = [...exportName]; - if (!this._target) { - this._target = new Map(); - this._target.set(key, { connection, export: exportName, priority }); - return true; - } - const oldTarget = this._target.get(key); - if (!oldTarget) { - if (oldTarget === null && !connection) return false; - this._target.set(key, { connection, export: exportName, priority }); - this._maxTarget = undefined; - return true; - } - if ( - oldTarget.connection !== connection || - oldTarget.priority !== priority || - (exportName - ? !oldTarget.export || !equals(oldTarget.export, exportName) - : oldTarget.export) - ) { - oldTarget.connection = connection; - oldTarget.export = exportName; - oldTarget.priority = priority; - this._maxTarget = undefined; - return true; - } - return false; - } + /** @type {SyncHook<[]>} */ + optimize: new SyncHook([]), + /** @type {SyncBailHook<[Iterable]>} */ + optimizeModules: new SyncBailHook(["modules"]), + /** @type {SyncHook<[Iterable]>} */ + afterOptimizeModules: new SyncHook(["modules"]), - /** - * @param {RuntimeSpec} runtime for this runtime - * @returns {UsageStateType} usage state - */ - getUsed(runtime) { - if (!this._hasUseInRuntimeInfo) return UsageState.NoInfo; - if (this._globalUsed !== undefined) return this._globalUsed; - if (this._usedInRuntime === undefined) { - return UsageState.Unused; - } else if (typeof runtime === "string") { - const value = this._usedInRuntime.get(runtime); - return value === undefined ? UsageState.Unused : value; - } else if (runtime === undefined) { - /** @type {UsageStateType} */ - let max = UsageState.Unused; - for (const value of this._usedInRuntime.values()) { - if (value === UsageState.Used) { - return UsageState.Used; - } - if (max < value) max = value; - } - return max; - } else { - /** @type {UsageStateType} */ - let max = UsageState.Unused; - for (const item of runtime) { - const value = this._usedInRuntime.get(item); - if (value !== undefined) { - if (value === UsageState.Used) { - return UsageState.Used; - } - if (max < value) max = value; - } - } - return max; - } - } + /** @type {SyncBailHook<[Iterable, ChunkGroup[]]>} */ + optimizeChunks: new SyncBailHook(["chunks", "chunkGroups"]), + /** @type {SyncHook<[Iterable, ChunkGroup[]]>} */ + afterOptimizeChunks: new SyncHook(["chunks", "chunkGroups"]), - /** - * get used name - * @param {string | undefined} fallbackName fallback name for used exports with no name - * @param {RuntimeSpec} runtime check usage for this runtime only - * @returns {string | false} used name - */ - getUsedName(fallbackName, runtime) { - if (this._hasUseInRuntimeInfo) { - if (this._globalUsed !== undefined) { - if (this._globalUsed === UsageState.Unused) return false; - } else { - if (this._usedInRuntime === undefined) return false; - if (typeof runtime === "string") { - if (!this._usedInRuntime.has(runtime)) { - return false; - } - } else if (runtime !== undefined) { - if ( - Array.from(runtime).every( - runtime => !this._usedInRuntime.has(runtime) - ) - ) { - return false; - } - } - } - } - if (this._usedName !== null) return this._usedName; - return this.name || fallbackName; - } + /** @type {AsyncSeriesHook<[Iterable, Iterable]>} */ + optimizeTree: new AsyncSeriesHook(["chunks", "modules"]), + /** @type {SyncHook<[Iterable, Iterable]>} */ + afterOptimizeTree: new SyncHook(["chunks", "modules"]), - /** - * @returns {boolean} true, when a mangled name of this export is set - */ - hasUsedName() { - return this._usedName !== null; - } + /** @type {AsyncSeriesBailHook<[Iterable, Iterable]>} */ + optimizeChunkModules: new AsyncSeriesBailHook(["chunks", "modules"]), + /** @type {SyncHook<[Iterable, Iterable]>} */ + afterOptimizeChunkModules: new SyncHook(["chunks", "modules"]), + /** @type {SyncBailHook<[], boolean>} */ + shouldRecord: new SyncBailHook([]), - /** - * Sets the mangled name of this export - * @param {string} name the new name - * @returns {void} - */ - setUsedName(name) { - this._usedName = name; - } + /** @type {SyncHook<[Chunk, Set, RuntimeRequirementsContext]>} */ + additionalChunkRuntimeRequirements: new SyncHook([ + "chunk", + "runtimeRequirements", + "context" + ]), + /** @type {HookMap, RuntimeRequirementsContext]>>} */ + runtimeRequirementInChunk: new HookMap( + () => new SyncBailHook(["chunk", "runtimeRequirements", "context"]) + ), + /** @type {SyncHook<[Module, Set, RuntimeRequirementsContext]>} */ + additionalModuleRuntimeRequirements: new SyncHook([ + "module", + "runtimeRequirements", + "context" + ]), + /** @type {HookMap, RuntimeRequirementsContext]>>} */ + runtimeRequirementInModule: new HookMap( + () => new SyncBailHook(["module", "runtimeRequirements", "context"]) + ), + /** @type {SyncHook<[Chunk, Set, RuntimeRequirementsContext]>} */ + additionalTreeRuntimeRequirements: new SyncHook([ + "chunk", + "runtimeRequirements", + "context" + ]), + /** @type {HookMap, RuntimeRequirementsContext]>>} */ + runtimeRequirementInTree: new HookMap( + () => new SyncBailHook(["chunk", "runtimeRequirements", "context"]) + ), - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {function({ module: Module, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target - * @returns {ExportInfo | ExportsInfo | undefined} the terminal binding export(s) info if known - */ - getTerminalBinding(moduleGraph, resolveTargetFilter = RETURNS_TRUE) { - if (this.terminalBinding) return this; - const target = this.getTarget(moduleGraph, resolveTargetFilter); - if (!target) return undefined; - const exportsInfo = moduleGraph.getExportsInfo(target.module); - if (!target.export) return exportsInfo; - return exportsInfo.getReadOnlyExportInfoRecursive(target.export); - } + /** @type {SyncHook<[RuntimeModule, Chunk]>} */ + runtimeModule: new SyncHook(["module", "chunk"]), - isReexport() { - return !this.terminalBinding && this._target && this._target.size > 0; - } + /** @type {SyncHook<[Iterable, any]>} */ + reviveModules: new SyncHook(["modules", "records"]), + /** @type {SyncHook<[Iterable]>} */ + beforeModuleIds: new SyncHook(["modules"]), + /** @type {SyncHook<[Iterable]>} */ + moduleIds: new SyncHook(["modules"]), + /** @type {SyncHook<[Iterable]>} */ + optimizeModuleIds: new SyncHook(["modules"]), + /** @type {SyncHook<[Iterable]>} */ + afterOptimizeModuleIds: new SyncHook(["modules"]), - _getMaxTarget() { - if (this._maxTarget !== undefined) return this._maxTarget; - if (this._target.size <= 1) return (this._maxTarget = this._target); - let maxPriority = -Infinity; - let minPriority = Infinity; - for (const { priority } of this._target.values()) { - if (maxPriority < priority) maxPriority = priority; - if (minPriority > priority) minPriority = priority; - } - // This should be very common - if (maxPriority === minPriority) return (this._maxTarget = this._target); + /** @type {SyncHook<[Iterable, any]>} */ + reviveChunks: new SyncHook(["chunks", "records"]), + /** @type {SyncHook<[Iterable]>} */ + beforeChunkIds: new SyncHook(["chunks"]), + /** @type {SyncHook<[Iterable]>} */ + chunkIds: new SyncHook(["chunks"]), + /** @type {SyncHook<[Iterable]>} */ + optimizeChunkIds: new SyncHook(["chunks"]), + /** @type {SyncHook<[Iterable]>} */ + afterOptimizeChunkIds: new SyncHook(["chunks"]), - // This is an edge case - const map = new Map(); - for (const [key, value] of this._target) { - if (maxPriority === value.priority) { - map.set(key, value); - } - } - this._maxTarget = map; - return map; - } + /** @type {SyncHook<[Iterable, any]>} */ + recordModules: new SyncHook(["modules", "records"]), + /** @type {SyncHook<[Iterable, any]>} */ + recordChunks: new SyncHook(["chunks", "records"]), - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {function(Module): boolean} validTargetModuleFilter a valid target module - * @returns {{ module: Module, export: string[] | undefined } | undefined | false} the target, undefined when there is no target, false when no target is valid - */ - findTarget(moduleGraph, validTargetModuleFilter) { - return this._findTarget(moduleGraph, validTargetModuleFilter, new Set()); - } + /** @type {SyncHook<[Iterable]>} */ + optimizeCodeGeneration: new SyncHook(["modules"]), - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {function(Module): boolean} validTargetModuleFilter a valid target module - * @param {Set | undefined} alreadyVisited set of already visited export info to avoid circular references - * @returns {{ module: Module, export: string[] | undefined } | undefined | false} the target, undefined when there is no target, false when no target is valid - */ - _findTarget(moduleGraph, validTargetModuleFilter, alreadyVisited) { - if (!this._target || this._target.size === 0) return undefined; - let rawTarget = this._getMaxTarget().values().next().value; - if (!rawTarget) return undefined; - /** @type {{ module: Module, export: string[] | undefined }} */ - let target = { - module: rawTarget.connection.module, - export: rawTarget.export - }; - for (;;) { - if (validTargetModuleFilter(target.module)) return target; - const exportsInfo = moduleGraph.getExportsInfo(target.module); - const exportInfo = exportsInfo.getExportInfo(target.export[0]); - if (alreadyVisited.has(exportInfo)) return null; - const newTarget = exportInfo._findTarget( - moduleGraph, - validTargetModuleFilter, - alreadyVisited - ); - if (!newTarget) return false; - if (target.export.length === 1) { - target = newTarget; - } else { - target = { - module: newTarget.module, - export: newTarget.export - ? newTarget.export.concat(target.export.slice(1)) - : target.export.slice(1) - }; - } - } - } + /** @type {SyncHook<[]>} */ + beforeModuleHash: new SyncHook([]), + /** @type {SyncHook<[]>} */ + afterModuleHash: new SyncHook([]), - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {function({ module: Module, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target - * @returns {{ module: Module, export: string[] | undefined } | undefined} the target - */ - getTarget(moduleGraph, resolveTargetFilter = RETURNS_TRUE) { - const result = this._getTarget(moduleGraph, resolveTargetFilter, undefined); - if (result === CIRCULAR) return undefined; - return result; - } + /** @type {SyncHook<[]>} */ + beforeCodeGeneration: new SyncHook([]), + /** @type {SyncHook<[]>} */ + afterCodeGeneration: new SyncHook([]), - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {function({ module: Module, connection: ModuleGraphConnection, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target - * @param {Set | undefined} alreadyVisited set of already visited export info to avoid circular references - * @returns {{ module: Module, connection: ModuleGraphConnection, export: string[] | undefined } | CIRCULAR | undefined} the target - */ - _getTarget(moduleGraph, resolveTargetFilter, alreadyVisited) { - /** - * @param {{ connection: ModuleGraphConnection, export: string[] | undefined } | null} inputTarget unresolved target - * @param {Set} alreadyVisited set of already visited export info to avoid circular references - * @returns {{ module: Module, connection: ModuleGraphConnection, export: string[] | undefined } | CIRCULAR | null} resolved target - */ - const resolveTarget = (inputTarget, alreadyVisited) => { - if (!inputTarget) return null; - if (!inputTarget.export) { - return { - module: inputTarget.connection.module, - connection: inputTarget.connection, - export: undefined - }; - } - /** @type {{ module: Module, connection: ModuleGraphConnection, export: string[] | undefined }} */ - let target = { - module: inputTarget.connection.module, - connection: inputTarget.connection, - export: inputTarget.export - }; - if (!resolveTargetFilter(target)) return target; - let alreadyVisitedOwned = false; - for (;;) { - const exportsInfo = moduleGraph.getExportsInfo(target.module); - const exportInfo = exportsInfo.getExportInfo(target.export[0]); - if (!exportInfo) return target; - if (alreadyVisited.has(exportInfo)) return CIRCULAR; - const newTarget = exportInfo._getTarget( - moduleGraph, - resolveTargetFilter, - alreadyVisited - ); - if (newTarget === CIRCULAR) return CIRCULAR; - if (!newTarget) return target; - if (target.export.length === 1) { - target = newTarget; - if (!target.export) return target; - } else { - target = { - module: newTarget.module, - connection: newTarget.connection, - export: newTarget.export - ? newTarget.export.concat(target.export.slice(1)) - : target.export.slice(1) - }; - } - if (!resolveTargetFilter(target)) return target; - if (!alreadyVisitedOwned) { - alreadyVisited = new Set(alreadyVisited); - alreadyVisitedOwned = true; - } - alreadyVisited.add(exportInfo); - } - }; + /** @type {SyncHook<[]>} */ + beforeRuntimeRequirements: new SyncHook([]), + /** @type {SyncHook<[]>} */ + afterRuntimeRequirements: new SyncHook([]), - if (!this._target || this._target.size === 0) return undefined; - if (alreadyVisited && alreadyVisited.has(this)) return CIRCULAR; - const newAlreadyVisited = new Set(alreadyVisited); - newAlreadyVisited.add(this); - const values = this._getMaxTarget().values(); - const target = resolveTarget(values.next().value, newAlreadyVisited); - if (target === CIRCULAR) return CIRCULAR; - if (target === null) return undefined; - let result = values.next(); - while (!result.done) { - const t = resolveTarget(result.value, newAlreadyVisited); - if (t === CIRCULAR) return CIRCULAR; - if (t === null) return undefined; - if (t.module !== target.module) return undefined; - if (!t.export !== !target.export) return undefined; - if (target.export && !equals(t.export, target.export)) return undefined; - result = values.next(); - } - return target; - } + /** @type {SyncHook<[]>} */ + beforeHash: new SyncHook([]), + /** @type {SyncHook<[Chunk]>} */ + contentHash: new SyncHook(["chunk"]), + /** @type {SyncHook<[]>} */ + afterHash: new SyncHook([]), + /** @type {SyncHook<[any]>} */ + recordHash: new SyncHook(["records"]), + /** @type {SyncHook<[Compilation, any]>} */ + record: new SyncHook(["compilation", "records"]), - /** - * Move the target forward as long resolveTargetFilter is fulfilled - * @param {ModuleGraph} moduleGraph the module graph - * @param {function({ module: Module, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target - * @param {function({ module: Module, export: string[] | undefined }): ModuleGraphConnection=} updateOriginalConnection updates the original connection instead of using the target connection - * @returns {{ module: Module, export: string[] | undefined } | undefined} the resolved target when moved - */ - moveTarget(moduleGraph, resolveTargetFilter, updateOriginalConnection) { - const target = this._getTarget(moduleGraph, resolveTargetFilter, undefined); - if (target === CIRCULAR) return undefined; - if (!target) return undefined; - const originalTarget = this._getMaxTarget().values().next().value; - if ( - originalTarget.connection === target.connection && - originalTarget.export === target.export - ) { - return undefined; - } - this._target.clear(); - this._target.set(undefined, { - connection: updateOriginalConnection - ? updateOriginalConnection(target) - : target.connection, - export: target.export, - priority: 0 - }); - return target; - } - - createNestedExportsInfo() { - if (this.exportsInfoOwned) return this.exportsInfo; - this.exportsInfoOwned = true; - const oldExportsInfo = this.exportsInfo; - this.exportsInfo = new ExportsInfo(); - this.exportsInfo.setHasProvideInfo(); - if (oldExportsInfo) { - this.exportsInfo.setRedirectNamedTo(oldExportsInfo); - } - return this.exportsInfo; - } - - getNestedExportsInfo() { - return this.exportsInfo; - } + /** @type {SyncHook<[]>} */ + beforeModuleAssets: new SyncHook([]), + /** @type {SyncBailHook<[], boolean>} */ + shouldGenerateChunkAssets: new SyncBailHook([]), + /** @type {SyncHook<[]>} */ + beforeChunkAssets: new SyncHook([]), + // TODO webpack 6 remove + /** @deprecated */ + additionalChunkAssets: createProcessAssetsHook( + "additionalChunkAssets", + Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL, + () => [this.chunks], + "DEP_WEBPACK_COMPILATION_ADDITIONAL_CHUNK_ASSETS" + ), - hasInfo(baseInfo, runtime) { - return ( - (this._usedName && this._usedName !== this.name) || - this.provided || - this.terminalBinding || - this.getUsed(runtime) !== baseInfo.getUsed(runtime) - ); - } + // TODO webpack 6 deprecate + /** @deprecated */ + additionalAssets: createProcessAssetsHook( + "additionalAssets", + Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL, + () => [] + ), + // TODO webpack 6 remove + /** @deprecated */ + optimizeChunkAssets: createProcessAssetsHook( + "optimizeChunkAssets", + Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE, + () => [this.chunks], + "DEP_WEBPACK_COMPILATION_OPTIMIZE_CHUNK_ASSETS" + ), + // TODO webpack 6 remove + /** @deprecated */ + afterOptimizeChunkAssets: createProcessAssetsHook( + "afterOptimizeChunkAssets", + Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE + 1, + () => [this.chunks], + "DEP_WEBPACK_COMPILATION_AFTER_OPTIMIZE_CHUNK_ASSETS" + ), + // TODO webpack 6 deprecate + /** @deprecated */ + optimizeAssets: processAssetsHook, + // TODO webpack 6 deprecate + /** @deprecated */ + afterOptimizeAssets: afterProcessAssetsHook, - updateHash(hash, runtime) { - this._updateHash(hash, runtime, new Set()); - } + processAssets: processAssetsHook, + afterProcessAssets: afterProcessAssetsHook, + /** @type {AsyncSeriesHook<[CompilationAssets]>} */ + processAdditionalAssets: new AsyncSeriesHook(["assets"]), - _updateHash(hash, runtime, alreadyVisitedExportsInfo) { - hash.update( - `${this._usedName || this.name}${this.getUsed(runtime)}${this.provided}${ - this.terminalBinding - }` - ); - if (this.exportsInfo && !alreadyVisitedExportsInfo.has(this.exportsInfo)) { - this.exportsInfo._updateHash(hash, runtime, alreadyVisitedExportsInfo); - } - } + /** @type {SyncBailHook<[], boolean>} */ + needAdditionalSeal: new SyncBailHook([]), + /** @type {AsyncSeriesHook<[]>} */ + afterSeal: new AsyncSeriesHook([]), - getUsedInfo() { - if (this._globalUsed !== undefined) { - switch (this._globalUsed) { - case UsageState.Unused: - return "unused"; - case UsageState.NoInfo: - return "no usage info"; - case UsageState.Unknown: - return "maybe used (runtime-defined)"; - case UsageState.Used: - return "used"; - case UsageState.OnlyPropertiesUsed: - return "only properties used"; - } - } else if (this._usedInRuntime !== undefined) { - /** @type {Map} */ - const map = new Map(); - for (const [runtime, used] of this._usedInRuntime) { - const list = map.get(used); - if (list !== undefined) list.push(runtime); - else map.set(used, [runtime]); - } - const specificInfo = Array.from(map, ([used, runtimes]) => { - switch (used) { - case UsageState.NoInfo: - return `no usage info in ${runtimes.join(", ")}`; - case UsageState.Unknown: - return `maybe used in ${runtimes.join(", ")} (runtime-defined)`; - case UsageState.Used: - return `used in ${runtimes.join(", ")}`; - case UsageState.OnlyPropertiesUsed: - return `only properties used in ${runtimes.join(", ")}`; - } - }); - if (specificInfo.length > 0) { - return specificInfo.join("; "); - } - } - return this._hasUseInRuntimeInfo ? "unused" : "no usage info"; - } + /** @type {SyncWaterfallHook<[RenderManifestEntry[], RenderManifestOptions]>} */ + renderManifest: new SyncWaterfallHook(["result", "options"]), - getProvidedInfo() { - switch (this.provided) { - case undefined: - return "no provided info"; - case null: - return "maybe provided (runtime-defined)"; - case true: - return "provided"; - case false: - return "not provided"; - } - } + /** @type {SyncHook<[Hash]>} */ + fullHash: new SyncHook(["hash"]), + /** @type {SyncHook<[Chunk, Hash, ChunkHashContext]>} */ + chunkHash: new SyncHook(["chunk", "chunkHash", "ChunkHashContext"]), - getRenameInfo() { - if (this._usedName !== null && this._usedName !== this.name) { - return `renamed to ${JSON.stringify(this._usedName).slice(1, -1)}`; - } - switch (this.canMangleProvide) { - case undefined: - switch (this.canMangleUse) { - case undefined: - return "missing provision and use info prevents renaming"; - case false: - return "usage prevents renaming (no provision info)"; - case true: - return "missing provision info prevents renaming"; - } - break; - case true: - switch (this.canMangleUse) { - case undefined: - return "missing usage info prevents renaming"; - case false: - return "usage prevents renaming"; - case true: - return "could be renamed"; - } - break; - case false: - switch (this.canMangleUse) { - case undefined: - return "provision prevents renaming (no use info)"; - case false: - return "usage and provision prevents renaming"; - case true: - return "provision prevents renaming"; - } - break; - } - throw new Error( - `Unexpected flags for getRenameInfo ${this.canMangleProvide} ${this.canMangleUse}` - ); - } -} + /** @type {SyncHook<[Module, string]>} */ + moduleAsset: new SyncHook(["module", "filename"]), + /** @type {SyncHook<[Chunk, string]>} */ + chunkAsset: new SyncHook(["chunk", "filename"]), -module.exports = ExportsInfo; -module.exports.ExportInfo = ExportInfo; -module.exports.UsageState = UsageState; + /** @type {SyncWaterfallHook<[string, object, AssetInfo]>} */ + assetPath: new SyncWaterfallHook(["path", "options", "assetInfo"]), + /** @type {SyncBailHook<[], boolean>} */ + needAdditionalPass: new SyncBailHook([]), -/***/ }), + /** @type {SyncHook<[Compiler, string, number]>} */ + childCompiler: new SyncHook([ + "childCompiler", + "compilerName", + "compilerIndex" + ]), -/***/ 7145: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** @type {SyncBailHook<[string, LogEntry], true>} */ + log: new SyncBailHook(["origin", "logEntry"]), -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** @type {SyncWaterfallHook<[WebpackError[]]>} */ + processWarnings: new SyncWaterfallHook(["warnings"]), + /** @type {SyncWaterfallHook<[WebpackError[]]>} */ + processErrors: new SyncWaterfallHook(["errors"]), + /** @type {HookMap, CreateStatsOptionsContext]>>} */ + statsPreset: new HookMap(() => new SyncHook(["options", "context"])), + /** @type {SyncHook<[Partial, CreateStatsOptionsContext]>} */ + statsNormalize: new SyncHook(["options", "context"]), + /** @type {SyncHook<[StatsFactory, NormalizedStatsOptions]>} */ + statsFactory: new SyncHook(["statsFactory", "options"]), + /** @type {SyncHook<[StatsPrinter, NormalizedStatsOptions]>} */ + statsPrinter: new SyncHook(["statsPrinter", "options"]), + get normalModuleLoader() { + return getNormalModuleLoader(); + } + }); + /** @type {string=} */ + this.name = undefined; + this.startTime = undefined; + this.endTime = undefined; + /** @type {Compiler} */ + this.compiler = compiler; + this.resolverFactory = compiler.resolverFactory; + this.inputFileSystem = compiler.inputFileSystem; + this.fileSystemInfo = new FileSystemInfo(this.inputFileSystem, { + managedPaths: compiler.managedPaths, + immutablePaths: compiler.immutablePaths, + logger: this.getLogger("webpack.FileSystemInfo"), + hashFunction: compiler.options.output.hashFunction + }); + if (compiler.fileTimestamps) { + this.fileSystemInfo.addFileTimestamps(compiler.fileTimestamps, true); + } + if (compiler.contextTimestamps) { + this.fileSystemInfo.addContextTimestamps( + compiler.contextTimestamps, + true + ); + } + /** @type {Map>} */ + this.valueCacheVersions = new Map(); + this.requestShortener = compiler.requestShortener; + this.compilerPath = compiler.compilerPath; -const ConstDependency = __webpack_require__(76911); -const ExportsInfoDependency = __webpack_require__(78988); + this.logger = this.getLogger("webpack.Compilation"); -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ + const options = compiler.options; + this.options = options; + this.outputOptions = options && options.output; + /** @type {boolean} */ + this.bail = (options && options.bail) || false; + /** @type {boolean} */ + this.profile = (options && options.profile) || false; -class ExportsInfoApiPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "ExportsInfoApiPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyTemplates.set( - ExportsInfoDependency, - new ExportsInfoDependency.Template() - ); - /** - * @param {JavascriptParser} parser the parser - * @returns {void} - */ - const handler = parser => { - parser.hooks.expressionMemberChain - .for("__webpack_exports_info__") - .tap("ExportsInfoApiPlugin", (expr, members) => { - const dep = - members.length >= 2 - ? new ExportsInfoDependency( - expr.range, - members.slice(0, -1), - members[members.length - 1] - ) - : new ExportsInfoDependency(expr.range, null, members[0]); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - return true; - }); - parser.hooks.expression - .for("__webpack_exports_info__") - .tap("ExportsInfoApiPlugin", expr => { - const dep = new ConstDependency("true", expr.range); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - }; - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("ExportsInfoApiPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("ExportsInfoApiPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("ExportsInfoApiPlugin", handler); - } + this.params = params; + this.mainTemplate = new MainTemplate(this.outputOptions, this); + this.chunkTemplate = new ChunkTemplate(this.outputOptions, this); + this.runtimeTemplate = new RuntimeTemplate( + this, + this.outputOptions, + this.requestShortener ); - } -} - -module.exports = ExportsInfoApiPlugin; + /** @type {{javascript: ModuleTemplate}} */ + this.moduleTemplates = { + javascript: new ModuleTemplate(this.runtimeTemplate, this) + }; + defineRemovedModuleTemplates(this.moduleTemplates); + /** @type {Map> | undefined} */ + this.moduleMemCaches = undefined; + /** @type {Map> | undefined} */ + this.moduleMemCaches2 = undefined; + this.moduleGraph = new ModuleGraph(); + /** @type {ChunkGraph} */ + this.chunkGraph = undefined; + /** @type {CodeGenerationResults} */ + this.codeGenerationResults = undefined; -/***/ }), + /** @type {AsyncQueue} */ + this.processDependenciesQueue = new AsyncQueue({ + name: "processDependencies", + parallelism: options.parallelism || 100, + processor: this._processModuleDependencies.bind(this) + }); + /** @type {AsyncQueue} */ + this.addModuleQueue = new AsyncQueue({ + name: "addModule", + parent: this.processDependenciesQueue, + getKey: module => module.identifier(), + processor: this._addModule.bind(this) + }); + /** @type {AsyncQueue} */ + this.factorizeQueue = new AsyncQueue({ + name: "factorize", + parent: this.addModuleQueue, + processor: this._factorizeModule.bind(this) + }); + /** @type {AsyncQueue} */ + this.buildQueue = new AsyncQueue({ + name: "build", + parent: this.factorizeQueue, + processor: this._buildModule.bind(this) + }); + /** @type {AsyncQueue} */ + this.rebuildQueue = new AsyncQueue({ + name: "rebuild", + parallelism: options.parallelism || 100, + processor: this._rebuildModule.bind(this) + }); -/***/ 73071: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * Modules in value are building during the build of Module in key. + * Means value blocking key from finishing. + * Needed to detect build cycles. + * @type {WeakMap>} + */ + this.creatingModuleDuringBuild = new WeakMap(); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** @type {Map} */ + this.entries = new Map(); + /** @type {EntryData} */ + this.globalEntry = { + dependencies: [], + includeDependencies: [], + options: { + name: undefined + } + }; + /** @type {Map} */ + this.entrypoints = new Map(); + /** @type {Entrypoint[]} */ + this.asyncEntrypoints = []; + /** @type {Set} */ + this.chunks = new Set(); + /** @type {ChunkGroup[]} */ + this.chunkGroups = []; + /** @type {Map} */ + this.namedChunkGroups = new Map(); + /** @type {Map} */ + this.namedChunks = new Map(); + /** @type {Set} */ + this.modules = new Set(); + if (this._backCompat) { + arrayToSetDeprecation(this.chunks, "Compilation.chunks"); + arrayToSetDeprecation(this.modules, "Compilation.modules"); + } + /** @private @type {Map} */ + this._modules = new Map(); + this.records = null; + /** @type {string[]} */ + this.additionalChunkAssets = []; + /** @type {CompilationAssets} */ + this.assets = {}; + /** @type {Map} */ + this.assetsInfo = new Map(); + /** @type {Map>>} */ + this._assetsRelatedIn = new Map(); + /** @type {WebpackError[]} */ + this.errors = []; + /** @type {WebpackError[]} */ + this.warnings = []; + /** @type {Compilation[]} */ + this.children = []; + /** @type {Map} */ + this.logging = new Map(); + /** @type {Map} */ + this.dependencyFactories = new Map(); + /** @type {DependencyTemplates} */ + this.dependencyTemplates = new DependencyTemplates( + this.outputOptions.hashFunction + ); + this.childrenCounters = {}; + /** @type {Set} */ + this.usedChunkIds = null; + /** @type {Set} */ + this.usedModuleIds = null; + /** @type {boolean} */ + this.needAdditionalPass = false; + /** @type {Set} */ + this._restoredUnsafeCacheModuleEntries = new Set(); + /** @type {Map} */ + this._restoredUnsafeCacheEntries = new Map(); + /** @type {WeakSet} */ + this.builtModules = new WeakSet(); + /** @type {WeakSet} */ + this.codeGeneratedModules = new WeakSet(); + /** @type {WeakSet} */ + this.buildTimeExecutedModules = new WeakSet(); + /** @private @type {Map} */ + this._rebuildingModules = new Map(); + /** @type {Set} */ + this.emittedAssets = new Set(); + /** @type {Set} */ + this.comparedForEmitAssets = new Set(); + /** @type {LazySet} */ + this.fileDependencies = new LazySet(); + /** @type {LazySet} */ + this.contextDependencies = new LazySet(); + /** @type {LazySet} */ + this.missingDependencies = new LazySet(); + /** @type {LazySet} */ + this.buildDependencies = new LazySet(); + // TODO webpack 6 remove + this.compilationDependencies = { + add: util.deprecate( + item => this.fileDependencies.add(item), + "Compilation.compilationDependencies is deprecated (used Compilation.fileDependencies instead)", + "DEP_WEBPACK_COMPILATION_COMPILATION_DEPENDENCIES" + ) + }; + this._modulesCache = this.getCache("Compilation/modules"); + this._assetsCache = this.getCache("Compilation/assets"); + this._codeGenerationCache = this.getCache("Compilation/codeGeneration"); + const unsafeCache = options.module.unsafeCache; + this._unsafeCache = !!unsafeCache; + this._unsafeCachePredicate = + typeof unsafeCache === "function" ? unsafeCache : () => true; + } -const { OriginalSource, RawSource } = __webpack_require__(51255); -const ConcatenationScope = __webpack_require__(98229); -const { UsageState } = __webpack_require__(63686); -const InitFragment = __webpack_require__(55870); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const StaticExportsDependency = __webpack_require__(91418); -const createHash = __webpack_require__(49835); -const extractUrlAndGlobal = __webpack_require__(11850); -const makeSerializable = __webpack_require__(33032); -const propertyAccess = __webpack_require__(54190); -const { register } = __webpack_require__(8282); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./ExportsInfo")} ExportsInfo */ -/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("./Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ -/** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./WebpackError")} WebpackError */ -/** @typedef {import("./javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */ -/** @typedef {import("./util/Hash")} Hash */ -/** @typedef {typeof import("./util/Hash")} HashConstructor */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - -/** - * @typedef {Object} SourceData - * @property {boolean=} iife - * @property {string=} init - * @property {string} expression - * @property {InitFragment[]=} chunkInitFragments - * @property {ReadonlySet=} runtimeRequirements - */ - -const TYPES = new Set(["javascript"]); -const CSS_TYPES = new Set(["css-import"]); -const RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]); -const RUNTIME_REQUIREMENTS_FOR_SCRIPT = new Set([RuntimeGlobals.loadScript]); -const RUNTIME_REQUIREMENTS_FOR_MODULE = new Set([ - RuntimeGlobals.definePropertyGetters -]); -const EMPTY_RUNTIME_REQUIREMENTS = new Set([]); - -/** - * @param {string|string[]} variableName the variable name or path - * @param {string} type the module system - * @returns {SourceData} the generated source - */ -const getSourceForGlobalVariableExternal = (variableName, type) => { - if (!Array.isArray(variableName)) { - // make it an array as the look up works the same basically - variableName = [variableName]; + getStats() { + return new Stats(this); } - // needed for e.g. window["some"]["thing"] - const objectLookup = variableName.map(r => `[${JSON.stringify(r)}]`).join(""); - return { - iife: type === "this", - expression: `${type}${objectLookup}` - }; -}; - -/** - * @param {string|string[]} moduleAndSpecifiers the module request - * @returns {SourceData} the generated source - */ -const getSourceForCommonJsExternal = moduleAndSpecifiers => { - if (!Array.isArray(moduleAndSpecifiers)) { - return { - expression: `require(${JSON.stringify(moduleAndSpecifiers)})` - }; + /** + * @param {StatsOptions | string} optionsOrPreset stats option value + * @param {CreateStatsOptionsContext} context context + * @returns {NormalizedStatsOptions} normalized options + */ + createStatsOptions(optionsOrPreset, context = {}) { + if ( + typeof optionsOrPreset === "boolean" || + typeof optionsOrPreset === "string" + ) { + optionsOrPreset = { preset: optionsOrPreset }; + } + if (typeof optionsOrPreset === "object" && optionsOrPreset !== null) { + // We use this method of shallow cloning this object to include + // properties in the prototype chain + /** @type {Partial} */ + const options = {}; + for (const key in optionsOrPreset) { + options[key] = optionsOrPreset[key]; + } + if (options.preset !== undefined) { + this.hooks.statsPreset.for(options.preset).call(options, context); + } + this.hooks.statsNormalize.call(options, context); + return /** @type {NormalizedStatsOptions} */ (options); + } else { + /** @type {Partial} */ + const options = {}; + this.hooks.statsNormalize.call(options, context); + return /** @type {NormalizedStatsOptions} */ (options); + } } - const moduleName = moduleAndSpecifiers[0]; - return { - expression: `require(${JSON.stringify(moduleName)})${propertyAccess( - moduleAndSpecifiers, - 1 - )}` - }; -}; -/** - * @param {string|string[]} moduleAndSpecifiers the module request - * @returns {SourceData} the generated source - */ -const getSourceForCommonJsExternalInNodeModule = moduleAndSpecifiers => { - const chunkInitFragments = [ - new InitFragment( - 'import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";\n', - InitFragment.STAGE_HARMONY_IMPORTS, - 0, - "external module node-commonjs" - ) - ]; - if (!Array.isArray(moduleAndSpecifiers)) { - return { - expression: `__WEBPACK_EXTERNAL_createRequire(import.meta.url)(${JSON.stringify( - moduleAndSpecifiers - )})`, - chunkInitFragments - }; + createStatsFactory(options) { + const statsFactory = new StatsFactory(); + this.hooks.statsFactory.call(statsFactory, options); + return statsFactory; } - const moduleName = moduleAndSpecifiers[0]; - return { - expression: `__WEBPACK_EXTERNAL_createRequire(import.meta.url)(${JSON.stringify( - moduleName - )})${propertyAccess(moduleAndSpecifiers, 1)}`, - chunkInitFragments - }; -}; -/** - * @param {string|string[]} moduleAndSpecifiers the module request - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @returns {SourceData} the generated source - */ -const getSourceForImportExternal = (moduleAndSpecifiers, runtimeTemplate) => { - const importName = runtimeTemplate.outputOptions.importFunctionName; - if (!runtimeTemplate.supportsDynamicImport() && importName === "import") { - throw new Error( - "The target environment doesn't support 'import()' so it's not possible to use external type 'import'" - ); - } - if (!Array.isArray(moduleAndSpecifiers)) { - return { - expression: `${importName}(${JSON.stringify(moduleAndSpecifiers)});` - }; + createStatsPrinter(options) { + const statsPrinter = new StatsPrinter(); + this.hooks.statsPrinter.call(statsPrinter, options); + return statsPrinter; } - if (moduleAndSpecifiers.length === 1) { - return { - expression: `${importName}(${JSON.stringify(moduleAndSpecifiers[0])});` - }; + + /** + * @param {string} name cache name + * @returns {CacheFacade} the cache facade instance + */ + getCache(name) { + return this.compiler.getCache(name); } - const moduleName = moduleAndSpecifiers[0]; - return { - expression: `${importName}(${JSON.stringify( - moduleName - )}).then(${runtimeTemplate.returningFunction( - `module${propertyAccess(moduleAndSpecifiers, 1)}`, - "module" - )});` - }; -}; -class ModuleExternalInitFragment extends InitFragment { /** - * @param {string} request import source - * @param {string=} ident recomputed ident - * @param {string | HashConstructor=} hashFunction the hash function to use + * @param {string | (function(): string)} name name of the logger, or function called once to get the logger name + * @returns {Logger} a logger with that name */ - constructor(request, ident, hashFunction = "md4") { - if (ident === undefined) { - ident = Template.toIdentifier(request); - if (ident !== request) { - ident += `_${createHash(hashFunction) - .update(request) - .digest("hex") - .slice(0, 8)}`; - } + getLogger(name) { + if (!name) { + throw new TypeError("Compilation.getLogger(name) called without a name"); } - const identifier = `__WEBPACK_EXTERNAL_MODULE_${ident}__`; - super( - `import * as ${identifier} from ${JSON.stringify(request)};\n`, - InitFragment.STAGE_HARMONY_IMPORTS, - 0, - `external module import ${ident}` + /** @type {LogEntry[] | undefined} */ + let logEntries; + return new Logger( + (type, args) => { + if (typeof name === "function") { + name = name(); + if (!name) { + throw new TypeError( + "Compilation.getLogger(name) called with a function not returning a name" + ); + } + } + let trace; + switch (type) { + case LogType.warn: + case LogType.error: + case LogType.trace: + trace = ErrorHelpers.cutOffLoaderExecution(new Error("Trace").stack) + .split("\n") + .slice(3); + break; + } + /** @type {LogEntry} */ + const logEntry = { + time: Date.now(), + type, + args, + trace + }; + if (this.hooks.log.call(name, logEntry) === undefined) { + if (logEntry.type === LogType.profileEnd) { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + if (typeof console.profileEnd === "function") { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.profileEnd(`[${name}] ${logEntry.args[0]}`); + } + } + if (logEntries === undefined) { + logEntries = this.logging.get(name); + if (logEntries === undefined) { + logEntries = []; + this.logging.set(name, logEntries); + } + } + logEntries.push(logEntry); + if (logEntry.type === LogType.profile) { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + if (typeof console.profile === "function") { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.profile(`[${name}] ${logEntry.args[0]}`); + } + } + } + }, + childName => { + if (typeof name === "function") { + if (typeof childName === "function") { + return this.getLogger(() => { + if (typeof name === "function") { + name = name(); + if (!name) { + throw new TypeError( + "Compilation.getLogger(name) called with a function not returning a name" + ); + } + } + if (typeof childName === "function") { + childName = childName(); + if (!childName) { + throw new TypeError( + "Logger.getChildLogger(name) called with a function not returning a name" + ); + } + } + return `${name}/${childName}`; + }); + } else { + return this.getLogger(() => { + if (typeof name === "function") { + name = name(); + if (!name) { + throw new TypeError( + "Compilation.getLogger(name) called with a function not returning a name" + ); + } + } + return `${name}/${childName}`; + }); + } + } else { + if (typeof childName === "function") { + return this.getLogger(() => { + if (typeof childName === "function") { + childName = childName(); + if (!childName) { + throw new TypeError( + "Logger.getChildLogger(name) called with a function not returning a name" + ); + } + } + return `${name}/${childName}`; + }); + } else { + return this.getLogger(`${name}/${childName}`); + } + } + } ); - this._ident = ident; - this._identifier = identifier; - this._request = request; } - getNamespaceIdentifier() { - return this._identifier; + /** + * @param {Module} module module to be added that was created + * @param {ModuleCallback} callback returns the module in the compilation, + * it could be the passed one (if new), or an already existing in the compilation + * @returns {void} + */ + addModule(module, callback) { + this.addModuleQueue.add(module, callback); } -} -register( - ModuleExternalInitFragment, - "webpack/lib/ExternalModule", - "ModuleExternalInitFragment", - { - serialize(obj, { write }) { - write(obj._request); - write(obj._ident); - }, - deserialize({ read }) { - return new ModuleExternalInitFragment(read(), read()); + /** + * @param {Module} module module to be added that was created + * @param {ModuleCallback} callback returns the module in the compilation, + * it could be the passed one (if new), or an already existing in the compilation + * @returns {void} + */ + _addModule(module, callback) { + const identifier = module.identifier(); + const alreadyAddedModule = this._modules.get(identifier); + if (alreadyAddedModule) { + return callback(null, alreadyAddedModule); } - } -); -const generateModuleRemapping = (input, exportsInfo, runtime) => { - if (exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused) { - const properties = []; - for (const exportInfo of exportsInfo.orderedExports) { - const used = exportInfo.getUsedName(exportInfo.name, runtime); - if (!used) continue; - const nestedInfo = exportInfo.getNestedExportsInfo(); - if (nestedInfo) { - const nestedExpr = generateModuleRemapping( - `${input}${propertyAccess([exportInfo.name])}`, - nestedInfo - ); - if (nestedExpr) { - properties.push(`[${JSON.stringify(used)}]: y(${nestedExpr})`); - continue; - } - } - properties.push( - `[${JSON.stringify(used)}]: () => ${input}${propertyAccess([ - exportInfo.name - ])}` - ); + const currentProfile = this.profile + ? this.moduleGraph.getProfile(module) + : undefined; + if (currentProfile !== undefined) { + currentProfile.markRestoringStart(); } - return `x({ ${properties.join(", ")} })`; - } -}; -/** - * @param {string|string[]} moduleAndSpecifiers the module request - * @param {ExportsInfo} exportsInfo exports info of this module - * @param {RuntimeSpec} runtime the runtime - * @param {string | HashConstructor=} hashFunction the hash function to use - * @returns {SourceData} the generated source - */ -const getSourceForModuleExternal = ( - moduleAndSpecifiers, - exportsInfo, - runtime, - hashFunction -) => { - if (!Array.isArray(moduleAndSpecifiers)) - moduleAndSpecifiers = [moduleAndSpecifiers]; - const initFragment = new ModuleExternalInitFragment( - moduleAndSpecifiers[0], - undefined, - hashFunction - ); - const baseAccess = `${initFragment.getNamespaceIdentifier()}${propertyAccess( - moduleAndSpecifiers, - 1 - )}`; - const moduleRemapping = generateModuleRemapping( - baseAccess, - exportsInfo, - runtime - ); - let expression = moduleRemapping || baseAccess; - return { - expression, - init: `var x = y => { var x = {}; ${RuntimeGlobals.definePropertyGetters}(x, y); return x; }\nvar y = x => () => x`, - runtimeRequirements: moduleRemapping - ? RUNTIME_REQUIREMENTS_FOR_MODULE - : undefined, - chunkInitFragments: [initFragment] - }; -}; + this._modulesCache.get(identifier, null, (err, cacheModule) => { + if (err) return callback(new ModuleRestoreError(module, err)); -/** - * @param {string|string[]} urlAndGlobal the script request - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @returns {SourceData} the generated source - */ -const getSourceForScriptExternal = (urlAndGlobal, runtimeTemplate) => { - if (typeof urlAndGlobal === "string") { - urlAndGlobal = extractUrlAndGlobal(urlAndGlobal); + if (currentProfile !== undefined) { + currentProfile.markRestoringEnd(); + currentProfile.markIntegrationStart(); + } + + if (cacheModule) { + cacheModule.updateCacheModule(module); + + module = cacheModule; + } + this._modules.set(identifier, module); + this.modules.add(module); + if (this._backCompat) + ModuleGraph.setModuleGraphForModule(module, this.moduleGraph); + if (currentProfile !== undefined) { + currentProfile.markIntegrationEnd(); + } + callback(null, module); + }); } - const url = urlAndGlobal[0]; - const globalName = urlAndGlobal[1]; - return { - init: "var __webpack_error__ = new Error();", - expression: `new Promise(${runtimeTemplate.basicFunction( - "resolve, reject", - [ - `if(typeof ${globalName} !== "undefined") return resolve();`, - `${RuntimeGlobals.loadScript}(${JSON.stringify( - url - )}, ${runtimeTemplate.basicFunction("event", [ - `if(typeof ${globalName} !== "undefined") return resolve();`, - "var errorType = event && (event.type === 'load' ? 'missing' : event.type);", - "var realSrc = event && event.target && event.target.src;", - "__webpack_error__.message = 'Loading script failed.\\n(' + errorType + ': ' + realSrc + ')';", - "__webpack_error__.name = 'ScriptExternalLoadError';", - "__webpack_error__.type = errorType;", - "__webpack_error__.request = realSrc;", - "reject(__webpack_error__);" - ])}, ${JSON.stringify(globalName)});` - ] - )}).then(${runtimeTemplate.returningFunction( - `${globalName}${propertyAccess(urlAndGlobal, 2)}` - )})`, - runtimeRequirements: RUNTIME_REQUIREMENTS_FOR_SCRIPT - }; -}; -/** - * @param {string} variableName the variable name to check - * @param {string} request the request path - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @returns {string} the generated source - */ -const checkExternalVariable = (variableName, request, runtimeTemplate) => { - return `if(typeof ${variableName} === 'undefined') { ${runtimeTemplate.throwMissingModuleErrorBlock( - { request } - )} }\n`; -}; - -/** - * @param {string|number} id the module id - * @param {boolean} optional true, if the module is optional - * @param {string|string[]} request the request path - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @returns {SourceData} the generated source - */ -const getSourceForAmdOrUmdExternal = ( - id, - optional, - request, - runtimeTemplate -) => { - const externalVariable = `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( - `${id}` - )}__`; - return { - init: optional - ? checkExternalVariable( - externalVariable, - Array.isArray(request) ? request.join(".") : request, - runtimeTemplate - ) - : undefined, - expression: externalVariable - }; -}; - -/** - * @param {boolean} optional true, if the module is optional - * @param {string|string[]} request the request path - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @returns {SourceData} the generated source - */ -const getSourceForDefaultCase = (optional, request, runtimeTemplate) => { - if (!Array.isArray(request)) { - // make it an array as the look up works the same basically - request = [request]; - } - - const variableName = request[0]; - const objectLookup = propertyAccess(request, 1); - return { - init: optional - ? checkExternalVariable(variableName, request.join("."), runtimeTemplate) - : undefined, - expression: `${variableName}${objectLookup}` - }; -}; - -class ExternalModule extends Module { - constructor(request, type, userRequest) { - super("javascript/dynamic", null); - - // Info from Factory - /** @type {string | string[] | Record} */ - this.request = request; - /** @type {string} */ - this.externalType = type; - /** @type {string} */ - this.userRequest = userRequest; - } + /** + * Fetches a module from a compilation by its identifier + * @param {Module} module the module provided + * @returns {Module} the module requested + */ + getModule(module) { + const identifier = module.identifier(); + return this._modules.get(identifier); + } /** - * @returns {Set} types available (do not mutate) + * Attempts to search for a module by its identifier + * @param {string} identifier identifier (usually path) for module + * @returns {Module|undefined} attempt to search for module and return it, else undefined */ - getSourceTypes() { - return this.externalType === "css-import" ? CSS_TYPES : TYPES; + findModule(identifier) { + return this._modules.get(identifier); } /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion + * Schedules a build of the module object + * + * @param {Module} module module to be built + * @param {ModuleCallback} callback the callback + * @returns {void} */ - libIdent(options) { - return this.userRequest; + buildModule(module, callback) { + this.buildQueue.add(module, callback); } /** - * @param {Chunk} chunk the chunk which condition should be checked - * @param {Compilation} compilation the compilation - * @returns {boolean} true, if the chunk is ok for the module + * Builds the module object + * + * @param {Module} module module to be built + * @param {ModuleCallback} callback the callback + * @returns {void} */ - chunkCondition(chunk, { chunkGraph }) { - return this.externalType === "css-import" - ? true - : chunkGraph.getNumberOfEntryModules(chunk) > 0; - } + _buildModule(module, callback) { + const currentProfile = this.profile + ? this.moduleGraph.getProfile(module) + : undefined; + if (currentProfile !== undefined) { + currentProfile.markBuildingStart(); + } - /** - * @returns {string} a unique identifier of the module - */ - identifier() { - return `external ${this.externalType} ${JSON.stringify(this.request)}`; - } + module.needBuild( + { + compilation: this, + fileSystemInfo: this.fileSystemInfo, + valueCacheVersions: this.valueCacheVersions + }, + (err, needBuild) => { + if (err) return callback(err); - /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module - */ - readableIdentifier(requestShortener) { - return "external " + JSON.stringify(this.request); + if (!needBuild) { + if (currentProfile !== undefined) { + currentProfile.markBuildingEnd(); + } + this.hooks.stillValidModule.call(module); + return callback(); + } + + this.hooks.buildModule.call(module); + this.builtModules.add(module); + module.build( + this.options, + this, + this.resolverFactory.get("normal", module.resolveOptions), + this.inputFileSystem, + err => { + if (currentProfile !== undefined) { + currentProfile.markBuildingEnd(); + } + if (err) { + this.hooks.failedModule.call(module, err); + return callback(err); + } + if (currentProfile !== undefined) { + currentProfile.markStoringStart(); + } + this._modulesCache.store(module.identifier(), null, module, err => { + if (currentProfile !== undefined) { + currentProfile.markStoringEnd(); + } + if (err) { + this.hooks.failedModule.call(module, err); + return callback(new ModuleStoreError(module, err)); + } + this.hooks.succeedModule.call(module); + return callback(); + }); + } + ); + } + ); } /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @param {Module} module to be processed for deps + * @param {ModuleCallback} callback callback to be triggered * @returns {void} */ - needBuild(context, callback) { - return callback(null, !this.buildMeta); + processModuleDependencies(module, callback) { + this.processDependenciesQueue.add(module, callback); } /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function + * @param {Module} module to be processed for deps * @returns {void} */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = { - async: false, - exportsType: undefined - }; - this.buildInfo = { - strict: true, - topLevelDeclarations: new Set(), - module: compilation.outputOptions.module - }; - const { request, externalType } = this._getRequestAndExternalType(); - this.buildMeta.exportsType = "dynamic"; - let canMangle = false; - this.clearDependenciesAndBlocks(); - switch (externalType) { - case "this": - this.buildInfo.strict = false; - break; - case "system": - if (!Array.isArray(request) || request.length === 1) { - this.buildMeta.exportsType = "namespace"; - canMangle = true; - } - break; - case "module": - if (this.buildInfo.module) { - if (!Array.isArray(request) || request.length === 1) { - this.buildMeta.exportsType = "namespace"; - canMangle = true; - } - } else { - this.buildMeta.async = true; - if (!Array.isArray(request) || request.length === 1) { - this.buildMeta.exportsType = "namespace"; - canMangle = false; - } - } - break; - case "script": - case "promise": - this.buildMeta.async = true; - break; - case "import": - this.buildMeta.async = true; - if (!Array.isArray(request) || request.length === 1) { - this.buildMeta.exportsType = "namespace"; - canMangle = false; + processModuleDependenciesNonRecursive(module) { + const processDependenciesBlock = block => { + if (block.dependencies) { + let i = 0; + for (const dep of block.dependencies) { + this.moduleGraph.setParents(dep, block, module, i++); } - break; - } - this.addDependency(new StaticExportsDependency(true, canMangle)); - callback(); - } + } + if (block.blocks) { + for (const b of block.blocks) processDependenciesBlock(b); + } + }; - restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory) { - this._restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory); + processDependenciesBlock(module); } /** - * @param {ConcatenationBailoutReasonContext} context context - * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated + * @param {Module} module to be processed for deps + * @param {ModuleCallback} callback callback to be triggered + * @returns {void} */ - getConcatenationBailoutReason({ moduleGraph }) { - switch (this.externalType) { - case "amd": - case "amd-require": - case "umd": - case "umd2": - case "system": - case "jsonp": - return `${this.externalType} externals can't be concatenated`; - } - return undefined; - } + _processModuleDependencies(module, callback) { + /** @type {Array<{factory: ModuleFactory, dependencies: Dependency[], originModule: Module|null}>} */ + const sortedDependencies = []; - _getRequestAndExternalType() { - let { request, externalType } = this; - if (typeof request === "object" && !Array.isArray(request)) - request = request[externalType]; - return { request, externalType }; - } + /** @type {DependenciesBlock} */ + let currentBlock; - _getSourceData( - request, - externalType, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtime - ) { - switch (externalType) { - case "this": - case "window": - case "self": - return getSourceForGlobalVariableExternal(request, this.externalType); - case "global": - return getSourceForGlobalVariableExternal( - request, - runtimeTemplate.globalObject - ); - case "commonjs": - case "commonjs2": - case "commonjs-module": - case "commonjs-static": - return getSourceForCommonJsExternal(request); - case "node-commonjs": - return this.buildInfo.module - ? getSourceForCommonJsExternalInNodeModule(request) - : getSourceForCommonJsExternal(request); - case "amd": - case "amd-require": - case "umd": - case "umd2": - case "system": - case "jsonp": { - const id = chunkGraph.getModuleId(this); - return getSourceForAmdOrUmdExternal( - id !== null ? id : this.identifier(), - this.isOptional(moduleGraph), - request, - runtimeTemplate - ); - } - case "import": - return getSourceForImportExternal(request, runtimeTemplate); - case "script": - return getSourceForScriptExternal(request, runtimeTemplate); - case "module": { - if (!this.buildInfo.module) { - if (!runtimeTemplate.supportsDynamicImport()) { - throw new Error( - "The target environment doesn't support dynamic import() syntax so it's not possible to use external type 'module' within a script" + - (runtimeTemplate.supportsEcmaScriptModuleSyntax() - ? "\nDid you mean to build a EcmaScript Module ('output.module: true')?" - : "") - ); - } - return getSourceForImportExternal(request, runtimeTemplate); - } - if (!runtimeTemplate.supportsEcmaScriptModuleSyntax()) { - throw new Error( - "The target environment doesn't support EcmaScriptModule syntax so it's not possible to use external type 'module'" - ); - } - return getSourceForModuleExternal( - request, - moduleGraph.getExportsInfo(this), - runtime, - runtimeTemplate.outputOptions.hashFunction - ); - } - case "var": - case "promise": - case "const": - case "let": - case "assign": - default: - return getSourceForDefaultCase( - this.isOptional(moduleGraph), - request, - runtimeTemplate - ); - } - } + /** @type {Map>} */ + let dependencies; + /** @type {DepConstructor} */ + let factoryCacheKey; + /** @type {ModuleFactory} */ + let factoryCacheKey2; + /** @type {Map} */ + let factoryCacheValue; + /** @type {string} */ + let listCacheKey1; + /** @type {string} */ + let listCacheKey2; + /** @type {Dependency[]} */ + let listCacheValue; - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration({ - runtimeTemplate, - moduleGraph, - chunkGraph, - runtime, - concatenationScope - }) { - const { request, externalType } = this._getRequestAndExternalType(); - switch (externalType) { - case "asset": { - const sources = new Map(); - sources.set( - "javascript", - new RawSource(`module.exports = ${JSON.stringify(request)};`) - ); - const data = new Map(); - data.set("url", request); - return { sources, runtimeRequirements: RUNTIME_REQUIREMENTS, data }; - } - case "css-import": { - const sources = new Map(); - sources.set( - "css-import", - new RawSource(`@import url(${JSON.stringify(request)});`) - ); - return { - sources, - runtimeRequirements: EMPTY_RUNTIME_REQUIREMENTS - }; - } - default: { - const sourceData = this._getSourceData( - request, - externalType, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtime - ); + let inProgressSorting = 1; + let inProgressTransitive = 1; - let sourceString = sourceData.expression; - if (sourceData.iife) - sourceString = `(function() { return ${sourceString}; }())`; - if (concatenationScope) { - sourceString = `${ - runtimeTemplate.supportsConst() ? "const" : "var" - } ${ConcatenationScope.NAMESPACE_OBJECT_EXPORT} = ${sourceString};`; - concatenationScope.registerNamespaceExport( - ConcatenationScope.NAMESPACE_OBJECT_EXPORT - ); - } else { - sourceString = `module.exports = ${sourceString};`; - } - if (sourceData.init) - sourceString = `${sourceData.init}\n${sourceString}`; + const onDependenciesSorted = err => { + if (err) return callback(err); - let data = undefined; - if (sourceData.chunkInitFragments) { - data = new Map(); - data.set("chunkInitFragments", sourceData.chunkInitFragments); - } + // early exit without changing parallelism back and forth + if (sortedDependencies.length === 0 && inProgressTransitive === 1) { + return callback(); + } - const sources = new Map(); - if (this.useSourceMap || this.useSimpleSourceMap) { - sources.set( - "javascript", - new OriginalSource(sourceString, this.identifier()) - ); - } else { - sources.set("javascript", new RawSource(sourceString)); - } + // This is nested so we need to allow one additional task + this.processDependenciesQueue.increaseParallelism(); - let runtimeRequirements = sourceData.runtimeRequirements; - if (!concatenationScope) { - if (!runtimeRequirements) { - runtimeRequirements = RUNTIME_REQUIREMENTS; - } else { - const set = new Set(runtimeRequirements); - set.add(RuntimeGlobals.module); - runtimeRequirements = set; + for (const item of sortedDependencies) { + inProgressTransitive++; + this.handleModuleCreation(item, err => { + // In V8, the Error objects keep a reference to the functions on the stack. These warnings & + // errors are created inside closures that keep a reference to the Compilation, so errors are + // leaking the Compilation object. + if (err && this.bail) { + if (inProgressTransitive <= 0) return; + inProgressTransitive = -1; + // eslint-disable-next-line no-self-assign + err.stack = err.stack; + onTransitiveTasksFinished(err); + return; } - } - - return { - sources, - runtimeRequirements: - runtimeRequirements || EMPTY_RUNTIME_REQUIREMENTS, - data - }; + if (--inProgressTransitive === 0) onTransitiveTasksFinished(); + }); } - } - } - - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - return 42; - } + if (--inProgressTransitive === 0) onTransitiveTasksFinished(); + }; - /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - const { chunkGraph } = context; - hash.update( - `${this.externalType}${JSON.stringify(this.request)}${this.isOptional( - chunkGraph.moduleGraph - )}` - ); - super.updateHash(hash, context); - } + const onTransitiveTasksFinished = err => { + if (err) return callback(err); + this.processDependenciesQueue.decreaseParallelism(); - serialize(context) { - const { write } = context; + return callback(); + }; - write(this.request); - write(this.externalType); - write(this.userRequest); - - super.serialize(context); - } + /** + * @param {Dependency} dep dependency + * @param {number} index index in block + * @returns {void} + */ + const processDependency = (dep, index) => { + this.moduleGraph.setParents(dep, currentBlock, module, index); + if (this._unsafeCache) { + try { + const unsafeCachedModule = unsafeCacheDependencies.get(dep); + if (unsafeCachedModule === null) return; + if (unsafeCachedModule !== undefined) { + if ( + this._restoredUnsafeCacheModuleEntries.has(unsafeCachedModule) + ) { + this._handleExistingModuleFromUnsafeCache( + module, + dep, + unsafeCachedModule + ); + return; + } + const identifier = unsafeCachedModule.identifier(); + const cachedModule = + this._restoredUnsafeCacheEntries.get(identifier); + if (cachedModule !== undefined) { + // update unsafe cache to new module + unsafeCacheDependencies.set(dep, cachedModule); + this._handleExistingModuleFromUnsafeCache( + module, + dep, + cachedModule + ); + return; + } + inProgressSorting++; + this._modulesCache.get(identifier, null, (err, cachedModule) => { + if (err) { + if (inProgressSorting <= 0) return; + inProgressSorting = -1; + onDependenciesSorted(err); + return; + } + try { + if (!this._restoredUnsafeCacheEntries.has(identifier)) { + const data = unsafeCacheData.get(cachedModule); + if (data === undefined) { + processDependencyForResolving(dep); + if (--inProgressSorting === 0) onDependenciesSorted(); + return; + } + if (cachedModule !== unsafeCachedModule) { + unsafeCacheDependencies.set(dep, cachedModule); + } + cachedModule.restoreFromUnsafeCache( + data, + this.params.normalModuleFactory, + this.params + ); + this._restoredUnsafeCacheEntries.set( + identifier, + cachedModule + ); + this._restoredUnsafeCacheModuleEntries.add(cachedModule); + if (!this.modules.has(cachedModule)) { + inProgressTransitive++; + this._handleNewModuleFromUnsafeCache( + module, + dep, + cachedModule, + err => { + if (err) { + if (inProgressTransitive <= 0) return; + inProgressTransitive = -1; + onTransitiveTasksFinished(err); + } + if (--inProgressTransitive === 0) + return onTransitiveTasksFinished(); + } + ); + if (--inProgressSorting === 0) onDependenciesSorted(); + return; + } + } + if (unsafeCachedModule !== cachedModule) { + unsafeCacheDependencies.set(dep, cachedModule); + } + this._handleExistingModuleFromUnsafeCache( + module, + dep, + cachedModule + ); // a3 + } catch (err) { + if (inProgressSorting <= 0) return; + inProgressSorting = -1; + onDependenciesSorted(err); + return; + } + if (--inProgressSorting === 0) onDependenciesSorted(); + }); + return; + } + } catch (e) { + console.error(e); + } + } + processDependencyForResolving(dep); + }; - deserialize(context) { - const { read } = context; + /** + * @param {Dependency} dep dependency + * @returns {void} + */ + const processDependencyForResolving = dep => { + const resourceIdent = dep.getResourceIdentifier(); + if (resourceIdent !== undefined && resourceIdent !== null) { + const category = dep.category; + const constructor = /** @type {DepConstructor} */ (dep.constructor); + if (factoryCacheKey === constructor) { + // Fast path 1: same constructor as prev item + if (listCacheKey1 === category && listCacheKey2 === resourceIdent) { + // Super fast path 1: also same resource + listCacheValue.push(dep); + return; + } + } else { + const factory = this.dependencyFactories.get(constructor); + if (factory === undefined) { + throw new Error( + `No module factory available for dependency type: ${constructor.name}` + ); + } + if (factoryCacheKey2 === factory) { + // Fast path 2: same factory as prev item + factoryCacheKey = constructor; + if (listCacheKey1 === category && listCacheKey2 === resourceIdent) { + // Super fast path 2: also same resource + listCacheValue.push(dep); + return; + } + } else { + // Slow path + if (factoryCacheKey2 !== undefined) { + // Archive last cache entry + if (dependencies === undefined) dependencies = new Map(); + dependencies.set(factoryCacheKey2, factoryCacheValue); + factoryCacheValue = dependencies.get(factory); + if (factoryCacheValue === undefined) { + factoryCacheValue = new Map(); + } + } else { + factoryCacheValue = new Map(); + } + factoryCacheKey = constructor; + factoryCacheKey2 = factory; + } + } + // Here webpack is using heuristic that assumes + // mostly esm dependencies would be used + // so we don't allocate extra string for them + const cacheKey = + category === esmDependencyCategory + ? resourceIdent + : `${category}${resourceIdent}`; + let list = factoryCacheValue.get(cacheKey); + if (list === undefined) { + factoryCacheValue.set(cacheKey, (list = [])); + sortedDependencies.push({ + factory: factoryCacheKey2, + dependencies: list, + originModule: module + }); + } + list.push(dep); + listCacheKey1 = category; + listCacheKey2 = resourceIdent; + listCacheValue = list; + } + }; - this.request = read(); - this.externalType = read(); - this.userRequest = read(); + try { + /** @type {DependenciesBlock[]} */ + const queue = [module]; + do { + const block = queue.pop(); + if (block.dependencies) { + currentBlock = block; + let i = 0; + for (const dep of block.dependencies) processDependency(dep, i++); + } + if (block.blocks) { + for (const b of block.blocks) queue.push(b); + } + } while (queue.length !== 0); + } catch (e) { + return callback(e); + } - super.deserialize(context); + if (--inProgressSorting === 0) onDependenciesSorted(); } -} - -makeSerializable(ExternalModule, "webpack/lib/ExternalModule"); - -module.exports = ExternalModule; - - -/***/ }), - -/***/ 62153: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - + _handleNewModuleFromUnsafeCache(originModule, dependency, module, callback) { + const moduleGraph = this.moduleGraph; -const util = __webpack_require__(73837); -const ExternalModule = __webpack_require__(73071); -const { resolveByProperty, cachedSetProperty } = __webpack_require__(60839); + moduleGraph.setResolvedModule(originModule, dependency, module); -/** @typedef {import("../declarations/WebpackOptions").Externals} Externals */ -/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ + moduleGraph.setIssuerIfUnset( + module, + originModule !== undefined ? originModule : null + ); -const UNSPECIFIED_EXTERNAL_TYPE_REGEXP = /^[a-z0-9-]+ /; -const EMPTY_RESOLVE_OPTIONS = {}; + this._modules.set(module.identifier(), module); + this.modules.add(module); + if (this._backCompat) + ModuleGraph.setModuleGraphForModule(module, this.moduleGraph); -// TODO webpack 6 remove this -const callDeprecatedExternals = util.deprecate( - (externalsFunction, context, request, cb) => { - externalsFunction.call(null, context, request, cb); - }, - "The externals-function should be defined like ({context, request}, cb) => { ... }", - "DEP_WEBPACK_EXTERNALS_FUNCTION_PARAMETERS" -); + this._handleModuleBuildAndDependencies( + originModule, + module, + true, + callback + ); + } -const cache = new WeakMap(); + _handleExistingModuleFromUnsafeCache(originModule, dependency, module) { + const moduleGraph = this.moduleGraph; -const resolveLayer = (obj, layer) => { - let map = cache.get(obj); - if (map === undefined) { - map = new Map(); - cache.set(obj, map); - } else { - const cacheEntry = map.get(layer); - if (cacheEntry !== undefined) return cacheEntry; + moduleGraph.setResolvedModule(originModule, dependency, module); } - const result = resolveByProperty(obj, "byLayer", layer); - map.set(layer, result); - return result; -}; -class ExternalModuleFactoryPlugin { /** - * @param {string | undefined} type default external type - * @param {Externals} externals externals config + * @typedef {Object} HandleModuleCreationOptions + * @property {ModuleFactory} factory + * @property {Dependency[]} dependencies + * @property {Module | null} originModule + * @property {Partial=} contextInfo + * @property {string=} context + * @property {boolean=} recursive recurse into dependencies of the created module + * @property {boolean=} connectOrigin connect the resolved module with the origin module */ - constructor(type, externals) { - this.type = type; - this.externals = externals; - } /** - * @param {NormalModuleFactory} normalModuleFactory the normal module factory + * @param {HandleModuleCreationOptions} options options object + * @param {ModuleCallback} callback callback * @returns {void} */ - apply(normalModuleFactory) { - const globalType = this.type; - normalModuleFactory.hooks.factorize.tapAsync( - "ExternalModuleFactoryPlugin", - (data, callback) => { - const context = data.context; - const contextInfo = data.contextInfo; - const dependency = data.dependencies[0]; - const dependencyType = data.dependencyType; + handleModuleCreation( + { + factory, + dependencies, + originModule, + contextInfo, + context, + recursive = true, + connectOrigin = recursive + }, + callback + ) { + const moduleGraph = this.moduleGraph; - /** - * @param {string|string[]|boolean|Record} value the external config - * @param {string|undefined} type type of external - * @param {function(Error=, ExternalModule=): void} callback callback - * @returns {void} - */ - const handleExternal = (value, type, callback) => { - if (value === false) { - // Not externals, fallback to original factory - return callback(); + const currentProfile = this.profile ? new ModuleProfile() : undefined; + + this.factorizeModule( + { + currentProfile, + factory, + dependencies, + factoryResult: true, + originModule, + contextInfo, + context + }, + (err, factoryResult) => { + const applyFactoryResultDependencies = () => { + const { fileDependencies, contextDependencies, missingDependencies } = + factoryResult; + if (fileDependencies) { + this.fileDependencies.addAll(fileDependencies); } - /** @type {string | string[] | Record} */ - let externalConfig; - if (value === true) { - externalConfig = dependency.request; - } else { - externalConfig = value; + if (contextDependencies) { + this.contextDependencies.addAll(contextDependencies); } - // When no explicit type is specified, extract it from the externalConfig - if (type === undefined) { - if ( - typeof externalConfig === "string" && - UNSPECIFIED_EXTERNAL_TYPE_REGEXP.test(externalConfig) - ) { - const idx = externalConfig.indexOf(" "); - type = externalConfig.substr(0, idx); - externalConfig = externalConfig.substr(idx + 1); - } else if ( - Array.isArray(externalConfig) && - externalConfig.length > 0 && - UNSPECIFIED_EXTERNAL_TYPE_REGEXP.test(externalConfig[0]) - ) { - const firstItem = externalConfig[0]; - const idx = firstItem.indexOf(" "); - type = firstItem.substr(0, idx); - externalConfig = [ - firstItem.substr(idx + 1), - ...externalConfig.slice(1) - ]; - } + if (missingDependencies) { + this.missingDependencies.addAll(missingDependencies); } - callback( - null, - new ExternalModule( - externalConfig, - type || globalType, - dependency.request - ) - ); }; + if (err) { + if (factoryResult) applyFactoryResultDependencies(); + if (dependencies.every(d => d.optional)) { + this.warnings.push(err); + return callback(); + } else { + this.errors.push(err); + return callback(err); + } + } - /** - * @param {Externals} externals externals config - * @param {function((Error | null)=, ExternalModule=): void} callback callback - * @returns {void} - */ - const handleExternals = (externals, callback) => { - if (typeof externals === "string") { - if (externals === dependency.request) { - return handleExternal(dependency.request, undefined, callback); + const newModule = factoryResult.module; + + if (!newModule) { + applyFactoryResultDependencies(); + return callback(); + } + + if (currentProfile !== undefined) { + moduleGraph.setProfile(newModule, currentProfile); + } + + this.addModule(newModule, (err, module) => { + if (err) { + applyFactoryResultDependencies(); + if (!err.module) { + err.module = module; } - } else if (Array.isArray(externals)) { - let i = 0; - const next = () => { - let asyncFlag; - const handleExternalsAndCallback = (err, module) => { - if (err) return callback(err); - if (!module) { - if (asyncFlag) { - asyncFlag = false; - return; - } - return next(); - } - callback(null, module); - }; + this.errors.push(err); - do { - asyncFlag = true; - if (i >= externals.length) return callback(); - handleExternals(externals[i++], handleExternalsAndCallback); - } while (!asyncFlag); - asyncFlag = false; - }; + return callback(err); + } - next(); - return; - } else if (externals instanceof RegExp) { - if (externals.test(dependency.request)) { - return handleExternal(dependency.request, undefined, callback); + if ( + this._unsafeCache && + factoryResult.cacheable !== false && + /** @type {any} */ (module).restoreFromUnsafeCache && + this._unsafeCachePredicate(module) + ) { + const unsafeCacheableModule = + /** @type {Module & { restoreFromUnsafeCache: Function }} */ ( + module + ); + for (let i = 0; i < dependencies.length; i++) { + const dependency = dependencies[i]; + moduleGraph.setResolvedModule( + connectOrigin ? originModule : null, + dependency, + unsafeCacheableModule + ); + unsafeCacheDependencies.set(dependency, unsafeCacheableModule); } - } else if (typeof externals === "function") { - const cb = (err, value, type) => { - if (err) return callback(err); - if (value !== undefined) { - handleExternal(value, type, callback); + if (!unsafeCacheData.has(unsafeCacheableModule)) { + unsafeCacheData.set( + unsafeCacheableModule, + unsafeCacheableModule.getUnsafeCacheData() + ); + } + } else { + applyFactoryResultDependencies(); + for (let i = 0; i < dependencies.length; i++) { + const dependency = dependencies[i]; + moduleGraph.setResolvedModule( + connectOrigin ? originModule : null, + dependency, + module + ); + } + } + + moduleGraph.setIssuerIfUnset( + module, + originModule !== undefined ? originModule : null + ); + if (module !== newModule) { + if (currentProfile !== undefined) { + const otherProfile = moduleGraph.getProfile(module); + if (otherProfile !== undefined) { + currentProfile.mergeInto(otherProfile); } else { - callback(); + moduleGraph.setProfile(module, currentProfile); } - }; - if (externals.length === 3) { - // TODO webpack 6 remove this - callDeprecatedExternals( - externals, - context, - dependency.request, - cb - ); - } else { - const promise = externals( - { - context, - request: dependency.request, - dependencyType, - contextInfo, - getResolve: options => (context, request, callback) => { - const resolveContext = { - fileDependencies: data.fileDependencies, - missingDependencies: data.missingDependencies, - contextDependencies: data.contextDependencies - }; - let resolver = normalModuleFactory.getResolver( - "normal", - dependencyType - ? cachedSetProperty( - data.resolveOptions || EMPTY_RESOLVE_OPTIONS, - "dependencyType", - dependencyType - ) - : data.resolveOptions - ); - if (options) resolver = resolver.withOptions(options); - if (callback) { - resolver.resolve( - {}, - context, - request, - resolveContext, - callback - ); - } else { - return new Promise((resolve, reject) => { - resolver.resolve( - {}, - context, - request, - resolveContext, - (err, result) => { - if (err) reject(err); - else resolve(result); - } - ); - }); - } - } - }, - cb - ); - if (promise && promise.then) promise.then(r => cb(null, r), cb); - } - return; - } else if (typeof externals === "object") { - const resolvedExternals = resolveLayer( - externals, - contextInfo.issuerLayer - ); - if ( - Object.prototype.hasOwnProperty.call( - resolvedExternals, - dependency.request - ) - ) { - return handleExternal( - resolvedExternals[dependency.request], - undefined, - callback - ); } } - callback(); - }; - handleExternals(this.externals, callback); + this._handleModuleBuildAndDependencies( + originModule, + module, + recursive, + callback + ); + }); } ); } -} -module.exports = ExternalModuleFactoryPlugin; + _handleModuleBuildAndDependencies(originModule, module, recursive, callback) { + // Check for cycles when build is trigger inside another build + let creatingModuleDuringBuildSet = undefined; + if (!recursive && this.buildQueue.isProcessing(originModule)) { + // Track build dependency + creatingModuleDuringBuildSet = + this.creatingModuleDuringBuild.get(originModule); + if (creatingModuleDuringBuildSet === undefined) { + creatingModuleDuringBuildSet = new Set(); + this.creatingModuleDuringBuild.set( + originModule, + creatingModuleDuringBuildSet + ); + } + creatingModuleDuringBuildSet.add(module); -/***/ }), - -/***/ 6652: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // When building is blocked by another module + // search for a cycle, cancel the cycle by throwing + // an error (otherwise this would deadlock) + const blockReasons = this.creatingModuleDuringBuild.get(module); + if (blockReasons !== undefined) { + const set = new Set(blockReasons); + for (const item of set) { + const blockReasons = this.creatingModuleDuringBuild.get(item); + if (blockReasons !== undefined) { + for (const m of blockReasons) { + if (m === module) { + return callback(new BuildCycleError(module)); + } + set.add(m); + } + } + } + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + this.buildModule(module, err => { + if (creatingModuleDuringBuildSet !== undefined) { + creatingModuleDuringBuildSet.delete(module); + } + if (err) { + if (!err.module) { + err.module = module; + } + this.errors.push(err); + return callback(err); + } + if (!recursive) { + this.processModuleDependenciesNonRecursive(module); + callback(null, module); + return; + } -const ExternalModuleFactoryPlugin = __webpack_require__(62153); + // This avoids deadlocks for circular dependencies + if (this.processDependenciesQueue.isProcessing(module)) { + return callback(); + } -/** @typedef {import("../declarations/WebpackOptions").Externals} Externals */ -/** @typedef {import("./Compiler")} Compiler */ + this.processModuleDependencies(module, err => { + if (err) { + return callback(err); + } + callback(null, module); + }); + }); + } -class ExternalsPlugin { /** - * @param {string | undefined} type default external type - * @param {Externals} externals externals config + * @param {FactorizeModuleOptions} options options object + * @param {ModuleOrFactoryResultCallback} callback callback + * @returns {void} */ - constructor(type, externals) { - this.type = type; - this.externals = externals; + _factorizeModule( + { + currentProfile, + factory, + dependencies, + originModule, + factoryResult, + contextInfo, + context + }, + callback + ) { + if (currentProfile !== undefined) { + currentProfile.markFactoryStart(); + } + factory.create( + { + contextInfo: { + issuer: originModule ? originModule.nameForCondition() : "", + issuerLayer: originModule ? originModule.layer : null, + compiler: this.compiler.name, + ...contextInfo + }, + resolveOptions: originModule ? originModule.resolveOptions : undefined, + context: context + ? context + : originModule + ? originModule.context + : this.compiler.context, + dependencies: dependencies + }, + (err, result) => { + if (result) { + // TODO webpack 6: remove + // For backward-compat + if (result.module === undefined && result instanceof Module) { + result = { + module: result + }; + } + if (!factoryResult) { + const { + fileDependencies, + contextDependencies, + missingDependencies + } = result; + if (fileDependencies) { + this.fileDependencies.addAll(fileDependencies); + } + if (contextDependencies) { + this.contextDependencies.addAll(contextDependencies); + } + if (missingDependencies) { + this.missingDependencies.addAll(missingDependencies); + } + } + } + if (err) { + const notFoundError = new ModuleNotFoundError( + originModule, + err, + dependencies.map(d => d.loc).filter(Boolean)[0] + ); + return callback(notFoundError, factoryResult ? result : undefined); + } + if (!result) { + return callback(); + } + + if (currentProfile !== undefined) { + currentProfile.markFactoryEnd(); + } + + callback(null, factoryResult ? result : result.module); + } + ); } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {string} context context string path + * @param {Dependency} dependency dependency used to create Module chain + * @param {ModuleCallback} callback callback for when module chain is complete + * @returns {void} will throw if dependency instance is not a valid Dependency */ - apply(compiler) { - compiler.hooks.compile.tap("ExternalsPlugin", ({ normalModuleFactory }) => { - new ExternalModuleFactoryPlugin(this.type, this.externals).apply( - normalModuleFactory - ); - }); + addModuleChain(context, dependency, callback) { + return this.addModuleTree({ context, dependency }, callback); } -} - -module.exports = ExternalsPlugin; + /** + * @param {Object} options options + * @param {string} options.context context string path + * @param {Dependency} options.dependency dependency used to create Module chain + * @param {Partial=} options.contextInfo additional context info for the root module + * @param {ModuleCallback} callback callback for when module chain is complete + * @returns {void} will throw if dependency instance is not a valid Dependency + */ + addModuleTree({ context, dependency, contextInfo }, callback) { + if ( + typeof dependency !== "object" || + dependency === null || + !dependency.constructor + ) { + return callback( + new WebpackError("Parameter 'dependency' must be a Dependency") + ); + } + const Dep = /** @type {DepConstructor} */ (dependency.constructor); + const moduleFactory = this.dependencyFactories.get(Dep); + if (!moduleFactory) { + return callback( + new WebpackError( + `No dependency factory available for this dependency type: ${dependency.constructor.name}` + ) + ); + } -/***/ }), + this.handleModuleCreation( + { + factory: moduleFactory, + dependencies: [dependency], + originModule: null, + contextInfo, + context + }, + (err, result) => { + if (err && this.bail) { + callback(err); + this.buildQueue.stop(); + this.rebuildQueue.stop(); + this.processDependenciesQueue.stop(); + this.factorizeQueue.stop(); + } else if (!err && result) { + callback(null, result); + } else { + callback(); + } + } + ); + } -/***/ 79453: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * @param {string} context context path for entry + * @param {Dependency} entry entry dependency that should be followed + * @param {string | EntryOptions} optionsOrName options or deprecated name of entry + * @param {ModuleCallback} callback callback function + * @returns {void} returns + */ + addEntry(context, entry, optionsOrName, callback) { + // TODO webpack 6 remove + const options = + typeof optionsOrName === "object" + ? optionsOrName + : { name: optionsOrName }; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + this._addEntryItem(context, entry, "dependencies", options, callback); + } + /** + * @param {string} context context path for entry + * @param {Dependency} dependency dependency that should be followed + * @param {EntryOptions} options options + * @param {ModuleCallback} callback callback function + * @returns {void} returns + */ + addInclude(context, dependency, options, callback) { + this._addEntryItem( + context, + dependency, + "includeDependencies", + options, + callback + ); + } + /** + * @param {string} context context path for entry + * @param {Dependency} entry entry dependency that should be followed + * @param {"dependencies" | "includeDependencies"} target type of entry + * @param {EntryOptions} options options + * @param {ModuleCallback} callback callback function + * @returns {void} returns + */ + _addEntryItem(context, entry, target, options, callback) { + const { name } = options; + let entryData = + name !== undefined ? this.entries.get(name) : this.globalEntry; + if (entryData === undefined) { + entryData = { + dependencies: [], + includeDependencies: [], + options: { + name: undefined, + ...options + } + }; + entryData[target].push(entry); + this.entries.set(name, entryData); + } else { + entryData[target].push(entry); + for (const key of Object.keys(options)) { + if (options[key] === undefined) continue; + if (entryData.options[key] === options[key]) continue; + if ( + Array.isArray(entryData.options[key]) && + Array.isArray(options[key]) && + arrayEquals(entryData.options[key], options[key]) + ) { + continue; + } + if (entryData.options[key] === undefined) { + entryData.options[key] = options[key]; + } else { + return callback( + new WebpackError( + `Conflicting entry option ${key} = ${entryData.options[key]} vs ${options[key]}` + ) + ); + } + } + } -const { create: createResolver } = __webpack_require__(9256); -const asyncLib = __webpack_require__(78175); -const AsyncQueue = __webpack_require__(12260); -const StackedCacheMap = __webpack_require__(64985); -const createHash = __webpack_require__(49835); -const { join, dirname, relative, lstatReadlinkAbsolute } = __webpack_require__(17139); -const makeSerializable = __webpack_require__(33032); -const processAsyncTree = __webpack_require__(42791); + this.hooks.addEntry.call(entry, options); -/** @typedef {import("./WebpackError")} WebpackError */ -/** @typedef {import("./logging/Logger").Logger} Logger */ -/** @typedef {typeof import("./util/Hash")} Hash */ -/** @typedef {import("./util/fs").IStats} IStats */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ + this.addModuleTree( + { + context, + dependency: entry, + contextInfo: entryData.options.layer + ? { issuerLayer: entryData.options.layer } + : undefined + }, + (err, module) => { + if (err) { + this.hooks.failedEntry.call(entry, options, err); + return callback(err); + } + this.hooks.succeedEntry.call(entry, options, module); + return callback(null, module); + } + ); + } -const supportsEsm = +process.versions.modules >= 83; + /** + * @param {Module} module module to be rebuilt + * @param {ModuleCallback} callback callback when module finishes rebuilding + * @returns {void} + */ + rebuildModule(module, callback) { + this.rebuildQueue.add(module, callback); + } -let FS_ACCURACY = 2000; + /** + * @param {Module} module module to be rebuilt + * @param {ModuleCallback} callback callback when module finishes rebuilding + * @returns {void} + */ + _rebuildModule(module, callback) { + this.hooks.rebuildModule.call(module); + const oldDependencies = module.dependencies.slice(); + const oldBlocks = module.blocks.slice(); + module.invalidateBuild(); + this.buildQueue.invalidate(module); + this.buildModule(module, err => { + if (err) { + return this.hooks.finishRebuildingModule.callAsync(module, err2 => { + if (err2) { + callback( + makeWebpackError(err2, "Compilation.hooks.finishRebuildingModule") + ); + return; + } + callback(err); + }); + } -const EMPTY_SET = new Set(); + this.processDependenciesQueue.invalidate(module); + this.moduleGraph.unfreeze(); + this.processModuleDependencies(module, err => { + if (err) return callback(err); + this.removeReasonsOfDependencyBlock(module, { + dependencies: oldDependencies, + blocks: oldBlocks + }); + this.hooks.finishRebuildingModule.callAsync(module, err2 => { + if (err2) { + callback( + makeWebpackError(err2, "Compilation.hooks.finishRebuildingModule") + ); + return; + } + callback(null, module); + }); + }); + }); + } -const RBDT_RESOLVE_CJS = 0; -const RBDT_RESOLVE_ESM = 1; -const RBDT_RESOLVE_DIRECTORY = 2; -const RBDT_RESOLVE_CJS_FILE = 3; -const RBDT_RESOLVE_CJS_FILE_AS_CHILD = 4; -const RBDT_RESOLVE_ESM_FILE = 5; -const RBDT_DIRECTORY = 6; -const RBDT_FILE = 7; -const RBDT_DIRECTORY_DEPENDENCIES = 8; -const RBDT_FILE_DEPENDENCIES = 9; + _computeAffectedModules(modules) { + const moduleMemCacheCache = this.compiler.moduleMemCaches; + if (!moduleMemCacheCache) return; + if (!this.moduleMemCaches) { + this.moduleMemCaches = new Map(); + this.moduleGraph.setModuleMemCaches(this.moduleMemCaches); + } + const { moduleGraph, moduleMemCaches } = this; + const affectedModules = new Set(); + const infectedModules = new Set(); + let statNew = 0; + let statChanged = 0; + let statUnchanged = 0; + let statReferencesChanged = 0; + let statWithoutBuild = 0; -const INVALID = Symbol("invalid"); + const computeReferences = module => { + /** @type {WeakMap} */ + let references = undefined; + for (const connection of moduleGraph.getOutgoingConnections(module)) { + const d = connection.dependency; + const m = connection.module; + if (!d || !m || unsafeCacheDependencies.has(d)) continue; + if (references === undefined) references = new WeakMap(); + references.set(d, m); + } + return references; + }; -/** - * @typedef {Object} FileSystemInfoEntry - * @property {number} safeTime - * @property {number=} timestamp - */ - -/** - * @typedef {Object} ResolvedContextFileSystemInfoEntry - * @property {number} safeTime - * @property {string=} timestampHash - */ - -/** - * @typedef {Object} ContextFileSystemInfoEntry - * @property {number} safeTime - * @property {string=} timestampHash - * @property {ResolvedContextFileSystemInfoEntry=} resolved - * @property {Set=} symlinks - */ - -/** - * @typedef {Object} TimestampAndHash - * @property {number} safeTime - * @property {number=} timestamp - * @property {string} hash - */ - -/** - * @typedef {Object} ResolvedContextTimestampAndHash - * @property {number} safeTime - * @property {string=} timestampHash - * @property {string} hash - */ - -/** - * @typedef {Object} ContextTimestampAndHash - * @property {number} safeTime - * @property {string=} timestampHash - * @property {string} hash - * @property {ResolvedContextTimestampAndHash=} resolved - * @property {Set=} symlinks - */ - -/** - * @typedef {Object} ContextHash - * @property {string} hash - * @property {string=} resolved - * @property {Set=} symlinks - */ - -/** - * @typedef {Object} SnapshotOptimizationEntry - * @property {Snapshot} snapshot - * @property {number} shared - * @property {Set} snapshotContent - * @property {Set} children - */ - -/** - * @typedef {Object} ResolveBuildDependenciesResult - * @property {Set} files list of files - * @property {Set} directories list of directories - * @property {Set} missing list of missing entries - * @property {Map} resolveResults stored resolve results - * @property {Object} resolveDependencies dependencies of the resolving - * @property {Set} resolveDependencies.files list of files - * @property {Set} resolveDependencies.directories list of directories - * @property {Set} resolveDependencies.missing list of missing entries - */ - -const DONE_ITERATOR_RESULT = new Set().keys().next(); + /** + * @param {Module} module the module + * @param {WeakMap} references references + * @returns {boolean} true, when the references differ + */ + const compareReferences = (module, references) => { + if (references === undefined) return true; + for (const connection of moduleGraph.getOutgoingConnections(module)) { + const d = connection.dependency; + if (!d) continue; + const entry = references.get(d); + if (entry === undefined) continue; + if (entry !== connection.module) return false; + } + return true; + }; -// cspell:word tshs -// Tsh = Timestamp + Hash -// Tshs = Timestamp + Hash combinations + const modulesWithoutCache = new Set(modules); + for (const [module, cachedMemCache] of moduleMemCacheCache) { + if (modulesWithoutCache.has(module)) { + const buildInfo = module.buildInfo; + if (buildInfo) { + if (cachedMemCache.buildInfo !== buildInfo) { + // use a new one + const memCache = new WeakTupleMap(); + moduleMemCaches.set(module, memCache); + affectedModules.add(module); + cachedMemCache.buildInfo = buildInfo; + cachedMemCache.references = computeReferences(module); + cachedMemCache.memCache = memCache; + statChanged++; + } else if (!compareReferences(module, cachedMemCache.references)) { + // use a new one + const memCache = new WeakTupleMap(); + moduleMemCaches.set(module, memCache); + affectedModules.add(module); + cachedMemCache.references = computeReferences(module); + cachedMemCache.memCache = memCache; + statReferencesChanged++; + } else { + // keep the old mem cache + moduleMemCaches.set(module, cachedMemCache.memCache); + statUnchanged++; + } + } else { + infectedModules.add(module); + moduleMemCacheCache.delete(module); + statWithoutBuild++; + } + modulesWithoutCache.delete(module); + } else { + moduleMemCacheCache.delete(module); + } + } -class SnapshotIterator { - constructor(next) { - this.next = next; - } -} + for (const module of modulesWithoutCache) { + const buildInfo = module.buildInfo; + if (buildInfo) { + // create a new entry + const memCache = new WeakTupleMap(); + moduleMemCacheCache.set(module, { + buildInfo, + references: computeReferences(module), + memCache + }); + moduleMemCaches.set(module, memCache); + affectedModules.add(module); + statNew++; + } else { + infectedModules.add(module); + statWithoutBuild++; + } + } -class SnapshotIterable { - constructor(snapshot, getMaps) { - this.snapshot = snapshot; - this.getMaps = getMaps; + const reduceAffectType = connections => { + let affected = false; + for (const { dependency } of connections) { + if (!dependency) continue; + const type = dependency.couldAffectReferencingModule(); + if (type === Dependency.TRANSITIVE) return Dependency.TRANSITIVE; + if (type === false) continue; + affected = true; + } + return affected; + }; + const directOnlyInfectedModules = new Set(); + for (const module of infectedModules) { + for (const [ + referencingModule, + connections + ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { + if (!referencingModule) continue; + if (infectedModules.has(referencingModule)) continue; + const type = reduceAffectType(connections); + if (!type) continue; + if (type === true) { + directOnlyInfectedModules.add(referencingModule); + } else { + infectedModules.add(referencingModule); + } + } + } + for (const module of directOnlyInfectedModules) infectedModules.add(module); + const directOnlyAffectModules = new Set(); + for (const module of affectedModules) { + for (const [ + referencingModule, + connections + ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { + if (!referencingModule) continue; + if (infectedModules.has(referencingModule)) continue; + if (affectedModules.has(referencingModule)) continue; + const type = reduceAffectType(connections); + if (!type) continue; + if (type === true) { + directOnlyAffectModules.add(referencingModule); + } else { + affectedModules.add(referencingModule); + } + const memCache = new WeakTupleMap(); + const cache = moduleMemCacheCache.get(referencingModule); + cache.memCache = memCache; + moduleMemCaches.set(referencingModule, memCache); + } + } + for (const module of directOnlyAffectModules) affectedModules.add(module); + this.logger.log( + `${Math.round( + (100 * (affectedModules.size + infectedModules.size)) / + this.modules.size + )}% (${affectedModules.size} affected + ${ + infectedModules.size + } infected of ${ + this.modules.size + }) modules flagged as affected (${statNew} new modules, ${statChanged} changed, ${statReferencesChanged} references changed, ${statUnchanged} unchanged, ${statWithoutBuild} were not built)` + ); } - [Symbol.iterator]() { - let state = 0; - /** @type {IterableIterator} */ - let it; - /** @type {(Snapshot) => (Map | Set)[]} */ - let getMaps; - /** @type {(Map | Set)[]} */ - let maps; - /** @type {Snapshot} */ - let snapshot; - let queue; - return new SnapshotIterator(() => { - for (;;) { - switch (state) { - case 0: - snapshot = this.snapshot; - getMaps = this.getMaps; - maps = getMaps(snapshot); - state = 1; - /* falls through */ - case 1: - if (maps.length > 0) { - const map = maps.pop(); - if (map !== undefined) { - it = map.keys(); - state = 2; - } else { - break; - } - } else { - state = 3; - break; + _computeAffectedModulesWithChunkGraph() { + const { moduleMemCaches } = this; + if (!moduleMemCaches) return; + const moduleMemCaches2 = (this.moduleMemCaches2 = new Map()); + const { moduleGraph, chunkGraph } = this; + const key = "memCache2"; + let statUnchanged = 0; + let statChanged = 0; + let statNew = 0; + /** + * @param {Module} module module + * @returns {{ id: string | number, modules?: Map, blocks?: (string | number)[] }} references + */ + const computeReferences = module => { + const id = chunkGraph.getModuleId(module); + /** @type {Map} */ + let modules = undefined; + /** @type {(string | number)[] | undefined} */ + let blocks = undefined; + const outgoing = moduleGraph.getOutgoingConnectionsByModule(module); + if (outgoing !== undefined) { + for (const m of outgoing.keys()) { + if (!m) continue; + if (modules === undefined) modules = new Map(); + modules.set(m, chunkGraph.getModuleId(m)); + } + } + if (module.blocks.length > 0) { + blocks = []; + const queue = Array.from(module.blocks); + for (const block of queue) { + const chunkGroup = chunkGraph.getBlockChunkGroup(block); + if (chunkGroup) { + for (const chunk of chunkGroup.chunks) { + blocks.push(chunk.id); } - /* falls through */ - case 2: { - const result = it.next(); - if (!result.done) return result; - state = 1; - break; + } else { + blocks.push(null); } - case 3: { - const children = snapshot.children; - if (children !== undefined) { - if (children.size === 1) { - // shortcut for a single child - // avoids allocation of queue - for (const child of children) snapshot = child; - maps = getMaps(snapshot); - state = 1; - break; - } - if (queue === undefined) queue = []; - for (const child of children) { - queue.push(child); - } - } - if (queue !== undefined && queue.length > 0) { - snapshot = queue.pop(); - maps = getMaps(snapshot); - state = 1; - break; - } else { - state = 4; + queue.push.apply(queue, block.blocks); + } + } + return { id, modules, blocks }; + }; + /** + * @param {Module} module module + * @param {Object} references references + * @param {string | number} references.id id + * @param {Map=} references.modules modules + * @param {(string | number)[]=} references.blocks blocks + * @returns {boolean} ok? + */ + const compareReferences = (module, { id, modules, blocks }) => { + if (id !== chunkGraph.getModuleId(module)) return false; + if (modules !== undefined) { + for (const [module, id] of modules) { + if (chunkGraph.getModuleId(module) !== id) return false; + } + } + if (blocks !== undefined) { + const queue = Array.from(module.blocks); + let i = 0; + for (const block of queue) { + const chunkGroup = chunkGraph.getBlockChunkGroup(block); + if (chunkGroup) { + for (const chunk of chunkGroup.chunks) { + if (i >= blocks.length || blocks[i++] !== chunk.id) return false; } + } else { + if (i >= blocks.length || blocks[i++] !== null) return false; } - /* falls through */ - case 4: - return DONE_ITERATOR_RESULT; + queue.push.apply(queue, block.blocks); } + if (i !== blocks.length) return false; } - }); - } -} - -class Snapshot { - constructor() { - this._flags = 0; - /** @type {number | undefined} */ - this.startTime = undefined; - /** @type {Map | undefined} */ - this.fileTimestamps = undefined; - /** @type {Map | undefined} */ - this.fileHashes = undefined; - /** @type {Map | undefined} */ - this.fileTshs = undefined; - /** @type {Map | undefined} */ - this.contextTimestamps = undefined; - /** @type {Map | undefined} */ - this.contextHashes = undefined; - /** @type {Map | undefined} */ - this.contextTshs = undefined; - /** @type {Map | undefined} */ - this.missingExistence = undefined; - /** @type {Map | undefined} */ - this.managedItemInfo = undefined; - /** @type {Set | undefined} */ - this.managedFiles = undefined; - /** @type {Set | undefined} */ - this.managedContexts = undefined; - /** @type {Set | undefined} */ - this.managedMissing = undefined; - /** @type {Set | undefined} */ - this.children = undefined; - } - - hasStartTime() { - return (this._flags & 1) !== 0; - } - - setStartTime(value) { - this._flags = this._flags | 1; - this.startTime = value; - } + return true; + }; - setMergedStartTime(value, snapshot) { - if (value) { - if (snapshot.hasStartTime()) { - this.setStartTime(Math.min(value, snapshot.startTime)); + for (const [module, memCache] of moduleMemCaches) { + /** @type {{ references: { id: string | number, modules?: Map, blocks?: (string | number)[]}, memCache: WeakTupleMap }} */ + const cache = memCache.get(key); + if (cache === undefined) { + const memCache2 = new WeakTupleMap(); + memCache.set(key, { + references: computeReferences(module), + memCache: memCache2 + }); + moduleMemCaches2.set(module, memCache2); + statNew++; + } else if (!compareReferences(module, cache.references)) { + const memCache = new WeakTupleMap(); + cache.references = computeReferences(module); + cache.memCache = memCache; + moduleMemCaches2.set(module, memCache); + statChanged++; } else { - this.setStartTime(value); + moduleMemCaches2.set(module, cache.memCache); + statUnchanged++; } - } else { - if (snapshot.hasStartTime()) this.setStartTime(snapshot.startTime); } - } - - hasFileTimestamps() { - return (this._flags & 2) !== 0; - } - - setFileTimestamps(value) { - this._flags = this._flags | 2; - this.fileTimestamps = value; - } - - hasFileHashes() { - return (this._flags & 4) !== 0; - } - - setFileHashes(value) { - this._flags = this._flags | 4; - this.fileHashes = value; - } - - hasFileTshs() { - return (this._flags & 8) !== 0; - } - - setFileTshs(value) { - this._flags = this._flags | 8; - this.fileTshs = value; - } - - hasContextTimestamps() { - return (this._flags & 0x10) !== 0; - } - setContextTimestamps(value) { - this._flags = this._flags | 0x10; - this.contextTimestamps = value; + this.logger.log( + `${Math.round( + (100 * statChanged) / (statNew + statChanged + statUnchanged) + )}% modules flagged as affected by chunk graph (${statNew} new modules, ${statChanged} changed, ${statUnchanged} unchanged)` + ); } - hasContextHashes() { - return (this._flags & 0x20) !== 0; - } + finish(callback) { + this.factorizeQueue.clear(); + if (this.profile) { + this.logger.time("finish module profiles"); + const ParallelismFactorCalculator = __webpack_require__(50780); + const p = new ParallelismFactorCalculator(); + const moduleGraph = this.moduleGraph; + const modulesWithProfiles = new Map(); + for (const module of this.modules) { + const profile = moduleGraph.getProfile(module); + if (!profile) continue; + modulesWithProfiles.set(module, profile); + p.range( + profile.buildingStartTime, + profile.buildingEndTime, + f => (profile.buildingParallelismFactor = f) + ); + p.range( + profile.factoryStartTime, + profile.factoryEndTime, + f => (profile.factoryParallelismFactor = f) + ); + p.range( + profile.integrationStartTime, + profile.integrationEndTime, + f => (profile.integrationParallelismFactor = f) + ); + p.range( + profile.storingStartTime, + profile.storingEndTime, + f => (profile.storingParallelismFactor = f) + ); + p.range( + profile.restoringStartTime, + profile.restoringEndTime, + f => (profile.restoringParallelismFactor = f) + ); + if (profile.additionalFactoryTimes) { + for (const { start, end } of profile.additionalFactoryTimes) { + const influence = (end - start) / profile.additionalFactories; + p.range( + start, + end, + f => + (profile.additionalFactoriesParallelismFactor += f * influence) + ); + } + } + } + p.calculate(); - setContextHashes(value) { - this._flags = this._flags | 0x20; - this.contextHashes = value; - } - - hasContextTshs() { - return (this._flags & 0x40) !== 0; - } + const logger = this.getLogger("webpack.Compilation.ModuleProfile"); + const logByValue = (value, msg) => { + if (value > 1000) { + logger.error(msg); + } else if (value > 500) { + logger.warn(msg); + } else if (value > 200) { + logger.info(msg); + } else if (value > 30) { + logger.log(msg); + } else { + logger.debug(msg); + } + }; + const logNormalSummary = (category, getDuration, getParallelism) => { + let sum = 0; + let max = 0; + for (const [module, profile] of modulesWithProfiles) { + const p = getParallelism(profile); + const d = getDuration(profile); + if (d === 0 || p === 0) continue; + const t = d / p; + sum += t; + if (t <= 10) continue; + logByValue( + t, + ` | ${Math.round(t)} ms${ + p >= 1.1 ? ` (parallelism ${Math.round(p * 10) / 10})` : "" + } ${category} > ${module.readableIdentifier(this.requestShortener)}` + ); + max = Math.max(max, t); + } + if (sum <= 10) return; + logByValue( + Math.max(sum / 10, max), + `${Math.round(sum)} ms ${category}` + ); + }; + const logByLoadersSummary = (category, getDuration, getParallelism) => { + const map = new Map(); + for (const [module, profile] of modulesWithProfiles) { + const list = provide( + map, + module.type + "!" + module.identifier().replace(/(!|^)[^!]*$/, ""), + () => [] + ); + list.push({ module, profile }); + } - setContextTshs(value) { - this._flags = this._flags | 0x40; - this.contextTshs = value; - } + let sum = 0; + let max = 0; + for (const [key, modules] of map) { + let innerSum = 0; + let innerMax = 0; + for (const { module, profile } of modules) { + const p = getParallelism(profile); + const d = getDuration(profile); + if (d === 0 || p === 0) continue; + const t = d / p; + innerSum += t; + if (t <= 10) continue; + logByValue( + t, + ` | | ${Math.round(t)} ms${ + p >= 1.1 ? ` (parallelism ${Math.round(p * 10) / 10})` : "" + } ${category} > ${module.readableIdentifier( + this.requestShortener + )}` + ); + innerMax = Math.max(innerMax, t); + } + sum += innerSum; + if (innerSum <= 10) continue; + const idx = key.indexOf("!"); + const loaders = key.slice(idx + 1); + const moduleType = key.slice(0, idx); + const t = Math.max(innerSum / 10, innerMax); + logByValue( + t, + ` | ${Math.round(innerSum)} ms ${category} > ${ + loaders + ? `${ + modules.length + } x ${moduleType} with ${this.requestShortener.shorten( + loaders + )}` + : `${modules.length} x ${moduleType}` + }` + ); + max = Math.max(max, t); + } + if (sum <= 10) return; + logByValue( + Math.max(sum / 10, max), + `${Math.round(sum)} ms ${category}` + ); + }; + logNormalSummary( + "resolve to new modules", + p => p.factory, + p => p.factoryParallelismFactor + ); + logNormalSummary( + "resolve to existing modules", + p => p.additionalFactories, + p => p.additionalFactoriesParallelismFactor + ); + logNormalSummary( + "integrate modules", + p => p.restoring, + p => p.restoringParallelismFactor + ); + logByLoadersSummary( + "build modules", + p => p.building, + p => p.buildingParallelismFactor + ); + logNormalSummary( + "store modules", + p => p.storing, + p => p.storingParallelismFactor + ); + logNormalSummary( + "restore modules", + p => p.restoring, + p => p.restoringParallelismFactor + ); + this.logger.timeEnd("finish module profiles"); + } + this.logger.time("compute affected modules"); + this._computeAffectedModules(this.modules); + this.logger.timeEnd("compute affected modules"); + this.logger.time("finish modules"); + const { modules, moduleMemCaches } = this; + this.hooks.finishModules.callAsync(modules, err => { + this.logger.timeEnd("finish modules"); + if (err) return callback(err); - hasMissingExistence() { - return (this._flags & 0x80) !== 0; - } + // extract warnings and errors from modules + this.moduleGraph.freeze("dependency errors"); + // TODO keep a cacheToken (= {}) for each module in the graph + // create a new one per compilation and flag all updated files + // and parents with it + this.logger.time("report dependency errors and warnings"); + for (const module of modules) { + // TODO only run for modules with changed cacheToken + // global WeakMap> to keep modules without errors/warnings + const memCache = moduleMemCaches && moduleMemCaches.get(module); + if (memCache && memCache.get("noWarningsOrErrors")) continue; + let hasProblems = this.reportDependencyErrorsAndWarnings(module, [ + module + ]); + const errors = module.getErrors(); + if (errors !== undefined) { + for (const error of errors) { + if (!error.module) { + error.module = module; + } + this.errors.push(error); + hasProblems = true; + } + } + const warnings = module.getWarnings(); + if (warnings !== undefined) { + for (const warning of warnings) { + if (!warning.module) { + warning.module = module; + } + this.warnings.push(warning); + hasProblems = true; + } + } + if (!hasProblems && memCache) memCache.set("noWarningsOrErrors", true); + } + this.moduleGraph.unfreeze(); + this.logger.timeEnd("report dependency errors and warnings"); - setMissingExistence(value) { - this._flags = this._flags | 0x80; - this.missingExistence = value; + callback(); + }); } - hasManagedItemInfo() { - return (this._flags & 0x100) !== 0; + unseal() { + this.hooks.unseal.call(); + this.chunks.clear(); + this.chunkGroups.length = 0; + this.namedChunks.clear(); + this.namedChunkGroups.clear(); + this.entrypoints.clear(); + this.additionalChunkAssets.length = 0; + this.assets = {}; + this.assetsInfo.clear(); + this.moduleGraph.removeAllModuleAttributes(); + this.moduleGraph.unfreeze(); + this.moduleMemCaches2 = undefined; } - setManagedItemInfo(value) { - this._flags = this._flags | 0x100; - this.managedItemInfo = value; - } + /** + * @param {Callback} callback signals when the call finishes + * @returns {void} + */ + seal(callback) { + const finalCallback = err => { + this.factorizeQueue.clear(); + this.buildQueue.clear(); + this.rebuildQueue.clear(); + this.processDependenciesQueue.clear(); + this.addModuleQueue.clear(); + return callback(err); + }; + const chunkGraph = new ChunkGraph( + this.moduleGraph, + this.outputOptions.hashFunction + ); + this.chunkGraph = chunkGraph; - hasManagedFiles() { - return (this._flags & 0x200) !== 0; - } + if (this._backCompat) { + for (const module of this.modules) { + ChunkGraph.setChunkGraphForModule(module, chunkGraph); + } + } - setManagedFiles(value) { - this._flags = this._flags | 0x200; - this.managedFiles = value; - } + this.hooks.seal.call(); - hasManagedContexts() { - return (this._flags & 0x400) !== 0; - } + this.logger.time("optimize dependencies"); + while (this.hooks.optimizeDependencies.call(this.modules)) { + /* empty */ + } + this.hooks.afterOptimizeDependencies.call(this.modules); + this.logger.timeEnd("optimize dependencies"); - setManagedContexts(value) { - this._flags = this._flags | 0x400; - this.managedContexts = value; - } + this.logger.time("create chunks"); + this.hooks.beforeChunks.call(); + this.moduleGraph.freeze("seal"); + /** @type {Map} */ + const chunkGraphInit = new Map(); + for (const [name, { dependencies, includeDependencies, options }] of this + .entries) { + const chunk = this.addChunk(name); + if (options.filename) { + chunk.filenameTemplate = options.filename; + } + const entrypoint = new Entrypoint(options); + if (!options.dependOn && !options.runtime) { + entrypoint.setRuntimeChunk(chunk); + } + entrypoint.setEntrypointChunk(chunk); + this.namedChunkGroups.set(name, entrypoint); + this.entrypoints.set(name, entrypoint); + this.chunkGroups.push(entrypoint); + connectChunkGroupAndChunk(entrypoint, chunk); - hasManagedMissing() { - return (this._flags & 0x800) !== 0; - } + const entryModules = new Set(); + for (const dep of [...this.globalEntry.dependencies, ...dependencies]) { + entrypoint.addOrigin(null, { name }, /** @type {any} */ (dep).request); - setManagedMissing(value) { - this._flags = this._flags | 0x800; - this.managedMissing = value; - } + const module = this.moduleGraph.getModule(dep); + if (module) { + chunkGraph.connectChunkAndEntryModule(chunk, module, entrypoint); + entryModules.add(module); + const modulesList = chunkGraphInit.get(entrypoint); + if (modulesList === undefined) { + chunkGraphInit.set(entrypoint, [module]); + } else { + modulesList.push(module); + } + } + } - hasChildren() { - return (this._flags & 0x1000) !== 0; - } + this.assignDepths(entryModules); - setChildren(value) { - this._flags = this._flags | 0x1000; - this.children = value; - } + const mapAndSort = deps => + deps + .map(dep => this.moduleGraph.getModule(dep)) + .filter(Boolean) + .sort(compareModulesByIdentifier); + const includedModules = [ + ...mapAndSort(this.globalEntry.includeDependencies), + ...mapAndSort(includeDependencies) + ]; - addChild(child) { - if (!this.hasChildren()) { - this.setChildren(new Set()); + let modulesList = chunkGraphInit.get(entrypoint); + if (modulesList === undefined) { + chunkGraphInit.set(entrypoint, (modulesList = [])); + } + for (const module of includedModules) { + this.assignDepth(module); + modulesList.push(module); + } } - this.children.add(child); - } + const runtimeChunks = new Set(); + outer: for (const [ + name, + { + options: { dependOn, runtime } + } + ] of this.entries) { + if (dependOn && runtime) { + const err = + new WebpackError(`Entrypoint '${name}' has 'dependOn' and 'runtime' specified. This is not valid. +Entrypoints that depend on other entrypoints do not have their own runtime. +They will use the runtime(s) from referenced entrypoints instead. +Remove the 'runtime' option from the entrypoint.`); + const entry = this.entrypoints.get(name); + err.chunk = entry.getEntrypointChunk(); + this.errors.push(err); + } + if (dependOn) { + const entry = this.entrypoints.get(name); + const referencedChunks = entry + .getEntrypointChunk() + .getAllReferencedChunks(); + const dependOnEntries = []; + for (const dep of dependOn) { + const dependency = this.entrypoints.get(dep); + if (!dependency) { + throw new Error( + `Entry ${name} depends on ${dep}, but this entry was not found` + ); + } + if (referencedChunks.has(dependency.getEntrypointChunk())) { + const err = new WebpackError( + `Entrypoints '${name}' and '${dep}' use 'dependOn' to depend on each other in a circular way.` + ); + const entryChunk = entry.getEntrypointChunk(); + err.chunk = entryChunk; + this.errors.push(err); + entry.setRuntimeChunk(entryChunk); + continue outer; + } + dependOnEntries.push(dependency); + } + for (const dependency of dependOnEntries) { + connectChunkGroupParentAndChild(dependency, entry); + } + } else if (runtime) { + const entry = this.entrypoints.get(name); + let chunk = this.namedChunks.get(runtime); + if (chunk) { + if (!runtimeChunks.has(chunk)) { + const err = + new WebpackError(`Entrypoint '${name}' has a 'runtime' option which points to another entrypoint named '${runtime}'. +It's not valid to use other entrypoints as runtime chunk. +Did you mean to use 'dependOn: ${JSON.stringify( + runtime + )}' instead to allow using entrypoint '${name}' within the runtime of entrypoint '${runtime}'? For this '${runtime}' must always be loaded when '${name}' is used. +Or do you want to use the entrypoints '${name}' and '${runtime}' independently on the same page with a shared runtime? In this case give them both the same value for the 'runtime' option. It must be a name not already used by an entrypoint.`); + const entryChunk = entry.getEntrypointChunk(); + err.chunk = entryChunk; + this.errors.push(err); + entry.setRuntimeChunk(entryChunk); + continue; + } + } else { + chunk = this.addChunk(runtime); + chunk.preventIntegration = true; + runtimeChunks.add(chunk); + } + entry.unshiftChunk(chunk); + chunk.addGroup(entry); + entry.setRuntimeChunk(chunk); + } + } + buildChunkGraph(this, chunkGraphInit); + this.hooks.afterChunks.call(this.chunks); + this.logger.timeEnd("create chunks"); - serialize({ write }) { - write(this._flags); - if (this.hasStartTime()) write(this.startTime); - if (this.hasFileTimestamps()) write(this.fileTimestamps); - if (this.hasFileHashes()) write(this.fileHashes); - if (this.hasFileTshs()) write(this.fileTshs); - if (this.hasContextTimestamps()) write(this.contextTimestamps); - if (this.hasContextHashes()) write(this.contextHashes); - if (this.hasContextTshs()) write(this.contextTshs); - if (this.hasMissingExistence()) write(this.missingExistence); - if (this.hasManagedItemInfo()) write(this.managedItemInfo); - if (this.hasManagedFiles()) write(this.managedFiles); - if (this.hasManagedContexts()) write(this.managedContexts); - if (this.hasManagedMissing()) write(this.managedMissing); - if (this.hasChildren()) write(this.children); - } + this.logger.time("optimize"); + this.hooks.optimize.call(); - deserialize({ read }) { - this._flags = read(); - if (this.hasStartTime()) this.startTime = read(); - if (this.hasFileTimestamps()) this.fileTimestamps = read(); - if (this.hasFileHashes()) this.fileHashes = read(); - if (this.hasFileTshs()) this.fileTshs = read(); - if (this.hasContextTimestamps()) this.contextTimestamps = read(); - if (this.hasContextHashes()) this.contextHashes = read(); - if (this.hasContextTshs()) this.contextTshs = read(); - if (this.hasMissingExistence()) this.missingExistence = read(); - if (this.hasManagedItemInfo()) this.managedItemInfo = read(); - if (this.hasManagedFiles()) this.managedFiles = read(); - if (this.hasManagedContexts()) this.managedContexts = read(); - if (this.hasManagedMissing()) this.managedMissing = read(); - if (this.hasChildren()) this.children = read(); - } + while (this.hooks.optimizeModules.call(this.modules)) { + /* empty */ + } + this.hooks.afterOptimizeModules.call(this.modules); - /** - * @param {function(Snapshot): (ReadonlyMap | ReadonlySet)[]} getMaps first - * @returns {Iterable} iterable - */ - _createIterable(getMaps) { - return new SnapshotIterable(this, getMaps); - } + while (this.hooks.optimizeChunks.call(this.chunks, this.chunkGroups)) { + /* empty */ + } + this.hooks.afterOptimizeChunks.call(this.chunks, this.chunkGroups); - /** - * @returns {Iterable} iterable - */ - getFileIterable() { - return this._createIterable(s => [ - s.fileTimestamps, - s.fileHashes, - s.fileTshs, - s.managedFiles - ]); - } + this.hooks.optimizeTree.callAsync(this.chunks, this.modules, err => { + if (err) { + return finalCallback( + makeWebpackError(err, "Compilation.hooks.optimizeTree") + ); + } - /** - * @returns {Iterable} iterable - */ - getContextIterable() { - return this._createIterable(s => [ - s.contextTimestamps, - s.contextHashes, - s.contextTshs, - s.managedContexts - ]); - } + this.hooks.afterOptimizeTree.call(this.chunks, this.modules); - /** - * @returns {Iterable} iterable - */ - getMissingIterable() { - return this._createIterable(s => [s.missingExistence, s.managedMissing]); - } -} + this.hooks.optimizeChunkModules.callAsync( + this.chunks, + this.modules, + err => { + if (err) { + return finalCallback( + makeWebpackError(err, "Compilation.hooks.optimizeChunkModules") + ); + } -makeSerializable(Snapshot, "webpack/lib/FileSystemInfo", "Snapshot"); + this.hooks.afterOptimizeChunkModules.call(this.chunks, this.modules); -const MIN_COMMON_SNAPSHOT_SIZE = 3; + const shouldRecord = this.hooks.shouldRecord.call() !== false; -/** - * @template T - */ -class SnapshotOptimization { - /** - * @param {function(Snapshot): boolean} has has value - * @param {function(Snapshot): Map | Set} get get value - * @param {function(Snapshot, Map | Set): void} set set value - * @param {boolean=} useStartTime use the start time of snapshots - * @param {boolean=} isSet value is an Set instead of a Map - */ - constructor(has, get, set, useStartTime = true, isSet = false) { - this._has = has; - this._get = get; - this._set = set; - this._useStartTime = useStartTime; - this._isSet = isSet; - /** @type {Map} */ - this._map = new Map(); - this._statItemsShared = 0; - this._statItemsUnshared = 0; - this._statSharedSnapshots = 0; - this._statReusedSharedSnapshots = 0; - } + this.hooks.reviveModules.call(this.modules, this.records); + this.hooks.beforeModuleIds.call(this.modules); + this.hooks.moduleIds.call(this.modules); + this.hooks.optimizeModuleIds.call(this.modules); + this.hooks.afterOptimizeModuleIds.call(this.modules); - getStatisticMessage() { - const total = this._statItemsShared + this._statItemsUnshared; - if (total === 0) return undefined; - return `${ - this._statItemsShared && Math.round((this._statItemsShared * 100) / total) - }% (${this._statItemsShared}/${total}) entries shared via ${ - this._statSharedSnapshots - } shared snapshots (${ - this._statReusedSharedSnapshots + this._statSharedSnapshots - } times referenced)`; - } + this.hooks.reviveChunks.call(this.chunks, this.records); + this.hooks.beforeChunkIds.call(this.chunks); + this.hooks.chunkIds.call(this.chunks); + this.hooks.optimizeChunkIds.call(this.chunks); + this.hooks.afterOptimizeChunkIds.call(this.chunks); - clear() { - this._map.clear(); - this._statItemsShared = 0; - this._statItemsUnshared = 0; - this._statSharedSnapshots = 0; - this._statReusedSharedSnapshots = 0; + this.assignRuntimeIds(); + + this.logger.time("compute affected modules with chunk graph"); + this._computeAffectedModulesWithChunkGraph(); + this.logger.timeEnd("compute affected modules with chunk graph"); + + this.sortItemsWithChunkIds(); + + if (shouldRecord) { + this.hooks.recordModules.call(this.modules, this.records); + this.hooks.recordChunks.call(this.chunks, this.records); + } + + this.hooks.optimizeCodeGeneration.call(this.modules); + this.logger.timeEnd("optimize"); + + this.logger.time("module hashing"); + this.hooks.beforeModuleHash.call(); + this.createModuleHashes(); + this.hooks.afterModuleHash.call(); + this.logger.timeEnd("module hashing"); + + this.logger.time("code generation"); + this.hooks.beforeCodeGeneration.call(); + this.codeGeneration(err => { + if (err) { + return finalCallback(err); + } + this.hooks.afterCodeGeneration.call(); + this.logger.timeEnd("code generation"); + + this.logger.time("runtime requirements"); + this.hooks.beforeRuntimeRequirements.call(); + this.processRuntimeRequirements(); + this.hooks.afterRuntimeRequirements.call(); + this.logger.timeEnd("runtime requirements"); + + this.logger.time("hashing"); + this.hooks.beforeHash.call(); + const codeGenerationJobs = this.createHash(); + this.hooks.afterHash.call(); + this.logger.timeEnd("hashing"); + + this._runCodeGenerationJobs(codeGenerationJobs, err => { + if (err) { + return finalCallback(err); + } + + if (shouldRecord) { + this.logger.time("record hash"); + this.hooks.recordHash.call(this.records); + this.logger.timeEnd("record hash"); + } + + this.logger.time("module assets"); + this.clearAssets(); + + this.hooks.beforeModuleAssets.call(); + this.createModuleAssets(); + this.logger.timeEnd("module assets"); + + const cont = () => { + this.logger.time("process assets"); + this.hooks.processAssets.callAsync(this.assets, err => { + if (err) { + return finalCallback( + makeWebpackError(err, "Compilation.hooks.processAssets") + ); + } + this.hooks.afterProcessAssets.call(this.assets); + this.logger.timeEnd("process assets"); + this.assets = this._backCompat + ? soonFrozenObjectDeprecation( + this.assets, + "Compilation.assets", + "DEP_WEBPACK_COMPILATION_ASSETS", + `BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation. + Do changes to assets earlier, e. g. in Compilation.hooks.processAssets. + Make sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_*.` + ) + : Object.freeze(this.assets); + + this.summarizeDependencies(); + if (shouldRecord) { + this.hooks.record.call(this, this.records); + } + + if (this.hooks.needAdditionalSeal.call()) { + this.unseal(); + return this.seal(callback); + } + return this.hooks.afterSeal.callAsync(err => { + if (err) { + return finalCallback( + makeWebpackError(err, "Compilation.hooks.afterSeal") + ); + } + this.fileSystemInfo.logStatistics(); + finalCallback(); + }); + }); + }; + + this.logger.time("create chunk assets"); + if (this.hooks.shouldGenerateChunkAssets.call() !== false) { + this.hooks.beforeChunkAssets.call(); + this.createChunkAssets(err => { + this.logger.timeEnd("create chunk assets"); + if (err) { + return finalCallback(err); + } + cont(); + }); + } else { + this.logger.timeEnd("create chunk assets"); + cont(); + } + }); + }); + } + ); + }); } /** - * @param {Snapshot} newSnapshot snapshot - * @param {Set} capturedFiles files to snapshot/share - * @returns {void} + * @param {Module} module module to report from + * @param {DependenciesBlock[]} blocks blocks to report from + * @returns {boolean} true, when it has warnings or errors */ - optimize(newSnapshot, capturedFiles) { - /** - * @param {SnapshotOptimizationEntry} entry optimization entry - * @returns {void} - */ - const increaseSharedAndStoreOptimizationEntry = entry => { - if (entry.children !== undefined) { - entry.children.forEach(increaseSharedAndStoreOptimizationEntry); - } - entry.shared++; - storeOptimizationEntry(entry); - }; - /** - * @param {SnapshotOptimizationEntry} entry optimization entry - * @returns {void} - */ - const storeOptimizationEntry = entry => { - for (const path of entry.snapshotContent) { - const old = this._map.get(path); - if (old.shared < entry.shared) { - this._map.set(path, entry); - } - capturedFiles.delete(path); - } - }; + reportDependencyErrorsAndWarnings(module, blocks) { + let hasProblems = false; + for (let indexBlock = 0; indexBlock < blocks.length; indexBlock++) { + const block = blocks[indexBlock]; + const dependencies = block.dependencies; - /** @type {SnapshotOptimizationEntry} */ - let newOptimizationEntry = undefined; + for (let indexDep = 0; indexDep < dependencies.length; indexDep++) { + const d = dependencies[indexDep]; - const capturedFilesSize = capturedFiles.size; + const warnings = d.getWarnings(this.moduleGraph); + if (warnings) { + for (let indexWar = 0; indexWar < warnings.length; indexWar++) { + const w = warnings[indexWar]; - /** @type {Set | undefined} */ - const optimizationEntries = new Set(); + const warning = new ModuleDependencyWarning(module, w, d.loc); + this.warnings.push(warning); + hasProblems = true; + } + } + const errors = d.getErrors(this.moduleGraph); + if (errors) { + for (let indexErr = 0; indexErr < errors.length; indexErr++) { + const e = errors[indexErr]; - for (const path of capturedFiles) { - const optimizationEntry = this._map.get(path); - if (optimizationEntry === undefined) { - if (newOptimizationEntry === undefined) { - newOptimizationEntry = { - snapshot: newSnapshot, - shared: 0, - snapshotContent: undefined, - children: undefined - }; + const error = new ModuleDependencyError(module, e, d.loc); + this.errors.push(error); + hasProblems = true; + } } - this._map.set(path, newOptimizationEntry); - continue; - } else { - optimizationEntries.add(optimizationEntry); } + + if (this.reportDependencyErrorsAndWarnings(module, block.blocks)) + hasProblems = true; } + return hasProblems; + } - optimizationEntries: for (const optimizationEntry of optimizationEntries) { - const snapshot = optimizationEntry.snapshot; - if (optimizationEntry.shared > 0) { - // It's a shared snapshot - // We can't change it, so we can only use it when all files match - // and startTime is compatible - if ( - this._useStartTime && - newSnapshot.startTime && - (!snapshot.startTime || snapshot.startTime > newSnapshot.startTime) - ) { - continue; + codeGeneration(callback) { + const { chunkGraph } = this; + this.codeGenerationResults = new CodeGenerationResults( + this.outputOptions.hashFunction + ); + /** @type {{module: Module, hash: string, runtime: RuntimeSpec, runtimes: RuntimeSpec[]}[]} */ + const jobs = []; + for (const module of this.modules) { + const runtimes = chunkGraph.getModuleRuntimes(module); + if (runtimes.size === 1) { + for (const runtime of runtimes) { + const hash = chunkGraph.getModuleHash(module, runtime); + jobs.push({ module, hash, runtime, runtimes: [runtime] }); } - const nonSharedFiles = new Set(); - const snapshotContent = optimizationEntry.snapshotContent; - const snapshotEntries = this._get(snapshot); - for (const path of snapshotContent) { - if (!capturedFiles.has(path)) { - if (!snapshotEntries.has(path)) { - // File is not shared and can't be removed from the snapshot - // because it's in a child of the snapshot - continue optimizationEntries; - } - nonSharedFiles.add(path); - continue; + } else if (runtimes.size > 1) { + /** @type {Map} */ + const map = new Map(); + for (const runtime of runtimes) { + const hash = chunkGraph.getModuleHash(module, runtime); + const job = map.get(hash); + if (job === undefined) { + const newJob = { module, hash, runtime, runtimes: [runtime] }; + jobs.push(newJob); + map.set(hash, newJob); + } else { + job.runtimes.push(runtime); } } - if (nonSharedFiles.size === 0) { - // The complete snapshot is shared - // add it as child - newSnapshot.addChild(snapshot); - increaseSharedAndStoreOptimizationEntry(optimizationEntry); - this._statReusedSharedSnapshots++; - } else { - // Only a part of the snapshot is shared - const sharedCount = snapshotContent.size - nonSharedFiles.size; - if (sharedCount < MIN_COMMON_SNAPSHOT_SIZE) { - // Common part it too small - continue optimizationEntries; - } - // Extract common timestamps from both snapshots - let commonMap; - if (this._isSet) { - commonMap = new Set(); - for (const path of /** @type {Set} */ (snapshotEntries)) { - if (nonSharedFiles.has(path)) continue; - commonMap.add(path); - snapshotEntries.delete(path); - } - } else { - commonMap = new Map(); - const map = /** @type {Map} */ (snapshotEntries); - for (const [path, value] of map) { - if (nonSharedFiles.has(path)) continue; - commonMap.set(path, value); - snapshotEntries.delete(path); + } + } + + this._runCodeGenerationJobs(jobs, callback); + } + + _runCodeGenerationJobs(jobs, callback) { + let statModulesFromCache = 0; + let statModulesGenerated = 0; + const { chunkGraph, moduleGraph, dependencyTemplates, runtimeTemplate } = + this; + const results = this.codeGenerationResults; + const errors = []; + /** @type {Set | undefined} */ + let notCodeGeneratedModules = undefined; + const runIteration = () => { + let delayedJobs = []; + let delayedModules = new Set(); + asyncLib.eachLimit( + jobs, + this.options.parallelism, + (job, callback) => { + const { module } = job; + const { codeGenerationDependencies } = module; + if (codeGenerationDependencies !== undefined) { + if ( + notCodeGeneratedModules === undefined || + codeGenerationDependencies.some(dep => { + const referencedModule = moduleGraph.getModule(dep); + return notCodeGeneratedModules.has(referencedModule); + }) + ) { + delayedJobs.push(job); + delayedModules.add(module); + return callback(); } } - // Create and attach snapshot - const commonSnapshot = new Snapshot(); - if (this._useStartTime) { - commonSnapshot.setMergedStartTime(newSnapshot.startTime, snapshot); - } - this._set(commonSnapshot, commonMap); - newSnapshot.addChild(commonSnapshot); - snapshot.addChild(commonSnapshot); - // Create optimization entry - const newEntry = { - snapshot: commonSnapshot, - shared: optimizationEntry.shared + 1, - snapshotContent: new Set(commonMap.keys()), - children: undefined - }; - if (optimizationEntry.children === undefined) - optimizationEntry.children = new Set(); - optimizationEntry.children.add(newEntry); - storeOptimizationEntry(newEntry); - this._statSharedSnapshots++; - } - } else { - // It's a unshared snapshot - // We can extract a common shared snapshot - // with all common files - const snapshotEntries = this._get(snapshot); - if (snapshotEntries === undefined) { - // Incomplete snapshot, that can't be used - continue optimizationEntries; - } - let commonMap; - if (this._isSet) { - commonMap = new Set(); - const set = /** @type {Set} */ (snapshotEntries); - if (capturedFiles.size < set.size) { - for (const path of capturedFiles) { - if (set.has(path)) commonMap.add(path); + const { hash, runtime, runtimes } = job; + this._codeGenerationModule( + module, + runtime, + runtimes, + hash, + dependencyTemplates, + chunkGraph, + moduleGraph, + runtimeTemplate, + errors, + results, + (err, codeGenerated) => { + if (codeGenerated) statModulesGenerated++; + else statModulesFromCache++; + callback(err); } - } else { - for (const path of set) { - if (capturedFiles.has(path)) commonMap.add(path); + ); + }, + err => { + if (err) return callback(err); + if (delayedJobs.length > 0) { + if (delayedJobs.length === jobs.length) { + return callback( + new Error( + `Unable to make progress during code generation because of circular code generation dependency: ${Array.from( + delayedModules, + m => m.identifier() + ).join(", ")}` + ) + ); } + jobs = delayedJobs; + delayedJobs = []; + notCodeGeneratedModules = delayedModules; + delayedModules = new Set(); + return runIteration(); } - } else { - commonMap = new Map(); - const map = /** @type {Map} */ (snapshotEntries); - for (const path of capturedFiles) { - const ts = map.get(path); - if (ts === undefined) continue; - commonMap.set(path, ts); + if (errors.length > 0) { + errors.sort( + compareSelect(err => err.module, compareModulesByIdentifier) + ); + for (const error of errors) { + this.errors.push(error); + } } + this.logger.log( + `${Math.round( + (100 * statModulesGenerated) / + (statModulesGenerated + statModulesFromCache) + )}% code generated (${statModulesGenerated} generated, ${statModulesFromCache} from cache)` + ); + callback(); } - - if (commonMap.size < MIN_COMMON_SNAPSHOT_SIZE) { - // Common part it too small - continue optimizationEntries; - } - // Create and attach snapshot - const commonSnapshot = new Snapshot(); - if (this._useStartTime) { - commonSnapshot.setMergedStartTime(newSnapshot.startTime, snapshot); - } - this._set(commonSnapshot, commonMap); - newSnapshot.addChild(commonSnapshot); - snapshot.addChild(commonSnapshot); - // Remove files from snapshot - for (const path of commonMap.keys()) snapshotEntries.delete(path); - const sharedCount = commonMap.size; - this._statItemsUnshared -= sharedCount; - this._statItemsShared += sharedCount; - // Create optimization entry - storeOptimizationEntry({ - snapshot: commonSnapshot, - shared: 2, - snapshotContent: new Set(commonMap.keys()), - children: undefined - }); - this._statSharedSnapshots++; - } - } - const unshared = capturedFiles.size; - this._statItemsUnshared += unshared; - this._statItemsShared += capturedFilesSize - unshared; + ); + }; + runIteration(); } -} - -const parseString = str => { - if (str[0] === "'") str = `"${str.slice(1, -1).replace(/"/g, '\\"')}"`; - return JSON.parse(str); -}; - -/* istanbul ignore next */ -/** - * @param {number} mtime mtime - */ -const applyMtime = mtime => { - if (FS_ACCURACY > 1 && mtime % 2 !== 0) FS_ACCURACY = 1; - else if (FS_ACCURACY > 10 && mtime % 20 !== 0) FS_ACCURACY = 10; - else if (FS_ACCURACY > 100 && mtime % 200 !== 0) FS_ACCURACY = 100; - else if (FS_ACCURACY > 1000 && mtime % 2000 !== 0) FS_ACCURACY = 1000; -}; -/** - * @template T - * @template K - * @param {Map} a source map - * @param {Map} b joining map - * @returns {Map} joined map - */ -const mergeMaps = (a, b) => { - if (!b || b.size === 0) return a; - if (!a || a.size === 0) return b; - const map = new Map(a); - for (const [key, value] of b) { - map.set(key, value); - } - return map; -}; - -/** - * @template T - * @template K - * @param {Set} a source map - * @param {Set} b joining map - * @returns {Set} joined map - */ -const mergeSets = (a, b) => { - if (!b || b.size === 0) return a; - if (!a || a.size === 0) return b; - const map = new Set(a); - for (const item of b) { - map.add(item); + /** + * @param {Module} module module + * @param {RuntimeSpec} runtime runtime + * @param {RuntimeSpec[]} runtimes runtimes + * @param {string} hash hash + * @param {DependencyTemplates} dependencyTemplates dependencyTemplates + * @param {ChunkGraph} chunkGraph chunkGraph + * @param {ModuleGraph} moduleGraph moduleGraph + * @param {RuntimeTemplate} runtimeTemplate runtimeTemplate + * @param {WebpackError[]} errors errors + * @param {CodeGenerationResults} results results + * @param {function(WebpackError=, boolean=): void} callback callback + */ + _codeGenerationModule( + module, + runtime, + runtimes, + hash, + dependencyTemplates, + chunkGraph, + moduleGraph, + runtimeTemplate, + errors, + results, + callback + ) { + let codeGenerated = false; + const cache = new MultiItemCache( + runtimes.map(runtime => + this._codeGenerationCache.getItemCache( + `${module.identifier()}|${getRuntimeKey(runtime)}`, + `${hash}|${dependencyTemplates.getHash()}` + ) + ) + ); + cache.get((err, cachedResult) => { + if (err) return callback(err); + let result; + if (!cachedResult) { + try { + codeGenerated = true; + this.codeGeneratedModules.add(module); + result = module.codeGeneration({ + chunkGraph, + moduleGraph, + dependencyTemplates, + runtimeTemplate, + runtime, + codeGenerationResults: results + }); + } catch (err) { + errors.push(new CodeGenerationError(module, err)); + result = cachedResult = { + sources: new Map(), + runtimeRequirements: null + }; + } + } else { + result = cachedResult; + } + for (const runtime of runtimes) { + results.add(module, runtime, result); + } + if (!cachedResult) { + cache.store(result, err => callback(err, codeGenerated)); + } else { + callback(null, codeGenerated); + } + }); } - return map; -}; -/** - * Finding file or directory to manage - * @param {string} managedPath path that is managing by {@link FileSystemInfo} - * @param {string} path path to file or directory - * @returns {string|null} managed item - * @example - * getManagedItem( - * '/Users/user/my-project/node_modules/', - * '/Users/user/my-project/node_modules/package/index.js' - * ) === '/Users/user/my-project/node_modules/package' - * getManagedItem( - * '/Users/user/my-project/node_modules/', - * '/Users/user/my-project/node_modules/package1/node_modules/package2' - * ) === '/Users/user/my-project/node_modules/package1/node_modules/package2' - * getManagedItem( - * '/Users/user/my-project/node_modules/', - * '/Users/user/my-project/node_modules/.bin/script.js' - * ) === null // hidden files are disallowed as managed items - * getManagedItem( - * '/Users/user/my-project/node_modules/', - * '/Users/user/my-project/node_modules/package' - * ) === '/Users/user/my-project/node_modules/package' - */ -const getManagedItem = (managedPath, path) => { - let i = managedPath.length; - let slashes = 1; - let startingPosition = true; - loop: while (i < path.length) { - switch (path.charCodeAt(i)) { - case 47: // slash - case 92: // backslash - if (--slashes === 0) break loop; - startingPosition = true; - break; - case 46: // . - // hidden files are disallowed as managed items - // it's probably .yarn-integrity or .cache - if (startingPosition) return null; - break; - case 64: // @ - if (!startingPosition) return null; - slashes++; - break; - default: - startingPosition = false; - break; - } - i++; - } - if (i === path.length) slashes--; - // return null when path is incomplete - if (slashes !== 0) return null; - // if (path.slice(i + 1, i + 13) === "node_modules") - if ( - path.length >= i + 13 && - path.charCodeAt(i + 1) === 110 && - path.charCodeAt(i + 2) === 111 && - path.charCodeAt(i + 3) === 100 && - path.charCodeAt(i + 4) === 101 && - path.charCodeAt(i + 5) === 95 && - path.charCodeAt(i + 6) === 109 && - path.charCodeAt(i + 7) === 111 && - path.charCodeAt(i + 8) === 100 && - path.charCodeAt(i + 9) === 117 && - path.charCodeAt(i + 10) === 108 && - path.charCodeAt(i + 11) === 101 && - path.charCodeAt(i + 12) === 115 - ) { - // if this is the end of the path - if (path.length === i + 13) { - // return the node_modules directory - // it's special - return path; + _getChunkGraphEntries() { + /** @type {Set} */ + const treeEntries = new Set(); + for (const ep of this.entrypoints.values()) { + const chunk = ep.getRuntimeChunk(); + if (chunk) treeEntries.add(chunk); } - const c = path.charCodeAt(i + 13); - // if next symbol is slash or backslash - if (c === 47 || c === 92) { - // Managed subpath - return getManagedItem(path.slice(0, i + 14), path); + for (const ep of this.asyncEntrypoints) { + const chunk = ep.getRuntimeChunk(); + if (chunk) treeEntries.add(chunk); } + return treeEntries; } - return path.slice(0, i); -}; - -/** - * @template {ContextFileSystemInfoEntry | ContextTimestampAndHash} T - * @param {T} entry entry - * @returns {T["resolved"] | undefined} the resolved entry - */ -const getResolvedTimestamp = entry => { - if (entry === null) return null; - if (entry.resolved !== undefined) return entry.resolved; - return entry.symlinks === undefined ? entry : undefined; -}; - -/** - * @param {ContextHash} entry entry - * @returns {string | undefined} the resolved entry - */ -const getResolvedHash = entry => { - if (entry === null) return null; - if (entry.resolved !== undefined) return entry.resolved; - return entry.symlinks === undefined ? entry.hash : undefined; -}; - -const addAll = (source, target) => { - for (const key of source) target.add(key); -}; -/** - * Used to access information about the filesystem in a cached way - */ -class FileSystemInfo { /** - * @param {InputFileSystem} fs file system * @param {Object} options options - * @param {Iterable=} options.managedPaths paths that are only managed by a package manager - * @param {Iterable=} options.immutablePaths paths that are immutable - * @param {Logger=} options.logger logger used to log invalid snapshots - * @param {string | Hash=} options.hashFunction the hash function to use + * @param {ChunkGraph=} options.chunkGraph the chunk graph + * @param {Iterable=} options.modules modules + * @param {Iterable=} options.chunks chunks + * @param {CodeGenerationResults=} options.codeGenerationResults codeGenerationResults + * @param {Iterable=} options.chunkGraphEntries chunkGraphEntries + * @returns {void} */ - constructor( - fs, - { - managedPaths = [], - immutablePaths = [], - logger, - hashFunction = "md4" - } = {} - ) { - this.fs = fs; - this.logger = logger; - this._remainingLogs = logger ? 40 : 0; - this._loggedPaths = logger ? new Set() : undefined; - this._hashFunction = hashFunction; - /** @type {WeakMap} */ - this._snapshotCache = new WeakMap(); - this._fileTimestampsOptimization = new SnapshotOptimization( - s => s.hasFileTimestamps(), - s => s.fileTimestamps, - (s, v) => s.setFileTimestamps(v) - ); - this._fileHashesOptimization = new SnapshotOptimization( - s => s.hasFileHashes(), - s => s.fileHashes, - (s, v) => s.setFileHashes(v), - false - ); - this._fileTshsOptimization = new SnapshotOptimization( - s => s.hasFileTshs(), - s => s.fileTshs, - (s, v) => s.setFileTshs(v) - ); - this._contextTimestampsOptimization = new SnapshotOptimization( - s => s.hasContextTimestamps(), - s => s.contextTimestamps, - (s, v) => s.setContextTimestamps(v) - ); - this._contextHashesOptimization = new SnapshotOptimization( - s => s.hasContextHashes(), - s => s.contextHashes, - (s, v) => s.setContextHashes(v), - false - ); - this._contextTshsOptimization = new SnapshotOptimization( - s => s.hasContextTshs(), - s => s.contextTshs, - (s, v) => s.setContextTshs(v) - ); - this._missingExistenceOptimization = new SnapshotOptimization( - s => s.hasMissingExistence(), - s => s.missingExistence, - (s, v) => s.setMissingExistence(v), - false - ); - this._managedItemInfoOptimization = new SnapshotOptimization( - s => s.hasManagedItemInfo(), - s => s.managedItemInfo, - (s, v) => s.setManagedItemInfo(v), - false - ); - this._managedFilesOptimization = new SnapshotOptimization( - s => s.hasManagedFiles(), - s => s.managedFiles, - (s, v) => s.setManagedFiles(v), - false, - true - ); - this._managedContextsOptimization = new SnapshotOptimization( - s => s.hasManagedContexts(), - s => s.managedContexts, - (s, v) => s.setManagedContexts(v), - false, - true - ); - this._managedMissingOptimization = new SnapshotOptimization( - s => s.hasManagedMissing(), - s => s.managedMissing, - (s, v) => s.setManagedMissing(v), - false, - true - ); - /** @type {StackedCacheMap} */ - this._fileTimestamps = new StackedCacheMap(); - /** @type {Map} */ - this._fileHashes = new Map(); - /** @type {Map} */ - this._fileTshs = new Map(); - /** @type {StackedCacheMap} */ - this._contextTimestamps = new StackedCacheMap(); - /** @type {Map} */ - this._contextHashes = new Map(); - /** @type {Map} */ - this._contextTshs = new Map(); - /** @type {Map} */ - this._managedItems = new Map(); - /** @type {AsyncQueue} */ - this.fileTimestampQueue = new AsyncQueue({ - name: "file timestamp", - parallelism: 30, - processor: this._readFileTimestamp.bind(this) - }); - /** @type {AsyncQueue} */ - this.fileHashQueue = new AsyncQueue({ - name: "file hash", - parallelism: 10, - processor: this._readFileHash.bind(this) - }); - /** @type {AsyncQueue} */ - this.contextTimestampQueue = new AsyncQueue({ - name: "context timestamp", - parallelism: 2, - processor: this._readContextTimestamp.bind(this) - }); - /** @type {AsyncQueue} */ - this.contextHashQueue = new AsyncQueue({ - name: "context hash", - parallelism: 2, - processor: this._readContextHash.bind(this) - }); - /** @type {AsyncQueue} */ - this.contextTshQueue = new AsyncQueue({ - name: "context hash and timestamp", - parallelism: 2, - processor: this._readContextTimestampAndHash.bind(this) - }); - /** @type {AsyncQueue} */ - this.managedItemQueue = new AsyncQueue({ - name: "managed item info", - parallelism: 10, - processor: this._getManagedItemInfo.bind(this) - }); - /** @type {AsyncQueue>} */ - this.managedItemDirectoryQueue = new AsyncQueue({ - name: "managed item directory info", - parallelism: 10, - processor: this._getManagedItemDirectoryInfo.bind(this) - }); - this.managedPaths = Array.from(managedPaths); - this.managedPathsWithSlash = /** @type {string[]} */ ( - this.managedPaths.filter(p => typeof p === "string") - ).map(p => join(fs, p, "_").slice(0, -1)); + processRuntimeRequirements({ + chunkGraph = this.chunkGraph, + modules = this.modules, + chunks = this.chunks, + codeGenerationResults = this.codeGenerationResults, + chunkGraphEntries = this._getChunkGraphEntries() + } = {}) { + const context = { chunkGraph, codeGenerationResults }; + const { moduleMemCaches2 } = this; + this.logger.time("runtime requirements.modules"); + const additionalModuleRuntimeRequirements = + this.hooks.additionalModuleRuntimeRequirements; + const runtimeRequirementInModule = this.hooks.runtimeRequirementInModule; + for (const module of modules) { + if (chunkGraph.getNumberOfModuleChunks(module) > 0) { + const memCache = moduleMemCaches2 && moduleMemCaches2.get(module); + for (const runtime of chunkGraph.getModuleRuntimes(module)) { + if (memCache) { + const cached = memCache.get( + `moduleRuntimeRequirements-${getRuntimeKey(runtime)}` + ); + if (cached !== undefined) { + if (cached !== null) { + chunkGraph.addModuleRuntimeRequirements( + module, + runtime, + cached, + false + ); + } + continue; + } + } + let set; + const runtimeRequirements = + codeGenerationResults.getRuntimeRequirements(module, runtime); + if (runtimeRequirements && runtimeRequirements.size > 0) { + set = new Set(runtimeRequirements); + } else if (additionalModuleRuntimeRequirements.isUsed()) { + set = new Set(); + } else { + if (memCache) { + memCache.set( + `moduleRuntimeRequirements-${getRuntimeKey(runtime)}`, + null + ); + } + continue; + } + additionalModuleRuntimeRequirements.call(module, set, context); - this.managedPathsRegExps = /** @type {RegExp[]} */ ( - this.managedPaths.filter(p => typeof p !== "string") - ); - this.immutablePaths = Array.from(immutablePaths); - this.immutablePathsWithSlash = /** @type {string[]} */ ( - this.immutablePaths.filter(p => typeof p === "string") - ).map(p => join(fs, p, "_").slice(0, -1)); - this.immutablePathsRegExps = /** @type {RegExp[]} */ ( - this.immutablePaths.filter(p => typeof p !== "string") - ); + for (const r of set) { + const hook = runtimeRequirementInModule.get(r); + if (hook !== undefined) hook.call(module, set, context); + } + if (set.size === 0) { + if (memCache) { + memCache.set( + `moduleRuntimeRequirements-${getRuntimeKey(runtime)}`, + null + ); + } + } else { + if (memCache) { + memCache.set( + `moduleRuntimeRequirements-${getRuntimeKey(runtime)}`, + set + ); + chunkGraph.addModuleRuntimeRequirements( + module, + runtime, + set, + false + ); + } else { + chunkGraph.addModuleRuntimeRequirements(module, runtime, set); + } + } + } + } + } + this.logger.timeEnd("runtime requirements.modules"); - this._cachedDeprecatedFileTimestamps = undefined; - this._cachedDeprecatedContextTimestamps = undefined; + this.logger.time("runtime requirements.chunks"); + for (const chunk of chunks) { + const set = new Set(); + for (const module of chunkGraph.getChunkModulesIterable(chunk)) { + const runtimeRequirements = chunkGraph.getModuleRuntimeRequirements( + module, + chunk.runtime + ); + for (const r of runtimeRequirements) set.add(r); + } + this.hooks.additionalChunkRuntimeRequirements.call(chunk, set, context); - this._warnAboutExperimentalEsmTracking = false; + for (const r of set) { + this.hooks.runtimeRequirementInChunk.for(r).call(chunk, set, context); + } - this._statCreatedSnapshots = 0; - this._statTestedSnapshotsCached = 0; - this._statTestedSnapshotsNotCached = 0; - this._statTestedChildrenCached = 0; - this._statTestedChildrenNotCached = 0; - this._statTestedEntries = 0; - } + chunkGraph.addChunkRuntimeRequirements(chunk, set); + } + this.logger.timeEnd("runtime requirements.chunks"); - logStatistics() { - const logWhenMessage = (header, message) => { - if (message) { - this.logger.log(`${header}: ${message}`); + this.logger.time("runtime requirements.entries"); + for (const treeEntry of chunkGraphEntries) { + const set = new Set(); + for (const chunk of treeEntry.getAllReferencedChunks()) { + const runtimeRequirements = + chunkGraph.getChunkRuntimeRequirements(chunk); + for (const r of runtimeRequirements) set.add(r); } - }; - this.logger.log(`${this._statCreatedSnapshots} new snapshots created`); - this.logger.log( - `${ - this._statTestedSnapshotsNotCached && - Math.round( - (this._statTestedSnapshotsNotCached * 100) / - (this._statTestedSnapshotsCached + - this._statTestedSnapshotsNotCached) - ) - }% root snapshot uncached (${this._statTestedSnapshotsNotCached} / ${ - this._statTestedSnapshotsCached + this._statTestedSnapshotsNotCached - })` - ); - this.logger.log( - `${ - this._statTestedChildrenNotCached && - Math.round( - (this._statTestedChildrenNotCached * 100) / - (this._statTestedChildrenCached + this._statTestedChildrenNotCached) - ) - }% children snapshot uncached (${this._statTestedChildrenNotCached} / ${ - this._statTestedChildrenCached + this._statTestedChildrenNotCached - })` - ); - this.logger.log(`${this._statTestedEntries} entries tested`); - this.logger.log( - `File info in cache: ${this._fileTimestamps.size} timestamps ${this._fileHashes.size} hashes ${this._fileTshs.size} timestamp hash combinations` - ); - logWhenMessage( - `File timestamp snapshot optimization`, - this._fileTimestampsOptimization.getStatisticMessage() - ); - logWhenMessage( - `File hash snapshot optimization`, - this._fileHashesOptimization.getStatisticMessage() - ); - logWhenMessage( - `File timestamp hash combination snapshot optimization`, - this._fileTshsOptimization.getStatisticMessage() - ); - this.logger.log( - `Directory info in cache: ${this._contextTimestamps.size} timestamps ${this._contextHashes.size} hashes ${this._contextTshs.size} timestamp hash combinations` - ); - logWhenMessage( - `Directory timestamp snapshot optimization`, - this._contextTimestampsOptimization.getStatisticMessage() - ); - logWhenMessage( - `Directory hash snapshot optimization`, - this._contextHashesOptimization.getStatisticMessage() - ); - logWhenMessage( - `Directory timestamp hash combination snapshot optimization`, - this._contextTshsOptimization.getStatisticMessage() - ); - logWhenMessage( - `Missing items snapshot optimization`, - this._missingExistenceOptimization.getStatisticMessage() - ); - this.logger.log( - `Managed items info in cache: ${this._managedItems.size} items` - ); - logWhenMessage( - `Managed items snapshot optimization`, - this._managedItemInfoOptimization.getStatisticMessage() - ); - logWhenMessage( - `Managed files snapshot optimization`, - this._managedFilesOptimization.getStatisticMessage() - ); - logWhenMessage( - `Managed contexts snapshot optimization`, - this._managedContextsOptimization.getStatisticMessage() - ); - logWhenMessage( - `Managed missing snapshot optimization`, - this._managedMissingOptimization.getStatisticMessage() - ); - } - _log(path, reason, ...args) { - const key = path + reason; - if (this._loggedPaths.has(key)) return; - this._loggedPaths.add(key); - this.logger.debug(`${path} invalidated because ${reason}`, ...args); - if (--this._remainingLogs === 0) { - this.logger.debug( - "Logging limit has been reached and no further logging will be emitted by FileSystemInfo" + this.hooks.additionalTreeRuntimeRequirements.call( + treeEntry, + set, + context ); + + for (const r of set) { + this.hooks.runtimeRequirementInTree + .for(r) + .call(treeEntry, set, context); + } + + chunkGraph.addTreeRuntimeRequirements(treeEntry, set); } + this.logger.timeEnd("runtime requirements.entries"); } - clear() { - this._remainingLogs = this.logger ? 40 : 0; - if (this._loggedPaths !== undefined) this._loggedPaths.clear(); + // TODO webpack 6 make chunkGraph argument non-optional + /** + * @param {Chunk} chunk target chunk + * @param {RuntimeModule} module runtime module + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {void} + */ + addRuntimeModule(chunk, module, chunkGraph = this.chunkGraph) { + // Deprecated ModuleGraph association + if (this._backCompat) + ModuleGraph.setModuleGraphForModule(module, this.moduleGraph); - this._snapshotCache = new WeakMap(); - this._fileTimestampsOptimization.clear(); - this._fileHashesOptimization.clear(); - this._fileTshsOptimization.clear(); - this._contextTimestampsOptimization.clear(); - this._contextHashesOptimization.clear(); - this._contextTshsOptimization.clear(); - this._missingExistenceOptimization.clear(); - this._managedItemInfoOptimization.clear(); - this._managedFilesOptimization.clear(); - this._managedContextsOptimization.clear(); - this._managedMissingOptimization.clear(); - this._fileTimestamps.clear(); - this._fileHashes.clear(); - this._fileTshs.clear(); - this._contextTimestamps.clear(); - this._contextHashes.clear(); - this._contextTshs.clear(); - this._managedItems.clear(); - this._managedItems.clear(); + // add it to the list + this.modules.add(module); + this._modules.set(module.identifier(), module); - this._cachedDeprecatedFileTimestamps = undefined; - this._cachedDeprecatedContextTimestamps = undefined; + // connect to the chunk graph + chunkGraph.connectChunkAndModule(chunk, module); + chunkGraph.connectChunkAndRuntimeModule(chunk, module); + if (module.fullHash) { + chunkGraph.addFullHashModuleToChunk(chunk, module); + } else if (module.dependentHash) { + chunkGraph.addDependentHashModuleToChunk(chunk, module); + } - this._statCreatedSnapshots = 0; - this._statTestedSnapshotsCached = 0; - this._statTestedSnapshotsNotCached = 0; - this._statTestedChildrenCached = 0; - this._statTestedChildrenNotCached = 0; - this._statTestedEntries = 0; + // attach runtime module + module.attach(this, chunk, chunkGraph); + + // Setup internals + const exportsInfo = this.moduleGraph.getExportsInfo(module); + exportsInfo.setHasProvideInfo(); + if (typeof chunk.runtime === "string") { + exportsInfo.setUsedForSideEffectsOnly(chunk.runtime); + } else if (chunk.runtime === undefined) { + exportsInfo.setUsedForSideEffectsOnly(undefined); + } else { + for (const runtime of chunk.runtime) { + exportsInfo.setUsedForSideEffectsOnly(runtime); + } + } + chunkGraph.addModuleRuntimeRequirements( + module, + chunk.runtime, + new Set([RuntimeGlobals.requireScope]) + ); + + // runtime modules don't need ids + chunkGraph.setModuleId(module, ""); + + // Call hook + this.hooks.runtimeModule.call(module, chunk); } /** - * @param {ReadonlyMap} map timestamps - * @param {boolean=} immutable if 'map' is immutable and FileSystemInfo can keep referencing it - * @returns {void} + * If `module` is passed, `loc` and `request` must also be passed. + * @param {string | ChunkGroupOptions} groupOptions options for the chunk group + * @param {Module=} module the module the references the chunk group + * @param {DependencyLocation=} loc the location from with the chunk group is referenced (inside of module) + * @param {string=} request the request from which the the chunk group is referenced + * @returns {ChunkGroup} the new or existing chunk group */ - addFileTimestamps(map, immutable) { - this._fileTimestamps.addAll(map, immutable); - this._cachedDeprecatedFileTimestamps = undefined; + addChunkInGroup(groupOptions, module, loc, request) { + if (typeof groupOptions === "string") { + groupOptions = { name: groupOptions }; + } + const name = groupOptions.name; + + if (name) { + const chunkGroup = this.namedChunkGroups.get(name); + if (chunkGroup !== undefined) { + chunkGroup.addOptions(groupOptions); + if (module) { + chunkGroup.addOrigin(module, loc, request); + } + return chunkGroup; + } + } + const chunkGroup = new ChunkGroup(groupOptions); + if (module) chunkGroup.addOrigin(module, loc, request); + const chunk = this.addChunk(name); + + connectChunkGroupAndChunk(chunkGroup, chunk); + + this.chunkGroups.push(chunkGroup); + if (name) { + this.namedChunkGroups.set(name, chunkGroup); + } + return chunkGroup; } /** - * @param {ReadonlyMap} map timestamps - * @param {boolean=} immutable if 'map' is immutable and FileSystemInfo can keep referencing it - * @returns {void} + * @param {EntryOptions} options options for the entrypoint + * @param {Module} module the module the references the chunk group + * @param {DependencyLocation} loc the location from with the chunk group is referenced (inside of module) + * @param {string} request the request from which the the chunk group is referenced + * @returns {Entrypoint} the new or existing entrypoint */ - addContextTimestamps(map, immutable) { - this._contextTimestamps.addAll(map, immutable); - this._cachedDeprecatedContextTimestamps = undefined; + addAsyncEntrypoint(options, module, loc, request) { + const name = options.name; + if (name) { + const entrypoint = this.namedChunkGroups.get(name); + if (entrypoint instanceof Entrypoint) { + if (entrypoint !== undefined) { + if (module) { + entrypoint.addOrigin(module, loc, request); + } + return entrypoint; + } + } else if (entrypoint) { + throw new Error( + `Cannot add an async entrypoint with the name '${name}', because there is already an chunk group with this name` + ); + } + } + const chunk = this.addChunk(name); + if (options.filename) { + chunk.filenameTemplate = options.filename; + } + const entrypoint = new Entrypoint(options, false); + entrypoint.setRuntimeChunk(chunk); + entrypoint.setEntrypointChunk(chunk); + if (name) { + this.namedChunkGroups.set(name, entrypoint); + } + this.chunkGroups.push(entrypoint); + this.asyncEntrypoints.push(entrypoint); + connectChunkGroupAndChunk(entrypoint, chunk); + if (module) { + entrypoint.addOrigin(module, loc, request); + } + return entrypoint; } /** - * @param {string} path file path - * @param {function((WebpackError | null)=, (FileSystemInfoEntry | "ignore" | null)=): void} callback callback function - * @returns {void} + * This method first looks to see if a name is provided for a new chunk, + * and first looks to see if any named chunks already exist and reuse that chunk instead. + * + * @param {string=} name optional chunk name to be provided + * @returns {Chunk} create a chunk (invoked during seal event) */ - getFileTimestamp(path, callback) { - const cache = this._fileTimestamps.get(path); - if (cache !== undefined) return callback(null, cache); - this.fileTimestampQueue.add(path, callback); + addChunk(name) { + if (name) { + const chunk = this.namedChunks.get(name); + if (chunk !== undefined) { + return chunk; + } + } + const chunk = new Chunk(name, this._backCompat); + this.chunks.add(chunk); + if (this._backCompat) + ChunkGraph.setChunkGraphForChunk(chunk, this.chunkGraph); + if (name) { + this.namedChunks.set(name, chunk); + } + return chunk; } /** - * @param {string} path context path - * @param {function((WebpackError | null)=, (ResolvedContextFileSystemInfoEntry | "ignore" | null)=): void} callback callback function + * @deprecated + * @param {Module} module module to assign depth * @returns {void} */ - getContextTimestamp(path, callback) { - const cache = this._contextTimestamps.get(path); - if (cache !== undefined) { - if (cache === "ignore") return callback(null, "ignore"); - const resolved = getResolvedTimestamp(cache); - if (resolved !== undefined) return callback(null, resolved); - return this._resolveContextTimestamp(cache, callback); + assignDepth(module) { + const moduleGraph = this.moduleGraph; + + const queue = new Set([module]); + let depth; + + moduleGraph.setDepth(module, 0); + + /** + * @param {Module} module module for processing + * @returns {void} + */ + const processModule = module => { + if (!moduleGraph.setDepthIfLower(module, depth)) return; + queue.add(module); + }; + + for (module of queue) { + queue.delete(module); + depth = moduleGraph.getDepth(module) + 1; + + for (const connection of moduleGraph.getOutgoingConnections(module)) { + const refModule = connection.module; + if (refModule) { + processModule(refModule); + } + } } - this.contextTimestampQueue.add(path, (err, entry) => { - if (err) return callback(err); - const resolved = getResolvedTimestamp(entry); - if (resolved !== undefined) return callback(null, resolved); - this._resolveContextTimestamp(entry, callback); - }); } /** - * @param {string} path context path - * @param {function((WebpackError | null)=, (ContextFileSystemInfoEntry | "ignore" | null)=): void} callback callback function + * @param {Set} modules module to assign depth * @returns {void} */ - _getUnresolvedContextTimestamp(path, callback) { - const cache = this._contextTimestamps.get(path); - if (cache !== undefined) return callback(null, cache); - this.contextTimestampQueue.add(path, callback); + assignDepths(modules) { + const moduleGraph = this.moduleGraph; + + /** @type {Set} */ + const queue = new Set(modules); + queue.add(1); + let depth = 0; + + let i = 0; + for (const module of queue) { + i++; + if (typeof module === "number") { + depth = module; + if (queue.size === i) return; + queue.add(depth + 1); + } else { + moduleGraph.setDepth(module, depth); + for (const { module: refModule } of moduleGraph.getOutgoingConnections( + module + )) { + if (refModule) { + queue.add(refModule); + } + } + } + } } /** - * @param {string} path file path - * @param {function((WebpackError | null)=, string=): void} callback callback function - * @returns {void} + * @param {Dependency} dependency the dependency + * @param {RuntimeSpec} runtime the runtime + * @returns {(string[] | ReferencedExport)[]} referenced exports */ - getFileHash(path, callback) { - const cache = this._fileHashes.get(path); - if (cache !== undefined) return callback(null, cache); - this.fileHashQueue.add(path, callback); + getDependencyReferencedExports(dependency, runtime) { + const referencedExports = dependency.getReferencedExports( + this.moduleGraph, + runtime + ); + return this.hooks.dependencyReferencedExports.call( + referencedExports, + dependency, + runtime + ); } /** - * @param {string} path context path - * @param {function((WebpackError | null)=, string=): void} callback callback function + * + * @param {Module} module module relationship for removal + * @param {DependenciesBlockLike} block //TODO: good description * @returns {void} */ - getContextHash(path, callback) { - const cache = this._contextHashes.get(path); - if (cache !== undefined) { - const resolved = getResolvedHash(cache); - if (resolved !== undefined) return callback(null, resolved); - return this._resolveContextHash(cache, callback); + removeReasonsOfDependencyBlock(module, block) { + if (block.blocks) { + for (const b of block.blocks) { + this.removeReasonsOfDependencyBlock(module, b); + } } - this.contextHashQueue.add(path, (err, entry) => { - if (err) return callback(err); - const resolved = getResolvedHash(entry); - if (resolved !== undefined) return callback(null, resolved); - this._resolveContextHash(entry, callback); - }); - } - /** - * @param {string} path context path - * @param {function((WebpackError | null)=, ContextHash=): void} callback callback function - * @returns {void} - */ - _getUnresolvedContextHash(path, callback) { - const cache = this._contextHashes.get(path); - if (cache !== undefined) return callback(null, cache); - this.contextHashQueue.add(path, callback); + if (block.dependencies) { + for (const dep of block.dependencies) { + const originalModule = this.moduleGraph.getModule(dep); + if (originalModule) { + this.moduleGraph.removeConnection(dep); + + if (this.chunkGraph) { + for (const chunk of this.chunkGraph.getModuleChunks( + originalModule + )) { + this.patchChunksAfterReasonRemoval(originalModule, chunk); + } + } + } + } + } } /** - * @param {string} path context path - * @param {function((WebpackError | null)=, ResolvedContextTimestampAndHash=): void} callback callback function + * @param {Module} module module to patch tie + * @param {Chunk} chunk chunk to patch tie * @returns {void} */ - getContextTsh(path, callback) { - const cache = this._contextTshs.get(path); - if (cache !== undefined) { - const resolved = getResolvedTimestamp(cache); - if (resolved !== undefined) return callback(null, resolved); - return this._resolveContextTsh(cache, callback); + patchChunksAfterReasonRemoval(module, chunk) { + if (!module.hasReasons(this.moduleGraph, chunk.runtime)) { + this.removeReasonsOfDependencyBlock(module, module); + } + if (!module.hasReasonForChunk(chunk, this.moduleGraph, this.chunkGraph)) { + if (this.chunkGraph.isModuleInChunk(module, chunk)) { + this.chunkGraph.disconnectChunkAndModule(chunk, module); + this.removeChunkFromDependencies(module, chunk); + } } - this.contextTshQueue.add(path, (err, entry) => { - if (err) return callback(err); - const resolved = getResolvedTimestamp(entry); - if (resolved !== undefined) return callback(null, resolved); - this._resolveContextTsh(entry, callback); - }); } /** - * @param {string} path context path - * @param {function((WebpackError | null)=, ContextTimestampAndHash=): void} callback callback function + * + * @param {DependenciesBlock} block block tie for Chunk + * @param {Chunk} chunk chunk to remove from dep * @returns {void} */ - _getUnresolvedContextTsh(path, callback) { - const cache = this._contextTshs.get(path); - if (cache !== undefined) return callback(null, cache); - this.contextTshQueue.add(path, callback); - } + removeChunkFromDependencies(block, chunk) { + /** + * @param {Dependency} d dependency to (maybe) patch up + */ + const iteratorDependency = d => { + const depModule = this.moduleGraph.getModule(d); + if (!depModule) { + return; + } + this.patchChunksAfterReasonRemoval(depModule, chunk); + }; - _createBuildDependenciesResolvers() { - const resolveContext = createResolver({ - resolveToContext: true, - exportsFields: [], - fileSystem: this.fs - }); - const resolveCjs = createResolver({ - extensions: [".js", ".json", ".node"], - conditionNames: ["require", "node"], - exportsFields: ["exports"], - fileSystem: this.fs - }); - const resolveCjsAsChild = createResolver({ - extensions: [".js", ".json", ".node"], - conditionNames: ["require", "node"], - exportsFields: [], - fileSystem: this.fs - }); - const resolveEsm = createResolver({ - extensions: [".js", ".json", ".node"], - fullySpecified: true, - conditionNames: ["import", "node"], - exportsFields: ["exports"], - fileSystem: this.fs - }); - return { resolveContext, resolveEsm, resolveCjs, resolveCjsAsChild }; + const blocks = block.blocks; + for (let indexBlock = 0; indexBlock < blocks.length; indexBlock++) { + const asyncBlock = blocks[indexBlock]; + const chunkGroup = this.chunkGraph.getBlockChunkGroup(asyncBlock); + // Grab all chunks from the first Block's AsyncDepBlock + const chunks = chunkGroup.chunks; + // For each chunk in chunkGroup + for (let indexChunk = 0; indexChunk < chunks.length; indexChunk++) { + const iteratedChunk = chunks[indexChunk]; + chunkGroup.removeChunk(iteratedChunk); + // Recurse + this.removeChunkFromDependencies(block, iteratedChunk); + } + } + + if (block.dependencies) { + for (const dep of block.dependencies) iteratorDependency(dep); + } } - /** - * @param {string} context context directory - * @param {Iterable} deps dependencies - * @param {function((Error | null)=, ResolveBuildDependenciesResult=): void} callback callback function - * @returns {void} - */ - resolveBuildDependencies(context, deps, callback) { - const { resolveContext, resolveEsm, resolveCjs, resolveCjsAsChild } = - this._createBuildDependenciesResolvers(); - - /** @type {Set} */ - const files = new Set(); - /** @type {Set} */ - const fileSymlinks = new Set(); - /** @type {Set} */ - const directories = new Set(); - /** @type {Set} */ - const directorySymlinks = new Set(); - /** @type {Set} */ - const missing = new Set(); - /** @type {Set} */ - const resolveFiles = new Set(); - /** @type {Set} */ - const resolveDirectories = new Set(); - /** @type {Set} */ - const resolveMissing = new Set(); - /** @type {Map} */ - const resolveResults = new Map(); - const invalidResolveResults = new Set(); - const resolverContext = { - fileDependencies: resolveFiles, - contextDependencies: resolveDirectories, - missingDependencies: resolveMissing - }; - const expectedToString = expected => { - return expected ? ` (expected ${expected})` : ""; + assignRuntimeIds() { + const { chunkGraph } = this; + const processEntrypoint = ep => { + const runtime = ep.options.runtime || ep.name; + const chunk = ep.getRuntimeChunk(); + chunkGraph.setRuntimeId(runtime, chunk.id); }; - const jobToString = job => { - switch (job.type) { - case RBDT_RESOLVE_CJS: - return `resolve commonjs ${job.path}${expectedToString( - job.expected - )}`; - case RBDT_RESOLVE_ESM: - return `resolve esm ${job.path}${expectedToString(job.expected)}`; - case RBDT_RESOLVE_DIRECTORY: - return `resolve directory ${job.path}`; - case RBDT_RESOLVE_CJS_FILE: - return `resolve commonjs file ${job.path}${expectedToString( - job.expected - )}`; - case RBDT_RESOLVE_ESM_FILE: - return `resolve esm file ${job.path}${expectedToString( - job.expected - )}`; - case RBDT_DIRECTORY: - return `directory ${job.path}`; - case RBDT_FILE: - return `file ${job.path}`; - case RBDT_DIRECTORY_DEPENDENCIES: - return `directory dependencies ${job.path}`; - case RBDT_FILE_DEPENDENCIES: - return `file dependencies ${job.path}`; + for (const ep of this.entrypoints.values()) { + processEntrypoint(ep); + } + for (const ep of this.asyncEntrypoints) { + processEntrypoint(ep); + } + } + + sortItemsWithChunkIds() { + for (const chunkGroup of this.chunkGroups) { + chunkGroup.sortItems(); + } + + this.errors.sort(compareErrors); + this.warnings.sort(compareErrors); + this.children.sort(byNameOrHash); + } + + summarizeDependencies() { + for ( + let indexChildren = 0; + indexChildren < this.children.length; + indexChildren++ + ) { + const child = this.children[indexChildren]; + + this.fileDependencies.addAll(child.fileDependencies); + this.contextDependencies.addAll(child.contextDependencies); + this.missingDependencies.addAll(child.missingDependencies); + this.buildDependencies.addAll(child.buildDependencies); + } + + for (const module of this.modules) { + module.addCacheDependencies( + this.fileDependencies, + this.contextDependencies, + this.missingDependencies, + this.buildDependencies + ); + } + } + + createModuleHashes() { + let statModulesHashed = 0; + let statModulesFromCache = 0; + const { chunkGraph, runtimeTemplate, moduleMemCaches2 } = this; + const { hashFunction, hashDigest, hashDigestLength } = this.outputOptions; + for (const module of this.modules) { + const memCache = moduleMemCaches2 && moduleMemCaches2.get(module); + for (const runtime of chunkGraph.getModuleRuntimes(module)) { + if (memCache) { + const digest = memCache.get(`moduleHash-${getRuntimeKey(runtime)}`); + if (digest !== undefined) { + chunkGraph.setModuleHashes( + module, + runtime, + digest, + digest.substr(0, hashDigestLength) + ); + statModulesFromCache++; + continue; + } + } + statModulesHashed++; + const digest = this._createModuleHash( + module, + chunkGraph, + runtime, + hashFunction, + runtimeTemplate, + hashDigest, + hashDigestLength + ); + if (memCache) { + memCache.set(`moduleHash-${getRuntimeKey(runtime)}`, digest); + } } - return `unknown ${job.type} ${job.path}`; - }; - const pathToString = job => { - let result = ` at ${jobToString(job)}`; - job = job.issuer; - while (job !== undefined) { - result += `\n at ${jobToString(job)}`; - job = job.issuer; + } + this.logger.log( + `${statModulesHashed} modules hashed, ${statModulesFromCache} from cache (${ + Math.round( + (100 * (statModulesHashed + statModulesFromCache)) / this.modules.size + ) / 100 + } variants per module in average)` + ); + } + + _createModuleHash( + module, + chunkGraph, + runtime, + hashFunction, + runtimeTemplate, + hashDigest, + hashDigestLength + ) { + const moduleHash = createHash(hashFunction); + module.updateHash(moduleHash, { + chunkGraph, + runtime, + runtimeTemplate + }); + const moduleHashDigest = /** @type {string} */ ( + moduleHash.digest(hashDigest) + ); + chunkGraph.setModuleHashes( + module, + runtime, + moduleHashDigest, + moduleHashDigest.substr(0, hashDigestLength) + ); + return moduleHashDigest; + } + + createHash() { + this.logger.time("hashing: initialize hash"); + const chunkGraph = this.chunkGraph; + const runtimeTemplate = this.runtimeTemplate; + const outputOptions = this.outputOptions; + const hashFunction = outputOptions.hashFunction; + const hashDigest = outputOptions.hashDigest; + const hashDigestLength = outputOptions.hashDigestLength; + const hash = createHash(hashFunction); + if (outputOptions.hashSalt) { + hash.update(outputOptions.hashSalt); + } + this.logger.timeEnd("hashing: initialize hash"); + if (this.children.length > 0) { + this.logger.time("hashing: hash child compilations"); + for (const child of this.children) { + hash.update(child.hash); } - return result; - }; - processAsyncTree( - Array.from(deps, dep => ({ - type: RBDT_RESOLVE_CJS, - context, - path: dep, - expected: undefined, - issuer: undefined - })), - 20, - (job, push, callback) => { - const { type, context, path, expected } = job; - const resolveDirectory = path => { - const key = `d\n${context}\n${path}`; - if (resolveResults.has(key)) { - return callback(); - } - resolveResults.set(key, undefined); - resolveContext(context, path, resolverContext, (err, _, result) => { - if (err) { - if (expected === false) { - resolveResults.set(key, false); - return callback(); - } - invalidResolveResults.add(key); - err.message += `\nwhile resolving '${path}' in ${context} to a directory`; - return callback(err); - } - const resultPath = result.path; - resolveResults.set(key, resultPath); - push({ - type: RBDT_DIRECTORY, - context: undefined, - path: resultPath, - expected: undefined, - issuer: job - }); - callback(); - }); - }; - const resolveFile = (path, symbol, resolve) => { - const key = `${symbol}\n${context}\n${path}`; - if (resolveResults.has(key)) { - return callback(); - } - resolveResults.set(key, undefined); - resolve(context, path, resolverContext, (err, _, result) => { - if (typeof expected === "string") { - if (!err && result && result.path === expected) { - resolveResults.set(key, result.path); - } else { - invalidResolveResults.add(key); - this.logger.warn( - `Resolving '${path}' in ${context} for build dependencies doesn't lead to expected result '${expected}', but to '${ - err || (result && result.path) - }' instead. Resolving dependencies are ignored for this path.\n${pathToString( - job - )}` - ); - } - } else { - if (err) { - if (expected === false) { - resolveResults.set(key, false); - return callback(); - } - invalidResolveResults.add(key); - err.message += `\nwhile resolving '${path}' in ${context} as file\n${pathToString( - job - )}`; - return callback(err); - } - const resultPath = result.path; - resolveResults.set(key, resultPath); - push({ - type: RBDT_FILE, - context: undefined, - path: resultPath, - expected: undefined, - issuer: job - }); - } - callback(); - }); - }; - switch (type) { - case RBDT_RESOLVE_CJS: { - const isDirectory = /[\\/]$/.test(path); - if (isDirectory) { - resolveDirectory(path.slice(0, path.length - 1)); - } else { - resolveFile(path, "f", resolveCjs); - } - break; - } - case RBDT_RESOLVE_ESM: { - const isDirectory = /[\\/]$/.test(path); - if (isDirectory) { - resolveDirectory(path.slice(0, path.length - 1)); - } else { - resolveFile(path); - } - break; - } - case RBDT_RESOLVE_DIRECTORY: { - resolveDirectory(path); - break; - } - case RBDT_RESOLVE_CJS_FILE: { - resolveFile(path, "f", resolveCjs); - break; - } - case RBDT_RESOLVE_CJS_FILE_AS_CHILD: { - resolveFile(path, "c", resolveCjsAsChild); - break; + this.logger.timeEnd("hashing: hash child compilations"); + } + if (this.warnings.length > 0) { + this.logger.time("hashing: hash warnings"); + for (const warning of this.warnings) { + hash.update(`${warning.message}`); + } + this.logger.timeEnd("hashing: hash warnings"); + } + if (this.errors.length > 0) { + this.logger.time("hashing: hash errors"); + for (const error of this.errors) { + hash.update(`${error.message}`); + } + this.logger.timeEnd("hashing: hash errors"); + } + + this.logger.time("hashing: sort chunks"); + /* + * all non-runtime chunks need to be hashes first, + * since runtime chunk might use their hashes. + * runtime chunks need to be hashed in the correct order + * since they may depend on each other (for async entrypoints). + * So we put all non-runtime chunks first and hash them in any order. + * And order runtime chunks according to referenced between each other. + * Chunks need to be in deterministic order since we add hashes to full chunk + * during these hashing. + */ + /** @type {Chunk[]} */ + const unorderedRuntimeChunks = []; + /** @type {Chunk[]} */ + const otherChunks = []; + for (const c of this.chunks) { + if (c.hasRuntime()) { + unorderedRuntimeChunks.push(c); + } else { + otherChunks.push(c); + } + } + unorderedRuntimeChunks.sort(byId); + otherChunks.sort(byId); + + /** @typedef {{ chunk: Chunk, referencedBy: RuntimeChunkInfo[], remaining: number }} RuntimeChunkInfo */ + /** @type {Map} */ + const runtimeChunksMap = new Map(); + for (const chunk of unorderedRuntimeChunks) { + runtimeChunksMap.set(chunk, { + chunk, + referencedBy: [], + remaining: 0 + }); + } + let remaining = 0; + for (const info of runtimeChunksMap.values()) { + for (const other of new Set( + Array.from(info.chunk.getAllReferencedAsyncEntrypoints()).map( + e => e.chunks[e.chunks.length - 1] + ) + )) { + const otherInfo = runtimeChunksMap.get(other); + otherInfo.referencedBy.push(info); + info.remaining++; + remaining++; + } + } + /** @type {Chunk[]} */ + const runtimeChunks = []; + for (const info of runtimeChunksMap.values()) { + if (info.remaining === 0) { + runtimeChunks.push(info.chunk); + } + } + // If there are any references between chunks + // make sure to follow these chains + if (remaining > 0) { + const readyChunks = []; + for (const chunk of runtimeChunks) { + const hasFullHashModules = + chunkGraph.getNumberOfChunkFullHashModules(chunk) !== 0; + const info = runtimeChunksMap.get(chunk); + for (const otherInfo of info.referencedBy) { + if (hasFullHashModules) { + chunkGraph.upgradeDependentToFullHashModules(otherInfo.chunk); } - case RBDT_RESOLVE_ESM_FILE: { - resolveFile(path, "e", resolveEsm); - break; + remaining--; + if (--otherInfo.remaining === 0) { + readyChunks.push(otherInfo.chunk); } - case RBDT_FILE: { - if (files.has(path)) { - callback(); - break; + } + if (readyChunks.length > 0) { + // This ensures deterministic ordering, since referencedBy is non-deterministic + readyChunks.sort(byId); + for (const c of readyChunks) runtimeChunks.push(c); + readyChunks.length = 0; + } + } + } + // If there are still remaining references we have cycles and want to create a warning + if (remaining > 0) { + let circularRuntimeChunkInfo = []; + for (const info of runtimeChunksMap.values()) { + if (info.remaining !== 0) { + circularRuntimeChunkInfo.push(info); + } + } + circularRuntimeChunkInfo.sort(compareSelect(i => i.chunk, byId)); + const err = + new WebpackError(`Circular dependency between chunks with runtime (${Array.from( + circularRuntimeChunkInfo, + c => c.chunk.name || c.chunk.id + ).join(", ")}) +This prevents using hashes of each other and should be avoided.`); + err.chunk = circularRuntimeChunkInfo[0].chunk; + this.warnings.push(err); + for (const i of circularRuntimeChunkInfo) runtimeChunks.push(i.chunk); + } + this.logger.timeEnd("hashing: sort chunks"); + + const fullHashChunks = new Set(); + /** @type {{module: Module, hash: string, runtime: RuntimeSpec, runtimes: RuntimeSpec[]}[]} */ + const codeGenerationJobs = []; + /** @type {Map>} */ + const codeGenerationJobsMap = new Map(); + + const processChunk = chunk => { + // Last minute module hash generation for modules that depend on chunk hashes + this.logger.time("hashing: hash runtime modules"); + const runtime = chunk.runtime; + for (const module of chunkGraph.getChunkModulesIterable(chunk)) { + if (!chunkGraph.hasModuleHashes(module, runtime)) { + const hash = this._createModuleHash( + module, + chunkGraph, + runtime, + hashFunction, + runtimeTemplate, + hashDigest, + hashDigestLength + ); + let hashMap = codeGenerationJobsMap.get(hash); + if (hashMap) { + const moduleJob = hashMap.get(module); + if (moduleJob) { + moduleJob.runtimes.push(runtime); + continue; } - files.add(path); - this.fs.realpath(path, (err, _realPath) => { - if (err) return callback(err); - const realPath = /** @type {string} */ (_realPath); - if (realPath !== path) { - fileSymlinks.add(path); - resolveFiles.add(path); - if (files.has(realPath)) return callback(); - files.add(realPath); - } - push({ - type: RBDT_FILE_DEPENDENCIES, - context: undefined, - path: realPath, - expected: undefined, - issuer: job - }); - callback(); - }); - break; - } - case RBDT_DIRECTORY: { - if (directories.has(path)) { - callback(); - break; - } - directories.add(path); - this.fs.realpath(path, (err, _realPath) => { - if (err) return callback(err); - const realPath = /** @type {string} */ (_realPath); - if (realPath !== path) { - directorySymlinks.add(path); - resolveFiles.add(path); - if (directories.has(realPath)) return callback(); - directories.add(realPath); - } - push({ - type: RBDT_DIRECTORY_DEPENDENCIES, - context: undefined, - path: realPath, - expected: undefined, - issuer: job - }); - callback(); - }); - break; - } - case RBDT_FILE_DEPENDENCIES: { - // Check for known files without dependencies - if (/\.json5?$|\.yarn-integrity$|yarn\.lock$|\.ya?ml/.test(path)) { - process.nextTick(callback); - break; - } - // Check commonjs cache for the module - /** @type {NodeModule} */ - const module = require.cache[path]; - if (module && Array.isArray(module.children)) { - children: for (const child of module.children) { - let childPath = child.filename; - if (childPath) { - push({ - type: RBDT_FILE, - context: undefined, - path: childPath, - expected: undefined, - issuer: job - }); - const context = dirname(this.fs, path); - for (const modulePath of module.paths) { - if (childPath.startsWith(modulePath)) { - let subPath = childPath.slice(modulePath.length + 1); - const packageMatch = /^(@[^\\/]+[\\/])[^\\/]+/.exec( - subPath - ); - if (packageMatch) { - push({ - type: RBDT_FILE, - context: undefined, - path: - modulePath + - childPath[modulePath.length] + - packageMatch[0] + - childPath[modulePath.length] + - "package.json", - expected: false, - issuer: job - }); - } - let request = subPath.replace(/\\/g, "/"); - if (request.endsWith(".js")) - request = request.slice(0, -3); - push({ - type: RBDT_RESOLVE_CJS_FILE_AS_CHILD, - context, - path: request, - expected: child.filename, - issuer: job - }); - continue children; - } - } - let request = relative(this.fs, context, childPath); - if (request.endsWith(".js")) request = request.slice(0, -3); - request = request.replace(/\\/g, "/"); - if (!request.startsWith("../")) request = `./${request}`; - push({ - type: RBDT_RESOLVE_CJS_FILE, - context, - path: request, - expected: child.filename, - issuer: job - }); - } - } - } else if (supportsEsm && /\.m?js$/.test(path)) { - if (!this._warnAboutExperimentalEsmTracking) { - this.logger.log( - "Node.js doesn't offer a (nice) way to introspect the ESM dependency graph yet.\n" + - "Until a full solution is available webpack uses an experimental ESM tracking based on parsing.\n" + - "As best effort webpack parses the ESM files to guess dependencies. But this can lead to expensive and incorrect tracking." - ); - this._warnAboutExperimentalEsmTracking = true; - } - const lexer = __webpack_require__(54392); - lexer.init.then(() => { - this.fs.readFile(path, (err, content) => { - if (err) return callback(err); - try { - const context = dirname(this.fs, path); - const source = content.toString(); - const [imports] = lexer.parse(source); - for (const imp of imports) { - try { - let dependency; - if (imp.d === -1) { - // import ... from "..." - dependency = parseString( - source.substring(imp.s - 1, imp.e + 1) - ); - } else if (imp.d > -1) { - // import() - let expr = source.substring(imp.s, imp.e).trim(); - dependency = parseString(expr); - } else { - // e.g. import.meta - continue; - } - push({ - type: RBDT_RESOLVE_ESM_FILE, - context, - path: dependency, - expected: undefined, - issuer: job - }); - } catch (e) { - this.logger.warn( - `Parsing of ${path} for build dependencies failed at 'import(${source.substring( - imp.s, - imp.e - )})'.\n` + - "Build dependencies behind this expression are ignored and might cause incorrect cache invalidation." - ); - this.logger.debug(pathToString(job)); - this.logger.debug(e.stack); - } - } - } catch (e) { - this.logger.warn( - `Parsing of ${path} for build dependencies failed and all dependencies of this file are ignored, which might cause incorrect cache invalidation..` - ); - this.logger.debug(pathToString(job)); - this.logger.debug(e.stack); - } - process.nextTick(callback); - }); - }, callback); - break; - } else { - this.logger.log( - `Assuming ${path} has no dependencies as we were unable to assign it to any module system.` - ); - this.logger.debug(pathToString(job)); - } - process.nextTick(callback); - break; - } - case RBDT_DIRECTORY_DEPENDENCIES: { - const match = - /(^.+[\\/]node_modules[\\/](?:@[^\\/]+[\\/])?[^\\/]+)/.exec(path); - const packagePath = match ? match[1] : path; - const packageJson = join(this.fs, packagePath, "package.json"); - this.fs.readFile(packageJson, (err, content) => { - if (err) { - if (err.code === "ENOENT") { - resolveMissing.add(packageJson); - const parent = dirname(this.fs, packagePath); - if (parent !== packagePath) { - push({ - type: RBDT_DIRECTORY_DEPENDENCIES, - context: undefined, - path: parent, - expected: undefined, - issuer: job - }); - } - callback(); - return; - } - return callback(err); - } - resolveFiles.add(packageJson); - let packageData; - try { - packageData = JSON.parse(content.toString("utf-8")); - } catch (e) { - return callback(e); - } - const depsObject = packageData.dependencies; - const optionalDepsObject = packageData.optionalDependencies; - const allDeps = new Set(); - const optionalDeps = new Set(); - if (typeof depsObject === "object" && depsObject) { - for (const dep of Object.keys(depsObject)) { - allDeps.add(dep); - } - } - if ( - typeof optionalDepsObject === "object" && - optionalDepsObject - ) { - for (const dep of Object.keys(optionalDepsObject)) { - allDeps.add(dep); - optionalDeps.add(dep); - } - } - for (const dep of allDeps) { - push({ - type: RBDT_RESOLVE_DIRECTORY, - context: packagePath, - path: dep, - expected: !optionalDeps.has(dep), - issuer: job - }); - } - callback(); - }); - break; + } else { + hashMap = new Map(); + codeGenerationJobsMap.set(hash, hashMap); } + const job = { + module, + hash, + runtime, + runtimes: [runtime] + }; + hashMap.set(module, job); + codeGenerationJobs.push(job); } - }, - err => { - if (err) return callback(err); - for (const l of fileSymlinks) files.delete(l); - for (const l of directorySymlinks) directories.delete(l); - for (const k of invalidResolveResults) resolveResults.delete(k); - callback(null, { - files, - directories, - missing, - resolveResults, - resolveDependencies: { - files: resolveFiles, - directories: resolveDirectories, - missing: resolveMissing - } + } + this.logger.timeAggregate("hashing: hash runtime modules"); + this.logger.time("hashing: hash chunks"); + const chunkHash = createHash(hashFunction); + try { + if (outputOptions.hashSalt) { + chunkHash.update(outputOptions.hashSalt); + } + chunk.updateHash(chunkHash, chunkGraph); + this.hooks.chunkHash.call(chunk, chunkHash, { + chunkGraph, + codeGenerationResults: this.codeGenerationResults, + moduleGraph: this.moduleGraph, + runtimeTemplate: this.runtimeTemplate + }); + const chunkHashDigest = /** @type {string} */ ( + chunkHash.digest(hashDigest) + ); + hash.update(chunkHashDigest); + chunk.hash = chunkHashDigest; + chunk.renderedHash = chunk.hash.substr(0, hashDigestLength); + const fullHashModules = + chunkGraph.getChunkFullHashModulesIterable(chunk); + if (fullHashModules) { + fullHashChunks.add(chunk); + } else { + this.hooks.contentHash.call(chunk); + } + } catch (err) { + this.errors.push(new ChunkRenderError(chunk, "", err)); + } + this.logger.timeAggregate("hashing: hash chunks"); + }; + otherChunks.forEach(processChunk); + for (const chunk of runtimeChunks) processChunk(chunk); + + this.logger.timeAggregateEnd("hashing: hash runtime modules"); + this.logger.timeAggregateEnd("hashing: hash chunks"); + this.logger.time("hashing: hash digest"); + this.hooks.fullHash.call(hash); + this.fullHash = /** @type {string} */ (hash.digest(hashDigest)); + this.hash = this.fullHash.substr(0, hashDigestLength); + this.logger.timeEnd("hashing: hash digest"); + + this.logger.time("hashing: process full hash modules"); + for (const chunk of fullHashChunks) { + for (const module of chunkGraph.getChunkFullHashModulesIterable(chunk)) { + const moduleHash = createHash(hashFunction); + module.updateHash(moduleHash, { + chunkGraph, + runtime: chunk.runtime, + runtimeTemplate }); + const moduleHashDigest = /** @type {string} */ ( + moduleHash.digest(hashDigest) + ); + const oldHash = chunkGraph.getModuleHash(module, chunk.runtime); + chunkGraph.setModuleHashes( + module, + chunk.runtime, + moduleHashDigest, + moduleHashDigest.substr(0, hashDigestLength) + ); + codeGenerationJobsMap.get(oldHash).get(module).hash = moduleHashDigest; } - ); + const chunkHash = createHash(hashFunction); + chunkHash.update(chunk.hash); + chunkHash.update(this.hash); + const chunkHashDigest = /** @type {string} */ ( + chunkHash.digest(hashDigest) + ); + chunk.hash = chunkHashDigest; + chunk.renderedHash = chunk.hash.substr(0, hashDigestLength); + this.hooks.contentHash.call(chunk); + } + this.logger.timeEnd("hashing: process full hash modules"); + return codeGenerationJobs; } /** - * @param {Map} resolveResults results from resolving - * @param {function((Error | null)=, boolean=): void} callback callback with true when resolveResults resolve the same way + * @param {string} file file name + * @param {Source} source asset source + * @param {AssetInfo} assetInfo extra asset information * @returns {void} */ - checkResolveResultsValid(resolveResults, callback) { - const { resolveCjs, resolveCjsAsChild, resolveEsm, resolveContext } = - this._createBuildDependenciesResolvers(); - asyncLib.eachLimit( - resolveResults, - 20, - ([key, expectedResult], callback) => { - const [type, context, path] = key.split("\n"); - switch (type) { - case "d": - resolveContext(context, path, {}, (err, _, result) => { - if (expectedResult === false) - return callback(err ? undefined : INVALID); - if (err) return callback(err); - const resultPath = result.path; - if (resultPath !== expectedResult) return callback(INVALID); - callback(); - }); - break; - case "f": - resolveCjs(context, path, {}, (err, _, result) => { - if (expectedResult === false) - return callback(err ? undefined : INVALID); - if (err) return callback(err); - const resultPath = result.path; - if (resultPath !== expectedResult) return callback(INVALID); - callback(); - }); - break; - case "c": - resolveCjsAsChild(context, path, {}, (err, _, result) => { - if (expectedResult === false) - return callback(err ? undefined : INVALID); - if (err) return callback(err); - const resultPath = result.path; - if (resultPath !== expectedResult) return callback(INVALID); - callback(); - }); - break; - case "e": - resolveEsm(context, path, {}, (err, _, result) => { - if (expectedResult === false) - return callback(err ? undefined : INVALID); - if (err) return callback(err); - const resultPath = result.path; - if (resultPath !== expectedResult) return callback(INVALID); - callback(); - }); - break; - default: - callback(new Error("Unexpected type in resolve result key")); - break; - } - }, - /** - * @param {Error | typeof INVALID=} err error or invalid flag - * @returns {void} - */ - err => { - if (err === INVALID) { - return callback(null, false); + emitAsset(file, source, assetInfo = {}) { + if (this.assets[file]) { + if (!isSourceEqual(this.assets[file], source)) { + this.errors.push( + new WebpackError( + `Conflict: Multiple assets emit different content to the same filename ${file}` + ) + ); + this.assets[file] = source; + this._setAssetInfo(file, assetInfo); + return; + } + const oldInfo = this.assetsInfo.get(file); + const newInfo = Object.assign({}, oldInfo, assetInfo); + this._setAssetInfo(file, newInfo, oldInfo); + return; + } + this.assets[file] = source; + this._setAssetInfo(file, assetInfo, undefined); + } + + _setAssetInfo(file, newInfo, oldInfo = this.assetsInfo.get(file)) { + if (newInfo === undefined) { + this.assetsInfo.delete(file); + } else { + this.assetsInfo.set(file, newInfo); + } + const oldRelated = oldInfo && oldInfo.related; + const newRelated = newInfo && newInfo.related; + if (oldRelated) { + for (const key of Object.keys(oldRelated)) { + const remove = name => { + const relatedIn = this._assetsRelatedIn.get(name); + if (relatedIn === undefined) return; + const entry = relatedIn.get(key); + if (entry === undefined) return; + entry.delete(file); + if (entry.size !== 0) return; + relatedIn.delete(key); + if (relatedIn.size === 0) this._assetsRelatedIn.delete(name); + }; + const entry = oldRelated[key]; + if (Array.isArray(entry)) { + entry.forEach(remove); + } else if (entry) { + remove(entry); } - if (err) { - return callback(err); + } + } + if (newRelated) { + for (const key of Object.keys(newRelated)) { + const add = name => { + let relatedIn = this._assetsRelatedIn.get(name); + if (relatedIn === undefined) { + this._assetsRelatedIn.set(name, (relatedIn = new Map())); + } + let entry = relatedIn.get(key); + if (entry === undefined) { + relatedIn.set(key, (entry = new Set())); + } + entry.add(file); + }; + const entry = newRelated[key]; + if (Array.isArray(entry)) { + entry.forEach(add); + } else if (entry) { + add(entry); } - return callback(null, true); } - ); + } } /** - * - * @param {number} startTime when processing the files has started - * @param {Iterable} files all files - * @param {Iterable} directories all directories - * @param {Iterable} missing all missing files or directories - * @param {Object} options options object (for future extensions) - * @param {boolean=} options.hash should use hash to snapshot - * @param {boolean=} options.timestamp should use timestamp to snapshot - * @param {function((WebpackError | null)=, (Snapshot | null)=): void} callback callback function - * @returns {void} + * @param {string} file file name + * @param {Source | function(Source): Source} newSourceOrFunction new asset source or function converting old to new + * @param {AssetInfo | function(AssetInfo | undefined): AssetInfo} assetInfoUpdateOrFunction new asset info or function converting old to new */ - createSnapshot(startTime, files, directories, missing, options, callback) { - /** @type {Map} */ - const fileTimestamps = new Map(); - /** @type {Map} */ - const fileHashes = new Map(); - /** @type {Map} */ - const fileTshs = new Map(); - /** @type {Map} */ - const contextTimestamps = new Map(); - /** @type {Map} */ - const contextHashes = new Map(); - /** @type {Map} */ - const contextTshs = new Map(); - /** @type {Map} */ - const missingExistence = new Map(); - /** @type {Map} */ - const managedItemInfo = new Map(); - /** @type {Set} */ - const managedFiles = new Set(); - /** @type {Set} */ - const managedContexts = new Set(); - /** @type {Set} */ - const managedMissing = new Set(); - /** @type {Set} */ - const children = new Set(); - - const snapshot = new Snapshot(); - if (startTime) snapshot.setStartTime(startTime); + updateAsset( + file, + newSourceOrFunction, + assetInfoUpdateOrFunction = undefined + ) { + if (!this.assets[file]) { + throw new Error( + `Called Compilation.updateAsset for not existing filename ${file}` + ); + } + if (typeof newSourceOrFunction === "function") { + this.assets[file] = newSourceOrFunction(this.assets[file]); + } else { + this.assets[file] = newSourceOrFunction; + } + if (assetInfoUpdateOrFunction !== undefined) { + const oldInfo = this.assetsInfo.get(file) || EMPTY_ASSET_INFO; + if (typeof assetInfoUpdateOrFunction === "function") { + this._setAssetInfo(file, assetInfoUpdateOrFunction(oldInfo), oldInfo); + } else { + this._setAssetInfo( + file, + cachedCleverMerge(oldInfo, assetInfoUpdateOrFunction), + oldInfo + ); + } + } + } - /** @type {Set} */ - const managedItems = new Set(); - - /** 1 = timestamp, 2 = hash, 3 = timestamp + hash */ - const mode = options && options.hash ? (options.timestamp ? 3 : 2) : 1; - - let jobs = 1; - const jobDone = () => { - if (--jobs === 0) { - if (fileTimestamps.size !== 0) { - snapshot.setFileTimestamps(fileTimestamps); - } - if (fileHashes.size !== 0) { - snapshot.setFileHashes(fileHashes); - } - if (fileTshs.size !== 0) { - snapshot.setFileTshs(fileTshs); - } - if (contextTimestamps.size !== 0) { - snapshot.setContextTimestamps(contextTimestamps); - } - if (contextHashes.size !== 0) { - snapshot.setContextHashes(contextHashes); - } - if (contextTshs.size !== 0) { - snapshot.setContextTshs(contextTshs); - } - if (missingExistence.size !== 0) { - snapshot.setMissingExistence(missingExistence); - } - if (managedItemInfo.size !== 0) { - snapshot.setManagedItemInfo(managedItemInfo); - } - this._managedFilesOptimization.optimize(snapshot, managedFiles); - if (managedFiles.size !== 0) { - snapshot.setManagedFiles(managedFiles); - } - this._managedContextsOptimization.optimize(snapshot, managedContexts); - if (managedContexts.size !== 0) { - snapshot.setManagedContexts(managedContexts); - } - this._managedMissingOptimization.optimize(snapshot, managedMissing); - if (managedMissing.size !== 0) { - snapshot.setManagedMissing(managedMissing); - } - if (children.size !== 0) { - snapshot.setChildren(children); - } - this._snapshotCache.set(snapshot, true); - this._statCreatedSnapshots++; - - callback(null, snapshot); - } - }; - const jobError = () => { - if (jobs > 0) { - // large negative number instead of NaN or something else to keep jobs to stay a SMI (v8) - jobs = -100000000; - callback(null, null); + renameAsset(file, newFile) { + const source = this.assets[file]; + if (!source) { + throw new Error( + `Called Compilation.renameAsset for not existing filename ${file}` + ); + } + if (this.assets[newFile]) { + if (!isSourceEqual(this.assets[file], source)) { + this.errors.push( + new WebpackError( + `Conflict: Called Compilation.renameAsset for already existing filename ${newFile} with different content` + ) + ); } - }; - const checkManaged = (path, managedSet) => { - for (const immutablePath of this.immutablePathsRegExps) { - if (immutablePath.test(path)) { - managedSet.add(path); - return true; + } + const assetInfo = this.assetsInfo.get(file); + // Update related in all other assets + const relatedInInfo = this._assetsRelatedIn.get(file); + if (relatedInInfo) { + for (const [key, assets] of relatedInInfo) { + for (const name of assets) { + const info = this.assetsInfo.get(name); + if (!info) continue; + const related = info.related; + if (!related) continue; + const entry = related[key]; + let newEntry; + if (Array.isArray(entry)) { + newEntry = entry.map(x => (x === file ? newFile : x)); + } else if (entry === file) { + newEntry = newFile; + } else continue; + this.assetsInfo.set(name, { + ...info, + related: { + ...related, + [key]: newEntry + } + }); } } - for (const immutablePath of this.immutablePathsWithSlash) { - if (path.startsWith(immutablePath)) { - managedSet.add(path); - return true; + } + this._setAssetInfo(file, undefined, assetInfo); + this._setAssetInfo(newFile, assetInfo); + delete this.assets[file]; + this.assets[newFile] = source; + for (const chunk of this.chunks) { + { + const size = chunk.files.size; + chunk.files.delete(file); + if (size !== chunk.files.size) { + chunk.files.add(newFile); } } - for (const managedPath of this.managedPathsRegExps) { - const match = managedPath.exec(path); - if (match) { - const managedItem = getManagedItem(match[1], path); - if (managedItem) { - managedItems.add(managedItem); - managedSet.add(path); - return true; - } + { + const size = chunk.auxiliaryFiles.size; + chunk.auxiliaryFiles.delete(file); + if (size !== chunk.auxiliaryFiles.size) { + chunk.auxiliaryFiles.add(newFile); } } - for (const managedPath of this.managedPathsWithSlash) { - if (path.startsWith(managedPath)) { - const managedItem = getManagedItem(managedPath, path); - if (managedItem) { - managedItems.add(managedItem); - managedSet.add(path); - return true; + } + } + + /** + * @param {string} file file name + */ + deleteAsset(file) { + if (!this.assets[file]) { + return; + } + delete this.assets[file]; + const assetInfo = this.assetsInfo.get(file); + this._setAssetInfo(file, undefined, assetInfo); + const related = assetInfo && assetInfo.related; + if (related) { + for (const key of Object.keys(related)) { + const checkUsedAndDelete = file => { + if (!this._assetsRelatedIn.has(file)) { + this.deleteAsset(file); } + }; + const items = related[key]; + if (Array.isArray(items)) { + items.forEach(checkUsedAndDelete); + } else if (items) { + checkUsedAndDelete(items); } } - return false; - }; - const captureNonManaged = (items, managedSet) => { - const capturedItems = new Set(); - for (const path of items) { - if (!checkManaged(path, managedSet)) capturedItems.add(path); + } + // TODO If this becomes a performance problem + // store a reverse mapping from asset to chunk + for (const chunk of this.chunks) { + chunk.files.delete(file); + chunk.auxiliaryFiles.delete(file); + } + } + + getAssets() { + /** @type {Readonly[]} */ + const array = []; + for (const assetName of Object.keys(this.assets)) { + if (Object.prototype.hasOwnProperty.call(this.assets, assetName)) { + array.push({ + name: assetName, + source: this.assets[assetName], + info: this.assetsInfo.get(assetName) || EMPTY_ASSET_INFO + }); } - return capturedItems; + } + return array; + } + + /** + * @param {string} name the name of the asset + * @returns {Readonly | undefined} the asset or undefined when not found + */ + getAsset(name) { + if (!Object.prototype.hasOwnProperty.call(this.assets, name)) + return undefined; + return { + name, + source: this.assets[name], + info: this.assetsInfo.get(name) || EMPTY_ASSET_INFO }; - const processCapturedFiles = capturedFiles => { - switch (mode) { - case 3: - this._fileTshsOptimization.optimize(snapshot, capturedFiles); - for (const path of capturedFiles) { - const cache = this._fileTshs.get(path); - if (cache !== undefined) { - fileTshs.set(path, cache); - } else { - jobs++; - this._getFileTimestampAndHash(path, (err, entry) => { - if (err) { - if (this.logger) { - this.logger.debug( - `Error snapshotting file timestamp hash combination of ${path}: ${err.stack}` - ); - } - jobError(); - } else { - fileTshs.set(path, entry); - jobDone(); - } - }); - } + } + + clearAssets() { + for (const chunk of this.chunks) { + chunk.files.clear(); + chunk.auxiliaryFiles.clear(); + } + } + + createModuleAssets() { + const { chunkGraph } = this; + for (const module of this.modules) { + if (module.buildInfo.assets) { + const assetsInfo = module.buildInfo.assetsInfo; + for (const assetName of Object.keys(module.buildInfo.assets)) { + const fileName = this.getPath(assetName, { + chunkGraph: this.chunkGraph, + module + }); + for (const chunk of chunkGraph.getModuleChunksIterable(module)) { + chunk.auxiliaryFiles.add(fileName); } - break; - case 2: - this._fileHashesOptimization.optimize(snapshot, capturedFiles); - for (const path of capturedFiles) { - const cache = this._fileHashes.get(path); - if (cache !== undefined) { - fileHashes.set(path, cache); - } else { - jobs++; - this.fileHashQueue.add(path, (err, entry) => { - if (err) { - if (this.logger) { - this.logger.debug( - `Error snapshotting file hash of ${path}: ${err.stack}` - ); - } - jobError(); + this.emitAsset( + fileName, + module.buildInfo.assets[assetName], + assetsInfo ? assetsInfo.get(assetName) : undefined + ); + this.hooks.moduleAsset.call(module, fileName); + } + } + } + } + + /** + * @param {RenderManifestOptions} options options object + * @returns {RenderManifestEntry[]} manifest entries + */ + getRenderManifest(options) { + return this.hooks.renderManifest.call([], options); + } + + /** + * @param {Callback} callback signals when the call finishes + * @returns {void} + */ + createChunkAssets(callback) { + const outputOptions = this.outputOptions; + const cachedSourceMap = new WeakMap(); + /** @type {Map} */ + const alreadyWrittenFiles = new Map(); + + asyncLib.forEachLimit( + this.chunks, + 15, + (chunk, callback) => { + /** @type {RenderManifestEntry[]} */ + let manifest; + try { + manifest = this.getRenderManifest({ + chunk, + hash: this.hash, + fullHash: this.fullHash, + outputOptions, + codeGenerationResults: this.codeGenerationResults, + moduleTemplates: this.moduleTemplates, + dependencyTemplates: this.dependencyTemplates, + chunkGraph: this.chunkGraph, + moduleGraph: this.moduleGraph, + runtimeTemplate: this.runtimeTemplate + }); + } catch (err) { + this.errors.push(new ChunkRenderError(chunk, "", err)); + return callback(); + } + asyncLib.forEach( + manifest, + (fileManifest, callback) => { + const ident = fileManifest.identifier; + const usedHash = fileManifest.hash; + + const assetCacheItem = this._assetsCache.getItemCache( + ident, + usedHash + ); + + assetCacheItem.get((err, sourceFromCache) => { + /** @type {string | function(PathData, AssetInfo=): string} */ + let filenameTemplate; + /** @type {string} */ + let file; + /** @type {AssetInfo} */ + let assetInfo; + + let inTry = true; + const errorAndCallback = err => { + const filename = + file || + (typeof file === "string" + ? file + : typeof filenameTemplate === "string" + ? filenameTemplate + : ""); + + this.errors.push(new ChunkRenderError(chunk, filename, err)); + inTry = false; + return callback(); + }; + + try { + if ("filename" in fileManifest) { + file = fileManifest.filename; + assetInfo = fileManifest.info; } else { - fileHashes.set(path, entry); - jobDone(); + filenameTemplate = fileManifest.filenameTemplate; + const pathAndInfo = this.getPathWithInfo( + filenameTemplate, + fileManifest.pathOptions + ); + file = pathAndInfo.path; + assetInfo = fileManifest.info + ? { + ...pathAndInfo.info, + ...fileManifest.info + } + : pathAndInfo.info; } - }); - } - } - break; - case 1: - this._fileTimestampsOptimization.optimize(snapshot, capturedFiles); - for (const path of capturedFiles) { - const cache = this._fileTimestamps.get(path); - if (cache !== undefined) { - if (cache !== "ignore") { - fileTimestamps.set(path, cache); - } - } else { - jobs++; - this.fileTimestampQueue.add(path, (err, entry) => { + if (err) { - if (this.logger) { - this.logger.debug( - `Error snapshotting file timestamp of ${path}: ${err.stack}` + return errorAndCallback(err); + } + + let source = sourceFromCache; + + // check if the same filename was already written by another chunk + const alreadyWritten = alreadyWrittenFiles.get(file); + if (alreadyWritten !== undefined) { + if (alreadyWritten.hash !== usedHash) { + inTry = false; + return callback( + new WebpackError( + `Conflict: Multiple chunks emit assets to the same filename ${file}` + + ` (chunks ${alreadyWritten.chunk.id} and ${chunk.id})` + ) ); + } else { + source = alreadyWritten.source; } - jobError(); + } else if (!source) { + // render the asset + source = fileManifest.render(); + + // Ensure that source is a cached source to avoid additional cost because of repeated access + if (!(source instanceof CachedSource)) { + const cacheEntry = cachedSourceMap.get(source); + if (cacheEntry) { + source = cacheEntry; + } else { + const cachedSource = new CachedSource(source); + cachedSourceMap.set(source, cachedSource); + source = cachedSource; + } + } + } + this.emitAsset(file, source, assetInfo); + if (fileManifest.auxiliary) { + chunk.auxiliaryFiles.add(file); } else { - fileTimestamps.set(path, entry); - jobDone(); + chunk.files.add(file); } - }); - } - } - break; - } - }; - if (files) { - processCapturedFiles(captureNonManaged(files, managedFiles)); - } - const processCapturedDirectories = capturedDirectories => { - switch (mode) { - case 3: - this._contextTshsOptimization.optimize(snapshot, capturedDirectories); - for (const path of capturedDirectories) { - const cache = this._contextTshs.get(path); - /** @type {ResolvedContextTimestampAndHash} */ - let resolved; - if ( - cache !== undefined && - (resolved = getResolvedTimestamp(cache)) !== undefined - ) { - contextTshs.set(path, resolved); - } else { - jobs++; - /** - * @param {Error=} err error - * @param {ResolvedContextTimestampAndHash=} entry entry - * @returns {void} - */ - const callback = (err, entry) => { - if (err) { - if (this.logger) { - this.logger.debug( - `Error snapshotting context timestamp hash combination of ${path}: ${err.stack}` - ); - } - jobError(); + this.hooks.chunkAsset.call(chunk, file); + alreadyWrittenFiles.set(file, { + hash: usedHash, + source, + chunk + }); + if (source !== sourceFromCache) { + assetCacheItem.store(source, err => { + if (err) return errorAndCallback(err); + inTry = false; + return callback(); + }); } else { - contextTshs.set(path, entry); - jobDone(); + inTry = false; + callback(); } - }; - if (cache !== undefined) { - this._resolveContextTsh(cache, callback); - } else { - this.getContextTsh(path, callback); + } catch (err) { + if (!inTry) throw err; + errorAndCallback(err); } - } - } - break; - case 2: - this._contextHashesOptimization.optimize( - snapshot, - capturedDirectories - ); - for (const path of capturedDirectories) { - const cache = this._contextHashes.get(path); - let resolved; - if ( - cache !== undefined && - (resolved = getResolvedHash(cache)) !== undefined - ) { - contextHashes.set(path, resolved); - } else { - jobs++; - const callback = (err, entry) => { - if (err) { - if (this.logger) { - this.logger.debug( - `Error snapshotting context hash of ${path}: ${err.stack}` - ); - } - jobError(); - } else { - contextHashes.set(path, entry); - jobDone(); - } - }; - if (cache !== undefined) { - this._resolveContextHash(cache, callback); - } else { - this.getContextHash(path, callback); - } - } - } - break; - case 1: - this._contextTimestampsOptimization.optimize( - snapshot, - capturedDirectories - ); - for (const path of capturedDirectories) { - const cache = this._contextTimestamps.get(path); - if (cache === "ignore") continue; - let resolved; - if ( - cache !== undefined && - (resolved = getResolvedTimestamp(cache)) !== undefined - ) { - contextTimestamps.set(path, resolved); - } else { - jobs++; - /** - * @param {Error=} err error - * @param {ResolvedContextFileSystemInfoEntry=} entry entry - * @returns {void} - */ - const callback = (err, entry) => { - if (err) { - if (this.logger) { - this.logger.debug( - `Error snapshotting context timestamp of ${path}: ${err.stack}` - ); - } - jobError(); - } else { - contextTimestamps.set(path, entry); - jobDone(); - } - }; - if (cache !== undefined) { - this._resolveContextTimestamp(cache, callback); - } else { - this.getContextTimestamp(path, callback); - } - } - } - break; - } - }; - if (directories) { - processCapturedDirectories( - captureNonManaged(directories, managedContexts) - ); - } - const processCapturedMissing = capturedMissing => { - this._missingExistenceOptimization.optimize(snapshot, capturedMissing); - for (const path of capturedMissing) { - const cache = this._fileTimestamps.get(path); - if (cache !== undefined) { - if (cache !== "ignore") { - missingExistence.set(path, Boolean(cache)); - } - } else { - jobs++; - this.fileTimestampQueue.add(path, (err, entry) => { - if (err) { - if (this.logger) { - this.logger.debug( - `Error snapshotting missing timestamp of ${path}: ${err.stack}` - ); - } - jobError(); - } else { - missingExistence.set(path, Boolean(entry)); - jobDone(); - } - }); - } - } - }; - if (missing) { - processCapturedMissing(captureNonManaged(missing, managedMissing)); - } - this._managedItemInfoOptimization.optimize(snapshot, managedItems); - for (const path of managedItems) { - const cache = this._managedItems.get(path); - if (cache !== undefined) { - if (!cache.startsWith("*")) { - managedFiles.add(join(this.fs, path, "package.json")); - } else if (cache === "*nested") { - managedMissing.add(join(this.fs, path, "package.json")); - } - managedItemInfo.set(path, cache); - } else { - jobs++; - this.managedItemQueue.add(path, (err, entry) => { - if (err) { - if (this.logger) { - this.logger.debug( - `Error snapshotting managed item ${path}: ${err.stack}` - ); - } - jobError(); - } else if (entry) { - if (!entry.startsWith("*")) { - managedFiles.add(join(this.fs, path, "package.json")); - } else if (cache === "*nested") { - managedMissing.add(join(this.fs, path, "package.json")); - } - managedItemInfo.set(path, entry); - jobDone(); - } else { - // Fallback to normal snapshotting - const process = (set, fn) => { - if (set.size === 0) return; - const captured = new Set(); - for (const file of set) { - if (file.startsWith(path)) captured.add(file); - } - if (captured.size > 0) fn(captured); - }; - process(managedFiles, processCapturedFiles); - process(managedContexts, processCapturedDirectories); - process(managedMissing, processCapturedMissing); - jobDone(); - } - }); - } - } - jobDone(); + }); + }, + callback + ); + }, + callback + ); } /** - * @param {Snapshot} snapshot1 a snapshot - * @param {Snapshot} snapshot2 a snapshot - * @returns {Snapshot} merged snapshot + * @param {string | function(PathData, AssetInfo=): string} filename used to get asset path with hash + * @param {PathData} data context data + * @returns {string} interpolated path */ - mergeSnapshots(snapshot1, snapshot2) { - const snapshot = new Snapshot(); - if (snapshot1.hasStartTime() && snapshot2.hasStartTime()) - snapshot.setStartTime(Math.min(snapshot1.startTime, snapshot2.startTime)); - else if (snapshot2.hasStartTime()) snapshot.startTime = snapshot2.startTime; - else if (snapshot1.hasStartTime()) snapshot.startTime = snapshot1.startTime; - if (snapshot1.hasFileTimestamps() || snapshot2.hasFileTimestamps()) { - snapshot.setFileTimestamps( - mergeMaps(snapshot1.fileTimestamps, snapshot2.fileTimestamps) - ); - } - if (snapshot1.hasFileHashes() || snapshot2.hasFileHashes()) { - snapshot.setFileHashes( - mergeMaps(snapshot1.fileHashes, snapshot2.fileHashes) - ); - } - if (snapshot1.hasFileTshs() || snapshot2.hasFileTshs()) { - snapshot.setFileTshs(mergeMaps(snapshot1.fileTshs, snapshot2.fileTshs)); - } - if (snapshot1.hasContextTimestamps() || snapshot2.hasContextTimestamps()) { - snapshot.setContextTimestamps( - mergeMaps(snapshot1.contextTimestamps, snapshot2.contextTimestamps) - ); - } - if (snapshot1.hasContextHashes() || snapshot2.hasContextHashes()) { - snapshot.setContextHashes( - mergeMaps(snapshot1.contextHashes, snapshot2.contextHashes) - ); - } - if (snapshot1.hasContextTshs() || snapshot2.hasContextTshs()) { - snapshot.setContextTshs( - mergeMaps(snapshot1.contextTshs, snapshot2.contextTshs) - ); - } - if (snapshot1.hasMissingExistence() || snapshot2.hasMissingExistence()) { - snapshot.setMissingExistence( - mergeMaps(snapshot1.missingExistence, snapshot2.missingExistence) - ); - } - if (snapshot1.hasManagedItemInfo() || snapshot2.hasManagedItemInfo()) { - snapshot.setManagedItemInfo( - mergeMaps(snapshot1.managedItemInfo, snapshot2.managedItemInfo) - ); - } - if (snapshot1.hasManagedFiles() || snapshot2.hasManagedFiles()) { - snapshot.setManagedFiles( - mergeSets(snapshot1.managedFiles, snapshot2.managedFiles) - ); - } - if (snapshot1.hasManagedContexts() || snapshot2.hasManagedContexts()) { - snapshot.setManagedContexts( - mergeSets(snapshot1.managedContexts, snapshot2.managedContexts) - ); - } - if (snapshot1.hasManagedMissing() || snapshot2.hasManagedMissing()) { - snapshot.setManagedMissing( - mergeSets(snapshot1.managedMissing, snapshot2.managedMissing) - ); - } - if (snapshot1.hasChildren() || snapshot2.hasChildren()) { - snapshot.setChildren(mergeSets(snapshot1.children, snapshot2.children)); - } - if ( - this._snapshotCache.get(snapshot1) === true && - this._snapshotCache.get(snapshot2) === true - ) { - this._snapshotCache.set(snapshot, true); + getPath(filename, data = {}) { + if (!data.hash) { + data = { + hash: this.hash, + ...data + }; } - return snapshot; + return this.getAssetPath(filename, data); } /** - * @param {Snapshot} snapshot the snapshot made - * @param {function((WebpackError | null)=, boolean=): void} callback callback function - * @returns {void} + * @param {string | function(PathData, AssetInfo=): string} filename used to get asset path with hash + * @param {PathData} data context data + * @returns {{ path: string, info: AssetInfo }} interpolated path and asset info */ - checkSnapshotValid(snapshot, callback) { - const cachedResult = this._snapshotCache.get(snapshot); - if (cachedResult !== undefined) { - this._statTestedSnapshotsCached++; - if (typeof cachedResult === "boolean") { - callback(null, cachedResult); - } else { - cachedResult.push(callback); - } - return; + getPathWithInfo(filename, data = {}) { + if (!data.hash) { + data = { + hash: this.hash, + ...data + }; } - this._statTestedSnapshotsNotCached++; - this._checkSnapshotValidNoCache(snapshot, callback); + return this.getAssetPathWithInfo(filename, data); } /** - * @param {Snapshot} snapshot the snapshot made - * @param {function((WebpackError | null)=, boolean=): void} callback callback function - * @returns {void} + * @param {string | function(PathData, AssetInfo=): string} filename used to get asset path with hash + * @param {PathData} data context data + * @returns {string} interpolated path */ - _checkSnapshotValidNoCache(snapshot, callback) { - /** @type {number | undefined} */ - let startTime = undefined; - if (snapshot.hasStartTime()) { - startTime = snapshot.startTime; - } - let jobs = 1; - const jobDone = () => { - if (--jobs === 0) { - this._snapshotCache.set(snapshot, true); - callback(null, true); - } - }; - const invalid = () => { - if (jobs > 0) { - // large negative number instead of NaN or something else to keep jobs to stay a SMI (v8) - jobs = -100000000; - this._snapshotCache.set(snapshot, false); - callback(null, false); - } - }; - const invalidWithError = (path, err) => { - if (this._remainingLogs > 0) { - this._log(path, `error occurred: %s`, err); - } - invalid(); - }; - /** - * @param {string} path file path - * @param {string} current current hash - * @param {string} snap snapshot hash - * @returns {boolean} true, if ok - */ - const checkHash = (path, current, snap) => { - if (current !== snap) { - // If hash differ it's invalid - if (this._remainingLogs > 0) { - this._log(path, `hashes differ (%s != %s)`, current, snap); + getAssetPath(filename, data) { + return this.hooks.assetPath.call( + typeof filename === "function" ? filename(data) : filename, + data, + undefined + ); + } + + /** + * @param {string | function(PathData, AssetInfo=): string} filename used to get asset path with hash + * @param {PathData} data context data + * @returns {{ path: string, info: AssetInfo }} interpolated path and asset info + */ + getAssetPathWithInfo(filename, data) { + const assetInfo = {}; + // TODO webpack 5: refactor assetPath hook to receive { path, info } object + const newPath = this.hooks.assetPath.call( + typeof filename === "function" ? filename(data, assetInfo) : filename, + data, + assetInfo + ); + return { path: newPath, info: assetInfo }; + } + + getWarnings() { + return this.hooks.processWarnings.call(this.warnings); + } + + getErrors() { + return this.hooks.processErrors.call(this.errors); + } + + /** + * This function allows you to run another instance of webpack inside of webpack however as + * a child with different settings and configurations (if desired) applied. It copies all hooks, plugins + * from parent (or top level compiler) and creates a child Compilation + * + * @param {string} name name of the child compiler + * @param {OutputOptions=} outputOptions // Need to convert config schema to types for this + * @param {Array=} plugins webpack plugins that will be applied + * @returns {Compiler} creates a child Compiler instance + */ + createChildCompiler(name, outputOptions, plugins) { + const idx = this.childrenCounters[name] || 0; + this.childrenCounters[name] = idx + 1; + return this.compiler.createChildCompiler( + this, + name, + idx, + outputOptions, + plugins + ); + } + + /** + * @param {Module} module the module + * @param {ExecuteModuleOptions} options options + * @param {ExecuteModuleCallback} callback callback + */ + executeModule(module, options, callback) { + // Aggregate all referenced modules and ensure they are ready + const modules = new Set([module]); + processAsyncTree( + modules, + 10, + /** + * @param {Module} module the module + * @param {function(Module): void} push push more jobs + * @param {Callback} callback callback + * @returns {void} + */ + (module, push, callback) => { + this.buildQueue.waitFor(module, err => { + if (err) return callback(err); + this.processDependenciesQueue.waitFor(module, err => { + if (err) return callback(err); + for (const { module: m } of this.moduleGraph.getOutgoingConnections( + module + )) { + const size = modules.size; + modules.add(m); + if (modules.size !== size) push(m); + } + callback(); + }); + }); + }, + err => { + if (err) return callback(err); + + // Create new chunk graph, chunk and entrypoint for the build time execution + const chunkGraph = new ChunkGraph( + this.moduleGraph, + this.outputOptions.hashFunction + ); + const runtime = "build time"; + const { hashFunction, hashDigest, hashDigestLength } = + this.outputOptions; + const runtimeTemplate = this.runtimeTemplate; + + const chunk = new Chunk("build time chunk", this._backCompat); + chunk.id = chunk.name; + chunk.ids = [chunk.id]; + chunk.runtime = runtime; + + const entrypoint = new Entrypoint({ + runtime, + chunkLoading: false, + ...options.entryOptions + }); + chunkGraph.connectChunkAndEntryModule(chunk, module, entrypoint); + connectChunkGroupAndChunk(entrypoint, chunk); + entrypoint.setRuntimeChunk(chunk); + entrypoint.setEntrypointChunk(chunk); + + const chunks = new Set([chunk]); + + // Assign ids to modules and modules to the chunk + for (const module of modules) { + const id = module.identifier(); + chunkGraph.setModuleId(module, id); + chunkGraph.connectChunkAndModule(chunk, module); } - return false; - } - return true; - }; - /** - * @param {string} path file path - * @param {boolean} current current entry - * @param {boolean} snap entry from snapshot - * @returns {boolean} true, if ok - */ - const checkExistence = (path, current, snap) => { - if (!current !== !snap) { - // If existence of item differs - // it's invalid - if (this._remainingLogs > 0) { - this._log( - path, - current ? "it didn't exist before" : "it does no longer exist" + + // Hash modules + for (const module of modules) { + this._createModuleHash( + module, + chunkGraph, + runtime, + hashFunction, + runtimeTemplate, + hashDigest, + hashDigestLength ); } - return false; - } - return true; - }; - /** - * @param {string} path file path - * @param {FileSystemInfoEntry} current current entry - * @param {FileSystemInfoEntry} snap entry from snapshot - * @param {boolean} log log reason - * @returns {boolean} true, if ok - */ - const checkFile = (path, current, snap, log = true) => { - if (current === snap) return true; - if (!checkExistence(path, Boolean(current), Boolean(snap))) return false; - if (current) { - // For existing items only - if (typeof startTime === "number" && current.safeTime > startTime) { - // If a change happened after starting reading the item - // this may no longer be valid - if (log && this._remainingLogs > 0) { - this._log( - path, - `it may have changed (%d) after the start time of the snapshot (%d)`, - current.safeTime, - startTime + + const codeGenerationResults = new CodeGenerationResults( + this.outputOptions.hashFunction + ); + /** @type {WebpackError[]} */ + const errors = []; + /** + * @param {Module} module the module + * @param {Callback} callback callback + * @returns {void} + */ + const codeGen = (module, callback) => { + this._codeGenerationModule( + module, + runtime, + [runtime], + chunkGraph.getModuleHash(module, runtime), + this.dependencyTemplates, + chunkGraph, + this.moduleGraph, + runtimeTemplate, + errors, + codeGenerationResults, + (err, codeGenerated) => { + callback(err); + } + ); + }; + + const reportErrors = () => { + if (errors.length > 0) { + errors.sort( + compareSelect(err => err.module, compareModulesByIdentifier) ); + for (const error of errors) { + this.errors.push(error); + } + errors.length = 0; } - return false; - } - if ( - snap.timestamp !== undefined && - current.timestamp !== snap.timestamp - ) { - // If we have a timestamp (it was a file or symlink) and it differs from current timestamp - // it's invalid - if (log && this._remainingLogs > 0) { - this._log( - path, - `timestamps differ (%d != %d)`, - current.timestamp, - snap.timestamp - ); - } - return false; - } - } - return true; - }; - /** - * @param {string} path file path - * @param {ResolvedContextFileSystemInfoEntry} current current entry - * @param {ResolvedContextFileSystemInfoEntry} snap entry from snapshot - * @param {boolean} log log reason - * @returns {boolean} true, if ok - */ - const checkContext = (path, current, snap, log = true) => { - if (current === snap) return true; - if (!checkExistence(path, Boolean(current), Boolean(snap))) return false; - if (current) { - // For existing items only - if (typeof startTime === "number" && current.safeTime > startTime) { - // If a change happened after starting reading the item - // this may no longer be valid - if (log && this._remainingLogs > 0) { - this._log( - path, - `it may have changed (%d) after the start time of the snapshot (%d)`, - current.safeTime, - startTime + }; + + // Generate code for all aggregated modules + asyncLib.eachLimit(modules, 10, codeGen, err => { + if (err) return callback(err); + reportErrors(); + + // for backward-compat temporary set the chunk graph + // TODO webpack 6 + const old = this.chunkGraph; + this.chunkGraph = chunkGraph; + this.processRuntimeRequirements({ + chunkGraph, + modules, + chunks, + codeGenerationResults, + chunkGraphEntries: chunks + }); + this.chunkGraph = old; + + const runtimeModules = + chunkGraph.getChunkRuntimeModulesIterable(chunk); + + // Hash runtime modules + for (const module of runtimeModules) { + modules.add(module); + this._createModuleHash( + module, + chunkGraph, + runtime, + hashFunction, + runtimeTemplate, + hashDigest, + hashDigestLength ); } - return false; - } - if ( - snap.timestampHash !== undefined && - current.timestampHash !== snap.timestampHash - ) { - // If we have a timestampHash (it was a directory) and it differs from current timestampHash - // it's invalid - if (log && this._remainingLogs > 0) { - this._log( - path, - `timestamps hashes differ (%s != %s)`, - current.timestampHash, - snap.timestampHash + + // Generate code for all runtime modules + asyncLib.eachLimit(runtimeModules, 10, codeGen, err => { + if (err) return callback(err); + reportErrors(); + + /** @type {Map} */ + const moduleArgumentsMap = new Map(); + /** @type {Map} */ + const moduleArgumentsById = new Map(); + + /** @type {ExecuteModuleResult["fileDependencies"]} */ + const fileDependencies = new LazySet(); + /** @type {ExecuteModuleResult["contextDependencies"]} */ + const contextDependencies = new LazySet(); + /** @type {ExecuteModuleResult["missingDependencies"]} */ + const missingDependencies = new LazySet(); + /** @type {ExecuteModuleResult["buildDependencies"]} */ + const buildDependencies = new LazySet(); + + /** @type {ExecuteModuleResult["assets"]} */ + const assets = new Map(); + + let cacheable = true; + + /** @type {ExecuteModuleContext} */ + const context = { + assets, + __webpack_require__: undefined, + chunk, + chunkGraph + }; + + // Prepare execution + asyncLib.eachLimit( + modules, + 10, + (module, callback) => { + const codeGenerationResult = codeGenerationResults.get( + module, + runtime + ); + /** @type {ExecuteModuleArgument} */ + const moduleArgument = { + module, + codeGenerationResult, + preparedInfo: undefined, + moduleObject: undefined + }; + moduleArgumentsMap.set(module, moduleArgument); + moduleArgumentsById.set(module.identifier(), moduleArgument); + module.addCacheDependencies( + fileDependencies, + contextDependencies, + missingDependencies, + buildDependencies + ); + if (module.buildInfo.cacheable === false) { + cacheable = false; + } + if (module.buildInfo && module.buildInfo.assets) { + const { assets: moduleAssets, assetsInfo } = module.buildInfo; + for (const assetName of Object.keys(moduleAssets)) { + assets.set(assetName, { + source: moduleAssets[assetName], + info: assetsInfo ? assetsInfo.get(assetName) : undefined + }); + } + } + this.hooks.prepareModuleExecution.callAsync( + moduleArgument, + context, + callback + ); + }, + err => { + if (err) return callback(err); + + let exports; + try { + const { + strictModuleErrorHandling, + strictModuleExceptionHandling + } = this.outputOptions; + const __nested_webpack_require_152432__ = id => { + const cached = moduleCache[id]; + if (cached !== undefined) { + if (cached.error) throw cached.error; + return cached.exports; + } + const moduleArgument = moduleArgumentsById.get(id); + return __webpack_require_module__(moduleArgument, id); + }; + const interceptModuleExecution = (__nested_webpack_require_152432__[ + RuntimeGlobals.interceptModuleExecution.replace( + "__webpack_require__.", + "" + ) + ] = []); + const moduleCache = (__nested_webpack_require_152432__[ + RuntimeGlobals.moduleCache.replace( + "__webpack_require__.", + "" + ) + ] = {}); + + context.__webpack_require__ = __nested_webpack_require_152432__; + + /** + * @param {ExecuteModuleArgument} moduleArgument the module argument + * @param {string=} id id + * @returns {any} exports + */ + const __webpack_require_module__ = (moduleArgument, id) => { + var execOptions = { + id, + module: { + id, + exports: {}, + loaded: false, + error: undefined + }, + require: __nested_webpack_require_152432__ + }; + interceptModuleExecution.forEach(handler => + handler(execOptions) + ); + const module = moduleArgument.module; + this.buildTimeExecutedModules.add(module); + const moduleObject = execOptions.module; + moduleArgument.moduleObject = moduleObject; + try { + if (id) moduleCache[id] = moduleObject; + + tryRunOrWebpackError( + () => + this.hooks.executeModule.call( + moduleArgument, + context + ), + "Compilation.hooks.executeModule" + ); + moduleObject.loaded = true; + return moduleObject.exports; + } catch (e) { + if (strictModuleExceptionHandling) { + if (id) delete moduleCache[id]; + } else if (strictModuleErrorHandling) { + moduleObject.error = e; + } + if (!e.module) e.module = module; + throw e; + } + }; + + for (const runtimeModule of chunkGraph.getChunkRuntimeModulesInOrder( + chunk + )) { + __webpack_require_module__( + moduleArgumentsMap.get(runtimeModule) + ); + } + exports = __nested_webpack_require_152432__(module.identifier()); + } catch (e) { + const err = new WebpackError( + `Execution of module code from module graph (${module.readableIdentifier( + this.requestShortener + )}) failed: ${e.message}` + ); + err.stack = e.stack; + err.module = e.module; + return callback(err); + } + + callback(null, { + exports, + assets, + cacheable, + fileDependencies, + contextDependencies, + missingDependencies, + buildDependencies + }); + } ); - } - return false; - } - } - return true; - }; - if (snapshot.hasChildren()) { - const childCallback = (err, result) => { - if (err || !result) return invalid(); - else jobDone(); - }; - for (const child of snapshot.children) { - const cache = this._snapshotCache.get(child); - if (cache !== undefined) { - this._statTestedChildrenCached++; - /* istanbul ignore else */ - if (typeof cache === "boolean") { - if (cache === false) { - invalid(); - return; - } - } else { - jobs++; - cache.push(childCallback); - } - } else { - this._statTestedChildrenNotCached++; - jobs++; - this._checkSnapshotValidNoCache(child, childCallback); - } - } - } - if (snapshot.hasFileTimestamps()) { - const { fileTimestamps } = snapshot; - this._statTestedEntries += fileTimestamps.size; - for (const [path, ts] of fileTimestamps) { - const cache = this._fileTimestamps.get(path); - if (cache !== undefined) { - if (cache !== "ignore" && !checkFile(path, cache, ts)) { - invalid(); - return; - } - } else { - jobs++; - this.fileTimestampQueue.add(path, (err, entry) => { - if (err) return invalidWithError(path, err); - if (!checkFile(path, entry, ts)) { - invalid(); - } else { - jobDone(); - } }); - } - } - } - const processFileHashSnapshot = (path, hash) => { - const cache = this._fileHashes.get(path); - if (cache !== undefined) { - if (cache !== "ignore" && !checkHash(path, cache, hash)) { - invalid(); - return; - } - } else { - jobs++; - this.fileHashQueue.add(path, (err, entry) => { - if (err) return invalidWithError(path, err); - if (!checkHash(path, entry, hash)) { - invalid(); - } else { - jobDone(); - } }); } - }; - if (snapshot.hasFileHashes()) { - const { fileHashes } = snapshot; - this._statTestedEntries += fileHashes.size; - for (const [path, hash] of fileHashes) { - processFileHashSnapshot(path, hash); + ); + } + + checkConstraints() { + const chunkGraph = this.chunkGraph; + + /** @type {Set} */ + const usedIds = new Set(); + + for (const module of this.modules) { + if (module.type === "runtime") continue; + const moduleId = chunkGraph.getModuleId(module); + if (moduleId === null) continue; + if (usedIds.has(moduleId)) { + throw new Error(`checkConstraints: duplicate module id ${moduleId}`); } + usedIds.add(moduleId); } - if (snapshot.hasFileTshs()) { - const { fileTshs } = snapshot; - this._statTestedEntries += fileTshs.size; - for (const [path, tsh] of fileTshs) { - if (typeof tsh === "string") { - processFileHashSnapshot(path, tsh); - } else { - const cache = this._fileTimestamps.get(path); - if (cache !== undefined) { - if (cache === "ignore" || !checkFile(path, cache, tsh, false)) { - processFileHashSnapshot(path, tsh && tsh.hash); - } - } else { - jobs++; - this.fileTimestampQueue.add(path, (err, entry) => { - if (err) return invalidWithError(path, err); - if (!checkFile(path, entry, tsh, false)) { - processFileHashSnapshot(path, tsh && tsh.hash); - } - jobDone(); - }); - } + + for (const chunk of this.chunks) { + for (const module of chunkGraph.getChunkModulesIterable(chunk)) { + if (!this.modules.has(module)) { + throw new Error( + "checkConstraints: module in chunk but not in compilation " + + ` ${chunk.debugId} ${module.debugId}` + ); } } - } - if (snapshot.hasContextTimestamps()) { - const { contextTimestamps } = snapshot; - this._statTestedEntries += contextTimestamps.size; - for (const [path, ts] of contextTimestamps) { - const cache = this._contextTimestamps.get(path); - if (cache === "ignore") continue; - let resolved; - if ( - cache !== undefined && - (resolved = getResolvedTimestamp(cache)) !== undefined - ) { - if (!checkContext(path, resolved, ts)) { - invalid(); - return; - } - } else { - jobs++; - /** - * @param {Error=} err error - * @param {ResolvedContextFileSystemInfoEntry=} entry entry - * @returns {void} - */ - const callback = (err, entry) => { - if (err) return invalidWithError(path, err); - if (!checkContext(path, entry, ts)) { - invalid(); - } else { - jobDone(); - } - }; - if (cache !== undefined) { - this._resolveContextTimestamp(cache, callback); - } else { - this.getContextTimestamp(path, callback); - } + for (const module of chunkGraph.getChunkEntryModulesIterable(chunk)) { + if (!this.modules.has(module)) { + throw new Error( + "checkConstraints: entry module in chunk but not in compilation " + + ` ${chunk.debugId} ${module.debugId}` + ); } } } - const processContextHashSnapshot = (path, hash) => { - const cache = this._contextHashes.get(path); - let resolved; - if ( - cache !== undefined && - (resolved = getResolvedHash(cache)) !== undefined - ) { - if (!checkHash(path, resolved, hash)) { - invalid(); - return; - } - } else { - jobs++; - const callback = (err, entry) => { - if (err) return invalidWithError(path, err); - if (!checkHash(path, entry, hash)) { - invalid(); - } else { - jobDone(); - } - }; - if (cache !== undefined) { - this._resolveContextHash(cache, callback); - } else { - this.getContextHash(path, callback); - } - } - }; - if (snapshot.hasContextHashes()) { - const { contextHashes } = snapshot; - this._statTestedEntries += contextHashes.size; - for (const [path, hash] of contextHashes) { - processContextHashSnapshot(path, hash); - } - } - if (snapshot.hasContextTshs()) { - const { contextTshs } = snapshot; - this._statTestedEntries += contextTshs.size; - for (const [path, tsh] of contextTshs) { - if (typeof tsh === "string") { - processContextHashSnapshot(path, tsh); - } else { - const cache = this._contextTimestamps.get(path); - if (cache === "ignore") continue; - let resolved; - if ( - cache !== undefined && - (resolved = getResolvedTimestamp(cache)) !== undefined - ) { - if (!checkContext(path, resolved, tsh, false)) { - processContextHashSnapshot(path, tsh && tsh.hash); - } - } else { - jobs++; - /** - * @param {Error=} err error - * @param {ResolvedContextFileSystemInfoEntry=} entry entry - * @returns {void} - */ - const callback = (err, entry) => { - if (err) return invalidWithError(path, err); - if (!checkContext(path, entry, tsh, false)) { - processContextHashSnapshot(path, tsh && tsh.hash); - } - jobDone(); - }; - if (cache !== undefined) { - this._resolveContextTimestamp(cache, callback); - } else { - this.getContextTimestamp(path, callback); - } - } - } - } - } - if (snapshot.hasMissingExistence()) { - const { missingExistence } = snapshot; - this._statTestedEntries += missingExistence.size; - for (const [path, existence] of missingExistence) { - const cache = this._fileTimestamps.get(path); - if (cache !== undefined) { - if ( - cache !== "ignore" && - !checkExistence(path, Boolean(cache), Boolean(existence)) - ) { - invalid(); - return; - } - } else { - jobs++; - this.fileTimestampQueue.add(path, (err, entry) => { - if (err) return invalidWithError(path, err); - if (!checkExistence(path, Boolean(entry), Boolean(existence))) { - invalid(); - } else { - jobDone(); - } - }); - } - } - } - if (snapshot.hasManagedItemInfo()) { - const { managedItemInfo } = snapshot; - this._statTestedEntries += managedItemInfo.size; - for (const [path, info] of managedItemInfo) { - const cache = this._managedItems.get(path); - if (cache !== undefined) { - if (!checkHash(path, cache, info)) { - invalid(); - return; - } - } else { - jobs++; - this.managedItemQueue.add(path, (err, entry) => { - if (err) return invalidWithError(path, err); - if (!checkHash(path, entry, info)) { - invalid(); - } else { - jobDone(); - } - }); - } - } - } - jobDone(); - - // if there was an async action - // try to join multiple concurrent request for this snapshot - if (jobs > 0) { - const callbacks = [callback]; - callback = (err, result) => { - for (const callback of callbacks) callback(err, result); - }; - this._snapshotCache.set(snapshot, callbacks); + + for (const chunkGroup of this.chunkGroups) { + chunkGroup.checkConstraints(); } } +} - _readFileTimestamp(path, callback) { - this.fs.stat(path, (err, stat) => { - if (err) { - if (err.code === "ENOENT") { - this._fileTimestamps.set(path, null); - this._cachedDeprecatedFileTimestamps = undefined; - return callback(null, null); - } - return callback(err); - } - - let ts; - if (stat.isDirectory()) { - ts = { - safeTime: 0, - timestamp: undefined - }; - } else { - const mtime = +stat.mtime; +/** + * @typedef {Object} FactorizeModuleOptions + * @property {ModuleProfile} currentProfile + * @property {ModuleFactory} factory + * @property {Dependency[]} dependencies + * @property {boolean=} factoryResult return full ModuleFactoryResult instead of only module + * @property {Module | null} originModule + * @property {Partial=} contextInfo + * @property {string=} context + */ - if (mtime) applyMtime(mtime); +/** + * @param {FactorizeModuleOptions} options options object + * @param {ModuleCallback | ModuleFactoryResultCallback} callback callback + * @returns {void} + */ - ts = { - safeTime: mtime ? mtime + FS_ACCURACY : Infinity, - timestamp: mtime - }; - } +// Workaround for typescript as it doesn't support function overloading in jsdoc within a class +Compilation.prototype.factorizeModule = /** @type {{ + (options: FactorizeModuleOptions & { factoryResult?: false }, callback: ModuleCallback): void; + (options: FactorizeModuleOptions & { factoryResult: true }, callback: ModuleFactoryResultCallback): void; +}} */ ( + function (options, callback) { + this.factorizeQueue.add(options, callback); + } +); - this._fileTimestamps.set(path, ts); - this._cachedDeprecatedFileTimestamps = undefined; +// Hide from typescript +const compilationPrototype = Compilation.prototype; - callback(null, ts); - }); +// TODO webpack 6 remove +Object.defineProperty(compilationPrototype, "modifyHash", { + writable: false, + enumerable: false, + configurable: false, + value: () => { + throw new Error( + "Compilation.modifyHash was removed in favor of Compilation.hooks.fullHash" + ); } +}); - _readFileHash(path, callback) { - this.fs.readFile(path, (err, content) => { - if (err) { - if (err.code === "EISDIR") { - this._fileHashes.set(path, "directory"); - return callback(null, "directory"); - } - if (err.code === "ENOENT") { - this._fileHashes.set(path, null); - return callback(null, null); - } - if (err.code === "ERR_FS_FILE_TOO_LARGE") { - this.logger.warn(`Ignoring ${path} for hashing as it's very large`); - this._fileHashes.set(path, "too large"); - return callback(null, "too large"); - } - return callback(err); - } +// TODO webpack 6 remove +Object.defineProperty(compilationPrototype, "cache", { + enumerable: false, + configurable: false, + get: util.deprecate( + /** + * @this {Compilation} the compilation + * @returns {Cache} the cache + */ + function () { + return this.compiler.cache; + }, + "Compilation.cache was removed in favor of Compilation.getCache()", + "DEP_WEBPACK_COMPILATION_CACHE" + ), + set: util.deprecate( + v => {}, + "Compilation.cache was removed in favor of Compilation.getCache()", + "DEP_WEBPACK_COMPILATION_CACHE" + ) +}); - const hash = createHash(this._hashFunction); +/** + * Add additional assets to the compilation. + */ +Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL = -2000; - hash.update(content); +/** + * Basic preprocessing of assets. + */ +Compilation.PROCESS_ASSETS_STAGE_PRE_PROCESS = -1000; - const digest = /** @type {string} */ (hash.digest("hex")); +/** + * Derive new assets from existing assets. + * Existing assets should not be treated as complete. + */ +Compilation.PROCESS_ASSETS_STAGE_DERIVED = -200; - this._fileHashes.set(path, digest); +/** + * Add additional sections to existing assets, like a banner or initialization code. + */ +Compilation.PROCESS_ASSETS_STAGE_ADDITIONS = -100; - callback(null, digest); - }); - } +/** + * Optimize existing assets in a general way. + */ +Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE = 100; - _getFileTimestampAndHash(path, callback) { - const continueWithHash = hash => { - const cache = this._fileTimestamps.get(path); - if (cache !== undefined) { - if (cache !== "ignore") { - const result = { - ...cache, - hash - }; - this._fileTshs.set(path, result); - return callback(null, result); - } else { - this._fileTshs.set(path, hash); - return callback(null, hash); - } - } else { - this.fileTimestampQueue.add(path, (err, entry) => { - if (err) { - return callback(err); - } - const result = { - ...entry, - hash - }; - this._fileTshs.set(path, result); - return callback(null, result); - }); - } - }; +/** + * Optimize the count of existing assets, e. g. by merging them. + * Only assets of the same type should be merged. + * For assets of different types see PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE. + */ +Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT = 200; - const cache = this._fileHashes.get(path); - if (cache !== undefined) { - continueWithHash(cache); - } else { - this.fileHashQueue.add(path, (err, entry) => { - if (err) { - return callback(err); - } - continueWithHash(entry); - }); - } - } +/** + * Optimize the compatibility of existing assets, e. g. add polyfills or vendor-prefixes. + */ +Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY = 300; - /** - * @template T - * @template ItemType - * @param {Object} options options - * @param {string} options.path path - * @param {function(string): ItemType} options.fromImmutablePath called when context item is an immutable path - * @param {function(string): ItemType} options.fromManagedItem called when context item is a managed path - * @param {function(string, string, function(Error=, ItemType=): void): void} options.fromSymlink called when context item is a symlink - * @param {function(string, IStats, function(Error=, ItemType=): void): void} options.fromFile called when context item is a file - * @param {function(string, IStats, function(Error=, ItemType=): void): void} options.fromDirectory called when context item is a directory - * @param {function(string[], ItemType[]): T} options.reduce called from all context items - * @param {function((Error | null)=, (T)=): void} callback callback - */ - _readContext( - { - path, - fromImmutablePath, - fromManagedItem, - fromSymlink, - fromFile, - fromDirectory, - reduce - }, - callback - ) { - this.fs.readdir(path, (err, _files) => { - if (err) { - if (err.code === "ENOENT") { - return callback(null, null); - } - return callback(err); - } - const files = /** @type {string[]} */ (_files) - .map(file => file.normalize("NFC")) - .filter(file => !/^\./.test(file)) - .sort(); - asyncLib.map( - files, - (file, callback) => { - const child = join(this.fs, path, file); - for (const immutablePath of this.immutablePathsRegExps) { - if (immutablePath.test(path)) { - // ignore any immutable path for timestamping - return callback(null, fromImmutablePath(path)); - } - } - for (const immutablePath of this.immutablePathsWithSlash) { - if (path.startsWith(immutablePath)) { - // ignore any immutable path for timestamping - return callback(null, fromImmutablePath(path)); - } - } - for (const managedPath of this.managedPathsRegExps) { - const match = managedPath.exec(path); - if (match) { - const managedItem = getManagedItem(match[1], path); - if (managedItem) { - // construct timestampHash from managed info - return this.managedItemQueue.add(managedItem, (err, info) => { - if (err) return callback(err); - return callback(null, fromManagedItem(info)); - }); - } - } - } - for (const managedPath of this.managedPathsWithSlash) { - if (path.startsWith(managedPath)) { - const managedItem = getManagedItem(managedPath, child); - if (managedItem) { - // construct timestampHash from managed info - return this.managedItemQueue.add(managedItem, (err, info) => { - if (err) return callback(err); - return callback(null, fromManagedItem(info)); - }); - } - } - } +/** + * Optimize the size of existing assets, e. g. by minimizing or omitting whitespace. + */ +Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE = 400; - lstatReadlinkAbsolute(this.fs, child, (err, stat) => { - if (err) return callback(err); +/** + * Add development tooling to assets, e. g. by extracting a SourceMap. + */ +Compilation.PROCESS_ASSETS_STAGE_DEV_TOOLING = 500; - if (typeof stat === "string") { - return fromSymlink(child, stat, callback); - } +/** + * Optimize the count of existing assets, e. g. by inlining assets of into other assets. + * Only assets of different types should be inlined. + * For assets of the same type see PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT. + */ +Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE = 700; - if (stat.isFile()) { - return fromFile(child, stat, callback); - } - if (stat.isDirectory()) { - return fromDirectory(child, stat, callback); - } - callback(null, null); - }); - }, - (err, results) => { - if (err) return callback(err); - const result = reduce(files, results); - callback(null, result); - } - ); - }); - } +/** + * Summarize the list of existing assets + * e. g. creating an assets manifest of Service Workers. + */ +Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE = 1000; - _readContextTimestamp(path, callback) { - this._readContext( - { - path, - fromImmutablePath: () => null, - fromManagedItem: info => ({ - safeTime: 0, - timestampHash: info - }), - fromSymlink: (file, target, callback) => { - callback(null, { - timestampHash: target, - symlinks: new Set([target]) - }); - }, - fromFile: (file, stat, callback) => { - // Prefer the cached value over our new stat to report consistent results - const cache = this._fileTimestamps.get(file); - if (cache !== undefined) - return callback(null, cache === "ignore" ? null : cache); +/** + * Optimize the hashes of the assets, e. g. by generating real hashes of the asset content. + */ +Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH = 2500; - const mtime = +stat.mtime; +/** + * Optimize the transfer of existing assets, e. g. by preparing a compressed (gzip) file as separate asset. + */ +Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER = 3000; - if (mtime) applyMtime(mtime); +/** + * Analyse existing assets. + */ +Compilation.PROCESS_ASSETS_STAGE_ANALYSE = 4000; - const ts = { - safeTime: mtime ? mtime + FS_ACCURACY : Infinity, - timestamp: mtime - }; +/** + * Creating assets for reporting purposes. + */ +Compilation.PROCESS_ASSETS_STAGE_REPORT = 5000; - this._fileTimestamps.set(file, ts); - this._cachedDeprecatedFileTimestamps = undefined; - callback(null, ts); - }, - fromDirectory: (directory, stat, callback) => { - this.contextTimestampQueue.increaseParallelism(); - this._getUnresolvedContextTimestamp(directory, (err, tsEntry) => { - this.contextTimestampQueue.decreaseParallelism(); - callback(err, tsEntry); - }); - }, - reduce: (files, tsEntries) => { - let symlinks = undefined; +module.exports = Compilation; - const hash = createHash(this._hashFunction); - for (const file of files) hash.update(file); - let safeTime = 0; - for (const entry of tsEntries) { - if (!entry) { - hash.update("n"); - continue; - } - if (entry.timestamp) { - hash.update("f"); - hash.update(`${entry.timestamp}`); - } else if (entry.timestampHash) { - hash.update("d"); - hash.update(`${entry.timestampHash}`); - } - if (entry.symlinks !== undefined) { - if (symlinks === undefined) symlinks = new Set(); - addAll(entry.symlinks, symlinks); - } - if (entry.safeTime) { - safeTime = Math.max(safeTime, entry.safeTime); - } - } +/***/ }), - const digest = /** @type {string} */ (hash.digest("hex")); +/***/ 70845: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const result = { - safeTime, - timestampHash: digest - }; - if (symlinks) result.symlinks = symlinks; - return result; - } - }, - (err, result) => { - if (err) return callback(err); - this._contextTimestamps.set(path, result); - this._cachedDeprecatedContextTimestamps = undefined; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - callback(null, result); - } - ); - } - /** - * @param {ContextFileSystemInfoEntry} entry entry - * @param {function((Error | null)=, ResolvedContextFileSystemInfoEntry=): void} callback callback - * @returns {void} - */ - _resolveContextTimestamp(entry, callback) { - const hashes = []; - let safeTime = 0; - processAsyncTree( - entry.symlinks, - 10, - (target, push, callback) => { - this._getUnresolvedContextTimestamp(target, (err, entry) => { - if (err) return callback(err); - if (entry && entry !== "ignore") { - hashes.push(entry.timestampHash); - if (entry.safeTime) { - safeTime = Math.max(safeTime, entry.safeTime); - } - if (entry.symlinks !== undefined) { - for (const target of entry.symlinks) push(target); - } - } - callback(); - }); - }, - err => { - if (err) return callback(err); - const hash = createHash(this._hashFunction); - hash.update(entry.timestampHash); - if (entry.safeTime) { - safeTime = Math.max(safeTime, entry.safeTime); - } - hashes.sort(); - for (const h of hashes) { - hash.update(h); - } - callback( - null, - (entry.resolved = { - safeTime, - timestampHash: /** @type {string} */ (hash.digest("hex")) - }) - ); - } - ); - } - - _readContextHash(path, callback) { - this._readContext( - { - path, - fromImmutablePath: () => "", - fromManagedItem: info => info || "", - fromSymlink: (file, target, callback) => { - callback(null, { - hash: target, - symlinks: new Set([target]) - }); - }, - fromFile: (file, stat, callback) => - this.getFileHash(file, (err, hash) => { - callback(err, hash || ""); - }), - fromDirectory: (directory, stat, callback) => { - this.contextHashQueue.increaseParallelism(); - this._getUnresolvedContextHash(directory, (err, hash) => { - this.contextHashQueue.decreaseParallelism(); - callback(err, hash || ""); - }); - }, - /** - * @param {string[]} files files - * @param {(string | ContextHash)[]} fileHashes hashes - * @returns {ContextHash} reduced hash - */ - reduce: (files, fileHashes) => { - let symlinks = undefined; - const hash = createHash(this._hashFunction); - for (const file of files) hash.update(file); - for (const entry of fileHashes) { - if (typeof entry === "string") { - hash.update(entry); - } else { - hash.update(entry.hash); - if (entry.symlinks) { - if (symlinks === undefined) symlinks = new Set(); - addAll(entry.symlinks, symlinks); - } - } - } +const parseJson = __webpack_require__(15235); +const asyncLib = __webpack_require__(78175); +const { + SyncHook, + SyncBailHook, + AsyncParallelHook, + AsyncSeriesHook +} = __webpack_require__(41242); +const { SizeOnlySource } = __webpack_require__(51255); +const webpack = __webpack_require__(91919); +const Cache = __webpack_require__(7592); +const CacheFacade = __webpack_require__(55392); +const ChunkGraph = __webpack_require__(64971); +const Compilation = __webpack_require__(85720); +const ConcurrentCompilationError = __webpack_require__(95735); +const ContextModuleFactory = __webpack_require__(62471); +const ModuleGraph = __webpack_require__(99988); +const NormalModuleFactory = __webpack_require__(68860); +const RequestShortener = __webpack_require__(73406); +const ResolverFactory = __webpack_require__(30217); +const Stats = __webpack_require__(31743); +const Watching = __webpack_require__(84275); +const WebpackError = __webpack_require__(53799); +const { Logger } = __webpack_require__(32597); +const { join, dirname, mkdirp } = __webpack_require__(17139); +const { makePathsRelative } = __webpack_require__(82186); +const { isSourceEqual } = __webpack_require__(41245); - const result = { - hash: /** @type {string} */ (hash.digest("hex")) - }; - if (symlinks) result.symlinks = symlinks; - return result; - } - }, - (err, result) => { - if (err) return callback(err); - this._contextHashes.set(path, result); - return callback(null, result); - } - ); - } +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").EntryNormalized} Entry */ +/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */ +/** @typedef {import("../declarations/WebpackOptions").WatchOptions} WatchOptions */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./util/WeakTupleMap")} WeakTupleMap */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("./util/fs").IntermediateFileSystem} IntermediateFileSystem */ +/** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */ +/** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */ - /** - * @param {ContextHash} entry context hash - * @param {function((Error | null)=, string=): void} callback callback - * @returns {void} - */ - _resolveContextHash(entry, callback) { - const hashes = []; - processAsyncTree( - entry.symlinks, - 10, - (target, push, callback) => { - this._getUnresolvedContextHash(target, (err, hash) => { - if (err) return callback(err); - if (hash) { - hashes.push(hash.hash); - if (hash.symlinks !== undefined) { - for (const target of hash.symlinks) push(target); - } - } - callback(); - }); - }, - err => { - if (err) return callback(err); - const hash = createHash(this._hashFunction); - hash.update(entry.hash); - hashes.sort(); - for (const h of hashes) { - hash.update(h); - } - callback( - null, - (entry.resolved = /** @type {string} */ (hash.digest("hex"))) - ); - } - ); - } +/** + * @typedef {Object} CompilationParams + * @property {NormalModuleFactory} normalModuleFactory + * @property {ContextModuleFactory} contextModuleFactory + */ - _readContextTimestampAndHash(path, callback) { - const finalize = (timestamp, hash) => { - const result = - timestamp === "ignore" - ? hash - : { - ...timestamp, - ...hash - }; - this._contextTshs.set(path, result); - callback(null, result); - }; - const cachedHash = this._contextHashes.get(path); - const cachedTimestamp = this._contextTimestamps.get(path); - if (cachedHash !== undefined) { - if (cachedTimestamp !== undefined) { - finalize(cachedTimestamp, cachedHash); - } else { - this.contextTimestampQueue.add(path, (err, entry) => { - if (err) return callback(err); - finalize(entry, cachedHash); - }); - } - } else { - if (cachedTimestamp !== undefined) { - this.contextHashQueue.add(path, (err, entry) => { - if (err) return callback(err); - finalize(cachedTimestamp, entry); - }); - } else { - this._readContext( - { - path, - fromImmutablePath: () => null, - fromManagedItem: info => ({ - safeTime: 0, - timestampHash: info, - hash: info || "" - }), - fromSymlink: (fle, target, callback) => { - callback(null, { - timestampHash: target, - hash: target, - symlinks: new Set([target]) - }); - }, - fromFile: (file, stat, callback) => { - this._getFileTimestampAndHash(file, callback); - }, - fromDirectory: (directory, stat, callback) => { - this.contextTshQueue.increaseParallelism(); - this.contextTshQueue.add(directory, (err, result) => { - this.contextTshQueue.decreaseParallelism(); - callback(err, result); - }); - }, - /** - * @param {string[]} files files - * @param {(Partial & Partial | string | null)[]} results results - * @returns {ContextTimestampAndHash} tsh - */ - reduce: (files, results) => { - let symlinks = undefined; +/** + * @template T + * @callback Callback + * @param {(Error | null)=} err + * @param {T=} result + */ - const tsHash = createHash(this._hashFunction); - const hash = createHash(this._hashFunction); +/** + * @callback RunAsChildCallback + * @param {(Error | null)=} err + * @param {Chunk[]=} entries + * @param {Compilation=} compilation + */ - for (const file of files) { - tsHash.update(file); - hash.update(file); - } - let safeTime = 0; - for (const entry of results) { - if (!entry) { - tsHash.update("n"); - continue; - } - if (typeof entry === "string") { - tsHash.update("n"); - hash.update(entry); - continue; - } - if (entry.timestamp) { - tsHash.update("f"); - tsHash.update(`${entry.timestamp}`); - } else if (entry.timestampHash) { - tsHash.update("d"); - tsHash.update(`${entry.timestampHash}`); - } - if (entry.symlinks !== undefined) { - if (symlinks === undefined) symlinks = new Set(); - addAll(entry.symlinks, symlinks); - } - if (entry.safeTime) { - safeTime = Math.max(safeTime, entry.safeTime); - } - hash.update(entry.hash); - } +/** + * @typedef {Object} AssetEmittedInfo + * @property {Buffer} content + * @property {Source} source + * @property {Compilation} compilation + * @property {string} outputPath + * @property {string} targetPath + */ - const result = { - safeTime, - timestampHash: /** @type {string} */ (tsHash.digest("hex")), - hash: /** @type {string} */ (hash.digest("hex")) - }; - if (symlinks) result.symlinks = symlinks; - return result; - } - }, - (err, result) => { - if (err) return callback(err); - this._contextTshs.set(path, result); - return callback(null, result); - } - ); - } - } +/** + * @param {string[]} array an array + * @returns {boolean} true, if the array is sorted + */ +const isSorted = array => { + for (let i = 1; i < array.length; i++) { + if (array[i - 1] > array[i]) return false; } + return true; +}; - /** - * @param {ContextTimestampAndHash} entry entry - * @param {function((Error | null)=, ResolvedContextTimestampAndHash=): void} callback callback - * @returns {void} - */ - _resolveContextTsh(entry, callback) { - const hashes = []; - const tsHashes = []; - let safeTime = 0; - processAsyncTree( - entry.symlinks, - 10, - (target, push, callback) => { - this._getUnresolvedContextTsh(target, (err, entry) => { - if (err) return callback(err); - if (entry) { - hashes.push(entry.hash); - if (entry.timestampHash) tsHashes.push(entry.timestampHash); - if (entry.safeTime) { - safeTime = Math.max(safeTime, entry.safeTime); - } - if (entry.symlinks !== undefined) { - for (const target of entry.symlinks) push(target); - } - } - callback(); - }); - }, - err => { - if (err) return callback(err); - const hash = createHash(this._hashFunction); - const tsHash = createHash(this._hashFunction); - hash.update(entry.hash); - if (entry.timestampHash) tsHash.update(entry.timestampHash); - if (entry.safeTime) { - safeTime = Math.max(safeTime, entry.safeTime); - } - hashes.sort(); - for (const h of hashes) { - hash.update(h); - } - tsHashes.sort(); - for (const h of tsHashes) { - tsHash.update(h); - } - callback( - null, - (entry.resolved = { - safeTime, - timestampHash: /** @type {string} */ (tsHash.digest("hex")), - hash: /** @type {string} */ (hash.digest("hex")) - }) - ); - } - ); +/** + * @param {Object} obj an object + * @param {string[]} keys the keys of the object + * @returns {Object} the object with properties sorted by property name + */ +const sortObject = (obj, keys) => { + const o = {}; + for (const k of keys.sort()) { + o[k] = obj[k]; } + return o; +}; - _getManagedItemDirectoryInfo(path, callback) { - this.fs.readdir(path, (err, elements) => { - if (err) { - if (err.code === "ENOENT" || err.code === "ENOTDIR") { - return callback(null, EMPTY_SET); - } - return callback(err); - } - const set = new Set( - /** @type {string[]} */ (elements).map(element => - join(this.fs, path, element) - ) - ); - callback(null, set); - }); +/** + * @param {string} filename filename + * @param {string | string[] | undefined} hashes list of hashes + * @returns {boolean} true, if the filename contains any hash + */ +const includesHash = (filename, hashes) => { + if (!hashes) return false; + if (Array.isArray(hashes)) { + return hashes.some(hash => filename.includes(hash)); + } else { + return filename.includes(hashes); } +}; - _getManagedItemInfo(path, callback) { - const dir = dirname(this.fs, path); - this.managedItemDirectoryQueue.add(dir, (err, elements) => { - if (err) { - return callback(err); - } - if (!elements.has(path)) { - // file or directory doesn't exist - this._managedItems.set(path, "*missing"); - return callback(null, "*missing"); - } - // something exists - // it may be a file or directory - if ( - path.endsWith("node_modules") && - (path.endsWith("/node_modules") || path.endsWith("\\node_modules")) - ) { - // we are only interested in existence of this special directory - this._managedItems.set(path, "*node_modules"); - return callback(null, "*node_modules"); - } - - // we assume it's a directory, as files shouldn't occur in managed paths - const packageJsonPath = join(this.fs, path, "package.json"); - this.fs.readFile(packageJsonPath, (err, content) => { - if (err) { - if (err.code === "ENOENT" || err.code === "ENOTDIR") { - // no package.json or path is not a directory - this.fs.readdir(path, (err, elements) => { - if ( - !err && - elements.length === 1 && - elements[0] === "node_modules" - ) { - // This is only a grouping folder e. g. used by yarn - // we are only interested in existence of this special directory - this._managedItems.set(path, "*nested"); - return callback(null, "*nested"); - } - this.logger.warn( - `Managed item ${path} isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)` - ); - return callback(); - }); - return; - } - return callback(err); - } - let data; - try { - data = JSON.parse(content.toString("utf-8")); - } catch (e) { - return callback(e); - } - if (!data.name) { - this.logger.warn( - `${packageJsonPath} doesn't contain a "name" property (see snapshot.managedPaths option)` - ); - return callback(); - } - const info = `${data.name || ""}@${data.version || ""}`; - this._managedItems.set(path, info); - callback(null, info); - }); - }); - } +class Compiler { + /** + * @param {string} context the compilation path + * @param {WebpackOptions} options options + */ + constructor(context, options = /** @type {WebpackOptions} */ ({})) { + this.hooks = Object.freeze({ + /** @type {SyncHook<[]>} */ + initialize: new SyncHook([]), - getDeprecatedFileTimestamps() { - if (this._cachedDeprecatedFileTimestamps !== undefined) - return this._cachedDeprecatedFileTimestamps; - const map = new Map(); - for (const [path, info] of this._fileTimestamps) { - if (info) map.set(path, typeof info === "object" ? info.safeTime : null); - } - return (this._cachedDeprecatedFileTimestamps = map); - } + /** @type {SyncBailHook<[Compilation], boolean>} */ + shouldEmit: new SyncBailHook(["compilation"]), + /** @type {AsyncSeriesHook<[Stats]>} */ + done: new AsyncSeriesHook(["stats"]), + /** @type {SyncHook<[Stats]>} */ + afterDone: new SyncHook(["stats"]), + /** @type {AsyncSeriesHook<[]>} */ + additionalPass: new AsyncSeriesHook([]), + /** @type {AsyncSeriesHook<[Compiler]>} */ + beforeRun: new AsyncSeriesHook(["compiler"]), + /** @type {AsyncSeriesHook<[Compiler]>} */ + run: new AsyncSeriesHook(["compiler"]), + /** @type {AsyncSeriesHook<[Compilation]>} */ + emit: new AsyncSeriesHook(["compilation"]), + /** @type {AsyncSeriesHook<[string, AssetEmittedInfo]>} */ + assetEmitted: new AsyncSeriesHook(["file", "info"]), + /** @type {AsyncSeriesHook<[Compilation]>} */ + afterEmit: new AsyncSeriesHook(["compilation"]), - getDeprecatedContextTimestamps() { - if (this._cachedDeprecatedContextTimestamps !== undefined) - return this._cachedDeprecatedContextTimestamps; - const map = new Map(); - for (const [path, info] of this._contextTimestamps) { - if (info) map.set(path, typeof info === "object" ? info.safeTime : null); - } - return (this._cachedDeprecatedContextTimestamps = map); - } -} + /** @type {SyncHook<[Compilation, CompilationParams]>} */ + thisCompilation: new SyncHook(["compilation", "params"]), + /** @type {SyncHook<[Compilation, CompilationParams]>} */ + compilation: new SyncHook(["compilation", "params"]), + /** @type {SyncHook<[NormalModuleFactory]>} */ + normalModuleFactory: new SyncHook(["normalModuleFactory"]), + /** @type {SyncHook<[ContextModuleFactory]>} */ + contextModuleFactory: new SyncHook(["contextModuleFactory"]), -module.exports = FileSystemInfo; -module.exports.Snapshot = Snapshot; + /** @type {AsyncSeriesHook<[CompilationParams]>} */ + beforeCompile: new AsyncSeriesHook(["params"]), + /** @type {SyncHook<[CompilationParams]>} */ + compile: new SyncHook(["params"]), + /** @type {AsyncParallelHook<[Compilation]>} */ + make: new AsyncParallelHook(["compilation"]), + /** @type {AsyncParallelHook<[Compilation]>} */ + finishMake: new AsyncSeriesHook(["compilation"]), + /** @type {AsyncSeriesHook<[Compilation]>} */ + afterCompile: new AsyncSeriesHook(["compilation"]), + /** @type {AsyncSeriesHook<[]>} */ + readRecords: new AsyncSeriesHook([]), + /** @type {AsyncSeriesHook<[]>} */ + emitRecords: new AsyncSeriesHook([]), -/***/ }), + /** @type {AsyncSeriesHook<[Compiler]>} */ + watchRun: new AsyncSeriesHook(["compiler"]), + /** @type {SyncHook<[Error]>} */ + failed: new SyncHook(["error"]), + /** @type {SyncHook<[string | null, number]>} */ + invalid: new SyncHook(["filename", "changeTime"]), + /** @type {SyncHook<[]>} */ + watchClose: new SyncHook([]), + /** @type {AsyncSeriesHook<[]>} */ + shutdown: new AsyncSeriesHook([]), -/***/ 58727: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** @type {SyncBailHook<[string, string, any[]], true>} */ + infrastructureLog: new SyncBailHook(["origin", "type", "args"]), -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // TODO the following hooks are weirdly located here + // TODO move them for webpack 5 + /** @type {SyncHook<[]>} */ + environment: new SyncHook([]), + /** @type {SyncHook<[]>} */ + afterEnvironment: new SyncHook([]), + /** @type {SyncHook<[Compiler]>} */ + afterPlugins: new SyncHook(["compiler"]), + /** @type {SyncHook<[Compiler]>} */ + afterResolvers: new SyncHook(["compiler"]), + /** @type {SyncBailHook<[string, Entry], boolean>} */ + entryOption: new SyncBailHook(["context", "entry"]) + }); + this.webpack = webpack; + /** @type {string=} */ + this.name = undefined; + /** @type {Compilation=} */ + this.parentCompilation = undefined; + /** @type {Compiler} */ + this.root = this; + /** @type {string} */ + this.outputPath = ""; + /** @type {Watching} */ + this.watching = undefined; -const { getEntryRuntime, mergeRuntimeOwned } = __webpack_require__(17156); + /** @type {OutputFileSystem} */ + this.outputFileSystem = null; + /** @type {IntermediateFileSystem} */ + this.intermediateFileSystem = null; + /** @type {InputFileSystem} */ + this.inputFileSystem = null; + /** @type {WatchFileSystem} */ + this.watchFileSystem = null; -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ + /** @type {string|null} */ + this.recordsInputPath = null; + /** @type {string|null} */ + this.recordsOutputPath = null; + this.records = {}; + /** @type {Set} */ + this.managedPaths = new Set(); + /** @type {Set} */ + this.immutablePaths = new Set(); -class FlagAllModulesAsUsedPlugin { - constructor(explanation) { - this.explanation = explanation; + /** @type {ReadonlySet} */ + this.modifiedFiles = undefined; + /** @type {ReadonlySet} */ + this.removedFiles = undefined; + /** @type {ReadonlyMap} */ + this.fileTimestamps = undefined; + /** @type {ReadonlyMap} */ + this.contextTimestamps = undefined; + /** @type {number} */ + this.fsStartTime = undefined; + + /** @type {ResolverFactory} */ + this.resolverFactory = new ResolverFactory(); + + this.infrastructureLogger = undefined; + + this.options = options; + + this.context = context; + + this.requestShortener = new RequestShortener(context, this.root); + + this.cache = new Cache(); + + /** @type {Map, memCache: WeakTupleMap }> | undefined} */ + this.moduleMemCaches = undefined; + + this.compilerPath = ""; + + /** @type {boolean} */ + this.running = false; + + /** @type {boolean} */ + this.idle = false; + + /** @type {boolean} */ + this.watchMode = false; + + this._backCompat = this.options.experiments.backCompat !== false; + + /** @type {Compilation} */ + this._lastCompilation = undefined; + /** @type {NormalModuleFactory} */ + this._lastNormalModuleFactory = undefined; + + /** @private @type {WeakMap }>} */ + this._assetEmittingSourceCache = new WeakMap(); + /** @private @type {Map} */ + this._assetEmittingWrittenFiles = new Map(); + /** @private @type {Set} */ + this._assetEmittingPreviousFiles = new Set(); } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {string} name cache name + * @returns {CacheFacade} the cache facade instance */ - apply(compiler) { - compiler.hooks.compilation.tap( - "FlagAllModulesAsUsedPlugin", - compilation => { - const moduleGraph = compilation.moduleGraph; - compilation.hooks.optimizeDependencies.tap( - "FlagAllModulesAsUsedPlugin", - modules => { - /** @type {RuntimeSpec} */ - let runtime = undefined; - for (const [name, { options }] of compilation.entries) { - runtime = mergeRuntimeOwned( - runtime, - getEntryRuntime(compilation, name, options) - ); - } - for (const module of modules) { - const exportsInfo = moduleGraph.getExportsInfo(module); - exportsInfo.setUsedInUnknownWay(runtime); - moduleGraph.addExtraReason(module, this.explanation); - if (module.factoryMeta === undefined) { - module.factoryMeta = {}; + getCache(name) { + return new CacheFacade( + this.cache, + `${this.compilerPath}${name}`, + this.options.output.hashFunction + ); + } + + /** + * @param {string | (function(): string)} name name of the logger, or function called once to get the logger name + * @returns {Logger} a logger with that name + */ + getInfrastructureLogger(name) { + if (!name) { + throw new TypeError( + "Compiler.getInfrastructureLogger(name) called without a name" + ); + } + return new Logger( + (type, args) => { + if (typeof name === "function") { + name = name(); + if (!name) { + throw new TypeError( + "Compiler.getInfrastructureLogger(name) called with a function not returning a name" + ); + } + } + if (this.hooks.infrastructureLog.call(name, type, args) === undefined) { + if (this.infrastructureLogger !== undefined) { + this.infrastructureLogger(name, type, args); + } + } + }, + childName => { + if (typeof name === "function") { + if (typeof childName === "function") { + return this.getInfrastructureLogger(() => { + if (typeof name === "function") { + name = name(); + if (!name) { + throw new TypeError( + "Compiler.getInfrastructureLogger(name) called with a function not returning a name" + ); + } } - module.factoryMeta.sideEffectFree = false; - } + if (typeof childName === "function") { + childName = childName(); + if (!childName) { + throw new TypeError( + "Logger.getChildLogger(name) called with a function not returning a name" + ); + } + } + return `${name}/${childName}`; + }); + } else { + return this.getInfrastructureLogger(() => { + if (typeof name === "function") { + name = name(); + if (!name) { + throw new TypeError( + "Compiler.getInfrastructureLogger(name) called with a function not returning a name" + ); + } + } + return `${name}/${childName}`; + }); } - ); + } else { + if (typeof childName === "function") { + return this.getInfrastructureLogger(() => { + if (typeof childName === "function") { + childName = childName(); + if (!childName) { + throw new TypeError( + "Logger.getChildLogger(name) called with a function not returning a name" + ); + } + } + return `${name}/${childName}`; + }); + } else { + return this.getInfrastructureLogger(`${name}/${childName}`); + } + } } ); } -} -module.exports = FlagAllModulesAsUsedPlugin; + // TODO webpack 6: solve this in a better way + // e.g. move compilation specific info from Modules into ModuleGraph + _cleanupLastCompilation() { + if (this._lastCompilation !== undefined) { + for (const module of this._lastCompilation.modules) { + ChunkGraph.clearChunkGraphForModule(module); + ModuleGraph.clearModuleGraphForModule(module); + module.cleanupForCache(); + } + for (const chunk of this._lastCompilation.chunks) { + ChunkGraph.clearChunkGraphForChunk(chunk); + } + this._lastCompilation = undefined; + } + } + // TODO webpack 6: solve this in a better way + _cleanupLastNormalModuleFactory() { + if (this._lastNormalModuleFactory !== undefined) { + this._lastNormalModuleFactory.cleanupForCache(); + this._lastNormalModuleFactory = undefined; + } + } -/***/ }), + /** + * @param {WatchOptions} watchOptions the watcher's options + * @param {Callback} handler signals when the call finishes + * @returns {Watching} a compiler watcher + */ + watch(watchOptions, handler) { + if (this.running) { + return handler(new ConcurrentCompilationError()); + } -/***/ 84506: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + this.running = true; + this.watchMode = true; + this.watching = new Watching(this, watchOptions, handler); + return this.watching; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {Callback} callback signals when the call finishes + * @returns {void} + */ + run(callback) { + if (this.running) { + return callback(new ConcurrentCompilationError()); + } + let logger; + const finalCallback = (err, stats) => { + if (logger) logger.time("beginIdle"); + this.idle = true; + this.cache.beginIdle(); + this.idle = true; + if (logger) logger.timeEnd("beginIdle"); + this.running = false; + if (err) { + this.hooks.failed.call(err); + } + if (callback !== undefined) callback(err, stats); + this.hooks.afterDone.call(stats); + }; -const asyncLib = __webpack_require__(78175); -const Queue = __webpack_require__(65930); + const startTime = Date.now(); -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./Dependency").ExportSpec} ExportSpec */ -/** @typedef {import("./Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("./ExportsInfo")} ExportsInfo */ -/** @typedef {import("./Module")} Module */ + this.running = true; -class FlagDependencyExportsPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "FlagDependencyExportsPlugin", - compilation => { - const moduleGraph = compilation.moduleGraph; - const cache = compilation.getCache("FlagDependencyExportsPlugin"); - compilation.hooks.finishModules.tapAsync( - "FlagDependencyExportsPlugin", - (modules, callback) => { - const logger = compilation.getLogger( - "webpack.FlagDependencyExportsPlugin" - ); - let statRestoredFromMemCache = 0; - let statRestoredFromCache = 0; - let statNoExports = 0; - let statFlaggedUncached = 0; - let statNotCached = 0; - let statQueueItemsProcessed = 0; + const onCompiled = (err, compilation) => { + if (err) return finalCallback(err); - const { moduleMemCaches } = compilation; + if (this.hooks.shouldEmit.call(compilation) === false) { + compilation.startTime = startTime; + compilation.endTime = Date.now(); + const stats = new Stats(compilation); + this.hooks.done.callAsync(stats, err => { + if (err) return finalCallback(err); + return finalCallback(null, stats); + }); + return; + } - /** @type {Queue} */ - const queue = new Queue(); + process.nextTick(() => { + logger = compilation.getLogger("webpack.Compiler"); + logger.time("emitAssets"); + this.emitAssets(compilation, err => { + logger.timeEnd("emitAssets"); + if (err) return finalCallback(err); - // Step 1: Try to restore cached provided export info from cache - logger.time("restore cached provided exports"); - asyncLib.each( - modules, - (module, callback) => { - const exportsInfo = moduleGraph.getExportsInfo(module); - if (!module.buildMeta || !module.buildMeta.exportsType) { - if (exportsInfo.otherExportsInfo.provided !== null) { - // It's a module without declared exports - statNoExports++; - exportsInfo.setHasProvideInfo(); - exportsInfo.setUnknownExportsProvided(); - return callback(); - } - } - if (typeof module.buildInfo.hash !== "string") { - statFlaggedUncached++; - // Enqueue uncacheable module for determining the exports - queue.enqueue(module); - exportsInfo.setHasProvideInfo(); - return callback(); - } - const memCache = moduleMemCaches && moduleMemCaches.get(module); - const memCacheValue = memCache && memCache.get(this); - if (memCacheValue !== undefined) { - statRestoredFromMemCache++; - exportsInfo.restoreProvided(memCacheValue); - return callback(); - } - cache.get( - module.identifier(), - module.buildInfo.hash, - (err, result) => { - if (err) return callback(err); + if (compilation.hooks.needAdditionalPass.call()) { + compilation.needAdditionalPass = true; - if (result !== undefined) { - statRestoredFromCache++; - exportsInfo.restoreProvided(result); - } else { - statNotCached++; - // Without cached info enqueue module for determining the exports - queue.enqueue(module); - exportsInfo.setHasProvideInfo(); - } - callback(); - } - ); - }, - err => { - logger.timeEnd("restore cached provided exports"); - if (err) return callback(err); + compilation.startTime = startTime; + compilation.endTime = Date.now(); + logger.time("done hook"); + const stats = new Stats(compilation); + this.hooks.done.callAsync(stats, err => { + logger.timeEnd("done hook"); + if (err) return finalCallback(err); - /** @type {Set} */ - const modulesToStore = new Set(); + this.hooks.additionalPass.callAsync(err => { + if (err) return finalCallback(err); + this.compile(onCompiled); + }); + }); + return; + } - /** @type {Map>} */ - const dependencies = new Map(); + logger.time("emitRecords"); + this.emitRecords(err => { + logger.timeEnd("emitRecords"); + if (err) return finalCallback(err); - /** @type {Module} */ - let module; + compilation.startTime = startTime; + compilation.endTime = Date.now(); + logger.time("done hook"); + const stats = new Stats(compilation); + this.hooks.done.callAsync(stats, err => { + logger.timeEnd("done hook"); + if (err) return finalCallback(err); + this.cache.storeBuildDependencies( + compilation.buildDependencies, + err => { + if (err) return finalCallback(err); + return finalCallback(null, stats); + } + ); + }); + }); + }); + }); + }; - /** @type {ExportsInfo} */ - let exportsInfo; + const run = () => { + this.hooks.beforeRun.callAsync(this, err => { + if (err) return finalCallback(err); - /** @type {Map} */ - const exportsSpecsFromDependencies = new Map(); + this.hooks.run.callAsync(this, err => { + if (err) return finalCallback(err); - let cacheable = true; - let changed = false; + this.readRecords(err => { + if (err) return finalCallback(err); - /** - * @param {DependenciesBlock} depBlock the dependencies block - * @returns {void} - */ - const processDependenciesBlock = depBlock => { - for (const dep of depBlock.dependencies) { - processDependency(dep); - } - for (const block of depBlock.blocks) { - processDependenciesBlock(block); - } - }; + this.compile(onCompiled); + }); + }); + }); + }; - /** - * @param {Dependency} dep the dependency - * @returns {void} - */ - const processDependency = dep => { - const exportDesc = dep.getExports(moduleGraph); - if (!exportDesc) return; - exportsSpecsFromDependencies.set(dep, exportDesc); - }; + if (this.idle) { + this.cache.endIdle(err => { + if (err) return finalCallback(err); - /** - * @param {Dependency} dep dependency - * @param {ExportsSpec} exportDesc info - * @returns {void} - */ - const processExportsSpec = (dep, exportDesc) => { - const exports = exportDesc.exports; - const globalCanMangle = exportDesc.canMangle; - const globalFrom = exportDesc.from; - const globalPriority = exportDesc.priority; - const globalTerminalBinding = - exportDesc.terminalBinding || false; - const exportDeps = exportDesc.dependencies; - if (exportDesc.hideExports) { - for (const name of exportDesc.hideExports) { - const exportInfo = exportsInfo.getExportInfo(name); - exportInfo.unsetTarget(dep); - } - } - if (exports === true) { - // unknown exports - if ( - exportsInfo.setUnknownExportsProvided( - globalCanMangle, - exportDesc.excludeExports, - globalFrom && dep, - globalFrom, - globalPriority - ) - ) { - changed = true; - } - } else if (Array.isArray(exports)) { - /** - * merge in new exports - * @param {ExportsInfo} exportsInfo own exports info - * @param {(ExportSpec | string)[]} exports list of exports - */ - const mergeExports = (exportsInfo, exports) => { - for (const exportNameOrSpec of exports) { - let name; - let canMangle = globalCanMangle; - let terminalBinding = globalTerminalBinding; - let exports = undefined; - let from = globalFrom; - let fromExport = undefined; - let priority = globalPriority; - let hidden = false; - if (typeof exportNameOrSpec === "string") { - name = exportNameOrSpec; - } else { - name = exportNameOrSpec.name; - if (exportNameOrSpec.canMangle !== undefined) - canMangle = exportNameOrSpec.canMangle; - if (exportNameOrSpec.export !== undefined) - fromExport = exportNameOrSpec.export; - if (exportNameOrSpec.exports !== undefined) - exports = exportNameOrSpec.exports; - if (exportNameOrSpec.from !== undefined) - from = exportNameOrSpec.from; - if (exportNameOrSpec.priority !== undefined) - priority = exportNameOrSpec.priority; - if (exportNameOrSpec.terminalBinding !== undefined) - terminalBinding = exportNameOrSpec.terminalBinding; - if (exportNameOrSpec.hidden !== undefined) - hidden = exportNameOrSpec.hidden; - } - const exportInfo = exportsInfo.getExportInfo(name); + this.idle = false; + run(); + }); + } else { + run(); + } + } - if ( - exportInfo.provided === false || - exportInfo.provided === null - ) { - exportInfo.provided = true; - changed = true; - } + /** + * @param {RunAsChildCallback} callback signals when the call finishes + * @returns {void} + */ + runAsChild(callback) { + const startTime = Date.now(); + this.compile((err, compilation) => { + if (err) return callback(err); - if ( - exportInfo.canMangleProvide !== false && - canMangle === false - ) { - exportInfo.canMangleProvide = false; - changed = true; - } + this.parentCompilation.children.push(compilation); + for (const { name, source, info } of compilation.getAssets()) { + this.parentCompilation.emitAsset(name, source, info); + } - if (terminalBinding && !exportInfo.terminalBinding) { - exportInfo.terminalBinding = true; - changed = true; - } + const entries = []; + for (const ep of compilation.entrypoints.values()) { + entries.push(...ep.chunks); + } - if (exports) { - const nestedExportsInfo = - exportInfo.createNestedExportsInfo(); - mergeExports(nestedExportsInfo, exports); - } + compilation.startTime = startTime; + compilation.endTime = Date.now(); - if ( - from && - (hidden - ? exportInfo.unsetTarget(dep) - : exportInfo.setTarget( - dep, - from, - fromExport === undefined ? [name] : fromExport, - priority - )) - ) { - changed = true; - } + return callback(null, entries, compilation); + }); + } - // Recalculate target exportsInfo - const target = exportInfo.getTarget(moduleGraph); - let targetExportsInfo = undefined; - if (target) { - const targetModuleExportsInfo = - moduleGraph.getExportsInfo(target.module); - targetExportsInfo = - targetModuleExportsInfo.getNestedExportsInfo( - target.export - ); - // add dependency for this module - const set = dependencies.get(target.module); - if (set === undefined) { - dependencies.set(target.module, new Set([module])); - } else { - set.add(module); - } - } + purgeInputFileSystem() { + if (this.inputFileSystem && this.inputFileSystem.purge) { + this.inputFileSystem.purge(); + } + } - if (exportInfo.exportsInfoOwned) { - if ( - exportInfo.exportsInfo.setRedirectNamedTo( - targetExportsInfo - ) - ) { - changed = true; - } - } else if ( - exportInfo.exportsInfo !== targetExportsInfo - ) { - exportInfo.exportsInfo = targetExportsInfo; - changed = true; - } - } - }; - mergeExports(exportsInfo, exports); - } - // store dependencies - if (exportDeps) { - cacheable = false; - for (const exportDependency of exportDeps) { - // add dependency for this module - const set = dependencies.get(exportDependency); - if (set === undefined) { - dependencies.set(exportDependency, new Set([module])); - } else { - set.add(module); - } - } - } - }; + /** + * @param {Compilation} compilation the compilation + * @param {Callback} callback signals when the assets are emitted + * @returns {void} + */ + emitAssets(compilation, callback) { + let outputPath; - const notifyDependencies = () => { - const deps = dependencies.get(module); - if (deps !== undefined) { - for (const dep of deps) { - queue.enqueue(dep); - } - } - }; + const emitFiles = err => { + if (err) return callback(err); - logger.time("figure out provided exports"); - while (queue.length > 0) { - module = queue.dequeue(); + const assets = compilation.getAssets(); + compilation.assets = { ...compilation.assets }; + /** @type {Map} */ + const caseInsensitiveMap = new Map(); + /** @type {Set} */ + const allTargetPaths = new Set(); + asyncLib.forEachLimit( + assets, + 15, + ({ name: file, source, info }, callback) => { + let targetFile = file; + let immutable = info.immutable; + const queryStringIdx = targetFile.indexOf("?"); + if (queryStringIdx >= 0) { + targetFile = targetFile.substr(0, queryStringIdx); + // We may remove the hash, which is in the query string + // So we recheck if the file is immutable + // This doesn't cover all cases, but immutable is only a performance optimization anyway + immutable = + immutable && + (includesHash(targetFile, info.contenthash) || + includesHash(targetFile, info.chunkhash) || + includesHash(targetFile, info.modulehash) || + includesHash(targetFile, info.fullhash)); + } - statQueueItemsProcessed++; + const writeOut = err => { + if (err) return callback(err); + const targetPath = join( + this.outputFileSystem, + outputPath, + targetFile + ); + allTargetPaths.add(targetPath); - exportsInfo = moduleGraph.getExportsInfo(module); + // check if the target file has already been written by this Compiler + const targetFileGeneration = + this._assetEmittingWrittenFiles.get(targetPath); - cacheable = true; - changed = false; + // create an cache entry for this Source if not already existing + let cacheEntry = this._assetEmittingSourceCache.get(source); + if (cacheEntry === undefined) { + cacheEntry = { + sizeOnlySource: undefined, + writtenTo: new Map() + }; + this._assetEmittingSourceCache.set(source, cacheEntry); + } - exportsSpecsFromDependencies.clear(); - moduleGraph.freeze(); - processDependenciesBlock(module); - moduleGraph.unfreeze(); - for (const [ - dep, - exportsSpec - ] of exportsSpecsFromDependencies) { - processExportsSpec(dep, exportsSpec); - } + let similarEntry; - if (cacheable) { - modulesToStore.add(module); + const checkSimilarFile = () => { + const caseInsensitiveTargetPath = targetPath.toLowerCase(); + similarEntry = caseInsensitiveMap.get(caseInsensitiveTargetPath); + if (similarEntry !== undefined) { + const { path: other, source: otherSource } = similarEntry; + if (isSourceEqual(otherSource, source)) { + // Size may or may not be available at this point. + // If it's not available add to "waiting" list and it will be updated once available + if (similarEntry.size !== undefined) { + updateWithReplacementSource(similarEntry.size); + } else { + if (!similarEntry.waiting) similarEntry.waiting = []; + similarEntry.waiting.push({ file, cacheEntry }); } + alreadyWritten(); + } else { + const err = + new WebpackError(`Prevent writing to file that only differs in casing or query string from already written file. +This will lead to a race-condition and corrupted files on case-insensitive file systems. +${targetPath} +${other}`); + err.file = file; + callback(err); + } + return true; + } else { + caseInsensitiveMap.set( + caseInsensitiveTargetPath, + (similarEntry = { + path: targetPath, + source, + size: undefined, + waiting: undefined + }) + ); + return false; + } + }; - if (changed) { - notifyDependencies(); - } + /** + * get the binary (Buffer) content from the Source + * @returns {Buffer} content for the source + */ + const getContent = () => { + if (typeof source.buffer === "function") { + return source.buffer(); + } else { + const bufferOrString = source.source(); + if (Buffer.isBuffer(bufferOrString)) { + return bufferOrString; + } else { + return Buffer.from(bufferOrString, "utf8"); } - logger.timeEnd("figure out provided exports"); + } + }; - logger.log( - `${Math.round( - (100 * (statFlaggedUncached + statNotCached)) / - (statRestoredFromMemCache + - statRestoredFromCache + - statNotCached + - statFlaggedUncached + - statNoExports) - )}% of exports of modules have been determined (${statNoExports} no declared exports, ${statNotCached} not cached, ${statFlaggedUncached} flagged uncacheable, ${statRestoredFromCache} from cache, ${statRestoredFromMemCache} from mem cache, ${ - statQueueItemsProcessed - - statNotCached - - statFlaggedUncached - } additional calculations due to dependencies)` - ); + const alreadyWritten = () => { + // cache the information that the Source has been already been written to that location + if (targetFileGeneration === undefined) { + const newGeneration = 1; + this._assetEmittingWrittenFiles.set(targetPath, newGeneration); + cacheEntry.writtenTo.set(targetPath, newGeneration); + } else { + cacheEntry.writtenTo.set(targetPath, targetFileGeneration); + } + callback(); + }; - logger.time("store provided exports into cache"); - asyncLib.each( - modulesToStore, - (module, callback) => { - if (typeof module.buildInfo.hash !== "string") { - // not cacheable - return callback(); - } - const cachedData = moduleGraph - .getExportsInfo(module) - .getRestoreProvidedData(); - const memCache = - moduleMemCaches && moduleMemCaches.get(module); - if (memCache) { - memCache.set(this, cachedData); - } - cache.store( - module.identifier(), - module.buildInfo.hash, - cachedData, - callback - ); + /** + * Write the file to output file system + * @param {Buffer} content content to be written + * @returns {void} + */ + const doWrite = content => { + this.outputFileSystem.writeFile(targetPath, content, err => { + if (err) return callback(err); + + // information marker that the asset has been emitted + compilation.emittedAssets.add(file); + + // cache the information that the Source has been written to that location + const newGeneration = + targetFileGeneration === undefined + ? 1 + : targetFileGeneration + 1; + cacheEntry.writtenTo.set(targetPath, newGeneration); + this._assetEmittingWrittenFiles.set(targetPath, newGeneration); + this.hooks.assetEmitted.callAsync( + file, + { + content, + source, + outputPath, + compilation, + targetPath }, - err => { - logger.timeEnd("store provided exports into cache"); - callback(err); - } + callback ); - } - ); - } - ); + }); + }; - /** @type {WeakMap} */ - const providedExportsCache = new WeakMap(); - compilation.hooks.rebuildModule.tap( - "FlagDependencyExportsPlugin", - module => { - providedExportsCache.set( - module, - moduleGraph.getExportsInfo(module).getRestoreProvidedData() - ); - } - ); - compilation.hooks.finishRebuildingModule.tap( - "FlagDependencyExportsPlugin", - module => { - moduleGraph - .getExportsInfo(module) - .restoreProvided(providedExportsCache.get(module)); - } - ); - } - ); - } -} + const updateWithReplacementSource = size => { + updateFileWithReplacementSource(file, cacheEntry, size); + similarEntry.size = size; + if (similarEntry.waiting !== undefined) { + for (const { file, cacheEntry } of similarEntry.waiting) { + updateFileWithReplacementSource(file, cacheEntry, size); + } + } + }; -module.exports = FlagDependencyExportsPlugin; + const updateFileWithReplacementSource = ( + file, + cacheEntry, + size + ) => { + // Create a replacement resource which only allows to ask for size + // This allows to GC all memory allocated by the Source + // (expect when the Source is stored in any other cache) + if (!cacheEntry.sizeOnlySource) { + cacheEntry.sizeOnlySource = new SizeOnlySource(size); + } + compilation.updateAsset(file, cacheEntry.sizeOnlySource, { + size + }); + }; + const processExistingFile = stats => { + // skip emitting if it's already there and an immutable file + if (immutable) { + updateWithReplacementSource(stats.size); + return alreadyWritten(); + } -/***/ }), + const content = getContent(); -/***/ 58812: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + updateWithReplacementSource(content.length); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // if it exists and content on disk matches content + // skip writing the same content again + // (to keep mtime and don't trigger watchers) + // for a fast negative match file size is compared first + if (content.length === stats.size) { + compilation.comparedForEmitAssets.add(file); + return this.outputFileSystem.readFile( + targetPath, + (err, existingContent) => { + if ( + err || + !content.equals(/** @type {Buffer} */ (existingContent)) + ) { + return doWrite(content); + } else { + return alreadyWritten(); + } + } + ); + } + return doWrite(content); + }; + const processMissingFile = () => { + const content = getContent(); -const Dependency = __webpack_require__(54912); -const { UsageState } = __webpack_require__(63686); -const ModuleGraphConnection = __webpack_require__(40639); -const { STAGE_DEFAULT } = __webpack_require__(80057); -const ArrayQueue = __webpack_require__(41792); -const TupleQueue = __webpack_require__(38415); -const { getEntryRuntime, mergeRuntimeOwned } = __webpack_require__(17156); + updateWithReplacementSource(content.length); -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGroup")} ChunkGroup */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ -/** @typedef {import("./Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("./ExportsInfo")} ExportsInfo */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ + return doWrite(content); + }; -const { NO_EXPORTS_REFERENCED, EXPORTS_OBJECT_REFERENCED } = Dependency; + // if the target file has already been written + if (targetFileGeneration !== undefined) { + // check if the Source has been written to this target file + const writtenGeneration = cacheEntry.writtenTo.get(targetPath); + if (writtenGeneration === targetFileGeneration) { + // if yes, we may skip writing the file + // if it's already there + // (we assume one doesn't modify files while the Compiler is running, other then removing them) -class FlagDependencyUsagePlugin { - /** - * @param {boolean} global do a global analysis instead of per runtime - */ - constructor(global) { - this.global = global; - } - - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap("FlagDependencyUsagePlugin", compilation => { - const moduleGraph = compilation.moduleGraph; - compilation.hooks.optimizeDependencies.tap( - { - name: "FlagDependencyUsagePlugin", - stage: STAGE_DEFAULT - }, - modules => { - if (compilation.moduleMemCaches) { - throw new Error( - "optimization.usedExports can't be used with cacheUnaffected as export usage is a global effect" - ); - } - - const logger = compilation.getLogger( - "webpack.FlagDependencyUsagePlugin" - ); - /** @type {Map} */ - const exportInfoToModuleMap = new Map(); - - /** @type {TupleQueue<[Module, RuntimeSpec]>} */ - const queue = new TupleQueue(); + if (this._assetEmittingPreviousFiles.has(targetPath)) { + // We assume that assets from the last compilation say intact on disk (they are not removed) + compilation.updateAsset(file, cacheEntry.sizeOnlySource, { + size: cacheEntry.sizeOnlySource.size() + }); - /** - * @param {Module} module module to process - * @param {(string[] | ReferencedExport)[]} usedExports list of used exports - * @param {RuntimeSpec} runtime part of which runtime - * @param {boolean} forceSideEffects always apply side effects - * @returns {void} - */ - const processReferencedModule = ( - module, - usedExports, - runtime, - forceSideEffects - ) => { - const exportsInfo = moduleGraph.getExportsInfo(module); - if (usedExports.length > 0) { - if (!module.buildMeta || !module.buildMeta.exportsType) { - if (exportsInfo.setUsedWithoutInfo(runtime)) { - queue.enqueue(module, runtime); - } - return; - } - for (const usedExportInfo of usedExports) { - let usedExport; - let canMangle = true; - if (Array.isArray(usedExportInfo)) { - usedExport = usedExportInfo; - } else { - usedExport = usedExportInfo.name; - canMangle = usedExportInfo.canMangle !== false; - } - if (usedExport.length === 0) { - if (exportsInfo.setUsedInUnknownWay(runtime)) { - queue.enqueue(module, runtime); - } + return callback(); } else { - let currentExportsInfo = exportsInfo; - for (let i = 0; i < usedExport.length; i++) { - const exportInfo = currentExportsInfo.getExportInfo( - usedExport[i] - ); - if (canMangle === false) { - exportInfo.canMangleUse = false; - } - const lastOne = i === usedExport.length - 1; - if (!lastOne) { - const nestedInfo = exportInfo.getNestedExportsInfo(); - if (nestedInfo) { - if ( - exportInfo.setUsedConditionally( - used => used === UsageState.Unused, - UsageState.OnlyPropertiesUsed, - runtime - ) - ) { - const currentModule = - currentExportsInfo === exportsInfo - ? module - : exportInfoToModuleMap.get(currentExportsInfo); - if (currentModule) { - queue.enqueue(currentModule, runtime); - } - } - currentExportsInfo = nestedInfo; - continue; - } - } - if ( - exportInfo.setUsedConditionally( - v => v !== UsageState.Used, - UsageState.Used, - runtime - ) - ) { - const currentModule = - currentExportsInfo === exportsInfo - ? module - : exportInfoToModuleMap.get(currentExportsInfo); - if (currentModule) { - queue.enqueue(currentModule, runtime); - } - } - break; - } + // Settings immutable will make it accept file content without comparing when file exist + immutable = true; } - } - } else { - // for a module without side effects we stop tracking usage here when no export is used - // This module won't be evaluated in this case - // TODO webpack 6 remove this check - if ( - !forceSideEffects && - module.factoryMeta !== undefined && - module.factoryMeta.sideEffectFree - ) { - return; - } - if (exportsInfo.setUsedForSideEffectsOnly(runtime)) { - queue.enqueue(module, runtime); + } else if (!immutable) { + if (checkSimilarFile()) return; + // We wrote to this file before which has very likely a different content + // skip comparing and assume content is different for performance + // This case happens often during watch mode. + return processMissingFile(); } } - }; - /** - * @param {DependenciesBlock} module the module - * @param {RuntimeSpec} runtime part of which runtime - * @param {boolean} forceSideEffects always apply side effects - * @returns {void} - */ - const processModule = (module, runtime, forceSideEffects) => { - /** @type {Map>} */ - const map = new Map(); + if (checkSimilarFile()) return; + if (this.options.output.compareBeforeEmit) { + this.outputFileSystem.stat(targetPath, (err, stats) => { + const exists = !err && stats.isFile(); - /** @type {ArrayQueue} */ - const queue = new ArrayQueue(); - queue.enqueue(module); - for (;;) { - const block = queue.dequeue(); - if (block === undefined) break; - for (const b of block.blocks) { - if ( - !this.global && - b.groupOptions && - b.groupOptions.entryOptions - ) { - processModule( - b, - b.groupOptions.entryOptions.runtime || undefined, - true - ); - } else { - queue.enqueue(b); - } - } - for (const dep of block.dependencies) { - const connection = moduleGraph.getConnection(dep); - if (!connection || !connection.module) { - continue; - } - const activeState = connection.getActiveState(runtime); - if (activeState === false) continue; - const { module } = connection; - if (activeState === ModuleGraphConnection.TRANSITIVE_ONLY) { - processModule(module, runtime, false); - continue; - } - const oldReferencedExports = map.get(module); - if (oldReferencedExports === EXPORTS_OBJECT_REFERENCED) { - continue; - } - const referencedExports = - compilation.getDependencyReferencedExports(dep, runtime); - if ( - oldReferencedExports === undefined || - oldReferencedExports === NO_EXPORTS_REFERENCED || - referencedExports === EXPORTS_OBJECT_REFERENCED - ) { - map.set(module, referencedExports); - } else if ( - oldReferencedExports !== undefined && - referencedExports === NO_EXPORTS_REFERENCED - ) { - continue; + if (exists) { + processExistingFile(stats); } else { - let exportsMap; - if (Array.isArray(oldReferencedExports)) { - exportsMap = new Map(); - for (const item of oldReferencedExports) { - if (Array.isArray(item)) { - exportsMap.set(item.join("\n"), item); - } else { - exportsMap.set(item.name.join("\n"), item); - } - } - map.set(module, exportsMap); - } else { - exportsMap = oldReferencedExports; - } - for (const item of referencedExports) { - if (Array.isArray(item)) { - const key = item.join("\n"); - const oldItem = exportsMap.get(key); - if (oldItem === undefined) { - exportsMap.set(key, item); - } - // if oldItem is already an array we have to do nothing - // if oldItem is an ReferencedExport object, we don't have to do anything - // as canMangle defaults to true for arrays - } else { - const key = item.name.join("\n"); - const oldItem = exportsMap.get(key); - if (oldItem === undefined || Array.isArray(oldItem)) { - exportsMap.set(key, item); - } else { - exportsMap.set(key, { - name: item.name, - canMangle: item.canMangle && oldItem.canMangle - }); - } - } - } + processMissingFile(); } - } - } - - for (const [module, referencedExports] of map) { - if (Array.isArray(referencedExports)) { - processReferencedModule( - module, - referencedExports, - runtime, - forceSideEffects - ); - } else { - processReferencedModule( - module, - Array.from(referencedExports.values()), - runtime, - forceSideEffects - ); - } + }); + } else { + processMissingFile(); } }; - logger.time("initialize exports usage"); - for (const module of modules) { - const exportsInfo = moduleGraph.getExportsInfo(module); - exportInfoToModuleMap.set(exportsInfo, module); - exportsInfo.setHasUseInfo(); + if (targetFile.match(/\/|\\/)) { + const fs = this.outputFileSystem; + const dir = dirname(fs, join(fs, outputPath, targetFile)); + mkdirp(fs, dir, writeOut); + } else { + writeOut(); + } + }, + err => { + // Clear map to free up memory + caseInsensitiveMap.clear(); + if (err) { + this._assetEmittingPreviousFiles.clear(); + return callback(err); } - logger.timeEnd("initialize exports usage"); - logger.time("trace exports usage in graph"); + this._assetEmittingPreviousFiles = allTargetPaths; - /** - * @param {Dependency} dep dependency - * @param {RuntimeSpec} runtime runtime - */ - const processEntryDependency = (dep, runtime) => { - const module = moduleGraph.getModule(dep); - if (module) { - processReferencedModule( - module, - NO_EXPORTS_REFERENCED, - runtime, - true - ); - } - }; - /** @type {RuntimeSpec} */ - let globalRuntime = undefined; - for (const [ - entryName, - { dependencies: deps, includeDependencies: includeDeps, options } - ] of compilation.entries) { - const runtime = this.global - ? undefined - : getEntryRuntime(compilation, entryName, options); - for (const dep of deps) { - processEntryDependency(dep, runtime); - } - for (const dep of includeDeps) { - processEntryDependency(dep, runtime); - } - globalRuntime = mergeRuntimeOwned(globalRuntime, runtime); - } - for (const dep of compilation.globalEntry.dependencies) { - processEntryDependency(dep, globalRuntime); - } - for (const dep of compilation.globalEntry.includeDependencies) { - processEntryDependency(dep, globalRuntime); - } + this.hooks.afterEmit.callAsync(compilation, err => { + if (err) return callback(err); - while (queue.length) { - const [module, runtime] = queue.dequeue(); - processModule(module, runtime, false); - } - logger.timeEnd("trace exports usage in graph"); + return callback(); + }); } ); - }); - } -} - -module.exports = FlagDependencyUsagePlugin; - - -/***/ }), - -/***/ 93401: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./ConcatenationScope")} ConcatenationScope */ -/** @typedef {import("./DependencyTemplate")} DependencyTemplate */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./NormalModule")} NormalModule */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./util/Hash")} Hash */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - -/** - * @typedef {Object} GenerateContext - * @property {DependencyTemplates} dependencyTemplates mapping from dependencies to templates - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {Set} runtimeRequirements the requirements for runtime - * @property {RuntimeSpec} runtime the runtime - * @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules - * @property {CodeGenerationResults=} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that) - * @property {string} type which kind of code should be generated - * @property {function(): Map=} getData get access to the code generation data - */ - -/** - * @typedef {Object} UpdateHashContext - * @property {NormalModule} module the module - * @property {ChunkGraph} chunkGraph - * @property {RuntimeSpec} runtime - */ + }; -/** - * - */ -class Generator { - static byType(map) { - return new ByTypeGenerator(map); + this.hooks.emit.callAsync(compilation, err => { + if (err) return callback(err); + outputPath = compilation.getPath(this.outputPath, {}); + mkdirp(this.outputFileSystem, outputPath, emitFiles); + }); } - /* istanbul ignore next */ /** - * @abstract - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) + * @param {Callback} callback signals when the call finishes + * @returns {void} */ - getTypes(module) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + emitRecords(callback) { + if (this.hooks.emitRecords.isUsed()) { + if (this.recordsOutputPath) { + asyncLib.parallel( + [ + cb => this.hooks.emitRecords.callAsync(cb), + this._emitRecords.bind(this) + ], + err => callback(err) + ); + } else { + this.hooks.emitRecords.callAsync(callback); + } + } else { + if (this.recordsOutputPath) { + this._emitRecords(callback); + } else { + callback(); + } + } } - /* istanbul ignore next */ /** - * @abstract - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module + * @param {Callback} callback signals when the call finishes + * @returns {void} */ - getSize(module, type) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + _emitRecords(callback) { + const writeFile = () => { + this.outputFileSystem.writeFile( + this.recordsOutputPath, + JSON.stringify( + this.records, + (n, value) => { + if ( + typeof value === "object" && + value !== null && + !Array.isArray(value) + ) { + const keys = Object.keys(value); + if (!isSorted(keys)) { + return sortObject(value, keys); + } + } + return value; + }, + 2 + ), + callback + ); + }; + + const recordsOutputPathDirectory = dirname( + this.outputFileSystem, + this.recordsOutputPath + ); + if (!recordsOutputPathDirectory) { + return writeFile(); + } + mkdirp(this.outputFileSystem, recordsOutputPathDirectory, err => { + if (err) return callback(err); + writeFile(); + }); } - /* istanbul ignore next */ /** - * @abstract - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code + * @param {Callback} callback signals when the call finishes + * @returns {void} */ - generate( - module, - { dependencyTemplates, runtimeTemplate, moduleGraph, type } - ) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + readRecords(callback) { + if (this.hooks.readRecords.isUsed()) { + if (this.recordsInputPath) { + asyncLib.parallel([ + cb => this.hooks.readRecords.callAsync(cb), + this._readRecords.bind(this) + ]); + } else { + this.records = {}; + this.hooks.readRecords.callAsync(callback); + } + } else { + if (this.recordsInputPath) { + this._readRecords(callback); + } else { + this.records = {}; + callback(); + } + } } /** - * @param {NormalModule} module module for which the bailout reason should be determined - * @param {ConcatenationBailoutReasonContext} context context - * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated + * @param {Callback} callback signals when the call finishes + * @returns {void} */ - getConcatenationBailoutReason(module, context) { - return `Module Concatenation is not implemented for ${this.constructor.name}`; + _readRecords(callback) { + if (!this.recordsInputPath) { + this.records = {}; + return callback(); + } + this.inputFileSystem.stat(this.recordsInputPath, err => { + // It doesn't exist + // We can ignore this. + if (err) return callback(); + + this.inputFileSystem.readFile(this.recordsInputPath, (err, content) => { + if (err) return callback(err); + + try { + this.records = parseJson(content.toString("utf-8")); + } catch (e) { + e.message = "Cannot parse records: " + e.message; + return callback(e); + } + + return callback(); + }); + }); } /** - * @param {Hash} hash hash that will be modified - * @param {UpdateHashContext} updateHashContext context for updating hash + * @param {Compilation} compilation the compilation + * @param {string} compilerName the compiler's name + * @param {number} compilerIndex the compiler's index + * @param {OutputOptions=} outputOptions the output options + * @param {WebpackPluginInstance[]=} plugins the plugins to apply + * @returns {Compiler} a child compiler */ - updateHash(hash, { module, runtime }) { - // no nothing + createChildCompiler( + compilation, + compilerName, + compilerIndex, + outputOptions, + plugins + ) { + const childCompiler = new Compiler(this.context, { + ...this.options, + output: { + ...this.options.output, + ...outputOptions + } + }); + childCompiler.name = compilerName; + childCompiler.outputPath = this.outputPath; + childCompiler.inputFileSystem = this.inputFileSystem; + childCompiler.outputFileSystem = null; + childCompiler.resolverFactory = this.resolverFactory; + childCompiler.modifiedFiles = this.modifiedFiles; + childCompiler.removedFiles = this.removedFiles; + childCompiler.fileTimestamps = this.fileTimestamps; + childCompiler.contextTimestamps = this.contextTimestamps; + childCompiler.fsStartTime = this.fsStartTime; + childCompiler.cache = this.cache; + childCompiler.compilerPath = `${this.compilerPath}${compilerName}|${compilerIndex}|`; + childCompiler._backCompat = this._backCompat; + + const relativeCompilerName = makePathsRelative( + this.context, + compilerName, + this.root + ); + if (!this.records[relativeCompilerName]) { + this.records[relativeCompilerName] = []; + } + if (this.records[relativeCompilerName][compilerIndex]) { + childCompiler.records = this.records[relativeCompilerName][compilerIndex]; + } else { + this.records[relativeCompilerName].push((childCompiler.records = {})); + } + + childCompiler.parentCompilation = compilation; + childCompiler.root = this.root; + if (Array.isArray(plugins)) { + for (const plugin of plugins) { + plugin.apply(childCompiler); + } + } + for (const name in this.hooks) { + if ( + ![ + "make", + "compile", + "emit", + "afterEmit", + "invalid", + "done", + "thisCompilation" + ].includes(name) + ) { + if (childCompiler.hooks[name]) { + childCompiler.hooks[name].taps = this.hooks[name].taps.slice(); + } + } + } + + compilation.hooks.childCompiler.call( + childCompiler, + compilerName, + compilerIndex + ); + + return childCompiler; } -} -class ByTypeGenerator extends Generator { - constructor(map) { - super(); - this.map = map; - this._types = new Set(Object.keys(map)); + isChild() { + return !!this.parentCompilation; + } + + createCompilation(params) { + this._cleanupLastCompilation(); + return (this._lastCompilation = new Compilation(this, params)); } /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) + * @param {CompilationParams} params the compilation parameters + * @returns {Compilation} the created compilation */ - getTypes(module) { - return this._types; + newCompilation(params) { + const compilation = this.createCompilation(params); + compilation.name = this.name; + compilation.records = this.records; + this.hooks.thisCompilation.call(compilation, params); + this.hooks.compilation.call(compilation, params); + return compilation; + } + + createNormalModuleFactory() { + this._cleanupLastNormalModuleFactory(); + const normalModuleFactory = new NormalModuleFactory({ + context: this.options.context, + fs: this.inputFileSystem, + resolverFactory: this.resolverFactory, + options: this.options.module, + associatedObjectForCache: this.root, + layers: this.options.experiments.layers + }); + this._lastNormalModuleFactory = normalModuleFactory; + this.hooks.normalModuleFactory.call(normalModuleFactory); + return normalModuleFactory; + } + + createContextModuleFactory() { + const contextModuleFactory = new ContextModuleFactory(this.resolverFactory); + this.hooks.contextModuleFactory.call(contextModuleFactory); + return contextModuleFactory; + } + + newCompilationParams() { + const params = { + normalModuleFactory: this.createNormalModuleFactory(), + contextModuleFactory: this.createContextModuleFactory() + }; + return params; } /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module + * @param {Callback} callback signals when the compilation finishes + * @returns {void} */ - getSize(module, type) { - const t = type || "javascript"; - const generator = this.map[t]; - return generator ? generator.getSize(module, t) : 0; + compile(callback) { + const params = this.newCompilationParams(); + this.hooks.beforeCompile.callAsync(params, err => { + if (err) return callback(err); + + this.hooks.compile.call(params); + + const compilation = this.newCompilation(params); + + const logger = compilation.getLogger("webpack.Compiler"); + + logger.time("make hook"); + this.hooks.make.callAsync(compilation, err => { + logger.timeEnd("make hook"); + if (err) return callback(err); + + logger.time("finish make hook"); + this.hooks.finishMake.callAsync(compilation, err => { + logger.timeEnd("finish make hook"); + if (err) return callback(err); + + process.nextTick(() => { + logger.time("finish compilation"); + compilation.finish(err => { + logger.timeEnd("finish compilation"); + if (err) return callback(err); + + logger.time("seal compilation"); + compilation.seal(err => { + logger.timeEnd("seal compilation"); + if (err) return callback(err); + + logger.time("afterCompile hook"); + this.hooks.afterCompile.callAsync(compilation, err => { + logger.timeEnd("afterCompile hook"); + if (err) return callback(err); + + return callback(null, compilation); + }); + }); + }); + }); + }); + }); + }); } /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code + * @param {Callback} callback signals when the compiler closes + * @returns {void} */ - generate(module, generateContext) { - const type = generateContext.type; - const generator = this.map[type]; - if (!generator) { - throw new Error(`Generator.byType: no generator specified for ${type}`); + close(callback) { + if (this.watching) { + // When there is still an active watching, close this first + this.watching.close(err => { + this.close(callback); + }); + return; } - return generator.generate(module, generateContext); + this.hooks.shutdown.callAsync(err => { + if (err) return callback(err); + // Get rid of reference to last compilation to avoid leaking memory + // We can't run this._cleanupLastCompilation() as the Stats to this compilation + // might be still in use. We try to get rid of the reference to the cache instead. + this._lastCompilation = undefined; + this._lastNormalModuleFactory = undefined; + this.cache.shutdown(callback); + }); } } -module.exports = Generator; +module.exports = Compiler; /***/ }), -/***/ 37234: -/***/ (function(__unused_webpack_module, exports) { +/***/ 98229: +/***/ (function(module) { "use strict"; /* @@ -41552,166 +36031,309 @@ module.exports = Generator; -/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGroup")} ChunkGroup */ -/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ /** @typedef {import("./Module")} Module */ +const MODULE_REFERENCE_REGEXP = + /^__WEBPACK_MODULE_REFERENCE__(\d+)_([\da-f]+|ns)(_call)?(_directImport)?(?:_asiSafe(\d))?__$/; + +const DEFAULT_EXPORT = "__WEBPACK_DEFAULT_EXPORT__"; +const NAMESPACE_OBJECT_EXPORT = "__WEBPACK_NAMESPACE_OBJECT__"; + /** - * @param {ChunkGroup} chunkGroup the ChunkGroup to connect - * @param {Chunk} chunk chunk to tie to ChunkGroup - * @returns {void} + * @typedef {Object} ExternalModuleInfo + * @property {number} index + * @property {Module} module */ -const connectChunkGroupAndChunk = (chunkGroup, chunk) => { - if (chunkGroup.pushChunk(chunk)) { - chunk.addGroup(chunkGroup); - } -}; /** - * @param {ChunkGroup} parent parent ChunkGroup to connect - * @param {ChunkGroup} child child ChunkGroup to connect - * @returns {void} + * @typedef {Object} ConcatenatedModuleInfo + * @property {number} index + * @property {Module} module + * @property {Map} exportMap mapping from export name to symbol + * @property {Map} rawExportMap mapping from export name to symbol + * @property {string=} namespaceExportSymbol */ -const connectChunkGroupParentAndChild = (parent, child) => { - if (parent.addChild(child)) { - child.addParent(parent); + +/** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo} ModuleInfo */ + +/** + * @typedef {Object} ModuleReferenceOptions + * @property {string[]} ids the properties/exports of the module + * @property {boolean} call true, when this referenced export is called + * @property {boolean} directImport true, when this referenced export is directly imported (not via property access) + * @property {boolean | undefined} asiSafe if the position is ASI safe or unknown + */ + +class ConcatenationScope { + /** + * @param {ModuleInfo[] | Map} modulesMap all module info by module + * @param {ConcatenatedModuleInfo} currentModule the current module info + */ + constructor(modulesMap, currentModule) { + this._currentModule = currentModule; + if (Array.isArray(modulesMap)) { + const map = new Map(); + for (const info of modulesMap) { + map.set(info.module, info); + } + modulesMap = map; + } + this._modulesMap = modulesMap; } -}; -exports.connectChunkGroupAndChunk = connectChunkGroupAndChunk; -exports.connectChunkGroupParentAndChild = connectChunkGroupParentAndChild; + /** + * @param {Module} module the referenced module + * @returns {boolean} true, when it's in the scope + */ + isModuleInScope(module) { + return this._modulesMap.has(module); + } + + /** + * + * @param {string} exportName name of the export + * @param {string} symbol identifier of the export in source code + */ + registerExport(exportName, symbol) { + if (!this._currentModule.exportMap) { + this._currentModule.exportMap = new Map(); + } + if (!this._currentModule.exportMap.has(exportName)) { + this._currentModule.exportMap.set(exportName, symbol); + } + } + + /** + * + * @param {string} exportName name of the export + * @param {string} expression expression to be used + */ + registerRawExport(exportName, expression) { + if (!this._currentModule.rawExportMap) { + this._currentModule.rawExportMap = new Map(); + } + if (!this._currentModule.rawExportMap.has(exportName)) { + this._currentModule.rawExportMap.set(exportName, expression); + } + } + + /** + * @param {string} symbol identifier of the export in source code + */ + registerNamespaceExport(symbol) { + this._currentModule.namespaceExportSymbol = symbol; + } + + /** + * + * @param {Module} module the referenced module + * @param {Partial} options options + * @returns {string} the reference as identifier + */ + createModuleReference( + module, + { ids = undefined, call = false, directImport = false, asiSafe = false } + ) { + const info = this._modulesMap.get(module); + const callFlag = call ? "_call" : ""; + const directImportFlag = directImport ? "_directImport" : ""; + const asiSafeFlag = asiSafe + ? "_asiSafe1" + : asiSafe === false + ? "_asiSafe0" + : ""; + const exportData = ids + ? Buffer.from(JSON.stringify(ids), "utf-8").toString("hex") + : "ns"; + // a "._" is appended to allow "delete ...", which would cause a SyntaxError in strict mode + return `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportData}${callFlag}${directImportFlag}${asiSafeFlag}__._`; + } + + /** + * @param {string} name the identifier + * @returns {boolean} true, when it's an module reference + */ + static isModuleReference(name) { + return MODULE_REFERENCE_REGEXP.test(name); + } + + /** + * @param {string} name the identifier + * @returns {ModuleReferenceOptions & { index: number }} parsed options and index + */ + static matchModuleReference(name) { + const match = MODULE_REFERENCE_REGEXP.exec(name); + if (!match) return null; + const index = +match[1]; + const asiSafe = match[5]; + return { + index, + ids: + match[2] === "ns" + ? [] + : JSON.parse(Buffer.from(match[2], "hex").toString("utf-8")), + call: !!match[3], + directImport: !!match[4], + asiSafe: asiSafe ? asiSafe === "1" : undefined + }; + } +} + +ConcatenationScope.DEFAULT_EXPORT = DEFAULT_EXPORT; +ConcatenationScope.NAMESPACE_OBJECT_EXPORT = NAMESPACE_OBJECT_EXPORT; + +module.exports = ConcatenationScope; /***/ }), -/***/ 97511: +/***/ 95735: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Maksim Nazarjev @acupofspirt */ const WebpackError = __webpack_require__(53799); -module.exports = class HarmonyLinkingError extends WebpackError { - /** @param {string} message Error message */ - constructor(message) { - super(message); - this.name = "HarmonyLinkingError"; - this.hideStack = true; +module.exports = class ConcurrentCompilationError extends WebpackError { + constructor() { + super(); + + this.name = "ConcurrentCompilationError"; + this.message = + "You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."; } }; /***/ }), -/***/ 11351: +/***/ 61333: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Sean Larkin @thelarkinn + Author Tobias Koppers @sokra */ -const WebpackError = __webpack_require__(53799); +const { ConcatSource, PrefixSource } = __webpack_require__(51255); +const InitFragment = __webpack_require__(55870); +const Template = __webpack_require__(39722); +const { mergeRuntime } = __webpack_require__(17156); -/** @typedef {import("./Module")} Module */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("./Generator").GenerateContext} GenerateContext */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ + +const wrapInCondition = (condition, source) => { + if (typeof source === "string") { + return Template.asString([ + `if (${condition}) {`, + Template.indent(source), + "}", + "" + ]); + } else { + return new ConcatSource( + `if (${condition}) {\n`, + new PrefixSource("\t", source), + "}\n" + ); + } +}; /** - * @template T - * @callback Callback - * @param {Error=} err - * @param {T=} stats - * @returns {void} + * @typedef {GenerateContext} Context */ - -class HookWebpackError extends WebpackError { +class ConditionalInitFragment extends InitFragment { /** - * Creates an instance of HookWebpackError. - * @param {Error} error inner error - * @param {string} hook name of hook + * @param {string|Source} content the source code that will be included as initialization code + * @param {number} stage category of initialization code (contribute to order) + * @param {number} position position in the category (contribute to order) + * @param {string} key unique key to avoid emitting the same initialization code twice + * @param {RuntimeSpec | boolean} runtimeCondition in which runtime this fragment should be executed + * @param {string|Source=} endContent the source code that will be included at the end of the module */ - constructor(error, hook) { - super(error.message); - - this.name = "HookWebpackError"; - this.hook = hook; - this.error = error; - this.hideStack = true; - this.details = `caused by plugins in ${hook}\n${error.stack}`; - - this.stack += `\n-- inner error --\n${error.stack}`; + constructor( + content, + stage, + position, + key, + runtimeCondition = true, + endContent + ) { + super(content, stage, position, key, endContent); + this.runtimeCondition = runtimeCondition; } -} -module.exports = HookWebpackError; - -/** - * @param {Error} error an error - * @param {string} hook name of the hook - * @returns {WebpackError} a webpack error - */ -const makeWebpackError = (error, hook) => { - if (error instanceof WebpackError) return error; - return new HookWebpackError(error, hook); -}; -module.exports.makeWebpackError = makeWebpackError; - -/** - * @template T - * @param {function((WebpackError | null)=, T=): void} callback webpack error callback - * @param {string} hook name of hook - * @returns {Callback} generic callback - */ -const makeWebpackErrorCallback = (callback, hook) => { - return (err, result) => { - if (err) { - if (err instanceof WebpackError) { - callback(err); - return; - } - callback(new HookWebpackError(err, hook)); - return; - } - callback(null, result); - }; -}; + /** + * @param {Context} context context + * @returns {string|Source} the source code that will be included as initialization code + */ + getContent(context) { + if (this.runtimeCondition === false || !this.content) return ""; + if (this.runtimeCondition === true) return this.content; + const expr = context.runtimeTemplate.runtimeConditionExpression({ + chunkGraph: context.chunkGraph, + runtimeRequirements: context.runtimeRequirements, + runtime: context.runtime, + runtimeCondition: this.runtimeCondition + }); + if (expr === "true") return this.content; + return wrapInCondition(expr, this.content); + } -module.exports.makeWebpackErrorCallback = makeWebpackErrorCallback; + /** + * @param {Context} context context + * @returns {string|Source=} the source code that will be included at the end of the module + */ + getEndContent(context) { + if (this.runtimeCondition === false || !this.endContent) return ""; + if (this.runtimeCondition === true) return this.endContent; + const expr = context.runtimeTemplate.runtimeConditionExpression({ + chunkGraph: context.chunkGraph, + runtimeRequirements: context.runtimeRequirements, + runtime: context.runtime, + runtimeCondition: this.runtimeCondition + }); + if (expr === "true") return this.endContent; + return wrapInCondition(expr, this.endContent); + } -/** - * @template T - * @param {function(): T} fn function which will be wrapping in try catch - * @param {string} hook name of hook - * @returns {T} the result - */ -const tryRunOrWebpackError = (fn, hook) => { - let r; - try { - r = fn(); - } catch (err) { - if (err instanceof WebpackError) { - throw err; - } - throw new HookWebpackError(err, hook); + merge(other) { + if (this.runtimeCondition === true) return this; + if (other.runtimeCondition === true) return other; + if (this.runtimeCondition === false) return other; + if (other.runtimeCondition === false) return this; + const runtimeCondition = mergeRuntime( + this.runtimeCondition, + other.runtimeCondition + ); + return new ConditionalInitFragment( + this.content, + this.stage, + this.position, + this.key, + runtimeCondition, + this.endContent + ); } - return r; -}; +} -module.exports.tryRunOrWebpackError = tryRunOrWebpackError; +module.exports = ConditionalInitFragment; /***/ }), -/***/ 6404: +/***/ 11146: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -41722,1549 +36344,1632 @@ module.exports.tryRunOrWebpackError = tryRunOrWebpackError; -const { SyncBailHook } = __webpack_require__(6967); -const { RawSource } = __webpack_require__(51255); -const ChunkGraph = __webpack_require__(64971); -const Compilation = __webpack_require__(85720); -const HotUpdateChunk = __webpack_require__(9597); -const NormalModule = __webpack_require__(39); -const RuntimeGlobals = __webpack_require__(16475); -const WebpackError = __webpack_require__(53799); +const CachedConstDependency = __webpack_require__(57403); const ConstDependency = __webpack_require__(76911); -const ImportMetaHotAcceptDependency = __webpack_require__(51274); -const ImportMetaHotDeclineDependency = __webpack_require__(53141); -const ModuleHotAcceptDependency = __webpack_require__(47511); -const ModuleHotDeclineDependency = __webpack_require__(86301); -const HotModuleReplacementRuntimeModule = __webpack_require__(27899); -const JavascriptParser = __webpack_require__(29050); -const { - evaluateToIdentifier -} = __webpack_require__(93998); -const { find, isSubset } = __webpack_require__(93347); -const TupleSet = __webpack_require__(76455); -const { compareModulesById } = __webpack_require__(29579); -const { - getRuntimeKey, - keyToRuntime, - forEachRuntime, - mergeRuntimeOwned, - subtractRuntime, - intersectRuntime -} = __webpack_require__(17156); +const { evaluateToString } = __webpack_require__(93998); +const { parseResource } = __webpack_require__(82186); -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("estree").Expression} ExpressionNode */ +/** @typedef {import("estree").Super} SuperNode */ /** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./RuntimeModule")} RuntimeModule */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - -/** - * @typedef {Object} HMRJavascriptParserHooks - * @property {SyncBailHook<[TODO, string[]], void>} hotAcceptCallback - * @property {SyncBailHook<[TODO, string[]], void>} hotAcceptWithoutCallback - */ - -/** @type {WeakMap} */ -const parserHooksMap = new WeakMap(); -class HotModuleReplacementPlugin { - /** - * @param {JavascriptParser} parser the parser - * @returns {HMRJavascriptParserHooks} the attached hooks - */ - static getParserHooks(parser) { - if (!(parser instanceof JavascriptParser)) { - throw new TypeError( - "The 'parser' argument must be an instance of JavascriptParser" - ); - } - let hooks = parserHooksMap.get(parser); - if (hooks === undefined) { - hooks = { - hotAcceptCallback: new SyncBailHook(["expression", "requests"]), - hotAcceptWithoutCallback: new SyncBailHook(["expression", "requests"]) - }; - parserHooksMap.set(parser, hooks); +const collectDeclaration = (declarations, pattern) => { + const stack = [pattern]; + while (stack.length > 0) { + const node = stack.pop(); + switch (node.type) { + case "Identifier": + declarations.add(node.name); + break; + case "ArrayPattern": + for (const element of node.elements) { + if (element) { + stack.push(element); + } + } + break; + case "AssignmentPattern": + stack.push(node.left); + break; + case "ObjectPattern": + for (const property of node.properties) { + stack.push(property.value); + } + break; + case "RestElement": + stack.push(node.argument); + break; } - return hooks; } +}; - constructor(options) { - this.options = options || {}; +const getHoistedDeclarations = (branch, includeFunctionDeclarations) => { + const declarations = new Set(); + const stack = [branch]; + while (stack.length > 0) { + const node = stack.pop(); + // Some node could be `null` or `undefined`. + if (!node) continue; + switch (node.type) { + // Walk through control statements to look for hoisted declarations. + // Some branches are skipped since they do not allow declarations. + case "BlockStatement": + for (const stmt of node.body) { + stack.push(stmt); + } + break; + case "IfStatement": + stack.push(node.consequent); + stack.push(node.alternate); + break; + case "ForStatement": + stack.push(node.init); + stack.push(node.body); + break; + case "ForInStatement": + case "ForOfStatement": + stack.push(node.left); + stack.push(node.body); + break; + case "DoWhileStatement": + case "WhileStatement": + case "LabeledStatement": + stack.push(node.body); + break; + case "SwitchStatement": + for (const cs of node.cases) { + for (const consequent of cs.consequent) { + stack.push(consequent); + } + } + break; + case "TryStatement": + stack.push(node.block); + if (node.handler) { + stack.push(node.handler.body); + } + stack.push(node.finalizer); + break; + case "FunctionDeclaration": + if (includeFunctionDeclarations) { + collectDeclaration(declarations, node.id); + } + break; + case "VariableDeclaration": + if (node.kind === "var") { + for (const decl of node.declarations) { + collectDeclaration(declarations, decl.id); + } + } + break; + } } + return Array.from(declarations); +}; +class ConstPlugin { /** * Apply the plugin * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { - const { _backCompat: backCompat } = compiler; - if (compiler.options.output.strictModuleErrorHandling === undefined) - compiler.options.output.strictModuleErrorHandling = true; - const runtimeRequirements = [RuntimeGlobals.module]; - - const createAcceptHandler = (parser, ParamDependency) => { - const { hotAcceptCallback, hotAcceptWithoutCallback } = - HotModuleReplacementPlugin.getParserHooks(parser); - - return expr => { - const module = parser.state.module; - const dep = new ConstDependency( - `${module.moduleArgument}.hot.accept`, - expr.callee.range, - runtimeRequirements - ); - dep.loc = expr.loc; - module.addPresentationalDependency(dep); - module.buildInfo.moduleConcatenationBailout = "Hot Module Replacement"; - if (expr.arguments.length >= 1) { - const arg = parser.evaluateExpression(expr.arguments[0]); - let params = []; - let requests = []; - if (arg.isString()) { - params = [arg]; - } else if (arg.isArray()) { - params = arg.items.filter(param => param.isString()); - } - if (params.length > 0) { - params.forEach((param, idx) => { - const request = param.string; - const dep = new ParamDependency(request, param.range); - dep.optional = true; - dep.loc = Object.create(expr.loc); - dep.loc.index = idx; - module.addDependency(dep); - requests.push(request); - }); - if (expr.arguments.length > 1) { - hotAcceptCallback.call(expr.arguments[1], requests); - for (let i = 1; i < expr.arguments.length; i++) { - parser.walkExpression(expr.arguments[i]); - } - return true; - } else { - hotAcceptWithoutCallback.call(expr, requests); - return true; - } - } - } - parser.walkExpressions(expr.arguments); - return true; - }; - }; - - const createDeclineHandler = (parser, ParamDependency) => expr => { - const module = parser.state.module; - const dep = new ConstDependency( - `${module.moduleArgument}.hot.decline`, - expr.callee.range, - runtimeRequirements - ); - dep.loc = expr.loc; - module.addPresentationalDependency(dep); - module.buildInfo.moduleConcatenationBailout = "Hot Module Replacement"; - if (expr.arguments.length === 1) { - const arg = parser.evaluateExpression(expr.arguments[0]); - let params = []; - if (arg.isString()) { - params = [arg]; - } else if (arg.isArray()) { - params = arg.items.filter(param => param.isString()); - } - params.forEach((param, idx) => { - const dep = new ParamDependency(param.string, param.range); - dep.optional = true; - dep.loc = Object.create(expr.loc); - dep.loc.index = idx; - module.addDependency(dep); - }); - } - return true; - }; - - const createHMRExpressionHandler = parser => expr => { - const module = parser.state.module; - const dep = new ConstDependency( - `${module.moduleArgument}.hot`, - expr.range, - runtimeRequirements - ); - dep.loc = expr.loc; - module.addPresentationalDependency(dep); - module.buildInfo.moduleConcatenationBailout = "Hot Module Replacement"; - return true; - }; - - const applyModuleHot = parser => { - parser.hooks.evaluateIdentifier.for("module.hot").tap( - { - name: "HotModuleReplacementPlugin", - before: "NodeStuffPlugin" - }, - expr => { - return evaluateToIdentifier( - "module.hot", - "module", - () => ["hot"], - true - )(expr); - } - ); - parser.hooks.call - .for("module.hot.accept") - .tap( - "HotModuleReplacementPlugin", - createAcceptHandler(parser, ModuleHotAcceptDependency) - ); - parser.hooks.call - .for("module.hot.decline") - .tap( - "HotModuleReplacementPlugin", - createDeclineHandler(parser, ModuleHotDeclineDependency) - ); - parser.hooks.expression - .for("module.hot") - .tap("HotModuleReplacementPlugin", createHMRExpressionHandler(parser)); - }; - - const applyImportMetaHot = parser => { - parser.hooks.evaluateIdentifier - .for("import.meta.webpackHot") - .tap("HotModuleReplacementPlugin", expr => { - return evaluateToIdentifier( - "import.meta.webpackHot", - "import.meta", - () => ["webpackHot"], - true - )(expr); - }); - parser.hooks.call - .for("import.meta.webpackHot.accept") - .tap( - "HotModuleReplacementPlugin", - createAcceptHandler(parser, ImportMetaHotAcceptDependency) - ); - parser.hooks.call - .for("import.meta.webpackHot.decline") - .tap( - "HotModuleReplacementPlugin", - createDeclineHandler(parser, ImportMetaHotDeclineDependency) - ); - parser.hooks.expression - .for("import.meta.webpackHot") - .tap("HotModuleReplacementPlugin", createHMRExpressionHandler(parser)); - }; - + const cachedParseResource = parseResource.bindCache(compiler.root); compiler.hooks.compilation.tap( - "HotModuleReplacementPlugin", + "ConstPlugin", (compilation, { normalModuleFactory }) => { - // This applies the HMR plugin only to the targeted compiler - // It should not affect child compilations - if (compilation.compiler !== compiler) return; - - //#region module.hot.* API - compilation.dependencyFactories.set( - ModuleHotAcceptDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - ModuleHotAcceptDependency, - new ModuleHotAcceptDependency.Template() - ); - compilation.dependencyFactories.set( - ModuleHotDeclineDependency, - normalModuleFactory - ); compilation.dependencyTemplates.set( - ModuleHotDeclineDependency, - new ModuleHotDeclineDependency.Template() + ConstDependency, + new ConstDependency.Template() ); - //#endregion - //#region import.meta.webpackHot.* API - compilation.dependencyFactories.set( - ImportMetaHotAcceptDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - ImportMetaHotAcceptDependency, - new ImportMetaHotAcceptDependency.Template() - ); - compilation.dependencyFactories.set( - ImportMetaHotDeclineDependency, - normalModuleFactory - ); compilation.dependencyTemplates.set( - ImportMetaHotDeclineDependency, - new ImportMetaHotDeclineDependency.Template() + CachedConstDependency, + new CachedConstDependency.Template() ); - //#endregion - - let hotIndex = 0; - const fullHashChunkModuleHashes = {}; - const chunkModuleHashes = {}; - compilation.hooks.record.tap( - "HotModuleReplacementPlugin", - (compilation, records) => { - if (records.hash === compilation.hash) return; - const chunkGraph = compilation.chunkGraph; - records.hash = compilation.hash; - records.hotIndex = hotIndex; - records.fullHashChunkModuleHashes = fullHashChunkModuleHashes; - records.chunkModuleHashes = chunkModuleHashes; - records.chunkHashes = {}; - records.chunkRuntime = {}; - for (const chunk of compilation.chunks) { - records.chunkHashes[chunk.id] = chunk.hash; - records.chunkRuntime[chunk.id] = getRuntimeKey(chunk.runtime); - } - records.chunkModuleIds = {}; - for (const chunk of compilation.chunks) { - records.chunkModuleIds[chunk.id] = Array.from( - chunkGraph.getOrderedChunkModulesIterable( - chunk, - compareModulesById(chunkGraph) - ), - m => chunkGraph.getModuleId(m) - ); - } - } - ); - /** @type {TupleSet<[Module, Chunk]>} */ - const updatedModules = new TupleSet(); - /** @type {TupleSet<[Module, Chunk]>} */ - const fullHashModules = new TupleSet(); - /** @type {TupleSet<[Module, RuntimeSpec]>} */ - const nonCodeGeneratedModules = new TupleSet(); - compilation.hooks.fullHash.tap("HotModuleReplacementPlugin", hash => { - const chunkGraph = compilation.chunkGraph; - const records = compilation.records; - for (const chunk of compilation.chunks) { - const getModuleHash = module => { - if ( - compilation.codeGenerationResults.has(module, chunk.runtime) - ) { - return compilation.codeGenerationResults.getHash( - module, - chunk.runtime - ); + const handler = parser => { + parser.hooks.statementIf.tap("ConstPlugin", statement => { + if (parser.scope.isAsmJs) return; + const param = parser.evaluateExpression(statement.test); + const bool = param.asBool(); + if (typeof bool === "boolean") { + if (!param.couldHaveSideEffects()) { + const dep = new ConstDependency(`${bool}`, param.range); + dep.loc = statement.loc; + parser.state.module.addPresentationalDependency(dep); } else { - nonCodeGeneratedModules.add(module, chunk.runtime); - return chunkGraph.getModuleHash(module, chunk.runtime); + parser.walkExpression(statement.test); } - }; - const fullHashModulesInThisChunk = - chunkGraph.getChunkFullHashModulesSet(chunk); - if (fullHashModulesInThisChunk !== undefined) { - for (const module of fullHashModulesInThisChunk) { - fullHashModules.add(module, chunk); + const branchToRemove = bool + ? statement.alternate + : statement.consequent; + if (branchToRemove) { + // Before removing the dead branch, the hoisted declarations + // must be collected. + // + // Given the following code: + // + // if (true) f() else g() + // if (false) { + // function f() {} + // const g = function g() {} + // if (someTest) { + // let a = 1 + // var x, {y, z} = obj + // } + // } else { + // … + // } + // + // the generated code is: + // + // if (true) f() else {} + // if (false) { + // var f, x, y, z; (in loose mode) + // var x, y, z; (in strict mode) + // } else { + // … + // } + // + // NOTE: When code runs in strict mode, `var` declarations + // are hoisted but `function` declarations don't. + // + let declarations; + if (parser.scope.isStrict) { + // If the code runs in strict mode, variable declarations + // using `var` must be hoisted. + declarations = getHoistedDeclarations(branchToRemove, false); + } else { + // Otherwise, collect all hoisted declaration. + declarations = getHoistedDeclarations(branchToRemove, true); + } + let replacement; + if (declarations.length > 0) { + replacement = `{ var ${declarations.join(", ")}; }`; + } else { + replacement = "{}"; + } + const dep = new ConstDependency( + replacement, + branchToRemove.range + ); + dep.loc = branchToRemove.loc; + parser.state.module.addPresentationalDependency(dep); } + return bool; } - const modules = chunkGraph.getChunkModulesIterable(chunk); - if (modules !== undefined) { - if (records.chunkModuleHashes) { - if (fullHashModulesInThisChunk !== undefined) { - for (const module of modules) { - const key = `${chunk.id}|${module.identifier()}`; - const hash = getModuleHash(module); - if ( - fullHashModulesInThisChunk.has( - /** @type {RuntimeModule} */ (module) - ) - ) { - if (records.fullHashChunkModuleHashes[key] !== hash) { - updatedModules.add(module, chunk); - } - fullHashChunkModuleHashes[key] = hash; - } else { - if (records.chunkModuleHashes[key] !== hash) { - updatedModules.add(module, chunk); - } - chunkModuleHashes[key] = hash; - } - } + }); + parser.hooks.expressionConditionalOperator.tap( + "ConstPlugin", + expression => { + if (parser.scope.isAsmJs) return; + const param = parser.evaluateExpression(expression.test); + const bool = param.asBool(); + if (typeof bool === "boolean") { + if (!param.couldHaveSideEffects()) { + const dep = new ConstDependency(` ${bool}`, param.range); + dep.loc = expression.loc; + parser.state.module.addPresentationalDependency(dep); } else { - for (const module of modules) { - const key = `${chunk.id}|${module.identifier()}`; - const hash = getModuleHash(module); - if (records.chunkModuleHashes[key] !== hash) { - updatedModules.add(module, chunk); - } - chunkModuleHashes[key] = hash; - } + parser.walkExpression(expression.test); } - } else { - if (fullHashModulesInThisChunk !== undefined) { - for (const module of modules) { - const key = `${chunk.id}|${module.identifier()}`; - const hash = getModuleHash(module); - if ( - fullHashModulesInThisChunk.has( - /** @type {RuntimeModule} */ (module) - ) - ) { - fullHashChunkModuleHashes[key] = hash; - } else { - chunkModuleHashes[key] = hash; - } + // Expressions do not hoist. + // It is safe to remove the dead branch. + // + // Given the following code: + // + // false ? someExpression() : otherExpression(); + // + // the generated code is: + // + // false ? 0 : otherExpression(); + // + const branchToRemove = bool + ? expression.alternate + : expression.consequent; + const dep = new ConstDependency("0", branchToRemove.range); + dep.loc = branchToRemove.loc; + parser.state.module.addPresentationalDependency(dep); + return bool; + } + } + ); + parser.hooks.expressionLogicalOperator.tap( + "ConstPlugin", + expression => { + if (parser.scope.isAsmJs) return; + if ( + expression.operator === "&&" || + expression.operator === "||" + ) { + const param = parser.evaluateExpression(expression.left); + const bool = param.asBool(); + if (typeof bool === "boolean") { + // Expressions do not hoist. + // It is safe to remove the dead branch. + // + // ------------------------------------------ + // + // Given the following code: + // + // falsyExpression() && someExpression(); + // + // the generated code is: + // + // falsyExpression() && false; + // + // ------------------------------------------ + // + // Given the following code: + // + // truthyExpression() && someExpression(); + // + // the generated code is: + // + // true && someExpression(); + // + // ------------------------------------------ + // + // Given the following code: + // + // truthyExpression() || someExpression(); + // + // the generated code is: + // + // truthyExpression() || false; + // + // ------------------------------------------ + // + // Given the following code: + // + // falsyExpression() || someExpression(); + // + // the generated code is: + // + // false && someExpression(); + // + const keepRight = + (expression.operator === "&&" && bool) || + (expression.operator === "||" && !bool); + + if ( + !param.couldHaveSideEffects() && + (param.isBoolean() || keepRight) + ) { + // for case like + // + // return'development'===process.env.NODE_ENV&&'foo' + // + // we need a space before the bool to prevent result like + // + // returnfalse&&'foo' + // + const dep = new ConstDependency(` ${bool}`, param.range); + dep.loc = expression.loc; + parser.state.module.addPresentationalDependency(dep); + } else { + parser.walkExpression(expression.left); } - } else { - for (const module of modules) { - const key = `${chunk.id}|${module.identifier()}`; - const hash = getModuleHash(module); - chunkModuleHashes[key] = hash; + if (!keepRight) { + const dep = new ConstDependency( + "0", + expression.right.range + ); + dep.loc = expression.loc; + parser.state.module.addPresentationalDependency(dep); + } + return keepRight; + } + } else if (expression.operator === "??") { + const param = parser.evaluateExpression(expression.left); + const keepRight = param && param.asNullish(); + if (typeof keepRight === "boolean") { + // ------------------------------------------ + // + // Given the following code: + // + // nonNullish ?? someExpression(); + // + // the generated code is: + // + // nonNullish ?? 0; + // + // ------------------------------------------ + // + // Given the following code: + // + // nullish ?? someExpression(); + // + // the generated code is: + // + // null ?? someExpression(); + // + if (!param.couldHaveSideEffects() && keepRight) { + // cspell:word returnnull + // for case like + // + // return('development'===process.env.NODE_ENV&&null)??'foo' + // + // we need a space before the bool to prevent result like + // + // returnnull??'foo' + // + const dep = new ConstDependency(" null", param.range); + dep.loc = expression.loc; + parser.state.module.addPresentationalDependency(dep); + } else { + const dep = new ConstDependency( + "0", + expression.right.range + ); + dep.loc = expression.loc; + parser.state.module.addPresentationalDependency(dep); + parser.walkExpression(expression.left); } + + return keepRight; } } } - } - - hotIndex = records.hotIndex || 0; - if (updatedModules.size > 0) hotIndex++; + ); + parser.hooks.optionalChaining.tap("ConstPlugin", expr => { + /** @type {ExpressionNode[]} */ + const optionalExpressionsStack = []; + /** @type {ExpressionNode|SuperNode} */ + let next = expr.expression; - hash.update(`${hotIndex}`); - }); - compilation.hooks.processAssets.tap( - { - name: "HotModuleReplacementPlugin", - stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL - }, - () => { - const chunkGraph = compilation.chunkGraph; - const records = compilation.records; - if (records.hash === compilation.hash) return; - if ( - !records.chunkModuleHashes || - !records.chunkHashes || - !records.chunkModuleIds + while ( + next.type === "MemberExpression" || + next.type === "CallExpression" ) { - return; - } - for (const [module, chunk] of fullHashModules) { - const key = `${chunk.id}|${module.identifier()}`; - const hash = nonCodeGeneratedModules.has(module, chunk.runtime) - ? chunkGraph.getModuleHash(module, chunk.runtime) - : compilation.codeGenerationResults.getHash( - module, - chunk.runtime - ); - if (records.chunkModuleHashes[key] !== hash) { - updatedModules.add(module, chunk); + if (next.type === "MemberExpression") { + if (next.optional) { + // SuperNode can not be optional + optionalExpressionsStack.push( + /** @type {ExpressionNode} */ (next.object) + ); + } + next = next.object; + } else { + if (next.optional) { + // SuperNode can not be optional + optionalExpressionsStack.push( + /** @type {ExpressionNode} */ (next.callee) + ); + } + next = next.callee; } - chunkModuleHashes[key] = hash; } - /** @type {Map, removedChunkIds: Set, removedModules: Set, filename: string, assetInfo: AssetInfo }>} */ - const hotUpdateMainContentByRuntime = new Map(); - let allOldRuntime; - for (const key of Object.keys(records.chunkRuntime)) { - const runtime = keyToRuntime(records.chunkRuntime[key]); - allOldRuntime = mergeRuntimeOwned(allOldRuntime, runtime); + while (optionalExpressionsStack.length) { + const expression = optionalExpressionsStack.pop(); + const evaluated = parser.evaluateExpression(expression); + + if (evaluated && evaluated.asNullish()) { + // ------------------------------------------ + // + // Given the following code: + // + // nullishMemberChain?.a.b(); + // + // the generated code is: + // + // undefined; + // + // ------------------------------------------ + // + const dep = new ConstDependency(" undefined", expr.range); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + } } - forEachRuntime(allOldRuntime, runtime => { - const { path: filename, info: assetInfo } = - compilation.getPathWithInfo( - compilation.outputOptions.hotUpdateMainFilename, - { - hash: records.hash, - runtime - } - ); - hotUpdateMainContentByRuntime.set(runtime, { - updatedChunkIds: new Set(), - removedChunkIds: new Set(), - removedModules: new Set(), - filename, - assetInfo - }); + }); + parser.hooks.evaluateIdentifier + .for("__resourceQuery") + .tap("ConstPlugin", expr => { + if (parser.scope.isAsmJs) return; + if (!parser.state.module) return; + return evaluateToString( + cachedParseResource(parser.state.module.resource).query + )(expr); + }); + parser.hooks.expression + .for("__resourceQuery") + .tap("ConstPlugin", expr => { + if (parser.scope.isAsmJs) return; + if (!parser.state.module) return; + const dep = new CachedConstDependency( + JSON.stringify( + cachedParseResource(parser.state.module.resource).query + ), + expr.range, + "__resourceQuery" + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; }); - if (hotUpdateMainContentByRuntime.size === 0) return; - // Create a list of all active modules to verify which modules are removed completely - /** @type {Map} */ - const allModules = new Map(); - for (const module of compilation.modules) { - const id = chunkGraph.getModuleId(module); - allModules.set(id, module); - } + parser.hooks.evaluateIdentifier + .for("__resourceFragment") + .tap("ConstPlugin", expr => { + if (parser.scope.isAsmJs) return; + if (!parser.state.module) return; + return evaluateToString( + cachedParseResource(parser.state.module.resource).fragment + )(expr); + }); + parser.hooks.expression + .for("__resourceFragment") + .tap("ConstPlugin", expr => { + if (parser.scope.isAsmJs) return; + if (!parser.state.module) return; + const dep = new CachedConstDependency( + JSON.stringify( + cachedParseResource(parser.state.module.resource).fragment + ), + expr.range, + "__resourceFragment" + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + }; - // List of completely removed modules - /** @type {Set} */ - const completelyRemovedModules = new Set(); + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("ConstPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("ConstPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("ConstPlugin", handler); + } + ); + } +} - for (const key of Object.keys(records.chunkHashes)) { - const oldRuntime = keyToRuntime(records.chunkRuntime[key]); - /** @type {Module[]} */ - const remainingModules = []; - // Check which modules are removed - for (const id of records.chunkModuleIds[key]) { - const module = allModules.get(id); - if (module === undefined) { - completelyRemovedModules.add(id); - } else { - remainingModules.push(module); - } - } - - let chunkId; - let newModules; - let newRuntimeModules; - let newFullHashModules; - let newDependentHashModules; - let newRuntime; - let removedFromRuntime; - const currentChunk = find( - compilation.chunks, - chunk => `${chunk.id}` === key - ); - if (currentChunk) { - chunkId = currentChunk.id; - newRuntime = intersectRuntime( - currentChunk.runtime, - allOldRuntime - ); - if (newRuntime === undefined) continue; - newModules = chunkGraph - .getChunkModules(currentChunk) - .filter(module => updatedModules.has(module, currentChunk)); - newRuntimeModules = Array.from( - chunkGraph.getChunkRuntimeModulesIterable(currentChunk) - ).filter(module => updatedModules.has(module, currentChunk)); - const fullHashModules = - chunkGraph.getChunkFullHashModulesIterable(currentChunk); - newFullHashModules = - fullHashModules && - Array.from(fullHashModules).filter(module => - updatedModules.has(module, currentChunk) - ); - const dependentHashModules = - chunkGraph.getChunkDependentHashModulesIterable(currentChunk); - newDependentHashModules = - dependentHashModules && - Array.from(dependentHashModules).filter(module => - updatedModules.has(module, currentChunk) - ); - removedFromRuntime = subtractRuntime(oldRuntime, newRuntime); - } else { - // chunk has completely removed - chunkId = `${+key}` === key ? +key : key; - removedFromRuntime = oldRuntime; - newRuntime = oldRuntime; - } - if (removedFromRuntime) { - // chunk was removed from some runtimes - forEachRuntime(removedFromRuntime, runtime => { - hotUpdateMainContentByRuntime - .get(runtime) - .removedChunkIds.add(chunkId); - }); - // dispose modules from the chunk in these runtimes - // where they are no longer in this runtime - for (const module of remainingModules) { - const moduleKey = `${key}|${module.identifier()}`; - const oldHash = records.chunkModuleHashes[moduleKey]; - const runtimes = chunkGraph.getModuleRuntimes(module); - if (oldRuntime === newRuntime && runtimes.has(newRuntime)) { - // Module is still in the same runtime combination - const hash = nonCodeGeneratedModules.has(module, newRuntime) - ? chunkGraph.getModuleHash(module, newRuntime) - : compilation.codeGenerationResults.getHash( - module, - newRuntime - ); - if (hash !== oldHash) { - if (module.type === "runtime") { - newRuntimeModules = newRuntimeModules || []; - newRuntimeModules.push( - /** @type {RuntimeModule} */ (module) - ); - } else { - newModules = newModules || []; - newModules.push(module); - } - } - } else { - // module is no longer in this runtime combination - // We (incorrectly) assume that it's not in an overlapping runtime combination - // and dispose it from the main runtimes the chunk was removed from - forEachRuntime(removedFromRuntime, runtime => { - // If the module is still used in this runtime, do not dispose it - // This could create a bad runtime state where the module is still loaded, - // but no chunk which contains it. This means we don't receive further HMR updates - // to this module and that's bad. - // TODO force load one of the chunks which contains the module - for (const moduleRuntime of runtimes) { - if (typeof moduleRuntime === "string") { - if (moduleRuntime === runtime) return; - } else if (moduleRuntime !== undefined) { - if (moduleRuntime.has(runtime)) return; - } - } - hotUpdateMainContentByRuntime - .get(runtime) - .removedModules.add(module); - }); - } - } - } - if ( - (newModules && newModules.length > 0) || - (newRuntimeModules && newRuntimeModules.length > 0) - ) { - const hotUpdateChunk = new HotUpdateChunk(); - if (backCompat) - ChunkGraph.setChunkGraphForChunk(hotUpdateChunk, chunkGraph); - hotUpdateChunk.id = chunkId; - hotUpdateChunk.runtime = newRuntime; - if (currentChunk) { - for (const group of currentChunk.groupsIterable) - hotUpdateChunk.addGroup(group); - } - chunkGraph.attachModules(hotUpdateChunk, newModules || []); - chunkGraph.attachRuntimeModules( - hotUpdateChunk, - newRuntimeModules || [] - ); - if (newFullHashModules) { - chunkGraph.attachFullHashModules( - hotUpdateChunk, - newFullHashModules - ); - } - if (newDependentHashModules) { - chunkGraph.attachDependentHashModules( - hotUpdateChunk, - newDependentHashModules - ); - } - const renderManifest = compilation.getRenderManifest({ - chunk: hotUpdateChunk, - hash: records.hash, - fullHash: records.hash, - outputOptions: compilation.outputOptions, - moduleTemplates: compilation.moduleTemplates, - dependencyTemplates: compilation.dependencyTemplates, - codeGenerationResults: compilation.codeGenerationResults, - runtimeTemplate: compilation.runtimeTemplate, - moduleGraph: compilation.moduleGraph, - chunkGraph - }); - for (const entry of renderManifest) { - /** @type {string} */ - let filename; - /** @type {AssetInfo} */ - let assetInfo; - if ("filename" in entry) { - filename = entry.filename; - assetInfo = entry.info; - } else { - ({ path: filename, info: assetInfo } = - compilation.getPathWithInfo( - entry.filenameTemplate, - entry.pathOptions - )); - } - const source = entry.render(); - compilation.additionalChunkAssets.push(filename); - compilation.emitAsset(filename, source, { - hotModuleReplacement: true, - ...assetInfo - }); - if (currentChunk) { - currentChunk.files.add(filename); - compilation.hooks.chunkAsset.call(currentChunk, filename); - } - } - forEachRuntime(newRuntime, runtime => { - hotUpdateMainContentByRuntime - .get(runtime) - .updatedChunkIds.add(chunkId); - }); - } - } - const completelyRemovedModulesArray = Array.from( - completelyRemovedModules - ); - const hotUpdateMainContentByFilename = new Map(); - for (const { - removedChunkIds, - removedModules, - updatedChunkIds, - filename, - assetInfo - } of hotUpdateMainContentByRuntime.values()) { - const old = hotUpdateMainContentByFilename.get(filename); - if ( - old && - (!isSubset(old.removedChunkIds, removedChunkIds) || - !isSubset(old.removedModules, removedModules) || - !isSubset(old.updatedChunkIds, updatedChunkIds)) - ) { - compilation.warnings.push( - new WebpackError(`HotModuleReplacementPlugin -The configured output.hotUpdateMainFilename doesn't lead to unique filenames per runtime and HMR update differs between runtimes. -This might lead to incorrect runtime behavior of the applied update. -To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename option, or use the default config.`) - ); - for (const chunkId of removedChunkIds) - old.removedChunkIds.add(chunkId); - for (const chunkId of removedModules) - old.removedModules.add(chunkId); - for (const chunkId of updatedChunkIds) - old.updatedChunkIds.add(chunkId); - continue; - } - hotUpdateMainContentByFilename.set(filename, { - removedChunkIds, - removedModules, - updatedChunkIds, - assetInfo - }); - } - for (const [ - filename, - { removedChunkIds, removedModules, updatedChunkIds, assetInfo } - ] of hotUpdateMainContentByFilename) { - const hotUpdateMainJson = { - c: Array.from(updatedChunkIds), - r: Array.from(removedChunkIds), - m: - removedModules.size === 0 - ? completelyRemovedModulesArray - : completelyRemovedModulesArray.concat( - Array.from(removedModules, m => - chunkGraph.getModuleId(m) - ) - ) - }; - - const source = new RawSource(JSON.stringify(hotUpdateMainJson)); - compilation.emitAsset(filename, source, { - hotModuleReplacement: true, - ...assetInfo - }); - } - } - ); - - compilation.hooks.additionalTreeRuntimeRequirements.tap( - "HotModuleReplacementPlugin", - (chunk, runtimeRequirements) => { - runtimeRequirements.add(RuntimeGlobals.hmrDownloadManifest); - runtimeRequirements.add(RuntimeGlobals.hmrDownloadUpdateHandlers); - runtimeRequirements.add(RuntimeGlobals.interceptModuleExecution); - runtimeRequirements.add(RuntimeGlobals.moduleCache); - compilation.addRuntimeModule( - chunk, - new HotModuleReplacementRuntimeModule() - ); - } - ); - - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("HotModuleReplacementPlugin", parser => { - applyModuleHot(parser); - applyImportMetaHot(parser); - }); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("HotModuleReplacementPlugin", parser => { - applyModuleHot(parser); - }); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("HotModuleReplacementPlugin", parser => { - applyImportMetaHot(parser); - }); - - NormalModule.getCompilationHooks(compilation).loader.tap( - "HotModuleReplacementPlugin", - context => { - context.hot = true; - } - ); - } - ); - } -} - -module.exports = HotModuleReplacementPlugin; +module.exports = ConstPlugin; /***/ }), -/***/ 9597: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 21411: +/***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const Chunk = __webpack_require__(39385); +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./ContextModuleFactory")} ContextModuleFactory */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./util/Hash")} Hash */ +class ContextExclusionPlugin { + /** + * @param {RegExp} negativeMatcher Matcher regular expression + */ + constructor(negativeMatcher) { + this.negativeMatcher = negativeMatcher; + } -class HotUpdateChunk extends Chunk { - constructor() { - super(); + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.contextModuleFactory.tap("ContextExclusionPlugin", cmf => { + cmf.hooks.contextModuleFiles.tap("ContextExclusionPlugin", files => { + return files.filter(filePath => !this.negativeMatcher.test(filePath)); + }); + }); } } -module.exports = HotUpdateChunk; +module.exports = ContextExclusionPlugin; /***/ }), -/***/ 3: +/***/ 76729: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ -const ModuleFactory = __webpack_require__(51010); +const { OriginalSource, RawSource } = __webpack_require__(51255); +const AsyncDependenciesBlock = __webpack_require__(47736); +const { makeWebpackError } = __webpack_require__(11351); +const Module = __webpack_require__(73208); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const WebpackError = __webpack_require__(53799); +const { + compareLocations, + concatComparators, + compareSelect, + keepOriginalOrder, + compareModulesById +} = __webpack_require__(29579); +const { contextify, parseResource } = __webpack_require__(82186); +const makeSerializable = __webpack_require__(33032); -/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ -/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ -/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./ChunkGroup").RawChunkGroupOptions} RawChunkGroupOptions */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Module").BuildMeta} BuildMeta */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./dependencies/ContextElementDependency")} ContextElementDependency */ +/** @template T @typedef {import("./util/LazySet")} LazySet */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ + +/** @typedef {"sync" | "eager" | "weak" | "async-weak" | "lazy" | "lazy-once"} ContextMode Context mode */ /** - * Ignores error when module is unresolved + * @typedef {Object} ContextOptions + * @property {ContextMode} mode + * @property {boolean} recursive + * @property {RegExp} regExp + * @property {"strict"|boolean=} namespaceObject + * @property {string=} addon + * @property {string=} chunkName + * @property {RegExp=} include + * @property {RegExp=} exclude + * @property {RawChunkGroupOptions=} groupOptions + * @property {string=} typePrefix + * @property {string=} category + * @property {string[][]=} referencedExports exports referenced from modules (won't be mangled) */ -class IgnoreErrorModuleFactory extends ModuleFactory { - /** - * @param {NormalModuleFactory} normalModuleFactory normalModuleFactory instance - */ - constructor(normalModuleFactory) { - super(); - this.normalModuleFactory = normalModuleFactory; - } - - /** - * @param {ModuleFactoryCreateData} data data object - * @param {function(Error=, ModuleFactoryResult=): void} callback callback - * @returns {void} - */ - create(data, callback) { - this.normalModuleFactory.create(data, (err, result) => { - return callback(null, result); - }); - } -} +/** + * @typedef {Object} ContextModuleOptionsExtras + * @property {string} resource + * @property {string=} resourceQuery + * @property {string=} resourceFragment + * @property {TODO} resolveOptions + */ -module.exports = IgnoreErrorModuleFactory; +/** @typedef {ContextOptions & ContextModuleOptionsExtras} ContextModuleOptions */ +/** + * @callback ResolveDependenciesCallback + * @param {(Error | null)=} err + * @param {ContextElementDependency[]=} dependencies + */ -/***/ }), +/** + * @callback ResolveDependencies + * @param {InputFileSystem} fs + * @param {ContextModuleOptions} options + * @param {ResolveDependenciesCallback} callback + */ -/***/ 84808: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +const SNAPSHOT_OPTIONS = { timestamp: true }; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +const TYPES = new Set(["javascript"]); +class ContextModule extends Module { + /** + * @param {ResolveDependencies} resolveDependencies function to get dependencies in this context + * @param {ContextModuleOptions} options options object + */ + constructor(resolveDependencies, options) { + const parsed = parseResource(options ? options.resource : ""); + const resource = parsed.path; + const resourceQuery = (options && options.resourceQuery) || parsed.query; + const resourceFragment = + (options && options.resourceFragment) || parsed.fragment; + super("javascript/dynamic", resource); -const createSchemaValidation = __webpack_require__(32540); + // Info from Factory + this.resolveDependencies = resolveDependencies; + /** @type {ContextModuleOptions} */ + this.options = { + ...options, + resource, + resourceQuery, + resourceFragment + }; + if (options && options.resolveOptions !== undefined) { + this.resolveOptions = options.resolveOptions; + } -/** @typedef {import("../declarations/plugins/IgnorePlugin").IgnorePluginOptions} IgnorePluginOptions */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./NormalModuleFactory").ResolveData} ResolveData */ + if (options && typeof options.mode !== "string") { + throw new Error("options.mode is a required option"); + } -const validate = createSchemaValidation( - __webpack_require__(20858), - () => __webpack_require__(3098), - { - name: "Ignore Plugin", - baseDataPath: "options" + this._identifier = this._createIdentifier(); + this._forceBuild = true; } -); -class IgnorePlugin { /** - * @param {IgnorePluginOptions} options IgnorePlugin options + * @returns {Set} types available (do not mutate) */ - constructor(options) { - validate(options); - this.options = options; - - /** @private @type {Function} */ - this.checkIgnore = this.checkIgnore.bind(this); + getSourceTypes() { + return TYPES; } /** - * Note that if "contextRegExp" is given, both the "resourceRegExp" - * and "contextRegExp" have to match. - * - * @param {ResolveData} resolveData resolve data - * @returns {false|undefined} returns false when the request should be ignored, otherwise undefined + * Assuming this module is in the cache. Update the (cached) module with + * the fresh module from the factory. Usually updates internal references + * and properties. + * @param {Module} module fresh module + * @returns {void} */ - checkIgnore(resolveData) { - if ( - "checkResource" in this.options && - this.options.checkResource && - this.options.checkResource(resolveData.request, resolveData.context) - ) { - return false; - } - - if ( - "resourceRegExp" in this.options && - this.options.resourceRegExp && - this.options.resourceRegExp.test(resolveData.request) - ) { - if ("contextRegExp" in this.options && this.options.contextRegExp) { - // if "contextRegExp" is given, - // both the "resourceRegExp" and "contextRegExp" have to match. - if (this.options.contextRegExp.test(resolveData.context)) { - return false; - } - } else { - return false; - } - } + updateCacheModule(module) { + const m = /** @type {ContextModule} */ (module); + this.resolveDependencies = m.resolveDependencies; + this.options = m.options; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * Assuming this module is in the cache. Remove internal references to allow freeing some memory. */ - apply(compiler) { - compiler.hooks.normalModuleFactory.tap("IgnorePlugin", nmf => { - nmf.hooks.beforeResolve.tap("IgnorePlugin", this.checkIgnore); - }); - compiler.hooks.contextModuleFactory.tap("IgnorePlugin", cmf => { - cmf.hooks.beforeResolve.tap("IgnorePlugin", this.checkIgnore); - }); + cleanupForCache() { + super.cleanupForCache(); + this.resolveDependencies = undefined; } -} - -module.exports = IgnorePlugin; - - -/***/ }), - -/***/ 7373: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - + _prettyRegExp(regexString, stripSlash = true) { + const str = (regexString + "").replace(/!/g, "%21").replace(/\|/g, "%7C"); + return stripSlash ? str.substring(1, str.length - 1) : str; + } -/** @typedef {import("../declarations/WebpackOptions").IgnoreWarningsNormalized} IgnoreWarningsNormalized */ -/** @typedef {import("./Compiler")} Compiler */ - -class IgnoreWarningsPlugin { - /** - * @param {IgnoreWarningsNormalized} ignoreWarnings conditions to ignore warnings - */ - constructor(ignoreWarnings) { - this._ignoreWarnings = ignoreWarnings; + _createIdentifier() { + let identifier = this.context; + if (this.options.resourceQuery) { + identifier += `|${this.options.resourceQuery}`; + } + if (this.options.resourceFragment) { + identifier += `|${this.options.resourceFragment}`; + } + if (this.options.mode) { + identifier += `|${this.options.mode}`; + } + if (!this.options.recursive) { + identifier += "|nonrecursive"; + } + if (this.options.addon) { + identifier += `|${this.options.addon}`; + } + if (this.options.regExp) { + identifier += `|${this._prettyRegExp(this.options.regExp, false)}`; + } + if (this.options.include) { + identifier += `|include: ${this._prettyRegExp( + this.options.include, + false + )}`; + } + if (this.options.exclude) { + identifier += `|exclude: ${this._prettyRegExp( + this.options.exclude, + false + )}`; + } + if (this.options.referencedExports) { + identifier += `|referencedExports: ${JSON.stringify( + this.options.referencedExports + )}`; + } + if (this.options.chunkName) { + identifier += `|chunkName: ${this.options.chunkName}`; + } + if (this.options.groupOptions) { + identifier += `|groupOptions: ${JSON.stringify( + this.options.groupOptions + )}`; + } + if (this.options.namespaceObject === "strict") { + identifier += "|strict namespace object"; + } else if (this.options.namespaceObject) { + identifier += "|namespace object"; + } + + return identifier; } + /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @returns {string} a unique identifier of the module */ - apply(compiler) { - compiler.hooks.compilation.tap("IgnoreWarningsPlugin", compilation => { - compilation.hooks.processWarnings.tap( - "IgnoreWarningsPlugin", - warnings => { - return warnings.filter(warning => { - return !this._ignoreWarnings.some(ignore => - ignore(warning, compilation) - ); - }); - } - ); - }); + identifier() { + return this._identifier; } -} - -module.exports = IgnoreWarningsPlugin; - - -/***/ }), - -/***/ 55870: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent -*/ - - -const { ConcatSource } = __webpack_require__(51255); -const makeSerializable = __webpack_require__(33032); + /** + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + let identifier = requestShortener.shorten(this.context) + "/"; + if (this.options.resourceQuery) { + identifier += ` ${this.options.resourceQuery}`; + } + if (this.options.mode) { + identifier += ` ${this.options.mode}`; + } + if (!this.options.recursive) { + identifier += " nonrecursive"; + } + if (this.options.addon) { + identifier += ` ${requestShortener.shorten(this.options.addon)}`; + } + if (this.options.regExp) { + identifier += ` ${this._prettyRegExp(this.options.regExp)}`; + } + if (this.options.include) { + identifier += ` include: ${this._prettyRegExp(this.options.include)}`; + } + if (this.options.exclude) { + identifier += ` exclude: ${this._prettyRegExp(this.options.exclude)}`; + } + if (this.options.referencedExports) { + identifier += ` referencedExports: ${this.options.referencedExports + .map(e => e.join(".")) + .join(", ")}`; + } + if (this.options.chunkName) { + identifier += ` chunkName: ${this.options.chunkName}`; + } + if (this.options.groupOptions) { + const groupOptions = this.options.groupOptions; + for (const key of Object.keys(groupOptions)) { + identifier += ` ${key}: ${groupOptions[key]}`; + } + } + if (this.options.namespaceObject === "strict") { + identifier += " strict namespace object"; + } else if (this.options.namespaceObject) { + identifier += " namespace object"; + } -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("./Generator").GenerateContext} GenerateContext */ + return identifier; + } -/** - * @param {InitFragment} fragment the init fragment - * @param {number} index index - * @returns {[InitFragment, number]} tuple with both - */ -const extractFragmentIndex = (fragment, index) => [fragment, index]; + /** + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion + */ + libIdent(options) { + let identifier = contextify( + options.context, + this.context, + options.associatedObjectForCache + ); + if (this.layer) identifier = `(${this.layer})/${identifier}`; + if (this.options.mode) { + identifier += ` ${this.options.mode}`; + } + if (this.options.recursive) { + identifier += " recursive"; + } + if (this.options.addon) { + identifier += ` ${contextify( + options.context, + this.options.addon, + options.associatedObjectForCache + )}`; + } + if (this.options.regExp) { + identifier += ` ${this._prettyRegExp(this.options.regExp)}`; + } + if (this.options.include) { + identifier += ` include: ${this._prettyRegExp(this.options.include)}`; + } + if (this.options.exclude) { + identifier += ` exclude: ${this._prettyRegExp(this.options.exclude)}`; + } + if (this.options.referencedExports) { + identifier += ` referencedExports: ${this.options.referencedExports + .map(e => e.join(".")) + .join(", ")}`; + } -/** - * @param {[InitFragment, number]} a first pair - * @param {[InitFragment, number]} b second pair - * @returns {number} sort value - */ -const sortFragmentWithIndex = ([a, i], [b, j]) => { - const stageCmp = a.stage - b.stage; - if (stageCmp !== 0) return stageCmp; - const positionCmp = a.position - b.position; - if (positionCmp !== 0) return positionCmp; - return i - j; -}; + return identifier; + } -/** - * @template Context - */ -class InitFragment { /** - * @param {string|Source} content the source code that will be included as initialization code - * @param {number} stage category of initialization code (contribute to order) - * @param {number} position position in the category (contribute to order) - * @param {string=} key unique key to avoid emitting the same initialization code twice - * @param {string|Source=} endContent the source code that will be included at the end of the module + * @returns {void} */ - constructor(content, stage, position, key, endContent) { - this.content = content; - this.stage = stage; - this.position = position; - this.key = key; - this.endContent = endContent; + invalidateBuild() { + this._forceBuild = true; } /** - * @param {Context} context context - * @returns {string|Source} the source code that will be included as initialization code + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} */ - getContent(context) { - return this.content; + needBuild({ fileSystemInfo }, callback) { + // build if enforced + if (this._forceBuild) return callback(null, true); + + // always build when we have no snapshot + if (!this.buildInfo.snapshot) return callback(null, true); + + fileSystemInfo.checkSnapshotValid(this.buildInfo.snapshot, (err, valid) => { + callback(err, !valid); + }); } /** - * @param {Context} context context - * @returns {string|Source=} the source code that will be included at the end of the module + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} */ - getEndContent(context) { - return this.endContent; - } + build(options, compilation, resolver, fs, callback) { + this._forceBuild = false; + /** @type {BuildMeta} */ + this.buildMeta = { + exportsType: "default", + defaultObject: "redirect-warn" + }; + this.buildInfo = { + snapshot: undefined + }; + this.dependencies.length = 0; + this.blocks.length = 0; + const startTime = Date.now(); + this.resolveDependencies(fs, this.options, (err, dependencies) => { + if (err) { + return callback( + makeWebpackError(err, "ContextModule.resolveDependencies") + ); + } - static addToSource(source, initFragments, context) { - if (initFragments.length > 0) { - // Sort fragments by position. If 2 fragments have the same position, - // use their index. - const sortedFragments = initFragments - .map(extractFragmentIndex) - .sort(sortFragmentWithIndex); + // abort if something failed + // this will create an empty context + if (!dependencies) { + callback(); + return; + } - // Deduplicate fragments. If a fragment has no key, it is always included. - const keyedFragments = new Map(); - for (const [fragment] of sortedFragments) { - if (typeof fragment.mergeAll === "function") { - if (!fragment.key) { - throw new Error( - `InitFragment with mergeAll function must have a valid key: ${fragment.constructor.name}` - ); - } - const oldValue = keyedFragments.get(fragment.key); - if (oldValue === undefined) { - keyedFragments.set(fragment.key, fragment); - } else if (Array.isArray(oldValue)) { - oldValue.push(fragment); - } else { - keyedFragments.set(fragment.key, [oldValue, fragment]); - } - continue; - } else if (typeof fragment.merge === "function") { - const oldValue = keyedFragments.get(fragment.key); - if (oldValue !== undefined) { - keyedFragments.set(fragment.key, fragment.merge(oldValue)); - continue; - } - } - keyedFragments.set(fragment.key || Symbol(), fragment); + // enhance dependencies with meta info + for (const dep of dependencies) { + dep.loc = { + name: dep.userRequest + }; + dep.request = this.options.addon + dep.request; } + dependencies.sort( + concatComparators( + compareSelect(a => a.loc, compareLocations), + keepOriginalOrder(this.dependencies) + ) + ); - const concatSource = new ConcatSource(); - const endContents = []; - for (let fragment of keyedFragments.values()) { - if (Array.isArray(fragment)) { - fragment = fragment[0].mergeAll(fragment); + if (this.options.mode === "sync" || this.options.mode === "eager") { + // if we have an sync or eager context + // just add all dependencies and continue + this.dependencies = dependencies; + } else if (this.options.mode === "lazy-once") { + // for the lazy-once mode create a new async dependency block + // and add that block to this context + if (dependencies.length > 0) { + const block = new AsyncDependenciesBlock({ + ...this.options.groupOptions, + name: this.options.chunkName + }); + for (const dep of dependencies) { + block.addDependency(dep); + } + this.addBlock(block); } - concatSource.add(fragment.getContent(context)); - const endContent = fragment.getEndContent(context); - if (endContent) { - endContents.push(endContent); + } else if ( + this.options.mode === "weak" || + this.options.mode === "async-weak" + ) { + // we mark all dependencies as weak + for (const dep of dependencies) { + dep.weak = true; } + this.dependencies = dependencies; + } else if (this.options.mode === "lazy") { + // if we are lazy create a new async dependency block per dependency + // and add all blocks to this context + let index = 0; + for (const dep of dependencies) { + let chunkName = this.options.chunkName; + if (chunkName) { + if (!/\[(index|request)\]/.test(chunkName)) { + chunkName += "[index]"; + } + chunkName = chunkName.replace(/\[index\]/g, `${index++}`); + chunkName = chunkName.replace( + /\[request\]/g, + Template.toPath(dep.userRequest) + ); + } + const block = new AsyncDependenciesBlock( + { + ...this.options.groupOptions, + name: chunkName + }, + dep.loc, + dep.userRequest + ); + block.addDependency(dep); + this.addBlock(block); + } + } else { + callback( + new WebpackError(`Unsupported mode "${this.options.mode}" in context`) + ); + return; } - - concatSource.add(source); - for (const content of endContents.reverse()) { - concatSource.add(content); - } - return concatSource; - } else { - return source; - } + compilation.fileSystemInfo.createSnapshot( + startTime, + null, + [this.context], + null, + SNAPSHOT_OPTIONS, + (err, snapshot) => { + if (err) return callback(err); + this.buildInfo.snapshot = snapshot; + callback(); + } + ); + }); } - serialize(context) { - const { write } = context; - - write(this.content); - write(this.stage); - write(this.position); - write(this.key); - write(this.endContent); + /** + * @param {LazySet} fileDependencies set where file dependencies are added to + * @param {LazySet} contextDependencies set where context dependencies are added to + * @param {LazySet} missingDependencies set where missing dependencies are added to + * @param {LazySet} buildDependencies set where build dependencies are added to + */ + addCacheDependencies( + fileDependencies, + contextDependencies, + missingDependencies, + buildDependencies + ) { + contextDependencies.add(this.context); } - deserialize(context) { - const { read } = context; - - this.content = read(); - this.stage = read(); - this.position = read(); - this.key = read(); - this.endContent = read(); + /** + * @param {ContextElementDependency[]} dependencies all dependencies + * @param {ChunkGraph} chunkGraph chunk graph + * @returns {TODO} TODO + */ + getUserRequestMap(dependencies, chunkGraph) { + const moduleGraph = chunkGraph.moduleGraph; + // if we filter first we get a new array + // therefore we don't need to create a clone of dependencies explicitly + // therefore the order of this is !important! + const sortedDependencies = dependencies + .filter(dependency => moduleGraph.getModule(dependency)) + .sort((a, b) => { + if (a.userRequest === b.userRequest) { + return 0; + } + return a.userRequest < b.userRequest ? -1 : 1; + }); + const map = Object.create(null); + for (const dep of sortedDependencies) { + const module = moduleGraph.getModule(dep); + map[dep.userRequest] = chunkGraph.getModuleId(module); + } + return map; } -} - -makeSerializable(InitFragment, "webpack/lib/InitFragment"); - -InitFragment.prototype.merge = undefined; - -InitFragment.STAGE_CONSTANTS = 10; -InitFragment.STAGE_ASYNC_BOUNDARY = 20; -InitFragment.STAGE_HARMONY_EXPORTS = 30; -InitFragment.STAGE_HARMONY_IMPORTS = 40; -InitFragment.STAGE_PROVIDES = 50; -InitFragment.STAGE_ASYNC_DEPENDENCIES = 60; -InitFragment.STAGE_ASYNC_HARMONY_IMPORTS = 70; - -module.exports = InitFragment; - - -/***/ }), - -/***/ 68257: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); - -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("./Module")} Module */ -class InvalidDependenciesModuleWarning extends WebpackError { /** - * @param {Module} module module tied to dependency - * @param {Iterable} deps invalid dependencies + * @param {ContextElementDependency[]} dependencies all dependencies + * @param {ChunkGraph} chunkGraph chunk graph + * @returns {TODO} TODO */ - constructor(module, deps) { - const orderedDeps = deps ? Array.from(deps).sort() : []; - const depsList = orderedDeps.map(dep => ` * ${JSON.stringify(dep)}`); - super(`Invalid dependencies have been reported by plugins or loaders for this module. All reported dependencies need to be absolute paths. -Invalid dependencies may lead to broken watching and caching. -As best effort we try to convert all invalid values to absolute paths and converting globs into context dependencies, but this is deprecated behavior. -Loaders: Pass absolute paths to this.addDependency (existing files), this.addMissingDependency (not existing files), and this.addContextDependency (directories). -Plugins: Pass absolute paths to fileDependencies (existing files), missingDependencies (not existing files), and contextDependencies (directories). -Globs: They are not supported. Pass absolute path to the directory as context dependencies. -The following invalid values have been reported: -${depsList.slice(0, 3).join("\n")}${ - depsList.length > 3 ? "\n * and more ..." : "" - }`); + getFakeMap(dependencies, chunkGraph) { + if (!this.options.namespaceObject) { + return 9; + } + const moduleGraph = chunkGraph.moduleGraph; + // bitfield + let hasType = 0; + const comparator = compareModulesById(chunkGraph); + // if we filter first we get a new array + // therefore we don't need to create a clone of dependencies explicitly + // therefore the order of this is !important! + const sortedModules = dependencies + .map(dependency => moduleGraph.getModule(dependency)) + .filter(Boolean) + .sort(comparator); + const fakeMap = Object.create(null); + for (const module of sortedModules) { + const exportsType = module.getExportsType( + moduleGraph, + this.options.namespaceObject === "strict" + ); + const id = chunkGraph.getModuleId(module); + switch (exportsType) { + case "namespace": + fakeMap[id] = 9; + hasType |= 1; + break; + case "dynamic": + fakeMap[id] = 7; + hasType |= 2; + break; + case "default-only": + fakeMap[id] = 1; + hasType |= 4; + break; + case "default-with-named": + fakeMap[id] = 3; + hasType |= 8; + break; + default: + throw new Error(`Unexpected exports type ${exportsType}`); + } + } + if (hasType === 1) { + return 9; + } + if (hasType === 2) { + return 7; + } + if (hasType === 4) { + return 1; + } + if (hasType === 8) { + return 3; + } + if (hasType === 0) { + return 9; + } + return fakeMap; + } - this.name = "InvalidDependenciesModuleWarning"; - this.details = depsList.slice(3).join("\n"); - this.module = module; + getFakeMapInitStatement(fakeMap) { + return typeof fakeMap === "object" + ? `var fakeMap = ${JSON.stringify(fakeMap, null, "\t")};` + : ""; } -} -makeSerializable( - InvalidDependenciesModuleWarning, - "webpack/lib/InvalidDependenciesModuleWarning" -); + getReturn(type, asyncModule) { + if (type === 9) { + return "__webpack_require__(id)"; + } + return `${RuntimeGlobals.createFakeNamespaceObject}(id, ${type}${ + asyncModule ? " | 16" : "" + })`; + } -module.exports = InvalidDependenciesModuleWarning; + getReturnModuleObjectSource( + fakeMap, + asyncModule, + fakeMapDataExpression = "fakeMap[id]" + ) { + if (typeof fakeMap === "number") { + return `return ${this.getReturn(fakeMap, asyncModule)};`; + } + return `return ${ + RuntimeGlobals.createFakeNamespaceObject + }(id, ${fakeMapDataExpression}${asyncModule ? " | 16" : ""})`; + } + /** + * @param {TODO} dependencies TODO + * @param {TODO} id TODO + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {string} source code + */ + getSyncSource(dependencies, id, chunkGraph) { + const map = this.getUserRequestMap(dependencies, chunkGraph); + const fakeMap = this.getFakeMap(dependencies, chunkGraph); + const returnModuleObject = this.getReturnModuleObjectSource(fakeMap); -/***/ }), + return `var map = ${JSON.stringify(map, null, "\t")}; +${this.getFakeMapInitStatement(fakeMap)} -/***/ 52329: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +function webpackContext(req) { + var id = webpackContextResolve(req); + ${returnModuleObject} +} +function webpackContextResolve(req) { + if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + } + return map[req]; +} +webpackContext.keys = function webpackContextKeys() { + return Object.keys(map); +}; +webpackContext.resolve = webpackContextResolve; +module.exports = webpackContext; +webpackContext.id = ${JSON.stringify(id)};`; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sergey Melyukov @smelukov -*/ + /** + * @param {TODO} dependencies TODO + * @param {TODO} id TODO + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {string} source code + */ + getWeakSyncSource(dependencies, id, chunkGraph) { + const map = this.getUserRequestMap(dependencies, chunkGraph); + const fakeMap = this.getFakeMap(dependencies, chunkGraph); + const returnModuleObject = this.getReturnModuleObjectSource(fakeMap); + return `var map = ${JSON.stringify(map, null, "\t")}; +${this.getFakeMapInitStatement(fakeMap)} +function webpackContext(req) { + var id = webpackContextResolve(req); + if(!${RuntimeGlobals.moduleFactories}[id]) { + var e = new Error("Module '" + req + "' ('" + id + "') is not available (weak dependency)"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + } + ${returnModuleObject} +} +function webpackContextResolve(req) { + if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + } + return map[req]; +} +webpackContext.keys = function webpackContextKeys() { + return Object.keys(map); +}; +webpackContext.resolve = webpackContextResolve; +webpackContext.id = ${JSON.stringify(id)}; +module.exports = webpackContext;`; + } -const InnerGraph = __webpack_require__(38988); + /** + * @param {TODO} dependencies TODO + * @param {TODO} id TODO + * @param {Object} context context + * @param {ChunkGraph} context.chunkGraph the chunk graph + * @param {RuntimeTemplate} context.runtimeTemplate the chunk graph + * @returns {string} source code + */ + getAsyncWeakSource(dependencies, id, { chunkGraph, runtimeTemplate }) { + const arrow = runtimeTemplate.supportsArrowFunction(); + const map = this.getUserRequestMap(dependencies, chunkGraph); + const fakeMap = this.getFakeMap(dependencies, chunkGraph); + const returnModuleObject = this.getReturnModuleObjectSource(fakeMap, true); -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ + return `var map = ${JSON.stringify(map, null, "\t")}; +${this.getFakeMapInitStatement(fakeMap)} + +function webpackAsyncContext(req) { + return webpackAsyncContextResolve(req).then(${ + arrow ? "id =>" : "function(id)" + } { + if(!${RuntimeGlobals.moduleFactories}[id]) { + var e = new Error("Module '" + req + "' ('" + id + "') is not available (weak dependency)"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + } + ${returnModuleObject} + }); +} +function webpackAsyncContextResolve(req) { + // Here Promise.resolve().then() is used instead of new Promise() to prevent + // uncaught exception popping up in devtools + return Promise.resolve().then(${arrow ? "() =>" : "function()"} { + if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + } + return map[req]; + }); +} +webpackAsyncContext.keys = ${runtimeTemplate.returningFunction( + "Object.keys(map)" + )}; +webpackAsyncContext.resolve = webpackAsyncContextResolve; +webpackAsyncContext.id = ${JSON.stringify(id)}; +module.exports = webpackAsyncContext;`; + } -class JavascriptMetaInfoPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {TODO} dependencies TODO + * @param {TODO} id TODO + * @param {Object} context context + * @param {ChunkGraph} context.chunkGraph the chunk graph + * @param {RuntimeTemplate} context.runtimeTemplate the chunk graph + * @returns {string} source code */ - apply(compiler) { - compiler.hooks.compilation.tap( - "JavascriptMetaInfoPlugin", - (compilation, { normalModuleFactory }) => { - /** - * @param {JavascriptParser} parser the parser - * @returns {void} - */ - const handler = parser => { - parser.hooks.call.for("eval").tap("JavascriptMetaInfoPlugin", () => { - parser.state.module.buildInfo.moduleConcatenationBailout = "eval()"; - parser.state.module.buildInfo.usingEval = true; - const currentSymbol = InnerGraph.getTopLevelSymbol(parser.state); - if (currentSymbol) { - InnerGraph.addUsage(parser.state, null, currentSymbol); - } else { - InnerGraph.bailout(parser.state); - } - }); - parser.hooks.finish.tap("JavascriptMetaInfoPlugin", () => { - let topLevelDeclarations = - parser.state.module.buildInfo.topLevelDeclarations; - if (topLevelDeclarations === undefined) { - topLevelDeclarations = - parser.state.module.buildInfo.topLevelDeclarations = new Set(); - } - for (const name of parser.scope.definitions.asSet()) { - const freeInfo = parser.getFreeInfoFromVariable(name); - if (freeInfo === undefined) { - topLevelDeclarations.add(name); - } - } - }); - }; + getEagerSource(dependencies, id, { chunkGraph, runtimeTemplate }) { + const arrow = runtimeTemplate.supportsArrowFunction(); + const map = this.getUserRequestMap(dependencies, chunkGraph); + const fakeMap = this.getFakeMap(dependencies, chunkGraph); + const thenFunction = + fakeMap !== 9 + ? `${arrow ? "id =>" : "function(id)"} { + ${this.getReturnModuleObjectSource(fakeMap)} + }` + : "__webpack_require__"; + return `var map = ${JSON.stringify(map, null, "\t")}; +${this.getFakeMapInitStatement(fakeMap)} - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("JavascriptMetaInfoPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("JavascriptMetaInfoPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("JavascriptMetaInfoPlugin", handler); - } - ); - } +function webpackAsyncContext(req) { + return webpackAsyncContextResolve(req).then(${thenFunction}); } +function webpackAsyncContextResolve(req) { + // Here Promise.resolve().then() is used instead of new Promise() to prevent + // uncaught exception popping up in devtools + return Promise.resolve().then(${arrow ? "() =>" : "function()"} { + if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + } + return map[req]; + }); +} +webpackAsyncContext.keys = ${runtimeTemplate.returningFunction( + "Object.keys(map)" + )}; +webpackAsyncContext.resolve = webpackAsyncContextResolve; +webpackAsyncContext.id = ${JSON.stringify(id)}; +module.exports = webpackAsyncContext;`; + } -module.exports = JavascriptMetaInfoPlugin; + /** + * @param {TODO} block TODO + * @param {TODO} dependencies TODO + * @param {TODO} id TODO + * @param {Object} options options object + * @param {RuntimeTemplate} options.runtimeTemplate the runtime template + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @returns {string} source code + */ + getLazyOnceSource(block, dependencies, id, { runtimeTemplate, chunkGraph }) { + const promise = runtimeTemplate.blockPromise({ + chunkGraph, + block, + message: "lazy-once context", + runtimeRequirements: new Set() + }); + const arrow = runtimeTemplate.supportsArrowFunction(); + const map = this.getUserRequestMap(dependencies, chunkGraph); + const fakeMap = this.getFakeMap(dependencies, chunkGraph); + const thenFunction = + fakeMap !== 9 + ? `${arrow ? "id =>" : "function(id)"} { + ${this.getReturnModuleObjectSource(fakeMap, true)}; + }` + : "__webpack_require__"; + return `var map = ${JSON.stringify(map, null, "\t")}; +${this.getFakeMapInitStatement(fakeMap)} -/***/ }), +function webpackAsyncContext(req) { + return webpackAsyncContextResolve(req).then(${thenFunction}); +} +function webpackAsyncContextResolve(req) { + return ${promise}.then(${arrow ? "() =>" : "function()"} { + if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + } + return map[req]; + }); +} +webpackAsyncContext.keys = ${runtimeTemplate.returningFunction( + "Object.keys(map)" + )}; +webpackAsyncContext.resolve = webpackAsyncContextResolve; +webpackAsyncContext.id = ${JSON.stringify(id)}; +module.exports = webpackAsyncContext;`; + } -/***/ 93837: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * @param {TODO} blocks TODO + * @param {TODO} id TODO + * @param {Object} context context + * @param {ChunkGraph} context.chunkGraph the chunk graph + * @param {RuntimeTemplate} context.runtimeTemplate the chunk graph + * @returns {string} source code + */ + getLazySource(blocks, id, { chunkGraph, runtimeTemplate }) { + const moduleGraph = chunkGraph.moduleGraph; + const arrow = runtimeTemplate.supportsArrowFunction(); + let hasMultipleOrNoChunks = false; + let hasNoChunk = true; + const fakeMap = this.getFakeMap( + blocks.map(b => b.dependencies[0]), + chunkGraph + ); + const hasFakeMap = typeof fakeMap === "object"; + const items = blocks + .map(block => { + const dependency = block.dependencies[0]; + return { + dependency: dependency, + module: moduleGraph.getModule(dependency), + block: block, + userRequest: dependency.userRequest, + chunks: undefined + }; + }) + .filter(item => item.module); + for (const item of items) { + const chunkGroup = chunkGraph.getBlockChunkGroup(item.block); + const chunks = (chunkGroup && chunkGroup.chunks) || []; + item.chunks = chunks; + if (chunks.length > 0) { + hasNoChunk = false; + } + if (chunks.length !== 1) { + hasMultipleOrNoChunks = true; + } + } + const shortMode = hasNoChunk && !hasFakeMap; + const sortedItems = items.sort((a, b) => { + if (a.userRequest === b.userRequest) return 0; + return a.userRequest < b.userRequest ? -1 : 1; + }); + const map = Object.create(null); + for (const item of sortedItems) { + const moduleId = chunkGraph.getModuleId(item.module); + if (shortMode) { + map[item.userRequest] = moduleId; + } else { + const arrayStart = [moduleId]; + if (hasFakeMap) { + arrayStart.push(fakeMap[moduleId]); + } + map[item.userRequest] = arrayStart.concat( + item.chunks.map(chunk => chunk.id) + ); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const chunksStartPosition = hasFakeMap ? 2 : 1; + const requestPrefix = hasNoChunk + ? "Promise.resolve()" + : hasMultipleOrNoChunks + ? `Promise.all(ids.slice(${chunksStartPosition}).map(${RuntimeGlobals.ensureChunk}))` + : `${RuntimeGlobals.ensureChunk}(ids[${chunksStartPosition}])`; + const returnModuleObject = this.getReturnModuleObjectSource( + fakeMap, + true, + shortMode ? "invalid" : "ids[1]" + ); + const webpackAsyncContext = + requestPrefix === "Promise.resolve()" + ? ` +function webpackAsyncContext(req) { + return Promise.resolve().then(${arrow ? "() =>" : "function()"} { + if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + } + ${shortMode ? "var id = map[req];" : "var ids = map[req], id = ids[0];"} + ${returnModuleObject} + }); +}` + : `function webpackAsyncContext(req) { + if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { + return Promise.resolve().then(${arrow ? "() =>" : "function()"} { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + }); + } -const asyncLib = __webpack_require__(78175); -const EntryDependency = __webpack_require__(3979); -const { someInIterable } = __webpack_require__(39104); -const { compareModulesById } = __webpack_require__(29579); -const { dirname, mkdirp } = __webpack_require__(17139); + var ids = map[req], id = ids[0]; + return ${requestPrefix}.then(${arrow ? "() =>" : "function()"} { + ${returnModuleObject} + }); +}`; -/** @typedef {import("./Compiler")} Compiler */ + return `var map = ${JSON.stringify(map, null, "\t")}; +${webpackAsyncContext} +webpackAsyncContext.keys = ${runtimeTemplate.returningFunction( + "Object.keys(map)" + )}; +webpackAsyncContext.id = ${JSON.stringify(id)}; +module.exports = webpackAsyncContext;`; + } -/** - * @typedef {Object} ManifestModuleData - * @property {string | number} id - * @property {Object} buildMeta - * @property {boolean | string[]} exports - */ + getSourceForEmptyContext(id, runtimeTemplate) { + return `function webpackEmptyContext(req) { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; +} +webpackEmptyContext.keys = ${runtimeTemplate.returningFunction("[]")}; +webpackEmptyContext.resolve = webpackEmptyContext; +webpackEmptyContext.id = ${JSON.stringify(id)}; +module.exports = webpackEmptyContext;`; + } -class LibManifestPlugin { - constructor(options) { - this.options = options; + getSourceForEmptyAsyncContext(id, runtimeTemplate) { + const arrow = runtimeTemplate.supportsArrowFunction(); + return `function webpackEmptyAsyncContext(req) { + // Here Promise.resolve().then() is used instead of new Promise() to prevent + // uncaught exception popping up in devtools + return Promise.resolve().then(${arrow ? "() =>" : "function()"} { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + }); +} +webpackEmptyAsyncContext.keys = ${runtimeTemplate.returningFunction("[]")}; +webpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext; +webpackEmptyAsyncContext.id = ${JSON.stringify(id)}; +module.exports = webpackEmptyAsyncContext;`; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {string} asyncMode module mode + * @param {CodeGenerationContext} context context info + * @returns {string} the source code */ - apply(compiler) { - compiler.hooks.emit.tapAsync( - "LibManifestPlugin", - (compilation, callback) => { - const moduleGraph = compilation.moduleGraph; - asyncLib.forEach( - Array.from(compilation.chunks), - (chunk, callback) => { - if (!chunk.canBeInitial()) { - callback(); - return; - } - const chunkGraph = compilation.chunkGraph; - const targetPath = compilation.getPath(this.options.path, { - chunk - }); - const name = - this.options.name && - compilation.getPath(this.options.name, { - chunk - }); - const content = Object.create(null); - for (const module of chunkGraph.getOrderedChunkModulesIterable( - chunk, - compareModulesById(chunkGraph) - )) { - if ( - this.options.entryOnly && - !someInIterable( - moduleGraph.getIncomingConnections(module), - c => c.dependency instanceof EntryDependency - ) - ) { - continue; - } - const ident = module.libIdent({ - context: this.options.context || compiler.options.context, - associatedObjectForCache: compiler.root - }); - if (ident) { - const exportsInfo = moduleGraph.getExportsInfo(module); - const providedExports = exportsInfo.getProvidedExports(); - /** @type {ManifestModuleData} */ - const data = { - id: chunkGraph.getModuleId(module), - buildMeta: module.buildMeta, - exports: Array.isArray(providedExports) - ? providedExports - : undefined - }; - content[ident] = data; - } - } - const manifest = { - name, - type: this.options.type, - content - }; - // Apply formatting to content if format flag is true; - const manifestContent = this.options.format - ? JSON.stringify(manifest, null, 2) - : JSON.stringify(manifest); - const buffer = Buffer.from(manifestContent, "utf8"); - mkdirp( - compiler.intermediateFileSystem, - dirname(compiler.intermediateFileSystem, targetPath), - err => { - if (err) return callback(err); - compiler.intermediateFileSystem.writeFile( - targetPath, - buffer, - callback - ); - } - ); - }, - callback - ); + getSourceString(asyncMode, { runtimeTemplate, chunkGraph }) { + const id = chunkGraph.getModuleId(this); + if (asyncMode === "lazy") { + if (this.blocks && this.blocks.length > 0) { + return this.getLazySource(this.blocks, id, { + runtimeTemplate, + chunkGraph + }); } - ); + return this.getSourceForEmptyAsyncContext(id, runtimeTemplate); + } + if (asyncMode === "eager") { + if (this.dependencies && this.dependencies.length > 0) { + return this.getEagerSource(this.dependencies, id, { + chunkGraph, + runtimeTemplate + }); + } + return this.getSourceForEmptyAsyncContext(id, runtimeTemplate); + } + if (asyncMode === "lazy-once") { + const block = this.blocks[0]; + if (block) { + return this.getLazyOnceSource(block, block.dependencies, id, { + runtimeTemplate, + chunkGraph + }); + } + return this.getSourceForEmptyAsyncContext(id, runtimeTemplate); + } + if (asyncMode === "async-weak") { + if (this.dependencies && this.dependencies.length > 0) { + return this.getAsyncWeakSource(this.dependencies, id, { + chunkGraph, + runtimeTemplate + }); + } + return this.getSourceForEmptyAsyncContext(id, runtimeTemplate); + } + if (asyncMode === "weak") { + if (this.dependencies && this.dependencies.length > 0) { + return this.getWeakSyncSource(this.dependencies, id, chunkGraph); + } + } + if (this.dependencies && this.dependencies.length > 0) { + return this.getSyncSource(this.dependencies, id, chunkGraph); + } + return this.getSourceForEmptyContext(id, runtimeTemplate); } -} -module.exports = LibManifestPlugin; - - -/***/ }), - -/***/ 14157: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const EnableLibraryPlugin = __webpack_require__(91452); -/** @typedef {import("../declarations/WebpackOptions").AuxiliaryComment} AuxiliaryComment */ -/** @typedef {import("../declarations/WebpackOptions").LibraryExport} LibraryExport */ -/** @typedef {import("../declarations/WebpackOptions").LibraryName} LibraryName */ -/** @typedef {import("../declarations/WebpackOptions").LibraryType} LibraryType */ -/** @typedef {import("../declarations/WebpackOptions").UmdNamedDefine} UmdNamedDefine */ -/** @typedef {import("./Compiler")} Compiler */ + getSource(sourceString) { + if (this.useSourceMap || this.useSimpleSourceMap) { + return new OriginalSource(sourceString, this.identifier()); + } + return new RawSource(sourceString); + } -// TODO webpack 6 remove -class LibraryTemplatePlugin { /** - * @param {LibraryName} name name of library - * @param {LibraryType} target type of library - * @param {UmdNamedDefine} umdNamedDefine setting this to true will name the UMD module - * @param {AuxiliaryComment} auxiliaryComment comment in the UMD wrapper - * @param {LibraryExport} exportProperty which export should be exposed as library + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result */ - constructor(name, target, umdNamedDefine, auxiliaryComment, exportProperty) { - this.library = { - type: target || "var", - name, - umdNamedDefine, - auxiliaryComment, - export: exportProperty + codeGeneration(context) { + const { chunkGraph } = context; + const sources = new Map(); + sources.set( + "javascript", + this.getSource(this.getSourceString(this.options.mode, context)) + ); + const set = new Set(); + const allDeps = /** @type {ContextElementDependency[]} */ ( + this.dependencies.concat(this.blocks.map(b => b.dependencies[0])) + ); + set.add(RuntimeGlobals.module); + set.add(RuntimeGlobals.hasOwnProperty); + if (allDeps.length > 0) { + const asyncMode = this.options.mode; + set.add(RuntimeGlobals.require); + if (asyncMode === "weak") { + set.add(RuntimeGlobals.moduleFactories); + } else if (asyncMode === "async-weak") { + set.add(RuntimeGlobals.moduleFactories); + set.add(RuntimeGlobals.ensureChunk); + } else if (asyncMode === "lazy" || asyncMode === "lazy-once") { + set.add(RuntimeGlobals.ensureChunk); + } + if (this.getFakeMap(allDeps, chunkGraph) !== 9) { + set.add(RuntimeGlobals.createFakeNamespaceObject); + } + } + return { + sources, + runtimeRequirements: set }; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) */ - apply(compiler) { - const { output } = compiler.options; - output.library = this.library; - new EnableLibraryPlugin(this.library.type).apply(compiler); - } -} - -module.exports = LibraryTemplatePlugin; - - -/***/ }), - -/***/ 22078: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const ModuleFilenameHelpers = __webpack_require__(88821); -const NormalModule = __webpack_require__(39); -const createSchemaValidation = __webpack_require__(32540); - -/** @typedef {import("../declarations/plugins/LoaderOptionsPlugin").LoaderOptionsPluginOptions} LoaderOptionsPluginOptions */ -/** @typedef {import("./Compiler")} Compiler */ + size(type) { + // base penalty + let size = 160; -const validate = createSchemaValidation( - __webpack_require__(24160), - () => __webpack_require__(15965), - { - name: "Loader Options Plugin", - baseDataPath: "options" - } -); -class LoaderOptionsPlugin { - /** - * @param {LoaderOptionsPluginOptions} options options object - */ - constructor(options = {}) { - validate(options); - if (typeof options !== "object") options = {}; - if (!options.test) { - options.test = { - test: () => true - }; + // if we don't have dependencies we stop here. + for (const dependency of this.dependencies) { + const element = /** @type {ContextElementDependency} */ (dependency); + size += 5 + element.userRequest.length; } - this.options = options; + return size; } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const options = this.options; - compiler.hooks.compilation.tap("LoaderOptionsPlugin", compilation => { - NormalModule.getCompilationHooks(compilation).loader.tap( - "LoaderOptionsPlugin", - (context, module) => { - const resource = module.resource; - if (!resource) return; - const i = resource.indexOf("?"); - if ( - ModuleFilenameHelpers.matchObject( - options, - i < 0 ? resource : resource.substr(0, i) - ) - ) { - for (const key of Object.keys(options)) { - if (key === "include" || key === "exclude" || key === "test") { - continue; - } - context[key] = options[key]; - } - } - } - ); - }); + serialize(context) { + const { write } = context; + write(this._identifier); + write(this._forceBuild); + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + this._identifier = read(); + this._forceBuild = read(); + super.deserialize(context); } } -module.exports = LoaderOptionsPlugin; +makeSerializable(ContextModule, "webpack/lib/ContextModule"); + +module.exports = ContextModule; /***/ }), -/***/ 86738: +/***/ 62471: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -43275,378 +37980,397 @@ module.exports = LoaderOptionsPlugin; -const NormalModule = __webpack_require__(39); +const asyncLib = __webpack_require__(78175); +const { AsyncSeriesWaterfallHook, SyncWaterfallHook } = __webpack_require__(41242); +const ContextModule = __webpack_require__(76729); +const ModuleFactory = __webpack_require__(51010); +const ContextElementDependency = __webpack_require__(58477); +const LazySet = __webpack_require__(38938); +const { cachedSetProperty } = __webpack_require__(60839); +const { createFakeHook } = __webpack_require__(64518); +const { join } = __webpack_require__(17139); -/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./ContextModule").ContextModuleOptions} ContextModuleOptions */ +/** @typedef {import("./ContextModule").ResolveDependenciesCallback} ResolveDependenciesCallback */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ +/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ +/** @typedef {import("./ResolverFactory")} ResolverFactory */ +/** @typedef {import("./dependencies/ContextDependency")} ContextDependency */ +/** @template T @typedef {import("./util/deprecation").FakeHook} FakeHook */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ -class LoaderTargetPlugin { +const EMPTY_RESOLVE_OPTIONS = {}; + +module.exports = class ContextModuleFactory extends ModuleFactory { /** - * @param {string} target the target + * @param {ResolverFactory} resolverFactory resolverFactory */ - constructor(target) { - this.target = target; + constructor(resolverFactory) { + super(); + /** @type {AsyncSeriesWaterfallHook<[TODO[], ContextModuleOptions]>} */ + const alternativeRequests = new AsyncSeriesWaterfallHook([ + "modules", + "options" + ]); + this.hooks = Object.freeze({ + /** @type {AsyncSeriesWaterfallHook<[TODO]>} */ + beforeResolve: new AsyncSeriesWaterfallHook(["data"]), + /** @type {AsyncSeriesWaterfallHook<[TODO]>} */ + afterResolve: new AsyncSeriesWaterfallHook(["data"]), + /** @type {SyncWaterfallHook<[string[]]>} */ + contextModuleFiles: new SyncWaterfallHook(["files"]), + /** @type {FakeHook, "tap" | "tapAsync" | "tapPromise" | "name">>} */ + alternatives: createFakeHook( + { + name: "alternatives", + /** @type {AsyncSeriesWaterfallHook<[TODO[]]>["intercept"]} */ + intercept: interceptor => { + throw new Error( + "Intercepting fake hook ContextModuleFactory.hooks.alternatives is not possible, use ContextModuleFactory.hooks.alternativeRequests instead" + ); + }, + /** @type {AsyncSeriesWaterfallHook<[TODO[]]>["tap"]} */ + tap: (options, fn) => { + alternativeRequests.tap(options, fn); + }, + /** @type {AsyncSeriesWaterfallHook<[TODO[]]>["tapAsync"]} */ + tapAsync: (options, fn) => { + alternativeRequests.tapAsync(options, (items, _options, callback) => + fn(items, callback) + ); + }, + /** @type {AsyncSeriesWaterfallHook<[TODO[]]>["tapPromise"]} */ + tapPromise: (options, fn) => { + alternativeRequests.tapPromise(options, fn); + } + }, + "ContextModuleFactory.hooks.alternatives has deprecated in favor of ContextModuleFactory.hooks.alternativeRequests with an additional options argument.", + "DEP_WEBPACK_CONTEXT_MODULE_FACTORY_ALTERNATIVES" + ), + alternativeRequests + }); + this.resolverFactory = resolverFactory; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {ModuleFactoryCreateData} data data object + * @param {function(Error=, ModuleFactoryResult=): void} callback callback * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap("LoaderTargetPlugin", compilation => { - NormalModule.getCompilationHooks(compilation).loader.tap( - "LoaderTargetPlugin", - loaderContext => { - loaderContext.target = this.target; + create(data, callback) { + const context = data.context; + const dependencies = data.dependencies; + const resolveOptions = data.resolveOptions; + const dependency = /** @type {ContextDependency} */ (dependencies[0]); + const fileDependencies = new LazySet(); + const missingDependencies = new LazySet(); + const contextDependencies = new LazySet(); + this.hooks.beforeResolve.callAsync( + { + context: context, + dependencies: dependencies, + resolveOptions, + fileDependencies, + missingDependencies, + contextDependencies, + ...dependency.options + }, + (err, beforeResolveResult) => { + if (err) { + return callback(err, { + fileDependencies, + missingDependencies, + contextDependencies + }); } - ); - }); - } -} - -module.exports = LoaderTargetPlugin; - - -/***/ }), - -/***/ 12856: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // Ignored + if (!beforeResolveResult) { + return callback(null, { + fileDependencies, + missingDependencies, + contextDependencies + }); + } + const context = beforeResolveResult.context; + const request = beforeResolveResult.request; + const resolveOptions = beforeResolveResult.resolveOptions; -const { SyncWaterfallHook } = __webpack_require__(6967); -const util = __webpack_require__(73837); -const RuntimeGlobals = __webpack_require__(16475); -const memoize = __webpack_require__(78676); + let loaders, + resource, + loadersPrefix = ""; + const idx = request.lastIndexOf("!"); + if (idx >= 0) { + let loadersRequest = request.substr(0, idx + 1); + let i; + for ( + i = 0; + i < loadersRequest.length && loadersRequest[i] === "!"; + i++ + ) { + loadersPrefix += "!"; + } + loadersRequest = loadersRequest + .substr(i) + .replace(/!+$/, "") + .replace(/!!+/g, "!"); + if (loadersRequest === "") { + loaders = []; + } else { + loaders = loadersRequest.split("!"); + } + resource = request.substr(idx + 1); + } else { + loaders = []; + resource = request; + } -/** @typedef {import("webpack-sources").ConcatSource} ConcatSource */ -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").Output} OutputOptions */ -/** @typedef {import("./ModuleTemplate")} ModuleTemplate */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("./Module")} Module} */ -/** @typedef {import("./util/Hash")} Hash} */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates} */ -/** @typedef {import("./javascript/JavascriptModulesPlugin").RenderContext} RenderContext} */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate} */ -/** @typedef {import("./ModuleGraph")} ModuleGraph} */ -/** @typedef {import("./ChunkGraph")} ChunkGraph} */ -/** @typedef {import("./Template").RenderManifestOptions} RenderManifestOptions} */ -/** @typedef {import("./Template").RenderManifestEntry} RenderManifestEntry} */ + const contextResolver = this.resolverFactory.get( + "context", + dependencies.length > 0 + ? cachedSetProperty( + resolveOptions || EMPTY_RESOLVE_OPTIONS, + "dependencyType", + dependencies[0].category + ) + : resolveOptions + ); + const loaderResolver = this.resolverFactory.get("loader"); -const getJavascriptModulesPlugin = memoize(() => - __webpack_require__(89464) -); -const getJsonpTemplatePlugin = memoize(() => - __webpack_require__(4607) -); -const getLoadScriptRuntimeModule = memoize(() => - __webpack_require__(19942) -); + asyncLib.parallel( + [ + callback => { + contextResolver.resolve( + {}, + context, + resource, + { + fileDependencies, + missingDependencies, + contextDependencies + }, + (err, result) => { + if (err) return callback(err); + callback(null, result); + } + ); + }, + callback => { + asyncLib.map( + loaders, + (loader, callback) => { + loaderResolver.resolve( + {}, + context, + loader, + { + fileDependencies, + missingDependencies, + contextDependencies + }, + (err, result) => { + if (err) return callback(err); + callback(null, result); + } + ); + }, + callback + ); + } + ], + (err, result) => { + if (err) { + return callback(err, { + fileDependencies, + missingDependencies, + contextDependencies + }); + } -// TODO webpack 6 remove this class -class MainTemplate { - /** - * - * @param {OutputOptions} outputOptions output options for the MainTemplate - * @param {Compilation} compilation the compilation - */ - constructor(outputOptions, compilation) { - /** @type {OutputOptions} */ - this._outputOptions = outputOptions || {}; - this.hooks = Object.freeze({ - renderManifest: { - tap: util.deprecate( - (options, fn) => { - compilation.hooks.renderManifest.tap( - options, - (entries, options) => { - if (!options.chunk.hasRuntime()) return entries; - return fn(entries, options); + this.hooks.afterResolve.callAsync( + { + addon: + loadersPrefix + + result[1].join("!") + + (result[1].length > 0 ? "!" : ""), + resource: result[0], + resolveDependencies: this.resolveDependencies.bind(this), + ...beforeResolveResult + }, + (err, result) => { + if (err) { + return callback(err, { + fileDependencies, + missingDependencies, + contextDependencies + }); + } + + // Ignored + if (!result) { + return callback(null, { + fileDependencies, + missingDependencies, + contextDependencies + }); + } + + return callback(null, { + module: new ContextModule(result.resolveDependencies, result), + fileDependencies, + missingDependencies, + contextDependencies + }); } ); + } + ); + } + ); + } + + /** + * @param {InputFileSystem} fs file system + * @param {ContextModuleOptions} options options + * @param {ResolveDependenciesCallback} callback callback function + * @returns {void} + */ + resolveDependencies(fs, options, callback) { + const cmf = this; + const { + resource, + resourceQuery, + resourceFragment, + recursive, + regExp, + include, + exclude, + referencedExports, + category, + typePrefix + } = options; + if (!regExp || !resource) return callback(null, []); + + const addDirectoryChecked = (directory, visited, callback) => { + fs.realpath(directory, (err, realPath) => { + if (err) return callback(err); + if (visited.has(realPath)) return callback(null, []); + let recursionStack; + addDirectory( + directory, + (dir, callback) => { + if (recursionStack === undefined) { + recursionStack = new Set(visited); + recursionStack.add(realPath); + } + addDirectoryChecked(dir, recursionStack, callback); }, - "MainTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_RENDER_MANIFEST" - ) - }, - modules: { - tap: () => { - throw new Error( - "MainTemplate.hooks.modules has been removed (there is no replacement, please create an issue to request that)" - ); - } - }, - moduleObj: { - tap: () => { - throw new Error( - "MainTemplate.hooks.moduleObj has been removed (there is no replacement, please create an issue to request that)" - ); - } - }, - require: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .renderRequire.tap(options, fn); - }, - "MainTemplate.hooks.require is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderRequire instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_REQUIRE" - ) - }, - beforeStartup: { - tap: () => { - throw new Error( - "MainTemplate.hooks.beforeStartup has been removed (use RuntimeGlobals.startupOnlyBefore instead)" - ); - } - }, - startup: { - tap: () => { - throw new Error( - "MainTemplate.hooks.startup has been removed (use RuntimeGlobals.startup instead)" - ); - } - }, - afterStartup: { - tap: () => { - throw new Error( - "MainTemplate.hooks.afterStartup has been removed (use RuntimeGlobals.startupOnlyAfter instead)" - ); - } - }, - render: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .render.tap(options, (source, renderContext) => { - if ( - renderContext.chunkGraph.getNumberOfEntryModules( - renderContext.chunk - ) === 0 || - !renderContext.chunk.hasRuntime() - ) { - return source; + callback + ); + }); + }; + + const addDirectory = (directory, addSubDirectory, callback) => { + fs.readdir(directory, (err, files) => { + if (err) return callback(err); + const processedFiles = cmf.hooks.contextModuleFiles.call( + /** @type {string[]} */ (files).map(file => file.normalize("NFC")) + ); + if (!processedFiles || processedFiles.length === 0) + return callback(null, []); + asyncLib.map( + processedFiles.filter(p => p.indexOf(".") !== 0), + (segment, callback) => { + const subResource = join(fs, directory, segment); + + if (!exclude || !subResource.match(exclude)) { + fs.stat(subResource, (err, stat) => { + if (err) { + if (err.code === "ENOENT") { + // ENOENT is ok here because the file may have been deleted between + // the readdir and stat calls. + return callback(); + } else { + return callback(err); + } } - return fn( - source, - renderContext.chunk, - compilation.hash, - compilation.moduleTemplates.javascript, - compilation.dependencyTemplates - ); - }); - }, - "MainTemplate.hooks.render is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_RENDER" - ) - }, - renderWithEntry: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .render.tap(options, (source, renderContext) => { - if ( - renderContext.chunkGraph.getNumberOfEntryModules( - renderContext.chunk - ) === 0 || - !renderContext.chunk.hasRuntime() + + if (stat.isDirectory()) { + if (!recursive) return callback(); + addSubDirectory(subResource, callback); + } else if ( + stat.isFile() && + (!include || subResource.match(include)) ) { - return source; + const obj = { + context: resource, + request: + "." + + subResource.substr(resource.length).replace(/\\/g, "/") + }; + + this.hooks.alternativeRequests.callAsync( + [obj], + options, + (err, alternatives) => { + if (err) return callback(err); + alternatives = alternatives + .filter(obj => regExp.test(obj.request)) + .map(obj => { + const dep = new ContextElementDependency( + obj.request + resourceQuery + resourceFragment, + obj.request, + typePrefix, + category, + referencedExports + ); + dep.optional = true; + return dep; + }); + callback(null, alternatives); + } + ); + } else { + callback(); } - return fn(source, renderContext.chunk, compilation.hash); - }); - }, - "MainTemplate.hooks.renderWithEntry is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_RENDER_WITH_ENTRY" - ) - }, - assetPath: { - tap: util.deprecate( - (options, fn) => { - compilation.hooks.assetPath.tap(options, fn); - }, - "MainTemplate.hooks.assetPath is deprecated (use Compilation.hooks.assetPath instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_ASSET_PATH" - ), - call: util.deprecate( - (filename, options) => { - return compilation.getAssetPath(filename, options); - }, - "MainTemplate.hooks.assetPath is deprecated (use Compilation.hooks.assetPath instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_ASSET_PATH" - ) - }, - hash: { - tap: util.deprecate( - (options, fn) => { - compilation.hooks.fullHash.tap(options, fn); - }, - "MainTemplate.hooks.hash is deprecated (use Compilation.hooks.fullHash instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_HASH" - ) - }, - hashForChunk: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .chunkHash.tap(options, (chunk, hash) => { - if (!chunk.hasRuntime()) return; - return fn(hash, chunk); }); + } else { + callback(); + } }, - "MainTemplate.hooks.hashForChunk is deprecated (use JavascriptModulesPlugin.getCompilationHooks().chunkHash instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK" - ) - }, - globalHashPaths: { - tap: util.deprecate( - () => {}, - "MainTemplate.hooks.globalHashPaths has been removed (it's no longer needed)", - "DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK" - ) - }, - globalHash: { - tap: util.deprecate( - () => {}, - "MainTemplate.hooks.globalHash has been removed (it's no longer needed)", - "DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK" - ) - }, - hotBootstrap: { - tap: () => { - throw new Error( - "MainTemplate.hooks.hotBootstrap has been removed (use your own RuntimeModule instead)" - ); - } - }, + (err, result) => { + if (err) return callback(err); - // for compatibility: - /** @type {SyncWaterfallHook<[string, Chunk, string, ModuleTemplate, DependencyTemplates]>} */ - bootstrap: new SyncWaterfallHook([ - "source", - "chunk", - "hash", - "moduleTemplate", - "dependencyTemplates" - ]), - /** @type {SyncWaterfallHook<[string, Chunk, string]>} */ - localVars: new SyncWaterfallHook(["source", "chunk", "hash"]), - /** @type {SyncWaterfallHook<[string, Chunk, string]>} */ - requireExtensions: new SyncWaterfallHook(["source", "chunk", "hash"]), - /** @type {SyncWaterfallHook<[string, Chunk, string, string]>} */ - requireEnsure: new SyncWaterfallHook([ - "source", - "chunk", - "hash", - "chunkIdExpression" - ]), - get jsonpScript() { - const hooks = - getLoadScriptRuntimeModule().getCompilationHooks(compilation); - return hooks.createScript; - }, - get linkPrefetch() { - const hooks = getJsonpTemplatePlugin().getCompilationHooks(compilation); - return hooks.linkPrefetch; - }, - get linkPreload() { - const hooks = getJsonpTemplatePlugin().getCompilationHooks(compilation); - return hooks.linkPreload; - } - }); + if (!result) return callback(null, []); - this.renderCurrentHashCode = util.deprecate( - /** - * @deprecated - * @param {string} hash the hash - * @param {number=} length length of the hash - * @returns {string} generated code - */ (hash, length) => { - if (length) { - return `${RuntimeGlobals.getFullHash} ? ${ - RuntimeGlobals.getFullHash - }().slice(0, ${length}) : ${hash.slice(0, length)}`; - } - return `${RuntimeGlobals.getFullHash} ? ${RuntimeGlobals.getFullHash}() : ${hash}`; - }, - "MainTemplate.renderCurrentHashCode is deprecated (use RuntimeGlobals.getFullHash runtime function instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_RENDER_CURRENT_HASH_CODE" - ); + const flattenedResult = []; - this.getPublicPath = util.deprecate( - /** - * - * @param {object} options get public path options - * @returns {string} hook call - */ options => { - return compilation.getAssetPath( - compilation.outputOptions.publicPath, - options - ); - }, - "MainTemplate.getPublicPath is deprecated (use Compilation.getAssetPath(compilation.outputOptions.publicPath, options) instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_GET_PUBLIC_PATH" - ); + for (const item of result) { + if (item) flattenedResult.push(...item); + } - this.getAssetPath = util.deprecate( - (path, options) => { - return compilation.getAssetPath(path, options); - }, - "MainTemplate.getAssetPath is deprecated (use Compilation.getAssetPath instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_GET_ASSET_PATH" - ); + callback(null, flattenedResult); + } + ); + }); + }; - this.getAssetPathWithInfo = util.deprecate( - (path, options) => { - return compilation.getAssetPathWithInfo(path, options); - }, - "MainTemplate.getAssetPathWithInfo is deprecated (use Compilation.getAssetPath instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_GET_ASSET_PATH_WITH_INFO" - ); + if (typeof fs.realpath === "function") { + addDirectoryChecked(resource, new Set(), callback); + } else { + const addSubDirectory = (dir, callback) => + addDirectory(dir, addSubDirectory, callback); + addDirectory(resource, addSubDirectory, callback); + } } -} - -Object.defineProperty(MainTemplate.prototype, "requireFn", { - get: util.deprecate( - () => "__webpack_require__", - 'MainTemplate.requireFn is deprecated (use "__webpack_require__")', - "DEP_WEBPACK_MAIN_TEMPLATE_REQUIRE_FN" - ) -}); - -Object.defineProperty(MainTemplate.prototype, "outputOptions", { - get: util.deprecate( - /** - * @this {MainTemplate} - * @returns {OutputOptions} output options - */ - function () { - return this._outputOptions; - }, - "MainTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_OUTPUT_OPTIONS" - ) -}); - -module.exports = MainTemplate; +}; /***/ }), -/***/ 73208: +/***/ 12206: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -43657,769 +38381,874 @@ module.exports = MainTemplate; -const util = __webpack_require__(73837); -const ChunkGraph = __webpack_require__(64971); -const DependenciesBlock = __webpack_require__(71040); -const ModuleGraph = __webpack_require__(99988); -const RuntimeGlobals = __webpack_require__(16475); -const { first } = __webpack_require__(93347); -const { compareChunksById } = __webpack_require__(29579); -const makeSerializable = __webpack_require__(33032); +const ContextElementDependency = __webpack_require__(58477); +const { join } = __webpack_require__(17139); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGroup")} ChunkGroup */ -/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./ConcatenationScope")} ConcatenationScope */ -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./ExportsInfo").UsageStateType} UsageStateType */ -/** @typedef {import("./FileSystemInfo")} FileSystemInfo */ -/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./WebpackError")} WebpackError */ -/** @typedef {import("./util/Hash")} Hash */ -/** @template T @typedef {import("./util/LazySet")} LazySet */ -/** @template T @typedef {import("./util/SortableSet")} SortableSet */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - -/** - * @typedef {Object} SourceContext - * @property {DependencyTemplates} dependencyTemplates the dependency templates - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {RuntimeSpec} runtime the runtimes code should be generated for - * @property {string=} type the type of source that should be generated - */ - -/** - * @typedef {Object} CodeGenerationContext - * @property {DependencyTemplates} dependencyTemplates the dependency templates - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {RuntimeSpec} runtime the runtimes code should be generated for - * @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules - * @property {CodeGenerationResults} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that) - */ - -/** - * @typedef {Object} ConcatenationBailoutReasonContext - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - */ - -/** - * @typedef {Object} CodeGenerationResult - * @property {Map} sources the resulting sources for all source types - * @property {Map=} data the resulting data for all source types - * @property {ReadonlySet} runtimeRequirements the runtime requirements - * @property {string=} hash a hash of the code generation result (will be automatically calculated from sources and runtimeRequirements if not provided) - */ +class ContextReplacementPlugin { + constructor( + resourceRegExp, + newContentResource, + newContentRecursive, + newContentRegExp + ) { + this.resourceRegExp = resourceRegExp; -/** - * @typedef {Object} LibIdentOptions - * @property {string} context absolute context path to which lib ident is relative to - * @property {Object=} associatedObjectForCache object for caching - */ + if (typeof newContentResource === "function") { + this.newContentCallback = newContentResource; + } else if ( + typeof newContentResource === "string" && + typeof newContentRecursive === "object" + ) { + this.newContentResource = newContentResource; + this.newContentCreateContextMap = (fs, callback) => { + callback(null, newContentRecursive); + }; + } else if ( + typeof newContentResource === "string" && + typeof newContentRecursive === "function" + ) { + this.newContentResource = newContentResource; + this.newContentCreateContextMap = newContentRecursive; + } else { + if (typeof newContentResource !== "string") { + newContentRegExp = newContentRecursive; + newContentRecursive = newContentResource; + newContentResource = undefined; + } + if (typeof newContentRecursive !== "boolean") { + newContentRegExp = newContentRecursive; + newContentRecursive = undefined; + } + this.newContentResource = newContentResource; + this.newContentRecursive = newContentRecursive; + this.newContentRegExp = newContentRegExp; + } + } -/** - * @typedef {Object} KnownBuildMeta - * @property {string=} moduleArgument - * @property {string=} exportsArgument - * @property {boolean=} strict - * @property {string=} moduleConcatenationBailout - * @property {("default" | "namespace" | "flagged" | "dynamic")=} exportsType - * @property {(false | "redirect" | "redirect-warn")=} defaultObject - * @property {boolean=} strictHarmonyModule - * @property {boolean=} async - * @property {boolean=} sideEffectFree - */ + apply(compiler) { + const resourceRegExp = this.resourceRegExp; + const newContentCallback = this.newContentCallback; + const newContentResource = this.newContentResource; + const newContentRecursive = this.newContentRecursive; + const newContentRegExp = this.newContentRegExp; + const newContentCreateContextMap = this.newContentCreateContextMap; -/** - * @typedef {Object} NeedBuildContext - * @property {Compilation} compilation - * @property {FileSystemInfo} fileSystemInfo - * @property {Map>} valueCacheVersions - */ + compiler.hooks.contextModuleFactory.tap("ContextReplacementPlugin", cmf => { + cmf.hooks.beforeResolve.tap("ContextReplacementPlugin", result => { + if (!result) return; + if (resourceRegExp.test(result.request)) { + if (newContentResource !== undefined) { + result.request = newContentResource; + } + if (newContentRecursive !== undefined) { + result.recursive = newContentRecursive; + } + if (newContentRegExp !== undefined) { + result.regExp = newContentRegExp; + } + if (typeof newContentCallback === "function") { + newContentCallback(result); + } else { + for (const d of result.dependencies) { + if (d.critical) d.critical = false; + } + } + } + return result; + }); + cmf.hooks.afterResolve.tap("ContextReplacementPlugin", result => { + if (!result) return; + if (resourceRegExp.test(result.resource)) { + if (newContentResource !== undefined) { + if ( + newContentResource.startsWith("/") || + (newContentResource.length > 1 && newContentResource[1] === ":") + ) { + result.resource = newContentResource; + } else { + result.resource = join( + compiler.inputFileSystem, + result.resource, + newContentResource + ); + } + } + if (newContentRecursive !== undefined) { + result.recursive = newContentRecursive; + } + if (newContentRegExp !== undefined) { + result.regExp = newContentRegExp; + } + if (typeof newContentCreateContextMap === "function") { + result.resolveDependencies = + createResolveDependenciesFromContextMap( + newContentCreateContextMap + ); + } + if (typeof newContentCallback === "function") { + const origResource = result.resource; + newContentCallback(result); + if ( + result.resource !== origResource && + !result.resource.startsWith("/") && + (result.resource.length <= 1 || result.resource[1] !== ":") + ) { + // When the function changed it to an relative path + result.resource = join( + compiler.inputFileSystem, + origResource, + result.resource + ); + } + } else { + for (const d of result.dependencies) { + if (d.critical) d.critical = false; + } + } + } + return result; + }); + }); + } +} -/** @typedef {KnownBuildMeta & Record} BuildMeta */ +const createResolveDependenciesFromContextMap = createContextMap => { + const resolveDependenciesFromContextMap = (fs, options, callback) => { + createContextMap(fs, (err, map) => { + if (err) return callback(err); + const dependencies = Object.keys(map).map(key => { + return new ContextElementDependency( + map[key] + options.resourceQuery + options.resourceFragment, + key, + options.category, + options.referencedExports + ); + }); + callback(null, dependencies); + }); + }; + return resolveDependenciesFromContextMap; +}; -const EMPTY_RESOLVE_OPTIONS = {}; +module.exports = ContextReplacementPlugin; -let debugId = 1000; -const DEFAULT_TYPES_UNKNOWN = new Set(["unknown"]); -const DEFAULT_TYPES_JS = new Set(["javascript"]); +/***/ }), -const deprecatedNeedRebuild = util.deprecate( - (module, context) => { - return module.needRebuild( - context.fileSystemInfo.getDeprecatedFileTimestamps(), - context.fileSystemInfo.getDeprecatedContextTimestamps() - ); - }, - "Module.needRebuild is deprecated in favor of Module.needBuild", - "DEP_WEBPACK_MODULE_NEED_REBUILD" -); +/***/ 79065: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** @typedef {(requestShortener: RequestShortener) => string} OptimizationBailoutFunction */ +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -class Module extends DependenciesBlock { - /** - * @param {string} type the module type - * @param {string=} context an optional context - * @param {string=} layer an optional layer in which the module is - */ - constructor(type, context = null, layer = null) { - super(); - /** @type {string} */ - this.type = type; - /** @type {string | null} */ - this.context = context; - /** @type {string | null} */ - this.layer = layer; - /** @type {boolean} */ - this.needId = true; - // Unique Id - /** @type {number} */ - this.debugId = debugId++; +const RuntimeGlobals = __webpack_require__(16475); +const WebpackError = __webpack_require__(53799); +const ConstDependency = __webpack_require__(76911); +const BasicEvaluatedExpression = __webpack_require__(950); +const { + evaluateToString, + toConstantDependency +} = __webpack_require__(93998); +const createHash = __webpack_require__(49835); - // Info from Factory - /** @type {ResolveOptions} */ - this.resolveOptions = EMPTY_RESOLVE_OPTIONS; - /** @type {object | undefined} */ - this.factoryMeta = undefined; - // TODO refactor this -> options object filled from Factory - // TODO webpack 6: use an enum - /** @type {boolean} */ - this.useSourceMap = false; - /** @type {boolean} */ - this.useSimpleSourceMap = false; +/** @typedef {import("estree").Expression} Expression */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./NormalModule")} NormalModule */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ - // Info from Build - /** @type {WebpackError[] | undefined} */ - this._warnings = undefined; - /** @type {WebpackError[] | undefined} */ - this._errors = undefined; - /** @type {BuildMeta} */ - this.buildMeta = undefined; - /** @type {Record} */ - this.buildInfo = undefined; - /** @type {Dependency[] | undefined} */ - this.presentationalDependencies = undefined; - /** @type {Dependency[] | undefined} */ - this.codeGenerationDependencies = undefined; - } +/** @typedef {null|undefined|RegExp|Function|string|number|boolean|bigint|undefined} CodeValuePrimitive */ +/** @typedef {RecursiveArrayOrRecord} CodeValue */ - // TODO remove in webpack 6 - // BACKWARD-COMPAT START - get id() { - return ChunkGraph.getChunkGraphForModule( - this, - "Module.id", - "DEP_WEBPACK_MODULE_ID" - ).getModuleId(this); - } +/** + * @typedef {Object} RuntimeValueOptions + * @property {string[]=} fileDependencies + * @property {string[]=} contextDependencies + * @property {string[]=} missingDependencies + * @property {string[]=} buildDependencies + * @property {string|function(): string=} version + */ - set id(value) { - if (value === "") { - this.needId = false; - return; +class RuntimeValue { + /** + * @param {function({ module: NormalModule, key: string, readonly version: string | undefined }): CodeValuePrimitive} fn generator function + * @param {true | string[] | RuntimeValueOptions=} options options + */ + constructor(fn, options) { + this.fn = fn; + if (Array.isArray(options)) { + options = { + fileDependencies: options + }; } - ChunkGraph.getChunkGraphForModule( - this, - "Module.id", - "DEP_WEBPACK_MODULE_ID" - ).setModuleId(this, value); + this.options = options || {}; } - /** - * @returns {string} the hash of the module - */ - get hash() { - return ChunkGraph.getChunkGraphForModule( - this, - "Module.hash", - "DEP_WEBPACK_MODULE_HASH" - ).getModuleHash(this, undefined); + get fileDependencies() { + return this.options === true ? true : this.options.fileDependencies; } /** - * @returns {string} the shortened hash of the module + * @param {JavascriptParser} parser the parser + * @param {Map>} valueCacheVersions valueCacheVersions + * @param {string} key the defined key + * @returns {CodeValuePrimitive} code */ - get renderedHash() { - return ChunkGraph.getChunkGraphForModule( - this, - "Module.renderedHash", - "DEP_WEBPACK_MODULE_RENDERED_HASH" - ).getRenderedModuleHash(this, undefined); - } - - get profile() { - return ModuleGraph.getModuleGraphForModule( - this, - "Module.profile", - "DEP_WEBPACK_MODULE_PROFILE" - ).getProfile(this); - } + exec(parser, valueCacheVersions, key) { + const buildInfo = parser.state.module.buildInfo; + if (this.options === true) { + buildInfo.cacheable = false; + } else { + if (this.options.fileDependencies) { + for (const dep of this.options.fileDependencies) { + buildInfo.fileDependencies.add(dep); + } + } + if (this.options.contextDependencies) { + for (const dep of this.options.contextDependencies) { + buildInfo.contextDependencies.add(dep); + } + } + if (this.options.missingDependencies) { + for (const dep of this.options.missingDependencies) { + buildInfo.missingDependencies.add(dep); + } + } + if (this.options.buildDependencies) { + for (const dep of this.options.buildDependencies) { + buildInfo.buildDependencies.add(dep); + } + } + } - set profile(value) { - ModuleGraph.getModuleGraphForModule( - this, - "Module.profile", - "DEP_WEBPACK_MODULE_PROFILE" - ).setProfile(this, value); + return this.fn({ + module: parser.state.module, + key, + get version() { + return /** @type {string} */ ( + valueCacheVersions.get(VALUE_DEP_PREFIX + key) + ); + } + }); } - get index() { - return ModuleGraph.getModuleGraphForModule( - this, - "Module.index", - "DEP_WEBPACK_MODULE_INDEX" - ).getPreOrderIndex(this); + getCacheVersion() { + return this.options === true + ? undefined + : (typeof this.options.version === "function" + ? this.options.version() + : this.options.version) || "unset"; } +} - set index(value) { - ModuleGraph.getModuleGraphForModule( - this, - "Module.index", - "DEP_WEBPACK_MODULE_INDEX" - ).setPreOrderIndex(this, value); +/** + * @param {any[]|{[k: string]: any}} obj obj + * @param {JavascriptParser} parser Parser + * @param {Map>} valueCacheVersions valueCacheVersions + * @param {string} key the defined key + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @param {boolean|undefined|null=} asiSafe asi safe (undefined: unknown, null: unneeded) + * @returns {string} code converted to string that evaluates + */ +const stringifyObj = ( + obj, + parser, + valueCacheVersions, + key, + runtimeTemplate, + asiSafe +) => { + let code; + let arr = Array.isArray(obj); + if (arr) { + code = `[${obj + .map(code => + toCode(code, parser, valueCacheVersions, key, runtimeTemplate, null) + ) + .join(",")}]`; + } else { + code = `{${Object.keys(obj) + .map(key => { + const code = obj[key]; + return ( + JSON.stringify(key) + + ":" + + toCode(code, parser, valueCacheVersions, key, runtimeTemplate, null) + ); + }) + .join(",")}}`; } - get index2() { - return ModuleGraph.getModuleGraphForModule( - this, - "Module.index2", - "DEP_WEBPACK_MODULE_INDEX2" - ).getPostOrderIndex(this); + switch (asiSafe) { + case null: + return code; + case true: + return arr ? code : `(${code})`; + case false: + return arr ? `;${code}` : `;(${code})`; + default: + return `/*#__PURE__*/Object(${code})`; } +}; - set index2(value) { - ModuleGraph.getModuleGraphForModule( - this, - "Module.index2", - "DEP_WEBPACK_MODULE_INDEX2" - ).setPostOrderIndex(this, value); +/** + * Convert code to a string that evaluates + * @param {CodeValue} code Code to evaluate + * @param {JavascriptParser} parser Parser + * @param {Map>} valueCacheVersions valueCacheVersions + * @param {string} key the defined key + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @param {boolean|undefined|null=} asiSafe asi safe (undefined: unknown, null: unneeded) + * @returns {string} code converted to string that evaluates + */ +const toCode = ( + code, + parser, + valueCacheVersions, + key, + runtimeTemplate, + asiSafe +) => { + if (code === null) { + return "null"; } - - get depth() { - return ModuleGraph.getModuleGraphForModule( - this, - "Module.depth", - "DEP_WEBPACK_MODULE_DEPTH" - ).getDepth(this); - } - - set depth(value) { - ModuleGraph.getModuleGraphForModule( - this, - "Module.depth", - "DEP_WEBPACK_MODULE_DEPTH" - ).setDepth(this, value); - } - - get issuer() { - return ModuleGraph.getModuleGraphForModule( - this, - "Module.issuer", - "DEP_WEBPACK_MODULE_ISSUER" - ).getIssuer(this); - } - - set issuer(value) { - ModuleGraph.getModuleGraphForModule( - this, - "Module.issuer", - "DEP_WEBPACK_MODULE_ISSUER" - ).setIssuer(this, value); - } - - get usedExports() { - return ModuleGraph.getModuleGraphForModule( - this, - "Module.usedExports", - "DEP_WEBPACK_MODULE_USED_EXPORTS" - ).getUsedExports(this, undefined); - } - - /** - * @deprecated - * @returns {(string | OptimizationBailoutFunction)[]} list - */ - get optimizationBailout() { - return ModuleGraph.getModuleGraphForModule( - this, - "Module.optimizationBailout", - "DEP_WEBPACK_MODULE_OPTIMIZATION_BAILOUT" - ).getOptimizationBailout(this); + if (code === undefined) { + return "undefined"; } - - get optional() { - return this.isOptional( - ModuleGraph.getModuleGraphForModule( - this, - "Module.optional", - "DEP_WEBPACK_MODULE_OPTIONAL" - ) - ); + if (Object.is(code, -0)) { + return "-0"; } - - addChunk(chunk) { - const chunkGraph = ChunkGraph.getChunkGraphForModule( - this, - "Module.addChunk", - "DEP_WEBPACK_MODULE_ADD_CHUNK" + if (code instanceof RuntimeValue) { + return toCode( + code.exec(parser, valueCacheVersions, key), + parser, + valueCacheVersions, + key, + runtimeTemplate, + asiSafe ); - if (chunkGraph.isModuleInChunk(this, chunk)) return false; - chunkGraph.connectChunkAndModule(chunk, this); - return true; - } - - removeChunk(chunk) { - return ChunkGraph.getChunkGraphForModule( - this, - "Module.removeChunk", - "DEP_WEBPACK_MODULE_REMOVE_CHUNK" - ).disconnectChunkAndModule(chunk, this); } - - isInChunk(chunk) { - return ChunkGraph.getChunkGraphForModule( - this, - "Module.isInChunk", - "DEP_WEBPACK_MODULE_IS_IN_CHUNK" - ).isModuleInChunk(this, chunk); + if (code instanceof RegExp && code.toString) { + return code.toString(); } - - isEntryModule() { - return ChunkGraph.getChunkGraphForModule( - this, - "Module.isEntryModule", - "DEP_WEBPACK_MODULE_IS_ENTRY_MODULE" - ).isEntryModule(this); + if (typeof code === "function" && code.toString) { + return "(" + code.toString() + ")"; } - - getChunks() { - return ChunkGraph.getChunkGraphForModule( - this, - "Module.getChunks", - "DEP_WEBPACK_MODULE_GET_CHUNKS" - ).getModuleChunks(this); + if (typeof code === "object") { + return stringifyObj( + code, + parser, + valueCacheVersions, + key, + runtimeTemplate, + asiSafe + ); } - - getNumberOfChunks() { - return ChunkGraph.getChunkGraphForModule( - this, - "Module.getNumberOfChunks", - "DEP_WEBPACK_MODULE_GET_NUMBER_OF_CHUNKS" - ).getNumberOfModuleChunks(this); + if (typeof code === "bigint") { + return runtimeTemplate.supportsBigIntLiteral() + ? `${code}n` + : `BigInt("${code}")`; } + return code + ""; +}; - get chunksIterable() { - return ChunkGraph.getChunkGraphForModule( - this, - "Module.chunksIterable", - "DEP_WEBPACK_MODULE_CHUNKS_ITERABLE" - ).getOrderedModuleChunksIterable(this, compareChunksById); +const toCacheVersion = code => { + if (code === null) { + return "null"; } - - /** - * @param {string} exportName a name of an export - * @returns {boolean | null} true, if the export is provided why the module. - * null, if it's unknown. - * false, if it's not provided. - */ - isProvided(exportName) { - return ModuleGraph.getModuleGraphForModule( - this, - "Module.usedExports", - "DEP_WEBPACK_MODULE_USED_EXPORTS" - ).isExportProvided(this, exportName); + if (code === undefined) { + return "undefined"; } - // BACKWARD-COMPAT END - - /** - * @returns {string} name of the exports argument - */ - get exportsArgument() { - return (this.buildInfo && this.buildInfo.exportsArgument) || "exports"; + if (Object.is(code, -0)) { + return "-0"; } - - /** - * @returns {string} name of the module argument - */ - get moduleArgument() { - return (this.buildInfo && this.buildInfo.moduleArgument) || "module"; + if (code instanceof RuntimeValue) { + return code.getCacheVersion(); } - - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {boolean} strict the importing module is strict - * @returns {"namespace" | "default-only" | "default-with-named" | "dynamic"} export type - * "namespace": Exports is already a namespace object. namespace = exports. - * "dynamic": Check at runtime if __esModule is set. When set: namespace = { ...exports, default: exports }. When not set: namespace = { default: exports }. - * "default-only": Provide a namespace object with only default export. namespace = { default: exports } - * "default-with-named": Provide a namespace object with named and default export. namespace = { ...exports, default: exports } - */ - getExportsType(moduleGraph, strict) { - switch (this.buildMeta && this.buildMeta.exportsType) { - case "flagged": - return strict ? "default-with-named" : "namespace"; - case "namespace": - return "namespace"; - case "default": - switch (this.buildMeta.defaultObject) { - case "redirect": - return "default-with-named"; - case "redirect-warn": - return strict ? "default-only" : "default-with-named"; - default: - return "default-only"; - } - case "dynamic": { - if (strict) return "default-with-named"; - // Try to figure out value of __esModule by following reexports - const handleDefault = () => { - switch (this.buildMeta.defaultObject) { - case "redirect": - case "redirect-warn": - return "default-with-named"; - default: - return "default-only"; - } - }; - const exportInfo = moduleGraph.getReadOnlyExportInfo( - this, - "__esModule" - ); - if (exportInfo.provided === false) { - return handleDefault(); - } - const target = exportInfo.getTarget(moduleGraph); - if ( - !target || - !target.export || - target.export.length !== 1 || - target.export[0] !== "__esModule" - ) { - return "dynamic"; - } - switch ( - target.module.buildMeta && - target.module.buildMeta.exportsType - ) { - case "flagged": - case "namespace": - return "namespace"; - case "default": - return handleDefault(); - default: - return "dynamic"; - } - } - default: - return strict ? "default-with-named" : "dynamic"; - } + if (code instanceof RegExp && code.toString) { + return code.toString(); } - - /** - * @param {Dependency} presentationalDependency dependency being tied to module. - * This is a Dependency without edge in the module graph. It's only for presentation. - * @returns {void} - */ - addPresentationalDependency(presentationalDependency) { - if (this.presentationalDependencies === undefined) { - this.presentationalDependencies = []; - } - this.presentationalDependencies.push(presentationalDependency); + if (typeof code === "function" && code.toString) { + return "(" + code.toString() + ")"; } - - /** - * @param {Dependency} codeGenerationDependency dependency being tied to module. - * This is a Dependency where the code generation result of the referenced module is needed during code generation. - * The Dependency should also be added to normal dependencies via addDependency. - * @returns {void} - */ - addCodeGenerationDependency(codeGenerationDependency) { - if (this.codeGenerationDependencies === undefined) { - this.codeGenerationDependencies = []; - } - this.codeGenerationDependencies.push(codeGenerationDependency); + if (typeof code === "object") { + const items = Object.keys(code).map(key => ({ + key, + value: toCacheVersion(code[key]) + })); + if (items.some(({ value }) => value === undefined)) return undefined; + return `{${items.map(({ key, value }) => `${key}: ${value}`).join(", ")}}`; } - - /** - * Removes all dependencies and blocks - * @returns {void} - */ - clearDependenciesAndBlocks() { - if (this.presentationalDependencies !== undefined) { - this.presentationalDependencies.length = 0; - } - if (this.codeGenerationDependencies !== undefined) { - this.codeGenerationDependencies.length = 0; - } - super.clearDependenciesAndBlocks(); + if (typeof code === "bigint") { + return `${code}n`; } + return code + ""; +}; - /** - * @param {WebpackError} warning the warning - * @returns {void} - */ - addWarning(warning) { - if (this._warnings === undefined) { - this._warnings = []; - } - this._warnings.push(warning); - } +const VALUE_DEP_PREFIX = "webpack/DefinePlugin "; +const VALUE_DEP_MAIN = "webpack/DefinePlugin_hash"; +class DefinePlugin { /** - * @returns {Iterable | undefined} list of warnings if any + * Create a new define plugin + * @param {Record} definitions A map of global object definitions */ - getWarnings() { - return this._warnings; + constructor(definitions) { + this.definitions = definitions; } /** - * @returns {number} number of warnings + * @param {function({ module: NormalModule, key: string, readonly version: string | undefined }): CodeValuePrimitive} fn generator function + * @param {true | string[] | RuntimeValueOptions=} options options + * @returns {RuntimeValue} runtime value */ - getNumberOfWarnings() { - return this._warnings !== undefined ? this._warnings.length : 0; + static runtimeValue(fn, options) { + return new RuntimeValue(fn, options); } /** - * @param {WebpackError} error the error + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - addError(error) { - if (this._errors === undefined) { - this._errors = []; - } - this._errors.push(error); - } - - /** - * @returns {Iterable | undefined} list of errors if any - */ - getErrors() { - return this._errors; - } + apply(compiler) { + const definitions = this.definitions; + compiler.hooks.compilation.tap( + "DefinePlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyTemplates.set( + ConstDependency, + new ConstDependency.Template() + ); + const { runtimeTemplate } = compilation; - /** - * @returns {number} number of errors - */ - getNumberOfErrors() { - return this._errors !== undefined ? this._errors.length : 0; - } + const mainHash = createHash(compilation.outputOptions.hashFunction); + mainHash.update( + /** @type {string} */ ( + compilation.valueCacheVersions.get(VALUE_DEP_MAIN) + ) || "" + ); - /** - * removes all warnings and errors - * @returns {void} - */ - clearWarningsAndErrors() { - if (this._warnings !== undefined) { - this._warnings.length = 0; - } - if (this._errors !== undefined) { - this._errors.length = 0; - } - } + /** + * Handler + * @param {JavascriptParser} parser Parser + * @returns {void} + */ + const handler = parser => { + const mainValue = compilation.valueCacheVersions.get(VALUE_DEP_MAIN); + parser.hooks.program.tap("DefinePlugin", () => { + const { buildInfo } = parser.state.module; + if (!buildInfo.valueDependencies) + buildInfo.valueDependencies = new Map(); + buildInfo.valueDependencies.set(VALUE_DEP_MAIN, mainValue); + }); - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {boolean} true, if the module is optional - */ - isOptional(moduleGraph) { - let hasConnections = false; - for (const r of moduleGraph.getIncomingConnections(this)) { - if ( - !r.dependency || - !r.dependency.optional || - !r.isTargetActive(undefined) - ) { - return false; - } - hasConnections = true; - } - return hasConnections; - } + const addValueDependency = key => { + const { buildInfo } = parser.state.module; + buildInfo.valueDependencies.set( + VALUE_DEP_PREFIX + key, + compilation.valueCacheVersions.get(VALUE_DEP_PREFIX + key) + ); + }; - /** - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {Chunk} chunk a chunk - * @param {Chunk=} ignoreChunk chunk to be ignored - * @returns {boolean} true, if the module is accessible from "chunk" when ignoring "ignoreChunk" - */ - isAccessibleInChunk(chunkGraph, chunk, ignoreChunk) { - // Check if module is accessible in ALL chunk groups - for (const chunkGroup of chunk.groupsIterable) { - if (!this.isAccessibleInChunkGroup(chunkGraph, chunkGroup)) return false; - } - return true; - } + const withValueDependency = + (key, fn) => + (...args) => { + addValueDependency(key); + return fn(...args); + }; - /** - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {ChunkGroup} chunkGroup a chunk group - * @param {Chunk=} ignoreChunk chunk to be ignored - * @returns {boolean} true, if the module is accessible from "chunkGroup" when ignoring "ignoreChunk" - */ - isAccessibleInChunkGroup(chunkGraph, chunkGroup, ignoreChunk) { - const queue = new Set([chunkGroup]); + /** + * Walk definitions + * @param {Object} definitions Definitions map + * @param {string} prefix Prefix string + * @returns {void} + */ + const walkDefinitions = (definitions, prefix) => { + Object.keys(definitions).forEach(key => { + const code = definitions[key]; + if ( + code && + typeof code === "object" && + !(code instanceof RuntimeValue) && + !(code instanceof RegExp) + ) { + walkDefinitions(code, prefix + key + "."); + applyObjectDefine(prefix + key, code); + return; + } + applyDefineKey(prefix, key); + applyDefine(prefix + key, code); + }); + }; - // Check if module is accessible from all items of the queue - queueFor: for (const cg of queue) { - // 1. If module is in one of the chunks of the group we can continue checking the next items - // because it's accessible. - for (const chunk of cg.chunks) { - if (chunk !== ignoreChunk && chunkGraph.isModuleInChunk(this, chunk)) - continue queueFor; - } - // 2. If the chunk group is initial, we can break here because it's not accessible. - if (chunkGroup.isInitial()) return false; - // 3. Enqueue all parents because it must be accessible from ALL parents - for (const parent of chunkGroup.parentsIterable) queue.add(parent); - } - // When we processed through the whole list and we didn't bailout, the module is accessible - return true; - } + /** + * Apply define key + * @param {string} prefix Prefix + * @param {string} key Key + * @returns {void} + */ + const applyDefineKey = (prefix, key) => { + const splittedKey = key.split("."); + splittedKey.slice(1).forEach((_, i) => { + const fullKey = prefix + splittedKey.slice(0, i + 1).join("."); + parser.hooks.canRename.for(fullKey).tap("DefinePlugin", () => { + addValueDependency(key); + return true; + }); + }); + }; - /** - * @param {Chunk} chunk a chunk - * @param {ModuleGraph} moduleGraph the module graph - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {boolean} true, if the module has any reason why "chunk" should be included - */ - hasReasonForChunk(chunk, moduleGraph, chunkGraph) { - // check for each reason if we need the chunk - for (const [ - fromModule, - connections - ] of moduleGraph.getIncomingConnectionsByOriginModule(this)) { - if (!connections.some(c => c.isTargetActive(chunk.runtime))) continue; - for (const originChunk of chunkGraph.getModuleChunksIterable( - fromModule - )) { - // return true if module this is not reachable from originChunk when ignoring chunk - if (!this.isAccessibleInChunk(chunkGraph, originChunk, chunk)) - return true; - } - } - return false; - } + /** + * Apply Code + * @param {string} key Key + * @param {CodeValue} code Code + * @returns {void} + */ + const applyDefine = (key, code) => { + const originalKey = key; + const isTypeof = /^typeof\s+/.test(key); + if (isTypeof) key = key.replace(/^typeof\s+/, ""); + let recurse = false; + let recurseTypeof = false; + if (!isTypeof) { + parser.hooks.canRename.for(key).tap("DefinePlugin", () => { + addValueDependency(originalKey); + return true; + }); + parser.hooks.evaluateIdentifier + .for(key) + .tap("DefinePlugin", expr => { + /** + * this is needed in case there is a recursion in the DefinePlugin + * to prevent an endless recursion + * e.g.: new DefinePlugin({ + * "a": "b", + * "b": "a" + * }); + */ + if (recurse) return; + addValueDependency(originalKey); + recurse = true; + const res = parser.evaluate( + toCode( + code, + parser, + compilation.valueCacheVersions, + key, + runtimeTemplate, + null + ) + ); + recurse = false; + res.setRange(expr.range); + return res; + }); + parser.hooks.expression.for(key).tap("DefinePlugin", expr => { + addValueDependency(originalKey); + const strCode = toCode( + code, + parser, + compilation.valueCacheVersions, + originalKey, + runtimeTemplate, + !parser.isAsiPosition(expr.range[0]) + ); + if (/__webpack_require__\s*(!?\.)/.test(strCode)) { + return toConstantDependency(parser, strCode, [ + RuntimeGlobals.require + ])(expr); + } else if (/__webpack_require__/.test(strCode)) { + return toConstantDependency(parser, strCode, [ + RuntimeGlobals.requireScope + ])(expr); + } else { + return toConstantDependency(parser, strCode)(expr); + } + }); + } + parser.hooks.evaluateTypeof.for(key).tap("DefinePlugin", expr => { + /** + * this is needed in case there is a recursion in the DefinePlugin + * to prevent an endless recursion + * e.g.: new DefinePlugin({ + * "typeof a": "typeof b", + * "typeof b": "typeof a" + * }); + */ + if (recurseTypeof) return; + recurseTypeof = true; + addValueDependency(originalKey); + const codeCode = toCode( + code, + parser, + compilation.valueCacheVersions, + originalKey, + runtimeTemplate, + null + ); + const typeofCode = isTypeof + ? codeCode + : "typeof (" + codeCode + ")"; + const res = parser.evaluate(typeofCode); + recurseTypeof = false; + res.setRange(expr.range); + return res; + }); + parser.hooks.typeof.for(key).tap("DefinePlugin", expr => { + addValueDependency(originalKey); + const codeCode = toCode( + code, + parser, + compilation.valueCacheVersions, + originalKey, + runtimeTemplate, + null + ); + const typeofCode = isTypeof + ? codeCode + : "typeof (" + codeCode + ")"; + const res = parser.evaluate(typeofCode); + if (!res.isString()) return; + return toConstantDependency( + parser, + JSON.stringify(res.string) + ).bind(parser)(expr); + }); + }; - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true if at least one other module depends on this module - */ - hasReasons(moduleGraph, runtime) { - for (const c of moduleGraph.getIncomingConnections(this)) { - if (c.isTargetActive(runtime)) return true; - } - return false; - } + /** + * Apply Object + * @param {string} key Key + * @param {Object} obj Object + * @returns {void} + */ + const applyObjectDefine = (key, obj) => { + parser.hooks.canRename.for(key).tap("DefinePlugin", () => { + addValueDependency(key); + return true; + }); + parser.hooks.evaluateIdentifier + .for(key) + .tap("DefinePlugin", expr => { + addValueDependency(key); + return new BasicEvaluatedExpression() + .setTruthy() + .setSideEffects(false) + .setRange(expr.range); + }); + parser.hooks.evaluateTypeof + .for(key) + .tap( + "DefinePlugin", + withValueDependency(key, evaluateToString("object")) + ); + parser.hooks.expression.for(key).tap("DefinePlugin", expr => { + addValueDependency(key); + const strCode = stringifyObj( + obj, + parser, + compilation.valueCacheVersions, + key, + runtimeTemplate, + !parser.isAsiPosition(expr.range[0]) + ); - /** - * @returns {string} for debugging - */ - toString() { - return `Module[${this.debugId}: ${this.identifier()}]`; - } + if (/__webpack_require__\s*(!?\.)/.test(strCode)) { + return toConstantDependency(parser, strCode, [ + RuntimeGlobals.require + ])(expr); + } else if (/__webpack_require__/.test(strCode)) { + return toConstantDependency(parser, strCode, [ + RuntimeGlobals.requireScope + ])(expr); + } else { + return toConstantDependency(parser, strCode)(expr); + } + }); + parser.hooks.typeof + .for(key) + .tap( + "DefinePlugin", + withValueDependency( + key, + toConstantDependency(parser, JSON.stringify("object")) + ) + ); + }; - /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} - */ - needBuild(context, callback) { - callback( - null, - !this.buildMeta || - this.needRebuild === Module.prototype.needRebuild || - deprecatedNeedRebuild(this, context) + walkDefinitions(definitions, ""); + }; + + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("DefinePlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("DefinePlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("DefinePlugin", handler); + + /** + * Walk definitions + * @param {Object} definitions Definitions map + * @param {string} prefix Prefix string + * @returns {void} + */ + const walkDefinitionsForValues = (definitions, prefix) => { + Object.keys(definitions).forEach(key => { + const code = definitions[key]; + const version = toCacheVersion(code); + const name = VALUE_DEP_PREFIX + prefix + key; + mainHash.update("|" + prefix + key); + const oldVersion = compilation.valueCacheVersions.get(name); + if (oldVersion === undefined) { + compilation.valueCacheVersions.set(name, version); + } else if (oldVersion !== version) { + const warning = new WebpackError( + `DefinePlugin\nConflicting values for '${prefix + key}'` + ); + warning.details = `'${oldVersion}' !== '${version}'`; + warning.hideStack = true; + compilation.warnings.push(warning); + } + if ( + code && + typeof code === "object" && + !(code instanceof RuntimeValue) && + !(code instanceof RegExp) + ) { + walkDefinitionsForValues(code, prefix + key + "."); + } + }); + }; + + walkDefinitionsForValues(definitions, ""); + + compilation.valueCacheVersions.set( + VALUE_DEP_MAIN, + /** @type {string} */ (mainHash.digest("hex").slice(0, 8)) + ); + } ); } +} +module.exports = DefinePlugin; - /** - * @deprecated Use needBuild instead - * @param {Map} fileTimestamps timestamps of files - * @param {Map} contextTimestamps timestamps of directories - * @returns {boolean} true, if the module needs a rebuild - */ - needRebuild(fileTimestamps, contextTimestamps) { - return true; + +/***/ }), + +/***/ 28623: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { OriginalSource, RawSource } = __webpack_require__(51255); +const Module = __webpack_require__(73208); +const RuntimeGlobals = __webpack_require__(16475); +const DelegatedSourceDependency = __webpack_require__(22914); +const StaticExportsDependency = __webpack_require__(91418); +const makeSerializable = __webpack_require__(33032); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./LibManifestPlugin").ManifestModuleData} ManifestModuleData */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("./Module").SourceContext} SourceContext */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./dependencies/ModuleDependency")} ModuleDependency */ +/** @typedef {import("./util/Hash")} Hash */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ + +const TYPES = new Set(["javascript"]); +const RUNTIME_REQUIREMENTS = new Set([ + RuntimeGlobals.module, + RuntimeGlobals.require +]); + +class DelegatedModule extends Module { + constructor(sourceRequest, data, type, userRequest, originalRequest) { + super("javascript/dynamic", null); + + // Info from Factory + this.sourceRequest = sourceRequest; + this.request = data.id; + this.delegationType = type; + this.userRequest = userRequest; + this.originalRequest = originalRequest; + /** @type {ManifestModuleData} */ + this.delegateData = data; + + // Build info + this.delegatedSourceDependency = undefined; } /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} + * @returns {Set} types available (do not mutate) */ - updateHash( - hash, - context = { - chunkGraph: ChunkGraph.getChunkGraphForModule( - this, - "Module.updateHash", - "DEP_WEBPACK_MODULE_UPDATE_HASH" - ), - runtime: undefined - } - ) { - const { chunkGraph, runtime } = context; - hash.update(chunkGraph.getModuleGraphHash(this, runtime)); - if (this.presentationalDependencies !== undefined) { - for (const dep of this.presentationalDependencies) { - dep.updateHash(hash, context); - } - } - super.updateHash(hash, context); + getSourceTypes() { + return TYPES; } /** - * @returns {void} + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion */ - invalidateBuild() { - // should be overridden to support this feature + libIdent(options) { + return typeof this.originalRequest === "string" + ? this.originalRequest + : this.originalRequest.libIdent(options); } - /* istanbul ignore next */ /** - * @abstract * @returns {string} a unique identifier of the module */ identifier() { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + return `delegated ${JSON.stringify(this.request)} from ${ + this.sourceRequest + }`; } - /* istanbul ignore next */ /** - * @abstract * @param {RequestShortener} requestShortener the request shortener * @returns {string} a user readable identifier of the module */ readableIdentifier(requestShortener) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + return `delegated ${this.userRequest} from ${this.sourceRequest}`; + } + + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + return callback(null, !this.buildMeta); } - /* istanbul ignore next */ /** - * @abstract * @param {WebpackOptions} options webpack options * @param {Compilation} compilation the compilation * @param {ResolverWithOptions} resolver the resolver @@ -44428,136 +39257,106 @@ class Module extends DependenciesBlock { * @returns {void} */ build(options, compilation, resolver, fs, callback) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + this.buildMeta = { ...this.delegateData.buildMeta }; + this.buildInfo = {}; + this.dependencies.length = 0; + this.delegatedSourceDependency = new DelegatedSourceDependency( + this.sourceRequest + ); + this.addDependency(this.delegatedSourceDependency); + this.addDependency( + new StaticExportsDependency(this.delegateData.exports || true, false) + ); + callback(); } /** - * @abstract - * @returns {Set} types available (do not mutate) + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result */ - getSourceTypes() { - // Better override this method to return the correct types - if (this.source === Module.prototype.source) { - return DEFAULT_TYPES_UNKNOWN; + codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { + const dep = /** @type {DelegatedSourceDependency} */ (this.dependencies[0]); + const sourceModule = moduleGraph.getModule(dep); + let str; + + if (!sourceModule) { + str = runtimeTemplate.throwMissingModuleErrorBlock({ + request: this.sourceRequest + }); } else { - return DEFAULT_TYPES_JS; + str = `module.exports = (${runtimeTemplate.moduleExports({ + module: sourceModule, + chunkGraph, + request: dep.request, + runtimeRequirements: new Set() + })})`; + + switch (this.delegationType) { + case "require": + str += `(${JSON.stringify(this.request)})`; + break; + case "object": + str += `[${JSON.stringify(this.request)}]`; + break; + } + + str += ";"; } - } - /** - * @abstract - * @deprecated Use codeGeneration() instead - * @param {DependencyTemplates} dependencyTemplates the dependency templates - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @param {string=} type the type of source that should be generated - * @returns {Source} generated source - */ - source(dependencyTemplates, runtimeTemplate, type = "javascript") { - if (this.codeGeneration === Module.prototype.codeGeneration) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + const sources = new Map(); + if (this.useSourceMap || this.useSimpleSourceMap) { + sources.set("javascript", new OriginalSource(str, this.identifier())); + } else { + sources.set("javascript", new RawSource(str)); } - const chunkGraph = ChunkGraph.getChunkGraphForModule( - this, - "Module.source() is deprecated. Use Compilation.codeGenerationResults.getSource(module, runtime, type) instead", - "DEP_WEBPACK_MODULE_SOURCE" - ); - /** @type {CodeGenerationContext} */ - const codeGenContext = { - dependencyTemplates, - runtimeTemplate, - moduleGraph: chunkGraph.moduleGraph, - chunkGraph, - runtime: undefined, - codeGenerationResults: undefined + + return { + sources, + runtimeRequirements: RUNTIME_REQUIREMENTS }; - const sources = this.codeGeneration(codeGenContext).sources; - return type ? sources.get(type) : sources.get(first(this.getSourceTypes())); } - /* istanbul ignore next */ /** - * @abstract * @param {string=} type the source type for which the size should be estimated * @returns {number} the estimated size of the module (must be non-zero) */ size(type) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + return 42; } /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} */ - libIdent(options) { - return null; + updateHash(hash, context) { + hash.update(this.delegationType); + hash.update(JSON.stringify(this.request)); + super.updateHash(hash, context); } - /** - * @returns {string | null} absolute path which should be used for condition matching (usually the resource path) - */ - nameForCondition() { - return null; + serialize(context) { + const { write } = context; + // constructor + write(this.sourceRequest); + write(this.delegateData); + write(this.delegationType); + write(this.userRequest); + write(this.originalRequest); + super.serialize(context); } - /** - * @param {ConcatenationBailoutReasonContext} context context - * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated - */ - getConcatenationBailoutReason(context) { - return `Module Concatenation is not implemented for ${this.constructor.name}`; - } - - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this module should be connected to referencing modules when consumed for side-effects only - */ - getSideEffectsConnectionState(moduleGraph) { - return true; - } - - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration(context) { - // Best override this method - const sources = new Map(); - for (const type of this.getSourceTypes()) { - if (type !== "unknown") { - sources.set( - type, - this.source( - context.dependencyTemplates, - context.runtimeTemplate, - type - ) - ); - } - } - return { - sources, - runtimeRequirements: new Set([ - RuntimeGlobals.module, - RuntimeGlobals.exports, - RuntimeGlobals.require - ]) - }; - } - - /** - * @param {Chunk} chunk the chunk which condition should be checked - * @param {Compilation} compilation the compilation - * @returns {boolean} true, if the chunk is ok for the module - */ - chunkCondition(chunk, compilation) { - return true; - } - - hasChunkCondition() { - return this.chunkCondition !== Module.prototype.chunkCondition; + static deserialize(context) { + const { read } = context; + const obj = new DelegatedModule( + read(), // sourceRequest + read(), // delegateData + read(), // delegationType + read(), // userRequest + read() // originalRequest + ); + obj.deserialize(context); + return obj; } /** @@ -44568,184 +39367,31 @@ class Module extends DependenciesBlock { * @returns {void} */ updateCacheModule(module) { - this.type = module.type; - this.layer = module.layer; - this.context = module.context; - this.factoryMeta = module.factoryMeta; - this.resolveOptions = module.resolveOptions; - } - - /** - * Module should be unsafe cached. Get data that's needed for that. - * This data will be passed to restoreFromUnsafeCache later. - * @returns {object} cached data - */ - getUnsafeCacheData() { - return { - factoryMeta: this.factoryMeta, - resolveOptions: this.resolveOptions - }; - } - - /** - * restore unsafe cache data - * @param {object} unsafeCacheData data from getUnsafeCacheData - * @param {NormalModuleFactory} normalModuleFactory the normal module factory handling the unsafe caching - */ - _restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory) { - this.factoryMeta = unsafeCacheData.factoryMeta; - this.resolveOptions = unsafeCacheData.resolveOptions; + super.updateCacheModule(module); + const m = /** @type {DelegatedModule} */ (module); + this.delegationType = m.delegationType; + this.userRequest = m.userRequest; + this.originalRequest = m.originalRequest; + this.delegateData = m.delegateData; } /** * Assuming this module is in the cache. Remove internal references to allow freeing some memory. */ cleanupForCache() { - this.factoryMeta = undefined; - this.resolveOptions = undefined; - } - - /** - * @returns {Source | null} the original source for the module before webpack transformation - */ - originalSource() { - return null; - } - - /** - * @param {LazySet} fileDependencies set where file dependencies are added to - * @param {LazySet} contextDependencies set where context dependencies are added to - * @param {LazySet} missingDependencies set where missing dependencies are added to - * @param {LazySet} buildDependencies set where build dependencies are added to - */ - addCacheDependencies( - fileDependencies, - contextDependencies, - missingDependencies, - buildDependencies - ) {} - - serialize(context) { - const { write } = context; - write(this.type); - write(this.layer); - write(this.context); - write(this.resolveOptions); - write(this.factoryMeta); - write(this.useSourceMap); - write(this.useSimpleSourceMap); - write( - this._warnings !== undefined && this._warnings.length === 0 - ? undefined - : this._warnings - ); - write( - this._errors !== undefined && this._errors.length === 0 - ? undefined - : this._errors - ); - write(this.buildMeta); - write(this.buildInfo); - write(this.presentationalDependencies); - write(this.codeGenerationDependencies); - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - this.type = read(); - this.layer = read(); - this.context = read(); - this.resolveOptions = read(); - this.factoryMeta = read(); - this.useSourceMap = read(); - this.useSimpleSourceMap = read(); - this._warnings = read(); - this._errors = read(); - this.buildMeta = read(); - this.buildInfo = read(); - this.presentationalDependencies = read(); - this.codeGenerationDependencies = read(); - super.deserialize(context); + super.cleanupForCache(); + this.delegateData = undefined; } } -makeSerializable(Module, "webpack/lib/Module"); - -// TODO remove in webpack 6 -Object.defineProperty(Module.prototype, "hasEqualsChunks", { - get() { - throw new Error( - "Module.hasEqualsChunks was renamed (use hasEqualChunks instead)" - ); - } -}); - -// TODO remove in webpack 6 -Object.defineProperty(Module.prototype, "isUsed", { - get() { - throw new Error( - "Module.isUsed was renamed (use getUsedName, isExportUsed or isModuleUsed instead)" - ); - } -}); - -// TODO remove in webpack 6 -Object.defineProperty(Module.prototype, "errors", { - get: util.deprecate( - /** - * @this {Module} - * @returns {WebpackError[]} array - */ - function () { - if (this._errors === undefined) { - this._errors = []; - } - return this._errors; - }, - "Module.errors was removed (use getErrors instead)", - "DEP_WEBPACK_MODULE_ERRORS" - ) -}); - -// TODO remove in webpack 6 -Object.defineProperty(Module.prototype, "warnings", { - get: util.deprecate( - /** - * @this {Module} - * @returns {WebpackError[]} array - */ - function () { - if (this._warnings === undefined) { - this._warnings = []; - } - return this._warnings; - }, - "Module.warnings was removed (use getWarnings instead)", - "DEP_WEBPACK_MODULE_WARNINGS" - ) -}); - -// TODO remove in webpack 6 -Object.defineProperty(Module.prototype, "used", { - get() { - throw new Error( - "Module.used was refactored (use ModuleGraph.getUsedExports instead)" - ); - }, - set(value) { - throw new Error( - "Module.used was refactored (use ModuleGraph.setUsedExports instead)" - ); - } -}); +makeSerializable(DelegatedModule, "webpack/lib/DelegatedModule"); -module.exports = Module; +module.exports = DelegatedModule; /***/ }), -/***/ 21305: +/***/ 51387: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -44756,81 +39402,95 @@ module.exports = Module; -const { cutOffLoaderExecution } = __webpack_require__(59985); -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); - -class ModuleBuildError extends WebpackError { - /** - * @param {string | Error&any} err error thrown - * @param {{from?: string|null}} info additional info - */ - constructor(err, { from = null } = {}) { - let message = "Module build failed"; - let details = undefined; - - if (from) { - message += ` (from ${from}):\n`; - } else { - message += ": "; - } - - if (err !== null && typeof err === "object") { - if (typeof err.stack === "string" && err.stack) { - const stack = cutOffLoaderExecution(err.stack); +const DelegatedModule = __webpack_require__(28623); - if (!err.hideStack) { - message += stack; - } else { - details = stack; +// options.source +// options.type +// options.context +// options.scope +// options.content +// options.associatedObjectForCache +class DelegatedModuleFactoryPlugin { + constructor(options) { + this.options = options; + options.type = options.type || "require"; + options.extensions = options.extensions || ["", ".js", ".json", ".wasm"]; + } - if (typeof err.message === "string" && err.message) { - message += err.message; - } else { - message += err; + apply(normalModuleFactory) { + const scope = this.options.scope; + if (scope) { + normalModuleFactory.hooks.factorize.tapAsync( + "DelegatedModuleFactoryPlugin", + (data, callback) => { + const [dependency] = data.dependencies; + const { request } = dependency; + if (request && request.startsWith(`${scope}/`)) { + const innerRequest = "." + request.substr(scope.length); + let resolved; + if (innerRequest in this.options.content) { + resolved = this.options.content[innerRequest]; + return callback( + null, + new DelegatedModule( + this.options.source, + resolved, + this.options.type, + innerRequest, + request + ) + ); + } + for (let i = 0; i < this.options.extensions.length; i++) { + const extension = this.options.extensions[i]; + const requestPlusExt = innerRequest + extension; + if (requestPlusExt in this.options.content) { + resolved = this.options.content[requestPlusExt]; + return callback( + null, + new DelegatedModule( + this.options.source, + resolved, + this.options.type, + requestPlusExt, + request + extension + ) + ); + } + } } + return callback(); } - } else if (typeof err.message === "string" && err.message) { - message += err.message; - } else { - message += String(err); - } + ); } else { - message += String(err); + normalModuleFactory.hooks.module.tap( + "DelegatedModuleFactoryPlugin", + module => { + const request = module.libIdent(this.options); + if (request) { + if (request in this.options.content) { + const resolved = this.options.content[request]; + return new DelegatedModule( + this.options.source, + resolved, + this.options.type, + request, + module + ); + } + } + return module; + } + ); } - - super(message); - - this.name = "ModuleBuildError"; - this.details = details; - this.error = err; - } - - serialize(context) { - const { write } = context; - - write(this.error); - - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - - this.error = read(); - - super.deserialize(context); } } - -makeSerializable(ModuleBuildError, "webpack/lib/ModuleBuildError"); - -module.exports = ModuleBuildError; +module.exports = DelegatedModuleFactoryPlugin; /***/ }), -/***/ 67409: +/***/ 80632: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -44841,44 +39501,47 @@ module.exports = ModuleBuildError; -const WebpackError = __webpack_require__(53799); +const DelegatedModuleFactoryPlugin = __webpack_require__(51387); +const DelegatedSourceDependency = __webpack_require__(22914); -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("./Module")} Module */ +/** @typedef {import("./Compiler")} Compiler */ + +class DelegatedPlugin { + constructor(options) { + this.options = options; + } -class ModuleDependencyError extends WebpackError { /** - * Creates an instance of ModuleDependencyError. - * @param {Module} module module tied to dependency - * @param {Error} err error thrown - * @param {DependencyLocation} loc location of dependency + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - constructor(module, err, loc) { - super(err.message); - - this.name = "ModuleDependencyError"; - this.details = - err && !(/** @type {any} */ (err).hideStack) - ? err.stack.split("\n").slice(1).join("\n") - : undefined; - this.module = module; - this.loc = loc; - /** error is not (de)serialized, so it might be undefined after deserialization */ - this.error = err; + apply(compiler) { + compiler.hooks.compilation.tap( + "DelegatedPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + DelegatedSourceDependency, + normalModuleFactory + ); + } + ); - if (err && /** @type {any} */ (err).hideStack) { - this.stack = - err.stack.split("\n").slice(1).join("\n") + "\n\n" + this.stack; - } + compiler.hooks.compile.tap("DelegatedPlugin", ({ normalModuleFactory }) => { + new DelegatedModuleFactoryPlugin({ + associatedObjectForCache: compiler.root, + ...this.options + }).apply(normalModuleFactory); + }); } } -module.exports = ModuleDependencyError; +module.exports = DelegatedPlugin; /***/ }), -/***/ 29656: +/***/ 71040: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -44889,49 +39552,111 @@ module.exports = ModuleDependencyError; -const WebpackError = __webpack_require__(53799); const makeSerializable = __webpack_require__(33032); -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("./Module")} Module */ +/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./ChunkGroup")} ChunkGroup */ +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("./util/Hash")} Hash */ -class ModuleDependencyWarning extends WebpackError { - /** - * @param {Module} module module tied to dependency - * @param {Error} err error thrown - * @param {DependencyLocation} loc location of dependency - */ - constructor(module, err, loc) { - super(err ? err.message : ""); +/** @typedef {(d: Dependency) => boolean} DependencyFilterFunction */ - this.name = "ModuleDependencyWarning"; - this.details = - err && !(/** @type {any} */ (err).hideStack) - ? err.stack.split("\n").slice(1).join("\n") - : undefined; - this.module = module; - this.loc = loc; - /** error is not (de)serialized, so it might be undefined after deserialization */ - this.error = err; +class DependenciesBlock { + constructor() { + /** @type {Dependency[]} */ + this.dependencies = []; + /** @type {AsyncDependenciesBlock[]} */ + this.blocks = []; + /** @type {DependenciesBlock} */ + this.parent = undefined; + } - if (err && /** @type {any} */ (err).hideStack) { - this.stack = - err.stack.split("\n").slice(1).join("\n") + "\n\n" + this.stack; - } + getRootBlock() { + /** @type {DependenciesBlock} */ + let current = this; + while (current.parent) current = current.parent; + return current; } -} -makeSerializable( - ModuleDependencyWarning, - "webpack/lib/ModuleDependencyWarning" -); + /** + * Adds a DependencyBlock to DependencyBlock relationship. + * This is used for when a Module has a AsyncDependencyBlock tie (for code-splitting) + * + * @param {AsyncDependenciesBlock} block block being added + * @returns {void} + */ + addBlock(block) { + this.blocks.push(block); + block.parent = this; + } -module.exports = ModuleDependencyWarning; + /** + * @param {Dependency} dependency dependency being tied to block. + * This is an "edge" pointing to another "node" on module graph. + * @returns {void} + */ + addDependency(dependency) { + this.dependencies.push(dependency); + } + + /** + * @param {Dependency} dependency dependency being removed + * @returns {void} + */ + removeDependency(dependency) { + const idx = this.dependencies.indexOf(dependency); + if (idx >= 0) { + this.dependencies.splice(idx, 1); + } + } + + /** + * Removes all dependencies and blocks + * @returns {void} + */ + clearDependenciesAndBlocks() { + this.dependencies.length = 0; + this.blocks.length = 0; + } + + /** + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + for (const dep of this.dependencies) { + dep.updateHash(hash, context); + } + for (const block of this.blocks) { + block.updateHash(hash, context); + } + } + + serialize({ write }) { + write(this.dependencies); + write(this.blocks); + } + + deserialize({ read }) { + this.dependencies = read(); + this.blocks = read(); + for (const block of this.blocks) { + block.parent = this; + } + } +} + +makeSerializable(DependenciesBlock, "webpack/lib/DependenciesBlock"); + +module.exports = DependenciesBlock; /***/ }), -/***/ 23744: +/***/ 54912: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -44942,65 +39667,352 @@ module.exports = ModuleDependencyWarning; -const { cleanUp } = __webpack_require__(59985); -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); +const memoize = __webpack_require__(78676); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./util/Hash")} Hash */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ + +/** + * @typedef {Object} UpdateHashContext + * @property {ChunkGraph} chunkGraph + * @property {RuntimeSpec} runtime + * @property {RuntimeTemplate=} runtimeTemplate + */ + +/** + * @typedef {Object} SourcePosition + * @property {number} line + * @property {number=} column + */ + +/** + * @typedef {Object} RealDependencyLocation + * @property {SourcePosition} start + * @property {SourcePosition=} end + * @property {number=} index + */ + +/** + * @typedef {Object} SyntheticDependencyLocation + * @property {string} name + * @property {number=} index + */ + +/** @typedef {SyntheticDependencyLocation|RealDependencyLocation} DependencyLocation */ + +/** + * @typedef {Object} ExportSpec + * @property {string} name the name of the export + * @property {boolean=} canMangle can the export be renamed (defaults to true) + * @property {boolean=} terminalBinding is the export a terminal binding that should be checked for export star conflicts + * @property {(string | ExportSpec)[]=} exports nested exports + * @property {ModuleGraphConnection=} from when reexported: from which module + * @property {string[] | null=} export when reexported: from which export + * @property {number=} priority when reexported: with which priority + * @property {boolean=} hidden export is not visible, because another export blends over it + */ + +/** + * @typedef {Object} ExportsSpec + * @property {(string | ExportSpec)[] | true | null} exports exported names, true for unknown exports or null for no exports + * @property {Set=} excludeExports when exports = true, list of unaffected exports + * @property {Set=} hideExports list of maybe prior exposed, but now hidden exports + * @property {ModuleGraphConnection=} from when reexported: from which module + * @property {number=} priority when reexported: with which priority + * @property {boolean=} canMangle can the export be renamed (defaults to true) + * @property {boolean=} terminalBinding are the exports terminal bindings that should be checked for export star conflicts + * @property {Module[]=} dependencies module on which the result depends on + */ + +/** + * @typedef {Object} ReferencedExport + * @property {string[]} name name of the referenced export + * @property {boolean=} canMangle when false, referenced export can not be mangled, defaults to true + */ + +const TRANSITIVE = Symbol("transitive"); + +const getIgnoredModule = memoize(() => { + const RawModule = __webpack_require__(84929); + return new RawModule("/* (ignored) */", `ignored`, `(ignored)`); +}); + +class Dependency { + constructor() { + /** @type {Module} */ + this._parentModule = undefined; + /** @type {DependenciesBlock} */ + this._parentDependenciesBlock = undefined; + /** @type {number} */ + this._parentDependenciesBlockIndex = -1; + // TODO check if this can be moved into ModuleDependency + /** @type {boolean} */ + this.weak = false; + // TODO check if this can be moved into ModuleDependency + /** @type {boolean} */ + this.optional = false; + this._locSL = 0; + this._locSC = 0; + this._locEL = 0; + this._locEC = 0; + this._locI = undefined; + this._locN = undefined; + this._loc = undefined; + } -class ModuleError extends WebpackError { /** - * @param {Error} err error thrown - * @param {{from?: string|null}} info additional info + * @returns {string} a display name for the type of dependency */ - constructor(err, { from = null } = {}) { - let message = "Module Error"; + get type() { + return "unknown"; + } - if (from) { - message += ` (from ${from}):\n`; - } else { - message += ": "; + /** + * @returns {string} a dependency category, typical categories are "commonjs", "amd", "esm" + */ + get category() { + return "unknown"; + } + + /** + * @returns {DependencyLocation} location + */ + get loc() { + if (this._loc !== undefined) return this._loc; + /** @type {SyntheticDependencyLocation & RealDependencyLocation} */ + const loc = {}; + if (this._locSL > 0) { + loc.start = { line: this._locSL, column: this._locSC }; + } + if (this._locEL > 0) { + loc.end = { line: this._locEL, column: this._locEC }; + } + if (this._locN !== undefined) { + loc.name = this._locN; } + if (this._locI !== undefined) { + loc.index = this._locI; + } + return (this._loc = loc); + } - if (err && typeof err === "object" && err.message) { - message += err.message; - } else if (err) { - message += err; + set loc(loc) { + if ("start" in loc && typeof loc.start === "object") { + this._locSL = loc.start.line || 0; + this._locSC = loc.start.column || 0; + } else { + this._locSL = 0; + this._locSC = 0; + } + if ("end" in loc && typeof loc.end === "object") { + this._locEL = loc.end.line || 0; + this._locEC = loc.end.column || 0; + } else { + this._locEL = 0; + this._locEC = 0; + } + if ("index" in loc) { + this._locI = loc.index; + } else { + this._locI = undefined; + } + if ("name" in loc) { + this._locN = loc.name; + } else { + this._locN = undefined; } + this._loc = loc; + } - super(message); + setLoc(startLine, startColumn, endLine, endColumn) { + this._locSL = startLine; + this._locSC = startColumn; + this._locEL = endLine; + this._locEC = endColumn; + this._locI = undefined; + this._locN = undefined; + this._loc = undefined; + } - this.name = "ModuleError"; - this.error = err; - this.details = - err && typeof err === "object" && err.stack - ? cleanUp(err.stack, this.message) - : undefined; + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + return null; } - serialize(context) { - const { write } = context; + /** + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + */ + couldAffectReferencingModule() { + return TRANSITIVE; + } - write(this.error); + /** + * Returns the referenced module and export + * @deprecated + * @param {ModuleGraph} moduleGraph module graph + * @returns {never} throws error + */ + getReference(moduleGraph) { + throw new Error( + "Dependency.getReference was removed in favor of Dependency.getReferencedExports, ModuleGraph.getModule and ModuleGraph.getConnection().active" + ); + } - super.serialize(context); + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + return Dependency.EXPORTS_OBJECT_REFERENCED; } - deserialize(context) { - const { read } = context; + /** + * @param {ModuleGraph} moduleGraph module graph + * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active + */ + getCondition(moduleGraph) { + return null; + } - this.error = read(); + /** + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names + */ + getExports(moduleGraph) { + return undefined; + } - super.deserialize(context); + /** + * Returns warnings + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[]} warnings + */ + getWarnings(moduleGraph) { + return null; + } + + /** + * Returns errors + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[]} errors + */ + getErrors(moduleGraph) { + return null; + } + + /** + * Update the hash + * @param {Hash} hash hash to be updated + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) {} + + /** + * implement this method to allow the occurrence order plugin to count correctly + * @returns {number} count how often the id is used in this dependency + */ + getNumberOfIdOccurrences() { + return 1; + } + + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this dependency connects the module to referencing modules + */ + getModuleEvaluationSideEffectsState(moduleGraph) { + return true; + } + + /** + * @param {string} context context directory + * @returns {Module} a module + */ + createIgnoredModule(context) { + return getIgnoredModule(); + } + + serialize({ write }) { + write(this.weak); + write(this.optional); + write(this._locSL); + write(this._locSC); + write(this._locEL); + write(this._locEC); + write(this._locI); + write(this._locN); + } + + deserialize({ read }) { + this.weak = read(); + this.optional = read(); + this._locSL = read(); + this._locSC = read(); + this._locEL = read(); + this._locEC = read(); + this._locI = read(); + this._locN = read(); } } -makeSerializable(ModuleError, "webpack/lib/ModuleError"); +/** @type {string[][]} */ +Dependency.NO_EXPORTS_REFERENCED = []; +/** @type {string[][]} */ +Dependency.EXPORTS_OBJECT_REFERENCED = [[]]; -module.exports = ModuleError; +Object.defineProperty(Dependency.prototype, "module", { + /** + * @deprecated + * @returns {never} throws + */ + get() { + throw new Error( + "module property was removed from Dependency (use compilation.moduleGraph.getModule(dependency) instead)" + ); + }, + + /** + * @deprecated + * @returns {never} throws + */ + set() { + throw new Error( + "module property was removed from Dependency (use compilation.moduleGraph.updateModule(dependency, module) instead)" + ); + } +}); + +Object.defineProperty(Dependency.prototype, "disconnect", { + get() { + throw new Error( + "disconnect was removed from Dependency (Dependency no longer carries graph specific information)" + ); + } +}); + +Dependency.TRANSITIVE = TRANSITIVE; + +module.exports = Dependency; /***/ }), -/***/ 51010: +/***/ 5160: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -45011,55 +40023,62 @@ module.exports = ModuleError; -/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ +/** @typedef {import("./ConcatenationScope")} ConcatenationScope */ /** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./Dependency").RuntimeSpec} RuntimeSpec */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Generator").GenerateContext} GenerateContext */ +/** @template T @typedef {import("./InitFragment")} InitFragment */ /** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ /** - * @typedef {Object} ModuleFactoryResult - * @property {Module=} module the created module or unset if no module was created - * @property {Set=} fileDependencies - * @property {Set=} contextDependencies - * @property {Set=} missingDependencies - * @property {boolean=} cacheable allow to use the unsafe cache + * @typedef {Object} DependencyTemplateContext + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {DependencyTemplates} dependencyTemplates the dependency templates + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {Set} runtimeRequirements the requirements for runtime + * @property {Module} module current module + * @property {RuntimeSpec} runtime current runtimes, for which code is generated + * @property {InitFragment[]} initFragments mutable array of init fragments for the current module + * @property {ConcatenationScope=} concatenationScope when in a concatenated module, information about other concatenated modules + * @property {CodeGenerationResults} codeGenerationResults the code generation results */ /** - * @typedef {Object} ModuleFactoryCreateDataContextInfo - * @property {string} issuer - * @property {string | null=} issuerLayer - * @property {string} compiler + * @typedef {Object} CssDependencyTemplateContextExtras + * @property {Map} cssExports the css exports */ -/** - * @typedef {Object} ModuleFactoryCreateData - * @property {ModuleFactoryCreateDataContextInfo} contextInfo - * @property {ResolveOptions=} resolveOptions - * @property {string} context - * @property {Dependency[]} dependencies - */ +/** @typedef {DependencyTemplateContext & CssDependencyTemplateContextExtras} CssDependencyTemplateContext */ -class ModuleFactory { +class DependencyTemplate { /* istanbul ignore next */ /** * @abstract - * @param {ModuleFactoryCreateData} data data object - * @param {function(Error=, ModuleFactoryResult=): void} callback callback + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - create(data, callback) { + apply(dependency, source, templateContext) { const AbstractMethodError = __webpack_require__(77198); throw new AbstractMethodError(); } } -module.exports = ModuleFactory; +module.exports = DependencyTemplate; /***/ }), -/***/ 88821: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 9163: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -45069,281 +40088,134 @@ module.exports = ModuleFactory; -const NormalModule = __webpack_require__(39); const createHash = __webpack_require__(49835); -const memoize = __webpack_require__(78676); -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./DependencyTemplate")} DependencyTemplate */ /** @typedef {typeof import("./util/Hash")} Hash */ -const ModuleFilenameHelpers = exports; - -// TODO webpack 6: consider removing these -ModuleFilenameHelpers.ALL_LOADERS_RESOURCE = "[all-loaders][resource]"; -ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE = - /\[all-?loaders\]\[resource\]/gi; -ModuleFilenameHelpers.LOADERS_RESOURCE = "[loaders][resource]"; -ModuleFilenameHelpers.REGEXP_LOADERS_RESOURCE = /\[loaders\]\[resource\]/gi; -ModuleFilenameHelpers.RESOURCE = "[resource]"; -ModuleFilenameHelpers.REGEXP_RESOURCE = /\[resource\]/gi; -ModuleFilenameHelpers.ABSOLUTE_RESOURCE_PATH = "[absolute-resource-path]"; -// cSpell:words olute -ModuleFilenameHelpers.REGEXP_ABSOLUTE_RESOURCE_PATH = - /\[abs(olute)?-?resource-?path\]/gi; -ModuleFilenameHelpers.RESOURCE_PATH = "[resource-path]"; -ModuleFilenameHelpers.REGEXP_RESOURCE_PATH = /\[resource-?path\]/gi; -ModuleFilenameHelpers.ALL_LOADERS = "[all-loaders]"; -ModuleFilenameHelpers.REGEXP_ALL_LOADERS = /\[all-?loaders\]/gi; -ModuleFilenameHelpers.LOADERS = "[loaders]"; -ModuleFilenameHelpers.REGEXP_LOADERS = /\[loaders\]/gi; -ModuleFilenameHelpers.QUERY = "[query]"; -ModuleFilenameHelpers.REGEXP_QUERY = /\[query\]/gi; -ModuleFilenameHelpers.ID = "[id]"; -ModuleFilenameHelpers.REGEXP_ID = /\[id\]/gi; -ModuleFilenameHelpers.HASH = "[hash]"; -ModuleFilenameHelpers.REGEXP_HASH = /\[hash\]/gi; -ModuleFilenameHelpers.NAMESPACE = "[namespace]"; -ModuleFilenameHelpers.REGEXP_NAMESPACE = /\[namespace\]/gi; +/** @typedef {new (...args: any[]) => Dependency} DependencyConstructor */ -const getAfter = (strFn, token) => { - return () => { - const str = strFn(); - const idx = str.indexOf(token); - return idx < 0 ? "" : str.substr(idx); - }; -}; +class DependencyTemplates { + /** + * @param {string | Hash} hashFunction the hash function to use + */ + constructor(hashFunction = "md4") { + /** @type {Map} */ + this._map = new Map(); + /** @type {string} */ + this._hash = "31d6cfe0d16ae931b73c59d7e0c089c0"; + this._hashFunction = hashFunction; + } -const getBefore = (strFn, token) => { - return () => { - const str = strFn(); - const idx = str.lastIndexOf(token); - return idx < 0 ? "" : str.substr(0, idx); - }; -}; + /** + * @param {DependencyConstructor} dependency Constructor of Dependency + * @returns {DependencyTemplate} template for this dependency + */ + get(dependency) { + return this._map.get(dependency); + } -const getHash = (strFn, hashFunction) => { - return () => { - const hash = createHash(hashFunction); - hash.update(strFn()); - const digest = /** @type {string} */ (hash.digest("hex")); - return digest.substr(0, 4); - }; -}; + /** + * @param {DependencyConstructor} dependency Constructor of Dependency + * @param {DependencyTemplate} dependencyTemplate template for this dependency + * @returns {void} + */ + set(dependency, dependencyTemplate) { + this._map.set(dependency, dependencyTemplate); + } -const asRegExp = test => { - if (typeof test === "string") { - test = new RegExp("^" + test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")); + /** + * @param {string} part additional hash contributor + * @returns {void} + */ + updateHash(part) { + const hash = createHash(this._hashFunction); + hash.update(`${this._hash}${part}`); + this._hash = /** @type {string} */ (hash.digest("hex")); } - return test; -}; -const lazyObject = obj => { - const newObj = {}; - for (const key of Object.keys(obj)) { - const fn = obj[key]; - Object.defineProperty(newObj, key, { - get: () => fn(), - set: v => { - Object.defineProperty(newObj, key, { - value: v, - enumerable: true, - writable: true - }); - }, - enumerable: true, - configurable: true - }); + getHash() { + return this._hash; } - return newObj; -}; -const REGEXP = /\[\\*([\w-]+)\\*\]/gi; + clone() { + const newInstance = new DependencyTemplates(this._hashFunction); + newInstance._map = new Map(this._map); + newInstance._hash = this._hash; + return newInstance; + } +} -/** - * - * @param {Module | string} module the module - * @param {TODO} options options - * @param {Object} contextInfo context info - * @param {RequestShortener} contextInfo.requestShortener requestShortener - * @param {ChunkGraph} contextInfo.chunkGraph chunk graph - * @param {string | Hash} contextInfo.hashFunction the hash function to use - * @returns {string} the filename - */ -ModuleFilenameHelpers.createFilename = ( - module = "", - options, - { requestShortener, chunkGraph, hashFunction = "md4" } -) => { - const opts = { - namespace: "", - moduleFilenameTemplate: "", - ...(typeof options === "object" - ? options - : { - moduleFilenameTemplate: options - }) - }; +module.exports = DependencyTemplates; - let absoluteResourcePath; - let hash; - let identifier; - let moduleId; - let shortIdentifier; - if (typeof module === "string") { - shortIdentifier = memoize(() => requestShortener.shorten(module)); - identifier = shortIdentifier; - moduleId = () => ""; - absoluteResourcePath = () => module.split("!").pop(); - hash = getHash(identifier, hashFunction); - } else { - shortIdentifier = memoize(() => - module.readableIdentifier(requestShortener) - ); - identifier = memoize(() => requestShortener.shorten(module.identifier())); - moduleId = () => chunkGraph.getModuleId(module); - absoluteResourcePath = () => - module instanceof NormalModule - ? module.resource - : module.identifier().split("!").pop(); - hash = getHash(identifier, hashFunction); - } - const resource = memoize(() => shortIdentifier().split("!").pop()); - const loaders = getBefore(shortIdentifier, "!"); - const allLoaders = getBefore(identifier, "!"); - const query = getAfter(resource, "?"); - const resourcePath = () => { - const q = query().length; - return q === 0 ? resource() : resource().slice(0, -q); - }; - if (typeof opts.moduleFilenameTemplate === "function") { - return opts.moduleFilenameTemplate( - lazyObject({ - identifier: identifier, - shortIdentifier: shortIdentifier, - resource: resource, - resourcePath: memoize(resourcePath), - absoluteResourcePath: memoize(absoluteResourcePath), - allLoaders: memoize(allLoaders), - query: memoize(query), - moduleId: memoize(moduleId), - hash: memoize(hash), - namespace: () => opts.namespace - }) - ); - } +/***/ }), - // TODO webpack 6: consider removing alternatives without dashes - /** @type {Map} */ - const replacements = new Map([ - ["identifier", identifier], - ["short-identifier", shortIdentifier], - ["resource", resource], - ["resource-path", resourcePath], - // cSpell:words resourcepath - ["resourcepath", resourcePath], - ["absolute-resource-path", absoluteResourcePath], - ["abs-resource-path", absoluteResourcePath], - // cSpell:words absoluteresource - ["absoluteresource-path", absoluteResourcePath], - // cSpell:words absresource - ["absresource-path", absoluteResourcePath], - // cSpell:words resourcepath - ["absolute-resourcepath", absoluteResourcePath], - // cSpell:words resourcepath - ["abs-resourcepath", absoluteResourcePath], - // cSpell:words absoluteresourcepath - ["absoluteresourcepath", absoluteResourcePath], - // cSpell:words absresourcepath - ["absresourcepath", absoluteResourcePath], - ["all-loaders", allLoaders], - // cSpell:words allloaders - ["allloaders", allLoaders], - ["loaders", loaders], - ["query", query], - ["id", moduleId], - ["hash", hash], - ["namespace", () => opts.namespace] - ]); +/***/ 62790: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // TODO webpack 6: consider removing weird double placeholders - return opts.moduleFilenameTemplate - .replace(ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE, "[identifier]") - .replace( - ModuleFilenameHelpers.REGEXP_LOADERS_RESOURCE, - "[short-identifier]" - ) - .replace(REGEXP, (match, content) => { - if (content.length + 2 === match.length) { - const replacement = replacements.get(content.toLowerCase()); - if (replacement !== undefined) { - return replacement(); - } - } else if (match.startsWith("[\\") && match.endsWith("\\]")) { - return `[${match.slice(2, -2)}]`; - } - return match; - }); -}; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -ModuleFilenameHelpers.replaceDuplicates = (array, fn, comparator) => { - const countMap = Object.create(null); - const posMap = Object.create(null); - array.forEach((item, idx) => { - countMap[item] = countMap[item] || []; - countMap[item].push(idx); - posMap[item] = 0; - }); - if (comparator) { - Object.keys(countMap).forEach(item => { - countMap[item].sort(comparator); - }); - } - return array.map((item, i) => { - if (countMap[item].length > 1) { - if (comparator && countMap[item][0] === i) return item; - return fn(item, i, posMap[item]++); - } else { - return item; - } - }); -}; -ModuleFilenameHelpers.matchPart = (str, test) => { - if (!test) return true; - test = asRegExp(test); - if (Array.isArray(test)) { - return test.map(asRegExp).some(regExp => regExp.test(str)); - } else { - return test.test(str); - } -}; -ModuleFilenameHelpers.matchObject = (obj, str) => { - if (obj.test) { - if (!ModuleFilenameHelpers.matchPart(str, obj.test)) { - return false; - } - } - if (obj.include) { - if (!ModuleFilenameHelpers.matchPart(str, obj.include)) { - return false; - } +const DllModuleFactory = __webpack_require__(68703); +const DllEntryDependency = __webpack_require__(95666); +const EntryDependency = __webpack_require__(3979); + +class DllEntryPlugin { + constructor(context, entries, options) { + this.context = context; + this.entries = entries; + this.options = options; } - if (obj.exclude) { - if (ModuleFilenameHelpers.matchPart(str, obj.exclude)) { - return false; - } + + apply(compiler) { + compiler.hooks.compilation.tap( + "DllEntryPlugin", + (compilation, { normalModuleFactory }) => { + const dllModuleFactory = new DllModuleFactory(); + compilation.dependencyFactories.set( + DllEntryDependency, + dllModuleFactory + ); + compilation.dependencyFactories.set( + EntryDependency, + normalModuleFactory + ); + } + ); + compiler.hooks.make.tapAsync("DllEntryPlugin", (compilation, callback) => { + compilation.addEntry( + this.context, + new DllEntryDependency( + this.entries.map((e, idx) => { + const dep = new EntryDependency(e); + dep.loc = { + name: this.options.name, + index: idx + }; + return dep; + }), + this.options.name + ), + this.options, + callback + ); + }); } - return true; -}; +} + +module.exports = DllEntryPlugin; /***/ }), -/***/ 99988: +/***/ 28280: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -45354,861 +40226,895 @@ ModuleFilenameHelpers.matchObject = (obj, str) => { -const util = __webpack_require__(73837); -const ExportsInfo = __webpack_require__(63686); -const ModuleGraphConnection = __webpack_require__(40639); -const SortableSet = __webpack_require__(13098); -const WeakTupleMap = __webpack_require__(28745); +const { RawSource } = __webpack_require__(51255); +const Module = __webpack_require__(73208); +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); -/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./ExportsInfo").ExportInfo} ExportInfo */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleProfile")} ModuleProfile */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("./Module").SourceContext} SourceContext */ /** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - -/** - * @callback OptimizationBailoutFunction - * @param {RequestShortener} requestShortener - * @returns {string} - */ +/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./util/Hash")} Hash */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ -const EMPTY_SET = new Set(); +const TYPES = new Set(["javascript"]); +const RUNTIME_REQUIREMENTS = new Set([ + RuntimeGlobals.require, + RuntimeGlobals.module +]); -/** - * @param {SortableSet} set input - * @returns {readonly Map} mapped by origin module - */ -const getConnectionsByOriginModule = set => { - const map = new Map(); - /** @type {Module | 0} */ - let lastModule = 0; - /** @type {ModuleGraphConnection[]} */ - let lastList = undefined; - for (const connection of set) { - const { originModule } = connection; - if (lastModule === originModule) { - lastList.push(connection); - } else { - lastModule = originModule; - const list = map.get(originModule); - if (list !== undefined) { - lastList = list; - list.push(connection); - } else { - const list = [connection]; - lastList = list; - map.set(originModule, list); - } - } - } - return map; -}; +class DllModule extends Module { + constructor(context, dependencies, name) { + super("javascript/dynamic", context); -/** - * @param {SortableSet} set input - * @returns {readonly Map} mapped by module - */ -const getConnectionsByModule = set => { - const map = new Map(); - /** @type {Module | 0} */ - let lastModule = 0; - /** @type {ModuleGraphConnection[]} */ - let lastList = undefined; - for (const connection of set) { - const { module } = connection; - if (lastModule === module) { - lastList.push(connection); - } else { - lastModule = module; - const list = map.get(module); - if (list !== undefined) { - lastList = list; - list.push(connection); - } else { - const list = [connection]; - lastList = list; - map.set(module, list); - } - } + // Info from Factory + this.dependencies = dependencies; + this.name = name; } - return map; -}; -class ModuleGraphModule { - constructor() { - /** @type {SortableSet} */ - this.incomingConnections = new SortableSet(); - /** @type {SortableSet | undefined} */ - this.outgoingConnections = undefined; - /** @type {Module | null} */ - this.issuer = undefined; - /** @type {(string | OptimizationBailoutFunction)[]} */ - this.optimizationBailout = []; - /** @type {ExportsInfo} */ - this.exports = new ExportsInfo(); - /** @type {number} */ - this.preOrderIndex = null; - /** @type {number} */ - this.postOrderIndex = null; - /** @type {number} */ - this.depth = null; - /** @type {ModuleProfile} */ - this.profile = undefined; - /** @type {boolean} */ - this.async = false; - /** @type {ModuleGraphConnection[]} */ - this._unassignedConnections = undefined; + /** + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + return TYPES; } -} - -class ModuleGraph { - constructor() { - /** @type {WeakMap} */ - this._dependencyMap = new WeakMap(); - /** @type {Map} */ - this._moduleMap = new Map(); - /** @type {WeakMap} */ - this._metaMap = new WeakMap(); - - /** @type {WeakTupleMap} */ - this._cache = undefined; - /** @type {Map>} */ - this._moduleMemCaches = undefined; + /** + * @returns {string} a unique identifier of the module + */ + identifier() { + return `dll ${this.name}`; } /** - * @param {Module} module the module - * @returns {ModuleGraphModule} the internal module + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module */ - _getModuleGraphModule(module) { - let mgm = this._moduleMap.get(module); - if (mgm === undefined) { - mgm = new ModuleGraphModule(); - this._moduleMap.set(module, mgm); - } - return mgm; + readableIdentifier(requestShortener) { + return `dll ${this.name}`; } /** - * @param {Dependency} dependency the dependency - * @param {DependenciesBlock} block parent block - * @param {Module} module parent module - * @param {number=} indexInBlock position in block + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function * @returns {void} */ - setParents(dependency, block, module, indexInBlock = -1) { - dependency._parentDependenciesBlockIndex = indexInBlock; - dependency._parentDependenciesBlock = block; - dependency._parentModule = module; + build(options, compilation, resolver, fs, callback) { + this.buildMeta = {}; + this.buildInfo = {}; + return callback(); } /** - * @param {Dependency} dependency the dependency - * @returns {Module} parent module + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result */ - getParentModule(dependency) { - return dependency._parentModule; + codeGeneration(context) { + const sources = new Map(); + sources.set( + "javascript", + new RawSource("module.exports = __webpack_require__;") + ); + return { + sources, + runtimeRequirements: RUNTIME_REQUIREMENTS + }; } /** - * @param {Dependency} dependency the dependency - * @returns {DependenciesBlock} parent block + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} */ - getParentBlock(dependency) { - return dependency._parentDependenciesBlock; + needBuild(context, callback) { + return callback(null, !this.buildMeta); } /** - * @param {Dependency} dependency the dependency - * @returns {number} index + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) */ - getParentBlockIndex(dependency) { - return dependency._parentDependenciesBlockIndex; + size(type) { + return 12; } /** - * @param {Module} originModule the referencing module - * @param {Dependency} dependency the referencing dependency - * @param {Module} module the referenced module + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context * @returns {void} */ - setResolvedModule(originModule, dependency, module) { - const connection = new ModuleGraphConnection( - originModule, - dependency, - module, - undefined, - dependency.weak, - dependency.getCondition(this) - ); - const connections = this._getModuleGraphModule(module).incomingConnections; - connections.add(connection); - if (originModule) { - const mgm = this._getModuleGraphModule(originModule); - if (mgm._unassignedConnections === undefined) { - mgm._unassignedConnections = []; - } - mgm._unassignedConnections.push(connection); - if (mgm.outgoingConnections === undefined) { - mgm.outgoingConnections = new SortableSet(); - } - mgm.outgoingConnections.add(connection); - } else { - this._dependencyMap.set(dependency, connection); - } + updateHash(hash, context) { + hash.update(`dll module${this.name || ""}`); + super.updateHash(hash, context); } - /** - * @param {Dependency} dependency the referencing dependency - * @param {Module} module the referenced module - * @returns {void} - */ - updateModule(dependency, module) { - const connection = this.getConnection(dependency); - if (connection.module === module) return; - const newConnection = connection.clone(); - newConnection.module = module; - this._dependencyMap.set(dependency, newConnection); - connection.setActive(false); - const originMgm = this._getModuleGraphModule(connection.originModule); - originMgm.outgoingConnections.add(newConnection); - const targetMgm = this._getModuleGraphModule(module); - targetMgm.incomingConnections.add(newConnection); + serialize(context) { + context.write(this.name); + super.serialize(context); } - /** - * @param {Dependency} dependency the referencing dependency - * @returns {void} - */ - removeConnection(dependency) { - const connection = this.getConnection(dependency); - const targetMgm = this._getModuleGraphModule(connection.module); - targetMgm.incomingConnections.delete(connection); - const originMgm = this._getModuleGraphModule(connection.originModule); - originMgm.outgoingConnections.delete(connection); - this._dependencyMap.set(dependency, null); + deserialize(context) { + this.name = context.read(); + super.deserialize(context); } /** - * @param {Dependency} dependency the referencing dependency - * @param {string} explanation an explanation + * Assuming this module is in the cache. Update the (cached) module with + * the fresh module from the factory. Usually updates internal references + * and properties. + * @param {Module} module fresh module * @returns {void} */ - addExplanation(dependency, explanation) { - const connection = this.getConnection(dependency); - connection.addExplanation(explanation); + updateCacheModule(module) { + super.updateCacheModule(module); + this.dependencies = module.dependencies; } /** - * @param {Module} sourceModule the source module - * @param {Module} targetModule the target module - * @returns {void} + * Assuming this module is in the cache. Remove internal references to allow freeing some memory. */ - cloneModuleAttributes(sourceModule, targetModule) { - const oldMgm = this._getModuleGraphModule(sourceModule); - const newMgm = this._getModuleGraphModule(targetModule); - newMgm.postOrderIndex = oldMgm.postOrderIndex; - newMgm.preOrderIndex = oldMgm.preOrderIndex; - newMgm.depth = oldMgm.depth; - newMgm.exports = oldMgm.exports; - newMgm.async = oldMgm.async; + cleanupForCache() { + super.cleanupForCache(); + this.dependencies = undefined; } +} - /** - * @param {Module} module the module - * @returns {void} - */ - removeModuleAttributes(module) { - const mgm = this._getModuleGraphModule(module); - mgm.postOrderIndex = null; - mgm.preOrderIndex = null; - mgm.depth = null; - mgm.async = false; - } +makeSerializable(DllModule, "webpack/lib/DllModule"); - /** - * @returns {void} - */ - removeAllModuleAttributes() { - for (const mgm of this._moduleMap.values()) { - mgm.postOrderIndex = null; - mgm.preOrderIndex = null; - mgm.depth = null; - mgm.async = false; - } - } +module.exports = DllModule; - /** - * @param {Module} oldModule the old referencing module - * @param {Module} newModule the new referencing module - * @param {function(ModuleGraphConnection): boolean} filterConnection filter predicate for replacement - * @returns {void} - */ - moveModuleConnections(oldModule, newModule, filterConnection) { - if (oldModule === newModule) return; - const oldMgm = this._getModuleGraphModule(oldModule); - const newMgm = this._getModuleGraphModule(newModule); - // Outgoing connections - const oldConnections = oldMgm.outgoingConnections; - if (oldConnections !== undefined) { - if (newMgm.outgoingConnections === undefined) { - newMgm.outgoingConnections = new SortableSet(); - } - const newConnections = newMgm.outgoingConnections; - for (const connection of oldConnections) { - if (filterConnection(connection)) { - connection.originModule = newModule; - newConnections.add(connection); - oldConnections.delete(connection); - } - } - } - // Incoming connections - const oldConnections2 = oldMgm.incomingConnections; - const newConnections2 = newMgm.incomingConnections; - for (const connection of oldConnections2) { - if (filterConnection(connection)) { - connection.module = newModule; - newConnections2.add(connection); - oldConnections2.delete(connection); - } - } - } - /** - * @param {Module} oldModule the old referencing module - * @param {Module} newModule the new referencing module - * @param {function(ModuleGraphConnection): boolean} filterConnection filter predicate for replacement - * @returns {void} - */ - copyOutgoingModuleConnections(oldModule, newModule, filterConnection) { - if (oldModule === newModule) return; - const oldMgm = this._getModuleGraphModule(oldModule); - const newMgm = this._getModuleGraphModule(newModule); - // Outgoing connections - const oldConnections = oldMgm.outgoingConnections; - if (oldConnections !== undefined) { - if (newMgm.outgoingConnections === undefined) { - newMgm.outgoingConnections = new SortableSet(); - } - const newConnections = newMgm.outgoingConnections; - for (const connection of oldConnections) { - if (filterConnection(connection)) { - const newConnection = connection.clone(); - newConnection.originModule = newModule; - newConnections.add(newConnection); - if (newConnection.module !== undefined) { - const otherMgm = this._getModuleGraphModule(newConnection.module); - otherMgm.incomingConnections.add(newConnection); - } - } - } - } - } +/***/ }), + +/***/ 68703: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const DllModule = __webpack_require__(28280); +const ModuleFactory = __webpack_require__(51010); + +/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ +/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ +/** @typedef {import("./dependencies/DllEntryDependency")} DllEntryDependency */ +class DllModuleFactory extends ModuleFactory { + constructor() { + super(); + this.hooks = Object.freeze({}); + } /** - * @param {Module} module the referenced module - * @param {string} explanation an explanation why it's referenced + * @param {ModuleFactoryCreateData} data data object + * @param {function(Error=, ModuleFactoryResult=): void} callback callback * @returns {void} */ - addExtraReason(module, explanation) { - const connections = this._getModuleGraphModule(module).incomingConnections; - connections.add(new ModuleGraphConnection(null, null, module, explanation)); + create(data, callback) { + const dependency = /** @type {DllEntryDependency} */ (data.dependencies[0]); + callback(null, { + module: new DllModule( + data.context, + dependency.dependencies, + dependency.name + ) + }); } +} - /** - * @param {Dependency} dependency the dependency to look for a referenced module - * @returns {Module} the referenced module - */ - getResolvedModule(dependency) { - const connection = this.getConnection(dependency); - return connection !== undefined ? connection.resolvedModule : null; - } +module.exports = DllModuleFactory; - /** - * @param {Dependency} dependency the dependency to look for a referenced module - * @returns {ModuleGraphConnection | undefined} the connection - */ - getConnection(dependency) { - const connection = this._dependencyMap.get(dependency); - if (connection === undefined) { - const module = this.getParentModule(dependency); - if (module !== undefined) { - const mgm = this._getModuleGraphModule(module); - if ( - mgm._unassignedConnections && - mgm._unassignedConnections.length !== 0 - ) { - let foundConnection; - for (const connection of mgm._unassignedConnections) { - this._dependencyMap.set(connection.dependency, connection); - if (connection.dependency === dependency) - foundConnection = connection; - } - mgm._unassignedConnections.length = 0; - if (foundConnection !== undefined) { - return foundConnection; - } - } - } - this._dependencyMap.set(dependency, null); - return undefined; - } - return connection === null ? undefined : connection; - } - /** - * @param {Dependency} dependency the dependency to look for a referenced module - * @returns {Module} the referenced module - */ - getModule(dependency) { - const connection = this.getConnection(dependency); - return connection !== undefined ? connection.module : null; - } +/***/ }), - /** - * @param {Dependency} dependency the dependency to look for a referencing module - * @returns {Module} the referencing module - */ - getOrigin(dependency) { - const connection = this.getConnection(dependency); - return connection !== undefined ? connection.originModule : null; - } +/***/ 40038: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {Dependency} dependency the dependency to look for a referencing module - * @returns {Module} the original referencing module - */ - getResolvedOrigin(dependency) { - const connection = this.getConnection(dependency); - return connection !== undefined ? connection.resolvedOriginModule : null; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {Module} module the module - * @returns {Iterable} reasons why a module is included - */ - getIncomingConnections(module) { - const connections = this._getModuleGraphModule(module).incomingConnections; - return connections; - } - /** - * @param {Module} module the module - * @returns {Iterable} list of outgoing connections - */ - getOutgoingConnections(module) { - const connections = this._getModuleGraphModule(module).outgoingConnections; - return connections === undefined ? EMPTY_SET : connections; - } - /** - * @param {Module} module the module - * @returns {readonly Map} reasons why a module is included, in a map by source module - */ - getIncomingConnectionsByOriginModule(module) { - const connections = this._getModuleGraphModule(module).incomingConnections; - return connections.getFromUnorderedCache(getConnectionsByOriginModule); - } +const DllEntryPlugin = __webpack_require__(62790); +const FlagAllModulesAsUsedPlugin = __webpack_require__(58727); +const LibManifestPlugin = __webpack_require__(93837); +const createSchemaValidation = __webpack_require__(32540); - /** - * @param {Module} module the module - * @returns {readonly Map | undefined} connections to modules, in a map by module - */ - getOutgoingConnectionsByModule(module) { - const connections = this._getModuleGraphModule(module).outgoingConnections; - return connections === undefined - ? undefined - : connections.getFromUnorderedCache(getConnectionsByModule); +/** @typedef {import("../declarations/plugins/DllPlugin").DllPluginOptions} DllPluginOptions */ +/** @typedef {import("./Compiler")} Compiler */ + +const validate = createSchemaValidation( + __webpack_require__(9667), + () => __webpack_require__(99926), + { + name: "Dll Plugin", + baseDataPath: "options" } +); +class DllPlugin { /** - * @param {Module} module the module - * @returns {ModuleProfile | null} the module profile + * @param {DllPluginOptions} options options object */ - getProfile(module) { - const mgm = this._getModuleGraphModule(module); - return mgm.profile; + constructor(options) { + validate(options); + this.options = { + ...options, + entryOnly: options.entryOnly !== false + }; } /** - * @param {Module} module the module - * @param {ModuleProfile | null} profile the module profile + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - setProfile(module, profile) { - const mgm = this._getModuleGraphModule(module); - mgm.profile = profile; + apply(compiler) { + compiler.hooks.entryOption.tap("DllPlugin", (context, entry) => { + if (typeof entry !== "function") { + for (const name of Object.keys(entry)) { + const options = { + name, + filename: entry.filename + }; + new DllEntryPlugin(context, entry[name].import, options).apply( + compiler + ); + } + } else { + throw new Error( + "DllPlugin doesn't support dynamic entry (function) yet" + ); + } + return true; + }); + new LibManifestPlugin(this.options).apply(compiler); + if (!this.options.entryOnly) { + new FlagAllModulesAsUsedPlugin("DllPlugin").apply(compiler); + } } +} - /** - * @param {Module} module the module - * @returns {Module | null} the issuer module - */ - getIssuer(module) { - const mgm = this._getModuleGraphModule(module); - return mgm.issuer; - } +module.exports = DllPlugin; - /** - * @param {Module} module the module - * @param {Module | null} issuer the issuer module - * @returns {void} - */ - setIssuer(module, issuer) { - const mgm = this._getModuleGraphModule(module); - mgm.issuer = issuer; - } - /** - * @param {Module} module the module - * @param {Module | null} issuer the issuer module - * @returns {void} - */ - setIssuerIfUnset(module, issuer) { - const mgm = this._getModuleGraphModule(module); - if (mgm.issuer === undefined) mgm.issuer = issuer; - } +/***/ }), - /** - * @param {Module} module the module - * @returns {(string | OptimizationBailoutFunction)[]} optimization bailouts - */ - getOptimizationBailout(module) { - const mgm = this._getModuleGraphModule(module); - return mgm.optimizationBailout; - } +/***/ 90999: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {Module} module the module - * @returns {true | string[] | null} the provided exports - */ - getProvidedExports(module) { - const mgm = this._getModuleGraphModule(module); - return mgm.exports.getProvidedExports(); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {Module} module the module - * @param {string | string[]} exportName a name of an export - * @returns {boolean | null} true, if the export is provided by the module. - * null, if it's unknown. - * false, if it's not provided. - */ - isExportProvided(module, exportName) { - const mgm = this._getModuleGraphModule(module); - const result = mgm.exports.isExportProvided(exportName); - return result === undefined ? null : result; - } - /** - * @param {Module} module the module - * @returns {ExportsInfo} info about the exports - */ - getExportsInfo(module) { - const mgm = this._getModuleGraphModule(module); - return mgm.exports; - } - /** - * @param {Module} module the module - * @param {string} exportName the export - * @returns {ExportInfo} info about the export - */ - getExportInfo(module, exportName) { - const mgm = this._getModuleGraphModule(module); - return mgm.exports.getExportInfo(exportName); - } +const parseJson = __webpack_require__(15235); +const DelegatedModuleFactoryPlugin = __webpack_require__(51387); +const ExternalModuleFactoryPlugin = __webpack_require__(62153); +const WebpackError = __webpack_require__(53799); +const DelegatedSourceDependency = __webpack_require__(22914); +const createSchemaValidation = __webpack_require__(32540); +const makePathsRelative = (__webpack_require__(82186).makePathsRelative); - /** - * @param {Module} module the module - * @param {string} exportName the export - * @returns {ExportInfo} info about the export (do not modify) - */ - getReadOnlyExportInfo(module, exportName) { - const mgm = this._getModuleGraphModule(module); - return mgm.exports.getReadOnlyExportInfo(exportName); +/** @typedef {import("../declarations/WebpackOptions").Externals} Externals */ +/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptions} DllReferencePluginOptions */ +/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptionsManifest} DllReferencePluginOptionsManifest */ + +const validate = createSchemaValidation( + __webpack_require__(28534), + () => __webpack_require__(46552), + { + name: "Dll Reference Plugin", + baseDataPath: "options" } +); +class DllReferencePlugin { /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @returns {false | true | SortableSet | null} the used exports - * false: module is not used at all. - * true: the module namespace/object export is used. - * SortableSet: these export names are used. - * empty SortableSet: module is used but no export. - * null: unknown, worst case should be assumed. + * @param {DllReferencePluginOptions} options options object */ - getUsedExports(module, runtime) { - const mgm = this._getModuleGraphModule(module); - return mgm.exports.getUsedExports(runtime); + constructor(options) { + validate(options); + this.options = options; + /** @type {WeakMap} */ + this._compilationData = new WeakMap(); } - /** - * @param {Module} module the module - * @returns {number} the index of the module - */ - getPreOrderIndex(module) { - const mgm = this._getModuleGraphModule(module); - return mgm.preOrderIndex; + apply(compiler) { + compiler.hooks.compilation.tap( + "DllReferencePlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + DelegatedSourceDependency, + normalModuleFactory + ); + } + ); + + compiler.hooks.beforeCompile.tapAsync( + "DllReferencePlugin", + (params, callback) => { + if ("manifest" in this.options) { + const manifest = this.options.manifest; + if (typeof manifest === "string") { + compiler.inputFileSystem.readFile(manifest, (err, result) => { + if (err) return callback(err); + const data = { + path: manifest, + data: undefined, + error: undefined + }; + // Catch errors parsing the manifest so that blank + // or malformed manifest files don't kill the process. + try { + data.data = parseJson(result.toString("utf-8")); + } catch (e) { + // Store the error in the params so that it can + // be added as a compilation error later on. + const manifestPath = makePathsRelative( + compiler.options.context, + manifest, + compiler.root + ); + data.error = new DllManifestError(manifestPath, e.message); + } + this._compilationData.set(params, data); + return callback(); + }); + return; + } + } + return callback(); + } + ); + + compiler.hooks.compile.tap("DllReferencePlugin", params => { + let name = this.options.name; + let sourceType = this.options.sourceType; + let content = + "content" in this.options ? this.options.content : undefined; + if ("manifest" in this.options) { + let manifestParameter = this.options.manifest; + let manifest; + if (typeof manifestParameter === "string") { + const data = this._compilationData.get(params); + // If there was an error parsing the manifest + // file, exit now because the error will be added + // as a compilation error in the "compilation" hook. + if (data.error) { + return; + } + manifest = data.data; + } else { + manifest = manifestParameter; + } + if (manifest) { + if (!name) name = manifest.name; + if (!sourceType) sourceType = manifest.type; + if (!content) content = manifest.content; + } + } + /** @type {Externals} */ + const externals = {}; + const source = "dll-reference " + name; + externals[source] = name; + const normalModuleFactory = params.normalModuleFactory; + new ExternalModuleFactoryPlugin(sourceType || "var", externals).apply( + normalModuleFactory + ); + new DelegatedModuleFactoryPlugin({ + source: source, + type: this.options.type, + scope: this.options.scope, + context: this.options.context || compiler.options.context, + content, + extensions: this.options.extensions, + associatedObjectForCache: compiler.root + }).apply(normalModuleFactory); + }); + + compiler.hooks.compilation.tap( + "DllReferencePlugin", + (compilation, params) => { + if ("manifest" in this.options) { + let manifest = this.options.manifest; + if (typeof manifest === "string") { + const data = this._compilationData.get(params); + // If there was an error parsing the manifest file, add the + // error as a compilation error to make the compilation fail. + if (data.error) { + compilation.errors.push(data.error); + } + compilation.fileDependencies.add(manifest); + } + } + } + ); + } +} + +class DllManifestError extends WebpackError { + constructor(filename, message) { + super(); + + this.name = "DllManifestError"; + this.message = `Dll manifest ${filename}\n${message}`; } +} + +module.exports = DllReferencePlugin; + +/***/ }), + +/***/ 96475: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Naoyuki Kanezawa @nkzawa +*/ + + + +const EntryOptionPlugin = __webpack_require__(9909); +const EntryPlugin = __webpack_require__(96953); +const EntryDependency = __webpack_require__(3979); + +/** @typedef {import("../declarations/WebpackOptions").EntryDynamicNormalized} EntryDynamic */ +/** @typedef {import("../declarations/WebpackOptions").EntryItem} EntryItem */ +/** @typedef {import("../declarations/WebpackOptions").EntryStaticNormalized} EntryStatic */ +/** @typedef {import("./Compiler")} Compiler */ + +class DynamicEntryPlugin { /** - * @param {Module} module the module - * @returns {number} the index of the module + * @param {string} context the context path + * @param {EntryDynamic} entry the entry value */ - getPostOrderIndex(module) { - const mgm = this._getModuleGraphModule(module); - return mgm.postOrderIndex; + constructor(context, entry) { + this.context = context; + this.entry = entry; } /** - * @param {Module} module the module - * @param {number} index the index of the module + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - setPreOrderIndex(module, index) { - const mgm = this._getModuleGraphModule(module); - mgm.preOrderIndex = index; + apply(compiler) { + compiler.hooks.compilation.tap( + "DynamicEntryPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + EntryDependency, + normalModuleFactory + ); + } + ); + + compiler.hooks.make.tapPromise( + "DynamicEntryPlugin", + (compilation, callback) => + Promise.resolve(this.entry()) + .then(entry => { + const promises = []; + for (const name of Object.keys(entry)) { + const desc = entry[name]; + const options = EntryOptionPlugin.entryDescriptionToOptions( + compiler, + name, + desc + ); + for (const entry of desc.import) { + promises.push( + new Promise((resolve, reject) => { + compilation.addEntry( + this.context, + EntryPlugin.createDependency(entry, options), + options, + err => { + if (err) return reject(err); + resolve(); + } + ); + }) + ); + } + } + return Promise.all(promises); + }) + .then(x => {}) + ); } +} + +module.exports = DynamicEntryPlugin; + + +/***/ }), + +/***/ 9909: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +/** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescription */ +/** @typedef {import("../declarations/WebpackOptions").EntryNormalized} Entry */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ +class EntryOptionPlugin { /** - * @param {Module} module the module - * @param {number} index the index of the module - * @returns {boolean} true, if the index was set + * @param {Compiler} compiler the compiler instance one is tapping into + * @returns {void} */ - setPreOrderIndexIfUnset(module, index) { - const mgm = this._getModuleGraphModule(module); - if (mgm.preOrderIndex === null) { - mgm.preOrderIndex = index; + apply(compiler) { + compiler.hooks.entryOption.tap("EntryOptionPlugin", (context, entry) => { + EntryOptionPlugin.applyEntryOption(compiler, context, entry); return true; - } - return false; + }); } /** - * @param {Module} module the module - * @param {number} index the index of the module + * @param {Compiler} compiler the compiler + * @param {string} context context directory + * @param {Entry} entry request * @returns {void} */ - setPostOrderIndex(module, index) { - const mgm = this._getModuleGraphModule(module); - mgm.postOrderIndex = index; + static applyEntryOption(compiler, context, entry) { + if (typeof entry === "function") { + const DynamicEntryPlugin = __webpack_require__(96475); + new DynamicEntryPlugin(context, entry).apply(compiler); + } else { + const EntryPlugin = __webpack_require__(96953); + for (const name of Object.keys(entry)) { + const desc = entry[name]; + const options = EntryOptionPlugin.entryDescriptionToOptions( + compiler, + name, + desc + ); + for (const entry of desc.import) { + new EntryPlugin(context, entry, options).apply(compiler); + } + } + } } /** - * @param {Module} module the module - * @param {number} index the index of the module - * @returns {boolean} true, if the index was set + * @param {Compiler} compiler the compiler + * @param {string} name entry name + * @param {EntryDescription} desc entry description + * @returns {EntryOptions} options for the entry */ - setPostOrderIndexIfUnset(module, index) { - const mgm = this._getModuleGraphModule(module); - if (mgm.postOrderIndex === null) { - mgm.postOrderIndex = index; - return true; + static entryDescriptionToOptions(compiler, name, desc) { + /** @type {EntryOptions} */ + const options = { + name, + filename: desc.filename, + runtime: desc.runtime, + layer: desc.layer, + dependOn: desc.dependOn, + publicPath: desc.publicPath, + chunkLoading: desc.chunkLoading, + asyncChunks: desc.asyncChunks, + wasmLoading: desc.wasmLoading, + library: desc.library + }; + if (desc.layer !== undefined && !compiler.options.experiments.layers) { + throw new Error( + "'entryOptions.layer' is only allowed when 'experiments.layers' is enabled" + ); } - return false; + if (desc.chunkLoading) { + const EnableChunkLoadingPlugin = __webpack_require__(61291); + EnableChunkLoadingPlugin.checkEnabled(compiler, desc.chunkLoading); + } + if (desc.wasmLoading) { + const EnableWasmLoadingPlugin = __webpack_require__(78613); + EnableWasmLoadingPlugin.checkEnabled(compiler, desc.wasmLoading); + } + if (desc.library) { + const EnableLibraryPlugin = __webpack_require__(91452); + EnableLibraryPlugin.checkEnabled(compiler, desc.library.type); + } + return options; } +} + +module.exports = EntryOptionPlugin; + + +/***/ }), + +/***/ 96953: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + +const EntryDependency = __webpack_require__(3979); + +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ + +class EntryPlugin { /** - * @param {Module} module the module - * @returns {number} the depth of the module + * An entry plugin which will handle + * creation of the EntryDependency + * + * @param {string} context context path + * @param {string} entry entry path + * @param {EntryOptions | string=} options entry options (passing a string is deprecated) */ - getDepth(module) { - const mgm = this._getModuleGraphModule(module); - return mgm.depth; + constructor(context, entry, options) { + this.context = context; + this.entry = entry; + this.options = options || ""; } /** - * @param {Module} module the module - * @param {number} depth the depth of the module + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - setDepth(module, depth) { - const mgm = this._getModuleGraphModule(module); - mgm.depth = depth; + apply(compiler) { + compiler.hooks.compilation.tap( + "EntryPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + EntryDependency, + normalModuleFactory + ); + } + ); + + const { entry, options, context } = this; + const dep = EntryPlugin.createDependency(entry, options); + + compiler.hooks.make.tapAsync("EntryPlugin", (compilation, callback) => { + compilation.addEntry(context, dep, options, err => { + callback(err); + }); + }); } /** - * @param {Module} module the module - * @param {number} depth the depth of the module - * @returns {boolean} true, if the depth was set + * @param {string} entry entry request + * @param {EntryOptions | string} options entry options (passing string is deprecated) + * @returns {EntryDependency} the dependency */ - setDepthIfLower(module, depth) { - const mgm = this._getModuleGraphModule(module); - if (mgm.depth === null || mgm.depth > depth) { - mgm.depth = depth; - return true; + static createDependency(entry, options) { + const dep = new EntryDependency(entry); + // TODO webpack 6 remove string option + dep.loc = { name: typeof options === "object" ? options.name : options }; + return dep; + } +} + +module.exports = EntryPlugin; + + +/***/ }), + +/***/ 13795: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ChunkGroup = __webpack_require__(15626); + +/** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescription */ +/** @typedef {import("./Chunk")} Chunk */ + +/** @typedef {{ name?: string } & Omit} EntryOptions */ + +/** + * Entrypoint serves as an encapsulation primitive for chunks that are + * a part of a single ChunkGroup. They represent all bundles that need to be loaded for a + * single instance of a page. Multi-page application architectures will typically yield multiple Entrypoint objects + * inside of the compilation, whereas a Single Page App may only contain one with many lazy-loaded chunks. + */ +class Entrypoint extends ChunkGroup { + /** + * Creates an instance of Entrypoint. + * @param {EntryOptions | string} entryOptions the options for the entrypoint (or name) + * @param {boolean=} initial false, when the entrypoint is not initial loaded + */ + constructor(entryOptions, initial = true) { + if (typeof entryOptions === "string") { + entryOptions = { name: entryOptions }; } - return false; + super({ + name: entryOptions.name + }); + this.options = entryOptions; + /** @type {Chunk=} */ + this._runtimeChunk = undefined; + /** @type {Chunk=} */ + this._entrypointChunk = undefined; + /** @type {boolean} */ + this._initial = initial; } /** - * @param {Module} module the module - * @returns {boolean} true, if the module is async + * @returns {boolean} true, when this chunk group will be loaded on initial page load */ - isAsync(module) { - const mgm = this._getModuleGraphModule(module); - return mgm.async; + isInitial() { + return this._initial; } /** - * @param {Module} module the module + * Sets the runtimeChunk for an entrypoint. + * @param {Chunk} chunk the chunk being set as the runtime chunk. * @returns {void} */ - setAsync(module) { - const mgm = this._getModuleGraphModule(module); - mgm.async = true; + setRuntimeChunk(chunk) { + this._runtimeChunk = chunk; } /** - * @param {any} thing any thing - * @returns {Object} metadata + * Fetches the chunk reference containing the webpack bootstrap code + * @returns {Chunk | null} returns the runtime chunk or null if there is none */ - getMeta(thing) { - let meta = this._metaMap.get(thing); - if (meta === undefined) { - meta = Object.create(null); - this._metaMap.set(thing, meta); + getRuntimeChunk() { + if (this._runtimeChunk) return this._runtimeChunk; + for (const parent of this.parentsIterable) { + if (parent instanceof Entrypoint) return parent.getRuntimeChunk(); } - return meta; + return null; } /** - * @param {any} thing any thing - * @returns {Object} metadata + * Sets the chunk with the entrypoint modules for an entrypoint. + * @param {Chunk} chunk the chunk being set as the entrypoint chunk. + * @returns {void} */ - getMetaIfExisting(thing) { - return this._metaMap.get(thing); + setEntrypointChunk(chunk) { + this._entrypointChunk = chunk; } /** - * @param {string=} cacheStage a persistent stage name for caching + * Returns the chunk which contains the entrypoint modules + * (or at least the execution of them) + * @returns {Chunk} chunk */ - freeze(cacheStage) { - this._cache = new WeakTupleMap(); - this._cacheStage = cacheStage; - } - - unfreeze() { - this._cache = undefined; - this._cacheStage = undefined; + getEntrypointChunk() { + return this._entrypointChunk; } /** - * @template {any[]} T - * @template V - * @param {(moduleGraph: ModuleGraph, ...args: T) => V} fn computer - * @param {T} args arguments - * @returns {V} computed value or cached + * @param {Chunk} oldChunk chunk to be replaced + * @param {Chunk} newChunk New chunk that will be replaced with + * @returns {boolean} returns true if the replacement was successful */ - cached(fn, ...args) { - if (this._cache === undefined) return fn(this, ...args); - return this._cache.provide(fn, ...args, () => fn(this, ...args)); + replaceChunk(oldChunk, newChunk) { + if (this._runtimeChunk === oldChunk) this._runtimeChunk = newChunk; + if (this._entrypointChunk === oldChunk) this._entrypointChunk = newChunk; + return super.replaceChunk(oldChunk, newChunk); } +} - /** - * @param {Map>} moduleMemCaches mem caches for modules for better caching - */ - setModuleMemCaches(moduleMemCaches) { - this._moduleMemCaches = moduleMemCaches; - } +module.exports = Entrypoint; - /** - * @param {Dependency} dependency dependency - * @param {...any} args arguments, last argument is a function called with moduleGraph, dependency, ...args - * @returns {any} computed value or cached - */ - dependencyCacheProvide(dependency, ...args) { - /** @type {(moduleGraph: ModuleGraph, dependency: Dependency, ...args: any[]) => any} */ - const fn = args.pop(); - if (this._moduleMemCaches && this._cacheStage) { - const memCache = this._moduleMemCaches.get( - this.getParentModule(dependency) - ); - if (memCache !== undefined) { - return memCache.provide(dependency, this._cacheStage, ...args, () => - fn(this, dependency, ...args) - ); - } + +/***/ }), + +/***/ 22070: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Authors Simen Brekken @simenbrekken, Einar Löve @einarlove +*/ + + + +const DefinePlugin = __webpack_require__(79065); +const WebpackError = __webpack_require__(53799); + +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./DefinePlugin").CodeValue} CodeValue */ + +class EnvironmentPlugin { + constructor(...keys) { + if (keys.length === 1 && Array.isArray(keys[0])) { + this.keys = keys[0]; + this.defaultValues = {}; + } else if (keys.length === 1 && keys[0] && typeof keys[0] === "object") { + this.keys = Object.keys(keys[0]); + this.defaultValues = keys[0]; + } else { + this.keys = keys; + this.defaultValues = {}; } - if (this._cache === undefined) return fn(this, dependency, ...args); - return this._cache.provide(dependency, ...args, () => - fn(this, dependency, ...args) - ); } - // TODO remove in webpack 6 /** - * @param {Module} module the module - * @param {string} deprecateMessage message for the deprecation message - * @param {string} deprecationCode code for the deprecation - * @returns {ModuleGraph} the module graph + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - static getModuleGraphForModule(module, deprecateMessage, deprecationCode) { - const fn = deprecateMap.get(deprecateMessage); - if (fn) return fn(module); - const newFn = util.deprecate( - /** - * @param {Module} module the module - * @returns {ModuleGraph} the module graph - */ - module => { - const moduleGraph = moduleGraphForModuleMap.get(module); - if (!moduleGraph) - throw new Error( - deprecateMessage + - "There was no ModuleGraph assigned to the Module for backward-compat (Use the new API)" + apply(compiler) { + /** @type {Record} */ + const definitions = {}; + for (const key of this.keys) { + const value = + process.env[key] !== undefined + ? process.env[key] + : this.defaultValues[key]; + + if (value === undefined) { + compiler.hooks.thisCompilation.tap("EnvironmentPlugin", compilation => { + const error = new WebpackError( + `EnvironmentPlugin - ${key} environment variable is undefined.\n\n` + + "You can pass an object with default values to suppress this warning.\n" + + "See https://webpack.js.org/plugins/environment-plugin for example." ); - return moduleGraph; - }, - deprecateMessage + ": Use new ModuleGraph API", - deprecationCode - ); - deprecateMap.set(deprecateMessage, newFn); - return newFn(module); - } - // TODO remove in webpack 6 - /** - * @param {Module} module the module - * @param {ModuleGraph} moduleGraph the module graph - * @returns {void} - */ - static setModuleGraphForModule(module, moduleGraph) { - moduleGraphForModuleMap.set(module, moduleGraph); - } + error.name = "EnvVariableNotDefinedError"; + compilation.errors.push(error); + }); + } - // TODO remove in webpack 6 - /** - * @param {Module} module the module - * @returns {void} - */ - static clearModuleGraphForModule(module) { - moduleGraphForModuleMap.delete(module); + definitions[`process.env.${key}`] = + value === undefined ? "undefined" : JSON.stringify(value); + } + + new DefinePlugin(definitions).apply(compiler); } } -// TODO remove in webpack 6 -/** @type {WeakMap} */ -const moduleGraphForModuleMap = new WeakMap(); - -// TODO remove in webpack 6 -/** @type {Map ModuleGraph>} */ -const deprecateMap = new Map(); - -module.exports = ModuleGraph; -module.exports.ModuleGraphConnection = ModuleGraphConnection; +module.exports = EnvironmentPlugin; /***/ }), -/***/ 40639: -/***/ (function(module) { +/***/ 59985: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* @@ -46218,195 +41124,190 @@ module.exports.ModuleGraphConnection = ModuleGraphConnection; -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ +const loaderFlag = "LOADER_EXECUTION"; -/** - * Module itself is not connected, but transitive modules are connected transitively. - */ -const TRANSITIVE_ONLY = Symbol("transitive only"); +const webpackOptionsFlag = "WEBPACK_OPTIONS"; -/** - * While determining the active state, this flag is used to signal a circular connection. - */ -const CIRCULAR_CONNECTION = Symbol("circular connection"); +exports.cutOffByFlag = (stack, flag) => { + stack = stack.split("\n"); + for (let i = 0; i < stack.length; i++) { + if (stack[i].includes(flag)) { + stack.length = i; + } + } + return stack.join("\n"); +}; -/** @typedef {boolean | typeof TRANSITIVE_ONLY | typeof CIRCULAR_CONNECTION} ConnectionState */ +exports.cutOffLoaderExecution = stack => + exports.cutOffByFlag(stack, loaderFlag); -/** - * @param {ConnectionState} a first - * @param {ConnectionState} b second - * @returns {ConnectionState} merged - */ -const addConnectionStates = (a, b) => { - if (a === true || b === true) return true; - if (a === false) return b; - if (b === false) return a; - if (a === TRANSITIVE_ONLY) return b; - if (b === TRANSITIVE_ONLY) return a; - return a; -}; +exports.cutOffWebpackOptions = stack => + exports.cutOffByFlag(stack, webpackOptionsFlag); -/** - * @param {ConnectionState} a first - * @param {ConnectionState} b second - * @returns {ConnectionState} intersected - */ -const intersectConnectionStates = (a, b) => { - if (a === false || b === false) return false; - if (a === true) return b; - if (b === true) return a; - if (a === CIRCULAR_CONNECTION) return b; - if (b === CIRCULAR_CONNECTION) return a; - return a; +exports.cutOffMultilineMessage = (stack, message) => { + stack = stack.split("\n"); + message = message.split("\n"); + + const result = []; + + stack.forEach((line, idx) => { + if (!line.includes(message[idx])) result.push(line); + }); + + return result.join("\n"); }; -class ModuleGraphConnection { - /** - * @param {Module|null} originModule the referencing module - * @param {Dependency|null} dependency the referencing dependency - * @param {Module} module the referenced module - * @param {string=} explanation some extra detail - * @param {boolean=} weak the reference is weak - * @param {false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState=} condition condition for the connection - */ - constructor( - originModule, - dependency, - module, - explanation, - weak = false, - condition = undefined - ) { - this.originModule = originModule; - this.resolvedOriginModule = originModule; - this.dependency = dependency; - this.resolvedModule = module; - this.module = module; - this.weak = weak; - this.conditional = !!condition; - this._active = condition !== false; - /** @type {function(ModuleGraphConnection, RuntimeSpec): ConnectionState} */ - this.condition = condition || undefined; - /** @type {Set} */ - this.explanations = undefined; - if (explanation) { - this.explanations = new Set(); - this.explanations.add(explanation); - } +exports.cutOffMessage = (stack, message) => { + const nextLine = stack.indexOf("\n"); + if (nextLine === -1) { + return stack === message ? "" : stack; + } else { + const firstLine = stack.substr(0, nextLine); + return firstLine === message ? stack.substr(nextLine + 1) : stack; } +}; - clone() { - const clone = new ModuleGraphConnection( - this.resolvedOriginModule, - this.dependency, - this.resolvedModule, - undefined, - this.weak, - this.condition - ); - clone.originModule = this.originModule; - clone.module = this.module; - clone.conditional = this.conditional; - clone._active = this._active; - if (this.explanations) clone.explanations = new Set(this.explanations); - return clone; - } +exports.cleanUp = (stack, message) => { + stack = exports.cutOffLoaderExecution(stack); + stack = exports.cutOffMessage(stack, message); + return stack; +}; - /** - * @param {function(ModuleGraphConnection, RuntimeSpec): ConnectionState} condition condition for the connection - * @returns {void} - */ - addCondition(condition) { - if (this.conditional) { - const old = this.condition; - this.condition = (c, r) => - intersectConnectionStates(old(c, r), condition(c, r)); - } else if (this._active) { - this.conditional = true; - this.condition = condition; - } - } +exports.cleanUpWebpackOptions = (stack, message) => { + stack = exports.cutOffWebpackOptions(stack); + stack = exports.cutOffMultilineMessage(stack, message); + return stack; +}; - /** - * @param {string} explanation the explanation to add - * @returns {void} - */ - addExplanation(explanation) { - if (this.explanations === undefined) { - this.explanations = new Set(); - } - this.explanations.add(explanation); - } - get explanation() { - if (this.explanations === undefined) return ""; - return Array.from(this.explanations).join(" "); - } +/***/ }), - // TODO webpack 5 remove - get active() { - throw new Error("Use getActiveState instead"); - } +/***/ 65218: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true, if the connection is active - */ - isActive(runtime) { - if (!this.conditional) return this._active; - return this.condition(this, runtime) !== false; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true, if the connection is active - */ - isTargetActive(runtime) { - if (!this.conditional) return this._active; - return this.condition(this, runtime) === true; - } - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {ConnectionState} true: fully active, false: inactive, TRANSITIVE: direct module inactive, but transitive connection maybe active - */ - getActiveState(runtime) { - if (!this.conditional) return this._active; - return this.condition(this, runtime); + +const { ConcatSource, RawSource } = __webpack_require__(51255); +const ExternalModule = __webpack_require__(73071); +const ModuleFilenameHelpers = __webpack_require__(88821); +const RuntimeGlobals = __webpack_require__(16475); +const JavascriptModulesPlugin = __webpack_require__(89464); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("./Compiler")} Compiler */ + +/** @type {WeakMap} */ +const cache = new WeakMap(); + +const devtoolWarning = new RawSource(`/* + * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +`); + +class EvalDevToolModulePlugin { + constructor(options) { + this.namespace = options.namespace || ""; + this.sourceUrlComment = options.sourceUrlComment || "\n//# sourceURL=[url]"; + this.moduleFilenameTemplate = + options.moduleFilenameTemplate || + "webpack://[namespace]/[resourcePath]?[loaders]"; } /** - * @param {boolean} value active or not + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - setActive(value) { - this.conditional = false; - this._active = value; - } - - set active(value) { - throw new Error("Use setActive instead"); + apply(compiler) { + compiler.hooks.compilation.tap("EvalDevToolModulePlugin", compilation => { + const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); + hooks.renderModuleContent.tap( + "EvalDevToolModulePlugin", + (source, module, { runtimeTemplate, chunkGraph }) => { + const cacheEntry = cache.get(source); + if (cacheEntry !== undefined) return cacheEntry; + if (module instanceof ExternalModule) { + cache.set(source, source); + return source; + } + const content = source.source(); + const str = ModuleFilenameHelpers.createFilename( + module, + { + moduleFilenameTemplate: this.moduleFilenameTemplate, + namespace: this.namespace + }, + { + requestShortener: runtimeTemplate.requestShortener, + chunkGraph, + hashFunction: compilation.outputOptions.hashFunction + } + ); + const footer = + "\n" + + this.sourceUrlComment.replace( + /\[url\]/g, + encodeURI(str) + .replace(/%2F/g, "/") + .replace(/%20/g, "_") + .replace(/%5E/g, "^") + .replace(/%5C/g, "\\") + .replace(/^\//, "") + ); + const result = new RawSource( + `eval(${ + compilation.outputOptions.trustedTypes + ? `${RuntimeGlobals.createScript}(${JSON.stringify( + content + footer + )})` + : JSON.stringify(content + footer) + });` + ); + cache.set(source, result); + return result; + } + ); + hooks.inlineInRuntimeBailout.tap( + "EvalDevToolModulePlugin", + () => "the eval devtool is used." + ); + hooks.render.tap( + "EvalDevToolModulePlugin", + source => new ConcatSource(devtoolWarning, source) + ); + hooks.chunkHash.tap("EvalDevToolModulePlugin", (chunk, hash) => { + hash.update("EvalDevToolModulePlugin"); + hash.update("2"); + }); + if (compilation.outputOptions.trustedTypes) { + compilation.hooks.additionalModuleRuntimeRequirements.tap( + "EvalDevToolModulePlugin", + (module, set, context) => { + set.add(RuntimeGlobals.createScript); + } + ); + } + }); } } -/** @typedef {typeof TRANSITIVE_ONLY} TRANSITIVE_ONLY */ -/** @typedef {typeof CIRCULAR_CONNECTION} CIRCULAR_CONNECTION */ - -module.exports = ModuleGraphConnection; -module.exports.addConnectionStates = addConnectionStates; -module.exports.TRANSITIVE_ONLY = /** @type {typeof TRANSITIVE_ONLY} */ ( - TRANSITIVE_ONLY -); -module.exports.CIRCULAR_CONNECTION = /** @type {typeof CIRCULAR_CONNECTION} */ ( - CIRCULAR_CONNECTION -); +module.exports = EvalDevToolModulePlugin; /***/ }), -/***/ 3454: +/***/ 14790: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -46417,259 +41318,210 @@ module.exports.CIRCULAR_CONNECTION = /** @type {typeof CIRCULAR_CONNECTION} */ ( -const { ConcatSource, RawSource, CachedSource } = __webpack_require__(51255); -const { UsageState } = __webpack_require__(63686); -const Template = __webpack_require__(1626); +const { ConcatSource, RawSource } = __webpack_require__(51255); +const ModuleFilenameHelpers = __webpack_require__(88821); +const NormalModule = __webpack_require__(39); +const RuntimeGlobals = __webpack_require__(16475); +const SourceMapDevToolModuleOptionsPlugin = __webpack_require__(97513); const JavascriptModulesPlugin = __webpack_require__(89464); +const ConcatenatedModule = __webpack_require__(97198); +const { makePathsAbsolute } = __webpack_require__(82186); /** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").DevTool} DevToolOptions */ +/** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */ /** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./ExportsInfo")} ExportsInfo */ -/** @typedef {import("./ExportsInfo").ExportInfo} ExportInfo */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./ModuleTemplate")} ModuleTemplate */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -const joinIterableWithComma = iterable => { - // This is more performant than Array.from().join(", ") - // as it doesn't create an array - let str = ""; - let first = true; - for (const item of iterable) { - if (first) { - first = false; - } else { - str += ", "; - } - str += item; - } - return str; -}; +/** @type {WeakMap} */ +const cache = new WeakMap(); -/** - * @param {ConcatSource} source output - * @param {string} indent spacing - * @param {ExportsInfo} exportsInfo data - * @param {ModuleGraph} moduleGraph moduleGraph - * @param {RequestShortener} requestShortener requestShortener - * @param {Set} alreadyPrinted deduplication set - * @returns {void} +const devtoolWarning = new RawSource(`/* + * ATTENTION: An "eval-source-map" devtool has been used. + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). */ -const printExportsInfoToSource = ( - source, - indent, - exportsInfo, - moduleGraph, - requestShortener, - alreadyPrinted = new Set() -) => { - const otherExportsInfo = exportsInfo.otherExportsInfo; - - let alreadyPrintedExports = 0; +`); - // determine exports to print - const printedExports = []; - for (const exportInfo of exportsInfo.orderedExports) { - if (!alreadyPrinted.has(exportInfo)) { - alreadyPrinted.add(exportInfo); - printedExports.push(exportInfo); +class EvalSourceMapDevToolPlugin { + /** + * @param {SourceMapDevToolPluginOptions|string} inputOptions Options object + */ + constructor(inputOptions) { + /** @type {SourceMapDevToolPluginOptions} */ + let options; + if (typeof inputOptions === "string") { + options = { + append: inputOptions + }; } else { - alreadyPrintedExports++; - } - } - let showOtherExports = false; - if (!alreadyPrinted.has(otherExportsInfo)) { - alreadyPrinted.add(otherExportsInfo); - showOtherExports = true; - } else { - alreadyPrintedExports++; - } - - // print the exports - for (const exportInfo of printedExports) { - const target = exportInfo.getTarget(moduleGraph); - source.add( - Template.toComment( - `${indent}export ${JSON.stringify(exportInfo.name).slice( - 1, - -1 - )} [${exportInfo.getProvidedInfo()}] [${exportInfo.getUsedInfo()}] [${exportInfo.getRenameInfo()}]${ - target - ? ` -> ${target.module.readableIdentifier(requestShortener)}${ - target.export - ? ` .${target.export - .map(e => JSON.stringify(e).slice(1, -1)) - .join(".")}` - : "" - }` - : "" - }` - ) + "\n" - ); - if (exportInfo.exportsInfo) { - printExportsInfoToSource( - source, - indent + " ", - exportInfo.exportsInfo, - moduleGraph, - requestShortener, - alreadyPrinted - ); - } - } - - if (alreadyPrintedExports) { - source.add( - Template.toComment( - `${indent}... (${alreadyPrintedExports} already listed exports)` - ) + "\n" - ); - } - - if (showOtherExports) { - const target = otherExportsInfo.getTarget(moduleGraph); - if ( - target || - otherExportsInfo.provided !== false || - otherExportsInfo.getUsed(undefined) !== UsageState.Unused - ) { - const title = - printedExports.length > 0 || alreadyPrintedExports > 0 - ? "other exports" - : "exports"; - source.add( - Template.toComment( - `${indent}${title} [${otherExportsInfo.getProvidedInfo()}] [${otherExportsInfo.getUsedInfo()}]${ - target - ? ` -> ${target.module.readableIdentifier(requestShortener)}` - : "" - }` - ) + "\n" - ); + options = inputOptions; } + this.sourceMapComment = + options.append || "//# sourceURL=[module]\n//# sourceMappingURL=[url]"; + this.moduleFilenameTemplate = + options.moduleFilenameTemplate || + "webpack://[namespace]/[resource-path]?[hash]"; + this.namespace = options.namespace || ""; + this.options = options; } -}; - -/** @type {WeakMap }>>} */ -const caches = new WeakMap(); -class ModuleInfoHeaderPlugin { - /** - * @param {boolean=} verbose add more information like exports, runtime requirements and bailouts - */ - constructor(verbose = true) { - this._verbose = verbose; - } /** - * @param {Compiler} compiler the compiler + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { - const { _verbose: verbose } = this; - compiler.hooks.compilation.tap("ModuleInfoHeaderPlugin", compilation => { - const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); - hooks.renderModulePackage.tap( - "ModuleInfoHeaderPlugin", - ( - moduleSource, - module, - { chunk, chunkGraph, moduleGraph, runtimeTemplate } - ) => { - const { requestShortener } = runtimeTemplate; - let cacheEntry; - let cache = caches.get(requestShortener); - if (cache === undefined) { - caches.set(requestShortener, (cache = new WeakMap())); - cache.set( - module, - (cacheEntry = { header: undefined, full: new WeakMap() }) - ); - } else { - cacheEntry = cache.get(module); - if (cacheEntry === undefined) { - cache.set( - module, - (cacheEntry = { header: undefined, full: new WeakMap() }) - ); - } else if (!verbose) { - const cachedSource = cacheEntry.full.get(moduleSource); - if (cachedSource !== undefined) return cachedSource; - } - } - const source = new ConcatSource(); - let header = cacheEntry.header; - if (header === undefined) { - const req = module.readableIdentifier(requestShortener); - const reqStr = req.replace(/\*\//g, "*_/"); - const reqStrStar = "*".repeat(reqStr.length); - const headerStr = `/*!****${reqStrStar}****!*\\\n !*** ${reqStr} ***!\n \\****${reqStrStar}****/\n`; - header = new RawSource(headerStr); - cacheEntry.header = header; - } - source.add(header); - if (verbose) { - const exportsType = module.buildMeta.exportsType; - source.add( - Template.toComment( - exportsType - ? `${exportsType} exports` - : "unknown exports (runtime-defined)" - ) + "\n" - ); - if (exportsType) { - const exportsInfo = moduleGraph.getExportsInfo(module); - printExportsInfoToSource( - source, - "", - exportsInfo, - moduleGraph, - requestShortener - ); + const options = this.options; + compiler.hooks.compilation.tap( + "EvalSourceMapDevToolPlugin", + compilation => { + const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); + new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation); + const matchModule = ModuleFilenameHelpers.matchObject.bind( + ModuleFilenameHelpers, + options + ); + hooks.renderModuleContent.tap( + "EvalSourceMapDevToolPlugin", + (source, m, { runtimeTemplate, chunkGraph }) => { + const cachedSource = cache.get(source); + if (cachedSource !== undefined) { + return cachedSource; } - source.add( - Template.toComment( - `runtime requirements: ${joinIterableWithComma( - chunkGraph.getModuleRuntimeRequirements(module, chunk.runtime) - )}` - ) + "\n" - ); - const optimizationBailout = - moduleGraph.getOptimizationBailout(module); - if (optimizationBailout) { - for (const text of optimizationBailout) { - let code; - if (typeof text === "function") { - code = text(requestShortener); - } else { - code = text; + + const result = r => { + cache.set(source, r); + return r; + }; + + if (m instanceof NormalModule) { + const module = /** @type {NormalModule} */ (m); + if (!matchModule(module.resource)) { + return result(source); + } + } else if (m instanceof ConcatenatedModule) { + const concatModule = /** @type {ConcatenatedModule} */ (m); + if (concatModule.rootModule instanceof NormalModule) { + const module = /** @type {NormalModule} */ ( + concatModule.rootModule + ); + if (!matchModule(module.resource)) { + return result(source); } - source.add(Template.toComment(`${code}`) + "\n"); + } else { + return result(source); } + } else { + return result(source); } - source.add(moduleSource); - return source; - } else { - source.add(moduleSource); - const cachedSource = new CachedSource(source); - cacheEntry.full.set(moduleSource, cachedSource); - return cachedSource; + + /** @type {{ [key: string]: TODO; }} */ + let sourceMap; + let content; + if (source.sourceAndMap) { + const sourceAndMap = source.sourceAndMap(options); + sourceMap = sourceAndMap.map; + content = sourceAndMap.source; + } else { + sourceMap = source.map(options); + content = source.source(); + } + if (!sourceMap) { + return result(source); + } + + // Clone (flat) the sourcemap to ensure that the mutations below do not persist. + sourceMap = { ...sourceMap }; + const context = compiler.options.context; + const root = compiler.root; + const modules = sourceMap.sources.map(source => { + if (!source.startsWith("webpack://")) return source; + source = makePathsAbsolute(context, source.slice(10), root); + const module = compilation.findModule(source); + return module || source; + }); + let moduleFilenames = modules.map(module => { + return ModuleFilenameHelpers.createFilename( + module, + { + moduleFilenameTemplate: this.moduleFilenameTemplate, + namespace: this.namespace + }, + { + requestShortener: runtimeTemplate.requestShortener, + chunkGraph, + hashFunction: compilation.outputOptions.hashFunction + } + ); + }); + moduleFilenames = ModuleFilenameHelpers.replaceDuplicates( + moduleFilenames, + (filename, i, n) => { + for (let j = 0; j < n; j++) filename += "*"; + return filename; + } + ); + sourceMap.sources = moduleFilenames; + sourceMap.sourceRoot = options.sourceRoot || ""; + const moduleId = chunkGraph.getModuleId(m); + sourceMap.file = `${moduleId}.js`; + + const footer = + this.sourceMapComment.replace( + /\[url\]/g, + `data:application/json;charset=utf-8;base64,${Buffer.from( + JSON.stringify(sourceMap), + "utf8" + ).toString("base64")}` + ) + `\n//# sourceURL=webpack-internal:///${moduleId}\n`; // workaround for chrome bug + + return result( + new RawSource( + `eval(${ + compilation.outputOptions.trustedTypes + ? `${RuntimeGlobals.createScript}(${JSON.stringify( + content + footer + )})` + : JSON.stringify(content + footer) + });` + ) + ); } + ); + hooks.inlineInRuntimeBailout.tap( + "EvalDevToolModulePlugin", + () => "the eval-source-map devtool is used." + ); + hooks.render.tap( + "EvalSourceMapDevToolPlugin", + source => new ConcatSource(devtoolWarning, source) + ); + hooks.chunkHash.tap("EvalSourceMapDevToolPlugin", (chunk, hash) => { + hash.update("EvalSourceMapDevToolPlugin"); + hash.update("2"); + }); + if (compilation.outputOptions.trustedTypes) { + compilation.hooks.additionalModuleRuntimeRequirements.tap( + "EvalSourceMapDevToolPlugin", + (module, set, context) => { + set.add(RuntimeGlobals.createScript); + } + ); } - ); - hooks.chunkHash.tap("ModuleInfoHeaderPlugin", (chunk, hash) => { - hash.update("ModuleInfoHeaderPlugin"); - hash.update("1"); - }); - }); + } + ); } } -module.exports = ModuleInfoHeaderPlugin; + +module.exports = EvalSourceMapDevToolPlugin; /***/ }), -/***/ 32882: +/***/ 63686: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -46680,1598 +41532,1527 @@ module.exports = ModuleInfoHeaderPlugin; -const WebpackError = __webpack_require__(53799); +const { equals } = __webpack_require__(84953); +const SortableSet = __webpack_require__(13098); +const makeSerializable = __webpack_require__(33032); +const { forEachRuntime } = __webpack_require__(17156); -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Dependency").RuntimeSpec} RuntimeSpec */ /** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("./util/Hash")} Hash */ -const previouslyPolyfilledBuiltinModules = { - assert: "assert/", - buffer: "buffer/", - console: "console-browserify", - constants: "constants-browserify", - crypto: "crypto-browserify", - domain: "domain-browser", - events: "events/", - http: "stream-http", - https: "https-browserify", - os: "os-browserify/browser", - path: "path-browserify", - punycode: "punycode/", - process: "process/browser", - querystring: "querystring-es3", - stream: "stream-browserify", - _stream_duplex: "readable-stream/duplex", - _stream_passthrough: "readable-stream/passthrough", - _stream_readable: "readable-stream/readable", - _stream_transform: "readable-stream/transform", - _stream_writable: "readable-stream/writable", - string_decoder: "string_decoder/", - sys: "util/", - timers: "timers-browserify", - tty: "tty-browserify", - url: "url/", - util: "util/", - vm: "vm-browserify", - zlib: "browserify-zlib" -}; +/** @typedef {typeof UsageState.OnlyPropertiesUsed | typeof UsageState.NoInfo | typeof UsageState.Unknown | typeof UsageState.Used} RuntimeUsageStateType */ +/** @typedef {typeof UsageState.Unused | RuntimeUsageStateType} UsageStateType */ -class ModuleNotFoundError extends WebpackError { - /** - * @param {Module} module module tied to dependency - * @param {Error&any} err error thrown - * @param {DependencyLocation} loc location of dependency - */ - constructor(module, err, loc) { - let message = `Module not found: ${err.toString()}`; +const UsageState = Object.freeze({ + Unused: /** @type {0} */ (0), + OnlyPropertiesUsed: /** @type {1} */ (1), + NoInfo: /** @type {2} */ (2), + Unknown: /** @type {3} */ (3), + Used: /** @type {4} */ (4) +}); - // TODO remove in webpack 6 - const match = err.message.match(/Can't resolve '([^']+)'/); - if (match) { - const request = match[1]; - const alias = previouslyPolyfilledBuiltinModules[request]; - if (alias) { - const pathIndex = alias.indexOf("/"); - const dependency = pathIndex > 0 ? alias.slice(0, pathIndex) : alias; - message += - "\n\n" + - "BREAKING CHANGE: " + - "webpack < 5 used to include polyfills for node.js core modules by default.\n" + - "This is no longer the case. Verify if you need this module and configure a polyfill for it.\n\n"; - message += - "If you want to include a polyfill, you need to:\n" + - `\t- add a fallback 'resolve.fallback: { "${request}": require.resolve("${alias}") }'\n` + - `\t- install '${dependency}'\n`; - message += - "If you don't want to include a polyfill, you can use an empty module like this:\n" + - `\tresolve.fallback: { "${request}": false }`; - } - } +const RETURNS_TRUE = () => true; - super(message); +const CIRCULAR = Symbol("circular target"); - this.name = "ModuleNotFoundError"; - this.details = err.details; - this.module = module; - this.error = err; - this.loc = loc; +class RestoreProvidedData { + constructor( + exports, + otherProvided, + otherCanMangleProvide, + otherTerminalBinding + ) { + this.exports = exports; + this.otherProvided = otherProvided; + this.otherCanMangleProvide = otherCanMangleProvide; + this.otherTerminalBinding = otherTerminalBinding; } -} - -module.exports = ModuleNotFoundError; - - -/***/ }), -/***/ 58443: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + serialize({ write }) { + write(this.exports); + write(this.otherProvided); + write(this.otherCanMangleProvide); + write(this.otherTerminalBinding); + } + static deserialize({ read }) { + return new RestoreProvidedData(read(), read(), read(), read()); + } +} +makeSerializable( + RestoreProvidedData, + "webpack/lib/ModuleGraph", + "RestoreProvidedData" +); -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); +class ExportsInfo { + constructor() { + /** @type {Map} */ + this._exports = new Map(); + this._otherExportsInfo = new ExportInfo(null); + this._sideEffectsOnlyInfo = new ExportInfo("*side effects only*"); + this._exportsAreOrdered = false; + /** @type {ExportsInfo=} */ + this._redirectTo = undefined; + } -const WASM_HEADER = Buffer.from([0x00, 0x61, 0x73, 0x6d]); + /** + * @returns {Iterable} all owned exports in any order + */ + get ownedExports() { + return this._exports.values(); + } -class ModuleParseError extends WebpackError { /** - * @param {string | Buffer} source source code - * @param {Error&any} err the parse error - * @param {string[]} loaders the loaders used - * @param {string} type module type + * @returns {Iterable} all owned exports in order */ - constructor(source, err, loaders, type) { - let message = "Module parse failed: " + (err && err.message); - let loc = undefined; - - if ( - ((Buffer.isBuffer(source) && source.slice(0, 4).equals(WASM_HEADER)) || - (typeof source === "string" && /^\0asm/.test(source))) && - !type.startsWith("webassembly") - ) { - message += - "\nThe module seem to be a WebAssembly module, but module is not flagged as WebAssembly module for webpack."; - message += - "\nBREAKING CHANGE: Since webpack 5 WebAssembly is not enabled by default and flagged as experimental feature."; - message += - "\nYou need to enable one of the WebAssembly experiments via 'experiments.asyncWebAssembly: true' (based on async modules) or 'experiments.syncWebAssembly: true' (like webpack 4, deprecated)."; - message += - "\nFor files that transpile to WebAssembly, make sure to set the module type in the 'module.rules' section of the config (e. g. 'type: \"webassembly/async\"')."; - } else if (!loaders) { - message += - "\nYou may need an appropriate loader to handle this file type."; - } else if (loaders.length >= 1) { - message += `\nFile was processed with these loaders:${loaders - .map(loader => `\n * ${loader}`) - .join("")}`; - message += - "\nYou may need an additional loader to handle the result of these loaders."; - } else { - message += - "\nYou may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders"; + get orderedOwnedExports() { + if (!this._exportsAreOrdered) { + this._sortExports(); } + return this._exports.values(); + } - if ( - err && - err.loc && - typeof err.loc === "object" && - typeof err.loc.line === "number" - ) { - var lineNumber = err.loc.line; - - if ( - Buffer.isBuffer(source) || - /[\0\u0001\u0002\u0003\u0004\u0005\u0006\u0007]/.test(source) - ) { - // binary file - message += "\n(Source code omitted for this binary file)"; - } else { - const sourceLines = source.split(/\r?\n/); - const start = Math.max(0, lineNumber - 3); - const linesBefore = sourceLines.slice(start, lineNumber - 1); - const theLine = sourceLines[lineNumber - 1]; - const linesAfter = sourceLines.slice(lineNumber, lineNumber + 2); - - message += - linesBefore.map(l => `\n| ${l}`).join("") + - `\n> ${theLine}` + - linesAfter.map(l => `\n| ${l}`).join(""); + /** + * @returns {Iterable} all exports in any order + */ + get exports() { + if (this._redirectTo !== undefined) { + const map = new Map(this._redirectTo._exports); + for (const [key, value] of this._exports) { + map.set(key, value); } - - loc = { start: err.loc }; - } else if (err && err.stack) { - message += "\n" + err.stack; + return map.values(); } - - super(message); - - this.name = "ModuleParseError"; - this.loc = loc; - this.error = err; - } - - serialize(context) { - const { write } = context; - - write(this.error); - - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - - this.error = read(); - - super.deserialize(context); + return this._exports.values(); } -} - -makeSerializable(ModuleParseError, "webpack/lib/ModuleParseError"); - -module.exports = ModuleParseError; - - -/***/ }), - -/***/ 36418: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -class ModuleProfile { - constructor() { - this.startTime = Date.now(); - - this.factoryStartTime = 0; - this.factoryEndTime = 0; - this.factory = 0; - this.factoryParallelismFactor = 0; - - this.restoringStartTime = 0; - this.restoringEndTime = 0; - this.restoring = 0; - this.restoringParallelismFactor = 0; - this.integrationStartTime = 0; - this.integrationEndTime = 0; - this.integration = 0; - this.integrationParallelismFactor = 0; - - this.buildingStartTime = 0; - this.buildingEndTime = 0; - this.building = 0; - this.buildingParallelismFactor = 0; - - this.storingStartTime = 0; - this.storingEndTime = 0; - this.storing = 0; - this.storingParallelismFactor = 0; - - this.additionalFactoryTimes = undefined; - this.additionalFactories = 0; - this.additionalFactoriesParallelismFactor = 0; - - /** @deprecated */ - this.additionalIntegration = 0; + /** + * @returns {Iterable} all exports in order + */ + get orderedExports() { + if (!this._exportsAreOrdered) { + this._sortExports(); + } + if (this._redirectTo !== undefined) { + const map = new Map( + Array.from(this._redirectTo.orderedExports, item => [item.name, item]) + ); + for (const [key, value] of this._exports) { + map.set(key, value); + } + // sorting should be pretty fast as map contains + // a lot of presorted items + this._sortExportsMap(map); + return map.values(); + } + return this._exports.values(); } - markFactoryStart() { - this.factoryStartTime = Date.now(); + /** + * @returns {ExportInfo} the export info of unlisted exports + */ + get otherExportsInfo() { + if (this._redirectTo !== undefined) + return this._redirectTo.otherExportsInfo; + return this._otherExportsInfo; } - markFactoryEnd() { - this.factoryEndTime = Date.now(); - this.factory = this.factoryEndTime - this.factoryStartTime; + _sortExportsMap(exports) { + if (exports.size > 1) { + const namesInOrder = []; + for (const entry of exports.values()) { + namesInOrder.push(entry.name); + } + namesInOrder.sort(); + let i = 0; + for (const entry of exports.values()) { + const name = namesInOrder[i]; + if (entry.name !== name) break; + i++; + } + for (; i < namesInOrder.length; i++) { + const name = namesInOrder[i]; + const correctEntry = exports.get(name); + exports.delete(name); + exports.set(name, correctEntry); + } + } } - markRestoringStart() { - this.restoringStartTime = Date.now(); + _sortExports() { + this._sortExportsMap(this._exports); + this._exportsAreOrdered = true; } - markRestoringEnd() { - this.restoringEndTime = Date.now(); - this.restoring = this.restoringEndTime - this.restoringStartTime; + setRedirectNamedTo(exportsInfo) { + if (this._redirectTo === exportsInfo) return false; + this._redirectTo = exportsInfo; + return true; } - markIntegrationStart() { - this.integrationStartTime = Date.now(); + setHasProvideInfo() { + for (const exportInfo of this._exports.values()) { + if (exportInfo.provided === undefined) { + exportInfo.provided = false; + } + if (exportInfo.canMangleProvide === undefined) { + exportInfo.canMangleProvide = true; + } + } + if (this._redirectTo !== undefined) { + this._redirectTo.setHasProvideInfo(); + } else { + if (this._otherExportsInfo.provided === undefined) { + this._otherExportsInfo.provided = false; + } + if (this._otherExportsInfo.canMangleProvide === undefined) { + this._otherExportsInfo.canMangleProvide = true; + } + } } - markIntegrationEnd() { - this.integrationEndTime = Date.now(); - this.integration = this.integrationEndTime - this.integrationStartTime; + setHasUseInfo() { + for (const exportInfo of this._exports.values()) { + exportInfo.setHasUseInfo(); + } + this._sideEffectsOnlyInfo.setHasUseInfo(); + if (this._redirectTo !== undefined) { + this._redirectTo.setHasUseInfo(); + } else { + this._otherExportsInfo.setHasUseInfo(); + if (this._otherExportsInfo.canMangleUse === undefined) { + this._otherExportsInfo.canMangleUse = true; + } + } } - markBuildingStart() { - this.buildingStartTime = Date.now(); + /** + * @param {string} name export name + * @returns {ExportInfo} export info for this name + */ + getOwnExportInfo(name) { + const info = this._exports.get(name); + if (info !== undefined) return info; + const newInfo = new ExportInfo(name, this._otherExportsInfo); + this._exports.set(name, newInfo); + this._exportsAreOrdered = false; + return newInfo; } - markBuildingEnd() { - this.buildingEndTime = Date.now(); - this.building = this.buildingEndTime - this.buildingStartTime; + /** + * @param {string} name export name + * @returns {ExportInfo} export info for this name + */ + getExportInfo(name) { + const info = this._exports.get(name); + if (info !== undefined) return info; + if (this._redirectTo !== undefined) + return this._redirectTo.getExportInfo(name); + const newInfo = new ExportInfo(name, this._otherExportsInfo); + this._exports.set(name, newInfo); + this._exportsAreOrdered = false; + return newInfo; } - markStoringStart() { - this.storingStartTime = Date.now(); + /** + * @param {string} name export name + * @returns {ExportInfo} export info for this name + */ + getReadOnlyExportInfo(name) { + const info = this._exports.get(name); + if (info !== undefined) return info; + if (this._redirectTo !== undefined) + return this._redirectTo.getReadOnlyExportInfo(name); + return this._otherExportsInfo; } - markStoringEnd() { - this.storingEndTime = Date.now(); - this.storing = this.storingEndTime - this.storingStartTime; + /** + * @param {string[]} name export name + * @returns {ExportInfo | undefined} export info for this name + */ + getReadOnlyExportInfoRecursive(name) { + const exportInfo = this.getReadOnlyExportInfo(name[0]); + if (name.length === 1) return exportInfo; + if (!exportInfo.exportsInfo) return undefined; + return exportInfo.exportsInfo.getReadOnlyExportInfoRecursive(name.slice(1)); } - // This depends on timing so we ignore it for coverage - /* istanbul ignore next */ /** - * Merge this profile into another one - * @param {ModuleProfile} realProfile the profile to merge into - * @returns {void} + * @param {string[]=} name the export name + * @returns {ExportsInfo | undefined} the nested exports info */ - mergeInto(realProfile) { - realProfile.additionalFactories = this.factory; - (realProfile.additionalFactoryTimes = - realProfile.additionalFactoryTimes || []).push({ - start: this.factoryStartTime, - end: this.factoryEndTime - }); + getNestedExportsInfo(name) { + if (Array.isArray(name) && name.length > 0) { + const info = this.getReadOnlyExportInfo(name[0]); + if (!info.exportsInfo) return undefined; + return info.exportsInfo.getNestedExportsInfo(name.slice(1)); + } + return this; } -} - -module.exports = ModuleProfile; - - -/***/ }), - -/***/ 94560: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const WebpackError = __webpack_require__(53799); - -/** @typedef {import("./Module")} Module */ -class ModuleRestoreError extends WebpackError { /** - * @param {Module} module module tied to dependency - * @param {string | Error} err error thrown + * @param {boolean=} canMangle true, if exports can still be mangled (defaults to false) + * @param {Set=} excludeExports list of unaffected exports + * @param {any=} targetKey use this as key for the target + * @param {ModuleGraphConnection=} targetModule set this module as target + * @param {number=} priority priority + * @returns {boolean} true, if this call changed something */ - constructor(module, err) { - let message = "Module restore failed: "; - let details = undefined; - if (err !== null && typeof err === "object") { - if (typeof err.stack === "string" && err.stack) { - const stack = err.stack; - message += stack; - } else if (typeof err.message === "string" && err.message) { - message += err.message; - } else { - message += err; + setUnknownExportsProvided( + canMangle, + excludeExports, + targetKey, + targetModule, + priority + ) { + let changed = false; + if (excludeExports) { + for (const name of excludeExports) { + // Make sure these entries exist, so they can get different info + this.getExportInfo(name); + } + } + for (const exportInfo of this._exports.values()) { + if (!canMangle && exportInfo.canMangleProvide !== false) { + exportInfo.canMangleProvide = false; + changed = true; + } + if (excludeExports && excludeExports.has(exportInfo.name)) continue; + if (exportInfo.provided !== true && exportInfo.provided !== null) { + exportInfo.provided = null; + changed = true; + } + if (targetKey) { + exportInfo.setTarget(targetKey, targetModule, [exportInfo.name], -1); + } + } + if (this._redirectTo !== undefined) { + if ( + this._redirectTo.setUnknownExportsProvided( + canMangle, + excludeExports, + targetKey, + targetModule, + priority + ) + ) { + changed = true; } } else { - message += String(err); + if ( + this._otherExportsInfo.provided !== true && + this._otherExportsInfo.provided !== null + ) { + this._otherExportsInfo.provided = null; + changed = true; + } + if (!canMangle && this._otherExportsInfo.canMangleProvide !== false) { + this._otherExportsInfo.canMangleProvide = false; + changed = true; + } + if (targetKey) { + this._otherExportsInfo.setTarget( + targetKey, + targetModule, + undefined, + priority + ); + } } - - super(message); - - this.name = "ModuleRestoreError"; - this.details = details; - this.module = module; - this.error = err; + return changed; } -} - -module.exports = ModuleRestoreError; - - -/***/ }), - -/***/ 59001: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const WebpackError = __webpack_require__(53799); - -/** @typedef {import("./Module")} Module */ - -class ModuleStoreError extends WebpackError { /** - * @param {Module} module module tied to dependency - * @param {string | Error} err error thrown + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true, when something changed */ - constructor(module, err) { - let message = "Module storing failed: "; - let details = undefined; - if (err !== null && typeof err === "object") { - if (typeof err.stack === "string" && err.stack) { - const stack = err.stack; - message += stack; - } else if (typeof err.message === "string" && err.message) { - message += err.message; - } else { - message += err; + setUsedInUnknownWay(runtime) { + let changed = false; + for (const exportInfo of this._exports.values()) { + if (exportInfo.setUsedInUnknownWay(runtime)) { + changed = true; + } + } + if (this._redirectTo !== undefined) { + if (this._redirectTo.setUsedInUnknownWay(runtime)) { + changed = true; } } else { - message += String(err); + if ( + this._otherExportsInfo.setUsedConditionally( + used => used < UsageState.Unknown, + UsageState.Unknown, + runtime + ) + ) { + changed = true; + } + if (this._otherExportsInfo.canMangleUse !== false) { + this._otherExportsInfo.canMangleUse = false; + changed = true; + } } - - super(message); - - this.name = "ModuleStoreError"; - this.details = details; - this.module = module; - this.error = err; + return changed; } -} - -module.exports = ModuleStoreError; - -/***/ }), - -/***/ 62677: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const util = __webpack_require__(73837); -const memoize = __webpack_require__(78676); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./util/Hash")} Hash */ - -const getJavascriptModulesPlugin = memoize(() => - __webpack_require__(89464) -); - -// TODO webpack 6: remove this class -class ModuleTemplate { /** - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @param {Compilation} compilation the compilation + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true, when something changed */ - constructor(runtimeTemplate, compilation) { - this._runtimeTemplate = runtimeTemplate; - this.type = "javascript"; - this.hooks = Object.freeze({ - content: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .renderModuleContent.tap( - options, - (source, module, renderContext) => - fn( - source, - module, - renderContext, - renderContext.dependencyTemplates - ) - ); - }, - "ModuleTemplate.hooks.content is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModuleContent instead)", - "DEP_MODULE_TEMPLATE_CONTENT" - ) - }, - module: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .renderModuleContent.tap( - options, - (source, module, renderContext) => - fn( - source, - module, - renderContext, - renderContext.dependencyTemplates - ) - ); - }, - "ModuleTemplate.hooks.module is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModuleContent instead)", - "DEP_MODULE_TEMPLATE_MODULE" - ) - }, - render: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .renderModuleContainer.tap( - options, - (source, module, renderContext) => - fn( - source, - module, - renderContext, - renderContext.dependencyTemplates - ) - ); - }, - "ModuleTemplate.hooks.render is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModuleContainer instead)", - "DEP_MODULE_TEMPLATE_RENDER" - ) - }, - package: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .renderModulePackage.tap( - options, - (source, module, renderContext) => - fn( - source, - module, - renderContext, - renderContext.dependencyTemplates - ) - ); - }, - "ModuleTemplate.hooks.package is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModulePackage instead)", - "DEP_MODULE_TEMPLATE_PACKAGE" - ) - }, - hash: { - tap: util.deprecate( - (options, fn) => { - compilation.hooks.fullHash.tap(options, fn); - }, - "ModuleTemplate.hooks.hash is deprecated (use Compilation.hooks.fullHash instead)", - "DEP_MODULE_TEMPLATE_HASH" - ) + setUsedWithoutInfo(runtime) { + let changed = false; + for (const exportInfo of this._exports.values()) { + if (exportInfo.setUsedWithoutInfo(runtime)) { + changed = true; } - }); - } -} - -Object.defineProperty(ModuleTemplate.prototype, "runtimeTemplate", { - get: util.deprecate( - /** - * @this {ModuleTemplate} - * @returns {TODO} output options - */ - function () { - return this._runtimeTemplate; - }, - "ModuleTemplate.runtimeTemplate is deprecated (use Compilation.runtimeTemplate instead)", - "DEP_WEBPACK_CHUNK_TEMPLATE_OUTPUT_OPTIONS" - ) -}); - -module.exports = ModuleTemplate; - - -/***/ }), - -/***/ 11234: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { cleanUp } = __webpack_require__(59985); -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); - -class ModuleWarning extends WebpackError { - /** - * @param {Error} warning error thrown - * @param {{from?: string|null}} info additional info - */ - constructor(warning, { from = null } = {}) { - let message = "Module Warning"; - - if (from) { - message += ` (from ${from}):\n`; - } else { - message += ": "; } - - if (warning && typeof warning === "object" && warning.message) { - message += warning.message; - } else if (warning) { - message += String(warning); + if (this._redirectTo !== undefined) { + if (this._redirectTo.setUsedWithoutInfo(runtime)) { + changed = true; + } + } else { + if (this._otherExportsInfo.setUsed(UsageState.NoInfo, runtime)) { + changed = true; + } + if (this._otherExportsInfo.canMangleUse !== false) { + this._otherExportsInfo.canMangleUse = false; + changed = true; + } } - - super(message); - - this.name = "ModuleWarning"; - this.warning = warning; - this.details = - warning && typeof warning === "object" && warning.stack - ? cleanUp(warning.stack, this.message) - : undefined; - } - - serialize(context) { - const { write } = context; - - write(this.warning); - - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - - this.warning = read(); - - super.deserialize(context); + return changed; } -} - -makeSerializable(ModuleWarning, "webpack/lib/ModuleWarning"); - -module.exports = ModuleWarning; - - -/***/ }), - -/***/ 33370: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const asyncLib = __webpack_require__(78175); -const { SyncHook, MultiHook } = __webpack_require__(6967); - -const ConcurrentCompilationError = __webpack_require__(95735); -const MultiStats = __webpack_require__(24170); -const MultiWatching = __webpack_require__(81128); -const ArrayQueue = __webpack_require__(41792); - -/** @template T @typedef {import("tapable").AsyncSeriesHook} AsyncSeriesHook */ -/** @template T @template R @typedef {import("tapable").SyncBailHook} SyncBailHook */ -/** @typedef {import("../declarations/WebpackOptions").WatchOptions} WatchOptions */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Stats")} Stats */ -/** @typedef {import("./Watching")} Watching */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ -/** @typedef {import("./util/fs").IntermediateFileSystem} IntermediateFileSystem */ -/** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */ -/** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */ -/** - * @template T - * @callback Callback - * @param {(Error | null)=} err - * @param {T=} result - */ - -/** - * @callback RunWithDependenciesHandler - * @param {Compiler} compiler - * @param {Callback} callback - */ - -/** - * @typedef {Object} MultiCompilerOptions - * @property {number=} parallelism how many Compilers are allows to run at the same time in parallel - */ - -module.exports = class MultiCompiler { /** - * @param {Compiler[] | Record} compilers child compilers - * @param {MultiCompilerOptions} options options + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true, when something changed */ - constructor(compilers, options) { - if (!Array.isArray(compilers)) { - compilers = Object.keys(compilers).map(name => { - compilers[name].name = name; - return compilers[name]; - }); - } - - this.hooks = Object.freeze({ - /** @type {SyncHook<[MultiStats]>} */ - done: new SyncHook(["stats"]), - /** @type {MultiHook>} */ - invalid: new MultiHook(compilers.map(c => c.hooks.invalid)), - /** @type {MultiHook>} */ - run: new MultiHook(compilers.map(c => c.hooks.run)), - /** @type {SyncHook<[]>} */ - watchClose: new SyncHook([]), - /** @type {MultiHook>} */ - watchRun: new MultiHook(compilers.map(c => c.hooks.watchRun)), - /** @type {MultiHook>} */ - infrastructureLog: new MultiHook( - compilers.map(c => c.hooks.infrastructureLog) - ) - }); - this.compilers = compilers; - /** @type {MultiCompilerOptions} */ - this._options = { - parallelism: options.parallelism || Infinity - }; - /** @type {WeakMap} */ - this.dependencies = new WeakMap(); - this.running = false; - - /** @type {Stats[]} */ - const compilerStats = this.compilers.map(() => null); - let doneCompilers = 0; - for (let index = 0; index < this.compilers.length; index++) { - const compiler = this.compilers[index]; - const compilerIndex = index; - let compilerDone = false; - compiler.hooks.done.tap("MultiCompiler", stats => { - if (!compilerDone) { - compilerDone = true; - doneCompilers++; - } - compilerStats[compilerIndex] = stats; - if (doneCompilers === this.compilers.length) { - this.hooks.done.call(new MultiStats(compilerStats)); - } - }); - compiler.hooks.invalid.tap("MultiCompiler", () => { - if (compilerDone) { - compilerDone = false; - doneCompilers--; - } - }); + setAllKnownExportsUsed(runtime) { + let changed = false; + for (const exportInfo of this._exports.values()) { + if (!exportInfo.provided) continue; + if (exportInfo.setUsed(UsageState.Used, runtime)) { + changed = true; + } } + return changed; } - get options() { - return Object.assign( - this.compilers.map(c => c.options), - this._options + /** + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true, when something changed + */ + setUsedForSideEffectsOnly(runtime) { + return this._sideEffectsOnlyInfo.setUsedConditionally( + used => used === UsageState.Unused, + UsageState.Used, + runtime ); } - get outputPath() { - let commonPath = this.compilers[0].outputPath; - for (const compiler of this.compilers) { - while ( - compiler.outputPath.indexOf(commonPath) !== 0 && - /[/\\]/.test(commonPath) - ) { - commonPath = commonPath.replace(/[/\\][^/\\]*$/, ""); + /** + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true, when the module exports are used in any way + */ + isUsed(runtime) { + if (this._redirectTo !== undefined) { + if (this._redirectTo.isUsed(runtime)) { + return true; + } + } else { + if (this._otherExportsInfo.getUsed(runtime) !== UsageState.Unused) { + return true; } } - - if (!commonPath && this.compilers[0].outputPath[0] === "/") return "/"; - return commonPath; - } - - get inputFileSystem() { - throw new Error("Cannot read inputFileSystem of a MultiCompiler"); - } - - get outputFileSystem() { - throw new Error("Cannot read outputFileSystem of a MultiCompiler"); - } - - get watchFileSystem() { - throw new Error("Cannot read watchFileSystem of a MultiCompiler"); - } - - get intermediateFileSystem() { - throw new Error("Cannot read outputFileSystem of a MultiCompiler"); + for (const exportInfo of this._exports.values()) { + if (exportInfo.getUsed(runtime) !== UsageState.Unused) { + return true; + } + } + return false; } /** - * @param {InputFileSystem} value the new input file system + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true, when the module is used in any way */ - set inputFileSystem(value) { - for (const compiler of this.compilers) { - compiler.inputFileSystem = value; - } + isModuleUsed(runtime) { + if (this.isUsed(runtime)) return true; + if (this._sideEffectsOnlyInfo.getUsed(runtime) !== UsageState.Unused) + return true; + return false; } /** - * @param {OutputFileSystem} value the new output file system + * @param {RuntimeSpec} runtime the runtime + * @returns {SortableSet | boolean | null} set of used exports, or true (when namespace object is used), or false (when unused), or null (when unknown) */ - set outputFileSystem(value) { - for (const compiler of this.compilers) { - compiler.outputFileSystem = value; + getUsedExports(runtime) { + if (!this._redirectTo !== undefined) { + switch (this._otherExportsInfo.getUsed(runtime)) { + case UsageState.NoInfo: + return null; + case UsageState.Unknown: + case UsageState.OnlyPropertiesUsed: + case UsageState.Used: + return true; + } + } + const array = []; + if (!this._exportsAreOrdered) this._sortExports(); + for (const exportInfo of this._exports.values()) { + switch (exportInfo.getUsed(runtime)) { + case UsageState.NoInfo: + return null; + case UsageState.Unknown: + return true; + case UsageState.OnlyPropertiesUsed: + case UsageState.Used: + array.push(exportInfo.name); + } + } + if (this._redirectTo !== undefined) { + const inner = this._redirectTo.getUsedExports(runtime); + if (inner === null) return null; + if (inner === true) return true; + if (inner !== false) { + for (const item of inner) { + array.push(item); + } + } + } + if (array.length === 0) { + switch (this._sideEffectsOnlyInfo.getUsed(runtime)) { + case UsageState.NoInfo: + return null; + case UsageState.Unused: + return false; + } } + return new SortableSet(array); } /** - * @param {WatchFileSystem} value the new watch file system + * @returns {null | true | string[]} list of exports when known */ - set watchFileSystem(value) { - for (const compiler of this.compilers) { - compiler.watchFileSystem = value; + getProvidedExports() { + if (!this._redirectTo !== undefined) { + switch (this._otherExportsInfo.provided) { + case undefined: + return null; + case null: + return true; + case true: + return true; + } + } + const array = []; + if (!this._exportsAreOrdered) this._sortExports(); + for (const exportInfo of this._exports.values()) { + switch (exportInfo.provided) { + case undefined: + return null; + case null: + return true; + case true: + array.push(exportInfo.name); + } + } + if (this._redirectTo !== undefined) { + const inner = this._redirectTo.getProvidedExports(); + if (inner === null) return null; + if (inner === true) return true; + for (const item of inner) { + if (!array.includes(item)) { + array.push(item); + } + } } + return array; } /** - * @param {IntermediateFileSystem} value the new intermediate file system + * @param {RuntimeSpec} runtime the runtime + * @returns {ExportInfo[]} exports that are relevant (not unused and potential provided) */ - set intermediateFileSystem(value) { - for (const compiler of this.compilers) { - compiler.intermediateFileSystem = value; + getRelevantExports(runtime) { + const list = []; + for (const exportInfo of this._exports.values()) { + const used = exportInfo.getUsed(runtime); + if (used === UsageState.Unused) continue; + if (exportInfo.provided === false) continue; + list.push(exportInfo); } + if (this._redirectTo !== undefined) { + for (const exportInfo of this._redirectTo.getRelevantExports(runtime)) { + if (!this._exports.has(exportInfo.name)) list.push(exportInfo); + } + } + if ( + this._otherExportsInfo.provided !== false && + this._otherExportsInfo.getUsed(runtime) !== UsageState.Unused + ) { + list.push(this._otherExportsInfo); + } + return list; } - getInfrastructureLogger(name) { - return this.compilers[0].getInfrastructureLogger(name); + /** + * @param {string | string[]} name the name of the export + * @returns {boolean | undefined | null} if the export is provided + */ + isExportProvided(name) { + if (Array.isArray(name)) { + const info = this.getReadOnlyExportInfo(name[0]); + if (info.exportsInfo && name.length > 1) { + return info.exportsInfo.isExportProvided(name.slice(1)); + } + return info.provided; + } + const info = this.getReadOnlyExportInfo(name); + return info.provided; } /** - * @param {Compiler} compiler the child compiler - * @param {string[]} dependencies its dependencies - * @returns {void} + * @param {RuntimeSpec} runtime runtime + * @returns {string} key representing the usage */ - setDependencies(compiler, dependencies) { - this.dependencies.set(compiler, dependencies); + getUsageKey(runtime) { + const key = []; + if (this._redirectTo !== undefined) { + key.push(this._redirectTo.getUsageKey(runtime)); + } else { + key.push(this._otherExportsInfo.getUsed(runtime)); + } + key.push(this._sideEffectsOnlyInfo.getUsed(runtime)); + for (const exportInfo of this.orderedOwnedExports) { + key.push(exportInfo.getUsed(runtime)); + } + return key.join("|"); } /** - * @param {Callback} callback signals when the validation is complete - * @returns {boolean} true if the dependencies are valid + * @param {RuntimeSpec} runtimeA first runtime + * @param {RuntimeSpec} runtimeB second runtime + * @returns {boolean} true, when equally used */ - validateDependencies(callback) { - /** @type {Set<{source: Compiler, target: Compiler}>} */ - const edges = new Set(); - /** @type {string[]} */ - const missing = []; - const targetFound = compiler => { - for (const edge of edges) { - if (edge.target === compiler) { - return true; - } - } - return false; - }; - const sortEdges = (e1, e2) => { - return ( - e1.source.name.localeCompare(e2.source.name) || - e1.target.name.localeCompare(e2.target.name) - ); - }; - for (const source of this.compilers) { - const dependencies = this.dependencies.get(source); - if (dependencies) { - for (const dep of dependencies) { - const target = this.compilers.find(c => c.name === dep); - if (!target) { - missing.push(dep); - } else { - edges.add({ - source, - target - }); - } - } - } - } - /** @type {string[]} */ - const errors = missing.map(m => `Compiler dependency \`${m}\` not found.`); - const stack = this.compilers.filter(c => !targetFound(c)); - while (stack.length > 0) { - const current = stack.pop(); - for (const edge of edges) { - if (edge.source === current) { - edges.delete(edge); - const target = edge.target; - if (!targetFound(target)) { - stack.push(target); - } - } + isEquallyUsed(runtimeA, runtimeB) { + if (this._redirectTo !== undefined) { + if (!this._redirectTo.isEquallyUsed(runtimeA, runtimeB)) return false; + } else { + if ( + this._otherExportsInfo.getUsed(runtimeA) !== + this._otherExportsInfo.getUsed(runtimeB) + ) { + return false; } } - if (edges.size > 0) { - /** @type {string[]} */ - const lines = Array.from(edges) - .sort(sortEdges) - .map(edge => `${edge.source.name} -> ${edge.target.name}`); - lines.unshift("Circular dependency found in compiler dependencies."); - errors.unshift(lines.join("\n")); - } - if (errors.length > 0) { - const message = errors.join("\n"); - callback(new Error(message)); + if ( + this._sideEffectsOnlyInfo.getUsed(runtimeA) !== + this._sideEffectsOnlyInfo.getUsed(runtimeB) + ) { return false; } + for (const exportInfo of this.ownedExports) { + if (exportInfo.getUsed(runtimeA) !== exportInfo.getUsed(runtimeB)) + return false; + } return true; } - // TODO webpack 6 remove /** - * @deprecated This method should have been private - * @param {Compiler[]} compilers the child compilers - * @param {RunWithDependenciesHandler} fn a handler to run for each compiler - * @param {Callback} callback the compiler's handler - * @returns {void} + * @param {string | string[]} name export name + * @param {RuntimeSpec} runtime check usage for this runtime only + * @returns {UsageStateType} usage status */ - runWithDependencies(compilers, fn, callback) { - const fulfilledNames = new Set(); - let remainingCompilers = compilers; - const isDependencyFulfilled = d => fulfilledNames.has(d); - const getReadyCompilers = () => { - let readyCompilers = []; - let list = remainingCompilers; - remainingCompilers = []; - for (const c of list) { - const dependencies = this.dependencies.get(c); - const ready = - !dependencies || dependencies.every(isDependencyFulfilled); - if (ready) { - readyCompilers.push(c); - } else { - remainingCompilers.push(c); - } + getUsed(name, runtime) { + if (Array.isArray(name)) { + if (name.length === 0) return this.otherExportsInfo.getUsed(runtime); + let info = this.getReadOnlyExportInfo(name[0]); + if (info.exportsInfo && name.length > 1) { + return info.exportsInfo.getUsed(name.slice(1), runtime); } - return readyCompilers; - }; - const runCompilers = callback => { - if (remainingCompilers.length === 0) return callback(); - asyncLib.map( - getReadyCompilers(), - (compiler, callback) => { - fn(compiler, err => { - if (err) return callback(err); - fulfilledNames.add(compiler.name); - runCompilers(callback); - }); - }, - callback - ); - }; - runCompilers(callback); + return info.getUsed(runtime); + } + let info = this.getReadOnlyExportInfo(name); + return info.getUsed(runtime); } /** - * @template SetupResult - * @param {function(Compiler, number, Callback, function(): boolean, function(): void, function(): void): SetupResult} setup setup a single compiler - * @param {function(Compiler, SetupResult, Callback): void} run run/continue a single compiler - * @param {Callback} callback callback when all compilers are done, result includes Stats of all changed compilers - * @returns {SetupResult[]} result of setup + * @param {string | string[]} name the export name + * @param {RuntimeSpec} runtime check usage for this runtime only + * @returns {string | string[] | false} the used name */ - _runGraph(setup, run, callback) { - /** @typedef {{ compiler: Compiler, setupResult: SetupResult, result: Stats, state: "pending" | "blocked" | "queued" | "starting" | "running" | "running-outdated" | "done", children: Node[], parents: Node[] }} Node */ - - // State transitions for nodes: - // -> blocked (initial) - // blocked -> starting [running++] (when all parents done) - // queued -> starting [running++] (when processing the queue) - // starting -> running (when run has been called) - // running -> done [running--] (when compilation is done) - // done -> pending (when invalidated from file change) - // pending -> blocked [add to queue] (when invalidated from aggregated changes) - // done -> blocked [add to queue] (when invalidated, from parent invalidation) - // running -> running-outdated (when invalidated, either from change or parent invalidation) - // running-outdated -> blocked [running--] (when compilation is done) - - /** @type {Node[]} */ - const nodes = this.compilers.map(compiler => ({ - compiler, - setupResult: undefined, - result: undefined, - state: "blocked", - children: [], - parents: [] - })); - /** @type {Map} */ - const compilerToNode = new Map(); - for (const node of nodes) compilerToNode.set(node.compiler.name, node); - for (const node of nodes) { - const dependencies = this.dependencies.get(node.compiler); - if (!dependencies) continue; - for (const dep of dependencies) { - const parent = compilerToNode.get(dep); - node.parents.push(parent); - parent.children.push(node); - } - } - /** @type {ArrayQueue} */ - const queue = new ArrayQueue(); - for (const node of nodes) { - if (node.parents.length === 0) { - node.state = "queued"; - queue.enqueue(node); - } - } - let errored = false; - let running = 0; - const parallelism = this._options.parallelism; - /** - * @param {Node} node node - * @param {Error=} err error - * @param {Stats=} stats result - * @returns {void} - */ - const nodeDone = (node, err, stats) => { - if (errored) return; - if (err) { - errored = true; - return asyncLib.each( - nodes, - (node, callback) => { - if (node.compiler.watching) { - node.compiler.watching.close(callback); - } else { - callback(); - } - }, - () => callback(err) - ); - } - node.result = stats; - running--; - if (node.state === "running") { - node.state = "done"; - for (const child of node.children) { - if (child.state === "blocked") queue.enqueue(child); - } - } else if (node.state === "running-outdated") { - node.state = "blocked"; - queue.enqueue(node); - } - processQueue(); - }; - /** - * @param {Node} node node - * @returns {void} - */ - const nodeInvalidFromParent = node => { - if (node.state === "done") { - node.state = "blocked"; - } else if (node.state === "running") { - node.state = "running-outdated"; - } - for (const child of node.children) { - nodeInvalidFromParent(child); - } - }; - /** - * @param {Node} node node - * @returns {void} - */ - const nodeInvalid = node => { - if (node.state === "done") { - node.state = "pending"; - } else if (node.state === "running") { - node.state = "running-outdated"; - } - for (const child of node.children) { - nodeInvalidFromParent(child); - } - }; - /** - * @param {Node} node node - * @returns {void} - */ - const nodeChange = node => { - nodeInvalid(node); - if (node.state === "pending") { - node.state = "blocked"; - } - if (node.state === "blocked") { - queue.enqueue(node); - processQueue(); + getUsedName(name, runtime) { + if (Array.isArray(name)) { + // TODO improve this + if (name.length === 0) { + if (!this.isUsed(runtime)) return false; + return name; } - }; - - const setupResults = []; - nodes.forEach((node, i) => { - setupResults.push( - (node.setupResult = setup( - node.compiler, - i, - nodeDone.bind(null, node), - () => node.state !== "starting" && node.state !== "running", - () => nodeChange(node), - () => nodeInvalid(node) - )) - ); - }); - let processing = true; - const processQueue = () => { - if (processing) return; - processing = true; - process.nextTick(processQueueWorker); - }; - const processQueueWorker = () => { - while (running < parallelism && queue.length > 0 && !errored) { - const node = queue.dequeue(); - if ( - node.state === "queued" || - (node.state === "blocked" && - node.parents.every(p => p.state === "done")) - ) { - running++; - node.state = "starting"; - run(node.compiler, node.setupResult, nodeDone.bind(null, node)); - node.state = "running"; - } + let info = this.getReadOnlyExportInfo(name[0]); + const x = info.getUsedName(name[0], runtime); + if (x === false) return false; + const arr = x === name[0] && name.length === 1 ? name : [x]; + if (name.length === 1) { + return arr; } - processing = false; if ( - !errored && - running === 0 && - nodes.every(node => node.state === "done") + info.exportsInfo && + info.getUsed(runtime) === UsageState.OnlyPropertiesUsed ) { - const stats = []; - for (const node of nodes) { - const result = node.result; - if (result) { - node.result = undefined; - stats.push(result); - } - } - if (stats.length > 0) { - callback(null, new MultiStats(stats)); - } + const nested = info.exportsInfo.getUsedName(name.slice(1), runtime); + if (!nested) return false; + return arr.concat(nested); + } else { + return arr.concat(name.slice(1)); } - }; - processQueueWorker(); - return setupResults; + } else { + let info = this.getReadOnlyExportInfo(name); + const usedName = info.getUsedName(name, runtime); + return usedName; + } } /** - * @param {WatchOptions|WatchOptions[]} watchOptions the watcher's options - * @param {Callback} handler signals when the call finishes - * @returns {MultiWatching} a compiler watcher + * @param {Hash} hash the hash + * @param {RuntimeSpec} runtime the runtime + * @returns {void} */ - watch(watchOptions, handler) { - if (this.running) { - return handler(new ConcurrentCompilationError()); - } - this.running = true; - - if (this.validateDependencies(handler)) { - const watchings = this._runGraph( - (compiler, idx, callback, isBlocked, setChanged, setInvalid) => { - const watching = compiler.watch( - Array.isArray(watchOptions) ? watchOptions[idx] : watchOptions, - callback - ); - if (watching) { - watching._onInvalid = setInvalid; - watching._onChange = setChanged; - watching._isBlocked = isBlocked; - } - return watching; - }, - (compiler, watching, callback) => { - if (compiler.watching !== watching) return; - if (!watching.running) watching.invalidate(); - }, - handler - ); - return new MultiWatching(watchings, this); - } - - return new MultiWatching([], this); + updateHash(hash, runtime) { + this._updateHash(hash, runtime, new Set()); } /** - * @param {Callback} callback signals when the call finishes + * @param {Hash} hash the hash + * @param {RuntimeSpec} runtime the runtime + * @param {Set} alreadyVisitedExportsInfo for circular references * @returns {void} */ - run(callback) { - if (this.running) { - return callback(new ConcurrentCompilationError()); + _updateHash(hash, runtime, alreadyVisitedExportsInfo) { + const set = new Set(alreadyVisitedExportsInfo); + set.add(this); + for (const exportInfo of this.orderedExports) { + if (exportInfo.hasInfo(this._otherExportsInfo, runtime)) { + exportInfo._updateHash(hash, runtime, set); + } } - this.running = true; - - if (this.validateDependencies(callback)) { - this._runGraph( - () => {}, - (compiler, setupResult, callback) => compiler.run(callback), - (err, stats) => { - this.running = false; - - if (callback !== undefined) { - return callback(err, stats); - } - } - ); + this._sideEffectsOnlyInfo._updateHash(hash, runtime, set); + this._otherExportsInfo._updateHash(hash, runtime, set); + if (this._redirectTo !== undefined) { + this._redirectTo._updateHash(hash, runtime, set); } } - purgeInputFileSystem() { - for (const compiler of this.compilers) { - if (compiler.inputFileSystem && compiler.inputFileSystem.purge) { - compiler.inputFileSystem.purge(); + getRestoreProvidedData() { + const otherProvided = this._otherExportsInfo.provided; + const otherCanMangleProvide = this._otherExportsInfo.canMangleProvide; + const otherTerminalBinding = this._otherExportsInfo.terminalBinding; + const exports = []; + for (const exportInfo of this.orderedExports) { + if ( + exportInfo.provided !== otherProvided || + exportInfo.canMangleProvide !== otherCanMangleProvide || + exportInfo.terminalBinding !== otherTerminalBinding || + exportInfo.exportsInfoOwned + ) { + exports.push({ + name: exportInfo.name, + provided: exportInfo.provided, + canMangleProvide: exportInfo.canMangleProvide, + terminalBinding: exportInfo.terminalBinding, + exportsInfo: exportInfo.exportsInfoOwned + ? exportInfo.exportsInfo.getRestoreProvidedData() + : undefined + }); } } - } - - /** - * @param {Callback} callback signals when the compiler closes - * @returns {void} - */ - close(callback) { - asyncLib.each( - this.compilers, - (compiler, callback) => { - compiler.close(callback); - }, - callback + return new RestoreProvidedData( + exports, + otherProvided, + otherCanMangleProvide, + otherTerminalBinding ); } -}; - - -/***/ }), -/***/ 24170: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const identifierUtils = __webpack_require__(82186); - -/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */ -/** @typedef {import("./Stats")} Stats */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").KnownStatsCompilation} KnownStatsCompilation */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */ - -const indent = (str, prefix) => { - const rem = str.replace(/\n([^\n])/g, "\n" + prefix + "$1"); - return prefix + rem; -}; + restoreProvided({ + otherProvided, + otherCanMangleProvide, + otherTerminalBinding, + exports + }) { + let wasEmpty = true; + for (const exportInfo of this._exports.values()) { + wasEmpty = false; + exportInfo.provided = otherProvided; + exportInfo.canMangleProvide = otherCanMangleProvide; + exportInfo.terminalBinding = otherTerminalBinding; + } + this._otherExportsInfo.provided = otherProvided; + this._otherExportsInfo.canMangleProvide = otherCanMangleProvide; + this._otherExportsInfo.terminalBinding = otherTerminalBinding; + for (const exp of exports) { + const exportInfo = this.getExportInfo(exp.name); + exportInfo.provided = exp.provided; + exportInfo.canMangleProvide = exp.canMangleProvide; + exportInfo.terminalBinding = exp.terminalBinding; + if (exp.exportsInfo) { + const exportsInfo = exportInfo.createNestedExportsInfo(); + exportsInfo.restoreProvided(exp.exportsInfo); + } + } + if (wasEmpty) this._exportsAreOrdered = true; + } +} -class MultiStats { +class ExportInfo { /** - * @param {Stats[]} stats the child stats + * @param {string} name the original name of the export + * @param {ExportInfo=} initFrom init values from this ExportInfo */ - constructor(stats) { - this.stats = stats; + constructor(name, initFrom) { + /** @type {string} */ + this.name = name; + /** @private @type {string | null} */ + this._usedName = initFrom ? initFrom._usedName : null; + /** @private @type {UsageStateType} */ + this._globalUsed = initFrom ? initFrom._globalUsed : undefined; + /** @private @type {Map} */ + this._usedInRuntime = + initFrom && initFrom._usedInRuntime + ? new Map(initFrom._usedInRuntime) + : undefined; + /** @private @type {boolean} */ + this._hasUseInRuntimeInfo = initFrom + ? initFrom._hasUseInRuntimeInfo + : false; + /** + * true: it is provided + * false: it is not provided + * null: only the runtime knows if it is provided + * undefined: it was not determined if it is provided + * @type {boolean | null | undefined} + */ + this.provided = initFrom ? initFrom.provided : undefined; + /** + * is the export a terminal binding that should be checked for export star conflicts + * @type {boolean} + */ + this.terminalBinding = initFrom ? initFrom.terminalBinding : false; + /** + * true: it can be mangled + * false: is can not be mangled + * undefined: it was not determined if it can be mangled + * @type {boolean | undefined} + */ + this.canMangleProvide = initFrom ? initFrom.canMangleProvide : undefined; + /** + * true: it can be mangled + * false: is can not be mangled + * undefined: it was not determined if it can be mangled + * @type {boolean | undefined} + */ + this.canMangleUse = initFrom ? initFrom.canMangleUse : undefined; + /** @type {boolean} */ + this.exportsInfoOwned = false; + /** @type {ExportsInfo=} */ + this.exportsInfo = undefined; + /** @type {Map=} */ + this._target = undefined; + if (initFrom && initFrom._target) { + this._target = new Map(); + for (const [key, value] of initFrom._target) { + this._target.set(key, { + connection: value.connection, + export: value.export || [name], + priority: value.priority + }); + } + } + /** @type {Map=} */ + this._maxTarget = undefined; } - get hash() { - return this.stats.map(stat => stat.hash).join(""); + // TODO webpack 5 remove + /** @private */ + get used() { + throw new Error("REMOVED"); + } + /** @private */ + get usedName() { + throw new Error("REMOVED"); } - /** - * @returns {boolean} true if a child compilation encountered an error + * @private + * @param {*} v v */ - hasErrors() { - return this.stats.some(stat => stat.hasErrors()); + set used(v) { + throw new Error("REMOVED"); } - /** - * @returns {boolean} true if a child compilation had a warning + * @private + * @param {*} v v */ - hasWarnings() { - return this.stats.some(stat => stat.hasWarnings()); + set usedName(v) { + throw new Error("REMOVED"); } - _createChildOptions(options, context) { - if (!options) { - options = {}; + get canMangle() { + switch (this.canMangleProvide) { + case undefined: + return this.canMangleUse === false ? false : undefined; + case false: + return false; + case true: + switch (this.canMangleUse) { + case undefined: + return undefined; + case false: + return false; + case true: + return true; + } } - const { children: childrenOptions = undefined, ...baseOptions } = - typeof options === "string" ? { preset: options } : options; - const children = this.stats.map((stat, idx) => { - const childOptions = Array.isArray(childrenOptions) - ? childrenOptions[idx] - : childrenOptions; - return stat.compilation.createStatsOptions( - { - ...baseOptions, - ...(typeof childOptions === "string" - ? { preset: childOptions } - : childOptions && typeof childOptions === "object" - ? childOptions - : undefined) - }, - context - ); - }); - return { - version: children.every(o => o.version), - hash: children.every(o => o.hash), - errorsCount: children.every(o => o.errorsCount), - warningsCount: children.every(o => o.warningsCount), - errors: children.every(o => o.errors), - warnings: children.every(o => o.warnings), - children - }; + throw new Error( + `Unexpected flags for canMangle ${this.canMangleProvide} ${this.canMangleUse}` + ); } /** - * @param {any} options stats options - * @returns {StatsCompilation} json output + * @param {RuntimeSpec} runtime only apply to this runtime + * @returns {boolean} true, when something changed */ - toJson(options) { - options = this._createChildOptions(options, { forToString: false }); - /** @type {KnownStatsCompilation} */ - const obj = {}; - obj.children = this.stats.map((stat, idx) => { - const obj = stat.toJson(options.children[idx]); - const compilationName = stat.compilation.name; - const name = - compilationName && - identifierUtils.makePathsRelative( - options.context, - compilationName, - stat.compilation.compiler.root - ); - obj.name = name; - return obj; - }); - if (options.version) { - obj.version = obj.children[0].version; - } - if (options.hash) { - obj.hash = obj.children.map(j => j.hash).join(""); - } - const mapError = (j, obj) => { - return { - ...obj, - compilerPath: obj.compilerPath - ? `${j.name}.${obj.compilerPath}` - : j.name - }; - }; - if (options.errors) { - obj.errors = []; - for (const j of obj.children) { - for (const i of j.errors) { - obj.errors.push(mapError(j, i)); - } - } + setUsedInUnknownWay(runtime) { + let changed = false; + if ( + this.setUsedConditionally( + used => used < UsageState.Unknown, + UsageState.Unknown, + runtime + ) + ) { + changed = true; } - if (options.warnings) { - obj.warnings = []; - for (const j of obj.children) { - for (const i of j.warnings) { - obj.warnings.push(mapError(j, i)); - } - } + if (this.canMangleUse !== false) { + this.canMangleUse = false; + changed = true; } - if (options.errorsCount) { - obj.errorsCount = 0; - for (const j of obj.children) { - obj.errorsCount += j.errorsCount; - } + return changed; + } + + /** + * @param {RuntimeSpec} runtime only apply to this runtime + * @returns {boolean} true, when something changed + */ + setUsedWithoutInfo(runtime) { + let changed = false; + if (this.setUsed(UsageState.NoInfo, runtime)) { + changed = true; } - if (options.warningsCount) { - obj.warningsCount = 0; - for (const j of obj.children) { - obj.warningsCount += j.warningsCount; - } + if (this.canMangleUse !== false) { + this.canMangleUse = false; + changed = true; } - return obj; + return changed; } - toString(options) { - options = this._createChildOptions(options, { forToString: true }); - const results = this.stats.map((stat, idx) => { - const str = stat.toString(options.children[idx]); - const compilationName = stat.compilation.name; - const name = - compilationName && - identifierUtils - .makePathsRelative( - options.context, - compilationName, - stat.compilation.compiler.root - ) - .replace(/\|/g, " "); - if (!str) return str; - return name ? `${name}:\n${indent(str, " ")}` : str; - }); - return results.filter(Boolean).join("\n\n"); + setHasUseInfo() { + if (!this._hasUseInRuntimeInfo) { + this._hasUseInRuntimeInfo = true; + } + if (this.canMangleUse === undefined) { + this.canMangleUse = true; + } + if (this.exportsInfoOwned) { + this.exportsInfo.setHasUseInfo(); + } } -} - -module.exports = MultiStats; - - -/***/ }), - -/***/ 81128: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const asyncLib = __webpack_require__(78175); -/** @typedef {import("./MultiCompiler")} MultiCompiler */ -/** @typedef {import("./Watching")} Watching */ - -/** - * @template T - * @callback Callback - * @param {(Error | null)=} err - * @param {T=} result - */ - -class MultiWatching { /** - * @param {Watching[]} watchings child compilers' watchers - * @param {MultiCompiler} compiler the compiler + * @param {function(UsageStateType): boolean} condition compare with old value + * @param {UsageStateType} newValue set when condition is true + * @param {RuntimeSpec} runtime only apply to this runtime + * @returns {boolean} true when something has changed */ - constructor(watchings, compiler) { - this.watchings = watchings; - this.compiler = compiler; + setUsedConditionally(condition, newValue, runtime) { + if (runtime === undefined) { + if (this._globalUsed === undefined) { + this._globalUsed = newValue; + return true; + } else { + if (this._globalUsed !== newValue && condition(this._globalUsed)) { + this._globalUsed = newValue; + return true; + } + } + } else if (this._usedInRuntime === undefined) { + if (newValue !== UsageState.Unused && condition(UsageState.Unused)) { + this._usedInRuntime = new Map(); + forEachRuntime(runtime, runtime => + this._usedInRuntime.set(runtime, newValue) + ); + return true; + } + } else { + let changed = false; + forEachRuntime(runtime, runtime => { + /** @type {UsageStateType} */ + let oldValue = this._usedInRuntime.get(runtime); + if (oldValue === undefined) oldValue = UsageState.Unused; + if (newValue !== oldValue && condition(oldValue)) { + if (newValue === UsageState.Unused) { + this._usedInRuntime.delete(runtime); + } else { + this._usedInRuntime.set(runtime, newValue); + } + changed = true; + } + }); + if (changed) { + if (this._usedInRuntime.size === 0) this._usedInRuntime = undefined; + return true; + } + } + return false; } - invalidate(callback) { - if (callback) { - asyncLib.each( - this.watchings, - (watching, callback) => watching.invalidate(callback), - callback - ); + /** + * @param {UsageStateType} newValue new value of the used state + * @param {RuntimeSpec} runtime only apply to this runtime + * @returns {boolean} true when something has changed + */ + setUsed(newValue, runtime) { + if (runtime === undefined) { + if (this._globalUsed !== newValue) { + this._globalUsed = newValue; + return true; + } + } else if (this._usedInRuntime === undefined) { + if (newValue !== UsageState.Unused) { + this._usedInRuntime = new Map(); + forEachRuntime(runtime, runtime => + this._usedInRuntime.set(runtime, newValue) + ); + return true; + } } else { - for (const watching of this.watchings) { - watching.invalidate(); + let changed = false; + forEachRuntime(runtime, runtime => { + /** @type {UsageStateType} */ + let oldValue = this._usedInRuntime.get(runtime); + if (oldValue === undefined) oldValue = UsageState.Unused; + if (newValue !== oldValue) { + if (newValue === UsageState.Unused) { + this._usedInRuntime.delete(runtime); + } else { + this._usedInRuntime.set(runtime, newValue); + } + changed = true; + } + }); + if (changed) { + if (this._usedInRuntime.size === 0) this._usedInRuntime = undefined; + return true; } } + return false; } - suspend() { - for (const watching of this.watchings) { - watching.suspend(); + /** + * @param {any} key the key + * @returns {boolean} true, if something has changed + */ + unsetTarget(key) { + if (!this._target) return false; + if (this._target.delete(key)) { + this._maxTarget = undefined; + return true; } + return false; } - resume() { - for (const watching of this.watchings) { - watching.resume(); + /** + * @param {any} key the key + * @param {ModuleGraphConnection} connection the target module if a single one + * @param {string[]=} exportName the exported name + * @param {number=} priority priority + * @returns {boolean} true, if something has changed + */ + setTarget(key, connection, exportName, priority = 0) { + if (exportName) exportName = [...exportName]; + if (!this._target) { + this._target = new Map(); + this._target.set(key, { connection, export: exportName, priority }); + return true; + } + const oldTarget = this._target.get(key); + if (!oldTarget) { + if (oldTarget === null && !connection) return false; + this._target.set(key, { connection, export: exportName, priority }); + this._maxTarget = undefined; + return true; + } + if ( + oldTarget.connection !== connection || + oldTarget.priority !== priority || + (exportName + ? !oldTarget.export || !equals(oldTarget.export, exportName) + : oldTarget.export) + ) { + oldTarget.connection = connection; + oldTarget.export = exportName; + oldTarget.priority = priority; + this._maxTarget = undefined; + return true; } + return false; } /** - * @param {Callback} callback signals when the watcher is closed - * @returns {void} + * @param {RuntimeSpec} runtime for this runtime + * @returns {UsageStateType} usage state */ - close(callback) { - asyncLib.forEach( - this.watchings, - (watching, finishedCallback) => { - watching.close(finishedCallback); - }, - err => { - this.compiler.hooks.watchClose.call(); - if (typeof callback === "function") { - this.compiler.running = false; - callback(err); + getUsed(runtime) { + if (!this._hasUseInRuntimeInfo) return UsageState.NoInfo; + if (this._globalUsed !== undefined) return this._globalUsed; + if (this._usedInRuntime === undefined) { + return UsageState.Unused; + } else if (typeof runtime === "string") { + const value = this._usedInRuntime.get(runtime); + return value === undefined ? UsageState.Unused : value; + } else if (runtime === undefined) { + /** @type {UsageStateType} */ + let max = UsageState.Unused; + for (const value of this._usedInRuntime.values()) { + if (value === UsageState.Used) { + return UsageState.Used; } + if (max < value) max = value; } - ); - } -} - -module.exports = MultiWatching; - - -/***/ }), - -/***/ 50169: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - + return max; + } else { + /** @type {UsageStateType} */ + let max = UsageState.Unused; + for (const item of runtime) { + const value = this._usedInRuntime.get(item); + if (value !== undefined) { + if (value === UsageState.Used) { + return UsageState.Used; + } + if (max < value) max = value; + } + } + return max; + } + } + /** + * get used name + * @param {string | undefined} fallbackName fallback name for used exports with no name + * @param {RuntimeSpec} runtime check usage for this runtime only + * @returns {string | false} used name + */ + getUsedName(fallbackName, runtime) { + if (this._hasUseInRuntimeInfo) { + if (this._globalUsed !== undefined) { + if (this._globalUsed === UsageState.Unused) return false; + } else { + if (this._usedInRuntime === undefined) return false; + if (typeof runtime === "string") { + if (!this._usedInRuntime.has(runtime)) { + return false; + } + } else if (runtime !== undefined) { + if ( + Array.from(runtime).every( + runtime => !this._usedInRuntime.has(runtime) + ) + ) { + return false; + } + } + } + } + if (this._usedName !== null) return this._usedName; + return this.name || fallbackName; + } -/** @typedef {import("./Compiler")} Compiler */ + /** + * @returns {boolean} true, when a mangled name of this export is set + */ + hasUsedName() { + return this._usedName !== null; + } -class NoEmitOnErrorsPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * Sets the mangled name of this export + * @param {string} name the new name * @returns {void} */ - apply(compiler) { - compiler.hooks.shouldEmit.tap("NoEmitOnErrorsPlugin", compilation => { - if (compilation.getStats().hasErrors()) return false; - }); - compiler.hooks.compilation.tap("NoEmitOnErrorsPlugin", compilation => { - compilation.hooks.shouldRecord.tap("NoEmitOnErrorsPlugin", () => { - if (compilation.getStats().hasErrors()) return false; - }); - }); + setUsedName(name) { + this._usedName = name; } -} - -module.exports = NoEmitOnErrorsPlugin; + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {function({ module: Module, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target + * @returns {ExportInfo | ExportsInfo | undefined} the terminal binding export(s) info if known + */ + getTerminalBinding(moduleGraph, resolveTargetFilter = RETURNS_TRUE) { + if (this.terminalBinding) return this; + const target = this.getTarget(moduleGraph, resolveTargetFilter); + if (!target) return undefined; + const exportsInfo = moduleGraph.getExportsInfo(target.module); + if (!target.export) return exportsInfo; + return exportsInfo.getReadOnlyExportInfoRecursive(target.export); + } -/***/ }), + isReexport() { + return !this.terminalBinding && this._target && this._target.size > 0; + } -/***/ 80832: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + _getMaxTarget() { + if (this._maxTarget !== undefined) return this._maxTarget; + if (this._target.size <= 1) return (this._maxTarget = this._target); + let maxPriority = -Infinity; + let minPriority = Infinity; + for (const { priority } of this._target.values()) { + if (maxPriority < priority) maxPriority = priority; + if (minPriority > priority) minPriority = priority; + } + // This should be very common + if (maxPriority === minPriority) return (this._maxTarget = this._target); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // This is an edge case + const map = new Map(); + for (const [key, value] of this._target) { + if (maxPriority === value.priority) { + map.set(key, value); + } + } + this._maxTarget = map; + return map; + } + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {function(Module): boolean} validTargetModuleFilter a valid target module + * @returns {{ module: Module, export: string[] | undefined } | undefined | false} the target, undefined when there is no target, false when no target is valid + */ + findTarget(moduleGraph, validTargetModuleFilter) { + return this._findTarget(moduleGraph, validTargetModuleFilter, new Set()); + } + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {function(Module): boolean} validTargetModuleFilter a valid target module + * @param {Set | undefined} alreadyVisited set of already visited export info to avoid circular references + * @returns {{ module: Module, export: string[] | undefined } | undefined | false} the target, undefined when there is no target, false when no target is valid + */ + _findTarget(moduleGraph, validTargetModuleFilter, alreadyVisited) { + if (!this._target || this._target.size === 0) return undefined; + let rawTarget = this._getMaxTarget().values().next().value; + if (!rawTarget) return undefined; + /** @type {{ module: Module, export: string[] | undefined }} */ + let target = { + module: rawTarget.connection.module, + export: rawTarget.export + }; + for (;;) { + if (validTargetModuleFilter(target.module)) return target; + const exportsInfo = moduleGraph.getExportsInfo(target.module); + const exportInfo = exportsInfo.getExportInfo(target.export[0]); + if (alreadyVisited.has(exportInfo)) return null; + const newTarget = exportInfo._findTarget( + moduleGraph, + validTargetModuleFilter, + alreadyVisited + ); + if (!newTarget) return false; + if (target.export.length === 1) { + target = newTarget; + } else { + target = { + module: newTarget.module, + export: newTarget.export + ? newTarget.export.concat(target.export.slice(1)) + : target.export.slice(1) + }; + } + } + } -const WebpackError = __webpack_require__(53799); + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {function({ module: Module, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target + * @returns {{ module: Module, export: string[] | undefined } | undefined} the target + */ + getTarget(moduleGraph, resolveTargetFilter = RETURNS_TRUE) { + const result = this._getTarget(moduleGraph, resolveTargetFilter, undefined); + if (result === CIRCULAR) return undefined; + return result; + } -module.exports = class NoModeWarning extends WebpackError { - constructor() { - super(); + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {function({ module: Module, connection: ModuleGraphConnection, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target + * @param {Set | undefined} alreadyVisited set of already visited export info to avoid circular references + * @returns {{ module: Module, connection: ModuleGraphConnection, export: string[] | undefined } | CIRCULAR | undefined} the target + */ + _getTarget(moduleGraph, resolveTargetFilter, alreadyVisited) { + /** + * @param {{ connection: ModuleGraphConnection, export: string[] | undefined } | null} inputTarget unresolved target + * @param {Set} alreadyVisited set of already visited export info to avoid circular references + * @returns {{ module: Module, connection: ModuleGraphConnection, export: string[] | undefined } | CIRCULAR | null} resolved target + */ + const resolveTarget = (inputTarget, alreadyVisited) => { + if (!inputTarget) return null; + if (!inputTarget.export) { + return { + module: inputTarget.connection.module, + connection: inputTarget.connection, + export: undefined + }; + } + /** @type {{ module: Module, connection: ModuleGraphConnection, export: string[] | undefined }} */ + let target = { + module: inputTarget.connection.module, + connection: inputTarget.connection, + export: inputTarget.export + }; + if (!resolveTargetFilter(target)) return target; + let alreadyVisitedOwned = false; + for (;;) { + const exportsInfo = moduleGraph.getExportsInfo(target.module); + const exportInfo = exportsInfo.getExportInfo(target.export[0]); + if (!exportInfo) return target; + if (alreadyVisited.has(exportInfo)) return CIRCULAR; + const newTarget = exportInfo._getTarget( + moduleGraph, + resolveTargetFilter, + alreadyVisited + ); + if (newTarget === CIRCULAR) return CIRCULAR; + if (!newTarget) return target; + if (target.export.length === 1) { + target = newTarget; + if (!target.export) return target; + } else { + target = { + module: newTarget.module, + connection: newTarget.connection, + export: newTarget.export + ? newTarget.export.concat(target.export.slice(1)) + : target.export.slice(1) + }; + } + if (!resolveTargetFilter(target)) return target; + if (!alreadyVisitedOwned) { + alreadyVisited = new Set(alreadyVisited); + alreadyVisitedOwned = true; + } + alreadyVisited.add(exportInfo); + } + }; - this.name = "NoModeWarning"; - this.message = - "configuration\n" + - "The 'mode' option has not been set, webpack will fallback to 'production' for this value.\n" + - "Set 'mode' option to 'development' or 'production' to enable defaults for each environment.\n" + - "You can also set it to 'none' to disable any default behavior. " + - "Learn more: https://webpack.js.org/configuration/mode/"; + if (!this._target || this._target.size === 0) return undefined; + if (alreadyVisited && alreadyVisited.has(this)) return CIRCULAR; + const newAlreadyVisited = new Set(alreadyVisited); + newAlreadyVisited.add(this); + const values = this._getMaxTarget().values(); + const target = resolveTarget(values.next().value, newAlreadyVisited); + if (target === CIRCULAR) return CIRCULAR; + if (target === null) return undefined; + let result = values.next(); + while (!result.done) { + const t = resolveTarget(result.value, newAlreadyVisited); + if (t === CIRCULAR) return CIRCULAR; + if (t === null) return undefined; + if (t.module !== target.module) return undefined; + if (!t.export !== !target.export) return undefined; + if (target.export && !equals(t.export, target.export)) return undefined; + result = values.next(); + } + return target; } -}; + /** + * Move the target forward as long resolveTargetFilter is fulfilled + * @param {ModuleGraph} moduleGraph the module graph + * @param {function({ module: Module, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target + * @param {function({ module: Module, export: string[] | undefined }): ModuleGraphConnection=} updateOriginalConnection updates the original connection instead of using the target connection + * @returns {{ module: Module, export: string[] | undefined } | undefined} the resolved target when moved + */ + moveTarget(moduleGraph, resolveTargetFilter, updateOriginalConnection) { + const target = this._getTarget(moduleGraph, resolveTargetFilter, undefined); + if (target === CIRCULAR) return undefined; + if (!target) return undefined; + const originalTarget = this._getMaxTarget().values().next().value; + if ( + originalTarget.connection === target.connection && + originalTarget.export === target.export + ) { + return undefined; + } + this._target.clear(); + this._target.set(undefined, { + connection: updateOriginalConnection + ? updateOriginalConnection(target) + : target.connection, + export: target.export, + priority: 0 + }); + return target; + } -/***/ }), + createNestedExportsInfo() { + if (this.exportsInfoOwned) return this.exportsInfo; + this.exportsInfoOwned = true; + const oldExportsInfo = this.exportsInfo; + this.exportsInfo = new ExportsInfo(); + this.exportsInfo.setHasProvideInfo(); + if (oldExportsInfo) { + this.exportsInfo.setRedirectNamedTo(oldExportsInfo); + } + return this.exportsInfo; + } -/***/ 6325: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + getNestedExportsInfo() { + return this.exportsInfo; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ + hasInfo(baseInfo, runtime) { + return ( + (this._usedName && this._usedName !== this.name) || + this.provided || + this.terminalBinding || + this.getUsed(runtime) !== baseInfo.getUsed(runtime) + ); + } + updateHash(hash, runtime) { + this._updateHash(hash, runtime, new Set()); + } + _updateHash(hash, runtime, alreadyVisitedExportsInfo) { + hash.update( + `${this._usedName || this.name}${this.getUsed(runtime)}${this.provided}${ + this.terminalBinding + }` + ); + if (this.exportsInfo && !alreadyVisitedExportsInfo.has(this.exportsInfo)) { + this.exportsInfo._updateHash(hash, runtime, alreadyVisitedExportsInfo); + } + } -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); + getUsedInfo() { + if (this._globalUsed !== undefined) { + switch (this._globalUsed) { + case UsageState.Unused: + return "unused"; + case UsageState.NoInfo: + return "no usage info"; + case UsageState.Unknown: + return "maybe used (runtime-defined)"; + case UsageState.Used: + return "used"; + case UsageState.OnlyPropertiesUsed: + return "only properties used"; + } + } else if (this._usedInRuntime !== undefined) { + /** @type {Map} */ + const map = new Map(); + for (const [runtime, used] of this._usedInRuntime) { + const list = map.get(used); + if (list !== undefined) list.push(runtime); + else map.set(used, [runtime]); + } + const specificInfo = Array.from(map, ([used, runtimes]) => { + switch (used) { + case UsageState.NoInfo: + return `no usage info in ${runtimes.join(", ")}`; + case UsageState.Unknown: + return `maybe used in ${runtimes.join(", ")} (runtime-defined)`; + case UsageState.Used: + return `used in ${runtimes.join(", ")}`; + case UsageState.OnlyPropertiesUsed: + return `only properties used in ${runtimes.join(", ")}`; + } + }); + if (specificInfo.length > 0) { + return specificInfo.join("; "); + } + } + return this._hasUseInRuntimeInfo ? "unused" : "no usage info"; + } -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ + getProvidedInfo() { + switch (this.provided) { + case undefined: + return "no provided info"; + case null: + return "maybe provided (runtime-defined)"; + case true: + return "provided"; + case false: + return "not provided"; + } + } -class NodeStuffInWebError extends WebpackError { - /** - * @param {DependencyLocation} loc loc - * @param {string} expression expression - * @param {string} description description - */ - constructor(loc, expression, description) { - super( - `${JSON.stringify( - expression - )} has been used, it will be undefined in next major version. -${description}` + getRenameInfo() { + if (this._usedName !== null && this._usedName !== this.name) { + return `renamed to ${JSON.stringify(this._usedName).slice(1, -1)}`; + } + switch (this.canMangleProvide) { + case undefined: + switch (this.canMangleUse) { + case undefined: + return "missing provision and use info prevents renaming"; + case false: + return "usage prevents renaming (no provision info)"; + case true: + return "missing provision info prevents renaming"; + } + break; + case true: + switch (this.canMangleUse) { + case undefined: + return "missing usage info prevents renaming"; + case false: + return "usage prevents renaming"; + case true: + return "could be renamed"; + } + break; + case false: + switch (this.canMangleUse) { + case undefined: + return "provision prevents renaming (no use info)"; + case false: + return "usage and provision prevents renaming"; + case true: + return "provision prevents renaming"; + } + break; + } + throw new Error( + `Unexpected flags for getRenameInfo ${this.canMangleProvide} ${this.canMangleUse}` ); - - this.name = "NodeStuffInWebError"; - this.loc = loc; } } -makeSerializable(NodeStuffInWebError, "webpack/lib/NodeStuffInWebError"); - -module.exports = NodeStuffInWebError; +module.exports = ExportsInfo; +module.exports.ExportInfo = ExportInfo; +module.exports.UsageState = UsageState; /***/ }), -/***/ 95287: +/***/ 7145: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -48282,180 +43063,75 @@ module.exports = NodeStuffInWebError; -const NodeStuffInWebError = __webpack_require__(6325); -const RuntimeGlobals = __webpack_require__(16475); -const CachedConstDependency = __webpack_require__(57403); const ConstDependency = __webpack_require__(76911); -const { - evaluateToString, - expressionIsUnsupported -} = __webpack_require__(93998); -const { relative } = __webpack_require__(17139); -const { parseResource } = __webpack_require__(82186); +const ExportsInfoDependency = __webpack_require__(78988); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ /** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ - -class NodeStuffPlugin { - constructor(options) { - this.options = options; - } +/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ +class ExportsInfoApiPlugin { /** * Apply the plugin * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { - const options = this.options; compiler.hooks.compilation.tap( - "NodeStuffPlugin", + "ExportsInfoApiPlugin", (compilation, { normalModuleFactory }) => { - const handler = (parser, parserOptions) => { - if (parserOptions.node === false) return; - - let localOptions = options; - if (parserOptions.node) { - localOptions = { ...localOptions, ...parserOptions.node }; - } - - if (localOptions.global !== false) { - const withWarning = localOptions.global === "warn"; - parser.hooks.expression - .for("global") - .tap("NodeStuffPlugin", expr => { - const dep = new ConstDependency( - RuntimeGlobals.global, - expr.range, - [RuntimeGlobals.global] - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - - // TODO webpack 6 remove - if (withWarning) { - parser.state.module.addWarning( - new NodeStuffInWebError( - dep.loc, - "global", - "The global namespace object is Node.js feature and doesn't present in browser." - ) - ); - } - }); - } - - const setModuleConstant = (expressionName, fn, warning) => { - parser.hooks.expression - .for(expressionName) - .tap("NodeStuffPlugin", expr => { - const dep = new CachedConstDependency( - JSON.stringify(fn(parser.state.module)), - expr.range, - expressionName - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - - // TODO webpack 6 remove - if (warning) { - parser.state.module.addWarning( - new NodeStuffInWebError(dep.loc, expressionName, warning) - ); - } - - return true; - }); - }; - - const setConstant = (expressionName, value, warning) => - setModuleConstant(expressionName, () => value, warning); - - const context = compiler.context; - if (localOptions.__filename) { - switch (localOptions.__filename) { - case "mock": - setConstant("__filename", "/index.js"); - break; - case "warn-mock": - setConstant( - "__filename", - "/index.js", - "The __filename is Node.js feature and doesn't present in browser." - ); - break; - case true: - setModuleConstant("__filename", module => - relative(compiler.inputFileSystem, context, module.resource) - ); - break; - } - - parser.hooks.evaluateIdentifier - .for("__filename") - .tap("NodeStuffPlugin", expr => { - if (!parser.state.module) return; - const resource = parseResource(parser.state.module.resource); - return evaluateToString(resource.path)(expr); - }); - } - if (localOptions.__dirname) { - switch (localOptions.__dirname) { - case "mock": - setConstant("__dirname", "/"); - break; - case "warn-mock": - setConstant( - "__dirname", - "/", - "The __dirname is Node.js feature and doesn't present in browser." - ); - break; - case true: - setModuleConstant("__dirname", module => - relative(compiler.inputFileSystem, context, module.context) - ); - break; - } - - parser.hooks.evaluateIdentifier - .for("__dirname") - .tap("NodeStuffPlugin", expr => { - if (!parser.state.module) return; - return evaluateToString(parser.state.module.context)(expr); - }); - } + compilation.dependencyTemplates.set( + ExportsInfoDependency, + new ExportsInfoDependency.Template() + ); + /** + * @param {JavascriptParser} parser the parser + * @returns {void} + */ + const handler = parser => { + parser.hooks.expressionMemberChain + .for("__webpack_exports_info__") + .tap("ExportsInfoApiPlugin", (expr, members) => { + const dep = + members.length >= 2 + ? new ExportsInfoDependency( + expr.range, + members.slice(0, -1), + members[members.length - 1] + ) + : new ExportsInfoDependency(expr.range, null, members[0]); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + return true; + }); parser.hooks.expression - .for("require.extensions") - .tap( - "NodeStuffPlugin", - expressionIsUnsupported( - parser, - "require.extensions is not supported by webpack. Use a loader instead." - ) - ); + .for("__webpack_exports_info__") + .tap("ExportsInfoApiPlugin", expr => { + const dep = new ConstDependency("true", expr.range); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); }; - normalModuleFactory.hooks.parser .for("javascript/auto") - .tap("NodeStuffPlugin", handler); + .tap("ExportsInfoApiPlugin", handler); normalModuleFactory.hooks.parser .for("javascript/dynamic") - .tap("NodeStuffPlugin", handler); + .tap("ExportsInfoApiPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("ExportsInfoApiPlugin", handler); } ); } } -module.exports = NodeStuffPlugin; +module.exports = ExportsInfoApiPlugin; /***/ }), -/***/ 39: +/***/ 73071: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -48466,430 +43142,500 @@ module.exports = NodeStuffPlugin; -const parseJson = __webpack_require__(15235); -const { getContext, runLoaders } = __webpack_require__(8255); -const querystring = __webpack_require__(63477); -const { HookMap, SyncHook, AsyncSeriesBailHook } = __webpack_require__(6967); -const { - CachedSource, - OriginalSource, - RawSource, - SourceMapSource -} = __webpack_require__(51255); -const Compilation = __webpack_require__(85720); -const HookWebpackError = __webpack_require__(11351); +const { OriginalSource, RawSource } = __webpack_require__(51255); +const ConcatenationScope = __webpack_require__(98229); +const { UsageState } = __webpack_require__(63686); +const InitFragment = __webpack_require__(55870); const Module = __webpack_require__(73208); -const ModuleBuildError = __webpack_require__(21305); -const ModuleError = __webpack_require__(23744); -const ModuleGraphConnection = __webpack_require__(40639); -const ModuleParseError = __webpack_require__(58443); -const ModuleWarning = __webpack_require__(11234); const RuntimeGlobals = __webpack_require__(16475); -const UnhandledSchemeError = __webpack_require__(68099); -const WebpackError = __webpack_require__(53799); -const formatLocation = __webpack_require__(16734); -const LazySet = __webpack_require__(38938); -const { isSubset } = __webpack_require__(93347); -const { getScheme } = __webpack_require__(54500); -const { - compareLocations, - concatComparators, - compareSelect, - keepOriginalOrder -} = __webpack_require__(29579); +const Template = __webpack_require__(39722); +const StaticExportsDependency = __webpack_require__(91418); const createHash = __webpack_require__(49835); -const { createFakeHook } = __webpack_require__(64518); -const { join } = __webpack_require__(17139); -const { - contextify, - absolutify, - makePathsRelative -} = __webpack_require__(82186); +const extractUrlAndGlobal = __webpack_require__(11850); const makeSerializable = __webpack_require__(33032); -const memoize = __webpack_require__(78676); +const propertyAccess = __webpack_require__(54190); +const { register } = __webpack_require__(8282); /** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/LoaderContext").NormalModuleLoaderContext} NormalModuleLoaderContext */ -/** @typedef {import("../declarations/WebpackOptions").Mode} Mode */ /** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./Chunk")} Chunk */ /** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Compilation")} Compilation */ /** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ /** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./Generator")} Generator */ +/** @typedef {import("./ExportsInfo")} ExportsInfo */ /** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ /** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ /** @typedef {import("./Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ /** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ /** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */ /** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ -/** @typedef {import("./Parser")} Parser */ /** @typedef {import("./RequestShortener")} RequestShortener */ /** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./logging/Logger").Logger} WebpackLogger */ +/** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */ /** @typedef {import("./util/Hash")} Hash */ +/** @typedef {typeof import("./util/Hash")} HashConstructor */ /** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ /** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ /** - * @typedef {Object} SourceMap - * @property {number} version - * @property {string[]} sources - * @property {string} mappings - * @property {string=} file - * @property {string=} sourceRoot - * @property {string[]=} sourcesContent - * @property {string[]=} names + * @typedef {Object} SourceData + * @property {boolean=} iife + * @property {string=} init + * @property {string} expression + * @property {InitFragment[]=} chunkInitFragments + * @property {ReadonlySet=} runtimeRequirements */ -const getInvalidDependenciesModuleWarning = memoize(() => - __webpack_require__(68257) -); -const getValidate = memoize(() => (__webpack_require__(38476).validate)); - -const ABSOLUTE_PATH_REGEX = /^([a-zA-Z]:\\|\\\\|\/)/; +const TYPES = new Set(["javascript"]); +const CSS_TYPES = new Set(["css-import"]); +const RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]); +const RUNTIME_REQUIREMENTS_FOR_SCRIPT = new Set([RuntimeGlobals.loadScript]); +const RUNTIME_REQUIREMENTS_FOR_MODULE = new Set([ + RuntimeGlobals.definePropertyGetters +]); +const EMPTY_RUNTIME_REQUIREMENTS = new Set([]); /** - * @typedef {Object} LoaderItem - * @property {string} loader - * @property {any} options - * @property {string?} ident - * @property {string?} type + * @param {string|string[]} variableName the variable name or path + * @param {string} type the module system + * @returns {SourceData} the generated source */ +const getSourceForGlobalVariableExternal = (variableName, type) => { + if (!Array.isArray(variableName)) { + // make it an array as the look up works the same basically + variableName = [variableName]; + } -/** - * @param {string} context absolute context path - * @param {string} source a source path - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {string} new source path - */ -const contextifySourceUrl = (context, source, associatedObjectForCache) => { - if (source.startsWith("webpack://")) return source; - return `webpack://${makePathsRelative( - context, - source, - associatedObjectForCache - )}`; + // needed for e.g. window["some"]["thing"] + const objectLookup = variableName.map(r => `[${JSON.stringify(r)}]`).join(""); + return { + iife: type === "this", + expression: `${type}${objectLookup}` + }; }; /** - * @param {string} context absolute context path - * @param {SourceMap} sourceMap a source map - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {SourceMap} new source map + * @param {string|string[]} moduleAndSpecifiers the module request + * @returns {SourceData} the generated source */ -const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => { - if (!Array.isArray(sourceMap.sources)) return sourceMap; - const { sourceRoot } = sourceMap; - /** @type {function(string): string} */ - const mapper = !sourceRoot - ? source => source - : sourceRoot.endsWith("/") - ? source => - source.startsWith("/") - ? `${sourceRoot.slice(0, -1)}${source}` - : `${sourceRoot}${source}` - : source => - source.startsWith("/") - ? `${sourceRoot}${source}` - : `${sourceRoot}/${source}`; - const newSources = sourceMap.sources.map(source => - contextifySourceUrl(context, mapper(source), associatedObjectForCache) - ); +const getSourceForCommonJsExternal = moduleAndSpecifiers => { + if (!Array.isArray(moduleAndSpecifiers)) { + return { + expression: `require(${JSON.stringify(moduleAndSpecifiers)})` + }; + } + const moduleName = moduleAndSpecifiers[0]; return { - ...sourceMap, - file: "x", - sourceRoot: undefined, - sources: newSources + expression: `require(${JSON.stringify(moduleName)})${propertyAccess( + moduleAndSpecifiers, + 1 + )}` }; }; /** - * @param {string | Buffer} input the input - * @returns {string} the converted string + * @param {string|string[]} moduleAndSpecifiers the module request + * @returns {SourceData} the generated source */ -const asString = input => { - if (Buffer.isBuffer(input)) { - return input.toString("utf-8"); +const getSourceForCommonJsExternalInNodeModule = moduleAndSpecifiers => { + const chunkInitFragments = [ + new InitFragment( + 'import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";\n', + InitFragment.STAGE_HARMONY_IMPORTS, + 0, + "external module node-commonjs" + ) + ]; + if (!Array.isArray(moduleAndSpecifiers)) { + return { + expression: `__WEBPACK_EXTERNAL_createRequire(import.meta.url)(${JSON.stringify( + moduleAndSpecifiers + )})`, + chunkInitFragments + }; } - return input; + const moduleName = moduleAndSpecifiers[0]; + return { + expression: `__WEBPACK_EXTERNAL_createRequire(import.meta.url)(${JSON.stringify( + moduleName + )})${propertyAccess(moduleAndSpecifiers, 1)}`, + chunkInitFragments + }; }; /** - * @param {string | Buffer} input the input - * @returns {Buffer} the converted buffer + * @param {string|string[]} moduleAndSpecifiers the module request + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @returns {SourceData} the generated source */ -const asBuffer = input => { - if (!Buffer.isBuffer(input)) { - return Buffer.from(input, "utf-8"); +const getSourceForImportExternal = (moduleAndSpecifiers, runtimeTemplate) => { + const importName = runtimeTemplate.outputOptions.importFunctionName; + if (!runtimeTemplate.supportsDynamicImport() && importName === "import") { + throw new Error( + "The target environment doesn't support 'import()' so it's not possible to use external type 'import'" + ); } - return input; + if (!Array.isArray(moduleAndSpecifiers)) { + return { + expression: `${importName}(${JSON.stringify(moduleAndSpecifiers)});` + }; + } + if (moduleAndSpecifiers.length === 1) { + return { + expression: `${importName}(${JSON.stringify(moduleAndSpecifiers[0])});` + }; + } + const moduleName = moduleAndSpecifiers[0]; + return { + expression: `${importName}(${JSON.stringify( + moduleName + )}).then(${runtimeTemplate.returningFunction( + `module${propertyAccess(moduleAndSpecifiers, 1)}`, + "module" + )});` + }; }; -class NonErrorEmittedError extends WebpackError { - constructor(error) { - super(); +class ModuleExternalInitFragment extends InitFragment { + /** + * @param {string} request import source + * @param {string=} ident recomputed ident + * @param {string | HashConstructor=} hashFunction the hash function to use + */ + constructor(request, ident, hashFunction = "md4") { + if (ident === undefined) { + ident = Template.toIdentifier(request); + if (ident !== request) { + ident += `_${createHash(hashFunction) + .update(request) + .digest("hex") + .slice(0, 8)}`; + } + } + const identifier = `__WEBPACK_EXTERNAL_MODULE_${ident}__`; + super( + `import * as ${identifier} from ${JSON.stringify(request)};\n`, + InitFragment.STAGE_HARMONY_IMPORTS, + 0, + `external module import ${ident}` + ); + this._ident = ident; + this._identifier = identifier; + this._request = request; + } - this.name = "NonErrorEmittedError"; - this.message = "(Emitted value instead of an instance of Error) " + error; + getNamespaceIdentifier() { + return this._identifier; } } -makeSerializable( - NonErrorEmittedError, - "webpack/lib/NormalModule", - "NonErrorEmittedError" +register( + ModuleExternalInitFragment, + "webpack/lib/ExternalModule", + "ModuleExternalInitFragment", + { + serialize(obj, { write }) { + write(obj._request); + write(obj._ident); + }, + deserialize({ read }) { + return new ModuleExternalInitFragment(read(), read()); + } + } ); -/** - * @typedef {Object} NormalModuleCompilationHooks - * @property {SyncHook<[object, NormalModule]>} loader - * @property {SyncHook<[LoaderItem[], NormalModule, object]>} beforeLoaders - * @property {SyncHook<[NormalModule]>} beforeParse - * @property {SyncHook<[NormalModule]>} beforeSnapshot - * @property {HookMap>} readResourceForScheme - * @property {HookMap>} readResource - * @property {AsyncSeriesBailHook<[NormalModule, NeedBuildContext], boolean>} needBuild - */ - -/** @type {WeakMap} */ -const compilationHooksMap = new WeakMap(); - -class NormalModule extends Module { - /** - * @param {Compilation} compilation the compilation - * @returns {NormalModuleCompilationHooks} the attached hooks - */ - static getCompilationHooks(compilation) { - if (!(compilation instanceof Compilation)) { - throw new TypeError( - "The 'compilation' argument must be an instance of Compilation" +const generateModuleRemapping = (input, exportsInfo, runtime) => { + if (exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused) { + const properties = []; + for (const exportInfo of exportsInfo.orderedExports) { + const used = exportInfo.getUsedName(exportInfo.name, runtime); + if (!used) continue; + const nestedInfo = exportInfo.getNestedExportsInfo(); + if (nestedInfo) { + const nestedExpr = generateModuleRemapping( + `${input}${propertyAccess([exportInfo.name])}`, + nestedInfo + ); + if (nestedExpr) { + properties.push(`[${JSON.stringify(used)}]: y(${nestedExpr})`); + continue; + } + } + properties.push( + `[${JSON.stringify(used)}]: () => ${input}${propertyAccess([ + exportInfo.name + ])}` ); } - let hooks = compilationHooksMap.get(compilation); - if (hooks === undefined) { - hooks = { - loader: new SyncHook(["loaderContext", "module"]), - beforeLoaders: new SyncHook(["loaders", "module", "loaderContext"]), - beforeParse: new SyncHook(["module"]), - beforeSnapshot: new SyncHook(["module"]), - // TODO webpack 6 deprecate - readResourceForScheme: new HookMap(scheme => { - const hook = hooks.readResource.for(scheme); - return createFakeHook( - /** @type {AsyncSeriesBailHook<[string, NormalModule], string | Buffer>} */ ({ - tap: (options, fn) => - hook.tap(options, loaderContext => - fn(loaderContext.resource, loaderContext._module) - ), - tapAsync: (options, fn) => - hook.tapAsync(options, (loaderContext, callback) => - fn(loaderContext.resource, loaderContext._module, callback) - ), - tapPromise: (options, fn) => - hook.tapPromise(options, loaderContext => - fn(loaderContext.resource, loaderContext._module) - ) - }) - ); - }), - readResource: new HookMap( - () => new AsyncSeriesBailHook(["loaderContext"]) - ), - needBuild: new AsyncSeriesBailHook(["module", "context"]) - }; - compilationHooksMap.set(compilation, hooks); - } - return hooks; + return `x({ ${properties.join(", ")} })`; } +}; - /** - * @param {Object} options options object - * @param {string=} options.layer an optional layer in which the module is - * @param {string} options.type module type - * @param {string} options.request request string - * @param {string} options.userRequest request intended by user (without loaders from config) - * @param {string} options.rawRequest request without resolving - * @param {LoaderItem[]} options.loaders list of loaders - * @param {string} options.resource path + query of the real resource - * @param {Record=} options.resourceResolveData resource resolve data - * @param {string} options.context context directory for resolving - * @param {string | undefined} options.matchResource path + query of the matched resource (virtual) - * @param {Parser} options.parser the parser used - * @param {object} options.parserOptions the options of the parser used - * @param {Generator} options.generator the generator used - * @param {object} options.generatorOptions the options of the generator used - * @param {Object} options.resolveOptions options used for resolving requests from this module - */ - constructor({ - layer, - type, - request, - userRequest, - rawRequest, - loaders, - resource, - resourceResolveData, - context, - matchResource, - parser, - parserOptions, - generator, - generatorOptions, - resolveOptions - }) { - super(type, context || getContext(resource), layer); +/** + * @param {string|string[]} moduleAndSpecifiers the module request + * @param {ExportsInfo} exportsInfo exports info of this module + * @param {RuntimeSpec} runtime the runtime + * @param {string | HashConstructor=} hashFunction the hash function to use + * @returns {SourceData} the generated source + */ +const getSourceForModuleExternal = ( + moduleAndSpecifiers, + exportsInfo, + runtime, + hashFunction +) => { + if (!Array.isArray(moduleAndSpecifiers)) + moduleAndSpecifiers = [moduleAndSpecifiers]; + const initFragment = new ModuleExternalInitFragment( + moduleAndSpecifiers[0], + undefined, + hashFunction + ); + const baseAccess = `${initFragment.getNamespaceIdentifier()}${propertyAccess( + moduleAndSpecifiers, + 1 + )}`; + const moduleRemapping = generateModuleRemapping( + baseAccess, + exportsInfo, + runtime + ); + let expression = moduleRemapping || baseAccess; + return { + expression, + init: `var x = y => { var x = {}; ${RuntimeGlobals.definePropertyGetters}(x, y); return x; }\nvar y = x => () => x`, + runtimeRequirements: moduleRemapping + ? RUNTIME_REQUIREMENTS_FOR_MODULE + : undefined, + chunkInitFragments: [initFragment] + }; +}; + +/** + * @param {string|string[]} urlAndGlobal the script request + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @returns {SourceData} the generated source + */ +const getSourceForScriptExternal = (urlAndGlobal, runtimeTemplate) => { + if (typeof urlAndGlobal === "string") { + urlAndGlobal = extractUrlAndGlobal(urlAndGlobal); + } + const url = urlAndGlobal[0]; + const globalName = urlAndGlobal[1]; + return { + init: "var __webpack_error__ = new Error();", + expression: `new Promise(${runtimeTemplate.basicFunction( + "resolve, reject", + [ + `if(typeof ${globalName} !== "undefined") return resolve();`, + `${RuntimeGlobals.loadScript}(${JSON.stringify( + url + )}, ${runtimeTemplate.basicFunction("event", [ + `if(typeof ${globalName} !== "undefined") return resolve();`, + "var errorType = event && (event.type === 'load' ? 'missing' : event.type);", + "var realSrc = event && event.target && event.target.src;", + "__webpack_error__.message = 'Loading script failed.\\n(' + errorType + ': ' + realSrc + ')';", + "__webpack_error__.name = 'ScriptExternalLoadError';", + "__webpack_error__.type = errorType;", + "__webpack_error__.request = realSrc;", + "reject(__webpack_error__);" + ])}, ${JSON.stringify(globalName)});` + ] + )}).then(${runtimeTemplate.returningFunction( + `${globalName}${propertyAccess(urlAndGlobal, 2)}` + )})`, + runtimeRequirements: RUNTIME_REQUIREMENTS_FOR_SCRIPT + }; +}; + +/** + * @param {string} variableName the variable name to check + * @param {string} request the request path + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @returns {string} the generated source + */ +const checkExternalVariable = (variableName, request, runtimeTemplate) => { + return `if(typeof ${variableName} === 'undefined') { ${runtimeTemplate.throwMissingModuleErrorBlock( + { request } + )} }\n`; +}; + +/** + * @param {string|number} id the module id + * @param {boolean} optional true, if the module is optional + * @param {string|string[]} request the request path + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @returns {SourceData} the generated source + */ +const getSourceForAmdOrUmdExternal = ( + id, + optional, + request, + runtimeTemplate +) => { + const externalVariable = `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( + `${id}` + )}__`; + return { + init: optional + ? checkExternalVariable( + externalVariable, + Array.isArray(request) ? request.join(".") : request, + runtimeTemplate + ) + : undefined, + expression: externalVariable + }; +}; + +/** + * @param {boolean} optional true, if the module is optional + * @param {string|string[]} request the request path + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @returns {SourceData} the generated source + */ +const getSourceForDefaultCase = (optional, request, runtimeTemplate) => { + if (!Array.isArray(request)) { + // make it an array as the look up works the same basically + request = [request]; + } + + const variableName = request[0]; + const objectLookup = propertyAccess(request, 1); + return { + init: optional + ? checkExternalVariable(variableName, request.join("."), runtimeTemplate) + : undefined, + expression: `${variableName}${objectLookup}` + }; +}; + +class ExternalModule extends Module { + constructor(request, type, userRequest) { + super("javascript/dynamic", null); // Info from Factory - /** @type {string} */ + /** @type {string | string[] | Record} */ this.request = request; /** @type {string} */ - this.userRequest = userRequest; - /** @type {string} */ - this.rawRequest = rawRequest; - /** @type {boolean} */ - this.binary = /^(asset|webassembly)\b/.test(type); - /** @type {Parser} */ - this.parser = parser; - this.parserOptions = parserOptions; - /** @type {Generator} */ - this.generator = generator; - this.generatorOptions = generatorOptions; + this.externalType = type; /** @type {string} */ - this.resource = resource; - this.resourceResolveData = resourceResolveData; - /** @type {string | undefined} */ - this.matchResource = matchResource; - /** @type {LoaderItem[]} */ - this.loaders = loaders; - if (resolveOptions !== undefined) { - // already declared in super class - this.resolveOptions = resolveOptions; - } - - // Info from Build - /** @type {(WebpackError | null)=} */ - this.error = null; - /** @private @type {Source=} */ - this._source = null; - /** @private @type {Map | undefined} **/ - this._sourceSizes = undefined; - /** @private @type {Set} */ - this._sourceTypes = undefined; - - // Cache - this._lastSuccessfulBuildMeta = {}; - this._forceBuild = true; - this._isEvaluatingSideEffects = false; - /** @type {WeakSet | undefined} */ - this._addedSideEffectsBailout = undefined; + this.userRequest = userRequest; } /** - * @returns {string} a unique identifier of the module + * @returns {Set} types available (do not mutate) */ - identifier() { - if (this.layer === null) { - if (this.type === "javascript/auto") { - return this.request; - } else { - return `${this.type}|${this.request}`; - } - } else { - return `${this.type}|${this.request}|${this.layer}`; - } + getSourceTypes() { + return this.externalType === "css-import" ? CSS_TYPES : TYPES; } /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion */ - readableIdentifier(requestShortener) { - return requestShortener.shorten(this.userRequest); + libIdent(options) { + return this.userRequest; } /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion + * @param {Chunk} chunk the chunk which condition should be checked + * @param {Compilation} compilation the compilation + * @returns {boolean} true, if the chunk is ok for the module */ - libIdent(options) { - let ident = contextify( - options.context, - this.userRequest, - options.associatedObjectForCache - ); - if (this.layer) ident = `(${this.layer})/${ident}`; - return ident; + chunkCondition(chunk, { chunkGraph }) { + return this.externalType === "css-import" + ? true + : chunkGraph.getNumberOfEntryModules(chunk) > 0; } /** - * @returns {string | null} absolute path which should be used for condition matching (usually the resource path) + * @returns {string} a unique identifier of the module */ - nameForCondition() { - const resource = this.matchResource || this.resource; - const idx = resource.indexOf("?"); - if (idx >= 0) return resource.substr(0, idx); - return resource; + identifier() { + return `external ${this.externalType} ${JSON.stringify(this.request)}`; } /** - * Assuming this module is in the cache. Update the (cached) module with - * the fresh module from the factory. Usually updates internal references - * and properties. - * @param {Module} module fresh module - * @returns {void} + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module */ - updateCacheModule(module) { - super.updateCacheModule(module); - const m = /** @type {NormalModule} */ (module); - this.binary = m.binary; - this.request = m.request; - this.userRequest = m.userRequest; - this.rawRequest = m.rawRequest; - this.parser = m.parser; - this.parserOptions = m.parserOptions; - this.generator = m.generator; - this.generatorOptions = m.generatorOptions; - this.resource = m.resource; - this.resourceResolveData = m.resourceResolveData; - this.context = m.context; - this.matchResource = m.matchResource; - this.loaders = m.loaders; + readableIdentifier(requestShortener) { + return "external " + JSON.stringify(this.request); } /** - * Assuming this module is in the cache. Remove internal references to allow freeing some memory. + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} */ - cleanupForCache() { - // Make sure to cache types and sizes before cleanup when this module has been built - // They are accessed by the stats and we don't want them to crash after cleanup - // TODO reconsider this for webpack 6 - if (this.buildInfo) { - if (this._sourceTypes === undefined) this.getSourceTypes(); - for (const type of this._sourceTypes) { - this.size(type); - } - } - super.cleanupForCache(); - this.parser = undefined; - this.parserOptions = undefined; - this.generator = undefined; - this.generatorOptions = undefined; + needBuild(context, callback) { + return callback(null, !this.buildMeta); } /** - * Module should be unsafe cached. Get data that's needed for that. - * This data will be passed to restoreFromUnsafeCache later. - * @returns {object} cached data + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} */ - getUnsafeCacheData() { - const data = super.getUnsafeCacheData(); - data.parserOptions = this.parserOptions; - data.generatorOptions = this.generatorOptions; - return data; + build(options, compilation, resolver, fs, callback) { + this.buildMeta = { + async: false, + exportsType: undefined + }; + this.buildInfo = { + strict: true, + topLevelDeclarations: new Set(), + module: compilation.outputOptions.module + }; + const { request, externalType } = this._getRequestAndExternalType(); + this.buildMeta.exportsType = "dynamic"; + let canMangle = false; + this.clearDependenciesAndBlocks(); + switch (externalType) { + case "this": + this.buildInfo.strict = false; + break; + case "system": + if (!Array.isArray(request) || request.length === 1) { + this.buildMeta.exportsType = "namespace"; + canMangle = true; + } + break; + case "module": + if (this.buildInfo.module) { + if (!Array.isArray(request) || request.length === 1) { + this.buildMeta.exportsType = "namespace"; + canMangle = true; + } + } else { + this.buildMeta.async = true; + if (!Array.isArray(request) || request.length === 1) { + this.buildMeta.exportsType = "namespace"; + canMangle = false; + } + } + break; + case "script": + case "promise": + this.buildMeta.async = true; + break; + case "import": + this.buildMeta.async = true; + if (!Array.isArray(request) || request.length === 1) { + this.buildMeta.exportsType = "namespace"; + canMangle = false; + } + break; + } + this.addDependency(new StaticExportsDependency(true, canMangle)); + callback(); } restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory) { @@ -48897,4108 +43643,4135 @@ class NormalModule extends Module { } /** - * restore unsafe cache data - * @param {object} unsafeCacheData data from getUnsafeCacheData - * @param {NormalModuleFactory} normalModuleFactory the normal module factory handling the unsafe caching + * @param {ConcatenationBailoutReasonContext} context context + * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated */ - _restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory) { - super._restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory); - this.parserOptions = unsafeCacheData.parserOptions; - this.parser = normalModuleFactory.getParser(this.type, this.parserOptions); - this.generatorOptions = unsafeCacheData.generatorOptions; - this.generator = normalModuleFactory.getGenerator( - this.type, - this.generatorOptions - ); - // we assume the generator behaves identically and keep cached sourceTypes/Sizes + getConcatenationBailoutReason({ moduleGraph }) { + switch (this.externalType) { + case "amd": + case "amd-require": + case "umd": + case "umd2": + case "system": + case "jsonp": + return `${this.externalType} externals can't be concatenated`; + } + return undefined; } - /** - * @param {string} context the compilation context - * @param {string} name the asset name - * @param {string} content the content - * @param {string | TODO} sourceMap an optional source map - * @param {Object=} associatedObjectForCache object for caching - * @returns {Source} the created source - */ - createSourceForAsset( - context, - name, - content, - sourceMap, - associatedObjectForCache + _getRequestAndExternalType() { + let { request, externalType } = this; + if (typeof request === "object" && !Array.isArray(request)) + request = request[externalType]; + return { request, externalType }; + } + + _getSourceData( + request, + externalType, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtime ) { - if (sourceMap) { - if ( - typeof sourceMap === "string" && - (this.useSourceMap || this.useSimpleSourceMap) - ) { - return new OriginalSource( - content, - contextifySourceUrl(context, sourceMap, associatedObjectForCache) + switch (externalType) { + case "this": + case "window": + case "self": + return getSourceForGlobalVariableExternal(request, this.externalType); + case "global": + return getSourceForGlobalVariableExternal( + request, + runtimeTemplate.globalObject + ); + case "commonjs": + case "commonjs2": + case "commonjs-module": + case "commonjs-static": + return getSourceForCommonJsExternal(request); + case "node-commonjs": + return this.buildInfo.module + ? getSourceForCommonJsExternalInNodeModule(request) + : getSourceForCommonJsExternal(request); + case "amd": + case "amd-require": + case "umd": + case "umd2": + case "system": + case "jsonp": { + const id = chunkGraph.getModuleId(this); + return getSourceForAmdOrUmdExternal( + id !== null ? id : this.identifier(), + this.isOptional(moduleGraph), + request, + runtimeTemplate ); } - - if (this.useSourceMap) { - return new SourceMapSource( - content, - name, - contextifySourceMap(context, sourceMap, associatedObjectForCache) + case "import": + return getSourceForImportExternal(request, runtimeTemplate); + case "script": + return getSourceForScriptExternal(request, runtimeTemplate); + case "module": { + if (!this.buildInfo.module) { + if (!runtimeTemplate.supportsDynamicImport()) { + throw new Error( + "The target environment doesn't support dynamic import() syntax so it's not possible to use external type 'module' within a script" + + (runtimeTemplate.supportsEcmaScriptModuleSyntax() + ? "\nDid you mean to build a EcmaScript Module ('output.module: true')?" + : "") + ); + } + return getSourceForImportExternal(request, runtimeTemplate); + } + if (!runtimeTemplate.supportsEcmaScriptModuleSyntax()) { + throw new Error( + "The target environment doesn't support EcmaScriptModule syntax so it's not possible to use external type 'module'" + ); + } + return getSourceForModuleExternal( + request, + moduleGraph.getExportsInfo(this), + runtime, + runtimeTemplate.outputOptions.hashFunction ); } + case "var": + case "promise": + case "const": + case "let": + case "assign": + default: + return getSourceForDefaultCase( + this.isOptional(moduleGraph), + request, + runtimeTemplate + ); } - - return new RawSource(content); } /** - * @param {ResolverWithOptions} resolver a resolver - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {InputFileSystem} fs file system from reading - * @param {NormalModuleCompilationHooks} hooks the hooks - * @returns {NormalModuleLoaderContext} loader context + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result */ - _createLoaderContext(resolver, options, compilation, fs, hooks) { - const { requestShortener } = compilation.runtimeTemplate; - const getCurrentLoaderName = () => { - const currentLoader = this.getCurrentLoader(loaderContext); - if (!currentLoader) return "(not in loader scope)"; - return requestShortener.shorten(currentLoader.loader); - }; - const getResolveContext = () => { - return { - fileDependencies: { - add: d => loaderContext.addDependency(d) - }, - contextDependencies: { - add: d => loaderContext.addContextDependency(d) - }, - missingDependencies: { - add: d => loaderContext.addMissingDependency(d) - } - }; - }; - const getAbsolutify = memoize(() => - absolutify.bindCache(compilation.compiler.root) - ); - const getAbsolutifyInContext = memoize(() => - absolutify.bindContextCache(this.context, compilation.compiler.root) - ); - const getContextify = memoize(() => - contextify.bindCache(compilation.compiler.root) - ); - const getContextifyInContext = memoize(() => - contextify.bindContextCache(this.context, compilation.compiler.root) - ); - const utils = { - absolutify: (context, request) => { - return context === this.context - ? getAbsolutifyInContext()(request) - : getAbsolutify()(context, request); - }, - contextify: (context, request) => { - return context === this.context - ? getContextifyInContext()(request) - : getContextify()(context, request); - }, - createHash: type => { - return createHash(type || compilation.outputOptions.hashFunction); + codeGeneration({ + runtimeTemplate, + moduleGraph, + chunkGraph, + runtime, + concatenationScope + }) { + const { request, externalType } = this._getRequestAndExternalType(); + switch (externalType) { + case "asset": { + const sources = new Map(); + sources.set( + "javascript", + new RawSource(`module.exports = ${JSON.stringify(request)};`) + ); + const data = new Map(); + data.set("url", request); + return { sources, runtimeRequirements: RUNTIME_REQUIREMENTS, data }; } - }; - const loaderContext = { - version: 2, - getOptions: schema => { - const loader = this.getCurrentLoader(loaderContext); - - let { options } = loader; + case "css-import": { + const sources = new Map(); + sources.set( + "css-import", + new RawSource(`@import url(${JSON.stringify(request)});`) + ); + return { + sources, + runtimeRequirements: EMPTY_RUNTIME_REQUIREMENTS + }; + } + default: { + const sourceData = this._getSourceData( + request, + externalType, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtime + ); - if (typeof options === "string") { - if (options.substr(0, 1) === "{" && options.substr(-1) === "}") { - try { - options = parseJson(options); - } catch (e) { - throw new Error(`Cannot parse string options: ${e.message}`); - } - } else { - options = querystring.parse(options, "&", "=", { - maxKeys: 0 - }); - } + let sourceString = sourceData.expression; + if (sourceData.iife) + sourceString = `(function() { return ${sourceString}; }())`; + if (concatenationScope) { + sourceString = `${ + runtimeTemplate.supportsConst() ? "const" : "var" + } ${ConcatenationScope.NAMESPACE_OBJECT_EXPORT} = ${sourceString};`; + concatenationScope.registerNamespaceExport( + ConcatenationScope.NAMESPACE_OBJECT_EXPORT + ); + } else { + sourceString = `module.exports = ${sourceString};`; } + if (sourceData.init) + sourceString = `${sourceData.init}\n${sourceString}`; - if (options === null || options === undefined) { - options = {}; + let data = undefined; + if (sourceData.chunkInitFragments) { + data = new Map(); + data.set("chunkInitFragments", sourceData.chunkInitFragments); } - if (schema) { - let name = "Loader"; - let baseDataPath = "options"; - let match; - if (schema.title && (match = /^(.+) (.+)$/.exec(schema.title))) { - [, name, baseDataPath] = match; - } - getValidate()(schema, options, { - name, - baseDataPath - }); + const sources = new Map(); + if (this.useSourceMap || this.useSimpleSourceMap) { + sources.set( + "javascript", + new OriginalSource(sourceString, this.identifier()) + ); + } else { + sources.set("javascript", new RawSource(sourceString)); } - return options; - }, - emitWarning: warning => { - if (!(warning instanceof Error)) { - warning = new NonErrorEmittedError(warning); - } - this.addWarning( - new ModuleWarning(warning, { - from: getCurrentLoaderName() - }) - ); - }, - emitError: error => { - if (!(error instanceof Error)) { - error = new NonErrorEmittedError(error); - } - this.addError( - new ModuleError(error, { - from: getCurrentLoaderName() - }) - ); - }, - getLogger: name => { - const currentLoader = this.getCurrentLoader(loaderContext); - return compilation.getLogger(() => - [currentLoader && currentLoader.loader, name, this.identifier()] - .filter(Boolean) - .join("|") - ); - }, - resolve(context, request, callback) { - resolver.resolve({}, context, request, getResolveContext(), callback); - }, - getResolve(options) { - const child = options ? resolver.withOptions(options) : resolver; - return (context, request, callback) => { - if (callback) { - child.resolve({}, context, request, getResolveContext(), callback); + let runtimeRequirements = sourceData.runtimeRequirements; + if (!concatenationScope) { + if (!runtimeRequirements) { + runtimeRequirements = RUNTIME_REQUIREMENTS; } else { - return new Promise((resolve, reject) => { - child.resolve( - {}, - context, - request, - getResolveContext(), - (err, result) => { - if (err) reject(err); - else resolve(result); - } - ); - }); + const set = new Set(runtimeRequirements); + set.add(RuntimeGlobals.module); + runtimeRequirements = set; } - }; - }, - emitFile: (name, content, sourceMap, assetInfo) => { - if (!this.buildInfo.assets) { - this.buildInfo.assets = Object.create(null); - this.buildInfo.assetsInfo = new Map(); - } - this.buildInfo.assets[name] = this.createSourceForAsset( - options.context, - name, - content, - sourceMap, - compilation.compiler.root - ); - this.buildInfo.assetsInfo.set(name, assetInfo); - }, - addBuildDependency: dep => { - if (this.buildInfo.buildDependencies === undefined) { - this.buildInfo.buildDependencies = new LazySet(); } - this.buildInfo.buildDependencies.add(dep); - }, - utils, - rootContext: options.context, - webpack: true, - sourceMap: !!this.useSourceMap, - mode: options.mode || "production", - _module: this, - _compilation: compilation, - _compiler: compilation.compiler, - fs: fs - }; - - Object.assign(loaderContext, options.loader); - - hooks.loader.call(loaderContext, this); - return loaderContext; + return { + sources, + runtimeRequirements: + runtimeRequirements || EMPTY_RUNTIME_REQUIREMENTS, + data + }; + } + } } - getCurrentLoader(loaderContext, index = loaderContext.loaderIndex) { - if ( - this.loaders && - this.loaders.length && - index < this.loaders.length && - index >= 0 && - this.loaders[index] - ) { - return this.loaders[index]; - } - return null; + /** + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + return 42; } /** - * @param {string} context the compilation context - * @param {string | Buffer} content the content - * @param {string | TODO} sourceMap an optional source map - * @param {Object=} associatedObjectForCache object for caching - * @returns {Source} the created source + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} */ - createSource(context, content, sourceMap, associatedObjectForCache) { - if (Buffer.isBuffer(content)) { - return new RawSource(content); - } + updateHash(hash, context) { + const { chunkGraph } = context; + hash.update( + `${this.externalType}${JSON.stringify(this.request)}${this.isOptional( + chunkGraph.moduleGraph + )}` + ); + super.updateHash(hash, context); + } - // if there is no identifier return raw source - if (!this.identifier) { - return new RawSource(content); - } + serialize(context) { + const { write } = context; - // from here on we assume we have an identifier - const identifier = this.identifier(); + write(this.request); + write(this.externalType); + write(this.userRequest); - if (this.useSourceMap && sourceMap) { - return new SourceMapSource( - content, - contextifySourceUrl(context, identifier, associatedObjectForCache), - contextifySourceMap(context, sourceMap, associatedObjectForCache) - ); - } + super.serialize(context); + } - if (this.useSourceMap || this.useSimpleSourceMap) { - return new OriginalSource( - content, - contextifySourceUrl(context, identifier, associatedObjectForCache) - ); - } + deserialize(context) { + const { read } = context; - return new RawSource(content); + this.request = read(); + this.externalType = read(); + this.userRequest = read(); + + super.deserialize(context); } +} - /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {NormalModuleCompilationHooks} hooks the hooks - * @param {function((WebpackError | null)=): void} callback callback function - * @returns {void} - */ - _doBuild(options, compilation, resolver, fs, hooks, callback) { - const loaderContext = this._createLoaderContext( - resolver, - options, - compilation, - fs, - hooks - ); +makeSerializable(ExternalModule, "webpack/lib/ExternalModule"); - const processResult = (err, result) => { - if (err) { - if (!(err instanceof Error)) { - err = new NonErrorEmittedError(err); - } - const currentLoader = this.getCurrentLoader(loaderContext); - const error = new ModuleBuildError(err, { - from: - currentLoader && - compilation.runtimeTemplate.requestShortener.shorten( - currentLoader.loader - ) - }); - return callback(error); - } +module.exports = ExternalModule; - const source = result[0]; - const sourceMap = result.length >= 1 ? result[1] : null; - const extraInfo = result.length >= 2 ? result[2] : null; - if (!Buffer.isBuffer(source) && typeof source !== "string") { - const currentLoader = this.getCurrentLoader(loaderContext, 0); - const err = new Error( - `Final loader (${ - currentLoader - ? compilation.runtimeTemplate.requestShortener.shorten( - currentLoader.loader - ) - : "unknown" - }) didn't return a Buffer or String` - ); - const error = new ModuleBuildError(err); - return callback(error); - } +/***/ }), - this._source = this.createSource( - options.context, - this.binary ? asBuffer(source) : asString(source), - sourceMap, - compilation.compiler.root - ); - if (this._sourceSizes !== undefined) this._sourceSizes.clear(); - this._ast = - typeof extraInfo === "object" && - extraInfo !== null && - extraInfo.webpackAST !== undefined - ? extraInfo.webpackAST - : null; - return callback(); - }; +/***/ 62153: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - this.buildInfo.fileDependencies = new LazySet(); - this.buildInfo.contextDependencies = new LazySet(); - this.buildInfo.missingDependencies = new LazySet(); - this.buildInfo.cacheable = true; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - try { - hooks.beforeLoaders.call(this.loaders, this, loaderContext); - } catch (err) { - processResult(err); - return; - } - if (this.loaders.length > 0) { - this.buildInfo.buildDependencies = new LazySet(); - } - runLoaders( - { - resource: this.resource, - loaders: this.loaders, - context: loaderContext, - processResource: (loaderContext, resourcePath, callback) => { - const resource = loaderContext.resource; - const scheme = getScheme(resource); - hooks.readResource - .for(scheme) - .callAsync(loaderContext, (err, result) => { - if (err) return callback(err); - if (typeof result !== "string" && !result) { - return callback(new UnhandledSchemeError(scheme, resource)); - } - return callback(null, result); - }); - } - }, - (err, result) => { - // Cleanup loaderContext to avoid leaking memory in ICs - loaderContext._compilation = - loaderContext._compiler = - loaderContext._module = - loaderContext.fs = - undefined; +const util = __webpack_require__(73837); +const ExternalModule = __webpack_require__(73071); +const { resolveByProperty, cachedSetProperty } = __webpack_require__(60839); - if (!result) { - this.buildInfo.cacheable = false; - return processResult( - err || new Error("No result from loader-runner processing"), - null - ); - } - this.buildInfo.fileDependencies.addAll(result.fileDependencies); - this.buildInfo.contextDependencies.addAll(result.contextDependencies); - this.buildInfo.missingDependencies.addAll(result.missingDependencies); - for (const loader of this.loaders) { - this.buildInfo.buildDependencies.add(loader.loader); - } - this.buildInfo.cacheable = this.buildInfo.cacheable && result.cacheable; - processResult(err, result.result); - } - ); +/** @typedef {import("../declarations/WebpackOptions").Externals} Externals */ +/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ + +const UNSPECIFIED_EXTERNAL_TYPE_REGEXP = /^[a-z0-9-]+ /; +const EMPTY_RESOLVE_OPTIONS = {}; + +// TODO webpack 6 remove this +const callDeprecatedExternals = util.deprecate( + (externalsFunction, context, request, cb) => { + externalsFunction.call(null, context, request, cb); + }, + "The externals-function should be defined like ({context, request}, cb) => { ... }", + "DEP_WEBPACK_EXTERNALS_FUNCTION_PARAMETERS" +); + +const cache = new WeakMap(); + +const resolveLayer = (obj, layer) => { + let map = cache.get(obj); + if (map === undefined) { + map = new Map(); + cache.set(obj, map); + } else { + const cacheEntry = map.get(layer); + if (cacheEntry !== undefined) return cacheEntry; } + const result = resolveByProperty(obj, "byLayer", layer); + map.set(layer, result); + return result; +}; +class ExternalModuleFactoryPlugin { /** - * @param {WebpackError} error the error - * @returns {void} + * @param {string | undefined} type default external type + * @param {Externals} externals externals config */ - markModuleAsErrored(error) { - // Restore build meta from successful build to keep importing state - this.buildMeta = { ...this._lastSuccessfulBuildMeta }; - this.error = error; - this.addError(error); + constructor(type, externals) { + this.type = type; + this.externals = externals; } - applyNoParseRule(rule, content) { - // must start with "rule" if rule is a string - if (typeof rule === "string") { - return content.startsWith(rule); - } - - if (typeof rule === "function") { - return rule(content); - } - // we assume rule is a regexp - return rule.test(content); - } + /** + * @param {NormalModuleFactory} normalModuleFactory the normal module factory + * @returns {void} + */ + apply(normalModuleFactory) { + const globalType = this.type; + normalModuleFactory.hooks.factorize.tapAsync( + "ExternalModuleFactoryPlugin", + (data, callback) => { + const context = data.context; + const contextInfo = data.contextInfo; + const dependency = data.dependencies[0]; + const dependencyType = data.dependencyType; - // check if module should not be parsed - // returns "true" if the module should !not! be parsed - // returns "false" if the module !must! be parsed - shouldPreventParsing(noParseRule, request) { - // if no noParseRule exists, return false - // the module !must! be parsed. - if (!noParseRule) { - return false; - } - - // we only have one rule to check - if (!Array.isArray(noParseRule)) { - // returns "true" if the module is !not! to be parsed - return this.applyNoParseRule(noParseRule, request); - } - - for (let i = 0; i < noParseRule.length; i++) { - const rule = noParseRule[i]; - // early exit on first truthy match - // this module is !not! to be parsed - if (this.applyNoParseRule(rule, request)) { - return true; - } - } - // no match found, so this module !should! be parsed - return false; - } - - _initBuildHash(compilation) { - const hash = createHash(compilation.outputOptions.hashFunction); - if (this._source) { - hash.update("source"); - this._source.updateHash(hash); - } - hash.update("meta"); - hash.update(JSON.stringify(this.buildMeta)); - this.buildInfo.hash = /** @type {string} */ (hash.digest("hex")); - } + /** + * @param {string|string[]|boolean|Record} value the external config + * @param {string|undefined} type type of external + * @param {function(Error=, ExternalModule=): void} callback callback + * @returns {void} + */ + const handleExternal = (value, type, callback) => { + if (value === false) { + // Not externals, fallback to original factory + return callback(); + } + /** @type {string | string[] | Record} */ + let externalConfig; + if (value === true) { + externalConfig = dependency.request; + } else { + externalConfig = value; + } + // When no explicit type is specified, extract it from the externalConfig + if (type === undefined) { + if ( + typeof externalConfig === "string" && + UNSPECIFIED_EXTERNAL_TYPE_REGEXP.test(externalConfig) + ) { + const idx = externalConfig.indexOf(" "); + type = externalConfig.substr(0, idx); + externalConfig = externalConfig.substr(idx + 1); + } else if ( + Array.isArray(externalConfig) && + externalConfig.length > 0 && + UNSPECIFIED_EXTERNAL_TYPE_REGEXP.test(externalConfig[0]) + ) { + const firstItem = externalConfig[0]; + const idx = firstItem.indexOf(" "); + type = firstItem.substr(0, idx); + externalConfig = [ + firstItem.substr(idx + 1), + ...externalConfig.slice(1) + ]; + } + } + callback( + null, + new ExternalModule( + externalConfig, + type || globalType, + dependency.request + ) + ); + }; - /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} - */ - build(options, compilation, resolver, fs, callback) { - this._forceBuild = false; - this._source = null; - if (this._sourceSizes !== undefined) this._sourceSizes.clear(); - this._sourceTypes = undefined; - this._ast = null; - this.error = null; - this.clearWarningsAndErrors(); - this.clearDependenciesAndBlocks(); - this.buildMeta = {}; - this.buildInfo = { - cacheable: false, - parsed: true, - fileDependencies: undefined, - contextDependencies: undefined, - missingDependencies: undefined, - buildDependencies: undefined, - valueDependencies: undefined, - hash: undefined, - assets: undefined, - assetsInfo: undefined - }; + /** + * @param {Externals} externals externals config + * @param {function((Error | null)=, ExternalModule=): void} callback callback + * @returns {void} + */ + const handleExternals = (externals, callback) => { + if (typeof externals === "string") { + if (externals === dependency.request) { + return handleExternal(dependency.request, undefined, callback); + } + } else if (Array.isArray(externals)) { + let i = 0; + const next = () => { + let asyncFlag; + const handleExternalsAndCallback = (err, module) => { + if (err) return callback(err); + if (!module) { + if (asyncFlag) { + asyncFlag = false; + return; + } + return next(); + } + callback(null, module); + }; - const startTime = compilation.compiler.fsStartTime || Date.now(); + do { + asyncFlag = true; + if (i >= externals.length) return callback(); + handleExternals(externals[i++], handleExternalsAndCallback); + } while (!asyncFlag); + asyncFlag = false; + }; - const hooks = NormalModule.getCompilationHooks(compilation); + next(); + return; + } else if (externals instanceof RegExp) { + if (externals.test(dependency.request)) { + return handleExternal(dependency.request, undefined, callback); + } + } else if (typeof externals === "function") { + const cb = (err, value, type) => { + if (err) return callback(err); + if (value !== undefined) { + handleExternal(value, type, callback); + } else { + callback(); + } + }; + if (externals.length === 3) { + // TODO webpack 6 remove this + callDeprecatedExternals( + externals, + context, + dependency.request, + cb + ); + } else { + const promise = externals( + { + context, + request: dependency.request, + dependencyType, + contextInfo, + getResolve: options => (context, request, callback) => { + const resolveContext = { + fileDependencies: data.fileDependencies, + missingDependencies: data.missingDependencies, + contextDependencies: data.contextDependencies + }; + let resolver = normalModuleFactory.getResolver( + "normal", + dependencyType + ? cachedSetProperty( + data.resolveOptions || EMPTY_RESOLVE_OPTIONS, + "dependencyType", + dependencyType + ) + : data.resolveOptions + ); + if (options) resolver = resolver.withOptions(options); + if (callback) { + resolver.resolve( + {}, + context, + request, + resolveContext, + callback + ); + } else { + return new Promise((resolve, reject) => { + resolver.resolve( + {}, + context, + request, + resolveContext, + (err, result) => { + if (err) reject(err); + else resolve(result); + } + ); + }); + } + } + }, + cb + ); + if (promise && promise.then) promise.then(r => cb(null, r), cb); + } + return; + } else if (typeof externals === "object") { + const resolvedExternals = resolveLayer( + externals, + contextInfo.issuerLayer + ); + if ( + Object.prototype.hasOwnProperty.call( + resolvedExternals, + dependency.request + ) + ) { + return handleExternal( + resolvedExternals[dependency.request], + undefined, + callback + ); + } + } + callback(); + }; - return this._doBuild(options, compilation, resolver, fs, hooks, err => { - // if we have an error mark module as failed and exit - if (err) { - this.markModuleAsErrored(err); - this._initBuildHash(compilation); - return callback(); + handleExternals(this.externals, callback); } + ); + } +} +module.exports = ExternalModuleFactoryPlugin; - const handleParseError = e => { - const source = this._source.source(); - const loaders = this.loaders.map(item => - contextify(options.context, item.loader, compilation.compiler.root) - ); - const error = new ModuleParseError(source, e, loaders, this.type); - this.markModuleAsErrored(error); - this._initBuildHash(compilation); - return callback(); - }; - const handleParseResult = result => { - this.dependencies.sort( - concatComparators( - compareSelect(a => a.loc, compareLocations), - keepOriginalOrder(this.dependencies) - ) - ); - this._initBuildHash(compilation); - this._lastSuccessfulBuildMeta = this.buildMeta; - return handleBuildDone(); - }; +/***/ }), - const handleBuildDone = () => { - try { - hooks.beforeSnapshot.call(this); - } catch (err) { - this.markModuleAsErrored(err); - return callback(); - } +/***/ 6652: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const snapshotOptions = compilation.options.snapshot.module; - if (!this.buildInfo.cacheable || !snapshotOptions) { - return callback(); - } - // add warning for all non-absolute paths in fileDependencies, etc - // This makes it easier to find problems with watching and/or caching - let nonAbsoluteDependencies = undefined; - const checkDependencies = deps => { - for (const dep of deps) { - if (!ABSOLUTE_PATH_REGEX.test(dep)) { - if (nonAbsoluteDependencies === undefined) - nonAbsoluteDependencies = new Set(); - nonAbsoluteDependencies.add(dep); - deps.delete(dep); - try { - const depWithoutGlob = dep.replace(/[\\/]?\*.*$/, ""); - const absolute = join( - compilation.fileSystemInfo.fs, - this.context, - depWithoutGlob - ); - if (absolute !== dep && ABSOLUTE_PATH_REGEX.test(absolute)) { - (depWithoutGlob !== dep - ? this.buildInfo.contextDependencies - : deps - ).add(absolute); - } - } catch (e) { - // ignore - } - } - } - }; - checkDependencies(this.buildInfo.fileDependencies); - checkDependencies(this.buildInfo.missingDependencies); - checkDependencies(this.buildInfo.contextDependencies); - if (nonAbsoluteDependencies !== undefined) { - const InvalidDependenciesModuleWarning = - getInvalidDependenciesModuleWarning(); - this.addWarning( - new InvalidDependenciesModuleWarning(this, nonAbsoluteDependencies) - ); - } - // convert file/context/missingDependencies into filesystem snapshot - compilation.fileSystemInfo.createSnapshot( - startTime, - this.buildInfo.fileDependencies, - this.buildInfo.contextDependencies, - this.buildInfo.missingDependencies, - snapshotOptions, - (err, snapshot) => { - if (err) { - this.markModuleAsErrored(err); - return; - } - this.buildInfo.fileDependencies = undefined; - this.buildInfo.contextDependencies = undefined; - this.buildInfo.missingDependencies = undefined; - this.buildInfo.snapshot = snapshot; - return callback(); - } - ); - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - try { - hooks.beforeParse.call(this); - } catch (err) { - this.markModuleAsErrored(err); - this._initBuildHash(compilation); - return callback(); - } - // check if this module should !not! be parsed. - // if so, exit here; - const noParseRule = options.module && options.module.noParse; - if (this.shouldPreventParsing(noParseRule, this.request)) { - // We assume that we need module and exports - this.buildInfo.parsed = false; - this._initBuildHash(compilation); - return handleBuildDone(); - } - let result; - try { - const source = this._source.source(); - result = this.parser.parse(this._ast || source, { - source, - current: this, - module: this, - compilation: compilation, - options: options - }); - } catch (e) { - handleParseError(e); - return; - } - handleParseResult(result); - }); - } +const ExternalModuleFactoryPlugin = __webpack_require__(62153); - /** - * @param {ConcatenationBailoutReasonContext} context context - * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated - */ - getConcatenationBailoutReason(context) { - return this.generator.getConcatenationBailoutReason(this, context); - } +/** @typedef {import("../declarations/WebpackOptions").Externals} Externals */ +/** @typedef {import("./Compiler")} Compiler */ +class ExternalsPlugin { /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this module should be connected to referencing modules when consumed for side-effects only + * @param {string | undefined} type default external type + * @param {Externals} externals externals config */ - getSideEffectsConnectionState(moduleGraph) { - if (this.factoryMeta !== undefined) { - if (this.factoryMeta.sideEffectFree) return false; - if (this.factoryMeta.sideEffectFree === false) return true; - } - if (this.buildMeta !== undefined && this.buildMeta.sideEffectFree) { - if (this._isEvaluatingSideEffects) - return ModuleGraphConnection.CIRCULAR_CONNECTION; - this._isEvaluatingSideEffects = true; - /** @type {ConnectionState} */ - let current = false; - for (const dep of this.dependencies) { - const state = dep.getModuleEvaluationSideEffectsState(moduleGraph); - if (state === true) { - if ( - this._addedSideEffectsBailout === undefined - ? ((this._addedSideEffectsBailout = new WeakSet()), true) - : !this._addedSideEffectsBailout.has(moduleGraph) - ) { - this._addedSideEffectsBailout.add(moduleGraph); - moduleGraph - .getOptimizationBailout(this) - .push( - () => - `Dependency (${ - dep.type - }) with side effects at ${formatLocation(dep.loc)}` - ); - } - this._isEvaluatingSideEffects = false; - return true; - } else if (state !== ModuleGraphConnection.CIRCULAR_CONNECTION) { - current = ModuleGraphConnection.addConnectionStates(current, state); - } - } - this._isEvaluatingSideEffects = false; - // When caching is implemented here, make sure to not cache when - // at least one circular connection was in the loop above - return current; - } else { - return true; - } + constructor(type, externals) { + this.type = type; + this.externals = externals; } /** - * @returns {Set} types available (do not mutate) + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - getSourceTypes() { - if (this._sourceTypes === undefined) { - this._sourceTypes = this.generator.getTypes(this); - } - return this._sourceTypes; + apply(compiler) { + compiler.hooks.compile.tap("ExternalsPlugin", ({ normalModuleFactory }) => { + new ExternalModuleFactoryPlugin(this.type, this.externals).apply( + normalModuleFactory + ); + }); } +} - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration({ - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtime, - concatenationScope, - codeGenerationResults - }) { - /** @type {Set} */ - const runtimeRequirements = new Set(); +module.exports = ExternalsPlugin; - if (!this.buildInfo.parsed) { - runtimeRequirements.add(RuntimeGlobals.module); - runtimeRequirements.add(RuntimeGlobals.exports); - runtimeRequirements.add(RuntimeGlobals.thisAsExports); - } - /** @type {Map} */ - let data; - const getData = () => { - if (data === undefined) data = new Map(); - return data; - }; +/***/ }), - const sources = new Map(); - for (const type of this.generator.getTypes(this)) { - const source = this.error - ? new RawSource( - "throw new Error(" + JSON.stringify(this.error.message) + ");" - ) - : this.generator.generate(this, { - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtimeRequirements, - runtime, - concatenationScope, - codeGenerationResults, - getData, - type - }); +/***/ 79453: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (source) { - sources.set(type, new CachedSource(source)); - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** @type {CodeGenerationResult} */ - const resultEntry = { - sources, - runtimeRequirements, - data - }; - return resultEntry; - } - /** - * @returns {Source | null} the original source for the module before webpack transformation - */ - originalSource() { - return this._source; - } - /** - * @returns {void} - */ - invalidateBuild() { - this._forceBuild = true; - } +const { create: createResolver } = __webpack_require__(30662); +const asyncLib = __webpack_require__(78175); +const AsyncQueue = __webpack_require__(12260); +const StackedCacheMap = __webpack_require__(64985); +const createHash = __webpack_require__(49835); +const { join, dirname, relative, lstatReadlinkAbsolute } = __webpack_require__(17139); +const makeSerializable = __webpack_require__(33032); +const processAsyncTree = __webpack_require__(42791); - /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} - */ - needBuild(context, callback) { - const { fileSystemInfo, compilation, valueCacheVersions } = context; - // build if enforced - if (this._forceBuild) return callback(null, true); +/** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./logging/Logger").Logger} Logger */ +/** @typedef {typeof import("./util/Hash")} Hash */ +/** @typedef {import("./util/fs").IStats} IStats */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ - // always try to build in case of an error - if (this.error) return callback(null, true); +const supportsEsm = +process.versions.modules >= 83; - // always build when module is not cacheable - if (!this.buildInfo.cacheable) return callback(null, true); +let FS_ACCURACY = 2000; - // build when there is no snapshot to check - if (!this.buildInfo.snapshot) return callback(null, true); +const EMPTY_SET = new Set(); - // build when valueDependencies have changed - /** @type {Map>} */ - const valueDependencies = this.buildInfo.valueDependencies; - if (valueDependencies) { - if (!valueCacheVersions) return callback(null, true); - for (const [key, value] of valueDependencies) { - if (value === undefined) return callback(null, true); - const current = valueCacheVersions.get(key); - if ( - value !== current && - (typeof value === "string" || - typeof current === "string" || - current === undefined || - !isSubset(value, current)) - ) { - return callback(null, true); - } - } - } +const RBDT_RESOLVE_CJS = 0; +const RBDT_RESOLVE_ESM = 1; +const RBDT_RESOLVE_DIRECTORY = 2; +const RBDT_RESOLVE_CJS_FILE = 3; +const RBDT_RESOLVE_CJS_FILE_AS_CHILD = 4; +const RBDT_RESOLVE_ESM_FILE = 5; +const RBDT_DIRECTORY = 6; +const RBDT_FILE = 7; +const RBDT_DIRECTORY_DEPENDENCIES = 8; +const RBDT_FILE_DEPENDENCIES = 9; - // check snapshot for validity - fileSystemInfo.checkSnapshotValid(this.buildInfo.snapshot, (err, valid) => { - if (err) return callback(err); - if (!valid) return callback(null, true); - const hooks = NormalModule.getCompilationHooks(compilation); - hooks.needBuild.callAsync(this, context, (err, needBuild) => { - if (err) { - return callback( - HookWebpackError.makeWebpackError( - err, - "NormalModule.getCompilationHooks().needBuild" - ) - ); +const INVALID = Symbol("invalid"); + +/** + * @typedef {Object} FileSystemInfoEntry + * @property {number} safeTime + * @property {number=} timestamp + */ + +/** + * @typedef {Object} ResolvedContextFileSystemInfoEntry + * @property {number} safeTime + * @property {string=} timestampHash + */ + +/** + * @typedef {Object} ContextFileSystemInfoEntry + * @property {number} safeTime + * @property {string=} timestampHash + * @property {ResolvedContextFileSystemInfoEntry=} resolved + * @property {Set=} symlinks + */ + +/** + * @typedef {Object} TimestampAndHash + * @property {number} safeTime + * @property {number=} timestamp + * @property {string} hash + */ + +/** + * @typedef {Object} ResolvedContextTimestampAndHash + * @property {number} safeTime + * @property {string=} timestampHash + * @property {string} hash + */ + +/** + * @typedef {Object} ContextTimestampAndHash + * @property {number} safeTime + * @property {string=} timestampHash + * @property {string} hash + * @property {ResolvedContextTimestampAndHash=} resolved + * @property {Set=} symlinks + */ + +/** + * @typedef {Object} ContextHash + * @property {string} hash + * @property {string=} resolved + * @property {Set=} symlinks + */ + +/** + * @typedef {Object} SnapshotOptimizationEntry + * @property {Snapshot} snapshot + * @property {number} shared + * @property {Set} snapshotContent + * @property {Set} children + */ + +/** + * @typedef {Object} ResolveBuildDependenciesResult + * @property {Set} files list of files + * @property {Set} directories list of directories + * @property {Set} missing list of missing entries + * @property {Map} resolveResults stored resolve results + * @property {Object} resolveDependencies dependencies of the resolving + * @property {Set} resolveDependencies.files list of files + * @property {Set} resolveDependencies.directories list of directories + * @property {Set} resolveDependencies.missing list of missing entries + */ + +const DONE_ITERATOR_RESULT = new Set().keys().next(); + +// cspell:word tshs +// Tsh = Timestamp + Hash +// Tshs = Timestamp + Hash combinations + +class SnapshotIterator { + constructor(next) { + this.next = next; + } +} + +class SnapshotIterable { + constructor(snapshot, getMaps) { + this.snapshot = snapshot; + this.getMaps = getMaps; + } + + [Symbol.iterator]() { + let state = 0; + /** @type {IterableIterator} */ + let it; + /** @type {(Snapshot) => (Map | Set)[]} */ + let getMaps; + /** @type {(Map | Set)[]} */ + let maps; + /** @type {Snapshot} */ + let snapshot; + let queue; + return new SnapshotIterator(() => { + for (;;) { + switch (state) { + case 0: + snapshot = this.snapshot; + getMaps = this.getMaps; + maps = getMaps(snapshot); + state = 1; + /* falls through */ + case 1: + if (maps.length > 0) { + const map = maps.pop(); + if (map !== undefined) { + it = map.keys(); + state = 2; + } else { + break; + } + } else { + state = 3; + break; + } + /* falls through */ + case 2: { + const result = it.next(); + if (!result.done) return result; + state = 1; + break; + } + case 3: { + const children = snapshot.children; + if (children !== undefined) { + if (children.size === 1) { + // shortcut for a single child + // avoids allocation of queue + for (const child of children) snapshot = child; + maps = getMaps(snapshot); + state = 1; + break; + } + if (queue === undefined) queue = []; + for (const child of children) { + queue.push(child); + } + } + if (queue !== undefined && queue.length > 0) { + snapshot = queue.pop(); + maps = getMaps(snapshot); + state = 1; + break; + } else { + state = 4; + } + } + /* falls through */ + case 4: + return DONE_ITERATOR_RESULT; } - callback(null, !!needBuild); - }); + } }); } +} - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - const cachedSize = - this._sourceSizes === undefined ? undefined : this._sourceSizes.get(type); - if (cachedSize !== undefined) { - return cachedSize; - } - const size = Math.max(1, this.generator.getSize(this, type)); - if (this._sourceSizes === undefined) { - this._sourceSizes = new Map(); - } - this._sourceSizes.set(type, size); - return size; +class Snapshot { + constructor() { + this._flags = 0; + /** @type {number | undefined} */ + this.startTime = undefined; + /** @type {Map | undefined} */ + this.fileTimestamps = undefined; + /** @type {Map | undefined} */ + this.fileHashes = undefined; + /** @type {Map | undefined} */ + this.fileTshs = undefined; + /** @type {Map | undefined} */ + this.contextTimestamps = undefined; + /** @type {Map | undefined} */ + this.contextHashes = undefined; + /** @type {Map | undefined} */ + this.contextTshs = undefined; + /** @type {Map | undefined} */ + this.missingExistence = undefined; + /** @type {Map | undefined} */ + this.managedItemInfo = undefined; + /** @type {Set | undefined} */ + this.managedFiles = undefined; + /** @type {Set | undefined} */ + this.managedContexts = undefined; + /** @type {Set | undefined} */ + this.managedMissing = undefined; + /** @type {Set | undefined} */ + this.children = undefined; } - /** - * @param {LazySet} fileDependencies set where file dependencies are added to - * @param {LazySet} contextDependencies set where context dependencies are added to - * @param {LazySet} missingDependencies set where missing dependencies are added to - * @param {LazySet} buildDependencies set where build dependencies are added to - */ - addCacheDependencies( - fileDependencies, - contextDependencies, - missingDependencies, - buildDependencies - ) { - const { snapshot, buildDependencies: buildDeps } = this.buildInfo; - if (snapshot) { - fileDependencies.addAll(snapshot.getFileIterable()); - contextDependencies.addAll(snapshot.getContextIterable()); - missingDependencies.addAll(snapshot.getMissingIterable()); + hasStartTime() { + return (this._flags & 1) !== 0; + } + + setStartTime(value) { + this._flags = this._flags | 1; + this.startTime = value; + } + + setMergedStartTime(value, snapshot) { + if (value) { + if (snapshot.hasStartTime()) { + this.setStartTime(Math.min(value, snapshot.startTime)); + } else { + this.setStartTime(value); + } } else { - const { - fileDependencies: fileDeps, - contextDependencies: contextDeps, - missingDependencies: missingDeps - } = this.buildInfo; - if (fileDeps !== undefined) fileDependencies.addAll(fileDeps); - if (contextDeps !== undefined) contextDependencies.addAll(contextDeps); - if (missingDeps !== undefined) missingDependencies.addAll(missingDeps); - } - if (buildDeps !== undefined) { - buildDependencies.addAll(buildDeps); + if (snapshot.hasStartTime()) this.setStartTime(snapshot.startTime); } } - /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - hash.update(this.buildInfo.hash); - this.generator.updateHash(hash, { - module: this, - ...context - }); - super.updateHash(hash, context); + hasFileTimestamps() { + return (this._flags & 2) !== 0; } - serialize(context) { - const { write } = context; - // deserialize - write(this._source); - write(this.error); - write(this._lastSuccessfulBuildMeta); - write(this._forceBuild); - super.serialize(context); + setFileTimestamps(value) { + this._flags = this._flags | 2; + this.fileTimestamps = value; } - static deserialize(context) { - const obj = new NormalModule({ - // will be deserialized by Module - layer: null, - type: "", - // will be filled by updateCacheModule - resource: "", - context: "", - request: null, - userRequest: null, - rawRequest: null, - loaders: null, - matchResource: null, - parser: null, - parserOptions: null, - generator: null, - generatorOptions: null, - resolveOptions: null - }); - obj.deserialize(context); - return obj; + hasFileHashes() { + return (this._flags & 4) !== 0; } - deserialize(context) { - const { read } = context; - this._source = read(); - this.error = read(); - this._lastSuccessfulBuildMeta = read(); - this._forceBuild = read(); - super.deserialize(context); + setFileHashes(value) { + this._flags = this._flags | 4; + this.fileHashes = value; } -} -makeSerializable(NormalModule, "webpack/lib/NormalModule"); + hasFileTshs() { + return (this._flags & 8) !== 0; + } -module.exports = NormalModule; + setFileTshs(value) { + this._flags = this._flags | 8; + this.fileTshs = value; + } + hasContextTimestamps() { + return (this._flags & 0x10) !== 0; + } -/***/ }), + setContextTimestamps(value) { + this._flags = this._flags | 0x10; + this.contextTimestamps = value; + } -/***/ 68860: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + hasContextHashes() { + return (this._flags & 0x20) !== 0; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + setContextHashes(value) { + this._flags = this._flags | 0x20; + this.contextHashes = value; + } + hasContextTshs() { + return (this._flags & 0x40) !== 0; + } + setContextTshs(value) { + this._flags = this._flags | 0x40; + this.contextTshs = value; + } -const { getContext } = __webpack_require__(8255); -const asyncLib = __webpack_require__(78175); -const { - AsyncSeriesBailHook, - SyncWaterfallHook, - SyncBailHook, - SyncHook, - HookMap -} = __webpack_require__(6967); -const ChunkGraph = __webpack_require__(64971); -const Module = __webpack_require__(73208); -const ModuleFactory = __webpack_require__(51010); -const ModuleGraph = __webpack_require__(99988); -const NormalModule = __webpack_require__(39); -const BasicEffectRulePlugin = __webpack_require__(30318); -const BasicMatcherRulePlugin = __webpack_require__(94215); -const ObjectMatcherRulePlugin = __webpack_require__(72021); -const RuleSetCompiler = __webpack_require__(83349); -const UseEffectRulePlugin = __webpack_require__(84977); -const LazySet = __webpack_require__(38938); -const { getScheme } = __webpack_require__(54500); -const { cachedCleverMerge, cachedSetProperty } = __webpack_require__(60839); -const { join } = __webpack_require__(17139); -const { - parseResource, - parseResourceWithoutFragment -} = __webpack_require__(82186); + hasMissingExistence() { + return (this._flags & 0x80) !== 0; + } -/** @typedef {import("../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */ -/** @typedef {import("./Generator")} Generator */ -/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ -/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ -/** @typedef {import("./Parser")} Parser */ -/** @typedef {import("./ResolverFactory")} ResolverFactory */ -/** @typedef {import("./dependencies/ModuleDependency")} ModuleDependency */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ + setMissingExistence(value) { + this._flags = this._flags | 0x80; + this.missingExistence = value; + } -/** - * @typedef {Object} ResolveData - * @property {ModuleFactoryCreateData["contextInfo"]} contextInfo - * @property {ModuleFactoryCreateData["resolveOptions"]} resolveOptions - * @property {string} context - * @property {string} request - * @property {Record | undefined} assertions - * @property {ModuleDependency[]} dependencies - * @property {string} dependencyType - * @property {Object} createData - * @property {LazySet} fileDependencies - * @property {LazySet} missingDependencies - * @property {LazySet} contextDependencies - * @property {boolean} cacheable allow to use the unsafe cache - */ + hasManagedItemInfo() { + return (this._flags & 0x100) !== 0; + } -/** - * @typedef {Object} ResourceData - * @property {string} resource - * @property {string} path - * @property {string} query - * @property {string} fragment - * @property {string=} context - */ - -/** @typedef {ResourceData & { data: Record }} ResourceDataWithData */ - -/** @typedef {Object} ParsedLoaderRequest - * @property {string} loader loader - * @property {string|undefined} options options - */ + setManagedItemInfo(value) { + this._flags = this._flags | 0x100; + this.managedItemInfo = value; + } -const EMPTY_RESOLVE_OPTIONS = {}; -const EMPTY_PARSER_OPTIONS = {}; -const EMPTY_GENERATOR_OPTIONS = {}; -const EMPTY_ELEMENTS = []; + hasManagedFiles() { + return (this._flags & 0x200) !== 0; + } -const MATCH_RESOURCE_REGEX = /^([^!]+)!=!/; + setManagedFiles(value) { + this._flags = this._flags | 0x200; + this.managedFiles = value; + } -const loaderToIdent = data => { - if (!data.options) { - return data.loader; + hasManagedContexts() { + return (this._flags & 0x400) !== 0; } - if (typeof data.options === "string") { - return data.loader + "?" + data.options; + + setManagedContexts(value) { + this._flags = this._flags | 0x400; + this.managedContexts = value; } - if (typeof data.options !== "object") { - throw new Error("loader options must be string or object"); + + hasManagedMissing() { + return (this._flags & 0x800) !== 0; } - if (data.ident) { - return data.loader + "??" + data.ident; + + setManagedMissing(value) { + this._flags = this._flags | 0x800; + this.managedMissing = value; } - return data.loader + "?" + JSON.stringify(data.options); -}; -const stringifyLoadersAndResource = (loaders, resource) => { - let str = ""; - for (const loader of loaders) { - str += loaderToIdent(loader) + "!"; + hasChildren() { + return (this._flags & 0x1000) !== 0; } - return str + resource; -}; -const needCalls = (times, callback) => { - return err => { - if (--times === 0) { - return callback(err); - } - if (err && times > 0) { - times = NaN; - return callback(err); - } - }; -}; + setChildren(value) { + this._flags = this._flags | 0x1000; + this.children = value; + } -const mergeGlobalOptions = (globalOptions, type, localOptions) => { - const parts = type.split("/"); - let result; - let current = ""; - for (const part of parts) { - current = current ? `${current}/${part}` : part; - const options = globalOptions[current]; - if (typeof options === "object") { - if (result === undefined) { - result = options; - } else { - result = cachedCleverMerge(result, options); - } + addChild(child) { + if (!this.hasChildren()) { + this.setChildren(new Set()); } + this.children.add(child); } - if (result === undefined) { - return localOptions; - } else { - return cachedCleverMerge(result, localOptions); - } -}; -// TODO webpack 6 remove -const deprecationChangedHookMessage = (name, hook) => { - const names = hook.taps - .map(tapped => { - return tapped.name; - }) - .join(", "); + serialize({ write }) { + write(this._flags); + if (this.hasStartTime()) write(this.startTime); + if (this.hasFileTimestamps()) write(this.fileTimestamps); + if (this.hasFileHashes()) write(this.fileHashes); + if (this.hasFileTshs()) write(this.fileTshs); + if (this.hasContextTimestamps()) write(this.contextTimestamps); + if (this.hasContextHashes()) write(this.contextHashes); + if (this.hasContextTshs()) write(this.contextTshs); + if (this.hasMissingExistence()) write(this.missingExistence); + if (this.hasManagedItemInfo()) write(this.managedItemInfo); + if (this.hasManagedFiles()) write(this.managedFiles); + if (this.hasManagedContexts()) write(this.managedContexts); + if (this.hasManagedMissing()) write(this.managedMissing); + if (this.hasChildren()) write(this.children); + } - return ( - `NormalModuleFactory.${name} (${names}) is no longer a waterfall hook, but a bailing hook instead. ` + - "Do not return the passed object, but modify it instead. " + - "Returning false will ignore the request and results in no module created." - ); -}; + deserialize({ read }) { + this._flags = read(); + if (this.hasStartTime()) this.startTime = read(); + if (this.hasFileTimestamps()) this.fileTimestamps = read(); + if (this.hasFileHashes()) this.fileHashes = read(); + if (this.hasFileTshs()) this.fileTshs = read(); + if (this.hasContextTimestamps()) this.contextTimestamps = read(); + if (this.hasContextHashes()) this.contextHashes = read(); + if (this.hasContextTshs()) this.contextTshs = read(); + if (this.hasMissingExistence()) this.missingExistence = read(); + if (this.hasManagedItemInfo()) this.managedItemInfo = read(); + if (this.hasManagedFiles()) this.managedFiles = read(); + if (this.hasManagedContexts()) this.managedContexts = read(); + if (this.hasManagedMissing()) this.managedMissing = read(); + if (this.hasChildren()) this.children = read(); + } -const ruleSetCompiler = new RuleSetCompiler([ - new BasicMatcherRulePlugin("test", "resource"), - new BasicMatcherRulePlugin("scheme"), - new BasicMatcherRulePlugin("mimetype"), - new BasicMatcherRulePlugin("dependency"), - new BasicMatcherRulePlugin("include", "resource"), - new BasicMatcherRulePlugin("exclude", "resource", true), - new BasicMatcherRulePlugin("resource"), - new BasicMatcherRulePlugin("resourceQuery"), - new BasicMatcherRulePlugin("resourceFragment"), - new BasicMatcherRulePlugin("realResource"), - new BasicMatcherRulePlugin("issuer"), - new BasicMatcherRulePlugin("compiler"), - new BasicMatcherRulePlugin("issuerLayer"), - new ObjectMatcherRulePlugin("assert", "assertions"), - new ObjectMatcherRulePlugin("descriptionData"), - new BasicEffectRulePlugin("type"), - new BasicEffectRulePlugin("sideEffects"), - new BasicEffectRulePlugin("parser"), - new BasicEffectRulePlugin("resolve"), - new BasicEffectRulePlugin("generator"), - new BasicEffectRulePlugin("layer"), - new UseEffectRulePlugin() -]); + /** + * @param {function(Snapshot): (ReadonlyMap | ReadonlySet)[]} getMaps first + * @returns {Iterable} iterable + */ + _createIterable(getMaps) { + return new SnapshotIterable(this, getMaps); + } -class NormalModuleFactory extends ModuleFactory { /** - * @param {Object} param params - * @param {string=} param.context context - * @param {InputFileSystem} param.fs file system - * @param {ResolverFactory} param.resolverFactory resolverFactory - * @param {ModuleOptions} param.options options - * @param {Object=} param.associatedObjectForCache an object to which the cache will be attached - * @param {boolean=} param.layers enable layers + * @returns {Iterable} iterable */ - constructor({ - context, - fs, - resolverFactory, - options, - associatedObjectForCache, - layers = false - }) { - super(); - this.hooks = Object.freeze({ - /** @type {AsyncSeriesBailHook<[ResolveData], TODO>} */ - resolve: new AsyncSeriesBailHook(["resolveData"]), - /** @type {HookMap>} */ - resolveForScheme: new HookMap( - () => new AsyncSeriesBailHook(["resourceData", "resolveData"]) - ), - /** @type {HookMap>} */ - resolveInScheme: new HookMap( - () => new AsyncSeriesBailHook(["resourceData", "resolveData"]) - ), - /** @type {AsyncSeriesBailHook<[ResolveData], TODO>} */ - factorize: new AsyncSeriesBailHook(["resolveData"]), - /** @type {AsyncSeriesBailHook<[ResolveData], TODO>} */ - beforeResolve: new AsyncSeriesBailHook(["resolveData"]), - /** @type {AsyncSeriesBailHook<[ResolveData], TODO>} */ - afterResolve: new AsyncSeriesBailHook(["resolveData"]), - /** @type {AsyncSeriesBailHook<[ResolveData["createData"], ResolveData], TODO>} */ - createModule: new AsyncSeriesBailHook(["createData", "resolveData"]), - /** @type {SyncWaterfallHook<[Module, ResolveData["createData"], ResolveData], TODO>} */ - module: new SyncWaterfallHook(["module", "createData", "resolveData"]), - createParser: new HookMap(() => new SyncBailHook(["parserOptions"])), - parser: new HookMap(() => new SyncHook(["parser", "parserOptions"])), - createGenerator: new HookMap( - () => new SyncBailHook(["generatorOptions"]) - ), - generator: new HookMap( - () => new SyncHook(["generator", "generatorOptions"]) - ) - }); - this.resolverFactory = resolverFactory; - this.ruleSet = ruleSetCompiler.compile([ - { - rules: options.defaultRules - }, - { - rules: options.rules - } + getFileIterable() { + return this._createIterable(s => [ + s.fileTimestamps, + s.fileHashes, + s.fileTshs, + s.managedFiles ]); - this.context = context || ""; - this.fs = fs; - this._globalParserOptions = options.parser; - this._globalGeneratorOptions = options.generator; - /** @type {Map>} */ - this.parserCache = new Map(); - /** @type {Map>} */ - this.generatorCache = new Map(); - /** @type {Set} */ - this._restoredUnsafeCacheEntries = new Set(); - - const cacheParseResource = parseResource.bindCache( - associatedObjectForCache - ); - const cachedParseResourceWithoutFragment = - parseResourceWithoutFragment.bindCache(associatedObjectForCache); - this._parseResourceWithoutFragment = cachedParseResourceWithoutFragment; + } - this.hooks.factorize.tapAsync( - { - name: "NormalModuleFactory", - stage: 100 - }, - (resolveData, callback) => { - this.hooks.resolve.callAsync(resolveData, (err, result) => { - if (err) return callback(err); + /** + * @returns {Iterable} iterable + */ + getContextIterable() { + return this._createIterable(s => [ + s.contextTimestamps, + s.contextHashes, + s.contextTshs, + s.managedContexts + ]); + } - // Ignored - if (result === false) return callback(); + /** + * @returns {Iterable} iterable + */ + getMissingIterable() { + return this._createIterable(s => [s.missingExistence, s.managedMissing]); + } +} - // direct module - if (result instanceof Module) return callback(null, result); +makeSerializable(Snapshot, "webpack/lib/FileSystemInfo", "Snapshot"); - if (typeof result === "object") - throw new Error( - deprecationChangedHookMessage("resolve", this.hooks.resolve) + - " Returning a Module object will result in this module used as result." - ); +const MIN_COMMON_SNAPSHOT_SIZE = 3; - this.hooks.afterResolve.callAsync(resolveData, (err, result) => { - if (err) return callback(err); +/** + * @template T + */ +class SnapshotOptimization { + /** + * @param {function(Snapshot): boolean} has has value + * @param {function(Snapshot): Map | Set} get get value + * @param {function(Snapshot, Map | Set): void} set set value + * @param {boolean=} useStartTime use the start time of snapshots + * @param {boolean=} isSet value is an Set instead of a Map + */ + constructor(has, get, set, useStartTime = true, isSet = false) { + this._has = has; + this._get = get; + this._set = set; + this._useStartTime = useStartTime; + this._isSet = isSet; + /** @type {Map} */ + this._map = new Map(); + this._statItemsShared = 0; + this._statItemsUnshared = 0; + this._statSharedSnapshots = 0; + this._statReusedSharedSnapshots = 0; + } - if (typeof result === "object") - throw new Error( - deprecationChangedHookMessage( - "afterResolve", - this.hooks.afterResolve - ) - ); + getStatisticMessage() { + const total = this._statItemsShared + this._statItemsUnshared; + if (total === 0) return undefined; + return `${ + this._statItemsShared && Math.round((this._statItemsShared * 100) / total) + }% (${this._statItemsShared}/${total}) entries shared via ${ + this._statSharedSnapshots + } shared snapshots (${ + this._statReusedSharedSnapshots + this._statSharedSnapshots + } times referenced)`; + } - // Ignored - if (result === false) return callback(); + clear() { + this._map.clear(); + this._statItemsShared = 0; + this._statItemsUnshared = 0; + this._statSharedSnapshots = 0; + this._statReusedSharedSnapshots = 0; + } - const createData = resolveData.createData; + /** + * @param {Snapshot} newSnapshot snapshot + * @param {Set} capturedFiles files to snapshot/share + * @returns {void} + */ + optimize(newSnapshot, capturedFiles) { + /** + * @param {SnapshotOptimizationEntry} entry optimization entry + * @returns {void} + */ + const increaseSharedAndStoreOptimizationEntry = entry => { + if (entry.children !== undefined) { + entry.children.forEach(increaseSharedAndStoreOptimizationEntry); + } + entry.shared++; + storeOptimizationEntry(entry); + }; + /** + * @param {SnapshotOptimizationEntry} entry optimization entry + * @returns {void} + */ + const storeOptimizationEntry = entry => { + for (const path of entry.snapshotContent) { + const old = this._map.get(path); + if (old.shared < entry.shared) { + this._map.set(path, entry); + } + capturedFiles.delete(path); + } + }; - this.hooks.createModule.callAsync( - createData, - resolveData, - (err, createdModule) => { - if (!createdModule) { - if (!resolveData.request) { - return callback(new Error("Empty dependency (no request)")); - } + /** @type {SnapshotOptimizationEntry} */ + let newOptimizationEntry = undefined; - createdModule = new NormalModule(createData); - } + const capturedFilesSize = capturedFiles.size; - createdModule = this.hooks.module.call( - createdModule, - createData, - resolveData - ); + /** @type {Set | undefined} */ + const optimizationEntries = new Set(); - return callback(null, createdModule); - } - ); - }); - }); + for (const path of capturedFiles) { + const optimizationEntry = this._map.get(path); + if (optimizationEntry === undefined) { + if (newOptimizationEntry === undefined) { + newOptimizationEntry = { + snapshot: newSnapshot, + shared: 0, + snapshotContent: undefined, + children: undefined + }; + } + this._map.set(path, newOptimizationEntry); + continue; + } else { + optimizationEntries.add(optimizationEntry); } - ); - this.hooks.resolve.tapAsync( - { - name: "NormalModuleFactory", - stage: 100 - }, - (data, callback) => { - const { - contextInfo, - context, - dependencies, - dependencyType, - request, - assertions, - resolveOptions, - fileDependencies, - missingDependencies, - contextDependencies - } = data; - const loaderResolver = this.getResolver("loader"); - - /** @type {ResourceData | undefined} */ - let matchResourceData = undefined; - /** @type {string} */ - let unresolvedResource; - /** @type {ParsedLoaderRequest[]} */ - let elements; - let noPreAutoLoaders = false; - let noAutoLoaders = false; - let noPrePostAutoLoaders = false; - - const contextScheme = getScheme(context); - /** @type {string | undefined} */ - let scheme = getScheme(request); + } - if (!scheme) { - /** @type {string} */ - let requestWithoutMatchResource = request; - const matchResourceMatch = MATCH_RESOURCE_REGEX.exec(request); - if (matchResourceMatch) { - let matchResource = matchResourceMatch[1]; - if (matchResource.charCodeAt(0) === 46) { - // 46 === ".", 47 === "/" - const secondChar = matchResource.charCodeAt(1); - if ( - secondChar === 47 || - (secondChar === 46 && matchResource.charCodeAt(2) === 47) - ) { - // if matchResources startsWith ../ or ./ - matchResource = join(this.fs, context, matchResource); - } + optimizationEntries: for (const optimizationEntry of optimizationEntries) { + const snapshot = optimizationEntry.snapshot; + if (optimizationEntry.shared > 0) { + // It's a shared snapshot + // We can't change it, so we can only use it when all files match + // and startTime is compatible + if ( + this._useStartTime && + newSnapshot.startTime && + (!snapshot.startTime || snapshot.startTime > newSnapshot.startTime) + ) { + continue; + } + const nonSharedFiles = new Set(); + const snapshotContent = optimizationEntry.snapshotContent; + const snapshotEntries = this._get(snapshot); + for (const path of snapshotContent) { + if (!capturedFiles.has(path)) { + if (!snapshotEntries.has(path)) { + // File is not shared and can't be removed from the snapshot + // because it's in a child of the snapshot + continue optimizationEntries; } - matchResourceData = { - resource: matchResource, - ...cacheParseResource(matchResource) - }; - requestWithoutMatchResource = request.substr( - matchResourceMatch[0].length - ); + nonSharedFiles.add(path); + continue; } - - scheme = getScheme(requestWithoutMatchResource); - - if (!scheme && !contextScheme) { - const firstChar = requestWithoutMatchResource.charCodeAt(0); - const secondChar = requestWithoutMatchResource.charCodeAt(1); - noPreAutoLoaders = firstChar === 45 && secondChar === 33; // startsWith "-!" - noAutoLoaders = noPreAutoLoaders || firstChar === 33; // startsWith "!" - noPrePostAutoLoaders = firstChar === 33 && secondChar === 33; // startsWith "!!"; - const rawElements = requestWithoutMatchResource - .slice( - noPreAutoLoaders || noPrePostAutoLoaders - ? 2 - : noAutoLoaders - ? 1 - : 0 - ) - .split(/!+/); - unresolvedResource = rawElements.pop(); - elements = rawElements.map(el => { - const { path, query } = cachedParseResourceWithoutFragment(el); - return { - loader: path, - options: query ? query.slice(1) : undefined - }; - }); - scheme = getScheme(unresolvedResource); - } else { - unresolvedResource = requestWithoutMatchResource; - elements = EMPTY_ELEMENTS; - } - } else { - unresolvedResource = request; - elements = EMPTY_ELEMENTS; } - - const resolveContext = { - fileDependencies, - missingDependencies, - contextDependencies - }; - - /** @type {ResourceDataWithData} */ - let resourceData; - - let loaders; - - const continueCallback = needCalls(2, err => { - if (err) return callback(err); - - // translate option idents - try { - for (const item of loaders) { - if (typeof item.options === "string" && item.options[0] === "?") { - const ident = item.options.substr(1); - if (ident === "[[missing ident]]") { - throw new Error( - "No ident is provided by referenced loader. " + - "When using a function for Rule.use in config you need to " + - "provide an 'ident' property for referenced loader options." - ); - } - item.options = this.ruleSet.references.get(ident); - if (item.options === undefined) { - throw new Error( - "Invalid ident is provided by referenced loader" - ); - } - item.ident = ident; - } - } - } catch (e) { - return callback(e); - } - - if (!resourceData) { - // ignored - return callback(null, dependencies[0].createIgnoredModule(context)); + if (nonSharedFiles.size === 0) { + // The complete snapshot is shared + // add it as child + newSnapshot.addChild(snapshot); + increaseSharedAndStoreOptimizationEntry(optimizationEntry); + this._statReusedSharedSnapshots++; + } else { + // Only a part of the snapshot is shared + const sharedCount = snapshotContent.size - nonSharedFiles.size; + if (sharedCount < MIN_COMMON_SNAPSHOT_SIZE) { + // Common part it too small + continue optimizationEntries; } - - const userRequest = - (matchResourceData !== undefined - ? `${matchResourceData.resource}!=!` - : "") + - stringifyLoadersAndResource(loaders, resourceData.resource); - - const settings = {}; - const useLoadersPost = []; - const useLoaders = []; - const useLoadersPre = []; - - // handle .webpack[] suffix - let resource; - let match; - if ( - matchResourceData && - typeof (resource = matchResourceData.resource) === "string" && - (match = /\.webpack\[([^\]]+)\]$/.exec(resource)) - ) { - settings.type = match[1]; - matchResourceData.resource = matchResourceData.resource.slice( - 0, - -settings.type.length - 10 - ); + // Extract common timestamps from both snapshots + let commonMap; + if (this._isSet) { + commonMap = new Set(); + for (const path of /** @type {Set} */ (snapshotEntries)) { + if (nonSharedFiles.has(path)) continue; + commonMap.add(path); + snapshotEntries.delete(path); + } } else { - settings.type = "javascript/auto"; - const resourceDataForRules = matchResourceData || resourceData; - const result = this.ruleSet.exec({ - resource: resourceDataForRules.path, - realResource: resourceData.path, - resourceQuery: resourceDataForRules.query, - resourceFragment: resourceDataForRules.fragment, - scheme, - assertions, - mimetype: matchResourceData - ? "" - : resourceData.data.mimetype || "", - dependency: dependencyType, - descriptionData: matchResourceData - ? undefined - : resourceData.data.descriptionFileData, - issuer: contextInfo.issuer, - compiler: contextInfo.compiler, - issuerLayer: contextInfo.issuerLayer || "" - }); - for (const r of result) { - if (r.type === "use") { - if (!noAutoLoaders && !noPrePostAutoLoaders) { - useLoaders.push(r.value); - } - } else if (r.type === "use-post") { - if (!noPrePostAutoLoaders) { - useLoadersPost.push(r.value); - } - } else if (r.type === "use-pre") { - if (!noPreAutoLoaders && !noPrePostAutoLoaders) { - useLoadersPre.push(r.value); - } - } else if ( - typeof r.value === "object" && - r.value !== null && - typeof settings[r.type] === "object" && - settings[r.type] !== null - ) { - settings[r.type] = cachedCleverMerge(settings[r.type], r.value); - } else { - settings[r.type] = r.value; - } + commonMap = new Map(); + const map = /** @type {Map} */ (snapshotEntries); + for (const [path, value] of map) { + if (nonSharedFiles.has(path)) continue; + commonMap.set(path, value); + snapshotEntries.delete(path); } } - - let postLoaders, normalLoaders, preLoaders; - - const continueCallback = needCalls(3, err => { - if (err) { - return callback(err); - } - const allLoaders = postLoaders; - if (matchResourceData === undefined) { - for (const loader of loaders) allLoaders.push(loader); - for (const loader of normalLoaders) allLoaders.push(loader); - } else { - for (const loader of normalLoaders) allLoaders.push(loader); - for (const loader of loaders) allLoaders.push(loader); - } - for (const loader of preLoaders) allLoaders.push(loader); - let type = settings.type; - const resolveOptions = settings.resolve; - const layer = settings.layer; - if (layer !== undefined && !layers) { - return callback( - new Error( - "'Rule.layer' is only allowed when 'experiments.layers' is enabled" - ) - ); - } - try { - Object.assign(data.createData, { - layer: - layer === undefined ? contextInfo.issuerLayer || null : layer, - request: stringifyLoadersAndResource( - allLoaders, - resourceData.resource - ), - userRequest, - rawRequest: request, - loaders: allLoaders, - resource: resourceData.resource, - context: - resourceData.context || getContext(resourceData.resource), - matchResource: matchResourceData - ? matchResourceData.resource - : undefined, - resourceResolveData: resourceData.data, - settings, - type, - parser: this.getParser(type, settings.parser), - parserOptions: settings.parser, - generator: this.getGenerator(type, settings.generator), - generatorOptions: settings.generator, - resolveOptions - }); - } catch (e) { - return callback(e); - } - callback(); - }); - this.resolveRequestArray( - contextInfo, - this.context, - useLoadersPost, - loaderResolver, - resolveContext, - (err, result) => { - postLoaders = result; - continueCallback(err); - } - ); - this.resolveRequestArray( - contextInfo, - this.context, - useLoaders, - loaderResolver, - resolveContext, - (err, result) => { - normalLoaders = result; - continueCallback(err); + // Create and attach snapshot + const commonSnapshot = new Snapshot(); + if (this._useStartTime) { + commonSnapshot.setMergedStartTime(newSnapshot.startTime, snapshot); + } + this._set(commonSnapshot, commonMap); + newSnapshot.addChild(commonSnapshot); + snapshot.addChild(commonSnapshot); + // Create optimization entry + const newEntry = { + snapshot: commonSnapshot, + shared: optimizationEntry.shared + 1, + snapshotContent: new Set(commonMap.keys()), + children: undefined + }; + if (optimizationEntry.children === undefined) + optimizationEntry.children = new Set(); + optimizationEntry.children.add(newEntry); + storeOptimizationEntry(newEntry); + this._statSharedSnapshots++; + } + } else { + // It's a unshared snapshot + // We can extract a common shared snapshot + // with all common files + const snapshotEntries = this._get(snapshot); + if (snapshotEntries === undefined) { + // Incomplete snapshot, that can't be used + continue optimizationEntries; + } + let commonMap; + if (this._isSet) { + commonMap = new Set(); + const set = /** @type {Set} */ (snapshotEntries); + if (capturedFiles.size < set.size) { + for (const path of capturedFiles) { + if (set.has(path)) commonMap.add(path); } - ); - this.resolveRequestArray( - contextInfo, - this.context, - useLoadersPre, - loaderResolver, - resolveContext, - (err, result) => { - preLoaders = result; - continueCallback(err); + } else { + for (const path of set) { + if (capturedFiles.has(path)) commonMap.add(path); } - ); - }); - - this.resolveRequestArray( - contextInfo, - contextScheme ? this.context : context, - elements, - loaderResolver, - resolveContext, - (err, result) => { - if (err) return continueCallback(err); - loaders = result; - continueCallback(); - } - ); - - const defaultResolve = context => { - if (/^($|\?)/.test(unresolvedResource)) { - resourceData = { - resource: unresolvedResource, - data: {}, - ...cacheParseResource(unresolvedResource) - }; - continueCallback(); } - - // resource without scheme and with path - else { - const normalResolver = this.getResolver( - "normal", - dependencyType - ? cachedSetProperty( - resolveOptions || EMPTY_RESOLVE_OPTIONS, - "dependencyType", - dependencyType - ) - : resolveOptions - ); - this.resolveResource( - contextInfo, - context, - unresolvedResource, - normalResolver, - resolveContext, - (err, resolvedResource, resolvedResourceResolveData) => { - if (err) return continueCallback(err); - if (resolvedResource !== false) { - resourceData = { - resource: resolvedResource, - data: resolvedResourceResolveData, - ...cacheParseResource(resolvedResource) - }; - } - continueCallback(); - } - ); + } else { + commonMap = new Map(); + const map = /** @type {Map} */ (snapshotEntries); + for (const path of capturedFiles) { + const ts = map.get(path); + if (ts === undefined) continue; + commonMap.set(path, ts); } - }; - - // resource with scheme - if (scheme) { - resourceData = { - resource: unresolvedResource, - data: {}, - path: undefined, - query: undefined, - fragment: undefined, - context: undefined - }; - this.hooks.resolveForScheme - .for(scheme) - .callAsync(resourceData, data, err => { - if (err) return continueCallback(err); - continueCallback(); - }); } - // resource within scheme - else if (contextScheme) { - resourceData = { - resource: unresolvedResource, - data: {}, - path: undefined, - query: undefined, - fragment: undefined, - context: undefined - }; - this.hooks.resolveInScheme - .for(contextScheme) - .callAsync(resourceData, data, (err, handled) => { - if (err) return continueCallback(err); - if (!handled) return defaultResolve(this.context); - continueCallback(); - }); + if (commonMap.size < MIN_COMMON_SNAPSHOT_SIZE) { + // Common part it too small + continue optimizationEntries; } - - // resource without scheme and without path - else defaultResolve(context); + // Create and attach snapshot + const commonSnapshot = new Snapshot(); + if (this._useStartTime) { + commonSnapshot.setMergedStartTime(newSnapshot.startTime, snapshot); + } + this._set(commonSnapshot, commonMap); + newSnapshot.addChild(commonSnapshot); + snapshot.addChild(commonSnapshot); + // Remove files from snapshot + for (const path of commonMap.keys()) snapshotEntries.delete(path); + const sharedCount = commonMap.size; + this._statItemsUnshared -= sharedCount; + this._statItemsShared += sharedCount; + // Create optimization entry + storeOptimizationEntry({ + snapshot: commonSnapshot, + shared: 2, + snapshotContent: new Set(commonMap.keys()), + children: undefined + }); + this._statSharedSnapshots++; } - ); - } - - cleanupForCache() { - for (const module of this._restoredUnsafeCacheEntries) { - ChunkGraph.clearChunkGraphForModule(module); - ModuleGraph.clearModuleGraphForModule(module); - module.cleanupForCache(); } + const unshared = capturedFiles.size; + this._statItemsUnshared += unshared; + this._statItemsShared += capturedFilesSize - unshared; } +} - /** - * @param {ModuleFactoryCreateData} data data object - * @param {function(Error=, ModuleFactoryResult=): void} callback callback - * @returns {void} - */ - create(data, callback) { - const dependencies = /** @type {ModuleDependency[]} */ (data.dependencies); - const context = data.context || this.context; - const resolveOptions = data.resolveOptions || EMPTY_RESOLVE_OPTIONS; - const dependency = dependencies[0]; - const request = dependency.request; - const assertions = dependency.assertions; - const contextInfo = data.contextInfo; - const fileDependencies = new LazySet(); - const missingDependencies = new LazySet(); - const contextDependencies = new LazySet(); - const dependencyType = - (dependencies.length > 0 && dependencies[0].category) || ""; - /** @type {ResolveData} */ - const resolveData = { - contextInfo, - resolveOptions, - context, - request, - assertions, - dependencies, - dependencyType, - fileDependencies, - missingDependencies, - contextDependencies, - createData: {}, - cacheable: true - }; - this.hooks.beforeResolve.callAsync(resolveData, (err, result) => { - if (err) { - return callback(err, { - fileDependencies, - missingDependencies, - contextDependencies, - cacheable: false - }); - } +const parseString = str => { + if (str[0] === "'") str = `"${str.slice(1, -1).replace(/"/g, '\\"')}"`; + return JSON.parse(str); +}; - // Ignored - if (result === false) { - return callback(null, { - fileDependencies, - missingDependencies, - contextDependencies, - cacheable: resolveData.cacheable - }); - } +/* istanbul ignore next */ +/** + * @param {number} mtime mtime + */ +const applyMtime = mtime => { + if (FS_ACCURACY > 1 && mtime % 2 !== 0) FS_ACCURACY = 1; + else if (FS_ACCURACY > 10 && mtime % 20 !== 0) FS_ACCURACY = 10; + else if (FS_ACCURACY > 100 && mtime % 200 !== 0) FS_ACCURACY = 100; + else if (FS_ACCURACY > 1000 && mtime % 2000 !== 0) FS_ACCURACY = 1000; +}; - if (typeof result === "object") - throw new Error( - deprecationChangedHookMessage( - "beforeResolve", - this.hooks.beforeResolve - ) - ); +/** + * @template T + * @template K + * @param {Map} a source map + * @param {Map} b joining map + * @returns {Map} joined map + */ +const mergeMaps = (a, b) => { + if (!b || b.size === 0) return a; + if (!a || a.size === 0) return b; + const map = new Map(a); + for (const [key, value] of b) { + map.set(key, value); + } + return map; +}; - this.hooks.factorize.callAsync(resolveData, (err, module) => { - if (err) { - return callback(err, { - fileDependencies, - missingDependencies, - contextDependencies, - cacheable: false - }); - } - - const factoryResult = { - module, - fileDependencies, - missingDependencies, - contextDependencies, - cacheable: resolveData.cacheable - }; - - callback(null, factoryResult); - }); - }); - } - - resolveResource( - contextInfo, - context, - unresolvedResource, - resolver, - resolveContext, - callback - ) { - resolver.resolve( - contextInfo, - context, - unresolvedResource, - resolveContext, - (err, resolvedResource, resolvedResourceResolveData) => { - if (err) { - return this._resolveResourceErrorHints( - err, - contextInfo, - context, - unresolvedResource, - resolver, - resolveContext, - (err2, hints) => { - if (err2) { - err.message += ` -An fatal error happened during resolving additional hints for this error: ${err2.message}`; - err.stack += ` - -An fatal error happened during resolving additional hints for this error: -${err2.stack}`; - return callback(err); - } - if (hints && hints.length > 0) { - err.message += ` -${hints.join("\n\n")}`; - } - callback(err); - } - ); - } - callback(err, resolvedResource, resolvedResourceResolveData); - } - ); - } - - _resolveResourceErrorHints( - error, - contextInfo, - context, - unresolvedResource, - resolver, - resolveContext, - callback - ) { - asyncLib.parallel( - [ - callback => { - if (!resolver.options.fullySpecified) return callback(); - resolver - .withOptions({ - fullySpecified: false - }) - .resolve( - contextInfo, - context, - unresolvedResource, - resolveContext, - (err, resolvedResource) => { - if (!err && resolvedResource) { - const resource = parseResource(resolvedResource).path.replace( - /^.*[\\/]/, - "" - ); - return callback( - null, - `Did you mean '${resource}'? -BREAKING CHANGE: The request '${unresolvedResource}' failed to resolve only because it was resolved as fully specified -(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"'). -The extension in the request is mandatory for it to be fully specified. -Add the extension to the request.` - ); - } - callback(); - } - ); - }, - callback => { - if (!resolver.options.enforceExtension) return callback(); - resolver - .withOptions({ - enforceExtension: false, - extensions: [] - }) - .resolve( - contextInfo, - context, - unresolvedResource, - resolveContext, - (err, resolvedResource) => { - if (!err && resolvedResource) { - let hint = ""; - const match = /(\.[^.]+)(\?|$)/.exec(unresolvedResource); - if (match) { - const fixedRequest = unresolvedResource.replace( - /(\.[^.]+)(\?|$)/, - "$2" - ); - if (resolver.options.extensions.has(match[1])) { - hint = `Did you mean '${fixedRequest}'?`; - } else { - hint = `Did you mean '${fixedRequest}'? Also note that '${match[1]}' is not in 'resolve.extensions' yet and need to be added for this to work?`; - } - } else { - hint = `Did you mean to omit the extension or to remove 'resolve.enforceExtension'?`; - } - return callback( - null, - `The request '${unresolvedResource}' failed to resolve only because 'resolve.enforceExtension' was specified. -${hint} -Including the extension in the request is no longer possible. Did you mean to enforce including the extension in requests with 'resolve.extensions: []' instead?` - ); - } - callback(); - } - ); - }, - callback => { - if ( - /^\.\.?\//.test(unresolvedResource) || - resolver.options.preferRelative - ) { - return callback(); - } - resolver.resolve( - contextInfo, - context, - `./${unresolvedResource}`, - resolveContext, - (err, resolvedResource) => { - if (err || !resolvedResource) return callback(); - const moduleDirectories = resolver.options.modules - .map(m => (Array.isArray(m) ? m.join(", ") : m)) - .join(", "); - callback( - null, - `Did you mean './${unresolvedResource}'? -Requests that should resolve in the current directory need to start with './'. -Requests that start with a name are treated as module requests and resolve within module directories (${moduleDirectories}). -If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.` - ); - } - ); - } - ], - (err, hints) => { - if (err) return callback(err); - callback(null, hints.filter(Boolean)); - } - ); - } - - resolveRequestArray( - contextInfo, - context, - array, - resolver, - resolveContext, - callback - ) { - if (array.length === 0) return callback(null, array); - asyncLib.map( - array, - (item, callback) => { - resolver.resolve( - contextInfo, - context, - item.loader, - resolveContext, - (err, result) => { - if ( - err && - /^[^/]*$/.test(item.loader) && - !/-loader$/.test(item.loader) - ) { - return resolver.resolve( - contextInfo, - context, - item.loader + "-loader", - resolveContext, - err2 => { - if (!err2) { - err.message = - err.message + - "\n" + - "BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when using loaders.\n" + - ` You need to specify '${item.loader}-loader' instead of '${item.loader}',\n` + - " see https://webpack.js.org/migrate/3/#automatic-loader-module-name-extension-removed"; - } - callback(err); - } - ); - } - if (err) return callback(err); - - const parsedResult = this._parseResourceWithoutFragment(result); - const resolved = { - loader: parsedResult.path, - options: - item.options === undefined - ? parsedResult.query - ? parsedResult.query.slice(1) - : undefined - : item.options, - ident: item.options === undefined ? undefined : item.ident - }; - return callback(null, resolved); - } - ); - }, - callback - ); - } - - getParser(type, parserOptions = EMPTY_PARSER_OPTIONS) { - let cache = this.parserCache.get(type); - - if (cache === undefined) { - cache = new WeakMap(); - this.parserCache.set(type, cache); - } - - let parser = cache.get(parserOptions); - - if (parser === undefined) { - parser = this.createParser(type, parserOptions); - cache.set(parserOptions, parser); - } - - return parser; +/** + * @template T + * @template K + * @param {Set} a source map + * @param {Set} b joining map + * @returns {Set} joined map + */ +const mergeSets = (a, b) => { + if (!b || b.size === 0) return a; + if (!a || a.size === 0) return b; + const map = new Set(a); + for (const item of b) { + map.add(item); } + return map; +}; - /** - * @param {string} type type - * @param {{[k: string]: any}} parserOptions parser options - * @returns {Parser} parser - */ - createParser(type, parserOptions = {}) { - parserOptions = mergeGlobalOptions( - this._globalParserOptions, - type, - parserOptions - ); - const parser = this.hooks.createParser.for(type).call(parserOptions); - if (!parser) { - throw new Error(`No parser registered for ${type}`); +/** + * Finding file or directory to manage + * @param {string} managedPath path that is managing by {@link FileSystemInfo} + * @param {string} path path to file or directory + * @returns {string|null} managed item + * @example + * getManagedItem( + * '/Users/user/my-project/node_modules/', + * '/Users/user/my-project/node_modules/package/index.js' + * ) === '/Users/user/my-project/node_modules/package' + * getManagedItem( + * '/Users/user/my-project/node_modules/', + * '/Users/user/my-project/node_modules/package1/node_modules/package2' + * ) === '/Users/user/my-project/node_modules/package1/node_modules/package2' + * getManagedItem( + * '/Users/user/my-project/node_modules/', + * '/Users/user/my-project/node_modules/.bin/script.js' + * ) === null // hidden files are disallowed as managed items + * getManagedItem( + * '/Users/user/my-project/node_modules/', + * '/Users/user/my-project/node_modules/package' + * ) === '/Users/user/my-project/node_modules/package' + */ +const getManagedItem = (managedPath, path) => { + let i = managedPath.length; + let slashes = 1; + let startingPosition = true; + loop: while (i < path.length) { + switch (path.charCodeAt(i)) { + case 47: // slash + case 92: // backslash + if (--slashes === 0) break loop; + startingPosition = true; + break; + case 46: // . + // hidden files are disallowed as managed items + // it's probably .yarn-integrity or .cache + if (startingPosition) return null; + break; + case 64: // @ + if (!startingPosition) return null; + slashes++; + break; + default: + startingPosition = false; + break; } - this.hooks.parser.for(type).call(parser, parserOptions); - return parser; + i++; } - - getGenerator(type, generatorOptions = EMPTY_GENERATOR_OPTIONS) { - let cache = this.generatorCache.get(type); - - if (cache === undefined) { - cache = new WeakMap(); - this.generatorCache.set(type, cache); - } - - let generator = cache.get(generatorOptions); - - if (generator === undefined) { - generator = this.createGenerator(type, generatorOptions); - cache.set(generatorOptions, generator); + if (i === path.length) slashes--; + // return null when path is incomplete + if (slashes !== 0) return null; + // if (path.slice(i + 1, i + 13) === "node_modules") + if ( + path.length >= i + 13 && + path.charCodeAt(i + 1) === 110 && + path.charCodeAt(i + 2) === 111 && + path.charCodeAt(i + 3) === 100 && + path.charCodeAt(i + 4) === 101 && + path.charCodeAt(i + 5) === 95 && + path.charCodeAt(i + 6) === 109 && + path.charCodeAt(i + 7) === 111 && + path.charCodeAt(i + 8) === 100 && + path.charCodeAt(i + 9) === 117 && + path.charCodeAt(i + 10) === 108 && + path.charCodeAt(i + 11) === 101 && + path.charCodeAt(i + 12) === 115 + ) { + // if this is the end of the path + if (path.length === i + 13) { + // return the node_modules directory + // it's special + return path; } - - return generator; - } - - createGenerator(type, generatorOptions = {}) { - generatorOptions = mergeGlobalOptions( - this._globalGeneratorOptions, - type, - generatorOptions - ); - const generator = this.hooks.createGenerator - .for(type) - .call(generatorOptions); - if (!generator) { - throw new Error(`No generator registered for ${type}`); + const c = path.charCodeAt(i + 13); + // if next symbol is slash or backslash + if (c === 47 || c === 92) { + // Managed subpath + return getManagedItem(path.slice(0, i + 14), path); } - this.hooks.generator.for(type).call(generator, generatorOptions); - return generator; - } - - getResolver(type, resolveOptions) { - return this.resolverFactory.get(type, resolveOptions); } -} - -module.exports = NormalModuleFactory; - - -/***/ }), - -/***/ 30633: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - + return path.slice(0, i); +}; -const { join, dirname } = __webpack_require__(17139); +/** + * @template {ContextFileSystemInfoEntry | ContextTimestampAndHash} T + * @param {T} entry entry + * @returns {T["resolved"] | undefined} the resolved entry + */ +const getResolvedTimestamp = entry => { + if (entry === null) return null; + if (entry.resolved !== undefined) return entry.resolved; + return entry.symlinks === undefined ? entry : undefined; +}; -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {function(TODO): void} ModuleReplacer */ +/** + * @param {ContextHash} entry entry + * @returns {string | undefined} the resolved entry + */ +const getResolvedHash = entry => { + if (entry === null) return null; + if (entry.resolved !== undefined) return entry.resolved; + return entry.symlinks === undefined ? entry.hash : undefined; +}; -class NormalModuleReplacementPlugin { - /** - * Create an instance of the plugin - * @param {RegExp} resourceRegExp the resource matcher - * @param {string|ModuleReplacer} newResource the resource replacement - */ - constructor(resourceRegExp, newResource) { - this.resourceRegExp = resourceRegExp; - this.newResource = newResource; - } +const addAll = (source, target) => { + for (const key of source) target.add(key); +}; +/** + * Used to access information about the filesystem in a cached way + */ +class FileSystemInfo { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {InputFileSystem} fs file system + * @param {Object} options options + * @param {Iterable=} options.managedPaths paths that are only managed by a package manager + * @param {Iterable=} options.immutablePaths paths that are immutable + * @param {Logger=} options.logger logger used to log invalid snapshots + * @param {string | Hash=} options.hashFunction the hash function to use */ - apply(compiler) { - const resourceRegExp = this.resourceRegExp; - const newResource = this.newResource; - compiler.hooks.normalModuleFactory.tap( - "NormalModuleReplacementPlugin", - nmf => { - nmf.hooks.beforeResolve.tap("NormalModuleReplacementPlugin", result => { - if (resourceRegExp.test(result.request)) { - if (typeof newResource === "function") { - newResource(result); - } else { - result.request = newResource; - } - } - }); - nmf.hooks.afterResolve.tap("NormalModuleReplacementPlugin", result => { - const createData = result.createData; - if (resourceRegExp.test(createData.resource)) { - if (typeof newResource === "function") { - newResource(result); - } else { - const fs = compiler.inputFileSystem; - if ( - newResource.startsWith("/") || - (newResource.length > 1 && newResource[1] === ":") - ) { - createData.resource = newResource; - } else { - createData.resource = join( - fs, - dirname(fs, createData.resource), - newResource - ); - } - } - } - }); - } - ); - } -} - -module.exports = NormalModuleReplacementPlugin; - - -/***/ }), - -/***/ 80057: -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent -*/ - - - -exports.STAGE_BASIC = -10; -exports.STAGE_DEFAULT = 0; -exports.STAGE_ADVANCED = 10; - - -/***/ }), - -/***/ 81426: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -class OptionsApply { - process(options, compiler) {} -} -module.exports = OptionsApply; + constructor( + fs, + { + managedPaths = [], + immutablePaths = [], + logger, + hashFunction = "md4" + } = {} + ) { + this.fs = fs; + this.logger = logger; + this._remainingLogs = logger ? 40 : 0; + this._loggedPaths = logger ? new Set() : undefined; + this._hashFunction = hashFunction; + /** @type {WeakMap} */ + this._snapshotCache = new WeakMap(); + this._fileTimestampsOptimization = new SnapshotOptimization( + s => s.hasFileTimestamps(), + s => s.fileTimestamps, + (s, v) => s.setFileTimestamps(v) + ); + this._fileHashesOptimization = new SnapshotOptimization( + s => s.hasFileHashes(), + s => s.fileHashes, + (s, v) => s.setFileHashes(v), + false + ); + this._fileTshsOptimization = new SnapshotOptimization( + s => s.hasFileTshs(), + s => s.fileTshs, + (s, v) => s.setFileTshs(v) + ); + this._contextTimestampsOptimization = new SnapshotOptimization( + s => s.hasContextTimestamps(), + s => s.contextTimestamps, + (s, v) => s.setContextTimestamps(v) + ); + this._contextHashesOptimization = new SnapshotOptimization( + s => s.hasContextHashes(), + s => s.contextHashes, + (s, v) => s.setContextHashes(v), + false + ); + this._contextTshsOptimization = new SnapshotOptimization( + s => s.hasContextTshs(), + s => s.contextTshs, + (s, v) => s.setContextTshs(v) + ); + this._missingExistenceOptimization = new SnapshotOptimization( + s => s.hasMissingExistence(), + s => s.missingExistence, + (s, v) => s.setMissingExistence(v), + false + ); + this._managedItemInfoOptimization = new SnapshotOptimization( + s => s.hasManagedItemInfo(), + s => s.managedItemInfo, + (s, v) => s.setManagedItemInfo(v), + false + ); + this._managedFilesOptimization = new SnapshotOptimization( + s => s.hasManagedFiles(), + s => s.managedFiles, + (s, v) => s.setManagedFiles(v), + false, + true + ); + this._managedContextsOptimization = new SnapshotOptimization( + s => s.hasManagedContexts(), + s => s.managedContexts, + (s, v) => s.setManagedContexts(v), + false, + true + ); + this._managedMissingOptimization = new SnapshotOptimization( + s => s.hasManagedMissing(), + s => s.managedMissing, + (s, v) => s.setManagedMissing(v), + false, + true + ); + /** @type {StackedCacheMap} */ + this._fileTimestamps = new StackedCacheMap(); + /** @type {Map} */ + this._fileHashes = new Map(); + /** @type {Map} */ + this._fileTshs = new Map(); + /** @type {StackedCacheMap} */ + this._contextTimestamps = new StackedCacheMap(); + /** @type {Map} */ + this._contextHashes = new Map(); + /** @type {Map} */ + this._contextTshs = new Map(); + /** @type {Map} */ + this._managedItems = new Map(); + /** @type {AsyncQueue} */ + this.fileTimestampQueue = new AsyncQueue({ + name: "file timestamp", + parallelism: 30, + processor: this._readFileTimestamp.bind(this) + }); + /** @type {AsyncQueue} */ + this.fileHashQueue = new AsyncQueue({ + name: "file hash", + parallelism: 10, + processor: this._readFileHash.bind(this) + }); + /** @type {AsyncQueue} */ + this.contextTimestampQueue = new AsyncQueue({ + name: "context timestamp", + parallelism: 2, + processor: this._readContextTimestamp.bind(this) + }); + /** @type {AsyncQueue} */ + this.contextHashQueue = new AsyncQueue({ + name: "context hash", + parallelism: 2, + processor: this._readContextHash.bind(this) + }); + /** @type {AsyncQueue} */ + this.contextTshQueue = new AsyncQueue({ + name: "context hash and timestamp", + parallelism: 2, + processor: this._readContextTimestampAndHash.bind(this) + }); + /** @type {AsyncQueue} */ + this.managedItemQueue = new AsyncQueue({ + name: "managed item info", + parallelism: 10, + processor: this._getManagedItemInfo.bind(this) + }); + /** @type {AsyncQueue>} */ + this.managedItemDirectoryQueue = new AsyncQueue({ + name: "managed item directory info", + parallelism: 10, + processor: this._getManagedItemDirectoryInfo.bind(this) + }); + this.managedPaths = Array.from(managedPaths); + this.managedPathsWithSlash = /** @type {string[]} */ ( + this.managedPaths.filter(p => typeof p === "string") + ).map(p => join(fs, p, "_").slice(0, -1)); + this.managedPathsRegExps = /** @type {RegExp[]} */ ( + this.managedPaths.filter(p => typeof p !== "string") + ); + this.immutablePaths = Array.from(immutablePaths); + this.immutablePathsWithSlash = /** @type {string[]} */ ( + this.immutablePaths.filter(p => typeof p === "string") + ).map(p => join(fs, p, "_").slice(0, -1)); + this.immutablePathsRegExps = /** @type {RegExp[]} */ ( + this.immutablePaths.filter(p => typeof p !== "string") + ); -/***/ }), + this._cachedDeprecatedFileTimestamps = undefined; + this._cachedDeprecatedContextTimestamps = undefined; -/***/ 11715: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + this._warnAboutExperimentalEsmTracking = false; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + this._statCreatedSnapshots = 0; + this._statTestedSnapshotsCached = 0; + this._statTestedSnapshotsNotCached = 0; + this._statTestedChildrenCached = 0; + this._statTestedChildrenNotCached = 0; + this._statTestedEntries = 0; + } + logStatistics() { + const logWhenMessage = (header, message) => { + if (message) { + this.logger.log(`${header}: ${message}`); + } + }; + this.logger.log(`${this._statCreatedSnapshots} new snapshots created`); + this.logger.log( + `${ + this._statTestedSnapshotsNotCached && + Math.round( + (this._statTestedSnapshotsNotCached * 100) / + (this._statTestedSnapshotsCached + + this._statTestedSnapshotsNotCached) + ) + }% root snapshot uncached (${this._statTestedSnapshotsNotCached} / ${ + this._statTestedSnapshotsCached + this._statTestedSnapshotsNotCached + })` + ); + this.logger.log( + `${ + this._statTestedChildrenNotCached && + Math.round( + (this._statTestedChildrenNotCached * 100) / + (this._statTestedChildrenCached + this._statTestedChildrenNotCached) + ) + }% children snapshot uncached (${this._statTestedChildrenNotCached} / ${ + this._statTestedChildrenCached + this._statTestedChildrenNotCached + })` + ); + this.logger.log(`${this._statTestedEntries} entries tested`); + this.logger.log( + `File info in cache: ${this._fileTimestamps.size} timestamps ${this._fileHashes.size} hashes ${this._fileTshs.size} timestamp hash combinations` + ); + logWhenMessage( + `File timestamp snapshot optimization`, + this._fileTimestampsOptimization.getStatisticMessage() + ); + logWhenMessage( + `File hash snapshot optimization`, + this._fileHashesOptimization.getStatisticMessage() + ); + logWhenMessage( + `File timestamp hash combination snapshot optimization`, + this._fileTshsOptimization.getStatisticMessage() + ); + this.logger.log( + `Directory info in cache: ${this._contextTimestamps.size} timestamps ${this._contextHashes.size} hashes ${this._contextTshs.size} timestamp hash combinations` + ); + logWhenMessage( + `Directory timestamp snapshot optimization`, + this._contextTimestampsOptimization.getStatisticMessage() + ); + logWhenMessage( + `Directory hash snapshot optimization`, + this._contextHashesOptimization.getStatisticMessage() + ); + logWhenMessage( + `Directory timestamp hash combination snapshot optimization`, + this._contextTshsOptimization.getStatisticMessage() + ); + logWhenMessage( + `Missing items snapshot optimization`, + this._missingExistenceOptimization.getStatisticMessage() + ); + this.logger.log( + `Managed items info in cache: ${this._managedItems.size} items` + ); + logWhenMessage( + `Managed items snapshot optimization`, + this._managedItemInfoOptimization.getStatisticMessage() + ); + logWhenMessage( + `Managed files snapshot optimization`, + this._managedFilesOptimization.getStatisticMessage() + ); + logWhenMessage( + `Managed contexts snapshot optimization`, + this._managedContextsOptimization.getStatisticMessage() + ); + logWhenMessage( + `Managed missing snapshot optimization`, + this._managedMissingOptimization.getStatisticMessage() + ); + } + _log(path, reason, ...args) { + const key = path + reason; + if (this._loggedPaths.has(key)) return; + this._loggedPaths.add(key); + this.logger.debug(`${path} invalidated because ${reason}`, ...args); + if (--this._remainingLogs === 0) { + this.logger.debug( + "Logging limit has been reached and no further logging will be emitted by FileSystemInfo" + ); + } + } -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./NormalModule")} NormalModule */ + clear() { + this._remainingLogs = this.logger ? 40 : 0; + if (this._loggedPaths !== undefined) this._loggedPaths.clear(); -/** @typedef {Record} PreparsedAst */ + this._snapshotCache = new WeakMap(); + this._fileTimestampsOptimization.clear(); + this._fileHashesOptimization.clear(); + this._fileTshsOptimization.clear(); + this._contextTimestampsOptimization.clear(); + this._contextHashesOptimization.clear(); + this._contextTshsOptimization.clear(); + this._missingExistenceOptimization.clear(); + this._managedItemInfoOptimization.clear(); + this._managedFilesOptimization.clear(); + this._managedContextsOptimization.clear(); + this._managedMissingOptimization.clear(); + this._fileTimestamps.clear(); + this._fileHashes.clear(); + this._fileTshs.clear(); + this._contextTimestamps.clear(); + this._contextHashes.clear(); + this._contextTshs.clear(); + this._managedItems.clear(); + this._managedItems.clear(); -/** - * @typedef {Object} ParserStateBase - * @property {string | Buffer} source - * @property {NormalModule} current - * @property {NormalModule} module - * @property {Compilation} compilation - * @property {{[k: string]: any}} options - */ + this._cachedDeprecatedFileTimestamps = undefined; + this._cachedDeprecatedContextTimestamps = undefined; -/** @typedef {Record & ParserStateBase} ParserState */ + this._statCreatedSnapshots = 0; + this._statTestedSnapshotsCached = 0; + this._statTestedSnapshotsNotCached = 0; + this._statTestedChildrenCached = 0; + this._statTestedChildrenNotCached = 0; + this._statTestedEntries = 0; + } -class Parser { - /* istanbul ignore next */ /** - * @abstract - * @param {string | Buffer | PreparsedAst} source the source to parse - * @param {ParserState} state the parser state - * @returns {ParserState} the parser state + * @param {ReadonlyMap} map timestamps + * @param {boolean=} immutable if 'map' is immutable and FileSystemInfo can keep referencing it + * @returns {void} */ - parse(source, state) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + addFileTimestamps(map, immutable) { + this._fileTimestamps.addAll(map, immutable); + this._cachedDeprecatedFileTimestamps = undefined; } -} - -module.exports = Parser; - - -/***/ }), - -/***/ 73850: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {ReadonlyMap} map timestamps + * @param {boolean=} immutable if 'map' is immutable and FileSystemInfo can keep referencing it + * @returns {void} + */ + addContextTimestamps(map, immutable) { + this._contextTimestamps.addAll(map, immutable); + this._cachedDeprecatedContextTimestamps = undefined; + } + /** + * @param {string} path file path + * @param {function((WebpackError | null)=, (FileSystemInfoEntry | "ignore" | null)=): void} callback callback function + * @returns {void} + */ + getFileTimestamp(path, callback) { + const cache = this._fileTimestamps.get(path); + if (cache !== undefined) return callback(null, cache); + this.fileTimestampQueue.add(path, callback); + } -const PrefetchDependency = __webpack_require__(31618); + /** + * @param {string} path context path + * @param {function((WebpackError | null)=, (ResolvedContextFileSystemInfoEntry | "ignore" | null)=): void} callback callback function + * @returns {void} + */ + getContextTimestamp(path, callback) { + const cache = this._contextTimestamps.get(path); + if (cache !== undefined) { + if (cache === "ignore") return callback(null, "ignore"); + const resolved = getResolvedTimestamp(cache); + if (resolved !== undefined) return callback(null, resolved); + return this._resolveContextTimestamp(cache, callback); + } + this.contextTimestampQueue.add(path, (err, entry) => { + if (err) return callback(err); + const resolved = getResolvedTimestamp(entry); + if (resolved !== undefined) return callback(null, resolved); + this._resolveContextTimestamp(entry, callback); + }); + } -/** @typedef {import("./Compiler")} Compiler */ + /** + * @param {string} path context path + * @param {function((WebpackError | null)=, (ContextFileSystemInfoEntry | "ignore" | null)=): void} callback callback function + * @returns {void} + */ + _getUnresolvedContextTimestamp(path, callback) { + const cache = this._contextTimestamps.get(path); + if (cache !== undefined) return callback(null, cache); + this.contextTimestampQueue.add(path, callback); + } -class PrefetchPlugin { - constructor(context, request) { - if (request) { - this.context = context; - this.request = request; - } else { - this.context = null; - this.request = context; - } + /** + * @param {string} path file path + * @param {function((WebpackError | null)=, string=): void} callback callback function + * @returns {void} + */ + getFileHash(path, callback) { + const cache = this._fileHashes.get(path); + if (cache !== undefined) return callback(null, cache); + this.fileHashQueue.add(path, callback); } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {string} path context path + * @param {function((WebpackError | null)=, string=): void} callback callback function * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap( - "PrefetchPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - PrefetchDependency, - normalModuleFactory - ); - } - ); - compiler.hooks.make.tapAsync("PrefetchPlugin", (compilation, callback) => { - compilation.addModuleChain( - this.context || compiler.context, - new PrefetchDependency(this.request), - err => { - callback(err); - } - ); + getContextHash(path, callback) { + const cache = this._contextHashes.get(path); + if (cache !== undefined) { + const resolved = getResolvedHash(cache); + if (resolved !== undefined) return callback(null, resolved); + return this._resolveContextHash(cache, callback); + } + this.contextHashQueue.add(path, (err, entry) => { + if (err) return callback(err); + const resolved = getResolvedHash(entry); + if (resolved !== undefined) return callback(null, resolved); + this._resolveContextHash(entry, callback); }); } -} - -module.exports = PrefetchPlugin; + /** + * @param {string} path context path + * @param {function((WebpackError | null)=, ContextHash=): void} callback callback function + * @returns {void} + */ + _getUnresolvedContextHash(path, callback) { + const cache = this._contextHashes.get(path); + if (cache !== undefined) return callback(null, cache); + this.contextHashQueue.add(path, callback); + } -/***/ }), - -/***/ 13216: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const Compiler = __webpack_require__(70845); -const MultiCompiler = __webpack_require__(33370); -const NormalModule = __webpack_require__(39); -const createSchemaValidation = __webpack_require__(32540); -const { contextify } = __webpack_require__(82186); - -/** @typedef {import("../declarations/plugins/ProgressPlugin").HandlerFunction} HandlerFunction */ -/** @typedef {import("../declarations/plugins/ProgressPlugin").ProgressPluginArgument} ProgressPluginArgument */ -/** @typedef {import("../declarations/plugins/ProgressPlugin").ProgressPluginOptions} ProgressPluginOptions */ - -const validate = createSchemaValidation( - __webpack_require__(57647), - () => __webpack_require__(75202), - { - name: "Progress Plugin", - baseDataPath: "options" - } -); -const median3 = (a, b, c) => { - return a + b + c - Math.max(a, b, c) - Math.min(a, b, c); -}; - -const createDefaultHandler = (profile, logger) => { - /** @type {{ value: string, time: number }[]} */ - const lastStateInfo = []; - - const defaultHandler = (percentage, msg, ...args) => { - if (profile) { - if (percentage === 0) { - lastStateInfo.length = 0; - } - const fullState = [msg, ...args]; - const state = fullState.map(s => s.replace(/\d+\/\d+ /g, "")); - const now = Date.now(); - const len = Math.max(state.length, lastStateInfo.length); - for (let i = len; i >= 0; i--) { - const stateItem = i < state.length ? state[i] : undefined; - const lastStateItem = - i < lastStateInfo.length ? lastStateInfo[i] : undefined; - if (lastStateItem) { - if (stateItem !== lastStateItem.value) { - const diff = now - lastStateItem.time; - if (lastStateItem.value) { - let reportState = lastStateItem.value; - if (i > 0) { - reportState = lastStateInfo[i - 1].value + " > " + reportState; - } - const stateMsg = `${" | ".repeat(i)}${diff} ms ${reportState}`; - const d = diff; - // This depends on timing so we ignore it for coverage - /* istanbul ignore next */ - { - if (d > 10000) { - logger.error(stateMsg); - } else if (d > 1000) { - logger.warn(stateMsg); - } else if (d > 10) { - logger.info(stateMsg); - } else if (d > 5) { - logger.log(stateMsg); - } else { - logger.debug(stateMsg); - } - } - } - if (stateItem === undefined) { - lastStateInfo.length = i; - } else { - lastStateItem.value = stateItem; - lastStateItem.time = now; - lastStateInfo.length = i + 1; - } - } - } else { - lastStateInfo[i] = { - value: stateItem, - time: now - }; - } - } - } - logger.status(`${Math.floor(percentage * 100)}%`, msg, ...args); - if (percentage === 1 || (!msg && args.length === 0)) logger.status(); - }; - - return defaultHandler; -}; - -/** - * @callback ReportProgress - * @param {number} p - * @param {...string} [args] - * @returns {void} - */ - -/** @type {WeakMap} */ -const progressReporters = new WeakMap(); - -class ProgressPlugin { - /** - * @param {Compiler} compiler the current compiler - * @returns {ReportProgress} a progress reporter, if any - */ - static getReporter(compiler) { - return progressReporters.get(compiler); - } - - /** - * @param {ProgressPluginArgument} options options - */ - constructor(options = {}) { - if (typeof options === "function") { - options = { - handler: options - }; - } - - validate(options); - options = { ...ProgressPlugin.defaultOptions, ...options }; - - this.profile = options.profile; - this.handler = options.handler; - this.modulesCount = options.modulesCount; - this.dependenciesCount = options.dependenciesCount; - this.showEntries = options.entries; - this.showModules = options.modules; - this.showDependencies = options.dependencies; - this.showActiveModules = options.activeModules; - this.percentBy = options.percentBy; - } + /** + * @param {string} path context path + * @param {function((WebpackError | null)=, ResolvedContextTimestampAndHash=): void} callback callback function + * @returns {void} + */ + getContextTsh(path, callback) { + const cache = this._contextTshs.get(path); + if (cache !== undefined) { + const resolved = getResolvedTimestamp(cache); + if (resolved !== undefined) return callback(null, resolved); + return this._resolveContextTsh(cache, callback); + } + this.contextTshQueue.add(path, (err, entry) => { + if (err) return callback(err); + const resolved = getResolvedTimestamp(entry); + if (resolved !== undefined) return callback(null, resolved); + this._resolveContextTsh(entry, callback); + }); + } /** - * @param {Compiler | MultiCompiler} compiler webpack compiler + * @param {string} path context path + * @param {function((WebpackError | null)=, ContextTimestampAndHash=): void} callback callback function * @returns {void} */ - apply(compiler) { - const handler = - this.handler || - createDefaultHandler( - this.profile, - compiler.getInfrastructureLogger("webpack.Progress") - ); - if (compiler instanceof MultiCompiler) { - this._applyOnMultiCompiler(compiler, handler); - } else if (compiler instanceof Compiler) { - this._applyOnCompiler(compiler, handler); - } + _getUnresolvedContextTsh(path, callback) { + const cache = this._contextTshs.get(path); + if (cache !== undefined) return callback(null, cache); + this.contextTshQueue.add(path, callback); } - /** - * @param {MultiCompiler} compiler webpack multi-compiler - * @param {HandlerFunction} handler function that executes for every progress step - * @returns {void} - */ - _applyOnMultiCompiler(compiler, handler) { - const states = compiler.compilers.map( - () => /** @type {[number, ...string[]]} */ ([0]) - ); - compiler.compilers.forEach((compiler, idx) => { - new ProgressPlugin((p, msg, ...args) => { - states[idx] = [p, msg, ...args]; - let sum = 0; - for (const [p] of states) sum += p; - handler(sum / states.length, `[${idx}] ${msg}`, ...args); - }).apply(compiler); + _createBuildDependenciesResolvers() { + const resolveContext = createResolver({ + resolveToContext: true, + exportsFields: [], + fileSystem: this.fs + }); + const resolveCjs = createResolver({ + extensions: [".js", ".json", ".node"], + conditionNames: ["require", "node"], + exportsFields: ["exports"], + fileSystem: this.fs + }); + const resolveCjsAsChild = createResolver({ + extensions: [".js", ".json", ".node"], + conditionNames: ["require", "node"], + exportsFields: [], + fileSystem: this.fs + }); + const resolveEsm = createResolver({ + extensions: [".js", ".json", ".node"], + fullySpecified: true, + conditionNames: ["import", "node"], + exportsFields: ["exports"], + fileSystem: this.fs }); + return { resolveContext, resolveEsm, resolveCjs, resolveCjsAsChild }; } /** - * @param {Compiler} compiler webpack compiler - * @param {HandlerFunction} handler function that executes for every progress step + * @param {string} context context directory + * @param {Iterable} deps dependencies + * @param {function((Error | null)=, ResolveBuildDependenciesResult=): void} callback callback function * @returns {void} */ - _applyOnCompiler(compiler, handler) { - const showEntries = this.showEntries; - const showModules = this.showModules; - const showDependencies = this.showDependencies; - const showActiveModules = this.showActiveModules; - let lastActiveModule = ""; - let currentLoader = ""; - let lastModulesCount = 0; - let lastDependenciesCount = 0; - let lastEntriesCount = 0; - let modulesCount = 0; - let dependenciesCount = 0; - let entriesCount = 1; - let doneModules = 0; - let doneDependencies = 0; - let doneEntries = 0; - const activeModules = new Set(); - let lastUpdate = 0; - - const updateThrottled = () => { - if (lastUpdate + 500 < Date.now()) update(); - }; - - const update = () => { - /** @type {string[]} */ - const items = []; - const percentByModules = - doneModules / - Math.max(lastModulesCount || this.modulesCount || 1, modulesCount); - const percentByEntries = - doneEntries / - Math.max(lastEntriesCount || this.dependenciesCount || 1, entriesCount); - const percentByDependencies = - doneDependencies / - Math.max(lastDependenciesCount || 1, dependenciesCount); - let percentageFactor; - - switch (this.percentBy) { - case "entries": - percentageFactor = percentByEntries; - break; - case "dependencies": - percentageFactor = percentByDependencies; - break; - case "modules": - percentageFactor = percentByModules; - break; - default: - percentageFactor = median3( - percentByModules, - percentByEntries, - percentByDependencies - ); - } - - const percentage = 0.1 + percentageFactor * 0.55; - - if (currentLoader) { - items.push( - `import loader ${contextify( - compiler.context, - currentLoader, - compiler.root - )}` - ); - } else { - const statItems = []; - if (showEntries) { - statItems.push(`${doneEntries}/${entriesCount} entries`); - } - if (showDependencies) { - statItems.push( - `${doneDependencies}/${dependenciesCount} dependencies` - ); - } - if (showModules) { - statItems.push(`${doneModules}/${modulesCount} modules`); - } - if (showActiveModules) { - statItems.push(`${activeModules.size} active`); - } - if (statItems.length > 0) { - items.push(statItems.join(" ")); - } - if (showActiveModules) { - items.push(lastActiveModule); - } - } - handler(percentage, "building", ...items); - lastUpdate = Date.now(); - }; - - const factorizeAdd = () => { - dependenciesCount++; - if (dependenciesCount < 50 || dependenciesCount % 100 === 0) - updateThrottled(); - }; + resolveBuildDependencies(context, deps, callback) { + const { resolveContext, resolveEsm, resolveCjs, resolveCjsAsChild } = + this._createBuildDependenciesResolvers(); - const factorizeDone = () => { - doneDependencies++; - if (doneDependencies < 50 || doneDependencies % 100 === 0) - updateThrottled(); + /** @type {Set} */ + const files = new Set(); + /** @type {Set} */ + const fileSymlinks = new Set(); + /** @type {Set} */ + const directories = new Set(); + /** @type {Set} */ + const directorySymlinks = new Set(); + /** @type {Set} */ + const missing = new Set(); + /** @type {Set} */ + const resolveFiles = new Set(); + /** @type {Set} */ + const resolveDirectories = new Set(); + /** @type {Set} */ + const resolveMissing = new Set(); + /** @type {Map} */ + const resolveResults = new Map(); + const invalidResolveResults = new Set(); + const resolverContext = { + fileDependencies: resolveFiles, + contextDependencies: resolveDirectories, + missingDependencies: resolveMissing }; - - const moduleAdd = () => { - modulesCount++; - if (modulesCount < 50 || modulesCount % 100 === 0) updateThrottled(); + const expectedToString = expected => { + return expected ? ` (expected ${expected})` : ""; }; - - // only used when showActiveModules is set - const moduleBuild = module => { - const ident = module.identifier(); - if (ident) { - activeModules.add(ident); - lastActiveModule = ident; - update(); + const jobToString = job => { + switch (job.type) { + case RBDT_RESOLVE_CJS: + return `resolve commonjs ${job.path}${expectedToString( + job.expected + )}`; + case RBDT_RESOLVE_ESM: + return `resolve esm ${job.path}${expectedToString(job.expected)}`; + case RBDT_RESOLVE_DIRECTORY: + return `resolve directory ${job.path}`; + case RBDT_RESOLVE_CJS_FILE: + return `resolve commonjs file ${job.path}${expectedToString( + job.expected + )}`; + case RBDT_RESOLVE_ESM_FILE: + return `resolve esm file ${job.path}${expectedToString( + job.expected + )}`; + case RBDT_DIRECTORY: + return `directory ${job.path}`; + case RBDT_FILE: + return `file ${job.path}`; + case RBDT_DIRECTORY_DEPENDENCIES: + return `directory dependencies ${job.path}`; + case RBDT_FILE_DEPENDENCIES: + return `file dependencies ${job.path}`; } + return `unknown ${job.type} ${job.path}`; }; - - const entryAdd = (entry, options) => { - entriesCount++; - if (entriesCount < 5 || entriesCount % 10 === 0) updateThrottled(); - }; - - const moduleDone = module => { - doneModules++; - if (showActiveModules) { - const ident = module.identifier(); - if (ident) { - activeModules.delete(ident); - if (lastActiveModule === ident) { - lastActiveModule = ""; - for (const m of activeModules) { - lastActiveModule = m; - } - update(); - return; - } - } + const pathToString = job => { + let result = ` at ${jobToString(job)}`; + job = job.issuer; + while (job !== undefined) { + result += `\n at ${jobToString(job)}`; + job = job.issuer; } - if (doneModules < 50 || doneModules % 100 === 0) updateThrottled(); - }; - - const entryDone = (entry, options) => { - doneEntries++; - update(); + return result; }; - - const cache = compiler - .getCache("ProgressPlugin") - .getItemCache("counts", null); - - let cacheGetPromise; - - compiler.hooks.beforeCompile.tap("ProgressPlugin", () => { - if (!cacheGetPromise) { - cacheGetPromise = cache.getPromise().then( - data => { - if (data) { - lastModulesCount = lastModulesCount || data.modulesCount; - lastDependenciesCount = - lastDependenciesCount || data.dependenciesCount; + processAsyncTree( + Array.from(deps, dep => ({ + type: RBDT_RESOLVE_CJS, + context, + path: dep, + expected: undefined, + issuer: undefined + })), + 20, + (job, push, callback) => { + const { type, context, path, expected } = job; + const resolveDirectory = path => { + const key = `d\n${context}\n${path}`; + if (resolveResults.has(key)) { + return callback(); + } + resolveResults.set(key, undefined); + resolveContext(context, path, resolverContext, (err, _, result) => { + if (err) { + if (expected === false) { + resolveResults.set(key, false); + return callback(); + } + invalidResolveResults.add(key); + err.message += `\nwhile resolving '${path}' in ${context} to a directory`; + return callback(err); } - return data; - }, - err => { - // Ignore error + const resultPath = result.path; + resolveResults.set(key, resultPath); + push({ + type: RBDT_DIRECTORY, + context: undefined, + path: resultPath, + expected: undefined, + issuer: job + }); + callback(); + }); + }; + const resolveFile = (path, symbol, resolve) => { + const key = `${symbol}\n${context}\n${path}`; + if (resolveResults.has(key)) { + return callback(); } - ); - } - }); - - compiler.hooks.afterCompile.tapPromise("ProgressPlugin", compilation => { - if (compilation.compiler.isChild()) return Promise.resolve(); - return cacheGetPromise.then(async oldData => { - if ( - !oldData || - oldData.modulesCount !== modulesCount || - oldData.dependenciesCount !== dependenciesCount - ) { - await cache.storePromise({ modulesCount, dependenciesCount }); - } - }); - }); - - compiler.hooks.compilation.tap("ProgressPlugin", compilation => { - if (compilation.compiler.isChild()) return; - lastModulesCount = modulesCount; - lastEntriesCount = entriesCount; - lastDependenciesCount = dependenciesCount; - modulesCount = dependenciesCount = entriesCount = 0; - doneModules = doneDependencies = doneEntries = 0; - - compilation.factorizeQueue.hooks.added.tap( - "ProgressPlugin", - factorizeAdd - ); - compilation.factorizeQueue.hooks.result.tap( - "ProgressPlugin", - factorizeDone - ); - - compilation.addModuleQueue.hooks.added.tap("ProgressPlugin", moduleAdd); - compilation.processDependenciesQueue.hooks.result.tap( - "ProgressPlugin", - moduleDone - ); - - if (showActiveModules) { - compilation.hooks.buildModule.tap("ProgressPlugin", moduleBuild); - } - - compilation.hooks.addEntry.tap("ProgressPlugin", entryAdd); - compilation.hooks.failedEntry.tap("ProgressPlugin", entryDone); - compilation.hooks.succeedEntry.tap("ProgressPlugin", entryDone); - - // avoid dynamic require if bundled with webpack - // @ts-expect-error - if (false) {} - - const hooks = { - finishModules: "finish module graph", - seal: "plugins", - optimizeDependencies: "dependencies optimization", - afterOptimizeDependencies: "after dependencies optimization", - beforeChunks: "chunk graph", - afterChunks: "after chunk graph", - optimize: "optimizing", - optimizeModules: "module optimization", - afterOptimizeModules: "after module optimization", - optimizeChunks: "chunk optimization", - afterOptimizeChunks: "after chunk optimization", - optimizeTree: "module and chunk tree optimization", - afterOptimizeTree: "after module and chunk tree optimization", - optimizeChunkModules: "chunk modules optimization", - afterOptimizeChunkModules: "after chunk modules optimization", - reviveModules: "module reviving", - beforeModuleIds: "before module ids", - moduleIds: "module ids", - optimizeModuleIds: "module id optimization", - afterOptimizeModuleIds: "module id optimization", - reviveChunks: "chunk reviving", - beforeChunkIds: "before chunk ids", - chunkIds: "chunk ids", - optimizeChunkIds: "chunk id optimization", - afterOptimizeChunkIds: "after chunk id optimization", - recordModules: "record modules", - recordChunks: "record chunks", - beforeModuleHash: "module hashing", - beforeCodeGeneration: "code generation", - beforeRuntimeRequirements: "runtime requirements", - beforeHash: "hashing", - afterHash: "after hashing", - recordHash: "record hash", - beforeModuleAssets: "module assets processing", - beforeChunkAssets: "chunk assets processing", - processAssets: "asset processing", - afterProcessAssets: "after asset optimization", - record: "recording", - afterSeal: "after seal" - }; - const numberOfHooks = Object.keys(hooks).length; - Object.keys(hooks).forEach((name, idx) => { - const title = hooks[name]; - const percentage = (idx / numberOfHooks) * 0.25 + 0.7; - compilation.hooks[name].intercept({ - name: "ProgressPlugin", - call() { - handler(percentage, "sealing", title); - }, - done() { - progressReporters.set(compiler, undefined); - handler(percentage, "sealing", title); - }, - result() { - handler(percentage, "sealing", title); - }, - error() { - handler(percentage, "sealing", title); - }, - tap(tap) { - // p is percentage from 0 to 1 - // args is any number of messages in a hierarchical matter - progressReporters.set(compilation.compiler, (p, ...args) => { - handler(percentage, "sealing", title, tap.name, ...args); + resolveResults.set(key, undefined); + resolve(context, path, resolverContext, (err, _, result) => { + if (typeof expected === "string") { + if (!err && result && result.path === expected) { + resolveResults.set(key, result.path); + } else { + invalidResolveResults.add(key); + this.logger.warn( + `Resolving '${path}' in ${context} for build dependencies doesn't lead to expected result '${expected}', but to '${ + err || (result && result.path) + }' instead. Resolving dependencies are ignored for this path.\n${pathToString( + job + )}` + ); + } + } else { + if (err) { + if (expected === false) { + resolveResults.set(key, false); + return callback(); + } + invalidResolveResults.add(key); + err.message += `\nwhile resolving '${path}' in ${context} as file\n${pathToString( + job + )}`; + return callback(err); + } + const resultPath = result.path; + resolveResults.set(key, resultPath); + push({ + type: RBDT_FILE, + context: undefined, + path: resultPath, + expected: undefined, + issuer: job + }); + } + callback(); + }); + }; + switch (type) { + case RBDT_RESOLVE_CJS: { + const isDirectory = /[\\/]$/.test(path); + if (isDirectory) { + resolveDirectory(path.slice(0, path.length - 1)); + } else { + resolveFile(path, "f", resolveCjs); + } + break; + } + case RBDT_RESOLVE_ESM: { + const isDirectory = /[\\/]$/.test(path); + if (isDirectory) { + resolveDirectory(path.slice(0, path.length - 1)); + } else { + resolveFile(path); + } + break; + } + case RBDT_RESOLVE_DIRECTORY: { + resolveDirectory(path); + break; + } + case RBDT_RESOLVE_CJS_FILE: { + resolveFile(path, "f", resolveCjs); + break; + } + case RBDT_RESOLVE_CJS_FILE_AS_CHILD: { + resolveFile(path, "c", resolveCjsAsChild); + break; + } + case RBDT_RESOLVE_ESM_FILE: { + resolveFile(path, "e", resolveEsm); + break; + } + case RBDT_FILE: { + if (files.has(path)) { + callback(); + break; + } + files.add(path); + this.fs.realpath(path, (err, _realPath) => { + if (err) return callback(err); + const realPath = /** @type {string} */ (_realPath); + if (realPath !== path) { + fileSymlinks.add(path); + resolveFiles.add(path); + if (files.has(realPath)) return callback(); + files.add(realPath); + } + push({ + type: RBDT_FILE_DEPENDENCIES, + context: undefined, + path: realPath, + expected: undefined, + issuer: job + }); + callback(); }); - handler(percentage, "sealing", title, tap.name); + break; + } + case RBDT_DIRECTORY: { + if (directories.has(path)) { + callback(); + break; + } + directories.add(path); + this.fs.realpath(path, (err, _realPath) => { + if (err) return callback(err); + const realPath = /** @type {string} */ (_realPath); + if (realPath !== path) { + directorySymlinks.add(path); + resolveFiles.add(path); + if (directories.has(realPath)) return callback(); + directories.add(realPath); + } + push({ + type: RBDT_DIRECTORY_DEPENDENCIES, + context: undefined, + path: realPath, + expected: undefined, + issuer: job + }); + callback(); + }); + break; + } + case RBDT_FILE_DEPENDENCIES: { + // Check for known files without dependencies + if (/\.json5?$|\.yarn-integrity$|yarn\.lock$|\.ya?ml/.test(path)) { + process.nextTick(callback); + break; + } + // Check commonjs cache for the module + /** @type {NodeModule} */ + const module = require.cache[path]; + if (module && Array.isArray(module.children)) { + children: for (const child of module.children) { + let childPath = child.filename; + if (childPath) { + push({ + type: RBDT_FILE, + context: undefined, + path: childPath, + expected: undefined, + issuer: job + }); + const context = dirname(this.fs, path); + for (const modulePath of module.paths) { + if (childPath.startsWith(modulePath)) { + let subPath = childPath.slice(modulePath.length + 1); + const packageMatch = /^(@[^\\/]+[\\/])[^\\/]+/.exec( + subPath + ); + if (packageMatch) { + push({ + type: RBDT_FILE, + context: undefined, + path: + modulePath + + childPath[modulePath.length] + + packageMatch[0] + + childPath[modulePath.length] + + "package.json", + expected: false, + issuer: job + }); + } + let request = subPath.replace(/\\/g, "/"); + if (request.endsWith(".js")) + request = request.slice(0, -3); + push({ + type: RBDT_RESOLVE_CJS_FILE_AS_CHILD, + context, + path: request, + expected: child.filename, + issuer: job + }); + continue children; + } + } + let request = relative(this.fs, context, childPath); + if (request.endsWith(".js")) request = request.slice(0, -3); + request = request.replace(/\\/g, "/"); + if (!request.startsWith("../")) request = `./${request}`; + push({ + type: RBDT_RESOLVE_CJS_FILE, + context, + path: request, + expected: child.filename, + issuer: job + }); + } + } + } else if (supportsEsm && /\.m?js$/.test(path)) { + if (!this._warnAboutExperimentalEsmTracking) { + this.logger.log( + "Node.js doesn't offer a (nice) way to introspect the ESM dependency graph yet.\n" + + "Until a full solution is available webpack uses an experimental ESM tracking based on parsing.\n" + + "As best effort webpack parses the ESM files to guess dependencies. But this can lead to expensive and incorrect tracking." + ); + this._warnAboutExperimentalEsmTracking = true; + } + const lexer = __webpack_require__(54392); + lexer.init.then(() => { + this.fs.readFile(path, (err, content) => { + if (err) return callback(err); + try { + const context = dirname(this.fs, path); + const source = content.toString(); + const [imports] = lexer.parse(source); + for (const imp of imports) { + try { + let dependency; + if (imp.d === -1) { + // import ... from "..." + dependency = parseString( + source.substring(imp.s - 1, imp.e + 1) + ); + } else if (imp.d > -1) { + // import() + let expr = source.substring(imp.s, imp.e).trim(); + dependency = parseString(expr); + } else { + // e.g. import.meta + continue; + } + push({ + type: RBDT_RESOLVE_ESM_FILE, + context, + path: dependency, + expected: undefined, + issuer: job + }); + } catch (e) { + this.logger.warn( + `Parsing of ${path} for build dependencies failed at 'import(${source.substring( + imp.s, + imp.e + )})'.\n` + + "Build dependencies behind this expression are ignored and might cause incorrect cache invalidation." + ); + this.logger.debug(pathToString(job)); + this.logger.debug(e.stack); + } + } + } catch (e) { + this.logger.warn( + `Parsing of ${path} for build dependencies failed and all dependencies of this file are ignored, which might cause incorrect cache invalidation..` + ); + this.logger.debug(pathToString(job)); + this.logger.debug(e.stack); + } + process.nextTick(callback); + }); + }, callback); + break; + } else { + this.logger.log( + `Assuming ${path} has no dependencies as we were unable to assign it to any module system.` + ); + this.logger.debug(pathToString(job)); + } + process.nextTick(callback); + break; + } + case RBDT_DIRECTORY_DEPENDENCIES: { + const match = + /(^.+[\\/]node_modules[\\/](?:@[^\\/]+[\\/])?[^\\/]+)/.exec(path); + const packagePath = match ? match[1] : path; + const packageJson = join(this.fs, packagePath, "package.json"); + this.fs.readFile(packageJson, (err, content) => { + if (err) { + if (err.code === "ENOENT") { + resolveMissing.add(packageJson); + const parent = dirname(this.fs, packagePath); + if (parent !== packagePath) { + push({ + type: RBDT_DIRECTORY_DEPENDENCIES, + context: undefined, + path: parent, + expected: undefined, + issuer: job + }); + } + callback(); + return; + } + return callback(err); + } + resolveFiles.add(packageJson); + let packageData; + try { + packageData = JSON.parse(content.toString("utf-8")); + } catch (e) { + return callback(e); + } + const depsObject = packageData.dependencies; + const optionalDepsObject = packageData.optionalDependencies; + const allDeps = new Set(); + const optionalDeps = new Set(); + if (typeof depsObject === "object" && depsObject) { + for (const dep of Object.keys(depsObject)) { + allDeps.add(dep); + } + } + if ( + typeof optionalDepsObject === "object" && + optionalDepsObject + ) { + for (const dep of Object.keys(optionalDepsObject)) { + allDeps.add(dep); + optionalDeps.add(dep); + } + } + for (const dep of allDeps) { + push({ + type: RBDT_RESOLVE_DIRECTORY, + context: packagePath, + path: dep, + expected: !optionalDeps.has(dep), + issuer: job + }); + } + callback(); + }); + break; } - }); - }); - }); - compiler.hooks.make.intercept({ - name: "ProgressPlugin", - call() { - handler(0.1, "building"); - }, - done() { - handler(0.65, "building"); - } - }); - const interceptHook = (hook, progress, category, name) => { - hook.intercept({ - name: "ProgressPlugin", - call() { - handler(progress, category, name); - }, - done() { - progressReporters.set(compiler, undefined); - handler(progress, category, name); - }, - result() { - handler(progress, category, name); - }, - error() { - handler(progress, category, name); - }, - tap(tap) { - progressReporters.set(compiler, (p, ...args) => { - handler(progress, category, name, tap.name, ...args); - }); - handler(progress, category, name, tap.name); } - }); - }; - compiler.cache.hooks.endIdle.intercept({ - name: "ProgressPlugin", - call() { - handler(0, ""); - } - }); - interceptHook(compiler.cache.hooks.endIdle, 0.01, "cache", "end idle"); - compiler.hooks.initialize.intercept({ - name: "ProgressPlugin", - call() { - handler(0, ""); - } - }); - interceptHook(compiler.hooks.initialize, 0.01, "setup", "initialize"); - interceptHook(compiler.hooks.beforeRun, 0.02, "setup", "before run"); - interceptHook(compiler.hooks.run, 0.03, "setup", "run"); - interceptHook(compiler.hooks.watchRun, 0.03, "setup", "watch run"); - interceptHook( - compiler.hooks.normalModuleFactory, - 0.04, - "setup", - "normal module factory" - ); - interceptHook( - compiler.hooks.contextModuleFactory, - 0.05, - "setup", - "context module factory" - ); - interceptHook( - compiler.hooks.beforeCompile, - 0.06, - "setup", - "before compile" - ); - interceptHook(compiler.hooks.compile, 0.07, "setup", "compile"); - interceptHook(compiler.hooks.thisCompilation, 0.08, "setup", "compilation"); - interceptHook(compiler.hooks.compilation, 0.09, "setup", "compilation"); - interceptHook(compiler.hooks.finishMake, 0.69, "building", "finish"); - interceptHook(compiler.hooks.emit, 0.95, "emitting", "emit"); - interceptHook(compiler.hooks.afterEmit, 0.98, "emitting", "after emit"); - interceptHook(compiler.hooks.done, 0.99, "done", "plugins"); - compiler.hooks.done.intercept({ - name: "ProgressPlugin", - done() { - handler(0.99, ""); + }, + err => { + if (err) return callback(err); + for (const l of fileSymlinks) files.delete(l); + for (const l of directorySymlinks) directories.delete(l); + for (const k of invalidResolveResults) resolveResults.delete(k); + callback(null, { + files, + directories, + missing, + resolveResults, + resolveDependencies: { + files: resolveFiles, + directories: resolveDirectories, + missing: resolveMissing + } + }); } - }); - interceptHook( - compiler.cache.hooks.storeBuildDependencies, - 0.99, - "cache", - "store build dependencies" ); - interceptHook(compiler.cache.hooks.shutdown, 0.99, "cache", "shutdown"); - interceptHook(compiler.cache.hooks.beginIdle, 0.99, "cache", "begin idle"); - interceptHook( - compiler.hooks.watchClose, - 0.99, - "end", - "closing watch compilation" - ); - compiler.cache.hooks.beginIdle.intercept({ - name: "ProgressPlugin", - done() { - handler(1, ""); - } - }); - compiler.cache.hooks.shutdown.intercept({ - name: "ProgressPlugin", - done() { - handler(1, ""); - } - }); } -} - -ProgressPlugin.defaultOptions = { - profile: false, - modulesCount: 5000, - dependenciesCount: 10000, - modules: true, - dependencies: true, - activeModules: false, - entries: true -}; - -module.exports = ProgressPlugin; - - -/***/ }), - -/***/ 38309: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const ConstDependency = __webpack_require__(76911); -const ProvidedDependency = __webpack_require__(95770); -const { approve } = __webpack_require__(93998); - -/** @typedef {import("./Compiler")} Compiler */ - -class ProvidePlugin { /** - * @param {Record} definitions the provided identifiers + * @param {Map} resolveResults results from resolving + * @param {function((Error | null)=, boolean=): void} callback callback with true when resolveResults resolve the same way + * @returns {void} */ - constructor(definitions) { - this.definitions = definitions; + checkResolveResultsValid(resolveResults, callback) { + const { resolveCjs, resolveCjsAsChild, resolveEsm, resolveContext } = + this._createBuildDependenciesResolvers(); + asyncLib.eachLimit( + resolveResults, + 20, + ([key, expectedResult], callback) => { + const [type, context, path] = key.split("\n"); + switch (type) { + case "d": + resolveContext(context, path, {}, (err, _, result) => { + if (expectedResult === false) + return callback(err ? undefined : INVALID); + if (err) return callback(err); + const resultPath = result.path; + if (resultPath !== expectedResult) return callback(INVALID); + callback(); + }); + break; + case "f": + resolveCjs(context, path, {}, (err, _, result) => { + if (expectedResult === false) + return callback(err ? undefined : INVALID); + if (err) return callback(err); + const resultPath = result.path; + if (resultPath !== expectedResult) return callback(INVALID); + callback(); + }); + break; + case "c": + resolveCjsAsChild(context, path, {}, (err, _, result) => { + if (expectedResult === false) + return callback(err ? undefined : INVALID); + if (err) return callback(err); + const resultPath = result.path; + if (resultPath !== expectedResult) return callback(INVALID); + callback(); + }); + break; + case "e": + resolveEsm(context, path, {}, (err, _, result) => { + if (expectedResult === false) + return callback(err ? undefined : INVALID); + if (err) return callback(err); + const resultPath = result.path; + if (resultPath !== expectedResult) return callback(INVALID); + callback(); + }); + break; + default: + callback(new Error("Unexpected type in resolve result key")); + break; + } + }, + /** + * @param {Error | typeof INVALID=} err error or invalid flag + * @returns {void} + */ + err => { + if (err === INVALID) { + return callback(null, false); + } + if (err) { + return callback(err); + } + return callback(null, true); + } + ); } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * + * @param {number} startTime when processing the files has started + * @param {Iterable} files all files + * @param {Iterable} directories all directories + * @param {Iterable} missing all missing files or directories + * @param {Object} options options object (for future extensions) + * @param {boolean=} options.hash should use hash to snapshot + * @param {boolean=} options.timestamp should use timestamp to snapshot + * @param {function((WebpackError | null)=, (Snapshot | null)=): void} callback callback function * @returns {void} */ - apply(compiler) { - const definitions = this.definitions; - compiler.hooks.compilation.tap( - "ProvidePlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyTemplates.set( - ConstDependency, - new ConstDependency.Template() - ); - compilation.dependencyFactories.set( - ProvidedDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - ProvidedDependency, - new ProvidedDependency.Template() - ); - const handler = (parser, parserOptions) => { - Object.keys(definitions).forEach(name => { - const request = [].concat(definitions[name]); - const splittedName = name.split("."); - if (splittedName.length > 0) { - splittedName.slice(1).forEach((_, i) => { - const name = splittedName.slice(0, i + 1).join("."); - parser.hooks.canRename.for(name).tap("ProvidePlugin", approve); + createSnapshot(startTime, files, directories, missing, options, callback) { + /** @type {Map} */ + const fileTimestamps = new Map(); + /** @type {Map} */ + const fileHashes = new Map(); + /** @type {Map} */ + const fileTshs = new Map(); + /** @type {Map} */ + const contextTimestamps = new Map(); + /** @type {Map} */ + const contextHashes = new Map(); + /** @type {Map} */ + const contextTshs = new Map(); + /** @type {Map} */ + const missingExistence = new Map(); + /** @type {Map} */ + const managedItemInfo = new Map(); + /** @type {Set} */ + const managedFiles = new Set(); + /** @type {Set} */ + const managedContexts = new Set(); + /** @type {Set} */ + const managedMissing = new Set(); + /** @type {Set} */ + const children = new Set(); + + const snapshot = new Snapshot(); + if (startTime) snapshot.setStartTime(startTime); + + /** @type {Set} */ + const managedItems = new Set(); + + /** 1 = timestamp, 2 = hash, 3 = timestamp + hash */ + const mode = options && options.hash ? (options.timestamp ? 3 : 2) : 1; + + let jobs = 1; + const jobDone = () => { + if (--jobs === 0) { + if (fileTimestamps.size !== 0) { + snapshot.setFileTimestamps(fileTimestamps); + } + if (fileHashes.size !== 0) { + snapshot.setFileHashes(fileHashes); + } + if (fileTshs.size !== 0) { + snapshot.setFileTshs(fileTshs); + } + if (contextTimestamps.size !== 0) { + snapshot.setContextTimestamps(contextTimestamps); + } + if (contextHashes.size !== 0) { + snapshot.setContextHashes(contextHashes); + } + if (contextTshs.size !== 0) { + snapshot.setContextTshs(contextTshs); + } + if (missingExistence.size !== 0) { + snapshot.setMissingExistence(missingExistence); + } + if (managedItemInfo.size !== 0) { + snapshot.setManagedItemInfo(managedItemInfo); + } + this._managedFilesOptimization.optimize(snapshot, managedFiles); + if (managedFiles.size !== 0) { + snapshot.setManagedFiles(managedFiles); + } + this._managedContextsOptimization.optimize(snapshot, managedContexts); + if (managedContexts.size !== 0) { + snapshot.setManagedContexts(managedContexts); + } + this._managedMissingOptimization.optimize(snapshot, managedMissing); + if (managedMissing.size !== 0) { + snapshot.setManagedMissing(managedMissing); + } + if (children.size !== 0) { + snapshot.setChildren(children); + } + this._snapshotCache.set(snapshot, true); + this._statCreatedSnapshots++; + + callback(null, snapshot); + } + }; + const jobError = () => { + if (jobs > 0) { + // large negative number instead of NaN or something else to keep jobs to stay a SMI (v8) + jobs = -100000000; + callback(null, null); + } + }; + const checkManaged = (path, managedSet) => { + for (const immutablePath of this.immutablePathsRegExps) { + if (immutablePath.test(path)) { + managedSet.add(path); + return true; + } + } + for (const immutablePath of this.immutablePathsWithSlash) { + if (path.startsWith(immutablePath)) { + managedSet.add(path); + return true; + } + } + for (const managedPath of this.managedPathsRegExps) { + const match = managedPath.exec(path); + if (match) { + const managedItem = getManagedItem(match[1], path); + if (managedItem) { + managedItems.add(managedItem); + managedSet.add(path); + return true; + } + } + } + for (const managedPath of this.managedPathsWithSlash) { + if (path.startsWith(managedPath)) { + const managedItem = getManagedItem(managedPath, path); + if (managedItem) { + managedItems.add(managedItem); + managedSet.add(path); + return true; + } + } + } + return false; + }; + const captureNonManaged = (items, managedSet) => { + const capturedItems = new Set(); + for (const path of items) { + if (!checkManaged(path, managedSet)) capturedItems.add(path); + } + return capturedItems; + }; + const processCapturedFiles = capturedFiles => { + switch (mode) { + case 3: + this._fileTshsOptimization.optimize(snapshot, capturedFiles); + for (const path of capturedFiles) { + const cache = this._fileTshs.get(path); + if (cache !== undefined) { + fileTshs.set(path, cache); + } else { + jobs++; + this._getFileTimestampAndHash(path, (err, entry) => { + if (err) { + if (this.logger) { + this.logger.debug( + `Error snapshotting file timestamp hash combination of ${path}: ${err.stack}` + ); + } + jobError(); + } else { + fileTshs.set(path, entry); + jobDone(); + } }); } - - parser.hooks.expression.for(name).tap("ProvidePlugin", expr => { - const nameIdentifier = name.includes(".") - ? `__webpack_provided_${name.replace(/\./g, "_dot_")}` - : name; - const dep = new ProvidedDependency( - request[0], - nameIdentifier, - request.slice(1), - expr.range - ); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - return true; - }); - - parser.hooks.call.for(name).tap("ProvidePlugin", expr => { - const nameIdentifier = name.includes(".") - ? `__webpack_provided_${name.replace(/\./g, "_dot_")}` - : name; - const dep = new ProvidedDependency( - request[0], - nameIdentifier, - request.slice(1), - expr.callee.range - ); - dep.loc = expr.callee.loc; - parser.state.module.addDependency(dep); - parser.walkExpressions(expr.arguments); - return true; - }); + } + break; + case 2: + this._fileHashesOptimization.optimize(snapshot, capturedFiles); + for (const path of capturedFiles) { + const cache = this._fileHashes.get(path); + if (cache !== undefined) { + fileHashes.set(path, cache); + } else { + jobs++; + this.fileHashQueue.add(path, (err, entry) => { + if (err) { + if (this.logger) { + this.logger.debug( + `Error snapshotting file hash of ${path}: ${err.stack}` + ); + } + jobError(); + } else { + fileHashes.set(path, entry); + jobDone(); + } + }); + } + } + break; + case 1: + this._fileTimestampsOptimization.optimize(snapshot, capturedFiles); + for (const path of capturedFiles) { + const cache = this._fileTimestamps.get(path); + if (cache !== undefined) { + if (cache !== "ignore") { + fileTimestamps.set(path, cache); + } + } else { + jobs++; + this.fileTimestampQueue.add(path, (err, entry) => { + if (err) { + if (this.logger) { + this.logger.debug( + `Error snapshotting file timestamp of ${path}: ${err.stack}` + ); + } + jobError(); + } else { + fileTimestamps.set(path, entry); + jobDone(); + } + }); + } + } + break; + } + }; + if (files) { + processCapturedFiles(captureNonManaged(files, managedFiles)); + } + const processCapturedDirectories = capturedDirectories => { + switch (mode) { + case 3: + this._contextTshsOptimization.optimize(snapshot, capturedDirectories); + for (const path of capturedDirectories) { + const cache = this._contextTshs.get(path); + /** @type {ResolvedContextTimestampAndHash} */ + let resolved; + if ( + cache !== undefined && + (resolved = getResolvedTimestamp(cache)) !== undefined + ) { + contextTshs.set(path, resolved); + } else { + jobs++; + /** + * @param {Error=} err error + * @param {ResolvedContextTimestampAndHash=} entry entry + * @returns {void} + */ + const callback = (err, entry) => { + if (err) { + if (this.logger) { + this.logger.debug( + `Error snapshotting context timestamp hash combination of ${path}: ${err.stack}` + ); + } + jobError(); + } else { + contextTshs.set(path, entry); + jobDone(); + } + }; + if (cache !== undefined) { + this._resolveContextTsh(cache, callback); + } else { + this.getContextTsh(path, callback); + } + } + } + break; + case 2: + this._contextHashesOptimization.optimize( + snapshot, + capturedDirectories + ); + for (const path of capturedDirectories) { + const cache = this._contextHashes.get(path); + let resolved; + if ( + cache !== undefined && + (resolved = getResolvedHash(cache)) !== undefined + ) { + contextHashes.set(path, resolved); + } else { + jobs++; + const callback = (err, entry) => { + if (err) { + if (this.logger) { + this.logger.debug( + `Error snapshotting context hash of ${path}: ${err.stack}` + ); + } + jobError(); + } else { + contextHashes.set(path, entry); + jobDone(); + } + }; + if (cache !== undefined) { + this._resolveContextHash(cache, callback); + } else { + this.getContextHash(path, callback); + } + } + } + break; + case 1: + this._contextTimestampsOptimization.optimize( + snapshot, + capturedDirectories + ); + for (const path of capturedDirectories) { + const cache = this._contextTimestamps.get(path); + if (cache === "ignore") continue; + let resolved; + if ( + cache !== undefined && + (resolved = getResolvedTimestamp(cache)) !== undefined + ) { + contextTimestamps.set(path, resolved); + } else { + jobs++; + /** + * @param {Error=} err error + * @param {ResolvedContextFileSystemInfoEntry=} entry entry + * @returns {void} + */ + const callback = (err, entry) => { + if (err) { + if (this.logger) { + this.logger.debug( + `Error snapshotting context timestamp of ${path}: ${err.stack}` + ); + } + jobError(); + } else { + contextTimestamps.set(path, entry); + jobDone(); + } + }; + if (cache !== undefined) { + this._resolveContextTimestamp(cache, callback); + } else { + this.getContextTimestamp(path, callback); + } + } + } + break; + } + }; + if (directories) { + processCapturedDirectories( + captureNonManaged(directories, managedContexts) + ); + } + const processCapturedMissing = capturedMissing => { + this._missingExistenceOptimization.optimize(snapshot, capturedMissing); + for (const path of capturedMissing) { + const cache = this._fileTimestamps.get(path); + if (cache !== undefined) { + if (cache !== "ignore") { + missingExistence.set(path, Boolean(cache)); + } + } else { + jobs++; + this.fileTimestampQueue.add(path, (err, entry) => { + if (err) { + if (this.logger) { + this.logger.debug( + `Error snapshotting missing timestamp of ${path}: ${err.stack}` + ); + } + jobError(); + } else { + missingExistence.set(path, Boolean(entry)); + jobDone(); + } }); - }; - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("ProvidePlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("ProvidePlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("ProvidePlugin", handler); + } } - ); - } -} - -module.exports = ProvidePlugin; - - -/***/ }), - -/***/ 84929: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { OriginalSource, RawSource } = __webpack_require__(51255); -const Module = __webpack_require__(73208); -const makeSerializable = __webpack_require__(33032); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./WebpackError")} WebpackError */ -/** @typedef {import("./util/Hash")} Hash */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ - -const TYPES = new Set(["javascript"]); - -class RawModule extends Module { - /** - * @param {string} source source code - * @param {string} identifier unique identifier - * @param {string=} readableIdentifier readable identifier - * @param {ReadonlySet=} runtimeRequirements runtime requirements needed for the source code - */ - constructor(source, identifier, readableIdentifier, runtimeRequirements) { - super("javascript/dynamic", null); - this.sourceStr = source; - this.identifierStr = identifier || this.sourceStr; - this.readableIdentifierStr = readableIdentifier || this.identifierStr; - this.runtimeRequirements = runtimeRequirements || null; - } - - /** - * @returns {Set} types available (do not mutate) - */ - getSourceTypes() { - return TYPES; - } - - /** - * @returns {string} a unique identifier of the module - */ - identifier() { - return this.identifierStr; - } - - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - return Math.max(1, this.sourceStr.length); - } - - /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module - */ - readableIdentifier(requestShortener) { - return requestShortener.shorten(this.readableIdentifierStr); - } - - /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} - */ - needBuild(context, callback) { - return callback(null, !this.buildMeta); - } - - /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} - */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = {}; - this.buildInfo = { - cacheable: true }; - callback(); + if (missing) { + processCapturedMissing(captureNonManaged(missing, managedMissing)); + } + this._managedItemInfoOptimization.optimize(snapshot, managedItems); + for (const path of managedItems) { + const cache = this._managedItems.get(path); + if (cache !== undefined) { + if (!cache.startsWith("*")) { + managedFiles.add(join(this.fs, path, "package.json")); + } else if (cache === "*nested") { + managedMissing.add(join(this.fs, path, "package.json")); + } + managedItemInfo.set(path, cache); + } else { + jobs++; + this.managedItemQueue.add(path, (err, entry) => { + if (err) { + if (this.logger) { + this.logger.debug( + `Error snapshotting managed item ${path}: ${err.stack}` + ); + } + jobError(); + } else if (entry) { + if (!entry.startsWith("*")) { + managedFiles.add(join(this.fs, path, "package.json")); + } else if (cache === "*nested") { + managedMissing.add(join(this.fs, path, "package.json")); + } + managedItemInfo.set(path, entry); + jobDone(); + } else { + // Fallback to normal snapshotting + const process = (set, fn) => { + if (set.size === 0) return; + const captured = new Set(); + for (const file of set) { + if (file.startsWith(path)) captured.add(file); + } + if (captured.size > 0) fn(captured); + }; + process(managedFiles, processCapturedFiles); + process(managedContexts, processCapturedDirectories); + process(managedMissing, processCapturedMissing); + jobDone(); + } + }); + } + } + jobDone(); } /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result + * @param {Snapshot} snapshot1 a snapshot + * @param {Snapshot} snapshot2 a snapshot + * @returns {Snapshot} merged snapshot */ - codeGeneration(context) { - const sources = new Map(); - if (this.useSourceMap || this.useSimpleSourceMap) { - sources.set( - "javascript", - new OriginalSource(this.sourceStr, this.identifier()) + mergeSnapshots(snapshot1, snapshot2) { + const snapshot = new Snapshot(); + if (snapshot1.hasStartTime() && snapshot2.hasStartTime()) + snapshot.setStartTime(Math.min(snapshot1.startTime, snapshot2.startTime)); + else if (snapshot2.hasStartTime()) snapshot.startTime = snapshot2.startTime; + else if (snapshot1.hasStartTime()) snapshot.startTime = snapshot1.startTime; + if (snapshot1.hasFileTimestamps() || snapshot2.hasFileTimestamps()) { + snapshot.setFileTimestamps( + mergeMaps(snapshot1.fileTimestamps, snapshot2.fileTimestamps) ); - } else { - sources.set("javascript", new RawSource(this.sourceStr)); } - return { sources, runtimeRequirements: this.runtimeRequirements }; + if (snapshot1.hasFileHashes() || snapshot2.hasFileHashes()) { + snapshot.setFileHashes( + mergeMaps(snapshot1.fileHashes, snapshot2.fileHashes) + ); + } + if (snapshot1.hasFileTshs() || snapshot2.hasFileTshs()) { + snapshot.setFileTshs(mergeMaps(snapshot1.fileTshs, snapshot2.fileTshs)); + } + if (snapshot1.hasContextTimestamps() || snapshot2.hasContextTimestamps()) { + snapshot.setContextTimestamps( + mergeMaps(snapshot1.contextTimestamps, snapshot2.contextTimestamps) + ); + } + if (snapshot1.hasContextHashes() || snapshot2.hasContextHashes()) { + snapshot.setContextHashes( + mergeMaps(snapshot1.contextHashes, snapshot2.contextHashes) + ); + } + if (snapshot1.hasContextTshs() || snapshot2.hasContextTshs()) { + snapshot.setContextTshs( + mergeMaps(snapshot1.contextTshs, snapshot2.contextTshs) + ); + } + if (snapshot1.hasMissingExistence() || snapshot2.hasMissingExistence()) { + snapshot.setMissingExistence( + mergeMaps(snapshot1.missingExistence, snapshot2.missingExistence) + ); + } + if (snapshot1.hasManagedItemInfo() || snapshot2.hasManagedItemInfo()) { + snapshot.setManagedItemInfo( + mergeMaps(snapshot1.managedItemInfo, snapshot2.managedItemInfo) + ); + } + if (snapshot1.hasManagedFiles() || snapshot2.hasManagedFiles()) { + snapshot.setManagedFiles( + mergeSets(snapshot1.managedFiles, snapshot2.managedFiles) + ); + } + if (snapshot1.hasManagedContexts() || snapshot2.hasManagedContexts()) { + snapshot.setManagedContexts( + mergeSets(snapshot1.managedContexts, snapshot2.managedContexts) + ); + } + if (snapshot1.hasManagedMissing() || snapshot2.hasManagedMissing()) { + snapshot.setManagedMissing( + mergeSets(snapshot1.managedMissing, snapshot2.managedMissing) + ); + } + if (snapshot1.hasChildren() || snapshot2.hasChildren()) { + snapshot.setChildren(mergeSets(snapshot1.children, snapshot2.children)); + } + if ( + this._snapshotCache.get(snapshot1) === true && + this._snapshotCache.get(snapshot2) === true + ) { + this._snapshotCache.set(snapshot, true); + } + return snapshot; } /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context + * @param {Snapshot} snapshot the snapshot made + * @param {function((WebpackError | null)=, boolean=): void} callback callback function * @returns {void} */ - updateHash(hash, context) { - hash.update(this.sourceStr); - super.updateHash(hash, context); - } - - serialize(context) { - const { write } = context; - - write(this.sourceStr); - write(this.identifierStr); - write(this.readableIdentifierStr); - write(this.runtimeRequirements); - - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - - this.sourceStr = read(); - this.identifierStr = read(); - this.readableIdentifierStr = read(); - this.runtimeRequirements = read(); - - super.deserialize(context); - } -} - -makeSerializable(RawModule, "webpack/lib/RawModule"); - -module.exports = RawModule; - - -/***/ }), - -/***/ 11094: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { compareNumbers } = __webpack_require__(29579); -const identifierUtils = __webpack_require__(82186); - -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Module")} Module */ - -/** - * @typedef {Object} RecordsChunks - * @property {Record=} byName - * @property {Record=} bySource - * @property {number[]=} usedIds - */ - -/** - * @typedef {Object} RecordsModules - * @property {Record=} byIdentifier - * @property {Record=} bySource - * @property {number[]=} usedIds - */ - -/** - * @typedef {Object} Records - * @property {RecordsChunks=} chunks - * @property {RecordsModules=} modules - */ - -class RecordIdsPlugin { - /** - * @param {Object} options Options object - * @param {boolean=} options.portableIds true, when ids need to be portable - */ - constructor(options) { - this.options = options || {}; + checkSnapshotValid(snapshot, callback) { + const cachedResult = this._snapshotCache.get(snapshot); + if (cachedResult !== undefined) { + this._statTestedSnapshotsCached++; + if (typeof cachedResult === "boolean") { + callback(null, cachedResult); + } else { + cachedResult.push(callback); + } + return; + } + this._statTestedSnapshotsNotCached++; + this._checkSnapshotValidNoCache(snapshot, callback); } /** - * @param {Compiler} compiler the Compiler + * @param {Snapshot} snapshot the snapshot made + * @param {function((WebpackError | null)=, boolean=): void} callback callback function * @returns {void} */ - apply(compiler) { - const portableIds = this.options.portableIds; - - const makePathsRelative = - identifierUtils.makePathsRelative.bindContextCache( - compiler.context, - compiler.root - ); - + _checkSnapshotValidNoCache(snapshot, callback) { + /** @type {number | undefined} */ + let startTime = undefined; + if (snapshot.hasStartTime()) { + startTime = snapshot.startTime; + } + let jobs = 1; + const jobDone = () => { + if (--jobs === 0) { + this._snapshotCache.set(snapshot, true); + callback(null, true); + } + }; + const invalid = () => { + if (jobs > 0) { + // large negative number instead of NaN or something else to keep jobs to stay a SMI (v8) + jobs = -100000000; + this._snapshotCache.set(snapshot, false); + callback(null, false); + } + }; + const invalidWithError = (path, err) => { + if (this._remainingLogs > 0) { + this._log(path, `error occurred: %s`, err); + } + invalid(); + }; /** - * @param {Module} module the module - * @returns {string} the (portable) identifier + * @param {string} path file path + * @param {string} current current hash + * @param {string} snap snapshot hash + * @returns {boolean} true, if ok */ - const getModuleIdentifier = module => { - if (portableIds) { - return makePathsRelative(module.identifier()); + const checkHash = (path, current, snap) => { + if (current !== snap) { + // If hash differ it's invalid + if (this._remainingLogs > 0) { + this._log(path, `hashes differ (%s != %s)`, current, snap); + } + return false; + } + return true; + }; + /** + * @param {string} path file path + * @param {boolean} current current entry + * @param {boolean} snap entry from snapshot + * @returns {boolean} true, if ok + */ + const checkExistence = (path, current, snap) => { + if (!current !== !snap) { + // If existence of item differs + // it's invalid + if (this._remainingLogs > 0) { + this._log( + path, + current ? "it didn't exist before" : "it does no longer exist" + ); + } + return false; } - return module.identifier(); + return true; }; - - compiler.hooks.compilation.tap("RecordIdsPlugin", compilation => { - compilation.hooks.recordModules.tap( - "RecordIdsPlugin", - /** - * @param {Module[]} modules the modules array - * @param {Records} records the records object - * @returns {void} - */ - (modules, records) => { - const chunkGraph = compilation.chunkGraph; - if (!records.modules) records.modules = {}; - if (!records.modules.byIdentifier) records.modules.byIdentifier = {}; - /** @type {Set} */ - const usedIds = new Set(); - for (const module of modules) { - const moduleId = chunkGraph.getModuleId(module); - if (typeof moduleId !== "number") continue; - const identifier = getModuleIdentifier(module); - records.modules.byIdentifier[identifier] = moduleId; - usedIds.add(moduleId); + /** + * @param {string} path file path + * @param {FileSystemInfoEntry} current current entry + * @param {FileSystemInfoEntry} snap entry from snapshot + * @param {boolean} log log reason + * @returns {boolean} true, if ok + */ + const checkFile = (path, current, snap, log = true) => { + if (current === snap) return true; + if (!checkExistence(path, Boolean(current), Boolean(snap))) return false; + if (current) { + // For existing items only + if (typeof startTime === "number" && current.safeTime > startTime) { + // If a change happened after starting reading the item + // this may no longer be valid + if (log && this._remainingLogs > 0) { + this._log( + path, + `it may have changed (%d) after the start time of the snapshot (%d)`, + current.safeTime, + startTime + ); } - records.modules.usedIds = Array.from(usedIds).sort(compareNumbers); + return false; } - ); - compilation.hooks.reviveModules.tap( - "RecordIdsPlugin", - /** - * @param {Module[]} modules the modules array - * @param {Records} records the records object - * @returns {void} - */ - (modules, records) => { - if (!records.modules) return; - if (records.modules.byIdentifier) { - const chunkGraph = compilation.chunkGraph; - /** @type {Set} */ - const usedIds = new Set(); - for (const module of modules) { - const moduleId = chunkGraph.getModuleId(module); - if (moduleId !== null) continue; - const identifier = getModuleIdentifier(module); - const id = records.modules.byIdentifier[identifier]; - if (id === undefined) continue; - if (usedIds.has(id)) continue; - usedIds.add(id); - chunkGraph.setModuleId(module, id); - } + if ( + snap.timestamp !== undefined && + current.timestamp !== snap.timestamp + ) { + // If we have a timestamp (it was a file or symlink) and it differs from current timestamp + // it's invalid + if (log && this._remainingLogs > 0) { + this._log( + path, + `timestamps differ (%d != %d)`, + current.timestamp, + snap.timestamp + ); } - if (Array.isArray(records.modules.usedIds)) { - compilation.usedModuleIds = new Set(records.modules.usedIds); + return false; + } + } + return true; + }; + /** + * @param {string} path file path + * @param {ResolvedContextFileSystemInfoEntry} current current entry + * @param {ResolvedContextFileSystemInfoEntry} snap entry from snapshot + * @param {boolean} log log reason + * @returns {boolean} true, if ok + */ + const checkContext = (path, current, snap, log = true) => { + if (current === snap) return true; + if (!checkExistence(path, Boolean(current), Boolean(snap))) return false; + if (current) { + // For existing items only + if (typeof startTime === "number" && current.safeTime > startTime) { + // If a change happened after starting reading the item + // this may no longer be valid + if (log && this._remainingLogs > 0) { + this._log( + path, + `it may have changed (%d) after the start time of the snapshot (%d)`, + current.safeTime, + startTime + ); } + return false; } - ); - - /** - * @param {Chunk} chunk the chunk - * @returns {string[]} sources of the chunk - */ - const getChunkSources = chunk => { - /** @type {string[]} */ - const sources = []; - for (const chunkGroup of chunk.groupsIterable) { - const index = chunkGroup.chunks.indexOf(chunk); - if (chunkGroup.name) { - sources.push(`${index} ${chunkGroup.name}`); - } else { - for (const origin of chunkGroup.origins) { - if (origin.module) { - if (origin.request) { - sources.push( - `${index} ${getModuleIdentifier(origin.module)} ${ - origin.request - }` - ); - } else if (typeof origin.loc === "string") { - sources.push( - `${index} ${getModuleIdentifier(origin.module)} ${ - origin.loc - }` - ); - } else if ( - origin.loc && - typeof origin.loc === "object" && - "start" in origin.loc - ) { - sources.push( - `${index} ${getModuleIdentifier( - origin.module - )} ${JSON.stringify(origin.loc.start)}` - ); - } - } - } + if ( + snap.timestampHash !== undefined && + current.timestampHash !== snap.timestampHash + ) { + // If we have a timestampHash (it was a directory) and it differs from current timestampHash + // it's invalid + if (log && this._remainingLogs > 0) { + this._log( + path, + `timestamps hashes differ (%s != %s)`, + current.timestampHash, + snap.timestampHash + ); } + return false; } - return sources; + } + return true; + }; + if (snapshot.hasChildren()) { + const childCallback = (err, result) => { + if (err || !result) return invalid(); + else jobDone(); }; - - compilation.hooks.recordChunks.tap( - "RecordIdsPlugin", - /** - * @param {Chunk[]} chunks the chunks array - * @param {Records} records the records object - * @returns {void} - */ - (chunks, records) => { - if (!records.chunks) records.chunks = {}; - if (!records.chunks.byName) records.chunks.byName = {}; - if (!records.chunks.bySource) records.chunks.bySource = {}; - /** @type {Set} */ - const usedIds = new Set(); - for (const chunk of chunks) { - if (typeof chunk.id !== "number") continue; - const name = chunk.name; - if (name) records.chunks.byName[name] = chunk.id; - const sources = getChunkSources(chunk); - for (const source of sources) { - records.chunks.bySource[source] = chunk.id; + for (const child of snapshot.children) { + const cache = this._snapshotCache.get(child); + if (cache !== undefined) { + this._statTestedChildrenCached++; + /* istanbul ignore else */ + if (typeof cache === "boolean") { + if (cache === false) { + invalid(); + return; } - usedIds.add(chunk.id); + } else { + jobs++; + cache.push(childCallback); } - records.chunks.usedIds = Array.from(usedIds).sort(compareNumbers); + } else { + this._statTestedChildrenNotCached++; + jobs++; + this._checkSnapshotValidNoCache(child, childCallback); } - ); - compilation.hooks.reviveChunks.tap( - "RecordIdsPlugin", - /** - * @param {Chunk[]} chunks the chunks array - * @param {Records} records the records object - * @returns {void} - */ - (chunks, records) => { - if (!records.chunks) return; - /** @type {Set} */ - const usedIds = new Set(); - if (records.chunks.byName) { - for (const chunk of chunks) { - if (chunk.id !== null) continue; - if (!chunk.name) continue; - const id = records.chunks.byName[chunk.name]; - if (id === undefined) continue; - if (usedIds.has(id)) continue; - usedIds.add(id); - chunk.id = id; - chunk.ids = [id]; + } + } + if (snapshot.hasFileTimestamps()) { + const { fileTimestamps } = snapshot; + this._statTestedEntries += fileTimestamps.size; + for (const [path, ts] of fileTimestamps) { + const cache = this._fileTimestamps.get(path); + if (cache !== undefined) { + if (cache !== "ignore" && !checkFile(path, cache, ts)) { + invalid(); + return; + } + } else { + jobs++; + this.fileTimestampQueue.add(path, (err, entry) => { + if (err) return invalidWithError(path, err); + if (!checkFile(path, entry, ts)) { + invalid(); + } else { + jobDone(); } + }); + } + } + } + const processFileHashSnapshot = (path, hash) => { + const cache = this._fileHashes.get(path); + if (cache !== undefined) { + if (cache !== "ignore" && !checkHash(path, cache, hash)) { + invalid(); + return; + } + } else { + jobs++; + this.fileHashQueue.add(path, (err, entry) => { + if (err) return invalidWithError(path, err); + if (!checkHash(path, entry, hash)) { + invalid(); + } else { + jobDone(); } - if (records.chunks.bySource) { - for (const chunk of chunks) { - if (chunk.id !== null) continue; - const sources = getChunkSources(chunk); - for (const source of sources) { - const id = records.chunks.bySource[source]; - if (id === undefined) continue; - if (usedIds.has(id)) continue; - usedIds.add(id); - chunk.id = id; - chunk.ids = [id]; - break; + }); + } + }; + if (snapshot.hasFileHashes()) { + const { fileHashes } = snapshot; + this._statTestedEntries += fileHashes.size; + for (const [path, hash] of fileHashes) { + processFileHashSnapshot(path, hash); + } + } + if (snapshot.hasFileTshs()) { + const { fileTshs } = snapshot; + this._statTestedEntries += fileTshs.size; + for (const [path, tsh] of fileTshs) { + if (typeof tsh === "string") { + processFileHashSnapshot(path, tsh); + } else { + const cache = this._fileTimestamps.get(path); + if (cache !== undefined) { + if (cache === "ignore" || !checkFile(path, cache, tsh, false)) { + processFileHashSnapshot(path, tsh && tsh.hash); + } + } else { + jobs++; + this.fileTimestampQueue.add(path, (err, entry) => { + if (err) return invalidWithError(path, err); + if (!checkFile(path, entry, tsh, false)) { + processFileHashSnapshot(path, tsh && tsh.hash); } + jobDone(); + }); + } + } + } + } + if (snapshot.hasContextTimestamps()) { + const { contextTimestamps } = snapshot; + this._statTestedEntries += contextTimestamps.size; + for (const [path, ts] of contextTimestamps) { + const cache = this._contextTimestamps.get(path); + if (cache === "ignore") continue; + let resolved; + if ( + cache !== undefined && + (resolved = getResolvedTimestamp(cache)) !== undefined + ) { + if (!checkContext(path, resolved, ts)) { + invalid(); + return; + } + } else { + jobs++; + /** + * @param {Error=} err error + * @param {ResolvedContextFileSystemInfoEntry=} entry entry + * @returns {void} + */ + const callback = (err, entry) => { + if (err) return invalidWithError(path, err); + if (!checkContext(path, entry, ts)) { + invalid(); + } else { + jobDone(); } + }; + if (cache !== undefined) { + this._resolveContextTimestamp(cache, callback); + } else { + this.getContextTimestamp(path, callback); } - if (Array.isArray(records.chunks.usedIds)) { - compilation.usedChunkIds = new Set(records.chunks.usedIds); + } + } + } + const processContextHashSnapshot = (path, hash) => { + const cache = this._contextHashes.get(path); + let resolved; + if ( + cache !== undefined && + (resolved = getResolvedHash(cache)) !== undefined + ) { + if (!checkHash(path, resolved, hash)) { + invalid(); + return; + } + } else { + jobs++; + const callback = (err, entry) => { + if (err) return invalidWithError(path, err); + if (!checkHash(path, entry, hash)) { + invalid(); + } else { + jobDone(); } + }; + if (cache !== undefined) { + this._resolveContextHash(cache, callback); + } else { + this.getContextHash(path, callback); } - ); - }); - } -} -module.exports = RecordIdsPlugin; - - -/***/ }), - -/***/ 73406: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { contextify } = __webpack_require__(82186); - -class RequestShortener { - /** - * @param {string} dir the directory - * @param {object=} associatedObjectForCache an object to which the cache will be attached - */ - constructor(dir, associatedObjectForCache) { - this.contextify = contextify.bindContextCache( - dir, - associatedObjectForCache - ); - } - - /** - * @param {string | undefined | null} request the request to shorten - * @returns {string | undefined | null} the shortened request - */ - shorten(request) { - if (!request) { - return request; + } + }; + if (snapshot.hasContextHashes()) { + const { contextHashes } = snapshot; + this._statTestedEntries += contextHashes.size; + for (const [path, hash] of contextHashes) { + processContextHashSnapshot(path, hash); + } } - return this.contextify(request); - } -} - -module.exports = RequestShortener; - - -/***/ }), - -/***/ 88846: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const ConstDependency = __webpack_require__(76911); -const { - toConstantDependency -} = __webpack_require__(93998); - -/** @typedef {import("./Compiler")} Compiler */ - -module.exports = class RequireJsStuffPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "RequireJsStuffPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyTemplates.set( - ConstDependency, - new ConstDependency.Template() - ); - const handler = (parser, parserOptions) => { + if (snapshot.hasContextTshs()) { + const { contextTshs } = snapshot; + this._statTestedEntries += contextTshs.size; + for (const [path, tsh] of contextTshs) { + if (typeof tsh === "string") { + processContextHashSnapshot(path, tsh); + } else { + const cache = this._contextTimestamps.get(path); + if (cache === "ignore") continue; + let resolved; + if ( + cache !== undefined && + (resolved = getResolvedTimestamp(cache)) !== undefined + ) { + if (!checkContext(path, resolved, tsh, false)) { + processContextHashSnapshot(path, tsh && tsh.hash); + } + } else { + jobs++; + /** + * @param {Error=} err error + * @param {ResolvedContextFileSystemInfoEntry=} entry entry + * @returns {void} + */ + const callback = (err, entry) => { + if (err) return invalidWithError(path, err); + if (!checkContext(path, entry, tsh, false)) { + processContextHashSnapshot(path, tsh && tsh.hash); + } + jobDone(); + }; + if (cache !== undefined) { + this._resolveContextTimestamp(cache, callback); + } else { + this.getContextTimestamp(path, callback); + } + } + } + } + } + if (snapshot.hasMissingExistence()) { + const { missingExistence } = snapshot; + this._statTestedEntries += missingExistence.size; + for (const [path, existence] of missingExistence) { + const cache = this._fileTimestamps.get(path); + if (cache !== undefined) { if ( - parserOptions.requireJs === undefined || - !parserOptions.requireJs + cache !== "ignore" && + !checkExistence(path, Boolean(cache), Boolean(existence)) ) { + invalid(); return; } - - parser.hooks.call - .for("require.config") - .tap( - "RequireJsStuffPlugin", - toConstantDependency(parser, "undefined") - ); - parser.hooks.call - .for("requirejs.config") - .tap( - "RequireJsStuffPlugin", - toConstantDependency(parser, "undefined") - ); - - parser.hooks.expression - .for("require.version") - .tap( - "RequireJsStuffPlugin", - toConstantDependency(parser, JSON.stringify("0.0.0")) - ); - parser.hooks.expression - .for("requirejs.onError") - .tap( - "RequireJsStuffPlugin", - toConstantDependency( - parser, - RuntimeGlobals.uncaughtErrorHandler, - [RuntimeGlobals.uncaughtErrorHandler] - ) - ); - }; - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("RequireJsStuffPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("RequireJsStuffPlugin", handler); + } else { + jobs++; + this.fileTimestampQueue.add(path, (err, entry) => { + if (err) return invalidWithError(path, err); + if (!checkExistence(path, Boolean(entry), Boolean(existence))) { + invalid(); + } else { + jobDone(); + } + }); + } } - ); - } -}; - - -/***/ }), - -/***/ 30217: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const Factory = (__webpack_require__(9256).ResolverFactory); -const { HookMap, SyncHook, SyncWaterfallHook } = __webpack_require__(6967); -const { - cachedCleverMerge, - removeOperations, - resolveByProperty -} = __webpack_require__(60839); - -/** @typedef {import("enhanced-resolve").ResolveOptions} ResolveOptions */ -/** @typedef {import("enhanced-resolve").Resolver} Resolver */ -/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} WebpackResolveOptions */ -/** @typedef {import("../declarations/WebpackOptions").ResolvePluginInstance} ResolvePluginInstance */ - -/** @typedef {WebpackResolveOptions & {dependencyType?: string, resolveToContext?: boolean }} ResolveOptionsWithDependencyType */ -/** - * @typedef {Object} WithOptions - * @property {function(Partial): ResolverWithOptions} withOptions create a resolver with additional/different options - */ - -/** @typedef {Resolver & WithOptions} ResolverWithOptions */ - -// need to be hoisted on module level for caching identity -const EMPTY_RESOLVE_OPTIONS = {}; - -/** - * @param {ResolveOptionsWithDependencyType} resolveOptionsWithDepType enhanced options - * @returns {ResolveOptions} merged options - */ -const convertToResolveOptions = resolveOptionsWithDepType => { - const { dependencyType, plugins, ...remaining } = resolveOptionsWithDepType; - - // check type compat - /** @type {Partial} */ - const partialOptions = { - ...remaining, - plugins: - plugins && - /** @type {ResolvePluginInstance[]} */ ( - plugins.filter(item => item !== "...") - ) - }; - - if (!partialOptions.fileSystem) { - throw new Error( - "fileSystem is missing in resolveOptions, but it's required for enhanced-resolve" - ); - } - // These weird types validate that we checked all non-optional properties - const options = - /** @type {Partial & Pick} */ ( - partialOptions - ); - - return removeOperations( - resolveByProperty(options, "byDependency", dependencyType) - ); -}; - -/** - * @typedef {Object} ResolverCache - * @property {WeakMap} direct - * @property {Map} stringified - */ - -module.exports = class ResolverFactory { - constructor() { - this.hooks = Object.freeze({ - /** @type {HookMap>} */ - resolveOptions: new HookMap( - () => new SyncWaterfallHook(["resolveOptions"]) - ), - /** @type {HookMap>} */ - resolver: new HookMap( - () => new SyncHook(["resolver", "resolveOptions", "userResolveOptions"]) - ) - }); - /** @type {Map} */ - this.cache = new Map(); - } - - /** - * @param {string} type type of resolver - * @param {ResolveOptionsWithDependencyType=} resolveOptions options - * @returns {ResolverWithOptions} the resolver - */ - get(type, resolveOptions = EMPTY_RESOLVE_OPTIONS) { - let typedCaches = this.cache.get(type); - if (!typedCaches) { - typedCaches = { - direct: new WeakMap(), - stringified: new Map() - }; - this.cache.set(type, typedCaches); - } - const cachedResolver = typedCaches.direct.get(resolveOptions); - if (cachedResolver) { - return cachedResolver; } - const ident = JSON.stringify(resolveOptions); - const resolver = typedCaches.stringified.get(ident); - if (resolver) { - typedCaches.direct.set(resolveOptions, resolver); - return resolver; + if (snapshot.hasManagedItemInfo()) { + const { managedItemInfo } = snapshot; + this._statTestedEntries += managedItemInfo.size; + for (const [path, info] of managedItemInfo) { + const cache = this._managedItems.get(path); + if (cache !== undefined) { + if (!checkHash(path, cache, info)) { + invalid(); + return; + } + } else { + jobs++; + this.managedItemQueue.add(path, (err, entry) => { + if (err) return invalidWithError(path, err); + if (!checkHash(path, entry, info)) { + invalid(); + } else { + jobDone(); + } + }); + } + } } - const newResolver = this._create(type, resolveOptions); - typedCaches.direct.set(resolveOptions, newResolver); - typedCaches.stringified.set(ident, newResolver); - return newResolver; - } - - /** - * @param {string} type type of resolver - * @param {ResolveOptionsWithDependencyType} resolveOptionsWithDepType options - * @returns {ResolverWithOptions} the resolver - */ - _create(type, resolveOptionsWithDepType) { - /** @type {ResolveOptionsWithDependencyType} */ - const originalResolveOptions = { ...resolveOptionsWithDepType }; + jobDone(); - const resolveOptions = convertToResolveOptions( - this.hooks.resolveOptions.for(type).call(resolveOptionsWithDepType) - ); - const resolver = /** @type {ResolverWithOptions} */ ( - Factory.createResolver(resolveOptions) - ); - if (!resolver) { - throw new Error("No resolver created"); + // if there was an async action + // try to join multiple concurrent request for this snapshot + if (jobs > 0) { + const callbacks = [callback]; + callback = (err, result) => { + for (const callback of callbacks) callback(err, result); + }; + this._snapshotCache.set(snapshot, callbacks); } - /** @type {WeakMap, ResolverWithOptions>} */ - const childCache = new WeakMap(); - resolver.withOptions = options => { - const cacheEntry = childCache.get(options); - if (cacheEntry !== undefined) return cacheEntry; - const mergedOptions = cachedCleverMerge(originalResolveOptions, options); - const resolver = this.get(type, mergedOptions); - childCache.set(options, resolver); - return resolver; - }; - this.hooks.resolver - .for(type) - .call(resolver, resolveOptions, originalResolveOptions); - return resolver; } -}; - -/***/ }), - -/***/ 16475: -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** - * the internal require function - */ -exports.require = "__webpack_require__"; - -/** - * access to properties of the internal require function/object - */ -exports.requireScope = "__webpack_require__.*"; - -/** - * the internal exports object - */ -exports.exports = "__webpack_exports__"; - -/** - * top-level this need to be the exports object - */ -exports.thisAsExports = "top-level-this-exports"; - -/** - * runtime need to return the exports of the last entry module - */ -exports.returnExportsFromRuntime = "return-exports-from-runtime"; - -/** - * the internal module object - */ -exports.module = "module"; - -/** - * the internal module object - */ -exports.moduleId = "module.id"; - -/** - * the internal module object - */ -exports.moduleLoaded = "module.loaded"; - -/** - * the bundle public path - */ -exports.publicPath = "__webpack_require__.p"; - -/** - * the module id of the entry point - */ -exports.entryModuleId = "__webpack_require__.s"; - -/** - * the module cache - */ -exports.moduleCache = "__webpack_require__.c"; - -/** - * the module functions - */ -exports.moduleFactories = "__webpack_require__.m"; - -/** - * the module functions, with only write access - */ -exports.moduleFactoriesAddOnly = "__webpack_require__.m (add only)"; - -/** - * the chunk ensure function - */ -exports.ensureChunk = "__webpack_require__.e"; - -/** - * an object with handlers to ensure a chunk - */ -exports.ensureChunkHandlers = "__webpack_require__.f"; - -/** - * a runtime requirement if ensureChunkHandlers should include loading of chunk needed for entries - */ -exports.ensureChunkIncludeEntries = "__webpack_require__.f (include entries)"; - -/** - * the chunk prefetch function - */ -exports.prefetchChunk = "__webpack_require__.E"; - -/** - * an object with handlers to prefetch a chunk - */ -exports.prefetchChunkHandlers = "__webpack_require__.F"; - -/** - * the chunk preload function - */ -exports.preloadChunk = "__webpack_require__.G"; - -/** - * an object with handlers to preload a chunk - */ -exports.preloadChunkHandlers = "__webpack_require__.H"; - -/** - * the exported property define getters function - */ -exports.definePropertyGetters = "__webpack_require__.d"; - -/** - * define compatibility on export - */ -exports.makeNamespaceObject = "__webpack_require__.r"; - -/** - * create a fake namespace object - */ -exports.createFakeNamespaceObject = "__webpack_require__.t"; - -/** - * compatibility get default export - */ -exports.compatGetDefaultExport = "__webpack_require__.n"; - -/** - * harmony module decorator - */ -exports.harmonyModuleDecorator = "__webpack_require__.hmd"; - -/** - * node.js module decorator - */ -exports.nodeModuleDecorator = "__webpack_require__.nmd"; + _readFileTimestamp(path, callback) { + this.fs.stat(path, (err, stat) => { + if (err) { + if (err.code === "ENOENT") { + this._fileTimestamps.set(path, null); + this._cachedDeprecatedFileTimestamps = undefined; + return callback(null, null); + } + return callback(err); + } -/** - * the webpack hash - */ -exports.getFullHash = "__webpack_require__.h"; + let ts; + if (stat.isDirectory()) { + ts = { + safeTime: 0, + timestamp: undefined + }; + } else { + const mtime = +stat.mtime; -/** - * an object containing all installed WebAssembly.Instance export objects keyed by module id - */ -exports.wasmInstances = "__webpack_require__.w"; + if (mtime) applyMtime(mtime); -/** - * instantiate a wasm instance from module exports object, id, hash and importsObject - */ -exports.instantiateWasm = "__webpack_require__.v"; + ts = { + safeTime: mtime ? mtime + FS_ACCURACY : Infinity, + timestamp: mtime + }; + } -/** - * the uncaught error handler for the webpack runtime - */ -exports.uncaughtErrorHandler = "__webpack_require__.oe"; + this._fileTimestamps.set(path, ts); + this._cachedDeprecatedFileTimestamps = undefined; -/** - * the script nonce - */ -exports.scriptNonce = "__webpack_require__.nc"; + callback(null, ts); + }); + } -/** - * function to load a script tag. - * Arguments: (url: string, done: (event) => void), key?: string | number, chunkId?: string | number) => void - * done function is called when loading has finished or timeout occurred. - * It will attach to existing script tags with data-webpack == uniqueName + ":" + key or src == url. - */ -exports.loadScript = "__webpack_require__.l"; + _readFileHash(path, callback) { + this.fs.readFile(path, (err, content) => { + if (err) { + if (err.code === "EISDIR") { + this._fileHashes.set(path, "directory"); + return callback(null, "directory"); + } + if (err.code === "ENOENT") { + this._fileHashes.set(path, null); + return callback(null, null); + } + if (err.code === "ERR_FS_FILE_TOO_LARGE") { + this.logger.warn(`Ignoring ${path} for hashing as it's very large`); + this._fileHashes.set(path, "too large"); + return callback(null, "too large"); + } + return callback(err); + } -/** - * function to promote a string to a TrustedScript using webpack's Trusted - * Types policy - * Arguments: (script: string) => TrustedScript - */ -exports.createScript = "__webpack_require__.ts"; + const hash = createHash(this._hashFunction); -/** - * function to promote a string to a TrustedScriptURL using webpack's Trusted - * Types policy - * Arguments: (url: string) => TrustedScriptURL - */ -exports.createScriptUrl = "__webpack_require__.tu"; + hash.update(content); -/** - * function to return webpack's Trusted Types policy - * Arguments: () => TrustedTypePolicy - */ -exports.getTrustedTypesPolicy = "__webpack_require__.tt"; + const digest = /** @type {string} */ (hash.digest("hex")); -/** - * the chunk name of the chunk with the runtime - */ -exports.chunkName = "__webpack_require__.cn"; + this._fileHashes.set(path, digest); -/** - * the runtime id of the current runtime - */ -exports.runtimeId = "__webpack_require__.j"; + callback(null, digest); + }); + } -/** - * the filename of the script part of the chunk - */ -exports.getChunkScriptFilename = "__webpack_require__.u"; + _getFileTimestampAndHash(path, callback) { + const continueWithHash = hash => { + const cache = this._fileTimestamps.get(path); + if (cache !== undefined) { + if (cache !== "ignore") { + const result = { + ...cache, + hash + }; + this._fileTshs.set(path, result); + return callback(null, result); + } else { + this._fileTshs.set(path, hash); + return callback(null, hash); + } + } else { + this.fileTimestampQueue.add(path, (err, entry) => { + if (err) { + return callback(err); + } + const result = { + ...entry, + hash + }; + this._fileTshs.set(path, result); + return callback(null, result); + }); + } + }; -/** - * the filename of the css part of the chunk - */ -exports.getChunkCssFilename = "__webpack_require__.k"; + const cache = this._fileHashes.get(path); + if (cache !== undefined) { + continueWithHash(cache); + } else { + this.fileHashQueue.add(path, (err, entry) => { + if (err) { + return callback(err); + } + continueWithHash(entry); + }); + } + } -/** - * a flag when a module/chunk/tree has css modules - */ -exports.hasCssModules = "has css modules"; + /** + * @template T + * @template ItemType + * @param {Object} options options + * @param {string} options.path path + * @param {function(string): ItemType} options.fromImmutablePath called when context item is an immutable path + * @param {function(string): ItemType} options.fromManagedItem called when context item is a managed path + * @param {function(string, string, function(Error=, ItemType=): void): void} options.fromSymlink called when context item is a symlink + * @param {function(string, IStats, function(Error=, ItemType=): void): void} options.fromFile called when context item is a file + * @param {function(string, IStats, function(Error=, ItemType=): void): void} options.fromDirectory called when context item is a directory + * @param {function(string[], ItemType[]): T} options.reduce called from all context items + * @param {function((Error | null)=, (T)=): void} callback callback + */ + _readContext( + { + path, + fromImmutablePath, + fromManagedItem, + fromSymlink, + fromFile, + fromDirectory, + reduce + }, + callback + ) { + this.fs.readdir(path, (err, _files) => { + if (err) { + if (err.code === "ENOENT") { + return callback(null, null); + } + return callback(err); + } + const files = /** @type {string[]} */ (_files) + .map(file => file.normalize("NFC")) + .filter(file => !/^\./.test(file)) + .sort(); + asyncLib.map( + files, + (file, callback) => { + const child = join(this.fs, path, file); + for (const immutablePath of this.immutablePathsRegExps) { + if (immutablePath.test(path)) { + // ignore any immutable path for timestamping + return callback(null, fromImmutablePath(path)); + } + } + for (const immutablePath of this.immutablePathsWithSlash) { + if (path.startsWith(immutablePath)) { + // ignore any immutable path for timestamping + return callback(null, fromImmutablePath(path)); + } + } + for (const managedPath of this.managedPathsRegExps) { + const match = managedPath.exec(path); + if (match) { + const managedItem = getManagedItem(match[1], path); + if (managedItem) { + // construct timestampHash from managed info + return this.managedItemQueue.add(managedItem, (err, info) => { + if (err) return callback(err); + return callback(null, fromManagedItem(info)); + }); + } + } + } + for (const managedPath of this.managedPathsWithSlash) { + if (path.startsWith(managedPath)) { + const managedItem = getManagedItem(managedPath, child); + if (managedItem) { + // construct timestampHash from managed info + return this.managedItemQueue.add(managedItem, (err, info) => { + if (err) return callback(err); + return callback(null, fromManagedItem(info)); + }); + } + } + } -/** - * the filename of the script part of the hot update chunk - */ -exports.getChunkUpdateScriptFilename = "__webpack_require__.hu"; + lstatReadlinkAbsolute(this.fs, child, (err, stat) => { + if (err) return callback(err); -/** - * the filename of the css part of the hot update chunk - */ -exports.getChunkUpdateCssFilename = "__webpack_require__.hk"; + if (typeof stat === "string") { + return fromSymlink(child, stat, callback); + } -/** - * startup signal from runtime - * This will be called when the runtime chunk has been loaded. - */ -exports.startup = "__webpack_require__.x"; + if (stat.isFile()) { + return fromFile(child, stat, callback); + } + if (stat.isDirectory()) { + return fromDirectory(child, stat, callback); + } + callback(null, null); + }); + }, + (err, results) => { + if (err) return callback(err); + const result = reduce(files, results); + callback(null, result); + } + ); + }); + } -/** - * @deprecated - * creating a default startup function with the entry modules - */ -exports.startupNoDefault = "__webpack_require__.x (no default handler)"; + _readContextTimestamp(path, callback) { + this._readContext( + { + path, + fromImmutablePath: () => null, + fromManagedItem: info => ({ + safeTime: 0, + timestampHash: info + }), + fromSymlink: (file, target, callback) => { + callback(null, { + timestampHash: target, + symlinks: new Set([target]) + }); + }, + fromFile: (file, stat, callback) => { + // Prefer the cached value over our new stat to report consistent results + const cache = this._fileTimestamps.get(file); + if (cache !== undefined) + return callback(null, cache === "ignore" ? null : cache); -/** - * startup signal from runtime but only used to add logic after the startup - */ -exports.startupOnlyAfter = "__webpack_require__.x (only after)"; + const mtime = +stat.mtime; -/** - * startup signal from runtime but only used to add sync logic before the startup - */ -exports.startupOnlyBefore = "__webpack_require__.x (only before)"; + if (mtime) applyMtime(mtime); -/** - * global callback functions for installing chunks - */ -exports.chunkCallback = "webpackChunk"; + const ts = { + safeTime: mtime ? mtime + FS_ACCURACY : Infinity, + timestamp: mtime + }; -/** - * method to startup an entrypoint with needed chunks. - * Signature: (moduleId: Id, chunkIds: Id[]) => any. - * Returns the exports of the module or a Promise - */ -exports.startupEntrypoint = "__webpack_require__.X"; + this._fileTimestamps.set(file, ts); + this._cachedDeprecatedFileTimestamps = undefined; + callback(null, ts); + }, + fromDirectory: (directory, stat, callback) => { + this.contextTimestampQueue.increaseParallelism(); + this._getUnresolvedContextTimestamp(directory, (err, tsEntry) => { + this.contextTimestampQueue.decreaseParallelism(); + callback(err, tsEntry); + }); + }, + reduce: (files, tsEntries) => { + let symlinks = undefined; -/** - * register deferred code, which will run when certain - * chunks are loaded. - * Signature: (chunkIds: Id[], fn: () => any, priority: int >= 0 = 0) => any - * Returned value will be returned directly when all chunks are already loaded - * When (priority & 1) it will wait for all other handlers with lower priority to - * be executed before itself is executed - */ -exports.onChunksLoaded = "__webpack_require__.O"; + const hash = createHash(this._hashFunction); -/** - * method to install a chunk that was loaded somehow - * Signature: ({ id, ids, modules, runtime }) => void - */ -exports.externalInstallChunk = "__webpack_require__.C"; + for (const file of files) hash.update(file); + let safeTime = 0; + for (const entry of tsEntries) { + if (!entry) { + hash.update("n"); + continue; + } + if (entry.timestamp) { + hash.update("f"); + hash.update(`${entry.timestamp}`); + } else if (entry.timestampHash) { + hash.update("d"); + hash.update(`${entry.timestampHash}`); + } + if (entry.symlinks !== undefined) { + if (symlinks === undefined) symlinks = new Set(); + addAll(entry.symlinks, symlinks); + } + if (entry.safeTime) { + safeTime = Math.max(safeTime, entry.safeTime); + } + } -/** - * interceptor for module executions - */ -exports.interceptModuleExecution = "__webpack_require__.i"; + const digest = /** @type {string} */ (hash.digest("hex")); -/** - * the global object - */ -exports.global = "__webpack_require__.g"; + const result = { + safeTime, + timestampHash: digest + }; + if (symlinks) result.symlinks = symlinks; + return result; + } + }, + (err, result) => { + if (err) return callback(err); + this._contextTimestamps.set(path, result); + this._cachedDeprecatedContextTimestamps = undefined; -/** - * an object with all share scopes - */ -exports.shareScopeMap = "__webpack_require__.S"; + callback(null, result); + } + ); + } -/** - * The sharing init sequence function (only runs once per share scope). - * Has one argument, the name of the share scope. - * Creates a share scope if not existing - */ -exports.initializeSharing = "__webpack_require__.I"; + /** + * @param {ContextFileSystemInfoEntry} entry entry + * @param {function((Error | null)=, ResolvedContextFileSystemInfoEntry=): void} callback callback + * @returns {void} + */ + _resolveContextTimestamp(entry, callback) { + const hashes = []; + let safeTime = 0; + processAsyncTree( + entry.symlinks, + 10, + (target, push, callback) => { + this._getUnresolvedContextTimestamp(target, (err, entry) => { + if (err) return callback(err); + if (entry && entry !== "ignore") { + hashes.push(entry.timestampHash); + if (entry.safeTime) { + safeTime = Math.max(safeTime, entry.safeTime); + } + if (entry.symlinks !== undefined) { + for (const target of entry.symlinks) push(target); + } + } + callback(); + }); + }, + err => { + if (err) return callback(err); + const hash = createHash(this._hashFunction); + hash.update(entry.timestampHash); + if (entry.safeTime) { + safeTime = Math.max(safeTime, entry.safeTime); + } + hashes.sort(); + for (const h of hashes) { + hash.update(h); + } + callback( + null, + (entry.resolved = { + safeTime, + timestampHash: /** @type {string} */ (hash.digest("hex")) + }) + ); + } + ); + } -/** - * The current scope when getting a module from a remote - */ -exports.currentRemoteGetScope = "__webpack_require__.R"; + _readContextHash(path, callback) { + this._readContext( + { + path, + fromImmutablePath: () => "", + fromManagedItem: info => info || "", + fromSymlink: (file, target, callback) => { + callback(null, { + hash: target, + symlinks: new Set([target]) + }); + }, + fromFile: (file, stat, callback) => + this.getFileHash(file, (err, hash) => { + callback(err, hash || ""); + }), + fromDirectory: (directory, stat, callback) => { + this.contextHashQueue.increaseParallelism(); + this._getUnresolvedContextHash(directory, (err, hash) => { + this.contextHashQueue.decreaseParallelism(); + callback(err, hash || ""); + }); + }, + /** + * @param {string[]} files files + * @param {(string | ContextHash)[]} fileHashes hashes + * @returns {ContextHash} reduced hash + */ + reduce: (files, fileHashes) => { + let symlinks = undefined; + const hash = createHash(this._hashFunction); -/** - * the filename of the HMR manifest - */ -exports.getUpdateManifestFilename = "__webpack_require__.hmrF"; + for (const file of files) hash.update(file); + for (const entry of fileHashes) { + if (typeof entry === "string") { + hash.update(entry); + } else { + hash.update(entry.hash); + if (entry.symlinks) { + if (symlinks === undefined) symlinks = new Set(); + addAll(entry.symlinks, symlinks); + } + } + } -/** - * function downloading the update manifest - */ -exports.hmrDownloadManifest = "__webpack_require__.hmrM"; + const result = { + hash: /** @type {string} */ (hash.digest("hex")) + }; + if (symlinks) result.symlinks = symlinks; + return result; + } + }, + (err, result) => { + if (err) return callback(err); + this._contextHashes.set(path, result); + return callback(null, result); + } + ); + } -/** - * array with handler functions to download chunk updates - */ -exports.hmrDownloadUpdateHandlers = "__webpack_require__.hmrC"; + /** + * @param {ContextHash} entry context hash + * @param {function((Error | null)=, string=): void} callback callback + * @returns {void} + */ + _resolveContextHash(entry, callback) { + const hashes = []; + processAsyncTree( + entry.symlinks, + 10, + (target, push, callback) => { + this._getUnresolvedContextHash(target, (err, hash) => { + if (err) return callback(err); + if (hash) { + hashes.push(hash.hash); + if (hash.symlinks !== undefined) { + for (const target of hash.symlinks) push(target); + } + } + callback(); + }); + }, + err => { + if (err) return callback(err); + const hash = createHash(this._hashFunction); + hash.update(entry.hash); + hashes.sort(); + for (const h of hashes) { + hash.update(h); + } + callback( + null, + (entry.resolved = /** @type {string} */ (hash.digest("hex"))) + ); + } + ); + } -/** - * object with all hmr module data for all modules - */ -exports.hmrModuleData = "__webpack_require__.hmrD"; + _readContextTimestampAndHash(path, callback) { + const finalize = (timestamp, hash) => { + const result = + timestamp === "ignore" + ? hash + : { + ...timestamp, + ...hash + }; + this._contextTshs.set(path, result); + callback(null, result); + }; + const cachedHash = this._contextHashes.get(path); + const cachedTimestamp = this._contextTimestamps.get(path); + if (cachedHash !== undefined) { + if (cachedTimestamp !== undefined) { + finalize(cachedTimestamp, cachedHash); + } else { + this.contextTimestampQueue.add(path, (err, entry) => { + if (err) return callback(err); + finalize(entry, cachedHash); + }); + } + } else { + if (cachedTimestamp !== undefined) { + this.contextHashQueue.add(path, (err, entry) => { + if (err) return callback(err); + finalize(cachedTimestamp, entry); + }); + } else { + this._readContext( + { + path, + fromImmutablePath: () => null, + fromManagedItem: info => ({ + safeTime: 0, + timestampHash: info, + hash: info || "" + }), + fromSymlink: (fle, target, callback) => { + callback(null, { + timestampHash: target, + hash: target, + symlinks: new Set([target]) + }); + }, + fromFile: (file, stat, callback) => { + this._getFileTimestampAndHash(file, callback); + }, + fromDirectory: (directory, stat, callback) => { + this.contextTshQueue.increaseParallelism(); + this.contextTshQueue.add(directory, (err, result) => { + this.contextTshQueue.decreaseParallelism(); + callback(err, result); + }); + }, + /** + * @param {string[]} files files + * @param {(Partial & Partial | string | null)[]} results results + * @returns {ContextTimestampAndHash} tsh + */ + reduce: (files, results) => { + let symlinks = undefined; -/** - * array with handler functions when a module should be invalidated - */ -exports.hmrInvalidateModuleHandlers = "__webpack_require__.hmrI"; + const tsHash = createHash(this._hashFunction); + const hash = createHash(this._hashFunction); -/** - * the prefix for storing state of runtime modules when hmr is enabled - */ -exports.hmrRuntimeStatePrefix = "__webpack_require__.hmrS"; + for (const file of files) { + tsHash.update(file); + hash.update(file); + } + let safeTime = 0; + for (const entry of results) { + if (!entry) { + tsHash.update("n"); + continue; + } + if (typeof entry === "string") { + tsHash.update("n"); + hash.update(entry); + continue; + } + if (entry.timestamp) { + tsHash.update("f"); + tsHash.update(`${entry.timestamp}`); + } else if (entry.timestampHash) { + tsHash.update("d"); + tsHash.update(`${entry.timestampHash}`); + } + if (entry.symlinks !== undefined) { + if (symlinks === undefined) symlinks = new Set(); + addAll(entry.symlinks, symlinks); + } + if (entry.safeTime) { + safeTime = Math.max(safeTime, entry.safeTime); + } + hash.update(entry.hash); + } -/** - * the AMD define function - */ -exports.amdDefine = "__webpack_require__.amdD"; + const result = { + safeTime, + timestampHash: /** @type {string} */ (tsHash.digest("hex")), + hash: /** @type {string} */ (hash.digest("hex")) + }; + if (symlinks) result.symlinks = symlinks; + return result; + } + }, + (err, result) => { + if (err) return callback(err); + this._contextTshs.set(path, result); + return callback(null, result); + } + ); + } + } + } -/** - * the AMD options - */ -exports.amdOptions = "__webpack_require__.amdO"; + /** + * @param {ContextTimestampAndHash} entry entry + * @param {function((Error | null)=, ResolvedContextTimestampAndHash=): void} callback callback + * @returns {void} + */ + _resolveContextTsh(entry, callback) { + const hashes = []; + const tsHashes = []; + let safeTime = 0; + processAsyncTree( + entry.symlinks, + 10, + (target, push, callback) => { + this._getUnresolvedContextTsh(target, (err, entry) => { + if (err) return callback(err); + if (entry) { + hashes.push(entry.hash); + if (entry.timestampHash) tsHashes.push(entry.timestampHash); + if (entry.safeTime) { + safeTime = Math.max(safeTime, entry.safeTime); + } + if (entry.symlinks !== undefined) { + for (const target of entry.symlinks) push(target); + } + } + callback(); + }); + }, + err => { + if (err) return callback(err); + const hash = createHash(this._hashFunction); + const tsHash = createHash(this._hashFunction); + hash.update(entry.hash); + if (entry.timestampHash) tsHash.update(entry.timestampHash); + if (entry.safeTime) { + safeTime = Math.max(safeTime, entry.safeTime); + } + hashes.sort(); + for (const h of hashes) { + hash.update(h); + } + tsHashes.sort(); + for (const h of tsHashes) { + tsHash.update(h); + } + callback( + null, + (entry.resolved = { + safeTime, + timestampHash: /** @type {string} */ (tsHash.digest("hex")), + hash: /** @type {string} */ (hash.digest("hex")) + }) + ); + } + ); + } -/** - * the System polyfill object - */ -exports.system = "__webpack_require__.System"; + _getManagedItemDirectoryInfo(path, callback) { + this.fs.readdir(path, (err, elements) => { + if (err) { + if (err.code === "ENOENT" || err.code === "ENOTDIR") { + return callback(null, EMPTY_SET); + } + return callback(err); + } + const set = new Set( + /** @type {string[]} */ (elements).map(element => + join(this.fs, path, element) + ) + ); + callback(null, set); + }); + } -/** - * the shorthand for Object.prototype.hasOwnProperty - * using of it decreases the compiled bundle size - */ -exports.hasOwnProperty = "__webpack_require__.o"; + _getManagedItemInfo(path, callback) { + const dir = dirname(this.fs, path); + this.managedItemDirectoryQueue.add(dir, (err, elements) => { + if (err) { + return callback(err); + } + if (!elements.has(path)) { + // file or directory doesn't exist + this._managedItems.set(path, "*missing"); + return callback(null, "*missing"); + } + // something exists + // it may be a file or directory + if ( + path.endsWith("node_modules") && + (path.endsWith("/node_modules") || path.endsWith("\\node_modules")) + ) { + // we are only interested in existence of this special directory + this._managedItems.set(path, "*node_modules"); + return callback(null, "*node_modules"); + } -/** - * the System.register context object - */ -exports.systemContext = "__webpack_require__.y"; + // we assume it's a directory, as files shouldn't occur in managed paths + const packageJsonPath = join(this.fs, path, "package.json"); + this.fs.readFile(packageJsonPath, (err, content) => { + if (err) { + if (err.code === "ENOENT" || err.code === "ENOTDIR") { + // no package.json or path is not a directory + this.fs.readdir(path, (err, elements) => { + if ( + !err && + elements.length === 1 && + elements[0] === "node_modules" + ) { + // This is only a grouping folder e. g. used by yarn + // we are only interested in existence of this special directory + this._managedItems.set(path, "*nested"); + return callback(null, "*nested"); + } + this.logger.warn( + `Managed item ${path} isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)` + ); + return callback(); + }); + return; + } + return callback(err); + } + let data; + try { + data = JSON.parse(content.toString("utf-8")); + } catch (e) { + return callback(e); + } + if (!data.name) { + this.logger.warn( + `${packageJsonPath} doesn't contain a "name" property (see snapshot.managedPaths option)` + ); + return callback(); + } + const info = `${data.name || ""}@${data.version || ""}`; + this._managedItems.set(path, info); + callback(null, info); + }); + }); + } -/** - * the baseURI of current document - */ -exports.baseURI = "__webpack_require__.b"; + getDeprecatedFileTimestamps() { + if (this._cachedDeprecatedFileTimestamps !== undefined) + return this._cachedDeprecatedFileTimestamps; + const map = new Map(); + for (const [path, info] of this._fileTimestamps) { + if (info) map.set(path, typeof info === "object" ? info.safeTime : null); + } + return (this._cachedDeprecatedFileTimestamps = map); + } -/** - * a RelativeURL class when relative URLs are used - */ -exports.relativeUrl = "__webpack_require__.U"; + getDeprecatedContextTimestamps() { + if (this._cachedDeprecatedContextTimestamps !== undefined) + return this._cachedDeprecatedContextTimestamps; + const map = new Map(); + for (const [path, info] of this._contextTimestamps) { + if (info) map.set(path, typeof info === "object" ? info.safeTime : null); + } + return (this._cachedDeprecatedContextTimestamps = map); + } +} -/** - * Creates an async module. The body function must be a async function. - * "module.exports" will be decorated with an AsyncModulePromise. - * The body function will be called. - * To handle async dependencies correctly do this: "([a, b, c] = await handleDependencies([a, b, c]));". - * If "hasAwaitAfterDependencies" is truthy, "handleDependencies()" must be called at the end of the body function. - * Signature: function( - * module: Module, - * body: (handleDependencies: (deps: AsyncModulePromise[]) => Promise & () => void, - * hasAwaitAfterDependencies?: boolean - * ) => void - */ -exports.asyncModule = "__webpack_require__.a"; +module.exports = FileSystemInfo; +module.exports.Snapshot = Snapshot; /***/ }), -/***/ 16963: +/***/ 58727: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -53009,669 +47782,839 @@ exports.asyncModule = "__webpack_require__.a"; -const { RawSource } = __webpack_require__(51255); -const OriginalSource = (__webpack_require__(51255).OriginalSource); -const Module = __webpack_require__(73208); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("./WebpackError")} WebpackError */ -/** @typedef {import("./util/Hash")} Hash */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ +const { getEntryRuntime, mergeRuntimeOwned } = __webpack_require__(17156); -const TYPES = new Set(["runtime"]); +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ -class RuntimeModule extends Module { - /** - * @param {string} name a readable name - * @param {number=} stage an optional stage - */ - constructor(name, stage = 0) { - super("runtime"); - this.name = name; - this.stage = stage; - this.buildMeta = {}; - this.buildInfo = {}; - /** @type {Compilation} */ - this.compilation = undefined; - /** @type {Chunk} */ - this.chunk = undefined; - /** @type {ChunkGraph} */ - this.chunkGraph = undefined; - this.fullHash = false; - this.dependentHash = false; - /** @type {string} */ - this._cachedGeneratedCode = undefined; +class FlagAllModulesAsUsedPlugin { + constructor(explanation) { + this.explanation = explanation; } /** - * @param {Compilation} compilation the compilation - * @param {Chunk} chunk the chunk - * @param {ChunkGraph} chunkGraph the chunk graph + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - attach(compilation, chunk, chunkGraph = compilation.chunkGraph) { - this.compilation = compilation; - this.chunk = chunk; - this.chunkGraph = chunkGraph; + apply(compiler) { + compiler.hooks.compilation.tap( + "FlagAllModulesAsUsedPlugin", + compilation => { + const moduleGraph = compilation.moduleGraph; + compilation.hooks.optimizeDependencies.tap( + "FlagAllModulesAsUsedPlugin", + modules => { + /** @type {RuntimeSpec} */ + let runtime = undefined; + for (const [name, { options }] of compilation.entries) { + runtime = mergeRuntimeOwned( + runtime, + getEntryRuntime(compilation, name, options) + ); + } + for (const module of modules) { + const exportsInfo = moduleGraph.getExportsInfo(module); + exportsInfo.setUsedInUnknownWay(runtime); + moduleGraph.addExtraReason(module, this.explanation); + if (module.factoryMeta === undefined) { + module.factoryMeta = {}; + } + module.factoryMeta.sideEffectFree = false; + } + } + ); + } + ); } +} - /** - * @returns {string} a unique identifier of the module - */ - identifier() { - return `webpack/runtime/${this.name}`; - } +module.exports = FlagAllModulesAsUsedPlugin; - /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module - */ - readableIdentifier(requestShortener) { - return `webpack/runtime/${this.name}`; - } - /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} - */ - needBuild(context, callback) { - return callback(null, false); - } +/***/ }), - /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} - */ - build(options, compilation, resolver, fs, callback) { - // do nothing - // should not be called as runtime modules are added later to the compilation - callback(); - } +/***/ 84506: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const asyncLib = __webpack_require__(78175); +const Queue = __webpack_require__(65930); + +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./Dependency").ExportSpec} ExportSpec */ +/** @typedef {import("./Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("./ExportsInfo")} ExportsInfo */ +/** @typedef {import("./Module")} Module */ +class FlagDependencyExportsPlugin { /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - updateHash(hash, context) { - hash.update(this.name); - hash.update(`${this.stage}`); - try { - if (this.fullHash || this.dependentHash) { - // Do not use getGeneratedCode here, because i. e. compilation hash might be not - // ready at this point. We will cache it later instead. - hash.update(this.generate()); - } else { - hash.update(this.getGeneratedCode()); - } - } catch (err) { - hash.update(err.message); - } - super.updateHash(hash, context); - } + apply(compiler) { + compiler.hooks.compilation.tap( + "FlagDependencyExportsPlugin", + compilation => { + const moduleGraph = compilation.moduleGraph; + const cache = compilation.getCache("FlagDependencyExportsPlugin"); + compilation.hooks.finishModules.tapAsync( + "FlagDependencyExportsPlugin", + (modules, callback) => { + const logger = compilation.getLogger( + "webpack.FlagDependencyExportsPlugin" + ); + let statRestoredFromMemCache = 0; + let statRestoredFromCache = 0; + let statNoExports = 0; + let statFlaggedUncached = 0; + let statNotCached = 0; + let statQueueItemsProcessed = 0; - /** - * @returns {Set} types available (do not mutate) - */ - getSourceTypes() { - return TYPES; - } + const { moduleMemCaches } = compilation; - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration(context) { - const sources = new Map(); - const generatedCode = this.getGeneratedCode(); - if (generatedCode) { - sources.set( - "runtime", - this.useSourceMap || this.useSimpleSourceMap - ? new OriginalSource(generatedCode, this.identifier()) - : new RawSource(generatedCode) - ); - } - return { - sources, - runtimeRequirements: null - }; - } + /** @type {Queue} */ + const queue = new Queue(); + + // Step 1: Try to restore cached provided export info from cache + logger.time("restore cached provided exports"); + asyncLib.each( + modules, + (module, callback) => { + const exportsInfo = moduleGraph.getExportsInfo(module); + if (!module.buildMeta || !module.buildMeta.exportsType) { + if (exportsInfo.otherExportsInfo.provided !== null) { + // It's a module without declared exports + statNoExports++; + exportsInfo.setHasProvideInfo(); + exportsInfo.setUnknownExportsProvided(); + return callback(); + } + } + if (typeof module.buildInfo.hash !== "string") { + statFlaggedUncached++; + // Enqueue uncacheable module for determining the exports + queue.enqueue(module); + exportsInfo.setHasProvideInfo(); + return callback(); + } + const memCache = moduleMemCaches && moduleMemCaches.get(module); + const memCacheValue = memCache && memCache.get(this); + if (memCacheValue !== undefined) { + statRestoredFromMemCache++; + exportsInfo.restoreProvided(memCacheValue); + return callback(); + } + cache.get( + module.identifier(), + module.buildInfo.hash, + (err, result) => { + if (err) return callback(err); + + if (result !== undefined) { + statRestoredFromCache++; + exportsInfo.restoreProvided(result); + } else { + statNotCached++; + // Without cached info enqueue module for determining the exports + queue.enqueue(module); + exportsInfo.setHasProvideInfo(); + } + callback(); + } + ); + }, + err => { + logger.timeEnd("restore cached provided exports"); + if (err) return callback(err); - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - try { - const source = this.getGeneratedCode(); - return source ? source.length : 0; - } catch (e) { - return 0; - } - } + /** @type {Set} */ + const modulesToStore = new Set(); - /* istanbul ignore next */ - /** - * @abstract - * @returns {string} runtime code - */ - generate() { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); - } + /** @type {Map>} */ + const dependencies = new Map(); - /** - * @returns {string} runtime code - */ - getGeneratedCode() { - if (this._cachedGeneratedCode) { - return this._cachedGeneratedCode; - } - return (this._cachedGeneratedCode = this.generate()); - } + /** @type {Module} */ + let module; - /** - * @returns {boolean} true, if the runtime module should get it's own scope - */ - shouldIsolate() { - return true; - } -} + /** @type {ExportsInfo} */ + let exportsInfo; -/** - * Runtime modules without any dependencies to other runtime modules - */ -RuntimeModule.STAGE_NORMAL = 0; + /** @type {Map} */ + const exportsSpecsFromDependencies = new Map(); -/** - * Runtime modules with simple dependencies on other runtime modules - */ -RuntimeModule.STAGE_BASIC = 5; + let cacheable = true; + let changed = false; -/** - * Runtime modules which attach to handlers of other runtime modules - */ -RuntimeModule.STAGE_ATTACH = 10; + /** + * @param {DependenciesBlock} depBlock the dependencies block + * @returns {void} + */ + const processDependenciesBlock = depBlock => { + for (const dep of depBlock.dependencies) { + processDependency(dep); + } + for (const block of depBlock.blocks) { + processDependenciesBlock(block); + } + }; -/** - * Runtime modules which trigger actions on bootstrap - */ -RuntimeModule.STAGE_TRIGGER = 20; + /** + * @param {Dependency} dep the dependency + * @returns {void} + */ + const processDependency = dep => { + const exportDesc = dep.getExports(moduleGraph); + if (!exportDesc) return; + exportsSpecsFromDependencies.set(dep, exportDesc); + }; -module.exports = RuntimeModule; + /** + * @param {Dependency} dep dependency + * @param {ExportsSpec} exportDesc info + * @returns {void} + */ + const processExportsSpec = (dep, exportDesc) => { + const exports = exportDesc.exports; + const globalCanMangle = exportDesc.canMangle; + const globalFrom = exportDesc.from; + const globalPriority = exportDesc.priority; + const globalTerminalBinding = + exportDesc.terminalBinding || false; + const exportDeps = exportDesc.dependencies; + if (exportDesc.hideExports) { + for (const name of exportDesc.hideExports) { + const exportInfo = exportsInfo.getExportInfo(name); + exportInfo.unsetTarget(dep); + } + } + if (exports === true) { + // unknown exports + if ( + exportsInfo.setUnknownExportsProvided( + globalCanMangle, + exportDesc.excludeExports, + globalFrom && dep, + globalFrom, + globalPriority + ) + ) { + changed = true; + } + } else if (Array.isArray(exports)) { + /** + * merge in new exports + * @param {ExportsInfo} exportsInfo own exports info + * @param {(ExportSpec | string)[]} exports list of exports + */ + const mergeExports = (exportsInfo, exports) => { + for (const exportNameOrSpec of exports) { + let name; + let canMangle = globalCanMangle; + let terminalBinding = globalTerminalBinding; + let exports = undefined; + let from = globalFrom; + let fromExport = undefined; + let priority = globalPriority; + let hidden = false; + if (typeof exportNameOrSpec === "string") { + name = exportNameOrSpec; + } else { + name = exportNameOrSpec.name; + if (exportNameOrSpec.canMangle !== undefined) + canMangle = exportNameOrSpec.canMangle; + if (exportNameOrSpec.export !== undefined) + fromExport = exportNameOrSpec.export; + if (exportNameOrSpec.exports !== undefined) + exports = exportNameOrSpec.exports; + if (exportNameOrSpec.from !== undefined) + from = exportNameOrSpec.from; + if (exportNameOrSpec.priority !== undefined) + priority = exportNameOrSpec.priority; + if (exportNameOrSpec.terminalBinding !== undefined) + terminalBinding = exportNameOrSpec.terminalBinding; + if (exportNameOrSpec.hidden !== undefined) + hidden = exportNameOrSpec.hidden; + } + const exportInfo = exportsInfo.getExportInfo(name); + if ( + exportInfo.provided === false || + exportInfo.provided === null + ) { + exportInfo.provided = true; + changed = true; + } -/***/ }), + if ( + exportInfo.canMangleProvide !== false && + canMangle === false + ) { + exportInfo.canMangleProvide = false; + changed = true; + } -/***/ 2307: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (terminalBinding && !exportInfo.terminalBinding) { + exportInfo.terminalBinding = true; + changed = true; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (exports) { + const nestedExportsInfo = + exportInfo.createNestedExportsInfo(); + mergeExports(nestedExportsInfo, exports); + } + if ( + from && + (hidden + ? exportInfo.unsetTarget(dep) + : exportInfo.setTarget( + dep, + from, + fromExport === undefined ? [name] : fromExport, + priority + )) + ) { + changed = true; + } + // Recalculate target exportsInfo + const target = exportInfo.getTarget(moduleGraph); + let targetExportsInfo = undefined; + if (target) { + const targetModuleExportsInfo = + moduleGraph.getExportsInfo(target.module); + targetExportsInfo = + targetModuleExportsInfo.getNestedExportsInfo( + target.export + ); + // add dependency for this module + const set = dependencies.get(target.module); + if (set === undefined) { + dependencies.set(target.module, new Set([module])); + } else { + set.add(module); + } + } -const RuntimeGlobals = __webpack_require__(16475); -const { getChunkFilenameTemplate } = __webpack_require__(47283); -const RuntimeRequirementsDependency = __webpack_require__(24187); -const JavascriptModulesPlugin = __webpack_require__(89464); -const AsyncModuleRuntimeModule = __webpack_require__(63672); -const AutoPublicPathRuntimeModule = __webpack_require__(66532); -const CompatGetDefaultExportRuntimeModule = __webpack_require__(44793); -const CompatRuntimeModule = __webpack_require__(88234); -const CreateFakeNamespaceObjectRuntimeModule = __webpack_require__(94669); -const CreateScriptRuntimeModule = __webpack_require__(2759); -const CreateScriptUrlRuntimeModule = __webpack_require__(21213); -const DefinePropertyGettersRuntimeModule = __webpack_require__(75481); -const EnsureChunkRuntimeModule = __webpack_require__(71519); -const GetChunkFilenameRuntimeModule = __webpack_require__(34277); -const GetMainFilenameRuntimeModule = __webpack_require__(10029); -const GetTrustedTypesPolicyRuntimeModule = __webpack_require__(38713); -const GlobalRuntimeModule = __webpack_require__(23255); -const HasOwnPropertyRuntimeModule = __webpack_require__(8011); -const LoadScriptRuntimeModule = __webpack_require__(19942); -const MakeNamespaceObjectRuntimeModule = __webpack_require__(65714); -const OnChunksLoadedRuntimeModule = __webpack_require__(44518); -const PublicPathRuntimeModule = __webpack_require__(56030); -const RelativeUrlRuntimeModule = __webpack_require__(4537); -const RuntimeIdRuntimeModule = __webpack_require__(97115); -const SystemContextRuntimeModule = __webpack_require__(80655); -const ShareRuntimeModule = __webpack_require__(96066); -const StringXor = __webpack_require__(40293); + if (exportInfo.exportsInfoOwned) { + if ( + exportInfo.exportsInfo.setRedirectNamedTo( + targetExportsInfo + ) + ) { + changed = true; + } + } else if ( + exportInfo.exportsInfo !== targetExportsInfo + ) { + exportInfo.exportsInfo = targetExportsInfo; + changed = true; + } + } + }; + mergeExports(exportsInfo, exports); + } + // store dependencies + if (exportDeps) { + cacheable = false; + for (const exportDependency of exportDeps) { + // add dependency for this module + const set = dependencies.get(exportDependency); + if (set === undefined) { + dependencies.set(exportDependency, new Set([module])); + } else { + set.add(module); + } + } + } + }; -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Module")} Module */ + const notifyDependencies = () => { + const deps = dependencies.get(module); + if (deps !== undefined) { + for (const dep of deps) { + queue.enqueue(dep); + } + } + }; -const GLOBALS_ON_REQUIRE = [ - RuntimeGlobals.chunkName, - RuntimeGlobals.runtimeId, - RuntimeGlobals.compatGetDefaultExport, - RuntimeGlobals.createFakeNamespaceObject, - RuntimeGlobals.createScript, - RuntimeGlobals.createScriptUrl, - RuntimeGlobals.getTrustedTypesPolicy, - RuntimeGlobals.definePropertyGetters, - RuntimeGlobals.ensureChunk, - RuntimeGlobals.entryModuleId, - RuntimeGlobals.getFullHash, - RuntimeGlobals.global, - RuntimeGlobals.makeNamespaceObject, - RuntimeGlobals.moduleCache, - RuntimeGlobals.moduleFactories, - RuntimeGlobals.moduleFactoriesAddOnly, - RuntimeGlobals.interceptModuleExecution, - RuntimeGlobals.publicPath, - RuntimeGlobals.baseURI, - RuntimeGlobals.relativeUrl, - RuntimeGlobals.scriptNonce, - RuntimeGlobals.uncaughtErrorHandler, - RuntimeGlobals.asyncModule, - RuntimeGlobals.wasmInstances, - RuntimeGlobals.instantiateWasm, - RuntimeGlobals.shareScopeMap, - RuntimeGlobals.initializeSharing, - RuntimeGlobals.loadScript, - RuntimeGlobals.systemContext, - RuntimeGlobals.onChunksLoaded -]; + logger.time("figure out provided exports"); + while (queue.length > 0) { + module = queue.dequeue(); -const MODULE_DEPENDENCIES = { - [RuntimeGlobals.moduleLoaded]: [RuntimeGlobals.module], - [RuntimeGlobals.moduleId]: [RuntimeGlobals.module] -}; + statQueueItemsProcessed++; -const TREE_DEPENDENCIES = { - [RuntimeGlobals.definePropertyGetters]: [RuntimeGlobals.hasOwnProperty], - [RuntimeGlobals.compatGetDefaultExport]: [ - RuntimeGlobals.definePropertyGetters - ], - [RuntimeGlobals.createFakeNamespaceObject]: [ - RuntimeGlobals.definePropertyGetters, - RuntimeGlobals.makeNamespaceObject, - RuntimeGlobals.require - ], - [RuntimeGlobals.initializeSharing]: [RuntimeGlobals.shareScopeMap], - [RuntimeGlobals.shareScopeMap]: [RuntimeGlobals.hasOwnProperty] -}; + exportsInfo = moduleGraph.getExportsInfo(module); -class RuntimePlugin { - /** - * @param {Compiler} compiler the Compiler - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap("RuntimePlugin", compilation => { - compilation.dependencyTemplates.set( - RuntimeRequirementsDependency, - new RuntimeRequirementsDependency.Template() - ); - for (const req of GLOBALS_ON_REQUIRE) { - compilation.hooks.runtimeRequirementInModule - .for(req) - .tap("RuntimePlugin", (module, set) => { - set.add(RuntimeGlobals.requireScope); - }); - compilation.hooks.runtimeRequirementInTree - .for(req) - .tap("RuntimePlugin", (module, set) => { - set.add(RuntimeGlobals.requireScope); - }); - } - for (const req of Object.keys(TREE_DEPENDENCIES)) { - const deps = TREE_DEPENDENCIES[req]; - compilation.hooks.runtimeRequirementInTree - .for(req) - .tap("RuntimePlugin", (chunk, set) => { - for (const dep of deps) set.add(dep); - }); - } - for (const req of Object.keys(MODULE_DEPENDENCIES)) { - const deps = MODULE_DEPENDENCIES[req]; - compilation.hooks.runtimeRequirementInModule - .for(req) - .tap("RuntimePlugin", (chunk, set) => { - for (const dep of deps) set.add(dep); - }); - } - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.definePropertyGetters) - .tap("RuntimePlugin", chunk => { - compilation.addRuntimeModule( - chunk, - new DefinePropertyGettersRuntimeModule() - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.makeNamespaceObject) - .tap("RuntimePlugin", chunk => { - compilation.addRuntimeModule( - chunk, - new MakeNamespaceObjectRuntimeModule() - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.createFakeNamespaceObject) - .tap("RuntimePlugin", chunk => { - compilation.addRuntimeModule( - chunk, - new CreateFakeNamespaceObjectRuntimeModule() - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hasOwnProperty) - .tap("RuntimePlugin", chunk => { - compilation.addRuntimeModule( - chunk, - new HasOwnPropertyRuntimeModule() - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.compatGetDefaultExport) - .tap("RuntimePlugin", chunk => { - compilation.addRuntimeModule( - chunk, - new CompatGetDefaultExportRuntimeModule() - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.runtimeId) - .tap("RuntimePlugin", chunk => { - compilation.addRuntimeModule(chunk, new RuntimeIdRuntimeModule()); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.publicPath) - .tap("RuntimePlugin", (chunk, set) => { - const { outputOptions } = compilation; - const { publicPath: globalPublicPath, scriptType } = outputOptions; - const entryOptions = chunk.getEntryOptions(); - const publicPath = - entryOptions && entryOptions.publicPath !== undefined - ? entryOptions.publicPath - : globalPublicPath; + cacheable = true; + changed = false; - if (publicPath === "auto") { - const module = new AutoPublicPathRuntimeModule(); - if (scriptType !== "module") set.add(RuntimeGlobals.global); - compilation.addRuntimeModule(chunk, module); - } else { - const module = new PublicPathRuntimeModule(publicPath); + exportsSpecsFromDependencies.clear(); + moduleGraph.freeze(); + processDependenciesBlock(module); + moduleGraph.unfreeze(); + for (const [ + dep, + exportsSpec + ] of exportsSpecsFromDependencies) { + processExportsSpec(dep, exportsSpec); + } - if ( - typeof publicPath !== "string" || - /\[(full)?hash\]/.test(publicPath) - ) { - module.fullHash = true; - } + if (cacheable) { + modulesToStore.add(module); + } - compilation.addRuntimeModule(chunk, module); - } - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.global) - .tap("RuntimePlugin", chunk => { - compilation.addRuntimeModule(chunk, new GlobalRuntimeModule()); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.asyncModule) - .tap("RuntimePlugin", chunk => { - compilation.addRuntimeModule(chunk, new AsyncModuleRuntimeModule()); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.systemContext) - .tap("RuntimePlugin", chunk => { - const { outputOptions } = compilation; - const { library: globalLibrary } = outputOptions; - const entryOptions = chunk.getEntryOptions(); - const libraryType = - entryOptions && entryOptions.library !== undefined - ? entryOptions.library.type - : globalLibrary.type; + if (changed) { + notifyDependencies(); + } + } + logger.timeEnd("figure out provided exports"); - if (libraryType === "system") { - compilation.addRuntimeModule( - chunk, - new SystemContextRuntimeModule() + logger.log( + `${Math.round( + (100 * (statFlaggedUncached + statNotCached)) / + (statRestoredFromMemCache + + statRestoredFromCache + + statNotCached + + statFlaggedUncached + + statNoExports) + )}% of exports of modules have been determined (${statNoExports} no declared exports, ${statNotCached} not cached, ${statFlaggedUncached} flagged uncacheable, ${statRestoredFromCache} from cache, ${statRestoredFromMemCache} from mem cache, ${ + statQueueItemsProcessed - + statNotCached - + statFlaggedUncached + } additional calculations due to dependencies)` + ); + + logger.time("store provided exports into cache"); + asyncLib.each( + modulesToStore, + (module, callback) => { + if (typeof module.buildInfo.hash !== "string") { + // not cacheable + return callback(); + } + const cachedData = moduleGraph + .getExportsInfo(module) + .getRestoreProvidedData(); + const memCache = + moduleMemCaches && moduleMemCaches.get(module); + if (memCache) { + memCache.set(this, cachedData); + } + cache.store( + module.identifier(), + module.buildInfo.hash, + cachedData, + callback + ); + }, + err => { + logger.timeEnd("store provided exports into cache"); + callback(err); + } + ); + } ); } - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.getChunkScriptFilename) - .tap("RuntimePlugin", (chunk, set) => { - if ( - typeof compilation.outputOptions.chunkFilename === "string" && - /\[(full)?hash(:\d+)?\]/.test( - compilation.outputOptions.chunkFilename - ) - ) { - set.add(RuntimeGlobals.getFullHash); - } - compilation.addRuntimeModule( - chunk, - new GetChunkFilenameRuntimeModule( - "javascript", - "javascript", - RuntimeGlobals.getChunkScriptFilename, - chunk => - chunk.filenameTemplate || - (chunk.canBeInitial() - ? compilation.outputOptions.filename - : compilation.outputOptions.chunkFilename), - false - ) - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.getChunkCssFilename) - .tap("RuntimePlugin", (chunk, set) => { - if ( - typeof compilation.outputOptions.cssChunkFilename === "string" && - /\[(full)?hash(:\d+)?\]/.test( - compilation.outputOptions.cssChunkFilename - ) - ) { - set.add(RuntimeGlobals.getFullHash); + ); + + /** @type {WeakMap} */ + const providedExportsCache = new WeakMap(); + compilation.hooks.rebuildModule.tap( + "FlagDependencyExportsPlugin", + module => { + providedExportsCache.set( + module, + moduleGraph.getExportsInfo(module).getRestoreProvidedData() + ); } - compilation.addRuntimeModule( - chunk, - new GetChunkFilenameRuntimeModule( - "css", - "css", - RuntimeGlobals.getChunkCssFilename, - chunk => - getChunkFilenameTemplate(chunk, compilation.outputOptions), - set.has(RuntimeGlobals.hmrDownloadUpdateHandlers) - ) - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.getChunkUpdateScriptFilename) - .tap("RuntimePlugin", (chunk, set) => { - if ( - /\[(full)?hash(:\d+)?\]/.test( - compilation.outputOptions.hotUpdateChunkFilename - ) - ) - set.add(RuntimeGlobals.getFullHash); - compilation.addRuntimeModule( - chunk, - new GetChunkFilenameRuntimeModule( - "javascript", - "javascript update", - RuntimeGlobals.getChunkUpdateScriptFilename, - c => compilation.outputOptions.hotUpdateChunkFilename, - true - ) - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.getUpdateManifestFilename) - .tap("RuntimePlugin", (chunk, set) => { - if ( - /\[(full)?hash(:\d+)?\]/.test( - compilation.outputOptions.hotUpdateMainFilename - ) - ) { - set.add(RuntimeGlobals.getFullHash); + ); + compilation.hooks.finishRebuildingModule.tap( + "FlagDependencyExportsPlugin", + module => { + moduleGraph + .getExportsInfo(module) + .restoreProvided(providedExportsCache.get(module)); } - compilation.addRuntimeModule( - chunk, - new GetMainFilenameRuntimeModule( - "update manifest", - RuntimeGlobals.getUpdateManifestFilename, - compilation.outputOptions.hotUpdateMainFilename - ) - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunk) - .tap("RuntimePlugin", (chunk, set) => { - const hasAsyncChunks = chunk.hasAsyncChunks(); - if (hasAsyncChunks) { - set.add(RuntimeGlobals.ensureChunkHandlers); + ); + } + ); + } +} + +module.exports = FlagDependencyExportsPlugin; + + +/***/ }), + +/***/ 58812: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const Dependency = __webpack_require__(54912); +const { UsageState } = __webpack_require__(63686); +const ModuleGraphConnection = __webpack_require__(40639); +const { STAGE_DEFAULT } = __webpack_require__(80057); +const ArrayQueue = __webpack_require__(41792); +const TupleQueue = __webpack_require__(38415); +const { getEntryRuntime, mergeRuntimeOwned } = __webpack_require__(17156); + +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./ChunkGroup")} ChunkGroup */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ +/** @typedef {import("./Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("./ExportsInfo")} ExportsInfo */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ + +const { NO_EXPORTS_REFERENCED, EXPORTS_OBJECT_REFERENCED } = Dependency; + +class FlagDependencyUsagePlugin { + /** + * @param {boolean} global do a global analysis instead of per runtime + */ + constructor(global) { + this.global = global; + } + + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap("FlagDependencyUsagePlugin", compilation => { + const moduleGraph = compilation.moduleGraph; + compilation.hooks.optimizeDependencies.tap( + { + name: "FlagDependencyUsagePlugin", + stage: STAGE_DEFAULT + }, + modules => { + if (compilation.moduleMemCaches) { + throw new Error( + "optimization.usedExports can't be used with cacheUnaffected as export usage is a global effect" + ); } - compilation.addRuntimeModule( - chunk, - new EnsureChunkRuntimeModule(set) + + const logger = compilation.getLogger( + "webpack.FlagDependencyUsagePlugin" ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkIncludeEntries) - .tap("RuntimePlugin", (chunk, set) => { - set.add(RuntimeGlobals.ensureChunkHandlers); - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.shareScopeMap) - .tap("RuntimePlugin", (chunk, set) => { - compilation.addRuntimeModule(chunk, new ShareRuntimeModule()); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.loadScript) - .tap("RuntimePlugin", (chunk, set) => { - const withCreateScriptUrl = !!compilation.outputOptions.trustedTypes; - if (withCreateScriptUrl) { - set.add(RuntimeGlobals.createScriptUrl); + /** @type {Map} */ + const exportInfoToModuleMap = new Map(); + + /** @type {TupleQueue<[Module, RuntimeSpec]>} */ + const queue = new TupleQueue(); + + /** + * @param {Module} module module to process + * @param {(string[] | ReferencedExport)[]} usedExports list of used exports + * @param {RuntimeSpec} runtime part of which runtime + * @param {boolean} forceSideEffects always apply side effects + * @returns {void} + */ + const processReferencedModule = ( + module, + usedExports, + runtime, + forceSideEffects + ) => { + const exportsInfo = moduleGraph.getExportsInfo(module); + if (usedExports.length > 0) { + if (!module.buildMeta || !module.buildMeta.exportsType) { + if (exportsInfo.setUsedWithoutInfo(runtime)) { + queue.enqueue(module, runtime); + } + return; + } + for (const usedExportInfo of usedExports) { + let usedExport; + let canMangle = true; + if (Array.isArray(usedExportInfo)) { + usedExport = usedExportInfo; + } else { + usedExport = usedExportInfo.name; + canMangle = usedExportInfo.canMangle !== false; + } + if (usedExport.length === 0) { + if (exportsInfo.setUsedInUnknownWay(runtime)) { + queue.enqueue(module, runtime); + } + } else { + let currentExportsInfo = exportsInfo; + for (let i = 0; i < usedExport.length; i++) { + const exportInfo = currentExportsInfo.getExportInfo( + usedExport[i] + ); + if (canMangle === false) { + exportInfo.canMangleUse = false; + } + const lastOne = i === usedExport.length - 1; + if (!lastOne) { + const nestedInfo = exportInfo.getNestedExportsInfo(); + if (nestedInfo) { + if ( + exportInfo.setUsedConditionally( + used => used === UsageState.Unused, + UsageState.OnlyPropertiesUsed, + runtime + ) + ) { + const currentModule = + currentExportsInfo === exportsInfo + ? module + : exportInfoToModuleMap.get(currentExportsInfo); + if (currentModule) { + queue.enqueue(currentModule, runtime); + } + } + currentExportsInfo = nestedInfo; + continue; + } + } + if ( + exportInfo.setUsedConditionally( + v => v !== UsageState.Used, + UsageState.Used, + runtime + ) + ) { + const currentModule = + currentExportsInfo === exportsInfo + ? module + : exportInfoToModuleMap.get(currentExportsInfo); + if (currentModule) { + queue.enqueue(currentModule, runtime); + } + } + break; + } + } + } + } else { + // for a module without side effects we stop tracking usage here when no export is used + // This module won't be evaluated in this case + // TODO webpack 6 remove this check + if ( + !forceSideEffects && + module.factoryMeta !== undefined && + module.factoryMeta.sideEffectFree + ) { + return; + } + if (exportsInfo.setUsedForSideEffectsOnly(runtime)) { + queue.enqueue(module, runtime); + } + } + }; + + /** + * @param {DependenciesBlock} module the module + * @param {RuntimeSpec} runtime part of which runtime + * @param {boolean} forceSideEffects always apply side effects + * @returns {void} + */ + const processModule = (module, runtime, forceSideEffects) => { + /** @type {Map>} */ + const map = new Map(); + + /** @type {ArrayQueue} */ + const queue = new ArrayQueue(); + queue.enqueue(module); + for (;;) { + const block = queue.dequeue(); + if (block === undefined) break; + for (const b of block.blocks) { + if ( + !this.global && + b.groupOptions && + b.groupOptions.entryOptions + ) { + processModule( + b, + b.groupOptions.entryOptions.runtime || undefined, + true + ); + } else { + queue.enqueue(b); + } + } + for (const dep of block.dependencies) { + const connection = moduleGraph.getConnection(dep); + if (!connection || !connection.module) { + continue; + } + const activeState = connection.getActiveState(runtime); + if (activeState === false) continue; + const { module } = connection; + if (activeState === ModuleGraphConnection.TRANSITIVE_ONLY) { + processModule(module, runtime, false); + continue; + } + const oldReferencedExports = map.get(module); + if (oldReferencedExports === EXPORTS_OBJECT_REFERENCED) { + continue; + } + const referencedExports = + compilation.getDependencyReferencedExports(dep, runtime); + if ( + oldReferencedExports === undefined || + oldReferencedExports === NO_EXPORTS_REFERENCED || + referencedExports === EXPORTS_OBJECT_REFERENCED + ) { + map.set(module, referencedExports); + } else if ( + oldReferencedExports !== undefined && + referencedExports === NO_EXPORTS_REFERENCED + ) { + continue; + } else { + let exportsMap; + if (Array.isArray(oldReferencedExports)) { + exportsMap = new Map(); + for (const item of oldReferencedExports) { + if (Array.isArray(item)) { + exportsMap.set(item.join("\n"), item); + } else { + exportsMap.set(item.name.join("\n"), item); + } + } + map.set(module, exportsMap); + } else { + exportsMap = oldReferencedExports; + } + for (const item of referencedExports) { + if (Array.isArray(item)) { + const key = item.join("\n"); + const oldItem = exportsMap.get(key); + if (oldItem === undefined) { + exportsMap.set(key, item); + } + // if oldItem is already an array we have to do nothing + // if oldItem is an ReferencedExport object, we don't have to do anything + // as canMangle defaults to true for arrays + } else { + const key = item.name.join("\n"); + const oldItem = exportsMap.get(key); + if (oldItem === undefined || Array.isArray(oldItem)) { + exportsMap.set(key, item); + } else { + exportsMap.set(key, { + name: item.name, + canMangle: item.canMangle && oldItem.canMangle + }); + } + } + } + } + } + } + + for (const [module, referencedExports] of map) { + if (Array.isArray(referencedExports)) { + processReferencedModule( + module, + referencedExports, + runtime, + forceSideEffects + ); + } else { + processReferencedModule( + module, + Array.from(referencedExports.values()), + runtime, + forceSideEffects + ); + } + } + }; + + logger.time("initialize exports usage"); + for (const module of modules) { + const exportsInfo = moduleGraph.getExportsInfo(module); + exportInfoToModuleMap.set(exportsInfo, module); + exportsInfo.setHasUseInfo(); } - compilation.addRuntimeModule( - chunk, - new LoadScriptRuntimeModule(withCreateScriptUrl) - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.createScript) - .tap("RuntimePlugin", (chunk, set) => { - if (compilation.outputOptions.trustedTypes) { - set.add(RuntimeGlobals.getTrustedTypesPolicy); + logger.timeEnd("initialize exports usage"); + + logger.time("trace exports usage in graph"); + + /** + * @param {Dependency} dep dependency + * @param {RuntimeSpec} runtime runtime + */ + const processEntryDependency = (dep, runtime) => { + const module = moduleGraph.getModule(dep); + if (module) { + processReferencedModule( + module, + NO_EXPORTS_REFERENCED, + runtime, + true + ); + } + }; + /** @type {RuntimeSpec} */ + let globalRuntime = undefined; + for (const [ + entryName, + { dependencies: deps, includeDependencies: includeDeps, options } + ] of compilation.entries) { + const runtime = this.global + ? undefined + : getEntryRuntime(compilation, entryName, options); + for (const dep of deps) { + processEntryDependency(dep, runtime); + } + for (const dep of includeDeps) { + processEntryDependency(dep, runtime); + } + globalRuntime = mergeRuntimeOwned(globalRuntime, runtime); } - compilation.addRuntimeModule(chunk, new CreateScriptRuntimeModule()); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.createScriptUrl) - .tap("RuntimePlugin", (chunk, set) => { - if (compilation.outputOptions.trustedTypes) { - set.add(RuntimeGlobals.getTrustedTypesPolicy); + for (const dep of compilation.globalEntry.dependencies) { + processEntryDependency(dep, globalRuntime); } - compilation.addRuntimeModule( - chunk, - new CreateScriptUrlRuntimeModule() - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.getTrustedTypesPolicy) - .tap("RuntimePlugin", (chunk, set) => { - compilation.addRuntimeModule( - chunk, - new GetTrustedTypesPolicyRuntimeModule(set) - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.relativeUrl) - .tap("RuntimePlugin", (chunk, set) => { - compilation.addRuntimeModule(chunk, new RelativeUrlRuntimeModule()); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.onChunksLoaded) - .tap("RuntimePlugin", (chunk, set) => { - compilation.addRuntimeModule( - chunk, - new OnChunksLoadedRuntimeModule() - ); - return true; - }); - // TODO webpack 6: remove CompatRuntimeModule - compilation.hooks.additionalTreeRuntimeRequirements.tap( - "RuntimePlugin", - (chunk, set) => { - const { mainTemplate } = compilation; - if ( - mainTemplate.hooks.bootstrap.isUsed() || - mainTemplate.hooks.localVars.isUsed() || - mainTemplate.hooks.requireEnsure.isUsed() || - mainTemplate.hooks.requireExtensions.isUsed() - ) { - compilation.addRuntimeModule(chunk, new CompatRuntimeModule()); + for (const dep of compilation.globalEntry.includeDependencies) { + processEntryDependency(dep, globalRuntime); } - } - ); - JavascriptModulesPlugin.getCompilationHooks(compilation).chunkHash.tap( - "RuntimePlugin", - (chunk, hash, { chunkGraph }) => { - const xor = new StringXor(); - for (const m of chunkGraph.getChunkRuntimeModulesIterable(chunk)) { - xor.add(chunkGraph.getModuleHash(m, chunk.runtime)); + + while (queue.length) { + const [module, runtime] = queue.dequeue(); + processModule(module, runtime, false); } - xor.updateHash(hash); + logger.timeEnd("trace exports usage in graph"); } ); }); } } -module.exports = RuntimePlugin; + +module.exports = FlagDependencyUsagePlugin; /***/ }), -/***/ 18777: +/***/ 93401: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -53682,1125 +48625,1274 @@ module.exports = RuntimePlugin; -const InitFragment = __webpack_require__(55870); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const { equals } = __webpack_require__(84953); -const compileBooleanMatcher = __webpack_require__(29404); -const propertyAccess = __webpack_require__(54190); -const { forEachRuntime, subtractRuntime } = __webpack_require__(17156); - -/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */ -/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("webpack-sources").Source} Source */ /** @typedef {import("./ChunkGraph")} ChunkGraph */ /** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ /** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ConcatenationScope")} ConcatenationScope */ +/** @typedef {import("./DependencyTemplate")} DependencyTemplate */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ /** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./NormalModule")} NormalModule */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./util/Hash")} Hash */ /** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ /** - * @param {Module} module the module - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {string} error message + * @typedef {Object} GenerateContext + * @property {DependencyTemplates} dependencyTemplates mapping from dependencies to templates + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {Set} runtimeRequirements the requirements for runtime + * @property {RuntimeSpec} runtime the runtime + * @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules + * @property {CodeGenerationResults=} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that) + * @property {string} type which kind of code should be generated + * @property {function(): Map=} getData get access to the code generation data */ -const noModuleIdErrorMessage = (module, chunkGraph) => { - return `Module ${module.identifier()} has no id assigned. -This should not happen. -It's in these chunks: ${ - Array.from( - chunkGraph.getModuleChunksIterable(module), - c => c.name || c.id || c.debugId - ).join(", ") || "none" - } (If module is in no chunk this indicates a bug in some chunk/module optimization logic) -Module has these incoming connections: ${Array.from( - chunkGraph.moduleGraph.getIncomingConnections(module), - connection => - `\n - ${ - connection.originModule && connection.originModule.identifier() - } ${connection.dependency && connection.dependency.type} ${ - (connection.explanations && - Array.from(connection.explanations).join(", ")) || - "" - }` - ).join("")}`; -}; /** - * @param {string|undefined} definition global object definition - * @returns {string} save to use global object + * @typedef {Object} UpdateHashContext + * @property {NormalModule} module the module + * @property {ChunkGraph} chunkGraph + * @property {RuntimeSpec} runtime */ -function getGlobalObject(definition) { - if (!definition) return definition; - const trimmed = definition.trim(); - - if ( - // identifier, we do not need real identifier regarding ECMAScript/Unicode - trimmed.match(/^[_\p{L}][_0-9\p{L}]*$/iu) || - // iife - // call expression - // expression in parentheses - trimmed.match(/^([_\p{L}][_0-9\p{L}]*)?\(.*\)$/iu) - ) - return trimmed; - return `Object(${trimmed})`; -} +/** + * + */ +class Generator { + static byType(map) { + return new ByTypeGenerator(map); + } -class RuntimeTemplate { + /* istanbul ignore next */ /** - * @param {Compilation} compilation the compilation - * @param {OutputOptions} outputOptions the compilation output options - * @param {RequestShortener} requestShortener the request shortener + * @abstract + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) */ - constructor(compilation, outputOptions, requestShortener) { - this.compilation = compilation; - this.outputOptions = outputOptions || {}; - this.requestShortener = requestShortener; - this.globalObject = getGlobalObject(outputOptions.globalObject); + getTypes(module) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } - isIIFE() { - return this.outputOptions.iife; + /* istanbul ignore next */ + /** + * @abstract + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module + */ + getSize(module, type) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } - isModule() { - return this.outputOptions.module; + /* istanbul ignore next */ + /** + * @abstract + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code + */ + generate( + module, + { dependencyTemplates, runtimeTemplate, moduleGraph, type } + ) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } - supportsConst() { - return this.outputOptions.environment.const; + /** + * @param {NormalModule} module module for which the bailout reason should be determined + * @param {ConcatenationBailoutReasonContext} context context + * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated + */ + getConcatenationBailoutReason(module, context) { + return `Module Concatenation is not implemented for ${this.constructor.name}`; } - supportsArrowFunction() { - return this.outputOptions.environment.arrowFunction; + /** + * @param {Hash} hash hash that will be modified + * @param {UpdateHashContext} updateHashContext context for updating hash + */ + updateHash(hash, { module, runtime }) { + // no nothing } +} - supportsOptionalChaining() { - return this.outputOptions.environment.optionalChaining; +class ByTypeGenerator extends Generator { + constructor(map) { + super(); + this.map = map; + this._types = new Set(Object.keys(map)); } - supportsForOf() { - return this.outputOptions.environment.forOf; + /** + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) + */ + getTypes(module) { + return this._types; } - supportsDestructuring() { - return this.outputOptions.environment.destructuring; + /** + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module + */ + getSize(module, type) { + const t = type || "javascript"; + const generator = this.map[t]; + return generator ? generator.getSize(module, t) : 0; } - supportsBigIntLiteral() { - return this.outputOptions.environment.bigIntLiteral; + /** + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code + */ + generate(module, generateContext) { + const type = generateContext.type; + const generator = this.map[type]; + if (!generator) { + throw new Error(`Generator.byType: no generator specified for ${type}`); + } + return generator.generate(module, generateContext); } +} - supportsDynamicImport() { - return this.outputOptions.environment.dynamicImport; - } +module.exports = Generator; - supportsEcmaScriptModuleSyntax() { - return this.outputOptions.environment.module; - } - supportTemplateLiteral() { - return this.outputOptions.environment.templateLiteral; +/***/ }), + +/***/ 37234: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./ChunkGroup")} ChunkGroup */ +/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ +/** @typedef {import("./Module")} Module */ + +/** + * @param {ChunkGroup} chunkGroup the ChunkGroup to connect + * @param {Chunk} chunk chunk to tie to ChunkGroup + * @returns {void} + */ +const connectChunkGroupAndChunk = (chunkGroup, chunk) => { + if (chunkGroup.pushChunk(chunk)) { + chunk.addGroup(chunkGroup); } +}; - returningFunction(returnValue, args = "") { - return this.supportsArrowFunction() - ? `(${args}) => (${returnValue})` - : `function(${args}) { return ${returnValue}; }`; +/** + * @param {ChunkGroup} parent parent ChunkGroup to connect + * @param {ChunkGroup} child child ChunkGroup to connect + * @returns {void} + */ +const connectChunkGroupParentAndChild = (parent, child) => { + if (parent.addChild(child)) { + child.addParent(parent); } +}; - basicFunction(args, body) { - return this.supportsArrowFunction() - ? `(${args}) => {\n${Template.indent(body)}\n}` - : `function(${args}) {\n${Template.indent(body)}\n}`; +exports.connectChunkGroupAndChunk = connectChunkGroupAndChunk; +exports.connectChunkGroupParentAndChild = connectChunkGroupParentAndChild; + + +/***/ }), + +/***/ 97511: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const WebpackError = __webpack_require__(53799); + +module.exports = class HarmonyLinkingError extends WebpackError { + /** @param {string} message Error message */ + constructor(message) { + super(message); + this.name = "HarmonyLinkingError"; + this.hideStack = true; } +}; + + +/***/ }), + +/***/ 11351: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Sean Larkin @thelarkinn +*/ + + + +const WebpackError = __webpack_require__(53799); + +/** @typedef {import("./Module")} Module */ + +/** + * @template T + * @callback Callback + * @param {Error=} err + * @param {T=} stats + * @returns {void} + */ +class HookWebpackError extends WebpackError { /** - * @param {Array} args args - * @returns {string} result expression + * Creates an instance of HookWebpackError. + * @param {Error} error inner error + * @param {string} hook name of hook */ - concatenation(...args) { - const len = args.length; + constructor(error, hook) { + super(error.message); - if (len === 2) return this._es5Concatenation(args); - if (len === 0) return '""'; - if (len === 1) { - return typeof args[0] === "string" - ? JSON.stringify(args[0]) - : `"" + ${args[0].expr}`; - } - if (!this.supportTemplateLiteral()) return this._es5Concatenation(args); + this.name = "HookWebpackError"; + this.hook = hook; + this.error = error; + this.hideStack = true; + this.details = `caused by plugins in ${hook}\n${error.stack}`; - // cost comparison between template literal and concatenation: - // both need equal surroundings: `xxx` vs "xxx" - // template literal has constant cost of 3 chars for each expression - // es5 concatenation has cost of 3 + n chars for n expressions in row - // when a es5 concatenation ends with an expression it reduces cost by 3 - // when a es5 concatenation starts with an single expression it reduces cost by 3 - // e. g. `${a}${b}${c}` (3*3 = 9) is longer than ""+a+b+c ((3+3)-3 = 3) - // e. g. `x${a}x${b}x${c}x` (3*3 = 9) is shorter than "x"+a+"x"+b+"x"+c+"x" (4+4+4 = 12) + this.stack += `\n-- inner error --\n${error.stack}`; + } +} - let templateCost = 0; - let concatenationCost = 0; +module.exports = HookWebpackError; - let lastWasExpr = false; - for (const arg of args) { - const isExpr = typeof arg !== "string"; - if (isExpr) { - templateCost += 3; - concatenationCost += lastWasExpr ? 1 : 4; +/** + * @param {Error} error an error + * @param {string} hook name of the hook + * @returns {WebpackError} a webpack error + */ +const makeWebpackError = (error, hook) => { + if (error instanceof WebpackError) return error; + return new HookWebpackError(error, hook); +}; +module.exports.makeWebpackError = makeWebpackError; + +/** + * @template T + * @param {function((WebpackError | null)=, T=): void} callback webpack error callback + * @param {string} hook name of hook + * @returns {Callback} generic callback + */ +const makeWebpackErrorCallback = (callback, hook) => { + return (err, result) => { + if (err) { + if (err instanceof WebpackError) { + callback(err); + return; } - lastWasExpr = isExpr; + callback(new HookWebpackError(err, hook)); + return; } - if (lastWasExpr) concatenationCost -= 3; - if (typeof args[0] !== "string" && typeof args[1] === "string") - concatenationCost -= 3; + callback(null, result); + }; +}; - if (concatenationCost <= templateCost) return this._es5Concatenation(args); +module.exports.makeWebpackErrorCallback = makeWebpackErrorCallback; - return `\`${args - .map(arg => (typeof arg === "string" ? arg : `\${${arg.expr}}`)) - .join("")}\``; +/** + * @template T + * @param {function(): T} fn function which will be wrapping in try catch + * @param {string} hook name of hook + * @returns {T} the result + */ +const tryRunOrWebpackError = (fn, hook) => { + let r; + try { + r = fn(); + } catch (err) { + if (err instanceof WebpackError) { + throw err; + } + throw new HookWebpackError(err, hook); } + return r; +}; - /** - * @param {Array} args args (len >= 2) - * @returns {string} result expression - * @private - */ - _es5Concatenation(args) { - const str = args - .map(arg => (typeof arg === "string" ? JSON.stringify(arg) : arg.expr)) - .join(" + "); +module.exports.tryRunOrWebpackError = tryRunOrWebpackError; - // when the first two args are expression, we need to prepend "" + to force string - // concatenation instead of number addition. - return typeof args[0] !== "string" && typeof args[1] !== "string" - ? `"" + ${str}` - : str; - } - expressionFunction(expression, args = "") { - return this.supportsArrowFunction() - ? `(${args}) => (${expression})` - : `function(${args}) { ${expression}; }`; - } +/***/ }), + +/***/ 6404: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + - emptyFunction() { - return this.supportsArrowFunction() ? "x => {}" : "function() {}"; - } - destructureArray(items, value) { - return this.supportsDestructuring() - ? `var [${items.join(", ")}] = ${value};` - : Template.asString( - items.map((item, i) => `var ${item} = ${value}[${i}];`) - ); - } +const { SyncBailHook } = __webpack_require__(41242); +const { RawSource } = __webpack_require__(51255); +const ChunkGraph = __webpack_require__(64971); +const Compilation = __webpack_require__(85720); +const HotUpdateChunk = __webpack_require__(9597); +const NormalModule = __webpack_require__(39); +const RuntimeGlobals = __webpack_require__(16475); +const WebpackError = __webpack_require__(53799); +const ConstDependency = __webpack_require__(76911); +const ImportMetaHotAcceptDependency = __webpack_require__(51274); +const ImportMetaHotDeclineDependency = __webpack_require__(53141); +const ModuleHotAcceptDependency = __webpack_require__(47511); +const ModuleHotDeclineDependency = __webpack_require__(86301); +const HotModuleReplacementRuntimeModule = __webpack_require__(27899); +const JavascriptParser = __webpack_require__(29050); +const { + evaluateToIdentifier +} = __webpack_require__(93998); +const { find, isSubset } = __webpack_require__(93347); +const TupleSet = __webpack_require__(76455); +const { compareModulesById } = __webpack_require__(29579); +const { + getRuntimeKey, + keyToRuntime, + forEachRuntime, + mergeRuntimeOwned, + subtractRuntime, + intersectRuntime +} = __webpack_require__(17156); - destructureObject(items, value) { - return this.supportsDestructuring() - ? `var {${items.join(", ")}} = ${value};` - : Template.asString( - items.map(item => `var ${item} = ${value}${propertyAccess([item])};`) - ); - } +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./RuntimeModule")} RuntimeModule */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - iife(args, body) { - return `(${this.basicFunction(args, body)})()`; - } +/** + * @typedef {Object} HMRJavascriptParserHooks + * @property {SyncBailHook<[TODO, string[]], void>} hotAcceptCallback + * @property {SyncBailHook<[TODO, string[]], void>} hotAcceptWithoutCallback + */ - forEach(variable, array, body) { - return this.supportsForOf() - ? `for(const ${variable} of ${array}) {\n${Template.indent(body)}\n}` - : `${array}.forEach(function(${variable}) {\n${Template.indent( - body - )}\n});`; - } +/** @type {WeakMap} */ +const parserHooksMap = new WeakMap(); +class HotModuleReplacementPlugin { /** - * Add a comment - * @param {object} options Information content of the comment - * @param {string=} options.request request string used originally - * @param {string=} options.chunkName name of the chunk referenced - * @param {string=} options.chunkReason reason information of the chunk - * @param {string=} options.message additional message - * @param {string=} options.exportName name of the export - * @returns {string} comment + * @param {JavascriptParser} parser the parser + * @returns {HMRJavascriptParserHooks} the attached hooks */ - comment({ request, chunkName, chunkReason, message, exportName }) { - let content; - if (this.outputOptions.pathinfo) { - content = [message, request, chunkName, chunkReason] - .filter(Boolean) - .map(item => this.requestShortener.shorten(item)) - .join(" | "); - } else { - content = [message, chunkName, chunkReason] - .filter(Boolean) - .map(item => this.requestShortener.shorten(item)) - .join(" | "); + static getParserHooks(parser) { + if (!(parser instanceof JavascriptParser)) { + throw new TypeError( + "The 'parser' argument must be an instance of JavascriptParser" + ); } - if (!content) return ""; - if (this.outputOptions.pathinfo) { - return Template.toComment(content) + " "; - } else { - return Template.toNormalComment(content) + " "; + let hooks = parserHooksMap.get(parser); + if (hooks === undefined) { + hooks = { + hotAcceptCallback: new SyncBailHook(["expression", "requests"]), + hotAcceptWithoutCallback: new SyncBailHook(["expression", "requests"]) + }; + parserHooksMap.set(parser, hooks); } + return hooks; } - /** - * @param {object} options generation options - * @param {string=} options.request request string used originally - * @returns {string} generated error block - */ - throwMissingModuleErrorBlock({ request }) { - const err = `Cannot find module '${request}'`; - return `var e = new Error(${JSON.stringify( - err - )}); e.code = 'MODULE_NOT_FOUND'; throw e;`; + constructor(options) { + this.options = options || {}; } /** - * @param {object} options generation options - * @param {string=} options.request request string used originally - * @returns {string} generated error function + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - throwMissingModuleErrorFunction({ request }) { - return `function webpackMissingModule() { ${this.throwMissingModuleErrorBlock( - { request } - )} }`; - } + apply(compiler) { + const { _backCompat: backCompat } = compiler; + if (compiler.options.output.strictModuleErrorHandling === undefined) + compiler.options.output.strictModuleErrorHandling = true; + const runtimeRequirements = [RuntimeGlobals.module]; - /** - * @param {object} options generation options - * @param {string=} options.request request string used originally - * @returns {string} generated error IIFE - */ - missingModule({ request }) { - return `Object(${this.throwMissingModuleErrorFunction({ request })}())`; - } + const createAcceptHandler = (parser, ParamDependency) => { + const { hotAcceptCallback, hotAcceptWithoutCallback } = + HotModuleReplacementPlugin.getParserHooks(parser); - /** - * @param {object} options generation options - * @param {string=} options.request request string used originally - * @returns {string} generated error statement - */ - missingModuleStatement({ request }) { - return `${this.missingModule({ request })};\n`; - } + return expr => { + const module = parser.state.module; + const dep = new ConstDependency( + `${module.moduleArgument}.hot.accept`, + expr.callee.range, + runtimeRequirements + ); + dep.loc = expr.loc; + module.addPresentationalDependency(dep); + module.buildInfo.moduleConcatenationBailout = "Hot Module Replacement"; + if (expr.arguments.length >= 1) { + const arg = parser.evaluateExpression(expr.arguments[0]); + let params = []; + let requests = []; + if (arg.isString()) { + params = [arg]; + } else if (arg.isArray()) { + params = arg.items.filter(param => param.isString()); + } + if (params.length > 0) { + params.forEach((param, idx) => { + const request = param.string; + const dep = new ParamDependency(request, param.range); + dep.optional = true; + dep.loc = Object.create(expr.loc); + dep.loc.index = idx; + module.addDependency(dep); + requests.push(request); + }); + if (expr.arguments.length > 1) { + hotAcceptCallback.call(expr.arguments[1], requests); + for (let i = 1; i < expr.arguments.length; i++) { + parser.walkExpression(expr.arguments[i]); + } + return true; + } else { + hotAcceptWithoutCallback.call(expr, requests); + return true; + } + } + } + parser.walkExpressions(expr.arguments); + return true; + }; + }; - /** - * @param {object} options generation options - * @param {string=} options.request request string used originally - * @returns {string} generated error code - */ - missingModulePromise({ request }) { - return `Promise.resolve().then(${this.throwMissingModuleErrorFunction({ - request - })})`; - } + const createDeclineHandler = (parser, ParamDependency) => expr => { + const module = parser.state.module; + const dep = new ConstDependency( + `${module.moduleArgument}.hot.decline`, + expr.callee.range, + runtimeRequirements + ); + dep.loc = expr.loc; + module.addPresentationalDependency(dep); + module.buildInfo.moduleConcatenationBailout = "Hot Module Replacement"; + if (expr.arguments.length === 1) { + const arg = parser.evaluateExpression(expr.arguments[0]); + let params = []; + if (arg.isString()) { + params = [arg]; + } else if (arg.isArray()) { + params = arg.items.filter(param => param.isString()); + } + params.forEach((param, idx) => { + const dep = new ParamDependency(param.string, param.range); + dep.optional = true; + dep.loc = Object.create(expr.loc); + dep.loc.index = idx; + module.addDependency(dep); + }); + } + return true; + }; - /** - * @param {Object} options options object - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {Module} options.module the module - * @param {string} options.request the request that should be printed as comment - * @param {string=} options.idExpr expression to use as id expression - * @param {"expression" | "promise" | "statements"} options.type which kind of code should be returned - * @returns {string} the code - */ - weakError({ module, chunkGraph, request, idExpr, type }) { - const moduleId = chunkGraph.getModuleId(module); - const errorMessage = - moduleId === null - ? JSON.stringify("Module is not available (weak dependency)") - : idExpr - ? `"Module '" + ${idExpr} + "' is not available (weak dependency)"` - : JSON.stringify( - `Module '${moduleId}' is not available (weak dependency)` - ); - const comment = request ? Template.toNormalComment(request) + " " : ""; - const errorStatements = - `var e = new Error(${errorMessage}); ` + - comment + - "e.code = 'MODULE_NOT_FOUND'; throw e;"; - switch (type) { - case "statements": - return errorStatements; - case "promise": - return `Promise.resolve().then(${this.basicFunction( - "", - errorStatements - )})`; - case "expression": - return this.iife("", errorStatements); - } - } + const createHMRExpressionHandler = parser => expr => { + const module = parser.state.module; + const dep = new ConstDependency( + `${module.moduleArgument}.hot`, + expr.range, + runtimeRequirements + ); + dep.loc = expr.loc; + module.addPresentationalDependency(dep); + module.buildInfo.moduleConcatenationBailout = "Hot Module Replacement"; + return true; + }; + + const applyModuleHot = parser => { + parser.hooks.evaluateIdentifier.for("module.hot").tap( + { + name: "HotModuleReplacementPlugin", + before: "NodeStuffPlugin" + }, + expr => { + return evaluateToIdentifier( + "module.hot", + "module", + () => ["hot"], + true + )(expr); + } + ); + parser.hooks.call + .for("module.hot.accept") + .tap( + "HotModuleReplacementPlugin", + createAcceptHandler(parser, ModuleHotAcceptDependency) + ); + parser.hooks.call + .for("module.hot.decline") + .tap( + "HotModuleReplacementPlugin", + createDeclineHandler(parser, ModuleHotDeclineDependency) + ); + parser.hooks.expression + .for("module.hot") + .tap("HotModuleReplacementPlugin", createHMRExpressionHandler(parser)); + }; + + const applyImportMetaHot = parser => { + parser.hooks.evaluateIdentifier + .for("import.meta.webpackHot") + .tap("HotModuleReplacementPlugin", expr => { + return evaluateToIdentifier( + "import.meta.webpackHot", + "import.meta", + () => ["webpackHot"], + true + )(expr); + }); + parser.hooks.call + .for("import.meta.webpackHot.accept") + .tap( + "HotModuleReplacementPlugin", + createAcceptHandler(parser, ImportMetaHotAcceptDependency) + ); + parser.hooks.call + .for("import.meta.webpackHot.decline") + .tap( + "HotModuleReplacementPlugin", + createDeclineHandler(parser, ImportMetaHotDeclineDependency) + ); + parser.hooks.expression + .for("import.meta.webpackHot") + .tap("HotModuleReplacementPlugin", createHMRExpressionHandler(parser)); + }; + + compiler.hooks.compilation.tap( + "HotModuleReplacementPlugin", + (compilation, { normalModuleFactory }) => { + // This applies the HMR plugin only to the targeted compiler + // It should not affect child compilations + if (compilation.compiler !== compiler) return; + + //#region module.hot.* API + compilation.dependencyFactories.set( + ModuleHotAcceptDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + ModuleHotAcceptDependency, + new ModuleHotAcceptDependency.Template() + ); + compilation.dependencyFactories.set( + ModuleHotDeclineDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + ModuleHotDeclineDependency, + new ModuleHotDeclineDependency.Template() + ); + //#endregion + + //#region import.meta.webpackHot.* API + compilation.dependencyFactories.set( + ImportMetaHotAcceptDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + ImportMetaHotAcceptDependency, + new ImportMetaHotAcceptDependency.Template() + ); + compilation.dependencyFactories.set( + ImportMetaHotDeclineDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + ImportMetaHotDeclineDependency, + new ImportMetaHotDeclineDependency.Template() + ); + //#endregion + + let hotIndex = 0; + const fullHashChunkModuleHashes = {}; + const chunkModuleHashes = {}; + + compilation.hooks.record.tap( + "HotModuleReplacementPlugin", + (compilation, records) => { + if (records.hash === compilation.hash) return; + const chunkGraph = compilation.chunkGraph; + records.hash = compilation.hash; + records.hotIndex = hotIndex; + records.fullHashChunkModuleHashes = fullHashChunkModuleHashes; + records.chunkModuleHashes = chunkModuleHashes; + records.chunkHashes = {}; + records.chunkRuntime = {}; + for (const chunk of compilation.chunks) { + records.chunkHashes[chunk.id] = chunk.hash; + records.chunkRuntime[chunk.id] = getRuntimeKey(chunk.runtime); + } + records.chunkModuleIds = {}; + for (const chunk of compilation.chunks) { + records.chunkModuleIds[chunk.id] = Array.from( + chunkGraph.getOrderedChunkModulesIterable( + chunk, + compareModulesById(chunkGraph) + ), + m => chunkGraph.getModuleId(m) + ); + } + } + ); + /** @type {TupleSet<[Module, Chunk]>} */ + const updatedModules = new TupleSet(); + /** @type {TupleSet<[Module, Chunk]>} */ + const fullHashModules = new TupleSet(); + /** @type {TupleSet<[Module, RuntimeSpec]>} */ + const nonCodeGeneratedModules = new TupleSet(); + compilation.hooks.fullHash.tap("HotModuleReplacementPlugin", hash => { + const chunkGraph = compilation.chunkGraph; + const records = compilation.records; + for (const chunk of compilation.chunks) { + const getModuleHash = module => { + if ( + compilation.codeGenerationResults.has(module, chunk.runtime) + ) { + return compilation.codeGenerationResults.getHash( + module, + chunk.runtime + ); + } else { + nonCodeGeneratedModules.add(module, chunk.runtime); + return chunkGraph.getModuleHash(module, chunk.runtime); + } + }; + const fullHashModulesInThisChunk = + chunkGraph.getChunkFullHashModulesSet(chunk); + if (fullHashModulesInThisChunk !== undefined) { + for (const module of fullHashModulesInThisChunk) { + fullHashModules.add(module, chunk); + } + } + const modules = chunkGraph.getChunkModulesIterable(chunk); + if (modules !== undefined) { + if (records.chunkModuleHashes) { + if (fullHashModulesInThisChunk !== undefined) { + for (const module of modules) { + const key = `${chunk.id}|${module.identifier()}`; + const hash = getModuleHash(module); + if ( + fullHashModulesInThisChunk.has( + /** @type {RuntimeModule} */ (module) + ) + ) { + if (records.fullHashChunkModuleHashes[key] !== hash) { + updatedModules.add(module, chunk); + } + fullHashChunkModuleHashes[key] = hash; + } else { + if (records.chunkModuleHashes[key] !== hash) { + updatedModules.add(module, chunk); + } + chunkModuleHashes[key] = hash; + } + } + } else { + for (const module of modules) { + const key = `${chunk.id}|${module.identifier()}`; + const hash = getModuleHash(module); + if (records.chunkModuleHashes[key] !== hash) { + updatedModules.add(module, chunk); + } + chunkModuleHashes[key] = hash; + } + } + } else { + if (fullHashModulesInThisChunk !== undefined) { + for (const module of modules) { + const key = `${chunk.id}|${module.identifier()}`; + const hash = getModuleHash(module); + if ( + fullHashModulesInThisChunk.has( + /** @type {RuntimeModule} */ (module) + ) + ) { + fullHashChunkModuleHashes[key] = hash; + } else { + chunkModuleHashes[key] = hash; + } + } + } else { + for (const module of modules) { + const key = `${chunk.id}|${module.identifier()}`; + const hash = getModuleHash(module); + chunkModuleHashes[key] = hash; + } + } + } + } + } - /** - * @param {Object} options options object - * @param {Module} options.module the module - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {string} options.request the request that should be printed as comment - * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) - * @returns {string} the expression - */ - moduleId({ module, chunkGraph, request, weak }) { - if (!module) { - return this.missingModule({ - request - }); - } - const moduleId = chunkGraph.getModuleId(module); - if (moduleId === null) { - if (weak) { - return "null /* weak dependency, without id */"; - } - throw new Error( - `RuntimeTemplate.moduleId(): ${noModuleIdErrorMessage( - module, - chunkGraph - )}` - ); - } - return `${this.comment({ request })}${JSON.stringify(moduleId)}`; - } + hotIndex = records.hotIndex || 0; + if (updatedModules.size > 0) hotIndex++; - /** - * @param {Object} options options object - * @param {Module} options.module the module - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {string} options.request the request that should be printed as comment - * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @returns {string} the expression - */ - moduleRaw({ module, chunkGraph, request, weak, runtimeRequirements }) { - if (!module) { - return this.missingModule({ - request - }); - } - const moduleId = chunkGraph.getModuleId(module); - if (moduleId === null) { - if (weak) { - // only weak referenced modules don't get an id - // we can always emit an error emitting code here - return this.weakError({ - module, - chunkGraph, - request, - type: "expression" + hash.update(`${hotIndex}`); }); - } - throw new Error( - `RuntimeTemplate.moduleId(): ${noModuleIdErrorMessage( - module, - chunkGraph - )}` - ); - } - runtimeRequirements.add(RuntimeGlobals.require); - return `__webpack_require__(${this.moduleId({ - module, - chunkGraph, - request, - weak - })})`; - } + compilation.hooks.processAssets.tap( + { + name: "HotModuleReplacementPlugin", + stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL + }, + () => { + const chunkGraph = compilation.chunkGraph; + const records = compilation.records; + if (records.hash === compilation.hash) return; + if ( + !records.chunkModuleHashes || + !records.chunkHashes || + !records.chunkModuleIds + ) { + return; + } + for (const [module, chunk] of fullHashModules) { + const key = `${chunk.id}|${module.identifier()}`; + const hash = nonCodeGeneratedModules.has(module, chunk.runtime) + ? chunkGraph.getModuleHash(module, chunk.runtime) + : compilation.codeGenerationResults.getHash( + module, + chunk.runtime + ); + if (records.chunkModuleHashes[key] !== hash) { + updatedModules.add(module, chunk); + } + chunkModuleHashes[key] = hash; + } - /** - * @param {Object} options options object - * @param {Module} options.module the module - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {string} options.request the request that should be printed as comment - * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @returns {string} the expression - */ - moduleExports({ module, chunkGraph, request, weak, runtimeRequirements }) { - return this.moduleRaw({ - module, - chunkGraph, - request, - weak, - runtimeRequirements - }); - } + /** @type {Map, removedChunkIds: Set, removedModules: Set, filename: string, assetInfo: AssetInfo }>} */ + const hotUpdateMainContentByRuntime = new Map(); + let allOldRuntime; + for (const key of Object.keys(records.chunkRuntime)) { + const runtime = keyToRuntime(records.chunkRuntime[key]); + allOldRuntime = mergeRuntimeOwned(allOldRuntime, runtime); + } + forEachRuntime(allOldRuntime, runtime => { + const { path: filename, info: assetInfo } = + compilation.getPathWithInfo( + compilation.outputOptions.hotUpdateMainFilename, + { + hash: records.hash, + runtime + } + ); + hotUpdateMainContentByRuntime.set(runtime, { + updatedChunkIds: new Set(), + removedChunkIds: new Set(), + removedModules: new Set(), + filename, + assetInfo + }); + }); + if (hotUpdateMainContentByRuntime.size === 0) return; - /** - * @param {Object} options options object - * @param {Module} options.module the module - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {string} options.request the request that should be printed as comment - * @param {boolean=} options.strict if the current module is in strict esm mode - * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @returns {string} the expression - */ - moduleNamespace({ - module, - chunkGraph, - request, - strict, - weak, - runtimeRequirements - }) { - if (!module) { - return this.missingModule({ - request - }); - } - if (chunkGraph.getModuleId(module) === null) { - if (weak) { - // only weak referenced modules don't get an id - // we can always emit an error emitting code here - return this.weakError({ - module, - chunkGraph, - request, - type: "expression" - }); - } - throw new Error( - `RuntimeTemplate.moduleNamespace(): ${noModuleIdErrorMessage( - module, - chunkGraph - )}` - ); - } - const moduleId = this.moduleId({ - module, - chunkGraph, - request, - weak - }); - const exportsType = module.getExportsType(chunkGraph.moduleGraph, strict); - switch (exportsType) { - case "namespace": - return this.moduleRaw({ - module, - chunkGraph, - request, - weak, - runtimeRequirements - }); - case "default-with-named": - runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); - return `${RuntimeGlobals.createFakeNamespaceObject}(${moduleId}, 3)`; - case "default-only": - runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); - return `${RuntimeGlobals.createFakeNamespaceObject}(${moduleId}, 1)`; - case "dynamic": - runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); - return `${RuntimeGlobals.createFakeNamespaceObject}(${moduleId}, 7)`; - } - } + // Create a list of all active modules to verify which modules are removed completely + /** @type {Map} */ + const allModules = new Map(); + for (const module of compilation.modules) { + const id = chunkGraph.getModuleId(module); + allModules.set(id, module); + } - /** - * @param {Object} options options object - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {AsyncDependenciesBlock=} options.block the current dependencies block - * @param {Module} options.module the module - * @param {string} options.request the request that should be printed as comment - * @param {string} options.message a message for the comment - * @param {boolean=} options.strict if the current module is in strict esm mode - * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @returns {string} the promise expression - */ - moduleNamespacePromise({ - chunkGraph, - block, - module, - request, - message, - strict, - weak, - runtimeRequirements - }) { - if (!module) { - return this.missingModulePromise({ - request - }); - } - const moduleId = chunkGraph.getModuleId(module); - if (moduleId === null) { - if (weak) { - // only weak referenced modules don't get an id - // we can always emit an error emitting code here - return this.weakError({ - module, - chunkGraph, - request, - type: "promise" - }); - } - throw new Error( - `RuntimeTemplate.moduleNamespacePromise(): ${noModuleIdErrorMessage( - module, - chunkGraph - )}` - ); - } - const promise = this.blockPromise({ - chunkGraph, - block, - message, - runtimeRequirements - }); + // List of completely removed modules + /** @type {Set} */ + const completelyRemovedModules = new Set(); + + for (const key of Object.keys(records.chunkHashes)) { + const oldRuntime = keyToRuntime(records.chunkRuntime[key]); + /** @type {Module[]} */ + const remainingModules = []; + // Check which modules are removed + for (const id of records.chunkModuleIds[key]) { + const module = allModules.get(id); + if (module === undefined) { + completelyRemovedModules.add(id); + } else { + remainingModules.push(module); + } + } + + let chunkId; + let newModules; + let newRuntimeModules; + let newFullHashModules; + let newDependentHashModules; + let newRuntime; + let removedFromRuntime; + const currentChunk = find( + compilation.chunks, + chunk => `${chunk.id}` === key + ); + if (currentChunk) { + chunkId = currentChunk.id; + newRuntime = intersectRuntime( + currentChunk.runtime, + allOldRuntime + ); + if (newRuntime === undefined) continue; + newModules = chunkGraph + .getChunkModules(currentChunk) + .filter(module => updatedModules.has(module, currentChunk)); + newRuntimeModules = Array.from( + chunkGraph.getChunkRuntimeModulesIterable(currentChunk) + ).filter(module => updatedModules.has(module, currentChunk)); + const fullHashModules = + chunkGraph.getChunkFullHashModulesIterable(currentChunk); + newFullHashModules = + fullHashModules && + Array.from(fullHashModules).filter(module => + updatedModules.has(module, currentChunk) + ); + const dependentHashModules = + chunkGraph.getChunkDependentHashModulesIterable(currentChunk); + newDependentHashModules = + dependentHashModules && + Array.from(dependentHashModules).filter(module => + updatedModules.has(module, currentChunk) + ); + removedFromRuntime = subtractRuntime(oldRuntime, newRuntime); + } else { + // chunk has completely removed + chunkId = `${+key}` === key ? +key : key; + removedFromRuntime = oldRuntime; + newRuntime = oldRuntime; + } + if (removedFromRuntime) { + // chunk was removed from some runtimes + forEachRuntime(removedFromRuntime, runtime => { + hotUpdateMainContentByRuntime + .get(runtime) + .removedChunkIds.add(chunkId); + }); + // dispose modules from the chunk in these runtimes + // where they are no longer in this runtime + for (const module of remainingModules) { + const moduleKey = `${key}|${module.identifier()}`; + const oldHash = records.chunkModuleHashes[moduleKey]; + const runtimes = chunkGraph.getModuleRuntimes(module); + if (oldRuntime === newRuntime && runtimes.has(newRuntime)) { + // Module is still in the same runtime combination + const hash = nonCodeGeneratedModules.has(module, newRuntime) + ? chunkGraph.getModuleHash(module, newRuntime) + : compilation.codeGenerationResults.getHash( + module, + newRuntime + ); + if (hash !== oldHash) { + if (module.type === "runtime") { + newRuntimeModules = newRuntimeModules || []; + newRuntimeModules.push( + /** @type {RuntimeModule} */ (module) + ); + } else { + newModules = newModules || []; + newModules.push(module); + } + } + } else { + // module is no longer in this runtime combination + // We (incorrectly) assume that it's not in an overlapping runtime combination + // and dispose it from the main runtimes the chunk was removed from + forEachRuntime(removedFromRuntime, runtime => { + // If the module is still used in this runtime, do not dispose it + // This could create a bad runtime state where the module is still loaded, + // but no chunk which contains it. This means we don't receive further HMR updates + // to this module and that's bad. + // TODO force load one of the chunks which contains the module + for (const moduleRuntime of runtimes) { + if (typeof moduleRuntime === "string") { + if (moduleRuntime === runtime) return; + } else if (moduleRuntime !== undefined) { + if (moduleRuntime.has(runtime)) return; + } + } + hotUpdateMainContentByRuntime + .get(runtime) + .removedModules.add(module); + }); + } + } + } + if ( + (newModules && newModules.length > 0) || + (newRuntimeModules && newRuntimeModules.length > 0) + ) { + const hotUpdateChunk = new HotUpdateChunk(); + if (backCompat) + ChunkGraph.setChunkGraphForChunk(hotUpdateChunk, chunkGraph); + hotUpdateChunk.id = chunkId; + hotUpdateChunk.runtime = newRuntime; + if (currentChunk) { + for (const group of currentChunk.groupsIterable) + hotUpdateChunk.addGroup(group); + } + chunkGraph.attachModules(hotUpdateChunk, newModules || []); + chunkGraph.attachRuntimeModules( + hotUpdateChunk, + newRuntimeModules || [] + ); + if (newFullHashModules) { + chunkGraph.attachFullHashModules( + hotUpdateChunk, + newFullHashModules + ); + } + if (newDependentHashModules) { + chunkGraph.attachDependentHashModules( + hotUpdateChunk, + newDependentHashModules + ); + } + const renderManifest = compilation.getRenderManifest({ + chunk: hotUpdateChunk, + hash: records.hash, + fullHash: records.hash, + outputOptions: compilation.outputOptions, + moduleTemplates: compilation.moduleTemplates, + dependencyTemplates: compilation.dependencyTemplates, + codeGenerationResults: compilation.codeGenerationResults, + runtimeTemplate: compilation.runtimeTemplate, + moduleGraph: compilation.moduleGraph, + chunkGraph + }); + for (const entry of renderManifest) { + /** @type {string} */ + let filename; + /** @type {AssetInfo} */ + let assetInfo; + if ("filename" in entry) { + filename = entry.filename; + assetInfo = entry.info; + } else { + ({ path: filename, info: assetInfo } = + compilation.getPathWithInfo( + entry.filenameTemplate, + entry.pathOptions + )); + } + const source = entry.render(); + compilation.additionalChunkAssets.push(filename); + compilation.emitAsset(filename, source, { + hotModuleReplacement: true, + ...assetInfo + }); + if (currentChunk) { + currentChunk.files.add(filename); + compilation.hooks.chunkAsset.call(currentChunk, filename); + } + } + forEachRuntime(newRuntime, runtime => { + hotUpdateMainContentByRuntime + .get(runtime) + .updatedChunkIds.add(chunkId); + }); + } + } + const completelyRemovedModulesArray = Array.from( + completelyRemovedModules + ); + const hotUpdateMainContentByFilename = new Map(); + for (const { + removedChunkIds, + removedModules, + updatedChunkIds, + filename, + assetInfo + } of hotUpdateMainContentByRuntime.values()) { + const old = hotUpdateMainContentByFilename.get(filename); + if ( + old && + (!isSubset(old.removedChunkIds, removedChunkIds) || + !isSubset(old.removedModules, removedModules) || + !isSubset(old.updatedChunkIds, updatedChunkIds)) + ) { + compilation.warnings.push( + new WebpackError(`HotModuleReplacementPlugin +The configured output.hotUpdateMainFilename doesn't lead to unique filenames per runtime and HMR update differs between runtimes. +This might lead to incorrect runtime behavior of the applied update. +To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename option, or use the default config.`) + ); + for (const chunkId of removedChunkIds) + old.removedChunkIds.add(chunkId); + for (const chunkId of removedModules) + old.removedModules.add(chunkId); + for (const chunkId of updatedChunkIds) + old.updatedChunkIds.add(chunkId); + continue; + } + hotUpdateMainContentByFilename.set(filename, { + removedChunkIds, + removedModules, + updatedChunkIds, + assetInfo + }); + } + for (const [ + filename, + { removedChunkIds, removedModules, updatedChunkIds, assetInfo } + ] of hotUpdateMainContentByFilename) { + const hotUpdateMainJson = { + c: Array.from(updatedChunkIds), + r: Array.from(removedChunkIds), + m: + removedModules.size === 0 + ? completelyRemovedModulesArray + : completelyRemovedModulesArray.concat( + Array.from(removedModules, m => + chunkGraph.getModuleId(m) + ) + ) + }; - let appending; - let idExpr = JSON.stringify(chunkGraph.getModuleId(module)); - const comment = this.comment({ - request - }); - let header = ""; - if (weak) { - if (idExpr.length > 8) { - // 'var x="nnnnnn";x,"+x+",x' vs '"nnnnnn",nnnnnn,"nnnnnn"' - header += `var id = ${idExpr}; `; - idExpr = "id"; - } - runtimeRequirements.add(RuntimeGlobals.moduleFactories); - header += `if(!${ - RuntimeGlobals.moduleFactories - }[${idExpr}]) { ${this.weakError({ - module, - chunkGraph, - request, - idExpr, - type: "statements" - })} } `; - } - const moduleIdExpr = this.moduleId({ - module, - chunkGraph, - request, - weak - }); - const exportsType = module.getExportsType(chunkGraph.moduleGraph, strict); - let fakeType = 16; - switch (exportsType) { - case "namespace": - if (header) { - const rawModule = this.moduleRaw({ - module, - chunkGraph, - request, - weak, - runtimeRequirements - }); - appending = `.then(${this.basicFunction( - "", - `${header}return ${rawModule};` - )})`; - } else { - runtimeRequirements.add(RuntimeGlobals.require); - appending = `.then(__webpack_require__.bind(__webpack_require__, ${comment}${idExpr}))`; - } - break; - case "dynamic": - fakeType |= 4; - /* fall through */ - case "default-with-named": - fakeType |= 2; - /* fall through */ - case "default-only": - runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); - if (chunkGraph.moduleGraph.isAsync(module)) { - if (header) { - const rawModule = this.moduleRaw({ - module, - chunkGraph, - request, - weak, - runtimeRequirements - }); - appending = `.then(${this.basicFunction( - "", - `${header}return ${rawModule};` - )})`; - } else { - runtimeRequirements.add(RuntimeGlobals.require); - appending = `.then(__webpack_require__.bind(__webpack_require__, ${comment}${idExpr}))`; + const source = new RawSource(JSON.stringify(hotUpdateMainJson)); + compilation.emitAsset(filename, source, { + hotModuleReplacement: true, + ...assetInfo + }); + } } - appending += `.then(${this.returningFunction( - `${RuntimeGlobals.createFakeNamespaceObject}(m, ${fakeType})`, - "m" - )})`; - } else { - fakeType |= 1; - if (header) { - const returnExpression = `${RuntimeGlobals.createFakeNamespaceObject}(${moduleIdExpr}, ${fakeType})`; - appending = `.then(${this.basicFunction( - "", - `${header}return ${returnExpression};` - )})`; - } else { - appending = `.then(${RuntimeGlobals.createFakeNamespaceObject}.bind(__webpack_require__, ${comment}${idExpr}, ${fakeType}))`; + ); + + compilation.hooks.additionalTreeRuntimeRequirements.tap( + "HotModuleReplacementPlugin", + (chunk, runtimeRequirements) => { + runtimeRequirements.add(RuntimeGlobals.hmrDownloadManifest); + runtimeRequirements.add(RuntimeGlobals.hmrDownloadUpdateHandlers); + runtimeRequirements.add(RuntimeGlobals.interceptModuleExecution); + runtimeRequirements.add(RuntimeGlobals.moduleCache); + compilation.addRuntimeModule( + chunk, + new HotModuleReplacementRuntimeModule() + ); } - } - break; - } + ); - return `${promise || "Promise.resolve()"}${appending}`; - } + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("HotModuleReplacementPlugin", parser => { + applyModuleHot(parser); + applyImportMetaHot(parser); + }); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("HotModuleReplacementPlugin", parser => { + applyModuleHot(parser); + }); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("HotModuleReplacementPlugin", parser => { + applyImportMetaHot(parser); + }); - /** - * @param {Object} options options object - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {RuntimeSpec=} options.runtime runtime for which this code will be generated - * @param {RuntimeSpec | boolean=} options.runtimeCondition only execute the statement in some runtimes - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @returns {string} expression - */ - runtimeConditionExpression({ - chunkGraph, - runtimeCondition, - runtime, - runtimeRequirements - }) { - if (runtimeCondition === undefined) return "true"; - if (typeof runtimeCondition === "boolean") return `${runtimeCondition}`; - /** @type {Set} */ - const positiveRuntimeIds = new Set(); - forEachRuntime(runtimeCondition, runtime => - positiveRuntimeIds.add(`${chunkGraph.getRuntimeId(runtime)}`) - ); - /** @type {Set} */ - const negativeRuntimeIds = new Set(); - forEachRuntime(subtractRuntime(runtime, runtimeCondition), runtime => - negativeRuntimeIds.add(`${chunkGraph.getRuntimeId(runtime)}`) + NormalModule.getCompilationHooks(compilation).loader.tap( + "HotModuleReplacementPlugin", + context => { + context.hot = true; + } + ); + } ); - runtimeRequirements.add(RuntimeGlobals.runtimeId); - return compileBooleanMatcher.fromLists( - Array.from(positiveRuntimeIds), - Array.from(negativeRuntimeIds) - )(RuntimeGlobals.runtimeId); } +} - /** - * - * @param {Object} options options object - * @param {boolean=} options.update whether a new variable should be created or the existing one updated - * @param {Module} options.module the module - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {string} options.request the request that should be printed as comment - * @param {string} options.importVar name of the import variable - * @param {Module} options.originModule module in which the statement is emitted - * @param {boolean=} options.weak true, if this is a weak dependency - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @returns {[string, string]} the import statement and the compat statement - */ - importStatement({ - update, - module, - chunkGraph, - request, - importVar, - originModule, - weak, - runtimeRequirements - }) { - if (!module) { - return [ - this.missingModuleStatement({ - request - }), - "" - ]; - } - if (chunkGraph.getModuleId(module) === null) { - if (weak) { - // only weak referenced modules don't get an id - // we can always emit an error emitting code here - return [ - this.weakError({ - module, - chunkGraph, - request, - type: "statements" - }), - "" - ]; - } - throw new Error( - `RuntimeTemplate.importStatement(): ${noModuleIdErrorMessage( - module, - chunkGraph - )}` - ); - } - const moduleId = this.moduleId({ - module, - chunkGraph, - request, - weak - }); - const optDeclaration = update ? "" : "var "; - - const exportsType = module.getExportsType( - chunkGraph.moduleGraph, - originModule.buildMeta.strictHarmonyModule - ); - runtimeRequirements.add(RuntimeGlobals.require); - const importContent = `/* harmony import */ ${optDeclaration}${importVar} = __webpack_require__(${moduleId});\n`; +module.exports = HotModuleReplacementPlugin; - if (exportsType === "dynamic") { - runtimeRequirements.add(RuntimeGlobals.compatGetDefaultExport); - return [ - importContent, - `/* harmony import */ ${optDeclaration}${importVar}_default = /*#__PURE__*/${RuntimeGlobals.compatGetDefaultExport}(${importVar});\n` - ]; - } - return [importContent, ""]; - } - /** - * @param {Object} options options - * @param {ModuleGraph} options.moduleGraph the module graph - * @param {Module} options.module the module - * @param {string} options.request the request - * @param {string | string[]} options.exportName the export name - * @param {Module} options.originModule the origin module - * @param {boolean|undefined} options.asiSafe true, if location is safe for ASI, a bracket can be emitted - * @param {boolean} options.isCall true, if expression will be called - * @param {boolean} options.callContext when false, call context will not be preserved - * @param {boolean} options.defaultInterop when true and accessing the default exports, interop code will be generated - * @param {string} options.importVar the identifier name of the import variable - * @param {InitFragment[]} options.initFragments init fragments will be added here - * @param {RuntimeSpec} options.runtime runtime for which this code will be generated - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @returns {string} expression - */ - exportFromImport({ - moduleGraph, - module, - request, - exportName, - originModule, - asiSafe, - isCall, - callContext, - defaultInterop, - importVar, - initFragments, - runtime, - runtimeRequirements - }) { - if (!module) { - return this.missingModule({ - request - }); - } - if (!Array.isArray(exportName)) { - exportName = exportName ? [exportName] : []; - } - const exportsType = module.getExportsType( - moduleGraph, - originModule.buildMeta.strictHarmonyModule - ); +/***/ }), - if (defaultInterop) { - if (exportName.length > 0 && exportName[0] === "default") { - switch (exportsType) { - case "dynamic": - if (isCall) { - return `${importVar}_default()${propertyAccess(exportName, 1)}`; - } else { - return asiSafe - ? `(${importVar}_default()${propertyAccess(exportName, 1)})` - : asiSafe === false - ? `;(${importVar}_default()${propertyAccess(exportName, 1)})` - : `${importVar}_default.a${propertyAccess(exportName, 1)}`; - } - case "default-only": - case "default-with-named": - exportName = exportName.slice(1); - break; - } - } else if (exportName.length > 0) { - if (exportsType === "default-only") { - return ( - "/* non-default import from non-esm module */undefined" + - propertyAccess(exportName, 1) - ); - } else if ( - exportsType !== "namespace" && - exportName[0] === "__esModule" - ) { - return "/* __esModule */true"; - } - } else if ( - exportsType === "default-only" || - exportsType === "default-with-named" - ) { - runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); - initFragments.push( - new InitFragment( - `var ${importVar}_namespace_cache;\n`, - InitFragment.STAGE_CONSTANTS, - -1, - `${importVar}_namespace_cache` - ) - ); - return `/*#__PURE__*/ ${ - asiSafe ? "" : asiSafe === false ? ";" : "Object" - }(${importVar}_namespace_cache || (${importVar}_namespace_cache = ${ - RuntimeGlobals.createFakeNamespaceObject - }(${importVar}${exportsType === "default-only" ? "" : ", 2"})))`; - } - } +/***/ 9597: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (exportName.length > 0) { - const exportsInfo = moduleGraph.getExportsInfo(module); - const used = exportsInfo.getUsedName(exportName, runtime); - if (!used) { - const comment = Template.toNormalComment( - `unused export ${propertyAccess(exportName)}` - ); - return `${comment} undefined`; - } - const comment = equals(used, exportName) - ? "" - : Template.toNormalComment(propertyAccess(exportName)) + " "; - const access = `${importVar}${comment}${propertyAccess(used)}`; - if (isCall && callContext === false) { - return asiSafe - ? `(0,${access})` - : asiSafe === false - ? `;(0,${access})` - : `/*#__PURE__*/Object(${access})`; - } - return access; - } else { - return importVar; - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {Object} options options - * @param {AsyncDependenciesBlock} options.block the async block - * @param {string} options.message the message - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @returns {string} expression - */ - blockPromise({ block, message, chunkGraph, runtimeRequirements }) { - if (!block) { - const comment = this.comment({ - message - }); - return `Promise.resolve(${comment.trim()})`; - } - const chunkGroup = chunkGraph.getBlockChunkGroup(block); - if (!chunkGroup || chunkGroup.chunks.length === 0) { - const comment = this.comment({ - message - }); - return `Promise.resolve(${comment.trim()})`; - } - const chunks = chunkGroup.chunks.filter( - chunk => !chunk.hasRuntime() && chunk.id !== null - ); - const comment = this.comment({ - message, - chunkName: block.chunkName - }); - if (chunks.length === 1) { - const chunkId = JSON.stringify(chunks[0].id); - runtimeRequirements.add(RuntimeGlobals.ensureChunk); - return `${RuntimeGlobals.ensureChunk}(${comment}${chunkId})`; - } else if (chunks.length > 0) { - runtimeRequirements.add(RuntimeGlobals.ensureChunk); - const requireChunkId = chunk => - `${RuntimeGlobals.ensureChunk}(${JSON.stringify(chunk.id)})`; - return `Promise.all(${comment.trim()}[${chunks - .map(requireChunkId) - .join(", ")}])`; - } else { - return `Promise.resolve(${comment.trim()})`; - } - } - /** - * @param {Object} options options - * @param {AsyncDependenciesBlock} options.block the async block - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @param {string=} options.request request string used originally - * @returns {string} expression - */ - asyncModuleFactory({ block, chunkGraph, runtimeRequirements, request }) { - const dep = block.dependencies[0]; - const module = chunkGraph.moduleGraph.getModule(dep); - const ensureChunk = this.blockPromise({ - block, - message: "", - chunkGraph, - runtimeRequirements - }); - const factory = this.returningFunction( - this.moduleRaw({ - module, - chunkGraph, - request, - runtimeRequirements - }) - ); - return this.returningFunction( - ensureChunk.startsWith("Promise.resolve(") - ? `${factory}` - : `${ensureChunk}.then(${this.returningFunction(factory)})` - ); - } - /** - * @param {Object} options options - * @param {Dependency} options.dependency the dependency - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @param {string=} options.request request string used originally - * @returns {string} expression - */ - syncModuleFactory({ dependency, chunkGraph, runtimeRequirements, request }) { - const module = chunkGraph.moduleGraph.getModule(dependency); - const factory = this.returningFunction( - this.moduleRaw({ - module, - chunkGraph, - request, - runtimeRequirements - }) - ); - return this.returningFunction(factory); - } +const Chunk = __webpack_require__(39385); - /** - * @param {Object} options options - * @param {string} options.exportsArgument the name of the exports object - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @returns {string} statement - */ - defineEsModuleFlagStatement({ exportsArgument, runtimeRequirements }) { - runtimeRequirements.add(RuntimeGlobals.makeNamespaceObject); - runtimeRequirements.add(RuntimeGlobals.exports); - return `${RuntimeGlobals.makeNamespaceObject}(${exportsArgument});\n`; - } +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./util/Hash")} Hash */ - /** - * @param {Object} options options object - * @param {Module} options.module the module - * @param {string} options.publicPath the public path - * @param {RuntimeSpec=} options.runtime runtime - * @param {CodeGenerationResults} options.codeGenerationResults the code generation results - * @returns {string} the url of the asset - */ - assetUrl({ publicPath, runtime, module, codeGenerationResults }) { - if (!module) { - return "data:,"; - } - const codeGen = codeGenerationResults.get(module, runtime); - const { data } = codeGen; - const url = data.get("url"); - if (url) return url.toString(); - const filename = data.get("filename"); - return publicPath + filename; +class HotUpdateChunk extends Chunk { + constructor() { + super(); } } -module.exports = RuntimeTemplate; +module.exports = HotUpdateChunk; /***/ }), -/***/ 63560: -/***/ (function(module) { +/***/ 3: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ -class SelfModuleFactory { - constructor(moduleGraph) { - this.moduleGraph = moduleGraph; +const ModuleFactory = __webpack_require__(51010); + +/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ +/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ +/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ + +/** + * Ignores error when module is unresolved + */ +class IgnoreErrorModuleFactory extends ModuleFactory { + /** + * @param {NormalModuleFactory} normalModuleFactory normalModuleFactory instance + */ + constructor(normalModuleFactory) { + super(); + + this.normalModuleFactory = normalModuleFactory; } + /** + * @param {ModuleFactoryCreateData} data data object + * @param {function(Error=, ModuleFactoryResult=): void} callback callback + * @returns {void} + */ create(data, callback) { - const module = this.moduleGraph.getParentModule(data.dependencies[0]); - callback(null, { - module + this.normalModuleFactory.create(data, (err, result) => { + return callback(null, result); }); } } -module.exports = SelfModuleFactory; +module.exports = IgnoreErrorModuleFactory; /***/ }), -/***/ 48076: +/***/ 84808: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Sean Larkin @thelarkinn + Author Tobias Koppers @sokra */ -module.exports = __webpack_require__(96953); - +const createSchemaValidation = __webpack_require__(32540); -/***/ }), +/** @typedef {import("../declarations/plugins/IgnorePlugin").IgnorePluginOptions} IgnorePluginOptions */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./NormalModuleFactory").ResolveData} ResolveData */ -/***/ 71070: -/***/ (function(__unused_webpack_module, exports) { +const validate = createSchemaValidation( + __webpack_require__(20858), + () => __webpack_require__(3098), + { + name: "Ignore Plugin", + baseDataPath: "options" + } +); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sean Larkin @thelarkinn -*/ +class IgnorePlugin { + /** + * @param {IgnorePluginOptions} options IgnorePlugin options + */ + constructor(options) { + validate(options); + this.options = options; + /** @private @type {Function} */ + this.checkIgnore = this.checkIgnore.bind(this); + } + /** + * Note that if "contextRegExp" is given, both the "resourceRegExp" + * and "contextRegExp" have to match. + * + * @param {ResolveData} resolveData resolve data + * @returns {false|undefined} returns false when the request should be ignored, otherwise undefined + */ + checkIgnore(resolveData) { + if ( + "checkResource" in this.options && + this.options.checkResource && + this.options.checkResource(resolveData.request, resolveData.context) + ) { + return false; + } -/** - * @param {number} size the size in bytes - * @returns {string} the formatted size - */ -exports.formatSize = size => { - if (typeof size !== "number" || Number.isNaN(size) === true) { - return "unknown size"; + if ( + "resourceRegExp" in this.options && + this.options.resourceRegExp && + this.options.resourceRegExp.test(resolveData.request) + ) { + if ("contextRegExp" in this.options && this.options.contextRegExp) { + // if "contextRegExp" is given, + // both the "resourceRegExp" and "contextRegExp" have to match. + if (this.options.contextRegExp.test(resolveData.context)) { + return false; + } + } else { + return false; + } + } } - if (size <= 0) { - return "0 bytes"; + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.normalModuleFactory.tap("IgnorePlugin", nmf => { + nmf.hooks.beforeResolve.tap("IgnorePlugin", this.checkIgnore); + }); + compiler.hooks.contextModuleFactory.tap("IgnorePlugin", cmf => { + cmf.hooks.beforeResolve.tap("IgnorePlugin", this.checkIgnore); + }); } +} - const abbreviations = ["bytes", "KiB", "MiB", "GiB"]; - const index = Math.floor(Math.log(size) / Math.log(1024)); - - return `${+(size / Math.pow(1024, index)).toPrecision(3)} ${ - abbreviations[index] - }`; -}; +module.exports = IgnorePlugin; /***/ }), -/***/ 97513: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 41606: +/***/ (function(module) { "use strict"; /* @@ -54810,630 +49902,464 @@ exports.formatSize = size => { -const JavascriptModulesPlugin = __webpack_require__(89464); - -/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("../declarations/WebpackOptions").IgnoreWarningsNormalized} IgnoreWarningsNormalized */ +/** @typedef {import("./Compiler")} Compiler */ -class SourceMapDevToolModuleOptionsPlugin { - constructor(options) { - this.options = options; +class IgnoreWarningsPlugin { + /** + * @param {IgnoreWarningsNormalized} ignoreWarnings conditions to ignore warnings + */ + constructor(ignoreWarnings) { + this._ignoreWarnings = ignoreWarnings; } - /** - * @param {Compilation} compilation the compiler instance + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply(compilation) { - const options = this.options; - if (options.module !== false) { - compilation.hooks.buildModule.tap( - "SourceMapDevToolModuleOptionsPlugin", - module => { - module.useSourceMap = true; - } - ); - compilation.hooks.runtimeModule.tap( - "SourceMapDevToolModuleOptionsPlugin", - module => { - module.useSourceMap = true; - } - ); - } else { - compilation.hooks.buildModule.tap( - "SourceMapDevToolModuleOptionsPlugin", - module => { - module.useSimpleSourceMap = true; - } - ); - compilation.hooks.runtimeModule.tap( - "SourceMapDevToolModuleOptionsPlugin", - module => { - module.useSimpleSourceMap = true; + apply(compiler) { + compiler.hooks.compilation.tap("IgnoreWarningsPlugin", compilation => { + compilation.hooks.processWarnings.tap( + "IgnoreWarningsPlugin", + warnings => { + return warnings.filter(warning => { + return !this._ignoreWarnings.some(ignore => + ignore(warning, compilation) + ); + }); } ); - } - JavascriptModulesPlugin.getCompilationHooks(compilation).useSourceMap.tap( - "SourceMapDevToolModuleOptionsPlugin", - () => true - ); + }); } } -module.exports = SourceMapDevToolModuleOptionsPlugin; +module.exports = IgnoreWarningsPlugin; /***/ }), -/***/ 63872: +/***/ 55870: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Florent Cailhol @ooflorent */ -const asyncLib = __webpack_require__(78175); -const { ConcatSource, RawSource } = __webpack_require__(51255); -const Compilation = __webpack_require__(85720); -const ModuleFilenameHelpers = __webpack_require__(88821); -const ProgressPlugin = __webpack_require__(13216); -const SourceMapDevToolModuleOptionsPlugin = __webpack_require__(97513); -const createSchemaValidation = __webpack_require__(32540); -const createHash = __webpack_require__(49835); -const { relative, dirname } = __webpack_require__(17139); -const { makePathsAbsolute } = __webpack_require__(82186); +const { ConcatSource } = __webpack_require__(51255); +const makeSerializable = __webpack_require__(33032); -/** @typedef {import("webpack-sources").MapOptions} MapOptions */ /** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */ -/** @typedef {import("./Cache").Etag} Etag */ -/** @typedef {import("./CacheFacade").ItemCacheFacade} ItemCacheFacade */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./NormalModule").SourceMap} SourceMap */ -/** @typedef {import("./util/Hash")} Hash */ +/** @typedef {import("./Generator").GenerateContext} GenerateContext */ -const validate = createSchemaValidation( - __webpack_require__(2885), - () => __webpack_require__(30501), - { - name: "SourceMap DevTool Plugin", - baseDataPath: "options" - } -); /** - * @typedef {object} SourceMapTask - * @property {Source} asset - * @property {AssetInfo} assetInfo - * @property {(string | Module)[]} modules - * @property {string} source - * @property {string} file - * @property {SourceMap} sourceMap - * @property {ItemCacheFacade} cacheItem cache item + * @param {InitFragment} fragment the init fragment + * @param {number} index index + * @returns {[InitFragment, number]} tuple with both */ +const extractFragmentIndex = (fragment, index) => [fragment, index]; /** - * Escapes regular expression metacharacters - * @param {string} str String to quote - * @returns {string} Escaped string + * @param {[InitFragment, number]} a first pair + * @param {[InitFragment, number]} b second pair + * @returns {number} sort value */ -const quoteMeta = str => { - return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); +const sortFragmentWithIndex = ([a, i], [b, j]) => { + const stageCmp = a.stage - b.stage; + if (stageCmp !== 0) return stageCmp; + const positionCmp = a.position - b.position; + if (positionCmp !== 0) return positionCmp; + return i - j; }; /** - * Creating {@link SourceMapTask} for given file - * @param {string} file current compiled file - * @param {Source} asset the asset - * @param {AssetInfo} assetInfo the asset info - * @param {MapOptions} options source map options - * @param {Compilation} compilation compilation instance - * @param {ItemCacheFacade} cacheItem cache item - * @returns {SourceMapTask | undefined} created task instance or `undefined` + * @template Context */ -const getTaskForFile = ( - file, - asset, - assetInfo, - options, - compilation, - cacheItem -) => { - let source; - /** @type {SourceMap} */ - let sourceMap; +class InitFragment { /** - * Check if asset can build source map + * @param {string|Source} content the source code that will be included as initialization code + * @param {number} stage category of initialization code (contribute to order) + * @param {number} position position in the category (contribute to order) + * @param {string=} key unique key to avoid emitting the same initialization code twice + * @param {string|Source=} endContent the source code that will be included at the end of the module */ - if (asset.sourceAndMap) { - const sourceAndMap = asset.sourceAndMap(options); - sourceMap = /** @type {SourceMap} */ (sourceAndMap.map); - source = sourceAndMap.source; - } else { - sourceMap = /** @type {SourceMap} */ (asset.map(options)); - source = asset.source(); + constructor(content, stage, position, key, endContent) { + this.content = content; + this.stage = stage; + this.position = position; + this.key = key; + this.endContent = endContent; } - if (!sourceMap || typeof source !== "string") return; - const context = compilation.options.context; - const root = compilation.compiler.root; - const cachedAbsolutify = makePathsAbsolute.bindContextCache(context, root); - const modules = sourceMap.sources.map(source => { - if (!source.startsWith("webpack://")) return source; - source = cachedAbsolutify(source.slice(10)); - const module = compilation.findModule(source); - return module || source; - }); - - return { - file, - asset, - source, - assetInfo, - sourceMap, - modules, - cacheItem - }; -}; -class SourceMapDevToolPlugin { /** - * @param {SourceMapDevToolPluginOptions} [options] options object - * @throws {Error} throws error, if got more than 1 arguments + * @param {Context} context context + * @returns {string|Source} the source code that will be included as initialization code */ - constructor(options = {}) { - validate(options); - - /** @type {string | false} */ - this.sourceMapFilename = options.filename; - /** @type {string | false} */ - this.sourceMappingURLComment = - options.append === false - ? false - : options.append || "\n//# source" + "MappingURL=[url]"; - /** @type {string | Function} */ - this.moduleFilenameTemplate = - options.moduleFilenameTemplate || "webpack://[namespace]/[resourcePath]"; - /** @type {string | Function} */ - this.fallbackModuleFilenameTemplate = - options.fallbackModuleFilenameTemplate || - "webpack://[namespace]/[resourcePath]?[hash]"; - /** @type {string} */ - this.namespace = options.namespace || ""; - /** @type {SourceMapDevToolPluginOptions} */ - this.options = options; + getContent(context) { + return this.content; } /** - * Apply the plugin - * @param {Compiler} compiler compiler instance - * @returns {void} + * @param {Context} context context + * @returns {string|Source=} the source code that will be included at the end of the module */ - apply(compiler) { - const outputFs = compiler.outputFileSystem; - const sourceMapFilename = this.sourceMapFilename; - const sourceMappingURLComment = this.sourceMappingURLComment; - const moduleFilenameTemplate = this.moduleFilenameTemplate; - const namespace = this.namespace; - const fallbackModuleFilenameTemplate = this.fallbackModuleFilenameTemplate; - const requestShortener = compiler.requestShortener; - const options = this.options; - options.test = options.test || /\.((c|m)?js|css)($|\?)/i; + getEndContent(context) { + return this.endContent; + } - const matchObject = ModuleFilenameHelpers.matchObject.bind( - undefined, - options - ); + static addToSource(source, initFragments, context) { + if (initFragments.length > 0) { + // Sort fragments by position. If 2 fragments have the same position, + // use their index. + const sortedFragments = initFragments + .map(extractFragmentIndex) + .sort(sortFragmentWithIndex); - compiler.hooks.compilation.tap("SourceMapDevToolPlugin", compilation => { - new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation); + // Deduplicate fragments. If a fragment has no key, it is always included. + const keyedFragments = new Map(); + for (const [fragment] of sortedFragments) { + if (typeof fragment.mergeAll === "function") { + if (!fragment.key) { + throw new Error( + `InitFragment with mergeAll function must have a valid key: ${fragment.constructor.name}` + ); + } + const oldValue = keyedFragments.get(fragment.key); + if (oldValue === undefined) { + keyedFragments.set(fragment.key, fragment); + } else if (Array.isArray(oldValue)) { + oldValue.push(fragment); + } else { + keyedFragments.set(fragment.key, [oldValue, fragment]); + } + continue; + } else if (typeof fragment.merge === "function") { + const oldValue = keyedFragments.get(fragment.key); + if (oldValue !== undefined) { + keyedFragments.set(fragment.key, fragment.merge(oldValue)); + continue; + } + } + keyedFragments.set(fragment.key || Symbol(), fragment); + } - compilation.hooks.processAssets.tapAsync( - { - name: "SourceMapDevToolPlugin", - stage: Compilation.PROCESS_ASSETS_STAGE_DEV_TOOLING, - additionalAssets: true - }, - (assets, callback) => { - const chunkGraph = compilation.chunkGraph; - const cache = compilation.getCache("SourceMapDevToolPlugin"); - /** @type {Map} */ - const moduleToSourceNameMapping = new Map(); - /** - * @type {Function} - * @returns {void} - */ - const reportProgress = - ProgressPlugin.getReporter(compilation.compiler) || (() => {}); + const concatSource = new ConcatSource(); + const endContents = []; + for (let fragment of keyedFragments.values()) { + if (Array.isArray(fragment)) { + fragment = fragment[0].mergeAll(fragment); + } + concatSource.add(fragment.getContent(context)); + const endContent = fragment.getEndContent(context); + if (endContent) { + endContents.push(endContent); + } + } - /** @type {Map} */ - const fileToChunk = new Map(); - for (const chunk of compilation.chunks) { - for (const file of chunk.files) { - fileToChunk.set(file, chunk); - } - for (const file of chunk.auxiliaryFiles) { - fileToChunk.set(file, chunk); - } - } + concatSource.add(source); + for (const content of endContents.reverse()) { + concatSource.add(content); + } + return concatSource; + } else { + return source; + } + } + + serialize(context) { + const { write } = context; + + write(this.content); + write(this.stage); + write(this.position); + write(this.key); + write(this.endContent); + } + + deserialize(context) { + const { read } = context; + + this.content = read(); + this.stage = read(); + this.position = read(); + this.key = read(); + this.endContent = read(); + } +} + +makeSerializable(InitFragment, "webpack/lib/InitFragment"); + +InitFragment.prototype.merge = undefined; + +InitFragment.STAGE_CONSTANTS = 10; +InitFragment.STAGE_ASYNC_BOUNDARY = 20; +InitFragment.STAGE_HARMONY_EXPORTS = 30; +InitFragment.STAGE_HARMONY_IMPORTS = 40; +InitFragment.STAGE_PROVIDES = 50; +InitFragment.STAGE_ASYNC_DEPENDENCIES = 60; +InitFragment.STAGE_ASYNC_HARMONY_IMPORTS = 70; + +module.exports = InitFragment; + + +/***/ }), + +/***/ 68257: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); + +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Module")} Module */ - /** @type {string[]} */ - const files = []; - for (const file of Object.keys(assets)) { - if (matchObject(file)) { - files.push(file); - } - } +class InvalidDependenciesModuleWarning extends WebpackError { + /** + * @param {Module} module module tied to dependency + * @param {Iterable} deps invalid dependencies + */ + constructor(module, deps) { + const orderedDeps = deps ? Array.from(deps).sort() : []; + const depsList = orderedDeps.map(dep => ` * ${JSON.stringify(dep)}`); + super(`Invalid dependencies have been reported by plugins or loaders for this module. All reported dependencies need to be absolute paths. +Invalid dependencies may lead to broken watching and caching. +As best effort we try to convert all invalid values to absolute paths and converting globs into context dependencies, but this is deprecated behavior. +Loaders: Pass absolute paths to this.addDependency (existing files), this.addMissingDependency (not existing files), and this.addContextDependency (directories). +Plugins: Pass absolute paths to fileDependencies (existing files), missingDependencies (not existing files), and contextDependencies (directories). +Globs: They are not supported. Pass absolute path to the directory as context dependencies. +The following invalid values have been reported: +${depsList.slice(0, 3).join("\n")}${ + depsList.length > 3 ? "\n * and more ..." : "" + }`); - reportProgress(0.0); - /** @type {SourceMapTask[]} */ - const tasks = []; - let fileIndex = 0; + this.name = "InvalidDependenciesModuleWarning"; + this.details = depsList.slice(3).join("\n"); + this.module = module; + } +} - asyncLib.each( - files, - (file, callback) => { - const asset = compilation.getAsset(file); - if (asset.info.related && asset.info.related.sourceMap) { - fileIndex++; - return callback(); - } - const cacheItem = cache.getItemCache( - file, - cache.mergeEtags( - cache.getLazyHashedEtag(asset.source), - namespace - ) - ); +makeSerializable( + InvalidDependenciesModuleWarning, + "webpack/lib/InvalidDependenciesModuleWarning" +); - cacheItem.get((err, cacheEntry) => { - if (err) { - return callback(err); - } - /** - * If presented in cache, reassigns assets. Cache assets already have source maps. - */ - if (cacheEntry) { - const { assets, assetsInfo } = cacheEntry; - for (const cachedFile of Object.keys(assets)) { - if (cachedFile === file) { - compilation.updateAsset( - cachedFile, - assets[cachedFile], - assetsInfo[cachedFile] - ); - } else { - compilation.emitAsset( - cachedFile, - assets[cachedFile], - assetsInfo[cachedFile] - ); - } - /** - * Add file to chunk, if not presented there - */ - if (cachedFile !== file) { - const chunk = fileToChunk.get(file); - if (chunk !== undefined) - chunk.auxiliaryFiles.add(cachedFile); - } - } +module.exports = InvalidDependenciesModuleWarning; - reportProgress( - (0.5 * ++fileIndex) / files.length, - file, - "restored cached SourceMap" - ); - return callback(); - } +/***/ }), - reportProgress( - (0.5 * fileIndex) / files.length, - file, - "generate SourceMap" - ); +/***/ 52329: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** @type {SourceMapTask | undefined} */ - const task = getTaskForFile( - file, - asset.source, - asset.info, - { - module: options.module, - columns: options.columns - }, - compilation, - cacheItem - ); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Sergey Melyukov @smelukov +*/ - if (task) { - const modules = task.modules; - for (let idx = 0; idx < modules.length; idx++) { - const module = modules[idx]; - if (!moduleToSourceNameMapping.get(module)) { - moduleToSourceNameMapping.set( - module, - ModuleFilenameHelpers.createFilename( - module, - { - moduleFilenameTemplate: moduleFilenameTemplate, - namespace: namespace - }, - { - requestShortener, - chunkGraph, - hashFunction: compilation.outputOptions.hashFunction - } - ) - ); - } - } - tasks.push(task); - } +const InnerGraph = __webpack_require__(38988); - reportProgress( - (0.5 * ++fileIndex) / files.length, - file, - "generated SourceMap" - ); +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ - callback(); - }); - }, - err => { - if (err) { - return callback(err); +class JavascriptMetaInfoPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "JavascriptMetaInfoPlugin", + (compilation, { normalModuleFactory }) => { + /** + * @param {JavascriptParser} parser the parser + * @returns {void} + */ + const handler = parser => { + parser.hooks.call.for("eval").tap("JavascriptMetaInfoPlugin", () => { + parser.state.module.buildInfo.moduleConcatenationBailout = "eval()"; + parser.state.module.buildInfo.usingEval = true; + const currentSymbol = InnerGraph.getTopLevelSymbol(parser.state); + if (currentSymbol) { + InnerGraph.addUsage(parser.state, null, currentSymbol); + } else { + InnerGraph.bailout(parser.state); + } + }); + parser.hooks.finish.tap("JavascriptMetaInfoPlugin", () => { + let topLevelDeclarations = + parser.state.module.buildInfo.topLevelDeclarations; + if (topLevelDeclarations === undefined) { + topLevelDeclarations = + parser.state.module.buildInfo.topLevelDeclarations = new Set(); + } + for (const name of parser.scope.definitions.asSet()) { + const freeInfo = parser.getFreeInfoFromVariable(name); + if (freeInfo === undefined) { + topLevelDeclarations.add(name); } + } + }); + }; - reportProgress(0.5, "resolve sources"); - /** @type {Set} */ - const usedNamesSet = new Set(moduleToSourceNameMapping.values()); - /** @type {Set} */ - const conflictDetectionSet = new Set(); + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("JavascriptMetaInfoPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("JavascriptMetaInfoPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("JavascriptMetaInfoPlugin", handler); + } + ); + } +} - /** - * all modules in defined order (longest identifier first) - * @type {Array} - */ - const allModules = Array.from( - moduleToSourceNameMapping.keys() - ).sort((a, b) => { - const ai = typeof a === "string" ? a : a.identifier(); - const bi = typeof b === "string" ? b : b.identifier(); - return ai.length - bi.length; - }); +module.exports = JavascriptMetaInfoPlugin; - // find modules with conflicting source names - for (let idx = 0; idx < allModules.length; idx++) { - const module = allModules[idx]; - let sourceName = moduleToSourceNameMapping.get(module); - let hasName = conflictDetectionSet.has(sourceName); - if (!hasName) { - conflictDetectionSet.add(sourceName); - continue; - } - // try the fallback name first - sourceName = ModuleFilenameHelpers.createFilename( - module, - { - moduleFilenameTemplate: fallbackModuleFilenameTemplate, - namespace: namespace - }, - { - requestShortener, - chunkGraph, - hashFunction: compilation.outputOptions.hashFunction - } - ); - hasName = usedNamesSet.has(sourceName); - if (!hasName) { - moduleToSourceNameMapping.set(module, sourceName); - usedNamesSet.add(sourceName); - continue; - } +/***/ }), - // otherwise just append stars until we have a valid name - while (hasName) { - sourceName += "*"; - hasName = usedNamesSet.has(sourceName); - } - moduleToSourceNameMapping.set(module, sourceName); - usedNamesSet.add(sourceName); - } +/***/ 93837: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - let taskIndex = 0; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - asyncLib.each( - tasks, - (task, callback) => { - const assets = Object.create(null); - const assetsInfo = Object.create(null); - const file = task.file; - const chunk = fileToChunk.get(file); - const sourceMap = task.sourceMap; - const source = task.source; - const modules = task.modules; - reportProgress( - 0.5 + (0.5 * taskIndex) / tasks.length, - file, - "attach SourceMap" - ); - const moduleFilenames = modules.map(m => - moduleToSourceNameMapping.get(m) - ); - sourceMap.sources = moduleFilenames; - if (options.noSources) { - sourceMap.sourcesContent = undefined; - } - sourceMap.sourceRoot = options.sourceRoot || ""; - sourceMap.file = file; - const usesContentHash = - sourceMapFilename && - /\[contenthash(:\w+)?\]/.test(sourceMapFilename); +const asyncLib = __webpack_require__(78175); +const EntryDependency = __webpack_require__(3979); +const { someInIterable } = __webpack_require__(39104); +const { compareModulesById } = __webpack_require__(29579); +const { dirname, mkdirp } = __webpack_require__(17139); - // If SourceMap and asset uses contenthash, avoid a circular dependency by hiding hash in `file` - if (usesContentHash && task.assetInfo.contenthash) { - const contenthash = task.assetInfo.contenthash; - let pattern; - if (Array.isArray(contenthash)) { - pattern = contenthash.map(quoteMeta).join("|"); - } else { - pattern = quoteMeta(contenthash); - } - sourceMap.file = sourceMap.file.replace( - new RegExp(pattern, "g"), - m => "x".repeat(m.length) - ); - } +/** @typedef {import("./Compiler")} Compiler */ - /** @type {string | false} */ - let currentSourceMappingURLComment = sourceMappingURLComment; - if ( - currentSourceMappingURLComment !== false && - /\.css($|\?)/i.test(file) - ) { - currentSourceMappingURLComment = - currentSourceMappingURLComment.replace( - /^\n\/\/(.*)$/, - "\n/*$1*/" - ); - } - const sourceMapString = JSON.stringify(sourceMap); - if (sourceMapFilename) { - let filename = file; - const sourceMapContentHash = - usesContentHash && - /** @type {string} */ ( - createHash(compilation.outputOptions.hashFunction) - .update(sourceMapString) - .digest("hex") - ); - const pathParams = { - chunk, - filename: options.fileContext - ? relative( - outputFs, - `/${options.fileContext}`, - `/${filename}` - ) - : filename, - contentHash: sourceMapContentHash - }; - const { path: sourceMapFile, info: sourceMapInfo } = - compilation.getPathWithInfo( - sourceMapFilename, - pathParams - ); - const sourceMapUrl = options.publicPath - ? options.publicPath + sourceMapFile - : relative( - outputFs, - dirname(outputFs, `/${file}`), - `/${sourceMapFile}` - ); - /** @type {Source} */ - let asset = new RawSource(source); - if (currentSourceMappingURLComment !== false) { - // Add source map url to compilation asset, if currentSourceMappingURLComment is set - asset = new ConcatSource( - asset, - compilation.getPath( - currentSourceMappingURLComment, - Object.assign({ url: sourceMapUrl }, pathParams) - ) - ); - } - const assetInfo = { - related: { sourceMap: sourceMapFile } - }; - assets[file] = asset; - assetsInfo[file] = assetInfo; - compilation.updateAsset(file, asset, assetInfo); - // Add source map file to compilation assets and chunk files - const sourceMapAsset = new RawSource(sourceMapString); - const sourceMapAssetInfo = { - ...sourceMapInfo, - development: true - }; - assets[sourceMapFile] = sourceMapAsset; - assetsInfo[sourceMapFile] = sourceMapAssetInfo; - compilation.emitAsset( - sourceMapFile, - sourceMapAsset, - sourceMapAssetInfo - ); - if (chunk !== undefined) - chunk.auxiliaryFiles.add(sourceMapFile); - } else { - if (currentSourceMappingURLComment === false) { - throw new Error( - "SourceMapDevToolPlugin: append can't be false when no filename is provided" - ); - } - /** - * Add source map as data url to asset - */ - const asset = new ConcatSource( - new RawSource(source), - currentSourceMappingURLComment - .replace(/\[map\]/g, () => sourceMapString) - .replace( - /\[url\]/g, - () => - `data:application/json;charset=utf-8;base64,${Buffer.from( - sourceMapString, - "utf-8" - ).toString("base64")}` - ) - ); - assets[file] = asset; - assetsInfo[file] = undefined; - compilation.updateAsset(file, asset); - } +/** + * @typedef {Object} ManifestModuleData + * @property {string | number} id + * @property {Object} buildMeta + * @property {boolean | string[]} exports + */ - task.cacheItem.store({ assets, assetsInfo }, err => { - reportProgress( - 0.5 + (0.5 * ++taskIndex) / tasks.length, - task.file, - "attached SourceMap" - ); +class LibManifestPlugin { + constructor(options) { + this.options = options; + } - if (err) { - return callback(err); - } - callback(); - }); - }, - err => { - reportProgress(1.0); - callback(err); - } - ); + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.emit.tapAsync( + "LibManifestPlugin", + (compilation, callback) => { + const moduleGraph = compilation.moduleGraph; + asyncLib.forEach( + Array.from(compilation.chunks), + (chunk, callback) => { + if (!chunk.canBeInitial()) { + callback(); + return; } - ); - } - ); - }); + const chunkGraph = compilation.chunkGraph; + const targetPath = compilation.getPath(this.options.path, { + chunk + }); + const name = + this.options.name && + compilation.getPath(this.options.name, { + chunk + }); + const content = Object.create(null); + for (const module of chunkGraph.getOrderedChunkModulesIterable( + chunk, + compareModulesById(chunkGraph) + )) { + if ( + this.options.entryOnly && + !someInIterable( + moduleGraph.getIncomingConnections(module), + c => c.dependency instanceof EntryDependency + ) + ) { + continue; + } + const ident = module.libIdent({ + context: this.options.context || compiler.options.context, + associatedObjectForCache: compiler.root + }); + if (ident) { + const exportsInfo = moduleGraph.getExportsInfo(module); + const providedExports = exportsInfo.getProvidedExports(); + /** @type {ManifestModuleData} */ + const data = { + id: chunkGraph.getModuleId(module), + buildMeta: module.buildMeta, + exports: Array.isArray(providedExports) + ? providedExports + : undefined + }; + content[ident] = data; + } + } + const manifest = { + name, + type: this.options.type, + content + }; + // Apply formatting to content if format flag is true; + const manifestContent = this.options.format + ? JSON.stringify(manifest, null, 2) + : JSON.stringify(manifest); + const buffer = Buffer.from(manifestContent, "utf8"); + mkdirp( + compiler.intermediateFileSystem, + dirname(compiler.intermediateFileSystem, targetPath), + err => { + if (err) return callback(err); + compiler.intermediateFileSystem.writeFile( + targetPath, + buffer, + callback + ); + } + ); + }, + callback + ); + } + ); } } - -module.exports = SourceMapDevToolPlugin; +module.exports = LibManifestPlugin; /***/ }), -/***/ 31743: -/***/ (function(module) { +/***/ 14157: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -55443,88 +50369,513 @@ module.exports = SourceMapDevToolPlugin; -/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */ +const EnableLibraryPlugin = __webpack_require__(91452); -class Stats { +/** @typedef {import("../declarations/WebpackOptions").AuxiliaryComment} AuxiliaryComment */ +/** @typedef {import("../declarations/WebpackOptions").LibraryExport} LibraryExport */ +/** @typedef {import("../declarations/WebpackOptions").LibraryName} LibraryName */ +/** @typedef {import("../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../declarations/WebpackOptions").UmdNamedDefine} UmdNamedDefine */ +/** @typedef {import("./Compiler")} Compiler */ + +// TODO webpack 6 remove +class LibraryTemplatePlugin { /** - * @param {Compilation} compilation webpack compilation + * @param {LibraryName} name name of library + * @param {LibraryType} target type of library + * @param {UmdNamedDefine} umdNamedDefine setting this to true will name the UMD module + * @param {AuxiliaryComment} auxiliaryComment comment in the UMD wrapper + * @param {LibraryExport} exportProperty which export should be exposed as library */ - constructor(compilation) { - this.compilation = compilation; + constructor(name, target, umdNamedDefine, auxiliaryComment, exportProperty) { + this.library = { + type: target || "var", + name, + umdNamedDefine, + auxiliaryComment, + export: exportProperty + }; } - get hash() { - return this.compilation.hash; + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const { output } = compiler.options; + output.library = this.library; + new EnableLibraryPlugin(this.library.type).apply(compiler); } +} - get startTime() { - return this.compilation.startTime; - } +module.exports = LibraryTemplatePlugin; - get endTime() { - return this.compilation.endTime; + +/***/ }), + +/***/ 22078: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ModuleFilenameHelpers = __webpack_require__(88821); +const NormalModule = __webpack_require__(39); +const createSchemaValidation = __webpack_require__(32540); + +/** @typedef {import("../declarations/plugins/LoaderOptionsPlugin").LoaderOptionsPluginOptions} LoaderOptionsPluginOptions */ +/** @typedef {import("./Compiler")} Compiler */ + +const validate = createSchemaValidation( + __webpack_require__(24160), + () => __webpack_require__(15965), + { + name: "Loader Options Plugin", + baseDataPath: "options" + } +); +class LoaderOptionsPlugin { + /** + * @param {LoaderOptionsPluginOptions} options options object + */ + constructor(options = {}) { + validate(options); + if (typeof options !== "object") options = {}; + if (!options.test) { + options.test = { + test: () => true + }; + } + this.options = options; } /** - * @returns {boolean} true if the compilation had a warning + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - hasWarnings() { - return ( - this.compilation.warnings.length > 0 || - this.compilation.children.some(child => child.getStats().hasWarnings()) - ); + apply(compiler) { + const options = this.options; + compiler.hooks.compilation.tap("LoaderOptionsPlugin", compilation => { + NormalModule.getCompilationHooks(compilation).loader.tap( + "LoaderOptionsPlugin", + (context, module) => { + const resource = module.resource; + if (!resource) return; + const i = resource.indexOf("?"); + if ( + ModuleFilenameHelpers.matchObject( + options, + i < 0 ? resource : resource.substr(0, i) + ) + ) { + for (const key of Object.keys(options)) { + if (key === "include" || key === "exclude" || key === "test") { + continue; + } + context[key] = options[key]; + } + } + } + ); + }); } +} + +module.exports = LoaderOptionsPlugin; + +/***/ }), + +/***/ 86738: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const NormalModule = __webpack_require__(39); + +/** @typedef {import("./Compiler")} Compiler */ + +class LoaderTargetPlugin { /** - * @returns {boolean} true if the compilation encountered an error + * @param {string} target the target */ - hasErrors() { - return ( - this.compilation.errors.length > 0 || - this.compilation.children.some(child => child.getStats().hasErrors()) - ); + constructor(target) { + this.target = target; } /** - * @param {(string|StatsOptions)=} options stats options - * @returns {StatsCompilation} json output + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - toJson(options) { - options = this.compilation.createStatsOptions(options, { - forToString: false + apply(compiler) { + compiler.hooks.compilation.tap("LoaderTargetPlugin", compilation => { + NormalModule.getCompilationHooks(compilation).loader.tap( + "LoaderTargetPlugin", + loaderContext => { + loaderContext.target = this.target; + } + ); }); + } +} - const statsFactory = this.compilation.createStatsFactory(options); +module.exports = LoaderTargetPlugin; - return statsFactory.create("compilation", this.compilation, { - compilation: this.compilation - }); - } - toString(options) { - options = this.compilation.createStatsOptions(options, { - forToString: true +/***/ }), + +/***/ 12856: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { SyncWaterfallHook } = __webpack_require__(41242); +const util = __webpack_require__(73837); +const RuntimeGlobals = __webpack_require__(16475); +const memoize = __webpack_require__(78676); + +/** @typedef {import("webpack-sources").ConcatSource} ConcatSource */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").Output} OutputOptions */ +/** @typedef {import("./ModuleTemplate")} ModuleTemplate */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("./Module")} Module} */ +/** @typedef {import("./util/Hash")} Hash} */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates} */ +/** @typedef {import("./javascript/JavascriptModulesPlugin").RenderContext} RenderContext} */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate} */ +/** @typedef {import("./ModuleGraph")} ModuleGraph} */ +/** @typedef {import("./ChunkGraph")} ChunkGraph} */ +/** @typedef {import("./Template").RenderManifestOptions} RenderManifestOptions} */ +/** @typedef {import("./Template").RenderManifestEntry} RenderManifestEntry} */ + +const getJavascriptModulesPlugin = memoize(() => + __webpack_require__(89464) +); +const getJsonpTemplatePlugin = memoize(() => + __webpack_require__(4607) +); +const getLoadScriptRuntimeModule = memoize(() => + __webpack_require__(19942) +); + +// TODO webpack 6 remove this class +class MainTemplate { + /** + * + * @param {OutputOptions} outputOptions output options for the MainTemplate + * @param {Compilation} compilation the compilation + */ + constructor(outputOptions, compilation) { + /** @type {OutputOptions} */ + this._outputOptions = outputOptions || {}; + this.hooks = Object.freeze({ + renderManifest: { + tap: util.deprecate( + (options, fn) => { + compilation.hooks.renderManifest.tap( + options, + (entries, options) => { + if (!options.chunk.hasRuntime()) return entries; + return fn(entries, options); + } + ); + }, + "MainTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_RENDER_MANIFEST" + ) + }, + modules: { + tap: () => { + throw new Error( + "MainTemplate.hooks.modules has been removed (there is no replacement, please create an issue to request that)" + ); + } + }, + moduleObj: { + tap: () => { + throw new Error( + "MainTemplate.hooks.moduleObj has been removed (there is no replacement, please create an issue to request that)" + ); + } + }, + require: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .renderRequire.tap(options, fn); + }, + "MainTemplate.hooks.require is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderRequire instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_REQUIRE" + ) + }, + beforeStartup: { + tap: () => { + throw new Error( + "MainTemplate.hooks.beforeStartup has been removed (use RuntimeGlobals.startupOnlyBefore instead)" + ); + } + }, + startup: { + tap: () => { + throw new Error( + "MainTemplate.hooks.startup has been removed (use RuntimeGlobals.startup instead)" + ); + } + }, + afterStartup: { + tap: () => { + throw new Error( + "MainTemplate.hooks.afterStartup has been removed (use RuntimeGlobals.startupOnlyAfter instead)" + ); + } + }, + render: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .render.tap(options, (source, renderContext) => { + if ( + renderContext.chunkGraph.getNumberOfEntryModules( + renderContext.chunk + ) === 0 || + !renderContext.chunk.hasRuntime() + ) { + return source; + } + return fn( + source, + renderContext.chunk, + compilation.hash, + compilation.moduleTemplates.javascript, + compilation.dependencyTemplates + ); + }); + }, + "MainTemplate.hooks.render is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_RENDER" + ) + }, + renderWithEntry: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .render.tap(options, (source, renderContext) => { + if ( + renderContext.chunkGraph.getNumberOfEntryModules( + renderContext.chunk + ) === 0 || + !renderContext.chunk.hasRuntime() + ) { + return source; + } + return fn(source, renderContext.chunk, compilation.hash); + }); + }, + "MainTemplate.hooks.renderWithEntry is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_RENDER_WITH_ENTRY" + ) + }, + assetPath: { + tap: util.deprecate( + (options, fn) => { + compilation.hooks.assetPath.tap(options, fn); + }, + "MainTemplate.hooks.assetPath is deprecated (use Compilation.hooks.assetPath instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_ASSET_PATH" + ), + call: util.deprecate( + (filename, options) => { + return compilation.getAssetPath(filename, options); + }, + "MainTemplate.hooks.assetPath is deprecated (use Compilation.hooks.assetPath instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_ASSET_PATH" + ) + }, + hash: { + tap: util.deprecate( + (options, fn) => { + compilation.hooks.fullHash.tap(options, fn); + }, + "MainTemplate.hooks.hash is deprecated (use Compilation.hooks.fullHash instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_HASH" + ) + }, + hashForChunk: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .chunkHash.tap(options, (chunk, hash) => { + if (!chunk.hasRuntime()) return; + return fn(hash, chunk); + }); + }, + "MainTemplate.hooks.hashForChunk is deprecated (use JavascriptModulesPlugin.getCompilationHooks().chunkHash instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK" + ) + }, + globalHashPaths: { + tap: util.deprecate( + () => {}, + "MainTemplate.hooks.globalHashPaths has been removed (it's no longer needed)", + "DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK" + ) + }, + globalHash: { + tap: util.deprecate( + () => {}, + "MainTemplate.hooks.globalHash has been removed (it's no longer needed)", + "DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK" + ) + }, + hotBootstrap: { + tap: () => { + throw new Error( + "MainTemplate.hooks.hotBootstrap has been removed (use your own RuntimeModule instead)" + ); + } + }, + + // for compatibility: + /** @type {SyncWaterfallHook<[string, Chunk, string, ModuleTemplate, DependencyTemplates]>} */ + bootstrap: new SyncWaterfallHook([ + "source", + "chunk", + "hash", + "moduleTemplate", + "dependencyTemplates" + ]), + /** @type {SyncWaterfallHook<[string, Chunk, string]>} */ + localVars: new SyncWaterfallHook(["source", "chunk", "hash"]), + /** @type {SyncWaterfallHook<[string, Chunk, string]>} */ + requireExtensions: new SyncWaterfallHook(["source", "chunk", "hash"]), + /** @type {SyncWaterfallHook<[string, Chunk, string, string]>} */ + requireEnsure: new SyncWaterfallHook([ + "source", + "chunk", + "hash", + "chunkIdExpression" + ]), + get jsonpScript() { + const hooks = + getLoadScriptRuntimeModule().getCompilationHooks(compilation); + return hooks.createScript; + }, + get linkPrefetch() { + const hooks = getJsonpTemplatePlugin().getCompilationHooks(compilation); + return hooks.linkPrefetch; + }, + get linkPreload() { + const hooks = getJsonpTemplatePlugin().getCompilationHooks(compilation); + return hooks.linkPreload; + } }); - const statsFactory = this.compilation.createStatsFactory(options); - const statsPrinter = this.compilation.createStatsPrinter(options); + this.renderCurrentHashCode = util.deprecate( + /** + * @deprecated + * @param {string} hash the hash + * @param {number=} length length of the hash + * @returns {string} generated code + */ (hash, length) => { + if (length) { + return `${RuntimeGlobals.getFullHash} ? ${ + RuntimeGlobals.getFullHash + }().slice(0, ${length}) : ${hash.slice(0, length)}`; + } + return `${RuntimeGlobals.getFullHash} ? ${RuntimeGlobals.getFullHash}() : ${hash}`; + }, + "MainTemplate.renderCurrentHashCode is deprecated (use RuntimeGlobals.getFullHash runtime function instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_RENDER_CURRENT_HASH_CODE" + ); + + this.getPublicPath = util.deprecate( + /** + * + * @param {object} options get public path options + * @returns {string} hook call + */ options => { + return compilation.getAssetPath( + compilation.outputOptions.publicPath, + options + ); + }, + "MainTemplate.getPublicPath is deprecated (use Compilation.getAssetPath(compilation.outputOptions.publicPath, options) instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_GET_PUBLIC_PATH" + ); + + this.getAssetPath = util.deprecate( + (path, options) => { + return compilation.getAssetPath(path, options); + }, + "MainTemplate.getAssetPath is deprecated (use Compilation.getAssetPath instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_GET_ASSET_PATH" + ); - const data = statsFactory.create("compilation", this.compilation, { - compilation: this.compilation - }); - const result = statsPrinter.print("compilation", data); - return result === undefined ? "" : result; + this.getAssetPathWithInfo = util.deprecate( + (path, options) => { + return compilation.getAssetPathWithInfo(path, options); + }, + "MainTemplate.getAssetPathWithInfo is deprecated (use Compilation.getAssetPath instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_GET_ASSET_PATH_WITH_INFO" + ); } } -module.exports = Stats; +Object.defineProperty(MainTemplate.prototype, "requireFn", { + get: util.deprecate( + () => "__webpack_require__", + 'MainTemplate.requireFn is deprecated (use "__webpack_require__")', + "DEP_WEBPACK_MAIN_TEMPLATE_REQUIRE_FN" + ) +}); + +Object.defineProperty(MainTemplate.prototype, "outputOptions", { + get: util.deprecate( + /** + * @this {MainTemplate} + * @returns {OutputOptions} output options + */ + function () { + return this._outputOptions; + }, + "MainTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_OUTPUT_OPTIONS" + ) +}); + +module.exports = MainTemplate; /***/ }), -/***/ 1626: +/***/ 73208: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -55535,922 +50886,1095 @@ module.exports = Stats; -const { ConcatSource, PrefixSource } = __webpack_require__(51255); +const util = __webpack_require__(73837); +const ChunkGraph = __webpack_require__(64971); +const DependenciesBlock = __webpack_require__(71040); +const ModuleGraph = __webpack_require__(99988); +const RuntimeGlobals = __webpack_require__(16475); +const { first } = __webpack_require__(93347); +const { compareChunksById } = __webpack_require__(29579); +const makeSerializable = __webpack_require__(33032); /** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").Output} OutputOptions */ +/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ /** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./ChunkGroup")} ChunkGroup */ /** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ -/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("./Compilation").PathData} PathData */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./ConcatenationScope")} ConcatenationScope */ +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ /** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./ModuleTemplate")} ModuleTemplate */ -/** @typedef {import("./RuntimeModule")} RuntimeModule */ +/** @typedef {import("./ExportsInfo").UsageStateType} UsageStateType */ +/** @typedef {import("./FileSystemInfo")} FileSystemInfo */ +/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */ -/** @typedef {import("./javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ +/** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./util/Hash")} Hash */ +/** @template T @typedef {import("./util/LazySet")} LazySet */ +/** @template T @typedef {import("./util/SortableSet")} SortableSet */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ -const START_LOWERCASE_ALPHABET_CODE = "a".charCodeAt(0); -const START_UPPERCASE_ALPHABET_CODE = "A".charCodeAt(0); -const DELTA_A_TO_Z = "z".charCodeAt(0) - START_LOWERCASE_ALPHABET_CODE + 1; -const NUMBER_OF_IDENTIFIER_START_CHARS = DELTA_A_TO_Z * 2 + 2; // a-z A-Z _ $ -const NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS = - NUMBER_OF_IDENTIFIER_START_CHARS + 10; // a-z A-Z _ $ 0-9 -const FUNCTION_CONTENT_REGEX = /^function\s?\(\)\s?\{\r?\n?|\r?\n?\}$/g; -const INDENT_MULTILINE_REGEX = /^\t/gm; -const LINE_SEPARATOR_REGEX = /\r?\n/g; -const IDENTIFIER_NAME_REPLACE_REGEX = /^([^a-zA-Z$_])/; -const IDENTIFIER_ALPHA_NUMERIC_NAME_REPLACE_REGEX = /[^a-zA-Z0-9$]+/g; -const COMMENT_END_REGEX = /\*\//g; -const PATH_NAME_NORMALIZE_REPLACE_REGEX = /[^a-zA-Z0-9_!§$()=\-^°]+/g; -const MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g; +/** + * @typedef {Object} SourceContext + * @property {DependencyTemplates} dependencyTemplates the dependency templates + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {RuntimeSpec} runtime the runtimes code should be generated for + * @property {string=} type the type of source that should be generated + */ /** - * @typedef {Object} RenderManifestOptions - * @property {Chunk} chunk the chunk used to render - * @property {string} hash - * @property {string} fullHash - * @property {OutputOptions} outputOptions - * @property {CodeGenerationResults} codeGenerationResults - * @property {{javascript: ModuleTemplate}} moduleTemplates - * @property {DependencyTemplates} dependencyTemplates - * @property {RuntimeTemplate} runtimeTemplate - * @property {ModuleGraph} moduleGraph - * @property {ChunkGraph} chunkGraph + * @typedef {Object} CodeGenerationContext + * @property {DependencyTemplates} dependencyTemplates the dependency templates + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {RuntimeSpec} runtime the runtimes code should be generated for + * @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules + * @property {CodeGenerationResults} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that) */ -/** @typedef {RenderManifestEntryTemplated | RenderManifestEntryStatic} RenderManifestEntry */ +/** + * @typedef {Object} ConcatenationBailoutReasonContext + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + */ /** - * @typedef {Object} RenderManifestEntryTemplated - * @property {function(): Source} render - * @property {string | function(PathData, AssetInfo=): string} filenameTemplate - * @property {PathData=} pathOptions - * @property {AssetInfo=} info - * @property {string} identifier - * @property {string=} hash - * @property {boolean=} auxiliary + * @typedef {Object} CodeGenerationResult + * @property {Map} sources the resulting sources for all source types + * @property {Map=} data the resulting data for all source types + * @property {ReadonlySet} runtimeRequirements the runtime requirements + * @property {string=} hash a hash of the code generation result (will be automatically calculated from sources and runtimeRequirements if not provided) */ /** - * @typedef {Object} RenderManifestEntryStatic - * @property {function(): Source} render - * @property {string} filename - * @property {AssetInfo} info - * @property {string} identifier - * @property {string=} hash - * @property {boolean=} auxiliary + * @typedef {Object} LibIdentOptions + * @property {string} context absolute context path to which lib ident is relative to + * @property {Object=} associatedObjectForCache object for caching */ /** - * @typedef {Object} HasId - * @property {number | string} id + * @typedef {Object} KnownBuildMeta + * @property {string=} moduleArgument + * @property {string=} exportsArgument + * @property {boolean=} strict + * @property {string=} moduleConcatenationBailout + * @property {("default" | "namespace" | "flagged" | "dynamic")=} exportsType + * @property {(false | "redirect" | "redirect-warn")=} defaultObject + * @property {boolean=} strictHarmonyModule + * @property {boolean=} async + * @property {boolean=} sideEffectFree */ /** - * @typedef {function(Module, number): boolean} ModuleFilterPredicate + * @typedef {Object} NeedBuildContext + * @property {Compilation} compilation + * @property {FileSystemInfo} fileSystemInfo + * @property {Map>} valueCacheVersions */ -class Template { +/** @typedef {KnownBuildMeta & Record} BuildMeta */ + +const EMPTY_RESOLVE_OPTIONS = {}; + +let debugId = 1000; + +const DEFAULT_TYPES_UNKNOWN = new Set(["unknown"]); +const DEFAULT_TYPES_JS = new Set(["javascript"]); + +const deprecatedNeedRebuild = util.deprecate( + (module, context) => { + return module.needRebuild( + context.fileSystemInfo.getDeprecatedFileTimestamps(), + context.fileSystemInfo.getDeprecatedContextTimestamps() + ); + }, + "Module.needRebuild is deprecated in favor of Module.needBuild", + "DEP_WEBPACK_MODULE_NEED_REBUILD" +); + +/** @typedef {(requestShortener: RequestShortener) => string} OptimizationBailoutFunction */ + +class Module extends DependenciesBlock { /** - * - * @param {Function} fn a runtime function (.runtime.js) "template" - * @returns {string} the updated and normalized function string + * @param {string} type the module type + * @param {string=} context an optional context + * @param {string=} layer an optional layer in which the module is */ - static getFunctionContent(fn) { - return fn - .toString() - .replace(FUNCTION_CONTENT_REGEX, "") - .replace(INDENT_MULTILINE_REGEX, "") - .replace(LINE_SEPARATOR_REGEX, "\n"); + constructor(type, context = null, layer = null) { + super(); + + /** @type {string} */ + this.type = type; + /** @type {string | null} */ + this.context = context; + /** @type {string | null} */ + this.layer = layer; + /** @type {boolean} */ + this.needId = true; + + // Unique Id + /** @type {number} */ + this.debugId = debugId++; + + // Info from Factory + /** @type {ResolveOptions} */ + this.resolveOptions = EMPTY_RESOLVE_OPTIONS; + /** @type {object | undefined} */ + this.factoryMeta = undefined; + // TODO refactor this -> options object filled from Factory + // TODO webpack 6: use an enum + /** @type {boolean} */ + this.useSourceMap = false; + /** @type {boolean} */ + this.useSimpleSourceMap = false; + + // Info from Build + /** @type {WebpackError[] | undefined} */ + this._warnings = undefined; + /** @type {WebpackError[] | undefined} */ + this._errors = undefined; + /** @type {BuildMeta} */ + this.buildMeta = undefined; + /** @type {Record} */ + this.buildInfo = undefined; + /** @type {Dependency[] | undefined} */ + this.presentationalDependencies = undefined; + /** @type {Dependency[] | undefined} */ + this.codeGenerationDependencies = undefined; } - /** - * @param {string} str the string converted to identifier - * @returns {string} created identifier - */ - static toIdentifier(str) { - if (typeof str !== "string") return ""; - return str - .replace(IDENTIFIER_NAME_REPLACE_REGEX, "_$1") - .replace(IDENTIFIER_ALPHA_NUMERIC_NAME_REPLACE_REGEX, "_"); + // TODO remove in webpack 6 + // BACKWARD-COMPAT START + get id() { + return ChunkGraph.getChunkGraphForModule( + this, + "Module.id", + "DEP_WEBPACK_MODULE_ID" + ).getModuleId(this); } - /** - * - * @param {string} str string to be converted to commented in bundle code - * @returns {string} returns a commented version of string - */ - static toComment(str) { - if (!str) return ""; - return `/*! ${str.replace(COMMENT_END_REGEX, "* /")} */`; + + set id(value) { + if (value === "") { + this.needId = false; + return; + } + ChunkGraph.getChunkGraphForModule( + this, + "Module.id", + "DEP_WEBPACK_MODULE_ID" + ).setModuleId(this, value); } /** - * - * @param {string} str string to be converted to "normal comment" - * @returns {string} returns a commented version of string + * @returns {string} the hash of the module */ - static toNormalComment(str) { - if (!str) return ""; - return `/* ${str.replace(COMMENT_END_REGEX, "* /")} */`; + get hash() { + return ChunkGraph.getChunkGraphForModule( + this, + "Module.hash", + "DEP_WEBPACK_MODULE_HASH" + ).getModuleHash(this, undefined); } /** - * @param {string} str string path to be normalized - * @returns {string} normalized bundle-safe path + * @returns {string} the shortened hash of the module */ - static toPath(str) { - if (typeof str !== "string") return ""; - return str - .replace(PATH_NAME_NORMALIZE_REPLACE_REGEX, "-") - .replace(MATCH_PADDED_HYPHENS_REPLACE_REGEX, ""); + get renderedHash() { + return ChunkGraph.getChunkGraphForModule( + this, + "Module.renderedHash", + "DEP_WEBPACK_MODULE_RENDERED_HASH" + ).getRenderedModuleHash(this, undefined); } - // map number to a single character a-z, A-Z or multiple characters if number is too big - /** - * @param {number} n number to convert to ident - * @returns {string} returns single character ident - */ - static numberToIdentifier(n) { - if (n >= NUMBER_OF_IDENTIFIER_START_CHARS) { - // use multiple letters - return ( - Template.numberToIdentifier(n % NUMBER_OF_IDENTIFIER_START_CHARS) + - Template.numberToIdentifierContinuation( - Math.floor(n / NUMBER_OF_IDENTIFIER_START_CHARS) - ) - ); - } + get profile() { + return ModuleGraph.getModuleGraphForModule( + this, + "Module.profile", + "DEP_WEBPACK_MODULE_PROFILE" + ).getProfile(this); + } - // lower case - if (n < DELTA_A_TO_Z) { - return String.fromCharCode(START_LOWERCASE_ALPHABET_CODE + n); - } - n -= DELTA_A_TO_Z; + set profile(value) { + ModuleGraph.getModuleGraphForModule( + this, + "Module.profile", + "DEP_WEBPACK_MODULE_PROFILE" + ).setProfile(this, value); + } - // upper case - if (n < DELTA_A_TO_Z) { - return String.fromCharCode(START_UPPERCASE_ALPHABET_CODE + n); - } + get index() { + return ModuleGraph.getModuleGraphForModule( + this, + "Module.index", + "DEP_WEBPACK_MODULE_INDEX" + ).getPreOrderIndex(this); + } - if (n === DELTA_A_TO_Z) return "_"; - return "$"; + set index(value) { + ModuleGraph.getModuleGraphForModule( + this, + "Module.index", + "DEP_WEBPACK_MODULE_INDEX" + ).setPreOrderIndex(this, value); } - /** - * @param {number} n number to convert to ident - * @returns {string} returns single character ident - */ - static numberToIdentifierContinuation(n) { - if (n >= NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS) { - // use multiple letters - return ( - Template.numberToIdentifierContinuation( - n % NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS - ) + - Template.numberToIdentifierContinuation( - Math.floor(n / NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS) - ) - ); - } + get index2() { + return ModuleGraph.getModuleGraphForModule( + this, + "Module.index2", + "DEP_WEBPACK_MODULE_INDEX2" + ).getPostOrderIndex(this); + } - // lower case - if (n < DELTA_A_TO_Z) { - return String.fromCharCode(START_LOWERCASE_ALPHABET_CODE + n); - } - n -= DELTA_A_TO_Z; + set index2(value) { + ModuleGraph.getModuleGraphForModule( + this, + "Module.index2", + "DEP_WEBPACK_MODULE_INDEX2" + ).setPostOrderIndex(this, value); + } - // upper case - if (n < DELTA_A_TO_Z) { - return String.fromCharCode(START_UPPERCASE_ALPHABET_CODE + n); - } - n -= DELTA_A_TO_Z; + get depth() { + return ModuleGraph.getModuleGraphForModule( + this, + "Module.depth", + "DEP_WEBPACK_MODULE_DEPTH" + ).getDepth(this); + } - // numbers - if (n < 10) { - return `${n}`; - } + set depth(value) { + ModuleGraph.getModuleGraphForModule( + this, + "Module.depth", + "DEP_WEBPACK_MODULE_DEPTH" + ).setDepth(this, value); + } - if (n === 10) return "_"; - return "$"; + get issuer() { + return ModuleGraph.getModuleGraphForModule( + this, + "Module.issuer", + "DEP_WEBPACK_MODULE_ISSUER" + ).getIssuer(this); + } + + set issuer(value) { + ModuleGraph.getModuleGraphForModule( + this, + "Module.issuer", + "DEP_WEBPACK_MODULE_ISSUER" + ).setIssuer(this, value); + } + + get usedExports() { + return ModuleGraph.getModuleGraphForModule( + this, + "Module.usedExports", + "DEP_WEBPACK_MODULE_USED_EXPORTS" + ).getUsedExports(this, undefined); } /** - * - * @param {string | string[]} s string to convert to identity - * @returns {string} converted identity + * @deprecated + * @returns {(string | OptimizationBailoutFunction)[]} list */ - static indent(s) { - if (Array.isArray(s)) { - return s.map(Template.indent).join("\n"); - } else { - const str = s.trimRight(); - if (!str) return ""; - const ind = str[0] === "\n" ? "" : "\t"; - return ind + str.replace(/\n([^\n])/g, "\n\t$1"); - } + get optimizationBailout() { + return ModuleGraph.getModuleGraphForModule( + this, + "Module.optimizationBailout", + "DEP_WEBPACK_MODULE_OPTIMIZATION_BAILOUT" + ).getOptimizationBailout(this); + } + + get optional() { + return this.isOptional( + ModuleGraph.getModuleGraphForModule( + this, + "Module.optional", + "DEP_WEBPACK_MODULE_OPTIONAL" + ) + ); + } + + addChunk(chunk) { + const chunkGraph = ChunkGraph.getChunkGraphForModule( + this, + "Module.addChunk", + "DEP_WEBPACK_MODULE_ADD_CHUNK" + ); + if (chunkGraph.isModuleInChunk(this, chunk)) return false; + chunkGraph.connectChunkAndModule(chunk, this); + return true; + } + + removeChunk(chunk) { + return ChunkGraph.getChunkGraphForModule( + this, + "Module.removeChunk", + "DEP_WEBPACK_MODULE_REMOVE_CHUNK" + ).disconnectChunkAndModule(chunk, this); + } + + isInChunk(chunk) { + return ChunkGraph.getChunkGraphForModule( + this, + "Module.isInChunk", + "DEP_WEBPACK_MODULE_IS_IN_CHUNK" + ).isModuleInChunk(this, chunk); + } + + isEntryModule() { + return ChunkGraph.getChunkGraphForModule( + this, + "Module.isEntryModule", + "DEP_WEBPACK_MODULE_IS_ENTRY_MODULE" + ).isEntryModule(this); + } + + getChunks() { + return ChunkGraph.getChunkGraphForModule( + this, + "Module.getChunks", + "DEP_WEBPACK_MODULE_GET_CHUNKS" + ).getModuleChunks(this); } - /** - * - * @param {string|string[]} s string to create prefix for - * @param {string} prefix prefix to compose - * @returns {string} returns new prefix string - */ - static prefix(s, prefix) { - const str = Template.asString(s).trim(); - if (!str) return ""; - const ind = str[0] === "\n" ? "" : prefix; - return ind + str.replace(/\n([^\n])/g, "\n" + prefix + "$1"); + getNumberOfChunks() { + return ChunkGraph.getChunkGraphForModule( + this, + "Module.getNumberOfChunks", + "DEP_WEBPACK_MODULE_GET_NUMBER_OF_CHUNKS" + ).getNumberOfModuleChunks(this); + } + + get chunksIterable() { + return ChunkGraph.getChunkGraphForModule( + this, + "Module.chunksIterable", + "DEP_WEBPACK_MODULE_CHUNKS_ITERABLE" + ).getOrderedModuleChunksIterable(this, compareChunksById); } /** - * - * @param {string|string[]} str string or string collection - * @returns {string} returns a single string from array + * @param {string} exportName a name of an export + * @returns {boolean | null} true, if the export is provided why the module. + * null, if it's unknown. + * false, if it's not provided. */ - static asString(str) { - if (Array.isArray(str)) { - return str.join("\n"); - } - return str; + isProvided(exportName) { + return ModuleGraph.getModuleGraphForModule( + this, + "Module.usedExports", + "DEP_WEBPACK_MODULE_USED_EXPORTS" + ).isExportProvided(this, exportName); } + // BACKWARD-COMPAT END /** - * @typedef {Object} WithId - * @property {string|number} id + * @returns {string} name of the exports argument */ + get exportsArgument() { + return (this.buildInfo && this.buildInfo.exportsArgument) || "exports"; + } /** - * @param {WithId[]} modules a collection of modules to get array bounds for - * @returns {[number, number] | false} returns the upper and lower array bounds - * or false if not every module has a number based id + * @returns {string} name of the module argument */ - static getModulesArrayBounds(modules) { - let maxId = -Infinity; - let minId = Infinity; - for (const module of modules) { - const moduleId = module.id; - if (typeof moduleId !== "number") return false; - if (maxId < moduleId) maxId = moduleId; - if (minId > moduleId) minId = moduleId; - } - if (minId < 16 + ("" + minId).length) { - // add minId x ',' instead of 'Array(minId).concat(…)' - minId = 0; - } - // start with -1 because the first module needs no comma - let objectOverhead = -1; - for (const module of modules) { - // module id + colon + comma - objectOverhead += `${module.id}`.length + 2; - } - // number of commas, or when starting non-zero the length of Array(minId).concat() - const arrayOverhead = minId === 0 ? maxId : 16 + `${minId}`.length + maxId; - return arrayOverhead < objectOverhead ? [minId, maxId] : false; + get moduleArgument() { + return (this.buildInfo && this.buildInfo.moduleArgument) || "module"; } /** - * @param {ChunkRenderContext} renderContext render context - * @param {Module[]} modules modules to render (should be ordered by identifier) - * @param {function(Module): Source} renderModule function to render a module - * @param {string=} prefix applying prefix strings - * @returns {Source} rendered chunk modules in a Source object + * @param {ModuleGraph} moduleGraph the module graph + * @param {boolean} strict the importing module is strict + * @returns {"namespace" | "default-only" | "default-with-named" | "dynamic"} export type + * "namespace": Exports is already a namespace object. namespace = exports. + * "dynamic": Check at runtime if __esModule is set. When set: namespace = { ...exports, default: exports }. When not set: namespace = { default: exports }. + * "default-only": Provide a namespace object with only default export. namespace = { default: exports } + * "default-with-named": Provide a namespace object with named and default export. namespace = { ...exports, default: exports } */ - static renderChunkModules(renderContext, modules, renderModule, prefix = "") { - const { chunkGraph } = renderContext; - var source = new ConcatSource(); - if (modules.length === 0) { - return null; - } - /** @type {{id: string|number, source: Source|string}[]} */ - const allModules = modules.map(module => { - return { - id: chunkGraph.getModuleId(module), - source: renderModule(module) || "false" - }; - }); - const bounds = Template.getModulesArrayBounds(allModules); - if (bounds) { - // Render a spare array - const minId = bounds[0]; - const maxId = bounds[1]; - if (minId !== 0) { - source.add(`Array(${minId}).concat(`); - } - source.add("[\n"); - /** @type {Map} */ - const modules = new Map(); - for (const module of allModules) { - modules.set(module.id, module); - } - for (let idx = minId; idx <= maxId; idx++) { - const module = modules.get(idx); - if (idx !== minId) { - source.add(",\n"); + getExportsType(moduleGraph, strict) { + switch (this.buildMeta && this.buildMeta.exportsType) { + case "flagged": + return strict ? "default-with-named" : "namespace"; + case "namespace": + return "namespace"; + case "default": + switch (this.buildMeta.defaultObject) { + case "redirect": + return "default-with-named"; + case "redirect-warn": + return strict ? "default-only" : "default-with-named"; + default: + return "default-only"; } - source.add(`/* ${idx} */`); - if (module) { - source.add("\n"); - source.add(module.source); + case "dynamic": { + if (strict) return "default-with-named"; + // Try to figure out value of __esModule by following reexports + const handleDefault = () => { + switch (this.buildMeta.defaultObject) { + case "redirect": + case "redirect-warn": + return "default-with-named"; + default: + return "default-only"; + } + }; + const exportInfo = moduleGraph.getReadOnlyExportInfo( + this, + "__esModule" + ); + if (exportInfo.provided === false) { + return handleDefault(); } - } - source.add("\n" + prefix + "]"); - if (minId !== 0) { - source.add(")"); - } - } else { - // Render an object - source.add("{\n"); - for (let i = 0; i < allModules.length; i++) { - const module = allModules[i]; - if (i !== 0) { - source.add(",\n"); + const target = exportInfo.getTarget(moduleGraph); + if ( + !target || + !target.export || + target.export.length !== 1 || + target.export[0] !== "__esModule" + ) { + return "dynamic"; + } + switch ( + target.module.buildMeta && + target.module.buildMeta.exportsType + ) { + case "flagged": + case "namespace": + return "namespace"; + case "default": + return handleDefault(); + default: + return "dynamic"; } - source.add(`\n/***/ ${JSON.stringify(module.id)}:\n`); - source.add(module.source); } - source.add(`\n\n${prefix}}`); + default: + return strict ? "default-with-named" : "dynamic"; } - return source; } /** - * @param {RuntimeModule[]} runtimeModules array of runtime modules in order - * @param {RenderContext & { codeGenerationResults?: CodeGenerationResults }} renderContext render context - * @returns {Source} rendered runtime modules in a Source object + * @param {Dependency} presentationalDependency dependency being tied to module. + * This is a Dependency without edge in the module graph. It's only for presentation. + * @returns {void} */ - static renderRuntimeModules(runtimeModules, renderContext) { - const source = new ConcatSource(); - for (const module of runtimeModules) { - const codeGenerationResults = renderContext.codeGenerationResults; - let runtimeSource; - if (codeGenerationResults) { - runtimeSource = codeGenerationResults.getSource( - module, - renderContext.chunk.runtime, - "runtime" - ); - } else { - const codeGenResult = module.codeGeneration({ - chunkGraph: renderContext.chunkGraph, - dependencyTemplates: renderContext.dependencyTemplates, - moduleGraph: renderContext.moduleGraph, - runtimeTemplate: renderContext.runtimeTemplate, - runtime: renderContext.chunk.runtime, - codeGenerationResults - }); - if (!codeGenResult) continue; - runtimeSource = codeGenResult.sources.get("runtime"); - } - if (runtimeSource) { - source.add(Template.toNormalComment(module.identifier()) + "\n"); - if (!module.shouldIsolate()) { - source.add(runtimeSource); - source.add("\n\n"); - } else if (renderContext.runtimeTemplate.supportsArrowFunction()) { - source.add("(() => {\n"); - source.add(new PrefixSource("\t", runtimeSource)); - source.add("\n})();\n\n"); - } else { - source.add("!function() {\n"); - source.add(new PrefixSource("\t", runtimeSource)); - source.add("\n}();\n\n"); - } - } + addPresentationalDependency(presentationalDependency) { + if (this.presentationalDependencies === undefined) { + this.presentationalDependencies = []; } - return source; + this.presentationalDependencies.push(presentationalDependency); } /** - * @param {RuntimeModule[]} runtimeModules array of runtime modules in order - * @param {RenderContext} renderContext render context - * @returns {Source} rendered chunk runtime modules in a Source object + * @param {Dependency} codeGenerationDependency dependency being tied to module. + * This is a Dependency where the code generation result of the referenced module is needed during code generation. + * The Dependency should also be added to normal dependencies via addDependency. + * @returns {void} */ - static renderChunkRuntimeModules(runtimeModules, renderContext) { - return new PrefixSource( - "/******/ ", - new ConcatSource( - "function(__webpack_require__) { // webpackRuntimeModules\n", - this.renderRuntimeModules(runtimeModules, renderContext), - "}\n" - ) - ); - } -} - -module.exports = Template; -module.exports.NUMBER_OF_IDENTIFIER_START_CHARS = - NUMBER_OF_IDENTIFIER_START_CHARS; -module.exports.NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS = - NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS; - - -/***/ }), - -/***/ 80734: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Jason Anderson @diurnalist -*/ - - - -const mime = __webpack_require__(78585); -const { basename, extname } = __webpack_require__(71017); -const util = __webpack_require__(73837); -const Chunk = __webpack_require__(39385); -const Module = __webpack_require__(73208); -const { parseResource } = __webpack_require__(82186); - -/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("./Compilation").PathData} PathData */ -/** @typedef {import("./Compiler")} Compiler */ - -const REGEXP = /\[\\*([\w:]+)\\*\]/gi; - -const prepareId = id => { - if (typeof id !== "string") return id; - - if (/^"\s\+*.*\+\s*"$/.test(id)) { - const match = /^"\s\+*\s*(.*)\s*\+\s*"$/.exec(id); - - return `" + (${match[1]} + "").replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_") + "`; + addCodeGenerationDependency(codeGenerationDependency) { + if (this.codeGenerationDependencies === undefined) { + this.codeGenerationDependencies = []; + } + this.codeGenerationDependencies.push(codeGenerationDependency); } - return id.replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_"); -}; - -const hashLength = (replacer, handler, assetInfo, hashName) => { - const fn = (match, arg, input) => { - let result; - const length = arg && parseInt(arg, 10); - - if (length && handler) { - result = handler(length); - } else { - const hash = replacer(match, arg, input); - - result = length ? hash.slice(0, length) : hash; - } - if (assetInfo) { - assetInfo.immutable = true; - if (Array.isArray(assetInfo[hashName])) { - assetInfo[hashName] = [...assetInfo[hashName], result]; - } else if (assetInfo[hashName]) { - assetInfo[hashName] = [assetInfo[hashName], result]; - } else { - assetInfo[hashName] = result; - } + /** + * Removes all dependencies and blocks + * @returns {void} + */ + clearDependenciesAndBlocks() { + if (this.presentationalDependencies !== undefined) { + this.presentationalDependencies.length = 0; } - return result; - }; - - return fn; -}; - -const replacer = (value, allowEmpty) => { - const fn = (match, arg, input) => { - if (typeof value === "function") { - value = value(); + if (this.codeGenerationDependencies !== undefined) { + this.codeGenerationDependencies.length = 0; } - if (value === null || value === undefined) { - if (!allowEmpty) { - throw new Error( - `Path variable ${match} not implemented in this context: ${input}` - ); - } + super.clearDependenciesAndBlocks(); + } - return ""; - } else { - return `${value}`; + /** + * @param {WebpackError} warning the warning + * @returns {void} + */ + addWarning(warning) { + if (this._warnings === undefined) { + this._warnings = []; } - }; - - return fn; -}; - -const deprecationCache = new Map(); -const deprecatedFunction = (() => () => {})(); -const deprecated = (fn, message, code) => { - let d = deprecationCache.get(message); - if (d === undefined) { - d = util.deprecate(deprecatedFunction, message, code); - deprecationCache.set(message, d); + this._warnings.push(warning); } - return (...args) => { - d(); - return fn(...args); - }; -}; - -/** - * @param {string | function(PathData, AssetInfo=): string} path the raw path - * @param {PathData} data context data - * @param {AssetInfo} assetInfo extra info about the asset (will be written to) - * @returns {string} the interpolated path - */ -const replacePathVariables = (path, data, assetInfo) => { - const chunkGraph = data.chunkGraph; - - /** @type {Map} */ - const replacements = new Map(); - - // Filename context - // - // Placeholders - // - // for /some/path/file.js?query#fragment: - // [file] - /some/path/file.js - // [query] - ?query - // [fragment] - #fragment - // [base] - file.js - // [path] - /some/path/ - // [name] - file - // [ext] - .js - if (typeof data.filename === "string") { - // check that filename is data uri - let match = data.filename.match(/^data:([^;,]+)/); - if (match) { - const ext = mime.extension(match[1]); - const emptyReplacer = replacer("", true); - replacements.set("file", emptyReplacer); - replacements.set("query", emptyReplacer); - replacements.set("fragment", emptyReplacer); - replacements.set("path", emptyReplacer); - replacements.set("base", emptyReplacer); - replacements.set("name", emptyReplacer); - replacements.set("ext", replacer(ext ? `.${ext}` : "", true)); - // Legacy - replacements.set( - "filebase", - deprecated( - emptyReplacer, - "[filebase] is now [base]", - "DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_FILENAME" - ) - ); - } else { - const { path: file, query, fragment } = parseResource(data.filename); + /** + * @returns {Iterable | undefined} list of warnings if any + */ + getWarnings() { + return this._warnings; + } - const ext = extname(file); - const base = basename(file); - const name = base.slice(0, base.length - ext.length); - const path = file.slice(0, file.length - base.length); + /** + * @returns {number} number of warnings + */ + getNumberOfWarnings() { + return this._warnings !== undefined ? this._warnings.length : 0; + } - replacements.set("file", replacer(file)); - replacements.set("query", replacer(query, true)); - replacements.set("fragment", replacer(fragment, true)); - replacements.set("path", replacer(path, true)); - replacements.set("base", replacer(base)); - replacements.set("name", replacer(name)); - replacements.set("ext", replacer(ext, true)); - // Legacy - replacements.set( - "filebase", - deprecated( - replacer(base), - "[filebase] is now [base]", - "DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_FILENAME" - ) - ); + /** + * @param {WebpackError} error the error + * @returns {void} + */ + addError(error) { + if (this._errors === undefined) { + this._errors = []; } + this._errors.push(error); } - // Compilation context - // - // Placeholders - // - // [fullhash] - data.hash (3a4b5c6e7f) - // - // Legacy Placeholders - // - // [hash] - data.hash (3a4b5c6e7f) - if (data.hash) { - const hashReplacer = hashLength( - replacer(data.hash), - data.hashWithLength, - assetInfo, - "fullhash" - ); - - replacements.set("fullhash", hashReplacer); - - // Legacy - replacements.set( - "hash", - deprecated( - hashReplacer, - "[hash] is now [fullhash] (also consider using [chunkhash] or [contenthash], see documentation for details)", - "DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_HASH" - ) - ); + /** + * @returns {Iterable | undefined} list of errors if any + */ + getErrors() { + return this._errors; } - // Chunk Context - // - // Placeholders - // - // [id] - chunk.id (0.js) - // [name] - chunk.name (app.js) - // [chunkhash] - chunk.hash (7823t4t4.js) - // [contenthash] - chunk.contentHash[type] (3256u3zg.js) - if (data.chunk) { - const chunk = data.chunk; + /** + * @returns {number} number of errors + */ + getNumberOfErrors() { + return this._errors !== undefined ? this._errors.length : 0; + } - const contentHashType = data.contentHashType; + /** + * removes all warnings and errors + * @returns {void} + */ + clearWarningsAndErrors() { + if (this._warnings !== undefined) { + this._warnings.length = 0; + } + if (this._errors !== undefined) { + this._errors.length = 0; + } + } - const idReplacer = replacer(chunk.id); - const nameReplacer = replacer(chunk.name || chunk.id); - const chunkhashReplacer = hashLength( - replacer(chunk instanceof Chunk ? chunk.renderedHash : chunk.hash), - "hashWithLength" in chunk ? chunk.hashWithLength : undefined, - assetInfo, - "chunkhash" - ); - const contenthashReplacer = hashLength( - replacer( - data.contentHash || - (contentHashType && - chunk.contentHash && - chunk.contentHash[contentHashType]) - ), - data.contentHashWithLength || - ("contentHashWithLength" in chunk && chunk.contentHashWithLength - ? chunk.contentHashWithLength[contentHashType] - : undefined), - assetInfo, - "contenthash" - ); + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {boolean} true, if the module is optional + */ + isOptional(moduleGraph) { + let hasConnections = false; + for (const r of moduleGraph.getIncomingConnections(this)) { + if ( + !r.dependency || + !r.dependency.optional || + !r.isTargetActive(undefined) + ) { + return false; + } + hasConnections = true; + } + return hasConnections; + } - replacements.set("id", idReplacer); - replacements.set("name", nameReplacer); - replacements.set("chunkhash", chunkhashReplacer); - replacements.set("contenthash", contenthashReplacer); + /** + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {Chunk} chunk a chunk + * @param {Chunk=} ignoreChunk chunk to be ignored + * @returns {boolean} true, if the module is accessible from "chunk" when ignoring "ignoreChunk" + */ + isAccessibleInChunk(chunkGraph, chunk, ignoreChunk) { + // Check if module is accessible in ALL chunk groups + for (const chunkGroup of chunk.groupsIterable) { + if (!this.isAccessibleInChunkGroup(chunkGraph, chunkGroup)) return false; + } + return true; } - // Module Context - // - // Placeholders - // - // [id] - module.id (2.png) - // [hash] - module.hash (6237543873.png) - // - // Legacy Placeholders - // - // [moduleid] - module.id (2.png) - // [modulehash] - module.hash (6237543873.png) - if (data.module) { - const module = data.module; + /** + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {ChunkGroup} chunkGroup a chunk group + * @param {Chunk=} ignoreChunk chunk to be ignored + * @returns {boolean} true, if the module is accessible from "chunkGroup" when ignoring "ignoreChunk" + */ + isAccessibleInChunkGroup(chunkGraph, chunkGroup, ignoreChunk) { + const queue = new Set([chunkGroup]); - const idReplacer = replacer(() => - prepareId( - module instanceof Module ? chunkGraph.getModuleId(module) : module.id - ) - ); - const moduleHashReplacer = hashLength( - replacer(() => - module instanceof Module - ? chunkGraph.getRenderedModuleHash(module, data.runtime) - : module.hash - ), - "hashWithLength" in module ? module.hashWithLength : undefined, - assetInfo, - "modulehash" - ); - const contentHashReplacer = hashLength( - replacer(data.contentHash), - undefined, - assetInfo, - "contenthash" - ); + // Check if module is accessible from all items of the queue + queueFor: for (const cg of queue) { + // 1. If module is in one of the chunks of the group we can continue checking the next items + // because it's accessible. + for (const chunk of cg.chunks) { + if (chunk !== ignoreChunk && chunkGraph.isModuleInChunk(this, chunk)) + continue queueFor; + } + // 2. If the chunk group is initial, we can break here because it's not accessible. + if (chunkGroup.isInitial()) return false; + // 3. Enqueue all parents because it must be accessible from ALL parents + for (const parent of chunkGroup.parentsIterable) queue.add(parent); + } + // When we processed through the whole list and we didn't bailout, the module is accessible + return true; + } - replacements.set("id", idReplacer); - replacements.set("modulehash", moduleHashReplacer); - replacements.set("contenthash", contentHashReplacer); - replacements.set( - "hash", - data.contentHash ? contentHashReplacer : moduleHashReplacer - ); - // Legacy - replacements.set( - "moduleid", - deprecated( - idReplacer, - "[moduleid] is now [id]", - "DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_MODULE_ID" - ) - ); + /** + * @param {Chunk} chunk a chunk + * @param {ModuleGraph} moduleGraph the module graph + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {boolean} true, if the module has any reason why "chunk" should be included + */ + hasReasonForChunk(chunk, moduleGraph, chunkGraph) { + // check for each reason if we need the chunk + for (const [ + fromModule, + connections + ] of moduleGraph.getIncomingConnectionsByOriginModule(this)) { + if (!connections.some(c => c.isTargetActive(chunk.runtime))) continue; + for (const originChunk of chunkGraph.getModuleChunksIterable( + fromModule + )) { + // return true if module this is not reachable from originChunk when ignoring chunk + if (!this.isAccessibleInChunk(chunkGraph, originChunk, chunk)) + return true; + } + } + return false; } - // Other things - if (data.url) { - replacements.set("url", replacer(data.url)); + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true if at least one other module depends on this module + */ + hasReasons(moduleGraph, runtime) { + for (const c of moduleGraph.getIncomingConnections(this)) { + if (c.isTargetActive(runtime)) return true; + } + return false; } - if (typeof data.runtime === "string") { - replacements.set( - "runtime", - replacer(() => prepareId(data.runtime)) + + /** + * @returns {string} for debugging + */ + toString() { + return `Module[${this.debugId}: ${this.identifier()}]`; + } + + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + callback( + null, + !this.buildMeta || + this.needRebuild === Module.prototype.needRebuild || + deprecatedNeedRebuild(this, context) ); - } else { - replacements.set("runtime", replacer("_")); } - if (typeof path === "function") { - path = path(data, assetInfo); + /** + * @deprecated Use needBuild instead + * @param {Map} fileTimestamps timestamps of files + * @param {Map} contextTimestamps timestamps of directories + * @returns {boolean} true, if the module needs a rebuild + */ + needRebuild(fileTimestamps, contextTimestamps) { + return true; } - path = path.replace(REGEXP, (match, content) => { - if (content.length + 2 === match.length) { - const contentMatch = /^(\w+)(?::(\w+))?$/.exec(content); - if (!contentMatch) return match; - const [, kind, arg] = contentMatch; - const replacer = replacements.get(kind); - if (replacer !== undefined) { - return replacer(match, arg, path); + /** + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash( + hash, + context = { + chunkGraph: ChunkGraph.getChunkGraphForModule( + this, + "Module.updateHash", + "DEP_WEBPACK_MODULE_UPDATE_HASH" + ), + runtime: undefined + } + ) { + const { chunkGraph, runtime } = context; + hash.update(chunkGraph.getModuleGraphHash(this, runtime)); + if (this.presentationalDependencies !== undefined) { + for (const dep of this.presentationalDependencies) { + dep.updateHash(hash, context); } - } else if (match.startsWith("[\\") && match.endsWith("\\]")) { - return `[${match.slice(2, -2)}]`; } - return match; - }); - - return path; -}; - -const plugin = "TemplatedPathPlugin"; + super.updateHash(hash, context); + } -class TemplatedPathPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap(plugin, compilation => { - compilation.hooks.assetPath.tap(plugin, replacePathVariables); - }); + invalidateBuild() { + // should be overridden to support this feature } -} - -module.exports = TemplatedPathPlugin; + /* istanbul ignore next */ + /** + * @abstract + * @returns {string} a unique identifier of the module + */ + identifier() { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); + } -/***/ }), + /* istanbul ignore next */ + /** + * @abstract + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); + } -/***/ 68099: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /* istanbul ignore next */ + /** + * @abstract + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ + /** + * @abstract + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + // Better override this method to return the correct types + if (this.source === Module.prototype.source) { + return DEFAULT_TYPES_UNKNOWN; + } else { + return DEFAULT_TYPES_JS; + } + } + /** + * @abstract + * @deprecated Use codeGeneration() instead + * @param {DependencyTemplates} dependencyTemplates the dependency templates + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @param {string=} type the type of source that should be generated + * @returns {Source} generated source + */ + source(dependencyTemplates, runtimeTemplate, type = "javascript") { + if (this.codeGeneration === Module.prototype.codeGeneration) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); + } + const chunkGraph = ChunkGraph.getChunkGraphForModule( + this, + "Module.source() is deprecated. Use Compilation.codeGenerationResults.getSource(module, runtime, type) instead", + "DEP_WEBPACK_MODULE_SOURCE" + ); + /** @type {CodeGenerationContext} */ + const codeGenContext = { + dependencyTemplates, + runtimeTemplate, + moduleGraph: chunkGraph.moduleGraph, + chunkGraph, + runtime: undefined, + codeGenerationResults: undefined + }; + const sources = this.codeGeneration(codeGenContext).sources; + return type ? sources.get(type) : sources.get(first(this.getSourceTypes())); + } + /* istanbul ignore next */ + /** + * @abstract + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); + } -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); + /** + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion + */ + libIdent(options) { + return null; + } -class UnhandledSchemeError extends WebpackError { /** - * @param {string} scheme scheme - * @param {string} resource resource + * @returns {string | null} absolute path which should be used for condition matching (usually the resource path) */ - constructor(scheme, resource) { - super( - `Reading from "${resource}" is not handled by plugins (Unhandled scheme).` + - '\nWebpack supports "data:" and "file:" URIs by default.' + - `\nYou may need an additional plugin to handle "${scheme}:" URIs.` - ); - this.file = resource; - this.name = "UnhandledSchemeError"; + nameForCondition() { + return null; } -} -makeSerializable( - UnhandledSchemeError, - "webpack/lib/UnhandledSchemeError", - "UnhandledSchemeError" -); + /** + * @param {ConcatenationBailoutReasonContext} context context + * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated + */ + getConcatenationBailoutReason(context) { + return `Module Concatenation is not implemented for ${this.constructor.name}`; + } -module.exports = UnhandledSchemeError; + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this module should be connected to referencing modules when consumed for side-effects only + */ + getSideEffectsConnectionState(moduleGraph) { + return true; + } + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration(context) { + // Best override this method + const sources = new Map(); + for (const type of this.getSourceTypes()) { + if (type !== "unknown") { + sources.set( + type, + this.source( + context.dependencyTemplates, + context.runtimeTemplate, + type + ) + ); + } + } + return { + sources, + runtimeRequirements: new Set([ + RuntimeGlobals.module, + RuntimeGlobals.exports, + RuntimeGlobals.require + ]) + }; + } -/***/ }), + /** + * @param {Chunk} chunk the chunk which condition should be checked + * @param {Compilation} compilation the compilation + * @returns {boolean} true, if the chunk is ok for the module + */ + chunkCondition(chunk, compilation) { + return true; + } -/***/ 42495: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + hasChunkCondition() { + return this.chunkCondition !== Module.prototype.chunkCondition; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * Assuming this module is in the cache. Update the (cached) module with + * the fresh module from the factory. Usually updates internal references + * and properties. + * @param {Module} module fresh module + * @returns {void} + */ + updateCacheModule(module) { + this.type = module.type; + this.layer = module.layer; + this.context = module.context; + this.factoryMeta = module.factoryMeta; + this.resolveOptions = module.resolveOptions; + } + /** + * Module should be unsafe cached. Get data that's needed for that. + * This data will be passed to restoreFromUnsafeCache later. + * @returns {object} cached data + */ + getUnsafeCacheData() { + return { + factoryMeta: this.factoryMeta, + resolveOptions: this.resolveOptions + }; + } + /** + * restore unsafe cache data + * @param {object} unsafeCacheData data from getUnsafeCacheData + * @param {NormalModuleFactory} normalModuleFactory the normal module factory handling the unsafe caching + */ + _restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory) { + this.factoryMeta = unsafeCacheData.factoryMeta; + this.resolveOptions = unsafeCacheData.resolveOptions; + } -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); + /** + * Assuming this module is in the cache. Remove internal references to allow freeing some memory. + */ + cleanupForCache() { + this.factoryMeta = undefined; + this.resolveOptions = undefined; + } -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ + /** + * @returns {Source | null} the original source for the module before webpack transformation + */ + originalSource() { + return null; + } -class UnsupportedFeatureWarning extends WebpackError { /** - * @param {string} message description of warning - * @param {DependencyLocation} loc location start and end positions of the module + * @param {LazySet} fileDependencies set where file dependencies are added to + * @param {LazySet} contextDependencies set where context dependencies are added to + * @param {LazySet} missingDependencies set where missing dependencies are added to + * @param {LazySet} buildDependencies set where build dependencies are added to */ - constructor(message, loc) { - super(message); + addCacheDependencies( + fileDependencies, + contextDependencies, + missingDependencies, + buildDependencies + ) {} - this.name = "UnsupportedFeatureWarning"; - this.loc = loc; - this.hideStack = true; + serialize(context) { + const { write } = context; + write(this.type); + write(this.layer); + write(this.context); + write(this.resolveOptions); + write(this.factoryMeta); + write(this.useSourceMap); + write(this.useSimpleSourceMap); + write( + this._warnings !== undefined && this._warnings.length === 0 + ? undefined + : this._warnings + ); + write( + this._errors !== undefined && this._errors.length === 0 + ? undefined + : this._errors + ); + write(this.buildMeta); + write(this.buildInfo); + write(this.presentationalDependencies); + write(this.codeGenerationDependencies); + super.serialize(context); } -} - -makeSerializable( - UnsupportedFeatureWarning, - "webpack/lib/UnsupportedFeatureWarning" -); - -module.exports = UnsupportedFeatureWarning; - - -/***/ }), - -/***/ 36803: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + deserialize(context) { + const { read } = context; + this.type = read(); + this.layer = read(); + this.context = read(); + this.resolveOptions = read(); + this.factoryMeta = read(); + this.useSourceMap = read(); + this.useSimpleSourceMap = read(); + this._warnings = read(); + this._errors = read(); + this.buildMeta = read(); + this.buildInfo = read(); + this.presentationalDependencies = read(); + this.codeGenerationDependencies = read(); + super.deserialize(context); + } +} +makeSerializable(Module, "webpack/lib/Module"); -const ConstDependency = __webpack_require__(76911); +// TODO remove in webpack 6 +Object.defineProperty(Module.prototype, "hasEqualsChunks", { + get() { + throw new Error( + "Module.hasEqualsChunks was renamed (use hasEqualChunks instead)" + ); + } +}); -/** @typedef {import("./Compiler")} Compiler */ +// TODO remove in webpack 6 +Object.defineProperty(Module.prototype, "isUsed", { + get() { + throw new Error( + "Module.isUsed was renamed (use getUsedName, isExportUsed or isModuleUsed instead)" + ); + } +}); -class UseStrictPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "UseStrictPlugin", - (compilation, { normalModuleFactory }) => { - const handler = parser => { - parser.hooks.program.tap("UseStrictPlugin", ast => { - const firstNode = ast.body[0]; - if ( - firstNode && - firstNode.type === "ExpressionStatement" && - firstNode.expression.type === "Literal" && - firstNode.expression.value === "use strict" - ) { - // Remove "use strict" expression. It will be added later by the renderer again. - // This is necessary in order to not break the strict mode when webpack prepends code. - // @see https://github.com/webpack/webpack/issues/1970 - const dep = new ConstDependency("", firstNode.range); - dep.loc = firstNode.loc; - parser.state.module.addPresentationalDependency(dep); - parser.state.module.buildInfo.strict = true; - } - }); - }; +// TODO remove in webpack 6 +Object.defineProperty(Module.prototype, "errors", { + get: util.deprecate( + /** + * @this {Module} + * @returns {WebpackError[]} array + */ + function () { + if (this._errors === undefined) { + this._errors = []; + } + return this._errors; + }, + "Module.errors was removed (use getErrors instead)", + "DEP_WEBPACK_MODULE_ERRORS" + ) +}); - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("UseStrictPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("UseStrictPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("UseStrictPlugin", handler); +// TODO remove in webpack 6 +Object.defineProperty(Module.prototype, "warnings", { + get: util.deprecate( + /** + * @this {Module} + * @returns {WebpackError[]} array + */ + function () { + if (this._warnings === undefined) { + this._warnings = []; } + return this._warnings; + }, + "Module.warnings was removed (use getWarnings instead)", + "DEP_WEBPACK_MODULE_WARNINGS" + ) +}); + +// TODO remove in webpack 6 +Object.defineProperty(Module.prototype, "used", { + get() { + throw new Error( + "Module.used was refactored (use ModuleGraph.getUsedExports instead)" + ); + }, + set(value) { + throw new Error( + "Module.used was refactored (use ModuleGraph.setUsedExports instead)" ); } -} +}); -module.exports = UseStrictPlugin; +module.exports = Module; /***/ }), -/***/ 56504: +/***/ 21305: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -56461,119 +51985,81 @@ module.exports = UseStrictPlugin; -const CaseSensitiveModulesWarning = __webpack_require__(77975); - -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Module")} Module */ +const { cutOffLoaderExecution } = __webpack_require__(59985); +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); -class WarnCaseSensitiveModulesPlugin { +class ModuleBuildError extends WebpackError { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {string | Error&any} err error thrown + * @param {{from?: string|null}} info additional info */ - apply(compiler) { - compiler.hooks.compilation.tap( - "WarnCaseSensitiveModulesPlugin", - compilation => { - compilation.hooks.seal.tap("WarnCaseSensitiveModulesPlugin", () => { - /** @type {Map>} */ - const moduleWithoutCase = new Map(); - for (const module of compilation.modules) { - const identifier = module.identifier(); - const lowerIdentifier = identifier.toLowerCase(); - let map = moduleWithoutCase.get(lowerIdentifier); - if (map === undefined) { - map = new Map(); - moduleWithoutCase.set(lowerIdentifier, map); - } - map.set(identifier, module); - } - for (const pair of moduleWithoutCase) { - const map = pair[1]; - if (map.size > 1) { - compilation.warnings.push( - new CaseSensitiveModulesWarning( - map.values(), - compilation.moduleGraph - ) - ); - } - } - }); - } - ); - } -} - -module.exports = WarnCaseSensitiveModulesPlugin; + constructor(err, { from = null } = {}) { + let message = "Module build failed"; + let details = undefined; + if (from) { + message += ` (from ${from}):\n`; + } else { + message += ": "; + } -/***/ }), + if (err !== null && typeof err === "object") { + if (typeof err.stack === "string" && err.stack) { + const stack = cutOffLoaderExecution(err.stack); -/***/ 76537: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (!err.hideStack) { + message += stack; + } else { + details = stack; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent -*/ + if (typeof err.message === "string" && err.message) { + message += err.message; + } else { + message += err; + } + } + } else if (typeof err.message === "string" && err.message) { + message += err.message; + } else { + message += String(err); + } + } else { + message += String(err); + } + super(message); + this.name = "ModuleBuildError"; + this.details = details; + this.error = err; + } -const WebpackError = __webpack_require__(53799); + serialize(context) { + const { write } = context; -/** @typedef {import("./Compiler")} Compiler */ + write(this.error); -class WarnDeprecatedOptionPlugin { - /** - * Create an instance of the plugin - * @param {string} option the target option - * @param {string | number} value the deprecated option value - * @param {string} suggestion the suggestion replacement - */ - constructor(option, value, suggestion) { - this.option = option; - this.value = value; - this.suggestion = suggestion; + super.serialize(context); } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - "WarnDeprecatedOptionPlugin", - compilation => { - compilation.warnings.push( - new DeprecatedOptionWarning(this.option, this.value, this.suggestion) - ); - } - ); - } -} + deserialize(context) { + const { read } = context; -class DeprecatedOptionWarning extends WebpackError { - constructor(option, value, suggestion) { - super(); + this.error = read(); - this.name = "DeprecatedOptionWarning"; - this.message = - "configuration\n" + - `The value '${value}' for option '${option}' is deprecated. ` + - `Use '${suggestion}' instead.`; + super.deserialize(context); } } -module.exports = WarnDeprecatedOptionPlugin; +makeSerializable(ModuleBuildError, "webpack/lib/ModuleBuildError"); + +module.exports = ModuleBuildError; /***/ }), -/***/ 25295: +/***/ 67409: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -56584,29 +52070,44 @@ module.exports = WarnDeprecatedOptionPlugin; -const NoModeWarning = __webpack_require__(80832); +const WebpackError = __webpack_require__(53799); -/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Module")} Module */ -class WarnNoModeSetPlugin { +class ModuleDependencyError extends WebpackError { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * Creates an instance of ModuleDependencyError. + * @param {Module} module module tied to dependency + * @param {Error} err error thrown + * @param {DependencyLocation} loc location of dependency */ - apply(compiler) { - compiler.hooks.thisCompilation.tap("WarnNoModeSetPlugin", compilation => { - compilation.warnings.push(new NoModeWarning()); - }); + constructor(module, err, loc) { + super(err.message); + + this.name = "ModuleDependencyError"; + this.details = + err && !(/** @type {any} */ (err).hideStack) + ? err.stack.split("\n").slice(1).join("\n") + : undefined; + this.module = module; + this.loc = loc; + /** error is not (de)serialized, so it might be undefined after deserialization */ + this.error = err; + + if (err && /** @type {any} */ (err).hideStack) { + this.stack = + err.stack.split("\n").slice(1).join("\n") + "\n\n" + this.stack; + } } } -module.exports = WarnNoModeSetPlugin; +module.exports = ModuleDependencyError; /***/ }), -/***/ 65193: +/***/ 29656: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -56617,136 +52118,49 @@ module.exports = WarnNoModeSetPlugin; -const { groupBy } = __webpack_require__(84953); -const createSchemaValidation = __webpack_require__(32540); - -/** @typedef {import("../declarations/plugins/WatchIgnorePlugin").WatchIgnorePluginOptions} WatchIgnorePluginOptions */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */ - -const validate = createSchemaValidation( - __webpack_require__(16711), - () => __webpack_require__(44246), - { - name: "Watch Ignore Plugin", - baseDataPath: "options" - } -); +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); -const IGNORE_TIME_ENTRY = "ignore"; +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Module")} Module */ -class IgnoringWatchFileSystem { +class ModuleDependencyWarning extends WebpackError { /** - * @param {WatchFileSystem} wfs original file system - * @param {(string|RegExp)[]} paths ignored paths + * @param {Module} module module tied to dependency + * @param {Error} err error thrown + * @param {DependencyLocation} loc location of dependency */ - constructor(wfs, paths) { - this.wfs = wfs; - this.paths = paths; - } - - watch(files, dirs, missing, startTime, options, callback, callbackUndelayed) { - files = Array.from(files); - dirs = Array.from(dirs); - const ignored = path => - this.paths.some(p => - p instanceof RegExp ? p.test(path) : path.indexOf(p) === 0 - ); - - const [ignoredFiles, notIgnoredFiles] = groupBy(files, ignored); - const [ignoredDirs, notIgnoredDirs] = groupBy(dirs, ignored); - - const watcher = this.wfs.watch( - notIgnoredFiles, - notIgnoredDirs, - missing, - startTime, - options, - (err, fileTimestamps, dirTimestamps, changedFiles, removedFiles) => { - if (err) return callback(err); - for (const path of ignoredFiles) { - fileTimestamps.set(path, IGNORE_TIME_ENTRY); - } - - for (const path of ignoredDirs) { - dirTimestamps.set(path, IGNORE_TIME_ENTRY); - } + constructor(module, err, loc) { + super(err ? err.message : ""); - callback( - err, - fileTimestamps, - dirTimestamps, - changedFiles, - removedFiles - ); - }, - callbackUndelayed - ); + this.name = "ModuleDependencyWarning"; + this.details = + err && !(/** @type {any} */ (err).hideStack) + ? err.stack.split("\n").slice(1).join("\n") + : undefined; + this.module = module; + this.loc = loc; + /** error is not (de)serialized, so it might be undefined after deserialization */ + this.error = err; - return { - close: () => watcher.close(), - pause: () => watcher.pause(), - getContextTimeInfoEntries: () => { - const dirTimestamps = watcher.getContextTimeInfoEntries(); - for (const path of ignoredDirs) { - dirTimestamps.set(path, IGNORE_TIME_ENTRY); - } - return dirTimestamps; - }, - getFileTimeInfoEntries: () => { - const fileTimestamps = watcher.getFileTimeInfoEntries(); - for (const path of ignoredFiles) { - fileTimestamps.set(path, IGNORE_TIME_ENTRY); - } - return fileTimestamps; - }, - getInfo: - watcher.getInfo && - (() => { - const info = watcher.getInfo(); - const { fileTimeInfoEntries, contextTimeInfoEntries } = info; - for (const path of ignoredFiles) { - fileTimeInfoEntries.set(path, IGNORE_TIME_ENTRY); - } - for (const path of ignoredDirs) { - contextTimeInfoEntries.set(path, IGNORE_TIME_ENTRY); - } - return info; - }) - }; + if (err && /** @type {any} */ (err).hideStack) { + this.stack = + err.stack.split("\n").slice(1).join("\n") + "\n\n" + this.stack; + } } } -class WatchIgnorePlugin { - /** - * @param {WatchIgnorePluginOptions} options options - */ - constructor(options) { - validate(options); - this.paths = options.paths; - } - - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.afterEnvironment.tap("WatchIgnorePlugin", () => { - compiler.watchFileSystem = new IgnoringWatchFileSystem( - compiler.watchFileSystem, - this.paths - ); - }); - } -} +makeSerializable( + ModuleDependencyWarning, + "webpack/lib/ModuleDependencyWarning" +); -module.exports = WatchIgnorePlugin; +module.exports = ModuleDependencyWarning; /***/ }), -/***/ 84275: +/***/ 23744: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -56757,645 +52171,408 @@ module.exports = WatchIgnorePlugin; -const Stats = __webpack_require__(31743); - -/** @typedef {import("../declarations/WebpackOptions").WatchOptions} WatchOptions */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */ - -/** - * @template T - * @callback Callback - * @param {(Error | null)=} err - * @param {T=} result - */ +const { cleanUp } = __webpack_require__(59985); +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); -class Watching { +class ModuleError extends WebpackError { /** - * @param {Compiler} compiler the compiler - * @param {WatchOptions} watchOptions options - * @param {Callback} handler completion handler + * @param {Error} err error thrown + * @param {{from?: string|null}} info additional info */ - constructor(compiler, watchOptions, handler) { - this.startTime = null; - this.invalid = false; - this.handler = handler; - /** @type {Callback[]} */ - this.callbacks = []; - /** @type {Callback[] | undefined} */ - this._closeCallbacks = undefined; - this.closed = false; - this.suspended = false; - this.blocked = false; - this._isBlocked = () => false; - this._onChange = () => {}; - this._onInvalid = () => {}; - if (typeof watchOptions === "number") { - this.watchOptions = { - aggregateTimeout: watchOptions - }; - } else if (watchOptions && typeof watchOptions === "object") { - this.watchOptions = { ...watchOptions }; - } else { - this.watchOptions = {}; - } - if (typeof this.watchOptions.aggregateTimeout !== "number") { - this.watchOptions.aggregateTimeout = 20; - } - this.compiler = compiler; - this.running = false; - this._initial = true; - this._invalidReported = true; - this._needRecords = true; - this.watcher = undefined; - this.pausedWatcher = undefined; - /** @type {Set} */ - this._collectedChangedFiles = undefined; - /** @type {Set} */ - this._collectedRemovedFiles = undefined; - this._done = this._done.bind(this); - process.nextTick(() => { - if (this._initial) this._invalidate(); - }); - } + constructor(err, { from = null } = {}) { + let message = "Module Error"; - /** - * @param {ReadonlySet} changedFiles changed files - * @param {ReadonlySet} removedFiles removed files - */ - _mergeWithCollected(changedFiles, removedFiles) { - if (!changedFiles) return; - if (!this._collectedChangedFiles) { - this._collectedChangedFiles = new Set(changedFiles); - this._collectedRemovedFiles = new Set(removedFiles); + if (from) { + message += ` (from ${from}):\n`; } else { - for (const file of changedFiles) { - this._collectedChangedFiles.add(file); - this._collectedRemovedFiles.delete(file); - } - for (const file of removedFiles) { - this._collectedChangedFiles.delete(file); - this._collectedRemovedFiles.add(file); - } + message += ": "; } - } - /** - * @param {ReadonlyMap=} fileTimeInfoEntries info for files - * @param {ReadonlyMap=} contextTimeInfoEntries info for directories - * @param {ReadonlySet=} changedFiles changed files - * @param {ReadonlySet=} removedFiles removed files - * @returns {void} - */ - _go(fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles) { - this._initial = false; - if (this.startTime === null) this.startTime = Date.now(); - this.running = true; - if (this.watcher) { - this.pausedWatcher = this.watcher; - this.lastWatcherStartTime = Date.now(); - this.watcher.pause(); - this.watcher = null; - } else if (!this.lastWatcherStartTime) { - this.lastWatcherStartTime = Date.now(); - } - this.compiler.fsStartTime = Date.now(); - if ( - changedFiles && - removedFiles && - fileTimeInfoEntries && - contextTimeInfoEntries - ) { - this._mergeWithCollected(changedFiles, removedFiles); - this.compiler.fileTimestamps = fileTimeInfoEntries; - this.compiler.contextTimestamps = contextTimeInfoEntries; - } else if (this.pausedWatcher) { - if (this.pausedWatcher.getInfo) { - const { - changes, - removals, - fileTimeInfoEntries, - contextTimeInfoEntries - } = this.pausedWatcher.getInfo(); - this._mergeWithCollected(changes, removals); - this.compiler.fileTimestamps = fileTimeInfoEntries; - this.compiler.contextTimestamps = contextTimeInfoEntries; - } else { - this._mergeWithCollected( - this.pausedWatcher.getAggregatedChanges && - this.pausedWatcher.getAggregatedChanges(), - this.pausedWatcher.getAggregatedRemovals && - this.pausedWatcher.getAggregatedRemovals() - ); - this.compiler.fileTimestamps = - this.pausedWatcher.getFileTimeInfoEntries(); - this.compiler.contextTimestamps = - this.pausedWatcher.getContextTimeInfoEntries(); - } + if (err && typeof err === "object" && err.message) { + message += err.message; + } else if (err) { + message += err; } - this.compiler.modifiedFiles = this._collectedChangedFiles; - this._collectedChangedFiles = undefined; - this.compiler.removedFiles = this._collectedRemovedFiles; - this._collectedRemovedFiles = undefined; - - const run = () => { - if (this.compiler.idle) { - return this.compiler.cache.endIdle(err => { - if (err) return this._done(err); - this.compiler.idle = false; - run(); - }); - } - if (this._needRecords) { - return this.compiler.readRecords(err => { - if (err) return this._done(err); - - this._needRecords = false; - run(); - }); - } - this.invalid = false; - this._invalidReported = false; - this.compiler.hooks.watchRun.callAsync(this.compiler, err => { - if (err) return this._done(err); - const onCompiled = (err, compilation) => { - if (err) return this._done(err, compilation); - if (this.invalid) return this._done(null, compilation); - if (this.compiler.hooks.shouldEmit.call(compilation) === false) { - return this._done(null, compilation); - } + super(message); - process.nextTick(() => { - const logger = compilation.getLogger("webpack.Compiler"); - logger.time("emitAssets"); - this.compiler.emitAssets(compilation, err => { - logger.timeEnd("emitAssets"); - if (err) return this._done(err, compilation); - if (this.invalid) return this._done(null, compilation); + this.name = "ModuleError"; + this.error = err; + this.details = + err && typeof err === "object" && err.stack + ? cleanUp(err.stack, this.message) + : undefined; + } - logger.time("emitRecords"); - this.compiler.emitRecords(err => { - logger.timeEnd("emitRecords"); - if (err) return this._done(err, compilation); + serialize(context) { + const { write } = context; - if (compilation.hooks.needAdditionalPass.call()) { - compilation.needAdditionalPass = true; + write(this.error); - compilation.startTime = this.startTime; - compilation.endTime = Date.now(); - logger.time("done hook"); - const stats = new Stats(compilation); - this.compiler.hooks.done.callAsync(stats, err => { - logger.timeEnd("done hook"); - if (err) return this._done(err, compilation); + super.serialize(context); + } - this.compiler.hooks.additionalPass.callAsync(err => { - if (err) return this._done(err, compilation); - this.compiler.compile(onCompiled); - }); - }); - return; - } - return this._done(null, compilation); - }); - }); - }); - }; - this.compiler.compile(onCompiled); - }); - }; + deserialize(context) { + const { read } = context; - run(); - } + this.error = read(); - /** - * @param {Compilation} compilation the compilation - * @returns {Stats} the compilation stats - */ - _getStats(compilation) { - const stats = new Stats(compilation); - return stats; + super.deserialize(context); } +} - /** - * @param {Error=} err an optional error - * @param {Compilation=} compilation the compilation - * @returns {void} - */ - _done(err, compilation) { - this.running = false; - - const logger = compilation && compilation.getLogger("webpack.Watching"); +makeSerializable(ModuleError, "webpack/lib/ModuleError"); - let stats = null; +module.exports = ModuleError; - const handleError = (err, cbs) => { - this.compiler.hooks.failed.call(err); - this.compiler.cache.beginIdle(); - this.compiler.idle = true; - this.handler(err, stats); - if (!cbs) { - cbs = this.callbacks; - this.callbacks = []; - } - for (const cb of cbs) cb(err); - }; - if ( - this.invalid && - !this.suspended && - !this.blocked && - !(this._isBlocked() && (this.blocked = true)) - ) { - if (compilation) { - logger.time("storeBuildDependencies"); - this.compiler.cache.storeBuildDependencies( - compilation.buildDependencies, - err => { - logger.timeEnd("storeBuildDependencies"); - if (err) return handleError(err); - this._go(); - } - ); - } else { - this._go(); - } - return; - } +/***/ }), - if (compilation) { - compilation.startTime = this.startTime; - compilation.endTime = Date.now(); - stats = new Stats(compilation); - } - this.startTime = null; - if (err) return handleError(err); +/***/ 51010: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const cbs = this.callbacks; - this.callbacks = []; - logger.time("done hook"); - this.compiler.hooks.done.callAsync(stats, err => { - logger.timeEnd("done hook"); - if (err) return handleError(err, cbs); - this.handler(null, stats); - logger.time("storeBuildDependencies"); - this.compiler.cache.storeBuildDependencies( - compilation.buildDependencies, - err => { - logger.timeEnd("storeBuildDependencies"); - if (err) return handleError(err, cbs); - logger.time("beginIdle"); - this.compiler.cache.beginIdle(); - this.compiler.idle = true; - logger.timeEnd("beginIdle"); - process.nextTick(() => { - if (!this.closed) { - this.watch( - compilation.fileDependencies, - compilation.contextDependencies, - compilation.missingDependencies - ); - } - }); - for (const cb of cbs) cb(null); - this.compiler.hooks.afterDone.call(stats); - } - ); - }); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {Iterable} files watched files - * @param {Iterable} dirs watched directories - * @param {Iterable} missing watched existence entries - * @returns {void} - */ - watch(files, dirs, missing) { - this.pausedWatcher = null; - this.watcher = this.compiler.watchFileSystem.watch( - files, - dirs, - missing, - this.lastWatcherStartTime, - this.watchOptions, - ( - err, - fileTimeInfoEntries, - contextTimeInfoEntries, - changedFiles, - removedFiles - ) => { - if (err) { - this.compiler.modifiedFiles = undefined; - this.compiler.removedFiles = undefined; - this.compiler.fileTimestamps = undefined; - this.compiler.contextTimestamps = undefined; - this.compiler.fsStartTime = undefined; - return this.handler(err); - } - this._invalidate( - fileTimeInfoEntries, - contextTimeInfoEntries, - changedFiles, - removedFiles - ); - this._onChange(); - }, - (fileName, changeTime) => { - if (!this._invalidReported) { - this._invalidReported = true; - this.compiler.hooks.invalid.call(fileName, changeTime); - } - this._onInvalid(); - } - ); - } - /** - * @param {Callback=} callback signals when the build has completed again - * @returns {void} - */ - invalidate(callback) { - if (callback) { - this.callbacks.push(callback); - } - if (!this._invalidReported) { - this._invalidReported = true; - this.compiler.hooks.invalid.call(null, Date.now()); - } - this._onChange(); - this._invalidate(); - } - _invalidate( - fileTimeInfoEntries, - contextTimeInfoEntries, - changedFiles, - removedFiles - ) { - if (this.suspended || (this._isBlocked() && (this.blocked = true))) { - this._mergeWithCollected(changedFiles, removedFiles); - return; - } +/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./Module")} Module */ - if (this.running) { - this._mergeWithCollected(changedFiles, removedFiles); - this.invalid = true; - } else { - this._go( - fileTimeInfoEntries, - contextTimeInfoEntries, - changedFiles, - removedFiles - ); - } - } +/** + * @typedef {Object} ModuleFactoryResult + * @property {Module=} module the created module or unset if no module was created + * @property {Set=} fileDependencies + * @property {Set=} contextDependencies + * @property {Set=} missingDependencies + * @property {boolean=} cacheable allow to use the unsafe cache + */ - suspend() { - this.suspended = true; - } +/** + * @typedef {Object} ModuleFactoryCreateDataContextInfo + * @property {string} issuer + * @property {string | null=} issuerLayer + * @property {string} compiler + */ - resume() { - if (this.suspended) { - this.suspended = false; - this._invalidate(); - } - } +/** + * @typedef {Object} ModuleFactoryCreateData + * @property {ModuleFactoryCreateDataContextInfo} contextInfo + * @property {ResolveOptions=} resolveOptions + * @property {string} context + * @property {Dependency[]} dependencies + */ +class ModuleFactory { + /* istanbul ignore next */ /** - * @param {Callback} callback signals when the watcher is closed - * @returns {void} - */ - close(callback) { - if (this._closeCallbacks) { - if (callback) { - this._closeCallbacks.push(callback); - } - return; - } - const finalCallback = (err, compilation) => { - this.running = false; - this.compiler.running = false; - this.compiler.watching = undefined; - this.compiler.watchMode = false; - this.compiler.modifiedFiles = undefined; - this.compiler.removedFiles = undefined; - this.compiler.fileTimestamps = undefined; - this.compiler.contextTimestamps = undefined; - this.compiler.fsStartTime = undefined; - const shutdown = err => { - this.compiler.hooks.watchClose.call(); - const closeCallbacks = this._closeCallbacks; - this._closeCallbacks = undefined; - for (const cb of closeCallbacks) cb(err); - }; - if (compilation) { - const logger = compilation.getLogger("webpack.Watching"); - logger.time("storeBuildDependencies"); - this.compiler.cache.storeBuildDependencies( - compilation.buildDependencies, - err2 => { - logger.timeEnd("storeBuildDependencies"); - shutdown(err || err2); - } - ); - } else { - shutdown(err); - } - }; - - this.closed = true; - if (this.watcher) { - this.watcher.close(); - this.watcher = null; - } - if (this.pausedWatcher) { - this.pausedWatcher.close(); - this.pausedWatcher = null; - } - this._closeCallbacks = []; - if (callback) { - this._closeCallbacks.push(callback); - } - if (this.running) { - this.invalid = true; - this._done = finalCallback; - } else { - finalCallback(); - } + * @abstract + * @param {ModuleFactoryCreateData} data data object + * @param {function(Error=, ModuleFactoryResult=): void} callback callback + * @returns {void} + */ + create(data, callback) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } } -module.exports = Watching; +module.exports = ModuleFactory; /***/ }), -/***/ 53799: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 88821: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Jarid Margolin @jaridmargolin + Author Tobias Koppers @sokra */ -const inspect = (__webpack_require__(73837).inspect.custom); -const makeSerializable = __webpack_require__(33032); +const NormalModule = __webpack_require__(39); +const createHash = __webpack_require__(49835); +const memoize = __webpack_require__(78676); -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ /** @typedef {import("./Module")} Module */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {typeof import("./util/Hash")} Hash */ -class WebpackError extends Error { - /** - * Creates an instance of WebpackError. - * @param {string=} message error message - */ - constructor(message) { - super(message); - - this.details = undefined; - /** @type {Module} */ - this.module = undefined; - /** @type {DependencyLocation} */ - this.loc = undefined; - /** @type {boolean} */ - this.hideStack = undefined; - /** @type {Chunk} */ - this.chunk = undefined; - /** @type {string} */ - this.file = undefined; - } - - [inspect]() { - return this.stack + (this.details ? `\n${this.details}` : ""); - } - - serialize({ write }) { - write(this.name); - write(this.message); - write(this.stack); - write(this.details); - write(this.loc); - write(this.hideStack); - } - - deserialize({ read }) { - this.name = read(); - this.message = read(); - this.stack = read(); - this.details = read(); - this.loc = read(); - this.hideStack = read(); - } -} - -makeSerializable(WebpackError, "webpack/lib/WebpackError"); +const ModuleFilenameHelpers = exports; -module.exports = WebpackError; +// TODO webpack 6: consider removing these +ModuleFilenameHelpers.ALL_LOADERS_RESOURCE = "[all-loaders][resource]"; +ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE = + /\[all-?loaders\]\[resource\]/gi; +ModuleFilenameHelpers.LOADERS_RESOURCE = "[loaders][resource]"; +ModuleFilenameHelpers.REGEXP_LOADERS_RESOURCE = /\[loaders\]\[resource\]/gi; +ModuleFilenameHelpers.RESOURCE = "[resource]"; +ModuleFilenameHelpers.REGEXP_RESOURCE = /\[resource\]/gi; +ModuleFilenameHelpers.ABSOLUTE_RESOURCE_PATH = "[absolute-resource-path]"; +// cSpell:words olute +ModuleFilenameHelpers.REGEXP_ABSOLUTE_RESOURCE_PATH = + /\[abs(olute)?-?resource-?path\]/gi; +ModuleFilenameHelpers.RESOURCE_PATH = "[resource-path]"; +ModuleFilenameHelpers.REGEXP_RESOURCE_PATH = /\[resource-?path\]/gi; +ModuleFilenameHelpers.ALL_LOADERS = "[all-loaders]"; +ModuleFilenameHelpers.REGEXP_ALL_LOADERS = /\[all-?loaders\]/gi; +ModuleFilenameHelpers.LOADERS = "[loaders]"; +ModuleFilenameHelpers.REGEXP_LOADERS = /\[loaders\]/gi; +ModuleFilenameHelpers.QUERY = "[query]"; +ModuleFilenameHelpers.REGEXP_QUERY = /\[query\]/gi; +ModuleFilenameHelpers.ID = "[id]"; +ModuleFilenameHelpers.REGEXP_ID = /\[id\]/gi; +ModuleFilenameHelpers.HASH = "[hash]"; +ModuleFilenameHelpers.REGEXP_HASH = /\[hash\]/gi; +ModuleFilenameHelpers.NAMESPACE = "[namespace]"; +ModuleFilenameHelpers.REGEXP_NAMESPACE = /\[namespace\]/gi; +const getAfter = (strFn, token) => { + return () => { + const str = strFn(); + const idx = str.indexOf(token); + return idx < 0 ? "" : str.substr(idx); + }; +}; -/***/ }), +const getBefore = (strFn, token) => { + return () => { + const str = strFn(); + const idx = str.lastIndexOf(token); + return idx < 0 ? "" : str.substr(0, idx); + }; +}; -/***/ 97017: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +const getHash = (strFn, hashFunction) => { + return () => { + const hash = createHash(hashFunction); + hash.update(strFn()); + const digest = /** @type {string} */ (hash.digest("hex")); + return digest.substr(0, 4); + }; +}; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ +const asRegExp = test => { + if (typeof test === "string") { + test = new RegExp("^" + test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")); + } + return test; +}; +const lazyObject = obj => { + const newObj = {}; + for (const key of Object.keys(obj)) { + const fn = obj[key]; + Object.defineProperty(newObj, key, { + get: () => fn(), + set: v => { + Object.defineProperty(newObj, key, { + value: v, + enumerable: true, + writable: true + }); + }, + enumerable: true, + configurable: true + }); + } + return newObj; +}; +const REGEXP = /\[\\*([\w-]+)\\*\]/gi; -const IgnoreErrorModuleFactory = __webpack_require__(3); -const WebpackIsIncludedDependency = __webpack_require__(26505); -const { - toConstantDependency -} = __webpack_require__(93998); +/** + * + * @param {Module | string} module the module + * @param {TODO} options options + * @param {Object} contextInfo context info + * @param {RequestShortener} contextInfo.requestShortener requestShortener + * @param {ChunkGraph} contextInfo.chunkGraph chunk graph + * @param {string | Hash} contextInfo.hashFunction the hash function to use + * @returns {string} the filename + */ +ModuleFilenameHelpers.createFilename = ( + module = "", + options, + { requestShortener, chunkGraph, hashFunction = "md4" } +) => { + const opts = { + namespace: "", + moduleFilenameTemplate: "", + ...(typeof options === "object" + ? options + : { + moduleFilenameTemplate: options + }) + }; -/** @typedef {import("enhanced-resolve/lib/Resolver")} Resolver */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ + let absoluteResourcePath; + let hash; + let identifier; + let moduleId; + let shortIdentifier; + if (typeof module === "string") { + shortIdentifier = memoize(() => requestShortener.shorten(module)); + identifier = shortIdentifier; + moduleId = () => ""; + absoluteResourcePath = () => module.split("!").pop(); + hash = getHash(identifier, hashFunction); + } else { + shortIdentifier = memoize(() => + module.readableIdentifier(requestShortener) + ); + identifier = memoize(() => requestShortener.shorten(module.identifier())); + moduleId = () => chunkGraph.getModuleId(module); + absoluteResourcePath = () => + module instanceof NormalModule + ? module.resource + : module.identifier().split("!").pop(); + hash = getHash(identifier, hashFunction); + } + const resource = memoize(() => shortIdentifier().split("!").pop()); -class WebpackIsIncludedPlugin { - /** - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "WebpackIsIncludedPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - WebpackIsIncludedDependency, - new IgnoreErrorModuleFactory(normalModuleFactory) - ); - compilation.dependencyTemplates.set( - WebpackIsIncludedDependency, - new WebpackIsIncludedDependency.Template() - ); + const loaders = getBefore(shortIdentifier, "!"); + const allLoaders = getBefore(identifier, "!"); + const query = getAfter(resource, "?"); + const resourcePath = () => { + const q = query().length; + return q === 0 ? resource() : resource().slice(0, -q); + }; + if (typeof opts.moduleFilenameTemplate === "function") { + return opts.moduleFilenameTemplate( + lazyObject({ + identifier: identifier, + shortIdentifier: shortIdentifier, + resource: resource, + resourcePath: memoize(resourcePath), + absoluteResourcePath: memoize(absoluteResourcePath), + allLoaders: memoize(allLoaders), + query: memoize(query), + moduleId: memoize(moduleId), + hash: memoize(hash), + namespace: () => opts.namespace + }) + ); + } - /** - * @param {JavascriptParser} parser the parser - * @returns {void} - */ - const handler = parser => { - parser.hooks.call - .for("__webpack_is_included__") - .tap("WebpackIsIncludedPlugin", expr => { - if ( - expr.type !== "CallExpression" || - expr.arguments.length !== 1 || - expr.arguments[0].type === "SpreadElement" - ) - return; + // TODO webpack 6: consider removing alternatives without dashes + /** @type {Map} */ + const replacements = new Map([ + ["identifier", identifier], + ["short-identifier", shortIdentifier], + ["resource", resource], + ["resource-path", resourcePath], + // cSpell:words resourcepath + ["resourcepath", resourcePath], + ["absolute-resource-path", absoluteResourcePath], + ["abs-resource-path", absoluteResourcePath], + // cSpell:words absoluteresource + ["absoluteresource-path", absoluteResourcePath], + // cSpell:words absresource + ["absresource-path", absoluteResourcePath], + // cSpell:words resourcepath + ["absolute-resourcepath", absoluteResourcePath], + // cSpell:words resourcepath + ["abs-resourcepath", absoluteResourcePath], + // cSpell:words absoluteresourcepath + ["absoluteresourcepath", absoluteResourcePath], + // cSpell:words absresourcepath + ["absresourcepath", absoluteResourcePath], + ["all-loaders", allLoaders], + // cSpell:words allloaders + ["allloaders", allLoaders], + ["loaders", loaders], + ["query", query], + ["id", moduleId], + ["hash", hash], + ["namespace", () => opts.namespace] + ]); - const request = parser.evaluateExpression(expr.arguments[0]); + // TODO webpack 6: consider removing weird double placeholders + return opts.moduleFilenameTemplate + .replace(ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE, "[identifier]") + .replace( + ModuleFilenameHelpers.REGEXP_LOADERS_RESOURCE, + "[short-identifier]" + ) + .replace(REGEXP, (match, content) => { + if (content.length + 2 === match.length) { + const replacement = replacements.get(content.toLowerCase()); + if (replacement !== undefined) { + return replacement(); + } + } else if (match.startsWith("[\\") && match.endsWith("\\]")) { + return `[${match.slice(2, -2)}]`; + } + return match; + }); +}; - if (!request.isString()) return; +ModuleFilenameHelpers.replaceDuplicates = (array, fn, comparator) => { + const countMap = Object.create(null); + const posMap = Object.create(null); + array.forEach((item, idx) => { + countMap[item] = countMap[item] || []; + countMap[item].push(idx); + posMap[item] = 0; + }); + if (comparator) { + Object.keys(countMap).forEach(item => { + countMap[item].sort(comparator); + }); + } + return array.map((item, i) => { + if (countMap[item].length > 1) { + if (comparator && countMap[item][0] === i) return item; + return fn(item, i, posMap[item]++); + } else { + return item; + } + }); +}; - const dep = new WebpackIsIncludedDependency( - request.string, - expr.range - ); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - return true; - }); - parser.hooks.typeof - .for("__webpack_is_included__") - .tap( - "WebpackIsIncludedPlugin", - toConstantDependency(parser, JSON.stringify("function")) - ); - }; - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("WebpackIsIncludedPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("WebpackIsIncludedPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("WebpackIsIncludedPlugin", handler); - } - ); +ModuleFilenameHelpers.matchPart = (str, test) => { + if (!test) return true; + test = asRegExp(test); + if (Array.isArray(test)) { + return test.map(asRegExp).some(regExp => regExp.test(str)); + } else { + return test.test(str); } -} +}; -module.exports = WebpackIsIncludedPlugin; +ModuleFilenameHelpers.matchObject = (obj, str) => { + if (obj.test) { + if (!ModuleFilenameHelpers.matchPart(str, obj.test)) { + return false; + } + } + if (obj.include) { + if (!ModuleFilenameHelpers.matchPart(str, obj.include)) { + return false; + } + } + if (obj.exclude) { + if (ModuleFilenameHelpers.matchPart(str, obj.exclude)) { + return false; + } + } + return true; +}; /***/ }), -/***/ 88422: +/***/ 99988: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -57406,699 +52583,861 @@ module.exports = WebpackIsIncludedPlugin; -const OptionsApply = __webpack_require__(81426); +const util = __webpack_require__(73837); +const ExportsInfo = __webpack_require__(63686); +const ModuleGraphConnection = __webpack_require__(40639); +const SortableSet = __webpack_require__(13098); +const WeakTupleMap = __webpack_require__(28745); -const AssetModulesPlugin = __webpack_require__(16109); -const JavascriptModulesPlugin = __webpack_require__(89464); -const JsonModulesPlugin = __webpack_require__(86770); +/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./ExportsInfo").ExportInfo} ExportInfo */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleProfile")} ModuleProfile */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ -const ChunkPrefetchPreloadPlugin = __webpack_require__(33895); +/** + * @callback OptimizationBailoutFunction + * @param {RequestShortener} requestShortener + * @returns {string} + */ -const EntryOptionPlugin = __webpack_require__(9909); -const RecordIdsPlugin = __webpack_require__(11094); +const EMPTY_SET = new Set(); + +/** + * @param {SortableSet} set input + * @returns {readonly Map} mapped by origin module + */ +const getConnectionsByOriginModule = set => { + const map = new Map(); + /** @type {Module | 0} */ + let lastModule = 0; + /** @type {ModuleGraphConnection[]} */ + let lastList = undefined; + for (const connection of set) { + const { originModule } = connection; + if (lastModule === originModule) { + lastList.push(connection); + } else { + lastModule = originModule; + const list = map.get(originModule); + if (list !== undefined) { + lastList = list; + list.push(connection); + } else { + const list = [connection]; + lastList = list; + map.set(originModule, list); + } + } + } + return map; +}; + +/** + * @param {SortableSet} set input + * @returns {readonly Map} mapped by module + */ +const getConnectionsByModule = set => { + const map = new Map(); + /** @type {Module | 0} */ + let lastModule = 0; + /** @type {ModuleGraphConnection[]} */ + let lastList = undefined; + for (const connection of set) { + const { module } = connection; + if (lastModule === module) { + lastList.push(connection); + } else { + lastModule = module; + const list = map.get(module); + if (list !== undefined) { + lastList = list; + list.push(connection); + } else { + const list = [connection]; + lastList = list; + map.set(module, list); + } + } + } + return map; +}; + +class ModuleGraphModule { + constructor() { + /** @type {SortableSet} */ + this.incomingConnections = new SortableSet(); + /** @type {SortableSet | undefined} */ + this.outgoingConnections = undefined; + /** @type {Module | null} */ + this.issuer = undefined; + /** @type {(string | OptimizationBailoutFunction)[]} */ + this.optimizationBailout = []; + /** @type {ExportsInfo} */ + this.exports = new ExportsInfo(); + /** @type {number} */ + this.preOrderIndex = null; + /** @type {number} */ + this.postOrderIndex = null; + /** @type {number} */ + this.depth = null; + /** @type {ModuleProfile} */ + this.profile = undefined; + /** @type {boolean} */ + this.async = false; + /** @type {ModuleGraphConnection[]} */ + this._unassignedConnections = undefined; + } +} + +class ModuleGraph { + constructor() { + /** @type {WeakMap} */ + this._dependencyMap = new WeakMap(); + /** @type {Map} */ + this._moduleMap = new Map(); + /** @type {WeakMap} */ + this._metaMap = new WeakMap(); -const RuntimePlugin = __webpack_require__(2307); + /** @type {WeakTupleMap} */ + this._cache = undefined; -const APIPlugin = __webpack_require__(74315); -const CompatibilityPlugin = __webpack_require__(94258); -const ConstPlugin = __webpack_require__(11146); -const ExportsInfoApiPlugin = __webpack_require__(7145); -const WebpackIsIncludedPlugin = __webpack_require__(97017); + /** @type {Map>} */ + this._moduleMemCaches = undefined; + } -const TemplatedPathPlugin = __webpack_require__(80734); -const UseStrictPlugin = __webpack_require__(36803); -const WarnCaseSensitiveModulesPlugin = __webpack_require__(56504); + /** + * @param {Module} module the module + * @returns {ModuleGraphModule} the internal module + */ + _getModuleGraphModule(module) { + let mgm = this._moduleMap.get(module); + if (mgm === undefined) { + mgm = new ModuleGraphModule(); + this._moduleMap.set(module, mgm); + } + return mgm; + } -const DataUriPlugin = __webpack_require__(64820); -const FileUriPlugin = __webpack_require__(57637); + /** + * @param {Dependency} dependency the dependency + * @param {DependenciesBlock} block parent block + * @param {Module} module parent module + * @param {number=} indexInBlock position in block + * @returns {void} + */ + setParents(dependency, block, module, indexInBlock = -1) { + dependency._parentDependenciesBlockIndex = indexInBlock; + dependency._parentDependenciesBlock = block; + dependency._parentModule = module; + } -const ResolverCachePlugin = __webpack_require__(97347); + /** + * @param {Dependency} dependency the dependency + * @returns {Module} parent module + */ + getParentModule(dependency) { + return dependency._parentModule; + } -const CommonJsPlugin = __webpack_require__(32406); -const HarmonyModulesPlugin = __webpack_require__(39029); -const ImportMetaPlugin = __webpack_require__(17228); -const ImportPlugin = __webpack_require__(41293); -const LoaderPlugin = __webpack_require__(24721); -const RequireContextPlugin = __webpack_require__(2928); -const RequireEnsurePlugin = __webpack_require__(8434); -const RequireIncludePlugin = __webpack_require__(37378); -const SystemPlugin = __webpack_require__(97981); -const URLPlugin = __webpack_require__(14412); -const WorkerPlugin = __webpack_require__(82509); + /** + * @param {Dependency} dependency the dependency + * @returns {DependenciesBlock} parent block + */ + getParentBlock(dependency) { + return dependency._parentDependenciesBlock; + } -const InferAsyncModulesPlugin = __webpack_require__(59498); + /** + * @param {Dependency} dependency the dependency + * @returns {number} index + */ + getParentBlockIndex(dependency) { + return dependency._parentDependenciesBlockIndex; + } -const JavascriptMetaInfoPlugin = __webpack_require__(52329); -const DefaultStatsFactoryPlugin = __webpack_require__(71760); -const DefaultStatsPresetPlugin = __webpack_require__(55442); -const DefaultStatsPrinterPlugin = __webpack_require__(58692); + /** + * @param {Module} originModule the referencing module + * @param {Dependency} dependency the referencing dependency + * @param {Module} module the referenced module + * @returns {void} + */ + setResolvedModule(originModule, dependency, module) { + const connection = new ModuleGraphConnection( + originModule, + dependency, + module, + undefined, + dependency.weak, + dependency.getCondition(this) + ); + const connections = this._getModuleGraphModule(module).incomingConnections; + connections.add(connection); + if (originModule) { + const mgm = this._getModuleGraphModule(originModule); + if (mgm._unassignedConnections === undefined) { + mgm._unassignedConnections = []; + } + mgm._unassignedConnections.push(connection); + if (mgm.outgoingConnections === undefined) { + mgm.outgoingConnections = new SortableSet(); + } + mgm.outgoingConnections.add(connection); + } else { + this._dependencyMap.set(dependency, connection); + } + } -const { cleverMerge } = __webpack_require__(60839); + /** + * @param {Dependency} dependency the referencing dependency + * @param {Module} module the referenced module + * @returns {void} + */ + updateModule(dependency, module) { + const connection = this.getConnection(dependency); + if (connection.module === module) return; + const newConnection = connection.clone(); + newConnection.module = module; + this._dependencyMap.set(dependency, newConnection); + connection.setActive(false); + const originMgm = this._getModuleGraphModule(connection.originModule); + originMgm.outgoingConnections.add(newConnection); + const targetMgm = this._getModuleGraphModule(module); + targetMgm.incomingConnections.add(newConnection); + } -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("./Compiler")} Compiler */ + /** + * @param {Dependency} dependency the referencing dependency + * @returns {void} + */ + removeConnection(dependency) { + const connection = this.getConnection(dependency); + const targetMgm = this._getModuleGraphModule(connection.module); + targetMgm.incomingConnections.delete(connection); + const originMgm = this._getModuleGraphModule(connection.originModule); + originMgm.outgoingConnections.delete(connection); + this._dependencyMap.set(dependency, null); + } -class WebpackOptionsApply extends OptionsApply { - constructor() { - super(); + /** + * @param {Dependency} dependency the referencing dependency + * @param {string} explanation an explanation + * @returns {void} + */ + addExplanation(dependency, explanation) { + const connection = this.getConnection(dependency); + connection.addExplanation(explanation); } /** - * @param {WebpackOptions} options options object - * @param {Compiler} compiler compiler object - * @returns {WebpackOptions} options object + * @param {Module} sourceModule the source module + * @param {Module} targetModule the target module + * @returns {void} */ - process(options, compiler) { - compiler.outputPath = options.output.path; - compiler.recordsInputPath = options.recordsInputPath || null; - compiler.recordsOutputPath = options.recordsOutputPath || null; - compiler.name = options.name; + cloneModuleAttributes(sourceModule, targetModule) { + const oldMgm = this._getModuleGraphModule(sourceModule); + const newMgm = this._getModuleGraphModule(targetModule); + newMgm.postOrderIndex = oldMgm.postOrderIndex; + newMgm.preOrderIndex = oldMgm.preOrderIndex; + newMgm.depth = oldMgm.depth; + newMgm.exports = oldMgm.exports; + newMgm.async = oldMgm.async; + } - if (options.externals) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const ExternalsPlugin = __webpack_require__(6652); - new ExternalsPlugin(options.externalsType, options.externals).apply( - compiler - ); - } + /** + * @param {Module} module the module + * @returns {void} + */ + removeModuleAttributes(module) { + const mgm = this._getModuleGraphModule(module); + mgm.postOrderIndex = null; + mgm.preOrderIndex = null; + mgm.depth = null; + mgm.async = false; + } - if (options.externalsPresets.node) { - const NodeTargetPlugin = __webpack_require__(17916); - new NodeTargetPlugin().apply(compiler); - } - if (options.externalsPresets.electronMain) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const ElectronTargetPlugin = __webpack_require__(32277); - new ElectronTargetPlugin("main").apply(compiler); - } - if (options.externalsPresets.electronPreload) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const ElectronTargetPlugin = __webpack_require__(32277); - new ElectronTargetPlugin("preload").apply(compiler); - } - if (options.externalsPresets.electronRenderer) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const ElectronTargetPlugin = __webpack_require__(32277); - new ElectronTargetPlugin("renderer").apply(compiler); - } - if ( - options.externalsPresets.electron && - !options.externalsPresets.electronMain && - !options.externalsPresets.electronPreload && - !options.externalsPresets.electronRenderer - ) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const ElectronTargetPlugin = __webpack_require__(32277); - new ElectronTargetPlugin().apply(compiler); - } - if (options.externalsPresets.nwjs) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const ExternalsPlugin = __webpack_require__(6652); - new ExternalsPlugin("node-commonjs", "nw.gui").apply(compiler); - } - if (options.externalsPresets.webAsync) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const ExternalsPlugin = __webpack_require__(6652); - new ExternalsPlugin( - "import", - options.experiments.css - ? ({ request, dependencyType }, callback) => { - if (dependencyType === "url") { - if (/^(\/\/|https?:\/\/)/.test(request)) - return callback(null, `asset ${request}`); - } else if (dependencyType === "css-import") { - if (/^(\/\/|https?:\/\/)/.test(request)) - return callback(null, `css-import ${request}`); - } else if (/^(\/\/|https?:\/\/|std:)/.test(request)) { - if (/^\.css(\?|$)/.test(request)) - return callback(null, `css-import ${request}`); - return callback(null, `import ${request}`); - } - callback(); - } - : /^(\/\/|https?:\/\/|std:)/ - ).apply(compiler); - } else if (options.externalsPresets.web) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const ExternalsPlugin = __webpack_require__(6652); - new ExternalsPlugin( - "module", - options.experiments.css - ? ({ request, dependencyType }, callback) => { - if (dependencyType === "url") { - if (/^(\/\/|https?:\/\/)/.test(request)) - return callback(null, `asset ${request}`); - } else if (dependencyType === "css-import") { - if (/^(\/\/|https?:\/\/)/.test(request)) - return callback(null, `css-import ${request}`); - } else if (/^(\/\/|https?:\/\/|std:)/.test(request)) { - if (/^\.css(\?|$)/.test(request)) - return callback(null, `css-import ${request}`); - return callback(null, `module ${request}`); - } - callback(); - } - : /^(\/\/|https?:\/\/|std:)/ - ).apply(compiler); + /** + * @returns {void} + */ + removeAllModuleAttributes() { + for (const mgm of this._moduleMap.values()) { + mgm.postOrderIndex = null; + mgm.preOrderIndex = null; + mgm.depth = null; + mgm.async = false; } + } - new ChunkPrefetchPreloadPlugin().apply(compiler); - - if (typeof options.output.chunkFormat === "string") { - switch (options.output.chunkFormat) { - case "array-push": { - const ArrayPushCallbackChunkFormatPlugin = __webpack_require__(18535); - new ArrayPushCallbackChunkFormatPlugin().apply(compiler); - break; - } - case "commonjs": { - const CommonJsChunkFormatPlugin = __webpack_require__(84508); - new CommonJsChunkFormatPlugin().apply(compiler); - break; - } - case "module": { - const ModuleChunkFormatPlugin = __webpack_require__(68927); - new ModuleChunkFormatPlugin().apply(compiler); - break; + /** + * @param {Module} oldModule the old referencing module + * @param {Module} newModule the new referencing module + * @param {function(ModuleGraphConnection): boolean} filterConnection filter predicate for replacement + * @returns {void} + */ + moveModuleConnections(oldModule, newModule, filterConnection) { + if (oldModule === newModule) return; + const oldMgm = this._getModuleGraphModule(oldModule); + const newMgm = this._getModuleGraphModule(newModule); + // Outgoing connections + const oldConnections = oldMgm.outgoingConnections; + if (oldConnections !== undefined) { + if (newMgm.outgoingConnections === undefined) { + newMgm.outgoingConnections = new SortableSet(); + } + const newConnections = newMgm.outgoingConnections; + for (const connection of oldConnections) { + if (filterConnection(connection)) { + connection.originModule = newModule; + newConnections.add(connection); + oldConnections.delete(connection); } - default: - throw new Error( - "Unsupported chunk format '" + options.output.chunkFormat + "'." - ); } } - - if (options.output.enabledChunkLoadingTypes.length > 0) { - for (const type of options.output.enabledChunkLoadingTypes) { - const EnableChunkLoadingPlugin = __webpack_require__(61291); - new EnableChunkLoadingPlugin(type).apply(compiler); + // Incoming connections + const oldConnections2 = oldMgm.incomingConnections; + const newConnections2 = newMgm.incomingConnections; + for (const connection of oldConnections2) { + if (filterConnection(connection)) { + connection.module = newModule; + newConnections2.add(connection); + oldConnections2.delete(connection); } } + } - if (options.output.enabledWasmLoadingTypes.length > 0) { - for (const type of options.output.enabledWasmLoadingTypes) { - const EnableWasmLoadingPlugin = __webpack_require__(78613); - new EnableWasmLoadingPlugin(type).apply(compiler); + /** + * @param {Module} oldModule the old referencing module + * @param {Module} newModule the new referencing module + * @param {function(ModuleGraphConnection): boolean} filterConnection filter predicate for replacement + * @returns {void} + */ + copyOutgoingModuleConnections(oldModule, newModule, filterConnection) { + if (oldModule === newModule) return; + const oldMgm = this._getModuleGraphModule(oldModule); + const newMgm = this._getModuleGraphModule(newModule); + // Outgoing connections + const oldConnections = oldMgm.outgoingConnections; + if (oldConnections !== undefined) { + if (newMgm.outgoingConnections === undefined) { + newMgm.outgoingConnections = new SortableSet(); + } + const newConnections = newMgm.outgoingConnections; + for (const connection of oldConnections) { + if (filterConnection(connection)) { + const newConnection = connection.clone(); + newConnection.originModule = newModule; + newConnections.add(newConnection); + if (newConnection.module !== undefined) { + const otherMgm = this._getModuleGraphModule(newConnection.module); + otherMgm.incomingConnections.add(newConnection); + } + } } } + } - if (options.output.enabledLibraryTypes.length > 0) { - for (const type of options.output.enabledLibraryTypes) { - const EnableLibraryPlugin = __webpack_require__(91452); - new EnableLibraryPlugin(type).apply(compiler); + /** + * @param {Module} module the referenced module + * @param {string} explanation an explanation why it's referenced + * @returns {void} + */ + addExtraReason(module, explanation) { + const connections = this._getModuleGraphModule(module).incomingConnections; + connections.add(new ModuleGraphConnection(null, null, module, explanation)); + } + + /** + * @param {Dependency} dependency the dependency to look for a referenced module + * @returns {Module} the referenced module + */ + getResolvedModule(dependency) { + const connection = this.getConnection(dependency); + return connection !== undefined ? connection.resolvedModule : null; + } + + /** + * @param {Dependency} dependency the dependency to look for a referenced module + * @returns {ModuleGraphConnection | undefined} the connection + */ + getConnection(dependency) { + const connection = this._dependencyMap.get(dependency); + if (connection === undefined) { + const module = this.getParentModule(dependency); + if (module !== undefined) { + const mgm = this._getModuleGraphModule(module); + if ( + mgm._unassignedConnections && + mgm._unassignedConnections.length !== 0 + ) { + let foundConnection; + for (const connection of mgm._unassignedConnections) { + this._dependencyMap.set(connection.dependency, connection); + if (connection.dependency === dependency) + foundConnection = connection; + } + mgm._unassignedConnections.length = 0; + if (foundConnection !== undefined) { + return foundConnection; + } + } } + this._dependencyMap.set(dependency, null); + return undefined; } + return connection === null ? undefined : connection; + } - if (options.output.pathinfo) { - const ModuleInfoHeaderPlugin = __webpack_require__(3454); - new ModuleInfoHeaderPlugin(options.output.pathinfo !== true).apply( - compiler - ); - } + /** + * @param {Dependency} dependency the dependency to look for a referenced module + * @returns {Module} the referenced module + */ + getModule(dependency) { + const connection = this.getConnection(dependency); + return connection !== undefined ? connection.module : null; + } + + /** + * @param {Dependency} dependency the dependency to look for a referencing module + * @returns {Module} the referencing module + */ + getOrigin(dependency) { + const connection = this.getConnection(dependency); + return connection !== undefined ? connection.originModule : null; + } + + /** + * @param {Dependency} dependency the dependency to look for a referencing module + * @returns {Module} the original referencing module + */ + getResolvedOrigin(dependency) { + const connection = this.getConnection(dependency); + return connection !== undefined ? connection.resolvedOriginModule : null; + } + + /** + * @param {Module} module the module + * @returns {Iterable} reasons why a module is included + */ + getIncomingConnections(module) { + const connections = this._getModuleGraphModule(module).incomingConnections; + return connections; + } + + /** + * @param {Module} module the module + * @returns {Iterable} list of outgoing connections + */ + getOutgoingConnections(module) { + const connections = this._getModuleGraphModule(module).outgoingConnections; + return connections === undefined ? EMPTY_SET : connections; + } + + /** + * @param {Module} module the module + * @returns {readonly Map} reasons why a module is included, in a map by source module + */ + getIncomingConnectionsByOriginModule(module) { + const connections = this._getModuleGraphModule(module).incomingConnections; + return connections.getFromUnorderedCache(getConnectionsByOriginModule); + } + + /** + * @param {Module} module the module + * @returns {readonly Map | undefined} connections to modules, in a map by module + */ + getOutgoingConnectionsByModule(module) { + const connections = this._getModuleGraphModule(module).outgoingConnections; + return connections === undefined + ? undefined + : connections.getFromUnorderedCache(getConnectionsByModule); + } + + /** + * @param {Module} module the module + * @returns {ModuleProfile | null} the module profile + */ + getProfile(module) { + const mgm = this._getModuleGraphModule(module); + return mgm.profile; + } + + /** + * @param {Module} module the module + * @param {ModuleProfile | null} profile the module profile + * @returns {void} + */ + setProfile(module, profile) { + const mgm = this._getModuleGraphModule(module); + mgm.profile = profile; + } - if (options.output.clean) { - const CleanPlugin = __webpack_require__(31085); - new CleanPlugin( - options.output.clean === true ? {} : options.output.clean - ).apply(compiler); - } + /** + * @param {Module} module the module + * @returns {Module | null} the issuer module + */ + getIssuer(module) { + const mgm = this._getModuleGraphModule(module); + return mgm.issuer; + } - if (options.devtool) { - if (options.devtool.includes("source-map")) { - const hidden = options.devtool.includes("hidden"); - const inline = options.devtool.includes("inline"); - const evalWrapped = options.devtool.includes("eval"); - const cheap = options.devtool.includes("cheap"); - const moduleMaps = options.devtool.includes("module"); - const noSources = options.devtool.includes("nosources"); - const Plugin = evalWrapped - ? __webpack_require__(14790) - : __webpack_require__(63872); - new Plugin({ - filename: inline ? null : options.output.sourceMapFilename, - moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate, - fallbackModuleFilenameTemplate: - options.output.devtoolFallbackModuleFilenameTemplate, - append: hidden ? false : undefined, - module: moduleMaps ? true : cheap ? false : true, - columns: cheap ? false : true, - noSources: noSources, - namespace: options.output.devtoolNamespace - }).apply(compiler); - } else if (options.devtool.includes("eval")) { - const EvalDevToolModulePlugin = __webpack_require__(65218); - new EvalDevToolModulePlugin({ - moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate, - namespace: options.output.devtoolNamespace - }).apply(compiler); - } - } + /** + * @param {Module} module the module + * @param {Module | null} issuer the issuer module + * @returns {void} + */ + setIssuer(module, issuer) { + const mgm = this._getModuleGraphModule(module); + mgm.issuer = issuer; + } - new JavascriptModulesPlugin().apply(compiler); - new JsonModulesPlugin().apply(compiler); - new AssetModulesPlugin().apply(compiler); + /** + * @param {Module} module the module + * @param {Module | null} issuer the issuer module + * @returns {void} + */ + setIssuerIfUnset(module, issuer) { + const mgm = this._getModuleGraphModule(module); + if (mgm.issuer === undefined) mgm.issuer = issuer; + } - if (!options.experiments.outputModule) { - if (options.output.module) { - throw new Error( - "'output.module: true' is only allowed when 'experiments.outputModule' is enabled" - ); - } - if (options.output.enabledLibraryTypes.includes("module")) { - throw new Error( - "library type \"module\" is only allowed when 'experiments.outputModule' is enabled" - ); - } - if (options.externalsType === "module") { - throw new Error( - "'externalsType: \"module\"' is only allowed when 'experiments.outputModule' is enabled" - ); - } - } + /** + * @param {Module} module the module + * @returns {(string | OptimizationBailoutFunction)[]} optimization bailouts + */ + getOptimizationBailout(module) { + const mgm = this._getModuleGraphModule(module); + return mgm.optimizationBailout; + } - if (options.experiments.syncWebAssembly) { - const WebAssemblyModulesPlugin = __webpack_require__(53639); - new WebAssemblyModulesPlugin({ - mangleImports: options.optimization.mangleWasmImports - }).apply(compiler); - } + /** + * @param {Module} module the module + * @returns {true | string[] | null} the provided exports + */ + getProvidedExports(module) { + const mgm = this._getModuleGraphModule(module); + return mgm.exports.getProvidedExports(); + } - if (options.experiments.asyncWebAssembly) { - const AsyncWebAssemblyModulesPlugin = __webpack_require__(7538); - new AsyncWebAssemblyModulesPlugin({ - mangleImports: options.optimization.mangleWasmImports - }).apply(compiler); - } + /** + * @param {Module} module the module + * @param {string | string[]} exportName a name of an export + * @returns {boolean | null} true, if the export is provided by the module. + * null, if it's unknown. + * false, if it's not provided. + */ + isExportProvided(module, exportName) { + const mgm = this._getModuleGraphModule(module); + const result = mgm.exports.isExportProvided(exportName); + return result === undefined ? null : result; + } - if (options.experiments.css) { - const CssModulesPlugin = __webpack_require__(47283); - new CssModulesPlugin(options.experiments.css).apply(compiler); - } + /** + * @param {Module} module the module + * @returns {ExportsInfo} info about the exports + */ + getExportsInfo(module) { + const mgm = this._getModuleGraphModule(module); + return mgm.exports; + } - if (options.experiments.lazyCompilation) { - const LazyCompilationPlugin = __webpack_require__(79040); - const lazyOptions = - typeof options.experiments.lazyCompilation === "object" - ? options.experiments.lazyCompilation - : null; - new LazyCompilationPlugin({ - backend: - typeof lazyOptions.backend === "function" - ? lazyOptions.backend - : __webpack_require__(17781)({ - ...lazyOptions.backend, - client: - (lazyOptions.backend && lazyOptions.backend.client) || - options.externalsPresets.node ? __webpack_require__.ab + "lazy-compilation-node.js" : __webpack_require__.ab + "lazy-compilation-web.js" - }), - entries: !lazyOptions || lazyOptions.entries !== false, - imports: !lazyOptions || lazyOptions.imports !== false, - test: (lazyOptions && lazyOptions.test) || undefined - }).apply(compiler); - } + /** + * @param {Module} module the module + * @param {string} exportName the export + * @returns {ExportInfo} info about the export + */ + getExportInfo(module, exportName) { + const mgm = this._getModuleGraphModule(module); + return mgm.exports.getExportInfo(exportName); + } - if (options.experiments.buildHttp) { - const HttpUriPlugin = __webpack_require__(42110); - const httpOptions = options.experiments.buildHttp; - new HttpUriPlugin(httpOptions).apply(compiler); - } + /** + * @param {Module} module the module + * @param {string} exportName the export + * @returns {ExportInfo} info about the export (do not modify) + */ + getReadOnlyExportInfo(module, exportName) { + const mgm = this._getModuleGraphModule(module); + return mgm.exports.getReadOnlyExportInfo(exportName); + } - new EntryOptionPlugin().apply(compiler); - compiler.hooks.entryOption.call(options.context, options.entry); + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @returns {false | true | SortableSet | null} the used exports + * false: module is not used at all. + * true: the module namespace/object export is used. + * SortableSet: these export names are used. + * empty SortableSet: module is used but no export. + * null: unknown, worst case should be assumed. + */ + getUsedExports(module, runtime) { + const mgm = this._getModuleGraphModule(module); + return mgm.exports.getUsedExports(runtime); + } - new RuntimePlugin().apply(compiler); + /** + * @param {Module} module the module + * @returns {number} the index of the module + */ + getPreOrderIndex(module) { + const mgm = this._getModuleGraphModule(module); + return mgm.preOrderIndex; + } - new InferAsyncModulesPlugin().apply(compiler); + /** + * @param {Module} module the module + * @returns {number} the index of the module + */ + getPostOrderIndex(module) { + const mgm = this._getModuleGraphModule(module); + return mgm.postOrderIndex; + } - new DataUriPlugin().apply(compiler); - new FileUriPlugin().apply(compiler); + /** + * @param {Module} module the module + * @param {number} index the index of the module + * @returns {void} + */ + setPreOrderIndex(module, index) { + const mgm = this._getModuleGraphModule(module); + mgm.preOrderIndex = index; + } - new CompatibilityPlugin().apply(compiler); - new HarmonyModulesPlugin({ - topLevelAwait: options.experiments.topLevelAwait - }).apply(compiler); - if (options.amd !== false) { - const AMDPlugin = __webpack_require__(50067); - const RequireJsStuffPlugin = __webpack_require__(88846); - new AMDPlugin(options.amd || {}).apply(compiler); - new RequireJsStuffPlugin().apply(compiler); + /** + * @param {Module} module the module + * @param {number} index the index of the module + * @returns {boolean} true, if the index was set + */ + setPreOrderIndexIfUnset(module, index) { + const mgm = this._getModuleGraphModule(module); + if (mgm.preOrderIndex === null) { + mgm.preOrderIndex = index; + return true; } - new CommonJsPlugin().apply(compiler); - new LoaderPlugin({}).apply(compiler); - if (options.node !== false) { - const NodeStuffPlugin = __webpack_require__(95287); - new NodeStuffPlugin(options.node).apply(compiler); + return false; + } + + /** + * @param {Module} module the module + * @param {number} index the index of the module + * @returns {void} + */ + setPostOrderIndex(module, index) { + const mgm = this._getModuleGraphModule(module); + mgm.postOrderIndex = index; + } + + /** + * @param {Module} module the module + * @param {number} index the index of the module + * @returns {boolean} true, if the index was set + */ + setPostOrderIndexIfUnset(module, index) { + const mgm = this._getModuleGraphModule(module); + if (mgm.postOrderIndex === null) { + mgm.postOrderIndex = index; + return true; } - new APIPlugin().apply(compiler); - new ExportsInfoApiPlugin().apply(compiler); - new WebpackIsIncludedPlugin().apply(compiler); - new ConstPlugin().apply(compiler); - new UseStrictPlugin().apply(compiler); - new RequireIncludePlugin().apply(compiler); - new RequireEnsurePlugin().apply(compiler); - new RequireContextPlugin().apply(compiler); - new ImportPlugin().apply(compiler); - new SystemPlugin().apply(compiler); - new ImportMetaPlugin().apply(compiler); - new URLPlugin().apply(compiler); - new WorkerPlugin( - options.output.workerChunkLoading, - options.output.workerWasmLoading, - options.output.module - ).apply(compiler); + return false; + } - new DefaultStatsFactoryPlugin().apply(compiler); - new DefaultStatsPresetPlugin().apply(compiler); - new DefaultStatsPrinterPlugin().apply(compiler); + /** + * @param {Module} module the module + * @returns {number} the depth of the module + */ + getDepth(module) { + const mgm = this._getModuleGraphModule(module); + return mgm.depth; + } - new JavascriptMetaInfoPlugin().apply(compiler); + /** + * @param {Module} module the module + * @param {number} depth the depth of the module + * @returns {void} + */ + setDepth(module, depth) { + const mgm = this._getModuleGraphModule(module); + mgm.depth = depth; + } - if (typeof options.mode !== "string") { - const WarnNoModeSetPlugin = __webpack_require__(25295); - new WarnNoModeSetPlugin().apply(compiler); + /** + * @param {Module} module the module + * @param {number} depth the depth of the module + * @returns {boolean} true, if the depth was set + */ + setDepthIfLower(module, depth) { + const mgm = this._getModuleGraphModule(module); + if (mgm.depth === null || mgm.depth > depth) { + mgm.depth = depth; + return true; } + return false; + } - const EnsureChunkConditionsPlugin = __webpack_require__(96260); - new EnsureChunkConditionsPlugin().apply(compiler); - if (options.optimization.removeAvailableModules) { - const RemoveParentModulesPlugin = __webpack_require__(7081); - new RemoveParentModulesPlugin().apply(compiler); - } - if (options.optimization.removeEmptyChunks) { - const RemoveEmptyChunksPlugin = __webpack_require__(84760); - new RemoveEmptyChunksPlugin().apply(compiler); - } - if (options.optimization.mergeDuplicateChunks) { - const MergeDuplicateChunksPlugin = __webpack_require__(85067); - new MergeDuplicateChunksPlugin().apply(compiler); - } - if (options.optimization.flagIncludedChunks) { - const FlagIncludedChunksPlugin = __webpack_require__(50089); - new FlagIncludedChunksPlugin().apply(compiler); - } - if (options.optimization.sideEffects) { - const SideEffectsFlagPlugin = __webpack_require__(84800); - new SideEffectsFlagPlugin( - options.optimization.sideEffects === true - ).apply(compiler); - } - if (options.optimization.providedExports) { - const FlagDependencyExportsPlugin = __webpack_require__(84506); - new FlagDependencyExportsPlugin().apply(compiler); - } - if (options.optimization.usedExports) { - const FlagDependencyUsagePlugin = __webpack_require__(58812); - new FlagDependencyUsagePlugin( - options.optimization.usedExports === "global" - ).apply(compiler); - } - if (options.optimization.innerGraph) { - const InnerGraphPlugin = __webpack_require__(28758); - new InnerGraphPlugin().apply(compiler); - } - if (options.optimization.mangleExports) { - const MangleExportsPlugin = __webpack_require__(27868); - new MangleExportsPlugin( - options.optimization.mangleExports !== "size" - ).apply(compiler); - } - if (options.optimization.concatenateModules) { - const ModuleConcatenationPlugin = __webpack_require__(74844); - new ModuleConcatenationPlugin().apply(compiler); - } - if (options.optimization.splitChunks) { - const SplitChunksPlugin = __webpack_require__(21478); - new SplitChunksPlugin(options.optimization.splitChunks).apply(compiler); - } - if (options.optimization.runtimeChunk) { - const RuntimeChunkPlugin = __webpack_require__(2837); - new RuntimeChunkPlugin(options.optimization.runtimeChunk).apply(compiler); - } - if (!options.optimization.emitOnErrors) { - const NoEmitOnErrorsPlugin = __webpack_require__(50169); - new NoEmitOnErrorsPlugin().apply(compiler); - } - if (options.optimization.realContentHash) { - const RealContentHashPlugin = __webpack_require__(46043); - new RealContentHashPlugin({ - hashFunction: options.output.hashFunction, - hashDigest: options.output.hashDigest - }).apply(compiler); - } - if (options.optimization.checkWasmTypes) { - const WasmFinalizeExportsPlugin = __webpack_require__(19810); - new WasmFinalizeExportsPlugin().apply(compiler); - } - const moduleIds = options.optimization.moduleIds; - if (moduleIds) { - switch (moduleIds) { - case "natural": { - const NaturalModuleIdsPlugin = __webpack_require__(83366); - new NaturalModuleIdsPlugin().apply(compiler); - break; - } - case "named": { - const NamedModuleIdsPlugin = __webpack_require__(24339); - new NamedModuleIdsPlugin().apply(compiler); - break; - } - case "hashed": { - const WarnDeprecatedOptionPlugin = __webpack_require__(76537); - const HashedModuleIdsPlugin = __webpack_require__(21825); - new WarnDeprecatedOptionPlugin( - "optimization.moduleIds", - "hashed", - "deterministic" - ).apply(compiler); - new HashedModuleIdsPlugin({ - hashFunction: options.output.hashFunction - }).apply(compiler); - break; - } - case "deterministic": { - const DeterministicModuleIdsPlugin = __webpack_require__(76692); - new DeterministicModuleIdsPlugin().apply(compiler); - break; - } - case "size": { - const OccurrenceModuleIdsPlugin = __webpack_require__(35371); - new OccurrenceModuleIdsPlugin({ - prioritiseInitial: true - }).apply(compiler); - break; - } - default: - throw new Error( - `webpack bug: moduleIds: ${moduleIds} is not implemented` - ); - } - } - const chunkIds = options.optimization.chunkIds; - if (chunkIds) { - switch (chunkIds) { - case "natural": { - const NaturalChunkIdsPlugin = __webpack_require__(86221); - new NaturalChunkIdsPlugin().apply(compiler); - break; - } - case "named": { - const NamedChunkIdsPlugin = __webpack_require__(6454); - new NamedChunkIdsPlugin().apply(compiler); - break; - } - case "deterministic": { - const DeterministicChunkIdsPlugin = __webpack_require__(8747); - new DeterministicChunkIdsPlugin().apply(compiler); - break; - } - case "size": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const OccurrenceChunkIdsPlugin = __webpack_require__(51020); - new OccurrenceChunkIdsPlugin({ - prioritiseInitial: true - }).apply(compiler); - break; - } - case "total-size": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const OccurrenceChunkIdsPlugin = __webpack_require__(51020); - new OccurrenceChunkIdsPlugin({ - prioritiseInitial: false - }).apply(compiler); - break; - } - default: - throw new Error( - `webpack bug: chunkIds: ${chunkIds} is not implemented` - ); - } - } - if (options.optimization.nodeEnv) { - const DefinePlugin = __webpack_require__(79065); - new DefinePlugin({ - "process.env.NODE_ENV": JSON.stringify(options.optimization.nodeEnv) - }).apply(compiler); - } - if (options.optimization.minimize) { - for (const minimizer of options.optimization.minimizer) { - if (typeof minimizer === "function") { - minimizer.call(compiler, compiler); - } else if (minimizer !== "...") { - minimizer.apply(compiler); - } - } - } + /** + * @param {Module} module the module + * @returns {boolean} true, if the module is async + */ + isAsync(module) { + const mgm = this._getModuleGraphModule(module); + return mgm.async; + } + + /** + * @param {Module} module the module + * @returns {void} + */ + setAsync(module) { + const mgm = this._getModuleGraphModule(module); + mgm.async = true; + } - if (options.performance) { - const SizeLimitsPlugin = __webpack_require__(32557); - new SizeLimitsPlugin(options.performance).apply(compiler); + /** + * @param {any} thing any thing + * @returns {Object} metadata + */ + getMeta(thing) { + let meta = this._metaMap.get(thing); + if (meta === undefined) { + meta = Object.create(null); + this._metaMap.set(thing, meta); } + return meta; + } - new TemplatedPathPlugin().apply(compiler); + /** + * @param {any} thing any thing + * @returns {Object} metadata + */ + getMetaIfExisting(thing) { + return this._metaMap.get(thing); + } - new RecordIdsPlugin({ - portableIds: options.optimization.portableRecords - }).apply(compiler); + /** + * @param {string=} cacheStage a persistent stage name for caching + */ + freeze(cacheStage) { + this._cache = new WeakTupleMap(); + this._cacheStage = cacheStage; + } - new WarnCaseSensitiveModulesPlugin().apply(compiler); + unfreeze() { + this._cache = undefined; + this._cacheStage = undefined; + } - const AddManagedPathsPlugin = __webpack_require__(47942); - new AddManagedPathsPlugin( - options.snapshot.managedPaths, - options.snapshot.immutablePaths - ).apply(compiler); + /** + * @template {any[]} T + * @template V + * @param {(moduleGraph: ModuleGraph, ...args: T) => V} fn computer + * @param {T} args arguments + * @returns {V} computed value or cached + */ + cached(fn, ...args) { + if (this._cache === undefined) return fn(this, ...args); + return this._cache.provide(fn, ...args, () => fn(this, ...args)); + } - if (options.cache && typeof options.cache === "object") { - const cacheOptions = options.cache; - switch (cacheOptions.type) { - case "memory": { - if (isFinite(cacheOptions.maxGenerations)) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const MemoryWithGcCachePlugin = __webpack_require__(99334); - new MemoryWithGcCachePlugin({ - maxGenerations: cacheOptions.maxGenerations - }).apply(compiler); - } else { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const MemoryCachePlugin = __webpack_require__(52539); - new MemoryCachePlugin().apply(compiler); - } - if (cacheOptions.cacheUnaffected) { - if (!options.experiments.cacheUnaffected) { - throw new Error( - "'cache.cacheUnaffected: true' is only allowed when 'experiments.cacheUnaffected' is enabled" - ); - } - compiler.moduleMemCaches = new Map(); - } - break; - } - case "filesystem": { - const AddBuildDependenciesPlugin = __webpack_require__(28034); - for (const key in cacheOptions.buildDependencies) { - const list = cacheOptions.buildDependencies[key]; - new AddBuildDependenciesPlugin(list).apply(compiler); - } - if (!isFinite(cacheOptions.maxMemoryGenerations)) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const MemoryCachePlugin = __webpack_require__(52539); - new MemoryCachePlugin().apply(compiler); - } else if (cacheOptions.maxMemoryGenerations !== 0) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const MemoryWithGcCachePlugin = __webpack_require__(99334); - new MemoryWithGcCachePlugin({ - maxGenerations: cacheOptions.maxMemoryGenerations - }).apply(compiler); - } - if (cacheOptions.memoryCacheUnaffected) { - if (!options.experiments.cacheUnaffected) { - throw new Error( - "'cache.memoryCacheUnaffected: true' is only allowed when 'experiments.cacheUnaffected' is enabled" - ); - } - compiler.moduleMemCaches = new Map(); - } - switch (cacheOptions.store) { - case "pack": { - const IdleFileCachePlugin = __webpack_require__(71985); - const PackFileCacheStrategy = __webpack_require__(86180); - new IdleFileCachePlugin( - new PackFileCacheStrategy({ - compiler, - fs: compiler.intermediateFileSystem, - context: options.context, - cacheLocation: cacheOptions.cacheLocation, - version: cacheOptions.version, - logger: compiler.getInfrastructureLogger( - "webpack.cache.PackFileCacheStrategy" - ), - snapshot: options.snapshot, - maxAge: cacheOptions.maxAge, - profile: cacheOptions.profile, - allowCollectingMemory: cacheOptions.allowCollectingMemory, - compression: cacheOptions.compression - }), - cacheOptions.idleTimeout, - cacheOptions.idleTimeoutForInitialStore, - cacheOptions.idleTimeoutAfterLargeChanges - ).apply(compiler); - break; - } - default: - throw new Error("Unhandled value for cache.store"); - } - break; - } - default: - // @ts-expect-error Property 'type' does not exist on type 'never'. ts(2339) - throw new Error(`Unknown cache type ${cacheOptions.type}`); + /** + * @param {Map>} moduleMemCaches mem caches for modules for better caching + */ + setModuleMemCaches(moduleMemCaches) { + this._moduleMemCaches = moduleMemCaches; + } + + /** + * @param {Dependency} dependency dependency + * @param {...any} args arguments, last argument is a function called with moduleGraph, dependency, ...args + * @returns {any} computed value or cached + */ + dependencyCacheProvide(dependency, ...args) { + /** @type {(moduleGraph: ModuleGraph, dependency: Dependency, ...args: any[]) => any} */ + const fn = args.pop(); + if (this._moduleMemCaches && this._cacheStage) { + const memCache = this._moduleMemCaches.get( + this.getParentModule(dependency) + ); + if (memCache !== undefined) { + return memCache.provide(dependency, this._cacheStage, ...args, () => + fn(this, dependency, ...args) + ); } } - new ResolverCachePlugin().apply(compiler); + if (this._cache === undefined) return fn(this, dependency, ...args); + return this._cache.provide(dependency, ...args, () => + fn(this, dependency, ...args) + ); + } - if (options.ignoreWarnings && options.ignoreWarnings.length > 0) { - const IgnoreWarningsPlugin = __webpack_require__(7373); - new IgnoreWarningsPlugin(options.ignoreWarnings).apply(compiler); - } + // TODO remove in webpack 6 + /** + * @param {Module} module the module + * @param {string} deprecateMessage message for the deprecation message + * @param {string} deprecationCode code for the deprecation + * @returns {ModuleGraph} the module graph + */ + static getModuleGraphForModule(module, deprecateMessage, deprecationCode) { + const fn = deprecateMap.get(deprecateMessage); + if (fn) return fn(module); + const newFn = util.deprecate( + /** + * @param {Module} module the module + * @returns {ModuleGraph} the module graph + */ + module => { + const moduleGraph = moduleGraphForModuleMap.get(module); + if (!moduleGraph) + throw new Error( + deprecateMessage + + "There was no ModuleGraph assigned to the Module for backward-compat (Use the new API)" + ); + return moduleGraph; + }, + deprecateMessage + ": Use new ModuleGraph API", + deprecationCode + ); + deprecateMap.set(deprecateMessage, newFn); + return newFn(module); + } - compiler.hooks.afterPlugins.call(compiler); - if (!compiler.inputFileSystem) { - throw new Error("No input filesystem provided"); - } - compiler.resolverFactory.hooks.resolveOptions - .for("normal") - .tap("WebpackOptionsApply", resolveOptions => { - resolveOptions = cleverMerge(options.resolve, resolveOptions); - resolveOptions.fileSystem = compiler.inputFileSystem; - return resolveOptions; - }); - compiler.resolverFactory.hooks.resolveOptions - .for("context") - .tap("WebpackOptionsApply", resolveOptions => { - resolveOptions = cleverMerge(options.resolve, resolveOptions); - resolveOptions.fileSystem = compiler.inputFileSystem; - resolveOptions.resolveToContext = true; - return resolveOptions; - }); - compiler.resolverFactory.hooks.resolveOptions - .for("loader") - .tap("WebpackOptionsApply", resolveOptions => { - resolveOptions = cleverMerge(options.resolveLoader, resolveOptions); - resolveOptions.fileSystem = compiler.inputFileSystem; - return resolveOptions; - }); - compiler.hooks.afterResolvers.call(compiler); - return options; + // TODO remove in webpack 6 + /** + * @param {Module} module the module + * @param {ModuleGraph} moduleGraph the module graph + * @returns {void} + */ + static setModuleGraphForModule(module, moduleGraph) { + moduleGraphForModuleMap.set(module, moduleGraph); + } + + // TODO remove in webpack 6 + /** + * @param {Module} module the module + * @returns {void} + */ + static clearModuleGraphForModule(module) { + moduleGraphForModuleMap.delete(module); } } -module.exports = WebpackOptionsApply; +// TODO remove in webpack 6 +/** @type {WeakMap} */ +const moduleGraphForModuleMap = new WeakMap(); + +// TODO remove in webpack 6 +/** @type {Map ModuleGraph>} */ +const deprecateMap = new Map(); + +module.exports = ModuleGraph; +module.exports.ModuleGraphConnection = ModuleGraphConnection; /***/ }), -/***/ 14452: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 40639: +/***/ (function(module) { "use strict"; /* @@ -58108,820 +53447,884 @@ module.exports = WebpackOptionsApply; -const { applyWebpackOptionsDefaults } = __webpack_require__(92988); -const { getNormalizedWebpackOptions } = __webpack_require__(26693); +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ -class WebpackOptionsDefaulter { - process(options) { - options = getNormalizedWebpackOptions(options); - applyWebpackOptionsDefaults(options); - return options; - } -} +/** + * Module itself is not connected, but transitive modules are connected transitively. + */ +const TRANSITIVE_ONLY = Symbol("transitive only"); -module.exports = WebpackOptionsDefaulter; +/** + * While determining the active state, this flag is used to signal a circular connection. + */ +const CIRCULAR_CONNECTION = Symbol("circular connection"); +/** @typedef {boolean | typeof TRANSITIVE_ONLY | typeof CIRCULAR_CONNECTION} ConnectionState */ -/***/ }), +/** + * @param {ConnectionState} a first + * @param {ConnectionState} b second + * @returns {ConnectionState} merged + */ +const addConnectionStates = (a, b) => { + if (a === true || b === true) return true; + if (a === false) return b; + if (b === false) return a; + if (a === TRANSITIVE_ONLY) return b; + if (b === TRANSITIVE_ONLY) return a; + return a; +}; -/***/ 98421: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * @param {ConnectionState} a first + * @param {ConnectionState} b second + * @returns {ConnectionState} intersected + */ +const intersectConnectionStates = (a, b) => { + if (a === false || b === false) return false; + if (a === true) return b; + if (b === true) return a; + if (a === CIRCULAR_CONNECTION) return b; + if (b === CIRCULAR_CONNECTION) return a; + return a; +}; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sergey Melyukov @smelukov -*/ +class ModuleGraphConnection { + /** + * @param {Module|null} originModule the referencing module + * @param {Dependency|null} dependency the referencing dependency + * @param {Module} module the referenced module + * @param {string=} explanation some extra detail + * @param {boolean=} weak the reference is weak + * @param {false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState=} condition condition for the connection + */ + constructor( + originModule, + dependency, + module, + explanation, + weak = false, + condition = undefined + ) { + this.originModule = originModule; + this.resolvedOriginModule = originModule; + this.dependency = dependency; + this.resolvedModule = module; + this.module = module; + this.weak = weak; + this.conditional = !!condition; + this._active = condition !== false; + /** @type {function(ModuleGraphConnection, RuntimeSpec): ConnectionState} */ + this.condition = condition || undefined; + /** @type {Set} */ + this.explanations = undefined; + if (explanation) { + this.explanations = new Set(); + this.explanations.add(explanation); + } + } + clone() { + const clone = new ModuleGraphConnection( + this.resolvedOriginModule, + this.dependency, + this.resolvedModule, + undefined, + this.weak, + this.condition + ); + clone.originModule = this.originModule; + clone.module = this.module; + clone.conditional = this.conditional; + clone._active = this._active; + if (this.explanations) clone.explanations = new Set(this.explanations); + return clone; + } + /** + * @param {function(ModuleGraphConnection, RuntimeSpec): ConnectionState} condition condition for the connection + * @returns {void} + */ + addCondition(condition) { + if (this.conditional) { + const old = this.condition; + this.condition = (c, r) => + intersectConnectionStates(old(c, r), condition(c, r)); + } else if (this._active) { + this.conditional = true; + this.condition = condition; + } + } -const mimeTypes = __webpack_require__(78585); -const path = __webpack_require__(71017); -const { RawSource } = __webpack_require__(51255); -const Generator = __webpack_require__(93401); -const RuntimeGlobals = __webpack_require__(16475); -const createHash = __webpack_require__(49835); -const { makePathsRelative } = __webpack_require__(82186); -const nonNumericOnlyHash = __webpack_require__(55668); + /** + * @param {string} explanation the explanation to add + * @returns {void} + */ + addExplanation(explanation) { + if (this.explanations === undefined) { + this.explanations = new Set(); + } + this.explanations.add(explanation); + } -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").AssetGeneratorOptions} AssetGeneratorOptions */ -/** @typedef {import("../../declarations/WebpackOptions").AssetModuleOutputPath} AssetModuleOutputPath */ -/** @typedef {import("../../declarations/WebpackOptions").RawPublicPath} RawPublicPath */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../Generator").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../NormalModule")} NormalModule */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("../util/Hash")} Hash */ + get explanation() { + if (this.explanations === undefined) return ""; + return Array.from(this.explanations).join(" "); + } -const mergeMaybeArrays = (a, b) => { - const set = new Set(); - if (Array.isArray(a)) for (const item of a) set.add(item); - else set.add(a); - if (Array.isArray(b)) for (const item of b) set.add(item); - else set.add(b); - return Array.from(set); -}; + // TODO webpack 5 remove + get active() { + throw new Error("Use getActiveState instead"); + } -const mergeAssetInfo = (a, b) => { - const result = { ...a, ...b }; - for (const key of Object.keys(a)) { - if (key in b) { - if (a[key] === b[key]) continue; - switch (key) { - case "fullhash": - case "chunkhash": - case "modulehash": - case "contenthash": - result[key] = mergeMaybeArrays(a[key], b[key]); - break; - case "immutable": - case "development": - case "hotModuleReplacement": - case "javascriptModule": - result[key] = a[key] || b[key]; - break; - case "related": - result[key] = mergeRelatedInfo(a[key], b[key]); - break; - default: - throw new Error(`Can't handle conflicting asset info for ${key}`); - } - } + /** + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true, if the connection is active + */ + isActive(runtime) { + if (!this.conditional) return this._active; + return this.condition(this, runtime) !== false; } - return result; -}; -const mergeRelatedInfo = (a, b) => { - const result = { ...a, ...b }; - for (const key of Object.keys(a)) { - if (key in b) { - if (a[key] === b[key]) continue; - result[key] = mergeMaybeArrays(a[key], b[key]); + /** + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true, if the connection is active + */ + isTargetActive(runtime) { + if (!this.conditional) return this._active; + return this.condition(this, runtime) === true; + } + + /** + * @param {RuntimeSpec} runtime the runtime + * @returns {ConnectionState} true: fully active, false: inactive, TRANSITIVE: direct module inactive, but transitive connection maybe active + */ + getActiveState(runtime) { + if (!this.conditional) return this._active; + return this.condition(this, runtime); + } + + /** + * @param {boolean} value active or not + * @returns {void} + */ + setActive(value) { + this.conditional = false; + this._active = value; + } + + set active(value) { + throw new Error("Use setActive instead"); + } +} + +/** @typedef {typeof TRANSITIVE_ONLY} TRANSITIVE_ONLY */ +/** @typedef {typeof CIRCULAR_CONNECTION} CIRCULAR_CONNECTION */ + +module.exports = ModuleGraphConnection; +module.exports.addConnectionStates = addConnectionStates; +module.exports.TRANSITIVE_ONLY = /** @type {typeof TRANSITIVE_ONLY} */ ( + TRANSITIVE_ONLY +); +module.exports.CIRCULAR_CONNECTION = /** @type {typeof CIRCULAR_CONNECTION} */ ( + CIRCULAR_CONNECTION +); + + +/***/ }), + +/***/ 3454: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { ConcatSource, RawSource, CachedSource } = __webpack_require__(51255); +const { UsageState } = __webpack_require__(63686); +const Template = __webpack_require__(39722); +const JavascriptModulesPlugin = __webpack_require__(89464); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./ExportsInfo")} ExportsInfo */ +/** @typedef {import("./ExportsInfo").ExportInfo} ExportInfo */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./ModuleTemplate")} ModuleTemplate */ +/** @typedef {import("./RequestShortener")} RequestShortener */ + +const joinIterableWithComma = iterable => { + // This is more performant than Array.from().join(", ") + // as it doesn't create an array + let str = ""; + let first = true; + for (const item of iterable) { + if (first) { + first = false; + } else { + str += ", "; } + str += item; } - return result; + return str; }; -const encodeDataUri = (encoding, source) => { - let encodedContent; +/** + * @param {ConcatSource} source output + * @param {string} indent spacing + * @param {ExportsInfo} exportsInfo data + * @param {ModuleGraph} moduleGraph moduleGraph + * @param {RequestShortener} requestShortener requestShortener + * @param {Set} alreadyPrinted deduplication set + * @returns {void} + */ +const printExportsInfoToSource = ( + source, + indent, + exportsInfo, + moduleGraph, + requestShortener, + alreadyPrinted = new Set() +) => { + const otherExportsInfo = exportsInfo.otherExportsInfo; - switch (encoding) { - case "base64": { - encodedContent = source.buffer().toString("base64"); - break; - } - case false: { - const content = source.source(); + let alreadyPrintedExports = 0; - if (typeof content !== "string") { - encodedContent = content.toString("utf-8"); - } + // determine exports to print + const printedExports = []; + for (const exportInfo of exportsInfo.orderedExports) { + if (!alreadyPrinted.has(exportInfo)) { + alreadyPrinted.add(exportInfo); + printedExports.push(exportInfo); + } else { + alreadyPrintedExports++; + } + } + let showOtherExports = false; + if (!alreadyPrinted.has(otherExportsInfo)) { + alreadyPrinted.add(otherExportsInfo); + showOtherExports = true; + } else { + alreadyPrintedExports++; + } - encodedContent = encodeURIComponent(encodedContent).replace( - /[!'()*]/g, - character => "%" + character.codePointAt(0).toString(16) + // print the exports + for (const exportInfo of printedExports) { + const target = exportInfo.getTarget(moduleGraph); + source.add( + Template.toComment( + `${indent}export ${JSON.stringify(exportInfo.name).slice( + 1, + -1 + )} [${exportInfo.getProvidedInfo()}] [${exportInfo.getUsedInfo()}] [${exportInfo.getRenameInfo()}]${ + target + ? ` -> ${target.module.readableIdentifier(requestShortener)}${ + target.export + ? ` .${target.export + .map(e => JSON.stringify(e).slice(1, -1)) + .join(".")}` + : "" + }` + : "" + }` + ) + "\n" + ); + if (exportInfo.exportsInfo) { + printExportsInfoToSource( + source, + indent + " ", + exportInfo.exportsInfo, + moduleGraph, + requestShortener, + alreadyPrinted ); - break; } - default: - throw new Error(`Unsupported encoding '${encoding}'`); } - return encodedContent; -}; + if (alreadyPrintedExports) { + source.add( + Template.toComment( + `${indent}... (${alreadyPrintedExports} already listed exports)` + ) + "\n" + ); + } -const decodeDataUriContent = (encoding, content) => { - const isBase64 = encoding === "base64"; - return isBase64 - ? Buffer.from(content, "base64") - : Buffer.from(decodeURIComponent(content), "ascii"); + if (showOtherExports) { + const target = otherExportsInfo.getTarget(moduleGraph); + if ( + target || + otherExportsInfo.provided !== false || + otherExportsInfo.getUsed(undefined) !== UsageState.Unused + ) { + const title = + printedExports.length > 0 || alreadyPrintedExports > 0 + ? "other exports" + : "exports"; + source.add( + Template.toComment( + `${indent}${title} [${otherExportsInfo.getProvidedInfo()}] [${otherExportsInfo.getUsedInfo()}]${ + target + ? ` -> ${target.module.readableIdentifier(requestShortener)}` + : "" + }` + ) + "\n" + ); + } + } }; -const JS_TYPES = new Set(["javascript"]); -const JS_AND_ASSET_TYPES = new Set(["javascript", "asset"]); +/** @type {WeakMap }>>} */ +const caches = new WeakMap(); -class AssetGenerator extends Generator { +class ModuleInfoHeaderPlugin { /** - * @param {AssetGeneratorOptions["dataUrl"]=} dataUrlOptions the options for the data url - * @param {string=} filename override for output.assetModuleFilename - * @param {RawPublicPath=} publicPath override for output.assetModulePublicPath - * @param {AssetModuleOutputPath=} outputPath the output path for the emitted file which is not included in the runtime import - * @param {boolean=} emit generate output asset + * @param {boolean=} verbose add more information like exports, runtime requirements and bailouts */ - constructor(dataUrlOptions, filename, publicPath, outputPath, emit) { - super(); - this.dataUrlOptions = dataUrlOptions; - this.filename = filename; - this.publicPath = publicPath; - this.outputPath = outputPath; - this.emit = emit; + constructor(verbose = true) { + this._verbose = verbose; } - /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code + * @param {Compiler} compiler the compiler + * @returns {void} */ - generate( - module, - { runtime, chunkGraph, runtimeTemplate, runtimeRequirements, type, getData } - ) { - switch (type) { - case "asset": - return module.originalSource(); - default: { - runtimeRequirements.add(RuntimeGlobals.module); - - const originalSource = module.originalSource(); - if (module.buildInfo.dataUrl) { - let encodedSource; - if (typeof this.dataUrlOptions === "function") { - encodedSource = this.dataUrlOptions.call( - null, - originalSource.source(), - { - filename: module.matchResource || module.resource, - module - } + apply(compiler) { + const { _verbose: verbose } = this; + compiler.hooks.compilation.tap("ModuleInfoHeaderPlugin", compilation => { + const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); + hooks.renderModulePackage.tap( + "ModuleInfoHeaderPlugin", + ( + moduleSource, + module, + { chunk, chunkGraph, moduleGraph, runtimeTemplate } + ) => { + const { requestShortener } = runtimeTemplate; + let cacheEntry; + let cache = caches.get(requestShortener); + if (cache === undefined) { + caches.set(requestShortener, (cache = new WeakMap())); + cache.set( + module, + (cacheEntry = { header: undefined, full: new WeakMap() }) ); } else { - /** @type {string | false | undefined} */ - let encoding = this.dataUrlOptions.encoding; - if (encoding === undefined) { - if ( - module.resourceResolveData && - module.resourceResolveData.encoding !== undefined - ) { - encoding = module.resourceResolveData.encoding; - } - } - if (encoding === undefined) { - encoding = "base64"; - } - let ext; - let mimeType = this.dataUrlOptions.mimetype; - if (mimeType === undefined) { - ext = path.extname(module.nameForCondition()); - if ( - module.resourceResolveData && - module.resourceResolveData.mimetype !== undefined - ) { - mimeType = - module.resourceResolveData.mimetype + - module.resourceResolveData.parameters; - } else if (ext) { - mimeType = mimeTypes.lookup(ext); - } - } - if (typeof mimeType !== "string") { - throw new Error( - "DataUrl can't be generated automatically, " + - `because there is no mimetype for "${ext}" in mimetype database. ` + - 'Either pass a mimetype via "generator.mimetype" or ' + - 'use type: "asset/resource" to create a resource file instead of a DataUrl' + cacheEntry = cache.get(module); + if (cacheEntry === undefined) { + cache.set( + module, + (cacheEntry = { header: undefined, full: new WeakMap() }) ); + } else if (!verbose) { + const cachedSource = cacheEntry.full.get(moduleSource); + if (cachedSource !== undefined) return cachedSource; } - - let encodedContent; - - if ( - module.resourceResolveData && - module.resourceResolveData.encoding === encoding && - decodeDataUriContent( - module.resourceResolveData.encoding, - module.resourceResolveData.encodedContent - ).equals(originalSource.buffer()) - ) { - encodedContent = module.resourceResolveData.encodedContent; - } else { - encodedContent = encodeDataUri(encoding, originalSource); - } - - encodedSource = `data:${mimeType}${ - encoding ? `;${encoding}` : "" - },${encodedContent}`; } - const data = getData(); - data.set("url", Buffer.from(encodedSource)); - return new RawSource( - `${RuntimeGlobals.module}.exports = ${JSON.stringify( - encodedSource - )};` - ); - } else { - const assetModuleFilename = - this.filename || runtimeTemplate.outputOptions.assetModuleFilename; - const hash = createHash(runtimeTemplate.outputOptions.hashFunction); - if (runtimeTemplate.outputOptions.hashSalt) { - hash.update(runtimeTemplate.outputOptions.hashSalt); + const source = new ConcatSource(); + let header = cacheEntry.header; + if (header === undefined) { + const req = module.readableIdentifier(requestShortener); + const reqStr = req.replace(/\*\//g, "*_/"); + const reqStrStar = "*".repeat(reqStr.length); + const headerStr = `/*!****${reqStrStar}****!*\\\n !*** ${reqStr} ***!\n \\****${reqStrStar}****/\n`; + header = new RawSource(headerStr); + cacheEntry.header = header; } - hash.update(originalSource.buffer()); - const fullHash = /** @type {string} */ ( - hash.digest(runtimeTemplate.outputOptions.hashDigest) - ); - const contentHash = nonNumericOnlyHash( - fullHash, - runtimeTemplate.outputOptions.hashDigestLength - ); - module.buildInfo.fullContentHash = fullHash; - const sourceFilename = makePathsRelative( - runtimeTemplate.compilation.compiler.context, - module.matchResource || module.resource, - runtimeTemplate.compilation.compiler.root - ).replace(/^\.\//, ""); - let { path: filename, info: assetInfo } = - runtimeTemplate.compilation.getAssetPathWithInfo( - assetModuleFilename, - { - module, - runtime, - filename: sourceFilename, - chunkGraph, - contentHash - } + source.add(header); + if (verbose) { + const exportsType = module.buildMeta.exportsType; + source.add( + Template.toComment( + exportsType + ? `${exportsType} exports` + : "unknown exports (runtime-defined)" + ) + "\n" ); - let assetPath; - if (this.publicPath !== undefined) { - const { path, info } = - runtimeTemplate.compilation.getAssetPathWithInfo( - this.publicPath, - { - module, - runtime, - filename: sourceFilename, - chunkGraph, - contentHash - } + if (exportsType) { + const exportsInfo = moduleGraph.getExportsInfo(module); + printExportsInfoToSource( + source, + "", + exportsInfo, + moduleGraph, + requestShortener ); - assetInfo = mergeAssetInfo(assetInfo, info); - assetPath = JSON.stringify(path + filename); - } else { - runtimeRequirements.add(RuntimeGlobals.publicPath); // add __webpack_require__.p - assetPath = runtimeTemplate.concatenation( - { expr: RuntimeGlobals.publicPath }, - filename + } + source.add( + Template.toComment( + `runtime requirements: ${joinIterableWithComma( + chunkGraph.getModuleRuntimeRequirements(module, chunk.runtime) + )}` + ) + "\n" ); - } - assetInfo = { - sourceFilename, - ...assetInfo - }; - if (this.outputPath) { - const { path: outputPath, info } = - runtimeTemplate.compilation.getAssetPathWithInfo( - this.outputPath, - { - module, - runtime, - filename: sourceFilename, - chunkGraph, - contentHash + const optimizationBailout = + moduleGraph.getOptimizationBailout(module); + if (optimizationBailout) { + for (const text of optimizationBailout) { + let code; + if (typeof text === "function") { + code = text(requestShortener); + } else { + code = text; } - ); - assetInfo = mergeAssetInfo(assetInfo, info); - filename = path.posix.join(outputPath, filename); - } - module.buildInfo.filename = filename; - module.buildInfo.assetInfo = assetInfo; - if (getData) { - // Due to code generation caching module.buildInfo.XXX can't used to store such information - // It need to be stored in the code generation results instead, where it's cached too - // TODO webpack 6 For back-compat reasons we also store in on module.buildInfo - const data = getData(); - data.set("fullContentHash", fullHash); - data.set("filename", filename); - data.set("assetInfo", assetInfo); + source.add(Template.toComment(`${code}`) + "\n"); + } + } + source.add(moduleSource); + return source; + } else { + source.add(moduleSource); + const cachedSource = new CachedSource(source); + cacheEntry.full.set(moduleSource, cachedSource); + return cachedSource; } - - return new RawSource( - `${RuntimeGlobals.module}.exports = ${assetPath};` - ); } - } - } + ); + hooks.chunkHash.tap("ModuleInfoHeaderPlugin", (chunk, hash) => { + hash.update("ModuleInfoHeaderPlugin"); + hash.update("1"); + }); + }); } +} +module.exports = ModuleInfoHeaderPlugin; - /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) - */ - getTypes(module) { - if ((module.buildInfo && module.buildInfo.dataUrl) || this.emit === false) { - return JS_TYPES; - } else { - return JS_AND_ASSET_TYPES; - } - } +/***/ }), + +/***/ 32882: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const WebpackError = __webpack_require__(53799); + +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Module")} Module */ + +const previouslyPolyfilledBuiltinModules = { + assert: "assert/", + buffer: "buffer/", + console: "console-browserify", + constants: "constants-browserify", + crypto: "crypto-browserify", + domain: "domain-browser", + events: "events/", + http: "stream-http", + https: "https-browserify", + os: "os-browserify/browser", + path: "path-browserify", + punycode: "punycode/", + process: "process/browser", + querystring: "querystring-es3", + stream: "stream-browserify", + _stream_duplex: "readable-stream/duplex", + _stream_passthrough: "readable-stream/passthrough", + _stream_readable: "readable-stream/readable", + _stream_transform: "readable-stream/transform", + _stream_writable: "readable-stream/writable", + string_decoder: "string_decoder/", + sys: "util/", + timers: "timers-browserify", + tty: "tty-browserify", + url: "url/", + util: "util/", + vm: "vm-browserify", + zlib: "browserify-zlib" +}; + +class ModuleNotFoundError extends WebpackError { /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module + * @param {Module} module module tied to dependency + * @param {Error&any} err error thrown + * @param {DependencyLocation} loc location of dependency */ - getSize(module, type) { - switch (type) { - case "asset": { - const originalSource = module.originalSource(); - - if (!originalSource) { - return 0; - } + constructor(module, err, loc) { + let message = `Module not found: ${err.toString()}`; - return originalSource.size(); + // TODO remove in webpack 6 + const match = err.message.match(/Can't resolve '([^']+)'/); + if (match) { + const request = match[1]; + const alias = previouslyPolyfilledBuiltinModules[request]; + if (alias) { + const pathIndex = alias.indexOf("/"); + const dependency = pathIndex > 0 ? alias.slice(0, pathIndex) : alias; + message += + "\n\n" + + "BREAKING CHANGE: " + + "webpack < 5 used to include polyfills for node.js core modules by default.\n" + + "This is no longer the case. Verify if you need this module and configure a polyfill for it.\n\n"; + message += + "If you want to include a polyfill, you need to:\n" + + `\t- add a fallback 'resolve.fallback: { "${request}": require.resolve("${alias}") }'\n` + + `\t- install '${dependency}'\n`; + message += + "If you don't want to include a polyfill, you can use an empty module like this:\n" + + `\tresolve.fallback: { "${request}": false }`; } - default: - if (module.buildInfo && module.buildInfo.dataUrl) { - const originalSource = module.originalSource(); - - if (!originalSource) { - return 0; - } - - // roughly for data url - // Example: m.exports="data:image/png;base64,ag82/f+2==" - // 4/3 = base64 encoding - // 34 = ~ data url header + footer + rounding - return originalSource.size() * 1.34 + 36; - } else { - // it's only estimated so this number is probably fine - // Example: m.exports=r.p+"0123456789012345678901.ext" - return 42; - } } - } - /** - * @param {Hash} hash hash that will be modified - * @param {UpdateHashContext} updateHashContext context for updating hash - */ - updateHash(hash, { module }) { - hash.update(module.buildInfo.dataUrl ? "data-url" : "resource"); + super(message); + + this.name = "ModuleNotFoundError"; + this.details = err.details; + this.module = module; + this.error = err; + this.loc = loc; } } -module.exports = AssetGenerator; +module.exports = ModuleNotFoundError; /***/ }), -/***/ 16109: +/***/ 58443: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Yuta Hiroto @hiroppy + Author Tobias Koppers @sokra */ -const { cleverMerge } = __webpack_require__(60839); -const { compareModulesByIdentifier } = __webpack_require__(29579); -const createSchemaValidation = __webpack_require__(32540); -const memoize = __webpack_require__(78676); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ - -const getSchema = name => { - const { definitions } = __webpack_require__(73342); - return { - definitions, - oneOf: [{ $ref: `#/definitions/${name}` }] - }; -}; - -const generatorValidationOptions = { - name: "Asset Modules Plugin", - baseDataPath: "generator" -}; -const validateGeneratorOptions = { - asset: createSchemaValidation( - __webpack_require__(55125), - () => getSchema("AssetGeneratorOptions"), - generatorValidationOptions - ), - "asset/resource": createSchemaValidation( - __webpack_require__(4405), - () => getSchema("AssetResourceGeneratorOptions"), - generatorValidationOptions - ), - "asset/inline": createSchemaValidation( - __webpack_require__(62368), - () => getSchema("AssetInlineGeneratorOptions"), - generatorValidationOptions - ) -}; - -const validateParserOptions = createSchemaValidation( - __webpack_require__(45020), - () => getSchema("AssetParserOptions"), - { - name: "Asset Modules Plugin", - baseDataPath: "parser" - } -); - -const getAssetGenerator = memoize(() => __webpack_require__(98421)); -const getAssetParser = memoize(() => __webpack_require__(91112)); -const getAssetSourceParser = memoize(() => __webpack_require__(30953)); -const getAssetSourceGenerator = memoize(() => - __webpack_require__(18749) -); +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); -const type = "asset"; -const plugin = "AssetModulesPlugin"; +const WASM_HEADER = Buffer.from([0x00, 0x61, 0x73, 0x6d]); -class AssetModulesPlugin { +class ModuleParseError extends WebpackError { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {string | Buffer} source source code + * @param {Error&any} err the parse error + * @param {string[]} loaders the loaders used + * @param {string} type module type */ - apply(compiler) { - compiler.hooks.compilation.tap( - plugin, - (compilation, { normalModuleFactory }) => { - normalModuleFactory.hooks.createParser - .for("asset") - .tap(plugin, parserOptions => { - validateParserOptions(parserOptions); - parserOptions = cleverMerge( - compiler.options.module.parser.asset, - parserOptions - ); - - let dataUrlCondition = parserOptions.dataUrlCondition; - if (!dataUrlCondition || typeof dataUrlCondition === "object") { - dataUrlCondition = { - maxSize: 8096, - ...dataUrlCondition - }; - } - - const AssetParser = getAssetParser(); - - return new AssetParser(dataUrlCondition); - }); - normalModuleFactory.hooks.createParser - .for("asset/inline") - .tap(plugin, parserOptions => { - const AssetParser = getAssetParser(); + constructor(source, err, loaders, type) { + let message = "Module parse failed: " + (err && err.message); + let loc = undefined; - return new AssetParser(true); - }); - normalModuleFactory.hooks.createParser - .for("asset/resource") - .tap(plugin, parserOptions => { - const AssetParser = getAssetParser(); + if ( + ((Buffer.isBuffer(source) && source.slice(0, 4).equals(WASM_HEADER)) || + (typeof source === "string" && /^\0asm/.test(source))) && + !type.startsWith("webassembly") + ) { + message += + "\nThe module seem to be a WebAssembly module, but module is not flagged as WebAssembly module for webpack."; + message += + "\nBREAKING CHANGE: Since webpack 5 WebAssembly is not enabled by default and flagged as experimental feature."; + message += + "\nYou need to enable one of the WebAssembly experiments via 'experiments.asyncWebAssembly: true' (based on async modules) or 'experiments.syncWebAssembly: true' (like webpack 4, deprecated)."; + message += + "\nFor files that transpile to WebAssembly, make sure to set the module type in the 'module.rules' section of the config (e. g. 'type: \"webassembly/async\"')."; + } else if (!loaders) { + message += + "\nYou may need an appropriate loader to handle this file type."; + } else if (loaders.length >= 1) { + message += `\nFile was processed with these loaders:${loaders + .map(loader => `\n * ${loader}`) + .join("")}`; + message += + "\nYou may need an additional loader to handle the result of these loaders."; + } else { + message += + "\nYou may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders"; + } - return new AssetParser(false); - }); - normalModuleFactory.hooks.createParser - .for("asset/source") - .tap(plugin, parserOptions => { - const AssetSourceParser = getAssetSourceParser(); + if ( + err && + err.loc && + typeof err.loc === "object" && + typeof err.loc.line === "number" + ) { + var lineNumber = err.loc.line; - return new AssetSourceParser(); - }); + if ( + Buffer.isBuffer(source) || + /[\0\u0001\u0002\u0003\u0004\u0005\u0006\u0007]/.test(source) + ) { + // binary file + message += "\n(Source code omitted for this binary file)"; + } else { + const sourceLines = source.split(/\r?\n/); + const start = Math.max(0, lineNumber - 3); + const linesBefore = sourceLines.slice(start, lineNumber - 1); + const theLine = sourceLines[lineNumber - 1]; + const linesAfter = sourceLines.slice(lineNumber, lineNumber + 2); - for (const type of ["asset", "asset/inline", "asset/resource"]) { - normalModuleFactory.hooks.createGenerator - .for(type) - .tap(plugin, generatorOptions => { - validateGeneratorOptions[type](generatorOptions); + message += + linesBefore.map(l => `\n| ${l}`).join("") + + `\n> ${theLine}` + + linesAfter.map(l => `\n| ${l}`).join(""); + } - let dataUrl = undefined; - if (type !== "asset/resource") { - dataUrl = generatorOptions.dataUrl; - if (!dataUrl || typeof dataUrl === "object") { - dataUrl = { - encoding: undefined, - mimetype: undefined, - ...dataUrl - }; - } - } + loc = { start: err.loc }; + } else if (err && err.stack) { + message += "\n" + err.stack; + } - let filename = undefined; - let publicPath = undefined; - let outputPath = undefined; - if (type !== "asset/inline") { - filename = generatorOptions.filename; - publicPath = generatorOptions.publicPath; - outputPath = generatorOptions.outputPath; - } + super(message); - const AssetGenerator = getAssetGenerator(); + this.name = "ModuleParseError"; + this.loc = loc; + this.error = err; + } - return new AssetGenerator( - dataUrl, - filename, - publicPath, - outputPath, - generatorOptions.emit !== false - ); - }); - } - normalModuleFactory.hooks.createGenerator - .for("asset/source") - .tap(plugin, () => { - const AssetSourceGenerator = getAssetSourceGenerator(); + serialize(context) { + const { write } = context; - return new AssetSourceGenerator(); - }); + write(this.error); - compilation.hooks.renderManifest.tap(plugin, (result, options) => { - const { chunkGraph } = compilation; - const { chunk, codeGenerationResults } = options; + super.serialize(context); + } - const modules = chunkGraph.getOrderedChunkModulesIterableBySourceType( - chunk, - "asset", - compareModulesByIdentifier - ); - if (modules) { - for (const module of modules) { - try { - const codeGenResult = codeGenerationResults.get( - module, - chunk.runtime - ); - result.push({ - render: () => codeGenResult.sources.get(type), - filename: - module.buildInfo.filename || - codeGenResult.data.get("filename"), - info: - module.buildInfo.assetInfo || - codeGenResult.data.get("assetInfo"), - auxiliary: true, - identifier: `assetModule${chunkGraph.getModuleId(module)}`, - hash: - module.buildInfo.fullContentHash || - codeGenResult.data.get("fullContentHash") - }); - } catch (e) { - e.message += `\nduring rendering of asset ${module.identifier()}`; - throw e; - } - } - } + deserialize(context) { + const { read } = context; - return result; - }); + this.error = read(); - compilation.hooks.prepareModuleExecution.tap( - "AssetModulesPlugin", - (options, context) => { - const { codeGenerationResult } = options; - const source = codeGenerationResult.sources.get("asset"); - if (source === undefined) return; - context.assets.set(codeGenerationResult.data.get("filename"), { - source, - info: codeGenerationResult.data.get("assetInfo") - }); - } - ); - } - ); + super.deserialize(context); } } -module.exports = AssetModulesPlugin; +makeSerializable(ModuleParseError, "webpack/lib/ModuleParseError"); + +module.exports = ModuleParseError; /***/ }), -/***/ 91112: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 36418: +/***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Yuta Hiroto @hiroppy + Author Tobias Koppers @sokra */ -const Parser = __webpack_require__(11715); +class ModuleProfile { + constructor() { + this.startTime = Date.now(); -/** @typedef {import("../../declarations/WebpackOptions").AssetParserOptions} AssetParserOptions */ -/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ + this.factoryStartTime = 0; + this.factoryEndTime = 0; + this.factory = 0; + this.factoryParallelismFactor = 0; -class AssetParser extends Parser { - /** - * @param {AssetParserOptions["dataUrlCondition"] | boolean} dataUrlCondition condition for inlining as DataUrl - */ - constructor(dataUrlCondition) { - super(); - this.dataUrlCondition = dataUrlCondition; - } + this.restoringStartTime = 0; + this.restoringEndTime = 0; + this.restoring = 0; + this.restoringParallelismFactor = 0; - /** - * @param {string | Buffer | PreparsedAst} source the source to parse - * @param {ParserState} state the parser state - * @returns {ParserState} the parser state - */ - parse(source, state) { - if (typeof source === "object" && !Buffer.isBuffer(source)) { - throw new Error("AssetParser doesn't accept preparsed AST"); - } - state.module.buildInfo.strict = true; - state.module.buildMeta.exportsType = "default"; + this.integrationStartTime = 0; + this.integrationEndTime = 0; + this.integration = 0; + this.integrationParallelismFactor = 0; - if (typeof this.dataUrlCondition === "function") { - state.module.buildInfo.dataUrl = this.dataUrlCondition(source, { - filename: state.module.matchResource || state.module.resource, - module: state.module - }); - } else if (typeof this.dataUrlCondition === "boolean") { - state.module.buildInfo.dataUrl = this.dataUrlCondition; - } else if ( - this.dataUrlCondition && - typeof this.dataUrlCondition === "object" - ) { - state.module.buildInfo.dataUrl = - Buffer.byteLength(source) <= this.dataUrlCondition.maxSize; - } else { - throw new Error("Unexpected dataUrlCondition type"); - } + this.buildingStartTime = 0; + this.buildingEndTime = 0; + this.building = 0; + this.buildingParallelismFactor = 0; - return state; + this.storingStartTime = 0; + this.storingEndTime = 0; + this.storing = 0; + this.storingParallelismFactor = 0; + + this.additionalFactoryTimes = undefined; + this.additionalFactories = 0; + this.additionalFactoriesParallelismFactor = 0; + + /** @deprecated */ + this.additionalIntegration = 0; } -} -module.exports = AssetParser; + markFactoryStart() { + this.factoryStartTime = Date.now(); + } + markFactoryEnd() { + this.factoryEndTime = Date.now(); + this.factory = this.factoryEndTime - this.factoryStartTime; + } -/***/ }), + markRestoringStart() { + this.restoringStartTime = Date.now(); + } -/***/ 18749: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + markRestoringEnd() { + this.restoringEndTime = Date.now(); + this.restoring = this.restoringEndTime - this.restoringStartTime; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sergey Melyukov @smelukov -*/ + markIntegrationStart() { + this.integrationStartTime = Date.now(); + } + markIntegrationEnd() { + this.integrationEndTime = Date.now(); + this.integration = this.integrationEndTime - this.integrationStartTime; + } + markBuildingStart() { + this.buildingStartTime = Date.now(); + } -const { RawSource } = __webpack_require__(51255); -const Generator = __webpack_require__(93401); -const RuntimeGlobals = __webpack_require__(16475); + markBuildingEnd() { + this.buildingEndTime = Date.now(); + this.building = this.buildingEndTime - this.buildingStartTime; + } -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../NormalModule")} NormalModule */ + markStoringStart() { + this.storingStartTime = Date.now(); + } -const TYPES = new Set(["javascript"]); + markStoringEnd() { + this.storingEndTime = Date.now(); + this.storing = this.storingEndTime - this.storingStartTime; + } -class AssetSourceGenerator extends Generator { + // This depends on timing so we ignore it for coverage + /* istanbul ignore next */ /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code + * Merge this profile into another one + * @param {ModuleProfile} realProfile the profile to merge into + * @returns {void} */ - generate(module, { chunkGraph, runtimeTemplate, runtimeRequirements }) { - runtimeRequirements.add(RuntimeGlobals.module); + mergeInto(realProfile) { + realProfile.additionalFactories = this.factory; + (realProfile.additionalFactoryTimes = + realProfile.additionalFactoryTimes || []).push({ + start: this.factoryStartTime, + end: this.factoryEndTime + }); + } +} - const originalSource = module.originalSource(); +module.exports = ModuleProfile; - if (!originalSource) { - return new RawSource(""); - } - const content = originalSource.source(); +/***/ }), + +/***/ 94560: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - let encodedSource; - if (typeof content === "string") { - encodedSource = content; - } else { - encodedSource = content.toString("utf-8"); - } - return new RawSource( - `${RuntimeGlobals.module}.exports = ${JSON.stringify(encodedSource)};` - ); - } - /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) - */ - getTypes(module) { - return TYPES; - } +const WebpackError = __webpack_require__(53799); + +/** @typedef {import("./Module")} Module */ + +class ModuleRestoreError extends WebpackError { /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module + * @param {Module} module module tied to dependency + * @param {string | Error} err error thrown */ - getSize(module, type) { - const originalSource = module.originalSource(); - - if (!originalSource) { - return 0; + constructor(module, err) { + let message = "Module restore failed: "; + let details = undefined; + if (err !== null && typeof err === "object") { + if (typeof err.stack === "string" && err.stack) { + const stack = err.stack; + message += stack; + } else if (typeof err.message === "string" && err.message) { + message += err.message; + } else { + message += err; + } + } else { + message += String(err); } - // Example: m.exports="abcd" - return originalSource.size() + 12; + super(message); + + this.name = "ModuleRestoreError"; + this.details = details; + this.module = module; + this.error = err; } } -module.exports = AssetSourceGenerator; +module.exports = ModuleRestoreError; /***/ }), -/***/ 30953: +/***/ 59001: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Yuta Hiroto @hiroppy + Author Tobias Koppers @sokra */ -const Parser = __webpack_require__(11715); +const WebpackError = __webpack_require__(53799); -/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ +/** @typedef {import("./Module")} Module */ -class AssetSourceParser extends Parser { +class ModuleStoreError extends WebpackError { /** - * @param {string | Buffer | PreparsedAst} source the source to parse - * @param {ParserState} state the parser state - * @returns {ParserState} the parser state + * @param {Module} module module tied to dependency + * @param {string | Error} err error thrown */ - parse(source, state) { - if (typeof source === "object" && !Buffer.isBuffer(source)) { - throw new Error("AssetSourceParser doesn't accept preparsed AST"); + constructor(module, err) { + let message = "Module storing failed: "; + let details = undefined; + if (err !== null && typeof err === "object") { + if (typeof err.stack === "string" && err.stack) { + const stack = err.stack; + message += stack; + } else if (typeof err.message === "string" && err.message) { + message += err.message; + } else { + message += err; + } + } else { + message += String(err); } - const { module } = state; - module.buildInfo.strict = true; - module.buildMeta.exportsType = "default"; - return state; + super(message); + + this.name = "ModuleStoreError"; + this.details = details; + this.module = module; + this.error = err; } } -module.exports = AssetSourceParser; +module.exports = ModuleStoreError; /***/ }), -/***/ 19684: +/***/ 62677: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -58932,129 +54335,194 @@ module.exports = AssetSourceParser; -const { RawSource } = __webpack_require__(51255); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); +const util = __webpack_require__(73837); +const memoize = __webpack_require__(78676); -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./util/Hash")} Hash */ -const TYPES = new Set(["javascript"]); +const getJavascriptModulesPlugin = memoize(() => + __webpack_require__(89464) +); -class RawDataUrlModule extends Module { +// TODO webpack 6: remove this class +class ModuleTemplate { /** - * @param {string} url raw url - * @param {string} identifier unique identifier - * @param {string=} readableIdentifier readable identifier + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @param {Compilation} compilation the compilation */ - constructor(url, identifier, readableIdentifier) { - super("asset/raw-data-url", null); - this.url = url; - this.urlBuffer = url ? Buffer.from(url) : undefined; - this.identifierStr = identifier || this.url; - this.readableIdentifierStr = readableIdentifier || this.identifierStr; + constructor(runtimeTemplate, compilation) { + this._runtimeTemplate = runtimeTemplate; + this.type = "javascript"; + this.hooks = Object.freeze({ + content: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .renderModuleContent.tap( + options, + (source, module, renderContext) => + fn( + source, + module, + renderContext, + renderContext.dependencyTemplates + ) + ); + }, + "ModuleTemplate.hooks.content is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModuleContent instead)", + "DEP_MODULE_TEMPLATE_CONTENT" + ) + }, + module: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .renderModuleContent.tap( + options, + (source, module, renderContext) => + fn( + source, + module, + renderContext, + renderContext.dependencyTemplates + ) + ); + }, + "ModuleTemplate.hooks.module is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModuleContent instead)", + "DEP_MODULE_TEMPLATE_MODULE" + ) + }, + render: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .renderModuleContainer.tap( + options, + (source, module, renderContext) => + fn( + source, + module, + renderContext, + renderContext.dependencyTemplates + ) + ); + }, + "ModuleTemplate.hooks.render is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModuleContainer instead)", + "DEP_MODULE_TEMPLATE_RENDER" + ) + }, + package: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .renderModulePackage.tap( + options, + (source, module, renderContext) => + fn( + source, + module, + renderContext, + renderContext.dependencyTemplates + ) + ); + }, + "ModuleTemplate.hooks.package is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModulePackage instead)", + "DEP_MODULE_TEMPLATE_PACKAGE" + ) + }, + hash: { + tap: util.deprecate( + (options, fn) => { + compilation.hooks.fullHash.tap(options, fn); + }, + "ModuleTemplate.hooks.hash is deprecated (use Compilation.hooks.fullHash instead)", + "DEP_MODULE_TEMPLATE_HASH" + ) + } + }); } +} - /** - * @returns {Set} types available (do not mutate) - */ - getSourceTypes() { - return TYPES; - } +Object.defineProperty(ModuleTemplate.prototype, "runtimeTemplate", { + get: util.deprecate( + /** + * @this {ModuleTemplate} + * @returns {TODO} output options + */ + function () { + return this._runtimeTemplate; + }, + "ModuleTemplate.runtimeTemplate is deprecated (use Compilation.runtimeTemplate instead)", + "DEP_WEBPACK_CHUNK_TEMPLATE_OUTPUT_OPTIONS" + ) +}); - /** - * @returns {string} a unique identifier of the module - */ - identifier() { - return this.identifierStr; - } +module.exports = ModuleTemplate; - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - if (this.url === undefined) this.url = this.urlBuffer.toString(); - return Math.max(1, this.url.length); - } - /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module - */ - readableIdentifier(requestShortener) { - return requestShortener.shorten(this.readableIdentifierStr); - } +/***/ }), - /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} - */ - needBuild(context, callback) { - return callback(null, !this.buildMeta); - } +/***/ 11234: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} - */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = {}; - this.buildInfo = { - cacheable: true - }; - callback(); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration(context) { - if (this.url === undefined) this.url = this.urlBuffer.toString(); - const sources = new Map(); - sources.set( - "javascript", - new RawSource(`module.exports = ${JSON.stringify(this.url)};`) - ); - const data = new Map(); - data.set("url", this.urlBuffer); - const runtimeRequirements = new Set(); - runtimeRequirements.add(RuntimeGlobals.module); - return { sources, runtimeRequirements, data }; - } + +const { cleanUp } = __webpack_require__(59985); +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); + +class ModuleWarning extends WebpackError { /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} + * @param {Error} warning error thrown + * @param {{from?: string|null}} info additional info */ - updateHash(hash, context) { - hash.update(this.urlBuffer); - super.updateHash(hash, context); + constructor(warning, { from = null } = {}) { + let message = "Module Warning"; + + if (from) { + message += ` (from ${from}):\n`; + } else { + message += ": "; + } + + if (warning && typeof warning === "object" && warning.message) { + message += warning.message; + } else if (warning) { + message += String(warning); + } + + super(message); + + this.name = "ModuleWarning"; + this.warning = warning; + this.details = + warning && typeof warning === "object" && warning.stack + ? cleanUp(warning.stack, this.message) + : undefined; } serialize(context) { const { write } = context; - write(this.urlBuffer); - write(this.identifierStr); - write(this.readableIdentifierStr); + write(this.warning); super.serialize(context); } @@ -59062,22 +54530,20 @@ class RawDataUrlModule extends Module { deserialize(context) { const { read } = context; - this.urlBuffer = read(); - this.identifierStr = read(); - this.readableIdentifierStr = read(); + this.warning = read(); super.deserialize(context); } } -makeSerializable(RawDataUrlModule, "webpack/lib/asset/RawDataUrlModule"); +makeSerializable(ModuleWarning, "webpack/lib/ModuleWarning"); -module.exports = RawDataUrlModule; +module.exports = ModuleWarning; /***/ }), -/***/ 41153: +/***/ 33370: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -59088,3801 +54554,3670 @@ module.exports = RawDataUrlModule; -const InitFragment = __webpack_require__(55870); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); +const asyncLib = __webpack_require__(78175); +const { SyncHook, MultiHook } = __webpack_require__(41242); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +const ConcurrentCompilationError = __webpack_require__(95735); +const MultiStats = __webpack_require__(24170); +const MultiWatching = __webpack_require__(81128); +const ArrayQueue = __webpack_require__(41792); + +/** @template T @typedef {import("tapable").AsyncSeriesHook} AsyncSeriesHook */ +/** @template T @template R @typedef {import("tapable").SyncBailHook} SyncBailHook */ +/** @typedef {import("../declarations/WebpackOptions").WatchOptions} WatchOptions */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Stats")} Stats */ +/** @typedef {import("./Watching")} Watching */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("./util/fs").IntermediateFileSystem} IntermediateFileSystem */ +/** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */ +/** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */ + +/** + * @template T + * @callback Callback + * @param {(Error | null)=} err + * @param {T=} result + */ + +/** + * @callback RunWithDependenciesHandler + * @param {Compiler} compiler + * @param {Callback} callback + */ + +/** + * @typedef {Object} MultiCompilerOptions + * @property {number=} parallelism how many Compilers are allows to run at the same time in parallel + */ + +module.exports = class MultiCompiler { + /** + * @param {Compiler[] | Record} compilers child compilers + * @param {MultiCompilerOptions} options options + */ + constructor(compilers, options) { + if (!Array.isArray(compilers)) { + compilers = Object.keys(compilers).map(name => { + compilers[name].name = name; + return compilers[name]; + }); + } + + this.hooks = Object.freeze({ + /** @type {SyncHook<[MultiStats]>} */ + done: new SyncHook(["stats"]), + /** @type {MultiHook>} */ + invalid: new MultiHook(compilers.map(c => c.hooks.invalid)), + /** @type {MultiHook>} */ + run: new MultiHook(compilers.map(c => c.hooks.run)), + /** @type {SyncHook<[]>} */ + watchClose: new SyncHook([]), + /** @type {MultiHook>} */ + watchRun: new MultiHook(compilers.map(c => c.hooks.watchRun)), + /** @type {MultiHook>} */ + infrastructureLog: new MultiHook( + compilers.map(c => c.hooks.infrastructureLog) + ) + }); + this.compilers = compilers; + /** @type {MultiCompilerOptions} */ + this._options = { + parallelism: options.parallelism || Infinity + }; + /** @type {WeakMap} */ + this.dependencies = new WeakMap(); + this.running = false; + + /** @type {Stats[]} */ + const compilerStats = this.compilers.map(() => null); + let doneCompilers = 0; + for (let index = 0; index < this.compilers.length; index++) { + const compiler = this.compilers[index]; + const compilerIndex = index; + let compilerDone = false; + compiler.hooks.done.tap("MultiCompiler", stats => { + if (!compilerDone) { + compilerDone = true; + doneCompilers++; + } + compilerStats[compilerIndex] = stats; + if (doneCompilers === this.compilers.length) { + this.hooks.done.call(new MultiStats(compilerStats)); + } + }); + compiler.hooks.invalid.tap("MultiCompiler", () => { + if (compilerDone) { + compilerDone = false; + doneCompilers--; + } + }); + } + } + + get options() { + return Object.assign( + this.compilers.map(c => c.options), + this._options + ); + } + + get outputPath() { + let commonPath = this.compilers[0].outputPath; + for (const compiler of this.compilers) { + while ( + compiler.outputPath.indexOf(commonPath) !== 0 && + /[/\\]/.test(commonPath) + ) { + commonPath = commonPath.replace(/[/\\][^/\\]*$/, ""); + } + } + + if (!commonPath && this.compilers[0].outputPath[0] === "/") return "/"; + return commonPath; + } + + get inputFileSystem() { + throw new Error("Cannot read inputFileSystem of a MultiCompiler"); + } + + get outputFileSystem() { + throw new Error("Cannot read outputFileSystem of a MultiCompiler"); + } + + get watchFileSystem() { + throw new Error("Cannot read watchFileSystem of a MultiCompiler"); + } + + get intermediateFileSystem() { + throw new Error("Cannot read outputFileSystem of a MultiCompiler"); + } -/** - * @typedef {GenerateContext} Context - */ -class AwaitDependenciesInitFragment extends InitFragment { /** - * @param {Set} promises the promises that should be awaited + * @param {InputFileSystem} value the new input file system */ - constructor(promises) { - super( - undefined, - InitFragment.STAGE_ASYNC_DEPENDENCIES, - 0, - "await-dependencies" - ); - this.promises = promises; + set inputFileSystem(value) { + for (const compiler of this.compilers) { + compiler.inputFileSystem = value; + } } - merge(other) { - const promises = new Set(other.promises); - for (const p of this.promises) { - promises.add(p); + /** + * @param {OutputFileSystem} value the new output file system + */ + set outputFileSystem(value) { + for (const compiler of this.compilers) { + compiler.outputFileSystem = value; } - return new AwaitDependenciesInitFragment(promises); } /** - * @param {Context} context context - * @returns {string|Source} the source code that will be included as initialization code + * @param {WatchFileSystem} value the new watch file system */ - getContent({ runtimeRequirements }) { - runtimeRequirements.add(RuntimeGlobals.module); - const promises = this.promises; - if (promises.size === 0) { - return ""; - } - if (promises.size === 1) { - for (const p of promises) { - return Template.asString([ - `var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${p}]);`, - `${p} = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];`, - "" - ]); - } + set watchFileSystem(value) { + for (const compiler of this.compilers) { + compiler.watchFileSystem = value; } - const sepPromises = Array.from(promises).join(", "); - // TODO check if destructuring is supported - return Template.asString([ - `var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${sepPromises}]);`, - `([${sepPromises}] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);`, - "" - ]); } -} - -module.exports = AwaitDependenciesInitFragment; - - -/***/ }), - -/***/ 59498: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - + /** + * @param {IntermediateFileSystem} value the new intermediate file system + */ + set intermediateFileSystem(value) { + for (const compiler of this.compilers) { + compiler.intermediateFileSystem = value; + } + } -const HarmonyImportDependency = __webpack_require__(57154); - -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ + getInfrastructureLogger(name) { + return this.compilers[0].getInfrastructureLogger(name); + } -class InferAsyncModulesPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {Compiler} compiler the child compiler + * @param {string[]} dependencies its dependencies * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap("InferAsyncModulesPlugin", compilation => { - const { moduleGraph } = compilation; - compilation.hooks.finishModules.tap( - "InferAsyncModulesPlugin", - modules => { - /** @type {Set} */ - const queue = new Set(); - for (const module of modules) { - if (module.buildMeta && module.buildMeta.async) { - queue.add(module); - } + setDependencies(compiler, dependencies) { + this.dependencies.set(compiler, dependencies); + } + + /** + * @param {Callback} callback signals when the validation is complete + * @returns {boolean} true if the dependencies are valid + */ + validateDependencies(callback) { + /** @type {Set<{source: Compiler, target: Compiler}>} */ + const edges = new Set(); + /** @type {string[]} */ + const missing = []; + const targetFound = compiler => { + for (const edge of edges) { + if (edge.target === compiler) { + return true; + } + } + return false; + }; + const sortEdges = (e1, e2) => { + return ( + e1.source.name.localeCompare(e2.source.name) || + e1.target.name.localeCompare(e2.target.name) + ); + }; + for (const source of this.compilers) { + const dependencies = this.dependencies.get(source); + if (dependencies) { + for (const dep of dependencies) { + const target = this.compilers.find(c => c.name === dep); + if (!target) { + missing.push(dep); + } else { + edges.add({ + source, + target + }); } - for (const module of queue) { - moduleGraph.setAsync(module); - for (const [ - originModule, - connections - ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { - if ( - connections.some( - c => - c.dependency instanceof HarmonyImportDependency && - c.isTargetActive(undefined) - ) - ) { - queue.add(originModule); - } - } + } + } + } + /** @type {string[]} */ + const errors = missing.map(m => `Compiler dependency \`${m}\` not found.`); + const stack = this.compilers.filter(c => !targetFound(c)); + while (stack.length > 0) { + const current = stack.pop(); + for (const edge of edges) { + if (edge.source === current) { + edges.delete(edge); + const target = edge.target; + if (!targetFound(target)) { + stack.push(target); } } - ); - }); + } + } + if (edges.size > 0) { + /** @type {string[]} */ + const lines = Array.from(edges) + .sort(sortEdges) + .map(edge => `${edge.source.name} -> ${edge.target.name}`); + lines.unshift("Circular dependency found in compiler dependencies."); + errors.unshift(lines.join("\n")); + } + if (errors.length > 0) { + const message = errors.join("\n"); + callback(new Error(message)); + return false; + } + return true; } -} - -module.exports = InferAsyncModulesPlugin; - - -/***/ }), - -/***/ 79233: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const AsyncDependencyToInitialChunkError = __webpack_require__(30111); -const { connectChunkGroupParentAndChild } = __webpack_require__(37234); -const ModuleGraphConnection = __webpack_require__(40639); -const { getEntryRuntime, mergeRuntime } = __webpack_require__(17156); - -/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGroup")} ChunkGroup */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./Entrypoint")} Entrypoint */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("./logging/Logger").Logger} Logger */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - -/** - * @typedef {Object} QueueItem - * @property {number} action - * @property {DependenciesBlock} block - * @property {Module} module - * @property {Chunk} chunk - * @property {ChunkGroup} chunkGroup - * @property {ChunkGroupInfo} chunkGroupInfo - */ - -/** @typedef {Set & { plus: Set }} ModuleSetPlus */ - -/** - * @typedef {Object} ChunkGroupInfo - * @property {ChunkGroup} chunkGroup the chunk group - * @property {RuntimeSpec} runtime the runtimes - * @property {ModuleSetPlus} minAvailableModules current minimal set of modules available at this point - * @property {boolean} minAvailableModulesOwned true, if minAvailableModules is owned and can be modified - * @property {ModuleSetPlus[]} availableModulesToBeMerged enqueued updates to the minimal set of available modules - * @property {Set=} skippedItems modules that were skipped because module is already available in parent chunks (need to reconsider when minAvailableModules is shrinking) - * @property {Set<[Module, ConnectionState]>=} skippedModuleConnections referenced modules that where skipped because they were not active in this runtime - * @property {ModuleSetPlus} resultingAvailableModules set of modules available including modules from this chunk group - * @property {Set} children set of children chunk groups, that will be revisited when availableModules shrink - * @property {Set} availableSources set of chunk groups that are the source for minAvailableModules - * @property {Set} availableChildren set of chunk groups which depend on the this chunk group as availableSource - * @property {number} preOrderIndex next pre order index - * @property {number} postOrderIndex next post order index - * @property {boolean} chunkLoading has a chunk loading mechanism - * @property {boolean} asyncChunks create async chunks - */ - -/** - * @typedef {Object} BlockChunkGroupConnection - * @property {ChunkGroupInfo} originChunkGroupInfo origin chunk group - * @property {ChunkGroup} chunkGroup referenced chunk group - */ - -const EMPTY_SET = /** @type {ModuleSetPlus} */ (new Set()); -EMPTY_SET.plus = EMPTY_SET; - -/** - * @param {ModuleSetPlus} a first set - * @param {ModuleSetPlus} b second set - * @returns {number} cmp - */ -const bySetSize = (a, b) => { - return b.size + b.plus.size - a.size - a.plus.size; -}; - -const extractBlockModules = (module, moduleGraph, runtime, blockModulesMap) => { - let blockCache; - let modules; - - const arrays = []; - const queue = [module]; - while (queue.length > 0) { - const block = queue.pop(); - const arr = []; - arrays.push(arr); - blockModulesMap.set(block, arr); - for (const b of block.blocks) { - queue.push(b); - } + // TODO webpack 6 remove + /** + * @deprecated This method should have been private + * @param {Compiler[]} compilers the child compilers + * @param {RunWithDependenciesHandler} fn a handler to run for each compiler + * @param {Callback} callback the compiler's handler + * @returns {void} + */ + runWithDependencies(compilers, fn, callback) { + const fulfilledNames = new Set(); + let remainingCompilers = compilers; + const isDependencyFulfilled = d => fulfilledNames.has(d); + const getReadyCompilers = () => { + let readyCompilers = []; + let list = remainingCompilers; + remainingCompilers = []; + for (const c of list) { + const dependencies = this.dependencies.get(c); + const ready = + !dependencies || dependencies.every(isDependencyFulfilled); + if (ready) { + readyCompilers.push(c); + } else { + remainingCompilers.push(c); + } + } + return readyCompilers; + }; + const runCompilers = callback => { + if (remainingCompilers.length === 0) return callback(); + asyncLib.map( + getReadyCompilers(), + (compiler, callback) => { + fn(compiler, err => { + if (err) return callback(err); + fulfilledNames.add(compiler.name); + runCompilers(callback); + }); + }, + callback + ); + }; + runCompilers(callback); } - for (const connection of moduleGraph.getOutgoingConnections(module)) { - const d = connection.dependency; - // We skip connections without dependency - if (!d) continue; - const m = connection.module; - // We skip connections without Module pointer - if (!m) continue; - // We skip weak connections - if (connection.weak) continue; - const state = connection.getActiveState(runtime); - // We skip inactive connections - if (state === false) continue; + /** + * @template SetupResult + * @param {function(Compiler, number, Callback, function(): boolean, function(): void, function(): void): SetupResult} setup setup a single compiler + * @param {function(Compiler, SetupResult, Callback): void} run run/continue a single compiler + * @param {Callback} callback callback when all compilers are done, result includes Stats of all changed compilers + * @returns {SetupResult[]} result of setup + */ + _runGraph(setup, run, callback) { + /** @typedef {{ compiler: Compiler, setupResult: SetupResult, result: Stats, state: "pending" | "blocked" | "queued" | "starting" | "running" | "running-outdated" | "done", children: Node[], parents: Node[] }} Node */ - const block = moduleGraph.getParentBlock(d); - let index = moduleGraph.getParentBlockIndex(d); + // State transitions for nodes: + // -> blocked (initial) + // blocked -> starting [running++] (when all parents done) + // queued -> starting [running++] (when processing the queue) + // starting -> running (when run has been called) + // running -> done [running--] (when compilation is done) + // done -> pending (when invalidated from file change) + // pending -> blocked [add to queue] (when invalidated from aggregated changes) + // done -> blocked [add to queue] (when invalidated, from parent invalidation) + // running -> running-outdated (when invalidated, either from change or parent invalidation) + // running-outdated -> blocked [running--] (when compilation is done) - // deprecated fallback - if (index < 0) { - index = block.dependencies.indexOf(d); + /** @type {Node[]} */ + const nodes = this.compilers.map(compiler => ({ + compiler, + setupResult: undefined, + result: undefined, + state: "blocked", + children: [], + parents: [] + })); + /** @type {Map} */ + const compilerToNode = new Map(); + for (const node of nodes) compilerToNode.set(node.compiler.name, node); + for (const node of nodes) { + const dependencies = this.dependencies.get(node.compiler); + if (!dependencies) continue; + for (const dep of dependencies) { + const parent = compilerToNode.get(dep); + node.parents.push(parent); + parent.children.push(node); + } } - - if (blockCache !== block) { - modules = blockModulesMap.get((blockCache = block)); + /** @type {ArrayQueue} */ + const queue = new ArrayQueue(); + for (const node of nodes) { + if (node.parents.length === 0) { + node.state = "queued"; + queue.enqueue(node); + } } + let errored = false; + let running = 0; + const parallelism = this._options.parallelism; + /** + * @param {Node} node node + * @param {Error=} err error + * @param {Stats=} stats result + * @returns {void} + */ + const nodeDone = (node, err, stats) => { + if (errored) return; + if (err) { + errored = true; + return asyncLib.each( + nodes, + (node, callback) => { + if (node.compiler.watching) { + node.compiler.watching.close(callback); + } else { + callback(); + } + }, + () => callback(err) + ); + } + node.result = stats; + running--; + if (node.state === "running") { + node.state = "done"; + for (const child of node.children) { + if (child.state === "blocked") queue.enqueue(child); + } + } else if (node.state === "running-outdated") { + node.state = "blocked"; + queue.enqueue(node); + } + processQueue(); + }; + /** + * @param {Node} node node + * @returns {void} + */ + const nodeInvalidFromParent = node => { + if (node.state === "done") { + node.state = "blocked"; + } else if (node.state === "running") { + node.state = "running-outdated"; + } + for (const child of node.children) { + nodeInvalidFromParent(child); + } + }; + /** + * @param {Node} node node + * @returns {void} + */ + const nodeInvalid = node => { + if (node.state === "done") { + node.state = "pending"; + } else if (node.state === "running") { + node.state = "running-outdated"; + } + for (const child of node.children) { + nodeInvalidFromParent(child); + } + }; + /** + * @param {Node} node node + * @returns {void} + */ + const nodeChange = node => { + nodeInvalid(node); + if (node.state === "pending") { + node.state = "blocked"; + } + if (node.state === "blocked") { + queue.enqueue(node); + processQueue(); + } + }; - const i = index << 2; - modules[i] = m; - modules[i + 1] = state; - } - - for (const modules of arrays) { - if (modules.length === 0) continue; - let indexMap; - let length = 0; - outer: for (let j = 0; j < modules.length; j += 2) { - const m = modules[j]; - if (m === undefined) continue; - const state = modules[j + 1]; - if (indexMap === undefined) { - let i = 0; - for (; i < length; i += 2) { - if (modules[i] === m) { - const merged = modules[i + 1]; - if (merged === true) continue outer; - modules[i + 1] = ModuleGraphConnection.addConnectionStates( - merged, - state - ); - } + const setupResults = []; + nodes.forEach((node, i) => { + setupResults.push( + (node.setupResult = setup( + node.compiler, + i, + nodeDone.bind(null, node), + () => node.state !== "starting" && node.state !== "running", + () => nodeChange(node), + () => nodeInvalid(node) + )) + ); + }); + let processing = true; + const processQueue = () => { + if (processing) return; + processing = true; + process.nextTick(processQueueWorker); + }; + const processQueueWorker = () => { + while (running < parallelism && queue.length > 0 && !errored) { + const node = queue.dequeue(); + if ( + node.state === "queued" || + (node.state === "blocked" && + node.parents.every(p => p.state === "done")) + ) { + running++; + node.state = "starting"; + run(node.compiler, node.setupResult, nodeDone.bind(null, node)); + node.state = "running"; } - modules[length] = m; - length++; - modules[length] = state; - length++; - if (length > 30) { - // To avoid worse case performance, we will use an index map for - // linear cost access, which allows to maintain O(n) complexity - // while keeping allocations down to a minimum - indexMap = new Map(); - for (let i = 0; i < length; i += 2) { - indexMap.set(modules[i], i + 1); + } + processing = false; + if ( + !errored && + running === 0 && + nodes.every(node => node.state === "done") + ) { + const stats = []; + for (const node of nodes) { + const result = node.result; + if (result) { + node.result = undefined; + stats.push(result); } } - } else { - const idx = indexMap.get(m); - if (idx !== undefined) { - const merged = modules[idx]; - if (merged === true) continue outer; - modules[idx] = ModuleGraphConnection.addConnectionStates( - merged, - state - ); - } else { - modules[length] = m; - length++; - modules[length] = state; - indexMap.set(m, length); - length++; + if (stats.length > 0) { + callback(null, new MultiStats(stats)); } } - } - modules.length = length; + }; + processQueueWorker(); + return setupResults; } -}; -/** - * - * @param {Logger} logger a logger - * @param {Compilation} compilation the compilation - * @param {Map} inputEntrypointsAndModules chunk groups which are processed with the modules - * @param {Map} chunkGroupInfoMap mapping from chunk group to available modules - * @param {Map} blockConnections connection for blocks - * @param {Set} blocksWithNestedBlocks flag for blocks that have nested blocks - * @param {Set} allCreatedChunkGroups filled with all chunk groups that are created here - */ -const visitModules = ( - logger, - compilation, - inputEntrypointsAndModules, - chunkGroupInfoMap, - blockConnections, - blocksWithNestedBlocks, - allCreatedChunkGroups -) => { - const { moduleGraph, chunkGraph, moduleMemCaches } = compilation; + /** + * @param {WatchOptions|WatchOptions[]} watchOptions the watcher's options + * @param {Callback} handler signals when the call finishes + * @returns {MultiWatching} a compiler watcher + */ + watch(watchOptions, handler) { + if (this.running) { + return handler(new ConcurrentCompilationError()); + } + this.running = true; - const blockModulesRuntimeMap = new Map(); + if (this.validateDependencies(handler)) { + const watchings = this._runGraph( + (compiler, idx, callback, isBlocked, setChanged, setInvalid) => { + const watching = compiler.watch( + Array.isArray(watchOptions) ? watchOptions[idx] : watchOptions, + callback + ); + if (watching) { + watching._onInvalid = setInvalid; + watching._onChange = setChanged; + watching._isBlocked = isBlocked; + } + return watching; + }, + (compiler, watching, callback) => { + if (compiler.watching !== watching) return; + if (!watching.running) watching.invalidate(); + }, + handler + ); + return new MultiWatching(watchings, this); + } - /** @type {RuntimeSpec | false} */ - let blockModulesMapRuntime = false; - let blockModulesMap; + return new MultiWatching([], this); + } /** - * - * @param {DependenciesBlock} block block - * @param {RuntimeSpec} runtime runtime - * @returns {(Module | ConnectionState)[]} block modules in flatten tuples + * @param {Callback} callback signals when the call finishes + * @returns {void} */ - const getBlockModules = (block, runtime) => { - if (blockModulesMapRuntime !== runtime) { - blockModulesMap = blockModulesRuntimeMap.get(runtime); - if (blockModulesMap === undefined) { - blockModulesMap = new Map(); - blockModulesRuntimeMap.set(runtime, blockModulesMap); - } + run(callback) { + if (this.running) { + return callback(new ConcurrentCompilationError()); } - let blockModules = blockModulesMap.get(block); - if (blockModules !== undefined) return blockModules; - const module = /** @type {Module} */ (block.getRootBlock()); - const memCache = moduleMemCaches && moduleMemCaches.get(module); - if (memCache !== undefined) { - const map = memCache.provide( - "bundleChunkGraph.blockModules", - runtime, - () => { - logger.time("visitModules: prepare"); - const map = new Map(); - extractBlockModules(module, moduleGraph, runtime, map); - logger.timeAggregate("visitModules: prepare"); - return map; + this.running = true; + + if (this.validateDependencies(callback)) { + this._runGraph( + () => {}, + (compiler, setupResult, callback) => compiler.run(callback), + (err, stats) => { + this.running = false; + + if (callback !== undefined) { + return callback(err, stats); + } } ); - for (const [block, blockModules] of map) - blockModulesMap.set(block, blockModules); - return map.get(block); - } else { - logger.time("visitModules: prepare"); - extractBlockModules(module, moduleGraph, runtime, blockModulesMap); - blockModules = blockModulesMap.get(block); - logger.timeAggregate("visitModules: prepare"); - return blockModules; } - }; - - let statProcessedQueueItems = 0; - let statProcessedBlocks = 0; - let statConnectedChunkGroups = 0; - let statProcessedChunkGroupsForMerging = 0; - let statMergedAvailableModuleSets = 0; - let statForkedAvailableModules = 0; - let statForkedAvailableModulesCount = 0; - let statForkedAvailableModulesCountPlus = 0; - let statForkedMergedModulesCount = 0; - let statForkedMergedModulesCountPlus = 0; - let statForkedResultModulesCount = 0; - let statChunkGroupInfoUpdated = 0; - let statChildChunkGroupsReconnected = 0; + } - let nextChunkGroupIndex = 0; - let nextFreeModulePreOrderIndex = 0; - let nextFreeModulePostOrderIndex = 0; + purgeInputFileSystem() { + for (const compiler of this.compilers) { + if (compiler.inputFileSystem && compiler.inputFileSystem.purge) { + compiler.inputFileSystem.purge(); + } + } + } - /** @type {Map} */ - const blockChunkGroups = new Map(); + /** + * @param {Callback} callback signals when the compiler closes + * @returns {void} + */ + close(callback) { + asyncLib.each( + this.compilers, + (compiler, callback) => { + compiler.close(callback); + }, + callback + ); + } +}; - /** @type {Map} */ - const namedChunkGroups = new Map(); - /** @type {Map} */ - const namedAsyncEntrypoints = new Map(); +/***/ }), - const ADD_AND_ENTER_ENTRY_MODULE = 0; - const ADD_AND_ENTER_MODULE = 1; - const ENTER_MODULE = 2; - const PROCESS_BLOCK = 3; - const PROCESS_ENTRY_BLOCK = 4; - const LEAVE_MODULE = 5; +/***/ 24170: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** @type {QueueItem[]} */ - let queue = []; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** @type {Map>} */ - const queueConnect = new Map(); - /** @type {Set} */ - const chunkGroupsForCombining = new Set(); - // Fill queue with entrypoint modules - // Create ChunkGroupInfo for entrypoints - for (const [chunkGroup, modules] of inputEntrypointsAndModules) { - const runtime = getEntryRuntime( - compilation, - chunkGroup.name, - chunkGroup.options - ); - /** @type {ChunkGroupInfo} */ - const chunkGroupInfo = { - chunkGroup, - runtime, - minAvailableModules: undefined, - minAvailableModulesOwned: false, - availableModulesToBeMerged: [], - skippedItems: undefined, - resultingAvailableModules: undefined, - children: undefined, - availableSources: undefined, - availableChildren: undefined, - preOrderIndex: 0, - postOrderIndex: 0, - chunkLoading: - chunkGroup.options.chunkLoading !== undefined - ? chunkGroup.options.chunkLoading !== false - : compilation.outputOptions.chunkLoading !== false, - asyncChunks: - chunkGroup.options.asyncChunks !== undefined - ? chunkGroup.options.asyncChunks - : compilation.outputOptions.asyncChunks !== false - }; - chunkGroup.index = nextChunkGroupIndex++; - if (chunkGroup.getNumberOfParents() > 0) { - // minAvailableModules for child entrypoints are unknown yet, set to undefined. - // This means no module is added until other sets are merged into - // this minAvailableModules (by the parent entrypoints) - const skippedItems = new Set(); - for (const module of modules) { - skippedItems.add(module); - } - chunkGroupInfo.skippedItems = skippedItems; - chunkGroupsForCombining.add(chunkGroupInfo); - } else { - // The application may start here: We start with an empty list of available modules - chunkGroupInfo.minAvailableModules = EMPTY_SET; - const chunk = chunkGroup.getEntrypointChunk(); - for (const module of modules) { - queue.push({ - action: ADD_AND_ENTER_MODULE, - block: module, - module, - chunk, - chunkGroup, - chunkGroupInfo - }); - } - } - chunkGroupInfoMap.set(chunkGroup, chunkGroupInfo); - if (chunkGroup.name) { - namedChunkGroups.set(chunkGroup.name, chunkGroupInfo); - } - } - // Fill availableSources with parent-child dependencies between entrypoints - for (const chunkGroupInfo of chunkGroupsForCombining) { - const { chunkGroup } = chunkGroupInfo; - chunkGroupInfo.availableSources = new Set(); - for (const parent of chunkGroup.parentsIterable) { - const parentChunkGroupInfo = chunkGroupInfoMap.get(parent); - chunkGroupInfo.availableSources.add(parentChunkGroupInfo); - if (parentChunkGroupInfo.availableChildren === undefined) { - parentChunkGroupInfo.availableChildren = new Set(); - } - parentChunkGroupInfo.availableChildren.add(chunkGroupInfo); - } - } - // pop() is used to read from the queue - // so it need to be reversed to be iterated in - // correct order - queue.reverse(); - /** @type {Set} */ - const outdatedChunkGroupInfo = new Set(); - /** @type {Set} */ - const chunkGroupsForMerging = new Set(); - /** @type {QueueItem[]} */ - let queueDelayed = []; +const identifierUtils = __webpack_require__(82186); - /** @type {[Module, ConnectionState][]} */ - const skipConnectionBuffer = []; - /** @type {Module[]} */ - const skipBuffer = []; - /** @type {QueueItem[]} */ - const queueBuffer = []; +/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */ +/** @typedef {import("./Stats")} Stats */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").KnownStatsCompilation} KnownStatsCompilation */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */ - /** @type {Module} */ - let module; - /** @type {Chunk} */ - let chunk; - /** @type {ChunkGroup} */ - let chunkGroup; - /** @type {DependenciesBlock} */ - let block; - /** @type {ChunkGroupInfo} */ - let chunkGroupInfo; +const indent = (str, prefix) => { + const rem = str.replace(/\n([^\n])/g, "\n" + prefix + "$1"); + return prefix + rem; +}; - // For each async Block in graph +class MultiStats { /** - * @param {AsyncDependenciesBlock} b iterating over each Async DepBlock - * @returns {void} + * @param {Stats[]} stats the child stats */ - const iteratorBlock = b => { - // 1. We create a chunk group with single chunk in it for this Block - // but only once (blockChunkGroups map) - let cgi = blockChunkGroups.get(b); - /** @type {ChunkGroup} */ - let c; - /** @type {Entrypoint} */ - let entrypoint; - const entryOptions = b.groupOptions && b.groupOptions.entryOptions; - if (cgi === undefined) { - const chunkName = (b.groupOptions && b.groupOptions.name) || b.chunkName; - if (entryOptions) { - cgi = namedAsyncEntrypoints.get(chunkName); - if (!cgi) { - entrypoint = compilation.addAsyncEntrypoint( - entryOptions, - module, - b.loc, - b.request - ); - entrypoint.index = nextChunkGroupIndex++; - cgi = { - chunkGroup: entrypoint, - runtime: entrypoint.options.runtime || entrypoint.name, - minAvailableModules: EMPTY_SET, - minAvailableModulesOwned: false, - availableModulesToBeMerged: [], - skippedItems: undefined, - resultingAvailableModules: undefined, - children: undefined, - availableSources: undefined, - availableChildren: undefined, - preOrderIndex: 0, - postOrderIndex: 0, - chunkLoading: - entryOptions.chunkLoading !== undefined - ? entryOptions.chunkLoading !== false - : chunkGroupInfo.chunkLoading, - asyncChunks: - entryOptions.asyncChunks !== undefined - ? entryOptions.asyncChunks - : chunkGroupInfo.asyncChunks - }; - chunkGroupInfoMap.set(entrypoint, cgi); - - chunkGraph.connectBlockAndChunkGroup(b, entrypoint); - if (chunkName) { - namedAsyncEntrypoints.set(chunkName, cgi); - } - } else { - entrypoint = /** @type {Entrypoint} */ (cgi.chunkGroup); - // TODO merge entryOptions - entrypoint.addOrigin(module, b.loc, b.request); - chunkGraph.connectBlockAndChunkGroup(b, entrypoint); - } + constructor(stats) { + this.stats = stats; + } - // 2. We enqueue the DependenciesBlock for traversal - queueDelayed.push({ - action: PROCESS_ENTRY_BLOCK, - block: b, - module: module, - chunk: entrypoint.chunks[0], - chunkGroup: entrypoint, - chunkGroupInfo: cgi - }); - } else if (!chunkGroupInfo.asyncChunks || !chunkGroupInfo.chunkLoading) { - // Just queue the block into the current chunk group - queue.push({ - action: PROCESS_BLOCK, - block: b, - module: module, - chunk, - chunkGroup, - chunkGroupInfo - }); - } else { - cgi = chunkName && namedChunkGroups.get(chunkName); - if (!cgi) { - c = compilation.addChunkInGroup( - b.groupOptions || b.chunkName, - module, - b.loc, - b.request - ); - c.index = nextChunkGroupIndex++; - cgi = { - chunkGroup: c, - runtime: chunkGroupInfo.runtime, - minAvailableModules: undefined, - minAvailableModulesOwned: undefined, - availableModulesToBeMerged: [], - skippedItems: undefined, - resultingAvailableModules: undefined, - children: undefined, - availableSources: undefined, - availableChildren: undefined, - preOrderIndex: 0, - postOrderIndex: 0, - chunkLoading: chunkGroupInfo.chunkLoading, - asyncChunks: chunkGroupInfo.asyncChunks - }; - allCreatedChunkGroups.add(c); - chunkGroupInfoMap.set(c, cgi); - if (chunkName) { - namedChunkGroups.set(chunkName, cgi); - } - } else { - c = cgi.chunkGroup; - if (c.isInitial()) { - compilation.errors.push( - new AsyncDependencyToInitialChunkError(chunkName, module, b.loc) - ); - c = chunkGroup; - } - c.addOptions(b.groupOptions); - c.addOrigin(module, b.loc, b.request); - } - blockConnections.set(b, []); - } - blockChunkGroups.set(b, cgi); - } else if (entryOptions) { - entrypoint = /** @type {Entrypoint} */ (cgi.chunkGroup); - } else { - c = cgi.chunkGroup; - } + get hash() { + return this.stats.map(stat => stat.hash).join(""); + } - if (c !== undefined) { - // 2. We store the connection for the block - // to connect it later if needed - blockConnections.get(b).push({ - originChunkGroupInfo: chunkGroupInfo, - chunkGroup: c - }); + /** + * @returns {boolean} true if a child compilation encountered an error + */ + hasErrors() { + return this.stats.some(stat => stat.hasErrors()); + } - // 3. We enqueue the chunk group info creation/updating - let connectList = queueConnect.get(chunkGroupInfo); - if (connectList === undefined) { - connectList = new Set(); - queueConnect.set(chunkGroupInfo, connectList); - } - connectList.add(cgi); + /** + * @returns {boolean} true if a child compilation had a warning + */ + hasWarnings() { + return this.stats.some(stat => stat.hasWarnings()); + } - // TODO check if this really need to be done for each traversal - // or if it is enough when it's queued when created - // 4. We enqueue the DependenciesBlock for traversal - queueDelayed.push({ - action: PROCESS_BLOCK, - block: b, - module: module, - chunk: c.chunks[0], - chunkGroup: c, - chunkGroupInfo: cgi - }); - } else if (entrypoint !== undefined) { - chunkGroupInfo.chunkGroup.addAsyncEntrypoint(entrypoint); + _createChildOptions(options, context) { + if (!options) { + options = {}; } - }; + const { children: childrenOptions = undefined, ...baseOptions } = + typeof options === "string" ? { preset: options } : options; + const children = this.stats.map((stat, idx) => { + const childOptions = Array.isArray(childrenOptions) + ? childrenOptions[idx] + : childrenOptions; + return stat.compilation.createStatsOptions( + { + ...baseOptions, + ...(typeof childOptions === "string" + ? { preset: childOptions } + : childOptions && typeof childOptions === "object" + ? childOptions + : undefined) + }, + context + ); + }); + return { + version: children.every(o => o.version), + hash: children.every(o => o.hash), + errorsCount: children.every(o => o.errorsCount), + warningsCount: children.every(o => o.warningsCount), + errors: children.every(o => o.errors), + warnings: children.every(o => o.warnings), + children + }; + } /** - * @param {DependenciesBlock} block the block - * @returns {void} + * @param {any} options stats options + * @returns {StatsCompilation} json output */ - const processBlock = block => { - statProcessedBlocks++; - // get prepared block info - const blockModules = getBlockModules(block, chunkGroupInfo.runtime); - - if (blockModules !== undefined) { - const { minAvailableModules } = chunkGroupInfo; - // Buffer items because order need to be reversed to get indices correct - // Traverse all referenced modules - for (let i = 0; i < blockModules.length; i += 2) { - const refModule = /** @type {Module} */ (blockModules[i]); - if (chunkGraph.isModuleInChunk(refModule, chunk)) { - // skip early if already connected - continue; - } - const activeState = /** @type {ConnectionState} */ ( - blockModules[i + 1] + toJson(options) { + options = this._createChildOptions(options, { forToString: false }); + /** @type {KnownStatsCompilation} */ + const obj = {}; + obj.children = this.stats.map((stat, idx) => { + const obj = stat.toJson(options.children[idx]); + const compilationName = stat.compilation.name; + const name = + compilationName && + identifierUtils.makePathsRelative( + options.context, + compilationName, + stat.compilation.compiler.root ); - if (activeState !== true) { - skipConnectionBuffer.push([refModule, activeState]); - if (activeState === false) continue; - } - if ( - activeState === true && - (minAvailableModules.has(refModule) || - minAvailableModules.plus.has(refModule)) - ) { - // already in parent chunks, skip it for now - skipBuffer.push(refModule); - continue; + obj.name = name; + return obj; + }); + if (options.version) { + obj.version = obj.children[0].version; + } + if (options.hash) { + obj.hash = obj.children.map(j => j.hash).join(""); + } + const mapError = (j, obj) => { + return { + ...obj, + compilerPath: obj.compilerPath + ? `${j.name}.${obj.compilerPath}` + : j.name + }; + }; + if (options.errors) { + obj.errors = []; + for (const j of obj.children) { + for (const i of j.errors) { + obj.errors.push(mapError(j, i)); } - // enqueue, then add and enter to be in the correct order - // this is relevant with circular dependencies - queueBuffer.push({ - action: activeState === true ? ADD_AND_ENTER_MODULE : PROCESS_BLOCK, - block: refModule, - module: refModule, - chunk, - chunkGroup, - chunkGroupInfo - }); } - // Add buffered items in reverse order - if (skipConnectionBuffer.length > 0) { - let { skippedModuleConnections } = chunkGroupInfo; - if (skippedModuleConnections === undefined) { - chunkGroupInfo.skippedModuleConnections = skippedModuleConnections = - new Set(); - } - for (let i = skipConnectionBuffer.length - 1; i >= 0; i--) { - skippedModuleConnections.add(skipConnectionBuffer[i]); + } + if (options.warnings) { + obj.warnings = []; + for (const j of obj.children) { + for (const i of j.warnings) { + obj.warnings.push(mapError(j, i)); } - skipConnectionBuffer.length = 0; } - if (skipBuffer.length > 0) { - let { skippedItems } = chunkGroupInfo; - if (skippedItems === undefined) { - chunkGroupInfo.skippedItems = skippedItems = new Set(); - } - for (let i = skipBuffer.length - 1; i >= 0; i--) { - skippedItems.add(skipBuffer[i]); - } - skipBuffer.length = 0; + } + if (options.errorsCount) { + obj.errorsCount = 0; + for (const j of obj.children) { + obj.errorsCount += j.errorsCount; } - if (queueBuffer.length > 0) { - for (let i = queueBuffer.length - 1; i >= 0; i--) { - queue.push(queueBuffer[i]); - } - queueBuffer.length = 0; + } + if (options.warningsCount) { + obj.warningsCount = 0; + for (const j of obj.children) { + obj.warningsCount += j.warningsCount; } } + return obj; + } - // Traverse all Blocks - for (const b of block.blocks) { - iteratorBlock(b); - } + toString(options) { + options = this._createChildOptions(options, { forToString: true }); + const results = this.stats.map((stat, idx) => { + const str = stat.toString(options.children[idx]); + const compilationName = stat.compilation.name; + const name = + compilationName && + identifierUtils + .makePathsRelative( + options.context, + compilationName, + stat.compilation.compiler.root + ) + .replace(/\|/g, " "); + if (!str) return str; + return name ? `${name}:\n${indent(str, " ")}` : str; + }); + return results.filter(Boolean).join("\n\n"); + } +} - if (block.blocks.length > 0 && module !== block) { - blocksWithNestedBlocks.add(block); - } - }; +module.exports = MultiStats; + + +/***/ }), + +/***/ 81128: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const asyncLib = __webpack_require__(78175); + +/** @typedef {import("./MultiCompiler")} MultiCompiler */ +/** @typedef {import("./Watching")} Watching */ + +/** + * @template T + * @callback Callback + * @param {(Error | null)=} err + * @param {T=} result + */ +class MultiWatching { /** - * @param {DependenciesBlock} block the block - * @returns {void} + * @param {Watching[]} watchings child compilers' watchers + * @param {MultiCompiler} compiler the compiler */ - const processEntryBlock = block => { - statProcessedBlocks++; - // get prepared block info - const blockModules = getBlockModules(block, chunkGroupInfo.runtime); + constructor(watchings, compiler) { + this.watchings = watchings; + this.compiler = compiler; + } - if (blockModules !== undefined) { - // Traverse all referenced modules - for (let i = 0; i < blockModules.length; i += 2) { - const refModule = /** @type {Module} */ (blockModules[i]); - const activeState = /** @type {ConnectionState} */ ( - blockModules[i + 1] - ); - // enqueue, then add and enter to be in the correct order - // this is relevant with circular dependencies - queueBuffer.push({ - action: - activeState === true ? ADD_AND_ENTER_ENTRY_MODULE : PROCESS_BLOCK, - block: refModule, - module: refModule, - chunk, - chunkGroup, - chunkGroupInfo - }); - } - // Add buffered items in reverse order - if (queueBuffer.length > 0) { - for (let i = queueBuffer.length - 1; i >= 0; i--) { - queue.push(queueBuffer[i]); - } - queueBuffer.length = 0; + invalidate(callback) { + if (callback) { + asyncLib.each( + this.watchings, + (watching, callback) => watching.invalidate(callback), + callback + ); + } else { + for (const watching of this.watchings) { + watching.invalidate(); } } + } - // Traverse all Blocks - for (const b of block.blocks) { - iteratorBlock(b); + suspend() { + for (const watching of this.watchings) { + watching.suspend(); } + } - if (block.blocks.length > 0 && module !== block) { - blocksWithNestedBlocks.add(block); + resume() { + for (const watching of this.watchings) { + watching.resume(); } - }; - - const processQueue = () => { - while (queue.length) { - statProcessedQueueItems++; - const queueItem = queue.pop(); - module = queueItem.module; - block = queueItem.block; - chunk = queueItem.chunk; - chunkGroup = queueItem.chunkGroup; - chunkGroupInfo = queueItem.chunkGroupInfo; + } - switch (queueItem.action) { - case ADD_AND_ENTER_ENTRY_MODULE: - chunkGraph.connectChunkAndEntryModule( - chunk, - module, - /** @type {Entrypoint} */ (chunkGroup) - ); - // fallthrough - case ADD_AND_ENTER_MODULE: { - if (chunkGraph.isModuleInChunk(module, chunk)) { - // already connected, skip it - break; - } - // We connect Module and Chunk - chunkGraph.connectChunkAndModule(chunk, module); + /** + * @param {Callback} callback signals when the watcher is closed + * @returns {void} + */ + close(callback) { + asyncLib.forEach( + this.watchings, + (watching, finishedCallback) => { + watching.close(finishedCallback); + }, + err => { + this.compiler.hooks.watchClose.call(); + if (typeof callback === "function") { + this.compiler.running = false; + callback(err); } - // fallthrough - case ENTER_MODULE: { - const index = chunkGroup.getModulePreOrderIndex(module); - if (index === undefined) { - chunkGroup.setModulePreOrderIndex( - module, - chunkGroupInfo.preOrderIndex++ - ); - } + } + ); + } +} - if ( - moduleGraph.setPreOrderIndexIfUnset( - module, - nextFreeModulePreOrderIndex - ) - ) { - nextFreeModulePreOrderIndex++; - } +module.exports = MultiWatching; - // reuse queueItem - queueItem.action = LEAVE_MODULE; - queue.push(queueItem); - } - // fallthrough - case PROCESS_BLOCK: { - processBlock(block); - break; - } - case PROCESS_ENTRY_BLOCK: { - processEntryBlock(block); - break; - } - case LEAVE_MODULE: { - const index = chunkGroup.getModulePostOrderIndex(module); - if (index === undefined) { - chunkGroup.setModulePostOrderIndex( - module, - chunkGroupInfo.postOrderIndex++ - ); - } - if ( - moduleGraph.setPostOrderIndexIfUnset( - module, - nextFreeModulePostOrderIndex - ) - ) { - nextFreeModulePostOrderIndex++; - } - break; - } - } - } - }; +/***/ }), - const calculateResultingAvailableModules = chunkGroupInfo => { - if (chunkGroupInfo.resultingAvailableModules) - return chunkGroupInfo.resultingAvailableModules; +/***/ 50169: +/***/ (function(module) { - const minAvailableModules = chunkGroupInfo.minAvailableModules; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // Create a new Set of available modules at this point - // We want to be as lazy as possible. There are multiple ways doing this: - // Note that resultingAvailableModules is stored as "(a) + (b)" as it's a ModuleSetPlus - // - resultingAvailableModules = (modules of chunk) + (minAvailableModules + minAvailableModules.plus) - // - resultingAvailableModules = (minAvailableModules + modules of chunk) + (minAvailableModules.plus) - // We choose one depending on the size of minAvailableModules vs minAvailableModules.plus - let resultingAvailableModules; - if (minAvailableModules.size > minAvailableModules.plus.size) { - // resultingAvailableModules = (modules of chunk) + (minAvailableModules + minAvailableModules.plus) - resultingAvailableModules = - /** @type {Set & {plus: Set}} */ (new Set()); - for (const module of minAvailableModules.plus) - minAvailableModules.add(module); - minAvailableModules.plus = EMPTY_SET; - resultingAvailableModules.plus = minAvailableModules; - chunkGroupInfo.minAvailableModulesOwned = false; - } else { - // resultingAvailableModules = (minAvailableModules + modules of chunk) + (minAvailableModules.plus) - resultingAvailableModules = - /** @type {Set & {plus: Set}} */ ( - new Set(minAvailableModules) - ); - resultingAvailableModules.plus = minAvailableModules.plus; - } - // add the modules from the chunk group to the set - for (const chunk of chunkGroupInfo.chunkGroup.chunks) { - for (const m of chunkGraph.getChunkModulesIterable(chunk)) { - resultingAvailableModules.add(m); - } - } - return (chunkGroupInfo.resultingAvailableModules = - resultingAvailableModules); - }; +/** @typedef {import("./Compiler")} Compiler */ + +class NoEmitOnErrorsPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.shouldEmit.tap("NoEmitOnErrorsPlugin", compilation => { + if (compilation.getStats().hasErrors()) return false; + }); + compiler.hooks.compilation.tap("NoEmitOnErrorsPlugin", compilation => { + compilation.hooks.shouldRecord.tap("NoEmitOnErrorsPlugin", () => { + if (compilation.getStats().hasErrors()) return false; + }); + }); + } +} + +module.exports = NoEmitOnErrorsPlugin; + + +/***/ }), + +/***/ 80832: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const WebpackError = __webpack_require__(53799); + +module.exports = class NoModeWarning extends WebpackError { + constructor() { + super(); + + this.name = "NoModeWarning"; + this.message = + "configuration\n" + + "The 'mode' option has not been set, webpack will fallback to 'production' for this value.\n" + + "Set 'mode' option to 'development' or 'production' to enable defaults for each environment.\n" + + "You can also set it to 'none' to disable any default behavior. " + + "Learn more: https://webpack.js.org/configuration/mode/"; + } +}; + + +/***/ }), + +/***/ 6325: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ + + + +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); + +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ + +class NodeStuffInWebError extends WebpackError { + /** + * @param {DependencyLocation} loc loc + * @param {string} expression expression + * @param {string} description description + */ + constructor(loc, expression, description) { + super( + `${JSON.stringify( + expression + )} has been used, it will be undefined in next major version. +${description}` + ); + + this.name = "NodeStuffInWebError"; + this.loc = loc; + } +} + +makeSerializable(NodeStuffInWebError, "webpack/lib/NodeStuffInWebError"); + +module.exports = NodeStuffInWebError; + - const processConnectQueue = () => { - // Figure out new parents for chunk groups - // to get new available modules for these children - for (const [chunkGroupInfo, targets] of queueConnect) { - // 1. Add new targets to the list of children - if (chunkGroupInfo.children === undefined) { - chunkGroupInfo.children = targets; - } else { - for (const target of targets) { - chunkGroupInfo.children.add(target); - } - } +/***/ }), - // 2. Calculate resulting available modules - const resultingAvailableModules = - calculateResultingAvailableModules(chunkGroupInfo); +/***/ 95287: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const runtime = chunkGroupInfo.runtime; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // 3. Update chunk group info - for (const target of targets) { - target.availableModulesToBeMerged.push(resultingAvailableModules); - chunkGroupsForMerging.add(target); - const oldRuntime = target.runtime; - const newRuntime = mergeRuntime(oldRuntime, runtime); - if (oldRuntime !== newRuntime) { - target.runtime = newRuntime; - outdatedChunkGroupInfo.add(target); - } - } - statConnectedChunkGroups += targets.size; - } - queueConnect.clear(); - }; - const processChunkGroupsForMerging = () => { - statProcessedChunkGroupsForMerging += chunkGroupsForMerging.size; +const NodeStuffInWebError = __webpack_require__(6325); +const RuntimeGlobals = __webpack_require__(16475); +const CachedConstDependency = __webpack_require__(57403); +const ConstDependency = __webpack_require__(76911); +const { + evaluateToString, + expressionIsUnsupported +} = __webpack_require__(93998); +const { relative } = __webpack_require__(17139); +const { parseResource } = __webpack_require__(82186); - // Execute the merge - for (const info of chunkGroupsForMerging) { - const availableModulesToBeMerged = info.availableModulesToBeMerged; - let cachedMinAvailableModules = info.minAvailableModules; +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ - statMergedAvailableModuleSets += availableModulesToBeMerged.length; +class NodeStuffPlugin { + constructor(options) { + this.options = options; + } - // 1. Get minimal available modules - // It doesn't make sense to traverse a chunk again with more available modules. - // This step calculates the minimal available modules and skips traversal when - // the list didn't shrink. - if (availableModulesToBeMerged.length > 1) { - availableModulesToBeMerged.sort(bySetSize); - } - let changed = false; - merge: for (const availableModules of availableModulesToBeMerged) { - if (cachedMinAvailableModules === undefined) { - cachedMinAvailableModules = availableModules; - info.minAvailableModules = cachedMinAvailableModules; - info.minAvailableModulesOwned = false; - changed = true; - } else { - if (info.minAvailableModulesOwned) { - // We own it and can modify it - if (cachedMinAvailableModules.plus === availableModules.plus) { - for (const m of cachedMinAvailableModules) { - if (!availableModules.has(m)) { - cachedMinAvailableModules.delete(m); - changed = true; - } - } - } else { - for (const m of cachedMinAvailableModules) { - if (!availableModules.has(m) && !availableModules.plus.has(m)) { - cachedMinAvailableModules.delete(m); - changed = true; - } - } - for (const m of cachedMinAvailableModules.plus) { - if (!availableModules.has(m) && !availableModules.plus.has(m)) { - // We can't remove modules from the plus part - // so we need to merge plus into the normal part to allow modifying it - const iterator = - cachedMinAvailableModules.plus[Symbol.iterator](); - // fast forward add all modules until m - /** @type {IteratorResult} */ - let it; - while (!(it = iterator.next()).done) { - const module = it.value; - if (module === m) break; - cachedMinAvailableModules.add(module); - } - // check the remaining modules before adding - while (!(it = iterator.next()).done) { - const module = it.value; - if ( - availableModules.has(module) || - availableModules.plus.has(module) - ) { - cachedMinAvailableModules.add(module); - } - } - cachedMinAvailableModules.plus = EMPTY_SET; - changed = true; - continue merge; - } - } - } - } else if (cachedMinAvailableModules.plus === availableModules.plus) { - // Common and fast case when the plus part is shared - // We only need to care about the normal part - if (availableModules.size < cachedMinAvailableModules.size) { - // the new availableModules is smaller so it's faster to - // fork from the new availableModules - statForkedAvailableModules++; - statForkedAvailableModulesCount += availableModules.size; - statForkedMergedModulesCount += cachedMinAvailableModules.size; - // construct a new Set as intersection of cachedMinAvailableModules and availableModules - const newSet = /** @type {ModuleSetPlus} */ (new Set()); - newSet.plus = availableModules.plus; - for (const m of availableModules) { - if (cachedMinAvailableModules.has(m)) { - newSet.add(m); - } - } - statForkedResultModulesCount += newSet.size; - cachedMinAvailableModules = newSet; - info.minAvailableModulesOwned = true; - info.minAvailableModules = newSet; - changed = true; - continue merge; - } - for (const m of cachedMinAvailableModules) { - if (!availableModules.has(m)) { - // cachedMinAvailableModules need to be modified - // but we don't own it - statForkedAvailableModules++; - statForkedAvailableModulesCount += - cachedMinAvailableModules.size; - statForkedMergedModulesCount += availableModules.size; - // construct a new Set as intersection of cachedMinAvailableModules and availableModules - // as the plus part is equal we can just take over this one - const newSet = /** @type {ModuleSetPlus} */ (new Set()); - newSet.plus = availableModules.plus; - const iterator = cachedMinAvailableModules[Symbol.iterator](); - // fast forward add all modules until m - /** @type {IteratorResult} */ - let it; - while (!(it = iterator.next()).done) { - const module = it.value; - if (module === m) break; - newSet.add(module); - } - // check the remaining modules before adding - while (!(it = iterator.next()).done) { - const module = it.value; - if (availableModules.has(module)) { - newSet.add(module); - } - } - statForkedResultModulesCount += newSet.size; - cachedMinAvailableModules = newSet; - info.minAvailableModulesOwned = true; - info.minAvailableModules = newSet; - changed = true; - continue merge; - } - } - } else { - for (const m of cachedMinAvailableModules) { - if (!availableModules.has(m) && !availableModules.plus.has(m)) { - // cachedMinAvailableModules need to be modified - // but we don't own it - statForkedAvailableModules++; - statForkedAvailableModulesCount += - cachedMinAvailableModules.size; - statForkedAvailableModulesCountPlus += - cachedMinAvailableModules.plus.size; - statForkedMergedModulesCount += availableModules.size; - statForkedMergedModulesCountPlus += availableModules.plus.size; - // construct a new Set as intersection of cachedMinAvailableModules and availableModules - const newSet = /** @type {ModuleSetPlus} */ (new Set()); - newSet.plus = EMPTY_SET; - const iterator = cachedMinAvailableModules[Symbol.iterator](); - // fast forward add all modules until m - /** @type {IteratorResult} */ - let it; - while (!(it = iterator.next()).done) { - const module = it.value; - if (module === m) break; - newSet.add(module); - } - // check the remaining modules before adding - while (!(it = iterator.next()).done) { - const module = it.value; - if ( - availableModules.has(module) || - availableModules.plus.has(module) - ) { - newSet.add(module); - } - } - // also check all modules in cachedMinAvailableModules.plus - for (const module of cachedMinAvailableModules.plus) { - if ( - availableModules.has(module) || - availableModules.plus.has(module) - ) { - newSet.add(module); - } - } - statForkedResultModulesCount += newSet.size; - cachedMinAvailableModules = newSet; - info.minAvailableModulesOwned = true; - info.minAvailableModules = newSet; - changed = true; - continue merge; - } - } - for (const m of cachedMinAvailableModules.plus) { - if (!availableModules.has(m) && !availableModules.plus.has(m)) { - // cachedMinAvailableModules need to be modified - // but we don't own it - statForkedAvailableModules++; - statForkedAvailableModulesCount += - cachedMinAvailableModules.size; - statForkedAvailableModulesCountPlus += - cachedMinAvailableModules.plus.size; - statForkedMergedModulesCount += availableModules.size; - statForkedMergedModulesCountPlus += availableModules.plus.size; - // construct a new Set as intersection of cachedMinAvailableModules and availableModules - // we already know that all modules directly from cachedMinAvailableModules are in availableModules too - const newSet = /** @type {ModuleSetPlus} */ ( - new Set(cachedMinAvailableModules) + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const options = this.options; + compiler.hooks.compilation.tap( + "NodeStuffPlugin", + (compilation, { normalModuleFactory }) => { + const handler = (parser, parserOptions) => { + if (parserOptions.node === false) return; + + let localOptions = options; + if (parserOptions.node) { + localOptions = { ...localOptions, ...parserOptions.node }; + } + + if (localOptions.global !== false) { + const withWarning = localOptions.global === "warn"; + parser.hooks.expression + .for("global") + .tap("NodeStuffPlugin", expr => { + const dep = new ConstDependency( + RuntimeGlobals.global, + expr.range, + [RuntimeGlobals.global] ); - newSet.plus = EMPTY_SET; - const iterator = - cachedMinAvailableModules.plus[Symbol.iterator](); - // fast forward add all modules until m - /** @type {IteratorResult} */ - let it; - while (!(it = iterator.next()).done) { - const module = it.value; - if (module === m) break; - newSet.add(module); - } - // check the remaining modules before adding - while (!(it = iterator.next()).done) { - const module = it.value; - if ( - availableModules.has(module) || - availableModules.plus.has(module) - ) { - newSet.add(module); - } + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + + // TODO webpack 6 remove + if (withWarning) { + parser.state.module.addWarning( + new NodeStuffInWebError( + dep.loc, + "global", + "The global namespace object is Node.js feature and doesn't present in browser." + ) + ); } - statForkedResultModulesCount += newSet.size; - cachedMinAvailableModules = newSet; - info.minAvailableModulesOwned = true; - info.minAvailableModules = newSet; - changed = true; - continue merge; - } - } + }); } - } - } - availableModulesToBeMerged.length = 0; - if (changed) { - info.resultingAvailableModules = undefined; - outdatedChunkGroupInfo.add(info); - } - } - chunkGroupsForMerging.clear(); - }; - const processChunkGroupsForCombining = () => { - for (const info of chunkGroupsForCombining) { - for (const source of info.availableSources) { - if (!source.minAvailableModules) { - chunkGroupsForCombining.delete(info); - break; - } - } - } - for (const info of chunkGroupsForCombining) { - const availableModules = /** @type {ModuleSetPlus} */ (new Set()); - availableModules.plus = EMPTY_SET; - const mergeSet = set => { - if (set.size > availableModules.plus.size) { - for (const item of availableModules.plus) availableModules.add(item); - availableModules.plus = set; - } else { - for (const item of set) availableModules.add(item); - } - }; - // combine minAvailableModules from all resultingAvailableModules - for (const source of info.availableSources) { - const resultingAvailableModules = - calculateResultingAvailableModules(source); - mergeSet(resultingAvailableModules); - mergeSet(resultingAvailableModules.plus); - } - info.minAvailableModules = availableModules; - info.minAvailableModulesOwned = false; - info.resultingAvailableModules = undefined; - outdatedChunkGroupInfo.add(info); - } - chunkGroupsForCombining.clear(); - }; + const setModuleConstant = (expressionName, fn, warning) => { + parser.hooks.expression + .for(expressionName) + .tap("NodeStuffPlugin", expr => { + const dep = new CachedConstDependency( + JSON.stringify(fn(parser.state.module)), + expr.range, + expressionName + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); - const processOutdatedChunkGroupInfo = () => { - statChunkGroupInfoUpdated += outdatedChunkGroupInfo.size; - // Revisit skipped elements - for (const info of outdatedChunkGroupInfo) { - // 1. Reconsider skipped items - if (info.skippedItems !== undefined) { - const { minAvailableModules } = info; - for (const module of info.skippedItems) { - if ( - !minAvailableModules.has(module) && - !minAvailableModules.plus.has(module) - ) { - queue.push({ - action: ADD_AND_ENTER_MODULE, - block: module, - module, - chunk: info.chunkGroup.chunks[0], - chunkGroup: info.chunkGroup, - chunkGroupInfo: info - }); - info.skippedItems.delete(module); - } - } - } + // TODO webpack 6 remove + if (warning) { + parser.state.module.addWarning( + new NodeStuffInWebError(dep.loc, expressionName, warning) + ); + } - // 2. Reconsider skipped connections - if (info.skippedModuleConnections !== undefined) { - const { minAvailableModules } = info; - for (const entry of info.skippedModuleConnections) { - const [module, activeState] = entry; - if (activeState === false) continue; - if (activeState === true) { - info.skippedModuleConnections.delete(entry); + return true; + }); + }; + + const setConstant = (expressionName, value, warning) => + setModuleConstant(expressionName, () => value, warning); + + const context = compiler.context; + if (localOptions.__filename) { + switch (localOptions.__filename) { + case "mock": + setConstant("__filename", "/index.js"); + break; + case "warn-mock": + setConstant( + "__filename", + "/index.js", + "The __filename is Node.js feature and doesn't present in browser." + ); + break; + case true: + setModuleConstant("__filename", module => + relative(compiler.inputFileSystem, context, module.resource) + ); + break; + } + + parser.hooks.evaluateIdentifier + .for("__filename") + .tap("NodeStuffPlugin", expr => { + if (!parser.state.module) return; + const resource = parseResource(parser.state.module.resource); + return evaluateToString(resource.path)(expr); + }); } - if ( - activeState === true && - (minAvailableModules.has(module) || - minAvailableModules.plus.has(module)) - ) { - info.skippedItems.add(module); - continue; + if (localOptions.__dirname) { + switch (localOptions.__dirname) { + case "mock": + setConstant("__dirname", "/"); + break; + case "warn-mock": + setConstant( + "__dirname", + "/", + "The __dirname is Node.js feature and doesn't present in browser." + ); + break; + case true: + setModuleConstant("__dirname", module => + relative(compiler.inputFileSystem, context, module.context) + ); + break; + } + + parser.hooks.evaluateIdentifier + .for("__dirname") + .tap("NodeStuffPlugin", expr => { + if (!parser.state.module) return; + return evaluateToString(parser.state.module.context)(expr); + }); } - queue.push({ - action: activeState === true ? ADD_AND_ENTER_MODULE : PROCESS_BLOCK, - block: module, - module, - chunk: info.chunkGroup.chunks[0], - chunkGroup: info.chunkGroup, - chunkGroupInfo: info - }); - } + parser.hooks.expression + .for("require.extensions") + .tap( + "NodeStuffPlugin", + expressionIsUnsupported( + parser, + "require.extensions is not supported by webpack. Use a loader instead." + ) + ); + }; + + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("NodeStuffPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("NodeStuffPlugin", handler); } + ); + } +} - // 2. Reconsider children chunk groups - if (info.children !== undefined) { - statChildChunkGroupsReconnected += info.children.size; - for (const cgi of info.children) { - let connectList = queueConnect.get(info); - if (connectList === undefined) { - connectList = new Set(); - queueConnect.set(info, connectList); - } - connectList.add(cgi); - } - } +module.exports = NodeStuffPlugin; - // 3. Reconsider chunk groups for combining - if (info.availableChildren !== undefined) { - for (const cgi of info.availableChildren) { - chunkGroupsForCombining.add(cgi); - } - } - } - outdatedChunkGroupInfo.clear(); - }; - // Iterative traversal of the Module graph - // Recursive would be simpler to write but could result in Stack Overflows - while (queue.length || queueConnect.size) { - logger.time("visitModules: visiting"); - processQueue(); - logger.timeAggregateEnd("visitModules: prepare"); - logger.timeEnd("visitModules: visiting"); +/***/ }), - if (chunkGroupsForCombining.size > 0) { - logger.time("visitModules: combine available modules"); - processChunkGroupsForCombining(); - logger.timeEnd("visitModules: combine available modules"); - } +/***/ 39: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (queueConnect.size > 0) { - logger.time("visitModules: calculating available modules"); - processConnectQueue(); - logger.timeEnd("visitModules: calculating available modules"); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (chunkGroupsForMerging.size > 0) { - logger.time("visitModules: merging available modules"); - processChunkGroupsForMerging(); - logger.timeEnd("visitModules: merging available modules"); - } - } - if (outdatedChunkGroupInfo.size > 0) { - logger.time("visitModules: check modules for revisit"); - processOutdatedChunkGroupInfo(); - logger.timeEnd("visitModules: check modules for revisit"); - } - // Run queueDelayed when all items of the queue are processed - // This is important to get the global indexing correct - // Async blocks should be processed after all sync blocks are processed - if (queue.length === 0) { - const tempQueue = queue; - queue = queueDelayed.reverse(); - queueDelayed = tempQueue; - } - } +const parseJson = __webpack_require__(15235); +const { getContext, runLoaders } = __webpack_require__(68318); +const querystring = __webpack_require__(63477); +const { HookMap, SyncHook, AsyncSeriesBailHook } = __webpack_require__(41242); +const { + CachedSource, + OriginalSource, + RawSource, + SourceMapSource +} = __webpack_require__(51255); +const Compilation = __webpack_require__(85720); +const HookWebpackError = __webpack_require__(11351); +const Module = __webpack_require__(73208); +const ModuleBuildError = __webpack_require__(21305); +const ModuleError = __webpack_require__(23744); +const ModuleGraphConnection = __webpack_require__(40639); +const ModuleParseError = __webpack_require__(58443); +const ModuleWarning = __webpack_require__(11234); +const RuntimeGlobals = __webpack_require__(16475); +const UnhandledSchemeError = __webpack_require__(68099); +const WebpackError = __webpack_require__(53799); +const formatLocation = __webpack_require__(16734); +const LazySet = __webpack_require__(38938); +const { isSubset } = __webpack_require__(93347); +const { getScheme } = __webpack_require__(54500); +const { + compareLocations, + concatComparators, + compareSelect, + keepOriginalOrder +} = __webpack_require__(29579); +const createHash = __webpack_require__(49835); +const { createFakeHook } = __webpack_require__(64518); +const { join } = __webpack_require__(17139); +const { + contextify, + absolutify, + makePathsRelative +} = __webpack_require__(82186); +const makeSerializable = __webpack_require__(33032); +const memoize = __webpack_require__(78676); - logger.log( - `${statProcessedQueueItems} queue items processed (${statProcessedBlocks} blocks)` - ); - logger.log(`${statConnectedChunkGroups} chunk groups connected`); - logger.log( - `${statProcessedChunkGroupsForMerging} chunk groups processed for merging (${statMergedAvailableModuleSets} module sets, ${statForkedAvailableModules} forked, ${statForkedAvailableModulesCount} + ${statForkedAvailableModulesCountPlus} modules forked, ${statForkedMergedModulesCount} + ${statForkedMergedModulesCountPlus} modules merged into fork, ${statForkedResultModulesCount} resulting modules)` - ); - logger.log( - `${statChunkGroupInfoUpdated} chunk group info updated (${statChildChunkGroupsReconnected} already connected chunk groups reconnected)` - ); -}; +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/LoaderContext").NormalModuleLoaderContext} NormalModuleLoaderContext */ +/** @typedef {import("../declarations/WebpackOptions").Mode} Mode */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Generator")} Generator */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("./Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ +/** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ +/** @typedef {import("./Parser")} Parser */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./logging/Logger").Logger} WebpackLogger */ +/** @typedef {import("./util/Hash")} Hash */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ /** - * - * @param {Compilation} compilation the compilation - * @param {Set} blocksWithNestedBlocks flag for blocks that have nested blocks - * @param {Map} blockConnections connection for blocks - * @param {Map} chunkGroupInfoMap mapping from chunk group to available modules + * @typedef {Object} SourceMap + * @property {number} version + * @property {string[]} sources + * @property {string} mappings + * @property {string=} file + * @property {string=} sourceRoot + * @property {string[]=} sourcesContent + * @property {string[]=} names */ -const connectChunkGroups = ( - compilation, - blocksWithNestedBlocks, - blockConnections, - chunkGroupInfoMap -) => { - const { chunkGraph } = compilation; - - /** - * Helper function to check if all modules of a chunk are available - * - * @param {ChunkGroup} chunkGroup the chunkGroup to scan - * @param {ModuleSetPlus} availableModules the comparator set - * @returns {boolean} return true if all modules of a chunk are available - */ - const areModulesAvailable = (chunkGroup, availableModules) => { - for (const chunk of chunkGroup.chunks) { - for (const module of chunkGraph.getChunkModulesIterable(chunk)) { - if (!availableModules.has(module) && !availableModules.plus.has(module)) - return false; - } - } - return true; - }; - // For each edge in the basic chunk graph - for (const [block, connections] of blockConnections) { - // 1. Check if connection is needed - // When none of the dependencies need to be connected - // we can skip all of them - // It's not possible to filter each item so it doesn't create inconsistent - // connections and modules can only create one version - // TODO maybe decide this per runtime - if ( - // TODO is this needed? - !blocksWithNestedBlocks.has(block) && - connections.every(({ chunkGroup, originChunkGroupInfo }) => - areModulesAvailable( - chunkGroup, - originChunkGroupInfo.resultingAvailableModules - ) - ) - ) { - continue; - } +const getInvalidDependenciesModuleWarning = memoize(() => + __webpack_require__(68257) +); +const getValidate = memoize(() => (__webpack_require__(38476).validate)); - // 2. Foreach edge - for (let i = 0; i < connections.length; i++) { - const { chunkGroup, originChunkGroupInfo } = connections[i]; +const ABSOLUTE_PATH_REGEX = /^([a-zA-Z]:\\|\\\\|\/)/; - // 3. Connect block with chunk - chunkGraph.connectBlockAndChunkGroup(block, chunkGroup); +/** + * @typedef {Object} LoaderItem + * @property {string} loader + * @property {any} options + * @property {string?} ident + * @property {string?} type + */ - // 4. Connect chunk with parent - connectChunkGroupParentAndChild( - originChunkGroupInfo.chunkGroup, - chunkGroup - ); - } - } +/** + * @param {string} context absolute context path + * @param {string} source a source path + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {string} new source path + */ +const contextifySourceUrl = (context, source, associatedObjectForCache) => { + if (source.startsWith("webpack://")) return source; + return `webpack://${makePathsRelative( + context, + source, + associatedObjectForCache + )}`; }; /** - * Remove all unconnected chunk groups - * @param {Compilation} compilation the compilation - * @param {Iterable} allCreatedChunkGroups all chunk groups that where created before + * @param {string} context absolute context path + * @param {SourceMap} sourceMap a source map + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {SourceMap} new source map */ -const cleanupUnconnectedGroups = (compilation, allCreatedChunkGroups) => { - const { chunkGraph } = compilation; +const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => { + if (!Array.isArray(sourceMap.sources)) return sourceMap; + const { sourceRoot } = sourceMap; + /** @type {function(string): string} */ + const mapper = !sourceRoot + ? source => source + : sourceRoot.endsWith("/") + ? source => + source.startsWith("/") + ? `${sourceRoot.slice(0, -1)}${source}` + : `${sourceRoot}${source}` + : source => + source.startsWith("/") + ? `${sourceRoot}${source}` + : `${sourceRoot}/${source}`; + const newSources = sourceMap.sources.map(source => + contextifySourceUrl(context, mapper(source), associatedObjectForCache) + ); + return { + ...sourceMap, + file: "x", + sourceRoot: undefined, + sources: newSources + }; +}; - for (const chunkGroup of allCreatedChunkGroups) { - if (chunkGroup.getNumberOfParents() === 0) { - for (const chunk of chunkGroup.chunks) { - compilation.chunks.delete(chunk); - chunkGraph.disconnectChunk(chunk); - } - chunkGraph.disconnectChunkGroup(chunkGroup); - chunkGroup.remove(); - } +/** + * @param {string | Buffer} input the input + * @returns {string} the converted string + */ +const asString = input => { + if (Buffer.isBuffer(input)) { + return input.toString("utf-8"); } + return input; }; /** - * This method creates the Chunk graph from the Module graph - * @param {Compilation} compilation the compilation - * @param {Map} inputEntrypointsAndModules chunk groups which are processed with the modules - * @returns {void} + * @param {string | Buffer} input the input + * @returns {Buffer} the converted buffer */ -const buildChunkGraph = (compilation, inputEntrypointsAndModules) => { - const logger = compilation.getLogger("webpack.buildChunkGraph"); - - // SHARED STATE - - /** @type {Map} */ - const blockConnections = new Map(); - - /** @type {Set} */ - const allCreatedChunkGroups = new Set(); - - /** @type {Map} */ - const chunkGroupInfoMap = new Map(); - - /** @type {Set} */ - const blocksWithNestedBlocks = new Set(); - - // PART ONE - - logger.time("visitModules"); - visitModules( - logger, - compilation, - inputEntrypointsAndModules, - chunkGroupInfoMap, - blockConnections, - blocksWithNestedBlocks, - allCreatedChunkGroups - ); - logger.timeEnd("visitModules"); - - // PART TWO +const asBuffer = input => { + if (!Buffer.isBuffer(input)) { + return Buffer.from(input, "utf-8"); + } + return input; +}; - logger.time("connectChunkGroups"); - connectChunkGroups( - compilation, - blocksWithNestedBlocks, - blockConnections, - chunkGroupInfoMap - ); - logger.timeEnd("connectChunkGroups"); +class NonErrorEmittedError extends WebpackError { + constructor(error) { + super(); - for (const [chunkGroup, chunkGroupInfo] of chunkGroupInfoMap) { - for (const chunk of chunkGroup.chunks) - chunk.runtime = mergeRuntime(chunk.runtime, chunkGroupInfo.runtime); + this.name = "NonErrorEmittedError"; + this.message = "(Emitted value instead of an instance of Error) " + error; } +} - // Cleanup work - - logger.time("cleanup"); - cleanupUnconnectedGroups(compilation, allCreatedChunkGroups); - logger.timeEnd("cleanup"); -}; +makeSerializable( + NonErrorEmittedError, + "webpack/lib/NormalModule", + "NonErrorEmittedError" +); -module.exports = buildChunkGraph; +/** + * @typedef {Object} NormalModuleCompilationHooks + * @property {SyncHook<[object, NormalModule]>} loader + * @property {SyncHook<[LoaderItem[], NormalModule, object]>} beforeLoaders + * @property {SyncHook<[NormalModule]>} beforeParse + * @property {SyncHook<[NormalModule]>} beforeSnapshot + * @property {HookMap>} readResourceForScheme + * @property {HookMap>} readResource + * @property {AsyncSeriesBailHook<[NormalModule, NeedBuildContext], boolean>} needBuild + */ +/** @type {WeakMap} */ +const compilationHooksMap = new WeakMap(); -/***/ }), +class NormalModule extends Module { + /** + * @param {Compilation} compilation the compilation + * @returns {NormalModuleCompilationHooks} the attached hooks + */ + static getCompilationHooks(compilation) { + if (!(compilation instanceof Compilation)) { + throw new TypeError( + "The 'compilation' argument must be an instance of Compilation" + ); + } + let hooks = compilationHooksMap.get(compilation); + if (hooks === undefined) { + hooks = { + loader: new SyncHook(["loaderContext", "module"]), + beforeLoaders: new SyncHook(["loaders", "module", "loaderContext"]), + beforeParse: new SyncHook(["module"]), + beforeSnapshot: new SyncHook(["module"]), + // TODO webpack 6 deprecate + readResourceForScheme: new HookMap(scheme => { + const hook = hooks.readResource.for(scheme); + return createFakeHook( + /** @type {AsyncSeriesBailHook<[string, NormalModule], string | Buffer>} */ ({ + tap: (options, fn) => + hook.tap(options, loaderContext => + fn(loaderContext.resource, loaderContext._module) + ), + tapAsync: (options, fn) => + hook.tapAsync(options, (loaderContext, callback) => + fn(loaderContext.resource, loaderContext._module, callback) + ), + tapPromise: (options, fn) => + hook.tapPromise(options, loaderContext => + fn(loaderContext.resource, loaderContext._module) + ) + }) + ); + }), + readResource: new HookMap( + () => new AsyncSeriesBailHook(["loaderContext"]) + ), + needBuild: new AsyncSeriesBailHook(["module", "context"]) + }; + compilationHooksMap.set(compilation, hooks); + } + return hooks; + } -/***/ 28034: -/***/ (function(module) { + /** + * @param {Object} options options object + * @param {string=} options.layer an optional layer in which the module is + * @param {string} options.type module type + * @param {string} options.request request string + * @param {string} options.userRequest request intended by user (without loaders from config) + * @param {string} options.rawRequest request without resolving + * @param {LoaderItem[]} options.loaders list of loaders + * @param {string} options.resource path + query of the real resource + * @param {Record=} options.resourceResolveData resource resolve data + * @param {string} options.context context directory for resolving + * @param {string | undefined} options.matchResource path + query of the matched resource (virtual) + * @param {Parser} options.parser the parser used + * @param {object} options.parserOptions the options of the parser used + * @param {Generator} options.generator the generator used + * @param {object} options.generatorOptions the options of the generator used + * @param {Object} options.resolveOptions options used for resolving requests from this module + */ + constructor({ + layer, + type, + request, + userRequest, + rawRequest, + loaders, + resource, + resourceResolveData, + context, + matchResource, + parser, + parserOptions, + generator, + generatorOptions, + resolveOptions + }) { + super(type, context || getContext(resource), layer); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // Info from Factory + /** @type {string} */ + this.request = request; + /** @type {string} */ + this.userRequest = userRequest; + /** @type {string} */ + this.rawRequest = rawRequest; + /** @type {boolean} */ + this.binary = /^(asset|webassembly)\b/.test(type); + /** @type {Parser} */ + this.parser = parser; + this.parserOptions = parserOptions; + /** @type {Generator} */ + this.generator = generator; + this.generatorOptions = generatorOptions; + /** @type {string} */ + this.resource = resource; + this.resourceResolveData = resourceResolveData; + /** @type {string | undefined} */ + this.matchResource = matchResource; + /** @type {LoaderItem[]} */ + this.loaders = loaders; + if (resolveOptions !== undefined) { + // already declared in super class + this.resolveOptions = resolveOptions; + } + // Info from Build + /** @type {(WebpackError | null)=} */ + this.error = null; + /** @private @type {Source=} */ + this._source = null; + /** @private @type {Map | undefined} **/ + this._sourceSizes = undefined; + /** @private @type {Set} */ + this._sourceTypes = undefined; + // Cache + this._lastSuccessfulBuildMeta = {}; + this._forceBuild = true; + this._isEvaluatingSideEffects = false; + /** @type {WeakSet | undefined} */ + this._addedSideEffectsBailout = undefined; + } -/** @typedef {import("../Compiler")} Compiler */ + /** + * @returns {string} a unique identifier of the module + */ + identifier() { + if (this.layer === null) { + if (this.type === "javascript/auto") { + return this.request; + } else { + return `${this.type}|${this.request}`; + } + } else { + return `${this.type}|${this.request}|${this.layer}`; + } + } -class AddBuildDependenciesPlugin { /** - * @param {Iterable} buildDependencies list of build dependencies + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module */ - constructor(buildDependencies) { - this.buildDependencies = new Set(buildDependencies); + readableIdentifier(requestShortener) { + return requestShortener.shorten(this.userRequest); } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion */ - apply(compiler) { - compiler.hooks.compilation.tap( - "AddBuildDependenciesPlugin", - compilation => { - compilation.buildDependencies.addAll(this.buildDependencies); - } + libIdent(options) { + let ident = contextify( + options.context, + this.userRequest, + options.associatedObjectForCache ); + if (this.layer) ident = `(${this.layer})/${ident}`; + return ident; } -} - -module.exports = AddBuildDependenciesPlugin; - - -/***/ }), - -/***/ 47942: -/***/ (function(module) { -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** @typedef {import("../Compiler")} Compiler */ - -class AddManagedPathsPlugin { /** - * @param {Iterable} managedPaths list of managed paths - * @param {Iterable} immutablePaths list of immutable paths + * @returns {string | null} absolute path which should be used for condition matching (usually the resource path) */ - constructor(managedPaths, immutablePaths) { - this.managedPaths = new Set(managedPaths); - this.immutablePaths = new Set(immutablePaths); + nameForCondition() { + const resource = this.matchResource || this.resource; + const idx = resource.indexOf("?"); + if (idx >= 0) return resource.substr(0, idx); + return resource; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * Assuming this module is in the cache. Update the (cached) module with + * the fresh module from the factory. Usually updates internal references + * and properties. + * @param {Module} module fresh module * @returns {void} */ - apply(compiler) { - for (const managedPath of this.managedPaths) { - compiler.managedPaths.add(managedPath); - } - for (const immutablePath of this.immutablePaths) { - compiler.immutablePaths.add(immutablePath); - } + updateCacheModule(module) { + super.updateCacheModule(module); + const m = /** @type {NormalModule} */ (module); + this.binary = m.binary; + this.request = m.request; + this.userRequest = m.userRequest; + this.rawRequest = m.rawRequest; + this.parser = m.parser; + this.parserOptions = m.parserOptions; + this.generator = m.generator; + this.generatorOptions = m.generatorOptions; + this.resource = m.resource; + this.resourceResolveData = m.resourceResolveData; + this.context = m.context; + this.matchResource = m.matchResource; + this.loaders = m.loaders; } -} - -module.exports = AddManagedPathsPlugin; - - -/***/ }), - -/***/ 71985: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const Cache = __webpack_require__(7592); -const ProgressPlugin = __webpack_require__(13216); - -/** @typedef {import("../Compiler")} Compiler */ -const BUILD_DEPENDENCIES_KEY = Symbol(); + /** + * Assuming this module is in the cache. Remove internal references to allow freeing some memory. + */ + cleanupForCache() { + // Make sure to cache types and sizes before cleanup when this module has been built + // They are accessed by the stats and we don't want them to crash after cleanup + // TODO reconsider this for webpack 6 + if (this.buildInfo) { + if (this._sourceTypes === undefined) this.getSourceTypes(); + for (const type of this._sourceTypes) { + this.size(type); + } + } + super.cleanupForCache(); + this.parser = undefined; + this.parserOptions = undefined; + this.generator = undefined; + this.generatorOptions = undefined; + } -class IdleFileCachePlugin { /** - * @param {TODO} strategy cache strategy - * @param {number} idleTimeout timeout - * @param {number} idleTimeoutForInitialStore initial timeout - * @param {number} idleTimeoutAfterLargeChanges timeout after changes + * Module should be unsafe cached. Get data that's needed for that. + * This data will be passed to restoreFromUnsafeCache later. + * @returns {object} cached data */ - constructor( - strategy, - idleTimeout, - idleTimeoutForInitialStore, - idleTimeoutAfterLargeChanges - ) { - this.strategy = strategy; - this.idleTimeout = idleTimeout; - this.idleTimeoutForInitialStore = idleTimeoutForInitialStore; - this.idleTimeoutAfterLargeChanges = idleTimeoutAfterLargeChanges; + getUnsafeCacheData() { + const data = super.getUnsafeCacheData(); + data.parserOptions = this.parserOptions; + data.generatorOptions = this.generatorOptions; + return data; + } + + restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory) { + this._restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory); } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * restore unsafe cache data + * @param {object} unsafeCacheData data from getUnsafeCacheData + * @param {NormalModuleFactory} normalModuleFactory the normal module factory handling the unsafe caching */ - apply(compiler) { - let strategy = this.strategy; - const idleTimeout = this.idleTimeout; - const idleTimeoutForInitialStore = Math.min( - idleTimeout, - this.idleTimeoutForInitialStore + _restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory) { + super._restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory); + this.parserOptions = unsafeCacheData.parserOptions; + this.parser = normalModuleFactory.getParser(this.type, this.parserOptions); + this.generatorOptions = unsafeCacheData.generatorOptions; + this.generator = normalModuleFactory.getGenerator( + this.type, + this.generatorOptions ); - const idleTimeoutAfterLargeChanges = this.idleTimeoutAfterLargeChanges; - const resolvedPromise = Promise.resolve(); - - let timeSpendInBuild = 0; - let timeSpendInStore = 0; - let avgTimeSpendInStore = 0; + // we assume the generator behaves identically and keep cached sourceTypes/Sizes + } - /** @type {Map Promise>} */ - const pendingIdleTasks = new Map(); + /** + * @param {string} context the compilation context + * @param {string} name the asset name + * @param {string} content the content + * @param {string | TODO} sourceMap an optional source map + * @param {Object=} associatedObjectForCache object for caching + * @returns {Source} the created source + */ + createSourceForAsset( + context, + name, + content, + sourceMap, + associatedObjectForCache + ) { + if (sourceMap) { + if ( + typeof sourceMap === "string" && + (this.useSourceMap || this.useSimpleSourceMap) + ) { + return new OriginalSource( + content, + contextifySourceUrl(context, sourceMap, associatedObjectForCache) + ); + } - compiler.cache.hooks.store.tap( - { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, - (identifier, etag, data) => { - pendingIdleTasks.set(identifier, () => - strategy.store(identifier, etag, data) + if (this.useSourceMap) { + return new SourceMapSource( + content, + name, + contextifySourceMap(context, sourceMap, associatedObjectForCache) ); } - ); + } - compiler.cache.hooks.get.tapPromise( - { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, - (identifier, etag, gotHandlers) => { - const restore = () => - strategy.restore(identifier, etag).then(cacheEntry => { - if (cacheEntry === undefined) { - gotHandlers.push((result, callback) => { - if (result !== undefined) { - pendingIdleTasks.set(identifier, () => - strategy.store(identifier, etag, result) - ); - } - callback(); - }); - } else { - return cacheEntry; - } - }); - const pendingTask = pendingIdleTasks.get(identifier); - if (pendingTask !== undefined) { - pendingIdleTasks.delete(identifier); - return pendingTask().then(restore); + return new RawSource(content); + } + + /** + * @param {ResolverWithOptions} resolver a resolver + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {InputFileSystem} fs file system from reading + * @param {NormalModuleCompilationHooks} hooks the hooks + * @returns {NormalModuleLoaderContext} loader context + */ + _createLoaderContext(resolver, options, compilation, fs, hooks) { + const { requestShortener } = compilation.runtimeTemplate; + const getCurrentLoaderName = () => { + const currentLoader = this.getCurrentLoader(loaderContext); + if (!currentLoader) return "(not in loader scope)"; + return requestShortener.shorten(currentLoader.loader); + }; + const getResolveContext = () => { + return { + fileDependencies: { + add: d => loaderContext.addDependency(d) + }, + contextDependencies: { + add: d => loaderContext.addContextDependency(d) + }, + missingDependencies: { + add: d => loaderContext.addMissingDependency(d) } - return restore(); - } + }; + }; + const getAbsolutify = memoize(() => + absolutify.bindCache(compilation.compiler.root) ); - - compiler.cache.hooks.storeBuildDependencies.tap( - { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, - dependencies => { - pendingIdleTasks.set(BUILD_DEPENDENCIES_KEY, () => - strategy.storeBuildDependencies(dependencies) - ); - } + const getAbsolutifyInContext = memoize(() => + absolutify.bindContextCache(this.context, compilation.compiler.root) + ); + const getContextify = memoize(() => + contextify.bindCache(compilation.compiler.root) ); + const getContextifyInContext = memoize(() => + contextify.bindContextCache(this.context, compilation.compiler.root) + ); + const utils = { + absolutify: (context, request) => { + return context === this.context + ? getAbsolutifyInContext()(request) + : getAbsolutify()(context, request); + }, + contextify: (context, request) => { + return context === this.context + ? getContextifyInContext()(request) + : getContextify()(context, request); + }, + createHash: type => { + return createHash(type || compilation.outputOptions.hashFunction); + } + }; + const loaderContext = { + version: 2, + getOptions: schema => { + const loader = this.getCurrentLoader(loaderContext); - compiler.cache.hooks.shutdown.tapPromise( - { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, - () => { - if (idleTimer) { - clearTimeout(idleTimer); - idleTimer = undefined; + let { options } = loader; + + if (typeof options === "string") { + if (options.substr(0, 1) === "{" && options.substr(-1) === "}") { + try { + options = parseJson(options); + } catch (e) { + throw new Error(`Cannot parse string options: ${e.message}`); + } + } else { + options = querystring.parse(options, "&", "=", { + maxKeys: 0 + }); + } } - isIdle = false; - const reportProgress = ProgressPlugin.getReporter(compiler); - const jobs = Array.from(pendingIdleTasks.values()); - if (reportProgress) reportProgress(0, "process pending cache items"); - const promises = jobs.map(fn => fn()); - pendingIdleTasks.clear(); - promises.push(currentIdlePromise); - const promise = Promise.all(promises); - currentIdlePromise = promise.then(() => strategy.afterAllStored()); - if (reportProgress) { - currentIdlePromise = currentIdlePromise.then(() => { - reportProgress(1, `stored`); - }); + + if (options === null || options === undefined) { + options = {}; } - return currentIdlePromise.then(() => { - // Reset strategy - if (strategy.clear) strategy.clear(); - }); - } - ); - /** @type {Promise} */ - let currentIdlePromise = resolvedPromise; - let isIdle = false; - let isInitialStore = true; - const processIdleTasks = () => { - if (isIdle) { - const startTime = Date.now(); - if (pendingIdleTasks.size > 0) { - const promises = [currentIdlePromise]; - const maxTime = startTime + 100; - let maxCount = 100; - for (const [filename, factory] of pendingIdleTasks) { - pendingIdleTasks.delete(filename); - promises.push(factory()); - if (maxCount-- <= 0 || Date.now() > maxTime) break; + if (schema) { + let name = "Loader"; + let baseDataPath = "options"; + let match; + if (schema.title && (match = /^(.+) (.+)$/.exec(schema.title))) { + [, name, baseDataPath] = match; } - currentIdlePromise = Promise.all(promises); - currentIdlePromise.then(() => { - timeSpendInStore += Date.now() - startTime; - // Allow to exit the process between - idleTimer = setTimeout(processIdleTasks, 0); - idleTimer.unref(); + getValidate()(schema, options, { + name, + baseDataPath }); - return; } - currentIdlePromise = currentIdlePromise - .then(async () => { - await strategy.afterAllStored(); - timeSpendInStore += Date.now() - startTime; - avgTimeSpendInStore = - Math.max(avgTimeSpendInStore, timeSpendInStore) * 0.9 + - timeSpendInStore * 0.1; - timeSpendInStore = 0; - timeSpendInBuild = 0; + + return options; + }, + emitWarning: warning => { + if (!(warning instanceof Error)) { + warning = new NonErrorEmittedError(warning); + } + this.addWarning( + new ModuleWarning(warning, { + from: getCurrentLoaderName() }) - .catch(err => { - const logger = compiler.getInfrastructureLogger( - "IdleFileCachePlugin" - ); - logger.warn(`Background tasks during idle failed: ${err.message}`); - logger.debug(err.stack); - }); - isInitialStore = false; - } - }; - let idleTimer = undefined; - compiler.cache.hooks.beginIdle.tap( - { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, - () => { - const isLargeChange = timeSpendInBuild > avgTimeSpendInStore * 2; - if (isInitialStore && idleTimeoutForInitialStore < idleTimeout) { - compiler - .getInfrastructureLogger("IdleFileCachePlugin") - .log( - `Initial cache was generated and cache will be persisted in ${ - idleTimeoutForInitialStore / 1000 - }s.` - ); - } else if ( - isLargeChange && - idleTimeoutAfterLargeChanges < idleTimeout - ) { - compiler - .getInfrastructureLogger("IdleFileCachePlugin") - .log( - `Spend ${Math.round(timeSpendInBuild) / 1000}s in build and ${ - Math.round(avgTimeSpendInStore) / 1000 - }s in average in cache store. This is considered as large change and cache will be persisted in ${ - idleTimeoutAfterLargeChanges / 1000 - }s.` - ); + ); + }, + emitError: error => { + if (!(error instanceof Error)) { + error = new NonErrorEmittedError(error); } - idleTimer = setTimeout(() => { - idleTimer = undefined; - isIdle = true; - resolvedPromise.then(processIdleTasks); - }, Math.min(isInitialStore ? idleTimeoutForInitialStore : Infinity, isLargeChange ? idleTimeoutAfterLargeChanges : Infinity, idleTimeout)); - idleTimer.unref(); - } - ); - compiler.cache.hooks.endIdle.tap( - { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, - () => { - if (idleTimer) { - clearTimeout(idleTimer); - idleTimer = undefined; + this.addError( + new ModuleError(error, { + from: getCurrentLoaderName() + }) + ); + }, + getLogger: name => { + const currentLoader = this.getCurrentLoader(loaderContext); + return compilation.getLogger(() => + [currentLoader && currentLoader.loader, name, this.identifier()] + .filter(Boolean) + .join("|") + ); + }, + resolve(context, request, callback) { + resolver.resolve({}, context, request, getResolveContext(), callback); + }, + getResolve(options) { + const child = options ? resolver.withOptions(options) : resolver; + return (context, request, callback) => { + if (callback) { + child.resolve({}, context, request, getResolveContext(), callback); + } else { + return new Promise((resolve, reject) => { + child.resolve( + {}, + context, + request, + getResolveContext(), + (err, result) => { + if (err) reject(err); + else resolve(result); + } + ); + }); + } + }; + }, + emitFile: (name, content, sourceMap, assetInfo) => { + if (!this.buildInfo.assets) { + this.buildInfo.assets = Object.create(null); + this.buildInfo.assetsInfo = new Map(); } - isIdle = false; - } - ); - compiler.hooks.done.tap("IdleFileCachePlugin", stats => { - // 10% build overhead is ignored, as it's not cacheable - timeSpendInBuild *= 0.9; - timeSpendInBuild += stats.endTime - stats.startTime; - }); - } -} + this.buildInfo.assets[name] = this.createSourceForAsset( + options.context, + name, + content, + sourceMap, + compilation.compiler.root + ); + this.buildInfo.assetsInfo.set(name, assetInfo); + }, + addBuildDependency: dep => { + if (this.buildInfo.buildDependencies === undefined) { + this.buildInfo.buildDependencies = new LazySet(); + } + this.buildInfo.buildDependencies.add(dep); + }, + utils, + rootContext: options.context, + webpack: true, + sourceMap: !!this.useSourceMap, + mode: options.mode || "production", + _module: this, + _compilation: compilation, + _compiler: compilation.compiler, + fs: fs + }; -module.exports = IdleFileCachePlugin; + Object.assign(loaderContext, options.loader); + hooks.loader.call(loaderContext, this); -/***/ }), + return loaderContext; + } -/***/ 52539: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + getCurrentLoader(loaderContext, index = loaderContext.loaderIndex) { + if ( + this.loaders && + this.loaders.length && + index < this.loaders.length && + index >= 0 && + this.loaders[index] + ) { + return this.loaders[index]; + } + return null; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {string} context the compilation context + * @param {string | Buffer} content the content + * @param {string | TODO} sourceMap an optional source map + * @param {Object=} associatedObjectForCache object for caching + * @returns {Source} the created source + */ + createSource(context, content, sourceMap, associatedObjectForCache) { + if (Buffer.isBuffer(content)) { + return new RawSource(content); + } + // if there is no identifier return raw source + if (!this.identifier) { + return new RawSource(content); + } + // from here on we assume we have an identifier + const identifier = this.identifier(); -const Cache = __webpack_require__(7592); + if (this.useSourceMap && sourceMap) { + return new SourceMapSource( + content, + contextifySourceUrl(context, identifier, associatedObjectForCache), + contextifySourceMap(context, sourceMap, associatedObjectForCache) + ); + } -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Cache").Etag} Etag */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ + if (this.useSourceMap || this.useSimpleSourceMap) { + return new OriginalSource( + content, + contextifySourceUrl(context, identifier, associatedObjectForCache) + ); + } + + return new RawSource(content); + } -class MemoryCachePlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {NormalModuleCompilationHooks} hooks the hooks + * @param {function((WebpackError | null)=): void} callback callback function * @returns {void} */ - apply(compiler) { - /** @type {Map} */ - const cache = new Map(); - compiler.cache.hooks.store.tap( - { name: "MemoryCachePlugin", stage: Cache.STAGE_MEMORY }, - (identifier, etag, data) => { - cache.set(identifier, { etag, data }); - } + _doBuild(options, compilation, resolver, fs, hooks, callback) { + const loaderContext = this._createLoaderContext( + resolver, + options, + compilation, + fs, + hooks ); - compiler.cache.hooks.get.tap( - { name: "MemoryCachePlugin", stage: Cache.STAGE_MEMORY }, - (identifier, etag, gotHandlers) => { - const cacheEntry = cache.get(identifier); - if (cacheEntry === null) { - return null; - } else if (cacheEntry !== undefined) { - return cacheEntry.etag === etag ? cacheEntry.data : null; + + const processResult = (err, result) => { + if (err) { + if (!(err instanceof Error)) { + err = new NonErrorEmittedError(err); } - gotHandlers.push((result, callback) => { - if (result === undefined) { - cache.set(identifier, null); - } else { - cache.set(identifier, { etag, data: result }); - } - return callback(); + const currentLoader = this.getCurrentLoader(loaderContext); + const error = new ModuleBuildError(err, { + from: + currentLoader && + compilation.runtimeTemplate.requestShortener.shorten( + currentLoader.loader + ) }); + return callback(error); } - ); - compiler.cache.hooks.shutdown.tap( - { name: "MemoryCachePlugin", stage: Cache.STAGE_MEMORY }, - () => { - cache.clear(); - } - ); - } -} -module.exports = MemoryCachePlugin; - - -/***/ }), - -/***/ 99334: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const source = result[0]; + const sourceMap = result.length >= 1 ? result[1] : null; + const extraInfo = result.length >= 2 ? result[2] : null; + if (!Buffer.isBuffer(source) && typeof source !== "string") { + const currentLoader = this.getCurrentLoader(loaderContext, 0); + const err = new Error( + `Final loader (${ + currentLoader + ? compilation.runtimeTemplate.requestShortener.shorten( + currentLoader.loader + ) + : "unknown" + }) didn't return a Buffer or String` + ); + const error = new ModuleBuildError(err); + return callback(error); + } + this._source = this.createSource( + options.context, + this.binary ? asBuffer(source) : asString(source), + sourceMap, + compilation.compiler.root + ); + if (this._sourceSizes !== undefined) this._sourceSizes.clear(); + this._ast = + typeof extraInfo === "object" && + extraInfo !== null && + extraInfo.webpackAST !== undefined + ? extraInfo.webpackAST + : null; + return callback(); + }; -const Cache = __webpack_require__(7592); + this.buildInfo.fileDependencies = new LazySet(); + this.buildInfo.contextDependencies = new LazySet(); + this.buildInfo.missingDependencies = new LazySet(); + this.buildInfo.cacheable = true; -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Cache").Etag} Etag */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ + try { + hooks.beforeLoaders.call(this.loaders, this, loaderContext); + } catch (err) { + processResult(err); + return; + } -class MemoryWithGcCachePlugin { - constructor({ maxGenerations }) { - this._maxGenerations = maxGenerations; - } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const maxGenerations = this._maxGenerations; - /** @type {Map} */ - const cache = new Map(); - /** @type {Map} */ - const oldCache = new Map(); - let generation = 0; - let cachePosition = 0; - const logger = compiler.getInfrastructureLogger("MemoryWithGcCachePlugin"); - compiler.hooks.afterDone.tap("MemoryWithGcCachePlugin", () => { - generation++; - let clearedEntries = 0; - let lastClearedIdentifier; - for (const [identifier, entry] of oldCache) { - if (entry.until > generation) break; + if (this.loaders.length > 0) { + this.buildInfo.buildDependencies = new LazySet(); + } - oldCache.delete(identifier); - if (cache.get(identifier) === undefined) { - cache.delete(identifier); - clearedEntries++; - lastClearedIdentifier = identifier; - } - } - if (clearedEntries > 0 || oldCache.size > 0) { - logger.log( - `${cache.size - oldCache.size} active entries, ${ - oldCache.size - } recently unused cached entries${ - clearedEntries > 0 - ? `, ${clearedEntries} old unused cache entries removed e. g. ${lastClearedIdentifier}` - : "" - }` - ); - } - let i = (cache.size / maxGenerations) | 0; - let j = cachePosition >= cache.size ? 0 : cachePosition; - cachePosition = j + i; - for (const [identifier, entry] of cache) { - if (j !== 0) { - j--; - continue; - } - if (entry !== undefined) { - // We don't delete the cache entry, but set it to undefined instead - // This reserves the location in the data table and avoids rehashing - // when constantly adding and removing entries. - // It will be deleted when removed from oldCache. - cache.set(identifier, undefined); - oldCache.delete(identifier); - oldCache.set(identifier, { - entry, - until: generation + maxGenerations - }); - if (i-- === 0) break; + runLoaders( + { + resource: this.resource, + loaders: this.loaders, + context: loaderContext, + processResource: (loaderContext, resourcePath, callback) => { + const resource = loaderContext.resource; + const scheme = getScheme(resource); + hooks.readResource + .for(scheme) + .callAsync(loaderContext, (err, result) => { + if (err) return callback(err); + if (typeof result !== "string" && !result) { + return callback(new UnhandledSchemeError(scheme, resource)); + } + return callback(null, result); + }); } - } - }); - compiler.cache.hooks.store.tap( - { name: "MemoryWithGcCachePlugin", stage: Cache.STAGE_MEMORY }, - (identifier, etag, data) => { - cache.set(identifier, { etag, data }); - } - ); - compiler.cache.hooks.get.tap( - { name: "MemoryWithGcCachePlugin", stage: Cache.STAGE_MEMORY }, - (identifier, etag, gotHandlers) => { - const cacheEntry = cache.get(identifier); - if (cacheEntry === null) { - return null; - } else if (cacheEntry !== undefined) { - return cacheEntry.etag === etag ? cacheEntry.data : null; + }, + (err, result) => { + // Cleanup loaderContext to avoid leaking memory in ICs + loaderContext._compilation = + loaderContext._compiler = + loaderContext._module = + loaderContext.fs = + undefined; + + if (!result) { + this.buildInfo.cacheable = false; + return processResult( + err || new Error("No result from loader-runner processing"), + null + ); } - const oldCacheEntry = oldCache.get(identifier); - if (oldCacheEntry !== undefined) { - const cacheEntry = oldCacheEntry.entry; - if (cacheEntry === null) { - oldCache.delete(identifier); - cache.set(identifier, cacheEntry); - return null; - } else { - if (cacheEntry.etag !== etag) return null; - oldCache.delete(identifier); - cache.set(identifier, cacheEntry); - return cacheEntry.data; - } + this.buildInfo.fileDependencies.addAll(result.fileDependencies); + this.buildInfo.contextDependencies.addAll(result.contextDependencies); + this.buildInfo.missingDependencies.addAll(result.missingDependencies); + for (const loader of this.loaders) { + this.buildInfo.buildDependencies.add(loader.loader); } - gotHandlers.push((result, callback) => { - if (result === undefined) { - cache.set(identifier, null); - } else { - cache.set(identifier, { etag, data: result }); - } - return callback(); - }); - } - ); - compiler.cache.hooks.shutdown.tap( - { name: "MemoryWithGcCachePlugin", stage: Cache.STAGE_MEMORY }, - () => { - cache.clear(); - oldCache.clear(); + this.buildInfo.cacheable = this.buildInfo.cacheable && result.cacheable; + processResult(err, result.result); } ); } -} -module.exports = MemoryWithGcCachePlugin; - - -/***/ }), - -/***/ 86180: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const FileSystemInfo = __webpack_require__(79453); -const ProgressPlugin = __webpack_require__(13216); -const { formatSize } = __webpack_require__(71070); -const SerializerMiddleware = __webpack_require__(83137); -const LazySet = __webpack_require__(38938); -const makeSerializable = __webpack_require__(33032); -const memoize = __webpack_require__(78676); -const { - createFileSerializer, - NOT_SERIALIZABLE -} = __webpack_require__(8282); - -/** @typedef {import("../../declarations/WebpackOptions").SnapshotOptions} SnapshotOptions */ -/** @typedef {import("../Cache").Etag} Etag */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../FileSystemInfo").Snapshot} Snapshot */ -/** @typedef {import("../logging/Logger").Logger} Logger */ -/** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */ - -class PackContainer { /** - * @param {Object} data stored data - * @param {string} version version identifier - * @param {Snapshot} buildSnapshot snapshot of all build dependencies - * @param {Set} buildDependencies list of all unresolved build dependencies captured - * @param {Map} resolveResults result of the resolved build dependencies - * @param {Snapshot} resolveBuildDependenciesSnapshot snapshot of the dependencies of the build dependencies resolving + * @param {WebpackError} error the error + * @returns {void} */ - constructor( - data, - version, - buildSnapshot, - buildDependencies, - resolveResults, - resolveBuildDependenciesSnapshot - ) { - this.data = data; - this.version = version; - this.buildSnapshot = buildSnapshot; - this.buildDependencies = buildDependencies; - this.resolveResults = resolveResults; - this.resolveBuildDependenciesSnapshot = resolveBuildDependenciesSnapshot; - } - - serialize({ write, writeLazy }) { - write(this.version); - write(this.buildSnapshot); - write(this.buildDependencies); - write(this.resolveResults); - write(this.resolveBuildDependenciesSnapshot); - writeLazy(this.data); - } - - deserialize({ read }) { - this.version = read(); - this.buildSnapshot = read(); - this.buildDependencies = read(); - this.resolveResults = read(); - this.resolveBuildDependenciesSnapshot = read(); - this.data = read(); + markModuleAsErrored(error) { + // Restore build meta from successful build to keep importing state + this.buildMeta = { ...this._lastSuccessfulBuildMeta }; + this.error = error; + this.addError(error); } -} - -makeSerializable( - PackContainer, - "webpack/lib/cache/PackFileCacheStrategy", - "PackContainer" -); - -const MIN_CONTENT_SIZE = 1024 * 1024; // 1 MB -const CONTENT_COUNT_TO_MERGE = 10; -const MIN_ITEMS_IN_FRESH_PACK = 100; -const MAX_ITEMS_IN_FRESH_PACK = 50000; -const MAX_TIME_IN_FRESH_PACK = 1 * 60 * 1000; // 1 min -class PackItemInfo { - /** - * @param {string} identifier identifier of item - * @param {string | null} etag etag of item - * @param {any} value fresh value of item - */ - constructor(identifier, etag, value) { - this.identifier = identifier; - this.etag = etag; - this.location = -1; - this.lastAccess = Date.now(); - this.freshValue = value; - } -} + applyNoParseRule(rule, content) { + // must start with "rule" if rule is a string + if (typeof rule === "string") { + return content.startsWith(rule); + } -class Pack { - constructor(logger, maxAge) { - /** @type {Map} */ - this.itemInfo = new Map(); - /** @type {string[]} */ - this.requests = []; - this.requestsTimeout = undefined; - /** @type {Map} */ - this.freshContent = new Map(); - /** @type {(undefined | PackContent)[]} */ - this.content = []; - this.invalid = false; - this.logger = logger; - this.maxAge = maxAge; + if (typeof rule === "function") { + return rule(content); + } + // we assume rule is a regexp + return rule.test(content); } - _addRequest(identifier) { - this.requests.push(identifier); - if (this.requestsTimeout === undefined) { - this.requestsTimeout = setTimeout(() => { - this.requests.push(undefined); - this.requestsTimeout = undefined; - }, MAX_TIME_IN_FRESH_PACK); - if (this.requestsTimeout.unref) this.requestsTimeout.unref(); + // check if module should not be parsed + // returns "true" if the module should !not! be parsed + // returns "false" if the module !must! be parsed + shouldPreventParsing(noParseRule, request) { + // if no noParseRule exists, return false + // the module !must! be parsed. + if (!noParseRule) { + return false; } - } - stopCapturingRequests() { - if (this.requestsTimeout !== undefined) { - clearTimeout(this.requestsTimeout); - this.requestsTimeout = undefined; + // we only have one rule to check + if (!Array.isArray(noParseRule)) { + // returns "true" if the module is !not! to be parsed + return this.applyNoParseRule(noParseRule, request); } - } - /** - * @param {string} identifier unique name for the resource - * @param {string | null} etag etag of the resource - * @returns {any} cached content - */ - get(identifier, etag) { - const info = this.itemInfo.get(identifier); - this._addRequest(identifier); - if (info === undefined) { - return undefined; - } - if (info.etag !== etag) return null; - info.lastAccess = Date.now(); - const loc = info.location; - if (loc === -1) { - return info.freshValue; - } else { - if (!this.content[loc]) { - return undefined; + for (let i = 0; i < noParseRule.length; i++) { + const rule = noParseRule[i]; + // early exit on first truthy match + // this module is !not! to be parsed + if (this.applyNoParseRule(rule, request)) { + return true; } - return this.content[loc].get(identifier); } + // no match found, so this module !should! be parsed + return false; + } + + _initBuildHash(compilation) { + const hash = createHash(compilation.outputOptions.hashFunction); + if (this._source) { + hash.update("source"); + this._source.updateHash(hash); + } + hash.update("meta"); + hash.update(JSON.stringify(this.buildMeta)); + this.buildInfo.hash = /** @type {string} */ (hash.digest("hex")); } /** - * @param {string} identifier unique name for the resource - * @param {string | null} etag etag of the resource - * @param {any} data cached content + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function * @returns {void} */ - set(identifier, etag, data) { - if (!this.invalid) { - this.invalid = true; - this.logger.log(`Pack got invalid because of write to: ${identifier}`); - } - const info = this.itemInfo.get(identifier); - if (info === undefined) { - const newInfo = new PackItemInfo(identifier, etag, data); - this.itemInfo.set(identifier, newInfo); - this._addRequest(identifier); - this.freshContent.set(identifier, newInfo); - } else { - const loc = info.location; - if (loc >= 0) { - this._addRequest(identifier); - this.freshContent.set(identifier, info); - const content = this.content[loc]; - content.delete(identifier); - if (content.items.size === 0) { - this.content[loc] = undefined; - this.logger.debug("Pack %d got empty and is removed", loc); - } + build(options, compilation, resolver, fs, callback) { + this._forceBuild = false; + this._source = null; + if (this._sourceSizes !== undefined) this._sourceSizes.clear(); + this._sourceTypes = undefined; + this._ast = null; + this.error = null; + this.clearWarningsAndErrors(); + this.clearDependenciesAndBlocks(); + this.buildMeta = {}; + this.buildInfo = { + cacheable: false, + parsed: true, + fileDependencies: undefined, + contextDependencies: undefined, + missingDependencies: undefined, + buildDependencies: undefined, + valueDependencies: undefined, + hash: undefined, + assets: undefined, + assetsInfo: undefined + }; + + const startTime = compilation.compiler.fsStartTime || Date.now(); + + const hooks = NormalModule.getCompilationHooks(compilation); + + return this._doBuild(options, compilation, resolver, fs, hooks, err => { + // if we have an error mark module as failed and exit + if (err) { + this.markModuleAsErrored(err); + this._initBuildHash(compilation); + return callback(); } - info.freshValue = data; - info.lastAccess = Date.now(); - info.etag = etag; - info.location = -1; - } - } - getContentStats() { - let count = 0; - let size = 0; - for (const content of this.content) { - if (content !== undefined) { - count++; - const s = content.getSize(); - if (s > 0) { - size += s; + const handleParseError = e => { + const source = this._source.source(); + const loaders = this.loaders.map(item => + contextify(options.context, item.loader, compilation.compiler.root) + ); + const error = new ModuleParseError(source, e, loaders, this.type); + this.markModuleAsErrored(error); + this._initBuildHash(compilation); + return callback(); + }; + + const handleParseResult = result => { + this.dependencies.sort( + concatComparators( + compareSelect(a => a.loc, compareLocations), + keepOriginalOrder(this.dependencies) + ) + ); + this._initBuildHash(compilation); + this._lastSuccessfulBuildMeta = this.buildMeta; + return handleBuildDone(); + }; + + const handleBuildDone = () => { + try { + hooks.beforeSnapshot.call(this); + } catch (err) { + this.markModuleAsErrored(err); + return callback(); + } + + const snapshotOptions = compilation.options.snapshot.module; + if (!this.buildInfo.cacheable || !snapshotOptions) { + return callback(); + } + // add warning for all non-absolute paths in fileDependencies, etc + // This makes it easier to find problems with watching and/or caching + let nonAbsoluteDependencies = undefined; + const checkDependencies = deps => { + for (const dep of deps) { + if (!ABSOLUTE_PATH_REGEX.test(dep)) { + if (nonAbsoluteDependencies === undefined) + nonAbsoluteDependencies = new Set(); + nonAbsoluteDependencies.add(dep); + deps.delete(dep); + try { + const depWithoutGlob = dep.replace(/[\\/]?\*.*$/, ""); + const absolute = join( + compilation.fileSystemInfo.fs, + this.context, + depWithoutGlob + ); + if (absolute !== dep && ABSOLUTE_PATH_REGEX.test(absolute)) { + (depWithoutGlob !== dep + ? this.buildInfo.contextDependencies + : deps + ).add(absolute); + } + } catch (e) { + // ignore + } + } + } + }; + checkDependencies(this.buildInfo.fileDependencies); + checkDependencies(this.buildInfo.missingDependencies); + checkDependencies(this.buildInfo.contextDependencies); + if (nonAbsoluteDependencies !== undefined) { + const InvalidDependenciesModuleWarning = + getInvalidDependenciesModuleWarning(); + this.addWarning( + new InvalidDependenciesModuleWarning(this, nonAbsoluteDependencies) + ); } + // convert file/context/missingDependencies into filesystem snapshot + compilation.fileSystemInfo.createSnapshot( + startTime, + this.buildInfo.fileDependencies, + this.buildInfo.contextDependencies, + this.buildInfo.missingDependencies, + snapshotOptions, + (err, snapshot) => { + if (err) { + this.markModuleAsErrored(err); + return; + } + this.buildInfo.fileDependencies = undefined; + this.buildInfo.contextDependencies = undefined; + this.buildInfo.missingDependencies = undefined; + this.buildInfo.snapshot = snapshot; + return callback(); + } + ); + }; + + try { + hooks.beforeParse.call(this); + } catch (err) { + this.markModuleAsErrored(err); + this._initBuildHash(compilation); + return callback(); } - } - return { count, size }; + + // check if this module should !not! be parsed. + // if so, exit here; + const noParseRule = options.module && options.module.noParse; + if (this.shouldPreventParsing(noParseRule, this.request)) { + // We assume that we need module and exports + this.buildInfo.parsed = false; + this._initBuildHash(compilation); + return handleBuildDone(); + } + + let result; + try { + const source = this._source.source(); + result = this.parser.parse(this._ast || source, { + source, + current: this, + module: this, + compilation: compilation, + options: options + }); + } catch (e) { + handleParseError(e); + return; + } + handleParseResult(result); + }); } /** - * @returns {number} new location of data entries + * @param {ConcatenationBailoutReasonContext} context context + * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated */ - _findLocation() { - let i; - for (i = 0; i < this.content.length && this.content[i] !== undefined; i++); - return i; + getConcatenationBailoutReason(context) { + return this.generator.getConcatenationBailoutReason(this, context); } - _gcAndUpdateLocation(items, usedItems, newLoc) { - let count = 0; - let lastGC; - const now = Date.now(); - for (const identifier of items) { - const info = this.itemInfo.get(identifier); - if (now - info.lastAccess > this.maxAge) { - this.itemInfo.delete(identifier); - items.delete(identifier); - usedItems.delete(identifier); - count++; - lastGC = identifier; - } else { - info.location = newLoc; - } - } - if (count > 0) { - this.logger.log( - "Garbage Collected %d old items at pack %d (%d items remaining) e. g. %s", - count, - newLoc, - items.size, - lastGC - ); + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this module should be connected to referencing modules when consumed for side-effects only + */ + getSideEffectsConnectionState(moduleGraph) { + if (this.factoryMeta !== undefined) { + if (this.factoryMeta.sideEffectFree) return false; + if (this.factoryMeta.sideEffectFree === false) return true; } - } - - _persistFreshContent() { - const itemsCount = this.freshContent.size; - if (itemsCount > 0) { - const packCount = Math.ceil(itemsCount / MAX_ITEMS_IN_FRESH_PACK); - const itemsPerPack = Math.ceil(itemsCount / packCount); - const packs = []; - let i = 0; - let ignoreNextTimeTick = false; - const createNextPack = () => { - const loc = this._findLocation(); - this.content[loc] = null; // reserve - const pack = { - /** @type {Set} */ - items: new Set(), - /** @type {Map} */ - map: new Map(), - loc - }; - packs.push(pack); - return pack; - }; - let pack = createNextPack(); - if (this.requestsTimeout !== undefined) - clearTimeout(this.requestsTimeout); - for (const identifier of this.requests) { - if (identifier === undefined) { - if (ignoreNextTimeTick) { - ignoreNextTimeTick = false; - } else if (pack.items.size >= MIN_ITEMS_IN_FRESH_PACK) { - i = 0; - pack = createNextPack(); + if (this.buildMeta !== undefined && this.buildMeta.sideEffectFree) { + if (this._isEvaluatingSideEffects) + return ModuleGraphConnection.CIRCULAR_CONNECTION; + this._isEvaluatingSideEffects = true; + /** @type {ConnectionState} */ + let current = false; + for (const dep of this.dependencies) { + const state = dep.getModuleEvaluationSideEffectsState(moduleGraph); + if (state === true) { + if ( + this._addedSideEffectsBailout === undefined + ? ((this._addedSideEffectsBailout = new WeakSet()), true) + : !this._addedSideEffectsBailout.has(moduleGraph) + ) { + this._addedSideEffectsBailout.add(moduleGraph); + moduleGraph + .getOptimizationBailout(this) + .push( + () => + `Dependency (${ + dep.type + }) with side effects at ${formatLocation(dep.loc)}` + ); } - continue; - } - const info = this.freshContent.get(identifier); - if (info === undefined) continue; - pack.items.add(identifier); - pack.map.set(identifier, info.freshValue); - info.location = pack.loc; - info.freshValue = undefined; - this.freshContent.delete(identifier); - if (++i > itemsPerPack) { - i = 0; - pack = createNextPack(); - ignoreNextTimeTick = true; + this._isEvaluatingSideEffects = false; + return true; + } else if (state !== ModuleGraphConnection.CIRCULAR_CONNECTION) { + current = ModuleGraphConnection.addConnectionStates(current, state); } } - this.requests.length = 0; - for (const pack of packs) { - this.content[pack.loc] = new PackContent( - pack.items, - new Set(pack.items), - new PackContentItems(pack.map) - ); - } - this.logger.log( - `${itemsCount} fresh items in cache put into pack ${ - packs.length > 1 - ? packs - .map(pack => `${pack.loc} (${pack.items.size} items)`) - .join(", ") - : packs[0].loc - }` - ); + this._isEvaluatingSideEffects = false; + // When caching is implemented here, make sure to not cache when + // at least one circular connection was in the loop above + return current; + } else { + return true; } } /** - * Merges small content files to a single content file + * @returns {Set} types available (do not mutate) */ - _optimizeSmallContent() { - // 1. Find all small content files - // Treat unused content files separately to avoid - // a merge-split cycle - /** @type {number[]} */ - const smallUsedContents = []; - /** @type {number} */ - let smallUsedContentSize = 0; - /** @type {number[]} */ - const smallUnusedContents = []; - /** @type {number} */ - let smallUnusedContentSize = 0; - for (let i = 0; i < this.content.length; i++) { - const content = this.content[i]; - if (content === undefined) continue; - if (content.outdated) continue; - const size = content.getSize(); - if (size < 0 || size > MIN_CONTENT_SIZE) continue; - if (content.used.size > 0) { - smallUsedContents.push(i); - smallUsedContentSize += size; - } else { - smallUnusedContents.push(i); - smallUnusedContentSize += size; - } + getSourceTypes() { + if (this._sourceTypes === undefined) { + this._sourceTypes = this.generator.getTypes(this); } + return this._sourceTypes; + } - // 2. Check if minimum number is reached - let mergedIndices; - if ( - smallUsedContents.length >= CONTENT_COUNT_TO_MERGE || - smallUsedContentSize > MIN_CONTENT_SIZE - ) { - mergedIndices = smallUsedContents; - } else if ( - smallUnusedContents.length >= CONTENT_COUNT_TO_MERGE || - smallUnusedContentSize > MIN_CONTENT_SIZE - ) { - mergedIndices = smallUnusedContents; - } else return; - - const mergedContent = []; + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration({ + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtime, + concatenationScope, + codeGenerationResults + }) { + /** @type {Set} */ + const runtimeRequirements = new Set(); - // 3. Remove old content entries - for (const i of mergedIndices) { - mergedContent.push(this.content[i]); - this.content[i] = undefined; + if (!this.buildInfo.parsed) { + runtimeRequirements.add(RuntimeGlobals.module); + runtimeRequirements.add(RuntimeGlobals.exports); + runtimeRequirements.add(RuntimeGlobals.thisAsExports); } - // 4. Determine merged items - /** @type {Set} */ - const mergedItems = new Set(); - /** @type {Set} */ - const mergedUsedItems = new Set(); - /** @type {(function(Map): Promise)[]} */ - const addToMergedMap = []; - for (const content of mergedContent) { - for (const identifier of content.items) { - mergedItems.add(identifier); - } - for (const identifier of content.used) { - mergedUsedItems.add(identifier); - } - addToMergedMap.push(async map => { - // unpack existing content - // after that values are accessible in .content - await content.unpack( - "it should be merged with other small pack contents" - ); - for (const [identifier, value] of content.content) { - map.set(identifier, value); - } - }); - } + /** @type {Map} */ + let data; + const getData = () => { + if (data === undefined) data = new Map(); + return data; + }; - // 5. GC and update location of merged items - const newLoc = this._findLocation(); - this._gcAndUpdateLocation(mergedItems, mergedUsedItems, newLoc); + const sources = new Map(); + for (const type of this.generator.getTypes(this)) { + const source = this.error + ? new RawSource( + "throw new Error(" + JSON.stringify(this.error.message) + ");" + ) + : this.generator.generate(this, { + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtimeRequirements, + runtime, + concatenationScope, + codeGenerationResults, + getData, + type + }); - // 6. If not empty, store content somewhere - if (mergedItems.size > 0) { - this.content[newLoc] = new PackContent( - mergedItems, - mergedUsedItems, - memoize(async () => { - /** @type {Map} */ - const map = new Map(); - await Promise.all(addToMergedMap.map(fn => fn(map))); - return new PackContentItems(map); - }) - ); - this.logger.log( - "Merged %d small files with %d cache items into pack %d", - mergedContent.length, - mergedItems.size, - newLoc - ); + if (source) { + sources.set(type, new CachedSource(source)); + } } + + /** @type {CodeGenerationResult} */ + const resultEntry = { + sources, + runtimeRequirements, + data + }; + return resultEntry; } /** - * Split large content files with used and unused items - * into two parts to separate used from unused items + * @returns {Source | null} the original source for the module before webpack transformation */ - _optimizeUnusedContent() { - // 1. Find a large content file with used and unused items - for (let i = 0; i < this.content.length; i++) { - const content = this.content[i]; - if (content === undefined) continue; - const size = content.getSize(); - if (size < MIN_CONTENT_SIZE) continue; - const used = content.used.size; - const total = content.items.size; - if (used > 0 && used < total) { - // 2. Remove this content - this.content[i] = undefined; + originalSource() { + return this._source; + } - // 3. Determine items for the used content file - const usedItems = new Set(content.used); - const newLoc = this._findLocation(); - this._gcAndUpdateLocation(usedItems, usedItems, newLoc); + /** + * @returns {void} + */ + invalidateBuild() { + this._forceBuild = true; + } - // 4. Create content file for used items - if (usedItems.size > 0) { - this.content[newLoc] = new PackContent( - usedItems, - new Set(usedItems), - async () => { - await content.unpack( - "it should be splitted into used and unused items" - ); - const map = new Map(); - for (const identifier of usedItems) { - map.set(identifier, content.content.get(identifier)); - } - return new PackContentItems(map); - } - ); - } + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + const { fileSystemInfo, compilation, valueCacheVersions } = context; + // build if enforced + if (this._forceBuild) return callback(null, true); - // 5. Determine items for the unused content file - const unusedItems = new Set(content.items); - const usedOfUnusedItems = new Set(); - for (const identifier of usedItems) { - unusedItems.delete(identifier); - } - const newUnusedLoc = this._findLocation(); - this._gcAndUpdateLocation(unusedItems, usedOfUnusedItems, newUnusedLoc); + // always try to build in case of an error + if (this.error) return callback(null, true); - // 6. Create content file for unused items - if (unusedItems.size > 0) { - this.content[newUnusedLoc] = new PackContent( - unusedItems, - usedOfUnusedItems, - async () => { - await content.unpack( - "it should be splitted into used and unused items" - ); - const map = new Map(); - for (const identifier of unusedItems) { - map.set(identifier, content.content.get(identifier)); - } - return new PackContentItems(map); - } - ); - } + // always build when module is not cacheable + if (!this.buildInfo.cacheable) return callback(null, true); - this.logger.log( - "Split pack %d into pack %d with %d used items and pack %d with %d unused items", - i, - newLoc, - usedItems.size, - newUnusedLoc, - unusedItems.size - ); + // build when there is no snapshot to check + if (!this.buildInfo.snapshot) return callback(null, true); - // optimizing only one of them is good enough and - // reduces the amount of serialization needed - return; + // build when valueDependencies have changed + /** @type {Map>} */ + const valueDependencies = this.buildInfo.valueDependencies; + if (valueDependencies) { + if (!valueCacheVersions) return callback(null, true); + for (const [key, value] of valueDependencies) { + if (value === undefined) return callback(null, true); + const current = valueCacheVersions.get(key); + if ( + value !== current && + (typeof value === "string" || + typeof current === "string" || + current === undefined || + !isSubset(value, current)) + ) { + return callback(null, true); + } } } + + // check snapshot for validity + fileSystemInfo.checkSnapshotValid(this.buildInfo.snapshot, (err, valid) => { + if (err) return callback(err); + if (!valid) return callback(null, true); + const hooks = NormalModule.getCompilationHooks(compilation); + hooks.needBuild.callAsync(this, context, (err, needBuild) => { + if (err) { + return callback( + HookWebpackError.makeWebpackError( + err, + "NormalModule.getCompilationHooks().needBuild" + ) + ); + } + callback(null, !!needBuild); + }); + }); } /** - * Find the content with the oldest item and run GC on that. - * Only runs for one content to avoid large invalidation. + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) */ - _gcOldestContent() { - /** @type {PackItemInfo} */ - let oldest = undefined; - for (const info of this.itemInfo.values()) { - if (oldest === undefined || info.lastAccess < oldest.lastAccess) { - oldest = info; - } + size(type) { + const cachedSize = + this._sourceSizes === undefined ? undefined : this._sourceSizes.get(type); + if (cachedSize !== undefined) { + return cachedSize; } - if (Date.now() - oldest.lastAccess > this.maxAge) { - const loc = oldest.location; - if (loc < 0) return; - const content = this.content[loc]; - const items = new Set(content.items); - const usedItems = new Set(content.used); - this._gcAndUpdateLocation(items, usedItems, loc); - - this.content[loc] = - items.size > 0 - ? new PackContent(items, usedItems, async () => { - await content.unpack( - "it contains old items that should be garbage collected" - ); - const map = new Map(); - for (const identifier of items) { - map.set(identifier, content.content.get(identifier)); - } - return new PackContentItems(map); - }) - : undefined; + const size = Math.max(1, this.generator.getSize(this, type)); + if (this._sourceSizes === undefined) { + this._sourceSizes = new Map(); } + this._sourceSizes.set(type, size); + return size; } - serialize({ write, writeSeparate }) { - this._persistFreshContent(); - this._optimizeSmallContent(); - this._optimizeUnusedContent(); - this._gcOldestContent(); - for (const identifier of this.itemInfo.keys()) { - write(identifier); - } - write(null); // null as marker of the end of keys - for (const info of this.itemInfo.values()) { - write(info.etag); - } - for (const info of this.itemInfo.values()) { - write(info.lastAccess); + /** + * @param {LazySet} fileDependencies set where file dependencies are added to + * @param {LazySet} contextDependencies set where context dependencies are added to + * @param {LazySet} missingDependencies set where missing dependencies are added to + * @param {LazySet} buildDependencies set where build dependencies are added to + */ + addCacheDependencies( + fileDependencies, + contextDependencies, + missingDependencies, + buildDependencies + ) { + const { snapshot, buildDependencies: buildDeps } = this.buildInfo; + if (snapshot) { + fileDependencies.addAll(snapshot.getFileIterable()); + contextDependencies.addAll(snapshot.getContextIterable()); + missingDependencies.addAll(snapshot.getMissingIterable()); + } else { + const { + fileDependencies: fileDeps, + contextDependencies: contextDeps, + missingDependencies: missingDeps + } = this.buildInfo; + if (fileDeps !== undefined) fileDependencies.addAll(fileDeps); + if (contextDeps !== undefined) contextDependencies.addAll(contextDeps); + if (missingDeps !== undefined) missingDependencies.addAll(missingDeps); } - for (let i = 0; i < this.content.length; i++) { - const content = this.content[i]; - if (content !== undefined) { - write(content.items); - content.writeLazy(lazy => writeSeparate(lazy, { name: `${i}` })); - } else { - write(undefined); // undefined marks an empty content slot - } + if (buildDeps !== undefined) { + buildDependencies.addAll(buildDeps); } - write(null); // null as marker of the end of items } - deserialize({ read, logger }) { - this.logger = logger; - { - const items = []; - let item = read(); - while (item !== null) { - items.push(item); - item = read(); - } - this.itemInfo.clear(); - const infoItems = items.map(identifier => { - const info = new PackItemInfo(identifier, undefined, undefined); - this.itemInfo.set(identifier, info); - return info; - }); - for (const info of infoItems) { - info.etag = read(); - } - for (const info of infoItems) { - info.lastAccess = read(); - } - } - this.content.length = 0; - let items = read(); - while (items !== null) { - if (items === undefined) { - this.content.push(items); - } else { - const idx = this.content.length; - const lazy = read(); - this.content.push( - new PackContent( - items, - new Set(), - lazy, - logger, - `${this.content.length}` - ) - ); - for (const identifier of items) { - this.itemInfo.get(identifier).location = idx; - } - } - items = read(); - } + /** + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + hash.update(this.buildInfo.hash); + this.generator.updateHash(hash, { + module: this, + ...context + }); + super.updateHash(hash, context); } -} -makeSerializable(Pack, "webpack/lib/cache/PackFileCacheStrategy", "Pack"); + serialize(context) { + const { write } = context; + // deserialize + write(this._source); + write(this.error); + write(this._lastSuccessfulBuildMeta); + write(this._forceBuild); + super.serialize(context); + } -class PackContentItems { - /** - * @param {Map} map items - */ - constructor(map) { - this.map = map; + static deserialize(context) { + const obj = new NormalModule({ + // will be deserialized by Module + layer: null, + type: "", + // will be filled by updateCacheModule + resource: "", + context: "", + request: null, + userRequest: null, + rawRequest: null, + loaders: null, + matchResource: null, + parser: null, + parserOptions: null, + generator: null, + generatorOptions: null, + resolveOptions: null + }); + obj.deserialize(context); + return obj; } - serialize({ write, snapshot, rollback, logger, profile }) { - if (profile) { - write(false); - for (const [key, value] of this.map) { - const s = snapshot(); - try { - write(key); - const start = process.hrtime(); - write(value); - const durationHr = process.hrtime(start); - const duration = durationHr[0] * 1000 + durationHr[1] / 1e6; - if (duration > 1) { - if (duration > 500) - logger.error(`Serialization of '${key}': ${duration} ms`); - else if (duration > 50) - logger.warn(`Serialization of '${key}': ${duration} ms`); - else if (duration > 10) - logger.info(`Serialization of '${key}': ${duration} ms`); - else if (duration > 5) - logger.log(`Serialization of '${key}': ${duration} ms`); - else logger.debug(`Serialization of '${key}': ${duration} ms`); - } - } catch (e) { - rollback(s); - if (e === NOT_SERIALIZABLE) continue; - logger.warn( - `Skipped not serializable cache item '${key}': ${e.message}` - ); - logger.debug(e.stack); - } - } - write(null); - return; - } - // Try to serialize all at once - const s = snapshot(); - try { - write(true); - write(this.map); - } catch (e) { - rollback(s); + deserialize(context) { + const { read } = context; + this._source = read(); + this.error = read(); + this._lastSuccessfulBuildMeta = read(); + this._forceBuild = read(); + super.deserialize(context); + } +} + +makeSerializable(NormalModule, "webpack/lib/NormalModule"); + +module.exports = NormalModule; + + +/***/ }), + +/***/ 68860: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { getContext } = __webpack_require__(68318); +const asyncLib = __webpack_require__(78175); +const { + AsyncSeriesBailHook, + SyncWaterfallHook, + SyncBailHook, + SyncHook, + HookMap +} = __webpack_require__(41242); +const ChunkGraph = __webpack_require__(64971); +const Module = __webpack_require__(73208); +const ModuleFactory = __webpack_require__(51010); +const ModuleGraph = __webpack_require__(99988); +const NormalModule = __webpack_require__(39); +const BasicEffectRulePlugin = __webpack_require__(30318); +const BasicMatcherRulePlugin = __webpack_require__(94215); +const ObjectMatcherRulePlugin = __webpack_require__(72021); +const RuleSetCompiler = __webpack_require__(83349); +const UseEffectRulePlugin = __webpack_require__(84977); +const LazySet = __webpack_require__(38938); +const { getScheme } = __webpack_require__(54500); +const { cachedCleverMerge, cachedSetProperty } = __webpack_require__(60839); +const { join } = __webpack_require__(17139); +const { + parseResource, + parseResourceWithoutFragment +} = __webpack_require__(82186); + +/** @typedef {import("../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */ +/** @typedef {import("./Generator")} Generator */ +/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ +/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ +/** @typedef {import("./Parser")} Parser */ +/** @typedef {import("./ResolverFactory")} ResolverFactory */ +/** @typedef {import("./dependencies/ModuleDependency")} ModuleDependency */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ + +/** + * @typedef {Object} ResolveData + * @property {ModuleFactoryCreateData["contextInfo"]} contextInfo + * @property {ModuleFactoryCreateData["resolveOptions"]} resolveOptions + * @property {string} context + * @property {string} request + * @property {Record | undefined} assertions + * @property {ModuleDependency[]} dependencies + * @property {string} dependencyType + * @property {Object} createData + * @property {LazySet} fileDependencies + * @property {LazySet} missingDependencies + * @property {LazySet} contextDependencies + * @property {boolean} cacheable allow to use the unsafe cache + */ + +/** + * @typedef {Object} ResourceData + * @property {string} resource + * @property {string} path + * @property {string} query + * @property {string} fragment + * @property {string=} context + */ + +/** @typedef {ResourceData & { data: Record }} ResourceDataWithData */ + +/** @typedef {Object} ParsedLoaderRequest + * @property {string} loader loader + * @property {string|undefined} options options + */ + +const EMPTY_RESOLVE_OPTIONS = {}; +const EMPTY_PARSER_OPTIONS = {}; +const EMPTY_GENERATOR_OPTIONS = {}; +const EMPTY_ELEMENTS = []; + +const MATCH_RESOURCE_REGEX = /^([^!]+)!=!/; + +const loaderToIdent = data => { + if (!data.options) { + return data.loader; + } + if (typeof data.options === "string") { + return data.loader + "?" + data.options; + } + if (typeof data.options !== "object") { + throw new Error("loader options must be string or object"); + } + if (data.ident) { + return data.loader + "??" + data.ident; + } + return data.loader + "?" + JSON.stringify(data.options); +}; - // Try to serialize each item on it's own - write(false); - for (const [key, value] of this.map) { - const s = snapshot(); - try { - write(key); - write(value); - } catch (e) { - rollback(s); - if (e === NOT_SERIALIZABLE) continue; - logger.warn( - `Skipped not serializable cache item '${key}': ${e.message}` - ); - logger.debug(e.stack); - } - } - write(null); - } +const stringifyLoadersAndResource = (loaders, resource) => { + let str = ""; + for (const loader of loaders) { + str += loaderToIdent(loader) + "!"; } + return str + resource; +}; - deserialize({ read, logger, profile }) { - if (read()) { - this.map = read(); - } else if (profile) { - const map = new Map(); - let key = read(); - while (key !== null) { - const start = process.hrtime(); - const value = read(); - const durationHr = process.hrtime(start); - const duration = durationHr[0] * 1000 + durationHr[1] / 1e6; - if (duration > 1) { - if (duration > 100) - logger.error(`Deserialization of '${key}': ${duration} ms`); - else if (duration > 20) - logger.warn(`Deserialization of '${key}': ${duration} ms`); - else if (duration > 5) - logger.info(`Deserialization of '${key}': ${duration} ms`); - else if (duration > 2) - logger.log(`Deserialization of '${key}': ${duration} ms`); - else logger.debug(`Deserialization of '${key}': ${duration} ms`); - } - map.set(key, value); - key = read(); - } - this.map = map; - } else { - const map = new Map(); - let key = read(); - while (key !== null) { - map.set(key, read()); - key = read(); +const needCalls = (times, callback) => { + return err => { + if (--times === 0) { + return callback(err); + } + if (err && times > 0) { + times = NaN; + return callback(err); + } + }; +}; + +const mergeGlobalOptions = (globalOptions, type, localOptions) => { + const parts = type.split("/"); + let result; + let current = ""; + for (const part of parts) { + current = current ? `${current}/${part}` : part; + const options = globalOptions[current]; + if (typeof options === "object") { + if (result === undefined) { + result = options; + } else { + result = cachedCleverMerge(result, options); } - this.map = map; } } -} + if (result === undefined) { + return localOptions; + } else { + return cachedCleverMerge(result, localOptions); + } +}; -makeSerializable( - PackContentItems, - "webpack/lib/cache/PackFileCacheStrategy", - "PackContentItems" -); +// TODO webpack 6 remove +const deprecationChangedHookMessage = (name, hook) => { + const names = hook.taps + .map(tapped => { + return tapped.name; + }) + .join(", "); -class PackContent { - /* - This class can be in these states: - | this.lazy | this.content | this.outdated | state - A1 | undefined | Map | false | fresh content - A2 | undefined | Map | true | (will not happen) - B1 | lazy () => {} | undefined | false | not deserialized - B2 | lazy () => {} | undefined | true | not deserialized, but some items has been removed - C1 | lazy* () => {} | Map | false | deserialized - C2 | lazy* () => {} | Map | true | deserialized, and some items has been removed + return ( + `NormalModuleFactory.${name} (${names}) is no longer a waterfall hook, but a bailing hook instead. ` + + "Do not return the passed object, but modify it instead. " + + "Returning false will ignore the request and results in no module created." + ); +}; - this.used is a subset of this.items. - this.items is a subset of this.content.keys() resp. this.lazy().map.keys() - When this.outdated === false, this.items === this.content.keys() resp. this.lazy().map.keys() - When this.outdated === true, this.items should be used to recreated this.lazy/this.content. - When this.lazy and this.content is set, they contain the same data. - this.get must only be called with a valid item from this.items. - In state C this.lazy is unMemoized - */ +const ruleSetCompiler = new RuleSetCompiler([ + new BasicMatcherRulePlugin("test", "resource"), + new BasicMatcherRulePlugin("scheme"), + new BasicMatcherRulePlugin("mimetype"), + new BasicMatcherRulePlugin("dependency"), + new BasicMatcherRulePlugin("include", "resource"), + new BasicMatcherRulePlugin("exclude", "resource", true), + new BasicMatcherRulePlugin("resource"), + new BasicMatcherRulePlugin("resourceQuery"), + new BasicMatcherRulePlugin("resourceFragment"), + new BasicMatcherRulePlugin("realResource"), + new BasicMatcherRulePlugin("issuer"), + new BasicMatcherRulePlugin("compiler"), + new BasicMatcherRulePlugin("issuerLayer"), + new ObjectMatcherRulePlugin("assert", "assertions"), + new ObjectMatcherRulePlugin("descriptionData"), + new BasicEffectRulePlugin("type"), + new BasicEffectRulePlugin("sideEffects"), + new BasicEffectRulePlugin("parser"), + new BasicEffectRulePlugin("resolve"), + new BasicEffectRulePlugin("generator"), + new BasicEffectRulePlugin("layer"), + new UseEffectRulePlugin() +]); +class NormalModuleFactory extends ModuleFactory { /** - * @param {Set} items keys - * @param {Set} usedItems used keys - * @param {PackContentItems | function(): Promise} dataOrFn sync or async content - * @param {Logger=} logger logger for logging - * @param {string=} lazyName name of dataOrFn for logging + * @param {Object} param params + * @param {string=} param.context context + * @param {InputFileSystem} param.fs file system + * @param {ResolverFactory} param.resolverFactory resolverFactory + * @param {ModuleOptions} param.options options + * @param {Object=} param.associatedObjectForCache an object to which the cache will be attached + * @param {boolean=} param.layers enable layers */ - constructor(items, usedItems, dataOrFn, logger, lazyName) { - this.items = items; - /** @type {function(): Promise | PackContentItems} */ - this.lazy = typeof dataOrFn === "function" ? dataOrFn : undefined; - /** @type {Map} */ - this.content = typeof dataOrFn === "function" ? undefined : dataOrFn.map; - this.outdated = false; - this.used = usedItems; - this.logger = logger; - this.lazyName = lazyName; - } + constructor({ + context, + fs, + resolverFactory, + options, + associatedObjectForCache, + layers = false + }) { + super(); + this.hooks = Object.freeze({ + /** @type {AsyncSeriesBailHook<[ResolveData], TODO>} */ + resolve: new AsyncSeriesBailHook(["resolveData"]), + /** @type {HookMap>} */ + resolveForScheme: new HookMap( + () => new AsyncSeriesBailHook(["resourceData", "resolveData"]) + ), + /** @type {HookMap>} */ + resolveInScheme: new HookMap( + () => new AsyncSeriesBailHook(["resourceData", "resolveData"]) + ), + /** @type {AsyncSeriesBailHook<[ResolveData], TODO>} */ + factorize: new AsyncSeriesBailHook(["resolveData"]), + /** @type {AsyncSeriesBailHook<[ResolveData], TODO>} */ + beforeResolve: new AsyncSeriesBailHook(["resolveData"]), + /** @type {AsyncSeriesBailHook<[ResolveData], TODO>} */ + afterResolve: new AsyncSeriesBailHook(["resolveData"]), + /** @type {AsyncSeriesBailHook<[ResolveData["createData"], ResolveData], TODO>} */ + createModule: new AsyncSeriesBailHook(["createData", "resolveData"]), + /** @type {SyncWaterfallHook<[Module, ResolveData["createData"], ResolveData], TODO>} */ + module: new SyncWaterfallHook(["module", "createData", "resolveData"]), + createParser: new HookMap(() => new SyncBailHook(["parserOptions"])), + parser: new HookMap(() => new SyncHook(["parser", "parserOptions"])), + createGenerator: new HookMap( + () => new SyncBailHook(["generatorOptions"]) + ), + generator: new HookMap( + () => new SyncHook(["generator", "generatorOptions"]) + ) + }); + this.resolverFactory = resolverFactory; + this.ruleSet = ruleSetCompiler.compile([ + { + rules: options.defaultRules + }, + { + rules: options.rules + } + ]); + this.context = context || ""; + this.fs = fs; + this._globalParserOptions = options.parser; + this._globalGeneratorOptions = options.generator; + /** @type {Map>} */ + this.parserCache = new Map(); + /** @type {Map>} */ + this.generatorCache = new Map(); + /** @type {Set} */ + this._restoredUnsafeCacheEntries = new Set(); - get(identifier) { - this.used.add(identifier); - if (this.content) { - return this.content.get(identifier); - } + const cacheParseResource = parseResource.bindCache( + associatedObjectForCache + ); + const cachedParseResourceWithoutFragment = + parseResourceWithoutFragment.bindCache(associatedObjectForCache); + this._parseResourceWithoutFragment = cachedParseResourceWithoutFragment; - // We are in state B - const { lazyName } = this; - let timeMessage; - if (lazyName) { - // only log once - this.lazyName = undefined; - timeMessage = `restore cache content ${lazyName} (${formatSize( - this.getSize() - )})`; - this.logger.log( - `starting to restore cache content ${lazyName} (${formatSize( - this.getSize() - )}) because of request to: ${identifier}` - ); - this.logger.time(timeMessage); - } - const value = this.lazy(); - if ("then" in value) { - return value.then(data => { - const map = data.map; - if (timeMessage) { - this.logger.timeEnd(timeMessage); - } - // Move to state C - this.content = map; - this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy); - return map.get(identifier); - }); - } else { - const map = value.map; - if (timeMessage) { - this.logger.timeEnd(timeMessage); - } - // Move to state C - this.content = map; - this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy); - return map.get(identifier); - } - } + this.hooks.factorize.tapAsync( + { + name: "NormalModuleFactory", + stage: 100 + }, + (resolveData, callback) => { + this.hooks.resolve.callAsync(resolveData, (err, result) => { + if (err) return callback(err); - /** - * @param {string} reason explanation why unpack is necessary - * @returns {void | Promise} maybe a promise if lazy - */ - unpack(reason) { - if (this.content) return; + // Ignored + if (result === false) return callback(); - // Move from state B to C - if (this.lazy) { - const { lazyName } = this; - let timeMessage; - if (lazyName) { - // only log once - this.lazyName = undefined; - timeMessage = `unpack cache content ${lazyName} (${formatSize( - this.getSize() - )})`; - this.logger.log( - `starting to unpack cache content ${lazyName} (${formatSize( - this.getSize() - )}) because ${reason}` - ); - this.logger.time(timeMessage); - } - const value = this.lazy(); - if ("then" in value) { - return value.then(data => { - if (timeMessage) { - this.logger.timeEnd(timeMessage); - } - this.content = data.map; + // direct module + if (result instanceof Module) return callback(null, result); + + if (typeof result === "object") + throw new Error( + deprecationChangedHookMessage("resolve", this.hooks.resolve) + + " Returning a Module object will result in this module used as result." + ); + + this.hooks.afterResolve.callAsync(resolveData, (err, result) => { + if (err) return callback(err); + + if (typeof result === "object") + throw new Error( + deprecationChangedHookMessage( + "afterResolve", + this.hooks.afterResolve + ) + ); + + // Ignored + if (result === false) return callback(); + + const createData = resolveData.createData; + + this.hooks.createModule.callAsync( + createData, + resolveData, + (err, createdModule) => { + if (!createdModule) { + if (!resolveData.request) { + return callback(new Error("Empty dependency (no request)")); + } + + createdModule = new NormalModule(createData); + } + + createdModule = this.hooks.module.call( + createdModule, + createData, + resolveData + ); + + return callback(null, createdModule); + } + ); + }); }); - } else { - if (timeMessage) { - this.logger.timeEnd(timeMessage); - } - this.content = value.map; } - } - } + ); + this.hooks.resolve.tapAsync( + { + name: "NormalModuleFactory", + stage: 100 + }, + (data, callback) => { + const { + contextInfo, + context, + dependencies, + dependencyType, + request, + assertions, + resolveOptions, + fileDependencies, + missingDependencies, + contextDependencies + } = data; + const loaderResolver = this.getResolver("loader"); - /** - * @returns {number} size of the content or -1 if not known - */ - getSize() { - if (!this.lazy) return -1; - const options = /** @type {any} */ (this.lazy).options; - if (!options) return -1; - const size = options.size; - if (typeof size !== "number") return -1; - return size; - } + /** @type {ResourceData | undefined} */ + let matchResourceData = undefined; + /** @type {string} */ + let unresolvedResource; + /** @type {ParsedLoaderRequest[]} */ + let elements; + let noPreAutoLoaders = false; + let noAutoLoaders = false; + let noPrePostAutoLoaders = false; - delete(identifier) { - this.items.delete(identifier); - this.used.delete(identifier); - this.outdated = true; - } + const contextScheme = getScheme(context); + /** @type {string | undefined} */ + let scheme = getScheme(request); - /** - * @template T - * @param {function(any): function(): Promise | PackContentItems} write write function - * @returns {void} - */ - writeLazy(write) { - if (!this.outdated && this.lazy) { - // State B1 or C1 - // this.lazy is still the valid deserialized version - write(this.lazy); - return; - } - if (!this.outdated && this.content) { - // State A1 - const map = new Map(this.content); - // Move to state C1 - this.lazy = SerializerMiddleware.unMemoizeLazy( - write(() => new PackContentItems(map)) - ); - return; - } - if (this.content) { - // State A2 or C2 - /** @type {Map} */ - const map = new Map(); - for (const item of this.items) { - map.set(item, this.content.get(item)); - } - // Move to state C1 - this.outdated = false; - this.content = map; - this.lazy = SerializerMiddleware.unMemoizeLazy( - write(() => new PackContentItems(map)) - ); - return; - } - // State B2 - const { lazyName } = this; - let timeMessage; - if (lazyName) { - // only log once - this.lazyName = undefined; - timeMessage = `unpack cache content ${lazyName} (${formatSize( - this.getSize() - )})`; - this.logger.log( - `starting to unpack cache content ${lazyName} (${formatSize( - this.getSize() - )}) because it's outdated and need to be serialized` - ); - this.logger.time(timeMessage); - } - const value = this.lazy(); - this.outdated = false; - if ("then" in value) { - // Move to state B1 - this.lazy = write(() => - value.then(data => { - if (timeMessage) { - this.logger.timeEnd(timeMessage); - } - const oldMap = data.map; - /** @type {Map} */ - const map = new Map(); - for (const item of this.items) { - map.set(item, oldMap.get(item)); + if (!scheme) { + /** @type {string} */ + let requestWithoutMatchResource = request; + const matchResourceMatch = MATCH_RESOURCE_REGEX.exec(request); + if (matchResourceMatch) { + let matchResource = matchResourceMatch[1]; + if (matchResource.charCodeAt(0) === 46) { + // 46 === ".", 47 === "/" + const secondChar = matchResource.charCodeAt(1); + if ( + secondChar === 47 || + (secondChar === 46 && matchResource.charCodeAt(2) === 47) + ) { + // if matchResources startsWith ../ or ./ + matchResource = join(this.fs, context, matchResource); + } + } + matchResourceData = { + resource: matchResource, + ...cacheParseResource(matchResource) + }; + requestWithoutMatchResource = request.substr( + matchResourceMatch[0].length + ); } - // Move to state C1 (or maybe C2) - this.content = map; - this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy); - return new PackContentItems(map); - }) - ); - } else { - // Move to state C1 - if (timeMessage) { - this.logger.timeEnd(timeMessage); - } - const oldMap = value.map; - /** @type {Map} */ - const map = new Map(); - for (const item of this.items) { - map.set(item, oldMap.get(item)); - } - this.content = map; - this.lazy = write(() => new PackContentItems(map)); - } - } -} + scheme = getScheme(requestWithoutMatchResource); -const allowCollectingMemory = buf => { - const wasted = buf.buffer.byteLength - buf.byteLength; - if (wasted > 8192 && (wasted > 1048576 || wasted > buf.byteLength)) { - return Buffer.from(buf); - } - return buf; -}; + if (!scheme && !contextScheme) { + const firstChar = requestWithoutMatchResource.charCodeAt(0); + const secondChar = requestWithoutMatchResource.charCodeAt(1); + noPreAutoLoaders = firstChar === 45 && secondChar === 33; // startsWith "-!" + noAutoLoaders = noPreAutoLoaders || firstChar === 33; // startsWith "!" + noPrePostAutoLoaders = firstChar === 33 && secondChar === 33; // startsWith "!!"; + const rawElements = requestWithoutMatchResource + .slice( + noPreAutoLoaders || noPrePostAutoLoaders + ? 2 + : noAutoLoaders + ? 1 + : 0 + ) + .split(/!+/); + unresolvedResource = rawElements.pop(); + elements = rawElements.map(el => { + const { path, query } = cachedParseResourceWithoutFragment(el); + return { + loader: path, + options: query ? query.slice(1) : undefined + }; + }); + scheme = getScheme(unresolvedResource); + } else { + unresolvedResource = requestWithoutMatchResource; + elements = EMPTY_ELEMENTS; + } + } else { + unresolvedResource = request; + elements = EMPTY_ELEMENTS; + } -class PackFileCacheStrategy { - /** - * @param {Object} options options - * @param {Compiler} options.compiler the compiler - * @param {IntermediateFileSystem} options.fs the filesystem - * @param {string} options.context the context directory - * @param {string} options.cacheLocation the location of the cache data - * @param {string} options.version version identifier - * @param {Logger} options.logger a logger - * @param {SnapshotOptions} options.snapshot options regarding snapshotting - * @param {number} options.maxAge max age of cache items - * @param {boolean} options.profile track and log detailed timing information for individual cache items - * @param {boolean} options.allowCollectingMemory allow to collect unused memory created during deserialization - * @param {false | "gzip" | "brotli"} options.compression compression used - */ - constructor({ - compiler, - fs, - context, - cacheLocation, - version, - logger, - snapshot, - maxAge, - profile, - allowCollectingMemory, - compression - }) { - this.fileSerializer = createFileSerializer( - fs, - compiler.options.output.hashFunction - ); - this.fileSystemInfo = new FileSystemInfo(fs, { - managedPaths: snapshot.managedPaths, - immutablePaths: snapshot.immutablePaths, - logger: logger.getChildLogger("webpack.FileSystemInfo"), - hashFunction: compiler.options.output.hashFunction - }); - this.compiler = compiler; - this.context = context; - this.cacheLocation = cacheLocation; - this.version = version; - this.logger = logger; - this.maxAge = maxAge; - this.profile = profile; - this.allowCollectingMemory = allowCollectingMemory; - this.compression = compression; - this._extension = - compression === "brotli" - ? ".pack.br" - : compression === "gzip" - ? ".pack.gz" - : ".pack"; - this.snapshot = snapshot; - /** @type {Set} */ - this.buildDependencies = new Set(); - /** @type {LazySet} */ - this.newBuildDependencies = new LazySet(); - /** @type {Snapshot} */ - this.resolveBuildDependenciesSnapshot = undefined; - /** @type {Map} */ - this.resolveResults = undefined; - /** @type {Snapshot} */ - this.buildSnapshot = undefined; - /** @type {Promise} */ - this.packPromise = this._openPack(); - this.storePromise = Promise.resolve(); - } + const resolveContext = { + fileDependencies, + missingDependencies, + contextDependencies + }; - _getPack() { - if (this.packPromise === undefined) { - this.packPromise = this.storePromise.then(() => this._openPack()); - } - return this.packPromise; - } + /** @type {ResourceDataWithData} */ + let resourceData; - /** - * @returns {Promise} the pack - */ - _openPack() { - const { logger, profile, cacheLocation, version } = this; - /** @type {Snapshot} */ - let buildSnapshot; - /** @type {Set} */ - let buildDependencies; - /** @type {Set} */ - let newBuildDependencies; - /** @type {Snapshot} */ - let resolveBuildDependenciesSnapshot; - /** @type {Map} */ - let resolveResults; - logger.time("restore cache container"); - return this.fileSerializer - .deserialize(null, { - filename: `${cacheLocation}/index${this._extension}`, - extension: `${this._extension}`, - logger, - profile, - retainedBuffer: this.allowCollectingMemory - ? allowCollectingMemory - : undefined - }) - .catch(err => { - if (err.code !== "ENOENT") { - logger.warn( - `Restoring pack failed from ${cacheLocation}${this._extension}: ${err}` - ); - logger.debug(err.stack); - } else { - logger.debug( - `No pack exists at ${cacheLocation}${this._extension}: ${err}` - ); - } - return undefined; - }) - .then(packContainer => { - logger.timeEnd("restore cache container"); - if (!packContainer) return undefined; - if (!(packContainer instanceof PackContainer)) { - logger.warn( - `Restored pack from ${cacheLocation}${this._extension}, but contained content is unexpected.`, - packContainer - ); - return undefined; - } - if (packContainer.version !== version) { - logger.log( - `Restored pack from ${cacheLocation}${this._extension}, but version doesn't match.` - ); - return undefined; - } - logger.time("check build dependencies"); - return Promise.all([ - new Promise((resolve, reject) => { - this.fileSystemInfo.checkSnapshotValid( - packContainer.buildSnapshot, - (err, valid) => { - if (err) { - logger.log( - `Restored pack from ${cacheLocation}${this._extension}, but checking snapshot of build dependencies errored: ${err}.` + let loaders; + + const continueCallback = needCalls(2, err => { + if (err) return callback(err); + + // translate option idents + try { + for (const item of loaders) { + if (typeof item.options === "string" && item.options[0] === "?") { + const ident = item.options.substr(1); + if (ident === "[[missing ident]]") { + throw new Error( + "No ident is provided by referenced loader. " + + "When using a function for Rule.use in config you need to " + + "provide an 'ident' property for referenced loader options." ); - logger.debug(err.stack); - return resolve(false); } - if (!valid) { - logger.log( - `Restored pack from ${cacheLocation}${this._extension}, but build dependencies have changed.` + item.options = this.ruleSet.references.get(ident); + if (item.options === undefined) { + throw new Error( + "Invalid ident is provided by referenced loader" ); - return resolve(false); } - buildSnapshot = packContainer.buildSnapshot; - return resolve(true); + item.ident = ident; } + } + } catch (e) { + return callback(e); + } + + if (!resourceData) { + // ignored + return callback(null, dependencies[0].createIgnoredModule(context)); + } + + const userRequest = + (matchResourceData !== undefined + ? `${matchResourceData.resource}!=!` + : "") + + stringifyLoadersAndResource(loaders, resourceData.resource); + + const settings = {}; + const useLoadersPost = []; + const useLoaders = []; + const useLoadersPre = []; + + // handle .webpack[] suffix + let resource; + let match; + if ( + matchResourceData && + typeof (resource = matchResourceData.resource) === "string" && + (match = /\.webpack\[([^\]]+)\]$/.exec(resource)) + ) { + settings.type = match[1]; + matchResourceData.resource = matchResourceData.resource.slice( + 0, + -settings.type.length - 10 ); - }), - new Promise((resolve, reject) => { - this.fileSystemInfo.checkSnapshotValid( - packContainer.resolveBuildDependenciesSnapshot, - (err, valid) => { - if (err) { - logger.log( - `Restored pack from ${cacheLocation}${this._extension}, but checking snapshot of resolving of build dependencies errored: ${err}.` - ); - logger.debug(err.stack); - return resolve(false); + } else { + settings.type = "javascript/auto"; + const resourceDataForRules = matchResourceData || resourceData; + const result = this.ruleSet.exec({ + resource: resourceDataForRules.path, + realResource: resourceData.path, + resourceQuery: resourceDataForRules.query, + resourceFragment: resourceDataForRules.fragment, + scheme, + assertions, + mimetype: matchResourceData + ? "" + : resourceData.data.mimetype || "", + dependency: dependencyType, + descriptionData: matchResourceData + ? undefined + : resourceData.data.descriptionFileData, + issuer: contextInfo.issuer, + compiler: contextInfo.compiler, + issuerLayer: contextInfo.issuerLayer || "" + }); + for (const r of result) { + if (r.type === "use") { + if (!noAutoLoaders && !noPrePostAutoLoaders) { + useLoaders.push(r.value); } - if (valid) { - resolveBuildDependenciesSnapshot = - packContainer.resolveBuildDependenciesSnapshot; - buildDependencies = packContainer.buildDependencies; - resolveResults = packContainer.resolveResults; - return resolve(true); + } else if (r.type === "use-post") { + if (!noPrePostAutoLoaders) { + useLoadersPost.push(r.value); } - logger.log( - "resolving of build dependencies is invalid, will re-resolve build dependencies" - ); - this.fileSystemInfo.checkResolveResultsValid( - packContainer.resolveResults, - (err, valid) => { - if (err) { - logger.log( - `Restored pack from ${cacheLocation}${this._extension}, but resolving of build dependencies errored: ${err}.` - ); - logger.debug(err.stack); - return resolve(false); - } - if (valid) { - newBuildDependencies = packContainer.buildDependencies; - resolveResults = packContainer.resolveResults; - return resolve(true); - } - logger.log( - `Restored pack from ${cacheLocation}${this._extension}, but build dependencies resolve to different locations.` - ); - return resolve(false); - } - ); + } else if (r.type === "use-pre") { + if (!noPreAutoLoaders && !noPrePostAutoLoaders) { + useLoadersPre.push(r.value); + } + } else if ( + typeof r.value === "object" && + r.value !== null && + typeof settings[r.type] === "object" && + settings[r.type] !== null + ) { + settings[r.type] = cachedCleverMerge(settings[r.type], r.value); + } else { + settings[r.type] = r.value; } - ); - }) - ]) - .catch(err => { - logger.timeEnd("check build dependencies"); - throw err; - }) - .then(([buildSnapshotValid, resolveValid]) => { - logger.timeEnd("check build dependencies"); - if (buildSnapshotValid && resolveValid) { - logger.time("restore cache content metadata"); - const d = packContainer.data(); - logger.timeEnd("restore cache content metadata"); - return d; } - return undefined; + } + + let postLoaders, normalLoaders, preLoaders; + + const continueCallback = needCalls(3, err => { + if (err) { + return callback(err); + } + const allLoaders = postLoaders; + if (matchResourceData === undefined) { + for (const loader of loaders) allLoaders.push(loader); + for (const loader of normalLoaders) allLoaders.push(loader); + } else { + for (const loader of normalLoaders) allLoaders.push(loader); + for (const loader of loaders) allLoaders.push(loader); + } + for (const loader of preLoaders) allLoaders.push(loader); + let type = settings.type; + const resolveOptions = settings.resolve; + const layer = settings.layer; + if (layer !== undefined && !layers) { + return callback( + new Error( + "'Rule.layer' is only allowed when 'experiments.layers' is enabled" + ) + ); + } + try { + Object.assign(data.createData, { + layer: + layer === undefined ? contextInfo.issuerLayer || null : layer, + request: stringifyLoadersAndResource( + allLoaders, + resourceData.resource + ), + userRequest, + rawRequest: request, + loaders: allLoaders, + resource: resourceData.resource, + context: + resourceData.context || getContext(resourceData.resource), + matchResource: matchResourceData + ? matchResourceData.resource + : undefined, + resourceResolveData: resourceData.data, + settings, + type, + parser: this.getParser(type, settings.parser), + parserOptions: settings.parser, + generator: this.getGenerator(type, settings.generator), + generatorOptions: settings.generator, + resolveOptions + }); + } catch (e) { + return callback(e); + } + callback(); }); - }) - .then(pack => { - if (pack) { - pack.maxAge = this.maxAge; - this.buildSnapshot = buildSnapshot; - if (buildDependencies) this.buildDependencies = buildDependencies; - if (newBuildDependencies) - this.newBuildDependencies.addAll(newBuildDependencies); - this.resolveResults = resolveResults; - this.resolveBuildDependenciesSnapshot = - resolveBuildDependenciesSnapshot; - return pack; + this.resolveRequestArray( + contextInfo, + this.context, + useLoadersPost, + loaderResolver, + resolveContext, + (err, result) => { + postLoaders = result; + continueCallback(err); + } + ); + this.resolveRequestArray( + contextInfo, + this.context, + useLoaders, + loaderResolver, + resolveContext, + (err, result) => { + normalLoaders = result; + continueCallback(err); + } + ); + this.resolveRequestArray( + contextInfo, + this.context, + useLoadersPre, + loaderResolver, + resolveContext, + (err, result) => { + preLoaders = result; + continueCallback(err); + } + ); + }); + + this.resolveRequestArray( + contextInfo, + contextScheme ? this.context : context, + elements, + loaderResolver, + resolveContext, + (err, result) => { + if (err) return continueCallback(err); + loaders = result; + continueCallback(); + } + ); + + const defaultResolve = context => { + if (/^($|\?)/.test(unresolvedResource)) { + resourceData = { + resource: unresolvedResource, + data: {}, + ...cacheParseResource(unresolvedResource) + }; + continueCallback(); + } + + // resource without scheme and with path + else { + const normalResolver = this.getResolver( + "normal", + dependencyType + ? cachedSetProperty( + resolveOptions || EMPTY_RESOLVE_OPTIONS, + "dependencyType", + dependencyType + ) + : resolveOptions + ); + this.resolveResource( + contextInfo, + context, + unresolvedResource, + normalResolver, + resolveContext, + (err, resolvedResource, resolvedResourceResolveData) => { + if (err) return continueCallback(err); + if (resolvedResource !== false) { + resourceData = { + resource: resolvedResource, + data: resolvedResourceResolveData, + ...cacheParseResource(resolvedResource) + }; + } + continueCallback(); + } + ); + } + }; + + // resource with scheme + if (scheme) { + resourceData = { + resource: unresolvedResource, + data: {}, + path: undefined, + query: undefined, + fragment: undefined, + context: undefined + }; + this.hooks.resolveForScheme + .for(scheme) + .callAsync(resourceData, data, err => { + if (err) return continueCallback(err); + continueCallback(); + }); } - return new Pack(logger, this.maxAge); - }) - .catch(err => { - this.logger.warn( - `Restoring pack from ${cacheLocation}${this._extension} failed: ${err}` - ); - this.logger.debug(err.stack); - return new Pack(logger, this.maxAge); - }); + + // resource within scheme + else if (contextScheme) { + resourceData = { + resource: unresolvedResource, + data: {}, + path: undefined, + query: undefined, + fragment: undefined, + context: undefined + }; + this.hooks.resolveInScheme + .for(contextScheme) + .callAsync(resourceData, data, (err, handled) => { + if (err) return continueCallback(err); + if (!handled) return defaultResolve(this.context); + continueCallback(); + }); + } + + // resource without scheme and without path + else defaultResolve(context); + } + ); } - /** - * @param {string} identifier unique name for the resource - * @param {Etag | null} etag etag of the resource - * @param {any} data cached content - * @returns {Promise} promise - */ - store(identifier, etag, data) { - return this._getPack().then(pack => { - pack.set(identifier, etag === null ? null : etag.toString(), data); - }); + cleanupForCache() { + for (const module of this._restoredUnsafeCacheEntries) { + ChunkGraph.clearChunkGraphForModule(module); + ModuleGraph.clearModuleGraphForModule(module); + module.cleanupForCache(); + } } /** - * @param {string} identifier unique name for the resource - * @param {Etag | null} etag etag of the resource - * @returns {Promise} promise to the cached content + * @param {ModuleFactoryCreateData} data data object + * @param {function(Error=, ModuleFactoryResult=): void} callback callback + * @returns {void} */ - restore(identifier, etag) { - return this._getPack() - .then(pack => - pack.get(identifier, etag === null ? null : etag.toString()) - ) - .catch(err => { - if (err && err.code !== "ENOENT") { - this.logger.warn( - `Restoring failed for ${identifier} from pack: ${err}` - ); - this.logger.debug(err.stack); + create(data, callback) { + const dependencies = /** @type {ModuleDependency[]} */ (data.dependencies); + const context = data.context || this.context; + const resolveOptions = data.resolveOptions || EMPTY_RESOLVE_OPTIONS; + const dependency = dependencies[0]; + const request = dependency.request; + const assertions = dependency.assertions; + const contextInfo = data.contextInfo; + const fileDependencies = new LazySet(); + const missingDependencies = new LazySet(); + const contextDependencies = new LazySet(); + const dependencyType = + (dependencies.length > 0 && dependencies[0].category) || ""; + /** @type {ResolveData} */ + const resolveData = { + contextInfo, + resolveOptions, + context, + request, + assertions, + dependencies, + dependencyType, + fileDependencies, + missingDependencies, + contextDependencies, + createData: {}, + cacheable: true + }; + this.hooks.beforeResolve.callAsync(resolveData, (err, result) => { + if (err) { + return callback(err, { + fileDependencies, + missingDependencies, + contextDependencies, + cacheable: false + }); + } + + // Ignored + if (result === false) { + return callback(null, { + fileDependencies, + missingDependencies, + contextDependencies, + cacheable: resolveData.cacheable + }); + } + + if (typeof result === "object") + throw new Error( + deprecationChangedHookMessage( + "beforeResolve", + this.hooks.beforeResolve + ) + ); + + this.hooks.factorize.callAsync(resolveData, (err, module) => { + if (err) { + return callback(err, { + fileDependencies, + missingDependencies, + contextDependencies, + cacheable: false + }); } + + const factoryResult = { + module, + fileDependencies, + missingDependencies, + contextDependencies, + cacheable: resolveData.cacheable + }; + + callback(null, factoryResult); }); + }); } - storeBuildDependencies(dependencies) { - this.newBuildDependencies.addAll(dependencies); - } + resolveResource( + contextInfo, + context, + unresolvedResource, + resolver, + resolveContext, + callback + ) { + resolver.resolve( + contextInfo, + context, + unresolvedResource, + resolveContext, + (err, resolvedResource, resolvedResourceResolveData) => { + if (err) { + return this._resolveResourceErrorHints( + err, + contextInfo, + context, + unresolvedResource, + resolver, + resolveContext, + (err2, hints) => { + if (err2) { + err.message += ` +An fatal error happened during resolving additional hints for this error: ${err2.message}`; + err.stack += ` - afterAllStored() { - const packPromise = this.packPromise; - if (packPromise === undefined) return Promise.resolve(); - const reportProgress = ProgressPlugin.getReporter(this.compiler); - return (this.storePromise = packPromise - .then(pack => { - pack.stopCapturingRequests(); - if (!pack.invalid) return; - this.packPromise = undefined; - this.logger.log(`Storing pack...`); - let promise; - const newBuildDependencies = new Set(); - for (const dep of this.newBuildDependencies) { - if (!this.buildDependencies.has(dep)) { - newBuildDependencies.add(dep); - } - } - if (newBuildDependencies.size > 0 || !this.buildSnapshot) { - if (reportProgress) reportProgress(0.5, "resolve build dependencies"); - this.logger.debug( - `Capturing build dependencies... (${Array.from( - newBuildDependencies - ).join(", ")})` +An fatal error happened during resolving additional hints for this error: +${err2.stack}`; + return callback(err); + } + if (hints && hints.length > 0) { + err.message += ` +${hints.join("\n\n")}`; + } + callback(err); + } ); - promise = new Promise((resolve, reject) => { - this.logger.time("resolve build dependencies"); - this.fileSystemInfo.resolveBuildDependencies( - this.context, - newBuildDependencies, - (err, result) => { - this.logger.timeEnd("resolve build dependencies"); - if (err) return reject(err); + } + callback(err, resolvedResource, resolvedResourceResolveData); + } + ); + } - this.logger.time("snapshot build dependencies"); - const { - files, - directories, - missing, - resolveResults, - resolveDependencies - } = result; - if (this.resolveResults) { - for (const [key, value] of resolveResults) { - this.resolveResults.set(key, value); - } - } else { - this.resolveResults = resolveResults; - } - if (reportProgress) { - reportProgress( - 0.6, - "snapshot build dependencies", - "resolving" + _resolveResourceErrorHints( + error, + contextInfo, + context, + unresolvedResource, + resolver, + resolveContext, + callback + ) { + asyncLib.parallel( + [ + callback => { + if (!resolver.options.fullySpecified) return callback(); + resolver + .withOptions({ + fullySpecified: false + }) + .resolve( + contextInfo, + context, + unresolvedResource, + resolveContext, + (err, resolvedResource) => { + if (!err && resolvedResource) { + const resource = parseResource(resolvedResource).path.replace( + /^.*[\\/]/, + "" + ); + return callback( + null, + `Did you mean '${resource}'? +BREAKING CHANGE: The request '${unresolvedResource}' failed to resolve only because it was resolved as fully specified +(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"'). +The extension in the request is mandatory for it to be fully specified. +Add the extension to the request.` ); } - this.fileSystemInfo.createSnapshot( - undefined, - resolveDependencies.files, - resolveDependencies.directories, - resolveDependencies.missing, - this.snapshot.resolveBuildDependencies, - (err, snapshot) => { - if (err) { - this.logger.timeEnd("snapshot build dependencies"); - return reject(err); - } - if (!snapshot) { - this.logger.timeEnd("snapshot build dependencies"); - return reject( - new Error("Unable to snapshot resolve dependencies") - ); - } - if (this.resolveBuildDependenciesSnapshot) { - this.resolveBuildDependenciesSnapshot = - this.fileSystemInfo.mergeSnapshots( - this.resolveBuildDependenciesSnapshot, - snapshot - ); + callback(); + } + ); + }, + callback => { + if (!resolver.options.enforceExtension) return callback(); + resolver + .withOptions({ + enforceExtension: false, + extensions: [] + }) + .resolve( + contextInfo, + context, + unresolvedResource, + resolveContext, + (err, resolvedResource) => { + if (!err && resolvedResource) { + let hint = ""; + const match = /(\.[^.]+)(\?|$)/.exec(unresolvedResource); + if (match) { + const fixedRequest = unresolvedResource.replace( + /(\.[^.]+)(\?|$)/, + "$2" + ); + if (resolver.options.extensions.has(match[1])) { + hint = `Did you mean '${fixedRequest}'?`; } else { - this.resolveBuildDependenciesSnapshot = snapshot; - } - if (reportProgress) { - reportProgress( - 0.7, - "snapshot build dependencies", - "modules" - ); + hint = `Did you mean '${fixedRequest}'? Also note that '${match[1]}' is not in 'resolve.extensions' yet and need to be added for this to work?`; } - this.fileSystemInfo.createSnapshot( - undefined, - files, - directories, - missing, - this.snapshot.buildDependencies, - (err, snapshot) => { - this.logger.timeEnd("snapshot build dependencies"); - if (err) return reject(err); - if (!snapshot) { - return reject( - new Error("Unable to snapshot build dependencies") - ); - } - this.logger.debug("Captured build dependencies"); - - if (this.buildSnapshot) { - this.buildSnapshot = - this.fileSystemInfo.mergeSnapshots( - this.buildSnapshot, - snapshot - ); - } else { - this.buildSnapshot = snapshot; - } - - resolve(); - } - ); + } else { + hint = `Did you mean to omit the extension or to remove 'resolve.enforceExtension'?`; } - ); + return callback( + null, + `The request '${unresolvedResource}' failed to resolve only because 'resolve.enforceExtension' was specified. +${hint} +Including the extension in the request is no longer possible. Did you mean to enforce including the extension in requests with 'resolve.extensions: []' instead?` + ); + } + callback(); } ); - }); - } else { - promise = Promise.resolve(); - } - return promise.then(() => { - if (reportProgress) reportProgress(0.8, "serialize pack"); - this.logger.time(`store pack`); - const updatedBuildDependencies = new Set(this.buildDependencies); - for (const dep of newBuildDependencies) { - updatedBuildDependencies.add(dep); + }, + callback => { + if ( + /^\.\.?\//.test(unresolvedResource) || + resolver.options.preferRelative + ) { + return callback(); } - const content = new PackContainer( - pack, - this.version, - this.buildSnapshot, - updatedBuildDependencies, - this.resolveResults, - this.resolveBuildDependenciesSnapshot - ); - return this.fileSerializer - .serialize(content, { - filename: `${this.cacheLocation}/index${this._extension}`, - extension: `${this._extension}`, - logger: this.logger, - profile: this.profile - }) - .then(() => { - for (const dep of newBuildDependencies) { - this.buildDependencies.add(dep); - } - this.newBuildDependencies.clear(); - this.logger.timeEnd(`store pack`); - const stats = pack.getContentStats(); - this.logger.log( - "Stored pack (%d items, %d files, %d MiB)", - pack.itemInfo.size, - stats.count, - Math.round(stats.size / 1024 / 1024) + resolver.resolve( + contextInfo, + context, + `./${unresolvedResource}`, + resolveContext, + (err, resolvedResource) => { + if (err || !resolvedResource) return callback(); + const moduleDirectories = resolver.options.modules + .map(m => (Array.isArray(m) ? m.join(", ") : m)) + .join(", "); + callback( + null, + `Did you mean './${unresolvedResource}'? +Requests that should resolve in the current directory need to start with './'. +Requests that start with a name are treated as module requests and resolve within module directories (${moduleDirectories}). +If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.` ); - }) - .catch(err => { - this.logger.timeEnd(`store pack`); - this.logger.warn(`Caching failed for pack: ${err}`); - this.logger.debug(err.stack); - }); - }); - }) - .catch(err => { - this.logger.warn(`Caching failed for pack: ${err}`); - this.logger.debug(err.stack); - })); + } + ); + } + ], + (err, hints) => { + if (err) return callback(err); + callback(null, hints.filter(Boolean)); + } + ); } - clear() { - this.fileSystemInfo.clear(); - this.buildDependencies.clear(); - this.newBuildDependencies.clear(); - this.resolveBuildDependenciesSnapshot = undefined; - this.resolveResults = undefined; - this.buildSnapshot = undefined; - this.packPromise = undefined; + resolveRequestArray( + contextInfo, + context, + array, + resolver, + resolveContext, + callback + ) { + if (array.length === 0) return callback(null, array); + asyncLib.map( + array, + (item, callback) => { + resolver.resolve( + contextInfo, + context, + item.loader, + resolveContext, + (err, result) => { + if ( + err && + /^[^/]*$/.test(item.loader) && + !/-loader$/.test(item.loader) + ) { + return resolver.resolve( + contextInfo, + context, + item.loader + "-loader", + resolveContext, + err2 => { + if (!err2) { + err.message = + err.message + + "\n" + + "BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when using loaders.\n" + + ` You need to specify '${item.loader}-loader' instead of '${item.loader}',\n` + + " see https://webpack.js.org/migrate/3/#automatic-loader-module-name-extension-removed"; + } + callback(err); + } + ); + } + if (err) return callback(err); + + const parsedResult = this._parseResourceWithoutFragment(result); + const resolved = { + loader: parsedResult.path, + options: + item.options === undefined + ? parsedResult.query + ? parsedResult.query.slice(1) + : undefined + : item.options, + ident: item.options === undefined ? undefined : item.ident + }; + return callback(null, resolved); + } + ); + }, + callback + ); } -} - -module.exports = PackFileCacheStrategy; - - -/***/ }), - -/***/ 97347: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + getParser(type, parserOptions = EMPTY_PARSER_OPTIONS) { + let cache = this.parserCache.get(type); + if (cache === undefined) { + cache = new WeakMap(); + this.parserCache.set(type, cache); + } -const LazySet = __webpack_require__(38938); -const makeSerializable = __webpack_require__(33032); + let parser = cache.get(parserOptions); -/** @typedef {import("enhanced-resolve/lib/Resolver")} Resolver */ -/** @typedef {import("../CacheFacade").ItemCacheFacade} ItemCacheFacade */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../FileSystemInfo")} FileSystemInfo */ -/** @typedef {import("../FileSystemInfo").Snapshot} Snapshot */ + if (parser === undefined) { + parser = this.createParser(type, parserOptions); + cache.set(parserOptions, parser); + } -class CacheEntry { - constructor(result, snapshot) { - this.result = result; - this.snapshot = snapshot; + return parser; } - serialize({ write }) { - write(this.result); - write(this.snapshot); + /** + * @param {string} type type + * @param {{[k: string]: any}} parserOptions parser options + * @returns {Parser} parser + */ + createParser(type, parserOptions = {}) { + parserOptions = mergeGlobalOptions( + this._globalParserOptions, + type, + parserOptions + ); + const parser = this.hooks.createParser.for(type).call(parserOptions); + if (!parser) { + throw new Error(`No parser registered for ${type}`); + } + this.hooks.parser.for(type).call(parser, parserOptions); + return parser; } - deserialize({ read }) { - this.result = read(); - this.snapshot = read(); - } -} + getGenerator(type, generatorOptions = EMPTY_GENERATOR_OPTIONS) { + let cache = this.generatorCache.get(type); -makeSerializable(CacheEntry, "webpack/lib/cache/ResolverCachePlugin"); + if (cache === undefined) { + cache = new WeakMap(); + this.generatorCache.set(type, cache); + } -/** - * @template T - * @param {Set | LazySet} set set to add items to - * @param {Set | LazySet} otherSet set to add items from - * @returns {void} - */ -const addAllToSet = (set, otherSet) => { - if (set instanceof LazySet) { - set.addAll(otherSet); - } else { - for (const item of otherSet) { - set.add(item); + let generator = cache.get(generatorOptions); + + if (generator === undefined) { + generator = this.createGenerator(type, generatorOptions); + cache.set(generatorOptions, generator); } + + return generator; } -}; -/** - * @param {Object} object an object - * @param {boolean} excludeContext if true, context is not included in string - * @returns {string} stringified version - */ -const objectToString = (object, excludeContext) => { - let str = ""; - for (const key in object) { - if (excludeContext && key === "context") continue; - const value = object[key]; - if (typeof value === "object" && value !== null) { - str += `|${key}=[${objectToString(value, false)}|]`; - } else { - str += `|${key}=|${value}`; + createGenerator(type, generatorOptions = {}) { + generatorOptions = mergeGlobalOptions( + this._globalGeneratorOptions, + type, + generatorOptions + ); + const generator = this.hooks.createGenerator + .for(type) + .call(generatorOptions); + if (!generator) { + throw new Error(`No generator registered for ${type}`); } + this.hooks.generator.for(type).call(generator, generatorOptions); + return generator; } - return str; -}; - -class ResolverCachePlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const cache = compiler.getCache("ResolverCachePlugin"); - /** @type {FileSystemInfo} */ - let fileSystemInfo; - let snapshotOptions; - let realResolves = 0; - let cachedResolves = 0; - let cacheInvalidResolves = 0; - let concurrentResolves = 0; - compiler.hooks.thisCompilation.tap("ResolverCachePlugin", compilation => { - snapshotOptions = compilation.options.snapshot.resolve; - fileSystemInfo = compilation.fileSystemInfo; - compilation.hooks.finishModules.tap("ResolverCachePlugin", () => { - if (realResolves + cachedResolves > 0) { - const logger = compilation.getLogger("webpack.ResolverCachePlugin"); - logger.log( - `${Math.round( - (100 * realResolves) / (realResolves + cachedResolves) - )}% really resolved (${realResolves} real resolves with ${cacheInvalidResolves} cached but invalid, ${cachedResolves} cached valid, ${concurrentResolves} concurrent)` - ); - realResolves = 0; - cachedResolves = 0; - cacheInvalidResolves = 0; - concurrentResolves = 0; - } - }); - }); - /** - * @param {ItemCacheFacade} itemCache cache - * @param {Resolver} resolver the resolver - * @param {Object} resolveContext context for resolving meta info - * @param {Object} request the request info object - * @param {function((Error | null)=, Object=): void} callback callback function - * @returns {void} - */ - const doRealResolve = ( - itemCache, - resolver, - resolveContext, - request, - callback - ) => { - realResolves++; - const newRequest = { - _ResolverCachePluginCacheMiss: true, - ...request - }; - const newResolveContext = { - ...resolveContext, - stack: new Set(), - missingDependencies: new LazySet(), - fileDependencies: new LazySet(), - contextDependencies: new LazySet() - }; - const propagate = key => { - if (resolveContext[key]) { - addAllToSet(resolveContext[key], newResolveContext[key]); - } - }; - const resolveTime = Date.now(); - resolver.doResolve( - resolver.hooks.resolve, - newRequest, - "Cache miss", - newResolveContext, - (err, result) => { - propagate("fileDependencies"); - propagate("contextDependencies"); - propagate("missingDependencies"); - if (err) return callback(err); - const fileDependencies = newResolveContext.fileDependencies; - const contextDependencies = newResolveContext.contextDependencies; - const missingDependencies = newResolveContext.missingDependencies; - fileSystemInfo.createSnapshot( - resolveTime, - fileDependencies, - contextDependencies, - missingDependencies, - snapshotOptions, - (err, snapshot) => { - if (err) return callback(err); - if (!snapshot) { - if (result) return callback(null, result); - return callback(); - } - itemCache.store(new CacheEntry(result, snapshot), storeErr => { - if (storeErr) return callback(storeErr); - if (result) return callback(null, result); - callback(); - }); - } - ); - } - ); - }; - compiler.resolverFactory.hooks.resolver.intercept({ - factory(type, hook) { - /** @type {Map} */ - const activeRequests = new Map(); - hook.tap( - "ResolverCachePlugin", - /** - * @param {Resolver} resolver the resolver - * @param {Object} options resolve options - * @param {Object} userOptions resolve options passed by the user - * @returns {void} - */ - (resolver, options, userOptions) => { - if (options.cache !== true) return; - const optionsIdent = objectToString(userOptions, false); - const cacheWithContext = - options.cacheWithContext !== undefined - ? options.cacheWithContext - : false; - resolver.hooks.resolve.tapAsync( - { - name: "ResolverCachePlugin", - stage: -100 - }, - (request, resolveContext, callback) => { - if (request._ResolverCachePluginCacheMiss || !fileSystemInfo) { - return callback(); - } - const identifier = `${type}${optionsIdent}${objectToString( - request, - !cacheWithContext - )}`; - const activeRequest = activeRequests.get(identifier); - if (activeRequest) { - activeRequest.push(callback); - return; - } - const itemCache = cache.getItemCache(identifier, null); - let callbacks; - const done = (err, result) => { - if (callbacks === undefined) { - callback(err, result); - callbacks = false; - } else { - for (const callback of callbacks) { - callback(err, result); - } - activeRequests.delete(identifier); - callbacks = false; - } - }; - /** - * @param {Error=} err error if any - * @param {CacheEntry=} cacheEntry cache entry - * @returns {void} - */ - const processCacheResult = (err, cacheEntry) => { - if (err) return done(err); - if (cacheEntry) { - const { snapshot, result } = cacheEntry; - fileSystemInfo.checkSnapshotValid( - snapshot, - (err, valid) => { - if (err || !valid) { - cacheInvalidResolves++; - return doRealResolve( - itemCache, - resolver, - resolveContext, - request, - done - ); - } - cachedResolves++; - if (resolveContext.missingDependencies) { - addAllToSet( - resolveContext.missingDependencies, - snapshot.getMissingIterable() - ); - } - if (resolveContext.fileDependencies) { - addAllToSet( - resolveContext.fileDependencies, - snapshot.getFileIterable() - ); - } - if (resolveContext.contextDependencies) { - addAllToSet( - resolveContext.contextDependencies, - snapshot.getContextIterable() - ); - } - done(null, result); - } - ); - } else { - doRealResolve( - itemCache, - resolver, - resolveContext, - request, - done - ); - } - }; - itemCache.get(processCacheResult); - if (callbacks === undefined) { - callbacks = [callback]; - activeRequests.set(identifier, callbacks); - } - } - ); - } - ); - return hook; - } - }); + getResolver(type, resolveOptions) { + return this.resolverFactory.get(type, resolveOptions); } } -module.exports = ResolverCachePlugin; +module.exports = NormalModuleFactory; /***/ }), -/***/ 94075: +/***/ 30633: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -62893,85 +58228,93 @@ module.exports = ResolverCachePlugin; -const createHash = __webpack_require__(49835); - -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {typeof import("../util/Hash")} HashConstructor */ +const { join, dirname } = __webpack_require__(17139); -/** - * @typedef {Object} HashableObject - * @property {function(Hash): void} updateHash - */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {function(TODO): void} ModuleReplacer */ -class LazyHashedEtag { +class NormalModuleReplacementPlugin { /** - * @param {HashableObject} obj object with updateHash method - * @param {string | HashConstructor} hashFunction the hash function to use + * Create an instance of the plugin + * @param {RegExp} resourceRegExp the resource matcher + * @param {string|ModuleReplacer} newResource the resource replacement */ - constructor(obj, hashFunction = "md4") { - this._obj = obj; - this._hash = undefined; - this._hashFunction = hashFunction; + constructor(resourceRegExp, newResource) { + this.resourceRegExp = resourceRegExp; + this.newResource = newResource; } /** - * @returns {string} hash of object + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - toString() { - if (this._hash === undefined) { - const hash = createHash(this._hashFunction); - this._obj.updateHash(hash); - this._hash = /** @type {string} */ (hash.digest("base64")); - } - return this._hash; + apply(compiler) { + const resourceRegExp = this.resourceRegExp; + const newResource = this.newResource; + compiler.hooks.normalModuleFactory.tap( + "NormalModuleReplacementPlugin", + nmf => { + nmf.hooks.beforeResolve.tap("NormalModuleReplacementPlugin", result => { + if (resourceRegExp.test(result.request)) { + if (typeof newResource === "function") { + newResource(result); + } else { + result.request = newResource; + } + } + }); + nmf.hooks.afterResolve.tap("NormalModuleReplacementPlugin", result => { + const createData = result.createData; + if (resourceRegExp.test(createData.resource)) { + if (typeof newResource === "function") { + newResource(result); + } else { + const fs = compiler.inputFileSystem; + if ( + newResource.startsWith("/") || + (newResource.length > 1 && newResource[1] === ":") + ) { + createData.resource = newResource; + } else { + createData.resource = join( + fs, + dirname(fs, createData.resource), + newResource + ); + } + } + } + }); + } + ); } } -/** @type {Map>} */ -const mapStrings = new Map(); +module.exports = NormalModuleReplacementPlugin; -/** @type {WeakMap>} */ -const mapObjects = new WeakMap(); -/** - * @param {HashableObject} obj object with updateHash method - * @param {string | HashConstructor} hashFunction the hash function to use - * @returns {LazyHashedEtag} etag - */ -const getter = (obj, hashFunction = "md4") => { - let innerMap; - if (typeof hashFunction === "string") { - innerMap = mapStrings.get(hashFunction); - if (innerMap === undefined) { - const newHash = new LazyHashedEtag(obj, hashFunction); - innerMap = new WeakMap(); - innerMap.set(obj, newHash); - mapStrings.set(hashFunction, innerMap); - return newHash; - } - } else { - innerMap = mapObjects.get(hashFunction); - if (innerMap === undefined) { - const newHash = new LazyHashedEtag(obj, hashFunction); - innerMap = new WeakMap(); - innerMap.set(obj, newHash); - mapObjects.set(hashFunction, innerMap); - return newHash; - } - } - const hash = innerMap.get(obj); - if (hash !== undefined) return hash; - const newHash = new LazyHashedEtag(obj, hashFunction); - innerMap.set(obj, newHash); - return newHash; -}; +/***/ }), -module.exports = getter; +/***/ 80057: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Florent Cailhol @ooflorent +*/ + + + +exports.STAGE_BASIC = -10; +exports.STAGE_DEFAULT = 0; +exports.STAGE_ADVANCED = 10; /***/ }), -/***/ 54980: +/***/ 81426: /***/ (function(module) { "use strict"; @@ -62982,79 +58325,16 @@ module.exports = getter; -/** @typedef {import("../Cache").Etag} Etag */ - -class MergedEtag { - /** - * @param {Etag} a first - * @param {Etag} b second - */ - constructor(a, b) { - this.a = a; - this.b = b; - } - - toString() { - return `${this.a.toString()}|${this.b.toString()}`; - } +class OptionsApply { + process(options, compiler) {} } - -const dualObjectMap = new WeakMap(); -const objectStringMap = new WeakMap(); - -/** - * @param {Etag} a first - * @param {Etag} b second - * @returns {Etag} result - */ -const mergeEtags = (a, b) => { - if (typeof a === "string") { - if (typeof b === "string") { - return `${a}|${b}`; - } else { - const temp = b; - b = a; - a = temp; - } - } else { - if (typeof b !== "string") { - // both a and b are objects - let map = dualObjectMap.get(a); - if (map === undefined) { - dualObjectMap.set(a, (map = new WeakMap())); - } - const mergedEtag = map.get(b); - if (mergedEtag === undefined) { - const newMergedEtag = new MergedEtag(a, b); - map.set(b, newMergedEtag); - return newMergedEtag; - } else { - return mergedEtag; - } - } - } - // a is object, b is string - let map = objectStringMap.get(a); - if (map === undefined) { - objectStringMap.set(a, (map = new Map())); - } - const mergedEtag = map.get(b); - if (mergedEtag === undefined) { - const newMergedEtag = new MergedEtag(a, b); - map.set(b, newMergedEtag); - return newMergedEtag; - } else { - return mergedEtag; - } -}; - -module.exports = mergeEtags; +module.exports = OptionsApply; /***/ }), -/***/ 13462: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 11715: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -63064,1003 +58344,701 @@ module.exports = mergeEtags; -const path = __webpack_require__(71017); -const webpackSchema = __webpack_require__(73342); - -// TODO add originPath to PathItem for better errors -/** - * @typedef {Object} PathItem - * @property {any} schema the part of the schema - * @property {string} path the path in the config - */ - -/** @typedef {"unknown-argument" | "unexpected-non-array-in-path" | "unexpected-non-object-in-path" | "multiple-values-unexpected" | "invalid-value"} ProblemType */ - -/** - * @typedef {Object} Problem - * @property {ProblemType} type - * @property {string} path - * @property {string} argument - * @property {any=} value - * @property {number=} index - * @property {string=} expected - */ - -/** - * @typedef {Object} LocalProblem - * @property {ProblemType} type - * @property {string} path - * @property {string=} expected - */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./NormalModule")} NormalModule */ -/** - * @typedef {Object} ArgumentConfig - * @property {string} description - * @property {string} [negatedDescription] - * @property {string} path - * @property {boolean} multiple - * @property {"enum"|"string"|"path"|"number"|"boolean"|"RegExp"|"reset"} type - * @property {any[]=} values - */ +/** @typedef {Record} PreparsedAst */ /** - * @typedef {Object} Argument - * @property {string} description - * @property {"string"|"number"|"boolean"} simpleType - * @property {boolean} multiple - * @property {ArgumentConfig[]} configs + * @typedef {Object} ParserStateBase + * @property {string | Buffer} source + * @property {NormalModule} current + * @property {NormalModule} module + * @property {Compilation} compilation + * @property {{[k: string]: any}} options */ -/** - * @param {any=} schema a json schema to create arguments for (by default webpack schema is used) - * @returns {Record} object of arguments - */ -const getArguments = (schema = webpackSchema) => { - /** @type {Record} */ - const flags = {}; +/** @typedef {Record & ParserStateBase} ParserState */ - const pathToArgumentName = input => { - return input - .replace(/\./g, "-") - .replace(/\[\]/g, "") - .replace( - /(\p{Uppercase_Letter}+|\p{Lowercase_Letter}|\d)(\p{Uppercase_Letter}+)/gu, - "$1-$2" - ) - .replace(/-?[^\p{Uppercase_Letter}\p{Lowercase_Letter}\d]+/gu, "-") - .toLowerCase(); - }; +class Parser { + /* istanbul ignore next */ + /** + * @abstract + * @param {string | Buffer | PreparsedAst} source the source to parse + * @param {ParserState} state the parser state + * @returns {ParserState} the parser state + */ + parse(source, state) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); + } +} - const getSchemaPart = path => { - const newPath = path.split("/"); +module.exports = Parser; - let schemaPart = schema; - for (let i = 1; i < newPath.length; i++) { - const inner = schemaPart[newPath[i]]; +/***/ }), - if (!inner) { - break; - } +/***/ 73850: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - schemaPart = inner; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - return schemaPart; - }; - /** - * - * @param {PathItem[]} path path in the schema - * @returns {string | undefined} description - */ - const getDescription = path => { - for (const { schema } of path) { - if (schema.cli) { - if (schema.cli.helper) continue; - if (schema.cli.description) return schema.cli.description; - } - if (schema.description) return schema.description; - } - }; - /** - * - * @param {PathItem[]} path path in the schema - * @returns {string | undefined} negative description - */ - const getNegatedDescription = path => { - for (const { schema } of path) { - if (schema.cli) { - if (schema.cli.helper) continue; - if (schema.cli.negatedDescription) return schema.cli.negatedDescription; - } - } - }; +const PrefetchDependency = __webpack_require__(31618); - /** - * - * @param {PathItem[]} path path in the schema - * @returns {string | undefined} reset description - */ - const getResetDescription = path => { - for (const { schema } of path) { - if (schema.cli) { - if (schema.cli.helper) continue; - if (schema.cli.resetDescription) return schema.cli.resetDescription; - } - } - }; +/** @typedef {import("./Compiler")} Compiler */ - /** - * - * @param {any} schemaPart schema - * @returns {Pick} partial argument config - */ - const schemaToArgumentConfig = schemaPart => { - if (schemaPart.enum) { - return { - type: "enum", - values: schemaPart.enum - }; - } - switch (schemaPart.type) { - case "number": - return { - type: "number" - }; - case "string": - return { - type: schemaPart.absolutePath ? "path" : "string" - }; - case "boolean": - return { - type: "boolean" - }; - } - if (schemaPart.instanceof === "RegExp") { - return { - type: "RegExp" - }; +class PrefetchPlugin { + constructor(context, request) { + if (request) { + this.context = context; + this.request = request; + } else { + this.context = null; + this.request = context; } - return undefined; - }; + } /** - * @param {PathItem[]} path path in the schema + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - const addResetFlag = path => { - const schemaPath = path[0].path; - const name = pathToArgumentName(`${schemaPath}.reset`); - const description = - getResetDescription(path) || - `Clear all items provided in '${schemaPath}' configuration. ${getDescription( - path - )}`; - flags[name] = { - configs: [ - { - type: "reset", - multiple: false, - description, - path: schemaPath + apply(compiler) { + compiler.hooks.compilation.tap( + "PrefetchPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + PrefetchDependency, + normalModuleFactory + ); + } + ); + compiler.hooks.make.tapAsync("PrefetchPlugin", (compilation, callback) => { + compilation.addModuleChain( + this.context || compiler.context, + new PrefetchDependency(this.request), + err => { + callback(err); } - ], - description: undefined, - simpleType: undefined, - multiple: undefined - }; - }; - - /** - * @param {PathItem[]} path full path in schema - * @param {boolean} multiple inside of an array - * @returns {number} number of arguments added - */ - const addFlag = (path, multiple) => { - const argConfigBase = schemaToArgumentConfig(path[0].schema); - if (!argConfigBase) return 0; - - const negatedDescription = getNegatedDescription(path); - const name = pathToArgumentName(path[0].path); - /** @type {ArgumentConfig} */ - const argConfig = { - ...argConfigBase, - multiple, - description: getDescription(path), - path: path[0].path - }; - - if (negatedDescription) { - argConfig.negatedDescription = negatedDescription; - } + ); + }); + } +} - if (!flags[name]) { - flags[name] = { - configs: [], - description: undefined, - simpleType: undefined, - multiple: undefined - }; - } +module.exports = PrefetchPlugin; - if ( - flags[name].configs.some( - item => JSON.stringify(item) === JSON.stringify(argConfig) - ) - ) { - return 0; - } - if ( - flags[name].configs.some( - item => item.type === argConfig.type && item.multiple !== multiple - ) - ) { - if (multiple) { - throw new Error( - `Conflicting schema for ${path[0].path} with ${argConfig.type} type (array type must be before single item type)` - ); - } - return 0; - } +/***/ }), - flags[name].configs.push(argConfig); +/***/ 13216: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - return 1; - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // TODO support `not` and `if/then/else` - // TODO support `const`, but we don't use it on our schema - /** - * - * @param {object} schemaPart the current schema - * @param {string} schemaPath the current path in the schema - * @param {{schema: object, path: string}[]} path all previous visited schemaParts - * @param {string | null} inArray if inside of an array, the path to the array - * @returns {number} added arguments - */ - const traverse = (schemaPart, schemaPath = "", path = [], inArray = null) => { - while (schemaPart.$ref) { - schemaPart = getSchemaPart(schemaPart.$ref); - } - const repetitions = path.filter(({ schema }) => schema === schemaPart); - if ( - repetitions.length >= 2 || - repetitions.some(({ path }) => path === schemaPath) - ) { - return 0; - } - if (schemaPart.cli && schemaPart.cli.exclude) return 0; +const Compiler = __webpack_require__(70845); +const MultiCompiler = __webpack_require__(33370); +const NormalModule = __webpack_require__(39); +const createSchemaValidation = __webpack_require__(32540); +const { contextify } = __webpack_require__(82186); - const fullPath = [{ schema: schemaPart, path: schemaPath }, ...path]; +/** @typedef {import("../declarations/plugins/ProgressPlugin").HandlerFunction} HandlerFunction */ +/** @typedef {import("../declarations/plugins/ProgressPlugin").ProgressPluginArgument} ProgressPluginArgument */ +/** @typedef {import("../declarations/plugins/ProgressPlugin").ProgressPluginOptions} ProgressPluginOptions */ - let addedArguments = 0; +const validate = createSchemaValidation( + __webpack_require__(57647), + () => __webpack_require__(75202), + { + name: "Progress Plugin", + baseDataPath: "options" + } +); +const median3 = (a, b, c) => { + return a + b + c - Math.max(a, b, c) - Math.min(a, b, c); +}; - addedArguments += addFlag(fullPath, !!inArray); +const createDefaultHandler = (profile, logger) => { + /** @type {{ value: string, time: number }[]} */ + const lastStateInfo = []; - if (schemaPart.type === "object") { - if (schemaPart.properties) { - for (const property of Object.keys(schemaPart.properties)) { - addedArguments += traverse( - schemaPart.properties[property], - schemaPath ? `${schemaPath}.${property}` : property, - fullPath, - inArray - ); + const defaultHandler = (percentage, msg, ...args) => { + if (profile) { + if (percentage === 0) { + lastStateInfo.length = 0; + } + const fullState = [msg, ...args]; + const state = fullState.map(s => s.replace(/\d+\/\d+ /g, "")); + const now = Date.now(); + const len = Math.max(state.length, lastStateInfo.length); + for (let i = len; i >= 0; i--) { + const stateItem = i < state.length ? state[i] : undefined; + const lastStateItem = + i < lastStateInfo.length ? lastStateInfo[i] : undefined; + if (lastStateItem) { + if (stateItem !== lastStateItem.value) { + const diff = now - lastStateItem.time; + if (lastStateItem.value) { + let reportState = lastStateItem.value; + if (i > 0) { + reportState = lastStateInfo[i - 1].value + " > " + reportState; + } + const stateMsg = `${" | ".repeat(i)}${diff} ms ${reportState}`; + const d = diff; + // This depends on timing so we ignore it for coverage + /* istanbul ignore next */ + { + if (d > 10000) { + logger.error(stateMsg); + } else if (d > 1000) { + logger.warn(stateMsg); + } else if (d > 10) { + logger.info(stateMsg); + } else if (d > 5) { + logger.log(stateMsg); + } else { + logger.debug(stateMsg); + } + } + } + if (stateItem === undefined) { + lastStateInfo.length = i; + } else { + lastStateItem.value = stateItem; + lastStateItem.time = now; + lastStateInfo.length = i + 1; + } + } + } else { + lastStateInfo[i] = { + value: stateItem, + time: now + }; } } - - return addedArguments; } + logger.status(`${Math.floor(percentage * 100)}%`, msg, ...args); + if (percentage === 1 || (!msg && args.length === 0)) logger.status(); + }; - if (schemaPart.type === "array") { - if (inArray) { - return 0; - } - if (Array.isArray(schemaPart.items)) { - let i = 0; - for (const item of schemaPart.items) { - addedArguments += traverse( - item, - `${schemaPath}.${i}`, - fullPath, - schemaPath - ); - } + return defaultHandler; +}; - return addedArguments; - } +/** + * @callback ReportProgress + * @param {number} p + * @param {...string} [args] + * @returns {void} + */ - addedArguments += traverse( - schemaPart.items, - `${schemaPath}[]`, - fullPath, - schemaPath - ); +/** @type {WeakMap} */ +const progressReporters = new WeakMap(); - if (addedArguments > 0) { - addResetFlag(fullPath); - addedArguments++; - } +class ProgressPlugin { + /** + * @param {Compiler} compiler the current compiler + * @returns {ReportProgress} a progress reporter, if any + */ + static getReporter(compiler) { + return progressReporters.get(compiler); + } - return addedArguments; + /** + * @param {ProgressPluginArgument} options options + */ + constructor(options = {}) { + if (typeof options === "function") { + options = { + handler: options + }; } - const maybeOf = schemaPart.oneOf || schemaPart.anyOf || schemaPart.allOf; - - if (maybeOf) { - const items = maybeOf; + validate(options); + options = { ...ProgressPlugin.defaultOptions, ...options }; - for (let i = 0; i < items.length; i++) { - addedArguments += traverse(items[i], schemaPath, fullPath, inArray); - } + this.profile = options.profile; + this.handler = options.handler; + this.modulesCount = options.modulesCount; + this.dependenciesCount = options.dependenciesCount; + this.showEntries = options.entries; + this.showModules = options.modules; + this.showDependencies = options.dependencies; + this.showActiveModules = options.activeModules; + this.percentBy = options.percentBy; + } - return addedArguments; + /** + * @param {Compiler | MultiCompiler} compiler webpack compiler + * @returns {void} + */ + apply(compiler) { + const handler = + this.handler || + createDefaultHandler( + this.profile, + compiler.getInfrastructureLogger("webpack.Progress") + ); + if (compiler instanceof MultiCompiler) { + this._applyOnMultiCompiler(compiler, handler); + } else if (compiler instanceof Compiler) { + this._applyOnCompiler(compiler, handler); } + } - return addedArguments; - }; + /** + * @param {MultiCompiler} compiler webpack multi-compiler + * @param {HandlerFunction} handler function that executes for every progress step + * @returns {void} + */ + _applyOnMultiCompiler(compiler, handler) { + const states = compiler.compilers.map( + () => /** @type {[number, ...string[]]} */ ([0]) + ); + compiler.compilers.forEach((compiler, idx) => { + new ProgressPlugin((p, msg, ...args) => { + states[idx] = [p, msg, ...args]; + let sum = 0; + for (const [p] of states) sum += p; + handler(sum / states.length, `[${idx}] ${msg}`, ...args); + }).apply(compiler); + }); + } - traverse(schema); + /** + * @param {Compiler} compiler webpack compiler + * @param {HandlerFunction} handler function that executes for every progress step + * @returns {void} + */ + _applyOnCompiler(compiler, handler) { + const showEntries = this.showEntries; + const showModules = this.showModules; + const showDependencies = this.showDependencies; + const showActiveModules = this.showActiveModules; + let lastActiveModule = ""; + let currentLoader = ""; + let lastModulesCount = 0; + let lastDependenciesCount = 0; + let lastEntriesCount = 0; + let modulesCount = 0; + let dependenciesCount = 0; + let entriesCount = 1; + let doneModules = 0; + let doneDependencies = 0; + let doneEntries = 0; + const activeModules = new Set(); + let lastUpdate = 0; - // Summarize flags - for (const name of Object.keys(flags)) { - const argument = flags[name]; - argument.description = argument.configs.reduce((desc, { description }) => { - if (!desc) return description; - if (!description) return desc; - if (desc.includes(description)) return desc; - return `${desc} ${description}`; - }, /** @type {string | undefined} */ (undefined)); - argument.simpleType = argument.configs.reduce((t, argConfig) => { - /** @type {"string" | "number" | "boolean"} */ - let type = "string"; - switch (argConfig.type) { - case "number": - type = "number"; + const updateThrottled = () => { + if (lastUpdate + 500 < Date.now()) update(); + }; + + const update = () => { + /** @type {string[]} */ + const items = []; + const percentByModules = + doneModules / + Math.max(lastModulesCount || this.modulesCount || 1, modulesCount); + const percentByEntries = + doneEntries / + Math.max(lastEntriesCount || this.dependenciesCount || 1, entriesCount); + const percentByDependencies = + doneDependencies / + Math.max(lastDependenciesCount || 1, dependenciesCount); + let percentageFactor; + + switch (this.percentBy) { + case "entries": + percentageFactor = percentByEntries; break; - case "reset": - case "boolean": - type = "boolean"; + case "dependencies": + percentageFactor = percentByDependencies; break; - case "enum": - if (argConfig.values.every(v => typeof v === "boolean")) - type = "boolean"; - if (argConfig.values.every(v => typeof v === "number")) - type = "number"; + case "modules": + percentageFactor = percentByModules; break; + default: + percentageFactor = median3( + percentByModules, + percentByEntries, + percentByDependencies + ); } - if (t === undefined) return type; - return t === type ? t : "string"; - }, /** @type {"string" | "number" | "boolean" | undefined} */ (undefined)); - argument.multiple = argument.configs.some(c => c.multiple); - } - return flags; -}; - -const cliAddedItems = new WeakMap(); + const percentage = 0.1 + percentageFactor * 0.55; -/** - * @param {any} config configuration - * @param {string} schemaPath path in the config - * @param {number | undefined} index index of value when multiple values are provided, otherwise undefined - * @returns {{ problem?: LocalProblem, object?: any, property?: string | number, value?: any }} problem or object with property and value - */ -const getObjectAndProperty = (config, schemaPath, index = 0) => { - if (!schemaPath) return { value: config }; - const parts = schemaPath.split("."); - let property = parts.pop(); - let current = config; - let i = 0; - for (const part of parts) { - const isArray = part.endsWith("[]"); - const name = isArray ? part.slice(0, -2) : part; - let value = current[name]; - if (isArray) { - if (value === undefined) { - value = {}; - current[name] = [...Array.from({ length: index }), value]; - cliAddedItems.set(current[name], index + 1); - } else if (!Array.isArray(value)) { - return { - problem: { - type: "unexpected-non-array-in-path", - path: parts.slice(0, i).join(".") - } - }; + if (currentLoader) { + items.push( + `import loader ${contextify( + compiler.context, + currentLoader, + compiler.root + )}` + ); } else { - let addedItems = cliAddedItems.get(value) || 0; - while (addedItems <= index) { - value.push(undefined); - addedItems++; + const statItems = []; + if (showEntries) { + statItems.push(`${doneEntries}/${entriesCount} entries`); } - cliAddedItems.set(value, addedItems); - const x = value.length - addedItems + index; - if (value[x] === undefined) { - value[x] = {}; - } else if (value[x] === null || typeof value[x] !== "object") { - return { - problem: { - type: "unexpected-non-object-in-path", - path: parts.slice(0, i).join(".") - } - }; + if (showDependencies) { + statItems.push( + `${doneDependencies}/${dependenciesCount} dependencies` + ); + } + if (showModules) { + statItems.push(`${doneModules}/${modulesCount} modules`); + } + if (showActiveModules) { + statItems.push(`${activeModules.size} active`); + } + if (statItems.length > 0) { + items.push(statItems.join(" ")); + } + if (showActiveModules) { + items.push(lastActiveModule); } - value = value[x]; - } - } else { - if (value === undefined) { - value = current[name] = {}; - } else if (value === null || typeof value !== "object") { - return { - problem: { - type: "unexpected-non-object-in-path", - path: parts.slice(0, i).join(".") - } - }; - } - } - current = value; - i++; - } - let value = current[property]; - if (property.endsWith("[]")) { - const name = property.slice(0, -2); - const value = current[name]; - if (value === undefined) { - current[name] = [...Array.from({ length: index }), undefined]; - cliAddedItems.set(current[name], index + 1); - return { object: current[name], property: index, value: undefined }; - } else if (!Array.isArray(value)) { - current[name] = [value, ...Array.from({ length: index }), undefined]; - cliAddedItems.set(current[name], index + 1); - return { object: current[name], property: index + 1, value: undefined }; - } else { - let addedItems = cliAddedItems.get(value) || 0; - while (addedItems <= index) { - value.push(undefined); - addedItems++; - } - cliAddedItems.set(value, addedItems); - const x = value.length - addedItems + index; - if (value[x] === undefined) { - value[x] = {}; - } else if (value[x] === null || typeof value[x] !== "object") { - return { - problem: { - type: "unexpected-non-object-in-path", - path: schemaPath - } - }; } - return { - object: value, - property: x, - value: value[x] - }; - } - } - return { object: current, property, value }; -}; - -/** - * @param {any} config configuration - * @param {string} schemaPath path in the config - * @param {any} value parsed value - * @param {number | undefined} index index of value when multiple values are provided, otherwise undefined - * @returns {LocalProblem | null} problem or null for success - */ -const setValue = (config, schemaPath, value, index) => { - const { problem, object, property } = getObjectAndProperty( - config, - schemaPath, - index - ); - if (problem) return problem; - object[property] = value; - return null; -}; + handler(percentage, "building", ...items); + lastUpdate = Date.now(); + }; -/** - * @param {ArgumentConfig} argConfig processing instructions - * @param {any} config configuration - * @param {any} value the value - * @param {number | undefined} index the index if multiple values provided - * @returns {LocalProblem | null} a problem if any - */ -const processArgumentConfig = (argConfig, config, value, index) => { - if (index !== undefined && !argConfig.multiple) { - return { - type: "multiple-values-unexpected", - path: argConfig.path + const factorizeAdd = () => { + dependenciesCount++; + if (dependenciesCount < 50 || dependenciesCount % 100 === 0) + updateThrottled(); }; - } - const parsed = parseValueForArgumentConfig(argConfig, value); - if (parsed === undefined) { - return { - type: "invalid-value", - path: argConfig.path, - expected: getExpectedValue(argConfig) + + const factorizeDone = () => { + doneDependencies++; + if (doneDependencies < 50 || doneDependencies % 100 === 0) + updateThrottled(); }; - } - const problem = setValue(config, argConfig.path, parsed, index); - if (problem) return problem; - return null; -}; -/** - * @param {ArgumentConfig} argConfig processing instructions - * @returns {string | undefined} expected message - */ -const getExpectedValue = argConfig => { - switch (argConfig.type) { - default: - return argConfig.type; - case "boolean": - return "true | false"; - case "RegExp": - return "regular expression (example: /ab?c*/)"; - case "enum": - return argConfig.values.map(v => `${v}`).join(" | "); - case "reset": - return "true (will reset the previous value to an empty array)"; - } -}; + const moduleAdd = () => { + modulesCount++; + if (modulesCount < 50 || modulesCount % 100 === 0) updateThrottled(); + }; -/** - * @param {ArgumentConfig} argConfig processing instructions - * @param {any} value the value - * @returns {any | undefined} parsed value - */ -const parseValueForArgumentConfig = (argConfig, value) => { - switch (argConfig.type) { - case "string": - if (typeof value === "string") { - return value; - } - break; - case "path": - if (typeof value === "string") { - return path.resolve(value); - } - break; - case "number": - if (typeof value === "number") return value; - if (typeof value === "string" && /^[+-]?\d*(\.\d*)[eE]\d+$/) { - const n = +value; - if (!isNaN(n)) return n; - } - break; - case "boolean": - if (typeof value === "boolean") return value; - if (value === "true") return true; - if (value === "false") return false; - break; - case "RegExp": - if (value instanceof RegExp) return value; - if (typeof value === "string") { - // cspell:word yugi - const match = /^\/(.*)\/([yugi]*)$/.exec(value); - if (match && !/[^\\]\//.test(match[1])) - return new RegExp(match[1], match[2]); - } - break; - case "enum": - if (argConfig.values.includes(value)) return value; - for (const item of argConfig.values) { - if (`${item}` === value) return item; + // only used when showActiveModules is set + const moduleBuild = module => { + const ident = module.identifier(); + if (ident) { + activeModules.add(ident); + lastActiveModule = ident; + update(); } - break; - case "reset": - if (value === true) return []; - break; - } -}; + }; -/** - * @param {Record} args object of arguments - * @param {any} config configuration - * @param {Record} values object with values - * @returns {Problem[] | null} problems or null for success - */ -const processArguments = (args, config, values) => { - /** @type {Problem[]} */ - const problems = []; - for (const key of Object.keys(values)) { - const arg = args[key]; - if (!arg) { - problems.push({ - type: "unknown-argument", - path: "", - argument: key - }); - continue; - } - const processValue = (value, i) => { - const currentProblems = []; - for (const argConfig of arg.configs) { - const problem = processArgumentConfig(argConfig, config, value, i); - if (!problem) { - return; + const entryAdd = (entry, options) => { + entriesCount++; + if (entriesCount < 5 || entriesCount % 10 === 0) updateThrottled(); + }; + + const moduleDone = module => { + doneModules++; + if (showActiveModules) { + const ident = module.identifier(); + if (ident) { + activeModules.delete(ident); + if (lastActiveModule === ident) { + lastActiveModule = ""; + for (const m of activeModules) { + lastActiveModule = m; + } + update(); + return; + } } - currentProblems.push({ - ...problem, - argument: key, - value: value, - index: i - }); } - problems.push(...currentProblems); + if (doneModules < 50 || doneModules % 100 === 0) updateThrottled(); }; - let value = values[key]; - if (Array.isArray(value)) { - for (let i = 0; i < value.length; i++) { - processValue(value[i], i); - } - } else { - processValue(value, undefined); - } - } - if (problems.length === 0) return null; - return problems; -}; - -exports.getArguments = getArguments; -exports.processArguments = processArguments; - - -/***/ }), - -/***/ 43950: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sergey Melyukov @smelukov -*/ - - - -const browserslist = __webpack_require__(14907); -const path = __webpack_require__(71017); -/** @typedef {import("./target").ApiTargetProperties} ApiTargetProperties */ -/** @typedef {import("./target").EcmaTargetProperties} EcmaTargetProperties */ -/** @typedef {import("./target").PlatformTargetProperties} PlatformTargetProperties */ + const entryDone = (entry, options) => { + doneEntries++; + update(); + }; -// [[C:]/path/to/config][:env] -const inputRx = /^(?:((?:[A-Z]:)?[/\\].*?))?(?::(.+?))?$/i; + const cache = compiler + .getCache("ProgressPlugin") + .getItemCache("counts", null); -/** - * @typedef {Object} BrowserslistHandlerConfig - * @property {string=} configPath - * @property {string=} env - * @property {string=} query - */ + let cacheGetPromise; -/** - * @param {string} input input string - * @param {string} context the context directory - * @returns {BrowserslistHandlerConfig} config - */ -const parse = (input, context) => { - if (!input) { - return {}; - } + compiler.hooks.beforeCompile.tap("ProgressPlugin", () => { + if (!cacheGetPromise) { + cacheGetPromise = cache.getPromise().then( + data => { + if (data) { + lastModulesCount = lastModulesCount || data.modulesCount; + lastDependenciesCount = + lastDependenciesCount || data.dependenciesCount; + } + return data; + }, + err => { + // Ignore error + } + ); + } + }); - if (path.isAbsolute(input)) { - const [, configPath, env] = inputRx.exec(input) || []; - return { configPath, env }; - } + compiler.hooks.afterCompile.tapPromise("ProgressPlugin", compilation => { + if (compilation.compiler.isChild()) return Promise.resolve(); + return cacheGetPromise.then(async oldData => { + if ( + !oldData || + oldData.modulesCount !== modulesCount || + oldData.dependenciesCount !== dependenciesCount + ) { + await cache.storePromise({ modulesCount, dependenciesCount }); + } + }); + }); - const config = browserslist.findConfig(context); + compiler.hooks.compilation.tap("ProgressPlugin", compilation => { + if (compilation.compiler.isChild()) return; + lastModulesCount = modulesCount; + lastEntriesCount = entriesCount; + lastDependenciesCount = dependenciesCount; + modulesCount = dependenciesCount = entriesCount = 0; + doneModules = doneDependencies = doneEntries = 0; - if (config && Object.keys(config).includes(input)) { - return { env: input }; - } + compilation.factorizeQueue.hooks.added.tap( + "ProgressPlugin", + factorizeAdd + ); + compilation.factorizeQueue.hooks.result.tap( + "ProgressPlugin", + factorizeDone + ); - return { query: input }; -}; + compilation.addModuleQueue.hooks.added.tap("ProgressPlugin", moduleAdd); + compilation.processDependenciesQueue.hooks.result.tap( + "ProgressPlugin", + moduleDone + ); -/** - * @param {string} input input string - * @param {string} context the context directory - * @returns {string[] | undefined} selected browsers - */ -const load = (input, context) => { - const { configPath, env, query } = parse(input, context); + if (showActiveModules) { + compilation.hooks.buildModule.tap("ProgressPlugin", moduleBuild); + } - // if a query is specified, then use it, else - // if a path to a config is specified then load it, else - // find a nearest config - const config = query - ? query - : configPath - ? browserslist.loadConfig({ - config: configPath, - env - }) - : browserslist.loadConfig({ path: context, env }); + compilation.hooks.addEntry.tap("ProgressPlugin", entryAdd); + compilation.hooks.failedEntry.tap("ProgressPlugin", entryDone); + compilation.hooks.succeedEntry.tap("ProgressPlugin", entryDone); - if (!config) return null; - return browserslist(config); -}; + // avoid dynamic require if bundled with webpack + // @ts-expect-error + if (false) {} -/** - * @param {string[]} browsers supported browsers list - * @returns {EcmaTargetProperties & PlatformTargetProperties & ApiTargetProperties} target properties - */ -const resolve = browsers => { - /** - * Checks all against a version number - * @param {Record} versions first supported version - * @returns {boolean} true if supports - */ - const rawChecker = versions => { - return browsers.every(v => { - const [name, parsedVersion] = v.split(" "); - if (!name) return false; - const requiredVersion = versions[name]; - if (!requiredVersion) return false; - const [parsedMajor, parserMinor] = - // safari TP supports all features for normal safari - parsedVersion === "TP" - ? [Infinity, Infinity] - : parsedVersion.split("."); - if (typeof requiredVersion === "number") { - return +parsedMajor >= requiredVersion; + const hooks = { + finishModules: "finish module graph", + seal: "plugins", + optimizeDependencies: "dependencies optimization", + afterOptimizeDependencies: "after dependencies optimization", + beforeChunks: "chunk graph", + afterChunks: "after chunk graph", + optimize: "optimizing", + optimizeModules: "module optimization", + afterOptimizeModules: "after module optimization", + optimizeChunks: "chunk optimization", + afterOptimizeChunks: "after chunk optimization", + optimizeTree: "module and chunk tree optimization", + afterOptimizeTree: "after module and chunk tree optimization", + optimizeChunkModules: "chunk modules optimization", + afterOptimizeChunkModules: "after chunk modules optimization", + reviveModules: "module reviving", + beforeModuleIds: "before module ids", + moduleIds: "module ids", + optimizeModuleIds: "module id optimization", + afterOptimizeModuleIds: "module id optimization", + reviveChunks: "chunk reviving", + beforeChunkIds: "before chunk ids", + chunkIds: "chunk ids", + optimizeChunkIds: "chunk id optimization", + afterOptimizeChunkIds: "after chunk id optimization", + recordModules: "record modules", + recordChunks: "record chunks", + beforeModuleHash: "module hashing", + beforeCodeGeneration: "code generation", + beforeRuntimeRequirements: "runtime requirements", + beforeHash: "hashing", + afterHash: "after hashing", + recordHash: "record hash", + beforeModuleAssets: "module assets processing", + beforeChunkAssets: "chunk assets processing", + processAssets: "asset processing", + afterProcessAssets: "after asset optimization", + record: "recording", + afterSeal: "after seal" + }; + const numberOfHooks = Object.keys(hooks).length; + Object.keys(hooks).forEach((name, idx) => { + const title = hooks[name]; + const percentage = (idx / numberOfHooks) * 0.25 + 0.7; + compilation.hooks[name].intercept({ + name: "ProgressPlugin", + call() { + handler(percentage, "sealing", title); + }, + done() { + progressReporters.set(compiler, undefined); + handler(percentage, "sealing", title); + }, + result() { + handler(percentage, "sealing", title); + }, + error() { + handler(percentage, "sealing", title); + }, + tap(tap) { + // p is percentage from 0 to 1 + // args is any number of messages in a hierarchical matter + progressReporters.set(compilation.compiler, (p, ...args) => { + handler(percentage, "sealing", title, tap.name, ...args); + }); + handler(percentage, "sealing", title, tap.name); + } + }); + }); + }); + compiler.hooks.make.intercept({ + name: "ProgressPlugin", + call() { + handler(0.1, "building"); + }, + done() { + handler(0.65, "building"); } - return requiredVersion[0] === +parsedMajor - ? +parserMinor >= requiredVersion[1] - : +parsedMajor > requiredVersion[0]; }); - }; - const anyNode = browsers.some(b => /^node /.test(b)); - const anyBrowser = browsers.some(b => /^(?!node)/.test(b)); - const browserProperty = !anyBrowser ? false : anyNode ? null : true; - const nodeProperty = !anyNode ? false : anyBrowser ? null : true; - // Internet Explorer Mobile, Blackberry browser and Opera Mini are very old browsers, they do not support new features - const es6DynamicImport = rawChecker({ - chrome: 63, - and_chr: 63, - edge: 79, - firefox: 67, - and_ff: 67, - // ie: Not supported - opera: 50, - op_mob: 46, - safari: [11, 1], - ios_saf: [11, 3], - samsung: [8, 2], - android: 63, - and_qq: [10, 4], - // baidu: Not supported - // and_uc: Not supported - // kaios: Not supported - // Since Node.js 13.14.0 no warning about usage, but it was added 8.5.0 with some limitations and it was improved in 12.0.0 and 13.2.0 - node: [13, 14] - }); - - return { - const: rawChecker({ - chrome: 49, - and_chr: 49, - edge: 12, - // Prior to Firefox 13, const is implemented, but re-assignment is not failing. - // Prior to Firefox 46, a TypeError was thrown on redeclaration instead of a SyntaxError. - firefox: 36, - and_ff: 36, - // Not supported in for-in and for-of loops - // ie: Not supported - opera: 36, - op_mob: 36, - safari: [10, 0], - ios_saf: [10, 0], - // Before 5.0 supported correctly in strict mode, otherwise supported without block scope - samsung: [5, 0], - android: 37, - and_qq: [10, 4], - // Supported correctly in strict mode, otherwise supported without block scope - // baidu: Not supported - and_uc: [12, 12], - kaios: [2, 5], - node: [6, 0] - }), - arrowFunction: rawChecker({ - chrome: 45, - and_chr: 45, - edge: 12, - // The initial implementation of arrow functions in Firefox made them automatically strict. This has been changed as of Firefox 24. The use of 'use strict'; is now required. - // Prior to Firefox 39, a line terminator (\\n) was incorrectly allowed after arrow function arguments. This has been fixed to conform to the ES2015 specification and code like () \\n => {} will now throw a SyntaxError in this and later versions. - firefox: 39, - and_ff: 39, - // ie: Not supported, - opera: 32, - op_mob: 32, - safari: 10, - ios_saf: 10, - samsung: [5, 0], - android: 45, - and_qq: [10, 4], - baidu: [7, 12], - and_uc: [12, 12], - kaios: [2, 5], - node: [6, 0] - }), - forOf: rawChecker({ - chrome: 38, - and_chr: 38, - edge: 12, - // Prior to Firefox 51, using the for...of loop construct with the const keyword threw a SyntaxError ("missing = in const declaration"). - firefox: 51, - and_ff: 51, - // ie: Not supported, - opera: 25, - op_mob: 25, - safari: 7, - ios_saf: 7, - samsung: [3, 0], - android: 38, - // and_qq: Unknown support - // baidu: Unknown support - // and_uc: Unknown support - // kaios: Unknown support - node: [0, 12] - }), - destructuring: rawChecker({ - chrome: 49, - and_chr: 49, - edge: 14, - firefox: 41, - and_ff: 41, - // ie: Not supported, - opera: 36, - op_mob: 36, - safari: 8, - ios_saf: 8, - samsung: [5, 0], - android: 49, - // and_qq: Unknown support - // baidu: Unknown support - // and_uc: Unknown support - // kaios: Unknown support - node: [6, 0] - }), - bigIntLiteral: rawChecker({ - chrome: 67, - and_chr: 67, - edge: 79, - firefox: 68, - and_ff: 68, - // ie: Not supported, - opera: 54, - op_mob: 48, - safari: 14, - ios_saf: 14, - samsung: [9, 2], - android: 67, - // and_qq: Not supported - // baidu: Not supported - // and_uc: Not supported - // kaios: Not supported - node: [10, 4] - }), - // Support syntax `import` and `export` and no limitations and bugs on Node.js - // Not include `export * as namespace` - module: rawChecker({ - chrome: 61, - and_chr: 61, - edge: 16, - firefox: 60, - and_ff: 60, - // ie: Not supported, - opera: 48, - op_mob: 45, - safari: [10, 1], - ios_saf: [10, 3], - samsung: [8, 0], - android: 61, - and_qq: [10, 4], - // baidu: Not supported - // and_uc: Not supported - // kaios: Not supported - // Since Node.js 13.14.0 no warning about usage, but it was added 8.5.0 with some limitations and it was improved in 12.0.0 and 13.2.0 - node: [13, 14] - }), - dynamicImport: es6DynamicImport, - dynamicImportInWorker: es6DynamicImport && !anyNode, - // browserslist does not have info about globalThis - // so this is based on mdn-browser-compat-data - globalThis: rawChecker({ - chrome: 71, - and_chr: 71, - edge: 79, - firefox: 65, - and_ff: 65, - // ie: Not supported, - opera: 58, - op_mob: 50, - safari: [12, 1], - ios_saf: [12, 2], - samsung: [10, 1], - android: 71, - // and_qq: Unknown support - // baidu: Unknown support - // and_uc: Unknown support - // kaios: Unknown support - node: [12, 0] - }), - optionalChaining: rawChecker({ - chrome: 80, - and_chr: 80, - edge: 80, - firefox: 74, - and_ff: 79, - // ie: Not supported, - opera: 67, - op_mob: 64, - safari: [13, 1], - ios_saf: [13, 4], - samsung: 13, - android: 80, - // and_qq: Not supported - // baidu: Not supported - // and_uc: Not supported - // kaios: Not supported - node: 14 - }), - templateLiteral: rawChecker({ - chrome: 41, - and_chr: 41, - edge: 13, - firefox: 34, - and_ff: 34, - // ie: Not supported, - opera: 29, - op_mob: 64, - safari: [9, 1], - ios_saf: 9, - samsung: 4, - android: 41, - and_qq: [10, 4], - baidu: [7, 12], - and_uc: [12, 12], - kaios: [2, 5], - node: 4 - }), - browser: browserProperty, - electron: false, - node: nodeProperty, - nwjs: false, - web: browserProperty, - webworker: false, + const interceptHook = (hook, progress, category, name) => { + hook.intercept({ + name: "ProgressPlugin", + call() { + handler(progress, category, name); + }, + done() { + progressReporters.set(compiler, undefined); + handler(progress, category, name); + }, + result() { + handler(progress, category, name); + }, + error() { + handler(progress, category, name); + }, + tap(tap) { + progressReporters.set(compiler, (p, ...args) => { + handler(progress, category, name, tap.name, ...args); + }); + handler(progress, category, name, tap.name); + } + }); + }; + compiler.cache.hooks.endIdle.intercept({ + name: "ProgressPlugin", + call() { + handler(0, ""); + } + }); + interceptHook(compiler.cache.hooks.endIdle, 0.01, "cache", "end idle"); + compiler.hooks.initialize.intercept({ + name: "ProgressPlugin", + call() { + handler(0, ""); + } + }); + interceptHook(compiler.hooks.initialize, 0.01, "setup", "initialize"); + interceptHook(compiler.hooks.beforeRun, 0.02, "setup", "before run"); + interceptHook(compiler.hooks.run, 0.03, "setup", "run"); + interceptHook(compiler.hooks.watchRun, 0.03, "setup", "watch run"); + interceptHook( + compiler.hooks.normalModuleFactory, + 0.04, + "setup", + "normal module factory" + ); + interceptHook( + compiler.hooks.contextModuleFactory, + 0.05, + "setup", + "context module factory" + ); + interceptHook( + compiler.hooks.beforeCompile, + 0.06, + "setup", + "before compile" + ); + interceptHook(compiler.hooks.compile, 0.07, "setup", "compile"); + interceptHook(compiler.hooks.thisCompilation, 0.08, "setup", "compilation"); + interceptHook(compiler.hooks.compilation, 0.09, "setup", "compilation"); + interceptHook(compiler.hooks.finishMake, 0.69, "building", "finish"); + interceptHook(compiler.hooks.emit, 0.95, "emitting", "emit"); + interceptHook(compiler.hooks.afterEmit, 0.98, "emitting", "after emit"); + interceptHook(compiler.hooks.done, 0.99, "done", "plugins"); + compiler.hooks.done.intercept({ + name: "ProgressPlugin", + done() { + handler(0.99, ""); + } + }); + interceptHook( + compiler.cache.hooks.storeBuildDependencies, + 0.99, + "cache", + "store build dependencies" + ); + interceptHook(compiler.cache.hooks.shutdown, 0.99, "cache", "shutdown"); + interceptHook(compiler.cache.hooks.beginIdle, 0.99, "cache", "begin idle"); + interceptHook( + compiler.hooks.watchClose, + 0.99, + "end", + "closing watch compilation" + ); + compiler.cache.hooks.beginIdle.intercept({ + name: "ProgressPlugin", + done() { + handler(1, ""); + } + }); + compiler.cache.hooks.shutdown.intercept({ + name: "ProgressPlugin", + done() { + handler(1, ""); + } + }); + } +} - document: browserProperty, - fetchWasm: browserProperty, - global: nodeProperty, - importScripts: false, - importScriptsInWorker: true, - nodeBuiltins: nodeProperty, - require: nodeProperty - }; +ProgressPlugin.defaultOptions = { + profile: false, + modulesCount: 5000, + dependenciesCount: 10000, + modules: true, + dependencies: true, + activeModules: false, + entries: true }; -module.exports = { - resolve, - load -}; +module.exports = ProgressPlugin; /***/ }), -/***/ 92988: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 38309: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -64070,2328 +59048,1257 @@ module.exports = { -const fs = __webpack_require__(57147); -const path = __webpack_require__(71017); -const Template = __webpack_require__(1626); -const { cleverMerge } = __webpack_require__(60839); -const { - getTargetsProperties, - getTargetProperties, - getDefaultTarget -} = __webpack_require__(52801); - -/** @typedef {import("../../declarations/WebpackOptions").CacheOptionsNormalized} CacheOptions */ -/** @typedef {import("../../declarations/WebpackOptions").CssExperimentOptions} CssExperimentOptions */ -/** @typedef {import("../../declarations/WebpackOptions").EntryDescription} EntryDescription */ -/** @typedef {import("../../declarations/WebpackOptions").EntryNormalized} Entry */ -/** @typedef {import("../../declarations/WebpackOptions").Experiments} Experiments */ -/** @typedef {import("../../declarations/WebpackOptions").ExperimentsNormalized} ExperimentsNormalized */ -/** @typedef {import("../../declarations/WebpackOptions").ExternalsPresets} ExternalsPresets */ -/** @typedef {import("../../declarations/WebpackOptions").ExternalsType} ExternalsType */ -/** @typedef {import("../../declarations/WebpackOptions").InfrastructureLogging} InfrastructureLogging */ -/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ -/** @typedef {import("../../declarations/WebpackOptions").Library} Library */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryName} LibraryName */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").Loader} Loader */ -/** @typedef {import("../../declarations/WebpackOptions").Mode} Mode */ -/** @typedef {import("../../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */ -/** @typedef {import("../../declarations/WebpackOptions").Node} WebpackNode */ -/** @typedef {import("../../declarations/WebpackOptions").Optimization} Optimization */ -/** @typedef {import("../../declarations/WebpackOptions").OutputNormalized} Output */ -/** @typedef {import("../../declarations/WebpackOptions").Performance} Performance */ -/** @typedef {import("../../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ -/** @typedef {import("../../declarations/WebpackOptions").RuleSetRules} RuleSetRules */ -/** @typedef {import("../../declarations/WebpackOptions").SnapshotOptions} SnapshotOptions */ -/** @typedef {import("../../declarations/WebpackOptions").Target} Target */ -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("./target").TargetProperties} TargetProperties */ +const ConstDependency = __webpack_require__(76911); +const ProvidedDependency = __webpack_require__(95770); +const { approve } = __webpack_require__(93998); -const NODE_MODULES_REGEXP = /[\\/]node_modules[\\/]/i; +/** @typedef {import("./Compiler")} Compiler */ -/** - * Sets a constant default value when undefined - * @template T - * @template {keyof T} P - * @param {T} obj an object - * @param {P} prop a property of this object - * @param {T[P]} value a default value of the property - * @returns {void} - */ -const D = (obj, prop, value) => { - if (obj[prop] === undefined) { - obj[prop] = value; +class ProvidePlugin { + /** + * @param {Record} definitions the provided identifiers + */ + constructor(definitions) { + this.definitions = definitions; } -}; -/** - * Sets a dynamic default value when undefined, by calling the factory function - * @template T - * @template {keyof T} P - * @param {T} obj an object - * @param {P} prop a property of this object - * @param {function(): T[P]} factory a default value factory for the property - * @returns {void} - */ -const F = (obj, prop, factory) => { - if (obj[prop] === undefined) { - obj[prop] = factory(); - } -}; + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const definitions = this.definitions; + compiler.hooks.compilation.tap( + "ProvidePlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyTemplates.set( + ConstDependency, + new ConstDependency.Template() + ); + compilation.dependencyFactories.set( + ProvidedDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + ProvidedDependency, + new ProvidedDependency.Template() + ); + const handler = (parser, parserOptions) => { + Object.keys(definitions).forEach(name => { + const request = [].concat(definitions[name]); + const splittedName = name.split("."); + if (splittedName.length > 0) { + splittedName.slice(1).forEach((_, i) => { + const name = splittedName.slice(0, i + 1).join("."); + parser.hooks.canRename.for(name).tap("ProvidePlugin", approve); + }); + } -/** - * Sets a dynamic default value when undefined, by calling the factory function. - * factory must return an array or undefined - * When the current value is already an array an contains "..." it's replaced with - * the result of the factory function - * @template T - * @template {keyof T} P - * @param {T} obj an object - * @param {P} prop a property of this object - * @param {function(): T[P]} factory a default value factory for the property - * @returns {void} - */ -const A = (obj, prop, factory) => { - const value = obj[prop]; - if (value === undefined) { - obj[prop] = factory(); - } else if (Array.isArray(value)) { - /** @type {any[]} */ - let newArray = undefined; - for (let i = 0; i < value.length; i++) { - const item = value[i]; - if (item === "...") { - if (newArray === undefined) { - newArray = value.slice(0, i); - obj[prop] = /** @type {T[P]} */ (/** @type {unknown} */ (newArray)); - } - const items = /** @type {any[]} */ (/** @type {unknown} */ (factory())); - if (items !== undefined) { - for (const item of items) { - newArray.push(item); - } - } - } else if (newArray !== undefined) { - newArray.push(item); + parser.hooks.expression.for(name).tap("ProvidePlugin", expr => { + const nameIdentifier = name.includes(".") + ? `__webpack_provided_${name.replace(/\./g, "_dot_")}` + : name; + const dep = new ProvidedDependency( + request[0], + nameIdentifier, + request.slice(1), + expr.range + ); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + return true; + }); + + parser.hooks.call.for(name).tap("ProvidePlugin", expr => { + const nameIdentifier = name.includes(".") + ? `__webpack_provided_${name.replace(/\./g, "_dot_")}` + : name; + const dep = new ProvidedDependency( + request[0], + nameIdentifier, + request.slice(1), + expr.callee.range + ); + dep.loc = expr.callee.loc; + parser.state.module.addDependency(dep); + parser.walkExpressions(expr.arguments); + return true; + }); + }); + }; + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("ProvidePlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("ProvidePlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("ProvidePlugin", handler); } - } + ); } -}; - -/** - * @param {WebpackOptions} options options to be modified - * @returns {void} - */ -const applyWebpackOptionsBaseDefaults = options => { - F(options, "context", () => process.cwd()); - applyInfrastructureLoggingDefaults(options.infrastructureLogging); -}; - -/** - * @param {WebpackOptions} options options to be modified - * @returns {void} - */ -const applyWebpackOptionsDefaults = options => { - F(options, "context", () => process.cwd()); - F(options, "target", () => { - return getDefaultTarget(options.context); - }); +} - const { mode, name, target } = options; +module.exports = ProvidePlugin; - let targetProperties = - target === false - ? /** @type {false} */ (false) - : typeof target === "string" - ? getTargetProperties(target, options.context) - : getTargetsProperties(target, options.context); - const development = mode === "development"; - const production = mode === "production" || !mode; +/***/ }), - if (typeof options.entry !== "function") { - for (const key of Object.keys(options.entry)) { - F( - options.entry[key], - "import", - () => /** @type {[string]} */ (["./src"]) - ); - } - } +/***/ 84929: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - F(options, "devtool", () => (development ? "eval" : false)); - D(options, "watch", false); - D(options, "profile", false); - D(options, "parallelism", 100); - D(options, "recordsInputPath", false); - D(options, "recordsOutputPath", false); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - applyExperimentsDefaults(options.experiments, { - production, - development, - targetProperties - }); - const futureDefaults = options.experiments.futureDefaults; - F(options, "cache", () => - development ? { type: /** @type {"memory"} */ ("memory") } : false - ); - applyCacheDefaults(options.cache, { - name: name || "default", - mode: mode || "production", - development, - cacheUnaffected: options.experiments.cacheUnaffected - }); - const cache = !!options.cache; +const { OriginalSource, RawSource } = __webpack_require__(51255); +const Module = __webpack_require__(73208); +const makeSerializable = __webpack_require__(33032); - applySnapshotDefaults(options.snapshot, { - production, - futureDefaults - }); +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./util/Hash")} Hash */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ - applyModuleDefaults(options.module, { - cache, - syncWebAssembly: options.experiments.syncWebAssembly, - asyncWebAssembly: options.experiments.asyncWebAssembly, - css: options.experiments.css, - futureDefaults - }); +const TYPES = new Set(["javascript"]); - applyOutputDefaults(options.output, { - context: options.context, - targetProperties, - isAffectedByBrowserslist: - target === undefined || - (typeof target === "string" && target.startsWith("browserslist")) || - (Array.isArray(target) && - target.some(target => target.startsWith("browserslist"))), - outputModule: options.experiments.outputModule, - development, - entry: options.entry, - module: options.module, - futureDefaults - }); +class RawModule extends Module { + /** + * @param {string} source source code + * @param {string} identifier unique identifier + * @param {string=} readableIdentifier readable identifier + * @param {ReadonlySet=} runtimeRequirements runtime requirements needed for the source code + */ + constructor(source, identifier, readableIdentifier, runtimeRequirements) { + super("javascript/dynamic", null); + this.sourceStr = source; + this.identifierStr = identifier || this.sourceStr; + this.readableIdentifierStr = readableIdentifier || this.identifierStr; + this.runtimeRequirements = runtimeRequirements || null; + } - applyExternalsPresetsDefaults(options.externalsPresets, { - targetProperties, - buildHttp: !!options.experiments.buildHttp - }); + /** + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + return TYPES; + } - applyLoaderDefaults(options.loader, { targetProperties }); + /** + * @returns {string} a unique identifier of the module + */ + identifier() { + return this.identifierStr; + } - F(options, "externalsType", () => { - const validExternalTypes = (__webpack_require__(73342).definitions.ExternalsType["enum"]); - return options.output.library && - validExternalTypes.includes(options.output.library.type) - ? /** @type {ExternalsType} */ (options.output.library.type) - : options.output.module - ? "module" - : "var"; - }); + /** + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + return Math.max(1, this.sourceStr.length); + } - applyNodeDefaults(options.node, { - futureDefaults: options.experiments.futureDefaults, - targetProperties - }); + /** + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + return requestShortener.shorten(this.readableIdentifierStr); + } - F(options, "performance", () => - production && - targetProperties && - (targetProperties.browser || targetProperties.browser === null) - ? {} - : false - ); - applyPerformanceDefaults(options.performance, { - production - }); + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + return callback(null, !this.buildMeta); + } - applyOptimizationDefaults(options.optimization, { - development, - production, - css: options.experiments.css, - records: !!(options.recordsInputPath || options.recordsOutputPath) - }); + /** + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + this.buildMeta = {}; + this.buildInfo = { + cacheable: true + }; + callback(); + } - options.resolve = cleverMerge( - getResolveDefaults({ - cache, - context: options.context, - targetProperties, - mode: options.mode - }), - options.resolve - ); + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration(context) { + const sources = new Map(); + if (this.useSourceMap || this.useSimpleSourceMap) { + sources.set( + "javascript", + new OriginalSource(this.sourceStr, this.identifier()) + ); + } else { + sources.set("javascript", new RawSource(this.sourceStr)); + } + return { sources, runtimeRequirements: this.runtimeRequirements }; + } - options.resolveLoader = cleverMerge( - getResolveLoaderDefaults({ cache }), - options.resolveLoader - ); -}; + /** + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + hash.update(this.sourceStr); + super.updateHash(hash, context); + } -/** - * @param {ExperimentsNormalized} experiments options - * @param {Object} options options - * @param {boolean} options.production is production - * @param {boolean} options.development is development mode - * @param {TargetProperties | false} options.targetProperties target properties - * @returns {void} - */ -const applyExperimentsDefaults = ( - experiments, - { production, development, targetProperties } -) => { - D(experiments, "futureDefaults", false); - D(experiments, "backCompat", !experiments.futureDefaults); - D(experiments, "topLevelAwait", experiments.futureDefaults); - D(experiments, "syncWebAssembly", false); - D(experiments, "asyncWebAssembly", experiments.futureDefaults); - D(experiments, "outputModule", false); - D(experiments, "layers", false); - D(experiments, "lazyCompilation", undefined); - D(experiments, "buildHttp", undefined); - D(experiments, "cacheUnaffected", experiments.futureDefaults); - F(experiments, "css", () => (experiments.futureDefaults ? {} : undefined)); + serialize(context) { + const { write } = context; - if (typeof experiments.buildHttp === "object") { - D(experiments.buildHttp, "frozen", production); - D(experiments.buildHttp, "upgrade", false); - } + write(this.sourceStr); + write(this.identifierStr); + write(this.readableIdentifierStr); + write(this.runtimeRequirements); - if (typeof experiments.css === "object") { - D( - experiments.css, - "exportsOnly", - !targetProperties || !targetProperties.document - ); + super.serialize(context); } -}; -/** - * @param {CacheOptions} cache options - * @param {Object} options options - * @param {string} options.name name - * @param {string} options.mode mode - * @param {boolean} options.development is development mode - * @param {boolean} options.cacheUnaffected the cacheUnaffected experiment is enabled - * @returns {void} - */ -const applyCacheDefaults = ( - cache, - { name, mode, development, cacheUnaffected } -) => { - if (cache === false) return; - switch (cache.type) { - case "filesystem": - F(cache, "name", () => name + "-" + mode); - D(cache, "version", ""); - F(cache, "cacheDirectory", () => { - const cwd = process.cwd(); - let dir = cwd; - for (;;) { - try { - if (fs.statSync(path.join(dir, "package.json")).isFile()) break; - // eslint-disable-next-line no-empty - } catch (e) {} - const parent = path.dirname(dir); - if (dir === parent) { - dir = undefined; - break; - } - dir = parent; - } - if (!dir) { - return path.resolve(cwd, ".cache/webpack"); - } else if (process.versions.pnp === "1") { - return path.resolve(dir, ".pnp/.cache/webpack"); - } else if (process.versions.pnp === "3") { - return path.resolve(dir, ".yarn/.cache/webpack"); - } else { - return path.resolve(dir, "node_modules/.cache/webpack"); - } - }); - F(cache, "cacheLocation", () => - path.resolve(cache.cacheDirectory, cache.name) - ); - D(cache, "hashAlgorithm", "md4"); - D(cache, "store", "pack"); - D(cache, "compression", false); - D(cache, "profile", false); - D(cache, "idleTimeout", 60000); - D(cache, "idleTimeoutForInitialStore", 5000); - D(cache, "idleTimeoutAfterLargeChanges", 1000); - D(cache, "maxMemoryGenerations", development ? 5 : Infinity); - D(cache, "maxAge", 1000 * 60 * 60 * 24 * 60); // 1 month - D(cache, "allowCollectingMemory", development); - D(cache, "memoryCacheUnaffected", development && cacheUnaffected); - D(cache.buildDependencies, "defaultWebpack", [ - path.resolve(__dirname, "..") + path.sep - ]); - break; - case "memory": - D(cache, "maxGenerations", Infinity); - D(cache, "cacheUnaffected", development && cacheUnaffected); - break; + deserialize(context) { + const { read } = context; + + this.sourceStr = read(); + this.identifierStr = read(); + this.readableIdentifierStr = read(); + this.runtimeRequirements = read(); + + super.deserialize(context); } -}; +} + +makeSerializable(RawModule, "webpack/lib/RawModule"); + +module.exports = RawModule; + + +/***/ }), + +/***/ 11094: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { compareNumbers } = __webpack_require__(29579); +const identifierUtils = __webpack_require__(82186); + +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Module")} Module */ /** - * @param {SnapshotOptions} snapshot options - * @param {Object} options options - * @param {boolean} options.production is production - * @param {boolean} options.futureDefaults is future defaults enabled - * @returns {void} + * @typedef {Object} RecordsChunks + * @property {Record=} byName + * @property {Record=} bySource + * @property {number[]=} usedIds */ -const applySnapshotDefaults = (snapshot, { production, futureDefaults }) => { - if (futureDefaults) { - F(snapshot, "managedPaths", () => - process.versions.pnp === "3" - ? [ - /^(.+?(?:[\\/]\.yarn[\\/]unplugged[\\/][^\\/]+)?[\\/]node_modules[\\/])/ - ] - : [/^(.+?[\\/]node_modules[\\/])/] - ); - F(snapshot, "immutablePaths", () => - process.versions.pnp === "3" - ? [/^(.+?[\\/]cache[\\/][^\\/]+\.zip[\\/]node_modules[\\/])/] - : [] - ); - } else { - A(snapshot, "managedPaths", () => { - if (process.versions.pnp === "3") { - const match = - /^(.+?)[\\/]cache[\\/]watchpack-npm-[^\\/]+\.zip[\\/]node_modules[\\/]/.exec( - /*require.resolve*/(36871) - ); - if (match) { - return [path.resolve(match[1], "unplugged")]; - } - } else { - const match = /^(.+?[\\/]node_modules[\\/])/.exec( - // eslint-disable-next-line node/no-extraneous-require - /*require.resolve*/(36871) - ); - if (match) { - return [match[1]]; - } - } - return []; - }); - A(snapshot, "immutablePaths", () => { - if (process.versions.pnp === "1") { - const match = - /^(.+?[\\/]v4)[\\/]npm-watchpack-[^\\/]+-[\da-f]{40}[\\/]node_modules[\\/]/.exec( - /*require.resolve*/(36871) - ); - if (match) { - return [match[1]]; - } - } else if (process.versions.pnp === "3") { - const match = - /^(.+?)[\\/]watchpack-npm-[^\\/]+\.zip[\\/]node_modules[\\/]/.exec( - /*require.resolve*/(36871) - ); - if (match) { - return [match[1]]; - } - } - return []; - }); - } - F(snapshot, "resolveBuildDependencies", () => ({ - timestamp: true, - hash: true - })); - F(snapshot, "buildDependencies", () => ({ timestamp: true, hash: true })); - F(snapshot, "module", () => - production ? { timestamp: true, hash: true } : { timestamp: true } - ); - F(snapshot, "resolve", () => - production ? { timestamp: true, hash: true } : { timestamp: true } - ); -}; /** - * @param {JavascriptParserOptions} parserOptions parser options - * @param {Object} options options - * @param {boolean} options.futureDefaults is future defaults enabled - * @returns {void} + * @typedef {Object} RecordsModules + * @property {Record=} byIdentifier + * @property {Record=} bySource + * @property {number[]=} usedIds */ -const applyJavascriptParserOptionsDefaults = ( - parserOptions, - { futureDefaults } -) => { - D(parserOptions, "unknownContextRequest", "."); - D(parserOptions, "unknownContextRegExp", false); - D(parserOptions, "unknownContextRecursive", true); - D(parserOptions, "unknownContextCritical", true); - D(parserOptions, "exprContextRequest", "."); - D(parserOptions, "exprContextRegExp", false); - D(parserOptions, "exprContextRecursive", true); - D(parserOptions, "exprContextCritical", true); - D(parserOptions, "wrappedContextRegExp", /.*/); - D(parserOptions, "wrappedContextRecursive", true); - D(parserOptions, "wrappedContextCritical", false); - D(parserOptions, "strictThisContextOnImports", false); - D(parserOptions, "importMeta", true); - if (futureDefaults) D(parserOptions, "exportsPresence", "error"); -}; /** - * @param {ModuleOptions} module options - * @param {Object} options options - * @param {boolean} options.cache is caching enabled - * @param {boolean} options.syncWebAssembly is syncWebAssembly enabled - * @param {boolean} options.asyncWebAssembly is asyncWebAssembly enabled - * @param {CssExperimentOptions} options.css is css enabled - * @param {boolean} options.futureDefaults is future defaults enabled - * @returns {void} + * @typedef {Object} Records + * @property {RecordsChunks=} chunks + * @property {RecordsModules=} modules */ -const applyModuleDefaults = ( - module, - { cache, syncWebAssembly, asyncWebAssembly, css, futureDefaults } -) => { - if (cache) { - D(module, "unsafeCache", module => { - const name = module.nameForCondition(); - return name && NODE_MODULES_REGEXP.test(name); - }); - } else { - D(module, "unsafeCache", false); - } - F(module.parser, "asset", () => ({})); - F(module.parser.asset, "dataUrlCondition", () => ({})); - if (typeof module.parser.asset.dataUrlCondition === "object") { - D(module.parser.asset.dataUrlCondition, "maxSize", 8096); +class RecordIdsPlugin { + /** + * @param {Object} options Options object + * @param {boolean=} options.portableIds true, when ids need to be portable + */ + constructor(options) { + this.options = options || {}; } - F(module.parser, "javascript", () => ({})); - applyJavascriptParserOptionsDefaults(module.parser.javascript, { - futureDefaults - }); + /** + * @param {Compiler} compiler the Compiler + * @returns {void} + */ + apply(compiler) { + const portableIds = this.options.portableIds; - A(module, "defaultRules", () => { - const esm = { - type: "javascript/esm", - resolve: { - byDependency: { - esm: { - fullySpecified: true - } - } + const makePathsRelative = + identifierUtils.makePathsRelative.bindContextCache( + compiler.context, + compiler.root + ); + + /** + * @param {Module} module the module + * @returns {string} the (portable) identifier + */ + const getModuleIdentifier = module => { + if (portableIds) { + return makePathsRelative(module.identifier()); } + return module.identifier(); }; - const commonjs = { - type: "javascript/dynamic" - }; - /** @type {RuleSetRules} */ - const rules = [ - { - mimetype: "application/node", - type: "javascript/auto" - }, - { - test: /\.json$/i, - type: "json" - }, - { - mimetype: "application/json", - type: "json" - }, - { - test: /\.mjs$/i, - ...esm - }, - { - test: /\.js$/i, - descriptionData: { - type: "module" - }, - ...esm - }, - { - test: /\.cjs$/i, - ...commonjs - }, - { - test: /\.js$/i, - descriptionData: { - type: "commonjs" - }, - ...commonjs - }, - { - mimetype: { - or: ["text/javascript", "application/javascript"] - }, - ...esm - } - ]; - if (asyncWebAssembly) { - const wasm = { - type: "webassembly/async", - rules: [ - { - descriptionData: { - type: "module" - }, - resolve: { - fullySpecified: true + + compiler.hooks.compilation.tap("RecordIdsPlugin", compilation => { + compilation.hooks.recordModules.tap( + "RecordIdsPlugin", + /** + * @param {Module[]} modules the modules array + * @param {Records} records the records object + * @returns {void} + */ + (modules, records) => { + const chunkGraph = compilation.chunkGraph; + if (!records.modules) records.modules = {}; + if (!records.modules.byIdentifier) records.modules.byIdentifier = {}; + /** @type {Set} */ + const usedIds = new Set(); + for (const module of modules) { + const moduleId = chunkGraph.getModuleId(module); + if (typeof moduleId !== "number") continue; + const identifier = getModuleIdentifier(module); + records.modules.byIdentifier[identifier] = moduleId; + usedIds.add(moduleId); + } + records.modules.usedIds = Array.from(usedIds).sort(compareNumbers); + } + ); + compilation.hooks.reviveModules.tap( + "RecordIdsPlugin", + /** + * @param {Module[]} modules the modules array + * @param {Records} records the records object + * @returns {void} + */ + (modules, records) => { + if (!records.modules) return; + if (records.modules.byIdentifier) { + const chunkGraph = compilation.chunkGraph; + /** @type {Set} */ + const usedIds = new Set(); + for (const module of modules) { + const moduleId = chunkGraph.getModuleId(module); + if (moduleId !== null) continue; + const identifier = getModuleIdentifier(module); + const id = records.modules.byIdentifier[identifier]; + if (id === undefined) continue; + if (usedIds.has(id)) continue; + usedIds.add(id); + chunkGraph.setModuleId(module, id); } } - ] - }; - rules.push({ - test: /\.wasm$/i, - ...wasm - }); - rules.push({ - mimetype: "application/wasm", - ...wasm - }); - } else if (syncWebAssembly) { - const wasm = { - type: "webassembly/sync", - rules: [ - { - descriptionData: { - type: "module" - }, - resolve: { - fullySpecified: true + if (Array.isArray(records.modules.usedIds)) { + compilation.usedModuleIds = new Set(records.modules.usedIds); + } + } + ); + + /** + * @param {Chunk} chunk the chunk + * @returns {string[]} sources of the chunk + */ + const getChunkSources = chunk => { + /** @type {string[]} */ + const sources = []; + for (const chunkGroup of chunk.groupsIterable) { + const index = chunkGroup.chunks.indexOf(chunk); + if (chunkGroup.name) { + sources.push(`${index} ${chunkGroup.name}`); + } else { + for (const origin of chunkGroup.origins) { + if (origin.module) { + if (origin.request) { + sources.push( + `${index} ${getModuleIdentifier(origin.module)} ${ + origin.request + }` + ); + } else if (typeof origin.loc === "string") { + sources.push( + `${index} ${getModuleIdentifier(origin.module)} ${ + origin.loc + }` + ); + } else if ( + origin.loc && + typeof origin.loc === "object" && + "start" in origin.loc + ) { + sources.push( + `${index} ${getModuleIdentifier( + origin.module + )} ${JSON.stringify(origin.loc.start)}` + ); + } + } } } - ] - }; - rules.push({ - test: /\.wasm$/i, - ...wasm - }); - rules.push({ - mimetype: "application/wasm", - ...wasm - }); - } - if (css) { - const cssRule = { - type: "css", - resolve: { - fullySpecified: true, - preferRelative: true } + return sources; }; - const cssModulesRule = { - type: "css/module", - resolve: { - fullySpecified: true + + compilation.hooks.recordChunks.tap( + "RecordIdsPlugin", + /** + * @param {Chunk[]} chunks the chunks array + * @param {Records} records the records object + * @returns {void} + */ + (chunks, records) => { + if (!records.chunks) records.chunks = {}; + if (!records.chunks.byName) records.chunks.byName = {}; + if (!records.chunks.bySource) records.chunks.bySource = {}; + /** @type {Set} */ + const usedIds = new Set(); + for (const chunk of chunks) { + if (typeof chunk.id !== "number") continue; + const name = chunk.name; + if (name) records.chunks.byName[name] = chunk.id; + const sources = getChunkSources(chunk); + for (const source of sources) { + records.chunks.bySource[source] = chunk.id; + } + usedIds.add(chunk.id); + } + records.chunks.usedIds = Array.from(usedIds).sort(compareNumbers); } - }; - rules.push({ - test: /\.css$/i, - oneOf: [ - { - test: /\.module\.css$/i, - ...cssModulesRule - }, - { - ...cssRule + ); + compilation.hooks.reviveChunks.tap( + "RecordIdsPlugin", + /** + * @param {Chunk[]} chunks the chunks array + * @param {Records} records the records object + * @returns {void} + */ + (chunks, records) => { + if (!records.chunks) return; + /** @type {Set} */ + const usedIds = new Set(); + if (records.chunks.byName) { + for (const chunk of chunks) { + if (chunk.id !== null) continue; + if (!chunk.name) continue; + const id = records.chunks.byName[chunk.name]; + if (id === undefined) continue; + if (usedIds.has(id)) continue; + usedIds.add(id); + chunk.id = id; + chunk.ids = [id]; + } } - ] - }); - rules.push({ - mimetype: "text/css+module", - ...cssModulesRule - }); - rules.push({ - mimetype: "text/css", - ...cssRule - }); - } - rules.push( - { - dependency: "url", - oneOf: [ - { - scheme: /^data$/, - type: "asset/inline" - }, - { - type: "asset/resource" + if (records.chunks.bySource) { + for (const chunk of chunks) { + if (chunk.id !== null) continue; + const sources = getChunkSources(chunk); + for (const source of sources) { + const id = records.chunks.bySource[source]; + if (id === undefined) continue; + if (usedIds.has(id)) continue; + usedIds.add(id); + chunk.id = id; + chunk.ids = [id]; + break; + } + } } - ] - }, - { - assert: { type: "json" }, - type: "json" - } - ); - return rules; - }); -}; - -/** - * @param {Output} output options - * @param {Object} options options - * @param {string} options.context context - * @param {TargetProperties | false} options.targetProperties target properties - * @param {boolean} options.isAffectedByBrowserslist is affected by browserslist - * @param {boolean} options.outputModule is outputModule experiment enabled - * @param {boolean} options.development is development mode - * @param {Entry} options.entry entry option - * @param {ModuleOptions} options.module module option - * @param {boolean} options.futureDefaults is future defaults enabled - * @returns {void} - */ -const applyOutputDefaults = ( - output, - { - context, - targetProperties: tp, - isAffectedByBrowserslist, - outputModule, - development, - entry, - module, - futureDefaults + if (Array.isArray(records.chunks.usedIds)) { + compilation.usedChunkIds = new Set(records.chunks.usedIds); + } + } + ); + }); } -) => { - /** - * @param {Library=} library the library option - * @returns {string} a readable library name - */ - const getLibraryName = library => { - const libraryName = - typeof library === "object" && - library && - !Array.isArray(library) && - "type" in library - ? library.name - : /** @type {LibraryName=} */ (library); - if (Array.isArray(libraryName)) { - return libraryName.join("."); - } else if (typeof libraryName === "object") { - return getLibraryName(libraryName.root); - } else if (typeof libraryName === "string") { - return libraryName; - } - return ""; - }; +} +module.exports = RecordIdsPlugin; - F(output, "uniqueName", () => { - const libraryName = getLibraryName(output.library); - if (libraryName) return libraryName; - const pkgPath = path.resolve(context, "package.json"); - try { - const packageInfo = JSON.parse(fs.readFileSync(pkgPath, "utf-8")); - return packageInfo.name || ""; - } catch (e) { - if (e.code !== "ENOENT") { - e.message += `\nwhile determining default 'output.uniqueName' from 'name' in ${pkgPath}`; - throw e; - } - return ""; - } - }); - F(output, "module", () => !!outputModule); - D(output, "filename", output.module ? "[name].mjs" : "[name].js"); - F(output, "iife", () => !output.module); - D(output, "importFunctionName", "import"); - D(output, "importMetaName", "import.meta"); - F(output, "chunkFilename", () => { - const filename = output.filename; - if (typeof filename !== "function") { - const hasName = filename.includes("[name]"); - const hasId = filename.includes("[id]"); - const hasChunkHash = filename.includes("[chunkhash]"); - const hasContentHash = filename.includes("[contenthash]"); - // Anything changing depending on chunk is fine - if (hasChunkHash || hasContentHash || hasName || hasId) return filename; - // Otherwise prefix "[id]." in front of the basename to make it changing - return filename.replace(/(^|\/)([^/]*(?:\?|$))/, "$1[id].$2"); - } - return output.module ? "[id].mjs" : "[id].js"; - }); - F(output, "cssFilename", () => { - const filename = output.filename; - if (typeof filename !== "function") { - return filename.replace(/\.[mc]?js(\?|$)/, ".css$1"); - } - return "[id].css"; - }); - F(output, "cssChunkFilename", () => { - const chunkFilename = output.chunkFilename; - if (typeof chunkFilename !== "function") { - return chunkFilename.replace(/\.[mc]?js(\?|$)/, ".css$1"); - } - return "[id].css"; - }); - D(output, "assetModuleFilename", "[hash][ext][query]"); - D(output, "webassemblyModuleFilename", "[hash].module.wasm"); - D(output, "compareBeforeEmit", true); - D(output, "charset", true); - F(output, "hotUpdateGlobal", () => - Template.toIdentifier( - "webpackHotUpdate" + Template.toIdentifier(output.uniqueName) - ) - ); - F(output, "chunkLoadingGlobal", () => - Template.toIdentifier( - "webpackChunk" + Template.toIdentifier(output.uniqueName) - ) - ); - F(output, "globalObject", () => { - if (tp) { - if (tp.global) return "global"; - if (tp.globalThis) return "globalThis"; - } - return "self"; - }); - F(output, "chunkFormat", () => { - if (tp) { - const helpMessage = isAffectedByBrowserslist - ? "Make sure that your 'browserslist' includes only platforms that support these features or select an appropriate 'target' to allow selecting a chunk format by default. Alternatively specify the 'output.chunkFormat' directly." - : "Select an appropriate 'target' to allow selecting one by default, or specify the 'output.chunkFormat' directly."; - if (output.module) { - if (tp.dynamicImport) return "module"; - if (tp.document) return "array-push"; - throw new Error( - "For the selected environment is no default ESM chunk format available:\n" + - "ESM exports can be chosen when 'import()' is available.\n" + - "JSONP Array push can be chosen when 'document' is available.\n" + - helpMessage - ); - } else { - if (tp.document) return "array-push"; - if (tp.require) return "commonjs"; - if (tp.nodeBuiltins) return "commonjs"; - if (tp.importScripts) return "array-push"; - throw new Error( - "For the selected environment is no default script chunk format available:\n" + - "JSONP Array push can be chosen when 'document' or 'importScripts' is available.\n" + - "CommonJs exports can be chosen when 'require' or node builtins are available.\n" + - helpMessage - ); - } - } - throw new Error( - "Chunk format can't be selected by default when no target is specified" - ); - }); - D(output, "asyncChunks", true); - F(output, "chunkLoading", () => { - if (tp) { - switch (output.chunkFormat) { - case "array-push": - if (tp.document) return "jsonp"; - if (tp.importScripts) return "import-scripts"; - break; - case "commonjs": - if (tp.require) return "require"; - if (tp.nodeBuiltins) return "async-node"; - break; - case "module": - if (tp.dynamicImport) return "import"; - break; - } - if ( - tp.require === null || - tp.nodeBuiltins === null || - tp.document === null || - tp.importScripts === null - ) { - return "universal"; - } - } - return false; - }); - F(output, "workerChunkLoading", () => { - if (tp) { - switch (output.chunkFormat) { - case "array-push": - if (tp.importScriptsInWorker) return "import-scripts"; - break; - case "commonjs": - if (tp.require) return "require"; - if (tp.nodeBuiltins) return "async-node"; - break; - case "module": - if (tp.dynamicImportInWorker) return "import"; - break; - } - if ( - tp.require === null || - tp.nodeBuiltins === null || - tp.importScriptsInWorker === null - ) { - return "universal"; - } - } - return false; - }); - F(output, "wasmLoading", () => { - if (tp) { - if (tp.fetchWasm) return "fetch"; - if (tp.nodeBuiltins) - return output.module ? "async-node-module" : "async-node"; - if (tp.nodeBuiltins === null || tp.fetchWasm === null) { - return "universal"; - } - } - return false; - }); - F(output, "workerWasmLoading", () => output.wasmLoading); - F(output, "devtoolNamespace", () => output.uniqueName); - if (output.library) { - F(output.library, "type", () => (output.module ? "module" : "var")); - } - F(output, "path", () => path.join(process.cwd(), "dist")); - F(output, "pathinfo", () => development); - D(output, "sourceMapFilename", "[file].map[query]"); - D( - output, - "hotUpdateChunkFilename", - `[id].[fullhash].hot-update.${output.module ? "mjs" : "js"}` - ); - D(output, "hotUpdateMainFilename", "[runtime].[fullhash].hot-update.json"); - D(output, "crossOriginLoading", false); - F(output, "scriptType", () => (output.module ? "module" : false)); - D( - output, - "publicPath", - (tp && (tp.document || tp.importScripts)) || output.scriptType === "module" - ? "auto" - : "" - ); - D(output, "chunkLoadTimeout", 120000); - D(output, "hashFunction", futureDefaults ? "xxhash64" : "md4"); - D(output, "hashDigest", "hex"); - D(output, "hashDigestLength", futureDefaults ? 16 : 20); - D(output, "strictModuleExceptionHandling", false); +/***/ }), - const optimistic = v => v || v === undefined; - const conditionallyOptimistic = (v, c) => (v === undefined && c) || v; - F( - output.environment, - "arrowFunction", - () => tp && optimistic(tp.arrowFunction) - ); - F(output.environment, "const", () => tp && optimistic(tp.const)); - F( - output.environment, - "destructuring", - () => tp && optimistic(tp.destructuring) - ); - F(output.environment, "forOf", () => tp && optimistic(tp.forOf)); - F(output.environment, "bigIntLiteral", () => tp && tp.bigIntLiteral); - F(output.environment, "dynamicImport", () => - conditionallyOptimistic(tp && tp.dynamicImport, output.module) - ); - F(output.environment, "module", () => - conditionallyOptimistic(tp && tp.module, output.module) - ); +/***/ 73406: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const { trustedTypes } = output; - if (trustedTypes) { - F( - trustedTypes, - "policyName", - () => - output.uniqueName.replace(/[^a-zA-Z0-9\-#=_/@.%]+/g, "_") || "webpack" +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { contextify } = __webpack_require__(82186); + +class RequestShortener { + /** + * @param {string} dir the directory + * @param {object=} associatedObjectForCache an object to which the cache will be attached + */ + constructor(dir, associatedObjectForCache) { + this.contextify = contextify.bindContextCache( + dir, + associatedObjectForCache ); } /** - * @param {function(EntryDescription): void} fn iterator - * @returns {void} + * @param {string | undefined | null} request the request to shorten + * @returns {string | undefined | null} the shortened request */ - const forEachEntry = fn => { - for (const name of Object.keys(entry)) { - fn(entry[name]); - } - }; - A(output, "enabledLibraryTypes", () => { - const enabledLibraryTypes = []; - if (output.library) { - enabledLibraryTypes.push(output.library.type); + shorten(request) { + if (!request) { + return request; } - forEachEntry(desc => { - if (desc.library) { - enabledLibraryTypes.push(desc.library.type); - } - }); - return enabledLibraryTypes; - }); + return this.contextify(request); + } +} - A(output, "enabledChunkLoadingTypes", () => { - const enabledChunkLoadingTypes = new Set(); - if (output.chunkLoading) { - enabledChunkLoadingTypes.add(output.chunkLoading); - } - if (output.workerChunkLoading) { - enabledChunkLoadingTypes.add(output.workerChunkLoading); - } - forEachEntry(desc => { - if (desc.chunkLoading) { - enabledChunkLoadingTypes.add(desc.chunkLoading); - } - }); - return Array.from(enabledChunkLoadingTypes); - }); +module.exports = RequestShortener; - A(output, "enabledWasmLoadingTypes", () => { - const enabledWasmLoadingTypes = new Set(); - if (output.wasmLoading) { - enabledWasmLoadingTypes.add(output.wasmLoading); - } - if (output.workerWasmLoading) { - enabledWasmLoadingTypes.add(output.workerWasmLoading); - } - forEachEntry(desc => { - if (desc.wasmLoading) { - enabledWasmLoadingTypes.add(desc.wasmLoading); - } - }); - return Array.from(enabledWasmLoadingTypes); - }); -}; -/** - * @param {ExternalsPresets} externalsPresets options - * @param {Object} options options - * @param {TargetProperties | false} options.targetProperties target properties - * @param {boolean} options.buildHttp buildHttp experiment enabled - * @returns {void} - */ -const applyExternalsPresetsDefaults = ( - externalsPresets, - { targetProperties, buildHttp } -) => { - D( - externalsPresets, - "web", - !buildHttp && targetProperties && targetProperties.web - ); - D(externalsPresets, "node", targetProperties && targetProperties.node); - D(externalsPresets, "nwjs", targetProperties && targetProperties.nwjs); - D( - externalsPresets, - "electron", - targetProperties && targetProperties.electron - ); - D( - externalsPresets, - "electronMain", - targetProperties && - targetProperties.electron && - targetProperties.electronMain - ); - D( - externalsPresets, - "electronPreload", - targetProperties && - targetProperties.electron && - targetProperties.electronPreload - ); - D( - externalsPresets, - "electronRenderer", - targetProperties && - targetProperties.electron && - targetProperties.electronRenderer - ); -}; +/***/ }), + +/***/ 88846: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const ConstDependency = __webpack_require__(76911); +const { + toConstantDependency +} = __webpack_require__(93998); + +/** @typedef {import("./Compiler")} Compiler */ + +module.exports = class RequireJsStuffPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "RequireJsStuffPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyTemplates.set( + ConstDependency, + new ConstDependency.Template() + ); + const handler = (parser, parserOptions) => { + if ( + parserOptions.requireJs === undefined || + !parserOptions.requireJs + ) { + return; + } + + parser.hooks.call + .for("require.config") + .tap( + "RequireJsStuffPlugin", + toConstantDependency(parser, "undefined") + ); + parser.hooks.call + .for("requirejs.config") + .tap( + "RequireJsStuffPlugin", + toConstantDependency(parser, "undefined") + ); -/** - * @param {Loader} loader options - * @param {Object} options options - * @param {TargetProperties | false} options.targetProperties target properties - * @returns {void} - */ -const applyLoaderDefaults = (loader, { targetProperties }) => { - F(loader, "target", () => { - if (targetProperties) { - if (targetProperties.electron) { - if (targetProperties.electronMain) return "electron-main"; - if (targetProperties.electronPreload) return "electron-preload"; - if (targetProperties.electronRenderer) return "electron-renderer"; - return "electron"; + parser.hooks.expression + .for("require.version") + .tap( + "RequireJsStuffPlugin", + toConstantDependency(parser, JSON.stringify("0.0.0")) + ); + parser.hooks.expression + .for("requirejs.onError") + .tap( + "RequireJsStuffPlugin", + toConstantDependency( + parser, + RuntimeGlobals.uncaughtErrorHandler, + [RuntimeGlobals.uncaughtErrorHandler] + ) + ); + }; + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("RequireJsStuffPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("RequireJsStuffPlugin", handler); } - if (targetProperties.nwjs) return "nwjs"; - if (targetProperties.node) return "node"; - if (targetProperties.web) return "web"; - } - }); + ); + } }; + +/***/ }), + +/***/ 30217: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const Factory = (__webpack_require__(30662).ResolverFactory); +const { HookMap, SyncHook, SyncWaterfallHook } = __webpack_require__(41242); +const { + cachedCleverMerge, + removeOperations, + resolveByProperty +} = __webpack_require__(60839); + +/** @typedef {import("enhanced-resolve").ResolveOptions} ResolveOptions */ +/** @typedef {import("enhanced-resolve").Resolver} Resolver */ +/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} WebpackResolveOptions */ +/** @typedef {import("../declarations/WebpackOptions").ResolvePluginInstance} ResolvePluginInstance */ + +/** @typedef {WebpackResolveOptions & {dependencyType?: string, resolveToContext?: boolean }} ResolveOptionsWithDependencyType */ /** - * @param {WebpackNode} node options - * @param {Object} options options - * @param {TargetProperties | false} options.targetProperties target properties - * @param {boolean} options.futureDefaults is future defaults enabled - * @returns {void} + * @typedef {Object} WithOptions + * @property {function(Partial): ResolverWithOptions} withOptions create a resolver with additional/different options */ -const applyNodeDefaults = (node, { futureDefaults, targetProperties }) => { - if (node === false) return; - F(node, "global", () => { - if (targetProperties && targetProperties.global) return false; - // TODO webpack 6 should always default to false - return futureDefaults ? "warn" : true; - }); - F(node, "__filename", () => { - if (targetProperties && targetProperties.node) return "eval-only"; - // TODO webpack 6 should always default to false - return futureDefaults ? "warn-mock" : "mock"; - }); - F(node, "__dirname", () => { - if (targetProperties && targetProperties.node) return "eval-only"; - // TODO webpack 6 should always default to false - return futureDefaults ? "warn-mock" : "mock"; - }); -}; +/** @typedef {Resolver & WithOptions} ResolverWithOptions */ + +// need to be hoisted on module level for caching identity +const EMPTY_RESOLVE_OPTIONS = {}; /** - * @param {Performance} performance options - * @param {Object} options options - * @param {boolean} options.production is production - * @returns {void} + * @param {ResolveOptionsWithDependencyType} resolveOptionsWithDepType enhanced options + * @returns {ResolveOptions} merged options */ -const applyPerformanceDefaults = (performance, { production }) => { - if (performance === false) return; - D(performance, "maxAssetSize", 250000); - D(performance, "maxEntrypointSize", 250000); - F(performance, "hints", () => (production ? "warning" : false)); +const convertToResolveOptions = resolveOptionsWithDepType => { + const { dependencyType, plugins, ...remaining } = resolveOptionsWithDepType; + + // check type compat + /** @type {Partial} */ + const partialOptions = { + ...remaining, + plugins: + plugins && + /** @type {ResolvePluginInstance[]} */ ( + plugins.filter(item => item !== "...") + ) + }; + + if (!partialOptions.fileSystem) { + throw new Error( + "fileSystem is missing in resolveOptions, but it's required for enhanced-resolve" + ); + } + // These weird types validate that we checked all non-optional properties + const options = + /** @type {Partial & Pick} */ ( + partialOptions + ); + + return removeOperations( + resolveByProperty(options, "byDependency", dependencyType) + ); }; /** - * @param {Optimization} optimization options - * @param {Object} options options - * @param {boolean} options.production is production - * @param {boolean} options.development is development - * @param {CssExperimentOptions} options.css is css enabled - * @param {boolean} options.records using records - * @returns {void} + * @typedef {Object} ResolverCache + * @property {WeakMap} direct + * @property {Map} stringified */ -const applyOptimizationDefaults = ( - optimization, - { production, development, css, records } -) => { - D(optimization, "removeAvailableModules", false); - D(optimization, "removeEmptyChunks", true); - D(optimization, "mergeDuplicateChunks", true); - D(optimization, "flagIncludedChunks", production); - F(optimization, "moduleIds", () => { - if (production) return "deterministic"; - if (development) return "named"; - return "natural"; - }); - F(optimization, "chunkIds", () => { - if (production) return "deterministic"; - if (development) return "named"; - return "natural"; - }); - F(optimization, "sideEffects", () => (production ? true : "flag")); - D(optimization, "providedExports", true); - D(optimization, "usedExports", production); - D(optimization, "innerGraph", production); - D(optimization, "mangleExports", production); - D(optimization, "concatenateModules", production); - D(optimization, "runtimeChunk", false); - D(optimization, "emitOnErrors", !production); - D(optimization, "checkWasmTypes", production); - D(optimization, "mangleWasmImports", false); - D(optimization, "portableRecords", records); - D(optimization, "realContentHash", production); - D(optimization, "minimize", production); - A(optimization, "minimizer", () => [ - { - apply: compiler => { - // Lazy load the Terser plugin - const TerserPlugin = __webpack_require__(55302); - new TerserPlugin({ - terserOptions: { - compress: { - passes: 2 - } - } - }).apply(compiler); - } + +module.exports = class ResolverFactory { + constructor() { + this.hooks = Object.freeze({ + /** @type {HookMap>} */ + resolveOptions: new HookMap( + () => new SyncWaterfallHook(["resolveOptions"]) + ), + /** @type {HookMap>} */ + resolver: new HookMap( + () => new SyncHook(["resolver", "resolveOptions", "userResolveOptions"]) + ) + }); + /** @type {Map} */ + this.cache = new Map(); + } + + /** + * @param {string} type type of resolver + * @param {ResolveOptionsWithDependencyType=} resolveOptions options + * @returns {ResolverWithOptions} the resolver + */ + get(type, resolveOptions = EMPTY_RESOLVE_OPTIONS) { + let typedCaches = this.cache.get(type); + if (!typedCaches) { + typedCaches = { + direct: new WeakMap(), + stringified: new Map() + }; + this.cache.set(type, typedCaches); } - ]); - F(optimization, "nodeEnv", () => { - if (production) return "production"; - if (development) return "development"; - return false; - }); - const { splitChunks } = optimization; - if (splitChunks) { - A(splitChunks, "defaultSizeTypes", () => - css ? ["javascript", "css", "unknown"] : ["javascript", "unknown"] + const cachedResolver = typedCaches.direct.get(resolveOptions); + if (cachedResolver) { + return cachedResolver; + } + const ident = JSON.stringify(resolveOptions); + const resolver = typedCaches.stringified.get(ident); + if (resolver) { + typedCaches.direct.set(resolveOptions, resolver); + return resolver; + } + const newResolver = this._create(type, resolveOptions); + typedCaches.direct.set(resolveOptions, newResolver); + typedCaches.stringified.set(ident, newResolver); + return newResolver; + } + + /** + * @param {string} type type of resolver + * @param {ResolveOptionsWithDependencyType} resolveOptionsWithDepType options + * @returns {ResolverWithOptions} the resolver + */ + _create(type, resolveOptionsWithDepType) { + /** @type {ResolveOptionsWithDependencyType} */ + const originalResolveOptions = { ...resolveOptionsWithDepType }; + + const resolveOptions = convertToResolveOptions( + this.hooks.resolveOptions.for(type).call(resolveOptionsWithDepType) ); - D(splitChunks, "hidePathInfo", production); - D(splitChunks, "chunks", "async"); - D(splitChunks, "usedExports", optimization.usedExports === true); - D(splitChunks, "minChunks", 1); - F(splitChunks, "minSize", () => (production ? 20000 : 10000)); - F(splitChunks, "minRemainingSize", () => (development ? 0 : undefined)); - F(splitChunks, "enforceSizeThreshold", () => (production ? 50000 : 30000)); - F(splitChunks, "maxAsyncRequests", () => (production ? 30 : Infinity)); - F(splitChunks, "maxInitialRequests", () => (production ? 30 : Infinity)); - D(splitChunks, "automaticNameDelimiter", "-"); - const { cacheGroups } = splitChunks; - F(cacheGroups, "default", () => ({ - idHint: "", - reuseExistingChunk: true, - minChunks: 2, - priority: -20 - })); - F(cacheGroups, "defaultVendors", () => ({ - idHint: "vendors", - reuseExistingChunk: true, - test: NODE_MODULES_REGEXP, - priority: -10 - })); + const resolver = /** @type {ResolverWithOptions} */ ( + Factory.createResolver(resolveOptions) + ); + if (!resolver) { + throw new Error("No resolver created"); + } + /** @type {WeakMap, ResolverWithOptions>} */ + const childCache = new WeakMap(); + resolver.withOptions = options => { + const cacheEntry = childCache.get(options); + if (cacheEntry !== undefined) return cacheEntry; + const mergedOptions = cachedCleverMerge(originalResolveOptions, options); + const resolver = this.get(type, mergedOptions); + childCache.set(options, resolver); + return resolver; + }; + this.hooks.resolver + .for(type) + .call(resolver, resolveOptions, originalResolveOptions); + return resolver; } }; -/** - * @param {Object} options options - * @param {boolean} options.cache is cache enable - * @param {string} options.context build context - * @param {TargetProperties | false} options.targetProperties target properties - * @param {Mode} options.mode mode - * @returns {ResolveOptions} resolve options - */ -const getResolveDefaults = ({ cache, context, targetProperties, mode }) => { - /** @type {string[]} */ - const conditions = ["webpack"]; - conditions.push(mode === "development" ? "development" : "production"); +/***/ }), - if (targetProperties) { - if (targetProperties.webworker) conditions.push("worker"); - if (targetProperties.node) conditions.push("node"); - if (targetProperties.web) conditions.push("browser"); - if (targetProperties.electron) conditions.push("electron"); - if (targetProperties.nwjs) conditions.push("nwjs"); - } +/***/ 16475: +/***/ (function(__unused_webpack_module, exports) { - const jsExtensions = [".js", ".json", ".wasm"]; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - const tp = targetProperties; - const browserField = - tp && tp.web && (!tp.node || (tp.electron && tp.electronRenderer)); - /** @type {function(): ResolveOptions} */ - const cjsDeps = () => ({ - aliasFields: browserField ? ["browser"] : [], - mainFields: browserField ? ["browser", "module", "..."] : ["module", "..."], - conditionNames: ["require", "module", "..."], - extensions: [...jsExtensions] - }); - /** @type {function(): ResolveOptions} */ - const esmDeps = () => ({ - aliasFields: browserField ? ["browser"] : [], - mainFields: browserField ? ["browser", "module", "..."] : ["module", "..."], - conditionNames: ["import", "module", "..."], - extensions: [...jsExtensions] - }); - /** @type {ResolveOptions} */ - const resolveOptions = { - cache, - modules: ["node_modules"], - conditionNames: conditions, - mainFiles: ["index"], - extensions: [], - aliasFields: [], - exportsFields: ["exports"], - roots: [context], - mainFields: ["main"], - byDependency: { - wasm: esmDeps(), - esm: esmDeps(), - loaderImport: esmDeps(), - url: { - preferRelative: true - }, - worker: { - ...esmDeps(), - preferRelative: true - }, - commonjs: cjsDeps(), - amd: cjsDeps(), - // for backward-compat: loadModule - loader: cjsDeps(), - // for backward-compat: Custom Dependency - unknown: cjsDeps(), - // for backward-compat: getResolve without dependencyType - undefined: cjsDeps() - } - }; +/** + * the internal require function + */ +exports.require = "__webpack_require__"; - return resolveOptions; -}; +/** + * access to properties of the internal require function/object + */ +exports.requireScope = "__webpack_require__.*"; /** - * @param {Object} options options - * @param {boolean} options.cache is cache enable - * @returns {ResolveOptions} resolve options + * the internal exports object */ -const getResolveLoaderDefaults = ({ cache }) => { - /** @type {ResolveOptions} */ - const resolveOptions = { - cache, - conditionNames: ["loader", "require", "node"], - exportsFields: ["exports"], - mainFields: ["loader", "main"], - extensions: [".js"], - mainFiles: ["index"] - }; +exports.exports = "__webpack_exports__"; - return resolveOptions; -}; +/** + * top-level this need to be the exports object + */ +exports.thisAsExports = "top-level-this-exports"; /** - * @param {InfrastructureLogging} infrastructureLogging options - * @returns {void} + * runtime need to return the exports of the last entry module */ -const applyInfrastructureLoggingDefaults = infrastructureLogging => { - F(infrastructureLogging, "stream", () => process.stderr); - const tty = - /** @type {any} */ (infrastructureLogging.stream).isTTY && - process.env.TERM !== "dumb"; - D(infrastructureLogging, "level", "info"); - D(infrastructureLogging, "debug", false); - D(infrastructureLogging, "colors", tty); - D(infrastructureLogging, "appendOnly", !tty); -}; +exports.returnExportsFromRuntime = "return-exports-from-runtime"; -exports.applyWebpackOptionsBaseDefaults = applyWebpackOptionsBaseDefaults; -exports.applyWebpackOptionsDefaults = applyWebpackOptionsDefaults; +/** + * the internal module object + */ +exports.module = "module"; +/** + * the internal module object + */ +exports.moduleId = "module.id"; -/***/ }), +/** + * the internal module object + */ +exports.moduleLoaded = "module.loaded"; -/***/ 26693: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/** + * the bundle public path + */ +exports.publicPath = "__webpack_require__.p"; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** + * the module id of the entry point + */ +exports.entryModuleId = "__webpack_require__.s"; +/** + * the module cache + */ +exports.moduleCache = "__webpack_require__.c"; +/** + * the module functions + */ +exports.moduleFactories = "__webpack_require__.m"; -const util = __webpack_require__(73837); +/** + * the module functions, with only write access + */ +exports.moduleFactoriesAddOnly = "__webpack_require__.m (add only)"; -/** @typedef {import("../../declarations/WebpackOptions").EntryStatic} EntryStatic */ -/** @typedef {import("../../declarations/WebpackOptions").EntryStaticNormalized} EntryStaticNormalized */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryName} LibraryName */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").OptimizationRuntimeChunk} OptimizationRuntimeChunk */ -/** @typedef {import("../../declarations/WebpackOptions").OptimizationRuntimeChunkNormalized} OptimizationRuntimeChunkNormalized */ -/** @typedef {import("../../declarations/WebpackOptions").OutputNormalized} OutputNormalized */ -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptions} WebpackOptions */ -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptionsNormalized */ +/** + * the chunk ensure function + */ +exports.ensureChunk = "__webpack_require__.e"; -const handledDeprecatedNoEmitOnErrors = util.deprecate( - (noEmitOnErrors, emitOnErrors) => { - if (emitOnErrors !== undefined && !noEmitOnErrors === !emitOnErrors) { - throw new Error( - "Conflicting use of 'optimization.noEmitOnErrors' and 'optimization.emitOnErrors'. Remove deprecated 'optimization.noEmitOnErrors' from config." - ); - } - return !noEmitOnErrors; - }, - "optimization.noEmitOnErrors is deprecated in favor of optimization.emitOnErrors", - "DEP_WEBPACK_CONFIGURATION_OPTIMIZATION_NO_EMIT_ON_ERRORS" -); +/** + * an object with handlers to ensure a chunk + */ +exports.ensureChunkHandlers = "__webpack_require__.f"; /** - * @template T - * @template R - * @param {T|undefined} value value or not - * @param {function(T): R} fn nested handler - * @returns {R} result value + * a runtime requirement if ensureChunkHandlers should include loading of chunk needed for entries */ -const nestedConfig = (value, fn) => - value === undefined ? fn(/** @type {T} */ ({})) : fn(value); +exports.ensureChunkIncludeEntries = "__webpack_require__.f (include entries)"; + +/** + * the chunk prefetch function + */ +exports.prefetchChunk = "__webpack_require__.E"; /** - * @template T - * @param {T|undefined} value value or not - * @returns {T} result value + * an object with handlers to prefetch a chunk */ -const cloneObject = value => { - return /** @type {T} */ ({ ...value }); -}; +exports.prefetchChunkHandlers = "__webpack_require__.F"; /** - * @template T - * @template R - * @param {T|undefined} value value or not - * @param {function(T): R} fn nested handler - * @returns {R|undefined} result value + * the chunk preload function */ -const optionalNestedConfig = (value, fn) => - value === undefined ? undefined : fn(value); +exports.preloadChunk = "__webpack_require__.G"; /** - * @template T - * @template R - * @param {T[]|undefined} value array or not - * @param {function(T[]): R[]} fn nested handler - * @returns {R[]|undefined} cloned value + * an object with handlers to preload a chunk */ -const nestedArray = (value, fn) => (Array.isArray(value) ? fn(value) : fn([])); +exports.preloadChunkHandlers = "__webpack_require__.H"; /** - * @template T - * @template R - * @param {T[]|undefined} value array or not - * @param {function(T[]): R[]} fn nested handler - * @returns {R[]|undefined} cloned value + * the exported property define getters function */ -const optionalNestedArray = (value, fn) => - Array.isArray(value) ? fn(value) : undefined; +exports.definePropertyGetters = "__webpack_require__.d"; /** - * @template T - * @template R - * @param {Record|undefined} value value or not - * @param {function(T): R} fn nested handler - * @param {Record=} customKeys custom nested handler for some keys - * @returns {Record} result value + * define compatibility on export */ -const keyedNestedConfig = (value, fn, customKeys) => { - const result = - value === undefined - ? {} - : Object.keys(value).reduce( - (obj, key) => ( - (obj[key] = ( - customKeys && key in customKeys ? customKeys[key] : fn - )(value[key])), - obj - ), - /** @type {Record} */ ({}) - ); - if (customKeys) { - for (const key of Object.keys(customKeys)) { - if (!(key in result)) { - result[key] = customKeys[key](/** @type {T} */ ({})); - } - } - } - return result; -}; +exports.makeNamespaceObject = "__webpack_require__.r"; /** - * @param {WebpackOptions} config input config - * @returns {WebpackOptionsNormalized} normalized options + * create a fake namespace object */ -const getNormalizedWebpackOptions = config => { - return { - amd: config.amd, - bail: config.bail, - cache: optionalNestedConfig(config.cache, cache => { - if (cache === false) return false; - if (cache === true) { - return { - type: "memory", - maxGenerations: undefined - }; - } - switch (cache.type) { - case "filesystem": - return { - type: "filesystem", - allowCollectingMemory: cache.allowCollectingMemory, - maxMemoryGenerations: cache.maxMemoryGenerations, - maxAge: cache.maxAge, - profile: cache.profile, - buildDependencies: cloneObject(cache.buildDependencies), - cacheDirectory: cache.cacheDirectory, - cacheLocation: cache.cacheLocation, - hashAlgorithm: cache.hashAlgorithm, - compression: cache.compression, - idleTimeout: cache.idleTimeout, - idleTimeoutForInitialStore: cache.idleTimeoutForInitialStore, - idleTimeoutAfterLargeChanges: cache.idleTimeoutAfterLargeChanges, - name: cache.name, - store: cache.store, - version: cache.version - }; - case undefined: - case "memory": - return { - type: "memory", - maxGenerations: cache.maxGenerations - }; - default: - // @ts-expect-error Property 'type' does not exist on type 'never'. ts(2339) - throw new Error(`Not implemented cache.type ${cache.type}`); - } - }), - context: config.context, - dependencies: config.dependencies, - devServer: optionalNestedConfig(config.devServer, devServer => ({ - ...devServer - })), - devtool: config.devtool, - entry: - config.entry === undefined - ? { main: {} } - : typeof config.entry === "function" - ? ( - fn => () => - Promise.resolve().then(fn).then(getNormalizedEntryStatic) - )(config.entry) - : getNormalizedEntryStatic(config.entry), - experiments: nestedConfig(config.experiments, experiments => ({ - ...experiments, - buildHttp: optionalNestedConfig(experiments.buildHttp, options => - Array.isArray(options) ? { allowedUris: options } : options - ), - lazyCompilation: optionalNestedConfig( - experiments.lazyCompilation, - options => - options === true ? {} : options === false ? undefined : options - ), - css: optionalNestedConfig(experiments.css, options => - options === true ? {} : options === false ? undefined : options - ) - })), - externals: config.externals, - externalsPresets: cloneObject(config.externalsPresets), - externalsType: config.externalsType, - ignoreWarnings: config.ignoreWarnings - ? config.ignoreWarnings.map(ignore => { - if (typeof ignore === "function") return ignore; - const i = ignore instanceof RegExp ? { message: ignore } : ignore; - return (warning, { requestShortener }) => { - if (!i.message && !i.module && !i.file) return false; - if (i.message && !i.message.test(warning.message)) { - return false; - } - if ( - i.module && - (!warning.module || - !i.module.test( - warning.module.readableIdentifier(requestShortener) - )) - ) { - return false; - } - if (i.file && (!warning.file || !i.file.test(warning.file))) { - return false; - } - return true; - }; - }) - : undefined, - infrastructureLogging: cloneObject(config.infrastructureLogging), - loader: cloneObject(config.loader), - mode: config.mode, - module: nestedConfig(config.module, module => ({ - noParse: module.noParse, - unsafeCache: module.unsafeCache, - parser: keyedNestedConfig(module.parser, cloneObject, { - javascript: parserOptions => ({ - unknownContextRequest: module.unknownContextRequest, - unknownContextRegExp: module.unknownContextRegExp, - unknownContextRecursive: module.unknownContextRecursive, - unknownContextCritical: module.unknownContextCritical, - exprContextRequest: module.exprContextRequest, - exprContextRegExp: module.exprContextRegExp, - exprContextRecursive: module.exprContextRecursive, - exprContextCritical: module.exprContextCritical, - wrappedContextRegExp: module.wrappedContextRegExp, - wrappedContextRecursive: module.wrappedContextRecursive, - wrappedContextCritical: module.wrappedContextCritical, - // TODO webpack 6 remove - strictExportPresence: module.strictExportPresence, - strictThisContextOnImports: module.strictThisContextOnImports, - ...parserOptions - }) - }), - generator: cloneObject(module.generator), - defaultRules: optionalNestedArray(module.defaultRules, r => [...r]), - rules: nestedArray(module.rules, r => [...r]) - })), - name: config.name, - node: nestedConfig( - config.node, - node => - node && { - ...node - } - ), - optimization: nestedConfig(config.optimization, optimization => { - return { - ...optimization, - runtimeChunk: getNormalizedOptimizationRuntimeChunk( - optimization.runtimeChunk - ), - splitChunks: nestedConfig( - optimization.splitChunks, - splitChunks => - splitChunks && { - ...splitChunks, - defaultSizeTypes: splitChunks.defaultSizeTypes - ? [...splitChunks.defaultSizeTypes] - : ["..."], - cacheGroups: cloneObject(splitChunks.cacheGroups) - } - ), - emitOnErrors: - optimization.noEmitOnErrors !== undefined - ? handledDeprecatedNoEmitOnErrors( - optimization.noEmitOnErrors, - optimization.emitOnErrors - ) - : optimization.emitOnErrors - }; - }), - output: nestedConfig(config.output, output => { - const { library } = output; - const libraryAsName = /** @type {LibraryName} */ (library); - const libraryBase = - typeof library === "object" && - library && - !Array.isArray(library) && - "type" in library - ? library - : libraryAsName || output.libraryTarget - ? /** @type {LibraryOptions} */ ({ - name: libraryAsName - }) - : undefined; - /** @type {OutputNormalized} */ - const result = { - assetModuleFilename: output.assetModuleFilename, - asyncChunks: output.asyncChunks, - charset: output.charset, - chunkFilename: output.chunkFilename, - chunkFormat: output.chunkFormat, - chunkLoading: output.chunkLoading, - chunkLoadingGlobal: output.chunkLoadingGlobal, - chunkLoadTimeout: output.chunkLoadTimeout, - cssFilename: output.cssFilename, - cssChunkFilename: output.cssChunkFilename, - clean: output.clean, - compareBeforeEmit: output.compareBeforeEmit, - crossOriginLoading: output.crossOriginLoading, - devtoolFallbackModuleFilenameTemplate: - output.devtoolFallbackModuleFilenameTemplate, - devtoolModuleFilenameTemplate: output.devtoolModuleFilenameTemplate, - devtoolNamespace: output.devtoolNamespace, - environment: cloneObject(output.environment), - enabledChunkLoadingTypes: output.enabledChunkLoadingTypes - ? [...output.enabledChunkLoadingTypes] - : ["..."], - enabledLibraryTypes: output.enabledLibraryTypes - ? [...output.enabledLibraryTypes] - : ["..."], - enabledWasmLoadingTypes: output.enabledWasmLoadingTypes - ? [...output.enabledWasmLoadingTypes] - : ["..."], - filename: output.filename, - globalObject: output.globalObject, - hashDigest: output.hashDigest, - hashDigestLength: output.hashDigestLength, - hashFunction: output.hashFunction, - hashSalt: output.hashSalt, - hotUpdateChunkFilename: output.hotUpdateChunkFilename, - hotUpdateGlobal: output.hotUpdateGlobal, - hotUpdateMainFilename: output.hotUpdateMainFilename, - iife: output.iife, - importFunctionName: output.importFunctionName, - importMetaName: output.importMetaName, - scriptType: output.scriptType, - library: libraryBase && { - type: - output.libraryTarget !== undefined - ? output.libraryTarget - : libraryBase.type, - auxiliaryComment: - output.auxiliaryComment !== undefined - ? output.auxiliaryComment - : libraryBase.auxiliaryComment, - export: - output.libraryExport !== undefined - ? output.libraryExport - : libraryBase.export, - name: libraryBase.name, - umdNamedDefine: - output.umdNamedDefine !== undefined - ? output.umdNamedDefine - : libraryBase.umdNamedDefine - }, - module: output.module, - path: output.path, - pathinfo: output.pathinfo, - publicPath: output.publicPath, - sourceMapFilename: output.sourceMapFilename, - sourcePrefix: output.sourcePrefix, - strictModuleExceptionHandling: output.strictModuleExceptionHandling, - trustedTypes: optionalNestedConfig( - output.trustedTypes, - trustedTypes => { - if (trustedTypes === true) return {}; - if (typeof trustedTypes === "string") - return { policyName: trustedTypes }; - return { ...trustedTypes }; - } - ), - uniqueName: output.uniqueName, - wasmLoading: output.wasmLoading, - webassemblyModuleFilename: output.webassemblyModuleFilename, - workerChunkLoading: output.workerChunkLoading, - workerWasmLoading: output.workerWasmLoading - }; - return result; - }), - parallelism: config.parallelism, - performance: optionalNestedConfig(config.performance, performance => { - if (performance === false) return false; - return { - ...performance - }; - }), - plugins: nestedArray(config.plugins, p => [...p]), - profile: config.profile, - recordsInputPath: - config.recordsInputPath !== undefined - ? config.recordsInputPath - : config.recordsPath, - recordsOutputPath: - config.recordsOutputPath !== undefined - ? config.recordsOutputPath - : config.recordsPath, - resolve: nestedConfig(config.resolve, resolve => ({ - ...resolve, - byDependency: keyedNestedConfig(resolve.byDependency, cloneObject) - })), - resolveLoader: cloneObject(config.resolveLoader), - snapshot: nestedConfig(config.snapshot, snapshot => ({ - resolveBuildDependencies: optionalNestedConfig( - snapshot.resolveBuildDependencies, - resolveBuildDependencies => ({ - timestamp: resolveBuildDependencies.timestamp, - hash: resolveBuildDependencies.hash - }) - ), - buildDependencies: optionalNestedConfig( - snapshot.buildDependencies, - buildDependencies => ({ - timestamp: buildDependencies.timestamp, - hash: buildDependencies.hash - }) - ), - resolve: optionalNestedConfig(snapshot.resolve, resolve => ({ - timestamp: resolve.timestamp, - hash: resolve.hash - })), - module: optionalNestedConfig(snapshot.module, module => ({ - timestamp: module.timestamp, - hash: module.hash - })), - immutablePaths: optionalNestedArray(snapshot.immutablePaths, p => [...p]), - managedPaths: optionalNestedArray(snapshot.managedPaths, p => [...p]) - })), - stats: nestedConfig(config.stats, stats => { - if (stats === false) { - return { - preset: "none" - }; - } - if (stats === true) { - return { - preset: "normal" - }; - } - if (typeof stats === "string") { - return { - preset: stats - }; - } - return { - ...stats - }; - }), - target: config.target, - watch: config.watch, - watchOptions: cloneObject(config.watchOptions) - }; -}; +exports.createFakeNamespaceObject = "__webpack_require__.t"; /** - * @param {EntryStatic} entry static entry options - * @returns {EntryStaticNormalized} normalized static entry options + * compatibility get default export */ -const getNormalizedEntryStatic = entry => { - if (typeof entry === "string") { - return { - main: { - import: [entry] - } - }; - } - if (Array.isArray(entry)) { - return { - main: { - import: entry - } - }; - } - /** @type {EntryStaticNormalized} */ - const result = {}; - for (const key of Object.keys(entry)) { - const value = entry[key]; - if (typeof value === "string") { - result[key] = { - import: [value] - }; - } else if (Array.isArray(value)) { - result[key] = { - import: value - }; - } else { - result[key] = { - import: - value.import && - (Array.isArray(value.import) ? value.import : [value.import]), - filename: value.filename, - layer: value.layer, - runtime: value.runtime, - publicPath: value.publicPath, - chunkLoading: value.chunkLoading, - asyncChunks: value.asyncChunks, - wasmLoading: value.wasmLoading, - dependOn: - value.dependOn && - (Array.isArray(value.dependOn) ? value.dependOn : [value.dependOn]), - library: value.library - }; - } - } - return result; -}; +exports.compatGetDefaultExport = "__webpack_require__.n"; /** - * @param {OptimizationRuntimeChunk=} runtimeChunk runtimeChunk option - * @returns {OptimizationRuntimeChunkNormalized=} normalized runtimeChunk option + * harmony module decorator */ -const getNormalizedOptimizationRuntimeChunk = runtimeChunk => { - if (runtimeChunk === undefined) return undefined; - if (runtimeChunk === false) return false; - if (runtimeChunk === "single") { - return { - name: () => "runtime" - }; - } - if (runtimeChunk === true || runtimeChunk === "multiple") { - return { - name: entrypoint => `runtime~${entrypoint.name}` - }; - } - const { name } = runtimeChunk; - return { - name: typeof name === "function" ? name : () => name - }; -}; +exports.harmonyModuleDecorator = "__webpack_require__.hmd"; -exports.getNormalizedWebpackOptions = getNormalizedWebpackOptions; +/** + * node.js module decorator + */ +exports.nodeModuleDecorator = "__webpack_require__.nmd"; +/** + * the webpack hash + */ +exports.getFullHash = "__webpack_require__.h"; -/***/ }), +/** + * an object containing all installed WebAssembly.Instance export objects keyed by module id + */ +exports.wasmInstances = "__webpack_require__.w"; -/***/ 52801: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/** + * instantiate a wasm instance from module exports object, id, hash and importsObject + */ +exports.instantiateWasm = "__webpack_require__.v"; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** + * the uncaught error handler for the webpack runtime + */ +exports.uncaughtErrorHandler = "__webpack_require__.oe"; +/** + * the script nonce + */ +exports.scriptNonce = "__webpack_require__.nc"; +/** + * function to load a script tag. + * Arguments: (url: string, done: (event) => void), key?: string | number, chunkId?: string | number) => void + * done function is called when loading has finished or timeout occurred. + * It will attach to existing script tags with data-webpack == uniqueName + ":" + key or src == url. + */ +exports.loadScript = "__webpack_require__.l"; -const memoize = __webpack_require__(78676); +/** + * function to promote a string to a TrustedScript using webpack's Trusted + * Types policy + * Arguments: (script: string) => TrustedScript + */ +exports.createScript = "__webpack_require__.ts"; -const getBrowserslistTargetHandler = memoize(() => - __webpack_require__(43950) -); +/** + * function to promote a string to a TrustedScriptURL using webpack's Trusted + * Types policy + * Arguments: (url: string) => TrustedScriptURL + */ +exports.createScriptUrl = "__webpack_require__.tu"; /** - * @param {string} context the context directory - * @returns {string} default target + * function to return webpack's Trusted Types policy + * Arguments: () => TrustedTypePolicy */ -const getDefaultTarget = context => { - const browsers = getBrowserslistTargetHandler().load(null, context); - return browsers ? "browserslist" : "web"; -}; +exports.getTrustedTypesPolicy = "__webpack_require__.tt"; /** - * @typedef {Object} PlatformTargetProperties - * @property {boolean | null} web web platform, importing of http(s) and std: is available - * @property {boolean | null} browser browser platform, running in a normal web browser - * @property {boolean | null} webworker (Web)Worker platform, running in a web/shared/service worker - * @property {boolean | null} node node platform, require of node built-in modules is available - * @property {boolean | null} nwjs nwjs platform, require of legacy nw.gui is available - * @property {boolean | null} electron electron platform, require of some electron built-in modules is available + * the chunk name of the chunk with the runtime */ +exports.chunkName = "__webpack_require__.cn"; /** - * @typedef {Object} ElectronContextTargetProperties - * @property {boolean | null} electronMain in main context - * @property {boolean | null} electronPreload in preload context - * @property {boolean | null} electronRenderer in renderer context with node integration + * the runtime id of the current runtime */ +exports.runtimeId = "__webpack_require__.j"; /** - * @typedef {Object} ApiTargetProperties - * @property {boolean | null} require has require function available - * @property {boolean | null} nodeBuiltins has node.js built-in modules available - * @property {boolean | null} document has document available (allows script tags) - * @property {boolean | null} importScripts has importScripts available - * @property {boolean | null} importScriptsInWorker has importScripts available when creating a worker - * @property {boolean | null} fetchWasm has fetch function available for WebAssembly - * @property {boolean | null} global has global variable available + * the filename of the script part of the chunk */ +exports.getChunkScriptFilename = "__webpack_require__.u"; /** - * @typedef {Object} EcmaTargetProperties - * @property {boolean | null} globalThis has globalThis variable available - * @property {boolean | null} bigIntLiteral big int literal syntax is available - * @property {boolean | null} const const and let variable declarations are available - * @property {boolean | null} arrowFunction arrow functions are available - * @property {boolean | null} forOf for of iteration is available - * @property {boolean | null} destructuring destructuring is available - * @property {boolean | null} dynamicImport async import() is available - * @property {boolean | null} dynamicImportInWorker async import() is available when creating a worker - * @property {boolean | null} module ESM syntax is available (when in module) - * @property {boolean | null} optionalChaining optional chaining is available - * @property {boolean | null} templateLiteral template literal is available + * the filename of the css part of the chunk */ +exports.getChunkCssFilename = "__webpack_require__.k"; -///** @typedef {PlatformTargetProperties | ApiTargetProperties | EcmaTargetProperties | PlatformTargetProperties & ApiTargetProperties | PlatformTargetProperties & EcmaTargetProperties | ApiTargetProperties & EcmaTargetProperties} TargetProperties */ -/** @template T @typedef {{ [P in keyof T]?: never }} Never */ -/** @template A @template B @typedef {(A & Never) | (Never & B) | (A & B)} Mix */ -/** @typedef {Mix, Mix>} TargetProperties */ +/** + * a flag when a module/chunk/tree has css modules + */ +exports.hasCssModules = "has css modules"; -const versionDependent = (major, minor) => { - if (!major) return () => /** @type {undefined} */ (undefined); - major = +major; - minor = minor ? +minor : 0; - return (vMajor, vMinor = 0) => { - return major > vMajor || (major === vMajor && minor >= vMinor); - }; -}; +/** + * the filename of the script part of the hot update chunk + */ +exports.getChunkUpdateScriptFilename = "__webpack_require__.hu"; -/** @type {[string, string, RegExp, (...args: string[]) => TargetProperties | false][]} */ -const TARGETS = [ - [ - "browserslist / browserslist:env / browserslist:query / browserslist:path-to-config / browserslist:path-to-config:env", - "Resolve features from browserslist. Will resolve browserslist config automatically. Only browser or node queries are supported (electron is not supported). Examples: 'browserslist:modern' to use 'modern' environment from browserslist config", - /^browserslist(?::(.+))?$/, - (rest, context) => { - const browserslistTargetHandler = getBrowserslistTargetHandler(); - const browsers = browserslistTargetHandler.load( - rest ? rest.trim() : null, - context - ); - if (!browsers) { - throw new Error(`No browserslist config found to handle the 'browserslist' target. -See https://github.com/browserslist/browserslist#queries for possible ways to provide a config. -The recommended way is to add a 'browserslist' key to your package.json and list supported browsers (resp. node.js versions). -You can also more options via the 'target' option: 'browserslist' / 'browserslist:env' / 'browserslist:query' / 'browserslist:path-to-config' / 'browserslist:path-to-config:env'`); - } - return browserslistTargetHandler.resolve(browsers); - } - ], - [ - "web", - "Web browser.", - /^web$/, - () => { - return { - web: true, - browser: true, - webworker: null, - node: false, - electron: false, - nwjs: false, +/** + * the filename of the css part of the hot update chunk + */ +exports.getChunkUpdateCssFilename = "__webpack_require__.hk"; - document: true, - importScriptsInWorker: true, - fetchWasm: true, - nodeBuiltins: false, - importScripts: false, - require: false, - global: false - }; - } - ], - [ - "webworker", - "Web Worker, SharedWorker or Service Worker.", - /^webworker$/, - () => { - return { - web: true, - browser: true, - webworker: true, - node: false, - electron: false, - nwjs: false, +/** + * startup signal from runtime + * This will be called when the runtime chunk has been loaded. + */ +exports.startup = "__webpack_require__.x"; - importScripts: true, - importScriptsInWorker: true, - fetchWasm: true, - nodeBuiltins: false, - require: false, - document: false, - global: false - }; - } - ], - [ - "[async-]node[X[.Y]]", - "Node.js in version X.Y. The 'async-' prefix will load chunks asynchronously via 'fs' and 'vm' instead of 'require()'. Examples: node14.5, async-node10.", - /^(async-)?node(\d+(?:\.(\d+))?)?$/, - (asyncFlag, major, minor) => { - const v = versionDependent(major, minor); - // see https://node.green/ - return { - node: true, - electron: false, - nwjs: false, - web: false, - webworker: false, - browser: false, +/** + * @deprecated + * creating a default startup function with the entry modules + */ +exports.startupNoDefault = "__webpack_require__.x (no default handler)"; - require: !asyncFlag, - nodeBuiltins: true, - global: true, - document: false, - fetchWasm: false, - importScripts: false, - importScriptsInWorker: false, +/** + * startup signal from runtime but only used to add logic after the startup + */ +exports.startupOnlyAfter = "__webpack_require__.x (only after)"; - globalThis: v(12), - const: v(6), - templateLiteral: v(4), - optionalChaining: v(14), - arrowFunction: v(6), - forOf: v(5), - destructuring: v(6), - bigIntLiteral: v(10, 4), - dynamicImport: v(12, 17), - dynamicImportInWorker: major ? false : undefined, - module: v(12, 17) - }; - } - ], - [ - "electron[X[.Y]]-main/preload/renderer", - "Electron in version X.Y. Script is running in main, preload resp. renderer context.", - /^electron(\d+(?:\.(\d+))?)?-(main|preload|renderer)$/, - (major, minor, context) => { - const v = versionDependent(major, minor); - // see https://node.green/ + https://github.com/electron/releases - return { - node: true, - electron: true, - web: context !== "main", - webworker: false, - browser: false, - nwjs: false, +/** + * startup signal from runtime but only used to add sync logic before the startup + */ +exports.startupOnlyBefore = "__webpack_require__.x (only before)"; - electronMain: context === "main", - electronPreload: context === "preload", - electronRenderer: context === "renderer", +/** + * global callback functions for installing chunks + */ +exports.chunkCallback = "webpackChunk"; - global: true, - nodeBuiltins: true, - require: true, - document: context === "renderer", - fetchWasm: context === "renderer", - importScripts: false, - importScriptsInWorker: true, +/** + * method to startup an entrypoint with needed chunks. + * Signature: (moduleId: Id, chunkIds: Id[]) => any. + * Returns the exports of the module or a Promise + */ +exports.startupEntrypoint = "__webpack_require__.X"; - globalThis: v(5), - const: v(1, 1), - templateLiteral: v(1, 1), - optionalChaining: v(8), - arrowFunction: v(1, 1), - forOf: v(0, 36), - destructuring: v(1, 1), - bigIntLiteral: v(4), - dynamicImport: v(11), - dynamicImportInWorker: major ? false : undefined, - module: v(11) - }; - } - ], - [ - "nwjs[X[.Y]] / node-webkit[X[.Y]]", - "NW.js in version X.Y.", - /^(?:nwjs|node-webkit)(\d+(?:\.(\d+))?)?$/, - (major, minor) => { - const v = versionDependent(major, minor); - // see https://node.green/ + https://github.com/nwjs/nw.js/blob/nw48/CHANGELOG.md - return { - node: true, - web: true, - nwjs: true, - webworker: null, - browser: false, - electron: false, +/** + * register deferred code, which will run when certain + * chunks are loaded. + * Signature: (chunkIds: Id[], fn: () => any, priority: int >= 0 = 0) => any + * Returned value will be returned directly when all chunks are already loaded + * When (priority & 1) it will wait for all other handlers with lower priority to + * be executed before itself is executed + */ +exports.onChunksLoaded = "__webpack_require__.O"; - global: true, - nodeBuiltins: true, - document: false, - importScriptsInWorker: false, - fetchWasm: false, - importScripts: false, - require: false, +/** + * method to install a chunk that was loaded somehow + * Signature: ({ id, ids, modules, runtime }) => void + */ +exports.externalInstallChunk = "__webpack_require__.C"; - globalThis: v(0, 43), - const: v(0, 15), - templateLiteral: v(0, 13), - optionalChaining: v(0, 44), - arrowFunction: v(0, 15), - forOf: v(0, 13), - destructuring: v(0, 15), - bigIntLiteral: v(0, 32), - dynamicImport: v(0, 43), - dynamicImportInWorker: major ? false : undefined, - module: v(0, 43) - }; - } - ], - [ - "esX", - "EcmaScript in this version. Examples: es2020, es5.", - /^es(\d+)$/, - version => { - let v = +version; - if (v < 1000) v = v + 2009; - return { - const: v >= 2015, - templateLiteral: v >= 2015, - optionalChaining: v >= 2020, - arrowFunction: v >= 2015, - forOf: v >= 2015, - destructuring: v >= 2015, - module: v >= 2015, - globalThis: v >= 2020, - bigIntLiteral: v >= 2020, - dynamicImport: v >= 2020, - dynamicImportInWorker: v >= 2020 - }; - } - ] -]; +/** + * interceptor for module executions + */ +exports.interceptModuleExecution = "__webpack_require__.i"; /** - * @param {string} target the target - * @param {string} context the context directory - * @returns {TargetProperties} target properties + * the global object */ -const getTargetProperties = (target, context) => { - for (const [, , regExp, handler] of TARGETS) { - const match = regExp.exec(target); - if (match) { - const [, ...args] = match; - const result = handler(...args, context); - if (result) return result; - } - } - throw new Error( - `Unknown target '${target}'. The following targets are supported:\n${TARGETS.map( - ([name, description]) => `* ${name}: ${description}` - ).join("\n")}` - ); -}; +exports.global = "__webpack_require__.g"; -const mergeTargetProperties = targetProperties => { - const keys = new Set(); - for (const tp of targetProperties) { - for (const key of Object.keys(tp)) { - keys.add(key); - } - } - const result = {}; - for (const key of keys) { - let hasTrue = false; - let hasFalse = false; - for (const tp of targetProperties) { - const value = tp[key]; - switch (value) { - case true: - hasTrue = true; - break; - case false: - hasFalse = true; - break; - } - } - if (hasTrue || hasFalse) - result[key] = hasFalse && hasTrue ? null : hasTrue ? true : false; - } - return /** @type {TargetProperties} */ (result); -}; +/** + * an object with all share scopes + */ +exports.shareScopeMap = "__webpack_require__.S"; /** - * @param {string[]} targets the targets - * @param {string} context the context directory - * @returns {TargetProperties} target properties + * The sharing init sequence function (only runs once per share scope). + * Has one argument, the name of the share scope. + * Creates a share scope if not existing */ -const getTargetsProperties = (targets, context) => { - return mergeTargetProperties( - targets.map(t => getTargetProperties(t, context)) - ); -}; +exports.initializeSharing = "__webpack_require__.I"; -exports.getDefaultTarget = getDefaultTarget; -exports.getTargetProperties = getTargetProperties; -exports.getTargetsProperties = getTargetsProperties; +/** + * The current scope when getting a module from a remote + */ +exports.currentRemoteGetScope = "__webpack_require__.R"; +/** + * the filename of the HMR manifest + */ +exports.getUpdateManifestFilename = "__webpack_require__.hmrF"; -/***/ }), +/** + * function downloading the update manifest + */ +exports.hmrDownloadManifest = "__webpack_require__.hmrM"; -/***/ 64813: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * array with handler functions to download chunk updates + */ +exports.hmrDownloadUpdateHandlers = "__webpack_require__.hmrC"; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr -*/ +/** + * object with all hmr module data for all modules + */ +exports.hmrModuleData = "__webpack_require__.hmrD"; +/** + * array with handler functions when a module should be invalidated + */ +exports.hmrInvalidateModuleHandlers = "__webpack_require__.hmrI"; +/** + * the prefix for storing state of runtime modules when hmr is enabled + */ +exports.hmrRuntimeStatePrefix = "__webpack_require__.hmrS"; -const Dependency = __webpack_require__(54912); -const makeSerializable = __webpack_require__(33032); +/** + * the AMD define function + */ +exports.amdDefine = "__webpack_require__.amdD"; -/** @typedef {import("./ContainerEntryModule").ExposeOptions} ExposeOptions */ +/** + * the AMD options + */ +exports.amdOptions = "__webpack_require__.amdO"; -class ContainerEntryDependency extends Dependency { - /** - * @param {string} name entry name - * @param {[string, ExposeOptions][]} exposes list of exposed modules - * @param {string} shareScope name of the share scope - */ - constructor(name, exposes, shareScope) { - super(); - this.name = name; - this.exposes = exposes; - this.shareScope = shareScope; - } +/** + * the System polyfill object + */ +exports.system = "__webpack_require__.System"; - /** - * @returns {string | null} an identifier to merge equal requests - */ - getResourceIdentifier() { - return `container-entry-${this.name}`; - } +/** + * the shorthand for Object.prototype.hasOwnProperty + * using of it decreases the compiled bundle size + */ +exports.hasOwnProperty = "__webpack_require__.o"; - get type() { - return "container entry"; - } +/** + * the System.register context object + */ +exports.systemContext = "__webpack_require__.y"; - get category() { - return "esm"; - } -} +/** + * the baseURI of current document + */ +exports.baseURI = "__webpack_require__.b"; -makeSerializable( - ContainerEntryDependency, - "webpack/lib/container/ContainerEntryDependency" -); +/** + * a RelativeURL class when relative URLs are used + */ +exports.relativeUrl = "__webpack_require__.U"; -module.exports = ContainerEntryDependency; +/** + * Creates an async module. The body function must be a async function. + * "module.exports" will be decorated with an AsyncModulePromise. + * The body function will be called. + * To handle async dependencies correctly do this: "([a, b, c] = await handleDependencies([a, b, c]));". + * If "hasAwaitAfterDependencies" is truthy, "handleDependencies()" must be called at the end of the body function. + * Signature: function( + * module: Module, + * body: (handleDependencies: (deps: AsyncModulePromise[]) => Promise & () => void, + * hasAwaitAfterDependencies?: boolean + * ) => void + */ +exports.asyncModule = "__webpack_require__.a"; /***/ }), -/***/ 80580: +/***/ 16963: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr + Author Tobias Koppers @sokra */ -const { OriginalSource, RawSource } = __webpack_require__(51255); -const AsyncDependenciesBlock = __webpack_require__(47736); +const { RawSource } = __webpack_require__(51255); +const OriginalSource = (__webpack_require__(51255).OriginalSource); const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const StaticExportsDependency = __webpack_require__(91418); -const makeSerializable = __webpack_require__(33032); -const ContainerExposedDependency = __webpack_require__(72374); - -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ -/** @typedef {import("./ContainerEntryDependency")} ContainerEntryDependency */ -/** - * @typedef {Object} ExposeOptions - * @property {string[]} import requests to exposed modules (last one is exported) - * @property {string} name custom chunk name for the exposed module - */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./util/Hash")} Hash */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ -const SOURCE_TYPES = new Set(["javascript"]); +const TYPES = new Set(["runtime"]); -class ContainerEntryModule extends Module { +class RuntimeModule extends Module { /** - * @param {string} name container entry name - * @param {[string, ExposeOptions][]} exposes list of exposed modules - * @param {string} shareScope name of the share scope + * @param {string} name a readable name + * @param {number=} stage an optional stage */ - constructor(name, exposes, shareScope) { - super("javascript/dynamic", null); - this._name = name; - this._exposes = exposes; - this._shareScope = shareScope; + constructor(name, stage = 0) { + super("runtime"); + this.name = name; + this.stage = stage; + this.buildMeta = {}; + this.buildInfo = {}; + /** @type {Compilation} */ + this.compilation = undefined; + /** @type {Chunk} */ + this.chunk = undefined; + /** @type {ChunkGraph} */ + this.chunkGraph = undefined; + this.fullHash = false; + this.dependentHash = false; + /** @type {string} */ + this._cachedGeneratedCode = undefined; } /** - * @returns {Set} types available (do not mutate) + * @param {Compilation} compilation the compilation + * @param {Chunk} chunk the chunk + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {void} */ - getSourceTypes() { - return SOURCE_TYPES; + attach(compilation, chunk, chunkGraph = compilation.chunkGraph) { + this.compilation = compilation; + this.chunk = chunk; + this.chunkGraph = chunkGraph; } /** * @returns {string} a unique identifier of the module */ identifier() { - return `container entry (${this._shareScope}) ${JSON.stringify( - this._exposes - )}`; + return `webpack/runtime/${this.name}`; } /** @@ -66399,17 +60306,7 @@ class ContainerEntryModule extends Module { * @returns {string} a user readable identifier of the module */ readableIdentifier(requestShortener) { - return `container entry`; - } - - /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion - */ - libIdent(options) { - return `${this.layer ? `(${this.layer})/` : ""}webpack/container/entry/${ - this._name - }`; + return `webpack/runtime/${this.name}`; } /** @@ -66418,7 +60315,7 @@ class ContainerEntryModule extends Module { * @returns {void} */ needBuild(context, callback) { - return callback(null, !this.buildMeta); + return callback(null, false); } /** @@ -66430,152 +60327,58 @@ class ContainerEntryModule extends Module { * @returns {void} */ build(options, compilation, resolver, fs, callback) { - this.buildMeta = {}; - this.buildInfo = { - strict: true, - topLevelDeclarations: new Set(["moduleMap", "get", "init"]) - }; - this.buildMeta.exportsType = "namespace"; - - this.clearDependenciesAndBlocks(); - - for (const [name, options] of this._exposes) { - const block = new AsyncDependenciesBlock( - { - name: options.name - }, - { name }, - options.import[options.import.length - 1] - ); - let idx = 0; - for (const request of options.import) { - const dep = new ContainerExposedDependency(name, request); - dep.loc = { - name, - index: idx++ - }; + // do nothing + // should not be called as runtime modules are added later to the compilation + callback(); + } - block.addDependency(dep); + /** + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + hash.update(this.name); + hash.update(`${this.stage}`); + try { + if (this.fullHash || this.dependentHash) { + // Do not use getGeneratedCode here, because i. e. compilation hash might be not + // ready at this point. We will cache it later instead. + hash.update(this.generate()); + } else { + hash.update(this.getGeneratedCode()); } - this.addBlock(block); + } catch (err) { + hash.update(err.message); } - this.addDependency(new StaticExportsDependency(["get", "init"], false)); + super.updateHash(hash, context); + } - callback(); + /** + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + return TYPES; } /** * @param {CodeGenerationContext} context context for code generation * @returns {CodeGenerationResult} result */ - codeGeneration({ moduleGraph, chunkGraph, runtimeTemplate }) { + codeGeneration(context) { const sources = new Map(); - const runtimeRequirements = new Set([ - RuntimeGlobals.definePropertyGetters, - RuntimeGlobals.hasOwnProperty, - RuntimeGlobals.exports - ]); - const getters = []; - - for (const block of this.blocks) { - const { dependencies } = block; - - const modules = dependencies.map(dependency => { - const dep = /** @type {ContainerExposedDependency} */ (dependency); - return { - name: dep.exposedName, - module: moduleGraph.getModule(dep), - request: dep.userRequest - }; - }); - - let str; - - if (modules.some(m => !m.module)) { - str = runtimeTemplate.throwMissingModuleErrorBlock({ - request: modules.map(m => m.request).join(", ") - }); - } else { - str = `return ${runtimeTemplate.blockPromise({ - block, - message: "", - chunkGraph, - runtimeRequirements - })}.then(${runtimeTemplate.returningFunction( - runtimeTemplate.returningFunction( - `(${modules - .map(({ module, request }) => - runtimeTemplate.moduleRaw({ - module, - chunkGraph, - request, - weak: false, - runtimeRequirements - }) - ) - .join(", ")})` - ) - )});`; - } - - getters.push( - `${JSON.stringify(modules[0].name)}: ${runtimeTemplate.basicFunction( - "", - str - )}` + const generatedCode = this.getGeneratedCode(); + if (generatedCode) { + sources.set( + "runtime", + this.useSourceMap || this.useSimpleSourceMap + ? new OriginalSource(generatedCode, this.identifier()) + : new RawSource(generatedCode) ); } - - const source = Template.asString([ - `var moduleMap = {`, - Template.indent(getters.join(",\n")), - "};", - `var get = ${runtimeTemplate.basicFunction("module, getScope", [ - `${RuntimeGlobals.currentRemoteGetScope} = getScope;`, - // reusing the getScope variable to avoid creating a new var (and module is also used later) - "getScope = (", - Template.indent([ - `${RuntimeGlobals.hasOwnProperty}(moduleMap, module)`, - Template.indent([ - "? moduleMap[module]()", - `: Promise.resolve().then(${runtimeTemplate.basicFunction( - "", - "throw new Error('Module \"' + module + '\" does not exist in container.');" - )})` - ]) - ]), - ");", - `${RuntimeGlobals.currentRemoteGetScope} = undefined;`, - "return getScope;" - ])};`, - `var init = ${runtimeTemplate.basicFunction("shareScope, initScope", [ - `if (!${RuntimeGlobals.shareScopeMap}) return;`, - `var name = ${JSON.stringify(this._shareScope)}`, - `var oldScope = ${RuntimeGlobals.shareScopeMap}[name];`, - `if(oldScope && oldScope !== shareScope) throw new Error("Container initialization failed as it has already been initialized with a different share scope");`, - `${RuntimeGlobals.shareScopeMap}[name] = shareScope;`, - `return ${RuntimeGlobals.initializeSharing}(name, initScope);` - ])};`, - "", - "// This exports getters to disallow modifications", - `${RuntimeGlobals.definePropertyGetters}(exports, {`, - Template.indent([ - `get: ${runtimeTemplate.returningFunction("get")},`, - `init: ${runtimeTemplate.returningFunction("init")}` - ]), - "});" - ]); - - sources.set( - "javascript", - this.useSourceMap || this.useSimpleSourceMap - ? new OriginalSource(source, "webpack/container-entry") - : new RawSource(source) - ); - return { sources, - runtimeRequirements + runtimeRequirements: null }; } @@ -66584,394 +60387,520 @@ class ContainerEntryModule extends Module { * @returns {number} the estimated size of the module (must be non-zero) */ size(type) { - return 42; - } - - serialize(context) { - const { write } = context; - write(this._name); - write(this._exposes); - write(this._shareScope); - super.serialize(context); - } - - static deserialize(context) { - const { read } = context; - const obj = new ContainerEntryModule(read(), read(), read()); - obj.deserialize(context); - return obj; - } -} - -makeSerializable( - ContainerEntryModule, - "webpack/lib/container/ContainerEntryModule" -); - -module.exports = ContainerEntryModule; - - -/***/ }), - -/***/ 76398: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr -*/ - - - -const ModuleFactory = __webpack_require__(51010); -const ContainerEntryModule = __webpack_require__(80580); - -/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ -/** @typedef {import("../ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ -/** @typedef {import("./ContainerEntryDependency")} ContainerEntryDependency */ - -module.exports = class ContainerEntryModuleFactory extends ModuleFactory { - /** - * @param {ModuleFactoryCreateData} data data object - * @param {function(Error=, ModuleFactoryResult=): void} callback callback - * @returns {void} - */ - create({ dependencies: [dependency] }, callback) { - const dep = /** @type {ContainerEntryDependency} */ (dependency); - callback(null, { - module: new ContainerEntryModule(dep.name, dep.exposes, dep.shareScope) - }); - } -}; - - -/***/ }), - -/***/ 72374: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr -*/ - - - -const ModuleDependency = __webpack_require__(80321); -const makeSerializable = __webpack_require__(33032); - -class ContainerExposedDependency extends ModuleDependency { - /** - * @param {string} exposedName public name - * @param {string} request request to module - */ - constructor(exposedName, request) { - super(request); - this.exposedName = exposedName; - } - - get type() { - return "container exposed"; - } - - get category() { - return "esm"; - } - - /** - * @returns {string | null} an identifier to merge equal requests - */ - getResourceIdentifier() { - return `exposed dependency ${this.exposedName}=${this.request}`; - } - - serialize(context) { - context.write(this.exposedName); - super.serialize(context); - } - - deserialize(context) { - this.exposedName = context.read(); - super.deserialize(context); - } -} - -makeSerializable( - ContainerExposedDependency, - "webpack/lib/container/ContainerExposedDependency" -); - -module.exports = ContainerExposedDependency; - - -/***/ }), - -/***/ 9244: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr -*/ - - - -const createSchemaValidation = __webpack_require__(32540); -const ContainerEntryDependency = __webpack_require__(64813); -const ContainerEntryModuleFactory = __webpack_require__(76398); -const ContainerExposedDependency = __webpack_require__(72374); -const { parseOptions } = __webpack_require__(3083); - -/** @typedef {import("../../declarations/plugins/container/ContainerPlugin").ContainerPluginOptions} ContainerPluginOptions */ -/** @typedef {import("../Compiler")} Compiler */ - -const validate = createSchemaValidation( - __webpack_require__(9504), - () => __webpack_require__(84899), - { - name: "Container Plugin", - baseDataPath: "options" + try { + const source = this.getGeneratedCode(); + return source ? source.length : 0; + } catch (e) { + return 0; + } } -); - -const PLUGIN_NAME = "ContainerPlugin"; -class ContainerPlugin { + /* istanbul ignore next */ /** - * @param {ContainerPluginOptions} options options + * @abstract + * @returns {string} runtime code */ - constructor(options) { - validate(options); - - this._options = { - name: options.name, - shareScope: options.shareScope || "default", - library: options.library || { - type: "var", - name: options.name - }, - runtime: options.runtime, - filename: options.filename || undefined, - exposes: parseOptions( - options.exposes, - item => ({ - import: Array.isArray(item) ? item : [item], - name: undefined - }), - item => ({ - import: Array.isArray(item.import) ? item.import : [item.import], - name: item.name || undefined - }) - ) - }; + generate() { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @returns {string} runtime code */ - apply(compiler) { - const { name, exposes, shareScope, filename, library, runtime } = - this._options; - - compiler.options.output.enabledLibraryTypes.push(library.type); - - compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => { - const dep = new ContainerEntryDependency(name, exposes, shareScope); - dep.loc = { name }; - compilation.addEntry( - compilation.options.context, - dep, - { - name, - filename, - runtime, - library - }, - error => { - if (error) return callback(error); - callback(); - } - ); - }); - - compiler.hooks.thisCompilation.tap( - PLUGIN_NAME, - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - ContainerEntryDependency, - new ContainerEntryModuleFactory() - ); - - compilation.dependencyFactories.set( - ContainerExposedDependency, - normalModuleFactory - ); - } - ); + getGeneratedCode() { + if (this._cachedGeneratedCode) { + return this._cachedGeneratedCode; + } + return (this._cachedGeneratedCode = this.generate()); + } + + /** + * @returns {boolean} true, if the runtime module should get it's own scope + */ + shouldIsolate() { + return true; } } -module.exports = ContainerPlugin; +/** + * Runtime modules without any dependencies to other runtime modules + */ +RuntimeModule.STAGE_NORMAL = 0; + +/** + * Runtime modules with simple dependencies on other runtime modules + */ +RuntimeModule.STAGE_BASIC = 5; + +/** + * Runtime modules which attach to handlers of other runtime modules + */ +RuntimeModule.STAGE_ATTACH = 10; + +/** + * Runtime modules which trigger actions on bootstrap + */ +RuntimeModule.STAGE_TRIGGER = 20; + +module.exports = RuntimeModule; /***/ }), -/***/ 95757: +/***/ 2307: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy + Author Tobias Koppers @sokra */ -const ExternalsPlugin = __webpack_require__(6652); const RuntimeGlobals = __webpack_require__(16475); -const createSchemaValidation = __webpack_require__(32540); -const FallbackDependency = __webpack_require__(57764); -const FallbackItemDependency = __webpack_require__(29593); -const FallbackModuleFactory = __webpack_require__(4112); -const RemoteModule = __webpack_require__(62916); -const RemoteRuntimeModule = __webpack_require__(88288); -const RemoteToExternalDependency = __webpack_require__(14389); -const { parseOptions } = __webpack_require__(3083); - -/** @typedef {import("../../declarations/plugins/container/ContainerReferencePlugin").ContainerReferencePluginOptions} ContainerReferencePluginOptions */ -/** @typedef {import("../../declarations/plugins/container/ContainerReferencePlugin").RemotesConfig} RemotesConfig */ -/** @typedef {import("../Compiler")} Compiler */ +const { getChunkFilenameTemplate } = __webpack_require__(47283); +const RuntimeRequirementsDependency = __webpack_require__(24187); +const JavascriptModulesPlugin = __webpack_require__(89464); +const AsyncModuleRuntimeModule = __webpack_require__(63672); +const AutoPublicPathRuntimeModule = __webpack_require__(66532); +const CompatGetDefaultExportRuntimeModule = __webpack_require__(44793); +const CompatRuntimeModule = __webpack_require__(88234); +const CreateFakeNamespaceObjectRuntimeModule = __webpack_require__(94669); +const CreateScriptRuntimeModule = __webpack_require__(2759); +const CreateScriptUrlRuntimeModule = __webpack_require__(21213); +const DefinePropertyGettersRuntimeModule = __webpack_require__(75481); +const EnsureChunkRuntimeModule = __webpack_require__(71519); +const GetChunkFilenameRuntimeModule = __webpack_require__(34277); +const GetMainFilenameRuntimeModule = __webpack_require__(10029); +const GetTrustedTypesPolicyRuntimeModule = __webpack_require__(38713); +const GlobalRuntimeModule = __webpack_require__(23255); +const HasOwnPropertyRuntimeModule = __webpack_require__(8011); +const LoadScriptRuntimeModule = __webpack_require__(19942); +const MakeNamespaceObjectRuntimeModule = __webpack_require__(65714); +const OnChunksLoadedRuntimeModule = __webpack_require__(44518); +const PublicPathRuntimeModule = __webpack_require__(56030); +const RelativeUrlRuntimeModule = __webpack_require__(4537); +const RuntimeIdRuntimeModule = __webpack_require__(97115); +const SystemContextRuntimeModule = __webpack_require__(80655); +const ShareRuntimeModule = __webpack_require__(96066); +const StringXor = __webpack_require__(40293); -const validate = createSchemaValidation( - __webpack_require__(95122), - () => - __webpack_require__(66681), - { - name: "Container Reference Plugin", - baseDataPath: "options" - } -); +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Module")} Module */ -const slashCode = "/".charCodeAt(0); +const GLOBALS_ON_REQUIRE = [ + RuntimeGlobals.chunkName, + RuntimeGlobals.runtimeId, + RuntimeGlobals.compatGetDefaultExport, + RuntimeGlobals.createFakeNamespaceObject, + RuntimeGlobals.createScript, + RuntimeGlobals.createScriptUrl, + RuntimeGlobals.getTrustedTypesPolicy, + RuntimeGlobals.definePropertyGetters, + RuntimeGlobals.ensureChunk, + RuntimeGlobals.entryModuleId, + RuntimeGlobals.getFullHash, + RuntimeGlobals.global, + RuntimeGlobals.makeNamespaceObject, + RuntimeGlobals.moduleCache, + RuntimeGlobals.moduleFactories, + RuntimeGlobals.moduleFactoriesAddOnly, + RuntimeGlobals.interceptModuleExecution, + RuntimeGlobals.publicPath, + RuntimeGlobals.baseURI, + RuntimeGlobals.relativeUrl, + RuntimeGlobals.scriptNonce, + RuntimeGlobals.uncaughtErrorHandler, + RuntimeGlobals.asyncModule, + RuntimeGlobals.wasmInstances, + RuntimeGlobals.instantiateWasm, + RuntimeGlobals.shareScopeMap, + RuntimeGlobals.initializeSharing, + RuntimeGlobals.loadScript, + RuntimeGlobals.systemContext, + RuntimeGlobals.onChunksLoaded +]; -class ContainerReferencePlugin { - /** - * @param {ContainerReferencePluginOptions} options options - */ - constructor(options) { - validate(options); +const MODULE_DEPENDENCIES = { + [RuntimeGlobals.moduleLoaded]: [RuntimeGlobals.module], + [RuntimeGlobals.moduleId]: [RuntimeGlobals.module] +}; - this._remoteType = options.remoteType; - this._remotes = parseOptions( - options.remotes, - item => ({ - external: Array.isArray(item) ? item : [item], - shareScope: options.shareScope || "default" - }), - item => ({ - external: Array.isArray(item.external) - ? item.external - : [item.external], - shareScope: item.shareScope || options.shareScope || "default" - }) - ); - } +const TREE_DEPENDENCIES = { + [RuntimeGlobals.definePropertyGetters]: [RuntimeGlobals.hasOwnProperty], + [RuntimeGlobals.compatGetDefaultExport]: [ + RuntimeGlobals.definePropertyGetters + ], + [RuntimeGlobals.createFakeNamespaceObject]: [ + RuntimeGlobals.definePropertyGetters, + RuntimeGlobals.makeNamespaceObject, + RuntimeGlobals.require + ], + [RuntimeGlobals.initializeSharing]: [RuntimeGlobals.shareScopeMap], + [RuntimeGlobals.shareScopeMap]: [RuntimeGlobals.hasOwnProperty] +}; +class RuntimePlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {Compiler} compiler the Compiler * @returns {void} */ apply(compiler) { - const { _remotes: remotes, _remoteType: remoteType } = this; - - /** @type {Record} */ - const remoteExternals = {}; - for (const [key, config] of remotes) { - let i = 0; - for (const external of config.external) { - if (external.startsWith("internal ")) continue; - remoteExternals[ - `webpack/container/reference/${key}${i ? `/fallback-${i}` : ""}` - ] = external; - i++; + compiler.hooks.compilation.tap("RuntimePlugin", compilation => { + compilation.dependencyTemplates.set( + RuntimeRequirementsDependency, + new RuntimeRequirementsDependency.Template() + ); + for (const req of GLOBALS_ON_REQUIRE) { + compilation.hooks.runtimeRequirementInModule + .for(req) + .tap("RuntimePlugin", (module, set) => { + set.add(RuntimeGlobals.requireScope); + }); + compilation.hooks.runtimeRequirementInTree + .for(req) + .tap("RuntimePlugin", (module, set) => { + set.add(RuntimeGlobals.requireScope); + }); } - } - - new ExternalsPlugin(remoteType, remoteExternals).apply(compiler); + for (const req of Object.keys(TREE_DEPENDENCIES)) { + const deps = TREE_DEPENDENCIES[req]; + compilation.hooks.runtimeRequirementInTree + .for(req) + .tap("RuntimePlugin", (chunk, set) => { + for (const dep of deps) set.add(dep); + }); + } + for (const req of Object.keys(MODULE_DEPENDENCIES)) { + const deps = MODULE_DEPENDENCIES[req]; + compilation.hooks.runtimeRequirementInModule + .for(req) + .tap("RuntimePlugin", (chunk, set) => { + for (const dep of deps) set.add(dep); + }); + } + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.definePropertyGetters) + .tap("RuntimePlugin", chunk => { + compilation.addRuntimeModule( + chunk, + new DefinePropertyGettersRuntimeModule() + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.makeNamespaceObject) + .tap("RuntimePlugin", chunk => { + compilation.addRuntimeModule( + chunk, + new MakeNamespaceObjectRuntimeModule() + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.createFakeNamespaceObject) + .tap("RuntimePlugin", chunk => { + compilation.addRuntimeModule( + chunk, + new CreateFakeNamespaceObjectRuntimeModule() + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hasOwnProperty) + .tap("RuntimePlugin", chunk => { + compilation.addRuntimeModule( + chunk, + new HasOwnPropertyRuntimeModule() + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.compatGetDefaultExport) + .tap("RuntimePlugin", chunk => { + compilation.addRuntimeModule( + chunk, + new CompatGetDefaultExportRuntimeModule() + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.runtimeId) + .tap("RuntimePlugin", chunk => { + compilation.addRuntimeModule(chunk, new RuntimeIdRuntimeModule()); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.publicPath) + .tap("RuntimePlugin", (chunk, set) => { + const { outputOptions } = compilation; + const { publicPath: globalPublicPath, scriptType } = outputOptions; + const entryOptions = chunk.getEntryOptions(); + const publicPath = + entryOptions && entryOptions.publicPath !== undefined + ? entryOptions.publicPath + : globalPublicPath; - compiler.hooks.compilation.tap( - "ContainerReferencePlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - RemoteToExternalDependency, - normalModuleFactory - ); + if (publicPath === "auto") { + const module = new AutoPublicPathRuntimeModule(); + if (scriptType !== "module") set.add(RuntimeGlobals.global); + compilation.addRuntimeModule(chunk, module); + } else { + const module = new PublicPathRuntimeModule(publicPath); - compilation.dependencyFactories.set( - FallbackItemDependency, - normalModuleFactory - ); + if ( + typeof publicPath !== "string" || + /\[(full)?hash\]/.test(publicPath) + ) { + module.fullHash = true; + } - compilation.dependencyFactories.set( - FallbackDependency, - new FallbackModuleFactory() - ); + compilation.addRuntimeModule(chunk, module); + } + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.global) + .tap("RuntimePlugin", chunk => { + compilation.addRuntimeModule(chunk, new GlobalRuntimeModule()); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.asyncModule) + .tap("RuntimePlugin", chunk => { + compilation.addRuntimeModule(chunk, new AsyncModuleRuntimeModule()); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.systemContext) + .tap("RuntimePlugin", chunk => { + const { outputOptions } = compilation; + const { library: globalLibrary } = outputOptions; + const entryOptions = chunk.getEntryOptions(); + const libraryType = + entryOptions && entryOptions.library !== undefined + ? entryOptions.library.type + : globalLibrary.type; - normalModuleFactory.hooks.factorize.tap( - "ContainerReferencePlugin", - data => { - if (!data.request.includes("!")) { - for (const [key, config] of remotes) { - if ( - data.request.startsWith(`${key}`) && - (data.request.length === key.length || - data.request.charCodeAt(key.length) === slashCode) - ) { - return new RemoteModule( - data.request, - config.external.map((external, i) => - external.startsWith("internal ") - ? external.slice(9) - : `webpack/container/reference/${key}${ - i ? `/fallback-${i}` : "" - }` - ), - `.${data.request.slice(key.length)}`, - config.shareScope - ); - } - } - } + if (libraryType === "system") { + compilation.addRuntimeModule( + chunk, + new SystemContextRuntimeModule() + ); + } + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.getChunkScriptFilename) + .tap("RuntimePlugin", (chunk, set) => { + if ( + typeof compilation.outputOptions.chunkFilename === "string" && + /\[(full)?hash(:\d+)?\]/.test( + compilation.outputOptions.chunkFilename + ) + ) { + set.add(RuntimeGlobals.getFullHash); + } + compilation.addRuntimeModule( + chunk, + new GetChunkFilenameRuntimeModule( + "javascript", + "javascript", + RuntimeGlobals.getChunkScriptFilename, + chunk => + chunk.filenameTemplate || + (chunk.canBeInitial() + ? compilation.outputOptions.filename + : compilation.outputOptions.chunkFilename), + false + ) + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.getChunkCssFilename) + .tap("RuntimePlugin", (chunk, set) => { + if ( + typeof compilation.outputOptions.cssChunkFilename === "string" && + /\[(full)?hash(:\d+)?\]/.test( + compilation.outputOptions.cssChunkFilename + ) + ) { + set.add(RuntimeGlobals.getFullHash); + } + compilation.addRuntimeModule( + chunk, + new GetChunkFilenameRuntimeModule( + "css", + "css", + RuntimeGlobals.getChunkCssFilename, + chunk => + getChunkFilenameTemplate(chunk, compilation.outputOptions), + set.has(RuntimeGlobals.hmrDownloadUpdateHandlers) + ) + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.getChunkUpdateScriptFilename) + .tap("RuntimePlugin", (chunk, set) => { + if ( + /\[(full)?hash(:\d+)?\]/.test( + compilation.outputOptions.hotUpdateChunkFilename + ) + ) + set.add(RuntimeGlobals.getFullHash); + compilation.addRuntimeModule( + chunk, + new GetChunkFilenameRuntimeModule( + "javascript", + "javascript update", + RuntimeGlobals.getChunkUpdateScriptFilename, + c => compilation.outputOptions.hotUpdateChunkFilename, + true + ) + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.getUpdateManifestFilename) + .tap("RuntimePlugin", (chunk, set) => { + if ( + /\[(full)?hash(:\d+)?\]/.test( + compilation.outputOptions.hotUpdateMainFilename + ) + ) { + set.add(RuntimeGlobals.getFullHash); + } + compilation.addRuntimeModule( + chunk, + new GetMainFilenameRuntimeModule( + "update manifest", + RuntimeGlobals.getUpdateManifestFilename, + compilation.outputOptions.hotUpdateMainFilename + ) + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunk) + .tap("RuntimePlugin", (chunk, set) => { + const hasAsyncChunks = chunk.hasAsyncChunks(); + if (hasAsyncChunks) { + set.add(RuntimeGlobals.ensureChunkHandlers); + } + compilation.addRuntimeModule( + chunk, + new EnsureChunkRuntimeModule(set) + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkIncludeEntries) + .tap("RuntimePlugin", (chunk, set) => { + set.add(RuntimeGlobals.ensureChunkHandlers); + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.shareScopeMap) + .tap("RuntimePlugin", (chunk, set) => { + compilation.addRuntimeModule(chunk, new ShareRuntimeModule()); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.loadScript) + .tap("RuntimePlugin", (chunk, set) => { + const withCreateScriptUrl = !!compilation.outputOptions.trustedTypes; + if (withCreateScriptUrl) { + set.add(RuntimeGlobals.createScriptUrl); + } + compilation.addRuntimeModule( + chunk, + new LoadScriptRuntimeModule(withCreateScriptUrl) + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.createScript) + .tap("RuntimePlugin", (chunk, set) => { + if (compilation.outputOptions.trustedTypes) { + set.add(RuntimeGlobals.getTrustedTypesPolicy); + } + compilation.addRuntimeModule(chunk, new CreateScriptRuntimeModule()); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.createScriptUrl) + .tap("RuntimePlugin", (chunk, set) => { + if (compilation.outputOptions.trustedTypes) { + set.add(RuntimeGlobals.getTrustedTypesPolicy); + } + compilation.addRuntimeModule( + chunk, + new CreateScriptUrlRuntimeModule() + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.getTrustedTypesPolicy) + .tap("RuntimePlugin", (chunk, set) => { + compilation.addRuntimeModule( + chunk, + new GetTrustedTypesPolicyRuntimeModule(set) + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.relativeUrl) + .tap("RuntimePlugin", (chunk, set) => { + compilation.addRuntimeModule(chunk, new RelativeUrlRuntimeModule()); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.onChunksLoaded) + .tap("RuntimePlugin", (chunk, set) => { + compilation.addRuntimeModule( + chunk, + new OnChunksLoadedRuntimeModule() + ); + return true; + }); + // TODO webpack 6: remove CompatRuntimeModule + compilation.hooks.additionalTreeRuntimeRequirements.tap( + "RuntimePlugin", + (chunk, set) => { + const { mainTemplate } = compilation; + if ( + mainTemplate.hooks.bootstrap.isUsed() || + mainTemplate.hooks.localVars.isUsed() || + mainTemplate.hooks.requireEnsure.isUsed() || + mainTemplate.hooks.requireExtensions.isUsed() + ) { + compilation.addRuntimeModule(chunk, new CompatRuntimeModule()); } - ); - - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("ContainerReferencePlugin", (chunk, set) => { - set.add(RuntimeGlobals.module); - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - set.add(RuntimeGlobals.hasOwnProperty); - set.add(RuntimeGlobals.initializeSharing); - set.add(RuntimeGlobals.shareScopeMap); - compilation.addRuntimeModule(chunk, new RemoteRuntimeModule()); - }); - } - ); + } + ); + JavascriptModulesPlugin.getCompilationHooks(compilation).chunkHash.tap( + "RuntimePlugin", + (chunk, hash, { chunkGraph }) => { + const xor = new StringXor(); + for (const m of chunkGraph.getChunkRuntimeModulesIterable(chunk)) { + xor.add(chunkGraph.getModuleHash(m, chunk.runtime)); + } + xor.updateHash(hash); + } + ); + }); } } - -module.exports = ContainerReferencePlugin; +module.exports = RuntimePlugin; /***/ }), -/***/ 57764: +/***/ 18777: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -66982,725 +60911,1045 @@ module.exports = ContainerReferencePlugin; -const Dependency = __webpack_require__(54912); -const makeSerializable = __webpack_require__(33032); +const InitFragment = __webpack_require__(55870); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const { equals } = __webpack_require__(84953); +const compileBooleanMatcher = __webpack_require__(29404); +const propertyAccess = __webpack_require__(54190); +const { forEachRuntime, subtractRuntime } = __webpack_require__(17156); -class FallbackDependency extends Dependency { - constructor(requests) { - super(); - this.requests = requests; - } +/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */ +/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ + +/** + * @param {Module} module the module + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {string} error message + */ +const noModuleIdErrorMessage = (module, chunkGraph) => { + return `Module ${module.identifier()} has no id assigned. +This should not happen. +It's in these chunks: ${ + Array.from( + chunkGraph.getModuleChunksIterable(module), + c => c.name || c.id || c.debugId + ).join(", ") || "none" + } (If module is in no chunk this indicates a bug in some chunk/module optimization logic) +Module has these incoming connections: ${Array.from( + chunkGraph.moduleGraph.getIncomingConnections(module), + connection => + `\n - ${ + connection.originModule && connection.originModule.identifier() + } ${connection.dependency && connection.dependency.type} ${ + (connection.explanations && + Array.from(connection.explanations).join(", ")) || + "" + }` + ).join("")}`; +}; + +/** + * @param {string|undefined} definition global object definition + * @returns {string} save to use global object + */ +function getGlobalObject(definition) { + if (!definition) return definition; + const trimmed = definition.trim(); + + if ( + // identifier, we do not need real identifier regarding ECMAScript/Unicode + trimmed.match(/^[_\p{L}][_0-9\p{L}]*$/iu) || + // iife + // call expression + // expression in parentheses + trimmed.match(/^([_\p{L}][_0-9\p{L}]*)?\(.*\)$/iu) + ) + return trimmed; + + return `Object(${trimmed})`; +} +class RuntimeTemplate { /** - * @returns {string | null} an identifier to merge equal requests + * @param {Compilation} compilation the compilation + * @param {OutputOptions} outputOptions the compilation output options + * @param {RequestShortener} requestShortener the request shortener */ - getResourceIdentifier() { - return `fallback ${this.requests.join(" ")}`; + constructor(compilation, outputOptions, requestShortener) { + this.compilation = compilation; + this.outputOptions = outputOptions || {}; + this.requestShortener = requestShortener; + this.globalObject = getGlobalObject(outputOptions.globalObject); } - get type() { - return "fallback"; + isIIFE() { + return this.outputOptions.iife; } - get category() { - return "esm"; + isModule() { + return this.outputOptions.module; } - serialize(context) { - const { write } = context; - write(this.requests); - super.serialize(context); + supportsConst() { + return this.outputOptions.environment.const; } - static deserialize(context) { - const { read } = context; - const obj = new FallbackDependency(read()); - obj.deserialize(context); - return obj; + supportsArrowFunction() { + return this.outputOptions.environment.arrowFunction; } -} - -makeSerializable( - FallbackDependency, - "webpack/lib/container/FallbackDependency" -); - -module.exports = FallbackDependency; - -/***/ }), + supportsOptionalChaining() { + return this.outputOptions.environment.optionalChaining; + } -/***/ 29593: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + supportsForOf() { + return this.outputOptions.environment.forOf; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + supportsDestructuring() { + return this.outputOptions.environment.destructuring; + } + supportsBigIntLiteral() { + return this.outputOptions.environment.bigIntLiteral; + } + supportsDynamicImport() { + return this.outputOptions.environment.dynamicImport; + } -const ModuleDependency = __webpack_require__(80321); -const makeSerializable = __webpack_require__(33032); + supportsEcmaScriptModuleSyntax() { + return this.outputOptions.environment.module; + } -class FallbackItemDependency extends ModuleDependency { - constructor(request) { - super(request); + supportTemplateLiteral() { + return this.outputOptions.environment.templateLiteral; } - get type() { - return "fallback item"; + returningFunction(returnValue, args = "") { + return this.supportsArrowFunction() + ? `(${args}) => (${returnValue})` + : `function(${args}) { return ${returnValue}; }`; } - get category() { - return "esm"; + basicFunction(args, body) { + return this.supportsArrowFunction() + ? `(${args}) => {\n${Template.indent(body)}\n}` + : `function(${args}) {\n${Template.indent(body)}\n}`; } -} -makeSerializable( - FallbackItemDependency, - "webpack/lib/container/FallbackItemDependency" -); + /** + * @param {Array} args args + * @returns {string} result expression + */ + concatenation(...args) { + const len = args.length; -module.exports = FallbackItemDependency; + if (len === 2) return this._es5Concatenation(args); + if (len === 0) return '""'; + if (len === 1) { + return typeof args[0] === "string" + ? JSON.stringify(args[0]) + : `"" + ${args[0].expr}`; + } + if (!this.supportTemplateLiteral()) return this._es5Concatenation(args); + // cost comparison between template literal and concatenation: + // both need equal surroundings: `xxx` vs "xxx" + // template literal has constant cost of 3 chars for each expression + // es5 concatenation has cost of 3 + n chars for n expressions in row + // when a es5 concatenation ends with an expression it reduces cost by 3 + // when a es5 concatenation starts with an single expression it reduces cost by 3 + // e. g. `${a}${b}${c}` (3*3 = 9) is longer than ""+a+b+c ((3+3)-3 = 3) + // e. g. `x${a}x${b}x${c}x` (3*3 = 9) is shorter than "x"+a+"x"+b+"x"+c+"x" (4+4+4 = 12) -/***/ }), + let templateCost = 0; + let concatenationCost = 0; -/***/ 82886: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + let lastWasExpr = false; + for (const arg of args) { + const isExpr = typeof arg !== "string"; + if (isExpr) { + templateCost += 3; + concatenationCost += lastWasExpr ? 1 : 4; + } + lastWasExpr = isExpr; + } + if (lastWasExpr) concatenationCost -= 3; + if (typeof args[0] !== "string" && typeof args[1] === "string") + concatenationCost -= 3; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy -*/ + if (concatenationCost <= templateCost) return this._es5Concatenation(args); + return `\`${args + .map(arg => (typeof arg === "string" ? arg : `\${${arg.expr}}`)) + .join("")}\``; + } + /** + * @param {Array} args args (len >= 2) + * @returns {string} result expression + * @private + */ + _es5Concatenation(args) { + const str = args + .map(arg => (typeof arg === "string" ? JSON.stringify(arg) : arg.expr)) + .join(" + "); -const { RawSource } = __webpack_require__(51255); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const makeSerializable = __webpack_require__(33032); -const FallbackItemDependency = __webpack_require__(29593); + // when the first two args are expression, we need to prepend "" + to force string + // concatenation instead of number addition. + return typeof args[0] !== "string" && typeof args[1] !== "string" + ? `"" + ${str}` + : str; + } -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ + expressionFunction(expression, args = "") { + return this.supportsArrowFunction() + ? `(${args}) => (${expression})` + : `function(${args}) { ${expression}; }`; + } -const TYPES = new Set(["javascript"]); -const RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]); + emptyFunction() { + return this.supportsArrowFunction() ? "x => {}" : "function() {}"; + } -class FallbackModule extends Module { - /** - * @param {string[]} requests list of requests to choose one - */ - constructor(requests) { - super("fallback-module"); - this.requests = requests; - this._identifier = `fallback ${this.requests.join(" ")}`; + destructureArray(items, value) { + return this.supportsDestructuring() + ? `var [${items.join(", ")}] = ${value};` + : Template.asString( + items.map((item, i) => `var ${item} = ${value}[${i}];`) + ); } - /** - * @returns {string} a unique identifier of the module - */ - identifier() { - return this._identifier; + destructureObject(items, value) { + return this.supportsDestructuring() + ? `var {${items.join(", ")}} = ${value};` + : Template.asString( + items.map(item => `var ${item} = ${value}${propertyAccess([item])};`) + ); } - /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module - */ - readableIdentifier(requestShortener) { - return this._identifier; + iife(args, body) { + return `(${this.basicFunction(args, body)})()`; + } + + forEach(variable, array, body) { + return this.supportsForOf() + ? `for(const ${variable} of ${array}) {\n${Template.indent(body)}\n}` + : `${array}.forEach(function(${variable}) {\n${Template.indent( + body + )}\n});`; } /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion + * Add a comment + * @param {object} options Information content of the comment + * @param {string=} options.request request string used originally + * @param {string=} options.chunkName name of the chunk referenced + * @param {string=} options.chunkReason reason information of the chunk + * @param {string=} options.message additional message + * @param {string=} options.exportName name of the export + * @returns {string} comment */ - libIdent(options) { - return `${this.layer ? `(${this.layer})/` : ""}webpack/container/fallback/${ - this.requests[0] - }/and ${this.requests.length - 1} more`; + comment({ request, chunkName, chunkReason, message, exportName }) { + let content; + if (this.outputOptions.pathinfo) { + content = [message, request, chunkName, chunkReason] + .filter(Boolean) + .map(item => this.requestShortener.shorten(item)) + .join(" | "); + } else { + content = [message, chunkName, chunkReason] + .filter(Boolean) + .map(item => this.requestShortener.shorten(item)) + .join(" | "); + } + if (!content) return ""; + if (this.outputOptions.pathinfo) { + return Template.toComment(content) + " "; + } else { + return Template.toNormalComment(content) + " "; + } } /** - * @param {Chunk} chunk the chunk which condition should be checked - * @param {Compilation} compilation the compilation - * @returns {boolean} true, if the chunk is ok for the module + * @param {object} options generation options + * @param {string=} options.request request string used originally + * @returns {string} generated error block */ - chunkCondition(chunk, { chunkGraph }) { - return chunkGraph.getNumberOfEntryModules(chunk) > 0; + throwMissingModuleErrorBlock({ request }) { + const err = `Cannot find module '${request}'`; + return `var e = new Error(${JSON.stringify( + err + )}); e.code = 'MODULE_NOT_FOUND'; throw e;`; } /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} + * @param {object} options generation options + * @param {string=} options.request request string used originally + * @returns {string} generated error function */ - needBuild(context, callback) { - callback(null, !this.buildInfo); + throwMissingModuleErrorFunction({ request }) { + return `function webpackMissingModule() { ${this.throwMissingModuleErrorBlock( + { request } + )} }`; } /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} + * @param {object} options generation options + * @param {string=} options.request request string used originally + * @returns {string} generated error IIFE */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = {}; - this.buildInfo = { - strict: true - }; - - this.clearDependenciesAndBlocks(); - for (const request of this.requests) - this.addDependency(new FallbackItemDependency(request)); - - callback(); + missingModule({ request }) { + return `Object(${this.throwMissingModuleErrorFunction({ request })}())`; } /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) + * @param {object} options generation options + * @param {string=} options.request request string used originally + * @returns {string} generated error statement */ - size(type) { - return this.requests.length * 5 + 42; + missingModuleStatement({ request }) { + return `${this.missingModule({ request })};\n`; } /** - * @returns {Set} types available (do not mutate) + * @param {object} options generation options + * @param {string=} options.request request string used originally + * @returns {string} generated error code */ - getSourceTypes() { - return TYPES; + missingModulePromise({ request }) { + return `Promise.resolve().then(${this.throwMissingModuleErrorFunction({ + request + })})`; } /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result + * @param {Object} options options object + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {Module} options.module the module + * @param {string} options.request the request that should be printed as comment + * @param {string=} options.idExpr expression to use as id expression + * @param {"expression" | "promise" | "statements"} options.type which kind of code should be returned + * @returns {string} the code */ - codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { - const ids = this.dependencies.map(dep => - chunkGraph.getModuleId(moduleGraph.getModule(dep)) - ); - const code = Template.asString([ - `var ids = ${JSON.stringify(ids)};`, - "var error, result, i = 0;", - `var loop = ${runtimeTemplate.basicFunction("next", [ - "while(i < ids.length) {", - Template.indent([ - "try { next = __webpack_require__(ids[i++]); } catch(e) { return handleError(e); }", - "if(next) return next.then ? next.then(handleResult, handleError) : handleResult(next);" - ]), - "}", - "if(error) throw error;" - ])}`, - `var handleResult = ${runtimeTemplate.basicFunction("result", [ - "if(result) return result;", - "return loop();" - ])};`, - `var handleError = ${runtimeTemplate.basicFunction("e", [ - "error = e;", - "return loop();" - ])};`, - "module.exports = loop();" - ]); - const sources = new Map(); - sources.set("javascript", new RawSource(code)); - return { sources, runtimeRequirements: RUNTIME_REQUIREMENTS }; + weakError({ module, chunkGraph, request, idExpr, type }) { + const moduleId = chunkGraph.getModuleId(module); + const errorMessage = + moduleId === null + ? JSON.stringify("Module is not available (weak dependency)") + : idExpr + ? `"Module '" + ${idExpr} + "' is not available (weak dependency)"` + : JSON.stringify( + `Module '${moduleId}' is not available (weak dependency)` + ); + const comment = request ? Template.toNormalComment(request) + " " : ""; + const errorStatements = + `var e = new Error(${errorMessage}); ` + + comment + + "e.code = 'MODULE_NOT_FOUND'; throw e;"; + switch (type) { + case "statements": + return errorStatements; + case "promise": + return `Promise.resolve().then(${this.basicFunction( + "", + errorStatements + )})`; + case "expression": + return this.iife("", errorStatements); + } } - serialize(context) { - const { write } = context; - write(this.requests); - super.serialize(context); + /** + * @param {Object} options options object + * @param {Module} options.module the module + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {string} options.request the request that should be printed as comment + * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) + * @returns {string} the expression + */ + moduleId({ module, chunkGraph, request, weak }) { + if (!module) { + return this.missingModule({ + request + }); + } + const moduleId = chunkGraph.getModuleId(module); + if (moduleId === null) { + if (weak) { + return "null /* weak dependency, without id */"; + } + throw new Error( + `RuntimeTemplate.moduleId(): ${noModuleIdErrorMessage( + module, + chunkGraph + )}` + ); + } + return `${this.comment({ request })}${JSON.stringify(moduleId)}`; } - static deserialize(context) { - const { read } = context; - const obj = new FallbackModule(read()); - obj.deserialize(context); - return obj; + /** + * @param {Object} options options object + * @param {Module} options.module the module + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {string} options.request the request that should be printed as comment + * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @returns {string} the expression + */ + moduleRaw({ module, chunkGraph, request, weak, runtimeRequirements }) { + if (!module) { + return this.missingModule({ + request + }); + } + const moduleId = chunkGraph.getModuleId(module); + if (moduleId === null) { + if (weak) { + // only weak referenced modules don't get an id + // we can always emit an error emitting code here + return this.weakError({ + module, + chunkGraph, + request, + type: "expression" + }); + } + throw new Error( + `RuntimeTemplate.moduleId(): ${noModuleIdErrorMessage( + module, + chunkGraph + )}` + ); + } + runtimeRequirements.add(RuntimeGlobals.require); + return `__webpack_require__(${this.moduleId({ + module, + chunkGraph, + request, + weak + })})`; } -} - -makeSerializable(FallbackModule, "webpack/lib/container/FallbackModule"); - -module.exports = FallbackModule; - - -/***/ }), - -/***/ 4112: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr -*/ - - - -const ModuleFactory = __webpack_require__(51010); -const FallbackModule = __webpack_require__(82886); - -/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ -/** @typedef {import("../ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ -/** @typedef {import("./FallbackDependency")} FallbackDependency */ - -module.exports = class FallbackModuleFactory extends ModuleFactory { /** - * @param {ModuleFactoryCreateData} data data object - * @param {function(Error=, ModuleFactoryResult=): void} callback callback - * @returns {void} + * @param {Object} options options object + * @param {Module} options.module the module + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {string} options.request the request that should be printed as comment + * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @returns {string} the expression */ - create({ dependencies: [dependency] }, callback) { - const dep = /** @type {FallbackDependency} */ (dependency); - callback(null, { - module: new FallbackModule(dep.requests) + moduleExports({ module, chunkGraph, request, weak, runtimeRequirements }) { + return this.moduleRaw({ + module, + chunkGraph, + request, + weak, + runtimeRequirements }); } -}; - - -/***/ }), - -/***/ 30569: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy -*/ - - - -const isValidExternalsType = __webpack_require__(62142); -const SharePlugin = __webpack_require__(26335); -const createSchemaValidation = __webpack_require__(32540); -const ContainerPlugin = __webpack_require__(9244); -const ContainerReferencePlugin = __webpack_require__(95757); - -/** @typedef {import("../../declarations/plugins/container/ModuleFederationPlugin").ExternalsType} ExternalsType */ -/** @typedef {import("../../declarations/plugins/container/ModuleFederationPlugin").ModuleFederationPluginOptions} ModuleFederationPluginOptions */ -/** @typedef {import("../../declarations/plugins/container/ModuleFederationPlugin").Shared} Shared */ -/** @typedef {import("../Compiler")} Compiler */ -const validate = createSchemaValidation( - __webpack_require__(7467), - () => __webpack_require__(82601), - { - name: "Module Federation Plugin", - baseDataPath: "options" - } -); -class ModuleFederationPlugin { /** - * @param {ModuleFederationPluginOptions} options options + * @param {Object} options options object + * @param {Module} options.module the module + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {string} options.request the request that should be printed as comment + * @param {boolean=} options.strict if the current module is in strict esm mode + * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @returns {string} the expression */ - constructor(options) { - validate(options); - - this._options = options; + moduleNamespace({ + module, + chunkGraph, + request, + strict, + weak, + runtimeRequirements + }) { + if (!module) { + return this.missingModule({ + request + }); + } + if (chunkGraph.getModuleId(module) === null) { + if (weak) { + // only weak referenced modules don't get an id + // we can always emit an error emitting code here + return this.weakError({ + module, + chunkGraph, + request, + type: "expression" + }); + } + throw new Error( + `RuntimeTemplate.moduleNamespace(): ${noModuleIdErrorMessage( + module, + chunkGraph + )}` + ); + } + const moduleId = this.moduleId({ + module, + chunkGraph, + request, + weak + }); + const exportsType = module.getExportsType(chunkGraph.moduleGraph, strict); + switch (exportsType) { + case "namespace": + return this.moduleRaw({ + module, + chunkGraph, + request, + weak, + runtimeRequirements + }); + case "default-with-named": + runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); + return `${RuntimeGlobals.createFakeNamespaceObject}(${moduleId}, 3)`; + case "default-only": + runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); + return `${RuntimeGlobals.createFakeNamespaceObject}(${moduleId}, 1)`; + case "dynamic": + runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); + return `${RuntimeGlobals.createFakeNamespaceObject}(${moduleId}, 7)`; + } } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {Object} options options object + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {AsyncDependenciesBlock=} options.block the current dependencies block + * @param {Module} options.module the module + * @param {string} options.request the request that should be printed as comment + * @param {string} options.message a message for the comment + * @param {boolean=} options.strict if the current module is in strict esm mode + * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @returns {string} the promise expression */ - apply(compiler) { - const { _options: options } = this; - const library = options.library || { type: "var", name: options.name }; - const remoteType = - options.remoteType || - (options.library && isValidExternalsType(options.library.type) - ? /** @type {ExternalsType} */ (options.library.type) - : "script"); - if ( - library && - !compiler.options.output.enabledLibraryTypes.includes(library.type) - ) { - compiler.options.output.enabledLibraryTypes.push(library.type); + moduleNamespacePromise({ + chunkGraph, + block, + module, + request, + message, + strict, + weak, + runtimeRequirements + }) { + if (!module) { + return this.missingModulePromise({ + request + }); } - compiler.hooks.afterPlugins.tap("ModuleFederationPlugin", () => { - if ( - options.exposes && - (Array.isArray(options.exposes) - ? options.exposes.length > 0 - : Object.keys(options.exposes).length > 0) - ) { - new ContainerPlugin({ - name: options.name, - library, - filename: options.filename, - runtime: options.runtime, - exposes: options.exposes - }).apply(compiler); - } - if ( - options.remotes && - (Array.isArray(options.remotes) - ? options.remotes.length > 0 - : Object.keys(options.remotes).length > 0) - ) { - new ContainerReferencePlugin({ - remoteType, - remotes: options.remotes - }).apply(compiler); - } - if (options.shared) { - new SharePlugin({ - shared: options.shared, - shareScope: options.shareScope - }).apply(compiler); + const moduleId = chunkGraph.getModuleId(module); + if (moduleId === null) { + if (weak) { + // only weak referenced modules don't get an id + // we can always emit an error emitting code here + return this.weakError({ + module, + chunkGraph, + request, + type: "promise" + }); } + throw new Error( + `RuntimeTemplate.moduleNamespacePromise(): ${noModuleIdErrorMessage( + module, + chunkGraph + )}` + ); + } + const promise = this.blockPromise({ + chunkGraph, + block, + message, + runtimeRequirements }); - } -} - -module.exports = ModuleFederationPlugin; - - -/***/ }), - -/***/ 62916: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy -*/ - - - -const { RawSource } = __webpack_require__(51255); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); -const FallbackDependency = __webpack_require__(57764); -const RemoteToExternalDependency = __webpack_require__(14389); - -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ -const TYPES = new Set(["remote", "share-init"]); -const RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]); + let appending; + let idExpr = JSON.stringify(chunkGraph.getModuleId(module)); + const comment = this.comment({ + request + }); + let header = ""; + if (weak) { + if (idExpr.length > 8) { + // 'var x="nnnnnn";x,"+x+",x' vs '"nnnnnn",nnnnnn,"nnnnnn"' + header += `var id = ${idExpr}; `; + idExpr = "id"; + } + runtimeRequirements.add(RuntimeGlobals.moduleFactories); + header += `if(!${ + RuntimeGlobals.moduleFactories + }[${idExpr}]) { ${this.weakError({ + module, + chunkGraph, + request, + idExpr, + type: "statements" + })} } `; + } + const moduleIdExpr = this.moduleId({ + module, + chunkGraph, + request, + weak + }); + const exportsType = module.getExportsType(chunkGraph.moduleGraph, strict); + let fakeType = 16; + switch (exportsType) { + case "namespace": + if (header) { + const rawModule = this.moduleRaw({ + module, + chunkGraph, + request, + weak, + runtimeRequirements + }); + appending = `.then(${this.basicFunction( + "", + `${header}return ${rawModule};` + )})`; + } else { + runtimeRequirements.add(RuntimeGlobals.require); + appending = `.then(__webpack_require__.bind(__webpack_require__, ${comment}${idExpr}))`; + } + break; + case "dynamic": + fakeType |= 4; + /* fall through */ + case "default-with-named": + fakeType |= 2; + /* fall through */ + case "default-only": + runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); + if (chunkGraph.moduleGraph.isAsync(module)) { + if (header) { + const rawModule = this.moduleRaw({ + module, + chunkGraph, + request, + weak, + runtimeRequirements + }); + appending = `.then(${this.basicFunction( + "", + `${header}return ${rawModule};` + )})`; + } else { + runtimeRequirements.add(RuntimeGlobals.require); + appending = `.then(__webpack_require__.bind(__webpack_require__, ${comment}${idExpr}))`; + } + appending += `.then(${this.returningFunction( + `${RuntimeGlobals.createFakeNamespaceObject}(m, ${fakeType})`, + "m" + )})`; + } else { + fakeType |= 1; + if (header) { + const returnExpression = `${RuntimeGlobals.createFakeNamespaceObject}(${moduleIdExpr}, ${fakeType})`; + appending = `.then(${this.basicFunction( + "", + `${header}return ${returnExpression};` + )})`; + } else { + appending = `.then(${RuntimeGlobals.createFakeNamespaceObject}.bind(__webpack_require__, ${comment}${idExpr}, ${fakeType}))`; + } + } + break; + } -class RemoteModule extends Module { - /** - * @param {string} request request string - * @param {string[]} externalRequests list of external requests to containers - * @param {string} internalRequest name of exposed module in container - * @param {string} shareScope the used share scope name - */ - constructor(request, externalRequests, internalRequest, shareScope) { - super("remote-module"); - this.request = request; - this.externalRequests = externalRequests; - this.internalRequest = internalRequest; - this.shareScope = shareScope; - this._identifier = `remote (${shareScope}) ${this.externalRequests.join( - " " - )} ${this.internalRequest}`; + return `${promise || "Promise.resolve()"}${appending}`; } /** - * @returns {string} a unique identifier of the module + * @param {Object} options options object + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {RuntimeSpec=} options.runtime runtime for which this code will be generated + * @param {RuntimeSpec | boolean=} options.runtimeCondition only execute the statement in some runtimes + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @returns {string} expression */ - identifier() { - return this._identifier; + runtimeConditionExpression({ + chunkGraph, + runtimeCondition, + runtime, + runtimeRequirements + }) { + if (runtimeCondition === undefined) return "true"; + if (typeof runtimeCondition === "boolean") return `${runtimeCondition}`; + /** @type {Set} */ + const positiveRuntimeIds = new Set(); + forEachRuntime(runtimeCondition, runtime => + positiveRuntimeIds.add(`${chunkGraph.getRuntimeId(runtime)}`) + ); + /** @type {Set} */ + const negativeRuntimeIds = new Set(); + forEachRuntime(subtractRuntime(runtime, runtimeCondition), runtime => + negativeRuntimeIds.add(`${chunkGraph.getRuntimeId(runtime)}`) + ); + runtimeRequirements.add(RuntimeGlobals.runtimeId); + return compileBooleanMatcher.fromLists( + Array.from(positiveRuntimeIds), + Array.from(negativeRuntimeIds) + )(RuntimeGlobals.runtimeId); } /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module + * + * @param {Object} options options object + * @param {boolean=} options.update whether a new variable should be created or the existing one updated + * @param {Module} options.module the module + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {string} options.request the request that should be printed as comment + * @param {string} options.importVar name of the import variable + * @param {Module} options.originModule module in which the statement is emitted + * @param {boolean=} options.weak true, if this is a weak dependency + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @returns {[string, string]} the import statement and the compat statement */ - readableIdentifier(requestShortener) { - return `remote ${this.request}`; - } + importStatement({ + update, + module, + chunkGraph, + request, + importVar, + originModule, + weak, + runtimeRequirements + }) { + if (!module) { + return [ + this.missingModuleStatement({ + request + }), + "" + ]; + } + if (chunkGraph.getModuleId(module) === null) { + if (weak) { + // only weak referenced modules don't get an id + // we can always emit an error emitting code here + return [ + this.weakError({ + module, + chunkGraph, + request, + type: "statements" + }), + "" + ]; + } + throw new Error( + `RuntimeTemplate.importStatement(): ${noModuleIdErrorMessage( + module, + chunkGraph + )}` + ); + } + const moduleId = this.moduleId({ + module, + chunkGraph, + request, + weak + }); + const optDeclaration = update ? "" : "var "; - /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion - */ - libIdent(options) { - return `${this.layer ? `(${this.layer})/` : ""}webpack/container/remote/${ - this.request - }`; - } + const exportsType = module.getExportsType( + chunkGraph.moduleGraph, + originModule.buildMeta.strictHarmonyModule + ); + runtimeRequirements.add(RuntimeGlobals.require); + const importContent = `/* harmony import */ ${optDeclaration}${importVar} = __webpack_require__(${moduleId});\n`; - /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} - */ - needBuild(context, callback) { - callback(null, !this.buildInfo); + if (exportsType === "dynamic") { + runtimeRequirements.add(RuntimeGlobals.compatGetDefaultExport); + return [ + importContent, + `/* harmony import */ ${optDeclaration}${importVar}_default = /*#__PURE__*/${RuntimeGlobals.compatGetDefaultExport}(${importVar});\n` + ]; + } + return [importContent, ""]; } /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} + * @param {Object} options options + * @param {ModuleGraph} options.moduleGraph the module graph + * @param {Module} options.module the module + * @param {string} options.request the request + * @param {string | string[]} options.exportName the export name + * @param {Module} options.originModule the origin module + * @param {boolean|undefined} options.asiSafe true, if location is safe for ASI, a bracket can be emitted + * @param {boolean} options.isCall true, if expression will be called + * @param {boolean} options.callContext when false, call context will not be preserved + * @param {boolean} options.defaultInterop when true and accessing the default exports, interop code will be generated + * @param {string} options.importVar the identifier name of the import variable + * @param {InitFragment[]} options.initFragments init fragments will be added here + * @param {RuntimeSpec} options.runtime runtime for which this code will be generated + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @returns {string} expression */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = {}; - this.buildInfo = { - strict: true - }; + exportFromImport({ + moduleGraph, + module, + request, + exportName, + originModule, + asiSafe, + isCall, + callContext, + defaultInterop, + importVar, + initFragments, + runtime, + runtimeRequirements + }) { + if (!module) { + return this.missingModule({ + request + }); + } + if (!Array.isArray(exportName)) { + exportName = exportName ? [exportName] : []; + } + const exportsType = module.getExportsType( + moduleGraph, + originModule.buildMeta.strictHarmonyModule + ); - this.clearDependenciesAndBlocks(); - if (this.externalRequests.length === 1) { - this.addDependency( - new RemoteToExternalDependency(this.externalRequests[0]) - ); - } else { - this.addDependency(new FallbackDependency(this.externalRequests)); + if (defaultInterop) { + if (exportName.length > 0 && exportName[0] === "default") { + switch (exportsType) { + case "dynamic": + if (isCall) { + return `${importVar}_default()${propertyAccess(exportName, 1)}`; + } else { + return asiSafe + ? `(${importVar}_default()${propertyAccess(exportName, 1)})` + : asiSafe === false + ? `;(${importVar}_default()${propertyAccess(exportName, 1)})` + : `${importVar}_default.a${propertyAccess(exportName, 1)}`; + } + case "default-only": + case "default-with-named": + exportName = exportName.slice(1); + break; + } + } else if (exportName.length > 0) { + if (exportsType === "default-only") { + return ( + "/* non-default import from non-esm module */undefined" + + propertyAccess(exportName, 1) + ); + } else if ( + exportsType !== "namespace" && + exportName[0] === "__esModule" + ) { + return "/* __esModule */true"; + } + } else if ( + exportsType === "default-only" || + exportsType === "default-with-named" + ) { + runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); + initFragments.push( + new InitFragment( + `var ${importVar}_namespace_cache;\n`, + InitFragment.STAGE_CONSTANTS, + -1, + `${importVar}_namespace_cache` + ) + ); + return `/*#__PURE__*/ ${ + asiSafe ? "" : asiSafe === false ? ";" : "Object" + }(${importVar}_namespace_cache || (${importVar}_namespace_cache = ${ + RuntimeGlobals.createFakeNamespaceObject + }(${importVar}${exportsType === "default-only" ? "" : ", 2"})))`; + } } - callback(); + if (exportName.length > 0) { + const exportsInfo = moduleGraph.getExportsInfo(module); + const used = exportsInfo.getUsedName(exportName, runtime); + if (!used) { + const comment = Template.toNormalComment( + `unused export ${propertyAccess(exportName)}` + ); + return `${comment} undefined`; + } + const comment = equals(used, exportName) + ? "" + : Template.toNormalComment(propertyAccess(exportName)) + " "; + const access = `${importVar}${comment}${propertyAccess(used)}`; + if (isCall && callContext === false) { + return asiSafe + ? `(0,${access})` + : asiSafe === false + ? `;(0,${access})` + : `/*#__PURE__*/Object(${access})`; + } + return access; + } else { + return importVar; + } } /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) + * @param {Object} options options + * @param {AsyncDependenciesBlock} options.block the async block + * @param {string} options.message the message + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @returns {string} expression */ - size(type) { - return 6; + blockPromise({ block, message, chunkGraph, runtimeRequirements }) { + if (!block) { + const comment = this.comment({ + message + }); + return `Promise.resolve(${comment.trim()})`; + } + const chunkGroup = chunkGraph.getBlockChunkGroup(block); + if (!chunkGroup || chunkGroup.chunks.length === 0) { + const comment = this.comment({ + message + }); + return `Promise.resolve(${comment.trim()})`; + } + const chunks = chunkGroup.chunks.filter( + chunk => !chunk.hasRuntime() && chunk.id !== null + ); + const comment = this.comment({ + message, + chunkName: block.chunkName + }); + if (chunks.length === 1) { + const chunkId = JSON.stringify(chunks[0].id); + runtimeRequirements.add(RuntimeGlobals.ensureChunk); + return `${RuntimeGlobals.ensureChunk}(${comment}${chunkId})`; + } else if (chunks.length > 0) { + runtimeRequirements.add(RuntimeGlobals.ensureChunk); + const requireChunkId = chunk => + `${RuntimeGlobals.ensureChunk}(${JSON.stringify(chunk.id)})`; + return `Promise.all(${comment.trim()}[${chunks + .map(requireChunkId) + .join(", ")}])`; + } else { + return `Promise.resolve(${comment.trim()})`; + } } /** - * @returns {Set} types available (do not mutate) + * @param {Object} options options + * @param {AsyncDependenciesBlock} options.block the async block + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @param {string=} options.request request string used originally + * @returns {string} expression */ - getSourceTypes() { - return TYPES; + asyncModuleFactory({ block, chunkGraph, runtimeRequirements, request }) { + const dep = block.dependencies[0]; + const module = chunkGraph.moduleGraph.getModule(dep); + const ensureChunk = this.blockPromise({ + block, + message: "", + chunkGraph, + runtimeRequirements + }); + const factory = this.returningFunction( + this.moduleRaw({ + module, + chunkGraph, + request, + runtimeRequirements + }) + ); + return this.returningFunction( + ensureChunk.startsWith("Promise.resolve(") + ? `${factory}` + : `${ensureChunk}.then(${this.returningFunction(factory)})` + ); } /** - * @returns {string | null} absolute path which should be used for condition matching (usually the resource path) + * @param {Object} options options + * @param {Dependency} options.dependency the dependency + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @param {string=} options.request request string used originally + * @returns {string} expression */ - nameForCondition() { - return this.request; + syncModuleFactory({ dependency, chunkGraph, runtimeRequirements, request }) { + const module = chunkGraph.moduleGraph.getModule(dependency); + const factory = this.returningFunction( + this.moduleRaw({ + module, + chunkGraph, + request, + runtimeRequirements + }) + ); + return this.returningFunction(factory); } /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result + * @param {Object} options options + * @param {string} options.exportsArgument the name of the exports object + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @returns {string} statement */ - codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { - const module = moduleGraph.getModule(this.dependencies[0]); - const id = module && chunkGraph.getModuleId(module); - const sources = new Map(); - sources.set("remote", new RawSource("")); - const data = new Map(); - data.set("share-init", [ - { - shareScope: this.shareScope, - initStage: 20, - init: id === undefined ? "" : `initExternal(${JSON.stringify(id)});` - } - ]); - return { sources, data, runtimeRequirements: RUNTIME_REQUIREMENTS }; - } - - serialize(context) { - const { write } = context; - write(this.request); - write(this.externalRequests); - write(this.internalRequest); - write(this.shareScope); - super.serialize(context); - } - - static deserialize(context) { - const { read } = context; - const obj = new RemoteModule(read(), read(), read(), read()); - obj.deserialize(context); - return obj; - } -} - -makeSerializable(RemoteModule, "webpack/lib/container/RemoteModule"); - -module.exports = RemoteModule; - - -/***/ }), - -/***/ 88288: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); - -/** @typedef {import("./RemoteModule")} RemoteModule */ - -class RemoteRuntimeModule extends RuntimeModule { - constructor() { - super("remotes loading"); + defineEsModuleFlagStatement({ exportsArgument, runtimeRequirements }) { + runtimeRequirements.add(RuntimeGlobals.makeNamespaceObject); + runtimeRequirements.add(RuntimeGlobals.exports); + return `${RuntimeGlobals.makeNamespaceObject}(${exportsArgument});\n`; } /** - * @returns {string} runtime code + * @param {Object} options options object + * @param {Module} options.module the module + * @param {string} options.publicPath the public path + * @param {RuntimeSpec=} options.runtime runtime + * @param {CodeGenerationResults} options.codeGenerationResults the code generation results + * @returns {string} the url of the asset */ - generate() { - const { compilation, chunkGraph } = this; - const { runtimeTemplate, moduleGraph } = compilation; - const chunkToRemotesMapping = {}; - const idToExternalAndNameMapping = {}; - for (const chunk of this.chunk.getAllAsyncChunks()) { - const modules = chunkGraph.getChunkModulesIterableBySourceType( - chunk, - "remote" - ); - if (!modules) continue; - const remotes = (chunkToRemotesMapping[chunk.id] = []); - for (const m of modules) { - const module = /** @type {RemoteModule} */ (m); - const name = module.internalRequest; - const id = chunkGraph.getModuleId(module); - const shareScope = module.shareScope; - const dep = module.dependencies[0]; - const externalModule = moduleGraph.getModule(dep); - const externalModuleId = - externalModule && chunkGraph.getModuleId(externalModule); - remotes.push(id); - idToExternalAndNameMapping[id] = [shareScope, name, externalModuleId]; - } + assetUrl({ publicPath, runtime, module, codeGenerationResults }) { + if (!module) { + return "data:,"; } - return Template.asString([ - `var chunkMapping = ${JSON.stringify( - chunkToRemotesMapping, - null, - "\t" - )};`, - `var idToExternalAndNameMapping = ${JSON.stringify( - idToExternalAndNameMapping, - null, - "\t" - )};`, - `${ - RuntimeGlobals.ensureChunkHandlers - }.remotes = ${runtimeTemplate.basicFunction("chunkId, promises", [ - `if(${RuntimeGlobals.hasOwnProperty}(chunkMapping, chunkId)) {`, - Template.indent([ - `chunkMapping[chunkId].forEach(${runtimeTemplate.basicFunction("id", [ - `var getScope = ${RuntimeGlobals.currentRemoteGetScope};`, - "if(!getScope) getScope = [];", - "var data = idToExternalAndNameMapping[id];", - "if(getScope.indexOf(data) >= 0) return;", - "getScope.push(data);", - `if(data.p) return promises.push(data.p);`, - `var onError = ${runtimeTemplate.basicFunction("error", [ - 'if(!error) error = new Error("Container missing");', - 'if(typeof error.message === "string")', - Template.indent( - `error.message += '\\nwhile loading "' + data[1] + '" from ' + data[2];` - ), - `__webpack_modules__[id] = ${runtimeTemplate.basicFunction("", [ - "throw error;" - ])}`, - "data.p = 0;" - ])};`, - `var handleFunction = ${runtimeTemplate.basicFunction( - "fn, arg1, arg2, d, next, first", - [ - "try {", - Template.indent([ - "var promise = fn(arg1, arg2);", - "if(promise && promise.then) {", - Template.indent([ - `var p = promise.then(${runtimeTemplate.returningFunction( - "next(result, d)", - "result" - )}, onError);`, - `if(first) promises.push(data.p = p); else return p;` - ]), - "} else {", - Template.indent(["return next(promise, d, first);"]), - "}" - ]), - "} catch(error) {", - Template.indent(["onError(error);"]), - "}" - ] - )}`, - `var onExternal = ${runtimeTemplate.returningFunction( - `external ? handleFunction(${RuntimeGlobals.initializeSharing}, data[0], 0, external, onInitialized, first) : onError()`, - "external, _, first" - )};`, - `var onInitialized = ${runtimeTemplate.returningFunction( - `handleFunction(external.get, data[1], getScope, 0, onFactory, first)`, - "_, external, first" - )};`, - `var onFactory = ${runtimeTemplate.basicFunction("factory", [ - "data.p = 1;", - `__webpack_modules__[id] = ${runtimeTemplate.basicFunction( - "module", - ["module.exports = factory();"] - )}` - ])};`, - "handleFunction(__webpack_require__, data[2], 0, 0, onExternal, 1);" - ])});` - ]), - "}" - ])}` - ]); + const codeGen = codeGenerationResults.get(module, runtime); + const { data } = codeGen; + const url = data.get("url"); + if (url) return url.toString(); + const filename = data.get("filename"); + return publicPath + filename; } } -module.exports = RemoteRuntimeModule; +module.exports = RuntimeTemplate; /***/ }), -/***/ 14389: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 63560: +/***/ (function(module) { "use strict"; /* @@ -67710,398 +61959,710 @@ module.exports = RemoteRuntimeModule; -const ModuleDependency = __webpack_require__(80321); -const makeSerializable = __webpack_require__(33032); - -class RemoteToExternalDependency extends ModuleDependency { - constructor(request) { - super(request); - } - - get type() { - return "remote to external"; +class SelfModuleFactory { + constructor(moduleGraph) { + this.moduleGraph = moduleGraph; } - get category() { - return "esm"; + create(data, callback) { + const module = this.moduleGraph.getParentModule(data.dependencies[0]); + callback(null, { + module + }); } } -makeSerializable( - RemoteToExternalDependency, - "webpack/lib/container/RemoteToExternalDependency" -); +module.exports = SelfModuleFactory; + + +/***/ }), + +/***/ 48076: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Sean Larkin @thelarkinn +*/ -module.exports = RemoteToExternalDependency; + + +module.exports = __webpack_require__(96953); /***/ }), -/***/ 3083: +/***/ 71070: /***/ (function(__unused_webpack_module, exports) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Sean Larkin @thelarkinn */ -/** @template T @typedef {(string | Record)[] | Record} ContainerOptionsFormat */ - /** - * @template T - * @template N - * @param {ContainerOptionsFormat} options options passed by the user - * @param {function(string | string[], string) : N} normalizeSimple normalize a simple item - * @param {function(T, string) : N} normalizeOptions normalize a complex item - * @param {function(string, N): void} fn processing function - * @returns {void} + * @param {number} size the size in bytes + * @returns {string} the formatted size */ -const process = (options, normalizeSimple, normalizeOptions, fn) => { - const array = items => { - for (const item of items) { - if (typeof item === "string") { - fn(item, normalizeSimple(item, item)); - } else if (item && typeof item === "object") { - object(item); - } else { - throw new Error("Unexpected options format"); - } - } - }; - const object = obj => { - for (const [key, value] of Object.entries(obj)) { - if (typeof value === "string" || Array.isArray(value)) { - fn(key, normalizeSimple(value, key)); - } else { - fn(key, normalizeOptions(value, key)); - } - } - }; - if (!options) { - return; - } else if (Array.isArray(options)) { - array(options); - } else if (typeof options === "object") { - object(options); - } else { - throw new Error("Unexpected options format"); +exports.formatSize = size => { + if (typeof size !== "number" || Number.isNaN(size) === true) { + return "unknown size"; } -}; -/** - * @template T - * @template R - * @param {ContainerOptionsFormat} options options passed by the user - * @param {function(string | string[], string) : R} normalizeSimple normalize a simple item - * @param {function(T, string) : R} normalizeOptions normalize a complex item - * @returns {[string, R][]} parsed options - */ -const parseOptions = (options, normalizeSimple, normalizeOptions) => { - /** @type {[string, R][]} */ - const items = []; - process(options, normalizeSimple, normalizeOptions, (key, value) => { - items.push([key, value]); - }); - return items; -}; + if (size <= 0) { + return "0 bytes"; + } -/** - * @template T - * @param {string} scope scope name - * @param {ContainerOptionsFormat} options options passed by the user - * @returns {Record} options to spread or pass - */ -const scope = (scope, options) => { - /** @type {Record} */ - const obj = {}; - process( - options, - item => /** @type {string | string[] | T} */ (item), - item => /** @type {string | string[] | T} */ (item), - (key, value) => { - obj[ - key.startsWith("./") ? `${scope}${key.slice(1)}` : `${scope}/${key}` - ] = value; - } - ); - return obj; -}; + const abbreviations = ["bytes", "KiB", "MiB", "GiB"]; + const index = Math.floor(Math.log(size) / Math.log(1024)); -exports.parseOptions = parseOptions; -exports.scope = scope; + return `${+(size / Math.pow(1024, index)).toPrecision(3)} ${ + abbreviations[index] + }`; +}; /***/ }), -/***/ 91254: +/***/ 97513: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Sergey Melyukov @smelukov + Author Tobias Koppers @sokra */ -const { ReplaceSource, RawSource, ConcatSource } = __webpack_require__(51255); -const { UsageState } = __webpack_require__(63686); -const Generator = __webpack_require__(93401); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../Generator").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ -/** @typedef {import("../NormalModule")} NormalModule */ -/** @typedef {import("../util/Hash")} Hash */ +const JavascriptModulesPlugin = __webpack_require__(89464); -const TYPES = new Set(["javascript"]); +/** @typedef {import("./Compilation")} Compilation */ -class CssExportsGenerator extends Generator { - constructor() { - super(); +class SourceMapDevToolModuleOptionsPlugin { + constructor(options) { + this.options = options; } - // TODO add getConcatenationBailoutReason to allow concatenation - // but how to make it have a module id - /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code + * @param {Compilation} compilation the compiler instance + * @returns {void} */ - generate(module, generateContext) { - const source = new ReplaceSource(new RawSource("")); - const initFragments = []; - const cssExports = new Map(); + apply(compilation) { + const options = this.options; + if (options.module !== false) { + compilation.hooks.buildModule.tap( + "SourceMapDevToolModuleOptionsPlugin", + module => { + module.useSourceMap = true; + } + ); + compilation.hooks.runtimeModule.tap( + "SourceMapDevToolModuleOptionsPlugin", + module => { + module.useSourceMap = true; + } + ); + } else { + compilation.hooks.buildModule.tap( + "SourceMapDevToolModuleOptionsPlugin", + module => { + module.useSimpleSourceMap = true; + } + ); + compilation.hooks.runtimeModule.tap( + "SourceMapDevToolModuleOptionsPlugin", + module => { + module.useSimpleSourceMap = true; + } + ); + } + JavascriptModulesPlugin.getCompilationHooks(compilation).useSourceMap.tap( + "SourceMapDevToolModuleOptionsPlugin", + () => true + ); + } +} - generateContext.runtimeRequirements.add(RuntimeGlobals.module); +module.exports = SourceMapDevToolModuleOptionsPlugin; - const runtimeRequirements = new Set(); - const templateContext = { - runtimeTemplate: generateContext.runtimeTemplate, - dependencyTemplates: generateContext.dependencyTemplates, - moduleGraph: generateContext.moduleGraph, - chunkGraph: generateContext.chunkGraph, - module, - runtime: generateContext.runtime, - runtimeRequirements: runtimeRequirements, - concatenationScope: generateContext.concatenationScope, - codeGenerationResults: generateContext.codeGenerationResults, - initFragments, - cssExports - }; +/***/ }), - const handleDependency = dependency => { - const constructor = /** @type {new (...args: any[]) => Dependency} */ ( - dependency.constructor - ); - const template = generateContext.dependencyTemplates.get(constructor); - if (!template) { - throw new Error( - "No template for dependency: " + dependency.constructor.name - ); - } +/***/ 63872: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - template.apply(dependency, source, templateContext); - }; - module.dependencies.forEach(handleDependency); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (generateContext.concatenationScope) { - const source = new ConcatSource(); - const usedIdentifiers = new Set(); - for (const [k, v] of cssExports) { - let identifier = Template.toIdentifier(k); - let i = 0; - while (usedIdentifiers.has(identifier)) { - identifier = Template.toIdentifier(k + i); - } - usedIdentifiers.add(identifier); - generateContext.concatenationScope.registerExport(k, identifier); - source.add( - `${ - generateContext.runtimeTemplate.supportsConst ? "const" : "var" - } ${identifier} = ${JSON.stringify(v)};\n` - ); - } - return source; - } else { - const otherUsed = - generateContext.moduleGraph - .getExportsInfo(module) - .otherExportsInfo.getUsed(generateContext.runtime) !== - UsageState.Unused; - if (otherUsed) { - generateContext.runtimeRequirements.add( - RuntimeGlobals.makeNamespaceObject - ); - } - return new RawSource( - `${otherUsed ? `${RuntimeGlobals.makeNamespaceObject}(` : ""}${ - module.moduleArgument - }.exports = {\n${Array.from( - cssExports, - ([k, v]) => `\t${JSON.stringify(k)}: ${JSON.stringify(v)}` - ).join(",\n")}\n}${otherUsed ? ")" : ""};` - ); - } + + +const asyncLib = __webpack_require__(78175); +const { ConcatSource, RawSource } = __webpack_require__(51255); +const Compilation = __webpack_require__(85720); +const ModuleFilenameHelpers = __webpack_require__(88821); +const ProgressPlugin = __webpack_require__(13216); +const SourceMapDevToolModuleOptionsPlugin = __webpack_require__(97513); +const createSchemaValidation = __webpack_require__(32540); +const createHash = __webpack_require__(49835); +const { relative, dirname } = __webpack_require__(17139); +const { makePathsAbsolute } = __webpack_require__(82186); + +/** @typedef {import("webpack-sources").MapOptions} MapOptions */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */ +/** @typedef {import("./Cache").Etag} Etag */ +/** @typedef {import("./CacheFacade").ItemCacheFacade} ItemCacheFacade */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./NormalModule").SourceMap} SourceMap */ +/** @typedef {import("./util/Hash")} Hash */ + +const validate = createSchemaValidation( + __webpack_require__(2885), + () => __webpack_require__(30501), + { + name: "SourceMap DevTool Plugin", + baseDataPath: "options" } +); +/** + * @typedef {object} SourceMapTask + * @property {Source} asset + * @property {AssetInfo} assetInfo + * @property {(string | Module)[]} modules + * @property {string} source + * @property {string} file + * @property {SourceMap} sourceMap + * @property {ItemCacheFacade} cacheItem cache item + */ + +/** + * Escapes regular expression metacharacters + * @param {string} str String to quote + * @returns {string} Escaped string + */ +const quoteMeta = str => { + return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); +}; +/** + * Creating {@link SourceMapTask} for given file + * @param {string} file current compiled file + * @param {Source} asset the asset + * @param {AssetInfo} assetInfo the asset info + * @param {MapOptions} options source map options + * @param {Compilation} compilation compilation instance + * @param {ItemCacheFacade} cacheItem cache item + * @returns {SourceMapTask | undefined} created task instance or `undefined` + */ +const getTaskForFile = ( + file, + asset, + assetInfo, + options, + compilation, + cacheItem +) => { + let source; + /** @type {SourceMap} */ + let sourceMap; /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) + * Check if asset can build source map */ - getTypes(module) { - return TYPES; + if (asset.sourceAndMap) { + const sourceAndMap = asset.sourceAndMap(options); + sourceMap = /** @type {SourceMap} */ (sourceAndMap.map); + source = sourceAndMap.source; + } else { + sourceMap = /** @type {SourceMap} */ (asset.map(options)); + source = asset.source(); } + if (!sourceMap || typeof source !== "string") return; + const context = compilation.options.context; + const root = compilation.compiler.root; + const cachedAbsolutify = makePathsAbsolute.bindContextCache(context, root); + const modules = sourceMap.sources.map(source => { + if (!source.startsWith("webpack://")) return source; + source = cachedAbsolutify(source.slice(10)); + const module = compilation.findModule(source); + return module || source; + }); + return { + file, + asset, + source, + assetInfo, + sourceMap, + modules, + cacheItem + }; +}; + +class SourceMapDevToolPlugin { /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module + * @param {SourceMapDevToolPluginOptions} [options] options object + * @throws {Error} throws error, if got more than 1 arguments */ - getSize(module, type) { - return 42; + constructor(options = {}) { + validate(options); + + /** @type {string | false} */ + this.sourceMapFilename = options.filename; + /** @type {string | false} */ + this.sourceMappingURLComment = + options.append === false + ? false + : options.append || "\n//# source" + "MappingURL=[url]"; + /** @type {string | Function} */ + this.moduleFilenameTemplate = + options.moduleFilenameTemplate || "webpack://[namespace]/[resourcePath]"; + /** @type {string | Function} */ + this.fallbackModuleFilenameTemplate = + options.fallbackModuleFilenameTemplate || + "webpack://[namespace]/[resourcePath]?[hash]"; + /** @type {string} */ + this.namespace = options.namespace || ""; + /** @type {SourceMapDevToolPluginOptions} */ + this.options = options; } /** - * @param {Hash} hash hash that will be modified - * @param {UpdateHashContext} updateHashContext context for updating hash + * Apply the plugin + * @param {Compiler} compiler compiler instance + * @returns {void} */ - updateHash(hash, { module }) {} -} + apply(compiler) { + const outputFs = compiler.outputFileSystem; + const sourceMapFilename = this.sourceMapFilename; + const sourceMappingURLComment = this.sourceMappingURLComment; + const moduleFilenameTemplate = this.moduleFilenameTemplate; + const namespace = this.namespace; + const fallbackModuleFilenameTemplate = this.fallbackModuleFilenameTemplate; + const requestShortener = compiler.requestShortener; + const options = this.options; + options.test = options.test || /\.((c|m)?js|css)($|\?)/i; + + const matchObject = ModuleFilenameHelpers.matchObject.bind( + undefined, + options + ); + + compiler.hooks.compilation.tap("SourceMapDevToolPlugin", compilation => { + new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation); + + compilation.hooks.processAssets.tapAsync( + { + name: "SourceMapDevToolPlugin", + stage: Compilation.PROCESS_ASSETS_STAGE_DEV_TOOLING, + additionalAssets: true + }, + (assets, callback) => { + const chunkGraph = compilation.chunkGraph; + const cache = compilation.getCache("SourceMapDevToolPlugin"); + /** @type {Map} */ + const moduleToSourceNameMapping = new Map(); + /** + * @type {Function} + * @returns {void} + */ + const reportProgress = + ProgressPlugin.getReporter(compilation.compiler) || (() => {}); + + /** @type {Map} */ + const fileToChunk = new Map(); + for (const chunk of compilation.chunks) { + for (const file of chunk.files) { + fileToChunk.set(file, chunk); + } + for (const file of chunk.auxiliaryFiles) { + fileToChunk.set(file, chunk); + } + } + + /** @type {string[]} */ + const files = []; + for (const file of Object.keys(assets)) { + if (matchObject(file)) { + files.push(file); + } + } + + reportProgress(0.0); + /** @type {SourceMapTask[]} */ + const tasks = []; + let fileIndex = 0; + + asyncLib.each( + files, + (file, callback) => { + const asset = compilation.getAsset(file); + if (asset.info.related && asset.info.related.sourceMap) { + fileIndex++; + return callback(); + } + const cacheItem = cache.getItemCache( + file, + cache.mergeEtags( + cache.getLazyHashedEtag(asset.source), + namespace + ) + ); + + cacheItem.get((err, cacheEntry) => { + if (err) { + return callback(err); + } + /** + * If presented in cache, reassigns assets. Cache assets already have source maps. + */ + if (cacheEntry) { + const { assets, assetsInfo } = cacheEntry; + for (const cachedFile of Object.keys(assets)) { + if (cachedFile === file) { + compilation.updateAsset( + cachedFile, + assets[cachedFile], + assetsInfo[cachedFile] + ); + } else { + compilation.emitAsset( + cachedFile, + assets[cachedFile], + assetsInfo[cachedFile] + ); + } + /** + * Add file to chunk, if not presented there + */ + if (cachedFile !== file) { + const chunk = fileToChunk.get(file); + if (chunk !== undefined) + chunk.auxiliaryFiles.add(cachedFile); + } + } -module.exports = CssExportsGenerator; + reportProgress( + (0.5 * ++fileIndex) / files.length, + file, + "restored cached SourceMap" + ); + return callback(); + } -/***/ }), + reportProgress( + (0.5 * fileIndex) / files.length, + file, + "generate SourceMap" + ); -/***/ 46061: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** @type {SourceMapTask | undefined} */ + const task = getTaskForFile( + file, + asset.source, + asset.info, + { + module: options.module, + columns: options.columns + }, + compilation, + cacheItem + ); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sergey Melyukov @smelukov -*/ + if (task) { + const modules = task.modules; + for (let idx = 0; idx < modules.length; idx++) { + const module = modules[idx]; + if (!moduleToSourceNameMapping.get(module)) { + moduleToSourceNameMapping.set( + module, + ModuleFilenameHelpers.createFilename( + module, + { + moduleFilenameTemplate: moduleFilenameTemplate, + namespace: namespace + }, + { + requestShortener, + chunkGraph, + hashFunction: compilation.outputOptions.hashFunction + } + ) + ); + } + } + tasks.push(task); + } -const { ReplaceSource } = __webpack_require__(51255); -const Generator = __webpack_require__(93401); -const InitFragment = __webpack_require__(55870); -const RuntimeGlobals = __webpack_require__(16475); + reportProgress( + (0.5 * ++fileIndex) / files.length, + file, + "generated SourceMap" + ); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../Generator").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../NormalModule")} NormalModule */ -/** @typedef {import("../util/Hash")} Hash */ + callback(); + }); + }, + err => { + if (err) { + return callback(err); + } -const TYPES = new Set(["css"]); + reportProgress(0.5, "resolve sources"); + /** @type {Set} */ + const usedNamesSet = new Set(moduleToSourceNameMapping.values()); + /** @type {Set} */ + const conflictDetectionSet = new Set(); -class CssGenerator extends Generator { - constructor() { - super(); - } + /** + * all modules in defined order (longest identifier first) + * @type {Array} + */ + const allModules = Array.from( + moduleToSourceNameMapping.keys() + ).sort((a, b) => { + const ai = typeof a === "string" ? a : a.identifier(); + const bi = typeof b === "string" ? b : b.identifier(); + return ai.length - bi.length; + }); - /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code - */ - generate(module, generateContext) { - const originalSource = module.originalSource(); - const source = new ReplaceSource(originalSource); - const initFragments = []; - const cssExports = new Map(); + // find modules with conflicting source names + for (let idx = 0; idx < allModules.length; idx++) { + const module = allModules[idx]; + let sourceName = moduleToSourceNameMapping.get(module); + let hasName = conflictDetectionSet.has(sourceName); + if (!hasName) { + conflictDetectionSet.add(sourceName); + continue; + } - generateContext.runtimeRequirements.add(RuntimeGlobals.hasCssModules); + // try the fallback name first + sourceName = ModuleFilenameHelpers.createFilename( + module, + { + moduleFilenameTemplate: fallbackModuleFilenameTemplate, + namespace: namespace + }, + { + requestShortener, + chunkGraph, + hashFunction: compilation.outputOptions.hashFunction + } + ); + hasName = usedNamesSet.has(sourceName); + if (!hasName) { + moduleToSourceNameMapping.set(module, sourceName); + usedNamesSet.add(sourceName); + continue; + } - const templateContext = { - runtimeTemplate: generateContext.runtimeTemplate, - dependencyTemplates: generateContext.dependencyTemplates, - moduleGraph: generateContext.moduleGraph, - chunkGraph: generateContext.chunkGraph, - module, - runtime: generateContext.runtime, - runtimeRequirements: generateContext.runtimeRequirements, - concatenationScope: generateContext.concatenationScope, - codeGenerationResults: generateContext.codeGenerationResults, - initFragments, - cssExports - }; + // otherwise just append stars until we have a valid name + while (hasName) { + sourceName += "*"; + hasName = usedNamesSet.has(sourceName); + } + moduleToSourceNameMapping.set(module, sourceName); + usedNamesSet.add(sourceName); + } - const handleDependency = dependency => { - const constructor = /** @type {new (...args: any[]) => Dependency} */ ( - dependency.constructor - ); - const template = generateContext.dependencyTemplates.get(constructor); - if (!template) { - throw new Error( - "No template for dependency: " + dependency.constructor.name - ); - } + let taskIndex = 0; - template.apply(dependency, source, templateContext); - }; - module.dependencies.forEach(handleDependency); - if (module.presentationalDependencies !== undefined) - module.presentationalDependencies.forEach(handleDependency); + asyncLib.each( + tasks, + (task, callback) => { + const assets = Object.create(null); + const assetsInfo = Object.create(null); + const file = task.file; + const chunk = fileToChunk.get(file); + const sourceMap = task.sourceMap; + const source = task.source; + const modules = task.modules; - if (cssExports.size > 0) { - const data = generateContext.getData(); - data.set("css-exports", cssExports); - } + reportProgress( + 0.5 + (0.5 * taskIndex) / tasks.length, + file, + "attach SourceMap" + ); - return InitFragment.addToSource(source, initFragments, generateContext); - } + const moduleFilenames = modules.map(m => + moduleToSourceNameMapping.get(m) + ); + sourceMap.sources = moduleFilenames; + if (options.noSources) { + sourceMap.sourcesContent = undefined; + } + sourceMap.sourceRoot = options.sourceRoot || ""; + sourceMap.file = file; + const usesContentHash = + sourceMapFilename && + /\[contenthash(:\w+)?\]/.test(sourceMapFilename); - /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) - */ - getTypes(module) { - return TYPES; - } + // If SourceMap and asset uses contenthash, avoid a circular dependency by hiding hash in `file` + if (usesContentHash && task.assetInfo.contenthash) { + const contenthash = task.assetInfo.contenthash; + let pattern; + if (Array.isArray(contenthash)) { + pattern = contenthash.map(quoteMeta).join("|"); + } else { + pattern = quoteMeta(contenthash); + } + sourceMap.file = sourceMap.file.replace( + new RegExp(pattern, "g"), + m => "x".repeat(m.length) + ); + } - /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module - */ - getSize(module, type) { - const originalSource = module.originalSource(); + /** @type {string | false} */ + let currentSourceMappingURLComment = sourceMappingURLComment; + if ( + currentSourceMappingURLComment !== false && + /\.css($|\?)/i.test(file) + ) { + currentSourceMappingURLComment = + currentSourceMappingURLComment.replace( + /^\n\/\/(.*)$/, + "\n/*$1*/" + ); + } + const sourceMapString = JSON.stringify(sourceMap); + if (sourceMapFilename) { + let filename = file; + const sourceMapContentHash = + usesContentHash && + /** @type {string} */ ( + createHash(compilation.outputOptions.hashFunction) + .update(sourceMapString) + .digest("hex") + ); + const pathParams = { + chunk, + filename: options.fileContext + ? relative( + outputFs, + `/${options.fileContext}`, + `/${filename}` + ) + : filename, + contentHash: sourceMapContentHash + }; + const { path: sourceMapFile, info: sourceMapInfo } = + compilation.getPathWithInfo( + sourceMapFilename, + pathParams + ); + const sourceMapUrl = options.publicPath + ? options.publicPath + sourceMapFile + : relative( + outputFs, + dirname(outputFs, `/${file}`), + `/${sourceMapFile}` + ); + /** @type {Source} */ + let asset = new RawSource(source); + if (currentSourceMappingURLComment !== false) { + // Add source map url to compilation asset, if currentSourceMappingURLComment is set + asset = new ConcatSource( + asset, + compilation.getPath( + currentSourceMappingURLComment, + Object.assign({ url: sourceMapUrl }, pathParams) + ) + ); + } + const assetInfo = { + related: { sourceMap: sourceMapFile } + }; + assets[file] = asset; + assetsInfo[file] = assetInfo; + compilation.updateAsset(file, asset, assetInfo); + // Add source map file to compilation assets and chunk files + const sourceMapAsset = new RawSource(sourceMapString); + const sourceMapAssetInfo = { + ...sourceMapInfo, + development: true + }; + assets[sourceMapFile] = sourceMapAsset; + assetsInfo[sourceMapFile] = sourceMapAssetInfo; + compilation.emitAsset( + sourceMapFile, + sourceMapAsset, + sourceMapAssetInfo + ); + if (chunk !== undefined) + chunk.auxiliaryFiles.add(sourceMapFile); + } else { + if (currentSourceMappingURLComment === false) { + throw new Error( + "SourceMapDevToolPlugin: append can't be false when no filename is provided" + ); + } + /** + * Add source map as data url to asset + */ + const asset = new ConcatSource( + new RawSource(source), + currentSourceMappingURLComment + .replace(/\[map\]/g, () => sourceMapString) + .replace( + /\[url\]/g, + () => + `data:application/json;charset=utf-8;base64,${Buffer.from( + sourceMapString, + "utf-8" + ).toString("base64")}` + ) + ); + assets[file] = asset; + assetsInfo[file] = undefined; + compilation.updateAsset(file, asset); + } - if (!originalSource) { - return 0; - } + task.cacheItem.store({ assets, assetsInfo }, err => { + reportProgress( + 0.5 + (0.5 * ++taskIndex) / tasks.length, + task.file, + "attached SourceMap" + ); - return originalSource.size(); + if (err) { + return callback(err); + } + callback(); + }); + }, + err => { + reportProgress(1.0); + callback(err); + } + ); + } + ); + } + ); + }); } - - /** - * @param {Hash} hash hash that will be modified - * @param {UpdateHashContext} updateHashContext context for updating hash - */ - updateHash(hash, { module }) {} } -module.exports = CssGenerator; +module.exports = SourceMapDevToolPlugin; /***/ }), -/***/ 80806: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 31743: +/***/ (function(module) { "use strict"; /* @@ -68111,444 +62672,88 @@ module.exports = CssGenerator; -const { SyncWaterfallHook } = __webpack_require__(6967); -const Compilation = __webpack_require__(85720); -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); -const compileBooleanMatcher = __webpack_require__(29404); -const { chunkHasCss } = __webpack_require__(47283); - -/** @typedef {import("../Chunk")} Chunk */ - -/** - * @typedef {Object} JsonpCompilationPluginHooks - * @property {SyncWaterfallHook<[string, Chunk]>} createStylesheet - */ - -/** @type {WeakMap} */ -const compilationHooksMap = new WeakMap(); +/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */ -class CssLoadingRuntimeModule extends RuntimeModule { +class Stats { /** - * @param {Compilation} compilation the compilation - * @returns {JsonpCompilationPluginHooks} hooks + * @param {Compilation} compilation webpack compilation */ - static getCompilationHooks(compilation) { - if (!(compilation instanceof Compilation)) { - throw new TypeError( - "The 'compilation' argument must be an instance of Compilation" - ); - } - let hooks = compilationHooksMap.get(compilation); - if (hooks === undefined) { - hooks = { - createStylesheet: new SyncWaterfallHook(["source", "chunk"]) - }; - compilationHooksMap.set(compilation, hooks); - } - return hooks; + constructor(compilation) { + this.compilation = compilation; } - constructor(runtimeRequirements, runtimeOptions) { - super("css loading", 10); + get hash() { + return this.compilation.hash; + } - this._runtimeRequirements = runtimeRequirements; - this.runtimeOptions = runtimeOptions; + get startTime() { + return this.compilation.startTime; + } + + get endTime() { + return this.compilation.endTime; } /** - * @returns {string} runtime code + * @returns {boolean} true if the compilation had a warning */ - generate() { - const { compilation, chunk, _runtimeRequirements } = this; - const { - chunkGraph, - runtimeTemplate, - outputOptions: { - crossOriginLoading, - uniqueName, - chunkLoadTimeout: loadTimeout - } - } = compilation; - const fn = RuntimeGlobals.ensureChunkHandlers; - const conditionMap = chunkGraph.getChunkConditionMap( - chunk, - (chunk, chunkGraph) => - !!chunkGraph.getChunkModulesIterableBySourceType(chunk, "css") + hasWarnings() { + return ( + this.compilation.warnings.length > 0 || + this.compilation.children.some(child => child.getStats().hasWarnings()) ); - const hasCssMatcher = compileBooleanMatcher(conditionMap); + } - const withLoading = - _runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers) && - hasCssMatcher !== false; - const withHmr = _runtimeRequirements.has( - RuntimeGlobals.hmrDownloadUpdateHandlers + /** + * @returns {boolean} true if the compilation encountered an error + */ + hasErrors() { + return ( + this.compilation.errors.length > 0 || + this.compilation.children.some(child => child.getStats().hasErrors()) ); - const initialChunkIdsWithCss = new Set(); - const initialChunkIdsWithoutCss = new Set(); - for (const c of chunk.getAllInitialChunks()) { - (chunkHasCss(c, chunkGraph) - ? initialChunkIdsWithCss - : initialChunkIdsWithoutCss - ).add(c.id); - } + } - if (!withLoading && !withHmr && initialChunkIdsWithCss.size === 0) { - return null; - } + /** + * @param {(string|StatsOptions)=} options stats options + * @returns {StatsCompilation} json output + */ + toJson(options) { + options = this.compilation.createStatsOptions(options, { + forToString: false + }); - const { createStylesheet } = - CssLoadingRuntimeModule.getCompilationHooks(compilation); + const statsFactory = this.compilation.createStatsFactory(options); - const stateExpression = withHmr - ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_css` - : undefined; + return statsFactory.create("compilation", this.compilation, { + compilation: this.compilation + }); + } - const code = Template.asString([ - "link = document.createElement('link');", - uniqueName - ? 'link.setAttribute("data-webpack", uniqueName + ":" + key);' - : "", - "link.setAttribute(loadingAttribute, 1);", - 'link.rel = "stylesheet";', - "link.href = url;", - crossOriginLoading - ? Template.asString([ - "if (link.src.indexOf(window.location.origin + '/') !== 0) {", - Template.indent( - `link.crossOrigin = ${JSON.stringify(crossOriginLoading)};` - ), - "}" - ]) - : "" - ]); + toString(options) { + options = this.compilation.createStatsOptions(options, { + forToString: true + }); - const cc = str => str.charCodeAt(0); + const statsFactory = this.compilation.createStatsFactory(options); + const statsPrinter = this.compilation.createStatsPrinter(options); - return Template.asString([ - "// object to store loaded and loading chunks", - "// undefined = chunk not loaded, null = chunk preloaded/prefetched", - "// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded", - `var installedChunks = ${ - stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" - }{${Array.from( - initialChunkIdsWithoutCss, - id => `${JSON.stringify(id)}:0` - ).join(",")}};`, - "", - uniqueName - ? `var uniqueName = ${JSON.stringify( - runtimeTemplate.outputOptions.uniqueName - )};` - : "// data-webpack is not used as build has no uniqueName", - `var loadCssChunkData = ${runtimeTemplate.basicFunction( - "target, link, chunkId", - [ - `var data, token = "", token2, exports = {}, exportsWithId = [], exportsWithDashes = [], ${ - withHmr ? "moduleIds = [], " : "" - }i = 0, cc = 1;`, - "try { if(!link) link = loadStylesheet(chunkId); data = link.sheet.cssRules; data = data[data.length - 1].style; } catch(e) { data = getComputedStyle(document.head); }", - `data = data.getPropertyValue(${ - uniqueName - ? runtimeTemplate.concatenation( - "--webpack-", - { expr: "uniqueName" }, - "-", - { expr: "chunkId" } - ) - : runtimeTemplate.concatenation("--webpack-", { expr: "chunkId" }) - });`, - "if(!data) return [];", - "for(; cc; i++) {", - Template.indent([ - "cc = data.charCodeAt(i);", - `if(cc == ${cc("(")}) { token2 = token; token = ""; }`, - `else if(cc == ${cc( - ")" - )}) { exports[token2.replace(/^_/, "")] = token.replace(/^_/, ""); token = ""; }`, - `else if(cc == ${cc("/")} || cc == ${cc( - "%" - )}) { token = token.replace(/^_/, ""); exports[token] = token; exportsWithId.push(token); if(cc == ${cc( - "%" - )}) exportsWithDashes.push(token); token = ""; }`, - `else if(!cc || cc == ${cc( - "," - )}) { token = token.replace(/^_/, ""); exportsWithId.forEach(${runtimeTemplate.expressionFunction( - `exports[x] = ${ - uniqueName - ? runtimeTemplate.concatenation( - { expr: "uniqueName" }, - "-", - { expr: "token" }, - "-", - { expr: "exports[x]" } - ) - : runtimeTemplate.concatenation({ expr: "token" }, "-", { - expr: "exports[x]" - }) - }`, - "x" - )}); exportsWithDashes.forEach(${runtimeTemplate.expressionFunction( - `exports[x] = "--" + exports[x]`, - "x" - )}); ${ - RuntimeGlobals.makeNamespaceObject - }(exports); target[token] = (${runtimeTemplate.basicFunction( - "exports, module", - `module.exports = exports;` - )}).bind(null, exports); ${ - withHmr ? "moduleIds.push(token); " : "" - }token = ""; exports = {}; exportsWithId.length = 0; }`, - `else if(cc == ${cc("\\")}) { token += data[++i] }`, - `else { token += data[i]; }` - ]), - "}", - `${ - withHmr ? `if(target == ${RuntimeGlobals.moduleFactories}) ` : "" - }installedChunks[chunkId] = 0;`, - withHmr ? "return moduleIds;" : "" - ] - )}`, - 'var loadingAttribute = "data-webpack-loading";', - `var loadStylesheet = ${runtimeTemplate.basicFunction( - "chunkId, url, done" + (withHmr ? ", hmr" : ""), - [ - 'var link, needAttach, key = "chunk-" + chunkId;', - withHmr ? "if(!hmr) {" : "", - 'var links = document.getElementsByTagName("link");', - "for(var i = 0; i < links.length; i++) {", - Template.indent([ - "var l = links[i];", - `if(l.rel == "stylesheet" && (${ - withHmr - ? 'l.href.startsWith(url) || l.getAttribute("href").startsWith(url)' - : 'l.href == url || l.getAttribute("href") == url' - }${ - uniqueName - ? ' || l.getAttribute("data-webpack") == uniqueName + ":" + key' - : "" - })) { link = l; break; }` - ]), - "}", - "if(!done) return link;", - withHmr ? "}" : "", - "if(!link) {", - Template.indent([ - "needAttach = true;", - createStylesheet.call(code, this.chunk) - ]), - "}", - `var onLinkComplete = ${runtimeTemplate.basicFunction( - "prev, event", - Template.asString([ - "link.onerror = link.onload = null;", - "link.removeAttribute(loadingAttribute);", - "clearTimeout(timeout);", - 'if(event && event.type != "load") link.parentNode.removeChild(link)', - "done(event);", - "if(prev) return prev(event);" - ]) - )};`, - "if(link.getAttribute(loadingAttribute)) {", - Template.indent([ - `var timeout = setTimeout(onLinkComplete.bind(null, undefined, { type: 'timeout', target: link }), ${loadTimeout});`, - "link.onerror = onLinkComplete.bind(null, link.onerror);", - "link.onload = onLinkComplete.bind(null, link.onload);" - ]), - "} else onLinkComplete(undefined, { type: 'load', target: link });", // We assume any existing stylesheet is render blocking - withHmr ? "hmr ? document.head.insertBefore(link, hmr) :" : "", - "needAttach && document.head.appendChild(link);", - "return link;" - ] - )};`, - initialChunkIdsWithCss.size > 2 - ? `${JSON.stringify( - Array.from(initialChunkIdsWithCss) - )}.forEach(loadCssChunkData.bind(null, ${ - RuntimeGlobals.moduleFactories - }, 0));` - : initialChunkIdsWithCss.size > 0 - ? `${Array.from( - initialChunkIdsWithCss, - id => - `loadCssChunkData(${ - RuntimeGlobals.moduleFactories - }, 0, ${JSON.stringify(id)});` - ).join("")}` - : "// no initial css", - "", - withLoading - ? Template.asString([ - `${fn}.css = ${runtimeTemplate.basicFunction("chunkId, promises", [ - "// css chunk loading", - `var installedChunkData = ${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;`, - 'if(installedChunkData !== 0) { // 0 means "already installed".', - Template.indent([ - "", - '// a Promise means "currently loading".', - "if(installedChunkData) {", - Template.indent(["promises.push(installedChunkData[2]);"]), - "} else {", - Template.indent([ - hasCssMatcher === true - ? "if(true) { // all chunks have CSS" - : `if(${hasCssMatcher("chunkId")}) {`, - Template.indent([ - "// setup Promise in chunk cache", - `var promise = new Promise(${runtimeTemplate.expressionFunction( - `installedChunkData = installedChunks[chunkId] = [resolve, reject]`, - "resolve, reject" - )});`, - "promises.push(installedChunkData[2] = promise);", - "", - "// start chunk loading", - `var url = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkCssFilename}(chunkId);`, - "// create error before stack unwound to get useful stacktrace later", - "var error = new Error();", - `var loadingEnded = ${runtimeTemplate.basicFunction( - "event", - [ - `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId)) {`, - Template.indent([ - "installedChunkData = installedChunks[chunkId];", - "if(installedChunkData !== 0) installedChunks[chunkId] = undefined;", - "if(installedChunkData) {", - Template.indent([ - 'if(event.type !== "load") {', - Template.indent([ - "var errorType = event && event.type;", - "var realSrc = event && event.target && event.target.src;", - "error.message = 'Loading css chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", - "error.name = 'ChunkLoadError';", - "error.type = errorType;", - "error.request = realSrc;", - "installedChunkData[1](error);" - ]), - "} else {", - Template.indent([ - `loadCssChunkData(${RuntimeGlobals.moduleFactories}, link, chunkId);`, - "installedChunkData[0]();" - ]), - "}" - ]), - "}" - ]), - "}" - ] - )};`, - "var link = loadStylesheet(chunkId, url, loadingEnded);" - ]), - "} else installedChunks[chunkId] = 0;" - ]), - "}" - ]), - "}" - ])};` - ]) - : "// no chunk loading", - "", - withHmr - ? Template.asString([ - "var oldTags = [];", - "var newTags = [];", - `var applyHandler = ${runtimeTemplate.basicFunction("options", [ - `return { dispose: ${runtimeTemplate.basicFunction( - "", - [] - )}, apply: ${runtimeTemplate.basicFunction("", [ - "var moduleIds = [];", - `newTags.forEach(${runtimeTemplate.expressionFunction( - "info[1].sheet.disabled = false", - "info" - )});`, - "while(oldTags.length) {", - Template.indent([ - "var oldTag = oldTags.pop();", - "if(oldTag.parentNode) oldTag.parentNode.removeChild(oldTag);" - ]), - "}", - "while(newTags.length) {", - Template.indent([ - `var info = newTags.pop();`, - `var chunkModuleIds = loadCssChunkData(${RuntimeGlobals.moduleFactories}, info[1], info[0]);`, - `chunkModuleIds.forEach(${runtimeTemplate.expressionFunction( - "moduleIds.push(id)", - "id" - )});` - ]), - "}", - "return moduleIds;" - ])} };` - ])}`, - `var cssTextKey = ${runtimeTemplate.returningFunction( - `Array.from(link.sheet.cssRules, ${runtimeTemplate.returningFunction( - "r.cssText", - "r" - )}).join()`, - "link" - )}`, - `${ - RuntimeGlobals.hmrDownloadUpdateHandlers - }.css = ${runtimeTemplate.basicFunction( - "chunkIds, removedChunks, removedModules, promises, applyHandlers, updatedModulesList", - [ - "applyHandlers.push(applyHandler);", - `chunkIds.forEach(${runtimeTemplate.basicFunction("chunkId", [ - `var filename = ${RuntimeGlobals.getChunkCssFilename}(chunkId);`, - `var url = ${RuntimeGlobals.publicPath} + filename;`, - "var oldTag = loadStylesheet(chunkId, url);", - "if(!oldTag) return;", - `promises.push(new Promise(${runtimeTemplate.basicFunction( - "resolve, reject", - [ - `var link = loadStylesheet(chunkId, url + (url.indexOf("?") < 0 ? "?" : "&") + "hmr=" + Date.now(), ${runtimeTemplate.basicFunction( - "event", - [ - 'if(event.type !== "load") {', - Template.indent([ - "var errorType = event && event.type;", - "var realSrc = event && event.target && event.target.src;", - "error.message = 'Loading css hot update chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", - "error.name = 'ChunkLoadError';", - "error.type = errorType;", - "error.request = realSrc;", - "reject(error);" - ]), - "} else {", - Template.indent([ - "try { if(cssTextKey(oldTag) == cssTextKey(link)) { if(link.parentNode) link.parentNode.removeChild(link); return resolve(); } } catch(e) {}", - "var factories = {};", - "loadCssChunkData(factories, link, chunkId);", - `Object.keys(factories).forEach(${runtimeTemplate.expressionFunction( - "updatedModulesList.push(id)", - "id" - )})`, - "link.sheet.disabled = true;", - "oldTags.push(oldTag);", - "newTags.push([chunkId, link]);", - "resolve();" - ]), - "}" - ] - )}, oldTag);` - ] - )}));` - ])});` - ] - )}` - ]) - : "// no hmr" - ]); + const data = statsFactory.create("compilation", this.compilation, { + compilation: this.compilation + }); + const result = statsPrinter.print("compilation", data); + return result === undefined ? "" : result; } } -module.exports = CssLoadingRuntimeModule; +module.exports = Stats; /***/ }), -/***/ 47283: +/***/ 39722: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -68559,1093 +62764,819 @@ module.exports = CssLoadingRuntimeModule; -const { ConcatSource } = __webpack_require__(51255); -const HotUpdateChunk = __webpack_require__(9597); -const RuntimeGlobals = __webpack_require__(16475); -const SelfModuleFactory = __webpack_require__(63560); -const CssExportDependency = __webpack_require__(76760); -const CssImportDependency = __webpack_require__(90542); -const CssLocalIdentifierDependency = __webpack_require__(92328); -const CssSelfLocalIdentifierDependency = __webpack_require__(29094); -const CssUrlDependency = __webpack_require__(70749); -const StaticExportsDependency = __webpack_require__(91418); -const { compareModulesByIdentifier } = __webpack_require__(29579); -const createSchemaValidation = __webpack_require__(32540); -const createHash = __webpack_require__(49835); -const memoize = __webpack_require__(78676); -const nonNumericOnlyHash = __webpack_require__(55668); -const CssExportsGenerator = __webpack_require__(91254); -const CssGenerator = __webpack_require__(46061); -const CssParser = __webpack_require__(98305); +const { ConcatSource, PrefixSource } = __webpack_require__(51255); /** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").CssExperimentOptions} CssExperimentOptions */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ +/** @typedef {import("../declarations/WebpackOptions").Output} OutputOptions */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ +/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("./Compilation").PathData} PathData */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./ModuleTemplate")} ModuleTemplate */ +/** @typedef {import("./RuntimeModule")} RuntimeModule */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */ +/** @typedef {import("./javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ -const getCssLoadingRuntimeModule = memoize(() => - __webpack_require__(80806) -); +const START_LOWERCASE_ALPHABET_CODE = "a".charCodeAt(0); +const START_UPPERCASE_ALPHABET_CODE = "A".charCodeAt(0); +const DELTA_A_TO_Z = "z".charCodeAt(0) - START_LOWERCASE_ALPHABET_CODE + 1; +const NUMBER_OF_IDENTIFIER_START_CHARS = DELTA_A_TO_Z * 2 + 2; // a-z A-Z _ $ +const NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS = + NUMBER_OF_IDENTIFIER_START_CHARS + 10; // a-z A-Z _ $ 0-9 +const FUNCTION_CONTENT_REGEX = /^function\s?\(\)\s?\{\r?\n?|\r?\n?\}$/g; +const INDENT_MULTILINE_REGEX = /^\t/gm; +const LINE_SEPARATOR_REGEX = /\r?\n/g; +const IDENTIFIER_NAME_REPLACE_REGEX = /^([^a-zA-Z$_])/; +const IDENTIFIER_ALPHA_NUMERIC_NAME_REPLACE_REGEX = /[^a-zA-Z0-9$]+/g; +const COMMENT_END_REGEX = /\*\//g; +const PATH_NAME_NORMALIZE_REPLACE_REGEX = /[^a-zA-Z0-9_!§$()=\-^°]+/g; +const MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g; -const getSchema = name => { - const { definitions } = __webpack_require__(73342); - return { - definitions, - oneOf: [{ $ref: `#/definitions/${name}` }] - }; -}; +/** + * @typedef {Object} RenderManifestOptions + * @property {Chunk} chunk the chunk used to render + * @property {string} hash + * @property {string} fullHash + * @property {OutputOptions} outputOptions + * @property {CodeGenerationResults} codeGenerationResults + * @property {{javascript: ModuleTemplate}} moduleTemplates + * @property {DependencyTemplates} dependencyTemplates + * @property {RuntimeTemplate} runtimeTemplate + * @property {ModuleGraph} moduleGraph + * @property {ChunkGraph} chunkGraph + */ -const validateGeneratorOptions = createSchemaValidation( - __webpack_require__(59170), - () => getSchema("CssGeneratorOptions"), - { - name: "Css Modules Plugin", - baseDataPath: "parser" - } -); -const validateParserOptions = createSchemaValidation( - __webpack_require__(38542), - () => getSchema("CssParserOptions"), - { - name: "Css Modules Plugin", - baseDataPath: "parser" - } -); +/** @typedef {RenderManifestEntryTemplated | RenderManifestEntryStatic} RenderManifestEntry */ -const escapeCss = (str, omitOptionalUnderscore) => { - const escaped = `${str}`.replace( - // cspell:word uffff - /[^a-zA-Z0-9_\u0081-\uffff-]/g, - s => `\\${s}` - ); - return !omitOptionalUnderscore && /^(?!--)[0-9_-]/.test(escaped) - ? `_${escaped}` - : escaped; -}; +/** + * @typedef {Object} RenderManifestEntryTemplated + * @property {function(): Source} render + * @property {string | function(PathData, AssetInfo=): string} filenameTemplate + * @property {PathData=} pathOptions + * @property {AssetInfo=} info + * @property {string} identifier + * @property {string=} hash + * @property {boolean=} auxiliary + */ -const plugin = "CssModulesPlugin"; +/** + * @typedef {Object} RenderManifestEntryStatic + * @property {function(): Source} render + * @property {string} filename + * @property {AssetInfo} info + * @property {string} identifier + * @property {string=} hash + * @property {boolean=} auxiliary + */ + +/** + * @typedef {Object} HasId + * @property {number | string} id + */ + +/** + * @typedef {function(Module, number): boolean} ModuleFilterPredicate + */ + +class Template { + /** + * + * @param {Function} fn a runtime function (.runtime.js) "template" + * @returns {string} the updated and normalized function string + */ + static getFunctionContent(fn) { + return fn + .toString() + .replace(FUNCTION_CONTENT_REGEX, "") + .replace(INDENT_MULTILINE_REGEX, "") + .replace(LINE_SEPARATOR_REGEX, "\n"); + } + + /** + * @param {string} str the string converted to identifier + * @returns {string} created identifier + */ + static toIdentifier(str) { + if (typeof str !== "string") return ""; + return str + .replace(IDENTIFIER_NAME_REPLACE_REGEX, "_$1") + .replace(IDENTIFIER_ALPHA_NUMERIC_NAME_REPLACE_REGEX, "_"); + } + /** + * + * @param {string} str string to be converted to commented in bundle code + * @returns {string} returns a commented version of string + */ + static toComment(str) { + if (!str) return ""; + return `/*! ${str.replace(COMMENT_END_REGEX, "* /")} */`; + } -class CssModulesPlugin { /** - * @param {CssExperimentOptions} options options + * + * @param {string} str string to be converted to "normal comment" + * @returns {string} returns a commented version of string */ - constructor({ exportsOnly = false }) { - this._exportsOnly = exportsOnly; + static toNormalComment(str) { + if (!str) return ""; + return `/* ${str.replace(COMMENT_END_REGEX, "* /")} */`; } + /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {string} str string path to be normalized + * @returns {string} normalized bundle-safe path */ - apply(compiler) { - compiler.hooks.compilation.tap( - plugin, - (compilation, { normalModuleFactory }) => { - const selfFactory = new SelfModuleFactory(compilation.moduleGraph); - compilation.dependencyFactories.set( - CssUrlDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - CssUrlDependency, - new CssUrlDependency.Template() - ); - compilation.dependencyTemplates.set( - CssLocalIdentifierDependency, - new CssLocalIdentifierDependency.Template() - ); - compilation.dependencyFactories.set( - CssSelfLocalIdentifierDependency, - selfFactory - ); - compilation.dependencyTemplates.set( - CssSelfLocalIdentifierDependency, - new CssSelfLocalIdentifierDependency.Template() - ); - compilation.dependencyTemplates.set( - CssExportDependency, - new CssExportDependency.Template() - ); - compilation.dependencyFactories.set( - CssImportDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - CssImportDependency, - new CssImportDependency.Template() - ); - compilation.dependencyTemplates.set( - StaticExportsDependency, - new StaticExportsDependency.Template() - ); - normalModuleFactory.hooks.createParser - .for("css") - .tap(plugin, parserOptions => { - validateParserOptions(parserOptions); - return new CssParser(); - }); - normalModuleFactory.hooks.createParser - .for("css/global") - .tap(plugin, parserOptions => { - validateParserOptions(parserOptions); - return new CssParser({ - allowPseudoBlocks: false, - allowModeSwitch: false - }); - }); - normalModuleFactory.hooks.createParser - .for("css/module") - .tap(plugin, parserOptions => { - validateParserOptions(parserOptions); - return new CssParser({ - defaultMode: "local" - }); - }); - normalModuleFactory.hooks.createGenerator - .for("css") - .tap(plugin, generatorOptions => { - validateGeneratorOptions(generatorOptions); - return this._exportsOnly - ? new CssExportsGenerator() - : new CssGenerator(); - }); - normalModuleFactory.hooks.createGenerator - .for("css/global") - .tap(plugin, generatorOptions => { - validateGeneratorOptions(generatorOptions); - return this._exportsOnly - ? new CssExportsGenerator() - : new CssGenerator(); - }); - normalModuleFactory.hooks.createGenerator - .for("css/module") - .tap(plugin, generatorOptions => { - validateGeneratorOptions(generatorOptions); - return this._exportsOnly - ? new CssExportsGenerator() - : new CssGenerator(); - }); - const orderedCssModulesPerChunk = new WeakMap(); - compilation.hooks.afterCodeGeneration.tap("CssModulesPlugin", () => { - const { chunkGraph } = compilation; - for (const chunk of compilation.chunks) { - if (CssModulesPlugin.chunkHasCss(chunk, chunkGraph)) { - orderedCssModulesPerChunk.set( - chunk, - this.getOrderedChunkCssModules(chunk, chunkGraph, compilation) - ); - } - } - }); - compilation.hooks.contentHash.tap("CssModulesPlugin", chunk => { - const { - chunkGraph, - outputOptions: { - hashSalt, - hashDigest, - hashDigestLength, - hashFunction - } - } = compilation; - const modules = orderedCssModulesPerChunk.get(chunk); - if (modules === undefined) return; - const hash = createHash(hashFunction); - if (hashSalt) hash.update(hashSalt); - for (const module of modules) { - hash.update(chunkGraph.getModuleHash(module, chunk.runtime)); - } - const digest = /** @type {string} */ (hash.digest(hashDigest)); - chunk.contentHash.css = nonNumericOnlyHash(digest, hashDigestLength); - }); - compilation.hooks.renderManifest.tap(plugin, (result, options) => { - const { chunkGraph } = compilation; - const { hash, chunk, codeGenerationResults } = options; + static toPath(str) { + if (typeof str !== "string") return ""; + return str + .replace(PATH_NAME_NORMALIZE_REPLACE_REGEX, "-") + .replace(MATCH_PADDED_HYPHENS_REPLACE_REGEX, ""); + } - if (chunk instanceof HotUpdateChunk) return result; + // map number to a single character a-z, A-Z or multiple characters if number is too big + /** + * @param {number} n number to convert to ident + * @returns {string} returns single character ident + */ + static numberToIdentifier(n) { + if (n >= NUMBER_OF_IDENTIFIER_START_CHARS) { + // use multiple letters + return ( + Template.numberToIdentifier(n % NUMBER_OF_IDENTIFIER_START_CHARS) + + Template.numberToIdentifierContinuation( + Math.floor(n / NUMBER_OF_IDENTIFIER_START_CHARS) + ) + ); + } - const modules = orderedCssModulesPerChunk.get(chunk); - if (modules !== undefined) { - result.push({ - render: () => - this.renderChunk({ - chunk, - chunkGraph, - codeGenerationResults, - uniqueName: compilation.outputOptions.uniqueName, - modules - }), - filenameTemplate: CssModulesPlugin.getChunkFilenameTemplate( - chunk, - compilation.outputOptions - ), - pathOptions: { - hash, - runtime: chunk.runtime, - chunk, - contentHashType: "css" - }, - identifier: `css${chunk.id}`, - hash: chunk.contentHash.css - }); - } - return result; - }); - const enabledChunks = new WeakSet(); - const handler = (chunk, set) => { - if (enabledChunks.has(chunk)) { - return; - } - enabledChunks.add(chunk); + // lower case + if (n < DELTA_A_TO_Z) { + return String.fromCharCode(START_LOWERCASE_ALPHABET_CODE + n); + } + n -= DELTA_A_TO_Z; - set.add(RuntimeGlobals.publicPath); - set.add(RuntimeGlobals.getChunkCssFilename); - set.add(RuntimeGlobals.hasOwnProperty); - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - set.add(RuntimeGlobals.makeNamespaceObject); + // upper case + if (n < DELTA_A_TO_Z) { + return String.fromCharCode(START_UPPERCASE_ALPHABET_CODE + n); + } - const CssLoadingRuntimeModule = getCssLoadingRuntimeModule(); - compilation.addRuntimeModule(chunk, new CssLoadingRuntimeModule(set)); - }; - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hasCssModules) - .tap(plugin, handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap(plugin, handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadUpdateHandlers) - .tap(plugin, handler); - } - ); + if (n === DELTA_A_TO_Z) return "_"; + return "$"; } - getModulesInOrder(chunk, modules, compilation) { - if (!modules) return []; - - const modulesList = [...modules]; + /** + * @param {number} n number to convert to ident + * @returns {string} returns single character ident + */ + static numberToIdentifierContinuation(n) { + if (n >= NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS) { + // use multiple letters + return ( + Template.numberToIdentifierContinuation( + n % NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS + ) + + Template.numberToIdentifierContinuation( + Math.floor(n / NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS) + ) + ); + } - // Get ordered list of modules per chunk group - // Lists are in reverse order to allow to use Array.pop() - const modulesByChunkGroup = Array.from(chunk.groupsIterable, chunkGroup => { - const sortedModules = modulesList - .map(module => { - return { - module, - index: chunkGroup.getModulePostOrderIndex(module) - }; - }) - .filter(item => item.index !== undefined) - .sort((a, b) => b.index - a.index) - .map(item => item.module); + // lower case + if (n < DELTA_A_TO_Z) { + return String.fromCharCode(START_LOWERCASE_ALPHABET_CODE + n); + } + n -= DELTA_A_TO_Z; - return { list: sortedModules, set: new Set(sortedModules) }; - }); + // upper case + if (n < DELTA_A_TO_Z) { + return String.fromCharCode(START_UPPERCASE_ALPHABET_CODE + n); + } + n -= DELTA_A_TO_Z; - if (modulesByChunkGroup.length === 1) - return modulesByChunkGroup[0].list.reverse(); + // numbers + if (n < 10) { + return `${n}`; + } - const compareModuleLists = ({ list: a }, { list: b }) => { - if (a.length === 0) { - return b.length === 0 ? 0 : 1; - } else { - if (b.length === 0) return -1; - return compareModulesByIdentifier(a[a.length - 1], b[b.length - 1]); - } - }; + if (n === 10) return "_"; + return "$"; + } - modulesByChunkGroup.sort(compareModuleLists); + /** + * + * @param {string | string[]} s string to convert to identity + * @returns {string} converted identity + */ + static indent(s) { + if (Array.isArray(s)) { + return s.map(Template.indent).join("\n"); + } else { + const str = s.trimRight(); + if (!str) return ""; + const ind = str[0] === "\n" ? "" : "\t"; + return ind + str.replace(/\n([^\n])/g, "\n\t$1"); + } + } - const finalModules = []; + /** + * + * @param {string|string[]} s string to create prefix for + * @param {string} prefix prefix to compose + * @returns {string} returns new prefix string + */ + static prefix(s, prefix) { + const str = Template.asString(s).trim(); + if (!str) return ""; + const ind = str[0] === "\n" ? "" : prefix; + return ind + str.replace(/\n([^\n])/g, "\n" + prefix + "$1"); + } - for (;;) { - const failedModules = new Set(); - const list = modulesByChunkGroup[0].list; - if (list.length === 0) { - // done, everything empty - break; - } - let selectedModule = list[list.length - 1]; - let hasFailed = undefined; - outer: for (;;) { - for (const { list, set } of modulesByChunkGroup) { - if (list.length === 0) continue; - const lastModule = list[list.length - 1]; - if (lastModule === selectedModule) continue; - if (!set.has(selectedModule)) continue; - failedModules.add(selectedModule); - if (failedModules.has(lastModule)) { - // There is a conflict, try other alternatives - hasFailed = lastModule; - continue; - } - selectedModule = lastModule; - hasFailed = false; - continue outer; // restart - } - break; - } - if (hasFailed) { - // There is a not resolve-able conflict with the selectedModule - if (compilation) { - // TODO print better warning - compilation.warnings.push( - new Error( - `chunk ${ - chunk.name || chunk.id - }\nConflicting order between ${hasFailed.readableIdentifier( - compilation.requestShortener - )} and ${selectedModule.readableIdentifier( - compilation.requestShortener - )}` - ) - ); - } - selectedModule = hasFailed; - } - // Insert the selected module into the final modules list - finalModules.push(selectedModule); - // Remove the selected module from all lists - for (const { list, set } of modulesByChunkGroup) { - const lastModule = list[list.length - 1]; - if (lastModule === selectedModule) list.pop(); - else if (hasFailed && set.has(selectedModule)) { - const idx = list.indexOf(selectedModule); - if (idx >= 0) list.splice(idx, 1); - } - } - modulesByChunkGroup.sort(compareModuleLists); + /** + * + * @param {string|string[]} str string or string collection + * @returns {string} returns a single string from array + */ + static asString(str) { + if (Array.isArray(str)) { + return str.join("\n"); } - return finalModules; + return str; } - getOrderedChunkCssModules(chunk, chunkGraph, compilation) { - return [ - ...this.getModulesInOrder( - chunk, - chunkGraph.getOrderedChunkModulesIterableBySourceType( - chunk, - "css-import", - compareModulesByIdentifier - ), - compilation - ), - ...this.getModulesInOrder( - chunk, - chunkGraph.getOrderedChunkModulesIterableBySourceType( - chunk, - "css", - compareModulesByIdentifier - ), - compilation - ) - ]; - } + /** + * @typedef {Object} WithId + * @property {string|number} id + */ - renderChunk({ - uniqueName, - chunk, - chunkGraph, - codeGenerationResults, - modules - }) { - const source = new ConcatSource(); - const metaData = []; + /** + * @param {WithId[]} modules a collection of modules to get array bounds for + * @returns {[number, number] | false} returns the upper and lower array bounds + * or false if not every module has a number based id + */ + static getModulesArrayBounds(modules) { + let maxId = -Infinity; + let minId = Infinity; for (const module of modules) { - try { - const codeGenResult = codeGenerationResults.get(module, chunk.runtime); + const moduleId = module.id; + if (typeof moduleId !== "number") return false; + if (maxId < moduleId) maxId = moduleId; + if (minId > moduleId) minId = moduleId; + } + if (minId < 16 + ("" + minId).length) { + // add minId x ',' instead of 'Array(minId).concat(…)' + minId = 0; + } + // start with -1 because the first module needs no comma + let objectOverhead = -1; + for (const module of modules) { + // module id + colon + comma + objectOverhead += `${module.id}`.length + 2; + } + // number of commas, or when starting non-zero the length of Array(minId).concat() + const arrayOverhead = minId === 0 ? maxId : 16 + `${minId}`.length + maxId; + return arrayOverhead < objectOverhead ? [minId, maxId] : false; + } - const s = - codeGenResult.sources.get("css") || - codeGenResult.sources.get("css-import"); - if (s) { - source.add(s); + /** + * @param {ChunkRenderContext} renderContext render context + * @param {Module[]} modules modules to render (should be ordered by identifier) + * @param {function(Module): Source} renderModule function to render a module + * @param {string=} prefix applying prefix strings + * @returns {Source} rendered chunk modules in a Source object + */ + static renderChunkModules(renderContext, modules, renderModule, prefix = "") { + const { chunkGraph } = renderContext; + var source = new ConcatSource(); + if (modules.length === 0) { + return null; + } + /** @type {{id: string|number, source: Source|string}[]} */ + const allModules = modules.map(module => { + return { + id: chunkGraph.getModuleId(module), + source: renderModule(module) || "false" + }; + }); + const bounds = Template.getModulesArrayBounds(allModules); + if (bounds) { + // Render a spare array + const minId = bounds[0]; + const maxId = bounds[1]; + if (minId !== 0) { + source.add(`Array(${minId}).concat(`); + } + source.add("[\n"); + /** @type {Map} */ + const modules = new Map(); + for (const module of allModules) { + modules.set(module.id, module); + } + for (let idx = minId; idx <= maxId; idx++) { + const module = modules.get(idx); + if (idx !== minId) { + source.add(",\n"); + } + source.add(`/* ${idx} */`); + if (module) { source.add("\n"); + source.add(module.source); + } + } + source.add("\n" + prefix + "]"); + if (minId !== 0) { + source.add(")"); + } + } else { + // Render an object + source.add("{\n"); + for (let i = 0; i < allModules.length; i++) { + const module = allModules[i]; + if (i !== 0) { + source.add(",\n"); } - const exports = - codeGenResult.data && codeGenResult.data.get("css-exports"); - const moduleId = chunkGraph.getModuleId(module) + ""; - metaData.push( - `${ - exports - ? Array.from(exports, ([n, v]) => { - const shortcutValue = `${ - uniqueName ? uniqueName + "-" : "" - }${moduleId}-${n}`; - return v === shortcutValue - ? `${escapeCss(n)}/` - : v === "--" + shortcutValue - ? `${escapeCss(n)}%` - : `${escapeCss(n)}(${escapeCss(v)})`; - }).join("") - : "" - }${escapeCss(moduleId)}` - ); - } catch (e) { - e.message += `\nduring rendering of css ${module.identifier()}`; - throw e; + source.add(`\n/***/ ${JSON.stringify(module.id)}:\n`); + source.add(module.source); } + source.add(`\n\n${prefix}}`); } - source.add( - `head{--webpack-${escapeCss( - (uniqueName ? uniqueName + "-" : "") + chunk.id, - true - )}:${metaData.join(",")};}` - ); return source; } - static getChunkFilenameTemplate(chunk, outputOptions) { - if (chunk.cssFilenameTemplate) { - return chunk.cssFilenameTemplate; - } else if (chunk.canBeInitial()) { - return outputOptions.cssFilename; - } else { - return outputOptions.cssChunkFilename; + /** + * @param {RuntimeModule[]} runtimeModules array of runtime modules in order + * @param {RenderContext & { codeGenerationResults?: CodeGenerationResults }} renderContext render context + * @returns {Source} rendered runtime modules in a Source object + */ + static renderRuntimeModules(runtimeModules, renderContext) { + const source = new ConcatSource(); + for (const module of runtimeModules) { + const codeGenerationResults = renderContext.codeGenerationResults; + let runtimeSource; + if (codeGenerationResults) { + runtimeSource = codeGenerationResults.getSource( + module, + renderContext.chunk.runtime, + "runtime" + ); + } else { + const codeGenResult = module.codeGeneration({ + chunkGraph: renderContext.chunkGraph, + dependencyTemplates: renderContext.dependencyTemplates, + moduleGraph: renderContext.moduleGraph, + runtimeTemplate: renderContext.runtimeTemplate, + runtime: renderContext.chunk.runtime, + codeGenerationResults + }); + if (!codeGenResult) continue; + runtimeSource = codeGenResult.sources.get("runtime"); + } + if (runtimeSource) { + source.add(Template.toNormalComment(module.identifier()) + "\n"); + if (!module.shouldIsolate()) { + source.add(runtimeSource); + source.add("\n\n"); + } else if (renderContext.runtimeTemplate.supportsArrowFunction()) { + source.add("(() => {\n"); + source.add(new PrefixSource("\t", runtimeSource)); + source.add("\n})();\n\n"); + } else { + source.add("!function() {\n"); + source.add(new PrefixSource("\t", runtimeSource)); + source.add("\n}();\n\n"); + } + } } + return source; } - static chunkHasCss(chunk, chunkGraph) { - return ( - !!chunkGraph.getChunkModulesIterableBySourceType(chunk, "css") || - !!chunkGraph.getChunkModulesIterableBySourceType(chunk, "css-import") + /** + * @param {RuntimeModule[]} runtimeModules array of runtime modules in order + * @param {RenderContext} renderContext render context + * @returns {Source} rendered chunk runtime modules in a Source object + */ + static renderChunkRuntimeModules(runtimeModules, renderContext) { + return new PrefixSource( + "/******/ ", + new ConcatSource( + "function(__webpack_require__) { // webpackRuntimeModules\n", + this.renderRuntimeModules(runtimeModules, renderContext), + "}\n" + ) ); } } -module.exports = CssModulesPlugin; +module.exports = Template; +module.exports.NUMBER_OF_IDENTIFIER_START_CHARS = + NUMBER_OF_IDENTIFIER_START_CHARS; +module.exports.NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS = + NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS; /***/ }), -/***/ 98305: +/***/ 80734: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Jason Anderson @diurnalist */ -const Parser = __webpack_require__(11715); -const ConstDependency = __webpack_require__(76911); -const CssExportDependency = __webpack_require__(76760); -const CssImportDependency = __webpack_require__(90542); -const CssLocalIdentifierDependency = __webpack_require__(92328); -const CssSelfLocalIdentifierDependency = __webpack_require__(29094); -const CssUrlDependency = __webpack_require__(70749); -const StaticExportsDependency = __webpack_require__(91418); -const walkCssTokens = __webpack_require__(44124); +const mime = __webpack_require__(78585); +const { basename, extname } = __webpack_require__(71017); +const util = __webpack_require__(73837); +const Chunk = __webpack_require__(39385); +const Module = __webpack_require__(73208); +const { parseResource } = __webpack_require__(82186); -/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ +/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("./Compilation").PathData} PathData */ +/** @typedef {import("./Compiler")} Compiler */ -const CC_LEFT_CURLY = "{".charCodeAt(0); -const CC_RIGHT_CURLY = "}".charCodeAt(0); -const CC_COLON = ":".charCodeAt(0); -const CC_SLASH = "/".charCodeAt(0); -const CC_SEMICOLON = ";".charCodeAt(0); +const REGEXP = /\[\\*([\w:]+)\\*\]/gi; -const cssUnescape = str => { - return str.replace(/\\([0-9a-fA-F]{1,6}[ \t\n\r\f]?|[\s\S])/g, match => { - if (match.length > 2) { - return String.fromCharCode(parseInt(match.slice(1).trim(), 16)); +const prepareId = id => { + if (typeof id !== "string") return id; + + if (/^"\s\+*.*\+\s*"$/.test(id)) { + const match = /^"\s\+*\s*(.*)\s*\+\s*"$/.exec(id); + + return `" + (${match[1]} + "").replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_") + "`; + } + + return id.replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_"); +}; + +const hashLength = (replacer, handler, assetInfo, hashName) => { + const fn = (match, arg, input) => { + let result; + const length = arg && parseInt(arg, 10); + + if (length && handler) { + result = handler(length); } else { - return match[1]; + const hash = replacer(match, arg, input); + + result = length ? hash.slice(0, length) : hash; } - }); + if (assetInfo) { + assetInfo.immutable = true; + if (Array.isArray(assetInfo[hashName])) { + assetInfo[hashName] = [...assetInfo[hashName], result]; + } else if (assetInfo[hashName]) { + assetInfo[hashName] = [assetInfo[hashName], result]; + } else { + assetInfo[hashName] = result; + } + } + return result; + }; + + return fn; }; -class LocConverter { - constructor(input) { - this._input = input; - this.line = 1; - this.column = 0; - this.pos = 0; +const replacer = (value, allowEmpty) => { + const fn = (match, arg, input) => { + if (typeof value === "function") { + value = value(); + } + if (value === null || value === undefined) { + if (!allowEmpty) { + throw new Error( + `Path variable ${match} not implemented in this context: ${input}` + ); + } + + return ""; + } else { + return `${value}`; + } + }; + + return fn; +}; + +const deprecationCache = new Map(); +const deprecatedFunction = (() => () => {})(); +const deprecated = (fn, message, code) => { + let d = deprecationCache.get(message); + if (d === undefined) { + d = util.deprecate(deprecatedFunction, message, code); + deprecationCache.set(message, d); } + return (...args) => { + d(); + return fn(...args); + }; +}; - get(pos) { - if (this.pos !== pos) { - if (this.pos < pos) { - const str = this._input.slice(this.pos, pos); - let i = str.lastIndexOf("\n"); - if (i === -1) { - this.column += str.length; - } else { - this.column = str.length - i - 1; - this.line++; - while (i > 0 && (i = str.lastIndexOf("\n", i - 1)) !== -1) - this.line++; - } - } else { - let i = this._input.lastIndexOf("\n", this.pos); - while (i >= pos) { - this.line--; - i = i > 0 ? this._input.lastIndexOf("\n", i - 1) : -1; - } - this.column = pos - i; - } - this.pos = pos; +/** + * @param {string | function(PathData, AssetInfo=): string} path the raw path + * @param {PathData} data context data + * @param {AssetInfo} assetInfo extra info about the asset (will be written to) + * @returns {string} the interpolated path + */ +const replacePathVariables = (path, data, assetInfo) => { + const chunkGraph = data.chunkGraph; + + /** @type {Map} */ + const replacements = new Map(); + + // Filename context + // + // Placeholders + // + // for /some/path/file.js?query#fragment: + // [file] - /some/path/file.js + // [query] - ?query + // [fragment] - #fragment + // [base] - file.js + // [path] - /some/path/ + // [name] - file + // [ext] - .js + if (typeof data.filename === "string") { + // check that filename is data uri + let match = data.filename.match(/^data:([^;,]+)/); + if (match) { + const ext = mime.extension(match[1]); + const emptyReplacer = replacer("", true); + + replacements.set("file", emptyReplacer); + replacements.set("query", emptyReplacer); + replacements.set("fragment", emptyReplacer); + replacements.set("path", emptyReplacer); + replacements.set("base", emptyReplacer); + replacements.set("name", emptyReplacer); + replacements.set("ext", replacer(ext ? `.${ext}` : "", true)); + // Legacy + replacements.set( + "filebase", + deprecated( + emptyReplacer, + "[filebase] is now [base]", + "DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_FILENAME" + ) + ); + } else { + const { path: file, query, fragment } = parseResource(data.filename); + + const ext = extname(file); + const base = basename(file); + const name = base.slice(0, base.length - ext.length); + const path = file.slice(0, file.length - base.length); + + replacements.set("file", replacer(file)); + replacements.set("query", replacer(query, true)); + replacements.set("fragment", replacer(fragment, true)); + replacements.set("path", replacer(path, true)); + replacements.set("base", replacer(base)); + replacements.set("name", replacer(name)); + replacements.set("ext", replacer(ext, true)); + // Legacy + replacements.set( + "filebase", + deprecated( + replacer(base), + "[filebase] is now [base]", + "DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_FILENAME" + ) + ); } - return this; } -} -const CSS_MODE_TOP_LEVEL = 0; -const CSS_MODE_IN_RULE = 1; -const CSS_MODE_IN_LOCAL_RULE = 2; -const CSS_MODE_AT_IMPORT_EXPECT_URL = 3; -// TODO implement layer and supports for @import -const CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS = 4; -const CSS_MODE_AT_IMPORT_EXPECT_MEDIA = 5; -const CSS_MODE_AT_OTHER = 6; + // Compilation context + // + // Placeholders + // + // [fullhash] - data.hash (3a4b5c6e7f) + // + // Legacy Placeholders + // + // [hash] - data.hash (3a4b5c6e7f) + if (data.hash) { + const hashReplacer = hashLength( + replacer(data.hash), + data.hashWithLength, + assetInfo, + "fullhash" + ); -const explainMode = mode => { - switch (mode) { - case CSS_MODE_TOP_LEVEL: - return "parsing top level css"; - case CSS_MODE_IN_RULE: - return "parsing css rule content (global)"; - case CSS_MODE_IN_LOCAL_RULE: - return "parsing css rule content (local)"; - case CSS_MODE_AT_IMPORT_EXPECT_URL: - return "parsing @import (expecting url)"; - case CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS: - return "parsing @import (expecting optionally supports or media query)"; - case CSS_MODE_AT_IMPORT_EXPECT_MEDIA: - return "parsing @import (expecting optionally media query)"; - case CSS_MODE_AT_OTHER: - return "parsing at-rule"; - default: - return mode; + replacements.set("fullhash", hashReplacer); + + // Legacy + replacements.set( + "hash", + deprecated( + hashReplacer, + "[hash] is now [fullhash] (also consider using [chunkhash] or [contenthash], see documentation for details)", + "DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_HASH" + ) + ); } -}; -class CssParser extends Parser { - constructor({ - allowPseudoBlocks = true, - allowModeSwitch = true, - defaultMode = "global" - } = {}) { - super(); - this.allowPseudoBlocks = allowPseudoBlocks; - this.allowModeSwitch = allowModeSwitch; - this.defaultMode = defaultMode; + // Chunk Context + // + // Placeholders + // + // [id] - chunk.id (0.js) + // [name] - chunk.name (app.js) + // [chunkhash] - chunk.hash (7823t4t4.js) + // [contenthash] - chunk.contentHash[type] (3256u3zg.js) + if (data.chunk) { + const chunk = data.chunk; + + const contentHashType = data.contentHashType; + + const idReplacer = replacer(chunk.id); + const nameReplacer = replacer(chunk.name || chunk.id); + const chunkhashReplacer = hashLength( + replacer(chunk instanceof Chunk ? chunk.renderedHash : chunk.hash), + "hashWithLength" in chunk ? chunk.hashWithLength : undefined, + assetInfo, + "chunkhash" + ); + const contenthashReplacer = hashLength( + replacer( + data.contentHash || + (contentHashType && + chunk.contentHash && + chunk.contentHash[contentHashType]) + ), + data.contentHashWithLength || + ("contentHashWithLength" in chunk && chunk.contentHashWithLength + ? chunk.contentHashWithLength[contentHashType] + : undefined), + assetInfo, + "contenthash" + ); + + replacements.set("id", idReplacer); + replacements.set("name", nameReplacer); + replacements.set("chunkhash", chunkhashReplacer); + replacements.set("contenthash", contenthashReplacer); + } + + // Module Context + // + // Placeholders + // + // [id] - module.id (2.png) + // [hash] - module.hash (6237543873.png) + // + // Legacy Placeholders + // + // [moduleid] - module.id (2.png) + // [modulehash] - module.hash (6237543873.png) + if (data.module) { + const module = data.module; + + const idReplacer = replacer(() => + prepareId( + module instanceof Module ? chunkGraph.getModuleId(module) : module.id + ) + ); + const moduleHashReplacer = hashLength( + replacer(() => + module instanceof Module + ? chunkGraph.getRenderedModuleHash(module, data.runtime) + : module.hash + ), + "hashWithLength" in module ? module.hashWithLength : undefined, + assetInfo, + "modulehash" + ); + const contentHashReplacer = hashLength( + replacer(data.contentHash), + undefined, + assetInfo, + "contenthash" + ); + + replacements.set("id", idReplacer); + replacements.set("modulehash", moduleHashReplacer); + replacements.set("contenthash", contentHashReplacer); + replacements.set( + "hash", + data.contentHash ? contentHashReplacer : moduleHashReplacer + ); + // Legacy + replacements.set( + "moduleid", + deprecated( + idReplacer, + "[moduleid] is now [id]", + "DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_MODULE_ID" + ) + ); + } + + // Other things + if (data.url) { + replacements.set("url", replacer(data.url)); } + if (typeof data.runtime === "string") { + replacements.set( + "runtime", + replacer(() => prepareId(data.runtime)) + ); + } else { + replacements.set("runtime", replacer("_")); + } + + if (typeof path === "function") { + path = path(data, assetInfo); + } + + path = path.replace(REGEXP, (match, content) => { + if (content.length + 2 === match.length) { + const contentMatch = /^(\w+)(?::(\w+))?$/.exec(content); + if (!contentMatch) return match; + const [, kind, arg] = contentMatch; + const replacer = replacements.get(kind); + if (replacer !== undefined) { + return replacer(match, arg, path); + } + } else if (match.startsWith("[\\") && match.endsWith("\\]")) { + return `[${match.slice(2, -2)}]`; + } + return match; + }); + + return path; +}; + +const plugin = "TemplatedPathPlugin"; +class TemplatedPathPlugin { /** - * @param {string | Buffer | PreparsedAst} source the source to parse - * @param {ParserState} state the parser state - * @returns {ParserState} the parser state + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - parse(source, state) { - if (Buffer.isBuffer(source)) { - source = source.toString("utf-8"); - } else if (typeof source === "object") { - throw new Error("webpackAst is unexpected for the CssParser"); - } - if (source[0] === "\ufeff") { - source = source.slice(1); - } + apply(compiler) { + compiler.hooks.compilation.tap(plugin, compilation => { + compilation.hooks.assetPath.tap(plugin, replacePathVariables); + }); + } +} - const module = state.module; +module.exports = TemplatedPathPlugin; - const declaredCssVariables = new Set(); - const locConverter = new LocConverter(source); - let mode = CSS_MODE_TOP_LEVEL; - let modePos = 0; - let modeNestingLevel = 0; - let modeData = undefined; - let singleClassSelector = undefined; - let lastIdentifier = undefined; - const modeStack = []; - const isTopLevelLocal = () => - modeData === "local" || - (this.defaultMode === "local" && modeData === undefined); - const eatWhiteLine = (input, pos) => { - for (;;) { - const cc = input.charCodeAt(pos); - if (cc === 32 || cc === 9) { - pos++; - continue; - } - if (cc === 10) pos++; - break; - } - return pos; - }; - const eatUntil = chars => { - const charCodes = Array.from({ length: chars.length }, (_, i) => - chars.charCodeAt(i) - ); - const arr = Array.from( - { length: charCodes.reduce((a, b) => Math.max(a, b), 0) + 1 }, - () => false - ); - charCodes.forEach(cc => (arr[cc] = true)); - return (input, pos) => { - for (;;) { - const cc = input.charCodeAt(pos); - if (cc < arr.length && arr[cc]) { - return pos; - } - pos++; - if (pos === input.length) return pos; - } - }; - }; - const eatText = (input, pos, eater) => { - let text = ""; - for (;;) { - if (input.charCodeAt(pos) === CC_SLASH) { - const newPos = walkCssTokens.eatComments(input, pos); - if (pos !== newPos) { - pos = newPos; - if (pos === input.length) break; - } else { - text += "/"; - pos++; - if (pos === input.length) break; - } - } - const newPos = eater(input, pos); - if (pos !== newPos) { - text += input.slice(pos, newPos); - pos = newPos; - } else { - break; - } - if (pos === input.length) break; - } - return [pos, text.trimRight()]; - }; - const eatExportName = eatUntil(":};/"); - const eatExportValue = eatUntil("};/"); - const parseExports = (input, pos) => { - pos = walkCssTokens.eatWhitespaceAndComments(input, pos); - const cc = input.charCodeAt(pos); - if (cc !== CC_LEFT_CURLY) - throw new Error( - `Unexpected ${input[pos]} at ${pos} during parsing of ':export' (expected '{')` - ); - pos++; - pos = walkCssTokens.eatWhitespaceAndComments(input, pos); - for (;;) { - if (input.charCodeAt(pos) === CC_RIGHT_CURLY) break; - pos = walkCssTokens.eatWhitespaceAndComments(input, pos); - if (pos === input.length) return pos; - let start = pos; - let name; - [pos, name] = eatText(input, pos, eatExportName); - if (pos === input.length) return pos; - if (input.charCodeAt(pos) !== CC_COLON) { - throw new Error( - `Unexpected ${input[pos]} at ${pos} during parsing of export name in ':export' (expected ':')` - ); - } - pos++; - if (pos === input.length) return pos; - pos = walkCssTokens.eatWhitespaceAndComments(input, pos); - if (pos === input.length) return pos; - let value; - [pos, value] = eatText(input, pos, eatExportValue); - if (pos === input.length) return pos; - const cc = input.charCodeAt(pos); - if (cc === CC_SEMICOLON) { - pos++; - if (pos === input.length) return pos; - pos = walkCssTokens.eatWhitespaceAndComments(input, pos); - if (pos === input.length) return pos; - } else if (cc !== CC_RIGHT_CURLY) { - throw new Error( - `Unexpected ${input[pos]} at ${pos} during parsing of export value in ':export' (expected ';' or '}')` - ); - } - const dep = new CssExportDependency(name, value); - const { line: sl, column: sc } = locConverter.get(start); - const { line: el, column: ec } = locConverter.get(pos); - dep.setLoc(sl, sc, el, ec); - module.addDependency(dep); - } - pos++; - if (pos === input.length) return pos; - pos = eatWhiteLine(input, pos); - return pos; - }; - const eatPropertyName = eatUntil(":{};"); - const processLocalDeclaration = (input, pos) => { - modeData = undefined; - const start = pos; - pos = walkCssTokens.eatWhitespaceAndComments(input, pos); - const propertyNameStart = pos; - const [propertyNameEnd, propertyName] = eatText( - input, - pos, - eatPropertyName - ); - if (input.charCodeAt(propertyNameEnd) !== CC_COLON) return start; - pos = propertyNameEnd + 1; - if (propertyName.startsWith("--")) { - // CSS Variable - const { line: sl, column: sc } = locConverter.get(propertyNameStart); - const { line: el, column: ec } = locConverter.get(propertyNameEnd); - const name = propertyName.slice(2); - const dep = new CssLocalIdentifierDependency( - name, - [propertyNameStart, propertyNameEnd], - "--" - ); - dep.setLoc(sl, sc, el, ec); - module.addDependency(dep); - declaredCssVariables.add(name); - } else if ( - propertyName === "animation-name" || - propertyName === "animation" - ) { - modeData = "animation"; - lastIdentifier = undefined; - } - return pos; - }; - const processDeclarationValueDone = (input, pos) => { - if (modeData === "animation" && lastIdentifier) { - const { line: sl, column: sc } = locConverter.get(lastIdentifier[0]); - const { line: el, column: ec } = locConverter.get(lastIdentifier[1]); - const name = input.slice(lastIdentifier[0], lastIdentifier[1]); - const dep = new CssSelfLocalIdentifierDependency(name, lastIdentifier); - dep.setLoc(sl, sc, el, ec); - module.addDependency(dep); - } - }; - const eatKeyframes = eatUntil("{};/"); - const eatNameInVar = eatUntil(",)};/"); - walkCssTokens(source, { - isSelector: () => { - return mode !== CSS_MODE_IN_RULE && mode !== CSS_MODE_IN_LOCAL_RULE; - }, - url: (input, start, end, contentStart, contentEnd) => { - const value = cssUnescape(input.slice(contentStart, contentEnd)); - switch (mode) { - case CSS_MODE_AT_IMPORT_EXPECT_URL: { - modeData.url = value; - mode = CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS; - break; - } - case CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS: - case CSS_MODE_AT_IMPORT_EXPECT_MEDIA: - throw new Error( - `Unexpected ${input.slice( - start, - end - )} at ${start} during ${explainMode(mode)}` - ); - default: { - const dep = new CssUrlDependency(value, [start, end], "url"); - const { line: sl, column: sc } = locConverter.get(start); - const { line: el, column: ec } = locConverter.get(end); - dep.setLoc(sl, sc, el, ec); - module.addDependency(dep); - module.addCodeGenerationDependency(dep); - break; - } - } - return end; - }, - string: (input, start, end) => { - switch (mode) { - case CSS_MODE_AT_IMPORT_EXPECT_URL: { - modeData.url = cssUnescape(input.slice(start + 1, end - 1)); - mode = CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS; - break; - } - } - return end; - }, - atKeyword: (input, start, end) => { - const name = input.slice(start, end); - if (name === "@namespace") { - throw new Error("@namespace is not supported in bundled CSS"); - } - if (name === "@import") { - if (mode !== CSS_MODE_TOP_LEVEL) { - throw new Error( - `Unexpected @import at ${start} during ${explainMode(mode)}` - ); - } - mode = CSS_MODE_AT_IMPORT_EXPECT_URL; - modePos = end; - modeData = { - start: start, - url: undefined, - supports: undefined - }; - } - if (name === "@keyframes") { - let pos = end; - pos = walkCssTokens.eatWhitespaceAndComments(input, pos); - if (pos === input.length) return pos; - const [newPos, name] = eatText(input, pos, eatKeyframes); - const { line: sl, column: sc } = locConverter.get(pos); - const { line: el, column: ec } = locConverter.get(newPos); - const dep = new CssLocalIdentifierDependency(name, [pos, newPos]); - dep.setLoc(sl, sc, el, ec); - module.addDependency(dep); - pos = newPos; - if (pos === input.length) return pos; - if (input.charCodeAt(pos) !== CC_LEFT_CURLY) { - throw new Error( - `Unexpected ${input[pos]} at ${pos} during parsing of @keyframes (expected '{')` - ); - } - mode = CSS_MODE_IN_LOCAL_RULE; - modeNestingLevel = 1; - return pos + 1; - } - return end; - }, - semicolon: (input, start, end) => { - switch (mode) { - case CSS_MODE_AT_IMPORT_EXPECT_URL: - throw new Error(`Expected URL for @import at ${start}`); - case CSS_MODE_AT_IMPORT_EXPECT_MEDIA: - case CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS: { - const { line: sl, column: sc } = locConverter.get(modeData.start); - const { line: el, column: ec } = locConverter.get(end); - end = eatWhiteLine(input, end); - const media = input.slice(modePos, start).trim(); - const dep = new CssImportDependency( - modeData.url, - [modeData.start, end], - modeData.supports, - media - ); - dep.setLoc(sl, sc, el, ec); - module.addDependency(dep); - break; - } - case CSS_MODE_IN_LOCAL_RULE: { - processDeclarationValueDone(input, start); - return processLocalDeclaration(input, end); - } - case CSS_MODE_IN_RULE: { - return end; - } - } - mode = CSS_MODE_TOP_LEVEL; - modeData = undefined; - singleClassSelector = undefined; - return end; - }, - leftCurlyBracket: (input, start, end) => { - switch (mode) { - case CSS_MODE_TOP_LEVEL: - mode = isTopLevelLocal() - ? CSS_MODE_IN_LOCAL_RULE - : CSS_MODE_IN_RULE; - modeNestingLevel = 1; - if (mode === CSS_MODE_IN_LOCAL_RULE) - return processLocalDeclaration(input, end); - break; - case CSS_MODE_IN_RULE: - case CSS_MODE_IN_LOCAL_RULE: - modeNestingLevel++; - break; - } - return end; - }, - rightCurlyBracket: (input, start, end) => { - switch (mode) { - case CSS_MODE_IN_LOCAL_RULE: - processDeclarationValueDone(input, start); - /* falls through */ - case CSS_MODE_IN_RULE: - if (--modeNestingLevel === 0) { - mode = CSS_MODE_TOP_LEVEL; - modeData = undefined; - singleClassSelector = undefined; - } - break; - } - return end; - }, - id: (input, start, end) => { - singleClassSelector = false; - switch (mode) { - case CSS_MODE_TOP_LEVEL: - if (isTopLevelLocal()) { - const name = input.slice(start + 1, end); - const dep = new CssLocalIdentifierDependency(name, [ - start + 1, - end - ]); - const { line: sl, column: sc } = locConverter.get(start); - const { line: el, column: ec } = locConverter.get(end); - dep.setLoc(sl, sc, el, ec); - module.addDependency(dep); - } - break; - } - return end; - }, - identifier: (input, start, end) => { - singleClassSelector = false; - switch (mode) { - case CSS_MODE_IN_LOCAL_RULE: - if (modeData === "animation") { - lastIdentifier = [start, end]; - } - break; - } - return end; - }, - class: (input, start, end) => { - switch (mode) { - case CSS_MODE_TOP_LEVEL: { - if (isTopLevelLocal()) { - const name = input.slice(start + 1, end); - const dep = new CssLocalIdentifierDependency(name, [ - start + 1, - end - ]); - const { line: sl, column: sc } = locConverter.get(start); - const { line: el, column: ec } = locConverter.get(end); - dep.setLoc(sl, sc, el, ec); - module.addDependency(dep); - if (singleClassSelector === undefined) singleClassSelector = name; - } else { - singleClassSelector = false; - } - break; - } - } - return end; - }, - leftParenthesis: (input, start, end) => { - switch (mode) { - case CSS_MODE_TOP_LEVEL: { - modeStack.push(false); - break; - } - } - return end; - }, - rightParenthesis: (input, start, end) => { - switch (mode) { - case CSS_MODE_TOP_LEVEL: { - const newModeData = modeStack.pop(); - if (newModeData !== false) { - modeData = newModeData; - const dep = new ConstDependency("", [start, end]); - module.addPresentationalDependency(dep); - } - break; - } - } - return end; - }, - pseudoClass: (input, start, end) => { - singleClassSelector = false; - switch (mode) { - case CSS_MODE_TOP_LEVEL: { - const name = input.slice(start, end); - if (this.allowModeSwitch && name === ":global") { - modeData = "global"; - const dep = new ConstDependency("", [start, end]); - module.addPresentationalDependency(dep); - } else if (this.allowModeSwitch && name === ":local") { - modeData = "local"; - const dep = new ConstDependency("", [start, end]); - module.addPresentationalDependency(dep); - } else if (this.allowPseudoBlocks && name === ":export") { - const pos = parseExports(input, end); - const dep = new ConstDependency("", [start, pos]); - module.addPresentationalDependency(dep); - return pos; - } - break; - } - } - return end; - }, - pseudoFunction: (input, start, end) => { - switch (mode) { - case CSS_MODE_TOP_LEVEL: { - const name = input.slice(start, end - 1); - if (this.allowModeSwitch && name === ":global") { - modeStack.push(modeData); - modeData = "global"; - const dep = new ConstDependency("", [start, end]); - module.addPresentationalDependency(dep); - } else if (this.allowModeSwitch && name === ":local") { - modeStack.push(modeData); - modeData = "local"; - const dep = new ConstDependency("", [start, end]); - module.addPresentationalDependency(dep); - } else { - modeStack.push(false); - } - break; - } - } - return end; - }, - function: (input, start, end) => { - switch (mode) { - case CSS_MODE_IN_LOCAL_RULE: { - const name = input.slice(start, end - 1); - if (name === "var") { - let pos = walkCssTokens.eatWhitespaceAndComments(input, end); - if (pos === input.length) return pos; - const [newPos, name] = eatText(input, pos, eatNameInVar); - if (!name.startsWith("--")) return end; - const { line: sl, column: sc } = locConverter.get(pos); - const { line: el, column: ec } = locConverter.get(newPos); - const dep = new CssSelfLocalIdentifierDependency( - name.slice(2), - [pos, newPos], - "--", - declaredCssVariables - ); - dep.setLoc(sl, sc, el, ec); - module.addDependency(dep); - return newPos; - } - break; - } - } - return end; - }, - comma: (input, start, end) => { - switch (mode) { - case CSS_MODE_TOP_LEVEL: - modeData = undefined; - modeStack.length = 0; - break; - case CSS_MODE_IN_LOCAL_RULE: - processDeclarationValueDone(input, start); - break; - } - return end; - } - }); +/***/ }), + +/***/ 68099: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ - module.buildInfo.strict = true; - module.buildMeta.exportsType = "namespace"; - module.addDependency(new StaticExportsDependency([], true)); - return state; + + +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); + +class UnhandledSchemeError extends WebpackError { + /** + * @param {string} scheme scheme + * @param {string} resource resource + */ + constructor(scheme, resource) { + super( + `Reading from "${resource}" is not handled by plugins (Unhandled scheme).` + + '\nWebpack supports "data:" and "file:" URIs by default.' + + `\nYou may need an additional plugin to handle "${scheme}:" URIs.` + ); + this.file = resource; + this.name = "UnhandledSchemeError"; } } -module.exports = CssParser; +makeSerializable( + UnhandledSchemeError, + "webpack/lib/UnhandledSchemeError", + "UnhandledSchemeError" +); + +module.exports = UnhandledSchemeError; /***/ }), -/***/ 44124: -/***/ (function(module) { +/***/ 42495: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -69655,1354 +63586,1045 @@ module.exports = CssParser; -/** - * @typedef {Object} CssTokenCallbacks - * @property {function(string, number): boolean} isSelector - * @property {function(string, number, number, number, number): number=} url - * @property {function(string, number, number): number=} string - * @property {function(string, number, number): number=} leftParenthesis - * @property {function(string, number, number): number=} rightParenthesis - * @property {function(string, number, number): number=} pseudoFunction - * @property {function(string, number, number): number=} function - * @property {function(string, number, number): number=} pseudoClass - * @property {function(string, number, number): number=} atKeyword - * @property {function(string, number, number): number=} class - * @property {function(string, number, number): number=} identifier - * @property {function(string, number, number): number=} id - * @property {function(string, number, number): number=} leftCurlyBracket - * @property {function(string, number, number): number=} rightCurlyBracket - * @property {function(string, number, number): number=} semicolon - * @property {function(string, number, number): number=} comma - */ - -/** @typedef {function(string, number, CssTokenCallbacks): number} CharHandler */ - -// spec: https://drafts.csswg.org/css-syntax/ +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); -const CC_LINE_FEED = "\n".charCodeAt(0); -const CC_CARRIAGE_RETURN = "\r".charCodeAt(0); -const CC_FORM_FEED = "\f".charCodeAt(0); +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -const CC_TAB = "\t".charCodeAt(0); -const CC_SPACE = " ".charCodeAt(0); +class UnsupportedFeatureWarning extends WebpackError { + /** + * @param {string} message description of warning + * @param {DependencyLocation} loc location start and end positions of the module + */ + constructor(message, loc) { + super(message); -const CC_SLASH = "/".charCodeAt(0); -const CC_BACK_SLASH = "\\".charCodeAt(0); -const CC_ASTERISK = "*".charCodeAt(0); + this.name = "UnsupportedFeatureWarning"; + this.loc = loc; + this.hideStack = true; + } +} -const CC_LEFT_PARENTHESIS = "(".charCodeAt(0); -const CC_RIGHT_PARENTHESIS = ")".charCodeAt(0); -const CC_LEFT_CURLY = "{".charCodeAt(0); -const CC_RIGHT_CURLY = "}".charCodeAt(0); +makeSerializable( + UnsupportedFeatureWarning, + "webpack/lib/UnsupportedFeatureWarning" +); -const CC_QUOTATION_MARK = '"'.charCodeAt(0); -const CC_APOSTROPHE = "'".charCodeAt(0); +module.exports = UnsupportedFeatureWarning; -const CC_FULL_STOP = ".".charCodeAt(0); -const CC_COLON = ":".charCodeAt(0); -const CC_SEMICOLON = ";".charCodeAt(0); -const CC_COMMA = ",".charCodeAt(0); -const CC_PERCENTAGE = "%".charCodeAt(0); -const CC_AT_SIGN = "@".charCodeAt(0); -const CC_LOW_LINE = "_".charCodeAt(0); -const CC_LOWER_A = "a".charCodeAt(0); -const CC_LOWER_U = "u".charCodeAt(0); -const CC_LOWER_E = "e".charCodeAt(0); -const CC_LOWER_Z = "z".charCodeAt(0); -const CC_UPPER_A = "A".charCodeAt(0); -const CC_UPPER_E = "E".charCodeAt(0); -const CC_UPPER_Z = "Z".charCodeAt(0); -const CC_0 = "0".charCodeAt(0); -const CC_9 = "9".charCodeAt(0); +/***/ }), -const CC_NUMBER_SIGN = "#".charCodeAt(0); -const CC_PLUS_SIGN = "+".charCodeAt(0); -const CC_HYPHEN_MINUS = "-".charCodeAt(0); +/***/ 36803: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -const CC_LESS_THAN_SIGN = "<".charCodeAt(0); -const CC_GREATER_THAN_SIGN = ">".charCodeAt(0); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -const _isNewLine = cc => { - return ( - cc === CC_LINE_FEED || cc === CC_CARRIAGE_RETURN || cc === CC_FORM_FEED - ); -}; -/** @type {CharHandler} */ -const consumeSpace = (input, pos, callbacks) => { - let cc; - do { - pos++; - cc = input.charCodeAt(pos); - } while (_isWhiteSpace(cc)); - return pos; -}; -const _isWhiteSpace = cc => { - return ( - cc === CC_LINE_FEED || - cc === CC_CARRIAGE_RETURN || - cc === CC_FORM_FEED || - cc === CC_TAB || - cc === CC_SPACE - ); -}; +const ConstDependency = __webpack_require__(76911); -/** @type {CharHandler} */ -const consumeSingleCharToken = (input, pos, callbacks) => { - return pos + 1; -}; +/** @typedef {import("./Compiler")} Compiler */ -/** @type {CharHandler} */ -const consumePotentialComment = (input, pos, callbacks) => { - pos++; - if (pos === input.length) return pos; - let cc = input.charCodeAt(pos); - if (cc !== CC_ASTERISK) return pos; - for (;;) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - while (cc === CC_ASTERISK) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - if (cc === CC_SLASH) return pos + 1; - } - } -}; +class UseStrictPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "UseStrictPlugin", + (compilation, { normalModuleFactory }) => { + const handler = parser => { + parser.hooks.program.tap("UseStrictPlugin", ast => { + const firstNode = ast.body[0]; + if ( + firstNode && + firstNode.type === "ExpressionStatement" && + firstNode.expression.type === "Literal" && + firstNode.expression.value === "use strict" + ) { + // Remove "use strict" expression. It will be added later by the renderer again. + // This is necessary in order to not break the strict mode when webpack prepends code. + // @see https://github.com/webpack/webpack/issues/1970 + const dep = new ConstDependency("", firstNode.range); + dep.loc = firstNode.loc; + parser.state.module.addPresentationalDependency(dep); + parser.state.module.buildInfo.strict = true; + } + }); + }; -/** @type {function(number): CharHandler} */ -const consumeString = end => (input, pos, callbacks) => { - const start = pos; - pos = _consumeString(input, pos, end); - if (callbacks.string !== undefined) { - pos = callbacks.string(input, start, pos); + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("UseStrictPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("UseStrictPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("UseStrictPlugin", handler); + } + ); } - return pos; -}; +} -const _consumeString = (input, pos, end) => { - pos++; - for (;;) { - if (pos === input.length) return pos; - const cc = input.charCodeAt(pos); - if (cc === end) return pos + 1; - if (_isNewLine(cc)) { - // bad string - return pos; - } - if (cc === CC_BACK_SLASH) { - // we don't need to fully parse the escaped code point - // just skip over a potential new line - pos++; - if (pos === input.length) return pos; - pos++; - } else { - pos++; - } - } -}; +module.exports = UseStrictPlugin; -const _isIdentifierStartCode = cc => { - return ( - cc === CC_LOW_LINE || - (cc >= CC_LOWER_A && cc <= CC_LOWER_Z) || - (cc >= CC_UPPER_A && cc <= CC_UPPER_Z) || - cc > 0x80 - ); -}; -const _isDigit = cc => { - return cc >= CC_0 && cc <= CC_9; -}; +/***/ }), -const _startsIdentifier = (input, pos) => { - const cc = input.charCodeAt(pos); - if (cc === CC_HYPHEN_MINUS) { - if (pos === input.length) return false; - const cc = input.charCodeAt(pos + 1); - if (cc === CC_HYPHEN_MINUS) return true; - if (cc === CC_BACK_SLASH) { - const cc = input.charCodeAt(pos + 2); - return !_isNewLine(cc); - } - return _isIdentifierStartCode(cc); - } - if (cc === CC_BACK_SLASH) { - const cc = input.charCodeAt(pos + 1); - return !_isNewLine(cc); - } - return _isIdentifierStartCode(cc); -}; +/***/ 56504: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** @type {CharHandler} */ -const consumeNumberSign = (input, pos, callbacks) => { - const start = pos; - pos++; - if (pos === input.length) return pos; - if (callbacks.isSelector(input, pos) && _startsIdentifier(input, pos)) { - pos = _consumeIdentifier(input, pos); - if (callbacks.id !== undefined) { - return callbacks.id(input, start, pos); - } - } - return pos; -}; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/** @type {CharHandler} */ -const consumeMinus = (input, pos, callbacks) => { - const start = pos; - pos++; - if (pos === input.length) return pos; - const cc = input.charCodeAt(pos); - if (cc === CC_FULL_STOP || _isDigit(cc)) { - return consumeNumericToken(input, pos, callbacks); - } else if (cc === CC_HYPHEN_MINUS) { - pos++; - if (pos === input.length) return pos; - const cc = input.charCodeAt(pos); - if (cc === CC_GREATER_THAN_SIGN) { - return pos + 1; - } else { - pos = _consumeIdentifier(input, pos); - if (callbacks.identifier !== undefined) { - return callbacks.identifier(input, start, pos); - } - } - } else if (cc === CC_BACK_SLASH) { - if (pos + 1 === input.length) return pos; - const cc = input.charCodeAt(pos + 1); - if (_isNewLine(cc)) return pos; - pos = _consumeIdentifier(input, pos); - if (callbacks.identifier !== undefined) { - return callbacks.identifier(input, start, pos); - } - } else if (_isIdentifierStartCode(cc)) { - pos++; - pos = _consumeIdentifier(input, pos); - if (callbacks.identifier !== undefined) { - return callbacks.identifier(input, start, pos); - } - } - return pos; -}; -/** @type {CharHandler} */ -const consumeDot = (input, pos, callbacks) => { - const start = pos; - pos++; - if (pos === input.length) return pos; - const cc = input.charCodeAt(pos); - if (_isDigit(cc)) return consumeNumericToken(input, pos - 2, callbacks); - if (!callbacks.isSelector(input, pos) || !_startsIdentifier(input, pos)) - return pos; - pos = _consumeIdentifier(input, pos); - if (callbacks.class !== undefined) return callbacks.class(input, start, pos); - return pos; -}; -/** @type {CharHandler} */ -const consumeNumericToken = (input, pos, callbacks) => { - pos = _consumeNumber(input, pos); - if (pos === input.length) return pos; - if (_startsIdentifier(input, pos)) return _consumeIdentifier(input, pos); - const cc = input.charCodeAt(pos); - if (cc === CC_PERCENTAGE) return pos + 1; - return pos; -}; +const CaseSensitiveModulesWarning = __webpack_require__(77975); -/** @type {CharHandler} */ -const consumeOtherIdentifier = (input, pos, callbacks) => { - const start = pos; - pos = _consumeIdentifier(input, pos); - if ( - pos !== input.length && - !callbacks.isSelector(input, pos) && - input.charCodeAt(pos) === CC_LEFT_PARENTHESIS - ) { - pos++; - if (callbacks.function !== undefined) { - return callbacks.function(input, start, pos); - } - } else { - if (callbacks.identifier !== undefined) { - return callbacks.identifier(input, start, pos); - } - } - return pos; -}; +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Module")} Module */ -/** @type {CharHandler} */ -const consumePotentialUrl = (input, pos, callbacks) => { - const start = pos; - pos = _consumeIdentifier(input, pos); - if (pos === start + 3 && input.slice(start, pos + 1) === "url(") { - pos++; - let cc = input.charCodeAt(pos); - while (_isWhiteSpace(cc)) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - } - if (cc === CC_QUOTATION_MARK || cc === CC_APOSTROPHE) { - pos++; - const contentStart = pos; - pos = _consumeString(input, pos, cc); - const contentEnd = pos - 1; - cc = input.charCodeAt(pos); - while (_isWhiteSpace(cc)) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - } - if (cc !== CC_RIGHT_PARENTHESIS) return pos; - pos++; - if (callbacks.url !== undefined) - return callbacks.url(input, start, pos, contentStart, contentEnd); - return pos; - } else { - const contentStart = pos; - let contentEnd; - for (;;) { - if (cc === CC_BACK_SLASH) { - pos++; - if (pos === input.length) return pos; - pos++; - } else if (_isWhiteSpace(cc)) { - contentEnd = pos; - do { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - } while (_isWhiteSpace(cc)); - if (cc !== CC_RIGHT_PARENTHESIS) return pos; - pos++; - if (callbacks.url !== undefined) { - return callbacks.url(input, start, pos, contentStart, contentEnd); +class WarnCaseSensitiveModulesPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "WarnCaseSensitiveModulesPlugin", + compilation => { + compilation.hooks.seal.tap("WarnCaseSensitiveModulesPlugin", () => { + /** @type {Map>} */ + const moduleWithoutCase = new Map(); + for (const module of compilation.modules) { + const identifier = module.identifier(); + const lowerIdentifier = identifier.toLowerCase(); + let map = moduleWithoutCase.get(lowerIdentifier); + if (map === undefined) { + map = new Map(); + moduleWithoutCase.set(lowerIdentifier, map); + } + map.set(identifier, module); } - return pos; - } else if (cc === CC_RIGHT_PARENTHESIS) { - contentEnd = pos; - pos++; - if (callbacks.url !== undefined) { - return callbacks.url(input, start, pos, contentStart, contentEnd); + for (const pair of moduleWithoutCase) { + const map = pair[1]; + if (map.size > 1) { + compilation.warnings.push( + new CaseSensitiveModulesWarning( + map.values(), + compilation.moduleGraph + ) + ); + } } - return pos; - } else if (cc === CC_LEFT_PARENTHESIS) { - return pos; - } else { - pos++; - } - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); + }); } - } - } else { - if (callbacks.identifier !== undefined) { - return callbacks.identifier(input, start, pos); - } - return pos; + ); } -}; +} -/** @type {CharHandler} */ -const consumePotentialPseudo = (input, pos, callbacks) => { - const start = pos; - pos++; - if (!callbacks.isSelector(input, pos) || !_startsIdentifier(input, pos)) - return pos; - pos = _consumeIdentifier(input, pos); - let cc = input.charCodeAt(pos); - if (cc === CC_LEFT_PARENTHESIS) { - pos++; - if (callbacks.pseudoFunction !== undefined) { - return callbacks.pseudoFunction(input, start, pos); - } - return pos; - } - if (callbacks.pseudoClass !== undefined) { - return callbacks.pseudoClass(input, start, pos); - } - return pos; -}; +module.exports = WarnCaseSensitiveModulesPlugin; + + +/***/ }), + +/***/ 76537: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Florent Cailhol @ooflorent +*/ + + + +const WebpackError = __webpack_require__(53799); + +/** @typedef {import("./Compiler")} Compiler */ -/** @type {CharHandler} */ -const consumeLeftParenthesis = (input, pos, callbacks) => { - pos++; - if (callbacks.leftParenthesis !== undefined) { - return callbacks.leftParenthesis(input, pos - 1, pos); +class WarnDeprecatedOptionPlugin { + /** + * Create an instance of the plugin + * @param {string} option the target option + * @param {string | number} value the deprecated option value + * @param {string} suggestion the suggestion replacement + */ + constructor(option, value, suggestion) { + this.option = option; + this.value = value; + this.suggestion = suggestion; } - return pos; -}; -/** @type {CharHandler} */ -const consumeRightParenthesis = (input, pos, callbacks) => { - pos++; - if (callbacks.rightParenthesis !== undefined) { - return callbacks.rightParenthesis(input, pos - 1, pos); + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "WarnDeprecatedOptionPlugin", + compilation => { + compilation.warnings.push( + new DeprecatedOptionWarning(this.option, this.value, this.suggestion) + ); + } + ); } - return pos; -}; +} -/** @type {CharHandler} */ -const consumeLeftCurlyBracket = (input, pos, callbacks) => { - pos++; - if (callbacks.leftCurlyBracket !== undefined) { - return callbacks.leftCurlyBracket(input, pos - 1, pos); - } - return pos; -}; +class DeprecatedOptionWarning extends WebpackError { + constructor(option, value, suggestion) { + super(); -/** @type {CharHandler} */ -const consumeRightCurlyBracket = (input, pos, callbacks) => { - pos++; - if (callbacks.rightCurlyBracket !== undefined) { - return callbacks.rightCurlyBracket(input, pos - 1, pos); + this.name = "DeprecatedOptionWarning"; + this.message = + "configuration\n" + + `The value '${value}' for option '${option}' is deprecated. ` + + `Use '${suggestion}' instead.`; } - return pos; -}; +} -/** @type {CharHandler} */ -const consumeSemicolon = (input, pos, callbacks) => { - pos++; - if (callbacks.semicolon !== undefined) { - return callbacks.semicolon(input, pos - 1, pos); - } - return pos; -}; +module.exports = WarnDeprecatedOptionPlugin; -/** @type {CharHandler} */ -const consumeComma = (input, pos, callbacks) => { - pos++; - if (callbacks.comma !== undefined) { - return callbacks.comma(input, pos - 1, pos); - } - return pos; -}; -const _consumeIdentifier = (input, pos) => { - for (;;) { - const cc = input.charCodeAt(pos); - if (cc === CC_BACK_SLASH) { - pos++; - if (pos === input.length) return pos; - pos++; - } else if ( - _isIdentifierStartCode(cc) || - _isDigit(cc) || - cc === CC_HYPHEN_MINUS - ) { - pos++; - } else { - return pos; - } - } -}; +/***/ }), -const _consumeNumber = (input, pos) => { - pos++; - if (pos === input.length) return pos; - let cc = input.charCodeAt(pos); - while (_isDigit(cc)) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - } - if (cc === CC_FULL_STOP && pos + 1 !== input.length) { - const next = input.charCodeAt(pos + 1); - if (_isDigit(next)) { - pos += 2; - cc = input.charCodeAt(pos); - while (_isDigit(cc)) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - } - } - } - if (cc === CC_LOWER_E || cc === CC_UPPER_E) { - if (pos + 1 !== input.length) { - const next = input.charCodeAt(pos + 2); - if (_isDigit(next)) { - pos += 2; - } else if ( - (next === CC_HYPHEN_MINUS || next === CC_PLUS_SIGN) && - pos + 2 !== input.length - ) { - const next = input.charCodeAt(pos + 2); - if (_isDigit(next)) { - pos += 3; - } else { - return pos; - } - } else { - return pos; - } - } - } else { - return pos; - } - cc = input.charCodeAt(pos); - while (_isDigit(cc)) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - } - return pos; -}; +/***/ 25295: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** @type {CharHandler} */ -const consumeLessThan = (input, pos, callbacks) => { - if (input.slice(pos + 1, pos + 4) === "!--") return pos + 4; - return pos + 1; -}; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/** @type {CharHandler} */ -const consumeAt = (input, pos, callbacks) => { - const start = pos; - pos++; - if (pos === input.length) return pos; - if (_startsIdentifier(input, pos)) { - pos = _consumeIdentifier(input, pos); - if (callbacks.atKeyword !== undefined) { - pos = callbacks.atKeyword(input, start, pos); - } - } - return pos; -}; -const CHAR_MAP = Array.from({ length: 0x80 }, (_, cc) => { - // https://drafts.csswg.org/css-syntax/#consume-token - switch (cc) { - case CC_LINE_FEED: - case CC_CARRIAGE_RETURN: - case CC_FORM_FEED: - case CC_TAB: - case CC_SPACE: - return consumeSpace; - case CC_QUOTATION_MARK: - case CC_APOSTROPHE: - return consumeString(cc); - case CC_NUMBER_SIGN: - return consumeNumberSign; - case CC_SLASH: - return consumePotentialComment; - // case CC_LEFT_SQUARE: - // case CC_RIGHT_SQUARE: - // case CC_COMMA: - // case CC_COLON: - // return consumeSingleCharToken; - case CC_COMMA: - return consumeComma; - case CC_SEMICOLON: - return consumeSemicolon; - case CC_LEFT_PARENTHESIS: - return consumeLeftParenthesis; - case CC_RIGHT_PARENTHESIS: - return consumeRightParenthesis; - case CC_LEFT_CURLY: - return consumeLeftCurlyBracket; - case CC_RIGHT_CURLY: - return consumeRightCurlyBracket; - case CC_COLON: - return consumePotentialPseudo; - case CC_PLUS_SIGN: - return consumeNumericToken; - case CC_FULL_STOP: - return consumeDot; - case CC_HYPHEN_MINUS: - return consumeMinus; - case CC_LESS_THAN_SIGN: - return consumeLessThan; - case CC_AT_SIGN: - return consumeAt; - case CC_LOWER_U: - return consumePotentialUrl; - case CC_LOW_LINE: - return consumeOtherIdentifier; - default: - if (_isDigit(cc)) return consumeNumericToken; - if ( - (cc >= CC_LOWER_A && cc <= CC_LOWER_Z) || - (cc >= CC_UPPER_A && cc <= CC_UPPER_Z) - ) { - return consumeOtherIdentifier; - } - return consumeSingleCharToken; - } -}); -/** - * @param {string} input input css - * @param {CssTokenCallbacks} callbacks callbacks - * @returns {void} - */ -module.exports = (input, callbacks) => { - let pos = 0; - while (pos < input.length) { - const cc = input.charCodeAt(pos); - if (cc < 0x80) { - pos = CHAR_MAP[cc](input, pos, callbacks); - } else { - pos++; - } - } -}; +const NoModeWarning = __webpack_require__(80832); -module.exports.eatComments = (input, pos) => { - loop: for (;;) { - const cc = input.charCodeAt(pos); - if (cc === CC_SLASH) { - if (pos === input.length) return pos; - let cc = input.charCodeAt(pos + 1); - if (cc !== CC_ASTERISK) return pos; - pos++; - for (;;) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - while (cc === CC_ASTERISK) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - if (cc === CC_SLASH) { - pos++; - continue loop; - } - } - } - } - return pos; - } -}; +/** @typedef {import("./Compiler")} Compiler */ -module.exports.eatWhitespaceAndComments = (input, pos) => { - loop: for (;;) { - const cc = input.charCodeAt(pos); - if (cc === CC_SLASH) { - if (pos === input.length) return pos; - let cc = input.charCodeAt(pos + 1); - if (cc !== CC_ASTERISK) return pos; - pos++; - for (;;) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - while (cc === CC_ASTERISK) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - if (cc === CC_SLASH) { - pos++; - continue loop; - } - } - } - } else if (_isWhiteSpace(cc)) { - pos++; - continue; - } - return pos; +class WarnNoModeSetPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.thisCompilation.tap("WarnNoModeSetPlugin", compilation => { + compilation.warnings.push(new NoModeWarning()); + }); } -}; +} + +module.exports = WarnNoModeSetPlugin; /***/ }), -/***/ 2757: +/***/ 65193: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const { Tracer } = __webpack_require__(5787); +const { groupBy } = __webpack_require__(84953); const createSchemaValidation = __webpack_require__(32540); -const { dirname, mkdirpSync } = __webpack_require__(17139); -/** @typedef {import("../../declarations/plugins/debug/ProfilingPlugin").ProfilingPluginOptions} ProfilingPluginOptions */ -/** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */ +/** @typedef {import("../declarations/plugins/WatchIgnorePlugin").WatchIgnorePluginOptions} WatchIgnorePluginOptions */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */ const validate = createSchemaValidation( - __webpack_require__(37134), - () => __webpack_require__(50686), + __webpack_require__(16711), + () => __webpack_require__(44246), { - name: "Profiling Plugin", + name: "Watch Ignore Plugin", baseDataPath: "options" } ); -let inspector = undefined; -try { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - inspector = __webpack_require__(31405); -} catch (e) { - console.log("Unable to CPU profile in < node 8.0"); +const IGNORE_TIME_ENTRY = "ignore"; + +class IgnoringWatchFileSystem { + /** + * @param {WatchFileSystem} wfs original file system + * @param {(string|RegExp)[]} paths ignored paths + */ + constructor(wfs, paths) { + this.wfs = wfs; + this.paths = paths; + } + + watch(files, dirs, missing, startTime, options, callback, callbackUndelayed) { + files = Array.from(files); + dirs = Array.from(dirs); + const ignored = path => + this.paths.some(p => + p instanceof RegExp ? p.test(path) : path.indexOf(p) === 0 + ); + + const [ignoredFiles, notIgnoredFiles] = groupBy(files, ignored); + const [ignoredDirs, notIgnoredDirs] = groupBy(dirs, ignored); + + const watcher = this.wfs.watch( + notIgnoredFiles, + notIgnoredDirs, + missing, + startTime, + options, + (err, fileTimestamps, dirTimestamps, changedFiles, removedFiles) => { + if (err) return callback(err); + for (const path of ignoredFiles) { + fileTimestamps.set(path, IGNORE_TIME_ENTRY); + } + + for (const path of ignoredDirs) { + dirTimestamps.set(path, IGNORE_TIME_ENTRY); + } + + callback( + err, + fileTimestamps, + dirTimestamps, + changedFiles, + removedFiles + ); + }, + callbackUndelayed + ); + + return { + close: () => watcher.close(), + pause: () => watcher.pause(), + getContextTimeInfoEntries: () => { + const dirTimestamps = watcher.getContextTimeInfoEntries(); + for (const path of ignoredDirs) { + dirTimestamps.set(path, IGNORE_TIME_ENTRY); + } + return dirTimestamps; + }, + getFileTimeInfoEntries: () => { + const fileTimestamps = watcher.getFileTimeInfoEntries(); + for (const path of ignoredFiles) { + fileTimestamps.set(path, IGNORE_TIME_ENTRY); + } + return fileTimestamps; + }, + getInfo: + watcher.getInfo && + (() => { + const info = watcher.getInfo(); + const { fileTimeInfoEntries, contextTimeInfoEntries } = info; + for (const path of ignoredFiles) { + fileTimeInfoEntries.set(path, IGNORE_TIME_ENTRY); + } + for (const path of ignoredDirs) { + contextTimeInfoEntries.set(path, IGNORE_TIME_ENTRY); + } + return info; + }) + }; + } } -class Profiler { - constructor(inspector) { - this.session = undefined; - this.inspector = inspector; - this._startTime = 0; +class WatchIgnorePlugin { + /** + * @param {WatchIgnorePluginOptions} options options + */ + constructor(options) { + validate(options); + this.paths = options.paths; } - hasSession() { - return this.session !== undefined; + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.afterEnvironment.tap("WatchIgnorePlugin", () => { + compiler.watchFileSystem = new IgnoringWatchFileSystem( + compiler.watchFileSystem, + this.paths + ); + }); } +} - startProfiling() { - if (this.inspector === undefined) { - return Promise.resolve(); +module.exports = WatchIgnorePlugin; + + +/***/ }), + +/***/ 84275: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const Stats = __webpack_require__(31743); + +/** @typedef {import("../declarations/WebpackOptions").WatchOptions} WatchOptions */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */ + +/** + * @template T + * @callback Callback + * @param {(Error | null)=} err + * @param {T=} result + */ + +class Watching { + /** + * @param {Compiler} compiler the compiler + * @param {WatchOptions} watchOptions options + * @param {Callback} handler completion handler + */ + constructor(compiler, watchOptions, handler) { + this.startTime = null; + this.invalid = false; + this.handler = handler; + /** @type {Callback[]} */ + this.callbacks = []; + /** @type {Callback[] | undefined} */ + this._closeCallbacks = undefined; + this.closed = false; + this.suspended = false; + this.blocked = false; + this._isBlocked = () => false; + this._onChange = () => {}; + this._onInvalid = () => {}; + if (typeof watchOptions === "number") { + this.watchOptions = { + aggregateTimeout: watchOptions + }; + } else if (watchOptions && typeof watchOptions === "object") { + this.watchOptions = { ...watchOptions }; + } else { + this.watchOptions = {}; } - - try { - this.session = new inspector.Session(); - this.session.connect(); - } catch (_) { - this.session = undefined; - return Promise.resolve(); + if (typeof this.watchOptions.aggregateTimeout !== "number") { + this.watchOptions.aggregateTimeout = 20; } - - const hrtime = process.hrtime(); - this._startTime = hrtime[0] * 1000000 + Math.round(hrtime[1] / 1000); - - return Promise.all([ - this.sendCommand("Profiler.setSamplingInterval", { - interval: 100 - }), - this.sendCommand("Profiler.enable"), - this.sendCommand("Profiler.start") - ]); + this.compiler = compiler; + this.running = false; + this._initial = true; + this._invalidReported = true; + this._needRecords = true; + this.watcher = undefined; + this.pausedWatcher = undefined; + /** @type {Set} */ + this._collectedChangedFiles = undefined; + /** @type {Set} */ + this._collectedRemovedFiles = undefined; + this._done = this._done.bind(this); + process.nextTick(() => { + if (this._initial) this._invalidate(); + }); } - sendCommand(method, params) { - if (this.hasSession()) { - return new Promise((res, rej) => { - return this.session.post(method, params, (err, params) => { - if (err !== null) { - rej(err); - } else { - res(params); - } - }); - }); + /** + * @param {ReadonlySet} changedFiles changed files + * @param {ReadonlySet} removedFiles removed files + */ + _mergeWithCollected(changedFiles, removedFiles) { + if (!changedFiles) return; + if (!this._collectedChangedFiles) { + this._collectedChangedFiles = new Set(changedFiles); + this._collectedRemovedFiles = new Set(removedFiles); } else { - return Promise.resolve(); + for (const file of changedFiles) { + this._collectedChangedFiles.add(file); + this._collectedRemovedFiles.delete(file); + } + for (const file of removedFiles) { + this._collectedChangedFiles.delete(file); + this._collectedRemovedFiles.add(file); + } } } - destroy() { - if (this.hasSession()) { - this.session.disconnect(); + /** + * @param {ReadonlyMap=} fileTimeInfoEntries info for files + * @param {ReadonlyMap=} contextTimeInfoEntries info for directories + * @param {ReadonlySet=} changedFiles changed files + * @param {ReadonlySet=} removedFiles removed files + * @returns {void} + */ + _go(fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles) { + this._initial = false; + if (this.startTime === null) this.startTime = Date.now(); + this.running = true; + if (this.watcher) { + this.pausedWatcher = this.watcher; + this.lastWatcherStartTime = Date.now(); + this.watcher.pause(); + this.watcher = null; + } else if (!this.lastWatcherStartTime) { + this.lastWatcherStartTime = Date.now(); + } + this.compiler.fsStartTime = Date.now(); + if ( + changedFiles && + removedFiles && + fileTimeInfoEntries && + contextTimeInfoEntries + ) { + this._mergeWithCollected(changedFiles, removedFiles); + this.compiler.fileTimestamps = fileTimeInfoEntries; + this.compiler.contextTimestamps = contextTimeInfoEntries; + } else if (this.pausedWatcher) { + if (this.pausedWatcher.getInfo) { + const { + changes, + removals, + fileTimeInfoEntries, + contextTimeInfoEntries + } = this.pausedWatcher.getInfo(); + this._mergeWithCollected(changes, removals); + this.compiler.fileTimestamps = fileTimeInfoEntries; + this.compiler.contextTimestamps = contextTimeInfoEntries; + } else { + this._mergeWithCollected( + this.pausedWatcher.getAggregatedChanges && + this.pausedWatcher.getAggregatedChanges(), + this.pausedWatcher.getAggregatedRemovals && + this.pausedWatcher.getAggregatedRemovals() + ); + this.compiler.fileTimestamps = + this.pausedWatcher.getFileTimeInfoEntries(); + this.compiler.contextTimestamps = + this.pausedWatcher.getContextTimeInfoEntries(); + } } + this.compiler.modifiedFiles = this._collectedChangedFiles; + this._collectedChangedFiles = undefined; + this.compiler.removedFiles = this._collectedRemovedFiles; + this._collectedRemovedFiles = undefined; - return Promise.resolve(); - } + const run = () => { + if (this.compiler.idle) { + return this.compiler.cache.endIdle(err => { + if (err) return this._done(err); + this.compiler.idle = false; + run(); + }); + } + if (this._needRecords) { + return this.compiler.readRecords(err => { + if (err) return this._done(err); - stopProfiling() { - return this.sendCommand("Profiler.stop").then(({ profile }) => { - const hrtime = process.hrtime(); - const endTime = hrtime[0] * 1000000 + Math.round(hrtime[1] / 1000); - if (profile.startTime < this._startTime || profile.endTime > endTime) { - // In some cases timestamps mismatch and we need to adjust them - // Both process.hrtime and the inspector timestamps claim to be relative - // to a unknown point in time. But they do not guarantee that this is the - // same point in time. - const duration = profile.endTime - profile.startTime; - const ownDuration = endTime - this._startTime; - const untracked = Math.max(0, ownDuration - duration); - profile.startTime = this._startTime + untracked / 2; - profile.endTime = endTime - untracked / 2; + this._needRecords = false; + run(); + }); } - return { profile }; - }); - } -} + this.invalid = false; + this._invalidReported = false; + this.compiler.hooks.watchRun.callAsync(this.compiler, err => { + if (err) return this._done(err); + const onCompiled = (err, compilation) => { + if (err) return this._done(err, compilation); + if (this.invalid) return this._done(null, compilation); -/** - * an object that wraps Tracer and Profiler with a counter - * @typedef {Object} Trace - * @property {Tracer} trace instance of Tracer - * @property {number} counter Counter - * @property {Profiler} profiler instance of Profiler - * @property {Function} end the end function - */ + if (this.compiler.hooks.shouldEmit.call(compilation) === false) { + return this._done(null, compilation); + } -/** - * @param {IntermediateFileSystem} fs filesystem used for output - * @param {string} outputPath The location where to write the log. - * @returns {Trace} The trace object - */ -const createTrace = (fs, outputPath) => { - const trace = new Tracer(); - const profiler = new Profiler(inspector); - if (/\/|\\/.test(outputPath)) { - const dirPath = dirname(fs, outputPath); - mkdirpSync(fs, dirPath); - } - const fsStream = fs.createWriteStream(outputPath); + process.nextTick(() => { + const logger = compilation.getLogger("webpack.Compiler"); + logger.time("emitAssets"); + this.compiler.emitAssets(compilation, err => { + logger.timeEnd("emitAssets"); + if (err) return this._done(err, compilation); + if (this.invalid) return this._done(null, compilation); - let counter = 0; + logger.time("emitRecords"); + this.compiler.emitRecords(err => { + logger.timeEnd("emitRecords"); + if (err) return this._done(err, compilation); - trace.pipe(fsStream); - // These are critical events that need to be inserted so that tools like - // chrome dev tools can load the profile. - trace.instantEvent({ - name: "TracingStartedInPage", - id: ++counter, - cat: ["disabled-by-default-devtools.timeline"], - args: { - data: { - sessionId: "-1", - page: "0xfff", - frames: [ - { - frame: "0xfff", - url: "webpack", - name: "" - } - ] - } - } - }); + if (compilation.hooks.needAdditionalPass.call()) { + compilation.needAdditionalPass = true; - trace.instantEvent({ - name: "TracingStartedInBrowser", - id: ++counter, - cat: ["disabled-by-default-devtools.timeline"], - args: { - data: { - sessionId: "-1" - } - } - }); + compilation.startTime = this.startTime; + compilation.endTime = Date.now(); + logger.time("done hook"); + const stats = new Stats(compilation); + this.compiler.hooks.done.callAsync(stats, err => { + logger.timeEnd("done hook"); + if (err) return this._done(err, compilation); - return { - trace, - counter, - profiler, - end: callback => { - trace.push("]"); - // Wait until the write stream finishes. - fsStream.on("close", () => { - callback(); + this.compiler.hooks.additionalPass.callAsync(err => { + if (err) return this._done(err, compilation); + this.compiler.compile(onCompiled); + }); + }); + return; + } + return this._done(null, compilation); + }); + }); + }); + }; + this.compiler.compile(onCompiled); }); - // Tear down the readable trace stream. - trace.push(null); - } - }; -}; + }; -const pluginName = "ProfilingPlugin"; + run(); + } -class ProfilingPlugin { /** - * @param {ProfilingPluginOptions=} options options object + * @param {Compilation} compilation the compilation + * @returns {Stats} the compilation stats */ - constructor(options = {}) { - validate(options); - this.outputPath = options.outputPath || "events.json"; + _getStats(compilation) { + const stats = new Stats(compilation); + return stats; } - apply(compiler) { - const tracer = createTrace( - compiler.intermediateFileSystem, - this.outputPath - ); - tracer.profiler.startProfiling(); + /** + * @param {Error=} err an optional error + * @param {Compilation=} compilation the compilation + * @returns {void} + */ + _done(err, compilation) { + this.running = false; - // Compiler Hooks - Object.keys(compiler.hooks).forEach(hookName => { - const hook = compiler.hooks[hookName]; - if (hook) { - hook.intercept(makeInterceptorFor("Compiler", tracer)(hookName)); - } - }); + const logger = compilation && compilation.getLogger("webpack.Watching"); - Object.keys(compiler.resolverFactory.hooks).forEach(hookName => { - const hook = compiler.resolverFactory.hooks[hookName]; - if (hook) { - hook.intercept(makeInterceptorFor("Resolver", tracer)(hookName)); - } - }); + let stats = null; - compiler.hooks.compilation.tap( - pluginName, - (compilation, { normalModuleFactory, contextModuleFactory }) => { - interceptAllHooksFor(compilation, tracer, "Compilation"); - interceptAllHooksFor( - normalModuleFactory, - tracer, - "Normal Module Factory" - ); - interceptAllHooksFor( - contextModuleFactory, - tracer, - "Context Module Factory" - ); - interceptAllParserHooks(normalModuleFactory, tracer); - interceptAllJavascriptModulesPluginHooks(compilation, tracer); + const handleError = (err, cbs) => { + this.compiler.hooks.failed.call(err); + this.compiler.cache.beginIdle(); + this.compiler.idle = true; + this.handler(err, stats); + if (!cbs) { + cbs = this.callbacks; + this.callbacks = []; } - ); + for (const cb of cbs) cb(err); + }; - // We need to write out the CPU profile when we are all done. - compiler.hooks.done.tapAsync( - { - name: pluginName, - stage: Infinity - }, - (stats, callback) => { - if (compiler.watchMode) return callback(); - tracer.profiler.stopProfiling().then(parsedResults => { - if (parsedResults === undefined) { - tracer.profiler.destroy(); - tracer.end(callback); - return; + if ( + this.invalid && + !this.suspended && + !this.blocked && + !(this._isBlocked() && (this.blocked = true)) + ) { + if (compilation) { + logger.time("storeBuildDependencies"); + this.compiler.cache.storeBuildDependencies( + compilation.buildDependencies, + err => { + logger.timeEnd("storeBuildDependencies"); + if (err) return handleError(err); + this._go(); } + ); + } else { + this._go(); + } + return; + } - const cpuStartTime = parsedResults.profile.startTime; - const cpuEndTime = parsedResults.profile.endTime; - - tracer.trace.completeEvent({ - name: "TaskQueueManager::ProcessTaskFromWorkQueue", - id: ++tracer.counter, - cat: ["toplevel"], - ts: cpuStartTime, - args: { - src_file: "../../ipc/ipc_moji_bootstrap.cc", - src_func: "Accept" - } - }); - - tracer.trace.completeEvent({ - name: "EvaluateScript", - id: ++tracer.counter, - cat: ["devtools.timeline"], - ts: cpuStartTime, - dur: cpuEndTime - cpuStartTime, - args: { - data: { - url: "webpack", - lineNumber: 1, - columnNumber: 1, - frame: "0xFFF" - } - } - }); + if (compilation) { + compilation.startTime = this.startTime; + compilation.endTime = Date.now(); + stats = new Stats(compilation); + } + this.startTime = null; + if (err) return handleError(err); - tracer.trace.instantEvent({ - name: "CpuProfile", - id: ++tracer.counter, - cat: ["disabled-by-default-devtools.timeline"], - ts: cpuEndTime, - args: { - data: { - cpuProfile: parsedResults.profile - } + const cbs = this.callbacks; + this.callbacks = []; + logger.time("done hook"); + this.compiler.hooks.done.callAsync(stats, err => { + logger.timeEnd("done hook"); + if (err) return handleError(err, cbs); + this.handler(null, stats); + logger.time("storeBuildDependencies"); + this.compiler.cache.storeBuildDependencies( + compilation.buildDependencies, + err => { + logger.timeEnd("storeBuildDependencies"); + if (err) return handleError(err, cbs); + logger.time("beginIdle"); + this.compiler.cache.beginIdle(); + this.compiler.idle = true; + logger.timeEnd("beginIdle"); + process.nextTick(() => { + if (!this.closed) { + this.watch( + compilation.fileDependencies, + compilation.contextDependencies, + compilation.missingDependencies + ); } }); - - tracer.profiler.destroy(); - tracer.end(callback); - }); - } - ); - } -} - -const interceptAllHooksFor = (instance, tracer, logLabel) => { - if (Reflect.has(instance, "hooks")) { - Object.keys(instance.hooks).forEach(hookName => { - const hook = instance.hooks[hookName]; - if (hook && !hook._fakeHook) { - hook.intercept(makeInterceptorFor(logLabel, tracer)(hookName)); - } + for (const cb of cbs) cb(null); + this.compiler.hooks.afterDone.call(stats); + } + ); }); } -}; -const interceptAllParserHooks = (moduleFactory, tracer) => { - const moduleTypes = [ - "javascript/auto", - "javascript/dynamic", - "javascript/esm", - "json", - "webassembly/async", - "webassembly/sync" - ]; + /** + * @param {Iterable} files watched files + * @param {Iterable} dirs watched directories + * @param {Iterable} missing watched existence entries + * @returns {void} + */ + watch(files, dirs, missing) { + this.pausedWatcher = null; + this.watcher = this.compiler.watchFileSystem.watch( + files, + dirs, + missing, + this.lastWatcherStartTime, + this.watchOptions, + ( + err, + fileTimeInfoEntries, + contextTimeInfoEntries, + changedFiles, + removedFiles + ) => { + if (err) { + this.compiler.modifiedFiles = undefined; + this.compiler.removedFiles = undefined; + this.compiler.fileTimestamps = undefined; + this.compiler.contextTimestamps = undefined; + this.compiler.fsStartTime = undefined; + return this.handler(err); + } + this._invalidate( + fileTimeInfoEntries, + contextTimeInfoEntries, + changedFiles, + removedFiles + ); + this._onChange(); + }, + (fileName, changeTime) => { + if (!this._invalidReported) { + this._invalidReported = true; + this.compiler.hooks.invalid.call(fileName, changeTime); + } + this._onInvalid(); + } + ); + } - moduleTypes.forEach(moduleType => { - moduleFactory.hooks.parser - .for(moduleType) - .tap("ProfilingPlugin", (parser, parserOpts) => { - interceptAllHooksFor(parser, tracer, "Parser"); - }); - }); -}; + /** + * @param {Callback=} callback signals when the build has completed again + * @returns {void} + */ + invalidate(callback) { + if (callback) { + this.callbacks.push(callback); + } + if (!this._invalidReported) { + this._invalidReported = true; + this.compiler.hooks.invalid.call(null, Date.now()); + } + this._onChange(); + this._invalidate(); + } -const interceptAllJavascriptModulesPluginHooks = (compilation, tracer) => { - interceptAllHooksFor( - { - hooks: - (__webpack_require__(89464).getCompilationHooks)( - compilation - ) - }, - tracer, - "JavascriptModulesPlugin" - ); -}; + _invalidate( + fileTimeInfoEntries, + contextTimeInfoEntries, + changedFiles, + removedFiles + ) { + if (this.suspended || (this._isBlocked() && (this.blocked = true))) { + this._mergeWithCollected(changedFiles, removedFiles); + return; + } -const makeInterceptorFor = (instance, tracer) => hookName => ({ - register: tapInfo => { - const { name, type, fn } = tapInfo; - const newFn = - // Don't tap our own hooks to ensure stream can close cleanly - name === pluginName - ? fn - : makeNewProfiledTapFn(hookName, tracer, { - name, - type, - fn - }); - return { - ...tapInfo, - fn: newFn - }; + if (this.running) { + this._mergeWithCollected(changedFiles, removedFiles); + this.invalid = true; + } else { + this._go( + fileTimeInfoEntries, + contextTimeInfoEntries, + changedFiles, + removedFiles + ); + } } -}); -// TODO improve typing -/** @typedef {(...args: TODO[]) => void | Promise} PluginFunction */ + suspend() { + this.suspended = true; + } -/** - * @param {string} hookName Name of the hook to profile. - * @param {Trace} tracer The trace object. - * @param {object} options Options for the profiled fn. - * @param {string} options.name Plugin name - * @param {string} options.type Plugin type (sync | async | promise) - * @param {PluginFunction} options.fn Plugin function - * @returns {PluginFunction} Chainable hooked function. - */ -const makeNewProfiledTapFn = (hookName, tracer, { name, type, fn }) => { - const defaultCategory = ["blink.user_timing"]; + resume() { + if (this.suspended) { + this.suspended = false; + this._invalidate(); + } + } - switch (type) { - case "promise": - return (...args) => { - const id = ++tracer.counter; - tracer.trace.begin({ - name, - id, - cat: defaultCategory - }); - const promise = /** @type {Promise<*>} */ (fn(...args)); - return promise.then(r => { - tracer.trace.end({ - name, - id, - cat: defaultCategory - }); - return r; - }); - }; - case "async": - return (...args) => { - const id = ++tracer.counter; - tracer.trace.begin({ - name, - id, - cat: defaultCategory - }); - const callback = args.pop(); - fn(...args, (...r) => { - tracer.trace.end({ - name, - id, - cat: defaultCategory - }); - callback(...r); - }); + /** + * @param {Callback} callback signals when the watcher is closed + * @returns {void} + */ + close(callback) { + if (this._closeCallbacks) { + if (callback) { + this._closeCallbacks.push(callback); + } + return; + } + const finalCallback = (err, compilation) => { + this.running = false; + this.compiler.running = false; + this.compiler.watching = undefined; + this.compiler.watchMode = false; + this.compiler.modifiedFiles = undefined; + this.compiler.removedFiles = undefined; + this.compiler.fileTimestamps = undefined; + this.compiler.contextTimestamps = undefined; + this.compiler.fsStartTime = undefined; + const shutdown = err => { + this.compiler.hooks.watchClose.call(); + const closeCallbacks = this._closeCallbacks; + this._closeCallbacks = undefined; + for (const cb of closeCallbacks) cb(err); }; - case "sync": - return (...args) => { - const id = ++tracer.counter; - // Do not instrument ourself due to the CPU - // profile needing to be the last event in the trace. - if (name === pluginName) { - return fn(...args); - } + if (compilation) { + const logger = compilation.getLogger("webpack.Watching"); + logger.time("storeBuildDependencies"); + this.compiler.cache.storeBuildDependencies( + compilation.buildDependencies, + err2 => { + logger.timeEnd("storeBuildDependencies"); + shutdown(err || err2); + } + ); + } else { + shutdown(err); + } + }; - tracer.trace.begin({ - name, - id, - cat: defaultCategory - }); - let r; - try { - r = fn(...args); - } catch (error) { - tracer.trace.end({ - name, - id, - cat: defaultCategory - }); - throw error; - } - tracer.trace.end({ - name, - id, - cat: defaultCategory - }); - return r; - }; - default: - break; + this.closed = true; + if (this.watcher) { + this.watcher.close(); + this.watcher = null; + } + if (this.pausedWatcher) { + this.pausedWatcher.close(); + this.pausedWatcher = null; + } + this._closeCallbacks = []; + if (callback) { + this._closeCallbacks.push(callback); + } + if (this.running) { + this.invalid = true; + this._done = finalCallback; + } else { + finalCallback(); + } } -}; +} -module.exports = ProfilingPlugin; -module.exports.Profiler = Profiler; +module.exports = Watching; /***/ }), -/***/ 96816: +/***/ 53799: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Jarid Margolin @jaridmargolin */ -const RuntimeGlobals = __webpack_require__(16475); +const inspect = (__webpack_require__(73837).inspect.custom); const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Module")} Module */ -/** @type {Record} */ -const DEFINITIONS = { - f: { - definition: "var __WEBPACK_AMD_DEFINE_RESULT__;", - content: `!(__WEBPACK_AMD_DEFINE_RESULT__ = (#).call(exports, __webpack_require__, exports, module), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`, - requests: [ - RuntimeGlobals.require, - RuntimeGlobals.exports, - RuntimeGlobals.module - ] - }, - o: { - definition: "", - content: "!(module.exports = #)", - requests: [RuntimeGlobals.module] - }, - of: { - definition: - "var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;", - content: `!(__WEBPACK_AMD_DEFINE_FACTORY__ = (#), - __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? - (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : - __WEBPACK_AMD_DEFINE_FACTORY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`, - requests: [ - RuntimeGlobals.require, - RuntimeGlobals.exports, - RuntimeGlobals.module - ] - }, - af: { - definition: - "var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;", - content: `!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, __WEBPACK_AMD_DEFINE_RESULT__ = (#).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`, - requests: [RuntimeGlobals.exports, RuntimeGlobals.module] - }, - ao: { - definition: "", - content: "!(#, module.exports = #)", - requests: [RuntimeGlobals.module] - }, - aof: { - definition: - "var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;", - content: `!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, __WEBPACK_AMD_DEFINE_FACTORY__ = (#), - __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? - (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`, - requests: [RuntimeGlobals.exports, RuntimeGlobals.module] - }, - lf: { - definition: "var XXX, XXXmodule;", - content: - "!(XXXmodule = { id: YYY, exports: {}, loaded: false }, XXX = (#).call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule), XXXmodule.loaded = true, XXX === undefined && (XXX = XXXmodule.exports))", - requests: [RuntimeGlobals.require, RuntimeGlobals.module] - }, - lo: { - definition: "var XXX;", - content: "!(XXX = #)", - requests: [] - }, - lof: { - definition: "var XXX, XXXfactory, XXXmodule;", - content: - "!(XXXfactory = (#), (typeof XXXfactory === 'function' ? ((XXXmodule = { id: YYY, exports: {}, loaded: false }), (XXX = XXXfactory.call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule)), (XXXmodule.loaded = true), XXX === undefined && (XXX = XXXmodule.exports)) : XXX = XXXfactory))", - requests: [RuntimeGlobals.require, RuntimeGlobals.module] - }, - laf: { - definition: "var __WEBPACK_AMD_DEFINE_ARRAY__, XXX, XXXexports;", - content: - "!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, XXX = (#).apply(XXXexports = {}, __WEBPACK_AMD_DEFINE_ARRAY__), XXX === undefined && (XXX = XXXexports))", - requests: [] - }, - lao: { - definition: "var XXX;", - content: "!(#, XXX = #)", - requests: [] - }, - laof: { - definition: "var XXXarray, XXXfactory, XXXexports, XXX;", - content: `!(XXXarray = #, XXXfactory = (#), - (typeof XXXfactory === 'function' ? - ((XXX = XXXfactory.apply(XXXexports = {}, XXXarray)), XXX === undefined && (XXX = XXXexports)) : - (XXX = XXXfactory) - ))`, - requests: [] - } -}; +class WebpackError extends Error { + /** + * Creates an instance of WebpackError. + * @param {string=} message error message + */ + constructor(message) { + super(message); -class AMDDefineDependency extends NullDependency { - constructor(range, arrayRange, functionRange, objectRange, namedModule) { - super(); - this.range = range; - this.arrayRange = arrayRange; - this.functionRange = functionRange; - this.objectRange = objectRange; - this.namedModule = namedModule; - this.localModule = null; + this.details = undefined; + /** @type {Module} */ + this.module = undefined; + /** @type {DependencyLocation} */ + this.loc = undefined; + /** @type {boolean} */ + this.hideStack = undefined; + /** @type {Chunk} */ + this.chunk = undefined; + /** @type {string} */ + this.file = undefined; } - get type() { - return "amd define"; + [inspect]() { + return this.stack + (this.details ? `\n${this.details}` : ""); } - serialize(context) { - const { write } = context; - write(this.range); - write(this.arrayRange); - write(this.functionRange); - write(this.objectRange); - write(this.namedModule); - write(this.localModule); - super.serialize(context); + serialize({ write }) { + write(this.name); + write(this.message); + write(this.stack); + write(this.details); + write(this.loc); + write(this.hideStack); } - deserialize(context) { - const { read } = context; - this.range = read(); - this.arrayRange = read(); - this.functionRange = read(); - this.objectRange = read(); - this.namedModule = read(); - this.localModule = read(); - super.deserialize(context); + deserialize({ read }) { + this.name = read(); + this.message = read(); + this.stack = read(); + this.details = read(); + this.loc = read(); + this.hideStack = read(); } } -makeSerializable( - AMDDefineDependency, - "webpack/lib/dependencies/AMDDefineDependency" -); +makeSerializable(WebpackError, "webpack/lib/WebpackError"); -AMDDefineDependency.Template = class AMDDefineDependencyTemplate extends ( - NullDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, { runtimeRequirements }) { - const dep = /** @type {AMDDefineDependency} */ (dependency); - const branch = this.branch(dep); - const { definition, content, requests } = DEFINITIONS[branch]; - for (const req of requests) { - runtimeRequirements.add(req); - } - this.replace(dep, source, definition, content); - } +module.exports = WebpackError; - localModuleVar(dependency) { - return ( - dependency.localModule && - dependency.localModule.used && - dependency.localModule.variableName() - ); - } - branch(dependency) { - const localModuleVar = this.localModuleVar(dependency) ? "l" : ""; - const arrayRange = dependency.arrayRange ? "a" : ""; - const objectRange = dependency.objectRange ? "o" : ""; - const functionRange = dependency.functionRange ? "f" : ""; - return localModuleVar + arrayRange + objectRange + functionRange; - } +/***/ }), - replace(dependency, source, definition, text) { - const localModuleVar = this.localModuleVar(dependency); - if (localModuleVar) { - text = text.replace(/XXX/g, localModuleVar.replace(/\$/g, "$$$$")); - definition = definition.replace( - /XXX/g, - localModuleVar.replace(/\$/g, "$$$$") - ); - } +/***/ 97017: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (dependency.namedModule) { - text = text.replace(/YYY/g, JSON.stringify(dependency.namedModule)); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ - const texts = text.split("#"); - if (definition) source.insert(0, definition); - let current = dependency.range[0]; - if (dependency.arrayRange) { - source.replace(current, dependency.arrayRange[0] - 1, texts.shift()); - current = dependency.arrayRange[1]; - } +const IgnoreErrorModuleFactory = __webpack_require__(3); +const WebpackIsIncludedDependency = __webpack_require__(26505); +const { + toConstantDependency +} = __webpack_require__(93998); - if (dependency.objectRange) { - source.replace(current, dependency.objectRange[0] - 1, texts.shift()); - current = dependency.objectRange[1]; - } else if (dependency.functionRange) { - source.replace(current, dependency.functionRange[0] - 1, texts.shift()); - current = dependency.functionRange[1]; - } - source.replace(current, dependency.range[1] - 1, texts.shift()); - if (texts.length > 0) throw new Error("Implementation error"); +/** @typedef {import("enhanced-resolve/lib/Resolver")} Resolver */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ + +class WebpackIsIncludedPlugin { + /** + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "WebpackIsIncludedPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + WebpackIsIncludedDependency, + new IgnoreErrorModuleFactory(normalModuleFactory) + ); + compilation.dependencyTemplates.set( + WebpackIsIncludedDependency, + new WebpackIsIncludedDependency.Template() + ); + + /** + * @param {JavascriptParser} parser the parser + * @returns {void} + */ + const handler = parser => { + parser.hooks.call + .for("__webpack_is_included__") + .tap("WebpackIsIncludedPlugin", expr => { + if ( + expr.type !== "CallExpression" || + expr.arguments.length !== 1 || + expr.arguments[0].type === "SpreadElement" + ) + return; + + const request = parser.evaluateExpression(expr.arguments[0]); + + if (!request.isString()) return; + + const dep = new WebpackIsIncludedDependency( + request.string, + expr.range + ); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + return true; + }); + parser.hooks.typeof + .for("__webpack_is_included__") + .tap( + "WebpackIsIncludedPlugin", + toConstantDependency(parser, JSON.stringify("function")) + ); + }; + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("WebpackIsIncludedPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("WebpackIsIncludedPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("WebpackIsIncludedPlugin", handler); + } + ); } -}; +} -module.exports = AMDDefineDependency; +module.exports = WebpackIsIncludedPlugin; /***/ }), -/***/ 48519: +/***/ 88422: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -71013,1067 +64635,1522 @@ module.exports = AMDDefineDependency; -const RuntimeGlobals = __webpack_require__(16475); -const AMDDefineDependency = __webpack_require__(96816); -const AMDRequireArrayDependency = __webpack_require__(33516); -const AMDRequireContextDependency = __webpack_require__(96123); -const AMDRequireItemDependency = __webpack_require__(71806); -const ConstDependency = __webpack_require__(76911); -const ContextDependencyHelpers = __webpack_require__(99630); -const DynamicExports = __webpack_require__(32006); -const LocalModuleDependency = __webpack_require__(52805); -const { addLocalModule, getLocalModule } = __webpack_require__(75827); +const OptionsApply = __webpack_require__(81426); -const isBoundFunctionExpression = expr => { - if (expr.type !== "CallExpression") return false; - if (expr.callee.type !== "MemberExpression") return false; - if (expr.callee.computed) return false; - if (expr.callee.object.type !== "FunctionExpression") return false; - if (expr.callee.property.type !== "Identifier") return false; - if (expr.callee.property.name !== "bind") return false; - return true; -}; +const AssetModulesPlugin = __webpack_require__(16109); +const JavascriptModulesPlugin = __webpack_require__(89464); +const JsonModulesPlugin = __webpack_require__(86770); -const isUnboundFunctionExpression = expr => { - if (expr.type === "FunctionExpression") return true; - if (expr.type === "ArrowFunctionExpression") return true; - return false; -}; +const ChunkPrefetchPreloadPlugin = __webpack_require__(33895); -const isCallable = expr => { - if (isUnboundFunctionExpression(expr)) return true; - if (isBoundFunctionExpression(expr)) return true; - return false; -}; +const EntryOptionPlugin = __webpack_require__(9909); +const RecordIdsPlugin = __webpack_require__(11094); -class AMDDefineDependencyParserPlugin { - constructor(options) { - this.options = options; +const RuntimePlugin = __webpack_require__(2307); + +const APIPlugin = __webpack_require__(74315); +const CompatibilityPlugin = __webpack_require__(94258); +const ConstPlugin = __webpack_require__(11146); +const ExportsInfoApiPlugin = __webpack_require__(7145); +const WebpackIsIncludedPlugin = __webpack_require__(97017); + +const TemplatedPathPlugin = __webpack_require__(80734); +const UseStrictPlugin = __webpack_require__(36803); +const WarnCaseSensitiveModulesPlugin = __webpack_require__(56504); + +const DataUriPlugin = __webpack_require__(64820); +const FileUriPlugin = __webpack_require__(57637); + +const ResolverCachePlugin = __webpack_require__(97347); + +const CommonJsPlugin = __webpack_require__(32406); +const HarmonyModulesPlugin = __webpack_require__(39029); +const ImportMetaPlugin = __webpack_require__(17228); +const ImportPlugin = __webpack_require__(41293); +const LoaderPlugin = __webpack_require__(24721); +const RequireContextPlugin = __webpack_require__(2928); +const RequireEnsurePlugin = __webpack_require__(8434); +const RequireIncludePlugin = __webpack_require__(37378); +const SystemPlugin = __webpack_require__(97981); +const URLPlugin = __webpack_require__(14412); +const WorkerPlugin = __webpack_require__(82509); + +const InferAsyncModulesPlugin = __webpack_require__(59498); + +const JavascriptMetaInfoPlugin = __webpack_require__(52329); +const DefaultStatsFactoryPlugin = __webpack_require__(71760); +const DefaultStatsPresetPlugin = __webpack_require__(55442); +const DefaultStatsPrinterPlugin = __webpack_require__(58692); + +const { cleverMerge } = __webpack_require__(60839); + +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./Compiler")} Compiler */ + +class WebpackOptionsApply extends OptionsApply { + constructor() { + super(); } - apply(parser) { - parser.hooks.call - .for("define") - .tap( - "AMDDefineDependencyParserPlugin", - this.processCallDefine.bind(this, parser) + /** + * @param {WebpackOptions} options options object + * @param {Compiler} compiler compiler object + * @returns {WebpackOptions} options object + */ + process(options, compiler) { + compiler.outputPath = options.output.path; + compiler.recordsInputPath = options.recordsInputPath || null; + compiler.recordsOutputPath = options.recordsOutputPath || null; + compiler.name = options.name; + + if (options.externals) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const ExternalsPlugin = __webpack_require__(6652); + new ExternalsPlugin(options.externalsType, options.externals).apply( + compiler ); - } + } - processArray(parser, expr, param, identifiers, namedModule) { - if (param.isArray()) { - param.items.forEach((param, idx) => { - if ( - param.isString() && - ["require", "module", "exports"].includes(param.string) - ) - identifiers[idx] = param.string; - const result = this.processItem(parser, expr, param, namedModule); - if (result === undefined) { - this.processContext(parser, expr, param); - } - }); - return true; - } else if (param.isConstArray()) { - const deps = []; - param.array.forEach((request, idx) => { - let dep; - let localModule; - if (request === "require") { - identifiers[idx] = request; - dep = "__webpack_require__"; - } else if (["exports", "module"].includes(request)) { - identifiers[idx] = request; - dep = request; - } else if ((localModule = getLocalModule(parser.state, request))) { - localModule.flagUsed(); - dep = new LocalModuleDependency(localModule, undefined, false); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - } else { - dep = this.newRequireItemDependency(request); - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - } - deps.push(dep); - }); - const dep = this.newRequireArrayDependency(deps, param.range); - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.module.addPresentationalDependency(dep); - return true; + if (options.externalsPresets.node) { + const NodeTargetPlugin = __webpack_require__(17916); + new NodeTargetPlugin().apply(compiler); } - } - processItem(parser, expr, param, namedModule) { - if (param.isConditional()) { - param.options.forEach(param => { - const result = this.processItem(parser, expr, param); - if (result === undefined) { - this.processContext(parser, expr, param); - } - }); - return true; - } else if (param.isString()) { - let dep, localModule; - if (param.string === "require") { - dep = new ConstDependency("__webpack_require__", param.range, [ - RuntimeGlobals.require - ]); - } else if (param.string === "exports") { - dep = new ConstDependency("exports", param.range, [ - RuntimeGlobals.exports - ]); - } else if (param.string === "module") { - dep = new ConstDependency("module", param.range, [ - RuntimeGlobals.module - ]); - } else if ( - (localModule = getLocalModule(parser.state, param.string, namedModule)) - ) { - localModule.flagUsed(); - dep = new LocalModuleDependency(localModule, param.range, false); - } else { - dep = this.newRequireItemDependency(param.string, param.range); - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; - } - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; + if (options.externalsPresets.electronMain) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const ElectronTargetPlugin = __webpack_require__(32277); + new ElectronTargetPlugin("main").apply(compiler); + } + if (options.externalsPresets.electronPreload) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const ElectronTargetPlugin = __webpack_require__(32277); + new ElectronTargetPlugin("preload").apply(compiler); + } + if (options.externalsPresets.electronRenderer) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const ElectronTargetPlugin = __webpack_require__(32277); + new ElectronTargetPlugin("renderer").apply(compiler); + } + if ( + options.externalsPresets.electron && + !options.externalsPresets.electronMain && + !options.externalsPresets.electronPreload && + !options.externalsPresets.electronRenderer + ) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const ElectronTargetPlugin = __webpack_require__(32277); + new ElectronTargetPlugin().apply(compiler); + } + if (options.externalsPresets.nwjs) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const ExternalsPlugin = __webpack_require__(6652); + new ExternalsPlugin("node-commonjs", "nw.gui").apply(compiler); + } + if (options.externalsPresets.webAsync) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const ExternalsPlugin = __webpack_require__(6652); + new ExternalsPlugin( + "import", + options.experiments.css + ? ({ request, dependencyType }, callback) => { + if (dependencyType === "url") { + if (/^(\/\/|https?:\/\/)/.test(request)) + return callback(null, `asset ${request}`); + } else if (dependencyType === "css-import") { + if (/^(\/\/|https?:\/\/)/.test(request)) + return callback(null, `css-import ${request}`); + } else if (/^(\/\/|https?:\/\/|std:)/.test(request)) { + if (/^\.css(\?|$)/.test(request)) + return callback(null, `css-import ${request}`); + return callback(null, `import ${request}`); + } + callback(); + } + : /^(\/\/|https?:\/\/|std:)/ + ).apply(compiler); + } else if (options.externalsPresets.web) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const ExternalsPlugin = __webpack_require__(6652); + new ExternalsPlugin( + "module", + options.experiments.css + ? ({ request, dependencyType }, callback) => { + if (dependencyType === "url") { + if (/^(\/\/|https?:\/\/)/.test(request)) + return callback(null, `asset ${request}`); + } else if (dependencyType === "css-import") { + if (/^(\/\/|https?:\/\/)/.test(request)) + return callback(null, `css-import ${request}`); + } else if (/^(\/\/|https?:\/\/|std:)/.test(request)) { + if (/^\.css(\?|$)/.test(request)) + return callback(null, `css-import ${request}`); + return callback(null, `module ${request}`); + } + callback(); + } + : /^(\/\/|https?:\/\/|std:)/ + ).apply(compiler); } - } - processContext(parser, expr, param) { - const dep = ContextDependencyHelpers.create( - AMDRequireContextDependency, - param.range, - param, - expr, - this.options, - { - category: "amd" - }, - parser - ); - if (!dep) return; - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; - } - processCallDefine(parser, expr) { - let array, fn, obj, namedModule; - switch (expr.arguments.length) { - case 1: - if (isCallable(expr.arguments[0])) { - // define(f() {…}) - fn = expr.arguments[0]; - } else if (expr.arguments[0].type === "ObjectExpression") { - // define({…}) - obj = expr.arguments[0]; - } else { - // define(expr) - // unclear if function or object - obj = fn = expr.arguments[0]; + new ChunkPrefetchPreloadPlugin().apply(compiler); + + if (typeof options.output.chunkFormat === "string") { + switch (options.output.chunkFormat) { + case "array-push": { + const ArrayPushCallbackChunkFormatPlugin = __webpack_require__(18535); + new ArrayPushCallbackChunkFormatPlugin().apply(compiler); + break; } - break; - case 2: - if (expr.arguments[0].type === "Literal") { - namedModule = expr.arguments[0].value; - // define("…", …) - if (isCallable(expr.arguments[1])) { - // define("…", f() {…}) - fn = expr.arguments[1]; - } else if (expr.arguments[1].type === "ObjectExpression") { - // define("…", {…}) - obj = expr.arguments[1]; - } else { - // define("…", expr) - // unclear if function or object - obj = fn = expr.arguments[1]; - } - } else { - array = expr.arguments[0]; - if (isCallable(expr.arguments[1])) { - // define([…], f() {}) - fn = expr.arguments[1]; - } else if (expr.arguments[1].type === "ObjectExpression") { - // define([…], {…}) - obj = expr.arguments[1]; - } else { - // define([…], expr) - // unclear if function or object - obj = fn = expr.arguments[1]; - } + case "commonjs": { + const CommonJsChunkFormatPlugin = __webpack_require__(84508); + new CommonJsChunkFormatPlugin().apply(compiler); + break; } - break; - case 3: - // define("…", […], f() {…}) - namedModule = expr.arguments[0].value; - array = expr.arguments[1]; - if (isCallable(expr.arguments[2])) { - // define("…", […], f() {}) - fn = expr.arguments[2]; - } else if (expr.arguments[2].type === "ObjectExpression") { - // define("…", […], {…}) - obj = expr.arguments[2]; - } else { - // define("…", […], expr) - // unclear if function or object - obj = fn = expr.arguments[2]; + case "module": { + const ModuleChunkFormatPlugin = __webpack_require__(68927); + new ModuleChunkFormatPlugin().apply(compiler); + break; } - break; - default: - return; + default: + throw new Error( + "Unsupported chunk format '" + options.output.chunkFormat + "'." + ); + } } - DynamicExports.bailout(parser.state); - let fnParams = null; - let fnParamsOffset = 0; - if (fn) { - if (isUnboundFunctionExpression(fn)) { - fnParams = fn.params; - } else if (isBoundFunctionExpression(fn)) { - fnParams = fn.callee.object.params; - fnParamsOffset = fn.arguments.length - 1; - if (fnParamsOffset < 0) { - fnParamsOffset = 0; - } + + if (options.output.enabledChunkLoadingTypes.length > 0) { + for (const type of options.output.enabledChunkLoadingTypes) { + const EnableChunkLoadingPlugin = __webpack_require__(61291); + new EnableChunkLoadingPlugin(type).apply(compiler); } } - let fnRenames = new Map(); - if (array) { - const identifiers = {}; - const param = parser.evaluateExpression(array); - const result = this.processArray( - parser, - expr, - param, - identifiers, - namedModule + + if (options.output.enabledWasmLoadingTypes.length > 0) { + for (const type of options.output.enabledWasmLoadingTypes) { + const EnableWasmLoadingPlugin = __webpack_require__(78613); + new EnableWasmLoadingPlugin(type).apply(compiler); + } + } + + if (options.output.enabledLibraryTypes.length > 0) { + for (const type of options.output.enabledLibraryTypes) { + const EnableLibraryPlugin = __webpack_require__(91452); + new EnableLibraryPlugin(type).apply(compiler); + } + } + + if (options.output.pathinfo) { + const ModuleInfoHeaderPlugin = __webpack_require__(3454); + new ModuleInfoHeaderPlugin(options.output.pathinfo !== true).apply( + compiler ); - if (!result) return; - if (fnParams) { - fnParams = fnParams.slice(fnParamsOffset).filter((param, idx) => { - if (identifiers[idx]) { - fnRenames.set(param.name, parser.getVariableInfo(identifiers[idx])); - return false; - } - return true; - }); + } + + if (options.output.clean) { + const CleanPlugin = __webpack_require__(31085); + new CleanPlugin( + options.output.clean === true ? {} : options.output.clean + ).apply(compiler); + } + + if (options.devtool) { + if (options.devtool.includes("source-map")) { + const hidden = options.devtool.includes("hidden"); + const inline = options.devtool.includes("inline"); + const evalWrapped = options.devtool.includes("eval"); + const cheap = options.devtool.includes("cheap"); + const moduleMaps = options.devtool.includes("module"); + const noSources = options.devtool.includes("nosources"); + const Plugin = evalWrapped + ? __webpack_require__(14790) + : __webpack_require__(63872); + new Plugin({ + filename: inline ? null : options.output.sourceMapFilename, + moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate, + fallbackModuleFilenameTemplate: + options.output.devtoolFallbackModuleFilenameTemplate, + append: hidden ? false : undefined, + module: moduleMaps ? true : cheap ? false : true, + columns: cheap ? false : true, + noSources: noSources, + namespace: options.output.devtoolNamespace + }).apply(compiler); + } else if (options.devtool.includes("eval")) { + const EvalDevToolModulePlugin = __webpack_require__(65218); + new EvalDevToolModulePlugin({ + moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate, + namespace: options.output.devtoolNamespace + }).apply(compiler); + } + } + + new JavascriptModulesPlugin().apply(compiler); + new JsonModulesPlugin().apply(compiler); + new AssetModulesPlugin().apply(compiler); + + if (!options.experiments.outputModule) { + if (options.output.module) { + throw new Error( + "'output.module: true' is only allowed when 'experiments.outputModule' is enabled" + ); + } + if (options.output.enabledLibraryTypes.includes("module")) { + throw new Error( + "library type \"module\" is only allowed when 'experiments.outputModule' is enabled" + ); } - } else { - const identifiers = ["require", "exports", "module"]; - if (fnParams) { - fnParams = fnParams.slice(fnParamsOffset).filter((param, idx) => { - if (identifiers[idx]) { - fnRenames.set(param.name, parser.getVariableInfo(identifiers[idx])); - return false; - } - return true; - }); + if (options.externalsType === "module") { + throw new Error( + "'externalsType: \"module\"' is only allowed when 'experiments.outputModule' is enabled" + ); } } - let inTry; - if (fn && isUnboundFunctionExpression(fn)) { - inTry = parser.scope.inTry; - parser.inScope(fnParams, () => { - for (const [name, varInfo] of fnRenames) { - parser.setVariable(name, varInfo); - } - parser.scope.inTry = inTry; - if (fn.body.type === "BlockStatement") { - parser.detectMode(fn.body.body); - const prev = parser.prevStatement; - parser.preWalkStatement(fn.body); - parser.prevStatement = prev; - parser.walkStatement(fn.body); - } else { - parser.walkExpression(fn.body); - } - }); - } else if (fn && isBoundFunctionExpression(fn)) { - inTry = parser.scope.inTry; - parser.inScope( - fn.callee.object.params.filter( - i => !["require", "module", "exports"].includes(i.name) - ), - () => { - for (const [name, varInfo] of fnRenames) { - parser.setVariable(name, varInfo); - } - parser.scope.inTry = inTry; - if (fn.callee.object.body.type === "BlockStatement") { - parser.detectMode(fn.callee.object.body.body); - const prev = parser.prevStatement; - parser.preWalkStatement(fn.callee.object.body); - parser.prevStatement = prev; - parser.walkStatement(fn.callee.object.body); - } else { - parser.walkExpression(fn.callee.object.body); - } - } - ); - if (fn.arguments) { - parser.walkExpressions(fn.arguments); - } - } else if (fn || obj) { - parser.walkExpression(fn || obj); + + if (options.experiments.syncWebAssembly) { + const WebAssemblyModulesPlugin = __webpack_require__(53639); + new WebAssemblyModulesPlugin({ + mangleImports: options.optimization.mangleWasmImports + }).apply(compiler); } - const dep = this.newDefineDependency( - expr.range, - array ? array.range : null, - fn ? fn.range : null, - obj ? obj.range : null, - namedModule ? namedModule : null - ); - dep.loc = expr.loc; - if (namedModule) { - dep.localModule = addLocalModule(parser.state, namedModule); + if (options.experiments.asyncWebAssembly) { + const AsyncWebAssemblyModulesPlugin = __webpack_require__(7538); + new AsyncWebAssemblyModulesPlugin({ + mangleImports: options.optimization.mangleWasmImports + }).apply(compiler); } - parser.state.module.addPresentationalDependency(dep); - return true; - } - newDefineDependency( - range, - arrayRange, - functionRange, - objectRange, - namedModule - ) { - return new AMDDefineDependency( - range, - arrayRange, - functionRange, - objectRange, - namedModule - ); - } - newRequireArrayDependency(depsArray, range) { - return new AMDRequireArrayDependency(depsArray, range); - } - newRequireItemDependency(request, range) { - return new AMDRequireItemDependency(request, range); - } -} -module.exports = AMDDefineDependencyParserPlugin; + if (options.experiments.css) { + const CssModulesPlugin = __webpack_require__(47283); + new CssModulesPlugin(options.experiments.css).apply(compiler); + } + if (options.experiments.lazyCompilation) { + const LazyCompilationPlugin = __webpack_require__(79040); + const lazyOptions = + typeof options.experiments.lazyCompilation === "object" + ? options.experiments.lazyCompilation + : null; + new LazyCompilationPlugin({ + backend: + typeof lazyOptions.backend === "function" + ? lazyOptions.backend + : __webpack_require__(17781)({ + ...lazyOptions.backend, + client: + (lazyOptions.backend && lazyOptions.backend.client) || + options.externalsPresets.node ? __webpack_require__.ab + "lazy-compilation-node.js" : __webpack_require__.ab + "lazy-compilation-web.js" + }), + entries: !lazyOptions || lazyOptions.entries !== false, + imports: !lazyOptions || lazyOptions.imports !== false, + test: (lazyOptions && lazyOptions.test) || undefined + }).apply(compiler); + } -/***/ }), + if (options.experiments.buildHttp) { + const HttpUriPlugin = __webpack_require__(42110); + const httpOptions = options.experiments.buildHttp; + new HttpUriPlugin(httpOptions).apply(compiler); + } -/***/ 50067: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + new EntryOptionPlugin().apply(compiler); + compiler.hooks.entryOption.call(options.context, options.entry); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + new RuntimePlugin().apply(compiler); + new InferAsyncModulesPlugin().apply(compiler); + new DataUriPlugin().apply(compiler); + new FileUriPlugin().apply(compiler); -const RuntimeGlobals = __webpack_require__(16475); -const { - approve, - evaluateToIdentifier, - evaluateToString, - toConstantDependency -} = __webpack_require__(93998); + new CompatibilityPlugin().apply(compiler); + new HarmonyModulesPlugin({ + topLevelAwait: options.experiments.topLevelAwait + }).apply(compiler); + if (options.amd !== false) { + const AMDPlugin = __webpack_require__(50067); + const RequireJsStuffPlugin = __webpack_require__(88846); + new AMDPlugin(options.amd || {}).apply(compiler); + new RequireJsStuffPlugin().apply(compiler); + } + new CommonJsPlugin().apply(compiler); + new LoaderPlugin({}).apply(compiler); + if (options.node !== false) { + const NodeStuffPlugin = __webpack_require__(95287); + new NodeStuffPlugin(options.node).apply(compiler); + } + new APIPlugin().apply(compiler); + new ExportsInfoApiPlugin().apply(compiler); + new WebpackIsIncludedPlugin().apply(compiler); + new ConstPlugin().apply(compiler); + new UseStrictPlugin().apply(compiler); + new RequireIncludePlugin().apply(compiler); + new RequireEnsurePlugin().apply(compiler); + new RequireContextPlugin().apply(compiler); + new ImportPlugin().apply(compiler); + new SystemPlugin().apply(compiler); + new ImportMetaPlugin().apply(compiler); + new URLPlugin().apply(compiler); + new WorkerPlugin( + options.output.workerChunkLoading, + options.output.workerWasmLoading, + options.output.module + ).apply(compiler); -const AMDDefineDependency = __webpack_require__(96816); -const AMDDefineDependencyParserPlugin = __webpack_require__(48519); -const AMDRequireArrayDependency = __webpack_require__(33516); -const AMDRequireContextDependency = __webpack_require__(96123); -const AMDRequireDependenciesBlockParserPlugin = __webpack_require__(66866); -const AMDRequireDependency = __webpack_require__(43911); -const AMDRequireItemDependency = __webpack_require__(71806); -const { - AMDDefineRuntimeModule, - AMDOptionsRuntimeModule -} = __webpack_require__(45242); -const ConstDependency = __webpack_require__(76911); -const LocalModuleDependency = __webpack_require__(52805); -const UnsupportedDependency = __webpack_require__(51669); + new DefaultStatsFactoryPlugin().apply(compiler); + new DefaultStatsPresetPlugin().apply(compiler); + new DefaultStatsPrinterPlugin().apply(compiler); -/** @typedef {import("../../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */ -/** @typedef {import("../Compiler")} Compiler */ + new JavascriptMetaInfoPlugin().apply(compiler); -class AMDPlugin { - /** - * @param {Record} amdOptions the AMD options - */ - constructor(amdOptions) { - this.amdOptions = amdOptions; - } + if (typeof options.mode !== "string") { + const WarnNoModeSetPlugin = __webpack_require__(25295); + new WarnNoModeSetPlugin().apply(compiler); + } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const amdOptions = this.amdOptions; - compiler.hooks.compilation.tap( - "AMDPlugin", - (compilation, { contextModuleFactory, normalModuleFactory }) => { - compilation.dependencyTemplates.set( - AMDRequireDependency, - new AMDRequireDependency.Template() - ); + const EnsureChunkConditionsPlugin = __webpack_require__(96260); + new EnsureChunkConditionsPlugin().apply(compiler); + if (options.optimization.removeAvailableModules) { + const RemoveParentModulesPlugin = __webpack_require__(7081); + new RemoveParentModulesPlugin().apply(compiler); + } + if (options.optimization.removeEmptyChunks) { + const RemoveEmptyChunksPlugin = __webpack_require__(84760); + new RemoveEmptyChunksPlugin().apply(compiler); + } + if (options.optimization.mergeDuplicateChunks) { + const MergeDuplicateChunksPlugin = __webpack_require__(85067); + new MergeDuplicateChunksPlugin().apply(compiler); + } + if (options.optimization.flagIncludedChunks) { + const FlagIncludedChunksPlugin = __webpack_require__(50089); + new FlagIncludedChunksPlugin().apply(compiler); + } + if (options.optimization.sideEffects) { + const SideEffectsFlagPlugin = __webpack_require__(84800); + new SideEffectsFlagPlugin( + options.optimization.sideEffects === true + ).apply(compiler); + } + if (options.optimization.providedExports) { + const FlagDependencyExportsPlugin = __webpack_require__(84506); + new FlagDependencyExportsPlugin().apply(compiler); + } + if (options.optimization.usedExports) { + const FlagDependencyUsagePlugin = __webpack_require__(58812); + new FlagDependencyUsagePlugin( + options.optimization.usedExports === "global" + ).apply(compiler); + } + if (options.optimization.innerGraph) { + const InnerGraphPlugin = __webpack_require__(28758); + new InnerGraphPlugin().apply(compiler); + } + if (options.optimization.mangleExports) { + const MangleExportsPlugin = __webpack_require__(27868); + new MangleExportsPlugin( + options.optimization.mangleExports !== "size" + ).apply(compiler); + } + if (options.optimization.concatenateModules) { + const ModuleConcatenationPlugin = __webpack_require__(74844); + new ModuleConcatenationPlugin().apply(compiler); + } + if (options.optimization.splitChunks) { + const SplitChunksPlugin = __webpack_require__(21478); + new SplitChunksPlugin(options.optimization.splitChunks).apply(compiler); + } + if (options.optimization.runtimeChunk) { + const RuntimeChunkPlugin = __webpack_require__(2837); + new RuntimeChunkPlugin(options.optimization.runtimeChunk).apply(compiler); + } + if (!options.optimization.emitOnErrors) { + const NoEmitOnErrorsPlugin = __webpack_require__(50169); + new NoEmitOnErrorsPlugin().apply(compiler); + } + if (options.optimization.realContentHash) { + const RealContentHashPlugin = __webpack_require__(46043); + new RealContentHashPlugin({ + hashFunction: options.output.hashFunction, + hashDigest: options.output.hashDigest + }).apply(compiler); + } + if (options.optimization.checkWasmTypes) { + const WasmFinalizeExportsPlugin = __webpack_require__(19810); + new WasmFinalizeExportsPlugin().apply(compiler); + } + const moduleIds = options.optimization.moduleIds; + if (moduleIds) { + switch (moduleIds) { + case "natural": { + const NaturalModuleIdsPlugin = __webpack_require__(83366); + new NaturalModuleIdsPlugin().apply(compiler); + break; + } + case "named": { + const NamedModuleIdsPlugin = __webpack_require__(24339); + new NamedModuleIdsPlugin().apply(compiler); + break; + } + case "hashed": { + const WarnDeprecatedOptionPlugin = __webpack_require__(76537); + const HashedModuleIdsPlugin = __webpack_require__(21825); + new WarnDeprecatedOptionPlugin( + "optimization.moduleIds", + "hashed", + "deterministic" + ).apply(compiler); + new HashedModuleIdsPlugin({ + hashFunction: options.output.hashFunction + }).apply(compiler); + break; + } + case "deterministic": { + const DeterministicModuleIdsPlugin = __webpack_require__(76692); + new DeterministicModuleIdsPlugin().apply(compiler); + break; + } + case "size": { + const OccurrenceModuleIdsPlugin = __webpack_require__(35371); + new OccurrenceModuleIdsPlugin({ + prioritiseInitial: true + }).apply(compiler); + break; + } + default: + throw new Error( + `webpack bug: moduleIds: ${moduleIds} is not implemented` + ); + } + } + const chunkIds = options.optimization.chunkIds; + if (chunkIds) { + switch (chunkIds) { + case "natural": { + const NaturalChunkIdsPlugin = __webpack_require__(86221); + new NaturalChunkIdsPlugin().apply(compiler); + break; + } + case "named": { + const NamedChunkIdsPlugin = __webpack_require__(6454); + new NamedChunkIdsPlugin().apply(compiler); + break; + } + case "deterministic": { + const DeterministicChunkIdsPlugin = __webpack_require__(8747); + new DeterministicChunkIdsPlugin().apply(compiler); + break; + } + case "size": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const OccurrenceChunkIdsPlugin = __webpack_require__(51020); + new OccurrenceChunkIdsPlugin({ + prioritiseInitial: true + }).apply(compiler); + break; + } + case "total-size": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const OccurrenceChunkIdsPlugin = __webpack_require__(51020); + new OccurrenceChunkIdsPlugin({ + prioritiseInitial: false + }).apply(compiler); + break; + } + default: + throw new Error( + `webpack bug: chunkIds: ${chunkIds} is not implemented` + ); + } + } + if (options.optimization.nodeEnv) { + const DefinePlugin = __webpack_require__(79065); + new DefinePlugin({ + "process.env.NODE_ENV": JSON.stringify(options.optimization.nodeEnv) + }).apply(compiler); + } + if (options.optimization.minimize) { + for (const minimizer of options.optimization.minimizer) { + if (typeof minimizer === "function") { + minimizer.call(compiler, compiler); + } else if (minimizer !== "...") { + minimizer.apply(compiler); + } + } + } - compilation.dependencyFactories.set( - AMDRequireItemDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - AMDRequireItemDependency, - new AMDRequireItemDependency.Template() - ); + if (options.performance) { + const SizeLimitsPlugin = __webpack_require__(32557); + new SizeLimitsPlugin(options.performance).apply(compiler); + } - compilation.dependencyTemplates.set( - AMDRequireArrayDependency, - new AMDRequireArrayDependency.Template() - ); + new TemplatedPathPlugin().apply(compiler); - compilation.dependencyFactories.set( - AMDRequireContextDependency, - contextModuleFactory - ); - compilation.dependencyTemplates.set( - AMDRequireContextDependency, - new AMDRequireContextDependency.Template() - ); + new RecordIdsPlugin({ + portableIds: options.optimization.portableRecords + }).apply(compiler); - compilation.dependencyTemplates.set( - AMDDefineDependency, - new AMDDefineDependency.Template() - ); + new WarnCaseSensitiveModulesPlugin().apply(compiler); - compilation.dependencyTemplates.set( - UnsupportedDependency, - new UnsupportedDependency.Template() - ); + const AddManagedPathsPlugin = __webpack_require__(47942); + new AddManagedPathsPlugin( + options.snapshot.managedPaths, + options.snapshot.immutablePaths + ).apply(compiler); + + if (options.cache && typeof options.cache === "object") { + const cacheOptions = options.cache; + switch (cacheOptions.type) { + case "memory": { + if (isFinite(cacheOptions.maxGenerations)) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const MemoryWithGcCachePlugin = __webpack_require__(99334); + new MemoryWithGcCachePlugin({ + maxGenerations: cacheOptions.maxGenerations + }).apply(compiler); + } else { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const MemoryCachePlugin = __webpack_require__(52539); + new MemoryCachePlugin().apply(compiler); + } + if (cacheOptions.cacheUnaffected) { + if (!options.experiments.cacheUnaffected) { + throw new Error( + "'cache.cacheUnaffected: true' is only allowed when 'experiments.cacheUnaffected' is enabled" + ); + } + compiler.moduleMemCaches = new Map(); + } + break; + } + case "filesystem": { + const AddBuildDependenciesPlugin = __webpack_require__(28034); + for (const key in cacheOptions.buildDependencies) { + const list = cacheOptions.buildDependencies[key]; + new AddBuildDependenciesPlugin(list).apply(compiler); + } + if (!isFinite(cacheOptions.maxMemoryGenerations)) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const MemoryCachePlugin = __webpack_require__(52539); + new MemoryCachePlugin().apply(compiler); + } else if (cacheOptions.maxMemoryGenerations !== 0) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const MemoryWithGcCachePlugin = __webpack_require__(99334); + new MemoryWithGcCachePlugin({ + maxGenerations: cacheOptions.maxMemoryGenerations + }).apply(compiler); + } + if (cacheOptions.memoryCacheUnaffected) { + if (!options.experiments.cacheUnaffected) { + throw new Error( + "'cache.memoryCacheUnaffected: true' is only allowed when 'experiments.cacheUnaffected' is enabled" + ); + } + compiler.moduleMemCaches = new Map(); + } + switch (cacheOptions.store) { + case "pack": { + const IdleFileCachePlugin = __webpack_require__(71985); + const PackFileCacheStrategy = __webpack_require__(86180); + new IdleFileCachePlugin( + new PackFileCacheStrategy({ + compiler, + fs: compiler.intermediateFileSystem, + context: options.context, + cacheLocation: cacheOptions.cacheLocation, + version: cacheOptions.version, + logger: compiler.getInfrastructureLogger( + "webpack.cache.PackFileCacheStrategy" + ), + snapshot: options.snapshot, + maxAge: cacheOptions.maxAge, + profile: cacheOptions.profile, + allowCollectingMemory: cacheOptions.allowCollectingMemory, + compression: cacheOptions.compression + }), + cacheOptions.idleTimeout, + cacheOptions.idleTimeoutForInitialStore, + cacheOptions.idleTimeoutAfterLargeChanges + ).apply(compiler); + break; + } + default: + throw new Error("Unhandled value for cache.store"); + } + break; + } + default: + // @ts-expect-error Property 'type' does not exist on type 'never'. ts(2339) + throw new Error(`Unknown cache type ${cacheOptions.type}`); + } + } + new ResolverCachePlugin().apply(compiler); - compilation.dependencyTemplates.set( - LocalModuleDependency, - new LocalModuleDependency.Template() - ); + if (options.ignoreWarnings && options.ignoreWarnings.length > 0) { + const IgnoreWarningsPlugin = __webpack_require__(41606); + new IgnoreWarningsPlugin(options.ignoreWarnings).apply(compiler); + } - compilation.hooks.runtimeRequirementInModule - .for(RuntimeGlobals.amdDefine) - .tap("AMDPlugin", (module, set) => { - set.add(RuntimeGlobals.require); - }); + compiler.hooks.afterPlugins.call(compiler); + if (!compiler.inputFileSystem) { + throw new Error("No input filesystem provided"); + } + compiler.resolverFactory.hooks.resolveOptions + .for("normal") + .tap("WebpackOptionsApply", resolveOptions => { + resolveOptions = cleverMerge(options.resolve, resolveOptions); + resolveOptions.fileSystem = compiler.inputFileSystem; + return resolveOptions; + }); + compiler.resolverFactory.hooks.resolveOptions + .for("context") + .tap("WebpackOptionsApply", resolveOptions => { + resolveOptions = cleverMerge(options.resolve, resolveOptions); + resolveOptions.fileSystem = compiler.inputFileSystem; + resolveOptions.resolveToContext = true; + return resolveOptions; + }); + compiler.resolverFactory.hooks.resolveOptions + .for("loader") + .tap("WebpackOptionsApply", resolveOptions => { + resolveOptions = cleverMerge(options.resolveLoader, resolveOptions); + resolveOptions.fileSystem = compiler.inputFileSystem; + return resolveOptions; + }); + compiler.hooks.afterResolvers.call(compiler); + return options; + } +} - compilation.hooks.runtimeRequirementInModule - .for(RuntimeGlobals.amdOptions) - .tap("AMDPlugin", (module, set) => { - set.add(RuntimeGlobals.requireScope); - }); +module.exports = WebpackOptionsApply; - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.amdDefine) - .tap("AMDPlugin", (chunk, set) => { - compilation.addRuntimeModule(chunk, new AMDDefineRuntimeModule()); - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.amdOptions) - .tap("AMDPlugin", (chunk, set) => { - compilation.addRuntimeModule( - chunk, - new AMDOptionsRuntimeModule(amdOptions) - ); - }); +/***/ }), - const handler = (parser, parserOptions) => { - if (parserOptions.amd !== undefined && !parserOptions.amd) return; +/***/ 14452: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const tapOptionsHooks = (optionExpr, rootName, getMembers) => { - parser.hooks.expression - .for(optionExpr) - .tap( - "AMDPlugin", - toConstantDependency(parser, RuntimeGlobals.amdOptions, [ - RuntimeGlobals.amdOptions - ]) - ); - parser.hooks.evaluateIdentifier - .for(optionExpr) - .tap( - "AMDPlugin", - evaluateToIdentifier(optionExpr, rootName, getMembers, true) - ); - parser.hooks.evaluateTypeof - .for(optionExpr) - .tap("AMDPlugin", evaluateToString("object")); - parser.hooks.typeof - .for(optionExpr) - .tap( - "AMDPlugin", - toConstantDependency(parser, JSON.stringify("object")) - ); - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - new AMDRequireDependenciesBlockParserPlugin(parserOptions).apply( - parser - ); - new AMDDefineDependencyParserPlugin(parserOptions).apply(parser); - tapOptionsHooks("define.amd", "define", () => "amd"); - tapOptionsHooks("require.amd", "require", () => ["amd"]); - tapOptionsHooks( - "__webpack_amd_options__", - "__webpack_amd_options__", - () => [] - ); - parser.hooks.expression.for("define").tap("AMDPlugin", expr => { - const dep = new ConstDependency( - RuntimeGlobals.amdDefine, - expr.range, - [RuntimeGlobals.amdDefine] - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - parser.hooks.typeof - .for("define") - .tap( - "AMDPlugin", - toConstantDependency(parser, JSON.stringify("function")) - ); - parser.hooks.evaluateTypeof - .for("define") - .tap("AMDPlugin", evaluateToString("function")); - parser.hooks.canRename.for("define").tap("AMDPlugin", approve); - parser.hooks.rename.for("define").tap("AMDPlugin", expr => { - const dep = new ConstDependency( - RuntimeGlobals.amdDefine, - expr.range, - [RuntimeGlobals.amdDefine] - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return false; - }); - parser.hooks.typeof - .for("require") - .tap( - "AMDPlugin", - toConstantDependency(parser, JSON.stringify("function")) - ); - parser.hooks.evaluateTypeof - .for("require") - .tap("AMDPlugin", evaluateToString("function")); - }; +const { applyWebpackOptionsDefaults } = __webpack_require__(92988); +const { getNormalizedWebpackOptions } = __webpack_require__(26693); - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("AMDPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("AMDPlugin", handler); - } - ); +class WebpackOptionsDefaulter { + process(options) { + options = getNormalizedWebpackOptions(options); + applyWebpackOptionsDefaults(options); + return options; } } -module.exports = AMDPlugin; +module.exports = WebpackOptionsDefaulter; /***/ }), -/***/ 33516: +/***/ 98421: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Sergey Melyukov @smelukov */ -const DependencyTemplate = __webpack_require__(5160); -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); +const mimeTypes = __webpack_require__(78585); +const path = __webpack_require__(71017); +const { RawSource } = __webpack_require__(51255); +const Generator = __webpack_require__(93401); +const RuntimeGlobals = __webpack_require__(16475); +const createHash = __webpack_require__(49835); +const { makePathsRelative } = __webpack_require__(82186); +const nonNumericOnlyHash = __webpack_require__(55668); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").AssetGeneratorOptions} AssetGeneratorOptions */ +/** @typedef {import("../../declarations/WebpackOptions").AssetModuleOutputPath} AssetModuleOutputPath */ +/** @typedef {import("../../declarations/WebpackOptions").RawPublicPath} RawPublicPath */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../Generator").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../util/Hash")} Hash */ -class AMDRequireArrayDependency extends NullDependency { - constructor(depsArray, range) { - super(); +const mergeMaybeArrays = (a, b) => { + const set = new Set(); + if (Array.isArray(a)) for (const item of a) set.add(item); + else set.add(a); + if (Array.isArray(b)) for (const item of b) set.add(item); + else set.add(b); + return Array.from(set); +}; - this.depsArray = depsArray; - this.range = range; +const mergeAssetInfo = (a, b) => { + const result = { ...a, ...b }; + for (const key of Object.keys(a)) { + if (key in b) { + if (a[key] === b[key]) continue; + switch (key) { + case "fullhash": + case "chunkhash": + case "modulehash": + case "contenthash": + result[key] = mergeMaybeArrays(a[key], b[key]); + break; + case "immutable": + case "development": + case "hotModuleReplacement": + case "javascriptModule": + result[key] = a[key] || b[key]; + break; + case "related": + result[key] = mergeRelatedInfo(a[key], b[key]); + break; + default: + throw new Error(`Can't handle conflicting asset info for ${key}`); + } + } } + return result; +}; - get type() { - return "amd require array"; +const mergeRelatedInfo = (a, b) => { + const result = { ...a, ...b }; + for (const key of Object.keys(a)) { + if (key in b) { + if (a[key] === b[key]) continue; + result[key] = mergeMaybeArrays(a[key], b[key]); + } } + return result; +}; - get category() { - return "amd"; - } +const encodeDataUri = (encoding, source) => { + let encodedContent; - serialize(context) { - const { write } = context; + switch (encoding) { + case "base64": { + encodedContent = source.buffer().toString("base64"); + break; + } + case false: { + const content = source.source(); - write(this.depsArray); - write(this.range); + if (typeof content !== "string") { + encodedContent = content.toString("utf-8"); + } - super.serialize(context); + encodedContent = encodeURIComponent(encodedContent).replace( + /[!'()*]/g, + character => "%" + character.codePointAt(0).toString(16) + ); + break; + } + default: + throw new Error(`Unsupported encoding '${encoding}'`); } - deserialize(context) { - const { read } = context; + return encodedContent; +}; - this.depsArray = read(); - this.range = read(); +const decodeDataUriContent = (encoding, content) => { + const isBase64 = encoding === "base64"; + return isBase64 + ? Buffer.from(content, "base64") + : Buffer.from(decodeURIComponent(content), "ascii"); +}; - super.deserialize(context); +const JS_TYPES = new Set(["javascript"]); +const JS_AND_ASSET_TYPES = new Set(["javascript", "asset"]); + +class AssetGenerator extends Generator { + /** + * @param {AssetGeneratorOptions["dataUrl"]=} dataUrlOptions the options for the data url + * @param {string=} filename override for output.assetModuleFilename + * @param {RawPublicPath=} publicPath override for output.assetModulePublicPath + * @param {AssetModuleOutputPath=} outputPath the output path for the emitted file which is not included in the runtime import + * @param {boolean=} emit generate output asset + */ + constructor(dataUrlOptions, filename, publicPath, outputPath, emit) { + super(); + this.dataUrlOptions = dataUrlOptions; + this.filename = filename; + this.publicPath = publicPath; + this.outputPath = outputPath; + this.emit = emit; } -} -makeSerializable( - AMDRequireArrayDependency, - "webpack/lib/dependencies/AMDRequireArrayDependency" -); + /** + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code + */ + generate( + module, + { runtime, chunkGraph, runtimeTemplate, runtimeRequirements, type, getData } + ) { + switch (type) { + case "asset": + return module.originalSource(); + default: { + runtimeRequirements.add(RuntimeGlobals.module); + + const originalSource = module.originalSource(); + if (module.buildInfo.dataUrl) { + let encodedSource; + if (typeof this.dataUrlOptions === "function") { + encodedSource = this.dataUrlOptions.call( + null, + originalSource.source(), + { + filename: module.matchResource || module.resource, + module + } + ); + } else { + /** @type {string | false | undefined} */ + let encoding = this.dataUrlOptions.encoding; + if (encoding === undefined) { + if ( + module.resourceResolveData && + module.resourceResolveData.encoding !== undefined + ) { + encoding = module.resourceResolveData.encoding; + } + } + if (encoding === undefined) { + encoding = "base64"; + } + let ext; + let mimeType = this.dataUrlOptions.mimetype; + if (mimeType === undefined) { + ext = path.extname(module.nameForCondition()); + if ( + module.resourceResolveData && + module.resourceResolveData.mimetype !== undefined + ) { + mimeType = + module.resourceResolveData.mimetype + + module.resourceResolveData.parameters; + } else if (ext) { + mimeType = mimeTypes.lookup(ext); + } + } + if (typeof mimeType !== "string") { + throw new Error( + "DataUrl can't be generated automatically, " + + `because there is no mimetype for "${ext}" in mimetype database. ` + + 'Either pass a mimetype via "generator.mimetype" or ' + + 'use type: "asset/resource" to create a resource file instead of a DataUrl' + ); + } + + let encodedContent; + + if ( + module.resourceResolveData && + module.resourceResolveData.encoding === encoding && + decodeDataUriContent( + module.resourceResolveData.encoding, + module.resourceResolveData.encodedContent + ).equals(originalSource.buffer()) + ) { + encodedContent = module.resourceResolveData.encodedContent; + } else { + encodedContent = encodeDataUri(encoding, originalSource); + } + + encodedSource = `data:${mimeType}${ + encoding ? `;${encoding}` : "" + },${encodedContent}`; + } + const data = getData(); + data.set("url", Buffer.from(encodedSource)); + return new RawSource( + `${RuntimeGlobals.module}.exports = ${JSON.stringify( + encodedSource + )};` + ); + } else { + const assetModuleFilename = + this.filename || runtimeTemplate.outputOptions.assetModuleFilename; + const hash = createHash(runtimeTemplate.outputOptions.hashFunction); + if (runtimeTemplate.outputOptions.hashSalt) { + hash.update(runtimeTemplate.outputOptions.hashSalt); + } + hash.update(originalSource.buffer()); + const fullHash = /** @type {string} */ ( + hash.digest(runtimeTemplate.outputOptions.hashDigest) + ); + const contentHash = nonNumericOnlyHash( + fullHash, + runtimeTemplate.outputOptions.hashDigestLength + ); + module.buildInfo.fullContentHash = fullHash; + const sourceFilename = makePathsRelative( + runtimeTemplate.compilation.compiler.context, + module.matchResource || module.resource, + runtimeTemplate.compilation.compiler.root + ).replace(/^\.\//, ""); + let { path: filename, info: assetInfo } = + runtimeTemplate.compilation.getAssetPathWithInfo( + assetModuleFilename, + { + module, + runtime, + filename: sourceFilename, + chunkGraph, + contentHash + } + ); + let assetPath; + if (this.publicPath !== undefined) { + const { path, info } = + runtimeTemplate.compilation.getAssetPathWithInfo( + this.publicPath, + { + module, + runtime, + filename: sourceFilename, + chunkGraph, + contentHash + } + ); + assetInfo = mergeAssetInfo(assetInfo, info); + assetPath = JSON.stringify(path + filename); + } else { + runtimeRequirements.add(RuntimeGlobals.publicPath); // add __webpack_require__.p + assetPath = runtimeTemplate.concatenation( + { expr: RuntimeGlobals.publicPath }, + filename + ); + } + assetInfo = { + sourceFilename, + ...assetInfo + }; + if (this.outputPath) { + const { path: outputPath, info } = + runtimeTemplate.compilation.getAssetPathWithInfo( + this.outputPath, + { + module, + runtime, + filename: sourceFilename, + chunkGraph, + contentHash + } + ); + assetInfo = mergeAssetInfo(assetInfo, info); + filename = path.posix.join(outputPath, filename); + } + module.buildInfo.filename = filename; + module.buildInfo.assetInfo = assetInfo; + if (getData) { + // Due to code generation caching module.buildInfo.XXX can't used to store such information + // It need to be stored in the code generation results instead, where it's cached too + // TODO webpack 6 For back-compat reasons we also store in on module.buildInfo + const data = getData(); + data.set("fullContentHash", fullHash); + data.set("filename", filename); + data.set("assetInfo", assetInfo); + } + + return new RawSource( + `${RuntimeGlobals.module}.exports = ${assetPath};` + ); + } + } + } + } -AMDRequireArrayDependency.Template = class AMDRequireArrayDependencyTemplate extends ( - DependencyTemplate -) { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) */ - apply(dependency, source, templateContext) { - const dep = /** @type {AMDRequireArrayDependency} */ (dependency); - const content = this.getContent(dep, templateContext); - source.replace(dep.range[0], dep.range[1] - 1, content); + getTypes(module) { + if ((module.buildInfo && module.buildInfo.dataUrl) || this.emit === false) { + return JS_TYPES; + } else { + return JS_AND_ASSET_TYPES; + } } - getContent(dep, templateContext) { - const requires = dep.depsArray.map(dependency => { - return this.contentForDependency(dependency, templateContext); - }); - return `[${requires.join(", ")}]`; - } + /** + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module + */ + getSize(module, type) { + switch (type) { + case "asset": { + const originalSource = module.originalSource(); - contentForDependency( - dep, - { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } - ) { - if (typeof dep === "string") { - return dep; - } + if (!originalSource) { + return 0; + } - if (dep.localModule) { - return dep.localModule.variableName(); - } else { - return runtimeTemplate.moduleExports({ - module: moduleGraph.getModule(dep), - chunkGraph, - request: dep.request, - runtimeRequirements - }); + return originalSource.size(); + } + default: + if (module.buildInfo && module.buildInfo.dataUrl) { + const originalSource = module.originalSource(); + + if (!originalSource) { + return 0; + } + + // roughly for data url + // Example: m.exports="data:image/png;base64,ag82/f+2==" + // 4/3 = base64 encoding + // 34 = ~ data url header + footer + rounding + return originalSource.size() * 1.34 + 36; + } else { + // it's only estimated so this number is probably fine + // Example: m.exports=r.p+"0123456789012345678901.ext" + return 42; + } } } -}; -module.exports = AMDRequireArrayDependency; + /** + * @param {Hash} hash hash that will be modified + * @param {UpdateHashContext} updateHashContext context for updating hash + */ + updateHash(hash, { module }) { + hash.update(module.buildInfo.dataUrl ? "data-url" : "resource"); + } +} + +module.exports = AssetGenerator; /***/ }), -/***/ 96123: +/***/ 16109: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Yuta Hiroto @hiroppy */ -const makeSerializable = __webpack_require__(33032); -const ContextDependency = __webpack_require__(88101); +const { cleverMerge } = __webpack_require__(60839); +const { compareModulesByIdentifier } = __webpack_require__(29579); +const createSchemaValidation = __webpack_require__(32540); +const memoize = __webpack_require__(78676); -class AMDRequireContextDependency extends ContextDependency { - constructor(options, range, valueRange) { - super(options); +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ - this.range = range; - this.valueRange = valueRange; - } +const getSchema = name => { + const { definitions } = __webpack_require__(73342); + return { + definitions, + oneOf: [{ $ref: `#/definitions/${name}` }] + }; +}; - get type() { - return "amd require context"; - } +const generatorValidationOptions = { + name: "Asset Modules Plugin", + baseDataPath: "generator" +}; +const validateGeneratorOptions = { + asset: createSchemaValidation( + __webpack_require__(55125), + () => getSchema("AssetGeneratorOptions"), + generatorValidationOptions + ), + "asset/resource": createSchemaValidation( + __webpack_require__(4405), + () => getSchema("AssetResourceGeneratorOptions"), + generatorValidationOptions + ), + "asset/inline": createSchemaValidation( + __webpack_require__(62368), + () => getSchema("AssetInlineGeneratorOptions"), + generatorValidationOptions + ) +}; - get category() { - return "amd"; +const validateParserOptions = createSchemaValidation( + __webpack_require__(45020), + () => getSchema("AssetParserOptions"), + { + name: "Asset Modules Plugin", + baseDataPath: "parser" } +); - serialize(context) { - const { write } = context; +const getAssetGenerator = memoize(() => __webpack_require__(98421)); +const getAssetParser = memoize(() => __webpack_require__(91112)); +const getAssetSourceParser = memoize(() => __webpack_require__(30953)); +const getAssetSourceGenerator = memoize(() => + __webpack_require__(18749) +); - write(this.range); - write(this.valueRange); +const type = "asset"; +const plugin = "AssetModulesPlugin"; - super.serialize(context); - } +class AssetModulesPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + plugin, + (compilation, { normalModuleFactory }) => { + normalModuleFactory.hooks.createParser + .for("asset") + .tap(plugin, parserOptions => { + validateParserOptions(parserOptions); + parserOptions = cleverMerge( + compiler.options.module.parser.asset, + parserOptions + ); - deserialize(context) { - const { read } = context; + let dataUrlCondition = parserOptions.dataUrlCondition; + if (!dataUrlCondition || typeof dataUrlCondition === "object") { + dataUrlCondition = { + maxSize: 8096, + ...dataUrlCondition + }; + } - this.range = read(); - this.valueRange = read(); + const AssetParser = getAssetParser(); - super.deserialize(context); - } -} + return new AssetParser(dataUrlCondition); + }); + normalModuleFactory.hooks.createParser + .for("asset/inline") + .tap(plugin, parserOptions => { + const AssetParser = getAssetParser(); -makeSerializable( - AMDRequireContextDependency, - "webpack/lib/dependencies/AMDRequireContextDependency" -); + return new AssetParser(true); + }); + normalModuleFactory.hooks.createParser + .for("asset/resource") + .tap(plugin, parserOptions => { + const AssetParser = getAssetParser(); -AMDRequireContextDependency.Template = __webpack_require__(75815); + return new AssetParser(false); + }); + normalModuleFactory.hooks.createParser + .for("asset/source") + .tap(plugin, parserOptions => { + const AssetSourceParser = getAssetSourceParser(); -module.exports = AMDRequireContextDependency; + return new AssetSourceParser(); + }); + for (const type of ["asset", "asset/inline", "asset/resource"]) { + normalModuleFactory.hooks.createGenerator + .for(type) + .tap(plugin, generatorOptions => { + validateGeneratorOptions[type](generatorOptions); -/***/ }), + let dataUrl = undefined; + if (type !== "asset/resource") { + dataUrl = generatorOptions.dataUrl; + if (!dataUrl || typeof dataUrl === "object") { + dataUrl = { + encoding: undefined, + mimetype: undefined, + ...dataUrl + }; + } + } -/***/ 76932: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + let filename = undefined; + let publicPath = undefined; + let outputPath = undefined; + if (type !== "asset/inline") { + filename = generatorOptions.filename; + publicPath = generatorOptions.publicPath; + outputPath = generatorOptions.outputPath; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const AssetGenerator = getAssetGenerator(); + return new AssetGenerator( + dataUrl, + filename, + publicPath, + outputPath, + generatorOptions.emit !== false + ); + }); + } + normalModuleFactory.hooks.createGenerator + .for("asset/source") + .tap(plugin, () => { + const AssetSourceGenerator = getAssetSourceGenerator(); + return new AssetSourceGenerator(); + }); -const AsyncDependenciesBlock = __webpack_require__(47736); -const makeSerializable = __webpack_require__(33032); + compilation.hooks.renderManifest.tap(plugin, (result, options) => { + const { chunkGraph } = compilation; + const { chunk, codeGenerationResults } = options; -class AMDRequireDependenciesBlock extends AsyncDependenciesBlock { - constructor(loc, request) { - super(null, loc, request); + const modules = chunkGraph.getOrderedChunkModulesIterableBySourceType( + chunk, + "asset", + compareModulesByIdentifier + ); + if (modules) { + for (const module of modules) { + try { + const codeGenResult = codeGenerationResults.get( + module, + chunk.runtime + ); + result.push({ + render: () => codeGenResult.sources.get(type), + filename: + module.buildInfo.filename || + codeGenResult.data.get("filename"), + info: + module.buildInfo.assetInfo || + codeGenResult.data.get("assetInfo"), + auxiliary: true, + identifier: `assetModule${chunkGraph.getModuleId(module)}`, + hash: + module.buildInfo.fullContentHash || + codeGenResult.data.get("fullContentHash") + }); + } catch (e) { + e.message += `\nduring rendering of asset ${module.identifier()}`; + throw e; + } + } + } + + return result; + }); + + compilation.hooks.prepareModuleExecution.tap( + "AssetModulesPlugin", + (options, context) => { + const { codeGenerationResult } = options; + const source = codeGenerationResult.sources.get("asset"); + if (source === undefined) return; + context.assets.set(codeGenerationResult.data.get("filename"), { + source, + info: codeGenerationResult.data.get("assetInfo") + }); + } + ); + } + ); } } -makeSerializable( - AMDRequireDependenciesBlock, - "webpack/lib/dependencies/AMDRequireDependenciesBlock" -); - -module.exports = AMDRequireDependenciesBlock; +module.exports = AssetModulesPlugin; /***/ }), -/***/ 66866: +/***/ 91112: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Yuta Hiroto @hiroppy */ -const RuntimeGlobals = __webpack_require__(16475); -const UnsupportedFeatureWarning = __webpack_require__(42495); -const AMDRequireArrayDependency = __webpack_require__(33516); -const AMDRequireContextDependency = __webpack_require__(96123); -const AMDRequireDependenciesBlock = __webpack_require__(76932); -const AMDRequireDependency = __webpack_require__(43911); -const AMDRequireItemDependency = __webpack_require__(71806); -const ConstDependency = __webpack_require__(76911); -const ContextDependencyHelpers = __webpack_require__(99630); -const LocalModuleDependency = __webpack_require__(52805); -const { getLocalModule } = __webpack_require__(75827); -const UnsupportedDependency = __webpack_require__(51669); -const getFunctionExpression = __webpack_require__(50396); +const Parser = __webpack_require__(11715); -class AMDRequireDependenciesBlockParserPlugin { - constructor(options) { - this.options = options; +/** @typedef {import("../../declarations/WebpackOptions").AssetParserOptions} AssetParserOptions */ +/** @typedef {import("../Parser").ParserState} ParserState */ +/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ + +class AssetParser extends Parser { + /** + * @param {AssetParserOptions["dataUrlCondition"] | boolean} dataUrlCondition condition for inlining as DataUrl + */ + constructor(dataUrlCondition) { + super(); + this.dataUrlCondition = dataUrlCondition; } - processFunctionArgument(parser, expression) { - let bindThis = true; - const fnData = getFunctionExpression(expression); - if (fnData) { - parser.inScope( - fnData.fn.params.filter(i => { - return !["require", "module", "exports"].includes(i.name); - }), - () => { - if (fnData.fn.body.type === "BlockStatement") { - parser.walkStatement(fnData.fn.body); - } else { - parser.walkExpression(fnData.fn.body); - } - } - ); - parser.walkExpressions(fnData.expressions); - if (fnData.needThis === false) { - bindThis = false; - } + /** + * @param {string | Buffer | PreparsedAst} source the source to parse + * @param {ParserState} state the parser state + * @returns {ParserState} the parser state + */ + parse(source, state) { + if (typeof source === "object" && !Buffer.isBuffer(source)) { + throw new Error("AssetParser doesn't accept preparsed AST"); + } + state.module.buildInfo.strict = true; + state.module.buildMeta.exportsType = "default"; + + if (typeof this.dataUrlCondition === "function") { + state.module.buildInfo.dataUrl = this.dataUrlCondition(source, { + filename: state.module.matchResource || state.module.resource, + module: state.module + }); + } else if (typeof this.dataUrlCondition === "boolean") { + state.module.buildInfo.dataUrl = this.dataUrlCondition; + } else if ( + this.dataUrlCondition && + typeof this.dataUrlCondition === "object" + ) { + state.module.buildInfo.dataUrl = + Buffer.byteLength(source) <= this.dataUrlCondition.maxSize; } else { - parser.walkExpression(expression); + throw new Error("Unexpected dataUrlCondition type"); } - return bindThis; - } - apply(parser) { - parser.hooks.call - .for("require") - .tap( - "AMDRequireDependenciesBlockParserPlugin", - this.processCallRequire.bind(this, parser) - ); + return state; } +} - processArray(parser, expr, param) { - if (param.isArray()) { - for (const p of param.items) { - const result = this.processItem(parser, expr, p); - if (result === undefined) { - this.processContext(parser, expr, p); - } - } - return true; - } else if (param.isConstArray()) { - const deps = []; - for (const request of param.array) { - let dep, localModule; - if (request === "require") { - dep = "__webpack_require__"; - } else if (["exports", "module"].includes(request)) { - dep = request; - } else if ((localModule = getLocalModule(parser.state, request))) { - localModule.flagUsed(); - dep = new LocalModuleDependency(localModule, undefined, false); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - } else { - dep = this.newRequireItemDependency(request); - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - } - deps.push(dep); - } - const dep = this.newRequireArrayDependency(deps, param.range); - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.module.addPresentationalDependency(dep); - return true; - } - } - processItem(parser, expr, param) { - if (param.isConditional()) { - for (const p of param.options) { - const result = this.processItem(parser, expr, p); - if (result === undefined) { - this.processContext(parser, expr, p); - } - } - return true; - } else if (param.isString()) { - let dep, localModule; - if (param.string === "require") { - dep = new ConstDependency("__webpack_require__", param.string, [ - RuntimeGlobals.require - ]); - } else if (param.string === "module") { - dep = new ConstDependency( - parser.state.module.buildInfo.moduleArgument, - param.range, - [RuntimeGlobals.module] - ); - } else if (param.string === "exports") { - dep = new ConstDependency( - parser.state.module.buildInfo.exportsArgument, - param.range, - [RuntimeGlobals.exports] - ); - } else if ((localModule = getLocalModule(parser.state, param.string))) { - localModule.flagUsed(); - dep = new LocalModuleDependency(localModule, param.range, false); - } else { - dep = this.newRequireItemDependency(param.string, param.range); - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; - } - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; +module.exports = AssetParser; + + +/***/ }), + +/***/ 18749: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Sergey Melyukov @smelukov +*/ + + + +const { RawSource } = __webpack_require__(51255); +const Generator = __webpack_require__(93401); +const RuntimeGlobals = __webpack_require__(16475); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../NormalModule")} NormalModule */ + +const TYPES = new Set(["javascript"]); + +class AssetSourceGenerator extends Generator { + /** + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code + */ + generate(module, { chunkGraph, runtimeTemplate, runtimeRequirements }) { + runtimeRequirements.add(RuntimeGlobals.module); + + const originalSource = module.originalSource(); + + if (!originalSource) { + return new RawSource(""); } - } - processContext(parser, expr, param) { - const dep = ContextDependencyHelpers.create( - AMDRequireContextDependency, - param.range, - param, - expr, - this.options, - { - category: "amd" - }, - parser + + const content = originalSource.source(); + + let encodedSource; + if (typeof content === "string") { + encodedSource = content; + } else { + encodedSource = content.toString("utf-8"); + } + return new RawSource( + `${RuntimeGlobals.module}.exports = ${JSON.stringify(encodedSource)};` ); - if (!dep) return; - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; } - processArrayForRequestString(param) { - if (param.isArray()) { - const result = param.items.map(item => - this.processItemForRequestString(item) - ); - if (result.every(Boolean)) return result.join(" "); - } else if (param.isConstArray()) { - return param.array.join(" "); - } + /** + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) + */ + getTypes(module) { + return TYPES; } - processItemForRequestString(param) { - if (param.isConditional()) { - const result = param.options.map(item => - this.processItemForRequestString(item) - ); - if (result.every(Boolean)) return result.join("|"); - } else if (param.isString()) { - return param.string; + /** + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module + */ + getSize(module, type) { + const originalSource = module.originalSource(); + + if (!originalSource) { + return 0; } + + // Example: m.exports="abcd" + return originalSource.size() + 12; } +} - processCallRequire(parser, expr) { - let param; - let depBlock; - let dep; - let result; +module.exports = AssetSourceGenerator; - const old = parser.state.current; - if (expr.arguments.length >= 1) { - param = parser.evaluateExpression(expr.arguments[0]); - depBlock = this.newRequireDependenciesBlock( - expr.loc, - this.processArrayForRequestString(param) - ); - dep = this.newRequireDependency( - expr.range, - param.range, - expr.arguments.length > 1 ? expr.arguments[1].range : null, - expr.arguments.length > 2 ? expr.arguments[2].range : null - ); - dep.loc = expr.loc; - depBlock.addDependency(dep); +/***/ }), - parser.state.current = depBlock; - } +/***/ 30953: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (expr.arguments.length === 1) { - parser.inScope([], () => { - result = this.processArray(parser, expr, param); - }); - parser.state.current = old; - if (!result) return; - parser.state.current.addBlock(depBlock); - return true; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Yuta Hiroto @hiroppy +*/ - if (expr.arguments.length === 2 || expr.arguments.length === 3) { - try { - parser.inScope([], () => { - result = this.processArray(parser, expr, param); - }); - if (!result) { - const dep = new UnsupportedDependency("unsupported", expr.range); - old.addPresentationalDependency(dep); - if (parser.state.module) { - parser.state.module.addError( - new UnsupportedFeatureWarning( - "Cannot statically analyse 'require(…, …)' in line " + - expr.loc.start.line, - expr.loc - ) - ); - } - depBlock = null; - return true; - } - dep.functionBindThis = this.processFunctionArgument( - parser, - expr.arguments[1] - ); - if (expr.arguments.length === 3) { - dep.errorCallbackBindThis = this.processFunctionArgument( - parser, - expr.arguments[2] - ); - } - } finally { - parser.state.current = old; - if (depBlock) parser.state.current.addBlock(depBlock); - } - return true; + + +const Parser = __webpack_require__(11715); + +/** @typedef {import("../Parser").ParserState} ParserState */ +/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ + +class AssetSourceParser extends Parser { + /** + * @param {string | Buffer | PreparsedAst} source the source to parse + * @param {ParserState} state the parser state + * @returns {ParserState} the parser state + */ + parse(source, state) { + if (typeof source === "object" && !Buffer.isBuffer(source)) { + throw new Error("AssetSourceParser doesn't accept preparsed AST"); } - } + const { module } = state; + module.buildInfo.strict = true; + module.buildMeta.exportsType = "default"; - newRequireDependenciesBlock(loc, request) { - return new AMDRequireDependenciesBlock(loc, request); - } - newRequireDependency( - outerRange, - arrayRange, - functionRange, - errorCallbackRange - ) { - return new AMDRequireDependency( - outerRange, - arrayRange, - functionRange, - errorCallbackRange - ); - } - newRequireItemDependency(request, range) { - return new AMDRequireItemDependency(request, range); - } - newRequireArrayDependency(depsArray, range) { - return new AMDRequireArrayDependency(depsArray, range); + return state; } } -module.exports = AMDRequireDependenciesBlockParserPlugin; + +module.exports = AssetSourceParser; /***/ }), -/***/ 43911: +/***/ 19684: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -72084,40 +66161,129 @@ module.exports = AMDRequireDependenciesBlockParserPlugin; +const { RawSource } = __webpack_require__(51255); +const Module = __webpack_require__(73208); const RuntimeGlobals = __webpack_require__(16475); const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../AsyncDependenciesBlock")} AsyncDependenciesBlock */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ -class AMDRequireDependency extends NullDependency { - constructor(outerRange, arrayRange, functionRange, errorCallbackRange) { - super(); +const TYPES = new Set(["javascript"]); - this.outerRange = outerRange; - this.arrayRange = arrayRange; - this.functionRange = functionRange; - this.errorCallbackRange = errorCallbackRange; - this.functionBindThis = false; - this.errorCallbackBindThis = false; +class RawDataUrlModule extends Module { + /** + * @param {string} url raw url + * @param {string} identifier unique identifier + * @param {string=} readableIdentifier readable identifier + */ + constructor(url, identifier, readableIdentifier) { + super("asset/raw-data-url", null); + this.url = url; + this.urlBuffer = url ? Buffer.from(url) : undefined; + this.identifierStr = identifier || this.url; + this.readableIdentifierStr = readableIdentifier || this.identifierStr; } - get category() { - return "amd"; + /** + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + return TYPES; + } + + /** + * @returns {string} a unique identifier of the module + */ + identifier() { + return this.identifierStr; + } + + /** + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + if (this.url === undefined) this.url = this.urlBuffer.toString(); + return Math.max(1, this.url.length); + } + + /** + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + return requestShortener.shorten(this.readableIdentifierStr); + } + + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + return callback(null, !this.buildMeta); + } + + /** + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + this.buildMeta = {}; + this.buildInfo = { + cacheable: true + }; + callback(); + } + + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration(context) { + if (this.url === undefined) this.url = this.urlBuffer.toString(); + const sources = new Map(); + sources.set( + "javascript", + new RawSource(`module.exports = ${JSON.stringify(this.url)};`) + ); + const data = new Map(); + data.set("url", this.urlBuffer); + const runtimeRequirements = new Set(); + runtimeRequirements.add(RuntimeGlobals.module); + return { sources, runtimeRequirements, data }; + } + + /** + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + hash.update(this.urlBuffer); + super.updateHash(hash, context); } serialize(context) { const { write } = context; - write(this.outerRange); - write(this.arrayRange); - write(this.functionRange); - write(this.errorCallbackRange); - write(this.functionBindThis); - write(this.errorCallbackBindThis); + write(this.urlBuffer); + write(this.identifierStr); + write(this.readableIdentifierStr); super.serialize(context); } @@ -72125,137 +66291,162 @@ class AMDRequireDependency extends NullDependency { deserialize(context) { const { read } = context; - this.outerRange = read(); - this.arrayRange = read(); - this.functionRange = read(); - this.errorCallbackRange = read(); - this.functionBindThis = read(); - this.errorCallbackBindThis = read(); + this.urlBuffer = read(); + this.identifierStr = read(); + this.readableIdentifierStr = read(); super.deserialize(context); } } -makeSerializable( - AMDRequireDependency, - "webpack/lib/dependencies/AMDRequireDependency" -); +makeSerializable(RawDataUrlModule, "webpack/lib/asset/RawDataUrlModule"); -AMDRequireDependency.Template = class AMDRequireDependencyTemplate extends ( - NullDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply( - dependency, - source, - { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } - ) { - const dep = /** @type {AMDRequireDependency} */ (dependency); - const depBlock = /** @type {AsyncDependenciesBlock} */ ( - moduleGraph.getParentBlock(dep) - ); - const promise = runtimeTemplate.blockPromise({ - chunkGraph, - block: depBlock, - message: "AMD require", - runtimeRequirements - }); +module.exports = RawDataUrlModule; - // has array range but no function range - if (dep.arrayRange && !dep.functionRange) { - const startBlock = `${promise}.then(function() {`; - const endBlock = `;})['catch'](${RuntimeGlobals.uncaughtErrorHandler})`; - runtimeRequirements.add(RuntimeGlobals.uncaughtErrorHandler); - source.replace(dep.outerRange[0], dep.arrayRange[0] - 1, startBlock); +/***/ }), - source.replace(dep.arrayRange[1], dep.outerRange[1] - 1, endBlock); +/***/ 41153: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - return; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // has function range but no array range - if (dep.functionRange && !dep.arrayRange) { - const startBlock = `${promise}.then((`; - const endBlock = `).bind(exports, __webpack_require__, exports, module))['catch'](${RuntimeGlobals.uncaughtErrorHandler})`; - runtimeRequirements.add(RuntimeGlobals.uncaughtErrorHandler); - source.replace(dep.outerRange[0], dep.functionRange[0] - 1, startBlock); - source.replace(dep.functionRange[1], dep.outerRange[1] - 1, endBlock); +const InitFragment = __webpack_require__(55870); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); - return; - } +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ - // has array range, function range, and errorCallbackRange - if (dep.arrayRange && dep.functionRange && dep.errorCallbackRange) { - const startBlock = `${promise}.then(function() { `; - const errorRangeBlock = `}${ - dep.functionBindThis ? ".bind(this)" : "" - })['catch'](`; - const endBlock = `${dep.errorCallbackBindThis ? ".bind(this)" : ""})`; +/** + * @typedef {GenerateContext} Context + */ +class AwaitDependenciesInitFragment extends InitFragment { + /** + * @param {Set} promises the promises that should be awaited + */ + constructor(promises) { + super( + undefined, + InitFragment.STAGE_ASYNC_DEPENDENCIES, + 0, + "await-dependencies" + ); + this.promises = promises; + } - source.replace(dep.outerRange[0], dep.arrayRange[0] - 1, startBlock); + merge(other) { + const promises = new Set(other.promises); + for (const p of this.promises) { + promises.add(p); + } + return new AwaitDependenciesInitFragment(promises); + } - source.insert(dep.arrayRange[0], "var __WEBPACK_AMD_REQUIRE_ARRAY__ = "); + /** + * @param {Context} context context + * @returns {string|Source} the source code that will be included as initialization code + */ + getContent({ runtimeRequirements }) { + runtimeRequirements.add(RuntimeGlobals.module); + const promises = this.promises; + if (promises.size === 0) { + return ""; + } + if (promises.size === 1) { + for (const p of promises) { + return Template.asString([ + `var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${p}]);`, + `${p} = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];`, + "" + ]); + } + } + const sepPromises = Array.from(promises).join(", "); + // TODO check if destructuring is supported + return Template.asString([ + `var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${sepPromises}]);`, + `([${sepPromises}] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);`, + "" + ]); + } +} - source.replace(dep.arrayRange[1], dep.functionRange[0] - 1, "; ("); +module.exports = AwaitDependenciesInitFragment; - source.insert( - dep.functionRange[1], - ").apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__);" - ); - source.replace( - dep.functionRange[1], - dep.errorCallbackRange[0] - 1, - errorRangeBlock - ); +/***/ }), - source.replace( - dep.errorCallbackRange[1], - dep.outerRange[1] - 1, - endBlock - ); +/***/ 59498: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - return; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // has array range, function range, but no errorCallbackRange - if (dep.arrayRange && dep.functionRange) { - const startBlock = `${promise}.then(function() { `; - const endBlock = `}${ - dep.functionBindThis ? ".bind(this)" : "" - })['catch'](${RuntimeGlobals.uncaughtErrorHandler})`; - runtimeRequirements.add(RuntimeGlobals.uncaughtErrorHandler); - source.replace(dep.outerRange[0], dep.arrayRange[0] - 1, startBlock); - source.insert(dep.arrayRange[0], "var __WEBPACK_AMD_REQUIRE_ARRAY__ = "); +const HarmonyImportDependency = __webpack_require__(57154); - source.replace(dep.arrayRange[1], dep.functionRange[0] - 1, "; ("); +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ - source.insert( - dep.functionRange[1], - ").apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__);" +class InferAsyncModulesPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap("InferAsyncModulesPlugin", compilation => { + const { moduleGraph } = compilation; + compilation.hooks.finishModules.tap( + "InferAsyncModulesPlugin", + modules => { + /** @type {Set} */ + const queue = new Set(); + for (const module of modules) { + if (module.buildMeta && module.buildMeta.async) { + queue.add(module); + } + } + for (const module of queue) { + moduleGraph.setAsync(module); + for (const [ + originModule, + connections + ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { + if ( + connections.some( + c => + c.dependency instanceof HarmonyImportDependency && + c.isTargetActive(undefined) + ) + ) { + queue.add(originModule); + } + } + } + } ); - - source.replace(dep.functionRange[1], dep.outerRange[1] - 1, endBlock); - } + }); } -}; +} -module.exports = AMDRequireDependency; +module.exports = InferAsyncModulesPlugin; /***/ }), -/***/ 71806: +/***/ 79233: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -72266,1161 +66457,1406 @@ module.exports = AMDRequireDependency; -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); -const ModuleDependencyTemplateAsRequireId = __webpack_require__(36873); +const AsyncDependencyToInitialChunkError = __webpack_require__(30111); +const { connectChunkGroupParentAndChild } = __webpack_require__(37234); +const ModuleGraphConnection = __webpack_require__(40639); +const { getEntryRuntime, mergeRuntime } = __webpack_require__(17156); -class AMDRequireItemDependency extends ModuleDependency { - constructor(request, range) { - super(request); +/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./ChunkGroup")} ChunkGroup */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./Entrypoint")} Entrypoint */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("./logging/Logger").Logger} Logger */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - this.range = range; - } +/** + * @typedef {Object} QueueItem + * @property {number} action + * @property {DependenciesBlock} block + * @property {Module} module + * @property {Chunk} chunk + * @property {ChunkGroup} chunkGroup + * @property {ChunkGroupInfo} chunkGroupInfo + */ - get type() { - return "amd require"; - } +/** @typedef {Set & { plus: Set }} ModuleSetPlus */ - get category() { - return "amd"; - } -} +/** + * @typedef {Object} ChunkGroupInfo + * @property {ChunkGroup} chunkGroup the chunk group + * @property {RuntimeSpec} runtime the runtimes + * @property {ModuleSetPlus} minAvailableModules current minimal set of modules available at this point + * @property {boolean} minAvailableModulesOwned true, if minAvailableModules is owned and can be modified + * @property {ModuleSetPlus[]} availableModulesToBeMerged enqueued updates to the minimal set of available modules + * @property {Set=} skippedItems modules that were skipped because module is already available in parent chunks (need to reconsider when minAvailableModules is shrinking) + * @property {Set<[Module, ConnectionState]>=} skippedModuleConnections referenced modules that where skipped because they were not active in this runtime + * @property {ModuleSetPlus} resultingAvailableModules set of modules available including modules from this chunk group + * @property {Set} children set of children chunk groups, that will be revisited when availableModules shrink + * @property {Set} availableSources set of chunk groups that are the source for minAvailableModules + * @property {Set} availableChildren set of chunk groups which depend on the this chunk group as availableSource + * @property {number} preOrderIndex next pre order index + * @property {number} postOrderIndex next post order index + * @property {boolean} chunkLoading has a chunk loading mechanism + * @property {boolean} asyncChunks create async chunks + */ -makeSerializable( - AMDRequireItemDependency, - "webpack/lib/dependencies/AMDRequireItemDependency" -); +/** + * @typedef {Object} BlockChunkGroupConnection + * @property {ChunkGroupInfo} originChunkGroupInfo origin chunk group + * @property {ChunkGroup} chunkGroup referenced chunk group + */ -AMDRequireItemDependency.Template = ModuleDependencyTemplateAsRequireId; +const EMPTY_SET = /** @type {ModuleSetPlus} */ (new Set()); +EMPTY_SET.plus = EMPTY_SET; -module.exports = AMDRequireItemDependency; +/** + * @param {ModuleSetPlus} a first set + * @param {ModuleSetPlus} b second set + * @returns {number} cmp + */ +const bySetSize = (a, b) => { + return b.size + b.plus.size - a.size - a.plus.size; +}; +const extractBlockModules = (module, moduleGraph, runtime, blockModulesMap) => { + let blockCache; + let modules; -/***/ }), + const arrays = []; -/***/ 45242: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + const queue = [module]; + while (queue.length > 0) { + const block = queue.pop(); + const arr = []; + arrays.push(arr); + blockModulesMap.set(block, arr); + for (const b of block.blocks) { + queue.push(b); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + for (const connection of moduleGraph.getOutgoingConnections(module)) { + const d = connection.dependency; + // We skip connections without dependency + if (!d) continue; + const m = connection.module; + // We skip connections without Module pointer + if (!m) continue; + // We skip weak connections + if (connection.weak) continue; + const state = connection.getActiveState(runtime); + // We skip inactive connections + if (state === false) continue; + const block = moduleGraph.getParentBlock(d); + let index = moduleGraph.getParentBlockIndex(d); + // deprecated fallback + if (index < 0) { + index = block.dependencies.indexOf(d); + } -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); + if (blockCache !== block) { + modules = blockModulesMap.get((blockCache = block)); + } -class AMDDefineRuntimeModule extends RuntimeModule { - constructor() { - super("amd define"); + const i = index << 2; + modules[i] = m; + modules[i + 1] = state; } - /** - * @returns {string} runtime code - */ - generate() { - return Template.asString([ - `${RuntimeGlobals.amdDefine} = function () {`, - Template.indent("throw new Error('define cannot be used indirect');"), - "};" - ]); + for (const modules of arrays) { + if (modules.length === 0) continue; + let indexMap; + let length = 0; + outer: for (let j = 0; j < modules.length; j += 2) { + const m = modules[j]; + if (m === undefined) continue; + const state = modules[j + 1]; + if (indexMap === undefined) { + let i = 0; + for (; i < length; i += 2) { + if (modules[i] === m) { + const merged = modules[i + 1]; + if (merged === true) continue outer; + modules[i + 1] = ModuleGraphConnection.addConnectionStates( + merged, + state + ); + } + } + modules[length] = m; + length++; + modules[length] = state; + length++; + if (length > 30) { + // To avoid worse case performance, we will use an index map for + // linear cost access, which allows to maintain O(n) complexity + // while keeping allocations down to a minimum + indexMap = new Map(); + for (let i = 0; i < length; i += 2) { + indexMap.set(modules[i], i + 1); + } + } + } else { + const idx = indexMap.get(m); + if (idx !== undefined) { + const merged = modules[idx]; + if (merged === true) continue outer; + modules[idx] = ModuleGraphConnection.addConnectionStates( + merged, + state + ); + } else { + modules[length] = m; + length++; + modules[length] = state; + indexMap.set(m, length); + length++; + } + } + } + modules.length = length; } -} +}; -class AMDOptionsRuntimeModule extends RuntimeModule { - /** - * @param {Record} options the AMD options - */ - constructor(options) { - super("amd options"); - this.options = options; - } +/** + * + * @param {Logger} logger a logger + * @param {Compilation} compilation the compilation + * @param {Map} inputEntrypointsAndModules chunk groups which are processed with the modules + * @param {Map} chunkGroupInfoMap mapping from chunk group to available modules + * @param {Map} blockConnections connection for blocks + * @param {Set} blocksWithNestedBlocks flag for blocks that have nested blocks + * @param {Set} allCreatedChunkGroups filled with all chunk groups that are created here + */ +const visitModules = ( + logger, + compilation, + inputEntrypointsAndModules, + chunkGroupInfoMap, + blockConnections, + blocksWithNestedBlocks, + allCreatedChunkGroups +) => { + const { moduleGraph, chunkGraph, moduleMemCaches } = compilation; + + const blockModulesRuntimeMap = new Map(); + + /** @type {RuntimeSpec | false} */ + let blockModulesMapRuntime = false; + let blockModulesMap; /** - * @returns {string} runtime code + * + * @param {DependenciesBlock} block block + * @param {RuntimeSpec} runtime runtime + * @returns {(Module | ConnectionState)[]} block modules in flatten tuples */ - generate() { - return Template.asString([ - `${RuntimeGlobals.amdOptions} = ${JSON.stringify(this.options)};` - ]); - } -} + const getBlockModules = (block, runtime) => { + if (blockModulesMapRuntime !== runtime) { + blockModulesMap = blockModulesRuntimeMap.get(runtime); + if (blockModulesMap === undefined) { + blockModulesMap = new Map(); + blockModulesRuntimeMap.set(runtime, blockModulesMap); + } + } + let blockModules = blockModulesMap.get(block); + if (blockModules !== undefined) return blockModules; + const module = /** @type {Module} */ (block.getRootBlock()); + const memCache = moduleMemCaches && moduleMemCaches.get(module); + if (memCache !== undefined) { + const map = memCache.provide( + "bundleChunkGraph.blockModules", + runtime, + () => { + logger.time("visitModules: prepare"); + const map = new Map(); + extractBlockModules(module, moduleGraph, runtime, map); + logger.timeAggregate("visitModules: prepare"); + return map; + } + ); + for (const [block, blockModules] of map) + blockModulesMap.set(block, blockModules); + return map.get(block); + } else { + logger.time("visitModules: prepare"); + extractBlockModules(module, moduleGraph, runtime, blockModulesMap); + blockModules = blockModulesMap.get(block); + logger.timeAggregate("visitModules: prepare"); + return blockModules; + } + }; -exports.AMDDefineRuntimeModule = AMDDefineRuntimeModule; -exports.AMDOptionsRuntimeModule = AMDOptionsRuntimeModule; + let statProcessedQueueItems = 0; + let statProcessedBlocks = 0; + let statConnectedChunkGroups = 0; + let statProcessedChunkGroupsForMerging = 0; + let statMergedAvailableModuleSets = 0; + let statForkedAvailableModules = 0; + let statForkedAvailableModulesCount = 0; + let statForkedAvailableModulesCountPlus = 0; + let statForkedMergedModulesCount = 0; + let statForkedMergedModulesCountPlus = 0; + let statForkedResultModulesCount = 0; + let statChunkGroupInfoUpdated = 0; + let statChildChunkGroupsReconnected = 0; + let nextChunkGroupIndex = 0; + let nextFreeModulePreOrderIndex = 0; + let nextFreeModulePostOrderIndex = 0; -/***/ }), + /** @type {Map} */ + const blockChunkGroups = new Map(); -/***/ 57403: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** @type {Map} */ + const namedChunkGroups = new Map(); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent -*/ + /** @type {Map} */ + const namedAsyncEntrypoints = new Map(); + + const ADD_AND_ENTER_ENTRY_MODULE = 0; + const ADD_AND_ENTER_MODULE = 1; + const ENTER_MODULE = 2; + const PROCESS_BLOCK = 3; + const PROCESS_ENTRY_BLOCK = 4; + const LEAVE_MODULE = 5; + + /** @type {QueueItem[]} */ + let queue = []; + + /** @type {Map>} */ + const queueConnect = new Map(); + /** @type {Set} */ + const chunkGroupsForCombining = new Set(); + + // Fill queue with entrypoint modules + // Create ChunkGroupInfo for entrypoints + for (const [chunkGroup, modules] of inputEntrypointsAndModules) { + const runtime = getEntryRuntime( + compilation, + chunkGroup.name, + chunkGroup.options + ); + /** @type {ChunkGroupInfo} */ + const chunkGroupInfo = { + chunkGroup, + runtime, + minAvailableModules: undefined, + minAvailableModulesOwned: false, + availableModulesToBeMerged: [], + skippedItems: undefined, + resultingAvailableModules: undefined, + children: undefined, + availableSources: undefined, + availableChildren: undefined, + preOrderIndex: 0, + postOrderIndex: 0, + chunkLoading: + chunkGroup.options.chunkLoading !== undefined + ? chunkGroup.options.chunkLoading !== false + : compilation.outputOptions.chunkLoading !== false, + asyncChunks: + chunkGroup.options.asyncChunks !== undefined + ? chunkGroup.options.asyncChunks + : compilation.outputOptions.asyncChunks !== false + }; + chunkGroup.index = nextChunkGroupIndex++; + if (chunkGroup.getNumberOfParents() > 0) { + // minAvailableModules for child entrypoints are unknown yet, set to undefined. + // This means no module is added until other sets are merged into + // this minAvailableModules (by the parent entrypoints) + const skippedItems = new Set(); + for (const module of modules) { + skippedItems.add(module); + } + chunkGroupInfo.skippedItems = skippedItems; + chunkGroupsForCombining.add(chunkGroupInfo); + } else { + // The application may start here: We start with an empty list of available modules + chunkGroupInfo.minAvailableModules = EMPTY_SET; + const chunk = chunkGroup.getEntrypointChunk(); + for (const module of modules) { + queue.push({ + action: ADD_AND_ENTER_MODULE, + block: module, + module, + chunk, + chunkGroup, + chunkGroupInfo + }); + } + } + chunkGroupInfoMap.set(chunkGroup, chunkGroupInfo); + if (chunkGroup.name) { + namedChunkGroups.set(chunkGroup.name, chunkGroupInfo); + } + } + // Fill availableSources with parent-child dependencies between entrypoints + for (const chunkGroupInfo of chunkGroupsForCombining) { + const { chunkGroup } = chunkGroupInfo; + chunkGroupInfo.availableSources = new Set(); + for (const parent of chunkGroup.parentsIterable) { + const parentChunkGroupInfo = chunkGroupInfoMap.get(parent); + chunkGroupInfo.availableSources.add(parentChunkGroupInfo); + if (parentChunkGroupInfo.availableChildren === undefined) { + parentChunkGroupInfo.availableChildren = new Set(); + } + parentChunkGroupInfo.availableChildren.add(chunkGroupInfo); + } + } + // pop() is used to read from the queue + // so it need to be reversed to be iterated in + // correct order + queue.reverse(); + + /** @type {Set} */ + const outdatedChunkGroupInfo = new Set(); + /** @type {Set} */ + const chunkGroupsForMerging = new Set(); + /** @type {QueueItem[]} */ + let queueDelayed = []; + + /** @type {[Module, ConnectionState][]} */ + const skipConnectionBuffer = []; + /** @type {Module[]} */ + const skipBuffer = []; + /** @type {QueueItem[]} */ + const queueBuffer = []; + + /** @type {Module} */ + let module; + /** @type {Chunk} */ + let chunk; + /** @type {ChunkGroup} */ + let chunkGroup; + /** @type {DependenciesBlock} */ + let block; + /** @type {ChunkGroupInfo} */ + let chunkGroupInfo; + // For each async Block in graph + /** + * @param {AsyncDependenciesBlock} b iterating over each Async DepBlock + * @returns {void} + */ + const iteratorBlock = b => { + // 1. We create a chunk group with single chunk in it for this Block + // but only once (blockChunkGroups map) + let cgi = blockChunkGroups.get(b); + /** @type {ChunkGroup} */ + let c; + /** @type {Entrypoint} */ + let entrypoint; + const entryOptions = b.groupOptions && b.groupOptions.entryOptions; + if (cgi === undefined) { + const chunkName = (b.groupOptions && b.groupOptions.name) || b.chunkName; + if (entryOptions) { + cgi = namedAsyncEntrypoints.get(chunkName); + if (!cgi) { + entrypoint = compilation.addAsyncEntrypoint( + entryOptions, + module, + b.loc, + b.request + ); + entrypoint.index = nextChunkGroupIndex++; + cgi = { + chunkGroup: entrypoint, + runtime: entrypoint.options.runtime || entrypoint.name, + minAvailableModules: EMPTY_SET, + minAvailableModulesOwned: false, + availableModulesToBeMerged: [], + skippedItems: undefined, + resultingAvailableModules: undefined, + children: undefined, + availableSources: undefined, + availableChildren: undefined, + preOrderIndex: 0, + postOrderIndex: 0, + chunkLoading: + entryOptions.chunkLoading !== undefined + ? entryOptions.chunkLoading !== false + : chunkGroupInfo.chunkLoading, + asyncChunks: + entryOptions.asyncChunks !== undefined + ? entryOptions.asyncChunks + : chunkGroupInfo.asyncChunks + }; + chunkGroupInfoMap.set(entrypoint, cgi); + chunkGraph.connectBlockAndChunkGroup(b, entrypoint); + if (chunkName) { + namedAsyncEntrypoints.set(chunkName, cgi); + } + } else { + entrypoint = /** @type {Entrypoint} */ (cgi.chunkGroup); + // TODO merge entryOptions + entrypoint.addOrigin(module, b.loc, b.request); + chunkGraph.connectBlockAndChunkGroup(b, entrypoint); + } -const DependencyTemplate = __webpack_require__(5160); -const InitFragment = __webpack_require__(55870); -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); + // 2. We enqueue the DependenciesBlock for traversal + queueDelayed.push({ + action: PROCESS_ENTRY_BLOCK, + block: b, + module: module, + chunk: entrypoint.chunks[0], + chunkGroup: entrypoint, + chunkGroupInfo: cgi + }); + } else if (!chunkGroupInfo.asyncChunks || !chunkGroupInfo.chunkLoading) { + // Just queue the block into the current chunk group + queue.push({ + action: PROCESS_BLOCK, + block: b, + module: module, + chunk, + chunkGroup, + chunkGroupInfo + }); + } else { + cgi = chunkName && namedChunkGroups.get(chunkName); + if (!cgi) { + c = compilation.addChunkInGroup( + b.groupOptions || b.chunkName, + module, + b.loc, + b.request + ); + c.index = nextChunkGroupIndex++; + cgi = { + chunkGroup: c, + runtime: chunkGroupInfo.runtime, + minAvailableModules: undefined, + minAvailableModulesOwned: undefined, + availableModulesToBeMerged: [], + skippedItems: undefined, + resultingAvailableModules: undefined, + children: undefined, + availableSources: undefined, + availableChildren: undefined, + preOrderIndex: 0, + postOrderIndex: 0, + chunkLoading: chunkGroupInfo.chunkLoading, + asyncChunks: chunkGroupInfo.asyncChunks + }; + allCreatedChunkGroups.add(c); + chunkGroupInfoMap.set(c, cgi); + if (chunkName) { + namedChunkGroups.set(chunkName, cgi); + } + } else { + c = cgi.chunkGroup; + if (c.isInitial()) { + compilation.errors.push( + new AsyncDependencyToInitialChunkError(chunkName, module, b.loc) + ); + c = chunkGroup; + } + c.addOptions(b.groupOptions); + c.addOrigin(module, b.loc, b.request); + } + blockConnections.set(b, []); + } + blockChunkGroups.set(b, cgi); + } else if (entryOptions) { + entrypoint = /** @type {Entrypoint} */ (cgi.chunkGroup); + } else { + c = cgi.chunkGroup; + } -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("../util/Hash")} Hash */ + if (c !== undefined) { + // 2. We store the connection for the block + // to connect it later if needed + blockConnections.get(b).push({ + originChunkGroupInfo: chunkGroupInfo, + chunkGroup: c + }); -class CachedConstDependency extends NullDependency { - constructor(expression, range, identifier) { - super(); + // 3. We enqueue the chunk group info creation/updating + let connectList = queueConnect.get(chunkGroupInfo); + if (connectList === undefined) { + connectList = new Set(); + queueConnect.set(chunkGroupInfo, connectList); + } + connectList.add(cgi); - this.expression = expression; - this.range = range; - this.identifier = identifier; - this._hashUpdate = undefined; - } + // TODO check if this really need to be done for each traversal + // or if it is enough when it's queued when created + // 4. We enqueue the DependenciesBlock for traversal + queueDelayed.push({ + action: PROCESS_BLOCK, + block: b, + module: module, + chunk: c.chunks[0], + chunkGroup: c, + chunkGroupInfo: cgi + }); + } else if (entrypoint !== undefined) { + chunkGroupInfo.chunkGroup.addAsyncEntrypoint(entrypoint); + } + }; /** - * Update the hash - * @param {Hash} hash hash to be updated - * @param {UpdateHashContext} context context + * @param {DependenciesBlock} block the block * @returns {void} */ - updateHash(hash, context) { - if (this._hashUpdate === undefined) - this._hashUpdate = "" + this.identifier + this.range + this.expression; - hash.update(this._hashUpdate); - } - - serialize(context) { - const { write } = context; - - write(this.expression); - write(this.range); - write(this.identifier); - - super.serialize(context); - } - - deserialize(context) { - const { read } = context; + const processBlock = block => { + statProcessedBlocks++; + // get prepared block info + const blockModules = getBlockModules(block, chunkGroupInfo.runtime); - this.expression = read(); - this.range = read(); - this.identifier = read(); + if (blockModules !== undefined) { + const { minAvailableModules } = chunkGroupInfo; + // Buffer items because order need to be reversed to get indices correct + // Traverse all referenced modules + for (let i = 0; i < blockModules.length; i += 2) { + const refModule = /** @type {Module} */ (blockModules[i]); + if (chunkGraph.isModuleInChunk(refModule, chunk)) { + // skip early if already connected + continue; + } + const activeState = /** @type {ConnectionState} */ ( + blockModules[i + 1] + ); + if (activeState !== true) { + skipConnectionBuffer.push([refModule, activeState]); + if (activeState === false) continue; + } + if ( + activeState === true && + (minAvailableModules.has(refModule) || + minAvailableModules.plus.has(refModule)) + ) { + // already in parent chunks, skip it for now + skipBuffer.push(refModule); + continue; + } + // enqueue, then add and enter to be in the correct order + // this is relevant with circular dependencies + queueBuffer.push({ + action: activeState === true ? ADD_AND_ENTER_MODULE : PROCESS_BLOCK, + block: refModule, + module: refModule, + chunk, + chunkGroup, + chunkGroupInfo + }); + } + // Add buffered items in reverse order + if (skipConnectionBuffer.length > 0) { + let { skippedModuleConnections } = chunkGroupInfo; + if (skippedModuleConnections === undefined) { + chunkGroupInfo.skippedModuleConnections = skippedModuleConnections = + new Set(); + } + for (let i = skipConnectionBuffer.length - 1; i >= 0; i--) { + skippedModuleConnections.add(skipConnectionBuffer[i]); + } + skipConnectionBuffer.length = 0; + } + if (skipBuffer.length > 0) { + let { skippedItems } = chunkGroupInfo; + if (skippedItems === undefined) { + chunkGroupInfo.skippedItems = skippedItems = new Set(); + } + for (let i = skipBuffer.length - 1; i >= 0; i--) { + skippedItems.add(skipBuffer[i]); + } + skipBuffer.length = 0; + } + if (queueBuffer.length > 0) { + for (let i = queueBuffer.length - 1; i >= 0; i--) { + queue.push(queueBuffer[i]); + } + queueBuffer.length = 0; + } + } - super.deserialize(context); - } -} + // Traverse all Blocks + for (const b of block.blocks) { + iteratorBlock(b); + } -makeSerializable( - CachedConstDependency, - "webpack/lib/dependencies/CachedConstDependency" -); + if (block.blocks.length > 0 && module !== block) { + blocksWithNestedBlocks.add(block); + } + }; -CachedConstDependency.Template = class CachedConstDependencyTemplate extends ( - DependencyTemplate -) { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object + * @param {DependenciesBlock} block the block * @returns {void} */ - apply( - dependency, - source, - { runtimeTemplate, dependencyTemplates, initFragments } - ) { - const dep = /** @type {CachedConstDependency} */ (dependency); - - initFragments.push( - new InitFragment( - `var ${dep.identifier} = ${dep.expression};\n`, - InitFragment.STAGE_CONSTANTS, - 0, - `const ${dep.identifier}` - ) - ); - - if (typeof dep.range === "number") { - source.insert(dep.range, dep.identifier); + const processEntryBlock = block => { + statProcessedBlocks++; + // get prepared block info + const blockModules = getBlockModules(block, chunkGroupInfo.runtime); - return; + if (blockModules !== undefined) { + // Traverse all referenced modules + for (let i = 0; i < blockModules.length; i += 2) { + const refModule = /** @type {Module} */ (blockModules[i]); + const activeState = /** @type {ConnectionState} */ ( + blockModules[i + 1] + ); + // enqueue, then add and enter to be in the correct order + // this is relevant with circular dependencies + queueBuffer.push({ + action: + activeState === true ? ADD_AND_ENTER_ENTRY_MODULE : PROCESS_BLOCK, + block: refModule, + module: refModule, + chunk, + chunkGroup, + chunkGroupInfo + }); + } + // Add buffered items in reverse order + if (queueBuffer.length > 0) { + for (let i = queueBuffer.length - 1; i >= 0; i--) { + queue.push(queueBuffer[i]); + } + queueBuffer.length = 0; + } } - source.replace(dep.range[0], dep.range[1] - 1, dep.identifier); - } -}; - -module.exports = CachedConstDependency; - - -/***/ }), - -/***/ 59643: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - + // Traverse all Blocks + for (const b of block.blocks) { + iteratorBlock(b); + } -const RuntimeGlobals = __webpack_require__(16475); + if (block.blocks.length > 0 && module !== block) { + blocksWithNestedBlocks.add(block); + } + }; -exports.handleDependencyBase = (depBase, module, runtimeRequirements) => { - let base = undefined; - let type; - switch (depBase) { - case "exports": - runtimeRequirements.add(RuntimeGlobals.exports); - base = module.exportsArgument; - type = "expression"; - break; - case "module.exports": - runtimeRequirements.add(RuntimeGlobals.module); - base = `${module.moduleArgument}.exports`; - type = "expression"; - break; - case "this": - runtimeRequirements.add(RuntimeGlobals.thisAsExports); - base = "this"; - type = "expression"; - break; - case "Object.defineProperty(exports)": - runtimeRequirements.add(RuntimeGlobals.exports); - base = module.exportsArgument; - type = "Object.defineProperty"; - break; - case "Object.defineProperty(module.exports)": - runtimeRequirements.add(RuntimeGlobals.module); - base = `${module.moduleArgument}.exports`; - type = "Object.defineProperty"; - break; - case "Object.defineProperty(this)": - runtimeRequirements.add(RuntimeGlobals.thisAsExports); - base = "this"; - type = "Object.defineProperty"; - break; - default: - throw new Error(`Unsupported base ${depBase}`); - } + const processQueue = () => { + while (queue.length) { + statProcessedQueueItems++; + const queueItem = queue.pop(); + module = queueItem.module; + block = queueItem.block; + chunk = queueItem.chunk; + chunkGroup = queueItem.chunkGroup; + chunkGroupInfo = queueItem.chunkGroupInfo; - return [type, base]; -}; + switch (queueItem.action) { + case ADD_AND_ENTER_ENTRY_MODULE: + chunkGraph.connectChunkAndEntryModule( + chunk, + module, + /** @type {Entrypoint} */ (chunkGroup) + ); + // fallthrough + case ADD_AND_ENTER_MODULE: { + if (chunkGraph.isModuleInChunk(module, chunk)) { + // already connected, skip it + break; + } + // We connect Module and Chunk + chunkGraph.connectChunkAndModule(chunk, module); + } + // fallthrough + case ENTER_MODULE: { + const index = chunkGroup.getModulePreOrderIndex(module); + if (index === undefined) { + chunkGroup.setModulePreOrderIndex( + module, + chunkGroupInfo.preOrderIndex++ + ); + } + if ( + moduleGraph.setPreOrderIndexIfUnset( + module, + nextFreeModulePreOrderIndex + ) + ) { + nextFreeModulePreOrderIndex++; + } -/***/ }), + // reuse queueItem + queueItem.action = LEAVE_MODULE; + queue.push(queueItem); + } + // fallthrough + case PROCESS_BLOCK: { + processBlock(block); + break; + } + case PROCESS_ENTRY_BLOCK: { + processEntryBlock(block); + break; + } + case LEAVE_MODULE: { + const index = chunkGroup.getModulePostOrderIndex(module); + if (index === undefined) { + chunkGroup.setModulePostOrderIndex( + module, + chunkGroupInfo.postOrderIndex++ + ); + } -/***/ 62892: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if ( + moduleGraph.setPostOrderIndexIfUnset( + module, + nextFreeModulePostOrderIndex + ) + ) { + nextFreeModulePostOrderIndex++; + } + break; + } + } + } + }; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const calculateResultingAvailableModules = chunkGroupInfo => { + if (chunkGroupInfo.resultingAvailableModules) + return chunkGroupInfo.resultingAvailableModules; + const minAvailableModules = chunkGroupInfo.minAvailableModules; + // Create a new Set of available modules at this point + // We want to be as lazy as possible. There are multiple ways doing this: + // Note that resultingAvailableModules is stored as "(a) + (b)" as it's a ModuleSetPlus + // - resultingAvailableModules = (modules of chunk) + (minAvailableModules + minAvailableModules.plus) + // - resultingAvailableModules = (minAvailableModules + modules of chunk) + (minAvailableModules.plus) + // We choose one depending on the size of minAvailableModules vs minAvailableModules.plus -const Dependency = __webpack_require__(54912); -const { UsageState } = __webpack_require__(63686); -const Template = __webpack_require__(1626); -const { equals } = __webpack_require__(84953); -const makeSerializable = __webpack_require__(33032); -const propertyAccess = __webpack_require__(54190); -const { handleDependencyBase } = __webpack_require__(59643); -const ModuleDependency = __webpack_require__(80321); -const processExportInfo = __webpack_require__(55207); + let resultingAvailableModules; + if (minAvailableModules.size > minAvailableModules.plus.size) { + // resultingAvailableModules = (modules of chunk) + (minAvailableModules + minAvailableModules.plus) + resultingAvailableModules = + /** @type {Set & {plus: Set}} */ (new Set()); + for (const module of minAvailableModules.plus) + minAvailableModules.add(module); + minAvailableModules.plus = EMPTY_SET; + resultingAvailableModules.plus = minAvailableModules; + chunkGroupInfo.minAvailableModulesOwned = false; + } else { + // resultingAvailableModules = (minAvailableModules + modules of chunk) + (minAvailableModules.plus) + resultingAvailableModules = + /** @type {Set & {plus: Set}} */ ( + new Set(minAvailableModules) + ); + resultingAvailableModules.plus = minAvailableModules.plus; + } -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + // add the modules from the chunk group to the set + for (const chunk of chunkGroupInfo.chunkGroup.chunks) { + for (const m of chunkGraph.getChunkModulesIterable(chunk)) { + resultingAvailableModules.add(m); + } + } + return (chunkGroupInfo.resultingAvailableModules = + resultingAvailableModules); + }; -const idsSymbol = Symbol("CommonJsExportRequireDependency.ids"); + const processConnectQueue = () => { + // Figure out new parents for chunk groups + // to get new available modules for these children + for (const [chunkGroupInfo, targets] of queueConnect) { + // 1. Add new targets to the list of children + if (chunkGroupInfo.children === undefined) { + chunkGroupInfo.children = targets; + } else { + for (const target of targets) { + chunkGroupInfo.children.add(target); + } + } -const EMPTY_OBJECT = {}; + // 2. Calculate resulting available modules + const resultingAvailableModules = + calculateResultingAvailableModules(chunkGroupInfo); -class CommonJsExportRequireDependency extends ModuleDependency { - constructor(range, valueRange, base, names, request, ids, resultUsed) { - super(request); - this.range = range; - this.valueRange = valueRange; - this.base = base; - this.names = names; - this.ids = ids; - this.resultUsed = resultUsed; - this.asiSafe = undefined; - } + const runtime = chunkGroupInfo.runtime; - get type() { - return "cjs export require"; - } + // 3. Update chunk group info + for (const target of targets) { + target.availableModulesToBeMerged.push(resultingAvailableModules); + chunkGroupsForMerging.add(target); + const oldRuntime = target.runtime; + const newRuntime = mergeRuntime(oldRuntime, runtime); + if (oldRuntime !== newRuntime) { + target.runtime = newRuntime; + outdatedChunkGroupInfo.add(target); + } + } - /** - * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module - */ - couldAffectReferencingModule() { - return Dependency.TRANSITIVE; - } + statConnectedChunkGroups += targets.size; + } + queueConnect.clear(); + }; - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {string[]} the imported id - */ - getIds(moduleGraph) { - return moduleGraph.getMeta(this)[idsSymbol] || this.ids; - } + const processChunkGroupsForMerging = () => { + statProcessedChunkGroupsForMerging += chunkGroupsForMerging.size; - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {string[]} ids the imported ids - * @returns {void} - */ - setIds(moduleGraph, ids) { - moduleGraph.getMeta(this)[idsSymbol] = ids; - } + // Execute the merge + for (const info of chunkGroupsForMerging) { + const availableModulesToBeMerged = info.availableModulesToBeMerged; + let cachedMinAvailableModules = info.minAvailableModules; - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - const ids = this.getIds(moduleGraph); - const getFullResult = () => { - if (ids.length === 0) { - return Dependency.EXPORTS_OBJECT_REFERENCED; - } else { - return [ - { - name: ids, - canMangle: false + statMergedAvailableModuleSets += availableModulesToBeMerged.length; + + // 1. Get minimal available modules + // It doesn't make sense to traverse a chunk again with more available modules. + // This step calculates the minimal available modules and skips traversal when + // the list didn't shrink. + if (availableModulesToBeMerged.length > 1) { + availableModulesToBeMerged.sort(bySetSize); + } + let changed = false; + merge: for (const availableModules of availableModulesToBeMerged) { + if (cachedMinAvailableModules === undefined) { + cachedMinAvailableModules = availableModules; + info.minAvailableModules = cachedMinAvailableModules; + info.minAvailableModulesOwned = false; + changed = true; + } else { + if (info.minAvailableModulesOwned) { + // We own it and can modify it + if (cachedMinAvailableModules.plus === availableModules.plus) { + for (const m of cachedMinAvailableModules) { + if (!availableModules.has(m)) { + cachedMinAvailableModules.delete(m); + changed = true; + } + } + } else { + for (const m of cachedMinAvailableModules) { + if (!availableModules.has(m) && !availableModules.plus.has(m)) { + cachedMinAvailableModules.delete(m); + changed = true; + } + } + for (const m of cachedMinAvailableModules.plus) { + if (!availableModules.has(m) && !availableModules.plus.has(m)) { + // We can't remove modules from the plus part + // so we need to merge plus into the normal part to allow modifying it + const iterator = + cachedMinAvailableModules.plus[Symbol.iterator](); + // fast forward add all modules until m + /** @type {IteratorResult} */ + let it; + while (!(it = iterator.next()).done) { + const module = it.value; + if (module === m) break; + cachedMinAvailableModules.add(module); + } + // check the remaining modules before adding + while (!(it = iterator.next()).done) { + const module = it.value; + if ( + availableModules.has(module) || + availableModules.plus.has(module) + ) { + cachedMinAvailableModules.add(module); + } + } + cachedMinAvailableModules.plus = EMPTY_SET; + changed = true; + continue merge; + } + } + } + } else if (cachedMinAvailableModules.plus === availableModules.plus) { + // Common and fast case when the plus part is shared + // We only need to care about the normal part + if (availableModules.size < cachedMinAvailableModules.size) { + // the new availableModules is smaller so it's faster to + // fork from the new availableModules + statForkedAvailableModules++; + statForkedAvailableModulesCount += availableModules.size; + statForkedMergedModulesCount += cachedMinAvailableModules.size; + // construct a new Set as intersection of cachedMinAvailableModules and availableModules + const newSet = /** @type {ModuleSetPlus} */ (new Set()); + newSet.plus = availableModules.plus; + for (const m of availableModules) { + if (cachedMinAvailableModules.has(m)) { + newSet.add(m); + } + } + statForkedResultModulesCount += newSet.size; + cachedMinAvailableModules = newSet; + info.minAvailableModulesOwned = true; + info.minAvailableModules = newSet; + changed = true; + continue merge; + } + for (const m of cachedMinAvailableModules) { + if (!availableModules.has(m)) { + // cachedMinAvailableModules need to be modified + // but we don't own it + statForkedAvailableModules++; + statForkedAvailableModulesCount += + cachedMinAvailableModules.size; + statForkedMergedModulesCount += availableModules.size; + // construct a new Set as intersection of cachedMinAvailableModules and availableModules + // as the plus part is equal we can just take over this one + const newSet = /** @type {ModuleSetPlus} */ (new Set()); + newSet.plus = availableModules.plus; + const iterator = cachedMinAvailableModules[Symbol.iterator](); + // fast forward add all modules until m + /** @type {IteratorResult} */ + let it; + while (!(it = iterator.next()).done) { + const module = it.value; + if (module === m) break; + newSet.add(module); + } + // check the remaining modules before adding + while (!(it = iterator.next()).done) { + const module = it.value; + if (availableModules.has(module)) { + newSet.add(module); + } + } + statForkedResultModulesCount += newSet.size; + cachedMinAvailableModules = newSet; + info.minAvailableModulesOwned = true; + info.minAvailableModules = newSet; + changed = true; + continue merge; + } + } + } else { + for (const m of cachedMinAvailableModules) { + if (!availableModules.has(m) && !availableModules.plus.has(m)) { + // cachedMinAvailableModules need to be modified + // but we don't own it + statForkedAvailableModules++; + statForkedAvailableModulesCount += + cachedMinAvailableModules.size; + statForkedAvailableModulesCountPlus += + cachedMinAvailableModules.plus.size; + statForkedMergedModulesCount += availableModules.size; + statForkedMergedModulesCountPlus += availableModules.plus.size; + // construct a new Set as intersection of cachedMinAvailableModules and availableModules + const newSet = /** @type {ModuleSetPlus} */ (new Set()); + newSet.plus = EMPTY_SET; + const iterator = cachedMinAvailableModules[Symbol.iterator](); + // fast forward add all modules until m + /** @type {IteratorResult} */ + let it; + while (!(it = iterator.next()).done) { + const module = it.value; + if (module === m) break; + newSet.add(module); + } + // check the remaining modules before adding + while (!(it = iterator.next()).done) { + const module = it.value; + if ( + availableModules.has(module) || + availableModules.plus.has(module) + ) { + newSet.add(module); + } + } + // also check all modules in cachedMinAvailableModules.plus + for (const module of cachedMinAvailableModules.plus) { + if ( + availableModules.has(module) || + availableModules.plus.has(module) + ) { + newSet.add(module); + } + } + statForkedResultModulesCount += newSet.size; + cachedMinAvailableModules = newSet; + info.minAvailableModulesOwned = true; + info.minAvailableModules = newSet; + changed = true; + continue merge; + } + } + for (const m of cachedMinAvailableModules.plus) { + if (!availableModules.has(m) && !availableModules.plus.has(m)) { + // cachedMinAvailableModules need to be modified + // but we don't own it + statForkedAvailableModules++; + statForkedAvailableModulesCount += + cachedMinAvailableModules.size; + statForkedAvailableModulesCountPlus += + cachedMinAvailableModules.plus.size; + statForkedMergedModulesCount += availableModules.size; + statForkedMergedModulesCountPlus += availableModules.plus.size; + // construct a new Set as intersection of cachedMinAvailableModules and availableModules + // we already know that all modules directly from cachedMinAvailableModules are in availableModules too + const newSet = /** @type {ModuleSetPlus} */ ( + new Set(cachedMinAvailableModules) + ); + newSet.plus = EMPTY_SET; + const iterator = + cachedMinAvailableModules.plus[Symbol.iterator](); + // fast forward add all modules until m + /** @type {IteratorResult} */ + let it; + while (!(it = iterator.next()).done) { + const module = it.value; + if (module === m) break; + newSet.add(module); + } + // check the remaining modules before adding + while (!(it = iterator.next()).done) { + const module = it.value; + if ( + availableModules.has(module) || + availableModules.plus.has(module) + ) { + newSet.add(module); + } + } + statForkedResultModulesCount += newSet.size; + cachedMinAvailableModules = newSet; + info.minAvailableModulesOwned = true; + info.minAvailableModules = newSet; + changed = true; + continue merge; + } + } } - ]; + } + } + availableModulesToBeMerged.length = 0; + if (changed) { + info.resultingAvailableModules = undefined; + outdatedChunkGroupInfo.add(info); } - }; - if (this.resultUsed) return getFullResult(); - let exportsInfo = moduleGraph.getExportsInfo( - moduleGraph.getParentModule(this) - ); - for (const name of this.names) { - const exportInfo = exportsInfo.getReadOnlyExportInfo(name); - const used = exportInfo.getUsed(runtime); - if (used === UsageState.Unused) return Dependency.NO_EXPORTS_REFERENCED; - if (used !== UsageState.OnlyPropertiesUsed) return getFullResult(); - exportsInfo = exportInfo.exportsInfo; - if (!exportsInfo) return getFullResult(); - } - if (exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused) { - return getFullResult(); - } - /** @type {string[][]} */ - const referencedExports = []; - for (const exportInfo of exportsInfo.orderedExports) { - processExportInfo( - runtime, - referencedExports, - ids.concat(exportInfo.name), - exportInfo, - false - ); } - return referencedExports.map(name => ({ - name, - canMangle: false - })); - } + chunkGroupsForMerging.clear(); + }; - /** - * Returns the exported names - * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names - */ - getExports(moduleGraph) { - const ids = this.getIds(moduleGraph); - if (this.names.length === 1) { - const name = this.names[0]; - const from = moduleGraph.getConnection(this); - if (!from) return; - return { - exports: [ - { - name, - from, - export: ids.length === 0 ? null : ids, - // we can't mangle names that are in an empty object - // because one could access the prototype property - // when export isn't set yet - canMangle: !(name in EMPTY_OBJECT) && false - } - ], - dependencies: [from.module] - }; - } else if (this.names.length > 0) { - const name = this.names[0]; - return { - exports: [ - { - name, - // we can't mangle names that are in an empty object - // because one could access the prototype property - // when export isn't set yet - canMangle: !(name in EMPTY_OBJECT) && false - } - ], - dependencies: undefined - }; - } else { - const from = moduleGraph.getConnection(this); - if (!from) return; - const reexportInfo = this.getStarReexports( - moduleGraph, - undefined, - from.module - ); - if (reexportInfo) { - return { - exports: Array.from(reexportInfo.exports, name => { - return { - name, - from, - export: ids.concat(name), - canMangle: !(name in EMPTY_OBJECT) && false - }; - }), - // TODO handle deep reexports - dependencies: [from.module] - }; - } else { - return { - exports: true, - from: ids.length === 0 ? from : undefined, - canMangle: false, - dependencies: [from.module] - }; + const processChunkGroupsForCombining = () => { + for (const info of chunkGroupsForCombining) { + for (const source of info.availableSources) { + if (!source.minAvailableModules) { + chunkGroupsForCombining.delete(info); + break; + } } } - } - - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {RuntimeSpec} runtime the runtime - * @param {Module} importedModule the imported module (optional) - * @returns {{exports?: Set, checked?: Set}} information - */ - getStarReexports( - moduleGraph, - runtime, - importedModule = moduleGraph.getModule(this) - ) { - let importedExportsInfo = moduleGraph.getExportsInfo(importedModule); - const ids = this.getIds(moduleGraph); - if (ids.length > 0) - importedExportsInfo = importedExportsInfo.getNestedExportsInfo(ids); - let exportsInfo = moduleGraph.getExportsInfo( - moduleGraph.getParentModule(this) - ); - if (this.names.length > 0) - exportsInfo = exportsInfo.getNestedExportsInfo(this.names); - - const noExtraExports = - importedExportsInfo && - importedExportsInfo.otherExportsInfo.provided === false; - const noExtraImports = - exportsInfo && - exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused; - - if (!noExtraExports && !noExtraImports) { - return; + for (const info of chunkGroupsForCombining) { + const availableModules = /** @type {ModuleSetPlus} */ (new Set()); + availableModules.plus = EMPTY_SET; + const mergeSet = set => { + if (set.size > availableModules.plus.size) { + for (const item of availableModules.plus) availableModules.add(item); + availableModules.plus = set; + } else { + for (const item of set) availableModules.add(item); + } + }; + // combine minAvailableModules from all resultingAvailableModules + for (const source of info.availableSources) { + const resultingAvailableModules = + calculateResultingAvailableModules(source); + mergeSet(resultingAvailableModules); + mergeSet(resultingAvailableModules.plus); + } + info.minAvailableModules = availableModules; + info.minAvailableModulesOwned = false; + info.resultingAvailableModules = undefined; + outdatedChunkGroupInfo.add(info); } + chunkGroupsForCombining.clear(); + }; - const isNamespaceImport = - importedModule.getExportsType(moduleGraph, false) === "namespace"; - - /** @type {Set} */ - const exports = new Set(); - /** @type {Set} */ - const checked = new Set(); + const processOutdatedChunkGroupInfo = () => { + statChunkGroupInfoUpdated += outdatedChunkGroupInfo.size; + // Revisit skipped elements + for (const info of outdatedChunkGroupInfo) { + // 1. Reconsider skipped items + if (info.skippedItems !== undefined) { + const { minAvailableModules } = info; + for (const module of info.skippedItems) { + if ( + !minAvailableModules.has(module) && + !minAvailableModules.plus.has(module) + ) { + queue.push({ + action: ADD_AND_ENTER_MODULE, + block: module, + module, + chunk: info.chunkGroup.chunks[0], + chunkGroup: info.chunkGroup, + chunkGroupInfo: info + }); + info.skippedItems.delete(module); + } + } + } - if (noExtraImports) { - for (const exportInfo of exportsInfo.orderedExports) { - const name = exportInfo.name; - if (exportInfo.getUsed(runtime) === UsageState.Unused) continue; - if (name === "__esModule" && isNamespaceImport) { - exports.add(name); - } else if (importedExportsInfo) { - const importedExportInfo = - importedExportsInfo.getReadOnlyExportInfo(name); - if (importedExportInfo.provided === false) continue; - exports.add(name); - if (importedExportInfo.provided === true) continue; - checked.add(name); - } else { - exports.add(name); - checked.add(name); + // 2. Reconsider skipped connections + if (info.skippedModuleConnections !== undefined) { + const { minAvailableModules } = info; + for (const entry of info.skippedModuleConnections) { + const [module, activeState] = entry; + if (activeState === false) continue; + if (activeState === true) { + info.skippedModuleConnections.delete(entry); + } + if ( + activeState === true && + (minAvailableModules.has(module) || + minAvailableModules.plus.has(module)) + ) { + info.skippedItems.add(module); + continue; + } + queue.push({ + action: activeState === true ? ADD_AND_ENTER_MODULE : PROCESS_BLOCK, + block: module, + module, + chunk: info.chunkGroup.chunks[0], + chunkGroup: info.chunkGroup, + chunkGroupInfo: info + }); } } - } else if (noExtraExports) { - for (const importedExportInfo of importedExportsInfo.orderedExports) { - const name = importedExportInfo.name; - if (importedExportInfo.provided === false) continue; - if (exportsInfo) { - const exportInfo = exportsInfo.getReadOnlyExportInfo(name); - if (exportInfo.getUsed(runtime) === UsageState.Unused) continue; + + // 2. Reconsider children chunk groups + if (info.children !== undefined) { + statChildChunkGroupsReconnected += info.children.size; + for (const cgi of info.children) { + let connectList = queueConnect.get(info); + if (connectList === undefined) { + connectList = new Set(); + queueConnect.set(info, connectList); + } + connectList.add(cgi); } - exports.add(name); - if (importedExportInfo.provided === true) continue; - checked.add(name); } - if (isNamespaceImport) { - exports.add("__esModule"); - checked.delete("__esModule"); + + // 3. Reconsider chunk groups for combining + if (info.availableChildren !== undefined) { + for (const cgi of info.availableChildren) { + chunkGroupsForCombining.add(cgi); + } } } + outdatedChunkGroupInfo.clear(); + }; - return { exports, checked }; - } - - serialize(context) { - const { write } = context; - write(this.asiSafe); - write(this.range); - write(this.valueRange); - write(this.base); - write(this.names); - write(this.ids); - write(this.resultUsed); - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - this.asiSafe = read(); - this.range = read(); - this.valueRange = read(); - this.base = read(); - this.names = read(); - this.ids = read(); - this.resultUsed = read(); - super.deserialize(context); - } -} - -makeSerializable( - CommonJsExportRequireDependency, - "webpack/lib/dependencies/CommonJsExportRequireDependency" -); + // Iterative traversal of the Module graph + // Recursive would be simpler to write but could result in Stack Overflows + while (queue.length || queueConnect.size) { + logger.time("visitModules: visiting"); + processQueue(); + logger.timeAggregateEnd("visitModules: prepare"); + logger.timeEnd("visitModules: visiting"); -CommonJsExportRequireDependency.Template = class CommonJsExportRequireDependencyTemplate extends ( - ModuleDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply( - dependency, - source, - { - module, - runtimeTemplate, - chunkGraph, - moduleGraph, - runtimeRequirements, - runtime + if (chunkGroupsForCombining.size > 0) { + logger.time("visitModules: combine available modules"); + processChunkGroupsForCombining(); + logger.timeEnd("visitModules: combine available modules"); } - ) { - const dep = /** @type {CommonJsExportRequireDependency} */ (dependency); - const used = moduleGraph - .getExportsInfo(module) - .getUsedName(dep.names, runtime); - const [type, base] = handleDependencyBase( - dep.base, - module, - runtimeRequirements - ); + if (queueConnect.size > 0) { + logger.time("visitModules: calculating available modules"); + processConnectQueue(); + logger.timeEnd("visitModules: calculating available modules"); - const importedModule = moduleGraph.getModule(dep); - let requireExpr = runtimeTemplate.moduleExports({ - module: importedModule, - chunkGraph, - request: dep.request, - weak: dep.weak, - runtimeRequirements - }); - if (importedModule) { - const ids = dep.getIds(moduleGraph); - const usedImported = moduleGraph - .getExportsInfo(importedModule) - .getUsedName(ids, runtime); - if (usedImported) { - const comment = equals(usedImported, ids) - ? "" - : Template.toNormalComment(propertyAccess(ids)) + " "; - requireExpr += `${comment}${propertyAccess(usedImported)}`; + if (chunkGroupsForMerging.size > 0) { + logger.time("visitModules: merging available modules"); + processChunkGroupsForMerging(); + logger.timeEnd("visitModules: merging available modules"); } } - switch (type) { - case "expression": - source.replace( - dep.range[0], - dep.range[1] - 1, - used - ? `${base}${propertyAccess(used)} = ${requireExpr}` - : `/* unused reexport */ ${requireExpr}` - ); - return; - case "Object.defineProperty": - throw new Error("TODO"); - default: - throw new Error("Unexpected type"); + if (outdatedChunkGroupInfo.size > 0) { + logger.time("visitModules: check modules for revisit"); + processOutdatedChunkGroupInfo(); + logger.timeEnd("visitModules: check modules for revisit"); } - } -}; - -module.exports = CommonJsExportRequireDependency; - - -/***/ }), - -/***/ 45598: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const InitFragment = __webpack_require__(55870); -const makeSerializable = __webpack_require__(33032); -const propertyAccess = __webpack_require__(54190); -const { handleDependencyBase } = __webpack_require__(59643); -const NullDependency = __webpack_require__(31830); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ - -const EMPTY_OBJECT = {}; - -class CommonJsExportsDependency extends NullDependency { - constructor(range, valueRange, base, names) { - super(); - this.range = range; - this.valueRange = valueRange; - this.base = base; - this.names = names; - } - - get type() { - return "cjs exports"; - } - - /** - * Returns the exported names - * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names - */ - getExports(moduleGraph) { - const name = this.names[0]; - return { - exports: [ - { - name, - // we can't mangle names that are in an empty object - // because one could access the prototype property - // when export isn't set yet - canMangle: !(name in EMPTY_OBJECT) - } - ], - dependencies: undefined - }; - } - serialize(context) { - const { write } = context; - write(this.range); - write(this.valueRange); - write(this.base); - write(this.names); - super.serialize(context); + // Run queueDelayed when all items of the queue are processed + // This is important to get the global indexing correct + // Async blocks should be processed after all sync blocks are processed + if (queue.length === 0) { + const tempQueue = queue; + queue = queueDelayed.reverse(); + queueDelayed = tempQueue; + } } - deserialize(context) { - const { read } = context; - this.range = read(); - this.valueRange = read(); - this.base = read(); - this.names = read(); - super.deserialize(context); - } -} + logger.log( + `${statProcessedQueueItems} queue items processed (${statProcessedBlocks} blocks)` + ); + logger.log(`${statConnectedChunkGroups} chunk groups connected`); + logger.log( + `${statProcessedChunkGroupsForMerging} chunk groups processed for merging (${statMergedAvailableModuleSets} module sets, ${statForkedAvailableModules} forked, ${statForkedAvailableModulesCount} + ${statForkedAvailableModulesCountPlus} modules forked, ${statForkedMergedModulesCount} + ${statForkedMergedModulesCountPlus} modules merged into fork, ${statForkedResultModulesCount} resulting modules)` + ); + logger.log( + `${statChunkGroupInfoUpdated} chunk group info updated (${statChildChunkGroupsReconnected} already connected chunk groups reconnected)` + ); +}; -makeSerializable( - CommonJsExportsDependency, - "webpack/lib/dependencies/CommonJsExportsDependency" -); +/** + * + * @param {Compilation} compilation the compilation + * @param {Set} blocksWithNestedBlocks flag for blocks that have nested blocks + * @param {Map} blockConnections connection for blocks + * @param {Map} chunkGroupInfoMap mapping from chunk group to available modules + */ +const connectChunkGroups = ( + compilation, + blocksWithNestedBlocks, + blockConnections, + chunkGroupInfoMap +) => { + const { chunkGraph } = compilation; -CommonJsExportsDependency.Template = class CommonJsExportsDependencyTemplate extends ( - NullDependency.Template -) { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} + * Helper function to check if all modules of a chunk are available + * + * @param {ChunkGroup} chunkGroup the chunkGroup to scan + * @param {ModuleSetPlus} availableModules the comparator set + * @returns {boolean} return true if all modules of a chunk are available */ - apply( - dependency, - source, - { module, moduleGraph, initFragments, runtimeRequirements, runtime } - ) { - const dep = /** @type {CommonJsExportsDependency} */ (dependency); - const used = moduleGraph - .getExportsInfo(module) - .getUsedName(dep.names, runtime); - - const [type, base] = handleDependencyBase( - dep.base, - module, - runtimeRequirements - ); - - switch (type) { - case "expression": - if (!used) { - initFragments.push( - new InitFragment( - "var __webpack_unused_export__;\n", - InitFragment.STAGE_CONSTANTS, - 0, - "__webpack_unused_export__" - ) - ); - source.replace( - dep.range[0], - dep.range[1] - 1, - "__webpack_unused_export__" - ); - return; - } - source.replace( - dep.range[0], - dep.range[1] - 1, - `${base}${propertyAccess(used)}` - ); - return; - case "Object.defineProperty": - if (!used) { - initFragments.push( - new InitFragment( - "var __webpack_unused_export__;\n", - InitFragment.STAGE_CONSTANTS, - 0, - "__webpack_unused_export__" - ) - ); - source.replace( - dep.range[0], - dep.valueRange[0] - 1, - "__webpack_unused_export__ = (" - ); - source.replace(dep.valueRange[1], dep.range[1] - 1, ")"); - return; - } - source.replace( - dep.range[0], - dep.valueRange[0] - 1, - `Object.defineProperty(${base}${propertyAccess( - used.slice(0, -1) - )}, ${JSON.stringify(used[used.length - 1])}, (` - ); - source.replace(dep.valueRange[1], dep.range[1] - 1, "))"); - return; + const areModulesAvailable = (chunkGroup, availableModules) => { + for (const chunk of chunkGroup.chunks) { + for (const module of chunkGraph.getChunkModulesIterable(chunk)) { + if (!availableModules.has(module) && !availableModules.plus.has(module)) + return false; + } } - } -}; - -module.exports = CommonJsExportsDependency; - - -/***/ }), - -/***/ 97107: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const formatLocation = __webpack_require__(16734); -const { evaluateToString } = __webpack_require__(93998); -const propertyAccess = __webpack_require__(54190); -const CommonJsExportRequireDependency = __webpack_require__(62892); -const CommonJsExportsDependency = __webpack_require__(45598); -const CommonJsSelfReferenceDependency = __webpack_require__(52225); -const DynamicExports = __webpack_require__(32006); -const HarmonyExports = __webpack_require__(39211); -const ModuleDecoratorDependency = __webpack_require__(88488); - -/** @typedef {import("estree").Expression} ExpressionNode */ -/** @typedef {import("../NormalModule")} NormalModule */ -/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */ -/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ + return true; + }; -const getValueOfPropertyDescription = expr => { - if (expr.type !== "ObjectExpression") return; - for (const property of expr.properties) { - if (property.computed) continue; - const key = property.key; - if (key.type !== "Identifier" || key.name !== "value") continue; - return property.value; - } -}; + // For each edge in the basic chunk graph + for (const [block, connections] of blockConnections) { + // 1. Check if connection is needed + // When none of the dependencies need to be connected + // we can skip all of them + // It's not possible to filter each item so it doesn't create inconsistent + // connections and modules can only create one version + // TODO maybe decide this per runtime + if ( + // TODO is this needed? + !blocksWithNestedBlocks.has(block) && + connections.every(({ chunkGroup, originChunkGroupInfo }) => + areModulesAvailable( + chunkGroup, + originChunkGroupInfo.resultingAvailableModules + ) + ) + ) { + continue; + } -const isTruthyLiteral = expr => { - switch (expr.type) { - case "Literal": - return !!expr.value; - case "UnaryExpression": - if (expr.operator === "!") return isFalsyLiteral(expr.argument); - } - return false; -}; + // 2. Foreach edge + for (let i = 0; i < connections.length; i++) { + const { chunkGroup, originChunkGroupInfo } = connections[i]; -const isFalsyLiteral = expr => { - switch (expr.type) { - case "Literal": - return !expr.value; - case "UnaryExpression": - if (expr.operator === "!") return isTruthyLiteral(expr.argument); - } - return false; -}; + // 3. Connect block with chunk + chunkGraph.connectBlockAndChunkGroup(block, chunkGroup); -/** - * @param {JavascriptParser} parser the parser - * @param {ExpressionNode} expr expression - * @returns {{ argument: BasicEvaluatedExpression, ids: string[] } | undefined} parsed call - */ -const parseRequireCall = (parser, expr) => { - const ids = []; - while (expr.type === "MemberExpression") { - if (expr.object.type === "Super") return; - if (!expr.property) return; - const prop = expr.property; - if (expr.computed) { - if (prop.type !== "Literal") return; - ids.push(`${prop.value}`); - } else { - if (prop.type !== "Identifier") return; - ids.push(prop.name); - } - expr = expr.object; - } - if (expr.type !== "CallExpression" || expr.arguments.length !== 1) return; - const callee = expr.callee; - if ( - callee.type !== "Identifier" || - parser.getVariableInfo(callee.name) !== "require" - ) { - return; + // 4. Connect chunk with parent + connectChunkGroupParentAndChild( + originChunkGroupInfo.chunkGroup, + chunkGroup + ); + } } - const arg = expr.arguments[0]; - if (arg.type === "SpreadElement") return; - const argValue = parser.evaluateExpression(arg); - return { argument: argValue, ids: ids.reverse() }; }; -class CommonJsExportsParserPlugin { - constructor(moduleGraph) { - this.moduleGraph = moduleGraph; - } +/** + * Remove all unconnected chunk groups + * @param {Compilation} compilation the compilation + * @param {Iterable} allCreatedChunkGroups all chunk groups that where created before + */ +const cleanupUnconnectedGroups = (compilation, allCreatedChunkGroups) => { + const { chunkGraph } = compilation; - /** - * @param {JavascriptParser} parser the parser - */ - apply(parser) { - const enableStructuredExports = () => { - DynamicExports.enable(parser.state); - }; - const checkNamespace = (topLevel, members, valueExpr) => { - if (!DynamicExports.isEnabled(parser.state)) return; - if (members.length > 0 && members[0] === "__esModule") { - if (valueExpr && isTruthyLiteral(valueExpr) && topLevel) { - DynamicExports.setFlagged(parser.state); - } else { - DynamicExports.setDynamic(parser.state); - } + for (const chunkGroup of allCreatedChunkGroups) { + if (chunkGroup.getNumberOfParents() === 0) { + for (const chunk of chunkGroup.chunks) { + compilation.chunks.delete(chunk); + chunkGraph.disconnectChunk(chunk); } - }; - const bailout = reason => { - DynamicExports.bailout(parser.state); - if (reason) bailoutHint(reason); - }; - const bailoutHint = reason => { - this.moduleGraph - .getOptimizationBailout(parser.state.module) - .push(`CommonJS bailout: ${reason}`); - }; + chunkGraph.disconnectChunkGroup(chunkGroup); + chunkGroup.remove(); + } + } +}; - // metadata // - parser.hooks.evaluateTypeof - .for("module") - .tap("CommonJsExportsParserPlugin", evaluateToString("object")); - parser.hooks.evaluateTypeof - .for("exports") - .tap("CommonJsPlugin", evaluateToString("object")); +/** + * This method creates the Chunk graph from the Module graph + * @param {Compilation} compilation the compilation + * @param {Map} inputEntrypointsAndModules chunk groups which are processed with the modules + * @returns {void} + */ +const buildChunkGraph = (compilation, inputEntrypointsAndModules) => { + const logger = compilation.getLogger("webpack.buildChunkGraph"); - // exporting // - const handleAssignExport = (expr, base, members) => { - if (HarmonyExports.isEnabled(parser.state)) return; - // Handle reexporting - const requireCall = parseRequireCall(parser, expr.right); - if ( - requireCall && - requireCall.argument.isString() && - (members.length === 0 || members[0] !== "__esModule") - ) { - enableStructuredExports(); - // It's possible to reexport __esModule, so we must convert to a dynamic module - if (members.length === 0) DynamicExports.setDynamic(parser.state); - const dep = new CommonJsExportRequireDependency( - expr.range, - null, - base, - members, - requireCall.argument.string, - requireCall.ids, - !parser.isStatementLevelExpression(expr) - ); - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.module.addDependency(dep); - return true; - } - if (members.length === 0) return; - enableStructuredExports(); - const remainingMembers = members; - checkNamespace( - parser.statementPath.length === 1 && - parser.isStatementLevelExpression(expr), - remainingMembers, - expr.right - ); - const dep = new CommonJsExportsDependency( - expr.left.range, - null, - base, - remainingMembers - ); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - parser.walkExpression(expr.right); - return true; - }; - parser.hooks.assignMemberChain - .for("exports") - .tap("CommonJsExportsParserPlugin", (expr, members) => { - return handleAssignExport(expr, "exports", members); - }); - parser.hooks.assignMemberChain - .for("this") - .tap("CommonJsExportsParserPlugin", (expr, members) => { - if (!parser.scope.topLevelScope) return; - return handleAssignExport(expr, "this", members); - }); - parser.hooks.assignMemberChain - .for("module") - .tap("CommonJsExportsParserPlugin", (expr, members) => { - if (members[0] !== "exports") return; - return handleAssignExport(expr, "module.exports", members.slice(1)); - }); - parser.hooks.call - .for("Object.defineProperty") - .tap("CommonJsExportsParserPlugin", expression => { - const expr = /** @type {import("estree").CallExpression} */ ( - expression - ); - if (!parser.isStatementLevelExpression(expr)) return; - if (expr.arguments.length !== 3) return; - if (expr.arguments[0].type === "SpreadElement") return; - if (expr.arguments[1].type === "SpreadElement") return; - if (expr.arguments[2].type === "SpreadElement") return; - const exportsArg = parser.evaluateExpression(expr.arguments[0]); - if (!exportsArg || !exportsArg.isIdentifier()) return; - if ( - exportsArg.identifier !== "exports" && - exportsArg.identifier !== "module.exports" && - (exportsArg.identifier !== "this" || !parser.scope.topLevelScope) - ) { - return; - } - const propertyArg = parser.evaluateExpression(expr.arguments[1]); - if (!propertyArg) return; - const property = propertyArg.asString(); - if (typeof property !== "string") return; - enableStructuredExports(); - const descArg = expr.arguments[2]; - checkNamespace( - parser.statementPath.length === 1, - [property], - getValueOfPropertyDescription(descArg) - ); - const dep = new CommonJsExportsDependency( - expr.range, - expr.arguments[2].range, - `Object.defineProperty(${exportsArg.identifier})`, - [property] - ); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); + // SHARED STATE - parser.walkExpression(expr.arguments[2]); - return true; - }); + /** @type {Map} */ + const blockConnections = new Map(); - // Self reference // - const handleAccessExport = (expr, base, members, call = undefined) => { - if (HarmonyExports.isEnabled(parser.state)) return; - if (members.length === 0) { - bailout(`${base} is used directly at ${formatLocation(expr.loc)}`); - } - if (call && members.length === 1) { - bailoutHint( - `${base}${propertyAccess( - members - )}(...) prevents optimization as ${base} is passed as call context at ${formatLocation( - expr.loc - )}` - ); - } - const dep = new CommonJsSelfReferenceDependency( - expr.range, - base, - members, - !!call - ); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - if (call) { - parser.walkExpressions(call.arguments); - } - return true; - }; - parser.hooks.callMemberChain - .for("exports") - .tap("CommonJsExportsParserPlugin", (expr, members) => { - return handleAccessExport(expr.callee, "exports", members, expr); - }); - parser.hooks.expressionMemberChain - .for("exports") - .tap("CommonJsExportsParserPlugin", (expr, members) => { - return handleAccessExport(expr, "exports", members); - }); - parser.hooks.expression - .for("exports") - .tap("CommonJsExportsParserPlugin", expr => { - return handleAccessExport(expr, "exports", []); - }); - parser.hooks.callMemberChain - .for("module") - .tap("CommonJsExportsParserPlugin", (expr, members) => { - if (members[0] !== "exports") return; - return handleAccessExport( - expr.callee, - "module.exports", - members.slice(1), - expr - ); - }); - parser.hooks.expressionMemberChain - .for("module") - .tap("CommonJsExportsParserPlugin", (expr, members) => { - if (members[0] !== "exports") return; - return handleAccessExport(expr, "module.exports", members.slice(1)); - }); - parser.hooks.expression - .for("module.exports") - .tap("CommonJsExportsParserPlugin", expr => { - return handleAccessExport(expr, "module.exports", []); - }); - parser.hooks.callMemberChain - .for("this") - .tap("CommonJsExportsParserPlugin", (expr, members) => { - if (!parser.scope.topLevelScope) return; - return handleAccessExport(expr.callee, "this", members, expr); - }); - parser.hooks.expressionMemberChain - .for("this") - .tap("CommonJsExportsParserPlugin", (expr, members) => { - if (!parser.scope.topLevelScope) return; - return handleAccessExport(expr, "this", members); - }); - parser.hooks.expression - .for("this") - .tap("CommonJsExportsParserPlugin", expr => { - if (!parser.scope.topLevelScope) return; - return handleAccessExport(expr, "this", []); - }); + /** @type {Set} */ + const allCreatedChunkGroups = new Set(); - // Bailouts // - parser.hooks.expression.for("module").tap("CommonJsPlugin", expr => { - bailout(); - const isHarmony = HarmonyExports.isEnabled(parser.state); - const dep = new ModuleDecoratorDependency( - isHarmony - ? RuntimeGlobals.harmonyModuleDecorator - : RuntimeGlobals.nodeModuleDecorator, - !isHarmony - ); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - return true; - }); + /** @type {Map} */ + const chunkGroupInfoMap = new Map(); + + /** @type {Set} */ + const blocksWithNestedBlocks = new Set(); + + // PART ONE + + logger.time("visitModules"); + visitModules( + logger, + compilation, + inputEntrypointsAndModules, + chunkGroupInfoMap, + blockConnections, + blocksWithNestedBlocks, + allCreatedChunkGroups + ); + logger.timeEnd("visitModules"); + + // PART TWO + + logger.time("connectChunkGroups"); + connectChunkGroups( + compilation, + blocksWithNestedBlocks, + blockConnections, + chunkGroupInfoMap + ); + logger.timeEnd("connectChunkGroups"); + + for (const [chunkGroup, chunkGroupInfo] of chunkGroupInfoMap) { + for (const chunk of chunkGroup.chunks) + chunk.runtime = mergeRuntime(chunk.runtime, chunkGroupInfo.runtime); } -} -module.exports = CommonJsExportsParserPlugin; + + // Cleanup work + + logger.time("cleanup"); + cleanupUnconnectedGroups(compilation, allCreatedChunkGroups); + logger.timeEnd("cleanup"); +}; + +module.exports = buildChunkGraph; /***/ }), -/***/ 59440: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 28034: +/***/ (function(module) { "use strict"; /* @@ -73430,536 +67866,315 @@ module.exports = CommonJsExportsParserPlugin; -const Template = __webpack_require__(1626); -const { equals } = __webpack_require__(84953); -const makeSerializable = __webpack_require__(33032); -const propertyAccess = __webpack_require__(54190); -const ModuleDependency = __webpack_require__(80321); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +/** @typedef {import("../Compiler")} Compiler */ -class CommonJsFullRequireDependency extends ModuleDependency { +class AddBuildDependenciesPlugin { /** - * @param {string} request the request string - * @param {[number, number]} range location in source code - * @param {string[]} names accessed properties on module + * @param {Iterable} buildDependencies list of build dependencies */ - constructor(request, range, names) { - super(request); - this.range = range; - this.names = names; - this.call = false; - this.asiSafe = undefined; + constructor(buildDependencies) { + this.buildDependencies = new Set(buildDependencies); } /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - getReferencedExports(moduleGraph, runtime) { - if (this.call) { - const importedModule = moduleGraph.getModule(this); - if ( - !importedModule || - importedModule.getExportsType(moduleGraph, false) !== "namespace" - ) { - return [this.names.slice(0, -1)]; + apply(compiler) { + compiler.hooks.compilation.tap( + "AddBuildDependenciesPlugin", + compilation => { + compilation.buildDependencies.addAll(this.buildDependencies); } - } - return [this.names]; + ); } +} - serialize(context) { - const { write } = context; - write(this.names); - write(this.call); - write(this.asiSafe); - super.serialize(context); - } +module.exports = AddBuildDependenciesPlugin; - deserialize(context) { - const { read } = context; - this.names = read(); - this.call = read(); - this.asiSafe = read(); - super.deserialize(context); - } - get type() { - return "cjs full require"; - } +/***/ }), - get category() { - return "commonjs"; +/***/ 47942: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +/** @typedef {import("../Compiler")} Compiler */ + +class AddManagedPathsPlugin { + /** + * @param {Iterable} managedPaths list of managed paths + * @param {Iterable} immutablePaths list of immutable paths + */ + constructor(managedPaths, immutablePaths) { + this.managedPaths = new Set(managedPaths); + this.immutablePaths = new Set(immutablePaths); } -} -CommonJsFullRequireDependency.Template = class CommonJsFullRequireDependencyTemplate extends ( - ModuleDependency.Template -) { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply( - dependency, - source, - { - module, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtimeRequirements, - runtime, - initFragments + apply(compiler) { + for (const managedPath of this.managedPaths) { + compiler.managedPaths.add(managedPath); } - ) { - const dep = /** @type {CommonJsFullRequireDependency} */ (dependency); - if (!dep.range) return; - const importedModule = moduleGraph.getModule(dep); - let requireExpr = runtimeTemplate.moduleExports({ - module: importedModule, - chunkGraph, - request: dep.request, - weak: dep.weak, - runtimeRequirements - }); - if (importedModule) { - const ids = dep.names; - const usedImported = moduleGraph - .getExportsInfo(importedModule) - .getUsedName(ids, runtime); - if (usedImported) { - const comment = equals(usedImported, ids) - ? "" - : Template.toNormalComment(propertyAccess(ids)) + " "; - const access = `${comment}${propertyAccess(usedImported)}`; - requireExpr = - dep.asiSafe === true - ? `(${requireExpr}${access})` - : `${requireExpr}${access}`; - } + for (const immutablePath of this.immutablePaths) { + compiler.immutablePaths.add(immutablePath); } - source.replace(dep.range[0], dep.range[1] - 1, requireExpr); } -}; - -makeSerializable( - CommonJsFullRequireDependency, - "webpack/lib/dependencies/CommonJsFullRequireDependency" -); +} -module.exports = CommonJsFullRequireDependency; +module.exports = AddManagedPathsPlugin; /***/ }), -/***/ 36013: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const CommentCompilationWarning = __webpack_require__(98427); -const RuntimeGlobals = __webpack_require__(16475); -const UnsupportedFeatureWarning = __webpack_require__(42495); -const { - evaluateToIdentifier, - evaluateToString, - expressionIsUnsupported, - toConstantDependency -} = __webpack_require__(93998); -const CommonJsFullRequireDependency = __webpack_require__(59440); -const CommonJsRequireContextDependency = __webpack_require__(23962); -const CommonJsRequireDependency = __webpack_require__(21264); -const ConstDependency = __webpack_require__(76911); -const ContextDependencyHelpers = __webpack_require__(99630); -const LocalModuleDependency = __webpack_require__(52805); -const { getLocalModule } = __webpack_require__(75827); -const RequireHeaderDependency = __webpack_require__(89183); -const RequireResolveContextDependency = __webpack_require__(55627); -const RequireResolveDependency = __webpack_require__(68582); -const RequireResolveHeaderDependency = __webpack_require__(9880); +/***/ 71985: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -class CommonJsImportsParserPlugin { - /** - * @param {JavascriptParserOptions} options parser options - */ - constructor(options) { - this.options = options; - } - apply(parser) { - const options = this.options; - // metadata // - const tapRequireExpression = (expression, getMembers) => { - parser.hooks.typeof - .for(expression) - .tap( - "CommonJsPlugin", - toConstantDependency(parser, JSON.stringify("function")) - ); - parser.hooks.evaluateTypeof - .for(expression) - .tap("CommonJsPlugin", evaluateToString("function")); - parser.hooks.evaluateIdentifier - .for(expression) - .tap( - "CommonJsPlugin", - evaluateToIdentifier(expression, "require", getMembers, true) - ); - }; - tapRequireExpression("require", () => []); - tapRequireExpression("require.resolve", () => ["resolve"]); - tapRequireExpression("require.resolveWeak", () => ["resolveWeak"]); +const Cache = __webpack_require__(7592); +const ProgressPlugin = __webpack_require__(13216); - // Weird stuff // - parser.hooks.assign.for("require").tap("CommonJsPlugin", expr => { - // to not leak to global "require", we need to define a local require here. - const dep = new ConstDependency("var require;", 0); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); +/** @typedef {import("../Compiler")} Compiler */ - // Unsupported // - parser.hooks.expression - .for("require.main.require") - .tap( - "CommonJsPlugin", - expressionIsUnsupported( - parser, - "require.main.require is not supported by webpack." - ) - ); - parser.hooks.call - .for("require.main.require") - .tap( - "CommonJsPlugin", - expressionIsUnsupported( - parser, - "require.main.require is not supported by webpack." - ) - ); - parser.hooks.expression - .for("module.parent.require") - .tap( - "CommonJsPlugin", - expressionIsUnsupported( - parser, - "module.parent.require is not supported by webpack." - ) - ); - parser.hooks.call - .for("module.parent.require") - .tap( - "CommonJsPlugin", - expressionIsUnsupported( - parser, - "module.parent.require is not supported by webpack." - ) - ); +const BUILD_DEPENDENCIES_KEY = Symbol(); - // renaming // - parser.hooks.canRename.for("require").tap("CommonJsPlugin", () => true); - parser.hooks.rename.for("require").tap("CommonJsPlugin", expr => { - // To avoid "not defined" error, replace the value with undefined - const dep = new ConstDependency("undefined", expr.range); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return false; - }); +class IdleFileCachePlugin { + /** + * @param {TODO} strategy cache strategy + * @param {number} idleTimeout timeout + * @param {number} idleTimeoutForInitialStore initial timeout + * @param {number} idleTimeoutAfterLargeChanges timeout after changes + */ + constructor( + strategy, + idleTimeout, + idleTimeoutForInitialStore, + idleTimeoutAfterLargeChanges + ) { + this.strategy = strategy; + this.idleTimeout = idleTimeout; + this.idleTimeoutForInitialStore = idleTimeoutForInitialStore; + this.idleTimeoutAfterLargeChanges = idleTimeoutAfterLargeChanges; + } - // inspection // - parser.hooks.expression - .for("require.cache") - .tap( - "CommonJsImportsParserPlugin", - toConstantDependency(parser, RuntimeGlobals.moduleCache, [ - RuntimeGlobals.moduleCache, - RuntimeGlobals.moduleId, - RuntimeGlobals.moduleLoaded - ]) - ); + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + let strategy = this.strategy; + const idleTimeout = this.idleTimeout; + const idleTimeoutForInitialStore = Math.min( + idleTimeout, + this.idleTimeoutForInitialStore + ); + const idleTimeoutAfterLargeChanges = this.idleTimeoutAfterLargeChanges; + const resolvedPromise = Promise.resolve(); - // require as expression // - parser.hooks.expression - .for("require") - .tap("CommonJsImportsParserPlugin", expr => { - const dep = new CommonJsRequireContextDependency( - { - request: options.unknownContextRequest, - recursive: options.unknownContextRecursive, - regExp: options.unknownContextRegExp, - mode: "sync" - }, - expr.range, - undefined, - parser.scope.inShorthand - ); - dep.critical = - options.unknownContextCritical && - "require function is used in a way in which dependencies cannot be statically extracted"; - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; - }); + let timeSpendInBuild = 0; + let timeSpendInStore = 0; + let avgTimeSpendInStore = 0; - // require // - const processRequireItem = (expr, param) => { - if (param.isString()) { - const dep = new CommonJsRequireDependency(param.string, param.range); - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; + /** @type {Map Promise>} */ + const pendingIdleTasks = new Map(); + + compiler.cache.hooks.store.tap( + { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, + (identifier, etag, data) => { + pendingIdleTasks.set(identifier, () => + strategy.store(identifier, etag, data) + ); } - }; - const processRequireContext = (expr, param) => { - const dep = ContextDependencyHelpers.create( - CommonJsRequireContextDependency, - expr.range, - param, - expr, - options, - { - category: "commonjs" - }, - parser - ); - if (!dep) return; - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; - }; - const createRequireHandler = callNew => expr => { - if (options.commonjsMagicComments) { - const { options: requireOptions, errors: commentErrors } = - parser.parseCommentOptions(expr.range); + ); - if (commentErrors) { - for (const e of commentErrors) { - const { comment } = e; - parser.state.module.addWarning( - new CommentCompilationWarning( - `Compilation error while processing magic comment(-s): /*${comment.value}*/: ${e.message}`, - comment.loc - ) - ); - } - } - if (requireOptions) { - if (requireOptions.webpackIgnore !== undefined) { - if (typeof requireOptions.webpackIgnore !== "boolean") { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackIgnore\` expected a boolean, but received: ${requireOptions.webpackIgnore}.`, - expr.loc - ) - ); + compiler.cache.hooks.get.tapPromise( + { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, + (identifier, etag, gotHandlers) => { + const restore = () => + strategy.restore(identifier, etag).then(cacheEntry => { + if (cacheEntry === undefined) { + gotHandlers.push((result, callback) => { + if (result !== undefined) { + pendingIdleTasks.set(identifier, () => + strategy.store(identifier, etag, result) + ); + } + callback(); + }); } else { - // Do not instrument `require()` if `webpackIgnore` is `true` - if (requireOptions.webpackIgnore) { - return true; - } + return cacheEntry; } - } - } - } - - if (expr.arguments.length !== 1) return; - let localModule; - const param = parser.evaluateExpression(expr.arguments[0]); - if (param.isConditional()) { - let isExpression = false; - for (const p of param.options) { - const result = processRequireItem(expr, p); - if (result === undefined) { - isExpression = true; - } - } - if (!isExpression) { - const dep = new RequireHeaderDependency(expr.callee.range); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - } - } - if ( - param.isString() && - (localModule = getLocalModule(parser.state, param.string)) - ) { - localModule.flagUsed(); - const dep = new LocalModuleDependency(localModule, expr.range, callNew); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - } else { - const result = processRequireItem(expr, param); - if (result === undefined) { - processRequireContext(expr, param); - } else { - const dep = new RequireHeaderDependency(expr.callee.range); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); + }); + const pendingTask = pendingIdleTasks.get(identifier); + if (pendingTask !== undefined) { + pendingIdleTasks.delete(identifier); + return pendingTask().then(restore); } - return true; + return restore(); } - }; - parser.hooks.call - .for("require") - .tap("CommonJsImportsParserPlugin", createRequireHandler(false)); - parser.hooks.new - .for("require") - .tap("CommonJsImportsParserPlugin", createRequireHandler(true)); - parser.hooks.call - .for("module.require") - .tap("CommonJsImportsParserPlugin", createRequireHandler(false)); - parser.hooks.new - .for("module.require") - .tap("CommonJsImportsParserPlugin", createRequireHandler(true)); + ); - // require with property access // - const chainHandler = (expr, calleeMembers, callExpr, members) => { - if (callExpr.arguments.length !== 1) return; - const param = parser.evaluateExpression(callExpr.arguments[0]); - if (param.isString() && !getLocalModule(parser.state, param.string)) { - const dep = new CommonJsFullRequireDependency( - param.string, - expr.range, - members - ); - dep.asiSafe = !parser.isAsiPosition(expr.range[0]); - dep.optional = !!parser.scope.inTry; - dep.loc = expr.loc; - parser.state.current.addDependency(dep); - return true; - } - }; - const callChainHandler = (expr, calleeMembers, callExpr, members) => { - if (callExpr.arguments.length !== 1) return; - const param = parser.evaluateExpression(callExpr.arguments[0]); - if (param.isString() && !getLocalModule(parser.state, param.string)) { - const dep = new CommonJsFullRequireDependency( - param.string, - expr.callee.range, - members + compiler.cache.hooks.storeBuildDependencies.tap( + { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, + dependencies => { + pendingIdleTasks.set(BUILD_DEPENDENCIES_KEY, () => + strategy.storeBuildDependencies(dependencies) ); - dep.call = true; - dep.asiSafe = !parser.isAsiPosition(expr.range[0]); - dep.optional = !!parser.scope.inTry; - dep.loc = expr.callee.loc; - parser.state.current.addDependency(dep); - parser.walkExpressions(expr.arguments); - return true; } - }; - parser.hooks.memberChainOfCallMemberChain - .for("require") - .tap("CommonJsImportsParserPlugin", chainHandler); - parser.hooks.memberChainOfCallMemberChain - .for("module.require") - .tap("CommonJsImportsParserPlugin", chainHandler); - parser.hooks.callMemberChainOfCallMemberChain - .for("require") - .tap("CommonJsImportsParserPlugin", callChainHandler); - parser.hooks.callMemberChainOfCallMemberChain - .for("module.require") - .tap("CommonJsImportsParserPlugin", callChainHandler); + ); - // require.resolve // - const processResolve = (expr, weak) => { - if (expr.arguments.length !== 1) return; - const param = parser.evaluateExpression(expr.arguments[0]); - if (param.isConditional()) { - for (const option of param.options) { - const result = processResolveItem(expr, option, weak); - if (result === undefined) { - processResolveContext(expr, option, weak); - } + compiler.cache.hooks.shutdown.tapPromise( + { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, + () => { + if (idleTimer) { + clearTimeout(idleTimer); + idleTimer = undefined; } - const dep = new RequireResolveHeaderDependency(expr.callee.range); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - } else { - const result = processResolveItem(expr, param, weak); - if (result === undefined) { - processResolveContext(expr, param, weak); + isIdle = false; + const reportProgress = ProgressPlugin.getReporter(compiler); + const jobs = Array.from(pendingIdleTasks.values()); + if (reportProgress) reportProgress(0, "process pending cache items"); + const promises = jobs.map(fn => fn()); + pendingIdleTasks.clear(); + promises.push(currentIdlePromise); + const promise = Promise.all(promises); + currentIdlePromise = promise.then(() => strategy.afterAllStored()); + if (reportProgress) { + currentIdlePromise = currentIdlePromise.then(() => { + reportProgress(1, `stored`); + }); } - const dep = new RequireResolveHeaderDependency(expr.callee.range); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; + return currentIdlePromise.then(() => { + // Reset strategy + if (strategy.clear) strategy.clear(); + }); } - }; - const processResolveItem = (expr, param, weak) => { - if (param.isString()) { - const dep = new RequireResolveDependency(param.string, param.range); - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - dep.weak = weak; - parser.state.current.addDependency(dep); - return true; + ); + + /** @type {Promise} */ + let currentIdlePromise = resolvedPromise; + let isIdle = false; + let isInitialStore = true; + const processIdleTasks = () => { + if (isIdle) { + const startTime = Date.now(); + if (pendingIdleTasks.size > 0) { + const promises = [currentIdlePromise]; + const maxTime = startTime + 100; + let maxCount = 100; + for (const [filename, factory] of pendingIdleTasks) { + pendingIdleTasks.delete(filename); + promises.push(factory()); + if (maxCount-- <= 0 || Date.now() > maxTime) break; + } + currentIdlePromise = Promise.all(promises); + currentIdlePromise.then(() => { + timeSpendInStore += Date.now() - startTime; + // Allow to exit the process between + idleTimer = setTimeout(processIdleTasks, 0); + idleTimer.unref(); + }); + return; + } + currentIdlePromise = currentIdlePromise + .then(async () => { + await strategy.afterAllStored(); + timeSpendInStore += Date.now() - startTime; + avgTimeSpendInStore = + Math.max(avgTimeSpendInStore, timeSpendInStore) * 0.9 + + timeSpendInStore * 0.1; + timeSpendInStore = 0; + timeSpendInBuild = 0; + }) + .catch(err => { + const logger = compiler.getInfrastructureLogger( + "IdleFileCachePlugin" + ); + logger.warn(`Background tasks during idle failed: ${err.message}`); + logger.debug(err.stack); + }); + isInitialStore = false; } }; - const processResolveContext = (expr, param, weak) => { - const dep = ContextDependencyHelpers.create( - RequireResolveContextDependency, - param.range, - param, - expr, - options, - { - category: "commonjs", - mode: weak ? "weak" : "sync" - }, - parser - ); - if (!dep) return; - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; - }; - - parser.hooks.call - .for("require.resolve") - .tap("RequireResolveDependencyParserPlugin", expr => { - return processResolve(expr, false); - }); - parser.hooks.call - .for("require.resolveWeak") - .tap("RequireResolveDependencyParserPlugin", expr => { - return processResolve(expr, true); - }); + let idleTimer = undefined; + compiler.cache.hooks.beginIdle.tap( + { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, + () => { + const isLargeChange = timeSpendInBuild > avgTimeSpendInStore * 2; + if (isInitialStore && idleTimeoutForInitialStore < idleTimeout) { + compiler + .getInfrastructureLogger("IdleFileCachePlugin") + .log( + `Initial cache was generated and cache will be persisted in ${ + idleTimeoutForInitialStore / 1000 + }s.` + ); + } else if ( + isLargeChange && + idleTimeoutAfterLargeChanges < idleTimeout + ) { + compiler + .getInfrastructureLogger("IdleFileCachePlugin") + .log( + `Spend ${Math.round(timeSpendInBuild) / 1000}s in build and ${ + Math.round(avgTimeSpendInStore) / 1000 + }s in average in cache store. This is considered as large change and cache will be persisted in ${ + idleTimeoutAfterLargeChanges / 1000 + }s.` + ); + } + idleTimer = setTimeout(() => { + idleTimer = undefined; + isIdle = true; + resolvedPromise.then(processIdleTasks); + }, Math.min(isInitialStore ? idleTimeoutForInitialStore : Infinity, isLargeChange ? idleTimeoutAfterLargeChanges : Infinity, idleTimeout)); + idleTimer.unref(); + } + ); + compiler.cache.hooks.endIdle.tap( + { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, + () => { + if (idleTimer) { + clearTimeout(idleTimer); + idleTimer = undefined; + } + isIdle = false; + } + ); + compiler.hooks.done.tap("IdleFileCachePlugin", stats => { + // 10% build overhead is ignored, as it's not cacheable + timeSpendInBuild *= 0.9; + timeSpendInBuild += stats.endTime - stats.startTime; + }); } } -module.exports = CommonJsImportsParserPlugin; + +module.exports = IdleFileCachePlugin; /***/ }), -/***/ 32406: +/***/ 52539: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -73970,284 +68185,198 @@ module.exports = CommonJsImportsParserPlugin; -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const SelfModuleFactory = __webpack_require__(63560); -const Template = __webpack_require__(1626); -const CommonJsExportsDependency = __webpack_require__(45598); -const CommonJsFullRequireDependency = __webpack_require__(59440); -const CommonJsRequireContextDependency = __webpack_require__(23962); -const CommonJsRequireDependency = __webpack_require__(21264); -const CommonJsSelfReferenceDependency = __webpack_require__(52225); -const ModuleDecoratorDependency = __webpack_require__(88488); -const RequireHeaderDependency = __webpack_require__(89183); -const RequireResolveContextDependency = __webpack_require__(55627); -const RequireResolveDependency = __webpack_require__(68582); -const RequireResolveHeaderDependency = __webpack_require__(9880); -const RuntimeRequirementsDependency = __webpack_require__(24187); - -const CommonJsExportsParserPlugin = __webpack_require__(97107); -const CommonJsImportsParserPlugin = __webpack_require__(36013); +const Cache = __webpack_require__(7592); -const { - evaluateToIdentifier, - toConstantDependency -} = __webpack_require__(93998); -const CommonJsExportRequireDependency = __webpack_require__(62892); +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Cache").Etag} Etag */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ -class CommonJsPlugin { +class MemoryCachePlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ apply(compiler) { - compiler.hooks.compilation.tap( - "CommonJsPlugin", - (compilation, { contextModuleFactory, normalModuleFactory }) => { - compilation.dependencyFactories.set( - CommonJsRequireDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - CommonJsRequireDependency, - new CommonJsRequireDependency.Template() - ); - - compilation.dependencyFactories.set( - CommonJsFullRequireDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - CommonJsFullRequireDependency, - new CommonJsFullRequireDependency.Template() - ); + /** @type {Map} */ + const cache = new Map(); + compiler.cache.hooks.store.tap( + { name: "MemoryCachePlugin", stage: Cache.STAGE_MEMORY }, + (identifier, etag, data) => { + cache.set(identifier, { etag, data }); + } + ); + compiler.cache.hooks.get.tap( + { name: "MemoryCachePlugin", stage: Cache.STAGE_MEMORY }, + (identifier, etag, gotHandlers) => { + const cacheEntry = cache.get(identifier); + if (cacheEntry === null) { + return null; + } else if (cacheEntry !== undefined) { + return cacheEntry.etag === etag ? cacheEntry.data : null; + } + gotHandlers.push((result, callback) => { + if (result === undefined) { + cache.set(identifier, null); + } else { + cache.set(identifier, { etag, data: result }); + } + return callback(); + }); + } + ); + compiler.cache.hooks.shutdown.tap( + { name: "MemoryCachePlugin", stage: Cache.STAGE_MEMORY }, + () => { + cache.clear(); + } + ); + } +} +module.exports = MemoryCachePlugin; - compilation.dependencyFactories.set( - CommonJsRequireContextDependency, - contextModuleFactory - ); - compilation.dependencyTemplates.set( - CommonJsRequireContextDependency, - new CommonJsRequireContextDependency.Template() - ); - compilation.dependencyFactories.set( - RequireResolveDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - RequireResolveDependency, - new RequireResolveDependency.Template() - ); +/***/ }), - compilation.dependencyFactories.set( - RequireResolveContextDependency, - contextModuleFactory - ); - compilation.dependencyTemplates.set( - RequireResolveContextDependency, - new RequireResolveContextDependency.Template() - ); +/***/ 99334: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - compilation.dependencyTemplates.set( - RequireResolveHeaderDependency, - new RequireResolveHeaderDependency.Template() - ); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - compilation.dependencyTemplates.set( - RequireHeaderDependency, - new RequireHeaderDependency.Template() - ); - compilation.dependencyTemplates.set( - CommonJsExportsDependency, - new CommonJsExportsDependency.Template() - ); - compilation.dependencyFactories.set( - CommonJsExportRequireDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - CommonJsExportRequireDependency, - new CommonJsExportRequireDependency.Template() - ); +const Cache = __webpack_require__(7592); - const selfFactory = new SelfModuleFactory(compilation.moduleGraph); +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Cache").Etag} Etag */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ - compilation.dependencyFactories.set( - CommonJsSelfReferenceDependency, - selfFactory - ); - compilation.dependencyTemplates.set( - CommonJsSelfReferenceDependency, - new CommonJsSelfReferenceDependency.Template() - ); +class MemoryWithGcCachePlugin { + constructor({ maxGenerations }) { + this._maxGenerations = maxGenerations; + } + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const maxGenerations = this._maxGenerations; + /** @type {Map} */ + const cache = new Map(); + /** @type {Map} */ + const oldCache = new Map(); + let generation = 0; + let cachePosition = 0; + const logger = compiler.getInfrastructureLogger("MemoryWithGcCachePlugin"); + compiler.hooks.afterDone.tap("MemoryWithGcCachePlugin", () => { + generation++; + let clearedEntries = 0; + let lastClearedIdentifier; + for (const [identifier, entry] of oldCache) { + if (entry.until > generation) break; - compilation.dependencyFactories.set( - ModuleDecoratorDependency, - selfFactory - ); - compilation.dependencyTemplates.set( - ModuleDecoratorDependency, - new ModuleDecoratorDependency.Template() + oldCache.delete(identifier); + if (cache.get(identifier) === undefined) { + cache.delete(identifier); + clearedEntries++; + lastClearedIdentifier = identifier; + } + } + if (clearedEntries > 0 || oldCache.size > 0) { + logger.log( + `${cache.size - oldCache.size} active entries, ${ + oldCache.size + } recently unused cached entries${ + clearedEntries > 0 + ? `, ${clearedEntries} old unused cache entries removed e. g. ${lastClearedIdentifier}` + : "" + }` ); - - compilation.hooks.runtimeRequirementInModule - .for(RuntimeGlobals.harmonyModuleDecorator) - .tap("CommonJsPlugin", (module, set) => { - set.add(RuntimeGlobals.module); - set.add(RuntimeGlobals.requireScope); - }); - - compilation.hooks.runtimeRequirementInModule - .for(RuntimeGlobals.nodeModuleDecorator) - .tap("CommonJsPlugin", (module, set) => { - set.add(RuntimeGlobals.module); - set.add(RuntimeGlobals.requireScope); - }); - - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.harmonyModuleDecorator) - .tap("CommonJsPlugin", (chunk, set) => { - compilation.addRuntimeModule( - chunk, - new HarmonyModuleDecoratorRuntimeModule() - ); - }); - - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.nodeModuleDecorator) - .tap("CommonJsPlugin", (chunk, set) => { - compilation.addRuntimeModule( - chunk, - new NodeModuleDecoratorRuntimeModule() - ); + } + let i = (cache.size / maxGenerations) | 0; + let j = cachePosition >= cache.size ? 0 : cachePosition; + cachePosition = j + i; + for (const [identifier, entry] of cache) { + if (j !== 0) { + j--; + continue; + } + if (entry !== undefined) { + // We don't delete the cache entry, but set it to undefined instead + // This reserves the location in the data table and avoids rehashing + // when constantly adding and removing entries. + // It will be deleted when removed from oldCache. + cache.set(identifier, undefined); + oldCache.delete(identifier); + oldCache.set(identifier, { + entry, + until: generation + maxGenerations }); - - const handler = (parser, parserOptions) => { - if (parserOptions.commonjs !== undefined && !parserOptions.commonjs) - return; - parser.hooks.typeof - .for("module") - .tap( - "CommonJsPlugin", - toConstantDependency(parser, JSON.stringify("object")) - ); - - parser.hooks.expression - .for("require.main") - .tap( - "CommonJsPlugin", - toConstantDependency( - parser, - `${RuntimeGlobals.moduleCache}[${RuntimeGlobals.entryModuleId}]`, - [RuntimeGlobals.moduleCache, RuntimeGlobals.entryModuleId] - ) - ); - parser.hooks.expression - .for("module.loaded") - .tap("CommonJsPlugin", expr => { - parser.state.module.buildInfo.moduleConcatenationBailout = - "module.loaded"; - const dep = new RuntimeRequirementsDependency([ - RuntimeGlobals.moduleLoaded - ]); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - - parser.hooks.expression - .for("module.id") - .tap("CommonJsPlugin", expr => { - parser.state.module.buildInfo.moduleConcatenationBailout = - "module.id"; - const dep = new RuntimeRequirementsDependency([ - RuntimeGlobals.moduleId - ]); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - - parser.hooks.evaluateIdentifier.for("module.hot").tap( - "CommonJsPlugin", - evaluateToIdentifier("module.hot", "module", () => ["hot"], null) - ); - - new CommonJsImportsParserPlugin(parserOptions).apply(parser); - new CommonJsExportsParserPlugin(compilation.moduleGraph).apply( - parser - ); - }; - - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("CommonJsPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("CommonJsPlugin", handler); + if (i-- === 0) break; + } + } + }); + compiler.cache.hooks.store.tap( + { name: "MemoryWithGcCachePlugin", stage: Cache.STAGE_MEMORY }, + (identifier, etag, data) => { + cache.set(identifier, { etag, data }); + } + ); + compiler.cache.hooks.get.tap( + { name: "MemoryWithGcCachePlugin", stage: Cache.STAGE_MEMORY }, + (identifier, etag, gotHandlers) => { + const cacheEntry = cache.get(identifier); + if (cacheEntry === null) { + return null; + } else if (cacheEntry !== undefined) { + return cacheEntry.etag === etag ? cacheEntry.data : null; + } + const oldCacheEntry = oldCache.get(identifier); + if (oldCacheEntry !== undefined) { + const cacheEntry = oldCacheEntry.entry; + if (cacheEntry === null) { + oldCache.delete(identifier); + cache.set(identifier, cacheEntry); + return null; + } else { + if (cacheEntry.etag !== etag) return null; + oldCache.delete(identifier); + cache.set(identifier, cacheEntry); + return cacheEntry.data; + } + } + gotHandlers.push((result, callback) => { + if (result === undefined) { + cache.set(identifier, null); + } else { + cache.set(identifier, { etag, data: result }); + } + return callback(); + }); + } + ); + compiler.cache.hooks.shutdown.tap( + { name: "MemoryWithGcCachePlugin", stage: Cache.STAGE_MEMORY }, + () => { + cache.clear(); + oldCache.clear(); } ); } } - -class HarmonyModuleDecoratorRuntimeModule extends RuntimeModule { - constructor() { - super("harmony module decorator"); - } - - /** - * @returns {string} runtime code - */ - generate() { - const { runtimeTemplate } = this.compilation; - return Template.asString([ - `${ - RuntimeGlobals.harmonyModuleDecorator - } = ${runtimeTemplate.basicFunction("module", [ - "module = Object.create(module);", - "if (!module.children) module.children = [];", - "Object.defineProperty(module, 'exports', {", - Template.indent([ - "enumerable: true,", - `set: ${runtimeTemplate.basicFunction("", [ - "throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id);" - ])}` - ]), - "});", - "return module;" - ])};` - ]); - } -} - -class NodeModuleDecoratorRuntimeModule extends RuntimeModule { - constructor() { - super("node module decorator"); - } - - /** - * @returns {string} runtime code - */ - generate() { - const { runtimeTemplate } = this.compilation; - return Template.asString([ - `${RuntimeGlobals.nodeModuleDecorator} = ${runtimeTemplate.basicFunction( - "module", - [ - "module.paths = [];", - "if (!module.children) module.children = [];", - "return module;" - ] - )};` - ]); - } -} - -module.exports = CommonJsPlugin; +module.exports = MemoryWithGcCachePlugin; /***/ }), -/***/ 23962: +/***/ 86180: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -74258,522 +68387,1431 @@ module.exports = CommonJsPlugin; +const FileSystemInfo = __webpack_require__(79453); +const ProgressPlugin = __webpack_require__(13216); +const { formatSize } = __webpack_require__(71070); +const SerializerMiddleware = __webpack_require__(83137); +const LazySet = __webpack_require__(38938); const makeSerializable = __webpack_require__(33032); -const ContextDependency = __webpack_require__(88101); -const ContextDependencyTemplateAsRequireCall = __webpack_require__(75815); - -class CommonJsRequireContextDependency extends ContextDependency { - constructor(options, range, valueRange, inShorthand) { - super(options); - - this.range = range; - this.valueRange = valueRange; - // inShorthand must be serialized by subclasses that use it - this.inShorthand = inShorthand; - } - - get type() { - return "cjs require context"; - } - - serialize(context) { - const { write } = context; +const memoize = __webpack_require__(78676); +const { + createFileSerializer, + NOT_SERIALIZABLE +} = __webpack_require__(8282); - write(this.range); - write(this.valueRange); - write(this.inShorthand); +/** @typedef {import("../../declarations/WebpackOptions").SnapshotOptions} SnapshotOptions */ +/** @typedef {import("../Cache").Etag} Etag */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../FileSystemInfo").Snapshot} Snapshot */ +/** @typedef {import("../logging/Logger").Logger} Logger */ +/** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */ - super.serialize(context); +class PackContainer { + /** + * @param {Object} data stored data + * @param {string} version version identifier + * @param {Snapshot} buildSnapshot snapshot of all build dependencies + * @param {Set} buildDependencies list of all unresolved build dependencies captured + * @param {Map} resolveResults result of the resolved build dependencies + * @param {Snapshot} resolveBuildDependenciesSnapshot snapshot of the dependencies of the build dependencies resolving + */ + constructor( + data, + version, + buildSnapshot, + buildDependencies, + resolveResults, + resolveBuildDependenciesSnapshot + ) { + this.data = data; + this.version = version; + this.buildSnapshot = buildSnapshot; + this.buildDependencies = buildDependencies; + this.resolveResults = resolveResults; + this.resolveBuildDependenciesSnapshot = resolveBuildDependenciesSnapshot; } - deserialize(context) { - const { read } = context; - - this.range = read(); - this.valueRange = read(); - this.inShorthand = read(); + serialize({ write, writeLazy }) { + write(this.version); + write(this.buildSnapshot); + write(this.buildDependencies); + write(this.resolveResults); + write(this.resolveBuildDependenciesSnapshot); + writeLazy(this.data); + } - super.deserialize(context); + deserialize({ read }) { + this.version = read(); + this.buildSnapshot = read(); + this.buildDependencies = read(); + this.resolveResults = read(); + this.resolveBuildDependenciesSnapshot = read(); + this.data = read(); } } makeSerializable( - CommonJsRequireContextDependency, - "webpack/lib/dependencies/CommonJsRequireContextDependency" + PackContainer, + "webpack/lib/cache/PackFileCacheStrategy", + "PackContainer" ); -CommonJsRequireContextDependency.Template = - ContextDependencyTemplateAsRequireCall; - -module.exports = CommonJsRequireContextDependency; +const MIN_CONTENT_SIZE = 1024 * 1024; // 1 MB +const CONTENT_COUNT_TO_MERGE = 10; +const MIN_ITEMS_IN_FRESH_PACK = 100; +const MAX_ITEMS_IN_FRESH_PACK = 50000; +const MAX_TIME_IN_FRESH_PACK = 1 * 60 * 1000; // 1 min +class PackItemInfo { + /** + * @param {string} identifier identifier of item + * @param {string | null} etag etag of item + * @param {any} value fresh value of item + */ + constructor(identifier, etag, value) { + this.identifier = identifier; + this.etag = etag; + this.location = -1; + this.lastAccess = Date.now(); + this.freshValue = value; + } +} -/***/ }), +class Pack { + constructor(logger, maxAge) { + /** @type {Map} */ + this.itemInfo = new Map(); + /** @type {string[]} */ + this.requests = []; + this.requestsTimeout = undefined; + /** @type {Map} */ + this.freshContent = new Map(); + /** @type {(undefined | PackContent)[]} */ + this.content = []; + this.invalid = false; + this.logger = logger; + this.maxAge = maxAge; + } -/***/ 21264: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + _addRequest(identifier) { + this.requests.push(identifier); + if (this.requestsTimeout === undefined) { + this.requestsTimeout = setTimeout(() => { + this.requests.push(undefined); + this.requestsTimeout = undefined; + }, MAX_TIME_IN_FRESH_PACK); + if (this.requestsTimeout.unref) this.requestsTimeout.unref(); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + stopCapturingRequests() { + if (this.requestsTimeout !== undefined) { + clearTimeout(this.requestsTimeout); + this.requestsTimeout = undefined; + } + } + /** + * @param {string} identifier unique name for the resource + * @param {string | null} etag etag of the resource + * @returns {any} cached content + */ + get(identifier, etag) { + const info = this.itemInfo.get(identifier); + this._addRequest(identifier); + if (info === undefined) { + return undefined; + } + if (info.etag !== etag) return null; + info.lastAccess = Date.now(); + const loc = info.location; + if (loc === -1) { + return info.freshValue; + } else { + if (!this.content[loc]) { + return undefined; + } + return this.content[loc].get(identifier); + } + } + /** + * @param {string} identifier unique name for the resource + * @param {string | null} etag etag of the resource + * @param {any} data cached content + * @returns {void} + */ + set(identifier, etag, data) { + if (!this.invalid) { + this.invalid = true; + this.logger.log(`Pack got invalid because of write to: ${identifier}`); + } + const info = this.itemInfo.get(identifier); + if (info === undefined) { + const newInfo = new PackItemInfo(identifier, etag, data); + this.itemInfo.set(identifier, newInfo); + this._addRequest(identifier); + this.freshContent.set(identifier, newInfo); + } else { + const loc = info.location; + if (loc >= 0) { + this._addRequest(identifier); + this.freshContent.set(identifier, info); + const content = this.content[loc]; + content.delete(identifier); + if (content.items.size === 0) { + this.content[loc] = undefined; + this.logger.debug("Pack %d got empty and is removed", loc); + } + } + info.freshValue = data; + info.lastAccess = Date.now(); + info.etag = etag; + info.location = -1; + } + } -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); -const ModuleDependencyTemplateAsId = __webpack_require__(80825); + getContentStats() { + let count = 0; + let size = 0; + for (const content of this.content) { + if (content !== undefined) { + count++; + const s = content.getSize(); + if (s > 0) { + size += s; + } + } + } + return { count, size }; + } -class CommonJsRequireDependency extends ModuleDependency { - constructor(request, range) { - super(request); - this.range = range; + /** + * @returns {number} new location of data entries + */ + _findLocation() { + let i; + for (i = 0; i < this.content.length && this.content[i] !== undefined; i++); + return i; } - get type() { - return "cjs require"; + _gcAndUpdateLocation(items, usedItems, newLoc) { + let count = 0; + let lastGC; + const now = Date.now(); + for (const identifier of items) { + const info = this.itemInfo.get(identifier); + if (now - info.lastAccess > this.maxAge) { + this.itemInfo.delete(identifier); + items.delete(identifier); + usedItems.delete(identifier); + count++; + lastGC = identifier; + } else { + info.location = newLoc; + } + } + if (count > 0) { + this.logger.log( + "Garbage Collected %d old items at pack %d (%d items remaining) e. g. %s", + count, + newLoc, + items.size, + lastGC + ); + } } - get category() { - return "commonjs"; + _persistFreshContent() { + const itemsCount = this.freshContent.size; + if (itemsCount > 0) { + const packCount = Math.ceil(itemsCount / MAX_ITEMS_IN_FRESH_PACK); + const itemsPerPack = Math.ceil(itemsCount / packCount); + const packs = []; + let i = 0; + let ignoreNextTimeTick = false; + const createNextPack = () => { + const loc = this._findLocation(); + this.content[loc] = null; // reserve + const pack = { + /** @type {Set} */ + items: new Set(), + /** @type {Map} */ + map: new Map(), + loc + }; + packs.push(pack); + return pack; + }; + let pack = createNextPack(); + if (this.requestsTimeout !== undefined) + clearTimeout(this.requestsTimeout); + for (const identifier of this.requests) { + if (identifier === undefined) { + if (ignoreNextTimeTick) { + ignoreNextTimeTick = false; + } else if (pack.items.size >= MIN_ITEMS_IN_FRESH_PACK) { + i = 0; + pack = createNextPack(); + } + continue; + } + const info = this.freshContent.get(identifier); + if (info === undefined) continue; + pack.items.add(identifier); + pack.map.set(identifier, info.freshValue); + info.location = pack.loc; + info.freshValue = undefined; + this.freshContent.delete(identifier); + if (++i > itemsPerPack) { + i = 0; + pack = createNextPack(); + ignoreNextTimeTick = true; + } + } + this.requests.length = 0; + for (const pack of packs) { + this.content[pack.loc] = new PackContent( + pack.items, + new Set(pack.items), + new PackContentItems(pack.map) + ); + } + this.logger.log( + `${itemsCount} fresh items in cache put into pack ${ + packs.length > 1 + ? packs + .map(pack => `${pack.loc} (${pack.items.size} items)`) + .join(", ") + : packs[0].loc + }` + ); + } } -} -CommonJsRequireDependency.Template = ModuleDependencyTemplateAsId; + /** + * Merges small content files to a single content file + */ + _optimizeSmallContent() { + // 1. Find all small content files + // Treat unused content files separately to avoid + // a merge-split cycle + /** @type {number[]} */ + const smallUsedContents = []; + /** @type {number} */ + let smallUsedContentSize = 0; + /** @type {number[]} */ + const smallUnusedContents = []; + /** @type {number} */ + let smallUnusedContentSize = 0; + for (let i = 0; i < this.content.length; i++) { + const content = this.content[i]; + if (content === undefined) continue; + if (content.outdated) continue; + const size = content.getSize(); + if (size < 0 || size > MIN_CONTENT_SIZE) continue; + if (content.used.size > 0) { + smallUsedContents.push(i); + smallUsedContentSize += size; + } else { + smallUnusedContents.push(i); + smallUnusedContentSize += size; + } + } -makeSerializable( - CommonJsRequireDependency, - "webpack/lib/dependencies/CommonJsRequireDependency" -); + // 2. Check if minimum number is reached + let mergedIndices; + if ( + smallUsedContents.length >= CONTENT_COUNT_TO_MERGE || + smallUsedContentSize > MIN_CONTENT_SIZE + ) { + mergedIndices = smallUsedContents; + } else if ( + smallUnusedContents.length >= CONTENT_COUNT_TO_MERGE || + smallUnusedContentSize > MIN_CONTENT_SIZE + ) { + mergedIndices = smallUnusedContents; + } else return; -module.exports = CommonJsRequireDependency; + const mergedContent = []; + + // 3. Remove old content entries + for (const i of mergedIndices) { + mergedContent.push(this.content[i]); + this.content[i] = undefined; + } + // 4. Determine merged items + /** @type {Set} */ + const mergedItems = new Set(); + /** @type {Set} */ + const mergedUsedItems = new Set(); + /** @type {(function(Map): Promise)[]} */ + const addToMergedMap = []; + for (const content of mergedContent) { + for (const identifier of content.items) { + mergedItems.add(identifier); + } + for (const identifier of content.used) { + mergedUsedItems.add(identifier); + } + addToMergedMap.push(async map => { + // unpack existing content + // after that values are accessible in .content + await content.unpack( + "it should be merged with other small pack contents" + ); + for (const [identifier, value] of content.content) { + map.set(identifier, value); + } + }); + } -/***/ }), + // 5. GC and update location of merged items + const newLoc = this._findLocation(); + this._gcAndUpdateLocation(mergedItems, mergedUsedItems, newLoc); -/***/ 52225: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // 6. If not empty, store content somewhere + if (mergedItems.size > 0) { + this.content[newLoc] = new PackContent( + mergedItems, + mergedUsedItems, + memoize(async () => { + /** @type {Map} */ + const map = new Map(); + await Promise.all(addToMergedMap.map(fn => fn(map))); + return new PackContentItems(map); + }) + ); + this.logger.log( + "Merged %d small files with %d cache items into pack %d", + mergedContent.length, + mergedItems.size, + newLoc + ); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * Split large content files with used and unused items + * into two parts to separate used from unused items + */ + _optimizeUnusedContent() { + // 1. Find a large content file with used and unused items + for (let i = 0; i < this.content.length; i++) { + const content = this.content[i]; + if (content === undefined) continue; + const size = content.getSize(); + if (size < MIN_CONTENT_SIZE) continue; + const used = content.used.size; + const total = content.items.size; + if (used > 0 && used < total) { + // 2. Remove this content + this.content[i] = undefined; + // 3. Determine items for the used content file + const usedItems = new Set(content.used); + const newLoc = this._findLocation(); + this._gcAndUpdateLocation(usedItems, usedItems, newLoc); + // 4. Create content file for used items + if (usedItems.size > 0) { + this.content[newLoc] = new PackContent( + usedItems, + new Set(usedItems), + async () => { + await content.unpack( + "it should be splitted into used and unused items" + ); + const map = new Map(); + for (const identifier of usedItems) { + map.set(identifier, content.content.get(identifier)); + } + return new PackContentItems(map); + } + ); + } -const RuntimeGlobals = __webpack_require__(16475); -const { equals } = __webpack_require__(84953); -const makeSerializable = __webpack_require__(33032); -const propertyAccess = __webpack_require__(54190); -const NullDependency = __webpack_require__(31830); + // 5. Determine items for the unused content file + const unusedItems = new Set(content.items); + const usedOfUnusedItems = new Set(); + for (const identifier of usedItems) { + unusedItems.delete(identifier); + } + const newUnusedLoc = this._findLocation(); + this._gcAndUpdateLocation(unusedItems, usedOfUnusedItems, newUnusedLoc); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + // 6. Create content file for unused items + if (unusedItems.size > 0) { + this.content[newUnusedLoc] = new PackContent( + unusedItems, + usedOfUnusedItems, + async () => { + await content.unpack( + "it should be splitted into used and unused items" + ); + const map = new Map(); + for (const identifier of unusedItems) { + map.set(identifier, content.content.get(identifier)); + } + return new PackContentItems(map); + } + ); + } -class CommonJsSelfReferenceDependency extends NullDependency { - constructor(range, base, names, call) { - super(); - this.range = range; - this.base = base; - this.names = names; - this.call = call; + this.logger.log( + "Split pack %d into pack %d with %d used items and pack %d with %d unused items", + i, + newLoc, + usedItems.size, + newUnusedLoc, + unusedItems.size + ); + + // optimizing only one of them is good enough and + // reduces the amount of serialization needed + return; + } + } + } + + /** + * Find the content with the oldest item and run GC on that. + * Only runs for one content to avoid large invalidation. + */ + _gcOldestContent() { + /** @type {PackItemInfo} */ + let oldest = undefined; + for (const info of this.itemInfo.values()) { + if (oldest === undefined || info.lastAccess < oldest.lastAccess) { + oldest = info; + } + } + if (Date.now() - oldest.lastAccess > this.maxAge) { + const loc = oldest.location; + if (loc < 0) return; + const content = this.content[loc]; + const items = new Set(content.items); + const usedItems = new Set(content.used); + this._gcAndUpdateLocation(items, usedItems, loc); + + this.content[loc] = + items.size > 0 + ? new PackContent(items, usedItems, async () => { + await content.unpack( + "it contains old items that should be garbage collected" + ); + const map = new Map(); + for (const identifier of items) { + map.set(identifier, content.content.get(identifier)); + } + return new PackContentItems(map); + }) + : undefined; + } } - get type() { - return "cjs self exports reference"; + serialize({ write, writeSeparate }) { + this._persistFreshContent(); + this._optimizeSmallContent(); + this._optimizeUnusedContent(); + this._gcOldestContent(); + for (const identifier of this.itemInfo.keys()) { + write(identifier); + } + write(null); // null as marker of the end of keys + for (const info of this.itemInfo.values()) { + write(info.etag); + } + for (const info of this.itemInfo.values()) { + write(info.lastAccess); + } + for (let i = 0; i < this.content.length; i++) { + const content = this.content[i]; + if (content !== undefined) { + write(content.items); + content.writeLazy(lazy => writeSeparate(lazy, { name: `${i}` })); + } else { + write(undefined); // undefined marks an empty content slot + } + } + write(null); // null as marker of the end of items } - get category() { - return "self"; + deserialize({ read, logger }) { + this.logger = logger; + { + const items = []; + let item = read(); + while (item !== null) { + items.push(item); + item = read(); + } + this.itemInfo.clear(); + const infoItems = items.map(identifier => { + const info = new PackItemInfo(identifier, undefined, undefined); + this.itemInfo.set(identifier, info); + return info; + }); + for (const info of infoItems) { + info.etag = read(); + } + for (const info of infoItems) { + info.lastAccess = read(); + } + } + this.content.length = 0; + let items = read(); + while (items !== null) { + if (items === undefined) { + this.content.push(items); + } else { + const idx = this.content.length; + const lazy = read(); + this.content.push( + new PackContent( + items, + new Set(), + lazy, + logger, + `${this.content.length}` + ) + ); + for (const identifier of items) { + this.itemInfo.get(identifier).location = idx; + } + } + items = read(); + } } +} - /** - * @returns {string | null} an identifier to merge equal requests - */ - getResourceIdentifier() { - return `self`; - } +makeSerializable(Pack, "webpack/lib/cache/PackFileCacheStrategy", "Pack"); +class PackContentItems { /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports + * @param {Map} map items */ - getReferencedExports(moduleGraph, runtime) { - return [this.call ? this.names.slice(0, -1) : this.names]; + constructor(map) { + this.map = map; } - serialize(context) { - const { write } = context; - write(this.range); - write(this.base); - write(this.names); - write(this.call); - super.serialize(context); + serialize({ write, snapshot, rollback, logger, profile }) { + if (profile) { + write(false); + for (const [key, value] of this.map) { + const s = snapshot(); + try { + write(key); + const start = process.hrtime(); + write(value); + const durationHr = process.hrtime(start); + const duration = durationHr[0] * 1000 + durationHr[1] / 1e6; + if (duration > 1) { + if (duration > 500) + logger.error(`Serialization of '${key}': ${duration} ms`); + else if (duration > 50) + logger.warn(`Serialization of '${key}': ${duration} ms`); + else if (duration > 10) + logger.info(`Serialization of '${key}': ${duration} ms`); + else if (duration > 5) + logger.log(`Serialization of '${key}': ${duration} ms`); + else logger.debug(`Serialization of '${key}': ${duration} ms`); + } + } catch (e) { + rollback(s); + if (e === NOT_SERIALIZABLE) continue; + logger.warn( + `Skipped not serializable cache item '${key}': ${e.message}` + ); + logger.debug(e.stack); + } + } + write(null); + return; + } + // Try to serialize all at once + const s = snapshot(); + try { + write(true); + write(this.map); + } catch (e) { + rollback(s); + + // Try to serialize each item on it's own + write(false); + for (const [key, value] of this.map) { + const s = snapshot(); + try { + write(key); + write(value); + } catch (e) { + rollback(s); + if (e === NOT_SERIALIZABLE) continue; + logger.warn( + `Skipped not serializable cache item '${key}': ${e.message}` + ); + logger.debug(e.stack); + } + } + write(null); + } } - deserialize(context) { - const { read } = context; - this.range = read(); - this.base = read(); - this.names = read(); - this.call = read(); - super.deserialize(context); + deserialize({ read, logger, profile }) { + if (read()) { + this.map = read(); + } else if (profile) { + const map = new Map(); + let key = read(); + while (key !== null) { + const start = process.hrtime(); + const value = read(); + const durationHr = process.hrtime(start); + const duration = durationHr[0] * 1000 + durationHr[1] / 1e6; + if (duration > 1) { + if (duration > 100) + logger.error(`Deserialization of '${key}': ${duration} ms`); + else if (duration > 20) + logger.warn(`Deserialization of '${key}': ${duration} ms`); + else if (duration > 5) + logger.info(`Deserialization of '${key}': ${duration} ms`); + else if (duration > 2) + logger.log(`Deserialization of '${key}': ${duration} ms`); + else logger.debug(`Deserialization of '${key}': ${duration} ms`); + } + map.set(key, value); + key = read(); + } + this.map = map; + } else { + const map = new Map(); + let key = read(); + while (key !== null) { + map.set(key, read()); + key = read(); + } + this.map = map; + } } } makeSerializable( - CommonJsSelfReferenceDependency, - "webpack/lib/dependencies/CommonJsSelfReferenceDependency" + PackContentItems, + "webpack/lib/cache/PackFileCacheStrategy", + "PackContentItems" ); -CommonJsSelfReferenceDependency.Template = class CommonJsSelfReferenceDependencyTemplate extends ( - NullDependency.Template -) { +class PackContent { + /* + This class can be in these states: + | this.lazy | this.content | this.outdated | state + A1 | undefined | Map | false | fresh content + A2 | undefined | Map | true | (will not happen) + B1 | lazy () => {} | undefined | false | not deserialized + B2 | lazy () => {} | undefined | true | not deserialized, but some items has been removed + C1 | lazy* () => {} | Map | false | deserialized + C2 | lazy* () => {} | Map | true | deserialized, and some items has been removed + + this.used is a subset of this.items. + this.items is a subset of this.content.keys() resp. this.lazy().map.keys() + When this.outdated === false, this.items === this.content.keys() resp. this.lazy().map.keys() + When this.outdated === true, this.items should be used to recreated this.lazy/this.content. + When this.lazy and this.content is set, they contain the same data. + this.get must only be called with a valid item from this.items. + In state C this.lazy is unMemoized + */ + /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} + * @param {Set} items keys + * @param {Set} usedItems used keys + * @param {PackContentItems | function(): Promise} dataOrFn sync or async content + * @param {Logger=} logger logger for logging + * @param {string=} lazyName name of dataOrFn for logging */ - apply( - dependency, - source, - { module, moduleGraph, runtime, runtimeRequirements } - ) { - const dep = /** @type {CommonJsSelfReferenceDependency} */ (dependency); - let used; - if (dep.names.length === 0) { - used = dep.names; - } else { - used = moduleGraph.getExportsInfo(module).getUsedName(dep.names, runtime); - } - if (!used) { - throw new Error( - "Self-reference dependency has unused export name: This should not happen" - ); - } + constructor(items, usedItems, dataOrFn, logger, lazyName) { + this.items = items; + /** @type {function(): Promise | PackContentItems} */ + this.lazy = typeof dataOrFn === "function" ? dataOrFn : undefined; + /** @type {Map} */ + this.content = typeof dataOrFn === "function" ? undefined : dataOrFn.map; + this.outdated = false; + this.used = usedItems; + this.logger = logger; + this.lazyName = lazyName; + } - let base = undefined; - switch (dep.base) { - case "exports": - runtimeRequirements.add(RuntimeGlobals.exports); - base = module.exportsArgument; - break; - case "module.exports": - runtimeRequirements.add(RuntimeGlobals.module); - base = `${module.moduleArgument}.exports`; - break; - case "this": - runtimeRequirements.add(RuntimeGlobals.thisAsExports); - base = "this"; - break; - default: - throw new Error(`Unsupported base ${dep.base}`); + get(identifier) { + this.used.add(identifier); + if (this.content) { + return this.content.get(identifier); } - if (base === dep.base && equals(used, dep.names)) { - // Nothing has to be changed - // We don't use a replacement for compat reasons - // for plugins that update `module._source` which they - // shouldn't do! - return; + // We are in state B + const { lazyName } = this; + let timeMessage; + if (lazyName) { + // only log once + this.lazyName = undefined; + timeMessage = `restore cache content ${lazyName} (${formatSize( + this.getSize() + )})`; + this.logger.log( + `starting to restore cache content ${lazyName} (${formatSize( + this.getSize() + )}) because of request to: ${identifier}` + ); + this.logger.time(timeMessage); + } + const value = this.lazy(); + if ("then" in value) { + return value.then(data => { + const map = data.map; + if (timeMessage) { + this.logger.timeEnd(timeMessage); + } + // Move to state C + this.content = map; + this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy); + return map.get(identifier); + }); + } else { + const map = value.map; + if (timeMessage) { + this.logger.timeEnd(timeMessage); + } + // Move to state C + this.content = map; + this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy); + return map.get(identifier); } - - source.replace( - dep.range[0], - dep.range[1] - 1, - `${base}${propertyAccess(used)}` - ); } -}; - -module.exports = CommonJsSelfReferenceDependency; - - -/***/ }), - -/***/ 76911: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../util/Hash")} Hash */ - -class ConstDependency extends NullDependency { /** - * @param {string} expression the expression - * @param {number|[number, number]} range the source range - * @param {string[]=} runtimeRequirements runtime requirements + * @param {string} reason explanation why unpack is necessary + * @returns {void | Promise} maybe a promise if lazy */ - constructor(expression, range, runtimeRequirements) { - super(); - this.expression = expression; - this.range = range; - this.runtimeRequirements = runtimeRequirements - ? new Set(runtimeRequirements) - : null; - this._hashUpdate = undefined; - } + unpack(reason) { + if (this.content) return; - /** - * Update the hash - * @param {Hash} hash hash to be updated - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - if (this._hashUpdate === undefined) { - let hashUpdate = "" + this.range + "|" + this.expression; - if (this.runtimeRequirements) { - for (const item of this.runtimeRequirements) { - hashUpdate += "|"; - hashUpdate += item; + // Move from state B to C + if (this.lazy) { + const { lazyName } = this; + let timeMessage; + if (lazyName) { + // only log once + this.lazyName = undefined; + timeMessage = `unpack cache content ${lazyName} (${formatSize( + this.getSize() + )})`; + this.logger.log( + `starting to unpack cache content ${lazyName} (${formatSize( + this.getSize() + )}) because ${reason}` + ); + this.logger.time(timeMessage); + } + const value = this.lazy(); + if ("then" in value) { + return value.then(data => { + if (timeMessage) { + this.logger.timeEnd(timeMessage); + } + this.content = data.map; + }); + } else { + if (timeMessage) { + this.logger.timeEnd(timeMessage); } + this.content = value.map; } - this._hashUpdate = hashUpdate; } - hash.update(this._hashUpdate); } /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this dependency connects the module to referencing modules + * @returns {number} size of the content or -1 if not known */ - getModuleEvaluationSideEffectsState(moduleGraph) { - return false; - } - - serialize(context) { - const { write } = context; - write(this.expression); - write(this.range); - write(this.runtimeRequirements); - super.serialize(context); + getSize() { + if (!this.lazy) return -1; + const options = /** @type {any} */ (this.lazy).options; + if (!options) return -1; + const size = options.size; + if (typeof size !== "number") return -1; + return size; } - deserialize(context) { - const { read } = context; - this.expression = read(); - this.range = read(); - this.runtimeRequirements = read(); - super.deserialize(context); + delete(identifier) { + this.items.delete(identifier); + this.used.delete(identifier); + this.outdated = true; } -} -makeSerializable(ConstDependency, "webpack/lib/dependencies/ConstDependency"); + /** + * @template T + * @param {function(any): function(): Promise | PackContentItems} write write function + * @returns {void} + */ + writeLazy(write) { + if (!this.outdated && this.lazy) { + // State B1 or C1 + // this.lazy is still the valid deserialized version + write(this.lazy); + return; + } + if (!this.outdated && this.content) { + // State A1 + const map = new Map(this.content); + // Move to state C1 + this.lazy = SerializerMiddleware.unMemoizeLazy( + write(() => new PackContentItems(map)) + ); + return; + } + if (this.content) { + // State A2 or C2 + /** @type {Map} */ + const map = new Map(); + for (const item of this.items) { + map.set(item, this.content.get(item)); + } + // Move to state C1 + this.outdated = false; + this.content = map; + this.lazy = SerializerMiddleware.unMemoizeLazy( + write(() => new PackContentItems(map)) + ); + return; + } + // State B2 + const { lazyName } = this; + let timeMessage; + if (lazyName) { + // only log once + this.lazyName = undefined; + timeMessage = `unpack cache content ${lazyName} (${formatSize( + this.getSize() + )})`; + this.logger.log( + `starting to unpack cache content ${lazyName} (${formatSize( + this.getSize() + )}) because it's outdated and need to be serialized` + ); + this.logger.time(timeMessage); + } + const value = this.lazy(); + this.outdated = false; + if ("then" in value) { + // Move to state B1 + this.lazy = write(() => + value.then(data => { + if (timeMessage) { + this.logger.timeEnd(timeMessage); + } + const oldMap = data.map; + /** @type {Map} */ + const map = new Map(); + for (const item of this.items) { + map.set(item, oldMap.get(item)); + } + // Move to state C1 (or maybe C2) + this.content = map; + this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy); -ConstDependency.Template = class ConstDependencyTemplate extends ( - NullDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, templateContext) { - const dep = /** @type {ConstDependency} */ (dependency); - if (dep.runtimeRequirements) { - for (const req of dep.runtimeRequirements) { - templateContext.runtimeRequirements.add(req); + return new PackContentItems(map); + }) + ); + } else { + // Move to state C1 + if (timeMessage) { + this.logger.timeEnd(timeMessage); } + const oldMap = value.map; + /** @type {Map} */ + const map = new Map(); + for (const item of this.items) { + map.set(item, oldMap.get(item)); + } + this.content = map; + this.lazy = write(() => new PackContentItems(map)); } - if (typeof dep.range === "number") { - source.insert(dep.range, dep.expression); - return; - } + } +} - source.replace(dep.range[0], dep.range[1] - 1, dep.expression); +const allowCollectingMemory = buf => { + const wasted = buf.buffer.byteLength - buf.byteLength; + if (wasted > 8192 && (wasted > 1048576 || wasted > buf.byteLength)) { + return Buffer.from(buf); } + return buf; }; -module.exports = ConstDependency; - - -/***/ }), - -/***/ 88101: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const Dependency = __webpack_require__(54912); -const DependencyTemplate = __webpack_require__(5160); -const makeSerializable = __webpack_require__(33032); -const memoize = __webpack_require__(78676); - -/** @typedef {import("../ContextModule").ContextOptions} ContextOptions */ -/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../WebpackError")} WebpackError */ - -const getCriticalDependencyWarning = memoize(() => - __webpack_require__(15427) -); - -/** @typedef {ContextOptions & { request: string }} ContextDependencyOptions */ - -const regExpToString = r => (r ? r + "" : ""); - -class ContextDependency extends Dependency { +class PackFileCacheStrategy { /** - * @param {ContextDependencyOptions} options options for the context module + * @param {Object} options options + * @param {Compiler} options.compiler the compiler + * @param {IntermediateFileSystem} options.fs the filesystem + * @param {string} options.context the context directory + * @param {string} options.cacheLocation the location of the cache data + * @param {string} options.version version identifier + * @param {Logger} options.logger a logger + * @param {SnapshotOptions} options.snapshot options regarding snapshotting + * @param {number} options.maxAge max age of cache items + * @param {boolean} options.profile track and log detailed timing information for individual cache items + * @param {boolean} options.allowCollectingMemory allow to collect unused memory created during deserialization + * @param {false | "gzip" | "brotli"} options.compression compression used */ - constructor(options) { - super(); - - this.options = options; - this.userRequest = this.options && this.options.request; - /** @type {false | string} */ - this.critical = false; - this.hadGlobalOrStickyRegExp = false; - - if ( - this.options && - (this.options.regExp.global || this.options.regExp.sticky) - ) { - this.options = { ...this.options, regExp: null }; - this.hadGlobalOrStickyRegExp = true; - } - - this.request = undefined; - this.range = undefined; - this.valueRange = undefined; - this.inShorthand = undefined; - // TODO refactor this - this.replaces = undefined; + constructor({ + compiler, + fs, + context, + cacheLocation, + version, + logger, + snapshot, + maxAge, + profile, + allowCollectingMemory, + compression + }) { + this.fileSerializer = createFileSerializer( + fs, + compiler.options.output.hashFunction + ); + this.fileSystemInfo = new FileSystemInfo(fs, { + managedPaths: snapshot.managedPaths, + immutablePaths: snapshot.immutablePaths, + logger: logger.getChildLogger("webpack.FileSystemInfo"), + hashFunction: compiler.options.output.hashFunction + }); + this.compiler = compiler; + this.context = context; + this.cacheLocation = cacheLocation; + this.version = version; + this.logger = logger; + this.maxAge = maxAge; + this.profile = profile; + this.allowCollectingMemory = allowCollectingMemory; + this.compression = compression; + this._extension = + compression === "brotli" + ? ".pack.br" + : compression === "gzip" + ? ".pack.gz" + : ".pack"; + this.snapshot = snapshot; + /** @type {Set} */ + this.buildDependencies = new Set(); + /** @type {LazySet} */ + this.newBuildDependencies = new LazySet(); + /** @type {Snapshot} */ + this.resolveBuildDependenciesSnapshot = undefined; + /** @type {Map} */ + this.resolveResults = undefined; + /** @type {Snapshot} */ + this.buildSnapshot = undefined; + /** @type {Promise} */ + this.packPromise = this._openPack(); + this.storePromise = Promise.resolve(); } - get category() { - return "commonjs"; + _getPack() { + if (this.packPromise === undefined) { + this.packPromise = this.storePromise.then(() => this._openPack()); + } + return this.packPromise; } /** - * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + * @returns {Promise} the pack */ - couldAffectReferencingModule() { - return true; + _openPack() { + const { logger, profile, cacheLocation, version } = this; + /** @type {Snapshot} */ + let buildSnapshot; + /** @type {Set} */ + let buildDependencies; + /** @type {Set} */ + let newBuildDependencies; + /** @type {Snapshot} */ + let resolveBuildDependenciesSnapshot; + /** @type {Map} */ + let resolveResults; + logger.time("restore cache container"); + return this.fileSerializer + .deserialize(null, { + filename: `${cacheLocation}/index${this._extension}`, + extension: `${this._extension}`, + logger, + profile, + retainedBuffer: this.allowCollectingMemory + ? allowCollectingMemory + : undefined + }) + .catch(err => { + if (err.code !== "ENOENT") { + logger.warn( + `Restoring pack failed from ${cacheLocation}${this._extension}: ${err}` + ); + logger.debug(err.stack); + } else { + logger.debug( + `No pack exists at ${cacheLocation}${this._extension}: ${err}` + ); + } + return undefined; + }) + .then(packContainer => { + logger.timeEnd("restore cache container"); + if (!packContainer) return undefined; + if (!(packContainer instanceof PackContainer)) { + logger.warn( + `Restored pack from ${cacheLocation}${this._extension}, but contained content is unexpected.`, + packContainer + ); + return undefined; + } + if (packContainer.version !== version) { + logger.log( + `Restored pack from ${cacheLocation}${this._extension}, but version doesn't match.` + ); + return undefined; + } + logger.time("check build dependencies"); + return Promise.all([ + new Promise((resolve, reject) => { + this.fileSystemInfo.checkSnapshotValid( + packContainer.buildSnapshot, + (err, valid) => { + if (err) { + logger.log( + `Restored pack from ${cacheLocation}${this._extension}, but checking snapshot of build dependencies errored: ${err}.` + ); + logger.debug(err.stack); + return resolve(false); + } + if (!valid) { + logger.log( + `Restored pack from ${cacheLocation}${this._extension}, but build dependencies have changed.` + ); + return resolve(false); + } + buildSnapshot = packContainer.buildSnapshot; + return resolve(true); + } + ); + }), + new Promise((resolve, reject) => { + this.fileSystemInfo.checkSnapshotValid( + packContainer.resolveBuildDependenciesSnapshot, + (err, valid) => { + if (err) { + logger.log( + `Restored pack from ${cacheLocation}${this._extension}, but checking snapshot of resolving of build dependencies errored: ${err}.` + ); + logger.debug(err.stack); + return resolve(false); + } + if (valid) { + resolveBuildDependenciesSnapshot = + packContainer.resolveBuildDependenciesSnapshot; + buildDependencies = packContainer.buildDependencies; + resolveResults = packContainer.resolveResults; + return resolve(true); + } + logger.log( + "resolving of build dependencies is invalid, will re-resolve build dependencies" + ); + this.fileSystemInfo.checkResolveResultsValid( + packContainer.resolveResults, + (err, valid) => { + if (err) { + logger.log( + `Restored pack from ${cacheLocation}${this._extension}, but resolving of build dependencies errored: ${err}.` + ); + logger.debug(err.stack); + return resolve(false); + } + if (valid) { + newBuildDependencies = packContainer.buildDependencies; + resolveResults = packContainer.resolveResults; + return resolve(true); + } + logger.log( + `Restored pack from ${cacheLocation}${this._extension}, but build dependencies resolve to different locations.` + ); + return resolve(false); + } + ); + } + ); + }) + ]) + .catch(err => { + logger.timeEnd("check build dependencies"); + throw err; + }) + .then(([buildSnapshotValid, resolveValid]) => { + logger.timeEnd("check build dependencies"); + if (buildSnapshotValid && resolveValid) { + logger.time("restore cache content metadata"); + const d = packContainer.data(); + logger.timeEnd("restore cache content metadata"); + return d; + } + return undefined; + }); + }) + .then(pack => { + if (pack) { + pack.maxAge = this.maxAge; + this.buildSnapshot = buildSnapshot; + if (buildDependencies) this.buildDependencies = buildDependencies; + if (newBuildDependencies) + this.newBuildDependencies.addAll(newBuildDependencies); + this.resolveResults = resolveResults; + this.resolveBuildDependenciesSnapshot = + resolveBuildDependenciesSnapshot; + return pack; + } + return new Pack(logger, this.maxAge); + }) + .catch(err => { + this.logger.warn( + `Restoring pack from ${cacheLocation}${this._extension} failed: ${err}` + ); + this.logger.debug(err.stack); + return new Pack(logger, this.maxAge); + }); } /** - * @returns {string | null} an identifier to merge equal requests + * @param {string} identifier unique name for the resource + * @param {Etag | null} etag etag of the resource + * @param {any} data cached content + * @returns {Promise} promise */ - getResourceIdentifier() { - return ( - `context${this.options.request} ${this.options.recursive} ` + - `${regExpToString(this.options.regExp)} ${regExpToString( - this.options.include - )} ${regExpToString(this.options.exclude)} ` + - `${this.options.mode} ${this.options.chunkName} ` + - `${JSON.stringify(this.options.groupOptions)}` - ); + store(identifier, etag, data) { + return this._getPack().then(pack => { + pack.set(identifier, etag === null ? null : etag.toString(), data); + }); } /** - * Returns warnings - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[]} warnings + * @param {string} identifier unique name for the resource + * @param {Etag | null} etag etag of the resource + * @returns {Promise} promise to the cached content */ - getWarnings(moduleGraph) { - let warnings = super.getWarnings(moduleGraph); - - if (this.critical) { - if (!warnings) warnings = []; - const CriticalDependencyWarning = getCriticalDependencyWarning(); - warnings.push(new CriticalDependencyWarning(this.critical)); - } - - if (this.hadGlobalOrStickyRegExp) { - if (!warnings) warnings = []; - const CriticalDependencyWarning = getCriticalDependencyWarning(); - warnings.push( - new CriticalDependencyWarning( - "Contexts can't use RegExps with the 'g' or 'y' flags." - ) - ); - } + restore(identifier, etag) { + return this._getPack() + .then(pack => + pack.get(identifier, etag === null ? null : etag.toString()) + ) + .catch(err => { + if (err && err.code !== "ENOENT") { + this.logger.warn( + `Restoring failed for ${identifier} from pack: ${err}` + ); + this.logger.debug(err.stack); + } + }); + } - return warnings; + storeBuildDependencies(dependencies) { + this.newBuildDependencies.addAll(dependencies); } - serialize(context) { - const { write } = context; + afterAllStored() { + const packPromise = this.packPromise; + if (packPromise === undefined) return Promise.resolve(); + const reportProgress = ProgressPlugin.getReporter(this.compiler); + return (this.storePromise = packPromise + .then(pack => { + pack.stopCapturingRequests(); + if (!pack.invalid) return; + this.packPromise = undefined; + this.logger.log(`Storing pack...`); + let promise; + const newBuildDependencies = new Set(); + for (const dep of this.newBuildDependencies) { + if (!this.buildDependencies.has(dep)) { + newBuildDependencies.add(dep); + } + } + if (newBuildDependencies.size > 0 || !this.buildSnapshot) { + if (reportProgress) reportProgress(0.5, "resolve build dependencies"); + this.logger.debug( + `Capturing build dependencies... (${Array.from( + newBuildDependencies + ).join(", ")})` + ); + promise = new Promise((resolve, reject) => { + this.logger.time("resolve build dependencies"); + this.fileSystemInfo.resolveBuildDependencies( + this.context, + newBuildDependencies, + (err, result) => { + this.logger.timeEnd("resolve build dependencies"); + if (err) return reject(err); + + this.logger.time("snapshot build dependencies"); + const { + files, + directories, + missing, + resolveResults, + resolveDependencies + } = result; + if (this.resolveResults) { + for (const [key, value] of resolveResults) { + this.resolveResults.set(key, value); + } + } else { + this.resolveResults = resolveResults; + } + if (reportProgress) { + reportProgress( + 0.6, + "snapshot build dependencies", + "resolving" + ); + } + this.fileSystemInfo.createSnapshot( + undefined, + resolveDependencies.files, + resolveDependencies.directories, + resolveDependencies.missing, + this.snapshot.resolveBuildDependencies, + (err, snapshot) => { + if (err) { + this.logger.timeEnd("snapshot build dependencies"); + return reject(err); + } + if (!snapshot) { + this.logger.timeEnd("snapshot build dependencies"); + return reject( + new Error("Unable to snapshot resolve dependencies") + ); + } + if (this.resolveBuildDependenciesSnapshot) { + this.resolveBuildDependenciesSnapshot = + this.fileSystemInfo.mergeSnapshots( + this.resolveBuildDependenciesSnapshot, + snapshot + ); + } else { + this.resolveBuildDependenciesSnapshot = snapshot; + } + if (reportProgress) { + reportProgress( + 0.7, + "snapshot build dependencies", + "modules" + ); + } + this.fileSystemInfo.createSnapshot( + undefined, + files, + directories, + missing, + this.snapshot.buildDependencies, + (err, snapshot) => { + this.logger.timeEnd("snapshot build dependencies"); + if (err) return reject(err); + if (!snapshot) { + return reject( + new Error("Unable to snapshot build dependencies") + ); + } + this.logger.debug("Captured build dependencies"); - write(this.options); - write(this.userRequest); - write(this.critical); - write(this.hadGlobalOrStickyRegExp); - write(this.request); - write(this.range); - write(this.valueRange); - write(this.prepend); - write(this.replaces); + if (this.buildSnapshot) { + this.buildSnapshot = + this.fileSystemInfo.mergeSnapshots( + this.buildSnapshot, + snapshot + ); + } else { + this.buildSnapshot = snapshot; + } - super.serialize(context); + resolve(); + } + ); + } + ); + } + ); + }); + } else { + promise = Promise.resolve(); + } + return promise.then(() => { + if (reportProgress) reportProgress(0.8, "serialize pack"); + this.logger.time(`store pack`); + const updatedBuildDependencies = new Set(this.buildDependencies); + for (const dep of newBuildDependencies) { + updatedBuildDependencies.add(dep); + } + const content = new PackContainer( + pack, + this.version, + this.buildSnapshot, + updatedBuildDependencies, + this.resolveResults, + this.resolveBuildDependenciesSnapshot + ); + return this.fileSerializer + .serialize(content, { + filename: `${this.cacheLocation}/index${this._extension}`, + extension: `${this._extension}`, + logger: this.logger, + profile: this.profile + }) + .then(() => { + for (const dep of newBuildDependencies) { + this.buildDependencies.add(dep); + } + this.newBuildDependencies.clear(); + this.logger.timeEnd(`store pack`); + const stats = pack.getContentStats(); + this.logger.log( + "Stored pack (%d items, %d files, %d MiB)", + pack.itemInfo.size, + stats.count, + Math.round(stats.size / 1024 / 1024) + ); + }) + .catch(err => { + this.logger.timeEnd(`store pack`); + this.logger.warn(`Caching failed for pack: ${err}`); + this.logger.debug(err.stack); + }); + }); + }) + .catch(err => { + this.logger.warn(`Caching failed for pack: ${err}`); + this.logger.debug(err.stack); + })); } - deserialize(context) { - const { read } = context; - - this.options = read(); - this.userRequest = read(); - this.critical = read(); - this.hadGlobalOrStickyRegExp = read(); - this.request = read(); - this.range = read(); - this.valueRange = read(); - this.prepend = read(); - this.replaces = read(); - - super.deserialize(context); + clear() { + this.fileSystemInfo.clear(); + this.buildDependencies.clear(); + this.newBuildDependencies.clear(); + this.resolveBuildDependenciesSnapshot = undefined; + this.resolveResults = undefined; + this.buildSnapshot = undefined; + this.packPromise = undefined; } } -makeSerializable( - ContextDependency, - "webpack/lib/dependencies/ContextDependency" -); - -ContextDependency.Template = DependencyTemplate; - -module.exports = ContextDependency; +module.exports = PackFileCacheStrategy; /***/ }), -/***/ 99630: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 97347: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -74783,236 +69821,297 @@ module.exports = ContextDependency; -const { parseResource } = __webpack_require__(82186); +const LazySet = __webpack_require__(38938); +const makeSerializable = __webpack_require__(33032); -/** @typedef {import("estree").Node} EsTreeNode */ -/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ -/** @typedef {import("../../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */ -/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */ -/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ -/** @typedef {import("./ContextDependency")} ContextDependency */ -/** @typedef {import("./ContextDependency").ContextDependencyOptions} ContextDependencyOptions */ +/** @typedef {import("enhanced-resolve/lib/Resolver")} Resolver */ +/** @typedef {import("../CacheFacade").ItemCacheFacade} ItemCacheFacade */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../FileSystemInfo")} FileSystemInfo */ +/** @typedef {import("../FileSystemInfo").Snapshot} Snapshot */ -/** - * Escapes regular expression metacharacters - * @param {string} str String to quote - * @returns {string} Escaped string - */ -const quoteMeta = str => { - return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); -}; +class CacheEntry { + constructor(result, snapshot) { + this.result = result; + this.snapshot = snapshot; + } -const splitContextFromPrefix = prefix => { - const idx = prefix.lastIndexOf("/"); - let context = "."; - if (idx >= 0) { - context = prefix.substr(0, idx); - prefix = `.${prefix.substr(idx)}`; + serialize({ write }) { + write(this.result); + write(this.snapshot); } - return { - context, - prefix - }; -}; -/** @typedef {Partial>} PartialContextDependencyOptions */ + deserialize({ read }) { + this.result = read(); + this.snapshot = read(); + } +} -/** @typedef {{ new(options: ContextDependencyOptions, range: [number, number], valueRange: [number, number]): ContextDependency }} ContextDependencyConstructor */ +makeSerializable(CacheEntry, "webpack/lib/cache/ResolverCachePlugin"); /** - * @param {ContextDependencyConstructor} Dep the Dependency class - * @param {[number, number]} range source range - * @param {BasicEvaluatedExpression} param context param - * @param {EsTreeNode} expr expr - * @param {Pick} options options for context creation - * @param {PartialContextDependencyOptions} contextOptions options for the ContextModule - * @param {JavascriptParser} parser the parser - * @returns {ContextDependency} the created Dependency + * @template T + * @param {Set | LazySet} set set to add items to + * @param {Set | LazySet} otherSet set to add items from + * @returns {void} */ -exports.create = (Dep, range, param, expr, options, contextOptions, parser) => { - if (param.isTemplateString()) { - let prefixRaw = param.quasis[0].string; - let postfixRaw = - param.quasis.length > 1 - ? param.quasis[param.quasis.length - 1].string - : ""; - - const valueRange = param.range; - const { context, prefix } = splitContextFromPrefix(prefixRaw); - const { - path: postfix, - query, - fragment - } = parseResource(postfixRaw, parser); - - // When there are more than two quasis, the generated RegExp can be more precise - // We join the quasis with the expression regexp - const innerQuasis = param.quasis.slice(1, param.quasis.length - 1); - const innerRegExp = - options.wrappedContextRegExp.source + - innerQuasis - .map(q => quoteMeta(q.string) + options.wrappedContextRegExp.source) - .join(""); - - // Example: `./context/pre${e}inner${e}inner2${e}post?query#frag` - // context: "./context" - // prefix: "./pre" - // innerQuasis: [BEE("inner"), BEE("inner2")] - // (BEE = BasicEvaluatedExpression) - // postfix: "post" - // query: "?query" - // fragment: "#frag" - // regExp: /^\.\/pre.*inner.*inner2.*post$/ - const regExp = new RegExp( - `^${quoteMeta(prefix)}${innerRegExp}${quoteMeta(postfix)}$` - ); - const dep = new Dep( - { - request: context + query + fragment, - recursive: options.wrappedContextRecursive, - regExp, - mode: "sync", - ...contextOptions - }, - range, - valueRange - ); - dep.loc = expr.loc; - const replaces = []; - - param.parts.forEach((part, i) => { - if (i % 2 === 0) { - // Quasis or merged quasi - let range = part.range; - let value = part.string; - if (param.templateStringKind === "cooked") { - value = JSON.stringify(value); - value = value.slice(1, value.length - 1); - } - if (i === 0) { - // prefix - value = prefix; - range = [param.range[0], part.range[1]]; - value = - (param.templateStringKind === "cooked" ? "`" : "String.raw`") + - value; - } else if (i === param.parts.length - 1) { - // postfix - value = postfix; - range = [part.range[0], param.range[1]]; - value = value + "`"; - } else if ( - part.expression && - part.expression.type === "TemplateElement" && - part.expression.value.raw === value - ) { - // Shortcut when it's a single quasi and doesn't need to be replaced - return; - } - replaces.push({ - range, - value - }); - } else { - // Expression - parser.walkExpression(part.expression); - } - }); - - dep.replaces = replaces; - dep.critical = - options.wrappedContextCritical && - "a part of the request of a dependency is an expression"; - return dep; - } else if ( - param.isWrapped() && - ((param.prefix && param.prefix.isString()) || - (param.postfix && param.postfix.isString())) - ) { - let prefixRaw = - param.prefix && param.prefix.isString() ? param.prefix.string : ""; - let postfixRaw = - param.postfix && param.postfix.isString() ? param.postfix.string : ""; - const prefixRange = - param.prefix && param.prefix.isString() ? param.prefix.range : null; - const postfixRange = - param.postfix && param.postfix.isString() ? param.postfix.range : null; - const valueRange = param.range; - const { context, prefix } = splitContextFromPrefix(prefixRaw); - const { - path: postfix, - query, - fragment - } = parseResource(postfixRaw, parser); - const regExp = new RegExp( - `^${quoteMeta(prefix)}${options.wrappedContextRegExp.source}${quoteMeta( - postfix - )}$` - ); - const dep = new Dep( - { - request: context + query + fragment, - recursive: options.wrappedContextRecursive, - regExp, - mode: "sync", - ...contextOptions - }, - range, - valueRange - ); - dep.loc = expr.loc; - const replaces = []; - if (prefixRange) { - replaces.push({ - range: prefixRange, - value: JSON.stringify(prefix) - }); - } - if (postfixRange) { - replaces.push({ - range: postfixRange, - value: JSON.stringify(postfix) - }); +const addAllToSet = (set, otherSet) => { + if (set instanceof LazySet) { + set.addAll(otherSet); + } else { + for (const item of otherSet) { + set.add(item); } - dep.replaces = replaces; - dep.critical = - options.wrappedContextCritical && - "a part of the request of a dependency is an expression"; + } +}; - if (parser && param.wrappedInnerExpressions) { - for (const part of param.wrappedInnerExpressions) { - if (part.expression) parser.walkExpression(part.expression); - } +/** + * @param {Object} object an object + * @param {boolean} excludeContext if true, context is not included in string + * @returns {string} stringified version + */ +const objectToString = (object, excludeContext) => { + let str = ""; + for (const key in object) { + if (excludeContext && key === "context") continue; + const value = object[key]; + if (typeof value === "object" && value !== null) { + str += `|${key}=[${objectToString(value, false)}|]`; + } else { + str += `|${key}=|${value}`; } + } + return str; +}; - return dep; - } else { - const dep = new Dep( - { - request: options.exprContextRequest, - recursive: options.exprContextRecursive, - regExp: /** @type {RegExp} */ (options.exprContextRegExp), - mode: "sync", - ...contextOptions - }, - range, - param.range - ); - dep.loc = expr.loc; - dep.critical = - options.exprContextCritical && - "the request of a dependency is an expression"; - - parser.walkExpression(param.expression); +class ResolverCachePlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const cache = compiler.getCache("ResolverCachePlugin"); + /** @type {FileSystemInfo} */ + let fileSystemInfo; + let snapshotOptions; + let realResolves = 0; + let cachedResolves = 0; + let cacheInvalidResolves = 0; + let concurrentResolves = 0; + compiler.hooks.thisCompilation.tap("ResolverCachePlugin", compilation => { + snapshotOptions = compilation.options.snapshot.resolve; + fileSystemInfo = compilation.fileSystemInfo; + compilation.hooks.finishModules.tap("ResolverCachePlugin", () => { + if (realResolves + cachedResolves > 0) { + const logger = compilation.getLogger("webpack.ResolverCachePlugin"); + logger.log( + `${Math.round( + (100 * realResolves) / (realResolves + cachedResolves) + )}% really resolved (${realResolves} real resolves with ${cacheInvalidResolves} cached but invalid, ${cachedResolves} cached valid, ${concurrentResolves} concurrent)` + ); + realResolves = 0; + cachedResolves = 0; + cacheInvalidResolves = 0; + concurrentResolves = 0; + } + }); + }); + /** + * @param {ItemCacheFacade} itemCache cache + * @param {Resolver} resolver the resolver + * @param {Object} resolveContext context for resolving meta info + * @param {Object} request the request info object + * @param {function((Error | null)=, Object=): void} callback callback function + * @returns {void} + */ + const doRealResolve = ( + itemCache, + resolver, + resolveContext, + request, + callback + ) => { + realResolves++; + const newRequest = { + _ResolverCachePluginCacheMiss: true, + ...request + }; + const newResolveContext = { + ...resolveContext, + stack: new Set(), + missingDependencies: new LazySet(), + fileDependencies: new LazySet(), + contextDependencies: new LazySet() + }; + const propagate = key => { + if (resolveContext[key]) { + addAllToSet(resolveContext[key], newResolveContext[key]); + } + }; + const resolveTime = Date.now(); + resolver.doResolve( + resolver.hooks.resolve, + newRequest, + "Cache miss", + newResolveContext, + (err, result) => { + propagate("fileDependencies"); + propagate("contextDependencies"); + propagate("missingDependencies"); + if (err) return callback(err); + const fileDependencies = newResolveContext.fileDependencies; + const contextDependencies = newResolveContext.contextDependencies; + const missingDependencies = newResolveContext.missingDependencies; + fileSystemInfo.createSnapshot( + resolveTime, + fileDependencies, + contextDependencies, + missingDependencies, + snapshotOptions, + (err, snapshot) => { + if (err) return callback(err); + if (!snapshot) { + if (result) return callback(null, result); + return callback(); + } + itemCache.store(new CacheEntry(result, snapshot), storeErr => { + if (storeErr) return callback(storeErr); + if (result) return callback(null, result); + callback(); + }); + } + ); + } + ); + }; + compiler.resolverFactory.hooks.resolver.intercept({ + factory(type, hook) { + /** @type {Map} */ + const activeRequests = new Map(); + hook.tap( + "ResolverCachePlugin", + /** + * @param {Resolver} resolver the resolver + * @param {Object} options resolve options + * @param {Object} userOptions resolve options passed by the user + * @returns {void} + */ + (resolver, options, userOptions) => { + if (options.cache !== true) return; + const optionsIdent = objectToString(userOptions, false); + const cacheWithContext = + options.cacheWithContext !== undefined + ? options.cacheWithContext + : false; + resolver.hooks.resolve.tapAsync( + { + name: "ResolverCachePlugin", + stage: -100 + }, + (request, resolveContext, callback) => { + if (request._ResolverCachePluginCacheMiss || !fileSystemInfo) { + return callback(); + } + const identifier = `${type}${optionsIdent}${objectToString( + request, + !cacheWithContext + )}`; + const activeRequest = activeRequests.get(identifier); + if (activeRequest) { + activeRequest.push(callback); + return; + } + const itemCache = cache.getItemCache(identifier, null); + let callbacks; + const done = (err, result) => { + if (callbacks === undefined) { + callback(err, result); + callbacks = false; + } else { + for (const callback of callbacks) { + callback(err, result); + } + activeRequests.delete(identifier); + callbacks = false; + } + }; + /** + * @param {Error=} err error if any + * @param {CacheEntry=} cacheEntry cache entry + * @returns {void} + */ + const processCacheResult = (err, cacheEntry) => { + if (err) return done(err); - return dep; + if (cacheEntry) { + const { snapshot, result } = cacheEntry; + fileSystemInfo.checkSnapshotValid( + snapshot, + (err, valid) => { + if (err || !valid) { + cacheInvalidResolves++; + return doRealResolve( + itemCache, + resolver, + resolveContext, + request, + done + ); + } + cachedResolves++; + if (resolveContext.missingDependencies) { + addAllToSet( + resolveContext.missingDependencies, + snapshot.getMissingIterable() + ); + } + if (resolveContext.fileDependencies) { + addAllToSet( + resolveContext.fileDependencies, + snapshot.getFileIterable() + ); + } + if (resolveContext.contextDependencies) { + addAllToSet( + resolveContext.contextDependencies, + snapshot.getContextIterable() + ); + } + done(null, result); + } + ); + } else { + doRealResolve( + itemCache, + resolver, + resolveContext, + request, + done + ); + } + }; + itemCache.get(processCacheResult); + if (callbacks === undefined) { + callbacks = [callback]; + activeRequests.set(identifier, callbacks); + } + } + ); + } + ); + return hook; + } + }); } -}; +} + +module.exports = ResolverCachePlugin; /***/ }), -/***/ 76081: +/***/ 94075: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -75023,66 +70122,86 @@ exports.create = (Dep, range, param, expr, options, contextOptions, parser) => { -const ContextDependency = __webpack_require__(88101); +const createHash = __webpack_require__(49835); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {typeof import("../util/Hash")} HashConstructor */ -class ContextDependencyTemplateAsId extends ContextDependency.Template { +/** + * @typedef {Object} HashableObject + * @property {function(Hash): void} updateHash + */ + +class LazyHashedEtag { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} + * @param {HashableObject} obj object with updateHash method + * @param {string | HashConstructor} hashFunction the hash function to use */ - apply( - dependency, - source, - { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } - ) { - const dep = /** @type {ContextDependency} */ (dependency); - const moduleExports = runtimeTemplate.moduleExports({ - module: moduleGraph.getModule(dep), - chunkGraph, - request: dep.request, - weak: dep.weak, - runtimeRequirements - }); + constructor(obj, hashFunction = "md4") { + this._obj = obj; + this._hash = undefined; + this._hashFunction = hashFunction; + } - if (moduleGraph.getModule(dep)) { - if (dep.valueRange) { - if (Array.isArray(dep.replaces)) { - for (let i = 0; i < dep.replaces.length; i++) { - const rep = dep.replaces[i]; - source.replace(rep.range[0], rep.range[1] - 1, rep.value); - } - } - source.replace(dep.valueRange[1], dep.range[1] - 1, ")"); - source.replace( - dep.range[0], - dep.valueRange[0] - 1, - `${moduleExports}.resolve(` - ); - } else { - source.replace( - dep.range[0], - dep.range[1] - 1, - `${moduleExports}.resolve` - ); - } - } else { - source.replace(dep.range[0], dep.range[1] - 1, moduleExports); + /** + * @returns {string} hash of object + */ + toString() { + if (this._hash === undefined) { + const hash = createHash(this._hashFunction); + this._obj.updateHash(hash); + this._hash = /** @type {string} */ (hash.digest("base64")); } + return this._hash; } } -module.exports = ContextDependencyTemplateAsId; + +/** @type {Map>} */ +const mapStrings = new Map(); + +/** @type {WeakMap>} */ +const mapObjects = new WeakMap(); + +/** + * @param {HashableObject} obj object with updateHash method + * @param {string | HashConstructor} hashFunction the hash function to use + * @returns {LazyHashedEtag} etag + */ +const getter = (obj, hashFunction = "md4") => { + let innerMap; + if (typeof hashFunction === "string") { + innerMap = mapStrings.get(hashFunction); + if (innerMap === undefined) { + const newHash = new LazyHashedEtag(obj, hashFunction); + innerMap = new WeakMap(); + innerMap.set(obj, newHash); + mapStrings.set(hashFunction, innerMap); + return newHash; + } + } else { + innerMap = mapObjects.get(hashFunction); + if (innerMap === undefined) { + const newHash = new LazyHashedEtag(obj, hashFunction); + innerMap = new WeakMap(); + innerMap.set(obj, newHash); + mapObjects.set(hashFunction, innerMap); + return newHash; + } + } + const hash = innerMap.get(obj); + if (hash !== undefined) return hash; + const newHash = new LazyHashedEtag(obj, hashFunction); + innerMap.set(obj, newHash); + return newHash; +}; + +module.exports = getter; /***/ }), -/***/ 75815: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 54980: +/***/ (function(module) { "use strict"; /* @@ -75092,64 +70211,79 @@ module.exports = ContextDependencyTemplateAsId; -const ContextDependency = __webpack_require__(88101); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../Cache").Etag} Etag */ -class ContextDependencyTemplateAsRequireCall extends ContextDependency.Template { +class MergedEtag { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} + * @param {Etag} a first + * @param {Etag} b second */ - apply( - dependency, - source, - { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } - ) { - const dep = /** @type {ContextDependency} */ (dependency); - let moduleExports = runtimeTemplate.moduleExports({ - module: moduleGraph.getModule(dep), - chunkGraph, - request: dep.request, - runtimeRequirements - }); + constructor(a, b) { + this.a = a; + this.b = b; + } - if (dep.inShorthand) { - moduleExports = `${dep.inShorthand}: ${moduleExports}`; + toString() { + return `${this.a.toString()}|${this.b.toString()}`; + } +} + +const dualObjectMap = new WeakMap(); +const objectStringMap = new WeakMap(); + +/** + * @param {Etag} a first + * @param {Etag} b second + * @returns {Etag} result + */ +const mergeEtags = (a, b) => { + if (typeof a === "string") { + if (typeof b === "string") { + return `${a}|${b}`; + } else { + const temp = b; + b = a; + a = temp; } - if (moduleGraph.getModule(dep)) { - if (dep.valueRange) { - if (Array.isArray(dep.replaces)) { - for (let i = 0; i < dep.replaces.length; i++) { - const rep = dep.replaces[i]; - source.replace(rep.range[0], rep.range[1] - 1, rep.value); - } - } - source.replace(dep.valueRange[1], dep.range[1] - 1, ")"); - source.replace( - dep.range[0], - dep.valueRange[0] - 1, - `${moduleExports}(` - ); + } else { + if (typeof b !== "string") { + // both a and b are objects + let map = dualObjectMap.get(a); + if (map === undefined) { + dualObjectMap.set(a, (map = new WeakMap())); + } + const mergedEtag = map.get(b); + if (mergedEtag === undefined) { + const newMergedEtag = new MergedEtag(a, b); + map.set(b, newMergedEtag); + return newMergedEtag; } else { - source.replace(dep.range[0], dep.range[1] - 1, moduleExports); + return mergedEtag; } - } else { - source.replace(dep.range[0], dep.range[1] - 1, moduleExports); } } -} -module.exports = ContextDependencyTemplateAsRequireCall; + // a is object, b is string + let map = objectStringMap.get(a); + if (map === undefined) { + objectStringMap.set(a, (map = new Map())); + } + const mergedEtag = map.get(b); + if (mergedEtag === undefined) { + const newMergedEtag = new MergedEtag(a, b); + map.set(b, newMergedEtag); + return newMergedEtag; + } else { + return mergedEtag; + } +}; + +module.exports = mergeEtags; /***/ }), -/***/ 58477: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 13462: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -75159,834 +70293,2319 @@ module.exports = ContextDependencyTemplateAsRequireCall; -const Dependency = __webpack_require__(54912); -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); +const path = __webpack_require__(71017); +const webpackSchema = __webpack_require__(73342); + +// TODO add originPath to PathItem for better errors +/** + * @typedef {Object} PathItem + * @property {any} schema the part of the schema + * @property {string} path the path in the config + */ + +/** @typedef {"unknown-argument" | "unexpected-non-array-in-path" | "unexpected-non-object-in-path" | "multiple-values-unexpected" | "invalid-value"} ProblemType */ + +/** + * @typedef {Object} Problem + * @property {ProblemType} type + * @property {string} path + * @property {string} argument + * @property {any=} value + * @property {number=} index + * @property {string=} expected + */ + +/** + * @typedef {Object} LocalProblem + * @property {ProblemType} type + * @property {string} path + * @property {string=} expected + */ + +/** + * @typedef {Object} ArgumentConfig + * @property {string} description + * @property {string} [negatedDescription] + * @property {string} path + * @property {boolean} multiple + * @property {"enum"|"string"|"path"|"number"|"boolean"|"RegExp"|"reset"} type + * @property {any[]=} values + */ + +/** + * @typedef {Object} Argument + * @property {string} description + * @property {"string"|"number"|"boolean"} simpleType + * @property {boolean} multiple + * @property {ArgumentConfig[]} configs + */ + +/** + * @param {any=} schema a json schema to create arguments for (by default webpack schema is used) + * @returns {Record} object of arguments + */ +const getArguments = (schema = webpackSchema) => { + /** @type {Record} */ + const flags = {}; + + const pathToArgumentName = input => { + return input + .replace(/\./g, "-") + .replace(/\[\]/g, "") + .replace( + /(\p{Uppercase_Letter}+|\p{Lowercase_Letter}|\d)(\p{Uppercase_Letter}+)/gu, + "$1-$2" + ) + .replace(/-?[^\p{Uppercase_Letter}\p{Lowercase_Letter}\d]+/gu, "-") + .toLowerCase(); + }; + + const getSchemaPart = path => { + const newPath = path.split("/"); + + let schemaPart = schema; + + for (let i = 1; i < newPath.length; i++) { + const inner = schemaPart[newPath[i]]; + + if (!inner) { + break; + } + + schemaPart = inner; + } + + return schemaPart; + }; + + /** + * + * @param {PathItem[]} path path in the schema + * @returns {string | undefined} description + */ + const getDescription = path => { + for (const { schema } of path) { + if (schema.cli) { + if (schema.cli.helper) continue; + if (schema.cli.description) return schema.cli.description; + } + if (schema.description) return schema.description; + } + }; + + /** + * + * @param {PathItem[]} path path in the schema + * @returns {string | undefined} negative description + */ + const getNegatedDescription = path => { + for (const { schema } of path) { + if (schema.cli) { + if (schema.cli.helper) continue; + if (schema.cli.negatedDescription) return schema.cli.negatedDescription; + } + } + }; + + /** + * + * @param {PathItem[]} path path in the schema + * @returns {string | undefined} reset description + */ + const getResetDescription = path => { + for (const { schema } of path) { + if (schema.cli) { + if (schema.cli.helper) continue; + if (schema.cli.resetDescription) return schema.cli.resetDescription; + } + } + }; + + /** + * + * @param {any} schemaPart schema + * @returns {Pick} partial argument config + */ + const schemaToArgumentConfig = schemaPart => { + if (schemaPart.enum) { + return { + type: "enum", + values: schemaPart.enum + }; + } + switch (schemaPart.type) { + case "number": + return { + type: "number" + }; + case "string": + return { + type: schemaPart.absolutePath ? "path" : "string" + }; + case "boolean": + return { + type: "boolean" + }; + } + if (schemaPart.instanceof === "RegExp") { + return { + type: "RegExp" + }; + } + return undefined; + }; + + /** + * @param {PathItem[]} path path in the schema + * @returns {void} + */ + const addResetFlag = path => { + const schemaPath = path[0].path; + const name = pathToArgumentName(`${schemaPath}.reset`); + const description = + getResetDescription(path) || + `Clear all items provided in '${schemaPath}' configuration. ${getDescription( + path + )}`; + flags[name] = { + configs: [ + { + type: "reset", + multiple: false, + description, + path: schemaPath + } + ], + description: undefined, + simpleType: undefined, + multiple: undefined + }; + }; + + /** + * @param {PathItem[]} path full path in schema + * @param {boolean} multiple inside of an array + * @returns {number} number of arguments added + */ + const addFlag = (path, multiple) => { + const argConfigBase = schemaToArgumentConfig(path[0].schema); + if (!argConfigBase) return 0; + + const negatedDescription = getNegatedDescription(path); + const name = pathToArgumentName(path[0].path); + /** @type {ArgumentConfig} */ + const argConfig = { + ...argConfigBase, + multiple, + description: getDescription(path), + path: path[0].path + }; -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + if (negatedDescription) { + argConfig.negatedDescription = negatedDescription; + } -class ContextElementDependency extends ModuleDependency { - constructor(request, userRequest, typePrefix, category, referencedExports) { - super(request); - this.referencedExports = referencedExports; - this._typePrefix = typePrefix; - this._category = category; + if (!flags[name]) { + flags[name] = { + configs: [], + description: undefined, + simpleType: undefined, + multiple: undefined + }; + } - if (userRequest) { - this.userRequest = userRequest; + if ( + flags[name].configs.some( + item => JSON.stringify(item) === JSON.stringify(argConfig) + ) + ) { + return 0; } - } - get type() { - if (this._typePrefix) { - return `${this._typePrefix} context element`; + if ( + flags[name].configs.some( + item => item.type === argConfig.type && item.multiple !== multiple + ) + ) { + if (multiple) { + throw new Error( + `Conflicting schema for ${path[0].path} with ${argConfig.type} type (array type must be before single item type)` + ); + } + return 0; } - return "context element"; - } + flags[name].configs.push(argConfig); - get category() { - return this._category; - } + return 1; + }; + // TODO support `not` and `if/then/else` + // TODO support `const`, but we don't use it on our schema /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports + * + * @param {object} schemaPart the current schema + * @param {string} schemaPath the current path in the schema + * @param {{schema: object, path: string}[]} path all previous visited schemaParts + * @param {string | null} inArray if inside of an array, the path to the array + * @returns {number} added arguments */ - getReferencedExports(moduleGraph, runtime) { - return this.referencedExports - ? this.referencedExports.map(e => ({ - name: e, - canMangle: false - })) - : Dependency.EXPORTS_OBJECT_REFERENCED; - } + const traverse = (schemaPart, schemaPath = "", path = [], inArray = null) => { + while (schemaPart.$ref) { + schemaPart = getSchemaPart(schemaPart.$ref); + } - serialize(context) { - const { write } = context; - write(this._typePrefix); - write(this._category); - write(this.referencedExports); - super.serialize(context); - } + const repetitions = path.filter(({ schema }) => schema === schemaPart); + if ( + repetitions.length >= 2 || + repetitions.some(({ path }) => path === schemaPath) + ) { + return 0; + } - deserialize(context) { - const { read } = context; - this._typePrefix = read(); - this._category = read(); - this.referencedExports = read(); - super.deserialize(context); - } -} + if (schemaPart.cli && schemaPart.cli.exclude) return 0; -makeSerializable( - ContextElementDependency, - "webpack/lib/dependencies/ContextElementDependency" -); + const fullPath = [{ schema: schemaPart, path: schemaPath }, ...path]; -module.exports = ContextElementDependency; + let addedArguments = 0; + addedArguments += addFlag(fullPath, !!inArray); -/***/ }), + if (schemaPart.type === "object") { + if (schemaPart.properties) { + for (const property of Object.keys(schemaPart.properties)) { + addedArguments += traverse( + schemaPart.properties[property], + schemaPath ? `${schemaPath}.${property}` : property, + fullPath, + inArray + ); + } + } -/***/ 79062: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + return addedArguments; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (schemaPart.type === "array") { + if (inArray) { + return 0; + } + if (Array.isArray(schemaPart.items)) { + let i = 0; + for (const item of schemaPart.items) { + addedArguments += traverse( + item, + `${schemaPath}.${i}`, + fullPath, + schemaPath + ); + } + return addedArguments; + } + addedArguments += traverse( + schemaPart.items, + `${schemaPath}[]`, + fullPath, + schemaPath + ); -const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); + if (addedArguments > 0) { + addResetFlag(fullPath); + addedArguments++; + } -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + return addedArguments; + } -class CreateScriptUrlDependency extends NullDependency { - /** - * @param {[number, number]} range range - */ - constructor(range) { - super(); - this.range = range; - } + const maybeOf = schemaPart.oneOf || schemaPart.anyOf || schemaPart.allOf; - get type() { - return "create script url"; - } + if (maybeOf) { + const items = maybeOf; - serialize(context) { - const { write } = context; - write(this.range); - super.serialize(context); - } + for (let i = 0; i < items.length; i++) { + addedArguments += traverse(items[i], schemaPath, fullPath, inArray); + } - deserialize(context) { - const { read } = context; - this.range = read(); - super.deserialize(context); - } -} + return addedArguments; + } -CreateScriptUrlDependency.Template = class CreateScriptUrlDependencyTemplate extends ( - NullDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, { runtimeRequirements }) { - const dep = /** @type {CreateScriptUrlDependency} */ (dependency); + return addedArguments; + }; - runtimeRequirements.add(RuntimeGlobals.createScriptUrl); + traverse(schema); - source.insert(dep.range[0], `${RuntimeGlobals.createScriptUrl}(`); - source.insert(dep.range[1], ")"); + // Summarize flags + for (const name of Object.keys(flags)) { + const argument = flags[name]; + argument.description = argument.configs.reduce((desc, { description }) => { + if (!desc) return description; + if (!description) return desc; + if (desc.includes(description)) return desc; + return `${desc} ${description}`; + }, /** @type {string | undefined} */ (undefined)); + argument.simpleType = argument.configs.reduce((t, argConfig) => { + /** @type {"string" | "number" | "boolean"} */ + let type = "string"; + switch (argConfig.type) { + case "number": + type = "number"; + break; + case "reset": + case "boolean": + type = "boolean"; + break; + case "enum": + if (argConfig.values.every(v => typeof v === "boolean")) + type = "boolean"; + if (argConfig.values.every(v => typeof v === "number")) + type = "number"; + break; + } + if (t === undefined) return type; + return t === type ? t : "string"; + }, /** @type {"string" | "number" | "boolean" | undefined} */ (undefined)); + argument.multiple = argument.configs.some(c => c.multiple); } -}; - -makeSerializable( - CreateScriptUrlDependency, - "webpack/lib/dependencies/CreateScriptUrlDependency" -); -module.exports = CreateScriptUrlDependency; - - -/***/ }), + return flags; +}; -/***/ 15427: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +const cliAddedItems = new WeakMap(); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** + * @param {any} config configuration + * @param {string} schemaPath path in the config + * @param {number | undefined} index index of value when multiple values are provided, otherwise undefined + * @returns {{ problem?: LocalProblem, object?: any, property?: string | number, value?: any }} problem or object with property and value + */ +const getObjectAndProperty = (config, schemaPath, index = 0) => { + if (!schemaPath) return { value: config }; + const parts = schemaPath.split("."); + let property = parts.pop(); + let current = config; + let i = 0; + for (const part of parts) { + const isArray = part.endsWith("[]"); + const name = isArray ? part.slice(0, -2) : part; + let value = current[name]; + if (isArray) { + if (value === undefined) { + value = {}; + current[name] = [...Array.from({ length: index }), value]; + cliAddedItems.set(current[name], index + 1); + } else if (!Array.isArray(value)) { + return { + problem: { + type: "unexpected-non-array-in-path", + path: parts.slice(0, i).join(".") + } + }; + } else { + let addedItems = cliAddedItems.get(value) || 0; + while (addedItems <= index) { + value.push(undefined); + addedItems++; + } + cliAddedItems.set(value, addedItems); + const x = value.length - addedItems + index; + if (value[x] === undefined) { + value[x] = {}; + } else if (value[x] === null || typeof value[x] !== "object") { + return { + problem: { + type: "unexpected-non-object-in-path", + path: parts.slice(0, i).join(".") + } + }; + } + value = value[x]; + } + } else { + if (value === undefined) { + value = current[name] = {}; + } else if (value === null || typeof value !== "object") { + return { + problem: { + type: "unexpected-non-object-in-path", + path: parts.slice(0, i).join(".") + } + }; + } + } + current = value; + i++; + } + let value = current[property]; + if (property.endsWith("[]")) { + const name = property.slice(0, -2); + const value = current[name]; + if (value === undefined) { + current[name] = [...Array.from({ length: index }), undefined]; + cliAddedItems.set(current[name], index + 1); + return { object: current[name], property: index, value: undefined }; + } else if (!Array.isArray(value)) { + current[name] = [value, ...Array.from({ length: index }), undefined]; + cliAddedItems.set(current[name], index + 1); + return { object: current[name], property: index + 1, value: undefined }; + } else { + let addedItems = cliAddedItems.get(value) || 0; + while (addedItems <= index) { + value.push(undefined); + addedItems++; + } + cliAddedItems.set(value, addedItems); + const x = value.length - addedItems + index; + if (value[x] === undefined) { + value[x] = {}; + } else if (value[x] === null || typeof value[x] !== "object") { + return { + problem: { + type: "unexpected-non-object-in-path", + path: schemaPath + } + }; + } + return { + object: value, + property: x, + value: value[x] + }; + } + } + return { object: current, property, value }; +}; +/** + * @param {any} config configuration + * @param {string} schemaPath path in the config + * @param {any} value parsed value + * @param {number | undefined} index index of value when multiple values are provided, otherwise undefined + * @returns {LocalProblem | null} problem or null for success + */ +const setValue = (config, schemaPath, value, index) => { + const { problem, object, property } = getObjectAndProperty( + config, + schemaPath, + index + ); + if (problem) return problem; + object[property] = value; + return null; +}; +/** + * @param {ArgumentConfig} argConfig processing instructions + * @param {any} config configuration + * @param {any} value the value + * @param {number | undefined} index the index if multiple values provided + * @returns {LocalProblem | null} a problem if any + */ +const processArgumentConfig = (argConfig, config, value, index) => { + if (index !== undefined && !argConfig.multiple) { + return { + type: "multiple-values-unexpected", + path: argConfig.path + }; + } + const parsed = parseValueForArgumentConfig(argConfig, value); + if (parsed === undefined) { + return { + type: "invalid-value", + path: argConfig.path, + expected: getExpectedValue(argConfig) + }; + } + const problem = setValue(config, argConfig.path, parsed, index); + if (problem) return problem; + return null; +}; -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); +/** + * @param {ArgumentConfig} argConfig processing instructions + * @returns {string | undefined} expected message + */ +const getExpectedValue = argConfig => { + switch (argConfig.type) { + default: + return argConfig.type; + case "boolean": + return "true | false"; + case "RegExp": + return "regular expression (example: /ab?c*/)"; + case "enum": + return argConfig.values.map(v => `${v}`).join(" | "); + case "reset": + return "true (will reset the previous value to an empty array)"; + } +}; -class CriticalDependencyWarning extends WebpackError { - constructor(message) { - super(); +/** + * @param {ArgumentConfig} argConfig processing instructions + * @param {any} value the value + * @returns {any | undefined} parsed value + */ +const parseValueForArgumentConfig = (argConfig, value) => { + switch (argConfig.type) { + case "string": + if (typeof value === "string") { + return value; + } + break; + case "path": + if (typeof value === "string") { + return path.resolve(value); + } + break; + case "number": + if (typeof value === "number") return value; + if (typeof value === "string" && /^[+-]?\d*(\.\d*)[eE]\d+$/) { + const n = +value; + if (!isNaN(n)) return n; + } + break; + case "boolean": + if (typeof value === "boolean") return value; + if (value === "true") return true; + if (value === "false") return false; + break; + case "RegExp": + if (value instanceof RegExp) return value; + if (typeof value === "string") { + // cspell:word yugi + const match = /^\/(.*)\/([yugi]*)$/.exec(value); + if (match && !/[^\\]\//.test(match[1])) + return new RegExp(match[1], match[2]); + } + break; + case "enum": + if (argConfig.values.includes(value)) return value; + for (const item of argConfig.values) { + if (`${item}` === value) return item; + } + break; + case "reset": + if (value === true) return []; + break; + } +}; - this.name = "CriticalDependencyWarning"; - this.message = "Critical dependency: " + message; +/** + * @param {Record} args object of arguments + * @param {any} config configuration + * @param {Record} values object with values + * @returns {Problem[] | null} problems or null for success + */ +const processArguments = (args, config, values) => { + /** @type {Problem[]} */ + const problems = []; + for (const key of Object.keys(values)) { + const arg = args[key]; + if (!arg) { + problems.push({ + type: "unknown-argument", + path: "", + argument: key + }); + continue; + } + const processValue = (value, i) => { + const currentProblems = []; + for (const argConfig of arg.configs) { + const problem = processArgumentConfig(argConfig, config, value, i); + if (!problem) { + return; + } + currentProblems.push({ + ...problem, + argument: key, + value: value, + index: i + }); + } + problems.push(...currentProblems); + }; + let value = values[key]; + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + processValue(value[i], i); + } + } else { + processValue(value, undefined); + } } -} - -makeSerializable( - CriticalDependencyWarning, - "webpack/lib/dependencies/CriticalDependencyWarning" -); + if (problems.length === 0) return null; + return problems; +}; -module.exports = CriticalDependencyWarning; +exports.getArguments = getArguments; +exports.processArguments = processArguments; /***/ }), -/***/ 76760: +/***/ 43950: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Sergey Melyukov @smelukov */ -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); +const browserslist = __webpack_require__(14907); +const path = __webpack_require__(71017); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("./target").ApiTargetProperties} ApiTargetProperties */ +/** @typedef {import("./target").EcmaTargetProperties} EcmaTargetProperties */ +/** @typedef {import("./target").PlatformTargetProperties} PlatformTargetProperties */ -class CssExportDependency extends NullDependency { - /** - * @param {string} name name - * @param {string} value value - */ - constructor(name, value) { - super(); - this.name = name; - this.value = value; - } +// [[C:]/path/to/config][:env] +const inputRx = /^(?:((?:[A-Z]:)?[/\\].*?))?(?::(.+?))?$/i; - get type() { - return "css :export"; - } +/** + * @typedef {Object} BrowserslistHandlerConfig + * @property {string=} configPath + * @property {string=} env + * @property {string=} query + */ - /** - * Returns the exported names - * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names - */ - getExports(moduleGraph) { - const name = this.name; - return { - exports: [ - { - name, - canMangle: true - } - ], - dependencies: undefined - }; +/** + * @param {string} input input string + * @param {string} context the context directory + * @returns {BrowserslistHandlerConfig} config + */ +const parse = (input, context) => { + if (!input) { + return {}; } - serialize(context) { - const { write } = context; - write(this.name); - write(this.value); - super.serialize(context); + if (path.isAbsolute(input)) { + const [, configPath, env] = inputRx.exec(input) || []; + return { configPath, env }; } - deserialize(context) { - const { read } = context; - this.name = read(); - this.value = read(); - super.deserialize(context); + const config = browserslist.findConfig(context); + + if (config && Object.keys(config).includes(input)) { + return { env: input }; } -} -CssExportDependency.Template = class CssExportDependencyTemplate extends ( - NullDependency.Template -) { + return { query: input }; +}; + +/** + * @param {string} input input string + * @param {string} context the context directory + * @returns {string[] | undefined} selected browsers + */ +const load = (input, context) => { + const { configPath, env, query } = parse(input, context); + + // if a query is specified, then use it, else + // if a path to a config is specified then load it, else + // find a nearest config + const config = query + ? query + : configPath + ? browserslist.loadConfig({ + config: configPath, + env + }) + : browserslist.loadConfig({ path: context, env }); + + if (!config) return null; + return browserslist(config); +}; + +/** + * @param {string[]} browsers supported browsers list + * @returns {EcmaTargetProperties & PlatformTargetProperties & ApiTargetProperties} target properties + */ +const resolve = browsers => { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} + * Checks all against a version number + * @param {Record} versions first supported version + * @returns {boolean} true if supports */ - apply(dependency, source, { cssExports }) { - const dep = /** @type {CssExportDependency} */ (dependency); - cssExports.set(dep.name, dep.value); - } -}; + const rawChecker = versions => { + return browsers.every(v => { + const [name, parsedVersion] = v.split(" "); + if (!name) return false; + const requiredVersion = versions[name]; + if (!requiredVersion) return false; + const [parsedMajor, parserMinor] = + // safari TP supports all features for normal safari + parsedVersion === "TP" + ? [Infinity, Infinity] + : parsedVersion.split("."); + if (typeof requiredVersion === "number") { + return +parsedMajor >= requiredVersion; + } + return requiredVersion[0] === +parsedMajor + ? +parserMinor >= requiredVersion[1] + : +parsedMajor > requiredVersion[0]; + }); + }; + const anyNode = browsers.some(b => /^node /.test(b)); + const anyBrowser = browsers.some(b => /^(?!node)/.test(b)); + const browserProperty = !anyBrowser ? false : anyNode ? null : true; + const nodeProperty = !anyNode ? false : anyBrowser ? null : true; + // Internet Explorer Mobile, Blackberry browser and Opera Mini are very old browsers, they do not support new features + const es6DynamicImport = rawChecker({ + chrome: 63, + and_chr: 63, + edge: 79, + firefox: 67, + and_ff: 67, + // ie: Not supported + opera: 50, + op_mob: 46, + safari: [11, 1], + ios_saf: [11, 3], + samsung: [8, 2], + android: 63, + and_qq: [10, 4], + // baidu: Not supported + // and_uc: Not supported + // kaios: Not supported + // Since Node.js 13.14.0 no warning about usage, but it was added 8.5.0 with some limitations and it was improved in 12.0.0 and 13.2.0 + node: [13, 14] + }); -makeSerializable( - CssExportDependency, - "webpack/lib/dependencies/CssExportDependency" -); + return { + const: rawChecker({ + chrome: 49, + and_chr: 49, + edge: 12, + // Prior to Firefox 13, const is implemented, but re-assignment is not failing. + // Prior to Firefox 46, a TypeError was thrown on redeclaration instead of a SyntaxError. + firefox: 36, + and_ff: 36, + // Not supported in for-in and for-of loops + // ie: Not supported + opera: 36, + op_mob: 36, + safari: [10, 0], + ios_saf: [10, 0], + // Before 5.0 supported correctly in strict mode, otherwise supported without block scope + samsung: [5, 0], + android: 37, + and_qq: [10, 4], + // Supported correctly in strict mode, otherwise supported without block scope + // baidu: Not supported + and_uc: [12, 12], + kaios: [2, 5], + node: [6, 0] + }), + arrowFunction: rawChecker({ + chrome: 45, + and_chr: 45, + edge: 12, + // The initial implementation of arrow functions in Firefox made them automatically strict. This has been changed as of Firefox 24. The use of 'use strict'; is now required. + // Prior to Firefox 39, a line terminator (\\n) was incorrectly allowed after arrow function arguments. This has been fixed to conform to the ES2015 specification and code like () \\n => {} will now throw a SyntaxError in this and later versions. + firefox: 39, + and_ff: 39, + // ie: Not supported, + opera: 32, + op_mob: 32, + safari: 10, + ios_saf: 10, + samsung: [5, 0], + android: 45, + and_qq: [10, 4], + baidu: [7, 12], + and_uc: [12, 12], + kaios: [2, 5], + node: [6, 0] + }), + forOf: rawChecker({ + chrome: 38, + and_chr: 38, + edge: 12, + // Prior to Firefox 51, using the for...of loop construct with the const keyword threw a SyntaxError ("missing = in const declaration"). + firefox: 51, + and_ff: 51, + // ie: Not supported, + opera: 25, + op_mob: 25, + safari: 7, + ios_saf: 7, + samsung: [3, 0], + android: 38, + // and_qq: Unknown support + // baidu: Unknown support + // and_uc: Unknown support + // kaios: Unknown support + node: [0, 12] + }), + destructuring: rawChecker({ + chrome: 49, + and_chr: 49, + edge: 14, + firefox: 41, + and_ff: 41, + // ie: Not supported, + opera: 36, + op_mob: 36, + safari: 8, + ios_saf: 8, + samsung: [5, 0], + android: 49, + // and_qq: Unknown support + // baidu: Unknown support + // and_uc: Unknown support + // kaios: Unknown support + node: [6, 0] + }), + bigIntLiteral: rawChecker({ + chrome: 67, + and_chr: 67, + edge: 79, + firefox: 68, + and_ff: 68, + // ie: Not supported, + opera: 54, + op_mob: 48, + safari: 14, + ios_saf: 14, + samsung: [9, 2], + android: 67, + // and_qq: Not supported + // baidu: Not supported + // and_uc: Not supported + // kaios: Not supported + node: [10, 4] + }), + // Support syntax `import` and `export` and no limitations and bugs on Node.js + // Not include `export * as namespace` + module: rawChecker({ + chrome: 61, + and_chr: 61, + edge: 16, + firefox: 60, + and_ff: 60, + // ie: Not supported, + opera: 48, + op_mob: 45, + safari: [10, 1], + ios_saf: [10, 3], + samsung: [8, 0], + android: 61, + and_qq: [10, 4], + // baidu: Not supported + // and_uc: Not supported + // kaios: Not supported + // Since Node.js 13.14.0 no warning about usage, but it was added 8.5.0 with some limitations and it was improved in 12.0.0 and 13.2.0 + node: [13, 14] + }), + dynamicImport: es6DynamicImport, + dynamicImportInWorker: es6DynamicImport && !anyNode, + // browserslist does not have info about globalThis + // so this is based on mdn-browser-compat-data + globalThis: rawChecker({ + chrome: 71, + and_chr: 71, + edge: 79, + firefox: 65, + and_ff: 65, + // ie: Not supported, + opera: 58, + op_mob: 50, + safari: [12, 1], + ios_saf: [12, 2], + samsung: [10, 1], + android: 71, + // and_qq: Unknown support + // baidu: Unknown support + // and_uc: Unknown support + // kaios: Unknown support + node: [12, 0] + }), + optionalChaining: rawChecker({ + chrome: 80, + and_chr: 80, + edge: 80, + firefox: 74, + and_ff: 79, + // ie: Not supported, + opera: 67, + op_mob: 64, + safari: [13, 1], + ios_saf: [13, 4], + samsung: 13, + android: 80, + // and_qq: Not supported + // baidu: Not supported + // and_uc: Not supported + // kaios: Not supported + node: 14 + }), + templateLiteral: rawChecker({ + chrome: 41, + and_chr: 41, + edge: 13, + firefox: 34, + and_ff: 34, + // ie: Not supported, + opera: 29, + op_mob: 64, + safari: [9, 1], + ios_saf: 9, + samsung: 4, + android: 41, + and_qq: [10, 4], + baidu: [7, 12], + and_uc: [12, 12], + kaios: [2, 5], + node: 4 + }), + browser: browserProperty, + electron: false, + node: nodeProperty, + nwjs: false, + web: browserProperty, + webworker: false, -module.exports = CssExportDependency; + document: browserProperty, + fetchWasm: browserProperty, + global: nodeProperty, + importScripts: false, + importScriptsInWorker: true, + nodeBuiltins: nodeProperty, + require: nodeProperty + }; +}; + +module.exports = { + resolve, + load +}; /***/ }), -/***/ 90542: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 92988: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); +const fs = __webpack_require__(57147); +const path = __webpack_require__(71017); +const Template = __webpack_require__(39722); +const { cleverMerge } = __webpack_require__(60839); +const { + getTargetsProperties, + getTargetProperties, + getDefaultTarget +} = __webpack_require__(52801); + +/** @typedef {import("../../declarations/WebpackOptions").CacheOptionsNormalized} CacheOptions */ +/** @typedef {import("../../declarations/WebpackOptions").CssExperimentOptions} CssExperimentOptions */ +/** @typedef {import("../../declarations/WebpackOptions").EntryDescription} EntryDescription */ +/** @typedef {import("../../declarations/WebpackOptions").EntryNormalized} Entry */ +/** @typedef {import("../../declarations/WebpackOptions").Experiments} Experiments */ +/** @typedef {import("../../declarations/WebpackOptions").ExperimentsNormalized} ExperimentsNormalized */ +/** @typedef {import("../../declarations/WebpackOptions").ExternalsPresets} ExternalsPresets */ +/** @typedef {import("../../declarations/WebpackOptions").ExternalsType} ExternalsType */ +/** @typedef {import("../../declarations/WebpackOptions").InfrastructureLogging} InfrastructureLogging */ +/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ +/** @typedef {import("../../declarations/WebpackOptions").Library} Library */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryName} LibraryName */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").Loader} Loader */ +/** @typedef {import("../../declarations/WebpackOptions").Mode} Mode */ +/** @typedef {import("../../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */ +/** @typedef {import("../../declarations/WebpackOptions").Node} WebpackNode */ +/** @typedef {import("../../declarations/WebpackOptions").Optimization} Optimization */ +/** @typedef {import("../../declarations/WebpackOptions").OutputNormalized} Output */ +/** @typedef {import("../../declarations/WebpackOptions").Performance} Performance */ +/** @typedef {import("../../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ +/** @typedef {import("../../declarations/WebpackOptions").RuleSetRules} RuleSetRules */ +/** @typedef {import("../../declarations/WebpackOptions").SnapshotOptions} SnapshotOptions */ +/** @typedef {import("../../declarations/WebpackOptions").Target} Target */ +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./target").TargetProperties} TargetProperties */ + +const NODE_MODULES_REGEXP = /[\\/]node_modules[\\/]/i; + +/** + * Sets a constant default value when undefined + * @template T + * @template {keyof T} P + * @param {T} obj an object + * @param {P} prop a property of this object + * @param {T[P]} value a default value of the property + * @returns {void} + */ +const D = (obj, prop, value) => { + if (obj[prop] === undefined) { + obj[prop] = value; + } +}; + +/** + * Sets a dynamic default value when undefined, by calling the factory function + * @template T + * @template {keyof T} P + * @param {T} obj an object + * @param {P} prop a property of this object + * @param {function(): T[P]} factory a default value factory for the property + * @returns {void} + */ +const F = (obj, prop, factory) => { + if (obj[prop] === undefined) { + obj[prop] = factory(); + } +}; + +/** + * Sets a dynamic default value when undefined, by calling the factory function. + * factory must return an array or undefined + * When the current value is already an array an contains "..." it's replaced with + * the result of the factory function + * @template T + * @template {keyof T} P + * @param {T} obj an object + * @param {P} prop a property of this object + * @param {function(): T[P]} factory a default value factory for the property + * @returns {void} + */ +const A = (obj, prop, factory) => { + const value = obj[prop]; + if (value === undefined) { + obj[prop] = factory(); + } else if (Array.isArray(value)) { + /** @type {any[]} */ + let newArray = undefined; + for (let i = 0; i < value.length; i++) { + const item = value[i]; + if (item === "...") { + if (newArray === undefined) { + newArray = value.slice(0, i); + obj[prop] = /** @type {T[P]} */ (/** @type {unknown} */ (newArray)); + } + const items = /** @type {any[]} */ (/** @type {unknown} */ (factory())); + if (items !== undefined) { + for (const item of items) { + newArray.push(item); + } + } + } else if (newArray !== undefined) { + newArray.push(item); + } + } + } +}; + +/** + * @param {WebpackOptions} options options to be modified + * @returns {void} + */ +const applyWebpackOptionsBaseDefaults = options => { + F(options, "context", () => process.cwd()); + applyInfrastructureLoggingDefaults(options.infrastructureLogging); +}; + +/** + * @param {WebpackOptions} options options to be modified + * @returns {void} + */ +const applyWebpackOptionsDefaults = options => { + F(options, "context", () => process.cwd()); + F(options, "target", () => { + return getDefaultTarget(options.context); + }); + + const { mode, name, target } = options; -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + let targetProperties = + target === false + ? /** @type {false} */ (false) + : typeof target === "string" + ? getTargetProperties(target, options.context) + : getTargetsProperties(target, options.context); -class CssImportDependency extends ModuleDependency { - /** - * @param {string} request request - * @param {[number, number]} range range of the argument - * @param {string | undefined} supports list of supports conditions - * @param {string | undefined} media list of media conditions - */ - constructor(request, range, supports, media) { - super(request); - this.range = range; - this.supports = supports; - this.media = media; - } + const development = mode === "development"; + const production = mode === "production" || !mode; - get type() { - return "css @import"; + if (typeof options.entry !== "function") { + for (const key of Object.keys(options.entry)) { + F( + options.entry[key], + "import", + () => /** @type {[string]} */ (["./src"]) + ); + } } - get category() { - return "css-import"; - } + F(options, "devtool", () => (development ? "eval" : false)); + D(options, "watch", false); + D(options, "profile", false); + D(options, "parallelism", 100); + D(options, "recordsInputPath", false); + D(options, "recordsOutputPath", false); - /** - * @param {string} context context directory - * @returns {Module} a module - */ - createIgnoredModule(context) { - return null; - } -} + applyExperimentsDefaults(options.experiments, { + production, + development, + targetProperties + }); -CssImportDependency.Template = class CssImportDependencyTemplate extends ( - ModuleDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, templateContext) { - const dep = /** @type {CssImportDependency} */ (dependency); + const futureDefaults = options.experiments.futureDefaults; - source.replace(dep.range[0], dep.range[1] - 1, ""); - } -}; + F(options, "cache", () => + development ? { type: /** @type {"memory"} */ ("memory") } : false + ); + applyCacheDefaults(options.cache, { + name: name || "default", + mode: mode || "production", + development, + cacheUnaffected: options.experiments.cacheUnaffected + }); + const cache = !!options.cache; -makeSerializable( - CssImportDependency, - "webpack/lib/dependencies/CssImportDependency" -); + applySnapshotDefaults(options.snapshot, { + production, + futureDefaults + }); -module.exports = CssImportDependency; + applyModuleDefaults(options.module, { + cache, + syncWebAssembly: options.experiments.syncWebAssembly, + asyncWebAssembly: options.experiments.asyncWebAssembly, + css: options.experiments.css, + futureDefaults + }); + applyOutputDefaults(options.output, { + context: options.context, + targetProperties, + isAffectedByBrowserslist: + target === undefined || + (typeof target === "string" && target.startsWith("browserslist")) || + (Array.isArray(target) && + target.some(target => target.startsWith("browserslist"))), + outputModule: options.experiments.outputModule, + development, + entry: options.entry, + module: options.module, + futureDefaults + }); -/***/ }), + applyExternalsPresetsDefaults(options.externalsPresets, { + targetProperties, + buildHttp: !!options.experiments.buildHttp + }); -/***/ 92328: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + applyLoaderDefaults(options.loader, { targetProperties }); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ + F(options, "externalsType", () => { + const validExternalTypes = (__webpack_require__(73342).definitions.ExternalsType["enum"]); + return options.output.library && + validExternalTypes.includes(options.output.library.type) + ? /** @type {ExternalsType} */ (options.output.library.type) + : options.output.module + ? "module" + : "var"; + }); + applyNodeDefaults(options.node, { + futureDefaults: options.experiments.futureDefaults, + targetProperties + }); + F(options, "performance", () => + production && + targetProperties && + (targetProperties.browser || targetProperties.browser === null) + ? {} + : false + ); + applyPerformanceDefaults(options.performance, { + production + }); -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); + applyOptimizationDefaults(options.optimization, { + development, + production, + css: options.experiments.css, + records: !!(options.recordsInputPath || options.recordsOutputPath) + }); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ + options.resolve = cleverMerge( + getResolveDefaults({ + cache, + context: options.context, + targetProperties, + mode: options.mode + }), + options.resolve + ); -class CssLocalIdentifierDependency extends NullDependency { - /** - * @param {string} name name - * @param {[number, number]} range range - * @param {string=} prefix prefix - */ - constructor(name, range, prefix = "") { - super(); - this.name = name; - this.range = range; - this.prefix = prefix; - } + options.resolveLoader = cleverMerge( + getResolveLoaderDefaults({ cache }), + options.resolveLoader + ); +}; - get type() { - return "css local identifier"; - } +/** + * @param {ExperimentsNormalized} experiments options + * @param {Object} options options + * @param {boolean} options.production is production + * @param {boolean} options.development is development mode + * @param {TargetProperties | false} options.targetProperties target properties + * @returns {void} + */ +const applyExperimentsDefaults = ( + experiments, + { production, development, targetProperties } +) => { + D(experiments, "futureDefaults", false); + D(experiments, "backCompat", !experiments.futureDefaults); + D(experiments, "topLevelAwait", experiments.futureDefaults); + D(experiments, "syncWebAssembly", false); + D(experiments, "asyncWebAssembly", experiments.futureDefaults); + D(experiments, "outputModule", false); + D(experiments, "layers", false); + D(experiments, "lazyCompilation", undefined); + D(experiments, "buildHttp", undefined); + D(experiments, "cacheUnaffected", experiments.futureDefaults); + F(experiments, "css", () => (experiments.futureDefaults ? {} : undefined)); - /** - * Returns the exported names - * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names - */ - getExports(moduleGraph) { - const name = this.name; - return { - exports: [ - { - name, - canMangle: true - } - ], - dependencies: undefined - }; + if (typeof experiments.buildHttp === "object") { + D(experiments.buildHttp, "frozen", production); + D(experiments.buildHttp, "upgrade", false); } - serialize(context) { - const { write } = context; - write(this.name); - write(this.range); - write(this.prefix); - super.serialize(context); + if (typeof experiments.css === "object") { + D( + experiments.css, + "exportsOnly", + !targetProperties || !targetProperties.document + ); } +}; - deserialize(context) { - const { read } = context; - this.name = read(); - this.range = read(); - this.prefix = read(); - super.deserialize(context); +/** + * @param {CacheOptions} cache options + * @param {Object} options options + * @param {string} options.name name + * @param {string} options.mode mode + * @param {boolean} options.development is development mode + * @param {boolean} options.cacheUnaffected the cacheUnaffected experiment is enabled + * @returns {void} + */ +const applyCacheDefaults = ( + cache, + { name, mode, development, cacheUnaffected } +) => { + if (cache === false) return; + switch (cache.type) { + case "filesystem": + F(cache, "name", () => name + "-" + mode); + D(cache, "version", ""); + F(cache, "cacheDirectory", () => { + const cwd = process.cwd(); + let dir = cwd; + for (;;) { + try { + if (fs.statSync(path.join(dir, "package.json")).isFile()) break; + // eslint-disable-next-line no-empty + } catch (e) {} + const parent = path.dirname(dir); + if (dir === parent) { + dir = undefined; + break; + } + dir = parent; + } + if (!dir) { + return path.resolve(cwd, ".cache/webpack"); + } else if (process.versions.pnp === "1") { + return path.resolve(dir, ".pnp/.cache/webpack"); + } else if (process.versions.pnp === "3") { + return path.resolve(dir, ".yarn/.cache/webpack"); + } else { + return path.resolve(dir, "node_modules/.cache/webpack"); + } + }); + F(cache, "cacheLocation", () => + path.resolve(cache.cacheDirectory, cache.name) + ); + D(cache, "hashAlgorithm", "md4"); + D(cache, "store", "pack"); + D(cache, "compression", false); + D(cache, "profile", false); + D(cache, "idleTimeout", 60000); + D(cache, "idleTimeoutForInitialStore", 5000); + D(cache, "idleTimeoutAfterLargeChanges", 1000); + D(cache, "maxMemoryGenerations", development ? 5 : Infinity); + D(cache, "maxAge", 1000 * 60 * 60 * 24 * 60); // 1 month + D(cache, "allowCollectingMemory", development); + D(cache, "memoryCacheUnaffected", development && cacheUnaffected); + D(cache.buildDependencies, "defaultWebpack", [ + path.resolve(__dirname, "..") + path.sep + ]); + break; + case "memory": + D(cache, "maxGenerations", Infinity); + D(cache, "cacheUnaffected", development && cacheUnaffected); + break; } -} - -const escapeCssIdentifier = (str, omitUnderscore) => { - const escaped = `${str}`.replace( - // cspell:word uffff - /[^a-zA-Z0-9_\u0081-\uffff-]/g, - s => `\\${s}` - ); - return !omitUnderscore && /^(?!--)[0-9-]/.test(escaped) - ? `_${escaped}` - : escaped; }; -CssLocalIdentifierDependency.Template = class CssLocalIdentifierDependencyTemplate extends ( - NullDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply( - dependency, - source, - { module, moduleGraph, chunkGraph, runtime, runtimeTemplate, cssExports } - ) { - const dep = /** @type {CssLocalIdentifierDependency} */ (dependency); - const used = moduleGraph - .getExportInfo(module, dep.name) - .getUsedName(dep.name, runtime); - const moduleId = chunkGraph.getModuleId(module); - const identifier = - dep.prefix + - (runtimeTemplate.outputOptions.uniqueName - ? runtimeTemplate.outputOptions.uniqueName + "-" - : "") + - (used ? moduleId + "-" + used : "-"); - source.replace( - dep.range[0], - dep.range[1] - 1, - escapeCssIdentifier(identifier, dep.prefix) +/** + * @param {SnapshotOptions} snapshot options + * @param {Object} options options + * @param {boolean} options.production is production + * @param {boolean} options.futureDefaults is future defaults enabled + * @returns {void} + */ +const applySnapshotDefaults = (snapshot, { production, futureDefaults }) => { + if (futureDefaults) { + F(snapshot, "managedPaths", () => + process.versions.pnp === "3" + ? [ + /^(.+?(?:[\\/]\.yarn[\\/]unplugged[\\/][^\\/]+)?[\\/]node_modules[\\/])/ + ] + : [/^(.+?[\\/]node_modules[\\/])/] ); - if (used) cssExports.set(used, identifier); + F(snapshot, "immutablePaths", () => + process.versions.pnp === "3" + ? [/^(.+?[\\/]cache[\\/][^\\/]+\.zip[\\/]node_modules[\\/])/] + : [] + ); + } else { + A(snapshot, "managedPaths", () => { + if (process.versions.pnp === "3") { + const match = + /^(.+?)[\\/]cache[\\/]watchpack-npm-[^\\/]+\.zip[\\/]node_modules[\\/]/.exec( + /*require.resolve*/(36871) + ); + if (match) { + return [path.resolve(match[1], "unplugged")]; + } + } else { + const match = /^(.+?[\\/]node_modules[\\/])/.exec( + // eslint-disable-next-line node/no-extraneous-require + /*require.resolve*/(36871) + ); + if (match) { + return [match[1]]; + } + } + return []; + }); + A(snapshot, "immutablePaths", () => { + if (process.versions.pnp === "1") { + const match = + /^(.+?[\\/]v4)[\\/]npm-watchpack-[^\\/]+-[\da-f]{40}[\\/]node_modules[\\/]/.exec( + /*require.resolve*/(36871) + ); + if (match) { + return [match[1]]; + } + } else if (process.versions.pnp === "3") { + const match = + /^(.+?)[\\/]watchpack-npm-[^\\/]+\.zip[\\/]node_modules[\\/]/.exec( + /*require.resolve*/(36871) + ); + if (match) { + return [match[1]]; + } + } + return []; + }); } + F(snapshot, "resolveBuildDependencies", () => ({ + timestamp: true, + hash: true + })); + F(snapshot, "buildDependencies", () => ({ timestamp: true, hash: true })); + F(snapshot, "module", () => + production ? { timestamp: true, hash: true } : { timestamp: true } + ); + F(snapshot, "resolve", () => + production ? { timestamp: true, hash: true } : { timestamp: true } + ); }; -makeSerializable( - CssLocalIdentifierDependency, - "webpack/lib/dependencies/CssLocalIdentifierDependency" -); - -module.exports = CssLocalIdentifierDependency; - - -/***/ }), - -/***/ 29094: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ - - - -const Dependency = __webpack_require__(54912); -const makeSerializable = __webpack_require__(33032); -const CssLocalIdentifierDependency = __webpack_require__(92328); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - -class CssSelfLocalIdentifierDependency extends CssLocalIdentifierDependency { - /** - * @param {string} name name - * @param {[number, number]} range range - * @param {string=} prefix prefix - * @param {Set=} declaredSet set of declared names (will only be active when in declared set) - */ - constructor(name, range, prefix = "", declaredSet = undefined) { - super(name, range, prefix); - this.declaredSet = declaredSet; - } - - get type() { - return "css self local identifier"; - } +/** + * @param {JavascriptParserOptions} parserOptions parser options + * @param {Object} options options + * @param {boolean} options.futureDefaults is future defaults enabled + * @returns {void} + */ +const applyJavascriptParserOptionsDefaults = ( + parserOptions, + { futureDefaults } +) => { + D(parserOptions, "unknownContextRequest", "."); + D(parserOptions, "unknownContextRegExp", false); + D(parserOptions, "unknownContextRecursive", true); + D(parserOptions, "unknownContextCritical", true); + D(parserOptions, "exprContextRequest", "."); + D(parserOptions, "exprContextRegExp", false); + D(parserOptions, "exprContextRecursive", true); + D(parserOptions, "exprContextCritical", true); + D(parserOptions, "wrappedContextRegExp", /.*/); + D(parserOptions, "wrappedContextRecursive", true); + D(parserOptions, "wrappedContextCritical", false); + D(parserOptions, "strictThisContextOnImports", false); + D(parserOptions, "importMeta", true); + if (futureDefaults) D(parserOptions, "exportsPresence", "error"); +}; - get category() { - return "self"; +/** + * @param {ModuleOptions} module options + * @param {Object} options options + * @param {boolean} options.cache is caching enabled + * @param {boolean} options.syncWebAssembly is syncWebAssembly enabled + * @param {boolean} options.asyncWebAssembly is asyncWebAssembly enabled + * @param {CssExperimentOptions} options.css is css enabled + * @param {boolean} options.futureDefaults is future defaults enabled + * @returns {void} + */ +const applyModuleDefaults = ( + module, + { cache, syncWebAssembly, asyncWebAssembly, css, futureDefaults } +) => { + if (cache) { + D(module, "unsafeCache", module => { + const name = module.nameForCondition(); + return name && NODE_MODULES_REGEXP.test(name); + }); + } else { + D(module, "unsafeCache", false); } - /** - * @returns {string | null} an identifier to merge equal requests - */ - getResourceIdentifier() { - return `self`; - } - /** - * Returns the exported names - * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names - */ - getExports(moduleGraph) { - if (this.declaredSet && !this.declaredSet.has(this.name)) return; - return super.getExports(moduleGraph); + F(module.parser, "asset", () => ({})); + F(module.parser.asset, "dataUrlCondition", () => ({})); + if (typeof module.parser.asset.dataUrlCondition === "object") { + D(module.parser.asset.dataUrlCondition, "maxSize", 8096); } - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - if (this.declaredSet && !this.declaredSet.has(this.name)) - return Dependency.NO_EXPORTS_REFERENCED; - return [[this.name]]; - } + F(module.parser, "javascript", () => ({})); + applyJavascriptParserOptionsDefaults(module.parser.javascript, { + futureDefaults + }); - serialize(context) { - const { write } = context; - write(this.declaredSet); - super.serialize(context); - } + A(module, "defaultRules", () => { + const esm = { + type: "javascript/esm", + resolve: { + byDependency: { + esm: { + fullySpecified: true + } + } + } + }; + const commonjs = { + type: "javascript/dynamic" + }; + /** @type {RuleSetRules} */ + const rules = [ + { + mimetype: "application/node", + type: "javascript/auto" + }, + { + test: /\.json$/i, + type: "json" + }, + { + mimetype: "application/json", + type: "json" + }, + { + test: /\.mjs$/i, + ...esm + }, + { + test: /\.js$/i, + descriptionData: { + type: "module" + }, + ...esm + }, + { + test: /\.cjs$/i, + ...commonjs + }, + { + test: /\.js$/i, + descriptionData: { + type: "commonjs" + }, + ...commonjs + }, + { + mimetype: { + or: ["text/javascript", "application/javascript"] + }, + ...esm + } + ]; + if (asyncWebAssembly) { + const wasm = { + type: "webassembly/async", + rules: [ + { + descriptionData: { + type: "module" + }, + resolve: { + fullySpecified: true + } + } + ] + }; + rules.push({ + test: /\.wasm$/i, + ...wasm + }); + rules.push({ + mimetype: "application/wasm", + ...wasm + }); + } else if (syncWebAssembly) { + const wasm = { + type: "webassembly/sync", + rules: [ + { + descriptionData: { + type: "module" + }, + resolve: { + fullySpecified: true + } + } + ] + }; + rules.push({ + test: /\.wasm$/i, + ...wasm + }); + rules.push({ + mimetype: "application/wasm", + ...wasm + }); + } + if (css) { + const cssRule = { + type: "css", + resolve: { + fullySpecified: true, + preferRelative: true + } + }; + const cssModulesRule = { + type: "css/module", + resolve: { + fullySpecified: true + } + }; + rules.push({ + test: /\.css$/i, + oneOf: [ + { + test: /\.module\.css$/i, + ...cssModulesRule + }, + { + ...cssRule + } + ] + }); + rules.push({ + mimetype: "text/css+module", + ...cssModulesRule + }); + rules.push({ + mimetype: "text/css", + ...cssRule + }); + } + rules.push( + { + dependency: "url", + oneOf: [ + { + scheme: /^data$/, + type: "asset/inline" + }, + { + type: "asset/resource" + } + ] + }, + { + assert: { type: "json" }, + type: "json" + } + ); + return rules; + }); +}; - deserialize(context) { - const { read } = context; - this.declaredSet = read(); - super.deserialize(context); +/** + * @param {Output} output options + * @param {Object} options options + * @param {string} options.context context + * @param {TargetProperties | false} options.targetProperties target properties + * @param {boolean} options.isAffectedByBrowserslist is affected by browserslist + * @param {boolean} options.outputModule is outputModule experiment enabled + * @param {boolean} options.development is development mode + * @param {Entry} options.entry entry option + * @param {ModuleOptions} options.module module option + * @param {boolean} options.futureDefaults is future defaults enabled + * @returns {void} + */ +const applyOutputDefaults = ( + output, + { + context, + targetProperties: tp, + isAffectedByBrowserslist, + outputModule, + development, + entry, + module, + futureDefaults } -} - -CssSelfLocalIdentifierDependency.Template = class CssSelfLocalIdentifierDependencyTemplate extends ( - CssLocalIdentifierDependency.Template -) { +) => { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} + * @param {Library=} library the library option + * @returns {string} a readable library name */ - apply(dependency, source, templateContext) { - const dep = /** @type {CssSelfLocalIdentifierDependency} */ (dependency); - if (dep.declaredSet && !dep.declaredSet.has(dep.name)) return; - super.apply(dependency, source, templateContext); - } -}; - -makeSerializable( - CssSelfLocalIdentifierDependency, - "webpack/lib/dependencies/CssSelfLocalIdentifierDependency" -); - -module.exports = CssSelfLocalIdentifierDependency; - - -/***/ }), - -/***/ 70749: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ - - - -const makeSerializable = __webpack_require__(33032); -const memoize = __webpack_require__(78676); -const ModuleDependency = __webpack_require__(80321); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + const getLibraryName = library => { + const libraryName = + typeof library === "object" && + library && + !Array.isArray(library) && + "type" in library + ? library.name + : /** @type {LibraryName=} */ (library); + if (Array.isArray(libraryName)) { + return libraryName.join("."); + } else if (typeof libraryName === "object") { + return getLibraryName(libraryName.root); + } else if (typeof libraryName === "string") { + return libraryName; + } + return ""; + }; -const getRawDataUrlModule = memoize(() => __webpack_require__(19684)); + F(output, "uniqueName", () => { + const libraryName = getLibraryName(output.library); + if (libraryName) return libraryName; + const pkgPath = path.resolve(context, "package.json"); + try { + const packageInfo = JSON.parse(fs.readFileSync(pkgPath, "utf-8")); + return packageInfo.name || ""; + } catch (e) { + if (e.code !== "ENOENT") { + e.message += `\nwhile determining default 'output.uniqueName' from 'name' in ${pkgPath}`; + throw e; + } + return ""; + } + }); -class CssUrlDependency extends ModuleDependency { - /** - * @param {string} request request - * @param {[number, number]} range range of the argument - * @param {string} cssFunctionKind kind of css function, e. g. url(), image() - */ - constructor(request, range, cssFunctionKind) { - super(request); - this.range = range; - this.cssFunctionKind = cssFunctionKind; + F(output, "module", () => !!outputModule); + D(output, "filename", output.module ? "[name].mjs" : "[name].js"); + F(output, "iife", () => !output.module); + D(output, "importFunctionName", "import"); + D(output, "importMetaName", "import.meta"); + F(output, "chunkFilename", () => { + const filename = output.filename; + if (typeof filename !== "function") { + const hasName = filename.includes("[name]"); + const hasId = filename.includes("[id]"); + const hasChunkHash = filename.includes("[chunkhash]"); + const hasContentHash = filename.includes("[contenthash]"); + // Anything changing depending on chunk is fine + if (hasChunkHash || hasContentHash || hasName || hasId) return filename; + // Otherwise prefix "[id]." in front of the basename to make it changing + return filename.replace(/(^|\/)([^/]*(?:\?|$))/, "$1[id].$2"); + } + return output.module ? "[id].mjs" : "[id].js"; + }); + F(output, "cssFilename", () => { + const filename = output.filename; + if (typeof filename !== "function") { + return filename.replace(/\.[mc]?js(\?|$)/, ".css$1"); + } + return "[id].css"; + }); + F(output, "cssChunkFilename", () => { + const chunkFilename = output.chunkFilename; + if (typeof chunkFilename !== "function") { + return chunkFilename.replace(/\.[mc]?js(\?|$)/, ".css$1"); + } + return "[id].css"; + }); + D(output, "assetModuleFilename", "[hash][ext][query]"); + D(output, "webassemblyModuleFilename", "[hash].module.wasm"); + D(output, "compareBeforeEmit", true); + D(output, "charset", true); + F(output, "hotUpdateGlobal", () => + Template.toIdentifier( + "webpackHotUpdate" + Template.toIdentifier(output.uniqueName) + ) + ); + F(output, "chunkLoadingGlobal", () => + Template.toIdentifier( + "webpackChunk" + Template.toIdentifier(output.uniqueName) + ) + ); + F(output, "globalObject", () => { + if (tp) { + if (tp.global) return "global"; + if (tp.globalThis) return "globalThis"; + } + return "self"; + }); + F(output, "chunkFormat", () => { + if (tp) { + const helpMessage = isAffectedByBrowserslist + ? "Make sure that your 'browserslist' includes only platforms that support these features or select an appropriate 'target' to allow selecting a chunk format by default. Alternatively specify the 'output.chunkFormat' directly." + : "Select an appropriate 'target' to allow selecting one by default, or specify the 'output.chunkFormat' directly."; + if (output.module) { + if (tp.dynamicImport) return "module"; + if (tp.document) return "array-push"; + throw new Error( + "For the selected environment is no default ESM chunk format available:\n" + + "ESM exports can be chosen when 'import()' is available.\n" + + "JSONP Array push can be chosen when 'document' is available.\n" + + helpMessage + ); + } else { + if (tp.document) return "array-push"; + if (tp.require) return "commonjs"; + if (tp.nodeBuiltins) return "commonjs"; + if (tp.importScripts) return "array-push"; + throw new Error( + "For the selected environment is no default script chunk format available:\n" + + "JSONP Array push can be chosen when 'document' or 'importScripts' is available.\n" + + "CommonJs exports can be chosen when 'require' or node builtins are available.\n" + + helpMessage + ); + } + } + throw new Error( + "Chunk format can't be selected by default when no target is specified" + ); + }); + D(output, "asyncChunks", true); + F(output, "chunkLoading", () => { + if (tp) { + switch (output.chunkFormat) { + case "array-push": + if (tp.document) return "jsonp"; + if (tp.importScripts) return "import-scripts"; + break; + case "commonjs": + if (tp.require) return "require"; + if (tp.nodeBuiltins) return "async-node"; + break; + case "module": + if (tp.dynamicImport) return "import"; + break; + } + if ( + tp.require === null || + tp.nodeBuiltins === null || + tp.document === null || + tp.importScripts === null + ) { + return "universal"; + } + } + return false; + }); + F(output, "workerChunkLoading", () => { + if (tp) { + switch (output.chunkFormat) { + case "array-push": + if (tp.importScriptsInWorker) return "import-scripts"; + break; + case "commonjs": + if (tp.require) return "require"; + if (tp.nodeBuiltins) return "async-node"; + break; + case "module": + if (tp.dynamicImportInWorker) return "import"; + break; + } + if ( + tp.require === null || + tp.nodeBuiltins === null || + tp.importScriptsInWorker === null + ) { + return "universal"; + } + } + return false; + }); + F(output, "wasmLoading", () => { + if (tp) { + if (tp.fetchWasm) return "fetch"; + if (tp.nodeBuiltins) + return output.module ? "async-node-module" : "async-node"; + if (tp.nodeBuiltins === null || tp.fetchWasm === null) { + return "universal"; + } + } + return false; + }); + F(output, "workerWasmLoading", () => output.wasmLoading); + F(output, "devtoolNamespace", () => output.uniqueName); + if (output.library) { + F(output.library, "type", () => (output.module ? "module" : "var")); } + F(output, "path", () => path.join(process.cwd(), "dist")); + F(output, "pathinfo", () => development); + D(output, "sourceMapFilename", "[file].map[query]"); + D( + output, + "hotUpdateChunkFilename", + `[id].[fullhash].hot-update.${output.module ? "mjs" : "js"}` + ); + D(output, "hotUpdateMainFilename", "[runtime].[fullhash].hot-update.json"); + D(output, "crossOriginLoading", false); + F(output, "scriptType", () => (output.module ? "module" : false)); + D( + output, + "publicPath", + (tp && (tp.document || tp.importScripts)) || output.scriptType === "module" + ? "auto" + : "" + ); + D(output, "chunkLoadTimeout", 120000); + D(output, "hashFunction", futureDefaults ? "xxhash64" : "md4"); + D(output, "hashDigest", "hex"); + D(output, "hashDigestLength", futureDefaults ? 16 : 20); + D(output, "strictModuleExceptionHandling", false); - get type() { - return "css url()"; - } + const optimistic = v => v || v === undefined; + const conditionallyOptimistic = (v, c) => (v === undefined && c) || v; + F( + output.environment, + "arrowFunction", + () => tp && optimistic(tp.arrowFunction) + ); + F(output.environment, "const", () => tp && optimistic(tp.const)); + F( + output.environment, + "destructuring", + () => tp && optimistic(tp.destructuring) + ); + F(output.environment, "forOf", () => tp && optimistic(tp.forOf)); + F(output.environment, "bigIntLiteral", () => tp && tp.bigIntLiteral); + F(output.environment, "dynamicImport", () => + conditionallyOptimistic(tp && tp.dynamicImport, output.module) + ); + F(output.environment, "module", () => + conditionallyOptimistic(tp && tp.module, output.module) + ); - get category() { - return "url"; + const { trustedTypes } = output; + if (trustedTypes) { + F( + trustedTypes, + "policyName", + () => + output.uniqueName.replace(/[^a-zA-Z0-9\-#=_/@.%]+/g, "_") || "webpack" + ); } /** - * @param {string} context context directory - * @returns {Module} a module + * @param {function(EntryDescription): void} fn iterator + * @returns {void} */ - createIgnoredModule(context) { - const RawDataUrlModule = getRawDataUrlModule(); - return new RawDataUrlModule("data:,", `ignored-asset`, `(ignored asset)`); - } - - serialize(context) { - const { write } = context; - write(this.cssFunctionKind); - super.serialize(context); - } + const forEachEntry = fn => { + for (const name of Object.keys(entry)) { + fn(entry[name]); + } + }; + A(output, "enabledLibraryTypes", () => { + const enabledLibraryTypes = []; + if (output.library) { + enabledLibraryTypes.push(output.library.type); + } + forEachEntry(desc => { + if (desc.library) { + enabledLibraryTypes.push(desc.library.type); + } + }); + return enabledLibraryTypes; + }); - deserialize(context) { - const { read } = context; - this.cssFunctionKind = read(); - super.deserialize(context); - } -} + A(output, "enabledChunkLoadingTypes", () => { + const enabledChunkLoadingTypes = new Set(); + if (output.chunkLoading) { + enabledChunkLoadingTypes.add(output.chunkLoading); + } + if (output.workerChunkLoading) { + enabledChunkLoadingTypes.add(output.workerChunkLoading); + } + forEachEntry(desc => { + if (desc.chunkLoading) { + enabledChunkLoadingTypes.add(desc.chunkLoading); + } + }); + return Array.from(enabledChunkLoadingTypes); + }); -const cssEscapeString = str => { - let countWhiteOrBracket = 0; - let countQuotation = 0; - let countApostrophe = 0; - for (let i = 0; i < str.length; i++) { - const cc = str.charCodeAt(i); - switch (cc) { - case 9: // tab - case 10: // nl - case 32: // space - case 40: // ( - case 41: // ) - countWhiteOrBracket++; - break; - case 34: - countQuotation++; - break; - case 39: - countApostrophe++; - break; + A(output, "enabledWasmLoadingTypes", () => { + const enabledWasmLoadingTypes = new Set(); + if (output.wasmLoading) { + enabledWasmLoadingTypes.add(output.wasmLoading); } - } - if (countWhiteOrBracket < 2) { - return str.replace(/[\n\t ()'"\\]/g, m => `\\${m}`); - } else if (countQuotation <= countApostrophe) { - return `"${str.replace(/[\n"\\]/g, m => `\\${m}`)}"`; - } else { - return `'${str.replace(/[\n'\\]/g, m => `\\${m}`)}'`; - } + if (output.workerWasmLoading) { + enabledWasmLoadingTypes.add(output.workerWasmLoading); + } + forEachEntry(desc => { + if (desc.wasmLoading) { + enabledWasmLoadingTypes.add(desc.wasmLoading); + } + }); + return Array.from(enabledWasmLoadingTypes); + }); }; -CssUrlDependency.Template = class CssUrlDependencyTemplate extends ( - ModuleDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply( - dependency, - source, - { runtime, moduleGraph, runtimeTemplate, codeGenerationResults } - ) { - const dep = /** @type {CssUrlDependency} */ (dependency); - - source.replace( - dep.range[0], - dep.range[1] - 1, - `${dep.cssFunctionKind}(${cssEscapeString( - runtimeTemplate.assetUrl({ - publicPath: "", - runtime, - module: moduleGraph.getModule(dep), - codeGenerationResults - }) - )})` - ); - } +/** + * @param {ExternalsPresets} externalsPresets options + * @param {Object} options options + * @param {TargetProperties | false} options.targetProperties target properties + * @param {boolean} options.buildHttp buildHttp experiment enabled + * @returns {void} + */ +const applyExternalsPresetsDefaults = ( + externalsPresets, + { targetProperties, buildHttp } +) => { + D( + externalsPresets, + "web", + !buildHttp && targetProperties && targetProperties.web + ); + D(externalsPresets, "node", targetProperties && targetProperties.node); + D(externalsPresets, "nwjs", targetProperties && targetProperties.nwjs); + D( + externalsPresets, + "electron", + targetProperties && targetProperties.electron + ); + D( + externalsPresets, + "electronMain", + targetProperties && + targetProperties.electron && + targetProperties.electronMain + ); + D( + externalsPresets, + "electronPreload", + targetProperties && + targetProperties.electron && + targetProperties.electronPreload + ); + D( + externalsPresets, + "electronRenderer", + targetProperties && + targetProperties.electron && + targetProperties.electronRenderer + ); }; -makeSerializable(CssUrlDependency, "webpack/lib/dependencies/CssUrlDependency"); - -module.exports = CssUrlDependency; - - -/***/ }), - -/***/ 22914: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - +/** + * @param {Loader} loader options + * @param {Object} options options + * @param {TargetProperties | false} options.targetProperties target properties + * @returns {void} + */ +const applyLoaderDefaults = (loader, { targetProperties }) => { + F(loader, "target", () => { + if (targetProperties) { + if (targetProperties.electron) { + if (targetProperties.electronMain) return "electron-main"; + if (targetProperties.electronPreload) return "electron-preload"; + if (targetProperties.electronRenderer) return "electron-renderer"; + return "electron"; + } + if (targetProperties.nwjs) return "nwjs"; + if (targetProperties.node) return "node"; + if (targetProperties.web) return "web"; + } + }); +}; -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); +/** + * @param {WebpackNode} node options + * @param {Object} options options + * @param {TargetProperties | false} options.targetProperties target properties + * @param {boolean} options.futureDefaults is future defaults enabled + * @returns {void} + */ +const applyNodeDefaults = (node, { futureDefaults, targetProperties }) => { + if (node === false) return; -class DelegatedSourceDependency extends ModuleDependency { - constructor(request) { - super(request); - } + F(node, "global", () => { + if (targetProperties && targetProperties.global) return false; + // TODO webpack 6 should always default to false + return futureDefaults ? "warn" : true; + }); + F(node, "__filename", () => { + if (targetProperties && targetProperties.node) return "eval-only"; + // TODO webpack 6 should always default to false + return futureDefaults ? "warn-mock" : "mock"; + }); + F(node, "__dirname", () => { + if (targetProperties && targetProperties.node) return "eval-only"; + // TODO webpack 6 should always default to false + return futureDefaults ? "warn-mock" : "mock"; + }); +}; - get type() { - return "delegated source"; - } +/** + * @param {Performance} performance options + * @param {Object} options options + * @param {boolean} options.production is production + * @returns {void} + */ +const applyPerformanceDefaults = (performance, { production }) => { + if (performance === false) return; + D(performance, "maxAssetSize", 250000); + D(performance, "maxEntrypointSize", 250000); + F(performance, "hints", () => (production ? "warning" : false)); +}; - get category() { - return "esm"; +/** + * @param {Optimization} optimization options + * @param {Object} options options + * @param {boolean} options.production is production + * @param {boolean} options.development is development + * @param {CssExperimentOptions} options.css is css enabled + * @param {boolean} options.records using records + * @returns {void} + */ +const applyOptimizationDefaults = ( + optimization, + { production, development, css, records } +) => { + D(optimization, "removeAvailableModules", false); + D(optimization, "removeEmptyChunks", true); + D(optimization, "mergeDuplicateChunks", true); + D(optimization, "flagIncludedChunks", production); + F(optimization, "moduleIds", () => { + if (production) return "deterministic"; + if (development) return "named"; + return "natural"; + }); + F(optimization, "chunkIds", () => { + if (production) return "deterministic"; + if (development) return "named"; + return "natural"; + }); + F(optimization, "sideEffects", () => (production ? true : "flag")); + D(optimization, "providedExports", true); + D(optimization, "usedExports", production); + D(optimization, "innerGraph", production); + D(optimization, "mangleExports", production); + D(optimization, "concatenateModules", production); + D(optimization, "runtimeChunk", false); + D(optimization, "emitOnErrors", !production); + D(optimization, "checkWasmTypes", production); + D(optimization, "mangleWasmImports", false); + D(optimization, "portableRecords", records); + D(optimization, "realContentHash", production); + D(optimization, "minimize", production); + A(optimization, "minimizer", () => [ + { + apply: compiler => { + // Lazy load the Terser plugin + const TerserPlugin = __webpack_require__(55302); + new TerserPlugin({ + terserOptions: { + compress: { + passes: 2 + } + } + }).apply(compiler); + } + } + ]); + F(optimization, "nodeEnv", () => { + if (production) return "production"; + if (development) return "development"; + return false; + }); + const { splitChunks } = optimization; + if (splitChunks) { + A(splitChunks, "defaultSizeTypes", () => + css ? ["javascript", "css", "unknown"] : ["javascript", "unknown"] + ); + D(splitChunks, "hidePathInfo", production); + D(splitChunks, "chunks", "async"); + D(splitChunks, "usedExports", optimization.usedExports === true); + D(splitChunks, "minChunks", 1); + F(splitChunks, "minSize", () => (production ? 20000 : 10000)); + F(splitChunks, "minRemainingSize", () => (development ? 0 : undefined)); + F(splitChunks, "enforceSizeThreshold", () => (production ? 50000 : 30000)); + F(splitChunks, "maxAsyncRequests", () => (production ? 30 : Infinity)); + F(splitChunks, "maxInitialRequests", () => (production ? 30 : Infinity)); + D(splitChunks, "automaticNameDelimiter", "-"); + const { cacheGroups } = splitChunks; + F(cacheGroups, "default", () => ({ + idHint: "", + reuseExistingChunk: true, + minChunks: 2, + priority: -20 + })); + F(cacheGroups, "defaultVendors", () => ({ + idHint: "vendors", + reuseExistingChunk: true, + test: NODE_MODULES_REGEXP, + priority: -10 + })); } -} - -makeSerializable( - DelegatedSourceDependency, - "webpack/lib/dependencies/DelegatedSourceDependency" -); - -module.exports = DelegatedSourceDependency; - - -/***/ }), - -/***/ 95666: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - +}; -const Dependency = __webpack_require__(54912); -const makeSerializable = __webpack_require__(33032); +/** + * @param {Object} options options + * @param {boolean} options.cache is cache enable + * @param {string} options.context build context + * @param {TargetProperties | false} options.targetProperties target properties + * @param {Mode} options.mode mode + * @returns {ResolveOptions} resolve options + */ +const getResolveDefaults = ({ cache, context, targetProperties, mode }) => { + /** @type {string[]} */ + const conditions = ["webpack"]; -class DllEntryDependency extends Dependency { - constructor(dependencies, name) { - super(); + conditions.push(mode === "development" ? "development" : "production"); - this.dependencies = dependencies; - this.name = name; + if (targetProperties) { + if (targetProperties.webworker) conditions.push("worker"); + if (targetProperties.node) conditions.push("node"); + if (targetProperties.web) conditions.push("browser"); + if (targetProperties.electron) conditions.push("electron"); + if (targetProperties.nwjs) conditions.push("nwjs"); } - get type() { - return "dll entry"; - } + const jsExtensions = [".js", ".json", ".wasm"]; - serialize(context) { - const { write } = context; + const tp = targetProperties; + const browserField = + tp && tp.web && (!tp.node || (tp.electron && tp.electronRenderer)); - write(this.dependencies); - write(this.name); + /** @type {function(): ResolveOptions} */ + const cjsDeps = () => ({ + aliasFields: browserField ? ["browser"] : [], + mainFields: browserField ? ["browser", "module", "..."] : ["module", "..."], + conditionNames: ["require", "module", "..."], + extensions: [...jsExtensions] + }); + /** @type {function(): ResolveOptions} */ + const esmDeps = () => ({ + aliasFields: browserField ? ["browser"] : [], + mainFields: browserField ? ["browser", "module", "..."] : ["module", "..."], + conditionNames: ["import", "module", "..."], + extensions: [...jsExtensions] + }); - super.serialize(context); - } + /** @type {ResolveOptions} */ + const resolveOptions = { + cache, + modules: ["node_modules"], + conditionNames: conditions, + mainFiles: ["index"], + extensions: [], + aliasFields: [], + exportsFields: ["exports"], + roots: [context], + mainFields: ["main"], + byDependency: { + wasm: esmDeps(), + esm: esmDeps(), + loaderImport: esmDeps(), + url: { + preferRelative: true + }, + worker: { + ...esmDeps(), + preferRelative: true + }, + commonjs: cjsDeps(), + amd: cjsDeps(), + // for backward-compat: loadModule + loader: cjsDeps(), + // for backward-compat: Custom Dependency + unknown: cjsDeps(), + // for backward-compat: getResolve without dependencyType + undefined: cjsDeps() + } + }; - deserialize(context) { - const { read } = context; + return resolveOptions; +}; - this.dependencies = read(); - this.name = read(); +/** + * @param {Object} options options + * @param {boolean} options.cache is cache enable + * @returns {ResolveOptions} resolve options + */ +const getResolveLoaderDefaults = ({ cache }) => { + /** @type {ResolveOptions} */ + const resolveOptions = { + cache, + conditionNames: ["loader", "require", "node"], + exportsFields: ["exports"], + mainFields: ["loader", "main"], + extensions: [".js"], + mainFiles: ["index"] + }; - super.deserialize(context); - } -} + return resolveOptions; +}; -makeSerializable( - DllEntryDependency, - "webpack/lib/dependencies/DllEntryDependency" -); +/** + * @param {InfrastructureLogging} infrastructureLogging options + * @returns {void} + */ +const applyInfrastructureLoggingDefaults = infrastructureLogging => { + F(infrastructureLogging, "stream", () => process.stderr); + const tty = + /** @type {any} */ (infrastructureLogging.stream).isTTY && + process.env.TERM !== "dumb"; + D(infrastructureLogging, "level", "info"); + D(infrastructureLogging, "debug", false); + D(infrastructureLogging, "colors", tty); + D(infrastructureLogging, "appendOnly", !tty); +}; -module.exports = DllEntryDependency; +exports.applyWebpackOptionsBaseDefaults = applyWebpackOptionsBaseDefaults; +exports.applyWebpackOptionsDefaults = applyWebpackOptionsDefaults; /***/ }), -/***/ 32006: -/***/ (function(__unused_webpack_module, exports) { +/***/ 26693: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -75996,547 +72615,533 @@ module.exports = DllEntryDependency; -/** @typedef {import("../Parser").ParserState} ParserState */ +const util = __webpack_require__(73837); -/** @type {WeakMap} */ -const parserStateExportsState = new WeakMap(); +/** @typedef {import("../../declarations/WebpackOptions").EntryStatic} EntryStatic */ +/** @typedef {import("../../declarations/WebpackOptions").EntryStaticNormalized} EntryStaticNormalized */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryName} LibraryName */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").OptimizationRuntimeChunk} OptimizationRuntimeChunk */ +/** @typedef {import("../../declarations/WebpackOptions").OptimizationRuntimeChunkNormalized} OptimizationRuntimeChunkNormalized */ +/** @typedef {import("../../declarations/WebpackOptions").OutputNormalized} OutputNormalized */ +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptions} WebpackOptions */ +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptionsNormalized */ + +const handledDeprecatedNoEmitOnErrors = util.deprecate( + (noEmitOnErrors, emitOnErrors) => { + if (emitOnErrors !== undefined && !noEmitOnErrors === !emitOnErrors) { + throw new Error( + "Conflicting use of 'optimization.noEmitOnErrors' and 'optimization.emitOnErrors'. Remove deprecated 'optimization.noEmitOnErrors' from config." + ); + } + return !noEmitOnErrors; + }, + "optimization.noEmitOnErrors is deprecated in favor of optimization.emitOnErrors", + "DEP_WEBPACK_CONFIGURATION_OPTIMIZATION_NO_EMIT_ON_ERRORS" +); /** - * @param {ParserState} parserState parser state - * @returns {void} + * @template T + * @template R + * @param {T|undefined} value value or not + * @param {function(T): R} fn nested handler + * @returns {R} result value */ -exports.bailout = parserState => { - const value = parserStateExportsState.get(parserState); - parserStateExportsState.set(parserState, false); - if (value === true) { - parserState.module.buildMeta.exportsType = undefined; - parserState.module.buildMeta.defaultObject = false; - } -}; +const nestedConfig = (value, fn) => + value === undefined ? fn(/** @type {T} */ ({})) : fn(value); /** - * @param {ParserState} parserState parser state - * @returns {void} + * @template T + * @param {T|undefined} value value or not + * @returns {T} result value */ -exports.enable = parserState => { - const value = parserStateExportsState.get(parserState); - if (value === false) return; - parserStateExportsState.set(parserState, true); - if (value !== true) { - parserState.module.buildMeta.exportsType = "default"; - parserState.module.buildMeta.defaultObject = "redirect"; - } +const cloneObject = value => { + return /** @type {T} */ ({ ...value }); }; /** - * @param {ParserState} parserState parser state - * @returns {void} + * @template T + * @template R + * @param {T|undefined} value value or not + * @param {function(T): R} fn nested handler + * @returns {R|undefined} result value */ -exports.setFlagged = parserState => { - const value = parserStateExportsState.get(parserState); - if (value !== true) return; - const buildMeta = parserState.module.buildMeta; - if (buildMeta.exportsType === "dynamic") return; - buildMeta.exportsType = "flagged"; -}; +const optionalNestedConfig = (value, fn) => + value === undefined ? undefined : fn(value); /** - * @param {ParserState} parserState parser state - * @returns {void} + * @template T + * @template R + * @param {T[]|undefined} value array or not + * @param {function(T[]): R[]} fn nested handler + * @returns {R[]|undefined} cloned value */ -exports.setDynamic = parserState => { - const value = parserStateExportsState.get(parserState); - if (value !== true) return; - parserState.module.buildMeta.exportsType = "dynamic"; +const nestedArray = (value, fn) => (Array.isArray(value) ? fn(value) : fn([])); + +/** + * @template T + * @template R + * @param {T[]|undefined} value array or not + * @param {function(T[]): R[]} fn nested handler + * @returns {R[]|undefined} cloned value + */ +const optionalNestedArray = (value, fn) => + Array.isArray(value) ? fn(value) : undefined; + +/** + * @template T + * @template R + * @param {Record|undefined} value value or not + * @param {function(T): R} fn nested handler + * @param {Record=} customKeys custom nested handler for some keys + * @returns {Record} result value + */ +const keyedNestedConfig = (value, fn, customKeys) => { + const result = + value === undefined + ? {} + : Object.keys(value).reduce( + (obj, key) => ( + (obj[key] = ( + customKeys && key in customKeys ? customKeys[key] : fn + )(value[key])), + obj + ), + /** @type {Record} */ ({}) + ); + if (customKeys) { + for (const key of Object.keys(customKeys)) { + if (!(key in result)) { + result[key] = customKeys[key](/** @type {T} */ ({})); + } + } + } + return result; }; /** - * @param {ParserState} parserState parser state - * @returns {boolean} true, when enabled + * @param {WebpackOptions} config input config + * @returns {WebpackOptionsNormalized} normalized options */ -exports.isEnabled = parserState => { - const value = parserStateExportsState.get(parserState); - return value === true; +const getNormalizedWebpackOptions = config => { + return { + amd: config.amd, + bail: config.bail, + cache: optionalNestedConfig(config.cache, cache => { + if (cache === false) return false; + if (cache === true) { + return { + type: "memory", + maxGenerations: undefined + }; + } + switch (cache.type) { + case "filesystem": + return { + type: "filesystem", + allowCollectingMemory: cache.allowCollectingMemory, + maxMemoryGenerations: cache.maxMemoryGenerations, + maxAge: cache.maxAge, + profile: cache.profile, + buildDependencies: cloneObject(cache.buildDependencies), + cacheDirectory: cache.cacheDirectory, + cacheLocation: cache.cacheLocation, + hashAlgorithm: cache.hashAlgorithm, + compression: cache.compression, + idleTimeout: cache.idleTimeout, + idleTimeoutForInitialStore: cache.idleTimeoutForInitialStore, + idleTimeoutAfterLargeChanges: cache.idleTimeoutAfterLargeChanges, + name: cache.name, + store: cache.store, + version: cache.version + }; + case undefined: + case "memory": + return { + type: "memory", + maxGenerations: cache.maxGenerations + }; + default: + // @ts-expect-error Property 'type' does not exist on type 'never'. ts(2339) + throw new Error(`Not implemented cache.type ${cache.type}`); + } + }), + context: config.context, + dependencies: config.dependencies, + devServer: optionalNestedConfig(config.devServer, devServer => ({ + ...devServer + })), + devtool: config.devtool, + entry: + config.entry === undefined + ? { main: {} } + : typeof config.entry === "function" + ? ( + fn => () => + Promise.resolve().then(fn).then(getNormalizedEntryStatic) + )(config.entry) + : getNormalizedEntryStatic(config.entry), + experiments: nestedConfig(config.experiments, experiments => ({ + ...experiments, + buildHttp: optionalNestedConfig(experiments.buildHttp, options => + Array.isArray(options) ? { allowedUris: options } : options + ), + lazyCompilation: optionalNestedConfig( + experiments.lazyCompilation, + options => + options === true ? {} : options === false ? undefined : options + ), + css: optionalNestedConfig(experiments.css, options => + options === true ? {} : options === false ? undefined : options + ) + })), + externals: config.externals, + externalsPresets: cloneObject(config.externalsPresets), + externalsType: config.externalsType, + ignoreWarnings: config.ignoreWarnings + ? config.ignoreWarnings.map(ignore => { + if (typeof ignore === "function") return ignore; + const i = ignore instanceof RegExp ? { message: ignore } : ignore; + return (warning, { requestShortener }) => { + if (!i.message && !i.module && !i.file) return false; + if (i.message && !i.message.test(warning.message)) { + return false; + } + if ( + i.module && + (!warning.module || + !i.module.test( + warning.module.readableIdentifier(requestShortener) + )) + ) { + return false; + } + if (i.file && (!warning.file || !i.file.test(warning.file))) { + return false; + } + return true; + }; + }) + : undefined, + infrastructureLogging: cloneObject(config.infrastructureLogging), + loader: cloneObject(config.loader), + mode: config.mode, + module: nestedConfig(config.module, module => ({ + noParse: module.noParse, + unsafeCache: module.unsafeCache, + parser: keyedNestedConfig(module.parser, cloneObject, { + javascript: parserOptions => ({ + unknownContextRequest: module.unknownContextRequest, + unknownContextRegExp: module.unknownContextRegExp, + unknownContextRecursive: module.unknownContextRecursive, + unknownContextCritical: module.unknownContextCritical, + exprContextRequest: module.exprContextRequest, + exprContextRegExp: module.exprContextRegExp, + exprContextRecursive: module.exprContextRecursive, + exprContextCritical: module.exprContextCritical, + wrappedContextRegExp: module.wrappedContextRegExp, + wrappedContextRecursive: module.wrappedContextRecursive, + wrappedContextCritical: module.wrappedContextCritical, + // TODO webpack 6 remove + strictExportPresence: module.strictExportPresence, + strictThisContextOnImports: module.strictThisContextOnImports, + ...parserOptions + }) + }), + generator: cloneObject(module.generator), + defaultRules: optionalNestedArray(module.defaultRules, r => [...r]), + rules: nestedArray(module.rules, r => [...r]) + })), + name: config.name, + node: nestedConfig( + config.node, + node => + node && { + ...node + } + ), + optimization: nestedConfig(config.optimization, optimization => { + return { + ...optimization, + runtimeChunk: getNormalizedOptimizationRuntimeChunk( + optimization.runtimeChunk + ), + splitChunks: nestedConfig( + optimization.splitChunks, + splitChunks => + splitChunks && { + ...splitChunks, + defaultSizeTypes: splitChunks.defaultSizeTypes + ? [...splitChunks.defaultSizeTypes] + : ["..."], + cacheGroups: cloneObject(splitChunks.cacheGroups) + } + ), + emitOnErrors: + optimization.noEmitOnErrors !== undefined + ? handledDeprecatedNoEmitOnErrors( + optimization.noEmitOnErrors, + optimization.emitOnErrors + ) + : optimization.emitOnErrors + }; + }), + output: nestedConfig(config.output, output => { + const { library } = output; + const libraryAsName = /** @type {LibraryName} */ (library); + const libraryBase = + typeof library === "object" && + library && + !Array.isArray(library) && + "type" in library + ? library + : libraryAsName || output.libraryTarget + ? /** @type {LibraryOptions} */ ({ + name: libraryAsName + }) + : undefined; + /** @type {OutputNormalized} */ + const result = { + assetModuleFilename: output.assetModuleFilename, + asyncChunks: output.asyncChunks, + charset: output.charset, + chunkFilename: output.chunkFilename, + chunkFormat: output.chunkFormat, + chunkLoading: output.chunkLoading, + chunkLoadingGlobal: output.chunkLoadingGlobal, + chunkLoadTimeout: output.chunkLoadTimeout, + cssFilename: output.cssFilename, + cssChunkFilename: output.cssChunkFilename, + clean: output.clean, + compareBeforeEmit: output.compareBeforeEmit, + crossOriginLoading: output.crossOriginLoading, + devtoolFallbackModuleFilenameTemplate: + output.devtoolFallbackModuleFilenameTemplate, + devtoolModuleFilenameTemplate: output.devtoolModuleFilenameTemplate, + devtoolNamespace: output.devtoolNamespace, + environment: cloneObject(output.environment), + enabledChunkLoadingTypes: output.enabledChunkLoadingTypes + ? [...output.enabledChunkLoadingTypes] + : ["..."], + enabledLibraryTypes: output.enabledLibraryTypes + ? [...output.enabledLibraryTypes] + : ["..."], + enabledWasmLoadingTypes: output.enabledWasmLoadingTypes + ? [...output.enabledWasmLoadingTypes] + : ["..."], + filename: output.filename, + globalObject: output.globalObject, + hashDigest: output.hashDigest, + hashDigestLength: output.hashDigestLength, + hashFunction: output.hashFunction, + hashSalt: output.hashSalt, + hotUpdateChunkFilename: output.hotUpdateChunkFilename, + hotUpdateGlobal: output.hotUpdateGlobal, + hotUpdateMainFilename: output.hotUpdateMainFilename, + iife: output.iife, + importFunctionName: output.importFunctionName, + importMetaName: output.importMetaName, + scriptType: output.scriptType, + library: libraryBase && { + type: + output.libraryTarget !== undefined + ? output.libraryTarget + : libraryBase.type, + auxiliaryComment: + output.auxiliaryComment !== undefined + ? output.auxiliaryComment + : libraryBase.auxiliaryComment, + export: + output.libraryExport !== undefined + ? output.libraryExport + : libraryBase.export, + name: libraryBase.name, + umdNamedDefine: + output.umdNamedDefine !== undefined + ? output.umdNamedDefine + : libraryBase.umdNamedDefine + }, + module: output.module, + path: output.path, + pathinfo: output.pathinfo, + publicPath: output.publicPath, + sourceMapFilename: output.sourceMapFilename, + sourcePrefix: output.sourcePrefix, + strictModuleExceptionHandling: output.strictModuleExceptionHandling, + trustedTypes: optionalNestedConfig( + output.trustedTypes, + trustedTypes => { + if (trustedTypes === true) return {}; + if (typeof trustedTypes === "string") + return { policyName: trustedTypes }; + return { ...trustedTypes }; + } + ), + uniqueName: output.uniqueName, + wasmLoading: output.wasmLoading, + webassemblyModuleFilename: output.webassemblyModuleFilename, + workerChunkLoading: output.workerChunkLoading, + workerWasmLoading: output.workerWasmLoading + }; + return result; + }), + parallelism: config.parallelism, + performance: optionalNestedConfig(config.performance, performance => { + if (performance === false) return false; + return { + ...performance + }; + }), + plugins: nestedArray(config.plugins, p => [...p]), + profile: config.profile, + recordsInputPath: + config.recordsInputPath !== undefined + ? config.recordsInputPath + : config.recordsPath, + recordsOutputPath: + config.recordsOutputPath !== undefined + ? config.recordsOutputPath + : config.recordsPath, + resolve: nestedConfig(config.resolve, resolve => ({ + ...resolve, + byDependency: keyedNestedConfig(resolve.byDependency, cloneObject) + })), + resolveLoader: cloneObject(config.resolveLoader), + snapshot: nestedConfig(config.snapshot, snapshot => ({ + resolveBuildDependencies: optionalNestedConfig( + snapshot.resolveBuildDependencies, + resolveBuildDependencies => ({ + timestamp: resolveBuildDependencies.timestamp, + hash: resolveBuildDependencies.hash + }) + ), + buildDependencies: optionalNestedConfig( + snapshot.buildDependencies, + buildDependencies => ({ + timestamp: buildDependencies.timestamp, + hash: buildDependencies.hash + }) + ), + resolve: optionalNestedConfig(snapshot.resolve, resolve => ({ + timestamp: resolve.timestamp, + hash: resolve.hash + })), + module: optionalNestedConfig(snapshot.module, module => ({ + timestamp: module.timestamp, + hash: module.hash + })), + immutablePaths: optionalNestedArray(snapshot.immutablePaths, p => [...p]), + managedPaths: optionalNestedArray(snapshot.managedPaths, p => [...p]) + })), + stats: nestedConfig(config.stats, stats => { + if (stats === false) { + return { + preset: "none" + }; + } + if (stats === true) { + return { + preset: "normal" + }; + } + if (typeof stats === "string") { + return { + preset: stats + }; + } + return { + ...stats + }; + }), + target: config.target, + watch: config.watch, + watchOptions: cloneObject(config.watchOptions) + }; }; - -/***/ }), - -/***/ 3979: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); - -class EntryDependency extends ModuleDependency { - /** - * @param {string} request request path for entry - */ - constructor(request) { - super(request); - } - - get type() { - return "entry"; - } - - get category() { - return "esm"; - } -} - -makeSerializable(EntryDependency, "webpack/lib/dependencies/EntryDependency"); - -module.exports = EntryDependency; - - -/***/ }), - -/***/ 78988: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { UsageState } = __webpack_require__(63686); -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {Module} module the module - * @param {string | null} exportName name of the export if any - * @param {string | null} property name of the requested property - * @param {RuntimeSpec} runtime for which runtime - * @returns {any} value of the property + * @param {EntryStatic} entry static entry options + * @returns {EntryStaticNormalized} normalized static entry options */ -const getProperty = (moduleGraph, module, exportName, property, runtime) => { - if (!exportName) { - switch (property) { - case "usedExports": { - const usedExports = moduleGraph - .getExportsInfo(module) - .getUsedExports(runtime); - if ( - typeof usedExports === "boolean" || - usedExports === undefined || - usedExports === null - ) { - return usedExports; - } - return Array.from(usedExports).sort(); +const getNormalizedEntryStatic = entry => { + if (typeof entry === "string") { + return { + main: { + import: [entry] } - } + }; } - switch (property) { - case "canMangle": { - const exportsInfo = moduleGraph.getExportsInfo(module); - const exportInfo = exportsInfo.getExportInfo(exportName); - if (exportInfo) return exportInfo.canMangle; - return exportsInfo.otherExportsInfo.canMangle; - } - case "used": - return ( - moduleGraph.getExportsInfo(module).getUsed(exportName, runtime) !== - UsageState.Unused - ); - case "useInfo": { - const state = moduleGraph - .getExportsInfo(module) - .getUsed(exportName, runtime); - switch (state) { - case UsageState.Used: - case UsageState.OnlyPropertiesUsed: - return true; - case UsageState.Unused: - return false; - case UsageState.NoInfo: - return undefined; - case UsageState.Unknown: - return null; - default: - throw new Error(`Unexpected UsageState ${state}`); + if (Array.isArray(entry)) { + return { + main: { + import: entry } - } - case "provideInfo": - return moduleGraph.getExportsInfo(module).isExportProvided(exportName); - } - return undefined; -}; - -class ExportsInfoDependency extends NullDependency { - constructor(range, exportName, property) { - super(); - this.range = range; - this.exportName = exportName; - this.property = property; - } - - serialize(context) { - const { write } = context; - write(this.range); - write(this.exportName); - write(this.property); - super.serialize(context); - } - - static deserialize(context) { - const obj = new ExportsInfoDependency( - context.read(), - context.read(), - context.read() - ); - obj.deserialize(context); - return obj; - } -} - -makeSerializable( - ExportsInfoDependency, - "webpack/lib/dependencies/ExportsInfoDependency" -); - -ExportsInfoDependency.Template = class ExportsInfoDependencyTemplate extends ( - NullDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, { module, moduleGraph, runtime }) { - const dep = /** @type {ExportsInfoDependency} */ (dependency); - - const value = getProperty( - moduleGraph, - module, - dep.exportName, - dep.property, - runtime - ); - source.replace( - dep.range[0], - dep.range[1] - 1, - value === undefined ? "undefined" : JSON.stringify(value) - ); - } -}; - -module.exports = ExportsInfoDependency; - - -/***/ }), - -/***/ 23624: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const Template = __webpack_require__(1626); -const makeSerializable = __webpack_require__(33032); -const HarmonyImportDependency = __webpack_require__(57154); -const NullDependency = __webpack_require__(31830); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("./HarmonyAcceptImportDependency")} HarmonyAcceptImportDependency */ - -class HarmonyAcceptDependency extends NullDependency { - /** - * @param {[number, number]} range expression range - * @param {HarmonyAcceptImportDependency[]} dependencies import dependencies - * @param {boolean} hasCallback true, if the range wraps an existing callback - */ - constructor(range, dependencies, hasCallback) { - super(); - this.range = range; - this.dependencies = dependencies; - this.hasCallback = hasCallback; - } - - get type() { - return "accepted harmony modules"; - } - - serialize(context) { - const { write } = context; - write(this.range); - write(this.dependencies); - write(this.hasCallback); - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - this.range = read(); - this.dependencies = read(); - this.hasCallback = read(); - super.deserialize(context); + }; } -} - -makeSerializable( - HarmonyAcceptDependency, - "webpack/lib/dependencies/HarmonyAcceptDependency" -); - -HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate extends ( - NullDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, templateContext) { - const dep = /** @type {HarmonyAcceptDependency} */ (dependency); - const { - module, - runtime, - runtimeRequirements, - runtimeTemplate, - moduleGraph, - chunkGraph - } = templateContext; - const content = dep.dependencies - .map(dependency => { - const referencedModule = moduleGraph.getModule(dependency); - return { - dependency, - runtimeCondition: referencedModule - ? HarmonyImportDependency.Template.getImportEmittedRuntime( - module, - referencedModule - ) - : false - }; - }) - .filter(({ runtimeCondition }) => runtimeCondition !== false) - .map(({ dependency, runtimeCondition }) => { - const condition = runtimeTemplate.runtimeConditionExpression({ - chunkGraph, - runtime, - runtimeCondition, - runtimeRequirements - }); - const s = dependency.getImportStatement(true, templateContext); - const code = s[0] + s[1]; - if (condition !== "true") { - return `if (${condition}) {\n${Template.indent(code)}\n}\n`; - } - return code; - }) - .join(""); - - if (dep.hasCallback) { - if (runtimeTemplate.supportsArrowFunction()) { - source.insert( - dep.range[0], - `__WEBPACK_OUTDATED_DEPENDENCIES__ => { ${content}(` - ); - source.insert(dep.range[1], ")(__WEBPACK_OUTDATED_DEPENDENCIES__); }"); - } else { - source.insert( - dep.range[0], - `function(__WEBPACK_OUTDATED_DEPENDENCIES__) { ${content}(` - ); - source.insert( - dep.range[1], - ")(__WEBPACK_OUTDATED_DEPENDENCIES__); }.bind(this)" - ); - } - return; + /** @type {EntryStaticNormalized} */ + const result = {}; + for (const key of Object.keys(entry)) { + const value = entry[key]; + if (typeof value === "string") { + result[key] = { + import: [value] + }; + } else if (Array.isArray(value)) { + result[key] = { + import: value + }; + } else { + result[key] = { + import: + value.import && + (Array.isArray(value.import) ? value.import : [value.import]), + filename: value.filename, + layer: value.layer, + runtime: value.runtime, + publicPath: value.publicPath, + chunkLoading: value.chunkLoading, + asyncChunks: value.asyncChunks, + wasmLoading: value.wasmLoading, + dependOn: + value.dependOn && + (Array.isArray(value.dependOn) ? value.dependOn : [value.dependOn]), + library: value.library + }; } - - const arrow = runtimeTemplate.supportsArrowFunction(); - source.insert( - dep.range[1] - 0.5, - `, ${arrow ? "() =>" : "function()"} { ${content} }` - ); } + return result; }; -module.exports = HarmonyAcceptDependency; - - -/***/ }), - -/***/ 99843: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const makeSerializable = __webpack_require__(33032); -const HarmonyImportDependency = __webpack_require__(57154); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ - -class HarmonyAcceptImportDependency extends HarmonyImportDependency { - constructor(request) { - super(request, NaN); - this.weak = true; - } - - get type() { - return "harmony accept"; - } -} - -makeSerializable( - HarmonyAcceptImportDependency, - "webpack/lib/dependencies/HarmonyAcceptImportDependency" -); - -HarmonyAcceptImportDependency.Template = class HarmonyAcceptImportDependencyTemplate extends ( - HarmonyImportDependency.Template -) {}; - -module.exports = HarmonyAcceptImportDependency; - - -/***/ }), - -/***/ 72906: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { UsageState } = __webpack_require__(63686); -const InitFragment = __webpack_require__(55870); -const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../Module")} Module */ - -class HarmonyCompatibilityDependency extends NullDependency { - get type() { - return "harmony export header"; - } -} - -makeSerializable( - HarmonyCompatibilityDependency, - "webpack/lib/dependencies/HarmonyCompatibilityDependency" -); - -HarmonyCompatibilityDependency.Template = class HarmonyExportDependencyTemplate extends ( - NullDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply( - dependency, - source, - { - module, - runtimeTemplate, - moduleGraph, - initFragments, - runtimeRequirements, - runtime, - concatenationScope - } - ) { - if (concatenationScope) return; - const exportsInfo = moduleGraph.getExportsInfo(module); - if ( - exportsInfo.getReadOnlyExportInfo("__esModule").getUsed(runtime) !== - UsageState.Unused - ) { - const content = runtimeTemplate.defineEsModuleFlagStatement({ - exportsArgument: module.exportsArgument, - runtimeRequirements - }); - initFragments.push( - new InitFragment( - content, - InitFragment.STAGE_HARMONY_EXPORTS, - 0, - "harmony compatibility" - ) - ); - } - if (moduleGraph.isAsync(module)) { - runtimeRequirements.add(RuntimeGlobals.module); - runtimeRequirements.add(RuntimeGlobals.asyncModule); - initFragments.push( - new InitFragment( - runtimeTemplate.supportsArrowFunction() - ? `${RuntimeGlobals.asyncModule}(${module.moduleArgument}, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n` - : `${RuntimeGlobals.asyncModule}(${module.moduleArgument}, async function (__webpack_handle_async_dependencies__, __webpack_async_result__) { try {\n`, - InitFragment.STAGE_ASYNC_BOUNDARY, - 0, - undefined, - `\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } }${ - module.buildMeta.async ? ", 1" : "" - });` - ) - ); - } +/** + * @param {OptimizationRuntimeChunk=} runtimeChunk runtimeChunk option + * @returns {OptimizationRuntimeChunkNormalized=} normalized runtimeChunk option + */ +const getNormalizedOptimizationRuntimeChunk = runtimeChunk => { + if (runtimeChunk === undefined) return undefined; + if (runtimeChunk === false) return false; + if (runtimeChunk === "single") { + return { + name: () => "runtime" + }; + } + if (runtimeChunk === true || runtimeChunk === "multiple") { + return { + name: entrypoint => `runtime~${entrypoint.name}` + }; } + const { name } = runtimeChunk; + return { + name: typeof name === "function" ? name : () => name + }; }; -module.exports = HarmonyCompatibilityDependency; +exports.getNormalizedWebpackOptions = getNormalizedWebpackOptions; /***/ }), -/***/ 17223: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 52801: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -76546,1845 +73151,1823 @@ module.exports = HarmonyCompatibilityDependency; -const DynamicExports = __webpack_require__(32006); -const HarmonyCompatibilityDependency = __webpack_require__(72906); -const HarmonyExports = __webpack_require__(39211); +const memoize = __webpack_require__(78676); -module.exports = class HarmonyDetectionParserPlugin { - constructor(options) { - const { topLevelAwait = false } = options || {}; - this.topLevelAwait = topLevelAwait; - } +const getBrowserslistTargetHandler = memoize(() => + __webpack_require__(43950) +); - apply(parser) { - parser.hooks.program.tap("HarmonyDetectionParserPlugin", ast => { - const isStrictHarmony = parser.state.module.type === "javascript/esm"; - const isHarmony = - isStrictHarmony || - ast.body.some( - statement => - statement.type === "ImportDeclaration" || - statement.type === "ExportDefaultDeclaration" || - statement.type === "ExportNamedDeclaration" || - statement.type === "ExportAllDeclaration" - ); - if (isHarmony) { - const module = parser.state.module; - const compatDep = new HarmonyCompatibilityDependency(); - compatDep.loc = { - start: { - line: -1, - column: 0 - }, - end: { - line: -1, - column: 0 - }, - index: -3 - }; - module.addPresentationalDependency(compatDep); - DynamicExports.bailout(parser.state); - HarmonyExports.enable(parser.state, isStrictHarmony); - parser.scope.isStrict = true; - } - }); +/** + * @param {string} context the context directory + * @returns {string} default target + */ +const getDefaultTarget = context => { + const browsers = getBrowserslistTargetHandler().load(null, context); + return browsers ? "browserslist" : "web"; +}; - parser.hooks.topLevelAwait.tap("HarmonyDetectionParserPlugin", () => { - const module = parser.state.module; - if (!this.topLevelAwait) { - throw new Error( - "The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it)" - ); - } - if (!HarmonyExports.isEnabled(parser.state)) { - throw new Error( - "Top-level-await is only supported in EcmaScript Modules" - ); - } - module.buildMeta.async = true; - }); +/** + * @typedef {Object} PlatformTargetProperties + * @property {boolean | null} web web platform, importing of http(s) and std: is available + * @property {boolean | null} browser browser platform, running in a normal web browser + * @property {boolean | null} webworker (Web)Worker platform, running in a web/shared/service worker + * @property {boolean | null} node node platform, require of node built-in modules is available + * @property {boolean | null} nwjs nwjs platform, require of legacy nw.gui is available + * @property {boolean | null} electron electron platform, require of some electron built-in modules is available + */ - const skipInHarmony = () => { - if (HarmonyExports.isEnabled(parser.state)) { - return true; - } - }; +/** + * @typedef {Object} ElectronContextTargetProperties + * @property {boolean | null} electronMain in main context + * @property {boolean | null} electronPreload in preload context + * @property {boolean | null} electronRenderer in renderer context with node integration + */ - const nullInHarmony = () => { - if (HarmonyExports.isEnabled(parser.state)) { - return null; - } - }; +/** + * @typedef {Object} ApiTargetProperties + * @property {boolean | null} require has require function available + * @property {boolean | null} nodeBuiltins has node.js built-in modules available + * @property {boolean | null} document has document available (allows script tags) + * @property {boolean | null} importScripts has importScripts available + * @property {boolean | null} importScriptsInWorker has importScripts available when creating a worker + * @property {boolean | null} fetchWasm has fetch function available for WebAssembly + * @property {boolean | null} global has global variable available + */ - const nonHarmonyIdentifiers = ["define", "exports"]; - for (const identifier of nonHarmonyIdentifiers) { - parser.hooks.evaluateTypeof - .for(identifier) - .tap("HarmonyDetectionParserPlugin", nullInHarmony); - parser.hooks.typeof - .for(identifier) - .tap("HarmonyDetectionParserPlugin", skipInHarmony); - parser.hooks.evaluate - .for(identifier) - .tap("HarmonyDetectionParserPlugin", nullInHarmony); - parser.hooks.expression - .for(identifier) - .tap("HarmonyDetectionParserPlugin", skipInHarmony); - parser.hooks.call - .for(identifier) - .tap("HarmonyDetectionParserPlugin", skipInHarmony); - } - } +/** + * @typedef {Object} EcmaTargetProperties + * @property {boolean | null} globalThis has globalThis variable available + * @property {boolean | null} bigIntLiteral big int literal syntax is available + * @property {boolean | null} const const and let variable declarations are available + * @property {boolean | null} arrowFunction arrow functions are available + * @property {boolean | null} forOf for of iteration is available + * @property {boolean | null} destructuring destructuring is available + * @property {boolean | null} dynamicImport async import() is available + * @property {boolean | null} dynamicImportInWorker async import() is available when creating a worker + * @property {boolean | null} module ESM syntax is available (when in module) + * @property {boolean | null} optionalChaining optional chaining is available + * @property {boolean | null} templateLiteral template literal is available + */ + +///** @typedef {PlatformTargetProperties | ApiTargetProperties | EcmaTargetProperties | PlatformTargetProperties & ApiTargetProperties | PlatformTargetProperties & EcmaTargetProperties | ApiTargetProperties & EcmaTargetProperties} TargetProperties */ +/** @template T @typedef {{ [P in keyof T]?: never }} Never */ +/** @template A @template B @typedef {(A & Never) | (Never & B) | (A & B)} Mix */ +/** @typedef {Mix, Mix>} TargetProperties */ + +const versionDependent = (major, minor) => { + if (!major) return () => /** @type {undefined} */ (undefined); + major = +major; + minor = minor ? +minor : 0; + return (vMajor, vMinor = 0) => { + return major > vMajor || (major === vMajor && minor >= vMinor); + }; }; +/** @type {[string, string, RegExp, (...args: string[]) => TargetProperties | false][]} */ +const TARGETS = [ + [ + "browserslist / browserslist:env / browserslist:query / browserslist:path-to-config / browserslist:path-to-config:env", + "Resolve features from browserslist. Will resolve browserslist config automatically. Only browser or node queries are supported (electron is not supported). Examples: 'browserslist:modern' to use 'modern' environment from browserslist config", + /^browserslist(?::(.+))?$/, + (rest, context) => { + const browserslistTargetHandler = getBrowserslistTargetHandler(); + const browsers = browserslistTargetHandler.load( + rest ? rest.trim() : null, + context + ); + if (!browsers) { + throw new Error(`No browserslist config found to handle the 'browserslist' target. +See https://github.com/browserslist/browserslist#queries for possible ways to provide a config. +The recommended way is to add a 'browserslist' key to your package.json and list supported browsers (resp. node.js versions). +You can also more options via the 'target' option: 'browserslist' / 'browserslist:env' / 'browserslist:query' / 'browserslist:path-to-config' / 'browserslist:path-to-config:env'`); + } + return browserslistTargetHandler.resolve(browsers); + } + ], + [ + "web", + "Web browser.", + /^web$/, + () => { + return { + web: true, + browser: true, + webworker: null, + node: false, + electron: false, + nwjs: false, -/***/ }), + document: true, + importScriptsInWorker: true, + fetchWasm: true, + nodeBuiltins: false, + importScripts: false, + require: false, + global: false + }; + } + ], + [ + "webworker", + "Web Worker, SharedWorker or Service Worker.", + /^webworker$/, + () => { + return { + web: true, + browser: true, + webworker: true, + node: false, + electron: false, + nwjs: false, -/***/ 93466: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + importScripts: true, + importScriptsInWorker: true, + fetchWasm: true, + nodeBuiltins: false, + require: false, + document: false, + global: false + }; + } + ], + [ + "[async-]node[X[.Y]]", + "Node.js in version X.Y. The 'async-' prefix will load chunks asynchronously via 'fs' and 'vm' instead of 'require()'. Examples: node14.5, async-node10.", + /^(async-)?node(\d+(?:\.(\d+))?)?$/, + (asyncFlag, major, minor) => { + const v = versionDependent(major, minor); + // see https://node.green/ + return { + node: true, + electron: false, + nwjs: false, + web: false, + webworker: false, + browser: false, -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + require: !asyncFlag, + nodeBuiltins: true, + global: true, + document: false, + fetchWasm: false, + importScripts: false, + importScriptsInWorker: false, + globalThis: v(12), + const: v(6), + templateLiteral: v(4), + optionalChaining: v(14), + arrowFunction: v(6), + forOf: v(5), + destructuring: v(6), + bigIntLiteral: v(10, 4), + dynamicImport: v(12, 17), + dynamicImportInWorker: major ? false : undefined, + module: v(12, 17) + }; + } + ], + [ + "electron[X[.Y]]-main/preload/renderer", + "Electron in version X.Y. Script is running in main, preload resp. renderer context.", + /^electron(\d+(?:\.(\d+))?)?-(main|preload|renderer)$/, + (major, minor, context) => { + const v = versionDependent(major, minor); + // see https://node.green/ + https://github.com/electron/releases + return { + node: true, + electron: true, + web: context !== "main", + webworker: false, + browser: false, + nwjs: false, + electronMain: context === "main", + electronPreload: context === "preload", + electronRenderer: context === "renderer", -const InnerGraph = __webpack_require__(38988); -const ConstDependency = __webpack_require__(76911); -const HarmonyExportExpressionDependency = __webpack_require__(51340); -const HarmonyExportHeaderDependency = __webpack_require__(38873); -const HarmonyExportImportedSpecifierDependency = __webpack_require__(67157); -const HarmonyExportSpecifierDependency = __webpack_require__(48567); -const { ExportPresenceModes } = __webpack_require__(57154); -const { - harmonySpecifierTag, - getAssertions -} = __webpack_require__(20862); -const HarmonyImportSideEffectDependency = __webpack_require__(73132); + global: true, + nodeBuiltins: true, + require: true, + document: context === "renderer", + fetchWasm: context === "renderer", + importScripts: false, + importScriptsInWorker: true, -const { HarmonyStarExportsList } = HarmonyExportImportedSpecifierDependency; + globalThis: v(5), + const: v(1, 1), + templateLiteral: v(1, 1), + optionalChaining: v(8), + arrowFunction: v(1, 1), + forOf: v(0, 36), + destructuring: v(1, 1), + bigIntLiteral: v(4), + dynamicImport: v(11), + dynamicImportInWorker: major ? false : undefined, + module: v(11) + }; + } + ], + [ + "nwjs[X[.Y]] / node-webkit[X[.Y]]", + "NW.js in version X.Y.", + /^(?:nwjs|node-webkit)(\d+(?:\.(\d+))?)?$/, + (major, minor) => { + const v = versionDependent(major, minor); + // see https://node.green/ + https://github.com/nwjs/nw.js/blob/nw48/CHANGELOG.md + return { + node: true, + web: true, + nwjs: true, + webworker: null, + browser: false, + electron: false, -module.exports = class HarmonyExportDependencyParserPlugin { - constructor(options) { - this.exportPresenceMode = - options.reexportExportsPresence !== undefined - ? ExportPresenceModes.fromUserOption(options.reexportExportsPresence) - : options.exportsPresence !== undefined - ? ExportPresenceModes.fromUserOption(options.exportsPresence) - : options.strictExportPresence - ? ExportPresenceModes.ERROR - : ExportPresenceModes.AUTO; - } + global: true, + nodeBuiltins: true, + document: false, + importScriptsInWorker: false, + fetchWasm: false, + importScripts: false, + require: false, - apply(parser) { - const { exportPresenceMode } = this; - parser.hooks.export.tap( - "HarmonyExportDependencyParserPlugin", - statement => { - const dep = new HarmonyExportHeaderDependency( - statement.declaration && statement.declaration.range, - statement.range - ); - dep.loc = Object.create(statement.loc); - dep.loc.index = -1; - parser.state.module.addPresentationalDependency(dep); - return true; - } - ); - parser.hooks.exportImport.tap( - "HarmonyExportDependencyParserPlugin", - (statement, source) => { - parser.state.lastHarmonyImportOrder = - (parser.state.lastHarmonyImportOrder || 0) + 1; - const clearDep = new ConstDependency("", statement.range); - clearDep.loc = Object.create(statement.loc); - clearDep.loc.index = -1; - parser.state.module.addPresentationalDependency(clearDep); - const sideEffectDep = new HarmonyImportSideEffectDependency( - source, - parser.state.lastHarmonyImportOrder, - getAssertions(statement) - ); - sideEffectDep.loc = Object.create(statement.loc); - sideEffectDep.loc.index = -1; - parser.state.current.addDependency(sideEffectDep); - return true; - } - ); - parser.hooks.exportExpression.tap( - "HarmonyExportDependencyParserPlugin", - (statement, expr) => { - const isFunctionDeclaration = expr.type === "FunctionDeclaration"; - const comments = parser.getComments([ - statement.range[0], - expr.range[0] - ]); - const dep = new HarmonyExportExpressionDependency( - expr.range, - statement.range, - comments - .map(c => { - switch (c.type) { - case "Block": - return `/*${c.value}*/`; - case "Line": - return `//${c.value}\n`; - } - return ""; - }) - .join(""), - expr.type.endsWith("Declaration") && expr.id - ? expr.id.name - : isFunctionDeclaration - ? { - id: expr.id ? expr.id.name : undefined, - range: [ - expr.range[0], - expr.params.length > 0 - ? expr.params[0].range[0] - : expr.body.range[0] - ], - prefix: `${expr.async ? "async " : ""}function${ - expr.generator ? "*" : "" - } `, - suffix: `(${expr.params.length > 0 ? "" : ") "}` - } - : undefined - ); - dep.loc = Object.create(statement.loc); - dep.loc.index = -1; - parser.state.current.addDependency(dep); - InnerGraph.addVariableUsage( - parser, - expr.type.endsWith("Declaration") && expr.id - ? expr.id.name - : "*default*", - "default" - ); - return true; - } - ); - parser.hooks.exportSpecifier.tap( - "HarmonyExportDependencyParserPlugin", - (statement, id, name, idx) => { - const settings = parser.getTagData(id, harmonySpecifierTag); - let dep; - const harmonyNamedExports = (parser.state.harmonyNamedExports = - parser.state.harmonyNamedExports || new Set()); - harmonyNamedExports.add(name); - InnerGraph.addVariableUsage(parser, id, name); - if (settings) { - dep = new HarmonyExportImportedSpecifierDependency( - settings.source, - settings.sourceOrder, - settings.ids, - name, - harmonyNamedExports, - null, - exportPresenceMode, - null, - settings.assertions - ); - } else { - dep = new HarmonyExportSpecifierDependency(id, name); - } - dep.loc = Object.create(statement.loc); - dep.loc.index = idx; - parser.state.current.addDependency(dep); - return true; - } - ); - parser.hooks.exportImportSpecifier.tap( - "HarmonyExportDependencyParserPlugin", - (statement, source, id, name, idx) => { - const harmonyNamedExports = (parser.state.harmonyNamedExports = - parser.state.harmonyNamedExports || new Set()); - let harmonyStarExports = null; - if (name) { - harmonyNamedExports.add(name); - } else { - harmonyStarExports = parser.state.harmonyStarExports = - parser.state.harmonyStarExports || new HarmonyStarExportsList(); - } - const dep = new HarmonyExportImportedSpecifierDependency( - source, - parser.state.lastHarmonyImportOrder, - id ? [id] : [], - name, - harmonyNamedExports, - harmonyStarExports && harmonyStarExports.slice(), - exportPresenceMode, - harmonyStarExports - ); - if (harmonyStarExports) { - harmonyStarExports.push(dep); - } - dep.loc = Object.create(statement.loc); - dep.loc.index = idx; - parser.state.current.addDependency(dep); - return true; + globalThis: v(0, 43), + const: v(0, 15), + templateLiteral: v(0, 13), + optionalChaining: v(0, 44), + arrowFunction: v(0, 15), + forOf: v(0, 13), + destructuring: v(0, 15), + bigIntLiteral: v(0, 32), + dynamicImport: v(0, 43), + dynamicImportInWorker: major ? false : undefined, + module: v(0, 43) + }; + } + ], + [ + "esX", + "EcmaScript in this version. Examples: es2020, es5.", + /^es(\d+)$/, + version => { + let v = +version; + if (v < 1000) v = v + 2009; + return { + const: v >= 2015, + templateLiteral: v >= 2015, + optionalChaining: v >= 2020, + arrowFunction: v >= 2015, + forOf: v >= 2015, + destructuring: v >= 2015, + module: v >= 2015, + globalThis: v >= 2020, + bigIntLiteral: v >= 2020, + dynamicImport: v >= 2020, + dynamicImportInWorker: v >= 2020 + }; + } + ] +]; + +/** + * @param {string} target the target + * @param {string} context the context directory + * @returns {TargetProperties} target properties + */ +const getTargetProperties = (target, context) => { + for (const [, , regExp, handler] of TARGETS) { + const match = regExp.exec(target); + if (match) { + const [, ...args] = match; + const result = handler(...args, context); + if (result) return result; + } + } + throw new Error( + `Unknown target '${target}'. The following targets are supported:\n${TARGETS.map( + ([name, description]) => `* ${name}: ${description}` + ).join("\n")}` + ); +}; + +const mergeTargetProperties = targetProperties => { + const keys = new Set(); + for (const tp of targetProperties) { + for (const key of Object.keys(tp)) { + keys.add(key); + } + } + const result = {}; + for (const key of keys) { + let hasTrue = false; + let hasFalse = false; + for (const tp of targetProperties) { + const value = tp[key]; + switch (value) { + case true: + hasTrue = true; + break; + case false: + hasFalse = true; + break; } - ); + } + if (hasTrue || hasFalse) + result[key] = hasFalse && hasTrue ? null : hasTrue ? true : false; } + return /** @type {TargetProperties} */ (result); +}; + +/** + * @param {string[]} targets the targets + * @param {string} context the context directory + * @returns {TargetProperties} target properties + */ +const getTargetsProperties = (targets, context) => { + return mergeTargetProperties( + targets.map(t => getTargetProperties(t, context)) + ); }; +exports.getDefaultTarget = getDefaultTarget; +exports.getTargetProperties = getTargetProperties; +exports.getTargetsProperties = getTargetsProperties; + /***/ }), -/***/ 51340: +/***/ 64813: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr */ -const ConcatenationScope = __webpack_require__(98229); -const RuntimeGlobals = __webpack_require__(16475); +const Dependency = __webpack_require__(54912); const makeSerializable = __webpack_require__(33032); -const HarmonyExportInitFragment = __webpack_require__(89500); -const NullDependency = __webpack_require__(31830); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("./ContainerEntryModule").ExposeOptions} ExposeOptions */ -class HarmonyExportExpressionDependency extends NullDependency { - constructor(range, rangeStatement, prefix, declarationId) { +class ContainerEntryDependency extends Dependency { + /** + * @param {string} name entry name + * @param {[string, ExposeOptions][]} exposes list of exposed modules + * @param {string} shareScope name of the share scope + */ + constructor(name, exposes, shareScope) { super(); - this.range = range; - this.rangeStatement = rangeStatement; - this.prefix = prefix; - this.declarationId = declarationId; + this.name = name; + this.exposes = exposes; + this.shareScope = shareScope; + } + + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + return `container-entry-${this.name}`; } get type() { - return "harmony export expression"; + return "container entry"; + } + + get category() { + return "esm"; } +} + +makeSerializable( + ContainerEntryDependency, + "webpack/lib/container/ContainerEntryDependency" +); + +module.exports = ContainerEntryDependency; + + +/***/ }), + +/***/ 80580: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr +*/ + + + +const { OriginalSource, RawSource } = __webpack_require__(51255); +const AsyncDependenciesBlock = __webpack_require__(47736); +const Module = __webpack_require__(73208); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const StaticExportsDependency = __webpack_require__(91418); +const makeSerializable = __webpack_require__(33032); +const ContainerExposedDependency = __webpack_require__(72374); + +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("./ContainerEntryDependency")} ContainerEntryDependency */ + +/** + * @typedef {Object} ExposeOptions + * @property {string[]} import requests to exposed modules (last one is exported) + * @property {string} name custom chunk name for the exposed module + */ + +const SOURCE_TYPES = new Set(["javascript"]); +class ContainerEntryModule extends Module { /** - * Returns the exported names - * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names + * @param {string} name container entry name + * @param {[string, ExposeOptions][]} exposes list of exposed modules + * @param {string} shareScope name of the share scope */ - getExports(moduleGraph) { - return { - exports: ["default"], - priority: 1, - terminalBinding: true, - dependencies: undefined - }; + constructor(name, exposes, shareScope) { + super("javascript/dynamic", null); + this._name = name; + this._exposes = exposes; + this._shareScope = shareScope; } /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this dependency connects the module to referencing modules + * @returns {Set} types available (do not mutate) */ - getModuleEvaluationSideEffectsState(moduleGraph) { - // The expression/declaration is already covered by SideEffectsFlagPlugin - return false; + getSourceTypes() { + return SOURCE_TYPES; } - serialize(context) { - const { write } = context; - write(this.range); - write(this.rangeStatement); - write(this.prefix); - write(this.declarationId); - super.serialize(context); + /** + * @returns {string} a unique identifier of the module + */ + identifier() { + return `container entry (${this._shareScope}) ${JSON.stringify( + this._exposes + )}`; } - deserialize(context) { - const { read } = context; - this.range = read(); - this.rangeStatement = read(); - this.prefix = read(); - this.declarationId = read(); - super.deserialize(context); + /** + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + return `container entry`; } -} -makeSerializable( - HarmonyExportExpressionDependency, - "webpack/lib/dependencies/HarmonyExportExpressionDependency" -); + /** + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion + */ + libIdent(options) { + return `${this.layer ? `(${this.layer})/` : ""}webpack/container/entry/${ + this._name + }`; + } -HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTemplate extends ( - NullDependency.Template -) { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild * @returns {void} */ - apply( - dependency, - source, - { - module, - moduleGraph, - runtimeTemplate, - runtimeRequirements, - initFragments, - runtime, - concatenationScope - } - ) { - const dep = /** @type {HarmonyExportExpressionDependency} */ (dependency); - const { declarationId } = dep; - const exportsName = module.exportsArgument; - if (declarationId) { - let name; - if (typeof declarationId === "string") { - name = declarationId; - } else { - name = ConcatenationScope.DEFAULT_EXPORT; - source.replace( - declarationId.range[0], - declarationId.range[1] - 1, - `${declarationId.prefix}${name}${declarationId.suffix}` - ); - } + needBuild(context, callback) { + return callback(null, !this.buildMeta); + } - if (concatenationScope) { - concatenationScope.registerExport("default", name); - } else { - const used = moduleGraph - .getExportsInfo(module) - .getUsedName("default", runtime); - if (used) { - const map = new Map(); - map.set(used, `/* export default binding */ ${name}`); - initFragments.push(new HarmonyExportInitFragment(exportsName, map)); - } - } + /** + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + this.buildMeta = {}; + this.buildInfo = { + strict: true, + topLevelDeclarations: new Set(["moduleMap", "get", "init"]) + }; + this.buildMeta.exportsType = "namespace"; - source.replace( - dep.rangeStatement[0], - dep.range[0] - 1, - `/* harmony default export */ ${dep.prefix}` + this.clearDependenciesAndBlocks(); + + for (const [name, options] of this._exposes) { + const block = new AsyncDependenciesBlock( + { + name: options.name + }, + { name }, + options.import[options.import.length - 1] ); - } else { - let content; - const name = ConcatenationScope.DEFAULT_EXPORT; - if (runtimeTemplate.supportsConst()) { - content = `/* harmony default export */ const ${name} = `; - if (concatenationScope) { - concatenationScope.registerExport("default", name); - } else { - const used = moduleGraph - .getExportsInfo(module) - .getUsedName("default", runtime); - if (used) { - runtimeRequirements.add(RuntimeGlobals.exports); - const map = new Map(); - map.set(used, name); - initFragments.push(new HarmonyExportInitFragment(exportsName, map)); - } else { - content = `/* unused harmony default export */ var ${name} = `; - } - } - } else if (concatenationScope) { - content = `/* harmony default export */ var ${name} = `; - concatenationScope.registerExport("default", name); - } else { - const used = moduleGraph - .getExportsInfo(module) - .getUsedName("default", runtime); - if (used) { - runtimeRequirements.add(RuntimeGlobals.exports); - // This is a little bit incorrect as TDZ is not correct, but we can't use const. - content = `/* harmony default export */ ${exportsName}[${JSON.stringify( - used - )}] = `; - } else { - content = `/* unused harmony default export */ var ${name} = `; - } - } + let idx = 0; + for (const request of options.import) { + const dep = new ContainerExposedDependency(name, request); + dep.loc = { + name, + index: idx++ + }; - if (dep.range) { - source.replace( - dep.rangeStatement[0], - dep.range[0] - 1, - content + "(" + dep.prefix - ); - source.replace(dep.range[1], dep.rangeStatement[1] - 0.5, ");"); - return; + block.addDependency(dep); } - - source.replace(dep.rangeStatement[0], dep.rangeStatement[1] - 1, content); + this.addBlock(block); } - } -}; + this.addDependency(new StaticExportsDependency(["get", "init"], false)); -module.exports = HarmonyExportExpressionDependency; + callback(); + } + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration({ moduleGraph, chunkGraph, runtimeTemplate }) { + const sources = new Map(); + const runtimeRequirements = new Set([ + RuntimeGlobals.definePropertyGetters, + RuntimeGlobals.hasOwnProperty, + RuntimeGlobals.exports + ]); + const getters = []; -/***/ }), + for (const block of this.blocks) { + const { dependencies } = block; -/***/ 38873: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + const modules = dependencies.map(dependency => { + const dep = /** @type {ContainerExposedDependency} */ (dependency); + return { + name: dep.exposedName, + module: moduleGraph.getModule(dep), + request: dep.userRequest + }; + }); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + let str; + if (modules.some(m => !m.module)) { + str = runtimeTemplate.throwMissingModuleErrorBlock({ + request: modules.map(m => m.request).join(", ") + }); + } else { + str = `return ${runtimeTemplate.blockPromise({ + block, + message: "", + chunkGraph, + runtimeRequirements + })}.then(${runtimeTemplate.returningFunction( + runtimeTemplate.returningFunction( + `(${modules + .map(({ module, request }) => + runtimeTemplate.moduleRaw({ + module, + chunkGraph, + request, + weak: false, + runtimeRequirements + }) + ) + .join(", ")})` + ) + )});`; + } + getters.push( + `${JSON.stringify(modules[0].name)}: ${runtimeTemplate.basicFunction( + "", + str + )}` + ); + } -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); + const source = Template.asString([ + `var moduleMap = {`, + Template.indent(getters.join(",\n")), + "};", + `var get = ${runtimeTemplate.basicFunction("module, getScope", [ + `${RuntimeGlobals.currentRemoteGetScope} = getScope;`, + // reusing the getScope variable to avoid creating a new var (and module is also used later) + "getScope = (", + Template.indent([ + `${RuntimeGlobals.hasOwnProperty}(moduleMap, module)`, + Template.indent([ + "? moduleMap[module]()", + `: Promise.resolve().then(${runtimeTemplate.basicFunction( + "", + "throw new Error('Module \"' + module + '\" does not exist in container.');" + )})` + ]) + ]), + ");", + `${RuntimeGlobals.currentRemoteGetScope} = undefined;`, + "return getScope;" + ])};`, + `var init = ${runtimeTemplate.basicFunction("shareScope, initScope", [ + `if (!${RuntimeGlobals.shareScopeMap}) return;`, + `var name = ${JSON.stringify(this._shareScope)}`, + `var oldScope = ${RuntimeGlobals.shareScopeMap}[name];`, + `if(oldScope && oldScope !== shareScope) throw new Error("Container initialization failed as it has already been initialized with a different share scope");`, + `${RuntimeGlobals.shareScopeMap}[name] = shareScope;`, + `return ${RuntimeGlobals.initializeSharing}(name, initScope);` + ])};`, + "", + "// This exports getters to disallow modifications", + `${RuntimeGlobals.definePropertyGetters}(exports, {`, + Template.indent([ + `get: ${runtimeTemplate.returningFunction("get")},`, + `init: ${runtimeTemplate.returningFunction("init")}` + ]), + "});" + ]); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + sources.set( + "javascript", + this.useSourceMap || this.useSimpleSourceMap + ? new OriginalSource(source, "webpack/container-entry") + : new RawSource(source) + ); -class HarmonyExportHeaderDependency extends NullDependency { - constructor(range, rangeStatement) { - super(); - this.range = range; - this.rangeStatement = rangeStatement; + return { + sources, + runtimeRequirements + }; } - get type() { - return "harmony export header"; + /** + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + return 42; } serialize(context) { const { write } = context; - write(this.range); - write(this.rangeStatement); + write(this._name); + write(this._exposes); + write(this._shareScope); super.serialize(context); } - deserialize(context) { + static deserialize(context) { const { read } = context; - this.range = read(); - this.rangeStatement = read(); - super.deserialize(context); + const obj = new ContainerEntryModule(read(), read(), read()); + obj.deserialize(context); + return obj; } } makeSerializable( - HarmonyExportHeaderDependency, - "webpack/lib/dependencies/HarmonyExportHeaderDependency" + ContainerEntryModule, + "webpack/lib/container/ContainerEntryModule" ); -HarmonyExportHeaderDependency.Template = class HarmonyExportDependencyTemplate extends ( - NullDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, templateContext) { - const dep = /** @type {HarmonyExportHeaderDependency} */ (dependency); - const content = ""; - const replaceUntil = dep.range - ? dep.range[0] - 1 - : dep.rangeStatement[1] - 1; - source.replace(dep.rangeStatement[0], replaceUntil, content); - } -}; - -module.exports = HarmonyExportHeaderDependency; +module.exports = ContainerEntryModule; /***/ }), -/***/ 67157: +/***/ 76398: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr */ -const Dependency = __webpack_require__(54912); -const { UsageState } = __webpack_require__(63686); -const HarmonyLinkingError = __webpack_require__(97511); -const InitFragment = __webpack_require__(55870); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const { countIterable } = __webpack_require__(39104); -const { first, combine } = __webpack_require__(93347); -const makeSerializable = __webpack_require__(33032); -const propertyAccess = __webpack_require__(54190); -const { getRuntimeKey, keyToRuntime } = __webpack_require__(17156); -const HarmonyExportInitFragment = __webpack_require__(89500); -const HarmonyImportDependency = __webpack_require__(57154); -const processExportInfo = __webpack_require__(55207); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ExportsInfo")} ExportsInfo */ -/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - -/** @typedef {"missing"|"unused"|"empty-star"|"reexport-dynamic-default"|"reexport-named-default"|"reexport-namespace-object"|"reexport-fake-namespace-object"|"reexport-undefined"|"normal-reexport"|"dynamic-reexport"} ExportModeType */ - -const { ExportPresenceModes } = HarmonyImportDependency; +const ModuleFactory = __webpack_require__(51010); +const ContainerEntryModule = __webpack_require__(80580); -const idsSymbol = Symbol("HarmonyExportImportedSpecifierDependency.ids"); +/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ +/** @typedef {import("../ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ +/** @typedef {import("./ContainerEntryDependency")} ContainerEntryDependency */ -class NormalReexportItem { +module.exports = class ContainerEntryModuleFactory extends ModuleFactory { /** - * @param {string} name export name - * @param {string[]} ids reexported ids from other module - * @param {ExportInfo} exportInfo export info from other module - * @param {boolean} checked true, if it should be checked at runtime if this export exists - * @param {boolean} hidden true, if it is hidden behind another active export in the same module + * @param {ModuleFactoryCreateData} data data object + * @param {function(Error=, ModuleFactoryResult=): void} callback callback + * @returns {void} */ - constructor(name, ids, exportInfo, checked, hidden) { - this.name = name; - this.ids = ids; - this.exportInfo = exportInfo; - this.checked = checked; - this.hidden = hidden; + create({ dependencies: [dependency] }, callback) { + const dep = /** @type {ContainerEntryDependency} */ (dependency); + callback(null, { + module: new ContainerEntryModule(dep.name, dep.exposes, dep.shareScope) + }); } -} - -class ExportMode { - /** - * @param {ExportModeType} type type of the mode - */ - constructor(type) { - /** @type {ExportModeType} */ - this.type = type; +}; - // for "normal-reexport": - /** @type {NormalReexportItem[] | null} */ - this.items = null; - // for "reexport-named-default" | "reexport-fake-namespace-object" | "reexport-namespace-object" - /** @type {string|null} */ - this.name = null; - /** @type {ExportInfo | null} */ - this.partialNamespaceExportInfo = null; +/***/ }), - // for "dynamic-reexport": - /** @type {Set | null} */ - this.ignored = null; +/***/ 72374: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // for "dynamic-reexport" | "empty-star": - /** @type {Set | null} */ - this.hidden = null; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr +*/ - // for "missing": - /** @type {string | null} */ - this.userRequest = null; - // for "reexport-fake-namespace-object": - /** @type {number} */ - this.fakeType = 0; - } -} -const determineExportAssignments = ( - moduleGraph, - dependencies, - additionalDependency -) => { - const names = new Set(); - const dependencyIndices = []; +const ModuleDependency = __webpack_require__(80321); +const makeSerializable = __webpack_require__(33032); - if (additionalDependency) { - dependencies = dependencies.concat(additionalDependency); +class ContainerExposedDependency extends ModuleDependency { + /** + * @param {string} exposedName public name + * @param {string} request request to module + */ + constructor(exposedName, request) { + super(request); + this.exposedName = exposedName; } - for (const dep of dependencies) { - const i = dependencyIndices.length; - dependencyIndices[i] = names.size; - const otherImportedModule = moduleGraph.getModule(dep); - if (otherImportedModule) { - const exportsInfo = moduleGraph.getExportsInfo(otherImportedModule); - for (const exportInfo of exportsInfo.exports) { - if ( - exportInfo.provided === true && - exportInfo.name !== "default" && - !names.has(exportInfo.name) - ) { - names.add(exportInfo.name); - dependencyIndices[i] = names.size; - } - } - } + get type() { + return "container exposed"; } - dependencyIndices.push(names.size); - - return { names: Array.from(names), dependencyIndices }; -}; -const findDependencyForName = ( - { names, dependencyIndices }, - name, - dependencies -) => { - const dependenciesIt = dependencies[Symbol.iterator](); - const dependencyIndicesIt = dependencyIndices[Symbol.iterator](); - let dependenciesItResult = dependenciesIt.next(); - let dependencyIndicesItResult = dependencyIndicesIt.next(); - if (dependencyIndicesItResult.done) return; - for (let i = 0; i < names.length; i++) { - while (i >= dependencyIndicesItResult.value) { - dependenciesItResult = dependenciesIt.next(); - dependencyIndicesItResult = dependencyIndicesIt.next(); - if (dependencyIndicesItResult.done) return; - } - if (names[i] === name) return dependenciesItResult.value; + get category() { + return "esm"; } - return undefined; -}; - -/** - * @param {ModuleGraph} moduleGraph the module graph - * @param {HarmonyExportImportedSpecifierDependency} dep the dependency - * @param {string} runtimeKey the runtime key - * @returns {ExportMode} the export mode - */ -const getMode = (moduleGraph, dep, runtimeKey) => { - const importedModule = moduleGraph.getModule(dep); - - if (!importedModule) { - const mode = new ExportMode("missing"); - - mode.userRequest = dep.userRequest; - return mode; + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + return `exposed dependency ${this.exposedName}=${this.request}`; } - const name = dep.name; - const runtime = keyToRuntime(runtimeKey); - const parentModule = moduleGraph.getParentModule(dep); - const exportsInfo = moduleGraph.getExportsInfo(parentModule); - - if ( - name - ? exportsInfo.getUsed(name, runtime) === UsageState.Unused - : exportsInfo.isUsed(runtime) === false - ) { - const mode = new ExportMode("unused"); - - mode.name = name || "*"; - - return mode; + serialize(context) { + context.write(this.exposedName); + super.serialize(context); } - const importedExportsType = importedModule.getExportsType( - moduleGraph, - parentModule.buildMeta.strictHarmonyModule - ); - - const ids = dep.getIds(moduleGraph); - - // Special handling for reexporting the default export - // from non-namespace modules - if (name && ids.length > 0 && ids[0] === "default") { - switch (importedExportsType) { - case "dynamic": { - const mode = new ExportMode("reexport-dynamic-default"); - - mode.name = name; - - return mode; - } - case "default-only": - case "default-with-named": { - const exportInfo = exportsInfo.getReadOnlyExportInfo(name); - const mode = new ExportMode("reexport-named-default"); - - mode.name = name; - mode.partialNamespaceExportInfo = exportInfo; - - return mode; - } - } + deserialize(context) { + this.exposedName = context.read(); + super.deserialize(context); } +} - // reexporting with a fixed name - if (name) { - let mode; - const exportInfo = exportsInfo.getReadOnlyExportInfo(name); +makeSerializable( + ContainerExposedDependency, + "webpack/lib/container/ContainerExposedDependency" +); - if (ids.length > 0) { - // export { name as name } - switch (importedExportsType) { - case "default-only": - mode = new ExportMode("reexport-undefined"); - mode.name = name; - break; - default: - mode = new ExportMode("normal-reexport"); - mode.items = [ - new NormalReexportItem(name, ids, exportInfo, false, false) - ]; - break; - } - } else { - // export * as name - switch (importedExportsType) { - case "default-only": - mode = new ExportMode("reexport-fake-namespace-object"); - mode.name = name; - mode.partialNamespaceExportInfo = exportInfo; - mode.fakeType = 0; - break; - case "default-with-named": - mode = new ExportMode("reexport-fake-namespace-object"); - mode.name = name; - mode.partialNamespaceExportInfo = exportInfo; - mode.fakeType = 2; - break; - case "dynamic": - default: - mode = new ExportMode("reexport-namespace-object"); - mode.name = name; - mode.partialNamespaceExportInfo = exportInfo; - } - } +module.exports = ContainerExposedDependency; - return mode; - } - // Star reexporting +/***/ }), - const { ignoredExports, exports, checked, hidden } = dep.getStarReexports( - moduleGraph, - runtime, - exportsInfo, - importedModule - ); - if (!exports) { - // We have too few info about the modules - // Delegate the logic to the runtime code +/***/ 9244: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const mode = new ExportMode("dynamic-reexport"); - mode.ignored = ignoredExports; - mode.hidden = hidden; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr +*/ - return mode; - } - if (exports.size === 0) { - const mode = new ExportMode("empty-star"); - mode.hidden = hidden; - return mode; - } +const createSchemaValidation = __webpack_require__(32540); +const ContainerEntryDependency = __webpack_require__(64813); +const ContainerEntryModuleFactory = __webpack_require__(76398); +const ContainerExposedDependency = __webpack_require__(72374); +const { parseOptions } = __webpack_require__(3083); - const mode = new ExportMode("normal-reexport"); +/** @typedef {import("../../declarations/plugins/container/ContainerPlugin").ContainerPluginOptions} ContainerPluginOptions */ +/** @typedef {import("../Compiler")} Compiler */ - mode.items = Array.from( - exports, - exportName => - new NormalReexportItem( - exportName, - [exportName], - exportsInfo.getReadOnlyExportInfo(exportName), - checked.has(exportName), - false - ) - ); - if (hidden !== undefined) { - for (const exportName of hidden) { - mode.items.push( - new NormalReexportItem( - exportName, - [exportName], - exportsInfo.getReadOnlyExportInfo(exportName), - false, - true - ) - ); - } +const validate = createSchemaValidation( + __webpack_require__(9504), + () => __webpack_require__(84899), + { + name: "Container Plugin", + baseDataPath: "options" } +); - return mode; -}; +const PLUGIN_NAME = "ContainerPlugin"; -class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { +class ContainerPlugin { /** - * @param {string} request the request string - * @param {number} sourceOrder the order in the original source file - * @param {string[]} ids the requested export name of the imported module - * @param {string | null} name the export name of for this module - * @param {Set} activeExports other named exports in the module - * @param {ReadonlyArray | Iterable} otherStarExports other star exports in the module before this import - * @param {number} exportPresenceMode mode of checking export names - * @param {HarmonyStarExportsList} allStarExports all star exports in the module - * @param {Record=} assertions import assertions + * @param {ContainerPluginOptions} options options */ - constructor( - request, - sourceOrder, - ids, - name, - activeExports, - otherStarExports, - exportPresenceMode, - allStarExports, - assertions - ) { - super(request, sourceOrder, assertions); + constructor(options) { + validate(options); - this.ids = ids; - this.name = name; - this.activeExports = activeExports; - this.otherStarExports = otherStarExports; - this.exportPresenceMode = exportPresenceMode; - this.allStarExports = allStarExports; + this._options = { + name: options.name, + shareScope: options.shareScope || "default", + library: options.library || { + type: "var", + name: options.name + }, + runtime: options.runtime, + filename: options.filename || undefined, + exposes: parseOptions( + options.exposes, + item => ({ + import: Array.isArray(item) ? item : [item], + name: undefined + }), + item => ({ + import: Array.isArray(item.import) ? item.import : [item.import], + name: item.name || undefined + }) + ) + }; } /** - * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - couldAffectReferencingModule() { - return Dependency.TRANSITIVE; + apply(compiler) { + const { name, exposes, shareScope, filename, library, runtime } = + this._options; + + compiler.options.output.enabledLibraryTypes.push(library.type); + + compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => { + const dep = new ContainerEntryDependency(name, exposes, shareScope); + dep.loc = { name }; + compilation.addEntry( + compilation.options.context, + dep, + { + name, + filename, + runtime, + library + }, + error => { + if (error) return callback(error); + callback(); + } + ); + }); + + compiler.hooks.thisCompilation.tap( + PLUGIN_NAME, + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + ContainerEntryDependency, + new ContainerEntryModuleFactory() + ); + + compilation.dependencyFactories.set( + ContainerExposedDependency, + normalModuleFactory + ); + } + ); } +} - // TODO webpack 6 remove - get id() { - throw new Error("id was renamed to ids and type changed to string[]"); - } +module.exports = ContainerPlugin; - // TODO webpack 6 remove - getId() { - throw new Error("id was renamed to ids and type changed to string[]"); - } - // TODO webpack 6 remove - setId() { - throw new Error("id was renamed to ids and type changed to string[]"); - } +/***/ }), - get type() { - return "harmony export imported specifier"; - } +/***/ 95757: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {string[]} the imported id - */ - getIds(moduleGraph) { - return moduleGraph.getMeta(this)[idsSymbol] || this.ids; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy +*/ - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {string[]} ids the imported ids - * @returns {void} - */ - setIds(moduleGraph, ids) { - moduleGraph.getMeta(this)[idsSymbol] = ids; + + +const ExternalsPlugin = __webpack_require__(6652); +const RuntimeGlobals = __webpack_require__(16475); +const createSchemaValidation = __webpack_require__(32540); +const FallbackDependency = __webpack_require__(57764); +const FallbackItemDependency = __webpack_require__(29593); +const FallbackModuleFactory = __webpack_require__(4112); +const RemoteModule = __webpack_require__(62916); +const RemoteRuntimeModule = __webpack_require__(88288); +const RemoteToExternalDependency = __webpack_require__(14389); +const { parseOptions } = __webpack_require__(3083); + +/** @typedef {import("../../declarations/plugins/container/ContainerReferencePlugin").ContainerReferencePluginOptions} ContainerReferencePluginOptions */ +/** @typedef {import("../../declarations/plugins/container/ContainerReferencePlugin").RemotesConfig} RemotesConfig */ +/** @typedef {import("../Compiler")} Compiler */ + +const validate = createSchemaValidation( + __webpack_require__(95122), + () => + __webpack_require__(66681), + { + name: "Container Reference Plugin", + baseDataPath: "options" } +); +const slashCode = "/".charCodeAt(0); + +class ContainerReferencePlugin { /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {RuntimeSpec} runtime the runtime - * @returns {ExportMode} the export mode + * @param {ContainerReferencePluginOptions} options options */ - getMode(moduleGraph, runtime) { - return moduleGraph.dependencyCacheProvide( - this, - getRuntimeKey(runtime), - getMode + constructor(options) { + validate(options); + + this._remoteType = options.remoteType; + this._remotes = parseOptions( + options.remotes, + item => ({ + external: Array.isArray(item) ? item : [item], + shareScope: options.shareScope || "default" + }), + item => ({ + external: Array.isArray(item.external) + ? item.external + : [item.external], + shareScope: item.shareScope || options.shareScope || "default" + }) ); } /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {RuntimeSpec} runtime the runtime - * @param {ExportsInfo} exportsInfo exports info about the current module (optional) - * @param {Module} importedModule the imported module (optional) - * @returns {{exports?: Set, checked?: Set, ignoredExports: Set, hidden?: Set}} information + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - getStarReexports( - moduleGraph, - runtime, - exportsInfo = moduleGraph.getExportsInfo(moduleGraph.getParentModule(this)), - importedModule = moduleGraph.getModule(this) - ) { - const importedExportsInfo = moduleGraph.getExportsInfo(importedModule); - - const noExtraExports = - importedExportsInfo.otherExportsInfo.provided === false; - const noExtraImports = - exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused; - - const ignoredExports = new Set(["default", ...this.activeExports]); + apply(compiler) { + const { _remotes: remotes, _remoteType: remoteType } = this; - let hiddenExports = undefined; - const otherStarExports = - this._discoverActiveExportsFromOtherStarExports(moduleGraph); - if (otherStarExports !== undefined) { - hiddenExports = new Set(); - for (let i = 0; i < otherStarExports.namesSlice; i++) { - hiddenExports.add(otherStarExports.names[i]); + /** @type {Record} */ + const remoteExternals = {}; + for (const [key, config] of remotes) { + let i = 0; + for (const external of config.external) { + if (external.startsWith("internal ")) continue; + remoteExternals[ + `webpack/container/reference/${key}${i ? `/fallback-${i}` : ""}` + ] = external; + i++; } - for (const e of ignoredExports) hiddenExports.delete(e); } - if (!noExtraExports && !noExtraImports) { - return { - ignoredExports, - hidden: hiddenExports - }; - } + new ExternalsPlugin(remoteType, remoteExternals).apply(compiler); - /** @type {Set} */ - const exports = new Set(); - /** @type {Set} */ - const checked = new Set(); - /** @type {Set} */ - const hidden = hiddenExports !== undefined ? new Set() : undefined; + compiler.hooks.compilation.tap( + "ContainerReferencePlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + RemoteToExternalDependency, + normalModuleFactory + ); - if (noExtraImports) { - for (const exportInfo of exportsInfo.orderedExports) { - const name = exportInfo.name; - if (ignoredExports.has(name)) continue; - if (exportInfo.getUsed(runtime) === UsageState.Unused) continue; - const importedExportInfo = - importedExportsInfo.getReadOnlyExportInfo(name); - if (importedExportInfo.provided === false) continue; - if (hiddenExports !== undefined && hiddenExports.has(name)) { - hidden.add(name); - continue; - } - exports.add(name); - if (importedExportInfo.provided === true) continue; - checked.add(name); - } - } else if (noExtraExports) { - for (const importedExportInfo of importedExportsInfo.orderedExports) { - const name = importedExportInfo.name; - if (ignoredExports.has(name)) continue; - if (importedExportInfo.provided === false) continue; - const exportInfo = exportsInfo.getReadOnlyExportInfo(name); - if (exportInfo.getUsed(runtime) === UsageState.Unused) continue; - if (hiddenExports !== undefined && hiddenExports.has(name)) { - hidden.add(name); - continue; - } - exports.add(name); - if (importedExportInfo.provided === true) continue; - checked.add(name); - } - } + compilation.dependencyFactories.set( + FallbackItemDependency, + normalModuleFactory + ); - return { ignoredExports, exports, checked, hidden }; - } + compilation.dependencyFactories.set( + FallbackDependency, + new FallbackModuleFactory() + ); - /** - * @param {ModuleGraph} moduleGraph module graph - * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active - */ - getCondition(moduleGraph) { - return (connection, runtime) => { - const mode = this.getMode(moduleGraph, runtime); - return mode.type !== "unused" && mode.type !== "empty-star"; - }; - } + normalModuleFactory.hooks.factorize.tap( + "ContainerReferencePlugin", + data => { + if (!data.request.includes("!")) { + for (const [key, config] of remotes) { + if ( + data.request.startsWith(`${key}`) && + (data.request.length === key.length || + data.request.charCodeAt(key.length) === slashCode) + ) { + return new RemoteModule( + data.request, + config.external.map((external, i) => + external.startsWith("internal ") + ? external.slice(9) + : `webpack/container/reference/${key}${ + i ? `/fallback-${i}` : "" + }` + ), + `.${data.request.slice(key.length)}`, + config.shareScope + ); + } + } + } + } + ); - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this dependency connects the module to referencing modules - */ - getModuleEvaluationSideEffectsState(moduleGraph) { - return false; + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("ContainerReferencePlugin", (chunk, set) => { + set.add(RuntimeGlobals.module); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + set.add(RuntimeGlobals.hasOwnProperty); + set.add(RuntimeGlobals.initializeSharing); + set.add(RuntimeGlobals.shareScopeMap); + compilation.addRuntimeModule(chunk, new RemoteRuntimeModule()); + }); + } + ); } +} - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - const mode = this.getMode(moduleGraph, runtime); +module.exports = ContainerReferencePlugin; - switch (mode.type) { - case "missing": - case "unused": - case "empty-star": - case "reexport-undefined": - return Dependency.NO_EXPORTS_REFERENCED; - case "reexport-dynamic-default": - return Dependency.EXPORTS_OBJECT_REFERENCED; +/***/ }), - case "reexport-named-default": { - if (!mode.partialNamespaceExportInfo) - return Dependency.EXPORTS_OBJECT_REFERENCED; - /** @type {string[][]} */ - const referencedExports = []; - processExportInfo( - runtime, - referencedExports, - [], - /** @type {ExportInfo} */ (mode.partialNamespaceExportInfo) - ); - return referencedExports; - } +/***/ 57764: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - case "reexport-namespace-object": - case "reexport-fake-namespace-object": { - if (!mode.partialNamespaceExportInfo) - return Dependency.EXPORTS_OBJECT_REFERENCED; - /** @type {string[][]} */ - const referencedExports = []; - processExportInfo( - runtime, - referencedExports, - [], - /** @type {ExportInfo} */ (mode.partialNamespaceExportInfo), - mode.type === "reexport-fake-namespace-object" - ); - return referencedExports; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - case "dynamic-reexport": - return Dependency.EXPORTS_OBJECT_REFERENCED; - case "normal-reexport": { - const referencedExports = []; - for (const { ids, exportInfo, hidden } of mode.items) { - if (hidden) continue; - processExportInfo(runtime, referencedExports, ids, exportInfo, false); - } - return referencedExports; - } - default: - throw new Error(`Unknown mode ${mode.type}`); - } +const Dependency = __webpack_require__(54912); +const makeSerializable = __webpack_require__(33032); + +class FallbackDependency extends Dependency { + constructor(requests) { + super(); + this.requests = requests; } /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {{ names: string[], namesSlice: number, dependencyIndices: number[], dependencyIndex: number } | undefined} exported names and their origin dependency + * @returns {string | null} an identifier to merge equal requests */ - _discoverActiveExportsFromOtherStarExports(moduleGraph) { - if (!this.otherStarExports) return undefined; - - const i = - "length" in this.otherStarExports - ? this.otherStarExports.length - : countIterable(this.otherStarExports); - if (i === 0) return undefined; + getResourceIdentifier() { + return `fallback ${this.requests.join(" ")}`; + } - if (this.allStarExports) { - const { names, dependencyIndices } = moduleGraph.cached( - determineExportAssignments, - this.allStarExports.dependencies - ); + get type() { + return "fallback"; + } - return { - names, - namesSlice: dependencyIndices[i - 1], - dependencyIndices, - dependencyIndex: i - }; - } + get category() { + return "esm"; + } - const { names, dependencyIndices } = moduleGraph.cached( - determineExportAssignments, - this.otherStarExports, - this - ); + serialize(context) { + const { write } = context; + write(this.requests); + super.serialize(context); + } - return { - names, - namesSlice: dependencyIndices[i - 1], - dependencyIndices, - dependencyIndex: i - }; + static deserialize(context) { + const { read } = context; + const obj = new FallbackDependency(read()); + obj.deserialize(context); + return obj; } +} - /** - * Returns the exported names - * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names - */ - getExports(moduleGraph) { - const mode = this.getMode(moduleGraph, undefined); +makeSerializable( + FallbackDependency, + "webpack/lib/container/FallbackDependency" +); - switch (mode.type) { - case "missing": - return undefined; - case "dynamic-reexport": { - const from = moduleGraph.getConnection(this); - return { - exports: true, - from, - canMangle: false, - excludeExports: mode.hidden - ? combine(mode.ignored, mode.hidden) - : mode.ignored, - hideExports: mode.hidden, - dependencies: [from.module] - }; - } - case "empty-star": - return { - exports: [], - hideExports: mode.hidden, - dependencies: [moduleGraph.getModule(this)] - }; - // falls through - case "normal-reexport": { - const from = moduleGraph.getConnection(this); - return { - exports: Array.from(mode.items, item => ({ - name: item.name, - from, - export: item.ids, - hidden: item.hidden - })), - priority: 1, - dependencies: [from.module] - }; - } - case "reexport-dynamic-default": { - { - const from = moduleGraph.getConnection(this); - return { - exports: [ - { - name: mode.name, - from, - export: ["default"] - } - ], - priority: 1, - dependencies: [from.module] - }; - } - } - case "reexport-undefined": - return { - exports: [mode.name], - dependencies: [moduleGraph.getModule(this)] - }; - case "reexport-fake-namespace-object": { - const from = moduleGraph.getConnection(this); - return { - exports: [ - { - name: mode.name, - from, - export: null, - exports: [ - { - name: "default", - canMangle: false, - from, - export: null - } - ] - } - ], - priority: 1, - dependencies: [from.module] - }; - } - case "reexport-namespace-object": { - const from = moduleGraph.getConnection(this); - return { - exports: [ - { - name: mode.name, - from, - export: null - } - ], - priority: 1, - dependencies: [from.module] - }; - } - case "reexport-named-default": { - const from = moduleGraph.getConnection(this); - return { - exports: [ - { - name: mode.name, - from, - export: ["default"] - } - ], - priority: 1, - dependencies: [from.module] - }; - } - default: - throw new Error(`Unknown mode ${mode.type}`); - } +module.exports = FallbackDependency; + + +/***/ }), + +/***/ 29593: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ModuleDependency = __webpack_require__(80321); +const makeSerializable = __webpack_require__(33032); + +class FallbackItemDependency extends ModuleDependency { + constructor(request) { + super(request); + } + + get type() { + return "fallback item"; + } + + get category() { + return "esm"; } +} + +makeSerializable( + FallbackItemDependency, + "webpack/lib/container/FallbackItemDependency" +); + +module.exports = FallbackItemDependency; + + +/***/ }), + +/***/ 82886: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy +*/ + + + +const { RawSource } = __webpack_require__(51255); +const Module = __webpack_require__(73208); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const makeSerializable = __webpack_require__(33032); +const FallbackItemDependency = __webpack_require__(29593); + +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ + +const TYPES = new Set(["javascript"]); +const RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]); +class FallbackModule extends Module { /** - * @param {ModuleGraph} moduleGraph module graph - * @returns {number} effective mode + * @param {string[]} requests list of requests to choose one */ - _getEffectiveExportPresenceLevel(moduleGraph) { - if (this.exportPresenceMode !== ExportPresenceModes.AUTO) - return this.exportPresenceMode; - return moduleGraph.getParentModule(this).buildMeta.strictHarmonyModule - ? ExportPresenceModes.ERROR - : ExportPresenceModes.WARN; + constructor(requests) { + super("fallback-module"); + this.requests = requests; + this._identifier = `fallback ${this.requests.join(" ")}`; } /** - * Returns warnings - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[]} warnings + * @returns {string} a unique identifier of the module */ - getWarnings(moduleGraph) { - const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); - if (exportsPresence === ExportPresenceModes.WARN) { - return this._getErrors(moduleGraph); - } - return null; + identifier() { + return this._identifier; } /** - * Returns errors - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[]} errors + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module */ - getErrors(moduleGraph) { - const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); - if (exportsPresence === ExportPresenceModes.ERROR) { - return this._getErrors(moduleGraph); - } - return null; + readableIdentifier(requestShortener) { + return this._identifier; } /** - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[] | undefined} errors + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion */ - _getErrors(moduleGraph) { - const ids = this.getIds(moduleGraph); - let errors = this.getLinkingErrors( - moduleGraph, - ids, - `(reexported as '${this.name}')` - ); - if (ids.length === 0 && this.name === null) { - const potentialConflicts = - this._discoverActiveExportsFromOtherStarExports(moduleGraph); - if (potentialConflicts && potentialConflicts.namesSlice > 0) { - const ownNames = new Set( - potentialConflicts.names.slice( - potentialConflicts.namesSlice, - potentialConflicts.dependencyIndices[ - potentialConflicts.dependencyIndex - ] - ) - ); - const importedModule = moduleGraph.getModule(this); - if (importedModule) { - const exportsInfo = moduleGraph.getExportsInfo(importedModule); - const conflicts = new Map(); - for (const exportInfo of exportsInfo.orderedExports) { - if (exportInfo.provided !== true) continue; - if (exportInfo.name === "default") continue; - if (this.activeExports.has(exportInfo.name)) continue; - if (ownNames.has(exportInfo.name)) continue; - const conflictingDependency = findDependencyForName( - potentialConflicts, - exportInfo.name, - this.allStarExports - ? this.allStarExports.dependencies - : [...this.otherStarExports, this] - ); - if (!conflictingDependency) continue; - const target = exportInfo.getTerminalBinding(moduleGraph); - if (!target) continue; - const conflictingModule = moduleGraph.getModule( - conflictingDependency - ); - if (conflictingModule === importedModule) continue; - const conflictingExportInfo = moduleGraph.getExportInfo( - conflictingModule, - exportInfo.name - ); - const conflictingTarget = - conflictingExportInfo.getTerminalBinding(moduleGraph); - if (!conflictingTarget) continue; - if (target === conflictingTarget) continue; - const list = conflicts.get(conflictingDependency.request); - if (list === undefined) { - conflicts.set(conflictingDependency.request, [exportInfo.name]); - } else { - list.push(exportInfo.name); - } - } - for (const [request, exports] of conflicts) { - if (!errors) errors = []; - errors.push( - new HarmonyLinkingError( - `The requested module '${ - this.request - }' contains conflicting star exports for the ${ - exports.length > 1 ? "names" : "name" - } ${exports - .map(e => `'${e}'`) - .join(", ")} with the previous requested module '${request}'` - ) - ); - } - } - } - } - return errors; + libIdent(options) { + return `${this.layer ? `(${this.layer})/` : ""}webpack/container/fallback/${ + this.requests[0] + }/and ${this.requests.length - 1} more`; } - serialize(context) { - const { write, setCircularReference } = context; + /** + * @param {Chunk} chunk the chunk which condition should be checked + * @param {Compilation} compilation the compilation + * @returns {boolean} true, if the chunk is ok for the module + */ + chunkCondition(chunk, { chunkGraph }) { + return chunkGraph.getNumberOfEntryModules(chunk) > 0; + } - setCircularReference(this); - write(this.ids); - write(this.name); - write(this.activeExports); - write(this.otherStarExports); - write(this.exportPresenceMode); - write(this.allStarExports); + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + callback(null, !this.buildInfo); + } - super.serialize(context); + /** + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + this.buildMeta = {}; + this.buildInfo = { + strict: true + }; + + this.clearDependenciesAndBlocks(); + for (const request of this.requests) + this.addDependency(new FallbackItemDependency(request)); + + callback(); } - deserialize(context) { - const { read, setCircularReference } = context; + /** + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + return this.requests.length * 5 + 42; + } - setCircularReference(this); - this.ids = read(); - this.name = read(); - this.activeExports = read(); - this.otherStarExports = read(); - this.exportPresenceMode = read(); - this.allStarExports = read(); + /** + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + return TYPES; + } - super.deserialize(context); + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { + const ids = this.dependencies.map(dep => + chunkGraph.getModuleId(moduleGraph.getModule(dep)) + ); + const code = Template.asString([ + `var ids = ${JSON.stringify(ids)};`, + "var error, result, i = 0;", + `var loop = ${runtimeTemplate.basicFunction("next", [ + "while(i < ids.length) {", + Template.indent([ + "try { next = __webpack_require__(ids[i++]); } catch(e) { return handleError(e); }", + "if(next) return next.then ? next.then(handleResult, handleError) : handleResult(next);" + ]), + "}", + "if(error) throw error;" + ])}`, + `var handleResult = ${runtimeTemplate.basicFunction("result", [ + "if(result) return result;", + "return loop();" + ])};`, + `var handleError = ${runtimeTemplate.basicFunction("e", [ + "error = e;", + "return loop();" + ])};`, + "module.exports = loop();" + ]); + const sources = new Map(); + sources.set("javascript", new RawSource(code)); + return { sources, runtimeRequirements: RUNTIME_REQUIREMENTS }; + } + + serialize(context) { + const { write } = context; + write(this.requests); + super.serialize(context); + } + + static deserialize(context) { + const { read } = context; + const obj = new FallbackModule(read()); + obj.deserialize(context); + return obj; } } -makeSerializable( - HarmonyExportImportedSpecifierDependency, - "webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency" -); +makeSerializable(FallbackModule, "webpack/lib/container/FallbackModule"); -module.exports = HarmonyExportImportedSpecifierDependency; +module.exports = FallbackModule; -HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedSpecifierDependencyTemplate extends ( - HarmonyImportDependency.Template -) { + +/***/ }), + +/***/ 4112: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr +*/ + + + +const ModuleFactory = __webpack_require__(51010); +const FallbackModule = __webpack_require__(82886); + +/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ +/** @typedef {import("../ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ +/** @typedef {import("./FallbackDependency")} FallbackDependency */ + +module.exports = class FallbackModuleFactory extends ModuleFactory { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object + * @param {ModuleFactoryCreateData} data data object + * @param {function(Error=, ModuleFactoryResult=): void} callback callback * @returns {void} */ - apply(dependency, source, templateContext) { - const { moduleGraph, runtime, concatenationScope } = templateContext; + create({ dependencies: [dependency] }, callback) { + const dep = /** @type {FallbackDependency} */ (dependency); + callback(null, { + module: new FallbackModule(dep.requests) + }); + } +}; - const dep = /** @type {HarmonyExportImportedSpecifierDependency} */ ( - dependency - ); - const mode = dep.getMode(moduleGraph, runtime); +/***/ }), - if (concatenationScope) { - switch (mode.type) { - case "reexport-undefined": - concatenationScope.registerRawExport( - mode.name, - "/* reexport non-default export from non-harmony */ undefined" - ); - } - return; - } +/***/ 30569: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (mode.type !== "unused" && mode.type !== "empty-star") { - super.apply(dependency, source, templateContext); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy +*/ - this._addExportFragments( - templateContext.initFragments, - dep, - mode, - templateContext.module, - moduleGraph, - runtime, - templateContext.runtimeTemplate, - templateContext.runtimeRequirements - ); - } - } + +const isValidExternalsType = __webpack_require__(62142); +const SharePlugin = __webpack_require__(26335); +const createSchemaValidation = __webpack_require__(32540); +const ContainerPlugin = __webpack_require__(9244); +const ContainerReferencePlugin = __webpack_require__(95757); + +/** @typedef {import("../../declarations/plugins/container/ModuleFederationPlugin").ExternalsType} ExternalsType */ +/** @typedef {import("../../declarations/plugins/container/ModuleFederationPlugin").ModuleFederationPluginOptions} ModuleFederationPluginOptions */ +/** @typedef {import("../../declarations/plugins/container/ModuleFederationPlugin").Shared} Shared */ +/** @typedef {import("../Compiler")} Compiler */ + +const validate = createSchemaValidation( + __webpack_require__(7467), + () => __webpack_require__(82601), + { + name: "Module Federation Plugin", + baseDataPath: "options" + } +); +class ModuleFederationPlugin { /** - * @param {InitFragment[]} initFragments target array for init fragments - * @param {HarmonyExportImportedSpecifierDependency} dep dependency - * @param {ExportMode} mode the export mode - * @param {Module} module the current module - * @param {ModuleGraph} moduleGraph the module graph - * @param {RuntimeSpec} runtime the runtime - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @param {Set} runtimeRequirements runtime requirements - * @returns {void} + * @param {ModuleFederationPluginOptions} options options */ - _addExportFragments( - initFragments, - dep, - mode, - module, - moduleGraph, - runtime, - runtimeTemplate, - runtimeRequirements - ) { - const importedModule = moduleGraph.getModule(dep); - const importVar = dep.getImportVar(moduleGraph); - - switch (mode.type) { - case "missing": - case "empty-star": - initFragments.push( - new InitFragment( - "/* empty/unused harmony star reexport */\n", - InitFragment.STAGE_HARMONY_EXPORTS, - 1 - ) - ); - break; + constructor(options) { + validate(options); - case "unused": - initFragments.push( - new InitFragment( - `${Template.toNormalComment( - `unused harmony reexport ${mode.name}` - )}\n`, - InitFragment.STAGE_HARMONY_EXPORTS, - 1 - ) - ); - break; + this._options = options; + } - case "reexport-dynamic-default": - initFragments.push( - this.getReexportFragment( - module, - "reexport default from dynamic", - moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), - importVar, - null, - runtimeRequirements - ) - ); - break; + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const { _options: options } = this; + const library = options.library || { type: "var", name: options.name }; + const remoteType = + options.remoteType || + (options.library && isValidExternalsType(options.library.type) + ? /** @type {ExternalsType} */ (options.library.type) + : "script"); + if ( + library && + !compiler.options.output.enabledLibraryTypes.includes(library.type) + ) { + compiler.options.output.enabledLibraryTypes.push(library.type); + } + compiler.hooks.afterPlugins.tap("ModuleFederationPlugin", () => { + if ( + options.exposes && + (Array.isArray(options.exposes) + ? options.exposes.length > 0 + : Object.keys(options.exposes).length > 0) + ) { + new ContainerPlugin({ + name: options.name, + library, + filename: options.filename, + runtime: options.runtime, + exposes: options.exposes + }).apply(compiler); + } + if ( + options.remotes && + (Array.isArray(options.remotes) + ? options.remotes.length > 0 + : Object.keys(options.remotes).length > 0) + ) { + new ContainerReferencePlugin({ + remoteType, + remotes: options.remotes + }).apply(compiler); + } + if (options.shared) { + new SharePlugin({ + shared: options.shared, + shareScope: options.shareScope + }).apply(compiler); + } + }); + } +} - case "reexport-fake-namespace-object": - initFragments.push( - ...this.getReexportFakeNamespaceObjectFragments( - module, - moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), - importVar, - mode.fakeType, - runtimeRequirements - ) - ); - break; +module.exports = ModuleFederationPlugin; - case "reexport-undefined": - initFragments.push( - this.getReexportFragment( - module, - "reexport non-default export from non-harmony", - moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), - "undefined", - "", - runtimeRequirements - ) - ); - break; - case "reexport-named-default": - initFragments.push( - this.getReexportFragment( - module, - "reexport default export from named module", - moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), - importVar, - "", - runtimeRequirements - ) - ); - break; +/***/ }), - case "reexport-namespace-object": - initFragments.push( - this.getReexportFragment( - module, - "reexport module object", - moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), - importVar, - "", - runtimeRequirements - ) - ); - break; +/***/ 62916: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - case "normal-reexport": - for (const { name, ids, checked, hidden } of mode.items) { - if (hidden) continue; - if (checked) { - initFragments.push( - new InitFragment( - "/* harmony reexport (checked) */ " + - this.getConditionalReexportStatement( - module, - name, - importVar, - ids, - runtimeRequirements - ), - moduleGraph.isAsync(importedModule) - ? InitFragment.STAGE_ASYNC_HARMONY_IMPORTS - : InitFragment.STAGE_HARMONY_IMPORTS, - dep.sourceOrder - ) - ); - } else { - initFragments.push( - this.getReexportFragment( - module, - "reexport safe", - moduleGraph.getExportsInfo(module).getUsedName(name, runtime), - importVar, - moduleGraph - .getExportsInfo(importedModule) - .getUsedName(ids, runtime), - runtimeRequirements - ) - ); - } - } - break; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy +*/ - case "dynamic-reexport": { - const ignored = mode.hidden - ? combine(mode.ignored, mode.hidden) - : mode.ignored; - const modern = - runtimeTemplate.supportsConst() && - runtimeTemplate.supportsArrowFunction(); - let content = - "/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};\n" + - `/* harmony reexport (unknown) */ for(${ - modern ? "const" : "var" - } __WEBPACK_IMPORT_KEY__ in ${importVar}) `; - // Filter out exports which are defined by other exports - // and filter out default export because it cannot be reexported with * - if (ignored.size > 1) { - content += - "if(" + - JSON.stringify(Array.from(ignored)) + - ".indexOf(__WEBPACK_IMPORT_KEY__) < 0) "; - } else if (ignored.size === 1) { - content += `if(__WEBPACK_IMPORT_KEY__ !== ${JSON.stringify( - first(ignored) - )}) `; - } - content += `__WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = `; - if (modern) { - content += `() => ${importVar}[__WEBPACK_IMPORT_KEY__]`; - } else { - content += `function(key) { return ${importVar}[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)`; - } +const { RawSource } = __webpack_require__(51255); +const Module = __webpack_require__(73208); +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); +const FallbackDependency = __webpack_require__(57764); +const RemoteToExternalDependency = __webpack_require__(14389); - runtimeRequirements.add(RuntimeGlobals.exports); - runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ - const exportsName = module.exportsArgument; - initFragments.push( - new InitFragment( - `${content}\n/* harmony reexport (unknown) */ ${RuntimeGlobals.definePropertyGetters}(${exportsName}, __WEBPACK_REEXPORT_OBJECT__);\n`, - moduleGraph.isAsync(importedModule) - ? InitFragment.STAGE_ASYNC_HARMONY_IMPORTS - : InitFragment.STAGE_HARMONY_IMPORTS, - dep.sourceOrder - ) - ); - break; - } +const TYPES = new Set(["remote", "share-init"]); +const RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]); - default: - throw new Error(`Unknown mode ${mode.type}`); - } +class RemoteModule extends Module { + /** + * @param {string} request request string + * @param {string[]} externalRequests list of external requests to containers + * @param {string} internalRequest name of exposed module in container + * @param {string} shareScope the used share scope name + */ + constructor(request, externalRequests, internalRequest, shareScope) { + super("remote-module"); + this.request = request; + this.externalRequests = externalRequests; + this.internalRequest = internalRequest; + this.shareScope = shareScope; + this._identifier = `remote (${shareScope}) ${this.externalRequests.join( + " " + )} ${this.internalRequest}`; } - getReexportFragment( - module, - comment, - key, - name, - valueKey, - runtimeRequirements - ) { - const returnValue = this.getReturnValue(name, valueKey); + /** + * @returns {string} a unique identifier of the module + */ + identifier() { + return this._identifier; + } - runtimeRequirements.add(RuntimeGlobals.exports); - runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); + /** + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + return `remote ${this.request}`; + } - const map = new Map(); - map.set(key, `/* ${comment} */ ${returnValue}`); + /** + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion + */ + libIdent(options) { + return `${this.layer ? `(${this.layer})/` : ""}webpack/container/remote/${ + this.request + }`; + } - return new HarmonyExportInitFragment(module.exportsArgument, map); + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + callback(null, !this.buildInfo); } - getReexportFakeNamespaceObjectFragments( - module, - key, - name, - fakeType, - runtimeRequirements - ) { - runtimeRequirements.add(RuntimeGlobals.exports); - runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); - runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); + /** + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + this.buildMeta = {}; + this.buildInfo = { + strict: true + }; - const map = new Map(); - map.set( - key, - `/* reexport fake namespace object from non-harmony */ ${name}_namespace_cache || (${name}_namespace_cache = ${ - RuntimeGlobals.createFakeNamespaceObject - }(${name}${fakeType ? `, ${fakeType}` : ""}))` - ); + this.clearDependenciesAndBlocks(); + if (this.externalRequests.length === 1) { + this.addDependency( + new RemoteToExternalDependency(this.externalRequests[0]) + ); + } else { + this.addDependency(new FallbackDependency(this.externalRequests)); + } - return [ - new InitFragment( - `var ${name}_namespace_cache;\n`, - InitFragment.STAGE_CONSTANTS, - -1, - `${name}_namespace_cache` - ), - new HarmonyExportInitFragment(module.exportsArgument, map) - ]; + callback(); } - getConditionalReexportStatement( - module, - key, - name, - valueKey, - runtimeRequirements - ) { - if (valueKey === false) { - return "/* unused export */\n"; - } + /** + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + return 6; + } - const exportsName = module.exportsArgument; - const returnValue = this.getReturnValue(name, valueKey); + /** + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + return TYPES; + } - runtimeRequirements.add(RuntimeGlobals.exports); - runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); - runtimeRequirements.add(RuntimeGlobals.hasOwnProperty); + /** + * @returns {string | null} absolute path which should be used for condition matching (usually the resource path) + */ + nameForCondition() { + return this.request; + } - return `if(${RuntimeGlobals.hasOwnProperty}(${name}, ${JSON.stringify( - valueKey[0] - )})) ${ - RuntimeGlobals.definePropertyGetters - }(${exportsName}, { ${JSON.stringify( - key - )}: function() { return ${returnValue}; } });\n`; + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { + const module = moduleGraph.getModule(this.dependencies[0]); + const id = module && chunkGraph.getModuleId(module); + const sources = new Map(); + sources.set("remote", new RawSource("")); + const data = new Map(); + data.set("share-init", [ + { + shareScope: this.shareScope, + initStage: 20, + init: id === undefined ? "" : `initExternal(${JSON.stringify(id)});` + } + ]); + return { sources, data, runtimeRequirements: RUNTIME_REQUIREMENTS }; } - getReturnValue(name, valueKey) { - if (valueKey === null) { - return `${name}_default.a`; - } + serialize(context) { + const { write } = context; + write(this.request); + write(this.externalRequests); + write(this.internalRequest); + write(this.shareScope); + super.serialize(context); + } - if (valueKey === "") { - return name; - } + static deserialize(context) { + const { read } = context; + const obj = new RemoteModule(read(), read(), read(), read()); + obj.deserialize(context); + return obj; + } +} - if (valueKey === false) { - return "/* unused export */ undefined"; - } +makeSerializable(RemoteModule, "webpack/lib/container/RemoteModule"); - return `${name}${propertyAccess(valueKey)}`; - } -}; +module.exports = RemoteModule; -class HarmonyStarExportsList { + +/***/ }), + +/***/ 88288: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); + +/** @typedef {import("./RemoteModule")} RemoteModule */ + +class RemoteRuntimeModule extends RuntimeModule { constructor() { - /** @type {HarmonyExportImportedSpecifierDependency[]} */ - this.dependencies = []; + super("remotes loading"); } /** - * @param {HarmonyExportImportedSpecifierDependency} dep dependency - * @returns {void} + * @returns {string} runtime code */ - push(dep) { - this.dependencies.push(dep); + generate() { + const { compilation, chunkGraph } = this; + const { runtimeTemplate, moduleGraph } = compilation; + const chunkToRemotesMapping = {}; + const idToExternalAndNameMapping = {}; + for (const chunk of this.chunk.getAllAsyncChunks()) { + const modules = chunkGraph.getChunkModulesIterableBySourceType( + chunk, + "remote" + ); + if (!modules) continue; + const remotes = (chunkToRemotesMapping[chunk.id] = []); + for (const m of modules) { + const module = /** @type {RemoteModule} */ (m); + const name = module.internalRequest; + const id = chunkGraph.getModuleId(module); + const shareScope = module.shareScope; + const dep = module.dependencies[0]; + const externalModule = moduleGraph.getModule(dep); + const externalModuleId = + externalModule && chunkGraph.getModuleId(externalModule); + remotes.push(id); + idToExternalAndNameMapping[id] = [shareScope, name, externalModuleId]; + } + } + return Template.asString([ + `var chunkMapping = ${JSON.stringify( + chunkToRemotesMapping, + null, + "\t" + )};`, + `var idToExternalAndNameMapping = ${JSON.stringify( + idToExternalAndNameMapping, + null, + "\t" + )};`, + `${ + RuntimeGlobals.ensureChunkHandlers + }.remotes = ${runtimeTemplate.basicFunction("chunkId, promises", [ + `if(${RuntimeGlobals.hasOwnProperty}(chunkMapping, chunkId)) {`, + Template.indent([ + `chunkMapping[chunkId].forEach(${runtimeTemplate.basicFunction("id", [ + `var getScope = ${RuntimeGlobals.currentRemoteGetScope};`, + "if(!getScope) getScope = [];", + "var data = idToExternalAndNameMapping[id];", + "if(getScope.indexOf(data) >= 0) return;", + "getScope.push(data);", + `if(data.p) return promises.push(data.p);`, + `var onError = ${runtimeTemplate.basicFunction("error", [ + 'if(!error) error = new Error("Container missing");', + 'if(typeof error.message === "string")', + Template.indent( + `error.message += '\\nwhile loading "' + data[1] + '" from ' + data[2];` + ), + `__webpack_modules__[id] = ${runtimeTemplate.basicFunction("", [ + "throw error;" + ])}`, + "data.p = 0;" + ])};`, + `var handleFunction = ${runtimeTemplate.basicFunction( + "fn, arg1, arg2, d, next, first", + [ + "try {", + Template.indent([ + "var promise = fn(arg1, arg2);", + "if(promise && promise.then) {", + Template.indent([ + `var p = promise.then(${runtimeTemplate.returningFunction( + "next(result, d)", + "result" + )}, onError);`, + `if(first) promises.push(data.p = p); else return p;` + ]), + "} else {", + Template.indent(["return next(promise, d, first);"]), + "}" + ]), + "} catch(error) {", + Template.indent(["onError(error);"]), + "}" + ] + )}`, + `var onExternal = ${runtimeTemplate.returningFunction( + `external ? handleFunction(${RuntimeGlobals.initializeSharing}, data[0], 0, external, onInitialized, first) : onError()`, + "external, _, first" + )};`, + `var onInitialized = ${runtimeTemplate.returningFunction( + `handleFunction(external.get, data[1], getScope, 0, onFactory, first)`, + "_, external, first" + )};`, + `var onFactory = ${runtimeTemplate.basicFunction("factory", [ + "data.p = 1;", + `__webpack_modules__[id] = ${runtimeTemplate.basicFunction( + "module", + ["module.exports = factory();"] + )}` + ])};`, + "handleFunction(__webpack_require__, data[2], 0, 0, onExternal, 1);" + ])});` + ]), + "}" + ])}` + ]); } +} + +module.exports = RemoteRuntimeModule; + + +/***/ }), + +/***/ 14389: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ModuleDependency = __webpack_require__(80321); +const makeSerializable = __webpack_require__(33032); - slice() { - return this.dependencies.slice(); +class RemoteToExternalDependency extends ModuleDependency { + constructor(request) { + super(request); } - serialize({ write, setCircularReference }) { - setCircularReference(this); - write(this.dependencies); + get type() { + return "remote to external"; } - deserialize({ read, setCircularReference }) { - setCircularReference(this); - this.dependencies = read(); + get category() { + return "esm"; } } makeSerializable( - HarmonyStarExportsList, - "webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency", - "HarmonyStarExportsList" + RemoteToExternalDependency, + "webpack/lib/container/RemoteToExternalDependency" ); -module.exports.HarmonyStarExportsList = HarmonyStarExportsList; +module.exports = RemoteToExternalDependency; /***/ }), -/***/ 89500: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 3083: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* @@ -78394,289 +74977,360 @@ module.exports.HarmonyStarExportsList = HarmonyStarExportsList; -const InitFragment = __webpack_require__(55870); -const RuntimeGlobals = __webpack_require__(16475); -const { first } = __webpack_require__(93347); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @template T @typedef {(string | Record)[] | Record} ContainerOptionsFormat */ -const joinIterableWithComma = iterable => { - // This is more performant than Array.from().join(", ") - // as it doesn't create an array - let str = ""; - let first = true; - for (const item of iterable) { - if (first) { - first = false; - } else { - str += ", "; +/** + * @template T + * @template N + * @param {ContainerOptionsFormat} options options passed by the user + * @param {function(string | string[], string) : N} normalizeSimple normalize a simple item + * @param {function(T, string) : N} normalizeOptions normalize a complex item + * @param {function(string, N): void} fn processing function + * @returns {void} + */ +const process = (options, normalizeSimple, normalizeOptions, fn) => { + const array = items => { + for (const item of items) { + if (typeof item === "string") { + fn(item, normalizeSimple(item, item)); + } else if (item && typeof item === "object") { + object(item); + } else { + throw new Error("Unexpected options format"); + } } - str += item; + }; + const object = obj => { + for (const [key, value] of Object.entries(obj)) { + if (typeof value === "string" || Array.isArray(value)) { + fn(key, normalizeSimple(value, key)); + } else { + fn(key, normalizeOptions(value, key)); + } + } + }; + if (!options) { + return; + } else if (Array.isArray(options)) { + array(options); + } else if (typeof options === "object") { + object(options); + } else { + throw new Error("Unexpected options format"); } - return str; }; -const EMPTY_MAP = new Map(); -const EMPTY_SET = new Set(); +/** + * @template T + * @template R + * @param {ContainerOptionsFormat} options options passed by the user + * @param {function(string | string[], string) : R} normalizeSimple normalize a simple item + * @param {function(T, string) : R} normalizeOptions normalize a complex item + * @returns {[string, R][]} parsed options + */ +const parseOptions = (options, normalizeSimple, normalizeOptions) => { + /** @type {[string, R][]} */ + const items = []; + process(options, normalizeSimple, normalizeOptions, (key, value) => { + items.push([key, value]); + }); + return items; +}; /** - * @typedef {GenerateContext} Context + * @template T + * @param {string} scope scope name + * @param {ContainerOptionsFormat} options options passed by the user + * @returns {Record} options to spread or pass */ -class HarmonyExportInitFragment extends InitFragment { - /** - * @param {string} exportsArgument the exports identifier - * @param {Map} exportMap mapping from used name to exposed variable name - * @param {Set} unusedExports list of unused export names - */ - constructor( - exportsArgument, - exportMap = EMPTY_MAP, - unusedExports = EMPTY_SET - ) { - super(undefined, InitFragment.STAGE_HARMONY_EXPORTS, 1, "harmony-exports"); - this.exportsArgument = exportsArgument; - this.exportMap = exportMap; - this.unusedExports = unusedExports; +const scope = (scope, options) => { + /** @type {Record} */ + const obj = {}; + process( + options, + item => /** @type {string | string[] | T} */ (item), + item => /** @type {string | string[] | T} */ (item), + (key, value) => { + obj[ + key.startsWith("./") ? `${scope}${key.slice(1)}` : `${scope}/${key}` + ] = value; + } + ); + return obj; +}; + +exports.parseOptions = parseOptions; +exports.scope = scope; + + +/***/ }), + +/***/ 91254: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Sergey Melyukov @smelukov +*/ + + + +const { ReplaceSource, RawSource, ConcatSource } = __webpack_require__(51255); +const { UsageState } = __webpack_require__(63686); +const Generator = __webpack_require__(93401); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../Generator").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../util/Hash")} Hash */ + +const TYPES = new Set(["javascript"]); + +class CssExportsGenerator extends Generator { + constructor() { + super(); } + // TODO add getConcatenationBailoutReason to allow concatenation + // but how to make it have a module id + /** - * @param {HarmonyExportInitFragment[]} fragments all fragments to merge - * @returns {HarmonyExportInitFragment} merged fragment + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code */ - mergeAll(fragments) { - let exportMap; - let exportMapOwned = false; - let unusedExports; - let unusedExportsOwned = false; + generate(module, generateContext) { + const source = new ReplaceSource(new RawSource("")); + const initFragments = []; + const cssExports = new Map(); - for (const fragment of fragments) { - if (fragment.exportMap.size !== 0) { - if (exportMap === undefined) { - exportMap = fragment.exportMap; - exportMapOwned = false; - } else { - if (!exportMapOwned) { - exportMap = new Map(exportMap); - exportMapOwned = true; - } - for (const [key, value] of fragment.exportMap) { - if (!exportMap.has(key)) exportMap.set(key, value); - } - } - } - if (fragment.unusedExports.size !== 0) { - if (unusedExports === undefined) { - unusedExports = fragment.unusedExports; - unusedExportsOwned = false; - } else { - if (!unusedExportsOwned) { - unusedExports = new Set(unusedExports); - unusedExportsOwned = true; - } - for (const value of fragment.unusedExports) { - unusedExports.add(value); - } - } + generateContext.runtimeRequirements.add(RuntimeGlobals.module); + + const runtimeRequirements = new Set(); + + const templateContext = { + runtimeTemplate: generateContext.runtimeTemplate, + dependencyTemplates: generateContext.dependencyTemplates, + moduleGraph: generateContext.moduleGraph, + chunkGraph: generateContext.chunkGraph, + module, + runtime: generateContext.runtime, + runtimeRequirements: runtimeRequirements, + concatenationScope: generateContext.concatenationScope, + codeGenerationResults: generateContext.codeGenerationResults, + initFragments, + cssExports + }; + + const handleDependency = dependency => { + const constructor = /** @type {new (...args: any[]) => Dependency} */ ( + dependency.constructor + ); + const template = generateContext.dependencyTemplates.get(constructor); + if (!template) { + throw new Error( + "No template for dependency: " + dependency.constructor.name + ); } - } - return new HarmonyExportInitFragment( - this.exportsArgument, - exportMap, - unusedExports - ); - } - merge(other) { - let exportMap; - if (this.exportMap.size === 0) { - exportMap = other.exportMap; - } else if (other.exportMap.size === 0) { - exportMap = this.exportMap; - } else { - exportMap = new Map(other.exportMap); - for (const [key, value] of this.exportMap) { - if (!exportMap.has(key)) exportMap.set(key, value); + template.apply(dependency, source, templateContext); + }; + module.dependencies.forEach(handleDependency); + + if (generateContext.concatenationScope) { + const source = new ConcatSource(); + const usedIdentifiers = new Set(); + for (const [k, v] of cssExports) { + let identifier = Template.toIdentifier(k); + let i = 0; + while (usedIdentifiers.has(identifier)) { + identifier = Template.toIdentifier(k + i); + } + usedIdentifiers.add(identifier); + generateContext.concatenationScope.registerExport(k, identifier); + source.add( + `${ + generateContext.runtimeTemplate.supportsConst ? "const" : "var" + } ${identifier} = ${JSON.stringify(v)};\n` + ); } - } - let unusedExports; - if (this.unusedExports.size === 0) { - unusedExports = other.unusedExports; - } else if (other.unusedExports.size === 0) { - unusedExports = this.unusedExports; + return source; } else { - unusedExports = new Set(other.unusedExports); - for (const value of this.unusedExports) { - unusedExports.add(value); + const otherUsed = + generateContext.moduleGraph + .getExportsInfo(module) + .otherExportsInfo.getUsed(generateContext.runtime) !== + UsageState.Unused; + if (otherUsed) { + generateContext.runtimeRequirements.add( + RuntimeGlobals.makeNamespaceObject + ); } + return new RawSource( + `${otherUsed ? `${RuntimeGlobals.makeNamespaceObject}(` : ""}${ + module.moduleArgument + }.exports = {\n${Array.from( + cssExports, + ([k, v]) => `\t${JSON.stringify(k)}: ${JSON.stringify(v)}` + ).join(",\n")}\n}${otherUsed ? ")" : ""};` + ); } - return new HarmonyExportInitFragment( - this.exportsArgument, - exportMap, - unusedExports - ); } /** - * @param {Context} context context - * @returns {string|Source} the source code that will be included as initialization code + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) */ - getContent({ runtimeTemplate, runtimeRequirements }) { - runtimeRequirements.add(RuntimeGlobals.exports); - runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); + getTypes(module) { + return TYPES; + } - const unusedPart = - this.unusedExports.size > 1 - ? `/* unused harmony exports ${joinIterableWithComma( - this.unusedExports - )} */\n` - : this.unusedExports.size > 0 - ? `/* unused harmony export ${first(this.unusedExports)} */\n` - : ""; - const definitions = []; - for (const [key, value] of this.exportMap) { - definitions.push( - `\n/* harmony export */ ${JSON.stringify( - key - )}: ${runtimeTemplate.returningFunction(value)}` - ); - } - const definePart = - this.exportMap.size > 0 - ? `/* harmony export */ ${RuntimeGlobals.definePropertyGetters}(${ - this.exportsArgument - }, {${definitions.join(",")}\n/* harmony export */ });\n` - : ""; - return `${definePart}${unusedPart}`; + /** + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module + */ + getSize(module, type) { + return 42; } + + /** + * @param {Hash} hash hash that will be modified + * @param {UpdateHashContext} updateHashContext context for updating hash + */ + updateHash(hash, { module }) {} } -module.exports = HarmonyExportInitFragment; +module.exports = CssExportsGenerator; /***/ }), -/***/ 48567: +/***/ 46061: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Sergey Melyukov @smelukov */ -const makeSerializable = __webpack_require__(33032); -const HarmonyExportInitFragment = __webpack_require__(89500); -const NullDependency = __webpack_require__(31830); +const { ReplaceSource } = __webpack_require__(51255); +const Generator = __webpack_require__(93401); +const InitFragment = __webpack_require__(55870); +const RuntimeGlobals = __webpack_require__(16475); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("webpack-sources").Source} Source */ /** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../Generator").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../util/Hash")} Hash */ -class HarmonyExportSpecifierDependency extends NullDependency { - constructor(id, name) { - super(); - this.id = id; - this.name = name; - } +const TYPES = new Set(["css"]); - get type() { - return "harmony export specifier"; +class CssGenerator extends Generator { + constructor() { + super(); } /** - * Returns the exported names - * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code */ - getExports(moduleGraph) { - return { - exports: [this.name], - priority: 1, - terminalBinding: true, - dependencies: undefined + generate(module, generateContext) { + const originalSource = module.originalSource(); + const source = new ReplaceSource(originalSource); + const initFragments = []; + const cssExports = new Map(); + + generateContext.runtimeRequirements.add(RuntimeGlobals.hasCssModules); + + const templateContext = { + runtimeTemplate: generateContext.runtimeTemplate, + dependencyTemplates: generateContext.dependencyTemplates, + moduleGraph: generateContext.moduleGraph, + chunkGraph: generateContext.chunkGraph, + module, + runtime: generateContext.runtime, + runtimeRequirements: generateContext.runtimeRequirements, + concatenationScope: generateContext.concatenationScope, + codeGenerationResults: generateContext.codeGenerationResults, + initFragments, + cssExports }; - } - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this dependency connects the module to referencing modules - */ - getModuleEvaluationSideEffectsState(moduleGraph) { - return false; - } + const handleDependency = dependency => { + const constructor = /** @type {new (...args: any[]) => Dependency} */ ( + dependency.constructor + ); + const template = generateContext.dependencyTemplates.get(constructor); + if (!template) { + throw new Error( + "No template for dependency: " + dependency.constructor.name + ); + } - serialize(context) { - const { write } = context; - write(this.id); - write(this.name); - super.serialize(context); - } + template.apply(dependency, source, templateContext); + }; + module.dependencies.forEach(handleDependency); + if (module.presentationalDependencies !== undefined) + module.presentationalDependencies.forEach(handleDependency); - deserialize(context) { - const { read } = context; - this.id = read(); - this.name = read(); - super.deserialize(context); + if (cssExports.size > 0) { + const data = generateContext.getData(); + data.set("css-exports", cssExports); + } + + return InitFragment.addToSource(source, initFragments, generateContext); } -} -makeSerializable( - HarmonyExportSpecifierDependency, - "webpack/lib/dependencies/HarmonyExportSpecifierDependency" -); + /** + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) + */ + getTypes(module) { + return TYPES; + } -HarmonyExportSpecifierDependency.Template = class HarmonyExportSpecifierDependencyTemplate extends ( - NullDependency.Template -) { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module */ - apply( - dependency, - source, - { module, moduleGraph, initFragments, runtime, concatenationScope } - ) { - const dep = /** @type {HarmonyExportSpecifierDependency} */ (dependency); - if (concatenationScope) { - concatenationScope.registerExport(dep.name, dep.id); - return; - } - const used = moduleGraph - .getExportsInfo(module) - .getUsedName(dep.name, runtime); - if (!used) { - const set = new Set(); - set.add(dep.name || "namespace"); - initFragments.push( - new HarmonyExportInitFragment(module.exportsArgument, undefined, set) - ); - return; + getSize(module, type) { + const originalSource = module.originalSource(); + + if (!originalSource) { + return 0; } - const map = new Map(); - map.set(used, `/* binding */ ${dep.id}`); - initFragments.push( - new HarmonyExportInitFragment(module.exportsArgument, map, undefined) - ); + return originalSource.size(); } -}; -module.exports = HarmonyExportSpecifierDependency; + /** + * @param {Hash} hash hash that will be modified + * @param {UpdateHashContext} updateHashContext context for updating hash + */ + updateHash(hash, { module }) {} +} + +module.exports = CssGenerator; /***/ }), -/***/ 39211: -/***/ (function(__unused_webpack_module, exports) { +/***/ 80806: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -78686,44 +75340,444 @@ module.exports = HarmonyExportSpecifierDependency; -/** @typedef {import("../Parser").ParserState} ParserState */ +const { SyncWaterfallHook } = __webpack_require__(41242); +const Compilation = __webpack_require__(85720); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); +const compileBooleanMatcher = __webpack_require__(29404); +const { chunkHasCss } = __webpack_require__(47283); -/** @type {WeakMap} */ -const parserStateExportsState = new WeakMap(); +/** @typedef {import("../Chunk")} Chunk */ /** - * @param {ParserState} parserState parser state - * @param {boolean} isStrictHarmony strict harmony mode should be enabled - * @returns {void} + * @typedef {Object} JsonpCompilationPluginHooks + * @property {SyncWaterfallHook<[string, Chunk]>} createStylesheet */ -exports.enable = (parserState, isStrictHarmony) => { - const value = parserStateExportsState.get(parserState); - if (value === false) return; - parserStateExportsState.set(parserState, true); - if (value !== true) { - parserState.module.buildMeta.exportsType = "namespace"; - parserState.module.buildInfo.strict = true; - parserState.module.buildInfo.exportsArgument = "__webpack_exports__"; - if (isStrictHarmony) { - parserState.module.buildMeta.strictHarmonyModule = true; - parserState.module.buildInfo.moduleArgument = "__webpack_module__"; + +/** @type {WeakMap} */ +const compilationHooksMap = new WeakMap(); + +class CssLoadingRuntimeModule extends RuntimeModule { + /** + * @param {Compilation} compilation the compilation + * @returns {JsonpCompilationPluginHooks} hooks + */ + static getCompilationHooks(compilation) { + if (!(compilation instanceof Compilation)) { + throw new TypeError( + "The 'compilation' argument must be an instance of Compilation" + ); + } + let hooks = compilationHooksMap.get(compilation); + if (hooks === undefined) { + hooks = { + createStylesheet: new SyncWaterfallHook(["source", "chunk"]) + }; + compilationHooksMap.set(compilation, hooks); } + return hooks; } -}; -/** - * @param {ParserState} parserState parser state - * @returns {boolean} true, when enabled - */ -exports.isEnabled = parserState => { - const value = parserStateExportsState.get(parserState); - return value === true; -}; + constructor(runtimeRequirements, runtimeOptions) { + super("css loading", 10); + + this._runtimeRequirements = runtimeRequirements; + this.runtimeOptions = runtimeOptions; + } + + /** + * @returns {string} runtime code + */ + generate() { + const { compilation, chunk, _runtimeRequirements } = this; + const { + chunkGraph, + runtimeTemplate, + outputOptions: { + crossOriginLoading, + uniqueName, + chunkLoadTimeout: loadTimeout + } + } = compilation; + const fn = RuntimeGlobals.ensureChunkHandlers; + const conditionMap = chunkGraph.getChunkConditionMap( + chunk, + (chunk, chunkGraph) => + !!chunkGraph.getChunkModulesIterableBySourceType(chunk, "css") + ); + const hasCssMatcher = compileBooleanMatcher(conditionMap); + + const withLoading = + _runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers) && + hasCssMatcher !== false; + const withHmr = _runtimeRequirements.has( + RuntimeGlobals.hmrDownloadUpdateHandlers + ); + const initialChunkIdsWithCss = new Set(); + const initialChunkIdsWithoutCss = new Set(); + for (const c of chunk.getAllInitialChunks()) { + (chunkHasCss(c, chunkGraph) + ? initialChunkIdsWithCss + : initialChunkIdsWithoutCss + ).add(c.id); + } + + if (!withLoading && !withHmr && initialChunkIdsWithCss.size === 0) { + return null; + } + + const { createStylesheet } = + CssLoadingRuntimeModule.getCompilationHooks(compilation); + + const stateExpression = withHmr + ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_css` + : undefined; + + const code = Template.asString([ + "link = document.createElement('link');", + uniqueName + ? 'link.setAttribute("data-webpack", uniqueName + ":" + key);' + : "", + "link.setAttribute(loadingAttribute, 1);", + 'link.rel = "stylesheet";', + "link.href = url;", + crossOriginLoading + ? Template.asString([ + "if (link.src.indexOf(window.location.origin + '/') !== 0) {", + Template.indent( + `link.crossOrigin = ${JSON.stringify(crossOriginLoading)};` + ), + "}" + ]) + : "" + ]); + + const cc = str => str.charCodeAt(0); + + return Template.asString([ + "// object to store loaded and loading chunks", + "// undefined = chunk not loaded, null = chunk preloaded/prefetched", + "// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded", + `var installedChunks = ${ + stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" + }{${Array.from( + initialChunkIdsWithoutCss, + id => `${JSON.stringify(id)}:0` + ).join(",")}};`, + "", + uniqueName + ? `var uniqueName = ${JSON.stringify( + runtimeTemplate.outputOptions.uniqueName + )};` + : "// data-webpack is not used as build has no uniqueName", + `var loadCssChunkData = ${runtimeTemplate.basicFunction( + "target, link, chunkId", + [ + `var data, token = "", token2, exports = {}, exportsWithId = [], exportsWithDashes = [], ${ + withHmr ? "moduleIds = [], " : "" + }i = 0, cc = 1;`, + "try { if(!link) link = loadStylesheet(chunkId); data = link.sheet.cssRules; data = data[data.length - 1].style; } catch(e) { data = getComputedStyle(document.head); }", + `data = data.getPropertyValue(${ + uniqueName + ? runtimeTemplate.concatenation( + "--webpack-", + { expr: "uniqueName" }, + "-", + { expr: "chunkId" } + ) + : runtimeTemplate.concatenation("--webpack-", { expr: "chunkId" }) + });`, + "if(!data) return [];", + "for(; cc; i++) {", + Template.indent([ + "cc = data.charCodeAt(i);", + `if(cc == ${cc("(")}) { token2 = token; token = ""; }`, + `else if(cc == ${cc( + ")" + )}) { exports[token2.replace(/^_/, "")] = token.replace(/^_/, ""); token = ""; }`, + `else if(cc == ${cc("/")} || cc == ${cc( + "%" + )}) { token = token.replace(/^_/, ""); exports[token] = token; exportsWithId.push(token); if(cc == ${cc( + "%" + )}) exportsWithDashes.push(token); token = ""; }`, + `else if(!cc || cc == ${cc( + "," + )}) { token = token.replace(/^_/, ""); exportsWithId.forEach(${runtimeTemplate.expressionFunction( + `exports[x] = ${ + uniqueName + ? runtimeTemplate.concatenation( + { expr: "uniqueName" }, + "-", + { expr: "token" }, + "-", + { expr: "exports[x]" } + ) + : runtimeTemplate.concatenation({ expr: "token" }, "-", { + expr: "exports[x]" + }) + }`, + "x" + )}); exportsWithDashes.forEach(${runtimeTemplate.expressionFunction( + `exports[x] = "--" + exports[x]`, + "x" + )}); ${ + RuntimeGlobals.makeNamespaceObject + }(exports); target[token] = (${runtimeTemplate.basicFunction( + "exports, module", + `module.exports = exports;` + )}).bind(null, exports); ${ + withHmr ? "moduleIds.push(token); " : "" + }token = ""; exports = {}; exportsWithId.length = 0; }`, + `else if(cc == ${cc("\\")}) { token += data[++i] }`, + `else { token += data[i]; }` + ]), + "}", + `${ + withHmr ? `if(target == ${RuntimeGlobals.moduleFactories}) ` : "" + }installedChunks[chunkId] = 0;`, + withHmr ? "return moduleIds;" : "" + ] + )}`, + 'var loadingAttribute = "data-webpack-loading";', + `var loadStylesheet = ${runtimeTemplate.basicFunction( + "chunkId, url, done" + (withHmr ? ", hmr" : ""), + [ + 'var link, needAttach, key = "chunk-" + chunkId;', + withHmr ? "if(!hmr) {" : "", + 'var links = document.getElementsByTagName("link");', + "for(var i = 0; i < links.length; i++) {", + Template.indent([ + "var l = links[i];", + `if(l.rel == "stylesheet" && (${ + withHmr + ? 'l.href.startsWith(url) || l.getAttribute("href").startsWith(url)' + : 'l.href == url || l.getAttribute("href") == url' + }${ + uniqueName + ? ' || l.getAttribute("data-webpack") == uniqueName + ":" + key' + : "" + })) { link = l; break; }` + ]), + "}", + "if(!done) return link;", + withHmr ? "}" : "", + "if(!link) {", + Template.indent([ + "needAttach = true;", + createStylesheet.call(code, this.chunk) + ]), + "}", + `var onLinkComplete = ${runtimeTemplate.basicFunction( + "prev, event", + Template.asString([ + "link.onerror = link.onload = null;", + "link.removeAttribute(loadingAttribute);", + "clearTimeout(timeout);", + 'if(event && event.type != "load") link.parentNode.removeChild(link)', + "done(event);", + "if(prev) return prev(event);" + ]) + )};`, + "if(link.getAttribute(loadingAttribute)) {", + Template.indent([ + `var timeout = setTimeout(onLinkComplete.bind(null, undefined, { type: 'timeout', target: link }), ${loadTimeout});`, + "link.onerror = onLinkComplete.bind(null, link.onerror);", + "link.onload = onLinkComplete.bind(null, link.onload);" + ]), + "} else onLinkComplete(undefined, { type: 'load', target: link });", // We assume any existing stylesheet is render blocking + withHmr ? "hmr ? document.head.insertBefore(link, hmr) :" : "", + "needAttach && document.head.appendChild(link);", + "return link;" + ] + )};`, + initialChunkIdsWithCss.size > 2 + ? `${JSON.stringify( + Array.from(initialChunkIdsWithCss) + )}.forEach(loadCssChunkData.bind(null, ${ + RuntimeGlobals.moduleFactories + }, 0));` + : initialChunkIdsWithCss.size > 0 + ? `${Array.from( + initialChunkIdsWithCss, + id => + `loadCssChunkData(${ + RuntimeGlobals.moduleFactories + }, 0, ${JSON.stringify(id)});` + ).join("")}` + : "// no initial css", + "", + withLoading + ? Template.asString([ + `${fn}.css = ${runtimeTemplate.basicFunction("chunkId, promises", [ + "// css chunk loading", + `var installedChunkData = ${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;`, + 'if(installedChunkData !== 0) { // 0 means "already installed".', + Template.indent([ + "", + '// a Promise means "currently loading".', + "if(installedChunkData) {", + Template.indent(["promises.push(installedChunkData[2]);"]), + "} else {", + Template.indent([ + hasCssMatcher === true + ? "if(true) { // all chunks have CSS" + : `if(${hasCssMatcher("chunkId")}) {`, + Template.indent([ + "// setup Promise in chunk cache", + `var promise = new Promise(${runtimeTemplate.expressionFunction( + `installedChunkData = installedChunks[chunkId] = [resolve, reject]`, + "resolve, reject" + )});`, + "promises.push(installedChunkData[2] = promise);", + "", + "// start chunk loading", + `var url = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkCssFilename}(chunkId);`, + "// create error before stack unwound to get useful stacktrace later", + "var error = new Error();", + `var loadingEnded = ${runtimeTemplate.basicFunction( + "event", + [ + `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId)) {`, + Template.indent([ + "installedChunkData = installedChunks[chunkId];", + "if(installedChunkData !== 0) installedChunks[chunkId] = undefined;", + "if(installedChunkData) {", + Template.indent([ + 'if(event.type !== "load") {', + Template.indent([ + "var errorType = event && event.type;", + "var realSrc = event && event.target && event.target.src;", + "error.message = 'Loading css chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", + "error.name = 'ChunkLoadError';", + "error.type = errorType;", + "error.request = realSrc;", + "installedChunkData[1](error);" + ]), + "} else {", + Template.indent([ + `loadCssChunkData(${RuntimeGlobals.moduleFactories}, link, chunkId);`, + "installedChunkData[0]();" + ]), + "}" + ]), + "}" + ]), + "}" + ] + )};`, + "var link = loadStylesheet(chunkId, url, loadingEnded);" + ]), + "} else installedChunks[chunkId] = 0;" + ]), + "}" + ]), + "}" + ])};` + ]) + : "// no chunk loading", + "", + withHmr + ? Template.asString([ + "var oldTags = [];", + "var newTags = [];", + `var applyHandler = ${runtimeTemplate.basicFunction("options", [ + `return { dispose: ${runtimeTemplate.basicFunction( + "", + [] + )}, apply: ${runtimeTemplate.basicFunction("", [ + "var moduleIds = [];", + `newTags.forEach(${runtimeTemplate.expressionFunction( + "info[1].sheet.disabled = false", + "info" + )});`, + "while(oldTags.length) {", + Template.indent([ + "var oldTag = oldTags.pop();", + "if(oldTag.parentNode) oldTag.parentNode.removeChild(oldTag);" + ]), + "}", + "while(newTags.length) {", + Template.indent([ + `var info = newTags.pop();`, + `var chunkModuleIds = loadCssChunkData(${RuntimeGlobals.moduleFactories}, info[1], info[0]);`, + `chunkModuleIds.forEach(${runtimeTemplate.expressionFunction( + "moduleIds.push(id)", + "id" + )});` + ]), + "}", + "return moduleIds;" + ])} };` + ])}`, + `var cssTextKey = ${runtimeTemplate.returningFunction( + `Array.from(link.sheet.cssRules, ${runtimeTemplate.returningFunction( + "r.cssText", + "r" + )}).join()`, + "link" + )}`, + `${ + RuntimeGlobals.hmrDownloadUpdateHandlers + }.css = ${runtimeTemplate.basicFunction( + "chunkIds, removedChunks, removedModules, promises, applyHandlers, updatedModulesList", + [ + "applyHandlers.push(applyHandler);", + `chunkIds.forEach(${runtimeTemplate.basicFunction("chunkId", [ + `var filename = ${RuntimeGlobals.getChunkCssFilename}(chunkId);`, + `var url = ${RuntimeGlobals.publicPath} + filename;`, + "var oldTag = loadStylesheet(chunkId, url);", + "if(!oldTag) return;", + `promises.push(new Promise(${runtimeTemplate.basicFunction( + "resolve, reject", + [ + `var link = loadStylesheet(chunkId, url + (url.indexOf("?") < 0 ? "?" : "&") + "hmr=" + Date.now(), ${runtimeTemplate.basicFunction( + "event", + [ + 'if(event.type !== "load") {', + Template.indent([ + "var errorType = event && event.type;", + "var realSrc = event && event.target && event.target.src;", + "error.message = 'Loading css hot update chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", + "error.name = 'ChunkLoadError';", + "error.type = errorType;", + "error.request = realSrc;", + "reject(error);" + ]), + "} else {", + Template.indent([ + "try { if(cssTextKey(oldTag) == cssTextKey(link)) { if(link.parentNode) link.parentNode.removeChild(link); return resolve(); } } catch(e) {}", + "var factories = {};", + "loadCssChunkData(factories, link, chunkId);", + `Object.keys(factories).forEach(${runtimeTemplate.expressionFunction( + "updatedModulesList.push(id)", + "id" + )})`, + "link.sheet.disabled = true;", + "oldTags.push(oldTag);", + "newTags.push([chunkId, link]);", + "resolve();" + ]), + "}" + ] + )}, oldTag);` + ] + )}));` + ])});` + ] + )}` + ]) + : "// no hmr" + ]); + } +} + +module.exports = CssLoadingRuntimeModule; /***/ }), -/***/ 57154: +/***/ 47283: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -78734,363 +75788,466 @@ exports.isEnabled = parserState => { -const ConditionalInitFragment = __webpack_require__(61333); -const Dependency = __webpack_require__(54912); -const HarmonyLinkingError = __webpack_require__(97511); -const InitFragment = __webpack_require__(55870); -const Template = __webpack_require__(1626); -const AwaitDependenciesInitFragment = __webpack_require__(41153); -const { filterRuntime, mergeRuntime } = __webpack_require__(17156); -const ModuleDependency = __webpack_require__(80321); +const { ConcatSource } = __webpack_require__(51255); +const HotUpdateChunk = __webpack_require__(9597); +const RuntimeGlobals = __webpack_require__(16475); +const SelfModuleFactory = __webpack_require__(63560); +const CssExportDependency = __webpack_require__(76760); +const CssImportDependency = __webpack_require__(90542); +const CssLocalIdentifierDependency = __webpack_require__(92328); +const CssSelfLocalIdentifierDependency = __webpack_require__(29094); +const CssUrlDependency = __webpack_require__(70749); +const StaticExportsDependency = __webpack_require__(91418); +const { compareModulesByIdentifier } = __webpack_require__(29579); +const createSchemaValidation = __webpack_require__(32540); +const createHash = __webpack_require__(49835); +const memoize = __webpack_require__(78676); +const nonNumericOnlyHash = __webpack_require__(55668); +const CssExportsGenerator = __webpack_require__(91254); +const CssGenerator = __webpack_require__(46061); +const CssParser = __webpack_require__(98305); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ /** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +/** @typedef {import("../../declarations/WebpackOptions").CssExperimentOptions} CssExperimentOptions */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ -const ExportPresenceModes = { - NONE: /** @type {0} */ (0), - WARN: /** @type {1} */ (1), - AUTO: /** @type {2} */ (2), - ERROR: /** @type {3} */ (3), - fromUserOption(str) { - switch (str) { - case "error": - return ExportPresenceModes.ERROR; - case "warn": - return ExportPresenceModes.WARN; - case "auto": - return ExportPresenceModes.AUTO; - case false: - return ExportPresenceModes.NONE; - default: - throw new Error(`Invalid export presence value ${str}`); - } - } +const getCssLoadingRuntimeModule = memoize(() => + __webpack_require__(80806) +); + +const getSchema = name => { + const { definitions } = __webpack_require__(73342); + return { + definitions, + oneOf: [{ $ref: `#/definitions/${name}` }] + }; }; -class HarmonyImportDependency extends ModuleDependency { - /** - * - * @param {string} request request string - * @param {number} sourceOrder source order - * @param {Record=} assertions import assertions - */ - constructor(request, sourceOrder, assertions) { - super(request); - this.sourceOrder = sourceOrder; - this.assertions = assertions; +const validateGeneratorOptions = createSchemaValidation( + __webpack_require__(59170), + () => getSchema("CssGeneratorOptions"), + { + name: "Css Modules Plugin", + baseDataPath: "parser" } - - get category() { - return "esm"; +); +const validateParserOptions = createSchemaValidation( + __webpack_require__(38542), + () => getSchema("CssParserOptions"), + { + name: "Css Modules Plugin", + baseDataPath: "parser" } +); - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - return Dependency.NO_EXPORTS_REFERENCED; - } +const escapeCss = (str, omitOptionalUnderscore) => { + const escaped = `${str}`.replace( + // cspell:word uffff + /[^a-zA-Z0-9_\u0081-\uffff-]/g, + s => `\\${s}` + ); + return !omitOptionalUnderscore && /^(?!--)[0-9_-]/.test(escaped) + ? `_${escaped}` + : escaped; +}; - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {string} name of the variable for the import - */ - getImportVar(moduleGraph) { - const module = moduleGraph.getParentModule(this); - const meta = moduleGraph.getMeta(module); - let importVarMap = meta.importVarMap; - if (!importVarMap) meta.importVarMap = importVarMap = new Map(); - let importVar = importVarMap.get(moduleGraph.getModule(this)); - if (importVar) return importVar; - importVar = `${Template.toIdentifier( - `${this.userRequest}` - )}__WEBPACK_IMPORTED_MODULE_${importVarMap.size}__`; - importVarMap.set(moduleGraph.getModule(this), importVar); - return importVar; - } +const plugin = "CssModulesPlugin"; +class CssModulesPlugin { /** - * @param {boolean} update create new variables or update existing one - * @param {DependencyTemplateContext} templateContext the template context - * @returns {[string, string]} the import statement and the compat statement + * @param {CssExperimentOptions} options options */ - getImportStatement( - update, - { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements } - ) { - return runtimeTemplate.importStatement({ - update, - module: moduleGraph.getModule(this), - chunkGraph, - importVar: this.getImportVar(moduleGraph), - request: this.request, - originModule: module, - runtimeRequirements - }); + constructor({ exportsOnly = false }) { + this._exportsOnly = exportsOnly; } - /** - * @param {ModuleGraph} moduleGraph module graph - * @param {string[]} ids imported ids - * @param {string} additionalMessage extra info included in the error message - * @returns {WebpackError[] | undefined} errors + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - getLinkingErrors(moduleGraph, ids, additionalMessage) { - const importedModule = moduleGraph.getModule(this); - // ignore errors for missing or failed modules - if (!importedModule || importedModule.getNumberOfErrors() > 0) { - return; - } - - const parentModule = moduleGraph.getParentModule(this); - const exportsType = importedModule.getExportsType( - moduleGraph, - parentModule.buildMeta.strictHarmonyModule - ); - if (exportsType === "namespace" || exportsType === "default-with-named") { - if (ids.length === 0) { - return; - } + apply(compiler) { + compiler.hooks.compilation.tap( + plugin, + (compilation, { normalModuleFactory }) => { + const selfFactory = new SelfModuleFactory(compilation.moduleGraph); + compilation.dependencyFactories.set( + CssUrlDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + CssUrlDependency, + new CssUrlDependency.Template() + ); + compilation.dependencyTemplates.set( + CssLocalIdentifierDependency, + new CssLocalIdentifierDependency.Template() + ); + compilation.dependencyFactories.set( + CssSelfLocalIdentifierDependency, + selfFactory + ); + compilation.dependencyTemplates.set( + CssSelfLocalIdentifierDependency, + new CssSelfLocalIdentifierDependency.Template() + ); + compilation.dependencyTemplates.set( + CssExportDependency, + new CssExportDependency.Template() + ); + compilation.dependencyFactories.set( + CssImportDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + CssImportDependency, + new CssImportDependency.Template() + ); + compilation.dependencyTemplates.set( + StaticExportsDependency, + new StaticExportsDependency.Template() + ); + normalModuleFactory.hooks.createParser + .for("css") + .tap(plugin, parserOptions => { + validateParserOptions(parserOptions); + return new CssParser(); + }); + normalModuleFactory.hooks.createParser + .for("css/global") + .tap(plugin, parserOptions => { + validateParserOptions(parserOptions); + return new CssParser({ + allowPseudoBlocks: false, + allowModeSwitch: false + }); + }); + normalModuleFactory.hooks.createParser + .for("css/module") + .tap(plugin, parserOptions => { + validateParserOptions(parserOptions); + return new CssParser({ + defaultMode: "local" + }); + }); + normalModuleFactory.hooks.createGenerator + .for("css") + .tap(plugin, generatorOptions => { + validateGeneratorOptions(generatorOptions); + return this._exportsOnly + ? new CssExportsGenerator() + : new CssGenerator(); + }); + normalModuleFactory.hooks.createGenerator + .for("css/global") + .tap(plugin, generatorOptions => { + validateGeneratorOptions(generatorOptions); + return this._exportsOnly + ? new CssExportsGenerator() + : new CssGenerator(); + }); + normalModuleFactory.hooks.createGenerator + .for("css/module") + .tap(plugin, generatorOptions => { + validateGeneratorOptions(generatorOptions); + return this._exportsOnly + ? new CssExportsGenerator() + : new CssGenerator(); + }); + const orderedCssModulesPerChunk = new WeakMap(); + compilation.hooks.afterCodeGeneration.tap("CssModulesPlugin", () => { + const { chunkGraph } = compilation; + for (const chunk of compilation.chunks) { + if (CssModulesPlugin.chunkHasCss(chunk, chunkGraph)) { + orderedCssModulesPerChunk.set( + chunk, + this.getOrderedChunkCssModules(chunk, chunkGraph, compilation) + ); + } + } + }); + compilation.hooks.contentHash.tap("CssModulesPlugin", chunk => { + const { + chunkGraph, + outputOptions: { + hashSalt, + hashDigest, + hashDigestLength, + hashFunction + } + } = compilation; + const modules = orderedCssModulesPerChunk.get(chunk); + if (modules === undefined) return; + const hash = createHash(hashFunction); + if (hashSalt) hash.update(hashSalt); + for (const module of modules) { + hash.update(chunkGraph.getModuleHash(module, chunk.runtime)); + } + const digest = /** @type {string} */ (hash.digest(hashDigest)); + chunk.contentHash.css = nonNumericOnlyHash(digest, hashDigestLength); + }); + compilation.hooks.renderManifest.tap(plugin, (result, options) => { + const { chunkGraph } = compilation; + const { hash, chunk, codeGenerationResults } = options; - if ( - (exportsType !== "default-with-named" || ids[0] !== "default") && - moduleGraph.isExportProvided(importedModule, ids) === false - ) { - // We are sure that it's not provided + if (chunk instanceof HotUpdateChunk) return result; - // Try to provide detailed info in the error message - let pos = 0; - let exportsInfo = moduleGraph.getExportsInfo(importedModule); - while (pos < ids.length && exportsInfo) { - const id = ids[pos++]; - const exportInfo = exportsInfo.getReadOnlyExportInfo(id); - if (exportInfo.provided === false) { - // We are sure that it's not provided - const providedExports = exportsInfo.getProvidedExports(); - const moreInfo = !Array.isArray(providedExports) - ? " (possible exports unknown)" - : providedExports.length === 0 - ? " (module has no exports)" - : ` (possible exports: ${providedExports.join(", ")})`; - return [ - new HarmonyLinkingError( - `export ${ids - .slice(0, pos) - .map(id => `'${id}'`) - .join(".")} ${additionalMessage} was not found in '${ - this.userRequest - }'${moreInfo}` - ) - ]; + const modules = orderedCssModulesPerChunk.get(chunk); + if (modules !== undefined) { + result.push({ + render: () => + this.renderChunk({ + chunk, + chunkGraph, + codeGenerationResults, + uniqueName: compilation.outputOptions.uniqueName, + modules + }), + filenameTemplate: CssModulesPlugin.getChunkFilenameTemplate( + chunk, + compilation.outputOptions + ), + pathOptions: { + hash, + runtime: chunk.runtime, + chunk, + contentHashType: "css" + }, + identifier: `css${chunk.id}`, + hash: chunk.contentHash.css + }); } - exportsInfo = exportInfo.getNestedExportsInfo(); - } + return result; + }); + const enabledChunks = new WeakSet(); + const handler = (chunk, set) => { + if (enabledChunks.has(chunk)) { + return; + } + enabledChunks.add(chunk); - // General error message - return [ - new HarmonyLinkingError( - `export ${ids - .map(id => `'${id}'`) - .join(".")} ${additionalMessage} was not found in '${ - this.userRequest - }'` - ) - ]; + set.add(RuntimeGlobals.publicPath); + set.add(RuntimeGlobals.getChunkCssFilename); + set.add(RuntimeGlobals.hasOwnProperty); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + set.add(RuntimeGlobals.makeNamespaceObject); + + const CssLoadingRuntimeModule = getCssLoadingRuntimeModule(); + compilation.addRuntimeModule(chunk, new CssLoadingRuntimeModule(set)); + }; + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hasCssModules) + .tap(plugin, handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap(plugin, handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadUpdateHandlers) + .tap(plugin, handler); } - } - switch (exportsType) { - case "default-only": - // It's has only a default export - if (ids.length > 0 && ids[0] !== "default") { - // In strict harmony modules we only support the default export - return [ - new HarmonyLinkingError( - `Can't import the named export ${ids - .map(id => `'${id}'`) - .join( - "." - )} ${additionalMessage} from default-exporting module (only default export is available)` - ) - ]; - } - break; - case "default-with-named": - // It has a default export and named properties redirect - // In some cases we still want to warn here - if ( - ids.length > 0 && - ids[0] !== "default" && - importedModule.buildMeta.defaultObject === "redirect-warn" - ) { - // For these modules only the default export is supported - return [ - new HarmonyLinkingError( - `Should not import the named export ${ids - .map(id => `'${id}'`) - .join( - "." - )} ${additionalMessage} from default-exporting module (only default export is available soon)` - ) - ]; - } - break; - } + ); } - serialize(context) { - const { write } = context; - write(this.sourceOrder); - write(this.assertions); - super.serialize(context); - } + getModulesInOrder(chunk, modules, compilation) { + if (!modules) return []; - deserialize(context) { - const { read } = context; - this.sourceOrder = read(); - this.assertions = read(); - super.deserialize(context); - } -} + const modulesList = [...modules]; -module.exports = HarmonyImportDependency; + // Get ordered list of modules per chunk group + // Lists are in reverse order to allow to use Array.pop() + const modulesByChunkGroup = Array.from(chunk.groupsIterable, chunkGroup => { + const sortedModules = modulesList + .map(module => { + return { + module, + index: chunkGroup.getModulePostOrderIndex(module) + }; + }) + .filter(item => item.index !== undefined) + .sort((a, b) => b.index - a.index) + .map(item => item.module); -/** @type {WeakMap>} */ -const importEmittedMap = new WeakMap(); + return { list: sortedModules, set: new Set(sortedModules) }; + }); -HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate extends ( - ModuleDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, templateContext) { - const dep = /** @type {HarmonyImportDependency} */ (dependency); - const { module, chunkGraph, moduleGraph, runtime } = templateContext; + if (modulesByChunkGroup.length === 1) + return modulesByChunkGroup[0].list.reverse(); - const connection = moduleGraph.getConnection(dep); - if (connection && !connection.isTargetActive(runtime)) return; + const compareModuleLists = ({ list: a }, { list: b }) => { + if (a.length === 0) { + return b.length === 0 ? 0 : 1; + } else { + if (b.length === 0) return -1; + return compareModulesByIdentifier(a[a.length - 1], b[b.length - 1]); + } + }; - const referencedModule = connection && connection.module; + modulesByChunkGroup.sort(compareModuleLists); - if ( - connection && - connection.weak && - referencedModule && - chunkGraph.getModuleId(referencedModule) === null - ) { - // in weak references, module might not be in any chunk - // but that's ok, we don't need that logic in this case - return; + const finalModules = []; + + for (;;) { + const failedModules = new Set(); + const list = modulesByChunkGroup[0].list; + if (list.length === 0) { + // done, everything empty + break; + } + let selectedModule = list[list.length - 1]; + let hasFailed = undefined; + outer: for (;;) { + for (const { list, set } of modulesByChunkGroup) { + if (list.length === 0) continue; + const lastModule = list[list.length - 1]; + if (lastModule === selectedModule) continue; + if (!set.has(selectedModule)) continue; + failedModules.add(selectedModule); + if (failedModules.has(lastModule)) { + // There is a conflict, try other alternatives + hasFailed = lastModule; + continue; + } + selectedModule = lastModule; + hasFailed = false; + continue outer; // restart + } + break; + } + if (hasFailed) { + // There is a not resolve-able conflict with the selectedModule + if (compilation) { + // TODO print better warning + compilation.warnings.push( + new Error( + `chunk ${ + chunk.name || chunk.id + }\nConflicting order between ${hasFailed.readableIdentifier( + compilation.requestShortener + )} and ${selectedModule.readableIdentifier( + compilation.requestShortener + )}` + ) + ); + } + selectedModule = hasFailed; + } + // Insert the selected module into the final modules list + finalModules.push(selectedModule); + // Remove the selected module from all lists + for (const { list, set } of modulesByChunkGroup) { + const lastModule = list[list.length - 1]; + if (lastModule === selectedModule) list.pop(); + else if (hasFailed && set.has(selectedModule)) { + const idx = list.indexOf(selectedModule); + if (idx >= 0) list.splice(idx, 1); + } + } + modulesByChunkGroup.sort(compareModuleLists); } + return finalModules; + } - const moduleKey = referencedModule - ? referencedModule.identifier() - : dep.request; - const key = `harmony import ${moduleKey}`; + getOrderedChunkCssModules(chunk, chunkGraph, compilation) { + return [ + ...this.getModulesInOrder( + chunk, + chunkGraph.getOrderedChunkModulesIterableBySourceType( + chunk, + "css-import", + compareModulesByIdentifier + ), + compilation + ), + ...this.getModulesInOrder( + chunk, + chunkGraph.getOrderedChunkModulesIterableBySourceType( + chunk, + "css", + compareModulesByIdentifier + ), + compilation + ) + ]; + } - const runtimeCondition = dep.weak - ? false - : connection - ? filterRuntime(runtime, r => connection.isTargetActive(r)) - : true; + renderChunk({ + uniqueName, + chunk, + chunkGraph, + codeGenerationResults, + modules + }) { + const source = new ConcatSource(); + const metaData = []; + for (const module of modules) { + try { + const codeGenResult = codeGenerationResults.get(module, chunk.runtime); - if (module && referencedModule) { - let emittedModules = importEmittedMap.get(module); - if (emittedModules === undefined) { - emittedModules = new WeakMap(); - importEmittedMap.set(module, emittedModules); - } - let mergedRuntimeCondition = runtimeCondition; - const oldRuntimeCondition = emittedModules.get(referencedModule) || false; - if (oldRuntimeCondition !== false && mergedRuntimeCondition !== true) { - if (mergedRuntimeCondition === false || oldRuntimeCondition === true) { - mergedRuntimeCondition = oldRuntimeCondition; - } else { - mergedRuntimeCondition = mergeRuntime( - oldRuntimeCondition, - mergedRuntimeCondition - ); + const s = + codeGenResult.sources.get("css") || + codeGenResult.sources.get("css-import"); + if (s) { + source.add(s); + source.add("\n"); } + const exports = + codeGenResult.data && codeGenResult.data.get("css-exports"); + const moduleId = chunkGraph.getModuleId(module) + ""; + metaData.push( + `${ + exports + ? Array.from(exports, ([n, v]) => { + const shortcutValue = `${ + uniqueName ? uniqueName + "-" : "" + }${moduleId}-${n}`; + return v === shortcutValue + ? `${escapeCss(n)}/` + : v === "--" + shortcutValue + ? `${escapeCss(n)}%` + : `${escapeCss(n)}(${escapeCss(v)})`; + }).join("") + : "" + }${escapeCss(moduleId)}` + ); + } catch (e) { + e.message += `\nduring rendering of css ${module.identifier()}`; + throw e; } - emittedModules.set(referencedModule, mergedRuntimeCondition); } + source.add( + `head{--webpack-${escapeCss( + (uniqueName ? uniqueName + "-" : "") + chunk.id, + true + )}:${metaData.join(",")};}` + ); + return source; + } - const importStatement = dep.getImportStatement(false, templateContext); - if ( - referencedModule && - templateContext.moduleGraph.isAsync(referencedModule) - ) { - templateContext.initFragments.push( - new ConditionalInitFragment( - importStatement[0], - InitFragment.STAGE_HARMONY_IMPORTS, - dep.sourceOrder, - key, - runtimeCondition - ) - ); - templateContext.initFragments.push( - new AwaitDependenciesInitFragment( - new Set([dep.getImportVar(templateContext.moduleGraph)]) - ) - ); - templateContext.initFragments.push( - new ConditionalInitFragment( - importStatement[1], - InitFragment.STAGE_ASYNC_HARMONY_IMPORTS, - dep.sourceOrder, - key + " compat", - runtimeCondition - ) - ); + static getChunkFilenameTemplate(chunk, outputOptions) { + if (chunk.cssFilenameTemplate) { + return chunk.cssFilenameTemplate; + } else if (chunk.canBeInitial()) { + return outputOptions.cssFilename; } else { - templateContext.initFragments.push( - new ConditionalInitFragment( - importStatement[0] + importStatement[1], - InitFragment.STAGE_HARMONY_IMPORTS, - dep.sourceOrder, - key, - runtimeCondition - ) - ); + return outputOptions.cssChunkFilename; } } - /** - * - * @param {Module} module the module - * @param {Module} referencedModule the referenced module - * @returns {RuntimeSpec | boolean} runtimeCondition in which this import has been emitted - */ - static getImportEmittedRuntime(module, referencedModule) { - const emittedModules = importEmittedMap.get(module); - if (emittedModules === undefined) return false; - return emittedModules.get(referencedModule) || false; + static chunkHasCss(chunk, chunkGraph) { + return ( + !!chunkGraph.getChunkModulesIterableBySourceType(chunk, "css") || + !!chunkGraph.getChunkModulesIterableBySourceType(chunk, "css-import") + ); } -}; +} -module.exports.ExportPresenceModes = ExportPresenceModes; +module.exports = CssModulesPlugin; /***/ }), -/***/ 20862: +/***/ 98305: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -79101,349 +76258,623 @@ module.exports.ExportPresenceModes = ExportPresenceModes; -const HotModuleReplacementPlugin = __webpack_require__(6404); -const InnerGraph = __webpack_require__(38988); +const Parser = __webpack_require__(11715); const ConstDependency = __webpack_require__(76911); -const HarmonyAcceptDependency = __webpack_require__(23624); -const HarmonyAcceptImportDependency = __webpack_require__(99843); -const HarmonyExports = __webpack_require__(39211); -const { ExportPresenceModes } = __webpack_require__(57154); -const HarmonyImportSideEffectDependency = __webpack_require__(73132); -const HarmonyImportSpecifierDependency = __webpack_require__(14077); +const CssExportDependency = __webpack_require__(76760); +const CssImportDependency = __webpack_require__(90542); +const CssLocalIdentifierDependency = __webpack_require__(92328); +const CssSelfLocalIdentifierDependency = __webpack_require__(29094); +const CssUrlDependency = __webpack_require__(70749); +const StaticExportsDependency = __webpack_require__(91418); +const walkCssTokens = __webpack_require__(44124); -/** @typedef {import("estree").ExportAllDeclaration} ExportAllDeclaration */ -/** @typedef {import("estree").ExportNamedDeclaration} ExportNamedDeclaration */ -/** @typedef {import("estree").Identifier} Identifier */ -/** @typedef {import("estree").ImportDeclaration} ImportDeclaration */ -/** @typedef {import("estree").ImportExpression} ImportExpression */ -/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ -/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ -/** @typedef {import("../optimize/InnerGraph").InnerGraph} InnerGraph */ -/** @typedef {import("../optimize/InnerGraph").TopLevelSymbol} TopLevelSymbol */ -/** @typedef {import("./HarmonyImportDependency")} HarmonyImportDependency */ +/** @typedef {import("../Parser").ParserState} ParserState */ +/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ -const harmonySpecifierTag = Symbol("harmony import"); +const CC_LEFT_CURLY = "{".charCodeAt(0); +const CC_RIGHT_CURLY = "}".charCodeAt(0); +const CC_COLON = ":".charCodeAt(0); +const CC_SLASH = "/".charCodeAt(0); +const CC_SEMICOLON = ";".charCodeAt(0); -/** - * @typedef {Object} HarmonySettings - * @property {string[]} ids - * @property {string} source - * @property {number} sourceOrder - * @property {string} name - * @property {boolean} await - * @property {Record | undefined} assertions - */ +const cssUnescape = str => { + return str.replace(/\\([0-9a-fA-F]{1,6}[ \t\n\r\f]?|[\s\S])/g, match => { + if (match.length > 2) { + return String.fromCharCode(parseInt(match.slice(1).trim(), 16)); + } else { + return match[1]; + } + }); +}; -/** - * @param {ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | ImportExpression} node node with assertions - * @returns {Record | undefined} assertions - */ -function getAssertions(node) { - // TODO remove cast when @types/estree has been updated to import assertions - const assertions = /** @type {{ assertions?: ImportAttributeNode[] }} */ ( - node - ).assertions; - if (assertions === undefined) { - return undefined; +class LocConverter { + constructor(input) { + this._input = input; + this.line = 1; + this.column = 0; + this.pos = 0; } - const result = {}; - for (const assertion of assertions) { - const key = - assertion.key.type === "Identifier" - ? assertion.key.name - : assertion.key.value; - result[key] = assertion.value.value; + + get(pos) { + if (this.pos !== pos) { + if (this.pos < pos) { + const str = this._input.slice(this.pos, pos); + let i = str.lastIndexOf("\n"); + if (i === -1) { + this.column += str.length; + } else { + this.column = str.length - i - 1; + this.line++; + while (i > 0 && (i = str.lastIndexOf("\n", i - 1)) !== -1) + this.line++; + } + } else { + let i = this._input.lastIndexOf("\n", this.pos); + while (i >= pos) { + this.line--; + i = i > 0 ? this._input.lastIndexOf("\n", i - 1) : -1; + } + this.column = pos - i; + } + this.pos = pos; + } + return this; } - return result; } -module.exports = class HarmonyImportDependencyParserPlugin { - /** - * @param {JavascriptParserOptions} options options - */ - constructor(options) { - this.exportPresenceMode = - options.importExportsPresence !== undefined - ? ExportPresenceModes.fromUserOption(options.importExportsPresence) - : options.exportsPresence !== undefined - ? ExportPresenceModes.fromUserOption(options.exportsPresence) - : options.strictExportPresence - ? ExportPresenceModes.ERROR - : ExportPresenceModes.AUTO; - this.strictThisContextOnImports = options.strictThisContextOnImports; +const CSS_MODE_TOP_LEVEL = 0; +const CSS_MODE_IN_RULE = 1; +const CSS_MODE_IN_LOCAL_RULE = 2; +const CSS_MODE_AT_IMPORT_EXPECT_URL = 3; +// TODO implement layer and supports for @import +const CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS = 4; +const CSS_MODE_AT_IMPORT_EXPECT_MEDIA = 5; +const CSS_MODE_AT_OTHER = 6; + +const explainMode = mode => { + switch (mode) { + case CSS_MODE_TOP_LEVEL: + return "parsing top level css"; + case CSS_MODE_IN_RULE: + return "parsing css rule content (global)"; + case CSS_MODE_IN_LOCAL_RULE: + return "parsing css rule content (local)"; + case CSS_MODE_AT_IMPORT_EXPECT_URL: + return "parsing @import (expecting url)"; + case CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS: + return "parsing @import (expecting optionally supports or media query)"; + case CSS_MODE_AT_IMPORT_EXPECT_MEDIA: + return "parsing @import (expecting optionally media query)"; + case CSS_MODE_AT_OTHER: + return "parsing at-rule"; + default: + return mode; + } +}; + +class CssParser extends Parser { + constructor({ + allowPseudoBlocks = true, + allowModeSwitch = true, + defaultMode = "global" + } = {}) { + super(); + this.allowPseudoBlocks = allowPseudoBlocks; + this.allowModeSwitch = allowModeSwitch; + this.defaultMode = defaultMode; } /** - * @param {JavascriptParser} parser the parser - * @returns {void} + * @param {string | Buffer | PreparsedAst} source the source to parse + * @param {ParserState} state the parser state + * @returns {ParserState} the parser state */ - apply(parser) { - const { exportPresenceMode } = this; - parser.hooks.isPure - .for("Identifier") - .tap("HarmonyImportDependencyParserPlugin", expression => { - const expr = /** @type {Identifier} */ (expression); - if ( - parser.isVariableDefined(expr.name) || - parser.getTagData(expr.name, harmonySpecifierTag) - ) { - return true; + parse(source, state) { + if (Buffer.isBuffer(source)) { + source = source.toString("utf-8"); + } else if (typeof source === "object") { + throw new Error("webpackAst is unexpected for the CssParser"); + } + if (source[0] === "\ufeff") { + source = source.slice(1); + } + + const module = state.module; + + const declaredCssVariables = new Set(); + + const locConverter = new LocConverter(source); + let mode = CSS_MODE_TOP_LEVEL; + let modePos = 0; + let modeNestingLevel = 0; + let modeData = undefined; + let singleClassSelector = undefined; + let lastIdentifier = undefined; + const modeStack = []; + const isTopLevelLocal = () => + modeData === "local" || + (this.defaultMode === "local" && modeData === undefined); + const eatWhiteLine = (input, pos) => { + for (;;) { + const cc = input.charCodeAt(pos); + if (cc === 32 || cc === 9) { + pos++; + continue; } - }); - parser.hooks.import.tap( - "HarmonyImportDependencyParserPlugin", - (statement, source) => { - parser.state.lastHarmonyImportOrder = - (parser.state.lastHarmonyImportOrder || 0) + 1; - const clearDep = new ConstDependency( - parser.isAsiPosition(statement.range[0]) ? ";" : "", - statement.range - ); - clearDep.loc = statement.loc; - parser.state.module.addPresentationalDependency(clearDep); - parser.unsetAsiPosition(statement.range[1]); - const assertions = getAssertions(statement); - const sideEffectDep = new HarmonyImportSideEffectDependency( - source, - parser.state.lastHarmonyImportOrder, - assertions - ); - sideEffectDep.loc = statement.loc; - parser.state.module.addDependency(sideEffectDep); - return true; - } - ); - parser.hooks.importSpecifier.tap( - "HarmonyImportDependencyParserPlugin", - (statement, source, id, name) => { - const ids = id === null ? [] : [id]; - parser.tagVariable(name, harmonySpecifierTag, { - name, - source, - ids, - sourceOrder: parser.state.lastHarmonyImportOrder, - assertions: getAssertions(statement) - }); - return true; + if (cc === 10) pos++; + break; } - ); - parser.hooks.expression - .for(harmonySpecifierTag) - .tap("HarmonyImportDependencyParserPlugin", expr => { - const settings = /** @type {HarmonySettings} */ (parser.currentTagData); - const dep = new HarmonyImportSpecifierDependency( - settings.source, - settings.sourceOrder, - settings.ids, - settings.name, - expr.range, - exportPresenceMode, - settings.assertions - ); - dep.shorthand = parser.scope.inShorthand; - dep.directImport = true; - dep.asiSafe = !parser.isAsiPosition(expr.range[0]); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); - return true; - }); - parser.hooks.expressionMemberChain - .for(harmonySpecifierTag) - .tap("HarmonyImportDependencyParserPlugin", (expr, members) => { - const settings = /** @type {HarmonySettings} */ (parser.currentTagData); - const ids = settings.ids.concat(members); - const dep = new HarmonyImportSpecifierDependency( - settings.source, - settings.sourceOrder, - ids, - settings.name, - expr.range, - exportPresenceMode, - settings.assertions - ); - dep.asiSafe = !parser.isAsiPosition(expr.range[0]); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); - return true; - }); - parser.hooks.callMemberChain - .for(harmonySpecifierTag) - .tap("HarmonyImportDependencyParserPlugin", (expr, members) => { - const { arguments: args, callee } = expr; - const settings = /** @type {HarmonySettings} */ (parser.currentTagData); - const ids = settings.ids.concat(members); - const dep = new HarmonyImportSpecifierDependency( - settings.source, - settings.sourceOrder, - ids, - settings.name, - callee.range, - exportPresenceMode, - settings.assertions - ); - dep.directImport = members.length === 0; - dep.call = true; - dep.asiSafe = !parser.isAsiPosition(callee.range[0]); - // only in case when we strictly follow the spec we need a special case here - dep.namespaceObjectAsContext = - members.length > 0 && this.strictThisContextOnImports; - dep.loc = callee.loc; - parser.state.module.addDependency(dep); - if (args) parser.walkExpressions(args); - InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); - return true; - }); - const { hotAcceptCallback, hotAcceptWithoutCallback } = - HotModuleReplacementPlugin.getParserHooks(parser); - hotAcceptCallback.tap( - "HarmonyImportDependencyParserPlugin", - (expr, requests) => { - if (!HarmonyExports.isEnabled(parser.state)) { - // This is not a harmony module, skip it - return; + return pos; + }; + const eatUntil = chars => { + const charCodes = Array.from({ length: chars.length }, (_, i) => + chars.charCodeAt(i) + ); + const arr = Array.from( + { length: charCodes.reduce((a, b) => Math.max(a, b), 0) + 1 }, + () => false + ); + charCodes.forEach(cc => (arr[cc] = true)); + return (input, pos) => { + for (;;) { + const cc = input.charCodeAt(pos); + if (cc < arr.length && arr[cc]) { + return pos; + } + pos++; + if (pos === input.length) return pos; + } + }; + }; + const eatText = (input, pos, eater) => { + let text = ""; + for (;;) { + if (input.charCodeAt(pos) === CC_SLASH) { + const newPos = walkCssTokens.eatComments(input, pos); + if (pos !== newPos) { + pos = newPos; + if (pos === input.length) break; + } else { + text += "/"; + pos++; + if (pos === input.length) break; + } } - const dependencies = requests.map(request => { - const dep = new HarmonyAcceptImportDependency(request); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - return dep; - }); - if (dependencies.length > 0) { - const dep = new HarmonyAcceptDependency( - expr.range, - dependencies, - true - ); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); + const newPos = eater(input, pos); + if (pos !== newPos) { + text += input.slice(pos, newPos); + pos = newPos; + } else { + break; } + if (pos === input.length) break; } - ); - hotAcceptWithoutCallback.tap( - "HarmonyImportDependencyParserPlugin", - (expr, requests) => { - if (!HarmonyExports.isEnabled(parser.state)) { - // This is not a harmony module, skip it - return; + return [pos, text.trimRight()]; + }; + const eatExportName = eatUntil(":};/"); + const eatExportValue = eatUntil("};/"); + const parseExports = (input, pos) => { + pos = walkCssTokens.eatWhitespaceAndComments(input, pos); + const cc = input.charCodeAt(pos); + if (cc !== CC_LEFT_CURLY) + throw new Error( + `Unexpected ${input[pos]} at ${pos} during parsing of ':export' (expected '{')` + ); + pos++; + pos = walkCssTokens.eatWhitespaceAndComments(input, pos); + for (;;) { + if (input.charCodeAt(pos) === CC_RIGHT_CURLY) break; + pos = walkCssTokens.eatWhitespaceAndComments(input, pos); + if (pos === input.length) return pos; + let start = pos; + let name; + [pos, name] = eatText(input, pos, eatExportName); + if (pos === input.length) return pos; + if (input.charCodeAt(pos) !== CC_COLON) { + throw new Error( + `Unexpected ${input[pos]} at ${pos} during parsing of export name in ':export' (expected ':')` + ); } - const dependencies = requests.map(request => { - const dep = new HarmonyAcceptImportDependency(request); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - return dep; - }); - if (dependencies.length > 0) { - const dep = new HarmonyAcceptDependency( - expr.range, - dependencies, - false + pos++; + if (pos === input.length) return pos; + pos = walkCssTokens.eatWhitespaceAndComments(input, pos); + if (pos === input.length) return pos; + let value; + [pos, value] = eatText(input, pos, eatExportValue); + if (pos === input.length) return pos; + const cc = input.charCodeAt(pos); + if (cc === CC_SEMICOLON) { + pos++; + if (pos === input.length) return pos; + pos = walkCssTokens.eatWhitespaceAndComments(input, pos); + if (pos === input.length) return pos; + } else if (cc !== CC_RIGHT_CURLY) { + throw new Error( + `Unexpected ${input[pos]} at ${pos} during parsing of export value in ':export' (expected ';' or '}')` ); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); } + const dep = new CssExportDependency(name, value); + const { line: sl, column: sc } = locConverter.get(start); + const { line: el, column: ec } = locConverter.get(pos); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); } - ); - } -}; - -module.exports.harmonySpecifierTag = harmonySpecifierTag; -module.exports.getAssertions = getAssertions; - - -/***/ }), - -/***/ 73132: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const makeSerializable = __webpack_require__(33032); -const HarmonyImportDependency = __webpack_require__(57154); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../InitFragment")} InitFragment */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - -class HarmonyImportSideEffectDependency extends HarmonyImportDependency { - constructor(request, sourceOrder, assertions) { - super(request, sourceOrder, assertions); - } - - get type() { - return "harmony side effect evaluation"; - } - - /** - * @param {ModuleGraph} moduleGraph module graph - * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active - */ - getCondition(moduleGraph) { - return connection => { - const refModule = connection.resolvedModule; - if (!refModule) return true; - return refModule.getSideEffectsConnectionState(moduleGraph); + pos++; + if (pos === input.length) return pos; + pos = eatWhiteLine(input, pos); + return pos; }; - } + const eatPropertyName = eatUntil(":{};"); + const processLocalDeclaration = (input, pos) => { + modeData = undefined; + const start = pos; + pos = walkCssTokens.eatWhitespaceAndComments(input, pos); + const propertyNameStart = pos; + const [propertyNameEnd, propertyName] = eatText( + input, + pos, + eatPropertyName + ); + if (input.charCodeAt(propertyNameEnd) !== CC_COLON) return start; + pos = propertyNameEnd + 1; + if (propertyName.startsWith("--")) { + // CSS Variable + const { line: sl, column: sc } = locConverter.get(propertyNameStart); + const { line: el, column: ec } = locConverter.get(propertyNameEnd); + const name = propertyName.slice(2); + const dep = new CssLocalIdentifierDependency( + name, + [propertyNameStart, propertyNameEnd], + "--" + ); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); + declaredCssVariables.add(name); + } else if ( + propertyName === "animation-name" || + propertyName === "animation" + ) { + modeData = "animation"; + lastIdentifier = undefined; + } + return pos; + }; + const processDeclarationValueDone = (input, pos) => { + if (modeData === "animation" && lastIdentifier) { + const { line: sl, column: sc } = locConverter.get(lastIdentifier[0]); + const { line: el, column: ec } = locConverter.get(lastIdentifier[1]); + const name = input.slice(lastIdentifier[0], lastIdentifier[1]); + const dep = new CssSelfLocalIdentifierDependency(name, lastIdentifier); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); + } + }; + const eatKeyframes = eatUntil("{};/"); + const eatNameInVar = eatUntil(",)};/"); + walkCssTokens(source, { + isSelector: () => { + return mode !== CSS_MODE_IN_RULE && mode !== CSS_MODE_IN_LOCAL_RULE; + }, + url: (input, start, end, contentStart, contentEnd) => { + const value = cssUnescape(input.slice(contentStart, contentEnd)); + switch (mode) { + case CSS_MODE_AT_IMPORT_EXPECT_URL: { + modeData.url = value; + mode = CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS; + break; + } + case CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS: + case CSS_MODE_AT_IMPORT_EXPECT_MEDIA: + throw new Error( + `Unexpected ${input.slice( + start, + end + )} at ${start} during ${explainMode(mode)}` + ); + default: { + const dep = new CssUrlDependency(value, [start, end], "url"); + const { line: sl, column: sc } = locConverter.get(start); + const { line: el, column: ec } = locConverter.get(end); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); + module.addCodeGenerationDependency(dep); + break; + } + } + return end; + }, + string: (input, start, end) => { + switch (mode) { + case CSS_MODE_AT_IMPORT_EXPECT_URL: { + modeData.url = cssUnescape(input.slice(start + 1, end - 1)); + mode = CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS; + break; + } + } + return end; + }, + atKeyword: (input, start, end) => { + const name = input.slice(start, end); + if (name === "@namespace") { + throw new Error("@namespace is not supported in bundled CSS"); + } + if (name === "@import") { + if (mode !== CSS_MODE_TOP_LEVEL) { + throw new Error( + `Unexpected @import at ${start} during ${explainMode(mode)}` + ); + } + mode = CSS_MODE_AT_IMPORT_EXPECT_URL; + modePos = end; + modeData = { + start: start, + url: undefined, + supports: undefined + }; + } + if (name === "@keyframes") { + let pos = end; + pos = walkCssTokens.eatWhitespaceAndComments(input, pos); + if (pos === input.length) return pos; + const [newPos, name] = eatText(input, pos, eatKeyframes); + const { line: sl, column: sc } = locConverter.get(pos); + const { line: el, column: ec } = locConverter.get(newPos); + const dep = new CssLocalIdentifierDependency(name, [pos, newPos]); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); + pos = newPos; + if (pos === input.length) return pos; + if (input.charCodeAt(pos) !== CC_LEFT_CURLY) { + throw new Error( + `Unexpected ${input[pos]} at ${pos} during parsing of @keyframes (expected '{')` + ); + } + mode = CSS_MODE_IN_LOCAL_RULE; + modeNestingLevel = 1; + return pos + 1; + } + return end; + }, + semicolon: (input, start, end) => { + switch (mode) { + case CSS_MODE_AT_IMPORT_EXPECT_URL: + throw new Error(`Expected URL for @import at ${start}`); + case CSS_MODE_AT_IMPORT_EXPECT_MEDIA: + case CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS: { + const { line: sl, column: sc } = locConverter.get(modeData.start); + const { line: el, column: ec } = locConverter.get(end); + end = eatWhiteLine(input, end); + const media = input.slice(modePos, start).trim(); + const dep = new CssImportDependency( + modeData.url, + [modeData.start, end], + modeData.supports, + media + ); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); + break; + } + case CSS_MODE_IN_LOCAL_RULE: { + processDeclarationValueDone(input, start); + return processLocalDeclaration(input, end); + } + case CSS_MODE_IN_RULE: { + return end; + } + } + mode = CSS_MODE_TOP_LEVEL; + modeData = undefined; + singleClassSelector = undefined; + return end; + }, + leftCurlyBracket: (input, start, end) => { + switch (mode) { + case CSS_MODE_TOP_LEVEL: + mode = isTopLevelLocal() + ? CSS_MODE_IN_LOCAL_RULE + : CSS_MODE_IN_RULE; + modeNestingLevel = 1; + if (mode === CSS_MODE_IN_LOCAL_RULE) + return processLocalDeclaration(input, end); + break; + case CSS_MODE_IN_RULE: + case CSS_MODE_IN_LOCAL_RULE: + modeNestingLevel++; + break; + } + return end; + }, + rightCurlyBracket: (input, start, end) => { + switch (mode) { + case CSS_MODE_IN_LOCAL_RULE: + processDeclarationValueDone(input, start); + /* falls through */ + case CSS_MODE_IN_RULE: + if (--modeNestingLevel === 0) { + mode = CSS_MODE_TOP_LEVEL; + modeData = undefined; + singleClassSelector = undefined; + } + break; + } + return end; + }, + id: (input, start, end) => { + singleClassSelector = false; + switch (mode) { + case CSS_MODE_TOP_LEVEL: + if (isTopLevelLocal()) { + const name = input.slice(start + 1, end); + const dep = new CssLocalIdentifierDependency(name, [ + start + 1, + end + ]); + const { line: sl, column: sc } = locConverter.get(start); + const { line: el, column: ec } = locConverter.get(end); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); + } + break; + } + return end; + }, + identifier: (input, start, end) => { + singleClassSelector = false; + switch (mode) { + case CSS_MODE_IN_LOCAL_RULE: + if (modeData === "animation") { + lastIdentifier = [start, end]; + } + break; + } + return end; + }, + class: (input, start, end) => { + switch (mode) { + case CSS_MODE_TOP_LEVEL: { + if (isTopLevelLocal()) { + const name = input.slice(start + 1, end); + const dep = new CssLocalIdentifierDependency(name, [ + start + 1, + end + ]); + const { line: sl, column: sc } = locConverter.get(start); + const { line: el, column: ec } = locConverter.get(end); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); + if (singleClassSelector === undefined) singleClassSelector = name; + } else { + singleClassSelector = false; + } + break; + } + } + return end; + }, + leftParenthesis: (input, start, end) => { + switch (mode) { + case CSS_MODE_TOP_LEVEL: { + modeStack.push(false); + break; + } + } + return end; + }, + rightParenthesis: (input, start, end) => { + switch (mode) { + case CSS_MODE_TOP_LEVEL: { + const newModeData = modeStack.pop(); + if (newModeData !== false) { + modeData = newModeData; + const dep = new ConstDependency("", [start, end]); + module.addPresentationalDependency(dep); + } + break; + } + } + return end; + }, + pseudoClass: (input, start, end) => { + singleClassSelector = false; + switch (mode) { + case CSS_MODE_TOP_LEVEL: { + const name = input.slice(start, end); + if (this.allowModeSwitch && name === ":global") { + modeData = "global"; + const dep = new ConstDependency("", [start, end]); + module.addPresentationalDependency(dep); + } else if (this.allowModeSwitch && name === ":local") { + modeData = "local"; + const dep = new ConstDependency("", [start, end]); + module.addPresentationalDependency(dep); + } else if (this.allowPseudoBlocks && name === ":export") { + const pos = parseExports(input, end); + const dep = new ConstDependency("", [start, pos]); + module.addPresentationalDependency(dep); + return pos; + } + break; + } + } + return end; + }, + pseudoFunction: (input, start, end) => { + switch (mode) { + case CSS_MODE_TOP_LEVEL: { + const name = input.slice(start, end - 1); + if (this.allowModeSwitch && name === ":global") { + modeStack.push(modeData); + modeData = "global"; + const dep = new ConstDependency("", [start, end]); + module.addPresentationalDependency(dep); + } else if (this.allowModeSwitch && name === ":local") { + modeStack.push(modeData); + modeData = "local"; + const dep = new ConstDependency("", [start, end]); + module.addPresentationalDependency(dep); + } else { + modeStack.push(false); + } + break; + } + } + return end; + }, + function: (input, start, end) => { + switch (mode) { + case CSS_MODE_IN_LOCAL_RULE: { + const name = input.slice(start, end - 1); + if (name === "var") { + let pos = walkCssTokens.eatWhitespaceAndComments(input, end); + if (pos === input.length) return pos; + const [newPos, name] = eatText(input, pos, eatNameInVar); + if (!name.startsWith("--")) return end; + const { line: sl, column: sc } = locConverter.get(pos); + const { line: el, column: ec } = locConverter.get(newPos); + const dep = new CssSelfLocalIdentifierDependency( + name.slice(2), + [pos, newPos], + "--", + declaredCssVariables + ); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); + return newPos; + } + break; + } + } + return end; + }, + comma: (input, start, end) => { + switch (mode) { + case CSS_MODE_TOP_LEVEL: + modeData = undefined; + modeStack.length = 0; + break; + case CSS_MODE_IN_LOCAL_RULE: + processDeclarationValueDone(input, start); + break; + } + return end; + } + }); - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this dependency connects the module to referencing modules - */ - getModuleEvaluationSideEffectsState(moduleGraph) { - const refModule = moduleGraph.getModule(this); - if (!refModule) return true; - return refModule.getSideEffectsConnectionState(moduleGraph); + module.buildInfo.strict = true; + module.buildMeta.exportsType = "namespace"; + module.addDependency(new StaticExportsDependency([], true)); + return state; } } -makeSerializable( - HarmonyImportSideEffectDependency, - "webpack/lib/dependencies/HarmonyImportSideEffectDependency" -); - -HarmonyImportSideEffectDependency.Template = class HarmonyImportSideEffectDependencyTemplate extends ( - HarmonyImportDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, templateContext) { - const { moduleGraph, concatenationScope } = templateContext; - if (concatenationScope) { - const module = moduleGraph.getModule(dependency); - if (concatenationScope.isModuleInScope(module)) { - return; - } - } - super.apply(dependency, source, templateContext); - } -}; - -module.exports = HarmonyImportSideEffectDependency; +module.exports = CssParser; /***/ }), -/***/ 14077: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 44124: +/***/ (function(module) { "use strict"; /* @@ -79453,670 +76884,1125 @@ module.exports = HarmonyImportSideEffectDependency; -const Dependency = __webpack_require__(54912); -const { - getDependencyUsedByExportsCondition -} = __webpack_require__(38988); -const makeSerializable = __webpack_require__(33032); -const propertyAccess = __webpack_require__(54190); -const HarmonyImportDependency = __webpack_require__(57154); +/** + * @typedef {Object} CssTokenCallbacks + * @property {function(string, number): boolean} isSelector + * @property {function(string, number, number, number, number): number=} url + * @property {function(string, number, number): number=} string + * @property {function(string, number, number): number=} leftParenthesis + * @property {function(string, number, number): number=} rightParenthesis + * @property {function(string, number, number): number=} pseudoFunction + * @property {function(string, number, number): number=} function + * @property {function(string, number, number): number=} pseudoClass + * @property {function(string, number, number): number=} atKeyword + * @property {function(string, number, number): number=} class + * @property {function(string, number, number): number=} identifier + * @property {function(string, number, number): number=} id + * @property {function(string, number, number): number=} leftCurlyBracket + * @property {function(string, number, number): number=} rightCurlyBracket + * @property {function(string, number, number): number=} semicolon + * @property {function(string, number, number): number=} comma + */ -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +/** @typedef {function(string, number, CssTokenCallbacks): number} CharHandler */ -const idsSymbol = Symbol("HarmonyImportSpecifierDependency.ids"); +// spec: https://drafts.csswg.org/css-syntax/ -const { ExportPresenceModes } = HarmonyImportDependency; +const CC_LINE_FEED = "\n".charCodeAt(0); +const CC_CARRIAGE_RETURN = "\r".charCodeAt(0); +const CC_FORM_FEED = "\f".charCodeAt(0); -class HarmonyImportSpecifierDependency extends HarmonyImportDependency { - constructor( - request, - sourceOrder, - ids, - name, - range, - exportPresenceMode, - assertions - ) { - super(request, sourceOrder, assertions); - this.ids = ids; - this.name = name; - this.range = range; - this.exportPresenceMode = exportPresenceMode; - this.namespaceObjectAsContext = false; - this.call = undefined; - this.directImport = undefined; - this.shorthand = undefined; - this.asiSafe = undefined; - /** @type {Set | boolean} */ - this.usedByExports = undefined; - } +const CC_TAB = "\t".charCodeAt(0); +const CC_SPACE = " ".charCodeAt(0); - // TODO webpack 6 remove - get id() { - throw new Error("id was renamed to ids and type changed to string[]"); - } +const CC_SLASH = "/".charCodeAt(0); +const CC_BACK_SLASH = "\\".charCodeAt(0); +const CC_ASTERISK = "*".charCodeAt(0); - // TODO webpack 6 remove - getId() { - throw new Error("id was renamed to ids and type changed to string[]"); - } +const CC_LEFT_PARENTHESIS = "(".charCodeAt(0); +const CC_RIGHT_PARENTHESIS = ")".charCodeAt(0); +const CC_LEFT_CURLY = "{".charCodeAt(0); +const CC_RIGHT_CURLY = "}".charCodeAt(0); - // TODO webpack 6 remove - setId() { - throw new Error("id was renamed to ids and type changed to string[]"); - } +const CC_QUOTATION_MARK = '"'.charCodeAt(0); +const CC_APOSTROPHE = "'".charCodeAt(0); - get type() { - return "harmony import specifier"; +const CC_FULL_STOP = ".".charCodeAt(0); +const CC_COLON = ":".charCodeAt(0); +const CC_SEMICOLON = ";".charCodeAt(0); +const CC_COMMA = ",".charCodeAt(0); +const CC_PERCENTAGE = "%".charCodeAt(0); +const CC_AT_SIGN = "@".charCodeAt(0); + +const CC_LOW_LINE = "_".charCodeAt(0); +const CC_LOWER_A = "a".charCodeAt(0); +const CC_LOWER_U = "u".charCodeAt(0); +const CC_LOWER_E = "e".charCodeAt(0); +const CC_LOWER_Z = "z".charCodeAt(0); +const CC_UPPER_A = "A".charCodeAt(0); +const CC_UPPER_E = "E".charCodeAt(0); +const CC_UPPER_Z = "Z".charCodeAt(0); +const CC_0 = "0".charCodeAt(0); +const CC_9 = "9".charCodeAt(0); + +const CC_NUMBER_SIGN = "#".charCodeAt(0); +const CC_PLUS_SIGN = "+".charCodeAt(0); +const CC_HYPHEN_MINUS = "-".charCodeAt(0); + +const CC_LESS_THAN_SIGN = "<".charCodeAt(0); +const CC_GREATER_THAN_SIGN = ">".charCodeAt(0); + +const _isNewLine = cc => { + return ( + cc === CC_LINE_FEED || cc === CC_CARRIAGE_RETURN || cc === CC_FORM_FEED + ); +}; + +/** @type {CharHandler} */ +const consumeSpace = (input, pos, callbacks) => { + let cc; + do { + pos++; + cc = input.charCodeAt(pos); + } while (_isWhiteSpace(cc)); + return pos; +}; + +const _isWhiteSpace = cc => { + return ( + cc === CC_LINE_FEED || + cc === CC_CARRIAGE_RETURN || + cc === CC_FORM_FEED || + cc === CC_TAB || + cc === CC_SPACE + ); +}; + +/** @type {CharHandler} */ +const consumeSingleCharToken = (input, pos, callbacks) => { + return pos + 1; +}; + +/** @type {CharHandler} */ +const consumePotentialComment = (input, pos, callbacks) => { + pos++; + if (pos === input.length) return pos; + let cc = input.charCodeAt(pos); + if (cc !== CC_ASTERISK) return pos; + for (;;) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + while (cc === CC_ASTERISK) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + if (cc === CC_SLASH) return pos + 1; + } } +}; - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {string[]} the imported ids - */ - getIds(moduleGraph) { - const meta = moduleGraph.getMetaIfExisting(this); - if (meta === undefined) return this.ids; - const ids = meta[idsSymbol]; - return ids !== undefined ? ids : this.ids; +/** @type {function(number): CharHandler} */ +const consumeString = end => (input, pos, callbacks) => { + const start = pos; + pos = _consumeString(input, pos, end); + if (callbacks.string !== undefined) { + pos = callbacks.string(input, start, pos); } + return pos; +}; - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {string[]} ids the imported ids - * @returns {void} - */ - setIds(moduleGraph, ids) { - moduleGraph.getMeta(this)[idsSymbol] = ids; +const _consumeString = (input, pos, end) => { + pos++; + for (;;) { + if (pos === input.length) return pos; + const cc = input.charCodeAt(pos); + if (cc === end) return pos + 1; + if (_isNewLine(cc)) { + // bad string + return pos; + } + if (cc === CC_BACK_SLASH) { + // we don't need to fully parse the escaped code point + // just skip over a potential new line + pos++; + if (pos === input.length) return pos; + pos++; + } else { + pos++; + } } +}; - /** - * @param {ModuleGraph} moduleGraph module graph - * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active - */ - getCondition(moduleGraph) { - return getDependencyUsedByExportsCondition( - this, - this.usedByExports, - moduleGraph - ); +const _isIdentifierStartCode = cc => { + return ( + cc === CC_LOW_LINE || + (cc >= CC_LOWER_A && cc <= CC_LOWER_Z) || + (cc >= CC_UPPER_A && cc <= CC_UPPER_Z) || + cc > 0x80 + ); +}; + +const _isDigit = cc => { + return cc >= CC_0 && cc <= CC_9; +}; + +const _startsIdentifier = (input, pos) => { + const cc = input.charCodeAt(pos); + if (cc === CC_HYPHEN_MINUS) { + if (pos === input.length) return false; + const cc = input.charCodeAt(pos + 1); + if (cc === CC_HYPHEN_MINUS) return true; + if (cc === CC_BACK_SLASH) { + const cc = input.charCodeAt(pos + 2); + return !_isNewLine(cc); + } + return _isIdentifierStartCode(cc); + } + if (cc === CC_BACK_SLASH) { + const cc = input.charCodeAt(pos + 1); + return !_isNewLine(cc); } + return _isIdentifierStartCode(cc); +}; - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this dependency connects the module to referencing modules - */ - getModuleEvaluationSideEffectsState(moduleGraph) { - return false; +/** @type {CharHandler} */ +const consumeNumberSign = (input, pos, callbacks) => { + const start = pos; + pos++; + if (pos === input.length) return pos; + if (callbacks.isSelector(input, pos) && _startsIdentifier(input, pos)) { + pos = _consumeIdentifier(input, pos); + if (callbacks.id !== undefined) { + return callbacks.id(input, start, pos); + } } + return pos; +}; - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - let ids = this.getIds(moduleGraph); - if (ids.length === 0) return Dependency.EXPORTS_OBJECT_REFERENCED; - let namespaceObjectAsContext = this.namespaceObjectAsContext; - if (ids[0] === "default") { - const selfModule = moduleGraph.getParentModule(this); - const importedModule = moduleGraph.getModule(this); - switch ( - importedModule.getExportsType( - moduleGraph, - selfModule.buildMeta.strictHarmonyModule - ) - ) { - case "default-only": - case "default-with-named": - if (ids.length === 1) return Dependency.EXPORTS_OBJECT_REFERENCED; - ids = ids.slice(1); - namespaceObjectAsContext = true; - break; - case "dynamic": - return Dependency.EXPORTS_OBJECT_REFERENCED; +/** @type {CharHandler} */ +const consumeMinus = (input, pos, callbacks) => { + const start = pos; + pos++; + if (pos === input.length) return pos; + const cc = input.charCodeAt(pos); + if (cc === CC_FULL_STOP || _isDigit(cc)) { + return consumeNumericToken(input, pos, callbacks); + } else if (cc === CC_HYPHEN_MINUS) { + pos++; + if (pos === input.length) return pos; + const cc = input.charCodeAt(pos); + if (cc === CC_GREATER_THAN_SIGN) { + return pos + 1; + } else { + pos = _consumeIdentifier(input, pos); + if (callbacks.identifier !== undefined) { + return callbacks.identifier(input, start, pos); } } - - if ( - this.call && - !this.directImport && - (namespaceObjectAsContext || ids.length > 1) - ) { - if (ids.length === 1) return Dependency.EXPORTS_OBJECT_REFERENCED; - ids = ids.slice(0, -1); + } else if (cc === CC_BACK_SLASH) { + if (pos + 1 === input.length) return pos; + const cc = input.charCodeAt(pos + 1); + if (_isNewLine(cc)) return pos; + pos = _consumeIdentifier(input, pos); + if (callbacks.identifier !== undefined) { + return callbacks.identifier(input, start, pos); + } + } else if (_isIdentifierStartCode(cc)) { + pos++; + pos = _consumeIdentifier(input, pos); + if (callbacks.identifier !== undefined) { + return callbacks.identifier(input, start, pos); } - - return [ids]; } + return pos; +}; - /** - * @param {ModuleGraph} moduleGraph module graph - * @returns {number} effective mode - */ - _getEffectiveExportPresenceLevel(moduleGraph) { - if (this.exportPresenceMode !== ExportPresenceModes.AUTO) - return this.exportPresenceMode; - return moduleGraph.getParentModule(this).buildMeta.strictHarmonyModule - ? ExportPresenceModes.ERROR - : ExportPresenceModes.WARN; +/** @type {CharHandler} */ +const consumeDot = (input, pos, callbacks) => { + const start = pos; + pos++; + if (pos === input.length) return pos; + const cc = input.charCodeAt(pos); + if (_isDigit(cc)) return consumeNumericToken(input, pos - 2, callbacks); + if (!callbacks.isSelector(input, pos) || !_startsIdentifier(input, pos)) + return pos; + pos = _consumeIdentifier(input, pos); + if (callbacks.class !== undefined) return callbacks.class(input, start, pos); + return pos; +}; + +/** @type {CharHandler} */ +const consumeNumericToken = (input, pos, callbacks) => { + pos = _consumeNumber(input, pos); + if (pos === input.length) return pos; + if (_startsIdentifier(input, pos)) return _consumeIdentifier(input, pos); + const cc = input.charCodeAt(pos); + if (cc === CC_PERCENTAGE) return pos + 1; + return pos; +}; + +/** @type {CharHandler} */ +const consumeOtherIdentifier = (input, pos, callbacks) => { + const start = pos; + pos = _consumeIdentifier(input, pos); + if ( + pos !== input.length && + !callbacks.isSelector(input, pos) && + input.charCodeAt(pos) === CC_LEFT_PARENTHESIS + ) { + pos++; + if (callbacks.function !== undefined) { + return callbacks.function(input, start, pos); + } + } else { + if (callbacks.identifier !== undefined) { + return callbacks.identifier(input, start, pos); + } } + return pos; +}; - /** - * Returns warnings - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[]} warnings - */ - getWarnings(moduleGraph) { - const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); - if (exportsPresence === ExportPresenceModes.WARN) { - return this._getErrors(moduleGraph); +/** @type {CharHandler} */ +const consumePotentialUrl = (input, pos, callbacks) => { + const start = pos; + pos = _consumeIdentifier(input, pos); + if (pos === start + 3 && input.slice(start, pos + 1) === "url(") { + pos++; + let cc = input.charCodeAt(pos); + while (_isWhiteSpace(cc)) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + } + if (cc === CC_QUOTATION_MARK || cc === CC_APOSTROPHE) { + pos++; + const contentStart = pos; + pos = _consumeString(input, pos, cc); + const contentEnd = pos - 1; + cc = input.charCodeAt(pos); + while (_isWhiteSpace(cc)) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + } + if (cc !== CC_RIGHT_PARENTHESIS) return pos; + pos++; + if (callbacks.url !== undefined) + return callbacks.url(input, start, pos, contentStart, contentEnd); + return pos; + } else { + const contentStart = pos; + let contentEnd; + for (;;) { + if (cc === CC_BACK_SLASH) { + pos++; + if (pos === input.length) return pos; + pos++; + } else if (_isWhiteSpace(cc)) { + contentEnd = pos; + do { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + } while (_isWhiteSpace(cc)); + if (cc !== CC_RIGHT_PARENTHESIS) return pos; + pos++; + if (callbacks.url !== undefined) { + return callbacks.url(input, start, pos, contentStart, contentEnd); + } + return pos; + } else if (cc === CC_RIGHT_PARENTHESIS) { + contentEnd = pos; + pos++; + if (callbacks.url !== undefined) { + return callbacks.url(input, start, pos, contentStart, contentEnd); + } + return pos; + } else if (cc === CC_LEFT_PARENTHESIS) { + return pos; + } else { + pos++; + } + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + } + } + } else { + if (callbacks.identifier !== undefined) { + return callbacks.identifier(input, start, pos); } - return null; + return pos; } +}; - /** - * Returns errors - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[]} errors - */ - getErrors(moduleGraph) { - const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); - if (exportsPresence === ExportPresenceModes.ERROR) { - return this._getErrors(moduleGraph); +/** @type {CharHandler} */ +const consumePotentialPseudo = (input, pos, callbacks) => { + const start = pos; + pos++; + if (!callbacks.isSelector(input, pos) || !_startsIdentifier(input, pos)) + return pos; + pos = _consumeIdentifier(input, pos); + let cc = input.charCodeAt(pos); + if (cc === CC_LEFT_PARENTHESIS) { + pos++; + if (callbacks.pseudoFunction !== undefined) { + return callbacks.pseudoFunction(input, start, pos); } - return null; + return pos; } - - /** - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[] | undefined} errors - */ - _getErrors(moduleGraph) { - const ids = this.getIds(moduleGraph); - return this.getLinkingErrors( - moduleGraph, - ids, - `(imported as '${this.name}')` - ); + if (callbacks.pseudoClass !== undefined) { + return callbacks.pseudoClass(input, start, pos); } + return pos; +}; - /** - * implement this method to allow the occurrence order plugin to count correctly - * @returns {number} count how often the id is used in this dependency - */ - getNumberOfIdOccurrences() { - return 0; +/** @type {CharHandler} */ +const consumeLeftParenthesis = (input, pos, callbacks) => { + pos++; + if (callbacks.leftParenthesis !== undefined) { + return callbacks.leftParenthesis(input, pos - 1, pos); } + return pos; +}; - serialize(context) { - const { write } = context; - write(this.ids); - write(this.name); - write(this.range); - write(this.exportPresenceMode); - write(this.namespaceObjectAsContext); - write(this.call); - write(this.directImport); - write(this.shorthand); - write(this.asiSafe); - write(this.usedByExports); - super.serialize(context); +/** @type {CharHandler} */ +const consumeRightParenthesis = (input, pos, callbacks) => { + pos++; + if (callbacks.rightParenthesis !== undefined) { + return callbacks.rightParenthesis(input, pos - 1, pos); } + return pos; +}; - deserialize(context) { - const { read } = context; - this.ids = read(); - this.name = read(); - this.range = read(); - this.exportPresenceMode = read(); - this.namespaceObjectAsContext = read(); - this.call = read(); - this.directImport = read(); - this.shorthand = read(); - this.asiSafe = read(); - this.usedByExports = read(); - super.deserialize(context); +/** @type {CharHandler} */ +const consumeLeftCurlyBracket = (input, pos, callbacks) => { + pos++; + if (callbacks.leftCurlyBracket !== undefined) { + return callbacks.leftCurlyBracket(input, pos - 1, pos); } -} + return pos; +}; -makeSerializable( - HarmonyImportSpecifierDependency, - "webpack/lib/dependencies/HarmonyImportSpecifierDependency" -); +/** @type {CharHandler} */ +const consumeRightCurlyBracket = (input, pos, callbacks) => { + pos++; + if (callbacks.rightCurlyBracket !== undefined) { + return callbacks.rightCurlyBracket(input, pos - 1, pos); + } + return pos; +}; -HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependencyTemplate extends ( - HarmonyImportDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, templateContext) { - const dep = /** @type {HarmonyImportSpecifierDependency} */ (dependency); - const { moduleGraph, module, runtime, concatenationScope } = - templateContext; - const connection = moduleGraph.getConnection(dep); - // Skip rendering depending when dependency is conditional - if (connection && !connection.isTargetActive(runtime)) return; +/** @type {CharHandler} */ +const consumeSemicolon = (input, pos, callbacks) => { + pos++; + if (callbacks.semicolon !== undefined) { + return callbacks.semicolon(input, pos - 1, pos); + } + return pos; +}; - const ids = dep.getIds(moduleGraph); +/** @type {CharHandler} */ +const consumeComma = (input, pos, callbacks) => { + pos++; + if (callbacks.comma !== undefined) { + return callbacks.comma(input, pos - 1, pos); + } + return pos; +}; - let exportExpr; - if ( - connection && - concatenationScope && - concatenationScope.isModuleInScope(connection.module) +const _consumeIdentifier = (input, pos) => { + for (;;) { + const cc = input.charCodeAt(pos); + if (cc === CC_BACK_SLASH) { + pos++; + if (pos === input.length) return pos; + pos++; + } else if ( + _isIdentifierStartCode(cc) || + _isDigit(cc) || + cc === CC_HYPHEN_MINUS ) { - if (ids.length === 0) { - exportExpr = concatenationScope.createModuleReference( - connection.module, - { - asiSafe: dep.asiSafe - } - ); - } else if (dep.namespaceObjectAsContext && ids.length === 1) { - exportExpr = - concatenationScope.createModuleReference(connection.module, { - asiSafe: dep.asiSafe - }) + propertyAccess(ids); - } else { - exportExpr = concatenationScope.createModuleReference( - connection.module, - { - ids, - call: dep.call, - directImport: dep.directImport, - asiSafe: dep.asiSafe - } - ); - } + pos++; } else { - super.apply(dependency, source, templateContext); - - const { runtimeTemplate, initFragments, runtimeRequirements } = - templateContext; + return pos; + } + } +}; - exportExpr = runtimeTemplate.exportFromImport({ - moduleGraph, - module: moduleGraph.getModule(dep), - request: dep.request, - exportName: ids, - originModule: module, - asiSafe: dep.shorthand ? true : dep.asiSafe, - isCall: dep.call, - callContext: !dep.directImport, - defaultInterop: true, - importVar: dep.getImportVar(moduleGraph), - initFragments, - runtime, - runtimeRequirements - }); +const _consumeNumber = (input, pos) => { + pos++; + if (pos === input.length) return pos; + let cc = input.charCodeAt(pos); + while (_isDigit(cc)) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + } + if (cc === CC_FULL_STOP && pos + 1 !== input.length) { + const next = input.charCodeAt(pos + 1); + if (_isDigit(next)) { + pos += 2; + cc = input.charCodeAt(pos); + while (_isDigit(cc)) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + } } - if (dep.shorthand) { - source.insert(dep.range[1], `: ${exportExpr}`); - } else { - source.replace(dep.range[0], dep.range[1] - 1, exportExpr); + } + if (cc === CC_LOWER_E || cc === CC_UPPER_E) { + if (pos + 1 !== input.length) { + const next = input.charCodeAt(pos + 2); + if (_isDigit(next)) { + pos += 2; + } else if ( + (next === CC_HYPHEN_MINUS || next === CC_PLUS_SIGN) && + pos + 2 !== input.length + ) { + const next = input.charCodeAt(pos + 2); + if (_isDigit(next)) { + pos += 3; + } else { + return pos; + } + } else { + return pos; + } } + } else { + return pos; + } + cc = input.charCodeAt(pos); + while (_isDigit(cc)) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); } + return pos; }; -module.exports = HarmonyImportSpecifierDependency; - - -/***/ }), - -/***/ 39029: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const HarmonyAcceptDependency = __webpack_require__(23624); -const HarmonyAcceptImportDependency = __webpack_require__(99843); -const HarmonyCompatibilityDependency = __webpack_require__(72906); -const HarmonyExportExpressionDependency = __webpack_require__(51340); -const HarmonyExportHeaderDependency = __webpack_require__(38873); -const HarmonyExportImportedSpecifierDependency = __webpack_require__(67157); -const HarmonyExportSpecifierDependency = __webpack_require__(48567); -const HarmonyImportSideEffectDependency = __webpack_require__(73132); -const HarmonyImportSpecifierDependency = __webpack_require__(14077); - -const HarmonyDetectionParserPlugin = __webpack_require__(17223); -const HarmonyExportDependencyParserPlugin = __webpack_require__(93466); -const HarmonyImportDependencyParserPlugin = __webpack_require__(20862); -const HarmonyTopLevelThisParserPlugin = __webpack_require__(63232); - -/** @typedef {import("../Compiler")} Compiler */ +/** @type {CharHandler} */ +const consumeLessThan = (input, pos, callbacks) => { + if (input.slice(pos + 1, pos + 4) === "!--") return pos + 4; + return pos + 1; +}; -class HarmonyModulesPlugin { - constructor(options) { - this.options = options; +/** @type {CharHandler} */ +const consumeAt = (input, pos, callbacks) => { + const start = pos; + pos++; + if (pos === input.length) return pos; + if (_startsIdentifier(input, pos)) { + pos = _consumeIdentifier(input, pos); + if (callbacks.atKeyword !== undefined) { + pos = callbacks.atKeyword(input, start, pos); + } } + return pos; +}; - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "HarmonyModulesPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyTemplates.set( - HarmonyCompatibilityDependency, - new HarmonyCompatibilityDependency.Template() - ); - - compilation.dependencyFactories.set( - HarmonyImportSideEffectDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - HarmonyImportSideEffectDependency, - new HarmonyImportSideEffectDependency.Template() - ); - - compilation.dependencyFactories.set( - HarmonyImportSpecifierDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - HarmonyImportSpecifierDependency, - new HarmonyImportSpecifierDependency.Template() - ); - - compilation.dependencyTemplates.set( - HarmonyExportHeaderDependency, - new HarmonyExportHeaderDependency.Template() - ); - - compilation.dependencyTemplates.set( - HarmonyExportExpressionDependency, - new HarmonyExportExpressionDependency.Template() - ); - - compilation.dependencyTemplates.set( - HarmonyExportSpecifierDependency, - new HarmonyExportSpecifierDependency.Template() - ); - - compilation.dependencyFactories.set( - HarmonyExportImportedSpecifierDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - HarmonyExportImportedSpecifierDependency, - new HarmonyExportImportedSpecifierDependency.Template() - ); - - compilation.dependencyTemplates.set( - HarmonyAcceptDependency, - new HarmonyAcceptDependency.Template() - ); - - compilation.dependencyFactories.set( - HarmonyAcceptImportDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - HarmonyAcceptImportDependency, - new HarmonyAcceptImportDependency.Template() - ); +const CHAR_MAP = Array.from({ length: 0x80 }, (_, cc) => { + // https://drafts.csswg.org/css-syntax/#consume-token + switch (cc) { + case CC_LINE_FEED: + case CC_CARRIAGE_RETURN: + case CC_FORM_FEED: + case CC_TAB: + case CC_SPACE: + return consumeSpace; + case CC_QUOTATION_MARK: + case CC_APOSTROPHE: + return consumeString(cc); + case CC_NUMBER_SIGN: + return consumeNumberSign; + case CC_SLASH: + return consumePotentialComment; + // case CC_LEFT_SQUARE: + // case CC_RIGHT_SQUARE: + // case CC_COMMA: + // case CC_COLON: + // return consumeSingleCharToken; + case CC_COMMA: + return consumeComma; + case CC_SEMICOLON: + return consumeSemicolon; + case CC_LEFT_PARENTHESIS: + return consumeLeftParenthesis; + case CC_RIGHT_PARENTHESIS: + return consumeRightParenthesis; + case CC_LEFT_CURLY: + return consumeLeftCurlyBracket; + case CC_RIGHT_CURLY: + return consumeRightCurlyBracket; + case CC_COLON: + return consumePotentialPseudo; + case CC_PLUS_SIGN: + return consumeNumericToken; + case CC_FULL_STOP: + return consumeDot; + case CC_HYPHEN_MINUS: + return consumeMinus; + case CC_LESS_THAN_SIGN: + return consumeLessThan; + case CC_AT_SIGN: + return consumeAt; + case CC_LOWER_U: + return consumePotentialUrl; + case CC_LOW_LINE: + return consumeOtherIdentifier; + default: + if (_isDigit(cc)) return consumeNumericToken; + if ( + (cc >= CC_LOWER_A && cc <= CC_LOWER_Z) || + (cc >= CC_UPPER_A && cc <= CC_UPPER_Z) + ) { + return consumeOtherIdentifier; + } + return consumeSingleCharToken; + } +}); - const handler = (parser, parserOptions) => { - // TODO webpack 6: rename harmony to esm or module - if (parserOptions.harmony !== undefined && !parserOptions.harmony) - return; +/** + * @param {string} input input css + * @param {CssTokenCallbacks} callbacks callbacks + * @returns {void} + */ +module.exports = (input, callbacks) => { + let pos = 0; + while (pos < input.length) { + const cc = input.charCodeAt(pos); + if (cc < 0x80) { + pos = CHAR_MAP[cc](input, pos, callbacks); + } else { + pos++; + } + } +}; - new HarmonyDetectionParserPlugin(this.options).apply(parser); - new HarmonyImportDependencyParserPlugin(parserOptions).apply(parser); - new HarmonyExportDependencyParserPlugin(parserOptions).apply(parser); - new HarmonyTopLevelThisParserPlugin().apply(parser); - }; +module.exports.eatComments = (input, pos) => { + loop: for (;;) { + const cc = input.charCodeAt(pos); + if (cc === CC_SLASH) { + if (pos === input.length) return pos; + let cc = input.charCodeAt(pos + 1); + if (cc !== CC_ASTERISK) return pos; + pos++; + for (;;) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + while (cc === CC_ASTERISK) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + if (cc === CC_SLASH) { + pos++; + continue loop; + } + } + } + } + return pos; + } +}; - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("HarmonyModulesPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("HarmonyModulesPlugin", handler); +module.exports.eatWhitespaceAndComments = (input, pos) => { + loop: for (;;) { + const cc = input.charCodeAt(pos); + if (cc === CC_SLASH) { + if (pos === input.length) return pos; + let cc = input.charCodeAt(pos + 1); + if (cc !== CC_ASTERISK) return pos; + pos++; + for (;;) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + while (cc === CC_ASTERISK) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + if (cc === CC_SLASH) { + pos++; + continue loop; + } + } } - ); + } else if (_isWhiteSpace(cc)) { + pos++; + continue; + } + return pos; } -} -module.exports = HarmonyModulesPlugin; +}; /***/ }), -/***/ 63232: +/***/ 2757: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent */ -const ConstDependency = __webpack_require__(76911); -const HarmonyExports = __webpack_require__(39211); +const { Tracer } = __webpack_require__(5787); +const createSchemaValidation = __webpack_require__(32540); +const { dirname, mkdirpSync } = __webpack_require__(17139); -class HarmonyTopLevelThisParserPlugin { - apply(parser) { - parser.hooks.expression - .for("this") - .tap("HarmonyTopLevelThisParserPlugin", node => { - if (!parser.scope.topLevelScope) return; - if (HarmonyExports.isEnabled(parser.state)) { - const dep = new ConstDependency("undefined", node.range, null); - dep.loc = node.loc; - parser.state.module.addPresentationalDependency(dep); - return this; - } - }); +/** @typedef {import("../../declarations/plugins/debug/ProfilingPlugin").ProfilingPluginOptions} ProfilingPluginOptions */ +/** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */ + +const validate = createSchemaValidation( + __webpack_require__(37134), + () => __webpack_require__(50686), + { + name: "Profiling Plugin", + baseDataPath: "options" } -} +); +let inspector = undefined; -module.exports = HarmonyTopLevelThisParserPlugin; +try { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + inspector = __webpack_require__(31405); +} catch (e) { + console.log("Unable to CPU profile in < node 8.0"); +} +class Profiler { + constructor(inspector) { + this.session = undefined; + this.inspector = inspector; + this._startTime = 0; + } -/***/ }), + hasSession() { + return this.session !== undefined; + } -/***/ 1902: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + startProfiling() { + if (this.inspector === undefined) { + return Promise.resolve(); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + try { + this.session = new inspector.Session(); + this.session.connect(); + } catch (_) { + this.session = undefined; + return Promise.resolve(); + } + const hrtime = process.hrtime(); + this._startTime = hrtime[0] * 1000000 + Math.round(hrtime[1] / 1000); + return Promise.all([ + this.sendCommand("Profiler.setSamplingInterval", { + interval: 100 + }), + this.sendCommand("Profiler.enable"), + this.sendCommand("Profiler.start") + ]); + } -const makeSerializable = __webpack_require__(33032); -const ContextDependency = __webpack_require__(88101); -const ContextDependencyTemplateAsRequireCall = __webpack_require__(75815); + sendCommand(method, params) { + if (this.hasSession()) { + return new Promise((res, rej) => { + return this.session.post(method, params, (err, params) => { + if (err !== null) { + rej(err); + } else { + res(params); + } + }); + }); + } else { + return Promise.resolve(); + } + } -class ImportContextDependency extends ContextDependency { - constructor(options, range, valueRange) { - super(options); + destroy() { + if (this.hasSession()) { + this.session.disconnect(); + } - this.range = range; - this.valueRange = valueRange; + return Promise.resolve(); } - get type() { - return `import() context ${this.options.mode}`; + stopProfiling() { + return this.sendCommand("Profiler.stop").then(({ profile }) => { + const hrtime = process.hrtime(); + const endTime = hrtime[0] * 1000000 + Math.round(hrtime[1] / 1000); + if (profile.startTime < this._startTime || profile.endTime > endTime) { + // In some cases timestamps mismatch and we need to adjust them + // Both process.hrtime and the inspector timestamps claim to be relative + // to a unknown point in time. But they do not guarantee that this is the + // same point in time. + const duration = profile.endTime - profile.startTime; + const ownDuration = endTime - this._startTime; + const untracked = Math.max(0, ownDuration - duration); + profile.startTime = this._startTime + untracked / 2; + profile.endTime = endTime - untracked / 2; + } + return { profile }; + }); } +} - get category() { - return "esm"; +/** + * an object that wraps Tracer and Profiler with a counter + * @typedef {Object} Trace + * @property {Tracer} trace instance of Tracer + * @property {number} counter Counter + * @property {Profiler} profiler instance of Profiler + * @property {Function} end the end function + */ + +/** + * @param {IntermediateFileSystem} fs filesystem used for output + * @param {string} outputPath The location where to write the log. + * @returns {Trace} The trace object + */ +const createTrace = (fs, outputPath) => { + const trace = new Tracer(); + const profiler = new Profiler(inspector); + if (/\/|\\/.test(outputPath)) { + const dirPath = dirname(fs, outputPath); + mkdirpSync(fs, dirPath); } + const fsStream = fs.createWriteStream(outputPath); - serialize(context) { - const { write } = context; + let counter = 0; - write(this.range); - write(this.valueRange); + trace.pipe(fsStream); + // These are critical events that need to be inserted so that tools like + // chrome dev tools can load the profile. + trace.instantEvent({ + name: "TracingStartedInPage", + id: ++counter, + cat: ["disabled-by-default-devtools.timeline"], + args: { + data: { + sessionId: "-1", + page: "0xfff", + frames: [ + { + frame: "0xfff", + url: "webpack", + name: "" + } + ] + } + } + }); - super.serialize(context); - } + trace.instantEvent({ + name: "TracingStartedInBrowser", + id: ++counter, + cat: ["disabled-by-default-devtools.timeline"], + args: { + data: { + sessionId: "-1" + } + } + }); - deserialize(context) { - const { read } = context; + return { + trace, + counter, + profiler, + end: callback => { + trace.push("]"); + // Wait until the write stream finishes. + fsStream.on("close", () => { + callback(); + }); + // Tear down the readable trace stream. + trace.push(null); + } + }; +}; - this.range = read(); - this.valueRange = read(); +const pluginName = "ProfilingPlugin"; - super.deserialize(context); +class ProfilingPlugin { + /** + * @param {ProfilingPluginOptions=} options options object + */ + constructor(options = {}) { + validate(options); + this.outputPath = options.outputPath || "events.json"; } -} - -makeSerializable( - ImportContextDependency, - "webpack/lib/dependencies/ImportContextDependency" -); - -ImportContextDependency.Template = ContextDependencyTemplateAsRequireCall; -module.exports = ImportContextDependency; + apply(compiler) { + const tracer = createTrace( + compiler.intermediateFileSystem, + this.outputPath + ); + tracer.profiler.startProfiling(); + // Compiler Hooks + Object.keys(compiler.hooks).forEach(hookName => { + const hook = compiler.hooks[hookName]; + if (hook) { + hook.intercept(makeInterceptorFor("Compiler", tracer)(hookName)); + } + }); -/***/ }), + Object.keys(compiler.resolverFactory.hooks).forEach(hookName => { + const hook = compiler.resolverFactory.hooks[hookName]; + if (hook) { + hook.intercept(makeInterceptorFor("Resolver", tracer)(hookName)); + } + }); -/***/ 89376: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + compiler.hooks.compilation.tap( + pluginName, + (compilation, { normalModuleFactory, contextModuleFactory }) => { + interceptAllHooksFor(compilation, tracer, "Compilation"); + interceptAllHooksFor( + normalModuleFactory, + tracer, + "Normal Module Factory" + ); + interceptAllHooksFor( + contextModuleFactory, + tracer, + "Context Module Factory" + ); + interceptAllParserHooks(normalModuleFactory, tracer); + interceptAllJavascriptModulesPluginHooks(compilation, tracer); + } + ); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // We need to write out the CPU profile when we are all done. + compiler.hooks.done.tapAsync( + { + name: pluginName, + stage: Infinity + }, + (stats, callback) => { + if (compiler.watchMode) return callback(); + tracer.profiler.stopProfiling().then(parsedResults => { + if (parsedResults === undefined) { + tracer.profiler.destroy(); + tracer.end(callback); + return; + } + const cpuStartTime = parsedResults.profile.startTime; + const cpuEndTime = parsedResults.profile.endTime; + tracer.trace.completeEvent({ + name: "TaskQueueManager::ProcessTaskFromWorkQueue", + id: ++tracer.counter, + cat: ["toplevel"], + ts: cpuStartTime, + args: { + src_file: "../../ipc/ipc_moji_bootstrap.cc", + src_func: "Accept" + } + }); -const Dependency = __webpack_require__(54912); -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); + tracer.trace.completeEvent({ + name: "EvaluateScript", + id: ++tracer.counter, + cat: ["devtools.timeline"], + ts: cpuStartTime, + dur: cpuEndTime - cpuStartTime, + args: { + data: { + url: "webpack", + lineNumber: 1, + columnNumber: 1, + frame: "0xFFF" + } + } + }); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../AsyncDependenciesBlock")} AsyncDependenciesBlock */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + tracer.trace.instantEvent({ + name: "CpuProfile", + id: ++tracer.counter, + cat: ["disabled-by-default-devtools.timeline"], + ts: cpuEndTime, + args: { + data: { + cpuProfile: parsedResults.profile + } + } + }); -class ImportDependency extends ModuleDependency { - /** - * @param {string} request the request - * @param {[number, number]} range expression range - * @param {string[][]=} referencedExports list of referenced exports - */ - constructor(request, range, referencedExports) { - super(request); - this.range = range; - this.referencedExports = referencedExports; + tracer.profiler.destroy(); + tracer.end(callback); + }); + } + ); } +} - get type() { - return "import()"; +const interceptAllHooksFor = (instance, tracer, logLabel) => { + if (Reflect.has(instance, "hooks")) { + Object.keys(instance.hooks).forEach(hookName => { + const hook = instance.hooks[hookName]; + if (hook && !hook._fakeHook) { + hook.intercept(makeInterceptorFor(logLabel, tracer)(hookName)); + } + }); } +}; - get category() { - return "esm"; - } +const interceptAllParserHooks = (moduleFactory, tracer) => { + const moduleTypes = [ + "javascript/auto", + "javascript/dynamic", + "javascript/esm", + "json", + "webassembly/async", + "webassembly/sync" + ]; - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - return this.referencedExports - ? this.referencedExports.map(e => ({ - name: e, - canMangle: false - })) - : Dependency.EXPORTS_OBJECT_REFERENCED; - } + moduleTypes.forEach(moduleType => { + moduleFactory.hooks.parser + .for(moduleType) + .tap("ProfilingPlugin", (parser, parserOpts) => { + interceptAllHooksFor(parser, tracer, "Parser"); + }); + }); +}; - serialize(context) { - context.write(this.range); - context.write(this.referencedExports); - super.serialize(context); - } +const interceptAllJavascriptModulesPluginHooks = (compilation, tracer) => { + interceptAllHooksFor( + { + hooks: + (__webpack_require__(89464).getCompilationHooks)( + compilation + ) + }, + tracer, + "JavascriptModulesPlugin" + ); +}; - deserialize(context) { - this.range = context.read(); - this.referencedExports = context.read(); - super.deserialize(context); +const makeInterceptorFor = (instance, tracer) => hookName => ({ + register: tapInfo => { + const { name, type, fn } = tapInfo; + const newFn = + // Don't tap our own hooks to ensure stream can close cleanly + name === pluginName + ? fn + : makeNewProfiledTapFn(hookName, tracer, { + name, + type, + fn + }); + return { + ...tapInfo, + fn: newFn + }; } -} +}); -makeSerializable(ImportDependency, "webpack/lib/dependencies/ImportDependency"); +// TODO improve typing +/** @typedef {(...args: TODO[]) => void | Promise} PluginFunction */ -ImportDependency.Template = class ImportDependencyTemplate extends ( - ModuleDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply( - dependency, - source, - { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements } - ) { - const dep = /** @type {ImportDependency} */ (dependency); - const block = /** @type {AsyncDependenciesBlock} */ ( - moduleGraph.getParentBlock(dep) - ); - const content = runtimeTemplate.moduleNamespacePromise({ - chunkGraph, - block: block, - module: moduleGraph.getModule(dep), - request: dep.request, - strict: module.buildMeta.strictHarmonyModule, - message: "import()", - runtimeRequirements - }); +/** + * @param {string} hookName Name of the hook to profile. + * @param {Trace} tracer The trace object. + * @param {object} options Options for the profiled fn. + * @param {string} options.name Plugin name + * @param {string} options.type Plugin type (sync | async | promise) + * @param {PluginFunction} options.fn Plugin function + * @returns {PluginFunction} Chainable hooked function. + */ +const makeNewProfiledTapFn = (hookName, tracer, { name, type, fn }) => { + const defaultCategory = ["blink.user_timing"]; + + switch (type) { + case "promise": + return (...args) => { + const id = ++tracer.counter; + tracer.trace.begin({ + name, + id, + cat: defaultCategory + }); + const promise = /** @type {Promise<*>} */ (fn(...args)); + return promise.then(r => { + tracer.trace.end({ + name, + id, + cat: defaultCategory + }); + return r; + }); + }; + case "async": + return (...args) => { + const id = ++tracer.counter; + tracer.trace.begin({ + name, + id, + cat: defaultCategory + }); + const callback = args.pop(); + fn(...args, (...r) => { + tracer.trace.end({ + name, + id, + cat: defaultCategory + }); + callback(...r); + }); + }; + case "sync": + return (...args) => { + const id = ++tracer.counter; + // Do not instrument ourself due to the CPU + // profile needing to be the last event in the trace. + if (name === pluginName) { + return fn(...args); + } - source.replace(dep.range[0], dep.range[1] - 1, content); + tracer.trace.begin({ + name, + id, + cat: defaultCategory + }); + let r; + try { + r = fn(...args); + } catch (error) { + tracer.trace.end({ + name, + id, + cat: defaultCategory + }); + throw error; + } + tracer.trace.end({ + name, + id, + cat: defaultCategory + }); + return r; + }; + default: + break; } }; -module.exports = ImportDependency; +module.exports = ProfilingPlugin; +module.exports.Profiler = Profiler; /***/ }), -/***/ 50718: +/***/ 96816: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -80127,371 +78013,225 @@ module.exports = ImportDependency; +const RuntimeGlobals = __webpack_require__(16475); const makeSerializable = __webpack_require__(33032); -const ImportDependency = __webpack_require__(89376); +const NullDependency = __webpack_require__(31830); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ /** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ - -class ImportEagerDependency extends ImportDependency { - /** - * @param {string} request the request - * @param {[number, number]} range expression range - * @param {string[][]=} referencedExports list of referenced exports - */ - constructor(request, range, referencedExports) { - super(request, range, referencedExports); - } - get type() { - return "import() eager"; - } - - get category() { - return "esm"; - } -} - -makeSerializable( - ImportEagerDependency, - "webpack/lib/dependencies/ImportEagerDependency" -); - -ImportEagerDependency.Template = class ImportEagerDependencyTemplate extends ( - ImportDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply( - dependency, - source, - { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements } - ) { - const dep = /** @type {ImportEagerDependency} */ (dependency); - const content = runtimeTemplate.moduleNamespacePromise({ - chunkGraph, - module: moduleGraph.getModule(dep), - request: dep.request, - strict: module.buildMeta.strictHarmonyModule, - message: "import() eager", - runtimeRequirements - }); - - source.replace(dep.range[0], dep.range[1] - 1, content); +/** @type {Record} */ +const DEFINITIONS = { + f: { + definition: "var __WEBPACK_AMD_DEFINE_RESULT__;", + content: `!(__WEBPACK_AMD_DEFINE_RESULT__ = (#).call(exports, __webpack_require__, exports, module), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`, + requests: [ + RuntimeGlobals.require, + RuntimeGlobals.exports, + RuntimeGlobals.module + ] + }, + o: { + definition: "", + content: "!(module.exports = #)", + requests: [RuntimeGlobals.module] + }, + of: { + definition: + "var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;", + content: `!(__WEBPACK_AMD_DEFINE_FACTORY__ = (#), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : + __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`, + requests: [ + RuntimeGlobals.require, + RuntimeGlobals.exports, + RuntimeGlobals.module + ] + }, + af: { + definition: + "var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;", + content: `!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, __WEBPACK_AMD_DEFINE_RESULT__ = (#).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`, + requests: [RuntimeGlobals.exports, RuntimeGlobals.module] + }, + ao: { + definition: "", + content: "!(#, module.exports = #)", + requests: [RuntimeGlobals.module] + }, + aof: { + definition: + "var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;", + content: `!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, __WEBPACK_AMD_DEFINE_FACTORY__ = (#), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`, + requests: [RuntimeGlobals.exports, RuntimeGlobals.module] + }, + lf: { + definition: "var XXX, XXXmodule;", + content: + "!(XXXmodule = { id: YYY, exports: {}, loaded: false }, XXX = (#).call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule), XXXmodule.loaded = true, XXX === undefined && (XXX = XXXmodule.exports))", + requests: [RuntimeGlobals.require, RuntimeGlobals.module] + }, + lo: { + definition: "var XXX;", + content: "!(XXX = #)", + requests: [] + }, + lof: { + definition: "var XXX, XXXfactory, XXXmodule;", + content: + "!(XXXfactory = (#), (typeof XXXfactory === 'function' ? ((XXXmodule = { id: YYY, exports: {}, loaded: false }), (XXX = XXXfactory.call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule)), (XXXmodule.loaded = true), XXX === undefined && (XXX = XXXmodule.exports)) : XXX = XXXfactory))", + requests: [RuntimeGlobals.require, RuntimeGlobals.module] + }, + laf: { + definition: "var __WEBPACK_AMD_DEFINE_ARRAY__, XXX, XXXexports;", + content: + "!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, XXX = (#).apply(XXXexports = {}, __WEBPACK_AMD_DEFINE_ARRAY__), XXX === undefined && (XXX = XXXexports))", + requests: [] + }, + lao: { + definition: "var XXX;", + content: "!(#, XXX = #)", + requests: [] + }, + laof: { + definition: "var XXXarray, XXXfactory, XXXexports, XXX;", + content: `!(XXXarray = #, XXXfactory = (#), + (typeof XXXfactory === 'function' ? + ((XXX = XXXfactory.apply(XXXexports = {}, XXXarray)), XXX === undefined && (XXX = XXXexports)) : + (XXX = XXXfactory) + ))`, + requests: [] } }; -module.exports = ImportEagerDependency; - - -/***/ }), - -/***/ 51274: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ - - - -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); -const ModuleDependencyTemplateAsId = __webpack_require__(80825); - -class ImportMetaHotAcceptDependency extends ModuleDependency { - constructor(request, range) { - super(request); +class AMDDefineDependency extends NullDependency { + constructor(range, arrayRange, functionRange, objectRange, namedModule) { + super(); this.range = range; - this.weak = true; + this.arrayRange = arrayRange; + this.functionRange = functionRange; + this.objectRange = objectRange; + this.namedModule = namedModule; + this.localModule = null; } get type() { - return "import.meta.webpackHot.accept"; - } - - get category() { - return "esm"; - } -} - -makeSerializable( - ImportMetaHotAcceptDependency, - "webpack/lib/dependencies/ImportMetaHotAcceptDependency" -); - -ImportMetaHotAcceptDependency.Template = ModuleDependencyTemplateAsId; - -module.exports = ImportMetaHotAcceptDependency; - - -/***/ }), - -/***/ 53141: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ - - - -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); -const ModuleDependencyTemplateAsId = __webpack_require__(80825); - -class ImportMetaHotDeclineDependency extends ModuleDependency { - constructor(request, range) { - super(request); - - this.range = range; - this.weak = true; + return "amd define"; } - get type() { - return "import.meta.webpackHot.decline"; + serialize(context) { + const { write } = context; + write(this.range); + write(this.arrayRange); + write(this.functionRange); + write(this.objectRange); + write(this.namedModule); + write(this.localModule); + super.serialize(context); } - get category() { - return "esm"; + deserialize(context) { + const { read } = context; + this.range = read(); + this.arrayRange = read(); + this.functionRange = read(); + this.objectRange = read(); + this.namedModule = read(); + this.localModule = read(); + super.deserialize(context); } } makeSerializable( - ImportMetaHotDeclineDependency, - "webpack/lib/dependencies/ImportMetaHotDeclineDependency" -); - -ImportMetaHotDeclineDependency.Template = ModuleDependencyTemplateAsId; - -module.exports = ImportMetaHotDeclineDependency; - - -/***/ }), - -/***/ 17228: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ - - - -const { pathToFileURL } = __webpack_require__(57310); -const ModuleDependencyWarning = __webpack_require__(29656); -const Template = __webpack_require__(1626); -const BasicEvaluatedExpression = __webpack_require__(950); -const { - evaluateToIdentifier, - toConstantDependency, - evaluateToString, - evaluateToNumber -} = __webpack_require__(93998); -const memoize = __webpack_require__(78676); -const propertyAccess = __webpack_require__(54190); -const ConstDependency = __webpack_require__(76911); - -/** @typedef {import("estree").MemberExpression} MemberExpression */ -/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../NormalModule")} NormalModule */ -/** @typedef {import("../javascript/JavascriptParser")} Parser */ - -const getCriticalDependencyWarning = memoize(() => - __webpack_require__(15427) + AMDDefineDependency, + "webpack/lib/dependencies/AMDDefineDependency" ); -class ImportMetaPlugin { +AMDDefineDependency.Template = class AMDDefineDependencyTemplate extends ( + NullDependency.Template +) { /** - * @param {Compiler} compiler compiler + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap( - "ImportMetaPlugin", - (compilation, { normalModuleFactory }) => { - /** - * @param {NormalModule} module module - * @returns {string} file url - */ - const getUrl = module => { - return pathToFileURL(module.resource).toString(); - }; - /** - * @param {Parser} parser parser parser - * @param {JavascriptParserOptions} parserOptions parserOptions - * @returns {void} - */ - const parserHandler = (parser, { importMeta }) => { - if (importMeta === false) { - const { importMetaName } = compilation.outputOptions; - if (importMetaName === "import.meta") return; - - parser.hooks.expression - .for("import.meta") - .tap("ImportMetaPlugin", metaProperty => { - const dep = new ConstDependency( - importMetaName, - metaProperty.range - ); - dep.loc = metaProperty.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - return; - } - - /// import.meta direct /// - parser.hooks.typeof - .for("import.meta") - .tap( - "ImportMetaPlugin", - toConstantDependency(parser, JSON.stringify("object")) - ); - parser.hooks.expression - .for("import.meta") - .tap("ImportMetaPlugin", metaProperty => { - const CriticalDependencyWarning = getCriticalDependencyWarning(); - parser.state.module.addWarning( - new ModuleDependencyWarning( - parser.state.module, - new CriticalDependencyWarning( - "Accessing import.meta directly is unsupported (only property access is supported)" - ), - metaProperty.loc - ) - ); - const dep = new ConstDependency( - `${parser.isAsiPosition(metaProperty.range[0]) ? ";" : ""}({})`, - metaProperty.range - ); - dep.loc = metaProperty.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - parser.hooks.evaluateTypeof - .for("import.meta") - .tap("ImportMetaPlugin", evaluateToString("object")); - parser.hooks.evaluateIdentifier.for("import.meta").tap( - "ImportMetaPlugin", - evaluateToIdentifier("import.meta", "import.meta", () => [], true) - ); - - /// import.meta.url /// - parser.hooks.typeof - .for("import.meta.url") - .tap( - "ImportMetaPlugin", - toConstantDependency(parser, JSON.stringify("string")) - ); - parser.hooks.expression - .for("import.meta.url") - .tap("ImportMetaPlugin", expr => { - const dep = new ConstDependency( - JSON.stringify(getUrl(parser.state.module)), - expr.range - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - parser.hooks.evaluateTypeof - .for("import.meta.url") - .tap("ImportMetaPlugin", evaluateToString("string")); - parser.hooks.evaluateIdentifier - .for("import.meta.url") - .tap("ImportMetaPlugin", expr => { - return new BasicEvaluatedExpression() - .setString(getUrl(parser.state.module)) - .setRange(expr.range); - }); - - /// import.meta.webpack /// - const webpackVersion = parseInt( - (__webpack_require__(32702)/* .version */ .i8), - 10 - ); - parser.hooks.typeof - .for("import.meta.webpack") - .tap( - "ImportMetaPlugin", - toConstantDependency(parser, JSON.stringify("number")) - ); - parser.hooks.expression - .for("import.meta.webpack") - .tap( - "ImportMetaPlugin", - toConstantDependency(parser, JSON.stringify(webpackVersion)) - ); - parser.hooks.evaluateTypeof - .for("import.meta.webpack") - .tap("ImportMetaPlugin", evaluateToString("number")); - parser.hooks.evaluateIdentifier - .for("import.meta.webpack") - .tap("ImportMetaPlugin", evaluateToNumber(webpackVersion)); - - /// Unknown properties /// - parser.hooks.unhandledExpressionMemberChain - .for("import.meta") - .tap("ImportMetaPlugin", (expr, members) => { - const dep = new ConstDependency( - `${Template.toNormalComment( - "unsupported import.meta." + members.join(".") - )} undefined${propertyAccess(members, 1)}`, - expr.range - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - parser.hooks.evaluate - .for("MemberExpression") - .tap("ImportMetaPlugin", expression => { - const expr = /** @type {MemberExpression} */ (expression); - if ( - expr.object.type === "MetaProperty" && - expr.object.meta.name === "import" && - expr.object.property.name === "meta" && - expr.property.type === - (expr.computed ? "Literal" : "Identifier") - ) { - return new BasicEvaluatedExpression() - .setUndefined() - .setRange(expr.range); - } - }); - }; + apply(dependency, source, { runtimeRequirements }) { + const dep = /** @type {AMDDefineDependency} */ (dependency); + const branch = this.branch(dep); + const { definition, content, requests } = DEFINITIONS[branch]; + for (const req of requests) { + runtimeRequirements.add(req); + } + this.replace(dep, source, definition, content); + } - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("ImportMetaPlugin", parserHandler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("ImportMetaPlugin", parserHandler); - } + localModuleVar(dependency) { + return ( + dependency.localModule && + dependency.localModule.used && + dependency.localModule.variableName() ); } -} -module.exports = ImportMetaPlugin; + branch(dependency) { + const localModuleVar = this.localModuleVar(dependency) ? "l" : ""; + const arrayRange = dependency.arrayRange ? "a" : ""; + const objectRange = dependency.objectRange ? "o" : ""; + const functionRange = dependency.functionRange ? "f" : ""; + return localModuleVar + arrayRange + objectRange + functionRange; + } + + replace(dependency, source, definition, text) { + const localModuleVar = this.localModuleVar(dependency); + if (localModuleVar) { + text = text.replace(/XXX/g, localModuleVar.replace(/\$/g, "$$$$")); + definition = definition.replace( + /XXX/g, + localModuleVar.replace(/\$/g, "$$$$") + ); + } + + if (dependency.namedModule) { + text = text.replace(/YYY/g, JSON.stringify(dependency.namedModule)); + } + + const texts = text.split("#"); + + if (definition) source.insert(0, definition); + + let current = dependency.range[0]; + if (dependency.arrayRange) { + source.replace(current, dependency.arrayRange[0] - 1, texts.shift()); + current = dependency.arrayRange[1]; + } + + if (dependency.objectRange) { + source.replace(current, dependency.objectRange[0] - 1, texts.shift()); + current = dependency.objectRange[1]; + } else if (dependency.functionRange) { + source.replace(current, dependency.functionRange[0] - 1, texts.shift()); + current = dependency.functionRange[1]; + } + source.replace(current, dependency.range[1] - 1, texts.shift()); + if (texts.length > 0) throw new Error("Implementation error"); + } +}; + +module.exports = AMDDefineDependency; /***/ }), -/***/ 88130: +/***/ 48519: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -80502,271 +78242,358 @@ module.exports = ImportMetaPlugin; -const AsyncDependenciesBlock = __webpack_require__(47736); -const CommentCompilationWarning = __webpack_require__(98427); -const UnsupportedFeatureWarning = __webpack_require__(42495); +const RuntimeGlobals = __webpack_require__(16475); +const AMDDefineDependency = __webpack_require__(96816); +const AMDRequireArrayDependency = __webpack_require__(33516); +const AMDRequireContextDependency = __webpack_require__(96123); +const AMDRequireItemDependency = __webpack_require__(71806); +const ConstDependency = __webpack_require__(76911); const ContextDependencyHelpers = __webpack_require__(99630); -const ImportContextDependency = __webpack_require__(1902); -const ImportDependency = __webpack_require__(89376); -const ImportEagerDependency = __webpack_require__(50718); -const ImportWeakDependency = __webpack_require__(82483); +const DynamicExports = __webpack_require__(32006); +const LocalModuleDependency = __webpack_require__(52805); +const { addLocalModule, getLocalModule } = __webpack_require__(75827); -/** @typedef {import("../ChunkGroup").RawChunkGroupOptions} RawChunkGroupOptions */ -/** @typedef {import("../ContextModule").ContextMode} ContextMode */ +const isBoundFunctionExpression = expr => { + if (expr.type !== "CallExpression") return false; + if (expr.callee.type !== "MemberExpression") return false; + if (expr.callee.computed) return false; + if (expr.callee.object.type !== "FunctionExpression") return false; + if (expr.callee.property.type !== "Identifier") return false; + if (expr.callee.property.name !== "bind") return false; + return true; +}; -class ImportParserPlugin { +const isUnboundFunctionExpression = expr => { + if (expr.type === "FunctionExpression") return true; + if (expr.type === "ArrowFunctionExpression") return true; + return false; +}; + +const isCallable = expr => { + if (isUnboundFunctionExpression(expr)) return true; + if (isBoundFunctionExpression(expr)) return true; + return false; +}; + +class AMDDefineDependencyParserPlugin { constructor(options) { this.options = options; } apply(parser) { - parser.hooks.importCall.tap("ImportParserPlugin", expr => { - const param = parser.evaluateExpression(expr.source); - - let chunkName = null; - /** @type {ContextMode} */ - let mode = "lazy"; - let include = null; - let exclude = null; - /** @type {string[][] | null} */ - let exports = null; - /** @type {RawChunkGroupOptions} */ - const groupOptions = {}; - - const { options: importOptions, errors: commentErrors } = - parser.parseCommentOptions(expr.range); + parser.hooks.call + .for("define") + .tap( + "AMDDefineDependencyParserPlugin", + this.processCallDefine.bind(this, parser) + ); + } - if (commentErrors) { - for (const e of commentErrors) { - const { comment } = e; - parser.state.module.addWarning( - new CommentCompilationWarning( - `Compilation error while processing magic comment(-s): /*${comment.value}*/: ${e.message}`, - comment.loc - ) - ); + processArray(parser, expr, param, identifiers, namedModule) { + if (param.isArray()) { + param.items.forEach((param, idx) => { + if ( + param.isString() && + ["require", "module", "exports"].includes(param.string) + ) + identifiers[idx] = param.string; + const result = this.processItem(parser, expr, param, namedModule); + if (result === undefined) { + this.processContext(parser, expr, param); + } + }); + return true; + } else if (param.isConstArray()) { + const deps = []; + param.array.forEach((request, idx) => { + let dep; + let localModule; + if (request === "require") { + identifiers[idx] = request; + dep = "__webpack_require__"; + } else if (["exports", "module"].includes(request)) { + identifiers[idx] = request; + dep = request; + } else if ((localModule = getLocalModule(parser.state, request))) { + localModule.flagUsed(); + dep = new LocalModuleDependency(localModule, undefined, false); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + } else { + dep = this.newRequireItemDependency(request); + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + } + deps.push(dep); + }); + const dep = this.newRequireArrayDependency(deps, param.range); + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.module.addPresentationalDependency(dep); + return true; + } + } + processItem(parser, expr, param, namedModule) { + if (param.isConditional()) { + param.options.forEach(param => { + const result = this.processItem(parser, expr, param); + if (result === undefined) { + this.processContext(parser, expr, param); } + }); + return true; + } else if (param.isString()) { + let dep, localModule; + if (param.string === "require") { + dep = new ConstDependency("__webpack_require__", param.range, [ + RuntimeGlobals.require + ]); + } else if (param.string === "exports") { + dep = new ConstDependency("exports", param.range, [ + RuntimeGlobals.exports + ]); + } else if (param.string === "module") { + dep = new ConstDependency("module", param.range, [ + RuntimeGlobals.module + ]); + } else if ( + (localModule = getLocalModule(parser.state, param.string, namedModule)) + ) { + localModule.flagUsed(); + dep = new LocalModuleDependency(localModule, param.range, false); + } else { + dep = this.newRequireItemDependency(param.string, param.range); + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; } + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + } + } + processContext(parser, expr, param) { + const dep = ContextDependencyHelpers.create( + AMDRequireContextDependency, + param.range, + param, + expr, + this.options, + { + category: "amd" + }, + parser + ); + if (!dep) return; + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; + } - if (importOptions) { - if (importOptions.webpackIgnore !== undefined) { - if (typeof importOptions.webpackIgnore !== "boolean") { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackIgnore\` expected a boolean, but received: ${importOptions.webpackIgnore}.`, - expr.loc - ) - ); - } else { - // Do not instrument `import()` if `webpackIgnore` is `true` - if (importOptions.webpackIgnore) { - return false; - } - } - } - if (importOptions.webpackChunkName !== undefined) { - if (typeof importOptions.webpackChunkName !== "string") { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackChunkName\` expected a string, but received: ${importOptions.webpackChunkName}.`, - expr.loc - ) - ); - } else { - chunkName = importOptions.webpackChunkName; - } + processCallDefine(parser, expr) { + let array, fn, obj, namedModule; + switch (expr.arguments.length) { + case 1: + if (isCallable(expr.arguments[0])) { + // define(f() {…}) + fn = expr.arguments[0]; + } else if (expr.arguments[0].type === "ObjectExpression") { + // define({…}) + obj = expr.arguments[0]; + } else { + // define(expr) + // unclear if function or object + obj = fn = expr.arguments[0]; } - if (importOptions.webpackMode !== undefined) { - if (typeof importOptions.webpackMode !== "string") { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackMode\` expected a string, but received: ${importOptions.webpackMode}.`, - expr.loc - ) - ); + break; + case 2: + if (expr.arguments[0].type === "Literal") { + namedModule = expr.arguments[0].value; + // define("…", …) + if (isCallable(expr.arguments[1])) { + // define("…", f() {…}) + fn = expr.arguments[1]; + } else if (expr.arguments[1].type === "ObjectExpression") { + // define("…", {…}) + obj = expr.arguments[1]; } else { - mode = importOptions.webpackMode; + // define("…", expr) + // unclear if function or object + obj = fn = expr.arguments[1]; } - } - if (importOptions.webpackPrefetch !== undefined) { - if (importOptions.webpackPrefetch === true) { - groupOptions.prefetchOrder = 0; - } else if (typeof importOptions.webpackPrefetch === "number") { - groupOptions.prefetchOrder = importOptions.webpackPrefetch; + } else { + array = expr.arguments[0]; + if (isCallable(expr.arguments[1])) { + // define([…], f() {}) + fn = expr.arguments[1]; + } else if (expr.arguments[1].type === "ObjectExpression") { + // define([…], {…}) + obj = expr.arguments[1]; } else { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackPrefetch\` expected true or a number, but received: ${importOptions.webpackPrefetch}.`, - expr.loc - ) - ); + // define([…], expr) + // unclear if function or object + obj = fn = expr.arguments[1]; } } - if (importOptions.webpackPreload !== undefined) { - if (importOptions.webpackPreload === true) { - groupOptions.preloadOrder = 0; - } else if (typeof importOptions.webpackPreload === "number") { - groupOptions.preloadOrder = importOptions.webpackPreload; - } else { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackPreload\` expected true or a number, but received: ${importOptions.webpackPreload}.`, - expr.loc - ) - ); - } + break; + case 3: + // define("…", […], f() {…}) + namedModule = expr.arguments[0].value; + array = expr.arguments[1]; + if (isCallable(expr.arguments[2])) { + // define("…", […], f() {}) + fn = expr.arguments[2]; + } else if (expr.arguments[2].type === "ObjectExpression") { + // define("…", […], {…}) + obj = expr.arguments[2]; + } else { + // define("…", […], expr) + // unclear if function or object + obj = fn = expr.arguments[2]; } - if (importOptions.webpackInclude !== undefined) { - if ( - !importOptions.webpackInclude || - importOptions.webpackInclude.constructor.name !== "RegExp" - ) { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackInclude\` expected a regular expression, but received: ${importOptions.webpackInclude}.`, - expr.loc - ) - ); - } else { - include = new RegExp(importOptions.webpackInclude); - } + break; + default: + return; + } + DynamicExports.bailout(parser.state); + let fnParams = null; + let fnParamsOffset = 0; + if (fn) { + if (isUnboundFunctionExpression(fn)) { + fnParams = fn.params; + } else if (isBoundFunctionExpression(fn)) { + fnParams = fn.callee.object.params; + fnParamsOffset = fn.arguments.length - 1; + if (fnParamsOffset < 0) { + fnParamsOffset = 0; } - if (importOptions.webpackExclude !== undefined) { - if ( - !importOptions.webpackExclude || - importOptions.webpackExclude.constructor.name !== "RegExp" - ) { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackExclude\` expected a regular expression, but received: ${importOptions.webpackExclude}.`, - expr.loc - ) - ); - } else { - exclude = new RegExp(importOptions.webpackExclude); + } + } + let fnRenames = new Map(); + if (array) { + const identifiers = {}; + const param = parser.evaluateExpression(array); + const result = this.processArray( + parser, + expr, + param, + identifiers, + namedModule + ); + if (!result) return; + if (fnParams) { + fnParams = fnParams.slice(fnParamsOffset).filter((param, idx) => { + if (identifiers[idx]) { + fnRenames.set(param.name, parser.getVariableInfo(identifiers[idx])); + return false; } - } - if (importOptions.webpackExports !== undefined) { - if ( - !( - typeof importOptions.webpackExports === "string" || - (Array.isArray(importOptions.webpackExports) && - importOptions.webpackExports.every( - item => typeof item === "string" - )) - ) - ) { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackExports\` expected a string or an array of strings, but received: ${importOptions.webpackExports}.`, - expr.loc - ) - ); - } else { - if (typeof importOptions.webpackExports === "string") { - exports = [[importOptions.webpackExports]]; - } else { - exports = Array.from(importOptions.webpackExports, e => [e]); - } + return true; + }); + } + } else { + const identifiers = ["require", "exports", "module"]; + if (fnParams) { + fnParams = fnParams.slice(fnParamsOffset).filter((param, idx) => { + if (identifiers[idx]) { + fnRenames.set(param.name, parser.getVariableInfo(identifiers[idx])); + return false; } - } + return true; + }); } - - if (param.isString()) { - if (mode !== "lazy" && mode !== "eager" && mode !== "weak") { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackMode\` expected 'lazy', 'eager' or 'weak', but received: ${mode}.`, - expr.loc - ) - ); + } + let inTry; + if (fn && isUnboundFunctionExpression(fn)) { + inTry = parser.scope.inTry; + parser.inScope(fnParams, () => { + for (const [name, varInfo] of fnRenames) { + parser.setVariable(name, varInfo); } - - if (mode === "eager") { - const dep = new ImportEagerDependency( - param.string, - expr.range, - exports - ); - parser.state.current.addDependency(dep); - } else if (mode === "weak") { - const dep = new ImportWeakDependency( - param.string, - expr.range, - exports - ); - parser.state.current.addDependency(dep); + parser.scope.inTry = inTry; + if (fn.body.type === "BlockStatement") { + parser.detectMode(fn.body.body); + const prev = parser.prevStatement; + parser.preWalkStatement(fn.body); + parser.prevStatement = prev; + parser.walkStatement(fn.body); } else { - const depBlock = new AsyncDependenciesBlock( - { - ...groupOptions, - name: chunkName - }, - expr.loc, - param.string - ); - const dep = new ImportDependency(param.string, expr.range, exports); - dep.loc = expr.loc; - depBlock.addDependency(dep); - parser.state.current.addBlock(depBlock); - } - return true; - } else { - if ( - mode !== "lazy" && - mode !== "lazy-once" && - mode !== "eager" && - mode !== "weak" - ) { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackMode\` expected 'lazy', 'lazy-once', 'eager' or 'weak', but received: ${mode}.`, - expr.loc - ) - ); - mode = "lazy"; + parser.walkExpression(fn.body); } - - if (mode === "weak") { - mode = "async-weak"; + }); + } else if (fn && isBoundFunctionExpression(fn)) { + inTry = parser.scope.inTry; + parser.inScope( + fn.callee.object.params.filter( + i => !["require", "module", "exports"].includes(i.name) + ), + () => { + for (const [name, varInfo] of fnRenames) { + parser.setVariable(name, varInfo); + } + parser.scope.inTry = inTry; + if (fn.callee.object.body.type === "BlockStatement") { + parser.detectMode(fn.callee.object.body.body); + const prev = parser.prevStatement; + parser.preWalkStatement(fn.callee.object.body); + parser.prevStatement = prev; + parser.walkStatement(fn.callee.object.body); + } else { + parser.walkExpression(fn.callee.object.body); + } } - const dep = ContextDependencyHelpers.create( - ImportContextDependency, - expr.range, - param, - expr, - this.options, - { - chunkName, - groupOptions, - include, - exclude, - mode, - namespaceObject: parser.state.module.buildMeta.strictHarmonyModule - ? "strict" - : true, - typePrefix: "import()", - category: "esm", - referencedExports: exports - }, - parser - ); - if (!dep) return; - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; + ); + if (fn.arguments) { + parser.walkExpressions(fn.arguments); } - }); + } else if (fn || obj) { + parser.walkExpression(fn || obj); + } + + const dep = this.newDefineDependency( + expr.range, + array ? array.range : null, + fn ? fn.range : null, + obj ? obj.range : null, + namedModule ? namedModule : null + ); + dep.loc = expr.loc; + if (namedModule) { + dep.localModule = addLocalModule(parser.state, namedModule); + } + parser.state.module.addPresentationalDependency(dep); + return true; } -} -module.exports = ImportParserPlugin; + newDefineDependency( + range, + arrayRange, + functionRange, + objectRange, + namedModule + ) { + return new AMDDefineDependency( + range, + arrayRange, + functionRange, + objectRange, + namedModule + ); + } + newRequireArrayDependency(depsArray, range) { + return new AMDRequireArrayDependency(depsArray, range); + } + newRequireItemDependency(request, range) { + return new AMDRequireItemDependency(request, range); + } +} +module.exports = AMDDefineDependencyParserPlugin; /***/ }), -/***/ 41293: +/***/ 50067: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -80777,161 +78604,220 @@ module.exports = ImportParserPlugin; -const ImportContextDependency = __webpack_require__(1902); -const ImportDependency = __webpack_require__(89376); -const ImportEagerDependency = __webpack_require__(50718); -const ImportParserPlugin = __webpack_require__(88130); -const ImportWeakDependency = __webpack_require__(82483); +const RuntimeGlobals = __webpack_require__(16475); +const { + approve, + evaluateToIdentifier, + evaluateToString, + toConstantDependency +} = __webpack_require__(93998); + +const AMDDefineDependency = __webpack_require__(96816); +const AMDDefineDependencyParserPlugin = __webpack_require__(48519); +const AMDRequireArrayDependency = __webpack_require__(33516); +const AMDRequireContextDependency = __webpack_require__(96123); +const AMDRequireDependenciesBlockParserPlugin = __webpack_require__(66866); +const AMDRequireDependency = __webpack_require__(43911); +const AMDRequireItemDependency = __webpack_require__(71806); +const { + AMDDefineRuntimeModule, + AMDOptionsRuntimeModule +} = __webpack_require__(45242); +const ConstDependency = __webpack_require__(76911); +const LocalModuleDependency = __webpack_require__(52805); +const UnsupportedDependency = __webpack_require__(51669); +/** @typedef {import("../../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */ /** @typedef {import("../Compiler")} Compiler */ -class ImportPlugin { +class AMDPlugin { + /** + * @param {Record} amdOptions the AMD options + */ + constructor(amdOptions) { + this.amdOptions = amdOptions; + } + /** * Apply the plugin * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { + const amdOptions = this.amdOptions; compiler.hooks.compilation.tap( - "ImportPlugin", + "AMDPlugin", (compilation, { contextModuleFactory, normalModuleFactory }) => { - compilation.dependencyFactories.set( - ImportDependency, - normalModuleFactory - ); compilation.dependencyTemplates.set( - ImportDependency, - new ImportDependency.Template() + AMDRequireDependency, + new AMDRequireDependency.Template() ); compilation.dependencyFactories.set( - ImportEagerDependency, + AMDRequireItemDependency, normalModuleFactory ); compilation.dependencyTemplates.set( - ImportEagerDependency, - new ImportEagerDependency.Template() + AMDRequireItemDependency, + new AMDRequireItemDependency.Template() ); - compilation.dependencyFactories.set( - ImportWeakDependency, - normalModuleFactory - ); compilation.dependencyTemplates.set( - ImportWeakDependency, - new ImportWeakDependency.Template() + AMDRequireArrayDependency, + new AMDRequireArrayDependency.Template() ); compilation.dependencyFactories.set( - ImportContextDependency, + AMDRequireContextDependency, contextModuleFactory ); compilation.dependencyTemplates.set( - ImportContextDependency, - new ImportContextDependency.Template() + AMDRequireContextDependency, + new AMDRequireContextDependency.Template() ); - const handler = (parser, parserOptions) => { - if (parserOptions.import !== undefined && !parserOptions.import) - return; + compilation.dependencyTemplates.set( + AMDDefineDependency, + new AMDDefineDependency.Template() + ); - new ImportParserPlugin(parserOptions).apply(parser); - }; + compilation.dependencyTemplates.set( + UnsupportedDependency, + new UnsupportedDependency.Template() + ); - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("ImportPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("ImportPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("ImportPlugin", handler); - } - ); - } -} -module.exports = ImportPlugin; + compilation.dependencyTemplates.set( + LocalModuleDependency, + new LocalModuleDependency.Template() + ); + compilation.hooks.runtimeRequirementInModule + .for(RuntimeGlobals.amdDefine) + .tap("AMDPlugin", (module, set) => { + set.add(RuntimeGlobals.require); + }); -/***/ }), + compilation.hooks.runtimeRequirementInModule + .for(RuntimeGlobals.amdOptions) + .tap("AMDPlugin", (module, set) => { + set.add(RuntimeGlobals.requireScope); + }); -/***/ 82483: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.amdDefine) + .tap("AMDPlugin", (chunk, set) => { + compilation.addRuntimeModule(chunk, new AMDDefineRuntimeModule()); + }); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.amdOptions) + .tap("AMDPlugin", (chunk, set) => { + compilation.addRuntimeModule( + chunk, + new AMDOptionsRuntimeModule(amdOptions) + ); + }); + const handler = (parser, parserOptions) => { + if (parserOptions.amd !== undefined && !parserOptions.amd) return; + const tapOptionsHooks = (optionExpr, rootName, getMembers) => { + parser.hooks.expression + .for(optionExpr) + .tap( + "AMDPlugin", + toConstantDependency(parser, RuntimeGlobals.amdOptions, [ + RuntimeGlobals.amdOptions + ]) + ); + parser.hooks.evaluateIdentifier + .for(optionExpr) + .tap( + "AMDPlugin", + evaluateToIdentifier(optionExpr, rootName, getMembers, true) + ); + parser.hooks.evaluateTypeof + .for(optionExpr) + .tap("AMDPlugin", evaluateToString("object")); + parser.hooks.typeof + .for(optionExpr) + .tap( + "AMDPlugin", + toConstantDependency(parser, JSON.stringify("object")) + ); + }; -const makeSerializable = __webpack_require__(33032); -const ImportDependency = __webpack_require__(89376); + new AMDRequireDependenciesBlockParserPlugin(parserOptions).apply( + parser + ); + new AMDDefineDependencyParserPlugin(parserOptions).apply(parser); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ + tapOptionsHooks("define.amd", "define", () => "amd"); + tapOptionsHooks("require.amd", "require", () => ["amd"]); + tapOptionsHooks( + "__webpack_amd_options__", + "__webpack_amd_options__", + () => [] + ); -class ImportWeakDependency extends ImportDependency { - /** - * @param {string} request the request - * @param {[number, number]} range expression range - * @param {string[][]=} referencedExports list of referenced exports - */ - constructor(request, range, referencedExports) { - super(request, range, referencedExports); - this.weak = true; - } + parser.hooks.expression.for("define").tap("AMDPlugin", expr => { + const dep = new ConstDependency( + RuntimeGlobals.amdDefine, + expr.range, + [RuntimeGlobals.amdDefine] + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + parser.hooks.typeof + .for("define") + .tap( + "AMDPlugin", + toConstantDependency(parser, JSON.stringify("function")) + ); + parser.hooks.evaluateTypeof + .for("define") + .tap("AMDPlugin", evaluateToString("function")); + parser.hooks.canRename.for("define").tap("AMDPlugin", approve); + parser.hooks.rename.for("define").tap("AMDPlugin", expr => { + const dep = new ConstDependency( + RuntimeGlobals.amdDefine, + expr.range, + [RuntimeGlobals.amdDefine] + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return false; + }); + parser.hooks.typeof + .for("require") + .tap( + "AMDPlugin", + toConstantDependency(parser, JSON.stringify("function")) + ); + parser.hooks.evaluateTypeof + .for("require") + .tap("AMDPlugin", evaluateToString("function")); + }; - get type() { - return "import() weak"; + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("AMDPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("AMDPlugin", handler); + } + ); } } -makeSerializable( - ImportWeakDependency, - "webpack/lib/dependencies/ImportWeakDependency" -); - -ImportWeakDependency.Template = class ImportDependencyTemplate extends ( - ImportDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply( - dependency, - source, - { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements } - ) { - const dep = /** @type {ImportWeakDependency} */ (dependency); - const content = runtimeTemplate.moduleNamespacePromise({ - chunkGraph, - module: moduleGraph.getModule(dep), - request: dep.request, - strict: module.buildMeta.strictHarmonyModule, - message: "import() weak", - weak: true, - runtimeRequirements - }); - - source.replace(dep.range[0], dep.range[1] - 1, content); - } -}; - -module.exports = ImportWeakDependency; +module.exports = AMDPlugin; /***/ }), -/***/ 750: +/***/ 33516: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -80942,142 +78828,103 @@ module.exports = ImportWeakDependency; +const DependencyTemplate = __webpack_require__(5160); const makeSerializable = __webpack_require__(33032); const NullDependency = __webpack_require__(31830); -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency").ExportSpec} ExportSpec */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/Hash")} Hash */ - -const getExportsFromData = data => { - if (data && typeof data === "object") { - if (Array.isArray(data)) { - return data.map((item, idx) => { - return { - name: `${idx}`, - canMangle: true, - exports: getExportsFromData(item) - }; - }); - } else { - const exports = []; - for (const key of Object.keys(data)) { - exports.push({ - name: key, - canMangle: true, - exports: getExportsFromData(data[key]) - }); - } - return exports; - } - } - return undefined; -}; +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -class JsonExportsDependency extends NullDependency { - /** - * @param {(string | ExportSpec)[]} exports json exports - */ - constructor(exports) { +class AMDRequireArrayDependency extends NullDependency { + constructor(depsArray, range) { super(); - this.exports = exports; - this._hashUpdate = undefined; - } - get type() { - return "json exports"; + this.depsArray = depsArray; + this.range = range; } - /** - * Returns the exported names - * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names - */ - getExports(moduleGraph) { - return { - exports: this.exports, - dependencies: undefined - }; + get type() { + return "amd require array"; } - /** - * Update the hash - * @param {Hash} hash hash to be updated - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - if (this._hashUpdate === undefined) { - this._hashUpdate = this.exports - ? JSON.stringify(this.exports) - : "undefined"; - } - hash.update(this._hashUpdate); + get category() { + return "amd"; } serialize(context) { const { write } = context; - write(this.exports); + + write(this.depsArray); + write(this.range); + super.serialize(context); } deserialize(context) { const { read } = context; - this.exports = read(); + + this.depsArray = read(); + this.range = read(); + super.deserialize(context); } } makeSerializable( - JsonExportsDependency, - "webpack/lib/dependencies/JsonExportsDependency" + AMDRequireArrayDependency, + "webpack/lib/dependencies/AMDRequireArrayDependency" ); -module.exports = JsonExportsDependency; -module.exports.getExportsFromData = getExportsFromData; - - -/***/ }), - -/***/ 71693: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const ModuleDependency = __webpack_require__(80321); - -class LoaderDependency extends ModuleDependency { +AMDRequireArrayDependency.Template = class AMDRequireArrayDependencyTemplate extends ( + DependencyTemplate +) { /** - * @param {string} request request string + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - constructor(request) { - super(request); + apply(dependency, source, templateContext) { + const dep = /** @type {AMDRequireArrayDependency} */ (dependency); + const content = this.getContent(dep, templateContext); + source.replace(dep.range[0], dep.range[1] - 1, content); } - get type() { - return "loader"; + getContent(dep, templateContext) { + const requires = dep.depsArray.map(dependency => { + return this.contentForDependency(dependency, templateContext); + }); + return `[${requires.join(", ")}]`; } - get category() { - return "loader"; + contentForDependency( + dep, + { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } + ) { + if (typeof dep === "string") { + return dep; + } + + if (dep.localModule) { + return dep.localModule.variableName(); + } else { + return runtimeTemplate.moduleExports({ + module: moduleGraph.getModule(dep), + chunkGraph, + request: dep.request, + runtimeRequirements + }); + } } -} +}; -module.exports = LoaderDependency; +module.exports = AMDRequireArrayDependency; /***/ }), -/***/ 223: +/***/ 96123: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -81088,299 +78935,57 @@ module.exports = LoaderDependency; -const ModuleDependency = __webpack_require__(80321); +const makeSerializable = __webpack_require__(33032); +const ContextDependency = __webpack_require__(88101); -class LoaderImportDependency extends ModuleDependency { - /** - * @param {string} request request string - */ - constructor(request) { - super(request); - this.weak = true; +class AMDRequireContextDependency extends ContextDependency { + constructor(options, range, valueRange) { + super(options); + + this.range = range; + this.valueRange = valueRange; } get type() { - return "loader import"; + return "amd require context"; } get category() { - return "loaderImport"; + return "amd"; } -} - -module.exports = LoaderImportDependency; + serialize(context) { + const { write } = context; -/***/ }), - -/***/ 24721: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const NormalModule = __webpack_require__(39); -const LazySet = __webpack_require__(38938); -const LoaderDependency = __webpack_require__(71693); -const LoaderImportDependency = __webpack_require__(223); - -/** @typedef {import("../Compilation").DepConstructor} DepConstructor */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ - -/** - * @callback LoadModuleCallback - * @param {(Error | null)=} err error object - * @param {string | Buffer=} source source code - * @param {object=} map source map - * @param {Module=} module loaded module if successful - */ - -/** - * @callback ImportModuleCallback - * @param {(Error | null)=} err error object - * @param {any=} exports exports of the evaluated module - */ + write(this.range); + write(this.valueRange); -/** - * @typedef {Object} ImportModuleOptions - * @property {string=} layer the target layer - * @property {string=} publicPath the target public path - */ + super.serialize(context); + } -class LoaderPlugin { - /** - * @param {Object} options options - */ - constructor(options = {}) {} + deserialize(context) { + const { read } = context; - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "LoaderPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - LoaderDependency, - normalModuleFactory - ); - compilation.dependencyFactories.set( - LoaderImportDependency, - normalModuleFactory - ); - } - ); + this.range = read(); + this.valueRange = read(); - compiler.hooks.compilation.tap("LoaderPlugin", compilation => { - const moduleGraph = compilation.moduleGraph; - NormalModule.getCompilationHooks(compilation).loader.tap( - "LoaderPlugin", - loaderContext => { - /** - * @param {string} request the request string to load the module from - * @param {LoadModuleCallback} callback callback returning the loaded module or error - * @returns {void} - */ - loaderContext.loadModule = (request, callback) => { - const dep = new LoaderDependency(request); - dep.loc = { - name: request - }; - const factory = compilation.dependencyFactories.get( - /** @type {DepConstructor} */ (dep.constructor) - ); - if (factory === undefined) { - return callback( - new Error( - `No module factory available for dependency type: ${dep.constructor.name}` - ) - ); - } - compilation.buildQueue.increaseParallelism(); - compilation.handleModuleCreation( - { - factory, - dependencies: [dep], - originModule: loaderContext._module, - context: loaderContext.context, - recursive: false - }, - err => { - compilation.buildQueue.decreaseParallelism(); - if (err) { - return callback(err); - } - const referencedModule = moduleGraph.getModule(dep); - if (!referencedModule) { - return callback(new Error("Cannot load the module")); - } - if (referencedModule.getNumberOfErrors() > 0) { - return callback( - new Error("The loaded module contains errors") - ); - } - const moduleSource = referencedModule.originalSource(); - if (!moduleSource) { - return callback( - new Error( - "The module created for a LoaderDependency must have an original source" - ) - ); - } - let source, map; - if (moduleSource.sourceAndMap) { - const sourceAndMap = moduleSource.sourceAndMap(); - map = sourceAndMap.map; - source = sourceAndMap.source; - } else { - map = moduleSource.map(); - source = moduleSource.source(); - } - const fileDependencies = new LazySet(); - const contextDependencies = new LazySet(); - const missingDependencies = new LazySet(); - const buildDependencies = new LazySet(); - referencedModule.addCacheDependencies( - fileDependencies, - contextDependencies, - missingDependencies, - buildDependencies - ); + super.deserialize(context); + } +} - for (const d of fileDependencies) { - loaderContext.addDependency(d); - } - for (const d of contextDependencies) { - loaderContext.addContextDependency(d); - } - for (const d of missingDependencies) { - loaderContext.addMissingDependency(d); - } - for (const d of buildDependencies) { - loaderContext.addBuildDependency(d); - } - return callback(null, source, map, referencedModule); - } - ); - }; +makeSerializable( + AMDRequireContextDependency, + "webpack/lib/dependencies/AMDRequireContextDependency" +); - /** - * @param {string} request the request string to load the module from - * @param {ImportModuleOptions=} options options - * @param {ImportModuleCallback=} callback callback returning the exports - * @returns {void} - */ - const importModule = (request, options, callback) => { - const dep = new LoaderImportDependency(request); - dep.loc = { - name: request - }; - const factory = compilation.dependencyFactories.get( - /** @type {DepConstructor} */ (dep.constructor) - ); - if (factory === undefined) { - return callback( - new Error( - `No module factory available for dependency type: ${dep.constructor.name}` - ) - ); - } - compilation.buildQueue.increaseParallelism(); - compilation.handleModuleCreation( - { - factory, - dependencies: [dep], - originModule: loaderContext._module, - contextInfo: { - issuerLayer: options.layer - }, - context: loaderContext.context, - connectOrigin: false - }, - err => { - compilation.buildQueue.decreaseParallelism(); - if (err) { - return callback(err); - } - const referencedModule = moduleGraph.getModule(dep); - if (!referencedModule) { - return callback(new Error("Cannot load the module")); - } - compilation.executeModule( - referencedModule, - { - entryOptions: { - publicPath: options.publicPath - } - }, - (err, result) => { - if (err) return callback(err); - for (const d of result.fileDependencies) { - loaderContext.addDependency(d); - } - for (const d of result.contextDependencies) { - loaderContext.addContextDependency(d); - } - for (const d of result.missingDependencies) { - loaderContext.addMissingDependency(d); - } - for (const d of result.buildDependencies) { - loaderContext.addBuildDependency(d); - } - if (result.cacheable === false) - loaderContext.cacheable(false); - for (const [name, { source, info }] of result.assets) { - const { buildInfo } = loaderContext._module; - if (!buildInfo.assets) { - buildInfo.assets = Object.create(null); - buildInfo.assetsInfo = new Map(); - } - buildInfo.assets[name] = source; - buildInfo.assetsInfo.set(name, info); - } - callback(null, result.exports); - } - ); - } - ); - }; +AMDRequireContextDependency.Template = __webpack_require__(75815); - /** - * @param {string} request the request string to load the module from - * @param {ImportModuleOptions} options options - * @param {ImportModuleCallback=} callback callback returning the exports - * @returns {Promise | void} exports - */ - loaderContext.importModule = (request, options, callback) => { - if (!callback) { - return new Promise((resolve, reject) => { - importModule(request, options || {}, (err, result) => { - if (err) reject(err); - else resolve(result); - }); - }); - } - return importModule(request, options || {}, callback); - }; - } - ); - }); - } -} -module.exports = LoaderPlugin; +module.exports = AMDRequireContextDependency; /***/ }), -/***/ 5826: +/***/ 76932: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -81391,48 +78996,26 @@ module.exports = LoaderPlugin; +const AsyncDependenciesBlock = __webpack_require__(47736); const makeSerializable = __webpack_require__(33032); -class LocalModule { - constructor(name, idx) { - this.name = name; - this.idx = idx; - this.used = false; - } - - flagUsed() { - this.used = true; - } - - variableName() { - return "__WEBPACK_LOCAL_MODULE_" + this.idx + "__"; - } - - serialize(context) { - const { write } = context; - - write(this.name); - write(this.idx); - write(this.used); - } - - deserialize(context) { - const { read } = context; - - this.name = read(); - this.idx = read(); - this.used = read(); +class AMDRequireDependenciesBlock extends AsyncDependenciesBlock { + constructor(loc, request) { + super(null, loc, request); } } -makeSerializable(LocalModule, "webpack/lib/dependencies/LocalModule"); +makeSerializable( + AMDRequireDependenciesBlock, + "webpack/lib/dependencies/AMDRequireDependenciesBlock" +); -module.exports = LocalModule; +module.exports = AMDRequireDependenciesBlock; /***/ }), -/***/ 52805: +/***/ 66866: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -81443,131 +79026,283 @@ module.exports = LocalModule; -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ - -class LocalModuleDependency extends NullDependency { - constructor(localModule, range, callNew) { - super(); +const RuntimeGlobals = __webpack_require__(16475); +const UnsupportedFeatureWarning = __webpack_require__(42495); +const AMDRequireArrayDependency = __webpack_require__(33516); +const AMDRequireContextDependency = __webpack_require__(96123); +const AMDRequireDependenciesBlock = __webpack_require__(76932); +const AMDRequireDependency = __webpack_require__(43911); +const AMDRequireItemDependency = __webpack_require__(71806); +const ConstDependency = __webpack_require__(76911); +const ContextDependencyHelpers = __webpack_require__(99630); +const LocalModuleDependency = __webpack_require__(52805); +const { getLocalModule } = __webpack_require__(75827); +const UnsupportedDependency = __webpack_require__(51669); +const getFunctionExpression = __webpack_require__(50396); - this.localModule = localModule; - this.range = range; - this.callNew = callNew; +class AMDRequireDependenciesBlockParserPlugin { + constructor(options) { + this.options = options; } - serialize(context) { - const { write } = context; + processFunctionArgument(parser, expression) { + let bindThis = true; + const fnData = getFunctionExpression(expression); + if (fnData) { + parser.inScope( + fnData.fn.params.filter(i => { + return !["require", "module", "exports"].includes(i.name); + }), + () => { + if (fnData.fn.body.type === "BlockStatement") { + parser.walkStatement(fnData.fn.body); + } else { + parser.walkExpression(fnData.fn.body); + } + } + ); + parser.walkExpressions(fnData.expressions); + if (fnData.needThis === false) { + bindThis = false; + } + } else { + parser.walkExpression(expression); + } + return bindThis; + } - write(this.localModule); - write(this.range); - write(this.callNew); + apply(parser) { + parser.hooks.call + .for("require") + .tap( + "AMDRequireDependenciesBlockParserPlugin", + this.processCallRequire.bind(this, parser) + ); + } - super.serialize(context); + processArray(parser, expr, param) { + if (param.isArray()) { + for (const p of param.items) { + const result = this.processItem(parser, expr, p); + if (result === undefined) { + this.processContext(parser, expr, p); + } + } + return true; + } else if (param.isConstArray()) { + const deps = []; + for (const request of param.array) { + let dep, localModule; + if (request === "require") { + dep = "__webpack_require__"; + } else if (["exports", "module"].includes(request)) { + dep = request; + } else if ((localModule = getLocalModule(parser.state, request))) { + localModule.flagUsed(); + dep = new LocalModuleDependency(localModule, undefined, false); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + } else { + dep = this.newRequireItemDependency(request); + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + } + deps.push(dep); + } + const dep = this.newRequireArrayDependency(deps, param.range); + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.module.addPresentationalDependency(dep); + return true; + } + } + processItem(parser, expr, param) { + if (param.isConditional()) { + for (const p of param.options) { + const result = this.processItem(parser, expr, p); + if (result === undefined) { + this.processContext(parser, expr, p); + } + } + return true; + } else if (param.isString()) { + let dep, localModule; + if (param.string === "require") { + dep = new ConstDependency("__webpack_require__", param.string, [ + RuntimeGlobals.require + ]); + } else if (param.string === "module") { + dep = new ConstDependency( + parser.state.module.buildInfo.moduleArgument, + param.range, + [RuntimeGlobals.module] + ); + } else if (param.string === "exports") { + dep = new ConstDependency( + parser.state.module.buildInfo.exportsArgument, + param.range, + [RuntimeGlobals.exports] + ); + } else if ((localModule = getLocalModule(parser.state, param.string))) { + localModule.flagUsed(); + dep = new LocalModuleDependency(localModule, param.range, false); + } else { + dep = this.newRequireItemDependency(param.string, param.range); + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; + } + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + } + } + processContext(parser, expr, param) { + const dep = ContextDependencyHelpers.create( + AMDRequireContextDependency, + param.range, + param, + expr, + this.options, + { + category: "amd" + }, + parser + ); + if (!dep) return; + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; } - deserialize(context) { - const { read } = context; - - this.localModule = read(); - this.range = read(); - this.callNew = read(); - - super.deserialize(context); + processArrayForRequestString(param) { + if (param.isArray()) { + const result = param.items.map(item => + this.processItemForRequestString(item) + ); + if (result.every(Boolean)) return result.join(" "); + } else if (param.isConstArray()) { + return param.array.join(" "); + } } -} - -makeSerializable( - LocalModuleDependency, - "webpack/lib/dependencies/LocalModuleDependency" -); -LocalModuleDependency.Template = class LocalModuleDependencyTemplate extends ( - NullDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, templateContext) { - const dep = /** @type {LocalModuleDependency} */ (dependency); - if (!dep.range) return; - const moduleInstance = dep.callNew - ? `new (function () { return ${dep.localModule.variableName()}; })()` - : dep.localModule.variableName(); - source.replace(dep.range[0], dep.range[1] - 1, moduleInstance); + processItemForRequestString(param) { + if (param.isConditional()) { + const result = param.options.map(item => + this.processItemForRequestString(item) + ); + if (result.every(Boolean)) return result.join("|"); + } else if (param.isString()) { + return param.string; + } } -}; - -module.exports = LocalModuleDependency; - - -/***/ }), - -/***/ 75827: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + processCallRequire(parser, expr) { + let param; + let depBlock; + let dep; + let result; + const old = parser.state.current; -const LocalModule = __webpack_require__(5826); + if (expr.arguments.length >= 1) { + param = parser.evaluateExpression(expr.arguments[0]); + depBlock = this.newRequireDependenciesBlock( + expr.loc, + this.processArrayForRequestString(param) + ); + dep = this.newRequireDependency( + expr.range, + param.range, + expr.arguments.length > 1 ? expr.arguments[1].range : null, + expr.arguments.length > 2 ? expr.arguments[2].range : null + ); + dep.loc = expr.loc; + depBlock.addDependency(dep); -const lookup = (parent, mod) => { - if (mod.charAt(0) !== ".") return mod; + parser.state.current = depBlock; + } - var path = parent.split("/"); - var segments = mod.split("/"); - path.pop(); + if (expr.arguments.length === 1) { + parser.inScope([], () => { + result = this.processArray(parser, expr, param); + }); + parser.state.current = old; + if (!result) return; + parser.state.current.addBlock(depBlock); + return true; + } - for (let i = 0; i < segments.length; i++) { - const seg = segments[i]; - if (seg === "..") { - path.pop(); - } else if (seg !== ".") { - path.push(seg); + if (expr.arguments.length === 2 || expr.arguments.length === 3) { + try { + parser.inScope([], () => { + result = this.processArray(parser, expr, param); + }); + if (!result) { + const dep = new UnsupportedDependency("unsupported", expr.range); + old.addPresentationalDependency(dep); + if (parser.state.module) { + parser.state.module.addError( + new UnsupportedFeatureWarning( + "Cannot statically analyse 'require(…, …)' in line " + + expr.loc.start.line, + expr.loc + ) + ); + } + depBlock = null; + return true; + } + dep.functionBindThis = this.processFunctionArgument( + parser, + expr.arguments[1] + ); + if (expr.arguments.length === 3) { + dep.errorCallbackBindThis = this.processFunctionArgument( + parser, + expr.arguments[2] + ); + } + } finally { + parser.state.current = old; + if (depBlock) parser.state.current.addBlock(depBlock); + } + return true; } } - return path.join("/"); -}; - -exports.addLocalModule = (state, name) => { - if (!state.localModules) { - state.localModules = []; + newRequireDependenciesBlock(loc, request) { + return new AMDRequireDependenciesBlock(loc, request); } - const m = new LocalModule(name, state.localModules.length); - state.localModules.push(m); - return m; -}; - -exports.getLocalModule = (state, name, namedModule) => { - if (!state.localModules) return null; - if (namedModule) { - // resolve dependency name relative to the defining named module - name = lookup(namedModule, name); + newRequireDependency( + outerRange, + arrayRange, + functionRange, + errorCallbackRange + ) { + return new AMDRequireDependency( + outerRange, + arrayRange, + functionRange, + errorCallbackRange + ); } - for (let i = 0; i < state.localModules.length; i++) { - if (state.localModules[i].name === name) { - return state.localModules[i]; - } + newRequireItemDependency(request, range) { + return new AMDRequireItemDependency(request, range); } - return null; -}; + newRequireArrayDependency(depsArray, range) { + return new AMDRequireArrayDependency(depsArray, range); + } +} +module.exports = AMDRequireDependenciesBlockParserPlugin; /***/ }), -/***/ 88488: +/***/ 43911: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -81578,98 +79313,64 @@ exports.getLocalModule = (state, name, namedModule) => { -const Dependency = __webpack_require__(54912); -const InitFragment = __webpack_require__(55870); const RuntimeGlobals = __webpack_require__(16475); const makeSerializable = __webpack_require__(33032); const NullDependency = __webpack_require__(31830); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("../Dependency")} Dependency */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -class ModuleDecoratorDependency extends NullDependency { - /** - * @param {string} decorator the decorator requirement - * @param {boolean} allowExportsAccess allow to access exports from module - */ - constructor(decorator, allowExportsAccess) { +class AMDRequireDependency extends NullDependency { + constructor(outerRange, arrayRange, functionRange, errorCallbackRange) { super(); - this.decorator = decorator; - this.allowExportsAccess = allowExportsAccess; - this._hashUpdate = undefined; - } - /** - * @returns {string} a display name for the type of dependency - */ - get type() { - return "module decorator"; + this.outerRange = outerRange; + this.arrayRange = arrayRange; + this.functionRange = functionRange; + this.errorCallbackRange = errorCallbackRange; + this.functionBindThis = false; + this.errorCallbackBindThis = false; } get category() { - return "self"; - } - - /** - * @returns {string | null} an identifier to merge equal requests - */ - getResourceIdentifier() { - return `self`; - } - - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - return this.allowExportsAccess - ? Dependency.EXPORTS_OBJECT_REFERENCED - : Dependency.NO_EXPORTS_REFERENCED; - } - - /** - * Update the hash - * @param {Hash} hash hash to be updated - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - if (this._hashUpdate === undefined) { - this._hashUpdate = `${this.decorator}${this.allowExportsAccess}`; - } - hash.update(this._hashUpdate); + return "amd"; } serialize(context) { const { write } = context; - write(this.decorator); - write(this.allowExportsAccess); + + write(this.outerRange); + write(this.arrayRange); + write(this.functionRange); + write(this.errorCallbackRange); + write(this.functionBindThis); + write(this.errorCallbackBindThis); + super.serialize(context); } deserialize(context) { const { read } = context; - this.decorator = read(); - this.allowExportsAccess = read(); + + this.outerRange = read(); + this.arrayRange = read(); + this.functionRange = read(); + this.errorCallbackRange = read(); + this.functionBindThis = read(); + this.errorCallbackBindThis = read(); + super.deserialize(context); } } makeSerializable( - ModuleDecoratorDependency, - "webpack/lib/dependencies/ModuleDecoratorDependency" + AMDRequireDependency, + "webpack/lib/dependencies/AMDRequireDependency" ); -ModuleDecoratorDependency.Template = class ModuleDecoratorDependencyTemplate extends ( +AMDRequireDependency.Template = class AMDRequireDependencyTemplate extends ( NullDependency.Template ) { /** @@ -81681,207 +79382,109 @@ ModuleDecoratorDependency.Template = class ModuleDecoratorDependencyTemplate ext apply( dependency, source, - { module, chunkGraph, initFragments, runtimeRequirements } + { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } ) { - const dep = /** @type {ModuleDecoratorDependency} */ (dependency); - runtimeRequirements.add(RuntimeGlobals.moduleLoaded); - runtimeRequirements.add(RuntimeGlobals.moduleId); - runtimeRequirements.add(RuntimeGlobals.module); - runtimeRequirements.add(dep.decorator); - initFragments.push( - new InitFragment( - `/* module decorator */ ${module.moduleArgument} = ${dep.decorator}(${module.moduleArgument});\n`, - InitFragment.STAGE_PROVIDES, - 0, - `module decorator ${chunkGraph.getModuleId(module)}` - ) + const dep = /** @type {AMDRequireDependency} */ (dependency); + const depBlock = /** @type {AsyncDependenciesBlock} */ ( + moduleGraph.getParentBlock(dep) ); - } -}; - -module.exports = ModuleDecoratorDependency; - - -/***/ }), - -/***/ 80321: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const Dependency = __webpack_require__(54912); -const DependencyTemplate = __webpack_require__(5160); -const memoize = __webpack_require__(78676); + const promise = runtimeTemplate.blockPromise({ + chunkGraph, + block: depBlock, + message: "AMD require", + runtimeRequirements + }); -/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ -/** @typedef {import("../Module")} Module */ + // has array range but no function range + if (dep.arrayRange && !dep.functionRange) { + const startBlock = `${promise}.then(function() {`; + const endBlock = `;})['catch'](${RuntimeGlobals.uncaughtErrorHandler})`; + runtimeRequirements.add(RuntimeGlobals.uncaughtErrorHandler); -const getRawModule = memoize(() => __webpack_require__(84929)); + source.replace(dep.outerRange[0], dep.arrayRange[0] - 1, startBlock); -class ModuleDependency extends Dependency { - /** - * @param {string} request request path which needs resolving - */ - constructor(request) { - super(); - this.request = request; - this.userRequest = request; - this.range = undefined; - // assertions must be serialized by subclasses that use it - /** @type {Record | undefined} */ - this.assertions = undefined; - } + source.replace(dep.arrayRange[1], dep.outerRange[1] - 1, endBlock); - /** - * @returns {string | null} an identifier to merge equal requests - */ - getResourceIdentifier() { - let str = `module${this.request}`; - if (this.assertions !== undefined) { - str += JSON.stringify(this.assertions); + return; } - return str; - } - - /** - * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module - */ - couldAffectReferencingModule() { - return true; - } - - /** - * @param {string} context context directory - * @returns {Module} a module - */ - createIgnoredModule(context) { - const RawModule = getRawModule(); - return new RawModule( - "/* (ignored) */", - `ignored|${context}|${this.request}`, - `${this.request} (ignored)` - ); - } - - serialize(context) { - const { write } = context; - write(this.request); - write(this.userRequest); - write(this.range); - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - this.request = read(); - this.userRequest = read(); - this.range = read(); - super.deserialize(context); - } -} - -ModuleDependency.Template = DependencyTemplate; - -module.exports = ModuleDependency; - - -/***/ }), - -/***/ 80825: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // has function range but no array range + if (dep.functionRange && !dep.arrayRange) { + const startBlock = `${promise}.then((`; + const endBlock = `).bind(exports, __webpack_require__, exports, module))['catch'](${RuntimeGlobals.uncaughtErrorHandler})`; + runtimeRequirements.add(RuntimeGlobals.uncaughtErrorHandler); + source.replace(dep.outerRange[0], dep.functionRange[0] - 1, startBlock); -const ModuleDependency = __webpack_require__(80321); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ - -class ModuleDependencyTemplateAsId extends ModuleDependency.Template { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, { runtimeTemplate, moduleGraph, chunkGraph }) { - const dep = /** @type {ModuleDependency} */ (dependency); - if (!dep.range) return; - const content = runtimeTemplate.moduleId({ - module: moduleGraph.getModule(dep), - chunkGraph, - request: dep.request, - weak: dep.weak - }); - source.replace(dep.range[0], dep.range[1] - 1, content); - } -} + source.replace(dep.functionRange[1], dep.outerRange[1] - 1, endBlock); -module.exports = ModuleDependencyTemplateAsId; + return; + } + // has array range, function range, and errorCallbackRange + if (dep.arrayRange && dep.functionRange && dep.errorCallbackRange) { + const startBlock = `${promise}.then(function() { `; + const errorRangeBlock = `}${ + dep.functionBindThis ? ".bind(this)" : "" + })['catch'](`; + const endBlock = `${dep.errorCallbackBindThis ? ".bind(this)" : ""})`; -/***/ }), + source.replace(dep.outerRange[0], dep.arrayRange[0] - 1, startBlock); -/***/ 36873: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + source.insert(dep.arrayRange[0], "var __WEBPACK_AMD_REQUIRE_ARRAY__ = "); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + source.replace(dep.arrayRange[1], dep.functionRange[0] - 1, "; ("); + source.insert( + dep.functionRange[1], + ").apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__);" + ); + source.replace( + dep.functionRange[1], + dep.errorCallbackRange[0] - 1, + errorRangeBlock + ); -const ModuleDependency = __webpack_require__(80321); + source.replace( + dep.errorCallbackRange[1], + dep.outerRange[1] - 1, + endBlock + ); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + return; + } -class ModuleDependencyTemplateAsRequireId extends ModuleDependency.Template { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply( - dependency, - source, - { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } - ) { - const dep = /** @type {ModuleDependency} */ (dependency); - if (!dep.range) return; - const content = runtimeTemplate.moduleExports({ - module: moduleGraph.getModule(dep), - chunkGraph, - request: dep.request, - weak: dep.weak, - runtimeRequirements - }); - source.replace(dep.range[0], dep.range[1] - 1, content); + // has array range, function range, but no errorCallbackRange + if (dep.arrayRange && dep.functionRange) { + const startBlock = `${promise}.then(function() { `; + const endBlock = `}${ + dep.functionBindThis ? ".bind(this)" : "" + })['catch'](${RuntimeGlobals.uncaughtErrorHandler})`; + runtimeRequirements.add(RuntimeGlobals.uncaughtErrorHandler); + + source.replace(dep.outerRange[0], dep.arrayRange[0] - 1, startBlock); + + source.insert(dep.arrayRange[0], "var __WEBPACK_AMD_REQUIRE_ARRAY__ = "); + + source.replace(dep.arrayRange[1], dep.functionRange[0] - 1, "; ("); + + source.insert( + dep.functionRange[1], + ").apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__);" + ); + + source.replace(dep.functionRange[1], dep.outerRange[1] - 1, endBlock); + } } -} -module.exports = ModuleDependencyTemplateAsRequireId; +}; + +module.exports = AMDRequireDependency; /***/ }), -/***/ 47511: +/***/ 71806: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -81894,112 +79497,167 @@ module.exports = ModuleDependencyTemplateAsRequireId; const makeSerializable = __webpack_require__(33032); const ModuleDependency = __webpack_require__(80321); -const ModuleDependencyTemplateAsId = __webpack_require__(80825); +const ModuleDependencyTemplateAsRequireId = __webpack_require__(36873); -class ModuleHotAcceptDependency extends ModuleDependency { +class AMDRequireItemDependency extends ModuleDependency { constructor(request, range) { super(request); + this.range = range; - this.weak = true; } get type() { - return "module.hot.accept"; + return "amd require"; } get category() { - return "commonjs"; + return "amd"; } } makeSerializable( - ModuleHotAcceptDependency, - "webpack/lib/dependencies/ModuleHotAcceptDependency" + AMDRequireItemDependency, + "webpack/lib/dependencies/AMDRequireItemDependency" ); -ModuleHotAcceptDependency.Template = ModuleDependencyTemplateAsId; +AMDRequireItemDependency.Template = ModuleDependencyTemplateAsRequireId; -module.exports = ModuleHotAcceptDependency; +module.exports = AMDRequireItemDependency; /***/ }), -/***/ 86301: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 45242: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); -const ModuleDependencyTemplateAsId = __webpack_require__(80825); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); -class ModuleHotDeclineDependency extends ModuleDependency { - constructor(request, range) { - super(request); +class AMDDefineRuntimeModule extends RuntimeModule { + constructor() { + super("amd define"); + } - this.range = range; - this.weak = true; + /** + * @returns {string} runtime code + */ + generate() { + return Template.asString([ + `${RuntimeGlobals.amdDefine} = function () {`, + Template.indent("throw new Error('define cannot be used indirect');"), + "};" + ]); } +} - get type() { - return "module.hot.decline"; +class AMDOptionsRuntimeModule extends RuntimeModule { + /** + * @param {Record} options the AMD options + */ + constructor(options) { + super("amd options"); + this.options = options; } - get category() { - return "commonjs"; + /** + * @returns {string} runtime code + */ + generate() { + return Template.asString([ + `${RuntimeGlobals.amdOptions} = ${JSON.stringify(this.options)};` + ]); } } -makeSerializable( - ModuleHotDeclineDependency, - "webpack/lib/dependencies/ModuleHotDeclineDependency" -); - -ModuleHotDeclineDependency.Template = ModuleDependencyTemplateAsId; - -module.exports = ModuleHotDeclineDependency; +exports.AMDDefineRuntimeModule = AMDDefineRuntimeModule; +exports.AMDOptionsRuntimeModule = AMDOptionsRuntimeModule; /***/ }), -/***/ 31830: +/***/ 57403: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Florent Cailhol @ooflorent */ -const Dependency = __webpack_require__(54912); const DependencyTemplate = __webpack_require__(5160); +const InitFragment = __webpack_require__(55870); +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../util/Hash")} Hash */ -class NullDependency extends Dependency { - get type() { - return "null"; +class CachedConstDependency extends NullDependency { + constructor(expression, range, identifier) { + super(); + + this.expression = expression; + this.range = range; + this.identifier = identifier; + this._hashUpdate = undefined; } /** - * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + * Update the hash + * @param {Hash} hash hash to be updated + * @param {UpdateHashContext} context context + * @returns {void} */ - couldAffectReferencingModule() { - return false; + updateHash(hash, context) { + if (this._hashUpdate === undefined) + this._hashUpdate = "" + this.identifier + this.range + this.expression; + hash.update(this._hashUpdate); + } + + serialize(context) { + const { write } = context; + + write(this.expression); + write(this.range); + write(this.identifier); + + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + + this.expression = read(); + this.range = read(); + this.identifier = read(); + + super.deserialize(context); } } -NullDependency.Template = class NullDependencyTemplate extends ( +makeSerializable( + CachedConstDependency, + "webpack/lib/dependencies/CachedConstDependency" +); + +CachedConstDependency.Template = class CachedConstDependencyTemplate extends ( DependencyTemplate ) { /** @@ -82008,16 +79666,39 @@ NullDependency.Template = class NullDependencyTemplate extends ( * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply(dependency, source, templateContext) {} + apply( + dependency, + source, + { runtimeTemplate, dependencyTemplates, initFragments } + ) { + const dep = /** @type {CachedConstDependency} */ (dependency); + + initFragments.push( + new InitFragment( + `var ${dep.identifier} = ${dep.expression};\n`, + InitFragment.STAGE_CONSTANTS, + 0, + `const ${dep.identifier}` + ) + ); + + if (typeof dep.range === "number") { + source.insert(dep.range, dep.identifier); + + return; + } + + source.replace(dep.range[0], dep.range[1] - 1, dep.identifier); + } }; -module.exports = NullDependency; +module.exports = CachedConstDependency; /***/ }), -/***/ 31618: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 59643: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -82027,113 +79708,361 @@ module.exports = NullDependency; -const ModuleDependency = __webpack_require__(80321); - -class PrefetchDependency extends ModuleDependency { - constructor(request) { - super(request); - } - - get type() { - return "prefetch"; - } +const RuntimeGlobals = __webpack_require__(16475); - get category() { - return "esm"; +exports.handleDependencyBase = (depBase, module, runtimeRequirements) => { + let base = undefined; + let type; + switch (depBase) { + case "exports": + runtimeRequirements.add(RuntimeGlobals.exports); + base = module.exportsArgument; + type = "expression"; + break; + case "module.exports": + runtimeRequirements.add(RuntimeGlobals.module); + base = `${module.moduleArgument}.exports`; + type = "expression"; + break; + case "this": + runtimeRequirements.add(RuntimeGlobals.thisAsExports); + base = "this"; + type = "expression"; + break; + case "Object.defineProperty(exports)": + runtimeRequirements.add(RuntimeGlobals.exports); + base = module.exportsArgument; + type = "Object.defineProperty"; + break; + case "Object.defineProperty(module.exports)": + runtimeRequirements.add(RuntimeGlobals.module); + base = `${module.moduleArgument}.exports`; + type = "Object.defineProperty"; + break; + case "Object.defineProperty(this)": + runtimeRequirements.add(RuntimeGlobals.thisAsExports); + base = "this"; + type = "Object.defineProperty"; + break; + default: + throw new Error(`Unsupported base ${depBase}`); } -} -module.exports = PrefetchDependency; + return [type, base]; +}; /***/ }), -/***/ 95770: +/***/ 62892: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent + Author Tobias Koppers @sokra */ -const InitFragment = __webpack_require__(55870); +const Dependency = __webpack_require__(54912); +const { UsageState } = __webpack_require__(63686); +const Template = __webpack_require__(39722); +const { equals } = __webpack_require__(84953); const makeSerializable = __webpack_require__(33032); +const propertyAccess = __webpack_require__(54190); +const { handleDependencyBase } = __webpack_require__(59643); const ModuleDependency = __webpack_require__(80321); +const processExportInfo = __webpack_require__(55207); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../Module")} Module */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -/** - * @param {string[]|null} path the property path array - * @returns {string} the converted path - */ -const pathToString = path => - path !== null && path.length > 0 - ? path.map(part => `[${JSON.stringify(part)}]`).join("") - : ""; +const idsSymbol = Symbol("CommonJsExportRequireDependency.ids"); -class ProvidedDependency extends ModuleDependency { - constructor(request, identifier, path, range) { +const EMPTY_OBJECT = {}; + +class CommonJsExportRequireDependency extends ModuleDependency { + constructor(range, valueRange, base, names, request, ids, resultUsed) { super(request); - this.identifier = identifier; - this.path = path; this.range = range; - this._hashUpdate = undefined; + this.valueRange = valueRange; + this.base = base; + this.names = names; + this.ids = ids; + this.resultUsed = resultUsed; + this.asiSafe = undefined; } get type() { - return "provided"; + return "cjs export require"; } - get category() { - return "esm"; + /** + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + */ + couldAffectReferencingModule() { + return Dependency.TRANSITIVE; } /** - * Update the hash - * @param {Hash} hash hash to be updated - * @param {UpdateHashContext} context context + * @param {ModuleGraph} moduleGraph the module graph + * @returns {string[]} the imported id + */ + getIds(moduleGraph) { + return moduleGraph.getMeta(this)[idsSymbol] || this.ids; + } + + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {string[]} ids the imported ids * @returns {void} */ - updateHash(hash, context) { - if (this._hashUpdate === undefined) { - this._hashUpdate = - this.identifier + (this.path ? this.path.join(",") : "null"); + setIds(moduleGraph, ids) { + moduleGraph.getMeta(this)[idsSymbol] = ids; + } + + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + const ids = this.getIds(moduleGraph); + const getFullResult = () => { + if (ids.length === 0) { + return Dependency.EXPORTS_OBJECT_REFERENCED; + } else { + return [ + { + name: ids, + canMangle: false + } + ]; + } + }; + if (this.resultUsed) return getFullResult(); + let exportsInfo = moduleGraph.getExportsInfo( + moduleGraph.getParentModule(this) + ); + for (const name of this.names) { + const exportInfo = exportsInfo.getReadOnlyExportInfo(name); + const used = exportInfo.getUsed(runtime); + if (used === UsageState.Unused) return Dependency.NO_EXPORTS_REFERENCED; + if (used !== UsageState.OnlyPropertiesUsed) return getFullResult(); + exportsInfo = exportInfo.exportsInfo; + if (!exportsInfo) return getFullResult(); + } + if (exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused) { + return getFullResult(); + } + /** @type {string[][]} */ + const referencedExports = []; + for (const exportInfo of exportsInfo.orderedExports) { + processExportInfo( + runtime, + referencedExports, + ids.concat(exportInfo.name), + exportInfo, + false + ); + } + return referencedExports.map(name => ({ + name, + canMangle: false + })); + } + + /** + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names + */ + getExports(moduleGraph) { + const ids = this.getIds(moduleGraph); + if (this.names.length === 1) { + const name = this.names[0]; + const from = moduleGraph.getConnection(this); + if (!from) return; + return { + exports: [ + { + name, + from, + export: ids.length === 0 ? null : ids, + // we can't mangle names that are in an empty object + // because one could access the prototype property + // when export isn't set yet + canMangle: !(name in EMPTY_OBJECT) && false + } + ], + dependencies: [from.module] + }; + } else if (this.names.length > 0) { + const name = this.names[0]; + return { + exports: [ + { + name, + // we can't mangle names that are in an empty object + // because one could access the prototype property + // when export isn't set yet + canMangle: !(name in EMPTY_OBJECT) && false + } + ], + dependencies: undefined + }; + } else { + const from = moduleGraph.getConnection(this); + if (!from) return; + const reexportInfo = this.getStarReexports( + moduleGraph, + undefined, + from.module + ); + if (reexportInfo) { + return { + exports: Array.from(reexportInfo.exports, name => { + return { + name, + from, + export: ids.concat(name), + canMangle: !(name in EMPTY_OBJECT) && false + }; + }), + // TODO handle deep reexports + dependencies: [from.module] + }; + } else { + return { + exports: true, + from: ids.length === 0 ? from : undefined, + canMangle: false, + dependencies: [from.module] + }; + } + } + } + + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {RuntimeSpec} runtime the runtime + * @param {Module} importedModule the imported module (optional) + * @returns {{exports?: Set, checked?: Set}} information + */ + getStarReexports( + moduleGraph, + runtime, + importedModule = moduleGraph.getModule(this) + ) { + let importedExportsInfo = moduleGraph.getExportsInfo(importedModule); + const ids = this.getIds(moduleGraph); + if (ids.length > 0) + importedExportsInfo = importedExportsInfo.getNestedExportsInfo(ids); + let exportsInfo = moduleGraph.getExportsInfo( + moduleGraph.getParentModule(this) + ); + if (this.names.length > 0) + exportsInfo = exportsInfo.getNestedExportsInfo(this.names); + + const noExtraExports = + importedExportsInfo && + importedExportsInfo.otherExportsInfo.provided === false; + const noExtraImports = + exportsInfo && + exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused; + + if (!noExtraExports && !noExtraImports) { + return; + } + + const isNamespaceImport = + importedModule.getExportsType(moduleGraph, false) === "namespace"; + + /** @type {Set} */ + const exports = new Set(); + /** @type {Set} */ + const checked = new Set(); + + if (noExtraImports) { + for (const exportInfo of exportsInfo.orderedExports) { + const name = exportInfo.name; + if (exportInfo.getUsed(runtime) === UsageState.Unused) continue; + if (name === "__esModule" && isNamespaceImport) { + exports.add(name); + } else if (importedExportsInfo) { + const importedExportInfo = + importedExportsInfo.getReadOnlyExportInfo(name); + if (importedExportInfo.provided === false) continue; + exports.add(name); + if (importedExportInfo.provided === true) continue; + checked.add(name); + } else { + exports.add(name); + checked.add(name); + } + } + } else if (noExtraExports) { + for (const importedExportInfo of importedExportsInfo.orderedExports) { + const name = importedExportInfo.name; + if (importedExportInfo.provided === false) continue; + if (exportsInfo) { + const exportInfo = exportsInfo.getReadOnlyExportInfo(name); + if (exportInfo.getUsed(runtime) === UsageState.Unused) continue; + } + exports.add(name); + if (importedExportInfo.provided === true) continue; + checked.add(name); + } + if (isNamespaceImport) { + exports.add("__esModule"); + checked.delete("__esModule"); + } } - hash.update(this._hashUpdate); + + return { exports, checked }; } serialize(context) { const { write } = context; - write(this.identifier); - write(this.path); + write(this.asiSafe); + write(this.range); + write(this.valueRange); + write(this.base); + write(this.names); + write(this.ids); + write(this.resultUsed); super.serialize(context); } deserialize(context) { const { read } = context; - this.identifier = read(); - this.path = read(); + this.asiSafe = read(); + this.range = read(); + this.valueRange = read(); + this.base = read(); + this.names = read(); + this.ids = read(); + this.resultUsed = read(); super.deserialize(context); } } makeSerializable( - ProvidedDependency, - "webpack/lib/dependencies/ProvidedDependency" + CommonJsExportRequireDependency, + "webpack/lib/dependencies/CommonJsExportRequireDependency" ); -class ProvidedDependencyTemplate extends ModuleDependency.Template { +CommonJsExportRequireDependency.Template = class CommonJsExportRequireDependencyTemplate extends ( + ModuleDependency.Template +) { /** * @param {Dependency} dependency the dependency for which the template should be applied * @param {ReplaceSource} source the current replace source which can be modified @@ -82144,41 +80073,70 @@ class ProvidedDependencyTemplate extends ModuleDependency.Template { dependency, source, { + module, runtimeTemplate, - moduleGraph, chunkGraph, - initFragments, - runtimeRequirements + moduleGraph, + runtimeRequirements, + runtime } ) { - const dep = /** @type {ProvidedDependency} */ (dependency); - initFragments.push( - new InitFragment( - `/* provided dependency */ var ${ - dep.identifier - } = ${runtimeTemplate.moduleExports({ - module: moduleGraph.getModule(dep), - chunkGraph, - request: dep.request, - runtimeRequirements - })}${pathToString(dep.path)};\n`, - InitFragment.STAGE_PROVIDES, - 1, - `provided ${dep.identifier}` - ) + const dep = /** @type {CommonJsExportRequireDependency} */ (dependency); + const used = moduleGraph + .getExportsInfo(module) + .getUsedName(dep.names, runtime); + + const [type, base] = handleDependencyBase( + dep.base, + module, + runtimeRequirements ); - source.replace(dep.range[0], dep.range[1] - 1, dep.identifier); - } -} -ProvidedDependency.Template = ProvidedDependencyTemplate; + const importedModule = moduleGraph.getModule(dep); + let requireExpr = runtimeTemplate.moduleExports({ + module: importedModule, + chunkGraph, + request: dep.request, + weak: dep.weak, + runtimeRequirements + }); + if (importedModule) { + const ids = dep.getIds(moduleGraph); + const usedImported = moduleGraph + .getExportsInfo(importedModule) + .getUsedName(ids, runtime); + if (usedImported) { + const comment = equals(usedImported, ids) + ? "" + : Template.toNormalComment(propertyAccess(ids)) + " "; + requireExpr += `${comment}${propertyAccess(usedImported)}`; + } + } -module.exports = ProvidedDependency; + switch (type) { + case "expression": + source.replace( + dep.range[0], + dep.range[1] - 1, + used + ? `${base}${propertyAccess(used)} = ${requireExpr}` + : `/* unused reexport */ ${requireExpr}` + ); + return; + case "Object.defineProperty": + throw new Error("TODO"); + default: + throw new Error("Unexpected type"); + } + } +}; + +module.exports = CommonJsExportRequireDependency; /***/ }), -/***/ 55799: +/***/ 45598: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -82189,74 +80147,79 @@ module.exports = ProvidedDependency; -const { UsageState } = __webpack_require__(63686); +const InitFragment = __webpack_require__(55870); const makeSerializable = __webpack_require__(33032); -const { filterRuntime } = __webpack_require__(17156); +const propertyAccess = __webpack_require__(54190); +const { handleDependencyBase } = __webpack_require__(59643); const NullDependency = __webpack_require__(31830); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ /** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../util/Hash")} Hash */ -class PureExpressionDependency extends NullDependency { - /** - * @param {[number, number]} range the source range - */ - constructor(range) { +const EMPTY_OBJECT = {}; + +class CommonJsExportsDependency extends NullDependency { + constructor(range, valueRange, base, names) { super(); this.range = range; - /** @type {Set | false} */ - this.usedByExports = false; - this._hashUpdate = undefined; + this.valueRange = valueRange; + this.base = base; + this.names = names; } - /** - * Update the hash - * @param {Hash} hash hash to be updated - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - if (this._hashUpdate === undefined) { - this._hashUpdate = this.range + ""; - } - hash.update(this._hashUpdate); + get type() { + return "cjs exports"; } /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this dependency connects the module to referencing modules + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names */ - getModuleEvaluationSideEffectsState(moduleGraph) { - return false; + getExports(moduleGraph) { + const name = this.names[0]; + return { + exports: [ + { + name, + // we can't mangle names that are in an empty object + // because one could access the prototype property + // when export isn't set yet + canMangle: !(name in EMPTY_OBJECT) + } + ], + dependencies: undefined + }; } serialize(context) { const { write } = context; write(this.range); - write(this.usedByExports); + write(this.valueRange); + write(this.base); + write(this.names); super.serialize(context); } deserialize(context) { const { read } = context; this.range = read(); - this.usedByExports = read(); + this.valueRange = read(); + this.base = read(); + this.names = read(); super.deserialize(context); } } makeSerializable( - PureExpressionDependency, - "webpack/lib/dependencies/PureExpressionDependency" + CommonJsExportsDependency, + "webpack/lib/dependencies/CommonJsExportsDependency" ); -PureExpressionDependency.Template = class PureExpressionDependencyTemplate extends ( +CommonJsExportsDependency.Template = class CommonJsExportsDependencyTemplate extends ( NullDependency.Template ) { /** @@ -82268,332 +80231,80 @@ PureExpressionDependency.Template = class PureExpressionDependencyTemplate exten apply( dependency, source, - { chunkGraph, moduleGraph, runtime, runtimeTemplate, runtimeRequirements } + { module, moduleGraph, initFragments, runtimeRequirements, runtime } ) { - const dep = /** @type {PureExpressionDependency} */ (dependency); - - const usedByExports = dep.usedByExports; - if (usedByExports !== false) { - const selfModule = moduleGraph.getParentModule(dep); - const exportsInfo = moduleGraph.getExportsInfo(selfModule); - const runtimeCondition = filterRuntime(runtime, runtime => { - for (const exportName of usedByExports) { - if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) { - return true; - } - } - return false; - }); - if (runtimeCondition === true) return; - if (runtimeCondition !== false) { - const condition = runtimeTemplate.runtimeConditionExpression({ - chunkGraph, - runtime, - runtimeCondition, - runtimeRequirements - }); - source.insert( - dep.range[0], - `(/* runtime-dependent pure expression or super */ ${condition} ? (` - ); - source.insert(dep.range[1], ") : null)"); - return; - } - } - - source.insert( - dep.range[0], - `(/* unused pure expression or super */ null && (` - ); - source.insert(dep.range[1], "))"); - } -}; - -module.exports = PureExpressionDependency; - - -/***/ }), - -/***/ 46917: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const makeSerializable = __webpack_require__(33032); -const ContextDependency = __webpack_require__(88101); -const ModuleDependencyTemplateAsRequireId = __webpack_require__(36873); - -class RequireContextDependency extends ContextDependency { - constructor(options, range) { - super(options); - - this.range = range; - } - - get type() { - return "require.context"; - } - - serialize(context) { - const { write } = context; - - write(this.range); - - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - - this.range = read(); - - super.deserialize(context); - } -} - -makeSerializable( - RequireContextDependency, - "webpack/lib/dependencies/RequireContextDependency" -); - -RequireContextDependency.Template = ModuleDependencyTemplateAsRequireId; - -module.exports = RequireContextDependency; - - -/***/ }), - -/***/ 18851: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const RequireContextDependency = __webpack_require__(46917); - -module.exports = class RequireContextDependencyParserPlugin { - apply(parser) { - parser.hooks.call - .for("require.context") - .tap("RequireContextDependencyParserPlugin", expr => { - let regExp = /^\.\/.*$/; - let recursive = true; - let mode = "sync"; - switch (expr.arguments.length) { - case 4: { - const modeExpr = parser.evaluateExpression(expr.arguments[3]); - if (!modeExpr.isString()) return; - mode = modeExpr.string; - } - // falls through - case 3: { - const regExpExpr = parser.evaluateExpression(expr.arguments[2]); - if (!regExpExpr.isRegExp()) return; - regExp = regExpExpr.regExp; - } - // falls through - case 2: { - const recursiveExpr = parser.evaluateExpression(expr.arguments[1]); - if (!recursiveExpr.isBoolean()) return; - recursive = recursiveExpr.bool; - } - // falls through - case 1: { - const requestExpr = parser.evaluateExpression(expr.arguments[0]); - if (!requestExpr.isString()) return; - const dep = new RequireContextDependency( - { - request: requestExpr.string, - recursive, - regExp, - mode, - category: "commonjs" - }, - expr.range - ); - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; - } - } - }); - } -}; - - -/***/ }), - -/***/ 2928: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { cachedSetProperty } = __webpack_require__(60839); -const ContextElementDependency = __webpack_require__(58477); -const RequireContextDependency = __webpack_require__(46917); -const RequireContextDependencyParserPlugin = __webpack_require__(18851); - -/** @typedef {import("../../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ -/** @typedef {import("../Compiler")} Compiler */ - -/** @type {ResolveOptions} */ -const EMPTY_RESOLVE_OPTIONS = {}; - -class RequireContextPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "RequireContextPlugin", - (compilation, { contextModuleFactory, normalModuleFactory }) => { - compilation.dependencyFactories.set( - RequireContextDependency, - contextModuleFactory - ); - compilation.dependencyTemplates.set( - RequireContextDependency, - new RequireContextDependency.Template() - ); - - compilation.dependencyFactories.set( - ContextElementDependency, - normalModuleFactory - ); - - const handler = (parser, parserOptions) => { - if ( - parserOptions.requireContext !== undefined && - !parserOptions.requireContext - ) - return; - - new RequireContextDependencyParserPlugin().apply(parser); - }; - - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("RequireContextPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("RequireContextPlugin", handler); - - contextModuleFactory.hooks.alternativeRequests.tap( - "RequireContextPlugin", - (items, options) => { - if (items.length === 0) return items; - - const finalResolveOptions = compiler.resolverFactory.get( - "normal", - cachedSetProperty( - options.resolveOptions || EMPTY_RESOLVE_OPTIONS, - "dependencyType", - options.category - ) - ).options; - - let newItems; - if (!finalResolveOptions.fullySpecified) { - newItems = []; - for (const item of items) { - const { request, context } = item; - for (const ext of finalResolveOptions.extensions) { - if (request.endsWith(ext)) { - newItems.push({ - context, - request: request.slice(0, -ext.length) - }); - } - } - if (!finalResolveOptions.enforceExtension) { - newItems.push(item); - } - } - items = newItems; - - newItems = []; - for (const obj of items) { - const { request, context } = obj; - for (const mainFile of finalResolveOptions.mainFiles) { - if (request.endsWith(`/${mainFile}`)) { - newItems.push({ - context, - request: request.slice(0, -mainFile.length) - }); - newItems.push({ - context, - request: request.slice(0, -mainFile.length - 1) - }); - } - } - newItems.push(obj); - } - items = newItems; - } - - newItems = []; - for (const item of items) { - let hideOriginal = false; - for (const modulesItems of finalResolveOptions.modules) { - if (Array.isArray(modulesItems)) { - for (const dir of modulesItems) { - if (item.request.startsWith(`./${dir}/`)) { - newItems.push({ - context: item.context, - request: item.request.slice(dir.length + 3) - }); - hideOriginal = true; - } - } - } else { - const dir = modulesItems.replace(/\\/g, "/"); - const fullPath = - item.context.replace(/\\/g, "/") + item.request.slice(1); - if (fullPath.startsWith(dir)) { - newItems.push({ - context: item.context, - request: fullPath.slice(dir.length + 1) - }); - } - } - } - if (!hideOriginal) { - newItems.push(item); - } - } - return newItems; - } - ); - } + const dep = /** @type {CommonJsExportsDependency} */ (dependency); + const used = moduleGraph + .getExportsInfo(module) + .getUsedName(dep.names, runtime); + + const [type, base] = handleDependencyBase( + dep.base, + module, + runtimeRequirements ); + + switch (type) { + case "expression": + if (!used) { + initFragments.push( + new InitFragment( + "var __webpack_unused_export__;\n", + InitFragment.STAGE_CONSTANTS, + 0, + "__webpack_unused_export__" + ) + ); + source.replace( + dep.range[0], + dep.range[1] - 1, + "__webpack_unused_export__" + ); + return; + } + source.replace( + dep.range[0], + dep.range[1] - 1, + `${base}${propertyAccess(used)}` + ); + return; + case "Object.defineProperty": + if (!used) { + initFragments.push( + new InitFragment( + "var __webpack_unused_export__;\n", + InitFragment.STAGE_CONSTANTS, + 0, + "__webpack_unused_export__" + ) + ); + source.replace( + dep.range[0], + dep.valueRange[0] - 1, + "__webpack_unused_export__ = (" + ); + source.replace(dep.valueRange[1], dep.range[1] - 1, ")"); + return; + } + source.replace( + dep.range[0], + dep.valueRange[0] - 1, + `Object.defineProperty(${base}${propertyAccess( + used.slice(0, -1) + )}, ${JSON.stringify(used[used.length - 1])}, (` + ); + source.replace(dep.valueRange[1], dep.range[1] - 1, "))"); + return; + } } -} -module.exports = RequireContextPlugin; +}; + +module.exports = CommonJsExportsDependency; /***/ }), -/***/ 27153: +/***/ 97107: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -82604,155 +80315,340 @@ module.exports = RequireContextPlugin; -const AsyncDependenciesBlock = __webpack_require__(47736); -const makeSerializable = __webpack_require__(33032); - -class RequireEnsureDependenciesBlock extends AsyncDependenciesBlock { - constructor(chunkName, loc) { - super(chunkName, loc, null); - } -} - -makeSerializable( - RequireEnsureDependenciesBlock, - "webpack/lib/dependencies/RequireEnsureDependenciesBlock" -); +const RuntimeGlobals = __webpack_require__(16475); +const formatLocation = __webpack_require__(16734); +const { evaluateToString } = __webpack_require__(93998); +const propertyAccess = __webpack_require__(54190); +const CommonJsExportRequireDependency = __webpack_require__(62892); +const CommonJsExportsDependency = __webpack_require__(45598); +const CommonJsSelfReferenceDependency = __webpack_require__(52225); +const DynamicExports = __webpack_require__(32006); +const HarmonyExports = __webpack_require__(39211); +const ModuleDecoratorDependency = __webpack_require__(88488); -module.exports = RequireEnsureDependenciesBlock; +/** @typedef {import("estree").Expression} ExpressionNode */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */ +/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ +const getValueOfPropertyDescription = expr => { + if (expr.type !== "ObjectExpression") return; + for (const property of expr.properties) { + if (property.computed) continue; + const key = property.key; + if (key.type !== "Identifier" || key.name !== "value") continue; + return property.value; + } +}; -/***/ }), +const isTruthyLiteral = expr => { + switch (expr.type) { + case "Literal": + return !!expr.value; + case "UnaryExpression": + if (expr.operator === "!") return isFalsyLiteral(expr.argument); + } + return false; +}; -/***/ 7235: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +const isFalsyLiteral = expr => { + switch (expr.type) { + case "Literal": + return !expr.value; + case "UnaryExpression": + if (expr.operator === "!") return isTruthyLiteral(expr.argument); + } + return false; +}; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** + * @param {JavascriptParser} parser the parser + * @param {ExpressionNode} expr expression + * @returns {{ argument: BasicEvaluatedExpression, ids: string[] } | undefined} parsed call + */ +const parseRequireCall = (parser, expr) => { + const ids = []; + while (expr.type === "MemberExpression") { + if (expr.object.type === "Super") return; + if (!expr.property) return; + const prop = expr.property; + if (expr.computed) { + if (prop.type !== "Literal") return; + ids.push(`${prop.value}`); + } else { + if (prop.type !== "Identifier") return; + ids.push(prop.name); + } + expr = expr.object; + } + if (expr.type !== "CallExpression" || expr.arguments.length !== 1) return; + const callee = expr.callee; + if ( + callee.type !== "Identifier" || + parser.getVariableInfo(callee.name) !== "require" + ) { + return; + } + const arg = expr.arguments[0]; + if (arg.type === "SpreadElement") return; + const argValue = parser.evaluateExpression(arg); + return { argument: argValue, ids: ids.reverse() }; +}; +class CommonJsExportsParserPlugin { + constructor(moduleGraph) { + this.moduleGraph = moduleGraph; + } + /** + * @param {JavascriptParser} parser the parser + */ + apply(parser) { + const enableStructuredExports = () => { + DynamicExports.enable(parser.state); + }; + const checkNamespace = (topLevel, members, valueExpr) => { + if (!DynamicExports.isEnabled(parser.state)) return; + if (members.length > 0 && members[0] === "__esModule") { + if (valueExpr && isTruthyLiteral(valueExpr) && topLevel) { + DynamicExports.setFlagged(parser.state); + } else { + DynamicExports.setDynamic(parser.state); + } + } + }; + const bailout = reason => { + DynamicExports.bailout(parser.state); + if (reason) bailoutHint(reason); + }; + const bailoutHint = reason => { + this.moduleGraph + .getOptimizationBailout(parser.state.module) + .push(`CommonJS bailout: ${reason}`); + }; -const RequireEnsureDependenciesBlock = __webpack_require__(27153); -const RequireEnsureDependency = __webpack_require__(27223); -const RequireEnsureItemDependency = __webpack_require__(50329); -const getFunctionExpression = __webpack_require__(50396); + // metadata // + parser.hooks.evaluateTypeof + .for("module") + .tap("CommonJsExportsParserPlugin", evaluateToString("object")); + parser.hooks.evaluateTypeof + .for("exports") + .tap("CommonJsPlugin", evaluateToString("object")); -module.exports = class RequireEnsureDependenciesBlockParserPlugin { - apply(parser) { + // exporting // + const handleAssignExport = (expr, base, members) => { + if (HarmonyExports.isEnabled(parser.state)) return; + // Handle reexporting + const requireCall = parseRequireCall(parser, expr.right); + if ( + requireCall && + requireCall.argument.isString() && + (members.length === 0 || members[0] !== "__esModule") + ) { + enableStructuredExports(); + // It's possible to reexport __esModule, so we must convert to a dynamic module + if (members.length === 0) DynamicExports.setDynamic(parser.state); + const dep = new CommonJsExportRequireDependency( + expr.range, + null, + base, + members, + requireCall.argument.string, + requireCall.ids, + !parser.isStatementLevelExpression(expr) + ); + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.module.addDependency(dep); + return true; + } + if (members.length === 0) return; + enableStructuredExports(); + const remainingMembers = members; + checkNamespace( + parser.statementPath.length === 1 && + parser.isStatementLevelExpression(expr), + remainingMembers, + expr.right + ); + const dep = new CommonJsExportsDependency( + expr.left.range, + null, + base, + remainingMembers + ); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + parser.walkExpression(expr.right); + return true; + }; + parser.hooks.assignMemberChain + .for("exports") + .tap("CommonJsExportsParserPlugin", (expr, members) => { + return handleAssignExport(expr, "exports", members); + }); + parser.hooks.assignMemberChain + .for("this") + .tap("CommonJsExportsParserPlugin", (expr, members) => { + if (!parser.scope.topLevelScope) return; + return handleAssignExport(expr, "this", members); + }); + parser.hooks.assignMemberChain + .for("module") + .tap("CommonJsExportsParserPlugin", (expr, members) => { + if (members[0] !== "exports") return; + return handleAssignExport(expr, "module.exports", members.slice(1)); + }); parser.hooks.call - .for("require.ensure") - .tap("RequireEnsureDependenciesBlockParserPlugin", expr => { - let chunkName = null; - let errorExpressionArg = null; - let errorExpression = null; - switch (expr.arguments.length) { - case 4: { - const chunkNameExpr = parser.evaluateExpression(expr.arguments[3]); - if (!chunkNameExpr.isString()) return; - chunkName = chunkNameExpr.string; - } - // falls through - case 3: { - errorExpressionArg = expr.arguments[2]; - errorExpression = getFunctionExpression(errorExpressionArg); - - if (!errorExpression && !chunkName) { - const chunkNameExpr = parser.evaluateExpression( - expr.arguments[2] - ); - if (!chunkNameExpr.isString()) return; - chunkName = chunkNameExpr.string; - } - } - // falls through - case 2: { - const dependenciesExpr = parser.evaluateExpression( - expr.arguments[0] - ); - const dependenciesItems = dependenciesExpr.isArray() - ? dependenciesExpr.items - : [dependenciesExpr]; - const successExpressionArg = expr.arguments[1]; - const successExpression = - getFunctionExpression(successExpressionArg); + .for("Object.defineProperty") + .tap("CommonJsExportsParserPlugin", expression => { + const expr = /** @type {import("estree").CallExpression} */ ( + expression + ); + if (!parser.isStatementLevelExpression(expr)) return; + if (expr.arguments.length !== 3) return; + if (expr.arguments[0].type === "SpreadElement") return; + if (expr.arguments[1].type === "SpreadElement") return; + if (expr.arguments[2].type === "SpreadElement") return; + const exportsArg = parser.evaluateExpression(expr.arguments[0]); + if (!exportsArg || !exportsArg.isIdentifier()) return; + if ( + exportsArg.identifier !== "exports" && + exportsArg.identifier !== "module.exports" && + (exportsArg.identifier !== "this" || !parser.scope.topLevelScope) + ) { + return; + } + const propertyArg = parser.evaluateExpression(expr.arguments[1]); + if (!propertyArg) return; + const property = propertyArg.asString(); + if (typeof property !== "string") return; + enableStructuredExports(); + const descArg = expr.arguments[2]; + checkNamespace( + parser.statementPath.length === 1, + [property], + getValueOfPropertyDescription(descArg) + ); + const dep = new CommonJsExportsDependency( + expr.range, + expr.arguments[2].range, + `Object.defineProperty(${exportsArg.identifier})`, + [property] + ); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); - if (successExpression) { - parser.walkExpressions(successExpression.expressions); - } - if (errorExpression) { - parser.walkExpressions(errorExpression.expressions); - } + parser.walkExpression(expr.arguments[2]); + return true; + }); - const depBlock = new RequireEnsureDependenciesBlock( - chunkName, - expr.loc - ); - const errorCallbackExists = - expr.arguments.length === 4 || - (!chunkName && expr.arguments.length === 3); - const dep = new RequireEnsureDependency( - expr.range, - expr.arguments[1].range, - errorCallbackExists && expr.arguments[2].range - ); - dep.loc = expr.loc; - depBlock.addDependency(dep); - const old = parser.state.current; - parser.state.current = depBlock; - try { - let failed = false; - parser.inScope([], () => { - for (const ee of dependenciesItems) { - if (ee.isString()) { - const ensureDependency = new RequireEnsureItemDependency( - ee.string - ); - ensureDependency.loc = ee.loc || expr.loc; - depBlock.addDependency(ensureDependency); - } else { - failed = true; - } - } - }); - if (failed) { - return; - } - if (successExpression) { - if (successExpression.fn.body.type === "BlockStatement") { - parser.walkStatement(successExpression.fn.body); - } else { - parser.walkExpression(successExpression.fn.body); - } - } - old.addBlock(depBlock); - } finally { - parser.state.current = old; - } - if (!successExpression) { - parser.walkExpression(successExpressionArg); - } - if (errorExpression) { - if (errorExpression.fn.body.type === "BlockStatement") { - parser.walkStatement(errorExpression.fn.body); - } else { - parser.walkExpression(errorExpression.fn.body); - } - } else if (errorExpressionArg) { - parser.walkExpression(errorExpressionArg); - } - return true; - } - } + // Self reference // + const handleAccessExport = (expr, base, members, call = undefined) => { + if (HarmonyExports.isEnabled(parser.state)) return; + if (members.length === 0) { + bailout(`${base} is used directly at ${formatLocation(expr.loc)}`); + } + if (call && members.length === 1) { + bailoutHint( + `${base}${propertyAccess( + members + )}(...) prevents optimization as ${base} is passed as call context at ${formatLocation( + expr.loc + )}` + ); + } + const dep = new CommonJsSelfReferenceDependency( + expr.range, + base, + members, + !!call + ); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + if (call) { + parser.walkExpressions(call.arguments); + } + return true; + }; + parser.hooks.callMemberChain + .for("exports") + .tap("CommonJsExportsParserPlugin", (expr, members) => { + return handleAccessExport(expr.callee, "exports", members, expr); + }); + parser.hooks.expressionMemberChain + .for("exports") + .tap("CommonJsExportsParserPlugin", (expr, members) => { + return handleAccessExport(expr, "exports", members); + }); + parser.hooks.expression + .for("exports") + .tap("CommonJsExportsParserPlugin", expr => { + return handleAccessExport(expr, "exports", []); + }); + parser.hooks.callMemberChain + .for("module") + .tap("CommonJsExportsParserPlugin", (expr, members) => { + if (members[0] !== "exports") return; + return handleAccessExport( + expr.callee, + "module.exports", + members.slice(1), + expr + ); + }); + parser.hooks.expressionMemberChain + .for("module") + .tap("CommonJsExportsParserPlugin", (expr, members) => { + if (members[0] !== "exports") return; + return handleAccessExport(expr, "module.exports", members.slice(1)); + }); + parser.hooks.expression + .for("module.exports") + .tap("CommonJsExportsParserPlugin", expr => { + return handleAccessExport(expr, "module.exports", []); + }); + parser.hooks.callMemberChain + .for("this") + .tap("CommonJsExportsParserPlugin", (expr, members) => { + if (!parser.scope.topLevelScope) return; + return handleAccessExport(expr.callee, "this", members, expr); }); + parser.hooks.expressionMemberChain + .for("this") + .tap("CommonJsExportsParserPlugin", (expr, members) => { + if (!parser.scope.topLevelScope) return; + return handleAccessExport(expr, "this", members); + }); + parser.hooks.expression + .for("this") + .tap("CommonJsExportsParserPlugin", expr => { + if (!parser.scope.topLevelScope) return; + return handleAccessExport(expr, "this", []); + }); + + // Bailouts // + parser.hooks.expression.for("module").tap("CommonJsPlugin", expr => { + bailout(); + const isHarmony = HarmonyExports.isEnabled(parser.state); + const dep = new ModuleDecoratorDependency( + isHarmony + ? RuntimeGlobals.harmonyModuleDecorator + : RuntimeGlobals.nodeModuleDecorator, + !isHarmony + ); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + return true; + }); } -}; +} +module.exports = CommonJsExportsParserPlugin; /***/ }), -/***/ 27223: +/***/ 59440: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -82763,56 +80659,79 @@ module.exports = class RequireEnsureDependenciesBlockParserPlugin { -const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const { equals } = __webpack_require__(84953); const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); +const propertyAccess = __webpack_require__(54190); +const ModuleDependency = __webpack_require__(80321); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../AsyncDependenciesBlock")} AsyncDependenciesBlock */ /** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -class RequireEnsureDependency extends NullDependency { - constructor(range, contentRange, errorHandlerRange) { - super(); - +class CommonJsFullRequireDependency extends ModuleDependency { + /** + * @param {string} request the request string + * @param {[number, number]} range location in source code + * @param {string[]} names accessed properties on module + */ + constructor(request, range, names) { + super(request); this.range = range; - this.contentRange = contentRange; - this.errorHandlerRange = errorHandlerRange; + this.names = names; + this.call = false; + this.asiSafe = undefined; } - get type() { - return "require.ensure"; + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + if (this.call) { + const importedModule = moduleGraph.getModule(this); + if ( + !importedModule || + importedModule.getExportsType(moduleGraph, false) !== "namespace" + ) { + return [this.names.slice(0, -1)]; + } + } + return [this.names]; } serialize(context) { const { write } = context; - - write(this.range); - write(this.contentRange); - write(this.errorHandlerRange); - + write(this.names); + write(this.call); + write(this.asiSafe); super.serialize(context); } deserialize(context) { const { read } = context; + this.names = read(); + this.call = read(); + this.asiSafe = read(); + super.deserialize(context); + } - this.range = read(); - this.contentRange = read(); - this.errorHandlerRange = read(); + get type() { + return "cjs full require"; + } - super.deserialize(context); + get category() { + return "commonjs"; } } -makeSerializable( - RequireEnsureDependency, - "webpack/lib/dependencies/RequireEnsureDependency" -); - -RequireEnsureDependency.Template = class RequireEnsureDependencyTemplate extends ( - NullDependency.Template +CommonJsFullRequireDependency.Template = class CommonJsFullRequireDependencyTemplate extends ( + ModuleDependency.Template ) { /** * @param {Dependency} dependency the dependency for which the template should be applied @@ -82823,45 +80742,57 @@ RequireEnsureDependency.Template = class RequireEnsureDependencyTemplate extends apply( dependency, source, - { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } + { + module, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtimeRequirements, + runtime, + initFragments + } ) { - const dep = /** @type {RequireEnsureDependency} */ (dependency); - const depBlock = /** @type {AsyncDependenciesBlock} */ ( - moduleGraph.getParentBlock(dep) - ); - const promise = runtimeTemplate.blockPromise({ + const dep = /** @type {CommonJsFullRequireDependency} */ (dependency); + if (!dep.range) return; + const importedModule = moduleGraph.getModule(dep); + let requireExpr = runtimeTemplate.moduleExports({ + module: importedModule, chunkGraph, - block: depBlock, - message: "require.ensure", + request: dep.request, + weak: dep.weak, runtimeRequirements }); - const range = dep.range; - const contentRange = dep.contentRange; - const errorHandlerRange = dep.errorHandlerRange; - source.replace(range[0], contentRange[0] - 1, `${promise}.then((`); - if (errorHandlerRange) { - source.replace( - contentRange[1], - errorHandlerRange[0] - 1, - ").bind(null, __webpack_require__))['catch'](" - ); - source.replace(errorHandlerRange[1], range[1] - 1, ")"); - } else { - source.replace( - contentRange[1], - range[1] - 1, - `).bind(null, __webpack_require__))['catch'](${RuntimeGlobals.uncaughtErrorHandler})` - ); + if (importedModule) { + const ids = dep.names; + const usedImported = moduleGraph + .getExportsInfo(importedModule) + .getUsedName(ids, runtime); + if (usedImported) { + const comment = equals(usedImported, ids) + ? "" + : Template.toNormalComment(propertyAccess(ids)) + " "; + const access = `${comment}${propertyAccess(usedImported)}`; + requireExpr = + dep.asiSafe === true + ? `(${requireExpr}${access})` + : `${requireExpr}${access}`; + } } + source.replace(dep.range[0], dep.range[1] - 1, requireExpr); } }; -module.exports = RequireEnsureDependency; +makeSerializable( + CommonJsFullRequireDependency, + "webpack/lib/dependencies/CommonJsFullRequireDependency" +); + +module.exports = CommonJsFullRequireDependency; /***/ }), -/***/ 50329: +/***/ 36013: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -82872,37 +80803,392 @@ module.exports = RequireEnsureDependency; -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); -const NullDependency = __webpack_require__(31830); +const CommentCompilationWarning = __webpack_require__(98427); +const RuntimeGlobals = __webpack_require__(16475); +const UnsupportedFeatureWarning = __webpack_require__(42495); +const { + evaluateToIdentifier, + evaluateToString, + expressionIsUnsupported, + toConstantDependency +} = __webpack_require__(93998); +const CommonJsFullRequireDependency = __webpack_require__(59440); +const CommonJsRequireContextDependency = __webpack_require__(23962); +const CommonJsRequireDependency = __webpack_require__(21264); +const ConstDependency = __webpack_require__(76911); +const ContextDependencyHelpers = __webpack_require__(99630); +const LocalModuleDependency = __webpack_require__(52805); +const { getLocalModule } = __webpack_require__(75827); +const RequireHeaderDependency = __webpack_require__(89183); +const RequireResolveContextDependency = __webpack_require__(55627); +const RequireResolveDependency = __webpack_require__(68582); +const RequireResolveHeaderDependency = __webpack_require__(9880); -class RequireEnsureItemDependency extends ModuleDependency { - constructor(request) { - super(request); - } +/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ - get type() { - return "require.ensure item"; +class CommonJsImportsParserPlugin { + /** + * @param {JavascriptParserOptions} options parser options + */ + constructor(options) { + this.options = options; } - get category() { - return "commonjs"; + apply(parser) { + const options = this.options; + + // metadata // + const tapRequireExpression = (expression, getMembers) => { + parser.hooks.typeof + .for(expression) + .tap( + "CommonJsPlugin", + toConstantDependency(parser, JSON.stringify("function")) + ); + parser.hooks.evaluateTypeof + .for(expression) + .tap("CommonJsPlugin", evaluateToString("function")); + parser.hooks.evaluateIdentifier + .for(expression) + .tap( + "CommonJsPlugin", + evaluateToIdentifier(expression, "require", getMembers, true) + ); + }; + tapRequireExpression("require", () => []); + tapRequireExpression("require.resolve", () => ["resolve"]); + tapRequireExpression("require.resolveWeak", () => ["resolveWeak"]); + + // Weird stuff // + parser.hooks.assign.for("require").tap("CommonJsPlugin", expr => { + // to not leak to global "require", we need to define a local require here. + const dep = new ConstDependency("var require;", 0); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + + // Unsupported // + parser.hooks.expression + .for("require.main.require") + .tap( + "CommonJsPlugin", + expressionIsUnsupported( + parser, + "require.main.require is not supported by webpack." + ) + ); + parser.hooks.call + .for("require.main.require") + .tap( + "CommonJsPlugin", + expressionIsUnsupported( + parser, + "require.main.require is not supported by webpack." + ) + ); + parser.hooks.expression + .for("module.parent.require") + .tap( + "CommonJsPlugin", + expressionIsUnsupported( + parser, + "module.parent.require is not supported by webpack." + ) + ); + parser.hooks.call + .for("module.parent.require") + .tap( + "CommonJsPlugin", + expressionIsUnsupported( + parser, + "module.parent.require is not supported by webpack." + ) + ); + + // renaming // + parser.hooks.canRename.for("require").tap("CommonJsPlugin", () => true); + parser.hooks.rename.for("require").tap("CommonJsPlugin", expr => { + // To avoid "not defined" error, replace the value with undefined + const dep = new ConstDependency("undefined", expr.range); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return false; + }); + + // inspection // + parser.hooks.expression + .for("require.cache") + .tap( + "CommonJsImportsParserPlugin", + toConstantDependency(parser, RuntimeGlobals.moduleCache, [ + RuntimeGlobals.moduleCache, + RuntimeGlobals.moduleId, + RuntimeGlobals.moduleLoaded + ]) + ); + + // require as expression // + parser.hooks.expression + .for("require") + .tap("CommonJsImportsParserPlugin", expr => { + const dep = new CommonJsRequireContextDependency( + { + request: options.unknownContextRequest, + recursive: options.unknownContextRecursive, + regExp: options.unknownContextRegExp, + mode: "sync" + }, + expr.range, + undefined, + parser.scope.inShorthand + ); + dep.critical = + options.unknownContextCritical && + "require function is used in a way in which dependencies cannot be statically extracted"; + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; + }); + + // require // + const processRequireItem = (expr, param) => { + if (param.isString()) { + const dep = new CommonJsRequireDependency(param.string, param.range); + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; + } + }; + const processRequireContext = (expr, param) => { + const dep = ContextDependencyHelpers.create( + CommonJsRequireContextDependency, + expr.range, + param, + expr, + options, + { + category: "commonjs" + }, + parser + ); + if (!dep) return; + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; + }; + const createRequireHandler = callNew => expr => { + if (options.commonjsMagicComments) { + const { options: requireOptions, errors: commentErrors } = + parser.parseCommentOptions(expr.range); + + if (commentErrors) { + for (const e of commentErrors) { + const { comment } = e; + parser.state.module.addWarning( + new CommentCompilationWarning( + `Compilation error while processing magic comment(-s): /*${comment.value}*/: ${e.message}`, + comment.loc + ) + ); + } + } + if (requireOptions) { + if (requireOptions.webpackIgnore !== undefined) { + if (typeof requireOptions.webpackIgnore !== "boolean") { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackIgnore\` expected a boolean, but received: ${requireOptions.webpackIgnore}.`, + expr.loc + ) + ); + } else { + // Do not instrument `require()` if `webpackIgnore` is `true` + if (requireOptions.webpackIgnore) { + return true; + } + } + } + } + } + + if (expr.arguments.length !== 1) return; + let localModule; + const param = parser.evaluateExpression(expr.arguments[0]); + if (param.isConditional()) { + let isExpression = false; + for (const p of param.options) { + const result = processRequireItem(expr, p); + if (result === undefined) { + isExpression = true; + } + } + if (!isExpression) { + const dep = new RequireHeaderDependency(expr.callee.range); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + } + } + if ( + param.isString() && + (localModule = getLocalModule(parser.state, param.string)) + ) { + localModule.flagUsed(); + const dep = new LocalModuleDependency(localModule, expr.range, callNew); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + } else { + const result = processRequireItem(expr, param); + if (result === undefined) { + processRequireContext(expr, param); + } else { + const dep = new RequireHeaderDependency(expr.callee.range); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + } + return true; + } + }; + parser.hooks.call + .for("require") + .tap("CommonJsImportsParserPlugin", createRequireHandler(false)); + parser.hooks.new + .for("require") + .tap("CommonJsImportsParserPlugin", createRequireHandler(true)); + parser.hooks.call + .for("module.require") + .tap("CommonJsImportsParserPlugin", createRequireHandler(false)); + parser.hooks.new + .for("module.require") + .tap("CommonJsImportsParserPlugin", createRequireHandler(true)); + + // require with property access // + const chainHandler = (expr, calleeMembers, callExpr, members) => { + if (callExpr.arguments.length !== 1) return; + const param = parser.evaluateExpression(callExpr.arguments[0]); + if (param.isString() && !getLocalModule(parser.state, param.string)) { + const dep = new CommonJsFullRequireDependency( + param.string, + expr.range, + members + ); + dep.asiSafe = !parser.isAsiPosition(expr.range[0]); + dep.optional = !!parser.scope.inTry; + dep.loc = expr.loc; + parser.state.current.addDependency(dep); + return true; + } + }; + const callChainHandler = (expr, calleeMembers, callExpr, members) => { + if (callExpr.arguments.length !== 1) return; + const param = parser.evaluateExpression(callExpr.arguments[0]); + if (param.isString() && !getLocalModule(parser.state, param.string)) { + const dep = new CommonJsFullRequireDependency( + param.string, + expr.callee.range, + members + ); + dep.call = true; + dep.asiSafe = !parser.isAsiPosition(expr.range[0]); + dep.optional = !!parser.scope.inTry; + dep.loc = expr.callee.loc; + parser.state.current.addDependency(dep); + parser.walkExpressions(expr.arguments); + return true; + } + }; + parser.hooks.memberChainOfCallMemberChain + .for("require") + .tap("CommonJsImportsParserPlugin", chainHandler); + parser.hooks.memberChainOfCallMemberChain + .for("module.require") + .tap("CommonJsImportsParserPlugin", chainHandler); + parser.hooks.callMemberChainOfCallMemberChain + .for("require") + .tap("CommonJsImportsParserPlugin", callChainHandler); + parser.hooks.callMemberChainOfCallMemberChain + .for("module.require") + .tap("CommonJsImportsParserPlugin", callChainHandler); + + // require.resolve // + const processResolve = (expr, weak) => { + if (expr.arguments.length !== 1) return; + const param = parser.evaluateExpression(expr.arguments[0]); + if (param.isConditional()) { + for (const option of param.options) { + const result = processResolveItem(expr, option, weak); + if (result === undefined) { + processResolveContext(expr, option, weak); + } + } + const dep = new RequireResolveHeaderDependency(expr.callee.range); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + } else { + const result = processResolveItem(expr, param, weak); + if (result === undefined) { + processResolveContext(expr, param, weak); + } + const dep = new RequireResolveHeaderDependency(expr.callee.range); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + } + }; + const processResolveItem = (expr, param, weak) => { + if (param.isString()) { + const dep = new RequireResolveDependency(param.string, param.range); + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + dep.weak = weak; + parser.state.current.addDependency(dep); + return true; + } + }; + const processResolveContext = (expr, param, weak) => { + const dep = ContextDependencyHelpers.create( + RequireResolveContextDependency, + param.range, + param, + expr, + options, + { + category: "commonjs", + mode: weak ? "weak" : "sync" + }, + parser + ); + if (!dep) return; + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; + }; + + parser.hooks.call + .for("require.resolve") + .tap("RequireResolveDependencyParserPlugin", expr => { + return processResolve(expr, false); + }); + parser.hooks.call + .for("require.resolveWeak") + .tap("RequireResolveDependencyParserPlugin", expr => { + return processResolve(expr, true); + }); } } - -makeSerializable( - RequireEnsureItemDependency, - "webpack/lib/dependencies/RequireEnsureItemDependency" -); - -RequireEnsureItemDependency.Template = NullDependency.Template; - -module.exports = RequireEnsureItemDependency; +module.exports = CommonJsImportsParserPlugin; /***/ }), -/***/ 8434: +/***/ 32406: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -82913,352 +81199,284 @@ module.exports = RequireEnsureItemDependency; -const RequireEnsureDependency = __webpack_require__(27223); -const RequireEnsureItemDependency = __webpack_require__(50329); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const SelfModuleFactory = __webpack_require__(63560); +const Template = __webpack_require__(39722); +const CommonJsExportsDependency = __webpack_require__(45598); +const CommonJsFullRequireDependency = __webpack_require__(59440); +const CommonJsRequireContextDependency = __webpack_require__(23962); +const CommonJsRequireDependency = __webpack_require__(21264); +const CommonJsSelfReferenceDependency = __webpack_require__(52225); +const ModuleDecoratorDependency = __webpack_require__(88488); +const RequireHeaderDependency = __webpack_require__(89183); +const RequireResolveContextDependency = __webpack_require__(55627); +const RequireResolveDependency = __webpack_require__(68582); +const RequireResolveHeaderDependency = __webpack_require__(9880); +const RuntimeRequirementsDependency = __webpack_require__(24187); -const RequireEnsureDependenciesBlockParserPlugin = __webpack_require__(7235); +const CommonJsExportsParserPlugin = __webpack_require__(97107); +const CommonJsImportsParserPlugin = __webpack_require__(36013); const { - evaluateToString, + evaluateToIdentifier, toConstantDependency } = __webpack_require__(93998); +const CommonJsExportRequireDependency = __webpack_require__(62892); -class RequireEnsurePlugin { +class CommonJsPlugin { apply(compiler) { compiler.hooks.compilation.tap( - "RequireEnsurePlugin", - (compilation, { normalModuleFactory }) => { + "CommonJsPlugin", + (compilation, { contextModuleFactory, normalModuleFactory }) => { compilation.dependencyFactories.set( - RequireEnsureItemDependency, + CommonJsRequireDependency, normalModuleFactory ); compilation.dependencyTemplates.set( - RequireEnsureItemDependency, - new RequireEnsureItemDependency.Template() + CommonJsRequireDependency, + new CommonJsRequireDependency.Template() ); + compilation.dependencyFactories.set( + CommonJsFullRequireDependency, + normalModuleFactory + ); compilation.dependencyTemplates.set( - RequireEnsureDependency, - new RequireEnsureDependency.Template() + CommonJsFullRequireDependency, + new CommonJsFullRequireDependency.Template() ); - const handler = (parser, parserOptions) => { - if ( - parserOptions.requireEnsure !== undefined && - !parserOptions.requireEnsure - ) - return; - - new RequireEnsureDependenciesBlockParserPlugin().apply(parser); - parser.hooks.evaluateTypeof - .for("require.ensure") - .tap("RequireEnsurePlugin", evaluateToString("function")); - parser.hooks.typeof - .for("require.ensure") - .tap( - "RequireEnsurePlugin", - toConstantDependency(parser, JSON.stringify("function")) - ); - }; - - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("RequireEnsurePlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("RequireEnsurePlugin", handler); - } - ); - } -} -module.exports = RequireEnsurePlugin; - - -/***/ }), - -/***/ 89183: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + compilation.dependencyFactories.set( + CommonJsRequireContextDependency, + contextModuleFactory + ); + compilation.dependencyTemplates.set( + CommonJsRequireContextDependency, + new CommonJsRequireContextDependency.Template() + ); -class RequireHeaderDependency extends NullDependency { - constructor(range) { - super(); - if (!Array.isArray(range)) throw new Error("range must be valid"); - this.range = range; - } + compilation.dependencyFactories.set( + RequireResolveDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + RequireResolveDependency, + new RequireResolveDependency.Template() + ); - serialize(context) { - const { write } = context; - write(this.range); - super.serialize(context); - } + compilation.dependencyFactories.set( + RequireResolveContextDependency, + contextModuleFactory + ); + compilation.dependencyTemplates.set( + RequireResolveContextDependency, + new RequireResolveContextDependency.Template() + ); - static deserialize(context) { - const obj = new RequireHeaderDependency(context.read()); - obj.deserialize(context); - return obj; - } -} + compilation.dependencyTemplates.set( + RequireResolveHeaderDependency, + new RequireResolveHeaderDependency.Template() + ); -makeSerializable( - RequireHeaderDependency, - "webpack/lib/dependencies/RequireHeaderDependency" -); + compilation.dependencyTemplates.set( + RequireHeaderDependency, + new RequireHeaderDependency.Template() + ); -RequireHeaderDependency.Template = class RequireHeaderDependencyTemplate extends ( - NullDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, { runtimeRequirements }) { - const dep = /** @type {RequireHeaderDependency} */ (dependency); - runtimeRequirements.add(RuntimeGlobals.require); - source.replace(dep.range[0], dep.range[1] - 1, "__webpack_require__"); - } -}; + compilation.dependencyTemplates.set( + CommonJsExportsDependency, + new CommonJsExportsDependency.Template() + ); -module.exports = RequireHeaderDependency; + compilation.dependencyFactories.set( + CommonJsExportRequireDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + CommonJsExportRequireDependency, + new CommonJsExportRequireDependency.Template() + ); + const selfFactory = new SelfModuleFactory(compilation.moduleGraph); -/***/ }), + compilation.dependencyFactories.set( + CommonJsSelfReferenceDependency, + selfFactory + ); + compilation.dependencyTemplates.set( + CommonJsSelfReferenceDependency, + new CommonJsSelfReferenceDependency.Template() + ); -/***/ 71284: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + compilation.dependencyFactories.set( + ModuleDecoratorDependency, + selfFactory + ); + compilation.dependencyTemplates.set( + ModuleDecoratorDependency, + new ModuleDecoratorDependency.Template() + ); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + compilation.hooks.runtimeRequirementInModule + .for(RuntimeGlobals.harmonyModuleDecorator) + .tap("CommonJsPlugin", (module, set) => { + set.add(RuntimeGlobals.module); + set.add(RuntimeGlobals.requireScope); + }); + compilation.hooks.runtimeRequirementInModule + .for(RuntimeGlobals.nodeModuleDecorator) + .tap("CommonJsPlugin", (module, set) => { + set.add(RuntimeGlobals.module); + set.add(RuntimeGlobals.requireScope); + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.harmonyModuleDecorator) + .tap("CommonJsPlugin", (chunk, set) => { + compilation.addRuntimeModule( + chunk, + new HarmonyModuleDecoratorRuntimeModule() + ); + }); -const Dependency = __webpack_require__(54912); -const Template = __webpack_require__(1626); -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.nodeModuleDecorator) + .tap("CommonJsPlugin", (chunk, set) => { + compilation.addRuntimeModule( + chunk, + new NodeModuleDecoratorRuntimeModule() + ); + }); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + const handler = (parser, parserOptions) => { + if (parserOptions.commonjs !== undefined && !parserOptions.commonjs) + return; + parser.hooks.typeof + .for("module") + .tap( + "CommonJsPlugin", + toConstantDependency(parser, JSON.stringify("object")) + ); -class RequireIncludeDependency extends ModuleDependency { - constructor(request, range) { - super(request); + parser.hooks.expression + .for("require.main") + .tap( + "CommonJsPlugin", + toConstantDependency( + parser, + `${RuntimeGlobals.moduleCache}[${RuntimeGlobals.entryModuleId}]`, + [RuntimeGlobals.moduleCache, RuntimeGlobals.entryModuleId] + ) + ); + parser.hooks.expression + .for("module.loaded") + .tap("CommonJsPlugin", expr => { + parser.state.module.buildInfo.moduleConcatenationBailout = + "module.loaded"; + const dep = new RuntimeRequirementsDependency([ + RuntimeGlobals.moduleLoaded + ]); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); - this.range = range; - } + parser.hooks.expression + .for("module.id") + .tap("CommonJsPlugin", expr => { + parser.state.module.buildInfo.moduleConcatenationBailout = + "module.id"; + const dep = new RuntimeRequirementsDependency([ + RuntimeGlobals.moduleId + ]); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - // This doesn't use any export - return Dependency.NO_EXPORTS_REFERENCED; - } + parser.hooks.evaluateIdentifier.for("module.hot").tap( + "CommonJsPlugin", + evaluateToIdentifier("module.hot", "module", () => ["hot"], null) + ); - get type() { - return "require.include"; - } + new CommonJsImportsParserPlugin(parserOptions).apply(parser); + new CommonJsExportsParserPlugin(compilation.moduleGraph).apply( + parser + ); + }; - get category() { - return "commonjs"; + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("CommonJsPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("CommonJsPlugin", handler); + } + ); } } -makeSerializable( - RequireIncludeDependency, - "webpack/lib/dependencies/RequireIncludeDependency" -); +class HarmonyModuleDecoratorRuntimeModule extends RuntimeModule { + constructor() { + super("harmony module decorator"); + } -RequireIncludeDependency.Template = class RequireIncludeDependencyTemplate extends ( - ModuleDependency.Template -) { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} + * @returns {string} runtime code */ - apply(dependency, source, { runtimeTemplate }) { - const dep = /** @type {RequireIncludeDependency} */ (dependency); - const comment = runtimeTemplate.outputOptions.pathinfo - ? Template.toComment( - `require.include ${runtimeTemplate.requestShortener.shorten( - dep.request - )}` - ) - : ""; - - source.replace(dep.range[0], dep.range[1] - 1, `undefined${comment}`); - } -}; - -module.exports = RequireIncludeDependency; - - -/***/ }), - -/***/ 35768: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const WebpackError = __webpack_require__(53799); -const { - evaluateToString, - toConstantDependency -} = __webpack_require__(93998); -const makeSerializable = __webpack_require__(33032); -const RequireIncludeDependency = __webpack_require__(71284); - -module.exports = class RequireIncludeDependencyParserPlugin { - constructor(warn) { - this.warn = warn; - } - apply(parser) { - const { warn } = this; - parser.hooks.call - .for("require.include") - .tap("RequireIncludeDependencyParserPlugin", expr => { - if (expr.arguments.length !== 1) return; - const param = parser.evaluateExpression(expr.arguments[0]); - if (!param.isString()) return; - - if (warn) { - parser.state.module.addWarning( - new RequireIncludeDeprecationWarning(expr.loc) - ); - } - - const dep = new RequireIncludeDependency(param.string, expr.range); - dep.loc = expr.loc; - parser.state.current.addDependency(dep); - return true; - }); - parser.hooks.evaluateTypeof - .for("require.include") - .tap("RequireIncludePlugin", expr => { - if (warn) { - parser.state.module.addWarning( - new RequireIncludeDeprecationWarning(expr.loc) - ); - } - return evaluateToString("function")(expr); - }); - parser.hooks.typeof - .for("require.include") - .tap("RequireIncludePlugin", expr => { - if (warn) { - parser.state.module.addWarning( - new RequireIncludeDeprecationWarning(expr.loc) - ); - } - return toConstantDependency(parser, JSON.stringify("function"))(expr); - }); - } -}; - -class RequireIncludeDeprecationWarning extends WebpackError { - constructor(loc) { - super("require.include() is deprecated and will be removed soon."); - - this.name = "RequireIncludeDeprecationWarning"; - - this.loc = loc; + generate() { + const { runtimeTemplate } = this.compilation; + return Template.asString([ + `${ + RuntimeGlobals.harmonyModuleDecorator + } = ${runtimeTemplate.basicFunction("module", [ + "module = Object.create(module);", + "if (!module.children) module.children = [];", + "Object.defineProperty(module, 'exports', {", + Template.indent([ + "enumerable: true,", + `set: ${runtimeTemplate.basicFunction("", [ + "throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id);" + ])}` + ]), + "});", + "return module;" + ])};` + ]); } -} - -makeSerializable( - RequireIncludeDeprecationWarning, - "webpack/lib/dependencies/RequireIncludeDependencyParserPlugin", - "RequireIncludeDeprecationWarning" -); - - -/***/ }), - -/***/ 37378: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const RequireIncludeDependency = __webpack_require__(71284); -const RequireIncludeDependencyParserPlugin = __webpack_require__(35768); - -class RequireIncludePlugin { - apply(compiler) { - compiler.hooks.compilation.tap( - "RequireIncludePlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - RequireIncludeDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - RequireIncludeDependency, - new RequireIncludeDependency.Template() - ); - - const handler = (parser, parserOptions) => { - if (parserOptions.requireInclude === false) return; - const warn = parserOptions.requireInclude === undefined; +} - new RequireIncludeDependencyParserPlugin(warn).apply(parser); - }; +class NodeModuleDecoratorRuntimeModule extends RuntimeModule { + constructor() { + super("node module decorator"); + } - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("RequireIncludePlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("RequireIncludePlugin", handler); - } - ); + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeTemplate } = this.compilation; + return Template.asString([ + `${RuntimeGlobals.nodeModuleDecorator} = ${runtimeTemplate.basicFunction( + "module", + [ + "module.paths = [];", + "if (!module.children) module.children = [];", + "return module;" + ] + )};` + ]); } } -module.exports = RequireIncludePlugin; + +module.exports = CommonJsPlugin; /***/ }), -/***/ 55627: +/***/ 23962: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -83271,18 +81489,20 @@ module.exports = RequireIncludePlugin; const makeSerializable = __webpack_require__(33032); const ContextDependency = __webpack_require__(88101); -const ContextDependencyTemplateAsId = __webpack_require__(76081); +const ContextDependencyTemplateAsRequireCall = __webpack_require__(75815); -class RequireResolveContextDependency extends ContextDependency { - constructor(options, range, valueRange) { +class CommonJsRequireContextDependency extends ContextDependency { + constructor(options, range, valueRange, inShorthand) { super(options); this.range = range; this.valueRange = valueRange; + // inShorthand must be serialized by subclasses that use it + this.inShorthand = inShorthand; } get type() { - return "amd require context"; + return "cjs require context"; } serialize(context) { @@ -83290,6 +81510,7 @@ class RequireResolveContextDependency extends ContextDependency { write(this.range); write(this.valueRange); + write(this.inShorthand); super.serialize(context); } @@ -83299,24 +81520,26 @@ class RequireResolveContextDependency extends ContextDependency { this.range = read(); this.valueRange = read(); + this.inShorthand = read(); super.deserialize(context); } } makeSerializable( - RequireResolveContextDependency, - "webpack/lib/dependencies/RequireResolveContextDependency" + CommonJsRequireContextDependency, + "webpack/lib/dependencies/CommonJsRequireContextDependency" ); -RequireResolveContextDependency.Template = ContextDependencyTemplateAsId; +CommonJsRequireContextDependency.Template = + ContextDependencyTemplateAsRequireCall; -module.exports = RequireResolveContextDependency; +module.exports = CommonJsRequireContextDependency; /***/ }), -/***/ 68582: +/***/ 21264: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -83327,55 +81550,38 @@ module.exports = RequireResolveContextDependency; -const Dependency = __webpack_require__(54912); const makeSerializable = __webpack_require__(33032); const ModuleDependency = __webpack_require__(80321); -const ModuleDependencyAsId = __webpack_require__(80825); - -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +const ModuleDependencyTemplateAsId = __webpack_require__(80825); -class RequireResolveDependency extends ModuleDependency { +class CommonJsRequireDependency extends ModuleDependency { constructor(request, range) { super(request); - this.range = range; } get type() { - return "require.resolve"; + return "cjs require"; } get category() { return "commonjs"; } - - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - // This doesn't use any export - return Dependency.NO_EXPORTS_REFERENCED; - } } +CommonJsRequireDependency.Template = ModuleDependencyTemplateAsId; + makeSerializable( - RequireResolveDependency, - "webpack/lib/dependencies/RequireResolveDependency" + CommonJsRequireDependency, + "webpack/lib/dependencies/CommonJsRequireDependency" ); -RequireResolveDependency.Template = ModuleDependencyAsId; - -module.exports = RequireResolveDependency; +module.exports = CommonJsRequireDependency; /***/ }), -/***/ 9880: +/***/ 52225: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -83386,43 +81592,79 @@ module.exports = RequireResolveDependency; +const RuntimeGlobals = __webpack_require__(16475); +const { equals } = __webpack_require__(84953); const makeSerializable = __webpack_require__(33032); +const propertyAccess = __webpack_require__(54190); const NullDependency = __webpack_require__(31830); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ /** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -class RequireResolveHeaderDependency extends NullDependency { - constructor(range) { +class CommonJsSelfReferenceDependency extends NullDependency { + constructor(range, base, names, call) { super(); + this.range = range; + this.base = base; + this.names = names; + this.call = call; + } - if (!Array.isArray(range)) throw new Error("range must be valid"); + get type() { + return "cjs self exports reference"; + } - this.range = range; + get category() { + return "self"; + } + + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + return `self`; + } + + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + return [this.call ? this.names.slice(0, -1) : this.names]; } serialize(context) { const { write } = context; - write(this.range); - + write(this.base); + write(this.names); + write(this.call); super.serialize(context); } - static deserialize(context) { - const obj = new RequireResolveHeaderDependency(context.read()); - obj.deserialize(context); - return obj; + deserialize(context) { + const { read } = context; + this.range = read(); + this.base = read(); + this.names = read(); + this.call = read(); + super.deserialize(context); } } makeSerializable( - RequireResolveHeaderDependency, - "webpack/lib/dependencies/RequireResolveHeaderDependency" + CommonJsSelfReferenceDependency, + "webpack/lib/dependencies/CommonJsSelfReferenceDependency" ); -RequireResolveHeaderDependency.Template = class RequireResolveHeaderDependencyTemplate extends ( +CommonJsSelfReferenceDependency.Template = class CommonJsSelfReferenceDependencyTemplate extends ( NullDependency.Template ) { /** @@ -83431,22 +81673,64 @@ RequireResolveHeaderDependency.Template = class RequireResolveHeaderDependencyTe * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply(dependency, source, templateContext) { - const dep = /** @type {RequireResolveHeaderDependency} */ (dependency); - source.replace(dep.range[0], dep.range[1] - 1, "/*require.resolve*/"); - } + apply( + dependency, + source, + { module, moduleGraph, runtime, runtimeRequirements } + ) { + const dep = /** @type {CommonJsSelfReferenceDependency} */ (dependency); + let used; + if (dep.names.length === 0) { + used = dep.names; + } else { + used = moduleGraph.getExportsInfo(module).getUsedName(dep.names, runtime); + } + if (!used) { + throw new Error( + "Self-reference dependency has unused export name: This should not happen" + ); + } - applyAsTemplateArgument(name, dep, source) { - source.replace(dep.range[0], dep.range[1] - 1, "/*require.resolve*/"); + let base = undefined; + switch (dep.base) { + case "exports": + runtimeRequirements.add(RuntimeGlobals.exports); + base = module.exportsArgument; + break; + case "module.exports": + runtimeRequirements.add(RuntimeGlobals.module); + base = `${module.moduleArgument}.exports`; + break; + case "this": + runtimeRequirements.add(RuntimeGlobals.thisAsExports); + base = "this"; + break; + default: + throw new Error(`Unsupported base ${dep.base}`); + } + + if (base === dep.base && equals(used, dep.names)) { + // Nothing has to be changed + // We don't use a replacement for compat reasons + // for plugins that update `module._source` which they + // shouldn't do! + return; + } + + source.replace( + dep.range[0], + dep.range[1] - 1, + `${base}${propertyAccess(used)}` + ); } }; -module.exports = RequireResolveHeaderDependency; +module.exports = CommonJsSelfReferenceDependency; /***/ }), -/***/ 24187: +/***/ 76911: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -83466,15 +81750,22 @@ const NullDependency = __webpack_require__(31830); /** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ /** @typedef {import("../util/Hash")} Hash */ -class RuntimeRequirementsDependency extends NullDependency { +class ConstDependency extends NullDependency { /** - * @param {string[]} runtimeRequirements runtime requirements + * @param {string} expression the expression + * @param {number|[number, number]} range the source range + * @param {string[]=} runtimeRequirements runtime requirements */ - constructor(runtimeRequirements) { + constructor(expression, range, runtimeRequirements) { super(); - this.runtimeRequirements = new Set(runtimeRequirements); + this.expression = expression; + this.range = range; + this.runtimeRequirements = runtimeRequirements + ? new Set(runtimeRequirements) + : null; this._hashUpdate = undefined; } @@ -83486,605 +81777,692 @@ class RuntimeRequirementsDependency extends NullDependency { */ updateHash(hash, context) { if (this._hashUpdate === undefined) { - this._hashUpdate = Array.from(this.runtimeRequirements).join() + ""; + let hashUpdate = "" + this.range + "|" + this.expression; + if (this.runtimeRequirements) { + for (const item of this.runtimeRequirements) { + hashUpdate += "|"; + hashUpdate += item; + } + } + this._hashUpdate = hashUpdate; } hash.update(this._hashUpdate); } - serialize(context) { - const { write } = context; - write(this.runtimeRequirements); - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - this.runtimeRequirements = read(); - super.deserialize(context); - } -} - -makeSerializable( - RuntimeRequirementsDependency, - "webpack/lib/dependencies/RuntimeRequirementsDependency" -); - -RuntimeRequirementsDependency.Template = class RuntimeRequirementsDependencyTemplate extends ( - NullDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, { runtimeRequirements }) { - const dep = /** @type {RuntimeRequirementsDependency} */ (dependency); - for (const req of dep.runtimeRequirements) { - runtimeRequirements.add(req); - } - } -}; - -module.exports = RuntimeRequirementsDependency; - - -/***/ }), - -/***/ 91418: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); - -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency").ExportSpec} ExportSpec */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/Hash")} Hash */ - -class StaticExportsDependency extends NullDependency { - /** - * @param {string[] | true} exports export names - * @param {boolean} canMangle true, if mangling exports names is allowed - */ - constructor(exports, canMangle) { - super(); - this.exports = exports; - this.canMangle = canMangle; - } - - get type() { - return "static exports"; - } - /** - * Returns the exported names - * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this dependency connects the module to referencing modules */ - getExports(moduleGraph) { - return { - exports: this.exports, - canMangle: this.canMangle, - dependencies: undefined - }; + getModuleEvaluationSideEffectsState(moduleGraph) { + return false; } serialize(context) { const { write } = context; - write(this.exports); - write(this.canMangle); + write(this.expression); + write(this.range); + write(this.runtimeRequirements); super.serialize(context); } deserialize(context) { const { read } = context; - this.exports = read(); - this.canMangle = read(); + this.expression = read(); + this.range = read(); + this.runtimeRequirements = read(); super.deserialize(context); } } -makeSerializable( - StaticExportsDependency, - "webpack/lib/dependencies/StaticExportsDependency" -); - -module.exports = StaticExportsDependency; - - -/***/ }), - -/***/ 97981: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const WebpackError = __webpack_require__(53799); -const { - evaluateToString, - expressionIsUnsupported, - toConstantDependency -} = __webpack_require__(93998); -const makeSerializable = __webpack_require__(33032); -const ConstDependency = __webpack_require__(76911); -const SystemRuntimeModule = __webpack_require__(85439); - -/** @typedef {import("../Compiler")} Compiler */ - -class SystemPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "SystemPlugin", - (compilation, { normalModuleFactory }) => { - compilation.hooks.runtimeRequirementInModule - .for(RuntimeGlobals.system) - .tap("SystemPlugin", (module, set) => { - set.add(RuntimeGlobals.requireScope); - }); - - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.system) - .tap("SystemPlugin", (chunk, set) => { - compilation.addRuntimeModule(chunk, new SystemRuntimeModule()); - }); - - const handler = (parser, parserOptions) => { - if (parserOptions.system === undefined || !parserOptions.system) { - return; - } - - const setNotSupported = name => { - parser.hooks.evaluateTypeof - .for(name) - .tap("SystemPlugin", evaluateToString("undefined")); - parser.hooks.expression - .for(name) - .tap( - "SystemPlugin", - expressionIsUnsupported( - parser, - name + " is not supported by webpack." - ) - ); - }; - - parser.hooks.typeof - .for("System.import") - .tap( - "SystemPlugin", - toConstantDependency(parser, JSON.stringify("function")) - ); - parser.hooks.evaluateTypeof - .for("System.import") - .tap("SystemPlugin", evaluateToString("function")); - parser.hooks.typeof - .for("System") - .tap( - "SystemPlugin", - toConstantDependency(parser, JSON.stringify("object")) - ); - parser.hooks.evaluateTypeof - .for("System") - .tap("SystemPlugin", evaluateToString("object")); - - setNotSupported("System.set"); - setNotSupported("System.get"); - setNotSupported("System.register"); - - parser.hooks.expression.for("System").tap("SystemPlugin", expr => { - const dep = new ConstDependency(RuntimeGlobals.system, expr.range, [ - RuntimeGlobals.system - ]); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - - parser.hooks.call.for("System.import").tap("SystemPlugin", expr => { - parser.state.module.addWarning( - new SystemImportDeprecationWarning(expr.loc) - ); - - return parser.hooks.importCall.call({ - type: "ImportExpression", - source: expr.arguments[0], - loc: expr.loc, - range: expr.range - }); - }); - }; - - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("SystemPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("SystemPlugin", handler); - } - ); - } -} - -class SystemImportDeprecationWarning extends WebpackError { - constructor(loc) { - super( - "System.import() is deprecated and will be removed soon. Use import() instead.\n" + - "For more info visit https://webpack.js.org/guides/code-splitting/" - ); - - this.name = "SystemImportDeprecationWarning"; - - this.loc = loc; - } -} - -makeSerializable( - SystemImportDeprecationWarning, - "webpack/lib/dependencies/SystemPlugin", - "SystemImportDeprecationWarning" -); - -module.exports = SystemPlugin; -module.exports.SystemImportDeprecationWarning = SystemImportDeprecationWarning; - - -/***/ }), - -/***/ 85439: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); - -class SystemRuntimeModule extends RuntimeModule { - constructor() { - super("system"); - } +makeSerializable(ConstDependency, "webpack/lib/dependencies/ConstDependency"); +ConstDependency.Template = class ConstDependencyTemplate extends ( + NullDependency.Template +) { /** - * @returns {string} runtime code + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - generate() { - return Template.asString([ - `${RuntimeGlobals.system} = {`, - Template.indent([ - "import: function () {", - Template.indent( - "throw new Error('System.import cannot be used indirectly');" - ), - "}" - ]), - "};" - ]); + apply(dependency, source, templateContext) { + const dep = /** @type {ConstDependency} */ (dependency); + if (dep.runtimeRequirements) { + for (const req of dep.runtimeRequirements) { + templateContext.runtimeRequirements.add(req); + } + } + if (typeof dep.range === "number") { + source.insert(dep.range, dep.expression); + return; + } + + source.replace(dep.range[0], dep.range[1] - 1, dep.expression); } -} +}; -module.exports = SystemRuntimeModule; +module.exports = ConstDependency; /***/ }), -/***/ 58612: +/***/ 88101: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ -const RuntimeGlobals = __webpack_require__(16475); -const { - getDependencyUsedByExportsCondition -} = __webpack_require__(38988); +const Dependency = __webpack_require__(54912); +const DependencyTemplate = __webpack_require__(5160); const makeSerializable = __webpack_require__(33032); const memoize = __webpack_require__(78676); -const ModuleDependency = __webpack_require__(80321); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ContextModule").ContextOptions} ContextOptions */ +/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +/** @typedef {import("../WebpackError")} WebpackError */ -const getRawDataUrlModule = memoize(() => __webpack_require__(19684)); +const getCriticalDependencyWarning = memoize(() => + __webpack_require__(15427) +); -class URLDependency extends ModuleDependency { +/** @typedef {ContextOptions & { request: string }} ContextDependencyOptions */ + +const regExpToString = r => (r ? r + "" : ""); + +class ContextDependency extends Dependency { /** - * @param {string} request request - * @param {[number, number]} range range of the arguments of new URL( |> ... <| ) - * @param {[number, number]} outerRange range of the full |> new URL(...) <| - * @param {boolean=} relative use relative urls instead of absolute with base uri + * @param {ContextDependencyOptions} options options for the context module */ - constructor(request, range, outerRange, relative) { - super(request); - this.range = range; - this.outerRange = outerRange; - this.relative = relative || false; - /** @type {Set | boolean} */ - this.usedByExports = undefined; - } + constructor(options) { + super(); - get type() { - return "new URL()"; + this.options = options; + this.userRequest = this.options && this.options.request; + /** @type {false | string} */ + this.critical = false; + this.hadGlobalOrStickyRegExp = false; + + if ( + this.options && + (this.options.regExp.global || this.options.regExp.sticky) + ) { + this.options = { ...this.options, regExp: null }; + this.hadGlobalOrStickyRegExp = true; + } + + this.request = undefined; + this.range = undefined; + this.valueRange = undefined; + this.inShorthand = undefined; + // TODO refactor this + this.replaces = undefined; } get category() { - return "url"; + return "commonjs"; } /** - * @param {ModuleGraph} moduleGraph module graph - * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module */ - getCondition(moduleGraph) { - return getDependencyUsedByExportsCondition( - this, - this.usedByExports, - moduleGraph + couldAffectReferencingModule() { + return true; + } + + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + return ( + `context${this.options.request} ${this.options.recursive} ` + + `${regExpToString(this.options.regExp)} ${regExpToString( + this.options.include + )} ${regExpToString(this.options.exclude)} ` + + `${this.options.mode} ${this.options.chunkName} ` + + `${JSON.stringify(this.options.groupOptions)}` ); } /** - * @param {string} context context directory - * @returns {Module} a module + * Returns warnings + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[]} warnings */ - createIgnoredModule(context) { - const RawDataUrlModule = getRawDataUrlModule(); - return new RawDataUrlModule("data:,", `ignored-asset`, `(ignored asset)`); + getWarnings(moduleGraph) { + let warnings = super.getWarnings(moduleGraph); + + if (this.critical) { + if (!warnings) warnings = []; + const CriticalDependencyWarning = getCriticalDependencyWarning(); + warnings.push(new CriticalDependencyWarning(this.critical)); + } + + if (this.hadGlobalOrStickyRegExp) { + if (!warnings) warnings = []; + const CriticalDependencyWarning = getCriticalDependencyWarning(); + warnings.push( + new CriticalDependencyWarning( + "Contexts can't use RegExps with the 'g' or 'y' flags." + ) + ); + } + + return warnings; } serialize(context) { const { write } = context; - write(this.outerRange); - write(this.relative); - write(this.usedByExports); + + write(this.options); + write(this.userRequest); + write(this.critical); + write(this.hadGlobalOrStickyRegExp); + write(this.request); + write(this.range); + write(this.valueRange); + write(this.prepend); + write(this.replaces); + super.serialize(context); } deserialize(context) { const { read } = context; - this.outerRange = read(); - this.relative = read(); - this.usedByExports = read(); + + this.options = read(); + this.userRequest = read(); + this.critical = read(); + this.hadGlobalOrStickyRegExp = read(); + this.request = read(); + this.range = read(); + this.valueRange = read(); + this.prepend = read(); + this.replaces = read(); + super.deserialize(context); } } -URLDependency.Template = class URLDependencyTemplate extends ( - ModuleDependency.Template -) { +makeSerializable( + ContextDependency, + "webpack/lib/dependencies/ContextDependency" +); + +ContextDependency.Template = DependencyTemplate; + +module.exports = ContextDependency; + + +/***/ }), + +/***/ 99630: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { parseResource } = __webpack_require__(82186); + +/** @typedef {import("estree").Node} EsTreeNode */ +/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ +/** @typedef {import("../../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */ +/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */ +/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ +/** @typedef {import("./ContextDependency")} ContextDependency */ +/** @typedef {import("./ContextDependency").ContextDependencyOptions} ContextDependencyOptions */ + +/** + * Escapes regular expression metacharacters + * @param {string} str String to quote + * @returns {string} Escaped string + */ +const quoteMeta = str => { + return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); +}; + +const splitContextFromPrefix = prefix => { + const idx = prefix.lastIndexOf("/"); + let context = "."; + if (idx >= 0) { + context = prefix.substr(0, idx); + prefix = `.${prefix.substr(idx)}`; + } + return { + context, + prefix + }; +}; + +/** @typedef {Partial>} PartialContextDependencyOptions */ + +/** @typedef {{ new(options: ContextDependencyOptions, range: [number, number], valueRange: [number, number]): ContextDependency }} ContextDependencyConstructor */ + +/** + * @param {ContextDependencyConstructor} Dep the Dependency class + * @param {[number, number]} range source range + * @param {BasicEvaluatedExpression} param context param + * @param {EsTreeNode} expr expr + * @param {Pick} options options for context creation + * @param {PartialContextDependencyOptions} contextOptions options for the ContextModule + * @param {JavascriptParser} parser the parser + * @returns {ContextDependency} the created Dependency + */ +exports.create = (Dep, range, param, expr, options, contextOptions, parser) => { + if (param.isTemplateString()) { + let prefixRaw = param.quasis[0].string; + let postfixRaw = + param.quasis.length > 1 + ? param.quasis[param.quasis.length - 1].string + : ""; + + const valueRange = param.range; + const { context, prefix } = splitContextFromPrefix(prefixRaw); + const { + path: postfix, + query, + fragment + } = parseResource(postfixRaw, parser); + + // When there are more than two quasis, the generated RegExp can be more precise + // We join the quasis with the expression regexp + const innerQuasis = param.quasis.slice(1, param.quasis.length - 1); + const innerRegExp = + options.wrappedContextRegExp.source + + innerQuasis + .map(q => quoteMeta(q.string) + options.wrappedContextRegExp.source) + .join(""); + + // Example: `./context/pre${e}inner${e}inner2${e}post?query#frag` + // context: "./context" + // prefix: "./pre" + // innerQuasis: [BEE("inner"), BEE("inner2")] + // (BEE = BasicEvaluatedExpression) + // postfix: "post" + // query: "?query" + // fragment: "#frag" + // regExp: /^\.\/pre.*inner.*inner2.*post$/ + const regExp = new RegExp( + `^${quoteMeta(prefix)}${innerRegExp}${quoteMeta(postfix)}$` + ); + const dep = new Dep( + { + request: context + query + fragment, + recursive: options.wrappedContextRecursive, + regExp, + mode: "sync", + ...contextOptions + }, + range, + valueRange + ); + dep.loc = expr.loc; + const replaces = []; + + param.parts.forEach((part, i) => { + if (i % 2 === 0) { + // Quasis or merged quasi + let range = part.range; + let value = part.string; + if (param.templateStringKind === "cooked") { + value = JSON.stringify(value); + value = value.slice(1, value.length - 1); + } + if (i === 0) { + // prefix + value = prefix; + range = [param.range[0], part.range[1]]; + value = + (param.templateStringKind === "cooked" ? "`" : "String.raw`") + + value; + } else if (i === param.parts.length - 1) { + // postfix + value = postfix; + range = [part.range[0], param.range[1]]; + value = value + "`"; + } else if ( + part.expression && + part.expression.type === "TemplateElement" && + part.expression.value.raw === value + ) { + // Shortcut when it's a single quasi and doesn't need to be replaced + return; + } + replaces.push({ + range, + value + }); + } else { + // Expression + parser.walkExpression(part.expression); + } + }); + + dep.replaces = replaces; + dep.critical = + options.wrappedContextCritical && + "a part of the request of a dependency is an expression"; + return dep; + } else if ( + param.isWrapped() && + ((param.prefix && param.prefix.isString()) || + (param.postfix && param.postfix.isString())) + ) { + let prefixRaw = + param.prefix && param.prefix.isString() ? param.prefix.string : ""; + let postfixRaw = + param.postfix && param.postfix.isString() ? param.postfix.string : ""; + const prefixRange = + param.prefix && param.prefix.isString() ? param.prefix.range : null; + const postfixRange = + param.postfix && param.postfix.isString() ? param.postfix.range : null; + const valueRange = param.range; + const { context, prefix } = splitContextFromPrefix(prefixRaw); + const { + path: postfix, + query, + fragment + } = parseResource(postfixRaw, parser); + const regExp = new RegExp( + `^${quoteMeta(prefix)}${options.wrappedContextRegExp.source}${quoteMeta( + postfix + )}$` + ); + const dep = new Dep( + { + request: context + query + fragment, + recursive: options.wrappedContextRecursive, + regExp, + mode: "sync", + ...contextOptions + }, + range, + valueRange + ); + dep.loc = expr.loc; + const replaces = []; + if (prefixRange) { + replaces.push({ + range: prefixRange, + value: JSON.stringify(prefix) + }); + } + if (postfixRange) { + replaces.push({ + range: postfixRange, + value: JSON.stringify(postfix) + }); + } + dep.replaces = replaces; + dep.critical = + options.wrappedContextCritical && + "a part of the request of a dependency is an expression"; + + if (parser && param.wrappedInnerExpressions) { + for (const part of param.wrappedInnerExpressions) { + if (part.expression) parser.walkExpression(part.expression); + } + } + + return dep; + } else { + const dep = new Dep( + { + request: options.exprContextRequest, + recursive: options.exprContextRecursive, + regExp: /** @type {RegExp} */ (options.exprContextRegExp), + mode: "sync", + ...contextOptions + }, + range, + param.range + ); + dep.loc = expr.loc; + dep.critical = + options.exprContextCritical && + "the request of a dependency is an expression"; + + parser.walkExpression(param.expression); + + return dep; + } +}; + + +/***/ }), + +/***/ 76081: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ContextDependency = __webpack_require__(88101); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + +class ContextDependencyTemplateAsId extends ContextDependency.Template { /** * @param {Dependency} dependency the dependency for which the template should be applied * @param {ReplaceSource} source the current replace source which can be modified * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply(dependency, source, templateContext) { - const { + apply( + dependency, + source, + { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } + ) { + const dep = /** @type {ContextDependency} */ (dependency); + const moduleExports = runtimeTemplate.moduleExports({ + module: moduleGraph.getModule(dep), chunkGraph, - moduleGraph, - runtimeRequirements, - runtimeTemplate, - runtime - } = templateContext; - const dep = /** @type {URLDependency} */ (dependency); - const connection = moduleGraph.getConnection(dep); - // Skip rendering depending when dependency is conditional - if (connection && !connection.isTargetActive(runtime)) { - source.replace( - dep.outerRange[0], - dep.outerRange[1] - 1, - "/* unused asset import */ undefined" - ); - return; - } - - runtimeRequirements.add(RuntimeGlobals.require); + request: dep.request, + weak: dep.weak, + runtimeRequirements + }); - if (dep.relative) { - runtimeRequirements.add(RuntimeGlobals.relativeUrl); - source.replace( - dep.outerRange[0], - dep.outerRange[1] - 1, - `/* asset import */ new ${ - RuntimeGlobals.relativeUrl - }(${runtimeTemplate.moduleRaw({ - chunkGraph, - module: moduleGraph.getModule(dep), - request: dep.request, - runtimeRequirements, - weak: false - })})` - ); + if (moduleGraph.getModule(dep)) { + if (dep.valueRange) { + if (Array.isArray(dep.replaces)) { + for (let i = 0; i < dep.replaces.length; i++) { + const rep = dep.replaces[i]; + source.replace(rep.range[0], rep.range[1] - 1, rep.value); + } + } + source.replace(dep.valueRange[1], dep.range[1] - 1, ")"); + source.replace( + dep.range[0], + dep.valueRange[0] - 1, + `${moduleExports}.resolve(` + ); + } else { + source.replace( + dep.range[0], + dep.range[1] - 1, + `${moduleExports}.resolve` + ); + } } else { - runtimeRequirements.add(RuntimeGlobals.baseURI); - - source.replace( - dep.range[0], - dep.range[1] - 1, - `/* asset import */ ${runtimeTemplate.moduleRaw({ - chunkGraph, - module: moduleGraph.getModule(dep), - request: dep.request, - runtimeRequirements, - weak: false - })}, ${RuntimeGlobals.baseURI}` - ); + source.replace(dep.range[0], dep.range[1] - 1, moduleExports); } } -}; - -makeSerializable(URLDependency, "webpack/lib/dependencies/URLDependency"); - -module.exports = URLDependency; +} +module.exports = ContextDependencyTemplateAsId; /***/ }), -/***/ 14412: +/***/ 75815: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ -const { approve } = __webpack_require__(93998); -const InnerGraph = __webpack_require__(38988); -const URLDependency = __webpack_require__(58612); +const ContextDependency = __webpack_require__(88101); -/** @typedef {import("estree").NewExpression} NewExpressionNode */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -class URLPlugin { +class ContextDependencyTemplateAsRequireCall extends ContextDependency.Template { /** - * @param {Compiler} compiler compiler + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap( - "URLPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set(URLDependency, normalModuleFactory); - compilation.dependencyTemplates.set( - URLDependency, - new URLDependency.Template() + apply( + dependency, + source, + { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } + ) { + const dep = /** @type {ContextDependency} */ (dependency); + let moduleExports = runtimeTemplate.moduleExports({ + module: moduleGraph.getModule(dep), + chunkGraph, + request: dep.request, + runtimeRequirements + }); + + if (dep.inShorthand) { + moduleExports = `${dep.inShorthand}: ${moduleExports}`; + } + if (moduleGraph.getModule(dep)) { + if (dep.valueRange) { + if (Array.isArray(dep.replaces)) { + for (let i = 0; i < dep.replaces.length; i++) { + const rep = dep.replaces[i]; + source.replace(rep.range[0], rep.range[1] - 1, rep.value); + } + } + source.replace(dep.valueRange[1], dep.range[1] - 1, ")"); + source.replace( + dep.range[0], + dep.valueRange[0] - 1, + `${moduleExports}(` ); + } else { + source.replace(dep.range[0], dep.range[1] - 1, moduleExports); + } + } else { + source.replace(dep.range[0], dep.range[1] - 1, moduleExports); + } + } +} +module.exports = ContextDependencyTemplateAsRequireCall; - /** - * @param {JavascriptParser} parser parser - * @param {object} parserOptions options - */ - const parserCallback = (parser, parserOptions) => { - if (parserOptions.url === false) return; - const relative = parserOptions.url === "relative"; - /** - * @param {NewExpressionNode} expr expression - * @returns {undefined | string} request - */ - const getUrlRequest = expr => { - if (expr.arguments.length !== 2) return; +/***/ }), - const [arg1, arg2] = expr.arguments; +/***/ 58477: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if ( - arg2.type !== "MemberExpression" || - arg1.type === "SpreadElement" - ) - return; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - const chain = parser.extractMemberExpressionChain(arg2); - if ( - chain.members.length !== 1 || - chain.object.type !== "MetaProperty" || - chain.object.meta.name !== "import" || - chain.object.property.name !== "meta" || - chain.members[0] !== "url" - ) - return; - const request = parser.evaluateExpression(arg1).asString(); +const Dependency = __webpack_require__(54912); +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); - return request; - }; +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - parser.hooks.canRename.for("URL").tap("URLPlugin", approve); - parser.hooks.new.for("URL").tap("URLPlugin", _expr => { - const expr = /** @type {NewExpressionNode} */ (_expr); +class ContextElementDependency extends ModuleDependency { + constructor(request, userRequest, typePrefix, category, referencedExports) { + super(request); + this.referencedExports = referencedExports; + this._typePrefix = typePrefix; + this._category = category; - const request = getUrlRequest(expr); + if (userRequest) { + this.userRequest = userRequest; + } + } - if (!request) return; + get type() { + if (this._typePrefix) { + return `${this._typePrefix} context element`; + } - const [arg1, arg2] = expr.arguments; - const dep = new URLDependency( - request, - [arg1.range[0], arg2.range[1]], - expr.range, - relative - ); - dep.loc = expr.loc; - parser.state.current.addDependency(dep); - InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); - return true; - }); - parser.hooks.isPure.for("NewExpression").tap("URLPlugin", _expr => { - const expr = /** @type {NewExpressionNode} */ (_expr); - const { callee } = expr; - if (callee.type !== "Identifier") return; - const calleeInfo = parser.getFreeInfoFromVariable(callee.name); - if (!calleeInfo || calleeInfo.name !== "URL") return; + return "context element"; + } - const request = getUrlRequest(expr); + get category() { + return this._category; + } - if (request) return true; - }); - }; + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + return this.referencedExports + ? this.referencedExports.map(e => ({ + name: e, + canMangle: false + })) + : Dependency.EXPORTS_OBJECT_REFERENCED; + } - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("URLPlugin", parserCallback); + serialize(context) { + const { write } = context; + write(this._typePrefix); + write(this._category); + write(this.referencedExports); + super.serialize(context); + } - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("URLPlugin", parserCallback); - } - ); + deserialize(context) { + const { read } = context; + this._typePrefix = read(); + this._category = read(); + this.referencedExports = read(); + super.deserialize(context); } } -module.exports = URLPlugin; +makeSerializable( + ContextElementDependency, + "webpack/lib/dependencies/ContextElementDependency" +); + +module.exports = ContextElementDependency; /***/ }), -/***/ 51669: +/***/ 79062: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -84095,6 +82473,7 @@ module.exports = URLPlugin; +const RuntimeGlobals = __webpack_require__(16475); const makeSerializable = __webpack_require__(33032); const NullDependency = __webpack_require__(31830); @@ -84102,39 +82481,33 @@ const NullDependency = __webpack_require__(31830); /** @typedef {import("../Dependency")} Dependency */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -class UnsupportedDependency extends NullDependency { - constructor(request, range) { +class CreateScriptUrlDependency extends NullDependency { + /** + * @param {[number, number]} range range + */ + constructor(range) { super(); - - this.request = request; this.range = range; } + get type() { + return "create script url"; + } + serialize(context) { const { write } = context; - - write(this.request); write(this.range); - super.serialize(context); } deserialize(context) { const { read } = context; - - this.request = read(); this.range = read(); - super.deserialize(context); } } -makeSerializable( - UnsupportedDependency, - "webpack/lib/dependencies/UnsupportedDependency" -); - -UnsupportedDependency.Template = class UnsupportedDependencyTemplate extends ( +CreateScriptUrlDependency.Template = class CreateScriptUrlDependencyTemplate extends ( NullDependency.Template ) { /** @@ -84143,25 +82516,27 @@ UnsupportedDependency.Template = class UnsupportedDependencyTemplate extends ( * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply(dependency, source, { runtimeTemplate }) { - const dep = /** @type {UnsupportedDependency} */ (dependency); + apply(dependency, source, { runtimeRequirements }) { + const dep = /** @type {CreateScriptUrlDependency} */ (dependency); - source.replace( - dep.range[0], - dep.range[1], - runtimeTemplate.missingModule({ - request: dep.request - }) - ); + runtimeRequirements.add(RuntimeGlobals.createScriptUrl); + + source.insert(dep.range[0], `${RuntimeGlobals.createScriptUrl}(`); + source.insert(dep.range[1], ")"); } }; -module.exports = UnsupportedDependency; +makeSerializable( + CreateScriptUrlDependency, + "webpack/lib/dependencies/CreateScriptUrlDependency" +); + +module.exports = CreateScriptUrlDependency; /***/ }), -/***/ 52204: +/***/ 15427: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -84172,191 +82547,205 @@ module.exports = UnsupportedDependency; -const Dependency = __webpack_require__(54912); +const WebpackError = __webpack_require__(53799); const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +class CriticalDependencyWarning extends WebpackError { + constructor(message) { + super(); -class WebAssemblyExportImportedDependency extends ModuleDependency { - constructor(exportName, request, name, valueType) { - super(request); - /** @type {string} */ - this.exportName = exportName; - /** @type {string} */ - this.name = name; - /** @type {string} */ - this.valueType = valueType; + this.name = "CriticalDependencyWarning"; + this.message = "Critical dependency: " + message; } +} - /** - * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module - */ - couldAffectReferencingModule() { - return Dependency.TRANSITIVE; - } +makeSerializable( + CriticalDependencyWarning, + "webpack/lib/dependencies/CriticalDependencyWarning" +); + +module.exports = CriticalDependencyWarning; + + +/***/ }), + +/***/ 76760: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ + + + +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ + +class CssExportDependency extends NullDependency { /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports + * @param {string} name name + * @param {string} value value */ - getReferencedExports(moduleGraph, runtime) { - return [[this.name]]; + constructor(name, value) { + super(); + this.name = name; + this.value = value; } get type() { - return "wasm export import"; + return "css :export"; } - get category() { - return "wasm"; + /** + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names + */ + getExports(moduleGraph) { + const name = this.name; + return { + exports: [ + { + name, + canMangle: true + } + ], + dependencies: undefined + }; } serialize(context) { const { write } = context; - - write(this.exportName); write(this.name); - write(this.valueType); - + write(this.value); super.serialize(context); } deserialize(context) { const { read } = context; - - this.exportName = read(); this.name = read(); - this.valueType = read(); - + this.value = read(); super.deserialize(context); } } +CssExportDependency.Template = class CssExportDependencyTemplate extends ( + NullDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply(dependency, source, { cssExports }) { + const dep = /** @type {CssExportDependency} */ (dependency); + cssExports.set(dep.name, dep.value); + } +}; + makeSerializable( - WebAssemblyExportImportedDependency, - "webpack/lib/dependencies/WebAssemblyExportImportedDependency" + CssExportDependency, + "webpack/lib/dependencies/CssExportDependency" ); -module.exports = WebAssemblyExportImportedDependency; +module.exports = CssExportDependency; /***/ }), -/***/ 5239: +/***/ 90542: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ const makeSerializable = __webpack_require__(33032); -const UnsupportedWebAssemblyFeatureError = __webpack_require__(78455); const ModuleDependency = __webpack_require__(80321); -/** @typedef {import("@webassemblyjs/ast").ModuleImportDescription} ModuleImportDescription */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../Module")} Module */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../util/Hash")} Hash */ /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -class WebAssemblyImportDependency extends ModuleDependency { +class CssImportDependency extends ModuleDependency { /** - * @param {string} request the request - * @param {string} name the imported name - * @param {ModuleImportDescription} description the WASM ast node - * @param {false | string} onlyDirectImport if only direct imports are allowed + * @param {string} request request + * @param {[number, number]} range range of the argument + * @param {string | undefined} supports list of supports conditions + * @param {string | undefined} media list of media conditions */ - constructor(request, name, description, onlyDirectImport) { + constructor(request, range, supports, media) { super(request); - /** @type {string} */ - this.name = name; - /** @type {ModuleImportDescription} */ - this.description = description; - /** @type {false | string} */ - this.onlyDirectImport = onlyDirectImport; + this.range = range; + this.supports = supports; + this.media = media; } get type() { - return "wasm import"; + return "css @import"; } get category() { - return "wasm"; + return "css-import"; } /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports + * @param {string} context context directory + * @returns {Module} a module */ - getReferencedExports(moduleGraph, runtime) { - return [[this.name]]; + createIgnoredModule(context) { + return null; } +} +CssImportDependency.Template = class CssImportDependencyTemplate extends ( + ModuleDependency.Template +) { /** - * Returns errors - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[]} errors + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - getErrors(moduleGraph) { - const module = moduleGraph.getModule(this); - - if ( - this.onlyDirectImport && - module && - !module.type.startsWith("webassembly") - ) { - return [ - new UnsupportedWebAssemblyFeatureError( - `Import "${this.name}" from "${this.request}" with ${this.onlyDirectImport} can only be used for direct wasm to wasm dependencies` - ) - ]; - } - } - - serialize(context) { - const { write } = context; - - write(this.name); - write(this.description); - write(this.onlyDirectImport); - - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - - this.name = read(); - this.description = read(); - this.onlyDirectImport = read(); + apply(dependency, source, templateContext) { + const dep = /** @type {CssImportDependency} */ (dependency); - super.deserialize(context); + source.replace(dep.range[0], dep.range[1] - 1, ""); } -} +}; makeSerializable( - WebAssemblyImportDependency, - "webpack/lib/dependencies/WebAssemblyImportDependency" + CssImportDependency, + "webpack/lib/dependencies/CssImportDependency" ); -module.exports = WebAssemblyImportDependency; +module.exports = CssImportDependency; /***/ }), -/***/ 26505: +/***/ 92328: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -84367,49 +82756,80 @@ module.exports = WebAssemblyImportDependency; -const Dependency = __webpack_require__(54912); -const Template = __webpack_require__(1626); const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); +const NullDependency = __webpack_require__(31830); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - -class WebpackIsIncludedDependency extends ModuleDependency { - constructor(request, range) { - super(request); - this.weak = true; +class CssLocalIdentifierDependency extends NullDependency { + /** + * @param {string} name name + * @param {[number, number]} range range + * @param {string=} prefix prefix + */ + constructor(name, range, prefix = "") { + super(); + this.name = name; this.range = range; + this.prefix = prefix; + } + + get type() { + return "css local identifier"; } /** - * Returns list of exports referenced by this dependency + * Returns the exported names * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports + * @returns {ExportsSpec | undefined} export names */ - getReferencedExports(moduleGraph, runtime) { - // This doesn't use any export - return Dependency.NO_EXPORTS_REFERENCED; + getExports(moduleGraph) { + const name = this.name; + return { + exports: [ + { + name, + canMangle: true + } + ], + dependencies: undefined + }; } - get type() { - return "__webpack_is_included__"; + serialize(context) { + const { write } = context; + write(this.name); + write(this.range); + write(this.prefix); + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + this.name = read(); + this.range = read(); + this.prefix = read(); + super.deserialize(context); } } -makeSerializable( - WebpackIsIncludedDependency, - "webpack/lib/dependencies/WebpackIsIncludedDependency" -); +const escapeCssIdentifier = (str, omitUnderscore) => { + const escaped = `${str}`.replace( + // cspell:word uffff + /[^a-zA-Z0-9_\u0081-\uffff-]/g, + s => `\\${s}` + ); + return !omitUnderscore && /^(?!--)[0-9-]/.test(escaped) + ? `_${escaped}` + : escaped; +}; -WebpackIsIncludedDependency.Template = class WebpackIsIncludedDependencyTemplate extends ( - ModuleDependency.Template +CssLocalIdentifierDependency.Template = class CssLocalIdentifierDependencyTemplate extends ( + NullDependency.Template ) { /** * @param {Dependency} dependency the dependency for which the template should be applied @@ -84417,34 +82837,42 @@ WebpackIsIncludedDependency.Template = class WebpackIsIncludedDependencyTemplate * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply(dependency, source, { runtimeTemplate, chunkGraph, moduleGraph }) { - const dep = /** @type {WebpackIsIncludedDependency} */ (dependency); - const connection = moduleGraph.getConnection(dep); - const included = connection - ? chunkGraph.getNumberOfModuleChunks(connection.module) > 0 - : false; - const comment = runtimeTemplate.outputOptions.pathinfo - ? Template.toComment( - `__webpack_is_included__ ${runtimeTemplate.requestShortener.shorten( - dep.request - )}` - ) - : ""; - + apply( + dependency, + source, + { module, moduleGraph, chunkGraph, runtime, runtimeTemplate, cssExports } + ) { + const dep = /** @type {CssLocalIdentifierDependency} */ (dependency); + const used = moduleGraph + .getExportInfo(module, dep.name) + .getUsedName(dep.name, runtime); + const moduleId = chunkGraph.getModuleId(module); + const identifier = + dep.prefix + + (runtimeTemplate.outputOptions.uniqueName + ? runtimeTemplate.outputOptions.uniqueName + "-" + : "") + + (used ? moduleId + "-" + used : "-"); source.replace( dep.range[0], dep.range[1] - 1, - `${comment}${JSON.stringify(included)}` + escapeCssIdentifier(identifier, dep.prefix) ); + if (used) cssExports.set(used, identifier); } }; -module.exports = WebpackIsIncludedDependency; +makeSerializable( + CssLocalIdentifierDependency, + "webpack/lib/dependencies/CssLocalIdentifierDependency" +); + +module.exports = CssLocalIdentifierDependency; /***/ }), -/***/ 1466: +/***/ 29094: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -84456,29 +82884,50 @@ module.exports = WebpackIsIncludedDependency; const Dependency = __webpack_require__(54912); -const RuntimeGlobals = __webpack_require__(16475); const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); +const CssLocalIdentifierDependency = __webpack_require__(92328); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../AsyncDependenciesBlock")} AsyncDependenciesBlock */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ /** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../Entrypoint")} Entrypoint */ +/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/Hash")} Hash */ /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -class WorkerDependency extends ModuleDependency { +class CssSelfLocalIdentifierDependency extends CssLocalIdentifierDependency { /** - * @param {string} request request + * @param {string} name name * @param {[number, number]} range range + * @param {string=} prefix prefix + * @param {Set=} declaredSet set of declared names (will only be active when in declared set) */ - constructor(request, range) { - super(request); - this.range = range; + constructor(name, range, prefix = "", declaredSet = undefined) { + super(name, range, prefix); + this.declaredSet = declaredSet; + } + + get type() { + return "css self local identifier"; + } + + get category() { + return "self"; + } + + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + return `self`; + } + /** + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names + */ + getExports(moduleGraph) { + if (this.declaredSet && !this.declaredSet.has(this.name)) return; + return super.getExports(moduleGraph); } /** @@ -84488,20 +82937,26 @@ class WorkerDependency extends ModuleDependency { * @returns {(string[] | ReferencedExport)[]} referenced exports */ getReferencedExports(moduleGraph, runtime) { - return Dependency.NO_EXPORTS_REFERENCED; + if (this.declaredSet && !this.declaredSet.has(this.name)) + return Dependency.NO_EXPORTS_REFERENCED; + return [[this.name]]; } - get type() { - return "new Worker()"; + serialize(context) { + const { write } = context; + write(this.declaredSet); + super.serialize(context); } - get category() { - return "worker"; + deserialize(context) { + const { read } = context; + this.declaredSet = read(); + super.deserialize(context); } } -WorkerDependency.Template = class WorkerDependencyTemplate extends ( - ModuleDependency.Template +CssSelfLocalIdentifierDependency.Template = class CssSelfLocalIdentifierDependencyTemplate extends ( + CssLocalIdentifierDependency.Template ) { /** * @param {Dependency} dependency the dependency for which the template should be applied @@ -84510,463 +82965,164 @@ WorkerDependency.Template = class WorkerDependencyTemplate extends ( * @returns {void} */ apply(dependency, source, templateContext) { - const { chunkGraph, moduleGraph, runtimeRequirements } = templateContext; - const dep = /** @type {WorkerDependency} */ (dependency); - const block = /** @type {AsyncDependenciesBlock} */ ( - moduleGraph.getParentBlock(dependency) - ); - const entrypoint = /** @type {Entrypoint} */ ( - chunkGraph.getBlockChunkGroup(block) - ); - const chunk = entrypoint.getEntrypointChunk(); - - runtimeRequirements.add(RuntimeGlobals.publicPath); - runtimeRequirements.add(RuntimeGlobals.baseURI); - runtimeRequirements.add(RuntimeGlobals.getChunkScriptFilename); - - source.replace( - dep.range[0], - dep.range[1] - 1, - `/* worker import */ ${RuntimeGlobals.publicPath} + ${ - RuntimeGlobals.getChunkScriptFilename - }(${JSON.stringify(chunk.id)}), ${RuntimeGlobals.baseURI}` - ); + const dep = /** @type {CssSelfLocalIdentifierDependency} */ (dependency); + if (dep.declaredSet && !dep.declaredSet.has(dep.name)) return; + super.apply(dependency, source, templateContext); } }; -makeSerializable(WorkerDependency, "webpack/lib/dependencies/WorkerDependency"); +makeSerializable( + CssSelfLocalIdentifierDependency, + "webpack/lib/dependencies/CssSelfLocalIdentifierDependency" +); -module.exports = WorkerDependency; +module.exports = CssSelfLocalIdentifierDependency; /***/ }), -/***/ 82509: +/***/ 70749: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ -const { pathToFileURL } = __webpack_require__(57310); -const AsyncDependenciesBlock = __webpack_require__(47736); -const CommentCompilationWarning = __webpack_require__(98427); -const UnsupportedFeatureWarning = __webpack_require__(42495); -const EnableChunkLoadingPlugin = __webpack_require__(61291); -const { equals } = __webpack_require__(84953); -const createHash = __webpack_require__(49835); -const { contextify } = __webpack_require__(82186); -const EnableWasmLoadingPlugin = __webpack_require__(78613); -const ConstDependency = __webpack_require__(76911); -const CreateScriptUrlDependency = __webpack_require__(79062); -const { - harmonySpecifierTag -} = __webpack_require__(20862); -const WorkerDependency = __webpack_require__(1466); - -/** @typedef {import("estree").Expression} Expression */ -/** @typedef {import("estree").ObjectExpression} ObjectExpression */ -/** @typedef {import("estree").Pattern} Pattern */ -/** @typedef {import("estree").Property} Property */ -/** @typedef {import("estree").SpreadElement} SpreadElement */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Entrypoint").EntryOptions} EntryOptions */ -/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */ -/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ -/** @typedef {import("./HarmonyImportDependencyParserPlugin").HarmonySettings} HarmonySettings */ - -const getUrl = module => { - return pathToFileURL(module.resource).toString(); -}; +const makeSerializable = __webpack_require__(33032); +const memoize = __webpack_require__(78676); +const ModuleDependency = __webpack_require__(80321); -const DEFAULT_SYNTAX = [ - "Worker", - "SharedWorker", - "navigator.serviceWorker.register()", - "Worker from worker_threads" -]; +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -/** @type {WeakMap} */ -const workerIndexMap = new WeakMap(); +const getRawDataUrlModule = memoize(() => __webpack_require__(19684)); -class WorkerPlugin { - constructor(chunkLoading, wasmLoading, module) { - this._chunkLoading = chunkLoading; - this._wasmLoading = wasmLoading; - this._module = module; - } +class CssUrlDependency extends ModuleDependency { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {string} request request + * @param {[number, number]} range range of the argument + * @param {string} cssFunctionKind kind of css function, e. g. url(), image() */ - apply(compiler) { - if (this._chunkLoading) { - new EnableChunkLoadingPlugin(this._chunkLoading).apply(compiler); - } - if (this._wasmLoading) { - new EnableWasmLoadingPlugin(this._wasmLoading).apply(compiler); - } - const cachedContextify = contextify.bindContextCache( - compiler.context, - compiler.root - ); - compiler.hooks.thisCompilation.tap( - "WorkerPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - WorkerDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - WorkerDependency, - new WorkerDependency.Template() - ); - compilation.dependencyTemplates.set( - CreateScriptUrlDependency, - new CreateScriptUrlDependency.Template() - ); - - /** - * @param {JavascriptParser} parser the parser - * @param {Expression} expr expression - * @returns {[BasicEvaluatedExpression, [number, number]]} parsed - */ - const parseModuleUrl = (parser, expr) => { - if ( - expr.type !== "NewExpression" || - expr.callee.type === "Super" || - expr.arguments.length !== 2 - ) - return; - const [arg1, arg2] = expr.arguments; - if (arg1.type === "SpreadElement") return; - if (arg2.type === "SpreadElement") return; - const callee = parser.evaluateExpression(expr.callee); - if (!callee.isIdentifier() || callee.identifier !== "URL") return; - const arg2Value = parser.evaluateExpression(arg2); - if ( - !arg2Value.isString() || - !arg2Value.string.startsWith("file://") || - arg2Value.string !== getUrl(parser.state.module) - ) { - return; - } - const arg1Value = parser.evaluateExpression(arg1); - return [arg1Value, [arg1.range[0], arg2.range[1]]]; - }; - - /** - * @param {JavascriptParser} parser the parser - * @param {ObjectExpression} expr expression - * @returns {{ expressions: Record, otherElements: (Property | SpreadElement)[], values: Record, spread: boolean, insertType: "comma" | "single", insertLocation: number }} parsed object - */ - const parseObjectExpression = (parser, expr) => { - /** @type {Record} */ - const values = {}; - /** @type {Record} */ - const expressions = {}; - /** @type {(Property | SpreadElement)[]} */ - const otherElements = []; - let spread = false; - for (const prop of expr.properties) { - if (prop.type === "SpreadElement") { - spread = true; - } else if ( - prop.type === "Property" && - !prop.method && - !prop.computed && - prop.key.type === "Identifier" - ) { - expressions[prop.key.name] = prop.value; - if (!prop.shorthand && !prop.value.type.endsWith("Pattern")) { - const value = parser.evaluateExpression( - /** @type {Expression} */ (prop.value) - ); - if (value.isCompileTimeValue()) - values[prop.key.name] = value.asCompileTimeValue(); - } - } else { - otherElements.push(prop); - } - } - const insertType = expr.properties.length > 0 ? "comma" : "single"; - const insertLocation = - expr.properties[expr.properties.length - 1].range[1]; - return { - expressions, - otherElements, - values, - spread, - insertType, - insertLocation - }; - }; - - /** - * @param {JavascriptParser} parser the parser - * @param {object} parserOptions options - */ - const parserPlugin = (parser, parserOptions) => { - if (parserOptions.worker === false) return; - const options = !Array.isArray(parserOptions.worker) - ? ["..."] - : parserOptions.worker; - const handleNewWorker = expr => { - if (expr.arguments.length === 0 || expr.arguments.length > 2) - return; - const [arg1, arg2] = expr.arguments; - if (arg1.type === "SpreadElement") return; - if (arg2 && arg2.type === "SpreadElement") return; - const parsedUrl = parseModuleUrl(parser, arg1); - if (!parsedUrl) return; - const [url, range] = parsedUrl; - if (!url.isString()) return; - const { - expressions, - otherElements, - values: options, - spread: hasSpreadInOptions, - insertType, - insertLocation - } = arg2 && arg2.type === "ObjectExpression" - ? parseObjectExpression(parser, arg2) - : { - expressions: {}, - otherElements: [], - values: {}, - spread: false, - insertType: arg2 ? "spread" : "argument", - insertLocation: arg2 ? arg2.range : arg1.range[1] - }; - const { options: importOptions, errors: commentErrors } = - parser.parseCommentOptions(expr.range); - - if (commentErrors) { - for (const e of commentErrors) { - const { comment } = e; - parser.state.module.addWarning( - new CommentCompilationWarning( - `Compilation error while processing magic comment(-s): /*${comment.value}*/: ${e.message}`, - comment.loc - ) - ); - } - } - - /** @type {EntryOptions} */ - let entryOptions = {}; + constructor(request, range, cssFunctionKind) { + super(request); + this.range = range; + this.cssFunctionKind = cssFunctionKind; + } - if (importOptions) { - if (importOptions.webpackIgnore !== undefined) { - if (typeof importOptions.webpackIgnore !== "boolean") { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackIgnore\` expected a boolean, but received: ${importOptions.webpackIgnore}.`, - expr.loc - ) - ); - } else { - if (importOptions.webpackIgnore) { - return false; - } - } - } - if (importOptions.webpackEntryOptions !== undefined) { - if ( - typeof importOptions.webpackEntryOptions !== "object" || - importOptions.webpackEntryOptions === null - ) { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackEntryOptions\` expected a object, but received: ${importOptions.webpackEntryOptions}.`, - expr.loc - ) - ); - } else { - Object.assign( - entryOptions, - importOptions.webpackEntryOptions - ); - } - } - if (importOptions.webpackChunkName !== undefined) { - if (typeof importOptions.webpackChunkName !== "string") { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackChunkName\` expected a string, but received: ${importOptions.webpackChunkName}.`, - expr.loc - ) - ); - } else { - entryOptions.name = importOptions.webpackChunkName; - } - } - } + get type() { + return "css url()"; + } - if ( - !Object.prototype.hasOwnProperty.call(entryOptions, "name") && - options && - typeof options.name === "string" - ) { - entryOptions.name = options.name; - } + get category() { + return "url"; + } - if (entryOptions.runtime === undefined) { - let i = workerIndexMap.get(parser.state) || 0; - workerIndexMap.set(parser.state, i + 1); - let name = `${cachedContextify( - parser.state.module.identifier() - )}|${i}`; - const hash = createHash(compilation.outputOptions.hashFunction); - hash.update(name); - const digest = /** @type {string} */ ( - hash.digest(compilation.outputOptions.hashDigest) - ); - entryOptions.runtime = digest.slice( - 0, - compilation.outputOptions.hashDigestLength - ); - } + /** + * @param {string} context context directory + * @returns {Module} a module + */ + createIgnoredModule(context) { + const RawDataUrlModule = getRawDataUrlModule(); + return new RawDataUrlModule("data:,", `ignored-asset`, `(ignored asset)`); + } - const block = new AsyncDependenciesBlock({ - name: entryOptions.name, - entryOptions: { - chunkLoading: this._chunkLoading, - wasmLoading: this._wasmLoading, - ...entryOptions - } - }); - block.loc = expr.loc; - const dep = new WorkerDependency(url.string, range); - dep.loc = expr.loc; - block.addDependency(dep); - parser.state.module.addBlock(block); + serialize(context) { + const { write } = context; + write(this.cssFunctionKind); + super.serialize(context); + } - if (compilation.outputOptions.trustedTypes) { - const dep = new CreateScriptUrlDependency( - expr.arguments[0].range - ); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - } + deserialize(context) { + const { read } = context; + this.cssFunctionKind = read(); + super.deserialize(context); + } +} - if (expressions.type) { - const expr = expressions.type; - if (options.type !== false) { - const dep = new ConstDependency( - this._module ? '"module"' : "undefined", - expr.range - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - expressions.type = undefined; - } - } else if (insertType === "comma") { - if (this._module || hasSpreadInOptions) { - const dep = new ConstDependency( - `, type: ${this._module ? '"module"' : "undefined"}`, - insertLocation - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - } - } else if (insertType === "spread") { - const dep1 = new ConstDependency( - "Object.assign({}, ", - insertLocation[0] - ); - const dep2 = new ConstDependency( - `, { type: ${this._module ? '"module"' : "undefined"} })`, - insertLocation[1] - ); - dep1.loc = expr.loc; - dep2.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep1); - parser.state.module.addPresentationalDependency(dep2); - } else if (insertType === "argument") { - if (this._module) { - const dep = new ConstDependency( - ', { type: "module" }', - insertLocation - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - } - } +const cssEscapeString = str => { + let countWhiteOrBracket = 0; + let countQuotation = 0; + let countApostrophe = 0; + for (let i = 0; i < str.length; i++) { + const cc = str.charCodeAt(i); + switch (cc) { + case 9: // tab + case 10: // nl + case 32: // space + case 40: // ( + case 41: // ) + countWhiteOrBracket++; + break; + case 34: + countQuotation++; + break; + case 39: + countApostrophe++; + break; + } + } + if (countWhiteOrBracket < 2) { + return str.replace(/[\n\t ()'"\\]/g, m => `\\${m}`); + } else if (countQuotation <= countApostrophe) { + return `"${str.replace(/[\n"\\]/g, m => `\\${m}`)}"`; + } else { + return `'${str.replace(/[\n'\\]/g, m => `\\${m}`)}'`; + } +}; - parser.walkExpression(expr.callee); - for (const key of Object.keys(expressions)) { - if (expressions[key]) parser.walkExpression(expressions[key]); - } - for (const prop of otherElements) { - parser.walkProperty(prop); - } - if (insertType === "spread") { - parser.walkExpression(arg2); - } +CssUrlDependency.Template = class CssUrlDependencyTemplate extends ( + ModuleDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { runtime, moduleGraph, runtimeTemplate, codeGenerationResults } + ) { + const dep = /** @type {CssUrlDependency} */ (dependency); - return true; - }; - const processItem = item => { - if (item.endsWith("()")) { - parser.hooks.call - .for(item.slice(0, -2)) - .tap("WorkerPlugin", handleNewWorker); - } else { - const match = /^(.+?)(\(\))?\s+from\s+(.+)$/.exec(item); - if (match) { - const ids = match[1].split("."); - const call = match[2]; - const source = match[3]; - (call ? parser.hooks.call : parser.hooks.new) - .for(harmonySpecifierTag) - .tap("WorkerPlugin", expr => { - const settings = /** @type {HarmonySettings} */ ( - parser.currentTagData - ); - if ( - !settings || - settings.source !== source || - !equals(settings.ids, ids) - ) { - return; - } - return handleNewWorker(expr); - }); - } else { - parser.hooks.new.for(item).tap("WorkerPlugin", handleNewWorker); - } - } - }; - for (const item of options) { - if (item === "...") { - DEFAULT_SYNTAX.forEach(processItem); - } else processItem(item); - } - }; - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("WorkerPlugin", parserPlugin); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("WorkerPlugin", parserPlugin); - } + source.replace( + dep.range[0], + dep.range[1] - 1, + `${dep.cssFunctionKind}(${cssEscapeString( + runtimeTemplate.assetUrl({ + publicPath: "", + runtime, + module: moduleGraph.getModule(dep), + codeGenerationResults + }) + )})` ); } -} -module.exports = WorkerPlugin; +}; + +makeSerializable(CssUrlDependency, "webpack/lib/dependencies/CssUrlDependency"); + +module.exports = CssUrlDependency; /***/ }), -/***/ 50396: -/***/ (function(module) { +/***/ 22914: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -84976,59 +83132,34 @@ module.exports = WorkerPlugin; -module.exports = expr => { - // - if ( - expr.type === "FunctionExpression" || - expr.type === "ArrowFunctionExpression" - ) { - return { - fn: expr, - expressions: [], - needThis: false - }; +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); + +class DelegatedSourceDependency extends ModuleDependency { + constructor(request) { + super(request); } - // .bind() - if ( - expr.type === "CallExpression" && - expr.callee.type === "MemberExpression" && - expr.callee.object.type === "FunctionExpression" && - expr.callee.property.type === "Identifier" && - expr.callee.property.name === "bind" && - expr.arguments.length === 1 - ) { - return { - fn: expr.callee.object, - expressions: [expr.arguments[0]], - needThis: undefined - }; + get type() { + return "delegated source"; } - // (function(_this) {return })(this) (Coffeescript) - if ( - expr.type === "CallExpression" && - expr.callee.type === "FunctionExpression" && - expr.callee.body.type === "BlockStatement" && - expr.arguments.length === 1 && - expr.arguments[0].type === "ThisExpression" && - expr.callee.body.body && - expr.callee.body.body.length === 1 && - expr.callee.body.body[0].type === "ReturnStatement" && - expr.callee.body.body[0].argument && - expr.callee.body.body[0].argument.type === "FunctionExpression" - ) { - return { - fn: expr.callee.body.body[0].argument, - expressions: [], - needThis: true - }; + + get category() { + return "esm"; } -}; +} + +makeSerializable( + DelegatedSourceDependency, + "webpack/lib/dependencies/DelegatedSourceDependency" +); + +module.exports = DelegatedSourceDependency; /***/ }), -/***/ 55207: +/***/ 95666: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -85039,70 +83170,52 @@ module.exports = expr => { -const { UsageState } = __webpack_require__(63686); +const Dependency = __webpack_require__(54912); +const makeSerializable = __webpack_require__(33032); -/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +class DllEntryDependency extends Dependency { + constructor(dependencies, name) { + super(); -/** - * @param {RuntimeSpec} runtime the runtime - * @param {string[][]} referencedExports list of referenced exports, will be added to - * @param {string[]} prefix export prefix - * @param {ExportInfo=} exportInfo the export info - * @param {boolean} defaultPointsToSelf when true, using default will reference itself - * @param {Set} alreadyVisited already visited export info (to handle circular reexports) - */ -const processExportInfo = ( - runtime, - referencedExports, - prefix, - exportInfo, - defaultPointsToSelf = false, - alreadyVisited = new Set() -) => { - if (!exportInfo) { - referencedExports.push(prefix); - return; + this.dependencies = dependencies; + this.name = name; } - const used = exportInfo.getUsed(runtime); - if (used === UsageState.Unused) return; - if (alreadyVisited.has(exportInfo)) { - referencedExports.push(prefix); - return; + + get type() { + return "dll entry"; } - alreadyVisited.add(exportInfo); - if ( - used !== UsageState.OnlyPropertiesUsed || - !exportInfo.exportsInfo || - exportInfo.exportsInfo.otherExportsInfo.getUsed(runtime) !== - UsageState.Unused - ) { - alreadyVisited.delete(exportInfo); - referencedExports.push(prefix); - return; + + serialize(context) { + const { write } = context; + + write(this.dependencies); + write(this.name); + + super.serialize(context); } - const exportsInfo = exportInfo.exportsInfo; - for (const exportInfo of exportsInfo.orderedExports) { - processExportInfo( - runtime, - referencedExports, - defaultPointsToSelf && exportInfo.name === "default" - ? prefix - : prefix.concat(exportInfo.name), - exportInfo, - false, - alreadyVisited - ); + + deserialize(context) { + const { read } = context; + + this.dependencies = read(); + this.name = read(); + + super.deserialize(context); } - alreadyVisited.delete(exportInfo); -}; -module.exports = processExportInfo; +} + +makeSerializable( + DllEntryDependency, + "webpack/lib/dependencies/DllEntryDependency" +); + +module.exports = DllEntryDependency; /***/ }), -/***/ 32277: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 32006: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* @@ -85112,72 +83225,111 @@ module.exports = processExportInfo; -const ExternalsPlugin = __webpack_require__(6652); +/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../Compiler")} Compiler */ +/** @type {WeakMap} */ +const parserStateExportsState = new WeakMap(); -class ElectronTargetPlugin { - /** - * @param {"main" | "preload" | "renderer"=} context in main, preload or renderer context? - */ - constructor(context) { - this._context = context; +/** + * @param {ParserState} parserState parser state + * @returns {void} + */ +exports.bailout = parserState => { + const value = parserStateExportsState.get(parserState); + parserStateExportsState.set(parserState, false); + if (value === true) { + parserState.module.buildMeta.exportsType = undefined; + parserState.module.buildMeta.defaultObject = false; } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - new ExternalsPlugin("node-commonjs", [ - "clipboard", - "crash-reporter", - "electron", - "ipc", - "native-image", - "original-fs", - "screen", - "shell" - ]).apply(compiler); - switch (this._context) { - case "main": - new ExternalsPlugin("node-commonjs", [ - "app", - "auto-updater", - "browser-window", - "content-tracing", - "dialog", - "global-shortcut", - "ipc-main", - "menu", - "menu-item", - "power-monitor", - "power-save-blocker", - "protocol", - "session", - "tray", - "web-contents" - ]).apply(compiler); - break; - case "preload": - case "renderer": - new ExternalsPlugin("node-commonjs", [ - "desktop-capturer", - "ipc-renderer", - "remote", - "web-frame" - ]).apply(compiler); - break; - } +}; + +/** + * @param {ParserState} parserState parser state + * @returns {void} + */ +exports.enable = parserState => { + const value = parserStateExportsState.get(parserState); + if (value === false) return; + parserStateExportsState.set(parserState, true); + if (value !== true) { + parserState.module.buildMeta.exportsType = "default"; + parserState.module.buildMeta.defaultObject = "redirect"; + } +}; + +/** + * @param {ParserState} parserState parser state + * @returns {void} + */ +exports.setFlagged = parserState => { + const value = parserStateExportsState.get(parserState); + if (value !== true) return; + const buildMeta = parserState.module.buildMeta; + if (buildMeta.exportsType === "dynamic") return; + buildMeta.exportsType = "flagged"; +}; + +/** + * @param {ParserState} parserState parser state + * @returns {void} + */ +exports.setDynamic = parserState => { + const value = parserStateExportsState.get(parserState); + if (value !== true) return; + parserState.module.buildMeta.exportsType = "dynamic"; +}; + +/** + * @param {ParserState} parserState parser state + * @returns {boolean} true, when enabled + */ +exports.isEnabled = parserState => { + const value = parserStateExportsState.get(parserState); + return value === true; +}; + + +/***/ }), + +/***/ 3979: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); + +class EntryDependency extends ModuleDependency { + /** + * @param {string} request request path for entry + */ + constructor(request) { + super(request); + } + + get type() { + return "entry"; + } + + get category() { + return "esm"; } } -module.exports = ElectronTargetPlugin; +makeSerializable(EntryDependency, "webpack/lib/dependencies/EntryDependency"); + +module.exports = EntryDependency; /***/ }), -/***/ 22273: +/***/ 78988: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -85188,68 +83340,289 @@ module.exports = ElectronTargetPlugin; -const WebpackError = __webpack_require__(53799); +const { UsageState } = __webpack_require__(63686); +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ /** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -class BuildCycleError extends WebpackError { +/** + * @param {ModuleGraph} moduleGraph the module graph + * @param {Module} module the module + * @param {string | null} exportName name of the export if any + * @param {string | null} property name of the requested property + * @param {RuntimeSpec} runtime for which runtime + * @returns {any} value of the property + */ +const getProperty = (moduleGraph, module, exportName, property, runtime) => { + if (!exportName) { + switch (property) { + case "usedExports": { + const usedExports = moduleGraph + .getExportsInfo(module) + .getUsedExports(runtime); + if ( + typeof usedExports === "boolean" || + usedExports === undefined || + usedExports === null + ) { + return usedExports; + } + return Array.from(usedExports).sort(); + } + } + } + switch (property) { + case "canMangle": { + const exportsInfo = moduleGraph.getExportsInfo(module); + const exportInfo = exportsInfo.getExportInfo(exportName); + if (exportInfo) return exportInfo.canMangle; + return exportsInfo.otherExportsInfo.canMangle; + } + case "used": + return ( + moduleGraph.getExportsInfo(module).getUsed(exportName, runtime) !== + UsageState.Unused + ); + case "useInfo": { + const state = moduleGraph + .getExportsInfo(module) + .getUsed(exportName, runtime); + switch (state) { + case UsageState.Used: + case UsageState.OnlyPropertiesUsed: + return true; + case UsageState.Unused: + return false; + case UsageState.NoInfo: + return undefined; + case UsageState.Unknown: + return null; + default: + throw new Error(`Unexpected UsageState ${state}`); + } + } + case "provideInfo": + return moduleGraph.getExportsInfo(module).isExportProvided(exportName); + } + return undefined; +}; + +class ExportsInfoDependency extends NullDependency { + constructor(range, exportName, property) { + super(); + this.range = range; + this.exportName = exportName; + this.property = property; + } + + serialize(context) { + const { write } = context; + write(this.range); + write(this.exportName); + write(this.property); + super.serialize(context); + } + + static deserialize(context) { + const obj = new ExportsInfoDependency( + context.read(), + context.read(), + context.read() + ); + obj.deserialize(context); + return obj; + } +} + +makeSerializable( + ExportsInfoDependency, + "webpack/lib/dependencies/ExportsInfoDependency" +); + +ExportsInfoDependency.Template = class ExportsInfoDependencyTemplate extends ( + NullDependency.Template +) { /** - * Creates an instance of ModuleDependencyError. - * @param {Module} module the module starting the cycle + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - constructor(module) { - super( - "There is a circular build dependency, which makes it impossible to create this module" - ); + apply(dependency, source, { module, moduleGraph, runtime }) { + const dep = /** @type {ExportsInfoDependency} */ (dependency); - this.name = "BuildCycleError"; - this.module = module; + const value = getProperty( + moduleGraph, + module, + dep.exportName, + dep.property, + runtime + ); + source.replace( + dep.range[0], + dep.range[1] - 1, + value === undefined ? "undefined" : JSON.stringify(value) + ); } -} +}; -module.exports = BuildCycleError; +module.exports = ExportsInfoDependency; /***/ }), -/***/ 5294: +/***/ 23624: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); +const makeSerializable = __webpack_require__(33032); +const HarmonyImportDependency = __webpack_require__(57154); +const NullDependency = __webpack_require__(31830); -class ExportWebpackRequireRuntimeModule extends RuntimeModule { - constructor() { - super("export webpack runtime", RuntimeModule.STAGE_ATTACH); - } +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("./HarmonyAcceptImportDependency")} HarmonyAcceptImportDependency */ +class HarmonyAcceptDependency extends NullDependency { /** - * @returns {boolean} true, if the runtime module should get it's own scope + * @param {[number, number]} range expression range + * @param {HarmonyAcceptImportDependency[]} dependencies import dependencies + * @param {boolean} hasCallback true, if the range wraps an existing callback */ - shouldIsolate() { - return false; + constructor(range, dependencies, hasCallback) { + super(); + this.range = range; + this.dependencies = dependencies; + this.hasCallback = hasCallback; + } + + get type() { + return "accepted harmony modules"; + } + + serialize(context) { + const { write } = context; + write(this.range); + write(this.dependencies); + write(this.hasCallback); + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + this.range = read(); + this.dependencies = read(); + this.hasCallback = read(); + super.deserialize(context); } +} + +makeSerializable( + HarmonyAcceptDependency, + "webpack/lib/dependencies/HarmonyAcceptDependency" +); +HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate extends ( + NullDependency.Template +) { /** - * @returns {string} runtime code + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - generate() { - return "export default __webpack_require__;"; + apply(dependency, source, templateContext) { + const dep = /** @type {HarmonyAcceptDependency} */ (dependency); + const { + module, + runtime, + runtimeRequirements, + runtimeTemplate, + moduleGraph, + chunkGraph + } = templateContext; + const content = dep.dependencies + .map(dependency => { + const referencedModule = moduleGraph.getModule(dependency); + return { + dependency, + runtimeCondition: referencedModule + ? HarmonyImportDependency.Template.getImportEmittedRuntime( + module, + referencedModule + ) + : false + }; + }) + .filter(({ runtimeCondition }) => runtimeCondition !== false) + .map(({ dependency, runtimeCondition }) => { + const condition = runtimeTemplate.runtimeConditionExpression({ + chunkGraph, + runtime, + runtimeCondition, + runtimeRequirements + }); + const s = dependency.getImportStatement(true, templateContext); + const code = s[0] + s[1]; + if (condition !== "true") { + return `if (${condition}) {\n${Template.indent(code)}\n}\n`; + } + return code; + }) + .join(""); + + if (dep.hasCallback) { + if (runtimeTemplate.supportsArrowFunction()) { + source.insert( + dep.range[0], + `__WEBPACK_OUTDATED_DEPENDENCIES__ => { ${content}(` + ); + source.insert(dep.range[1], ")(__WEBPACK_OUTDATED_DEPENDENCIES__); }"); + } else { + source.insert( + dep.range[0], + `function(__WEBPACK_OUTDATED_DEPENDENCIES__) { ${content}(` + ); + source.insert( + dep.range[1], + ")(__WEBPACK_OUTDATED_DEPENDENCIES__); }.bind(this)" + ); + } + return; + } + + const arrow = runtimeTemplate.supportsArrowFunction(); + source.insert( + dep.range[1] - 0.5, + `, ${arrow ? "() =>" : "function()"} { ${content} }` + ); } -} +}; -module.exports = ExportWebpackRequireRuntimeModule; +module.exports = HarmonyAcceptDependency; /***/ }), -/***/ 68927: +/***/ 99843: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -85260,206 +83633,138 @@ module.exports = ExportWebpackRequireRuntimeModule; -const { ConcatSource } = __webpack_require__(51255); -const { RuntimeGlobals } = __webpack_require__(91919); -const HotUpdateChunk = __webpack_require__(9597); -const Template = __webpack_require__(1626); -const { getAllChunks } = __webpack_require__(91145); -const { - getCompilationHooks, - getChunkFilenameTemplate -} = __webpack_require__(89464); -const { updateHashForEntryStartup } = __webpack_require__(98124); +const makeSerializable = __webpack_require__(33032); +const HarmonyImportDependency = __webpack_require__(57154); -/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -class ModuleChunkFormatPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - "ModuleChunkFormatPlugin", - compilation => { - compilation.hooks.additionalChunkRuntimeRequirements.tap( - "ModuleChunkFormatPlugin", - (chunk, set) => { - if (chunk.hasRuntime()) return; - if (compilation.chunkGraph.getNumberOfEntryModules(chunk) > 0) { - set.add(RuntimeGlobals.require); - set.add(RuntimeGlobals.startupEntrypoint); - set.add(RuntimeGlobals.externalInstallChunk); - } - } - ); - const hooks = getCompilationHooks(compilation); - hooks.renderChunk.tap( - "ModuleChunkFormatPlugin", - (modules, renderContext) => { - const { chunk, chunkGraph, runtimeTemplate } = renderContext; - const hotUpdateChunk = - chunk instanceof HotUpdateChunk ? chunk : null; - const source = new ConcatSource(); - if (hotUpdateChunk) { - throw new Error( - "HMR is not implemented for module chunk format yet" - ); - } else { - source.add(`export const id = ${JSON.stringify(chunk.id)};\n`); - source.add(`export const ids = ${JSON.stringify(chunk.ids)};\n`); - source.add(`export const modules = `); - source.add(modules); - source.add(`;\n`); - const runtimeModules = - chunkGraph.getChunkRuntimeModulesInOrder(chunk); - if (runtimeModules.length > 0) { - source.add("export const runtime =\n"); - source.add( - Template.renderChunkRuntimeModules( - runtimeModules, - renderContext - ) - ); - } - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); - if (entries.length > 0) { - const runtimeChunk = entries[0][1].getRuntimeChunk(); - const currentOutputName = compilation - .getPath( - getChunkFilenameTemplate(chunk, compilation.outputOptions), - { - chunk, - contentHashType: "javascript" - } - ) - .split("/"); +class HarmonyAcceptImportDependency extends HarmonyImportDependency { + constructor(request) { + super(request, NaN); + this.weak = true; + } - // remove filename, we only need the directory - currentOutputName.pop(); + get type() { + return "harmony accept"; + } +} - const getRelativePath = chunk => { - const baseOutputName = currentOutputName.slice(); - const chunkOutputName = compilation - .getPath( - getChunkFilenameTemplate( - chunk, - compilation.outputOptions - ), - { - chunk: chunk, - contentHashType: "javascript" - } - ) - .split("/"); +makeSerializable( + HarmonyAcceptImportDependency, + "webpack/lib/dependencies/HarmonyAcceptImportDependency" +); - // remove common parts - while ( - baseOutputName.length > 0 && - chunkOutputName.length > 0 && - baseOutputName[0] === chunkOutputName[0] - ) { - baseOutputName.shift(); - chunkOutputName.shift(); - } - // create final path - return ( - (baseOutputName.length > 0 - ? "../".repeat(baseOutputName.length) - : "./") + chunkOutputName.join("/") - ); - }; +HarmonyAcceptImportDependency.Template = class HarmonyAcceptImportDependencyTemplate extends ( + HarmonyImportDependency.Template +) {}; - const entrySource = new ConcatSource(); - entrySource.add(source); - entrySource.add(";\n\n// load runtime\n"); - entrySource.add( - `import __webpack_require__ from ${JSON.stringify( - getRelativePath(runtimeChunk) - )};\n` - ); +module.exports = HarmonyAcceptImportDependency; - const startupSource = new ConcatSource(); - startupSource.add( - `var __webpack_exec__ = ${runtimeTemplate.returningFunction( - `__webpack_require__(${RuntimeGlobals.entryModuleId} = moduleId)`, - "moduleId" - )}\n` - ); - const loadedChunks = new Set(); - let index = 0; - for (let i = 0; i < entries.length; i++) { - const [module, entrypoint] = entries[i]; - const final = i + 1 === entries.length; - const moduleId = chunkGraph.getModuleId(module); - const chunks = getAllChunks( - entrypoint, - runtimeChunk, - undefined - ); - for (const chunk of chunks) { - if (loadedChunks.has(chunk)) continue; - loadedChunks.add(chunk); - startupSource.add( - `import * as __webpack_chunk_${index}__ from ${JSON.stringify( - getRelativePath(chunk) - )};\n` - ); - startupSource.add( - `${RuntimeGlobals.externalInstallChunk}(__webpack_chunk_${index}__);\n` - ); - index++; - } - startupSource.add( - `${ - final ? "var __webpack_exports__ = " : "" - }__webpack_exec__(${JSON.stringify(moduleId)});\n` - ); - } +/***/ }), - entrySource.add( - hooks.renderStartup.call( - startupSource, - entries[entries.length - 1][0], - { - ...renderContext, - inlined: false - } - ) - ); - return entrySource; - } - } - return source; - } - ); - hooks.chunkHash.tap( - "ModuleChunkFormatPlugin", - (chunk, hash, { chunkGraph, runtimeTemplate }) => { - if (chunk.hasRuntime()) return; - hash.update("ModuleChunkFormatPlugin"); - hash.update("1"); - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); - updateHashForEntryStartup(hash, chunkGraph, entries, chunk); - } - ); - } - ); +/***/ 72906: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { UsageState } = __webpack_require__(63686); +const InitFragment = __webpack_require__(55870); +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../Module")} Module */ + +class HarmonyCompatibilityDependency extends NullDependency { + get type() { + return "harmony export header"; } } -module.exports = ModuleChunkFormatPlugin; +makeSerializable( + HarmonyCompatibilityDependency, + "webpack/lib/dependencies/HarmonyCompatibilityDependency" +); + +HarmonyCompatibilityDependency.Template = class HarmonyExportDependencyTemplate extends ( + NullDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { + module, + runtimeTemplate, + moduleGraph, + initFragments, + runtimeRequirements, + runtime, + concatenationScope + } + ) { + if (concatenationScope) return; + const exportsInfo = moduleGraph.getExportsInfo(module); + if ( + exportsInfo.getReadOnlyExportInfo("__esModule").getUsed(runtime) !== + UsageState.Unused + ) { + const content = runtimeTemplate.defineEsModuleFlagStatement({ + exportsArgument: module.exportsArgument, + runtimeRequirements + }); + initFragments.push( + new InitFragment( + content, + InitFragment.STAGE_HARMONY_EXPORTS, + 0, + "harmony compatibility" + ) + ); + } + if (moduleGraph.isAsync(module)) { + runtimeRequirements.add(RuntimeGlobals.module); + runtimeRequirements.add(RuntimeGlobals.asyncModule); + initFragments.push( + new InitFragment( + runtimeTemplate.supportsArrowFunction() + ? `${RuntimeGlobals.asyncModule}(${module.moduleArgument}, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n` + : `${RuntimeGlobals.asyncModule}(${module.moduleArgument}, async function (__webpack_handle_async_dependencies__, __webpack_async_result__) { try {\n`, + InitFragment.STAGE_ASYNC_BOUNDARY, + 0, + undefined, + `\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } }${ + module.buildMeta.async ? ", 1" : "" + });` + ) + ); + } + } +}; + +module.exports = HarmonyCompatibilityDependency; /***/ }), -/***/ 89831: +/***/ 17223: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -85470,315 +83775,295 @@ module.exports = ModuleChunkFormatPlugin; -const RuntimeGlobals = __webpack_require__(16475); -const ExportWebpackRequireRuntimeModule = __webpack_require__(5294); -const ModuleChunkLoadingRuntimeModule = __webpack_require__(64747); +const DynamicExports = __webpack_require__(32006); +const HarmonyCompatibilityDependency = __webpack_require__(72906); +const HarmonyExports = __webpack_require__(39211); -/** @typedef {import("../Compiler")} Compiler */ +module.exports = class HarmonyDetectionParserPlugin { + constructor(options) { + const { topLevelAwait = false } = options || {}; + this.topLevelAwait = topLevelAwait; + } -class ModuleChunkLoadingPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - "ModuleChunkLoadingPlugin", - compilation => { - const globalChunkLoading = compilation.outputOptions.chunkLoading; - const isEnabledForChunk = chunk => { - const options = chunk.getEntryOptions(); - const chunkLoading = - (options && options.chunkLoading) || globalChunkLoading; - return chunkLoading === "import"; - }; - const onceForChunkSet = new WeakSet(); - const handler = (chunk, set) => { - if (onceForChunkSet.has(chunk)) return; - onceForChunkSet.add(chunk); - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - set.add(RuntimeGlobals.hasOwnProperty); - compilation.addRuntimeModule( - chunk, - new ModuleChunkLoadingRuntimeModule(set) - ); + apply(parser) { + parser.hooks.program.tap("HarmonyDetectionParserPlugin", ast => { + const isStrictHarmony = parser.state.module.type === "javascript/esm"; + const isHarmony = + isStrictHarmony || + ast.body.some( + statement => + statement.type === "ImportDeclaration" || + statement.type === "ExportDefaultDeclaration" || + statement.type === "ExportNamedDeclaration" || + statement.type === "ExportAllDeclaration" + ); + if (isHarmony) { + const module = parser.state.module; + const compatDep = new HarmonyCompatibilityDependency(); + compatDep.loc = { + start: { + line: -1, + column: 0 + }, + end: { + line: -1, + column: 0 + }, + index: -3 }; - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("ModuleChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.baseURI) - .tap("ModuleChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.externalInstallChunk) - .tap("ModuleChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.onChunksLoaded) - .tap("ModuleChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.externalInstallChunk) - .tap("ModuleChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - compilation.addRuntimeModule( - chunk, - new ExportWebpackRequireRuntimeModule() - ); - }); + module.addPresentationalDependency(compatDep); + DynamicExports.bailout(parser.state); + HarmonyExports.enable(parser.state, isStrictHarmony); + parser.scope.isStrict = true; + } + }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("ModuleChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.getChunkScriptFilename); - }); + parser.hooks.topLevelAwait.tap("HarmonyDetectionParserPlugin", () => { + const module = parser.state.module; + if (!this.topLevelAwait) { + throw new Error( + "The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it)" + ); } - ); - } -} + if (!HarmonyExports.isEnabled(parser.state)) { + throw new Error( + "Top-level-await is only supported in EcmaScript Modules" + ); + } + module.buildMeta.async = true; + }); -module.exports = ModuleChunkLoadingPlugin; + const skipInHarmony = () => { + if (HarmonyExports.isEnabled(parser.state)) { + return true; + } + }; + + const nullInHarmony = () => { + if (HarmonyExports.isEnabled(parser.state)) { + return null; + } + }; + + const nonHarmonyIdentifiers = ["define", "exports"]; + for (const identifier of nonHarmonyIdentifiers) { + parser.hooks.evaluateTypeof + .for(identifier) + .tap("HarmonyDetectionParserPlugin", nullInHarmony); + parser.hooks.typeof + .for(identifier) + .tap("HarmonyDetectionParserPlugin", skipInHarmony); + parser.hooks.evaluate + .for(identifier) + .tap("HarmonyDetectionParserPlugin", nullInHarmony); + parser.hooks.expression + .for(identifier) + .tap("HarmonyDetectionParserPlugin", skipInHarmony); + parser.hooks.call + .for(identifier) + .tap("HarmonyDetectionParserPlugin", skipInHarmony); + } + } +}; /***/ }), -/***/ 64747: +/***/ 93466: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const { SyncWaterfallHook } = __webpack_require__(6967); -const Compilation = __webpack_require__(85720); -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); +const InnerGraph = __webpack_require__(38988); +const ConstDependency = __webpack_require__(76911); +const HarmonyExportExpressionDependency = __webpack_require__(51340); +const HarmonyExportHeaderDependency = __webpack_require__(38873); +const HarmonyExportImportedSpecifierDependency = __webpack_require__(67157); +const HarmonyExportSpecifierDependency = __webpack_require__(48567); +const { ExportPresenceModes } = __webpack_require__(57154); const { - getChunkFilenameTemplate, - chunkHasJs -} = __webpack_require__(89464); -const { getInitialChunkIds } = __webpack_require__(98124); -const compileBooleanMatcher = __webpack_require__(29404); -const { getUndoPath } = __webpack_require__(82186); - -/** @typedef {import("../Chunk")} Chunk */ - -/** - * @typedef {Object} JsonpCompilationPluginHooks - * @property {SyncWaterfallHook<[string, Chunk]>} linkPreload - * @property {SyncWaterfallHook<[string, Chunk]>} linkPrefetch - */ - -/** @type {WeakMap} */ -const compilationHooksMap = new WeakMap(); + harmonySpecifierTag, + getAssertions +} = __webpack_require__(20862); +const HarmonyImportSideEffectDependency = __webpack_require__(73132); -class ModuleChunkLoadingRuntimeModule extends RuntimeModule { - /** - * @param {Compilation} compilation the compilation - * @returns {JsonpCompilationPluginHooks} hooks - */ - static getCompilationHooks(compilation) { - if (!(compilation instanceof Compilation)) { - throw new TypeError( - "The 'compilation' argument must be an instance of Compilation" - ); - } - let hooks = compilationHooksMap.get(compilation); - if (hooks === undefined) { - hooks = { - linkPreload: new SyncWaterfallHook(["source", "chunk"]), - linkPrefetch: new SyncWaterfallHook(["source", "chunk"]) - }; - compilationHooksMap.set(compilation, hooks); - } - return hooks; - } +const { HarmonyStarExportsList } = HarmonyExportImportedSpecifierDependency; - constructor(runtimeRequirements) { - super("import chunk loading", RuntimeModule.STAGE_ATTACH); - this._runtimeRequirements = runtimeRequirements; +module.exports = class HarmonyExportDependencyParserPlugin { + constructor(options) { + this.exportPresenceMode = + options.reexportExportsPresence !== undefined + ? ExportPresenceModes.fromUserOption(options.reexportExportsPresence) + : options.exportsPresence !== undefined + ? ExportPresenceModes.fromUserOption(options.exportsPresence) + : options.strictExportPresence + ? ExportPresenceModes.ERROR + : ExportPresenceModes.AUTO; } - /** - * @returns {string} runtime code - */ - generate() { - const { compilation, chunk } = this; - const { - runtimeTemplate, - chunkGraph, - outputOptions: { importFunctionName, importMetaName } - } = compilation; - const fn = RuntimeGlobals.ensureChunkHandlers; - const withBaseURI = this._runtimeRequirements.has(RuntimeGlobals.baseURI); - const withExternalInstallChunk = this._runtimeRequirements.has( - RuntimeGlobals.externalInstallChunk - ); - const withLoading = this._runtimeRequirements.has( - RuntimeGlobals.ensureChunkHandlers - ); - const withOnChunkLoad = this._runtimeRequirements.has( - RuntimeGlobals.onChunksLoaded - ); - const withHmr = this._runtimeRequirements.has( - RuntimeGlobals.hmrDownloadUpdateHandlers - ); - const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs); - const hasJsMatcher = compileBooleanMatcher(conditionMap); - const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); - - const outputName = this.compilation.getPath( - getChunkFilenameTemplate(chunk, this.compilation.outputOptions), - { - chunk, - contentHashType: "javascript" + apply(parser) { + const { exportPresenceMode } = this; + parser.hooks.export.tap( + "HarmonyExportDependencyParserPlugin", + statement => { + const dep = new HarmonyExportHeaderDependency( + statement.declaration && statement.declaration.range, + statement.range + ); + dep.loc = Object.create(statement.loc); + dep.loc.index = -1; + parser.state.module.addPresentationalDependency(dep); + return true; } ); - const rootOutputDir = getUndoPath( - outputName, - this.compilation.outputOptions.path, - true + parser.hooks.exportImport.tap( + "HarmonyExportDependencyParserPlugin", + (statement, source) => { + parser.state.lastHarmonyImportOrder = + (parser.state.lastHarmonyImportOrder || 0) + 1; + const clearDep = new ConstDependency("", statement.range); + clearDep.loc = Object.create(statement.loc); + clearDep.loc.index = -1; + parser.state.module.addPresentationalDependency(clearDep); + const sideEffectDep = new HarmonyImportSideEffectDependency( + source, + parser.state.lastHarmonyImportOrder, + getAssertions(statement) + ); + sideEffectDep.loc = Object.create(statement.loc); + sideEffectDep.loc.index = -1; + parser.state.current.addDependency(sideEffectDep); + return true; + } + ); + parser.hooks.exportExpression.tap( + "HarmonyExportDependencyParserPlugin", + (statement, expr) => { + const isFunctionDeclaration = expr.type === "FunctionDeclaration"; + const comments = parser.getComments([ + statement.range[0], + expr.range[0] + ]); + const dep = new HarmonyExportExpressionDependency( + expr.range, + statement.range, + comments + .map(c => { + switch (c.type) { + case "Block": + return `/*${c.value}*/`; + case "Line": + return `//${c.value}\n`; + } + return ""; + }) + .join(""), + expr.type.endsWith("Declaration") && expr.id + ? expr.id.name + : isFunctionDeclaration + ? { + id: expr.id ? expr.id.name : undefined, + range: [ + expr.range[0], + expr.params.length > 0 + ? expr.params[0].range[0] + : expr.body.range[0] + ], + prefix: `${expr.async ? "async " : ""}function${ + expr.generator ? "*" : "" + } `, + suffix: `(${expr.params.length > 0 ? "" : ") "}` + } + : undefined + ); + dep.loc = Object.create(statement.loc); + dep.loc.index = -1; + parser.state.current.addDependency(dep); + InnerGraph.addVariableUsage( + parser, + expr.type.endsWith("Declaration") && expr.id + ? expr.id.name + : "*default*", + "default" + ); + return true; + } + ); + parser.hooks.exportSpecifier.tap( + "HarmonyExportDependencyParserPlugin", + (statement, id, name, idx) => { + const settings = parser.getTagData(id, harmonySpecifierTag); + let dep; + const harmonyNamedExports = (parser.state.harmonyNamedExports = + parser.state.harmonyNamedExports || new Set()); + harmonyNamedExports.add(name); + InnerGraph.addVariableUsage(parser, id, name); + if (settings) { + dep = new HarmonyExportImportedSpecifierDependency( + settings.source, + settings.sourceOrder, + settings.ids, + name, + harmonyNamedExports, + null, + exportPresenceMode, + null, + settings.assertions + ); + } else { + dep = new HarmonyExportSpecifierDependency(id, name); + } + dep.loc = Object.create(statement.loc); + dep.loc.index = idx; + parser.state.current.addDependency(dep); + return true; + } + ); + parser.hooks.exportImportSpecifier.tap( + "HarmonyExportDependencyParserPlugin", + (statement, source, id, name, idx) => { + const harmonyNamedExports = (parser.state.harmonyNamedExports = + parser.state.harmonyNamedExports || new Set()); + let harmonyStarExports = null; + if (name) { + harmonyNamedExports.add(name); + } else { + harmonyStarExports = parser.state.harmonyStarExports = + parser.state.harmonyStarExports || new HarmonyStarExportsList(); + } + const dep = new HarmonyExportImportedSpecifierDependency( + source, + parser.state.lastHarmonyImportOrder, + id ? [id] : [], + name, + harmonyNamedExports, + harmonyStarExports && harmonyStarExports.slice(), + exportPresenceMode, + harmonyStarExports + ); + if (harmonyStarExports) { + harmonyStarExports.push(dep); + } + dep.loc = Object.create(statement.loc); + dep.loc.index = idx; + parser.state.current.addDependency(dep); + return true; + } ); - - const stateExpression = withHmr - ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_module` - : undefined; - - return Template.asString([ - withBaseURI - ? Template.asString([ - `${RuntimeGlobals.baseURI} = new URL(${JSON.stringify( - rootOutputDir - )}, ${importMetaName}.url);` - ]) - : "// no baseURI", - "", - "// object to store loaded and loading chunks", - "// undefined = chunk not loaded, null = chunk preloaded/prefetched", - "// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded", - `var installedChunks = ${ - stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" - }{`, - Template.indent( - Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join( - ",\n" - ) - ), - "};", - "", - withLoading || withExternalInstallChunk - ? `var installChunk = ${runtimeTemplate.basicFunction("data", [ - runtimeTemplate.destructureObject( - ["ids", "modules", "runtime"], - "data" - ), - '// add "modules" to the modules object,', - '// then flag all "ids" as loaded and fire callback', - "var moduleId, chunkId, i = 0;", - "for(moduleId in modules) {", - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(modules, moduleId)) {`, - Template.indent( - `${RuntimeGlobals.moduleFactories}[moduleId] = modules[moduleId];` - ), - "}" - ]), - "}", - "if(runtime) runtime(__webpack_require__);", - "for(;i < ids.length; i++) {", - Template.indent([ - "chunkId = ids[i];", - `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) && installedChunks[chunkId]) {`, - Template.indent("installedChunks[chunkId][0]();"), - "}", - "installedChunks[ids[i]] = 0;" - ]), - "}", - withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : "" - ])}` - : "// no install chunk", - "", - withLoading - ? Template.asString([ - `${fn}.j = ${runtimeTemplate.basicFunction( - "chunkId, promises", - hasJsMatcher !== false - ? Template.indent([ - "// import() chunk loading for javascript", - `var installedChunkData = ${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;`, - 'if(installedChunkData !== 0) { // 0 means "already installed".', - Template.indent([ - "", - '// a Promise means "currently loading".', - "if(installedChunkData) {", - Template.indent([ - "promises.push(installedChunkData[1]);" - ]), - "} else {", - Template.indent([ - hasJsMatcher === true - ? "if(true) { // all chunks have JS" - : `if(${hasJsMatcher("chunkId")}) {`, - Template.indent([ - "// setup Promise in chunk cache", - `var promise = ${importFunctionName}(${JSON.stringify( - rootOutputDir - )} + ${ - RuntimeGlobals.getChunkScriptFilename - }(chunkId)).then(installChunk, ${runtimeTemplate.basicFunction( - "e", - [ - "if(installedChunks[chunkId] !== 0) installedChunks[chunkId] = undefined;", - "throw e;" - ] - )});`, - `var promise = Promise.race([promise, new Promise(${runtimeTemplate.expressionFunction( - `installedChunkData = installedChunks[chunkId] = [resolve]`, - "resolve" - )})])`, - `promises.push(installedChunkData[1] = promise);` - ]), - "} else installedChunks[chunkId] = 0;" - ]), - "}" - ]), - "}" - ]) - : Template.indent(["installedChunks[chunkId] = 0;"]) - )};` - ]) - : "// no chunk on demand loading", - "", - withExternalInstallChunk - ? Template.asString([ - `${RuntimeGlobals.externalInstallChunk} = installChunk;` - ]) - : "// no external install chunk", - "", - withOnChunkLoad - ? `${ - RuntimeGlobals.onChunksLoaded - }.j = ${runtimeTemplate.returningFunction( - "installedChunks[chunkId] === 0", - "chunkId" - )};` - : "// no on chunks loaded" - ]); } -} - -module.exports = ModuleChunkLoadingRuntimeModule; +}; /***/ }), -/***/ 16734: -/***/ (function(module) { +/***/ 51340: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -85788,72 +84073,194 @@ module.exports = ModuleChunkLoadingRuntimeModule; -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("./Dependency").SourcePosition} SourcePosition */ +const ConcatenationScope = __webpack_require__(98229); +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); +const HarmonyExportInitFragment = __webpack_require__(89500); +const NullDependency = __webpack_require__(31830); -/** - * @param {SourcePosition} pos position - * @returns {string} formatted position - */ -const formatPosition = pos => { - if (pos && typeof pos === "object") { - if ("line" in pos && "column" in pos) { - return `${pos.line}:${pos.column}`; - } else if ("line" in pos) { - return `${pos.line}:?`; - } +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ + +class HarmonyExportExpressionDependency extends NullDependency { + constructor(range, rangeStatement, prefix, declarationId) { + super(); + this.range = range; + this.rangeStatement = rangeStatement; + this.prefix = prefix; + this.declarationId = declarationId; } - return ""; -}; -/** - * @param {DependencyLocation} loc location - * @returns {string} formatted location - */ -const formatLocation = loc => { - if (loc && typeof loc === "object") { - if ("start" in loc && loc.start && "end" in loc && loc.end) { - if ( - typeof loc.start === "object" && - typeof loc.start.line === "number" && - typeof loc.end === "object" && - typeof loc.end.line === "number" && - typeof loc.end.column === "number" && - loc.start.line === loc.end.line - ) { - return `${formatPosition(loc.start)}-${loc.end.column}`; - } else if ( - typeof loc.start === "object" && - typeof loc.start.line === "number" && - typeof loc.start.column !== "number" && - typeof loc.end === "object" && - typeof loc.end.line === "number" && - typeof loc.end.column !== "number" - ) { - return `${loc.start.line}-${loc.end.line}`; + get type() { + return "harmony export expression"; + } + + /** + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names + */ + getExports(moduleGraph) { + return { + exports: ["default"], + priority: 1, + terminalBinding: true, + dependencies: undefined + }; + } + + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this dependency connects the module to referencing modules + */ + getModuleEvaluationSideEffectsState(moduleGraph) { + // The expression/declaration is already covered by SideEffectsFlagPlugin + return false; + } + + serialize(context) { + const { write } = context; + write(this.range); + write(this.rangeStatement); + write(this.prefix); + write(this.declarationId); + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + this.range = read(); + this.rangeStatement = read(); + this.prefix = read(); + this.declarationId = read(); + super.deserialize(context); + } +} + +makeSerializable( + HarmonyExportExpressionDependency, + "webpack/lib/dependencies/HarmonyExportExpressionDependency" +); + +HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTemplate extends ( + NullDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { + module, + moduleGraph, + runtimeTemplate, + runtimeRequirements, + initFragments, + runtime, + concatenationScope + } + ) { + const dep = /** @type {HarmonyExportExpressionDependency} */ (dependency); + const { declarationId } = dep; + const exportsName = module.exportsArgument; + if (declarationId) { + let name; + if (typeof declarationId === "string") { + name = declarationId; } else { - return `${formatPosition(loc.start)}-${formatPosition(loc.end)}`; + name = ConcatenationScope.DEFAULT_EXPORT; + source.replace( + declarationId.range[0], + declarationId.range[1] - 1, + `${declarationId.prefix}${name}${declarationId.suffix}` + ); } - } - if ("start" in loc && loc.start) { - return formatPosition(loc.start); - } - if ("name" in loc && "index" in loc) { - return `${loc.name}[${loc.index}]`; - } - if ("name" in loc) { - return loc.name; + + if (concatenationScope) { + concatenationScope.registerExport("default", name); + } else { + const used = moduleGraph + .getExportsInfo(module) + .getUsedName("default", runtime); + if (used) { + const map = new Map(); + map.set(used, `/* export default binding */ ${name}`); + initFragments.push(new HarmonyExportInitFragment(exportsName, map)); + } + } + + source.replace( + dep.rangeStatement[0], + dep.range[0] - 1, + `/* harmony default export */ ${dep.prefix}` + ); + } else { + let content; + const name = ConcatenationScope.DEFAULT_EXPORT; + if (runtimeTemplate.supportsConst()) { + content = `/* harmony default export */ const ${name} = `; + if (concatenationScope) { + concatenationScope.registerExport("default", name); + } else { + const used = moduleGraph + .getExportsInfo(module) + .getUsedName("default", runtime); + if (used) { + runtimeRequirements.add(RuntimeGlobals.exports); + const map = new Map(); + map.set(used, name); + initFragments.push(new HarmonyExportInitFragment(exportsName, map)); + } else { + content = `/* unused harmony default export */ var ${name} = `; + } + } + } else if (concatenationScope) { + content = `/* harmony default export */ var ${name} = `; + concatenationScope.registerExport("default", name); + } else { + const used = moduleGraph + .getExportsInfo(module) + .getUsedName("default", runtime); + if (used) { + runtimeRequirements.add(RuntimeGlobals.exports); + // This is a little bit incorrect as TDZ is not correct, but we can't use const. + content = `/* harmony default export */ ${exportsName}[${JSON.stringify( + used + )}] = `; + } else { + content = `/* unused harmony default export */ var ${name} = `; + } + } + + if (dep.range) { + source.replace( + dep.rangeStatement[0], + dep.range[0] - 1, + content + "(" + dep.prefix + ); + source.replace(dep.range[1], dep.rangeStatement[1] - 0.5, ");"); + return; + } + + source.replace(dep.rangeStatement[0], dep.rangeStatement[1] - 1, content); } } - return ""; }; -module.exports = formatLocation; +module.exports = HarmonyExportExpressionDependency; /***/ }), -/***/ 27899: +/***/ 38873: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -85864,46 +84271,69 @@ module.exports = formatLocation; -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); -class HotModuleReplacementRuntimeModule extends RuntimeModule { - constructor() { - super("hot module replacement", RuntimeModule.STAGE_BASIC); +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + +class HarmonyExportHeaderDependency extends NullDependency { + constructor(range, rangeStatement) { + super(); + this.range = range; + this.rangeStatement = rangeStatement; } + + get type() { + return "harmony export header"; + } + + serialize(context) { + const { write } = context; + write(this.range); + write(this.rangeStatement); + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + this.range = read(); + this.rangeStatement = read(); + super.deserialize(context); + } +} + +makeSerializable( + HarmonyExportHeaderDependency, + "webpack/lib/dependencies/HarmonyExportHeaderDependency" +); + +HarmonyExportHeaderDependency.Template = class HarmonyExportDependencyTemplate extends ( + NullDependency.Template +) { /** - * @returns {string} runtime code + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - generate() { - return Template.getFunctionContent( - require('./HotModuleReplacement.runtime.js') - ) - .replace(/\$getFullHash\$/g, RuntimeGlobals.getFullHash) - .replace( - /\$interceptModuleExecution\$/g, - RuntimeGlobals.interceptModuleExecution - ) - .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) - .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) - .replace(/\$hmrDownloadManifest\$/g, RuntimeGlobals.hmrDownloadManifest) - .replace( - /\$hmrInvalidateModuleHandlers\$/g, - RuntimeGlobals.hmrInvalidateModuleHandlers - ) - .replace( - /\$hmrDownloadUpdateHandlers\$/g, - RuntimeGlobals.hmrDownloadUpdateHandlers - ); + apply(dependency, source, templateContext) { + const dep = /** @type {HarmonyExportHeaderDependency} */ (dependency); + const content = ""; + const replaceUntil = dep.range + ? dep.range[0] - 1 + : dep.rangeStatement[1] - 1; + source.replace(dep.rangeStatement[0], replaceUntil, content); } -} +}; -module.exports = HotModuleReplacementRuntimeModule; +module.exports = HarmonyExportHeaderDependency; /***/ }), -/***/ 79040: +/***/ 67157: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -85914,1410 +84344,1275 @@ module.exports = HotModuleReplacementRuntimeModule; -const { RawSource } = __webpack_require__(51255); -const AsyncDependenciesBlock = __webpack_require__(47736); const Dependency = __webpack_require__(54912); -const Module = __webpack_require__(73208); -const ModuleFactory = __webpack_require__(51010); +const { UsageState } = __webpack_require__(63686); +const HarmonyLinkingError = __webpack_require__(97511); +const InitFragment = __webpack_require__(55870); const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const CommonJsRequireDependency = __webpack_require__(21264); -const { registerNotSerializable } = __webpack_require__(8282); +const Template = __webpack_require__(39722); +const { countIterable } = __webpack_require__(39104); +const { first, combine } = __webpack_require__(93347); +const makeSerializable = __webpack_require__(33032); +const propertyAccess = __webpack_require__(54190); +const { getRuntimeKey, keyToRuntime } = __webpack_require__(17156); +const HarmonyExportInitFragment = __webpack_require__(89500); +const HarmonyImportDependency = __webpack_require__(57154); +const processExportInfo = __webpack_require__(55207); -/** @typedef {import("../../declarations/WebpackOptions")} WebpackOptions */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ /** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../Module").BuildMeta} BuildMeta */ -/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ -/** @typedef {import("../ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ExportsInfo")} ExportsInfo */ +/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ /** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../dependencies/HarmonyImportDependency")} HarmonyImportDependency */ /** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ - -/** - * @typedef {Object} BackendApi - * @property {function(Error=): void} dispose - * @property {function(Module): { client: string, data: string, active: boolean }} module - */ - -const HMR_DEPENDENCY_TYPES = new Set([ - "import.meta.webpackHot.accept", - "import.meta.webpackHot.decline", - "module.hot.accept", - "module.hot.decline" -]); - -/** - * @param {undefined|string|RegExp|Function} test test option - * @param {Module} module the module - * @returns {boolean} true, if the module should be selected - */ -const checkTest = (test, module) => { - if (test === undefined) return true; - if (typeof test === "function") { - return test(module); - } - if (typeof test === "string") { - const name = module.nameForCondition(); - return name && name.startsWith(test); - } - if (test instanceof RegExp) { - const name = module.nameForCondition(); - return name && test.test(name); - } - return false; -}; - -const TYPES = new Set(["javascript"]); - -class LazyCompilationDependency extends Dependency { - constructor(proxyModule) { - super(); - this.proxyModule = proxyModule; - } - - get category() { - return "esm"; - } - - get type() { - return "lazy import()"; - } +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - /** - * @returns {string | null} an identifier to merge equal requests - */ - getResourceIdentifier() { - return this.proxyModule.originalModule.identifier(); - } -} +/** @typedef {"missing"|"unused"|"empty-star"|"reexport-dynamic-default"|"reexport-named-default"|"reexport-namespace-object"|"reexport-fake-namespace-object"|"reexport-undefined"|"normal-reexport"|"dynamic-reexport"} ExportModeType */ -registerNotSerializable(LazyCompilationDependency); +const { ExportPresenceModes } = HarmonyImportDependency; -class LazyCompilationProxyModule extends Module { - constructor(context, originalModule, request, client, data, active) { - super("lazy-compilation-proxy", context, originalModule.layer); - this.originalModule = originalModule; - this.request = request; - this.client = client; - this.data = data; - this.active = active; - } +const idsSymbol = Symbol("HarmonyExportImportedSpecifierDependency.ids"); +class NormalReexportItem { /** - * @returns {string} a unique identifier of the module + * @param {string} name export name + * @param {string[]} ids reexported ids from other module + * @param {ExportInfo} exportInfo export info from other module + * @param {boolean} checked true, if it should be checked at runtime if this export exists + * @param {boolean} hidden true, if it is hidden behind another active export in the same module */ - identifier() { - return `lazy-compilation-proxy|${this.originalModule.identifier()}`; + constructor(name, ids, exportInfo, checked, hidden) { + this.name = name; + this.ids = ids; + this.exportInfo = exportInfo; + this.checked = checked; + this.hidden = hidden; } +} +class ExportMode { /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module + * @param {ExportModeType} type type of the mode */ - readableIdentifier(requestShortener) { - return `lazy-compilation-proxy ${this.originalModule.readableIdentifier( - requestShortener - )}`; - } + constructor(type) { + /** @type {ExportModeType} */ + this.type = type; - /** - * Assuming this module is in the cache. Update the (cached) module with - * the fresh module from the factory. Usually updates internal references - * and properties. - * @param {Module} module fresh module - * @returns {void} - */ - updateCacheModule(module) { - super.updateCacheModule(module); - const m = /** @type {LazyCompilationProxyModule} */ (module); - this.originalModule = m.originalModule; - this.request = m.request; - this.client = m.client; - this.data = m.data; - this.active = m.active; - } + // for "normal-reexport": + /** @type {NormalReexportItem[] | null} */ + this.items = null; - /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion - */ - libIdent(options) { - return `${this.originalModule.libIdent(options)}!lazy-compilation-proxy`; - } + // for "reexport-named-default" | "reexport-fake-namespace-object" | "reexport-namespace-object" + /** @type {string|null} */ + this.name = null; + /** @type {ExportInfo | null} */ + this.partialNamespaceExportInfo = null; - /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} - */ - needBuild(context, callback) { - callback(null, !this.buildInfo || this.buildInfo.active !== this.active); - } + // for "dynamic-reexport": + /** @type {Set | null} */ + this.ignored = null; - /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} - */ - build(options, compilation, resolver, fs, callback) { - this.buildInfo = { - active: this.active - }; - /** @type {BuildMeta} */ - this.buildMeta = {}; - this.clearDependenciesAndBlocks(); - const dep = new CommonJsRequireDependency(this.client); - this.addDependency(dep); - if (this.active) { - const dep = new LazyCompilationDependency(this); - const block = new AsyncDependenciesBlock({}); - block.addDependency(dep); - this.addBlock(block); - } - callback(); - } + // for "dynamic-reexport" | "empty-star": + /** @type {Set | null} */ + this.hidden = null; - /** - * @returns {Set} types available (do not mutate) - */ - getSourceTypes() { - return TYPES; + // for "missing": + /** @type {string | null} */ + this.userRequest = null; + + // for "reexport-fake-namespace-object": + /** @type {number} */ + this.fakeType = 0; } +} - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - return 200; +const determineExportAssignments = ( + moduleGraph, + dependencies, + additionalDependency +) => { + const names = new Set(); + const dependencyIndices = []; + + if (additionalDependency) { + dependencies = dependencies.concat(additionalDependency); } - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration({ runtimeTemplate, chunkGraph, moduleGraph }) { - const sources = new Map(); - const runtimeRequirements = new Set(); - runtimeRequirements.add(RuntimeGlobals.module); - const clientDep = /** @type {CommonJsRequireDependency} */ ( - this.dependencies[0] - ); - const clientModule = moduleGraph.getModule(clientDep); - const block = this.blocks[0]; - const client = Template.asString([ - `var client = ${runtimeTemplate.moduleExports({ - module: clientModule, - chunkGraph, - request: clientDep.userRequest, - runtimeRequirements - })}`, - `var data = ${JSON.stringify(this.data)};` - ]); - const keepActive = Template.asString([ - `var dispose = client.keepAlive({ data: data, active: ${JSON.stringify( - !!block - )}, module: module, onError: onError });` - ]); - let source; - if (block) { - const dep = block.dependencies[0]; - const module = moduleGraph.getModule(dep); - source = Template.asString([ - client, - `module.exports = ${runtimeTemplate.moduleNamespacePromise({ - chunkGraph, - block, - module, - request: this.request, - strict: false, // TODO this should be inherited from the original module - message: "import()", - runtimeRequirements - })};`, - "if (module.hot) {", - Template.indent([ - "module.hot.accept();", - `module.hot.accept(${JSON.stringify( - chunkGraph.getModuleId(module) - )}, function() { module.hot.invalidate(); });`, - "module.hot.dispose(function(data) { delete data.resolveSelf; dispose(data); });", - "if (module.hot.data && module.hot.data.resolveSelf) module.hot.data.resolveSelf(module.exports);" - ]), - "}", - "function onError() { /* ignore */ }", - keepActive - ]); - } else { - source = Template.asString([ - client, - "var resolveSelf, onError;", - `module.exports = new Promise(function(resolve, reject) { resolveSelf = resolve; onError = reject; });`, - "if (module.hot) {", - Template.indent([ - "module.hot.accept();", - "if (module.hot.data && module.hot.data.resolveSelf) module.hot.data.resolveSelf(module.exports);", - "module.hot.dispose(function(data) { data.resolveSelf = resolveSelf; dispose(data); });" - ]), - "}", - keepActive - ]); + for (const dep of dependencies) { + const i = dependencyIndices.length; + dependencyIndices[i] = names.size; + const otherImportedModule = moduleGraph.getModule(dep); + if (otherImportedModule) { + const exportsInfo = moduleGraph.getExportsInfo(otherImportedModule); + for (const exportInfo of exportsInfo.exports) { + if ( + exportInfo.provided === true && + exportInfo.name !== "default" && + !names.has(exportInfo.name) + ) { + names.add(exportInfo.name); + dependencyIndices[i] = names.size; + } + } } - sources.set("javascript", new RawSource(source)); - return { - sources, - runtimeRequirements - }; } + dependencyIndices.push(names.size); - /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - super.updateHash(hash, context); - hash.update(this.active ? "active" : ""); - hash.update(JSON.stringify(this.data)); + return { names: Array.from(names), dependencyIndices }; +}; + +const findDependencyForName = ( + { names, dependencyIndices }, + name, + dependencies +) => { + const dependenciesIt = dependencies[Symbol.iterator](); + const dependencyIndicesIt = dependencyIndices[Symbol.iterator](); + let dependenciesItResult = dependenciesIt.next(); + let dependencyIndicesItResult = dependencyIndicesIt.next(); + if (dependencyIndicesItResult.done) return; + for (let i = 0; i < names.length; i++) { + while (i >= dependencyIndicesItResult.value) { + dependenciesItResult = dependenciesIt.next(); + dependencyIndicesItResult = dependencyIndicesIt.next(); + if (dependencyIndicesItResult.done) return; + } + if (names[i] === name) return dependenciesItResult.value; } -} + return undefined; +}; -registerNotSerializable(LazyCompilationProxyModule); +/** + * @param {ModuleGraph} moduleGraph the module graph + * @param {HarmonyExportImportedSpecifierDependency} dep the dependency + * @param {string} runtimeKey the runtime key + * @returns {ExportMode} the export mode + */ +const getMode = (moduleGraph, dep, runtimeKey) => { + const importedModule = moduleGraph.getModule(dep); -class LazyCompilationDependencyFactory extends ModuleFactory { - constructor(factory) { - super(); - this._factory = factory; - } + if (!importedModule) { + const mode = new ExportMode("missing"); - /** - * @param {ModuleFactoryCreateData} data data object - * @param {function(Error=, ModuleFactoryResult=): void} callback callback - * @returns {void} - */ - create(data, callback) { - const dependency = /** @type {LazyCompilationDependency} */ ( - data.dependencies[0] - ); - callback(null, { - module: dependency.proxyModule.originalModule - }); - } -} + mode.userRequest = dep.userRequest; -class LazyCompilationPlugin { - /** - * @param {Object} options options - * @param {(function(Compiler, function(Error?, BackendApi?): void): void) | function(Compiler): Promise} options.backend the backend - * @param {boolean} options.entries true, when entries are lazy compiled - * @param {boolean} options.imports true, when import() modules are lazy compiled - * @param {RegExp | string | (function(Module): boolean)} options.test additional filter for lazy compiled entrypoint modules - */ - constructor({ backend, entries, imports, test }) { - this.backend = backend; - this.entries = entries; - this.imports = imports; - this.test = test; + return mode; } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - let backend; - compiler.hooks.beforeCompile.tapAsync( - "LazyCompilationPlugin", - (params, callback) => { - if (backend !== undefined) return callback(); - const promise = this.backend(compiler, (err, result) => { - if (err) return callback(err); - backend = result; - callback(); - }); - if (promise && promise.then) { - promise.then(b => { - backend = b; - callback(); - }, callback); - } - } - ); - compiler.hooks.thisCompilation.tap( - "LazyCompilationPlugin", - (compilation, { normalModuleFactory }) => { - normalModuleFactory.hooks.module.tap( - "LazyCompilationPlugin", - (originalModule, createData, resolveData) => { - if ( - resolveData.dependencies.every(dep => - HMR_DEPENDENCY_TYPES.has(dep.type) - ) - ) { - // for HMR only resolving, try to determine if the HMR accept/decline refers to - // an import() or not - const hmrDep = resolveData.dependencies[0]; - const originModule = - compilation.moduleGraph.getParentModule(hmrDep); - const isReferringToDynamicImport = originModule.blocks.some( - block => - block.dependencies.some( - dep => - dep.type === "import()" && - /** @type {HarmonyImportDependency} */ (dep).request === - hmrDep.request - ) - ); - if (!isReferringToDynamicImport) return; - } else if ( - !resolveData.dependencies.every( - dep => - HMR_DEPENDENCY_TYPES.has(dep.type) || - (this.imports && - (dep.type === "import()" || - dep.type === "import() context element")) || - (this.entries && dep.type === "entry") - ) - ) - return; - if ( - /webpack[/\\]hot[/\\]|webpack-dev-server[/\\]client|webpack-hot-middleware[/\\]client/.test( - resolveData.request - ) || - !checkTest(this.test, originalModule) - ) - return; - const moduleInfo = backend.module(originalModule); - if (!moduleInfo) return; - const { client, data, active } = moduleInfo; - return new LazyCompilationProxyModule( - compiler.context, - originalModule, - resolveData.request, - client, - data, - active - ); - } - ); - compilation.dependencyFactories.set( - LazyCompilationDependency, - new LazyCompilationDependencyFactory() - ); - } - ); - compiler.hooks.shutdown.tapAsync("LazyCompilationPlugin", callback => { - backend.dispose(callback); - }); + const name = dep.name; + const runtime = keyToRuntime(runtimeKey); + const parentModule = moduleGraph.getParentModule(dep); + const exportsInfo = moduleGraph.getExportsInfo(parentModule); + + if ( + name + ? exportsInfo.getUsed(name, runtime) === UsageState.Unused + : exportsInfo.isUsed(runtime) === false + ) { + const mode = new ExportMode("unused"); + + mode.name = name || "*"; + + return mode; } -} -module.exports = LazyCompilationPlugin; + const importedExportsType = importedModule.getExportsType( + moduleGraph, + parentModule.buildMeta.strictHarmonyModule + ); + const ids = dep.getIds(moduleGraph); -/***/ }), + // Special handling for reexporting the default export + // from non-namespace modules + if (name && ids.length > 0 && ids[0] === "default") { + switch (importedExportsType) { + case "dynamic": { + const mode = new ExportMode("reexport-dynamic-default"); -/***/ 17781: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + mode.name = name; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + return mode; + } + case "default-only": + case "default-with-named": { + const exportInfo = exportsInfo.getReadOnlyExportInfo(name); + const mode = new ExportMode("reexport-named-default"); + mode.name = name; + mode.partialNamespaceExportInfo = exportInfo; + return mode; + } + } + } -/** @typedef {import("http").ServerOptions} HttpServerOptions */ -/** @typedef {import("https").ServerOptions} HttpsServerOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LazyCompilationDefaultBackendOptions} LazyCompilationDefaultBackendOptions */ -/** @typedef {import("../Compiler")} Compiler */ + // reexporting with a fixed name + if (name) { + let mode; + const exportInfo = exportsInfo.getReadOnlyExportInfo(name); + + if (ids.length > 0) { + // export { name as name } + switch (importedExportsType) { + case "default-only": + mode = new ExportMode("reexport-undefined"); + mode.name = name; + break; + default: + mode = new ExportMode("normal-reexport"); + mode.items = [ + new NormalReexportItem(name, ids, exportInfo, false, false) + ]; + break; + } + } else { + // export * as name + switch (importedExportsType) { + case "default-only": + mode = new ExportMode("reexport-fake-namespace-object"); + mode.name = name; + mode.partialNamespaceExportInfo = exportInfo; + mode.fakeType = 0; + break; + case "default-with-named": + mode = new ExportMode("reexport-fake-namespace-object"); + mode.name = name; + mode.partialNamespaceExportInfo = exportInfo; + mode.fakeType = 2; + break; + case "dynamic": + default: + mode = new ExportMode("reexport-namespace-object"); + mode.name = name; + mode.partialNamespaceExportInfo = exportInfo; + } + } + + return mode; + } + + // Star reexporting + + const { ignoredExports, exports, checked, hidden } = dep.getStarReexports( + moduleGraph, + runtime, + exportsInfo, + importedModule + ); + if (!exports) { + // We have too few info about the modules + // Delegate the logic to the runtime code -/** - * @callback BackendHandler - * @param {Compiler} compiler compiler - * @param {function((Error | null)=, any=): void} callback callback - * @returns {void} - */ + const mode = new ExportMode("dynamic-reexport"); + mode.ignored = ignoredExports; + mode.hidden = hidden; -/** - * @param {Omit & { client: NonNullable}} options additional options for the backend - * @returns {BackendHandler} backend - */ -module.exports = options => (compiler, callback) => { - const logger = compiler.getInfrastructureLogger("LazyCompilationBackend"); - const activeModules = new Map(); - const prefix = "/lazy-compilation-using-"; + return mode; + } - const isHttps = - options.protocol === "https" || - (typeof options.server === "object" && - ("key" in options.server || "pfx" in options.server)); + if (exports.size === 0) { + const mode = new ExportMode("empty-star"); + mode.hidden = hidden; - const createServer = - typeof options.server === "function" - ? options.server - : (() => { - const http = isHttps ? __webpack_require__(95687) : __webpack_require__(13685); - return http.createServer.bind(http, options.server); - })(); - const listen = - typeof options.listen === "function" - ? options.listen - : server => { - let listen = options.listen; - if (typeof listen === "object" && !("port" in listen)) - listen = { ...listen, port: undefined }; - server.listen(listen); - }; + return mode; + } - const protocol = options.protocol || (isHttps ? "https" : "http"); + const mode = new ExportMode("normal-reexport"); - const requestListener = (req, res) => { - const keys = req.url.slice(prefix.length).split("@"); - req.socket.on("close", () => { - setTimeout(() => { - for (const key of keys) { - const oldValue = activeModules.get(key) || 0; - activeModules.set(key, oldValue - 1); - if (oldValue === 1) { - logger.log( - `${key} is no longer in use. Next compilation will skip this module.` - ); - } - } - }, 120000); - }); - req.socket.setNoDelay(true); - res.writeHead(200, { - "content-type": "text/event-stream", - "Access-Control-Allow-Origin": "*", - "Access-Control-Allow-Methods": "*", - "Access-Control-Allow-Headers": "*" - }); - res.write("\n"); - let moduleActivated = false; - for (const key of keys) { - const oldValue = activeModules.get(key) || 0; - activeModules.set(key, oldValue + 1); - if (oldValue === 0) { - logger.log(`${key} is now in use and will be compiled.`); - moduleActivated = true; - } + mode.items = Array.from( + exports, + exportName => + new NormalReexportItem( + exportName, + [exportName], + exportsInfo.getReadOnlyExportInfo(exportName), + checked.has(exportName), + false + ) + ); + if (hidden !== undefined) { + for (const exportName of hidden) { + mode.items.push( + new NormalReexportItem( + exportName, + [exportName], + exportsInfo.getReadOnlyExportInfo(exportName), + false, + true + ) + ); } - if (moduleActivated && compiler.watching) compiler.watching.invalidate(); - }; - - const server = /** @type {import("net").Server} */ (createServer()); - server.on("request", requestListener); + } - let isClosing = false; - /** @type {Set} */ - const sockets = new Set(); - server.on("connection", socket => { - sockets.add(socket); - socket.on("close", () => { - sockets.delete(socket); - }); - if (isClosing) socket.destroy(); - }); - server.on("clientError", e => { - if (e.message !== "Server is disposing") logger.warn(e); - }); - server.on("listening", err => { - if (err) return callback(err); - const addr = server.address(); - if (typeof addr === "string") throw new Error("addr must not be a string"); - const urlBase = - addr.address === "::" || addr.address === "0.0.0.0" - ? `${protocol}://localhost:${addr.port}` - : addr.family === "IPv6" - ? `${protocol}://[${addr.address}]:${addr.port}` - : `${protocol}://${addr.address}:${addr.port}`; - logger.log( - `Server-Sent-Events server for lazy compilation open at ${urlBase}.` - ); - callback(null, { - dispose(callback) { - isClosing = true; - // Removing the listener is a workaround for a memory leak in node.js - server.off("request", requestListener); - server.close(err => { - callback(err); - }); - for (const socket of sockets) { - socket.destroy(new Error("Server is disposing")); - } - }, - module(originalModule) { - const key = `${encodeURIComponent( - originalModule.identifier().replace(/\\/g, "/").replace(/@/g, "_") - ).replace(/%(2F|3A|24|26|2B|2C|3B|3D|3A)/g, decodeURIComponent)}`; - const active = activeModules.get(key) > 0; - return { - client: `${options.client}?${encodeURIComponent(urlBase + prefix)}`, - data: key, - active - }; - } - }); - }); - listen(server); + return mode; }; +class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { + /** + * @param {string} request the request string + * @param {number} sourceOrder the order in the original source file + * @param {string[]} ids the requested export name of the imported module + * @param {string | null} name the export name of for this module + * @param {Set} activeExports other named exports in the module + * @param {ReadonlyArray | Iterable} otherStarExports other star exports in the module before this import + * @param {number} exportPresenceMode mode of checking export names + * @param {HarmonyStarExportsList} allStarExports all star exports in the module + * @param {Record=} assertions import assertions + */ + constructor( + request, + sourceOrder, + ids, + name, + activeExports, + otherStarExports, + exportPresenceMode, + allStarExports, + assertions + ) { + super(request, sourceOrder, assertions); -/***/ }), - -/***/ 64618: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + this.ids = ids; + this.name = name; + this.activeExports = activeExports; + this.otherStarExports = otherStarExports; + this.exportPresenceMode = exportPresenceMode; + this.allStarExports = allStarExports; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + */ + couldAffectReferencingModule() { + return Dependency.TRANSITIVE; + } + // TODO webpack 6 remove + get id() { + throw new Error("id was renamed to ids and type changed to string[]"); + } + // TODO webpack 6 remove + getId() { + throw new Error("id was renamed to ids and type changed to string[]"); + } -const { find } = __webpack_require__(93347); -const { - compareModulesByPreOrderIndexOrIdentifier, - compareModulesByPostOrderIndexOrIdentifier -} = __webpack_require__(29579); + // TODO webpack 6 remove + setId() { + throw new Error("id was renamed to ids and type changed to string[]"); + } -/** @typedef {import("../Compiler")} Compiler */ + get type() { + return "harmony export imported specifier"; + } -class ChunkModuleIdRangePlugin { - constructor(options) { - this.options = options; + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {string[]} the imported id + */ + getIds(moduleGraph) { + return moduleGraph.getMeta(this)[idsSymbol] || this.ids; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {ModuleGraph} moduleGraph the module graph + * @param {string[]} ids the imported ids * @returns {void} */ - apply(compiler) { - const options = this.options; - compiler.hooks.compilation.tap("ChunkModuleIdRangePlugin", compilation => { - const moduleGraph = compilation.moduleGraph; - compilation.hooks.moduleIds.tap("ChunkModuleIdRangePlugin", modules => { - const chunkGraph = compilation.chunkGraph; - const chunk = find( - compilation.chunks, - chunk => chunk.name === options.name - ); - if (!chunk) { - throw new Error( - `ChunkModuleIdRangePlugin: Chunk with name '${options.name}"' was not found` - ); - } - - let chunkModules; - if (options.order) { - let cmpFn; - switch (options.order) { - case "index": - case "preOrderIndex": - cmpFn = compareModulesByPreOrderIndexOrIdentifier(moduleGraph); - break; - case "index2": - case "postOrderIndex": - cmpFn = compareModulesByPostOrderIndexOrIdentifier(moduleGraph); - break; - default: - throw new Error( - "ChunkModuleIdRangePlugin: unexpected value of order" - ); - } - chunkModules = chunkGraph.getOrderedChunkModules(chunk, cmpFn); - } else { - chunkModules = Array.from(modules) - .filter(m => { - return chunkGraph.isModuleInChunk(m, chunk); - }) - .sort(compareModulesByPreOrderIndexOrIdentifier(moduleGraph)); - } + setIds(moduleGraph, ids) { + moduleGraph.getMeta(this)[idsSymbol] = ids; + } - let currentId = options.start || 0; - for (let i = 0; i < chunkModules.length; i++) { - const m = chunkModules[i]; - if (m.needId && chunkGraph.getModuleId(m) === null) { - chunkGraph.setModuleId(m, currentId++); - } - if (options.end && currentId > options.end) break; - } - }); - }); + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {RuntimeSpec} runtime the runtime + * @returns {ExportMode} the export mode + */ + getMode(moduleGraph, runtime) { + return moduleGraph.dependencyCacheProvide( + this, + getRuntimeKey(runtime), + getMode + ); } -} -module.exports = ChunkModuleIdRangePlugin; + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {RuntimeSpec} runtime the runtime + * @param {ExportsInfo} exportsInfo exports info about the current module (optional) + * @param {Module} importedModule the imported module (optional) + * @returns {{exports?: Set, checked?: Set, ignoredExports: Set, hidden?: Set}} information + */ + getStarReexports( + moduleGraph, + runtime, + exportsInfo = moduleGraph.getExportsInfo(moduleGraph.getParentModule(this)), + importedModule = moduleGraph.getModule(this) + ) { + const importedExportsInfo = moduleGraph.getExportsInfo(importedModule); -/***/ }), + const noExtraExports = + importedExportsInfo.otherExportsInfo.provided === false; + const noExtraImports = + exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused; -/***/ 8747: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + const ignoredExports = new Set(["default", ...this.activeExports]); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent -*/ + let hiddenExports = undefined; + const otherStarExports = + this._discoverActiveExportsFromOtherStarExports(moduleGraph); + if (otherStarExports !== undefined) { + hiddenExports = new Set(); + for (let i = 0; i < otherStarExports.namesSlice; i++) { + hiddenExports.add(otherStarExports.names[i]); + } + for (const e of ignoredExports) hiddenExports.delete(e); + } + if (!noExtraExports && !noExtraImports) { + return { + ignoredExports, + hidden: hiddenExports + }; + } + /** @type {Set} */ + const exports = new Set(); + /** @type {Set} */ + const checked = new Set(); + /** @type {Set} */ + const hidden = hiddenExports !== undefined ? new Set() : undefined; -const { compareChunksNatural } = __webpack_require__(29579); -const { - getFullChunkName, - getUsedChunkIds, - assignDeterministicIds -} = __webpack_require__(63290); + if (noExtraImports) { + for (const exportInfo of exportsInfo.orderedExports) { + const name = exportInfo.name; + if (ignoredExports.has(name)) continue; + if (exportInfo.getUsed(runtime) === UsageState.Unused) continue; + const importedExportInfo = + importedExportsInfo.getReadOnlyExportInfo(name); + if (importedExportInfo.provided === false) continue; + if (hiddenExports !== undefined && hiddenExports.has(name)) { + hidden.add(name); + continue; + } + exports.add(name); + if (importedExportInfo.provided === true) continue; + checked.add(name); + } + } else if (noExtraExports) { + for (const importedExportInfo of importedExportsInfo.orderedExports) { + const name = importedExportInfo.name; + if (ignoredExports.has(name)) continue; + if (importedExportInfo.provided === false) continue; + const exportInfo = exportsInfo.getReadOnlyExportInfo(name); + if (exportInfo.getUsed(runtime) === UsageState.Unused) continue; + if (hiddenExports !== undefined && hiddenExports.has(name)) { + hidden.add(name); + continue; + } + exports.add(name); + if (importedExportInfo.provided === true) continue; + checked.add(name); + } + } -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ + return { ignoredExports, exports, checked, hidden }; + } -class DeterministicChunkIdsPlugin { - constructor(options) { - this.options = options || {}; + /** + * @param {ModuleGraph} moduleGraph module graph + * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active + */ + getCondition(moduleGraph) { + return (connection, runtime) => { + const mode = this.getMode(moduleGraph, runtime); + return mode.type !== "unused" && mode.type !== "empty-star"; + }; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this dependency connects the module to referencing modules */ - apply(compiler) { - compiler.hooks.compilation.tap( - "DeterministicChunkIdsPlugin", - compilation => { - compilation.hooks.chunkIds.tap( - "DeterministicChunkIdsPlugin", - chunks => { - const chunkGraph = compilation.chunkGraph; - const context = this.options.context - ? this.options.context - : compiler.context; - const maxLength = this.options.maxLength || 3; + getModuleEvaluationSideEffectsState(moduleGraph) { + return false; + } - const compareNatural = compareChunksNatural(chunkGraph); + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + const mode = this.getMode(moduleGraph, runtime); - const usedIds = getUsedChunkIds(compilation); - assignDeterministicIds( - Array.from(chunks).filter(chunk => { - return chunk.id === null; - }), - chunk => - getFullChunkName(chunk, chunkGraph, context, compiler.root), - compareNatural, - (chunk, id) => { - const size = usedIds.size; - usedIds.add(`${id}`); - if (size === usedIds.size) return false; - chunk.id = id; - chunk.ids = [id]; - return true; - }, - [Math.pow(10, maxLength)], - 10, - usedIds.size - ); - } + switch (mode.type) { + case "missing": + case "unused": + case "empty-star": + case "reexport-undefined": + return Dependency.NO_EXPORTS_REFERENCED; + + case "reexport-dynamic-default": + return Dependency.EXPORTS_OBJECT_REFERENCED; + + case "reexport-named-default": { + if (!mode.partialNamespaceExportInfo) + return Dependency.EXPORTS_OBJECT_REFERENCED; + /** @type {string[][]} */ + const referencedExports = []; + processExportInfo( + runtime, + referencedExports, + [], + /** @type {ExportInfo} */ (mode.partialNamespaceExportInfo) ); + return referencedExports; } - ); + + case "reexport-namespace-object": + case "reexport-fake-namespace-object": { + if (!mode.partialNamespaceExportInfo) + return Dependency.EXPORTS_OBJECT_REFERENCED; + /** @type {string[][]} */ + const referencedExports = []; + processExportInfo( + runtime, + referencedExports, + [], + /** @type {ExportInfo} */ (mode.partialNamespaceExportInfo), + mode.type === "reexport-fake-namespace-object" + ); + return referencedExports; + } + + case "dynamic-reexport": + return Dependency.EXPORTS_OBJECT_REFERENCED; + + case "normal-reexport": { + const referencedExports = []; + for (const { ids, exportInfo, hidden } of mode.items) { + if (hidden) continue; + processExportInfo(runtime, referencedExports, ids, exportInfo, false); + } + return referencedExports; + } + + default: + throw new Error(`Unknown mode ${mode.type}`); + } } -} -module.exports = DeterministicChunkIdsPlugin; + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {{ names: string[], namesSlice: number, dependencyIndices: number[], dependencyIndex: number } | undefined} exported names and their origin dependency + */ + _discoverActiveExportsFromOtherStarExports(moduleGraph) { + if (!this.otherStarExports) return undefined; + const i = + "length" in this.otherStarExports + ? this.otherStarExports.length + : countIterable(this.otherStarExports); + if (i === 0) return undefined; -/***/ }), + if (this.allStarExports) { + const { names, dependencyIndices } = moduleGraph.cached( + determineExportAssignments, + this.allStarExports.dependencies + ); -/***/ 76692: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + return { + names, + namesSlice: dependencyIndices[i - 1], + dependencyIndices, + dependencyIndex: i + }; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent -*/ + const { names, dependencyIndices } = moduleGraph.cached( + determineExportAssignments, + this.otherStarExports, + this + ); + return { + names, + namesSlice: dependencyIndices[i - 1], + dependencyIndices, + dependencyIndex: i + }; + } + /** + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names + */ + getExports(moduleGraph) { + const mode = this.getMode(moduleGraph, undefined); -const { - compareModulesByPreOrderIndexOrIdentifier -} = __webpack_require__(29579); -const { - getUsedModuleIdsAndModules, - getFullModuleName, - assignDeterministicIds -} = __webpack_require__(63290); + switch (mode.type) { + case "missing": + return undefined; + case "dynamic-reexport": { + const from = moduleGraph.getConnection(this); + return { + exports: true, + from, + canMangle: false, + excludeExports: mode.hidden + ? combine(mode.ignored, mode.hidden) + : mode.ignored, + hideExports: mode.hidden, + dependencies: [from.module] + }; + } + case "empty-star": + return { + exports: [], + hideExports: mode.hidden, + dependencies: [moduleGraph.getModule(this)] + }; + // falls through + case "normal-reexport": { + const from = moduleGraph.getConnection(this); + return { + exports: Array.from(mode.items, item => ({ + name: item.name, + from, + export: item.ids, + hidden: item.hidden + })), + priority: 1, + dependencies: [from.module] + }; + } + case "reexport-dynamic-default": { + { + const from = moduleGraph.getConnection(this); + return { + exports: [ + { + name: mode.name, + from, + export: ["default"] + } + ], + priority: 1, + dependencies: [from.module] + }; + } + } + case "reexport-undefined": + return { + exports: [mode.name], + dependencies: [moduleGraph.getModule(this)] + }; + case "reexport-fake-namespace-object": { + const from = moduleGraph.getConnection(this); + return { + exports: [ + { + name: mode.name, + from, + export: null, + exports: [ + { + name: "default", + canMangle: false, + from, + export: null + } + ] + } + ], + priority: 1, + dependencies: [from.module] + }; + } + case "reexport-namespace-object": { + const from = moduleGraph.getConnection(this); + return { + exports: [ + { + name: mode.name, + from, + export: null + } + ], + priority: 1, + dependencies: [from.module] + }; + } + case "reexport-named-default": { + const from = moduleGraph.getConnection(this); + return { + exports: [ + { + name: mode.name, + from, + export: ["default"] + } + ], + priority: 1, + dependencies: [from.module] + }; + } + default: + throw new Error(`Unknown mode ${mode.type}`); + } + } -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ + /** + * @param {ModuleGraph} moduleGraph module graph + * @returns {number} effective mode + */ + _getEffectiveExportPresenceLevel(moduleGraph) { + if (this.exportPresenceMode !== ExportPresenceModes.AUTO) + return this.exportPresenceMode; + return moduleGraph.getParentModule(this).buildMeta.strictHarmonyModule + ? ExportPresenceModes.ERROR + : ExportPresenceModes.WARN; + } -class DeterministicModuleIdsPlugin { /** - * @param {Object} options options - * @param {string=} options.context context relative to which module identifiers are computed - * @param {function(Module): boolean=} options.test selector function for modules - * @param {number=} options.maxLength maximum id length in digits (used as starting point) - * @param {number=} options.salt hash salt for ids - * @param {boolean=} options.fixedLength do not increase the maxLength to find an optimal id space size - * @param {boolean=} options.failOnConflict throw an error when id conflicts occur (instead of rehashing) + * Returns warnings + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[]} warnings */ - constructor(options = {}) { - this.options = options; + getWarnings(moduleGraph) { + const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); + if (exportsPresence === ExportPresenceModes.WARN) { + return this._getErrors(moduleGraph); + } + return null; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * Returns errors + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[]} errors */ - apply(compiler) { - compiler.hooks.compilation.tap( - "DeterministicModuleIdsPlugin", - compilation => { - compilation.hooks.moduleIds.tap("DeterministicModuleIdsPlugin", () => { - const chunkGraph = compilation.chunkGraph; - const context = this.options.context - ? this.options.context - : compiler.context; - const maxLength = this.options.maxLength || 3; - const failOnConflict = this.options.failOnConflict || false; - const fixedLength = this.options.fixedLength || false; - const salt = this.options.salt || 0; - let conflicts = 0; + getErrors(moduleGraph) { + const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); + if (exportsPresence === ExportPresenceModes.ERROR) { + return this._getErrors(moduleGraph); + } + return null; + } - const [usedIds, modules] = getUsedModuleIdsAndModules( - compilation, - this.options.test - ); - assignDeterministicIds( - modules, - module => getFullModuleName(module, context, compiler.root), - failOnConflict - ? () => 0 - : compareModulesByPreOrderIndexOrIdentifier( - compilation.moduleGraph - ), - (module, id) => { - const size = usedIds.size; - usedIds.add(`${id}`); - if (size === usedIds.size) { - conflicts++; - return false; - } - chunkGraph.setModuleId(module, id); - return true; - }, - [Math.pow(10, maxLength)], - fixedLength ? 0 : 10, - usedIds.size, - salt - ); - if (failOnConflict && conflicts) - throw new Error( - `Assigning deterministic module ids has lead to ${conflicts} conflict${ - conflicts > 1 ? "s" : "" - }.\nIncrease the 'maxLength' to increase the id space and make conflicts less likely (recommended when there are many conflicts or application is expected to grow), or add an 'salt' number to try another hash starting value in the same id space (recommended when there is only a single conflict).` + /** + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[] | undefined} errors + */ + _getErrors(moduleGraph) { + const ids = this.getIds(moduleGraph); + let errors = this.getLinkingErrors( + moduleGraph, + ids, + `(reexported as '${this.name}')` + ); + if (ids.length === 0 && this.name === null) { + const potentialConflicts = + this._discoverActiveExportsFromOtherStarExports(moduleGraph); + if (potentialConflicts && potentialConflicts.namesSlice > 0) { + const ownNames = new Set( + potentialConflicts.names.slice( + potentialConflicts.namesSlice, + potentialConflicts.dependencyIndices[ + potentialConflicts.dependencyIndex + ] + ) + ); + const importedModule = moduleGraph.getModule(this); + if (importedModule) { + const exportsInfo = moduleGraph.getExportsInfo(importedModule); + const conflicts = new Map(); + for (const exportInfo of exportsInfo.orderedExports) { + if (exportInfo.provided !== true) continue; + if (exportInfo.name === "default") continue; + if (this.activeExports.has(exportInfo.name)) continue; + if (ownNames.has(exportInfo.name)) continue; + const conflictingDependency = findDependencyForName( + potentialConflicts, + exportInfo.name, + this.allStarExports + ? this.allStarExports.dependencies + : [...this.otherStarExports, this] ); - }); + if (!conflictingDependency) continue; + const target = exportInfo.getTerminalBinding(moduleGraph); + if (!target) continue; + const conflictingModule = moduleGraph.getModule( + conflictingDependency + ); + if (conflictingModule === importedModule) continue; + const conflictingExportInfo = moduleGraph.getExportInfo( + conflictingModule, + exportInfo.name + ); + const conflictingTarget = + conflictingExportInfo.getTerminalBinding(moduleGraph); + if (!conflictingTarget) continue; + if (target === conflictingTarget) continue; + const list = conflicts.get(conflictingDependency.request); + if (list === undefined) { + conflicts.set(conflictingDependency.request, [exportInfo.name]); + } else { + list.push(exportInfo.name); + } + } + for (const [request, exports] of conflicts) { + if (!errors) errors = []; + errors.push( + new HarmonyLinkingError( + `The requested module '${ + this.request + }' contains conflicting star exports for the ${ + exports.length > 1 ? "names" : "name" + } ${exports + .map(e => `'${e}'`) + .join(", ")} with the previous requested module '${request}'` + ) + ); + } + } } - ); + } + return errors; } -} - -module.exports = DeterministicModuleIdsPlugin; - - -/***/ }), - -/***/ 21825: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + serialize(context) { + const { write, setCircularReference } = context; + setCircularReference(this); + write(this.ids); + write(this.name); + write(this.activeExports); + write(this.otherStarExports); + write(this.exportPresenceMode); + write(this.allStarExports); + super.serialize(context); + } -const { - compareModulesByPreOrderIndexOrIdentifier -} = __webpack_require__(29579); -const createSchemaValidation = __webpack_require__(32540); -const createHash = __webpack_require__(49835); -const { - getUsedModuleIdsAndModules, - getFullModuleName -} = __webpack_require__(63290); + deserialize(context) { + const { read, setCircularReference } = context; -/** @typedef {import("../../declarations/plugins/HashedModuleIdsPlugin").HashedModuleIdsPluginOptions} HashedModuleIdsPluginOptions */ + setCircularReference(this); + this.ids = read(); + this.name = read(); + this.activeExports = read(); + this.otherStarExports = read(); + this.exportPresenceMode = read(); + this.allStarExports = read(); -const validate = createSchemaValidation( - __webpack_require__(52210), - () => __webpack_require__(59106), - { - name: "Hashed Module Ids Plugin", - baseDataPath: "options" + super.deserialize(context); } +} + +makeSerializable( + HarmonyExportImportedSpecifierDependency, + "webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency" ); -class HashedModuleIdsPlugin { +module.exports = HarmonyExportImportedSpecifierDependency; + +HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedSpecifierDependencyTemplate extends ( + HarmonyImportDependency.Template +) { /** - * @param {HashedModuleIdsPluginOptions=} options options object + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - constructor(options = {}) { - validate(options); + apply(dependency, source, templateContext) { + const { moduleGraph, runtime, concatenationScope } = templateContext; - /** @type {HashedModuleIdsPluginOptions} */ - this.options = { - context: null, - hashFunction: "md4", - hashDigest: "base64", - hashDigestLength: 4, - ...options - }; - } + const dep = /** @type {HarmonyExportImportedSpecifierDependency} */ ( + dependency + ); - apply(compiler) { - const options = this.options; - compiler.hooks.compilation.tap("HashedModuleIdsPlugin", compilation => { - compilation.hooks.moduleIds.tap("HashedModuleIdsPlugin", () => { - const chunkGraph = compilation.chunkGraph; - const context = this.options.context - ? this.options.context - : compiler.context; + const mode = dep.getMode(moduleGraph, runtime); - const [usedIds, modules] = getUsedModuleIdsAndModules(compilation); - const modulesInNaturalOrder = modules.sort( - compareModulesByPreOrderIndexOrIdentifier(compilation.moduleGraph) - ); - for (const module of modulesInNaturalOrder) { - const ident = getFullModuleName(module, context, compiler.root); - const hash = createHash(options.hashFunction); - hash.update(ident || ""); - const hashId = /** @type {string} */ ( - hash.digest(options.hashDigest) + if (concatenationScope) { + switch (mode.type) { + case "reexport-undefined": + concatenationScope.registerRawExport( + mode.name, + "/* reexport non-default export from non-harmony */ undefined" ); - let len = options.hashDigestLength; - while (usedIds.has(hashId.substr(0, len))) len++; - const moduleId = hashId.substr(0, len); - chunkGraph.setModuleId(module, moduleId); - usedIds.add(moduleId); - } - }); - }); - } -} - -module.exports = HashedModuleIdsPlugin; - - -/***/ }), + } + return; + } -/***/ 63290: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + if (mode.type !== "unused" && mode.type !== "empty-star") { + super.apply(dependency, source, templateContext); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + this._addExportFragments( + templateContext.initFragments, + dep, + mode, + templateContext.module, + moduleGraph, + runtime, + templateContext.runtimeTemplate, + templateContext.runtimeRequirements + ); + } + } + /** + * @param {InitFragment[]} initFragments target array for init fragments + * @param {HarmonyExportImportedSpecifierDependency} dep dependency + * @param {ExportMode} mode the export mode + * @param {Module} module the current module + * @param {ModuleGraph} moduleGraph the module graph + * @param {RuntimeSpec} runtime the runtime + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @param {Set} runtimeRequirements runtime requirements + * @returns {void} + */ + _addExportFragments( + initFragments, + dep, + mode, + module, + moduleGraph, + runtime, + runtimeTemplate, + runtimeRequirements + ) { + const importedModule = moduleGraph.getModule(dep); + const importVar = dep.getImportVar(moduleGraph); + switch (mode.type) { + case "missing": + case "empty-star": + initFragments.push( + new InitFragment( + "/* empty/unused harmony star reexport */\n", + InitFragment.STAGE_HARMONY_EXPORTS, + 1 + ) + ); + break; -const createHash = __webpack_require__(49835); -const { makePathsRelative } = __webpack_require__(82186); -const numberHash = __webpack_require__(70002); + case "unused": + initFragments.push( + new InitFragment( + `${Template.toNormalComment( + `unused harmony reexport ${mode.name}` + )}\n`, + InitFragment.STAGE_HARMONY_EXPORTS, + 1 + ) + ); + break; -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Module")} Module */ -/** @typedef {typeof import("../util/Hash")} Hash */ + case "reexport-dynamic-default": + initFragments.push( + this.getReexportFragment( + module, + "reexport default from dynamic", + moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), + importVar, + null, + runtimeRequirements + ) + ); + break; -/** - * @param {string} str string to hash - * @param {number} len max length of the hash - * @param {string | Hash} hashFunction hash function to use - * @returns {string} hash - */ -const getHash = (str, len, hashFunction) => { - const hash = createHash(hashFunction); - hash.update(str); - const digest = /** @type {string} */ (hash.digest("hex")); - return digest.substr(0, len); -}; + case "reexport-fake-namespace-object": + initFragments.push( + ...this.getReexportFakeNamespaceObjectFragments( + module, + moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), + importVar, + mode.fakeType, + runtimeRequirements + ) + ); + break; -/** - * @param {string} str the string - * @returns {string} string prefixed by an underscore if it is a number - */ -const avoidNumber = str => { - // max length of a number is 21 chars, bigger numbers a written as "...e+xx" - if (str.length > 21) return str; - const firstChar = str.charCodeAt(0); - // skip everything that doesn't look like a number - // charCodes: "-": 45, "1": 49, "9": 57 - if (firstChar < 49) { - if (firstChar !== 45) return str; - } else if (firstChar > 57) { - return str; - } - if (str === +str + "") { - return `_${str}`; - } - return str; -}; + case "reexport-undefined": + initFragments.push( + this.getReexportFragment( + module, + "reexport non-default export from non-harmony", + moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), + "undefined", + "", + runtimeRequirements + ) + ); + break; -/** - * @param {string} request the request - * @returns {string} id representation - */ -const requestToId = request => { - return request - .replace(/^(\.\.?\/)+/, "") - .replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_"); -}; -exports.requestToId = requestToId; + case "reexport-named-default": + initFragments.push( + this.getReexportFragment( + module, + "reexport default export from named module", + moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), + importVar, + "", + runtimeRequirements + ) + ); + break; -/** - * @param {string} string the string - * @param {string} delimiter separator for string and hash - * @param {string | Hash} hashFunction hash function to use - * @returns {string} string with limited max length to 100 chars - */ -const shortenLongString = (string, delimiter, hashFunction) => { - if (string.length < 100) return string; - return ( - string.slice(0, 100 - 6 - delimiter.length) + - delimiter + - getHash(string, 6, hashFunction) - ); -}; + case "reexport-namespace-object": + initFragments.push( + this.getReexportFragment( + module, + "reexport module object", + moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), + importVar, + "", + runtimeRequirements + ) + ); + break; -/** - * @param {Module} module the module - * @param {string} context context directory - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {string} short module name - */ -const getShortModuleName = (module, context, associatedObjectForCache) => { - const libIdent = module.libIdent({ context, associatedObjectForCache }); - if (libIdent) return avoidNumber(libIdent); - const nameForCondition = module.nameForCondition(); - if (nameForCondition) - return avoidNumber( - makePathsRelative(context, nameForCondition, associatedObjectForCache) - ); - return ""; -}; -exports.getShortModuleName = getShortModuleName; + case "normal-reexport": + for (const { name, ids, checked, hidden } of mode.items) { + if (hidden) continue; + if (checked) { + initFragments.push( + new InitFragment( + "/* harmony reexport (checked) */ " + + this.getConditionalReexportStatement( + module, + name, + importVar, + ids, + runtimeRequirements + ), + moduleGraph.isAsync(importedModule) + ? InitFragment.STAGE_ASYNC_HARMONY_IMPORTS + : InitFragment.STAGE_HARMONY_IMPORTS, + dep.sourceOrder + ) + ); + } else { + initFragments.push( + this.getReexportFragment( + module, + "reexport safe", + moduleGraph.getExportsInfo(module).getUsedName(name, runtime), + importVar, + moduleGraph + .getExportsInfo(importedModule) + .getUsedName(ids, runtime), + runtimeRequirements + ) + ); + } + } + break; -/** - * @param {string} shortName the short name - * @param {Module} module the module - * @param {string} context context directory - * @param {string | Hash} hashFunction hash function to use - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {string} long module name - */ -const getLongModuleName = ( - shortName, - module, - context, - hashFunction, - associatedObjectForCache -) => { - const fullName = getFullModuleName(module, context, associatedObjectForCache); - return `${shortName}?${getHash(fullName, 4, hashFunction)}`; -}; -exports.getLongModuleName = getLongModuleName; + case "dynamic-reexport": { + const ignored = mode.hidden + ? combine(mode.ignored, mode.hidden) + : mode.ignored; + const modern = + runtimeTemplate.supportsConst() && + runtimeTemplate.supportsArrowFunction(); + let content = + "/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};\n" + + `/* harmony reexport (unknown) */ for(${ + modern ? "const" : "var" + } __WEBPACK_IMPORT_KEY__ in ${importVar}) `; -/** - * @param {Module} module the module - * @param {string} context context directory - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {string} full module name - */ -const getFullModuleName = (module, context, associatedObjectForCache) => { - return makePathsRelative( - context, - module.identifier(), - associatedObjectForCache - ); -}; -exports.getFullModuleName = getFullModuleName; + // Filter out exports which are defined by other exports + // and filter out default export because it cannot be reexported with * + if (ignored.size > 1) { + content += + "if(" + + JSON.stringify(Array.from(ignored)) + + ".indexOf(__WEBPACK_IMPORT_KEY__) < 0) "; + } else if (ignored.size === 1) { + content += `if(__WEBPACK_IMPORT_KEY__ !== ${JSON.stringify( + first(ignored) + )}) `; + } -/** - * @param {Chunk} chunk the chunk - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {string} context context directory - * @param {string} delimiter delimiter for names - * @param {string | Hash} hashFunction hash function to use - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {string} short chunk name - */ -const getShortChunkName = ( - chunk, - chunkGraph, - context, - delimiter, - hashFunction, - associatedObjectForCache -) => { - const modules = chunkGraph.getChunkRootModules(chunk); - const shortModuleNames = modules.map(m => - requestToId(getShortModuleName(m, context, associatedObjectForCache)) - ); - chunk.idNameHints.sort(); - const chunkName = Array.from(chunk.idNameHints) - .concat(shortModuleNames) - .filter(Boolean) - .join(delimiter); - return shortenLongString(chunkName, delimiter, hashFunction); -}; -exports.getShortChunkName = getShortChunkName; + content += `__WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = `; + if (modern) { + content += `() => ${importVar}[__WEBPACK_IMPORT_KEY__]`; + } else { + content += `function(key) { return ${importVar}[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)`; + } -/** - * @param {Chunk} chunk the chunk - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {string} context context directory - * @param {string} delimiter delimiter for names - * @param {string | Hash} hashFunction hash function to use - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {string} short chunk name - */ -const getLongChunkName = ( - chunk, - chunkGraph, - context, - delimiter, - hashFunction, - associatedObjectForCache -) => { - const modules = chunkGraph.getChunkRootModules(chunk); - const shortModuleNames = modules.map(m => - requestToId(getShortModuleName(m, context, associatedObjectForCache)) - ); - const longModuleNames = modules.map(m => - requestToId( - getLongModuleName("", m, context, hashFunction, associatedObjectForCache) - ) - ); - chunk.idNameHints.sort(); - const chunkName = Array.from(chunk.idNameHints) - .concat(shortModuleNames, longModuleNames) - .filter(Boolean) - .join(delimiter); - return shortenLongString(chunkName, delimiter, hashFunction); -}; -exports.getLongChunkName = getLongChunkName; + runtimeRequirements.add(RuntimeGlobals.exports); + runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); -/** - * @param {Chunk} chunk the chunk - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {string} context context directory - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {string} full chunk name - */ -const getFullChunkName = ( - chunk, - chunkGraph, - context, - associatedObjectForCache -) => { - if (chunk.name) return chunk.name; - const modules = chunkGraph.getChunkRootModules(chunk); - const fullModuleNames = modules.map(m => - makePathsRelative(context, m.identifier(), associatedObjectForCache) - ); - return fullModuleNames.join(); -}; -exports.getFullChunkName = getFullChunkName; + const exportsName = module.exportsArgument; + initFragments.push( + new InitFragment( + `${content}\n/* harmony reexport (unknown) */ ${RuntimeGlobals.definePropertyGetters}(${exportsName}, __WEBPACK_REEXPORT_OBJECT__);\n`, + moduleGraph.isAsync(importedModule) + ? InitFragment.STAGE_ASYNC_HARMONY_IMPORTS + : InitFragment.STAGE_HARMONY_IMPORTS, + dep.sourceOrder + ) + ); + break; + } -/** - * @template K - * @template V - * @param {Map} map a map from key to values - * @param {K} key key - * @param {V} value value - * @returns {void} - */ -const addToMapOfItems = (map, key, value) => { - let array = map.get(key); - if (array === undefined) { - array = []; - map.set(key, array); + default: + throw new Error(`Unknown mode ${mode.type}`); + } } - array.push(value); -}; -/** - * @param {Compilation} compilation the compilation - * @param {function(Module): boolean=} filter filter modules - * @returns {[Set, Module[]]} used module ids as strings and modules without id matching the filter - */ -const getUsedModuleIdsAndModules = (compilation, filter) => { - const chunkGraph = compilation.chunkGraph; + getReexportFragment( + module, + comment, + key, + name, + valueKey, + runtimeRequirements + ) { + const returnValue = this.getReturnValue(name, valueKey); - const modules = []; + runtimeRequirements.add(RuntimeGlobals.exports); + runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); - /** @type {Set} */ - const usedIds = new Set(); - if (compilation.usedModuleIds) { - for (const id of compilation.usedModuleIds) { - usedIds.add(id + ""); - } - } + const map = new Map(); + map.set(key, `/* ${comment} */ ${returnValue}`); - for (const module of compilation.modules) { - if (!module.needId) continue; - const moduleId = chunkGraph.getModuleId(module); - if (moduleId !== null) { - usedIds.add(moduleId + ""); - } else { - if ( - (!filter || filter(module)) && - chunkGraph.getNumberOfModuleChunks(module) !== 0 - ) { - modules.push(module); - } - } + return new HarmonyExportInitFragment(module.exportsArgument, map); } - return [usedIds, modules]; -}; -exports.getUsedModuleIdsAndModules = getUsedModuleIdsAndModules; + getReexportFakeNamespaceObjectFragments( + module, + key, + name, + fakeType, + runtimeRequirements + ) { + runtimeRequirements.add(RuntimeGlobals.exports); + runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); + runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); -/** - * @param {Compilation} compilation the compilation - * @returns {Set} used chunk ids as strings - */ -const getUsedChunkIds = compilation => { - /** @type {Set} */ - const usedIds = new Set(); - if (compilation.usedChunkIds) { - for (const id of compilation.usedChunkIds) { - usedIds.add(id + ""); - } + const map = new Map(); + map.set( + key, + `/* reexport fake namespace object from non-harmony */ ${name}_namespace_cache || (${name}_namespace_cache = ${ + RuntimeGlobals.createFakeNamespaceObject + }(${name}${fakeType ? `, ${fakeType}` : ""}))` + ); + + return [ + new InitFragment( + `var ${name}_namespace_cache;\n`, + InitFragment.STAGE_CONSTANTS, + -1, + `${name}_namespace_cache` + ), + new HarmonyExportInitFragment(module.exportsArgument, map) + ]; } - for (const chunk of compilation.chunks) { - const chunkId = chunk.id; - if (chunkId !== null) { - usedIds.add(chunkId + ""); + getConditionalReexportStatement( + module, + key, + name, + valueKey, + runtimeRequirements + ) { + if (valueKey === false) { + return "/* unused export */\n"; } - } - return usedIds; -}; -exports.getUsedChunkIds = getUsedChunkIds; + const exportsName = module.exportsArgument; + const returnValue = this.getReturnValue(name, valueKey); -/** - * @template T - * @param {Iterable} items list of items to be named - * @param {function(T): string} getShortName get a short name for an item - * @param {function(T, string): string} getLongName get a long name for an item - * @param {function(T, T): -1|0|1} comparator order of items - * @param {Set} usedIds already used ids, will not be assigned - * @param {function(T, string): void} assignName assign a name to an item - * @returns {T[]} list of items without a name - */ -const assignNames = ( - items, - getShortName, - getLongName, - comparator, - usedIds, - assignName -) => { - /** @type {Map} */ - const nameToItems = new Map(); + runtimeRequirements.add(RuntimeGlobals.exports); + runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); + runtimeRequirements.add(RuntimeGlobals.hasOwnProperty); - for (const item of items) { - const name = getShortName(item); - addToMapOfItems(nameToItems, name, item); + return `if(${RuntimeGlobals.hasOwnProperty}(${name}, ${JSON.stringify( + valueKey[0] + )})) ${ + RuntimeGlobals.definePropertyGetters + }(${exportsName}, { ${JSON.stringify( + key + )}: function() { return ${returnValue}; } });\n`; } - /** @type {Map} */ - const nameToItems2 = new Map(); - - for (const [name, items] of nameToItems) { - if (items.length > 1 || !name) { - for (const item of items) { - const longName = getLongName(item, name); - addToMapOfItems(nameToItems2, longName, item); - } - } else { - addToMapOfItems(nameToItems2, name, items[0]); + getReturnValue(name, valueKey) { + if (valueKey === null) { + return `${name}_default.a`; } - } - /** @type {T[]} */ - const unnamedItems = []; + if (valueKey === "") { + return name; + } - for (const [name, items] of nameToItems2) { - if (!name) { - for (const item of items) { - unnamedItems.push(item); - } - } else if (items.length === 1 && !usedIds.has(name)) { - assignName(items[0], name); - usedIds.add(name); - } else { - items.sort(comparator); - let i = 0; - for (const item of items) { - while (nameToItems2.has(name + i) && usedIds.has(name + i)) i++; - assignName(item, name + i); - usedIds.add(name + i); - i++; - } + if (valueKey === false) { + return "/* unused export */ undefined"; } - } - unnamedItems.sort(comparator); - return unnamedItems; + return `${name}${propertyAccess(valueKey)}`; + } }; -exports.assignNames = assignNames; - -/** - * @template T - * @param {T[]} items list of items to be named - * @param {function(T): string} getName get a name for an item - * @param {function(T, T): -1|0|1} comparator order of items - * @param {function(T, number): boolean} assignId assign an id to an item - * @param {number[]} ranges usable ranges for ids - * @param {number} expandFactor factor to create more ranges - * @param {number} extraSpace extra space to allocate, i. e. when some ids are already used - * @param {number} salt salting number to initialize hashing - * @returns {void} - */ -const assignDeterministicIds = ( - items, - getName, - comparator, - assignId, - ranges = [10], - expandFactor = 10, - extraSpace = 0, - salt = 0 -) => { - items.sort(comparator); - - // max 5% fill rate - const optimalRange = Math.min( - Math.ceil(items.length * 20) + extraSpace, - Number.MAX_SAFE_INTEGER - ); - let i = 0; - let range = ranges[i]; - while (range < optimalRange) { - i++; - if (i < ranges.length) { - range = Math.min(ranges[i], Number.MAX_SAFE_INTEGER); - } else if (expandFactor) { - range = Math.min(range * expandFactor, Number.MAX_SAFE_INTEGER); - } else { - break; - } +class HarmonyStarExportsList { + constructor() { + /** @type {HarmonyExportImportedSpecifierDependency[]} */ + this.dependencies = []; } - for (const item of items) { - const ident = getName(item); - let id; - let i = salt; - do { - id = numberHash(ident + i++, range); - } while (!assignId(item, id)); + /** + * @param {HarmonyExportImportedSpecifierDependency} dep dependency + * @returns {void} + */ + push(dep) { + this.dependencies.push(dep); } -}; -exports.assignDeterministicIds = assignDeterministicIds; -/** - * @param {Set} usedIds used ids - * @param {Iterable} modules the modules - * @param {Compilation} compilation the compilation - * @returns {void} - */ -const assignAscendingModuleIds = (usedIds, modules, compilation) => { - const chunkGraph = compilation.chunkGraph; + slice() { + return this.dependencies.slice(); + } - let nextId = 0; - let assignId; - if (usedIds.size > 0) { - assignId = module => { - if (chunkGraph.getModuleId(module) === null) { - while (usedIds.has(nextId + "")) nextId++; - chunkGraph.setModuleId(module, nextId++); - } - }; - } else { - assignId = module => { - if (chunkGraph.getModuleId(module) === null) { - chunkGraph.setModuleId(module, nextId++); - } - }; + serialize({ write, setCircularReference }) { + setCircularReference(this); + write(this.dependencies); } - for (const module of modules) { - assignId(module); + + deserialize({ read, setCircularReference }) { + setCircularReference(this); + this.dependencies = read(); } -}; -exports.assignAscendingModuleIds = assignAscendingModuleIds; +} -/** - * @param {Iterable} chunks the chunks - * @param {Compilation} compilation the compilation - * @returns {void} - */ -const assignAscendingChunkIds = (chunks, compilation) => { - const usedIds = getUsedChunkIds(compilation); +makeSerializable( + HarmonyStarExportsList, + "webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency", + "HarmonyStarExportsList" +); - let nextId = 0; - if (usedIds.size > 0) { - for (const chunk of chunks) { - if (chunk.id === null) { - while (usedIds.has(nextId + "")) nextId++; - chunk.id = nextId; - chunk.ids = [nextId]; - nextId++; - } - } - } else { - for (const chunk of chunks) { - if (chunk.id === null) { - chunk.id = nextId; - chunk.ids = [nextId]; - nextId++; - } - } - } -}; -exports.assignAscendingChunkIds = assignAscendingChunkIds; +module.exports.HarmonyStarExportsList = HarmonyStarExportsList; /***/ }), -/***/ 6454: +/***/ 89500: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -87328,85 +85623,169 @@ exports.assignAscendingChunkIds = assignAscendingChunkIds; -const { compareChunksNatural } = __webpack_require__(29579); -const { - getShortChunkName, - getLongChunkName, - assignNames, - getUsedChunkIds, - assignAscendingChunkIds -} = __webpack_require__(63290); +const InitFragment = __webpack_require__(55870); +const RuntimeGlobals = __webpack_require__(16475); +const { first } = __webpack_require__(93347); -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -class NamedChunkIdsPlugin { - constructor(options) { - this.delimiter = (options && options.delimiter) || "-"; - this.context = options && options.context; +const joinIterableWithComma = iterable => { + // This is more performant than Array.from().join(", ") + // as it doesn't create an array + let str = ""; + let first = true; + for (const item of iterable) { + if (first) { + first = false; + } else { + str += ", "; + } + str += item; } + return str; +}; + +const EMPTY_MAP = new Map(); +const EMPTY_SET = new Set(); +/** + * @typedef {GenerateContext} Context + */ +class HarmonyExportInitFragment extends InitFragment { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {string} exportsArgument the exports identifier + * @param {Map} exportMap mapping from used name to exposed variable name + * @param {Set} unusedExports list of unused export names */ - apply(compiler) { - compiler.hooks.compilation.tap("NamedChunkIdsPlugin", compilation => { - const { hashFunction } = compilation.outputOptions; - compilation.hooks.chunkIds.tap("NamedChunkIdsPlugin", chunks => { - const chunkGraph = compilation.chunkGraph; - const context = this.context ? this.context : compiler.context; - const delimiter = this.delimiter; + constructor( + exportsArgument, + exportMap = EMPTY_MAP, + unusedExports = EMPTY_SET + ) { + super(undefined, InitFragment.STAGE_HARMONY_EXPORTS, 1, "harmony-exports"); + this.exportsArgument = exportsArgument; + this.exportMap = exportMap; + this.unusedExports = unusedExports; + } - const unnamedChunks = assignNames( - Array.from(chunks).filter(chunk => { - if (chunk.name) { - chunk.id = chunk.name; - chunk.ids = [chunk.name]; - } - return chunk.id === null; - }), - chunk => - getShortChunkName( - chunk, - chunkGraph, - context, - delimiter, - hashFunction, - compiler.root - ), - chunk => - getLongChunkName( - chunk, - chunkGraph, - context, - delimiter, - hashFunction, - compiler.root - ), - compareChunksNatural(chunkGraph), - getUsedChunkIds(compilation), - (chunk, name) => { - chunk.id = name; - chunk.ids = [name]; + /** + * @param {HarmonyExportInitFragment[]} fragments all fragments to merge + * @returns {HarmonyExportInitFragment} merged fragment + */ + mergeAll(fragments) { + let exportMap; + let exportMapOwned = false; + let unusedExports; + let unusedExportsOwned = false; + + for (const fragment of fragments) { + if (fragment.exportMap.size !== 0) { + if (exportMap === undefined) { + exportMap = fragment.exportMap; + exportMapOwned = false; + } else { + if (!exportMapOwned) { + exportMap = new Map(exportMap); + exportMapOwned = true; + } + for (const [key, value] of fragment.exportMap) { + if (!exportMap.has(key)) exportMap.set(key, value); } - ); - if (unnamedChunks.length > 0) { - assignAscendingChunkIds(unnamedChunks, compilation); } - }); - }); + } + if (fragment.unusedExports.size !== 0) { + if (unusedExports === undefined) { + unusedExports = fragment.unusedExports; + unusedExportsOwned = false; + } else { + if (!unusedExportsOwned) { + unusedExports = new Set(unusedExports); + unusedExportsOwned = true; + } + for (const value of fragment.unusedExports) { + unusedExports.add(value); + } + } + } + } + return new HarmonyExportInitFragment( + this.exportsArgument, + exportMap, + unusedExports + ); + } + + merge(other) { + let exportMap; + if (this.exportMap.size === 0) { + exportMap = other.exportMap; + } else if (other.exportMap.size === 0) { + exportMap = this.exportMap; + } else { + exportMap = new Map(other.exportMap); + for (const [key, value] of this.exportMap) { + if (!exportMap.has(key)) exportMap.set(key, value); + } + } + let unusedExports; + if (this.unusedExports.size === 0) { + unusedExports = other.unusedExports; + } else if (other.unusedExports.size === 0) { + unusedExports = this.unusedExports; + } else { + unusedExports = new Set(other.unusedExports); + for (const value of this.unusedExports) { + unusedExports.add(value); + } + } + return new HarmonyExportInitFragment( + this.exportsArgument, + exportMap, + unusedExports + ); + } + + /** + * @param {Context} context context + * @returns {string|Source} the source code that will be included as initialization code + */ + getContent({ runtimeTemplate, runtimeRequirements }) { + runtimeRequirements.add(RuntimeGlobals.exports); + runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); + + const unusedPart = + this.unusedExports.size > 1 + ? `/* unused harmony exports ${joinIterableWithComma( + this.unusedExports + )} */\n` + : this.unusedExports.size > 0 + ? `/* unused harmony export ${first(this.unusedExports)} */\n` + : ""; + const definitions = []; + for (const [key, value] of this.exportMap) { + definitions.push( + `\n/* harmony export */ ${JSON.stringify( + key + )}: ${runtimeTemplate.returningFunction(value)}` + ); + } + const definePart = + this.exportMap.size > 0 + ? `/* harmony export */ ${RuntimeGlobals.definePropertyGetters}(${ + this.exportsArgument + }, {${definitions.join(",")}\n/* harmony export */ });\n` + : ""; + return `${definePart}${unusedPart}`; } } -module.exports = NamedChunkIdsPlugin; +module.exports = HarmonyExportInitFragment; /***/ }), -/***/ 24339: +/***/ 48567: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -87417,63 +85796,116 @@ module.exports = NamedChunkIdsPlugin; -const { compareModulesByIdentifier } = __webpack_require__(29579); -const { - getShortModuleName, - getLongModuleName, - assignNames, - getUsedModuleIdsAndModules, - assignAscendingModuleIds -} = __webpack_require__(63290); +const makeSerializable = __webpack_require__(33032); +const HarmonyExportInitFragment = __webpack_require__(89500); +const NullDependency = __webpack_require__(31830); -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -class NamedModuleIdsPlugin { - constructor(options) { - this.options = options || {}; +class HarmonyExportSpecifierDependency extends NullDependency { + constructor(id, name) { + super(); + this.id = id; + this.name = name; + } + + get type() { + return "harmony export specifier"; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names */ - apply(compiler) { - const { root } = compiler; - compiler.hooks.compilation.tap("NamedModuleIdsPlugin", compilation => { - const { hashFunction } = compilation.outputOptions; - compilation.hooks.moduleIds.tap("NamedModuleIdsPlugin", () => { - const chunkGraph = compilation.chunkGraph; - const context = this.options.context - ? this.options.context - : compiler.context; + getExports(moduleGraph) { + return { + exports: [this.name], + priority: 1, + terminalBinding: true, + dependencies: undefined + }; + } - const [usedIds, modules] = getUsedModuleIdsAndModules(compilation); - const unnamedModules = assignNames( - modules, - m => getShortModuleName(m, context, root), - (m, shortName) => - getLongModuleName(shortName, m, context, hashFunction, root), - compareModulesByIdentifier, - usedIds, - (m, name) => chunkGraph.setModuleId(m, name) - ); - if (unnamedModules.length > 0) { - assignAscendingModuleIds(usedIds, unnamedModules, compilation); - } - }); - }); + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this dependency connects the module to referencing modules + */ + getModuleEvaluationSideEffectsState(moduleGraph) { + return false; + } + + serialize(context) { + const { write } = context; + write(this.id); + write(this.name); + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + this.id = read(); + this.name = read(); + super.deserialize(context); + } +} + +makeSerializable( + HarmonyExportSpecifierDependency, + "webpack/lib/dependencies/HarmonyExportSpecifierDependency" +); + +HarmonyExportSpecifierDependency.Template = class HarmonyExportSpecifierDependencyTemplate extends ( + NullDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { module, moduleGraph, initFragments, runtime, concatenationScope } + ) { + const dep = /** @type {HarmonyExportSpecifierDependency} */ (dependency); + if (concatenationScope) { + concatenationScope.registerExport(dep.name, dep.id); + return; + } + const used = moduleGraph + .getExportsInfo(module) + .getUsedName(dep.name, runtime); + if (!used) { + const set = new Set(); + set.add(dep.name || "namespace"); + initFragments.push( + new HarmonyExportInitFragment(module.exportsArgument, undefined, set) + ); + return; + } + + const map = new Map(); + map.set(used, `/* binding */ ${dep.id}`); + initFragments.push( + new HarmonyExportInitFragment(module.exportsArgument, map, undefined) + ); } -} +}; -module.exports = NamedModuleIdsPlugin; +module.exports = HarmonyExportSpecifierDependency; /***/ }), -/***/ 86221: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 39211: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* @@ -87483,172 +85915,411 @@ module.exports = NamedModuleIdsPlugin; -const { compareChunksNatural } = __webpack_require__(29579); -const { assignAscendingChunkIds } = __webpack_require__(63290); +/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ +/** @type {WeakMap} */ +const parserStateExportsState = new WeakMap(); -class NaturalChunkIdsPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap("NaturalChunkIdsPlugin", compilation => { - compilation.hooks.chunkIds.tap("NaturalChunkIdsPlugin", chunks => { - const chunkGraph = compilation.chunkGraph; - const compareNatural = compareChunksNatural(chunkGraph); - const chunksInNaturalOrder = Array.from(chunks).sort(compareNatural); - assignAscendingChunkIds(chunksInNaturalOrder, compilation); - }); - }); +/** + * @param {ParserState} parserState parser state + * @param {boolean} isStrictHarmony strict harmony mode should be enabled + * @returns {void} + */ +exports.enable = (parserState, isStrictHarmony) => { + const value = parserStateExportsState.get(parserState); + if (value === false) return; + parserStateExportsState.set(parserState, true); + if (value !== true) { + parserState.module.buildMeta.exportsType = "namespace"; + parserState.module.buildInfo.strict = true; + parserState.module.buildInfo.exportsArgument = "__webpack_exports__"; + if (isStrictHarmony) { + parserState.module.buildMeta.strictHarmonyModule = true; + parserState.module.buildInfo.moduleArgument = "__webpack_module__"; + } } -} +}; -module.exports = NaturalChunkIdsPlugin; +/** + * @param {ParserState} parserState parser state + * @returns {boolean} true, when enabled + */ +exports.isEnabled = parserState => { + const value = parserStateExportsState.get(parserState); + return value === true; +}; /***/ }), -/***/ 83366: +/***/ 57154: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent + Author Tobias Koppers @sokra */ -const { - compareModulesByPreOrderIndexOrIdentifier -} = __webpack_require__(29579); -const { - assignAscendingModuleIds, - getUsedModuleIdsAndModules -} = __webpack_require__(63290); +const ConditionalInitFragment = __webpack_require__(61333); +const Dependency = __webpack_require__(54912); +const HarmonyLinkingError = __webpack_require__(97511); +const InitFragment = __webpack_require__(55870); +const Template = __webpack_require__(39722); +const AwaitDependenciesInitFragment = __webpack_require__(41153); +const { filterRuntime, mergeRuntime } = __webpack_require__(17156); +const ModuleDependency = __webpack_require__(80321); -/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ /** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -class NaturalModuleIdsPlugin { +const ExportPresenceModes = { + NONE: /** @type {0} */ (0), + WARN: /** @type {1} */ (1), + AUTO: /** @type {2} */ (2), + ERROR: /** @type {3} */ (3), + fromUserOption(str) { + switch (str) { + case "error": + return ExportPresenceModes.ERROR; + case "warn": + return ExportPresenceModes.WARN; + case "auto": + return ExportPresenceModes.AUTO; + case false: + return ExportPresenceModes.NONE; + default: + throw new Error(`Invalid export presence value ${str}`); + } + } +}; + +class HarmonyImportDependency extends ModuleDependency { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * + * @param {string} request request string + * @param {number} sourceOrder source order + * @param {Record=} assertions import assertions */ - apply(compiler) { - compiler.hooks.compilation.tap("NaturalModuleIdsPlugin", compilation => { - compilation.hooks.moduleIds.tap("NaturalModuleIdsPlugin", modules => { - const [usedIds, modulesInNaturalOrder] = - getUsedModuleIdsAndModules(compilation); - modulesInNaturalOrder.sort( - compareModulesByPreOrderIndexOrIdentifier(compilation.moduleGraph) - ); - assignAscendingModuleIds(usedIds, modulesInNaturalOrder, compilation); - }); - }); + constructor(request, sourceOrder, assertions) { + super(request); + this.sourceOrder = sourceOrder; + this.assertions = assertions; } -} -module.exports = NaturalModuleIdsPlugin; + get category() { + return "esm"; + } + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + return Dependency.NO_EXPORTS_REFERENCED; + } -/***/ }), + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {string} name of the variable for the import + */ + getImportVar(moduleGraph) { + const module = moduleGraph.getParentModule(this); + const meta = moduleGraph.getMeta(module); + let importVarMap = meta.importVarMap; + if (!importVarMap) meta.importVarMap = importVarMap = new Map(); + let importVar = importVarMap.get(moduleGraph.getModule(this)); + if (importVar) return importVar; + importVar = `${Template.toIdentifier( + `${this.userRequest}` + )}__WEBPACK_IMPORTED_MODULE_${importVarMap.size}__`; + importVarMap.set(moduleGraph.getModule(this), importVar); + return importVar; + } -/***/ 51020: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * @param {boolean} update create new variables or update existing one + * @param {DependencyTemplateContext} templateContext the template context + * @returns {[string, string]} the import statement and the compat statement + */ + getImportStatement( + update, + { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements } + ) { + return runtimeTemplate.importStatement({ + update, + module: moduleGraph.getModule(this), + chunkGraph, + importVar: this.getImportVar(moduleGraph), + request: this.request, + originModule: module, + runtimeRequirements + }); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {ModuleGraph} moduleGraph module graph + * @param {string[]} ids imported ids + * @param {string} additionalMessage extra info included in the error message + * @returns {WebpackError[] | undefined} errors + */ + getLinkingErrors(moduleGraph, ids, additionalMessage) { + const importedModule = moduleGraph.getModule(this); + // ignore errors for missing or failed modules + if (!importedModule || importedModule.getNumberOfErrors() > 0) { + return; + } + const parentModule = moduleGraph.getParentModule(this); + const exportsType = importedModule.getExportsType( + moduleGraph, + parentModule.buildMeta.strictHarmonyModule + ); + if (exportsType === "namespace" || exportsType === "default-with-named") { + if (ids.length === 0) { + return; + } + if ( + (exportsType !== "default-with-named" || ids[0] !== "default") && + moduleGraph.isExportProvided(importedModule, ids) === false + ) { + // We are sure that it's not provided -const { compareChunksNatural } = __webpack_require__(29579); -const createSchemaValidation = __webpack_require__(32540); -const { assignAscendingChunkIds } = __webpack_require__(63290); + // Try to provide detailed info in the error message + let pos = 0; + let exportsInfo = moduleGraph.getExportsInfo(importedModule); + while (pos < ids.length && exportsInfo) { + const id = ids[pos++]; + const exportInfo = exportsInfo.getReadOnlyExportInfo(id); + if (exportInfo.provided === false) { + // We are sure that it's not provided + const providedExports = exportsInfo.getProvidedExports(); + const moreInfo = !Array.isArray(providedExports) + ? " (possible exports unknown)" + : providedExports.length === 0 + ? " (module has no exports)" + : ` (possible exports: ${providedExports.join(", ")})`; + return [ + new HarmonyLinkingError( + `export ${ids + .slice(0, pos) + .map(id => `'${id}'`) + .join(".")} ${additionalMessage} was not found in '${ + this.userRequest + }'${moreInfo}` + ) + ]; + } + exportsInfo = exportInfo.getNestedExportsInfo(); + } -/** @typedef {import("../../declarations/plugins/ids/OccurrenceChunkIdsPlugin").OccurrenceChunkIdsPluginOptions} OccurrenceChunkIdsPluginOptions */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ + // General error message + return [ + new HarmonyLinkingError( + `export ${ids + .map(id => `'${id}'`) + .join(".")} ${additionalMessage} was not found in '${ + this.userRequest + }'` + ) + ]; + } + } + switch (exportsType) { + case "default-only": + // It's has only a default export + if (ids.length > 0 && ids[0] !== "default") { + // In strict harmony modules we only support the default export + return [ + new HarmonyLinkingError( + `Can't import the named export ${ids + .map(id => `'${id}'`) + .join( + "." + )} ${additionalMessage} from default-exporting module (only default export is available)` + ) + ]; + } + break; + case "default-with-named": + // It has a default export and named properties redirect + // In some cases we still want to warn here + if ( + ids.length > 0 && + ids[0] !== "default" && + importedModule.buildMeta.defaultObject === "redirect-warn" + ) { + // For these modules only the default export is supported + return [ + new HarmonyLinkingError( + `Should not import the named export ${ids + .map(id => `'${id}'`) + .join( + "." + )} ${additionalMessage} from default-exporting module (only default export is available soon)` + ) + ]; + } + break; + } + } -const validate = createSchemaValidation( - __webpack_require__(24344), - () => __webpack_require__(53576), - { - name: "Occurrence Order Chunk Ids Plugin", - baseDataPath: "options" + serialize(context) { + const { write } = context; + write(this.sourceOrder); + write(this.assertions); + super.serialize(context); } -); -class OccurrenceChunkIdsPlugin { - /** - * @param {OccurrenceChunkIdsPluginOptions=} options options object - */ - constructor(options = {}) { - validate(options); - this.options = options; + deserialize(context) { + const { read } = context; + this.sourceOrder = read(); + this.assertions = read(); + super.deserialize(context); } +} + +module.exports = HarmonyImportDependency; + +/** @type {WeakMap>} */ +const importEmittedMap = new WeakMap(); +HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate extends ( + ModuleDependency.Template +) { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply(compiler) { - const prioritiseInitial = this.options.prioritiseInitial; - compiler.hooks.compilation.tap("OccurrenceChunkIdsPlugin", compilation => { - compilation.hooks.chunkIds.tap("OccurrenceChunkIdsPlugin", chunks => { - const chunkGraph = compilation.chunkGraph; + apply(dependency, source, templateContext) { + const dep = /** @type {HarmonyImportDependency} */ (dependency); + const { module, chunkGraph, moduleGraph, runtime } = templateContext; - /** @type {Map} */ - const occursInInitialChunksMap = new Map(); + const connection = moduleGraph.getConnection(dep); + if (connection && !connection.isTargetActive(runtime)) return; - const compareNatural = compareChunksNatural(chunkGraph); + const referencedModule = connection && connection.module; - for (const c of chunks) { - let occurs = 0; - for (const chunkGroup of c.groupsIterable) { - for (const parent of chunkGroup.parentsIterable) { - if (parent.isInitial()) occurs++; - } - } - occursInInitialChunksMap.set(c, occurs); + if ( + connection && + connection.weak && + referencedModule && + chunkGraph.getModuleId(referencedModule) === null + ) { + // in weak references, module might not be in any chunk + // but that's ok, we don't need that logic in this case + return; + } + + const moduleKey = referencedModule + ? referencedModule.identifier() + : dep.request; + const key = `harmony import ${moduleKey}`; + + const runtimeCondition = dep.weak + ? false + : connection + ? filterRuntime(runtime, r => connection.isTargetActive(r)) + : true; + + if (module && referencedModule) { + let emittedModules = importEmittedMap.get(module); + if (emittedModules === undefined) { + emittedModules = new WeakMap(); + importEmittedMap.set(module, emittedModules); + } + let mergedRuntimeCondition = runtimeCondition; + const oldRuntimeCondition = emittedModules.get(referencedModule) || false; + if (oldRuntimeCondition !== false && mergedRuntimeCondition !== true) { + if (mergedRuntimeCondition === false || oldRuntimeCondition === true) { + mergedRuntimeCondition = oldRuntimeCondition; + } else { + mergedRuntimeCondition = mergeRuntime( + oldRuntimeCondition, + mergedRuntimeCondition + ); } + } + emittedModules.set(referencedModule, mergedRuntimeCondition); + } - const chunksInOccurrenceOrder = Array.from(chunks).sort((a, b) => { - if (prioritiseInitial) { - const aEntryOccurs = occursInInitialChunksMap.get(a); - const bEntryOccurs = occursInInitialChunksMap.get(b); - if (aEntryOccurs > bEntryOccurs) return -1; - if (aEntryOccurs < bEntryOccurs) return 1; - } - const aOccurs = a.getNumberOfGroups(); - const bOccurs = b.getNumberOfGroups(); - if (aOccurs > bOccurs) return -1; - if (aOccurs < bOccurs) return 1; - return compareNatural(a, b); - }); - assignAscendingChunkIds(chunksInOccurrenceOrder, compilation); - }); - }); + const importStatement = dep.getImportStatement(false, templateContext); + if ( + referencedModule && + templateContext.moduleGraph.isAsync(referencedModule) + ) { + templateContext.initFragments.push( + new ConditionalInitFragment( + importStatement[0], + InitFragment.STAGE_HARMONY_IMPORTS, + dep.sourceOrder, + key, + runtimeCondition + ) + ); + templateContext.initFragments.push( + new AwaitDependenciesInitFragment( + new Set([dep.getImportVar(templateContext.moduleGraph)]) + ) + ); + templateContext.initFragments.push( + new ConditionalInitFragment( + importStatement[1], + InitFragment.STAGE_ASYNC_HARMONY_IMPORTS, + dep.sourceOrder, + key + " compat", + runtimeCondition + ) + ); + } else { + templateContext.initFragments.push( + new ConditionalInitFragment( + importStatement[0] + importStatement[1], + InitFragment.STAGE_HARMONY_IMPORTS, + dep.sourceOrder, + key, + runtimeCondition + ) + ); + } } -} -module.exports = OccurrenceChunkIdsPlugin; + /** + * + * @param {Module} module the module + * @param {Module} referencedModule the referenced module + * @returns {RuntimeSpec | boolean} runtimeCondition in which this import has been emitted + */ + static getImportEmittedRuntime(module, referencedModule) { + const emittedModules = importEmittedMap.get(module); + if (emittedModules === undefined) return false; + return emittedModules.get(referencedModule) || false; + } +}; + +module.exports.ExportPresenceModes = ExportPresenceModes; /***/ }), -/***/ 35371: +/***/ 20862: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -87659,163 +86330,260 @@ module.exports = OccurrenceChunkIdsPlugin; -const { - compareModulesByPreOrderIndexOrIdentifier -} = __webpack_require__(29579); -const createSchemaValidation = __webpack_require__(32540); -const { - assignAscendingModuleIds, - getUsedModuleIdsAndModules -} = __webpack_require__(63290); +const HotModuleReplacementPlugin = __webpack_require__(6404); +const InnerGraph = __webpack_require__(38988); +const ConstDependency = __webpack_require__(76911); +const HarmonyAcceptDependency = __webpack_require__(23624); +const HarmonyAcceptImportDependency = __webpack_require__(99843); +const HarmonyExports = __webpack_require__(39211); +const { ExportPresenceModes } = __webpack_require__(57154); +const HarmonyImportSideEffectDependency = __webpack_require__(73132); +const HarmonyImportSpecifierDependency = __webpack_require__(14077); + +/** @typedef {import("estree").ExportAllDeclaration} ExportAllDeclaration */ +/** @typedef {import("estree").ExportNamedDeclaration} ExportNamedDeclaration */ +/** @typedef {import("estree").Identifier} Identifier */ +/** @typedef {import("estree").ImportDeclaration} ImportDeclaration */ +/** @typedef {import("estree").ImportExpression} ImportExpression */ +/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ +/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ +/** @typedef {import("../optimize/InnerGraph").InnerGraph} InnerGraph */ +/** @typedef {import("../optimize/InnerGraph").TopLevelSymbol} TopLevelSymbol */ +/** @typedef {import("./HarmonyImportDependency")} HarmonyImportDependency */ -/** @typedef {import("../../declarations/plugins/ids/OccurrenceModuleIdsPlugin").OccurrenceModuleIdsPluginOptions} OccurrenceModuleIdsPluginOptions */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ +const harmonySpecifierTag = Symbol("harmony import"); -const validate = createSchemaValidation( - __webpack_require__(14916), - () => __webpack_require__(19330), - { - name: "Occurrence Order Module Ids Plugin", - baseDataPath: "options" +/** + * @typedef {Object} HarmonySettings + * @property {string[]} ids + * @property {string} source + * @property {number} sourceOrder + * @property {string} name + * @property {boolean} await + * @property {Record | undefined} assertions + */ + +/** + * @param {ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | ImportExpression} node node with assertions + * @returns {Record | undefined} assertions + */ +function getAssertions(node) { + // TODO remove cast when @types/estree has been updated to import assertions + const assertions = /** @type {{ assertions?: ImportAttributeNode[] }} */ ( + node + ).assertions; + if (assertions === undefined) { + return undefined; } -); + const result = {}; + for (const assertion of assertions) { + const key = + assertion.key.type === "Identifier" + ? assertion.key.name + : assertion.key.value; + result[key] = assertion.value.value; + } + return result; +} -class OccurrenceModuleIdsPlugin { +module.exports = class HarmonyImportDependencyParserPlugin { /** - * @param {OccurrenceModuleIdsPluginOptions=} options options object + * @param {JavascriptParserOptions} options options */ - constructor(options = {}) { - validate(options); - this.options = options; + constructor(options) { + this.exportPresenceMode = + options.importExportsPresence !== undefined + ? ExportPresenceModes.fromUserOption(options.importExportsPresence) + : options.exportsPresence !== undefined + ? ExportPresenceModes.fromUserOption(options.exportsPresence) + : options.strictExportPresence + ? ExportPresenceModes.ERROR + : ExportPresenceModes.AUTO; + this.strictThisContextOnImports = options.strictThisContextOnImports; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {JavascriptParser} parser the parser * @returns {void} */ - apply(compiler) { - const prioritiseInitial = this.options.prioritiseInitial; - compiler.hooks.compilation.tap("OccurrenceModuleIdsPlugin", compilation => { - const moduleGraph = compilation.moduleGraph; - - compilation.hooks.moduleIds.tap("OccurrenceModuleIdsPlugin", () => { - const chunkGraph = compilation.chunkGraph; - - const [usedIds, modulesInOccurrenceOrder] = - getUsedModuleIdsAndModules(compilation); - - const occursInInitialChunksMap = new Map(); - const occursInAllChunksMap = new Map(); - - const initialChunkChunkMap = new Map(); - const entryCountMap = new Map(); - for (const m of modulesInOccurrenceOrder) { - let initial = 0; - let entry = 0; - for (const c of chunkGraph.getModuleChunksIterable(m)) { - if (c.canBeInitial()) initial++; - if (chunkGraph.isEntryModuleInChunk(m, c)) entry++; - } - initialChunkChunkMap.set(m, initial); - entryCountMap.set(m, entry); - } - - /** - * @param {Module} module module - * @returns {number} count of occurs - */ - const countOccursInEntry = module => { - let sum = 0; - for (const [ - originModule, - connections - ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { - if (!originModule) continue; - if (!connections.some(c => c.isTargetActive(undefined))) continue; - sum += initialChunkChunkMap.get(originModule); - } - return sum; - }; - - /** - * @param {Module} module module - * @returns {number} count of occurs - */ - const countOccurs = module => { - let sum = 0; - for (const [ - originModule, - connections - ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { - if (!originModule) continue; - const chunkModules = - chunkGraph.getNumberOfModuleChunks(originModule); - for (const c of connections) { - if (!c.isTargetActive(undefined)) continue; - if (!c.dependency) continue; - const factor = c.dependency.getNumberOfIdOccurrences(); - if (factor === 0) continue; - sum += factor * chunkModules; - } - } - return sum; - }; - - if (prioritiseInitial) { - for (const m of modulesInOccurrenceOrder) { - const result = - countOccursInEntry(m) + - initialChunkChunkMap.get(m) + - entryCountMap.get(m); - occursInInitialChunksMap.set(m, result); - } - } - - for (const m of modulesInOccurrenceOrder) { - const result = - countOccurs(m) + - chunkGraph.getNumberOfModuleChunks(m) + - entryCountMap.get(m); - occursInAllChunksMap.set(m, result); + apply(parser) { + const { exportPresenceMode } = this; + parser.hooks.isPure + .for("Identifier") + .tap("HarmonyImportDependencyParserPlugin", expression => { + const expr = /** @type {Identifier} */ (expression); + if ( + parser.isVariableDefined(expr.name) || + parser.getTagData(expr.name, harmonySpecifierTag) + ) { + return true; } - - const naturalCompare = compareModulesByPreOrderIndexOrIdentifier( - compilation.moduleGraph + }); + parser.hooks.import.tap( + "HarmonyImportDependencyParserPlugin", + (statement, source) => { + parser.state.lastHarmonyImportOrder = + (parser.state.lastHarmonyImportOrder || 0) + 1; + const clearDep = new ConstDependency( + parser.isAsiPosition(statement.range[0]) ? ";" : "", + statement.range ); - - modulesInOccurrenceOrder.sort((a, b) => { - if (prioritiseInitial) { - const aEntryOccurs = occursInInitialChunksMap.get(a); - const bEntryOccurs = occursInInitialChunksMap.get(b); - if (aEntryOccurs > bEntryOccurs) return -1; - if (aEntryOccurs < bEntryOccurs) return 1; - } - const aOccurs = occursInAllChunksMap.get(a); - const bOccurs = occursInAllChunksMap.get(b); - if (aOccurs > bOccurs) return -1; - if (aOccurs < bOccurs) return 1; - return naturalCompare(a, b); + clearDep.loc = statement.loc; + parser.state.module.addPresentationalDependency(clearDep); + parser.unsetAsiPosition(statement.range[1]); + const assertions = getAssertions(statement); + const sideEffectDep = new HarmonyImportSideEffectDependency( + source, + parser.state.lastHarmonyImportOrder, + assertions + ); + sideEffectDep.loc = statement.loc; + parser.state.module.addDependency(sideEffectDep); + return true; + } + ); + parser.hooks.importSpecifier.tap( + "HarmonyImportDependencyParserPlugin", + (statement, source, id, name) => { + const ids = id === null ? [] : [id]; + parser.tagVariable(name, harmonySpecifierTag, { + name, + source, + ids, + sourceOrder: parser.state.lastHarmonyImportOrder, + assertions: getAssertions(statement) }); - - assignAscendingModuleIds( - usedIds, - modulesInOccurrenceOrder, - compilation + return true; + } + ); + parser.hooks.expression + .for(harmonySpecifierTag) + .tap("HarmonyImportDependencyParserPlugin", expr => { + const settings = /** @type {HarmonySettings} */ (parser.currentTagData); + const dep = new HarmonyImportSpecifierDependency( + settings.source, + settings.sourceOrder, + settings.ids, + settings.name, + expr.range, + exportPresenceMode, + settings.assertions ); + dep.shorthand = parser.scope.inShorthand; + dep.directImport = true; + dep.asiSafe = !parser.isAsiPosition(expr.range[0]); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); + return true; }); - }); + parser.hooks.expressionMemberChain + .for(harmonySpecifierTag) + .tap("HarmonyImportDependencyParserPlugin", (expr, members) => { + const settings = /** @type {HarmonySettings} */ (parser.currentTagData); + const ids = settings.ids.concat(members); + const dep = new HarmonyImportSpecifierDependency( + settings.source, + settings.sourceOrder, + ids, + settings.name, + expr.range, + exportPresenceMode, + settings.assertions + ); + dep.asiSafe = !parser.isAsiPosition(expr.range[0]); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); + return true; + }); + parser.hooks.callMemberChain + .for(harmonySpecifierTag) + .tap("HarmonyImportDependencyParserPlugin", (expr, members) => { + const { arguments: args, callee } = expr; + const settings = /** @type {HarmonySettings} */ (parser.currentTagData); + const ids = settings.ids.concat(members); + const dep = new HarmonyImportSpecifierDependency( + settings.source, + settings.sourceOrder, + ids, + settings.name, + callee.range, + exportPresenceMode, + settings.assertions + ); + dep.directImport = members.length === 0; + dep.call = true; + dep.asiSafe = !parser.isAsiPosition(callee.range[0]); + // only in case when we strictly follow the spec we need a special case here + dep.namespaceObjectAsContext = + members.length > 0 && this.strictThisContextOnImports; + dep.loc = callee.loc; + parser.state.module.addDependency(dep); + if (args) parser.walkExpressions(args); + InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); + return true; + }); + const { hotAcceptCallback, hotAcceptWithoutCallback } = + HotModuleReplacementPlugin.getParserHooks(parser); + hotAcceptCallback.tap( + "HarmonyImportDependencyParserPlugin", + (expr, requests) => { + if (!HarmonyExports.isEnabled(parser.state)) { + // This is not a harmony module, skip it + return; + } + const dependencies = requests.map(request => { + const dep = new HarmonyAcceptImportDependency(request); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + return dep; + }); + if (dependencies.length > 0) { + const dep = new HarmonyAcceptDependency( + expr.range, + dependencies, + true + ); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + } + } + ); + hotAcceptWithoutCallback.tap( + "HarmonyImportDependencyParserPlugin", + (expr, requests) => { + if (!HarmonyExports.isEnabled(parser.state)) { + // This is not a harmony module, skip it + return; + } + const dependencies = requests.map(request => { + const dep = new HarmonyAcceptImportDependency(request); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + return dep; + }); + if (dependencies.length > 0) { + const dep = new HarmonyAcceptDependency( + expr.range, + dependencies, + false + ); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + } + } + ); } -} +}; -module.exports = OccurrenceModuleIdsPlugin; +module.exports.harmonySpecifierTag = harmonySpecifierTag; +module.exports.getAssertions = getAssertions; /***/ }), -/***/ 8635: +/***/ 73132: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -87826,144 +86594,84 @@ module.exports = OccurrenceModuleIdsPlugin; -const { WebpackError } = __webpack_require__(91919); -const { getUsedModuleIdsAndModules } = __webpack_require__(63290); +const makeSerializable = __webpack_require__(33032); +const HarmonyImportDependency = __webpack_require__(57154); -/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../InitFragment")} InitFragment */ /** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -const plugin = "SyncModuleIdsPlugin"; +class HarmonyImportSideEffectDependency extends HarmonyImportDependency { + constructor(request, sourceOrder, assertions) { + super(request, sourceOrder, assertions); + } + + get type() { + return "harmony side effect evaluation"; + } -class SyncModuleIdsPlugin { /** - * @param {Object} options options - * @param {string} options.path path to file - * @param {string=} options.context context for module names - * @param {function(Module): boolean} options.test selector for modules - * @param {"read" | "create" | "merge" | "update"=} options.mode operation mode (defaults to merge) + * @param {ModuleGraph} moduleGraph module graph + * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active */ - constructor({ path, context, test, mode }) { - this._path = path; - this._context = context; - this._test = test || (() => true); - const readAndWrite = !mode || mode === "merge" || mode === "update"; - this._read = readAndWrite || mode === "read"; - this._write = readAndWrite || mode === "create"; - this._prune = mode === "update"; + getCondition(moduleGraph) { + return connection => { + const refModule = connection.resolvedModule; + if (!refModule) return true; + return refModule.getSideEffectsConnectionState(moduleGraph); + }; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this dependency connects the module to referencing modules + */ + getModuleEvaluationSideEffectsState(moduleGraph) { + const refModule = moduleGraph.getModule(this); + if (!refModule) return true; + return refModule.getSideEffectsConnectionState(moduleGraph); + } +} + +makeSerializable( + HarmonyImportSideEffectDependency, + "webpack/lib/dependencies/HarmonyImportSideEffectDependency" +); + +HarmonyImportSideEffectDependency.Template = class HarmonyImportSideEffectDependencyTemplate extends ( + HarmonyImportDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply(compiler) { - /** @type {Map} */ - let data; - let dataChanged = false; - if (this._read) { - compiler.hooks.readRecords.tapAsync(plugin, callback => { - const fs = compiler.intermediateFileSystem; - fs.readFile(this._path, (err, buffer) => { - if (err) { - if (err.code !== "ENOENT") { - return callback(err); - } - return callback(); - } - const json = JSON.parse(buffer.toString()); - data = new Map(); - for (const key of Object.keys(json)) { - data.set(key, json[key]); - } - dataChanged = false; - return callback(); - }); - }); - } - if (this._write) { - compiler.hooks.emitRecords.tapAsync(plugin, callback => { - if (!data || !dataChanged) return callback(); - const json = {}; - const sorted = Array.from(data).sort(([a], [b]) => (a < b ? -1 : 1)); - for (const [key, value] of sorted) { - json[key] = value; - } - const fs = compiler.intermediateFileSystem; - fs.writeFile(this._path, JSON.stringify(json), callback); - }); - } - compiler.hooks.thisCompilation.tap(plugin, compilation => { - const associatedObjectForCache = compiler.root; - const context = this._context || compiler.context; - if (this._read) { - compilation.hooks.reviveModules.tap(plugin, (_1, _2) => { - if (!data) return; - const { chunkGraph } = compilation; - const [usedIds, modules] = getUsedModuleIdsAndModules( - compilation, - this._test - ); - for (const module of modules) { - const name = module.libIdent({ - context, - associatedObjectForCache - }); - if (!name) continue; - const id = data.get(name); - const idAsString = `${id}`; - if (usedIds.has(idAsString)) { - const err = new WebpackError( - `SyncModuleIdsPlugin: Unable to restore id '${id}' from '${this._path}' as it's already used.` - ); - err.module = module; - compilation.errors.push(err); - } - chunkGraph.setModuleId(module, id); - usedIds.add(idAsString); - } - }); - } - if (this._write) { - compilation.hooks.recordModules.tap(plugin, modules => { - const { chunkGraph } = compilation; - let oldData = data; - if (!oldData) { - oldData = data = new Map(); - } else if (this._prune) { - data = new Map(); - } - for (const module of modules) { - if (this._test(module)) { - const name = module.libIdent({ - context, - associatedObjectForCache - }); - if (!name) continue; - const id = chunkGraph.getModuleId(module); - if (id === null) continue; - const oldId = oldData.get(name); - if (oldId !== id) { - dataChanged = true; - } else if (data === oldData) { - continue; - } - data.set(name, id); - } - } - if (data.size !== oldData.size) dataChanged = true; - }); + apply(dependency, source, templateContext) { + const { moduleGraph, concatenationScope } = templateContext; + if (concatenationScope) { + const module = moduleGraph.getModule(dependency); + if (concatenationScope.isModuleInScope(module)) { + return; } - }); + } + super.apply(dependency, source, templateContext); } -} +}; -module.exports = SyncModuleIdsPlugin; +module.exports = HarmonyImportSideEffectDependency; /***/ }), -/***/ 91919: +/***/ 14077: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -87974,583 +86682,335 @@ module.exports = SyncModuleIdsPlugin; -const util = __webpack_require__(73837); -const memoize = __webpack_require__(78676); +const Dependency = __webpack_require__(54912); +const { + getDependencyUsedByExportsCondition +} = __webpack_require__(38988); +const makeSerializable = __webpack_require__(33032); +const propertyAccess = __webpack_require__(54190); +const HarmonyImportDependency = __webpack_require__(57154); -/** @typedef {import("../declarations/WebpackOptions").Entry} Entry */ -/** @typedef {import("../declarations/WebpackOptions").EntryNormalized} EntryNormalized */ -/** @typedef {import("../declarations/WebpackOptions").EntryObject} EntryObject */ -/** @typedef {import("../declarations/WebpackOptions").FileCacheOptions} FileCacheOptions */ -/** @typedef {import("../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../declarations/WebpackOptions").ModuleOptions} ModuleOptions */ -/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ -/** @typedef {import("../declarations/WebpackOptions").RuleSetCondition} RuleSetCondition */ -/** @typedef {import("../declarations/WebpackOptions").RuleSetConditionAbsolute} RuleSetConditionAbsolute */ -/** @typedef {import("../declarations/WebpackOptions").RuleSetRule} RuleSetRule */ -/** @typedef {import("../declarations/WebpackOptions").RuleSetUse} RuleSetUse */ -/** @typedef {import("../declarations/WebpackOptions").RuleSetUseItem} RuleSetUseItem */ -/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} Configuration */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptionsNormalized */ -/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */ -/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */ -/** @typedef {import("./Compilation").Asset} Asset */ -/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("./Compilation").EntryOptions} EntryOptions */ -/** @typedef {import("./Compiler").AssetEmittedInfo} AssetEmittedInfo */ -/** @typedef {import("./MultiStats")} MultiStats */ -/** @typedef {import("./Parser").ParserState} ParserState */ -/** @typedef {import("./ResolverFactory").ResolvePluginInstance} ResolvePluginInstance */ -/** @typedef {import("./ResolverFactory").Resolver} Resolver */ -/** @typedef {import("./Watching")} Watching */ -/** @typedef {import("./cli").Argument} Argument */ -/** @typedef {import("./cli").Problem} Problem */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunk} StatsChunk */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunkGroup} StatsChunkGroup */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunkOrigin} StatsChunkOrigin */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsError} StatsError */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsLogging} StatsLogging */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsLoggingEntry} StatsLoggingEntry */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModule} StatsModule */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleIssuer} StatsModuleIssuer */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleReason} StatsModuleReason */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleTraceDependency} StatsModuleTraceDependency */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleTraceItem} StatsModuleTraceItem */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsProfile} StatsProfile */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -/** - * @template {Function} T - * @param {function(): T} factory factory function - * @returns {T} function - */ -const lazyFunction = factory => { - const fac = memoize(factory); - const f = /** @type {any} */ ( - (...args) => { - return fac()(...args); - } - ); - return /** @type {T} */ (f); -}; +const idsSymbol = Symbol("HarmonyImportSpecifierDependency.ids"); -/** - * @template A - * @template B - * @param {A} obj input a - * @param {B} exports input b - * @returns {A & B} merged - */ -const mergeExports = (obj, exports) => { - const descriptors = Object.getOwnPropertyDescriptors(exports); - for (const name of Object.keys(descriptors)) { - const descriptor = descriptors[name]; - if (descriptor.get) { - const fn = descriptor.get; - Object.defineProperty(obj, name, { - configurable: false, - enumerable: true, - get: memoize(fn) - }); - } else if (typeof descriptor.value === "object") { - Object.defineProperty(obj, name, { - configurable: false, - enumerable: true, - writable: false, - value: mergeExports({}, descriptor.value) - }); - } else { - throw new Error( - "Exposed values must be either a getter or an nested object" - ); - } +const { ExportPresenceModes } = HarmonyImportDependency; + +class HarmonyImportSpecifierDependency extends HarmonyImportDependency { + constructor( + request, + sourceOrder, + ids, + name, + range, + exportPresenceMode, + assertions + ) { + super(request, sourceOrder, assertions); + this.ids = ids; + this.name = name; + this.range = range; + this.exportPresenceMode = exportPresenceMode; + this.namespaceObjectAsContext = false; + this.call = undefined; + this.directImport = undefined; + this.shorthand = undefined; + this.asiSafe = undefined; + /** @type {Set | boolean} */ + this.usedByExports = undefined; } - return /** @type {A & B} */ (Object.freeze(obj)); -}; -const fn = lazyFunction(() => __webpack_require__(36243)); -module.exports = mergeExports(fn, { - get webpack() { - return __webpack_require__(36243); - }, - get validate() { - const webpackOptionsSchemaCheck = __webpack_require__(10382); - const getRealValidate = memoize(() => { - const validateSchema = __webpack_require__(12047); - const webpackOptionsSchema = __webpack_require__(73342); - return options => validateSchema(webpackOptionsSchema, options); - }); - return options => { - if (!webpackOptionsSchemaCheck(options)) getRealValidate()(options); - }; - }, - get validateSchema() { - const validateSchema = __webpack_require__(12047); - return validateSchema; - }, - get version() { - return /** @type {string} */ ((__webpack_require__(32702)/* .version */ .i8)); - }, + // TODO webpack 6 remove + get id() { + throw new Error("id was renamed to ids and type changed to string[]"); + } - get cli() { - return __webpack_require__(13462); - }, - get AutomaticPrefetchPlugin() { - return __webpack_require__(17714); - }, - get AsyncDependenciesBlock() { - return __webpack_require__(47736); - }, - get BannerPlugin() { - return __webpack_require__(21242); - }, - get Cache() { - return __webpack_require__(7592); - }, - get Chunk() { - return __webpack_require__(39385); - }, - get ChunkGraph() { - return __webpack_require__(64971); - }, - get CleanPlugin() { - return __webpack_require__(31085); - }, - get Compilation() { - return __webpack_require__(85720); - }, - get Compiler() { - return __webpack_require__(70845); - }, - get ConcatenationScope() { - return __webpack_require__(98229); - }, - get ContextExclusionPlugin() { - return __webpack_require__(21411); - }, - get ContextReplacementPlugin() { - return __webpack_require__(12206); - }, - get DefinePlugin() { - return __webpack_require__(79065); - }, - get DelegatedPlugin() { - return __webpack_require__(80632); - }, - get Dependency() { - return __webpack_require__(54912); - }, - get DllPlugin() { - return __webpack_require__(40038); - }, - get DllReferencePlugin() { - return __webpack_require__(90999); - }, - get DynamicEntryPlugin() { - return __webpack_require__(96475); - }, - get EntryOptionPlugin() { - return __webpack_require__(9909); - }, - get EntryPlugin() { - return __webpack_require__(96953); - }, - get EnvironmentPlugin() { - return __webpack_require__(22070); - }, - get EvalDevToolModulePlugin() { - return __webpack_require__(65218); - }, - get EvalSourceMapDevToolPlugin() { - return __webpack_require__(14790); - }, - get ExternalModule() { - return __webpack_require__(73071); - }, - get ExternalsPlugin() { - return __webpack_require__(6652); - }, - get Generator() { - return __webpack_require__(93401); - }, - get HotUpdateChunk() { - return __webpack_require__(9597); - }, - get HotModuleReplacementPlugin() { - return __webpack_require__(6404); - }, - get IgnorePlugin() { - return __webpack_require__(84808); - }, - get JavascriptModulesPlugin() { - return util.deprecate( - () => __webpack_require__(89464), - "webpack.JavascriptModulesPlugin has moved to webpack.javascript.JavascriptModulesPlugin", - "DEP_WEBPACK_JAVASCRIPT_MODULES_PLUGIN" - )(); - }, - get LibManifestPlugin() { - return __webpack_require__(93837); - }, - get LibraryTemplatePlugin() { - return util.deprecate( - () => __webpack_require__(14157), - "webpack.LibraryTemplatePlugin is deprecated and has been replaced by compilation.outputOptions.library or compilation.addEntry + passing a library option", - "DEP_WEBPACK_LIBRARY_TEMPLATE_PLUGIN" - )(); - }, - get LoaderOptionsPlugin() { - return __webpack_require__(22078); - }, - get LoaderTargetPlugin() { - return __webpack_require__(86738); - }, - get Module() { - return __webpack_require__(73208); - }, - get ModuleFilenameHelpers() { - return __webpack_require__(88821); - }, - get ModuleGraph() { - return __webpack_require__(99988); - }, - get ModuleGraphConnection() { - return __webpack_require__(40639); - }, - get NoEmitOnErrorsPlugin() { - return __webpack_require__(50169); - }, - get NormalModule() { - return __webpack_require__(39); - }, - get NormalModuleReplacementPlugin() { - return __webpack_require__(30633); - }, - get MultiCompiler() { - return __webpack_require__(33370); - }, - get Parser() { - return __webpack_require__(11715); - }, - get PrefetchPlugin() { - return __webpack_require__(73850); - }, - get ProgressPlugin() { - return __webpack_require__(13216); - }, - get ProvidePlugin() { - return __webpack_require__(38309); - }, - get RuntimeGlobals() { - return __webpack_require__(16475); - }, - get RuntimeModule() { - return __webpack_require__(16963); - }, - get SingleEntryPlugin() { - return util.deprecate( - () => __webpack_require__(96953), - "SingleEntryPlugin was renamed to EntryPlugin", - "DEP_WEBPACK_SINGLE_ENTRY_PLUGIN" - )(); - }, - get SourceMapDevToolPlugin() { - return __webpack_require__(63872); - }, - get Stats() { - return __webpack_require__(31743); - }, - get Template() { - return __webpack_require__(1626); - }, - get UsageState() { - return (__webpack_require__(63686).UsageState); - }, - get WatchIgnorePlugin() { - return __webpack_require__(65193); - }, - get WebpackError() { - return __webpack_require__(53799); - }, - get WebpackOptionsApply() { - return __webpack_require__(88422); - }, - get WebpackOptionsDefaulter() { - return util.deprecate( - () => __webpack_require__(14452), - "webpack.WebpackOptionsDefaulter is deprecated and has been replaced by webpack.config.getNormalizedWebpackOptions and webpack.config.applyWebpackOptionsDefaults", - "DEP_WEBPACK_OPTIONS_DEFAULTER" - )(); - }, - // TODO webpack 6 deprecate - get WebpackOptionsValidationError() { - return (__webpack_require__(38476).ValidationError); - }, - get ValidationError() { - return (__webpack_require__(38476).ValidationError); - }, + // TODO webpack 6 remove + getId() { + throw new Error("id was renamed to ids and type changed to string[]"); + } - cache: { - get MemoryCachePlugin() { - return __webpack_require__(52539); - } - }, + // TODO webpack 6 remove + setId() { + throw new Error("id was renamed to ids and type changed to string[]"); + } - config: { - get getNormalizedWebpackOptions() { - return (__webpack_require__(26693).getNormalizedWebpackOptions); - }, - get applyWebpackOptionsDefaults() { - return (__webpack_require__(92988).applyWebpackOptionsDefaults); - } - }, + get type() { + return "harmony import specifier"; + } - dependencies: { - get ModuleDependency() { - return __webpack_require__(80321); - }, - get ConstDependency() { - return __webpack_require__(76911); - }, - get NullDependency() { - return __webpack_require__(31830); - } - }, + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {string[]} the imported ids + */ + getIds(moduleGraph) { + const meta = moduleGraph.getMetaIfExisting(this); + if (meta === undefined) return this.ids; + const ids = meta[idsSymbol]; + return ids !== undefined ? ids : this.ids; + } - ids: { - get ChunkModuleIdRangePlugin() { - return __webpack_require__(64618); - }, - get NaturalModuleIdsPlugin() { - return __webpack_require__(83366); - }, - get OccurrenceModuleIdsPlugin() { - return __webpack_require__(35371); - }, - get NamedModuleIdsPlugin() { - return __webpack_require__(24339); - }, - get DeterministicChunkIdsPlugin() { - return __webpack_require__(8747); - }, - get DeterministicModuleIdsPlugin() { - return __webpack_require__(76692); - }, - get NamedChunkIdsPlugin() { - return __webpack_require__(6454); - }, - get OccurrenceChunkIdsPlugin() { - return __webpack_require__(51020); - }, - get HashedModuleIdsPlugin() { - return __webpack_require__(21825); - } - }, + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {string[]} ids the imported ids + * @returns {void} + */ + setIds(moduleGraph, ids) { + moduleGraph.getMeta(this)[idsSymbol] = ids; + } - javascript: { - get EnableChunkLoadingPlugin() { - return __webpack_require__(61291); - }, - get JavascriptModulesPlugin() { - return __webpack_require__(89464); - }, - get JavascriptParser() { - return __webpack_require__(29050); - } - }, + /** + * @param {ModuleGraph} moduleGraph module graph + * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active + */ + getCondition(moduleGraph) { + return getDependencyUsedByExportsCondition( + this, + this.usedByExports, + moduleGraph + ); + } - optimize: { - get AggressiveMergingPlugin() { - return __webpack_require__(64395); - }, - get AggressiveSplittingPlugin() { - return util.deprecate( - () => __webpack_require__(15543), - "AggressiveSplittingPlugin is deprecated in favor of SplitChunksPlugin", - "DEP_WEBPACK_AGGRESSIVE_SPLITTING_PLUGIN" - )(); - }, - get InnerGraph() { - return __webpack_require__(38988); - }, - get LimitChunkCountPlugin() { - return __webpack_require__(83608); - }, - get MinChunkSizePlugin() { - return __webpack_require__(53912); - }, - get ModuleConcatenationPlugin() { - return __webpack_require__(74844); - }, - get RealContentHashPlugin() { - return __webpack_require__(46043); - }, - get RuntimeChunkPlugin() { - return __webpack_require__(2837); - }, - get SideEffectsFlagPlugin() { - return __webpack_require__(84800); - }, - get SplitChunksPlugin() { - return __webpack_require__(21478); - } - }, + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this dependency connects the module to referencing modules + */ + getModuleEvaluationSideEffectsState(moduleGraph) { + return false; + } - runtime: { - get GetChunkFilenameRuntimeModule() { - return __webpack_require__(34277); - }, - get LoadScriptRuntimeModule() { - return __webpack_require__(19942); + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + let ids = this.getIds(moduleGraph); + if (ids.length === 0) return Dependency.EXPORTS_OBJECT_REFERENCED; + let namespaceObjectAsContext = this.namespaceObjectAsContext; + if (ids[0] === "default") { + const selfModule = moduleGraph.getParentModule(this); + const importedModule = moduleGraph.getModule(this); + switch ( + importedModule.getExportsType( + moduleGraph, + selfModule.buildMeta.strictHarmonyModule + ) + ) { + case "default-only": + case "default-with-named": + if (ids.length === 1) return Dependency.EXPORTS_OBJECT_REFERENCED; + ids = ids.slice(1); + namespaceObjectAsContext = true; + break; + case "dynamic": + return Dependency.EXPORTS_OBJECT_REFERENCED; + } } - }, - prefetch: { - get ChunkPrefetchPreloadPlugin() { - return __webpack_require__(33895); + if ( + this.call && + !this.directImport && + (namespaceObjectAsContext || ids.length > 1) + ) { + if (ids.length === 1) return Dependency.EXPORTS_OBJECT_REFERENCED; + ids = ids.slice(0, -1); } - }, - web: { - get FetchCompileAsyncWasmPlugin() { - return __webpack_require__(8437); - }, - get FetchCompileWasmPlugin() { - return __webpack_require__(35537); - }, - get JsonpChunkLoadingRuntimeModule() { - return __webpack_require__(84154); - }, - get JsonpTemplatePlugin() { - return __webpack_require__(4607); - } - }, + return [ids]; + } - webworker: { - get WebWorkerTemplatePlugin() { - return __webpack_require__(68693); - } - }, + /** + * @param {ModuleGraph} moduleGraph module graph + * @returns {number} effective mode + */ + _getEffectiveExportPresenceLevel(moduleGraph) { + if (this.exportPresenceMode !== ExportPresenceModes.AUTO) + return this.exportPresenceMode; + return moduleGraph.getParentModule(this).buildMeta.strictHarmonyModule + ? ExportPresenceModes.ERROR + : ExportPresenceModes.WARN; + } - node: { - get NodeEnvironmentPlugin() { - return __webpack_require__(7553); - }, - get NodeSourcePlugin() { - return __webpack_require__(7103); - }, - get NodeTargetPlugin() { - return __webpack_require__(17916); - }, - get NodeTemplatePlugin() { - return __webpack_require__(61052); - }, - get ReadFileCompileWasmPlugin() { - return __webpack_require__(98939); + /** + * Returns warnings + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[]} warnings + */ + getWarnings(moduleGraph) { + const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); + if (exportsPresence === ExportPresenceModes.WARN) { + return this._getErrors(moduleGraph); } - }, + return null; + } - electron: { - get ElectronTargetPlugin() { - return __webpack_require__(32277); + /** + * Returns errors + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[]} errors + */ + getErrors(moduleGraph) { + const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); + if (exportsPresence === ExportPresenceModes.ERROR) { + return this._getErrors(moduleGraph); } - }, + return null; + } - wasm: { - get AsyncWebAssemblyModulesPlugin() { - return __webpack_require__(7538); - } - }, + /** + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[] | undefined} errors + */ + _getErrors(moduleGraph) { + const ids = this.getIds(moduleGraph); + return this.getLinkingErrors( + moduleGraph, + ids, + `(imported as '${this.name}')` + ); + } - library: { - get AbstractLibraryPlugin() { - return __webpack_require__(26030); - }, - get EnableLibraryPlugin() { - return __webpack_require__(91452); - } - }, + /** + * implement this method to allow the occurrence order plugin to count correctly + * @returns {number} count how often the id is used in this dependency + */ + getNumberOfIdOccurrences() { + return 0; + } - container: { - get ContainerPlugin() { - return __webpack_require__(9244); - }, - get ContainerReferencePlugin() { - return __webpack_require__(95757); - }, - get ModuleFederationPlugin() { - return __webpack_require__(30569); - }, - get scope() { - return (__webpack_require__(3083).scope); - } - }, + serialize(context) { + const { write } = context; + write(this.ids); + write(this.name); + write(this.range); + write(this.exportPresenceMode); + write(this.namespaceObjectAsContext); + write(this.call); + write(this.directImport); + write(this.shorthand); + write(this.asiSafe); + write(this.usedByExports); + super.serialize(context); + } - sharing: { - get ConsumeSharedPlugin() { - return __webpack_require__(15046); - }, - get ProvideSharedPlugin() { - return __webpack_require__(31225); - }, - get SharePlugin() { - return __webpack_require__(26335); - }, - get scope() { - return (__webpack_require__(3083).scope); - } - }, + deserialize(context) { + const { read } = context; + this.ids = read(); + this.name = read(); + this.range = read(); + this.exportPresenceMode = read(); + this.namespaceObjectAsContext = read(); + this.call = read(); + this.directImport = read(); + this.shorthand = read(); + this.asiSafe = read(); + this.usedByExports = read(); + super.deserialize(context); + } +} - debug: { - get ProfilingPlugin() { - return __webpack_require__(2757); - } - }, +makeSerializable( + HarmonyImportSpecifierDependency, + "webpack/lib/dependencies/HarmonyImportSpecifierDependency" +); - util: { - get createHash() { - return __webpack_require__(49835); - }, - get comparators() { - return __webpack_require__(29579); - }, - get runtime() { - return __webpack_require__(17156); - }, - get serialization() { - return __webpack_require__(8282); - }, - get cleverMerge() { - return (__webpack_require__(60839).cachedCleverMerge); - }, - get LazySet() { - return __webpack_require__(38938); - } - }, +HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependencyTemplate extends ( + HarmonyImportDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply(dependency, source, templateContext) { + const dep = /** @type {HarmonyImportSpecifierDependency} */ (dependency); + const { moduleGraph, module, runtime, concatenationScope } = + templateContext; + const connection = moduleGraph.getConnection(dep); + // Skip rendering depending when dependency is conditional + if (connection && !connection.isTargetActive(runtime)) return; - get sources() { - return __webpack_require__(51255); - }, + const ids = dep.getIds(moduleGraph); - experiments: { - schemes: { - get HttpUriPlugin() { - return __webpack_require__(42110); - } - }, - ids: { - get SyncModuleIdsPlugin() { - return __webpack_require__(8635); + let exportExpr; + if ( + connection && + concatenationScope && + concatenationScope.isModuleInScope(connection.module) + ) { + if (ids.length === 0) { + exportExpr = concatenationScope.createModuleReference( + connection.module, + { + asiSafe: dep.asiSafe + } + ); + } else if (dep.namespaceObjectAsContext && ids.length === 1) { + exportExpr = + concatenationScope.createModuleReference(connection.module, { + asiSafe: dep.asiSafe + }) + propertyAccess(ids); + } else { + exportExpr = concatenationScope.createModuleReference( + connection.module, + { + ids, + call: dep.call, + directImport: dep.directImport, + asiSafe: dep.asiSafe + } + ); } + } else { + super.apply(dependency, source, templateContext); + + const { runtimeTemplate, initFragments, runtimeRequirements } = + templateContext; + + exportExpr = runtimeTemplate.exportFromImport({ + moduleGraph, + module: moduleGraph.getModule(dep), + request: dep.request, + exportName: ids, + originModule: module, + asiSafe: dep.shorthand ? true : dep.asiSafe, + isCall: dep.call, + callContext: !dep.directImport, + defaultInterop: true, + importVar: dep.getImportVar(moduleGraph), + initFragments, + runtime, + runtimeRequirements + }); + } + if (dep.shorthand) { + source.insert(dep.range[1], `: ${exportExpr}`); + } else { + source.replace(dep.range[0], dep.range[1] - 1, exportExpr); } } -}); +}; + +module.exports = HarmonyImportSpecifierDependency; /***/ }), -/***/ 18535: +/***/ 39029: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -88561,159 +87021,161 @@ module.exports = mergeExports(fn, { -const { ConcatSource, PrefixSource, RawSource } = __webpack_require__(51255); -const { RuntimeGlobals } = __webpack_require__(91919); -const HotUpdateChunk = __webpack_require__(9597); -const Template = __webpack_require__(1626); -const { getCompilationHooks } = __webpack_require__(89464); -const { - generateEntryStartup, - updateHashForEntryStartup -} = __webpack_require__(98124); +const HarmonyAcceptDependency = __webpack_require__(23624); +const HarmonyAcceptImportDependency = __webpack_require__(99843); +const HarmonyCompatibilityDependency = __webpack_require__(72906); +const HarmonyExportExpressionDependency = __webpack_require__(51340); +const HarmonyExportHeaderDependency = __webpack_require__(38873); +const HarmonyExportImportedSpecifierDependency = __webpack_require__(67157); +const HarmonyExportSpecifierDependency = __webpack_require__(48567); +const HarmonyImportSideEffectDependency = __webpack_require__(73132); +const HarmonyImportSpecifierDependency = __webpack_require__(14077); + +const HarmonyDetectionParserPlugin = __webpack_require__(17223); +const HarmonyExportDependencyParserPlugin = __webpack_require__(93466); +const HarmonyImportDependencyParserPlugin = __webpack_require__(20862); +const HarmonyTopLevelThisParserPlugin = __webpack_require__(63232); /** @typedef {import("../Compiler")} Compiler */ -class ArrayPushCallbackChunkFormatPlugin { +class HarmonyModulesPlugin { + constructor(options) { + this.options = options; + } + /** * Apply the plugin * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap( - "ArrayPushCallbackChunkFormatPlugin", - compilation => { - compilation.hooks.additionalChunkRuntimeRequirements.tap( - "ArrayPushCallbackChunkFormatPlugin", - (chunk, set, { chunkGraph }) => { - if (chunk.hasRuntime()) return; - if (chunkGraph.getNumberOfEntryModules(chunk) > 0) { - set.add(RuntimeGlobals.onChunksLoaded); - set.add(RuntimeGlobals.require); - } - set.add(RuntimeGlobals.chunkCallback); - } + compiler.hooks.compilation.tap( + "HarmonyModulesPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyTemplates.set( + HarmonyCompatibilityDependency, + new HarmonyCompatibilityDependency.Template() ); - const hooks = getCompilationHooks(compilation); - hooks.renderChunk.tap( - "ArrayPushCallbackChunkFormatPlugin", - (modules, renderContext) => { - const { chunk, chunkGraph, runtimeTemplate } = renderContext; - const hotUpdateChunk = - chunk instanceof HotUpdateChunk ? chunk : null; - const globalObject = runtimeTemplate.globalObject; - const source = new ConcatSource(); - const runtimeModules = - chunkGraph.getChunkRuntimeModulesInOrder(chunk); - if (hotUpdateChunk) { - const hotUpdateGlobal = - runtimeTemplate.outputOptions.hotUpdateGlobal; - source.add( - `${globalObject}[${JSON.stringify(hotUpdateGlobal)}](` - ); - source.add(`${JSON.stringify(chunk.id)},`); - source.add(modules); - if (runtimeModules.length > 0) { - source.add(",\n"); - const runtimePart = Template.renderChunkRuntimeModules( - runtimeModules, - renderContext - ); - source.add(runtimePart); - } - source.add(")"); - } else { - const chunkLoadingGlobal = - runtimeTemplate.outputOptions.chunkLoadingGlobal; - source.add( - `(${globalObject}[${JSON.stringify( - chunkLoadingGlobal - )}] = ${globalObject}[${JSON.stringify( - chunkLoadingGlobal - )}] || []).push([` - ); - source.add(`${JSON.stringify(chunk.ids)},`); - source.add(modules); - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); - if (runtimeModules.length > 0 || entries.length > 0) { - const runtime = new ConcatSource( - (runtimeTemplate.supportsArrowFunction() - ? "__webpack_require__ =>" - : "function(__webpack_require__)") + - " { // webpackRuntimeModules\n" - ); - if (runtimeModules.length > 0) { - runtime.add( - Template.renderRuntimeModules(runtimeModules, { - ...renderContext, - codeGenerationResults: compilation.codeGenerationResults - }) - ); - } - if (entries.length > 0) { - const startupSource = new RawSource( - generateEntryStartup( - chunkGraph, - runtimeTemplate, - entries, - chunk, - true - ) - ); - runtime.add( - hooks.renderStartup.call( - startupSource, - entries[entries.length - 1][0], - { - ...renderContext, - inlined: false - } - ) - ); - if ( - chunkGraph - .getChunkRuntimeRequirements(chunk) - .has(RuntimeGlobals.returnExportsFromRuntime) - ) { - runtime.add("return __webpack_exports__;\n"); - } - } - runtime.add("}\n"); - source.add(",\n"); - source.add(new PrefixSource("/******/ ", runtime)); - } - source.add("])"); - } - return source; - } + + compilation.dependencyFactories.set( + HarmonyImportSideEffectDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + HarmonyImportSideEffectDependency, + new HarmonyImportSideEffectDependency.Template() + ); + + compilation.dependencyFactories.set( + HarmonyImportSpecifierDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + HarmonyImportSpecifierDependency, + new HarmonyImportSpecifierDependency.Template() + ); + + compilation.dependencyTemplates.set( + HarmonyExportHeaderDependency, + new HarmonyExportHeaderDependency.Template() + ); + + compilation.dependencyTemplates.set( + HarmonyExportExpressionDependency, + new HarmonyExportExpressionDependency.Template() + ); + + compilation.dependencyTemplates.set( + HarmonyExportSpecifierDependency, + new HarmonyExportSpecifierDependency.Template() + ); + + compilation.dependencyFactories.set( + HarmonyExportImportedSpecifierDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + HarmonyExportImportedSpecifierDependency, + new HarmonyExportImportedSpecifierDependency.Template() ); - hooks.chunkHash.tap( - "ArrayPushCallbackChunkFormatPlugin", - (chunk, hash, { chunkGraph, runtimeTemplate }) => { - if (chunk.hasRuntime()) return; - hash.update( - `ArrayPushCallbackChunkFormatPlugin1${runtimeTemplate.outputOptions.chunkLoadingGlobal}${runtimeTemplate.outputOptions.hotUpdateGlobal}${runtimeTemplate.globalObject}` - ); - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); - updateHashForEntryStartup(hash, chunkGraph, entries, chunk); - } + + compilation.dependencyTemplates.set( + HarmonyAcceptDependency, + new HarmonyAcceptDependency.Template() ); + + compilation.dependencyFactories.set( + HarmonyAcceptImportDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + HarmonyAcceptImportDependency, + new HarmonyAcceptImportDependency.Template() + ); + + const handler = (parser, parserOptions) => { + // TODO webpack 6: rename harmony to esm or module + if (parserOptions.harmony !== undefined && !parserOptions.harmony) + return; + + new HarmonyDetectionParserPlugin(this.options).apply(parser); + new HarmonyImportDependencyParserPlugin(parserOptions).apply(parser); + new HarmonyExportDependencyParserPlugin(parserOptions).apply(parser); + new HarmonyTopLevelThisParserPlugin().apply(parser); + }; + + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("HarmonyModulesPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("HarmonyModulesPlugin", handler); } ); } } +module.exports = HarmonyModulesPlugin; -module.exports = ArrayPushCallbackChunkFormatPlugin; + +/***/ }), + +/***/ 63232: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Florent Cailhol @ooflorent +*/ + + + +const ConstDependency = __webpack_require__(76911); +const HarmonyExports = __webpack_require__(39211); + +class HarmonyTopLevelThisParserPlugin { + apply(parser) { + parser.hooks.expression + .for("this") + .tap("HarmonyTopLevelThisParserPlugin", node => { + if (!parser.scope.topLevelScope) return; + if (HarmonyExports.isEnabled(parser.state)) { + const dep = new ConstDependency("undefined", node.range, null); + dep.loc = node.loc; + parser.state.module.addPresentationalDependency(dep); + return this; + } + }); + } +} + +module.exports = HarmonyTopLevelThisParserPlugin; /***/ }), -/***/ 950: -/***/ (function(module) { +/***/ 1902: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -88723,705 +87185,542 @@ module.exports = ArrayPushCallbackChunkFormatPlugin; -/** @typedef {import("estree").Node} EsTreeNode */ -/** @typedef {import("./JavascriptParser").VariableInfoInterface} VariableInfoInterface */ +const makeSerializable = __webpack_require__(33032); +const ContextDependency = __webpack_require__(88101); +const ContextDependencyTemplateAsRequireCall = __webpack_require__(75815); -const TypeUnknown = 0; -const TypeUndefined = 1; -const TypeNull = 2; -const TypeString = 3; -const TypeNumber = 4; -const TypeBoolean = 5; -const TypeRegExp = 6; -const TypeConditional = 7; -const TypeArray = 8; -const TypeConstArray = 9; -const TypeIdentifier = 10; -const TypeWrapped = 11; -const TypeTemplateString = 12; -const TypeBigInt = 13; +class ImportContextDependency extends ContextDependency { + constructor(options, range, valueRange) { + super(options); -class BasicEvaluatedExpression { - constructor() { - this.type = TypeUnknown; - /** @type {[number, number]} */ - this.range = undefined; - /** @type {boolean} */ - this.falsy = false; - /** @type {boolean} */ - this.truthy = false; - /** @type {boolean | undefined} */ - this.nullish = undefined; - /** @type {boolean} */ - this.sideEffects = true; - /** @type {boolean | undefined} */ - this.bool = undefined; - /** @type {number | undefined} */ - this.number = undefined; - /** @type {bigint | undefined} */ - this.bigint = undefined; - /** @type {RegExp | undefined} */ - this.regExp = undefined; - /** @type {string | undefined} */ - this.string = undefined; - /** @type {BasicEvaluatedExpression[] | undefined} */ - this.quasis = undefined; - /** @type {BasicEvaluatedExpression[] | undefined} */ - this.parts = undefined; - /** @type {any[] | undefined} */ - this.array = undefined; - /** @type {BasicEvaluatedExpression[] | undefined} */ - this.items = undefined; - /** @type {BasicEvaluatedExpression[] | undefined} */ - this.options = undefined; - /** @type {BasicEvaluatedExpression | undefined} */ - this.prefix = undefined; - /** @type {BasicEvaluatedExpression | undefined} */ - this.postfix = undefined; - this.wrappedInnerExpressions = undefined; - /** @type {string | undefined} */ - this.identifier = undefined; - /** @type {VariableInfoInterface} */ - this.rootInfo = undefined; - /** @type {() => string[]} */ - this.getMembers = undefined; - /** @type {EsTreeNode} */ - this.expression = undefined; + this.range = range; + this.valueRange = valueRange; } - isUnknown() { - return this.type === TypeUnknown; + get type() { + return `import() context ${this.options.mode}`; } - isNull() { - return this.type === TypeNull; + get category() { + return "esm"; } - isUndefined() { - return this.type === TypeUndefined; - } + serialize(context) { + const { write } = context; - isString() { - return this.type === TypeString; - } + write(this.range); + write(this.valueRange); - isNumber() { - return this.type === TypeNumber; + super.serialize(context); } - isBigInt() { - return this.type === TypeBigInt; - } + deserialize(context) { + const { read } = context; - isBoolean() { - return this.type === TypeBoolean; - } + this.range = read(); + this.valueRange = read(); - isRegExp() { - return this.type === TypeRegExp; + super.deserialize(context); } +} - isConditional() { - return this.type === TypeConditional; - } +makeSerializable( + ImportContextDependency, + "webpack/lib/dependencies/ImportContextDependency" +); - isArray() { - return this.type === TypeArray; - } +ImportContextDependency.Template = ContextDependencyTemplateAsRequireCall; - isConstArray() { - return this.type === TypeConstArray; - } +module.exports = ImportContextDependency; - isIdentifier() { - return this.type === TypeIdentifier; - } - isWrapped() { - return this.type === TypeWrapped; - } +/***/ }), - isTemplateString() { - return this.type === TypeTemplateString; - } +/***/ 89376: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * Is expression a primitive or an object type value? - * @returns {boolean | undefined} true: primitive type, false: object type, undefined: unknown/runtime-defined - */ - isPrimitiveType() { - switch (this.type) { - case TypeUndefined: - case TypeNull: - case TypeString: - case TypeNumber: - case TypeBoolean: - case TypeBigInt: - case TypeWrapped: - case TypeTemplateString: - return true; - case TypeRegExp: - case TypeArray: - case TypeConstArray: - return false; - default: - return undefined; - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * Is expression a runtime or compile-time value? - * @returns {boolean} true: compile time value, false: runtime value - */ - isCompileTimeValue() { - switch (this.type) { - case TypeUndefined: - case TypeNull: - case TypeString: - case TypeNumber: - case TypeBoolean: - case TypeRegExp: - case TypeConstArray: - case TypeBigInt: - return true; - default: - return false; - } - } + +const Dependency = __webpack_require__(54912); +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + +class ImportDependency extends ModuleDependency { /** - * Gets the compile-time value of the expression - * @returns {any} the javascript value + * @param {string} request the request + * @param {[number, number]} range expression range + * @param {string[][]=} referencedExports list of referenced exports */ - asCompileTimeValue() { - switch (this.type) { - case TypeUndefined: - return undefined; - case TypeNull: - return null; - case TypeString: - return this.string; - case TypeNumber: - return this.number; - case TypeBoolean: - return this.bool; - case TypeRegExp: - return this.regExp; - case TypeConstArray: - return this.array; - case TypeBigInt: - return this.bigint; - default: - throw new Error( - "asCompileTimeValue must only be called for compile-time values" - ); - } - } - - isTruthy() { - return this.truthy; + constructor(request, range, referencedExports) { + super(request); + this.range = range; + this.referencedExports = referencedExports; } - isFalsy() { - return this.falsy; + get type() { + return "import()"; } - isNullish() { - return this.nullish; + get category() { + return "esm"; } /** - * Can this expression have side effects? - * @returns {boolean} false: never has side effects + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports */ - couldHaveSideEffects() { - return this.sideEffects; + getReferencedExports(moduleGraph, runtime) { + return this.referencedExports + ? this.referencedExports.map(e => ({ + name: e, + canMangle: false + })) + : Dependency.EXPORTS_OBJECT_REFERENCED; } - asBool() { - if (this.truthy) return true; - if (this.falsy || this.nullish) return false; - if (this.isBoolean()) return this.bool; - if (this.isNull()) return false; - if (this.isUndefined()) return false; - if (this.isString()) return this.string !== ""; - if (this.isNumber()) return this.number !== 0; - if (this.isBigInt()) return this.bigint !== BigInt(0); - if (this.isRegExp()) return true; - if (this.isArray()) return true; - if (this.isConstArray()) return true; - if (this.isWrapped()) { - return (this.prefix && this.prefix.asBool()) || - (this.postfix && this.postfix.asBool()) - ? true - : undefined; - } - if (this.isTemplateString()) { - const str = this.asString(); - if (typeof str === "string") return str !== ""; - } - return undefined; + serialize(context) { + context.write(this.range); + context.write(this.referencedExports); + super.serialize(context); } - asNullish() { - const nullish = this.isNullish(); + deserialize(context) { + this.range = context.read(); + this.referencedExports = context.read(); + super.deserialize(context); + } +} - if (nullish === true || this.isNull() || this.isUndefined()) return true; +makeSerializable(ImportDependency, "webpack/lib/dependencies/ImportDependency"); - if (nullish === false) return false; - if (this.isTruthy()) return false; - if (this.isBoolean()) return false; - if (this.isString()) return false; - if (this.isNumber()) return false; - if (this.isBigInt()) return false; - if (this.isRegExp()) return false; - if (this.isArray()) return false; - if (this.isConstArray()) return false; - if (this.isTemplateString()) return false; - if (this.isRegExp()) return false; +ImportDependency.Template = class ImportDependencyTemplate extends ( + ModuleDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements } + ) { + const dep = /** @type {ImportDependency} */ (dependency); + const block = /** @type {AsyncDependenciesBlock} */ ( + moduleGraph.getParentBlock(dep) + ); + const content = runtimeTemplate.moduleNamespacePromise({ + chunkGraph, + block: block, + module: moduleGraph.getModule(dep), + request: dep.request, + strict: module.buildMeta.strictHarmonyModule, + message: "import()", + runtimeRequirements + }); - return undefined; + source.replace(dep.range[0], dep.range[1] - 1, content); } +}; - asString() { - if (this.isBoolean()) return `${this.bool}`; - if (this.isNull()) return "null"; - if (this.isUndefined()) return "undefined"; - if (this.isString()) return this.string; - if (this.isNumber()) return `${this.number}`; - if (this.isBigInt()) return `${this.bigint}`; - if (this.isRegExp()) return `${this.regExp}`; - if (this.isArray()) { - let array = []; - for (const item of this.items) { - const itemStr = item.asString(); - if (itemStr === undefined) return undefined; - array.push(itemStr); - } - return `${array}`; - } - if (this.isConstArray()) return `${this.array}`; - if (this.isTemplateString()) { - let str = ""; - for (const part of this.parts) { - const partStr = part.asString(); - if (partStr === undefined) return undefined; - str += partStr; - } - return str; - } - return undefined; - } +module.exports = ImportDependency; - setString(string) { - this.type = TypeString; - this.string = string; - this.sideEffects = false; - return this; - } - setUndefined() { - this.type = TypeUndefined; - this.sideEffects = false; - return this; - } +/***/ }), - setNull() { - this.type = TypeNull; - this.sideEffects = false; - return this; - } +/***/ 50718: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - setNumber(number) { - this.type = TypeNumber; - this.number = number; - this.sideEffects = false; - return this; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - setBigInt(bigint) { - this.type = TypeBigInt; - this.bigint = bigint; - this.sideEffects = false; - return this; - } - setBoolean(bool) { - this.type = TypeBoolean; - this.bool = bool; - this.sideEffects = false; - return this; - } - setRegExp(regExp) { - this.type = TypeRegExp; - this.regExp = regExp; - this.sideEffects = false; - return this; - } +const makeSerializable = __webpack_require__(33032); +const ImportDependency = __webpack_require__(89376); - setIdentifier(identifier, rootInfo, getMembers) { - this.type = TypeIdentifier; - this.identifier = identifier; - this.rootInfo = rootInfo; - this.getMembers = getMembers; - this.sideEffects = true; - return this; +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ + +class ImportEagerDependency extends ImportDependency { + /** + * @param {string} request the request + * @param {[number, number]} range expression range + * @param {string[][]=} referencedExports list of referenced exports + */ + constructor(request, range, referencedExports) { + super(request, range, referencedExports); } - setWrapped(prefix, postfix, innerExpressions) { - this.type = TypeWrapped; - this.prefix = prefix; - this.postfix = postfix; - this.wrappedInnerExpressions = innerExpressions; - this.sideEffects = true; - return this; + get type() { + return "import() eager"; } - setOptions(options) { - this.type = TypeConditional; - this.options = options; - this.sideEffects = true; - return this; + get category() { + return "esm"; } +} - addOptions(options) { - if (!this.options) { - this.type = TypeConditional; - this.options = []; - this.sideEffects = true; - } - for (const item of options) { - this.options.push(item); - } - return this; - } +makeSerializable( + ImportEagerDependency, + "webpack/lib/dependencies/ImportEagerDependency" +); - setItems(items) { - this.type = TypeArray; - this.items = items; - this.sideEffects = items.some(i => i.couldHaveSideEffects()); - return this; - } +ImportEagerDependency.Template = class ImportEagerDependencyTemplate extends ( + ImportDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements } + ) { + const dep = /** @type {ImportEagerDependency} */ (dependency); + const content = runtimeTemplate.moduleNamespacePromise({ + chunkGraph, + module: moduleGraph.getModule(dep), + request: dep.request, + strict: module.buildMeta.strictHarmonyModule, + message: "import() eager", + runtimeRequirements + }); - setArray(array) { - this.type = TypeConstArray; - this.array = array; - this.sideEffects = false; - return this; + source.replace(dep.range[0], dep.range[1] - 1, content); } +}; - setTemplateString(quasis, parts, kind) { - this.type = TypeTemplateString; - this.quasis = quasis; - this.parts = parts; - this.templateStringKind = kind; - this.sideEffects = parts.some(p => p.sideEffects); - return this; - } +module.exports = ImportEagerDependency; - setTruthy() { - this.falsy = false; - this.truthy = true; - this.nullish = false; - return this; - } - setFalsy() { - this.falsy = true; - this.truthy = false; - return this; - } +/***/ }), - setNullish(value) { - this.nullish = value; +/***/ 51274: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (value) return this.setFalsy(); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ - return this; - } - setRange(range) { + +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); +const ModuleDependencyTemplateAsId = __webpack_require__(80825); + +class ImportMetaHotAcceptDependency extends ModuleDependency { + constructor(request, range) { + super(request); this.range = range; - return this; + this.weak = true; } - setSideEffects(sideEffects = true) { - this.sideEffects = sideEffects; - return this; + get type() { + return "import.meta.webpackHot.accept"; } - setExpression(expression) { - this.expression = expression; - return this; + get category() { + return "esm"; } } -/** - * @param {string} flags regexp flags - * @returns {boolean} is valid flags - */ -BasicEvaluatedExpression.isValidRegExpFlags = flags => { - const len = flags.length; - - if (len === 0) return true; - if (len > 4) return false; - - // cspell:word gimy - let remaining = 0b0000; // bit per RegExp flag: gimy - - for (let i = 0; i < len; i++) - switch (flags.charCodeAt(i)) { - case 103 /* g */: - if (remaining & 0b1000) return false; - remaining |= 0b1000; - break; - case 105 /* i */: - if (remaining & 0b0100) return false; - remaining |= 0b0100; - break; - case 109 /* m */: - if (remaining & 0b0010) return false; - remaining |= 0b0010; - break; - case 121 /* y */: - if (remaining & 0b0001) return false; - remaining |= 0b0001; - break; - default: - return false; - } +makeSerializable( + ImportMetaHotAcceptDependency, + "webpack/lib/dependencies/ImportMetaHotAcceptDependency" +); - return true; -}; +ImportMetaHotAcceptDependency.Template = ModuleDependencyTemplateAsId; -module.exports = BasicEvaluatedExpression; +module.exports = ImportMetaHotAcceptDependency; /***/ }), -/***/ 91145: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 53141: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ -const Entrypoint = __webpack_require__(13795); +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); +const ModuleDependencyTemplateAsId = __webpack_require__(80825); -/** @typedef {import("../Chunk")} Chunk */ +class ImportMetaHotDeclineDependency extends ModuleDependency { + constructor(request, range) { + super(request); -/** - * @param {Entrypoint} entrypoint a chunk group - * @param {Chunk} excludedChunk1 current chunk which is excluded - * @param {Chunk} excludedChunk2 runtime chunk which is excluded - * @returns {Set} chunks - */ -const getAllChunks = (entrypoint, excludedChunk1, excludedChunk2) => { - const queue = new Set([entrypoint]); - const chunks = new Set(); - for (const entrypoint of queue) { - for (const chunk of entrypoint.chunks) { - if (chunk === excludedChunk1) continue; - if (chunk === excludedChunk2) continue; - chunks.add(chunk); - } - for (const parent of entrypoint.parentsIterable) { - if (parent instanceof Entrypoint) queue.add(parent); - } + this.range = range; + this.weak = true; } - return chunks; -}; -exports.getAllChunks = getAllChunks; + + get type() { + return "import.meta.webpackHot.decline"; + } + + get category() { + return "esm"; + } +} + +makeSerializable( + ImportMetaHotDeclineDependency, + "webpack/lib/dependencies/ImportMetaHotDeclineDependency" +); + +ImportMetaHotDeclineDependency.Template = ModuleDependencyTemplateAsId; + +module.exports = ImportMetaHotDeclineDependency; /***/ }), -/***/ 84508: +/***/ 17228: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ -const { ConcatSource, RawSource } = __webpack_require__(51255); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const { - getChunkFilenameTemplate, - getCompilationHooks -} = __webpack_require__(89464); +const { pathToFileURL } = __webpack_require__(57310); +const ModuleDependencyWarning = __webpack_require__(29656); +const Template = __webpack_require__(39722); +const BasicEvaluatedExpression = __webpack_require__(950); const { - generateEntryStartup, - updateHashForEntryStartup -} = __webpack_require__(98124); + evaluateToIdentifier, + toConstantDependency, + evaluateToString, + evaluateToNumber +} = __webpack_require__(93998); +const memoize = __webpack_require__(78676); +const propertyAccess = __webpack_require__(54190); +const ConstDependency = __webpack_require__(76911); +/** @typedef {import("estree").MemberExpression} MemberExpression */ +/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ /** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../javascript/JavascriptParser")} Parser */ -class CommonJsChunkFormatPlugin { +const getCriticalDependencyWarning = memoize(() => + __webpack_require__(15427) +); + +class ImportMetaPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {Compiler} compiler compiler */ apply(compiler) { - compiler.hooks.thisCompilation.tap( - "CommonJsChunkFormatPlugin", - compilation => { - compilation.hooks.additionalChunkRuntimeRequirements.tap( - "CommonJsChunkLoadingPlugin", - (chunk, set, { chunkGraph }) => { - if (chunk.hasRuntime()) return; - if (chunkGraph.getNumberOfEntryModules(chunk) > 0) { - set.add(RuntimeGlobals.require); - set.add(RuntimeGlobals.startupEntrypoint); - set.add(RuntimeGlobals.externalInstallChunk); - } + compiler.hooks.compilation.tap( + "ImportMetaPlugin", + (compilation, { normalModuleFactory }) => { + /** + * @param {NormalModule} module module + * @returns {string} file url + */ + const getUrl = module => { + return pathToFileURL(module.resource).toString(); + }; + /** + * @param {Parser} parser parser parser + * @param {JavascriptParserOptions} parserOptions parserOptions + * @returns {void} + */ + const parserHandler = (parser, { importMeta }) => { + if (importMeta === false) { + const { importMetaName } = compilation.outputOptions; + if (importMetaName === "import.meta") return; + + parser.hooks.expression + .for("import.meta") + .tap("ImportMetaPlugin", metaProperty => { + const dep = new ConstDependency( + importMetaName, + metaProperty.range + ); + dep.loc = metaProperty.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + return; } - ); - const hooks = getCompilationHooks(compilation); - hooks.renderChunk.tap( - "CommonJsChunkFormatPlugin", - (modules, renderContext) => { - const { chunk, chunkGraph, runtimeTemplate } = renderContext; - const source = new ConcatSource(); - source.add(`exports.id = ${JSON.stringify(chunk.id)};\n`); - source.add(`exports.ids = ${JSON.stringify(chunk.ids)};\n`); - source.add(`exports.modules = `); - source.add(modules); - source.add(";\n"); - const runtimeModules = - chunkGraph.getChunkRuntimeModulesInOrder(chunk); - if (runtimeModules.length > 0) { - source.add("exports.runtime =\n"); - source.add( - Template.renderChunkRuntimeModules( - runtimeModules, - renderContext - ) - ); - } - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + + /// import.meta direct /// + parser.hooks.typeof + .for("import.meta") + .tap( + "ImportMetaPlugin", + toConstantDependency(parser, JSON.stringify("object")) ); - if (entries.length > 0) { - const runtimeChunk = entries[0][1].getRuntimeChunk(); - const currentOutputName = compilation - .getPath( - getChunkFilenameTemplate(chunk, compilation.outputOptions), - { - chunk, - contentHashType: "javascript" - } - ) - .split("/"); - const runtimeOutputName = compilation - .getPath( - getChunkFilenameTemplate( - runtimeChunk, - compilation.outputOptions + parser.hooks.expression + .for("import.meta") + .tap("ImportMetaPlugin", metaProperty => { + const CriticalDependencyWarning = getCriticalDependencyWarning(); + parser.state.module.addWarning( + new ModuleDependencyWarning( + parser.state.module, + new CriticalDependencyWarning( + "Accessing import.meta directly is unsupported (only property access is supported)" ), - { - chunk: runtimeChunk, - contentHashType: "javascript" - } + metaProperty.loc ) - .split("/"); - - // remove filename, we only need the directory - currentOutputName.pop(); - - // remove common parts - while ( - currentOutputName.length > 0 && - runtimeOutputName.length > 0 && - currentOutputName[0] === runtimeOutputName[0] - ) { - currentOutputName.shift(); - runtimeOutputName.shift(); - } - - // create final path - const runtimePath = - (currentOutputName.length > 0 - ? "../".repeat(currentOutputName.length) - : "./") + runtimeOutputName.join("/"); - - const entrySource = new ConcatSource(); - entrySource.add( - `(${ - runtimeTemplate.supportsArrowFunction() - ? "() => " - : "function() " - }{\n` - ); - entrySource.add("var exports = {};\n"); - entrySource.add(source); - entrySource.add(";\n\n// load runtime\n"); - entrySource.add( - `var __webpack_require__ = require(${JSON.stringify( - runtimePath - )});\n` - ); - entrySource.add( - `${RuntimeGlobals.externalInstallChunk}(exports);\n` ); - const startupSource = new RawSource( - generateEntryStartup( - chunkGraph, - runtimeTemplate, - entries, - chunk, - false - ) + const dep = new ConstDependency( + `${parser.isAsiPosition(metaProperty.range[0]) ? ";" : ""}({})`, + metaProperty.range ); - entrySource.add( - hooks.renderStartup.call( - startupSource, - entries[entries.length - 1][0], - { - ...renderContext, - inlined: false - } - ) + dep.loc = metaProperty.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + parser.hooks.evaluateTypeof + .for("import.meta") + .tap("ImportMetaPlugin", evaluateToString("object")); + parser.hooks.evaluateIdentifier.for("import.meta").tap( + "ImportMetaPlugin", + evaluateToIdentifier("import.meta", "import.meta", () => [], true) + ); + + /// import.meta.url /// + parser.hooks.typeof + .for("import.meta.url") + .tap( + "ImportMetaPlugin", + toConstantDependency(parser, JSON.stringify("string")) + ); + parser.hooks.expression + .for("import.meta.url") + .tap("ImportMetaPlugin", expr => { + const dep = new ConstDependency( + JSON.stringify(getUrl(parser.state.module)), + expr.range ); - entrySource.add("\n})()"); - return entrySource; - } - return source; - } - ); - hooks.chunkHash.tap( - "CommonJsChunkFormatPlugin", - (chunk, hash, { chunkGraph }) => { - if (chunk.hasRuntime()) return; - hash.update("CommonJsChunkFormatPlugin"); - hash.update("1"); - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + parser.hooks.evaluateTypeof + .for("import.meta.url") + .tap("ImportMetaPlugin", evaluateToString("string")); + parser.hooks.evaluateIdentifier + .for("import.meta.url") + .tap("ImportMetaPlugin", expr => { + return new BasicEvaluatedExpression() + .setString(getUrl(parser.state.module)) + .setRange(expr.range); + }); + + /// import.meta.webpack /// + const webpackVersion = parseInt( + (__webpack_require__(32702)/* .version */ .i8), + 10 + ); + parser.hooks.typeof + .for("import.meta.webpack") + .tap( + "ImportMetaPlugin", + toConstantDependency(parser, JSON.stringify("number")) ); - updateHashForEntryStartup(hash, chunkGraph, entries, chunk); - } - ); + parser.hooks.expression + .for("import.meta.webpack") + .tap( + "ImportMetaPlugin", + toConstantDependency(parser, JSON.stringify(webpackVersion)) + ); + parser.hooks.evaluateTypeof + .for("import.meta.webpack") + .tap("ImportMetaPlugin", evaluateToString("number")); + parser.hooks.evaluateIdentifier + .for("import.meta.webpack") + .tap("ImportMetaPlugin", evaluateToNumber(webpackVersion)); + + /// Unknown properties /// + parser.hooks.unhandledExpressionMemberChain + .for("import.meta") + .tap("ImportMetaPlugin", (expr, members) => { + const dep = new ConstDependency( + `${Template.toNormalComment( + "unsupported import.meta." + members.join(".") + )} undefined${propertyAccess(members, 1)}`, + expr.range + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + parser.hooks.evaluate + .for("MemberExpression") + .tap("ImportMetaPlugin", expression => { + const expr = /** @type {MemberExpression} */ (expression); + if ( + expr.object.type === "MetaProperty" && + expr.object.meta.name === "import" && + expr.object.property.name === "meta" && + expr.property.type === + (expr.computed ? "Literal" : "Identifier") + ) { + return new BasicEvaluatedExpression() + .setUndefined() + .setRange(expr.range); + } + }); + }; + + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("ImportMetaPlugin", parserHandler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("ImportMetaPlugin", parserHandler); } ); } } -module.exports = CommonJsChunkFormatPlugin; +module.exports = ImportMetaPlugin; /***/ }), -/***/ 61291: +/***/ 88130: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -89432,355 +87731,271 @@ module.exports = CommonJsChunkFormatPlugin; -/** @typedef {import("../../declarations/WebpackOptions").ChunkLoadingType} ChunkLoadingType */ -/** @typedef {import("../Compiler")} Compiler */ - -/** @type {WeakMap>} */ -const enabledTypes = new WeakMap(); +const AsyncDependenciesBlock = __webpack_require__(47736); +const CommentCompilationWarning = __webpack_require__(98427); +const UnsupportedFeatureWarning = __webpack_require__(42495); +const ContextDependencyHelpers = __webpack_require__(99630); +const ImportContextDependency = __webpack_require__(1902); +const ImportDependency = __webpack_require__(89376); +const ImportEagerDependency = __webpack_require__(50718); +const ImportWeakDependency = __webpack_require__(82483); -const getEnabledTypes = compiler => { - let set = enabledTypes.get(compiler); - if (set === undefined) { - set = new Set(); - enabledTypes.set(compiler, set); - } - return set; -}; +/** @typedef {import("../ChunkGroup").RawChunkGroupOptions} RawChunkGroupOptions */ +/** @typedef {import("../ContextModule").ContextMode} ContextMode */ -class EnableChunkLoadingPlugin { - /** - * @param {ChunkLoadingType} type library type that should be available - */ - constructor(type) { - this.type = type; +class ImportParserPlugin { + constructor(options) { + this.options = options; } - /** - * @param {Compiler} compiler the compiler instance - * @param {ChunkLoadingType} type type of library - * @returns {void} - */ - static setEnabled(compiler, type) { - getEnabledTypes(compiler).add(type); - } + apply(parser) { + parser.hooks.importCall.tap("ImportParserPlugin", expr => { + const param = parser.evaluateExpression(expr.source); - /** - * @param {Compiler} compiler the compiler instance - * @param {ChunkLoadingType} type type of library - * @returns {void} - */ - static checkEnabled(compiler, type) { - if (!getEnabledTypes(compiler).has(type)) { - throw new Error( - `Chunk loading type "${type}" is not enabled. ` + - "EnableChunkLoadingPlugin need to be used to enable this type of chunk loading. " + - 'This usually happens through the "output.enabledChunkLoadingTypes" option. ' + - 'If you are using a function as entry which sets "chunkLoading", you need to add all potential chunk loading types to "output.enabledChunkLoadingTypes". ' + - "These types are enabled: " + - Array.from(getEnabledTypes(compiler)).join(", ") - ); - } - } + let chunkName = null; + /** @type {ContextMode} */ + let mode = "lazy"; + let include = null; + let exclude = null; + /** @type {string[][] | null} */ + let exports = null; + /** @type {RawChunkGroupOptions} */ + const groupOptions = {}; - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const { type } = this; + const { options: importOptions, errors: commentErrors } = + parser.parseCommentOptions(expr.range); - // Only enable once - const enabled = getEnabledTypes(compiler); - if (enabled.has(type)) return; - enabled.add(type); + if (commentErrors) { + for (const e of commentErrors) { + const { comment } = e; + parser.state.module.addWarning( + new CommentCompilationWarning( + `Compilation error while processing magic comment(-s): /*${comment.value}*/: ${e.message}`, + comment.loc + ) + ); + } + } - if (typeof type === "string") { - switch (type) { - case "jsonp": { - const JsonpChunkLoadingPlugin = __webpack_require__(83121); - new JsonpChunkLoadingPlugin().apply(compiler); - break; + if (importOptions) { + if (importOptions.webpackIgnore !== undefined) { + if (typeof importOptions.webpackIgnore !== "boolean") { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackIgnore\` expected a boolean, but received: ${importOptions.webpackIgnore}.`, + expr.loc + ) + ); + } else { + // Do not instrument `import()` if `webpackIgnore` is `true` + if (importOptions.webpackIgnore) { + return false; + } + } } - case "import-scripts": { - const ImportScriptsChunkLoadingPlugin = __webpack_require__(54182); - new ImportScriptsChunkLoadingPlugin().apply(compiler); - break; + if (importOptions.webpackChunkName !== undefined) { + if (typeof importOptions.webpackChunkName !== "string") { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackChunkName\` expected a string, but received: ${importOptions.webpackChunkName}.`, + expr.loc + ) + ); + } else { + chunkName = importOptions.webpackChunkName; + } } - case "require": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const CommonJsChunkLoadingPlugin = __webpack_require__(1313); - new CommonJsChunkLoadingPlugin({ - asyncChunkLoading: false - }).apply(compiler); - break; + if (importOptions.webpackMode !== undefined) { + if (typeof importOptions.webpackMode !== "string") { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackMode\` expected a string, but received: ${importOptions.webpackMode}.`, + expr.loc + ) + ); + } else { + mode = importOptions.webpackMode; + } } - case "async-node": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const CommonJsChunkLoadingPlugin = __webpack_require__(1313); - new CommonJsChunkLoadingPlugin({ - asyncChunkLoading: true - }).apply(compiler); - break; + if (importOptions.webpackPrefetch !== undefined) { + if (importOptions.webpackPrefetch === true) { + groupOptions.prefetchOrder = 0; + } else if (typeof importOptions.webpackPrefetch === "number") { + groupOptions.prefetchOrder = importOptions.webpackPrefetch; + } else { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackPrefetch\` expected true or a number, but received: ${importOptions.webpackPrefetch}.`, + expr.loc + ) + ); + } } - case "import": { - const ModuleChunkLoadingPlugin = __webpack_require__(89831); - new ModuleChunkLoadingPlugin().apply(compiler); - break; + if (importOptions.webpackPreload !== undefined) { + if (importOptions.webpackPreload === true) { + groupOptions.preloadOrder = 0; + } else if (typeof importOptions.webpackPreload === "number") { + groupOptions.preloadOrder = importOptions.webpackPreload; + } else { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackPreload\` expected true or a number, but received: ${importOptions.webpackPreload}.`, + expr.loc + ) + ); + } + } + if (importOptions.webpackInclude !== undefined) { + if ( + !importOptions.webpackInclude || + importOptions.webpackInclude.constructor.name !== "RegExp" + ) { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackInclude\` expected a regular expression, but received: ${importOptions.webpackInclude}.`, + expr.loc + ) + ); + } else { + include = new RegExp(importOptions.webpackInclude); + } + } + if (importOptions.webpackExclude !== undefined) { + if ( + !importOptions.webpackExclude || + importOptions.webpackExclude.constructor.name !== "RegExp" + ) { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackExclude\` expected a regular expression, but received: ${importOptions.webpackExclude}.`, + expr.loc + ) + ); + } else { + exclude = new RegExp(importOptions.webpackExclude); + } + } + if (importOptions.webpackExports !== undefined) { + if ( + !( + typeof importOptions.webpackExports === "string" || + (Array.isArray(importOptions.webpackExports) && + importOptions.webpackExports.every( + item => typeof item === "string" + )) + ) + ) { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackExports\` expected a string or an array of strings, but received: ${importOptions.webpackExports}.`, + expr.loc + ) + ); + } else { + if (typeof importOptions.webpackExports === "string") { + exports = [[importOptions.webpackExports]]; + } else { + exports = Array.from(importOptions.webpackExports, e => [e]); + } + } } - case "universal": - // TODO implement universal chunk loading - throw new Error("Universal Chunk Loading is not implemented yet"); - default: - throw new Error(`Unsupported chunk loading type ${type}. -Plugins which provide custom chunk loading types must call EnableChunkLoadingPlugin.setEnabled(compiler, type) to disable this error.`); - } - } else { - // TODO support plugin instances here - // apply them to the compiler - } - } -} - -module.exports = EnableChunkLoadingPlugin; - - -/***/ }), - -/***/ 77106: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const util = __webpack_require__(73837); -const { RawSource, ReplaceSource } = __webpack_require__(51255); -const Generator = __webpack_require__(93401); -const InitFragment = __webpack_require__(55870); -const HarmonyCompatibilityDependency = __webpack_require__(72906); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../DependenciesBlock")} DependenciesBlock */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ -/** @typedef {import("../NormalModule")} NormalModule */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ - -// TODO: clean up this file -// replace with newer constructs - -const deprecatedGetInitFragments = util.deprecate( - (template, dependency, templateContext) => - template.getInitFragments(dependency, templateContext), - "DependencyTemplate.getInitFragment is deprecated (use apply(dep, source, { initFragments }) instead)", - "DEP_WEBPACK_JAVASCRIPT_GENERATOR_GET_INIT_FRAGMENTS" -); - -const TYPES = new Set(["javascript"]); - -class JavascriptGenerator extends Generator { - /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) - */ - getTypes(module) { - return TYPES; - } - - /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module - */ - getSize(module, type) { - const originalSource = module.originalSource(); - if (!originalSource) { - return 39; - } - return originalSource.size(); - } - - /** - * @param {NormalModule} module module for which the bailout reason should be determined - * @param {ConcatenationBailoutReasonContext} context context - * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated - */ - getConcatenationBailoutReason(module, context) { - // Only harmony modules are valid for optimization - if ( - !module.buildMeta || - module.buildMeta.exportsType !== "namespace" || - module.presentationalDependencies === undefined || - !module.presentationalDependencies.some( - d => d instanceof HarmonyCompatibilityDependency - ) - ) { - return "Module is not an ECMAScript module"; - } - - // Some expressions are not compatible with module concatenation - // because they may produce unexpected results. The plugin bails out - // if some were detected upfront. - if (module.buildInfo && module.buildInfo.moduleConcatenationBailout) { - return `Module uses ${module.buildInfo.moduleConcatenationBailout}`; - } - } - - /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code - */ - generate(module, generateContext) { - const originalSource = module.originalSource(); - if (!originalSource) { - return new RawSource("throw new Error('No source available');"); - } - - const source = new ReplaceSource(originalSource); - const initFragments = []; - - this.sourceModule(module, initFragments, source, generateContext); - - return InitFragment.addToSource(source, initFragments, generateContext); - } - - /** - * @param {Module} module the module to generate - * @param {InitFragment[]} initFragments mutable list of init fragments - * @param {ReplaceSource} source the current replace source which can be modified - * @param {GenerateContext} generateContext the generateContext - * @returns {void} - */ - sourceModule(module, initFragments, source, generateContext) { - for (const dependency of module.dependencies) { - this.sourceDependency( - module, - dependency, - initFragments, - source, - generateContext - ); - } - - if (module.presentationalDependencies !== undefined) { - for (const dependency of module.presentationalDependencies) { - this.sourceDependency( - module, - dependency, - initFragments, - source, - generateContext - ); } - } - - for (const childBlock of module.blocks) { - this.sourceBlock( - module, - childBlock, - initFragments, - source, - generateContext - ); - } - } - - /** - * @param {Module} module the module to generate - * @param {DependenciesBlock} block the dependencies block which will be processed - * @param {InitFragment[]} initFragments mutable list of init fragments - * @param {ReplaceSource} source the current replace source which can be modified - * @param {GenerateContext} generateContext the generateContext - * @returns {void} - */ - sourceBlock(module, block, initFragments, source, generateContext) { - for (const dependency of block.dependencies) { - this.sourceDependency( - module, - dependency, - initFragments, - source, - generateContext - ); - } - - for (const childBlock of block.blocks) { - this.sourceBlock( - module, - childBlock, - initFragments, - source, - generateContext - ); - } - } - - /** - * @param {Module} module the current module - * @param {Dependency} dependency the dependency to generate - * @param {InitFragment[]} initFragments mutable list of init fragments - * @param {ReplaceSource} source the current replace source which can be modified - * @param {GenerateContext} generateContext the render context - * @returns {void} - */ - sourceDependency(module, dependency, initFragments, source, generateContext) { - const constructor = /** @type {new (...args: any[]) => Dependency} */ ( - dependency.constructor - ); - const template = generateContext.dependencyTemplates.get(constructor); - if (!template) { - throw new Error( - "No template for dependency: " + dependency.constructor.name - ); - } - - const templateContext = { - runtimeTemplate: generateContext.runtimeTemplate, - dependencyTemplates: generateContext.dependencyTemplates, - moduleGraph: generateContext.moduleGraph, - chunkGraph: generateContext.chunkGraph, - module, - runtime: generateContext.runtime, - runtimeRequirements: generateContext.runtimeRequirements, - concatenationScope: generateContext.concatenationScope, - codeGenerationResults: generateContext.codeGenerationResults, - initFragments - }; - - template.apply(dependency, source, templateContext); - // TODO remove in webpack 6 - if ("getInitFragments" in template) { - const fragments = deprecatedGetInitFragments( - template, - dependency, - templateContext - ); + if (param.isString()) { + if (mode !== "lazy" && mode !== "eager" && mode !== "weak") { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackMode\` expected 'lazy', 'eager' or 'weak', but received: ${mode}.`, + expr.loc + ) + ); + } - if (fragments) { - for (const fragment of fragments) { - initFragments.push(fragment); + if (mode === "eager") { + const dep = new ImportEagerDependency( + param.string, + expr.range, + exports + ); + parser.state.current.addDependency(dep); + } else if (mode === "weak") { + const dep = new ImportWeakDependency( + param.string, + expr.range, + exports + ); + parser.state.current.addDependency(dep); + } else { + const depBlock = new AsyncDependenciesBlock( + { + ...groupOptions, + name: chunkName + }, + expr.loc, + param.string + ); + const dep = new ImportDependency(param.string, expr.range, exports); + dep.loc = expr.loc; + depBlock.addDependency(dep); + parser.state.current.addBlock(depBlock); + } + return true; + } else { + if ( + mode !== "lazy" && + mode !== "lazy-once" && + mode !== "eager" && + mode !== "weak" + ) { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackMode\` expected 'lazy', 'lazy-once', 'eager' or 'weak', but received: ${mode}.`, + expr.loc + ) + ); + mode = "lazy"; + } + + if (mode === "weak") { + mode = "async-weak"; } + const dep = ContextDependencyHelpers.create( + ImportContextDependency, + expr.range, + param, + expr, + this.options, + { + chunkName, + groupOptions, + include, + exclude, + mode, + namespaceObject: parser.state.module.buildMeta.strictHarmonyModule + ? "strict" + : true, + typePrefix: "import()", + category: "esm", + referencedExports: exports + }, + parser + ); + if (!dep) return; + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; } - } + }); } } -module.exports = JavascriptGenerator; +module.exports = ImportParserPlugin; /***/ }), -/***/ 89464: +/***/ 41293: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -89791,190 +88006,15 @@ module.exports = JavascriptGenerator; -const { SyncWaterfallHook, SyncHook, SyncBailHook } = __webpack_require__(6967); -const vm = __webpack_require__(26144); -const { - ConcatSource, - OriginalSource, - PrefixSource, - RawSource, - CachedSource -} = __webpack_require__(51255); -const Compilation = __webpack_require__(85720); -const { tryRunOrWebpackError } = __webpack_require__(11351); -const HotUpdateChunk = __webpack_require__(9597); -const InitFragment = __webpack_require__(55870); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const { last, someInIterable } = __webpack_require__(39104); -const StringXor = __webpack_require__(40293); -const { compareModulesByIdentifier } = __webpack_require__(29579); -const createHash = __webpack_require__(49835); -const nonNumericOnlyHash = __webpack_require__(55668); -const { intersectRuntime } = __webpack_require__(17156); -const JavascriptGenerator = __webpack_require__(77106); -const JavascriptParser = __webpack_require__(29050); +const ImportContextDependency = __webpack_require__(1902); +const ImportDependency = __webpack_require__(89376); +const ImportEagerDependency = __webpack_require__(50718); +const ImportParserPlugin = __webpack_require__(88130); +const ImportWeakDependency = __webpack_require__(82483); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../CodeGenerationResults")} CodeGenerationResults */ -/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ /** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("../util/Hash")} Hash */ - -/** - * @param {Chunk} chunk a chunk - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {boolean} true, when a JS file is needed for this chunk - */ -const chunkHasJs = (chunk, chunkGraph) => { - if (chunkGraph.getNumberOfEntryModules(chunk) > 0) return true; - - return chunkGraph.getChunkModulesIterableBySourceType(chunk, "javascript") - ? true - : false; -}; - -const printGeneratedCodeForStack = (module, code) => { - const lines = code.split("\n"); - const n = `${lines.length}`.length; - return `\n\nGenerated code for ${module.identifier()}\n${lines - .map((line, i, lines) => { - const iStr = `${i + 1}`; - return `${" ".repeat(n - iStr.length)}${iStr} | ${line}`; - }) - .join("\n")}`; -}; - -/** - * @typedef {Object} RenderContext - * @property {Chunk} chunk the chunk - * @property {DependencyTemplates} dependencyTemplates the dependency templates - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {CodeGenerationResults} codeGenerationResults results of code generation - * @property {boolean} strictMode rendering in strict context - */ - -/** - * @typedef {Object} MainRenderContext - * @property {Chunk} chunk the chunk - * @property {DependencyTemplates} dependencyTemplates the dependency templates - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {CodeGenerationResults} codeGenerationResults results of code generation - * @property {string} hash hash to be used for render call - * @property {boolean} strictMode rendering in strict context - */ - -/** - * @typedef {Object} ChunkRenderContext - * @property {Chunk} chunk the chunk - * @property {DependencyTemplates} dependencyTemplates the dependency templates - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {CodeGenerationResults} codeGenerationResults results of code generation - * @property {InitFragment[]} chunkInitFragments init fragments for the chunk - * @property {boolean} strictMode rendering in strict context - */ - -/** - * @typedef {Object} RenderBootstrapContext - * @property {Chunk} chunk the chunk - * @property {CodeGenerationResults} codeGenerationResults results of code generation - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {string} hash hash to be used for render call - */ - -/** @typedef {RenderContext & { inlined: boolean }} StartupRenderContext */ - -/** - * @typedef {Object} CompilationHooks - * @property {SyncWaterfallHook<[Source, Module, ChunkRenderContext]>} renderModuleContent - * @property {SyncWaterfallHook<[Source, Module, ChunkRenderContext]>} renderModuleContainer - * @property {SyncWaterfallHook<[Source, Module, ChunkRenderContext]>} renderModulePackage - * @property {SyncWaterfallHook<[Source, RenderContext]>} renderChunk - * @property {SyncWaterfallHook<[Source, RenderContext]>} renderMain - * @property {SyncWaterfallHook<[Source, RenderContext]>} renderContent - * @property {SyncWaterfallHook<[Source, RenderContext]>} render - * @property {SyncWaterfallHook<[Source, Module, StartupRenderContext]>} renderStartup - * @property {SyncWaterfallHook<[string, RenderBootstrapContext]>} renderRequire - * @property {SyncBailHook<[Module, RenderBootstrapContext], string>} inlineInRuntimeBailout - * @property {SyncBailHook<[Module, RenderContext], string>} embedInRuntimeBailout - * @property {SyncBailHook<[RenderContext], string>} strictRuntimeBailout - * @property {SyncHook<[Chunk, Hash, ChunkHashContext]>} chunkHash - * @property {SyncBailHook<[Chunk, RenderContext], boolean>} useSourceMap - */ - -/** @type {WeakMap} */ -const compilationHooksMap = new WeakMap(); - -class JavascriptModulesPlugin { - /** - * @param {Compilation} compilation the compilation - * @returns {CompilationHooks} the attached hooks - */ - static getCompilationHooks(compilation) { - if (!(compilation instanceof Compilation)) { - throw new TypeError( - "The 'compilation' argument must be an instance of Compilation" - ); - } - let hooks = compilationHooksMap.get(compilation); - if (hooks === undefined) { - hooks = { - renderModuleContent: new SyncWaterfallHook([ - "source", - "module", - "renderContext" - ]), - renderModuleContainer: new SyncWaterfallHook([ - "source", - "module", - "renderContext" - ]), - renderModulePackage: new SyncWaterfallHook([ - "source", - "module", - "renderContext" - ]), - render: new SyncWaterfallHook(["source", "renderContext"]), - renderContent: new SyncWaterfallHook(["source", "renderContext"]), - renderStartup: new SyncWaterfallHook([ - "source", - "module", - "startupRenderContext" - ]), - renderChunk: new SyncWaterfallHook(["source", "renderContext"]), - renderMain: new SyncWaterfallHook(["source", "renderContext"]), - renderRequire: new SyncWaterfallHook(["code", "renderContext"]), - inlineInRuntimeBailout: new SyncBailHook(["module", "renderContext"]), - embedInRuntimeBailout: new SyncBailHook(["module", "renderContext"]), - strictRuntimeBailout: new SyncBailHook(["renderContext"]), - chunkHash: new SyncHook(["chunk", "hash", "context"]), - useSourceMap: new SyncBailHook(["chunk", "renderContext"]) - }; - compilationHooksMap.set(compilation, hooks); - } - return hooks; - } - - constructor(options = {}) { - this.options = options; - /** @type {WeakMap} */ - this._moduleFactoryCache = new WeakMap(); - } +class ImportPlugin { /** * Apply the plugin * @param {Compiler} compiler the compiler instance @@ -89982,1183 +88022,646 @@ class JavascriptModulesPlugin { */ apply(compiler) { compiler.hooks.compilation.tap( - "JavascriptModulesPlugin", - (compilation, { normalModuleFactory }) => { - const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); - normalModuleFactory.hooks.createParser - .for("javascript/auto") - .tap("JavascriptModulesPlugin", options => { - return new JavascriptParser("auto"); - }); - normalModuleFactory.hooks.createParser - .for("javascript/dynamic") - .tap("JavascriptModulesPlugin", options => { - return new JavascriptParser("script"); - }); - normalModuleFactory.hooks.createParser - .for("javascript/esm") - .tap("JavascriptModulesPlugin", options => { - return new JavascriptParser("module"); - }); - normalModuleFactory.hooks.createGenerator - .for("javascript/auto") - .tap("JavascriptModulesPlugin", () => { - return new JavascriptGenerator(); - }); - normalModuleFactory.hooks.createGenerator - .for("javascript/dynamic") - .tap("JavascriptModulesPlugin", () => { - return new JavascriptGenerator(); - }); - normalModuleFactory.hooks.createGenerator - .for("javascript/esm") - .tap("JavascriptModulesPlugin", () => { - return new JavascriptGenerator(); - }); - compilation.hooks.renderManifest.tap( - "JavascriptModulesPlugin", - (result, options) => { - const { - hash, - chunk, - chunkGraph, - moduleGraph, - runtimeTemplate, - dependencyTemplates, - outputOptions, - codeGenerationResults - } = options; - - const hotUpdateChunk = - chunk instanceof HotUpdateChunk ? chunk : null; - - let render; - const filenameTemplate = - JavascriptModulesPlugin.getChunkFilenameTemplate( - chunk, - outputOptions - ); - if (hotUpdateChunk) { - render = () => - this.renderChunk( - { - chunk, - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - codeGenerationResults, - strictMode: runtimeTemplate.isModule() - }, - hooks - ); - } else if (chunk.hasRuntime()) { - render = () => - this.renderMain( - { - hash, - chunk, - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - codeGenerationResults, - strictMode: runtimeTemplate.isModule() - }, - hooks, - compilation - ); - } else { - if (!chunkHasJs(chunk, chunkGraph)) { - return result; - } - - render = () => - this.renderChunk( - { - chunk, - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - codeGenerationResults, - strictMode: runtimeTemplate.isModule() - }, - hooks - ); - } - - result.push({ - render, - filenameTemplate, - pathOptions: { - hash, - runtime: chunk.runtime, - chunk, - contentHashType: "javascript" - }, - info: { - javascriptModule: compilation.runtimeTemplate.isModule() - }, - identifier: hotUpdateChunk - ? `hotupdatechunk${chunk.id}` - : `chunk${chunk.id}`, - hash: chunk.contentHash.javascript - }); - - return result; - } - ); - compilation.hooks.chunkHash.tap( - "JavascriptModulesPlugin", - (chunk, hash, context) => { - hooks.chunkHash.call(chunk, hash, context); - if (chunk.hasRuntime()) { - this.updateHashWithBootstrap( - hash, - { - hash: "0000", - chunk, - codeGenerationResults: context.codeGenerationResults, - chunkGraph: context.chunkGraph, - moduleGraph: context.moduleGraph, - runtimeTemplate: context.runtimeTemplate - }, - hooks - ); - } - } + "ImportPlugin", + (compilation, { contextModuleFactory, normalModuleFactory }) => { + compilation.dependencyFactories.set( + ImportDependency, + normalModuleFactory ); - compilation.hooks.contentHash.tap("JavascriptModulesPlugin", chunk => { - const { - chunkGraph, - codeGenerationResults, - moduleGraph, - runtimeTemplate, - outputOptions: { - hashSalt, - hashDigest, - hashDigestLength, - hashFunction - } - } = compilation; - const hash = createHash(hashFunction); - if (hashSalt) hash.update(hashSalt); - if (chunk.hasRuntime()) { - this.updateHashWithBootstrap( - hash, - { - hash: "0000", - chunk, - codeGenerationResults, - chunkGraph: compilation.chunkGraph, - moduleGraph: compilation.moduleGraph, - runtimeTemplate: compilation.runtimeTemplate - }, - hooks - ); - } else { - hash.update(`${chunk.id} `); - hash.update(chunk.ids ? chunk.ids.join(",") : ""); - } - hooks.chunkHash.call(chunk, hash, { - chunkGraph, - codeGenerationResults, - moduleGraph, - runtimeTemplate - }); - const modules = chunkGraph.getChunkModulesIterableBySourceType( - chunk, - "javascript" - ); - if (modules) { - const xor = new StringXor(); - for (const m of modules) { - xor.add(chunkGraph.getModuleHash(m, chunk.runtime)); - } - xor.updateHash(hash); - } - const runtimeModules = chunkGraph.getChunkModulesIterableBySourceType( - chunk, - "runtime" - ); - if (runtimeModules) { - const xor = new StringXor(); - for (const m of runtimeModules) { - xor.add(chunkGraph.getModuleHash(m, chunk.runtime)); - } - xor.updateHash(hash); - } - const digest = /** @type {string} */ (hash.digest(hashDigest)); - chunk.contentHash.javascript = nonNumericOnlyHash( - digest, - hashDigestLength - ); - }); - compilation.hooks.additionalTreeRuntimeRequirements.tap( - "JavascriptModulesPlugin", - (chunk, set, { chunkGraph }) => { - if ( - !set.has(RuntimeGlobals.startupNoDefault) && - chunkGraph.hasChunkEntryDependentChunks(chunk) - ) { - set.add(RuntimeGlobals.onChunksLoaded); - set.add(RuntimeGlobals.require); - } - } + compilation.dependencyTemplates.set( + ImportDependency, + new ImportDependency.Template() + ); + + compilation.dependencyFactories.set( + ImportEagerDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + ImportEagerDependency, + new ImportEagerDependency.Template() ); - compilation.hooks.executeModule.tap( - "JavascriptModulesPlugin", - (options, context) => { - const source = - options.codeGenerationResult.sources.get("javascript"); - if (source === undefined) return; - const { module, moduleObject } = options; - const code = source.source(); - const fn = vm.runInThisContext( - `(function(${module.moduleArgument}, ${module.exportsArgument}, __webpack_require__) {\n${code}\n/**/})`, - { - filename: module.identifier(), - lineOffset: -1 - } - ); - try { - fn.call( - moduleObject.exports, - moduleObject, - moduleObject.exports, - context.__webpack_require__ - ); - } catch (e) { - e.stack += printGeneratedCodeForStack(options.module, code); - throw e; - } - } + compilation.dependencyFactories.set( + ImportWeakDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + ImportWeakDependency, + new ImportWeakDependency.Template() ); - compilation.hooks.executeModule.tap( - "JavascriptModulesPlugin", - (options, context) => { - const source = options.codeGenerationResult.sources.get("runtime"); - if (source === undefined) return; - let code = source.source(); - if (typeof code !== "string") code = code.toString(); - const fn = vm.runInThisContext( - `(function(__webpack_require__) {\n${code}\n/**/})`, - { - filename: options.module.identifier(), - lineOffset: -1 - } - ); - try { - fn.call(null, context.__webpack_require__); - } catch (e) { - e.stack += printGeneratedCodeForStack(options.module, code); - throw e; - } - } + compilation.dependencyFactories.set( + ImportContextDependency, + contextModuleFactory + ); + compilation.dependencyTemplates.set( + ImportContextDependency, + new ImportContextDependency.Template() ); + + const handler = (parser, parserOptions) => { + if (parserOptions.import !== undefined && !parserOptions.import) + return; + + new ImportParserPlugin(parserOptions).apply(parser); + }; + + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("ImportPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("ImportPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("ImportPlugin", handler); } ); } +} +module.exports = ImportPlugin; - static getChunkFilenameTemplate(chunk, outputOptions) { - if (chunk.filenameTemplate) { - return chunk.filenameTemplate; - } else if (chunk instanceof HotUpdateChunk) { - return outputOptions.hotUpdateChunkFilename; - } else if (chunk.canBeInitial()) { - return outputOptions.filename; - } else { - return outputOptions.chunkFilename; - } + +/***/ }), + +/***/ 82483: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const makeSerializable = __webpack_require__(33032); +const ImportDependency = __webpack_require__(89376); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ + +class ImportWeakDependency extends ImportDependency { + /** + * @param {string} request the request + * @param {[number, number]} range expression range + * @param {string[][]=} referencedExports list of referenced exports + */ + constructor(request, range, referencedExports) { + super(request, range, referencedExports); + this.weak = true; + } + + get type() { + return "import() weak"; } +} + +makeSerializable( + ImportWeakDependency, + "webpack/lib/dependencies/ImportWeakDependency" +); +ImportWeakDependency.Template = class ImportDependencyTemplate extends ( + ImportDependency.Template +) { /** - * @param {Module} module the rendered module - * @param {ChunkRenderContext} renderContext options object - * @param {CompilationHooks} hooks hooks - * @param {boolean} factory true: renders as factory method, false: pure module content - * @returns {Source} the newly generated source from rendering + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - renderModule(module, renderContext, hooks, factory) { - const { - chunk, + apply( + dependency, + source, + { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements } + ) { + const dep = /** @type {ImportWeakDependency} */ (dependency); + const content = runtimeTemplate.moduleNamespacePromise({ chunkGraph, - runtimeTemplate, - codeGenerationResults, - strictMode - } = renderContext; - try { - const codeGenResult = codeGenerationResults.get(module, chunk.runtime); - const moduleSource = codeGenResult.sources.get("javascript"); - if (!moduleSource) return null; - if (codeGenResult.data !== undefined) { - const chunkInitFragments = codeGenResult.data.get("chunkInitFragments"); - if (chunkInitFragments) { - for (const i of chunkInitFragments) - renderContext.chunkInitFragments.push(i); - } - } - const moduleSourcePostContent = tryRunOrWebpackError( - () => - hooks.renderModuleContent.call(moduleSource, module, renderContext), - "JavascriptModulesPlugin.getCompilationHooks().renderModuleContent" - ); - let moduleSourcePostContainer; - if (factory) { - const runtimeRequirements = chunkGraph.getModuleRuntimeRequirements( - module, - chunk.runtime - ); - const needModule = runtimeRequirements.has(RuntimeGlobals.module); - const needExports = runtimeRequirements.has(RuntimeGlobals.exports); - const needRequire = - runtimeRequirements.has(RuntimeGlobals.require) || - runtimeRequirements.has(RuntimeGlobals.requireScope); - const needThisAsExports = runtimeRequirements.has( - RuntimeGlobals.thisAsExports - ); - const needStrict = module.buildInfo.strict && !strictMode; - const cacheEntry = this._moduleFactoryCache.get( - moduleSourcePostContent - ); - let source; - if ( - cacheEntry && - cacheEntry.needModule === needModule && - cacheEntry.needExports === needExports && - cacheEntry.needRequire === needRequire && - cacheEntry.needThisAsExports === needThisAsExports && - cacheEntry.needStrict === needStrict - ) { - source = cacheEntry.source; - } else { - const factorySource = new ConcatSource(); - const args = []; - if (needExports || needRequire || needModule) - args.push( - needModule - ? module.moduleArgument - : "__unused_webpack_" + module.moduleArgument - ); - if (needExports || needRequire) - args.push( - needExports - ? module.exportsArgument - : "__unused_webpack_" + module.exportsArgument - ); - if (needRequire) args.push("__webpack_require__"); - if (!needThisAsExports && runtimeTemplate.supportsArrowFunction()) { - factorySource.add("/***/ ((" + args.join(", ") + ") => {\n\n"); - } else { - factorySource.add("/***/ (function(" + args.join(", ") + ") {\n\n"); - } - if (needStrict) { - factorySource.add('"use strict";\n'); - } - factorySource.add(moduleSourcePostContent); - factorySource.add("\n\n/***/ })"); - source = new CachedSource(factorySource); - this._moduleFactoryCache.set(moduleSourcePostContent, { - source, - needModule, - needExports, - needRequire, - needThisAsExports, - needStrict - }); - } - moduleSourcePostContainer = tryRunOrWebpackError( - () => hooks.renderModuleContainer.call(source, module, renderContext), - "JavascriptModulesPlugin.getCompilationHooks().renderModuleContainer" - ); - } else { - moduleSourcePostContainer = moduleSourcePostContent; + module: moduleGraph.getModule(dep), + request: dep.request, + strict: module.buildMeta.strictHarmonyModule, + message: "import() weak", + weak: true, + runtimeRequirements + }); + + source.replace(dep.range[0], dep.range[1] - 1, content); + } +}; + +module.exports = ImportWeakDependency; + + +/***/ }), + +/***/ 750: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); + +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency").ExportSpec} ExportSpec */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/Hash")} Hash */ + +const getExportsFromData = data => { + if (data && typeof data === "object") { + if (Array.isArray(data)) { + return data.map((item, idx) => { + return { + name: `${idx}`, + canMangle: true, + exports: getExportsFromData(item) + }; + }); + } else { + const exports = []; + for (const key of Object.keys(data)) { + exports.push({ + name: key, + canMangle: true, + exports: getExportsFromData(data[key]) + }); } - return tryRunOrWebpackError( - () => - hooks.renderModulePackage.call( - moduleSourcePostContainer, - module, - renderContext - ), - "JavascriptModulesPlugin.getCompilationHooks().renderModulePackage" - ); - } catch (e) { - e.module = module; - throw e; + return exports; } } + return undefined; +}; +class JsonExportsDependency extends NullDependency { /** - * @param {RenderContext} renderContext the render context - * @param {CompilationHooks} hooks hooks - * @returns {Source} the rendered source + * @param {(string | ExportSpec)[]} exports json exports */ - renderChunk(renderContext, hooks) { - const { chunk, chunkGraph } = renderContext; - const modules = chunkGraph.getOrderedChunkModulesIterableBySourceType( - chunk, - "javascript", - compareModulesByIdentifier - ); - const allModules = modules ? Array.from(modules) : []; - let strictHeader; - let allStrict = renderContext.strictMode; - if (!allStrict && allModules.every(m => m.buildInfo.strict)) { - const strictBailout = hooks.strictRuntimeBailout.call(renderContext); - strictHeader = strictBailout - ? `// runtime can't be in strict mode because ${strictBailout}.\n` - : '"use strict";\n'; - if (!strictBailout) allStrict = true; - } - /** @type {ChunkRenderContext} */ - const chunkRenderContext = { - ...renderContext, - chunkInitFragments: [], - strictMode: allStrict + constructor(exports) { + super(); + this.exports = exports; + this._hashUpdate = undefined; + } + + get type() { + return "json exports"; + } + + /** + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names + */ + getExports(moduleGraph) { + return { + exports: this.exports, + dependencies: undefined }; - const moduleSources = - Template.renderChunkModules(chunkRenderContext, allModules, module => - this.renderModule(module, chunkRenderContext, hooks, true) - ) || new RawSource("{}"); - let source = tryRunOrWebpackError( - () => hooks.renderChunk.call(moduleSources, chunkRenderContext), - "JavascriptModulesPlugin.getCompilationHooks().renderChunk" - ); - source = tryRunOrWebpackError( - () => hooks.renderContent.call(source, chunkRenderContext), - "JavascriptModulesPlugin.getCompilationHooks().renderContent" - ); - if (!source) { - throw new Error( - "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().renderContent plugins should return something" - ); - } - source = InitFragment.addToSource( - source, - chunkRenderContext.chunkInitFragments, - chunkRenderContext - ); - source = tryRunOrWebpackError( - () => hooks.render.call(source, chunkRenderContext), - "JavascriptModulesPlugin.getCompilationHooks().render" - ); - if (!source) { - throw new Error( - "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().render plugins should return something" - ); + } + + /** + * Update the hash + * @param {Hash} hash hash to be updated + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + if (this._hashUpdate === undefined) { + this._hashUpdate = this.exports + ? JSON.stringify(this.exports) + : "undefined"; } - chunk.rendered = true; - return strictHeader - ? new ConcatSource(strictHeader, source, ";") - : renderContext.runtimeTemplate.isModule() - ? source - : new ConcatSource(source, ";"); + hash.update(this._hashUpdate); + } + + serialize(context) { + const { write } = context; + write(this.exports); + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + this.exports = read(); + super.deserialize(context); + } +} + +makeSerializable( + JsonExportsDependency, + "webpack/lib/dependencies/JsonExportsDependency" +); + +module.exports = JsonExportsDependency; +module.exports.getExportsFromData = getExportsFromData; + + +/***/ }), + +/***/ 71693: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ModuleDependency = __webpack_require__(80321); + +class LoaderDependency extends ModuleDependency { + /** + * @param {string} request request string + */ + constructor(request) { + super(request); + } + + get type() { + return "loader"; + } + + get category() { + return "loader"; } +} + +module.exports = LoaderDependency; + + +/***/ }), + +/***/ 223: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + +const ModuleDependency = __webpack_require__(80321); + +class LoaderImportDependency extends ModuleDependency { /** - * @param {MainRenderContext} renderContext options object - * @param {CompilationHooks} hooks hooks - * @param {Compilation} compilation the compilation - * @returns {Source} the newly generated source from rendering + * @param {string} request request string */ - renderMain(renderContext, hooks, compilation) { - const { chunk, chunkGraph, runtimeTemplate } = renderContext; + constructor(request) { + super(request); + this.weak = true; + } + + get type() { + return "loader import"; + } + + get category() { + return "loaderImport"; + } +} + +module.exports = LoaderImportDependency; + + +/***/ }), + +/***/ 24721: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk); - const iife = runtimeTemplate.isIIFE(); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - const bootstrap = this.renderBootstrap(renderContext, hooks); - const useSourceMap = hooks.useSourceMap.call(chunk, renderContext); - const allModules = Array.from( - chunkGraph.getOrderedChunkModulesIterableBySourceType( - chunk, - "javascript", - compareModulesByIdentifier - ) || [] - ); - const hasEntryModules = chunkGraph.getNumberOfEntryModules(chunk) > 0; - let inlinedModules; - if (bootstrap.allowInlineStartup && hasEntryModules) { - inlinedModules = new Set(chunkGraph.getChunkEntryModulesIterable(chunk)); - } +const NormalModule = __webpack_require__(39); +const LazySet = __webpack_require__(38938); +const LoaderDependency = __webpack_require__(71693); +const LoaderImportDependency = __webpack_require__(223); - let source = new ConcatSource(); - let prefix; - if (iife) { - if (runtimeTemplate.supportsArrowFunction()) { - source.add("/******/ (() => { // webpackBootstrap\n"); - } else { - source.add("/******/ (function() { // webpackBootstrap\n"); - } - prefix = "/******/ \t"; - } else { - prefix = "/******/ "; - } - let allStrict = renderContext.strictMode; - if (!allStrict && allModules.every(m => m.buildInfo.strict)) { - const strictBailout = hooks.strictRuntimeBailout.call(renderContext); - if (strictBailout) { - source.add( - prefix + - `// runtime can't be in strict mode because ${strictBailout}.\n` - ); - } else { - allStrict = true; - source.add(prefix + '"use strict";\n'); - } - } +/** @typedef {import("../Compilation").DepConstructor} DepConstructor */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ - /** @type {ChunkRenderContext} */ - const chunkRenderContext = { - ...renderContext, - chunkInitFragments: [], - strictMode: allStrict - }; +/** + * @callback LoadModuleCallback + * @param {(Error | null)=} err error object + * @param {string | Buffer=} source source code + * @param {object=} map source map + * @param {Module=} module loaded module if successful + */ - const chunkModules = Template.renderChunkModules( - chunkRenderContext, - inlinedModules - ? allModules.filter(m => !inlinedModules.has(m)) - : allModules, - module => this.renderModule(module, chunkRenderContext, hooks, true), - prefix - ); - if ( - chunkModules || - runtimeRequirements.has(RuntimeGlobals.moduleFactories) || - runtimeRequirements.has(RuntimeGlobals.moduleFactoriesAddOnly) || - runtimeRequirements.has(RuntimeGlobals.require) - ) { - source.add(prefix + "var __webpack_modules__ = ("); - source.add(chunkModules || "{}"); - source.add(");\n"); - source.add( - "/************************************************************************/\n" - ); - } +/** + * @callback ImportModuleCallback + * @param {(Error | null)=} err error object + * @param {any=} exports exports of the evaluated module + */ - if (bootstrap.header.length > 0) { - const header = Template.asString(bootstrap.header) + "\n"; - source.add( - new PrefixSource( - prefix, - useSourceMap - ? new OriginalSource(header, "webpack/bootstrap") - : new RawSource(header) - ) - ); - source.add( - "/************************************************************************/\n" - ); - } +/** + * @typedef {Object} ImportModuleOptions + * @property {string=} layer the target layer + * @property {string=} publicPath the target public path + */ - const runtimeModules = - renderContext.chunkGraph.getChunkRuntimeModulesInOrder(chunk); +class LoaderPlugin { + /** + * @param {Object} options options + */ + constructor(options = {}) {} - if (runtimeModules.length > 0) { - source.add( - new PrefixSource( - prefix, - Template.renderRuntimeModules(runtimeModules, chunkRenderContext) - ) - ); - source.add( - "/************************************************************************/\n" - ); - // runtimeRuntimeModules calls codeGeneration - for (const module of runtimeModules) { - compilation.codeGeneratedModules.add(module); - } - } - if (inlinedModules) { - if (bootstrap.beforeStartup.length > 0) { - const beforeStartup = Template.asString(bootstrap.beforeStartup) + "\n"; - source.add( - new PrefixSource( - prefix, - useSourceMap - ? new OriginalSource(beforeStartup, "webpack/before-startup") - : new RawSource(beforeStartup) - ) + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "LoaderPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + LoaderDependency, + normalModuleFactory ); - } - const lastInlinedModule = last(inlinedModules); - const startupSource = new ConcatSource(); - startupSource.add(`var __webpack_exports__ = {};\n`); - for (const m of inlinedModules) { - const renderedModule = this.renderModule( - m, - chunkRenderContext, - hooks, - false + compilation.dependencyFactories.set( + LoaderImportDependency, + normalModuleFactory ); - if (renderedModule) { - const innerStrict = !allStrict && m.buildInfo.strict; - const runtimeRequirements = chunkGraph.getModuleRuntimeRequirements( - m, - chunk.runtime - ); - const exports = runtimeRequirements.has(RuntimeGlobals.exports); - const webpackExports = - exports && m.exportsArgument === "__webpack_exports__"; - let iife = innerStrict - ? "it need to be in strict mode." - : inlinedModules.size > 1 - ? // TODO check globals and top-level declarations of other entries and chunk modules - // to make a better decision - "it need to be isolated against other entry modules." - : chunkModules - ? "it need to be isolated against other modules in the chunk." - : exports && !webpackExports - ? `it uses a non-standard name for the exports (${m.exportsArgument}).` - : hooks.embedInRuntimeBailout.call(m, renderContext); - let footer; - if (iife !== undefined) { - startupSource.add( - `// This entry need to be wrapped in an IIFE because ${iife}\n` + } + ); + + compiler.hooks.compilation.tap("LoaderPlugin", compilation => { + const moduleGraph = compilation.moduleGraph; + NormalModule.getCompilationHooks(compilation).loader.tap( + "LoaderPlugin", + loaderContext => { + /** + * @param {string} request the request string to load the module from + * @param {LoadModuleCallback} callback callback returning the loaded module or error + * @returns {void} + */ + loaderContext.loadModule = (request, callback) => { + const dep = new LoaderDependency(request); + dep.loc = { + name: request + }; + const factory = compilation.dependencyFactories.get( + /** @type {DepConstructor} */ (dep.constructor) ); - const arrow = runtimeTemplate.supportsArrowFunction(); - if (arrow) { - startupSource.add("(() => {\n"); - footer = "\n})();\n\n"; - } else { - startupSource.add("!function() {\n"); - footer = "\n}();\n"; - } - if (innerStrict) startupSource.add('"use strict";\n'); - } else { - footer = "\n"; - } - if (exports) { - if (m !== lastInlinedModule) - startupSource.add(`var ${m.exportsArgument} = {};\n`); - else if (m.exportsArgument !== "__webpack_exports__") - startupSource.add( - `var ${m.exportsArgument} = __webpack_exports__;\n` + if (factory === undefined) { + return callback( + new Error( + `No module factory available for dependency type: ${dep.constructor.name}` + ) ); - } - startupSource.add(renderedModule); - startupSource.add(footer); - } - } - if (runtimeRequirements.has(RuntimeGlobals.onChunksLoaded)) { - startupSource.add( - `__webpack_exports__ = ${RuntimeGlobals.onChunksLoaded}(__webpack_exports__);\n` - ); - } - source.add( - hooks.renderStartup.call(startupSource, lastInlinedModule, { - ...renderContext, - inlined: true - }) - ); - if (bootstrap.afterStartup.length > 0) { - const afterStartup = Template.asString(bootstrap.afterStartup) + "\n"; - source.add( - new PrefixSource( - prefix, - useSourceMap - ? new OriginalSource(afterStartup, "webpack/after-startup") - : new RawSource(afterStartup) - ) - ); - } - } else { - const lastEntryModule = last( - chunkGraph.getChunkEntryModulesIterable(chunk) - ); - const toSource = useSourceMap - ? (content, name) => - new OriginalSource(Template.asString(content), name) - : content => new RawSource(Template.asString(content)); - source.add( - new PrefixSource( - prefix, - new ConcatSource( - toSource(bootstrap.beforeStartup, "webpack/before-startup"), - "\n", - hooks.renderStartup.call( - toSource(bootstrap.startup.concat(""), "webpack/startup"), - lastEntryModule, + } + compilation.buildQueue.increaseParallelism(); + compilation.handleModuleCreation( { - ...renderContext, - inlined: false + factory, + dependencies: [dep], + originModule: loaderContext._module, + context: loaderContext.context, + recursive: false + }, + err => { + compilation.buildQueue.decreaseParallelism(); + if (err) { + return callback(err); + } + const referencedModule = moduleGraph.getModule(dep); + if (!referencedModule) { + return callback(new Error("Cannot load the module")); + } + if (referencedModule.getNumberOfErrors() > 0) { + return callback( + new Error("The loaded module contains errors") + ); + } + const moduleSource = referencedModule.originalSource(); + if (!moduleSource) { + return callback( + new Error( + "The module created for a LoaderDependency must have an original source" + ) + ); + } + let source, map; + if (moduleSource.sourceAndMap) { + const sourceAndMap = moduleSource.sourceAndMap(); + map = sourceAndMap.map; + source = sourceAndMap.source; + } else { + map = moduleSource.map(); + source = moduleSource.source(); + } + const fileDependencies = new LazySet(); + const contextDependencies = new LazySet(); + const missingDependencies = new LazySet(); + const buildDependencies = new LazySet(); + referencedModule.addCacheDependencies( + fileDependencies, + contextDependencies, + missingDependencies, + buildDependencies + ); + + for (const d of fileDependencies) { + loaderContext.addDependency(d); + } + for (const d of contextDependencies) { + loaderContext.addContextDependency(d); + } + for (const d of missingDependencies) { + loaderContext.addMissingDependency(d); + } + for (const d of buildDependencies) { + loaderContext.addBuildDependency(d); + } + return callback(null, source, map, referencedModule); } - ), - toSource(bootstrap.afterStartup, "webpack/after-startup"), - "\n" - ) - ) - ); - } - if ( - hasEntryModules && - runtimeRequirements.has(RuntimeGlobals.returnExportsFromRuntime) - ) { - source.add(`${prefix}return __webpack_exports__;\n`); - } - if (iife) { - source.add("/******/ })()\n"); - } + ); + }; - /** @type {Source} */ - let finalSource = tryRunOrWebpackError( - () => hooks.renderMain.call(source, renderContext), - "JavascriptModulesPlugin.getCompilationHooks().renderMain" - ); - if (!finalSource) { - throw new Error( - "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().renderMain plugins should return something" - ); - } - finalSource = tryRunOrWebpackError( - () => hooks.renderContent.call(finalSource, renderContext), - "JavascriptModulesPlugin.getCompilationHooks().renderContent" - ); - if (!finalSource) { - throw new Error( - "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().renderContent plugins should return something" - ); - } - finalSource = InitFragment.addToSource( - finalSource, - chunkRenderContext.chunkInitFragments, - chunkRenderContext - ); - finalSource = tryRunOrWebpackError( - () => hooks.render.call(finalSource, renderContext), - "JavascriptModulesPlugin.getCompilationHooks().render" - ); - if (!finalSource) { - throw new Error( - "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().render plugins should return something" - ); - } - chunk.rendered = true; - return iife ? new ConcatSource(finalSource, ";") : finalSource; - } + /** + * @param {string} request the request string to load the module from + * @param {ImportModuleOptions=} options options + * @param {ImportModuleCallback=} callback callback returning the exports + * @returns {void} + */ + const importModule = (request, options, callback) => { + const dep = new LoaderImportDependency(request); + dep.loc = { + name: request + }; + const factory = compilation.dependencyFactories.get( + /** @type {DepConstructor} */ (dep.constructor) + ); + if (factory === undefined) { + return callback( + new Error( + `No module factory available for dependency type: ${dep.constructor.name}` + ) + ); + } + compilation.buildQueue.increaseParallelism(); + compilation.handleModuleCreation( + { + factory, + dependencies: [dep], + originModule: loaderContext._module, + contextInfo: { + issuerLayer: options.layer + }, + context: loaderContext.context, + connectOrigin: false + }, + err => { + compilation.buildQueue.decreaseParallelism(); + if (err) { + return callback(err); + } + const referencedModule = moduleGraph.getModule(dep); + if (!referencedModule) { + return callback(new Error("Cannot load the module")); + } + compilation.executeModule( + referencedModule, + { + entryOptions: { + publicPath: options.publicPath + } + }, + (err, result) => { + if (err) return callback(err); + for (const d of result.fileDependencies) { + loaderContext.addDependency(d); + } + for (const d of result.contextDependencies) { + loaderContext.addContextDependency(d); + } + for (const d of result.missingDependencies) { + loaderContext.addMissingDependency(d); + } + for (const d of result.buildDependencies) { + loaderContext.addBuildDependency(d); + } + if (result.cacheable === false) + loaderContext.cacheable(false); + for (const [name, { source, info }] of result.assets) { + const { buildInfo } = loaderContext._module; + if (!buildInfo.assets) { + buildInfo.assets = Object.create(null); + buildInfo.assetsInfo = new Map(); + } + buildInfo.assets[name] = source; + buildInfo.assetsInfo.set(name, info); + } + callback(null, result.exports); + } + ); + } + ); + }; - /** - * @param {Hash} hash the hash to be updated - * @param {RenderBootstrapContext} renderContext options object - * @param {CompilationHooks} hooks hooks - */ - updateHashWithBootstrap(hash, renderContext, hooks) { - const bootstrap = this.renderBootstrap(renderContext, hooks); - for (const key of Object.keys(bootstrap)) { - hash.update(key); - if (Array.isArray(bootstrap[key])) { - for (const line of bootstrap[key]) { - hash.update(line); + /** + * @param {string} request the request string to load the module from + * @param {ImportModuleOptions} options options + * @param {ImportModuleCallback=} callback callback returning the exports + * @returns {Promise | void} exports + */ + loaderContext.importModule = (request, options, callback) => { + if (!callback) { + return new Promise((resolve, reject) => { + importModule(request, options || {}, (err, result) => { + if (err) reject(err); + else resolve(result); + }); + }); + } + return importModule(request, options || {}, callback); + }; } - } else { - hash.update(JSON.stringify(bootstrap[key])); - } - } + ); + }); } +} +module.exports = LoaderPlugin; - /** - * @param {RenderBootstrapContext} renderContext options object - * @param {CompilationHooks} hooks hooks - * @returns {{ header: string[], beforeStartup: string[], startup: string[], afterStartup: string[], allowInlineStartup: boolean }} the generated source of the bootstrap code - */ - renderBootstrap(renderContext, hooks) { - const { - chunkGraph, - codeGenerationResults, - moduleGraph, - chunk, - runtimeTemplate - } = renderContext; - - const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk); - - const requireFunction = runtimeRequirements.has(RuntimeGlobals.require); - const moduleCache = runtimeRequirements.has(RuntimeGlobals.moduleCache); - const moduleFactories = runtimeRequirements.has( - RuntimeGlobals.moduleFactories - ); - const moduleUsed = runtimeRequirements.has(RuntimeGlobals.module); - const requireScopeUsed = runtimeRequirements.has( - RuntimeGlobals.requireScope - ); - const interceptModuleExecution = runtimeRequirements.has( - RuntimeGlobals.interceptModuleExecution - ); - const useRequire = - requireFunction || interceptModuleExecution || moduleUsed; +/***/ }), - const result = { - header: [], - beforeStartup: [], - startup: [], - afterStartup: [], - allowInlineStartup: true - }; +/***/ 5826: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - let { header: buf, startup, beforeStartup, afterStartup } = result; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (result.allowInlineStartup && moduleFactories) { - startup.push( - "// module factories are used so entry inlining is disabled" - ); - result.allowInlineStartup = false; - } - if (result.allowInlineStartup && moduleCache) { - startup.push("// module cache are used so entry inlining is disabled"); - result.allowInlineStartup = false; - } - if (result.allowInlineStartup && interceptModuleExecution) { - startup.push( - "// module execution is intercepted so entry inlining is disabled" - ); - result.allowInlineStartup = false; - } - if (useRequire || moduleCache) { - buf.push("// The module cache"); - buf.push("var __webpack_module_cache__ = {};"); - buf.push(""); - } - if (useRequire) { - buf.push("// The require function"); - buf.push(`function __webpack_require__(moduleId) {`); - buf.push(Template.indent(this.renderRequire(renderContext, hooks))); - buf.push("}"); - buf.push(""); - } else if (runtimeRequirements.has(RuntimeGlobals.requireScope)) { - buf.push("// The require scope"); - buf.push("var __webpack_require__ = {};"); - buf.push(""); - } +const makeSerializable = __webpack_require__(33032); - if ( - moduleFactories || - runtimeRequirements.has(RuntimeGlobals.moduleFactoriesAddOnly) - ) { - buf.push("// expose the modules object (__webpack_modules__)"); - buf.push(`${RuntimeGlobals.moduleFactories} = __webpack_modules__;`); - buf.push(""); - } +class LocalModule { + constructor(name, idx) { + this.name = name; + this.idx = idx; + this.used = false; + } - if (moduleCache) { - buf.push("// expose the module cache"); - buf.push(`${RuntimeGlobals.moduleCache} = __webpack_module_cache__;`); - buf.push(""); - } + flagUsed() { + this.used = true; + } - if (interceptModuleExecution) { - buf.push("// expose the module execution interceptor"); - buf.push(`${RuntimeGlobals.interceptModuleExecution} = [];`); - buf.push(""); - } + variableName() { + return "__WEBPACK_LOCAL_MODULE_" + this.idx + "__"; + } - if (!runtimeRequirements.has(RuntimeGlobals.startupNoDefault)) { - if (chunkGraph.getNumberOfEntryModules(chunk) > 0) { - /** @type {string[]} */ - const buf2 = []; - const runtimeRequirements = - chunkGraph.getTreeRuntimeRequirements(chunk); - buf2.push("// Load entry module and return exports"); - let i = chunkGraph.getNumberOfEntryModules(chunk); - for (const [ - entryModule, - entrypoint - ] of chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk)) { - const chunks = entrypoint.chunks.filter(c => c !== chunk); - if (result.allowInlineStartup && chunks.length > 0) { - buf2.push( - "// This entry module depends on other loaded chunks and execution need to be delayed" - ); - result.allowInlineStartup = false; - } - if ( - result.allowInlineStartup && - someInIterable( - moduleGraph.getIncomingConnectionsByOriginModule(entryModule), - ([originModule, connections]) => - originModule && - connections.some(c => c.isTargetActive(chunk.runtime)) && - someInIterable( - chunkGraph.getModuleRuntimes(originModule), - runtime => - intersectRuntime(runtime, chunk.runtime) !== undefined - ) - ) - ) { - buf2.push( - "// This entry module is referenced by other modules so it can't be inlined" - ); - result.allowInlineStartup = false; - } + serialize(context) { + const { write } = context; - let data; - if (codeGenerationResults.has(entryModule, chunk.runtime)) { - const result = codeGenerationResults.get( - entryModule, - chunk.runtime - ); - data = result.data; - } - if ( - result.allowInlineStartup && - (!data || !data.get("topLevelDeclarations")) && - (!entryModule.buildInfo || - !entryModule.buildInfo.topLevelDeclarations) - ) { - buf2.push( - "// This entry module doesn't tell about it's top-level declarations so it can't be inlined" - ); - result.allowInlineStartup = false; - } - if (result.allowInlineStartup) { - const bailout = hooks.inlineInRuntimeBailout.call( - entryModule, - renderContext - ); - if (bailout !== undefined) { - buf2.push( - `// This entry module can't be inlined because ${bailout}` - ); - result.allowInlineStartup = false; - } - } - i--; - const moduleId = chunkGraph.getModuleId(entryModule); - const entryRuntimeRequirements = - chunkGraph.getModuleRuntimeRequirements(entryModule, chunk.runtime); - let moduleIdExpr = JSON.stringify(moduleId); - if (runtimeRequirements.has(RuntimeGlobals.entryModuleId)) { - moduleIdExpr = `${RuntimeGlobals.entryModuleId} = ${moduleIdExpr}`; - } - if ( - result.allowInlineStartup && - entryRuntimeRequirements.has(RuntimeGlobals.module) - ) { - result.allowInlineStartup = false; - buf2.push( - "// This entry module used 'module' so it can't be inlined" - ); - } - if (chunks.length > 0) { - buf2.push( - `${i === 0 ? "var __webpack_exports__ = " : ""}${ - RuntimeGlobals.onChunksLoaded - }(undefined, ${JSON.stringify( - chunks.map(c => c.id) - )}, ${runtimeTemplate.returningFunction( - `__webpack_require__(${moduleIdExpr})` - )})` - ); - } else if (useRequire) { - buf2.push( - `${ - i === 0 ? "var __webpack_exports__ = " : "" - }__webpack_require__(${moduleIdExpr});` - ); - } else { - if (i === 0) buf2.push("var __webpack_exports__ = {};"); - if (requireScopeUsed) { - buf2.push( - `__webpack_modules__[${moduleIdExpr}](0, ${ - i === 0 ? "__webpack_exports__" : "{}" - }, __webpack_require__);` - ); - } else if (entryRuntimeRequirements.has(RuntimeGlobals.exports)) { - buf2.push( - `__webpack_modules__[${moduleIdExpr}](0, ${ - i === 0 ? "__webpack_exports__" : "{}" - });` - ); - } else { - buf2.push(`__webpack_modules__[${moduleIdExpr}]();`); - } - } - } - if (runtimeRequirements.has(RuntimeGlobals.onChunksLoaded)) { - buf2.push( - `__webpack_exports__ = ${RuntimeGlobals.onChunksLoaded}(__webpack_exports__);` - ); - } - if ( - runtimeRequirements.has(RuntimeGlobals.startup) || - (runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore) && - runtimeRequirements.has(RuntimeGlobals.startupOnlyAfter)) - ) { - result.allowInlineStartup = false; - buf.push("// the startup function"); - buf.push( - `${RuntimeGlobals.startup} = ${runtimeTemplate.basicFunction("", [ - ...buf2, - "return __webpack_exports__;" - ])};` - ); - buf.push(""); - startup.push("// run startup"); - startup.push( - `var __webpack_exports__ = ${RuntimeGlobals.startup}();` - ); - } else if (runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore)) { - buf.push("// the startup function"); - buf.push( - `${RuntimeGlobals.startup} = ${runtimeTemplate.emptyFunction()};` - ); - beforeStartup.push("// run runtime startup"); - beforeStartup.push(`${RuntimeGlobals.startup}();`); - startup.push("// startup"); - startup.push(Template.asString(buf2)); - } else if (runtimeRequirements.has(RuntimeGlobals.startupOnlyAfter)) { - buf.push("// the startup function"); - buf.push( - `${RuntimeGlobals.startup} = ${runtimeTemplate.emptyFunction()};` - ); - startup.push("// startup"); - startup.push(Template.asString(buf2)); - afterStartup.push("// run runtime startup"); - afterStartup.push(`${RuntimeGlobals.startup}();`); - } else { - startup.push("// startup"); - startup.push(Template.asString(buf2)); - } - } else if ( - runtimeRequirements.has(RuntimeGlobals.startup) || - runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore) || - runtimeRequirements.has(RuntimeGlobals.startupOnlyAfter) - ) { - buf.push( - "// the startup function", - "// It's empty as no entry modules are in this chunk", - `${RuntimeGlobals.startup} = ${runtimeTemplate.emptyFunction()};`, - "" - ); - } - } else if ( - runtimeRequirements.has(RuntimeGlobals.startup) || - runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore) || - runtimeRequirements.has(RuntimeGlobals.startupOnlyAfter) - ) { - result.allowInlineStartup = false; - buf.push( - "// the startup function", - "// It's empty as some runtime module handles the default behavior", - `${RuntimeGlobals.startup} = ${runtimeTemplate.emptyFunction()};` - ); - startup.push("// run startup"); - startup.push(`var __webpack_exports__ = ${RuntimeGlobals.startup}();`); - } - return result; + write(this.name); + write(this.idx); + write(this.used); } - /** - * @param {RenderBootstrapContext} renderContext options object - * @param {CompilationHooks} hooks hooks - * @returns {string} the generated source of the require function - */ - renderRequire(renderContext, hooks) { - const { - chunk, - chunkGraph, - runtimeTemplate: { outputOptions } - } = renderContext; - const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk); - const moduleExecution = runtimeRequirements.has( - RuntimeGlobals.interceptModuleExecution - ) - ? Template.asString([ - "var execOptions = { id: moduleId, module: module, factory: __webpack_modules__[moduleId], require: __webpack_require__ };", - `${RuntimeGlobals.interceptModuleExecution}.forEach(function(handler) { handler(execOptions); });`, - "module = execOptions.module;", - "execOptions.factory.call(module.exports, module, module.exports, execOptions.require);" - ]) - : runtimeRequirements.has(RuntimeGlobals.thisAsExports) - ? Template.asString([ - "__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);" - ]) - : Template.asString([ - "__webpack_modules__[moduleId](module, module.exports, __webpack_require__);" - ]); - const needModuleId = runtimeRequirements.has(RuntimeGlobals.moduleId); - const needModuleLoaded = runtimeRequirements.has( - RuntimeGlobals.moduleLoaded - ); - const content = Template.asString([ - "// Check if module is in cache", - "var cachedModule = __webpack_module_cache__[moduleId];", - "if (cachedModule !== undefined) {", - outputOptions.strictModuleErrorHandling - ? Template.indent([ - "if (cachedModule.error !== undefined) throw cachedModule.error;", - "return cachedModule.exports;" - ]) - : Template.indent("return cachedModule.exports;"), - "}", - "// Create a new module (and put it into the cache)", - "var module = __webpack_module_cache__[moduleId] = {", - Template.indent([ - needModuleId ? "id: moduleId," : "// no module.id needed", - needModuleLoaded ? "loaded: false," : "// no module.loaded needed", - "exports: {}" - ]), - "};", - "", - outputOptions.strictModuleExceptionHandling - ? Template.asString([ - "// Execute the module function", - "var threw = true;", - "try {", - Template.indent([moduleExecution, "threw = false;"]), - "} finally {", - Template.indent([ - "if(threw) delete __webpack_module_cache__[moduleId];" - ]), - "}" - ]) - : outputOptions.strictModuleErrorHandling - ? Template.asString([ - "// Execute the module function", - "try {", - Template.indent(moduleExecution), - "} catch(e) {", - Template.indent(["module.error = e;", "throw e;"]), - "}" - ]) - : Template.asString([ - "// Execute the module function", - moduleExecution - ]), - needModuleLoaded - ? Template.asString([ - "", - "// Flag the module as loaded", - "module.loaded = true;", - "" - ]) - : "", - "// Return the exports of the module", - "return module.exports;" - ]); - return tryRunOrWebpackError( - () => hooks.renderRequire.call(content, renderContext), - "JavascriptModulesPlugin.getCompilationHooks().renderRequire" - ); + deserialize(context) { + const { read } = context; + + this.name = read(); + this.idx = read(); + this.used = read(); } } -module.exports = JavascriptModulesPlugin; -module.exports.chunkHasJs = chunkHasJs; +makeSerializable(LocalModule, "webpack/lib/dependencies/LocalModule"); + +module.exports = LocalModule; /***/ }), -/***/ 29050: +/***/ 52805: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -91169,3781 +88672,2096 @@ module.exports.chunkHasJs = chunkHasJs; -const { Parser: AcornParser } = __webpack_require__(31988); -const { importAssertions } = __webpack_require__(72617); -const { SyncBailHook, HookMap } = __webpack_require__(6967); -const vm = __webpack_require__(26144); -const Parser = __webpack_require__(11715); -const StackedMap = __webpack_require__(58845); -const binarySearchBounds = __webpack_require__(92229); -const memoize = __webpack_require__(78676); -const BasicEvaluatedExpression = __webpack_require__(950); - -/** @typedef {import("acorn").Options} AcornOptions */ -/** @typedef {import("estree").ArrayExpression} ArrayExpressionNode */ -/** @typedef {import("estree").BinaryExpression} BinaryExpressionNode */ -/** @typedef {import("estree").BlockStatement} BlockStatementNode */ -/** @typedef {import("estree").SequenceExpression} SequenceExpressionNode */ -/** @typedef {import("estree").CallExpression} CallExpressionNode */ -/** @typedef {import("estree").ClassDeclaration} ClassDeclarationNode */ -/** @typedef {import("estree").ClassExpression} ClassExpressionNode */ -/** @typedef {import("estree").Comment} CommentNode */ -/** @typedef {import("estree").ConditionalExpression} ConditionalExpressionNode */ -/** @typedef {import("estree").Declaration} DeclarationNode */ -/** @typedef {import("estree").PrivateIdentifier} PrivateIdentifierNode */ -/** @typedef {import("estree").PropertyDefinition} PropertyDefinitionNode */ -/** @typedef {import("estree").Expression} ExpressionNode */ -/** @typedef {import("estree").Identifier} IdentifierNode */ -/** @typedef {import("estree").IfStatement} IfStatementNode */ -/** @typedef {import("estree").LabeledStatement} LabeledStatementNode */ -/** @typedef {import("estree").Literal} LiteralNode */ -/** @typedef {import("estree").LogicalExpression} LogicalExpressionNode */ -/** @typedef {import("estree").ChainExpression} ChainExpressionNode */ -/** @typedef {import("estree").MemberExpression} MemberExpressionNode */ -/** @typedef {import("estree").MetaProperty} MetaPropertyNode */ -/** @typedef {import("estree").MethodDefinition} MethodDefinitionNode */ -/** @typedef {import("estree").ModuleDeclaration} ModuleDeclarationNode */ -/** @typedef {import("estree").NewExpression} NewExpressionNode */ -/** @typedef {import("estree").Node} AnyNode */ -/** @typedef {import("estree").Program} ProgramNode */ -/** @typedef {import("estree").Statement} StatementNode */ -/** @typedef {import("estree").ImportDeclaration} ImportDeclarationNode */ -/** @typedef {import("estree").ExportNamedDeclaration} ExportNamedDeclarationNode */ -/** @typedef {import("estree").ExportDefaultDeclaration} ExportDefaultDeclarationNode */ -/** @typedef {import("estree").ExportAllDeclaration} ExportAllDeclarationNode */ -/** @typedef {import("estree").Super} SuperNode */ -/** @typedef {import("estree").TaggedTemplateExpression} TaggedTemplateExpressionNode */ -/** @typedef {import("estree").TemplateLiteral} TemplateLiteralNode */ -/** @typedef {import("estree").ThisExpression} ThisExpressionNode */ -/** @typedef {import("estree").UnaryExpression} UnaryExpressionNode */ -/** @typedef {import("estree").VariableDeclarator} VariableDeclaratorNode */ -/** @template T @typedef {import("tapable").AsArray} AsArray */ -/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ -/** @typedef {{declaredScope: ScopeInfo, freeName: string | true, tagInfo: TagInfo | undefined}} VariableInfoInterface */ -/** @typedef {{ name: string | VariableInfo, rootInfo: string | VariableInfo, getMembers: () => string[] }} GetInfoResult */ - -const EMPTY_ARRAY = []; -const ALLOWED_MEMBER_TYPES_CALL_EXPRESSION = 0b01; -const ALLOWED_MEMBER_TYPES_EXPRESSION = 0b10; -const ALLOWED_MEMBER_TYPES_ALL = 0b11; +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); -// Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -const parser = AcornParser.extend(importAssertions); +class LocalModuleDependency extends NullDependency { + constructor(localModule, range, callNew) { + super(); -class VariableInfo { - /** - * @param {ScopeInfo} declaredScope scope in which the variable is declared - * @param {string | true} freeName which free name the variable aliases, or true when none - * @param {TagInfo | undefined} tagInfo info about tags - */ - constructor(declaredScope, freeName, tagInfo) { - this.declaredScope = declaredScope; - this.freeName = freeName; - this.tagInfo = tagInfo; + this.localModule = localModule; + this.range = range; + this.callNew = callNew; } -} -/** @typedef {string | ScopeInfo | VariableInfo} ExportedVariableInfo */ -/** @typedef {LiteralNode | string | null | undefined} ImportSource */ -/** @typedef {Omit & { sourceType: "module" | "script" | "auto", ecmaVersion?: AcornOptions["ecmaVersion"] }} ParseOptions */ + serialize(context) { + const { write } = context; -/** - * @typedef {Object} TagInfo - * @property {any} tag - * @property {any} data - * @property {TagInfo | undefined} next - */ + write(this.localModule); + write(this.range); + write(this.callNew); + + super.serialize(context); + } -/** - * @typedef {Object} ScopeInfo - * @property {StackedMap} definitions - * @property {boolean | "arrow"} topLevelScope - * @property {boolean} inShorthand - * @property {boolean} isStrict - * @property {boolean} isAsmJs - * @property {boolean} inTry - */ + deserialize(context) { + const { read } = context; -const joinRanges = (startRange, endRange) => { - if (!endRange) return startRange; - if (!startRange) return endRange; - return [startRange[0], endRange[1]]; -}; + this.localModule = read(); + this.range = read(); + this.callNew = read(); -const objectAndMembersToName = (object, membersReversed) => { - let name = object; - for (let i = membersReversed.length - 1; i >= 0; i--) { - name = name + "." + membersReversed[i]; + super.deserialize(context); } - return name; -}; +} -const getRootName = expression => { - switch (expression.type) { - case "Identifier": - return expression.name; - case "ThisExpression": - return "this"; - case "MetaProperty": - return `${expression.meta.name}.${expression.property.name}`; - default: - return undefined; +makeSerializable( + LocalModuleDependency, + "webpack/lib/dependencies/LocalModuleDependency" +); + +LocalModuleDependency.Template = class LocalModuleDependencyTemplate extends ( + NullDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply(dependency, source, templateContext) { + const dep = /** @type {LocalModuleDependency} */ (dependency); + if (!dep.range) return; + const moduleInstance = dep.callNew + ? `new (function () { return ${dep.localModule.variableName()}; })()` + : dep.localModule.variableName(); + source.replace(dep.range[0], dep.range[1] - 1, moduleInstance); } }; -/** @type {AcornOptions} */ -const defaultParserOptions = { - ranges: true, - locations: true, - ecmaVersion: "latest", - sourceType: "module", - // https://github.com/tc39/proposal-hashbang - allowHashBang: true, - onComment: null -}; +module.exports = LocalModuleDependency; -// regexp to match at least one "magic comment" -const webpackCommentRegExp = new RegExp(/(^|\W)webpack[A-Z]{1,}[A-Za-z]{1,}:/); -const EMPTY_COMMENT_OPTIONS = { - options: null, - errors: null -}; +/***/ }), -class JavascriptParser extends Parser { - /** - * @param {"module" | "script" | "auto"} sourceType default source type - */ - constructor(sourceType = "auto") { - super(); - this.hooks = Object.freeze({ - /** @type {HookMap>} */ - evaluateTypeof: new HookMap(() => new SyncBailHook(["expression"])), - /** @type {HookMap>} */ - evaluate: new HookMap(() => new SyncBailHook(["expression"])), - /** @type {HookMap>} */ - evaluateIdentifier: new HookMap(() => new SyncBailHook(["expression"])), - /** @type {HookMap>} */ - evaluateDefinedIdentifier: new HookMap( - () => new SyncBailHook(["expression"]) - ), - /** @type {HookMap>} */ - evaluateCallExpressionMember: new HookMap( - () => new SyncBailHook(["expression", "param"]) - ), - /** @type {HookMap>} */ - isPure: new HookMap( - () => new SyncBailHook(["expression", "commentsStartPosition"]) - ), - /** @type {SyncBailHook<[StatementNode | ModuleDeclarationNode], boolean | void>} */ - preStatement: new SyncBailHook(["statement"]), +/***/ 75827: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - /** @type {SyncBailHook<[StatementNode | ModuleDeclarationNode], boolean | void>} */ - blockPreStatement: new SyncBailHook(["declaration"]), - /** @type {SyncBailHook<[StatementNode | ModuleDeclarationNode], boolean | void>} */ - statement: new SyncBailHook(["statement"]), - /** @type {SyncBailHook<[IfStatementNode], boolean | void>} */ - statementIf: new SyncBailHook(["statement"]), - /** @type {SyncBailHook<[ExpressionNode, ClassExpressionNode | ClassDeclarationNode], boolean | void>} */ - classExtendsExpression: new SyncBailHook([ - "expression", - "classDefinition" - ]), - /** @type {SyncBailHook<[MethodDefinitionNode | PropertyDefinitionNode, ClassExpressionNode | ClassDeclarationNode], boolean | void>} */ - classBodyElement: new SyncBailHook(["element", "classDefinition"]), - /** @type {SyncBailHook<[ExpressionNode, MethodDefinitionNode | PropertyDefinitionNode, ClassExpressionNode | ClassDeclarationNode], boolean | void>} */ - classBodyValue: new SyncBailHook([ - "expression", - "element", - "classDefinition" - ]), - /** @type {HookMap>} */ - label: new HookMap(() => new SyncBailHook(["statement"])), - /** @type {SyncBailHook<[ImportDeclarationNode, ImportSource], boolean | void>} */ - import: new SyncBailHook(["statement", "source"]), - /** @type {SyncBailHook<[ImportDeclarationNode, ImportSource, string, string], boolean | void>} */ - importSpecifier: new SyncBailHook([ - "statement", - "source", - "exportName", - "identifierName" - ]), - /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode], boolean | void>} */ - export: new SyncBailHook(["statement"]), - /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, ImportSource], boolean | void>} */ - exportImport: new SyncBailHook(["statement", "source"]), - /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, DeclarationNode], boolean | void>} */ - exportDeclaration: new SyncBailHook(["statement", "declaration"]), - /** @type {SyncBailHook<[ExportDefaultDeclarationNode, DeclarationNode], boolean | void>} */ - exportExpression: new SyncBailHook(["statement", "declaration"]), - /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, string, string, number | undefined], boolean | void>} */ - exportSpecifier: new SyncBailHook([ - "statement", - "identifierName", - "exportName", - "index" - ]), - /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, ImportSource, string, string, number | undefined], boolean | void>} */ - exportImportSpecifier: new SyncBailHook([ - "statement", - "source", - "identifierName", - "exportName", - "index" - ]), - /** @type {SyncBailHook<[VariableDeclaratorNode, StatementNode], boolean | void>} */ - preDeclarator: new SyncBailHook(["declarator", "statement"]), - /** @type {SyncBailHook<[VariableDeclaratorNode, StatementNode], boolean | void>} */ - declarator: new SyncBailHook(["declarator", "statement"]), - /** @type {HookMap>} */ - varDeclaration: new HookMap(() => new SyncBailHook(["declaration"])), - /** @type {HookMap>} */ - varDeclarationLet: new HookMap(() => new SyncBailHook(["declaration"])), - /** @type {HookMap>} */ - varDeclarationConst: new HookMap(() => new SyncBailHook(["declaration"])), - /** @type {HookMap>} */ - varDeclarationVar: new HookMap(() => new SyncBailHook(["declaration"])), - /** @type {HookMap>} */ - pattern: new HookMap(() => new SyncBailHook(["pattern"])), - /** @type {HookMap>} */ - canRename: new HookMap(() => new SyncBailHook(["initExpression"])), - /** @type {HookMap>} */ - rename: new HookMap(() => new SyncBailHook(["initExpression"])), - /** @type {HookMap>} */ - assign: new HookMap(() => new SyncBailHook(["expression"])), - /** @type {HookMap>} */ - assignMemberChain: new HookMap( - () => new SyncBailHook(["expression", "members"]) - ), - /** @type {HookMap>} */ - typeof: new HookMap(() => new SyncBailHook(["expression"])), - /** @type {SyncBailHook<[ExpressionNode], boolean | void>} */ - importCall: new SyncBailHook(["expression"]), - /** @type {SyncBailHook<[ExpressionNode], boolean | void>} */ - topLevelAwait: new SyncBailHook(["expression"]), - /** @type {HookMap>} */ - call: new HookMap(() => new SyncBailHook(["expression"])), - /** Something like "a.b()" */ - /** @type {HookMap>} */ - callMemberChain: new HookMap( - () => new SyncBailHook(["expression", "members"]) - ), - /** Something like "a.b().c.d" */ - /** @type {HookMap>} */ - memberChainOfCallMemberChain: new HookMap( - () => - new SyncBailHook([ - "expression", - "calleeMembers", - "callExpression", - "members" - ]) - ), - /** Something like "a.b().c.d()"" */ - /** @type {HookMap>} */ - callMemberChainOfCallMemberChain: new HookMap( - () => - new SyncBailHook([ - "expression", - "calleeMembers", - "innerCallExpression", - "members" - ]) - ), - /** @type {SyncBailHook<[ChainExpressionNode], boolean | void>} */ - optionalChaining: new SyncBailHook(["optionalChaining"]), - /** @type {HookMap>} */ - new: new HookMap(() => new SyncBailHook(["expression"])), - /** @type {HookMap>} */ - expression: new HookMap(() => new SyncBailHook(["expression"])), - /** @type {HookMap>} */ - expressionMemberChain: new HookMap( - () => new SyncBailHook(["expression", "members"]) - ), - /** @type {HookMap>} */ - unhandledExpressionMemberChain: new HookMap( - () => new SyncBailHook(["expression", "members"]) - ), - /** @type {SyncBailHook<[ExpressionNode], boolean | void>} */ - expressionConditionalOperator: new SyncBailHook(["expression"]), - /** @type {SyncBailHook<[ExpressionNode], boolean | void>} */ - expressionLogicalOperator: new SyncBailHook(["expression"]), - /** @type {SyncBailHook<[ProgramNode, CommentNode[]], boolean | void>} */ - program: new SyncBailHook(["ast", "comments"]), - /** @type {SyncBailHook<[ProgramNode, CommentNode[]], boolean | void>} */ - finish: new SyncBailHook(["ast", "comments"]) - }); - this.sourceType = sourceType; - /** @type {ScopeInfo} */ - this.scope = undefined; - /** @type {ParserState} */ - this.state = undefined; - this.comments = undefined; - this.semicolons = undefined; - /** @type {(StatementNode|ExpressionNode)[]} */ - this.statementPath = undefined; - this.prevStatement = undefined; - this.currentTagData = undefined; - this._initializeEvaluating(); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - _initializeEvaluating() { - this.hooks.evaluate.for("Literal").tap("JavascriptParser", _expr => { - const expr = /** @type {LiteralNode} */ (_expr); - switch (typeof expr.value) { - case "number": - return new BasicEvaluatedExpression() - .setNumber(expr.value) - .setRange(expr.range); - case "bigint": - return new BasicEvaluatedExpression() - .setBigInt(expr.value) - .setRange(expr.range); - case "string": - return new BasicEvaluatedExpression() - .setString(expr.value) - .setRange(expr.range); - case "boolean": - return new BasicEvaluatedExpression() - .setBoolean(expr.value) - .setRange(expr.range); - } - if (expr.value === null) { - return new BasicEvaluatedExpression().setNull().setRange(expr.range); - } - if (expr.value instanceof RegExp) { - return new BasicEvaluatedExpression() - .setRegExp(expr.value) - .setRange(expr.range); - } - }); - this.hooks.evaluate.for("NewExpression").tap("JavascriptParser", _expr => { - const expr = /** @type {NewExpressionNode} */ (_expr); - const callee = expr.callee; - if ( - callee.type !== "Identifier" || - callee.name !== "RegExp" || - expr.arguments.length > 2 || - this.getVariableInfo("RegExp") !== "RegExp" - ) - return; - let regExp, flags; - const arg1 = expr.arguments[0]; +const LocalModule = __webpack_require__(5826); - if (arg1) { - if (arg1.type === "SpreadElement") return; +const lookup = (parent, mod) => { + if (mod.charAt(0) !== ".") return mod; - const evaluatedRegExp = this.evaluateExpression(arg1); + var path = parent.split("/"); + var segments = mod.split("/"); + path.pop(); - if (!evaluatedRegExp) return; + for (let i = 0; i < segments.length; i++) { + const seg = segments[i]; + if (seg === "..") { + path.pop(); + } else if (seg !== ".") { + path.push(seg); + } + } - regExp = evaluatedRegExp.asString(); + return path.join("/"); +}; - if (!regExp) return; - } else { - return new BasicEvaluatedExpression() - .setRegExp(new RegExp("")) - .setRange(expr.range); - } +exports.addLocalModule = (state, name) => { + if (!state.localModules) { + state.localModules = []; + } + const m = new LocalModule(name, state.localModules.length); + state.localModules.push(m); + return m; +}; - const arg2 = expr.arguments[1]; +exports.getLocalModule = (state, name, namedModule) => { + if (!state.localModules) return null; + if (namedModule) { + // resolve dependency name relative to the defining named module + name = lookup(namedModule, name); + } + for (let i = 0; i < state.localModules.length; i++) { + if (state.localModules[i].name === name) { + return state.localModules[i]; + } + } + return null; +}; - if (arg2) { - if (arg2.type === "SpreadElement") return; - const evaluatedFlags = this.evaluateExpression(arg2); +/***/ }), - if (!evaluatedFlags) return; +/***/ 88488: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (!evaluatedFlags.isUndefined()) { - flags = evaluatedFlags.asString(); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if ( - flags === undefined || - !BasicEvaluatedExpression.isValidRegExpFlags(flags) - ) - return; - } - } - return new BasicEvaluatedExpression() - .setRegExp(flags ? new RegExp(regExp, flags) : new RegExp(regExp)) - .setRange(expr.range); - }); - this.hooks.evaluate - .for("LogicalExpression") - .tap("JavascriptParser", _expr => { - const expr = /** @type {LogicalExpressionNode} */ (_expr); - const left = this.evaluateExpression(expr.left); - if (!left) return; - let returnRight = false; - /** @type {boolean|undefined} */ - let allowedRight; - if (expr.operator === "&&") { - const leftAsBool = left.asBool(); - if (leftAsBool === false) return left.setRange(expr.range); - returnRight = leftAsBool === true; - allowedRight = false; - } else if (expr.operator === "||") { - const leftAsBool = left.asBool(); - if (leftAsBool === true) return left.setRange(expr.range); - returnRight = leftAsBool === false; - allowedRight = true; - } else if (expr.operator === "??") { - const leftAsNullish = left.asNullish(); - if (leftAsNullish === false) return left.setRange(expr.range); - if (leftAsNullish !== true) return; - returnRight = true; - } else return; - const right = this.evaluateExpression(expr.right); - if (!right) return; - if (returnRight) { - if (left.couldHaveSideEffects()) right.setSideEffects(); - return right.setRange(expr.range); - } +const Dependency = __webpack_require__(54912); +const InitFragment = __webpack_require__(55870); +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); - const asBool = right.asBool(); +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - if (allowedRight === true && asBool === true) { - return new BasicEvaluatedExpression() - .setRange(expr.range) - .setTruthy(); - } else if (allowedRight === false && asBool === false) { - return new BasicEvaluatedExpression().setRange(expr.range).setFalsy(); - } - }); +class ModuleDecoratorDependency extends NullDependency { + /** + * @param {string} decorator the decorator requirement + * @param {boolean} allowExportsAccess allow to access exports from module + */ + constructor(decorator, allowExportsAccess) { + super(); + this.decorator = decorator; + this.allowExportsAccess = allowExportsAccess; + this._hashUpdate = undefined; + } - const valueAsExpression = (value, expr, sideEffects) => { - switch (typeof value) { - case "boolean": - return new BasicEvaluatedExpression() - .setBoolean(value) - .setSideEffects(sideEffects) - .setRange(expr.range); - case "number": - return new BasicEvaluatedExpression() - .setNumber(value) - .setSideEffects(sideEffects) - .setRange(expr.range); - case "bigint": - return new BasicEvaluatedExpression() - .setBigInt(value) - .setSideEffects(sideEffects) - .setRange(expr.range); - case "string": - return new BasicEvaluatedExpression() - .setString(value) - .setSideEffects(sideEffects) - .setRange(expr.range); - } - }; + /** + * @returns {string} a display name for the type of dependency + */ + get type() { + return "module decorator"; + } - this.hooks.evaluate - .for("BinaryExpression") - .tap("JavascriptParser", _expr => { - const expr = /** @type {BinaryExpressionNode} */ (_expr); + get category() { + return "self"; + } - const handleConstOperation = fn => { - const left = this.evaluateExpression(expr.left); - if (!left || !left.isCompileTimeValue()) return; + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + return `self`; + } - const right = this.evaluateExpression(expr.right); - if (!right || !right.isCompileTimeValue()) return; + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + return this.allowExportsAccess + ? Dependency.EXPORTS_OBJECT_REFERENCED + : Dependency.NO_EXPORTS_REFERENCED; + } - const result = fn( - left.asCompileTimeValue(), - right.asCompileTimeValue() - ); - return valueAsExpression( - result, - expr, - left.couldHaveSideEffects() || right.couldHaveSideEffects() - ); - }; + /** + * Update the hash + * @param {Hash} hash hash to be updated + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + if (this._hashUpdate === undefined) { + this._hashUpdate = `${this.decorator}${this.allowExportsAccess}`; + } + hash.update(this._hashUpdate); + } - const isAlwaysDifferent = (a, b) => - (a === true && b === false) || (a === false && b === true); + serialize(context) { + const { write } = context; + write(this.decorator); + write(this.allowExportsAccess); + super.serialize(context); + } - const handleTemplateStringCompare = (left, right, res, eql) => { - const getPrefix = parts => { - let value = ""; - for (const p of parts) { - const v = p.asString(); - if (v !== undefined) value += v; - else break; - } - return value; - }; - const getSuffix = parts => { - let value = ""; - for (let i = parts.length - 1; i >= 0; i--) { - const v = parts[i].asString(); - if (v !== undefined) value = v + value; - else break; - } - return value; - }; - const leftPrefix = getPrefix(left.parts); - const rightPrefix = getPrefix(right.parts); - const leftSuffix = getSuffix(left.parts); - const rightSuffix = getSuffix(right.parts); - const lenPrefix = Math.min(leftPrefix.length, rightPrefix.length); - const lenSuffix = Math.min(leftSuffix.length, rightSuffix.length); - if ( - leftPrefix.slice(0, lenPrefix) !== - rightPrefix.slice(0, lenPrefix) || - leftSuffix.slice(-lenSuffix) !== rightSuffix.slice(-lenSuffix) - ) { - return res - .setBoolean(!eql) - .setSideEffects( - left.couldHaveSideEffects() || right.couldHaveSideEffects() - ); - } - }; + deserialize(context) { + const { read } = context; + this.decorator = read(); + this.allowExportsAccess = read(); + super.deserialize(context); + } +} - const handleStrictEqualityComparison = eql => { - const left = this.evaluateExpression(expr.left); - if (!left) return; - const right = this.evaluateExpression(expr.right); - if (!right) return; - const res = new BasicEvaluatedExpression(); - res.setRange(expr.range); +makeSerializable( + ModuleDecoratorDependency, + "webpack/lib/dependencies/ModuleDecoratorDependency" +); - const leftConst = left.isCompileTimeValue(); - const rightConst = right.isCompileTimeValue(); +ModuleDecoratorDependency.Template = class ModuleDecoratorDependencyTemplate extends ( + NullDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { module, chunkGraph, initFragments, runtimeRequirements } + ) { + const dep = /** @type {ModuleDecoratorDependency} */ (dependency); + runtimeRequirements.add(RuntimeGlobals.moduleLoaded); + runtimeRequirements.add(RuntimeGlobals.moduleId); + runtimeRequirements.add(RuntimeGlobals.module); + runtimeRequirements.add(dep.decorator); + initFragments.push( + new InitFragment( + `/* module decorator */ ${module.moduleArgument} = ${dep.decorator}(${module.moduleArgument});\n`, + InitFragment.STAGE_PROVIDES, + 0, + `module decorator ${chunkGraph.getModuleId(module)}` + ) + ); + } +}; - if (leftConst && rightConst) { - return res - .setBoolean( - eql === - (left.asCompileTimeValue() === right.asCompileTimeValue()) - ) - .setSideEffects( - left.couldHaveSideEffects() || right.couldHaveSideEffects() - ); - } +module.exports = ModuleDecoratorDependency; - if (left.isArray() && right.isArray()) { - return res - .setBoolean(!eql) - .setSideEffects( - left.couldHaveSideEffects() || right.couldHaveSideEffects() - ); - } - if (left.isTemplateString() && right.isTemplateString()) { - return handleTemplateStringCompare(left, right, res, eql); - } - const leftPrimitive = left.isPrimitiveType(); - const rightPrimitive = right.isPrimitiveType(); +/***/ }), - if ( - // Primitive !== Object or - // compile-time object types are never equal to something at runtime - (leftPrimitive === false && - (leftConst || rightPrimitive === true)) || - (rightPrimitive === false && - (rightConst || leftPrimitive === true)) || - // Different nullish or boolish status also means not equal - isAlwaysDifferent(left.asBool(), right.asBool()) || - isAlwaysDifferent(left.asNullish(), right.asNullish()) - ) { - return res - .setBoolean(!eql) - .setSideEffects( - left.couldHaveSideEffects() || right.couldHaveSideEffects() - ); - } - }; +/***/ 80321: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const handleAbstractEqualityComparison = eql => { - const left = this.evaluateExpression(expr.left); - if (!left) return; - const right = this.evaluateExpression(expr.right); - if (!right) return; - const res = new BasicEvaluatedExpression(); - res.setRange(expr.range); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - const leftConst = left.isCompileTimeValue(); - const rightConst = right.isCompileTimeValue(); - if (leftConst && rightConst) { - return res - .setBoolean( - eql === - // eslint-disable-next-line eqeqeq - (left.asCompileTimeValue() == right.asCompileTimeValue()) - ) - .setSideEffects( - left.couldHaveSideEffects() || right.couldHaveSideEffects() - ); - } - if (left.isArray() && right.isArray()) { - return res - .setBoolean(!eql) - .setSideEffects( - left.couldHaveSideEffects() || right.couldHaveSideEffects() - ); - } - if (left.isTemplateString() && right.isTemplateString()) { - return handleTemplateStringCompare(left, right, res, eql); - } - }; +const Dependency = __webpack_require__(54912); +const DependencyTemplate = __webpack_require__(5160); +const memoize = __webpack_require__(78676); - if (expr.operator === "+") { - const left = this.evaluateExpression(expr.left); - if (!left) return; - const right = this.evaluateExpression(expr.right); - if (!right) return; - const res = new BasicEvaluatedExpression(); - if (left.isString()) { - if (right.isString()) { - res.setString(left.string + right.string); - } else if (right.isNumber()) { - res.setString(left.string + right.number); - } else if ( - right.isWrapped() && - right.prefix && - right.prefix.isString() - ) { - // "left" + ("prefix" + inner + "postfix") - // => ("leftPrefix" + inner + "postfix") - res.setWrapped( - new BasicEvaluatedExpression() - .setString(left.string + right.prefix.string) - .setRange(joinRanges(left.range, right.prefix.range)), - right.postfix, - right.wrappedInnerExpressions - ); - } else if (right.isWrapped()) { - // "left" + ([null] + inner + "postfix") - // => ("left" + inner + "postfix") - res.setWrapped( - left, - right.postfix, - right.wrappedInnerExpressions - ); - } else { - // "left" + expr - // => ("left" + expr + "") - res.setWrapped(left, null, [right]); - } - } else if (left.isNumber()) { - if (right.isString()) { - res.setString(left.number + right.string); - } else if (right.isNumber()) { - res.setNumber(left.number + right.number); - } else { - return; - } - } else if (left.isBigInt()) { - if (right.isBigInt()) { - res.setBigInt(left.bigint + right.bigint); - } - } else if (left.isWrapped()) { - if (left.postfix && left.postfix.isString() && right.isString()) { - // ("prefix" + inner + "postfix") + "right" - // => ("prefix" + inner + "postfixRight") - res.setWrapped( - left.prefix, - new BasicEvaluatedExpression() - .setString(left.postfix.string + right.string) - .setRange(joinRanges(left.postfix.range, right.range)), - left.wrappedInnerExpressions - ); - } else if ( - left.postfix && - left.postfix.isString() && - right.isNumber() - ) { - // ("prefix" + inner + "postfix") + 123 - // => ("prefix" + inner + "postfix123") - res.setWrapped( - left.prefix, - new BasicEvaluatedExpression() - .setString(left.postfix.string + right.number) - .setRange(joinRanges(left.postfix.range, right.range)), - left.wrappedInnerExpressions - ); - } else if (right.isString()) { - // ("prefix" + inner + [null]) + "right" - // => ("prefix" + inner + "right") - res.setWrapped(left.prefix, right, left.wrappedInnerExpressions); - } else if (right.isNumber()) { - // ("prefix" + inner + [null]) + 123 - // => ("prefix" + inner + "123") - res.setWrapped( - left.prefix, - new BasicEvaluatedExpression() - .setString(right.number + "") - .setRange(right.range), - left.wrappedInnerExpressions - ); - } else if (right.isWrapped()) { - // ("prefix1" + inner1 + "postfix1") + ("prefix2" + inner2 + "postfix2") - // ("prefix1" + inner1 + "postfix1" + "prefix2" + inner2 + "postfix2") - res.setWrapped( - left.prefix, - right.postfix, - left.wrappedInnerExpressions && - right.wrappedInnerExpressions && - left.wrappedInnerExpressions - .concat(left.postfix ? [left.postfix] : []) - .concat(right.prefix ? [right.prefix] : []) - .concat(right.wrappedInnerExpressions) - ); - } else { - // ("prefix" + inner + postfix) + expr - // => ("prefix" + inner + postfix + expr + [null]) - res.setWrapped( - left.prefix, - null, - left.wrappedInnerExpressions && - left.wrappedInnerExpressions.concat( - left.postfix ? [left.postfix, right] : [right] - ) - ); - } - } else { - if (right.isString()) { - // left + "right" - // => ([null] + left + "right") - res.setWrapped(null, right, [left]); - } else if (right.isWrapped()) { - // left + (prefix + inner + "postfix") - // => ([null] + left + prefix + inner + "postfix") - res.setWrapped( - null, - right.postfix, - right.wrappedInnerExpressions && - (right.prefix ? [left, right.prefix] : [left]).concat( - right.wrappedInnerExpressions - ) - ); - } else { - return; - } - } - if (left.couldHaveSideEffects() || right.couldHaveSideEffects()) - res.setSideEffects(); - res.setRange(expr.range); - return res; - } else if (expr.operator === "-") { - return handleConstOperation((l, r) => l - r); - } else if (expr.operator === "*") { - return handleConstOperation((l, r) => l * r); - } else if (expr.operator === "/") { - return handleConstOperation((l, r) => l / r); - } else if (expr.operator === "**") { - return handleConstOperation((l, r) => l ** r); - } else if (expr.operator === "===") { - return handleStrictEqualityComparison(true); - } else if (expr.operator === "==") { - return handleAbstractEqualityComparison(true); - } else if (expr.operator === "!==") { - return handleStrictEqualityComparison(false); - } else if (expr.operator === "!=") { - return handleAbstractEqualityComparison(false); - } else if (expr.operator === "&") { - return handleConstOperation((l, r) => l & r); - } else if (expr.operator === "|") { - return handleConstOperation((l, r) => l | r); - } else if (expr.operator === "^") { - return handleConstOperation((l, r) => l ^ r); - } else if (expr.operator === ">>>") { - return handleConstOperation((l, r) => l >>> r); - } else if (expr.operator === ">>") { - return handleConstOperation((l, r) => l >> r); - } else if (expr.operator === "<<") { - return handleConstOperation((l, r) => l << r); - } else if (expr.operator === "<") { - return handleConstOperation((l, r) => l < r); - } else if (expr.operator === ">") { - return handleConstOperation((l, r) => l > r); - } else if (expr.operator === "<=") { - return handleConstOperation((l, r) => l <= r); - } else if (expr.operator === ">=") { - return handleConstOperation((l, r) => l >= r); - } - }); - this.hooks.evaluate - .for("UnaryExpression") - .tap("JavascriptParser", _expr => { - const expr = /** @type {UnaryExpressionNode} */ (_expr); +/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ +/** @typedef {import("../Module")} Module */ - const handleConstOperation = fn => { - const argument = this.evaluateExpression(expr.argument); - if (!argument || !argument.isCompileTimeValue()) return; - const result = fn(argument.asCompileTimeValue()); - return valueAsExpression( - result, - expr, - argument.couldHaveSideEffects() - ); - }; +const getRawModule = memoize(() => __webpack_require__(84929)); - if (expr.operator === "typeof") { - switch (expr.argument.type) { - case "Identifier": { - const res = this.callHooksForName( - this.hooks.evaluateTypeof, - expr.argument.name, - expr - ); - if (res !== undefined) return res; - break; - } - case "MetaProperty": { - const res = this.callHooksForName( - this.hooks.evaluateTypeof, - getRootName(expr.argument), - expr - ); - if (res !== undefined) return res; - break; - } - case "MemberExpression": { - const res = this.callHooksForExpression( - this.hooks.evaluateTypeof, - expr.argument, - expr - ); - if (res !== undefined) return res; - break; - } - case "ChainExpression": { - const res = this.callHooksForExpression( - this.hooks.evaluateTypeof, - expr.argument.expression, - expr - ); - if (res !== undefined) return res; - break; - } - case "FunctionExpression": { - return new BasicEvaluatedExpression() - .setString("function") - .setRange(expr.range); - } - } - const arg = this.evaluateExpression(expr.argument); - if (arg.isUnknown()) return; - if (arg.isString()) { - return new BasicEvaluatedExpression() - .setString("string") - .setRange(expr.range); - } - if (arg.isWrapped()) { - return new BasicEvaluatedExpression() - .setString("string") - .setSideEffects() - .setRange(expr.range); - } - if (arg.isUndefined()) { - return new BasicEvaluatedExpression() - .setString("undefined") - .setRange(expr.range); - } - if (arg.isNumber()) { - return new BasicEvaluatedExpression() - .setString("number") - .setRange(expr.range); - } - if (arg.isBigInt()) { - return new BasicEvaluatedExpression() - .setString("bigint") - .setRange(expr.range); - } - if (arg.isBoolean()) { - return new BasicEvaluatedExpression() - .setString("boolean") - .setRange(expr.range); - } - if (arg.isConstArray() || arg.isRegExp() || arg.isNull()) { - return new BasicEvaluatedExpression() - .setString("object") - .setRange(expr.range); - } - if (arg.isArray()) { - return new BasicEvaluatedExpression() - .setString("object") - .setSideEffects(arg.couldHaveSideEffects()) - .setRange(expr.range); - } - } else if (expr.operator === "!") { - const argument = this.evaluateExpression(expr.argument); - if (!argument) return; - const bool = argument.asBool(); - if (typeof bool !== "boolean") return; - return new BasicEvaluatedExpression() - .setBoolean(!bool) - .setSideEffects(argument.couldHaveSideEffects()) - .setRange(expr.range); - } else if (expr.operator === "~") { - return handleConstOperation(v => ~v); - } else if (expr.operator === "+") { - return handleConstOperation(v => +v); - } else if (expr.operator === "-") { - return handleConstOperation(v => -v); - } - }); - this.hooks.evaluateTypeof.for("undefined").tap("JavascriptParser", expr => { - return new BasicEvaluatedExpression() - .setString("undefined") - .setRange(expr.range); - }); - this.hooks.evaluate.for("Identifier").tap("JavascriptParser", expr => { - if (/** @type {IdentifierNode} */ (expr).name === "undefined") { - return new BasicEvaluatedExpression() - .setUndefined() - .setRange(expr.range); - } - }); - /** - * @param {string} exprType expression type name - * @param {function(ExpressionNode): GetInfoResult | undefined} getInfo get info - * @returns {void} - */ - const tapEvaluateWithVariableInfo = (exprType, getInfo) => { - /** @type {ExpressionNode | undefined} */ - let cachedExpression = undefined; - /** @type {GetInfoResult | undefined} */ - let cachedInfo = undefined; - this.hooks.evaluate.for(exprType).tap("JavascriptParser", expr => { - const expression = /** @type {MemberExpressionNode} */ (expr); +class ModuleDependency extends Dependency { + /** + * @param {string} request request path which needs resolving + */ + constructor(request) { + super(); + this.request = request; + this.userRequest = request; + this.range = undefined; + // assertions must be serialized by subclasses that use it + /** @type {Record | undefined} */ + this.assertions = undefined; + } - const info = getInfo(expr); - if (info !== undefined) { - return this.callHooksForInfoWithFallback( - this.hooks.evaluateIdentifier, - info.name, - name => { - cachedExpression = expression; - cachedInfo = info; - }, - name => { - const hook = this.hooks.evaluateDefinedIdentifier.get(name); - if (hook !== undefined) { - return hook.call(expression); - } - }, - expression - ); - } - }); - this.hooks.evaluate - .for(exprType) - .tap({ name: "JavascriptParser", stage: 100 }, expr => { - const info = cachedExpression === expr ? cachedInfo : getInfo(expr); - if (info !== undefined) { - return new BasicEvaluatedExpression() - .setIdentifier(info.name, info.rootInfo, info.getMembers) - .setRange(expr.range); - } - }); - this.hooks.finish.tap("JavascriptParser", () => { - // Cleanup for GC - cachedExpression = cachedInfo = undefined; - }); - }; - tapEvaluateWithVariableInfo("Identifier", expr => { - const info = this.getVariableInfo( - /** @type {IdentifierNode} */ (expr).name - ); - if ( - typeof info === "string" || - (info instanceof VariableInfo && typeof info.freeName === "string") - ) { - return { name: info, rootInfo: info, getMembers: () => [] }; - } - }); - tapEvaluateWithVariableInfo("ThisExpression", expr => { - const info = this.getVariableInfo("this"); - if ( - typeof info === "string" || - (info instanceof VariableInfo && typeof info.freeName === "string") - ) { - return { name: info, rootInfo: info, getMembers: () => [] }; - } - }); - this.hooks.evaluate.for("MetaProperty").tap("JavascriptParser", expr => { - const metaProperty = /** @type {MetaPropertyNode} */ (expr); + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + let str = `module${this.request}`; + if (this.assertions !== undefined) { + str += JSON.stringify(this.assertions); + } + return str; + } - return this.callHooksForName( - this.hooks.evaluateIdentifier, - getRootName(expr), - metaProperty - ); - }); - tapEvaluateWithVariableInfo("MemberExpression", expr => - this.getMemberExpressionInfo( - /** @type {MemberExpressionNode} */ (expr), - ALLOWED_MEMBER_TYPES_EXPRESSION - ) + /** + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + */ + couldAffectReferencingModule() { + return true; + } + + /** + * @param {string} context context directory + * @returns {Module} a module + */ + createIgnoredModule(context) { + const RawModule = getRawModule(); + return new RawModule( + "/* (ignored) */", + `ignored|${context}|${this.request}`, + `${this.request} (ignored)` ); + } - this.hooks.evaluate.for("CallExpression").tap("JavascriptParser", _expr => { - const expr = /** @type {CallExpressionNode} */ (_expr); - if ( - expr.callee.type !== "MemberExpression" || - expr.callee.property.type !== - (expr.callee.computed ? "Literal" : "Identifier") - ) { - return; - } + serialize(context) { + const { write } = context; + write(this.request); + write(this.userRequest); + write(this.range); + super.serialize(context); + } - // type Super also possible here - const param = this.evaluateExpression( - /** @type {ExpressionNode} */ (expr.callee.object) - ); - if (!param) return; - const property = - expr.callee.property.type === "Literal" - ? `${expr.callee.property.value}` - : expr.callee.property.name; - const hook = this.hooks.evaluateCallExpressionMember.get(property); - if (hook !== undefined) { - return hook.call(expr, param); - } + deserialize(context) { + const { read } = context; + this.request = read(); + this.userRequest = read(); + this.range = read(); + super.deserialize(context); + } +} + +ModuleDependency.Template = DependencyTemplate; + +module.exports = ModuleDependency; + + +/***/ }), + +/***/ 80825: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ModuleDependency = __webpack_require__(80321); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + +class ModuleDependencyTemplateAsId extends ModuleDependency.Template { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply(dependency, source, { runtimeTemplate, moduleGraph, chunkGraph }) { + const dep = /** @type {ModuleDependency} */ (dependency); + if (!dep.range) return; + const content = runtimeTemplate.moduleId({ + module: moduleGraph.getModule(dep), + chunkGraph, + request: dep.request, + weak: dep.weak }); - this.hooks.evaluateCallExpressionMember - .for("indexOf") - .tap("JavascriptParser", (expr, param) => { - if (!param.isString()) return; - if (expr.arguments.length === 0) return; - const [arg1, arg2] = expr.arguments; - if (arg1.type === "SpreadElement") return; - const arg1Eval = this.evaluateExpression(arg1); - if (!arg1Eval.isString()) return; - const arg1Value = arg1Eval.string; + source.replace(dep.range[0], dep.range[1] - 1, content); + } +} - let result; - if (arg2) { - if (arg2.type === "SpreadElement") return; - const arg2Eval = this.evaluateExpression(arg2); - if (!arg2Eval.isNumber()) return; - result = param.string.indexOf(arg1Value, arg2Eval.number); - } else { - result = param.string.indexOf(arg1Value); - } - return new BasicEvaluatedExpression() - .setNumber(result) - .setSideEffects(param.couldHaveSideEffects()) - .setRange(expr.range); - }); - this.hooks.evaluateCallExpressionMember - .for("replace") - .tap("JavascriptParser", (expr, param) => { - if (!param.isString()) return; - if (expr.arguments.length !== 2) return; - if (expr.arguments[0].type === "SpreadElement") return; - if (expr.arguments[1].type === "SpreadElement") return; - let arg1 = this.evaluateExpression(expr.arguments[0]); - let arg2 = this.evaluateExpression(expr.arguments[1]); - if (!arg1.isString() && !arg1.isRegExp()) return; - const arg1Value = arg1.regExp || arg1.string; - if (!arg2.isString()) return; - const arg2Value = arg2.string; - return new BasicEvaluatedExpression() - .setString(param.string.replace(arg1Value, arg2Value)) - .setSideEffects(param.couldHaveSideEffects()) - .setRange(expr.range); - }); - ["substr", "substring", "slice"].forEach(fn => { - this.hooks.evaluateCallExpressionMember - .for(fn) - .tap("JavascriptParser", (expr, param) => { - if (!param.isString()) return; - let arg1; - let result, - str = param.string; - switch (expr.arguments.length) { - case 1: - if (expr.arguments[0].type === "SpreadElement") return; - arg1 = this.evaluateExpression(expr.arguments[0]); - if (!arg1.isNumber()) return; - result = str[fn](arg1.number); - break; - case 2: { - if (expr.arguments[0].type === "SpreadElement") return; - if (expr.arguments[1].type === "SpreadElement") return; - arg1 = this.evaluateExpression(expr.arguments[0]); - const arg2 = this.evaluateExpression(expr.arguments[1]); - if (!arg1.isNumber()) return; - if (!arg2.isNumber()) return; - result = str[fn](arg1.number, arg2.number); - break; - } - default: - return; - } - return new BasicEvaluatedExpression() - .setString(result) - .setSideEffects(param.couldHaveSideEffects()) - .setRange(expr.range); - }); +module.exports = ModuleDependencyTemplateAsId; + + +/***/ }), + +/***/ 36873: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ModuleDependency = __webpack_require__(80321); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + +class ModuleDependencyTemplateAsRequireId extends ModuleDependency.Template { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } + ) { + const dep = /** @type {ModuleDependency} */ (dependency); + if (!dep.range) return; + const content = runtimeTemplate.moduleExports({ + module: moduleGraph.getModule(dep), + chunkGraph, + request: dep.request, + weak: dep.weak, + runtimeRequirements }); + source.replace(dep.range[0], dep.range[1] - 1, content); + } +} +module.exports = ModuleDependencyTemplateAsRequireId; - /** - * @param {"cooked" | "raw"} kind kind of values to get - * @param {TemplateLiteralNode} templateLiteralExpr TemplateLiteral expr - * @returns {{quasis: BasicEvaluatedExpression[], parts: BasicEvaluatedExpression[]}} Simplified template - */ - const getSimplifiedTemplateResult = (kind, templateLiteralExpr) => { - /** @type {BasicEvaluatedExpression[]} */ - const quasis = []; - /** @type {BasicEvaluatedExpression[]} */ - const parts = []; - for (let i = 0; i < templateLiteralExpr.quasis.length; i++) { - const quasiExpr = templateLiteralExpr.quasis[i]; - const quasi = quasiExpr.value[kind]; +/***/ }), - if (i > 0) { - const prevExpr = parts[parts.length - 1]; - const expr = this.evaluateExpression( - templateLiteralExpr.expressions[i - 1] - ); - const exprAsString = expr.asString(); - if ( - typeof exprAsString === "string" && - !expr.couldHaveSideEffects() - ) { - // We can merge quasi + expr + quasi when expr - // is a const string +/***/ 47511: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - prevExpr.setString(prevExpr.string + exprAsString + quasi); - prevExpr.setRange([prevExpr.range[0], quasiExpr.range[1]]); - // We unset the expression as it doesn't match to a single expression - prevExpr.setExpression(undefined); - continue; - } - parts.push(expr); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - const part = new BasicEvaluatedExpression() - .setString(quasi) - .setRange(quasiExpr.range) - .setExpression(quasiExpr); - quasis.push(part); - parts.push(part); - } - return { - quasis, - parts - }; - }; - this.hooks.evaluate - .for("TemplateLiteral") - .tap("JavascriptParser", _node => { - const node = /** @type {TemplateLiteralNode} */ (_node); - const { quasis, parts } = getSimplifiedTemplateResult("cooked", node); - if (parts.length === 1) { - return parts[0].setRange(node.range); - } - return new BasicEvaluatedExpression() - .setTemplateString(quasis, parts, "cooked") - .setRange(node.range); - }); - this.hooks.evaluate - .for("TaggedTemplateExpression") - .tap("JavascriptParser", _node => { - const node = /** @type {TaggedTemplateExpressionNode} */ (_node); - const tag = this.evaluateExpression(node.tag); +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); +const ModuleDependencyTemplateAsId = __webpack_require__(80825); + +class ModuleHotAcceptDependency extends ModuleDependency { + constructor(request, range) { + super(request); + this.range = range; + this.weak = true; + } + + get type() { + return "module.hot.accept"; + } + + get category() { + return "commonjs"; + } +} + +makeSerializable( + ModuleHotAcceptDependency, + "webpack/lib/dependencies/ModuleHotAcceptDependency" +); + +ModuleHotAcceptDependency.Template = ModuleDependencyTemplateAsId; + +module.exports = ModuleHotAcceptDependency; + + +/***/ }), + +/***/ 86301: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); +const ModuleDependencyTemplateAsId = __webpack_require__(80825); + +class ModuleHotDeclineDependency extends ModuleDependency { + constructor(request, range) { + super(request); + + this.range = range; + this.weak = true; + } + + get type() { + return "module.hot.decline"; + } + + get category() { + return "commonjs"; + } +} + +makeSerializable( + ModuleHotDeclineDependency, + "webpack/lib/dependencies/ModuleHotDeclineDependency" +); + +ModuleHotDeclineDependency.Template = ModuleDependencyTemplateAsId; + +module.exports = ModuleHotDeclineDependency; + + +/***/ }), + +/***/ 31830: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const Dependency = __webpack_require__(54912); +const DependencyTemplate = __webpack_require__(5160); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + +class NullDependency extends Dependency { + get type() { + return "null"; + } + + /** + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + */ + couldAffectReferencingModule() { + return false; + } +} + +NullDependency.Template = class NullDependencyTemplate extends ( + DependencyTemplate +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply(dependency, source, templateContext) {} +}; + +module.exports = NullDependency; + + +/***/ }), + +/***/ 31618: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ModuleDependency = __webpack_require__(80321); + +class PrefetchDependency extends ModuleDependency { + constructor(request) { + super(request); + } + + get type() { + return "prefetch"; + } + + get category() { + return "esm"; + } +} + +module.exports = PrefetchDependency; - if (tag.isIdentifier() && tag.identifier === "String.raw") { - const { quasis, parts } = getSimplifiedTemplateResult( - "raw", - node.quasi - ); - return new BasicEvaluatedExpression() - .setTemplateString(quasis, parts, "raw") - .setRange(node.range); - } - }); - this.hooks.evaluateCallExpressionMember - .for("concat") - .tap("JavascriptParser", (expr, param) => { - if (!param.isString() && !param.isWrapped()) return; +/***/ }), - let stringSuffix = null; - let hasUnknownParams = false; - const innerExpressions = []; - for (let i = expr.arguments.length - 1; i >= 0; i--) { - const arg = expr.arguments[i]; - if (arg.type === "SpreadElement") return; - const argExpr = this.evaluateExpression(arg); - if ( - hasUnknownParams || - (!argExpr.isString() && !argExpr.isNumber()) - ) { - hasUnknownParams = true; - innerExpressions.push(argExpr); - continue; - } +/***/ 95770: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const value = argExpr.isString() - ? argExpr.string - : "" + argExpr.number; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Florent Cailhol @ooflorent +*/ - const newString = value + (stringSuffix ? stringSuffix.string : ""); - const newRange = [ - argExpr.range[0], - (stringSuffix || argExpr).range[1] - ]; - stringSuffix = new BasicEvaluatedExpression() - .setString(newString) - .setSideEffects( - (stringSuffix && stringSuffix.couldHaveSideEffects()) || - argExpr.couldHaveSideEffects() - ) - .setRange(newRange); - } - if (hasUnknownParams) { - const prefix = param.isString() ? param : param.prefix; - const inner = - param.isWrapped() && param.wrappedInnerExpressions - ? param.wrappedInnerExpressions.concat(innerExpressions.reverse()) - : innerExpressions.reverse(); - return new BasicEvaluatedExpression() - .setWrapped(prefix, stringSuffix, inner) - .setRange(expr.range); - } else if (param.isWrapped()) { - const postfix = stringSuffix || param.postfix; - const inner = param.wrappedInnerExpressions - ? param.wrappedInnerExpressions.concat(innerExpressions.reverse()) - : innerExpressions.reverse(); - return new BasicEvaluatedExpression() - .setWrapped(param.prefix, postfix, inner) - .setRange(expr.range); - } else { - const newString = - param.string + (stringSuffix ? stringSuffix.string : ""); - return new BasicEvaluatedExpression() - .setString(newString) - .setSideEffects( - (stringSuffix && stringSuffix.couldHaveSideEffects()) || - param.couldHaveSideEffects() - ) - .setRange(expr.range); - } - }); - this.hooks.evaluateCallExpressionMember - .for("split") - .tap("JavascriptParser", (expr, param) => { - if (!param.isString()) return; - if (expr.arguments.length !== 1) return; - if (expr.arguments[0].type === "SpreadElement") return; - let result; - const arg = this.evaluateExpression(expr.arguments[0]); - if (arg.isString()) { - result = param.string.split(arg.string); - } else if (arg.isRegExp()) { - result = param.string.split(arg.regExp); - } else { - return; - } - return new BasicEvaluatedExpression() - .setArray(result) - .setSideEffects(param.couldHaveSideEffects()) - .setRange(expr.range); - }); - this.hooks.evaluate - .for("ConditionalExpression") - .tap("JavascriptParser", _expr => { - const expr = /** @type {ConditionalExpressionNode} */ (_expr); - const condition = this.evaluateExpression(expr.test); - const conditionValue = condition.asBool(); - let res; - if (conditionValue === undefined) { - const consequent = this.evaluateExpression(expr.consequent); - const alternate = this.evaluateExpression(expr.alternate); - if (!consequent || !alternate) return; - res = new BasicEvaluatedExpression(); - if (consequent.isConditional()) { - res.setOptions(consequent.options); - } else { - res.setOptions([consequent]); - } - if (alternate.isConditional()) { - res.addOptions(alternate.options); - } else { - res.addOptions([alternate]); - } - } else { - res = this.evaluateExpression( - conditionValue ? expr.consequent : expr.alternate - ); - if (condition.couldHaveSideEffects()) res.setSideEffects(); - } - res.setRange(expr.range); - return res; - }); - this.hooks.evaluate - .for("ArrayExpression") - .tap("JavascriptParser", _expr => { - const expr = /** @type {ArrayExpressionNode} */ (_expr); +const InitFragment = __webpack_require__(55870); +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); - const items = expr.elements.map(element => { - return ( - element !== null && - element.type !== "SpreadElement" && - this.evaluateExpression(element) - ); - }); - if (!items.every(Boolean)) return; - return new BasicEvaluatedExpression() - .setItems(items) - .setRange(expr.range); - }); - this.hooks.evaluate - .for("ChainExpression") - .tap("JavascriptParser", _expr => { - const expr = /** @type {ChainExpressionNode} */ (_expr); - /** @type {ExpressionNode[]} */ - const optionalExpressionsStack = []; - /** @type {ExpressionNode|SuperNode} */ - let next = expr.expression; +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../util/Hash")} Hash */ - while ( - next.type === "MemberExpression" || - next.type === "CallExpression" - ) { - if (next.type === "MemberExpression") { - if (next.optional) { - // SuperNode can not be optional - optionalExpressionsStack.push( - /** @type {ExpressionNode} */ (next.object) - ); - } - next = next.object; - } else { - if (next.optional) { - // SuperNode can not be optional - optionalExpressionsStack.push( - /** @type {ExpressionNode} */ (next.callee) - ); - } - next = next.callee; - } - } +/** + * @param {string[]|null} path the property path array + * @returns {string} the converted path + */ +const pathToString = path => + path !== null && path.length > 0 + ? path.map(part => `[${JSON.stringify(part)}]`).join("") + : ""; - while (optionalExpressionsStack.length > 0) { - const expression = optionalExpressionsStack.pop(); - const evaluated = this.evaluateExpression(expression); +class ProvidedDependency extends ModuleDependency { + constructor(request, identifier, path, range) { + super(request); + this.identifier = identifier; + this.path = path; + this.range = range; + this._hashUpdate = undefined; + } - if (evaluated && evaluated.asNullish()) { - return evaluated.setRange(_expr.range); - } - } - return this.evaluateExpression(expr.expression); - }); + get type() { + return "provided"; } - getRenameIdentifier(expr) { - const result = this.evaluateExpression(expr); - if (result && result.isIdentifier()) { - return result.identifier; - } + get category() { + return "esm"; } /** - * @param {ClassExpressionNode | ClassDeclarationNode} classy a class node + * Update the hash + * @param {Hash} hash hash to be updated + * @param {UpdateHashContext} context context * @returns {void} */ - walkClass(classy) { - if (classy.superClass) { - if (!this.hooks.classExtendsExpression.call(classy.superClass, classy)) { - this.walkExpression(classy.superClass); - } - } - if (classy.body && classy.body.type === "ClassBody") { - for (const classElement of /** @type {TODO} */ (classy.body.body)) { - if (!this.hooks.classBodyElement.call(classElement, classy)) { - if (classElement.computed && classElement.key) { - this.walkExpression(classElement.key); - } - if (classElement.value) { - if ( - !this.hooks.classBodyValue.call( - classElement.value, - classElement, - classy - ) - ) { - const wasTopLevel = this.scope.topLevelScope; - this.scope.topLevelScope = false; - this.walkExpression(classElement.value); - this.scope.topLevelScope = wasTopLevel; - } - } - } - } + updateHash(hash, context) { + if (this._hashUpdate === undefined) { + this._hashUpdate = + this.identifier + (this.path ? this.path.join(",") : "null"); } + hash.update(this._hashUpdate); } - // Pre walking iterates the scope for variable declarations - preWalkStatements(statements) { - for (let index = 0, len = statements.length; index < len; index++) { - const statement = statements[index]; - this.preWalkStatement(statement); - } + serialize(context) { + const { write } = context; + write(this.identifier); + write(this.path); + super.serialize(context); } - // Block pre walking iterates the scope for block variable declarations - blockPreWalkStatements(statements) { - for (let index = 0, len = statements.length; index < len; index++) { - const statement = statements[index]; - this.blockPreWalkStatement(statement); - } + deserialize(context) { + const { read } = context; + this.identifier = read(); + this.path = read(); + super.deserialize(context); } +} - // Walking iterates the statements and expressions and processes them - walkStatements(statements) { - for (let index = 0, len = statements.length; index < len; index++) { - const statement = statements[index]; - this.walkStatement(statement); - } - } +makeSerializable( + ProvidedDependency, + "webpack/lib/dependencies/ProvidedDependency" +); - preWalkStatement(statement) { - this.statementPath.push(statement); - if (this.hooks.preStatement.call(statement)) { - this.prevStatement = this.statementPath.pop(); - return; - } - switch (statement.type) { - case "BlockStatement": - this.preWalkBlockStatement(statement); - break; - case "DoWhileStatement": - this.preWalkDoWhileStatement(statement); - break; - case "ForInStatement": - this.preWalkForInStatement(statement); - break; - case "ForOfStatement": - this.preWalkForOfStatement(statement); - break; - case "ForStatement": - this.preWalkForStatement(statement); - break; - case "FunctionDeclaration": - this.preWalkFunctionDeclaration(statement); - break; - case "IfStatement": - this.preWalkIfStatement(statement); - break; - case "LabeledStatement": - this.preWalkLabeledStatement(statement); - break; - case "SwitchStatement": - this.preWalkSwitchStatement(statement); - break; - case "TryStatement": - this.preWalkTryStatement(statement); - break; - case "VariableDeclaration": - this.preWalkVariableDeclaration(statement); - break; - case "WhileStatement": - this.preWalkWhileStatement(statement); - break; - case "WithStatement": - this.preWalkWithStatement(statement); - break; +class ProvidedDependencyTemplate extends ModuleDependency.Template { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { + runtimeTemplate, + moduleGraph, + chunkGraph, + initFragments, + runtimeRequirements } - this.prevStatement = this.statementPath.pop(); + ) { + const dep = /** @type {ProvidedDependency} */ (dependency); + initFragments.push( + new InitFragment( + `/* provided dependency */ var ${ + dep.identifier + } = ${runtimeTemplate.moduleExports({ + module: moduleGraph.getModule(dep), + chunkGraph, + request: dep.request, + runtimeRequirements + })}${pathToString(dep.path)};\n`, + InitFragment.STAGE_PROVIDES, + 1, + `provided ${dep.identifier}` + ) + ); + source.replace(dep.range[0], dep.range[1] - 1, dep.identifier); } +} - blockPreWalkStatement(statement) { - this.statementPath.push(statement); - if (this.hooks.blockPreStatement.call(statement)) { - this.prevStatement = this.statementPath.pop(); - return; - } - switch (statement.type) { - case "ImportDeclaration": - this.blockPreWalkImportDeclaration(statement); - break; - case "ExportAllDeclaration": - this.blockPreWalkExportAllDeclaration(statement); - break; - case "ExportDefaultDeclaration": - this.blockPreWalkExportDefaultDeclaration(statement); - break; - case "ExportNamedDeclaration": - this.blockPreWalkExportNamedDeclaration(statement); - break; - case "VariableDeclaration": - this.blockPreWalkVariableDeclaration(statement); - break; - case "ClassDeclaration": - this.blockPreWalkClassDeclaration(statement); - break; - } - this.prevStatement = this.statementPath.pop(); - } +ProvidedDependency.Template = ProvidedDependencyTemplate; - walkStatement(statement) { - this.statementPath.push(statement); - if (this.hooks.statement.call(statement) !== undefined) { - this.prevStatement = this.statementPath.pop(); - return; - } - switch (statement.type) { - case "BlockStatement": - this.walkBlockStatement(statement); - break; - case "ClassDeclaration": - this.walkClassDeclaration(statement); - break; - case "DoWhileStatement": - this.walkDoWhileStatement(statement); - break; - case "ExportDefaultDeclaration": - this.walkExportDefaultDeclaration(statement); - break; - case "ExportNamedDeclaration": - this.walkExportNamedDeclaration(statement); - break; - case "ExpressionStatement": - this.walkExpressionStatement(statement); - break; - case "ForInStatement": - this.walkForInStatement(statement); - break; - case "ForOfStatement": - this.walkForOfStatement(statement); - break; - case "ForStatement": - this.walkForStatement(statement); - break; - case "FunctionDeclaration": - this.walkFunctionDeclaration(statement); - break; - case "IfStatement": - this.walkIfStatement(statement); - break; - case "LabeledStatement": - this.walkLabeledStatement(statement); - break; - case "ReturnStatement": - this.walkReturnStatement(statement); - break; - case "SwitchStatement": - this.walkSwitchStatement(statement); - break; - case "ThrowStatement": - this.walkThrowStatement(statement); - break; - case "TryStatement": - this.walkTryStatement(statement); - break; - case "VariableDeclaration": - this.walkVariableDeclaration(statement); - break; - case "WhileStatement": - this.walkWhileStatement(statement); - break; - case "WithStatement": - this.walkWithStatement(statement); - break; - } - this.prevStatement = this.statementPath.pop(); +module.exports = ProvidedDependency; + + +/***/ }), + +/***/ 55799: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { UsageState } = __webpack_require__(63686); +const makeSerializable = __webpack_require__(33032); +const { filterRuntime } = __webpack_require__(17156); +const NullDependency = __webpack_require__(31830); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../util/Hash")} Hash */ + +class PureExpressionDependency extends NullDependency { + /** + * @param {[number, number]} range the source range + */ + constructor(range) { + super(); + this.range = range; + /** @type {Set | false} */ + this.usedByExports = false; + this._hashUpdate = undefined; } /** - * Walks a statements that is nested within a parent statement - * and can potentially be a non-block statement. - * This enforces the nested statement to never be in ASI position. - * @param {StatementNode} statement the nested statement + * Update the hash + * @param {Hash} hash hash to be updated + * @param {UpdateHashContext} context context * @returns {void} */ - walkNestedStatement(statement) { - this.prevStatement = undefined; - this.walkStatement(statement); + updateHash(hash, context) { + if (this._hashUpdate === undefined) { + this._hashUpdate = this.range + ""; + } + hash.update(this._hashUpdate); } - // Real Statements - preWalkBlockStatement(statement) { - this.preWalkStatements(statement.body); + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this dependency connects the module to referencing modules + */ + getModuleEvaluationSideEffectsState(moduleGraph) { + return false; } - walkBlockStatement(statement) { - this.inBlockScope(() => { - const body = statement.body; - const prev = this.prevStatement; - this.blockPreWalkStatements(body); - this.prevStatement = prev; - this.walkStatements(body); - }); + serialize(context) { + const { write } = context; + write(this.range); + write(this.usedByExports); + super.serialize(context); } - walkExpressionStatement(statement) { - this.walkExpression(statement.expression); + deserialize(context) { + const { read } = context; + this.range = read(); + this.usedByExports = read(); + super.deserialize(context); } +} - preWalkIfStatement(statement) { - this.preWalkStatement(statement.consequent); - if (statement.alternate) { - this.preWalkStatement(statement.alternate); - } - } +makeSerializable( + PureExpressionDependency, + "webpack/lib/dependencies/PureExpressionDependency" +); - walkIfStatement(statement) { - const result = this.hooks.statementIf.call(statement); - if (result === undefined) { - this.walkExpression(statement.test); - this.walkNestedStatement(statement.consequent); - if (statement.alternate) { - this.walkNestedStatement(statement.alternate); - } - } else { - if (result) { - this.walkNestedStatement(statement.consequent); - } else if (statement.alternate) { - this.walkNestedStatement(statement.alternate); +PureExpressionDependency.Template = class PureExpressionDependencyTemplate extends ( + NullDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { chunkGraph, moduleGraph, runtime, runtimeTemplate, runtimeRequirements } + ) { + const dep = /** @type {PureExpressionDependency} */ (dependency); + + const usedByExports = dep.usedByExports; + if (usedByExports !== false) { + const selfModule = moduleGraph.getParentModule(dep); + const exportsInfo = moduleGraph.getExportsInfo(selfModule); + const runtimeCondition = filterRuntime(runtime, runtime => { + for (const exportName of usedByExports) { + if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) { + return true; + } + } + return false; + }); + if (runtimeCondition === true) return; + if (runtimeCondition !== false) { + const condition = runtimeTemplate.runtimeConditionExpression({ + chunkGraph, + runtime, + runtimeCondition, + runtimeRequirements + }); + source.insert( + dep.range[0], + `(/* runtime-dependent pure expression or super */ ${condition} ? (` + ); + source.insert(dep.range[1], ") : null)"); + return; } } - } - preWalkLabeledStatement(statement) { - this.preWalkStatement(statement.body); + source.insert( + dep.range[0], + `(/* unused pure expression or super */ null && (` + ); + source.insert(dep.range[1], "))"); } +}; - walkLabeledStatement(statement) { - const hook = this.hooks.label.get(statement.label.name); - if (hook !== undefined) { - const result = hook.call(statement); - if (result === true) return; - } - this.walkNestedStatement(statement.body); - } +module.exports = PureExpressionDependency; - preWalkWithStatement(statement) { - this.preWalkStatement(statement.body); - } - walkWithStatement(statement) { - this.walkExpression(statement.object); - this.walkNestedStatement(statement.body); - } +/***/ }), - preWalkSwitchStatement(statement) { - this.preWalkSwitchCases(statement.cases); - } +/***/ 46917: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - walkSwitchStatement(statement) { - this.walkExpression(statement.discriminant); - this.walkSwitchCases(statement.cases); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - walkTerminatingStatement(statement) { - if (statement.argument) this.walkExpression(statement.argument); - } - walkReturnStatement(statement) { - this.walkTerminatingStatement(statement); - } - walkThrowStatement(statement) { - this.walkTerminatingStatement(statement); - } +const makeSerializable = __webpack_require__(33032); +const ContextDependency = __webpack_require__(88101); +const ModuleDependencyTemplateAsRequireId = __webpack_require__(36873); - preWalkTryStatement(statement) { - this.preWalkStatement(statement.block); - if (statement.handler) this.preWalkCatchClause(statement.handler); - if (statement.finializer) this.preWalkStatement(statement.finializer); - } +class RequireContextDependency extends ContextDependency { + constructor(options, range) { + super(options); - walkTryStatement(statement) { - if (this.scope.inTry) { - this.walkStatement(statement.block); - } else { - this.scope.inTry = true; - this.walkStatement(statement.block); - this.scope.inTry = false; - } - if (statement.handler) this.walkCatchClause(statement.handler); - if (statement.finalizer) this.walkStatement(statement.finalizer); + this.range = range; } - preWalkWhileStatement(statement) { - this.preWalkStatement(statement.body); + get type() { + return "require.context"; } - walkWhileStatement(statement) { - this.walkExpression(statement.test); - this.walkNestedStatement(statement.body); + serialize(context) { + const { write } = context; + + write(this.range); + + super.serialize(context); } - preWalkDoWhileStatement(statement) { - this.preWalkStatement(statement.body); + deserialize(context) { + const { read } = context; + + this.range = read(); + + super.deserialize(context); } +} - walkDoWhileStatement(statement) { - this.walkNestedStatement(statement.body); - this.walkExpression(statement.test); +makeSerializable( + RequireContextDependency, + "webpack/lib/dependencies/RequireContextDependency" +); + +RequireContextDependency.Template = ModuleDependencyTemplateAsRequireId; + +module.exports = RequireContextDependency; + + +/***/ }), + +/***/ 18851: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const RequireContextDependency = __webpack_require__(46917); + +module.exports = class RequireContextDependencyParserPlugin { + apply(parser) { + parser.hooks.call + .for("require.context") + .tap("RequireContextDependencyParserPlugin", expr => { + let regExp = /^\.\/.*$/; + let recursive = true; + let mode = "sync"; + switch (expr.arguments.length) { + case 4: { + const modeExpr = parser.evaluateExpression(expr.arguments[3]); + if (!modeExpr.isString()) return; + mode = modeExpr.string; + } + // falls through + case 3: { + const regExpExpr = parser.evaluateExpression(expr.arguments[2]); + if (!regExpExpr.isRegExp()) return; + regExp = regExpExpr.regExp; + } + // falls through + case 2: { + const recursiveExpr = parser.evaluateExpression(expr.arguments[1]); + if (!recursiveExpr.isBoolean()) return; + recursive = recursiveExpr.bool; + } + // falls through + case 1: { + const requestExpr = parser.evaluateExpression(expr.arguments[0]); + if (!requestExpr.isString()) return; + const dep = new RequireContextDependency( + { + request: requestExpr.string, + recursive, + regExp, + mode, + category: "commonjs" + }, + expr.range + ); + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; + } + } + }); } +}; - preWalkForStatement(statement) { - if (statement.init) { - if (statement.init.type === "VariableDeclaration") { - this.preWalkStatement(statement.init); + +/***/ }), + +/***/ 2928: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { cachedSetProperty } = __webpack_require__(60839); +const ContextElementDependency = __webpack_require__(58477); +const RequireContextDependency = __webpack_require__(46917); +const RequireContextDependencyParserPlugin = __webpack_require__(18851); + +/** @typedef {import("../../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ +/** @typedef {import("../Compiler")} Compiler */ + +/** @type {ResolveOptions} */ +const EMPTY_RESOLVE_OPTIONS = {}; + +class RequireContextPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "RequireContextPlugin", + (compilation, { contextModuleFactory, normalModuleFactory }) => { + compilation.dependencyFactories.set( + RequireContextDependency, + contextModuleFactory + ); + compilation.dependencyTemplates.set( + RequireContextDependency, + new RequireContextDependency.Template() + ); + + compilation.dependencyFactories.set( + ContextElementDependency, + normalModuleFactory + ); + + const handler = (parser, parserOptions) => { + if ( + parserOptions.requireContext !== undefined && + !parserOptions.requireContext + ) + return; + + new RequireContextDependencyParserPlugin().apply(parser); + }; + + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("RequireContextPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("RequireContextPlugin", handler); + + contextModuleFactory.hooks.alternativeRequests.tap( + "RequireContextPlugin", + (items, options) => { + if (items.length === 0) return items; + + const finalResolveOptions = compiler.resolverFactory.get( + "normal", + cachedSetProperty( + options.resolveOptions || EMPTY_RESOLVE_OPTIONS, + "dependencyType", + options.category + ) + ).options; + + let newItems; + if (!finalResolveOptions.fullySpecified) { + newItems = []; + for (const item of items) { + const { request, context } = item; + for (const ext of finalResolveOptions.extensions) { + if (request.endsWith(ext)) { + newItems.push({ + context, + request: request.slice(0, -ext.length) + }); + } + } + if (!finalResolveOptions.enforceExtension) { + newItems.push(item); + } + } + items = newItems; + + newItems = []; + for (const obj of items) { + const { request, context } = obj; + for (const mainFile of finalResolveOptions.mainFiles) { + if (request.endsWith(`/${mainFile}`)) { + newItems.push({ + context, + request: request.slice(0, -mainFile.length) + }); + newItems.push({ + context, + request: request.slice(0, -mainFile.length - 1) + }); + } + } + newItems.push(obj); + } + items = newItems; + } + + newItems = []; + for (const item of items) { + let hideOriginal = false; + for (const modulesItems of finalResolveOptions.modules) { + if (Array.isArray(modulesItems)) { + for (const dir of modulesItems) { + if (item.request.startsWith(`./${dir}/`)) { + newItems.push({ + context: item.context, + request: item.request.slice(dir.length + 3) + }); + hideOriginal = true; + } + } + } else { + const dir = modulesItems.replace(/\\/g, "/"); + const fullPath = + item.context.replace(/\\/g, "/") + item.request.slice(1); + if (fullPath.startsWith(dir)) { + newItems.push({ + context: item.context, + request: fullPath.slice(dir.length + 1) + }); + } + } + } + if (!hideOriginal) { + newItems.push(item); + } + } + return newItems; + } + ); } - } - this.preWalkStatement(statement.body); + ); } +} +module.exports = RequireContextPlugin; - walkForStatement(statement) { - this.inBlockScope(() => { - if (statement.init) { - if (statement.init.type === "VariableDeclaration") { - this.blockPreWalkVariableDeclaration(statement.init); - this.prevStatement = undefined; - this.walkStatement(statement.init); - } else { - this.walkExpression(statement.init); - } - } - if (statement.test) { - this.walkExpression(statement.test); - } - if (statement.update) { - this.walkExpression(statement.update); - } - const body = statement.body; - if (body.type === "BlockStatement") { - // no need to add additional scope - const prev = this.prevStatement; - this.blockPreWalkStatements(body.body); - this.prevStatement = prev; - this.walkStatements(body.body); - } else { - this.walkNestedStatement(body); - } - }); + +/***/ }), + +/***/ 27153: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const AsyncDependenciesBlock = __webpack_require__(47736); +const makeSerializable = __webpack_require__(33032); + +class RequireEnsureDependenciesBlock extends AsyncDependenciesBlock { + constructor(chunkName, loc) { + super(chunkName, loc, null); } +} + +makeSerializable( + RequireEnsureDependenciesBlock, + "webpack/lib/dependencies/RequireEnsureDependenciesBlock" +); + +module.exports = RequireEnsureDependenciesBlock; - preWalkForInStatement(statement) { - if (statement.left.type === "VariableDeclaration") { - this.preWalkVariableDeclaration(statement.left); - } - this.preWalkStatement(statement.body); - } - walkForInStatement(statement) { - this.inBlockScope(() => { - if (statement.left.type === "VariableDeclaration") { - this.blockPreWalkVariableDeclaration(statement.left); - this.walkVariableDeclaration(statement.left); - } else { - this.walkPattern(statement.left); - } - this.walkExpression(statement.right); - const body = statement.body; - if (body.type === "BlockStatement") { - // no need to add additional scope - const prev = this.prevStatement; - this.blockPreWalkStatements(body.body); - this.prevStatement = prev; - this.walkStatements(body.body); - } else { - this.walkNestedStatement(body); - } - }); - } +/***/ }), - preWalkForOfStatement(statement) { - if (statement.await && this.scope.topLevelScope === true) { - this.hooks.topLevelAwait.call(statement); - } - if (statement.left.type === "VariableDeclaration") { - this.preWalkVariableDeclaration(statement.left); - } - this.preWalkStatement(statement.body); - } +/***/ 7235: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - walkForOfStatement(statement) { - this.inBlockScope(() => { - if (statement.left.type === "VariableDeclaration") { - this.blockPreWalkVariableDeclaration(statement.left); - this.walkVariableDeclaration(statement.left); - } else { - this.walkPattern(statement.left); - } - this.walkExpression(statement.right); - const body = statement.body; - if (body.type === "BlockStatement") { - // no need to add additional scope - const prev = this.prevStatement; - this.blockPreWalkStatements(body.body); - this.prevStatement = prev; - this.walkStatements(body.body); - } else { - this.walkNestedStatement(body); - } - }); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // Declarations - preWalkFunctionDeclaration(statement) { - if (statement.id) { - this.defineVariable(statement.id.name); - } - } - walkFunctionDeclaration(statement) { - const wasTopLevel = this.scope.topLevelScope; - this.scope.topLevelScope = false; - this.inFunctionScope(true, statement.params, () => { - for (const param of statement.params) { - this.walkPattern(param); - } - if (statement.body.type === "BlockStatement") { - this.detectMode(statement.body.body); - const prev = this.prevStatement; - this.preWalkStatement(statement.body); - this.prevStatement = prev; - this.walkStatement(statement.body); - } else { - this.walkExpression(statement.body); - } - }); - this.scope.topLevelScope = wasTopLevel; - } - blockPreWalkImportDeclaration(statement) { - const source = statement.source.value; - this.hooks.import.call(statement, source); - for (const specifier of statement.specifiers) { - const name = specifier.local.name; - switch (specifier.type) { - case "ImportDefaultSpecifier": - if ( - !this.hooks.importSpecifier.call(statement, source, "default", name) - ) { - this.defineVariable(name); - } - break; - case "ImportSpecifier": - if ( - !this.hooks.importSpecifier.call( - statement, - source, - specifier.imported.name, - name - ) - ) { - this.defineVariable(name); - } - break; - case "ImportNamespaceSpecifier": - if (!this.hooks.importSpecifier.call(statement, source, null, name)) { - this.defineVariable(name); +const RequireEnsureDependenciesBlock = __webpack_require__(27153); +const RequireEnsureDependency = __webpack_require__(27223); +const RequireEnsureItemDependency = __webpack_require__(50329); +const getFunctionExpression = __webpack_require__(50396); + +module.exports = class RequireEnsureDependenciesBlockParserPlugin { + apply(parser) { + parser.hooks.call + .for("require.ensure") + .tap("RequireEnsureDependenciesBlockParserPlugin", expr => { + let chunkName = null; + let errorExpressionArg = null; + let errorExpression = null; + switch (expr.arguments.length) { + case 4: { + const chunkNameExpr = parser.evaluateExpression(expr.arguments[3]); + if (!chunkNameExpr.isString()) return; + chunkName = chunkNameExpr.string; } - break; - default: - this.defineVariable(name); - } - } - } + // falls through + case 3: { + errorExpressionArg = expr.arguments[2]; + errorExpression = getFunctionExpression(errorExpressionArg); - enterDeclaration(declaration, onIdent) { - switch (declaration.type) { - case "VariableDeclaration": - for (const declarator of declaration.declarations) { - switch (declarator.type) { - case "VariableDeclarator": { - this.enterPattern(declarator.id, onIdent); - break; + if (!errorExpression && !chunkName) { + const chunkNameExpr = parser.evaluateExpression( + expr.arguments[2] + ); + if (!chunkNameExpr.isString()) return; + chunkName = chunkNameExpr.string; } } - } - break; - case "FunctionDeclaration": - this.enterPattern(declaration.id, onIdent); - break; - case "ClassDeclaration": - this.enterPattern(declaration.id, onIdent); - break; - } - } + // falls through + case 2: { + const dependenciesExpr = parser.evaluateExpression( + expr.arguments[0] + ); + const dependenciesItems = dependenciesExpr.isArray() + ? dependenciesExpr.items + : [dependenciesExpr]; + const successExpressionArg = expr.arguments[1]; + const successExpression = + getFunctionExpression(successExpressionArg); - blockPreWalkExportNamedDeclaration(statement) { - let source; - if (statement.source) { - source = statement.source.value; - this.hooks.exportImport.call(statement, source); - } else { - this.hooks.export.call(statement); - } - if (statement.declaration) { - if ( - !this.hooks.exportDeclaration.call(statement, statement.declaration) - ) { - const prev = this.prevStatement; - this.preWalkStatement(statement.declaration); - this.prevStatement = prev; - this.blockPreWalkStatement(statement.declaration); - let index = 0; - this.enterDeclaration(statement.declaration, def => { - this.hooks.exportSpecifier.call(statement, def, def, index++); - }); - } - } - if (statement.specifiers) { - for ( - let specifierIndex = 0; - specifierIndex < statement.specifiers.length; - specifierIndex++ - ) { - const specifier = statement.specifiers[specifierIndex]; - switch (specifier.type) { - case "ExportSpecifier": { - const name = specifier.exported.name; - if (source) { - this.hooks.exportImportSpecifier.call( - statement, - source, - specifier.local.name, - name, - specifierIndex - ); - } else { - this.hooks.exportSpecifier.call( - statement, - specifier.local.name, - name, - specifierIndex - ); + if (successExpression) { + parser.walkExpressions(successExpression.expressions); } - break; + if (errorExpression) { + parser.walkExpressions(errorExpression.expressions); + } + + const depBlock = new RequireEnsureDependenciesBlock( + chunkName, + expr.loc + ); + const errorCallbackExists = + expr.arguments.length === 4 || + (!chunkName && expr.arguments.length === 3); + const dep = new RequireEnsureDependency( + expr.range, + expr.arguments[1].range, + errorCallbackExists && expr.arguments[2].range + ); + dep.loc = expr.loc; + depBlock.addDependency(dep); + const old = parser.state.current; + parser.state.current = depBlock; + try { + let failed = false; + parser.inScope([], () => { + for (const ee of dependenciesItems) { + if (ee.isString()) { + const ensureDependency = new RequireEnsureItemDependency( + ee.string + ); + ensureDependency.loc = ee.loc || expr.loc; + depBlock.addDependency(ensureDependency); + } else { + failed = true; + } + } + }); + if (failed) { + return; + } + if (successExpression) { + if (successExpression.fn.body.type === "BlockStatement") { + parser.walkStatement(successExpression.fn.body); + } else { + parser.walkExpression(successExpression.fn.body); + } + } + old.addBlock(depBlock); + } finally { + parser.state.current = old; + } + if (!successExpression) { + parser.walkExpression(successExpressionArg); + } + if (errorExpression) { + if (errorExpression.fn.body.type === "BlockStatement") { + parser.walkStatement(errorExpression.fn.body); + } else { + parser.walkExpression(errorExpression.fn.body); + } + } else if (errorExpressionArg) { + parser.walkExpression(errorExpressionArg); + } + return true; } } - } - } + }); } +}; - walkExportNamedDeclaration(statement) { - if (statement.declaration) { - this.walkStatement(statement.declaration); - } - } - blockPreWalkExportDefaultDeclaration(statement) { - const prev = this.prevStatement; - this.preWalkStatement(statement.declaration); - this.prevStatement = prev; - this.blockPreWalkStatement(statement.declaration); - if ( - statement.declaration.id && - statement.declaration.type !== "FunctionExpression" && - statement.declaration.type !== "ClassExpression" - ) { - this.hooks.exportSpecifier.call( - statement, - statement.declaration.id.name, - "default", - undefined - ); - } - } +/***/ }), - walkExportDefaultDeclaration(statement) { - this.hooks.export.call(statement); - if ( - statement.declaration.id && - statement.declaration.type !== "FunctionExpression" && - statement.declaration.type !== "ClassExpression" - ) { - if ( - !this.hooks.exportDeclaration.call(statement, statement.declaration) - ) { - this.walkStatement(statement.declaration); - } - } else { - // Acorn parses `export default function() {}` as `FunctionDeclaration` and - // `export default class {}` as `ClassDeclaration`, both with `id = null`. - // These nodes must be treated as expressions. - if ( - statement.declaration.type === "FunctionDeclaration" || - statement.declaration.type === "ClassDeclaration" - ) { - this.walkStatement(statement.declaration); - } else { - this.walkExpression(statement.declaration); - } - if (!this.hooks.exportExpression.call(statement, statement.declaration)) { - this.hooks.exportSpecifier.call( - statement, - statement.declaration, - "default", - undefined - ); - } - } - } +/***/ 27223: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - blockPreWalkExportAllDeclaration(statement) { - const source = statement.source.value; - const name = statement.exported ? statement.exported.name : null; - this.hooks.exportImport.call(statement, source); - this.hooks.exportImportSpecifier.call(statement, source, null, name, 0); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - preWalkVariableDeclaration(statement) { - if (statement.kind !== "var") return; - this._preWalkVariableDeclaration(statement, this.hooks.varDeclarationVar); - } - blockPreWalkVariableDeclaration(statement) { - if (statement.kind === "var") return; - const hookMap = - statement.kind === "const" - ? this.hooks.varDeclarationConst - : this.hooks.varDeclarationLet; - this._preWalkVariableDeclaration(statement, hookMap); - } - _preWalkVariableDeclaration(statement, hookMap) { - for (const declarator of statement.declarations) { - switch (declarator.type) { - case "VariableDeclarator": { - if (!this.hooks.preDeclarator.call(declarator, statement)) { - this.enterPattern(declarator.id, (name, decl) => { - let hook = hookMap.get(name); - if (hook === undefined || !hook.call(decl)) { - hook = this.hooks.varDeclaration.get(name); - if (hook === undefined || !hook.call(decl)) { - this.defineVariable(name); - } - } - }); - } - break; - } - } - } +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + +class RequireEnsureDependency extends NullDependency { + constructor(range, contentRange, errorHandlerRange) { + super(); + + this.range = range; + this.contentRange = contentRange; + this.errorHandlerRange = errorHandlerRange; } - walkVariableDeclaration(statement) { - for (const declarator of statement.declarations) { - switch (declarator.type) { - case "VariableDeclarator": { - const renameIdentifier = - declarator.init && this.getRenameIdentifier(declarator.init); - if (renameIdentifier && declarator.id.type === "Identifier") { - const hook = this.hooks.canRename.get(renameIdentifier); - if (hook !== undefined && hook.call(declarator.init)) { - // renaming with "var a = b;" - const hook = this.hooks.rename.get(renameIdentifier); - if (hook === undefined || !hook.call(declarator.init)) { - this.setVariable(declarator.id.name, renameIdentifier); - } - break; - } - } - if (!this.hooks.declarator.call(declarator, statement)) { - this.walkPattern(declarator.id); - if (declarator.init) this.walkExpression(declarator.init); - } - break; - } - } - } + get type() { + return "require.ensure"; } - blockPreWalkClassDeclaration(statement) { - if (statement.id) { - this.defineVariable(statement.id.name); - } + serialize(context) { + const { write } = context; + + write(this.range); + write(this.contentRange); + write(this.errorHandlerRange); + + super.serialize(context); } - walkClassDeclaration(statement) { - this.walkClass(statement); + deserialize(context) { + const { read } = context; + + this.range = read(); + this.contentRange = read(); + this.errorHandlerRange = read(); + + super.deserialize(context); } +} - preWalkSwitchCases(switchCases) { - for (let index = 0, len = switchCases.length; index < len; index++) { - const switchCase = switchCases[index]; - this.preWalkStatements(switchCase.consequent); +makeSerializable( + RequireEnsureDependency, + "webpack/lib/dependencies/RequireEnsureDependency" +); + +RequireEnsureDependency.Template = class RequireEnsureDependencyTemplate extends ( + NullDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } + ) { + const dep = /** @type {RequireEnsureDependency} */ (dependency); + const depBlock = /** @type {AsyncDependenciesBlock} */ ( + moduleGraph.getParentBlock(dep) + ); + const promise = runtimeTemplate.blockPromise({ + chunkGraph, + block: depBlock, + message: "require.ensure", + runtimeRequirements + }); + const range = dep.range; + const contentRange = dep.contentRange; + const errorHandlerRange = dep.errorHandlerRange; + source.replace(range[0], contentRange[0] - 1, `${promise}.then((`); + if (errorHandlerRange) { + source.replace( + contentRange[1], + errorHandlerRange[0] - 1, + ").bind(null, __webpack_require__))['catch'](" + ); + source.replace(errorHandlerRange[1], range[1] - 1, ")"); + } else { + source.replace( + contentRange[1], + range[1] - 1, + `).bind(null, __webpack_require__))['catch'](${RuntimeGlobals.uncaughtErrorHandler})` + ); } } +}; - walkSwitchCases(switchCases) { - this.inBlockScope(() => { - const len = switchCases.length; - - // we need to pre walk all statements first since we can have invalid code - // import A from "module"; - // switch(1) { - // case 1: - // console.log(A); // should fail at runtime - // case 2: - // const A = 1; - // } - for (let index = 0; index < len; index++) { - const switchCase = switchCases[index]; +module.exports = RequireEnsureDependency; - if (switchCase.consequent.length > 0) { - const prev = this.prevStatement; - this.blockPreWalkStatements(switchCase.consequent); - this.prevStatement = prev; - } - } - for (let index = 0; index < len; index++) { - const switchCase = switchCases[index]; +/***/ }), - if (switchCase.test) { - this.walkExpression(switchCase.test); - } - if (switchCase.consequent.length > 0) { - this.walkStatements(switchCase.consequent); - } - } - }); - } +/***/ 50329: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - preWalkCatchClause(catchClause) { - this.preWalkStatement(catchClause.body); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - walkCatchClause(catchClause) { - this.inBlockScope(() => { - // Error binding is optional in catch clause since ECMAScript 2019 - if (catchClause.param !== null) { - this.enterPattern(catchClause.param, ident => { - this.defineVariable(ident); - }); - this.walkPattern(catchClause.param); - } - const prev = this.prevStatement; - this.blockPreWalkStatement(catchClause.body); - this.prevStatement = prev; - this.walkStatement(catchClause.body); - }); - } - walkPattern(pattern) { - switch (pattern.type) { - case "ArrayPattern": - this.walkArrayPattern(pattern); - break; - case "AssignmentPattern": - this.walkAssignmentPattern(pattern); - break; - case "MemberExpression": - this.walkMemberExpression(pattern); - break; - case "ObjectPattern": - this.walkObjectPattern(pattern); - break; - case "RestElement": - this.walkRestElement(pattern); - break; - } - } - walkAssignmentPattern(pattern) { - this.walkExpression(pattern.right); - this.walkPattern(pattern.left); - } +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); +const NullDependency = __webpack_require__(31830); - walkObjectPattern(pattern) { - for (let i = 0, len = pattern.properties.length; i < len; i++) { - const prop = pattern.properties[i]; - if (prop) { - if (prop.computed) this.walkExpression(prop.key); - if (prop.value) this.walkPattern(prop.value); - } - } +class RequireEnsureItemDependency extends ModuleDependency { + constructor(request) { + super(request); } - walkArrayPattern(pattern) { - for (let i = 0, len = pattern.elements.length; i < len; i++) { - const element = pattern.elements[i]; - if (element) this.walkPattern(element); - } + get type() { + return "require.ensure item"; } - walkRestElement(pattern) { - this.walkPattern(pattern.argument); + get category() { + return "commonjs"; } +} - walkExpressions(expressions) { - for (const expression of expressions) { - if (expression) { - this.walkExpression(expression); - } - } - } +makeSerializable( + RequireEnsureItemDependency, + "webpack/lib/dependencies/RequireEnsureItemDependency" +); - walkExpression(expression) { - switch (expression.type) { - case "ArrayExpression": - this.walkArrayExpression(expression); - break; - case "ArrowFunctionExpression": - this.walkArrowFunctionExpression(expression); - break; - case "AssignmentExpression": - this.walkAssignmentExpression(expression); - break; - case "AwaitExpression": - this.walkAwaitExpression(expression); - break; - case "BinaryExpression": - this.walkBinaryExpression(expression); - break; - case "CallExpression": - this.walkCallExpression(expression); - break; - case "ChainExpression": - this.walkChainExpression(expression); - break; - case "ClassExpression": - this.walkClassExpression(expression); - break; - case "ConditionalExpression": - this.walkConditionalExpression(expression); - break; - case "FunctionExpression": - this.walkFunctionExpression(expression); - break; - case "Identifier": - this.walkIdentifier(expression); - break; - case "ImportExpression": - this.walkImportExpression(expression); - break; - case "LogicalExpression": - this.walkLogicalExpression(expression); - break; - case "MetaProperty": - this.walkMetaProperty(expression); - break; - case "MemberExpression": - this.walkMemberExpression(expression); - break; - case "NewExpression": - this.walkNewExpression(expression); - break; - case "ObjectExpression": - this.walkObjectExpression(expression); - break; - case "SequenceExpression": - this.walkSequenceExpression(expression); - break; - case "SpreadElement": - this.walkSpreadElement(expression); - break; - case "TaggedTemplateExpression": - this.walkTaggedTemplateExpression(expression); - break; - case "TemplateLiteral": - this.walkTemplateLiteral(expression); - break; - case "ThisExpression": - this.walkThisExpression(expression); - break; - case "UnaryExpression": - this.walkUnaryExpression(expression); - break; - case "UpdateExpression": - this.walkUpdateExpression(expression); - break; - case "YieldExpression": - this.walkYieldExpression(expression); - break; - } - } +RequireEnsureItemDependency.Template = NullDependency.Template; - walkAwaitExpression(expression) { - if (this.scope.topLevelScope === true) - this.hooks.topLevelAwait.call(expression); - this.walkExpression(expression.argument); - } +module.exports = RequireEnsureItemDependency; - walkArrayExpression(expression) { - if (expression.elements) { - this.walkExpressions(expression.elements); - } - } - walkSpreadElement(expression) { - if (expression.argument) { - this.walkExpression(expression.argument); - } - } +/***/ }), - walkObjectExpression(expression) { - for ( - let propIndex = 0, len = expression.properties.length; - propIndex < len; - propIndex++ - ) { - const prop = expression.properties[propIndex]; - this.walkProperty(prop); - } - } +/***/ 8434: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - walkProperty(prop) { - if (prop.type === "SpreadElement") { - this.walkExpression(prop.argument); - return; - } - if (prop.computed) { - this.walkExpression(prop.key); - } - if (prop.shorthand && prop.value && prop.value.type === "Identifier") { - this.scope.inShorthand = prop.value.name; - this.walkIdentifier(prop.value); - this.scope.inShorthand = false; - } else { - this.walkExpression(prop.value); - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - walkFunctionExpression(expression) { - const wasTopLevel = this.scope.topLevelScope; - this.scope.topLevelScope = false; - const scopeParams = expression.params; - // Add function name in scope for recursive calls - if (expression.id) { - scopeParams.push(expression.id.name); - } - this.inFunctionScope(true, scopeParams, () => { - for (const param of expression.params) { - this.walkPattern(param); - } - if (expression.body.type === "BlockStatement") { - this.detectMode(expression.body.body); - const prev = this.prevStatement; - this.preWalkStatement(expression.body); - this.prevStatement = prev; - this.walkStatement(expression.body); - } else { - this.walkExpression(expression.body); - } - }); - this.scope.topLevelScope = wasTopLevel; - } +const RequireEnsureDependency = __webpack_require__(27223); +const RequireEnsureItemDependency = __webpack_require__(50329); - walkArrowFunctionExpression(expression) { - const wasTopLevel = this.scope.topLevelScope; - this.scope.topLevelScope = wasTopLevel ? "arrow" : false; - this.inFunctionScope(false, expression.params, () => { - for (const param of expression.params) { - this.walkPattern(param); - } - if (expression.body.type === "BlockStatement") { - this.detectMode(expression.body.body); - const prev = this.prevStatement; - this.preWalkStatement(expression.body); - this.prevStatement = prev; - this.walkStatement(expression.body); - } else { - this.walkExpression(expression.body); - } - }); - this.scope.topLevelScope = wasTopLevel; - } +const RequireEnsureDependenciesBlockParserPlugin = __webpack_require__(7235); - /** - * @param {SequenceExpressionNode} expression the sequence - */ - walkSequenceExpression(expression) { - if (!expression.expressions) return; - // We treat sequence expressions like statements when they are one statement level - // This has some benefits for optimizations that only work on statement level - const currentStatement = this.statementPath[this.statementPath.length - 1]; - if ( - currentStatement === expression || - (currentStatement.type === "ExpressionStatement" && - currentStatement.expression === expression) - ) { - const old = this.statementPath.pop(); - for (const expr of expression.expressions) { - this.statementPath.push(expr); - this.walkExpression(expr); - this.statementPath.pop(); - } - this.statementPath.push(old); - } else { - this.walkExpressions(expression.expressions); - } - } +const { + evaluateToString, + toConstantDependency +} = __webpack_require__(93998); - walkUpdateExpression(expression) { - this.walkExpression(expression.argument); - } +class RequireEnsurePlugin { + apply(compiler) { + compiler.hooks.compilation.tap( + "RequireEnsurePlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + RequireEnsureItemDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + RequireEnsureItemDependency, + new RequireEnsureItemDependency.Template() + ); - walkUnaryExpression(expression) { - if (expression.operator === "typeof") { - const result = this.callHooksForExpression( - this.hooks.typeof, - expression.argument, - expression - ); - if (result === true) return; - if (expression.argument.type === "ChainExpression") { - const result = this.callHooksForExpression( - this.hooks.typeof, - expression.argument.expression, - expression + compilation.dependencyTemplates.set( + RequireEnsureDependency, + new RequireEnsureDependency.Template() ); - if (result === true) return; - } - } - this.walkExpression(expression.argument); - } - walkLeftRightExpression(expression) { - this.walkExpression(expression.left); - this.walkExpression(expression.right); - } + const handler = (parser, parserOptions) => { + if ( + parserOptions.requireEnsure !== undefined && + !parserOptions.requireEnsure + ) + return; - walkBinaryExpression(expression) { - this.walkLeftRightExpression(expression); - } + new RequireEnsureDependenciesBlockParserPlugin().apply(parser); + parser.hooks.evaluateTypeof + .for("require.ensure") + .tap("RequireEnsurePlugin", evaluateToString("function")); + parser.hooks.typeof + .for("require.ensure") + .tap( + "RequireEnsurePlugin", + toConstantDependency(parser, JSON.stringify("function")) + ); + }; - walkLogicalExpression(expression) { - const result = this.hooks.expressionLogicalOperator.call(expression); - if (result === undefined) { - this.walkLeftRightExpression(expression); - } else { - if (result) { - this.walkExpression(expression.right); + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("RequireEnsurePlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("RequireEnsurePlugin", handler); } - } + ); } +} +module.exports = RequireEnsurePlugin; - walkAssignmentExpression(expression) { - if (expression.left.type === "Identifier") { - const renameIdentifier = this.getRenameIdentifier(expression.right); - if (renameIdentifier) { - if ( - this.callHooksForInfo( - this.hooks.canRename, - renameIdentifier, - expression.right - ) - ) { - // renaming "a = b;" - if ( - !this.callHooksForInfo( - this.hooks.rename, - renameIdentifier, - expression.right - ) - ) { - this.setVariable( - expression.left.name, - this.getVariableInfo(renameIdentifier) - ); - } - return; - } - } - this.walkExpression(expression.right); - this.enterPattern(expression.left, (name, decl) => { - if (!this.callHooksForName(this.hooks.assign, name, expression)) { - this.walkExpression(expression.left); - } - }); - return; - } - if (expression.left.type.endsWith("Pattern")) { - this.walkExpression(expression.right); - this.enterPattern(expression.left, (name, decl) => { - if (!this.callHooksForName(this.hooks.assign, name, expression)) { - this.defineVariable(name); - } - }); - this.walkPattern(expression.left); - } else if (expression.left.type === "MemberExpression") { - const exprName = this.getMemberExpressionInfo( - expression.left, - ALLOWED_MEMBER_TYPES_EXPRESSION - ); - if (exprName) { - if ( - this.callHooksForInfo( - this.hooks.assignMemberChain, - exprName.rootInfo, - expression, - exprName.getMembers() - ) - ) { - return; - } - } - this.walkExpression(expression.right); - this.walkExpression(expression.left); - } else { - this.walkExpression(expression.right); - this.walkExpression(expression.left); - } - } - walkConditionalExpression(expression) { - const result = this.hooks.expressionConditionalOperator.call(expression); - if (result === undefined) { - this.walkExpression(expression.test); - this.walkExpression(expression.consequent); - if (expression.alternate) { - this.walkExpression(expression.alternate); - } - } else { - if (result) { - this.walkExpression(expression.consequent); - } else if (expression.alternate) { - this.walkExpression(expression.alternate); - } - } - } +/***/ }), - walkNewExpression(expression) { - const result = this.callHooksForExpression( - this.hooks.new, - expression.callee, - expression - ); - if (result === true) return; - this.walkExpression(expression.callee); - if (expression.arguments) { - this.walkExpressions(expression.arguments); - } - } +/***/ 89183: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); - walkYieldExpression(expression) { - if (expression.argument) { - this.walkExpression(expression.argument); - } - } +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ - walkTemplateLiteral(expression) { - if (expression.expressions) { - this.walkExpressions(expression.expressions); - } +class RequireHeaderDependency extends NullDependency { + constructor(range) { + super(); + if (!Array.isArray(range)) throw new Error("range must be valid"); + this.range = range; } - walkTaggedTemplateExpression(expression) { - if (expression.tag) { - this.walkExpression(expression.tag); - } - if (expression.quasi && expression.quasi.expressions) { - this.walkExpressions(expression.quasi.expressions); - } + serialize(context) { + const { write } = context; + write(this.range); + super.serialize(context); } - walkClassExpression(expression) { - this.walkClass(expression); + static deserialize(context) { + const obj = new RequireHeaderDependency(context.read()); + obj.deserialize(context); + return obj; } +} + +makeSerializable( + RequireHeaderDependency, + "webpack/lib/dependencies/RequireHeaderDependency" +); +RequireHeaderDependency.Template = class RequireHeaderDependencyTemplate extends ( + NullDependency.Template +) { /** - * @param {ChainExpressionNode} expression expression + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - walkChainExpression(expression) { - const result = this.hooks.optionalChaining.call(expression); - - if (result === undefined) { - if (expression.expression.type === "CallExpression") { - this.walkCallExpression(expression.expression); - } else { - this.walkMemberExpression(expression.expression); - } - } + apply(dependency, source, { runtimeRequirements }) { + const dep = /** @type {RequireHeaderDependency} */ (dependency); + runtimeRequirements.add(RuntimeGlobals.require); + source.replace(dep.range[0], dep.range[1] - 1, "__webpack_require__"); } +}; - _walkIIFE(functionExpression, options, currentThis) { - const getVarInfo = argOrThis => { - const renameIdentifier = this.getRenameIdentifier(argOrThis); - if (renameIdentifier) { - if ( - this.callHooksForInfo( - this.hooks.canRename, - renameIdentifier, - argOrThis - ) - ) { - if ( - !this.callHooksForInfo( - this.hooks.rename, - renameIdentifier, - argOrThis - ) - ) { - return this.getVariableInfo(renameIdentifier); - } - } - } - this.walkExpression(argOrThis); - }; - const { params, type } = functionExpression; - const arrow = type === "ArrowFunctionExpression"; - const renameThis = currentThis ? getVarInfo(currentThis) : null; - const varInfoForArgs = options.map(getVarInfo); - const wasTopLevel = this.scope.topLevelScope; - this.scope.topLevelScope = wasTopLevel && arrow ? "arrow" : false; - const scopeParams = params.filter( - (identifier, idx) => !varInfoForArgs[idx] - ); +module.exports = RequireHeaderDependency; - // Add function name in scope for recursive calls - if (functionExpression.id) { - scopeParams.push(functionExpression.id.name); - } - this.inFunctionScope(true, scopeParams, () => { - if (renameThis && !arrow) { - this.setVariable("this", renameThis); - } - for (let i = 0; i < varInfoForArgs.length; i++) { - const varInfo = varInfoForArgs[i]; - if (!varInfo) continue; - if (!params[i] || params[i].type !== "Identifier") continue; - this.setVariable(params[i].name, varInfo); - } - if (functionExpression.body.type === "BlockStatement") { - this.detectMode(functionExpression.body.body); - const prev = this.prevStatement; - this.preWalkStatement(functionExpression.body); - this.prevStatement = prev; - this.walkStatement(functionExpression.body); - } else { - this.walkExpression(functionExpression.body); - } - }); - this.scope.topLevelScope = wasTopLevel; - } +/***/ }), - walkImportExpression(expression) { - let result = this.hooks.importCall.call(expression); - if (result === true) return; +/***/ 71284: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - this.walkExpression(expression.source); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - walkCallExpression(expression) { - const isSimpleFunction = fn => { - return fn.params.every(p => p.type === "Identifier"); - }; - if ( - expression.callee.type === "MemberExpression" && - expression.callee.object.type.endsWith("FunctionExpression") && - !expression.callee.computed && - (expression.callee.property.name === "call" || - expression.callee.property.name === "bind") && - expression.arguments.length > 0 && - isSimpleFunction(expression.callee.object) - ) { - // (function(…) { }.call/bind(?, …)) - this._walkIIFE( - expression.callee.object, - expression.arguments.slice(1), - expression.arguments[0] - ); - } else if ( - expression.callee.type.endsWith("FunctionExpression") && - isSimpleFunction(expression.callee) - ) { - // (function(…) { }(…)) - this._walkIIFE(expression.callee, expression.arguments, null); - } else { - if (expression.callee.type === "MemberExpression") { - const exprInfo = this.getMemberExpressionInfo( - expression.callee, - ALLOWED_MEMBER_TYPES_CALL_EXPRESSION - ); - if (exprInfo && exprInfo.type === "call") { - const result = this.callHooksForInfo( - this.hooks.callMemberChainOfCallMemberChain, - exprInfo.rootInfo, - expression, - exprInfo.getCalleeMembers(), - exprInfo.call, - exprInfo.getMembers() - ); - if (result === true) return; - } - } - const callee = this.evaluateExpression(expression.callee); - if (callee.isIdentifier()) { - const result1 = this.callHooksForInfo( - this.hooks.callMemberChain, - callee.rootInfo, - expression, - callee.getMembers() - ); - if (result1 === true) return; - const result2 = this.callHooksForInfo( - this.hooks.call, - callee.identifier, - expression - ); - if (result2 === true) return; - } - if (expression.callee) { - if (expression.callee.type === "MemberExpression") { - // because of call context we need to walk the call context as expression - this.walkExpression(expression.callee.object); - if (expression.callee.computed === true) - this.walkExpression(expression.callee.property); - } else { - this.walkExpression(expression.callee); - } - } - if (expression.arguments) this.walkExpressions(expression.arguments); - } - } - walkMemberExpression(expression) { - const exprInfo = this.getMemberExpressionInfo( - expression, - ALLOWED_MEMBER_TYPES_ALL - ); - if (exprInfo) { - switch (exprInfo.type) { - case "expression": { - const result1 = this.callHooksForInfo( - this.hooks.expression, - exprInfo.name, - expression - ); - if (result1 === true) return; - const members = exprInfo.getMembers(); - const result2 = this.callHooksForInfo( - this.hooks.expressionMemberChain, - exprInfo.rootInfo, - expression, - members - ); - if (result2 === true) return; - this.walkMemberExpressionWithExpressionName( - expression, - exprInfo.name, - exprInfo.rootInfo, - members.slice(), - () => - this.callHooksForInfo( - this.hooks.unhandledExpressionMemberChain, - exprInfo.rootInfo, - expression, - members - ) - ); - return; - } - case "call": { - const result = this.callHooksForInfo( - this.hooks.memberChainOfCallMemberChain, - exprInfo.rootInfo, - expression, - exprInfo.getCalleeMembers(), - exprInfo.call, - exprInfo.getMembers() - ); - if (result === true) return; - // Fast skip over the member chain as we already called memberChainOfCallMemberChain - // and call computed property are literals anyway - this.walkExpression(exprInfo.call); - return; - } - } - } - this.walkExpression(expression.object); - if (expression.computed === true) this.walkExpression(expression.property); - } +const Dependency = __webpack_require__(54912); +const Template = __webpack_require__(39722); +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); - walkMemberExpressionWithExpressionName( - expression, - name, - rootInfo, - members, - onUnhandled - ) { - if (expression.object.type === "MemberExpression") { - // optimize the case where expression.object is a MemberExpression too. - // we can keep info here when calling walkMemberExpression directly - const property = - expression.property.name || `${expression.property.value}`; - name = name.slice(0, -property.length - 1); - members.pop(); - const result = this.callHooksForInfo( - this.hooks.expression, - name, - expression.object - ); - if (result === true) return; - this.walkMemberExpressionWithExpressionName( - expression.object, - name, - rootInfo, - members, - onUnhandled - ); - } else if (!onUnhandled || !onUnhandled()) { - this.walkExpression(expression.object); - } - if (expression.computed === true) this.walkExpression(expression.property); - } +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - walkThisExpression(expression) { - this.callHooksForName(this.hooks.expression, "this", expression); - } +class RequireIncludeDependency extends ModuleDependency { + constructor(request, range) { + super(request); - walkIdentifier(expression) { - this.callHooksForName(this.hooks.expression, expression.name, expression); + this.range = range; } /** - * @param {MetaPropertyNode} metaProperty meta property + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports */ - walkMetaProperty(metaProperty) { - this.hooks.expression.for(getRootName(metaProperty)).call(metaProperty); + getReferencedExports(moduleGraph, runtime) { + // This doesn't use any export + return Dependency.NO_EXPORTS_REFERENCED; } - callHooksForExpression(hookMap, expr, ...args) { - return this.callHooksForExpressionWithFallback( - hookMap, - expr, - undefined, - undefined, - ...args - ); + get type() { + return "require.include"; } - /** - * @template T - * @template R - * @param {HookMap>} hookMap hooks the should be called - * @param {MemberExpressionNode} expr expression info - * @param {function(string, string | ScopeInfo | VariableInfo, function(): string[]): any} fallback callback when variable in not handled by hooks - * @param {function(string): any} defined callback when variable is defined - * @param {AsArray} args args for the hook - * @returns {R} result of hook - */ - callHooksForExpressionWithFallback( - hookMap, - expr, - fallback, - defined, - ...args - ) { - const exprName = this.getMemberExpressionInfo( - expr, - ALLOWED_MEMBER_TYPES_EXPRESSION - ); - if (exprName !== undefined) { - const members = exprName.getMembers(); - return this.callHooksForInfoWithFallback( - hookMap, - members.length === 0 ? exprName.rootInfo : exprName.name, - fallback && - (name => fallback(name, exprName.rootInfo, exprName.getMembers)), - defined && (() => defined(exprName.name)), - ...args - ); - } + get category() { + return "commonjs"; } +} + +makeSerializable( + RequireIncludeDependency, + "webpack/lib/dependencies/RequireIncludeDependency" +); +RequireIncludeDependency.Template = class RequireIncludeDependencyTemplate extends ( + ModuleDependency.Template +) { /** - * @template T - * @template R - * @param {HookMap>} hookMap hooks the should be called - * @param {string} name key in map - * @param {AsArray} args args for the hook - * @returns {R} result of hook + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - callHooksForName(hookMap, name, ...args) { - return this.callHooksForNameWithFallback( - hookMap, - name, - undefined, - undefined, - ...args - ); + apply(dependency, source, { runtimeTemplate }) { + const dep = /** @type {RequireIncludeDependency} */ (dependency); + const comment = runtimeTemplate.outputOptions.pathinfo + ? Template.toComment( + `require.include ${runtimeTemplate.requestShortener.shorten( + dep.request + )}` + ) + : ""; + + source.replace(dep.range[0], dep.range[1] - 1, `undefined${comment}`); } +}; - /** - * @template T - * @template R - * @param {HookMap>} hookMap hooks that should be called - * @param {ExportedVariableInfo} info variable info - * @param {AsArray} args args for the hook - * @returns {R} result of hook - */ - callHooksForInfo(hookMap, info, ...args) { - return this.callHooksForInfoWithFallback( - hookMap, - info, - undefined, - undefined, - ...args - ); +module.exports = RequireIncludeDependency; + + +/***/ }), + +/***/ 35768: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const WebpackError = __webpack_require__(53799); +const { + evaluateToString, + toConstantDependency +} = __webpack_require__(93998); +const makeSerializable = __webpack_require__(33032); +const RequireIncludeDependency = __webpack_require__(71284); + +module.exports = class RequireIncludeDependencyParserPlugin { + constructor(warn) { + this.warn = warn; } + apply(parser) { + const { warn } = this; + parser.hooks.call + .for("require.include") + .tap("RequireIncludeDependencyParserPlugin", expr => { + if (expr.arguments.length !== 1) return; + const param = parser.evaluateExpression(expr.arguments[0]); + if (!param.isString()) return; - /** - * @template T - * @template R - * @param {HookMap>} hookMap hooks the should be called - * @param {ExportedVariableInfo} info variable info - * @param {function(string): any} fallback callback when variable in not handled by hooks - * @param {function(): any} defined callback when variable is defined - * @param {AsArray} args args for the hook - * @returns {R} result of hook - */ - callHooksForInfoWithFallback(hookMap, info, fallback, defined, ...args) { - let name; - if (typeof info === "string") { - name = info; - } else { - if (!(info instanceof VariableInfo)) { - if (defined !== undefined) { - return defined(); - } - return; - } - let tagInfo = info.tagInfo; - while (tagInfo !== undefined) { - const hook = hookMap.get(tagInfo.tag); - if (hook !== undefined) { - this.currentTagData = tagInfo.data; - const result = hook.call(...args); - this.currentTagData = undefined; - if (result !== undefined) return result; + if (warn) { + parser.state.module.addWarning( + new RequireIncludeDeprecationWarning(expr.loc) + ); } - tagInfo = tagInfo.next; - } - if (info.freeName === true) { - if (defined !== undefined) { - return defined(); + + const dep = new RequireIncludeDependency(param.string, expr.range); + dep.loc = expr.loc; + parser.state.current.addDependency(dep); + return true; + }); + parser.hooks.evaluateTypeof + .for("require.include") + .tap("RequireIncludePlugin", expr => { + if (warn) { + parser.state.module.addWarning( + new RequireIncludeDeprecationWarning(expr.loc) + ); } - return; - } - name = info.freeName; - } - const hook = hookMap.get(name); - if (hook !== undefined) { - const result = hook.call(...args); - if (result !== undefined) return result; - } - if (fallback !== undefined) { - return fallback(name); - } + return evaluateToString("function")(expr); + }); + parser.hooks.typeof + .for("require.include") + .tap("RequireIncludePlugin", expr => { + if (warn) { + parser.state.module.addWarning( + new RequireIncludeDeprecationWarning(expr.loc) + ); + } + return toConstantDependency(parser, JSON.stringify("function"))(expr); + }); } +}; - /** - * @template T - * @template R - * @param {HookMap>} hookMap hooks the should be called - * @param {string} name key in map - * @param {function(string): any} fallback callback when variable in not handled by hooks - * @param {function(): any} defined callback when variable is defined - * @param {AsArray} args args for the hook - * @returns {R} result of hook - */ - callHooksForNameWithFallback(hookMap, name, fallback, defined, ...args) { - return this.callHooksForInfoWithFallback( - hookMap, - this.getVariableInfo(name), - fallback, - defined, - ...args - ); +class RequireIncludeDeprecationWarning extends WebpackError { + constructor(loc) { + super("require.include() is deprecated and will be removed soon."); + + this.name = "RequireIncludeDeprecationWarning"; + + this.loc = loc; } +} - /** - * @deprecated - * @param {any} params scope params - * @param {function(): void} fn inner function - * @returns {void} - */ - inScope(params, fn) { - const oldScope = this.scope; - this.scope = { - topLevelScope: oldScope.topLevelScope, - inTry: false, - inShorthand: false, - isStrict: oldScope.isStrict, - isAsmJs: oldScope.isAsmJs, - definitions: oldScope.definitions.createChild() - }; +makeSerializable( + RequireIncludeDeprecationWarning, + "webpack/lib/dependencies/RequireIncludeDependencyParserPlugin", + "RequireIncludeDeprecationWarning" +); - this.undefineVariable("this"); - this.enterPatterns(params, (ident, pattern) => { - this.defineVariable(ident); - }); +/***/ }), - fn(); +/***/ 37378: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - this.scope = oldScope; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - inFunctionScope(hasThis, params, fn) { - const oldScope = this.scope; - this.scope = { - topLevelScope: oldScope.topLevelScope, - inTry: false, - inShorthand: false, - isStrict: oldScope.isStrict, - isAsmJs: oldScope.isAsmJs, - definitions: oldScope.definitions.createChild() - }; - if (hasThis) { - this.undefineVariable("this"); - } - this.enterPatterns(params, (ident, pattern) => { - this.defineVariable(ident); - }); +const RequireIncludeDependency = __webpack_require__(71284); +const RequireIncludeDependencyParserPlugin = __webpack_require__(35768); - fn(); +class RequireIncludePlugin { + apply(compiler) { + compiler.hooks.compilation.tap( + "RequireIncludePlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + RequireIncludeDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + RequireIncludeDependency, + new RequireIncludeDependency.Template() + ); - this.scope = oldScope; + const handler = (parser, parserOptions) => { + if (parserOptions.requireInclude === false) return; + const warn = parserOptions.requireInclude === undefined; + + new RequireIncludeDependencyParserPlugin(warn).apply(parser); + }; + + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("RequireIncludePlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("RequireIncludePlugin", handler); + } + ); } +} +module.exports = RequireIncludePlugin; - inBlockScope(fn) { - const oldScope = this.scope; - this.scope = { - topLevelScope: oldScope.topLevelScope, - inTry: oldScope.inTry, - inShorthand: false, - isStrict: oldScope.isStrict, - isAsmJs: oldScope.isAsmJs, - definitions: oldScope.definitions.createChild() - }; - fn(); +/***/ }), - this.scope = oldScope; - } +/***/ 55627: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - detectMode(statements) { - const isLiteral = - statements.length >= 1 && - statements[0].type === "ExpressionStatement" && - statements[0].expression.type === "Literal"; - if (isLiteral && statements[0].expression.value === "use strict") { - this.scope.isStrict = true; - } - if (isLiteral && statements[0].expression.value === "use asm") { - this.scope.isAsmJs = true; - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - enterPatterns(patterns, onIdent) { - for (const pattern of patterns) { - if (typeof pattern !== "string") { - this.enterPattern(pattern, onIdent); - } else if (pattern) { - onIdent(pattern); - } - } - } - enterPattern(pattern, onIdent) { - if (!pattern) return; - switch (pattern.type) { - case "ArrayPattern": - this.enterArrayPattern(pattern, onIdent); - break; - case "AssignmentPattern": - this.enterAssignmentPattern(pattern, onIdent); - break; - case "Identifier": - this.enterIdentifier(pattern, onIdent); - break; - case "ObjectPattern": - this.enterObjectPattern(pattern, onIdent); - break; - case "RestElement": - this.enterRestElement(pattern, onIdent); - break; - case "Property": - if (pattern.shorthand && pattern.value.type === "Identifier") { - this.scope.inShorthand = pattern.value.name; - this.enterIdentifier(pattern.value, onIdent); - this.scope.inShorthand = false; - } else { - this.enterPattern(pattern.value, onIdent); - } - break; - } - } - enterIdentifier(pattern, onIdent) { - if (!this.callHooksForName(this.hooks.pattern, pattern.name, pattern)) { - onIdent(pattern.name, pattern); - } - } +const makeSerializable = __webpack_require__(33032); +const ContextDependency = __webpack_require__(88101); +const ContextDependencyTemplateAsId = __webpack_require__(76081); - enterObjectPattern(pattern, onIdent) { - for ( - let propIndex = 0, len = pattern.properties.length; - propIndex < len; - propIndex++ - ) { - const prop = pattern.properties[propIndex]; - this.enterPattern(prop, onIdent); - } - } +class RequireResolveContextDependency extends ContextDependency { + constructor(options, range, valueRange) { + super(options); - enterArrayPattern(pattern, onIdent) { - for ( - let elementIndex = 0, len = pattern.elements.length; - elementIndex < len; - elementIndex++ - ) { - const element = pattern.elements[elementIndex]; - this.enterPattern(element, onIdent); - } + this.range = range; + this.valueRange = valueRange; } - enterRestElement(pattern, onIdent) { - this.enterPattern(pattern.argument, onIdent); + get type() { + return "amd require context"; } - enterAssignmentPattern(pattern, onIdent) { - this.enterPattern(pattern.left, onIdent); - } + serialize(context) { + const { write } = context; - /** - * @param {ExpressionNode} expression expression node - * @returns {BasicEvaluatedExpression | undefined} evaluation result - */ - evaluateExpression(expression) { - try { - const hook = this.hooks.evaluate.get(expression.type); - if (hook !== undefined) { - const result = hook.call(expression); - if (result !== undefined) { - if (result) { - result.setExpression(expression); - } - return result; - } - } - } catch (e) { - console.warn(e); - // ignore error - } - return new BasicEvaluatedExpression() - .setRange(expression.range) - .setExpression(expression); - } + write(this.range); + write(this.valueRange); - parseString(expression) { - switch (expression.type) { - case "BinaryExpression": - if (expression.operator === "+") { - return ( - this.parseString(expression.left) + - this.parseString(expression.right) - ); - } - break; - case "Literal": - return expression.value + ""; - } - throw new Error( - expression.type + " is not supported as parameter for require" - ); + super.serialize(context); } - parseCalculatedString(expression) { - switch (expression.type) { - case "BinaryExpression": - if (expression.operator === "+") { - const left = this.parseCalculatedString(expression.left); - const right = this.parseCalculatedString(expression.right); - if (left.code) { - return { - range: left.range, - value: left.value, - code: true, - conditional: false - }; - } else if (right.code) { - return { - range: [ - left.range[0], - right.range ? right.range[1] : left.range[1] - ], - value: left.value + right.value, - code: true, - conditional: false - }; - } else { - return { - range: [left.range[0], right.range[1]], - value: left.value + right.value, - code: false, - conditional: false - }; - } - } - break; - case "ConditionalExpression": { - const consequent = this.parseCalculatedString(expression.consequent); - const alternate = this.parseCalculatedString(expression.alternate); - const items = []; - if (consequent.conditional) { - items.push(...consequent.conditional); - } else if (!consequent.code) { - items.push(consequent); - } else { - break; - } - if (alternate.conditional) { - items.push(...alternate.conditional); - } else if (!alternate.code) { - items.push(alternate); - } else { - break; - } - return { - range: undefined, - value: "", - code: true, - conditional: items - }; - } - case "Literal": - return { - range: expression.range, - value: expression.value + "", - code: false, - conditional: false - }; - } - return { - range: undefined, - value: "", - code: true, - conditional: false - }; - } + deserialize(context) { + const { read } = context; - /** - * @param {string | Buffer | PreparsedAst} source the source to parse - * @param {ParserState} state the parser state - * @returns {ParserState} the parser state - */ - parse(source, state) { - let ast; - let comments; - const semicolons = new Set(); - if (source === null) { - throw new Error("source must not be null"); - } - if (Buffer.isBuffer(source)) { - source = source.toString("utf-8"); - } - if (typeof source === "object") { - ast = /** @type {ProgramNode} */ (source); - comments = source.comments; - } else { - comments = []; - ast = JavascriptParser._parse(source, { - sourceType: this.sourceType, - onComment: comments, - onInsertedSemicolon: pos => semicolons.add(pos) - }); - } + this.range = read(); + this.valueRange = read(); - const oldScope = this.scope; - const oldState = this.state; - const oldComments = this.comments; - const oldSemicolons = this.semicolons; - const oldStatementPath = this.statementPath; - const oldPrevStatement = this.prevStatement; - this.scope = { - topLevelScope: true, - inTry: false, - inShorthand: false, - isStrict: false, - isAsmJs: false, - definitions: new StackedMap() - }; - /** @type {ParserState} */ - this.state = state; - this.comments = comments; - this.semicolons = semicolons; - this.statementPath = []; - this.prevStatement = undefined; - if (this.hooks.program.call(ast, comments) === undefined) { - this.detectMode(ast.body); - this.preWalkStatements(ast.body); - this.prevStatement = undefined; - this.blockPreWalkStatements(ast.body); - this.prevStatement = undefined; - this.walkStatements(ast.body); - } - this.hooks.finish.call(ast, comments); - this.scope = oldScope; - /** @type {ParserState} */ - this.state = oldState; - this.comments = oldComments; - this.semicolons = oldSemicolons; - this.statementPath = oldStatementPath; - this.prevStatement = oldPrevStatement; - return state; + super.deserialize(context); } +} - evaluate(source) { - const ast = JavascriptParser._parse("(" + source + ")", { - sourceType: this.sourceType, - locations: false - }); - if (ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement") { - throw new Error("evaluate: Source is not a expression"); - } - return this.evaluateExpression(ast.body[0].expression); - } +makeSerializable( + RequireResolveContextDependency, + "webpack/lib/dependencies/RequireResolveContextDependency" +); - /** - * @param {ExpressionNode | DeclarationNode | PrivateIdentifierNode | null | undefined} expr an expression - * @param {number} commentsStartPos source position from which annotation comments are checked - * @returns {boolean} true, when the expression is pure - */ - isPure(expr, commentsStartPos) { - if (!expr) return true; - const result = this.hooks.isPure - .for(expr.type) - .call(expr, commentsStartPos); - if (typeof result === "boolean") return result; - switch (expr.type) { - case "ClassDeclaration": - case "ClassExpression": { - if (expr.body.type !== "ClassBody") return false; - if (expr.superClass && !this.isPure(expr.superClass, expr.range[0])) { - return false; - } - const items = - /** @type {(MethodDefinitionNode | PropertyDefinitionNode)[]} */ ( - expr.body.body - ); - return items.every( - item => - (!item.computed || - !item.key || - this.isPure(item.key, item.range[0])) && - (!item.static || - !item.value || - this.isPure( - item.value, - item.key ? item.key.range[1] : item.range[0] - )) - ); - } +RequireResolveContextDependency.Template = ContextDependencyTemplateAsId; - case "FunctionDeclaration": - case "FunctionExpression": - case "ArrowFunctionExpression": - case "Literal": - case "PrivateIdentifier": - return true; +module.exports = RequireResolveContextDependency; - case "VariableDeclaration": - return expr.declarations.every(decl => - this.isPure(decl.init, decl.range[0]) - ); - case "ConditionalExpression": - return ( - this.isPure(expr.test, commentsStartPos) && - this.isPure(expr.consequent, expr.test.range[1]) && - this.isPure(expr.alternate, expr.consequent.range[1]) - ); +/***/ }), + +/***/ 68582: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const Dependency = __webpack_require__(54912); +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); +const ModuleDependencyAsId = __webpack_require__(80825); + +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - case "SequenceExpression": - return expr.expressions.every(expr => { - const pureFlag = this.isPure(expr, commentsStartPos); - commentsStartPos = expr.range[1]; - return pureFlag; - }); +class RequireResolveDependency extends ModuleDependency { + constructor(request, range) { + super(request); - case "CallExpression": { - const pureFlag = - expr.range[0] - commentsStartPos > 12 && - this.getComments([commentsStartPos, expr.range[0]]).some( - comment => - comment.type === "Block" && - /^\s*(#|@)__PURE__\s*$/.test(comment.value) - ); - if (!pureFlag) return false; - commentsStartPos = expr.callee.range[1]; - return expr.arguments.every(arg => { - if (arg.type === "SpreadElement") return false; - const pureFlag = this.isPure(arg, commentsStartPos); - commentsStartPos = arg.range[1]; - return pureFlag; - }); - } - } - const evaluated = this.evaluateExpression(expr); - return !evaluated.couldHaveSideEffects(); + this.range = range; } - getComments(range) { - const [rangeStart, rangeEnd] = range; - const compare = (comment, needle) => comment.range[0] - needle; - let idx = binarySearchBounds.ge(this.comments, rangeStart, compare); - let commentsInRange = []; - while (this.comments[idx] && this.comments[idx].range[1] <= rangeEnd) { - commentsInRange.push(this.comments[idx]); - idx++; - } - - return commentsInRange; + get type() { + return "require.resolve"; } - /** - * @param {number} pos source code position - * @returns {boolean} true when a semicolon has been inserted before this position, false if not - */ - isAsiPosition(pos) { - const currentStatement = this.statementPath[this.statementPath.length - 1]; - if (currentStatement === undefined) throw new Error("Not in statement"); - return ( - // Either asking directly for the end position of the current statement - (currentStatement.range[1] === pos && this.semicolons.has(pos)) || - // Or asking for the start position of the current statement, - // here we have to check multiple things - (currentStatement.range[0] === pos && - // is there a previous statement which might be relevant? - this.prevStatement !== undefined && - // is the end position of the previous statement an ASI position? - this.semicolons.has(this.prevStatement.range[1])) - ); + get category() { + return "commonjs"; } /** - * @param {number} pos source code position - * @returns {void} + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports */ - unsetAsiPosition(pos) { - this.semicolons.delete(pos); + getReferencedExports(moduleGraph, runtime) { + // This doesn't use any export + return Dependency.NO_EXPORTS_REFERENCED; } +} - isStatementLevelExpression(expr) { - const currentStatement = this.statementPath[this.statementPath.length - 1]; - return ( - expr === currentStatement || - (currentStatement.type === "ExpressionStatement" && - currentStatement.expression === expr) - ); - } +makeSerializable( + RequireResolveDependency, + "webpack/lib/dependencies/RequireResolveDependency" +); - getTagData(name, tag) { - const info = this.scope.definitions.get(name); - if (info instanceof VariableInfo) { - let tagInfo = info.tagInfo; - while (tagInfo !== undefined) { - if (tagInfo.tag === tag) return tagInfo.data; - tagInfo = tagInfo.next; - } - } - } +RequireResolveDependency.Template = ModuleDependencyAsId; - tagVariable(name, tag, data) { - const oldInfo = this.scope.definitions.get(name); - /** @type {VariableInfo} */ - let newInfo; - if (oldInfo === undefined) { - newInfo = new VariableInfo(this.scope, name, { - tag, - data, - next: undefined - }); - } else if (oldInfo instanceof VariableInfo) { - newInfo = new VariableInfo(oldInfo.declaredScope, oldInfo.freeName, { - tag, - data, - next: oldInfo.tagInfo - }); - } else { - newInfo = new VariableInfo(oldInfo, true, { - tag, - data, - next: undefined - }); - } - this.scope.definitions.set(name, newInfo); - } +module.exports = RequireResolveDependency; - defineVariable(name) { - const oldInfo = this.scope.definitions.get(name); - // Don't redefine variable in same scope to keep existing tags - if (oldInfo instanceof VariableInfo && oldInfo.declaredScope === this.scope) - return; - this.scope.definitions.set(name, this.scope); - } - undefineVariable(name) { - this.scope.definitions.delete(name); +/***/ }), + +/***/ 9880: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + +class RequireResolveHeaderDependency extends NullDependency { + constructor(range) { + super(); + + if (!Array.isArray(range)) throw new Error("range must be valid"); + + this.range = range; } - isVariableDefined(name) { - const info = this.scope.definitions.get(name); - if (info === undefined) return false; - if (info instanceof VariableInfo) { - return info.freeName === true; - } - return true; + serialize(context) { + const { write } = context; + + write(this.range); + + super.serialize(context); } - /** - * @param {string} name variable name - * @returns {ExportedVariableInfo} info for this variable - */ - getVariableInfo(name) { - const value = this.scope.definitions.get(name); - if (value === undefined) { - return name; - } else { - return value; - } + static deserialize(context) { + const obj = new RequireResolveHeaderDependency(context.read()); + obj.deserialize(context); + return obj; } +} + +makeSerializable( + RequireResolveHeaderDependency, + "webpack/lib/dependencies/RequireResolveHeaderDependency" +); +RequireResolveHeaderDependency.Template = class RequireResolveHeaderDependencyTemplate extends ( + NullDependency.Template +) { /** - * @param {string} name variable name - * @param {ExportedVariableInfo} variableInfo new info for this variable + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - setVariable(name, variableInfo) { - if (typeof variableInfo === "string") { - if (variableInfo === name) { - this.scope.definitions.delete(name); - } else { - this.scope.definitions.set( - name, - new VariableInfo(this.scope, variableInfo, undefined) - ); - } - } else { - this.scope.definitions.set(name, variableInfo); - } + apply(dependency, source, templateContext) { + const dep = /** @type {RequireResolveHeaderDependency} */ (dependency); + source.replace(dep.range[0], dep.range[1] - 1, "/*require.resolve*/"); } - parseCommentOptions(range) { - const comments = this.getComments(range); - if (comments.length === 0) { - return EMPTY_COMMENT_OPTIONS; - } - let options = {}; - let errors = []; - for (const comment of comments) { - const { value } = comment; - if (value && webpackCommentRegExp.test(value)) { - // try compile only if webpack options comment is present - try { - const val = vm.runInNewContext(`(function(){return {${value}};})()`); - Object.assign(options, val); - } catch (e) { - e.comment = comment; - errors.push(e); - } - } - } - return { options, errors }; + applyAsTemplateArgument(name, dep, source) { + source.replace(dep.range[0], dep.range[1] - 1, "/*require.resolve*/"); } +}; + +module.exports = RequireResolveHeaderDependency; + + +/***/ }), + +/***/ 24187: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/Hash")} Hash */ +class RuntimeRequirementsDependency extends NullDependency { /** - * @param {MemberExpressionNode} expression a member expression - * @returns {{ members: string[], object: ExpressionNode | SuperNode }} member names (reverse order) and remaining object + * @param {string[]} runtimeRequirements runtime requirements */ - extractMemberExpressionChain(expression) { - /** @type {AnyNode} */ - let expr = expression; - const members = []; - while (expr.type === "MemberExpression") { - if (expr.computed) { - if (expr.property.type !== "Literal") break; - members.push(`${expr.property.value}`); - } else { - if (expr.property.type !== "Identifier") break; - members.push(expr.property.name); - } - expr = expr.object; - } - return { - members, - object: expr - }; + constructor(runtimeRequirements) { + super(); + this.runtimeRequirements = new Set(runtimeRequirements); + this._hashUpdate = undefined; } /** - * @param {string} varName variable name - * @returns {{name: string, info: VariableInfo | string}} name of the free variable and variable info for that + * Update the hash + * @param {Hash} hash hash to be updated + * @param {UpdateHashContext} context context + * @returns {void} */ - getFreeInfoFromVariable(varName) { - const info = this.getVariableInfo(varName); - let name; - if (info instanceof VariableInfo) { - name = info.freeName; - if (typeof name !== "string") return undefined; - } else if (typeof info !== "string") { - return undefined; - } else { - name = info; + updateHash(hash, context) { + if (this._hashUpdate === undefined) { + this._hashUpdate = Array.from(this.runtimeRequirements).join() + ""; } - return { info, name }; + hash.update(this._hashUpdate); } - /** @typedef {{ type: "call", call: CallExpressionNode, calleeName: string, rootInfo: string | VariableInfo, getCalleeMembers: () => string[], name: string, getMembers: () => string[]}} CallExpressionInfo */ - /** @typedef {{ type: "expression", rootInfo: string | VariableInfo, name: string, getMembers: () => string[]}} ExpressionExpressionInfo */ - - /** - * @param {MemberExpressionNode} expression a member expression - * @param {number} allowedTypes which types should be returned, presented in bit mask - * @returns {CallExpressionInfo | ExpressionExpressionInfo | undefined} expression info - */ - getMemberExpressionInfo(expression, allowedTypes) { - const { object, members } = this.extractMemberExpressionChain(expression); - switch (object.type) { - case "CallExpression": { - if ((allowedTypes & ALLOWED_MEMBER_TYPES_CALL_EXPRESSION) === 0) - return undefined; - let callee = object.callee; - let rootMembers = EMPTY_ARRAY; - if (callee.type === "MemberExpression") { - ({ object: callee, members: rootMembers } = - this.extractMemberExpressionChain(callee)); - } - const rootName = getRootName(callee); - if (!rootName) return undefined; - const result = this.getFreeInfoFromVariable(rootName); - if (!result) return undefined; - const { info: rootInfo, name: resolvedRoot } = result; - const calleeName = objectAndMembersToName(resolvedRoot, rootMembers); - return { - type: "call", - call: object, - calleeName, - rootInfo, - getCalleeMembers: memoize(() => rootMembers.reverse()), - name: objectAndMembersToName(`${calleeName}()`, members), - getMembers: memoize(() => members.reverse()) - }; - } - case "Identifier": - case "MetaProperty": - case "ThisExpression": { - if ((allowedTypes & ALLOWED_MEMBER_TYPES_EXPRESSION) === 0) - return undefined; - const rootName = getRootName(object); - if (!rootName) return undefined; - - const result = this.getFreeInfoFromVariable(rootName); - if (!result) return undefined; - const { info: rootInfo, name: resolvedRoot } = result; - return { - type: "expression", - name: objectAndMembersToName(resolvedRoot, members), - rootInfo, - getMembers: memoize(() => members.reverse()) - }; - } - } + serialize(context) { + const { write } = context; + write(this.runtimeRequirements); + super.serialize(context); } - /** - * @param {MemberExpressionNode} expression an expression - * @returns {{ name: string, rootInfo: ExportedVariableInfo, getMembers: () => string[]}} name info - */ - getNameForExpression(expression) { - return this.getMemberExpressionInfo( - expression, - ALLOWED_MEMBER_TYPES_EXPRESSION - ); + deserialize(context) { + const { read } = context; + this.runtimeRequirements = read(); + super.deserialize(context); } +} + +makeSerializable( + RuntimeRequirementsDependency, + "webpack/lib/dependencies/RuntimeRequirementsDependency" +); +RuntimeRequirementsDependency.Template = class RuntimeRequirementsDependencyTemplate extends ( + NullDependency.Template +) { /** - * @param {string} code source code - * @param {ParseOptions} options parsing options - * @returns {ProgramNode} parsed ast + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - static _parse(code, options) { - const type = options ? options.sourceType : "module"; - /** @type {AcornOptions} */ - const parserOptions = { - ...defaultParserOptions, - allowReturnOutsideFunction: type === "script", - ...options, - sourceType: type === "auto" ? "module" : type - }; - - /** @type {AnyNode} */ - let ast; - let error; - let threw = false; - try { - ast = /** @type {AnyNode} */ (parser.parse(code, parserOptions)); - } catch (e) { - error = e; - threw = true; - } - - if (threw && type === "auto") { - parserOptions.sourceType = "script"; - if (!("allowReturnOutsideFunction" in options)) { - parserOptions.allowReturnOutsideFunction = true; - } - if (Array.isArray(parserOptions.onComment)) { - parserOptions.onComment.length = 0; - } - try { - ast = /** @type {AnyNode} */ (parser.parse(code, parserOptions)); - threw = false; - } catch (e) { - // we use the error from first parse try - // so nothing to do here - } - } - - if (threw) { - throw error; + apply(dependency, source, { runtimeRequirements }) { + const dep = /** @type {RuntimeRequirementsDependency} */ (dependency); + for (const req of dep.runtimeRequirements) { + runtimeRequirements.add(req); } - - return /** @type {ProgramNode} */ (ast); } -} +}; -module.exports = JavascriptParser; -module.exports.ALLOWED_MEMBER_TYPES_ALL = ALLOWED_MEMBER_TYPES_ALL; -module.exports.ALLOWED_MEMBER_TYPES_EXPRESSION = - ALLOWED_MEMBER_TYPES_EXPRESSION; -module.exports.ALLOWED_MEMBER_TYPES_CALL_EXPRESSION = - ALLOWED_MEMBER_TYPES_CALL_EXPRESSION; +module.exports = RuntimeRequirementsDependency; /***/ }), -/***/ 93998: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 91418: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -94953,112 +90771,71 @@ module.exports.ALLOWED_MEMBER_TYPES_CALL_EXPRESSION = -const UnsupportedFeatureWarning = __webpack_require__(42495); -const ConstDependency = __webpack_require__(76911); -const BasicEvaluatedExpression = __webpack_require__(950); - -/** @typedef {import("estree").Expression} ExpressionNode */ -/** @typedef {import("estree").Node} Node */ -/** @typedef {import("./JavascriptParser")} JavascriptParser */ - -/** - * @param {JavascriptParser} parser the parser - * @param {string} value the const value - * @param {string[]=} runtimeRequirements runtime requirements - * @returns {function(ExpressionNode): true} plugin function - */ -exports.toConstantDependency = (parser, value, runtimeRequirements) => { - return function constDependency(expr) { - const dep = new ConstDependency(value, expr.range, runtimeRequirements); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }; -}; +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); -/** - * @param {string} value the string value - * @returns {function(ExpressionNode): BasicEvaluatedExpression} plugin function - */ -exports.evaluateToString = value => { - return function stringExpression(expr) { - return new BasicEvaluatedExpression().setString(value).setRange(expr.range); - }; -}; +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency").ExportSpec} ExportSpec */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/Hash")} Hash */ -/** - * @param {number} value the number value - * @returns {function(ExpressionNode): BasicEvaluatedExpression} plugin function - */ -exports.evaluateToNumber = value => { - return function stringExpression(expr) { - return new BasicEvaluatedExpression().setNumber(value).setRange(expr.range); - }; -}; +class StaticExportsDependency extends NullDependency { + /** + * @param {string[] | true} exports export names + * @param {boolean} canMangle true, if mangling exports names is allowed + */ + constructor(exports, canMangle) { + super(); + this.exports = exports; + this.canMangle = canMangle; + } -/** - * @param {boolean} value the boolean value - * @returns {function(ExpressionNode): BasicEvaluatedExpression} plugin function - */ -exports.evaluateToBoolean = value => { - return function booleanExpression(expr) { - return new BasicEvaluatedExpression() - .setBoolean(value) - .setRange(expr.range); - }; -}; + get type() { + return "static exports"; + } -/** - * @param {string} identifier identifier - * @param {string} rootInfo rootInfo - * @param {function(): string[]} getMembers getMembers - * @param {boolean|null=} truthy is truthy, null if nullish - * @returns {function(ExpressionNode): BasicEvaluatedExpression} callback - */ -exports.evaluateToIdentifier = (identifier, rootInfo, getMembers, truthy) => { - return function identifierExpression(expr) { - let evaluatedExpression = new BasicEvaluatedExpression() - .setIdentifier(identifier, rootInfo, getMembers) - .setSideEffects(false) - .setRange(expr.range); - switch (truthy) { - case true: - evaluatedExpression.setTruthy(); - break; - case null: - evaluatedExpression.setNullish(true); - break; - case false: - evaluatedExpression.setFalsy(); - break; - } + /** + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names + */ + getExports(moduleGraph) { + return { + exports: this.exports, + canMangle: this.canMangle, + dependencies: undefined + }; + } - return evaluatedExpression; - }; -}; + serialize(context) { + const { write } = context; + write(this.exports); + write(this.canMangle); + super.serialize(context); + } -exports.expressionIsUnsupported = (parser, message) => { - return function unsupportedExpression(expr) { - const dep = new ConstDependency("(void 0)", expr.range, null); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - if (!parser.state.module) return; - parser.state.module.addWarning( - new UnsupportedFeatureWarning(message, expr.loc) - ); - return true; - }; -}; + deserialize(context) { + const { read } = context; + this.exports = read(); + this.canMangle = read(); + super.deserialize(context); + } +} -exports.skipTraversal = () => true; +makeSerializable( + StaticExportsDependency, + "webpack/lib/dependencies/StaticExportsDependency" +); -exports.approve = () => true; +module.exports = StaticExportsDependency; /***/ }), -/***/ 98124: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 97981: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -95069,506 +90846,474 @@ exports.approve = () => true; const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const { isSubset } = __webpack_require__(93347); -const { getAllChunks } = __webpack_require__(91145); +const WebpackError = __webpack_require__(53799); +const { + evaluateToString, + expressionIsUnsupported, + toConstantDependency +} = __webpack_require__(93998); +const makeSerializable = __webpack_require__(33032); +const ConstDependency = __webpack_require__(76911); +const SystemRuntimeModule = __webpack_require__(85439); -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../ChunkGraph").EntryModuleWithChunkGroup} EntryModuleWithChunkGroup */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {(string|number)[]} EntryItem */ +/** @typedef {import("../Compiler")} Compiler */ -const EXPORT_PREFIX = "var __webpack_exports__ = "; +class SystemPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "SystemPlugin", + (compilation, { normalModuleFactory }) => { + compilation.hooks.runtimeRequirementInModule + .for(RuntimeGlobals.system) + .tap("SystemPlugin", (module, set) => { + set.add(RuntimeGlobals.requireScope); + }); -/** - * @param {ChunkGraph} chunkGraph chunkGraph - * @param {RuntimeTemplate} runtimeTemplate runtimeTemplate - * @param {EntryModuleWithChunkGroup[]} entries entries - * @param {Chunk} chunk chunk - * @param {boolean} passive true: passive startup with on chunks loaded - * @returns {string} runtime code - */ -exports.generateEntryStartup = ( - chunkGraph, - runtimeTemplate, - entries, - chunk, - passive -) => { - /** @type {string[]} */ - const runtime = [ - `var __webpack_exec__ = ${runtimeTemplate.returningFunction( - `__webpack_require__(${RuntimeGlobals.entryModuleId} = moduleId)`, - "moduleId" - )}` - ]; + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.system) + .tap("SystemPlugin", (chunk, set) => { + compilation.addRuntimeModule(chunk, new SystemRuntimeModule()); + }); - const runModule = id => { - return `__webpack_exec__(${JSON.stringify(id)})`; - }; - const outputCombination = (chunks, moduleIds, final) => { - if (chunks.size === 0) { - runtime.push( - `${final ? EXPORT_PREFIX : ""}(${moduleIds.map(runModule).join(", ")});` - ); - } else { - const fn = runtimeTemplate.returningFunction( - moduleIds.map(runModule).join(", ") - ); - runtime.push( - `${final && !passive ? EXPORT_PREFIX : ""}${ - passive - ? RuntimeGlobals.onChunksLoaded - : RuntimeGlobals.startupEntrypoint - }(0, ${JSON.stringify(Array.from(chunks, c => c.id))}, ${fn});` - ); - if (final && passive) { - runtime.push(`${EXPORT_PREFIX}${RuntimeGlobals.onChunksLoaded}();`); - } - } - }; + const handler = (parser, parserOptions) => { + if (parserOptions.system === undefined || !parserOptions.system) { + return; + } - let currentChunks = undefined; - let currentModuleIds = undefined; + const setNotSupported = name => { + parser.hooks.evaluateTypeof + .for(name) + .tap("SystemPlugin", evaluateToString("undefined")); + parser.hooks.expression + .for(name) + .tap( + "SystemPlugin", + expressionIsUnsupported( + parser, + name + " is not supported by webpack." + ) + ); + }; - for (const [module, entrypoint] of entries) { - const runtimeChunk = entrypoint.getRuntimeChunk(); - const moduleId = chunkGraph.getModuleId(module); - const chunks = getAllChunks(entrypoint, chunk, runtimeChunk); - if ( - currentChunks && - currentChunks.size === chunks.size && - isSubset(currentChunks, chunks) - ) { - currentModuleIds.push(moduleId); - } else { - if (currentChunks) { - outputCombination(currentChunks, currentModuleIds); + parser.hooks.typeof + .for("System.import") + .tap( + "SystemPlugin", + toConstantDependency(parser, JSON.stringify("function")) + ); + parser.hooks.evaluateTypeof + .for("System.import") + .tap("SystemPlugin", evaluateToString("function")); + parser.hooks.typeof + .for("System") + .tap( + "SystemPlugin", + toConstantDependency(parser, JSON.stringify("object")) + ); + parser.hooks.evaluateTypeof + .for("System") + .tap("SystemPlugin", evaluateToString("object")); + + setNotSupported("System.set"); + setNotSupported("System.get"); + setNotSupported("System.register"); + + parser.hooks.expression.for("System").tap("SystemPlugin", expr => { + const dep = new ConstDependency(RuntimeGlobals.system, expr.range, [ + RuntimeGlobals.system + ]); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + + parser.hooks.call.for("System.import").tap("SystemPlugin", expr => { + parser.state.module.addWarning( + new SystemImportDeprecationWarning(expr.loc) + ); + + return parser.hooks.importCall.call({ + type: "ImportExpression", + source: expr.arguments[0], + loc: expr.loc, + range: expr.range + }); + }); + }; + + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("SystemPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("SystemPlugin", handler); } - currentChunks = chunks; - currentModuleIds = [moduleId]; - } + ); } +} - // output current modules with export prefix - if (currentChunks) { - outputCombination(currentChunks, currentModuleIds, true); - } - runtime.push(""); - return Template.asString(runtime); -}; +class SystemImportDeprecationWarning extends WebpackError { + constructor(loc) { + super( + "System.import() is deprecated and will be removed soon. Use import() instead.\n" + + "For more info visit https://webpack.js.org/guides/code-splitting/" + ); -/** - * @param {Hash} hash the hash to update - * @param {ChunkGraph} chunkGraph chunkGraph - * @param {EntryModuleWithChunkGroup[]} entries entries - * @param {Chunk} chunk chunk - * @returns {void} - */ -exports.updateHashForEntryStartup = (hash, chunkGraph, entries, chunk) => { - for (const [module, entrypoint] of entries) { - const runtimeChunk = entrypoint.getRuntimeChunk(); - const moduleId = chunkGraph.getModuleId(module); - hash.update(`${moduleId}`); - for (const c of getAllChunks(entrypoint, chunk, runtimeChunk)) - hash.update(`${c.id}`); - } -}; + this.name = "SystemImportDeprecationWarning"; -/** - * @param {Chunk} chunk the chunk - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {function(Chunk, ChunkGraph): boolean} filterFn filter function - * @returns {Set} initially fulfilled chunk ids - */ -exports.getInitialChunkIds = (chunk, chunkGraph, filterFn) => { - const initialChunkIds = new Set(chunk.ids); - for (const c of chunk.getAllInitialChunks()) { - if (c === chunk || filterFn(c, chunkGraph)) continue; - for (const id of c.ids) initialChunkIds.add(id); + this.loc = loc; } - return initialChunkIds; -}; +} + +makeSerializable( + SystemImportDeprecationWarning, + "webpack/lib/dependencies/SystemPlugin", + "SystemImportDeprecationWarning" +); + +module.exports = SystemPlugin; +module.exports.SystemImportDeprecationWarning = SystemImportDeprecationWarning; /***/ }), -/***/ 90490: +/***/ 85439: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Florent Cailhol @ooflorent */ -const { register } = __webpack_require__(8282); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); -class JsonData { - constructor(data) { - this._buffer = undefined; - this._data = undefined; - if (Buffer.isBuffer(data)) { - this._buffer = data; - } else { - this._data = data; - } +class SystemRuntimeModule extends RuntimeModule { + constructor() { + super("system"); } - get() { - if (this._data === undefined && this._buffer !== undefined) { - this._data = JSON.parse(this._buffer.toString()); - } - return this._data; + /** + * @returns {string} runtime code + */ + generate() { + return Template.asString([ + `${RuntimeGlobals.system} = {`, + Template.indent([ + "import: function () {", + Template.indent( + "throw new Error('System.import cannot be used indirectly');" + ), + "}" + ]), + "};" + ]); } } -register(JsonData, "webpack/lib/json/JsonData", null, { - serialize(obj, { write }) { - if (obj._buffer === undefined && obj._data !== undefined) { - obj._buffer = Buffer.from(JSON.stringify(obj._data)); - } - write(obj._buffer); - }, - deserialize({ read }) { - return new JsonData(read()); - } -}); - -module.exports = JsonData; +module.exports = SystemRuntimeModule; /***/ }), -/***/ 70393: +/***/ 58612: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ -const { RawSource } = __webpack_require__(51255); -const ConcatenationScope = __webpack_require__(98229); -const { UsageState } = __webpack_require__(63686); -const Generator = __webpack_require__(93401); const RuntimeGlobals = __webpack_require__(16475); +const { + getDependencyUsedByExportsCondition +} = __webpack_require__(38988); +const makeSerializable = __webpack_require__(33032); +const memoize = __webpack_require__(78676); +const ModuleDependency = __webpack_require__(80321); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../ExportsInfo")} ExportsInfo */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ -/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../util/Hash")} Hash */ /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -const stringifySafe = data => { - const stringified = JSON.stringify(data); - if (!stringified) { - return undefined; // Invalid JSON - } - - return stringified.replace(/\u2028|\u2029/g, str => - str === "\u2029" ? "\\u2029" : "\\u2028" - ); // invalid in JavaScript but valid JSON -}; - -/** - * @param {Object} data data (always an object or array) - * @param {ExportsInfo} exportsInfo exports info - * @param {RuntimeSpec} runtime the runtime - * @returns {Object} reduced data - */ -const createObjectForExportsInfo = (data, exportsInfo, runtime) => { - if (exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused) - return data; - const isArray = Array.isArray(data); - const reducedData = isArray ? [] : {}; - for (const key of Object.keys(data)) { - const exportInfo = exportsInfo.getReadOnlyExportInfo(key); - const used = exportInfo.getUsed(runtime); - if (used === UsageState.Unused) continue; - - let value; - if (used === UsageState.OnlyPropertiesUsed && exportInfo.exportsInfo) { - value = createObjectForExportsInfo( - data[key], - exportInfo.exportsInfo, - runtime - ); - } else { - value = data[key]; - } - const name = exportInfo.getUsedName(key, runtime); - reducedData[name] = value; - } - if (isArray) { - let arrayLengthWhenUsed = - exportsInfo.getReadOnlyExportInfo("length").getUsed(runtime) !== - UsageState.Unused - ? data.length - : undefined; +const getRawDataUrlModule = memoize(() => __webpack_require__(19684)); - let sizeObjectMinusArray = 0; - for (let i = 0; i < reducedData.length; i++) { - if (reducedData[i] === undefined) { - sizeObjectMinusArray -= 2; - } else { - sizeObjectMinusArray += `${i}`.length + 3; - } - } - if (arrayLengthWhenUsed !== undefined) { - sizeObjectMinusArray += - `${arrayLengthWhenUsed}`.length + - 8 - - (arrayLengthWhenUsed - reducedData.length) * 2; - } - if (sizeObjectMinusArray < 0) - return Object.assign( - arrayLengthWhenUsed === undefined - ? {} - : { length: arrayLengthWhenUsed }, - reducedData - ); - const generatedLength = - arrayLengthWhenUsed !== undefined - ? Math.max(arrayLengthWhenUsed, reducedData.length) - : reducedData.length; - for (let i = 0; i < generatedLength; i++) { - if (reducedData[i] === undefined) { - reducedData[i] = 0; - } - } +class URLDependency extends ModuleDependency { + /** + * @param {string} request request + * @param {[number, number]} range range of the arguments of new URL( |> ... <| ) + * @param {[number, number]} outerRange range of the full |> new URL(...) <| + * @param {boolean=} relative use relative urls instead of absolute with base uri + */ + constructor(request, range, outerRange, relative) { + super(request); + this.range = range; + this.outerRange = outerRange; + this.relative = relative || false; + /** @type {Set | boolean} */ + this.usedByExports = undefined; } - return reducedData; -}; -const TYPES = new Set(["javascript"]); + get type() { + return "new URL()"; + } -class JsonGenerator extends Generator { - /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) - */ - getTypes(module) { - return TYPES; + get category() { + return "url"; } /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module + * @param {ModuleGraph} moduleGraph module graph + * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active */ - getSize(module, type) { - let data = - module.buildInfo && - module.buildInfo.jsonData && - module.buildInfo.jsonData.get(); - if (!data) return 0; - return stringifySafe(data).length + 10; + getCondition(moduleGraph) { + return getDependencyUsedByExportsCondition( + this, + this.usedByExports, + moduleGraph + ); } /** - * @param {NormalModule} module module for which the bailout reason should be determined - * @param {ConcatenationBailoutReasonContext} context context - * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated + * @param {string} context context directory + * @returns {Module} a module */ - getConcatenationBailoutReason(module, context) { - return undefined; + createIgnoredModule(context) { + const RawDataUrlModule = getRawDataUrlModule(); + return new RawDataUrlModule("data:,", `ignored-asset`, `(ignored asset)`); + } + + serialize(context) { + const { write } = context; + write(this.outerRange); + write(this.relative); + write(this.usedByExports); + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + this.outerRange = read(); + this.relative = read(); + this.usedByExports = read(); + super.deserialize(context); } +} +URLDependency.Template = class URLDependencyTemplate extends ( + ModuleDependency.Template +) { /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - generate( - module, - { + apply(dependency, source, templateContext) { + const { + chunkGraph, moduleGraph, - runtimeTemplate, runtimeRequirements, - runtime, - concatenationScope - } - ) { - const data = - module.buildInfo && - module.buildInfo.jsonData && - module.buildInfo.jsonData.get(); - if (data === undefined) { - return new RawSource( - runtimeTemplate.missingModuleStatement({ - request: module.rawRequest - }) + runtimeTemplate, + runtime + } = templateContext; + const dep = /** @type {URLDependency} */ (dependency); + const connection = moduleGraph.getConnection(dep); + // Skip rendering depending when dependency is conditional + if (connection && !connection.isTargetActive(runtime)) { + source.replace( + dep.outerRange[0], + dep.outerRange[1] - 1, + "/* unused asset import */ undefined" ); + return; } - const exportsInfo = moduleGraph.getExportsInfo(module); - let finalJson = - typeof data === "object" && - data && - exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused - ? createObjectForExportsInfo(data, exportsInfo, runtime) - : data; - // Use JSON because JSON.parse() is much faster than JavaScript evaluation - const jsonStr = stringifySafe(finalJson); - const jsonExpr = - jsonStr.length > 20 && typeof finalJson === "object" - ? `JSON.parse('${jsonStr.replace(/[\\']/g, "\\$&")}')` - : jsonStr; - let content; - if (concatenationScope) { - content = `${runtimeTemplate.supportsConst() ? "const" : "var"} ${ - ConcatenationScope.NAMESPACE_OBJECT_EXPORT - } = ${jsonExpr};`; - concatenationScope.registerNamespaceExport( - ConcatenationScope.NAMESPACE_OBJECT_EXPORT + + runtimeRequirements.add(RuntimeGlobals.require); + + if (dep.relative) { + runtimeRequirements.add(RuntimeGlobals.relativeUrl); + source.replace( + dep.outerRange[0], + dep.outerRange[1] - 1, + `/* asset import */ new ${ + RuntimeGlobals.relativeUrl + }(${runtimeTemplate.moduleRaw({ + chunkGraph, + module: moduleGraph.getModule(dep), + request: dep.request, + runtimeRequirements, + weak: false + })})` ); } else { - runtimeRequirements.add(RuntimeGlobals.module); - content = `${module.moduleArgument}.exports = ${jsonExpr};`; + runtimeRequirements.add(RuntimeGlobals.baseURI); + + source.replace( + dep.range[0], + dep.range[1] - 1, + `/* asset import */ ${runtimeTemplate.moduleRaw({ + chunkGraph, + module: moduleGraph.getModule(dep), + request: dep.request, + runtimeRequirements, + weak: false + })}, ${RuntimeGlobals.baseURI}` + ); } - return new RawSource(content); } -} +}; -module.exports = JsonGenerator; +makeSerializable(URLDependency, "webpack/lib/dependencies/URLDependency"); + +module.exports = URLDependency; /***/ }), -/***/ 86770: +/***/ 14412: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ -const createSchemaValidation = __webpack_require__(32540); -const JsonGenerator = __webpack_require__(70393); -const JsonParser = __webpack_require__(41090); +const { approve } = __webpack_require__(93998); +const InnerGraph = __webpack_require__(38988); +const URLDependency = __webpack_require__(58612); +/** @typedef {import("estree").NewExpression} NewExpressionNode */ /** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ -const validate = createSchemaValidation( - __webpack_require__(54094), - () => __webpack_require__(50166), - { - name: "Json Modules Plugin", - baseDataPath: "parser" - } -); - -class JsonModulesPlugin { +class URLPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {Compiler} compiler compiler */ apply(compiler) { compiler.hooks.compilation.tap( - "JsonModulesPlugin", + "URLPlugin", (compilation, { normalModuleFactory }) => { - normalModuleFactory.hooks.createParser - .for("json") - .tap("JsonModulesPlugin", parserOptions => { - validate(parserOptions); + compilation.dependencyFactories.set(URLDependency, normalModuleFactory); + compilation.dependencyTemplates.set( + URLDependency, + new URLDependency.Template() + ); - return new JsonParser(parserOptions); - }); - normalModuleFactory.hooks.createGenerator - .for("json") - .tap("JsonModulesPlugin", () => { - return new JsonGenerator(); - }); - } - ); - } -} + /** + * @param {JavascriptParser} parser parser + * @param {object} parserOptions options + */ + const parserCallback = (parser, parserOptions) => { + if (parserOptions.url === false) return; + const relative = parserOptions.url === "relative"; -module.exports = JsonModulesPlugin; + /** + * @param {NewExpressionNode} expr expression + * @returns {undefined | string} request + */ + const getUrlRequest = expr => { + if (expr.arguments.length !== 2) return; + const [arg1, arg2] = expr.arguments; -/***/ }), + if ( + arg2.type !== "MemberExpression" || + arg1.type === "SpreadElement" + ) + return; -/***/ 41090: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + const chain = parser.extractMemberExpressionChain(arg2); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if ( + chain.members.length !== 1 || + chain.object.type !== "MetaProperty" || + chain.object.meta.name !== "import" || + chain.object.property.name !== "meta" || + chain.members[0] !== "url" + ) + return; + const request = parser.evaluateExpression(arg1).asString(); + return request; + }; -const parseJson = __webpack_require__(15235); -const Parser = __webpack_require__(11715); -const JsonExportsDependency = __webpack_require__(750); -const JsonData = __webpack_require__(90490); + parser.hooks.canRename.for("URL").tap("URLPlugin", approve); + parser.hooks.new.for("URL").tap("URLPlugin", _expr => { + const expr = /** @type {NewExpressionNode} */ (_expr); -/** @typedef {import("../../declarations/plugins/JsonModulesPluginParser").JsonModulesPluginParserOptions} JsonModulesPluginParserOptions */ -/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ + const request = getUrlRequest(expr); -class JsonParser extends Parser { - /** - * @param {JsonModulesPluginParserOptions} options parser options - */ - constructor(options) { - super(); - this.options = options || {}; - } + if (!request) return; - /** - * @param {string | Buffer | PreparsedAst} source the source to parse - * @param {ParserState} state the parser state - * @returns {ParserState} the parser state - */ - parse(source, state) { - if (Buffer.isBuffer(source)) { - source = source.toString("utf-8"); - } + const [arg1, arg2] = expr.arguments; + const dep = new URLDependency( + request, + [arg1.range[0], arg2.range[1]], + expr.range, + relative + ); + dep.loc = expr.loc; + parser.state.current.addDependency(dep); + InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); + return true; + }); + parser.hooks.isPure.for("NewExpression").tap("URLPlugin", _expr => { + const expr = /** @type {NewExpressionNode} */ (_expr); + const { callee } = expr; + if (callee.type !== "Identifier") return; + const calleeInfo = parser.getFreeInfoFromVariable(callee.name); + if (!calleeInfo || calleeInfo.name !== "URL") return; - /** @type {JsonModulesPluginParserOptions["parse"]} */ - const parseFn = - typeof this.options.parse === "function" ? this.options.parse : parseJson; + const request = getUrlRequest(expr); - const data = - typeof source === "object" - ? source - : parseFn(source[0] === "\ufeff" ? source.slice(1) : source); + if (request) return true; + }); + }; - state.module.buildInfo.jsonData = new JsonData(data); - state.module.buildInfo.strict = true; - state.module.buildMeta.exportsType = "default"; - state.module.buildMeta.defaultObject = - typeof data === "object" ? "redirect-warn" : false; - state.module.addDependency( - new JsonExportsDependency(JsonExportsDependency.getExportsFromData(data)) + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("URLPlugin", parserCallback); + + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("URLPlugin", parserCallback); + } ); - return state; } } -module.exports = JsonParser; +module.exports = URLPlugin; /***/ }), -/***/ 26030: +/***/ 51669: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -95579,471 +91324,453 @@ module.exports = JsonParser; -const RuntimeGlobals = __webpack_require__(16475); -const JavascriptModulesPlugin = __webpack_require__(89464); +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */ -/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -const COMMON_LIBRARY_NAME_MESSAGE = - "Common configuration options that specific library names are 'output.library[.name]', 'entry.xyz.library[.name]', 'ModuleFederationPlugin.name' and 'ModuleFederationPlugin.library[.name]'."; +class UnsupportedDependency extends NullDependency { + constructor(request, range) { + super(); -/** - * @template T - * @typedef {Object} LibraryContext - * @property {Compilation} compilation - * @property {ChunkGraph} chunkGraph - * @property {T} options - */ + this.request = request; + this.range = range; + } -/** - * @template T - */ -class AbstractLibraryPlugin { - /** - * @param {Object} options options - * @param {string} options.pluginName name of the plugin - * @param {LibraryType} options.type used library type - */ - constructor({ pluginName, type }) { - this._pluginName = pluginName; - this._type = type; - this._parseCache = new WeakMap(); + serialize(context) { + const { write } = context; + + write(this.request); + write(this.range); + + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + + this.request = read(); + this.range = read(); + + super.deserialize(context); } +} +makeSerializable( + UnsupportedDependency, + "webpack/lib/dependencies/UnsupportedDependency" +); + +UnsupportedDependency.Template = class UnsupportedDependencyTemplate extends ( + NullDependency.Template +) { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply(compiler) { - const { _pluginName } = this; - compiler.hooks.thisCompilation.tap(_pluginName, compilation => { - compilation.hooks.finishModules.tap( - { name: _pluginName, stage: 10 }, - () => { - for (const [ - name, - { - dependencies: deps, - options: { library } - } - ] of compilation.entries) { - const options = this._parseOptionsCached( - library !== undefined - ? library - : compilation.outputOptions.library - ); - if (options !== false) { - const dep = deps[deps.length - 1]; - if (dep) { - const module = compilation.moduleGraph.getModule(dep); - if (module) { - this.finishEntryModule(module, name, { - options, - compilation, - chunkGraph: compilation.chunkGraph - }); - } - } - } - } - } - ); + apply(dependency, source, { runtimeTemplate }) { + const dep = /** @type {UnsupportedDependency} */ (dependency); - const getOptionsForChunk = chunk => { - if (compilation.chunkGraph.getNumberOfEntryModules(chunk) === 0) - return false; - const options = chunk.getEntryOptions(); - const library = options && options.library; - return this._parseOptionsCached( - library !== undefined ? library : compilation.outputOptions.library - ); - }; + source.replace( + dep.range[0], + dep.range[1], + runtimeTemplate.missingModule({ + request: dep.request + }) + ); + } +}; - if ( - this.render !== AbstractLibraryPlugin.prototype.render || - this.runtimeRequirements !== - AbstractLibraryPlugin.prototype.runtimeRequirements - ) { - compilation.hooks.additionalChunkRuntimeRequirements.tap( - _pluginName, - (chunk, set, { chunkGraph }) => { - const options = getOptionsForChunk(chunk); - if (options !== false) { - this.runtimeRequirements(chunk, set, { - options, - compilation, - chunkGraph - }); - } - } - ); - } +module.exports = UnsupportedDependency; - const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); - if (this.render !== AbstractLibraryPlugin.prototype.render) { - hooks.render.tap(_pluginName, (source, renderContext) => { - const options = getOptionsForChunk(renderContext.chunk); - if (options === false) return source; - return this.render(source, renderContext, { - options, - compilation, - chunkGraph: compilation.chunkGraph - }); - }); - } +/***/ }), - if ( - this.embedInRuntimeBailout !== - AbstractLibraryPlugin.prototype.embedInRuntimeBailout - ) { - hooks.embedInRuntimeBailout.tap( - _pluginName, - (module, renderContext) => { - const options = getOptionsForChunk(renderContext.chunk); - if (options === false) return; - return this.embedInRuntimeBailout(module, renderContext, { - options, - compilation, - chunkGraph: compilation.chunkGraph - }); - } - ); - } +/***/ 52204: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if ( - this.strictRuntimeBailout !== - AbstractLibraryPlugin.prototype.strictRuntimeBailout - ) { - hooks.strictRuntimeBailout.tap(_pluginName, renderContext => { - const options = getOptionsForChunk(renderContext.chunk); - if (options === false) return; - return this.strictRuntimeBailout(renderContext, { - options, - compilation, - chunkGraph: compilation.chunkGraph - }); - }); - } - if ( - this.renderStartup !== AbstractLibraryPlugin.prototype.renderStartup - ) { - hooks.renderStartup.tap( - _pluginName, - (source, module, renderContext) => { - const options = getOptionsForChunk(renderContext.chunk); - if (options === false) return source; - return this.renderStartup(source, module, renderContext, { - options, - compilation, - chunkGraph: compilation.chunkGraph - }); - } - ); - } - hooks.chunkHash.tap(_pluginName, (chunk, hash, context) => { - const options = getOptionsForChunk(chunk); - if (options === false) return; - this.chunkHash(chunk, hash, context, { - options, - compilation, - chunkGraph: compilation.chunkGraph - }); - }); - }); +const Dependency = __webpack_require__(54912); +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); + +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + +class WebAssemblyExportImportedDependency extends ModuleDependency { + constructor(exportName, request, name, valueType) { + super(request); + /** @type {string} */ + this.exportName = exportName; + /** @type {string} */ + this.name = name; + /** @type {string} */ + this.valueType = valueType; } /** - * @param {LibraryOptions=} library normalized library option - * @returns {T | false} preprocess as needed by overriding + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module */ - _parseOptionsCached(library) { - if (!library) return false; - if (library.type !== this._type) return false; - const cacheEntry = this._parseCache.get(library); - if (cacheEntry !== undefined) return cacheEntry; - const result = this.parseOptions(library); - this._parseCache.set(library, result); - return result; + couldAffectReferencingModule() { + return Dependency.TRANSITIVE; } - /* istanbul ignore next */ /** - * @abstract - * @param {LibraryOptions} library normalized library option - * @returns {T | false} preprocess as needed by overriding + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports */ - parseOptions(library) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + getReferencedExports(moduleGraph, runtime) { + return [[this.name]]; } - /** - * @param {Module} module the exporting entry module - * @param {string} entryName the name of the entrypoint - * @param {LibraryContext} libraryContext context - * @returns {void} - */ - finishEntryModule(module, entryName, libraryContext) {} + get type() { + return "wasm export import"; + } - /** - * @param {Module} module the exporting entry module - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {string | undefined} bailout reason - */ - embedInRuntimeBailout(module, renderContext, libraryContext) { - return undefined; + get category() { + return "wasm"; } - /** - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {string | undefined} bailout reason - */ - strictRuntimeBailout(renderContext, libraryContext) { - return undefined; + serialize(context) { + const { write } = context; + + write(this.exportName); + write(this.name); + write(this.valueType); + + super.serialize(context); } - /** - * @param {Chunk} chunk the chunk - * @param {Set} set runtime requirements - * @param {LibraryContext} libraryContext context - * @returns {void} - */ - runtimeRequirements(chunk, set, libraryContext) { - if (this.render !== AbstractLibraryPlugin.prototype.render) - set.add(RuntimeGlobals.returnExportsFromRuntime); + deserialize(context) { + const { read } = context; + + this.exportName = read(); + this.name = read(); + this.valueType = read(); + + super.deserialize(context); } +} + +makeSerializable( + WebAssemblyExportImportedDependency, + "webpack/lib/dependencies/WebAssemblyExportImportedDependency" +); + +module.exports = WebAssemblyExportImportedDependency; + + +/***/ }), + +/***/ 5239: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const makeSerializable = __webpack_require__(33032); +const UnsupportedWebAssemblyFeatureError = __webpack_require__(78455); +const ModuleDependency = __webpack_require__(80321); + +/** @typedef {import("@webassemblyjs/ast").ModuleImportDescription} ModuleImportDescription */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +class WebAssemblyImportDependency extends ModuleDependency { /** - * @param {Source} source source - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export + * @param {string} request the request + * @param {string} name the imported name + * @param {ModuleImportDescription} description the WASM ast node + * @param {false | string} onlyDirectImport if only direct imports are allowed */ - render(source, renderContext, libraryContext) { - return source; + constructor(request, name, description, onlyDirectImport) { + super(request); + /** @type {string} */ + this.name = name; + /** @type {ModuleImportDescription} */ + this.description = description; + /** @type {false | string} */ + this.onlyDirectImport = onlyDirectImport; + } + + get type() { + return "wasm import"; + } + + get category() { + return "wasm"; } /** - * @param {Source} source source - * @param {Module} module module - * @param {StartupRenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports */ - renderStartup(source, module, renderContext, libraryContext) { - return source; + getReferencedExports(moduleGraph, runtime) { + return [[this.name]]; } /** - * @param {Chunk} chunk the chunk - * @param {Hash} hash hash - * @param {ChunkHashContext} chunkHashContext chunk hash context - * @param {LibraryContext} libraryContext context - * @returns {void} + * Returns errors + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[]} errors */ - chunkHash(chunk, hash, chunkHashContext, libraryContext) { - const options = this._parseOptionsCached( - libraryContext.compilation.outputOptions.library - ); - hash.update(this._pluginName); - hash.update(JSON.stringify(options)); + getErrors(moduleGraph) { + const module = moduleGraph.getModule(this); + + if ( + this.onlyDirectImport && + module && + !module.type.startsWith("webassembly") + ) { + return [ + new UnsupportedWebAssemblyFeatureError( + `Import "${this.name}" from "${this.request}" with ${this.onlyDirectImport} can only be used for direct wasm to wasm dependencies` + ) + ]; + } + } + + serialize(context) { + const { write } = context; + + write(this.name); + write(this.description); + write(this.onlyDirectImport); + + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + + this.name = read(); + this.description = read(); + this.onlyDirectImport = read(); + + super.deserialize(context); } } -AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE = COMMON_LIBRARY_NAME_MESSAGE; -module.exports = AbstractLibraryPlugin; +makeSerializable( + WebAssemblyImportDependency, + "webpack/lib/dependencies/WebAssemblyImportDependency" +); + +module.exports = WebAssemblyImportDependency; /***/ }), -/***/ 67416: +/***/ 26505: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ -const { ConcatSource } = __webpack_require__(51255); -const ExternalModule = __webpack_require__(73071); -const Template = __webpack_require__(1626); -const AbstractLibraryPlugin = __webpack_require__(26030); +const Dependency = __webpack_require__(54912); +const Template = __webpack_require__(39722); +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ -/** @typedef {import("../util/Hash")} Hash */ -/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -/** - * @typedef {Object} AmdLibraryPluginOptions - * @property {LibraryType} type - * @property {boolean=} requireAsWrapper - */ +class WebpackIsIncludedDependency extends ModuleDependency { + constructor(request, range) { + super(request); -/** - * @typedef {Object} AmdLibraryPluginParsed - * @property {string} name - */ + this.weak = true; + this.range = range; + } -/** - * @typedef {AmdLibraryPluginParsed} T - * @extends {AbstractLibraryPlugin} - */ -class AmdLibraryPlugin extends AbstractLibraryPlugin { /** - * @param {AmdLibraryPluginOptions} options the plugin options + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports */ - constructor(options) { - super({ - pluginName: "AmdLibraryPlugin", - type: options.type - }); - this.requireAsWrapper = options.requireAsWrapper; + getReferencedExports(moduleGraph, runtime) { + // This doesn't use any export + return Dependency.NO_EXPORTS_REFERENCED; } - /** - * @param {LibraryOptions} library normalized library option - * @returns {T | false} preprocess as needed by overriding - */ - parseOptions(library) { - const { name } = library; - if (this.requireAsWrapper) { - if (name) { - throw new Error( - `AMD library name must be unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` - ); - } - } else { - if (name && typeof name !== "string") { - throw new Error( - `AMD library name must be a simple string or unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` - ); - } - } - return { - name: /** @type {string=} */ (name) - }; + get type() { + return "__webpack_is_included__"; } +} + +makeSerializable( + WebpackIsIncludedDependency, + "webpack/lib/dependencies/WebpackIsIncludedDependency" +); +WebpackIsIncludedDependency.Template = class WebpackIsIncludedDependencyTemplate extends ( + ModuleDependency.Template +) { /** - * @param {Source} source source - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - render( - source, - { chunkGraph, chunk, runtimeTemplate }, - { options, compilation } - ) { - const modern = runtimeTemplate.supportsArrowFunction(); - const modules = chunkGraph - .getChunkModules(chunk) - .filter(m => m instanceof ExternalModule); - const externals = /** @type {ExternalModule[]} */ (modules); - const externalsDepsArray = JSON.stringify( - externals.map(m => - typeof m.request === "object" && !Array.isArray(m.request) - ? m.request.amd - : m.request - ) + apply(dependency, source, { runtimeTemplate, chunkGraph, moduleGraph }) { + const dep = /** @type {WebpackIsIncludedDependency} */ (dependency); + const connection = moduleGraph.getConnection(dep); + const included = connection + ? chunkGraph.getNumberOfModuleChunks(connection.module) > 0 + : false; + const comment = runtimeTemplate.outputOptions.pathinfo + ? Template.toComment( + `__webpack_is_included__ ${runtimeTemplate.requestShortener.shorten( + dep.request + )}` + ) + : ""; + + source.replace( + dep.range[0], + dep.range[1] - 1, + `${comment}${JSON.stringify(included)}` ); - const externalsArguments = externals - .map( - m => - `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( - `${chunkGraph.getModuleId(m)}` - )}__` - ) - .join(", "); + } +}; - const iife = runtimeTemplate.isIIFE(); - const fnStart = - (modern - ? `(${externalsArguments}) => {` - : `function(${externalsArguments}) {`) + - (iife || !chunk.hasRuntime() ? " return " : "\n"); - const fnEnd = iife ? ";\n}" : "\n}"; +module.exports = WebpackIsIncludedDependency; - if (this.requireAsWrapper) { - return new ConcatSource( - `require(${externalsDepsArray}, ${fnStart}`, - source, - `${fnEnd});` - ); - } else if (options.name) { - const name = compilation.getPath(options.name, { - chunk - }); - return new ConcatSource( - `define(${JSON.stringify(name)}, ${externalsDepsArray}, ${fnStart}`, - source, - `${fnEnd});` - ); - } else if (externalsArguments) { - return new ConcatSource( - `define(${externalsDepsArray}, ${fnStart}`, - source, - `${fnEnd});` - ); - } else { - return new ConcatSource(`define(${fnStart}`, source, `${fnEnd});`); - } +/***/ }), + +/***/ 1466: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ + + + +const Dependency = __webpack_require__(54912); +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../Entrypoint")} Entrypoint */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + +class WorkerDependency extends ModuleDependency { + /** + * @param {string} request request + * @param {[number, number]} range range + */ + constructor(request, range) { + super(request); + this.range = range; } /** - * @param {Chunk} chunk the chunk - * @param {Hash} hash hash - * @param {ChunkHashContext} chunkHashContext chunk hash context - * @param {LibraryContext} libraryContext context - * @returns {void} + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports */ - chunkHash(chunk, hash, chunkHashContext, { options, compilation }) { - hash.update("AmdLibraryPlugin"); - if (this.requireAsWrapper) { - hash.update("requireAsWrapper"); - } else if (options.name) { - hash.update("named"); - const name = compilation.getPath(options.name, { - chunk - }); - hash.update(name); - } + getReferencedExports(moduleGraph, runtime) { + return Dependency.NO_EXPORTS_REFERENCED; + } + + get type() { + return "new Worker()"; + } + + get category() { + return "worker"; } } -module.exports = AmdLibraryPlugin; +WorkerDependency.Template = class WorkerDependencyTemplate extends ( + ModuleDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply(dependency, source, templateContext) { + const { chunkGraph, moduleGraph, runtimeRequirements } = templateContext; + const dep = /** @type {WorkerDependency} */ (dependency); + const block = /** @type {AsyncDependenciesBlock} */ ( + moduleGraph.getParentBlock(dependency) + ); + const entrypoint = /** @type {Entrypoint} */ ( + chunkGraph.getBlockChunkGroup(block) + ); + const chunk = entrypoint.getEntrypointChunk(); + + runtimeRequirements.add(RuntimeGlobals.publicPath); + runtimeRequirements.add(RuntimeGlobals.baseURI); + runtimeRequirements.add(RuntimeGlobals.getChunkScriptFilename); + + source.replace( + dep.range[0], + dep.range[1] - 1, + `/* worker import */ ${RuntimeGlobals.publicPath} + ${ + RuntimeGlobals.getChunkScriptFilename + }(${JSON.stringify(chunk.id)}), ${RuntimeGlobals.baseURI}` + ); + } +}; + +makeSerializable(WorkerDependency, "webpack/lib/dependencies/WorkerDependency"); + +module.exports = WorkerDependency; /***/ }), -/***/ 40080: +/***/ 82509: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -96054,380 +91781,421 @@ module.exports = AmdLibraryPlugin; -const { ConcatSource } = __webpack_require__(51255); -const { UsageState } = __webpack_require__(63686); -const Template = __webpack_require__(1626); -const propertyAccess = __webpack_require__(54190); -const { getEntryRuntime } = __webpack_require__(17156); -const AbstractLibraryPlugin = __webpack_require__(26030); +const { pathToFileURL } = __webpack_require__(57310); +const AsyncDependenciesBlock = __webpack_require__(47736); +const CommentCompilationWarning = __webpack_require__(98427); +const UnsupportedFeatureWarning = __webpack_require__(42495); +const EnableChunkLoadingPlugin = __webpack_require__(61291); +const { equals } = __webpack_require__(84953); +const createHash = __webpack_require__(49835); +const { contextify } = __webpack_require__(82186); +const EnableWasmLoadingPlugin = __webpack_require__(78613); +const ConstDependency = __webpack_require__(76911); +const CreateScriptUrlDependency = __webpack_require__(79062); +const { + harmonySpecifierTag +} = __webpack_require__(20862); +const WorkerDependency = __webpack_require__(1466); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ +/** @typedef {import("estree").Expression} Expression */ +/** @typedef {import("estree").ObjectExpression} ObjectExpression */ +/** @typedef {import("estree").Pattern} Pattern */ +/** @typedef {import("estree").Property} Property */ +/** @typedef {import("estree").SpreadElement} SpreadElement */ /** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */ -/** @typedef {import("../util/Hash")} Hash */ -/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ - -const KEYWORD_REGEX = - /^(await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|super|switch|static|this|throw|try|true|typeof|var|void|while|with|yield)$/; -const IDENTIFIER_REGEX = - /^[\p{L}\p{Nl}$_][\p{L}\p{Nl}$\p{Mn}\p{Mc}\p{Nd}\p{Pc}]*$/iu; - -/** - * Validates the library name by checking for keywords and valid characters - * @param {string} name name to be validated - * @returns {boolean} true, when valid - */ -const isNameValid = name => { - return !KEYWORD_REGEX.test(name) && IDENTIFIER_REGEX.test(name); -}; - -/** - * @param {string[]} accessor variable plus properties - * @param {number} existingLength items of accessor that are existing already - * @param {boolean=} initLast if the last property should also be initialized to an object - * @returns {string} code to access the accessor while initializing - */ -const accessWithInit = (accessor, existingLength, initLast = false) => { - // This generates for [a, b, c, d]: - // (((a = typeof a === "undefined" ? {} : a).b = a.b || {}).c = a.b.c || {}).d - const base = accessor[0]; - if (accessor.length === 1 && !initLast) return base; - let current = - existingLength > 0 - ? base - : `(${base} = typeof ${base} === "undefined" ? {} : ${base})`; - - // i is the current position in accessor that has been printed - let i = 1; - - // all properties printed so far (excluding base) - let propsSoFar; - - // if there is existingLength, print all properties until this position as property access - if (existingLength > i) { - propsSoFar = accessor.slice(1, existingLength); - i = existingLength; - current += propertyAccess(propsSoFar); - } else { - propsSoFar = []; - } - - // all remaining properties (except the last one when initLast is not set) - // should be printed as initializer - const initUntil = initLast ? accessor.length : accessor.length - 1; - for (; i < initUntil; i++) { - const prop = accessor[i]; - propsSoFar.push(prop); - current = `(${current}${propertyAccess([prop])} = ${base}${propertyAccess( - propsSoFar - )} || {})`; - } - - // print the last property as property access if not yet printed - if (i < accessor.length) - current = `${current}${propertyAccess([accessor[accessor.length - 1]])}`; +/** @typedef {import("../Entrypoint").EntryOptions} EntryOptions */ +/** @typedef {import("../Parser").ParserState} ParserState */ +/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */ +/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ +/** @typedef {import("./HarmonyImportDependencyParserPlugin").HarmonySettings} HarmonySettings */ - return current; +const getUrl = module => { + return pathToFileURL(module.resource).toString(); }; -/** - * @typedef {Object} AssignLibraryPluginOptions - * @property {LibraryType} type - * @property {string[] | "global"} prefix name prefix - * @property {string | false} declare declare name as variable - * @property {"error"|"static"|"copy"|"assign"} unnamed behavior for unnamed library name - * @property {"copy"|"assign"=} named behavior for named library name - */ +const DEFAULT_SYNTAX = [ + "Worker", + "SharedWorker", + "navigator.serviceWorker.register()", + "Worker from worker_threads" +]; -/** - * @typedef {Object} AssignLibraryPluginParsed - * @property {string | string[]} name - * @property {string | string[] | undefined} export - */ +/** @type {WeakMap} */ +const workerIndexMap = new WeakMap(); -/** - * @typedef {AssignLibraryPluginParsed} T - * @extends {AbstractLibraryPlugin} - */ -class AssignLibraryPlugin extends AbstractLibraryPlugin { - /** - * @param {AssignLibraryPluginOptions} options the plugin options - */ - constructor(options) { - super({ - pluginName: "AssignLibraryPlugin", - type: options.type - }); - this.prefix = options.prefix; - this.declare = options.declare; - this.unnamed = options.unnamed; - this.named = options.named || "assign"; +class WorkerPlugin { + constructor(chunkLoading, wasmLoading, module) { + this._chunkLoading = chunkLoading; + this._wasmLoading = wasmLoading; + this._module = module; } - /** - * @param {LibraryOptions} library normalized library option - * @returns {T | false} preprocess as needed by overriding + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - parseOptions(library) { - const { name } = library; - if (this.unnamed === "error") { - if (typeof name !== "string" && !Array.isArray(name)) { - throw new Error( - `Library name must be a string or string array. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` + apply(compiler) { + if (this._chunkLoading) { + new EnableChunkLoadingPlugin(this._chunkLoading).apply(compiler); + } + if (this._wasmLoading) { + new EnableWasmLoadingPlugin(this._wasmLoading).apply(compiler); + } + const cachedContextify = contextify.bindContextCache( + compiler.context, + compiler.root + ); + compiler.hooks.thisCompilation.tap( + "WorkerPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + WorkerDependency, + normalModuleFactory ); - } - } else { - if (name && typeof name !== "string" && !Array.isArray(name)) { - throw new Error( - `Library name must be a string, string array or unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` + compilation.dependencyTemplates.set( + WorkerDependency, + new WorkerDependency.Template() + ); + compilation.dependencyTemplates.set( + CreateScriptUrlDependency, + new CreateScriptUrlDependency.Template() ); - } - } - return { - name: /** @type {string|string[]=} */ (name), - export: library.export - }; - } - /** - * @param {Module} module the exporting entry module - * @param {string} entryName the name of the entrypoint - * @param {LibraryContext} libraryContext context - * @returns {void} - */ - finishEntryModule( - module, - entryName, - { options, compilation, compilation: { moduleGraph } } - ) { - const runtime = getEntryRuntime(compilation, entryName); - if (options.export) { - const exportsInfo = moduleGraph.getExportInfo( - module, - Array.isArray(options.export) ? options.export[0] : options.export - ); - exportsInfo.setUsed(UsageState.Used, runtime); - exportsInfo.canMangleUse = false; - } else { - const exportsInfo = moduleGraph.getExportsInfo(module); - exportsInfo.setUsedInUnknownWay(runtime); - } - moduleGraph.addExtraReason(module, "used as library export"); - } + /** + * @param {JavascriptParser} parser the parser + * @param {Expression} expr expression + * @returns {[BasicEvaluatedExpression, [number, number]]} parsed + */ + const parseModuleUrl = (parser, expr) => { + if ( + expr.type !== "NewExpression" || + expr.callee.type === "Super" || + expr.arguments.length !== 2 + ) + return; + const [arg1, arg2] = expr.arguments; + if (arg1.type === "SpreadElement") return; + if (arg2.type === "SpreadElement") return; + const callee = parser.evaluateExpression(expr.callee); + if (!callee.isIdentifier() || callee.identifier !== "URL") return; + const arg2Value = parser.evaluateExpression(arg2); + if ( + !arg2Value.isString() || + !arg2Value.string.startsWith("file://") || + arg2Value.string !== getUrl(parser.state.module) + ) { + return; + } + const arg1Value = parser.evaluateExpression(arg1); + return [arg1Value, [arg1.range[0], arg2.range[1]]]; + }; - _getPrefix(compilation) { - return this.prefix === "global" - ? [compilation.runtimeTemplate.globalObject] - : this.prefix; - } + /** + * @param {JavascriptParser} parser the parser + * @param {ObjectExpression} expr expression + * @returns {{ expressions: Record, otherElements: (Property | SpreadElement)[], values: Record, spread: boolean, insertType: "comma" | "single", insertLocation: number }} parsed object + */ + const parseObjectExpression = (parser, expr) => { + /** @type {Record} */ + const values = {}; + /** @type {Record} */ + const expressions = {}; + /** @type {(Property | SpreadElement)[]} */ + const otherElements = []; + let spread = false; + for (const prop of expr.properties) { + if (prop.type === "SpreadElement") { + spread = true; + } else if ( + prop.type === "Property" && + !prop.method && + !prop.computed && + prop.key.type === "Identifier" + ) { + expressions[prop.key.name] = prop.value; + if (!prop.shorthand && !prop.value.type.endsWith("Pattern")) { + const value = parser.evaluateExpression( + /** @type {Expression} */ (prop.value) + ); + if (value.isCompileTimeValue()) + values[prop.key.name] = value.asCompileTimeValue(); + } + } else { + otherElements.push(prop); + } + } + const insertType = expr.properties.length > 0 ? "comma" : "single"; + const insertLocation = + expr.properties[expr.properties.length - 1].range[1]; + return { + expressions, + otherElements, + values, + spread, + insertType, + insertLocation + }; + }; - _getResolvedFullName(options, chunk, compilation) { - const prefix = this._getPrefix(compilation); - const fullName = options.name ? prefix.concat(options.name) : prefix; - return fullName.map(n => - compilation.getPath(n, { - chunk - }) - ); - } + /** + * @param {JavascriptParser} parser the parser + * @param {object} parserOptions options + */ + const parserPlugin = (parser, parserOptions) => { + if (parserOptions.worker === false) return; + const options = !Array.isArray(parserOptions.worker) + ? ["..."] + : parserOptions.worker; + const handleNewWorker = expr => { + if (expr.arguments.length === 0 || expr.arguments.length > 2) + return; + const [arg1, arg2] = expr.arguments; + if (arg1.type === "SpreadElement") return; + if (arg2 && arg2.type === "SpreadElement") return; + const parsedUrl = parseModuleUrl(parser, arg1); + if (!parsedUrl) return; + const [url, range] = parsedUrl; + if (!url.isString()) return; + const { + expressions, + otherElements, + values: options, + spread: hasSpreadInOptions, + insertType, + insertLocation + } = arg2 && arg2.type === "ObjectExpression" + ? parseObjectExpression(parser, arg2) + : { + expressions: {}, + otherElements: [], + values: {}, + spread: false, + insertType: arg2 ? "spread" : "argument", + insertLocation: arg2 ? arg2.range : arg1.range[1] + }; + const { options: importOptions, errors: commentErrors } = + parser.parseCommentOptions(expr.range); - /** - * @param {Source} source source - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export - */ - render(source, { chunk }, { options, compilation }) { - const fullNameResolved = this._getResolvedFullName( - options, - chunk, - compilation - ); - if (this.declare) { - const base = fullNameResolved[0]; - if (!isNameValid(base)) { - throw new Error( - `Library name base (${base}) must be a valid identifier when using a var declaring library type. Either use a valid identifier (e. g. ${Template.toIdentifier( - base - )}) or use a different library type (e. g. 'type: "global"', which assign a property on the global scope instead of declaring a variable). ${ - AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE - }` - ); - } - source = new ConcatSource(`${this.declare} ${base};\n`, source); - } - return source; - } + if (commentErrors) { + for (const e of commentErrors) { + const { comment } = e; + parser.state.module.addWarning( + new CommentCompilationWarning( + `Compilation error while processing magic comment(-s): /*${comment.value}*/: ${e.message}`, + comment.loc + ) + ); + } + } - /** - * @param {Module} module the exporting entry module - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {string | undefined} bailout reason - */ - embedInRuntimeBailout( - module, - { chunk, codeGenerationResults }, - { options, compilation } - ) { - const { data } = codeGenerationResults.get(module, chunk.runtime); - const topLevelDeclarations = - (data && data.get("topLevelDeclarations")) || - (module.buildInfo && module.buildInfo.topLevelDeclarations); - if (!topLevelDeclarations) - return "it doesn't tell about top level declarations."; - const fullNameResolved = this._getResolvedFullName( - options, - chunk, - compilation - ); - const base = fullNameResolved[0]; - if (topLevelDeclarations.has(base)) - return `it declares '${base}' on top-level, which conflicts with the current library output.`; - } + /** @type {EntryOptions} */ + let entryOptions = {}; + + if (importOptions) { + if (importOptions.webpackIgnore !== undefined) { + if (typeof importOptions.webpackIgnore !== "boolean") { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackIgnore\` expected a boolean, but received: ${importOptions.webpackIgnore}.`, + expr.loc + ) + ); + } else { + if (importOptions.webpackIgnore) { + return false; + } + } + } + if (importOptions.webpackEntryOptions !== undefined) { + if ( + typeof importOptions.webpackEntryOptions !== "object" || + importOptions.webpackEntryOptions === null + ) { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackEntryOptions\` expected a object, but received: ${importOptions.webpackEntryOptions}.`, + expr.loc + ) + ); + } else { + Object.assign( + entryOptions, + importOptions.webpackEntryOptions + ); + } + } + if (importOptions.webpackChunkName !== undefined) { + if (typeof importOptions.webpackChunkName !== "string") { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackChunkName\` expected a string, but received: ${importOptions.webpackChunkName}.`, + expr.loc + ) + ); + } else { + entryOptions.name = importOptions.webpackChunkName; + } + } + } + + if ( + !Object.prototype.hasOwnProperty.call(entryOptions, "name") && + options && + typeof options.name === "string" + ) { + entryOptions.name = options.name; + } + + if (entryOptions.runtime === undefined) { + let i = workerIndexMap.get(parser.state) || 0; + workerIndexMap.set(parser.state, i + 1); + let name = `${cachedContextify( + parser.state.module.identifier() + )}|${i}`; + const hash = createHash(compilation.outputOptions.hashFunction); + hash.update(name); + const digest = /** @type {string} */ ( + hash.digest(compilation.outputOptions.hashDigest) + ); + entryOptions.runtime = digest.slice( + 0, + compilation.outputOptions.hashDigestLength + ); + } - /** - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {string | undefined} bailout reason - */ - strictRuntimeBailout({ chunk }, { options, compilation }) { - if ( - this.declare || - this.prefix === "global" || - this.prefix.length > 0 || - !options.name - ) { - return; - } - return "a global variable is assign and maybe created"; - } + const block = new AsyncDependenciesBlock({ + name: entryOptions.name, + entryOptions: { + chunkLoading: this._chunkLoading, + wasmLoading: this._wasmLoading, + ...entryOptions + } + }); + block.loc = expr.loc; + const dep = new WorkerDependency(url.string, range); + dep.loc = expr.loc; + block.addDependency(dep); + parser.state.module.addBlock(block); - /** - * @param {Source} source source - * @param {Module} module module - * @param {StartupRenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export - */ - renderStartup( - source, - module, - { moduleGraph, chunk }, - { options, compilation } - ) { - const fullNameResolved = this._getResolvedFullName( - options, - chunk, - compilation - ); - const staticExports = this.unnamed === "static"; - const exportAccess = options.export - ? propertyAccess( - Array.isArray(options.export) ? options.export : [options.export] - ) - : ""; - const result = new ConcatSource(source); - if (staticExports) { - const exportsInfo = moduleGraph.getExportsInfo(module); - const exportTarget = accessWithInit( - fullNameResolved, - this._getPrefix(compilation).length, - true - ); - for (const exportInfo of exportsInfo.orderedExports) { - if (!exportInfo.provided) continue; - const nameAccess = propertyAccess([exportInfo.name]); - result.add( - `${exportTarget}${nameAccess} = __webpack_exports__${exportAccess}${nameAccess};\n` - ); - } - result.add( - `Object.defineProperty(${exportTarget}, "__esModule", { value: true });\n` - ); - } else if (options.name ? this.named === "copy" : this.unnamed === "copy") { - result.add( - `var __webpack_export_target__ = ${accessWithInit( - fullNameResolved, - this._getPrefix(compilation).length, - true - )};\n` - ); - let exports = "__webpack_exports__"; - if (exportAccess) { - result.add( - `var __webpack_exports_export__ = __webpack_exports__${exportAccess};\n` - ); - exports = "__webpack_exports_export__"; - } - result.add( - `for(var i in ${exports}) __webpack_export_target__[i] = ${exports}[i];\n` - ); - result.add( - `if(${exports}.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true });\n` - ); - } else { - result.add( - `${accessWithInit( - fullNameResolved, - this._getPrefix(compilation).length, - false - )} = __webpack_exports__${exportAccess};\n` - ); - } - return result; - } + if (compilation.outputOptions.trustedTypes) { + const dep = new CreateScriptUrlDependency( + expr.arguments[0].range + ); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + } - /** - * @param {Chunk} chunk the chunk - * @param {Set} set runtime requirements - * @param {LibraryContext} libraryContext context - * @returns {void} - */ - runtimeRequirements(chunk, set, libraryContext) { - // we don't need to return exports from runtime - } + if (expressions.type) { + const expr = expressions.type; + if (options.type !== false) { + const dep = new ConstDependency( + this._module ? '"module"' : "undefined", + expr.range + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + expressions.type = undefined; + } + } else if (insertType === "comma") { + if (this._module || hasSpreadInOptions) { + const dep = new ConstDependency( + `, type: ${this._module ? '"module"' : "undefined"}`, + insertLocation + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + } + } else if (insertType === "spread") { + const dep1 = new ConstDependency( + "Object.assign({}, ", + insertLocation[0] + ); + const dep2 = new ConstDependency( + `, { type: ${this._module ? '"module"' : "undefined"} })`, + insertLocation[1] + ); + dep1.loc = expr.loc; + dep2.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep1); + parser.state.module.addPresentationalDependency(dep2); + } else if (insertType === "argument") { + if (this._module) { + const dep = new ConstDependency( + ', { type: "module" }', + insertLocation + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + } + } - /** - * @param {Chunk} chunk the chunk - * @param {Hash} hash hash - * @param {ChunkHashContext} chunkHashContext chunk hash context - * @param {LibraryContext} libraryContext context - * @returns {void} - */ - chunkHash(chunk, hash, chunkHashContext, { options, compilation }) { - hash.update("AssignLibraryPlugin"); - const fullNameResolved = this._getResolvedFullName( - options, - chunk, - compilation + parser.walkExpression(expr.callee); + for (const key of Object.keys(expressions)) { + if (expressions[key]) parser.walkExpression(expressions[key]); + } + for (const prop of otherElements) { + parser.walkProperty(prop); + } + if (insertType === "spread") { + parser.walkExpression(arg2); + } + + return true; + }; + const processItem = item => { + if (item.endsWith("()")) { + parser.hooks.call + .for(item.slice(0, -2)) + .tap("WorkerPlugin", handleNewWorker); + } else { + const match = /^(.+?)(\(\))?\s+from\s+(.+)$/.exec(item); + if (match) { + const ids = match[1].split("."); + const call = match[2]; + const source = match[3]; + (call ? parser.hooks.call : parser.hooks.new) + .for(harmonySpecifierTag) + .tap("WorkerPlugin", expr => { + const settings = /** @type {HarmonySettings} */ ( + parser.currentTagData + ); + if ( + !settings || + settings.source !== source || + !equals(settings.ids, ids) + ) { + return; + } + return handleNewWorker(expr); + }); + } else { + parser.hooks.new.for(item).tap("WorkerPlugin", handleNewWorker); + } + } + }; + for (const item of options) { + if (item === "...") { + DEFAULT_SYNTAX.forEach(processItem); + } else processItem(item); + } + }; + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("WorkerPlugin", parserPlugin); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("WorkerPlugin", parserPlugin); + } ); - if (options.name ? this.named === "copy" : this.unnamed === "copy") { - hash.update("copy"); - } - if (this.declare) { - hash.update(this.declare); - } - hash.update(fullNameResolved.join(".")); - if (options.export) { - hash.update(`${options.export}`); - } } } - -module.exports = AssignLibraryPlugin; +module.exports = WorkerPlugin; /***/ }), -/***/ 91452: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 50396: +/***/ (function(module) { "use strict"; /* @@ -96437,252 +92205,59 @@ module.exports = AssignLibraryPlugin; -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ -/** @typedef {import("../Compiler")} Compiler */ - -/** @type {WeakMap>} */ -const enabledTypes = new WeakMap(); - -const getEnabledTypes = compiler => { - let set = enabledTypes.get(compiler); - if (set === undefined) { - set = new Set(); - enabledTypes.set(compiler, set); - } - return set; -}; - -class EnableLibraryPlugin { - /** - * @param {LibraryType} type library type that should be available - */ - constructor(type) { - this.type = type; - } - - /** - * @param {Compiler} compiler the compiler instance - * @param {LibraryType} type type of library - * @returns {void} - */ - static setEnabled(compiler, type) { - getEnabledTypes(compiler).add(type); - } - - /** - * @param {Compiler} compiler the compiler instance - * @param {LibraryType} type type of library - * @returns {void} - */ - static checkEnabled(compiler, type) { - if (!getEnabledTypes(compiler).has(type)) { - throw new Error( - `Library type "${type}" is not enabled. ` + - "EnableLibraryPlugin need to be used to enable this type of library. " + - 'This usually happens through the "output.enabledLibraryTypes" option. ' + - 'If you are using a function as entry which sets "library", you need to add all potential library types to "output.enabledLibraryTypes". ' + - "These types are enabled: " + - Array.from(getEnabledTypes(compiler)).join(", ") - ); - } +module.exports = expr => { + // + if ( + expr.type === "FunctionExpression" || + expr.type === "ArrowFunctionExpression" + ) { + return { + fn: expr, + expressions: [], + needThis: false + }; } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const { type } = this; - - // Only enable once - const enabled = getEnabledTypes(compiler); - if (enabled.has(type)) return; - enabled.add(type); - - if (typeof type === "string") { - const enableExportProperty = () => { - const ExportPropertyTemplatePlugin = __webpack_require__(5487); - new ExportPropertyTemplatePlugin({ - type, - nsObjectUsed: type !== "module" - }).apply(compiler); - }; - switch (type) { - case "var": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: [], - declare: "var", - unnamed: "error" - }).apply(compiler); - break; - } - case "assign-properties": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: [], - declare: false, - unnamed: "error", - named: "copy" - }).apply(compiler); - break; - } - case "assign": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: [], - declare: false, - unnamed: "error" - }).apply(compiler); - break; - } - case "this": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: ["this"], - declare: false, - unnamed: "copy" - }).apply(compiler); - break; - } - case "window": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: ["window"], - declare: false, - unnamed: "copy" - }).apply(compiler); - break; - } - case "self": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: ["self"], - declare: false, - unnamed: "copy" - }).apply(compiler); - break; - } - case "global": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: "global", - declare: false, - unnamed: "copy" - }).apply(compiler); - break; - } - case "commonjs": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: ["exports"], - declare: false, - unnamed: "copy" - }).apply(compiler); - break; - } - case "commonjs-static": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: ["exports"], - declare: false, - unnamed: "static" - }).apply(compiler); - break; - } - case "commonjs2": - case "commonjs-module": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: ["module", "exports"], - declare: false, - unnamed: "assign" - }).apply(compiler); - break; - } - case "amd": - case "amd-require": { - enableExportProperty(); - const AmdLibraryPlugin = __webpack_require__(67416); - new AmdLibraryPlugin({ - type, - requireAsWrapper: type === "amd-require" - }).apply(compiler); - break; - } - case "umd": - case "umd2": { - enableExportProperty(); - const UmdLibraryPlugin = __webpack_require__(54442); - new UmdLibraryPlugin({ - type, - optionalAmdExternalAsGlobal: type === "umd2" - }).apply(compiler); - break; - } - case "system": { - enableExportProperty(); - const SystemLibraryPlugin = __webpack_require__(11707); - new SystemLibraryPlugin({ - type - }).apply(compiler); - break; - } - case "jsonp": { - enableExportProperty(); - const JsonpLibraryPlugin = __webpack_require__(84415); - new JsonpLibraryPlugin({ - type - }).apply(compiler); - break; - } - case "module": { - enableExportProperty(); - const ModuleLibraryPlugin = __webpack_require__(59780); - new ModuleLibraryPlugin({ - type - }).apply(compiler); - break; - } - default: - throw new Error(`Unsupported library type ${type}. -Plugins which provide custom library types must call EnableLibraryPlugin.setEnabled(compiler, type) to disable this error.`); - } - } else { - // TODO support plugin instances here - // apply them to the compiler - } + // .bind() + if ( + expr.type === "CallExpression" && + expr.callee.type === "MemberExpression" && + expr.callee.object.type === "FunctionExpression" && + expr.callee.property.type === "Identifier" && + expr.callee.property.name === "bind" && + expr.arguments.length === 1 + ) { + return { + fn: expr.callee.object, + expressions: [expr.arguments[0]], + needThis: undefined + }; } -} - -module.exports = EnableLibraryPlugin; + // (function(_this) {return })(this) (Coffeescript) + if ( + expr.type === "CallExpression" && + expr.callee.type === "FunctionExpression" && + expr.callee.body.type === "BlockStatement" && + expr.arguments.length === 1 && + expr.arguments[0].type === "ThisExpression" && + expr.callee.body.body && + expr.callee.body.body.length === 1 && + expr.callee.body.body[0].type === "ReturnStatement" && + expr.callee.body.body[0].argument && + expr.callee.body.body[0].argument.type === "FunctionExpression" + ) { + return { + fn: expr.callee.body.body[0].argument, + expressions: [], + needThis: true + }; + } +}; /***/ }), -/***/ 5487: +/***/ 55207: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -96693,117 +92268,217 @@ module.exports = EnableLibraryPlugin; -const { ConcatSource } = __webpack_require__(51255); const { UsageState } = __webpack_require__(63686); -const propertyAccess = __webpack_require__(54190); -const { getEntryRuntime } = __webpack_require__(17156); -const AbstractLibraryPlugin = __webpack_require__(26030); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */ -/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ +/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ /** - * @typedef {Object} ExportPropertyLibraryPluginParsed - * @property {string | string[]} export + * @param {RuntimeSpec} runtime the runtime + * @param {string[][]} referencedExports list of referenced exports, will be added to + * @param {string[]} prefix export prefix + * @param {ExportInfo=} exportInfo the export info + * @param {boolean} defaultPointsToSelf when true, using default will reference itself + * @param {Set} alreadyVisited already visited export info (to handle circular reexports) */ +const processExportInfo = ( + runtime, + referencedExports, + prefix, + exportInfo, + defaultPointsToSelf = false, + alreadyVisited = new Set() +) => { + if (!exportInfo) { + referencedExports.push(prefix); + return; + } + const used = exportInfo.getUsed(runtime); + if (used === UsageState.Unused) return; + if (alreadyVisited.has(exportInfo)) { + referencedExports.push(prefix); + return; + } + alreadyVisited.add(exportInfo); + if ( + used !== UsageState.OnlyPropertiesUsed || + !exportInfo.exportsInfo || + exportInfo.exportsInfo.otherExportsInfo.getUsed(runtime) !== + UsageState.Unused + ) { + alreadyVisited.delete(exportInfo); + referencedExports.push(prefix); + return; + } + const exportsInfo = exportInfo.exportsInfo; + for (const exportInfo of exportsInfo.orderedExports) { + processExportInfo( + runtime, + referencedExports, + defaultPointsToSelf && exportInfo.name === "default" + ? prefix + : prefix.concat(exportInfo.name), + exportInfo, + false, + alreadyVisited + ); + } + alreadyVisited.delete(exportInfo); +}; +module.exports = processExportInfo; -/** - * @typedef {Object} ExportPropertyLibraryPluginOptions - * @property {LibraryType} type - * @property {boolean} nsObjectUsed the namespace object is used - */ -/** - * @typedef {ExportPropertyLibraryPluginParsed} T - * @extends {AbstractLibraryPlugin} - */ -class ExportPropertyLibraryPlugin extends AbstractLibraryPlugin { + +/***/ }), + +/***/ 32277: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ExternalsPlugin = __webpack_require__(6652); + +/** @typedef {import("../Compiler")} Compiler */ + +class ElectronTargetPlugin { /** - * @param {ExportPropertyLibraryPluginOptions} options options + * @param {"main" | "preload" | "renderer"=} context in main, preload or renderer context? */ - constructor({ type, nsObjectUsed }) { - super({ - pluginName: "ExportPropertyLibraryPlugin", - type - }); - this.nsObjectUsed = nsObjectUsed; + constructor(context) { + this._context = context; } - /** - * @param {LibraryOptions} library normalized library option - * @returns {T | false} preprocess as needed by overriding + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - parseOptions(library) { - return { - export: library.export - }; + apply(compiler) { + new ExternalsPlugin("node-commonjs", [ + "clipboard", + "crash-reporter", + "electron", + "ipc", + "native-image", + "original-fs", + "screen", + "shell" + ]).apply(compiler); + switch (this._context) { + case "main": + new ExternalsPlugin("node-commonjs", [ + "app", + "auto-updater", + "browser-window", + "content-tracing", + "dialog", + "global-shortcut", + "ipc-main", + "menu", + "menu-item", + "power-monitor", + "power-save-blocker", + "protocol", + "session", + "tray", + "web-contents" + ]).apply(compiler); + break; + case "preload": + case "renderer": + new ExternalsPlugin("node-commonjs", [ + "desktop-capturer", + "ipc-renderer", + "remote", + "web-frame" + ]).apply(compiler); + break; + } } +} + +module.exports = ElectronTargetPlugin; + + +/***/ }), + +/***/ 22273: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const WebpackError = __webpack_require__(53799); + +/** @typedef {import("../Module")} Module */ +class BuildCycleError extends WebpackError { /** - * @param {Module} module the exporting entry module - * @param {string} entryName the name of the entrypoint - * @param {LibraryContext} libraryContext context - * @returns {void} + * Creates an instance of ModuleDependencyError. + * @param {Module} module the module starting the cycle */ - finishEntryModule( - module, - entryName, - { options, compilation, compilation: { moduleGraph } } - ) { - const runtime = getEntryRuntime(compilation, entryName); - if (options.export) { - const exportsInfo = moduleGraph.getExportInfo( - module, - Array.isArray(options.export) ? options.export[0] : options.export - ); - exportsInfo.setUsed(UsageState.Used, runtime); - exportsInfo.canMangleUse = false; - } else { - const exportsInfo = moduleGraph.getExportsInfo(module); - if (this.nsObjectUsed) { - exportsInfo.setUsedInUnknownWay(runtime); - } else { - exportsInfo.setAllKnownExportsUsed(runtime); - } - } - moduleGraph.addExtraReason(module, "used as library export"); + constructor(module) { + super( + "There is a circular build dependency, which makes it impossible to create this module" + ); + + this.name = "BuildCycleError"; + this.module = module; + } +} + +module.exports = BuildCycleError; + + +/***/ }), + +/***/ 5294: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeModule = __webpack_require__(16963); + +class ExportWebpackRequireRuntimeModule extends RuntimeModule { + constructor() { + super("export webpack runtime", RuntimeModule.STAGE_ATTACH); } /** - * @param {Chunk} chunk the chunk - * @param {Set} set runtime requirements - * @param {LibraryContext} libraryContext context - * @returns {void} + * @returns {boolean} true, if the runtime module should get it's own scope */ - runtimeRequirements(chunk, set, libraryContext) {} + shouldIsolate() { + return false; + } /** - * @param {Source} source source - * @param {Module} module module - * @param {StartupRenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export + * @returns {string} runtime code */ - renderStartup(source, module, renderContext, { options }) { - if (!options.export) return source; - const postfix = `__webpack_exports__ = __webpack_exports__${propertyAccess( - Array.isArray(options.export) ? options.export : [options.export] - )};\n`; - return new ConcatSource(source, postfix); + generate() { + return "export default __webpack_require__;"; } } -module.exports = ExportPropertyLibraryPlugin; +module.exports = ExportWebpackRequireRuntimeModule; /***/ }), -/***/ 84415: +/***/ 68927: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -96815,444 +92490,649 @@ module.exports = ExportPropertyLibraryPlugin; const { ConcatSource } = __webpack_require__(51255); -const AbstractLibraryPlugin = __webpack_require__(26030); +const { RuntimeGlobals } = __webpack_require__(91919); +const HotUpdateChunk = __webpack_require__(9597); +const Template = __webpack_require__(39722); +const { getAllChunks } = __webpack_require__(91145); +const { + getCompilationHooks, + getChunkFilenameTemplate +} = __webpack_require__(89464); +const { updateHashForEntryStartup } = __webpack_require__(98124); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ /** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ -/** @typedef {import("../util/Hash")} Hash */ -/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ -/** - * @typedef {Object} JsonpLibraryPluginOptions - * @property {LibraryType} type - */ +class ModuleChunkFormatPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "ModuleChunkFormatPlugin", + compilation => { + compilation.hooks.additionalChunkRuntimeRequirements.tap( + "ModuleChunkFormatPlugin", + (chunk, set) => { + if (chunk.hasRuntime()) return; + if (compilation.chunkGraph.getNumberOfEntryModules(chunk) > 0) { + set.add(RuntimeGlobals.require); + set.add(RuntimeGlobals.startupEntrypoint); + set.add(RuntimeGlobals.externalInstallChunk); + } + } + ); + const hooks = getCompilationHooks(compilation); + hooks.renderChunk.tap( + "ModuleChunkFormatPlugin", + (modules, renderContext) => { + const { chunk, chunkGraph, runtimeTemplate } = renderContext; + const hotUpdateChunk = + chunk instanceof HotUpdateChunk ? chunk : null; + const source = new ConcatSource(); + if (hotUpdateChunk) { + throw new Error( + "HMR is not implemented for module chunk format yet" + ); + } else { + source.add(`export const id = ${JSON.stringify(chunk.id)};\n`); + source.add(`export const ids = ${JSON.stringify(chunk.ids)};\n`); + source.add(`export const modules = `); + source.add(modules); + source.add(`;\n`); + const runtimeModules = + chunkGraph.getChunkRuntimeModulesInOrder(chunk); + if (runtimeModules.length > 0) { + source.add("export const runtime =\n"); + source.add( + Template.renderChunkRuntimeModules( + runtimeModules, + renderContext + ) + ); + } + const entries = Array.from( + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ); + if (entries.length > 0) { + const runtimeChunk = entries[0][1].getRuntimeChunk(); + const currentOutputName = compilation + .getPath( + getChunkFilenameTemplate(chunk, compilation.outputOptions), + { + chunk, + contentHashType: "javascript" + } + ) + .split("/"); + + // remove filename, we only need the directory + currentOutputName.pop(); + + const getRelativePath = chunk => { + const baseOutputName = currentOutputName.slice(); + const chunkOutputName = compilation + .getPath( + getChunkFilenameTemplate( + chunk, + compilation.outputOptions + ), + { + chunk: chunk, + contentHashType: "javascript" + } + ) + .split("/"); + + // remove common parts + while ( + baseOutputName.length > 0 && + chunkOutputName.length > 0 && + baseOutputName[0] === chunkOutputName[0] + ) { + baseOutputName.shift(); + chunkOutputName.shift(); + } + // create final path + return ( + (baseOutputName.length > 0 + ? "../".repeat(baseOutputName.length) + : "./") + chunkOutputName.join("/") + ); + }; + + const entrySource = new ConcatSource(); + entrySource.add(source); + entrySource.add(";\n\n// load runtime\n"); + entrySource.add( + `import __webpack_require__ from ${JSON.stringify( + getRelativePath(runtimeChunk) + )};\n` + ); + + const startupSource = new ConcatSource(); + startupSource.add( + `var __webpack_exec__ = ${runtimeTemplate.returningFunction( + `__webpack_require__(${RuntimeGlobals.entryModuleId} = moduleId)`, + "moduleId" + )}\n` + ); + + const loadedChunks = new Set(); + let index = 0; + for (let i = 0; i < entries.length; i++) { + const [module, entrypoint] = entries[i]; + const final = i + 1 === entries.length; + const moduleId = chunkGraph.getModuleId(module); + const chunks = getAllChunks( + entrypoint, + runtimeChunk, + undefined + ); + for (const chunk of chunks) { + if (loadedChunks.has(chunk)) continue; + loadedChunks.add(chunk); + startupSource.add( + `import * as __webpack_chunk_${index}__ from ${JSON.stringify( + getRelativePath(chunk) + )};\n` + ); + startupSource.add( + `${RuntimeGlobals.externalInstallChunk}(__webpack_chunk_${index}__);\n` + ); + index++; + } + startupSource.add( + `${ + final ? "var __webpack_exports__ = " : "" + }__webpack_exec__(${JSON.stringify(moduleId)});\n` + ); + } + + entrySource.add( + hooks.renderStartup.call( + startupSource, + entries[entries.length - 1][0], + { + ...renderContext, + inlined: false + } + ) + ); + return entrySource; + } + } + return source; + } + ); + hooks.chunkHash.tap( + "ModuleChunkFormatPlugin", + (chunk, hash, { chunkGraph, runtimeTemplate }) => { + if (chunk.hasRuntime()) return; + hash.update("ModuleChunkFormatPlugin"); + hash.update("1"); + const entries = Array.from( + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ); + updateHashForEntryStartup(hash, chunkGraph, entries, chunk); + } + ); + } + ); + } +} + +module.exports = ModuleChunkFormatPlugin; + + +/***/ }), + +/***/ 89831: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/** - * @typedef {Object} JsonpLibraryPluginParsed - * @property {string} name - */ -/** - * @typedef {JsonpLibraryPluginParsed} T - * @extends {AbstractLibraryPlugin} - */ -class JsonpLibraryPlugin extends AbstractLibraryPlugin { - /** - * @param {JsonpLibraryPluginOptions} options the plugin options - */ - constructor(options) { - super({ - pluginName: "JsonpLibraryPlugin", - type: options.type - }); - } - /** - * @param {LibraryOptions} library normalized library option - * @returns {T | false} preprocess as needed by overriding - */ - parseOptions(library) { - const { name } = library; - if (typeof name !== "string") { - throw new Error( - `Jsonp library name must be a simple string. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` - ); - } - return { - name: /** @type {string} */ (name) - }; - } +const RuntimeGlobals = __webpack_require__(16475); +const ExportWebpackRequireRuntimeModule = __webpack_require__(5294); +const ModuleChunkLoadingRuntimeModule = __webpack_require__(64747); - /** - * @param {Source} source source - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export - */ - render(source, { chunk }, { options, compilation }) { - const name = compilation.getPath(options.name, { - chunk - }); - return new ConcatSource(`${name}(`, source, ")"); - } +/** @typedef {import("../Compiler")} Compiler */ +class ModuleChunkLoadingPlugin { /** - * @param {Chunk} chunk the chunk - * @param {Hash} hash hash - * @param {ChunkHashContext} chunkHashContext chunk hash context - * @param {LibraryContext} libraryContext context + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - chunkHash(chunk, hash, chunkHashContext, { options, compilation }) { - hash.update("JsonpLibraryPlugin"); - hash.update(compilation.getPath(options.name, { chunk })); + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "ModuleChunkLoadingPlugin", + compilation => { + const globalChunkLoading = compilation.outputOptions.chunkLoading; + const isEnabledForChunk = chunk => { + const options = chunk.getEntryOptions(); + const chunkLoading = + (options && options.chunkLoading) || globalChunkLoading; + return chunkLoading === "import"; + }; + const onceForChunkSet = new WeakSet(); + const handler = (chunk, set) => { + if (onceForChunkSet.has(chunk)) return; + onceForChunkSet.add(chunk); + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + set.add(RuntimeGlobals.hasOwnProperty); + compilation.addRuntimeModule( + chunk, + new ModuleChunkLoadingRuntimeModule(set) + ); + }; + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("ModuleChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.baseURI) + .tap("ModuleChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.externalInstallChunk) + .tap("ModuleChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.onChunksLoaded) + .tap("ModuleChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.externalInstallChunk) + .tap("ModuleChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + compilation.addRuntimeModule( + chunk, + new ExportWebpackRequireRuntimeModule() + ); + }); + + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("ModuleChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.getChunkScriptFilename); + }); + } + ); } } -module.exports = JsonpLibraryPlugin; +module.exports = ModuleChunkLoadingPlugin; /***/ }), -/***/ 59780: +/***/ 64747: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const { ConcatSource } = __webpack_require__(51255); -const Template = __webpack_require__(1626); -const propertyAccess = __webpack_require__(54190); -const AbstractLibraryPlugin = __webpack_require__(26030); +const { SyncWaterfallHook } = __webpack_require__(41242); +const Compilation = __webpack_require__(85720); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); +const { + getChunkFilenameTemplate, + chunkHasJs +} = __webpack_require__(89464); +const { getInitialChunkIds } = __webpack_require__(98124); +const compileBooleanMatcher = __webpack_require__(29404); +const { getUndoPath } = __webpack_require__(82186); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ /** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */ -/** @typedef {import("../util/Hash")} Hash */ -/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ - -/** - * @typedef {Object} ModuleLibraryPluginOptions - * @property {LibraryType} type - */ /** - * @typedef {Object} ModuleLibraryPluginParsed - * @property {string} name + * @typedef {Object} JsonpCompilationPluginHooks + * @property {SyncWaterfallHook<[string, Chunk]>} linkPreload + * @property {SyncWaterfallHook<[string, Chunk]>} linkPrefetch */ -/** - * @typedef {ModuleLibraryPluginParsed} T - * @extends {AbstractLibraryPlugin} - */ -class ModuleLibraryPlugin extends AbstractLibraryPlugin { - /** - * @param {ModuleLibraryPluginOptions} options the plugin options - */ - constructor(options) { - super({ - pluginName: "ModuleLibraryPlugin", - type: options.type - }); - } +/** @type {WeakMap} */ +const compilationHooksMap = new WeakMap(); +class ModuleChunkLoadingRuntimeModule extends RuntimeModule { /** - * @param {LibraryOptions} library normalized library option - * @returns {T | false} preprocess as needed by overriding + * @param {Compilation} compilation the compilation + * @returns {JsonpCompilationPluginHooks} hooks */ - parseOptions(library) { - const { name } = library; - if (name) { - throw new Error( - `Library name must be unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` + static getCompilationHooks(compilation) { + if (!(compilation instanceof Compilation)) { + throw new TypeError( + "The 'compilation' argument must be an instance of Compilation" ); } - return { - name: /** @type {string} */ (name) - }; + let hooks = compilationHooksMap.get(compilation); + if (hooks === undefined) { + hooks = { + linkPreload: new SyncWaterfallHook(["source", "chunk"]), + linkPrefetch: new SyncWaterfallHook(["source", "chunk"]) + }; + compilationHooksMap.set(compilation, hooks); + } + return hooks; + } + + constructor(runtimeRequirements) { + super("import chunk loading", RuntimeModule.STAGE_ATTACH); + this._runtimeRequirements = runtimeRequirements; } /** - * @param {Source} source source - * @param {Module} module module - * @param {StartupRenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export + * @returns {string} runtime code */ - renderStartup( - source, - module, - { moduleGraph, chunk }, - { options, compilation } - ) { - const result = new ConcatSource(source); - const exportsInfo = moduleGraph.getExportsInfo(module); - const exports = []; - const isAsync = moduleGraph.isAsync(module); - if (isAsync) { - result.add(`__webpack_exports__ = await __webpack_exports__;\n`); - } - for (const exportInfo of exportsInfo.orderedExports) { - if (!exportInfo.provided) continue; - const varName = `__webpack_exports__${Template.toIdentifier( - exportInfo.name - )}`; - result.add( - `var ${varName} = __webpack_exports__${propertyAccess([ - exportInfo.getUsedName(exportInfo.name, chunk.runtime) - ])};\n` - ); - exports.push(`${varName} as ${exportInfo.name}`); - } - if (exports.length > 0) { - result.add(`export { ${exports.join(", ")} };\n`); - } - return result; + generate() { + const { compilation, chunk } = this; + const { + runtimeTemplate, + chunkGraph, + outputOptions: { importFunctionName, importMetaName } + } = compilation; + const fn = RuntimeGlobals.ensureChunkHandlers; + const withBaseURI = this._runtimeRequirements.has(RuntimeGlobals.baseURI); + const withExternalInstallChunk = this._runtimeRequirements.has( + RuntimeGlobals.externalInstallChunk + ); + const withLoading = this._runtimeRequirements.has( + RuntimeGlobals.ensureChunkHandlers + ); + const withOnChunkLoad = this._runtimeRequirements.has( + RuntimeGlobals.onChunksLoaded + ); + const withHmr = this._runtimeRequirements.has( + RuntimeGlobals.hmrDownloadUpdateHandlers + ); + const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs); + const hasJsMatcher = compileBooleanMatcher(conditionMap); + const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); + + const outputName = this.compilation.getPath( + getChunkFilenameTemplate(chunk, this.compilation.outputOptions), + { + chunk, + contentHashType: "javascript" + } + ); + const rootOutputDir = getUndoPath( + outputName, + this.compilation.outputOptions.path, + true + ); + + const stateExpression = withHmr + ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_module` + : undefined; + + return Template.asString([ + withBaseURI + ? Template.asString([ + `${RuntimeGlobals.baseURI} = new URL(${JSON.stringify( + rootOutputDir + )}, ${importMetaName}.url);` + ]) + : "// no baseURI", + "", + "// object to store loaded and loading chunks", + "// undefined = chunk not loaded, null = chunk preloaded/prefetched", + "// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded", + `var installedChunks = ${ + stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" + }{`, + Template.indent( + Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join( + ",\n" + ) + ), + "};", + "", + withLoading || withExternalInstallChunk + ? `var installChunk = ${runtimeTemplate.basicFunction("data", [ + runtimeTemplate.destructureObject( + ["ids", "modules", "runtime"], + "data" + ), + '// add "modules" to the modules object,', + '// then flag all "ids" as loaded and fire callback', + "var moduleId, chunkId, i = 0;", + "for(moduleId in modules) {", + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(modules, moduleId)) {`, + Template.indent( + `${RuntimeGlobals.moduleFactories}[moduleId] = modules[moduleId];` + ), + "}" + ]), + "}", + "if(runtime) runtime(__webpack_require__);", + "for(;i < ids.length; i++) {", + Template.indent([ + "chunkId = ids[i];", + `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) && installedChunks[chunkId]) {`, + Template.indent("installedChunks[chunkId][0]();"), + "}", + "installedChunks[ids[i]] = 0;" + ]), + "}", + withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : "" + ])}` + : "// no install chunk", + "", + withLoading + ? Template.asString([ + `${fn}.j = ${runtimeTemplate.basicFunction( + "chunkId, promises", + hasJsMatcher !== false + ? Template.indent([ + "// import() chunk loading for javascript", + `var installedChunkData = ${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;`, + 'if(installedChunkData !== 0) { // 0 means "already installed".', + Template.indent([ + "", + '// a Promise means "currently loading".', + "if(installedChunkData) {", + Template.indent([ + "promises.push(installedChunkData[1]);" + ]), + "} else {", + Template.indent([ + hasJsMatcher === true + ? "if(true) { // all chunks have JS" + : `if(${hasJsMatcher("chunkId")}) {`, + Template.indent([ + "// setup Promise in chunk cache", + `var promise = ${importFunctionName}(${JSON.stringify( + rootOutputDir + )} + ${ + RuntimeGlobals.getChunkScriptFilename + }(chunkId)).then(installChunk, ${runtimeTemplate.basicFunction( + "e", + [ + "if(installedChunks[chunkId] !== 0) installedChunks[chunkId] = undefined;", + "throw e;" + ] + )});`, + `var promise = Promise.race([promise, new Promise(${runtimeTemplate.expressionFunction( + `installedChunkData = installedChunks[chunkId] = [resolve]`, + "resolve" + )})])`, + `promises.push(installedChunkData[1] = promise);` + ]), + "} else installedChunks[chunkId] = 0;" + ]), + "}" + ]), + "}" + ]) + : Template.indent(["installedChunks[chunkId] = 0;"]) + )};` + ]) + : "// no chunk on demand loading", + "", + withExternalInstallChunk + ? Template.asString([ + `${RuntimeGlobals.externalInstallChunk} = installChunk;` + ]) + : "// no external install chunk", + "", + withOnChunkLoad + ? `${ + RuntimeGlobals.onChunksLoaded + }.j = ${runtimeTemplate.returningFunction( + "installedChunks[chunkId] === 0", + "chunkId" + )};` + : "// no on chunks loaded" + ]); } } -module.exports = ModuleLibraryPlugin; +module.exports = ModuleChunkLoadingRuntimeModule; /***/ }), -/***/ 11707: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 16734: +/***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Joel Denning @joeldenning + Author Tobias Koppers @sokra */ -const { ConcatSource } = __webpack_require__(51255); -const { UsageState } = __webpack_require__(63686); -const ExternalModule = __webpack_require__(73071); -const Template = __webpack_require__(1626); -const propertyAccess = __webpack_require__(54190); -const AbstractLibraryPlugin = __webpack_require__(26030); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ -/** @typedef {import("../util/Hash")} Hash */ -/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ - -/** - * @typedef {Object} SystemLibraryPluginOptions - * @property {LibraryType} type - */ +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Dependency").SourcePosition} SourcePosition */ /** - * @typedef {Object} SystemLibraryPluginParsed - * @property {string} name + * @param {SourcePosition} pos position + * @returns {string} formatted position */ +const formatPosition = pos => { + if (pos && typeof pos === "object") { + if ("line" in pos && "column" in pos) { + return `${pos.line}:${pos.column}`; + } else if ("line" in pos) { + return `${pos.line}:?`; + } + } + return ""; +}; /** - * @typedef {SystemLibraryPluginParsed} T - * @extends {AbstractLibraryPlugin} + * @param {DependencyLocation} loc location + * @returns {string} formatted location */ -class SystemLibraryPlugin extends AbstractLibraryPlugin { - /** - * @param {SystemLibraryPluginOptions} options the plugin options - */ - constructor(options) { - super({ - pluginName: "SystemLibraryPlugin", - type: options.type - }); - } - - /** - * @param {LibraryOptions} library normalized library option - * @returns {T | false} preprocess as needed by overriding - */ - parseOptions(library) { - const { name } = library; - if (name && typeof name !== "string") { - throw new Error( - `System.js library name must be a simple string or unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` - ); +const formatLocation = loc => { + if (loc && typeof loc === "object") { + if ("start" in loc && loc.start && "end" in loc && loc.end) { + if ( + typeof loc.start === "object" && + typeof loc.start.line === "number" && + typeof loc.end === "object" && + typeof loc.end.line === "number" && + typeof loc.end.column === "number" && + loc.start.line === loc.end.line + ) { + return `${formatPosition(loc.start)}-${loc.end.column}`; + } else if ( + typeof loc.start === "object" && + typeof loc.start.line === "number" && + typeof loc.start.column !== "number" && + typeof loc.end === "object" && + typeof loc.end.line === "number" && + typeof loc.end.column !== "number" + ) { + return `${loc.start.line}-${loc.end.line}`; + } else { + return `${formatPosition(loc.start)}-${formatPosition(loc.end)}`; + } + } + if ("start" in loc && loc.start) { + return formatPosition(loc.start); + } + if ("name" in loc && "index" in loc) { + return `${loc.name}[${loc.index}]`; + } + if ("name" in loc) { + return loc.name; } - return { - name: /** @type {string=} */ (name) - }; } + return ""; +}; - /** - * @param {Source} source source - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export - */ - render(source, { chunkGraph, moduleGraph, chunk }, { options, compilation }) { - const modules = chunkGraph - .getChunkModules(chunk) - .filter(m => m instanceof ExternalModule && m.externalType === "system"); - const externals = /** @type {ExternalModule[]} */ (modules); - - // The name this bundle should be registered as with System - const name = options.name - ? `${JSON.stringify(compilation.getPath(options.name, { chunk }))}, ` - : ""; +module.exports = formatLocation; - // The array of dependencies that are external to webpack and will be provided by System - const systemDependencies = JSON.stringify( - externals.map(m => - typeof m.request === "object" && !Array.isArray(m.request) - ? m.request.amd - : m.request - ) - ); - // The name of the variable provided by System for exporting - const dynamicExport = "__WEBPACK_DYNAMIC_EXPORT__"; +/***/ }), - // An array of the internal variable names for the webpack externals - const externalWebpackNames = externals.map( - m => - `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( - `${chunkGraph.getModuleId(m)}` - )}__` - ); +/***/ 27899: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // Declaring variables for the internal variable names for the webpack externals - const externalVarDeclarations = externalWebpackNames - .map(name => `var ${name} = {};`) - .join("\n"); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // Define __esModule flag on all internal variables and helpers - const externalVarInitialization = []; - // The system.register format requires an array of setter functions for externals. - const setters = - externalWebpackNames.length === 0 - ? "" - : Template.asString([ - "setters: [", - Template.indent( - externals - .map((module, i) => { - const external = externalWebpackNames[i]; - const exportsInfo = moduleGraph.getExportsInfo(module); - const otherUnused = - exportsInfo.otherExportsInfo.getUsed(chunk.runtime) === - UsageState.Unused; - const instructions = []; - const handledNames = []; - for (const exportInfo of exportsInfo.orderedExports) { - const used = exportInfo.getUsedName( - undefined, - chunk.runtime - ); - if (used) { - if (otherUnused || used !== exportInfo.name) { - instructions.push( - `${external}${propertyAccess([ - used - ])} = module${propertyAccess([exportInfo.name])};` - ); - handledNames.push(exportInfo.name); - } - } else { - handledNames.push(exportInfo.name); - } - } - if (!otherUnused) { - if ( - !Array.isArray(module.request) || - module.request.length === 1 - ) { - externalVarInitialization.push( - `Object.defineProperty(${external}, "__esModule", { value: true });` - ); - } - if (handledNames.length > 0) { - const name = `${external}handledNames`; - externalVarInitialization.push( - `var ${name} = ${JSON.stringify(handledNames)};` - ); - instructions.push( - Template.asString([ - "Object.keys(module).forEach(function(key) {", - Template.indent([ - `if(${name}.indexOf(key) >= 0)`, - Template.indent(`${external}[key] = module[key];`) - ]), - "});" - ]) - ); - } else { - instructions.push( - Template.asString([ - "Object.keys(module).forEach(function(key) {", - Template.indent([`${external}[key] = module[key];`]), - "});" - ]) - ); - } - } - if (instructions.length === 0) return "function() {}"; - return Template.asString([ - "function(module) {", - Template.indent(instructions), - "}" - ]); - }) - .join(",\n") - ), - "]," - ]); - return new ConcatSource( - Template.asString([ - `System.register(${name}${systemDependencies}, function(${dynamicExport}, __system_context__) {`, - Template.indent([ - externalVarDeclarations, - Template.asString(externalVarInitialization), - "return {", - Template.indent([ - setters, - "execute: function() {", - Template.indent(`${dynamicExport}(`) - ]) - ]), - "" - ]), - source, - Template.asString([ - "", - Template.indent([ - Template.indent([Template.indent([");"]), "}"]), - "};" - ]), - "})" - ]) - ); - } +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); +class HotModuleReplacementRuntimeModule extends RuntimeModule { + constructor() { + super("hot module replacement", RuntimeModule.STAGE_BASIC); + } /** - * @param {Chunk} chunk the chunk - * @param {Hash} hash hash - * @param {ChunkHashContext} chunkHashContext chunk hash context - * @param {LibraryContext} libraryContext context - * @returns {void} + * @returns {string} runtime code */ - chunkHash(chunk, hash, chunkHashContext, { options, compilation }) { - hash.update("SystemLibraryPlugin"); - if (options.name) { - hash.update(compilation.getPath(options.name, { chunk })); - } + generate() { + return Template.getFunctionContent( + require('./HotModuleReplacement.runtime.js') + ) + .replace(/\$getFullHash\$/g, RuntimeGlobals.getFullHash) + .replace( + /\$interceptModuleExecution\$/g, + RuntimeGlobals.interceptModuleExecution + ) + .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) + .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) + .replace(/\$hmrDownloadManifest\$/g, RuntimeGlobals.hmrDownloadManifest) + .replace( + /\$hmrInvalidateModuleHandlers\$/g, + RuntimeGlobals.hmrInvalidateModuleHandlers + ) + .replace( + /\$hmrDownloadUpdateHandlers\$/g, + RuntimeGlobals.hmrDownloadUpdateHandlers + ); } } -module.exports = SystemLibraryPlugin; +module.exports = HotModuleReplacementRuntimeModule; /***/ }), -/***/ 54442: +/***/ 79040: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -97263,329 +93143,423 @@ module.exports = SystemLibraryPlugin; -const { ConcatSource, OriginalSource } = __webpack_require__(51255); -const ExternalModule = __webpack_require__(73071); -const Template = __webpack_require__(1626); -const AbstractLibraryPlugin = __webpack_require__(26030); +const { RawSource } = __webpack_require__(51255); +const AsyncDependenciesBlock = __webpack_require__(47736); +const Dependency = __webpack_require__(54912); +const Module = __webpack_require__(73208); +const ModuleFactory = __webpack_require__(51010); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const CommonJsRequireDependency = __webpack_require__(21264); +const { registerNotSerializable } = __webpack_require__(8282); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryCustomUmdCommentObject} LibraryCustomUmdCommentObject */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryCustomUmdObject} LibraryCustomUmdObject */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryName} LibraryName */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../../declarations/WebpackOptions")} WebpackOptions */ +/** @typedef {import("../Compilation")} Compilation */ /** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../Module").BuildMeta} BuildMeta */ +/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ +/** @typedef {import("../ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../dependencies/HarmonyImportDependency")} HarmonyImportDependency */ /** @typedef {import("../util/Hash")} Hash */ -/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ +/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ /** - * @param {string[]} accessor the accessor to convert to path - * @returns {string} the path + * @typedef {Object} BackendApi + * @property {function(Error=): void} dispose + * @property {function(Module): { client: string, data: string, active: boolean }} module */ -const accessorToObjectAccess = accessor => { - return accessor.map(a => `[${JSON.stringify(a)}]`).join(""); -}; + +const HMR_DEPENDENCY_TYPES = new Set([ + "import.meta.webpackHot.accept", + "import.meta.webpackHot.decline", + "module.hot.accept", + "module.hot.decline" +]); /** - * @param {string|undefined} base the path prefix - * @param {string|string[]} accessor the accessor - * @param {string=} joinWith the element separator - * @returns {string} the path + * @param {undefined|string|RegExp|Function} test test option + * @param {Module} module the module + * @returns {boolean} true, if the module should be selected */ -const accessorAccess = (base, accessor, joinWith = ", ") => { - const accessors = Array.isArray(accessor) ? accessor : [accessor]; - return accessors - .map((_, idx) => { - const a = base - ? base + accessorToObjectAccess(accessors.slice(0, idx + 1)) - : accessors[0] + accessorToObjectAccess(accessors.slice(1, idx + 1)); - if (idx === accessors.length - 1) return a; - if (idx === 0 && base === undefined) - return `${a} = typeof ${a} === "object" ? ${a} : {}`; - return `${a} = ${a} || {}`; - }) - .join(joinWith); +const checkTest = (test, module) => { + if (test === undefined) return true; + if (typeof test === "function") { + return test(module); + } + if (typeof test === "string") { + const name = module.nameForCondition(); + return name && name.startsWith(test); + } + if (test instanceof RegExp) { + const name = module.nameForCondition(); + return name && test.test(name); + } + return false; }; -/** @typedef {string | string[] | LibraryCustomUmdObject} UmdLibraryPluginName */ +const TYPES = new Set(["javascript"]); -/** - * @typedef {Object} UmdLibraryPluginOptions - * @property {LibraryType} type - * @property {boolean=} optionalAmdExternalAsGlobal - */ +class LazyCompilationDependency extends Dependency { + constructor(proxyModule) { + super(); + this.proxyModule = proxyModule; + } -/** - * @typedef {Object} UmdLibraryPluginParsed - * @property {string | string[]} name - * @property {LibraryCustomUmdObject} names - * @property {string | LibraryCustomUmdCommentObject} auxiliaryComment - * @property {boolean} namedDefine - */ + get category() { + return "esm"; + } + + get type() { + return "lazy import()"; + } -/** - * @typedef {UmdLibraryPluginParsed} T - * @extends {AbstractLibraryPlugin} - */ -class UmdLibraryPlugin extends AbstractLibraryPlugin { /** - * @param {UmdLibraryPluginOptions} options the plugin option + * @returns {string | null} an identifier to merge equal requests */ - constructor(options) { - super({ - pluginName: "UmdLibraryPlugin", - type: options.type - }); + getResourceIdentifier() { + return this.proxyModule.originalModule.identifier(); + } +} - this.optionalAmdExternalAsGlobal = options.optionalAmdExternalAsGlobal; +registerNotSerializable(LazyCompilationDependency); + +class LazyCompilationProxyModule extends Module { + constructor(context, originalModule, request, client, data, active) { + super("lazy-compilation-proxy", context, originalModule.layer); + this.originalModule = originalModule; + this.request = request; + this.client = client; + this.data = data; + this.active = active; } /** - * @param {LibraryOptions} library normalized library option - * @returns {T | false} preprocess as needed by overriding + * @returns {string} a unique identifier of the module */ - parseOptions(library) { - /** @type {LibraryName} */ - let name; - /** @type {LibraryCustomUmdObject} */ - let names; - if (typeof library.name === "object" && !Array.isArray(library.name)) { - name = library.name.root || library.name.amd || library.name.commonjs; - names = library.name; - } else { - name = library.name; - const singleName = Array.isArray(name) ? name[0] : name; - names = { - commonjs: singleName, - root: library.name, - amd: singleName - }; - } - return { - name, - names, - auxiliaryComment: library.auxiliaryComment, - namedDefine: library.umdNamedDefine + identifier() { + return `lazy-compilation-proxy|${this.originalModule.identifier()}`; + } + + /** + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + return `lazy-compilation-proxy ${this.originalModule.readableIdentifier( + requestShortener + )}`; + } + + /** + * Assuming this module is in the cache. Update the (cached) module with + * the fresh module from the factory. Usually updates internal references + * and properties. + * @param {Module} module fresh module + * @returns {void} + */ + updateCacheModule(module) { + super.updateCacheModule(module); + const m = /** @type {LazyCompilationProxyModule} */ (module); + this.originalModule = m.originalModule; + this.request = m.request; + this.client = m.client; + this.data = m.data; + this.active = m.active; + } + + /** + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion + */ + libIdent(options) { + return `${this.originalModule.libIdent(options)}!lazy-compilation-proxy`; + } + + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + callback(null, !this.buildInfo || this.buildInfo.active !== this.active); + } + + /** + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + this.buildInfo = { + active: this.active }; + /** @type {BuildMeta} */ + this.buildMeta = {}; + this.clearDependenciesAndBlocks(); + const dep = new CommonJsRequireDependency(this.client); + this.addDependency(dep); + if (this.active) { + const dep = new LazyCompilationDependency(this); + const block = new AsyncDependenciesBlock({}); + block.addDependency(dep); + this.addBlock(block); + } + callback(); } /** - * @param {Source} source source - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export + * @returns {Set} types available (do not mutate) */ - render( - source, - { chunkGraph, runtimeTemplate, chunk, moduleGraph }, - { options, compilation } - ) { - const modules = chunkGraph - .getChunkModules(chunk) - .filter( - m => - m instanceof ExternalModule && - (m.externalType === "umd" || m.externalType === "umd2") - ); - let externals = /** @type {ExternalModule[]} */ (modules); - /** @type {ExternalModule[]} */ - const optionalExternals = []; - /** @type {ExternalModule[]} */ - let requiredExternals = []; - if (this.optionalAmdExternalAsGlobal) { - for (const m of externals) { - if (m.isOptional(moduleGraph)) { - optionalExternals.push(m); - } else { - requiredExternals.push(m); - } - } - externals = requiredExternals.concat(optionalExternals); + getSourceTypes() { + return TYPES; + } + + /** + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + return 200; + } + + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration({ runtimeTemplate, chunkGraph, moduleGraph }) { + const sources = new Map(); + const runtimeRequirements = new Set(); + runtimeRequirements.add(RuntimeGlobals.module); + const clientDep = /** @type {CommonJsRequireDependency} */ ( + this.dependencies[0] + ); + const clientModule = moduleGraph.getModule(clientDep); + const block = this.blocks[0]; + const client = Template.asString([ + `var client = ${runtimeTemplate.moduleExports({ + module: clientModule, + chunkGraph, + request: clientDep.userRequest, + runtimeRequirements + })}`, + `var data = ${JSON.stringify(this.data)};` + ]); + const keepActive = Template.asString([ + `var dispose = client.keepAlive({ data: data, active: ${JSON.stringify( + !!block + )}, module: module, onError: onError });` + ]); + let source; + if (block) { + const dep = block.dependencies[0]; + const module = moduleGraph.getModule(dep); + source = Template.asString([ + client, + `module.exports = ${runtimeTemplate.moduleNamespacePromise({ + chunkGraph, + block, + module, + request: this.request, + strict: false, // TODO this should be inherited from the original module + message: "import()", + runtimeRequirements + })};`, + "if (module.hot) {", + Template.indent([ + "module.hot.accept();", + `module.hot.accept(${JSON.stringify( + chunkGraph.getModuleId(module) + )}, function() { module.hot.invalidate(); });`, + "module.hot.dispose(function(data) { delete data.resolveSelf; dispose(data); });", + "if (module.hot.data && module.hot.data.resolveSelf) module.hot.data.resolveSelf(module.exports);" + ]), + "}", + "function onError() { /* ignore */ }", + keepActive + ]); } else { - requiredExternals = externals; + source = Template.asString([ + client, + "var resolveSelf, onError;", + `module.exports = new Promise(function(resolve, reject) { resolveSelf = resolve; onError = reject; });`, + "if (module.hot) {", + Template.indent([ + "module.hot.accept();", + "if (module.hot.data && module.hot.data.resolveSelf) module.hot.data.resolveSelf(module.exports);", + "module.hot.dispose(function(data) { data.resolveSelf = resolveSelf; dispose(data); });" + ]), + "}", + keepActive + ]); } - - const replaceKeys = str => { - return compilation.getPath(str, { - chunk - }); - }; - - const externalsDepsArray = modules => { - return `[${replaceKeys( - modules - .map(m => - JSON.stringify( - typeof m.request === "object" ? m.request.amd : m.request - ) - ) - .join(", ") - )}]`; - }; - - const externalsRootArray = modules => { - return replaceKeys( - modules - .map(m => { - let request = m.request; - if (typeof request === "object") request = request.root; - return `root${accessorToObjectAccess([].concat(request))}`; - }) - .join(", ") - ); - }; - - const externalsRequireArray = type => { - return replaceKeys( - externals - .map(m => { - let expr; - let request = m.request; - if (typeof request === "object") { - request = request[type]; - } - if (request === undefined) { - throw new Error( - "Missing external configuration for type:" + type - ); - } - if (Array.isArray(request)) { - expr = `require(${JSON.stringify( - request[0] - )})${accessorToObjectAccess(request.slice(1))}`; - } else { - expr = `require(${JSON.stringify(request)})`; - } - if (m.isOptional(moduleGraph)) { - expr = `(function webpackLoadOptionalExternalModule() { try { return ${expr}; } catch(e) {} }())`; - } - return expr; - }) - .join(", ") - ); + sources.set("javascript", new RawSource(source)); + return { + sources, + runtimeRequirements }; + } - const externalsArguments = modules => { - return modules - .map( - m => - `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( - `${chunkGraph.getModuleId(m)}` - )}__` - ) - .join(", "); - }; + /** + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + super.updateHash(hash, context); + hash.update(this.active ? "active" : ""); + hash.update(JSON.stringify(this.data)); + } +} - const libraryName = library => { - return JSON.stringify(replaceKeys([].concat(library).pop())); - }; +registerNotSerializable(LazyCompilationProxyModule); - let amdFactory; - if (optionalExternals.length > 0) { - const wrapperArguments = externalsArguments(requiredExternals); - const factoryArguments = - requiredExternals.length > 0 - ? externalsArguments(requiredExternals) + - ", " + - externalsRootArray(optionalExternals) - : externalsRootArray(optionalExternals); - amdFactory = - `function webpackLoadOptionalExternalModuleAmd(${wrapperArguments}) {\n` + - ` return factory(${factoryArguments});\n` + - " }"; - } else { - amdFactory = "factory"; - } +class LazyCompilationDependencyFactory extends ModuleFactory { + constructor(factory) { + super(); + this._factory = factory; + } - const { auxiliaryComment, namedDefine, names } = options; + /** + * @param {ModuleFactoryCreateData} data data object + * @param {function(Error=, ModuleFactoryResult=): void} callback callback + * @returns {void} + */ + create(data, callback) { + const dependency = /** @type {LazyCompilationDependency} */ ( + data.dependencies[0] + ); + callback(null, { + module: dependency.proxyModule.originalModule + }); + } +} - const getAuxiliaryComment = type => { - if (auxiliaryComment) { - if (typeof auxiliaryComment === "string") - return "\t//" + auxiliaryComment + "\n"; - if (auxiliaryComment[type]) - return "\t//" + auxiliaryComment[type] + "\n"; +class LazyCompilationPlugin { + /** + * @param {Object} options options + * @param {(function(Compiler, function(Error?, BackendApi?): void): void) | function(Compiler): Promise} options.backend the backend + * @param {boolean} options.entries true, when entries are lazy compiled + * @param {boolean} options.imports true, when import() modules are lazy compiled + * @param {RegExp | string | (function(Module): boolean)} options.test additional filter for lazy compiled entrypoint modules + */ + constructor({ backend, entries, imports, test }) { + this.backend = backend; + this.entries = entries; + this.imports = imports; + this.test = test; + } + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + let backend; + compiler.hooks.beforeCompile.tapAsync( + "LazyCompilationPlugin", + (params, callback) => { + if (backend !== undefined) return callback(); + const promise = this.backend(compiler, (err, result) => { + if (err) return callback(err); + backend = result; + callback(); + }); + if (promise && promise.then) { + promise.then(b => { + backend = b; + callback(); + }, callback); + } } - return ""; - }; + ); + compiler.hooks.thisCompilation.tap( + "LazyCompilationPlugin", + (compilation, { normalModuleFactory }) => { + normalModuleFactory.hooks.module.tap( + "LazyCompilationPlugin", + (originalModule, createData, resolveData) => { + if ( + resolveData.dependencies.every(dep => + HMR_DEPENDENCY_TYPES.has(dep.type) + ) + ) { + // for HMR only resolving, try to determine if the HMR accept/decline refers to + // an import() or not + const hmrDep = resolveData.dependencies[0]; + const originModule = + compilation.moduleGraph.getParentModule(hmrDep); + const isReferringToDynamicImport = originModule.blocks.some( + block => + block.dependencies.some( + dep => + dep.type === "import()" && + /** @type {HarmonyImportDependency} */ (dep).request === + hmrDep.request + ) + ); + if (!isReferringToDynamicImport) return; + } else if ( + !resolveData.dependencies.every( + dep => + HMR_DEPENDENCY_TYPES.has(dep.type) || + (this.imports && + (dep.type === "import()" || + dep.type === "import() context element")) || + (this.entries && dep.type === "entry") + ) + ) + return; + if ( + /webpack[/\\]hot[/\\]|webpack-dev-server[/\\]client|webpack-hot-middleware[/\\]client/.test( + resolveData.request + ) || + !checkTest(this.test, originalModule) + ) + return; + const moduleInfo = backend.module(originalModule); + if (!moduleInfo) return; + const { client, data, active } = moduleInfo; - return new ConcatSource( - new OriginalSource( - "(function webpackUniversalModuleDefinition(root, factory) {\n" + - getAuxiliaryComment("commonjs2") + - " if(typeof exports === 'object' && typeof module === 'object')\n" + - " module.exports = factory(" + - externalsRequireArray("commonjs2") + - ");\n" + - getAuxiliaryComment("amd") + - " else if(typeof define === 'function' && define.amd)\n" + - (requiredExternals.length > 0 - ? names.amd && namedDefine === true - ? " define(" + - libraryName(names.amd) + - ", " + - externalsDepsArray(requiredExternals) + - ", " + - amdFactory + - ");\n" - : " define(" + - externalsDepsArray(requiredExternals) + - ", " + - amdFactory + - ");\n" - : names.amd && namedDefine === true - ? " define(" + - libraryName(names.amd) + - ", [], " + - amdFactory + - ");\n" - : " define([], " + amdFactory + ");\n") + - (names.root || names.commonjs - ? getAuxiliaryComment("commonjs") + - " else if(typeof exports === 'object')\n" + - " exports[" + - libraryName(names.commonjs || names.root) + - "] = factory(" + - externalsRequireArray("commonjs") + - ");\n" + - getAuxiliaryComment("root") + - " else\n" + - " " + - replaceKeys( - accessorAccess("root", names.root || names.commonjs) - ) + - " = factory(" + - externalsRootArray(externals) + - ");\n" - : " else {\n" + - (externals.length > 0 - ? " var a = typeof exports === 'object' ? factory(" + - externalsRequireArray("commonjs") + - ") : factory(" + - externalsRootArray(externals) + - ");\n" - : " var a = factory();\n") + - " for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n" + - " }\n") + - `})(${ - runtimeTemplate.outputOptions.globalObject - }, function(${externalsArguments(externals)}) {\nreturn `, - "webpack/universalModuleDefinition" - ), - source, - ";\n})" + return new LazyCompilationProxyModule( + compiler.context, + originalModule, + resolveData.request, + client, + data, + active + ); + } + ); + compilation.dependencyFactories.set( + LazyCompilationDependency, + new LazyCompilationDependencyFactory() + ); + } ); + compiler.hooks.shutdown.tapAsync("LazyCompilationPlugin", callback => { + backend.dispose(callback); + }); } } -module.exports = UmdLibraryPlugin; +module.exports = LazyCompilationPlugin; /***/ }), -/***/ 32597: -/***/ (function(__unused_webpack_module, exports) { +/***/ 17781: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -97595,493 +93569,414 @@ module.exports = UmdLibraryPlugin; -const LogType = Object.freeze({ - error: /** @type {"error"} */ ("error"), // message, c style arguments - warn: /** @type {"warn"} */ ("warn"), // message, c style arguments - info: /** @type {"info"} */ ("info"), // message, c style arguments - log: /** @type {"log"} */ ("log"), // message, c style arguments - debug: /** @type {"debug"} */ ("debug"), // message, c style arguments - - trace: /** @type {"trace"} */ ("trace"), // no arguments - - group: /** @type {"group"} */ ("group"), // [label] - groupCollapsed: /** @type {"groupCollapsed"} */ ("groupCollapsed"), // [label] - groupEnd: /** @type {"groupEnd"} */ ("groupEnd"), // [label] - - profile: /** @type {"profile"} */ ("profile"), // [profileName] - profileEnd: /** @type {"profileEnd"} */ ("profileEnd"), // [profileName] - - time: /** @type {"time"} */ ("time"), // name, time as [seconds, nanoseconds] - - clear: /** @type {"clear"} */ ("clear"), // no arguments - status: /** @type {"status"} */ ("status") // message, arguments -}); - -exports.LogType = LogType; - -/** @typedef {typeof LogType[keyof typeof LogType]} LogTypeEnum */ - -const LOG_SYMBOL = Symbol("webpack logger raw log method"); -const TIMERS_SYMBOL = Symbol("webpack logger times"); -const TIMERS_AGGREGATES_SYMBOL = Symbol("webpack logger aggregated times"); - -class WebpackLogger { - /** - * @param {function(LogTypeEnum, any[]=): void} log log function - * @param {function(string | function(): string): WebpackLogger} getChildLogger function to create child logger - */ - constructor(log, getChildLogger) { - this[LOG_SYMBOL] = log; - this.getChildLogger = getChildLogger; - } +/** @typedef {import("http").ServerOptions} HttpServerOptions */ +/** @typedef {import("https").ServerOptions} HttpsServerOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LazyCompilationDefaultBackendOptions} LazyCompilationDefaultBackendOptions */ +/** @typedef {import("../Compiler")} Compiler */ - error(...args) { - this[LOG_SYMBOL](LogType.error, args); - } +/** + * @callback BackendHandler + * @param {Compiler} compiler compiler + * @param {function((Error | null)=, any=): void} callback callback + * @returns {void} + */ - warn(...args) { - this[LOG_SYMBOL](LogType.warn, args); - } +/** + * @param {Omit & { client: NonNullable}} options additional options for the backend + * @returns {BackendHandler} backend + */ +module.exports = options => (compiler, callback) => { + const logger = compiler.getInfrastructureLogger("LazyCompilationBackend"); + const activeModules = new Map(); + const prefix = "/lazy-compilation-using-"; - info(...args) { - this[LOG_SYMBOL](LogType.info, args); - } + const isHttps = + options.protocol === "https" || + (typeof options.server === "object" && + ("key" in options.server || "pfx" in options.server)); - log(...args) { - this[LOG_SYMBOL](LogType.log, args); - } + const createServer = + typeof options.server === "function" + ? options.server + : (() => { + const http = isHttps ? __webpack_require__(95687) : __webpack_require__(13685); + return http.createServer.bind(http, options.server); + })(); + const listen = + typeof options.listen === "function" + ? options.listen + : server => { + let listen = options.listen; + if (typeof listen === "object" && !("port" in listen)) + listen = { ...listen, port: undefined }; + server.listen(listen); + }; - debug(...args) { - this[LOG_SYMBOL](LogType.debug, args); - } + const protocol = options.protocol || (isHttps ? "https" : "http"); - assert(assertion, ...args) { - if (!assertion) { - this[LOG_SYMBOL](LogType.error, args); + const requestListener = (req, res) => { + const keys = req.url.slice(prefix.length).split("@"); + req.socket.on("close", () => { + setTimeout(() => { + for (const key of keys) { + const oldValue = activeModules.get(key) || 0; + activeModules.set(key, oldValue - 1); + if (oldValue === 1) { + logger.log( + `${key} is no longer in use. Next compilation will skip this module.` + ); + } + } + }, 120000); + }); + req.socket.setNoDelay(true); + res.writeHead(200, { + "content-type": "text/event-stream", + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "*", + "Access-Control-Allow-Headers": "*" + }); + res.write("\n"); + let moduleActivated = false; + for (const key of keys) { + const oldValue = activeModules.get(key) || 0; + activeModules.set(key, oldValue + 1); + if (oldValue === 0) { + logger.log(`${key} is now in use and will be compiled.`); + moduleActivated = true; + } } - } + if (moduleActivated && compiler.watching) compiler.watching.invalidate(); + }; - trace() { - this[LOG_SYMBOL](LogType.trace, ["Trace"]); - } + const server = /** @type {import("net").Server} */ (createServer()); + server.on("request", requestListener); + + let isClosing = false; + /** @type {Set} */ + const sockets = new Set(); + server.on("connection", socket => { + sockets.add(socket); + socket.on("close", () => { + sockets.delete(socket); + }); + if (isClosing) socket.destroy(); + }); + server.on("clientError", e => { + if (e.message !== "Server is disposing") logger.warn(e); + }); + server.on("listening", err => { + if (err) return callback(err); + const addr = server.address(); + if (typeof addr === "string") throw new Error("addr must not be a string"); + const urlBase = + addr.address === "::" || addr.address === "0.0.0.0" + ? `${protocol}://localhost:${addr.port}` + : addr.family === "IPv6" + ? `${protocol}://[${addr.address}]:${addr.port}` + : `${protocol}://${addr.address}:${addr.port}`; + logger.log( + `Server-Sent-Events server for lazy compilation open at ${urlBase}.` + ); + callback(null, { + dispose(callback) { + isClosing = true; + // Removing the listener is a workaround for a memory leak in node.js + server.off("request", requestListener); + server.close(err => { + callback(err); + }); + for (const socket of sockets) { + socket.destroy(new Error("Server is disposing")); + } + }, + module(originalModule) { + const key = `${encodeURIComponent( + originalModule.identifier().replace(/\\/g, "/").replace(/@/g, "_") + ).replace(/%(2F|3A|24|26|2B|2C|3B|3D|3A)/g, decodeURIComponent)}`; + const active = activeModules.get(key) > 0; + return { + client: `${options.client}?${encodeURIComponent(urlBase + prefix)}`, + data: key, + active + }; + } + }); + }); + listen(server); +}; - clear() { - this[LOG_SYMBOL](LogType.clear); - } - status(...args) { - this[LOG_SYMBOL](LogType.status, args); - } +/***/ }), - group(...args) { - this[LOG_SYMBOL](LogType.group, args); - } +/***/ 64618: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - groupCollapsed(...args) { - this[LOG_SYMBOL](LogType.groupCollapsed, args); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - groupEnd(...args) { - this[LOG_SYMBOL](LogType.groupEnd, args); - } - profile(label) { - this[LOG_SYMBOL](LogType.profile, [label]); - } - profileEnd(label) { - this[LOG_SYMBOL](LogType.profileEnd, [label]); - } +const { find } = __webpack_require__(93347); +const { + compareModulesByPreOrderIndexOrIdentifier, + compareModulesByPostOrderIndexOrIdentifier +} = __webpack_require__(29579); - time(label) { - this[TIMERS_SYMBOL] = this[TIMERS_SYMBOL] || new Map(); - this[TIMERS_SYMBOL].set(label, process.hrtime()); - } +/** @typedef {import("../Compiler")} Compiler */ - timeLog(label) { - const prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label); - if (!prev) { - throw new Error(`No such label '${label}' for WebpackLogger.timeLog()`); - } - const time = process.hrtime(prev); - this[LOG_SYMBOL](LogType.time, [label, ...time]); +class ChunkModuleIdRangePlugin { + constructor(options) { + this.options = options; } - timeEnd(label) { - const prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label); - if (!prev) { - throw new Error(`No such label '${label}' for WebpackLogger.timeEnd()`); - } - const time = process.hrtime(prev); - this[TIMERS_SYMBOL].delete(label); - this[LOG_SYMBOL](LogType.time, [label, ...time]); - } + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const options = this.options; + compiler.hooks.compilation.tap("ChunkModuleIdRangePlugin", compilation => { + const moduleGraph = compilation.moduleGraph; + compilation.hooks.moduleIds.tap("ChunkModuleIdRangePlugin", modules => { + const chunkGraph = compilation.chunkGraph; + const chunk = find( + compilation.chunks, + chunk => chunk.name === options.name + ); + if (!chunk) { + throw new Error( + `ChunkModuleIdRangePlugin: Chunk with name '${options.name}"' was not found` + ); + } - timeAggregate(label) { - const prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label); - if (!prev) { - throw new Error( - `No such label '${label}' for WebpackLogger.timeAggregate()` - ); - } - const time = process.hrtime(prev); - this[TIMERS_SYMBOL].delete(label); - this[TIMERS_AGGREGATES_SYMBOL] = - this[TIMERS_AGGREGATES_SYMBOL] || new Map(); - const current = this[TIMERS_AGGREGATES_SYMBOL].get(label); - if (current !== undefined) { - if (time[1] + current[1] > 1e9) { - time[0] += current[0] + 1; - time[1] = time[1] - 1e9 + current[1]; - } else { - time[0] += current[0]; - time[1] += current[1]; - } - } - this[TIMERS_AGGREGATES_SYMBOL].set(label, time); - } + let chunkModules; + if (options.order) { + let cmpFn; + switch (options.order) { + case "index": + case "preOrderIndex": + cmpFn = compareModulesByPreOrderIndexOrIdentifier(moduleGraph); + break; + case "index2": + case "postOrderIndex": + cmpFn = compareModulesByPostOrderIndexOrIdentifier(moduleGraph); + break; + default: + throw new Error( + "ChunkModuleIdRangePlugin: unexpected value of order" + ); + } + chunkModules = chunkGraph.getOrderedChunkModules(chunk, cmpFn); + } else { + chunkModules = Array.from(modules) + .filter(m => { + return chunkGraph.isModuleInChunk(m, chunk); + }) + .sort(compareModulesByPreOrderIndexOrIdentifier(moduleGraph)); + } - timeAggregateEnd(label) { - if (this[TIMERS_AGGREGATES_SYMBOL] === undefined) return; - const time = this[TIMERS_AGGREGATES_SYMBOL].get(label); - if (time === undefined) return; - this[TIMERS_AGGREGATES_SYMBOL].delete(label); - this[LOG_SYMBOL](LogType.time, [label, ...time]); + let currentId = options.start || 0; + for (let i = 0; i < chunkModules.length; i++) { + const m = chunkModules[i]; + if (m.needId && chunkGraph.getModuleId(m) === null) { + chunkGraph.setModuleId(m, currentId++); + } + if (options.end && currentId > options.end) break; + } + }); + }); } } - -exports.Logger = WebpackLogger; +module.exports = ChunkModuleIdRangePlugin; /***/ }), -/***/ 54963: +/***/ 8747: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Florent Cailhol @ooflorent */ -const { LogType } = __webpack_require__(32597); - -/** @typedef {import("../../declarations/WebpackOptions").FilterItemTypes} FilterItemTypes */ -/** @typedef {import("../../declarations/WebpackOptions").FilterTypes} FilterTypes */ -/** @typedef {import("./Logger").LogTypeEnum} LogTypeEnum */ - -/** @typedef {function(string): boolean} FilterFunction */ - -/** - * @typedef {Object} LoggerConsole - * @property {function(): void} clear - * @property {function(): void} trace - * @property {(...args: any[]) => void} info - * @property {(...args: any[]) => void} log - * @property {(...args: any[]) => void} warn - * @property {(...args: any[]) => void} error - * @property {(...args: any[]) => void=} debug - * @property {(...args: any[]) => void=} group - * @property {(...args: any[]) => void=} groupCollapsed - * @property {(...args: any[]) => void=} groupEnd - * @property {(...args: any[]) => void=} status - * @property {(...args: any[]) => void=} profile - * @property {(...args: any[]) => void=} profileEnd - * @property {(...args: any[]) => void=} logTime - */ +const { compareChunksNatural } = __webpack_require__(29579); +const { + getFullChunkName, + getUsedChunkIds, + assignDeterministicIds +} = __webpack_require__(63290); -/** - * @typedef {Object} LoggerOptions - * @property {false|true|"none"|"error"|"warn"|"info"|"log"|"verbose"} level loglevel - * @property {FilterTypes|boolean} debug filter for debug logging - * @property {LoggerConsole} console the console to log to - */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ -/** - * @param {FilterItemTypes} item an input item - * @returns {FilterFunction} filter function - */ -const filterToFunction = item => { - if (typeof item === "string") { - const regExp = new RegExp( - `[\\\\/]${item.replace( - // eslint-disable-next-line no-useless-escape - /[-[\]{}()*+?.\\^$|]/g, - "\\$&" - )}([\\\\/]|$|!|\\?)` - ); - return ident => regExp.test(ident); - } - if (item && typeof item === "object" && typeof item.test === "function") { - return ident => item.test(ident); - } - if (typeof item === "function") { - return item; - } - if (typeof item === "boolean") { - return () => item; +class DeterministicChunkIdsPlugin { + constructor(options) { + this.options = options || {}; } -}; - -/** - * @enum {number} - */ -const LogLevel = { - none: 6, - false: 6, - error: 5, - warn: 4, - info: 3, - log: 2, - true: 2, - verbose: 1 -}; - -/** - * @param {LoggerOptions} options options object - * @returns {function(string, LogTypeEnum, any[]): void} logging function - */ -module.exports = ({ level = "info", debug = false, console }) => { - const debugFilters = - typeof debug === "boolean" - ? [() => debug] - : /** @type {FilterItemTypes[]} */ ([]) - .concat(debug) - .map(filterToFunction); - /** @type {number} */ - const loglevel = LogLevel[`${level}`] || 0; /** - * @param {string} name name of the logger - * @param {LogTypeEnum} type type of the log entry - * @param {any[]} args arguments of the log entry + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - const logger = (name, type, args) => { - const labeledArgs = () => { - if (Array.isArray(args)) { - if (args.length > 0 && typeof args[0] === "string") { - return [`[${name}] ${args[0]}`, ...args.slice(1)]; - } else { - return [`[${name}]`, ...args]; - } - } else { - return []; - } - }; - const debug = debugFilters.some(f => f(name)); - switch (type) { - case LogType.debug: - if (!debug) return; - // eslint-disable-next-line node/no-unsupported-features/node-builtins - if (typeof console.debug === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.debug(...labeledArgs()); - } else { - console.log(...labeledArgs()); - } - break; - case LogType.log: - if (!debug && loglevel > LogLevel.log) return; - console.log(...labeledArgs()); - break; - case LogType.info: - if (!debug && loglevel > LogLevel.info) return; - console.info(...labeledArgs()); - break; - case LogType.warn: - if (!debug && loglevel > LogLevel.warn) return; - console.warn(...labeledArgs()); - break; - case LogType.error: - if (!debug && loglevel > LogLevel.error) return; - console.error(...labeledArgs()); - break; - case LogType.trace: - if (!debug) return; - console.trace(); - break; - case LogType.groupCollapsed: - if (!debug && loglevel > LogLevel.log) return; - if (!debug && loglevel > LogLevel.verbose) { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - if (typeof console.groupCollapsed === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.groupCollapsed(...labeledArgs()); - } else { - console.log(...labeledArgs()); + apply(compiler) { + compiler.hooks.compilation.tap( + "DeterministicChunkIdsPlugin", + compilation => { + compilation.hooks.chunkIds.tap( + "DeterministicChunkIdsPlugin", + chunks => { + const chunkGraph = compilation.chunkGraph; + const context = this.options.context + ? this.options.context + : compiler.context; + const maxLength = this.options.maxLength || 3; + + const compareNatural = compareChunksNatural(chunkGraph); + + const usedIds = getUsedChunkIds(compilation); + assignDeterministicIds( + Array.from(chunks).filter(chunk => { + return chunk.id === null; + }), + chunk => + getFullChunkName(chunk, chunkGraph, context, compiler.root), + compareNatural, + (chunk, id) => { + const size = usedIds.size; + usedIds.add(`${id}`); + if (size === usedIds.size) return false; + chunk.id = id; + chunk.ids = [id]; + return true; + }, + [Math.pow(10, maxLength)], + 10, + usedIds.size + ); } - break; - } - // falls through - case LogType.group: - if (!debug && loglevel > LogLevel.log) return; - // eslint-disable-next-line node/no-unsupported-features/node-builtins - if (typeof console.group === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.group(...labeledArgs()); - } else { - console.log(...labeledArgs()); - } - break; - case LogType.groupEnd: - if (!debug && loglevel > LogLevel.log) return; - // eslint-disable-next-line node/no-unsupported-features/node-builtins - if (typeof console.groupEnd === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.groupEnd(); - } - break; - case LogType.time: { - if (!debug && loglevel > LogLevel.log) return; - const ms = args[1] * 1000 + args[2] / 1000000; - const msg = `[${name}] ${args[0]}: ${ms} ms`; - if (typeof console.logTime === "function") { - console.logTime(msg); - } else { - console.log(msg); - } - break; + ); } - case LogType.profile: - // eslint-disable-next-line node/no-unsupported-features/node-builtins - if (typeof console.profile === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.profile(...labeledArgs()); - } - break; - case LogType.profileEnd: - // eslint-disable-next-line node/no-unsupported-features/node-builtins - if (typeof console.profileEnd === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.profileEnd(...labeledArgs()); - } - break; - case LogType.clear: - if (!debug && loglevel > LogLevel.log) return; - // eslint-disable-next-line node/no-unsupported-features/node-builtins - if (typeof console.clear === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.clear(); - } - break; - case LogType.status: - if (!debug && loglevel > LogLevel.info) return; - if (typeof console.status === "function") { - if (args.length === 0) { - console.status(); - } else { - console.status(...labeledArgs()); - } - } else { - if (args.length !== 0) { - console.info(...labeledArgs()); - } - } - break; - default: - throw new Error(`Unexpected LogType ${type}`); - } - }; - return logger; -}; + ); + } +} + +module.exports = DeterministicChunkIdsPlugin; /***/ }), -/***/ 62090: -/***/ (function(module) { +/***/ 76692: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Florent Cailhol @ooflorent */ -const arraySum = array => { - let sum = 0; - for (const item of array) sum += item; - return sum; -}; - -/** - * @param {any[]} args items to be truncated - * @param {number} maxLength maximum length of args including spaces between - * @returns {string[]} truncated args - */ -const truncateArgs = (args, maxLength) => { - const lengths = args.map(a => `${a}`.length); - const availableLength = maxLength - lengths.length + 1; +const { + compareModulesByPreOrderIndexOrIdentifier +} = __webpack_require__(29579); +const { + getUsedModuleIdsAndModules, + getFullModuleName, + assignDeterministicIds +} = __webpack_require__(63290); - if (availableLength > 0 && args.length === 1) { - if (availableLength >= args[0].length) { - return args; - } else if (availableLength > 3) { - return ["..." + args[0].slice(-availableLength + 3)]; - } else { - return [args[0].slice(-availableLength)]; - } - } +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ - // Check if there is space for at least 4 chars per arg - if (availableLength < arraySum(lengths.map(i => Math.min(i, 6)))) { - // remove args - if (args.length > 1) - return truncateArgs(args.slice(0, args.length - 1), maxLength); - return []; +class DeterministicModuleIdsPlugin { + /** + * @param {Object} options options + * @param {string=} options.context context relative to which module identifiers are computed + * @param {function(Module): boolean=} options.test selector function for modules + * @param {number=} options.maxLength maximum id length in digits (used as starting point) + * @param {number=} options.salt hash salt for ids + * @param {boolean=} options.fixedLength do not increase the maxLength to find an optimal id space size + * @param {boolean=} options.failOnConflict throw an error when id conflicts occur (instead of rehashing) + */ + constructor(options = {}) { + this.options = options; } - let currentLength = arraySum(lengths); - - // Check if all fits into maxLength - if (currentLength <= availableLength) return args; + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "DeterministicModuleIdsPlugin", + compilation => { + compilation.hooks.moduleIds.tap("DeterministicModuleIdsPlugin", () => { + const chunkGraph = compilation.chunkGraph; + const context = this.options.context + ? this.options.context + : compiler.context; + const maxLength = this.options.maxLength || 3; + const failOnConflict = this.options.failOnConflict || false; + const fixedLength = this.options.fixedLength || false; + const salt = this.options.salt || 0; + let conflicts = 0; - // Try to remove chars from the longest items until it fits - while (currentLength > availableLength) { - const maxLength = Math.max(...lengths); - const shorterItems = lengths.filter(l => l !== maxLength); - const nextToMaxLength = - shorterItems.length > 0 ? Math.max(...shorterItems) : 0; - const maxReduce = maxLength - nextToMaxLength; - let maxItems = lengths.length - shorterItems.length; - let overrun = currentLength - availableLength; - for (let i = 0; i < lengths.length; i++) { - if (lengths[i] === maxLength) { - const reduce = Math.min(Math.floor(overrun / maxItems), maxReduce); - lengths[i] -= reduce; - currentLength -= reduce; - overrun -= reduce; - maxItems--; + const [usedIds, modules] = getUsedModuleIdsAndModules( + compilation, + this.options.test + ); + assignDeterministicIds( + modules, + module => getFullModuleName(module, context, compiler.root), + failOnConflict + ? () => 0 + : compareModulesByPreOrderIndexOrIdentifier( + compilation.moduleGraph + ), + (module, id) => { + const size = usedIds.size; + usedIds.add(`${id}`); + if (size === usedIds.size) { + conflicts++; + return false; + } + chunkGraph.setModuleId(module, id); + return true; + }, + [Math.pow(10, maxLength)], + fixedLength ? 0 : 10, + usedIds.size, + salt + ); + if (failOnConflict && conflicts) + throw new Error( + `Assigning deterministic module ids has lead to ${conflicts} conflict${ + conflicts > 1 ? "s" : "" + }.\nIncrease the 'maxLength' to increase the id space and make conflicts less likely (recommended when there are many conflicts or application is expected to grow), or add an 'salt' number to try another hash starting value in the same id space (recommended when there is only a single conflict).` + ); + }); } - } + ); } +} - // Return args reduced to length in lengths - return args.map((a, i) => { - const str = `${a}`; - const length = lengths[i]; - if (str.length === length) { - return str; - } else if (length > 5) { - return "..." + str.slice(-length + 3); - } else if (length > 0) { - return str.slice(-length); - } else { - return ""; - } - }); -}; - -module.exports = truncateArgs; +module.exports = DeterministicModuleIdsPlugin; /***/ }), -/***/ 1313: +/***/ 21825: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -98092,110 +93987,82 @@ module.exports = truncateArgs; -const RuntimeGlobals = __webpack_require__(16475); -const StartupChunkDependenciesPlugin = __webpack_require__(22339); +const { + compareModulesByPreOrderIndexOrIdentifier +} = __webpack_require__(29579); +const createSchemaValidation = __webpack_require__(32540); +const createHash = __webpack_require__(49835); +const { + getUsedModuleIdsAndModules, + getFullModuleName +} = __webpack_require__(63290); -/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../../declarations/plugins/HashedModuleIdsPlugin").HashedModuleIdsPluginOptions} HashedModuleIdsPluginOptions */ -class CommonJsChunkLoadingPlugin { - constructor(options) { - options = options || {}; - this._asyncChunkLoading = options.asyncChunkLoading; +const validate = createSchemaValidation( + __webpack_require__(52210), + () => __webpack_require__(59106), + { + name: "Hashed Module Ids Plugin", + baseDataPath: "options" } +); +class HashedModuleIdsPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {HashedModuleIdsPluginOptions=} options options object */ - apply(compiler) { - const ChunkLoadingRuntimeModule = this._asyncChunkLoading - ? __webpack_require__(73369) - : __webpack_require__(94172); - const chunkLoadingValue = this._asyncChunkLoading - ? "async-node" - : "require"; - new StartupChunkDependenciesPlugin({ - chunkLoading: chunkLoadingValue, - asyncChunkLoading: this._asyncChunkLoading - }).apply(compiler); - compiler.hooks.thisCompilation.tap( - "CommonJsChunkLoadingPlugin", - compilation => { - const globalChunkLoading = compilation.outputOptions.chunkLoading; - const isEnabledForChunk = chunk => { - const options = chunk.getEntryOptions(); - const chunkLoading = - options && options.chunkLoading !== undefined - ? options.chunkLoading - : globalChunkLoading; - return chunkLoading === chunkLoadingValue; - }; - const onceForChunkSet = new WeakSet(); - const handler = (chunk, set) => { - if (onceForChunkSet.has(chunk)) return; - onceForChunkSet.add(chunk); - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - set.add(RuntimeGlobals.hasOwnProperty); - compilation.addRuntimeModule( - chunk, - new ChunkLoadingRuntimeModule(set) - ); - }; + constructor(options = {}) { + validate(options); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("CommonJsChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadUpdateHandlers) - .tap("CommonJsChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadManifest) - .tap("CommonJsChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.baseURI) - .tap("CommonJsChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.externalInstallChunk) - .tap("CommonJsChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.onChunksLoaded) - .tap("CommonJsChunkLoadingPlugin", handler); + /** @type {HashedModuleIdsPluginOptions} */ + this.options = { + context: null, + hashFunction: "md4", + hashDigest: "base64", + hashDigestLength: 4, + ...options + }; + } - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("CommonJsChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.getChunkScriptFilename); - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadUpdateHandlers) - .tap("CommonJsChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.getChunkUpdateScriptFilename); - set.add(RuntimeGlobals.moduleCache); - set.add(RuntimeGlobals.hmrModuleData); - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadManifest) - .tap("CommonJsChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.getUpdateManifestFilename); - }); - } - ); + apply(compiler) { + const options = this.options; + compiler.hooks.compilation.tap("HashedModuleIdsPlugin", compilation => { + compilation.hooks.moduleIds.tap("HashedModuleIdsPlugin", () => { + const chunkGraph = compilation.chunkGraph; + const context = this.options.context + ? this.options.context + : compiler.context; + + const [usedIds, modules] = getUsedModuleIdsAndModules(compilation); + const modulesInNaturalOrder = modules.sort( + compareModulesByPreOrderIndexOrIdentifier(compilation.moduleGraph) + ); + for (const module of modulesInNaturalOrder) { + const ident = getFullModuleName(module, context, compiler.root); + const hash = createHash(options.hashFunction); + hash.update(ident || ""); + const hashId = /** @type {string} */ ( + hash.digest(options.hashDigest) + ); + let len = options.hashDigestLength; + while (usedIds.has(hashId.substr(0, len))) len++; + const moduleId = hashId.substr(0, len); + chunkGraph.setModuleId(module, moduleId); + usedIds.add(moduleId); + } + }); + }); } } -module.exports = CommonJsChunkLoadingPlugin; +module.exports = HashedModuleIdsPlugin; /***/ }), -/***/ 7553: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 63290: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -98205,180 +94072,481 @@ module.exports = CommonJsChunkLoadingPlugin; -const CachedInputFileSystem = __webpack_require__(52788); -const fs = __webpack_require__(90552); -const createConsoleLogger = __webpack_require__(54963); -const NodeWatchFileSystem = __webpack_require__(98810); -const nodeConsole = __webpack_require__(91786); +const createHash = __webpack_require__(49835); +const { makePathsRelative } = __webpack_require__(82186); +const numberHash = __webpack_require__(70002); -/** @typedef {import("../../declarations/WebpackOptions").InfrastructureLogging} InfrastructureLogging */ -/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Module")} Module */ +/** @typedef {typeof import("../util/Hash")} Hash */ -class NodeEnvironmentPlugin { - /** - * @param {Object} options options - * @param {InfrastructureLogging} options.infrastructureLogging infrastructure logging options - */ - constructor(options) { - this.options = options; +/** + * @param {string} str string to hash + * @param {number} len max length of the hash + * @param {string | Hash} hashFunction hash function to use + * @returns {string} hash + */ +const getHash = (str, len, hashFunction) => { + const hash = createHash(hashFunction); + hash.update(str); + const digest = /** @type {string} */ (hash.digest("hex")); + return digest.substr(0, len); +}; + +/** + * @param {string} str the string + * @returns {string} string prefixed by an underscore if it is a number + */ +const avoidNumber = str => { + // max length of a number is 21 chars, bigger numbers a written as "...e+xx" + if (str.length > 21) return str; + const firstChar = str.charCodeAt(0); + // skip everything that doesn't look like a number + // charCodes: "-": 45, "1": 49, "9": 57 + if (firstChar < 49) { + if (firstChar !== 45) return str; + } else if (firstChar > 57) { + return str; + } + if (str === +str + "") { + return `_${str}`; } + return str; +}; - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const { infrastructureLogging } = this.options; - compiler.infrastructureLogger = createConsoleLogger({ - level: infrastructureLogging.level || "info", - debug: infrastructureLogging.debug || false, - console: - infrastructureLogging.console || - nodeConsole({ - colors: infrastructureLogging.colors, - appendOnly: infrastructureLogging.appendOnly, - stream: infrastructureLogging.stream - }) - }); - compiler.inputFileSystem = new CachedInputFileSystem(fs, 60000); - const inputFileSystem = compiler.inputFileSystem; - compiler.outputFileSystem = fs; - compiler.intermediateFileSystem = fs; - compiler.watchFileSystem = new NodeWatchFileSystem( - compiler.inputFileSystem +/** + * @param {string} request the request + * @returns {string} id representation + */ +const requestToId = request => { + return request + .replace(/^(\.\.?\/)+/, "") + .replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_"); +}; +exports.requestToId = requestToId; + +/** + * @param {string} string the string + * @param {string} delimiter separator for string and hash + * @param {string | Hash} hashFunction hash function to use + * @returns {string} string with limited max length to 100 chars + */ +const shortenLongString = (string, delimiter, hashFunction) => { + if (string.length < 100) return string; + return ( + string.slice(0, 100 - 6 - delimiter.length) + + delimiter + + getHash(string, 6, hashFunction) + ); +}; + +/** + * @param {Module} module the module + * @param {string} context context directory + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {string} short module name + */ +const getShortModuleName = (module, context, associatedObjectForCache) => { + const libIdent = module.libIdent({ context, associatedObjectForCache }); + if (libIdent) return avoidNumber(libIdent); + const nameForCondition = module.nameForCondition(); + if (nameForCondition) + return avoidNumber( + makePathsRelative(context, nameForCondition, associatedObjectForCache) ); - compiler.hooks.beforeRun.tap("NodeEnvironmentPlugin", compiler => { - if (compiler.inputFileSystem === inputFileSystem) { - compiler.fsStartTime = Date.now(); - inputFileSystem.purge(); - } - }); + return ""; +}; +exports.getShortModuleName = getShortModuleName; + +/** + * @param {string} shortName the short name + * @param {Module} module the module + * @param {string} context context directory + * @param {string | Hash} hashFunction hash function to use + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {string} long module name + */ +const getLongModuleName = ( + shortName, + module, + context, + hashFunction, + associatedObjectForCache +) => { + const fullName = getFullModuleName(module, context, associatedObjectForCache); + return `${shortName}?${getHash(fullName, 4, hashFunction)}`; +}; +exports.getLongModuleName = getLongModuleName; + +/** + * @param {Module} module the module + * @param {string} context context directory + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {string} full module name + */ +const getFullModuleName = (module, context, associatedObjectForCache) => { + return makePathsRelative( + context, + module.identifier(), + associatedObjectForCache + ); +}; +exports.getFullModuleName = getFullModuleName; + +/** + * @param {Chunk} chunk the chunk + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {string} context context directory + * @param {string} delimiter delimiter for names + * @param {string | Hash} hashFunction hash function to use + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {string} short chunk name + */ +const getShortChunkName = ( + chunk, + chunkGraph, + context, + delimiter, + hashFunction, + associatedObjectForCache +) => { + const modules = chunkGraph.getChunkRootModules(chunk); + const shortModuleNames = modules.map(m => + requestToId(getShortModuleName(m, context, associatedObjectForCache)) + ); + chunk.idNameHints.sort(); + const chunkName = Array.from(chunk.idNameHints) + .concat(shortModuleNames) + .filter(Boolean) + .join(delimiter); + return shortenLongString(chunkName, delimiter, hashFunction); +}; +exports.getShortChunkName = getShortChunkName; + +/** + * @param {Chunk} chunk the chunk + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {string} context context directory + * @param {string} delimiter delimiter for names + * @param {string | Hash} hashFunction hash function to use + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {string} short chunk name + */ +const getLongChunkName = ( + chunk, + chunkGraph, + context, + delimiter, + hashFunction, + associatedObjectForCache +) => { + const modules = chunkGraph.getChunkRootModules(chunk); + const shortModuleNames = modules.map(m => + requestToId(getShortModuleName(m, context, associatedObjectForCache)) + ); + const longModuleNames = modules.map(m => + requestToId( + getLongModuleName("", m, context, hashFunction, associatedObjectForCache) + ) + ); + chunk.idNameHints.sort(); + const chunkName = Array.from(chunk.idNameHints) + .concat(shortModuleNames, longModuleNames) + .filter(Boolean) + .join(delimiter); + return shortenLongString(chunkName, delimiter, hashFunction); +}; +exports.getLongChunkName = getLongChunkName; + +/** + * @param {Chunk} chunk the chunk + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {string} context context directory + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {string} full chunk name + */ +const getFullChunkName = ( + chunk, + chunkGraph, + context, + associatedObjectForCache +) => { + if (chunk.name) return chunk.name; + const modules = chunkGraph.getChunkRootModules(chunk); + const fullModuleNames = modules.map(m => + makePathsRelative(context, m.identifier(), associatedObjectForCache) + ); + return fullModuleNames.join(); +}; +exports.getFullChunkName = getFullChunkName; + +/** + * @template K + * @template V + * @param {Map} map a map from key to values + * @param {K} key key + * @param {V} value value + * @returns {void} + */ +const addToMapOfItems = (map, key, value) => { + let array = map.get(key); + if (array === undefined) { + array = []; + map.set(key, array); } -} + array.push(value); +}; -module.exports = NodeEnvironmentPlugin; +/** + * @param {Compilation} compilation the compilation + * @param {function(Module): boolean=} filter filter modules + * @returns {[Set, Module[]]} used module ids as strings and modules without id matching the filter + */ +const getUsedModuleIdsAndModules = (compilation, filter) => { + const chunkGraph = compilation.chunkGraph; + const modules = []; -/***/ }), + /** @type {Set} */ + const usedIds = new Set(); + if (compilation.usedModuleIds) { + for (const id of compilation.usedModuleIds) { + usedIds.add(id + ""); + } + } -/***/ 7103: -/***/ (function(module) { + for (const module of compilation.modules) { + if (!module.needId) continue; + const moduleId = chunkGraph.getModuleId(module); + if (moduleId !== null) { + usedIds.add(moduleId + ""); + } else { + if ( + (!filter || filter(module)) && + chunkGraph.getNumberOfModuleChunks(module) !== 0 + ) { + modules.push(module); + } + } + } + + return [usedIds, modules]; +}; +exports.getUsedModuleIdsAndModules = getUsedModuleIdsAndModules; + +/** + * @param {Compilation} compilation the compilation + * @returns {Set} used chunk ids as strings + */ +const getUsedChunkIds = compilation => { + /** @type {Set} */ + const usedIds = new Set(); + if (compilation.usedChunkIds) { + for (const id of compilation.usedChunkIds) { + usedIds.add(id + ""); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + for (const chunk of compilation.chunks) { + const chunkId = chunk.id; + if (chunkId !== null) { + usedIds.add(chunkId + ""); + } + } + return usedIds; +}; +exports.getUsedChunkIds = getUsedChunkIds; +/** + * @template T + * @param {Iterable} items list of items to be named + * @param {function(T): string} getShortName get a short name for an item + * @param {function(T, string): string} getLongName get a long name for an item + * @param {function(T, T): -1|0|1} comparator order of items + * @param {Set} usedIds already used ids, will not be assigned + * @param {function(T, string): void} assignName assign a name to an item + * @returns {T[]} list of items without a name + */ +const assignNames = ( + items, + getShortName, + getLongName, + comparator, + usedIds, + assignName +) => { + /** @type {Map} */ + const nameToItems = new Map(); -/** @typedef {import("../Compiler")} Compiler */ + for (const item of items) { + const name = getShortName(item); + addToMapOfItems(nameToItems, name, item); + } -class NodeSourcePlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) {} -} + /** @type {Map} */ + const nameToItems2 = new Map(); -module.exports = NodeSourcePlugin; + for (const [name, items] of nameToItems) { + if (items.length > 1 || !name) { + for (const item of items) { + const longName = getLongName(item, name); + addToMapOfItems(nameToItems2, longName, item); + } + } else { + addToMapOfItems(nameToItems2, name, items[0]); + } + } + /** @type {T[]} */ + const unnamedItems = []; -/***/ }), + for (const [name, items] of nameToItems2) { + if (!name) { + for (const item of items) { + unnamedItems.push(item); + } + } else if (items.length === 1 && !usedIds.has(name)) { + assignName(items[0], name); + usedIds.add(name); + } else { + items.sort(comparator); + let i = 0; + for (const item of items) { + while (nameToItems2.has(name + i) && usedIds.has(name + i)) i++; + assignName(item, name + i); + usedIds.add(name + i); + i++; + } + } + } -/***/ 17916: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + unnamedItems.sort(comparator); + return unnamedItems; +}; +exports.assignNames = assignNames; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** + * @template T + * @param {T[]} items list of items to be named + * @param {function(T): string} getName get a name for an item + * @param {function(T, T): -1|0|1} comparator order of items + * @param {function(T, number): boolean} assignId assign an id to an item + * @param {number[]} ranges usable ranges for ids + * @param {number} expandFactor factor to create more ranges + * @param {number} extraSpace extra space to allocate, i. e. when some ids are already used + * @param {number} salt salting number to initialize hashing + * @returns {void} + */ +const assignDeterministicIds = ( + items, + getName, + comparator, + assignId, + ranges = [10], + expandFactor = 10, + extraSpace = 0, + salt = 0 +) => { + items.sort(comparator); + // max 5% fill rate + const optimalRange = Math.min( + Math.ceil(items.length * 20) + extraSpace, + Number.MAX_SAFE_INTEGER + ); + let i = 0; + let range = ranges[i]; + while (range < optimalRange) { + i++; + if (i < ranges.length) { + range = Math.min(ranges[i], Number.MAX_SAFE_INTEGER); + } else if (expandFactor) { + range = Math.min(range * expandFactor, Number.MAX_SAFE_INTEGER); + } else { + break; + } + } -const ExternalsPlugin = __webpack_require__(6652); + for (const item of items) { + const ident = getName(item); + let id; + let i = salt; + do { + id = numberHash(ident + i++, range); + } while (!assignId(item, id)); + } +}; +exports.assignDeterministicIds = assignDeterministicIds; -/** @typedef {import("../Compiler")} Compiler */ +/** + * @param {Set} usedIds used ids + * @param {Iterable} modules the modules + * @param {Compilation} compilation the compilation + * @returns {void} + */ +const assignAscendingModuleIds = (usedIds, modules, compilation) => { + const chunkGraph = compilation.chunkGraph; -const builtins = [ - "assert", - "async_hooks", - "buffer", - "child_process", - "cluster", - "console", - "constants", - "crypto", - "dgram", - "diagnostics_channel", - "dns", - "dns/promises", - "domain", - "events", - "fs", - "fs/promises", - "http", - "http2", - "https", - "inspector", - "module", - "net", - "os", - "path", - "path/posix", - "path/win32", - "perf_hooks", - "process", - "punycode", - "querystring", - "readline", - "repl", - "stream", - "stream/promises", - "stream/web", - "string_decoder", - "sys", - "timers", - "timers/promises", - "tls", - "trace_events", - "tty", - "url", - "util", - "util/types", - "v8", - "vm", - "wasi", - "worker_threads", - "zlib", - /^node:/, + let nextId = 0; + let assignId; + if (usedIds.size > 0) { + assignId = module => { + if (chunkGraph.getModuleId(module) === null) { + while (usedIds.has(nextId + "")) nextId++; + chunkGraph.setModuleId(module, nextId++); + } + }; + } else { + assignId = module => { + if (chunkGraph.getModuleId(module) === null) { + chunkGraph.setModuleId(module, nextId++); + } + }; + } + for (const module of modules) { + assignId(module); + } +}; +exports.assignAscendingModuleIds = assignAscendingModuleIds; - // cspell:word pnpapi - // Yarn PnP adds pnpapi as "builtin" - "pnpapi" -]; +/** + * @param {Iterable} chunks the chunks + * @param {Compilation} compilation the compilation + * @returns {void} + */ +const assignAscendingChunkIds = (chunks, compilation) => { + const usedIds = getUsedChunkIds(compilation); -class NodeTargetPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - new ExternalsPlugin("node-commonjs", builtins).apply(compiler); + let nextId = 0; + if (usedIds.size > 0) { + for (const chunk of chunks) { + if (chunk.id === null) { + while (usedIds.has(nextId + "")) nextId++; + chunk.id = nextId; + chunk.ids = [nextId]; + nextId++; + } + } + } else { + for (const chunk of chunks) { + if (chunk.id === null) { + chunk.id = nextId; + chunk.ids = [nextId]; + nextId++; + } + } } -} - -module.exports = NodeTargetPlugin; +}; +exports.assignAscendingChunkIds = assignAscendingChunkIds; /***/ }), -/***/ 61052: +/***/ 6454: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -98389,14 +94557,23 @@ module.exports = NodeTargetPlugin; -const CommonJsChunkFormatPlugin = __webpack_require__(84508); -const EnableChunkLoadingPlugin = __webpack_require__(61291); +const { compareChunksNatural } = __webpack_require__(29579); +const { + getShortChunkName, + getLongChunkName, + assignNames, + getUsedChunkIds, + assignAscendingChunkIds +} = __webpack_require__(63290); +/** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ -class NodeTemplatePlugin { +class NamedChunkIdsPlugin { constructor(options) { - this._options = options || {}; + this.delimiter = (options && options.delimiter) || "-"; + this.context = options && options.context; } /** @@ -98405,507 +94582,214 @@ class NodeTemplatePlugin { * @returns {void} */ apply(compiler) { - const chunkLoading = this._options.asyncChunkLoading - ? "async-node" - : "require"; - compiler.options.output.chunkLoading = chunkLoading; - new CommonJsChunkFormatPlugin().apply(compiler); - new EnableChunkLoadingPlugin(chunkLoading).apply(compiler); - } -} - -module.exports = NodeTemplatePlugin; - - -/***/ }), - -/***/ 98810: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const util = __webpack_require__(73837); -const Watchpack = __webpack_require__(36871); - -/** @typedef {import("../../declarations/WebpackOptions").WatchOptions} WatchOptions */ -/** @typedef {import("../FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */ -/** @typedef {import("../util/fs").WatchFileSystem} WatchFileSystem */ -/** @typedef {import("../util/fs").WatchMethod} WatchMethod */ -/** @typedef {import("../util/fs").Watcher} Watcher */ - -class NodeWatchFileSystem { - constructor(inputFileSystem) { - this.inputFileSystem = inputFileSystem; - this.watcherOptions = { - aggregateTimeout: 0 - }; - this.watcher = new Watchpack(this.watcherOptions); - } - - /** - * @param {Iterable} files watched files - * @param {Iterable} directories watched directories - * @param {Iterable} missing watched exitance entries - * @param {number} startTime timestamp of start time - * @param {WatchOptions} options options object - * @param {function(Error=, Map, Map, Set, Set): void} callback aggregated callback - * @param {function(string, number): void} callbackUndelayed callback when the first change was detected - * @returns {Watcher} a watcher - */ - watch( - files, - directories, - missing, - startTime, - options, - callback, - callbackUndelayed - ) { - if (!files || typeof files[Symbol.iterator] !== "function") { - throw new Error("Invalid arguments: 'files'"); - } - if (!directories || typeof directories[Symbol.iterator] !== "function") { - throw new Error("Invalid arguments: 'directories'"); - } - if (!missing || typeof missing[Symbol.iterator] !== "function") { - throw new Error("Invalid arguments: 'missing'"); - } - if (typeof callback !== "function") { - throw new Error("Invalid arguments: 'callback'"); - } - if (typeof startTime !== "number" && startTime) { - throw new Error("Invalid arguments: 'startTime'"); - } - if (typeof options !== "object") { - throw new Error("Invalid arguments: 'options'"); - } - if (typeof callbackUndelayed !== "function" && callbackUndelayed) { - throw new Error("Invalid arguments: 'callbackUndelayed'"); - } - const oldWatcher = this.watcher; - this.watcher = new Watchpack(options); - - if (callbackUndelayed) { - this.watcher.once("change", callbackUndelayed); - } - - const fetchTimeInfo = () => { - const fileTimeInfoEntries = new Map(); - const contextTimeInfoEntries = new Map(); - if (this.watcher) { - this.watcher.collectTimeInfoEntries( - fileTimeInfoEntries, - contextTimeInfoEntries - ); - } - return { fileTimeInfoEntries, contextTimeInfoEntries }; - }; - this.watcher.once("aggregated", (changes, removals) => { - // pause emitting events (avoids clearing aggregated changes and removals on timeout) - this.watcher.pause(); - - if (this.inputFileSystem && this.inputFileSystem.purge) { - const fs = this.inputFileSystem; - for (const item of changes) { - fs.purge(item); - } - for (const item of removals) { - fs.purge(item); - } - } - const { fileTimeInfoEntries, contextTimeInfoEntries } = fetchTimeInfo(); - callback( - null, - fileTimeInfoEntries, - contextTimeInfoEntries, - changes, - removals - ); - }); - - this.watcher.watch({ files, directories, missing, startTime }); + compiler.hooks.compilation.tap("NamedChunkIdsPlugin", compilation => { + const { hashFunction } = compilation.outputOptions; + compilation.hooks.chunkIds.tap("NamedChunkIdsPlugin", chunks => { + const chunkGraph = compilation.chunkGraph; + const context = this.context ? this.context : compiler.context; + const delimiter = this.delimiter; - if (oldWatcher) { - oldWatcher.close(); - } - return { - close: () => { - if (this.watcher) { - this.watcher.close(); - this.watcher = null; - } - }, - pause: () => { - if (this.watcher) { - this.watcher.pause(); - } - }, - getAggregatedRemovals: util.deprecate( - () => { - const items = this.watcher && this.watcher.aggregatedRemovals; - if (items && this.inputFileSystem && this.inputFileSystem.purge) { - const fs = this.inputFileSystem; - for (const item of items) { - fs.purge(item); - } - } - return items; - }, - "Watcher.getAggregatedRemovals is deprecated in favor of Watcher.getInfo since that's more performant.", - "DEP_WEBPACK_WATCHER_GET_AGGREGATED_REMOVALS" - ), - getAggregatedChanges: util.deprecate( - () => { - const items = this.watcher && this.watcher.aggregatedChanges; - if (items && this.inputFileSystem && this.inputFileSystem.purge) { - const fs = this.inputFileSystem; - for (const item of items) { - fs.purge(item); - } - } - return items; - }, - "Watcher.getAggregatedChanges is deprecated in favor of Watcher.getInfo since that's more performant.", - "DEP_WEBPACK_WATCHER_GET_AGGREGATED_CHANGES" - ), - getFileTimeInfoEntries: util.deprecate( - () => { - return fetchTimeInfo().fileTimeInfoEntries; - }, - "Watcher.getFileTimeInfoEntries is deprecated in favor of Watcher.getInfo since that's more performant.", - "DEP_WEBPACK_WATCHER_FILE_TIME_INFO_ENTRIES" - ), - getContextTimeInfoEntries: util.deprecate( - () => { - return fetchTimeInfo().contextTimeInfoEntries; - }, - "Watcher.getContextTimeInfoEntries is deprecated in favor of Watcher.getInfo since that's more performant.", - "DEP_WEBPACK_WATCHER_CONTEXT_TIME_INFO_ENTRIES" - ), - getInfo: () => { - const removals = this.watcher && this.watcher.aggregatedRemovals; - const changes = this.watcher && this.watcher.aggregatedChanges; - if (this.inputFileSystem && this.inputFileSystem.purge) { - const fs = this.inputFileSystem; - if (removals) { - for (const item of removals) { - fs.purge(item); - } - } - if (changes) { - for (const item of changes) { - fs.purge(item); + const unnamedChunks = assignNames( + Array.from(chunks).filter(chunk => { + if (chunk.name) { + chunk.id = chunk.name; + chunk.ids = [chunk.name]; } + return chunk.id === null; + }), + chunk => + getShortChunkName( + chunk, + chunkGraph, + context, + delimiter, + hashFunction, + compiler.root + ), + chunk => + getLongChunkName( + chunk, + chunkGraph, + context, + delimiter, + hashFunction, + compiler.root + ), + compareChunksNatural(chunkGraph), + getUsedChunkIds(compilation), + (chunk, name) => { + chunk.id = name; + chunk.ids = [name]; } + ); + if (unnamedChunks.length > 0) { + assignAscendingChunkIds(unnamedChunks, compilation); } - const { fileTimeInfoEntries, contextTimeInfoEntries } = fetchTimeInfo(); - return { - changes, - removals, - fileTimeInfoEntries, - contextTimeInfoEntries - }; - } - }; + }); + }); } } -module.exports = NodeWatchFileSystem; +module.exports = NamedChunkIdsPlugin; /***/ }), -/***/ 73369: +/***/ 24339: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); +const { compareModulesByIdentifier } = __webpack_require__(29579); const { - chunkHasJs, - getChunkFilenameTemplate -} = __webpack_require__(89464); -const { getInitialChunkIds } = __webpack_require__(98124); -const compileBooleanMatcher = __webpack_require__(29404); -const { getUndoPath } = __webpack_require__(82186); + getShortModuleName, + getLongModuleName, + assignNames, + getUsedModuleIdsAndModules, + assignAscendingModuleIds +} = __webpack_require__(63290); -class ReadFileChunkLoadingRuntimeModule extends RuntimeModule { - constructor(runtimeRequirements) { - super("readFile chunk loading", RuntimeModule.STAGE_ATTACH); - this.runtimeRequirements = runtimeRequirements; +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ + +class NamedModuleIdsPlugin { + constructor(options) { + this.options = options || {}; } /** - * @returns {string} runtime code + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - generate() { - const { chunkGraph, chunk } = this; - const { runtimeTemplate } = this.compilation; - const fn = RuntimeGlobals.ensureChunkHandlers; - const withBaseURI = this.runtimeRequirements.has(RuntimeGlobals.baseURI); - const withExternalInstallChunk = this.runtimeRequirements.has( - RuntimeGlobals.externalInstallChunk - ); - const withOnChunkLoad = this.runtimeRequirements.has( - RuntimeGlobals.onChunksLoaded - ); - const withLoading = this.runtimeRequirements.has( - RuntimeGlobals.ensureChunkHandlers - ); - const withHmr = this.runtimeRequirements.has( - RuntimeGlobals.hmrDownloadUpdateHandlers - ); - const withHmrManifest = this.runtimeRequirements.has( - RuntimeGlobals.hmrDownloadManifest - ); - const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs); - const hasJsMatcher = compileBooleanMatcher(conditionMap); - const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); + apply(compiler) { + const { root } = compiler; + compiler.hooks.compilation.tap("NamedModuleIdsPlugin", compilation => { + const { hashFunction } = compilation.outputOptions; + compilation.hooks.moduleIds.tap("NamedModuleIdsPlugin", () => { + const chunkGraph = compilation.chunkGraph; + const context = this.options.context + ? this.options.context + : compiler.context; - const outputName = this.compilation.getPath( - getChunkFilenameTemplate(chunk, this.compilation.outputOptions), - { - chunk, - contentHashType: "javascript" - } - ); - const rootOutputDir = getUndoPath( - outputName, - this.compilation.outputOptions.path, - false - ); + const [usedIds, modules] = getUsedModuleIdsAndModules(compilation); + const unnamedModules = assignNames( + modules, + m => getShortModuleName(m, context, root), + (m, shortName) => + getLongModuleName(shortName, m, context, hashFunction, root), + compareModulesByIdentifier, + usedIds, + (m, name) => chunkGraph.setModuleId(m, name) + ); + if (unnamedModules.length > 0) { + assignAscendingModuleIds(usedIds, unnamedModules, compilation); + } + }); + }); + } +} - const stateExpression = withHmr - ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_readFileVm` - : undefined; +module.exports = NamedModuleIdsPlugin; - return Template.asString([ - withBaseURI - ? Template.asString([ - `${RuntimeGlobals.baseURI} = require("url").pathToFileURL(${ - rootOutputDir - ? `__dirname + ${JSON.stringify("/" + rootOutputDir)}` - : "__filename" - });` - ]) - : "// no baseURI", - "", - "// object to store loaded chunks", - '// "0" means "already loaded", Promise means loading', - `var installedChunks = ${ - stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" - }{`, - Template.indent( - Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join( - ",\n" - ) - ), - "};", - "", - withOnChunkLoad - ? `${ - RuntimeGlobals.onChunksLoaded - }.readFileVm = ${runtimeTemplate.returningFunction( - "installedChunks[chunkId] === 0", - "chunkId" - )};` - : "// no on chunks loaded", - "", - withLoading || withExternalInstallChunk - ? `var installChunk = ${runtimeTemplate.basicFunction("chunk", [ - "var moreModules = chunk.modules, chunkIds = chunk.ids, runtime = chunk.runtime;", - "for(var moduleId in moreModules) {", - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, - Template.indent([ - `${RuntimeGlobals.moduleFactories}[moduleId] = moreModules[moduleId];` - ]), - "}" - ]), - "}", - `if(runtime) runtime(__webpack_require__);`, - "for(var i = 0; i < chunkIds.length; i++) {", - Template.indent([ - "if(installedChunks[chunkIds[i]]) {", - Template.indent(["installedChunks[chunkIds[i]][0]();"]), - "}", - "installedChunks[chunkIds[i]] = 0;" - ]), - "}", - withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : "" - ])};` - : "// no chunk install function needed", - "", - withLoading - ? Template.asString([ - "// ReadFile + VM.run chunk loading for javascript", - `${fn}.readFileVm = function(chunkId, promises) {`, - hasJsMatcher !== false - ? Template.indent([ - "", - "var installedChunkData = installedChunks[chunkId];", - 'if(installedChunkData !== 0) { // 0 means "already installed".', - Template.indent([ - '// array of [resolve, reject, promise] means "currently loading"', - "if(installedChunkData) {", - Template.indent(["promises.push(installedChunkData[2]);"]), - "} else {", - Template.indent([ - hasJsMatcher === true - ? "if(true) { // all chunks have JS" - : `if(${hasJsMatcher("chunkId")}) {`, - Template.indent([ - "// load the chunk and return promise to it", - "var promise = new Promise(function(resolve, reject) {", - Template.indent([ - "installedChunkData = installedChunks[chunkId] = [resolve, reject];", - `var filename = require('path').join(__dirname, ${JSON.stringify( - rootOutputDir - )} + ${ - RuntimeGlobals.getChunkScriptFilename - }(chunkId));`, - "require('fs').readFile(filename, 'utf-8', function(err, content) {", - Template.indent([ - "if(err) return reject(err);", - "var chunk = {};", - "require('vm').runInThisContext('(function(exports, require, __dirname, __filename) {' + content + '\\n})', filename)" + - "(chunk, require, require('path').dirname(filename), filename);", - "installChunk(chunk);" - ]), - "});" - ]), - "});", - "promises.push(installedChunkData[2] = promise);" - ]), - "} else installedChunks[chunkId] = 0;" - ]), - "}" - ]), - "}" - ]) - : Template.indent(["installedChunks[chunkId] = 0;"]), - "};" - ]) - : "// no chunk loading", - "", - withExternalInstallChunk - ? Template.asString([ - "module.exports = __webpack_require__;", - `${RuntimeGlobals.externalInstallChunk} = installChunk;` - ]) - : "// no external install chunk", - "", - withHmr - ? Template.asString([ - "function loadUpdateChunk(chunkId, updatedModulesList) {", - Template.indent([ - "return new Promise(function(resolve, reject) {", - Template.indent([ - `var filename = require('path').join(__dirname, ${JSON.stringify( - rootOutputDir - )} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId));`, - "require('fs').readFile(filename, 'utf-8', function(err, content) {", - Template.indent([ - "if(err) return reject(err);", - "var update = {};", - "require('vm').runInThisContext('(function(exports, require, __dirname, __filename) {' + content + '\\n})', filename)" + - "(update, require, require('path').dirname(filename), filename);", - "var updatedModules = update.modules;", - "var runtime = update.runtime;", - "for(var moduleId in updatedModules) {", - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(updatedModules, moduleId)) {`, - Template.indent([ - `currentUpdate[moduleId] = updatedModules[moduleId];`, - "if(updatedModulesList) updatedModulesList.push(moduleId);" - ]), - "}" - ]), - "}", - "if(runtime) currentUpdateRuntime.push(runtime);", - "resolve();" - ]), - "});" - ]), - "});" - ]), - "}", - "", - Template.getFunctionContent( - require('./JavascriptHotModuleReplacement.runtime.js') - ) - .replace(/\$key\$/g, "readFileVm") - .replace(/\$installedChunks\$/g, "installedChunks") - .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") - .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) - .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) - .replace( - /\$ensureChunkHandlers\$/g, - RuntimeGlobals.ensureChunkHandlers - ) - .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) - .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) - .replace( - /\$hmrDownloadUpdateHandlers\$/g, - RuntimeGlobals.hmrDownloadUpdateHandlers - ) - .replace( - /\$hmrInvalidateModuleHandlers\$/g, - RuntimeGlobals.hmrInvalidateModuleHandlers - ) - ]) - : "// no HMR", - "", - withHmrManifest - ? Template.asString([ - `${RuntimeGlobals.hmrDownloadManifest} = function() {`, - Template.indent([ - "return new Promise(function(resolve, reject) {", - Template.indent([ - `var filename = require('path').join(__dirname, ${JSON.stringify( - rootOutputDir - )} + ${RuntimeGlobals.getUpdateManifestFilename}());`, - "require('fs').readFile(filename, 'utf-8', function(err, content) {", - Template.indent([ - "if(err) {", - Template.indent([ - 'if(err.code === "ENOENT") return resolve();', - "return reject(err);" - ]), - "}", - "try { resolve(JSON.parse(content)); }", - "catch(e) { reject(e); }" - ]), - "});" - ]), - "});" - ]), - "}" - ]) - : "// no HMR manifest" - ]); + +/***/ }), + +/***/ 86221: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { compareChunksNatural } = __webpack_require__(29579); +const { assignAscendingChunkIds } = __webpack_require__(63290); + +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ + +class NaturalChunkIdsPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap("NaturalChunkIdsPlugin", compilation => { + compilation.hooks.chunkIds.tap("NaturalChunkIdsPlugin", chunks => { + const chunkGraph = compilation.chunkGraph; + const compareNatural = compareChunksNatural(chunkGraph); + const chunksInNaturalOrder = Array.from(chunks).sort(compareNatural); + assignAscendingChunkIds(chunksInNaturalOrder, compilation); + }); + }); } } -module.exports = ReadFileChunkLoadingRuntimeModule; +module.exports = NaturalChunkIdsPlugin; /***/ }), -/***/ 73163: +/***/ 83366: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Florent Cailhol @ooflorent +*/ + + + +const { + compareModulesByPreOrderIndexOrIdentifier +} = __webpack_require__(29579); +const { + assignAscendingModuleIds, + getUsedModuleIdsAndModules +} = __webpack_require__(63290); + +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ + +class NaturalModuleIdsPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap("NaturalModuleIdsPlugin", compilation => { + compilation.hooks.moduleIds.tap("NaturalModuleIdsPlugin", modules => { + const [usedIds, modulesInNaturalOrder] = + getUsedModuleIdsAndModules(compilation); + modulesInNaturalOrder.sort( + compareModulesByPreOrderIndexOrIdentifier(compilation.moduleGraph) + ); + assignAscendingModuleIds(usedIds, modulesInNaturalOrder, compilation); + }); + }); + } +} + +module.exports = NaturalModuleIdsPlugin; + + +/***/ }), + +/***/ 51020: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -98916,111 +94800,84 @@ module.exports = ReadFileChunkLoadingRuntimeModule; -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const AsyncWasmLoadingRuntimeModule = __webpack_require__(5434); +const { compareChunksNatural } = __webpack_require__(29579); +const createSchemaValidation = __webpack_require__(32540); +const { assignAscendingChunkIds } = __webpack_require__(63290); +/** @typedef {import("../../declarations/plugins/ids/OccurrenceChunkIdsPlugin").OccurrenceChunkIdsPluginOptions} OccurrenceChunkIdsPluginOptions */ +/** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ -class ReadFileCompileAsyncWasmPlugin { - constructor({ type = "async-node", import: useImport = false } = {}) { - this._type = type; - this._import = useImport; +const validate = createSchemaValidation( + __webpack_require__(24344), + () => __webpack_require__(53576), + { + name: "Occurrence Order Chunk Ids Plugin", + baseDataPath: "options" + } +); + +class OccurrenceChunkIdsPlugin { + /** + * @param {OccurrenceChunkIdsPluginOptions=} options options object + */ + constructor(options = {}) { + validate(options); + this.options = options; } + /** * Apply the plugin * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap( - "ReadFileCompileAsyncWasmPlugin", - compilation => { - const globalWasmLoading = compilation.outputOptions.wasmLoading; - const isEnabledForChunk = chunk => { - const options = chunk.getEntryOptions(); - const wasmLoading = - options && options.wasmLoading !== undefined - ? options.wasmLoading - : globalWasmLoading; - return wasmLoading === this._type; - }; - const generateLoadBinaryCode = this._import - ? path => - Template.asString([ - "Promise.all([import('fs'), import('url')]).then(([{ readFile }, { URL }]) => new Promise((resolve, reject) => {", - Template.indent([ - `readFile(new URL(${path}, import.meta.url), (err, buffer) => {`, - Template.indent([ - "if (err) return reject(err);", - "", - "// Fake fetch response", - "resolve({", - Template.indent(["arrayBuffer() { return buffer; }"]), - "});" - ]), - "});" - ]), - "}))" - ]) - : path => - Template.asString([ - "new Promise(function (resolve, reject) {", - Template.indent([ - "try {", - Template.indent([ - "var { readFile } = require('fs');", - "var { join } = require('path');", - "", - `readFile(join(__dirname, ${path}), function(err, buffer){`, - Template.indent([ - "if (err) return reject(err);", - "", - "// Fake fetch response", - "resolve({", - Template.indent(["arrayBuffer() { return buffer; }"]), - "});" - ]), - "});" - ]), - "} catch (err) { reject(err); }" - ]), - "})" - ]); - - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.instantiateWasm) - .tap("ReadFileCompileAsyncWasmPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - const chunkGraph = compilation.chunkGraph; - if ( - !chunkGraph.hasModuleInGraph( - chunk, - m => m.type === "webassembly/async" - ) - ) { - return; + const prioritiseInitial = this.options.prioritiseInitial; + compiler.hooks.compilation.tap("OccurrenceChunkIdsPlugin", compilation => { + compilation.hooks.chunkIds.tap("OccurrenceChunkIdsPlugin", chunks => { + const chunkGraph = compilation.chunkGraph; + + /** @type {Map} */ + const occursInInitialChunksMap = new Map(); + + const compareNatural = compareChunksNatural(chunkGraph); + + for (const c of chunks) { + let occurs = 0; + for (const chunkGroup of c.groupsIterable) { + for (const parent of chunkGroup.parentsIterable) { + if (parent.isInitial()) occurs++; } - set.add(RuntimeGlobals.publicPath); - compilation.addRuntimeModule( - chunk, - new AsyncWasmLoadingRuntimeModule({ - generateLoadBinaryCode, - supportsStreaming: false - }) - ); - }); - } - ); + } + occursInInitialChunksMap.set(c, occurs); + } + + const chunksInOccurrenceOrder = Array.from(chunks).sort((a, b) => { + if (prioritiseInitial) { + const aEntryOccurs = occursInInitialChunksMap.get(a); + const bEntryOccurs = occursInInitialChunksMap.get(b); + if (aEntryOccurs > bEntryOccurs) return -1; + if (aEntryOccurs < bEntryOccurs) return 1; + } + const aOccurs = a.getNumberOfGroups(); + const bOccurs = b.getNumberOfGroups(); + if (aOccurs > bOccurs) return -1; + if (aOccurs < bOccurs) return 1; + return compareNatural(a, b); + }); + assignAscendingChunkIds(chunksInOccurrenceOrder, compilation); + }); + }); } } -module.exports = ReadFileCompileAsyncWasmPlugin; +module.exports = OccurrenceChunkIdsPlugin; /***/ }), -/***/ 98939: +/***/ 35371: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -99031,17 +94888,36 @@ module.exports = ReadFileCompileAsyncWasmPlugin; -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const WasmChunkLoadingRuntimeModule = __webpack_require__(87394); +const { + compareModulesByPreOrderIndexOrIdentifier +} = __webpack_require__(29579); +const createSchemaValidation = __webpack_require__(32540); +const { + assignAscendingModuleIds, + getUsedModuleIdsAndModules +} = __webpack_require__(63290); +/** @typedef {import("../../declarations/plugins/ids/OccurrenceModuleIdsPlugin").OccurrenceModuleIdsPluginOptions} OccurrenceModuleIdsPluginOptions */ /** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ -// TODO webpack 6 remove +const validate = createSchemaValidation( + __webpack_require__(14916), + () => __webpack_require__(19330), + { + name: "Occurrence Order Module Ids Plugin", + baseDataPath: "options" + } +); -class ReadFileCompileWasmPlugin { - constructor(options) { - this.options = options || {}; +class OccurrenceModuleIdsPlugin { + /** + * @param {OccurrenceModuleIdsPluginOptions=} options options object + */ + constructor(options = {}) { + validate(options); + this.options = options; } /** @@ -99050,309 +94926,273 @@ class ReadFileCompileWasmPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap( - "ReadFileCompileWasmPlugin", - compilation => { - const globalWasmLoading = compilation.outputOptions.wasmLoading; - const isEnabledForChunk = chunk => { - const options = chunk.getEntryOptions(); - const wasmLoading = - options && options.wasmLoading !== undefined - ? options.wasmLoading - : globalWasmLoading; - return wasmLoading === "async-node"; + const prioritiseInitial = this.options.prioritiseInitial; + compiler.hooks.compilation.tap("OccurrenceModuleIdsPlugin", compilation => { + const moduleGraph = compilation.moduleGraph; + + compilation.hooks.moduleIds.tap("OccurrenceModuleIdsPlugin", () => { + const chunkGraph = compilation.chunkGraph; + + const [usedIds, modulesInOccurrenceOrder] = + getUsedModuleIdsAndModules(compilation); + + const occursInInitialChunksMap = new Map(); + const occursInAllChunksMap = new Map(); + + const initialChunkChunkMap = new Map(); + const entryCountMap = new Map(); + for (const m of modulesInOccurrenceOrder) { + let initial = 0; + let entry = 0; + for (const c of chunkGraph.getModuleChunksIterable(m)) { + if (c.canBeInitial()) initial++; + if (chunkGraph.isEntryModuleInChunk(m, c)) entry++; + } + initialChunkChunkMap.set(m, initial); + entryCountMap.set(m, entry); + } + + /** + * @param {Module} module module + * @returns {number} count of occurs + */ + const countOccursInEntry = module => { + let sum = 0; + for (const [ + originModule, + connections + ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { + if (!originModule) continue; + if (!connections.some(c => c.isTargetActive(undefined))) continue; + sum += initialChunkChunkMap.get(originModule); + } + return sum; }; - const generateLoadBinaryCode = path => - Template.asString([ - "new Promise(function (resolve, reject) {", - Template.indent([ - "var { readFile } = require('fs');", - "var { join } = require('path');", - "", - "try {", - Template.indent([ - `readFile(join(__dirname, ${path}), function(err, buffer){`, - Template.indent([ - "if (err) return reject(err);", - "", - "// Fake fetch response", - "resolve({", - Template.indent(["arrayBuffer() { return buffer; }"]), - "});" - ]), - "});" - ]), - "} catch (err) { reject(err); }" - ]), - "})" - ]); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("ReadFileCompileWasmPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - const chunkGraph = compilation.chunkGraph; - if ( - !chunkGraph.hasModuleInGraph( - chunk, - m => m.type === "webassembly/sync" - ) - ) { - return; + /** + * @param {Module} module module + * @returns {number} count of occurs + */ + const countOccurs = module => { + let sum = 0; + for (const [ + originModule, + connections + ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { + if (!originModule) continue; + const chunkModules = + chunkGraph.getNumberOfModuleChunks(originModule); + for (const c of connections) { + if (!c.isTargetActive(undefined)) continue; + if (!c.dependency) continue; + const factor = c.dependency.getNumberOfIdOccurrences(); + if (factor === 0) continue; + sum += factor * chunkModules; } - set.add(RuntimeGlobals.moduleCache); - compilation.addRuntimeModule( - chunk, - new WasmChunkLoadingRuntimeModule({ - generateLoadBinaryCode, - supportsStreaming: false, - mangleImports: this.options.mangleImports, - runtimeRequirements: set - }) - ); - }); - } - ); + } + return sum; + }; + + if (prioritiseInitial) { + for (const m of modulesInOccurrenceOrder) { + const result = + countOccursInEntry(m) + + initialChunkChunkMap.get(m) + + entryCountMap.get(m); + occursInInitialChunksMap.set(m, result); + } + } + + for (const m of modulesInOccurrenceOrder) { + const result = + countOccurs(m) + + chunkGraph.getNumberOfModuleChunks(m) + + entryCountMap.get(m); + occursInAllChunksMap.set(m, result); + } + + const naturalCompare = compareModulesByPreOrderIndexOrIdentifier( + compilation.moduleGraph + ); + + modulesInOccurrenceOrder.sort((a, b) => { + if (prioritiseInitial) { + const aEntryOccurs = occursInInitialChunksMap.get(a); + const bEntryOccurs = occursInInitialChunksMap.get(b); + if (aEntryOccurs > bEntryOccurs) return -1; + if (aEntryOccurs < bEntryOccurs) return 1; + } + const aOccurs = occursInAllChunksMap.get(a); + const bOccurs = occursInAllChunksMap.get(b); + if (aOccurs > bOccurs) return -1; + if (aOccurs < bOccurs) return 1; + return naturalCompare(a, b); + }); + + assignAscendingModuleIds( + usedIds, + modulesInOccurrenceOrder, + compilation + ); + }); + }); } } -module.exports = ReadFileCompileWasmPlugin; +module.exports = OccurrenceModuleIdsPlugin; /***/ }), -/***/ 94172: +/***/ 8635: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); -const { - chunkHasJs, - getChunkFilenameTemplate -} = __webpack_require__(89464); -const { getInitialChunkIds } = __webpack_require__(98124); -const compileBooleanMatcher = __webpack_require__(29404); -const { getUndoPath } = __webpack_require__(82186); +const { WebpackError } = __webpack_require__(91919); +const { getUsedModuleIdsAndModules } = __webpack_require__(63290); -class RequireChunkLoadingRuntimeModule extends RuntimeModule { - constructor(runtimeRequirements) { - super("require chunk loading", RuntimeModule.STAGE_ATTACH); - this.runtimeRequirements = runtimeRequirements; - } +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ +const plugin = "SyncModuleIdsPlugin"; + +class SyncModuleIdsPlugin { /** - * @returns {string} runtime code + * @param {Object} options options + * @param {string} options.path path to file + * @param {string=} options.context context for module names + * @param {function(Module): boolean} options.test selector for modules + * @param {"read" | "create" | "merge" | "update"=} options.mode operation mode (defaults to merge) */ - generate() { - const { chunkGraph, chunk } = this; - const { runtimeTemplate } = this.compilation; - const fn = RuntimeGlobals.ensureChunkHandlers; - const withBaseURI = this.runtimeRequirements.has(RuntimeGlobals.baseURI); - const withExternalInstallChunk = this.runtimeRequirements.has( - RuntimeGlobals.externalInstallChunk - ); - const withOnChunkLoad = this.runtimeRequirements.has( - RuntimeGlobals.onChunksLoaded - ); - const withLoading = this.runtimeRequirements.has( - RuntimeGlobals.ensureChunkHandlers - ); - const withHmr = this.runtimeRequirements.has( - RuntimeGlobals.hmrDownloadUpdateHandlers - ); - const withHmrManifest = this.runtimeRequirements.has( - RuntimeGlobals.hmrDownloadManifest - ); - const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs); - const hasJsMatcher = compileBooleanMatcher(conditionMap); - const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); - - const outputName = this.compilation.getPath( - getChunkFilenameTemplate(chunk, this.compilation.outputOptions), - { - chunk, - contentHashType: "javascript" - } - ); - const rootOutputDir = getUndoPath( - outputName, - this.compilation.outputOptions.path, - true - ); - - const stateExpression = withHmr - ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_require` - : undefined; + constructor({ path, context, test, mode }) { + this._path = path; + this._context = context; + this._test = test || (() => true); + const readAndWrite = !mode || mode === "merge" || mode === "update"; + this._read = readAndWrite || mode === "read"; + this._write = readAndWrite || mode === "create"; + this._prune = mode === "update"; + } - return Template.asString([ - withBaseURI - ? Template.asString([ - `${RuntimeGlobals.baseURI} = require("url").pathToFileURL(${ - rootOutputDir !== "./" - ? `__dirname + ${JSON.stringify("/" + rootOutputDir)}` - : "__filename" - });` - ]) - : "// no baseURI", - "", - "// object to store loaded chunks", - '// "1" means "loaded", otherwise not loaded yet', - `var installedChunks = ${ - stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" - }{`, - Template.indent( - Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 1`).join( - ",\n" - ) - ), - "};", - "", - withOnChunkLoad - ? `${ - RuntimeGlobals.onChunksLoaded - }.require = ${runtimeTemplate.returningFunction( - "installedChunks[chunkId]", - "chunkId" - )};` - : "// no on chunks loaded", - "", - withLoading || withExternalInstallChunk - ? `var installChunk = ${runtimeTemplate.basicFunction("chunk", [ - "var moreModules = chunk.modules, chunkIds = chunk.ids, runtime = chunk.runtime;", - "for(var moduleId in moreModules) {", - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, - Template.indent([ - `${RuntimeGlobals.moduleFactories}[moduleId] = moreModules[moduleId];` - ]), - "}" - ]), - "}", - `if(runtime) runtime(__webpack_require__);`, - "for(var i = 0; i < chunkIds.length; i++)", - Template.indent("installedChunks[chunkIds[i]] = 1;"), - withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : "" - ])};` - : "// no chunk install function needed", - "", - withLoading - ? Template.asString([ - "// require() chunk loading for javascript", - `${fn}.require = ${runtimeTemplate.basicFunction( - "chunkId, promises", - hasJsMatcher !== false - ? [ - '// "1" is the signal for "already loaded"', - "if(!installedChunks[chunkId]) {", - Template.indent([ - hasJsMatcher === true - ? "if(true) { // all chunks have JS" - : `if(${hasJsMatcher("chunkId")}) {`, - Template.indent([ - `installChunk(require(${JSON.stringify( - rootOutputDir - )} + ${ - RuntimeGlobals.getChunkScriptFilename - }(chunkId)));` - ]), - "} else installedChunks[chunkId] = 1;", - "" - ]), - "}" - ] - : "installedChunks[chunkId] = 1;" - )};` - ]) - : "// no chunk loading", - "", - withExternalInstallChunk - ? Template.asString([ - "module.exports = __webpack_require__;", - `${RuntimeGlobals.externalInstallChunk} = installChunk;` - ]) - : "// no external install chunk", - "", - withHmr - ? Template.asString([ - "function loadUpdateChunk(chunkId, updatedModulesList) {", - Template.indent([ - `var update = require(${JSON.stringify(rootOutputDir)} + ${ - RuntimeGlobals.getChunkUpdateScriptFilename - }(chunkId));`, - "var updatedModules = update.modules;", - "var runtime = update.runtime;", - "for(var moduleId in updatedModules) {", - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(updatedModules, moduleId)) {`, - Template.indent([ - `currentUpdate[moduleId] = updatedModules[moduleId];`, - "if(updatedModulesList) updatedModulesList.push(moduleId);" - ]), - "}" - ]), - "}", - "if(runtime) currentUpdateRuntime.push(runtime);" - ]), - "}", - "", - Template.getFunctionContent( - require('./JavascriptHotModuleReplacement.runtime.js') - ) - .replace(/\$key\$/g, "require") - .replace(/\$installedChunks\$/g, "installedChunks") - .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") - .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) - .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) - .replace( - /\$ensureChunkHandlers\$/g, - RuntimeGlobals.ensureChunkHandlers - ) - .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) - .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) - .replace( - /\$hmrDownloadUpdateHandlers\$/g, - RuntimeGlobals.hmrDownloadUpdateHandlers - ) - .replace( - /\$hmrInvalidateModuleHandlers\$/g, - RuntimeGlobals.hmrInvalidateModuleHandlers - ) - ]) - : "// no HMR", - "", - withHmrManifest - ? Template.asString([ - `${RuntimeGlobals.hmrDownloadManifest} = function() {`, - Template.indent([ - "return Promise.resolve().then(function() {", - Template.indent([ - `return require(${JSON.stringify(rootOutputDir)} + ${ - RuntimeGlobals.getUpdateManifestFilename - }());` - ]), - "})['catch'](function(err) { if(err.code !== 'MODULE_NOT_FOUND') throw err; });" - ]), - "}" - ]) - : "// no HMR manifest" - ]); + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + /** @type {Map} */ + let data; + let dataChanged = false; + if (this._read) { + compiler.hooks.readRecords.tapAsync(plugin, callback => { + const fs = compiler.intermediateFileSystem; + fs.readFile(this._path, (err, buffer) => { + if (err) { + if (err.code !== "ENOENT") { + return callback(err); + } + return callback(); + } + const json = JSON.parse(buffer.toString()); + data = new Map(); + for (const key of Object.keys(json)) { + data.set(key, json[key]); + } + dataChanged = false; + return callback(); + }); + }); + } + if (this._write) { + compiler.hooks.emitRecords.tapAsync(plugin, callback => { + if (!data || !dataChanged) return callback(); + const json = {}; + const sorted = Array.from(data).sort(([a], [b]) => (a < b ? -1 : 1)); + for (const [key, value] of sorted) { + json[key] = value; + } + const fs = compiler.intermediateFileSystem; + fs.writeFile(this._path, JSON.stringify(json), callback); + }); + } + compiler.hooks.thisCompilation.tap(plugin, compilation => { + const associatedObjectForCache = compiler.root; + const context = this._context || compiler.context; + if (this._read) { + compilation.hooks.reviveModules.tap(plugin, (_1, _2) => { + if (!data) return; + const { chunkGraph } = compilation; + const [usedIds, modules] = getUsedModuleIdsAndModules( + compilation, + this._test + ); + for (const module of modules) { + const name = module.libIdent({ + context, + associatedObjectForCache + }); + if (!name) continue; + const id = data.get(name); + const idAsString = `${id}`; + if (usedIds.has(idAsString)) { + const err = new WebpackError( + `SyncModuleIdsPlugin: Unable to restore id '${id}' from '${this._path}' as it's already used.` + ); + err.module = module; + compilation.errors.push(err); + } + chunkGraph.setModuleId(module, id); + usedIds.add(idAsString); + } + }); + } + if (this._write) { + compilation.hooks.recordModules.tap(plugin, modules => { + const { chunkGraph } = compilation; + let oldData = data; + if (!oldData) { + oldData = data = new Map(); + } else if (this._prune) { + data = new Map(); + } + for (const module of modules) { + if (this._test(module)) { + const name = module.libIdent({ + context, + associatedObjectForCache + }); + if (!name) continue; + const id = chunkGraph.getModuleId(module); + if (id === null) continue; + const oldId = oldData.get(name); + if (oldId !== id) { + dataChanged = true; + } else if (data === oldData) { + continue; + } + data.set(name, id); + } + } + if (data.size !== oldData.size) dataChanged = true; + }); + } + }); } } -module.exports = RequireChunkLoadingRuntimeModule; +module.exports = SyncModuleIdsPlugin; /***/ }), -/***/ 91786: +/***/ 91919: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -99364,246 +95204,582 @@ module.exports = RequireChunkLoadingRuntimeModule; const util = __webpack_require__(73837); -const truncateArgs = __webpack_require__(62090); +const memoize = __webpack_require__(78676); -module.exports = ({ colors, appendOnly, stream }) => { - let currentStatusMessage = undefined; - let hasStatusMessage = false; - let currentIndent = ""; - let currentCollapsed = 0; +/** @typedef {import("../declarations/WebpackOptions").Entry} Entry */ +/** @typedef {import("../declarations/WebpackOptions").EntryNormalized} EntryNormalized */ +/** @typedef {import("../declarations/WebpackOptions").EntryObject} EntryObject */ +/** @typedef {import("../declarations/WebpackOptions").FileCacheOptions} FileCacheOptions */ +/** @typedef {import("../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../declarations/WebpackOptions").ModuleOptions} ModuleOptions */ +/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ +/** @typedef {import("../declarations/WebpackOptions").RuleSetCondition} RuleSetCondition */ +/** @typedef {import("../declarations/WebpackOptions").RuleSetConditionAbsolute} RuleSetConditionAbsolute */ +/** @typedef {import("../declarations/WebpackOptions").RuleSetRule} RuleSetRule */ +/** @typedef {import("../declarations/WebpackOptions").RuleSetUse} RuleSetUse */ +/** @typedef {import("../declarations/WebpackOptions").RuleSetUseItem} RuleSetUseItem */ +/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} Configuration */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptionsNormalized */ +/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */ +/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */ +/** @typedef {import("./Compilation").Asset} Asset */ +/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("./Compilation").EntryOptions} EntryOptions */ +/** @typedef {import("./Compiler").AssetEmittedInfo} AssetEmittedInfo */ +/** @typedef {import("./MultiStats")} MultiStats */ +/** @typedef {import("./Parser").ParserState} ParserState */ +/** @typedef {import("./ResolverFactory").ResolvePluginInstance} ResolvePluginInstance */ +/** @typedef {import("./ResolverFactory").Resolver} Resolver */ +/** @typedef {import("./Watching")} Watching */ +/** @typedef {import("./cli").Argument} Argument */ +/** @typedef {import("./cli").Problem} Problem */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunk} StatsChunk */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunkGroup} StatsChunkGroup */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunkOrigin} StatsChunkOrigin */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsError} StatsError */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsLogging} StatsLogging */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsLoggingEntry} StatsLoggingEntry */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModule} StatsModule */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleIssuer} StatsModuleIssuer */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleReason} StatsModuleReason */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleTraceDependency} StatsModuleTraceDependency */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleTraceItem} StatsModuleTraceItem */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsProfile} StatsProfile */ - const indent = (str, prefix, colorPrefix, colorSuffix) => { - if (str === "") return str; - prefix = currentIndent + prefix; - if (colors) { - return ( - prefix + - colorPrefix + - str.replace(/\n/g, colorSuffix + "\n" + prefix + colorPrefix) + - colorSuffix - ); - } else { - return prefix + str.replace(/\n/g, "\n" + prefix); +/** + * @template {Function} T + * @param {function(): T} factory factory function + * @returns {T} function + */ +const lazyFunction = factory => { + const fac = memoize(factory); + const f = /** @type {any} */ ( + (...args) => { + return fac()(...args); } - }; + ); + return /** @type {T} */ (f); +}; - const clearStatusMessage = () => { - if (hasStatusMessage) { - stream.write("\x1b[2K\r"); - hasStatusMessage = false; +/** + * @template A + * @template B + * @param {A} obj input a + * @param {B} exports input b + * @returns {A & B} merged + */ +const mergeExports = (obj, exports) => { + const descriptors = Object.getOwnPropertyDescriptors(exports); + for (const name of Object.keys(descriptors)) { + const descriptor = descriptors[name]; + if (descriptor.get) { + const fn = descriptor.get; + Object.defineProperty(obj, name, { + configurable: false, + enumerable: true, + get: memoize(fn) + }); + } else if (typeof descriptor.value === "object") { + Object.defineProperty(obj, name, { + configurable: false, + enumerable: true, + writable: false, + value: mergeExports({}, descriptor.value) + }); + } else { + throw new Error( + "Exposed values must be either a getter or an nested object" + ); } - }; - - const writeStatusMessage = () => { - if (!currentStatusMessage) return; - const l = stream.columns; - const args = l - ? truncateArgs(currentStatusMessage, l - 1) - : currentStatusMessage; - const str = args.join(" "); - const coloredStr = `\u001b[1m${str}\u001b[39m\u001b[22m`; - stream.write(`\x1b[2K\r${coloredStr}`); - hasStatusMessage = true; - }; + } + return /** @type {A & B} */ (Object.freeze(obj)); +}; - const writeColored = (prefix, colorPrefix, colorSuffix) => { - return (...args) => { - if (currentCollapsed > 0) return; - clearStatusMessage(); - const str = indent( - util.format(...args), - prefix, - colorPrefix, - colorSuffix - ); - stream.write(str + "\n"); - writeStatusMessage(); +const fn = lazyFunction(() => __webpack_require__(36243)); +module.exports = mergeExports(fn, { + get webpack() { + return __webpack_require__(36243); + }, + get validate() { + const webpackOptionsSchemaCheck = __webpack_require__(10382); + const getRealValidate = memoize(() => { + const validateSchema = __webpack_require__(12047); + const webpackOptionsSchema = __webpack_require__(73342); + return options => validateSchema(webpackOptionsSchema, options); + }); + return options => { + if (!webpackOptionsSchemaCheck(options)) getRealValidate()(options); }; - }; + }, + get validateSchema() { + const validateSchema = __webpack_require__(12047); + return validateSchema; + }, + get version() { + return /** @type {string} */ ((__webpack_require__(32702)/* .version */ .i8)); + }, - const writeGroupMessage = writeColored( - "<-> ", - "\u001b[1m\u001b[36m", - "\u001b[39m\u001b[22m" - ); + get cli() { + return __webpack_require__(13462); + }, + get AutomaticPrefetchPlugin() { + return __webpack_require__(17714); + }, + get AsyncDependenciesBlock() { + return __webpack_require__(47736); + }, + get BannerPlugin() { + return __webpack_require__(21242); + }, + get Cache() { + return __webpack_require__(7592); + }, + get Chunk() { + return __webpack_require__(39385); + }, + get ChunkGraph() { + return __webpack_require__(64971); + }, + get CleanPlugin() { + return __webpack_require__(31085); + }, + get Compilation() { + return __webpack_require__(85720); + }, + get Compiler() { + return __webpack_require__(70845); + }, + get ConcatenationScope() { + return __webpack_require__(98229); + }, + get ContextExclusionPlugin() { + return __webpack_require__(21411); + }, + get ContextReplacementPlugin() { + return __webpack_require__(12206); + }, + get DefinePlugin() { + return __webpack_require__(79065); + }, + get DelegatedPlugin() { + return __webpack_require__(80632); + }, + get Dependency() { + return __webpack_require__(54912); + }, + get DllPlugin() { + return __webpack_require__(40038); + }, + get DllReferencePlugin() { + return __webpack_require__(90999); + }, + get DynamicEntryPlugin() { + return __webpack_require__(96475); + }, + get EntryOptionPlugin() { + return __webpack_require__(9909); + }, + get EntryPlugin() { + return __webpack_require__(96953); + }, + get EnvironmentPlugin() { + return __webpack_require__(22070); + }, + get EvalDevToolModulePlugin() { + return __webpack_require__(65218); + }, + get EvalSourceMapDevToolPlugin() { + return __webpack_require__(14790); + }, + get ExternalModule() { + return __webpack_require__(73071); + }, + get ExternalsPlugin() { + return __webpack_require__(6652); + }, + get Generator() { + return __webpack_require__(93401); + }, + get HotUpdateChunk() { + return __webpack_require__(9597); + }, + get HotModuleReplacementPlugin() { + return __webpack_require__(6404); + }, + get IgnorePlugin() { + return __webpack_require__(84808); + }, + get JavascriptModulesPlugin() { + return util.deprecate( + () => __webpack_require__(89464), + "webpack.JavascriptModulesPlugin has moved to webpack.javascript.JavascriptModulesPlugin", + "DEP_WEBPACK_JAVASCRIPT_MODULES_PLUGIN" + )(); + }, + get LibManifestPlugin() { + return __webpack_require__(93837); + }, + get LibraryTemplatePlugin() { + return util.deprecate( + () => __webpack_require__(14157), + "webpack.LibraryTemplatePlugin is deprecated and has been replaced by compilation.outputOptions.library or compilation.addEntry + passing a library option", + "DEP_WEBPACK_LIBRARY_TEMPLATE_PLUGIN" + )(); + }, + get LoaderOptionsPlugin() { + return __webpack_require__(22078); + }, + get LoaderTargetPlugin() { + return __webpack_require__(86738); + }, + get Module() { + return __webpack_require__(73208); + }, + get ModuleFilenameHelpers() { + return __webpack_require__(88821); + }, + get ModuleGraph() { + return __webpack_require__(99988); + }, + get ModuleGraphConnection() { + return __webpack_require__(40639); + }, + get NoEmitOnErrorsPlugin() { + return __webpack_require__(50169); + }, + get NormalModule() { + return __webpack_require__(39); + }, + get NormalModuleReplacementPlugin() { + return __webpack_require__(30633); + }, + get MultiCompiler() { + return __webpack_require__(33370); + }, + get Parser() { + return __webpack_require__(11715); + }, + get PrefetchPlugin() { + return __webpack_require__(73850); + }, + get ProgressPlugin() { + return __webpack_require__(13216); + }, + get ProvidePlugin() { + return __webpack_require__(38309); + }, + get RuntimeGlobals() { + return __webpack_require__(16475); + }, + get RuntimeModule() { + return __webpack_require__(16963); + }, + get SingleEntryPlugin() { + return util.deprecate( + () => __webpack_require__(96953), + "SingleEntryPlugin was renamed to EntryPlugin", + "DEP_WEBPACK_SINGLE_ENTRY_PLUGIN" + )(); + }, + get SourceMapDevToolPlugin() { + return __webpack_require__(63872); + }, + get Stats() { + return __webpack_require__(31743); + }, + get Template() { + return __webpack_require__(39722); + }, + get UsageState() { + return (__webpack_require__(63686).UsageState); + }, + get WatchIgnorePlugin() { + return __webpack_require__(65193); + }, + get WebpackError() { + return __webpack_require__(53799); + }, + get WebpackOptionsApply() { + return __webpack_require__(88422); + }, + get WebpackOptionsDefaulter() { + return util.deprecate( + () => __webpack_require__(14452), + "webpack.WebpackOptionsDefaulter is deprecated and has been replaced by webpack.config.getNormalizedWebpackOptions and webpack.config.applyWebpackOptionsDefaults", + "DEP_WEBPACK_OPTIONS_DEFAULTER" + )(); + }, + // TODO webpack 6 deprecate + get WebpackOptionsValidationError() { + return (__webpack_require__(38476).ValidationError); + }, + get ValidationError() { + return (__webpack_require__(38476).ValidationError); + }, - const writeGroupCollapsedMessage = writeColored( - "<+> ", - "\u001b[1m\u001b[36m", - "\u001b[39m\u001b[22m" - ); + cache: { + get MemoryCachePlugin() { + return __webpack_require__(52539); + } + }, - return { - log: writeColored(" ", "\u001b[1m", "\u001b[22m"), - debug: writeColored(" ", "", ""), - trace: writeColored(" ", "", ""), - info: writeColored(" ", "\u001b[1m\u001b[32m", "\u001b[39m\u001b[22m"), - warn: writeColored(" ", "\u001b[1m\u001b[33m", "\u001b[39m\u001b[22m"), - error: writeColored(" ", "\u001b[1m\u001b[31m", "\u001b[39m\u001b[22m"), - logTime: writeColored( - " ", - "\u001b[1m\u001b[35m", - "\u001b[39m\u001b[22m" - ), - group: (...args) => { - writeGroupMessage(...args); - if (currentCollapsed > 0) { - currentCollapsed++; - } else { - currentIndent += " "; - } + config: { + get getNormalizedWebpackOptions() { + return (__webpack_require__(26693).getNormalizedWebpackOptions); }, - groupCollapsed: (...args) => { - writeGroupCollapsedMessage(...args); - currentCollapsed++; + get applyWebpackOptionsDefaults() { + return (__webpack_require__(92988).applyWebpackOptionsDefaults); + } + }, + + dependencies: { + get ModuleDependency() { + return __webpack_require__(80321); + }, + get ConstDependency() { + return __webpack_require__(76911); + }, + get NullDependency() { + return __webpack_require__(31830); + } + }, + + ids: { + get ChunkModuleIdRangePlugin() { + return __webpack_require__(64618); + }, + get NaturalModuleIdsPlugin() { + return __webpack_require__(83366); + }, + get OccurrenceModuleIdsPlugin() { + return __webpack_require__(35371); + }, + get NamedModuleIdsPlugin() { + return __webpack_require__(24339); + }, + get DeterministicChunkIdsPlugin() { + return __webpack_require__(8747); + }, + get DeterministicModuleIdsPlugin() { + return __webpack_require__(76692); + }, + get NamedChunkIdsPlugin() { + return __webpack_require__(6454); + }, + get OccurrenceChunkIdsPlugin() { + return __webpack_require__(51020); }, - groupEnd: () => { - if (currentCollapsed > 0) currentCollapsed--; - else if (currentIndent.length >= 2) - currentIndent = currentIndent.slice(0, currentIndent.length - 2); + get HashedModuleIdsPlugin() { + return __webpack_require__(21825); + } + }, + + javascript: { + get EnableChunkLoadingPlugin() { + return __webpack_require__(61291); }, - // eslint-disable-next-line node/no-unsupported-features/node-builtins - profile: console.profile && (name => console.profile(name)), - // eslint-disable-next-line node/no-unsupported-features/node-builtins - profileEnd: console.profileEnd && (name => console.profileEnd(name)), - clear: - !appendOnly && - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.clear && - (() => { - clearStatusMessage(); - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.clear(); - writeStatusMessage(); - }), - status: appendOnly - ? writeColored(" ", "", "") - : (name, ...args) => { - args = args.filter(Boolean); - if (name === undefined && args.length === 0) { - clearStatusMessage(); - currentStatusMessage = undefined; - } else if ( - typeof name === "string" && - name.startsWith("[webpack.Progress] ") - ) { - currentStatusMessage = [name.slice(19), ...args]; - writeStatusMessage(); - } else if (name === "[webpack.Progress]") { - currentStatusMessage = [...args]; - writeStatusMessage(); - } else { - currentStatusMessage = [name, ...args]; - writeStatusMessage(); - } - } - }; -}; + get JavascriptModulesPlugin() { + return __webpack_require__(89464); + }, + get JavascriptParser() { + return __webpack_require__(29050); + } + }, + optimize: { + get AggressiveMergingPlugin() { + return __webpack_require__(64395); + }, + get AggressiveSplittingPlugin() { + return util.deprecate( + () => __webpack_require__(15543), + "AggressiveSplittingPlugin is deprecated in favor of SplitChunksPlugin", + "DEP_WEBPACK_AGGRESSIVE_SPLITTING_PLUGIN" + )(); + }, + get InnerGraph() { + return __webpack_require__(38988); + }, + get LimitChunkCountPlugin() { + return __webpack_require__(83608); + }, + get MinChunkSizePlugin() { + return __webpack_require__(53912); + }, + get ModuleConcatenationPlugin() { + return __webpack_require__(74844); + }, + get RealContentHashPlugin() { + return __webpack_require__(46043); + }, + get RuntimeChunkPlugin() { + return __webpack_require__(2837); + }, + get SideEffectsFlagPlugin() { + return __webpack_require__(84800); + }, + get SplitChunksPlugin() { + return __webpack_require__(21478); + } + }, -/***/ }), + runtime: { + get GetChunkFilenameRuntimeModule() { + return __webpack_require__(34277); + }, + get LoadScriptRuntimeModule() { + return __webpack_require__(19942); + } + }, -/***/ 64395: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + prefetch: { + get ChunkPrefetchPreloadPlugin() { + return __webpack_require__(33895); + } + }, -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + web: { + get FetchCompileAsyncWasmPlugin() { + return __webpack_require__(8437); + }, + get FetchCompileWasmPlugin() { + return __webpack_require__(35537); + }, + get JsonpChunkLoadingRuntimeModule() { + return __webpack_require__(84154); + }, + get JsonpTemplatePlugin() { + return __webpack_require__(4607); + } + }, + webworker: { + get WebWorkerTemplatePlugin() { + return __webpack_require__(68693); + } + }, + node: { + get NodeEnvironmentPlugin() { + return __webpack_require__(7553); + }, + get NodeSourcePlugin() { + return __webpack_require__(7103); + }, + get NodeTargetPlugin() { + return __webpack_require__(17916); + }, + get NodeTemplatePlugin() { + return __webpack_require__(61052); + }, + get ReadFileCompileWasmPlugin() { + return __webpack_require__(98939); + } + }, -const { STAGE_ADVANCED } = __webpack_require__(80057); + electron: { + get ElectronTargetPlugin() { + return __webpack_require__(32277); + } + }, -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ + wasm: { + get AsyncWebAssemblyModulesPlugin() { + return __webpack_require__(7538); + } + }, -class AggressiveMergingPlugin { - constructor(options) { - if ( - (options !== undefined && typeof options !== "object") || - Array.isArray(options) - ) { - throw new Error( - "Argument should be an options object. To use defaults, pass in nothing.\nFor more info on options, see https://webpack.js.org/plugins/" - ); + library: { + get AbstractLibraryPlugin() { + return __webpack_require__(26030); + }, + get EnableLibraryPlugin() { + return __webpack_require__(91452); } - this.options = options || {}; - } + }, - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const options = this.options; - const minSizeReduce = options.minSizeReduce || 1.5; + container: { + get ContainerPlugin() { + return __webpack_require__(9244); + }, + get ContainerReferencePlugin() { + return __webpack_require__(95757); + }, + get ModuleFederationPlugin() { + return __webpack_require__(30569); + }, + get scope() { + return (__webpack_require__(3083).scope); + } + }, - compiler.hooks.thisCompilation.tap( - "AggressiveMergingPlugin", - compilation => { - compilation.hooks.optimizeChunks.tap( - { - name: "AggressiveMergingPlugin", - stage: STAGE_ADVANCED - }, - chunks => { - const chunkGraph = compilation.chunkGraph; - /** @type {{a: Chunk, b: Chunk, improvement: number}[]} */ - let combinations = []; - for (const a of chunks) { - if (a.canBeInitial()) continue; - for (const b of chunks) { - if (b.canBeInitial()) continue; - if (b === a) break; - if (!chunkGraph.canChunksBeIntegrated(a, b)) { - continue; - } - const aSize = chunkGraph.getChunkSize(b, { - chunkOverhead: 0 - }); - const bSize = chunkGraph.getChunkSize(a, { - chunkOverhead: 0 - }); - const abSize = chunkGraph.getIntegratedChunksSize(b, a, { - chunkOverhead: 0 - }); - const improvement = (aSize + bSize) / abSize; - combinations.push({ - a, - b, - improvement - }); - } - } + sharing: { + get ConsumeSharedPlugin() { + return __webpack_require__(15046); + }, + get ProvideSharedPlugin() { + return __webpack_require__(31225); + }, + get SharePlugin() { + return __webpack_require__(26335); + }, + get scope() { + return (__webpack_require__(3083).scope); + } + }, - combinations.sort((a, b) => { - return b.improvement - a.improvement; - }); + debug: { + get ProfilingPlugin() { + return __webpack_require__(2757); + } + }, - const pair = combinations[0]; + util: { + get createHash() { + return __webpack_require__(49835); + }, + get comparators() { + return __webpack_require__(29579); + }, + get runtime() { + return __webpack_require__(17156); + }, + get serialization() { + return __webpack_require__(8282); + }, + get cleverMerge() { + return (__webpack_require__(60839).cachedCleverMerge); + }, + get LazySet() { + return __webpack_require__(38938); + } + }, - if (!pair) return; - if (pair.improvement < minSizeReduce) return; + get sources() { + return __webpack_require__(51255); + }, - chunkGraph.integrateChunks(pair.b, pair.a); - compilation.chunks.delete(pair.a); - return true; - } - ); + experiments: { + schemes: { + get HttpUriPlugin() { + return __webpack_require__(42110); } - ); + }, + ids: { + get SyncModuleIdsPlugin() { + return __webpack_require__(8635); + } + } } -} - -module.exports = AggressiveMergingPlugin; +}); /***/ }), -/***/ 15543: +/***/ 18535: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -99614,334 +95790,159 @@ module.exports = AggressiveMergingPlugin; -const { STAGE_ADVANCED } = __webpack_require__(80057); -const { intersect } = __webpack_require__(93347); -const { - compareModulesByIdentifier, - compareChunks -} = __webpack_require__(29579); -const createSchemaValidation = __webpack_require__(32540); -const identifierUtils = __webpack_require__(82186); - -/** @typedef {import("../../declarations/plugins/optimize/AggressiveSplittingPlugin").AggressiveSplittingPluginOptions} AggressiveSplittingPluginOptions */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ - -const validate = createSchemaValidation( - __webpack_require__(32697), - () => - __webpack_require__(47995), - { - name: "Aggressive Splitting Plugin", - baseDataPath: "options" - } -); - -const moveModuleBetween = (chunkGraph, oldChunk, newChunk) => { - return module => { - chunkGraph.disconnectChunkAndModule(oldChunk, module); - chunkGraph.connectChunkAndModule(newChunk, module); - }; -}; - -/** - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {Chunk} chunk the chunk - * @returns {function(Module): boolean} filter for entry module - */ -const isNotAEntryModule = (chunkGraph, chunk) => { - return module => { - return !chunkGraph.isEntryModuleInChunk(module, chunk); - }; -}; - -/** @type {WeakSet} */ -const recordedChunks = new WeakSet(); - -class AggressiveSplittingPlugin { - /** - * @param {AggressiveSplittingPluginOptions=} options options object - */ - constructor(options = {}) { - validate(options); - - this.options = options; - if (typeof this.options.minSize !== "number") { - this.options.minSize = 30 * 1024; - } - if (typeof this.options.maxSize !== "number") { - this.options.maxSize = 50 * 1024; - } - if (typeof this.options.chunkOverhead !== "number") { - this.options.chunkOverhead = 0; - } - if (typeof this.options.entryChunkMultiplicator !== "number") { - this.options.entryChunkMultiplicator = 1; - } - } - - /** - * @param {Chunk} chunk the chunk to test - * @returns {boolean} true if the chunk was recorded - */ - static wasChunkRecorded(chunk) { - return recordedChunks.has(chunk); - } - - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - "AggressiveSplittingPlugin", - compilation => { - let needAdditionalSeal = false; - let newSplits; - let fromAggressiveSplittingSet; - let chunkSplitDataMap; - compilation.hooks.optimize.tap("AggressiveSplittingPlugin", () => { - newSplits = []; - fromAggressiveSplittingSet = new Set(); - chunkSplitDataMap = new Map(); - }); - compilation.hooks.optimizeChunks.tap( - { - name: "AggressiveSplittingPlugin", - stage: STAGE_ADVANCED - }, - chunks => { - const chunkGraph = compilation.chunkGraph; - // Precompute stuff - const nameToModuleMap = new Map(); - const moduleToNameMap = new Map(); - const makePathsRelative = - identifierUtils.makePathsRelative.bindContextCache( - compiler.context, - compiler.root - ); - for (const m of compilation.modules) { - const name = makePathsRelative(m.identifier()); - nameToModuleMap.set(name, m); - moduleToNameMap.set(m, name); - } - - // Check used chunk ids - const usedIds = new Set(); - for (const chunk of chunks) { - usedIds.add(chunk.id); - } - - const recordedSplits = - (compilation.records && compilation.records.aggressiveSplits) || - []; - const usedSplits = newSplits - ? recordedSplits.concat(newSplits) - : recordedSplits; - - const minSize = this.options.minSize; - const maxSize = this.options.maxSize; - - const applySplit = splitData => { - // Cannot split if id is already taken - if (splitData.id !== undefined && usedIds.has(splitData.id)) { - return false; - } - - // Get module objects from names - const selectedModules = splitData.modules.map(name => - nameToModuleMap.get(name) - ); - - // Does the modules exist at all? - if (!selectedModules.every(Boolean)) return false; - - // Check if size matches (faster than waiting for hash) - let size = 0; - for (const m of selectedModules) size += m.size(); - if (size !== splitData.size) return false; - - // get chunks with all modules - const selectedChunks = intersect( - selectedModules.map( - m => new Set(chunkGraph.getModuleChunksIterable(m)) - ) - ); - - // No relevant chunks found - if (selectedChunks.size === 0) return false; - - // The found chunk is already the split or similar - if ( - selectedChunks.size === 1 && - chunkGraph.getNumberOfChunkModules( - Array.from(selectedChunks)[0] - ) === selectedModules.length - ) { - const chunk = Array.from(selectedChunks)[0]; - if (fromAggressiveSplittingSet.has(chunk)) return false; - fromAggressiveSplittingSet.add(chunk); - chunkSplitDataMap.set(chunk, splitData); - return true; - } - - // split the chunk into two parts - const newChunk = compilation.addChunk(); - newChunk.chunkReason = "aggressive splitted"; - for (const chunk of selectedChunks) { - selectedModules.forEach( - moveModuleBetween(chunkGraph, chunk, newChunk) - ); - chunk.split(newChunk); - chunk.name = null; - } - fromAggressiveSplittingSet.add(newChunk); - chunkSplitDataMap.set(newChunk, splitData); - - if (splitData.id !== null && splitData.id !== undefined) { - newChunk.id = splitData.id; - newChunk.ids = [splitData.id]; - } - return true; - }; - - // try to restore to recorded splitting - let changed = false; - for (let j = 0; j < usedSplits.length; j++) { - const splitData = usedSplits[j]; - if (applySplit(splitData)) changed = true; - } +const { ConcatSource, PrefixSource, RawSource } = __webpack_require__(51255); +const { RuntimeGlobals } = __webpack_require__(91919); +const HotUpdateChunk = __webpack_require__(9597); +const Template = __webpack_require__(39722); +const { getCompilationHooks } = __webpack_require__(89464); +const { + generateEntryStartup, + updateHashForEntryStartup +} = __webpack_require__(98124); - // for any chunk which isn't splitted yet, split it and create a new entry - // start with the biggest chunk - const cmpFn = compareChunks(chunkGraph); - const sortedChunks = Array.from(chunks).sort((a, b) => { - const diff1 = - chunkGraph.getChunkModulesSize(b) - - chunkGraph.getChunkModulesSize(a); - if (diff1) return diff1; - const diff2 = - chunkGraph.getNumberOfChunkModules(a) - - chunkGraph.getNumberOfChunkModules(b); - if (diff2) return diff2; - return cmpFn(a, b); - }); - for (const chunk of sortedChunks) { - if (fromAggressiveSplittingSet.has(chunk)) continue; - const size = chunkGraph.getChunkModulesSize(chunk); - if ( - size > maxSize && - chunkGraph.getNumberOfChunkModules(chunk) > 1 - ) { - const modules = chunkGraph - .getOrderedChunkModules(chunk, compareModulesByIdentifier) - .filter(isNotAEntryModule(chunkGraph, chunk)); - const selectedModules = []; - let selectedModulesSize = 0; - for (let k = 0; k < modules.length; k++) { - const module = modules[k]; - const newSize = selectedModulesSize + module.size(); - if (newSize > maxSize && selectedModulesSize >= minSize) { - break; - } - selectedModulesSize = newSize; - selectedModules.push(module); - } - if (selectedModules.length === 0) continue; - const splitData = { - modules: selectedModules - .map(m => moduleToNameMap.get(m)) - .sort(), - size: selectedModulesSize - }; +/** @typedef {import("../Compiler")} Compiler */ - if (applySplit(splitData)) { - newSplits = (newSplits || []).concat(splitData); - changed = true; - } - } +class ArrayPushCallbackChunkFormatPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "ArrayPushCallbackChunkFormatPlugin", + compilation => { + compilation.hooks.additionalChunkRuntimeRequirements.tap( + "ArrayPushCallbackChunkFormatPlugin", + (chunk, set, { chunkGraph }) => { + if (chunk.hasRuntime()) return; + if (chunkGraph.getNumberOfEntryModules(chunk) > 0) { + set.add(RuntimeGlobals.onChunksLoaded); + set.add(RuntimeGlobals.require); } - if (changed) return true; + set.add(RuntimeGlobals.chunkCallback); } ); - compilation.hooks.recordHash.tap( - "AggressiveSplittingPlugin", - records => { - // 4. save made splittings to records - const allSplits = new Set(); - const invalidSplits = new Set(); - - // Check if some splittings are invalid - // We remove invalid splittings and try again - for (const chunk of compilation.chunks) { - const splitData = chunkSplitDataMap.get(chunk); - if (splitData !== undefined) { - if (splitData.hash && chunk.hash !== splitData.hash) { - // Split was successful, but hash doesn't equal - // We can throw away the split since it's useless now - invalidSplits.add(splitData); - } - } - } - - if (invalidSplits.size > 0) { - records.aggressiveSplits = records.aggressiveSplits.filter( - splitData => !invalidSplits.has(splitData) + const hooks = getCompilationHooks(compilation); + hooks.renderChunk.tap( + "ArrayPushCallbackChunkFormatPlugin", + (modules, renderContext) => { + const { chunk, chunkGraph, runtimeTemplate } = renderContext; + const hotUpdateChunk = + chunk instanceof HotUpdateChunk ? chunk : null; + const globalObject = runtimeTemplate.globalObject; + const source = new ConcatSource(); + const runtimeModules = + chunkGraph.getChunkRuntimeModulesInOrder(chunk); + if (hotUpdateChunk) { + const hotUpdateGlobal = + runtimeTemplate.outputOptions.hotUpdateGlobal; + source.add( + `${globalObject}[${JSON.stringify(hotUpdateGlobal)}](` ); - needAdditionalSeal = true; + source.add(`${JSON.stringify(chunk.id)},`); + source.add(modules); + if (runtimeModules.length > 0) { + source.add(",\n"); + const runtimePart = Template.renderChunkRuntimeModules( + runtimeModules, + renderContext + ); + source.add(runtimePart); + } + source.add(")"); } else { - // set hash and id values on all (new) splittings - for (const chunk of compilation.chunks) { - const splitData = chunkSplitDataMap.get(chunk); - if (splitData !== undefined) { - splitData.hash = chunk.hash; - splitData.id = chunk.id; - allSplits.add(splitData); - // set flag for stats - recordedChunks.add(chunk); + const chunkLoadingGlobal = + runtimeTemplate.outputOptions.chunkLoadingGlobal; + source.add( + `(${globalObject}[${JSON.stringify( + chunkLoadingGlobal + )}] = ${globalObject}[${JSON.stringify( + chunkLoadingGlobal + )}] || []).push([` + ); + source.add(`${JSON.stringify(chunk.ids)},`); + source.add(modules); + const entries = Array.from( + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ); + if (runtimeModules.length > 0 || entries.length > 0) { + const runtime = new ConcatSource( + (runtimeTemplate.supportsArrowFunction() + ? "__webpack_require__ =>" + : "function(__webpack_require__)") + + " { // webpackRuntimeModules\n" + ); + if (runtimeModules.length > 0) { + runtime.add( + Template.renderRuntimeModules(runtimeModules, { + ...renderContext, + codeGenerationResults: compilation.codeGenerationResults + }) + ); } - } - - // Also add all unused historical splits (after the used ones) - // They can still be used in some future compilation - const recordedSplits = - compilation.records && compilation.records.aggressiveSplits; - if (recordedSplits) { - for (const splitData of recordedSplits) { - if (!invalidSplits.has(splitData)) allSplits.add(splitData); + if (entries.length > 0) { + const startupSource = new RawSource( + generateEntryStartup( + chunkGraph, + runtimeTemplate, + entries, + chunk, + true + ) + ); + runtime.add( + hooks.renderStartup.call( + startupSource, + entries[entries.length - 1][0], + { + ...renderContext, + inlined: false + } + ) + ); + if ( + chunkGraph + .getChunkRuntimeRequirements(chunk) + .has(RuntimeGlobals.returnExportsFromRuntime) + ) { + runtime.add("return __webpack_exports__;\n"); + } } + runtime.add("}\n"); + source.add(",\n"); + source.add(new PrefixSource("/******/ ", runtime)); } - - // record all splits - records.aggressiveSplits = Array.from(allSplits); - - needAdditionalSeal = false; + source.add("])"); } + return source; } ); - compilation.hooks.needAdditionalSeal.tap( - "AggressiveSplittingPlugin", - () => { - if (needAdditionalSeal) { - needAdditionalSeal = false; - return true; - } + hooks.chunkHash.tap( + "ArrayPushCallbackChunkFormatPlugin", + (chunk, hash, { chunkGraph, runtimeTemplate }) => { + if (chunk.hasRuntime()) return; + hash.update( + `ArrayPushCallbackChunkFormatPlugin1${runtimeTemplate.outputOptions.chunkLoadingGlobal}${runtimeTemplate.outputOptions.hotUpdateGlobal}${runtimeTemplate.globalObject}` + ); + const entries = Array.from( + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ); + updateHashForEntryStartup(hash, chunkGraph, entries, chunk); } ); } ); } } -module.exports = AggressiveSplittingPlugin; + +module.exports = ArrayPushCallbackChunkFormatPlugin; /***/ }), -/***/ 97198: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 950: +/***/ (function(module) { "use strict"; /* @@ -99951,1883 +95952,2442 @@ module.exports = AggressiveSplittingPlugin; -const eslintScope = __webpack_require__(36007); -const Referencer = __webpack_require__(44585); -const { - CachedSource, - ConcatSource, - ReplaceSource -} = __webpack_require__(51255); -const ConcatenationScope = __webpack_require__(98229); -const { UsageState } = __webpack_require__(63686); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const HarmonyImportDependency = __webpack_require__(57154); -const JavascriptParser = __webpack_require__(29050); -const { equals } = __webpack_require__(84953); -const LazySet = __webpack_require__(38938); -const { concatComparators, keepOriginalOrder } = __webpack_require__(29579); -const createHash = __webpack_require__(49835); -const { makePathsRelative } = __webpack_require__(82186); -const makeSerializable = __webpack_require__(33032); -const propertyAccess = __webpack_require__(54190); -const { - filterRuntime, - intersectRuntime, - mergeRuntimeCondition, - mergeRuntimeConditionNonFalse, - runtimeConditionToString, - subtractRuntimeCondition -} = __webpack_require__(17156); +/** @typedef {import("estree").Node} EsTreeNode */ +/** @typedef {import("./JavascriptParser").VariableInfoInterface} VariableInfoInterface */ -/** @typedef {import("eslint-scope").Scope} Scope */ -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../CodeGenerationResults")} CodeGenerationResults */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */ -/** @template T @typedef {import("../InitFragment")} InitFragment */ -/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {typeof import("../util/Hash")} HashConstructor */ -/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +const TypeUnknown = 0; +const TypeUndefined = 1; +const TypeNull = 2; +const TypeString = 3; +const TypeNumber = 4; +const TypeBoolean = 5; +const TypeRegExp = 6; +const TypeConditional = 7; +const TypeArray = 8; +const TypeConstArray = 9; +const TypeIdentifier = 10; +const TypeWrapped = 11; +const TypeTemplateString = 12; +const TypeBigInt = 13; -// fix eslint-scope to support class properties correctly -// cspell:word Referencer -const ReferencerClass = Referencer; -if (!ReferencerClass.prototype.PropertyDefinition) { - ReferencerClass.prototype.PropertyDefinition = - ReferencerClass.prototype.Property; -} +class BasicEvaluatedExpression { + constructor() { + this.type = TypeUnknown; + /** @type {[number, number]} */ + this.range = undefined; + /** @type {boolean} */ + this.falsy = false; + /** @type {boolean} */ + this.truthy = false; + /** @type {boolean | undefined} */ + this.nullish = undefined; + /** @type {boolean} */ + this.sideEffects = true; + /** @type {boolean | undefined} */ + this.bool = undefined; + /** @type {number | undefined} */ + this.number = undefined; + /** @type {bigint | undefined} */ + this.bigint = undefined; + /** @type {RegExp | undefined} */ + this.regExp = undefined; + /** @type {string | undefined} */ + this.string = undefined; + /** @type {BasicEvaluatedExpression[] | undefined} */ + this.quasis = undefined; + /** @type {BasicEvaluatedExpression[] | undefined} */ + this.parts = undefined; + /** @type {any[] | undefined} */ + this.array = undefined; + /** @type {BasicEvaluatedExpression[] | undefined} */ + this.items = undefined; + /** @type {BasicEvaluatedExpression[] | undefined} */ + this.options = undefined; + /** @type {BasicEvaluatedExpression | undefined} */ + this.prefix = undefined; + /** @type {BasicEvaluatedExpression | undefined} */ + this.postfix = undefined; + this.wrappedInnerExpressions = undefined; + /** @type {string | undefined} */ + this.identifier = undefined; + /** @type {VariableInfoInterface} */ + this.rootInfo = undefined; + /** @type {() => string[]} */ + this.getMembers = undefined; + /** @type {EsTreeNode} */ + this.expression = undefined; + } -/** - * @typedef {Object} ReexportInfo - * @property {Module} module - * @property {string[]} export - */ + isUnknown() { + return this.type === TypeUnknown; + } -/** @typedef {RawBinding | SymbolBinding} Binding */ + isNull() { + return this.type === TypeNull; + } -/** - * @typedef {Object} RawBinding - * @property {ModuleInfo} info - * @property {string} rawName - * @property {string=} comment - * @property {string[]} ids - * @property {string[]} exportName - */ + isUndefined() { + return this.type === TypeUndefined; + } -/** - * @typedef {Object} SymbolBinding - * @property {ConcatenatedModuleInfo} info - * @property {string} name - * @property {string=} comment - * @property {string[]} ids - * @property {string[]} exportName - */ + isString() { + return this.type === TypeString; + } -/** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo } ModuleInfo */ -/** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo | ReferenceToModuleInfo } ModuleInfoOrReference */ + isNumber() { + return this.type === TypeNumber; + } -/** - * @typedef {Object} ConcatenatedModuleInfo - * @property {"concatenated"} type - * @property {Module} module - * @property {number} index - * @property {Object} ast - * @property {Source} internalSource - * @property {ReplaceSource} source - * @property {InitFragment[]=} chunkInitFragments - * @property {Iterable} runtimeRequirements - * @property {Scope} globalScope - * @property {Scope} moduleScope - * @property {Map} internalNames - * @property {Map} exportMap - * @property {Map} rawExportMap - * @property {string=} namespaceExportSymbol - * @property {string} namespaceObjectName - * @property {boolean} interopNamespaceObjectUsed - * @property {string} interopNamespaceObjectName - * @property {boolean} interopNamespaceObject2Used - * @property {string} interopNamespaceObject2Name - * @property {boolean} interopDefaultAccessUsed - * @property {string} interopDefaultAccessName - */ + isBigInt() { + return this.type === TypeBigInt; + } + + isBoolean() { + return this.type === TypeBoolean; + } + + isRegExp() { + return this.type === TypeRegExp; + } + + isConditional() { + return this.type === TypeConditional; + } + + isArray() { + return this.type === TypeArray; + } + + isConstArray() { + return this.type === TypeConstArray; + } + + isIdentifier() { + return this.type === TypeIdentifier; + } + + isWrapped() { + return this.type === TypeWrapped; + } + + isTemplateString() { + return this.type === TypeTemplateString; + } + + /** + * Is expression a primitive or an object type value? + * @returns {boolean | undefined} true: primitive type, false: object type, undefined: unknown/runtime-defined + */ + isPrimitiveType() { + switch (this.type) { + case TypeUndefined: + case TypeNull: + case TypeString: + case TypeNumber: + case TypeBoolean: + case TypeBigInt: + case TypeWrapped: + case TypeTemplateString: + return true; + case TypeRegExp: + case TypeArray: + case TypeConstArray: + return false; + default: + return undefined; + } + } + + /** + * Is expression a runtime or compile-time value? + * @returns {boolean} true: compile time value, false: runtime value + */ + isCompileTimeValue() { + switch (this.type) { + case TypeUndefined: + case TypeNull: + case TypeString: + case TypeNumber: + case TypeBoolean: + case TypeRegExp: + case TypeConstArray: + case TypeBigInt: + return true; + default: + return false; + } + } + + /** + * Gets the compile-time value of the expression + * @returns {any} the javascript value + */ + asCompileTimeValue() { + switch (this.type) { + case TypeUndefined: + return undefined; + case TypeNull: + return null; + case TypeString: + return this.string; + case TypeNumber: + return this.number; + case TypeBoolean: + return this.bool; + case TypeRegExp: + return this.regExp; + case TypeConstArray: + return this.array; + case TypeBigInt: + return this.bigint; + default: + throw new Error( + "asCompileTimeValue must only be called for compile-time values" + ); + } + } -/** - * @typedef {Object} ExternalModuleInfo - * @property {"external"} type - * @property {Module} module - * @property {RuntimeSpec | boolean} runtimeCondition - * @property {number} index - * @property {string} name - * @property {boolean} interopNamespaceObjectUsed - * @property {string} interopNamespaceObjectName - * @property {boolean} interopNamespaceObject2Used - * @property {string} interopNamespaceObject2Name - * @property {boolean} interopDefaultAccessUsed - * @property {string} interopDefaultAccessName - */ + isTruthy() { + return this.truthy; + } -/** - * @typedef {Object} ReferenceToModuleInfo - * @property {"reference"} type - * @property {RuntimeSpec | boolean} runtimeCondition - * @property {ConcatenatedModuleInfo | ExternalModuleInfo} target - */ + isFalsy() { + return this.falsy; + } -const RESERVED_NAMES = new Set( - [ - // internal names (should always be renamed) - ConcatenationScope.DEFAULT_EXPORT, - ConcatenationScope.NAMESPACE_OBJECT_EXPORT, + isNullish() { + return this.nullish; + } - // keywords - "abstract,arguments,async,await,boolean,break,byte,case,catch,char,class,const,continue", - "debugger,default,delete,do,double,else,enum,eval,export,extends,false,final,finally,float", - "for,function,goto,if,implements,import,in,instanceof,int,interface,let,long,native,new,null", - "package,private,protected,public,return,short,static,super,switch,synchronized,this,throw", - "throws,transient,true,try,typeof,var,void,volatile,while,with,yield", + /** + * Can this expression have side effects? + * @returns {boolean} false: never has side effects + */ + couldHaveSideEffects() { + return this.sideEffects; + } - // commonjs/amd - "module,__dirname,__filename,exports,require,define", + asBool() { + if (this.truthy) return true; + if (this.falsy || this.nullish) return false; + if (this.isBoolean()) return this.bool; + if (this.isNull()) return false; + if (this.isUndefined()) return false; + if (this.isString()) return this.string !== ""; + if (this.isNumber()) return this.number !== 0; + if (this.isBigInt()) return this.bigint !== BigInt(0); + if (this.isRegExp()) return true; + if (this.isArray()) return true; + if (this.isConstArray()) return true; + if (this.isWrapped()) { + return (this.prefix && this.prefix.asBool()) || + (this.postfix && this.postfix.asBool()) + ? true + : undefined; + } + if (this.isTemplateString()) { + const str = this.asString(); + if (typeof str === "string") return str !== ""; + } + return undefined; + } - // js globals - "Array,Date,eval,function,hasOwnProperty,Infinity,isFinite,isNaN,isPrototypeOf,length,Math", - "NaN,name,Number,Object,prototype,String,toString,undefined,valueOf", + asNullish() { + const nullish = this.isNullish(); - // browser globals - "alert,all,anchor,anchors,area,assign,blur,button,checkbox,clearInterval,clearTimeout", - "clientInformation,close,closed,confirm,constructor,crypto,decodeURI,decodeURIComponent", - "defaultStatus,document,element,elements,embed,embeds,encodeURI,encodeURIComponent,escape", - "event,fileUpload,focus,form,forms,frame,innerHeight,innerWidth,layer,layers,link,location", - "mimeTypes,navigate,navigator,frames,frameRate,hidden,history,image,images,offscreenBuffering", - "open,opener,option,outerHeight,outerWidth,packages,pageXOffset,pageYOffset,parent,parseFloat", - "parseInt,password,pkcs11,plugin,prompt,propertyIsEnum,radio,reset,screenX,screenY,scroll", - "secure,select,self,setInterval,setTimeout,status,submit,taint,text,textarea,top,unescape", - "untaint,window", + if (nullish === true || this.isNull() || this.isUndefined()) return true; - // window events - "onblur,onclick,onerror,onfocus,onkeydown,onkeypress,onkeyup,onmouseover,onload,onmouseup,onmousedown,onsubmit" - ] - .join(",") - .split(",") -); + if (nullish === false) return false; + if (this.isTruthy()) return false; + if (this.isBoolean()) return false; + if (this.isString()) return false; + if (this.isNumber()) return false; + if (this.isBigInt()) return false; + if (this.isRegExp()) return false; + if (this.isArray()) return false; + if (this.isConstArray()) return false; + if (this.isTemplateString()) return false; + if (this.isRegExp()) return false; -const bySourceOrder = (a, b) => { - const aOrder = a.sourceOrder; - const bOrder = b.sourceOrder; - if (isNaN(aOrder)) { - if (!isNaN(bOrder)) { - return 1; - } - } else { - if (isNaN(bOrder)) { - return -1; + return undefined; + } + + asString() { + if (this.isBoolean()) return `${this.bool}`; + if (this.isNull()) return "null"; + if (this.isUndefined()) return "undefined"; + if (this.isString()) return this.string; + if (this.isNumber()) return `${this.number}`; + if (this.isBigInt()) return `${this.bigint}`; + if (this.isRegExp()) return `${this.regExp}`; + if (this.isArray()) { + let array = []; + for (const item of this.items) { + const itemStr = item.asString(); + if (itemStr === undefined) return undefined; + array.push(itemStr); + } + return `${array}`; } - if (aOrder !== bOrder) { - return aOrder < bOrder ? -1 : 1; + if (this.isConstArray()) return `${this.array}`; + if (this.isTemplateString()) { + let str = ""; + for (const part of this.parts) { + const partStr = part.asString(); + if (partStr === undefined) return undefined; + str += partStr; + } + return str; } + return undefined; } - return 0; -}; -const joinIterableWithComma = iterable => { - // This is more performant than Array.from().join(", ") - // as it doesn't create an array - let str = ""; - let first = true; - for (const item of iterable) { - if (first) { - first = false; - } else { - str += ", "; - } - str += item; + setString(string) { + this.type = TypeString; + this.string = string; + this.sideEffects = false; + return this; } - return str; -}; -/** - * @typedef {Object} ConcatenationEntry - * @property {"concatenated" | "external"} type - * @property {Module} module - * @property {RuntimeSpec | boolean} runtimeCondition - */ + setUndefined() { + this.type = TypeUndefined; + this.sideEffects = false; + return this; + } -/** - * @param {ModuleGraph} moduleGraph the module graph - * @param {ModuleInfo} info module info - * @param {string[]} exportName exportName - * @param {Map} moduleToInfoMap moduleToInfoMap - * @param {RuntimeSpec} runtime for which runtime - * @param {RequestShortener} requestShortener the request shortener - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @param {Set} neededNamespaceObjects modules for which a namespace object should be generated - * @param {boolean} asCall asCall - * @param {boolean} strictHarmonyModule strictHarmonyModule - * @param {boolean | undefined} asiSafe asiSafe - * @param {Set} alreadyVisited alreadyVisited - * @returns {Binding} the final variable - */ -const getFinalBinding = ( - moduleGraph, - info, - exportName, - moduleToInfoMap, - runtime, - requestShortener, - runtimeTemplate, - neededNamespaceObjects, - asCall, - strictHarmonyModule, - asiSafe, - alreadyVisited = new Set() -) => { - const exportsType = info.module.getExportsType( - moduleGraph, - strictHarmonyModule - ); - if (exportName.length === 0) { - switch (exportsType) { - case "default-only": - info.interopNamespaceObject2Used = true; - return { - info, - rawName: info.interopNamespaceObject2Name, - ids: exportName, - exportName - }; - case "default-with-named": - info.interopNamespaceObjectUsed = true; - return { - info, - rawName: info.interopNamespaceObjectName, - ids: exportName, - exportName - }; - case "namespace": - case "dynamic": - break; - default: - throw new Error(`Unexpected exportsType ${exportsType}`); - } - } else { - switch (exportsType) { - case "namespace": - break; - case "default-with-named": - switch (exportName[0]) { - case "default": - exportName = exportName.slice(1); - break; - case "__esModule": - return { - info, - rawName: "/* __esModule */true", - ids: exportName.slice(1), - exportName - }; - } - break; - case "default-only": { - const exportId = exportName[0]; - if (exportId === "__esModule") { - return { - info, - rawName: "/* __esModule */true", - ids: exportName.slice(1), - exportName - }; - } - exportName = exportName.slice(1); - if (exportId !== "default") { - return { - info, - rawName: - "/* non-default import from default-exporting module */undefined", - ids: exportName, - exportName - }; - } - break; - } - case "dynamic": - switch (exportName[0]) { - case "default": { - exportName = exportName.slice(1); - info.interopDefaultAccessUsed = true; - const defaultExport = asCall - ? `${info.interopDefaultAccessName}()` - : asiSafe - ? `(${info.interopDefaultAccessName}())` - : asiSafe === false - ? `;(${info.interopDefaultAccessName}())` - : `${info.interopDefaultAccessName}.a`; - return { - info, - rawName: defaultExport, - ids: exportName, - exportName - }; - } - case "__esModule": - return { - info, - rawName: "/* __esModule */true", - ids: exportName.slice(1), - exportName - }; - } - break; - default: - throw new Error(`Unexpected exportsType ${exportsType}`); - } + setNull() { + this.type = TypeNull; + this.sideEffects = false; + return this; } - if (exportName.length === 0) { - switch (info.type) { - case "concatenated": - neededNamespaceObjects.add(info); - return { - info, - rawName: info.namespaceObjectName, - ids: exportName, - exportName - }; - case "external": - return { info, rawName: info.name, ids: exportName, exportName }; - } + + setNumber(number) { + this.type = TypeNumber; + this.number = number; + this.sideEffects = false; + return this; } - const exportsInfo = moduleGraph.getExportsInfo(info.module); - const exportInfo = exportsInfo.getExportInfo(exportName[0]); - if (alreadyVisited.has(exportInfo)) { - return { - info, - rawName: "/* circular reexport */ Object(function x() { x() }())", - ids: [], - exportName - }; + + setBigInt(bigint) { + this.type = TypeBigInt; + this.bigint = bigint; + this.sideEffects = false; + return this; } - alreadyVisited.add(exportInfo); - switch (info.type) { - case "concatenated": { - const exportId = exportName[0]; - if (exportInfo.provided === false) { - // It's not provided, but it could be on the prototype - neededNamespaceObjects.add(info); - return { - info, - rawName: info.namespaceObjectName, - ids: exportName, - exportName - }; - } - const directExport = info.exportMap && info.exportMap.get(exportId); - if (directExport) { - const usedName = /** @type {string[]} */ ( - exportsInfo.getUsedName(exportName, runtime) - ); - if (!usedName) { - return { - info, - rawName: "/* unused export */ undefined", - ids: exportName.slice(1), - exportName - }; - } - return { - info, - name: directExport, - ids: usedName.slice(1), - exportName - }; - } - const rawExport = info.rawExportMap && info.rawExportMap.get(exportId); - if (rawExport) { - return { - info, - rawName: rawExport, - ids: exportName.slice(1), - exportName - }; - } - const reexport = exportInfo.findTarget(moduleGraph, module => - moduleToInfoMap.has(module) - ); - if (reexport === false) { - throw new Error( - `Target module of reexport from '${info.module.readableIdentifier( - requestShortener - )}' is not part of the concatenation (export '${exportId}')\nModules in the concatenation:\n${Array.from( - moduleToInfoMap, - ([m, info]) => - ` * ${info.type} ${m.readableIdentifier(requestShortener)}` - ).join("\n")}` - ); - } - if (reexport) { - const refInfo = moduleToInfoMap.get(reexport.module); - return getFinalBinding( - moduleGraph, - refInfo, - reexport.export - ? [...reexport.export, ...exportName.slice(1)] - : exportName.slice(1), - moduleToInfoMap, - runtime, - requestShortener, - runtimeTemplate, - neededNamespaceObjects, - asCall, - info.module.buildMeta.strictHarmonyModule, - asiSafe, - alreadyVisited - ); - } - if (info.namespaceExportSymbol) { - const usedName = /** @type {string[]} */ ( - exportsInfo.getUsedName(exportName, runtime) - ); - return { - info, - rawName: info.namespaceObjectName, - ids: usedName, - exportName - }; - } - throw new Error( - `Cannot get final name for export '${exportName.join( - "." - )}' of ${info.module.readableIdentifier(requestShortener)}` - ); - } - case "external": { - const used = /** @type {string[]} */ ( - exportsInfo.getUsedName(exportName, runtime) - ); - if (!used) { - return { - info, - rawName: "/* unused export */ undefined", - ids: exportName.slice(1), - exportName - }; - } - const comment = equals(used, exportName) - ? "" - : Template.toNormalComment(`${exportName.join(".")}`); - return { info, rawName: info.name + comment, ids: used, exportName }; + setBoolean(bool) { + this.type = TypeBoolean; + this.bool = bool; + this.sideEffects = false; + return this; + } + + setRegExp(regExp) { + this.type = TypeRegExp; + this.regExp = regExp; + this.sideEffects = false; + return this; + } + + setIdentifier(identifier, rootInfo, getMembers) { + this.type = TypeIdentifier; + this.identifier = identifier; + this.rootInfo = rootInfo; + this.getMembers = getMembers; + this.sideEffects = true; + return this; + } + + setWrapped(prefix, postfix, innerExpressions) { + this.type = TypeWrapped; + this.prefix = prefix; + this.postfix = postfix; + this.wrappedInnerExpressions = innerExpressions; + this.sideEffects = true; + return this; + } + + setOptions(options) { + this.type = TypeConditional; + this.options = options; + this.sideEffects = true; + return this; + } + + addOptions(options) { + if (!this.options) { + this.type = TypeConditional; + this.options = []; + this.sideEffects = true; + } + for (const item of options) { + this.options.push(item); } + return this; } -}; -/** - * @param {ModuleGraph} moduleGraph the module graph - * @param {ModuleInfo} info module info - * @param {string[]} exportName exportName - * @param {Map} moduleToInfoMap moduleToInfoMap - * @param {RuntimeSpec} runtime for which runtime - * @param {RequestShortener} requestShortener the request shortener - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @param {Set} neededNamespaceObjects modules for which a namespace object should be generated - * @param {boolean} asCall asCall - * @param {boolean} callContext callContext - * @param {boolean} strictHarmonyModule strictHarmonyModule - * @param {boolean | undefined} asiSafe asiSafe - * @returns {string} the final name - */ -const getFinalName = ( - moduleGraph, - info, - exportName, - moduleToInfoMap, - runtime, - requestShortener, - runtimeTemplate, - neededNamespaceObjects, - asCall, - callContext, - strictHarmonyModule, - asiSafe -) => { - const binding = getFinalBinding( - moduleGraph, - info, - exportName, - moduleToInfoMap, - runtime, - requestShortener, - runtimeTemplate, - neededNamespaceObjects, - asCall, - strictHarmonyModule, - asiSafe - ); - { - const { ids, comment } = binding; - let reference; - let isPropertyAccess; - if ("rawName" in binding) { - reference = `${binding.rawName}${comment || ""}${propertyAccess(ids)}`; - isPropertyAccess = ids.length > 0; - } else { - const { info, name: exportId } = binding; - const name = info.internalNames.get(exportId); - if (!name) { - throw new Error( - `The export "${exportId}" in "${info.module.readableIdentifier( - requestShortener - )}" has no internal name (existing names: ${ - Array.from( - info.internalNames, - ([name, symbol]) => `${name}: ${symbol}` - ).join(", ") || "none" - })` - ); - } - reference = `${name}${comment || ""}${propertyAccess(ids)}`; - isPropertyAccess = ids.length > 1; - } - if (isPropertyAccess && asCall && callContext === false) { - return asiSafe - ? `(0,${reference})` - : asiSafe === false - ? `;(0,${reference})` - : `/*#__PURE__*/Object(${reference})`; - } - return reference; + setItems(items) { + this.type = TypeArray; + this.items = items; + this.sideEffects = items.some(i => i.couldHaveSideEffects()); + return this; } -}; -const addScopeSymbols = (s, nameSet, scopeSet1, scopeSet2) => { - let scope = s; - while (scope) { - if (scopeSet1.has(scope)) break; - if (scopeSet2.has(scope)) break; - scopeSet1.add(scope); - for (const variable of scope.variables) { - nameSet.add(variable.name); - } - scope = scope.upper; + setArray(array) { + this.type = TypeConstArray; + this.array = array; + this.sideEffects = false; + return this; } -}; -const getAllReferences = variable => { - let set = variable.references; - // Look for inner scope variables too (like in class Foo { t() { Foo } }) - const identifiers = new Set(variable.identifiers); - for (const scope of variable.scope.childScopes) { - for (const innerVar of scope.variables) { - if (innerVar.identifiers.some(id => identifiers.has(id))) { - set = set.concat(innerVar.references); - break; - } - } + setTemplateString(quasis, parts, kind) { + this.type = TypeTemplateString; + this.quasis = quasis; + this.parts = parts; + this.templateStringKind = kind; + this.sideEffects = parts.some(p => p.sideEffects); + return this; } - return set; -}; -const getPathInAst = (ast, node) => { - if (ast === node) { - return []; + setTruthy() { + this.falsy = false; + this.truthy = true; + this.nullish = false; + return this; } - const nr = node.range; + setFalsy() { + this.falsy = true; + this.truthy = false; + return this; + } - const enterNode = n => { - if (!n) return undefined; - const r = n.range; - if (r) { - if (r[0] <= nr[0] && r[1] >= nr[1]) { - const path = getPathInAst(n, node); - if (path) { - path.push(n); - return path; - } - } + setNullish(value) { + this.nullish = value; + + if (value) return this.setFalsy(); + + return this; + } + + setRange(range) { + this.range = range; + return this; + } + + setSideEffects(sideEffects = true) { + this.sideEffects = sideEffects; + return this; + } + + setExpression(expression) { + this.expression = expression; + return this; + } +} + +/** + * @param {string} flags regexp flags + * @returns {boolean} is valid flags + */ +BasicEvaluatedExpression.isValidRegExpFlags = flags => { + const len = flags.length; + + if (len === 0) return true; + if (len > 4) return false; + + // cspell:word gimy + let remaining = 0b0000; // bit per RegExp flag: gimy + + for (let i = 0; i < len; i++) + switch (flags.charCodeAt(i)) { + case 103 /* g */: + if (remaining & 0b1000) return false; + remaining |= 0b1000; + break; + case 105 /* i */: + if (remaining & 0b0100) return false; + remaining |= 0b0100; + break; + case 109 /* m */: + if (remaining & 0b0010) return false; + remaining |= 0b0010; + break; + case 121 /* y */: + if (remaining & 0b0001) return false; + remaining |= 0b0001; + break; + default: + return false; } - return undefined; - }; - if (Array.isArray(ast)) { - for (let i = 0; i < ast.length; i++) { - const enterResult = enterNode(ast[i]); - if (enterResult !== undefined) return enterResult; + return true; +}; + +module.exports = BasicEvaluatedExpression; + + +/***/ }), + +/***/ 91145: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const Entrypoint = __webpack_require__(13795); + +/** @typedef {import("../Chunk")} Chunk */ + +/** + * @param {Entrypoint} entrypoint a chunk group + * @param {Chunk} excludedChunk1 current chunk which is excluded + * @param {Chunk} excludedChunk2 runtime chunk which is excluded + * @returns {Set} chunks + */ +const getAllChunks = (entrypoint, excludedChunk1, excludedChunk2) => { + const queue = new Set([entrypoint]); + const chunks = new Set(); + for (const entrypoint of queue) { + for (const chunk of entrypoint.chunks) { + if (chunk === excludedChunk1) continue; + if (chunk === excludedChunk2) continue; + chunks.add(chunk); } - } else if (ast && typeof ast === "object") { - const keys = Object.keys(ast); - for (let i = 0; i < keys.length; i++) { - const value = ast[keys[i]]; - if (Array.isArray(value)) { - const pathResult = getPathInAst(value, node); - if (pathResult !== undefined) return pathResult; - } else if (value && typeof value === "object") { - const enterResult = enterNode(value); - if (enterResult !== undefined) return enterResult; - } + for (const parent of entrypoint.parentsIterable) { + if (parent instanceof Entrypoint) queue.add(parent); } } + return chunks; }; +exports.getAllChunks = getAllChunks; -const TYPES = new Set(["javascript"]); -class ConcatenatedModule extends Module { +/***/ }), + +/***/ 84508: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { ConcatSource, RawSource } = __webpack_require__(51255); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const { + getChunkFilenameTemplate, + getCompilationHooks +} = __webpack_require__(89464); +const { + generateEntryStartup, + updateHashForEntryStartup +} = __webpack_require__(98124); + +/** @typedef {import("../Compiler")} Compiler */ + +class CommonJsChunkFormatPlugin { /** - * @param {Module} rootModule the root module of the concatenation - * @param {Set} modules all modules in the concatenation (including the root module) - * @param {RuntimeSpec} runtime the runtime - * @param {Object=} associatedObjectForCache object for caching - * @param {string | HashConstructor=} hashFunction hash function to use - * @returns {ConcatenatedModule} the module + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - static create( - rootModule, - modules, - runtime, - associatedObjectForCache, - hashFunction = "md4" - ) { - const identifier = ConcatenatedModule._createIdentifier( - rootModule, - modules, - associatedObjectForCache, - hashFunction + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "CommonJsChunkFormatPlugin", + compilation => { + compilation.hooks.additionalChunkRuntimeRequirements.tap( + "CommonJsChunkLoadingPlugin", + (chunk, set, { chunkGraph }) => { + if (chunk.hasRuntime()) return; + if (chunkGraph.getNumberOfEntryModules(chunk) > 0) { + set.add(RuntimeGlobals.require); + set.add(RuntimeGlobals.startupEntrypoint); + set.add(RuntimeGlobals.externalInstallChunk); + } + } + ); + const hooks = getCompilationHooks(compilation); + hooks.renderChunk.tap( + "CommonJsChunkFormatPlugin", + (modules, renderContext) => { + const { chunk, chunkGraph, runtimeTemplate } = renderContext; + const source = new ConcatSource(); + source.add(`exports.id = ${JSON.stringify(chunk.id)};\n`); + source.add(`exports.ids = ${JSON.stringify(chunk.ids)};\n`); + source.add(`exports.modules = `); + source.add(modules); + source.add(";\n"); + const runtimeModules = + chunkGraph.getChunkRuntimeModulesInOrder(chunk); + if (runtimeModules.length > 0) { + source.add("exports.runtime =\n"); + source.add( + Template.renderChunkRuntimeModules( + runtimeModules, + renderContext + ) + ); + } + const entries = Array.from( + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ); + if (entries.length > 0) { + const runtimeChunk = entries[0][1].getRuntimeChunk(); + const currentOutputName = compilation + .getPath( + getChunkFilenameTemplate(chunk, compilation.outputOptions), + { + chunk, + contentHashType: "javascript" + } + ) + .split("/"); + const runtimeOutputName = compilation + .getPath( + getChunkFilenameTemplate( + runtimeChunk, + compilation.outputOptions + ), + { + chunk: runtimeChunk, + contentHashType: "javascript" + } + ) + .split("/"); + + // remove filename, we only need the directory + currentOutputName.pop(); + + // remove common parts + while ( + currentOutputName.length > 0 && + runtimeOutputName.length > 0 && + currentOutputName[0] === runtimeOutputName[0] + ) { + currentOutputName.shift(); + runtimeOutputName.shift(); + } + + // create final path + const runtimePath = + (currentOutputName.length > 0 + ? "../".repeat(currentOutputName.length) + : "./") + runtimeOutputName.join("/"); + + const entrySource = new ConcatSource(); + entrySource.add( + `(${ + runtimeTemplate.supportsArrowFunction() + ? "() => " + : "function() " + }{\n` + ); + entrySource.add("var exports = {};\n"); + entrySource.add(source); + entrySource.add(";\n\n// load runtime\n"); + entrySource.add( + `var __webpack_require__ = require(${JSON.stringify( + runtimePath + )});\n` + ); + entrySource.add( + `${RuntimeGlobals.externalInstallChunk}(exports);\n` + ); + const startupSource = new RawSource( + generateEntryStartup( + chunkGraph, + runtimeTemplate, + entries, + chunk, + false + ) + ); + entrySource.add( + hooks.renderStartup.call( + startupSource, + entries[entries.length - 1][0], + { + ...renderContext, + inlined: false + } + ) + ); + entrySource.add("\n})()"); + return entrySource; + } + return source; + } + ); + hooks.chunkHash.tap( + "CommonJsChunkFormatPlugin", + (chunk, hash, { chunkGraph }) => { + if (chunk.hasRuntime()) return; + hash.update("CommonJsChunkFormatPlugin"); + hash.update("1"); + const entries = Array.from( + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ); + updateHashForEntryStartup(hash, chunkGraph, entries, chunk); + } + ); + } ); - return new ConcatenatedModule({ - identifier, - rootModule, - modules, - runtime - }); } +} - /** - * @param {Object} options options - * @param {string} options.identifier the identifier of the module - * @param {Module=} options.rootModule the root module of the concatenation - * @param {RuntimeSpec} options.runtime the selected runtime - * @param {Set=} options.modules all concatenated modules - */ - constructor({ identifier, rootModule, modules, runtime }) { - super("javascript/esm", null, rootModule && rootModule.layer); +module.exports = CommonJsChunkFormatPlugin; - // Info from Factory - /** @type {string} */ - this._identifier = identifier; - /** @type {Module} */ - this.rootModule = rootModule; - /** @type {Set} */ - this._modules = modules; - this._runtime = runtime; - this.factoryMeta = rootModule && rootModule.factoryMeta; - } - /** - * Assuming this module is in the cache. Update the (cached) module with - * the fresh module from the factory. Usually updates internal references - * and properties. - * @param {Module} module fresh module - * @returns {void} - */ - updateCacheModule(module) { - throw new Error("Must not be called"); +/***/ }), + +/***/ 61291: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +/** @typedef {import("../../declarations/WebpackOptions").ChunkLoadingType} ChunkLoadingType */ +/** @typedef {import("../Compiler")} Compiler */ + +/** @type {WeakMap>} */ +const enabledTypes = new WeakMap(); + +const getEnabledTypes = compiler => { + let set = enabledTypes.get(compiler); + if (set === undefined) { + set = new Set(); + enabledTypes.set(compiler, set); } + return set; +}; +class EnableChunkLoadingPlugin { /** - * @returns {Set} types available (do not mutate) + * @param {ChunkLoadingType} type library type that should be available */ - getSourceTypes() { - return TYPES; + constructor(type) { + this.type = type; } - get modules() { - return Array.from(this._modules); + /** + * @param {Compiler} compiler the compiler instance + * @param {ChunkLoadingType} type type of library + * @returns {void} + */ + static setEnabled(compiler, type) { + getEnabledTypes(compiler).add(type); } /** - * @returns {string} a unique identifier of the module + * @param {Compiler} compiler the compiler instance + * @param {ChunkLoadingType} type type of library + * @returns {void} */ - identifier() { - return this._identifier; + static checkEnabled(compiler, type) { + if (!getEnabledTypes(compiler).has(type)) { + throw new Error( + `Chunk loading type "${type}" is not enabled. ` + + "EnableChunkLoadingPlugin need to be used to enable this type of chunk loading. " + + 'This usually happens through the "output.enabledChunkLoadingTypes" option. ' + + 'If you are using a function as entry which sets "chunkLoading", you need to add all potential chunk loading types to "output.enabledChunkLoadingTypes". ' + + "These types are enabled: " + + Array.from(getEnabledTypes(compiler)).join(", ") + ); + } } /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - readableIdentifier(requestShortener) { - return ( - this.rootModule.readableIdentifier(requestShortener) + - ` + ${this._modules.size - 1} modules` - ); + apply(compiler) { + const { type } = this; + + // Only enable once + const enabled = getEnabledTypes(compiler); + if (enabled.has(type)) return; + enabled.add(type); + + if (typeof type === "string") { + switch (type) { + case "jsonp": { + const JsonpChunkLoadingPlugin = __webpack_require__(83121); + new JsonpChunkLoadingPlugin().apply(compiler); + break; + } + case "import-scripts": { + const ImportScriptsChunkLoadingPlugin = __webpack_require__(54182); + new ImportScriptsChunkLoadingPlugin().apply(compiler); + break; + } + case "require": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const CommonJsChunkLoadingPlugin = __webpack_require__(1313); + new CommonJsChunkLoadingPlugin({ + asyncChunkLoading: false + }).apply(compiler); + break; + } + case "async-node": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const CommonJsChunkLoadingPlugin = __webpack_require__(1313); + new CommonJsChunkLoadingPlugin({ + asyncChunkLoading: true + }).apply(compiler); + break; + } + case "import": { + const ModuleChunkLoadingPlugin = __webpack_require__(89831); + new ModuleChunkLoadingPlugin().apply(compiler); + break; + } + case "universal": + // TODO implement universal chunk loading + throw new Error("Universal Chunk Loading is not implemented yet"); + default: + throw new Error(`Unsupported chunk loading type ${type}. +Plugins which provide custom chunk loading types must call EnableChunkLoadingPlugin.setEnabled(compiler, type) to disable this error.`); + } + } else { + // TODO support plugin instances here + // apply them to the compiler + } } +} + +module.exports = EnableChunkLoadingPlugin; + + +/***/ }), + +/***/ 77106: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const util = __webpack_require__(73837); +const { RawSource, ReplaceSource } = __webpack_require__(51255); +const Generator = __webpack_require__(93401); +const InitFragment = __webpack_require__(55870); +const HarmonyCompatibilityDependency = __webpack_require__(72906); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../DependenciesBlock")} DependenciesBlock */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ + +// TODO: clean up this file +// replace with newer constructs + +const deprecatedGetInitFragments = util.deprecate( + (template, dependency, templateContext) => + template.getInitFragments(dependency, templateContext), + "DependencyTemplate.getInitFragment is deprecated (use apply(dep, source, { initFragments }) instead)", + "DEP_WEBPACK_JAVASCRIPT_GENERATOR_GET_INIT_FRAGMENTS" +); + +const TYPES = new Set(["javascript"]); +class JavascriptGenerator extends Generator { /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) */ - libIdent(options) { - return this.rootModule.libIdent(options); + getTypes(module) { + return TYPES; } /** - * @returns {string | null} absolute path which should be used for condition matching (usually the resource path) + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module */ - nameForCondition() { - return this.rootModule.nameForCondition(); + getSize(module, type) { + const originalSource = module.originalSource(); + if (!originalSource) { + return 39; + } + return originalSource.size(); } /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this module should be connected to referencing modules when consumed for side-effects only + * @param {NormalModule} module module for which the bailout reason should be determined + * @param {ConcatenationBailoutReasonContext} context context + * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated */ - getSideEffectsConnectionState(moduleGraph) { - return this.rootModule.getSideEffectsConnectionState(moduleGraph); + getConcatenationBailoutReason(module, context) { + // Only harmony modules are valid for optimization + if ( + !module.buildMeta || + module.buildMeta.exportsType !== "namespace" || + module.presentationalDependencies === undefined || + !module.presentationalDependencies.some( + d => d instanceof HarmonyCompatibilityDependency + ) + ) { + return "Module is not an ECMAScript module"; + } + + // Some expressions are not compatible with module concatenation + // because they may produce unexpected results. The plugin bails out + // if some were detected upfront. + if (module.buildInfo && module.buildInfo.moduleConcatenationBailout) { + return `Module uses ${module.buildInfo.moduleConcatenationBailout}`; + } } /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code */ - build(options, compilation, resolver, fs, callback) { - const { rootModule } = this; - this.buildInfo = { - strict: true, - cacheable: true, - moduleArgument: rootModule.buildInfo.moduleArgument, - exportsArgument: rootModule.buildInfo.exportsArgument, - fileDependencies: new LazySet(), - contextDependencies: new LazySet(), - missingDependencies: new LazySet(), - topLevelDeclarations: new Set(), - assets: undefined - }; - this.buildMeta = rootModule.buildMeta; - this.clearDependenciesAndBlocks(); - this.clearWarningsAndErrors(); + generate(module, generateContext) { + const originalSource = module.originalSource(); + if (!originalSource) { + return new RawSource("throw new Error('No source available');"); + } - for (const m of this._modules) { - // populate cacheable - if (!m.buildInfo.cacheable) { - this.buildInfo.cacheable = false; - } + const source = new ReplaceSource(originalSource); + const initFragments = []; - // populate dependencies - for (const d of m.dependencies.filter( - dep => - !(dep instanceof HarmonyImportDependency) || - !this._modules.has(compilation.moduleGraph.getModule(dep)) - )) { - this.dependencies.push(d); - } - // populate blocks - for (const d of m.blocks) { - this.blocks.push(d); - } + this.sourceModule(module, initFragments, source, generateContext); - // populate warnings - const warnings = m.getWarnings(); - if (warnings !== undefined) { - for (const warning of warnings) { - this.addWarning(warning); - } - } + return InitFragment.addToSource(source, initFragments, generateContext); + } - // populate errors - const errors = m.getErrors(); - if (errors !== undefined) { - for (const error of errors) { - this.addError(error); - } - } + /** + * @param {Module} module the module to generate + * @param {InitFragment[]} initFragments mutable list of init fragments + * @param {ReplaceSource} source the current replace source which can be modified + * @param {GenerateContext} generateContext the generateContext + * @returns {void} + */ + sourceModule(module, initFragments, source, generateContext) { + for (const dependency of module.dependencies) { + this.sourceDependency( + module, + dependency, + initFragments, + source, + generateContext + ); + } - // populate topLevelDeclarations - if (m.buildInfo.topLevelDeclarations) { - const topLevelDeclarations = this.buildInfo.topLevelDeclarations; - if (topLevelDeclarations !== undefined) { - for (const decl of m.buildInfo.topLevelDeclarations) { - topLevelDeclarations.add(decl); - } - } - } else { - this.buildInfo.topLevelDeclarations = undefined; + if (module.presentationalDependencies !== undefined) { + for (const dependency of module.presentationalDependencies) { + this.sourceDependency( + module, + dependency, + initFragments, + source, + generateContext + ); } + } - // populate assets - if (m.buildInfo.assets) { - if (this.buildInfo.assets === undefined) { - this.buildInfo.assets = Object.create(null); - } - Object.assign(this.buildInfo.assets, m.buildInfo.assets); - } - if (m.buildInfo.assetsInfo) { - if (this.buildInfo.assetsInfo === undefined) { - this.buildInfo.assetsInfo = new Map(); - } - for (const [key, value] of m.buildInfo.assetsInfo) { - this.buildInfo.assetsInfo.set(key, value); - } - } + for (const childBlock of module.blocks) { + this.sourceBlock( + module, + childBlock, + initFragments, + source, + generateContext + ); } - callback(); } /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) + * @param {Module} module the module to generate + * @param {DependenciesBlock} block the dependencies block which will be processed + * @param {InitFragment[]} initFragments mutable list of init fragments + * @param {ReplaceSource} source the current replace source which can be modified + * @param {GenerateContext} generateContext the generateContext + * @returns {void} */ - size(type) { - // Guess size from embedded modules - let size = 0; - for (const module of this._modules) { - size += module.size(type); + sourceBlock(module, block, initFragments, source, generateContext) { + for (const dependency of block.dependencies) { + this.sourceDependency( + module, + dependency, + initFragments, + source, + generateContext + ); + } + + for (const childBlock of block.blocks) { + this.sourceBlock( + module, + childBlock, + initFragments, + source, + generateContext + ); } - return size; } /** - * @private - * @param {Module} rootModule the root of the concatenation - * @param {Set} modulesSet a set of modules which should be concatenated - * @param {RuntimeSpec} runtime for this runtime - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConcatenationEntry[]} concatenation list + * @param {Module} module the current module + * @param {Dependency} dependency the dependency to generate + * @param {InitFragment[]} initFragments mutable list of init fragments + * @param {ReplaceSource} source the current replace source which can be modified + * @param {GenerateContext} generateContext the render context + * @returns {void} */ - _createConcatenationList(rootModule, modulesSet, runtime, moduleGraph) { - /** @type {ConcatenationEntry[]} */ - const list = []; - /** @type {Map} */ - const existingEntries = new Map(); - - /** - * @param {Module} module a module - * @returns {Iterable<{ connection: ModuleGraphConnection, runtimeCondition: RuntimeSpec | true }>} imported modules in order - */ - const getConcatenatedImports = module => { - let connections = Array.from(moduleGraph.getOutgoingConnections(module)); - if (module === rootModule) { - for (const c of moduleGraph.getOutgoingConnections(this)) - connections.push(c); - } - const references = connections - .filter(connection => { - if (!(connection.dependency instanceof HarmonyImportDependency)) - return false; - return ( - connection && - connection.resolvedOriginModule === module && - connection.module && - connection.isTargetActive(runtime) - ); - }) - .map(connection => ({ - connection, - sourceOrder: /** @type {HarmonyImportDependency} */ ( - connection.dependency - ).sourceOrder - })); - references.sort( - concatComparators(bySourceOrder, keepOriginalOrder(references)) + sourceDependency(module, dependency, initFragments, source, generateContext) { + const constructor = /** @type {new (...args: any[]) => Dependency} */ ( + dependency.constructor + ); + const template = generateContext.dependencyTemplates.get(constructor); + if (!template) { + throw new Error( + "No template for dependency: " + dependency.constructor.name ); - /** @type {Map} */ - const referencesMap = new Map(); - for (const { connection } of references) { - const runtimeCondition = filterRuntime(runtime, r => - connection.isTargetActive(r) - ); - if (runtimeCondition === false) continue; - const module = connection.module; - const entry = referencesMap.get(module); - if (entry === undefined) { - referencesMap.set(module, { connection, runtimeCondition }); - continue; - } - entry.runtimeCondition = mergeRuntimeConditionNonFalse( - entry.runtimeCondition, - runtimeCondition, - runtime - ); - } - return referencesMap.values(); - }; + } - /** - * @param {ModuleGraphConnection} connection graph connection - * @param {RuntimeSpec | true} runtimeCondition runtime condition - * @returns {void} - */ - const enterModule = (connection, runtimeCondition) => { - const module = connection.module; - if (!module) return; - const existingEntry = existingEntries.get(module); - if (existingEntry === true) { - return; - } - if (modulesSet.has(module)) { - existingEntries.set(module, true); - if (runtimeCondition !== true) { - throw new Error( - `Cannot runtime-conditional concatenate a module (${module.identifier()} in ${this.rootModule.identifier()}, ${runtimeConditionToString( - runtimeCondition - )}). This should not happen.` - ); - } - const imports = getConcatenatedImports(module); - for (const { connection, runtimeCondition } of imports) - enterModule(connection, runtimeCondition); - list.push({ - type: "concatenated", - module: connection.module, - runtimeCondition - }); - } else { - if (existingEntry !== undefined) { - const reducedRuntimeCondition = subtractRuntimeCondition( - runtimeCondition, - existingEntry, - runtime - ); - if (reducedRuntimeCondition === false) return; - runtimeCondition = reducedRuntimeCondition; - existingEntries.set( - connection.module, - mergeRuntimeConditionNonFalse( - existingEntry, - runtimeCondition, - runtime - ) - ); - } else { - existingEntries.set(connection.module, runtimeCondition); - } - if (list.length > 0) { - const lastItem = list[list.length - 1]; - if ( - lastItem.type === "external" && - lastItem.module === connection.module - ) { - lastItem.runtimeCondition = mergeRuntimeCondition( - lastItem.runtimeCondition, - runtimeCondition, - runtime - ); - return; - } - } - list.push({ - type: "external", - get module() { - // We need to use a getter here, because the module in the dependency - // could be replaced by some other process (i. e. also replaced with a - // concatenated module) - return connection.module; - }, - runtimeCondition - }); - } + const templateContext = { + runtimeTemplate: generateContext.runtimeTemplate, + dependencyTemplates: generateContext.dependencyTemplates, + moduleGraph: generateContext.moduleGraph, + chunkGraph: generateContext.chunkGraph, + module, + runtime: generateContext.runtime, + runtimeRequirements: generateContext.runtimeRequirements, + concatenationScope: generateContext.concatenationScope, + codeGenerationResults: generateContext.codeGenerationResults, + initFragments }; - existingEntries.set(rootModule, true); - const imports = getConcatenatedImports(rootModule); - for (const { connection, runtimeCondition } of imports) - enterModule(connection, runtimeCondition); - list.push({ - type: "concatenated", - module: rootModule, - runtimeCondition: true - }); + template.apply(dependency, source, templateContext); - return list; - } + // TODO remove in webpack 6 + if ("getInitFragments" in template) { + const fragments = deprecatedGetInitFragments( + template, + dependency, + templateContext + ); - /** - * @param {Module} rootModule the root module of the concatenation - * @param {Set} modules all modules in the concatenation (including the root module) - * @param {Object=} associatedObjectForCache object for caching - * @param {string | HashConstructor=} hashFunction hash function to use - * @returns {string} the identifier - */ - static _createIdentifier( - rootModule, - modules, - associatedObjectForCache, - hashFunction = "md4" - ) { - const cachedMakePathsRelative = makePathsRelative.bindContextCache( - rootModule.context, - associatedObjectForCache - ); - let identifiers = []; - for (const module of modules) { - identifiers.push(cachedMakePathsRelative(module.identifier())); + if (fragments) { + for (const fragment of fragments) { + initFragments.push(fragment); + } + } } - identifiers.sort(); - const hash = createHash(hashFunction); - hash.update(identifiers.join(" ")); - return rootModule.identifier() + "|" + hash.digest("hex"); } +} + +module.exports = JavascriptGenerator; + + +/***/ }), + +/***/ 89464: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { SyncWaterfallHook, SyncHook, SyncBailHook } = __webpack_require__(41242); +const vm = __webpack_require__(26144); +const { + ConcatSource, + OriginalSource, + PrefixSource, + RawSource, + CachedSource +} = __webpack_require__(51255); +const Compilation = __webpack_require__(85720); +const { tryRunOrWebpackError } = __webpack_require__(11351); +const HotUpdateChunk = __webpack_require__(9597); +const InitFragment = __webpack_require__(55870); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const { last, someInIterable } = __webpack_require__(39104); +const StringXor = __webpack_require__(40293); +const { compareModulesByIdentifier } = __webpack_require__(29579); +const createHash = __webpack_require__(49835); +const nonNumericOnlyHash = __webpack_require__(55668); +const { intersectRuntime } = __webpack_require__(17156); +const JavascriptGenerator = __webpack_require__(77106); +const JavascriptParser = __webpack_require__(29050); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../CodeGenerationResults")} CodeGenerationResults */ +/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../util/Hash")} Hash */ + +/** + * @param {Chunk} chunk a chunk + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {boolean} true, when a JS file is needed for this chunk + */ +const chunkHasJs = (chunk, chunkGraph) => { + if (chunkGraph.getNumberOfEntryModules(chunk) > 0) return true; + + return chunkGraph.getChunkModulesIterableBySourceType(chunk, "javascript") + ? true + : false; +}; + +const printGeneratedCodeForStack = (module, code) => { + const lines = code.split("\n"); + const n = `${lines.length}`.length; + return `\n\nGenerated code for ${module.identifier()}\n${lines + .map((line, i, lines) => { + const iStr = `${i + 1}`; + return `${" ".repeat(n - iStr.length)}${iStr} | ${line}`; + }) + .join("\n")}`; +}; + +/** + * @typedef {Object} RenderContext + * @property {Chunk} chunk the chunk + * @property {DependencyTemplates} dependencyTemplates the dependency templates + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {CodeGenerationResults} codeGenerationResults results of code generation + * @property {boolean} strictMode rendering in strict context + */ + +/** + * @typedef {Object} MainRenderContext + * @property {Chunk} chunk the chunk + * @property {DependencyTemplates} dependencyTemplates the dependency templates + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {CodeGenerationResults} codeGenerationResults results of code generation + * @property {string} hash hash to be used for render call + * @property {boolean} strictMode rendering in strict context + */ + +/** + * @typedef {Object} ChunkRenderContext + * @property {Chunk} chunk the chunk + * @property {DependencyTemplates} dependencyTemplates the dependency templates + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {CodeGenerationResults} codeGenerationResults results of code generation + * @property {InitFragment[]} chunkInitFragments init fragments for the chunk + * @property {boolean} strictMode rendering in strict context + */ + +/** + * @typedef {Object} RenderBootstrapContext + * @property {Chunk} chunk the chunk + * @property {CodeGenerationResults} codeGenerationResults results of code generation + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {string} hash hash to be used for render call + */ + +/** @typedef {RenderContext & { inlined: boolean }} StartupRenderContext */ + +/** + * @typedef {Object} CompilationHooks + * @property {SyncWaterfallHook<[Source, Module, ChunkRenderContext]>} renderModuleContent + * @property {SyncWaterfallHook<[Source, Module, ChunkRenderContext]>} renderModuleContainer + * @property {SyncWaterfallHook<[Source, Module, ChunkRenderContext]>} renderModulePackage + * @property {SyncWaterfallHook<[Source, RenderContext]>} renderChunk + * @property {SyncWaterfallHook<[Source, RenderContext]>} renderMain + * @property {SyncWaterfallHook<[Source, RenderContext]>} renderContent + * @property {SyncWaterfallHook<[Source, RenderContext]>} render + * @property {SyncWaterfallHook<[Source, Module, StartupRenderContext]>} renderStartup + * @property {SyncWaterfallHook<[string, RenderBootstrapContext]>} renderRequire + * @property {SyncBailHook<[Module, RenderBootstrapContext], string>} inlineInRuntimeBailout + * @property {SyncBailHook<[Module, RenderContext], string>} embedInRuntimeBailout + * @property {SyncBailHook<[RenderContext], string>} strictRuntimeBailout + * @property {SyncHook<[Chunk, Hash, ChunkHashContext]>} chunkHash + * @property {SyncBailHook<[Chunk, RenderContext], boolean>} useSourceMap + */ + +/** @type {WeakMap} */ +const compilationHooksMap = new WeakMap(); +class JavascriptModulesPlugin { /** - * @param {LazySet} fileDependencies set where file dependencies are added to - * @param {LazySet} contextDependencies set where context dependencies are added to - * @param {LazySet} missingDependencies set where missing dependencies are added to - * @param {LazySet} buildDependencies set where build dependencies are added to + * @param {Compilation} compilation the compilation + * @returns {CompilationHooks} the attached hooks */ - addCacheDependencies( - fileDependencies, - contextDependencies, - missingDependencies, - buildDependencies - ) { - for (const module of this._modules) { - module.addCacheDependencies( - fileDependencies, - contextDependencies, - missingDependencies, - buildDependencies + static getCompilationHooks(compilation) { + if (!(compilation instanceof Compilation)) { + throw new TypeError( + "The 'compilation' argument must be an instance of Compilation" ); } + let hooks = compilationHooksMap.get(compilation); + if (hooks === undefined) { + hooks = { + renderModuleContent: new SyncWaterfallHook([ + "source", + "module", + "renderContext" + ]), + renderModuleContainer: new SyncWaterfallHook([ + "source", + "module", + "renderContext" + ]), + renderModulePackage: new SyncWaterfallHook([ + "source", + "module", + "renderContext" + ]), + render: new SyncWaterfallHook(["source", "renderContext"]), + renderContent: new SyncWaterfallHook(["source", "renderContext"]), + renderStartup: new SyncWaterfallHook([ + "source", + "module", + "startupRenderContext" + ]), + renderChunk: new SyncWaterfallHook(["source", "renderContext"]), + renderMain: new SyncWaterfallHook(["source", "renderContext"]), + renderRequire: new SyncWaterfallHook(["code", "renderContext"]), + inlineInRuntimeBailout: new SyncBailHook(["module", "renderContext"]), + embedInRuntimeBailout: new SyncBailHook(["module", "renderContext"]), + strictRuntimeBailout: new SyncBailHook(["renderContext"]), + chunkHash: new SyncHook(["chunk", "hash", "context"]), + useSourceMap: new SyncBailHook(["chunk", "renderContext"]) + }; + compilationHooksMap.set(compilation, hooks); + } + return hooks; + } + + constructor(options = {}) { + this.options = options; + /** @type {WeakMap} */ + this._moduleFactoryCache = new WeakMap(); } /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - codeGeneration({ - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtime: generationRuntime, - codeGenerationResults - }) { - /** @type {Set} */ - const runtimeRequirements = new Set(); - const runtime = intersectRuntime(generationRuntime, this._runtime); - - const requestShortener = runtimeTemplate.requestShortener; - // Meta info for each module - const [modulesWithInfo, moduleToInfoMap] = this._getModulesWithInfo( - moduleGraph, - runtime - ); - - // Set with modules that need a generated namespace object - /** @type {Set} */ - const neededNamespaceObjects = new Set(); - - // Generate source code and analyse scopes - // Prepare a ReplaceSource for the final source - for (const info of moduleToInfoMap.values()) { - this._analyseModule( - moduleToInfoMap, - info, - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtime, - codeGenerationResults - ); - } + apply(compiler) { + compiler.hooks.compilation.tap( + "JavascriptModulesPlugin", + (compilation, { normalModuleFactory }) => { + const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); + normalModuleFactory.hooks.createParser + .for("javascript/auto") + .tap("JavascriptModulesPlugin", options => { + return new JavascriptParser("auto"); + }); + normalModuleFactory.hooks.createParser + .for("javascript/dynamic") + .tap("JavascriptModulesPlugin", options => { + return new JavascriptParser("script"); + }); + normalModuleFactory.hooks.createParser + .for("javascript/esm") + .tap("JavascriptModulesPlugin", options => { + return new JavascriptParser("module"); + }); + normalModuleFactory.hooks.createGenerator + .for("javascript/auto") + .tap("JavascriptModulesPlugin", () => { + return new JavascriptGenerator(); + }); + normalModuleFactory.hooks.createGenerator + .for("javascript/dynamic") + .tap("JavascriptModulesPlugin", () => { + return new JavascriptGenerator(); + }); + normalModuleFactory.hooks.createGenerator + .for("javascript/esm") + .tap("JavascriptModulesPlugin", () => { + return new JavascriptGenerator(); + }); + compilation.hooks.renderManifest.tap( + "JavascriptModulesPlugin", + (result, options) => { + const { + hash, + chunk, + chunkGraph, + moduleGraph, + runtimeTemplate, + dependencyTemplates, + outputOptions, + codeGenerationResults + } = options; - // List of all used names to avoid conflicts - const allUsedNames = new Set(RESERVED_NAMES); - // Updated Top level declarations are created by renaming - const topLevelDeclarations = new Set(); + const hotUpdateChunk = + chunk instanceof HotUpdateChunk ? chunk : null; - // List of additional names in scope for module references - /** @type {Map, alreadyCheckedScopes: Set }>} */ - const usedNamesInScopeInfo = new Map(); - /** - * @param {string} module module identifier - * @param {string} id export id - * @returns {{ usedNames: Set, alreadyCheckedScopes: Set }} info - */ - const getUsedNamesInScopeInfo = (module, id) => { - const key = `${module}-${id}`; - let info = usedNamesInScopeInfo.get(key); - if (info === undefined) { - info = { - usedNames: new Set(), - alreadyCheckedScopes: new Set() - }; - usedNamesInScopeInfo.set(key, info); - } - return info; - }; + let render; + const filenameTemplate = + JavascriptModulesPlugin.getChunkFilenameTemplate( + chunk, + outputOptions + ); + if (hotUpdateChunk) { + render = () => + this.renderChunk( + { + chunk, + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + codeGenerationResults, + strictMode: runtimeTemplate.isModule() + }, + hooks + ); + } else if (chunk.hasRuntime()) { + render = () => + this.renderMain( + { + hash, + chunk, + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + codeGenerationResults, + strictMode: runtimeTemplate.isModule() + }, + hooks, + compilation + ); + } else { + if (!chunkHasJs(chunk, chunkGraph)) { + return result; + } - // Set of already checked scopes - const ignoredScopes = new Set(); + render = () => + this.renderChunk( + { + chunk, + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + codeGenerationResults, + strictMode: runtimeTemplate.isModule() + }, + hooks + ); + } - // get all global names - for (const info of modulesWithInfo) { - if (info.type === "concatenated") { - // ignore symbols from moduleScope - if (info.moduleScope) { - ignoredScopes.add(info.moduleScope); - } + result.push({ + render, + filenameTemplate, + pathOptions: { + hash, + runtime: chunk.runtime, + chunk, + contentHashType: "javascript" + }, + info: { + javascriptModule: compilation.runtimeTemplate.isModule() + }, + identifier: hotUpdateChunk + ? `hotupdatechunk${chunk.id}` + : `chunk${chunk.id}`, + hash: chunk.contentHash.javascript + }); - // The super class expression in class scopes behaves weird - // We get ranges of all super class expressions to make - // renaming to work correctly - const superClassCache = new WeakMap(); - const getSuperClassExpressions = scope => { - const cacheEntry = superClassCache.get(scope); - if (cacheEntry !== undefined) return cacheEntry; - const superClassExpressions = []; - for (const childScope of scope.childScopes) { - if (childScope.type !== "class") continue; - const block = childScope.block; + return result; + } + ); + compilation.hooks.chunkHash.tap( + "JavascriptModulesPlugin", + (chunk, hash, context) => { + hooks.chunkHash.call(chunk, hash, context); + if (chunk.hasRuntime()) { + this.updateHashWithBootstrap( + hash, + { + hash: "0000", + chunk, + codeGenerationResults: context.codeGenerationResults, + chunkGraph: context.chunkGraph, + moduleGraph: context.moduleGraph, + runtimeTemplate: context.runtimeTemplate + }, + hooks + ); + } + } + ); + compilation.hooks.contentHash.tap("JavascriptModulesPlugin", chunk => { + const { + chunkGraph, + codeGenerationResults, + moduleGraph, + runtimeTemplate, + outputOptions: { + hashSalt, + hashDigest, + hashDigestLength, + hashFunction + } + } = compilation; + const hash = createHash(hashFunction); + if (hashSalt) hash.update(hashSalt); + if (chunk.hasRuntime()) { + this.updateHashWithBootstrap( + hash, + { + hash: "0000", + chunk, + codeGenerationResults, + chunkGraph: compilation.chunkGraph, + moduleGraph: compilation.moduleGraph, + runtimeTemplate: compilation.runtimeTemplate + }, + hooks + ); + } else { + hash.update(`${chunk.id} `); + hash.update(chunk.ids ? chunk.ids.join(",") : ""); + } + hooks.chunkHash.call(chunk, hash, { + chunkGraph, + codeGenerationResults, + moduleGraph, + runtimeTemplate + }); + const modules = chunkGraph.getChunkModulesIterableBySourceType( + chunk, + "javascript" + ); + if (modules) { + const xor = new StringXor(); + for (const m of modules) { + xor.add(chunkGraph.getModuleHash(m, chunk.runtime)); + } + xor.updateHash(hash); + } + const runtimeModules = chunkGraph.getChunkModulesIterableBySourceType( + chunk, + "runtime" + ); + if (runtimeModules) { + const xor = new StringXor(); + for (const m of runtimeModules) { + xor.add(chunkGraph.getModuleHash(m, chunk.runtime)); + } + xor.updateHash(hash); + } + const digest = /** @type {string} */ (hash.digest(hashDigest)); + chunk.contentHash.javascript = nonNumericOnlyHash( + digest, + hashDigestLength + ); + }); + compilation.hooks.additionalTreeRuntimeRequirements.tap( + "JavascriptModulesPlugin", + (chunk, set, { chunkGraph }) => { if ( - (block.type === "ClassDeclaration" || - block.type === "ClassExpression") && - block.superClass + !set.has(RuntimeGlobals.startupNoDefault) && + chunkGraph.hasChunkEntryDependentChunks(chunk) ) { - superClassExpressions.push({ - range: block.superClass.range, - variables: childScope.variables - }); + set.add(RuntimeGlobals.onChunksLoaded); + set.add(RuntimeGlobals.require); } } - superClassCache.set(scope, superClassExpressions); - return superClassExpressions; - }; + ); + compilation.hooks.executeModule.tap( + "JavascriptModulesPlugin", + (options, context) => { + const source = + options.codeGenerationResult.sources.get("javascript"); + if (source === undefined) return; + const { module, moduleObject } = options; + const code = source.source(); - // add global symbols - if (info.globalScope) { - for (const reference of info.globalScope.through) { - const name = reference.identifier.name; - if (ConcatenationScope.isModuleReference(name)) { - const match = ConcatenationScope.matchModuleReference(name); - if (!match) continue; - const referencedInfo = modulesWithInfo[match.index]; - if (referencedInfo.type === "reference") - throw new Error("Module reference can't point to a reference"); - const binding = getFinalBinding( - moduleGraph, - referencedInfo, - match.ids, - moduleToInfoMap, - runtime, - requestShortener, - runtimeTemplate, - neededNamespaceObjects, - false, - info.module.buildMeta.strictHarmonyModule, - true - ); - if (!binding.ids) continue; - const { usedNames, alreadyCheckedScopes } = - getUsedNamesInScopeInfo( - binding.info.module.identifier(), - "name" in binding ? binding.name : "" - ); - for (const expr of getSuperClassExpressions(reference.from)) { - if ( - expr.range[0] <= reference.identifier.range[0] && - expr.range[1] >= reference.identifier.range[1] - ) { - for (const variable of expr.variables) { - usedNames.add(variable.name); - } - } + const fn = vm.runInThisContext( + `(function(${module.moduleArgument}, ${module.exportsArgument}, __webpack_require__) {\n${code}\n/**/})`, + { + filename: module.identifier(), + lineOffset: -1 } - addScopeSymbols( - reference.from, - usedNames, - alreadyCheckedScopes, - ignoredScopes + ); + try { + fn.call( + moduleObject.exports, + moduleObject, + moduleObject.exports, + context.__webpack_require__ ); - } else { - allUsedNames.add(name); + } catch (e) { + e.stack += printGeneratedCodeForStack(options.module, code); + throw e; } } - } - } - } + ); + compilation.hooks.executeModule.tap( + "JavascriptModulesPlugin", + (options, context) => { + const source = options.codeGenerationResult.sources.get("runtime"); + if (source === undefined) return; + let code = source.source(); + if (typeof code !== "string") code = code.toString(); - // generate names for symbols - for (const info of moduleToInfoMap.values()) { - const { usedNames: namespaceObjectUsedNames } = getUsedNamesInScopeInfo( - info.module.identifier(), - "" - ); - switch (info.type) { - case "concatenated": { - for (const variable of info.moduleScope.variables) { - const name = variable.name; - const { usedNames, alreadyCheckedScopes } = getUsedNamesInScopeInfo( - info.module.identifier(), - name - ); - if (allUsedNames.has(name) || usedNames.has(name)) { - const references = getAllReferences(variable); - for (const ref of references) { - addScopeSymbols( - ref.from, - usedNames, - alreadyCheckedScopes, - ignoredScopes - ); - } - const newName = this.findNewName( - name, - allUsedNames, - usedNames, - info.module.readableIdentifier(requestShortener) - ); - allUsedNames.add(newName); - info.internalNames.set(name, newName); - topLevelDeclarations.add(newName); - const source = info.source; - const allIdentifiers = new Set( - references.map(r => r.identifier).concat(variable.identifiers) - ); - for (const identifier of allIdentifiers) { - const r = identifier.range; - const path = getPathInAst(info.ast, identifier); - if (path && path.length > 1) { - const maybeProperty = - path[1].type === "AssignmentPattern" && - path[1].left === path[0] - ? path[2] - : path[1]; - if ( - maybeProperty.type === "Property" && - maybeProperty.shorthand - ) { - source.insert(r[1], `: ${newName}`); - continue; - } - } - source.replace(r[0], r[1] - 1, newName); + const fn = vm.runInThisContext( + `(function(__webpack_require__) {\n${code}\n/**/})`, + { + filename: options.module.identifier(), + lineOffset: -1 } - } else { - allUsedNames.add(name); - info.internalNames.set(name, name); - topLevelDeclarations.add(name); - } - } - let namespaceObjectName; - if (info.namespaceExportSymbol) { - namespaceObjectName = info.internalNames.get( - info.namespaceExportSymbol - ); - } else { - namespaceObjectName = this.findNewName( - "namespaceObject", - allUsedNames, - namespaceObjectUsedNames, - info.module.readableIdentifier(requestShortener) ); - allUsedNames.add(namespaceObjectName); + try { + fn.call(null, context.__webpack_require__); + } catch (e) { + e.stack += printGeneratedCodeForStack(options.module, code); + throw e; + } } - info.namespaceObjectName = namespaceObjectName; - topLevelDeclarations.add(namespaceObjectName); - break; - } - case "external": { - const externalName = this.findNewName( - "", - allUsedNames, - namespaceObjectUsedNames, - info.module.readableIdentifier(requestShortener) - ); - allUsedNames.add(externalName); - info.name = externalName; - topLevelDeclarations.add(externalName); - break; + ); + } + ); + } + + static getChunkFilenameTemplate(chunk, outputOptions) { + if (chunk.filenameTemplate) { + return chunk.filenameTemplate; + } else if (chunk instanceof HotUpdateChunk) { + return outputOptions.hotUpdateChunkFilename; + } else if (chunk.canBeInitial()) { + return outputOptions.filename; + } else { + return outputOptions.chunkFilename; + } + } + + /** + * @param {Module} module the rendered module + * @param {ChunkRenderContext} renderContext options object + * @param {CompilationHooks} hooks hooks + * @param {boolean} factory true: renders as factory method, false: pure module content + * @returns {Source} the newly generated source from rendering + */ + renderModule(module, renderContext, hooks, factory) { + const { + chunk, + chunkGraph, + runtimeTemplate, + codeGenerationResults, + strictMode + } = renderContext; + try { + const codeGenResult = codeGenerationResults.get(module, chunk.runtime); + const moduleSource = codeGenResult.sources.get("javascript"); + if (!moduleSource) return null; + if (codeGenResult.data !== undefined) { + const chunkInitFragments = codeGenResult.data.get("chunkInitFragments"); + if (chunkInitFragments) { + for (const i of chunkInitFragments) + renderContext.chunkInitFragments.push(i); } } - if (info.module.buildMeta.exportsType !== "namespace") { - const externalNameInterop = this.findNewName( - "namespaceObject", - allUsedNames, - namespaceObjectUsedNames, - info.module.readableIdentifier(requestShortener) + const moduleSourcePostContent = tryRunOrWebpackError( + () => + hooks.renderModuleContent.call(moduleSource, module, renderContext), + "JavascriptModulesPlugin.getCompilationHooks().renderModuleContent" + ); + let moduleSourcePostContainer; + if (factory) { + const runtimeRequirements = chunkGraph.getModuleRuntimeRequirements( + module, + chunk.runtime ); - allUsedNames.add(externalNameInterop); - info.interopNamespaceObjectName = externalNameInterop; - topLevelDeclarations.add(externalNameInterop); - } - if ( - info.module.buildMeta.exportsType === "default" && - info.module.buildMeta.defaultObject !== "redirect" - ) { - const externalNameInterop = this.findNewName( - "namespaceObject2", - allUsedNames, - namespaceObjectUsedNames, - info.module.readableIdentifier(requestShortener) + const needModule = runtimeRequirements.has(RuntimeGlobals.module); + const needExports = runtimeRequirements.has(RuntimeGlobals.exports); + const needRequire = + runtimeRequirements.has(RuntimeGlobals.require) || + runtimeRequirements.has(RuntimeGlobals.requireScope); + const needThisAsExports = runtimeRequirements.has( + RuntimeGlobals.thisAsExports ); - allUsedNames.add(externalNameInterop); - info.interopNamespaceObject2Name = externalNameInterop; - topLevelDeclarations.add(externalNameInterop); - } - if ( - info.module.buildMeta.exportsType === "dynamic" || - !info.module.buildMeta.exportsType - ) { - const externalNameInterop = this.findNewName( - "default", - allUsedNames, - namespaceObjectUsedNames, - info.module.readableIdentifier(requestShortener) + const needStrict = module.buildInfo.strict && !strictMode; + const cacheEntry = this._moduleFactoryCache.get( + moduleSourcePostContent ); - allUsedNames.add(externalNameInterop); - info.interopDefaultAccessName = externalNameInterop; - topLevelDeclarations.add(externalNameInterop); - } - } - - // Find and replace references to modules - for (const info of moduleToInfoMap.values()) { - if (info.type === "concatenated") { - for (const reference of info.globalScope.through) { - const name = reference.identifier.name; - const match = ConcatenationScope.matchModuleReference(name); - if (match) { - const referencedInfo = modulesWithInfo[match.index]; - if (referencedInfo.type === "reference") - throw new Error("Module reference can't point to a reference"); - const finalName = getFinalName( - moduleGraph, - referencedInfo, - match.ids, - moduleToInfoMap, - runtime, - requestShortener, - runtimeTemplate, - neededNamespaceObjects, - match.call, - !match.directImport, - info.module.buildMeta.strictHarmonyModule, - match.asiSafe + let source; + if ( + cacheEntry && + cacheEntry.needModule === needModule && + cacheEntry.needExports === needExports && + cacheEntry.needRequire === needRequire && + cacheEntry.needThisAsExports === needThisAsExports && + cacheEntry.needStrict === needStrict + ) { + source = cacheEntry.source; + } else { + const factorySource = new ConcatSource(); + const args = []; + if (needExports || needRequire || needModule) + args.push( + needModule + ? module.moduleArgument + : "__unused_webpack_" + module.moduleArgument ); - const r = reference.identifier.range; - const source = info.source; - // range is extended by 2 chars to cover the appended "._" - source.replace(r[0], r[1] + 1, finalName); + if (needExports || needRequire) + args.push( + needExports + ? module.exportsArgument + : "__unused_webpack_" + module.exportsArgument + ); + if (needRequire) args.push("__webpack_require__"); + if (!needThisAsExports && runtimeTemplate.supportsArrowFunction()) { + factorySource.add("/***/ ((" + args.join(", ") + ") => {\n\n"); + } else { + factorySource.add("/***/ (function(" + args.join(", ") + ") {\n\n"); + } + if (needStrict) { + factorySource.add('"use strict";\n'); } + factorySource.add(moduleSourcePostContent); + factorySource.add("\n\n/***/ })"); + source = new CachedSource(factorySource); + this._moduleFactoryCache.set(moduleSourcePostContent, { + source, + needModule, + needExports, + needRequire, + needThisAsExports, + needStrict + }); } + moduleSourcePostContainer = tryRunOrWebpackError( + () => hooks.renderModuleContainer.call(source, module, renderContext), + "JavascriptModulesPlugin.getCompilationHooks().renderModuleContainer" + ); + } else { + moduleSourcePostContainer = moduleSourcePostContent; } + return tryRunOrWebpackError( + () => + hooks.renderModulePackage.call( + moduleSourcePostContainer, + module, + renderContext + ), + "JavascriptModulesPlugin.getCompilationHooks().renderModulePackage" + ); + } catch (e) { + e.module = module; + throw e; } + } - // Map with all root exposed used exports - /** @type {Map} */ - const exportsMap = new Map(); + /** + * @param {RenderContext} renderContext the render context + * @param {CompilationHooks} hooks hooks + * @returns {Source} the rendered source + */ + renderChunk(renderContext, hooks) { + const { chunk, chunkGraph } = renderContext; + const modules = chunkGraph.getOrderedChunkModulesIterableBySourceType( + chunk, + "javascript", + compareModulesByIdentifier + ); + const allModules = modules ? Array.from(modules) : []; + let strictHeader; + let allStrict = renderContext.strictMode; + if (!allStrict && allModules.every(m => m.buildInfo.strict)) { + const strictBailout = hooks.strictRuntimeBailout.call(renderContext); + strictHeader = strictBailout + ? `// runtime can't be in strict mode because ${strictBailout}.\n` + : '"use strict";\n'; + if (!strictBailout) allStrict = true; + } + /** @type {ChunkRenderContext} */ + const chunkRenderContext = { + ...renderContext, + chunkInitFragments: [], + strictMode: allStrict + }; + const moduleSources = + Template.renderChunkModules(chunkRenderContext, allModules, module => + this.renderModule(module, chunkRenderContext, hooks, true) + ) || new RawSource("{}"); + let source = tryRunOrWebpackError( + () => hooks.renderChunk.call(moduleSources, chunkRenderContext), + "JavascriptModulesPlugin.getCompilationHooks().renderChunk" + ); + source = tryRunOrWebpackError( + () => hooks.renderContent.call(source, chunkRenderContext), + "JavascriptModulesPlugin.getCompilationHooks().renderContent" + ); + if (!source) { + throw new Error( + "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().renderContent plugins should return something" + ); + } + source = InitFragment.addToSource( + source, + chunkRenderContext.chunkInitFragments, + chunkRenderContext + ); + source = tryRunOrWebpackError( + () => hooks.render.call(source, chunkRenderContext), + "JavascriptModulesPlugin.getCompilationHooks().render" + ); + if (!source) { + throw new Error( + "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().render plugins should return something" + ); + } + chunk.rendered = true; + return strictHeader + ? new ConcatSource(strictHeader, source, ";") + : renderContext.runtimeTemplate.isModule() + ? source + : new ConcatSource(source, ";"); + } - // Set with all root exposed unused exports - /** @type {Set} */ - const unusedExports = new Set(); + /** + * @param {MainRenderContext} renderContext options object + * @param {CompilationHooks} hooks hooks + * @param {Compilation} compilation the compilation + * @returns {Source} the newly generated source from rendering + */ + renderMain(renderContext, hooks, compilation) { + const { chunk, chunkGraph, runtimeTemplate } = renderContext; + + const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk); + const iife = runtimeTemplate.isIIFE(); + + const bootstrap = this.renderBootstrap(renderContext, hooks); + const useSourceMap = hooks.useSourceMap.call(chunk, renderContext); - const rootInfo = /** @type {ConcatenatedModuleInfo} */ ( - moduleToInfoMap.get(this.rootModule) + const allModules = Array.from( + chunkGraph.getOrderedChunkModulesIterableBySourceType( + chunk, + "javascript", + compareModulesByIdentifier + ) || [] ); - const strictHarmonyModule = rootInfo.module.buildMeta.strictHarmonyModule; - const exportsInfo = moduleGraph.getExportsInfo(rootInfo.module); - for (const exportInfo of exportsInfo.orderedExports) { - const name = exportInfo.name; - if (exportInfo.provided === false) continue; - const used = exportInfo.getUsedName(undefined, runtime); - if (!used) { - unusedExports.add(name); - continue; + + const hasEntryModules = chunkGraph.getNumberOfEntryModules(chunk) > 0; + let inlinedModules; + if (bootstrap.allowInlineStartup && hasEntryModules) { + inlinedModules = new Set(chunkGraph.getChunkEntryModulesIterable(chunk)); + } + + let source = new ConcatSource(); + let prefix; + if (iife) { + if (runtimeTemplate.supportsArrowFunction()) { + source.add("/******/ (() => { // webpackBootstrap\n"); + } else { + source.add("/******/ (function() { // webpackBootstrap\n"); + } + prefix = "/******/ \t"; + } else { + prefix = "/******/ "; + } + let allStrict = renderContext.strictMode; + if (!allStrict && allModules.every(m => m.buildInfo.strict)) { + const strictBailout = hooks.strictRuntimeBailout.call(renderContext); + if (strictBailout) { + source.add( + prefix + + `// runtime can't be in strict mode because ${strictBailout}.\n` + ); + } else { + allStrict = true; + source.add(prefix + '"use strict";\n'); } - exportsMap.set(used, requestShortener => { - try { - const finalName = getFinalName( - moduleGraph, - rootInfo, - [name], - moduleToInfoMap, - runtime, - requestShortener, - runtimeTemplate, - neededNamespaceObjects, - false, - false, - strictHarmonyModule, - true - ); - return `/* ${ - exportInfo.isReexport() ? "reexport" : "binding" - } */ ${finalName}`; - } catch (e) { - e.message += `\nwhile generating the root export '${name}' (used name: '${used}')`; - throw e; - } - }); } - const result = new ConcatSource(); + /** @type {ChunkRenderContext} */ + const chunkRenderContext = { + ...renderContext, + chunkInitFragments: [], + strictMode: allStrict + }; - // add harmony compatibility flag (must be first because of possible circular dependencies) + const chunkModules = Template.renderChunkModules( + chunkRenderContext, + inlinedModules + ? allModules.filter(m => !inlinedModules.has(m)) + : allModules, + module => this.renderModule(module, chunkRenderContext, hooks, true), + prefix + ); if ( - moduleGraph.getExportsInfo(this).otherExportsInfo.getUsed(runtime) !== - UsageState.Unused + chunkModules || + runtimeRequirements.has(RuntimeGlobals.moduleFactories) || + runtimeRequirements.has(RuntimeGlobals.moduleFactoriesAddOnly) || + runtimeRequirements.has(RuntimeGlobals.require) ) { - result.add(`// ESM COMPAT FLAG\n`); - result.add( - runtimeTemplate.defineEsModuleFlagStatement({ - exportsArgument: this.exportsArgument, - runtimeRequirements - }) + source.add(prefix + "var __webpack_modules__ = ("); + source.add(chunkModules || "{}"); + source.add(");\n"); + source.add( + "/************************************************************************/\n" ); } - // define exports - if (exportsMap.size > 0) { - runtimeRequirements.add(RuntimeGlobals.exports); - runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); - const definitions = []; - for (const [key, value] of exportsMap) { - definitions.push( - `\n ${JSON.stringify(key)}: ${runtimeTemplate.returningFunction( - value(requestShortener) - )}` - ); - } - result.add(`\n// EXPORTS\n`); - result.add( - `${RuntimeGlobals.definePropertyGetters}(${ - this.exportsArgument - }, {${definitions.join(",")}\n});\n` + if (bootstrap.header.length > 0) { + const header = Template.asString(bootstrap.header) + "\n"; + source.add( + new PrefixSource( + prefix, + useSourceMap + ? new OriginalSource(header, "webpack/bootstrap") + : new RawSource(header) + ) ); - } - - // list unused exports - if (unusedExports.size > 0) { - result.add( - `\n// UNUSED EXPORTS: ${joinIterableWithComma(unusedExports)}\n` + source.add( + "/************************************************************************/\n" ); } - // generate namespace objects - const namespaceObjectSources = new Map(); - for (const info of neededNamespaceObjects) { - if (info.namespaceExportSymbol) continue; - const nsObj = []; - const exportsInfo = moduleGraph.getExportsInfo(info.module); - for (const exportInfo of exportsInfo.orderedExports) { - if (exportInfo.provided === false) continue; - const usedName = exportInfo.getUsedName(undefined, runtime); - if (usedName) { - const finalName = getFinalName( - moduleGraph, - info, - [exportInfo.name], - moduleToInfoMap, - runtime, - requestShortener, - runtimeTemplate, - neededNamespaceObjects, - false, - undefined, - info.module.buildMeta.strictHarmonyModule, - true - ); - nsObj.push( - `\n ${JSON.stringify( - usedName - )}: ${runtimeTemplate.returningFunction(finalName)}` - ); - } - } - const name = info.namespaceObjectName; - const defineGetters = - nsObj.length > 0 - ? `${RuntimeGlobals.definePropertyGetters}(${name}, {${nsObj.join( - "," - )}\n});\n` - : ""; - if (nsObj.length > 0) - runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); - namespaceObjectSources.set( - info, - ` -// NAMESPACE OBJECT: ${info.module.readableIdentifier(requestShortener)} -var ${name} = {}; -${RuntimeGlobals.makeNamespaceObject}(${name}); -${defineGetters}` - ); - runtimeRequirements.add(RuntimeGlobals.makeNamespaceObject); - } + const runtimeModules = + renderContext.chunkGraph.getChunkRuntimeModulesInOrder(chunk); - // define required namespace objects (must be before evaluation modules) - for (const info of modulesWithInfo) { - if (info.type === "concatenated") { - const source = namespaceObjectSources.get(info); - if (!source) continue; - result.add(source); + if (runtimeModules.length > 0) { + source.add( + new PrefixSource( + prefix, + Template.renderRuntimeModules(runtimeModules, chunkRenderContext) + ) + ); + source.add( + "/************************************************************************/\n" + ); + // runtimeRuntimeModules calls codeGeneration + for (const module of runtimeModules) { + compilation.codeGeneratedModules.add(module); } } - - const chunkInitFragments = []; - - // evaluate modules in order - for (const rawInfo of modulesWithInfo) { - let name; - let isConditional = false; - const info = rawInfo.type === "reference" ? rawInfo.target : rawInfo; - switch (info.type) { - case "concatenated": { - result.add( - `\n;// CONCATENATED MODULE: ${info.module.readableIdentifier( - requestShortener - )}\n` + if (inlinedModules) { + if (bootstrap.beforeStartup.length > 0) { + const beforeStartup = Template.asString(bootstrap.beforeStartup) + "\n"; + source.add( + new PrefixSource( + prefix, + useSourceMap + ? new OriginalSource(beforeStartup, "webpack/before-startup") + : new RawSource(beforeStartup) + ) + ); + } + const lastInlinedModule = last(inlinedModules); + const startupSource = new ConcatSource(); + startupSource.add(`var __webpack_exports__ = {};\n`); + for (const m of inlinedModules) { + const renderedModule = this.renderModule( + m, + chunkRenderContext, + hooks, + false + ); + if (renderedModule) { + const innerStrict = !allStrict && m.buildInfo.strict; + const runtimeRequirements = chunkGraph.getModuleRuntimeRequirements( + m, + chunk.runtime ); - result.add(info.source); - if (info.chunkInitFragments) { - for (const f of info.chunkInitFragments) chunkInitFragments.push(f); - } - if (info.runtimeRequirements) { - for (const r of info.runtimeRequirements) { - runtimeRequirements.add(r); + const exports = runtimeRequirements.has(RuntimeGlobals.exports); + const webpackExports = + exports && m.exportsArgument === "__webpack_exports__"; + let iife = innerStrict + ? "it need to be in strict mode." + : inlinedModules.size > 1 + ? // TODO check globals and top-level declarations of other entries and chunk modules + // to make a better decision + "it need to be isolated against other entry modules." + : chunkModules + ? "it need to be isolated against other modules in the chunk." + : exports && !webpackExports + ? `it uses a non-standard name for the exports (${m.exportsArgument}).` + : hooks.embedInRuntimeBailout.call(m, renderContext); + let footer; + if (iife !== undefined) { + startupSource.add( + `// This entry need to be wrapped in an IIFE because ${iife}\n` + ); + const arrow = runtimeTemplate.supportsArrowFunction(); + if (arrow) { + startupSource.add("(() => {\n"); + footer = "\n})();\n\n"; + } else { + startupSource.add("!function() {\n"); + footer = "\n}();\n"; } + if (innerStrict) startupSource.add('"use strict";\n'); + } else { + footer = "\n"; } - name = info.namespaceObjectName; - break; - } - case "external": { - result.add( - `\n// EXTERNAL MODULE: ${info.module.readableIdentifier( - requestShortener - )}\n` - ); - runtimeRequirements.add(RuntimeGlobals.require); - const { runtimeCondition } = - /** @type {ExternalModuleInfo | ReferenceToModuleInfo} */ (rawInfo); - const condition = runtimeTemplate.runtimeConditionExpression({ - chunkGraph, - runtimeCondition, - runtime, - runtimeRequirements - }); - if (condition !== "true") { - isConditional = true; - result.add(`if (${condition}) {\n`); + if (exports) { + if (m !== lastInlinedModule) + startupSource.add(`var ${m.exportsArgument} = {};\n`); + else if (m.exportsArgument !== "__webpack_exports__") + startupSource.add( + `var ${m.exportsArgument} = __webpack_exports__;\n` + ); } - result.add( - `var ${info.name} = __webpack_require__(${JSON.stringify( - chunkGraph.getModuleId(info.module) - )});` - ); - name = info.name; - break; + startupSource.add(renderedModule); + startupSource.add(footer); } - default: - // @ts-expect-error never is expected here - throw new Error(`Unsupported concatenation entry type ${info.type}`); - } - if (info.interopNamespaceObjectUsed) { - runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); - result.add( - `\nvar ${info.interopNamespaceObjectName} = /*#__PURE__*/${RuntimeGlobals.createFakeNamespaceObject}(${name}, 2);` - ); } - if (info.interopNamespaceObject2Used) { - runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); - result.add( - `\nvar ${info.interopNamespaceObject2Name} = /*#__PURE__*/${RuntimeGlobals.createFakeNamespaceObject}(${name});` + if (runtimeRequirements.has(RuntimeGlobals.onChunksLoaded)) { + startupSource.add( + `__webpack_exports__ = ${RuntimeGlobals.onChunksLoaded}(__webpack_exports__);\n` ); } - if (info.interopDefaultAccessUsed) { - runtimeRequirements.add(RuntimeGlobals.compatGetDefaultExport); - result.add( - `\nvar ${info.interopDefaultAccessName} = /*#__PURE__*/${RuntimeGlobals.compatGetDefaultExport}(${name});` + source.add( + hooks.renderStartup.call(startupSource, lastInlinedModule, { + ...renderContext, + inlined: true + }) + ); + if (bootstrap.afterStartup.length > 0) { + const afterStartup = Template.asString(bootstrap.afterStartup) + "\n"; + source.add( + new PrefixSource( + prefix, + useSourceMap + ? new OriginalSource(afterStartup, "webpack/after-startup") + : new RawSource(afterStartup) + ) ); } - if (isConditional) { - result.add("\n}"); - } + } else { + const lastEntryModule = last( + chunkGraph.getChunkEntryModulesIterable(chunk) + ); + const toSource = useSourceMap + ? (content, name) => + new OriginalSource(Template.asString(content), name) + : content => new RawSource(Template.asString(content)); + source.add( + new PrefixSource( + prefix, + new ConcatSource( + toSource(bootstrap.beforeStartup, "webpack/before-startup"), + "\n", + hooks.renderStartup.call( + toSource(bootstrap.startup.concat(""), "webpack/startup"), + lastEntryModule, + { + ...renderContext, + inlined: false + } + ), + toSource(bootstrap.afterStartup, "webpack/after-startup"), + "\n" + ) + ) + ); + } + if ( + hasEntryModules && + runtimeRequirements.has(RuntimeGlobals.returnExportsFromRuntime) + ) { + source.add(`${prefix}return __webpack_exports__;\n`); + } + if (iife) { + source.add("/******/ })()\n"); } - const data = new Map(); - if (chunkInitFragments.length > 0) - data.set("chunkInitFragments", chunkInitFragments); - data.set("topLevelDeclarations", topLevelDeclarations); - - /** @type {CodeGenerationResult} */ - const resultEntry = { - sources: new Map([["javascript", new CachedSource(result)]]), - data, - runtimeRequirements - }; - - return resultEntry; - } - - /** - * @param {Map} modulesMap modulesMap - * @param {ModuleInfo} info info - * @param {DependencyTemplates} dependencyTemplates dependencyTemplates - * @param {RuntimeTemplate} runtimeTemplate runtimeTemplate - * @param {ModuleGraph} moduleGraph moduleGraph - * @param {ChunkGraph} chunkGraph chunkGraph - * @param {RuntimeSpec} runtime runtime - * @param {CodeGenerationResults} codeGenerationResults codeGenerationResults - */ - _analyseModule( - modulesMap, - info, - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtime, - codeGenerationResults - ) { - if (info.type === "concatenated") { - const m = info.module; - try { - // Create a concatenation scope to track and capture information - const concatenationScope = new ConcatenationScope(modulesMap, info); - - // TODO cache codeGeneration results - const codeGenResult = m.codeGeneration({ - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtime, - concatenationScope, - codeGenerationResults - }); - const source = codeGenResult.sources.get("javascript"); - const data = codeGenResult.data; - const chunkInitFragments = data && data.get("chunkInitFragments"); - const code = source.source().toString(); - let ast; - try { - ast = JavascriptParser._parse(code, { - sourceType: "module" - }); - } catch (err) { - if ( - err.loc && - typeof err.loc === "object" && - typeof err.loc.line === "number" - ) { - const lineNumber = err.loc.line; - const lines = code.split("\n"); - err.message += - "\n| " + - lines - .slice(Math.max(0, lineNumber - 3), lineNumber + 2) - .join("\n| "); - } - throw err; - } - const scopeManager = eslintScope.analyze(ast, { - ecmaVersion: 6, - sourceType: "module", - optimistic: true, - ignoreEval: true, - impliedStrict: true - }); - const globalScope = scopeManager.acquire(ast); - const moduleScope = globalScope.childScopes[0]; - const resultSource = new ReplaceSource(source); - info.runtimeRequirements = codeGenResult.runtimeRequirements; - info.ast = ast; - info.internalSource = source; - info.source = resultSource; - info.chunkInitFragments = chunkInitFragments; - info.globalScope = globalScope; - info.moduleScope = moduleScope; - } catch (err) { - err.message += `\nwhile analyzing module ${m.identifier()} for concatenation`; - throw err; - } + /** @type {Source} */ + let finalSource = tryRunOrWebpackError( + () => hooks.renderMain.call(source, renderContext), + "JavascriptModulesPlugin.getCompilationHooks().renderMain" + ); + if (!finalSource) { + throw new Error( + "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().renderMain plugins should return something" + ); + } + finalSource = tryRunOrWebpackError( + () => hooks.renderContent.call(finalSource, renderContext), + "JavascriptModulesPlugin.getCompilationHooks().renderContent" + ); + if (!finalSource) { + throw new Error( + "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().renderContent plugins should return something" + ); } + finalSource = InitFragment.addToSource( + finalSource, + chunkRenderContext.chunkInitFragments, + chunkRenderContext + ); + finalSource = tryRunOrWebpackError( + () => hooks.render.call(finalSource, renderContext), + "JavascriptModulesPlugin.getCompilationHooks().render" + ); + if (!finalSource) { + throw new Error( + "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().render plugins should return something" + ); + } + chunk.rendered = true; + return iife ? new ConcatSource(finalSource, ";") : finalSource; } /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {RuntimeSpec} runtime the runtime - * @returns {[ModuleInfoOrReference[], Map]} module info items + * @param {Hash} hash the hash to be updated + * @param {RenderBootstrapContext} renderContext options object + * @param {CompilationHooks} hooks hooks */ - _getModulesWithInfo(moduleGraph, runtime) { - const orderedConcatenationList = this._createConcatenationList( - this.rootModule, - this._modules, - runtime, - moduleGraph - ); - /** @type {Map} */ - const map = new Map(); - const list = orderedConcatenationList.map((info, index) => { - let item = map.get(info.module); - if (item === undefined) { - switch (info.type) { - case "concatenated": - item = { - type: "concatenated", - module: info.module, - index, - ast: undefined, - internalSource: undefined, - runtimeRequirements: undefined, - source: undefined, - globalScope: undefined, - moduleScope: undefined, - internalNames: new Map(), - exportMap: undefined, - rawExportMap: undefined, - namespaceExportSymbol: undefined, - namespaceObjectName: undefined, - interopNamespaceObjectUsed: false, - interopNamespaceObjectName: undefined, - interopNamespaceObject2Used: false, - interopNamespaceObject2Name: undefined, - interopDefaultAccessUsed: false, - interopDefaultAccessName: undefined - }; - break; - case "external": - item = { - type: "external", - module: info.module, - runtimeCondition: info.runtimeCondition, - index, - name: undefined, - interopNamespaceObjectUsed: false, - interopNamespaceObjectName: undefined, - interopNamespaceObject2Used: false, - interopNamespaceObject2Name: undefined, - interopDefaultAccessUsed: false, - interopDefaultAccessName: undefined - }; - break; - default: - throw new Error( - `Unsupported concatenation entry type ${info.type}` - ); + updateHashWithBootstrap(hash, renderContext, hooks) { + const bootstrap = this.renderBootstrap(renderContext, hooks); + for (const key of Object.keys(bootstrap)) { + hash.update(key); + if (Array.isArray(bootstrap[key])) { + for (const line of bootstrap[key]) { + hash.update(line); } - map.set(item.module, item); - return item; } else { - /** @type {ReferenceToModuleInfo} */ - const ref = { - type: "reference", - runtimeCondition: info.runtimeCondition, - target: item - }; - return ref; + hash.update(JSON.stringify(bootstrap[key])); } - }); - return [list, map]; + } } - findNewName(oldName, usedNamed1, usedNamed2, extraInfo) { - let name = oldName; + /** + * @param {RenderBootstrapContext} renderContext options object + * @param {CompilationHooks} hooks hooks + * @returns {{ header: string[], beforeStartup: string[], startup: string[], afterStartup: string[], allowInlineStartup: boolean }} the generated source of the bootstrap code + */ + renderBootstrap(renderContext, hooks) { + const { + chunkGraph, + codeGenerationResults, + moduleGraph, + chunk, + runtimeTemplate + } = renderContext; - if (name === ConcatenationScope.DEFAULT_EXPORT) { - name = ""; + const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk); + + const requireFunction = runtimeRequirements.has(RuntimeGlobals.require); + const moduleCache = runtimeRequirements.has(RuntimeGlobals.moduleCache); + const moduleFactories = runtimeRequirements.has( + RuntimeGlobals.moduleFactories + ); + const moduleUsed = runtimeRequirements.has(RuntimeGlobals.module); + const requireScopeUsed = runtimeRequirements.has( + RuntimeGlobals.requireScope + ); + const interceptModuleExecution = runtimeRequirements.has( + RuntimeGlobals.interceptModuleExecution + ); + + const useRequire = + requireFunction || interceptModuleExecution || moduleUsed; + + const result = { + header: [], + beforeStartup: [], + startup: [], + afterStartup: [], + allowInlineStartup: true + }; + + let { header: buf, startup, beforeStartup, afterStartup } = result; + + if (result.allowInlineStartup && moduleFactories) { + startup.push( + "// module factories are used so entry inlining is disabled" + ); + result.allowInlineStartup = false; } - if (name === ConcatenationScope.NAMESPACE_OBJECT_EXPORT) { - name = "namespaceObject"; + if (result.allowInlineStartup && moduleCache) { + startup.push("// module cache are used so entry inlining is disabled"); + result.allowInlineStartup = false; + } + if (result.allowInlineStartup && interceptModuleExecution) { + startup.push( + "// module execution is intercepted so entry inlining is disabled" + ); + result.allowInlineStartup = false; } - // Remove uncool stuff - extraInfo = extraInfo.replace( - /\.+\/|(\/index)?\.([a-zA-Z0-9]{1,4})($|\s|\?)|\s*\+\s*\d+\s*modules/g, - "" - ); + if (useRequire || moduleCache) { + buf.push("// The module cache"); + buf.push("var __webpack_module_cache__ = {};"); + buf.push(""); + } - const splittedInfo = extraInfo.split("/"); - while (splittedInfo.length) { - name = splittedInfo.pop() + (name ? "_" + name : ""); - const nameIdent = Template.toIdentifier(name); - if ( - !usedNamed1.has(nameIdent) && - (!usedNamed2 || !usedNamed2.has(nameIdent)) - ) - return nameIdent; + if (useRequire) { + buf.push("// The require function"); + buf.push(`function __webpack_require__(moduleId) {`); + buf.push(Template.indent(this.renderRequire(renderContext, hooks))); + buf.push("}"); + buf.push(""); + } else if (runtimeRequirements.has(RuntimeGlobals.requireScope)) { + buf.push("// The require scope"); + buf.push("var __webpack_require__ = {};"); + buf.push(""); } - let i = 0; - let nameWithNumber = Template.toIdentifier(`${name}_${i}`); - while ( - usedNamed1.has(nameWithNumber) || - (usedNamed2 && usedNamed2.has(nameWithNumber)) + if ( + moduleFactories || + runtimeRequirements.has(RuntimeGlobals.moduleFactoriesAddOnly) ) { - i++; - nameWithNumber = Template.toIdentifier(`${name}_${i}`); + buf.push("// expose the modules object (__webpack_modules__)"); + buf.push(`${RuntimeGlobals.moduleFactories} = __webpack_modules__;`); + buf.push(""); } - return nameWithNumber; - } - /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - const { chunkGraph, runtime } = context; - for (const info of this._createConcatenationList( - this.rootModule, - this._modules, - intersectRuntime(runtime, this._runtime), - chunkGraph.moduleGraph - )) { - switch (info.type) { - case "concatenated": - info.module.updateHash(hash, context); - break; - case "external": - hash.update(`${chunkGraph.getModuleId(info.module)}`); - // TODO runtimeCondition - break; + if (moduleCache) { + buf.push("// expose the module cache"); + buf.push(`${RuntimeGlobals.moduleCache} = __webpack_module_cache__;`); + buf.push(""); + } + + if (interceptModuleExecution) { + buf.push("// expose the module execution interceptor"); + buf.push(`${RuntimeGlobals.interceptModuleExecution} = [];`); + buf.push(""); + } + + if (!runtimeRequirements.has(RuntimeGlobals.startupNoDefault)) { + if (chunkGraph.getNumberOfEntryModules(chunk) > 0) { + /** @type {string[]} */ + const buf2 = []; + const runtimeRequirements = + chunkGraph.getTreeRuntimeRequirements(chunk); + buf2.push("// Load entry module and return exports"); + let i = chunkGraph.getNumberOfEntryModules(chunk); + for (const [ + entryModule, + entrypoint + ] of chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk)) { + const chunks = entrypoint.chunks.filter(c => c !== chunk); + if (result.allowInlineStartup && chunks.length > 0) { + buf2.push( + "// This entry module depends on other loaded chunks and execution need to be delayed" + ); + result.allowInlineStartup = false; + } + if ( + result.allowInlineStartup && + someInIterable( + moduleGraph.getIncomingConnectionsByOriginModule(entryModule), + ([originModule, connections]) => + originModule && + connections.some(c => c.isTargetActive(chunk.runtime)) && + someInIterable( + chunkGraph.getModuleRuntimes(originModule), + runtime => + intersectRuntime(runtime, chunk.runtime) !== undefined + ) + ) + ) { + buf2.push( + "// This entry module is referenced by other modules so it can't be inlined" + ); + result.allowInlineStartup = false; + } + + let data; + if (codeGenerationResults.has(entryModule, chunk.runtime)) { + const result = codeGenerationResults.get( + entryModule, + chunk.runtime + ); + data = result.data; + } + if ( + result.allowInlineStartup && + (!data || !data.get("topLevelDeclarations")) && + (!entryModule.buildInfo || + !entryModule.buildInfo.topLevelDeclarations) + ) { + buf2.push( + "// This entry module doesn't tell about it's top-level declarations so it can't be inlined" + ); + result.allowInlineStartup = false; + } + if (result.allowInlineStartup) { + const bailout = hooks.inlineInRuntimeBailout.call( + entryModule, + renderContext + ); + if (bailout !== undefined) { + buf2.push( + `// This entry module can't be inlined because ${bailout}` + ); + result.allowInlineStartup = false; + } + } + i--; + const moduleId = chunkGraph.getModuleId(entryModule); + const entryRuntimeRequirements = + chunkGraph.getModuleRuntimeRequirements(entryModule, chunk.runtime); + let moduleIdExpr = JSON.stringify(moduleId); + if (runtimeRequirements.has(RuntimeGlobals.entryModuleId)) { + moduleIdExpr = `${RuntimeGlobals.entryModuleId} = ${moduleIdExpr}`; + } + if ( + result.allowInlineStartup && + entryRuntimeRequirements.has(RuntimeGlobals.module) + ) { + result.allowInlineStartup = false; + buf2.push( + "// This entry module used 'module' so it can't be inlined" + ); + } + if (chunks.length > 0) { + buf2.push( + `${i === 0 ? "var __webpack_exports__ = " : ""}${ + RuntimeGlobals.onChunksLoaded + }(undefined, ${JSON.stringify( + chunks.map(c => c.id) + )}, ${runtimeTemplate.returningFunction( + `__webpack_require__(${moduleIdExpr})` + )})` + ); + } else if (useRequire) { + buf2.push( + `${ + i === 0 ? "var __webpack_exports__ = " : "" + }__webpack_require__(${moduleIdExpr});` + ); + } else { + if (i === 0) buf2.push("var __webpack_exports__ = {};"); + if (requireScopeUsed) { + buf2.push( + `__webpack_modules__[${moduleIdExpr}](0, ${ + i === 0 ? "__webpack_exports__" : "{}" + }, __webpack_require__);` + ); + } else if (entryRuntimeRequirements.has(RuntimeGlobals.exports)) { + buf2.push( + `__webpack_modules__[${moduleIdExpr}](0, ${ + i === 0 ? "__webpack_exports__" : "{}" + });` + ); + } else { + buf2.push(`__webpack_modules__[${moduleIdExpr}]();`); + } + } + } + if (runtimeRequirements.has(RuntimeGlobals.onChunksLoaded)) { + buf2.push( + `__webpack_exports__ = ${RuntimeGlobals.onChunksLoaded}(__webpack_exports__);` + ); + } + if ( + runtimeRequirements.has(RuntimeGlobals.startup) || + (runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore) && + runtimeRequirements.has(RuntimeGlobals.startupOnlyAfter)) + ) { + result.allowInlineStartup = false; + buf.push("// the startup function"); + buf.push( + `${RuntimeGlobals.startup} = ${runtimeTemplate.basicFunction("", [ + ...buf2, + "return __webpack_exports__;" + ])};` + ); + buf.push(""); + startup.push("// run startup"); + startup.push( + `var __webpack_exports__ = ${RuntimeGlobals.startup}();` + ); + } else if (runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore)) { + buf.push("// the startup function"); + buf.push( + `${RuntimeGlobals.startup} = ${runtimeTemplate.emptyFunction()};` + ); + beforeStartup.push("// run runtime startup"); + beforeStartup.push(`${RuntimeGlobals.startup}();`); + startup.push("// startup"); + startup.push(Template.asString(buf2)); + } else if (runtimeRequirements.has(RuntimeGlobals.startupOnlyAfter)) { + buf.push("// the startup function"); + buf.push( + `${RuntimeGlobals.startup} = ${runtimeTemplate.emptyFunction()};` + ); + startup.push("// startup"); + startup.push(Template.asString(buf2)); + afterStartup.push("// run runtime startup"); + afterStartup.push(`${RuntimeGlobals.startup}();`); + } else { + startup.push("// startup"); + startup.push(Template.asString(buf2)); + } + } else if ( + runtimeRequirements.has(RuntimeGlobals.startup) || + runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore) || + runtimeRequirements.has(RuntimeGlobals.startupOnlyAfter) + ) { + buf.push( + "// the startup function", + "// It's empty as no entry modules are in this chunk", + `${RuntimeGlobals.startup} = ${runtimeTemplate.emptyFunction()};`, + "" + ); } + } else if ( + runtimeRequirements.has(RuntimeGlobals.startup) || + runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore) || + runtimeRequirements.has(RuntimeGlobals.startupOnlyAfter) + ) { + result.allowInlineStartup = false; + buf.push( + "// the startup function", + "// It's empty as some runtime module handles the default behavior", + `${RuntimeGlobals.startup} = ${runtimeTemplate.emptyFunction()};` + ); + startup.push("// run startup"); + startup.push(`var __webpack_exports__ = ${RuntimeGlobals.startup}();`); } - super.updateHash(hash, context); + return result; } - static deserialize(context) { - const obj = new ConcatenatedModule({ - identifier: undefined, - rootModule: undefined, - modules: undefined, - runtime: undefined - }); - obj.deserialize(context); - return obj; + /** + * @param {RenderBootstrapContext} renderContext options object + * @param {CompilationHooks} hooks hooks + * @returns {string} the generated source of the require function + */ + renderRequire(renderContext, hooks) { + const { + chunk, + chunkGraph, + runtimeTemplate: { outputOptions } + } = renderContext; + const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk); + const moduleExecution = runtimeRequirements.has( + RuntimeGlobals.interceptModuleExecution + ) + ? Template.asString([ + "var execOptions = { id: moduleId, module: module, factory: __webpack_modules__[moduleId], require: __webpack_require__ };", + `${RuntimeGlobals.interceptModuleExecution}.forEach(function(handler) { handler(execOptions); });`, + "module = execOptions.module;", + "execOptions.factory.call(module.exports, module, module.exports, execOptions.require);" + ]) + : runtimeRequirements.has(RuntimeGlobals.thisAsExports) + ? Template.asString([ + "__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);" + ]) + : Template.asString([ + "__webpack_modules__[moduleId](module, module.exports, __webpack_require__);" + ]); + const needModuleId = runtimeRequirements.has(RuntimeGlobals.moduleId); + const needModuleLoaded = runtimeRequirements.has( + RuntimeGlobals.moduleLoaded + ); + const content = Template.asString([ + "// Check if module is in cache", + "var cachedModule = __webpack_module_cache__[moduleId];", + "if (cachedModule !== undefined) {", + outputOptions.strictModuleErrorHandling + ? Template.indent([ + "if (cachedModule.error !== undefined) throw cachedModule.error;", + "return cachedModule.exports;" + ]) + : Template.indent("return cachedModule.exports;"), + "}", + "// Create a new module (and put it into the cache)", + "var module = __webpack_module_cache__[moduleId] = {", + Template.indent([ + needModuleId ? "id: moduleId," : "// no module.id needed", + needModuleLoaded ? "loaded: false," : "// no module.loaded needed", + "exports: {}" + ]), + "};", + "", + outputOptions.strictModuleExceptionHandling + ? Template.asString([ + "// Execute the module function", + "var threw = true;", + "try {", + Template.indent([moduleExecution, "threw = false;"]), + "} finally {", + Template.indent([ + "if(threw) delete __webpack_module_cache__[moduleId];" + ]), + "}" + ]) + : outputOptions.strictModuleErrorHandling + ? Template.asString([ + "// Execute the module function", + "try {", + Template.indent(moduleExecution), + "} catch(e) {", + Template.indent(["module.error = e;", "throw e;"]), + "}" + ]) + : Template.asString([ + "// Execute the module function", + moduleExecution + ]), + needModuleLoaded + ? Template.asString([ + "", + "// Flag the module as loaded", + "module.loaded = true;", + "" + ]) + : "", + "// Return the exports of the module", + "return module.exports;" + ]); + return tryRunOrWebpackError( + () => hooks.renderRequire.call(content, renderContext), + "JavascriptModulesPlugin.getCompilationHooks().renderRequire" + ); } } -makeSerializable(ConcatenatedModule, "webpack/lib/optimize/ConcatenatedModule"); - -module.exports = ConcatenatedModule; +module.exports = JavascriptModulesPlugin; +module.exports.chunkHasJs = chunkHasJs; /***/ }), -/***/ 96260: +/***/ 29050: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -101838,2551 +98398,3781 @@ module.exports = ConcatenatedModule; -const { STAGE_BASIC } = __webpack_require__(80057); - -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../Compiler")} Compiler */ - -class EnsureChunkConditionsPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "EnsureChunkConditionsPlugin", - compilation => { - const handler = chunks => { - const chunkGraph = compilation.chunkGraph; - // These sets are hoisted here to save memory - // They are cleared at the end of every loop - /** @type {Set} */ - const sourceChunks = new Set(); - /** @type {Set} */ - const chunkGroups = new Set(); - for (const module of compilation.modules) { - if (!module.hasChunkCondition()) continue; - for (const chunk of chunkGraph.getModuleChunksIterable(module)) { - if (!module.chunkCondition(chunk, compilation)) { - sourceChunks.add(chunk); - for (const group of chunk.groupsIterable) { - chunkGroups.add(group); - } - } - } - if (sourceChunks.size === 0) continue; - /** @type {Set} */ - const targetChunks = new Set(); - chunkGroupLoop: for (const chunkGroup of chunkGroups) { - // Can module be placed in a chunk of this group? - for (const chunk of chunkGroup.chunks) { - if (module.chunkCondition(chunk, compilation)) { - targetChunks.add(chunk); - continue chunkGroupLoop; - } - } - // We reached the entrypoint: fail - if (chunkGroup.isInitial()) { - throw new Error( - "Cannot fullfil chunk condition of " + module.identifier() - ); - } - // Try placing in all parents - for (const group of chunkGroup.parentsIterable) { - chunkGroups.add(group); - } - } - for (const sourceChunk of sourceChunks) { - chunkGraph.disconnectChunkAndModule(sourceChunk, module); - } - for (const targetChunk of targetChunks) { - chunkGraph.connectChunkAndModule(targetChunk, module); - } - sourceChunks.clear(); - chunkGroups.clear(); - } - }; - compilation.hooks.optimizeChunks.tap( - { - name: "EnsureChunkConditionsPlugin", - stage: STAGE_BASIC - }, - handler - ); - } - ); - } -} -module.exports = EnsureChunkConditionsPlugin; - - -/***/ }), - -/***/ 50089: -/***/ (function(module) { +const { Parser: AcornParser } = __webpack_require__(31988); +const { importAssertions } = __webpack_require__(72617); +const { SyncBailHook, HookMap } = __webpack_require__(41242); +const vm = __webpack_require__(26144); +const Parser = __webpack_require__(11715); +const StackedMap = __webpack_require__(58845); +const binarySearchBounds = __webpack_require__(92229); +const memoize = __webpack_require__(78676); +const BasicEvaluatedExpression = __webpack_require__(950); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** @typedef {import("acorn").Options} AcornOptions */ +/** @typedef {import("estree").ArrayExpression} ArrayExpressionNode */ +/** @typedef {import("estree").BinaryExpression} BinaryExpressionNode */ +/** @typedef {import("estree").BlockStatement} BlockStatementNode */ +/** @typedef {import("estree").SequenceExpression} SequenceExpressionNode */ +/** @typedef {import("estree").CallExpression} CallExpressionNode */ +/** @typedef {import("estree").ClassDeclaration} ClassDeclarationNode */ +/** @typedef {import("estree").ClassExpression} ClassExpressionNode */ +/** @typedef {import("estree").Comment} CommentNode */ +/** @typedef {import("estree").ConditionalExpression} ConditionalExpressionNode */ +/** @typedef {import("estree").Declaration} DeclarationNode */ +/** @typedef {import("estree").PrivateIdentifier} PrivateIdentifierNode */ +/** @typedef {import("estree").PropertyDefinition} PropertyDefinitionNode */ +/** @typedef {import("estree").Expression} ExpressionNode */ +/** @typedef {import("estree").Identifier} IdentifierNode */ +/** @typedef {import("estree").IfStatement} IfStatementNode */ +/** @typedef {import("estree").LabeledStatement} LabeledStatementNode */ +/** @typedef {import("estree").Literal} LiteralNode */ +/** @typedef {import("estree").LogicalExpression} LogicalExpressionNode */ +/** @typedef {import("estree").ChainExpression} ChainExpressionNode */ +/** @typedef {import("estree").MemberExpression} MemberExpressionNode */ +/** @typedef {import("estree").MetaProperty} MetaPropertyNode */ +/** @typedef {import("estree").MethodDefinition} MethodDefinitionNode */ +/** @typedef {import("estree").ModuleDeclaration} ModuleDeclarationNode */ +/** @typedef {import("estree").NewExpression} NewExpressionNode */ +/** @typedef {import("estree").Node} AnyNode */ +/** @typedef {import("estree").Program} ProgramNode */ +/** @typedef {import("estree").Statement} StatementNode */ +/** @typedef {import("estree").ImportDeclaration} ImportDeclarationNode */ +/** @typedef {import("estree").ExportNamedDeclaration} ExportNamedDeclarationNode */ +/** @typedef {import("estree").ExportDefaultDeclaration} ExportDefaultDeclarationNode */ +/** @typedef {import("estree").ExportAllDeclaration} ExportAllDeclarationNode */ +/** @typedef {import("estree").Super} SuperNode */ +/** @typedef {import("estree").TaggedTemplateExpression} TaggedTemplateExpressionNode */ +/** @typedef {import("estree").TemplateLiteral} TemplateLiteralNode */ +/** @typedef {import("estree").ThisExpression} ThisExpressionNode */ +/** @typedef {import("estree").UnaryExpression} UnaryExpressionNode */ +/** @typedef {import("estree").VariableDeclarator} VariableDeclaratorNode */ +/** @template T @typedef {import("tapable").AsArray} AsArray */ +/** @typedef {import("../Parser").ParserState} ParserState */ +/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ +/** @typedef {{declaredScope: ScopeInfo, freeName: string | true, tagInfo: TagInfo | undefined}} VariableInfoInterface */ +/** @typedef {{ name: string | VariableInfo, rootInfo: string | VariableInfo, getMembers: () => string[] }} GetInfoResult */ +const EMPTY_ARRAY = []; +const ALLOWED_MEMBER_TYPES_CALL_EXPRESSION = 0b01; +const ALLOWED_MEMBER_TYPES_EXPRESSION = 0b10; +const ALLOWED_MEMBER_TYPES_ALL = 0b11; +// Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ +const parser = AcornParser.extend(importAssertions); -class FlagIncludedChunksPlugin { +class VariableInfo { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {ScopeInfo} declaredScope scope in which the variable is declared + * @param {string | true} freeName which free name the variable aliases, or true when none + * @param {TagInfo | undefined} tagInfo info about tags */ - apply(compiler) { - compiler.hooks.compilation.tap("FlagIncludedChunksPlugin", compilation => { - compilation.hooks.optimizeChunkIds.tap( - "FlagIncludedChunksPlugin", - chunks => { - const chunkGraph = compilation.chunkGraph; - - // prepare two bit integers for each module - // 2^31 is the max number represented as SMI in v8 - // we want the bits distributed this way: - // the bit 2^31 is pretty rar and only one module should get it - // so it has a probability of 1 / modulesCount - // the first bit (2^0) is the easiest and every module could get it - // if it doesn't get a better bit - // from bit 2^n to 2^(n+1) there is a probability of p - // so 1 / modulesCount == p^31 - // <=> p = sqrt31(1 / modulesCount) - // so we use a modulo of 1 / sqrt31(1 / modulesCount) - /** @type {WeakMap} */ - const moduleBits = new WeakMap(); - const modulesCount = compilation.modules.size; - - // precalculate the modulo values for each bit - const modulo = 1 / Math.pow(1 / modulesCount, 1 / 31); - const modulos = Array.from( - { length: 31 }, - (x, i) => Math.pow(modulo, i) | 0 - ); - - // iterate all modules to generate bit values - let i = 0; - for (const module of compilation.modules) { - let bit = 30; - while (i % modulos[bit] !== 0) { - bit--; - } - moduleBits.set(module, 1 << bit); - i++; - } - - // iterate all chunks to generate bitmaps - /** @type {WeakMap} */ - const chunkModulesHash = new WeakMap(); - for (const chunk of chunks) { - let hash = 0; - for (const module of chunkGraph.getChunkModulesIterable(chunk)) { - hash |= moduleBits.get(module); - } - chunkModulesHash.set(chunk, hash); - } - - for (const chunkA of chunks) { - const chunkAHash = chunkModulesHash.get(chunkA); - const chunkAModulesCount = - chunkGraph.getNumberOfChunkModules(chunkA); - if (chunkAModulesCount === 0) continue; - let bestModule = undefined; - for (const module of chunkGraph.getChunkModulesIterable(chunkA)) { - if ( - bestModule === undefined || - chunkGraph.getNumberOfModuleChunks(bestModule) > - chunkGraph.getNumberOfModuleChunks(module) - ) - bestModule = module; - } - loopB: for (const chunkB of chunkGraph.getModuleChunksIterable( - bestModule - )) { - // as we iterate the same iterables twice - // skip if we find ourselves - if (chunkA === chunkB) continue; - - const chunkBModulesCount = - chunkGraph.getNumberOfChunkModules(chunkB); + constructor(declaredScope, freeName, tagInfo) { + this.declaredScope = declaredScope; + this.freeName = freeName; + this.tagInfo = tagInfo; + } +} - // ids for empty chunks are not included - if (chunkBModulesCount === 0) continue; +/** @typedef {string | ScopeInfo | VariableInfo} ExportedVariableInfo */ +/** @typedef {LiteralNode | string | null | undefined} ImportSource */ +/** @typedef {Omit & { sourceType: "module" | "script" | "auto", ecmaVersion?: AcornOptions["ecmaVersion"] }} ParseOptions */ - // instead of swapping A and B just bail - // as we loop twice the current A will be B and B then A - if (chunkAModulesCount > chunkBModulesCount) continue; +/** + * @typedef {Object} TagInfo + * @property {any} tag + * @property {any} data + * @property {TagInfo | undefined} next + */ - // is chunkA in chunkB? +/** + * @typedef {Object} ScopeInfo + * @property {StackedMap} definitions + * @property {boolean | "arrow"} topLevelScope + * @property {boolean} inShorthand + * @property {boolean} isStrict + * @property {boolean} isAsmJs + * @property {boolean} inTry + */ - // we do a cheap check for the hash value - const chunkBHash = chunkModulesHash.get(chunkB); - if ((chunkBHash & chunkAHash) !== chunkAHash) continue; +const joinRanges = (startRange, endRange) => { + if (!endRange) return startRange; + if (!startRange) return endRange; + return [startRange[0], endRange[1]]; +}; - // compare all modules - for (const m of chunkGraph.getChunkModulesIterable(chunkA)) { - if (!chunkGraph.isModuleInChunk(m, chunkB)) continue loopB; - } - chunkB.ids.push(chunkA.id); - } - } - } - ); - }); +const objectAndMembersToName = (object, membersReversed) => { + let name = object; + for (let i = membersReversed.length - 1; i >= 0; i--) { + name = name + "." + membersReversed[i]; } -} -module.exports = FlagIncludedChunksPlugin; - - -/***/ }), + return name; +}; -/***/ 38988: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +const getRootName = expression => { + switch (expression.type) { + case "Identifier": + return expression.name; + case "ThisExpression": + return "this"; + case "MetaProperty": + return `${expression.meta.name}.${expression.property.name}`; + default: + return undefined; + } +}; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sergey Melyukov @smelukov -*/ +/** @type {AcornOptions} */ +const defaultParserOptions = { + ranges: true, + locations: true, + ecmaVersion: "latest", + sourceType: "module", + // https://github.com/tc39/proposal-hashbang + allowHashBang: true, + onComment: null +}; +// regexp to match at least one "magic comment" +const webpackCommentRegExp = new RegExp(/(^|\W)webpack[A-Z]{1,}[A-Za-z]{1,}:/); +const EMPTY_COMMENT_OPTIONS = { + options: null, + errors: null +}; -const { UsageState } = __webpack_require__(63686); +class JavascriptParser extends Parser { + /** + * @param {"module" | "script" | "auto"} sourceType default source type + */ + constructor(sourceType = "auto") { + super(); + this.hooks = Object.freeze({ + /** @type {HookMap>} */ + evaluateTypeof: new HookMap(() => new SyncBailHook(["expression"])), + /** @type {HookMap>} */ + evaluate: new HookMap(() => new SyncBailHook(["expression"])), + /** @type {HookMap>} */ + evaluateIdentifier: new HookMap(() => new SyncBailHook(["expression"])), + /** @type {HookMap>} */ + evaluateDefinedIdentifier: new HookMap( + () => new SyncBailHook(["expression"]) + ), + /** @type {HookMap>} */ + evaluateCallExpressionMember: new HookMap( + () => new SyncBailHook(["expression", "param"]) + ), + /** @type {HookMap>} */ + isPure: new HookMap( + () => new SyncBailHook(["expression", "commentsStartPosition"]) + ), + /** @type {SyncBailHook<[StatementNode | ModuleDeclarationNode], boolean | void>} */ + preStatement: new SyncBailHook(["statement"]), -/** @typedef {import("estree").Node} AnyNode */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + /** @type {SyncBailHook<[StatementNode | ModuleDeclarationNode], boolean | void>} */ + blockPreStatement: new SyncBailHook(["declaration"]), + /** @type {SyncBailHook<[StatementNode | ModuleDeclarationNode], boolean | void>} */ + statement: new SyncBailHook(["statement"]), + /** @type {SyncBailHook<[IfStatementNode], boolean | void>} */ + statementIf: new SyncBailHook(["statement"]), + /** @type {SyncBailHook<[ExpressionNode, ClassExpressionNode | ClassDeclarationNode], boolean | void>} */ + classExtendsExpression: new SyncBailHook([ + "expression", + "classDefinition" + ]), + /** @type {SyncBailHook<[MethodDefinitionNode | PropertyDefinitionNode, ClassExpressionNode | ClassDeclarationNode], boolean | void>} */ + classBodyElement: new SyncBailHook(["element", "classDefinition"]), + /** @type {SyncBailHook<[ExpressionNode, MethodDefinitionNode | PropertyDefinitionNode, ClassExpressionNode | ClassDeclarationNode], boolean | void>} */ + classBodyValue: new SyncBailHook([ + "expression", + "element", + "classDefinition" + ]), + /** @type {HookMap>} */ + label: new HookMap(() => new SyncBailHook(["statement"])), + /** @type {SyncBailHook<[ImportDeclarationNode, ImportSource], boolean | void>} */ + import: new SyncBailHook(["statement", "source"]), + /** @type {SyncBailHook<[ImportDeclarationNode, ImportSource, string, string], boolean | void>} */ + importSpecifier: new SyncBailHook([ + "statement", + "source", + "exportName", + "identifierName" + ]), + /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode], boolean | void>} */ + export: new SyncBailHook(["statement"]), + /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, ImportSource], boolean | void>} */ + exportImport: new SyncBailHook(["statement", "source"]), + /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, DeclarationNode], boolean | void>} */ + exportDeclaration: new SyncBailHook(["statement", "declaration"]), + /** @type {SyncBailHook<[ExportDefaultDeclarationNode, DeclarationNode], boolean | void>} */ + exportExpression: new SyncBailHook(["statement", "declaration"]), + /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, string, string, number | undefined], boolean | void>} */ + exportSpecifier: new SyncBailHook([ + "statement", + "identifierName", + "exportName", + "index" + ]), + /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, ImportSource, string, string, number | undefined], boolean | void>} */ + exportImportSpecifier: new SyncBailHook([ + "statement", + "source", + "identifierName", + "exportName", + "index" + ]), + /** @type {SyncBailHook<[VariableDeclaratorNode, StatementNode], boolean | void>} */ + preDeclarator: new SyncBailHook(["declarator", "statement"]), + /** @type {SyncBailHook<[VariableDeclaratorNode, StatementNode], boolean | void>} */ + declarator: new SyncBailHook(["declarator", "statement"]), + /** @type {HookMap>} */ + varDeclaration: new HookMap(() => new SyncBailHook(["declaration"])), + /** @type {HookMap>} */ + varDeclarationLet: new HookMap(() => new SyncBailHook(["declaration"])), + /** @type {HookMap>} */ + varDeclarationConst: new HookMap(() => new SyncBailHook(["declaration"])), + /** @type {HookMap>} */ + varDeclarationVar: new HookMap(() => new SyncBailHook(["declaration"])), + /** @type {HookMap>} */ + pattern: new HookMap(() => new SyncBailHook(["pattern"])), + /** @type {HookMap>} */ + canRename: new HookMap(() => new SyncBailHook(["initExpression"])), + /** @type {HookMap>} */ + rename: new HookMap(() => new SyncBailHook(["initExpression"])), + /** @type {HookMap>} */ + assign: new HookMap(() => new SyncBailHook(["expression"])), + /** @type {HookMap>} */ + assignMemberChain: new HookMap( + () => new SyncBailHook(["expression", "members"]) + ), + /** @type {HookMap>} */ + typeof: new HookMap(() => new SyncBailHook(["expression"])), + /** @type {SyncBailHook<[ExpressionNode], boolean | void>} */ + importCall: new SyncBailHook(["expression"]), + /** @type {SyncBailHook<[ExpressionNode], boolean | void>} */ + topLevelAwait: new SyncBailHook(["expression"]), + /** @type {HookMap>} */ + call: new HookMap(() => new SyncBailHook(["expression"])), + /** Something like "a.b()" */ + /** @type {HookMap>} */ + callMemberChain: new HookMap( + () => new SyncBailHook(["expression", "members"]) + ), + /** Something like "a.b().c.d" */ + /** @type {HookMap>} */ + memberChainOfCallMemberChain: new HookMap( + () => + new SyncBailHook([ + "expression", + "calleeMembers", + "callExpression", + "members" + ]) + ), + /** Something like "a.b().c.d()"" */ + /** @type {HookMap>} */ + callMemberChainOfCallMemberChain: new HookMap( + () => + new SyncBailHook([ + "expression", + "calleeMembers", + "innerCallExpression", + "members" + ]) + ), + /** @type {SyncBailHook<[ChainExpressionNode], boolean | void>} */ + optionalChaining: new SyncBailHook(["optionalChaining"]), + /** @type {HookMap>} */ + new: new HookMap(() => new SyncBailHook(["expression"])), + /** @type {HookMap>} */ + expression: new HookMap(() => new SyncBailHook(["expression"])), + /** @type {HookMap>} */ + expressionMemberChain: new HookMap( + () => new SyncBailHook(["expression", "members"]) + ), + /** @type {HookMap>} */ + unhandledExpressionMemberChain: new HookMap( + () => new SyncBailHook(["expression", "members"]) + ), + /** @type {SyncBailHook<[ExpressionNode], boolean | void>} */ + expressionConditionalOperator: new SyncBailHook(["expression"]), + /** @type {SyncBailHook<[ExpressionNode], boolean | void>} */ + expressionLogicalOperator: new SyncBailHook(["expression"]), + /** @type {SyncBailHook<[ProgramNode, CommentNode[]], boolean | void>} */ + program: new SyncBailHook(["ast", "comments"]), + /** @type {SyncBailHook<[ProgramNode, CommentNode[]], boolean | void>} */ + finish: new SyncBailHook(["ast", "comments"]) + }); + this.sourceType = sourceType; + /** @type {ScopeInfo} */ + this.scope = undefined; + /** @type {ParserState} */ + this.state = undefined; + this.comments = undefined; + this.semicolons = undefined; + /** @type {(StatementNode|ExpressionNode)[]} */ + this.statementPath = undefined; + this.prevStatement = undefined; + this.currentTagData = undefined; + this._initializeEvaluating(); + } -/** @typedef {Map | true>} InnerGraph */ -/** @typedef {function(boolean | Set | undefined): void} UsageCallback */ + _initializeEvaluating() { + this.hooks.evaluate.for("Literal").tap("JavascriptParser", _expr => { + const expr = /** @type {LiteralNode} */ (_expr); -/** - * @typedef {Object} StateObject - * @property {InnerGraph} innerGraph - * @property {TopLevelSymbol=} currentTopLevelSymbol - * @property {Map>} usageCallbackMap - */ + switch (typeof expr.value) { + case "number": + return new BasicEvaluatedExpression() + .setNumber(expr.value) + .setRange(expr.range); + case "bigint": + return new BasicEvaluatedExpression() + .setBigInt(expr.value) + .setRange(expr.range); + case "string": + return new BasicEvaluatedExpression() + .setString(expr.value) + .setRange(expr.range); + case "boolean": + return new BasicEvaluatedExpression() + .setBoolean(expr.value) + .setRange(expr.range); + } + if (expr.value === null) { + return new BasicEvaluatedExpression().setNull().setRange(expr.range); + } + if (expr.value instanceof RegExp) { + return new BasicEvaluatedExpression() + .setRegExp(expr.value) + .setRange(expr.range); + } + }); + this.hooks.evaluate.for("NewExpression").tap("JavascriptParser", _expr => { + const expr = /** @type {NewExpressionNode} */ (_expr); + const callee = expr.callee; + if ( + callee.type !== "Identifier" || + callee.name !== "RegExp" || + expr.arguments.length > 2 || + this.getVariableInfo("RegExp") !== "RegExp" + ) + return; -/** @typedef {false|StateObject} State */ + let regExp, flags; + const arg1 = expr.arguments[0]; -/** @type {WeakMap} */ -const parserStateMap = new WeakMap(); -const topLevelSymbolTag = Symbol("top level symbol"); + if (arg1) { + if (arg1.type === "SpreadElement") return; -/** - * @param {ParserState} parserState parser state - * @returns {State} state - */ -function getState(parserState) { - return parserStateMap.get(parserState); -} + const evaluatedRegExp = this.evaluateExpression(arg1); -/** - * @param {ParserState} parserState parser state - * @returns {void} - */ -exports.bailout = parserState => { - parserStateMap.set(parserState, false); -}; + if (!evaluatedRegExp) return; -/** - * @param {ParserState} parserState parser state - * @returns {void} - */ -exports.enable = parserState => { - const state = parserStateMap.get(parserState); - if (state === false) { - return; - } - parserStateMap.set(parserState, { - innerGraph: new Map(), - currentTopLevelSymbol: undefined, - usageCallbackMap: new Map() - }); -}; + regExp = evaluatedRegExp.asString(); -/** - * @param {ParserState} parserState parser state - * @returns {boolean} true, when enabled - */ -exports.isEnabled = parserState => { - const state = parserStateMap.get(parserState); - return !!state; -}; + if (!regExp) return; + } else { + return new BasicEvaluatedExpression() + .setRegExp(new RegExp("")) + .setRange(expr.range); + } -/** - * @param {ParserState} state parser state - * @param {TopLevelSymbol | null} symbol the symbol, or null for all symbols - * @param {string | TopLevelSymbol | true} usage usage data - * @returns {void} - */ -exports.addUsage = (state, symbol, usage) => { - const innerGraphState = getState(state); + const arg2 = expr.arguments[1]; - if (innerGraphState) { - const { innerGraph } = innerGraphState; - const info = innerGraph.get(symbol); - if (usage === true) { - innerGraph.set(symbol, true); - } else if (info === undefined) { - innerGraph.set(symbol, new Set([usage])); - } else if (info !== true) { - info.add(usage); - } - } -}; + if (arg2) { + if (arg2.type === "SpreadElement") return; -/** - * @param {JavascriptParser} parser the parser - * @param {string} name name of variable - * @param {string | TopLevelSymbol | true} usage usage data - * @returns {void} - */ -exports.addVariableUsage = (parser, name, usage) => { - const symbol = - /** @type {TopLevelSymbol} */ ( - parser.getTagData(name, topLevelSymbolTag) - ) || exports.tagTopLevelSymbol(parser, name); - if (symbol) { - exports.addUsage(parser.state, symbol, usage); - } -}; + const evaluatedFlags = this.evaluateExpression(arg2); -/** - * @param {ParserState} state parser state - * @returns {void} - */ -exports.inferDependencyUsage = state => { - const innerGraphState = getState(state); + if (!evaluatedFlags) return; - if (!innerGraphState) { - return; - } + if (!evaluatedFlags.isUndefined()) { + flags = evaluatedFlags.asString(); - const { innerGraph, usageCallbackMap } = innerGraphState; - const processed = new Map(); - // flatten graph to terminal nodes (string, undefined or true) - const nonTerminal = new Set(innerGraph.keys()); - while (nonTerminal.size > 0) { - for (const key of nonTerminal) { - /** @type {Set | true} */ - let newSet = new Set(); - let isTerminal = true; - const value = innerGraph.get(key); - let alreadyProcessed = processed.get(key); - if (alreadyProcessed === undefined) { - alreadyProcessed = new Set(); - processed.set(key, alreadyProcessed); - } - if (value !== true && value !== undefined) { - for (const item of value) { - alreadyProcessed.add(item); - } - for (const item of value) { - if (typeof item === "string") { - newSet.add(item); - } else { - const itemValue = innerGraph.get(item); - if (itemValue === true) { - newSet = true; - break; - } - if (itemValue !== undefined) { - for (const i of itemValue) { - if (i === key) continue; - if (alreadyProcessed.has(i)) continue; - newSet.add(i); - if (typeof i !== "string") { - isTerminal = false; - } - } - } - } - } - if (newSet === true) { - innerGraph.set(key, true); - } else if (newSet.size === 0) { - innerGraph.set(key, undefined); - } else { - innerGraph.set(key, newSet); + if ( + flags === undefined || + !BasicEvaluatedExpression.isValidRegExpFlags(flags) + ) + return; } } - if (isTerminal) { - nonTerminal.delete(key); - // For the global key, merge with all other keys - if (key === null) { - const globalValue = innerGraph.get(null); - if (globalValue) { - for (const [key, value] of innerGraph) { - if (key !== null && value !== true) { - if (globalValue === true) { - innerGraph.set(key, true); - } else { - const newSet = new Set(value); - for (const item of globalValue) { - newSet.add(item); - } - innerGraph.set(key, newSet); - } - } - } - } - } - } - } - } + return new BasicEvaluatedExpression() + .setRegExp(flags ? new RegExp(regExp, flags) : new RegExp(regExp)) + .setRange(expr.range); + }); + this.hooks.evaluate + .for("LogicalExpression") + .tap("JavascriptParser", _expr => { + const expr = /** @type {LogicalExpressionNode} */ (_expr); - /** @type {Map>} */ - for (const [symbol, callbacks] of usageCallbackMap) { - const usage = /** @type {true | Set | undefined} */ ( - innerGraph.get(symbol) - ); - for (const callback of callbacks) { - callback(usage === undefined ? false : usage); - } - } -}; + const left = this.evaluateExpression(expr.left); + if (!left) return; + let returnRight = false; + /** @type {boolean|undefined} */ + let allowedRight; + if (expr.operator === "&&") { + const leftAsBool = left.asBool(); + if (leftAsBool === false) return left.setRange(expr.range); + returnRight = leftAsBool === true; + allowedRight = false; + } else if (expr.operator === "||") { + const leftAsBool = left.asBool(); + if (leftAsBool === true) return left.setRange(expr.range); + returnRight = leftAsBool === false; + allowedRight = true; + } else if (expr.operator === "??") { + const leftAsNullish = left.asNullish(); + if (leftAsNullish === false) return left.setRange(expr.range); + if (leftAsNullish !== true) return; + returnRight = true; + } else return; + const right = this.evaluateExpression(expr.right); + if (!right) return; + if (returnRight) { + if (left.couldHaveSideEffects()) right.setSideEffects(); + return right.setRange(expr.range); + } -/** - * @param {ParserState} state parser state - * @param {UsageCallback} onUsageCallback on usage callback - */ -exports.onUsage = (state, onUsageCallback) => { - const innerGraphState = getState(state); + const asBool = right.asBool(); - if (innerGraphState) { - const { usageCallbackMap, currentTopLevelSymbol } = innerGraphState; - if (currentTopLevelSymbol) { - let callbacks = usageCallbackMap.get(currentTopLevelSymbol); + if (allowedRight === true && asBool === true) { + return new BasicEvaluatedExpression() + .setRange(expr.range) + .setTruthy(); + } else if (allowedRight === false && asBool === false) { + return new BasicEvaluatedExpression().setRange(expr.range).setFalsy(); + } + }); - if (callbacks === undefined) { - callbacks = new Set(); - usageCallbackMap.set(currentTopLevelSymbol, callbacks); + const valueAsExpression = (value, expr, sideEffects) => { + switch (typeof value) { + case "boolean": + return new BasicEvaluatedExpression() + .setBoolean(value) + .setSideEffects(sideEffects) + .setRange(expr.range); + case "number": + return new BasicEvaluatedExpression() + .setNumber(value) + .setSideEffects(sideEffects) + .setRange(expr.range); + case "bigint": + return new BasicEvaluatedExpression() + .setBigInt(value) + .setSideEffects(sideEffects) + .setRange(expr.range); + case "string": + return new BasicEvaluatedExpression() + .setString(value) + .setSideEffects(sideEffects) + .setRange(expr.range); } + }; - callbacks.add(onUsageCallback); - } else { - onUsageCallback(true); - } - } else { - onUsageCallback(undefined); - } -}; - -/** - * @param {ParserState} state parser state - * @param {TopLevelSymbol} symbol the symbol - */ -exports.setTopLevelSymbol = (state, symbol) => { - const innerGraphState = getState(state); - - if (innerGraphState) { - innerGraphState.currentTopLevelSymbol = symbol; - } -}; - -/** - * @param {ParserState} state parser state - * @returns {TopLevelSymbol|void} usage data - */ -exports.getTopLevelSymbol = state => { - const innerGraphState = getState(state); - - if (innerGraphState) { - return innerGraphState.currentTopLevelSymbol; - } -}; - -/** - * @param {JavascriptParser} parser parser - * @param {string} name name of variable - * @returns {TopLevelSymbol} symbol - */ -exports.tagTopLevelSymbol = (parser, name) => { - const innerGraphState = getState(parser.state); - if (!innerGraphState) return; + this.hooks.evaluate + .for("BinaryExpression") + .tap("JavascriptParser", _expr => { + const expr = /** @type {BinaryExpressionNode} */ (_expr); - parser.defineVariable(name); + const handleConstOperation = fn => { + const left = this.evaluateExpression(expr.left); + if (!left || !left.isCompileTimeValue()) return; - const existingTag = /** @type {TopLevelSymbol} */ ( - parser.getTagData(name, topLevelSymbolTag) - ); - if (existingTag) { - return existingTag; - } + const right = this.evaluateExpression(expr.right); + if (!right || !right.isCompileTimeValue()) return; - const fn = new TopLevelSymbol(name); - parser.tagVariable(name, topLevelSymbolTag, fn); - return fn; -}; + const result = fn( + left.asCompileTimeValue(), + right.asCompileTimeValue() + ); + return valueAsExpression( + result, + expr, + left.couldHaveSideEffects() || right.couldHaveSideEffects() + ); + }; -/** - * @param {Dependency} dependency the dependency - * @param {Set | boolean} usedByExports usedByExports info - * @param {ModuleGraph} moduleGraph moduleGraph - * @param {RuntimeSpec} runtime runtime - * @returns {boolean} false, when unused. Otherwise true - */ -exports.isDependencyUsedByExports = ( - dependency, - usedByExports, - moduleGraph, - runtime -) => { - if (usedByExports === false) return false; - if (usedByExports !== true && usedByExports !== undefined) { - const selfModule = moduleGraph.getParentModule(dependency); - const exportsInfo = moduleGraph.getExportsInfo(selfModule); - let used = false; - for (const exportName of usedByExports) { - if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) - used = true; - } - if (!used) return false; - } - return true; -}; + const isAlwaysDifferent = (a, b) => + (a === true && b === false) || (a === false && b === true); -/** - * @param {Dependency} dependency the dependency - * @param {Set | boolean} usedByExports usedByExports info - * @param {ModuleGraph} moduleGraph moduleGraph - * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active - */ -exports.getDependencyUsedByExportsCondition = ( - dependency, - usedByExports, - moduleGraph -) => { - if (usedByExports === false) return false; - if (usedByExports !== true && usedByExports !== undefined) { - const selfModule = moduleGraph.getParentModule(dependency); - const exportsInfo = moduleGraph.getExportsInfo(selfModule); - return (connections, runtime) => { - for (const exportName of usedByExports) { - if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) - return true; - } - return false; - }; - } - return null; -}; + const handleTemplateStringCompare = (left, right, res, eql) => { + const getPrefix = parts => { + let value = ""; + for (const p of parts) { + const v = p.asString(); + if (v !== undefined) value += v; + else break; + } + return value; + }; + const getSuffix = parts => { + let value = ""; + for (let i = parts.length - 1; i >= 0; i--) { + const v = parts[i].asString(); + if (v !== undefined) value = v + value; + else break; + } + return value; + }; + const leftPrefix = getPrefix(left.parts); + const rightPrefix = getPrefix(right.parts); + const leftSuffix = getSuffix(left.parts); + const rightSuffix = getSuffix(right.parts); + const lenPrefix = Math.min(leftPrefix.length, rightPrefix.length); + const lenSuffix = Math.min(leftSuffix.length, rightSuffix.length); + if ( + leftPrefix.slice(0, lenPrefix) !== + rightPrefix.slice(0, lenPrefix) || + leftSuffix.slice(-lenSuffix) !== rightSuffix.slice(-lenSuffix) + ) { + return res + .setBoolean(!eql) + .setSideEffects( + left.couldHaveSideEffects() || right.couldHaveSideEffects() + ); + } + }; -class TopLevelSymbol { - /** - * @param {string} name name of the variable - */ - constructor(name) { - this.name = name; - } -} + const handleStrictEqualityComparison = eql => { + const left = this.evaluateExpression(expr.left); + if (!left) return; + const right = this.evaluateExpression(expr.right); + if (!right) return; + const res = new BasicEvaluatedExpression(); + res.setRange(expr.range); -exports.TopLevelSymbol = TopLevelSymbol; -exports.topLevelSymbolTag = topLevelSymbolTag; + const leftConst = left.isCompileTimeValue(); + const rightConst = right.isCompileTimeValue(); + if (leftConst && rightConst) { + return res + .setBoolean( + eql === + (left.asCompileTimeValue() === right.asCompileTimeValue()) + ) + .setSideEffects( + left.couldHaveSideEffects() || right.couldHaveSideEffects() + ); + } -/***/ }), + if (left.isArray() && right.isArray()) { + return res + .setBoolean(!eql) + .setSideEffects( + left.couldHaveSideEffects() || right.couldHaveSideEffects() + ); + } + if (left.isTemplateString() && right.isTemplateString()) { + return handleTemplateStringCompare(left, right, res, eql); + } -/***/ 28758: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + const leftPrimitive = left.isPrimitiveType(); + const rightPrimitive = right.isPrimitiveType(); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if ( + // Primitive !== Object or + // compile-time object types are never equal to something at runtime + (leftPrimitive === false && + (leftConst || rightPrimitive === true)) || + (rightPrimitive === false && + (rightConst || leftPrimitive === true)) || + // Different nullish or boolish status also means not equal + isAlwaysDifferent(left.asBool(), right.asBool()) || + isAlwaysDifferent(left.asNullish(), right.asNullish()) + ) { + return res + .setBoolean(!eql) + .setSideEffects( + left.couldHaveSideEffects() || right.couldHaveSideEffects() + ); + } + }; + const handleAbstractEqualityComparison = eql => { + const left = this.evaluateExpression(expr.left); + if (!left) return; + const right = this.evaluateExpression(expr.right); + if (!right) return; + const res = new BasicEvaluatedExpression(); + res.setRange(expr.range); + const leftConst = left.isCompileTimeValue(); + const rightConst = right.isCompileTimeValue(); -const PureExpressionDependency = __webpack_require__(55799); -const InnerGraph = __webpack_require__(38988); + if (leftConst && rightConst) { + return res + .setBoolean( + eql === + // eslint-disable-next-line eqeqeq + (left.asCompileTimeValue() == right.asCompileTimeValue()) + ) + .setSideEffects( + left.couldHaveSideEffects() || right.couldHaveSideEffects() + ); + } -/** @typedef {import("estree").ClassDeclaration} ClassDeclarationNode */ -/** @typedef {import("estree").ClassExpression} ClassExpressionNode */ -/** @typedef {import("estree").Node} Node */ -/** @typedef {import("estree").VariableDeclarator} VariableDeclaratorNode */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../dependencies/HarmonyImportSpecifierDependency")} HarmonyImportSpecifierDependency */ -/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ -/** @typedef {import("./InnerGraph").InnerGraph} InnerGraph */ -/** @typedef {import("./InnerGraph").TopLevelSymbol} TopLevelSymbol */ + if (left.isArray() && right.isArray()) { + return res + .setBoolean(!eql) + .setSideEffects( + left.couldHaveSideEffects() || right.couldHaveSideEffects() + ); + } + if (left.isTemplateString() && right.isTemplateString()) { + return handleTemplateStringCompare(left, right, res, eql); + } + }; -const { topLevelSymbolTag } = InnerGraph; + if (expr.operator === "+") { + const left = this.evaluateExpression(expr.left); + if (!left) return; + const right = this.evaluateExpression(expr.right); + if (!right) return; + const res = new BasicEvaluatedExpression(); + if (left.isString()) { + if (right.isString()) { + res.setString(left.string + right.string); + } else if (right.isNumber()) { + res.setString(left.string + right.number); + } else if ( + right.isWrapped() && + right.prefix && + right.prefix.isString() + ) { + // "left" + ("prefix" + inner + "postfix") + // => ("leftPrefix" + inner + "postfix") + res.setWrapped( + new BasicEvaluatedExpression() + .setString(left.string + right.prefix.string) + .setRange(joinRanges(left.range, right.prefix.range)), + right.postfix, + right.wrappedInnerExpressions + ); + } else if (right.isWrapped()) { + // "left" + ([null] + inner + "postfix") + // => ("left" + inner + "postfix") + res.setWrapped( + left, + right.postfix, + right.wrappedInnerExpressions + ); + } else { + // "left" + expr + // => ("left" + expr + "") + res.setWrapped(left, null, [right]); + } + } else if (left.isNumber()) { + if (right.isString()) { + res.setString(left.number + right.string); + } else if (right.isNumber()) { + res.setNumber(left.number + right.number); + } else { + return; + } + } else if (left.isBigInt()) { + if (right.isBigInt()) { + res.setBigInt(left.bigint + right.bigint); + } + } else if (left.isWrapped()) { + if (left.postfix && left.postfix.isString() && right.isString()) { + // ("prefix" + inner + "postfix") + "right" + // => ("prefix" + inner + "postfixRight") + res.setWrapped( + left.prefix, + new BasicEvaluatedExpression() + .setString(left.postfix.string + right.string) + .setRange(joinRanges(left.postfix.range, right.range)), + left.wrappedInnerExpressions + ); + } else if ( + left.postfix && + left.postfix.isString() && + right.isNumber() + ) { + // ("prefix" + inner + "postfix") + 123 + // => ("prefix" + inner + "postfix123") + res.setWrapped( + left.prefix, + new BasicEvaluatedExpression() + .setString(left.postfix.string + right.number) + .setRange(joinRanges(left.postfix.range, right.range)), + left.wrappedInnerExpressions + ); + } else if (right.isString()) { + // ("prefix" + inner + [null]) + "right" + // => ("prefix" + inner + "right") + res.setWrapped(left.prefix, right, left.wrappedInnerExpressions); + } else if (right.isNumber()) { + // ("prefix" + inner + [null]) + 123 + // => ("prefix" + inner + "123") + res.setWrapped( + left.prefix, + new BasicEvaluatedExpression() + .setString(right.number + "") + .setRange(right.range), + left.wrappedInnerExpressions + ); + } else if (right.isWrapped()) { + // ("prefix1" + inner1 + "postfix1") + ("prefix2" + inner2 + "postfix2") + // ("prefix1" + inner1 + "postfix1" + "prefix2" + inner2 + "postfix2") + res.setWrapped( + left.prefix, + right.postfix, + left.wrappedInnerExpressions && + right.wrappedInnerExpressions && + left.wrappedInnerExpressions + .concat(left.postfix ? [left.postfix] : []) + .concat(right.prefix ? [right.prefix] : []) + .concat(right.wrappedInnerExpressions) + ); + } else { + // ("prefix" + inner + postfix) + expr + // => ("prefix" + inner + postfix + expr + [null]) + res.setWrapped( + left.prefix, + null, + left.wrappedInnerExpressions && + left.wrappedInnerExpressions.concat( + left.postfix ? [left.postfix, right] : [right] + ) + ); + } + } else { + if (right.isString()) { + // left + "right" + // => ([null] + left + "right") + res.setWrapped(null, right, [left]); + } else if (right.isWrapped()) { + // left + (prefix + inner + "postfix") + // => ([null] + left + prefix + inner + "postfix") + res.setWrapped( + null, + right.postfix, + right.wrappedInnerExpressions && + (right.prefix ? [left, right.prefix] : [left]).concat( + right.wrappedInnerExpressions + ) + ); + } else { + return; + } + } + if (left.couldHaveSideEffects() || right.couldHaveSideEffects()) + res.setSideEffects(); + res.setRange(expr.range); + return res; + } else if (expr.operator === "-") { + return handleConstOperation((l, r) => l - r); + } else if (expr.operator === "*") { + return handleConstOperation((l, r) => l * r); + } else if (expr.operator === "/") { + return handleConstOperation((l, r) => l / r); + } else if (expr.operator === "**") { + return handleConstOperation((l, r) => l ** r); + } else if (expr.operator === "===") { + return handleStrictEqualityComparison(true); + } else if (expr.operator === "==") { + return handleAbstractEqualityComparison(true); + } else if (expr.operator === "!==") { + return handleStrictEqualityComparison(false); + } else if (expr.operator === "!=") { + return handleAbstractEqualityComparison(false); + } else if (expr.operator === "&") { + return handleConstOperation((l, r) => l & r); + } else if (expr.operator === "|") { + return handleConstOperation((l, r) => l | r); + } else if (expr.operator === "^") { + return handleConstOperation((l, r) => l ^ r); + } else if (expr.operator === ">>>") { + return handleConstOperation((l, r) => l >>> r); + } else if (expr.operator === ">>") { + return handleConstOperation((l, r) => l >> r); + } else if (expr.operator === "<<") { + return handleConstOperation((l, r) => l << r); + } else if (expr.operator === "<") { + return handleConstOperation((l, r) => l < r); + } else if (expr.operator === ">") { + return handleConstOperation((l, r) => l > r); + } else if (expr.operator === "<=") { + return handleConstOperation((l, r) => l <= r); + } else if (expr.operator === ">=") { + return handleConstOperation((l, r) => l >= r); + } + }); + this.hooks.evaluate + .for("UnaryExpression") + .tap("JavascriptParser", _expr => { + const expr = /** @type {UnaryExpressionNode} */ (_expr); -class InnerGraphPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "InnerGraphPlugin", - (compilation, { normalModuleFactory }) => { - const logger = compilation.getLogger("webpack.InnerGraphPlugin"); + const handleConstOperation = fn => { + const argument = this.evaluateExpression(expr.argument); + if (!argument || !argument.isCompileTimeValue()) return; + const result = fn(argument.asCompileTimeValue()); + return valueAsExpression( + result, + expr, + argument.couldHaveSideEffects() + ); + }; - compilation.dependencyTemplates.set( - PureExpressionDependency, - new PureExpressionDependency.Template() - ); + if (expr.operator === "typeof") { + switch (expr.argument.type) { + case "Identifier": { + const res = this.callHooksForName( + this.hooks.evaluateTypeof, + expr.argument.name, + expr + ); + if (res !== undefined) return res; + break; + } + case "MetaProperty": { + const res = this.callHooksForName( + this.hooks.evaluateTypeof, + getRootName(expr.argument), + expr + ); + if (res !== undefined) return res; + break; + } + case "MemberExpression": { + const res = this.callHooksForExpression( + this.hooks.evaluateTypeof, + expr.argument, + expr + ); + if (res !== undefined) return res; + break; + } + case "ChainExpression": { + const res = this.callHooksForExpression( + this.hooks.evaluateTypeof, + expr.argument.expression, + expr + ); + if (res !== undefined) return res; + break; + } + case "FunctionExpression": { + return new BasicEvaluatedExpression() + .setString("function") + .setRange(expr.range); + } + } + const arg = this.evaluateExpression(expr.argument); + if (arg.isUnknown()) return; + if (arg.isString()) { + return new BasicEvaluatedExpression() + .setString("string") + .setRange(expr.range); + } + if (arg.isWrapped()) { + return new BasicEvaluatedExpression() + .setString("string") + .setSideEffects() + .setRange(expr.range); + } + if (arg.isUndefined()) { + return new BasicEvaluatedExpression() + .setString("undefined") + .setRange(expr.range); + } + if (arg.isNumber()) { + return new BasicEvaluatedExpression() + .setString("number") + .setRange(expr.range); + } + if (arg.isBigInt()) { + return new BasicEvaluatedExpression() + .setString("bigint") + .setRange(expr.range); + } + if (arg.isBoolean()) { + return new BasicEvaluatedExpression() + .setString("boolean") + .setRange(expr.range); + } + if (arg.isConstArray() || arg.isRegExp() || arg.isNull()) { + return new BasicEvaluatedExpression() + .setString("object") + .setRange(expr.range); + } + if (arg.isArray()) { + return new BasicEvaluatedExpression() + .setString("object") + .setSideEffects(arg.couldHaveSideEffects()) + .setRange(expr.range); + } + } else if (expr.operator === "!") { + const argument = this.evaluateExpression(expr.argument); + if (!argument) return; + const bool = argument.asBool(); + if (typeof bool !== "boolean") return; + return new BasicEvaluatedExpression() + .setBoolean(!bool) + .setSideEffects(argument.couldHaveSideEffects()) + .setRange(expr.range); + } else if (expr.operator === "~") { + return handleConstOperation(v => ~v); + } else if (expr.operator === "+") { + return handleConstOperation(v => +v); + } else if (expr.operator === "-") { + return handleConstOperation(v => -v); + } + }); + this.hooks.evaluateTypeof.for("undefined").tap("JavascriptParser", expr => { + return new BasicEvaluatedExpression() + .setString("undefined") + .setRange(expr.range); + }); + this.hooks.evaluate.for("Identifier").tap("JavascriptParser", expr => { + if (/** @type {IdentifierNode} */ (expr).name === "undefined") { + return new BasicEvaluatedExpression() + .setUndefined() + .setRange(expr.range); + } + }); + /** + * @param {string} exprType expression type name + * @param {function(ExpressionNode): GetInfoResult | undefined} getInfo get info + * @returns {void} + */ + const tapEvaluateWithVariableInfo = (exprType, getInfo) => { + /** @type {ExpressionNode | undefined} */ + let cachedExpression = undefined; + /** @type {GetInfoResult | undefined} */ + let cachedInfo = undefined; + this.hooks.evaluate.for(exprType).tap("JavascriptParser", expr => { + const expression = /** @type {MemberExpressionNode} */ (expr); - /** - * @param {JavascriptParser} parser the parser - * @param {Object} parserOptions options - * @returns {void} - */ - const handler = (parser, parserOptions) => { - const onUsageSuper = sup => { - InnerGraph.onUsage(parser.state, usedByExports => { - switch (usedByExports) { - case undefined: - case true: - return; - default: { - const dep = new PureExpressionDependency(sup.range); - dep.loc = sup.loc; - dep.usedByExports = usedByExports; - parser.state.module.addDependency(dep); - break; - } + const info = getInfo(expr); + if (info !== undefined) { + return this.callHooksForInfoWithFallback( + this.hooks.evaluateIdentifier, + info.name, + name => { + cachedExpression = expression; + cachedInfo = info; + }, + name => { + const hook = this.hooks.evaluateDefinedIdentifier.get(name); + if (hook !== undefined) { + return hook.call(expression); } - }); - }; - - parser.hooks.program.tap("InnerGraphPlugin", () => { - InnerGraph.enable(parser.state); - }); - - parser.hooks.finish.tap("InnerGraphPlugin", () => { - if (!InnerGraph.isEnabled(parser.state)) return; + }, + expression + ); + } + }); + this.hooks.evaluate + .for(exprType) + .tap({ name: "JavascriptParser", stage: 100 }, expr => { + const info = cachedExpression === expr ? cachedInfo : getInfo(expr); + if (info !== undefined) { + return new BasicEvaluatedExpression() + .setIdentifier(info.name, info.rootInfo, info.getMembers) + .setRange(expr.range); + } + }); + this.hooks.finish.tap("JavascriptParser", () => { + // Cleanup for GC + cachedExpression = cachedInfo = undefined; + }); + }; + tapEvaluateWithVariableInfo("Identifier", expr => { + const info = this.getVariableInfo( + /** @type {IdentifierNode} */ (expr).name + ); + if ( + typeof info === "string" || + (info instanceof VariableInfo && typeof info.freeName === "string") + ) { + return { name: info, rootInfo: info, getMembers: () => [] }; + } + }); + tapEvaluateWithVariableInfo("ThisExpression", expr => { + const info = this.getVariableInfo("this"); + if ( + typeof info === "string" || + (info instanceof VariableInfo && typeof info.freeName === "string") + ) { + return { name: info, rootInfo: info, getMembers: () => [] }; + } + }); + this.hooks.evaluate.for("MetaProperty").tap("JavascriptParser", expr => { + const metaProperty = /** @type {MetaPropertyNode} */ (expr); - logger.time("infer dependency usage"); - InnerGraph.inferDependencyUsage(parser.state); - logger.timeAggregate("infer dependency usage"); - }); + return this.callHooksForName( + this.hooks.evaluateIdentifier, + getRootName(expr), + metaProperty + ); + }); + tapEvaluateWithVariableInfo("MemberExpression", expr => + this.getMemberExpressionInfo( + /** @type {MemberExpressionNode} */ (expr), + ALLOWED_MEMBER_TYPES_EXPRESSION + ) + ); - // During prewalking the following datastructures are filled with - // nodes that have a TopLevelSymbol assigned and - // variables are tagged with the assigned TopLevelSymbol + this.hooks.evaluate.for("CallExpression").tap("JavascriptParser", _expr => { + const expr = /** @type {CallExpressionNode} */ (_expr); + if ( + expr.callee.type !== "MemberExpression" || + expr.callee.property.type !== + (expr.callee.computed ? "Literal" : "Identifier") + ) { + return; + } - // We differ 3 types of nodes: - // 1. full statements (export default, function declaration) - // 2. classes (class declaration, class expression) - // 3. variable declarators (const x = ...) + // type Super also possible here + const param = this.evaluateExpression( + /** @type {ExpressionNode} */ (expr.callee.object) + ); + if (!param) return; + const property = + expr.callee.property.type === "Literal" + ? `${expr.callee.property.value}` + : expr.callee.property.name; + const hook = this.hooks.evaluateCallExpressionMember.get(property); + if (hook !== undefined) { + return hook.call(expr, param); + } + }); + this.hooks.evaluateCallExpressionMember + .for("indexOf") + .tap("JavascriptParser", (expr, param) => { + if (!param.isString()) return; + if (expr.arguments.length === 0) return; + const [arg1, arg2] = expr.arguments; + if (arg1.type === "SpreadElement") return; + const arg1Eval = this.evaluateExpression(arg1); + if (!arg1Eval.isString()) return; + const arg1Value = arg1Eval.string; - /** @type {WeakMap} */ - const statementWithTopLevelSymbol = new WeakMap(); - /** @type {WeakMap} */ - const statementPurePart = new WeakMap(); + let result; + if (arg2) { + if (arg2.type === "SpreadElement") return; + const arg2Eval = this.evaluateExpression(arg2); + if (!arg2Eval.isNumber()) return; + result = param.string.indexOf(arg1Value, arg2Eval.number); + } else { + result = param.string.indexOf(arg1Value); + } + return new BasicEvaluatedExpression() + .setNumber(result) + .setSideEffects(param.couldHaveSideEffects()) + .setRange(expr.range); + }); + this.hooks.evaluateCallExpressionMember + .for("replace") + .tap("JavascriptParser", (expr, param) => { + if (!param.isString()) return; + if (expr.arguments.length !== 2) return; + if (expr.arguments[0].type === "SpreadElement") return; + if (expr.arguments[1].type === "SpreadElement") return; + let arg1 = this.evaluateExpression(expr.arguments[0]); + let arg2 = this.evaluateExpression(expr.arguments[1]); + if (!arg1.isString() && !arg1.isRegExp()) return; + const arg1Value = arg1.regExp || arg1.string; + if (!arg2.isString()) return; + const arg2Value = arg2.string; + return new BasicEvaluatedExpression() + .setString(param.string.replace(arg1Value, arg2Value)) + .setSideEffects(param.couldHaveSideEffects()) + .setRange(expr.range); + }); + ["substr", "substring", "slice"].forEach(fn => { + this.hooks.evaluateCallExpressionMember + .for(fn) + .tap("JavascriptParser", (expr, param) => { + if (!param.isString()) return; + let arg1; + let result, + str = param.string; + switch (expr.arguments.length) { + case 1: + if (expr.arguments[0].type === "SpreadElement") return; + arg1 = this.evaluateExpression(expr.arguments[0]); + if (!arg1.isNumber()) return; + result = str[fn](arg1.number); + break; + case 2: { + if (expr.arguments[0].type === "SpreadElement") return; + if (expr.arguments[1].type === "SpreadElement") return; + arg1 = this.evaluateExpression(expr.arguments[0]); + const arg2 = this.evaluateExpression(expr.arguments[1]); + if (!arg1.isNumber()) return; + if (!arg2.isNumber()) return; + result = str[fn](arg1.number, arg2.number); + break; + } + default: + return; + } + return new BasicEvaluatedExpression() + .setString(result) + .setSideEffects(param.couldHaveSideEffects()) + .setRange(expr.range); + }); + }); - /** @type {WeakMap} */ - const classWithTopLevelSymbol = new WeakMap(); + /** + * @param {"cooked" | "raw"} kind kind of values to get + * @param {TemplateLiteralNode} templateLiteralExpr TemplateLiteral expr + * @returns {{quasis: BasicEvaluatedExpression[], parts: BasicEvaluatedExpression[]}} Simplified template + */ + const getSimplifiedTemplateResult = (kind, templateLiteralExpr) => { + /** @type {BasicEvaluatedExpression[]} */ + const quasis = []; + /** @type {BasicEvaluatedExpression[]} */ + const parts = []; - /** @type {WeakMap} */ - const declWithTopLevelSymbol = new WeakMap(); - /** @type {WeakSet} */ - const pureDeclarators = new WeakSet(); + for (let i = 0; i < templateLiteralExpr.quasis.length; i++) { + const quasiExpr = templateLiteralExpr.quasis[i]; + const quasi = quasiExpr.value[kind]; - // The following hooks are used during prewalking: + if (i > 0) { + const prevExpr = parts[parts.length - 1]; + const expr = this.evaluateExpression( + templateLiteralExpr.expressions[i - 1] + ); + const exprAsString = expr.asString(); + if ( + typeof exprAsString === "string" && + !expr.couldHaveSideEffects() + ) { + // We can merge quasi + expr + quasi when expr + // is a const string - parser.hooks.preStatement.tap("InnerGraphPlugin", statement => { - if (!InnerGraph.isEnabled(parser.state)) return; + prevExpr.setString(prevExpr.string + exprAsString + quasi); + prevExpr.setRange([prevExpr.range[0], quasiExpr.range[1]]); + // We unset the expression as it doesn't match to a single expression + prevExpr.setExpression(undefined); + continue; + } + parts.push(expr); + } - if (parser.scope.topLevelScope === true) { - if (statement.type === "FunctionDeclaration") { - const name = statement.id ? statement.id.name : "*default*"; - const fn = InnerGraph.tagTopLevelSymbol(parser, name); - statementWithTopLevelSymbol.set(statement, fn); - return true; - } - } - }); + const part = new BasicEvaluatedExpression() + .setString(quasi) + .setRange(quasiExpr.range) + .setExpression(quasiExpr); + quasis.push(part); + parts.push(part); + } + return { + quasis, + parts + }; + }; - parser.hooks.blockPreStatement.tap("InnerGraphPlugin", statement => { - if (!InnerGraph.isEnabled(parser.state)) return; + this.hooks.evaluate + .for("TemplateLiteral") + .tap("JavascriptParser", _node => { + const node = /** @type {TemplateLiteralNode} */ (_node); - if (parser.scope.topLevelScope === true) { - if (statement.type === "ClassDeclaration") { - const name = statement.id ? statement.id.name : "*default*"; - const fn = InnerGraph.tagTopLevelSymbol(parser, name); - classWithTopLevelSymbol.set(statement, fn); - return true; - } - if (statement.type === "ExportDefaultDeclaration") { - const name = "*default*"; - const fn = InnerGraph.tagTopLevelSymbol(parser, name); - const decl = statement.declaration; - if ( - decl.type === "ClassExpression" || - decl.type === "ClassDeclaration" - ) { - classWithTopLevelSymbol.set(decl, fn); - } else if (parser.isPure(decl, statement.range[0])) { - statementWithTopLevelSymbol.set(statement, fn); - if ( - !decl.type.endsWith("FunctionExpression") && - !decl.type.endsWith("Declaration") && - decl.type !== "Literal" - ) { - statementPurePart.set(statement, decl); - } - } - } - } - }); + const { quasis, parts } = getSimplifiedTemplateResult("cooked", node); + if (parts.length === 1) { + return parts[0].setRange(node.range); + } + return new BasicEvaluatedExpression() + .setTemplateString(quasis, parts, "cooked") + .setRange(node.range); + }); + this.hooks.evaluate + .for("TaggedTemplateExpression") + .tap("JavascriptParser", _node => { + const node = /** @type {TaggedTemplateExpressionNode} */ (_node); + const tag = this.evaluateExpression(node.tag); - parser.hooks.preDeclarator.tap( - "InnerGraphPlugin", - (decl, statement) => { - if (!InnerGraph.isEnabled(parser.state)) return; - if ( - parser.scope.topLevelScope === true && - decl.init && - decl.id.type === "Identifier" - ) { - const name = decl.id.name; - if (decl.init.type === "ClassExpression") { - const fn = InnerGraph.tagTopLevelSymbol(parser, name); - classWithTopLevelSymbol.set(decl.init, fn); - } else if (parser.isPure(decl.init, decl.id.range[1])) { - const fn = InnerGraph.tagTopLevelSymbol(parser, name); - declWithTopLevelSymbol.set(decl, fn); - if ( - !decl.init.type.endsWith("FunctionExpression") && - decl.init.type !== "Literal" - ) { - pureDeclarators.add(decl); - } - return true; - } - } - } + if (tag.isIdentifier() && tag.identifier === "String.raw") { + const { quasis, parts } = getSimplifiedTemplateResult( + "raw", + node.quasi ); + return new BasicEvaluatedExpression() + .setTemplateString(quasis, parts, "raw") + .setRange(node.range); + } + }); - // During real walking we set the TopLevelSymbol state to the assigned - // TopLevelSymbol by using the fill datastructures. - - // In addition to tracking TopLevelSymbols, we sometimes need to - // add a PureExpressionDependency. This is needed to skip execution - // of pure expressions, even when they are not dropped due to - // minimizing. Otherwise symbols used there might not exist anymore - // as they are removed as unused by this optimization - - // When we find a reference to a TopLevelSymbol, we register a - // TopLevelSymbol dependency from TopLevelSymbol in state to the - // referenced TopLevelSymbol. This way we get a graph of all - // TopLevelSymbols. + this.hooks.evaluateCallExpressionMember + .for("concat") + .tap("JavascriptParser", (expr, param) => { + if (!param.isString() && !param.isWrapped()) return; - // The following hooks are called during walking: + let stringSuffix = null; + let hasUnknownParams = false; + const innerExpressions = []; + for (let i = expr.arguments.length - 1; i >= 0; i--) { + const arg = expr.arguments[i]; + if (arg.type === "SpreadElement") return; + const argExpr = this.evaluateExpression(arg); + if ( + hasUnknownParams || + (!argExpr.isString() && !argExpr.isNumber()) + ) { + hasUnknownParams = true; + innerExpressions.push(argExpr); + continue; + } - parser.hooks.statement.tap("InnerGraphPlugin", statement => { - if (!InnerGraph.isEnabled(parser.state)) return; - if (parser.scope.topLevelScope === true) { - InnerGraph.setTopLevelSymbol(parser.state, undefined); + const value = argExpr.isString() + ? argExpr.string + : "" + argExpr.number; - const fn = statementWithTopLevelSymbol.get(statement); - if (fn) { - InnerGraph.setTopLevelSymbol(parser.state, fn); - const purePart = statementPurePart.get(statement); - if (purePart) { - InnerGraph.onUsage(parser.state, usedByExports => { - switch (usedByExports) { - case undefined: - case true: - return; - default: { - const dep = new PureExpressionDependency( - purePart.range - ); - dep.loc = statement.loc; - dep.usedByExports = usedByExports; - parser.state.module.addDependency(dep); - break; - } - } - }); - } - } - } - }); + const newString = value + (stringSuffix ? stringSuffix.string : ""); + const newRange = [ + argExpr.range[0], + (stringSuffix || argExpr).range[1] + ]; + stringSuffix = new BasicEvaluatedExpression() + .setString(newString) + .setSideEffects( + (stringSuffix && stringSuffix.couldHaveSideEffects()) || + argExpr.couldHaveSideEffects() + ) + .setRange(newRange); + } - parser.hooks.classExtendsExpression.tap( - "InnerGraphPlugin", - (expr, statement) => { - if (!InnerGraph.isEnabled(parser.state)) return; - if (parser.scope.topLevelScope === true) { - const fn = classWithTopLevelSymbol.get(statement); - if ( - fn && - parser.isPure( - expr, - statement.id ? statement.id.range[1] : statement.range[0] - ) - ) { - InnerGraph.setTopLevelSymbol(parser.state, fn); - onUsageSuper(expr); - } - } - } - ); + if (hasUnknownParams) { + const prefix = param.isString() ? param : param.prefix; + const inner = + param.isWrapped() && param.wrappedInnerExpressions + ? param.wrappedInnerExpressions.concat(innerExpressions.reverse()) + : innerExpressions.reverse(); + return new BasicEvaluatedExpression() + .setWrapped(prefix, stringSuffix, inner) + .setRange(expr.range); + } else if (param.isWrapped()) { + const postfix = stringSuffix || param.postfix; + const inner = param.wrappedInnerExpressions + ? param.wrappedInnerExpressions.concat(innerExpressions.reverse()) + : innerExpressions.reverse(); + return new BasicEvaluatedExpression() + .setWrapped(param.prefix, postfix, inner) + .setRange(expr.range); + } else { + const newString = + param.string + (stringSuffix ? stringSuffix.string : ""); + return new BasicEvaluatedExpression() + .setString(newString) + .setSideEffects( + (stringSuffix && stringSuffix.couldHaveSideEffects()) || + param.couldHaveSideEffects() + ) + .setRange(expr.range); + } + }); + this.hooks.evaluateCallExpressionMember + .for("split") + .tap("JavascriptParser", (expr, param) => { + if (!param.isString()) return; + if (expr.arguments.length !== 1) return; + if (expr.arguments[0].type === "SpreadElement") return; + let result; + const arg = this.evaluateExpression(expr.arguments[0]); + if (arg.isString()) { + result = param.string.split(arg.string); + } else if (arg.isRegExp()) { + result = param.string.split(arg.regExp); + } else { + return; + } + return new BasicEvaluatedExpression() + .setArray(result) + .setSideEffects(param.couldHaveSideEffects()) + .setRange(expr.range); + }); + this.hooks.evaluate + .for("ConditionalExpression") + .tap("JavascriptParser", _expr => { + const expr = /** @type {ConditionalExpressionNode} */ (_expr); - parser.hooks.classBodyElement.tap( - "InnerGraphPlugin", - (element, classDefinition) => { - if (!InnerGraph.isEnabled(parser.state)) return; - if (parser.scope.topLevelScope === true) { - const fn = classWithTopLevelSymbol.get(classDefinition); - if (fn) { - InnerGraph.setTopLevelSymbol(parser.state, undefined); - } - } - } + const condition = this.evaluateExpression(expr.test); + const conditionValue = condition.asBool(); + let res; + if (conditionValue === undefined) { + const consequent = this.evaluateExpression(expr.consequent); + const alternate = this.evaluateExpression(expr.alternate); + if (!consequent || !alternate) return; + res = new BasicEvaluatedExpression(); + if (consequent.isConditional()) { + res.setOptions(consequent.options); + } else { + res.setOptions([consequent]); + } + if (alternate.isConditional()) { + res.addOptions(alternate.options); + } else { + res.addOptions([alternate]); + } + } else { + res = this.evaluateExpression( + conditionValue ? expr.consequent : expr.alternate ); + if (condition.couldHaveSideEffects()) res.setSideEffects(); + } + res.setRange(expr.range); + return res; + }); + this.hooks.evaluate + .for("ArrayExpression") + .tap("JavascriptParser", _expr => { + const expr = /** @type {ArrayExpressionNode} */ (_expr); - parser.hooks.classBodyValue.tap( - "InnerGraphPlugin", - (expression, element, classDefinition) => { - if (!InnerGraph.isEnabled(parser.state)) return; - if (parser.scope.topLevelScope === true) { - const fn = classWithTopLevelSymbol.get(classDefinition); - if (fn) { - if ( - !element.static || - parser.isPure( - expression, - element.key ? element.key.range[1] : element.range[0] - ) - ) { - InnerGraph.setTopLevelSymbol(parser.state, fn); - if (element.type !== "MethodDefinition" && element.static) { - InnerGraph.onUsage(parser.state, usedByExports => { - switch (usedByExports) { - case undefined: - case true: - return; - default: { - const dep = new PureExpressionDependency( - expression.range - ); - dep.loc = expression.loc; - dep.usedByExports = usedByExports; - parser.state.module.addDependency(dep); - break; - } - } - }); - } - } else { - InnerGraph.setTopLevelSymbol(parser.state, undefined); - } - } - } - } + const items = expr.elements.map(element => { + return ( + element !== null && + element.type !== "SpreadElement" && + this.evaluateExpression(element) ); + }); + if (!items.every(Boolean)) return; + return new BasicEvaluatedExpression() + .setItems(items) + .setRange(expr.range); + }); + this.hooks.evaluate + .for("ChainExpression") + .tap("JavascriptParser", _expr => { + const expr = /** @type {ChainExpressionNode} */ (_expr); + /** @type {ExpressionNode[]} */ + const optionalExpressionsStack = []; + /** @type {ExpressionNode|SuperNode} */ + let next = expr.expression; - parser.hooks.declarator.tap("InnerGraphPlugin", (decl, statement) => { - if (!InnerGraph.isEnabled(parser.state)) return; - const fn = declWithTopLevelSymbol.get(decl); - - if (fn) { - InnerGraph.setTopLevelSymbol(parser.state, fn); - if (pureDeclarators.has(decl)) { - if (decl.init.type === "ClassExpression") { - if (decl.init.superClass) { - onUsageSuper(decl.init.superClass); - } - } else { - InnerGraph.onUsage(parser.state, usedByExports => { - switch (usedByExports) { - case undefined: - case true: - return; - default: { - const dep = new PureExpressionDependency( - decl.init.range - ); - dep.loc = decl.loc; - dep.usedByExports = usedByExports; - parser.state.module.addDependency(dep); - break; - } - } - }); - } - } - parser.walkExpression(decl.init); - InnerGraph.setTopLevelSymbol(parser.state, undefined); - return true; - } - }); - - parser.hooks.expression - .for(topLevelSymbolTag) - .tap("InnerGraphPlugin", () => { - const topLevelSymbol = /** @type {TopLevelSymbol} */ ( - parser.currentTagData - ); - const currentTopLevelSymbol = InnerGraph.getTopLevelSymbol( - parser.state + while ( + next.type === "MemberExpression" || + next.type === "CallExpression" + ) { + if (next.type === "MemberExpression") { + if (next.optional) { + // SuperNode can not be optional + optionalExpressionsStack.push( + /** @type {ExpressionNode} */ (next.object) ); - InnerGraph.addUsage( - parser.state, - topLevelSymbol, - currentTopLevelSymbol || true + } + next = next.object; + } else { + if (next.optional) { + // SuperNode can not be optional + optionalExpressionsStack.push( + /** @type {ExpressionNode} */ (next.callee) ); - }); - parser.hooks.assign - .for(topLevelSymbolTag) - .tap("InnerGraphPlugin", expr => { - if (!InnerGraph.isEnabled(parser.state)) return; - if (expr.operator === "=") return true; - }); - }; - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("InnerGraphPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("InnerGraphPlugin", handler); + } + next = next.callee; + } + } - compilation.hooks.finishModules.tap("InnerGraphPlugin", () => { - logger.timeAggregateEnd("infer dependency usage"); - }); - } - ); + while (optionalExpressionsStack.length > 0) { + const expression = optionalExpressionsStack.pop(); + const evaluated = this.evaluateExpression(expression); + + if (evaluated && evaluated.asNullish()) { + return evaluated.setRange(_expr.range); + } + } + return this.evaluateExpression(expr.expression); + }); } -} -module.exports = InnerGraphPlugin; + getRenameIdentifier(expr) { + const result = this.evaluateExpression(expr); + if (result && result.isIdentifier()) { + return result.identifier; + } + } + /** + * @param {ClassExpressionNode | ClassDeclarationNode} classy a class node + * @returns {void} + */ + walkClass(classy) { + if (classy.superClass) { + if (!this.hooks.classExtendsExpression.call(classy.superClass, classy)) { + this.walkExpression(classy.superClass); + } + } + if (classy.body && classy.body.type === "ClassBody") { + for (const classElement of /** @type {TODO} */ (classy.body.body)) { + if (!this.hooks.classBodyElement.call(classElement, classy)) { + if (classElement.computed && classElement.key) { + this.walkExpression(classElement.key); + } + if (classElement.value) { + if ( + !this.hooks.classBodyValue.call( + classElement.value, + classElement, + classy + ) + ) { + const wasTopLevel = this.scope.topLevelScope; + this.scope.topLevelScope = false; + this.walkExpression(classElement.value); + this.scope.topLevelScope = wasTopLevel; + } + } + } + } + } + } -/***/ }), + // Pre walking iterates the scope for variable declarations + preWalkStatements(statements) { + for (let index = 0, len = statements.length; index < len; index++) { + const statement = statements[index]; + this.preWalkStatement(statement); + } + } -/***/ 83608: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Block pre walking iterates the scope for block variable declarations + blockPreWalkStatements(statements) { + for (let index = 0, len = statements.length; index < len; index++) { + const statement = statements[index]; + this.blockPreWalkStatement(statement); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // Walking iterates the statements and expressions and processes them + walkStatements(statements) { + for (let index = 0, len = statements.length; index < len; index++) { + const statement = statements[index]; + this.walkStatement(statement); + } + } + preWalkStatement(statement) { + this.statementPath.push(statement); + if (this.hooks.preStatement.call(statement)) { + this.prevStatement = this.statementPath.pop(); + return; + } + switch (statement.type) { + case "BlockStatement": + this.preWalkBlockStatement(statement); + break; + case "DoWhileStatement": + this.preWalkDoWhileStatement(statement); + break; + case "ForInStatement": + this.preWalkForInStatement(statement); + break; + case "ForOfStatement": + this.preWalkForOfStatement(statement); + break; + case "ForStatement": + this.preWalkForStatement(statement); + break; + case "FunctionDeclaration": + this.preWalkFunctionDeclaration(statement); + break; + case "IfStatement": + this.preWalkIfStatement(statement); + break; + case "LabeledStatement": + this.preWalkLabeledStatement(statement); + break; + case "SwitchStatement": + this.preWalkSwitchStatement(statement); + break; + case "TryStatement": + this.preWalkTryStatement(statement); + break; + case "VariableDeclaration": + this.preWalkVariableDeclaration(statement); + break; + case "WhileStatement": + this.preWalkWhileStatement(statement); + break; + case "WithStatement": + this.preWalkWithStatement(statement); + break; + } + this.prevStatement = this.statementPath.pop(); + } + blockPreWalkStatement(statement) { + this.statementPath.push(statement); + if (this.hooks.blockPreStatement.call(statement)) { + this.prevStatement = this.statementPath.pop(); + return; + } + switch (statement.type) { + case "ImportDeclaration": + this.blockPreWalkImportDeclaration(statement); + break; + case "ExportAllDeclaration": + this.blockPreWalkExportAllDeclaration(statement); + break; + case "ExportDefaultDeclaration": + this.blockPreWalkExportDefaultDeclaration(statement); + break; + case "ExportNamedDeclaration": + this.blockPreWalkExportNamedDeclaration(statement); + break; + case "VariableDeclaration": + this.blockPreWalkVariableDeclaration(statement); + break; + case "ClassDeclaration": + this.blockPreWalkClassDeclaration(statement); + break; + } + this.prevStatement = this.statementPath.pop(); + } -const { STAGE_ADVANCED } = __webpack_require__(80057); -const LazyBucketSortedSet = __webpack_require__(48424); -const { compareChunks } = __webpack_require__(29579); -const createSchemaValidation = __webpack_require__(32540); + walkStatement(statement) { + this.statementPath.push(statement); + if (this.hooks.statement.call(statement) !== undefined) { + this.prevStatement = this.statementPath.pop(); + return; + } + switch (statement.type) { + case "BlockStatement": + this.walkBlockStatement(statement); + break; + case "ClassDeclaration": + this.walkClassDeclaration(statement); + break; + case "DoWhileStatement": + this.walkDoWhileStatement(statement); + break; + case "ExportDefaultDeclaration": + this.walkExportDefaultDeclaration(statement); + break; + case "ExportNamedDeclaration": + this.walkExportNamedDeclaration(statement); + break; + case "ExpressionStatement": + this.walkExpressionStatement(statement); + break; + case "ForInStatement": + this.walkForInStatement(statement); + break; + case "ForOfStatement": + this.walkForOfStatement(statement); + break; + case "ForStatement": + this.walkForStatement(statement); + break; + case "FunctionDeclaration": + this.walkFunctionDeclaration(statement); + break; + case "IfStatement": + this.walkIfStatement(statement); + break; + case "LabeledStatement": + this.walkLabeledStatement(statement); + break; + case "ReturnStatement": + this.walkReturnStatement(statement); + break; + case "SwitchStatement": + this.walkSwitchStatement(statement); + break; + case "ThrowStatement": + this.walkThrowStatement(statement); + break; + case "TryStatement": + this.walkTryStatement(statement); + break; + case "VariableDeclaration": + this.walkVariableDeclaration(statement); + break; + case "WhileStatement": + this.walkWhileStatement(statement); + break; + case "WithStatement": + this.walkWithStatement(statement); + break; + } + this.prevStatement = this.statementPath.pop(); + } -/** @typedef {import("../../declarations/plugins/optimize/LimitChunkCountPlugin").LimitChunkCountPluginOptions} LimitChunkCountPluginOptions */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ + /** + * Walks a statements that is nested within a parent statement + * and can potentially be a non-block statement. + * This enforces the nested statement to never be in ASI position. + * @param {StatementNode} statement the nested statement + * @returns {void} + */ + walkNestedStatement(statement) { + this.prevStatement = undefined; + this.walkStatement(statement); + } -const validate = createSchemaValidation( - __webpack_require__(36557), - () => __webpack_require__(30837), - { - name: "Limit Chunk Count Plugin", - baseDataPath: "options" + // Real Statements + preWalkBlockStatement(statement) { + this.preWalkStatements(statement.body); } -); -/** - * @typedef {Object} ChunkCombination - * @property {boolean} deleted this is set to true when combination was removed - * @property {number} sizeDiff - * @property {number} integratedSize - * @property {Chunk} a - * @property {Chunk} b - * @property {number} aIdx - * @property {number} bIdx - * @property {number} aSize - * @property {number} bSize - */ + walkBlockStatement(statement) { + this.inBlockScope(() => { + const body = statement.body; + const prev = this.prevStatement; + this.blockPreWalkStatements(body); + this.prevStatement = prev; + this.walkStatements(body); + }); + } -const addToSetMap = (map, key, value) => { - const set = map.get(key); - if (set === undefined) { - map.set(key, new Set([value])); - } else { - set.add(value); + walkExpressionStatement(statement) { + this.walkExpression(statement.expression); } -}; -class LimitChunkCountPlugin { - /** - * @param {LimitChunkCountPluginOptions=} options options object - */ - constructor(options) { - validate(options); - this.options = options; + preWalkIfStatement(statement) { + this.preWalkStatement(statement.consequent); + if (statement.alternate) { + this.preWalkStatement(statement.alternate); + } } - /** - * @param {Compiler} compiler the webpack compiler - * @returns {void} - */ - apply(compiler) { - const options = this.options; - compiler.hooks.compilation.tap("LimitChunkCountPlugin", compilation => { - compilation.hooks.optimizeChunks.tap( - { - name: "LimitChunkCountPlugin", - stage: STAGE_ADVANCED - }, - chunks => { - const chunkGraph = compilation.chunkGraph; - const maxChunks = options.maxChunks; - if (!maxChunks) return; - if (maxChunks < 1) return; - if (compilation.chunks.size <= maxChunks) return; + walkIfStatement(statement) { + const result = this.hooks.statementIf.call(statement); + if (result === undefined) { + this.walkExpression(statement.test); + this.walkNestedStatement(statement.consequent); + if (statement.alternate) { + this.walkNestedStatement(statement.alternate); + } + } else { + if (result) { + this.walkNestedStatement(statement.consequent); + } else if (statement.alternate) { + this.walkNestedStatement(statement.alternate); + } + } + } - let remainingChunksToMerge = compilation.chunks.size - maxChunks; + preWalkLabeledStatement(statement) { + this.preWalkStatement(statement.body); + } - // order chunks in a deterministic way - const compareChunksWithGraph = compareChunks(chunkGraph); - const orderedChunks = Array.from(chunks).sort(compareChunksWithGraph); + walkLabeledStatement(statement) { + const hook = this.hooks.label.get(statement.label.name); + if (hook !== undefined) { + const result = hook.call(statement); + if (result === true) return; + } + this.walkNestedStatement(statement.body); + } - // create a lazy sorted data structure to keep all combinations - // this is large. Size = chunks * (chunks - 1) / 2 - // It uses a multi layer bucket sort plus normal sort in the last layer - // It's also lazy so only accessed buckets are sorted - const combinations = new LazyBucketSortedSet( - // Layer 1: ordered by largest size benefit - c => c.sizeDiff, - (a, b) => b - a, - // Layer 2: ordered by smallest combined size - c => c.integratedSize, - (a, b) => a - b, - // Layer 3: ordered by position difference in orderedChunk (-> to be deterministic) - c => c.bIdx - c.aIdx, - (a, b) => a - b, - // Layer 4: ordered by position in orderedChunk (-> to be deterministic) - (a, b) => a.bIdx - b.bIdx - ); + preWalkWithStatement(statement) { + this.preWalkStatement(statement.body); + } - // we keep a mapping from chunk to all combinations - // but this mapping is not kept up-to-date with deletions - // so `deleted` flag need to be considered when iterating this - /** @type {Map>} */ - const combinationsByChunk = new Map(); + walkWithStatement(statement) { + this.walkExpression(statement.object); + this.walkNestedStatement(statement.body); + } - orderedChunks.forEach((b, bIdx) => { - // create combination pairs with size and integrated size - for (let aIdx = 0; aIdx < bIdx; aIdx++) { - const a = orderedChunks[aIdx]; - // filter pairs that can not be integrated! - if (!chunkGraph.canChunksBeIntegrated(a, b)) continue; + preWalkSwitchStatement(statement) { + this.preWalkSwitchCases(statement.cases); + } - const integratedSize = chunkGraph.getIntegratedChunksSize( - a, - b, - options - ); + walkSwitchStatement(statement) { + this.walkExpression(statement.discriminant); + this.walkSwitchCases(statement.cases); + } - const aSize = chunkGraph.getChunkSize(a, options); - const bSize = chunkGraph.getChunkSize(b, options); - const c = { - deleted: false, - sizeDiff: aSize + bSize - integratedSize, - integratedSize, - a, - b, - aIdx, - bIdx, - aSize, - bSize - }; - combinations.add(c); - addToSetMap(combinationsByChunk, a, c); - addToSetMap(combinationsByChunk, b, c); - } - return combinations; - }); + walkTerminatingStatement(statement) { + if (statement.argument) this.walkExpression(statement.argument); + } - // list of modified chunks during this run - // combinations affected by this change are skipped to allow - // further optimizations - /** @type {Set} */ - const modifiedChunks = new Set(); + walkReturnStatement(statement) { + this.walkTerminatingStatement(statement); + } - let changed = false; - // eslint-disable-next-line no-constant-condition - loop: while (true) { - const combination = combinations.popFirst(); - if (combination === undefined) break; + walkThrowStatement(statement) { + this.walkTerminatingStatement(statement); + } - combination.deleted = true; - const { a, b, integratedSize } = combination; + preWalkTryStatement(statement) { + this.preWalkStatement(statement.block); + if (statement.handler) this.preWalkCatchClause(statement.handler); + if (statement.finializer) this.preWalkStatement(statement.finializer); + } - // skip over pair when - // one of the already merged chunks is a parent of one of the chunks - if (modifiedChunks.size > 0) { - const queue = new Set(a.groupsIterable); - for (const group of b.groupsIterable) { - queue.add(group); - } - for (const group of queue) { - for (const mChunk of modifiedChunks) { - if (mChunk !== a && mChunk !== b && mChunk.isInGroup(group)) { - // This is a potential pair which needs recalculation - // We can't do that now, but it merge before following pairs - // so we leave space for it, and consider chunks as modified - // just for the worse case - remainingChunksToMerge--; - if (remainingChunksToMerge <= 0) break loop; - modifiedChunks.add(a); - modifiedChunks.add(b); - continue loop; - } - } - for (const parent of group.parentsIterable) { - queue.add(parent); - } - } - } + walkTryStatement(statement) { + if (this.scope.inTry) { + this.walkStatement(statement.block); + } else { + this.scope.inTry = true; + this.walkStatement(statement.block); + this.scope.inTry = false; + } + if (statement.handler) this.walkCatchClause(statement.handler); + if (statement.finalizer) this.walkStatement(statement.finalizer); + } - // merge the chunks - if (chunkGraph.canChunksBeIntegrated(a, b)) { - chunkGraph.integrateChunks(a, b); - compilation.chunks.delete(b); + preWalkWhileStatement(statement) { + this.preWalkStatement(statement.body); + } - // flag chunk a as modified as further optimization are possible for all children here - modifiedChunks.add(a); + walkWhileStatement(statement) { + this.walkExpression(statement.test); + this.walkNestedStatement(statement.body); + } - changed = true; - remainingChunksToMerge--; - if (remainingChunksToMerge <= 0) break; + preWalkDoWhileStatement(statement) { + this.preWalkStatement(statement.body); + } - // Update all affected combinations - // delete all combination with the removed chunk - // we will use combinations with the kept chunk instead - for (const combination of combinationsByChunk.get(a)) { - if (combination.deleted) continue; - combination.deleted = true; - combinations.delete(combination); - } + walkDoWhileStatement(statement) { + this.walkNestedStatement(statement.body); + this.walkExpression(statement.test); + } - // Update combinations with the kept chunk with new sizes - for (const combination of combinationsByChunk.get(b)) { - if (combination.deleted) continue; - if (combination.a === b) { - if (!chunkGraph.canChunksBeIntegrated(a, combination.b)) { - combination.deleted = true; - combinations.delete(combination); - continue; - } - // Update size - const newIntegratedSize = chunkGraph.getIntegratedChunksSize( - a, - combination.b, - options - ); - const finishUpdate = combinations.startUpdate(combination); - combination.a = a; - combination.integratedSize = newIntegratedSize; - combination.aSize = integratedSize; - combination.sizeDiff = - combination.bSize + integratedSize - newIntegratedSize; - finishUpdate(); - } else if (combination.b === b) { - if (!chunkGraph.canChunksBeIntegrated(combination.a, a)) { - combination.deleted = true; - combinations.delete(combination); - continue; - } - // Update size - const newIntegratedSize = chunkGraph.getIntegratedChunksSize( - combination.a, - a, - options - ); + preWalkForStatement(statement) { + if (statement.init) { + if (statement.init.type === "VariableDeclaration") { + this.preWalkStatement(statement.init); + } + } + this.preWalkStatement(statement.body); + } - const finishUpdate = combinations.startUpdate(combination); - combination.b = a; - combination.integratedSize = newIntegratedSize; - combination.bSize = integratedSize; - combination.sizeDiff = - integratedSize + combination.aSize - newIntegratedSize; - finishUpdate(); - } - } - combinationsByChunk.set(a, combinationsByChunk.get(b)); - combinationsByChunk.delete(b); - } - } - if (changed) return true; + walkForStatement(statement) { + this.inBlockScope(() => { + if (statement.init) { + if (statement.init.type === "VariableDeclaration") { + this.blockPreWalkVariableDeclaration(statement.init); + this.prevStatement = undefined; + this.walkStatement(statement.init); + } else { + this.walkExpression(statement.init); } - ); + } + if (statement.test) { + this.walkExpression(statement.test); + } + if (statement.update) { + this.walkExpression(statement.update); + } + const body = statement.body; + if (body.type === "BlockStatement") { + // no need to add additional scope + const prev = this.prevStatement; + this.blockPreWalkStatements(body.body); + this.prevStatement = prev; + this.walkStatements(body.body); + } else { + this.walkNestedStatement(body); + } }); } -} -module.exports = LimitChunkCountPlugin; - - -/***/ }), -/***/ 27868: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + preWalkForInStatement(statement) { + if (statement.left.type === "VariableDeclaration") { + this.preWalkVariableDeclaration(statement.left); + } + this.preWalkStatement(statement.body); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + walkForInStatement(statement) { + this.inBlockScope(() => { + if (statement.left.type === "VariableDeclaration") { + this.blockPreWalkVariableDeclaration(statement.left); + this.walkVariableDeclaration(statement.left); + } else { + this.walkPattern(statement.left); + } + this.walkExpression(statement.right); + const body = statement.body; + if (body.type === "BlockStatement") { + // no need to add additional scope + const prev = this.prevStatement; + this.blockPreWalkStatements(body.body); + this.prevStatement = prev; + this.walkStatements(body.body); + } else { + this.walkNestedStatement(body); + } + }); + } + preWalkForOfStatement(statement) { + if (statement.await && this.scope.topLevelScope === true) { + this.hooks.topLevelAwait.call(statement); + } + if (statement.left.type === "VariableDeclaration") { + this.preWalkVariableDeclaration(statement.left); + } + this.preWalkStatement(statement.body); + } + walkForOfStatement(statement) { + this.inBlockScope(() => { + if (statement.left.type === "VariableDeclaration") { + this.blockPreWalkVariableDeclaration(statement.left); + this.walkVariableDeclaration(statement.left); + } else { + this.walkPattern(statement.left); + } + this.walkExpression(statement.right); + const body = statement.body; + if (body.type === "BlockStatement") { + // no need to add additional scope + const prev = this.prevStatement; + this.blockPreWalkStatements(body.body); + this.prevStatement = prev; + this.walkStatements(body.body); + } else { + this.walkNestedStatement(body); + } + }); + } -const { UsageState } = __webpack_require__(63686); -const { - numberToIdentifier, - NUMBER_OF_IDENTIFIER_START_CHARS, - NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS -} = __webpack_require__(1626); -const { assignDeterministicIds } = __webpack_require__(63290); -const { compareSelect, compareStringsNumeric } = __webpack_require__(29579); + // Declarations + preWalkFunctionDeclaration(statement) { + if (statement.id) { + this.defineVariable(statement.id.name); + } + } -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../ExportsInfo")} ExportsInfo */ -/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */ + walkFunctionDeclaration(statement) { + const wasTopLevel = this.scope.topLevelScope; + this.scope.topLevelScope = false; + this.inFunctionScope(true, statement.params, () => { + for (const param of statement.params) { + this.walkPattern(param); + } + if (statement.body.type === "BlockStatement") { + this.detectMode(statement.body.body); + const prev = this.prevStatement; + this.preWalkStatement(statement.body); + this.prevStatement = prev; + this.walkStatement(statement.body); + } else { + this.walkExpression(statement.body); + } + }); + this.scope.topLevelScope = wasTopLevel; + } -/** - * @param {ExportsInfo} exportsInfo exports info - * @returns {boolean} mangle is possible - */ -const canMangle = exportsInfo => { - if (exportsInfo.otherExportsInfo.getUsed(undefined) !== UsageState.Unused) - return false; - let hasSomethingToMangle = false; - for (const exportInfo of exportsInfo.exports) { - if (exportInfo.canMangle === true) { - hasSomethingToMangle = true; + blockPreWalkImportDeclaration(statement) { + const source = statement.source.value; + this.hooks.import.call(statement, source); + for (const specifier of statement.specifiers) { + const name = specifier.local.name; + switch (specifier.type) { + case "ImportDefaultSpecifier": + if ( + !this.hooks.importSpecifier.call(statement, source, "default", name) + ) { + this.defineVariable(name); + } + break; + case "ImportSpecifier": + if ( + !this.hooks.importSpecifier.call( + statement, + source, + specifier.imported.name, + name + ) + ) { + this.defineVariable(name); + } + break; + case "ImportNamespaceSpecifier": + if (!this.hooks.importSpecifier.call(statement, source, null, name)) { + this.defineVariable(name); + } + break; + default: + this.defineVariable(name); + } } } - return hasSomethingToMangle; -}; - -// Sort by name -const comparator = compareSelect(e => e.name, compareStringsNumeric); -/** - * @param {boolean} deterministic use deterministic names - * @param {ExportsInfo} exportsInfo exports info - * @param {boolean} isNamespace is namespace object - * @returns {void} - */ -const mangleExportsInfo = (deterministic, exportsInfo, isNamespace) => { - if (!canMangle(exportsInfo)) return; - const usedNames = new Set(); - /** @type {ExportInfo[]} */ - const mangleableExports = []; - // Avoid to renamed exports that are not provided when - // 1. it's not a namespace export: non-provided exports can be found in prototype chain - // 2. there are other provided exports and deterministic mode is chosen: - // non-provided exports would break the determinism - let avoidMangleNonProvided = !isNamespace; - if (!avoidMangleNonProvided && deterministic) { - for (const exportInfo of exportsInfo.ownedExports) { - if (exportInfo.provided !== false) { - avoidMangleNonProvided = true; + enterDeclaration(declaration, onIdent) { + switch (declaration.type) { + case "VariableDeclaration": + for (const declarator of declaration.declarations) { + switch (declarator.type) { + case "VariableDeclarator": { + this.enterPattern(declarator.id, onIdent); + break; + } + } + } + break; + case "FunctionDeclaration": + this.enterPattern(declaration.id, onIdent); + break; + case "ClassDeclaration": + this.enterPattern(declaration.id, onIdent); break; - } } } - for (const exportInfo of exportsInfo.ownedExports) { - const name = exportInfo.name; - if (!exportInfo.hasUsedName()) { + + blockPreWalkExportNamedDeclaration(statement) { + let source; + if (statement.source) { + source = statement.source.value; + this.hooks.exportImport.call(statement, source); + } else { + this.hooks.export.call(statement); + } + if (statement.declaration) { if ( - // Can the export be mangled? - exportInfo.canMangle !== true || - // Never rename 1 char exports - (name.length === 1 && /^[a-zA-Z0-9_$]/.test(name)) || - // Don't rename 2 char exports in deterministic mode - (deterministic && - name.length === 2 && - /^[a-zA-Z_$][a-zA-Z0-9_$]|^[1-9][0-9]/.test(name)) || - // Don't rename exports that are not provided - (avoidMangleNonProvided && exportInfo.provided !== true) + !this.hooks.exportDeclaration.call(statement, statement.declaration) ) { - exportInfo.setUsedName(name); - usedNames.add(name); - } else { - mangleableExports.push(exportInfo); + const prev = this.prevStatement; + this.preWalkStatement(statement.declaration); + this.prevStatement = prev; + this.blockPreWalkStatement(statement.declaration); + let index = 0; + this.enterDeclaration(statement.declaration, def => { + this.hooks.exportSpecifier.call(statement, def, def, index++); + }); } } - if (exportInfo.exportsInfoOwned) { - const used = exportInfo.getUsed(undefined); - if ( - used === UsageState.OnlyPropertiesUsed || - used === UsageState.Unused + if (statement.specifiers) { + for ( + let specifierIndex = 0; + specifierIndex < statement.specifiers.length; + specifierIndex++ ) { - mangleExportsInfo(deterministic, exportInfo.exportsInfo, false); + const specifier = statement.specifiers[specifierIndex]; + switch (specifier.type) { + case "ExportSpecifier": { + const name = specifier.exported.name; + if (source) { + this.hooks.exportImportSpecifier.call( + statement, + source, + specifier.local.name, + name, + specifierIndex + ); + } else { + this.hooks.exportSpecifier.call( + statement, + specifier.local.name, + name, + specifierIndex + ); + } + break; + } + } } } } - if (deterministic) { - assignDeterministicIds( - mangleableExports, - e => e.name, - comparator, - (e, id) => { - const name = numberToIdentifier(id); - const size = usedNames.size; - usedNames.add(name); - if (size === usedNames.size) return false; - e.setUsedName(name); - return true; - }, - [ - NUMBER_OF_IDENTIFIER_START_CHARS, - NUMBER_OF_IDENTIFIER_START_CHARS * - NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS - ], - NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS, - usedNames.size - ); - } else { - const usedExports = []; - const unusedExports = []; - for (const exportInfo of mangleableExports) { - if (exportInfo.getUsed(undefined) === UsageState.Unused) { - unusedExports.push(exportInfo); + + walkExportNamedDeclaration(statement) { + if (statement.declaration) { + this.walkStatement(statement.declaration); + } + } + + blockPreWalkExportDefaultDeclaration(statement) { + const prev = this.prevStatement; + this.preWalkStatement(statement.declaration); + this.prevStatement = prev; + this.blockPreWalkStatement(statement.declaration); + if ( + statement.declaration.id && + statement.declaration.type !== "FunctionExpression" && + statement.declaration.type !== "ClassExpression" + ) { + this.hooks.exportSpecifier.call( + statement, + statement.declaration.id.name, + "default", + undefined + ); + } + } + + walkExportDefaultDeclaration(statement) { + this.hooks.export.call(statement); + if ( + statement.declaration.id && + statement.declaration.type !== "FunctionExpression" && + statement.declaration.type !== "ClassExpression" + ) { + if ( + !this.hooks.exportDeclaration.call(statement, statement.declaration) + ) { + this.walkStatement(statement.declaration); + } + } else { + // Acorn parses `export default function() {}` as `FunctionDeclaration` and + // `export default class {}` as `ClassDeclaration`, both with `id = null`. + // These nodes must be treated as expressions. + if ( + statement.declaration.type === "FunctionDeclaration" || + statement.declaration.type === "ClassDeclaration" + ) { + this.walkStatement(statement.declaration); } else { - usedExports.push(exportInfo); + this.walkExpression(statement.declaration); } - } - usedExports.sort(comparator); - unusedExports.sort(comparator); - let i = 0; - for (const list of [usedExports, unusedExports]) { - for (const exportInfo of list) { - let name; - do { - name = numberToIdentifier(i++); - } while (usedNames.has(name)); - exportInfo.setUsedName(name); + if (!this.hooks.exportExpression.call(statement, statement.declaration)) { + this.hooks.exportSpecifier.call( + statement, + statement.declaration, + "default", + undefined + ); } } } -}; -class MangleExportsPlugin { - /** - * @param {boolean} deterministic use deterministic names - */ - constructor(deterministic) { - this._deterministic = deterministic; + blockPreWalkExportAllDeclaration(statement) { + const source = statement.source.value; + const name = statement.exported ? statement.exported.name : null; + this.hooks.exportImport.call(statement, source); + this.hooks.exportImportSpecifier.call(statement, source, null, name, 0); } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const { _deterministic: deterministic } = this; - compiler.hooks.compilation.tap("MangleExportsPlugin", compilation => { - const moduleGraph = compilation.moduleGraph; - compilation.hooks.optimizeCodeGeneration.tap( - "MangleExportsPlugin", - modules => { - if (compilation.moduleMemCaches) { - throw new Error( - "optimization.mangleExports can't be used with cacheUnaffected as export mangling is a global effect" - ); + + preWalkVariableDeclaration(statement) { + if (statement.kind !== "var") return; + this._preWalkVariableDeclaration(statement, this.hooks.varDeclarationVar); + } + + blockPreWalkVariableDeclaration(statement) { + if (statement.kind === "var") return; + const hookMap = + statement.kind === "const" + ? this.hooks.varDeclarationConst + : this.hooks.varDeclarationLet; + this._preWalkVariableDeclaration(statement, hookMap); + } + + _preWalkVariableDeclaration(statement, hookMap) { + for (const declarator of statement.declarations) { + switch (declarator.type) { + case "VariableDeclarator": { + if (!this.hooks.preDeclarator.call(declarator, statement)) { + this.enterPattern(declarator.id, (name, decl) => { + let hook = hookMap.get(name); + if (hook === undefined || !hook.call(decl)) { + hook = this.hooks.varDeclaration.get(name); + if (hook === undefined || !hook.call(decl)) { + this.defineVariable(name); + } + } + }); } - for (const module of modules) { - const isNamespace = - module.buildMeta && module.buildMeta.exportsType === "namespace"; - const exportsInfo = moduleGraph.getExportsInfo(module); - mangleExportsInfo(deterministic, exportsInfo, isNamespace); + break; + } + } + } + } + + walkVariableDeclaration(statement) { + for (const declarator of statement.declarations) { + switch (declarator.type) { + case "VariableDeclarator": { + const renameIdentifier = + declarator.init && this.getRenameIdentifier(declarator.init); + if (renameIdentifier && declarator.id.type === "Identifier") { + const hook = this.hooks.canRename.get(renameIdentifier); + if (hook !== undefined && hook.call(declarator.init)) { + // renaming with "var a = b;" + const hook = this.hooks.rename.get(renameIdentifier); + if (hook === undefined || !hook.call(declarator.init)) { + this.setVariable(declarator.id.name, renameIdentifier); + } + break; + } + } + if (!this.hooks.declarator.call(declarator, statement)) { + this.walkPattern(declarator.id); + if (declarator.init) this.walkExpression(declarator.init); } + break; } - ); - }); + } + } } -} -module.exports = MangleExportsPlugin; + blockPreWalkClassDeclaration(statement) { + if (statement.id) { + this.defineVariable(statement.id.name); + } + } + walkClassDeclaration(statement) { + this.walkClass(statement); + } -/***/ }), + preWalkSwitchCases(switchCases) { + for (let index = 0, len = switchCases.length; index < len; index++) { + const switchCase = switchCases[index]; + this.preWalkStatements(switchCase.consequent); + } + } -/***/ 85067: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + walkSwitchCases(switchCases) { + this.inBlockScope(() => { + const len = switchCases.length; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // we need to pre walk all statements first since we can have invalid code + // import A from "module"; + // switch(1) { + // case 1: + // console.log(A); // should fail at runtime + // case 2: + // const A = 1; + // } + for (let index = 0; index < len; index++) { + const switchCase = switchCases[index]; + if (switchCase.consequent.length > 0) { + const prev = this.prevStatement; + this.blockPreWalkStatements(switchCase.consequent); + this.prevStatement = prev; + } + } + for (let index = 0; index < len; index++) { + const switchCase = switchCases[index]; -const { STAGE_BASIC } = __webpack_require__(80057); -const { runtimeEqual } = __webpack_require__(17156); + if (switchCase.test) { + this.walkExpression(switchCase.test); + } + if (switchCase.consequent.length > 0) { + this.walkStatements(switchCase.consequent); + } + } + }); + } -/** @typedef {import("../Compiler")} Compiler */ + preWalkCatchClause(catchClause) { + this.preWalkStatement(catchClause.body); + } -class MergeDuplicateChunksPlugin { - /** - * @param {Compiler} compiler the compiler - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "MergeDuplicateChunksPlugin", - compilation => { - compilation.hooks.optimizeChunks.tap( - { - name: "MergeDuplicateChunksPlugin", - stage: STAGE_BASIC - }, - chunks => { - const { chunkGraph, moduleGraph } = compilation; + walkCatchClause(catchClause) { + this.inBlockScope(() => { + // Error binding is optional in catch clause since ECMAScript 2019 + if (catchClause.param !== null) { + this.enterPattern(catchClause.param, ident => { + this.defineVariable(ident); + }); + this.walkPattern(catchClause.param); + } + const prev = this.prevStatement; + this.blockPreWalkStatement(catchClause.body); + this.prevStatement = prev; + this.walkStatement(catchClause.body); + }); + } - // remember already tested chunks for performance - const notDuplicates = new Set(); + walkPattern(pattern) { + switch (pattern.type) { + case "ArrayPattern": + this.walkArrayPattern(pattern); + break; + case "AssignmentPattern": + this.walkAssignmentPattern(pattern); + break; + case "MemberExpression": + this.walkMemberExpression(pattern); + break; + case "ObjectPattern": + this.walkObjectPattern(pattern); + break; + case "RestElement": + this.walkRestElement(pattern); + break; + } + } - // for each chunk - for (const chunk of chunks) { - // track a Set of all chunk that could be duplicates - let possibleDuplicates; - for (const module of chunkGraph.getChunkModulesIterable(chunk)) { - if (possibleDuplicates === undefined) { - // when possibleDuplicates is not yet set, - // create a new Set from chunks of the current module - // including only chunks with the same number of modules - for (const dup of chunkGraph.getModuleChunksIterable( - module - )) { - if ( - dup !== chunk && - chunkGraph.getNumberOfChunkModules(chunk) === - chunkGraph.getNumberOfChunkModules(dup) && - !notDuplicates.has(dup) - ) { - // delay allocating the new Set until here, reduce memory pressure - if (possibleDuplicates === undefined) { - possibleDuplicates = new Set(); - } - possibleDuplicates.add(dup); - } - } - // when no chunk is possible we can break here - if (possibleDuplicates === undefined) break; - } else { - // validate existing possible duplicates - for (const dup of possibleDuplicates) { - // remove possible duplicate when module is not contained - if (!chunkGraph.isModuleInChunk(module, dup)) { - possibleDuplicates.delete(dup); - } - } - // when all chunks has been removed we can break here - if (possibleDuplicates.size === 0) break; - } - } + walkAssignmentPattern(pattern) { + this.walkExpression(pattern.right); + this.walkPattern(pattern.left); + } - // when we found duplicates - if ( - possibleDuplicates !== undefined && - possibleDuplicates.size > 0 - ) { - outer: for (const otherChunk of possibleDuplicates) { - if (otherChunk.hasRuntime() !== chunk.hasRuntime()) continue; - if (chunkGraph.getNumberOfEntryModules(chunk) > 0) continue; - if (chunkGraph.getNumberOfEntryModules(otherChunk) > 0) - continue; - if (!runtimeEqual(chunk.runtime, otherChunk.runtime)) { - for (const module of chunkGraph.getChunkModulesIterable( - chunk - )) { - const exportsInfo = moduleGraph.getExportsInfo(module); - if ( - !exportsInfo.isEquallyUsed( - chunk.runtime, - otherChunk.runtime - ) - ) { - continue outer; - } - } - } - // merge them - if (chunkGraph.canChunksBeIntegrated(chunk, otherChunk)) { - chunkGraph.integrateChunks(chunk, otherChunk); - compilation.chunks.delete(otherChunk); - } - } - } + walkObjectPattern(pattern) { + for (let i = 0, len = pattern.properties.length; i < len; i++) { + const prop = pattern.properties[i]; + if (prop) { + if (prop.computed) this.walkExpression(prop.key); + if (prop.value) this.walkPattern(prop.value); + } + } + } - // don't check already processed chunks twice - notDuplicates.add(chunk); - } - } - ); + walkArrayPattern(pattern) { + for (let i = 0, len = pattern.elements.length; i < len; i++) { + const element = pattern.elements[i]; + if (element) this.walkPattern(element); + } + } + + walkRestElement(pattern) { + this.walkPattern(pattern.argument); + } + + walkExpressions(expressions) { + for (const expression of expressions) { + if (expression) { + this.walkExpression(expression); } - ); + } + } + + walkExpression(expression) { + switch (expression.type) { + case "ArrayExpression": + this.walkArrayExpression(expression); + break; + case "ArrowFunctionExpression": + this.walkArrowFunctionExpression(expression); + break; + case "AssignmentExpression": + this.walkAssignmentExpression(expression); + break; + case "AwaitExpression": + this.walkAwaitExpression(expression); + break; + case "BinaryExpression": + this.walkBinaryExpression(expression); + break; + case "CallExpression": + this.walkCallExpression(expression); + break; + case "ChainExpression": + this.walkChainExpression(expression); + break; + case "ClassExpression": + this.walkClassExpression(expression); + break; + case "ConditionalExpression": + this.walkConditionalExpression(expression); + break; + case "FunctionExpression": + this.walkFunctionExpression(expression); + break; + case "Identifier": + this.walkIdentifier(expression); + break; + case "ImportExpression": + this.walkImportExpression(expression); + break; + case "LogicalExpression": + this.walkLogicalExpression(expression); + break; + case "MetaProperty": + this.walkMetaProperty(expression); + break; + case "MemberExpression": + this.walkMemberExpression(expression); + break; + case "NewExpression": + this.walkNewExpression(expression); + break; + case "ObjectExpression": + this.walkObjectExpression(expression); + break; + case "SequenceExpression": + this.walkSequenceExpression(expression); + break; + case "SpreadElement": + this.walkSpreadElement(expression); + break; + case "TaggedTemplateExpression": + this.walkTaggedTemplateExpression(expression); + break; + case "TemplateLiteral": + this.walkTemplateLiteral(expression); + break; + case "ThisExpression": + this.walkThisExpression(expression); + break; + case "UnaryExpression": + this.walkUnaryExpression(expression); + break; + case "UpdateExpression": + this.walkUpdateExpression(expression); + break; + case "YieldExpression": + this.walkYieldExpression(expression); + break; + } } -} -module.exports = MergeDuplicateChunksPlugin; + walkAwaitExpression(expression) { + if (this.scope.topLevelScope === true) + this.hooks.topLevelAwait.call(expression); + this.walkExpression(expression.argument); + } -/***/ }), + walkArrayExpression(expression) { + if (expression.elements) { + this.walkExpressions(expression.elements); + } + } -/***/ 53912: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + walkSpreadElement(expression) { + if (expression.argument) { + this.walkExpression(expression.argument); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + walkObjectExpression(expression) { + for ( + let propIndex = 0, len = expression.properties.length; + propIndex < len; + propIndex++ + ) { + const prop = expression.properties[propIndex]; + this.walkProperty(prop); + } + } + walkProperty(prop) { + if (prop.type === "SpreadElement") { + this.walkExpression(prop.argument); + return; + } + if (prop.computed) { + this.walkExpression(prop.key); + } + if (prop.shorthand && prop.value && prop.value.type === "Identifier") { + this.scope.inShorthand = prop.value.name; + this.walkIdentifier(prop.value); + this.scope.inShorthand = false; + } else { + this.walkExpression(prop.value); + } + } + walkFunctionExpression(expression) { + const wasTopLevel = this.scope.topLevelScope; + this.scope.topLevelScope = false; + const scopeParams = expression.params; -const { STAGE_ADVANCED } = __webpack_require__(80057); -const createSchemaValidation = __webpack_require__(32540); + // Add function name in scope for recursive calls + if (expression.id) { + scopeParams.push(expression.id.name); + } -/** @typedef {import("../../declarations/plugins/optimize/MinChunkSizePlugin").MinChunkSizePluginOptions} MinChunkSizePluginOptions */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ + this.inFunctionScope(true, scopeParams, () => { + for (const param of expression.params) { + this.walkPattern(param); + } + if (expression.body.type === "BlockStatement") { + this.detectMode(expression.body.body); + const prev = this.prevStatement; + this.preWalkStatement(expression.body); + this.prevStatement = prev; + this.walkStatement(expression.body); + } else { + this.walkExpression(expression.body); + } + }); + this.scope.topLevelScope = wasTopLevel; + } -const validate = createSchemaValidation( - __webpack_require__(60135), - () => __webpack_require__(53850), - { - name: "Min Chunk Size Plugin", - baseDataPath: "options" + walkArrowFunctionExpression(expression) { + const wasTopLevel = this.scope.topLevelScope; + this.scope.topLevelScope = wasTopLevel ? "arrow" : false; + this.inFunctionScope(false, expression.params, () => { + for (const param of expression.params) { + this.walkPattern(param); + } + if (expression.body.type === "BlockStatement") { + this.detectMode(expression.body.body); + const prev = this.prevStatement; + this.preWalkStatement(expression.body); + this.prevStatement = prev; + this.walkStatement(expression.body); + } else { + this.walkExpression(expression.body); + } + }); + this.scope.topLevelScope = wasTopLevel; } -); -class MinChunkSizePlugin { /** - * @param {MinChunkSizePluginOptions} options options object + * @param {SequenceExpressionNode} expression the sequence */ - constructor(options) { - validate(options); - this.options = options; + walkSequenceExpression(expression) { + if (!expression.expressions) return; + // We treat sequence expressions like statements when they are one statement level + // This has some benefits for optimizations that only work on statement level + const currentStatement = this.statementPath[this.statementPath.length - 1]; + if ( + currentStatement === expression || + (currentStatement.type === "ExpressionStatement" && + currentStatement.expression === expression) + ) { + const old = this.statementPath.pop(); + for (const expr of expression.expressions) { + this.statementPath.push(expr); + this.walkExpression(expr); + this.statementPath.pop(); + } + this.statementPath.push(old); + } else { + this.walkExpressions(expression.expressions); + } } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const options = this.options; - const minChunkSize = options.minChunkSize; - compiler.hooks.compilation.tap("MinChunkSizePlugin", compilation => { - compilation.hooks.optimizeChunks.tap( - { - name: "MinChunkSizePlugin", - stage: STAGE_ADVANCED - }, - chunks => { - const chunkGraph = compilation.chunkGraph; - const equalOptions = { - chunkOverhead: 1, - entryChunkMultiplicator: 1 - }; + walkUpdateExpression(expression) { + this.walkExpression(expression.argument); + } - const chunkSizesMap = new Map(); - /** @type {[Chunk, Chunk][]} */ - const combinations = []; - /** @type {Chunk[]} */ - const smallChunks = []; - const visitedChunks = []; - for (const a of chunks) { - // check if one of the chunks sizes is smaller than the minChunkSize - // and filter pairs that can NOT be integrated! - if (chunkGraph.getChunkSize(a, equalOptions) < minChunkSize) { - smallChunks.push(a); - for (const b of visitedChunks) { - if (chunkGraph.canChunksBeIntegrated(b, a)) - combinations.push([b, a]); - } - } else { - for (const b of smallChunks) { - if (chunkGraph.canChunksBeIntegrated(b, a)) - combinations.push([b, a]); - } - } - chunkSizesMap.set(a, chunkGraph.getChunkSize(a, options)); - visitedChunks.push(a); - } + walkUnaryExpression(expression) { + if (expression.operator === "typeof") { + const result = this.callHooksForExpression( + this.hooks.typeof, + expression.argument, + expression + ); + if (result === true) return; + if (expression.argument.type === "ChainExpression") { + const result = this.callHooksForExpression( + this.hooks.typeof, + expression.argument.expression, + expression + ); + if (result === true) return; + } + } + this.walkExpression(expression.argument); + } - const sortedSizeFilteredExtendedPairCombinations = combinations - .map(pair => { - // extend combination pairs with size and integrated size - const a = chunkSizesMap.get(pair[0]); - const b = chunkSizesMap.get(pair[1]); - const ab = chunkGraph.getIntegratedChunksSize( - pair[0], - pair[1], - options - ); - /** @type {[number, number, Chunk, Chunk]} */ - const extendedPair = [a + b - ab, ab, pair[0], pair[1]]; - return extendedPair; - }) - .sort((a, b) => { - // sadly javascript does an in place sort here - // sort by size - const diff = b[0] - a[0]; - if (diff !== 0) return diff; - return a[1] - b[1]; - }); + walkLeftRightExpression(expression) { + this.walkExpression(expression.left); + this.walkExpression(expression.right); + } - if (sortedSizeFilteredExtendedPairCombinations.length === 0) return; + walkBinaryExpression(expression) { + this.walkLeftRightExpression(expression); + } - const pair = sortedSizeFilteredExtendedPairCombinations[0]; + walkLogicalExpression(expression) { + const result = this.hooks.expressionLogicalOperator.call(expression); + if (result === undefined) { + this.walkLeftRightExpression(expression); + } else { + if (result) { + this.walkExpression(expression.right); + } + } + } - chunkGraph.integrateChunks(pair[2], pair[3]); - compilation.chunks.delete(pair[3]); - return true; + walkAssignmentExpression(expression) { + if (expression.left.type === "Identifier") { + const renameIdentifier = this.getRenameIdentifier(expression.right); + if (renameIdentifier) { + if ( + this.callHooksForInfo( + this.hooks.canRename, + renameIdentifier, + expression.right + ) + ) { + // renaming "a = b;" + if ( + !this.callHooksForInfo( + this.hooks.rename, + renameIdentifier, + expression.right + ) + ) { + this.setVariable( + expression.left.name, + this.getVariableInfo(renameIdentifier) + ); + } + return; + } + } + this.walkExpression(expression.right); + this.enterPattern(expression.left, (name, decl) => { + if (!this.callHooksForName(this.hooks.assign, name, expression)) { + this.walkExpression(expression.left); + } + }); + return; + } + if (expression.left.type.endsWith("Pattern")) { + this.walkExpression(expression.right); + this.enterPattern(expression.left, (name, decl) => { + if (!this.callHooksForName(this.hooks.assign, name, expression)) { + this.defineVariable(name); } + }); + this.walkPattern(expression.left); + } else if (expression.left.type === "MemberExpression") { + const exprName = this.getMemberExpressionInfo( + expression.left, + ALLOWED_MEMBER_TYPES_EXPRESSION ); - }); + if (exprName) { + if ( + this.callHooksForInfo( + this.hooks.assignMemberChain, + exprName.rootInfo, + expression, + exprName.getMembers() + ) + ) { + return; + } + } + this.walkExpression(expression.right); + this.walkExpression(expression.left); + } else { + this.walkExpression(expression.right); + this.walkExpression(expression.left); + } } -} -module.exports = MinChunkSizePlugin; - - -/***/ }), -/***/ 85305: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const SizeFormatHelpers = __webpack_require__(71070); -const WebpackError = __webpack_require__(53799); - -class MinMaxSizeWarning extends WebpackError { - constructor(keys, minSize, maxSize) { - let keysMessage = "Fallback cache group"; - if (keys) { - keysMessage = - keys.length > 1 - ? `Cache groups ${keys.sort().join(", ")}` - : `Cache group ${keys[0]}`; + walkConditionalExpression(expression) { + const result = this.hooks.expressionConditionalOperator.call(expression); + if (result === undefined) { + this.walkExpression(expression.test); + this.walkExpression(expression.consequent); + if (expression.alternate) { + this.walkExpression(expression.alternate); + } + } else { + if (result) { + this.walkExpression(expression.consequent); + } else if (expression.alternate) { + this.walkExpression(expression.alternate); + } } - super( - `SplitChunksPlugin\n` + - `${keysMessage}\n` + - `Configured minSize (${SizeFormatHelpers.formatSize(minSize)}) is ` + - `bigger than maxSize (${SizeFormatHelpers.formatSize(maxSize)}).\n` + - "This seem to be a invalid optimization.splitChunks configuration." - ); } -} -module.exports = MinMaxSizeWarning; + walkNewExpression(expression) { + const result = this.callHooksForExpression( + this.hooks.new, + expression.callee, + expression + ); + if (result === true) return; + this.walkExpression(expression.callee); + if (expression.arguments) { + this.walkExpressions(expression.arguments); + } + } + walkYieldExpression(expression) { + if (expression.argument) { + this.walkExpression(expression.argument); + } + } -/***/ }), + walkTemplateLiteral(expression) { + if (expression.expressions) { + this.walkExpressions(expression.expressions); + } + } -/***/ 74844: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + walkTaggedTemplateExpression(expression) { + if (expression.tag) { + this.walkExpression(expression.tag); + } + if (expression.quasi && expression.quasi.expressions) { + this.walkExpressions(expression.quasi.expressions); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + walkClassExpression(expression) { + this.walkClass(expression); + } + /** + * @param {ChainExpressionNode} expression expression + */ + walkChainExpression(expression) { + const result = this.hooks.optionalChaining.call(expression); + if (result === undefined) { + if (expression.expression.type === "CallExpression") { + this.walkCallExpression(expression.expression); + } else { + this.walkMemberExpression(expression.expression); + } + } + } -const asyncLib = __webpack_require__(78175); -const ChunkGraph = __webpack_require__(64971); -const ModuleGraph = __webpack_require__(99988); -const { STAGE_DEFAULT } = __webpack_require__(80057); -const HarmonyImportDependency = __webpack_require__(57154); -const { compareModulesByIdentifier } = __webpack_require__(29579); -const { - intersectRuntime, - mergeRuntimeOwned, - filterRuntime, - runtimeToString, - mergeRuntime -} = __webpack_require__(17156); -const ConcatenatedModule = __webpack_require__(97198); + _walkIIFE(functionExpression, options, currentThis) { + const getVarInfo = argOrThis => { + const renameIdentifier = this.getRenameIdentifier(argOrThis); + if (renameIdentifier) { + if ( + this.callHooksForInfo( + this.hooks.canRename, + renameIdentifier, + argOrThis + ) + ) { + if ( + !this.callHooksForInfo( + this.hooks.rename, + renameIdentifier, + argOrThis + ) + ) { + return this.getVariableInfo(renameIdentifier); + } + } + } + this.walkExpression(argOrThis); + }; + const { params, type } = functionExpression; + const arrow = type === "ArrowFunctionExpression"; + const renameThis = currentThis ? getVarInfo(currentThis) : null; + const varInfoForArgs = options.map(getVarInfo); + const wasTopLevel = this.scope.topLevelScope; + this.scope.topLevelScope = wasTopLevel && arrow ? "arrow" : false; + const scopeParams = params.filter( + (identifier, idx) => !varInfoForArgs[idx] + ); -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + // Add function name in scope for recursive calls + if (functionExpression.id) { + scopeParams.push(functionExpression.id.name); + } -/** - * @typedef {Object} Statistics - * @property {number} cached - * @property {number} alreadyInConfig - * @property {number} invalidModule - * @property {number} incorrectChunks - * @property {number} incorrectDependency - * @property {number} incorrectModuleDependency - * @property {number} incorrectChunksOfImporter - * @property {number} incorrectRuntimeCondition - * @property {number} importerFailed - * @property {number} added - */ + this.inFunctionScope(true, scopeParams, () => { + if (renameThis && !arrow) { + this.setVariable("this", renameThis); + } + for (let i = 0; i < varInfoForArgs.length; i++) { + const varInfo = varInfoForArgs[i]; + if (!varInfo) continue; + if (!params[i] || params[i].type !== "Identifier") continue; + this.setVariable(params[i].name, varInfo); + } + if (functionExpression.body.type === "BlockStatement") { + this.detectMode(functionExpression.body.body); + const prev = this.prevStatement; + this.preWalkStatement(functionExpression.body); + this.prevStatement = prev; + this.walkStatement(functionExpression.body); + } else { + this.walkExpression(functionExpression.body); + } + }); + this.scope.topLevelScope = wasTopLevel; + } -const formatBailoutReason = msg => { - return "ModuleConcatenation bailout: " + msg; -}; + walkImportExpression(expression) { + let result = this.hooks.importCall.call(expression); + if (result === true) return; -class ModuleConcatenationPlugin { - constructor(options) { - if (typeof options !== "object") options = {}; - this.options = options; + this.walkExpression(expression.source); } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const { _backCompat: backCompat } = compiler; - compiler.hooks.compilation.tap("ModuleConcatenationPlugin", compilation => { - const moduleGraph = compilation.moduleGraph; - const bailoutReasonMap = new Map(); - - const setBailoutReason = (module, reason) => { - setInnerBailoutReason(module, reason); - moduleGraph - .getOptimizationBailout(module) - .push( - typeof reason === "function" - ? rs => formatBailoutReason(reason(rs)) - : formatBailoutReason(reason) + walkCallExpression(expression) { + const isSimpleFunction = fn => { + return fn.params.every(p => p.type === "Identifier"); + }; + if ( + expression.callee.type === "MemberExpression" && + expression.callee.object.type.endsWith("FunctionExpression") && + !expression.callee.computed && + (expression.callee.property.name === "call" || + expression.callee.property.name === "bind") && + expression.arguments.length > 0 && + isSimpleFunction(expression.callee.object) + ) { + // (function(…) { }.call/bind(?, …)) + this._walkIIFE( + expression.callee.object, + expression.arguments.slice(1), + expression.arguments[0] + ); + } else if ( + expression.callee.type.endsWith("FunctionExpression") && + isSimpleFunction(expression.callee) + ) { + // (function(…) { }(…)) + this._walkIIFE(expression.callee, expression.arguments, null); + } else { + if (expression.callee.type === "MemberExpression") { + const exprInfo = this.getMemberExpressionInfo( + expression.callee, + ALLOWED_MEMBER_TYPES_CALL_EXPRESSION + ); + if (exprInfo && exprInfo.type === "call") { + const result = this.callHooksForInfo( + this.hooks.callMemberChainOfCallMemberChain, + exprInfo.rootInfo, + expression, + exprInfo.getCalleeMembers(), + exprInfo.call, + exprInfo.getMembers() ); - }; - - const setInnerBailoutReason = (module, reason) => { - bailoutReasonMap.set(module, reason); - }; - - const getInnerBailoutReason = (module, requestShortener) => { - const reason = bailoutReasonMap.get(module); - if (typeof reason === "function") return reason(requestShortener); - return reason; - }; + if (result === true) return; + } + } + const callee = this.evaluateExpression(expression.callee); + if (callee.isIdentifier()) { + const result1 = this.callHooksForInfo( + this.hooks.callMemberChain, + callee.rootInfo, + expression, + callee.getMembers() + ); + if (result1 === true) return; + const result2 = this.callHooksForInfo( + this.hooks.call, + callee.identifier, + expression + ); + if (result2 === true) return; + } - const formatBailoutWarning = (module, problem) => requestShortener => { - if (typeof problem === "function") { - return formatBailoutReason( - `Cannot concat with ${module.readableIdentifier( - requestShortener - )}: ${problem(requestShortener)}` - ); + if (expression.callee) { + if (expression.callee.type === "MemberExpression") { + // because of call context we need to walk the call context as expression + this.walkExpression(expression.callee.object); + if (expression.callee.computed === true) + this.walkExpression(expression.callee.property); + } else { + this.walkExpression(expression.callee); } - const reason = getInnerBailoutReason(module, requestShortener); - const reasonWithPrefix = reason ? `: ${reason}` : ""; - if (module === problem) { - return formatBailoutReason( - `Cannot concat with ${module.readableIdentifier( - requestShortener - )}${reasonWithPrefix}` + } + if (expression.arguments) this.walkExpressions(expression.arguments); + } + } + + walkMemberExpression(expression) { + const exprInfo = this.getMemberExpressionInfo( + expression, + ALLOWED_MEMBER_TYPES_ALL + ); + if (exprInfo) { + switch (exprInfo.type) { + case "expression": { + const result1 = this.callHooksForInfo( + this.hooks.expression, + exprInfo.name, + expression ); - } else { - return formatBailoutReason( - `Cannot concat with ${module.readableIdentifier( - requestShortener - )} because of ${problem.readableIdentifier( - requestShortener - )}${reasonWithPrefix}` + if (result1 === true) return; + const members = exprInfo.getMembers(); + const result2 = this.callHooksForInfo( + this.hooks.expressionMemberChain, + exprInfo.rootInfo, + expression, + members + ); + if (result2 === true) return; + this.walkMemberExpressionWithExpressionName( + expression, + exprInfo.name, + exprInfo.rootInfo, + members.slice(), + () => + this.callHooksForInfo( + this.hooks.unhandledExpressionMemberChain, + exprInfo.rootInfo, + expression, + members + ) ); + return; } - }; - - compilation.hooks.optimizeChunkModules.tapAsync( - { - name: "ModuleConcatenationPlugin", - stage: STAGE_DEFAULT - }, - (allChunks, modules, callback) => { - const logger = compilation.getLogger( - "webpack.ModuleConcatenationPlugin" + case "call": { + const result = this.callHooksForInfo( + this.hooks.memberChainOfCallMemberChain, + exprInfo.rootInfo, + expression, + exprInfo.getCalleeMembers(), + exprInfo.call, + exprInfo.getMembers() ); - const { chunkGraph, moduleGraph } = compilation; - const relevantModules = []; - const possibleInners = new Set(); - const context = { - chunkGraph, - moduleGraph - }; - logger.time("select relevant modules"); - for (const module of modules) { - let canBeRoot = true; - let canBeInner = true; - - const bailoutReason = module.getConcatenationBailoutReason(context); - if (bailoutReason) { - setBailoutReason(module, bailoutReason); - continue; - } - - // Must not be an async module - if (moduleGraph.isAsync(module)) { - setBailoutReason(module, `Module is async`); - continue; - } - - // Must be in strict mode - if (!module.buildInfo.strict) { - setBailoutReason(module, `Module is not in strict mode`); - continue; - } - - // Module must be in any chunk (we don't want to do useless work) - if (chunkGraph.getNumberOfModuleChunks(module) === 0) { - setBailoutReason(module, "Module is not in any chunk"); - continue; - } - - // Exports must be known (and not dynamic) - const exportsInfo = moduleGraph.getExportsInfo(module); - const relevantExports = exportsInfo.getRelevantExports(undefined); - const unknownReexports = relevantExports.filter(exportInfo => { - return ( - exportInfo.isReexport() && !exportInfo.getTarget(moduleGraph) - ); - }); - if (unknownReexports.length > 0) { - setBailoutReason( - module, - `Reexports in this module do not have a static target (${Array.from( - unknownReexports, - exportInfo => - `${ - exportInfo.name || "other exports" - }: ${exportInfo.getUsedInfo()}` - ).join(", ")})` - ); - continue; - } - - // Root modules must have a static list of exports - const unknownProvidedExports = relevantExports.filter( - exportInfo => { - return exportInfo.provided !== true; - } - ); - if (unknownProvidedExports.length > 0) { - setBailoutReason( - module, - `List of module exports is dynamic (${Array.from( - unknownProvidedExports, - exportInfo => - `${ - exportInfo.name || "other exports" - }: ${exportInfo.getProvidedInfo()} and ${exportInfo.getUsedInfo()}` - ).join(", ")})` - ); - canBeRoot = false; - } - - // Module must not be an entry point - if (chunkGraph.isEntryModule(module)) { - setInnerBailoutReason(module, "Module is an entry point"); - canBeInner = false; - } + if (result === true) return; + // Fast skip over the member chain as we already called memberChainOfCallMemberChain + // and call computed property are literals anyway + this.walkExpression(exprInfo.call); + return; + } + } + } + this.walkExpression(expression.object); + if (expression.computed === true) this.walkExpression(expression.property); + } - if (canBeRoot) relevantModules.push(module); - if (canBeInner) possibleInners.add(module); - } - logger.timeEnd("select relevant modules"); - logger.debug( - `${relevantModules.length} potential root modules, ${possibleInners.size} potential inner modules` - ); - // sort by depth - // modules with lower depth are more likely suited as roots - // this improves performance, because modules already selected as inner are skipped - logger.time("sort relevant modules"); - relevantModules.sort((a, b) => { - return moduleGraph.getDepth(a) - moduleGraph.getDepth(b); - }); - logger.timeEnd("sort relevant modules"); + walkMemberExpressionWithExpressionName( + expression, + name, + rootInfo, + members, + onUnhandled + ) { + if (expression.object.type === "MemberExpression") { + // optimize the case where expression.object is a MemberExpression too. + // we can keep info here when calling walkMemberExpression directly + const property = + expression.property.name || `${expression.property.value}`; + name = name.slice(0, -property.length - 1); + members.pop(); + const result = this.callHooksForInfo( + this.hooks.expression, + name, + expression.object + ); + if (result === true) return; + this.walkMemberExpressionWithExpressionName( + expression.object, + name, + rootInfo, + members, + onUnhandled + ); + } else if (!onUnhandled || !onUnhandled()) { + this.walkExpression(expression.object); + } + if (expression.computed === true) this.walkExpression(expression.property); + } - /** @type {Statistics} */ - const stats = { - cached: 0, - alreadyInConfig: 0, - invalidModule: 0, - incorrectChunks: 0, - incorrectDependency: 0, - incorrectModuleDependency: 0, - incorrectChunksOfImporter: 0, - incorrectRuntimeCondition: 0, - importerFailed: 0, - added: 0 - }; - let statsCandidates = 0; - let statsSizeSum = 0; - let statsEmptyConfigurations = 0; + walkThisExpression(expression) { + this.callHooksForName(this.hooks.expression, "this", expression); + } - logger.time("find modules to concatenate"); - const concatConfigurations = []; - const usedAsInner = new Set(); - for (const currentRoot of relevantModules) { - // when used by another configuration as inner: - // the other configuration is better and we can skip this one - // TODO reconsider that when it's only used in a different runtime - if (usedAsInner.has(currentRoot)) continue; + walkIdentifier(expression) { + this.callHooksForName(this.hooks.expression, expression.name, expression); + } - let chunkRuntime = undefined; - for (const r of chunkGraph.getModuleRuntimes(currentRoot)) { - chunkRuntime = mergeRuntimeOwned(chunkRuntime, r); - } - const exportsInfo = moduleGraph.getExportsInfo(currentRoot); - const filteredRuntime = filterRuntime(chunkRuntime, r => - exportsInfo.isModuleUsed(r) - ); - const activeRuntime = - filteredRuntime === true - ? chunkRuntime - : filteredRuntime === false - ? undefined - : filteredRuntime; + /** + * @param {MetaPropertyNode} metaProperty meta property + */ + walkMetaProperty(metaProperty) { + this.hooks.expression.for(getRootName(metaProperty)).call(metaProperty); + } - // create a configuration with the root - const currentConfiguration = new ConcatConfiguration( - currentRoot, - activeRuntime - ); + callHooksForExpression(hookMap, expr, ...args) { + return this.callHooksForExpressionWithFallback( + hookMap, + expr, + undefined, + undefined, + ...args + ); + } - // cache failures to add modules - const failureCache = new Map(); + /** + * @template T + * @template R + * @param {HookMap>} hookMap hooks the should be called + * @param {MemberExpressionNode} expr expression info + * @param {function(string, string | ScopeInfo | VariableInfo, function(): string[]): any} fallback callback when variable in not handled by hooks + * @param {function(string): any} defined callback when variable is defined + * @param {AsArray} args args for the hook + * @returns {R} result of hook + */ + callHooksForExpressionWithFallback( + hookMap, + expr, + fallback, + defined, + ...args + ) { + const exprName = this.getMemberExpressionInfo( + expr, + ALLOWED_MEMBER_TYPES_EXPRESSION + ); + if (exprName !== undefined) { + const members = exprName.getMembers(); + return this.callHooksForInfoWithFallback( + hookMap, + members.length === 0 ? exprName.rootInfo : exprName.name, + fallback && + (name => fallback(name, exprName.rootInfo, exprName.getMembers)), + defined && (() => defined(exprName.name)), + ...args + ); + } + } - // potential optional import candidates - /** @type {Set} */ - const candidates = new Set(); + /** + * @template T + * @template R + * @param {HookMap>} hookMap hooks the should be called + * @param {string} name key in map + * @param {AsArray} args args for the hook + * @returns {R} result of hook + */ + callHooksForName(hookMap, name, ...args) { + return this.callHooksForNameWithFallback( + hookMap, + name, + undefined, + undefined, + ...args + ); + } - // try to add all imports - for (const imp of this._getImports( - compilation, - currentRoot, - activeRuntime - )) { - candidates.add(imp); - } + /** + * @template T + * @template R + * @param {HookMap>} hookMap hooks that should be called + * @param {ExportedVariableInfo} info variable info + * @param {AsArray} args args for the hook + * @returns {R} result of hook + */ + callHooksForInfo(hookMap, info, ...args) { + return this.callHooksForInfoWithFallback( + hookMap, + info, + undefined, + undefined, + ...args + ); + } - for (const imp of candidates) { - const impCandidates = new Set(); - const problem = this._tryToAdd( - compilation, - currentConfiguration, - imp, - chunkRuntime, - activeRuntime, - possibleInners, - impCandidates, - failureCache, - chunkGraph, - true, - stats - ); - if (problem) { - failureCache.set(imp, problem); - currentConfiguration.addWarning(imp, problem); - } else { - for (const c of impCandidates) { - candidates.add(c); - } - } - } - statsCandidates += candidates.size; - if (!currentConfiguration.isEmpty()) { - const modules = currentConfiguration.getModules(); - statsSizeSum += modules.size; - concatConfigurations.push(currentConfiguration); - for (const module of modules) { - if (module !== currentConfiguration.rootModule) { - usedAsInner.add(module); - } - } - } else { - statsEmptyConfigurations++; - const optimizationBailouts = - moduleGraph.getOptimizationBailout(currentRoot); - for (const warning of currentConfiguration.getWarningsSorted()) { - optimizationBailouts.push( - formatBailoutWarning(warning[0], warning[1]) - ); - } - } - } - logger.timeEnd("find modules to concatenate"); - logger.debug( - `${ - concatConfigurations.length - } successful concat configurations (avg size: ${ - statsSizeSum / concatConfigurations.length - }), ${statsEmptyConfigurations} bailed out completely` - ); - logger.debug( - `${statsCandidates} candidates were considered for adding (${stats.cached} cached failure, ${stats.alreadyInConfig} already in config, ${stats.invalidModule} invalid module, ${stats.incorrectChunks} incorrect chunks, ${stats.incorrectDependency} incorrect dependency, ${stats.incorrectChunksOfImporter} incorrect chunks of importer, ${stats.incorrectModuleDependency} incorrect module dependency, ${stats.incorrectRuntimeCondition} incorrect runtime condition, ${stats.importerFailed} importer failed, ${stats.added} added)` - ); - // HACK: Sort configurations by length and start with the longest one - // to get the biggest groups possible. Used modules are marked with usedModules - // TODO: Allow to reuse existing configuration while trying to add dependencies. - // This would improve performance. O(n^2) -> O(n) - logger.time(`sort concat configurations`); - concatConfigurations.sort((a, b) => { - return b.modules.size - a.modules.size; - }); - logger.timeEnd(`sort concat configurations`); - const usedModules = new Set(); + /** + * @template T + * @template R + * @param {HookMap>} hookMap hooks the should be called + * @param {ExportedVariableInfo} info variable info + * @param {function(string): any} fallback callback when variable in not handled by hooks + * @param {function(): any} defined callback when variable is defined + * @param {AsArray} args args for the hook + * @returns {R} result of hook + */ + callHooksForInfoWithFallback(hookMap, info, fallback, defined, ...args) { + let name; + if (typeof info === "string") { + name = info; + } else { + if (!(info instanceof VariableInfo)) { + if (defined !== undefined) { + return defined(); + } + return; + } + let tagInfo = info.tagInfo; + while (tagInfo !== undefined) { + const hook = hookMap.get(tagInfo.tag); + if (hook !== undefined) { + this.currentTagData = tagInfo.data; + const result = hook.call(...args); + this.currentTagData = undefined; + if (result !== undefined) return result; + } + tagInfo = tagInfo.next; + } + if (info.freeName === true) { + if (defined !== undefined) { + return defined(); + } + return; + } + name = info.freeName; + } + const hook = hookMap.get(name); + if (hook !== undefined) { + const result = hook.call(...args); + if (result !== undefined) return result; + } + if (fallback !== undefined) { + return fallback(name); + } + } - logger.time("create concatenated modules"); - asyncLib.each( - concatConfigurations, - (concatConfiguration, callback) => { - const rootModule = concatConfiguration.rootModule; + /** + * @template T + * @template R + * @param {HookMap>} hookMap hooks the should be called + * @param {string} name key in map + * @param {function(string): any} fallback callback when variable in not handled by hooks + * @param {function(): any} defined callback when variable is defined + * @param {AsArray} args args for the hook + * @returns {R} result of hook + */ + callHooksForNameWithFallback(hookMap, name, fallback, defined, ...args) { + return this.callHooksForInfoWithFallback( + hookMap, + this.getVariableInfo(name), + fallback, + defined, + ...args + ); + } - // Avoid overlapping configurations - // TODO: remove this when todo above is fixed - if (usedModules.has(rootModule)) return callback(); - const modules = concatConfiguration.getModules(); - for (const m of modules) { - usedModules.add(m); - } + /** + * @deprecated + * @param {any} params scope params + * @param {function(): void} fn inner function + * @returns {void} + */ + inScope(params, fn) { + const oldScope = this.scope; + this.scope = { + topLevelScope: oldScope.topLevelScope, + inTry: false, + inShorthand: false, + isStrict: oldScope.isStrict, + isAsmJs: oldScope.isAsmJs, + definitions: oldScope.definitions.createChild() + }; - // Create a new ConcatenatedModule - let newModule = ConcatenatedModule.create( - rootModule, - modules, - concatConfiguration.runtime, - compiler.root, - compilation.outputOptions.hashFunction - ); + this.undefineVariable("this"); - const build = () => { - newModule.build( - compiler.options, - compilation, - null, - null, - err => { - if (err) { - if (!err.module) { - err.module = newModule; - } - return callback(err); - } - integrate(); - } - ); - }; + this.enterPatterns(params, (ident, pattern) => { + this.defineVariable(ident); + }); - const integrate = () => { - if (backCompat) { - ChunkGraph.setChunkGraphForModule(newModule, chunkGraph); - ModuleGraph.setModuleGraphForModule(newModule, moduleGraph); - } + fn(); - for (const warning of concatConfiguration.getWarningsSorted()) { - moduleGraph - .getOptimizationBailout(newModule) - .push(formatBailoutWarning(warning[0], warning[1])); - } - moduleGraph.cloneModuleAttributes(rootModule, newModule); - for (const m of modules) { - // add to builtModules when one of the included modules was built - if (compilation.builtModules.has(m)) { - compilation.builtModules.add(newModule); - } - if (m !== rootModule) { - // attach external references to the concatenated module too - moduleGraph.copyOutgoingModuleConnections( - m, - newModule, - c => { - return ( - c.originModule === m && - !( - c.dependency instanceof HarmonyImportDependency && - modules.has(c.module) - ) - ); - } - ); - // remove module from chunk - for (const chunk of chunkGraph.getModuleChunksIterable( - rootModule - )) { - chunkGraph.disconnectChunkAndModule(chunk, m); - } - } - } - compilation.modules.delete(rootModule); - ChunkGraph.clearChunkGraphForModule(rootModule); - ModuleGraph.clearModuleGraphForModule(rootModule); + this.scope = oldScope; + } - // remove module from chunk - chunkGraph.replaceModule(rootModule, newModule); - // replace module references with the concatenated module - moduleGraph.moveModuleConnections(rootModule, newModule, c => { - const otherModule = - c.module === rootModule ? c.originModule : c.module; - const innerConnection = - c.dependency instanceof HarmonyImportDependency && - modules.has(otherModule); - return !innerConnection; - }); - // add concatenated module to the compilation - compilation.modules.add(newModule); + inFunctionScope(hasThis, params, fn) { + const oldScope = this.scope; + this.scope = { + topLevelScope: oldScope.topLevelScope, + inTry: false, + inShorthand: false, + isStrict: oldScope.isStrict, + isAsmJs: oldScope.isAsmJs, + definitions: oldScope.definitions.createChild() + }; - callback(); - }; + if (hasThis) { + this.undefineVariable("this"); + } - build(); - }, - err => { - logger.timeEnd("create concatenated modules"); - process.nextTick(callback.bind(null, err)); - } - ); - } - ); + this.enterPatterns(params, (ident, pattern) => { + this.defineVariable(ident); }); + + fn(); + + this.scope = oldScope; } - /** - * @param {Compilation} compilation the compilation - * @param {Module} module the module to be added - * @param {RuntimeSpec} runtime the runtime scope - * @returns {Set} the imported modules - */ - _getImports(compilation, module, runtime) { - const moduleGraph = compilation.moduleGraph; - const set = new Set(); - for (const dep of module.dependencies) { - // Get reference info only for harmony Dependencies - if (!(dep instanceof HarmonyImportDependency)) continue; + inBlockScope(fn) { + const oldScope = this.scope; + this.scope = { + topLevelScope: oldScope.topLevelScope, + inTry: oldScope.inTry, + inShorthand: false, + isStrict: oldScope.isStrict, + isAsmJs: oldScope.isAsmJs, + definitions: oldScope.definitions.createChild() + }; - const connection = moduleGraph.getConnection(dep); - // Reference is valid and has a module - if ( - !connection || - !connection.module || - !connection.isTargetActive(runtime) - ) { - continue; - } + fn(); - const importedNames = compilation.getDependencyReferencedExports( - dep, - undefined - ); + this.scope = oldScope; + } - if ( - importedNames.every(i => - Array.isArray(i) ? i.length > 0 : i.name.length > 0 - ) || - Array.isArray(moduleGraph.getProvidedExports(module)) - ) { - set.add(connection.module); + detectMode(statements) { + const isLiteral = + statements.length >= 1 && + statements[0].type === "ExpressionStatement" && + statements[0].expression.type === "Literal"; + if (isLiteral && statements[0].expression.value === "use strict") { + this.scope.isStrict = true; + } + if (isLiteral && statements[0].expression.value === "use asm") { + this.scope.isAsmJs = true; + } + } + + enterPatterns(patterns, onIdent) { + for (const pattern of patterns) { + if (typeof pattern !== "string") { + this.enterPattern(pattern, onIdent); + } else if (pattern) { + onIdent(pattern); } } - return set; } - /** - * @param {Compilation} compilation webpack compilation - * @param {ConcatConfiguration} config concat configuration (will be modified when added) - * @param {Module} module the module to be added - * @param {RuntimeSpec} runtime the runtime scope of the generated code - * @param {RuntimeSpec} activeRuntime the runtime scope of the root module - * @param {Set} possibleModules modules that are candidates - * @param {Set} candidates list of potential candidates (will be added to) - * @param {Map} failureCache cache for problematic modules to be more performant - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {boolean} avoidMutateOnFailure avoid mutating the config when adding fails - * @param {Statistics} statistics gathering metrics - * @returns {Module | function(RequestShortener): string} the problematic module - */ - _tryToAdd( - compilation, - config, - module, - runtime, - activeRuntime, - possibleModules, - candidates, - failureCache, - chunkGraph, - avoidMutateOnFailure, - statistics - ) { - const cacheEntry = failureCache.get(module); - if (cacheEntry) { - statistics.cached++; - return cacheEntry; + enterPattern(pattern, onIdent) { + if (!pattern) return; + switch (pattern.type) { + case "ArrayPattern": + this.enterArrayPattern(pattern, onIdent); + break; + case "AssignmentPattern": + this.enterAssignmentPattern(pattern, onIdent); + break; + case "Identifier": + this.enterIdentifier(pattern, onIdent); + break; + case "ObjectPattern": + this.enterObjectPattern(pattern, onIdent); + break; + case "RestElement": + this.enterRestElement(pattern, onIdent); + break; + case "Property": + if (pattern.shorthand && pattern.value.type === "Identifier") { + this.scope.inShorthand = pattern.value.name; + this.enterIdentifier(pattern.value, onIdent); + this.scope.inShorthand = false; + } else { + this.enterPattern(pattern.value, onIdent); + } + break; } + } - // Already added? - if (config.has(module)) { - statistics.alreadyInConfig++; - return null; + enterIdentifier(pattern, onIdent) { + if (!this.callHooksForName(this.hooks.pattern, pattern.name, pattern)) { + onIdent(pattern.name, pattern); } + } - // Not possible to add? - if (!possibleModules.has(module)) { - statistics.invalidModule++; - failureCache.set(module, module); // cache failures for performance - return module; + enterObjectPattern(pattern, onIdent) { + for ( + let propIndex = 0, len = pattern.properties.length; + propIndex < len; + propIndex++ + ) { + const prop = pattern.properties[propIndex]; + this.enterPattern(prop, onIdent); } + } - // Module must be in the correct chunks - const missingChunks = Array.from( - chunkGraph.getModuleChunksIterable(config.rootModule) - ).filter(chunk => !chunkGraph.isModuleInChunk(module, chunk)); - if (missingChunks.length > 0) { - const problem = requestShortener => { - const missingChunksList = Array.from( - new Set(missingChunks.map(chunk => chunk.name || "unnamed chunk(s)")) - ).sort(); - const chunks = Array.from( - new Set( - Array.from(chunkGraph.getModuleChunksIterable(module)).map( - chunk => chunk.name || "unnamed chunk(s)" - ) - ) - ).sort(); - return `Module ${module.readableIdentifier( - requestShortener - )} is not in the same chunk(s) (expected in chunk(s) ${missingChunksList.join( - ", " - )}, module is in chunk(s) ${chunks.join(", ")})`; - }; - statistics.incorrectChunks++; - failureCache.set(module, problem); // cache failures for performance - return problem; + enterArrayPattern(pattern, onIdent) { + for ( + let elementIndex = 0, len = pattern.elements.length; + elementIndex < len; + elementIndex++ + ) { + const element = pattern.elements[elementIndex]; + this.enterPattern(element, onIdent); } + } - const moduleGraph = compilation.moduleGraph; + enterRestElement(pattern, onIdent) { + this.enterPattern(pattern.argument, onIdent); + } - const incomingConnections = - moduleGraph.getIncomingConnectionsByOriginModule(module); + enterAssignmentPattern(pattern, onIdent) { + this.enterPattern(pattern.left, onIdent); + } - const incomingConnectionsFromNonModules = - incomingConnections.get(null) || incomingConnections.get(undefined); - if (incomingConnectionsFromNonModules) { - const activeNonModulesConnections = - incomingConnectionsFromNonModules.filter(connection => { - // We are not interested in inactive connections - // or connections without dependency - return connection.isActive(runtime) || connection.dependency; - }); - if (activeNonModulesConnections.length > 0) { - const problem = requestShortener => { - const importingExplanations = new Set( - activeNonModulesConnections.map(c => c.explanation).filter(Boolean) + /** + * @param {ExpressionNode} expression expression node + * @returns {BasicEvaluatedExpression | undefined} evaluation result + */ + evaluateExpression(expression) { + try { + const hook = this.hooks.evaluate.get(expression.type); + if (hook !== undefined) { + const result = hook.call(expression); + if (result !== undefined) { + if (result) { + result.setExpression(expression); + } + return result; + } + } + } catch (e) { + console.warn(e); + // ignore error + } + return new BasicEvaluatedExpression() + .setRange(expression.range) + .setExpression(expression); + } + + parseString(expression) { + switch (expression.type) { + case "BinaryExpression": + if (expression.operator === "+") { + return ( + this.parseString(expression.left) + + this.parseString(expression.right) ); - const explanations = Array.from(importingExplanations).sort(); - return `Module ${module.readableIdentifier( - requestShortener - )} is referenced ${ - explanations.length > 0 - ? `by: ${explanations.join(", ")}` - : "in an unsupported way" - }`; + } + break; + case "Literal": + return expression.value + ""; + } + throw new Error( + expression.type + " is not supported as parameter for require" + ); + } + + parseCalculatedString(expression) { + switch (expression.type) { + case "BinaryExpression": + if (expression.operator === "+") { + const left = this.parseCalculatedString(expression.left); + const right = this.parseCalculatedString(expression.right); + if (left.code) { + return { + range: left.range, + value: left.value, + code: true, + conditional: false + }; + } else if (right.code) { + return { + range: [ + left.range[0], + right.range ? right.range[1] : left.range[1] + ], + value: left.value + right.value, + code: true, + conditional: false + }; + } else { + return { + range: [left.range[0], right.range[1]], + value: left.value + right.value, + code: false, + conditional: false + }; + } + } + break; + case "ConditionalExpression": { + const consequent = this.parseCalculatedString(expression.consequent); + const alternate = this.parseCalculatedString(expression.alternate); + const items = []; + if (consequent.conditional) { + items.push(...consequent.conditional); + } else if (!consequent.code) { + items.push(consequent); + } else { + break; + } + if (alternate.conditional) { + items.push(...alternate.conditional); + } else if (!alternate.code) { + items.push(alternate); + } else { + break; + } + return { + range: undefined, + value: "", + code: true, + conditional: items }; - statistics.incorrectDependency++; - failureCache.set(module, problem); // cache failures for performance - return problem; } + case "Literal": + return { + range: expression.range, + value: expression.value + "", + code: false, + conditional: false + }; + } + return { + range: undefined, + value: "", + code: true, + conditional: false + }; + } + + /** + * @param {string | Buffer | PreparsedAst} source the source to parse + * @param {ParserState} state the parser state + * @returns {ParserState} the parser state + */ + parse(source, state) { + let ast; + let comments; + const semicolons = new Set(); + if (source === null) { + throw new Error("source must not be null"); + } + if (Buffer.isBuffer(source)) { + source = source.toString("utf-8"); + } + if (typeof source === "object") { + ast = /** @type {ProgramNode} */ (source); + comments = source.comments; + } else { + comments = []; + ast = JavascriptParser._parse(source, { + sourceType: this.sourceType, + onComment: comments, + onInsertedSemicolon: pos => semicolons.add(pos) + }); + } + + const oldScope = this.scope; + const oldState = this.state; + const oldComments = this.comments; + const oldSemicolons = this.semicolons; + const oldStatementPath = this.statementPath; + const oldPrevStatement = this.prevStatement; + this.scope = { + topLevelScope: true, + inTry: false, + inShorthand: false, + isStrict: false, + isAsmJs: false, + definitions: new StackedMap() + }; + /** @type {ParserState} */ + this.state = state; + this.comments = comments; + this.semicolons = semicolons; + this.statementPath = []; + this.prevStatement = undefined; + if (this.hooks.program.call(ast, comments) === undefined) { + this.detectMode(ast.body); + this.preWalkStatements(ast.body); + this.prevStatement = undefined; + this.blockPreWalkStatements(ast.body); + this.prevStatement = undefined; + this.walkStatements(ast.body); } + this.hooks.finish.call(ast, comments); + this.scope = oldScope; + /** @type {ParserState} */ + this.state = oldState; + this.comments = oldComments; + this.semicolons = oldSemicolons; + this.statementPath = oldStatementPath; + this.prevStatement = oldPrevStatement; + return state; + } - /** @type {Map} */ - const incomingConnectionsFromModules = new Map(); - for (const [originModule, connections] of incomingConnections) { - if (originModule) { - // Ignore connection from orphan modules - if (chunkGraph.getNumberOfModuleChunks(originModule) === 0) continue; + evaluate(source) { + const ast = JavascriptParser._parse("(" + source + ")", { + sourceType: this.sourceType, + locations: false + }); + if (ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement") { + throw new Error("evaluate: Source is not a expression"); + } + return this.evaluateExpression(ast.body[0].expression); + } - // We don't care for connections from other runtimes - let originRuntime = undefined; - for (const r of chunkGraph.getModuleRuntimes(originModule)) { - originRuntime = mergeRuntimeOwned(originRuntime, r); + /** + * @param {ExpressionNode | DeclarationNode | PrivateIdentifierNode | null | undefined} expr an expression + * @param {number} commentsStartPos source position from which annotation comments are checked + * @returns {boolean} true, when the expression is pure + */ + isPure(expr, commentsStartPos) { + if (!expr) return true; + const result = this.hooks.isPure + .for(expr.type) + .call(expr, commentsStartPos); + if (typeof result === "boolean") return result; + switch (expr.type) { + case "ClassDeclaration": + case "ClassExpression": { + if (expr.body.type !== "ClassBody") return false; + if (expr.superClass && !this.isPure(expr.superClass, expr.range[0])) { + return false; } + const items = + /** @type {(MethodDefinitionNode | PropertyDefinitionNode)[]} */ ( + expr.body.body + ); + return items.every( + item => + (!item.computed || + !item.key || + this.isPure(item.key, item.range[0])) && + (!item.static || + !item.value || + this.isPure( + item.value, + item.key ? item.key.range[1] : item.range[0] + )) + ); + } - if (!intersectRuntime(runtime, originRuntime)) continue; + case "FunctionDeclaration": + case "FunctionExpression": + case "ArrowFunctionExpression": + case "Literal": + case "PrivateIdentifier": + return true; - // We are not interested in inactive connections - const activeConnections = connections.filter(connection => - connection.isActive(runtime) + case "VariableDeclaration": + return expr.declarations.every(decl => + this.isPure(decl.init, decl.range[0]) ); - if (activeConnections.length > 0) - incomingConnectionsFromModules.set(originModule, activeConnections); - } - } - const incomingModules = Array.from(incomingConnectionsFromModules.keys()); + case "ConditionalExpression": + return ( + this.isPure(expr.test, commentsStartPos) && + this.isPure(expr.consequent, expr.test.range[1]) && + this.isPure(expr.alternate, expr.consequent.range[1]) + ); - // Module must be in the same chunks like the referencing module - const otherChunkModules = incomingModules.filter(originModule => { - for (const chunk of chunkGraph.getModuleChunksIterable( - config.rootModule - )) { - if (!chunkGraph.isModuleInChunk(originModule, chunk)) { - return true; - } + case "SequenceExpression": + return expr.expressions.every(expr => { + const pureFlag = this.isPure(expr, commentsStartPos); + commentsStartPos = expr.range[1]; + return pureFlag; + }); + + case "CallExpression": { + const pureFlag = + expr.range[0] - commentsStartPos > 12 && + this.getComments([commentsStartPos, expr.range[0]]).some( + comment => + comment.type === "Block" && + /^\s*(#|@)__PURE__\s*$/.test(comment.value) + ); + if (!pureFlag) return false; + commentsStartPos = expr.callee.range[1]; + return expr.arguments.every(arg => { + if (arg.type === "SpreadElement") return false; + const pureFlag = this.isPure(arg, commentsStartPos); + commentsStartPos = arg.range[1]; + return pureFlag; + }); } - return false; - }); - if (otherChunkModules.length > 0) { - const problem = requestShortener => { - const names = otherChunkModules - .map(m => m.readableIdentifier(requestShortener)) - .sort(); - return `Module ${module.readableIdentifier( - requestShortener - )} is referenced from different chunks by these modules: ${names.join( - ", " - )}`; - }; - statistics.incorrectChunksOfImporter++; - failureCache.set(module, problem); // cache failures for performance - return problem; } + const evaluated = this.evaluateExpression(expr); + return !evaluated.couldHaveSideEffects(); + } - /** @type {Map} */ - const nonHarmonyConnections = new Map(); - for (const [originModule, connections] of incomingConnectionsFromModules) { - const selected = connections.filter( - connection => - !connection.dependency || - !(connection.dependency instanceof HarmonyImportDependency) - ); - if (selected.length > 0) - nonHarmonyConnections.set(originModule, connections); - } - if (nonHarmonyConnections.size > 0) { - const problem = requestShortener => { - const names = Array.from(nonHarmonyConnections) - .map(([originModule, connections]) => { - return `${originModule.readableIdentifier( - requestShortener - )} (referenced with ${Array.from( - new Set( - connections - .map(c => c.dependency && c.dependency.type) - .filter(Boolean) - ) - ) - .sort() - .join(", ")})`; - }) - .sort(); - return `Module ${module.readableIdentifier( - requestShortener - )} is referenced from these modules with unsupported syntax: ${names.join( - ", " - )}`; - }; - statistics.incorrectModuleDependency++; - failureCache.set(module, problem); // cache failures for performance - return problem; + getComments(range) { + const [rangeStart, rangeEnd] = range; + const compare = (comment, needle) => comment.range[0] - needle; + let idx = binarySearchBounds.ge(this.comments, rangeStart, compare); + let commentsInRange = []; + while (this.comments[idx] && this.comments[idx].range[1] <= rangeEnd) { + commentsInRange.push(this.comments[idx]); + idx++; } - if (runtime !== undefined && typeof runtime !== "string") { - // Module must be consistently referenced in the same runtimes - /** @type {{ originModule: Module, runtimeCondition: RuntimeSpec }[]} */ - const otherRuntimeConnections = []; - outer: for (const [ - originModule, - connections - ] of incomingConnectionsFromModules) { - /** @type {false | RuntimeSpec} */ - let currentRuntimeCondition = false; - for (const connection of connections) { - const runtimeCondition = filterRuntime(runtime, runtime => { - return connection.isTargetActive(runtime); - }); - if (runtimeCondition === false) continue; - if (runtimeCondition === true) continue outer; - if (currentRuntimeCondition !== false) { - currentRuntimeCondition = mergeRuntime( - currentRuntimeCondition, - runtimeCondition - ); - } else { - currentRuntimeCondition = runtimeCondition; - } - } - if (currentRuntimeCondition !== false) { - otherRuntimeConnections.push({ - originModule, - runtimeCondition: currentRuntimeCondition - }); - } - } - if (otherRuntimeConnections.length > 0) { - const problem = requestShortener => { - return `Module ${module.readableIdentifier( - requestShortener - )} is runtime-dependent referenced by these modules: ${Array.from( - otherRuntimeConnections, - ({ originModule, runtimeCondition }) => - `${originModule.readableIdentifier( - requestShortener - )} (expected runtime ${runtimeToString( - runtime - )}, module is only referenced in ${runtimeToString( - /** @type {RuntimeSpec} */ (runtimeCondition) - )})` - ).join(", ")}`; - }; - statistics.incorrectRuntimeCondition++; - failureCache.set(module, problem); // cache failures for performance - return problem; + return commentsInRange; + } + + /** + * @param {number} pos source code position + * @returns {boolean} true when a semicolon has been inserted before this position, false if not + */ + isAsiPosition(pos) { + const currentStatement = this.statementPath[this.statementPath.length - 1]; + if (currentStatement === undefined) throw new Error("Not in statement"); + return ( + // Either asking directly for the end position of the current statement + (currentStatement.range[1] === pos && this.semicolons.has(pos)) || + // Or asking for the start position of the current statement, + // here we have to check multiple things + (currentStatement.range[0] === pos && + // is there a previous statement which might be relevant? + this.prevStatement !== undefined && + // is the end position of the previous statement an ASI position? + this.semicolons.has(this.prevStatement.range[1])) + ); + } + + /** + * @param {number} pos source code position + * @returns {void} + */ + unsetAsiPosition(pos) { + this.semicolons.delete(pos); + } + + isStatementLevelExpression(expr) { + const currentStatement = this.statementPath[this.statementPath.length - 1]; + return ( + expr === currentStatement || + (currentStatement.type === "ExpressionStatement" && + currentStatement.expression === expr) + ); + } + + getTagData(name, tag) { + const info = this.scope.definitions.get(name); + if (info instanceof VariableInfo) { + let tagInfo = info.tagInfo; + while (tagInfo !== undefined) { + if (tagInfo.tag === tag) return tagInfo.data; + tagInfo = tagInfo.next; } } + } - let backup; - if (avoidMutateOnFailure) { - backup = config.snapshot(); + tagVariable(name, tag, data) { + const oldInfo = this.scope.definitions.get(name); + /** @type {VariableInfo} */ + let newInfo; + if (oldInfo === undefined) { + newInfo = new VariableInfo(this.scope, name, { + tag, + data, + next: undefined + }); + } else if (oldInfo instanceof VariableInfo) { + newInfo = new VariableInfo(oldInfo.declaredScope, oldInfo.freeName, { + tag, + data, + next: oldInfo.tagInfo + }); + } else { + newInfo = new VariableInfo(oldInfo, true, { + tag, + data, + next: undefined + }); } + this.scope.definitions.set(name, newInfo); + } - // Add the module - config.add(module); + defineVariable(name) { + const oldInfo = this.scope.definitions.get(name); + // Don't redefine variable in same scope to keep existing tags + if (oldInfo instanceof VariableInfo && oldInfo.declaredScope === this.scope) + return; + this.scope.definitions.set(name, this.scope); + } - incomingModules.sort(compareModulesByIdentifier); + undefineVariable(name) { + this.scope.definitions.delete(name); + } - // Every module which depends on the added module must be in the configuration too. - for (const originModule of incomingModules) { - const problem = this._tryToAdd( - compilation, - config, - originModule, - runtime, - activeRuntime, - possibleModules, - candidates, - failureCache, - chunkGraph, - false, - statistics - ); - if (problem) { - if (backup !== undefined) config.rollback(backup); - statistics.importerFailed++; - failureCache.set(module, problem); // cache failures for performance - return problem; - } + isVariableDefined(name) { + const info = this.scope.definitions.get(name); + if (info === undefined) return false; + if (info instanceof VariableInfo) { + return info.freeName === true; } + return true; + } - // Add imports to possible candidates list - for (const imp of this._getImports(compilation, module, runtime)) { - candidates.add(imp); + /** + * @param {string} name variable name + * @returns {ExportedVariableInfo} info for this variable + */ + getVariableInfo(name) { + const value = this.scope.definitions.get(name); + if (value === undefined) { + return name; + } else { + return value; } - statistics.added++; - return null; } -} -class ConcatConfiguration { /** - * @param {Module} rootModule the root module - * @param {RuntimeSpec} runtime the runtime + * @param {string} name variable name + * @param {ExportedVariableInfo} variableInfo new info for this variable + * @returns {void} */ - constructor(rootModule, runtime) { - this.rootModule = rootModule; - this.runtime = runtime; - /** @type {Set} */ - this.modules = new Set(); - this.modules.add(rootModule); - /** @type {Map} */ - this.warnings = new Map(); + setVariable(name, variableInfo) { + if (typeof variableInfo === "string") { + if (variableInfo === name) { + this.scope.definitions.delete(name); + } else { + this.scope.definitions.set( + name, + new VariableInfo(this.scope, variableInfo, undefined) + ); + } + } else { + this.scope.definitions.set(name, variableInfo); + } } - add(module) { - this.modules.add(module); + parseCommentOptions(range) { + const comments = this.getComments(range); + if (comments.length === 0) { + return EMPTY_COMMENT_OPTIONS; + } + let options = {}; + let errors = []; + for (const comment of comments) { + const { value } = comment; + if (value && webpackCommentRegExp.test(value)) { + // try compile only if webpack options comment is present + try { + const val = vm.runInNewContext(`(function(){return {${value}};})()`); + Object.assign(options, val); + } catch (e) { + e.comment = comment; + errors.push(e); + } + } + } + return { options, errors }; } - has(module) { - return this.modules.has(module); + /** + * @param {MemberExpressionNode} expression a member expression + * @returns {{ members: string[], object: ExpressionNode | SuperNode }} member names (reverse order) and remaining object + */ + extractMemberExpressionChain(expression) { + /** @type {AnyNode} */ + let expr = expression; + const members = []; + while (expr.type === "MemberExpression") { + if (expr.computed) { + if (expr.property.type !== "Literal") break; + members.push(`${expr.property.value}`); + } else { + if (expr.property.type !== "Identifier") break; + members.push(expr.property.name); + } + expr = expr.object; + } + return { + members, + object: expr + }; } - isEmpty() { - return this.modules.size === 1; + /** + * @param {string} varName variable name + * @returns {{name: string, info: VariableInfo | string}} name of the free variable and variable info for that + */ + getFreeInfoFromVariable(varName) { + const info = this.getVariableInfo(varName); + let name; + if (info instanceof VariableInfo) { + name = info.freeName; + if (typeof name !== "string") return undefined; + } else if (typeof info !== "string") { + return undefined; + } else { + name = info; + } + return { info, name }; } - addWarning(module, problem) { - this.warnings.set(module, problem); - } + /** @typedef {{ type: "call", call: CallExpressionNode, calleeName: string, rootInfo: string | VariableInfo, getCalleeMembers: () => string[], name: string, getMembers: () => string[]}} CallExpressionInfo */ + /** @typedef {{ type: "expression", rootInfo: string | VariableInfo, name: string, getMembers: () => string[]}} ExpressionExpressionInfo */ - getWarningsSorted() { - return new Map( - Array.from(this.warnings).sort((a, b) => { - const ai = a[0].identifier(); - const bi = b[0].identifier(); - if (ai < bi) return -1; - if (ai > bi) return 1; - return 0; - }) - ); + /** + * @param {MemberExpressionNode} expression a member expression + * @param {number} allowedTypes which types should be returned, presented in bit mask + * @returns {CallExpressionInfo | ExpressionExpressionInfo | undefined} expression info + */ + getMemberExpressionInfo(expression, allowedTypes) { + const { object, members } = this.extractMemberExpressionChain(expression); + switch (object.type) { + case "CallExpression": { + if ((allowedTypes & ALLOWED_MEMBER_TYPES_CALL_EXPRESSION) === 0) + return undefined; + let callee = object.callee; + let rootMembers = EMPTY_ARRAY; + if (callee.type === "MemberExpression") { + ({ object: callee, members: rootMembers } = + this.extractMemberExpressionChain(callee)); + } + const rootName = getRootName(callee); + if (!rootName) return undefined; + const result = this.getFreeInfoFromVariable(rootName); + if (!result) return undefined; + const { info: rootInfo, name: resolvedRoot } = result; + const calleeName = objectAndMembersToName(resolvedRoot, rootMembers); + return { + type: "call", + call: object, + calleeName, + rootInfo, + getCalleeMembers: memoize(() => rootMembers.reverse()), + name: objectAndMembersToName(`${calleeName}()`, members), + getMembers: memoize(() => members.reverse()) + }; + } + case "Identifier": + case "MetaProperty": + case "ThisExpression": { + if ((allowedTypes & ALLOWED_MEMBER_TYPES_EXPRESSION) === 0) + return undefined; + const rootName = getRootName(object); + if (!rootName) return undefined; + + const result = this.getFreeInfoFromVariable(rootName); + if (!result) return undefined; + const { info: rootInfo, name: resolvedRoot } = result; + return { + type: "expression", + name: objectAndMembersToName(resolvedRoot, members), + rootInfo, + getMembers: memoize(() => members.reverse()) + }; + } + } } /** - * @returns {Set} modules as set + * @param {MemberExpressionNode} expression an expression + * @returns {{ name: string, rootInfo: ExportedVariableInfo, getMembers: () => string[]}} name info */ - getModules() { - return this.modules; + getNameForExpression(expression) { + return this.getMemberExpressionInfo( + expression, + ALLOWED_MEMBER_TYPES_EXPRESSION + ); } - snapshot() { - return this.modules.size; - } + /** + * @param {string} code source code + * @param {ParseOptions} options parsing options + * @returns {ProgramNode} parsed ast + */ + static _parse(code, options) { + const type = options ? options.sourceType : "module"; + /** @type {AcornOptions} */ + const parserOptions = { + ...defaultParserOptions, + allowReturnOutsideFunction: type === "script", + ...options, + sourceType: type === "auto" ? "module" : type + }; - rollback(snapshot) { - const modules = this.modules; - for (const m of modules) { - if (snapshot === 0) { - modules.delete(m); - } else { - snapshot--; + /** @type {AnyNode} */ + let ast; + let error; + let threw = false; + try { + ast = /** @type {AnyNode} */ (parser.parse(code, parserOptions)); + } catch (e) { + error = e; + threw = true; + } + + if (threw && type === "auto") { + parserOptions.sourceType = "script"; + if (!("allowReturnOutsideFunction" in options)) { + parserOptions.allowReturnOutsideFunction = true; + } + if (Array.isArray(parserOptions.onComment)) { + parserOptions.onComment.length = 0; + } + try { + ast = /** @type {AnyNode} */ (parser.parse(code, parserOptions)); + threw = false; + } catch (e) { + // we use the error from first parse try + // so nothing to do here } } + + if (threw) { + throw error; + } + + return /** @type {ProgramNode} */ (ast); } } -module.exports = ModuleConcatenationPlugin; +module.exports = JavascriptParser; +module.exports.ALLOWED_MEMBER_TYPES_ALL = ALLOWED_MEMBER_TYPES_ALL; +module.exports.ALLOWED_MEMBER_TYPES_EXPRESSION = + ALLOWED_MEMBER_TYPES_EXPRESSION; +module.exports.ALLOWED_MEMBER_TYPES_CALL_EXPRESSION = + ALLOWED_MEMBER_TYPES_CALL_EXPRESSION; /***/ }), -/***/ 46043: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 93998: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -104392,412 +102182,251 @@ module.exports = ModuleConcatenationPlugin; -const { SyncBailHook } = __webpack_require__(6967); -const { RawSource, CachedSource, CompatSource } = __webpack_require__(51255); -const Compilation = __webpack_require__(85720); -const WebpackError = __webpack_require__(53799); -const { compareSelect, compareStrings } = __webpack_require__(29579); -const createHash = __webpack_require__(49835); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("../Compiler")} Compiler */ - -const EMPTY_SET = new Set(); +const UnsupportedFeatureWarning = __webpack_require__(42495); +const ConstDependency = __webpack_require__(76911); +const BasicEvaluatedExpression = __webpack_require__(950); -const addToList = (itemOrItems, list) => { - if (Array.isArray(itemOrItems)) { - for (const item of itemOrItems) { - list.add(item); - } - } else if (itemOrItems) { - list.add(itemOrItems); - } -}; +/** @typedef {import("estree").Expression} ExpressionNode */ +/** @typedef {import("estree").Node} Node */ +/** @typedef {import("./JavascriptParser")} JavascriptParser */ /** - * @template T - * @param {T[]} input list - * @param {function(T): Buffer} fn map function - * @returns {Buffer[]} buffers without duplicates + * @param {JavascriptParser} parser the parser + * @param {string} value the const value + * @param {string[]=} runtimeRequirements runtime requirements + * @returns {function(ExpressionNode): true} plugin function */ -const mapAndDeduplicateBuffers = (input, fn) => { - // Buffer.equals compares size first so this should be efficient enough - // If it becomes a performance problem we can use a map and group by size - // instead of looping over all assets. - const result = []; - outer: for (const value of input) { - const buf = fn(value); - for (const other of result) { - if (buf.equals(other)) continue outer; - } - result.push(buf); - } - return result; +exports.toConstantDependency = (parser, value, runtimeRequirements) => { + return function constDependency(expr) { + const dep = new ConstDependency(value, expr.range, runtimeRequirements); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }; }; /** - * Escapes regular expression metacharacters - * @param {string} str String to quote - * @returns {string} Escaped string + * @param {string} value the string value + * @returns {function(ExpressionNode): BasicEvaluatedExpression} plugin function */ -const quoteMeta = str => { - return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); +exports.evaluateToString = value => { + return function stringExpression(expr) { + return new BasicEvaluatedExpression().setString(value).setRange(expr.range); + }; }; -const cachedSourceMap = new WeakMap(); - -const toCachedSource = source => { - if (source instanceof CachedSource) { - return source; - } - const entry = cachedSourceMap.get(source); - if (entry !== undefined) return entry; - const newSource = new CachedSource(CompatSource.from(source)); - cachedSourceMap.set(source, newSource); - return newSource; +/** + * @param {number} value the number value + * @returns {function(ExpressionNode): BasicEvaluatedExpression} plugin function + */ +exports.evaluateToNumber = value => { + return function stringExpression(expr) { + return new BasicEvaluatedExpression().setNumber(value).setRange(expr.range); + }; }; /** - * @typedef {Object} AssetInfoForRealContentHash - * @property {string} name - * @property {AssetInfo} info - * @property {Source} source - * @property {RawSource | undefined} newSource - * @property {RawSource | undefined} newSourceWithoutOwn - * @property {string} content - * @property {Set} ownHashes - * @property {Promise} contentComputePromise - * @property {Promise} contentComputeWithoutOwnPromise - * @property {Set} referencedHashes - * @property {Set} hashes + * @param {boolean} value the boolean value + * @returns {function(ExpressionNode): BasicEvaluatedExpression} plugin function */ +exports.evaluateToBoolean = value => { + return function booleanExpression(expr) { + return new BasicEvaluatedExpression() + .setBoolean(value) + .setRange(expr.range); + }; +}; /** - * @typedef {Object} CompilationHooks - * @property {SyncBailHook<[Buffer[], string], string>} updateHash + * @param {string} identifier identifier + * @param {string} rootInfo rootInfo + * @param {function(): string[]} getMembers getMembers + * @param {boolean|null=} truthy is truthy, null if nullish + * @returns {function(ExpressionNode): BasicEvaluatedExpression} callback */ - -/** @type {WeakMap} */ -const compilationHooksMap = new WeakMap(); - -class RealContentHashPlugin { - /** - * @param {Compilation} compilation the compilation - * @returns {CompilationHooks} the attached hooks - */ - static getCompilationHooks(compilation) { - if (!(compilation instanceof Compilation)) { - throw new TypeError( - "The 'compilation' argument must be an instance of Compilation" - ); - } - let hooks = compilationHooksMap.get(compilation); - if (hooks === undefined) { - hooks = { - updateHash: new SyncBailHook(["content", "oldHash"]) - }; - compilationHooksMap.set(compilation, hooks); +exports.evaluateToIdentifier = (identifier, rootInfo, getMembers, truthy) => { + return function identifierExpression(expr) { + let evaluatedExpression = new BasicEvaluatedExpression() + .setIdentifier(identifier, rootInfo, getMembers) + .setSideEffects(false) + .setRange(expr.range); + switch (truthy) { + case true: + evaluatedExpression.setTruthy(); + break; + case null: + evaluatedExpression.setNullish(true); + break; + case false: + evaluatedExpression.setFalsy(); + break; } - return hooks; - } - constructor({ hashFunction, hashDigest }) { - this._hashFunction = hashFunction; - this._hashDigest = hashDigest; - } + return evaluatedExpression; + }; +}; - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap("RealContentHashPlugin", compilation => { - const cacheAnalyse = compilation.getCache( - "RealContentHashPlugin|analyse" - ); - const cacheGenerate = compilation.getCache( - "RealContentHashPlugin|generate" - ); - const hooks = RealContentHashPlugin.getCompilationHooks(compilation); - compilation.hooks.processAssets.tapPromise( - { - name: "RealContentHashPlugin", - stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH - }, - async () => { - const assets = compilation.getAssets(); - /** @type {AssetInfoForRealContentHash[]} */ - const assetsWithInfo = []; - const hashToAssets = new Map(); - for (const { source, info, name } of assets) { - const cachedSource = toCachedSource(source); - const content = cachedSource.source(); - /** @type {Set} */ - const hashes = new Set(); - addToList(info.contenthash, hashes); - const data = { - name, - info, - source: cachedSource, - /** @type {RawSource | undefined} */ - newSource: undefined, - /** @type {RawSource | undefined} */ - newSourceWithoutOwn: undefined, - content, - /** @type {Set} */ - ownHashes: undefined, - contentComputePromise: undefined, - contentComputeWithoutOwnPromise: undefined, - /** @type {Set} */ - referencedHashes: undefined, - hashes - }; - assetsWithInfo.push(data); - for (const hash of hashes) { - const list = hashToAssets.get(hash); - if (list === undefined) { - hashToAssets.set(hash, [data]); - } else { - list.push(data); - } - } - } - if (hashToAssets.size === 0) return; - const hashRegExp = new RegExp( - Array.from(hashToAssets.keys(), quoteMeta).join("|"), - "g" - ); - await Promise.all( - assetsWithInfo.map(async asset => { - const { name, source, content, hashes } = asset; - if (Buffer.isBuffer(content)) { - asset.referencedHashes = EMPTY_SET; - asset.ownHashes = EMPTY_SET; - return; - } - const etag = cacheAnalyse.mergeEtags( - cacheAnalyse.getLazyHashedEtag(source), - Array.from(hashes).join("|") - ); - [asset.referencedHashes, asset.ownHashes] = - await cacheAnalyse.providePromise(name, etag, () => { - const referencedHashes = new Set(); - let ownHashes = new Set(); - const inContent = content.match(hashRegExp); - if (inContent) { - for (const hash of inContent) { - if (hashes.has(hash)) { - ownHashes.add(hash); - continue; - } - referencedHashes.add(hash); - } - } - return [referencedHashes, ownHashes]; - }); - }) - ); - const getDependencies = hash => { - const assets = hashToAssets.get(hash); - if (!assets) { - const referencingAssets = assetsWithInfo.filter(asset => - asset.referencedHashes.has(hash) - ); - const err = new WebpackError(`RealContentHashPlugin -Some kind of unexpected caching problem occurred. -An asset was cached with a reference to another asset (${hash}) that's not in the compilation anymore. -Either the asset was incorrectly cached, or the referenced asset should also be restored from cache. -Referenced by: -${referencingAssets - .map(a => { - const match = new RegExp(`.{0,20}${quoteMeta(hash)}.{0,20}`).exec( - a.content +exports.expressionIsUnsupported = (parser, message) => { + return function unsupportedExpression(expr) { + const dep = new ConstDependency("(void 0)", expr.range, null); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + if (!parser.state.module) return; + parser.state.module.addWarning( + new UnsupportedFeatureWarning(message, expr.loc) ); - return ` - ${a.name}: ...${match ? match[0] : "???"}...`; - }) - .join("\n")}`); - compilation.errors.push(err); - return undefined; - } - const hashes = new Set(); - for (const { referencedHashes, ownHashes } of assets) { - if (!ownHashes.has(hash)) { - for (const hash of ownHashes) { - hashes.add(hash); - } - } - for (const hash of referencedHashes) { - hashes.add(hash); - } - } - return hashes; - }; - const hashInfo = hash => { - const assets = hashToAssets.get(hash); - return `${hash} (${Array.from(assets, a => a.name)})`; - }; - const hashesInOrder = new Set(); - for (const hash of hashToAssets.keys()) { - const add = (hash, stack) => { - const deps = getDependencies(hash); - if (!deps) return; - stack.add(hash); - for (const dep of deps) { - if (hashesInOrder.has(dep)) continue; - if (stack.has(dep)) { - throw new Error( - `Circular hash dependency ${Array.from( - stack, - hashInfo - ).join(" -> ")} -> ${hashInfo(dep)}` - ); - } - add(dep, stack); - } - hashesInOrder.add(hash); - stack.delete(hash); - }; - if (hashesInOrder.has(hash)) continue; - add(hash, new Set()); - } - const hashToNewHash = new Map(); - const getEtag = asset => - cacheGenerate.mergeEtags( - cacheGenerate.getLazyHashedEtag(asset.source), - Array.from(asset.referencedHashes, hash => - hashToNewHash.get(hash) - ).join("|") - ); - const computeNewContent = asset => { - if (asset.contentComputePromise) return asset.contentComputePromise; - return (asset.contentComputePromise = (async () => { - if ( - asset.ownHashes.size > 0 || - Array.from(asset.referencedHashes).some( - hash => hashToNewHash.get(hash) !== hash - ) - ) { - const identifier = asset.name; - const etag = getEtag(asset); - asset.newSource = await cacheGenerate.providePromise( - identifier, - etag, - () => { - const newContent = asset.content.replace(hashRegExp, hash => - hashToNewHash.get(hash) - ); - return new RawSource(newContent); - } - ); - } - })()); - }; - const computeNewContentWithoutOwn = asset => { - if (asset.contentComputeWithoutOwnPromise) - return asset.contentComputeWithoutOwnPromise; - return (asset.contentComputeWithoutOwnPromise = (async () => { - if ( - asset.ownHashes.size > 0 || - Array.from(asset.referencedHashes).some( - hash => hashToNewHash.get(hash) !== hash - ) - ) { - const identifier = asset.name + "|without-own"; - const etag = getEtag(asset); - asset.newSourceWithoutOwn = await cacheGenerate.providePromise( - identifier, - etag, - () => { - const newContent = asset.content.replace( - hashRegExp, - hash => { - if (asset.ownHashes.has(hash)) { - return ""; - } - return hashToNewHash.get(hash); - } - ); - return new RawSource(newContent); - } - ); - } - })()); - }; - const comparator = compareSelect(a => a.name, compareStrings); - for (const oldHash of hashesInOrder) { - const assets = hashToAssets.get(oldHash); - assets.sort(comparator); - const hash = createHash(this._hashFunction); - await Promise.all( - assets.map(asset => - asset.ownHashes.has(oldHash) - ? computeNewContentWithoutOwn(asset) - : computeNewContent(asset) - ) - ); - const assetsContent = mapAndDeduplicateBuffers(assets, asset => { - if (asset.ownHashes.has(oldHash)) { - return asset.newSourceWithoutOwn - ? asset.newSourceWithoutOwn.buffer() - : asset.source.buffer(); - } else { - return asset.newSource - ? asset.newSource.buffer() - : asset.source.buffer(); - } - }); - let newHash = hooks.updateHash.call(assetsContent, oldHash); - if (!newHash) { - for (const content of assetsContent) { - hash.update(content); - } - const digest = hash.digest(this._hashDigest); - newHash = /** @type {string} */ (digest.slice(0, oldHash.length)); - } - hashToNewHash.set(oldHash, newHash); - } - await Promise.all( - assetsWithInfo.map(async asset => { - await computeNewContent(asset); - const newName = asset.name.replace(hashRegExp, hash => - hashToNewHash.get(hash) - ); + return true; + }; +}; + +exports.skipTraversal = () => true; + +exports.approve = () => true; + + +/***/ }), - const infoUpdate = {}; - const hash = asset.info.contenthash; - infoUpdate.contenthash = Array.isArray(hash) - ? hash.map(hash => hashToNewHash.get(hash)) - : hashToNewHash.get(hash); +/***/ 98124: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - if (asset.newSource !== undefined) { - compilation.updateAsset( - asset.name, - asset.newSource, - infoUpdate - ); - } else { - compilation.updateAsset(asset.name, asset.source, infoUpdate); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (asset.name !== newName) { - compilation.renameAsset(asset.name, newName); - } - }) - ); - } + + +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const { isSubset } = __webpack_require__(93347); +const { getAllChunks } = __webpack_require__(91145); + +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../ChunkGraph").EntryModuleWithChunkGroup} EntryModuleWithChunkGroup */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {(string|number)[]} EntryItem */ + +const EXPORT_PREFIX = "var __webpack_exports__ = "; + +/** + * @param {ChunkGraph} chunkGraph chunkGraph + * @param {RuntimeTemplate} runtimeTemplate runtimeTemplate + * @param {EntryModuleWithChunkGroup[]} entries entries + * @param {Chunk} chunk chunk + * @param {boolean} passive true: passive startup with on chunks loaded + * @returns {string} runtime code + */ +exports.generateEntryStartup = ( + chunkGraph, + runtimeTemplate, + entries, + chunk, + passive +) => { + /** @type {string[]} */ + const runtime = [ + `var __webpack_exec__ = ${runtimeTemplate.returningFunction( + `__webpack_require__(${RuntimeGlobals.entryModuleId} = moduleId)`, + "moduleId" + )}` + ]; + + const runModule = id => { + return `__webpack_exec__(${JSON.stringify(id)})`; + }; + const outputCombination = (chunks, moduleIds, final) => { + if (chunks.size === 0) { + runtime.push( + `${final ? EXPORT_PREFIX : ""}(${moduleIds.map(runModule).join(", ")});` ); - }); + } else { + const fn = runtimeTemplate.returningFunction( + moduleIds.map(runModule).join(", ") + ); + runtime.push( + `${final && !passive ? EXPORT_PREFIX : ""}${ + passive + ? RuntimeGlobals.onChunksLoaded + : RuntimeGlobals.startupEntrypoint + }(0, ${JSON.stringify(Array.from(chunks, c => c.id))}, ${fn});` + ); + if (final && passive) { + runtime.push(`${EXPORT_PREFIX}${RuntimeGlobals.onChunksLoaded}();`); + } + } + }; + + let currentChunks = undefined; + let currentModuleIds = undefined; + + for (const [module, entrypoint] of entries) { + const runtimeChunk = entrypoint.getRuntimeChunk(); + const moduleId = chunkGraph.getModuleId(module); + const chunks = getAllChunks(entrypoint, chunk, runtimeChunk); + if ( + currentChunks && + currentChunks.size === chunks.size && + isSubset(currentChunks, chunks) + ) { + currentModuleIds.push(moduleId); + } else { + if (currentChunks) { + outputCombination(currentChunks, currentModuleIds); + } + currentChunks = chunks; + currentModuleIds = [moduleId]; + } } -} -module.exports = RealContentHashPlugin; + // output current modules with export prefix + if (currentChunks) { + outputCombination(currentChunks, currentModuleIds, true); + } + runtime.push(""); + return Template.asString(runtime); +}; + +/** + * @param {Hash} hash the hash to update + * @param {ChunkGraph} chunkGraph chunkGraph + * @param {EntryModuleWithChunkGroup[]} entries entries + * @param {Chunk} chunk chunk + * @returns {void} + */ +exports.updateHashForEntryStartup = (hash, chunkGraph, entries, chunk) => { + for (const [module, entrypoint] of entries) { + const runtimeChunk = entrypoint.getRuntimeChunk(); + const moduleId = chunkGraph.getModuleId(module); + hash.update(`${moduleId}`); + for (const c of getAllChunks(entrypoint, chunk, runtimeChunk)) + hash.update(`${c.id}`); + } +}; + +/** + * @param {Chunk} chunk the chunk + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {function(Chunk, ChunkGraph): boolean} filterFn filter function + * @returns {Set} initially fulfilled chunk ids + */ +exports.getInitialChunkIds = (chunk, chunkGraph, filterFn) => { + const initialChunkIds = new Set(chunk.ids); + for (const c of chunk.getAllInitialChunks()) { + if (c === chunk || filterFn(c, chunkGraph)) continue; + for (const id of c.ids) initialChunkIds.add(id); + } + return initialChunkIds; +}; /***/ }), -/***/ 84760: +/***/ 90490: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -104808,61 +102437,45 @@ module.exports = RealContentHashPlugin; -const { STAGE_BASIC, STAGE_ADVANCED } = __webpack_require__(80057); - -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ +const { register } = __webpack_require__(8282); -class RemoveEmptyChunksPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap("RemoveEmptyChunksPlugin", compilation => { - /** - * @param {Iterable} chunks the chunks array - * @returns {void} - */ - const handler = chunks => { - const chunkGraph = compilation.chunkGraph; - for (const chunk of chunks) { - if ( - chunkGraph.getNumberOfChunkModules(chunk) === 0 && - !chunk.hasRuntime() && - chunkGraph.getNumberOfEntryModules(chunk) === 0 - ) { - compilation.chunkGraph.disconnectChunk(chunk); - compilation.chunks.delete(chunk); - } - } - }; +class JsonData { + constructor(data) { + this._buffer = undefined; + this._data = undefined; + if (Buffer.isBuffer(data)) { + this._buffer = data; + } else { + this._data = data; + } + } - // TODO do it once - compilation.hooks.optimizeChunks.tap( - { - name: "RemoveEmptyChunksPlugin", - stage: STAGE_BASIC - }, - handler - ); - compilation.hooks.optimizeChunks.tap( - { - name: "RemoveEmptyChunksPlugin", - stage: STAGE_ADVANCED - }, - handler - ); - }); + get() { + if (this._data === undefined && this._buffer !== undefined) { + this._data = JSON.parse(this._buffer.toString()); + } + return this._data; } } -module.exports = RemoveEmptyChunksPlugin; + +register(JsonData, "webpack/lib/json/JsonData", null, { + serialize(obj, { write }) { + if (obj._buffer === undefined && obj._data !== undefined) { + obj._buffer = Buffer.from(JSON.stringify(obj._data)); + } + write(obj._buffer); + }, + deserialize({ read }) { + return new JsonData(read()); + } +}); + +module.exports = JsonData; /***/ }), -/***/ 7081: +/***/ 70393: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -104873,126 +102486,196 @@ module.exports = RemoveEmptyChunksPlugin; -const { STAGE_BASIC } = __webpack_require__(80057); -const Queue = __webpack_require__(65930); -const { intersect } = __webpack_require__(93347); +const { RawSource } = __webpack_require__(51255); +const ConcatenationScope = __webpack_require__(98229); +const { UsageState } = __webpack_require__(63686); +const Generator = __webpack_require__(93401); +const RuntimeGlobals = __webpack_require__(16475); -/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../ExportsInfo")} ExportsInfo */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -class RemoveParentModulesPlugin { +const stringifySafe = data => { + const stringified = JSON.stringify(data); + if (!stringified) { + return undefined; // Invalid JSON + } + + return stringified.replace(/\u2028|\u2029/g, str => + str === "\u2029" ? "\\u2029" : "\\u2028" + ); // invalid in JavaScript but valid JSON +}; + +/** + * @param {Object} data data (always an object or array) + * @param {ExportsInfo} exportsInfo exports info + * @param {RuntimeSpec} runtime the runtime + * @returns {Object} reduced data + */ +const createObjectForExportsInfo = (data, exportsInfo, runtime) => { + if (exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused) + return data; + const isArray = Array.isArray(data); + const reducedData = isArray ? [] : {}; + for (const key of Object.keys(data)) { + const exportInfo = exportsInfo.getReadOnlyExportInfo(key); + const used = exportInfo.getUsed(runtime); + if (used === UsageState.Unused) continue; + + let value; + if (used === UsageState.OnlyPropertiesUsed && exportInfo.exportsInfo) { + value = createObjectForExportsInfo( + data[key], + exportInfo.exportsInfo, + runtime + ); + } else { + value = data[key]; + } + const name = exportInfo.getUsedName(key, runtime); + reducedData[name] = value; + } + if (isArray) { + let arrayLengthWhenUsed = + exportsInfo.getReadOnlyExportInfo("length").getUsed(runtime) !== + UsageState.Unused + ? data.length + : undefined; + + let sizeObjectMinusArray = 0; + for (let i = 0; i < reducedData.length; i++) { + if (reducedData[i] === undefined) { + sizeObjectMinusArray -= 2; + } else { + sizeObjectMinusArray += `${i}`.length + 3; + } + } + if (arrayLengthWhenUsed !== undefined) { + sizeObjectMinusArray += + `${arrayLengthWhenUsed}`.length + + 8 - + (arrayLengthWhenUsed - reducedData.length) * 2; + } + if (sizeObjectMinusArray < 0) + return Object.assign( + arrayLengthWhenUsed === undefined + ? {} + : { length: arrayLengthWhenUsed }, + reducedData + ); + const generatedLength = + arrayLengthWhenUsed !== undefined + ? Math.max(arrayLengthWhenUsed, reducedData.length) + : reducedData.length; + for (let i = 0; i < generatedLength; i++) { + if (reducedData[i] === undefined) { + reducedData[i] = 0; + } + } + } + return reducedData; +}; + +const TYPES = new Set(["javascript"]); + +class JsonGenerator extends Generator { /** - * @param {Compiler} compiler the compiler - * @returns {void} + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) */ - apply(compiler) { - compiler.hooks.compilation.tap("RemoveParentModulesPlugin", compilation => { - const handler = (chunks, chunkGroups) => { - const chunkGraph = compilation.chunkGraph; - const queue = new Queue(); - const availableModulesMap = new WeakMap(); + getTypes(module) { + return TYPES; + } - for (const chunkGroup of compilation.entrypoints.values()) { - // initialize available modules for chunks without parents - availableModulesMap.set(chunkGroup, new Set()); - for (const child of chunkGroup.childrenIterable) { - queue.enqueue(child); - } - } - for (const chunkGroup of compilation.asyncEntrypoints) { - // initialize available modules for chunks without parents - availableModulesMap.set(chunkGroup, new Set()); - for (const child of chunkGroup.childrenIterable) { - queue.enqueue(child); - } - } + /** + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module + */ + getSize(module, type) { + let data = + module.buildInfo && + module.buildInfo.jsonData && + module.buildInfo.jsonData.get(); + if (!data) return 0; + return stringifySafe(data).length + 10; + } - while (queue.length > 0) { - const chunkGroup = queue.dequeue(); - let availableModules = availableModulesMap.get(chunkGroup); - let changed = false; - for (const parent of chunkGroup.parentsIterable) { - const availableModulesInParent = availableModulesMap.get(parent); - if (availableModulesInParent !== undefined) { - // If we know the available modules in parent: process these - if (availableModules === undefined) { - // if we have not own info yet: create new entry - availableModules = new Set(availableModulesInParent); - for (const chunk of parent.chunks) { - for (const m of chunkGraph.getChunkModulesIterable(chunk)) { - availableModules.add(m); - } - } - availableModulesMap.set(chunkGroup, availableModules); - changed = true; - } else { - for (const m of availableModules) { - if ( - !chunkGraph.isModuleInChunkGroup(m, parent) && - !availableModulesInParent.has(m) - ) { - availableModules.delete(m); - changed = true; - } - } - } - } - } - if (changed) { - // if something changed: enqueue our children - for (const child of chunkGroup.childrenIterable) { - queue.enqueue(child); - } - } - } + /** + * @param {NormalModule} module module for which the bailout reason should be determined + * @param {ConcatenationBailoutReasonContext} context context + * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated + */ + getConcatenationBailoutReason(module, context) { + return undefined; + } - // now we have available modules for every chunk - for (const chunk of chunks) { - const availableModulesSets = Array.from( - chunk.groupsIterable, - chunkGroup => availableModulesMap.get(chunkGroup) - ); - if (availableModulesSets.some(s => s === undefined)) continue; // No info about this chunk group - const availableModules = - availableModulesSets.length === 1 - ? availableModulesSets[0] - : intersect(availableModulesSets); - const numberOfModules = chunkGraph.getNumberOfChunkModules(chunk); - const toRemove = new Set(); - if (numberOfModules < availableModules.size) { - for (const m of chunkGraph.getChunkModulesIterable(chunk)) { - if (availableModules.has(m)) { - toRemove.add(m); - } - } - } else { - for (const m of availableModules) { - if (chunkGraph.isModuleInChunk(m, chunk)) { - toRemove.add(m); - } - } - } - for (const module of toRemove) { - chunkGraph.disconnectChunkAndModule(chunk, module); - } - } - }; - compilation.hooks.optimizeChunks.tap( - { - name: "RemoveParentModulesPlugin", - stage: STAGE_BASIC - }, - handler + /** + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code + */ + generate( + module, + { + moduleGraph, + runtimeTemplate, + runtimeRequirements, + runtime, + concatenationScope + } + ) { + const data = + module.buildInfo && + module.buildInfo.jsonData && + module.buildInfo.jsonData.get(); + if (data === undefined) { + return new RawSource( + runtimeTemplate.missingModuleStatement({ + request: module.rawRequest + }) ); - }); + } + const exportsInfo = moduleGraph.getExportsInfo(module); + let finalJson = + typeof data === "object" && + data && + exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused + ? createObjectForExportsInfo(data, exportsInfo, runtime) + : data; + // Use JSON because JSON.parse() is much faster than JavaScript evaluation + const jsonStr = stringifySafe(finalJson); + const jsonExpr = + jsonStr.length > 20 && typeof finalJson === "object" + ? `JSON.parse('${jsonStr.replace(/[\\']/g, "\\$&")}')` + : jsonStr; + let content; + if (concatenationScope) { + content = `${runtimeTemplate.supportsConst() ? "const" : "var"} ${ + ConcatenationScope.NAMESPACE_OBJECT_EXPORT + } = ${jsonExpr};`; + concatenationScope.registerNamespaceExport( + ConcatenationScope.NAMESPACE_OBJECT_EXPORT + ); + } else { + runtimeRequirements.add(RuntimeGlobals.module); + content = `${module.moduleArgument}.exports = ${jsonExpr};`; + } + return new RawSource(content); } } -module.exports = RemoveParentModulesPlugin; + +module.exports = JsonGenerator; /***/ }), -/***/ 2837: -/***/ (function(module) { +/***/ 86770: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -105002,48 +102685,54 @@ module.exports = RemoveParentModulesPlugin; +const createSchemaValidation = __webpack_require__(32540); +const JsonGenerator = __webpack_require__(70393); +const JsonParser = __webpack_require__(41090); + /** @typedef {import("../Compiler")} Compiler */ -class RuntimeChunkPlugin { - constructor(options) { - this.options = { - name: entrypoint => `runtime~${entrypoint.name}`, - ...options - }; +const validate = createSchemaValidation( + __webpack_require__(54094), + () => __webpack_require__(50166), + { + name: "Json Modules Plugin", + baseDataPath: "parser" } +); +class JsonModulesPlugin { /** * Apply the plugin * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap("RuntimeChunkPlugin", compilation => { - compilation.hooks.addEntry.tap( - "RuntimeChunkPlugin", - (_, { name: entryName }) => { - if (entryName === undefined) return; - const data = compilation.entries.get(entryName); - if (data.options.runtime === undefined && !data.options.dependOn) { - // Determine runtime chunk name - let name = this.options.name; - if (typeof name === "function") { - name = name({ name: entryName }); - } - data.options.runtime = name; - } - } - ); - }); + compiler.hooks.compilation.tap( + "JsonModulesPlugin", + (compilation, { normalModuleFactory }) => { + normalModuleFactory.hooks.createParser + .for("json") + .tap("JsonModulesPlugin", parserOptions => { + validate(parserOptions); + + return new JsonParser(parserOptions); + }); + normalModuleFactory.hooks.createGenerator + .for("json") + .tap("JsonModulesPlugin", () => { + return new JsonGenerator(); + }); + } + ); } } -module.exports = RuntimeChunkPlugin; +module.exports = JsonModulesPlugin; /***/ }), -/***/ 84800: +/***/ 41090: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -105054,341 +102743,366 @@ module.exports = RuntimeChunkPlugin; -const glob2regexp = __webpack_require__(86140); -const { STAGE_DEFAULT } = __webpack_require__(80057); -const HarmonyExportImportedSpecifierDependency = __webpack_require__(67157); -const HarmonyImportSpecifierDependency = __webpack_require__(14077); -const formatLocation = __webpack_require__(16734); +const parseJson = __webpack_require__(15235); +const Parser = __webpack_require__(11715); +const JsonExportsDependency = __webpack_require__(750); +const JsonData = __webpack_require__(90490); + +/** @typedef {import("../../declarations/plugins/JsonModulesPluginParser").JsonModulesPluginParserOptions} JsonModulesPluginParserOptions */ +/** @typedef {import("../Parser").ParserState} ParserState */ +/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ + +class JsonParser extends Parser { + /** + * @param {JsonModulesPluginParserOptions} options parser options + */ + constructor(options) { + super(); + this.options = options || {}; + } + + /** + * @param {string | Buffer | PreparsedAst} source the source to parse + * @param {ParserState} state the parser state + * @returns {ParserState} the parser state + */ + parse(source, state) { + if (Buffer.isBuffer(source)) { + source = source.toString("utf-8"); + } + + /** @type {JsonModulesPluginParserOptions["parse"]} */ + const parseFn = + typeof this.options.parse === "function" ? this.options.parse : parseJson; + + const data = + typeof source === "object" + ? source + : parseFn(source[0] === "\ufeff" ? source.slice(1) : source); + + state.module.buildInfo.jsonData = new JsonData(data); + state.module.buildInfo.strict = true; + state.module.buildMeta.exportsType = "default"; + state.module.buildMeta.defaultObject = + typeof data === "object" ? "redirect-warn" : false; + state.module.addDependency( + new JsonExportsDependency(JsonExportsDependency.getExportsFromData(data)) + ); + return state; + } +} + +module.exports = JsonParser; + + +/***/ }), + +/***/ 26030: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + +const RuntimeGlobals = __webpack_require__(16475); +const JavascriptModulesPlugin = __webpack_require__(89464); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ /** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Dependency")} Dependency */ /** @typedef {import("../Module")} Module */ -/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */ +/** @typedef {import("../util/Hash")} Hash */ -/** - * @typedef {Object} ExportInModule - * @property {Module} module the module - * @property {string} exportName the name of the export - * @property {boolean} checked if the export is conditional - */ +const COMMON_LIBRARY_NAME_MESSAGE = + "Common configuration options that specific library names are 'output.library[.name]', 'entry.xyz.library[.name]', 'ModuleFederationPlugin.name' and 'ModuleFederationPlugin.library[.name]'."; /** - * @typedef {Object} ReexportInfo - * @property {Map} static - * @property {Map>} dynamic + * @template T + * @typedef {Object} LibraryContext + * @property {Compilation} compilation + * @property {ChunkGraph} chunkGraph + * @property {T} options */ -/** @type {WeakMap>} */ -const globToRegexpCache = new WeakMap(); - /** - * @param {string} glob the pattern - * @param {Map} cache the glob to RegExp cache - * @returns {RegExp} a regular expression + * @template T */ -const globToRegexp = (glob, cache) => { - const cacheEntry = cache.get(glob); - if (cacheEntry !== undefined) return cacheEntry; - if (!glob.includes("/")) { - glob = `**/${glob}`; - } - const baseRegexp = glob2regexp(glob, { globstar: true, extended: true }); - const regexpSource = baseRegexp.source; - const regexp = new RegExp("^(\\./)?" + regexpSource.slice(1)); - cache.set(glob, regexp); - return regexp; -}; - -class SideEffectsFlagPlugin { +class AbstractLibraryPlugin { /** - * @param {boolean} analyseSource analyse source code for side effects + * @param {Object} options options + * @param {string} options.pluginName name of the plugin + * @param {LibraryType} options.type used library type */ - constructor(analyseSource = true) { - this._analyseSource = analyseSource; + constructor({ pluginName, type }) { + this._pluginName = pluginName; + this._type = type; + this._parseCache = new WeakMap(); } + /** * Apply the plugin * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { - let cache = globToRegexpCache.get(compiler.root); - if (cache === undefined) { - cache = new Map(); - globToRegexpCache.set(compiler.root, cache); - } - compiler.hooks.compilation.tap( - "SideEffectsFlagPlugin", - (compilation, { normalModuleFactory }) => { - const moduleGraph = compilation.moduleGraph; - normalModuleFactory.hooks.module.tap( - "SideEffectsFlagPlugin", - (module, data) => { - const resolveData = data.resourceResolveData; - if ( - resolveData && - resolveData.descriptionFileData && - resolveData.relativePath - ) { - const sideEffects = resolveData.descriptionFileData.sideEffects; - if (sideEffects !== undefined) { - if (module.factoryMeta === undefined) { - module.factoryMeta = {}; + const { _pluginName } = this; + compiler.hooks.thisCompilation.tap(_pluginName, compilation => { + compilation.hooks.finishModules.tap( + { name: _pluginName, stage: 10 }, + () => { + for (const [ + name, + { + dependencies: deps, + options: { library } + } + ] of compilation.entries) { + const options = this._parseOptionsCached( + library !== undefined + ? library + : compilation.outputOptions.library + ); + if (options !== false) { + const dep = deps[deps.length - 1]; + if (dep) { + const module = compilation.moduleGraph.getModule(dep); + if (module) { + this.finishEntryModule(module, name, { + options, + compilation, + chunkGraph: compilation.chunkGraph + }); } - const hasSideEffects = - SideEffectsFlagPlugin.moduleHasSideEffects( - resolveData.relativePath, - sideEffects, - cache - ); - module.factoryMeta.sideEffectFree = !hasSideEffects; } } - - return module; } + } + ); + + const getOptionsForChunk = chunk => { + if (compilation.chunkGraph.getNumberOfEntryModules(chunk) === 0) + return false; + const options = chunk.getEntryOptions(); + const library = options && options.library; + return this._parseOptionsCached( + library !== undefined ? library : compilation.outputOptions.library ); - normalModuleFactory.hooks.module.tap( - "SideEffectsFlagPlugin", - (module, data) => { - if (typeof data.settings.sideEffects === "boolean") { - if (module.factoryMeta === undefined) { - module.factoryMeta = {}; - } - module.factoryMeta.sideEffectFree = !data.settings.sideEffects; + }; + + if ( + this.render !== AbstractLibraryPlugin.prototype.render || + this.runtimeRequirements !== + AbstractLibraryPlugin.prototype.runtimeRequirements + ) { + compilation.hooks.additionalChunkRuntimeRequirements.tap( + _pluginName, + (chunk, set, { chunkGraph }) => { + const options = getOptionsForChunk(chunk); + if (options !== false) { + this.runtimeRequirements(chunk, set, { + options, + compilation, + chunkGraph + }); } - return module; } ); - if (this._analyseSource) { - /** - * @param {JavascriptParser} parser the parser - * @returns {void} - */ - const parserHandler = parser => { - let sideEffectsStatement; - parser.hooks.program.tap("SideEffectsFlagPlugin", () => { - sideEffectsStatement = undefined; - }); - parser.hooks.statement.tap( - { name: "SideEffectsFlagPlugin", stage: -100 }, - statement => { - if (sideEffectsStatement) return; - if (parser.scope.topLevelScope !== true) return; - switch (statement.type) { - case "ExpressionStatement": - if ( - !parser.isPure(statement.expression, statement.range[0]) - ) { - sideEffectsStatement = statement; - } - break; - case "IfStatement": - case "WhileStatement": - case "DoWhileStatement": - if (!parser.isPure(statement.test, statement.range[0])) { - sideEffectsStatement = statement; - } - // statement hook will be called for child statements too - break; - case "ForStatement": - if ( - !parser.isPure(statement.init, statement.range[0]) || - !parser.isPure( - statement.test, - statement.init - ? statement.init.range[1] - : statement.range[0] - ) || - !parser.isPure( - statement.update, - statement.test - ? statement.test.range[1] - : statement.init - ? statement.init.range[1] - : statement.range[0] - ) - ) { - sideEffectsStatement = statement; - } - // statement hook will be called for child statements too - break; - case "SwitchStatement": - if ( - !parser.isPure(statement.discriminant, statement.range[0]) - ) { - sideEffectsStatement = statement; - } - // statement hook will be called for child statements too - break; - case "VariableDeclaration": - case "ClassDeclaration": - case "FunctionDeclaration": - if (!parser.isPure(statement, statement.range[0])) { - sideEffectsStatement = statement; - } - break; - case "ExportNamedDeclaration": - case "ExportDefaultDeclaration": - if ( - !parser.isPure(statement.declaration, statement.range[0]) - ) { - sideEffectsStatement = statement; - } - break; - case "LabeledStatement": - case "BlockStatement": - // statement hook will be called for child statements too - break; - case "EmptyStatement": - break; - case "ExportAllDeclaration": - case "ImportDeclaration": - // imports will be handled by the dependencies - break; - default: - sideEffectsStatement = statement; - break; - } - } - ); - parser.hooks.finish.tap("SideEffectsFlagPlugin", () => { - if (sideEffectsStatement === undefined) { - parser.state.module.buildMeta.sideEffectFree = true; - } else { - const { loc, type } = sideEffectsStatement; - moduleGraph - .getOptimizationBailout(parser.state.module) - .push( - () => - `Statement (${type}) with side effects in source code at ${formatLocation( - loc - )}` - ); - } + } + + const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); + + if (this.render !== AbstractLibraryPlugin.prototype.render) { + hooks.render.tap(_pluginName, (source, renderContext) => { + const options = getOptionsForChunk(renderContext.chunk); + if (options === false) return source; + return this.render(source, renderContext, { + options, + compilation, + chunkGraph: compilation.chunkGraph + }); + }); + } + + if ( + this.embedInRuntimeBailout !== + AbstractLibraryPlugin.prototype.embedInRuntimeBailout + ) { + hooks.embedInRuntimeBailout.tap( + _pluginName, + (module, renderContext) => { + const options = getOptionsForChunk(renderContext.chunk); + if (options === false) return; + return this.embedInRuntimeBailout(module, renderContext, { + options, + compilation, + chunkGraph: compilation.chunkGraph }); - }; - for (const key of [ - "javascript/auto", - "javascript/esm", - "javascript/dynamic" - ]) { - normalModuleFactory.hooks.parser - .for(key) - .tap("SideEffectsFlagPlugin", parserHandler); } - } - compilation.hooks.optimizeDependencies.tap( - { - name: "SideEffectsFlagPlugin", - stage: STAGE_DEFAULT - }, - modules => { - const logger = compilation.getLogger( - "webpack.SideEffectsFlagPlugin" - ); + ); + } - logger.time("update dependencies"); - for (const module of modules) { - if (module.getSideEffectsConnectionState(moduleGraph) === false) { - const exportsInfo = moduleGraph.getExportsInfo(module); - for (const connection of moduleGraph.getIncomingConnections( - module - )) { - const dep = connection.dependency; - let isReexport; - if ( - (isReexport = - dep instanceof - HarmonyExportImportedSpecifierDependency) || - (dep instanceof HarmonyImportSpecifierDependency && - !dep.namespaceObjectAsContext) - ) { - // TODO improve for export * - if (isReexport && dep.name) { - const exportInfo = moduleGraph.getExportInfo( - connection.originModule, - dep.name - ); - exportInfo.moveTarget( - moduleGraph, - ({ module }) => - module.getSideEffectsConnectionState(moduleGraph) === - false, - ({ module: newModule, export: exportName }) => { - moduleGraph.updateModule(dep, newModule); - moduleGraph.addExplanation( - dep, - "(skipped side-effect-free modules)" - ); - const ids = dep.getIds(moduleGraph); - dep.setIds( - moduleGraph, - exportName - ? [...exportName, ...ids.slice(1)] - : ids.slice(1) - ); - return moduleGraph.getConnection(dep); - } - ); - continue; - } - // TODO improve for nested imports - const ids = dep.getIds(moduleGraph); - if (ids.length > 0) { - const exportInfo = exportsInfo.getExportInfo(ids[0]); - const target = exportInfo.getTarget( - moduleGraph, - ({ module }) => - module.getSideEffectsConnectionState(moduleGraph) === - false - ); - if (!target) continue; + if ( + this.strictRuntimeBailout !== + AbstractLibraryPlugin.prototype.strictRuntimeBailout + ) { + hooks.strictRuntimeBailout.tap(_pluginName, renderContext => { + const options = getOptionsForChunk(renderContext.chunk); + if (options === false) return; + return this.strictRuntimeBailout(renderContext, { + options, + compilation, + chunkGraph: compilation.chunkGraph + }); + }); + } - moduleGraph.updateModule(dep, target.module); - moduleGraph.addExplanation( - dep, - "(skipped side-effect-free modules)" - ); - dep.setIds( - moduleGraph, - target.export - ? [...target.export, ...ids.slice(1)] - : ids.slice(1) - ); - } - } - } - } - } - logger.timeEnd("update dependencies"); + if ( + this.renderStartup !== AbstractLibraryPlugin.prototype.renderStartup + ) { + hooks.renderStartup.tap( + _pluginName, + (source, module, renderContext) => { + const options = getOptionsForChunk(renderContext.chunk); + if (options === false) return source; + return this.renderStartup(source, module, renderContext, { + options, + compilation, + chunkGraph: compilation.chunkGraph + }); } ); } - ); + + hooks.chunkHash.tap(_pluginName, (chunk, hash, context) => { + const options = getOptionsForChunk(chunk); + if (options === false) return; + this.chunkHash(chunk, hash, context, { + options, + compilation, + chunkGraph: compilation.chunkGraph + }); + }); + }); } - static moduleHasSideEffects(moduleName, flagValue, cache) { - switch (typeof flagValue) { - case "undefined": - return true; - case "boolean": - return flagValue; - case "string": - return globToRegexp(flagValue, cache).test(moduleName); - case "object": - return flagValue.some(glob => - SideEffectsFlagPlugin.moduleHasSideEffects(moduleName, glob, cache) - ); - } + /** + * @param {LibraryOptions=} library normalized library option + * @returns {T | false} preprocess as needed by overriding + */ + _parseOptionsCached(library) { + if (!library) return false; + if (library.type !== this._type) return false; + const cacheEntry = this._parseCache.get(library); + if (cacheEntry !== undefined) return cacheEntry; + const result = this.parseOptions(library); + this._parseCache.set(library, result); + return result; + } + + /* istanbul ignore next */ + /** + * @abstract + * @param {LibraryOptions} library normalized library option + * @returns {T | false} preprocess as needed by overriding + */ + parseOptions(library) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); + } + + /** + * @param {Module} module the exporting entry module + * @param {string} entryName the name of the entrypoint + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + finishEntryModule(module, entryName, libraryContext) {} + + /** + * @param {Module} module the exporting entry module + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {string | undefined} bailout reason + */ + embedInRuntimeBailout(module, renderContext, libraryContext) { + return undefined; + } + + /** + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {string | undefined} bailout reason + */ + strictRuntimeBailout(renderContext, libraryContext) { + return undefined; + } + + /** + * @param {Chunk} chunk the chunk + * @param {Set} set runtime requirements + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + runtimeRequirements(chunk, set, libraryContext) { + if (this.render !== AbstractLibraryPlugin.prototype.render) + set.add(RuntimeGlobals.returnExportsFromRuntime); + } + + /** + * @param {Source} source source + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + render(source, renderContext, libraryContext) { + return source; + } + + /** + * @param {Source} source source + * @param {Module} module module + * @param {StartupRenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + renderStartup(source, module, renderContext, libraryContext) { + return source; + } + + /** + * @param {Chunk} chunk the chunk + * @param {Hash} hash hash + * @param {ChunkHashContext} chunkHashContext chunk hash context + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + chunkHash(chunk, hash, chunkHashContext, libraryContext) { + const options = this._parseOptionsCached( + libraryContext.compilation.outputOptions.library + ); + hash.update(this._pluginName); + hash.update(JSON.stringify(options)); } } -module.exports = SideEffectsFlagPlugin; + +AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE = COMMON_LIBRARY_NAME_MESSAGE; +module.exports = AbstractLibraryPlugin; /***/ }), -/***/ 21478: +/***/ 67416: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -105399,2063 +103113,1878 @@ module.exports = SideEffectsFlagPlugin; -const Chunk = __webpack_require__(39385); -const { STAGE_ADVANCED } = __webpack_require__(80057); -const WebpackError = __webpack_require__(53799); -const { requestToId } = __webpack_require__(63290); -const { isSubset } = __webpack_require__(93347); -const SortableSet = __webpack_require__(13098); -const { - compareModulesByIdentifier, - compareIterables -} = __webpack_require__(29579); -const createHash = __webpack_require__(49835); -const deterministicGrouping = __webpack_require__(59836); -const { makePathsRelative } = __webpack_require__(82186); -const memoize = __webpack_require__(78676); -const MinMaxSizeWarning = __webpack_require__(85305); +const { ConcatSource } = __webpack_require__(51255); +const ExternalModule = __webpack_require__(73071); +const Template = __webpack_require__(39722); +const AbstractLibraryPlugin = __webpack_require__(26030); -/** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksCacheGroup} OptimizationSplitChunksCacheGroup */ -/** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksGetCacheGroups} OptimizationSplitChunksGetCacheGroups */ -/** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksOptions} OptimizationSplitChunksOptions */ -/** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksSizes} OptimizationSplitChunksSizes */ -/** @typedef {import("../../declarations/WebpackOptions").Output} OutputOptions */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("../Compilation").PathData} PathData */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ /** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/deterministicGrouping").GroupedItems} DeterministicGroupingGroupedItemsForModule */ -/** @typedef {import("../util/deterministicGrouping").Options} DeterministicGroupingOptionsForModule */ - -/** @typedef {Record} SplitChunksSizes */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ +/** @typedef {import("../util/Hash")} Hash */ +/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ /** - * @callback ChunkFilterFunction - * @param {Chunk} chunk - * @returns {boolean} + * @typedef {Object} AmdLibraryPluginOptions + * @property {LibraryType} type + * @property {boolean=} requireAsWrapper */ /** - * @callback CombineSizeFunction - * @param {number} a - * @param {number} b - * @returns {number} + * @typedef {Object} AmdLibraryPluginParsed + * @property {string} name */ /** - * @typedef {Object} CacheGroupSource - * @property {string=} key - * @property {number=} priority - * @property {GetName=} getName - * @property {ChunkFilterFunction=} chunksFilter - * @property {boolean=} enforce - * @property {SplitChunksSizes} minSize - * @property {SplitChunksSizes} minSizeReduction - * @property {SplitChunksSizes} minRemainingSize - * @property {SplitChunksSizes} enforceSizeThreshold - * @property {SplitChunksSizes} maxAsyncSize - * @property {SplitChunksSizes} maxInitialSize - * @property {number=} minChunks - * @property {number=} maxAsyncRequests - * @property {number=} maxInitialRequests - * @property {(string | function(PathData, AssetInfo=): string)=} filename - * @property {string=} idHint - * @property {string} automaticNameDelimiter - * @property {boolean=} reuseExistingChunk - * @property {boolean=} usedExports + * @typedef {AmdLibraryPluginParsed} T + * @extends {AbstractLibraryPlugin} */ +class AmdLibraryPlugin extends AbstractLibraryPlugin { + /** + * @param {AmdLibraryPluginOptions} options the plugin options + */ + constructor(options) { + super({ + pluginName: "AmdLibraryPlugin", + type: options.type + }); + this.requireAsWrapper = options.requireAsWrapper; + } -/** - * @typedef {Object} CacheGroup - * @property {string} key - * @property {number=} priority - * @property {GetName=} getName - * @property {ChunkFilterFunction=} chunksFilter - * @property {SplitChunksSizes} minSize - * @property {SplitChunksSizes} minSizeReduction - * @property {SplitChunksSizes} minRemainingSize - * @property {SplitChunksSizes} enforceSizeThreshold - * @property {SplitChunksSizes} maxAsyncSize - * @property {SplitChunksSizes} maxInitialSize - * @property {number=} minChunks - * @property {number=} maxAsyncRequests - * @property {number=} maxInitialRequests - * @property {(string | function(PathData, AssetInfo=): string)=} filename - * @property {string=} idHint - * @property {string} automaticNameDelimiter - * @property {boolean} reuseExistingChunk - * @property {boolean} usedExports - * @property {boolean} _validateSize - * @property {boolean} _validateRemainingSize - * @property {SplitChunksSizes} _minSizeForMaxSize - * @property {boolean} _conditionalEnforce - */ + /** + * @param {LibraryOptions} library normalized library option + * @returns {T | false} preprocess as needed by overriding + */ + parseOptions(library) { + const { name } = library; + if (this.requireAsWrapper) { + if (name) { + throw new Error( + `AMD library name must be unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` + ); + } + } else { + if (name && typeof name !== "string") { + throw new Error( + `AMD library name must be a simple string or unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` + ); + } + } + return { + name: /** @type {string=} */ (name) + }; + } -/** - * @typedef {Object} FallbackCacheGroup - * @property {ChunkFilterFunction} chunksFilter - * @property {SplitChunksSizes} minSize - * @property {SplitChunksSizes} maxAsyncSize - * @property {SplitChunksSizes} maxInitialSize - * @property {string} automaticNameDelimiter - */ + /** + * @param {Source} source source + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + render( + source, + { chunkGraph, chunk, runtimeTemplate }, + { options, compilation } + ) { + const modern = runtimeTemplate.supportsArrowFunction(); + const modules = chunkGraph + .getChunkModules(chunk) + .filter(m => m instanceof ExternalModule); + const externals = /** @type {ExternalModule[]} */ (modules); + const externalsDepsArray = JSON.stringify( + externals.map(m => + typeof m.request === "object" && !Array.isArray(m.request) + ? m.request.amd + : m.request + ) + ); + const externalsArguments = externals + .map( + m => + `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( + `${chunkGraph.getModuleId(m)}` + )}__` + ) + .join(", "); -/** - * @typedef {Object} CacheGroupsContext - * @property {ModuleGraph} moduleGraph - * @property {ChunkGraph} chunkGraph - */ + const iife = runtimeTemplate.isIIFE(); + const fnStart = + (modern + ? `(${externalsArguments}) => {` + : `function(${externalsArguments}) {`) + + (iife || !chunk.hasRuntime() ? " return " : "\n"); + const fnEnd = iife ? ";\n}" : "\n}"; -/** - * @callback GetCacheGroups - * @param {Module} module - * @param {CacheGroupsContext} context - * @returns {CacheGroupSource[]} - */ + if (this.requireAsWrapper) { + return new ConcatSource( + `require(${externalsDepsArray}, ${fnStart}`, + source, + `${fnEnd});` + ); + } else if (options.name) { + const name = compilation.getPath(options.name, { + chunk + }); -/** - * @callback GetName - * @param {Module=} module - * @param {Chunk[]=} chunks - * @param {string=} key - * @returns {string=} - */ + return new ConcatSource( + `define(${JSON.stringify(name)}, ${externalsDepsArray}, ${fnStart}`, + source, + `${fnEnd});` + ); + } else if (externalsArguments) { + return new ConcatSource( + `define(${externalsDepsArray}, ${fnStart}`, + source, + `${fnEnd});` + ); + } else { + return new ConcatSource(`define(${fnStart}`, source, `${fnEnd});`); + } + } -/** - * @typedef {Object} SplitChunksOptions - * @property {ChunkFilterFunction} chunksFilter - * @property {string[]} defaultSizeTypes - * @property {SplitChunksSizes} minSize - * @property {SplitChunksSizes} minSizeReduction - * @property {SplitChunksSizes} minRemainingSize - * @property {SplitChunksSizes} enforceSizeThreshold - * @property {SplitChunksSizes} maxInitialSize - * @property {SplitChunksSizes} maxAsyncSize - * @property {number} minChunks - * @property {number} maxAsyncRequests - * @property {number} maxInitialRequests - * @property {boolean} hidePathInfo - * @property {string | function(PathData, AssetInfo=): string} filename - * @property {string} automaticNameDelimiter - * @property {GetCacheGroups} getCacheGroups - * @property {GetName} getName - * @property {boolean} usedExports - * @property {FallbackCacheGroup} fallbackCacheGroup - */ + /** + * @param {Chunk} chunk the chunk + * @param {Hash} hash hash + * @param {ChunkHashContext} chunkHashContext chunk hash context + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + chunkHash(chunk, hash, chunkHashContext, { options, compilation }) { + hash.update("AmdLibraryPlugin"); + if (this.requireAsWrapper) { + hash.update("requireAsWrapper"); + } else if (options.name) { + hash.update("named"); + const name = compilation.getPath(options.name, { + chunk + }); + hash.update(name); + } + } +} -/** - * @typedef {Object} ChunksInfoItem - * @property {SortableSet} modules - * @property {CacheGroup} cacheGroup - * @property {number} cacheGroupIndex - * @property {string} name - * @property {Record} sizes - * @property {Set} chunks - * @property {Set} reuseableChunks - * @property {Set} chunksKeys - */ +module.exports = AmdLibraryPlugin; -const defaultGetName = /** @type {GetName} */ (() => {}); -const deterministicGroupingForModules = - /** @type {function(DeterministicGroupingOptionsForModule): DeterministicGroupingGroupedItemsForModule[]} */ ( - deterministicGrouping - ); +/***/ }), -/** @type {WeakMap} */ -const getKeyCache = new WeakMap(); +/***/ 40080: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** - * @param {string} name a filename to hash - * @param {OutputOptions} outputOptions hash function used - * @returns {string} hashed filename - */ -const hashFilename = (name, outputOptions) => { - const digest = /** @type {string} */ ( - createHash(outputOptions.hashFunction) - .update(name) - .digest(outputOptions.hashDigest) - ); - return digest.slice(0, 8); -}; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/** - * @param {Chunk} chunk the chunk - * @returns {number} the number of requests - */ -const getRequests = chunk => { - let requests = 0; - for (const chunkGroup of chunk.groupsIterable) { - requests = Math.max(requests, chunkGroup.chunks.length); - } - return requests; -}; -const mapObject = (obj, fn) => { - const newObj = Object.create(null); - for (const key of Object.keys(obj)) { - newObj[key] = fn(obj[key], key); - } - return newObj; -}; -/** - * @template T - * @param {Set} a set - * @param {Set} b other set - * @returns {boolean} true if at least one item of a is in b - */ -const isOverlap = (a, b) => { - for (const item of a) { - if (b.has(item)) return true; - } - return false; -}; +const { ConcatSource } = __webpack_require__(51255); +const { UsageState } = __webpack_require__(63686); +const Template = __webpack_require__(39722); +const propertyAccess = __webpack_require__(54190); +const { getEntryRuntime } = __webpack_require__(17156); +const AbstractLibraryPlugin = __webpack_require__(26030); -const compareModuleIterables = compareIterables(compareModulesByIdentifier); +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */ +/** @typedef {import("../util/Hash")} Hash */ +/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ + +const KEYWORD_REGEX = + /^(await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|super|switch|static|this|throw|try|true|typeof|var|void|while|with|yield)$/; +const IDENTIFIER_REGEX = + /^[\p{L}\p{Nl}$_][\p{L}\p{Nl}$\p{Mn}\p{Mc}\p{Nd}\p{Pc}]*$/iu; /** - * @param {ChunksInfoItem} a item - * @param {ChunksInfoItem} b item - * @returns {number} compare result + * Validates the library name by checking for keywords and valid characters + * @param {string} name name to be validated + * @returns {boolean} true, when valid */ -const compareEntries = (a, b) => { - // 1. by priority - const diffPriority = a.cacheGroup.priority - b.cacheGroup.priority; - if (diffPriority) return diffPriority; - // 2. by number of chunks - const diffCount = a.chunks.size - b.chunks.size; - if (diffCount) return diffCount; - // 3. by size reduction - const aSizeReduce = totalSize(a.sizes) * (a.chunks.size - 1); - const bSizeReduce = totalSize(b.sizes) * (b.chunks.size - 1); - const diffSizeReduce = aSizeReduce - bSizeReduce; - if (diffSizeReduce) return diffSizeReduce; - // 4. by cache group index - const indexDiff = b.cacheGroupIndex - a.cacheGroupIndex; - if (indexDiff) return indexDiff; - // 5. by number of modules (to be able to compare by identifier) - const modulesA = a.modules; - const modulesB = b.modules; - const diff = modulesA.size - modulesB.size; - if (diff) return diff; - // 6. by module identifiers - modulesA.sort(); - modulesB.sort(); - return compareModuleIterables(modulesA, modulesB); +const isNameValid = name => { + return !KEYWORD_REGEX.test(name) && IDENTIFIER_REGEX.test(name); }; -const INITIAL_CHUNK_FILTER = chunk => chunk.canBeInitial(); -const ASYNC_CHUNK_FILTER = chunk => !chunk.canBeInitial(); -const ALL_CHUNK_FILTER = chunk => true; - /** - * @param {OptimizationSplitChunksSizes} value the sizes - * @param {string[]} defaultSizeTypes the default size types - * @returns {SplitChunksSizes} normalized representation + * @param {string[]} accessor variable plus properties + * @param {number} existingLength items of accessor that are existing already + * @param {boolean=} initLast if the last property should also be initialized to an object + * @returns {string} code to access the accessor while initializing */ -const normalizeSizes = (value, defaultSizeTypes) => { - if (typeof value === "number") { - /** @type {Record} */ - const o = {}; - for (const sizeType of defaultSizeTypes) o[sizeType] = value; - return o; - } else if (typeof value === "object" && value !== null) { - return { ...value }; +const accessWithInit = (accessor, existingLength, initLast = false) => { + // This generates for [a, b, c, d]: + // (((a = typeof a === "undefined" ? {} : a).b = a.b || {}).c = a.b.c || {}).d + const base = accessor[0]; + if (accessor.length === 1 && !initLast) return base; + let current = + existingLength > 0 + ? base + : `(${base} = typeof ${base} === "undefined" ? {} : ${base})`; + + // i is the current position in accessor that has been printed + let i = 1; + + // all properties printed so far (excluding base) + let propsSoFar; + + // if there is existingLength, print all properties until this position as property access + if (existingLength > i) { + propsSoFar = accessor.slice(1, existingLength); + i = existingLength; + current += propertyAccess(propsSoFar); } else { - return {}; + propsSoFar = []; } -}; -/** - * @param {...SplitChunksSizes} sizes the sizes - * @returns {SplitChunksSizes} the merged sizes - */ -const mergeSizes = (...sizes) => { - /** @type {SplitChunksSizes} */ - let merged = {}; - for (let i = sizes.length - 1; i >= 0; i--) { - merged = Object.assign(merged, sizes[i]); + // all remaining properties (except the last one when initLast is not set) + // should be printed as initializer + const initUntil = initLast ? accessor.length : accessor.length - 1; + for (; i < initUntil; i++) { + const prop = accessor[i]; + propsSoFar.push(prop); + current = `(${current}${propertyAccess([prop])} = ${base}${propertyAccess( + propsSoFar + )} || {})`; } - return merged; -}; -/** - * @param {SplitChunksSizes} sizes the sizes - * @returns {boolean} true, if there are sizes > 0 - */ -const hasNonZeroSizes = sizes => { - for (const key of Object.keys(sizes)) { - if (sizes[key] > 0) return true; - } - return false; + // print the last property as property access if not yet printed + if (i < accessor.length) + current = `${current}${propertyAccess([accessor[accessor.length - 1]])}`; + + return current; }; /** - * @param {SplitChunksSizes} a first sizes - * @param {SplitChunksSizes} b second sizes - * @param {CombineSizeFunction} combine a function to combine sizes - * @returns {SplitChunksSizes} the combine sizes + * @typedef {Object} AssignLibraryPluginOptions + * @property {LibraryType} type + * @property {string[] | "global"} prefix name prefix + * @property {string | false} declare declare name as variable + * @property {"error"|"static"|"copy"|"assign"} unnamed behavior for unnamed library name + * @property {"copy"|"assign"=} named behavior for named library name */ -const combineSizes = (a, b, combine) => { - const aKeys = new Set(Object.keys(a)); - const bKeys = new Set(Object.keys(b)); - /** @type {SplitChunksSizes} */ - const result = {}; - for (const key of aKeys) { - if (bKeys.has(key)) { - result[key] = combine(a[key], b[key]); - } else { - result[key] = a[key]; - } - } - for (const key of bKeys) { - if (!aKeys.has(key)) { - result[key] = b[key]; - } - } - return result; -}; /** - * @param {SplitChunksSizes} sizes the sizes - * @param {SplitChunksSizes} minSize the min sizes - * @returns {boolean} true if there are sizes and all existing sizes are at least `minSize` + * @typedef {Object} AssignLibraryPluginParsed + * @property {string | string[]} name + * @property {string | string[] | undefined} export */ -const checkMinSize = (sizes, minSize) => { - for (const key of Object.keys(minSize)) { - const size = sizes[key]; - if (size === undefined || size === 0) continue; - if (size < minSize[key]) return false; - } - return true; -}; /** - * @param {SplitChunksSizes} sizes the sizes - * @param {SplitChunksSizes} minSizeReduction the min sizes - * @param {number} chunkCount number of chunks - * @returns {boolean} true if there are sizes and all existing sizes are at least `minSizeReduction` + * @typedef {AssignLibraryPluginParsed} T + * @extends {AbstractLibraryPlugin} */ -const checkMinSizeReduction = (sizes, minSizeReduction, chunkCount) => { - for (const key of Object.keys(minSizeReduction)) { - const size = sizes[key]; - if (size === undefined || size === 0) continue; - if (size * chunkCount < minSizeReduction[key]) return false; +class AssignLibraryPlugin extends AbstractLibraryPlugin { + /** + * @param {AssignLibraryPluginOptions} options the plugin options + */ + constructor(options) { + super({ + pluginName: "AssignLibraryPlugin", + type: options.type + }); + this.prefix = options.prefix; + this.declare = options.declare; + this.unnamed = options.unnamed; + this.named = options.named || "assign"; } - return true; -}; -/** - * @param {SplitChunksSizes} sizes the sizes - * @param {SplitChunksSizes} minSize the min sizes - * @returns {undefined | string[]} list of size types that are below min size - */ -const getViolatingMinSizes = (sizes, minSize) => { - let list; - for (const key of Object.keys(minSize)) { - const size = sizes[key]; - if (size === undefined || size === 0) continue; - if (size < minSize[key]) { - if (list === undefined) list = [key]; - else list.push(key); + /** + * @param {LibraryOptions} library normalized library option + * @returns {T | false} preprocess as needed by overriding + */ + parseOptions(library) { + const { name } = library; + if (this.unnamed === "error") { + if (typeof name !== "string" && !Array.isArray(name)) { + throw new Error( + `Library name must be a string or string array. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` + ); + } + } else { + if (name && typeof name !== "string" && !Array.isArray(name)) { + throw new Error( + `Library name must be a string, string array or unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` + ); + } } + return { + name: /** @type {string|string[]=} */ (name), + export: library.export + }; } - return list; -}; -/** - * @param {SplitChunksSizes} sizes the sizes - * @returns {number} the total size - */ -const totalSize = sizes => { - let size = 0; - for (const key of Object.keys(sizes)) { - size += sizes[key]; + /** + * @param {Module} module the exporting entry module + * @param {string} entryName the name of the entrypoint + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + finishEntryModule( + module, + entryName, + { options, compilation, compilation: { moduleGraph } } + ) { + const runtime = getEntryRuntime(compilation, entryName); + if (options.export) { + const exportsInfo = moduleGraph.getExportInfo( + module, + Array.isArray(options.export) ? options.export[0] : options.export + ); + exportsInfo.setUsed(UsageState.Used, runtime); + exportsInfo.canMangleUse = false; + } else { + const exportsInfo = moduleGraph.getExportsInfo(module); + exportsInfo.setUsedInUnknownWay(runtime); + } + moduleGraph.addExtraReason(module, "used as library export"); } - return size; -}; -/** - * @param {false|string|Function} name the chunk name - * @returns {GetName} a function to get the name of the chunk - */ -const normalizeName = name => { - if (typeof name === "string") { - return () => name; - } - if (typeof name === "function") { - return /** @type {GetName} */ (name); + _getPrefix(compilation) { + return this.prefix === "global" + ? [compilation.runtimeTemplate.globalObject] + : this.prefix; } -}; -/** - * @param {OptimizationSplitChunksCacheGroup["chunks"]} chunks the chunk filter option - * @returns {ChunkFilterFunction} the chunk filter function - */ -const normalizeChunksFilter = chunks => { - if (chunks === "initial") { - return INITIAL_CHUNK_FILTER; - } - if (chunks === "async") { - return ASYNC_CHUNK_FILTER; - } - if (chunks === "all") { - return ALL_CHUNK_FILTER; - } - if (typeof chunks === "function") { - return chunks; + _getResolvedFullName(options, chunk, compilation) { + const prefix = this._getPrefix(compilation); + const fullName = options.name ? prefix.concat(options.name) : prefix; + return fullName.map(n => + compilation.getPath(n, { + chunk + }) + ); } -}; -/** - * @param {GetCacheGroups | Record} cacheGroups the cache group options - * @param {string[]} defaultSizeTypes the default size types - * @returns {GetCacheGroups} a function to get the cache groups - */ -const normalizeCacheGroups = (cacheGroups, defaultSizeTypes) => { - if (typeof cacheGroups === "function") { - return cacheGroups; - } - if (typeof cacheGroups === "object" && cacheGroups !== null) { - /** @type {(function(Module, CacheGroupsContext, CacheGroupSource[]): void)[]} */ - const handlers = []; - for (const key of Object.keys(cacheGroups)) { - const option = cacheGroups[key]; - if (option === false) { - continue; - } - if (typeof option === "string" || option instanceof RegExp) { - const source = createCacheGroupSource({}, key, defaultSizeTypes); - handlers.push((module, context, results) => { - if (checkTest(option, module, context)) { - results.push(source); - } - }); - } else if (typeof option === "function") { - const cache = new WeakMap(); - handlers.push((module, context, results) => { - const result = option(module); - if (result) { - const groups = Array.isArray(result) ? result : [result]; - for (const group of groups) { - const cachedSource = cache.get(group); - if (cachedSource !== undefined) { - results.push(cachedSource); - } else { - const source = createCacheGroupSource( - group, - key, - defaultSizeTypes - ); - cache.set(group, source); - results.push(source); - } - } - } - }); - } else { - const source = createCacheGroupSource(option, key, defaultSizeTypes); - handlers.push((module, context, results) => { - if ( - checkTest(option.test, module, context) && - checkModuleType(option.type, module) && - checkModuleLayer(option.layer, module) - ) { - results.push(source); - } - }); + /** + * @param {Source} source source + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + render(source, { chunk }, { options, compilation }) { + const fullNameResolved = this._getResolvedFullName( + options, + chunk, + compilation + ); + if (this.declare) { + const base = fullNameResolved[0]; + if (!isNameValid(base)) { + throw new Error( + `Library name base (${base}) must be a valid identifier when using a var declaring library type. Either use a valid identifier (e. g. ${Template.toIdentifier( + base + )}) or use a different library type (e. g. 'type: "global"', which assign a property on the global scope instead of declaring a variable). ${ + AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE + }` + ); } + source = new ConcatSource(`${this.declare} ${base};\n`, source); } - /** - * @param {Module} module the current module - * @param {CacheGroupsContext} context the current context - * @returns {CacheGroupSource[]} the matching cache groups - */ - const fn = (module, context) => { - /** @type {CacheGroupSource[]} */ - let results = []; - for (const fn of handlers) { - fn(module, context, results); - } - return results; - }; - return fn; + return source; } - return () => null; -}; -/** - * @param {undefined|boolean|string|RegExp|Function} test test option - * @param {Module} module the module - * @param {CacheGroupsContext} context context object - * @returns {boolean} true, if the module should be selected - */ -const checkTest = (test, module, context) => { - if (test === undefined) return true; - if (typeof test === "function") { - return test(module, context); + /** + * @param {Module} module the exporting entry module + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {string | undefined} bailout reason + */ + embedInRuntimeBailout( + module, + { chunk, codeGenerationResults }, + { options, compilation } + ) { + const { data } = codeGenerationResults.get(module, chunk.runtime); + const topLevelDeclarations = + (data && data.get("topLevelDeclarations")) || + (module.buildInfo && module.buildInfo.topLevelDeclarations); + if (!topLevelDeclarations) + return "it doesn't tell about top level declarations."; + const fullNameResolved = this._getResolvedFullName( + options, + chunk, + compilation + ); + const base = fullNameResolved[0]; + if (topLevelDeclarations.has(base)) + return `it declares '${base}' on top-level, which conflicts with the current library output.`; } - if (typeof test === "boolean") return test; - if (typeof test === "string") { - const name = module.nameForCondition(); - return name && name.startsWith(test); + + /** + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {string | undefined} bailout reason + */ + strictRuntimeBailout({ chunk }, { options, compilation }) { + if ( + this.declare || + this.prefix === "global" || + this.prefix.length > 0 || + !options.name + ) { + return; + } + return "a global variable is assign and maybe created"; } - if (test instanceof RegExp) { - const name = module.nameForCondition(); - return name && test.test(name); + + /** + * @param {Source} source source + * @param {Module} module module + * @param {StartupRenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + renderStartup( + source, + module, + { moduleGraph, chunk }, + { options, compilation } + ) { + const fullNameResolved = this._getResolvedFullName( + options, + chunk, + compilation + ); + const staticExports = this.unnamed === "static"; + const exportAccess = options.export + ? propertyAccess( + Array.isArray(options.export) ? options.export : [options.export] + ) + : ""; + const result = new ConcatSource(source); + if (staticExports) { + const exportsInfo = moduleGraph.getExportsInfo(module); + const exportTarget = accessWithInit( + fullNameResolved, + this._getPrefix(compilation).length, + true + ); + for (const exportInfo of exportsInfo.orderedExports) { + if (!exportInfo.provided) continue; + const nameAccess = propertyAccess([exportInfo.name]); + result.add( + `${exportTarget}${nameAccess} = __webpack_exports__${exportAccess}${nameAccess};\n` + ); + } + result.add( + `Object.defineProperty(${exportTarget}, "__esModule", { value: true });\n` + ); + } else if (options.name ? this.named === "copy" : this.unnamed === "copy") { + result.add( + `var __webpack_export_target__ = ${accessWithInit( + fullNameResolved, + this._getPrefix(compilation).length, + true + )};\n` + ); + let exports = "__webpack_exports__"; + if (exportAccess) { + result.add( + `var __webpack_exports_export__ = __webpack_exports__${exportAccess};\n` + ); + exports = "__webpack_exports_export__"; + } + result.add( + `for(var i in ${exports}) __webpack_export_target__[i] = ${exports}[i];\n` + ); + result.add( + `if(${exports}.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true });\n` + ); + } else { + result.add( + `${accessWithInit( + fullNameResolved, + this._getPrefix(compilation).length, + false + )} = __webpack_exports__${exportAccess};\n` + ); + } + return result; } - return false; -}; -/** - * @param {undefined|string|RegExp|Function} test type option - * @param {Module} module the module - * @returns {boolean} true, if the module should be selected - */ -const checkModuleType = (test, module) => { - if (test === undefined) return true; - if (typeof test === "function") { - return test(module.type); - } - if (typeof test === "string") { - const type = module.type; - return test === type; - } - if (test instanceof RegExp) { - const type = module.type; - return test.test(type); + /** + * @param {Chunk} chunk the chunk + * @param {Set} set runtime requirements + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + runtimeRequirements(chunk, set, libraryContext) { + // we don't need to return exports from runtime } - return false; -}; -/** - * @param {undefined|string|RegExp|Function} test type option - * @param {Module} module the module - * @returns {boolean} true, if the module should be selected - */ -const checkModuleLayer = (test, module) => { - if (test === undefined) return true; - if (typeof test === "function") { - return test(module.layer); - } - if (typeof test === "string") { - const layer = module.layer; - return test === "" ? !layer : layer && layer.startsWith(test); - } - if (test instanceof RegExp) { - const layer = module.layer; - return test.test(layer); + /** + * @param {Chunk} chunk the chunk + * @param {Hash} hash hash + * @param {ChunkHashContext} chunkHashContext chunk hash context + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + chunkHash(chunk, hash, chunkHashContext, { options, compilation }) { + hash.update("AssignLibraryPlugin"); + const fullNameResolved = this._getResolvedFullName( + options, + chunk, + compilation + ); + if (options.name ? this.named === "copy" : this.unnamed === "copy") { + hash.update("copy"); + } + if (this.declare) { + hash.update(this.declare); + } + hash.update(fullNameResolved.join(".")); + if (options.export) { + hash.update(`${options.export}`); + } } - return false; -}; +} -/** - * @param {OptimizationSplitChunksCacheGroup} options the group options - * @param {string} key key of cache group - * @param {string[]} defaultSizeTypes the default size types - * @returns {CacheGroupSource} the normalized cached group - */ -const createCacheGroupSource = (options, key, defaultSizeTypes) => { - const minSize = normalizeSizes(options.minSize, defaultSizeTypes); - const minSizeReduction = normalizeSizes( - options.minSizeReduction, - defaultSizeTypes - ); - const maxSize = normalizeSizes(options.maxSize, defaultSizeTypes); - return { - key, - priority: options.priority, - getName: normalizeName(options.name), - chunksFilter: normalizeChunksFilter(options.chunks), - enforce: options.enforce, - minSize, - minSizeReduction, - minRemainingSize: mergeSizes( - normalizeSizes(options.minRemainingSize, defaultSizeTypes), - minSize - ), - enforceSizeThreshold: normalizeSizes( - options.enforceSizeThreshold, - defaultSizeTypes - ), - maxAsyncSize: mergeSizes( - normalizeSizes(options.maxAsyncSize, defaultSizeTypes), - maxSize - ), - maxInitialSize: mergeSizes( - normalizeSizes(options.maxInitialSize, defaultSizeTypes), - maxSize - ), - minChunks: options.minChunks, - maxAsyncRequests: options.maxAsyncRequests, - maxInitialRequests: options.maxInitialRequests, - filename: options.filename, - idHint: options.idHint, - automaticNameDelimiter: options.automaticNameDelimiter, - reuseExistingChunk: options.reuseExistingChunk, - usedExports: options.usedExports - }; +module.exports = AssignLibraryPlugin; + + +/***/ }), + +/***/ 91452: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Compiler")} Compiler */ + +/** @type {WeakMap>} */ +const enabledTypes = new WeakMap(); + +const getEnabledTypes = compiler => { + let set = enabledTypes.get(compiler); + if (set === undefined) { + set = new Set(); + enabledTypes.set(compiler, set); + } + return set; }; -module.exports = class SplitChunksPlugin { +class EnableLibraryPlugin { /** - * @param {OptimizationSplitChunksOptions=} options plugin options + * @param {LibraryType} type library type that should be available */ - constructor(options = {}) { - const defaultSizeTypes = options.defaultSizeTypes || [ - "javascript", - "unknown" - ]; - const fallbackCacheGroup = options.fallbackCacheGroup || {}; - const minSize = normalizeSizes(options.minSize, defaultSizeTypes); - const minSizeReduction = normalizeSizes( - options.minSizeReduction, - defaultSizeTypes - ); - const maxSize = normalizeSizes(options.maxSize, defaultSizeTypes); + constructor(type) { + this.type = type; + } - /** @type {SplitChunksOptions} */ - this.options = { - chunksFilter: normalizeChunksFilter(options.chunks || "all"), - defaultSizeTypes, - minSize, - minSizeReduction, - minRemainingSize: mergeSizes( - normalizeSizes(options.minRemainingSize, defaultSizeTypes), - minSize - ), - enforceSizeThreshold: normalizeSizes( - options.enforceSizeThreshold, - defaultSizeTypes - ), - maxAsyncSize: mergeSizes( - normalizeSizes(options.maxAsyncSize, defaultSizeTypes), - maxSize - ), - maxInitialSize: mergeSizes( - normalizeSizes(options.maxInitialSize, defaultSizeTypes), - maxSize - ), - minChunks: options.minChunks || 1, - maxAsyncRequests: options.maxAsyncRequests || 1, - maxInitialRequests: options.maxInitialRequests || 1, - hidePathInfo: options.hidePathInfo || false, - filename: options.filename || undefined, - getCacheGroups: normalizeCacheGroups( - options.cacheGroups, - defaultSizeTypes - ), - getName: options.name ? normalizeName(options.name) : defaultGetName, - automaticNameDelimiter: options.automaticNameDelimiter, - usedExports: options.usedExports, - fallbackCacheGroup: { - chunksFilter: normalizeChunksFilter( - fallbackCacheGroup.chunks || options.chunks || "all" - ), - minSize: mergeSizes( - normalizeSizes(fallbackCacheGroup.minSize, defaultSizeTypes), - minSize - ), - maxAsyncSize: mergeSizes( - normalizeSizes(fallbackCacheGroup.maxAsyncSize, defaultSizeTypes), - normalizeSizes(fallbackCacheGroup.maxSize, defaultSizeTypes), - normalizeSizes(options.maxAsyncSize, defaultSizeTypes), - normalizeSizes(options.maxSize, defaultSizeTypes) - ), - maxInitialSize: mergeSizes( - normalizeSizes(fallbackCacheGroup.maxInitialSize, defaultSizeTypes), - normalizeSizes(fallbackCacheGroup.maxSize, defaultSizeTypes), - normalizeSizes(options.maxInitialSize, defaultSizeTypes), - normalizeSizes(options.maxSize, defaultSizeTypes) - ), - automaticNameDelimiter: - fallbackCacheGroup.automaticNameDelimiter || - options.automaticNameDelimiter || - "~" - } - }; + /** + * @param {Compiler} compiler the compiler instance + * @param {LibraryType} type type of library + * @returns {void} + */ + static setEnabled(compiler, type) { + getEnabledTypes(compiler).add(type); + } - /** @type {WeakMap} */ - this._cacheGroupCache = new WeakMap(); + /** + * @param {Compiler} compiler the compiler instance + * @param {LibraryType} type type of library + * @returns {void} + */ + static checkEnabled(compiler, type) { + if (!getEnabledTypes(compiler).has(type)) { + throw new Error( + `Library type "${type}" is not enabled. ` + + "EnableLibraryPlugin need to be used to enable this type of library. " + + 'This usually happens through the "output.enabledLibraryTypes" option. ' + + 'If you are using a function as entry which sets "library", you need to add all potential library types to "output.enabledLibraryTypes". ' + + "These types are enabled: " + + Array.from(getEnabledTypes(compiler)).join(", ") + ); + } } /** - * @param {CacheGroupSource} cacheGroupSource source - * @returns {CacheGroup} the cache group (cached) + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - _getCacheGroup(cacheGroupSource) { - const cacheEntry = this._cacheGroupCache.get(cacheGroupSource); - if (cacheEntry !== undefined) return cacheEntry; - const minSize = mergeSizes( - cacheGroupSource.minSize, - cacheGroupSource.enforce ? undefined : this.options.minSize - ); - const minSizeReduction = mergeSizes( - cacheGroupSource.minSizeReduction, - cacheGroupSource.enforce ? undefined : this.options.minSizeReduction - ); - const minRemainingSize = mergeSizes( - cacheGroupSource.minRemainingSize, - cacheGroupSource.enforce ? undefined : this.options.minRemainingSize - ); - const enforceSizeThreshold = mergeSizes( - cacheGroupSource.enforceSizeThreshold, - cacheGroupSource.enforce ? undefined : this.options.enforceSizeThreshold - ); - const cacheGroup = { - key: cacheGroupSource.key, - priority: cacheGroupSource.priority || 0, - chunksFilter: cacheGroupSource.chunksFilter || this.options.chunksFilter, - minSize, - minSizeReduction, - minRemainingSize, - enforceSizeThreshold, - maxAsyncSize: mergeSizes( - cacheGroupSource.maxAsyncSize, - cacheGroupSource.enforce ? undefined : this.options.maxAsyncSize - ), - maxInitialSize: mergeSizes( - cacheGroupSource.maxInitialSize, - cacheGroupSource.enforce ? undefined : this.options.maxInitialSize - ), - minChunks: - cacheGroupSource.minChunks !== undefined - ? cacheGroupSource.minChunks - : cacheGroupSource.enforce - ? 1 - : this.options.minChunks, - maxAsyncRequests: - cacheGroupSource.maxAsyncRequests !== undefined - ? cacheGroupSource.maxAsyncRequests - : cacheGroupSource.enforce - ? Infinity - : this.options.maxAsyncRequests, - maxInitialRequests: - cacheGroupSource.maxInitialRequests !== undefined - ? cacheGroupSource.maxInitialRequests - : cacheGroupSource.enforce - ? Infinity - : this.options.maxInitialRequests, - getName: - cacheGroupSource.getName !== undefined - ? cacheGroupSource.getName - : this.options.getName, - usedExports: - cacheGroupSource.usedExports !== undefined - ? cacheGroupSource.usedExports - : this.options.usedExports, - filename: - cacheGroupSource.filename !== undefined - ? cacheGroupSource.filename - : this.options.filename, - automaticNameDelimiter: - cacheGroupSource.automaticNameDelimiter !== undefined - ? cacheGroupSource.automaticNameDelimiter - : this.options.automaticNameDelimiter, - idHint: - cacheGroupSource.idHint !== undefined - ? cacheGroupSource.idHint - : cacheGroupSource.key, - reuseExistingChunk: cacheGroupSource.reuseExistingChunk || false, - _validateSize: hasNonZeroSizes(minSize), - _validateRemainingSize: hasNonZeroSizes(minRemainingSize), - _minSizeForMaxSize: mergeSizes( - cacheGroupSource.minSize, - this.options.minSize - ), - _conditionalEnforce: hasNonZeroSizes(enforceSizeThreshold) - }; - this._cacheGroupCache.set(cacheGroupSource, cacheGroup); - return cacheGroup; + apply(compiler) { + const { type } = this; + + // Only enable once + const enabled = getEnabledTypes(compiler); + if (enabled.has(type)) return; + enabled.add(type); + + if (typeof type === "string") { + const enableExportProperty = () => { + const ExportPropertyTemplatePlugin = __webpack_require__(5487); + new ExportPropertyTemplatePlugin({ + type, + nsObjectUsed: type !== "module" + }).apply(compiler); + }; + switch (type) { + case "var": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: [], + declare: "var", + unnamed: "error" + }).apply(compiler); + break; + } + case "assign-properties": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: [], + declare: false, + unnamed: "error", + named: "copy" + }).apply(compiler); + break; + } + case "assign": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: [], + declare: false, + unnamed: "error" + }).apply(compiler); + break; + } + case "this": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: ["this"], + declare: false, + unnamed: "copy" + }).apply(compiler); + break; + } + case "window": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: ["window"], + declare: false, + unnamed: "copy" + }).apply(compiler); + break; + } + case "self": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: ["self"], + declare: false, + unnamed: "copy" + }).apply(compiler); + break; + } + case "global": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: "global", + declare: false, + unnamed: "copy" + }).apply(compiler); + break; + } + case "commonjs": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: ["exports"], + declare: false, + unnamed: "copy" + }).apply(compiler); + break; + } + case "commonjs-static": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: ["exports"], + declare: false, + unnamed: "static" + }).apply(compiler); + break; + } + case "commonjs2": + case "commonjs-module": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: ["module", "exports"], + declare: false, + unnamed: "assign" + }).apply(compiler); + break; + } + case "amd": + case "amd-require": { + enableExportProperty(); + const AmdLibraryPlugin = __webpack_require__(67416); + new AmdLibraryPlugin({ + type, + requireAsWrapper: type === "amd-require" + }).apply(compiler); + break; + } + case "umd": + case "umd2": { + enableExportProperty(); + const UmdLibraryPlugin = __webpack_require__(54442); + new UmdLibraryPlugin({ + type, + optionalAmdExternalAsGlobal: type === "umd2" + }).apply(compiler); + break; + } + case "system": { + enableExportProperty(); + const SystemLibraryPlugin = __webpack_require__(11707); + new SystemLibraryPlugin({ + type + }).apply(compiler); + break; + } + case "jsonp": { + enableExportProperty(); + const JsonpLibraryPlugin = __webpack_require__(84415); + new JsonpLibraryPlugin({ + type + }).apply(compiler); + break; + } + case "module": { + enableExportProperty(); + const ModuleLibraryPlugin = __webpack_require__(59780); + new ModuleLibraryPlugin({ + type + }).apply(compiler); + break; + } + default: + throw new Error(`Unsupported library type ${type}. +Plugins which provide custom library types must call EnableLibraryPlugin.setEnabled(compiler, type) to disable this error.`); + } + } else { + // TODO support plugin instances here + // apply them to the compiler + } } +} - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const cachedMakePathsRelative = makePathsRelative.bindContextCache( - compiler.context, - compiler.root - ); - compiler.hooks.thisCompilation.tap("SplitChunksPlugin", compilation => { - const logger = compilation.getLogger("webpack.SplitChunksPlugin"); - let alreadyOptimized = false; - compilation.hooks.unseal.tap("SplitChunksPlugin", () => { - alreadyOptimized = false; - }); - compilation.hooks.optimizeChunks.tap( - { - name: "SplitChunksPlugin", - stage: STAGE_ADVANCED - }, - chunks => { - if (alreadyOptimized) return; - alreadyOptimized = true; - logger.time("prepare"); - const chunkGraph = compilation.chunkGraph; - const moduleGraph = compilation.moduleGraph; - // Give each selected chunk an index (to create strings from chunks) - /** @type {Map} */ - const chunkIndexMap = new Map(); - const ZERO = BigInt("0"); - const ONE = BigInt("1"); - const START = ONE << BigInt("31"); - let index = START; - for (const chunk of chunks) { - chunkIndexMap.set( - chunk, - index | BigInt((Math.random() * 0x7fffffff) | 0) - ); - index = index << ONE; - } - /** - * @param {Iterable} chunks list of chunks - * @returns {bigint | Chunk} key of the chunks - */ - const getKey = chunks => { - const iterator = chunks[Symbol.iterator](); - let result = iterator.next(); - if (result.done) return ZERO; - const first = result.value; - result = iterator.next(); - if (result.done) return first; - let key = - chunkIndexMap.get(first) | chunkIndexMap.get(result.value); - while (!(result = iterator.next()).done) { - const raw = chunkIndexMap.get(result.value); - key = key ^ raw; - } - return key; - }; - const keyToString = key => { - if (typeof key === "bigint") return key.toString(16); - return chunkIndexMap.get(key).toString(16); - }; +module.exports = EnableLibraryPlugin; - const getChunkSetsInGraph = memoize(() => { - /** @type {Map>} */ - const chunkSetsInGraph = new Map(); - /** @type {Set} */ - const singleChunkSets = new Set(); - for (const module of compilation.modules) { - const chunks = chunkGraph.getModuleChunksIterable(module); - const chunksKey = getKey(chunks); - if (typeof chunksKey === "bigint") { - if (!chunkSetsInGraph.has(chunksKey)) { - chunkSetsInGraph.set(chunksKey, new Set(chunks)); - } - } else { - singleChunkSets.add(chunksKey); - } - } - return { chunkSetsInGraph, singleChunkSets }; - }); - /** - * @param {Module} module the module - * @returns {Iterable} groups of chunks with equal exports - */ - const groupChunksByExports = module => { - const exportsInfo = moduleGraph.getExportsInfo(module); - const groupedByUsedExports = new Map(); - for (const chunk of chunkGraph.getModuleChunksIterable(module)) { - const key = exportsInfo.getUsageKey(chunk.runtime); - const list = groupedByUsedExports.get(key); - if (list !== undefined) { - list.push(chunk); - } else { - groupedByUsedExports.set(key, [chunk]); - } - } - return groupedByUsedExports.values(); - }; +/***/ }), - /** @type {Map>} */ - const groupedByExportsMap = new Map(); +/***/ 5487: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const getExportsChunkSetsInGraph = memoize(() => { - /** @type {Map>} */ - const chunkSetsInGraph = new Map(); - /** @type {Set} */ - const singleChunkSets = new Set(); - for (const module of compilation.modules) { - const groupedChunks = Array.from(groupChunksByExports(module)); - groupedByExportsMap.set(module, groupedChunks); - for (const chunks of groupedChunks) { - if (chunks.length === 1) { - singleChunkSets.add(chunks[0]); - } else { - const chunksKey = /** @type {bigint} */ (getKey(chunks)); - if (!chunkSetsInGraph.has(chunksKey)) { - chunkSetsInGraph.set(chunksKey, new Set(chunks)); - } - } - } - } - return { chunkSetsInGraph, singleChunkSets }; - }); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // group these set of chunks by count - // to allow to check less sets via isSubset - // (only smaller sets can be subset) - const groupChunkSetsByCount = chunkSets => { - /** @type {Map>>} */ - const chunkSetsByCount = new Map(); - for (const chunksSet of chunkSets) { - const count = chunksSet.size; - let array = chunkSetsByCount.get(count); - if (array === undefined) { - array = []; - chunkSetsByCount.set(count, array); - } - array.push(chunksSet); - } - return chunkSetsByCount; - }; - const getChunkSetsByCount = memoize(() => - groupChunkSetsByCount( - getChunkSetsInGraph().chunkSetsInGraph.values() - ) - ); - const getExportsChunkSetsByCount = memoize(() => - groupChunkSetsByCount( - getExportsChunkSetsInGraph().chunkSetsInGraph.values() - ) - ); - // Create a list of possible combinations - const createGetCombinations = ( - chunkSets, - singleChunkSets, - chunkSetsByCount - ) => { - /** @type {Map | Chunk)[]>} */ - const combinationsCache = new Map(); - return key => { - const cacheEntry = combinationsCache.get(key); - if (cacheEntry !== undefined) return cacheEntry; - if (key instanceof Chunk) { - const result = [key]; - combinationsCache.set(key, result); - return result; - } - const chunksSet = chunkSets.get(key); - /** @type {(Set | Chunk)[]} */ - const array = [chunksSet]; - for (const [count, setArray] of chunkSetsByCount) { - // "equal" is not needed because they would have been merge in the first step - if (count < chunksSet.size) { - for (const set of setArray) { - if (isSubset(chunksSet, set)) { - array.push(set); - } - } - } - } - for (const chunk of singleChunkSets) { - if (chunksSet.has(chunk)) { - array.push(chunk); - } - } - combinationsCache.set(key, array); - return array; - }; - }; +const { ConcatSource } = __webpack_require__(51255); +const { UsageState } = __webpack_require__(63686); +const propertyAccess = __webpack_require__(54190); +const { getEntryRuntime } = __webpack_require__(17156); +const AbstractLibraryPlugin = __webpack_require__(26030); - const getCombinationsFactory = memoize(() => { - const { chunkSetsInGraph, singleChunkSets } = getChunkSetsInGraph(); - return createGetCombinations( - chunkSetsInGraph, - singleChunkSets, - getChunkSetsByCount() - ); - }); - const getCombinations = key => getCombinationsFactory()(key); +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */ +/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ - const getExportsCombinationsFactory = memoize(() => { - const { chunkSetsInGraph, singleChunkSets } = - getExportsChunkSetsInGraph(); - return createGetCombinations( - chunkSetsInGraph, - singleChunkSets, - getExportsChunkSetsByCount() - ); - }); - const getExportsCombinations = key => - getExportsCombinationsFactory()(key); +/** + * @typedef {Object} ExportPropertyLibraryPluginParsed + * @property {string | string[]} export + */ - /** - * @typedef {Object} SelectedChunksResult - * @property {Chunk[]} chunks the list of chunks - * @property {bigint | Chunk} key a key of the list - */ +/** + * @typedef {Object} ExportPropertyLibraryPluginOptions + * @property {LibraryType} type + * @property {boolean} nsObjectUsed the namespace object is used + */ +/** + * @typedef {ExportPropertyLibraryPluginParsed} T + * @extends {AbstractLibraryPlugin} + */ +class ExportPropertyLibraryPlugin extends AbstractLibraryPlugin { + /** + * @param {ExportPropertyLibraryPluginOptions} options options + */ + constructor({ type, nsObjectUsed }) { + super({ + pluginName: "ExportPropertyLibraryPlugin", + type + }); + this.nsObjectUsed = nsObjectUsed; + } - /** @type {WeakMap | Chunk, WeakMap>} */ - const selectedChunksCacheByChunksSet = new WeakMap(); + /** + * @param {LibraryOptions} library normalized library option + * @returns {T | false} preprocess as needed by overriding + */ + parseOptions(library) { + return { + export: library.export + }; + } - /** - * get list and key by applying the filter function to the list - * It is cached for performance reasons - * @param {Set | Chunk} chunks list of chunks - * @param {ChunkFilterFunction} chunkFilter filter function for chunks - * @returns {SelectedChunksResult} list and key - */ - const getSelectedChunks = (chunks, chunkFilter) => { - let entry = selectedChunksCacheByChunksSet.get(chunks); - if (entry === undefined) { - entry = new WeakMap(); - selectedChunksCacheByChunksSet.set(chunks, entry); - } - /** @type {SelectedChunksResult} */ - let entry2 = entry.get(chunkFilter); - if (entry2 === undefined) { - /** @type {Chunk[]} */ - const selectedChunks = []; - if (chunks instanceof Chunk) { - if (chunkFilter(chunks)) selectedChunks.push(chunks); - } else { - for (const chunk of chunks) { - if (chunkFilter(chunk)) selectedChunks.push(chunk); - } - } - entry2 = { - chunks: selectedChunks, - key: getKey(selectedChunks) - }; - entry.set(chunkFilter, entry2); - } - return entry2; - }; + /** + * @param {Module} module the exporting entry module + * @param {string} entryName the name of the entrypoint + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + finishEntryModule( + module, + entryName, + { options, compilation, compilation: { moduleGraph } } + ) { + const runtime = getEntryRuntime(compilation, entryName); + if (options.export) { + const exportsInfo = moduleGraph.getExportInfo( + module, + Array.isArray(options.export) ? options.export[0] : options.export + ); + exportsInfo.setUsed(UsageState.Used, runtime); + exportsInfo.canMangleUse = false; + } else { + const exportsInfo = moduleGraph.getExportsInfo(module); + if (this.nsObjectUsed) { + exportsInfo.setUsedInUnknownWay(runtime); + } else { + exportsInfo.setAllKnownExportsUsed(runtime); + } + } + moduleGraph.addExtraReason(module, "used as library export"); + } - /** @type {Map} */ - const alreadyValidatedParents = new Map(); - /** @type {Set} */ - const alreadyReportedErrors = new Set(); + /** + * @param {Chunk} chunk the chunk + * @param {Set} set runtime requirements + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + runtimeRequirements(chunk, set, libraryContext) {} - // Map a list of chunks to a list of modules - // For the key the chunk "index" is used, the value is a SortableSet of modules - /** @type {Map} */ - const chunksInfoMap = new Map(); + /** + * @param {Source} source source + * @param {Module} module module + * @param {StartupRenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + renderStartup(source, module, renderContext, { options }) { + if (!options.export) return source; + const postfix = `__webpack_exports__ = __webpack_exports__${propertyAccess( + Array.isArray(options.export) ? options.export : [options.export] + )};\n`; + return new ConcatSource(source, postfix); + } +} - /** - * @param {CacheGroup} cacheGroup the current cache group - * @param {number} cacheGroupIndex the index of the cache group of ordering - * @param {Chunk[]} selectedChunks chunks selected for this module - * @param {bigint | Chunk} selectedChunksKey a key of selectedChunks - * @param {Module} module the current module - * @returns {void} - */ - const addModuleToChunksInfoMap = ( - cacheGroup, - cacheGroupIndex, - selectedChunks, - selectedChunksKey, - module - ) => { - // Break if minimum number of chunks is not reached - if (selectedChunks.length < cacheGroup.minChunks) return; - // Determine name for split chunk - const name = cacheGroup.getName( - module, - selectedChunks, - cacheGroup.key - ); - // Check if the name is ok - const existingChunk = compilation.namedChunks.get(name); - if (existingChunk) { - const parentValidationKey = `${name}|${ - typeof selectedChunksKey === "bigint" - ? selectedChunksKey - : selectedChunksKey.debugId - }`; - const valid = alreadyValidatedParents.get(parentValidationKey); - if (valid === false) return; - if (valid === undefined) { - // Module can only be moved into the existing chunk if the existing chunk - // is a parent of all selected chunks - let isInAllParents = true; - /** @type {Set} */ - const queue = new Set(); - for (const chunk of selectedChunks) { - for (const group of chunk.groupsIterable) { - queue.add(group); - } - } - for (const group of queue) { - if (existingChunk.isInGroup(group)) continue; - let hasParent = false; - for (const parent of group.parentsIterable) { - hasParent = true; - queue.add(parent); - } - if (!hasParent) { - isInAllParents = false; - } - } - const valid = isInAllParents; - alreadyValidatedParents.set(parentValidationKey, valid); - if (!valid) { - if (!alreadyReportedErrors.has(name)) { - alreadyReportedErrors.add(name); - compilation.errors.push( - new WebpackError( - "SplitChunksPlugin\n" + - `Cache group "${cacheGroup.key}" conflicts with existing chunk.\n` + - `Both have the same name "${name}" and existing chunk is not a parent of the selected modules.\n` + - "Use a different name for the cache group or make sure that the existing chunk is a parent (e. g. via dependOn).\n" + - 'HINT: You can omit "name" to automatically create a name.\n' + - "BREAKING CHANGE: webpack < 5 used to allow to use an entrypoint as splitChunk. " + - "This is no longer allowed when the entrypoint is not a parent of the selected modules.\n" + - "Remove this entrypoint and add modules to cache group's 'test' instead. " + - "If you need modules to be evaluated on startup, add them to the existing entrypoints (make them arrays). " + - "See migration guide of more info." - ) - ); - } - return; - } - } - } - // Create key for maps - // When it has a name we use the name as key - // Otherwise we create the key from chunks and cache group key - // This automatically merges equal names - const key = - cacheGroup.key + - (name - ? ` name:${name}` - : ` chunks:${keyToString(selectedChunksKey)}`); - // Add module to maps - let info = chunksInfoMap.get(key); - if (info === undefined) { - chunksInfoMap.set( - key, - (info = { - modules: new SortableSet( - undefined, - compareModulesByIdentifier - ), - cacheGroup, - cacheGroupIndex, - name, - sizes: {}, - chunks: new Set(), - reuseableChunks: new Set(), - chunksKeys: new Set() - }) - ); - } - const oldSize = info.modules.size; - info.modules.add(module); - if (info.modules.size !== oldSize) { - for (const type of module.getSourceTypes()) { - info.sizes[type] = (info.sizes[type] || 0) + module.size(type); - } - } - const oldChunksKeysSize = info.chunksKeys.size; - info.chunksKeys.add(selectedChunksKey); - if (oldChunksKeysSize !== info.chunksKeys.size) { - for (const chunk of selectedChunks) { - info.chunks.add(chunk); - } - } - }; +module.exports = ExportPropertyLibraryPlugin; + + +/***/ }), + +/***/ 84415: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const context = { - moduleGraph, - chunkGraph - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - logger.timeEnd("prepare"); - logger.time("modules"); - // Walk through all modules - for (const module of compilation.modules) { - // Get cache group - let cacheGroups = this.options.getCacheGroups(module, context); - if (!Array.isArray(cacheGroups) || cacheGroups.length === 0) { - continue; - } +const { ConcatSource } = __webpack_require__(51255); +const AbstractLibraryPlugin = __webpack_require__(26030); - // Prepare some values (usedExports = false) - const getCombs = memoize(() => { - const chunks = chunkGraph.getModuleChunksIterable(module); - const chunksKey = getKey(chunks); - return getCombinations(chunksKey); - }); +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ +/** @typedef {import("../util/Hash")} Hash */ +/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ - // Prepare some values (usedExports = true) - const getCombsByUsedExports = memoize(() => { - // fill the groupedByExportsMap - getExportsChunkSetsInGraph(); - /** @type {Set | Chunk>} */ - const set = new Set(); - const groupedByUsedExports = groupedByExportsMap.get(module); - for (const chunks of groupedByUsedExports) { - const chunksKey = getKey(chunks); - for (const comb of getExportsCombinations(chunksKey)) - set.add(comb); - } - return set; - }); +/** + * @typedef {Object} JsonpLibraryPluginOptions + * @property {LibraryType} type + */ - let cacheGroupIndex = 0; - for (const cacheGroupSource of cacheGroups) { - const cacheGroup = this._getCacheGroup(cacheGroupSource); +/** + * @typedef {Object} JsonpLibraryPluginParsed + * @property {string} name + */ - const combs = cacheGroup.usedExports - ? getCombsByUsedExports() - : getCombs(); - // For all combination of chunk selection - for (const chunkCombination of combs) { - // Break if minimum number of chunks is not reached - const count = - chunkCombination instanceof Chunk ? 1 : chunkCombination.size; - if (count < cacheGroup.minChunks) continue; - // Select chunks by configuration - const { chunks: selectedChunks, key: selectedChunksKey } = - getSelectedChunks(chunkCombination, cacheGroup.chunksFilter); +/** + * @typedef {JsonpLibraryPluginParsed} T + * @extends {AbstractLibraryPlugin} + */ +class JsonpLibraryPlugin extends AbstractLibraryPlugin { + /** + * @param {JsonpLibraryPluginOptions} options the plugin options + */ + constructor(options) { + super({ + pluginName: "JsonpLibraryPlugin", + type: options.type + }); + } - addModuleToChunksInfoMap( - cacheGroup, - cacheGroupIndex, - selectedChunks, - selectedChunksKey, - module - ); - } - cacheGroupIndex++; - } - } + /** + * @param {LibraryOptions} library normalized library option + * @returns {T | false} preprocess as needed by overriding + */ + parseOptions(library) { + const { name } = library; + if (typeof name !== "string") { + throw new Error( + `Jsonp library name must be a simple string. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` + ); + } + return { + name: /** @type {string} */ (name) + }; + } - logger.timeEnd("modules"); + /** + * @param {Source} source source + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + render(source, { chunk }, { options, compilation }) { + const name = compilation.getPath(options.name, { + chunk + }); + return new ConcatSource(`${name}(`, source, ")"); + } - logger.time("queue"); + /** + * @param {Chunk} chunk the chunk + * @param {Hash} hash hash + * @param {ChunkHashContext} chunkHashContext chunk hash context + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + chunkHash(chunk, hash, chunkHashContext, { options, compilation }) { + hash.update("JsonpLibraryPlugin"); + hash.update(compilation.getPath(options.name, { chunk })); + } +} - /** - * @param {ChunksInfoItem} info entry - * @param {string[]} sourceTypes source types to be removed - */ - const removeModulesWithSourceType = (info, sourceTypes) => { - for (const module of info.modules) { - const types = module.getSourceTypes(); - if (sourceTypes.some(type => types.has(type))) { - info.modules.delete(module); - for (const type of types) { - info.sizes[type] -= module.size(type); - } - } - } - }; +module.exports = JsonpLibraryPlugin; - /** - * @param {ChunksInfoItem} info entry - * @returns {boolean} true, if entry become empty - */ - const removeMinSizeViolatingModules = info => { - if (!info.cacheGroup._validateSize) return false; - const violatingSizes = getViolatingMinSizes( - info.sizes, - info.cacheGroup.minSize - ); - if (violatingSizes === undefined) return false; - removeModulesWithSourceType(info, violatingSizes); - return info.modules.size === 0; - }; - // Filter items were size < minSize - for (const [key, info] of chunksInfoMap) { - if (removeMinSizeViolatingModules(info)) { - chunksInfoMap.delete(key); - } else if ( - !checkMinSizeReduction( - info.sizes, - info.cacheGroup.minSizeReduction, - info.chunks.size - ) - ) { - chunksInfoMap.delete(key); - } - } +/***/ }), - /** - * @typedef {Object} MaxSizeQueueItem - * @property {SplitChunksSizes} minSize - * @property {SplitChunksSizes} maxAsyncSize - * @property {SplitChunksSizes} maxInitialSize - * @property {string} automaticNameDelimiter - * @property {string[]} keys - */ +/***/ 59780: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** @type {Map} */ - const maxSizeQueueMap = new Map(); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - while (chunksInfoMap.size > 0) { - // Find best matching entry - let bestEntryKey; - let bestEntry; - for (const pair of chunksInfoMap) { - const key = pair[0]; - const info = pair[1]; - if ( - bestEntry === undefined || - compareEntries(bestEntry, info) < 0 - ) { - bestEntry = info; - bestEntryKey = key; - } - } - const item = bestEntry; - chunksInfoMap.delete(bestEntryKey); - let chunkName = item.name; - // Variable for the new chunk (lazy created) - /** @type {Chunk} */ - let newChunk; - // When no chunk name, check if we can reuse a chunk instead of creating a new one - let isExistingChunk = false; - let isReusedWithAllModules = false; - if (chunkName) { - const chunkByName = compilation.namedChunks.get(chunkName); - if (chunkByName !== undefined) { - newChunk = chunkByName; - const oldSize = item.chunks.size; - item.chunks.delete(newChunk); - isExistingChunk = item.chunks.size !== oldSize; - } - } else if (item.cacheGroup.reuseExistingChunk) { - outer: for (const chunk of item.chunks) { - if ( - chunkGraph.getNumberOfChunkModules(chunk) !== - item.modules.size - ) { - continue; - } - if ( - item.chunks.size > 1 && - chunkGraph.getNumberOfEntryModules(chunk) > 0 - ) { - continue; - } - for (const module of item.modules) { - if (!chunkGraph.isModuleInChunk(module, chunk)) { - continue outer; - } - } - if (!newChunk || !newChunk.name) { - newChunk = chunk; - } else if ( - chunk.name && - chunk.name.length < newChunk.name.length - ) { - newChunk = chunk; - } else if ( - chunk.name && - chunk.name.length === newChunk.name.length && - chunk.name < newChunk.name - ) { - newChunk = chunk; - } - } - if (newChunk) { - item.chunks.delete(newChunk); - chunkName = undefined; - isExistingChunk = true; - isReusedWithAllModules = true; - } - } +const { ConcatSource } = __webpack_require__(51255); +const Template = __webpack_require__(39722); +const propertyAccess = __webpack_require__(54190); +const AbstractLibraryPlugin = __webpack_require__(26030); - const enforced = - item.cacheGroup._conditionalEnforce && - checkMinSize(item.sizes, item.cacheGroup.enforceSizeThreshold); +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */ +/** @typedef {import("../util/Hash")} Hash */ +/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ - const usedChunks = new Set(item.chunks); +/** + * @typedef {Object} ModuleLibraryPluginOptions + * @property {LibraryType} type + */ - // Check if maxRequests condition can be fulfilled - if ( - !enforced && - (Number.isFinite(item.cacheGroup.maxInitialRequests) || - Number.isFinite(item.cacheGroup.maxAsyncRequests)) - ) { - for (const chunk of usedChunks) { - // respect max requests - const maxRequests = chunk.isOnlyInitial() - ? item.cacheGroup.maxInitialRequests - : chunk.canBeInitial() - ? Math.min( - item.cacheGroup.maxInitialRequests, - item.cacheGroup.maxAsyncRequests - ) - : item.cacheGroup.maxAsyncRequests; - if ( - isFinite(maxRequests) && - getRequests(chunk) >= maxRequests - ) { - usedChunks.delete(chunk); - } - } - } +/** + * @typedef {Object} ModuleLibraryPluginParsed + * @property {string} name + */ - outer: for (const chunk of usedChunks) { - for (const module of item.modules) { - if (chunkGraph.isModuleInChunk(module, chunk)) continue outer; - } - usedChunks.delete(chunk); - } +/** + * @typedef {ModuleLibraryPluginParsed} T + * @extends {AbstractLibraryPlugin} + */ +class ModuleLibraryPlugin extends AbstractLibraryPlugin { + /** + * @param {ModuleLibraryPluginOptions} options the plugin options + */ + constructor(options) { + super({ + pluginName: "ModuleLibraryPlugin", + type: options.type + }); + } - // Were some (invalid) chunks removed from usedChunks? - // => readd all modules to the queue, as things could have been changed - if (usedChunks.size < item.chunks.size) { - if (isExistingChunk) usedChunks.add(newChunk); - if (usedChunks.size >= item.cacheGroup.minChunks) { - const chunksArr = Array.from(usedChunks); - for (const module of item.modules) { - addModuleToChunksInfoMap( - item.cacheGroup, - item.cacheGroupIndex, - chunksArr, - getKey(usedChunks), - module - ); - } - } - continue; - } + /** + * @param {LibraryOptions} library normalized library option + * @returns {T | false} preprocess as needed by overriding + */ + parseOptions(library) { + const { name } = library; + if (name) { + throw new Error( + `Library name must be unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` + ); + } + return { + name: /** @type {string} */ (name) + }; + } + + /** + * @param {Source} source source + * @param {Module} module module + * @param {StartupRenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + renderStartup( + source, + module, + { moduleGraph, chunk }, + { options, compilation } + ) { + const result = new ConcatSource(source); + const exportsInfo = moduleGraph.getExportsInfo(module); + const exports = []; + const isAsync = moduleGraph.isAsync(module); + if (isAsync) { + result.add(`__webpack_exports__ = await __webpack_exports__;\n`); + } + for (const exportInfo of exportsInfo.orderedExports) { + if (!exportInfo.provided) continue; + const varName = `__webpack_exports__${Template.toIdentifier( + exportInfo.name + )}`; + result.add( + `var ${varName} = __webpack_exports__${propertyAccess([ + exportInfo.getUsedName(exportInfo.name, chunk.runtime) + ])};\n` + ); + exports.push(`${varName} as ${exportInfo.name}`); + } + if (exports.length > 0) { + result.add(`export { ${exports.join(", ")} };\n`); + } + return result; + } +} + +module.exports = ModuleLibraryPlugin; + + +/***/ }), + +/***/ 11707: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Joel Denning @joeldenning +*/ + + + +const { ConcatSource } = __webpack_require__(51255); +const { UsageState } = __webpack_require__(63686); +const ExternalModule = __webpack_require__(73071); +const Template = __webpack_require__(39722); +const propertyAccess = __webpack_require__(54190); +const AbstractLibraryPlugin = __webpack_require__(26030); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ +/** @typedef {import("../util/Hash")} Hash */ +/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ + +/** + * @typedef {Object} SystemLibraryPluginOptions + * @property {LibraryType} type + */ + +/** + * @typedef {Object} SystemLibraryPluginParsed + * @property {string} name + */ + +/** + * @typedef {SystemLibraryPluginParsed} T + * @extends {AbstractLibraryPlugin} + */ +class SystemLibraryPlugin extends AbstractLibraryPlugin { + /** + * @param {SystemLibraryPluginOptions} options the plugin options + */ + constructor(options) { + super({ + pluginName: "SystemLibraryPlugin", + type: options.type + }); + } + + /** + * @param {LibraryOptions} library normalized library option + * @returns {T | false} preprocess as needed by overriding + */ + parseOptions(library) { + const { name } = library; + if (name && typeof name !== "string") { + throw new Error( + `System.js library name must be a simple string or unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` + ); + } + return { + name: /** @type {string=} */ (name) + }; + } + + /** + * @param {Source} source source + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + render(source, { chunkGraph, moduleGraph, chunk }, { options, compilation }) { + const modules = chunkGraph + .getChunkModules(chunk) + .filter(m => m instanceof ExternalModule && m.externalType === "system"); + const externals = /** @type {ExternalModule[]} */ (modules); + + // The name this bundle should be registered as with System + const name = options.name + ? `${JSON.stringify(compilation.getPath(options.name, { chunk }))}, ` + : ""; + + // The array of dependencies that are external to webpack and will be provided by System + const systemDependencies = JSON.stringify( + externals.map(m => + typeof m.request === "object" && !Array.isArray(m.request) + ? m.request.amd + : m.request + ) + ); - // Validate minRemainingSize constraint when a single chunk is left over - if ( - !enforced && - item.cacheGroup._validateRemainingSize && - usedChunks.size === 1 - ) { - const [chunk] = usedChunks; - let chunkSizes = Object.create(null); - for (const module of chunkGraph.getChunkModulesIterable(chunk)) { - if (!item.modules.has(module)) { - for (const type of module.getSourceTypes()) { - chunkSizes[type] = - (chunkSizes[type] || 0) + module.size(type); - } - } - } - const violatingSizes = getViolatingMinSizes( - chunkSizes, - item.cacheGroup.minRemainingSize - ); - if (violatingSizes !== undefined) { - const oldModulesSize = item.modules.size; - removeModulesWithSourceType(item, violatingSizes); - if ( - item.modules.size > 0 && - item.modules.size !== oldModulesSize - ) { - // queue this item again to be processed again - // without violating modules - chunksInfoMap.set(bestEntryKey, item); - } - continue; - } - } + // The name of the variable provided by System for exporting + const dynamicExport = "__WEBPACK_DYNAMIC_EXPORT__"; - // Create the new chunk if not reusing one - if (newChunk === undefined) { - newChunk = compilation.addChunk(chunkName); - } - // Walk through all chunks - for (const chunk of usedChunks) { - // Add graph connections for splitted chunk - chunk.split(newChunk); - } + // An array of the internal variable names for the webpack externals + const externalWebpackNames = externals.map( + m => + `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( + `${chunkGraph.getModuleId(m)}` + )}__` + ); - // Add a note to the chunk - newChunk.chunkReason = - (newChunk.chunkReason ? newChunk.chunkReason + ", " : "") + - (isReusedWithAllModules - ? "reused as split chunk" - : "split chunk"); - if (item.cacheGroup.key) { - newChunk.chunkReason += ` (cache group: ${item.cacheGroup.key})`; - } - if (chunkName) { - newChunk.chunkReason += ` (name: ${chunkName})`; - } - if (item.cacheGroup.filename) { - newChunk.filenameTemplate = item.cacheGroup.filename; - } - if (item.cacheGroup.idHint) { - newChunk.idNameHints.add(item.cacheGroup.idHint); - } - if (!isReusedWithAllModules) { - // Add all modules to the new chunk - for (const module of item.modules) { - if (!module.chunkCondition(newChunk, compilation)) continue; - // Add module to new chunk - chunkGraph.connectChunkAndModule(newChunk, module); - // Remove module from used chunks - for (const chunk of usedChunks) { - chunkGraph.disconnectChunkAndModule(chunk, module); - } - } - } else { - // Remove all modules from used chunks - for (const module of item.modules) { - for (const chunk of usedChunks) { - chunkGraph.disconnectChunkAndModule(chunk, module); - } - } - } + // Declaring variables for the internal variable names for the webpack externals + const externalVarDeclarations = externalWebpackNames + .map(name => `var ${name} = {};`) + .join("\n"); - if ( - Object.keys(item.cacheGroup.maxAsyncSize).length > 0 || - Object.keys(item.cacheGroup.maxInitialSize).length > 0 - ) { - const oldMaxSizeSettings = maxSizeQueueMap.get(newChunk); - maxSizeQueueMap.set(newChunk, { - minSize: oldMaxSizeSettings - ? combineSizes( - oldMaxSizeSettings.minSize, - item.cacheGroup._minSizeForMaxSize, - Math.max - ) - : item.cacheGroup.minSize, - maxAsyncSize: oldMaxSizeSettings - ? combineSizes( - oldMaxSizeSettings.maxAsyncSize, - item.cacheGroup.maxAsyncSize, - Math.min - ) - : item.cacheGroup.maxAsyncSize, - maxInitialSize: oldMaxSizeSettings - ? combineSizes( - oldMaxSizeSettings.maxInitialSize, - item.cacheGroup.maxInitialSize, - Math.min - ) - : item.cacheGroup.maxInitialSize, - automaticNameDelimiter: item.cacheGroup.automaticNameDelimiter, - keys: oldMaxSizeSettings - ? oldMaxSizeSettings.keys.concat(item.cacheGroup.key) - : [item.cacheGroup.key] - }); - } + // Define __esModule flag on all internal variables and helpers + const externalVarInitialization = []; - // remove all modules from other entries and update size - for (const [key, info] of chunksInfoMap) { - if (isOverlap(info.chunks, usedChunks)) { - // update modules and total size - // may remove it from the map when < minSize - let updated = false; - for (const module of item.modules) { - if (info.modules.has(module)) { - // remove module - info.modules.delete(module); - // update size - for (const key of module.getSourceTypes()) { - info.sizes[key] -= module.size(key); + // The system.register format requires an array of setter functions for externals. + const setters = + externalWebpackNames.length === 0 + ? "" + : Template.asString([ + "setters: [", + Template.indent( + externals + .map((module, i) => { + const external = externalWebpackNames[i]; + const exportsInfo = moduleGraph.getExportsInfo(module); + const otherUnused = + exportsInfo.otherExportsInfo.getUsed(chunk.runtime) === + UsageState.Unused; + const instructions = []; + const handledNames = []; + for (const exportInfo of exportsInfo.orderedExports) { + const used = exportInfo.getUsedName( + undefined, + chunk.runtime + ); + if (used) { + if (otherUnused || used !== exportInfo.name) { + instructions.push( + `${external}${propertyAccess([ + used + ])} = module${propertyAccess([exportInfo.name])};` + ); + handledNames.push(exportInfo.name); + } + } else { + handledNames.push(exportInfo.name); } - updated = true; - } - } - if (updated) { - if (info.modules.size === 0) { - chunksInfoMap.delete(key); - continue; } - if ( - removeMinSizeViolatingModules(info) || - !checkMinSizeReduction( - info.sizes, - info.cacheGroup.minSizeReduction, - info.chunks.size - ) - ) { - chunksInfoMap.delete(key); - continue; + if (!otherUnused) { + if ( + !Array.isArray(module.request) || + module.request.length === 1 + ) { + externalVarInitialization.push( + `Object.defineProperty(${external}, "__esModule", { value: true });` + ); + } + if (handledNames.length > 0) { + const name = `${external}handledNames`; + externalVarInitialization.push( + `var ${name} = ${JSON.stringify(handledNames)};` + ); + instructions.push( + Template.asString([ + "Object.keys(module).forEach(function(key) {", + Template.indent([ + `if(${name}.indexOf(key) >= 0)`, + Template.indent(`${external}[key] = module[key];`) + ]), + "});" + ]) + ); + } else { + instructions.push( + Template.asString([ + "Object.keys(module).forEach(function(key) {", + Template.indent([`${external}[key] = module[key];`]), + "});" + ]) + ); + } } - } - } - } - } - - logger.timeEnd("queue"); - - logger.time("maxSize"); - - /** @type {Set} */ - const incorrectMinMaxSizeSet = new Set(); + if (instructions.length === 0) return "function() {}"; + return Template.asString([ + "function(module) {", + Template.indent(instructions), + "}" + ]); + }) + .join(",\n") + ), + "]," + ]); - const { outputOptions } = compilation; + return new ConcatSource( + Template.asString([ + `System.register(${name}${systemDependencies}, function(${dynamicExport}, __system_context__) {`, + Template.indent([ + externalVarDeclarations, + Template.asString(externalVarInitialization), + "return {", + Template.indent([ + setters, + "execute: function() {", + Template.indent(`${dynamicExport}(`) + ]) + ]), + "" + ]), + source, + Template.asString([ + "", + Template.indent([ + Template.indent([Template.indent([");"]), "}"]), + "};" + ]), + "})" + ]) + ); + } - // Make sure that maxSize is fulfilled - const { fallbackCacheGroup } = this.options; - for (const chunk of Array.from(compilation.chunks)) { - const chunkConfig = maxSizeQueueMap.get(chunk); - const { - minSize, - maxAsyncSize, - maxInitialSize, - automaticNameDelimiter - } = chunkConfig || fallbackCacheGroup; - if (!chunkConfig && !fallbackCacheGroup.chunksFilter(chunk)) - continue; - /** @type {SplitChunksSizes} */ - let maxSize; - if (chunk.isOnlyInitial()) { - maxSize = maxInitialSize; - } else if (chunk.canBeInitial()) { - maxSize = combineSizes(maxAsyncSize, maxInitialSize, Math.min); - } else { - maxSize = maxAsyncSize; - } - if (Object.keys(maxSize).length === 0) { - continue; - } - for (const key of Object.keys(maxSize)) { - const maxSizeValue = maxSize[key]; - const minSizeValue = minSize[key]; - if ( - typeof minSizeValue === "number" && - minSizeValue > maxSizeValue - ) { - const keys = chunkConfig && chunkConfig.keys; - const warningKey = `${ - keys && keys.join() - } ${minSizeValue} ${maxSizeValue}`; - if (!incorrectMinMaxSizeSet.has(warningKey)) { - incorrectMinMaxSizeSet.add(warningKey); - compilation.warnings.push( - new MinMaxSizeWarning(keys, minSizeValue, maxSizeValue) - ); - } - } - } - const results = deterministicGroupingForModules({ - minSize, - maxSize: mapObject(maxSize, (value, key) => { - const minSizeValue = minSize[key]; - return typeof minSizeValue === "number" - ? Math.max(value, minSizeValue) - : value; - }), - items: chunkGraph.getChunkModulesIterable(chunk), - getKey(module) { - const cache = getKeyCache.get(module); - if (cache !== undefined) return cache; - const ident = cachedMakePathsRelative(module.identifier()); - const nameForCondition = - module.nameForCondition && module.nameForCondition(); - const name = nameForCondition - ? cachedMakePathsRelative(nameForCondition) - : ident.replace(/^.*!|\?[^?!]*$/g, ""); - const fullKey = - name + - automaticNameDelimiter + - hashFilename(ident, outputOptions); - const key = requestToId(fullKey); - getKeyCache.set(module, key); - return key; - }, - getSize(module) { - const size = Object.create(null); - for (const key of module.getSourceTypes()) { - size[key] = module.size(key); - } - return size; - } - }); - if (results.length <= 1) { - continue; - } - for (let i = 0; i < results.length; i++) { - const group = results[i]; - const key = this.options.hidePathInfo - ? hashFilename(group.key, outputOptions) - : group.key; - let name = chunk.name - ? chunk.name + automaticNameDelimiter + key - : null; - if (name && name.length > 100) { - name = - name.slice(0, 100) + - automaticNameDelimiter + - hashFilename(name, outputOptions); - } - if (i !== results.length - 1) { - const newPart = compilation.addChunk(name); - chunk.split(newPart); - newPart.chunkReason = chunk.chunkReason; - // Add all modules to the new chunk - for (const module of group.items) { - if (!module.chunkCondition(newPart, compilation)) { - continue; - } - // Add module to new chunk - chunkGraph.connectChunkAndModule(newPart, module); - // Remove module from used chunks - chunkGraph.disconnectChunkAndModule(chunk, module); - } - } else { - // change the chunk to be a part - chunk.name = name; - } - } - } - logger.timeEnd("maxSize"); - } - ); - }); + /** + * @param {Chunk} chunk the chunk + * @param {Hash} hash hash + * @param {ChunkHashContext} chunkHashContext chunk hash context + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + chunkHash(chunk, hash, chunkHashContext, { options, compilation }) { + hash.update("SystemLibraryPlugin"); + if (options.name) { + hash.update(compilation.getPath(options.name, { chunk })); + } } -}; +} + +module.exports = SystemLibraryPlugin; /***/ }), -/***/ 52149: +/***/ 54442: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Sean Larkin @thelarkinn + Author Tobias Koppers @sokra */ -const { formatSize } = __webpack_require__(71070); -const WebpackError = __webpack_require__(53799); +const { ConcatSource, OriginalSource } = __webpack_require__(51255); +const ExternalModule = __webpack_require__(73071); +const Template = __webpack_require__(39722); +const AbstractLibraryPlugin = __webpack_require__(26030); -/** @typedef {import("./SizeLimitsPlugin").AssetDetails} AssetDetails */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryCustomUmdCommentObject} LibraryCustomUmdCommentObject */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryCustomUmdObject} LibraryCustomUmdObject */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryName} LibraryName */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ +/** @typedef {import("../util/Hash")} Hash */ +/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ + +/** + * @param {string[]} accessor the accessor to convert to path + * @returns {string} the path + */ +const accessorToObjectAccess = accessor => { + return accessor.map(a => `[${JSON.stringify(a)}]`).join(""); +}; + +/** + * @param {string|undefined} base the path prefix + * @param {string|string[]} accessor the accessor + * @param {string=} joinWith the element separator + * @returns {string} the path + */ +const accessorAccess = (base, accessor, joinWith = ", ") => { + const accessors = Array.isArray(accessor) ? accessor : [accessor]; + return accessors + .map((_, idx) => { + const a = base + ? base + accessorToObjectAccess(accessors.slice(0, idx + 1)) + : accessors[0] + accessorToObjectAccess(accessors.slice(1, idx + 1)); + if (idx === accessors.length - 1) return a; + if (idx === 0 && base === undefined) + return `${a} = typeof ${a} === "object" ? ${a} : {}`; + return `${a} = ${a} || {}`; + }) + .join(joinWith); +}; + +/** @typedef {string | string[] | LibraryCustomUmdObject} UmdLibraryPluginName */ + +/** + * @typedef {Object} UmdLibraryPluginOptions + * @property {LibraryType} type + * @property {boolean=} optionalAmdExternalAsGlobal + */ + +/** + * @typedef {Object} UmdLibraryPluginParsed + * @property {string | string[]} name + * @property {LibraryCustomUmdObject} names + * @property {string | LibraryCustomUmdCommentObject} auxiliaryComment + * @property {boolean} namedDefine + */ + +/** + * @typedef {UmdLibraryPluginParsed} T + * @extends {AbstractLibraryPlugin} + */ +class UmdLibraryPlugin extends AbstractLibraryPlugin { + /** + * @param {UmdLibraryPluginOptions} options the plugin option + */ + constructor(options) { + super({ + pluginName: "UmdLibraryPlugin", + type: options.type + }); + + this.optionalAmdExternalAsGlobal = options.optionalAmdExternalAsGlobal; + } + + /** + * @param {LibraryOptions} library normalized library option + * @returns {T | false} preprocess as needed by overriding + */ + parseOptions(library) { + /** @type {LibraryName} */ + let name; + /** @type {LibraryCustomUmdObject} */ + let names; + if (typeof library.name === "object" && !Array.isArray(library.name)) { + name = library.name.root || library.name.amd || library.name.commonjs; + names = library.name; + } else { + name = library.name; + const singleName = Array.isArray(name) ? name[0] : name; + names = { + commonjs: singleName, + root: library.name, + amd: singleName + }; + } + return { + name, + names, + auxiliaryComment: library.auxiliaryComment, + namedDefine: library.umdNamedDefine + }; + } -module.exports = class AssetsOverSizeLimitWarning extends WebpackError { /** - * @param {AssetDetails[]} assetsOverSizeLimit the assets - * @param {number} assetLimit the size limit + * @param {Source} source source + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export */ - constructor(assetsOverSizeLimit, assetLimit) { - const assetLists = assetsOverSizeLimit - .map(asset => `\n ${asset.name} (${formatSize(asset.size)})`) - .join(""); - - super(`asset size limit: The following asset(s) exceed the recommended size limit (${formatSize( - assetLimit - )}). -This can impact web performance. -Assets: ${assetLists}`); - - this.name = "AssetsOverSizeLimitWarning"; - this.assets = assetsOverSizeLimit; - } -}; + render( + source, + { chunkGraph, runtimeTemplate, chunk, moduleGraph }, + { options, compilation } + ) { + const modules = chunkGraph + .getChunkModules(chunk) + .filter( + m => + m instanceof ExternalModule && + (m.externalType === "umd" || m.externalType === "umd2") + ); + let externals = /** @type {ExternalModule[]} */ (modules); + /** @type {ExternalModule[]} */ + const optionalExternals = []; + /** @type {ExternalModule[]} */ + let requiredExternals = []; + if (this.optionalAmdExternalAsGlobal) { + for (const m of externals) { + if (m.isOptional(moduleGraph)) { + optionalExternals.push(m); + } else { + requiredExternals.push(m); + } + } + externals = requiredExternals.concat(optionalExternals); + } else { + requiredExternals = externals; + } + const replaceKeys = str => { + return compilation.getPath(str, { + chunk + }); + }; -/***/ }), + const externalsDepsArray = modules => { + return `[${replaceKeys( + modules + .map(m => + JSON.stringify( + typeof m.request === "object" ? m.request.amd : m.request + ) + ) + .join(", ") + )}]`; + }; -/***/ 84229: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + const externalsRootArray = modules => { + return replaceKeys( + modules + .map(m => { + let request = m.request; + if (typeof request === "object") request = request.root; + return `root${accessorToObjectAccess([].concat(request))}`; + }) + .join(", ") + ); + }; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sean Larkin @thelarkinn -*/ + const externalsRequireArray = type => { + return replaceKeys( + externals + .map(m => { + let expr; + let request = m.request; + if (typeof request === "object") { + request = request[type]; + } + if (request === undefined) { + throw new Error( + "Missing external configuration for type:" + type + ); + } + if (Array.isArray(request)) { + expr = `require(${JSON.stringify( + request[0] + )})${accessorToObjectAccess(request.slice(1))}`; + } else { + expr = `require(${JSON.stringify(request)})`; + } + if (m.isOptional(moduleGraph)) { + expr = `(function webpackLoadOptionalExternalModule() { try { return ${expr}; } catch(e) {} }())`; + } + return expr; + }) + .join(", ") + ); + }; + const externalsArguments = modules => { + return modules + .map( + m => + `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( + `${chunkGraph.getModuleId(m)}` + )}__` + ) + .join(", "); + }; + const libraryName = library => { + return JSON.stringify(replaceKeys([].concat(library).pop())); + }; -const { formatSize } = __webpack_require__(71070); -const WebpackError = __webpack_require__(53799); + let amdFactory; + if (optionalExternals.length > 0) { + const wrapperArguments = externalsArguments(requiredExternals); + const factoryArguments = + requiredExternals.length > 0 + ? externalsArguments(requiredExternals) + + ", " + + externalsRootArray(optionalExternals) + : externalsRootArray(optionalExternals); + amdFactory = + `function webpackLoadOptionalExternalModuleAmd(${wrapperArguments}) {\n` + + ` return factory(${factoryArguments});\n` + + " }"; + } else { + amdFactory = "factory"; + } -/** @typedef {import("./SizeLimitsPlugin").EntrypointDetails} EntrypointDetails */ + const { auxiliaryComment, namedDefine, names } = options; -module.exports = class EntrypointsOverSizeLimitWarning extends WebpackError { - /** - * @param {EntrypointDetails[]} entrypoints the entrypoints - * @param {number} entrypointLimit the size limit - */ - constructor(entrypoints, entrypointLimit) { - const entrypointList = entrypoints - .map( - entrypoint => - `\n ${entrypoint.name} (${formatSize( - entrypoint.size - )})\n${entrypoint.files.map(asset => ` ${asset}`).join("\n")}` - ) - .join(""); - super(`entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (${formatSize( - entrypointLimit - )}). This can impact web performance. -Entrypoints:${entrypointList}\n`); + const getAuxiliaryComment = type => { + if (auxiliaryComment) { + if (typeof auxiliaryComment === "string") + return "\t//" + auxiliaryComment + "\n"; + if (auxiliaryComment[type]) + return "\t//" + auxiliaryComment[type] + "\n"; + } + return ""; + }; - this.name = "EntrypointsOverSizeLimitWarning"; - this.entrypoints = entrypoints; + return new ConcatSource( + new OriginalSource( + "(function webpackUniversalModuleDefinition(root, factory) {\n" + + getAuxiliaryComment("commonjs2") + + " if(typeof exports === 'object' && typeof module === 'object')\n" + + " module.exports = factory(" + + externalsRequireArray("commonjs2") + + ");\n" + + getAuxiliaryComment("amd") + + " else if(typeof define === 'function' && define.amd)\n" + + (requiredExternals.length > 0 + ? names.amd && namedDefine === true + ? " define(" + + libraryName(names.amd) + + ", " + + externalsDepsArray(requiredExternals) + + ", " + + amdFactory + + ");\n" + : " define(" + + externalsDepsArray(requiredExternals) + + ", " + + amdFactory + + ");\n" + : names.amd && namedDefine === true + ? " define(" + + libraryName(names.amd) + + ", [], " + + amdFactory + + ");\n" + : " define([], " + amdFactory + ");\n") + + (names.root || names.commonjs + ? getAuxiliaryComment("commonjs") + + " else if(typeof exports === 'object')\n" + + " exports[" + + libraryName(names.commonjs || names.root) + + "] = factory(" + + externalsRequireArray("commonjs") + + ");\n" + + getAuxiliaryComment("root") + + " else\n" + + " " + + replaceKeys( + accessorAccess("root", names.root || names.commonjs) + ) + + " = factory(" + + externalsRootArray(externals) + + ");\n" + : " else {\n" + + (externals.length > 0 + ? " var a = typeof exports === 'object' ? factory(" + + externalsRequireArray("commonjs") + + ") : factory(" + + externalsRootArray(externals) + + ");\n" + : " var a = factory();\n") + + " for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n" + + " }\n") + + `})(${ + runtimeTemplate.outputOptions.globalObject + }, function(${externalsArguments(externals)}) {\nreturn `, + "webpack/universalModuleDefinition" + ), + source, + ";\n})" + ); } -}; +} + +module.exports = UmdLibraryPlugin; /***/ }), -/***/ 17791: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 32597: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Sean Larkin @thelarkinn + Author Tobias Koppers @sokra */ -const WebpackError = __webpack_require__(53799); - -module.exports = class NoAsyncChunksWarning extends WebpackError { - constructor() { - super( - "webpack performance recommendations: \n" + - "You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.\n" + - "For more info visit https://webpack.js.org/guides/code-splitting/" - ); - - this.name = "NoAsyncChunksWarning"; - } -}; - - -/***/ }), - -/***/ 32557: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sean Larkin @thelarkinn -*/ +const LogType = Object.freeze({ + error: /** @type {"error"} */ ("error"), // message, c style arguments + warn: /** @type {"warn"} */ ("warn"), // message, c style arguments + info: /** @type {"info"} */ ("info"), // message, c style arguments + log: /** @type {"log"} */ ("log"), // message, c style arguments + debug: /** @type {"debug"} */ ("debug"), // message, c style arguments + trace: /** @type {"trace"} */ ("trace"), // no arguments + group: /** @type {"group"} */ ("group"), // [label] + groupCollapsed: /** @type {"groupCollapsed"} */ ("groupCollapsed"), // [label] + groupEnd: /** @type {"groupEnd"} */ ("groupEnd"), // [label] -const { find } = __webpack_require__(93347); -const AssetsOverSizeLimitWarning = __webpack_require__(52149); -const EntrypointsOverSizeLimitWarning = __webpack_require__(84229); -const NoAsyncChunksWarning = __webpack_require__(17791); + profile: /** @type {"profile"} */ ("profile"), // [profileName] + profileEnd: /** @type {"profileEnd"} */ ("profileEnd"), // [profileName] -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").PerformanceOptions} PerformanceOptions */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Entrypoint")} Entrypoint */ -/** @typedef {import("../WebpackError")} WebpackError */ + time: /** @type {"time"} */ ("time"), // name, time as [seconds, nanoseconds] -/** - * @typedef {Object} AssetDetails - * @property {string} name - * @property {number} size - */ + clear: /** @type {"clear"} */ ("clear"), // no arguments + status: /** @type {"status"} */ ("status") // message, arguments +}); -/** - * @typedef {Object} EntrypointDetails - * @property {string} name - * @property {number} size - * @property {string[]} files - */ +exports.LogType = LogType; -const isOverSizeLimitSet = new WeakSet(); +/** @typedef {typeof LogType[keyof typeof LogType]} LogTypeEnum */ -const excludeSourceMap = (name, source, info) => !info.development; +const LOG_SYMBOL = Symbol("webpack logger raw log method"); +const TIMERS_SYMBOL = Symbol("webpack logger times"); +const TIMERS_AGGREGATES_SYMBOL = Symbol("webpack logger aggregated times"); -module.exports = class SizeLimitsPlugin { +class WebpackLogger { /** - * @param {PerformanceOptions} options the plugin options + * @param {function(LogTypeEnum, any[]=): void} log log function + * @param {function(string | function(): string): WebpackLogger} getChildLogger function to create child logger */ - constructor(options) { - this.hints = options.hints; - this.maxAssetSize = options.maxAssetSize; - this.maxEntrypointSize = options.maxEntrypointSize; - this.assetFilter = options.assetFilter; + constructor(log, getChildLogger) { + this[LOG_SYMBOL] = log; + this.getChildLogger = getChildLogger; } - /** - * @param {ChunkGroup | Source} thing the resource to test - * @returns {boolean} true if over the limit - */ - static isOverSizeLimit(thing) { - return isOverSizeLimitSet.has(thing); + error(...args) { + this[LOG_SYMBOL](LogType.error, args); } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const entrypointSizeLimit = this.maxEntrypointSize; - const assetSizeLimit = this.maxAssetSize; - const hints = this.hints; - const assetFilter = this.assetFilter || excludeSourceMap; - - compiler.hooks.afterEmit.tap("SizeLimitsPlugin", compilation => { - /** @type {WebpackError[]} */ - const warnings = []; - - /** - * @param {Entrypoint} entrypoint an entrypoint - * @returns {number} the size of the entrypoint - */ - const getEntrypointSize = entrypoint => { - let size = 0; - for (const file of entrypoint.getFiles()) { - const asset = compilation.getAsset(file); - if ( - asset && - assetFilter(asset.name, asset.source, asset.info) && - asset.source - ) { - size += asset.info.size || asset.source.size(); - } - } - return size; - }; - - /** @type {AssetDetails[]} */ - const assetsOverSizeLimit = []; - for (const { name, source, info } of compilation.getAssets()) { - if (!assetFilter(name, source, info) || !source) { - continue; - } - - const size = info.size || source.size(); - if (size > assetSizeLimit) { - assetsOverSizeLimit.push({ - name, - size - }); - isOverSizeLimitSet.add(source); - } - } + warn(...args) { + this[LOG_SYMBOL](LogType.warn, args); + } - const fileFilter = name => { - const asset = compilation.getAsset(name); - return asset && assetFilter(asset.name, asset.source, asset.info); - }; + info(...args) { + this[LOG_SYMBOL](LogType.info, args); + } - /** @type {EntrypointDetails[]} */ - const entrypointsOverLimit = []; - for (const [name, entry] of compilation.entrypoints) { - const size = getEntrypointSize(entry); + log(...args) { + this[LOG_SYMBOL](LogType.log, args); + } - if (size > entrypointSizeLimit) { - entrypointsOverLimit.push({ - name: name, - size: size, - files: entry.getFiles().filter(fileFilter) - }); - isOverSizeLimitSet.add(entry); - } - } + debug(...args) { + this[LOG_SYMBOL](LogType.debug, args); + } - if (hints) { - // 1. Individual Chunk: Size < 250kb - // 2. Collective Initial Chunks [entrypoint] (Each Set?): Size < 250kb - // 3. No Async Chunks - // if !1, then 2, if !2 return - if (assetsOverSizeLimit.length > 0) { - warnings.push( - new AssetsOverSizeLimitWarning(assetsOverSizeLimit, assetSizeLimit) - ); - } - if (entrypointsOverLimit.length > 0) { - warnings.push( - new EntrypointsOverSizeLimitWarning( - entrypointsOverLimit, - entrypointSizeLimit - ) - ); - } + assert(assertion, ...args) { + if (!assertion) { + this[LOG_SYMBOL](LogType.error, args); + } + } - if (warnings.length > 0) { - const someAsyncChunk = find( - compilation.chunks, - chunk => !chunk.canBeInitial() - ); + trace() { + this[LOG_SYMBOL](LogType.trace, ["Trace"]); + } - if (!someAsyncChunk) { - warnings.push(new NoAsyncChunksWarning()); - } + clear() { + this[LOG_SYMBOL](LogType.clear); + } - if (hints === "error") { - compilation.errors.push(...warnings); - } else { - compilation.warnings.push(...warnings); - } - } - } - }); + status(...args) { + this[LOG_SYMBOL](LogType.status, args); } -}; + group(...args) { + this[LOG_SYMBOL](LogType.group, args); + } -/***/ }), + groupCollapsed(...args) { + this[LOG_SYMBOL](LogType.groupCollapsed, args); + } -/***/ 95175: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + groupEnd(...args) { + this[LOG_SYMBOL](LogType.groupEnd, args); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + profile(label) { + this[LOG_SYMBOL](LogType.profile, [label]); + } + profileEnd(label) { + this[LOG_SYMBOL](LogType.profileEnd, [label]); + } + time(label) { + this[TIMERS_SYMBOL] = this[TIMERS_SYMBOL] || new Map(); + this[TIMERS_SYMBOL].set(label, process.hrtime()); + } -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); + timeLog(label) { + const prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label); + if (!prev) { + throw new Error(`No such label '${label}' for WebpackLogger.timeLog()`); + } + const time = process.hrtime(prev); + this[LOG_SYMBOL](LogType.time, [label, ...time]); + } -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ + timeEnd(label) { + const prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label); + if (!prev) { + throw new Error(`No such label '${label}' for WebpackLogger.timeEnd()`); + } + const time = process.hrtime(prev); + this[TIMERS_SYMBOL].delete(label); + this[LOG_SYMBOL](LogType.time, [label, ...time]); + } -class ChunkPrefetchFunctionRuntimeModule extends RuntimeModule { - /** - * @param {string} childType TODO - * @param {string} runtimeFunction TODO - * @param {string} runtimeHandlers TODO - */ - constructor(childType, runtimeFunction, runtimeHandlers) { - super(`chunk ${childType} function`); - this.childType = childType; - this.runtimeFunction = runtimeFunction; - this.runtimeHandlers = runtimeHandlers; + timeAggregate(label) { + const prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label); + if (!prev) { + throw new Error( + `No such label '${label}' for WebpackLogger.timeAggregate()` + ); + } + const time = process.hrtime(prev); + this[TIMERS_SYMBOL].delete(label); + this[TIMERS_AGGREGATES_SYMBOL] = + this[TIMERS_AGGREGATES_SYMBOL] || new Map(); + const current = this[TIMERS_AGGREGATES_SYMBOL].get(label); + if (current !== undefined) { + if (time[1] + current[1] > 1e9) { + time[0] += current[0] + 1; + time[1] = time[1] - 1e9 + current[1]; + } else { + time[0] += current[0]; + time[1] += current[1]; + } + } + this[TIMERS_AGGREGATES_SYMBOL].set(label, time); } - /** - * @returns {string} runtime code - */ - generate() { - const { runtimeFunction, runtimeHandlers } = this; - const { runtimeTemplate } = this.compilation; - return Template.asString([ - `${runtimeHandlers} = {};`, - `${runtimeFunction} = ${runtimeTemplate.basicFunction("chunkId", [ - // map is shorter than forEach - `Object.keys(${runtimeHandlers}).map(${runtimeTemplate.basicFunction( - "key", - `${runtimeHandlers}[key](chunkId);` - )});` - ])}` - ]); + timeAggregateEnd(label) { + if (this[TIMERS_AGGREGATES_SYMBOL] === undefined) return; + const time = this[TIMERS_AGGREGATES_SYMBOL].get(label); + if (time === undefined) return; + this[TIMERS_AGGREGATES_SYMBOL].delete(label); + this[LOG_SYMBOL](LogType.time, [label, ...time]); } } -module.exports = ChunkPrefetchFunctionRuntimeModule; +exports.Logger = WebpackLogger; /***/ }), -/***/ 33895: +/***/ 54963: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -107466,268 +104995,436 @@ module.exports = ChunkPrefetchFunctionRuntimeModule; -const RuntimeGlobals = __webpack_require__(16475); -const ChunkPrefetchFunctionRuntimeModule = __webpack_require__(95175); -const ChunkPrefetchStartupRuntimeModule = __webpack_require__(15294); -const ChunkPrefetchTriggerRuntimeModule = __webpack_require__(98441); -const ChunkPreloadTriggerRuntimeModule = __webpack_require__(56236); +const { LogType } = __webpack_require__(32597); -/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../../declarations/WebpackOptions").FilterItemTypes} FilterItemTypes */ +/** @typedef {import("../../declarations/WebpackOptions").FilterTypes} FilterTypes */ +/** @typedef {import("./Logger").LogTypeEnum} LogTypeEnum */ + +/** @typedef {function(string): boolean} FilterFunction */ + +/** + * @typedef {Object} LoggerConsole + * @property {function(): void} clear + * @property {function(): void} trace + * @property {(...args: any[]) => void} info + * @property {(...args: any[]) => void} log + * @property {(...args: any[]) => void} warn + * @property {(...args: any[]) => void} error + * @property {(...args: any[]) => void=} debug + * @property {(...args: any[]) => void=} group + * @property {(...args: any[]) => void=} groupCollapsed + * @property {(...args: any[]) => void=} groupEnd + * @property {(...args: any[]) => void=} status + * @property {(...args: any[]) => void=} profile + * @property {(...args: any[]) => void=} profileEnd + * @property {(...args: any[]) => void=} logTime + */ + +/** + * @typedef {Object} LoggerOptions + * @property {false|true|"none"|"error"|"warn"|"info"|"log"|"verbose"} level loglevel + * @property {FilterTypes|boolean} debug filter for debug logging + * @property {LoggerConsole} console the console to log to + */ + +/** + * @param {FilterItemTypes} item an input item + * @returns {FilterFunction} filter function + */ +const filterToFunction = item => { + if (typeof item === "string") { + const regExp = new RegExp( + `[\\\\/]${item.replace( + // eslint-disable-next-line no-useless-escape + /[-[\]{}()*+?.\\^$|]/g, + "\\$&" + )}([\\\\/]|$|!|\\?)` + ); + return ident => regExp.test(ident); + } + if (item && typeof item === "object" && typeof item.test === "function") { + return ident => item.test(ident); + } + if (typeof item === "function") { + return item; + } + if (typeof item === "boolean") { + return () => item; + } +}; + +/** + * @enum {number} + */ +const LogLevel = { + none: 6, + false: 6, + error: 5, + warn: 4, + info: 3, + log: 2, + true: 2, + verbose: 1 +}; + +/** + * @param {LoggerOptions} options options object + * @returns {function(string, LogTypeEnum, any[]): void} logging function + */ +module.exports = ({ level = "info", debug = false, console }) => { + const debugFilters = + typeof debug === "boolean" + ? [() => debug] + : /** @type {FilterItemTypes[]} */ ([]) + .concat(debug) + .map(filterToFunction); + /** @type {number} */ + const loglevel = LogLevel[`${level}`] || 0; -class ChunkPrefetchPreloadPlugin { /** - * @param {Compiler} compiler the compiler + * @param {string} name name of the logger + * @param {LogTypeEnum} type type of the log entry + * @param {any[]} args arguments of the log entry * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap( - "ChunkPrefetchPreloadPlugin", - compilation => { - compilation.hooks.additionalChunkRuntimeRequirements.tap( - "ChunkPrefetchPreloadPlugin", - (chunk, set, { chunkGraph }) => { - if (chunkGraph.getNumberOfEntryModules(chunk) === 0) return; - const startupChildChunks = chunk.getChildrenOfTypeInOrder( - chunkGraph, - "prefetchOrder" - ); - if (startupChildChunks) { - set.add(RuntimeGlobals.prefetchChunk); - set.add(RuntimeGlobals.onChunksLoaded); - compilation.addRuntimeModule( - chunk, - new ChunkPrefetchStartupRuntimeModule(startupChildChunks) - ); - } - } - ); - compilation.hooks.additionalTreeRuntimeRequirements.tap( - "ChunkPrefetchPreloadPlugin", - (chunk, set, { chunkGraph }) => { - const chunkMap = chunk.getChildIdsByOrdersMap(chunkGraph, false); - - if (chunkMap.prefetch) { - set.add(RuntimeGlobals.prefetchChunk); - compilation.addRuntimeModule( - chunk, - new ChunkPrefetchTriggerRuntimeModule(chunkMap.prefetch) - ); - } - if (chunkMap.preload) { - set.add(RuntimeGlobals.preloadChunk); - compilation.addRuntimeModule( - chunk, - new ChunkPreloadTriggerRuntimeModule(chunkMap.preload) - ); - } + const logger = (name, type, args) => { + const labeledArgs = () => { + if (Array.isArray(args)) { + if (args.length > 0 && typeof args[0] === "string") { + return [`[${name}] ${args[0]}`, ...args.slice(1)]; + } else { + return [`[${name}]`, ...args]; + } + } else { + return []; + } + }; + const debug = debugFilters.some(f => f(name)); + switch (type) { + case LogType.debug: + if (!debug) return; + // eslint-disable-next-line node/no-unsupported-features/node-builtins + if (typeof console.debug === "function") { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.debug(...labeledArgs()); + } else { + console.log(...labeledArgs()); + } + break; + case LogType.log: + if (!debug && loglevel > LogLevel.log) return; + console.log(...labeledArgs()); + break; + case LogType.info: + if (!debug && loglevel > LogLevel.info) return; + console.info(...labeledArgs()); + break; + case LogType.warn: + if (!debug && loglevel > LogLevel.warn) return; + console.warn(...labeledArgs()); + break; + case LogType.error: + if (!debug && loglevel > LogLevel.error) return; + console.error(...labeledArgs()); + break; + case LogType.trace: + if (!debug) return; + console.trace(); + break; + case LogType.groupCollapsed: + if (!debug && loglevel > LogLevel.log) return; + if (!debug && loglevel > LogLevel.verbose) { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + if (typeof console.groupCollapsed === "function") { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.groupCollapsed(...labeledArgs()); + } else { + console.log(...labeledArgs()); } - ); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.prefetchChunk) - .tap("ChunkPrefetchPreloadPlugin", (chunk, set) => { - compilation.addRuntimeModule( - chunk, - new ChunkPrefetchFunctionRuntimeModule( - "prefetch", - RuntimeGlobals.prefetchChunk, - RuntimeGlobals.prefetchChunkHandlers - ) - ); - set.add(RuntimeGlobals.prefetchChunkHandlers); - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.preloadChunk) - .tap("ChunkPrefetchPreloadPlugin", (chunk, set) => { - compilation.addRuntimeModule( - chunk, - new ChunkPrefetchFunctionRuntimeModule( - "preload", - RuntimeGlobals.preloadChunk, - RuntimeGlobals.preloadChunkHandlers - ) - ); - set.add(RuntimeGlobals.preloadChunkHandlers); - }); + break; + } + // falls through + case LogType.group: + if (!debug && loglevel > LogLevel.log) return; + // eslint-disable-next-line node/no-unsupported-features/node-builtins + if (typeof console.group === "function") { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.group(...labeledArgs()); + } else { + console.log(...labeledArgs()); + } + break; + case LogType.groupEnd: + if (!debug && loglevel > LogLevel.log) return; + // eslint-disable-next-line node/no-unsupported-features/node-builtins + if (typeof console.groupEnd === "function") { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.groupEnd(); + } + break; + case LogType.time: { + if (!debug && loglevel > LogLevel.log) return; + const ms = args[1] * 1000 + args[2] / 1000000; + const msg = `[${name}] ${args[0]}: ${ms} ms`; + if (typeof console.logTime === "function") { + console.logTime(msg); + } else { + console.log(msg); + } + break; } - ); - } -} - -module.exports = ChunkPrefetchPreloadPlugin; + case LogType.profile: + // eslint-disable-next-line node/no-unsupported-features/node-builtins + if (typeof console.profile === "function") { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.profile(...labeledArgs()); + } + break; + case LogType.profileEnd: + // eslint-disable-next-line node/no-unsupported-features/node-builtins + if (typeof console.profileEnd === "function") { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.profileEnd(...labeledArgs()); + } + break; + case LogType.clear: + if (!debug && loglevel > LogLevel.log) return; + // eslint-disable-next-line node/no-unsupported-features/node-builtins + if (typeof console.clear === "function") { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.clear(); + } + break; + case LogType.status: + if (!debug && loglevel > LogLevel.info) return; + if (typeof console.status === "function") { + if (args.length === 0) { + console.status(); + } else { + console.status(...labeledArgs()); + } + } else { + if (args.length !== 0) { + console.info(...labeledArgs()); + } + } + break; + default: + throw new Error(`Unexpected LogType ${type}`); + } + }; + return logger; +}; /***/ }), -/***/ 15294: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 62090: +/***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); +const arraySum = array => { + let sum = 0; + for (const item of array) sum += item; + return sum; +}; -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** + * @param {any[]} args items to be truncated + * @param {number} maxLength maximum length of args including spaces between + * @returns {string[]} truncated args + */ +const truncateArgs = (args, maxLength) => { + const lengths = args.map(a => `${a}`.length); + const availableLength = maxLength - lengths.length + 1; -class ChunkPrefetchStartupRuntimeModule extends RuntimeModule { - /** - * @param {{ onChunks: Chunk[], chunks: Set }[]} startupChunks chunk ids to trigger when chunks are loaded - */ - constructor(startupChunks) { - super("startup prefetch", RuntimeModule.STAGE_TRIGGER); - this.startupChunks = startupChunks; + if (availableLength > 0 && args.length === 1) { + if (availableLength >= args[0].length) { + return args; + } else if (availableLength > 3) { + return ["..." + args[0].slice(-availableLength + 3)]; + } else { + return [args[0].slice(-availableLength)]; + } } - /** - * @returns {string} runtime code - */ - generate() { - const { startupChunks, chunk } = this; - const { runtimeTemplate } = this.compilation; - return Template.asString( - startupChunks.map( - ({ onChunks, chunks }) => - `${RuntimeGlobals.onChunksLoaded}(0, ${JSON.stringify( - // This need to include itself to delay execution after this chunk has been fully loaded - onChunks.filter(c => c === chunk).map(c => c.id) - )}, ${runtimeTemplate.basicFunction( - "", - chunks.size < 3 - ? Array.from( - chunks, - c => - `${RuntimeGlobals.prefetchChunk}(${JSON.stringify(c.id)});` - ) - : `${JSON.stringify(Array.from(chunks, c => c.id))}.map(${ - RuntimeGlobals.prefetchChunk - });` - )}, 5);` - ) - ); + // Check if there is space for at least 4 chars per arg + if (availableLength < arraySum(lengths.map(i => Math.min(i, 6)))) { + // remove args + if (args.length > 1) + return truncateArgs(args.slice(0, args.length - 1), maxLength); + return []; } -} - -module.exports = ChunkPrefetchStartupRuntimeModule; - - -/***/ }), - -/***/ 98441: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + let currentLength = arraySum(lengths); + // Check if all fits into maxLength + if (currentLength <= availableLength) return args; -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); - -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ - -class ChunkPrefetchTriggerRuntimeModule extends RuntimeModule { - /** - * @param {Record} chunkMap map from chunk to - */ - constructor(chunkMap) { - super(`chunk prefetch trigger`, RuntimeModule.STAGE_TRIGGER); - this.chunkMap = chunkMap; + // Try to remove chars from the longest items until it fits + while (currentLength > availableLength) { + const maxLength = Math.max(...lengths); + const shorterItems = lengths.filter(l => l !== maxLength); + const nextToMaxLength = + shorterItems.length > 0 ? Math.max(...shorterItems) : 0; + const maxReduce = maxLength - nextToMaxLength; + let maxItems = lengths.length - shorterItems.length; + let overrun = currentLength - availableLength; + for (let i = 0; i < lengths.length; i++) { + if (lengths[i] === maxLength) { + const reduce = Math.min(Math.floor(overrun / maxItems), maxReduce); + lengths[i] -= reduce; + currentLength -= reduce; + overrun -= reduce; + maxItems--; + } + } } - /** - * @returns {string} runtime code - */ - generate() { - const { chunkMap } = this; - const { runtimeTemplate } = this.compilation; - const body = [ - "var chunks = chunkToChildrenMap[chunkId];", - `Array.isArray(chunks) && chunks.map(${RuntimeGlobals.prefetchChunk});` - ]; - return Template.asString([ - Template.asString([ - `var chunkToChildrenMap = ${JSON.stringify(chunkMap, null, "\t")};`, - `${ - RuntimeGlobals.ensureChunkHandlers - }.prefetch = ${runtimeTemplate.expressionFunction( - `Promise.all(promises).then(${runtimeTemplate.basicFunction( - "", - body - )})`, - "chunkId, promises" - )};` - ]) - ]); - } -} + // Return args reduced to length in lengths + return args.map((a, i) => { + const str = `${a}`; + const length = lengths[i]; + if (str.length === length) { + return str; + } else if (length > 5) { + return "..." + str.slice(-length + 3); + } else if (length > 0) { + return str.slice(-length); + } else { + return ""; + } + }); +}; -module.exports = ChunkPrefetchTriggerRuntimeModule; +module.exports = truncateArgs; /***/ }), -/***/ 56236: +/***/ 1313: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); +const StartupChunkDependenciesPlugin = __webpack_require__(22339); -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../Compiler")} Compiler */ -class ChunkPreloadTriggerRuntimeModule extends RuntimeModule { - /** - * @param {Record} chunkMap map from chunk to chunks - */ - constructor(chunkMap) { - super(`chunk preload trigger`, RuntimeModule.STAGE_TRIGGER); - this.chunkMap = chunkMap; +class CommonJsChunkLoadingPlugin { + constructor(options) { + options = options || {}; + this._asyncChunkLoading = options.asyncChunkLoading; } /** - * @returns {string} runtime code + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - generate() { - const { chunkMap } = this; - const { runtimeTemplate } = this.compilation; - const body = [ - "var chunks = chunkToChildrenMap[chunkId];", - `Array.isArray(chunks) && chunks.map(${RuntimeGlobals.preloadChunk});` - ]; - return Template.asString([ - Template.asString([ - `var chunkToChildrenMap = ${JSON.stringify(chunkMap, null, "\t")};`, - `${ - RuntimeGlobals.ensureChunkHandlers - }.preload = ${runtimeTemplate.basicFunction("chunkId", body)};` - ]) - ]); + apply(compiler) { + const ChunkLoadingRuntimeModule = this._asyncChunkLoading + ? __webpack_require__(73369) + : __webpack_require__(94172); + const chunkLoadingValue = this._asyncChunkLoading + ? "async-node" + : "require"; + new StartupChunkDependenciesPlugin({ + chunkLoading: chunkLoadingValue, + asyncChunkLoading: this._asyncChunkLoading + }).apply(compiler); + compiler.hooks.thisCompilation.tap( + "CommonJsChunkLoadingPlugin", + compilation => { + const globalChunkLoading = compilation.outputOptions.chunkLoading; + const isEnabledForChunk = chunk => { + const options = chunk.getEntryOptions(); + const chunkLoading = + options && options.chunkLoading !== undefined + ? options.chunkLoading + : globalChunkLoading; + return chunkLoading === chunkLoadingValue; + }; + const onceForChunkSet = new WeakSet(); + const handler = (chunk, set) => { + if (onceForChunkSet.has(chunk)) return; + onceForChunkSet.add(chunk); + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + set.add(RuntimeGlobals.hasOwnProperty); + compilation.addRuntimeModule( + chunk, + new ChunkLoadingRuntimeModule(set) + ); + }; + + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("CommonJsChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadUpdateHandlers) + .tap("CommonJsChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadManifest) + .tap("CommonJsChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.baseURI) + .tap("CommonJsChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.externalInstallChunk) + .tap("CommonJsChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.onChunksLoaded) + .tap("CommonJsChunkLoadingPlugin", handler); + + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("CommonJsChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.getChunkScriptFilename); + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadUpdateHandlers) + .tap("CommonJsChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.getChunkUpdateScriptFilename); + set.add(RuntimeGlobals.moduleCache); + set.add(RuntimeGlobals.hmrModuleData); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadManifest) + .tap("CommonJsChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.getUpdateManifestFilename); + }); + } + ); } } -module.exports = ChunkPreloadTriggerRuntimeModule; +module.exports = CommonJsChunkLoadingPlugin; /***/ }), -/***/ 30318: -/***/ (function(module) { +/***/ 7553: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -107737,43 +105434,64 @@ module.exports = ChunkPreloadTriggerRuntimeModule; -/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */ +const CachedInputFileSystem = __webpack_require__(89429); +const fs = __webpack_require__(90552); +const createConsoleLogger = __webpack_require__(54963); +const NodeWatchFileSystem = __webpack_require__(98810); +const nodeConsole = __webpack_require__(91786); -class BasicEffectRulePlugin { - constructor(ruleProperty, effectType) { - this.ruleProperty = ruleProperty; - this.effectType = effectType || ruleProperty; +/** @typedef {import("../../declarations/WebpackOptions").InfrastructureLogging} InfrastructureLogging */ +/** @typedef {import("../Compiler")} Compiler */ + +class NodeEnvironmentPlugin { + /** + * @param {Object} options options + * @param {InfrastructureLogging} options.infrastructureLogging infrastructure logging options + */ + constructor(options) { + this.options = options; } /** - * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply(ruleSetCompiler) { - ruleSetCompiler.hooks.rule.tap( - "BasicEffectRulePlugin", - (path, rule, unhandledProperties, result, references) => { - if (unhandledProperties.has(this.ruleProperty)) { - unhandledProperties.delete(this.ruleProperty); - - const value = rule[this.ruleProperty]; - - result.effects.push({ - type: this.effectType, - value - }); - } - } + apply(compiler) { + const { infrastructureLogging } = this.options; + compiler.infrastructureLogger = createConsoleLogger({ + level: infrastructureLogging.level || "info", + debug: infrastructureLogging.debug || false, + console: + infrastructureLogging.console || + nodeConsole({ + colors: infrastructureLogging.colors, + appendOnly: infrastructureLogging.appendOnly, + stream: infrastructureLogging.stream + }) + }); + compiler.inputFileSystem = new CachedInputFileSystem(fs, 60000); + const inputFileSystem = compiler.inputFileSystem; + compiler.outputFileSystem = fs; + compiler.intermediateFileSystem = fs; + compiler.watchFileSystem = new NodeWatchFileSystem( + compiler.inputFileSystem ); + compiler.hooks.beforeRun.tap("NodeEnvironmentPlugin", compiler => { + if (compiler.inputFileSystem === inputFileSystem) { + compiler.fsStartTime = Date.now(); + inputFileSystem.purge(); + } + }); } } -module.exports = BasicEffectRulePlugin; +module.exports = NodeEnvironmentPlugin; /***/ }), -/***/ 94215: +/***/ 7103: /***/ (function(module) { "use strict"; @@ -107784,52 +105502,24 @@ module.exports = BasicEffectRulePlugin; -/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */ -/** @typedef {import("./RuleSetCompiler").RuleCondition} RuleCondition */ - -class BasicMatcherRulePlugin { - constructor(ruleProperty, dataProperty, invert) { - this.ruleProperty = ruleProperty; - this.dataProperty = dataProperty || ruleProperty; - this.invert = invert || false; - } +/** @typedef {import("../Compiler")} Compiler */ +class NodeSourcePlugin { /** - * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply(ruleSetCompiler) { - ruleSetCompiler.hooks.rule.tap( - "BasicMatcherRulePlugin", - (path, rule, unhandledProperties, result) => { - if (unhandledProperties.has(this.ruleProperty)) { - unhandledProperties.delete(this.ruleProperty); - const value = rule[this.ruleProperty]; - const condition = ruleSetCompiler.compileCondition( - `${path}.${this.ruleProperty}`, - value - ); - const fn = condition.fn; - result.conditions.push({ - property: this.dataProperty, - matchWhenEmpty: this.invert - ? !condition.matchWhenEmpty - : condition.matchWhenEmpty, - fn: this.invert ? v => !fn(v) : fn - }); - } - } - ); - } + apply(compiler) {} } -module.exports = BasicMatcherRulePlugin; +module.exports = NodeSourcePlugin; /***/ }), -/***/ 72021: -/***/ (function(module) { +/***/ 17916: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -107839,51 +105529,85 @@ module.exports = BasicMatcherRulePlugin; -/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */ -/** @typedef {import("./RuleSetCompiler").RuleCondition} RuleCondition */ +const ExternalsPlugin = __webpack_require__(6652); -class ObjectMatcherRulePlugin { - constructor(ruleProperty, dataProperty) { - this.ruleProperty = ruleProperty; - this.dataProperty = dataProperty || ruleProperty; - } +/** @typedef {import("../Compiler")} Compiler */ + +const builtins = [ + "assert", + "async_hooks", + "buffer", + "child_process", + "cluster", + "console", + "constants", + "crypto", + "dgram", + "diagnostics_channel", + "dns", + "dns/promises", + "domain", + "events", + "fs", + "fs/promises", + "http", + "http2", + "https", + "inspector", + "module", + "net", + "os", + "path", + "path/posix", + "path/win32", + "perf_hooks", + "process", + "punycode", + "querystring", + "readline", + "repl", + "stream", + "stream/promises", + "stream/web", + "string_decoder", + "sys", + "timers", + "timers/promises", + "tls", + "trace_events", + "tty", + "url", + "util", + "util/types", + "v8", + "vm", + "wasi", + "worker_threads", + "zlib", + /^node:/, + + // cspell:word pnpapi + // Yarn PnP adds pnpapi as "builtin" + "pnpapi" +]; +class NodeTargetPlugin { /** - * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply(ruleSetCompiler) { - const { ruleProperty, dataProperty } = this; - ruleSetCompiler.hooks.rule.tap( - "ObjectMatcherRulePlugin", - (path, rule, unhandledProperties, result) => { - if (unhandledProperties.has(ruleProperty)) { - unhandledProperties.delete(ruleProperty); - const value = rule[ruleProperty]; - for (const property of Object.keys(value)) { - const nestedDataProperties = property.split("."); - const condition = ruleSetCompiler.compileCondition( - `${path}.${ruleProperty}.${property}`, - value[property] - ); - result.conditions.push({ - property: [dataProperty, ...nestedDataProperties], - matchWhenEmpty: condition.matchWhenEmpty, - fn: condition.fn - }); - } - } - } - ); + apply(compiler) { + new ExternalsPlugin("node-commonjs", builtins).apply(compiler); } } -module.exports = ObjectMatcherRulePlugin; +module.exports = NodeTargetPlugin; /***/ }), -/***/ 83349: +/***/ 61052: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -107894,383 +105618,523 @@ module.exports = ObjectMatcherRulePlugin; -const { SyncHook } = __webpack_require__(6967); - -/** - * @typedef {Object} RuleCondition - * @property {string | string[]} property - * @property {boolean} matchWhenEmpty - * @property {function(string): boolean} fn - */ - -/** - * @typedef {Object} Condition - * @property {boolean} matchWhenEmpty - * @property {function(string): boolean} fn - */ - -/** - * @typedef {Object} CompiledRule - * @property {RuleCondition[]} conditions - * @property {(Effect|function(object): Effect[])[]} effects - * @property {CompiledRule[]=} rules - * @property {CompiledRule[]=} oneOf - */ - -/** - * @typedef {Object} Effect - * @property {string} type - * @property {any} value - */ +const CommonJsChunkFormatPlugin = __webpack_require__(84508); +const EnableChunkLoadingPlugin = __webpack_require__(61291); -/** - * @typedef {Object} RuleSet - * @property {Map} references map of references in the rule set (may grow over time) - * @property {function(object): Effect[]} exec execute the rule set - */ +/** @typedef {import("../Compiler")} Compiler */ -class RuleSetCompiler { - constructor(plugins) { - this.hooks = Object.freeze({ - /** @type {SyncHook<[string, object, Set, CompiledRule, Map]>} */ - rule: new SyncHook([ - "path", - "rule", - "unhandledProperties", - "compiledRule", - "references" - ]) - }); - if (plugins) { - for (const plugin of plugins) { - plugin.apply(this); - } - } +class NodeTemplatePlugin { + constructor(options) { + this._options = options || {}; } /** - * @param {object[]} ruleSet raw user provided rules - * @returns {RuleSet} compiled RuleSet + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - compile(ruleSet) { - const refs = new Map(); - const rules = this.compileRules("ruleSet", ruleSet, refs); + apply(compiler) { + const chunkLoading = this._options.asyncChunkLoading + ? "async-node" + : "require"; + compiler.options.output.chunkLoading = chunkLoading; + new CommonJsChunkFormatPlugin().apply(compiler); + new EnableChunkLoadingPlugin(chunkLoading).apply(compiler); + } +} - /** - * @param {object} data data passed in - * @param {CompiledRule} rule the compiled rule - * @param {Effect[]} effects an array where effects are pushed to - * @returns {boolean} true, if the rule has matched - */ - const execRule = (data, rule, effects) => { - for (const condition of rule.conditions) { - const p = condition.property; - if (Array.isArray(p)) { - let current = data; - for (const subProperty of p) { - if ( - current && - typeof current === "object" && - Object.prototype.hasOwnProperty.call(current, subProperty) - ) { - current = current[subProperty]; - } else { - current = undefined; - break; - } - } - if (current !== undefined) { - if (!condition.fn(current)) return false; - continue; - } - } else if (p in data) { - const value = data[p]; - if (value !== undefined) { - if (!condition.fn(value)) return false; - continue; - } - } - if (!condition.matchWhenEmpty) { - return false; - } - } - for (const effect of rule.effects) { - if (typeof effect === "function") { - const returnedEffects = effect(data); - for (const effect of returnedEffects) { - effects.push(effect); - } - } else { - effects.push(effect); - } - } - if (rule.rules) { - for (const childRule of rule.rules) { - execRule(data, childRule, effects); - } - } - if (rule.oneOf) { - for (const childRule of rule.oneOf) { - if (execRule(data, childRule, effects)) { - break; - } - } - } - return true; - }; +module.exports = NodeTemplatePlugin; - return { - references: refs, - exec: data => { - /** @type {Effect[]} */ - const effects = []; - for (const rule of rules) { - execRule(data, rule, effects); - } - return effects; - } - }; - } - /** - * @param {string} path current path - * @param {object[]} rules the raw rules provided by user - * @param {Map} refs references - * @returns {CompiledRule[]} rules - */ - compileRules(path, rules, refs) { - return rules.map((rule, i) => - this.compileRule(`${path}[${i}]`, rule, refs) - ); - } +/***/ }), - /** - * @param {string} path current path - * @param {object} rule the raw rule provided by user - * @param {Map} refs references - * @returns {CompiledRule} normalized and compiled rule for processing - */ - compileRule(path, rule, refs) { - const unhandledProperties = new Set( - Object.keys(rule).filter(key => rule[key] !== undefined) - ); +/***/ 98810: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** @type {CompiledRule} */ - const compiledRule = { - conditions: [], - effects: [], - rules: undefined, - oneOf: undefined - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - this.hooks.rule.call(path, rule, unhandledProperties, compiledRule, refs); - if (unhandledProperties.has("rules")) { - unhandledProperties.delete("rules"); - const rules = rule.rules; - if (!Array.isArray(rules)) - throw this.error(path, rules, "Rule.rules must be an array of rules"); - compiledRule.rules = this.compileRules(`${path}.rules`, rules, refs); - } - if (unhandledProperties.has("oneOf")) { - unhandledProperties.delete("oneOf"); - const oneOf = rule.oneOf; - if (!Array.isArray(oneOf)) - throw this.error(path, oneOf, "Rule.oneOf must be an array of rules"); - compiledRule.oneOf = this.compileRules(`${path}.oneOf`, oneOf, refs); - } +const util = __webpack_require__(73837); +const Watchpack = __webpack_require__(36871); - if (unhandledProperties.size > 0) { - throw this.error( - path, - rule, - `Properties ${Array.from(unhandledProperties).join(", ")} are unknown` - ); - } +/** @typedef {import("../../declarations/WebpackOptions").WatchOptions} WatchOptions */ +/** @typedef {import("../FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */ +/** @typedef {import("../util/fs").WatchFileSystem} WatchFileSystem */ +/** @typedef {import("../util/fs").WatchMethod} WatchMethod */ +/** @typedef {import("../util/fs").Watcher} Watcher */ - return compiledRule; +class NodeWatchFileSystem { + constructor(inputFileSystem) { + this.inputFileSystem = inputFileSystem; + this.watcherOptions = { + aggregateTimeout: 0 + }; + this.watcher = new Watchpack(this.watcherOptions); } /** - * @param {string} path current path - * @param {any} condition user provided condition value - * @returns {Condition} compiled condition + * @param {Iterable} files watched files + * @param {Iterable} directories watched directories + * @param {Iterable} missing watched exitance entries + * @param {number} startTime timestamp of start time + * @param {WatchOptions} options options object + * @param {function(Error=, Map, Map, Set, Set): void} callback aggregated callback + * @param {function(string, number): void} callbackUndelayed callback when the first change was detected + * @returns {Watcher} a watcher */ - compileCondition(path, condition) { - if (condition === "") { - return { - matchWhenEmpty: true, - fn: str => str === "" - }; + watch( + files, + directories, + missing, + startTime, + options, + callback, + callbackUndelayed + ) { + if (!files || typeof files[Symbol.iterator] !== "function") { + throw new Error("Invalid arguments: 'files'"); } - if (!condition) { - throw this.error( - path, - condition, - "Expected condition but got falsy value" - ); + if (!directories || typeof directories[Symbol.iterator] !== "function") { + throw new Error("Invalid arguments: 'directories'"); } - if (typeof condition === "string") { - return { - matchWhenEmpty: condition.length === 0, - fn: str => typeof str === "string" && str.startsWith(condition) - }; + if (!missing || typeof missing[Symbol.iterator] !== "function") { + throw new Error("Invalid arguments: 'missing'"); } - if (typeof condition === "function") { - try { - return { - matchWhenEmpty: condition(""), - fn: condition - }; - } catch (err) { - throw this.error( - path, - condition, - "Evaluation of condition function threw error" - ); - } + if (typeof callback !== "function") { + throw new Error("Invalid arguments: 'callback'"); } - if (condition instanceof RegExp) { - return { - matchWhenEmpty: condition.test(""), - fn: v => typeof v === "string" && condition.test(v) - }; + if (typeof startTime !== "number" && startTime) { + throw new Error("Invalid arguments: 'startTime'"); } - if (Array.isArray(condition)) { - const items = condition.map((c, i) => - this.compileCondition(`${path}[${i}]`, c) - ); - return this.combineConditionsOr(items); + if (typeof options !== "object") { + throw new Error("Invalid arguments: 'options'"); + } + if (typeof callbackUndelayed !== "function" && callbackUndelayed) { + throw new Error("Invalid arguments: 'callbackUndelayed'"); + } + const oldWatcher = this.watcher; + this.watcher = new Watchpack(options); + + if (callbackUndelayed) { + this.watcher.once("change", callbackUndelayed); } - if (typeof condition !== "object") { - throw this.error( - path, - condition, - `Unexpected ${typeof condition} when condition was expected` + const fetchTimeInfo = () => { + const fileTimeInfoEntries = new Map(); + const contextTimeInfoEntries = new Map(); + if (this.watcher) { + this.watcher.collectTimeInfoEntries( + fileTimeInfoEntries, + contextTimeInfoEntries + ); + } + return { fileTimeInfoEntries, contextTimeInfoEntries }; + }; + this.watcher.once("aggregated", (changes, removals) => { + // pause emitting events (avoids clearing aggregated changes and removals on timeout) + this.watcher.pause(); + + if (this.inputFileSystem && this.inputFileSystem.purge) { + const fs = this.inputFileSystem; + for (const item of changes) { + fs.purge(item); + } + for (const item of removals) { + fs.purge(item); + } + } + const { fileTimeInfoEntries, contextTimeInfoEntries } = fetchTimeInfo(); + callback( + null, + fileTimeInfoEntries, + contextTimeInfoEntries, + changes, + removals ); - } + }); - const conditions = []; - for (const key of Object.keys(condition)) { - const value = condition[key]; - switch (key) { - case "or": - if (value) { - if (!Array.isArray(value)) { - throw this.error( - `${path}.or`, - condition.and, - "Expected array of conditions" - ); + this.watcher.watch({ files, directories, missing, startTime }); + + if (oldWatcher) { + oldWatcher.close(); + } + return { + close: () => { + if (this.watcher) { + this.watcher.close(); + this.watcher = null; + } + }, + pause: () => { + if (this.watcher) { + this.watcher.pause(); + } + }, + getAggregatedRemovals: util.deprecate( + () => { + const items = this.watcher && this.watcher.aggregatedRemovals; + if (items && this.inputFileSystem && this.inputFileSystem.purge) { + const fs = this.inputFileSystem; + for (const item of items) { + fs.purge(item); } - conditions.push(this.compileCondition(`${path}.or`, value)); } - break; - case "and": - if (value) { - if (!Array.isArray(value)) { - throw this.error( - `${path}.and`, - condition.and, - "Expected array of conditions" - ); + return items; + }, + "Watcher.getAggregatedRemovals is deprecated in favor of Watcher.getInfo since that's more performant.", + "DEP_WEBPACK_WATCHER_GET_AGGREGATED_REMOVALS" + ), + getAggregatedChanges: util.deprecate( + () => { + const items = this.watcher && this.watcher.aggregatedChanges; + if (items && this.inputFileSystem && this.inputFileSystem.purge) { + const fs = this.inputFileSystem; + for (const item of items) { + fs.purge(item); } - let i = 0; - for (const item of value) { - conditions.push(this.compileCondition(`${path}.and[${i}]`, item)); - i++; + } + return items; + }, + "Watcher.getAggregatedChanges is deprecated in favor of Watcher.getInfo since that's more performant.", + "DEP_WEBPACK_WATCHER_GET_AGGREGATED_CHANGES" + ), + getFileTimeInfoEntries: util.deprecate( + () => { + return fetchTimeInfo().fileTimeInfoEntries; + }, + "Watcher.getFileTimeInfoEntries is deprecated in favor of Watcher.getInfo since that's more performant.", + "DEP_WEBPACK_WATCHER_FILE_TIME_INFO_ENTRIES" + ), + getContextTimeInfoEntries: util.deprecate( + () => { + return fetchTimeInfo().contextTimeInfoEntries; + }, + "Watcher.getContextTimeInfoEntries is deprecated in favor of Watcher.getInfo since that's more performant.", + "DEP_WEBPACK_WATCHER_CONTEXT_TIME_INFO_ENTRIES" + ), + getInfo: () => { + const removals = this.watcher && this.watcher.aggregatedRemovals; + const changes = this.watcher && this.watcher.aggregatedChanges; + if (this.inputFileSystem && this.inputFileSystem.purge) { + const fs = this.inputFileSystem; + if (removals) { + for (const item of removals) { + fs.purge(item); } } - break; - case "not": - if (value) { - const matcher = this.compileCondition(`${path}.not`, value); - const fn = matcher.fn; - conditions.push({ - matchWhenEmpty: !matcher.matchWhenEmpty, - fn: v => !fn(v) - }); + if (changes) { + for (const item of changes) { + fs.purge(item); + } } - break; - default: - throw this.error( - `${path}.${key}`, - condition[key], - `Unexpected property ${key} in condition` - ); + } + const { fileTimeInfoEntries, contextTimeInfoEntries } = fetchTimeInfo(); + return { + changes, + removals, + fileTimeInfoEntries, + contextTimeInfoEntries + }; } - } - if (conditions.length === 0) { - throw this.error( - path, - condition, - "Expected condition, but got empty thing" - ); - } - return this.combineConditionsAnd(conditions); + }; } +} - /** - * @param {Condition[]} conditions some conditions - * @returns {Condition} merged condition - */ - combineConditionsOr(conditions) { - if (conditions.length === 0) { - return { - matchWhenEmpty: false, - fn: () => false - }; - } else if (conditions.length === 1) { - return conditions[0]; - } else { - return { - matchWhenEmpty: conditions.some(c => c.matchWhenEmpty), - fn: v => conditions.some(c => c.fn(v)) - }; - } - } +module.exports = NodeWatchFileSystem; - /** - * @param {Condition[]} conditions some conditions - * @returns {Condition} merged condition - */ - combineConditionsAnd(conditions) { - if (conditions.length === 0) { - return { - matchWhenEmpty: false, - fn: () => false - }; - } else if (conditions.length === 1) { - return conditions[0]; - } else { - return { - matchWhenEmpty: conditions.every(c => c.matchWhenEmpty), - fn: v => conditions.every(c => c.fn(v)) - }; - } + +/***/ }), + +/***/ 73369: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); +const { + chunkHasJs, + getChunkFilenameTemplate +} = __webpack_require__(89464); +const { getInitialChunkIds } = __webpack_require__(98124); +const compileBooleanMatcher = __webpack_require__(29404); +const { getUndoPath } = __webpack_require__(82186); + +class ReadFileChunkLoadingRuntimeModule extends RuntimeModule { + constructor(runtimeRequirements) { + super("readFile chunk loading", RuntimeModule.STAGE_ATTACH); + this.runtimeRequirements = runtimeRequirements; } /** - * @param {string} path current path - * @param {any} value value at the error location - * @param {string} message message explaining the problem - * @returns {Error} an error object + * @returns {string} runtime code */ - error(path, value, message) { - return new Error( - `Compiling RuleSet failed: ${message} (at ${path}: ${value})` + generate() { + const { chunkGraph, chunk } = this; + const { runtimeTemplate } = this.compilation; + const fn = RuntimeGlobals.ensureChunkHandlers; + const withBaseURI = this.runtimeRequirements.has(RuntimeGlobals.baseURI); + const withExternalInstallChunk = this.runtimeRequirements.has( + RuntimeGlobals.externalInstallChunk + ); + const withOnChunkLoad = this.runtimeRequirements.has( + RuntimeGlobals.onChunksLoaded + ); + const withLoading = this.runtimeRequirements.has( + RuntimeGlobals.ensureChunkHandlers + ); + const withHmr = this.runtimeRequirements.has( + RuntimeGlobals.hmrDownloadUpdateHandlers + ); + const withHmrManifest = this.runtimeRequirements.has( + RuntimeGlobals.hmrDownloadManifest + ); + const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs); + const hasJsMatcher = compileBooleanMatcher(conditionMap); + const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); + + const outputName = this.compilation.getPath( + getChunkFilenameTemplate(chunk, this.compilation.outputOptions), + { + chunk, + contentHashType: "javascript" + } + ); + const rootOutputDir = getUndoPath( + outputName, + this.compilation.outputOptions.path, + false ); + + const stateExpression = withHmr + ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_readFileVm` + : undefined; + + return Template.asString([ + withBaseURI + ? Template.asString([ + `${RuntimeGlobals.baseURI} = require("url").pathToFileURL(${ + rootOutputDir + ? `__dirname + ${JSON.stringify("/" + rootOutputDir)}` + : "__filename" + });` + ]) + : "// no baseURI", + "", + "// object to store loaded chunks", + '// "0" means "already loaded", Promise means loading', + `var installedChunks = ${ + stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" + }{`, + Template.indent( + Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join( + ",\n" + ) + ), + "};", + "", + withOnChunkLoad + ? `${ + RuntimeGlobals.onChunksLoaded + }.readFileVm = ${runtimeTemplate.returningFunction( + "installedChunks[chunkId] === 0", + "chunkId" + )};` + : "// no on chunks loaded", + "", + withLoading || withExternalInstallChunk + ? `var installChunk = ${runtimeTemplate.basicFunction("chunk", [ + "var moreModules = chunk.modules, chunkIds = chunk.ids, runtime = chunk.runtime;", + "for(var moduleId in moreModules) {", + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, + Template.indent([ + `${RuntimeGlobals.moduleFactories}[moduleId] = moreModules[moduleId];` + ]), + "}" + ]), + "}", + `if(runtime) runtime(__webpack_require__);`, + "for(var i = 0; i < chunkIds.length; i++) {", + Template.indent([ + "if(installedChunks[chunkIds[i]]) {", + Template.indent(["installedChunks[chunkIds[i]][0]();"]), + "}", + "installedChunks[chunkIds[i]] = 0;" + ]), + "}", + withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : "" + ])};` + : "// no chunk install function needed", + "", + withLoading + ? Template.asString([ + "// ReadFile + VM.run chunk loading for javascript", + `${fn}.readFileVm = function(chunkId, promises) {`, + hasJsMatcher !== false + ? Template.indent([ + "", + "var installedChunkData = installedChunks[chunkId];", + 'if(installedChunkData !== 0) { // 0 means "already installed".', + Template.indent([ + '// array of [resolve, reject, promise] means "currently loading"', + "if(installedChunkData) {", + Template.indent(["promises.push(installedChunkData[2]);"]), + "} else {", + Template.indent([ + hasJsMatcher === true + ? "if(true) { // all chunks have JS" + : `if(${hasJsMatcher("chunkId")}) {`, + Template.indent([ + "// load the chunk and return promise to it", + "var promise = new Promise(function(resolve, reject) {", + Template.indent([ + "installedChunkData = installedChunks[chunkId] = [resolve, reject];", + `var filename = require('path').join(__dirname, ${JSON.stringify( + rootOutputDir + )} + ${ + RuntimeGlobals.getChunkScriptFilename + }(chunkId));`, + "require('fs').readFile(filename, 'utf-8', function(err, content) {", + Template.indent([ + "if(err) return reject(err);", + "var chunk = {};", + "require('vm').runInThisContext('(function(exports, require, __dirname, __filename) {' + content + '\\n})', filename)" + + "(chunk, require, require('path').dirname(filename), filename);", + "installChunk(chunk);" + ]), + "});" + ]), + "});", + "promises.push(installedChunkData[2] = promise);" + ]), + "} else installedChunks[chunkId] = 0;" + ]), + "}" + ]), + "}" + ]) + : Template.indent(["installedChunks[chunkId] = 0;"]), + "};" + ]) + : "// no chunk loading", + "", + withExternalInstallChunk + ? Template.asString([ + "module.exports = __webpack_require__;", + `${RuntimeGlobals.externalInstallChunk} = installChunk;` + ]) + : "// no external install chunk", + "", + withHmr + ? Template.asString([ + "function loadUpdateChunk(chunkId, updatedModulesList) {", + Template.indent([ + "return new Promise(function(resolve, reject) {", + Template.indent([ + `var filename = require('path').join(__dirname, ${JSON.stringify( + rootOutputDir + )} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId));`, + "require('fs').readFile(filename, 'utf-8', function(err, content) {", + Template.indent([ + "if(err) return reject(err);", + "var update = {};", + "require('vm').runInThisContext('(function(exports, require, __dirname, __filename) {' + content + '\\n})', filename)" + + "(update, require, require('path').dirname(filename), filename);", + "var updatedModules = update.modules;", + "var runtime = update.runtime;", + "for(var moduleId in updatedModules) {", + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(updatedModules, moduleId)) {`, + Template.indent([ + `currentUpdate[moduleId] = updatedModules[moduleId];`, + "if(updatedModulesList) updatedModulesList.push(moduleId);" + ]), + "}" + ]), + "}", + "if(runtime) currentUpdateRuntime.push(runtime);", + "resolve();" + ]), + "});" + ]), + "});" + ]), + "}", + "", + Template.getFunctionContent( + require('./JavascriptHotModuleReplacement.runtime.js') + ) + .replace(/\$key\$/g, "readFileVm") + .replace(/\$installedChunks\$/g, "installedChunks") + .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") + .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) + .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) + .replace( + /\$ensureChunkHandlers\$/g, + RuntimeGlobals.ensureChunkHandlers + ) + .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) + .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) + .replace( + /\$hmrDownloadUpdateHandlers\$/g, + RuntimeGlobals.hmrDownloadUpdateHandlers + ) + .replace( + /\$hmrInvalidateModuleHandlers\$/g, + RuntimeGlobals.hmrInvalidateModuleHandlers + ) + ]) + : "// no HMR", + "", + withHmrManifest + ? Template.asString([ + `${RuntimeGlobals.hmrDownloadManifest} = function() {`, + Template.indent([ + "return new Promise(function(resolve, reject) {", + Template.indent([ + `var filename = require('path').join(__dirname, ${JSON.stringify( + rootOutputDir + )} + ${RuntimeGlobals.getUpdateManifestFilename}());`, + "require('fs').readFile(filename, 'utf-8', function(err, content) {", + Template.indent([ + "if(err) {", + Template.indent([ + 'if(err.code === "ENOENT") return resolve();', + "return reject(err);" + ]), + "}", + "try { resolve(JSON.parse(content)); }", + "catch(e) { reject(e); }" + ]), + "});" + ]), + "});" + ]), + "}" + ]) + : "// no HMR manifest" + ]); } } -module.exports = RuleSetCompiler; +module.exports = ReadFileChunkLoadingRuntimeModule; /***/ }), -/***/ 84977: +/***/ 73163: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -108281,362 +106145,212 @@ module.exports = RuleSetCompiler; -const util = __webpack_require__(73837); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const AsyncWasmLoadingRuntimeModule = __webpack_require__(5434); -/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */ -/** @typedef {import("./RuleSetCompiler").Effect} Effect */ +/** @typedef {import("../Compiler")} Compiler */ -class UseEffectRulePlugin { +class ReadFileCompileAsyncWasmPlugin { + constructor({ type = "async-node", import: useImport = false } = {}) { + this._type = type; + this._import = useImport; + } /** - * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply(ruleSetCompiler) { - ruleSetCompiler.hooks.rule.tap( - "UseEffectRulePlugin", - (path, rule, unhandledProperties, result, references) => { - const conflictWith = (property, correctProperty) => { - if (unhandledProperties.has(property)) { - throw ruleSetCompiler.error( - `${path}.${property}`, - rule[property], - `A Rule must not have a '${property}' property when it has a '${correctProperty}' property` - ); - } + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "ReadFileCompileAsyncWasmPlugin", + compilation => { + const globalWasmLoading = compilation.outputOptions.wasmLoading; + const isEnabledForChunk = chunk => { + const options = chunk.getEntryOptions(); + const wasmLoading = + options && options.wasmLoading !== undefined + ? options.wasmLoading + : globalWasmLoading; + return wasmLoading === this._type; }; + const generateLoadBinaryCode = this._import + ? path => + Template.asString([ + "Promise.all([import('fs'), import('url')]).then(([{ readFile }, { URL }]) => new Promise((resolve, reject) => {", + Template.indent([ + `readFile(new URL(${path}, import.meta.url), (err, buffer) => {`, + Template.indent([ + "if (err) return reject(err);", + "", + "// Fake fetch response", + "resolve({", + Template.indent(["arrayBuffer() { return buffer; }"]), + "});" + ]), + "});" + ]), + "}))" + ]) + : path => + Template.asString([ + "new Promise(function (resolve, reject) {", + Template.indent([ + "try {", + Template.indent([ + "var { readFile } = require('fs');", + "var { join } = require('path');", + "", + `readFile(join(__dirname, ${path}), function(err, buffer){`, + Template.indent([ + "if (err) return reject(err);", + "", + "// Fake fetch response", + "resolve({", + Template.indent(["arrayBuffer() { return buffer; }"]), + "});" + ]), + "});" + ]), + "} catch (err) { reject(err); }" + ]), + "})" + ]); - if (unhandledProperties.has("use")) { - unhandledProperties.delete("use"); - unhandledProperties.delete("enforce"); - - conflictWith("loader", "use"); - conflictWith("options", "use"); - - const use = rule.use; - const enforce = rule.enforce; - - const type = enforce ? `use-${enforce}` : "use"; - - /** - * - * @param {string} path options path - * @param {string} defaultIdent default ident when none is provided - * @param {object} item user provided use value - * @returns {Effect|function(any): Effect[]} effect - */ - const useToEffect = (path, defaultIdent, item) => { - if (typeof item === "function") { - return data => useToEffectsWithoutIdent(path, item(data)); - } else { - return useToEffectRaw(path, defaultIdent, item); - } - }; - - /** - * - * @param {string} path options path - * @param {string} defaultIdent default ident when none is provided - * @param {object} item user provided use value - * @returns {Effect} effect - */ - const useToEffectRaw = (path, defaultIdent, item) => { - if (typeof item === "string") { - return { - type, - value: { - loader: item, - options: undefined, - ident: undefined - } - }; - } else { - const loader = item.loader; - const options = item.options; - let ident = item.ident; - if (options && typeof options === "object") { - if (!ident) ident = defaultIdent; - references.set(ident, options); - } - if (typeof options === "string") { - util.deprecate( - () => {}, - `Using a string as loader options is deprecated (${path}.options)`, - "DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING" - )(); - } - return { - type: enforce ? `use-${enforce}` : "use", - value: { - loader, - options, - ident - } - }; - } - }; - - /** - * @param {string} path options path - * @param {any} items user provided use value - * @returns {Effect[]} effects - */ - const useToEffectsWithoutIdent = (path, items) => { - if (Array.isArray(items)) { - return items.map((item, idx) => - useToEffectRaw(`${path}[${idx}]`, "[[missing ident]]", item) - ); - } - return [useToEffectRaw(path, "[[missing ident]]", items)]; - }; - - /** - * @param {string} path current path - * @param {any} items user provided use value - * @returns {(Effect|function(any): Effect[])[]} effects - */ - const useToEffects = (path, items) => { - if (Array.isArray(items)) { - return items.map((item, idx) => { - const subPath = `${path}[${idx}]`; - return useToEffect(subPath, subPath, item); - }); - } - return [useToEffect(path, path, items)]; - }; - - if (typeof use === "function") { - result.effects.push(data => - useToEffectsWithoutIdent(`${path}.use`, use(data)) - ); - } else { - for (const effect of useToEffects(`${path}.use`, use)) { - result.effects.push(effect); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.instantiateWasm) + .tap("ReadFileCompileAsyncWasmPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + const chunkGraph = compilation.chunkGraph; + if ( + !chunkGraph.hasModuleInGraph( + chunk, + m => m.type === "webassembly/async" + ) + ) { + return; } - } - } - - if (unhandledProperties.has("loader")) { - unhandledProperties.delete("loader"); - unhandledProperties.delete("options"); - unhandledProperties.delete("enforce"); - - const loader = rule.loader; - const options = rule.options; - const enforce = rule.enforce; - - if (loader.includes("!")) { - throw ruleSetCompiler.error( - `${path}.loader`, - loader, - "Exclamation mark separated loader lists has been removed in favor of the 'use' property with arrays" - ); - } - - if (loader.includes("?")) { - throw ruleSetCompiler.error( - `${path}.loader`, - loader, - "Query arguments on 'loader' has been removed in favor of the 'options' property" + set.add(RuntimeGlobals.publicPath); + compilation.addRuntimeModule( + chunk, + new AsyncWasmLoadingRuntimeModule({ + generateLoadBinaryCode, + supportsStreaming: false + }) ); - } - - if (typeof options === "string") { - util.deprecate( - () => {}, - `Using a string as loader options is deprecated (${path}.options)`, - "DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING" - )(); - } - - const ident = - options && typeof options === "object" ? path : undefined; - references.set(ident, options); - result.effects.push({ - type: enforce ? `use-${enforce}` : "use", - value: { - loader, - options, - ident - } }); - } } ); } - - useItemToEffects(path, item) {} } -module.exports = UseEffectRulePlugin; +module.exports = ReadFileCompileAsyncWasmPlugin; /***/ }), -/***/ 63672: +/***/ 98939: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const HelperRuntimeModule = __webpack_require__(82444); +const Template = __webpack_require__(39722); +const WasmChunkLoadingRuntimeModule = __webpack_require__(87394); -class AsyncModuleRuntimeModule extends HelperRuntimeModule { - constructor() { - super("async module"); - } +/** @typedef {import("../Compiler")} Compiler */ - /** - * @returns {string} runtime code - */ - generate() { - const { runtimeTemplate } = this.compilation; - const fn = RuntimeGlobals.asyncModule; - return Template.asString([ - 'var webpackThen = typeof Symbol === "function" ? Symbol("webpack then") : "__webpack_then__";', - 'var webpackExports = typeof Symbol === "function" ? Symbol("webpack exports") : "__webpack_exports__";', - 'var webpackError = typeof Symbol === "function" ? Symbol("webpack error") : "__webpack_error__";', - `var completeQueue = ${runtimeTemplate.basicFunction("queue", [ - "if(queue) {", - Template.indent([ - `queue.forEach(${runtimeTemplate.expressionFunction( - "fn.r--", - "fn" - )});`, - `queue.forEach(${runtimeTemplate.expressionFunction( - "fn.r-- ? fn.r++ : fn()", - "fn" - )});` - ]), - "}" - ])}`, - `var completeFunction = ${runtimeTemplate.expressionFunction( - "!--fn.r && fn()", - "fn" - )};`, - `var queueFunction = ${runtimeTemplate.expressionFunction( - "queue ? queue.push(fn) : completeFunction(fn)", - "queue, fn" - )};`, - `var wrapDeps = ${runtimeTemplate.returningFunction( - `deps.map(${runtimeTemplate.basicFunction("dep", [ - 'if(dep !== null && typeof dep === "object") {', - Template.indent([ - "if(dep[webpackThen]) return dep;", - "if(dep.then) {", - Template.indent([ - "var queue = [];", - `dep.then(${runtimeTemplate.basicFunction("r", [ - "obj[webpackExports] = r;", - "completeQueue(queue);", - "queue = 0;" - ])}, ${runtimeTemplate.basicFunction("e", [ - "obj[webpackError] = e;", - "completeQueue(queue);", - "queue = 0;" - ])});`, - "var obj = {};", - `obj[webpackThen] = ${runtimeTemplate.expressionFunction( - "queueFunction(queue, fn), dep['catch'](reject)", - "fn, reject" - )};`, - "return obj;" - ]), - "}" - ]), - "}", - "var ret = {};", - `ret[webpackThen] = ${runtimeTemplate.expressionFunction( - "completeFunction(fn)", - "fn" - )};`, - "ret[webpackExports] = dep;", - "return ret;" - ])})`, - "deps" - )};`, - `${fn} = ${runtimeTemplate.basicFunction("module, body, hasAwait", [ - "var queue = hasAwait && [];", - "var exports = module.exports;", - "var currentDeps;", - "var outerResolve;", - "var reject;", - "var isEvaluating = true;", - "var nested = false;", - `var whenAll = ${runtimeTemplate.basicFunction( - "deps, onResolve, onReject", - [ - "if (nested) return;", - "nested = true;", - "onResolve.r += deps.length;", - `deps.map(${runtimeTemplate.expressionFunction( - "dep[webpackThen](onResolve, onReject)", - "dep, i" - )});`, - "nested = false;" - ] - )};`, - `var promise = new Promise(${runtimeTemplate.basicFunction( - "resolve, rej", - [ - "reject = rej;", - `outerResolve = ${runtimeTemplate.expressionFunction( - "resolve(exports), completeQueue(queue), queue = 0" - )};` - ] - )});`, - "promise[webpackExports] = exports;", - `promise[webpackThen] = ${runtimeTemplate.basicFunction( - "fn, rejectFn", - [ - "if (isEvaluating) { return completeFunction(fn); }", - "if (currentDeps) whenAll(currentDeps, fn, rejectFn);", - "queueFunction(queue, fn);", - "promise['catch'](rejectFn);" - ] - )};`, - "module.exports = promise;", - `body(${runtimeTemplate.basicFunction("deps", [ - "currentDeps = wrapDeps(deps);", - "var fn;", - `var getResult = ${runtimeTemplate.returningFunction( - `currentDeps.map(${runtimeTemplate.basicFunction("d", [ - "if(d[webpackError]) throw d[webpackError];", - "return d[webpackExports];" - ])})` - )}`, - `var promise = new Promise(${runtimeTemplate.basicFunction( - "resolve, reject", - [ - `fn = ${runtimeTemplate.expressionFunction( - "resolve(getResult)" - )};`, - "fn.r = 0;", - "whenAll(currentDeps, fn, reject);" - ] - )});`, - "return fn.r ? promise : getResult();" - ])}, ${runtimeTemplate.expressionFunction( - "err && reject(promise[webpackError] = err), outerResolve()", - "err" - )});`, - "isEvaluating = false;" - ])};` - ]); +// TODO webpack 6 remove + +class ReadFileCompileWasmPlugin { + constructor(options) { + this.options = options || {}; + } + + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "ReadFileCompileWasmPlugin", + compilation => { + const globalWasmLoading = compilation.outputOptions.wasmLoading; + const isEnabledForChunk = chunk => { + const options = chunk.getEntryOptions(); + const wasmLoading = + options && options.wasmLoading !== undefined + ? options.wasmLoading + : globalWasmLoading; + return wasmLoading === "async-node"; + }; + const generateLoadBinaryCode = path => + Template.asString([ + "new Promise(function (resolve, reject) {", + Template.indent([ + "var { readFile } = require('fs');", + "var { join } = require('path');", + "", + "try {", + Template.indent([ + `readFile(join(__dirname, ${path}), function(err, buffer){`, + Template.indent([ + "if (err) return reject(err);", + "", + "// Fake fetch response", + "resolve({", + Template.indent(["arrayBuffer() { return buffer; }"]), + "});" + ]), + "});" + ]), + "} catch (err) { reject(err); }" + ]), + "})" + ]); + + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("ReadFileCompileWasmPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + const chunkGraph = compilation.chunkGraph; + if ( + !chunkGraph.hasModuleInGraph( + chunk, + m => m.type === "webassembly/sync" + ) + ) { + return; + } + set.add(RuntimeGlobals.moduleCache); + compilation.addRuntimeModule( + chunk, + new WasmChunkLoadingRuntimeModule({ + generateLoadBinaryCode, + supportsStreaming: false, + mangleImports: this.options.mangleImports, + runtimeRequirements: set + }) + ); + }); + } + ); } } -module.exports = AsyncModuleRuntimeModule; +module.exports = ReadFileCompileWasmPlugin; /***/ }), -/***/ 66532: +/***/ 94172: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -108648,1759 +106362,2795 @@ module.exports = AsyncModuleRuntimeModule; const RuntimeGlobals = __webpack_require__(16475); const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); -const JavascriptModulesPlugin = __webpack_require__(89464); +const Template = __webpack_require__(39722); +const { + chunkHasJs, + getChunkFilenameTemplate +} = __webpack_require__(89464); +const { getInitialChunkIds } = __webpack_require__(98124); +const compileBooleanMatcher = __webpack_require__(29404); const { getUndoPath } = __webpack_require__(82186); -class AutoPublicPathRuntimeModule extends RuntimeModule { - constructor() { - super("publicPath", RuntimeModule.STAGE_BASIC); +class RequireChunkLoadingRuntimeModule extends RuntimeModule { + constructor(runtimeRequirements) { + super("require chunk loading", RuntimeModule.STAGE_ATTACH); + this.runtimeRequirements = runtimeRequirements; } /** * @returns {string} runtime code */ generate() { - const { compilation } = this; - const { scriptType, importMetaName, path } = compilation.outputOptions; - const chunkName = compilation.getPath( - JavascriptModulesPlugin.getChunkFilenameTemplate( - this.chunk, - compilation.outputOptions - ), + const { chunkGraph, chunk } = this; + const { runtimeTemplate } = this.compilation; + const fn = RuntimeGlobals.ensureChunkHandlers; + const withBaseURI = this.runtimeRequirements.has(RuntimeGlobals.baseURI); + const withExternalInstallChunk = this.runtimeRequirements.has( + RuntimeGlobals.externalInstallChunk + ); + const withOnChunkLoad = this.runtimeRequirements.has( + RuntimeGlobals.onChunksLoaded + ); + const withLoading = this.runtimeRequirements.has( + RuntimeGlobals.ensureChunkHandlers + ); + const withHmr = this.runtimeRequirements.has( + RuntimeGlobals.hmrDownloadUpdateHandlers + ); + const withHmrManifest = this.runtimeRequirements.has( + RuntimeGlobals.hmrDownloadManifest + ); + const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs); + const hasJsMatcher = compileBooleanMatcher(conditionMap); + const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); + + const outputName = this.compilation.getPath( + getChunkFilenameTemplate(chunk, this.compilation.outputOptions), { - chunk: this.chunk, + chunk, contentHashType: "javascript" } ); - const undoPath = getUndoPath(chunkName, path, false); + const rootOutputDir = getUndoPath( + outputName, + this.compilation.outputOptions.path, + true + ); + + const stateExpression = withHmr + ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_require` + : undefined; return Template.asString([ - "var scriptUrl;", - scriptType === "module" - ? `if (typeof ${importMetaName}.url === "string") scriptUrl = ${importMetaName}.url` - : Template.asString([ - `if (${RuntimeGlobals.global}.importScripts) scriptUrl = ${RuntimeGlobals.global}.location + "";`, - `var document = ${RuntimeGlobals.global}.document;`, - "if (!scriptUrl && document) {", + withBaseURI + ? Template.asString([ + `${RuntimeGlobals.baseURI} = require("url").pathToFileURL(${ + rootOutputDir !== "./" + ? `__dirname + ${JSON.stringify("/" + rootOutputDir)}` + : "__filename" + });` + ]) + : "// no baseURI", + "", + "// object to store loaded chunks", + '// "1" means "loaded", otherwise not loaded yet', + `var installedChunks = ${ + stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" + }{`, + Template.indent( + Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 1`).join( + ",\n" + ) + ), + "};", + "", + withOnChunkLoad + ? `${ + RuntimeGlobals.onChunksLoaded + }.require = ${runtimeTemplate.returningFunction( + "installedChunks[chunkId]", + "chunkId" + )};` + : "// no on chunks loaded", + "", + withLoading || withExternalInstallChunk + ? `var installChunk = ${runtimeTemplate.basicFunction("chunk", [ + "var moreModules = chunk.modules, chunkIds = chunk.ids, runtime = chunk.runtime;", + "for(var moduleId in moreModules) {", Template.indent([ - `if (document.currentScript)`, - Template.indent(`scriptUrl = document.currentScript.src`), - "if (!scriptUrl) {", + `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, Template.indent([ - 'var scripts = document.getElementsByTagName("script");', - "if(scripts.length) scriptUrl = scripts[scripts.length - 1].src" + `${RuntimeGlobals.moduleFactories}[moduleId] = moreModules[moduleId];` ]), "}" ]), + "}", + `if(runtime) runtime(__webpack_require__);`, + "for(var i = 0; i < chunkIds.length; i++)", + Template.indent("installedChunks[chunkIds[i]] = 1;"), + withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : "" + ])};` + : "// no chunk install function needed", + "", + withLoading + ? Template.asString([ + "// require() chunk loading for javascript", + `${fn}.require = ${runtimeTemplate.basicFunction( + "chunkId, promises", + hasJsMatcher !== false + ? [ + '// "1" is the signal for "already loaded"', + "if(!installedChunks[chunkId]) {", + Template.indent([ + hasJsMatcher === true + ? "if(true) { // all chunks have JS" + : `if(${hasJsMatcher("chunkId")}) {`, + Template.indent([ + `installChunk(require(${JSON.stringify( + rootOutputDir + )} + ${ + RuntimeGlobals.getChunkScriptFilename + }(chunkId)));` + ]), + "} else installedChunks[chunkId] = 1;", + "" + ]), + "}" + ] + : "installedChunks[chunkId] = 1;" + )};` + ]) + : "// no chunk loading", + "", + withExternalInstallChunk + ? Template.asString([ + "module.exports = __webpack_require__;", + `${RuntimeGlobals.externalInstallChunk} = installChunk;` + ]) + : "// no external install chunk", + "", + withHmr + ? Template.asString([ + "function loadUpdateChunk(chunkId, updatedModulesList) {", + Template.indent([ + `var update = require(${JSON.stringify(rootOutputDir)} + ${ + RuntimeGlobals.getChunkUpdateScriptFilename + }(chunkId));`, + "var updatedModules = update.modules;", + "var runtime = update.runtime;", + "for(var moduleId in updatedModules) {", + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(updatedModules, moduleId)) {`, + Template.indent([ + `currentUpdate[moduleId] = updatedModules[moduleId];`, + "if(updatedModulesList) updatedModulesList.push(moduleId);" + ]), + "}" + ]), + "}", + "if(runtime) currentUpdateRuntime.push(runtime);" + ]), + "}", + "", + Template.getFunctionContent( + require('./JavascriptHotModuleReplacement.runtime.js') + ) + .replace(/\$key\$/g, "require") + .replace(/\$installedChunks\$/g, "installedChunks") + .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") + .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) + .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) + .replace( + /\$ensureChunkHandlers\$/g, + RuntimeGlobals.ensureChunkHandlers + ) + .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) + .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) + .replace( + /\$hmrDownloadUpdateHandlers\$/g, + RuntimeGlobals.hmrDownloadUpdateHandlers + ) + .replace( + /\$hmrInvalidateModuleHandlers\$/g, + RuntimeGlobals.hmrInvalidateModuleHandlers + ) + ]) + : "// no HMR", + "", + withHmrManifest + ? Template.asString([ + `${RuntimeGlobals.hmrDownloadManifest} = function() {`, + Template.indent([ + "return Promise.resolve().then(function() {", + Template.indent([ + `return require(${JSON.stringify(rootOutputDir)} + ${ + RuntimeGlobals.getUpdateManifestFilename + }());` + ]), + "})['catch'](function(err) { if(err.code !== 'MODULE_NOT_FOUND') throw err; });" + ]), "}" - ]), - "// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration", - '// or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.', - 'if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");', - 'scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\\?.*$/, "").replace(/\\/[^\\/]+$/, "/");', - !undoPath - ? `${RuntimeGlobals.publicPath} = scriptUrl;` - : `${RuntimeGlobals.publicPath} = scriptUrl + ${JSON.stringify( - undoPath - )};` + ]) + : "// no HMR manifest" ]); } } -module.exports = AutoPublicPathRuntimeModule; +module.exports = RequireChunkLoadingRuntimeModule; /***/ }), -/***/ 84519: +/***/ 91786: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); +const util = __webpack_require__(73837); +const truncateArgs = __webpack_require__(62090); -class ChunkNameRuntimeModule extends RuntimeModule { - /** - * @param {string} chunkName the chunk's name - */ - constructor(chunkName) { - super("chunkName"); - this.chunkName = chunkName; - } +module.exports = ({ colors, appendOnly, stream }) => { + let currentStatusMessage = undefined; + let hasStatusMessage = false; + let currentIndent = ""; + let currentCollapsed = 0; - /** - * @returns {string} runtime code - */ - generate() { - return `${RuntimeGlobals.chunkName} = ${JSON.stringify(this.chunkName)};`; - } -} + const indent = (str, prefix, colorPrefix, colorSuffix) => { + if (str === "") return str; + prefix = currentIndent + prefix; + if (colors) { + return ( + prefix + + colorPrefix + + str.replace(/\n/g, colorSuffix + "\n" + prefix + colorPrefix) + + colorSuffix + ); + } else { + return prefix + str.replace(/\n/g, "\n" + prefix); + } + }; -module.exports = ChunkNameRuntimeModule; + const clearStatusMessage = () => { + if (hasStatusMessage) { + stream.write("\x1b[2K\r"); + hasStatusMessage = false; + } + }; + + const writeStatusMessage = () => { + if (!currentStatusMessage) return; + const l = stream.columns; + const args = l + ? truncateArgs(currentStatusMessage, l - 1) + : currentStatusMessage; + const str = args.join(" "); + const coloredStr = `\u001b[1m${str}\u001b[39m\u001b[22m`; + stream.write(`\x1b[2K\r${coloredStr}`); + hasStatusMessage = true; + }; + + const writeColored = (prefix, colorPrefix, colorSuffix) => { + return (...args) => { + if (currentCollapsed > 0) return; + clearStatusMessage(); + const str = indent( + util.format(...args), + prefix, + colorPrefix, + colorSuffix + ); + stream.write(str + "\n"); + writeStatusMessage(); + }; + }; + + const writeGroupMessage = writeColored( + "<-> ", + "\u001b[1m\u001b[36m", + "\u001b[39m\u001b[22m" + ); + + const writeGroupCollapsedMessage = writeColored( + "<+> ", + "\u001b[1m\u001b[36m", + "\u001b[39m\u001b[22m" + ); + + return { + log: writeColored(" ", "\u001b[1m", "\u001b[22m"), + debug: writeColored(" ", "", ""), + trace: writeColored(" ", "", ""), + info: writeColored(" ", "\u001b[1m\u001b[32m", "\u001b[39m\u001b[22m"), + warn: writeColored(" ", "\u001b[1m\u001b[33m", "\u001b[39m\u001b[22m"), + error: writeColored(" ", "\u001b[1m\u001b[31m", "\u001b[39m\u001b[22m"), + logTime: writeColored( + " ", + "\u001b[1m\u001b[35m", + "\u001b[39m\u001b[22m" + ), + group: (...args) => { + writeGroupMessage(...args); + if (currentCollapsed > 0) { + currentCollapsed++; + } else { + currentIndent += " "; + } + }, + groupCollapsed: (...args) => { + writeGroupCollapsedMessage(...args); + currentCollapsed++; + }, + groupEnd: () => { + if (currentCollapsed > 0) currentCollapsed--; + else if (currentIndent.length >= 2) + currentIndent = currentIndent.slice(0, currentIndent.length - 2); + }, + // eslint-disable-next-line node/no-unsupported-features/node-builtins + profile: console.profile && (name => console.profile(name)), + // eslint-disable-next-line node/no-unsupported-features/node-builtins + profileEnd: console.profileEnd && (name => console.profileEnd(name)), + clear: + !appendOnly && + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.clear && + (() => { + clearStatusMessage(); + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.clear(); + writeStatusMessage(); + }), + status: appendOnly + ? writeColored(" ", "", "") + : (name, ...args) => { + args = args.filter(Boolean); + if (name === undefined && args.length === 0) { + clearStatusMessage(); + currentStatusMessage = undefined; + } else if ( + typeof name === "string" && + name.startsWith("[webpack.Progress] ") + ) { + currentStatusMessage = [name.slice(19), ...args]; + writeStatusMessage(); + } else if (name === "[webpack.Progress]") { + currentStatusMessage = [...args]; + writeStatusMessage(); + } else { + currentStatusMessage = [name, ...args]; + writeStatusMessage(); + } + } + }; +}; /***/ }), -/***/ 44793: +/***/ 64395: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const HelperRuntimeModule = __webpack_require__(82444); +const { STAGE_ADVANCED } = __webpack_require__(80057); + +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compiler")} Compiler */ + +class AggressiveMergingPlugin { + constructor(options) { + if ( + (options !== undefined && typeof options !== "object") || + Array.isArray(options) + ) { + throw new Error( + "Argument should be an options object. To use defaults, pass in nothing.\nFor more info on options, see https://webpack.js.org/plugins/" + ); + } + this.options = options || {}; + } + + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const options = this.options; + const minSizeReduce = options.minSizeReduce || 1.5; + + compiler.hooks.thisCompilation.tap( + "AggressiveMergingPlugin", + compilation => { + compilation.hooks.optimizeChunks.tap( + { + name: "AggressiveMergingPlugin", + stage: STAGE_ADVANCED + }, + chunks => { + const chunkGraph = compilation.chunkGraph; + /** @type {{a: Chunk, b: Chunk, improvement: number}[]} */ + let combinations = []; + for (const a of chunks) { + if (a.canBeInitial()) continue; + for (const b of chunks) { + if (b.canBeInitial()) continue; + if (b === a) break; + if (!chunkGraph.canChunksBeIntegrated(a, b)) { + continue; + } + const aSize = chunkGraph.getChunkSize(b, { + chunkOverhead: 0 + }); + const bSize = chunkGraph.getChunkSize(a, { + chunkOverhead: 0 + }); + const abSize = chunkGraph.getIntegratedChunksSize(b, a, { + chunkOverhead: 0 + }); + const improvement = (aSize + bSize) / abSize; + combinations.push({ + a, + b, + improvement + }); + } + } + + combinations.sort((a, b) => { + return b.improvement - a.improvement; + }); + + const pair = combinations[0]; -class CompatGetDefaultExportRuntimeModule extends HelperRuntimeModule { - constructor() { - super("compat get default export"); - } + if (!pair) return; + if (pair.improvement < minSizeReduce) return; - /** - * @returns {string} runtime code - */ - generate() { - const { runtimeTemplate } = this.compilation; - const fn = RuntimeGlobals.compatGetDefaultExport; - return Template.asString([ - "// getDefaultExport function for compatibility with non-harmony modules", - `${fn} = ${runtimeTemplate.basicFunction("module", [ - "var getter = module && module.__esModule ?", - Template.indent([ - `${runtimeTemplate.returningFunction("module['default']")} :`, - `${runtimeTemplate.returningFunction("module")};` - ]), - `${RuntimeGlobals.definePropertyGetters}(getter, { a: getter });`, - "return getter;" - ])};` - ]); + chunkGraph.integrateChunks(pair.b, pair.a); + compilation.chunks.delete(pair.a); + return true; + } + ); + } + ); } } -module.exports = CompatGetDefaultExportRuntimeModule; +module.exports = AggressiveMergingPlugin; /***/ }), -/***/ 88234: +/***/ 15543: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); +const { STAGE_ADVANCED } = __webpack_require__(80057); +const { intersect } = __webpack_require__(93347); +const { + compareModulesByIdentifier, + compareChunks +} = __webpack_require__(29579); +const createSchemaValidation = __webpack_require__(32540); +const identifierUtils = __webpack_require__(82186); -/** @typedef {import("../MainTemplate")} MainTemplate */ +/** @typedef {import("../../declarations/plugins/optimize/AggressiveSplittingPlugin").AggressiveSplittingPluginOptions} AggressiveSplittingPluginOptions */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ -class CompatRuntimeModule extends RuntimeModule { - constructor() { - super("compat", RuntimeModule.STAGE_ATTACH); - this.fullHash = true; +const validate = createSchemaValidation( + __webpack_require__(32697), + () => + __webpack_require__(47995), + { + name: "Aggressive Splitting Plugin", + baseDataPath: "options" } +); + +const moveModuleBetween = (chunkGraph, oldChunk, newChunk) => { + return module => { + chunkGraph.disconnectChunkAndModule(oldChunk, module); + chunkGraph.connectChunkAndModule(newChunk, module); + }; +}; + +/** + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {Chunk} chunk the chunk + * @returns {function(Module): boolean} filter for entry module + */ +const isNotAEntryModule = (chunkGraph, chunk) => { + return module => { + return !chunkGraph.isEntryModuleInChunk(module, chunk); + }; +}; + +/** @type {WeakSet} */ +const recordedChunks = new WeakSet(); +class AggressiveSplittingPlugin { /** - * @returns {string} runtime code + * @param {AggressiveSplittingPluginOptions=} options options object */ - generate() { - const { chunkGraph, chunk, compilation } = this; - const { - runtimeTemplate, - mainTemplate, - moduleTemplates, - dependencyTemplates - } = compilation; - const bootstrap = mainTemplate.hooks.bootstrap.call( - "", - chunk, - compilation.hash || "XXXX", - moduleTemplates.javascript, - dependencyTemplates - ); - const localVars = mainTemplate.hooks.localVars.call( - "", - chunk, - compilation.hash || "XXXX" - ); - const requireExtensions = mainTemplate.hooks.requireExtensions.call( - "", - chunk, - compilation.hash || "XXXX" - ); - const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk); - let requireEnsure = ""; - if (runtimeRequirements.has(RuntimeGlobals.ensureChunk)) { - const requireEnsureHandler = mainTemplate.hooks.requireEnsure.call( - "", - chunk, - compilation.hash || "XXXX", - "chunkId" - ); - if (requireEnsureHandler) { - requireEnsure = `${ - RuntimeGlobals.ensureChunkHandlers - }.compat = ${runtimeTemplate.basicFunction( - "chunkId, promises", - requireEnsureHandler - )};`; - } + constructor(options = {}) { + validate(options); + + this.options = options; + if (typeof this.options.minSize !== "number") { + this.options.minSize = 30 * 1024; + } + if (typeof this.options.maxSize !== "number") { + this.options.maxSize = 50 * 1024; + } + if (typeof this.options.chunkOverhead !== "number") { + this.options.chunkOverhead = 0; + } + if (typeof this.options.entryChunkMultiplicator !== "number") { + this.options.entryChunkMultiplicator = 1; } - return [bootstrap, localVars, requireEnsure, requireExtensions] - .filter(Boolean) - .join("\n"); } /** - * @returns {boolean} true, if the runtime module should get it's own scope + * @param {Chunk} chunk the chunk to test + * @returns {boolean} true if the chunk was recorded */ - shouldIsolate() { - // We avoid isolating this to have better backward-compat - return false; - } -} - -module.exports = CompatRuntimeModule; - - -/***/ }), - -/***/ 94669: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const HelperRuntimeModule = __webpack_require__(82444); - -class CreateFakeNamespaceObjectRuntimeModule extends HelperRuntimeModule { - constructor() { - super("create fake namespace object"); + static wasChunkRecorded(chunk) { + return recordedChunks.has(chunk); } /** - * @returns {string} runtime code + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - generate() { - const { runtimeTemplate } = this.compilation; - const fn = RuntimeGlobals.createFakeNamespaceObject; - return Template.asString([ - `var getProto = Object.getPrototypeOf ? ${runtimeTemplate.returningFunction( - "Object.getPrototypeOf(obj)", - "obj" - )} : ${runtimeTemplate.returningFunction("obj.__proto__", "obj")};`, - "var leafPrototypes;", - "// create a fake namespace object", - "// mode & 1: value is a module id, require it", - "// mode & 2: merge all properties of value into the ns", - "// mode & 4: return value when already ns object", - "// mode & 16: return value when it's Promise-like", - "// mode & 8|1: behave like require", - // Note: must be a function (not arrow), because this is used in body! - `${fn} = function(value, mode) {`, - Template.indent([ - `if(mode & 1) value = this(value);`, - `if(mode & 8) return value;`, - "if(typeof value === 'object' && value) {", - Template.indent([ - "if((mode & 4) && value.__esModule) return value;", - "if((mode & 16) && typeof value.then === 'function') return value;" - ]), - "}", - "var ns = Object.create(null);", - `${RuntimeGlobals.makeNamespaceObject}(ns);`, - "var def = {};", - "leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];", - "for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {", - Template.indent([ - `Object.getOwnPropertyNames(current).forEach(${runtimeTemplate.expressionFunction( - `def[key] = ${runtimeTemplate.returningFunction("value[key]", "")}`, - "key" - )});` - ]), - "}", - `def['default'] = ${runtimeTemplate.returningFunction("value", "")};`, - `${RuntimeGlobals.definePropertyGetters}(ns, def);`, - "return ns;" - ]), - "};" - ]); - } -} - -module.exports = CreateFakeNamespaceObjectRuntimeModule; - + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "AggressiveSplittingPlugin", + compilation => { + let needAdditionalSeal = false; + let newSplits; + let fromAggressiveSplittingSet; + let chunkSplitDataMap; + compilation.hooks.optimize.tap("AggressiveSplittingPlugin", () => { + newSplits = []; + fromAggressiveSplittingSet = new Set(); + chunkSplitDataMap = new Map(); + }); + compilation.hooks.optimizeChunks.tap( + { + name: "AggressiveSplittingPlugin", + stage: STAGE_ADVANCED + }, + chunks => { + const chunkGraph = compilation.chunkGraph; + // Precompute stuff + const nameToModuleMap = new Map(); + const moduleToNameMap = new Map(); + const makePathsRelative = + identifierUtils.makePathsRelative.bindContextCache( + compiler.context, + compiler.root + ); + for (const m of compilation.modules) { + const name = makePathsRelative(m.identifier()); + nameToModuleMap.set(name, m); + moduleToNameMap.set(m, name); + } -/***/ }), + // Check used chunk ids + const usedIds = new Set(); + for (const chunk of chunks) { + usedIds.add(chunk.id); + } -/***/ 2759: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + const recordedSplits = + (compilation.records && compilation.records.aggressiveSplits) || + []; + const usedSplits = newSplits + ? recordedSplits.concat(newSplits) + : recordedSplits; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + const minSize = this.options.minSize; + const maxSize = this.options.maxSize; + const applySplit = splitData => { + // Cannot split if id is already taken + if (splitData.id !== undefined && usedIds.has(splitData.id)) { + return false; + } + // Get module objects from names + const selectedModules = splitData.modules.map(name => + nameToModuleMap.get(name) + ); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const HelperRuntimeModule = __webpack_require__(82444); + // Does the modules exist at all? + if (!selectedModules.every(Boolean)) return false; -class CreateScriptRuntimeModule extends HelperRuntimeModule { - constructor() { - super("trusted types script"); - } + // Check if size matches (faster than waiting for hash) + let size = 0; + for (const m of selectedModules) size += m.size(); + if (size !== splitData.size) return false; - /** - * @returns {string} runtime code - */ - generate() { - const { compilation } = this; - const { runtimeTemplate, outputOptions } = compilation; - const { trustedTypes } = outputOptions; - const fn = RuntimeGlobals.createScript; + // get chunks with all modules + const selectedChunks = intersect( + selectedModules.map( + m => new Set(chunkGraph.getModuleChunksIterable(m)) + ) + ); - return Template.asString( - `${fn} = ${runtimeTemplate.returningFunction( - trustedTypes - ? `${RuntimeGlobals.getTrustedTypesPolicy}().createScript(script)` - : "script", - "script" - )};` - ); - } -} + // No relevant chunks found + if (selectedChunks.size === 0) return false; -module.exports = CreateScriptRuntimeModule; + // The found chunk is already the split or similar + if ( + selectedChunks.size === 1 && + chunkGraph.getNumberOfChunkModules( + Array.from(selectedChunks)[0] + ) === selectedModules.length + ) { + const chunk = Array.from(selectedChunks)[0]; + if (fromAggressiveSplittingSet.has(chunk)) return false; + fromAggressiveSplittingSet.add(chunk); + chunkSplitDataMap.set(chunk, splitData); + return true; + } + // split the chunk into two parts + const newChunk = compilation.addChunk(); + newChunk.chunkReason = "aggressive splitted"; + for (const chunk of selectedChunks) { + selectedModules.forEach( + moveModuleBetween(chunkGraph, chunk, newChunk) + ); + chunk.split(newChunk); + chunk.name = null; + } + fromAggressiveSplittingSet.add(newChunk); + chunkSplitDataMap.set(newChunk, splitData); -/***/ }), + if (splitData.id !== null && splitData.id !== undefined) { + newChunk.id = splitData.id; + newChunk.ids = [splitData.id]; + } + return true; + }; -/***/ 21213: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // try to restore to recorded splitting + let changed = false; + for (let j = 0; j < usedSplits.length; j++) { + const splitData = usedSplits[j]; + if (applySplit(splitData)) changed = true; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + // for any chunk which isn't splitted yet, split it and create a new entry + // start with the biggest chunk + const cmpFn = compareChunks(chunkGraph); + const sortedChunks = Array.from(chunks).sort((a, b) => { + const diff1 = + chunkGraph.getChunkModulesSize(b) - + chunkGraph.getChunkModulesSize(a); + if (diff1) return diff1; + const diff2 = + chunkGraph.getNumberOfChunkModules(a) - + chunkGraph.getNumberOfChunkModules(b); + if (diff2) return diff2; + return cmpFn(a, b); + }); + for (const chunk of sortedChunks) { + if (fromAggressiveSplittingSet.has(chunk)) continue; + const size = chunkGraph.getChunkModulesSize(chunk); + if ( + size > maxSize && + chunkGraph.getNumberOfChunkModules(chunk) > 1 + ) { + const modules = chunkGraph + .getOrderedChunkModules(chunk, compareModulesByIdentifier) + .filter(isNotAEntryModule(chunkGraph, chunk)); + const selectedModules = []; + let selectedModulesSize = 0; + for (let k = 0; k < modules.length; k++) { + const module = modules[k]; + const newSize = selectedModulesSize + module.size(); + if (newSize > maxSize && selectedModulesSize >= minSize) { + break; + } + selectedModulesSize = newSize; + selectedModules.push(module); + } + if (selectedModules.length === 0) continue; + const splitData = { + modules: selectedModules + .map(m => moduleToNameMap.get(m)) + .sort(), + size: selectedModulesSize + }; + if (applySplit(splitData)) { + newSplits = (newSplits || []).concat(splitData); + changed = true; + } + } + } + if (changed) return true; + } + ); + compilation.hooks.recordHash.tap( + "AggressiveSplittingPlugin", + records => { + // 4. save made splittings to records + const allSplits = new Set(); + const invalidSplits = new Set(); + // Check if some splittings are invalid + // We remove invalid splittings and try again + for (const chunk of compilation.chunks) { + const splitData = chunkSplitDataMap.get(chunk); + if (splitData !== undefined) { + if (splitData.hash && chunk.hash !== splitData.hash) { + // Split was successful, but hash doesn't equal + // We can throw away the split since it's useless now + invalidSplits.add(splitData); + } + } + } -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const HelperRuntimeModule = __webpack_require__(82444); + if (invalidSplits.size > 0) { + records.aggressiveSplits = records.aggressiveSplits.filter( + splitData => !invalidSplits.has(splitData) + ); + needAdditionalSeal = true; + } else { + // set hash and id values on all (new) splittings + for (const chunk of compilation.chunks) { + const splitData = chunkSplitDataMap.get(chunk); + if (splitData !== undefined) { + splitData.hash = chunk.hash; + splitData.id = chunk.id; + allSplits.add(splitData); + // set flag for stats + recordedChunks.add(chunk); + } + } -class CreateScriptUrlRuntimeModule extends HelperRuntimeModule { - constructor() { - super("trusted types script url"); - } + // Also add all unused historical splits (after the used ones) + // They can still be used in some future compilation + const recordedSplits = + compilation.records && compilation.records.aggressiveSplits; + if (recordedSplits) { + for (const splitData of recordedSplits) { + if (!invalidSplits.has(splitData)) allSplits.add(splitData); + } + } - /** - * @returns {string} runtime code - */ - generate() { - const { compilation } = this; - const { runtimeTemplate, outputOptions } = compilation; - const { trustedTypes } = outputOptions; - const fn = RuntimeGlobals.createScriptUrl; + // record all splits + records.aggressiveSplits = Array.from(allSplits); - return Template.asString( - `${fn} = ${runtimeTemplate.returningFunction( - trustedTypes - ? `${RuntimeGlobals.getTrustedTypesPolicy}().createScriptURL(url)` - : "url", - "url" - )};` + needAdditionalSeal = false; + } + } + ); + compilation.hooks.needAdditionalSeal.tap( + "AggressiveSplittingPlugin", + () => { + if (needAdditionalSeal) { + needAdditionalSeal = false; + return true; + } + } + ); + } ); } } - -module.exports = CreateScriptUrlRuntimeModule; +module.exports = AggressiveSplittingPlugin; /***/ }), -/***/ 75481: +/***/ 97198: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ +const eslintScope = __webpack_require__(36007); +const Referencer = __webpack_require__(44585); +const { + CachedSource, + ConcatSource, + ReplaceSource +} = __webpack_require__(51255); +const ConcatenationScope = __webpack_require__(98229); +const { UsageState } = __webpack_require__(63686); +const Module = __webpack_require__(73208); const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const HelperRuntimeModule = __webpack_require__(82444); +const Template = __webpack_require__(39722); +const HarmonyImportDependency = __webpack_require__(57154); +const JavascriptParser = __webpack_require__(29050); +const { equals } = __webpack_require__(84953); +const LazySet = __webpack_require__(38938); +const { concatComparators, keepOriginalOrder } = __webpack_require__(29579); +const createHash = __webpack_require__(49835); +const { makePathsRelative } = __webpack_require__(82186); +const makeSerializable = __webpack_require__(33032); +const propertyAccess = __webpack_require__(54190); +const { + filterRuntime, + intersectRuntime, + mergeRuntimeCondition, + mergeRuntimeConditionNonFalse, + runtimeConditionToString, + subtractRuntimeCondition +} = __webpack_require__(17156); -class DefinePropertyGettersRuntimeModule extends HelperRuntimeModule { - constructor() { - super("define property getters"); - } +/** @typedef {import("eslint-scope").Scope} Scope */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../CodeGenerationResults")} CodeGenerationResults */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */ +/** @template T @typedef {import("../InitFragment")} InitFragment */ +/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {typeof import("../util/Hash")} HashConstructor */ +/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - /** - * @returns {string} runtime code - */ - generate() { - const { runtimeTemplate } = this.compilation; - const fn = RuntimeGlobals.definePropertyGetters; - return Template.asString([ - "// define getter functions for harmony exports", - `${fn} = ${runtimeTemplate.basicFunction("exports, definition", [ - `for(var key in definition) {`, - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(definition, key) && !${RuntimeGlobals.hasOwnProperty}(exports, key)) {`, - Template.indent([ - "Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });" - ]), - "}" - ]), - "}" - ])};` - ]); - } +// fix eslint-scope to support class properties correctly +// cspell:word Referencer +const ReferencerClass = Referencer; +if (!ReferencerClass.prototype.PropertyDefinition) { + ReferencerClass.prototype.PropertyDefinition = + ReferencerClass.prototype.Property; } -module.exports = DefinePropertyGettersRuntimeModule; - - -/***/ }), - -/***/ 71519: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - +/** + * @typedef {Object} ReexportInfo + * @property {Module} module + * @property {string[]} export + */ -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); +/** @typedef {RawBinding | SymbolBinding} Binding */ -class EnsureChunkRuntimeModule extends RuntimeModule { - constructor(runtimeRequirements) { - super("ensure chunk"); - this.runtimeRequirements = runtimeRequirements; - } +/** + * @typedef {Object} RawBinding + * @property {ModuleInfo} info + * @property {string} rawName + * @property {string=} comment + * @property {string[]} ids + * @property {string[]} exportName + */ - /** - * @returns {string} runtime code - */ - generate() { - const { runtimeTemplate } = this.compilation; - // Check if there are non initial chunks which need to be imported using require-ensure - if (this.runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers)) { - const handlers = RuntimeGlobals.ensureChunkHandlers; - return Template.asString([ - `${handlers} = {};`, - "// This file contains only the entry chunk.", - "// The chunk loading function for additional chunks", - `${RuntimeGlobals.ensureChunk} = ${runtimeTemplate.basicFunction( - "chunkId", - [ - `return Promise.all(Object.keys(${handlers}).reduce(${runtimeTemplate.basicFunction( - "promises, key", - [`${handlers}[key](chunkId, promises);`, "return promises;"] - )}, []));` - ] - )};` - ]); - } else { - // There ensureChunk is used somewhere in the tree, so we need an empty requireEnsure - // function. This can happen with multiple entrypoints. - return Template.asString([ - "// The chunk loading function for additional chunks", - "// Since all referenced chunks are already included", - "// in this file, this function is empty here.", - `${RuntimeGlobals.ensureChunk} = ${runtimeTemplate.returningFunction( - "Promise.resolve()" - )};` - ]); - } - } -} +/** + * @typedef {Object} SymbolBinding + * @property {ConcatenatedModuleInfo} info + * @property {string} name + * @property {string=} comment + * @property {string[]} ids + * @property {string[]} exportName + */ -module.exports = EnsureChunkRuntimeModule; +/** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo } ModuleInfo */ +/** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo | ReferenceToModuleInfo } ModuleInfoOrReference */ +/** + * @typedef {Object} ConcatenatedModuleInfo + * @property {"concatenated"} type + * @property {Module} module + * @property {number} index + * @property {Object} ast + * @property {Source} internalSource + * @property {ReplaceSource} source + * @property {InitFragment[]=} chunkInitFragments + * @property {Iterable} runtimeRequirements + * @property {Scope} globalScope + * @property {Scope} moduleScope + * @property {Map} internalNames + * @property {Map} exportMap + * @property {Map} rawExportMap + * @property {string=} namespaceExportSymbol + * @property {string} namespaceObjectName + * @property {boolean} interopNamespaceObjectUsed + * @property {string} interopNamespaceObjectName + * @property {boolean} interopNamespaceObject2Used + * @property {string} interopNamespaceObject2Name + * @property {boolean} interopDefaultAccessUsed + * @property {string} interopDefaultAccessName + */ -/***/ }), +/** + * @typedef {Object} ExternalModuleInfo + * @property {"external"} type + * @property {Module} module + * @property {RuntimeSpec | boolean} runtimeCondition + * @property {number} index + * @property {string} name + * @property {boolean} interopNamespaceObjectUsed + * @property {string} interopNamespaceObjectName + * @property {boolean} interopNamespaceObject2Used + * @property {string} interopNamespaceObject2Name + * @property {boolean} interopDefaultAccessUsed + * @property {string} interopDefaultAccessName + */ -/***/ 34277: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * @typedef {Object} ReferenceToModuleInfo + * @property {"reference"} type + * @property {RuntimeSpec | boolean} runtimeCondition + * @property {ConcatenatedModuleInfo | ExternalModuleInfo} target + */ -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ +const RESERVED_NAMES = new Set( + [ + // internal names (should always be renamed) + ConcatenationScope.DEFAULT_EXPORT, + ConcatenationScope.NAMESPACE_OBJECT_EXPORT, + // keywords + "abstract,arguments,async,await,boolean,break,byte,case,catch,char,class,const,continue", + "debugger,default,delete,do,double,else,enum,eval,export,extends,false,final,finally,float", + "for,function,goto,if,implements,import,in,instanceof,int,interface,let,long,native,new,null", + "package,private,protected,public,return,short,static,super,switch,synchronized,this,throw", + "throws,transient,true,try,typeof,var,void,volatile,while,with,yield", + // commonjs/amd + "module,__dirname,__filename,exports,require,define", -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); -const { first } = __webpack_require__(93347); + // js globals + "Array,Date,eval,function,hasOwnProperty,Infinity,isFinite,isNaN,isPrototypeOf,length,Math", + "NaN,name,Number,Object,prototype,String,toString,undefined,valueOf", -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("../Compilation").PathData} PathData */ + // browser globals + "alert,all,anchor,anchors,area,assign,blur,button,checkbox,clearInterval,clearTimeout", + "clientInformation,close,closed,confirm,constructor,crypto,decodeURI,decodeURIComponent", + "defaultStatus,document,element,elements,embed,embeds,encodeURI,encodeURIComponent,escape", + "event,fileUpload,focus,form,forms,frame,innerHeight,innerWidth,layer,layers,link,location", + "mimeTypes,navigate,navigator,frames,frameRate,hidden,history,image,images,offscreenBuffering", + "open,opener,option,outerHeight,outerWidth,packages,pageXOffset,pageYOffset,parent,parseFloat", + "parseInt,password,pkcs11,plugin,prompt,propertyIsEnum,radio,reset,screenX,screenY,scroll", + "secure,select,self,setInterval,setTimeout,status,submit,taint,text,textarea,top,unescape", + "untaint,window", -/** @typedef {function(PathData, AssetInfo=): string} FilenameFunction */ + // window events + "onblur,onclick,onerror,onfocus,onkeydown,onkeypress,onkeyup,onmouseover,onload,onmouseup,onmousedown,onsubmit" + ] + .join(",") + .split(",") +); -class GetChunkFilenameRuntimeModule extends RuntimeModule { - /** - * @param {string} contentType the contentType to use the content hash for - * @param {string} name kind of filename - * @param {string} global function name to be assigned - * @param {function(Chunk): string | FilenameFunction} getFilenameForChunk functor to get the filename or function - * @param {boolean} allChunks when false, only async chunks are included - */ - constructor(contentType, name, global, getFilenameForChunk, allChunks) { - super(`get ${name} chunk filename`); - this.contentType = contentType; - this.global = global; - this.getFilenameForChunk = getFilenameForChunk; - this.allChunks = allChunks; - this.dependentHash = true; +const bySourceOrder = (a, b) => { + const aOrder = a.sourceOrder; + const bOrder = b.sourceOrder; + if (isNaN(aOrder)) { + if (!isNaN(bOrder)) { + return 1; + } + } else { + if (isNaN(bOrder)) { + return -1; + } + if (aOrder !== bOrder) { + return aOrder < bOrder ? -1 : 1; + } } + return 0; +}; - /** - * @returns {string} runtime code - */ - generate() { - const { - global, - chunk, - chunkGraph, - contentType, - getFilenameForChunk, - allChunks, - compilation - } = this; - const { runtimeTemplate } = compilation; +const joinIterableWithComma = iterable => { + // This is more performant than Array.from().join(", ") + // as it doesn't create an array + let str = ""; + let first = true; + for (const item of iterable) { + if (first) { + first = false; + } else { + str += ", "; + } + str += item; + } + return str; +}; - /** @type {Map>} */ - const chunkFilenames = new Map(); - let maxChunks = 0; - /** @type {string} */ - let dynamicFilename; +/** + * @typedef {Object} ConcatenationEntry + * @property {"concatenated" | "external"} type + * @property {Module} module + * @property {RuntimeSpec | boolean} runtimeCondition + */ - /** - * @param {Chunk} c the chunk - * @returns {void} - */ - const addChunk = c => { - const chunkFilename = getFilenameForChunk(c); - if (chunkFilename) { - let set = chunkFilenames.get(chunkFilename); - if (set === undefined) { - chunkFilenames.set(chunkFilename, (set = new Set())); +/** + * @param {ModuleGraph} moduleGraph the module graph + * @param {ModuleInfo} info module info + * @param {string[]} exportName exportName + * @param {Map} moduleToInfoMap moduleToInfoMap + * @param {RuntimeSpec} runtime for which runtime + * @param {RequestShortener} requestShortener the request shortener + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @param {Set} neededNamespaceObjects modules for which a namespace object should be generated + * @param {boolean} asCall asCall + * @param {boolean} strictHarmonyModule strictHarmonyModule + * @param {boolean | undefined} asiSafe asiSafe + * @param {Set} alreadyVisited alreadyVisited + * @returns {Binding} the final variable + */ +const getFinalBinding = ( + moduleGraph, + info, + exportName, + moduleToInfoMap, + runtime, + requestShortener, + runtimeTemplate, + neededNamespaceObjects, + asCall, + strictHarmonyModule, + asiSafe, + alreadyVisited = new Set() +) => { + const exportsType = info.module.getExportsType( + moduleGraph, + strictHarmonyModule + ); + if (exportName.length === 0) { + switch (exportsType) { + case "default-only": + info.interopNamespaceObject2Used = true; + return { + info, + rawName: info.interopNamespaceObject2Name, + ids: exportName, + exportName + }; + case "default-with-named": + info.interopNamespaceObjectUsed = true; + return { + info, + rawName: info.interopNamespaceObjectName, + ids: exportName, + exportName + }; + case "namespace": + case "dynamic": + break; + default: + throw new Error(`Unexpected exportsType ${exportsType}`); + } + } else { + switch (exportsType) { + case "namespace": + break; + case "default-with-named": + switch (exportName[0]) { + case "default": + exportName = exportName.slice(1); + break; + case "__esModule": + return { + info, + rawName: "/* __esModule */true", + ids: exportName.slice(1), + exportName + }; } - set.add(c); - if (typeof chunkFilename === "string") { - if (set.size < maxChunks) return; - if (set.size === maxChunks) { - if (chunkFilename.length < dynamicFilename.length) return; - if (chunkFilename.length === dynamicFilename.length) { - if (chunkFilename < dynamicFilename) return; - } + break; + case "default-only": { + const exportId = exportName[0]; + if (exportId === "__esModule") { + return { + info, + rawName: "/* __esModule */true", + ids: exportName.slice(1), + exportName + }; + } + exportName = exportName.slice(1); + if (exportId !== "default") { + return { + info, + rawName: + "/* non-default import from default-exporting module */undefined", + ids: exportName, + exportName + }; + } + break; + } + case "dynamic": + switch (exportName[0]) { + case "default": { + exportName = exportName.slice(1); + info.interopDefaultAccessUsed = true; + const defaultExport = asCall + ? `${info.interopDefaultAccessName}()` + : asiSafe + ? `(${info.interopDefaultAccessName}())` + : asiSafe === false + ? `;(${info.interopDefaultAccessName}())` + : `${info.interopDefaultAccessName}.a`; + return { + info, + rawName: defaultExport, + ids: exportName, + exportName + }; } - maxChunks = set.size; - dynamicFilename = chunkFilename; + case "__esModule": + return { + info, + rawName: "/* __esModule */true", + ids: exportName.slice(1), + exportName + }; + } + break; + default: + throw new Error(`Unexpected exportsType ${exportsType}`); + } + } + if (exportName.length === 0) { + switch (info.type) { + case "concatenated": + neededNamespaceObjects.add(info); + return { + info, + rawName: info.namespaceObjectName, + ids: exportName, + exportName + }; + case "external": + return { info, rawName: info.name, ids: exportName, exportName }; + } + } + const exportsInfo = moduleGraph.getExportsInfo(info.module); + const exportInfo = exportsInfo.getExportInfo(exportName[0]); + if (alreadyVisited.has(exportInfo)) { + return { + info, + rawName: "/* circular reexport */ Object(function x() { x() }())", + ids: [], + exportName + }; + } + alreadyVisited.add(exportInfo); + switch (info.type) { + case "concatenated": { + const exportId = exportName[0]; + if (exportInfo.provided === false) { + // It's not provided, but it could be on the prototype + neededNamespaceObjects.add(info); + return { + info, + rawName: info.namespaceObjectName, + ids: exportName, + exportName + }; + } + const directExport = info.exportMap && info.exportMap.get(exportId); + if (directExport) { + const usedName = /** @type {string[]} */ ( + exportsInfo.getUsedName(exportName, runtime) + ); + if (!usedName) { + return { + info, + rawName: "/* unused export */ undefined", + ids: exportName.slice(1), + exportName + }; } + return { + info, + name: directExport, + ids: usedName.slice(1), + exportName + }; } - }; - - /** @type {string[]} */ - const includedChunksMessages = []; - if (allChunks) { - includedChunksMessages.push("all chunks"); - for (const c of chunk.getAllReferencedChunks()) { - addChunk(c); + const rawExport = info.rawExportMap && info.rawExportMap.get(exportId); + if (rawExport) { + return { + info, + rawName: rawExport, + ids: exportName.slice(1), + exportName + }; } - } else { - includedChunksMessages.push("async chunks"); - for (const c of chunk.getAllAsyncChunks()) { - addChunk(c); + const reexport = exportInfo.findTarget(moduleGraph, module => + moduleToInfoMap.has(module) + ); + if (reexport === false) { + throw new Error( + `Target module of reexport from '${info.module.readableIdentifier( + requestShortener + )}' is not part of the concatenation (export '${exportId}')\nModules in the concatenation:\n${Array.from( + moduleToInfoMap, + ([m, info]) => + ` * ${info.type} ${m.readableIdentifier(requestShortener)}` + ).join("\n")}` + ); } - const includeEntries = chunkGraph - .getTreeRuntimeRequirements(chunk) - .has(RuntimeGlobals.ensureChunkIncludeEntries); - if (includeEntries) { - includedChunksMessages.push("sibling chunks for the entrypoint"); - for (const c of chunkGraph.getChunkEntryDependentChunksIterable( - chunk - )) { - addChunk(c); - } + if (reexport) { + const refInfo = moduleToInfoMap.get(reexport.module); + return getFinalBinding( + moduleGraph, + refInfo, + reexport.export + ? [...reexport.export, ...exportName.slice(1)] + : exportName.slice(1), + moduleToInfoMap, + runtime, + requestShortener, + runtimeTemplate, + neededNamespaceObjects, + asCall, + info.module.buildMeta.strictHarmonyModule, + asiSafe, + alreadyVisited + ); } - } - for (const entrypoint of chunk.getAllReferencedAsyncEntrypoints()) { - addChunk(entrypoint.chunks[entrypoint.chunks.length - 1]); - } - - /** @type {Map>} */ - const staticUrls = new Map(); - /** @type {Set} */ - const dynamicUrlChunks = new Set(); - - /** - * @param {Chunk} c the chunk - * @param {string | FilenameFunction} chunkFilename the filename template for the chunk - * @returns {void} - */ - const addStaticUrl = (c, chunkFilename) => { - /** - * @param {string | number} value a value - * @returns {string} string to put in quotes - */ - const unquotedStringify = value => { - const str = `${value}`; - if (str.length >= 5 && str === `${c.id}`) { - // This is shorter and generates the same result - return '" + chunkId + "'; - } - const s = JSON.stringify(str); - return s.slice(1, s.length - 1); - }; - const unquotedStringifyWithLength = value => length => - unquotedStringify(`${value}`.slice(0, length)); - const chunkFilenameValue = - typeof chunkFilename === "function" - ? JSON.stringify( - chunkFilename({ - chunk: c, - contentHashType: contentType - }) - ) - : JSON.stringify(chunkFilename); - const staticChunkFilename = compilation.getPath(chunkFilenameValue, { - hash: `" + ${RuntimeGlobals.getFullHash}() + "`, - hashWithLength: length => - `" + ${RuntimeGlobals.getFullHash}().slice(0, ${length}) + "`, - chunk: { - id: unquotedStringify(c.id), - hash: unquotedStringify(c.renderedHash), - hashWithLength: unquotedStringifyWithLength(c.renderedHash), - name: unquotedStringify(c.name || c.id), - contentHash: { - [contentType]: unquotedStringify(c.contentHash[contentType]) - }, - contentHashWithLength: { - [contentType]: unquotedStringifyWithLength( - c.contentHash[contentType] - ) - } - }, - contentHashType: contentType - }); - let set = staticUrls.get(staticChunkFilename); - if (set === undefined) { - staticUrls.set(staticChunkFilename, (set = new Set())); + if (info.namespaceExportSymbol) { + const usedName = /** @type {string[]} */ ( + exportsInfo.getUsedName(exportName, runtime) + ); + return { + info, + rawName: info.namespaceObjectName, + ids: usedName, + exportName + }; } - set.add(c.id); - }; + throw new Error( + `Cannot get final name for export '${exportName.join( + "." + )}' of ${info.module.readableIdentifier(requestShortener)}` + ); + } - for (const [filename, chunks] of chunkFilenames) { - if (filename !== dynamicFilename) { - for (const c of chunks) addStaticUrl(c, filename); - } else { - for (const c of chunks) dynamicUrlChunks.add(c); + case "external": { + const used = /** @type {string[]} */ ( + exportsInfo.getUsedName(exportName, runtime) + ); + if (!used) { + return { + info, + rawName: "/* unused export */ undefined", + ids: exportName.slice(1), + exportName + }; } + const comment = equals(used, exportName) + ? "" + : Template.toNormalComment(`${exportName.join(".")}`); + return { info, rawName: info.name + comment, ids: used, exportName }; } + } +}; - /** - * @param {function(Chunk): string | number} fn function from chunk to value - * @returns {string} code with static mapping of results of fn - */ - const createMap = fn => { - const obj = {}; - let useId = false; - let lastKey; - let entries = 0; - for (const c of dynamicUrlChunks) { - const value = fn(c); - if (value === c.id) { - useId = true; - } else { - obj[c.id] = value; - lastKey = c.id; - entries++; - } - } - if (entries === 0) return "chunkId"; - if (entries === 1) { - return useId - ? `(chunkId === ${JSON.stringify(lastKey)} ? ${JSON.stringify( - obj[lastKey] - )} : chunkId)` - : JSON.stringify(obj[lastKey]); +/** + * @param {ModuleGraph} moduleGraph the module graph + * @param {ModuleInfo} info module info + * @param {string[]} exportName exportName + * @param {Map} moduleToInfoMap moduleToInfoMap + * @param {RuntimeSpec} runtime for which runtime + * @param {RequestShortener} requestShortener the request shortener + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @param {Set} neededNamespaceObjects modules for which a namespace object should be generated + * @param {boolean} asCall asCall + * @param {boolean} callContext callContext + * @param {boolean} strictHarmonyModule strictHarmonyModule + * @param {boolean | undefined} asiSafe asiSafe + * @returns {string} the final name + */ +const getFinalName = ( + moduleGraph, + info, + exportName, + moduleToInfoMap, + runtime, + requestShortener, + runtimeTemplate, + neededNamespaceObjects, + asCall, + callContext, + strictHarmonyModule, + asiSafe +) => { + const binding = getFinalBinding( + moduleGraph, + info, + exportName, + moduleToInfoMap, + runtime, + requestShortener, + runtimeTemplate, + neededNamespaceObjects, + asCall, + strictHarmonyModule, + asiSafe + ); + { + const { ids, comment } = binding; + let reference; + let isPropertyAccess; + if ("rawName" in binding) { + reference = `${binding.rawName}${comment || ""}${propertyAccess(ids)}`; + isPropertyAccess = ids.length > 0; + } else { + const { info, name: exportId } = binding; + const name = info.internalNames.get(exportId); + if (!name) { + throw new Error( + `The export "${exportId}" in "${info.module.readableIdentifier( + requestShortener + )}" has no internal name (existing names: ${ + Array.from( + info.internalNames, + ([name, symbol]) => `${name}: ${symbol}` + ).join(", ") || "none" + })` + ); } - return useId - ? `(${JSON.stringify(obj)}[chunkId] || chunkId)` - : `${JSON.stringify(obj)}[chunkId]`; - }; - - /** - * @param {function(Chunk): string | number} fn function from chunk to value - * @returns {string} code with static mapping of results of fn for including in quoted string - */ - const mapExpr = fn => { - return `" + ${createMap(fn)} + "`; - }; - - /** - * @param {function(Chunk): string | number} fn function from chunk to value - * @returns {function(number): string} function which generates code with static mapping of results of fn for including in quoted string for specific length - */ - const mapExprWithLength = fn => length => { - return `" + ${createMap(c => `${fn(c)}`.slice(0, length))} + "`; - }; - - const url = - dynamicFilename && - compilation.getPath(JSON.stringify(dynamicFilename), { - hash: `" + ${RuntimeGlobals.getFullHash}() + "`, - hashWithLength: length => - `" + ${RuntimeGlobals.getFullHash}().slice(0, ${length}) + "`, - chunk: { - id: `" + chunkId + "`, - hash: mapExpr(c => c.renderedHash), - hashWithLength: mapExprWithLength(c => c.renderedHash), - name: mapExpr(c => c.name || c.id), - contentHash: { - [contentType]: mapExpr(c => c.contentHash[contentType]) - }, - contentHashWithLength: { - [contentType]: mapExprWithLength(c => c.contentHash[contentType]) - } - }, - contentHashType: contentType - }); - - return Template.asString([ - `// This function allow to reference ${includedChunksMessages.join( - " and " - )}`, - `${global} = ${runtimeTemplate.basicFunction( - "chunkId", - - staticUrls.size > 0 - ? [ - "// return url for filenames not based on template", - // it minimizes to `x===1?"...":x===2?"...":"..."` - Template.asString( - Array.from(staticUrls, ([url, ids]) => { - const condition = - ids.size === 1 - ? `chunkId === ${JSON.stringify(first(ids))}` - : `{${Array.from( - ids, - id => `${JSON.stringify(id)}:1` - ).join(",")}}[chunkId]`; - return `if (${condition}) return ${url};`; - }) - ), - "// return url for filenames based on template", - `return ${url};` - ] - : ["// return url for filenames based on template", `return ${url};`] - )};` - ]); + reference = `${name}${comment || ""}${propertyAccess(ids)}`; + isPropertyAccess = ids.length > 1; + } + if (isPropertyAccess && asCall && callContext === false) { + return asiSafe + ? `(0,${reference})` + : asiSafe === false + ? `;(0,${reference})` + : `/*#__PURE__*/Object(${reference})`; + } + return reference; } -} +}; -module.exports = GetChunkFilenameRuntimeModule; +const addScopeSymbols = (s, nameSet, scopeSet1, scopeSet2) => { + let scope = s; + while (scope) { + if (scopeSet1.has(scope)) break; + if (scopeSet2.has(scope)) break; + scopeSet1.add(scope); + for (const variable of scope.variables) { + nameSet.add(variable.name); + } + scope = scope.upper; + } +}; +const getAllReferences = variable => { + let set = variable.references; + // Look for inner scope variables too (like in class Foo { t() { Foo } }) + const identifiers = new Set(variable.identifiers); + for (const scope of variable.scope.childScopes) { + for (const innerVar of scope.variables) { + if (innerVar.identifiers.some(id => identifiers.has(id))) { + set = set.concat(innerVar.references); + break; + } + } + } + return set; +}; -/***/ }), +const getPathInAst = (ast, node) => { + if (ast === node) { + return []; + } -/***/ 88732: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + const nr = node.range; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + const enterNode = n => { + if (!n) return undefined; + const r = n.range; + if (r) { + if (r[0] <= nr[0] && r[1] >= nr[1]) { + const path = getPathInAst(n, node); + if (path) { + path.push(n); + return path; + } + } + } + return undefined; + }; + if (Array.isArray(ast)) { + for (let i = 0; i < ast.length; i++) { + const enterResult = enterNode(ast[i]); + if (enterResult !== undefined) return enterResult; + } + } else if (ast && typeof ast === "object") { + const keys = Object.keys(ast); + for (let i = 0; i < keys.length; i++) { + const value = ast[keys[i]]; + if (Array.isArray(value)) { + const pathResult = getPathInAst(value, node); + if (pathResult !== undefined) return pathResult; + } else if (value && typeof value === "object") { + const enterResult = enterNode(value); + if (enterResult !== undefined) return enterResult; + } + } + } +}; +const TYPES = new Set(["javascript"]); -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); +class ConcatenatedModule extends Module { + /** + * @param {Module} rootModule the root module of the concatenation + * @param {Set} modules all modules in the concatenation (including the root module) + * @param {RuntimeSpec} runtime the runtime + * @param {Object=} associatedObjectForCache object for caching + * @param {string | HashConstructor=} hashFunction hash function to use + * @returns {ConcatenatedModule} the module + */ + static create( + rootModule, + modules, + runtime, + associatedObjectForCache, + hashFunction = "md4" + ) { + const identifier = ConcatenatedModule._createIdentifier( + rootModule, + modules, + associatedObjectForCache, + hashFunction + ); + return new ConcatenatedModule({ + identifier, + rootModule, + modules, + runtime + }); + } -/** @typedef {import("../Compilation")} Compilation */ + /** + * @param {Object} options options + * @param {string} options.identifier the identifier of the module + * @param {Module=} options.rootModule the root module of the concatenation + * @param {RuntimeSpec} options.runtime the selected runtime + * @param {Set=} options.modules all concatenated modules + */ + constructor({ identifier, rootModule, modules, runtime }) { + super("javascript/esm", null, rootModule && rootModule.layer); -class GetFullHashRuntimeModule extends RuntimeModule { - constructor() { - super("getFullHash"); - this.fullHash = true; + // Info from Factory + /** @type {string} */ + this._identifier = identifier; + /** @type {Module} */ + this.rootModule = rootModule; + /** @type {Set} */ + this._modules = modules; + this._runtime = runtime; + this.factoryMeta = rootModule && rootModule.factoryMeta; } /** - * @returns {string} runtime code + * Assuming this module is in the cache. Update the (cached) module with + * the fresh module from the factory. Usually updates internal references + * and properties. + * @param {Module} module fresh module + * @returns {void} */ - generate() { - const { runtimeTemplate } = this.compilation; - return `${RuntimeGlobals.getFullHash} = ${runtimeTemplate.returningFunction( - JSON.stringify(this.compilation.hash || "XXXX") - )}`; + updateCacheModule(module) { + throw new Error("Must not be called"); } -} - -module.exports = GetFullHashRuntimeModule; - - -/***/ }), - -/***/ 10029: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); -/** @typedef {import("../Compilation")} Compilation */ - -class GetMainFilenameRuntimeModule extends RuntimeModule { /** - * @param {string} name readable name - * @param {string} global global object binding - * @param {string} filename main file name + * @returns {Set} types available (do not mutate) */ - constructor(name, global, filename) { - super(`get ${name} filename`); - this.global = global; - this.filename = filename; + getSourceTypes() { + return TYPES; + } + + get modules() { + return Array.from(this._modules); } /** - * @returns {string} runtime code + * @returns {string} a unique identifier of the module */ - generate() { - const { global, filename, compilation, chunk } = this; - const { runtimeTemplate } = compilation; - const url = compilation.getPath(JSON.stringify(filename), { - hash: `" + ${RuntimeGlobals.getFullHash}() + "`, - hashWithLength: length => - `" + ${RuntimeGlobals.getFullHash}().slice(0, ${length}) + "`, - chunk, - runtime: chunk.runtime - }); - return Template.asString([ - `${global} = ${runtimeTemplate.returningFunction(url)};` - ]); + identifier() { + return this._identifier; } -} - -module.exports = GetMainFilenameRuntimeModule; - - -/***/ }), - -/***/ 38713: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const HelperRuntimeModule = __webpack_require__(82444); - -class GetTrustedTypesPolicyRuntimeModule extends HelperRuntimeModule { /** - * @param {Set} runtimeRequirements runtime requirements + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module */ - constructor(runtimeRequirements) { - super("trusted types policy"); - this.runtimeRequirements = runtimeRequirements; + readableIdentifier(requestShortener) { + return ( + this.rootModule.readableIdentifier(requestShortener) + + ` + ${this._modules.size - 1} modules` + ); } /** - * @returns {string} runtime code + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion */ - generate() { - const { compilation } = this; - const { runtimeTemplate, outputOptions } = compilation; - const { trustedTypes } = outputOptions; - const fn = RuntimeGlobals.getTrustedTypesPolicy; - - return Template.asString([ - "var policy;", - `${fn} = ${runtimeTemplate.basicFunction("", [ - "// Create Trusted Type policy if Trusted Types are available and the policy doesn't exist yet.", - "if (policy === undefined) {", - Template.indent([ - "policy = {", - Template.indent( - [ - ...(this.runtimeRequirements.has(RuntimeGlobals.createScript) - ? [ - `createScript: ${runtimeTemplate.returningFunction( - "script", - "script" - )}` - ] - : []), - ...(this.runtimeRequirements.has(RuntimeGlobals.createScriptUrl) - ? [ - `createScriptURL: ${runtimeTemplate.returningFunction( - "url", - "url" - )}` - ] - : []) - ].join(",\n") - ), - "};", - ...(trustedTypes - ? [ - 'if (typeof trustedTypes !== "undefined" && trustedTypes.createPolicy) {', - Template.indent([ - `policy = trustedTypes.createPolicy(${JSON.stringify( - trustedTypes.policyName - )}, policy);` - ]), - "}" - ] - : []) - ]), - "}", - "return policy;" - ])};` - ]); + libIdent(options) { + return this.rootModule.libIdent(options); } -} - -module.exports = GetTrustedTypesPolicyRuntimeModule; - - -/***/ }), - -/***/ 23255: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); - -class GlobalRuntimeModule extends RuntimeModule { - constructor() { - super("global"); + /** + * @returns {string | null} absolute path which should be used for condition matching (usually the resource path) + */ + nameForCondition() { + return this.rootModule.nameForCondition(); } /** - * @returns {string} runtime code + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this module should be connected to referencing modules when consumed for side-effects only */ - generate() { - return Template.asString([ - `${RuntimeGlobals.global} = (function() {`, - Template.indent([ - "if (typeof globalThis === 'object') return globalThis;", - "try {", - Template.indent( - // This works in non-strict mode - // or - // This works if eval is allowed (see CSP) - "return this || new Function('return this')();" - ), - "} catch (e) {", - Template.indent( - // This works if the window reference is available - "if (typeof window === 'object') return window;" - ), - "}" - // It can still be `undefined`, but nothing to do about it... - // We return `undefined`, instead of nothing here, so it's - // easier to handle this case: - // if (!global) { … } - ]), - "})();" - ]); + getSideEffectsConnectionState(moduleGraph) { + return this.rootModule.getSideEffectsConnectionState(moduleGraph); } -} - -module.exports = GlobalRuntimeModule; + /** + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + const { rootModule } = this; + this.buildInfo = { + strict: true, + cacheable: true, + moduleArgument: rootModule.buildInfo.moduleArgument, + exportsArgument: rootModule.buildInfo.exportsArgument, + fileDependencies: new LazySet(), + contextDependencies: new LazySet(), + missingDependencies: new LazySet(), + topLevelDeclarations: new Set(), + assets: undefined + }; + this.buildMeta = rootModule.buildMeta; + this.clearDependenciesAndBlocks(); + this.clearWarningsAndErrors(); -/***/ }), - -/***/ 8011: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + for (const m of this._modules) { + // populate cacheable + if (!m.buildInfo.cacheable) { + this.buildInfo.cacheable = false; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sergey Melyukov @smelukov -*/ + // populate dependencies + for (const d of m.dependencies.filter( + dep => + !(dep instanceof HarmonyImportDependency) || + !this._modules.has(compilation.moduleGraph.getModule(dep)) + )) { + this.dependencies.push(d); + } + // populate blocks + for (const d of m.blocks) { + this.blocks.push(d); + } + // populate warnings + const warnings = m.getWarnings(); + if (warnings !== undefined) { + for (const warning of warnings) { + this.addWarning(warning); + } + } + // populate errors + const errors = m.getErrors(); + if (errors !== undefined) { + for (const error of errors) { + this.addError(error); + } + } -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); + // populate topLevelDeclarations + if (m.buildInfo.topLevelDeclarations) { + const topLevelDeclarations = this.buildInfo.topLevelDeclarations; + if (topLevelDeclarations !== undefined) { + for (const decl of m.buildInfo.topLevelDeclarations) { + topLevelDeclarations.add(decl); + } + } + } else { + this.buildInfo.topLevelDeclarations = undefined; + } -class HasOwnPropertyRuntimeModule extends RuntimeModule { - constructor() { - super("hasOwnProperty shorthand"); + // populate assets + if (m.buildInfo.assets) { + if (this.buildInfo.assets === undefined) { + this.buildInfo.assets = Object.create(null); + } + Object.assign(this.buildInfo.assets, m.buildInfo.assets); + } + if (m.buildInfo.assetsInfo) { + if (this.buildInfo.assetsInfo === undefined) { + this.buildInfo.assetsInfo = new Map(); + } + for (const [key, value] of m.buildInfo.assetsInfo) { + this.buildInfo.assetsInfo.set(key, value); + } + } + } + callback(); } /** - * @returns {string} runtime code + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) */ - generate() { - const { runtimeTemplate } = this.compilation; - - return Template.asString([ - `${RuntimeGlobals.hasOwnProperty} = ${runtimeTemplate.returningFunction( - "Object.prototype.hasOwnProperty.call(obj, prop)", - "obj, prop" - )}` - ]); + size(type) { + // Guess size from embedded modules + let size = 0; + for (const module of this._modules) { + size += module.size(type); + } + return size; } -} - -module.exports = HasOwnPropertyRuntimeModule; - - -/***/ }), - -/***/ 82444: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - -const RuntimeModule = __webpack_require__(16963); - -class HelperRuntimeModule extends RuntimeModule { /** - * @param {string} name a readable name + * @private + * @param {Module} rootModule the root of the concatenation + * @param {Set} modulesSet a set of modules which should be concatenated + * @param {RuntimeSpec} runtime for this runtime + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConcatenationEntry[]} concatenation list */ - constructor(name) { - super(name); - } -} - -module.exports = HelperRuntimeModule; - - -/***/ }), - -/***/ 19942: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - - -const { SyncWaterfallHook } = __webpack_require__(6967); -const Compilation = __webpack_require__(85720); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const HelperRuntimeModule = __webpack_require__(82444); + _createConcatenationList(rootModule, modulesSet, runtime, moduleGraph) { + /** @type {ConcatenationEntry[]} */ + const list = []; + /** @type {Map} */ + const existingEntries = new Map(); -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ + /** + * @param {Module} module a module + * @returns {Iterable<{ connection: ModuleGraphConnection, runtimeCondition: RuntimeSpec | true }>} imported modules in order + */ + const getConcatenatedImports = module => { + let connections = Array.from(moduleGraph.getOutgoingConnections(module)); + if (module === rootModule) { + for (const c of moduleGraph.getOutgoingConnections(this)) + connections.push(c); + } + const references = connections + .filter(connection => { + if (!(connection.dependency instanceof HarmonyImportDependency)) + return false; + return ( + connection && + connection.resolvedOriginModule === module && + connection.module && + connection.isTargetActive(runtime) + ); + }) + .map(connection => ({ + connection, + sourceOrder: /** @type {HarmonyImportDependency} */ ( + connection.dependency + ).sourceOrder + })); + references.sort( + concatComparators(bySourceOrder, keepOriginalOrder(references)) + ); + /** @type {Map} */ + const referencesMap = new Map(); + for (const { connection } of references) { + const runtimeCondition = filterRuntime(runtime, r => + connection.isTargetActive(r) + ); + if (runtimeCondition === false) continue; + const module = connection.module; + const entry = referencesMap.get(module); + if (entry === undefined) { + referencesMap.set(module, { connection, runtimeCondition }); + continue; + } + entry.runtimeCondition = mergeRuntimeConditionNonFalse( + entry.runtimeCondition, + runtimeCondition, + runtime + ); + } + return referencesMap.values(); + }; -/** - * @typedef {Object} LoadScriptCompilationHooks - * @property {SyncWaterfallHook<[string, Chunk]>} createScript - */ + /** + * @param {ModuleGraphConnection} connection graph connection + * @param {RuntimeSpec | true} runtimeCondition runtime condition + * @returns {void} + */ + const enterModule = (connection, runtimeCondition) => { + const module = connection.module; + if (!module) return; + const existingEntry = existingEntries.get(module); + if (existingEntry === true) { + return; + } + if (modulesSet.has(module)) { + existingEntries.set(module, true); + if (runtimeCondition !== true) { + throw new Error( + `Cannot runtime-conditional concatenate a module (${module.identifier()} in ${this.rootModule.identifier()}, ${runtimeConditionToString( + runtimeCondition + )}). This should not happen.` + ); + } + const imports = getConcatenatedImports(module); + for (const { connection, runtimeCondition } of imports) + enterModule(connection, runtimeCondition); + list.push({ + type: "concatenated", + module: connection.module, + runtimeCondition + }); + } else { + if (existingEntry !== undefined) { + const reducedRuntimeCondition = subtractRuntimeCondition( + runtimeCondition, + existingEntry, + runtime + ); + if (reducedRuntimeCondition === false) return; + runtimeCondition = reducedRuntimeCondition; + existingEntries.set( + connection.module, + mergeRuntimeConditionNonFalse( + existingEntry, + runtimeCondition, + runtime + ) + ); + } else { + existingEntries.set(connection.module, runtimeCondition); + } + if (list.length > 0) { + const lastItem = list[list.length - 1]; + if ( + lastItem.type === "external" && + lastItem.module === connection.module + ) { + lastItem.runtimeCondition = mergeRuntimeCondition( + lastItem.runtimeCondition, + runtimeCondition, + runtime + ); + return; + } + } + list.push({ + type: "external", + get module() { + // We need to use a getter here, because the module in the dependency + // could be replaced by some other process (i. e. also replaced with a + // concatenated module) + return connection.module; + }, + runtimeCondition + }); + } + }; -/** @type {WeakMap} */ -const compilationHooksMap = new WeakMap(); + existingEntries.set(rootModule, true); + const imports = getConcatenatedImports(rootModule); + for (const { connection, runtimeCondition } of imports) + enterModule(connection, runtimeCondition); + list.push({ + type: "concatenated", + module: rootModule, + runtimeCondition: true + }); + + return list; + } -class LoadScriptRuntimeModule extends HelperRuntimeModule { /** - * @param {Compilation} compilation the compilation - * @returns {LoadScriptCompilationHooks} hooks + * @param {Module} rootModule the root module of the concatenation + * @param {Set} modules all modules in the concatenation (including the root module) + * @param {Object=} associatedObjectForCache object for caching + * @param {string | HashConstructor=} hashFunction hash function to use + * @returns {string} the identifier */ - static getCompilationHooks(compilation) { - if (!(compilation instanceof Compilation)) { - throw new TypeError( - "The 'compilation' argument must be an instance of Compilation" - ); - } - let hooks = compilationHooksMap.get(compilation); - if (hooks === undefined) { - hooks = { - createScript: new SyncWaterfallHook(["source", "chunk"]) - }; - compilationHooksMap.set(compilation, hooks); + static _createIdentifier( + rootModule, + modules, + associatedObjectForCache, + hashFunction = "md4" + ) { + const cachedMakePathsRelative = makePathsRelative.bindContextCache( + rootModule.context, + associatedObjectForCache + ); + let identifiers = []; + for (const module of modules) { + identifiers.push(cachedMakePathsRelative(module.identifier())); } - return hooks; + identifiers.sort(); + const hash = createHash(hashFunction); + hash.update(identifiers.join(" ")); + return rootModule.identifier() + "|" + hash.digest("hex"); } /** - * @param {boolean=} withCreateScriptUrl use create script url for trusted types + * @param {LazySet} fileDependencies set where file dependencies are added to + * @param {LazySet} contextDependencies set where context dependencies are added to + * @param {LazySet} missingDependencies set where missing dependencies are added to + * @param {LazySet} buildDependencies set where build dependencies are added to */ - constructor(withCreateScriptUrl) { - super("load script"); - this._withCreateScriptUrl = withCreateScriptUrl; + addCacheDependencies( + fileDependencies, + contextDependencies, + missingDependencies, + buildDependencies + ) { + for (const module of this._modules) { + module.addCacheDependencies( + fileDependencies, + contextDependencies, + missingDependencies, + buildDependencies + ); + } } /** - * @returns {string} runtime code + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result */ - generate() { - const { compilation } = this; - const { runtimeTemplate, outputOptions } = compilation; - const { - scriptType, - chunkLoadTimeout: loadTimeout, - crossOriginLoading, - uniqueName, - charset - } = outputOptions; - const fn = RuntimeGlobals.loadScript; - - const { createScript } = - LoadScriptRuntimeModule.getCompilationHooks(compilation); - - const code = Template.asString([ - "script = document.createElement('script');", - scriptType ? `script.type = ${JSON.stringify(scriptType)};` : "", - charset ? "script.charset = 'utf-8';" : "", - `script.timeout = ${loadTimeout / 1000};`, - `if (${RuntimeGlobals.scriptNonce}) {`, - Template.indent( - `script.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});` - ), - "}", - uniqueName - ? 'script.setAttribute("data-webpack", dataWebpackPrefix + key);' - : "", - `script.src = ${ - this._withCreateScriptUrl - ? `${RuntimeGlobals.createScriptUrl}(url)` - : "url" - };`, - crossOriginLoading - ? Template.asString([ - "if (script.src.indexOf(window.location.origin + '/') !== 0) {", - Template.indent( - `script.crossOrigin = ${JSON.stringify(crossOriginLoading)};` - ), - "}" - ]) - : "" - ]); - - return Template.asString([ - "var inProgress = {};", - uniqueName - ? `var dataWebpackPrefix = ${JSON.stringify(uniqueName + ":")};` - : "// data-webpack is not used as build has no uniqueName", - "// loadScript function to load a script via script tag", - `${fn} = ${runtimeTemplate.basicFunction("url, done, key, chunkId", [ - "if(inProgress[url]) { inProgress[url].push(done); return; }", - "var script, needAttach;", - "if(key !== undefined) {", - Template.indent([ - 'var scripts = document.getElementsByTagName("script");', - "for(var i = 0; i < scripts.length; i++) {", - Template.indent([ - "var s = scripts[i];", - `if(s.getAttribute("src") == url${ - uniqueName - ? ' || s.getAttribute("data-webpack") == dataWebpackPrefix + key' - : "" - }) { script = s; break; }` - ]), - "}" - ]), - "}", - "if(!script) {", - Template.indent([ - "needAttach = true;", - createScript.call(code, this.chunk) - ]), - "}", - "inProgress[url] = [done];", - "var onScriptComplete = " + - runtimeTemplate.basicFunction( - "prev, event", - Template.asString([ - "// avoid mem leaks in IE.", - "script.onerror = script.onload = null;", - "clearTimeout(timeout);", - "var doneFns = inProgress[url];", - "delete inProgress[url];", - "script.parentNode && script.parentNode.removeChild(script);", - `doneFns && doneFns.forEach(${runtimeTemplate.returningFunction( - "fn(event)", - "fn" - )});`, - "if(prev) return prev(event);" - ]) - ), - ";", - `var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), ${loadTimeout});`, - "script.onerror = onScriptComplete.bind(null, script.onerror);", - "script.onload = onScriptComplete.bind(null, script.onload);", - "needAttach && document.head.appendChild(script);" - ])};` - ]); - } -} - -module.exports = LoadScriptRuntimeModule; - - -/***/ }), - -/***/ 65714: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + codeGeneration({ + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtime: generationRuntime, + codeGenerationResults + }) { + /** @type {Set} */ + const runtimeRequirements = new Set(); + const runtime = intersectRuntime(generationRuntime, this._runtime); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + const requestShortener = runtimeTemplate.requestShortener; + // Meta info for each module + const [modulesWithInfo, moduleToInfoMap] = this._getModulesWithInfo( + moduleGraph, + runtime + ); + // Set with modules that need a generated namespace object + /** @type {Set} */ + const neededNamespaceObjects = new Set(); + // Generate source code and analyse scopes + // Prepare a ReplaceSource for the final source + for (const info of moduleToInfoMap.values()) { + this._analyseModule( + moduleToInfoMap, + info, + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtime, + codeGenerationResults + ); + } -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const HelperRuntimeModule = __webpack_require__(82444); + // List of all used names to avoid conflicts + const allUsedNames = new Set(RESERVED_NAMES); + // Updated Top level declarations are created by renaming + const topLevelDeclarations = new Set(); -class MakeNamespaceObjectRuntimeModule extends HelperRuntimeModule { - constructor() { - super("make namespace object"); - } + // List of additional names in scope for module references + /** @type {Map, alreadyCheckedScopes: Set }>} */ + const usedNamesInScopeInfo = new Map(); + /** + * @param {string} module module identifier + * @param {string} id export id + * @returns {{ usedNames: Set, alreadyCheckedScopes: Set }} info + */ + const getUsedNamesInScopeInfo = (module, id) => { + const key = `${module}-${id}`; + let info = usedNamesInScopeInfo.get(key); + if (info === undefined) { + info = { + usedNames: new Set(), + alreadyCheckedScopes: new Set() + }; + usedNamesInScopeInfo.set(key, info); + } + return info; + }; - /** - * @returns {string} runtime code - */ - generate() { - const { runtimeTemplate } = this.compilation; - const fn = RuntimeGlobals.makeNamespaceObject; - return Template.asString([ - "// define __esModule on exports", - `${fn} = ${runtimeTemplate.basicFunction("exports", [ - "if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {", - Template.indent([ - "Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });" - ]), - "}", - "Object.defineProperty(exports, '__esModule', { value: true });" - ])};` - ]); - } -} + // Set of already checked scopes + const ignoredScopes = new Set(); -module.exports = MakeNamespaceObjectRuntimeModule; + // get all global names + for (const info of modulesWithInfo) { + if (info.type === "concatenated") { + // ignore symbols from moduleScope + if (info.moduleScope) { + ignoredScopes.add(info.moduleScope); + } + // The super class expression in class scopes behaves weird + // We get ranges of all super class expressions to make + // renaming to work correctly + const superClassCache = new WeakMap(); + const getSuperClassExpressions = scope => { + const cacheEntry = superClassCache.get(scope); + if (cacheEntry !== undefined) return cacheEntry; + const superClassExpressions = []; + for (const childScope of scope.childScopes) { + if (childScope.type !== "class") continue; + const block = childScope.block; + if ( + (block.type === "ClassDeclaration" || + block.type === "ClassExpression") && + block.superClass + ) { + superClassExpressions.push({ + range: block.superClass.range, + variables: childScope.variables + }); + } + } + superClassCache.set(scope, superClassExpressions); + return superClassExpressions; + }; -/***/ }), + // add global symbols + if (info.globalScope) { + for (const reference of info.globalScope.through) { + const name = reference.identifier.name; + if (ConcatenationScope.isModuleReference(name)) { + const match = ConcatenationScope.matchModuleReference(name); + if (!match) continue; + const referencedInfo = modulesWithInfo[match.index]; + if (referencedInfo.type === "reference") + throw new Error("Module reference can't point to a reference"); + const binding = getFinalBinding( + moduleGraph, + referencedInfo, + match.ids, + moduleToInfoMap, + runtime, + requestShortener, + runtimeTemplate, + neededNamespaceObjects, + false, + info.module.buildMeta.strictHarmonyModule, + true + ); + if (!binding.ids) continue; + const { usedNames, alreadyCheckedScopes } = + getUsedNamesInScopeInfo( + binding.info.module.identifier(), + "name" in binding ? binding.name : "" + ); + for (const expr of getSuperClassExpressions(reference.from)) { + if ( + expr.range[0] <= reference.identifier.range[0] && + expr.range[1] >= reference.identifier.range[1] + ) { + for (const variable of expr.variables) { + usedNames.add(variable.name); + } + } + } + addScopeSymbols( + reference.from, + usedNames, + alreadyCheckedScopes, + ignoredScopes + ); + } else { + allUsedNames.add(name); + } + } + } + } + } -/***/ 44518: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // generate names for symbols + for (const info of moduleToInfoMap.values()) { + const { usedNames: namespaceObjectUsedNames } = getUsedNamesInScopeInfo( + info.module.identifier(), + "" + ); + switch (info.type) { + case "concatenated": { + for (const variable of info.moduleScope.variables) { + const name = variable.name; + const { usedNames, alreadyCheckedScopes } = getUsedNamesInScopeInfo( + info.module.identifier(), + name + ); + if (allUsedNames.has(name) || usedNames.has(name)) { + const references = getAllReferences(variable); + for (const ref of references) { + addScopeSymbols( + ref.from, + usedNames, + alreadyCheckedScopes, + ignoredScopes + ); + } + const newName = this.findNewName( + name, + allUsedNames, + usedNames, + info.module.readableIdentifier(requestShortener) + ); + allUsedNames.add(newName); + info.internalNames.set(name, newName); + topLevelDeclarations.add(newName); + const source = info.source; + const allIdentifiers = new Set( + references.map(r => r.identifier).concat(variable.identifiers) + ); + for (const identifier of allIdentifiers) { + const r = identifier.range; + const path = getPathInAst(info.ast, identifier); + if (path && path.length > 1) { + const maybeProperty = + path[1].type === "AssignmentPattern" && + path[1].left === path[0] + ? path[2] + : path[1]; + if ( + maybeProperty.type === "Property" && + maybeProperty.shorthand + ) { + source.insert(r[1], `: ${newName}`); + continue; + } + } + source.replace(r[0], r[1] - 1, newName); + } + } else { + allUsedNames.add(name); + info.internalNames.set(name, name); + topLevelDeclarations.add(name); + } + } + let namespaceObjectName; + if (info.namespaceExportSymbol) { + namespaceObjectName = info.internalNames.get( + info.namespaceExportSymbol + ); + } else { + namespaceObjectName = this.findNewName( + "namespaceObject", + allUsedNames, + namespaceObjectUsedNames, + info.module.readableIdentifier(requestShortener) + ); + allUsedNames.add(namespaceObjectName); + } + info.namespaceObjectName = namespaceObjectName; + topLevelDeclarations.add(namespaceObjectName); + break; + } + case "external": { + const externalName = this.findNewName( + "", + allUsedNames, + namespaceObjectUsedNames, + info.module.readableIdentifier(requestShortener) + ); + allUsedNames.add(externalName); + info.name = externalName; + topLevelDeclarations.add(externalName); + break; + } + } + if (info.module.buildMeta.exportsType !== "namespace") { + const externalNameInterop = this.findNewName( + "namespaceObject", + allUsedNames, + namespaceObjectUsedNames, + info.module.readableIdentifier(requestShortener) + ); + allUsedNames.add(externalNameInterop); + info.interopNamespaceObjectName = externalNameInterop; + topLevelDeclarations.add(externalNameInterop); + } + if ( + info.module.buildMeta.exportsType === "default" && + info.module.buildMeta.defaultObject !== "redirect" + ) { + const externalNameInterop = this.findNewName( + "namespaceObject2", + allUsedNames, + namespaceObjectUsedNames, + info.module.readableIdentifier(requestShortener) + ); + allUsedNames.add(externalNameInterop); + info.interopNamespaceObject2Name = externalNameInterop; + topLevelDeclarations.add(externalNameInterop); + } + if ( + info.module.buildMeta.exportsType === "dynamic" || + !info.module.buildMeta.exportsType + ) { + const externalNameInterop = this.findNewName( + "default", + allUsedNames, + namespaceObjectUsedNames, + info.module.readableIdentifier(requestShortener) + ); + allUsedNames.add(externalNameInterop); + info.interopDefaultAccessName = externalNameInterop; + topLevelDeclarations.add(externalNameInterop); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + // Find and replace references to modules + for (const info of moduleToInfoMap.values()) { + if (info.type === "concatenated") { + for (const reference of info.globalScope.through) { + const name = reference.identifier.name; + const match = ConcatenationScope.matchModuleReference(name); + if (match) { + const referencedInfo = modulesWithInfo[match.index]; + if (referencedInfo.type === "reference") + throw new Error("Module reference can't point to a reference"); + const finalName = getFinalName( + moduleGraph, + referencedInfo, + match.ids, + moduleToInfoMap, + runtime, + requestShortener, + runtimeTemplate, + neededNamespaceObjects, + match.call, + !match.directImport, + info.module.buildMeta.strictHarmonyModule, + match.asiSafe + ); + const r = reference.identifier.range; + const source = info.source; + // range is extended by 2 chars to cover the appended "._" + source.replace(r[0], r[1] + 1, finalName); + } + } + } + } + // Map with all root exposed used exports + /** @type {Map} */ + const exportsMap = new Map(); + // Set with all root exposed unused exports + /** @type {Set} */ + const unusedExports = new Set(); -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); + const rootInfo = /** @type {ConcatenatedModuleInfo} */ ( + moduleToInfoMap.get(this.rootModule) + ); + const strictHarmonyModule = rootInfo.module.buildMeta.strictHarmonyModule; + const exportsInfo = moduleGraph.getExportsInfo(rootInfo.module); + for (const exportInfo of exportsInfo.orderedExports) { + const name = exportInfo.name; + if (exportInfo.provided === false) continue; + const used = exportInfo.getUsedName(undefined, runtime); + if (!used) { + unusedExports.add(name); + continue; + } + exportsMap.set(used, requestShortener => { + try { + const finalName = getFinalName( + moduleGraph, + rootInfo, + [name], + moduleToInfoMap, + runtime, + requestShortener, + runtimeTemplate, + neededNamespaceObjects, + false, + false, + strictHarmonyModule, + true + ); + return `/* ${ + exportInfo.isReexport() ? "reexport" : "binding" + } */ ${finalName}`; + } catch (e) { + e.message += `\nwhile generating the root export '${name}' (used name: '${used}')`; + throw e; + } + }); + } -class OnChunksLoadedRuntimeModule extends RuntimeModule { - constructor() { - super("chunk loaded"); - } + const result = new ConcatSource(); - /** - * @returns {string} runtime code - */ - generate() { - const { compilation } = this; - const { runtimeTemplate } = compilation; - return Template.asString([ - "var deferred = [];", - `${RuntimeGlobals.onChunksLoaded} = ${runtimeTemplate.basicFunction( - "result, chunkIds, fn, priority", - [ - "if(chunkIds) {", - Template.indent([ - "priority = priority || 0;", - "for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];", - "deferred[i] = [chunkIds, fn, priority];", - "return;" - ]), - "}", - "var notFulfilled = Infinity;", - "for (var i = 0; i < deferred.length; i++) {", - Template.indent([ - runtimeTemplate.destructureArray( - ["chunkIds", "fn", "priority"], - "deferred[i]" - ), - "var fulfilled = true;", - "for (var j = 0; j < chunkIds.length; j++) {", - Template.indent([ - `if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(${ - RuntimeGlobals.onChunksLoaded - }).every(${runtimeTemplate.returningFunction( - `${RuntimeGlobals.onChunksLoaded}[key](chunkIds[j])`, - "key" - )})) {`, - Template.indent(["chunkIds.splice(j--, 1);"]), - "} else {", - Template.indent([ - "fulfilled = false;", - "if(priority < notFulfilled) notFulfilled = priority;" - ]), - "}" - ]), - "}", - "if(fulfilled) {", - Template.indent([ - "deferred.splice(i--, 1)", - "var r = fn();", - "if (r !== undefined) result = r;" - ]), - "}" - ]), - "}", - "return result;" - ] - )};` - ]); - } -} + // add harmony compatibility flag (must be first because of possible circular dependencies) + if ( + moduleGraph.getExportsInfo(this).otherExportsInfo.getUsed(runtime) !== + UsageState.Unused + ) { + result.add(`// ESM COMPAT FLAG\n`); + result.add( + runtimeTemplate.defineEsModuleFlagStatement({ + exportsArgument: this.exportsArgument, + runtimeRequirements + }) + ); + } -module.exports = OnChunksLoadedRuntimeModule; + // define exports + if (exportsMap.size > 0) { + runtimeRequirements.add(RuntimeGlobals.exports); + runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); + const definitions = []; + for (const [key, value] of exportsMap) { + definitions.push( + `\n ${JSON.stringify(key)}: ${runtimeTemplate.returningFunction( + value(requestShortener) + )}` + ); + } + result.add(`\n// EXPORTS\n`); + result.add( + `${RuntimeGlobals.definePropertyGetters}(${ + this.exportsArgument + }, {${definitions.join(",")}\n});\n` + ); + } + // list unused exports + if (unusedExports.size > 0) { + result.add( + `\n// UNUSED EXPORTS: ${joinIterableWithComma(unusedExports)}\n` + ); + } -/***/ }), + // generate namespace objects + const namespaceObjectSources = new Map(); + for (const info of neededNamespaceObjects) { + if (info.namespaceExportSymbol) continue; + const nsObj = []; + const exportsInfo = moduleGraph.getExportsInfo(info.module); + for (const exportInfo of exportsInfo.orderedExports) { + if (exportInfo.provided === false) continue; + const usedName = exportInfo.getUsedName(undefined, runtime); + if (usedName) { + const finalName = getFinalName( + moduleGraph, + info, + [exportInfo.name], + moduleToInfoMap, + runtime, + requestShortener, + runtimeTemplate, + neededNamespaceObjects, + false, + undefined, + info.module.buildMeta.strictHarmonyModule, + true + ); + nsObj.push( + `\n ${JSON.stringify( + usedName + )}: ${runtimeTemplate.returningFunction(finalName)}` + ); + } + } + const name = info.namespaceObjectName; + const defineGetters = + nsObj.length > 0 + ? `${RuntimeGlobals.definePropertyGetters}(${name}, {${nsObj.join( + "," + )}\n});\n` + : ""; + if (nsObj.length > 0) + runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); + namespaceObjectSources.set( + info, + ` +// NAMESPACE OBJECT: ${info.module.readableIdentifier(requestShortener)} +var ${name} = {}; +${RuntimeGlobals.makeNamespaceObject}(${name}); +${defineGetters}` + ); + runtimeRequirements.add(RuntimeGlobals.makeNamespaceObject); + } -/***/ 56030: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // define required namespace objects (must be before evaluation modules) + for (const info of modulesWithInfo) { + if (info.type === "concatenated") { + const source = namespaceObjectSources.get(info); + if (!source) continue; + result.add(source); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + const chunkInitFragments = []; + // evaluate modules in order + for (const rawInfo of modulesWithInfo) { + let name; + let isConditional = false; + const info = rawInfo.type === "reference" ? rawInfo.target : rawInfo; + switch (info.type) { + case "concatenated": { + result.add( + `\n;// CONCATENATED MODULE: ${info.module.readableIdentifier( + requestShortener + )}\n` + ); + result.add(info.source); + if (info.chunkInitFragments) { + for (const f of info.chunkInitFragments) chunkInitFragments.push(f); + } + if (info.runtimeRequirements) { + for (const r of info.runtimeRequirements) { + runtimeRequirements.add(r); + } + } + name = info.namespaceObjectName; + break; + } + case "external": { + result.add( + `\n// EXTERNAL MODULE: ${info.module.readableIdentifier( + requestShortener + )}\n` + ); + runtimeRequirements.add(RuntimeGlobals.require); + const { runtimeCondition } = + /** @type {ExternalModuleInfo | ReferenceToModuleInfo} */ (rawInfo); + const condition = runtimeTemplate.runtimeConditionExpression({ + chunkGraph, + runtimeCondition, + runtime, + runtimeRequirements + }); + if (condition !== "true") { + isConditional = true; + result.add(`if (${condition}) {\n`); + } + result.add( + `var ${info.name} = __webpack_require__(${JSON.stringify( + chunkGraph.getModuleId(info.module) + )});` + ); + name = info.name; + break; + } + default: + // @ts-expect-error never is expected here + throw new Error(`Unsupported concatenation entry type ${info.type}`); + } + if (info.interopNamespaceObjectUsed) { + runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); + result.add( + `\nvar ${info.interopNamespaceObjectName} = /*#__PURE__*/${RuntimeGlobals.createFakeNamespaceObject}(${name}, 2);` + ); + } + if (info.interopNamespaceObject2Used) { + runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); + result.add( + `\nvar ${info.interopNamespaceObject2Name} = /*#__PURE__*/${RuntimeGlobals.createFakeNamespaceObject}(${name});` + ); + } + if (info.interopDefaultAccessUsed) { + runtimeRequirements.add(RuntimeGlobals.compatGetDefaultExport); + result.add( + `\nvar ${info.interopDefaultAccessName} = /*#__PURE__*/${RuntimeGlobals.compatGetDefaultExport}(${name});` + ); + } + if (isConditional) { + result.add("\n}"); + } + } + const data = new Map(); + if (chunkInitFragments.length > 0) + data.set("chunkInitFragments", chunkInitFragments); + data.set("topLevelDeclarations", topLevelDeclarations); -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); + /** @type {CodeGenerationResult} */ + const resultEntry = { + sources: new Map([["javascript", new CachedSource(result)]]), + data, + runtimeRequirements + }; -class PublicPathRuntimeModule extends RuntimeModule { - constructor(publicPath) { - super("publicPath", RuntimeModule.STAGE_BASIC); - this.publicPath = publicPath; + return resultEntry; } /** - * @returns {string} runtime code + * @param {Map} modulesMap modulesMap + * @param {ModuleInfo} info info + * @param {DependencyTemplates} dependencyTemplates dependencyTemplates + * @param {RuntimeTemplate} runtimeTemplate runtimeTemplate + * @param {ModuleGraph} moduleGraph moduleGraph + * @param {ChunkGraph} chunkGraph chunkGraph + * @param {RuntimeSpec} runtime runtime + * @param {CodeGenerationResults} codeGenerationResults codeGenerationResults */ - generate() { - const { compilation, publicPath } = this; - - return `${RuntimeGlobals.publicPath} = ${JSON.stringify( - compilation.getPath(publicPath || "", { - hash: compilation.hash || "XXXX" - }) - )};`; - } -} - -module.exports = PublicPathRuntimeModule; - - -/***/ }), - -/***/ 4537: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const HelperRuntimeModule = __webpack_require__(82444); + _analyseModule( + modulesMap, + info, + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtime, + codeGenerationResults + ) { + if (info.type === "concatenated") { + const m = info.module; + try { + // Create a concatenation scope to track and capture information + const concatenationScope = new ConcatenationScope(modulesMap, info); -class RelativeUrlRuntimeModule extends HelperRuntimeModule { - constructor() { - super("relative url"); + // TODO cache codeGeneration results + const codeGenResult = m.codeGeneration({ + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtime, + concatenationScope, + codeGenerationResults + }); + const source = codeGenResult.sources.get("javascript"); + const data = codeGenResult.data; + const chunkInitFragments = data && data.get("chunkInitFragments"); + const code = source.source().toString(); + let ast; + try { + ast = JavascriptParser._parse(code, { + sourceType: "module" + }); + } catch (err) { + if ( + err.loc && + typeof err.loc === "object" && + typeof err.loc.line === "number" + ) { + const lineNumber = err.loc.line; + const lines = code.split("\n"); + err.message += + "\n| " + + lines + .slice(Math.max(0, lineNumber - 3), lineNumber + 2) + .join("\n| "); + } + throw err; + } + const scopeManager = eslintScope.analyze(ast, { + ecmaVersion: 6, + sourceType: "module", + optimistic: true, + ignoreEval: true, + impliedStrict: true + }); + const globalScope = scopeManager.acquire(ast); + const moduleScope = globalScope.childScopes[0]; + const resultSource = new ReplaceSource(source); + info.runtimeRequirements = codeGenResult.runtimeRequirements; + info.ast = ast; + info.internalSource = source; + info.source = resultSource; + info.chunkInitFragments = chunkInitFragments; + info.globalScope = globalScope; + info.moduleScope = moduleScope; + } catch (err) { + err.message += `\nwhile analyzing module ${m.identifier()} for concatenation`; + throw err; + } + } } /** - * @returns {string} runtime code + * @param {ModuleGraph} moduleGraph the module graph + * @param {RuntimeSpec} runtime the runtime + * @returns {[ModuleInfoOrReference[], Map]} module info items */ - generate() { - const { runtimeTemplate } = this.compilation; - return Template.asString([ - `${RuntimeGlobals.relativeUrl} = function RelativeURL(url) {`, - Template.indent([ - 'var realUrl = new URL(url, "x:/");', - "var values = {};", - "for (var key in realUrl) values[key] = realUrl[key];", - "values.href = url;", - 'values.pathname = url.replace(/[?#].*/, "");', - 'values.origin = values.protocol = "";', - `values.toString = values.toJSON = ${runtimeTemplate.returningFunction( - "url" - )};`, - "for (var key in values) Object.defineProperty(this, key, { enumerable: true, configurable: true, value: values[key] });" - ]), - "};", - `${RuntimeGlobals.relativeUrl}.prototype = URL.prototype;` - ]); + _getModulesWithInfo(moduleGraph, runtime) { + const orderedConcatenationList = this._createConcatenationList( + this.rootModule, + this._modules, + runtime, + moduleGraph + ); + /** @type {Map} */ + const map = new Map(); + const list = orderedConcatenationList.map((info, index) => { + let item = map.get(info.module); + if (item === undefined) { + switch (info.type) { + case "concatenated": + item = { + type: "concatenated", + module: info.module, + index, + ast: undefined, + internalSource: undefined, + runtimeRequirements: undefined, + source: undefined, + globalScope: undefined, + moduleScope: undefined, + internalNames: new Map(), + exportMap: undefined, + rawExportMap: undefined, + namespaceExportSymbol: undefined, + namespaceObjectName: undefined, + interopNamespaceObjectUsed: false, + interopNamespaceObjectName: undefined, + interopNamespaceObject2Used: false, + interopNamespaceObject2Name: undefined, + interopDefaultAccessUsed: false, + interopDefaultAccessName: undefined + }; + break; + case "external": + item = { + type: "external", + module: info.module, + runtimeCondition: info.runtimeCondition, + index, + name: undefined, + interopNamespaceObjectUsed: false, + interopNamespaceObjectName: undefined, + interopNamespaceObject2Used: false, + interopNamespaceObject2Name: undefined, + interopDefaultAccessUsed: false, + interopDefaultAccessName: undefined + }; + break; + default: + throw new Error( + `Unsupported concatenation entry type ${info.type}` + ); + } + map.set(item.module, item); + return item; + } else { + /** @type {ReferenceToModuleInfo} */ + const ref = { + type: "reference", + runtimeCondition: info.runtimeCondition, + target: item + }; + return ref; + } + }); + return [list, map]; } -} - -module.exports = RelativeUrlRuntimeModule; - - -/***/ }), - -/***/ 97115: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + findNewName(oldName, usedNamed1, usedNamed2, extraInfo) { + let name = oldName; + if (name === ConcatenationScope.DEFAULT_EXPORT) { + name = ""; + } + if (name === ConcatenationScope.NAMESPACE_OBJECT_EXPORT) { + name = "namespaceObject"; + } + // Remove uncool stuff + extraInfo = extraInfo.replace( + /\.+\/|(\/index)?\.([a-zA-Z0-9]{1,4})($|\s|\?)|\s*\+\s*\d+\s*modules/g, + "" + ); -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); + const splittedInfo = extraInfo.split("/"); + while (splittedInfo.length) { + name = splittedInfo.pop() + (name ? "_" + name : ""); + const nameIdent = Template.toIdentifier(name); + if ( + !usedNamed1.has(nameIdent) && + (!usedNamed2 || !usedNamed2.has(nameIdent)) + ) + return nameIdent; + } -class RuntimeIdRuntimeModule extends RuntimeModule { - constructor() { - super("runtimeId"); + let i = 0; + let nameWithNumber = Template.toIdentifier(`${name}_${i}`); + while ( + usedNamed1.has(nameWithNumber) || + (usedNamed2 && usedNamed2.has(nameWithNumber)) + ) { + i++; + nameWithNumber = Template.toIdentifier(`${name}_${i}`); + } + return nameWithNumber; } /** - * @returns {string} runtime code + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} */ - generate() { - const { chunkGraph, chunk } = this; - const runtime = chunk.runtime; - if (typeof runtime !== "string") - throw new Error("RuntimeIdRuntimeModule must be in a single runtime"); - const id = chunkGraph.getRuntimeId(runtime); - return `${RuntimeGlobals.runtimeId} = ${JSON.stringify(id)};`; + updateHash(hash, context) { + const { chunkGraph, runtime } = context; + for (const info of this._createConcatenationList( + this.rootModule, + this._modules, + intersectRuntime(runtime, this._runtime), + chunkGraph.moduleGraph + )) { + switch (info.type) { + case "concatenated": + info.module.updateHash(hash, context); + break; + case "external": + hash.update(`${chunkGraph.getModuleId(info.module)}`); + // TODO runtimeCondition + break; + } + } + super.updateHash(hash, context); + } + + static deserialize(context) { + const obj = new ConcatenatedModule({ + identifier: undefined, + rootModule: undefined, + modules: undefined, + runtime: undefined + }); + obj.deserialize(context); + return obj; } } -module.exports = RuntimeIdRuntimeModule; +makeSerializable(ConcatenatedModule, "webpack/lib/optimize/ConcatenatedModule"); + +module.exports = ConcatenatedModule; /***/ }), -/***/ 22339: +/***/ 96260: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const RuntimeGlobals = __webpack_require__(16475); -const StartupChunkDependenciesRuntimeModule = __webpack_require__(38157); -const StartupEntrypointRuntimeModule = __webpack_require__(97672); +const { STAGE_BASIC } = __webpack_require__(80057); +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ /** @typedef {import("../Compiler")} Compiler */ -class StartupChunkDependenciesPlugin { - constructor(options) { - this.chunkLoading = options.chunkLoading; - this.asyncChunkLoading = - typeof options.asyncChunkLoading === "boolean" - ? options.asyncChunkLoading - : true; - } - +class EnsureChunkConditionsPlugin { /** * Apply the plugin * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap( - "StartupChunkDependenciesPlugin", + compiler.hooks.compilation.tap( + "EnsureChunkConditionsPlugin", compilation => { - const globalChunkLoading = compilation.outputOptions.chunkLoading; - const isEnabledForChunk = chunk => { - const options = chunk.getEntryOptions(); - const chunkLoading = - options && options.chunkLoading !== undefined - ? options.chunkLoading - : globalChunkLoading; - return chunkLoading === this.chunkLoading; - }; - compilation.hooks.additionalTreeRuntimeRequirements.tap( - "StartupChunkDependenciesPlugin", - (chunk, set, { chunkGraph }) => { - if (!isEnabledForChunk(chunk)) return; - if (chunkGraph.hasChunkEntryDependentChunks(chunk)) { - set.add(RuntimeGlobals.startup); - set.add(RuntimeGlobals.ensureChunk); - set.add(RuntimeGlobals.ensureChunkIncludeEntries); - compilation.addRuntimeModule( - chunk, - new StartupChunkDependenciesRuntimeModule( - this.asyncChunkLoading - ) - ); + const handler = chunks => { + const chunkGraph = compilation.chunkGraph; + // These sets are hoisted here to save memory + // They are cleared at the end of every loop + /** @type {Set} */ + const sourceChunks = new Set(); + /** @type {Set} */ + const chunkGroups = new Set(); + for (const module of compilation.modules) { + if (!module.hasChunkCondition()) continue; + for (const chunk of chunkGraph.getModuleChunksIterable(module)) { + if (!module.chunkCondition(chunk, compilation)) { + sourceChunks.add(chunk); + for (const group of chunk.groupsIterable) { + chunkGroups.add(group); + } + } + } + if (sourceChunks.size === 0) continue; + /** @type {Set} */ + const targetChunks = new Set(); + chunkGroupLoop: for (const chunkGroup of chunkGroups) { + // Can module be placed in a chunk of this group? + for (const chunk of chunkGroup.chunks) { + if (module.chunkCondition(chunk, compilation)) { + targetChunks.add(chunk); + continue chunkGroupLoop; + } + } + // We reached the entrypoint: fail + if (chunkGroup.isInitial()) { + throw new Error( + "Cannot fullfil chunk condition of " + module.identifier() + ); + } + // Try placing in all parents + for (const group of chunkGroup.parentsIterable) { + chunkGroups.add(group); + } + } + for (const sourceChunk of sourceChunks) { + chunkGraph.disconnectChunkAndModule(sourceChunk, module); } + for (const targetChunk of targetChunks) { + chunkGraph.connectChunkAndModule(targetChunk, module); + } + sourceChunks.clear(); + chunkGroups.clear(); } + }; + compilation.hooks.optimizeChunks.tap( + { + name: "EnsureChunkConditionsPlugin", + stage: STAGE_BASIC + }, + handler ); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.startupEntrypoint) - .tap("StartupChunkDependenciesPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.require); - set.add(RuntimeGlobals.ensureChunk); - set.add(RuntimeGlobals.ensureChunkIncludeEntries); - compilation.addRuntimeModule( - chunk, - new StartupEntrypointRuntimeModule(this.asyncChunkLoading) - ); - }); } ); } } - -module.exports = StartupChunkDependenciesPlugin; - - -/***/ }), - -/***/ 38157: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); - -class StartupChunkDependenciesRuntimeModule extends RuntimeModule { - constructor(asyncChunkLoading) { - super("startup chunk dependencies", RuntimeModule.STAGE_TRIGGER); - this.asyncChunkLoading = asyncChunkLoading; - } - - /** - * @returns {string} runtime code - */ - generate() { - const { chunkGraph, chunk, compilation } = this; - const { runtimeTemplate } = compilation; - const chunkIds = Array.from( - chunkGraph.getChunkEntryDependentChunksIterable(chunk) - ).map(chunk => { - return chunk.id; - }); - return Template.asString([ - `var next = ${RuntimeGlobals.startup};`, - `${RuntimeGlobals.startup} = ${runtimeTemplate.basicFunction( - "", - !this.asyncChunkLoading - ? chunkIds - .map( - id => `${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)});` - ) - .concat("return next();") - : chunkIds.length === 1 - ? `return ${RuntimeGlobals.ensureChunk}(${JSON.stringify( - chunkIds[0] - )}).then(next);` - : chunkIds.length > 2 - ? [ - // using map is shorter for 3 or more chunks - `return Promise.all(${JSON.stringify(chunkIds)}.map(${ - RuntimeGlobals.ensureChunk - }, __webpack_require__)).then(next);` - ] - : [ - // calling ensureChunk directly is shorter for 0 - 2 chunks - "return Promise.all([", - Template.indent( - chunkIds - .map( - id => `${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)})` - ) - .join(",\n") - ), - "]).then(next);" - ] - )};` - ]); - } -} - -module.exports = StartupChunkDependenciesRuntimeModule; - - -/***/ }), - -/***/ 97672: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); - -/** @typedef {import("../MainTemplate")} MainTemplate */ - -class StartupEntrypointRuntimeModule extends RuntimeModule { - constructor(asyncChunkLoading) { - super("startup entrypoint"); - this.asyncChunkLoading = asyncChunkLoading; - } - - /** - * @returns {string} runtime code - */ - generate() { - const { compilation } = this; - const { runtimeTemplate } = compilation; - return `${ - RuntimeGlobals.startupEntrypoint - } = ${runtimeTemplate.basicFunction("result, chunkIds, fn", [ - "// arguments: chunkIds, moduleId are deprecated", - "var moduleId = chunkIds;", - `if(!fn) chunkIds = result, fn = ${runtimeTemplate.returningFunction( - `__webpack_require__(${RuntimeGlobals.entryModuleId} = moduleId)` - )};`, - ...(this.asyncChunkLoading - ? [ - `return Promise.all(chunkIds.map(${ - RuntimeGlobals.ensureChunk - }, __webpack_require__)).then(${runtimeTemplate.basicFunction("", [ - "var r = fn();", - "return r === undefined ? result : r;" - ])})` - ] - : [ - `chunkIds.map(${RuntimeGlobals.ensureChunk}, __webpack_require__)`, - "var r = fn();", - "return r === undefined ? result : r;" - ]) - ])}`; - } -} - -module.exports = StartupEntrypointRuntimeModule; - - -/***/ }), - -/***/ 80655: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); - -/** @typedef {import("../Compilation")} Compilation */ - -class SystemContextRuntimeModule extends RuntimeModule { - constructor() { - super("__system_context__"); - } - - /** - * @returns {string} runtime code - */ - generate() { - return `${RuntimeGlobals.systemContext} = __system_context__;`; - } -} - -module.exports = SystemContextRuntimeModule; +module.exports = EnsureChunkConditionsPlugin; /***/ }), -/***/ 64820: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 50089: +/***/ (function(module) { "use strict"; /* @@ -110410,5981 +109160,5803 @@ module.exports = SystemContextRuntimeModule; -const NormalModule = __webpack_require__(39); - +/** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ -// data URL scheme: "data:text/javascript;charset=utf-8;base64,some-string" -// http://www.ietf.org/rfc/rfc2397.txt -const URIRegEx = /^data:([^;,]+)?((?:;[^;,]+)*?)(?:;(base64))?,(.*)$/i; - -const decodeDataURI = uri => { - const match = URIRegEx.exec(uri); - if (!match) return null; - - const isBase64 = match[3]; - const body = match[4]; - return isBase64 - ? Buffer.from(body, "base64") - : Buffer.from(decodeURIComponent(body), "ascii"); -}; - -class DataUriPlugin { +class FlagIncludedChunksPlugin { /** * Apply the plugin * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap( - "DataUriPlugin", - (compilation, { normalModuleFactory }) => { - normalModuleFactory.hooks.resolveForScheme - .for("data") - .tap("DataUriPlugin", resourceData => { - const match = URIRegEx.exec(resourceData.resource); - if (match) { - resourceData.data.mimetype = match[1] || ""; - resourceData.data.parameters = match[2] || ""; - resourceData.data.encoding = match[3] || false; - resourceData.data.encodedContent = match[4] || ""; - } - }); - NormalModule.getCompilationHooks(compilation) - .readResourceForScheme.for("data") - .tap("DataUriPlugin", resource => decodeDataURI(resource)); - } - ); - } -} + compiler.hooks.compilation.tap("FlagIncludedChunksPlugin", compilation => { + compilation.hooks.optimizeChunkIds.tap( + "FlagIncludedChunksPlugin", + chunks => { + const chunkGraph = compilation.chunkGraph; -module.exports = DataUriPlugin; + // prepare two bit integers for each module + // 2^31 is the max number represented as SMI in v8 + // we want the bits distributed this way: + // the bit 2^31 is pretty rar and only one module should get it + // so it has a probability of 1 / modulesCount + // the first bit (2^0) is the easiest and every module could get it + // if it doesn't get a better bit + // from bit 2^n to 2^(n+1) there is a probability of p + // so 1 / modulesCount == p^31 + // <=> p = sqrt31(1 / modulesCount) + // so we use a modulo of 1 / sqrt31(1 / modulesCount) + /** @type {WeakMap} */ + const moduleBits = new WeakMap(); + const modulesCount = compilation.modules.size; + // precalculate the modulo values for each bit + const modulo = 1 / Math.pow(1 / modulesCount, 1 / 31); + const modulos = Array.from( + { length: 31 }, + (x, i) => Math.pow(modulo, i) | 0 + ); -/***/ }), + // iterate all modules to generate bit values + let i = 0; + for (const module of compilation.modules) { + let bit = 30; + while (i % modulos[bit] !== 0) { + bit--; + } + moduleBits.set(module, 1 << bit); + i++; + } -/***/ 57637: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // iterate all chunks to generate bitmaps + /** @type {WeakMap} */ + const chunkModulesHash = new WeakMap(); + for (const chunk of chunks) { + let hash = 0; + for (const module of chunkGraph.getChunkModulesIterable(chunk)) { + hash |= moduleBits.get(module); + } + chunkModulesHash.set(chunk, hash); + } + + for (const chunkA of chunks) { + const chunkAHash = chunkModulesHash.get(chunkA); + const chunkAModulesCount = + chunkGraph.getNumberOfChunkModules(chunkA); + if (chunkAModulesCount === 0) continue; + let bestModule = undefined; + for (const module of chunkGraph.getChunkModulesIterable(chunkA)) { + if ( + bestModule === undefined || + chunkGraph.getNumberOfModuleChunks(bestModule) > + chunkGraph.getNumberOfModuleChunks(module) + ) + bestModule = module; + } + loopB: for (const chunkB of chunkGraph.getModuleChunksIterable( + bestModule + )) { + // as we iterate the same iterables twice + // skip if we find ourselves + if (chunkA === chunkB) continue; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const chunkBModulesCount = + chunkGraph.getNumberOfChunkModules(chunkB); + // ids for empty chunks are not included + if (chunkBModulesCount === 0) continue; + // instead of swapping A and B just bail + // as we loop twice the current A will be B and B then A + if (chunkAModulesCount > chunkBModulesCount) continue; -const { URL, fileURLToPath } = __webpack_require__(57310); -const { NormalModule } = __webpack_require__(91919); + // is chunkA in chunkB? -/** @typedef {import("../Compiler")} Compiler */ + // we do a cheap check for the hash value + const chunkBHash = chunkModulesHash.get(chunkB); + if ((chunkBHash & chunkAHash) !== chunkAHash) continue; -class FileUriPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "FileUriPlugin", - (compilation, { normalModuleFactory }) => { - normalModuleFactory.hooks.resolveForScheme - .for("file") - .tap("FileUriPlugin", resourceData => { - const url = new URL(resourceData.resource); - const path = fileURLToPath(url); - const query = url.search; - const fragment = url.hash; - resourceData.path = path; - resourceData.query = query; - resourceData.fragment = fragment; - resourceData.resource = path + query + fragment; - return true; - }); - const hooks = NormalModule.getCompilationHooks(compilation); - hooks.readResource - .for(undefined) - .tapAsync("FileUriPlugin", (loaderContext, callback) => { - const { resourcePath } = loaderContext; - loaderContext.addDependency(resourcePath); - loaderContext.fs.readFile(resourcePath, callback); - }); - } - ); + // compare all modules + for (const m of chunkGraph.getChunkModulesIterable(chunkA)) { + if (!chunkGraph.isModuleInChunk(m, chunkB)) continue loopB; + } + chunkB.ids.push(chunkA.id); + } + } + } + ); + }); } } - -module.exports = FileUriPlugin; +module.exports = FlagIncludedChunksPlugin; /***/ }), -/***/ 42110: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 38988: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Sergey Melyukov @smelukov */ -const { extname, basename } = __webpack_require__(71017); -const { URL } = __webpack_require__(57310); -const { createGunzip, createBrotliDecompress, createInflate } = __webpack_require__(59796); -const NormalModule = __webpack_require__(39); -const createSchemaValidation = __webpack_require__(32540); -const createHash = __webpack_require__(49835); -const { mkdirp, dirname, join } = __webpack_require__(17139); -const memoize = __webpack_require__(78676); +const { UsageState } = __webpack_require__(63686); -/** @typedef {import("../../declarations/plugins/schemes/HttpUriPlugin").HttpUriPluginOptions} HttpUriPluginOptions */ -/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("estree").Node} AnyNode */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../Parser").ParserState} ParserState */ +/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -const getHttp = memoize(() => __webpack_require__(13685)); -const getHttps = memoize(() => __webpack_require__(95687)); +/** @typedef {Map | true>} InnerGraph */ +/** @typedef {function(boolean | Set | undefined): void} UsageCallback */ -/** @type {(() => void)[] | undefined} */ -let inProgressWrite = undefined; +/** + * @typedef {Object} StateObject + * @property {InnerGraph} innerGraph + * @property {TopLevelSymbol=} currentTopLevelSymbol + * @property {Map>} usageCallbackMap + */ -const validate = createSchemaValidation( - __webpack_require__(67263), - () => __webpack_require__(27256), - { - name: "Http Uri Plugin", - baseDataPath: "options" - } -); +/** @typedef {false|StateObject} State */ -const toSafePath = str => - str - .replace(/^[^a-zA-Z0-9]+|[^a-zA-Z0-9]+$/g, "") - .replace(/[^a-zA-Z0-9._-]+/g, "_"); +/** @type {WeakMap} */ +const parserStateMap = new WeakMap(); +const topLevelSymbolTag = Symbol("top level symbol"); -const computeIntegrity = content => { - const hash = createHash("sha512"); - hash.update(content); - const integrity = "sha512-" + hash.digest("base64"); - return integrity; -}; +/** + * @param {ParserState} parserState parser state + * @returns {State} state + */ +function getState(parserState) { + return parserStateMap.get(parserState); +} -const verifyIntegrity = (content, integrity) => { - if (integrity === "ignore") return true; - return computeIntegrity(content) === integrity; +/** + * @param {ParserState} parserState parser state + * @returns {void} + */ +exports.bailout = parserState => { + parserStateMap.set(parserState, false); }; /** - * @param {string} str input - * @returns {Record} parsed + * @param {ParserState} parserState parser state + * @returns {void} */ -const parseKeyValuePairs = str => { - /** @type {Record} */ - const result = {}; - for (const item of str.split(",")) { - const i = item.indexOf("="); - if (i >= 0) { - const key = item.slice(0, i).trim(); - const value = item.slice(i + 1).trim(); - result[key] = value; - } else { - const key = item.trim(); - if (!key) continue; - result[key] = key; - } +exports.enable = parserState => { + const state = parserStateMap.get(parserState); + if (state === false) { + return; } - return result; + parserStateMap.set(parserState, { + innerGraph: new Map(), + currentTopLevelSymbol: undefined, + usageCallbackMap: new Map() + }); }; -const parseCacheControl = (cacheControl, requestTime) => { - // When false resource is not stored in cache - let storeCache = true; - // When false resource is not stored in lockfile cache - let storeLock = true; - // Resource is only revalidated, after that timestamp and when upgrade is chosen - let validUntil = 0; - if (cacheControl) { - const parsed = parseKeyValuePairs(cacheControl); - if (parsed["no-cache"]) storeCache = storeLock = false; - if (parsed["max-age"] && !isNaN(+parsed["max-age"])) { - validUntil = requestTime + +parsed["max-age"] * 1000; - } - if (parsed["must-revalidate"]) validUntil = 0; - } - return { - storeLock, - storeCache, - validUntil - }; +/** + * @param {ParserState} parserState parser state + * @returns {boolean} true, when enabled + */ +exports.isEnabled = parserState => { + const state = parserStateMap.get(parserState); + return !!state; }; /** - * @typedef {Object} LockfileEntry - * @property {string} resolved - * @property {string} integrity - * @property {string} contentType + * @param {ParserState} state parser state + * @param {TopLevelSymbol | null} symbol the symbol, or null for all symbols + * @param {string | TopLevelSymbol | true} usage usage data + * @returns {void} */ +exports.addUsage = (state, symbol, usage) => { + const innerGraphState = getState(state); -const areLockfileEntriesEqual = (a, b) => { - return ( - a.resolved === b.resolved && - a.integrity === b.integrity && - a.contentType === b.contentType - ); + if (innerGraphState) { + const { innerGraph } = innerGraphState; + const info = innerGraph.get(symbol); + if (usage === true) { + innerGraph.set(symbol, true); + } else if (info === undefined) { + innerGraph.set(symbol, new Set([usage])); + } else if (info !== true) { + info.add(usage); + } + } }; -const entryToString = entry => { - return `resolved: ${entry.resolved}, integrity: ${entry.integrity}, contentType: ${entry.contentType}`; +/** + * @param {JavascriptParser} parser the parser + * @param {string} name name of variable + * @param {string | TopLevelSymbol | true} usage usage data + * @returns {void} + */ +exports.addVariableUsage = (parser, name, usage) => { + const symbol = + /** @type {TopLevelSymbol} */ ( + parser.getTagData(name, topLevelSymbolTag) + ) || exports.tagTopLevelSymbol(parser, name); + if (symbol) { + exports.addUsage(parser.state, symbol, usage); + } }; -class Lockfile { - constructor() { - this.version = 1; - /** @type {Map} */ - this.entries = new Map(); +/** + * @param {ParserState} state parser state + * @returns {void} + */ +exports.inferDependencyUsage = state => { + const innerGraphState = getState(state); + + if (!innerGraphState) { + return; } - static parse(content) { - // TODO handle merge conflicts - const data = JSON.parse(content); - if (data.version !== 1) - throw new Error(`Unsupported lockfile version ${data.version}`); - const lockfile = new Lockfile(); - for (const key of Object.keys(data)) { - if (key === "version") continue; - const entry = data[key]; - lockfile.entries.set( - key, - typeof entry === "string" - ? entry - : { - resolved: key, - ...entry - } - ); + const { innerGraph, usageCallbackMap } = innerGraphState; + const processed = new Map(); + // flatten graph to terminal nodes (string, undefined or true) + const nonTerminal = new Set(innerGraph.keys()); + while (nonTerminal.size > 0) { + for (const key of nonTerminal) { + /** @type {Set | true} */ + let newSet = new Set(); + let isTerminal = true; + const value = innerGraph.get(key); + let alreadyProcessed = processed.get(key); + if (alreadyProcessed === undefined) { + alreadyProcessed = new Set(); + processed.set(key, alreadyProcessed); + } + if (value !== true && value !== undefined) { + for (const item of value) { + alreadyProcessed.add(item); + } + for (const item of value) { + if (typeof item === "string") { + newSet.add(item); + } else { + const itemValue = innerGraph.get(item); + if (itemValue === true) { + newSet = true; + break; + } + if (itemValue !== undefined) { + for (const i of itemValue) { + if (i === key) continue; + if (alreadyProcessed.has(i)) continue; + newSet.add(i); + if (typeof i !== "string") { + isTerminal = false; + } + } + } + } + } + if (newSet === true) { + innerGraph.set(key, true); + } else if (newSet.size === 0) { + innerGraph.set(key, undefined); + } else { + innerGraph.set(key, newSet); + } + } + if (isTerminal) { + nonTerminal.delete(key); + + // For the global key, merge with all other keys + if (key === null) { + const globalValue = innerGraph.get(null); + if (globalValue) { + for (const [key, value] of innerGraph) { + if (key !== null && value !== true) { + if (globalValue === true) { + innerGraph.set(key, true); + } else { + const newSet = new Set(value); + for (const item of globalValue) { + newSet.add(item); + } + innerGraph.set(key, newSet); + } + } + } + } + } + } } - return lockfile; } - toString() { - let str = "{\n"; - const entries = Array.from(this.entries).sort(([a], [b]) => - a < b ? -1 : 1 + /** @type {Map>} */ + for (const [symbol, callbacks] of usageCallbackMap) { + const usage = /** @type {true | Set | undefined} */ ( + innerGraph.get(symbol) ); - for (const [key, entry] of entries) { - if (typeof entry === "string") { - str += ` ${JSON.stringify(key)}: ${JSON.stringify(entry)},\n`; - } else { - str += ` ${JSON.stringify(key)}: { `; - if (entry.resolved !== key) - str += `"resolved": ${JSON.stringify(entry.resolved)}, `; - str += `"integrity": ${JSON.stringify( - entry.integrity - )}, "contentType": ${JSON.stringify(entry.contentType)} },\n`; - } + for (const callback of callbacks) { + callback(usage === undefined ? false : usage); } - str += ` "version": ${this.version}\n}\n`; - return str; } -} +}; /** - * @template R - * @param {function(function(Error=, R=): void): void} fn function - * @returns {function(function((Error | null)=, R=): void): void} cached function + * @param {ParserState} state parser state + * @param {UsageCallback} onUsageCallback on usage callback */ -const cachedWithoutKey = fn => { - let inFlight = false; - /** @type {Error | undefined} */ - let cachedError = undefined; - /** @type {R | undefined} */ - let cachedResult = undefined; - /** @type {(function(Error=, R=): void)[] | undefined} */ - let cachedCallbacks = undefined; - return callback => { - if (inFlight) { - if (cachedResult !== undefined) return callback(null, cachedResult); - if (cachedError !== undefined) return callback(cachedError); - if (cachedCallbacks === undefined) cachedCallbacks = [callback]; - else cachedCallbacks.push(callback); - return; +exports.onUsage = (state, onUsageCallback) => { + const innerGraphState = getState(state); + + if (innerGraphState) { + const { usageCallbackMap, currentTopLevelSymbol } = innerGraphState; + if (currentTopLevelSymbol) { + let callbacks = usageCallbackMap.get(currentTopLevelSymbol); + + if (callbacks === undefined) { + callbacks = new Set(); + usageCallbackMap.set(currentTopLevelSymbol, callbacks); + } + + callbacks.add(onUsageCallback); + } else { + onUsageCallback(true); } - inFlight = true; - fn((err, result) => { - if (err) cachedError = err; - else cachedResult = result; - const callbacks = cachedCallbacks; - cachedCallbacks = undefined; - callback(err, result); - if (callbacks !== undefined) for (const cb of callbacks) cb(err, result); - }); - }; + } else { + onUsageCallback(undefined); + } }; /** - * @template T - * @template R - * @param {function(T, function(Error=, R=): void): void} fn function - * @param {function(T, function(Error=, R=): void): void=} forceFn function for the second try - * @returns {(function(T, function((Error | null)=, R=): void): void) & { force: function(T, function((Error | null)=, R=): void): void }} cached function + * @param {ParserState} state parser state + * @param {TopLevelSymbol} symbol the symbol */ -const cachedWithKey = (fn, forceFn = fn) => { - /** @typedef {{ result?: R, error?: Error, callbacks?: (function((Error | null)=, R=): void)[], force?: true }} CacheEntry */ - /** @type {Map} */ - const cache = new Map(); - const resultFn = (arg, callback) => { - const cacheEntry = cache.get(arg); - if (cacheEntry !== undefined) { - if (cacheEntry.result !== undefined) - return callback(null, cacheEntry.result); - if (cacheEntry.error !== undefined) return callback(cacheEntry.error); - if (cacheEntry.callbacks === undefined) cacheEntry.callbacks = [callback]; - else cacheEntry.callbacks.push(callback); - return; - } - /** @type {CacheEntry} */ - const newCacheEntry = { - result: undefined, - error: undefined, - callbacks: undefined - }; - cache.set(arg, newCacheEntry); - fn(arg, (err, result) => { - if (err) newCacheEntry.error = err; - else newCacheEntry.result = result; - const callbacks = newCacheEntry.callbacks; - newCacheEntry.callbacks = undefined; - callback(err, result); - if (callbacks !== undefined) for (const cb of callbacks) cb(err, result); - }); - }; - resultFn.force = (arg, callback) => { - const cacheEntry = cache.get(arg); - if (cacheEntry !== undefined && cacheEntry.force) { - if (cacheEntry.result !== undefined) - return callback(null, cacheEntry.result); - if (cacheEntry.error !== undefined) return callback(cacheEntry.error); - if (cacheEntry.callbacks === undefined) cacheEntry.callbacks = [callback]; - else cacheEntry.callbacks.push(callback); - return; +exports.setTopLevelSymbol = (state, symbol) => { + const innerGraphState = getState(state); + + if (innerGraphState) { + innerGraphState.currentTopLevelSymbol = symbol; + } +}; + +/** + * @param {ParserState} state parser state + * @returns {TopLevelSymbol|void} usage data + */ +exports.getTopLevelSymbol = state => { + const innerGraphState = getState(state); + + if (innerGraphState) { + return innerGraphState.currentTopLevelSymbol; + } +}; + +/** + * @param {JavascriptParser} parser parser + * @param {string} name name of variable + * @returns {TopLevelSymbol} symbol + */ +exports.tagTopLevelSymbol = (parser, name) => { + const innerGraphState = getState(parser.state); + if (!innerGraphState) return; + + parser.defineVariable(name); + + const existingTag = /** @type {TopLevelSymbol} */ ( + parser.getTagData(name, topLevelSymbolTag) + ); + if (existingTag) { + return existingTag; + } + + const fn = new TopLevelSymbol(name); + parser.tagVariable(name, topLevelSymbolTag, fn); + return fn; +}; + +/** + * @param {Dependency} dependency the dependency + * @param {Set | boolean} usedByExports usedByExports info + * @param {ModuleGraph} moduleGraph moduleGraph + * @param {RuntimeSpec} runtime runtime + * @returns {boolean} false, when unused. Otherwise true + */ +exports.isDependencyUsedByExports = ( + dependency, + usedByExports, + moduleGraph, + runtime +) => { + if (usedByExports === false) return false; + if (usedByExports !== true && usedByExports !== undefined) { + const selfModule = moduleGraph.getParentModule(dependency); + const exportsInfo = moduleGraph.getExportsInfo(selfModule); + let used = false; + for (const exportName of usedByExports) { + if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) + used = true; } - /** @type {CacheEntry} */ - const newCacheEntry = { - result: undefined, - error: undefined, - callbacks: undefined, - force: true + if (!used) return false; + } + return true; +}; + +/** + * @param {Dependency} dependency the dependency + * @param {Set | boolean} usedByExports usedByExports info + * @param {ModuleGraph} moduleGraph moduleGraph + * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active + */ +exports.getDependencyUsedByExportsCondition = ( + dependency, + usedByExports, + moduleGraph +) => { + if (usedByExports === false) return false; + if (usedByExports !== true && usedByExports !== undefined) { + const selfModule = moduleGraph.getParentModule(dependency); + const exportsInfo = moduleGraph.getExportsInfo(selfModule); + return (connections, runtime) => { + for (const exportName of usedByExports) { + if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) + return true; + } + return false; }; - cache.set(arg, newCacheEntry); - forceFn(arg, (err, result) => { - if (err) newCacheEntry.error = err; - else newCacheEntry.result = result; - const callbacks = newCacheEntry.callbacks; - newCacheEntry.callbacks = undefined; - callback(err, result); - if (callbacks !== undefined) for (const cb of callbacks) cb(err, result); - }); - }; - return resultFn; + } + return null; }; -class HttpUriPlugin { +class TopLevelSymbol { /** - * @param {HttpUriPluginOptions} options options + * @param {string} name name of the variable */ - constructor(options) { - validate(options); - this._lockfileLocation = options.lockfileLocation; - this._cacheLocation = options.cacheLocation; - this._upgrade = options.upgrade; - this._frozen = options.frozen; - this._allowedUris = options.allowedUris; + constructor(name) { + this.name = name; } +} + +exports.TopLevelSymbol = TopLevelSymbol; +exports.topLevelSymbolTag = topLevelSymbolTag; + + +/***/ }), + +/***/ 28758: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const PureExpressionDependency = __webpack_require__(55799); +const InnerGraph = __webpack_require__(38988); + +/** @typedef {import("estree").ClassDeclaration} ClassDeclarationNode */ +/** @typedef {import("estree").ClassExpression} ClassExpressionNode */ +/** @typedef {import("estree").Node} Node */ +/** @typedef {import("estree").VariableDeclarator} VariableDeclaratorNode */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../dependencies/HarmonyImportSpecifierDependency")} HarmonyImportSpecifierDependency */ +/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ +/** @typedef {import("./InnerGraph").InnerGraph} InnerGraph */ +/** @typedef {import("./InnerGraph").TopLevelSymbol} TopLevelSymbol */ +const { topLevelSymbolTag } = InnerGraph; + +class InnerGraphPlugin { /** * Apply the plugin * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { - const schemes = [ - { - scheme: "http", - fetch: (url, options, callback) => getHttp().get(url, options, callback) - }, - { - scheme: "https", - fetch: (url, options, callback) => - getHttps().get(url, options, callback) - } - ]; - let lockfileCache; compiler.hooks.compilation.tap( - "HttpUriPlugin", + "InnerGraphPlugin", (compilation, { normalModuleFactory }) => { - const intermediateFs = compiler.intermediateFileSystem; - const fs = compilation.inputFileSystem; - const cache = compilation.getCache("webpack.HttpUriPlugin"); - const logger = compilation.getLogger("webpack.HttpUriPlugin"); - const lockfileLocation = - this._lockfileLocation || - join( - intermediateFs, - compiler.context, - compiler.name - ? `${toSafePath(compiler.name)}.webpack.lock` - : "webpack.lock" - ); - const cacheLocation = - this._cacheLocation !== undefined - ? this._cacheLocation - : lockfileLocation + ".data"; - const upgrade = this._upgrade || false; - const frozen = this._frozen || false; - const hashFunction = "sha512"; - const hashDigest = "hex"; - const hashDigestLength = 20; - const allowedUris = this._allowedUris; + const logger = compilation.getLogger("webpack.InnerGraphPlugin"); - let warnedAboutEol = false; + compilation.dependencyTemplates.set( + PureExpressionDependency, + new PureExpressionDependency.Template() + ); - const cacheKeyCache = new Map(); /** - * @param {string} url the url - * @returns {string} the key + * @param {JavascriptParser} parser the parser + * @param {Object} parserOptions options + * @returns {void} */ - const getCacheKey = url => { - const cachedResult = cacheKeyCache.get(url); - if (cachedResult !== undefined) return cachedResult; - const result = _getCacheKey(url); - cacheKeyCache.set(url, result); - return result; - }; + const handler = (parser, parserOptions) => { + const onUsageSuper = sup => { + InnerGraph.onUsage(parser.state, usedByExports => { + switch (usedByExports) { + case undefined: + case true: + return; + default: { + const dep = new PureExpressionDependency(sup.range); + dep.loc = sup.loc; + dep.usedByExports = usedByExports; + parser.state.module.addDependency(dep); + break; + } + } + }); + }; - /** - * @param {string} url the url - * @returns {string} the key - */ - const _getCacheKey = url => { - const parsedUrl = new URL(url); - const folder = toSafePath(parsedUrl.origin); - const name = toSafePath(parsedUrl.pathname); - const query = toSafePath(parsedUrl.search); - let ext = extname(name); - if (ext.length > 20) ext = ""; - const basename = ext ? name.slice(0, -ext.length) : name; - const hash = createHash(hashFunction); - hash.update(url); - const digest = hash.digest(hashDigest).slice(0, hashDigestLength); - return `${folder.slice(-50)}/${`${basename}${ - query ? `_${query}` : "" - }`.slice(0, 150)}_${digest}${ext}`; - }; + parser.hooks.program.tap("InnerGraphPlugin", () => { + InnerGraph.enable(parser.state); + }); - const getLockfile = cachedWithoutKey( - /** - * @param {function((Error | null)=, Lockfile=): void} callback callback - * @returns {void} - */ - callback => { - const readLockfile = () => { - intermediateFs.readFile(lockfileLocation, (err, buffer) => { - if (err && err.code !== "ENOENT") { - compilation.missingDependencies.add(lockfileLocation); - return callback(err); - } - compilation.fileDependencies.add(lockfileLocation); - compilation.fileSystemInfo.createSnapshot( - compiler.fsStartTime, - buffer ? [lockfileLocation] : [], - [], - buffer ? [] : [lockfileLocation], - { timestamp: true }, - (err, snapshot) => { - if (err) return callback(err); - const lockfile = buffer - ? Lockfile.parse(buffer.toString("utf-8")) - : new Lockfile(); - lockfileCache = { - lockfile, - snapshot - }; - callback(null, lockfile); - } - ); - }); - }; - if (lockfileCache) { - compilation.fileSystemInfo.checkSnapshotValid( - lockfileCache.snapshot, - (err, valid) => { - if (err) return callback(err); - if (!valid) return readLockfile(); - callback(null, lockfileCache.lockfile); - } - ); - } else { - readLockfile(); - } - } - ); + parser.hooks.finish.tap("InnerGraphPlugin", () => { + if (!InnerGraph.isEnabled(parser.state)) return; - /** @type {Map | undefined} */ - let lockfileUpdates = undefined; - const storeLockEntry = (lockfile, url, entry) => { - const oldEntry = lockfile.entries.get(url); - if (lockfileUpdates === undefined) lockfileUpdates = new Map(); - lockfileUpdates.set(url, entry); - lockfile.entries.set(url, entry); - if (!oldEntry) { - logger.log(`${url} added to lockfile`); - } else if (typeof oldEntry === "string") { - if (typeof entry === "string") { - logger.log(`${url} updated in lockfile: ${oldEntry} -> ${entry}`); - } else { - logger.log( - `${url} updated in lockfile: ${oldEntry} -> ${entry.resolved}` - ); - } - } else if (typeof entry === "string") { - logger.log( - `${url} updated in lockfile: ${oldEntry.resolved} -> ${entry}` - ); - } else if (oldEntry.resolved !== entry.resolved) { - logger.log( - `${url} updated in lockfile: ${oldEntry.resolved} -> ${entry.resolved}` - ); - } else if (oldEntry.integrity !== entry.integrity) { - logger.log(`${url} updated in lockfile: content changed`); - } else if (oldEntry.contentType !== entry.contentType) { - logger.log( - `${url} updated in lockfile: ${oldEntry.contentType} -> ${entry.contentType}` - ); - } else { - logger.log(`${url} updated in lockfile`); - } - }; + logger.time("infer dependency usage"); + InnerGraph.inferDependencyUsage(parser.state); + logger.timeAggregate("infer dependency usage"); + }); - const storeResult = (lockfile, url, result, callback) => { - if (result.storeLock) { - storeLockEntry(lockfile, url, result.entry); - if (!cacheLocation || !result.content) - return callback(null, result); - const key = getCacheKey(result.entry.resolved); - const filePath = join(intermediateFs, cacheLocation, key); - mkdirp(intermediateFs, dirname(intermediateFs, filePath), err => { - if (err) return callback(err); - intermediateFs.writeFile(filePath, result.content, err => { - if (err) return callback(err); - callback(null, result); - }); - }); - } else { - storeLockEntry(lockfile, url, "no-cache"); - callback(null, result); - } - }; + // During prewalking the following datastructures are filled with + // nodes that have a TopLevelSymbol assigned and + // variables are tagged with the assigned TopLevelSymbol - for (const { scheme, fetch } of schemes) { - /** - * - * @param {string} url URL - * @param {string} integrity integrity - * @param {function((Error | null)=, { entry: LockfileEntry, content: Buffer, storeLock: boolean }=): void} callback callback - */ - const resolveContent = (url, integrity, callback) => { - const handleResult = (err, result) => { - if (err) return callback(err); - if ("location" in result) { - return resolveContent( - result.location, - integrity, - (err, innerResult) => { - if (err) return callback(err); - callback(null, { - entry: innerResult.entry, - content: innerResult.content, - storeLock: innerResult.storeLock && result.storeLock - }); - } - ); - } else { - if ( - !result.fresh && - integrity && - result.entry.integrity !== integrity && - !verifyIntegrity(result.content, integrity) - ) { - return fetchContent.force(url, handleResult); - } - return callback(null, { - entry: result.entry, - content: result.content, - storeLock: result.storeLock - }); + // We differ 3 types of nodes: + // 1. full statements (export default, function declaration) + // 2. classes (class declaration, class expression) + // 3. variable declarators (const x = ...) + + /** @type {WeakMap} */ + const statementWithTopLevelSymbol = new WeakMap(); + /** @type {WeakMap} */ + const statementPurePart = new WeakMap(); + + /** @type {WeakMap} */ + const classWithTopLevelSymbol = new WeakMap(); + + /** @type {WeakMap} */ + const declWithTopLevelSymbol = new WeakMap(); + /** @type {WeakSet} */ + const pureDeclarators = new WeakSet(); + + // The following hooks are used during prewalking: + + parser.hooks.preStatement.tap("InnerGraphPlugin", statement => { + if (!InnerGraph.isEnabled(parser.state)) return; + + if (parser.scope.topLevelScope === true) { + if (statement.type === "FunctionDeclaration") { + const name = statement.id ? statement.id.name : "*default*"; + const fn = InnerGraph.tagTopLevelSymbol(parser, name); + statementWithTopLevelSymbol.set(statement, fn); + return true; } - }; - fetchContent(url, handleResult); - }; + } + }); - /** @typedef {{ storeCache: boolean, storeLock: boolean, validUntil: number, etag: string | undefined, fresh: boolean }} FetchResultMeta */ - /** @typedef {FetchResultMeta & { location: string }} RedirectFetchResult */ - /** @typedef {FetchResultMeta & { entry: LockfileEntry, content: Buffer }} ContentFetchResult */ - /** @typedef {RedirectFetchResult | ContentFetchResult} FetchResult */ + parser.hooks.blockPreStatement.tap("InnerGraphPlugin", statement => { + if (!InnerGraph.isEnabled(parser.state)) return; - /** - * @param {string} url URL - * @param {FetchResult | RedirectFetchResult} cachedResult result from cache - * @param {function((Error | null)=, FetchResult=): void} callback callback - * @returns {void} - */ - const fetchContentRaw = (url, cachedResult, callback) => { - const requestTime = Date.now(); - fetch( - new URL(url), - { - headers: { - "accept-encoding": "gzip, deflate, br", - "user-agent": "webpack", - "if-none-match": cachedResult - ? cachedResult.etag || null - : null - } - }, - res => { - const etag = res.headers["etag"]; - const location = res.headers["location"]; - const cacheControl = res.headers["cache-control"]; - const { storeLock, storeCache, validUntil } = parseCacheControl( - cacheControl, - requestTime - ); - /** - * @param {Partial> & (Pick | Pick)} partialResult result - * @returns {void} - */ - const finishWith = partialResult => { - if ("location" in partialResult) { - logger.debug( - `GET ${url} [${res.statusCode}] -> ${partialResult.location}` - ); - } else { - logger.debug( - `GET ${url} [${res.statusCode}] ${Math.ceil( - partialResult.content.length / 1024 - )} kB${!storeLock ? " no-cache" : ""}` - ); - } - const result = { - ...partialResult, - fresh: true, - storeLock, - storeCache, - validUntil, - etag - }; - if (!storeCache) { - logger.log( - `${url} can't be stored in cache, due to Cache-Control header: ${cacheControl}` - ); - return callback(null, result); - } - cache.store( - url, - null, - { - ...result, - fresh: false - }, - err => { - if (err) { - logger.warn( - `${url} can't be stored in cache: ${err.message}` - ); - logger.debug(err.stack); - } - callback(null, result); - } - ); - }; - if (res.statusCode === 304) { - if ( - cachedResult.validUntil < validUntil || - cachedResult.storeLock !== storeLock || - cachedResult.storeCache !== storeCache || - cachedResult.etag !== etag - ) { - return finishWith(cachedResult); - } else { - logger.debug(`GET ${url} [${res.statusCode}] (unchanged)`); - return callback(null, { - ...cachedResult, - fresh: true - }); - } - } + if (parser.scope.topLevelScope === true) { + if (statement.type === "ClassDeclaration") { + const name = statement.id ? statement.id.name : "*default*"; + const fn = InnerGraph.tagTopLevelSymbol(parser, name); + classWithTopLevelSymbol.set(statement, fn); + return true; + } + if (statement.type === "ExportDefaultDeclaration") { + const name = "*default*"; + const fn = InnerGraph.tagTopLevelSymbol(parser, name); + const decl = statement.declaration; if ( - location && - res.statusCode >= 301 && - res.statusCode <= 308 - ) { - const result = { - location: new URL(location, url).href - }; - if ( - !cachedResult || - !("location" in cachedResult) || - cachedResult.location !== result.location || - cachedResult.validUntil < validUntil || - cachedResult.storeLock !== storeLock || - cachedResult.storeCache !== storeCache || - cachedResult.etag !== etag + decl.type === "ClassExpression" || + decl.type === "ClassDeclaration" + ) { + classWithTopLevelSymbol.set(decl, fn); + } else if (parser.isPure(decl, statement.range[0])) { + statementWithTopLevelSymbol.set(statement, fn); + if ( + !decl.type.endsWith("FunctionExpression") && + !decl.type.endsWith("Declaration") && + decl.type !== "Literal" ) { - return finishWith(result); - } else { - logger.debug(`GET ${url} [${res.statusCode}] (unchanged)`); - return callback(null, { - ...result, - fresh: true, - storeLock, - storeCache, - validUntil, - etag - }); + statementPurePart.set(statement, decl); } } - const contentType = res.headers["content-type"] || ""; - const bufferArr = []; + } + } + }); - const contentEncoding = res.headers["content-encoding"]; - let stream = res; - if (contentEncoding === "gzip") { - stream = stream.pipe(createGunzip()); - } else if (contentEncoding === "br") { - stream = stream.pipe(createBrotliDecompress()); - } else if (contentEncoding === "deflate") { - stream = stream.pipe(createInflate()); + parser.hooks.preDeclarator.tap( + "InnerGraphPlugin", + (decl, statement) => { + if (!InnerGraph.isEnabled(parser.state)) return; + if ( + parser.scope.topLevelScope === true && + decl.init && + decl.id.type === "Identifier" + ) { + const name = decl.id.name; + if (decl.init.type === "ClassExpression") { + const fn = InnerGraph.tagTopLevelSymbol(parser, name); + classWithTopLevelSymbol.set(decl.init, fn); + } else if (parser.isPure(decl.init, decl.id.range[1])) { + const fn = InnerGraph.tagTopLevelSymbol(parser, name); + declWithTopLevelSymbol.set(decl, fn); + if ( + !decl.init.type.endsWith("FunctionExpression") && + decl.init.type !== "Literal" + ) { + pureDeclarators.add(decl); + } + return true; } + } + } + ); - stream.on("data", chunk => { - bufferArr.push(chunk); - }); + // During real walking we set the TopLevelSymbol state to the assigned + // TopLevelSymbol by using the fill datastructures. - stream.on("end", () => { - if (!res.complete) { - logger.log(`GET ${url} [${res.statusCode}] (terminated)`); - return callback(new Error(`${url} request was terminated`)); - } + // In addition to tracking TopLevelSymbols, we sometimes need to + // add a PureExpressionDependency. This is needed to skip execution + // of pure expressions, even when they are not dropped due to + // minimizing. Otherwise symbols used there might not exist anymore + // as they are removed as unused by this optimization - const content = Buffer.concat(bufferArr); + // When we find a reference to a TopLevelSymbol, we register a + // TopLevelSymbol dependency from TopLevelSymbol in state to the + // referenced TopLevelSymbol. This way we get a graph of all + // TopLevelSymbols. - if (res.statusCode !== 200) { - logger.log(`GET ${url} [${res.statusCode}]`); - return callback( - new Error( - `${url} request status code = ${ - res.statusCode - }\n${content.toString("utf-8")}` - ) - ); - } + // The following hooks are called during walking: - const integrity = computeIntegrity(content); - const entry = { resolved: url, integrity, contentType }; + parser.hooks.statement.tap("InnerGraphPlugin", statement => { + if (!InnerGraph.isEnabled(parser.state)) return; + if (parser.scope.topLevelScope === true) { + InnerGraph.setTopLevelSymbol(parser.state, undefined); - finishWith({ - entry, - content + const fn = statementWithTopLevelSymbol.get(statement); + if (fn) { + InnerGraph.setTopLevelSymbol(parser.state, fn); + const purePart = statementPurePart.get(statement); + if (purePart) { + InnerGraph.onUsage(parser.state, usedByExports => { + switch (usedByExports) { + case undefined: + case true: + return; + default: { + const dep = new PureExpressionDependency( + purePart.range + ); + dep.loc = statement.loc; + dep.usedByExports = usedByExports; + parser.state.module.addDependency(dep); + break; + } + } }); - }); - } - ).on("error", err => { - logger.log(`GET ${url} (error)`); - err.message += `\nwhile fetching ${url}`; - callback(err); - }); - }; - - const fetchContent = cachedWithKey( - /** - * @param {string} url URL - * @param {function((Error | null)=, { validUntil: number, etag?: string, entry: LockfileEntry, content: Buffer, fresh: boolean } | { validUntil: number, etag?: string, location: string, fresh: boolean }=): void} callback callback - * @returns {void} - */ (url, callback) => { - cache.get(url, null, (err, cachedResult) => { - if (err) return callback(err); - if (cachedResult) { - const isValid = cachedResult.validUntil >= Date.now(); - if (isValid) return callback(null, cachedResult); } - fetchContentRaw(url, cachedResult, callback); - }); - }, - (url, callback) => fetchContentRaw(url, undefined, callback) - ); - - const isAllowed = uri => { - for (const allowed of allowedUris) { - if (typeof allowed === "string") { - if (uri.startsWith(allowed)) return true; - } else if (typeof allowed === "function") { - if (allowed(uri)) return true; - } else { - if (allowed.test(uri)) return true; } } - return false; - }; + }); - const getInfo = cachedWithKey( - /** - * @param {string} url the url - * @param {function((Error | null)=, { entry: LockfileEntry, content: Buffer }=): void} callback callback - * @returns {void} - */ - (url, callback) => { - if (!isAllowed(url)) { - return callback( - new Error( - `${url} doesn't match the allowedUris policy. These URIs are allowed:\n${allowedUris - .map(uri => ` - ${uri}`) - .join("\n")}` + parser.hooks.classExtendsExpression.tap( + "InnerGraphPlugin", + (expr, statement) => { + if (!InnerGraph.isEnabled(parser.state)) return; + if (parser.scope.topLevelScope === true) { + const fn = classWithTopLevelSymbol.get(statement); + if ( + fn && + parser.isPure( + expr, + statement.id ? statement.id.range[1] : statement.range[0] ) - ); - } - getLockfile((err, lockfile) => { - if (err) return callback(err); - const entryOrString = lockfile.entries.get(url); - if (!entryOrString) { - if (frozen) { - return callback( - new Error( - `${url} has no lockfile entry and lockfile is frozen` - ) - ); - } - resolveContent(url, null, (err, result) => { - if (err) return callback(err); - storeResult(lockfile, url, result, callback); - }); - return; - } - if (typeof entryOrString === "string") { - const entryTag = entryOrString; - resolveContent(url, null, (err, result) => { - if (err) return callback(err); - if (!result.storeLock || entryTag === "ignore") - return callback(null, result); - if (frozen) { - return callback( - new Error( - `${url} used to have ${entryTag} lockfile entry and has content now, but lockfile is frozen` - ) - ); - } - if (!upgrade) { - return callback( - new Error( - `${url} used to have ${entryTag} lockfile entry and has content now. -This should be reflected in the lockfile, so this lockfile entry must be upgraded, but upgrading is not enabled. -Remove this line from the lockfile to force upgrading.` - ) - ); - } - storeResult(lockfile, url, result, callback); - }); - return; - } - let entry = entryOrString; - const doFetch = lockedContent => { - resolveContent(url, entry.integrity, (err, result) => { - if (err) { - if (lockedContent) { - logger.warn( - `Upgrade request to ${url} failed: ${err.message}` - ); - logger.debug(err.stack); - return callback(null, { - entry, - content: lockedContent - }); - } - return callback(err); - } - if (!result.storeLock) { - // When the lockfile entry should be no-cache - // we need to update the lockfile - if (frozen) { - return callback( - new Error( - `${url} has a lockfile entry and is no-cache now, but lockfile is frozen\nLockfile: ${entryToString( - entry - )}` - ) - ); - } - storeResult(lockfile, url, result, callback); - return; - } - if (!areLockfileEntriesEqual(result.entry, entry)) { - // When the lockfile entry is outdated - // we need to update the lockfile - if (frozen) { - return callback( - new Error( - `${url} has an outdated lockfile entry, but lockfile is frozen\nLockfile: ${entryToString( - entry - )}\nExpected: ${entryToString(result.entry)}` - ) - ); - } - storeResult(lockfile, url, result, callback); - return; - } - if (!lockedContent && cacheLocation) { - // When the lockfile cache content is missing - // we need to update the lockfile - if (frozen) { - return callback( - new Error( - `${url} is missing content in the lockfile cache, but lockfile is frozen\nLockfile: ${entryToString( - entry - )}` - ) - ); - } - storeResult(lockfile, url, result, callback); - return; - } - return callback(null, result); - }); - }; - if (cacheLocation) { - // When there is a lockfile cache - // we read the content from there - const key = getCacheKey(entry.resolved); - const filePath = join(intermediateFs, cacheLocation, key); - fs.readFile(filePath, (err, result) => { - const content = /** @type {Buffer} */ (result); - if (err) { - if (err.code === "ENOENT") return doFetch(); - return callback(err); - } - const continueWithCachedContent = result => { - if (!upgrade) { - // When not in upgrade mode, we accept the result from the lockfile cache - return callback(null, { entry, content }); - } - return doFetch(content); - }; - if (!verifyIntegrity(content, entry.integrity)) { - let contentWithChangedEol; - let isEolChanged = false; - try { - contentWithChangedEol = Buffer.from( - content.toString("utf-8").replace(/\r\n/g, "\n") - ); - isEolChanged = verifyIntegrity( - contentWithChangedEol, - entry.integrity - ); - } catch (e) { - // ignore - } - if (isEolChanged) { - if (!warnedAboutEol) { - const explainer = `Incorrect end of line sequence was detected in the lockfile cache. -The lockfile cache is protected by integrity checks, so any external modification will lead to a corrupted lockfile cache. -When using git make sure to configure .gitattributes correctly for the lockfile cache: - **/*webpack.lock.data/** -text -This will avoid that the end of line sequence is changed by git on Windows.`; - if (frozen) { - logger.error(explainer); - } else { - logger.warn(explainer); - logger.info( - "Lockfile cache will be automatically fixed now, but when lockfile is frozen this would result in an error." - ); - } - warnedAboutEol = true; - } - if (!frozen) { - // "fix" the end of line sequence of the lockfile content - logger.log( - `${filePath} fixed end of line sequence (\\r\\n instead of \\n).` - ); - intermediateFs.writeFile( - filePath, - contentWithChangedEol, - err => { - if (err) return callback(err); - continueWithCachedContent(contentWithChangedEol); - } - ); - return; - } - } - if (frozen) { - return callback( - new Error( - `${ - entry.resolved - } integrity mismatch, expected content with integrity ${ - entry.integrity - } but got ${computeIntegrity(content)}. -Lockfile corrupted (${ - isEolChanged - ? "end of line sequence was unexpectedly changed" - : "incorrectly merged? changed by other tools?" - }). -Run build with un-frozen lockfile to automatically fix lockfile.` - ) - ); - } else { - // "fix" the lockfile entry to the correct integrity - // the content has priority over the integrity value - entry = { - ...entry, - integrity: computeIntegrity(content) - }; - storeLockEntry(lockfile, url, entry); - } - } - continueWithCachedContent(result); - }); - } else { - doFetch(); + ) { + InnerGraph.setTopLevelSymbol(parser.state, fn); + onUsageSuper(expr); } - }); + } } ); - const respondWithUrlModule = (url, resourceData, callback) => { - getInfo(url.href, (err, result) => { - if (err) return callback(err); - resourceData.resource = url.href; - resourceData.path = url.origin + url.pathname; - resourceData.query = url.search; - resourceData.fragment = url.hash; - resourceData.context = new URL( - ".", - result.entry.resolved - ).href.slice(0, -1); - resourceData.data.mimetype = result.entry.contentType; - callback(null, true); - }); - }; - normalModuleFactory.hooks.resolveForScheme - .for(scheme) - .tapAsync( - "HttpUriPlugin", - (resourceData, resolveData, callback) => { - respondWithUrlModule( - new URL(resourceData.resource), - resourceData, - callback - ); - } - ); - normalModuleFactory.hooks.resolveInScheme - .for(scheme) - .tapAsync("HttpUriPlugin", (resourceData, data, callback) => { - // Only handle relative urls (./xxx, ../xxx, /xxx, //xxx) - if ( - data.dependencyType !== "url" && - !/^\.{0,2}\//.test(resourceData.resource) - ) { - return callback(); - } - respondWithUrlModule( - new URL(resourceData.resource, data.context + "/"), - resourceData, - callback - ); - }); - const hooks = NormalModule.getCompilationHooks(compilation); - hooks.readResourceForScheme - .for(scheme) - .tapAsync("HttpUriPlugin", (resource, module, callback) => { - return getInfo(resource, (err, result) => { - if (err) return callback(err); - module.buildInfo.resourceIntegrity = result.entry.integrity; - callback(null, result.content); - }); - }); - hooks.needBuild.tapAsync( - "HttpUriPlugin", - (module, context, callback) => { - if ( - module.resource && - module.resource.startsWith(`${scheme}://`) - ) { - getInfo(module.resource, (err, result) => { - if (err) return callback(err); - if ( - result.entry.integrity !== - module.buildInfo.resourceIntegrity - ) { - return callback(null, true); - } - callback(); - }); - } else { - return callback(); + parser.hooks.classBodyElement.tap( + "InnerGraphPlugin", + (element, classDefinition) => { + if (!InnerGraph.isEnabled(parser.state)) return; + if (parser.scope.topLevelScope === true) { + const fn = classWithTopLevelSymbol.get(classDefinition); + if (fn) { + InnerGraph.setTopLevelSymbol(parser.state, undefined); + } } } ); - } - compilation.hooks.finishModules.tapAsync( - "HttpUriPlugin", - (modules, callback) => { - if (!lockfileUpdates) return callback(); - const ext = extname(lockfileLocation); - const tempFile = join( - intermediateFs, - dirname(intermediateFs, lockfileLocation), - `.${basename(lockfileLocation, ext)}.${ - (Math.random() * 10000) | 0 - }${ext}` - ); - const writeDone = () => { - const nextOperation = inProgressWrite.shift(); - if (nextOperation) { - nextOperation(); - } else { - inProgressWrite = undefined; - } - }; - const runWrite = () => { - intermediateFs.readFile(lockfileLocation, (err, buffer) => { - if (err && err.code !== "ENOENT") { - writeDone(); - return callback(err); - } - const lockfile = buffer - ? Lockfile.parse(buffer.toString("utf-8")) - : new Lockfile(); - for (const [key, value] of lockfileUpdates) { - lockfile.entries.set(key, value); + parser.hooks.classBodyValue.tap( + "InnerGraphPlugin", + (expression, element, classDefinition) => { + if (!InnerGraph.isEnabled(parser.state)) return; + if (parser.scope.topLevelScope === true) { + const fn = classWithTopLevelSymbol.get(classDefinition); + if (fn) { + if ( + !element.static || + parser.isPure( + expression, + element.key ? element.key.range[1] : element.range[0] + ) + ) { + InnerGraph.setTopLevelSymbol(parser.state, fn); + if (element.type !== "MethodDefinition" && element.static) { + InnerGraph.onUsage(parser.state, usedByExports => { + switch (usedByExports) { + case undefined: + case true: + return; + default: { + const dep = new PureExpressionDependency( + expression.range + ); + dep.loc = expression.loc; + dep.usedByExports = usedByExports; + parser.state.module.addDependency(dep); + break; + } + } + }); + } + } else { + InnerGraph.setTopLevelSymbol(parser.state, undefined); + } } - intermediateFs.writeFile(tempFile, lockfile.toString(), err => { - if (err) { - writeDone(); - return intermediateFs.unlink(tempFile, () => callback(err)); + } + } + ); + + parser.hooks.declarator.tap("InnerGraphPlugin", (decl, statement) => { + if (!InnerGraph.isEnabled(parser.state)) return; + const fn = declWithTopLevelSymbol.get(decl); + + if (fn) { + InnerGraph.setTopLevelSymbol(parser.state, fn); + if (pureDeclarators.has(decl)) { + if (decl.init.type === "ClassExpression") { + if (decl.init.superClass) { + onUsageSuper(decl.init.superClass); } - intermediateFs.rename(tempFile, lockfileLocation, err => { - if (err) { - writeDone(); - return intermediateFs.unlink(tempFile, () => - callback(err) - ); + } else { + InnerGraph.onUsage(parser.state, usedByExports => { + switch (usedByExports) { + case undefined: + case true: + return; + default: { + const dep = new PureExpressionDependency( + decl.init.range + ); + dep.loc = decl.loc; + dep.usedByExports = usedByExports; + parser.state.module.addDependency(dep); + break; + } } - writeDone(); - callback(); }); - }); - }); - }; - if (inProgressWrite) { - inProgressWrite.push(runWrite); - } else { - inProgressWrite = []; - runWrite(); + } + } + parser.walkExpression(decl.init); + InnerGraph.setTopLevelSymbol(parser.state, undefined); + return true; } - } - ); - } - ); - } -} - -module.exports = HttpUriPlugin; - - -/***/ }), - -/***/ 41721: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - + }); + parser.hooks.expression + .for(topLevelSymbolTag) + .tap("InnerGraphPlugin", () => { + const topLevelSymbol = /** @type {TopLevelSymbol} */ ( + parser.currentTagData + ); + const currentTopLevelSymbol = InnerGraph.getTopLevelSymbol( + parser.state + ); + InnerGraph.addUsage( + parser.state, + topLevelSymbol, + currentTopLevelSymbol || true + ); + }); + parser.hooks.assign + .for(topLevelSymbolTag) + .tap("InnerGraphPlugin", expr => { + if (!InnerGraph.isEnabled(parser.state)) return; + if (expr.operator === "=") return true; + }); + }; + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("InnerGraphPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("InnerGraphPlugin", handler); -class ArraySerializer { - serialize(array, { write }) { - write(array.length); - for (const item of array) write(item); - } - deserialize({ read }) { - const length = read(); - const array = []; - for (let i = 0; i < length; i++) { - array.push(read()); - } - return array; + compilation.hooks.finishModules.tap("InnerGraphPlugin", () => { + logger.timeAggregateEnd("infer dependency usage"); + }); + } + ); } } -module.exports = ArraySerializer; +module.exports = InnerGraphPlugin; /***/ }), -/***/ 97059: +/***/ 83608: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const memoize = __webpack_require__(78676); -const SerializerMiddleware = __webpack_require__(83137); - -/** @typedef {import("./types").BufferSerializableType} BufferSerializableType */ -/** @typedef {import("./types").PrimitiveSerializableType} PrimitiveSerializableType */ - -/* -Format: - -File -> Section* - -Section -> NullsSection | - BooleansSection | - F64NumbersSection | - I32NumbersSection | - I8NumbersSection | - ShortStringSection | - StringSection | - BufferSection | - NopSection - - - -NullsSection -> - NullHeaderByte | Null2HeaderByte | Null3HeaderByte | - Nulls8HeaderByte 0xnn (n:count - 4) | - Nulls32HeaderByte n:ui32 (n:count - 260) | -BooleansSection -> TrueHeaderByte | FalseHeaderByte | BooleansSectionHeaderByte BooleansCountAndBitsByte -F64NumbersSection -> F64NumbersSectionHeaderByte f64* -I32NumbersSection -> I32NumbersSectionHeaderByte i32* -I8NumbersSection -> I8NumbersSectionHeaderByte i8* -ShortStringSection -> ShortStringSectionHeaderByte ascii-byte* -StringSection -> StringSectionHeaderByte i32:length utf8-byte* -BufferSection -> BufferSectionHeaderByte i32:length byte* -NopSection --> NopSectionHeaderByte - -ShortStringSectionHeaderByte -> 0b1nnn_nnnn (n:length) - -F64NumbersSectionHeaderByte -> 0b001n_nnnn (n:count - 1) -I32NumbersSectionHeaderByte -> 0b010n_nnnn (n:count - 1) -I8NumbersSectionHeaderByte -> 0b011n_nnnn (n:count - 1) - -NullsSectionHeaderByte -> 0b0001_nnnn (n:count - 1) -BooleansCountAndBitsByte -> - 0b0000_1xxx (count = 3) | - 0b0001_xxxx (count = 4) | - 0b001x_xxxx (count = 5) | - 0b01xx_xxxx (count = 6) | - 0b1nnn_nnnn (n:count - 7, 7 <= count <= 133) - 0xff n:ui32 (n:count, 134 <= count < 2^32) - -StringSectionHeaderByte -> 0b0000_1110 -BufferSectionHeaderByte -> 0b0000_1111 -NopSectionHeaderByte -> 0b0000_1011 -FalseHeaderByte -> 0b0000_1100 -TrueHeaderByte -> 0b0000_1101 - -RawNumber -> n (n <= 10) - -*/ - -const LAZY_HEADER = 0x0b; -const TRUE_HEADER = 0x0c; -const FALSE_HEADER = 0x0d; -const BOOLEANS_HEADER = 0x0e; -const NULL_HEADER = 0x10; -const NULL2_HEADER = 0x11; -const NULL3_HEADER = 0x12; -const NULLS8_HEADER = 0x13; -const NULLS32_HEADER = 0x14; -const NULL_AND_I8_HEADER = 0x15; -const NULL_AND_I32_HEADER = 0x16; -const NULL_AND_TRUE_HEADER = 0x17; -const NULL_AND_FALSE_HEADER = 0x18; -const STRING_HEADER = 0x1e; -const BUFFER_HEADER = 0x1f; -const I8_HEADER = 0x60; -const I32_HEADER = 0x40; -const F64_HEADER = 0x20; -const SHORT_STRING_HEADER = 0x80; - -/** Uplift high-order bits */ -const NUMBERS_HEADER_MASK = 0xe0; -const NUMBERS_COUNT_MASK = 0x1f; // 0b0001_1111 -const SHORT_STRING_LENGTH_MASK = 0x7f; // 0b0111_1111 +const { STAGE_ADVANCED } = __webpack_require__(80057); +const LazyBucketSortedSet = __webpack_require__(48424); +const { compareChunks } = __webpack_require__(29579); +const createSchemaValidation = __webpack_require__(32540); -const HEADER_SIZE = 1; -const I8_SIZE = 1; -const I32_SIZE = 4; -const F64_SIZE = 8; +/** @typedef {import("../../declarations/plugins/optimize/LimitChunkCountPlugin").LimitChunkCountPluginOptions} LimitChunkCountPluginOptions */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compiler")} Compiler */ -const MEASURE_START_OPERATION = Symbol("MEASURE_START_OPERATION"); -const MEASURE_END_OPERATION = Symbol("MEASURE_END_OPERATION"); +const validate = createSchemaValidation( + __webpack_require__(36557), + () => __webpack_require__(30837), + { + name: "Limit Chunk Count Plugin", + baseDataPath: "options" + } +); -/** @typedef {typeof MEASURE_START_OPERATION} MEASURE_START_OPERATION_TYPE */ -/** @typedef {typeof MEASURE_END_OPERATION} MEASURE_END_OPERATION_TYPE */ +/** + * @typedef {Object} ChunkCombination + * @property {boolean} deleted this is set to true when combination was removed + * @property {number} sizeDiff + * @property {number} integratedSize + * @property {Chunk} a + * @property {Chunk} b + * @property {number} aIdx + * @property {number} bIdx + * @property {number} aSize + * @property {number} bSize + */ -const identifyNumber = n => { - if (n === (n | 0)) { - if (n <= 127 && n >= -128) return 0; - if (n <= 2147483647 && n >= -2147483648) return 1; +const addToSetMap = (map, key, value) => { + const set = map.get(key); + if (set === undefined) { + map.set(key, new Set([value])); + } else { + set.add(value); } - return 2; }; -/** - * @typedef {PrimitiveSerializableType[]} DeserializedType - * @typedef {BufferSerializableType[]} SerializedType - * @extends {SerializerMiddleware} - */ -class BinaryMiddleware extends SerializerMiddleware { +class LimitChunkCountPlugin { /** - * @param {DeserializedType} data data - * @param {Object} context context object - * @returns {SerializedType|Promise} serialized data + * @param {LimitChunkCountPluginOptions=} options options object */ - serialize(data, context) { - return this._serialize(data, context); - } - - _serializeLazy(fn, context) { - return SerializerMiddleware.serializeLazy(fn, data => - this._serialize(data, context) - ); + constructor(options) { + validate(options); + this.options = options; } /** - * @param {DeserializedType} data data - * @param {Object} context context object - * @param {{ leftOverBuffer: Buffer | null, allocationSize: number, increaseCounter: number }} allocationScope allocation scope - * @returns {SerializedType} serialized data + * @param {Compiler} compiler the webpack compiler + * @returns {void} */ - _serialize( - data, - context, - allocationScope = { - allocationSize: 1024, - increaseCounter: 0, - leftOverBuffer: null - } - ) { - /** @type {Buffer} */ - let leftOverBuffer = null; - /** @type {BufferSerializableType[]} */ - let buffers = []; - /** @type {Buffer} */ - let currentBuffer = allocationScope ? allocationScope.leftOverBuffer : null; - allocationScope.leftOverBuffer = null; - let currentPosition = 0; - if (currentBuffer === null) { - currentBuffer = Buffer.allocUnsafe(allocationScope.allocationSize); - } - const allocate = bytesNeeded => { - if (currentBuffer !== null) { - if (currentBuffer.length - currentPosition >= bytesNeeded) return; - flush(); - } - if (leftOverBuffer && leftOverBuffer.length >= bytesNeeded) { - currentBuffer = leftOverBuffer; - leftOverBuffer = null; - } else { - currentBuffer = Buffer.allocUnsafe( - Math.max(bytesNeeded, allocationScope.allocationSize) - ); - if ( - !(allocationScope.increaseCounter = - (allocationScope.increaseCounter + 1) % 4) && - allocationScope.allocationSize < 16777216 - ) { - allocationScope.allocationSize = allocationScope.allocationSize << 1; - } - } - }; - const flush = () => { - if (currentBuffer !== null) { - if (currentPosition > 0) { - buffers.push( - Buffer.from( - currentBuffer.buffer, - currentBuffer.byteOffset, - currentPosition - ) - ); - } - if ( - !leftOverBuffer || - leftOverBuffer.length < currentBuffer.length - currentPosition - ) { - leftOverBuffer = Buffer.from( - currentBuffer.buffer, - currentBuffer.byteOffset + currentPosition, - currentBuffer.byteLength - currentPosition + apply(compiler) { + const options = this.options; + compiler.hooks.compilation.tap("LimitChunkCountPlugin", compilation => { + compilation.hooks.optimizeChunks.tap( + { + name: "LimitChunkCountPlugin", + stage: STAGE_ADVANCED + }, + chunks => { + const chunkGraph = compilation.chunkGraph; + const maxChunks = options.maxChunks; + if (!maxChunks) return; + if (maxChunks < 1) return; + if (compilation.chunks.size <= maxChunks) return; + + let remainingChunksToMerge = compilation.chunks.size - maxChunks; + + // order chunks in a deterministic way + const compareChunksWithGraph = compareChunks(chunkGraph); + const orderedChunks = Array.from(chunks).sort(compareChunksWithGraph); + + // create a lazy sorted data structure to keep all combinations + // this is large. Size = chunks * (chunks - 1) / 2 + // It uses a multi layer bucket sort plus normal sort in the last layer + // It's also lazy so only accessed buckets are sorted + const combinations = new LazyBucketSortedSet( + // Layer 1: ordered by largest size benefit + c => c.sizeDiff, + (a, b) => b - a, + // Layer 2: ordered by smallest combined size + c => c.integratedSize, + (a, b) => a - b, + // Layer 3: ordered by position difference in orderedChunk (-> to be deterministic) + c => c.bIdx - c.aIdx, + (a, b) => a - b, + // Layer 4: ordered by position in orderedChunk (-> to be deterministic) + (a, b) => a.bIdx - b.bIdx ); - } - currentBuffer = null; - currentPosition = 0; - } - }; - const writeU8 = byte => { - currentBuffer.writeUInt8(byte, currentPosition++); - }; - const writeU32 = ui32 => { - currentBuffer.writeUInt32LE(ui32, currentPosition); - currentPosition += 4; - }; - const measureStack = []; - const measureStart = () => { - measureStack.push(buffers.length, currentPosition); - }; - const measureEnd = () => { - const oldPos = measureStack.pop(); - const buffersIndex = measureStack.pop(); - let size = currentPosition - oldPos; - for (let i = buffersIndex; i < buffers.length; i++) { - size += buffers[i].length; - } - return size; - }; - for (let i = 0; i < data.length; i++) { - const thing = data[i]; - switch (typeof thing) { - case "function": { - if (!SerializerMiddleware.isLazy(thing)) - throw new Error("Unexpected function " + thing); - /** @type {SerializedType | (() => SerializedType)} */ - let serializedData = - SerializerMiddleware.getLazySerializedValue(thing); - if (serializedData === undefined) { - if (SerializerMiddleware.isLazy(thing, this)) { - flush(); - allocationScope.leftOverBuffer = leftOverBuffer; - const result = - /** @type {(Exclude>)[]} */ ( - thing() - ); - const data = this._serialize(result, context, allocationScope); - leftOverBuffer = allocationScope.leftOverBuffer; - allocationScope.leftOverBuffer = null; - SerializerMiddleware.setLazySerializedValue(thing, data); - serializedData = data; - } else { - serializedData = this._serializeLazy(thing, context); - flush(); - buffers.push(serializedData); - break; - } - } else { - if (typeof serializedData === "function") { - flush(); - buffers.push(serializedData); - break; - } - } - const lengths = []; - for (const item of serializedData) { - let last; - if (typeof item === "function") { - lengths.push(0); - } else if (item.length === 0) { - // ignore - } else if ( - lengths.length > 0 && - (last = lengths[lengths.length - 1]) !== 0 - ) { - const remaining = 0xffffffff - last; - if (remaining >= item.length) { - lengths[lengths.length - 1] += item.length; - } else { - lengths.push(item.length - remaining); - lengths[lengths.length - 2] = 0xffffffff; - } - } else { - lengths.push(item.length); - } - } - allocate(5 + lengths.length * 4); - writeU8(LAZY_HEADER); - writeU32(lengths.length); - for (const l of lengths) { - writeU32(l); - } - flush(); - for (const item of serializedData) { - buffers.push(item); - } - break; - } - case "string": { - const len = Buffer.byteLength(thing); - if (len >= 128 || len !== thing.length) { - allocate(len + HEADER_SIZE + I32_SIZE); - writeU8(STRING_HEADER); - writeU32(len); - currentBuffer.write(thing, currentPosition); - currentPosition += len; - } else if (len >= 70) { - allocate(len + HEADER_SIZE); - writeU8(SHORT_STRING_HEADER | len); + // we keep a mapping from chunk to all combinations + // but this mapping is not kept up-to-date with deletions + // so `deleted` flag need to be considered when iterating this + /** @type {Map>} */ + const combinationsByChunk = new Map(); - currentBuffer.write(thing, currentPosition, "latin1"); - currentPosition += len; - } else { - allocate(len + HEADER_SIZE); - writeU8(SHORT_STRING_HEADER | len); + orderedChunks.forEach((b, bIdx) => { + // create combination pairs with size and integrated size + for (let aIdx = 0; aIdx < bIdx; aIdx++) { + const a = orderedChunks[aIdx]; + // filter pairs that can not be integrated! + if (!chunkGraph.canChunksBeIntegrated(a, b)) continue; - for (let i = 0; i < len; i++) { - currentBuffer[currentPosition++] = thing.charCodeAt(i); + const integratedSize = chunkGraph.getIntegratedChunksSize( + a, + b, + options + ); + + const aSize = chunkGraph.getChunkSize(a, options); + const bSize = chunkGraph.getChunkSize(b, options); + const c = { + deleted: false, + sizeDiff: aSize + bSize - integratedSize, + integratedSize, + a, + b, + aIdx, + bIdx, + aSize, + bSize + }; + combinations.add(c); + addToSetMap(combinationsByChunk, a, c); + addToSetMap(combinationsByChunk, b, c); } - } - break; - } - case "number": { - const type = identifyNumber(thing); - if (type === 0 && thing >= 0 && thing <= 10) { - // shortcut for very small numbers - allocate(I8_SIZE); - writeU8(thing); - break; - } - /** - * amount of numbers to write - * @type {number} - */ - let n = 1; - for (; n < 32 && i + n < data.length; n++) { - const item = data[i + n]; - if (typeof item !== "number") break; - if (identifyNumber(item) !== type) break; - } - switch (type) { - case 0: - allocate(HEADER_SIZE + I8_SIZE * n); - writeU8(I8_HEADER | (n - 1)); - while (n > 0) { - currentBuffer.writeInt8( - /** @type {number} */ (data[i]), - currentPosition - ); - currentPosition += I8_SIZE; - n--; - i++; + return combinations; + }); + + // list of modified chunks during this run + // combinations affected by this change are skipped to allow + // further optimizations + /** @type {Set} */ + const modifiedChunks = new Set(); + + let changed = false; + // eslint-disable-next-line no-constant-condition + loop: while (true) { + const combination = combinations.popFirst(); + if (combination === undefined) break; + + combination.deleted = true; + const { a, b, integratedSize } = combination; + + // skip over pair when + // one of the already merged chunks is a parent of one of the chunks + if (modifiedChunks.size > 0) { + const queue = new Set(a.groupsIterable); + for (const group of b.groupsIterable) { + queue.add(group); } - break; - case 1: - allocate(HEADER_SIZE + I32_SIZE * n); - writeU8(I32_HEADER | (n - 1)); - while (n > 0) { - currentBuffer.writeInt32LE( - /** @type {number} */ (data[i]), - currentPosition - ); - currentPosition += I32_SIZE; - n--; - i++; + for (const group of queue) { + for (const mChunk of modifiedChunks) { + if (mChunk !== a && mChunk !== b && mChunk.isInGroup(group)) { + // This is a potential pair which needs recalculation + // We can't do that now, but it merge before following pairs + // so we leave space for it, and consider chunks as modified + // just for the worse case + remainingChunksToMerge--; + if (remainingChunksToMerge <= 0) break loop; + modifiedChunks.add(a); + modifiedChunks.add(b); + continue loop; + } + } + for (const parent of group.parentsIterable) { + queue.add(parent); + } } - break; - case 2: - allocate(HEADER_SIZE + F64_SIZE * n); - writeU8(F64_HEADER | (n - 1)); - while (n > 0) { - currentBuffer.writeDoubleLE( - /** @type {number} */ (data[i]), - currentPosition - ); - currentPosition += F64_SIZE; - n--; - i++; + } + + // merge the chunks + if (chunkGraph.canChunksBeIntegrated(a, b)) { + chunkGraph.integrateChunks(a, b); + compilation.chunks.delete(b); + + // flag chunk a as modified as further optimization are possible for all children here + modifiedChunks.add(a); + + changed = true; + remainingChunksToMerge--; + if (remainingChunksToMerge <= 0) break; + + // Update all affected combinations + // delete all combination with the removed chunk + // we will use combinations with the kept chunk instead + for (const combination of combinationsByChunk.get(a)) { + if (combination.deleted) continue; + combination.deleted = true; + combinations.delete(combination); } - break; - } - i--; - break; - } - case "boolean": { - let lastByte = thing === true ? 1 : 0; - const bytes = []; - let count = 1; - let n; - for (n = 1; n < 0xffffffff && i + n < data.length; n++) { - const item = data[i + n]; - if (typeof item !== "boolean") break; - const pos = count & 0x7; - if (pos === 0) { - bytes.push(lastByte); - lastByte = item === true ? 1 : 0; - } else if (item === true) { - lastByte |= 1 << pos; - } - count++; - } - i += count - 1; - if (count === 1) { - allocate(HEADER_SIZE); - writeU8(lastByte === 1 ? TRUE_HEADER : FALSE_HEADER); - } else if (count === 2) { - allocate(HEADER_SIZE * 2); - writeU8(lastByte & 1 ? TRUE_HEADER : FALSE_HEADER); - writeU8(lastByte & 2 ? TRUE_HEADER : FALSE_HEADER); - } else if (count <= 6) { - allocate(HEADER_SIZE + I8_SIZE); - writeU8(BOOLEANS_HEADER); - writeU8((1 << count) | lastByte); - } else if (count <= 133) { - allocate(HEADER_SIZE + I8_SIZE + I8_SIZE * bytes.length + I8_SIZE); - writeU8(BOOLEANS_HEADER); - writeU8(0x80 | (count - 7)); - for (const byte of bytes) writeU8(byte); - writeU8(lastByte); - } else { - allocate( - HEADER_SIZE + - I8_SIZE + - I32_SIZE + - I8_SIZE * bytes.length + - I8_SIZE - ); - writeU8(BOOLEANS_HEADER); - writeU8(0xff); - writeU32(count); - for (const byte of bytes) writeU8(byte); - writeU8(lastByte); - } - break; - } - case "object": { - if (thing === null) { - let n; - for (n = 1; n < 0x100000104 && i + n < data.length; n++) { - const item = data[i + n]; - if (item !== null) break; - } - i += n - 1; - if (n === 1) { - if (i + 1 < data.length) { - const next = data[i + 1]; - if (next === true) { - allocate(HEADER_SIZE); - writeU8(NULL_AND_TRUE_HEADER); - i++; - } else if (next === false) { - allocate(HEADER_SIZE); - writeU8(NULL_AND_FALSE_HEADER); - i++; - } else if (typeof next === "number") { - const type = identifyNumber(next); - if (type === 0) { - allocate(HEADER_SIZE + I8_SIZE); - writeU8(NULL_AND_I8_HEADER); - currentBuffer.writeInt8(next, currentPosition); - currentPosition += I8_SIZE; - i++; - } else if (type === 1) { - allocate(HEADER_SIZE + I32_SIZE); - writeU8(NULL_AND_I32_HEADER); - currentBuffer.writeInt32LE(next, currentPosition); - currentPosition += I32_SIZE; - i++; - } else { - allocate(HEADER_SIZE); - writeU8(NULL_HEADER); + // Update combinations with the kept chunk with new sizes + for (const combination of combinationsByChunk.get(b)) { + if (combination.deleted) continue; + if (combination.a === b) { + if (!chunkGraph.canChunksBeIntegrated(a, combination.b)) { + combination.deleted = true; + combinations.delete(combination); + continue; } - } else { - allocate(HEADER_SIZE); - writeU8(NULL_HEADER); + // Update size + const newIntegratedSize = chunkGraph.getIntegratedChunksSize( + a, + combination.b, + options + ); + const finishUpdate = combinations.startUpdate(combination); + combination.a = a; + combination.integratedSize = newIntegratedSize; + combination.aSize = integratedSize; + combination.sizeDiff = + combination.bSize + integratedSize - newIntegratedSize; + finishUpdate(); + } else if (combination.b === b) { + if (!chunkGraph.canChunksBeIntegrated(combination.a, a)) { + combination.deleted = true; + combinations.delete(combination); + continue; + } + // Update size + const newIntegratedSize = chunkGraph.getIntegratedChunksSize( + combination.a, + a, + options + ); + + const finishUpdate = combinations.startUpdate(combination); + combination.b = a; + combination.integratedSize = newIntegratedSize; + combination.bSize = integratedSize; + combination.sizeDiff = + integratedSize + combination.aSize - newIntegratedSize; + finishUpdate(); } - } else { - allocate(HEADER_SIZE); - writeU8(NULL_HEADER); } - } else if (n === 2) { - allocate(HEADER_SIZE); - writeU8(NULL2_HEADER); - } else if (n === 3) { - allocate(HEADER_SIZE); - writeU8(NULL3_HEADER); - } else if (n < 260) { - allocate(HEADER_SIZE + I8_SIZE); - writeU8(NULLS8_HEADER); - writeU8(n - 4); - } else { - allocate(HEADER_SIZE + I32_SIZE); - writeU8(NULLS32_HEADER); - writeU32(n - 260); - } - } else if (Buffer.isBuffer(thing)) { - if (thing.length < 8192) { - allocate(HEADER_SIZE + I32_SIZE + thing.length); - writeU8(BUFFER_HEADER); - writeU32(thing.length); - thing.copy(currentBuffer, currentPosition); - currentPosition += thing.length; - } else { - allocate(HEADER_SIZE + I32_SIZE); - writeU8(BUFFER_HEADER); - writeU32(thing.length); - flush(); - buffers.push(thing); + combinationsByChunk.set(a, combinationsByChunk.get(b)); + combinationsByChunk.delete(b); } } - break; + if (changed) return true; } - case "symbol": { - if (thing === MEASURE_START_OPERATION) { - measureStart(); - } else if (thing === MEASURE_END_OPERATION) { - const size = measureEnd(); - allocate(HEADER_SIZE + I32_SIZE); - writeU8(I32_HEADER); - currentBuffer.writeInt32LE(size, currentPosition); - currentPosition += I32_SIZE; + ); + }); + } +} +module.exports = LimitChunkCountPlugin; + + +/***/ }), + +/***/ 27868: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { UsageState } = __webpack_require__(63686); +const { + numberToIdentifier, + NUMBER_OF_IDENTIFIER_START_CHARS, + NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS +} = __webpack_require__(39722); +const { assignDeterministicIds } = __webpack_require__(63290); +const { compareSelect, compareStringsNumeric } = __webpack_require__(29579); + +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../ExportsInfo")} ExportsInfo */ +/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */ + +/** + * @param {ExportsInfo} exportsInfo exports info + * @returns {boolean} mangle is possible + */ +const canMangle = exportsInfo => { + if (exportsInfo.otherExportsInfo.getUsed(undefined) !== UsageState.Unused) + return false; + let hasSomethingToMangle = false; + for (const exportInfo of exportsInfo.exports) { + if (exportInfo.canMangle === true) { + hasSomethingToMangle = true; + } + } + return hasSomethingToMangle; +}; + +// Sort by name +const comparator = compareSelect(e => e.name, compareStringsNumeric); +/** + * @param {boolean} deterministic use deterministic names + * @param {ExportsInfo} exportsInfo exports info + * @param {boolean} isNamespace is namespace object + * @returns {void} + */ +const mangleExportsInfo = (deterministic, exportsInfo, isNamespace) => { + if (!canMangle(exportsInfo)) return; + const usedNames = new Set(); + /** @type {ExportInfo[]} */ + const mangleableExports = []; + + // Avoid to renamed exports that are not provided when + // 1. it's not a namespace export: non-provided exports can be found in prototype chain + // 2. there are other provided exports and deterministic mode is chosen: + // non-provided exports would break the determinism + let avoidMangleNonProvided = !isNamespace; + if (!avoidMangleNonProvided && deterministic) { + for (const exportInfo of exportsInfo.ownedExports) { + if (exportInfo.provided !== false) { + avoidMangleNonProvided = true; + break; + } + } + } + for (const exportInfo of exportsInfo.ownedExports) { + const name = exportInfo.name; + if (!exportInfo.hasUsedName()) { + if ( + // Can the export be mangled? + exportInfo.canMangle !== true || + // Never rename 1 char exports + (name.length === 1 && /^[a-zA-Z0-9_$]/.test(name)) || + // Don't rename 2 char exports in deterministic mode + (deterministic && + name.length === 2 && + /^[a-zA-Z_$][a-zA-Z0-9_$]|^[1-9][0-9]/.test(name)) || + // Don't rename exports that are not provided + (avoidMangleNonProvided && exportInfo.provided !== true) + ) { + exportInfo.setUsedName(name); + usedNames.add(name); + } else { + mangleableExports.push(exportInfo); + } + } + if (exportInfo.exportsInfoOwned) { + const used = exportInfo.getUsed(undefined); + if ( + used === UsageState.OnlyPropertiesUsed || + used === UsageState.Unused + ) { + mangleExportsInfo(deterministic, exportInfo.exportsInfo, false); + } + } + } + if (deterministic) { + assignDeterministicIds( + mangleableExports, + e => e.name, + comparator, + (e, id) => { + const name = numberToIdentifier(id); + const size = usedNames.size; + usedNames.add(name); + if (size === usedNames.size) return false; + e.setUsedName(name); + return true; + }, + [ + NUMBER_OF_IDENTIFIER_START_CHARS, + NUMBER_OF_IDENTIFIER_START_CHARS * + NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS + ], + NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS, + usedNames.size + ); + } else { + const usedExports = []; + const unusedExports = []; + for (const exportInfo of mangleableExports) { + if (exportInfo.getUsed(undefined) === UsageState.Unused) { + unusedExports.push(exportInfo); + } else { + usedExports.push(exportInfo); + } + } + usedExports.sort(comparator); + unusedExports.sort(comparator); + let i = 0; + for (const list of [usedExports, unusedExports]) { + for (const exportInfo of list) { + let name; + do { + name = numberToIdentifier(i++); + } while (usedNames.has(name)); + exportInfo.setUsedName(name); + } + } + } +}; + +class MangleExportsPlugin { + /** + * @param {boolean} deterministic use deterministic names + */ + constructor(deterministic) { + this._deterministic = deterministic; + } + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const { _deterministic: deterministic } = this; + compiler.hooks.compilation.tap("MangleExportsPlugin", compilation => { + const moduleGraph = compilation.moduleGraph; + compilation.hooks.optimizeCodeGeneration.tap( + "MangleExportsPlugin", + modules => { + if (compilation.moduleMemCaches) { + throw new Error( + "optimization.mangleExports can't be used with cacheUnaffected as export mangling is a global effect" + ); + } + for (const module of modules) { + const isNamespace = + module.buildMeta && module.buildMeta.exportsType === "namespace"; + const exportsInfo = moduleGraph.getExportsInfo(module); + mangleExportsInfo(deterministic, exportsInfo, isNamespace); } - break; } - } - } - flush(); + ); + }); + } +} - allocationScope.leftOverBuffer = leftOverBuffer; +module.exports = MangleExportsPlugin; - // avoid leaking memory - currentBuffer = null; - leftOverBuffer = null; - allocationScope = undefined; - const _buffers = buffers; - buffers = undefined; - return _buffers; - } - /** - * @param {SerializedType} data data - * @param {Object} context context object - * @returns {DeserializedType|Promise} deserialized data - */ - deserialize(data, context) { - return this._deserialize(data, context); - } +/***/ }), - _createLazyDeserialized(content, context) { - return SerializerMiddleware.createLazy( - memoize(() => this._deserialize(content, context)), - this, - undefined, - content - ); - } +/***/ 85067: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - _deserializeLazy(fn, context) { - return SerializerMiddleware.deserializeLazy(fn, data => - this._deserialize(data, context) - ); - } + +const { STAGE_BASIC } = __webpack_require__(80057); +const { runtimeEqual } = __webpack_require__(17156); + +/** @typedef {import("../Compiler")} Compiler */ + +class MergeDuplicateChunksPlugin { /** - * @param {SerializedType} data data - * @param {Object} context context object - * @returns {DeserializedType} deserialized data + * @param {Compiler} compiler the compiler + * @returns {void} */ - _deserialize(data, context) { - let currentDataItem = 0; - let currentBuffer = data[0]; - let currentIsBuffer = Buffer.isBuffer(currentBuffer); - let currentPosition = 0; + apply(compiler) { + compiler.hooks.compilation.tap( + "MergeDuplicateChunksPlugin", + compilation => { + compilation.hooks.optimizeChunks.tap( + { + name: "MergeDuplicateChunksPlugin", + stage: STAGE_BASIC + }, + chunks => { + const { chunkGraph, moduleGraph } = compilation; - const retainedBuffer = context.retainedBuffer || (x => x); + // remember already tested chunks for performance + const notDuplicates = new Set(); - const checkOverflow = () => { - if (currentPosition >= currentBuffer.length) { - currentPosition = 0; - currentDataItem++; - currentBuffer = - currentDataItem < data.length ? data[currentDataItem] : null; - currentIsBuffer = Buffer.isBuffer(currentBuffer); - } - }; - const isInCurrentBuffer = n => { - return currentIsBuffer && n + currentPosition <= currentBuffer.length; - }; - const ensureBuffer = () => { - if (!currentIsBuffer) { - throw new Error( - currentBuffer === null - ? "Unexpected end of stream" - : "Unexpected lazy element in stream" - ); - } - }; - /** - * Reads n bytes - * @param {number} n amount of bytes to read - * @returns {Buffer} buffer with bytes - */ - const read = n => { - ensureBuffer(); - const rem = currentBuffer.length - currentPosition; - if (rem < n) { - const buffers = [read(rem)]; - n -= rem; - ensureBuffer(); - while (currentBuffer.length < n) { - const b = /** @type {Buffer} */ (currentBuffer); - buffers.push(b); - n -= b.length; - currentDataItem++; - currentBuffer = - currentDataItem < data.length ? data[currentDataItem] : null; - currentIsBuffer = Buffer.isBuffer(currentBuffer); - ensureBuffer(); - } - buffers.push(read(n)); - return Buffer.concat(buffers); - } - const b = /** @type {Buffer} */ (currentBuffer); - const res = Buffer.from(b.buffer, b.byteOffset + currentPosition, n); - currentPosition += n; - checkOverflow(); - return res; - }; - /** - * Reads up to n bytes - * @param {number} n amount of bytes to read - * @returns {Buffer} buffer with bytes - */ - const readUpTo = n => { - ensureBuffer(); - const rem = currentBuffer.length - currentPosition; - if (rem < n) { - n = rem; - } - const b = /** @type {Buffer} */ (currentBuffer); - const res = Buffer.from(b.buffer, b.byteOffset + currentPosition, n); - currentPosition += n; - checkOverflow(); - return res; - }; - const readU8 = () => { - ensureBuffer(); - /** - * There is no need to check remaining buffer size here - * since {@link checkOverflow} guarantees at least one byte remaining - */ - const byte = /** @type {Buffer} */ (currentBuffer).readUInt8( - currentPosition - ); - currentPosition += I8_SIZE; - checkOverflow(); - return byte; - }; - const readU32 = () => { - return read(I32_SIZE).readUInt32LE(0); - }; - const readBits = (data, n) => { - let mask = 1; - while (n !== 0) { - result.push((data & mask) !== 0); - mask = mask << 1; - n--; - } - }; - const dispatchTable = Array.from({ length: 256 }).map((_, header) => { - switch (header) { - case LAZY_HEADER: - return () => { - const count = readU32(); - const lengths = Array.from({ length: count }).map(() => readU32()); - const content = []; - for (let l of lengths) { - if (l === 0) { - if (typeof currentBuffer !== "function") { - throw new Error("Unexpected non-lazy element in stream"); + // for each chunk + for (const chunk of chunks) { + // track a Set of all chunk that could be duplicates + let possibleDuplicates; + for (const module of chunkGraph.getChunkModulesIterable(chunk)) { + if (possibleDuplicates === undefined) { + // when possibleDuplicates is not yet set, + // create a new Set from chunks of the current module + // including only chunks with the same number of modules + for (const dup of chunkGraph.getModuleChunksIterable( + module + )) { + if ( + dup !== chunk && + chunkGraph.getNumberOfChunkModules(chunk) === + chunkGraph.getNumberOfChunkModules(dup) && + !notDuplicates.has(dup) + ) { + // delay allocating the new Set until here, reduce memory pressure + if (possibleDuplicates === undefined) { + possibleDuplicates = new Set(); + } + possibleDuplicates.add(dup); + } + } + // when no chunk is possible we can break here + if (possibleDuplicates === undefined) break; + } else { + // validate existing possible duplicates + for (const dup of possibleDuplicates) { + // remove possible duplicate when module is not contained + if (!chunkGraph.isModuleInChunk(module, dup)) { + possibleDuplicates.delete(dup); + } + } + // when all chunks has been removed we can break here + if (possibleDuplicates.size === 0) break; } - content.push(currentBuffer); - currentDataItem++; - currentBuffer = - currentDataItem < data.length ? data[currentDataItem] : null; - currentIsBuffer = Buffer.isBuffer(currentBuffer); - } else { - do { - const buf = readUpTo(l); - l -= buf.length; - content.push(retainedBuffer(buf)); - } while (l > 0); - } - } - result.push(this._createLazyDeserialized(content, context)); - }; - case BUFFER_HEADER: - return () => { - const len = readU32(); - result.push(retainedBuffer(read(len))); - }; - case TRUE_HEADER: - return () => result.push(true); - case FALSE_HEADER: - return () => result.push(false); - case NULL3_HEADER: - return () => result.push(null, null, null); - case NULL2_HEADER: - return () => result.push(null, null); - case NULL_HEADER: - return () => result.push(null); - case NULL_AND_TRUE_HEADER: - return () => result.push(null, true); - case NULL_AND_FALSE_HEADER: - return () => result.push(null, false); - case NULL_AND_I8_HEADER: - return () => { - if (currentIsBuffer) { - result.push( - null, - /** @type {Buffer} */ (currentBuffer).readInt8(currentPosition) - ); - currentPosition += I8_SIZE; - checkOverflow(); - } else { - result.push(null, read(I8_SIZE).readInt8(0)); - } - }; - case NULL_AND_I32_HEADER: - return () => { - result.push(null); - if (isInCurrentBuffer(I32_SIZE)) { - result.push( - /** @type {Buffer} */ (currentBuffer).readInt32LE( - currentPosition - ) - ); - currentPosition += I32_SIZE; - checkOverflow(); - } else { - result.push(read(I32_SIZE).readInt32LE(0)); - } - }; - case NULLS8_HEADER: - return () => { - const len = readU8() + 4; - for (let i = 0; i < len; i++) { - result.push(null); - } - }; - case NULLS32_HEADER: - return () => { - const len = readU32() + 260; - for (let i = 0; i < len; i++) { - result.push(null); - } - }; - case BOOLEANS_HEADER: - return () => { - const innerHeader = readU8(); - if ((innerHeader & 0xf0) === 0) { - readBits(innerHeader, 3); - } else if ((innerHeader & 0xe0) === 0) { - readBits(innerHeader, 4); - } else if ((innerHeader & 0xc0) === 0) { - readBits(innerHeader, 5); - } else if ((innerHeader & 0x80) === 0) { - readBits(innerHeader, 6); - } else if (innerHeader !== 0xff) { - let count = (innerHeader & 0x7f) + 7; - while (count > 8) { - readBits(readU8(), 8); - count -= 8; } - readBits(readU8(), count); - } else { - let count = readU32(); - while (count > 8) { - readBits(readU8(), 8); - count -= 8; - } - readBits(readU8(), count); - } - }; - case STRING_HEADER: - return () => { - const len = readU32(); - if (isInCurrentBuffer(len) && currentPosition + len < 0x7fffffff) { - result.push( - currentBuffer.toString( - undefined, - currentPosition, - currentPosition + len - ) - ); - currentPosition += len; - checkOverflow(); - } else { - result.push(read(len).toString()); - } - }; - case SHORT_STRING_HEADER: - return () => result.push(""); - case SHORT_STRING_HEADER | 1: - return () => { - if (currentIsBuffer && currentPosition < 0x7ffffffe) { - result.push( - currentBuffer.toString( - "latin1", - currentPosition, - currentPosition + 1 - ) - ); - currentPosition++; - checkOverflow(); - } else { - result.push(read(1).toString("latin1")); - } - }; - case I8_HEADER: - return () => { - if (currentIsBuffer) { - result.push( - /** @type {Buffer} */ (currentBuffer).readInt8(currentPosition) - ); - currentPosition++; - checkOverflow(); - } else { - result.push(read(1).readInt8(0)); - } - }; - default: - if (header <= 10) { - return () => result.push(header); - } else if ((header & SHORT_STRING_HEADER) === SHORT_STRING_HEADER) { - const len = header & SHORT_STRING_LENGTH_MASK; - return () => { + + // when we found duplicates if ( - isInCurrentBuffer(len) && - currentPosition + len < 0x7fffffff + possibleDuplicates !== undefined && + possibleDuplicates.size > 0 ) { - result.push( - currentBuffer.toString( - "latin1", - currentPosition, - currentPosition + len - ) - ); - currentPosition += len; - checkOverflow(); - } else { - result.push(read(len).toString("latin1")); - } - }; - } else if ((header & NUMBERS_HEADER_MASK) === F64_HEADER) { - const len = (header & NUMBERS_COUNT_MASK) + 1; - return () => { - const need = F64_SIZE * len; - if (isInCurrentBuffer(need)) { - for (let i = 0; i < len; i++) { - result.push( - /** @type {Buffer} */ (currentBuffer).readDoubleLE( - currentPosition - ) - ); - currentPosition += F64_SIZE; - } - checkOverflow(); - } else { - const buf = read(need); - for (let i = 0; i < len; i++) { - result.push(buf.readDoubleLE(i * F64_SIZE)); - } - } - }; - } else if ((header & NUMBERS_HEADER_MASK) === I32_HEADER) { - const len = (header & NUMBERS_COUNT_MASK) + 1; - return () => { - const need = I32_SIZE * len; - if (isInCurrentBuffer(need)) { - for (let i = 0; i < len; i++) { - result.push( - /** @type {Buffer} */ (currentBuffer).readInt32LE( - currentPosition - ) - ); - currentPosition += I32_SIZE; - } - checkOverflow(); - } else { - const buf = read(need); - for (let i = 0; i < len; i++) { - result.push(buf.readInt32LE(i * I32_SIZE)); - } - } - }; - } else if ((header & NUMBERS_HEADER_MASK) === I8_HEADER) { - const len = (header & NUMBERS_COUNT_MASK) + 1; - return () => { - const need = I8_SIZE * len; - if (isInCurrentBuffer(need)) { - for (let i = 0; i < len; i++) { - result.push( - /** @type {Buffer} */ (currentBuffer).readInt8( - currentPosition - ) - ); - currentPosition += I8_SIZE; - } - checkOverflow(); - } else { - const buf = read(need); - for (let i = 0; i < len; i++) { - result.push(buf.readInt8(i * I8_SIZE)); + outer: for (const otherChunk of possibleDuplicates) { + if (otherChunk.hasRuntime() !== chunk.hasRuntime()) continue; + if (chunkGraph.getNumberOfEntryModules(chunk) > 0) continue; + if (chunkGraph.getNumberOfEntryModules(otherChunk) > 0) + continue; + if (!runtimeEqual(chunk.runtime, otherChunk.runtime)) { + for (const module of chunkGraph.getChunkModulesIterable( + chunk + )) { + const exportsInfo = moduleGraph.getExportsInfo(module); + if ( + !exportsInfo.isEquallyUsed( + chunk.runtime, + otherChunk.runtime + ) + ) { + continue outer; + } + } + } + // merge them + if (chunkGraph.canChunksBeIntegrated(chunk, otherChunk)) { + chunkGraph.integrateChunks(chunk, otherChunk); + compilation.chunks.delete(otherChunk); + } } } - }; - } else { - return () => { - throw new Error( - `Unexpected header byte 0x${header.toString(16)}` - ); - }; - } - } - }); - - /** @type {DeserializedType} */ - let result = []; - while (currentBuffer !== null) { - if (typeof currentBuffer === "function") { - result.push(this._deserializeLazy(currentBuffer, context)); - currentDataItem++; - currentBuffer = - currentDataItem < data.length ? data[currentDataItem] : null; - currentIsBuffer = Buffer.isBuffer(currentBuffer); - } else { - const header = readU8(); - dispatchTable[header](); - } - } - // avoid leaking memory in context - let _result = result; - result = undefined; - return _result; + // don't check already processed chunks twice + notDuplicates.add(chunk); + } + } + ); + } + ); } } - -module.exports = BinaryMiddleware; - -module.exports.MEASURE_START_OPERATION = MEASURE_START_OPERATION; -module.exports.MEASURE_END_OPERATION = MEASURE_END_OPERATION; +module.exports = MergeDuplicateChunksPlugin; /***/ }), -/***/ 93475: -/***/ (function(module) { +/***/ 53912: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -class DateObjectSerializer { - serialize(obj, { write }) { - write(obj.getTime()); - } - deserialize({ read }) { - return new Date(read()); - } -} - -module.exports = DateObjectSerializer; - - -/***/ }), +const { STAGE_ADVANCED } = __webpack_require__(80057); +const createSchemaValidation = __webpack_require__(32540); -/***/ 79479: -/***/ (function(module) { +/** @typedef {import("../../declarations/plugins/optimize/MinChunkSizePlugin").MinChunkSizePluginOptions} MinChunkSizePluginOptions */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compiler")} Compiler */ -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ +const validate = createSchemaValidation( + __webpack_require__(60135), + () => __webpack_require__(53850), + { + name: "Min Chunk Size Plugin", + baseDataPath: "options" + } +); +class MinChunkSizePlugin { + /** + * @param {MinChunkSizePluginOptions} options options object + */ + constructor(options) { + validate(options); + this.options = options; + } + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const options = this.options; + const minChunkSize = options.minChunkSize; + compiler.hooks.compilation.tap("MinChunkSizePlugin", compilation => { + compilation.hooks.optimizeChunks.tap( + { + name: "MinChunkSizePlugin", + stage: STAGE_ADVANCED + }, + chunks => { + const chunkGraph = compilation.chunkGraph; + const equalOptions = { + chunkOverhead: 1, + entryChunkMultiplicator: 1 + }; -class ErrorObjectSerializer { - constructor(Type) { - this.Type = Type; - } + const chunkSizesMap = new Map(); + /** @type {[Chunk, Chunk][]} */ + const combinations = []; + /** @type {Chunk[]} */ + const smallChunks = []; + const visitedChunks = []; + for (const a of chunks) { + // check if one of the chunks sizes is smaller than the minChunkSize + // and filter pairs that can NOT be integrated! + if (chunkGraph.getChunkSize(a, equalOptions) < minChunkSize) { + smallChunks.push(a); + for (const b of visitedChunks) { + if (chunkGraph.canChunksBeIntegrated(b, a)) + combinations.push([b, a]); + } + } else { + for (const b of smallChunks) { + if (chunkGraph.canChunksBeIntegrated(b, a)) + combinations.push([b, a]); + } + } + chunkSizesMap.set(a, chunkGraph.getChunkSize(a, options)); + visitedChunks.push(a); + } - serialize(obj, { write }) { - write(obj.message); - write(obj.stack); - } + const sortedSizeFilteredExtendedPairCombinations = combinations + .map(pair => { + // extend combination pairs with size and integrated size + const a = chunkSizesMap.get(pair[0]); + const b = chunkSizesMap.get(pair[1]); + const ab = chunkGraph.getIntegratedChunksSize( + pair[0], + pair[1], + options + ); + /** @type {[number, number, Chunk, Chunk]} */ + const extendedPair = [a + b - ab, ab, pair[0], pair[1]]; + return extendedPair; + }) + .sort((a, b) => { + // sadly javascript does an in place sort here + // sort by size + const diff = b[0] - a[0]; + if (diff !== 0) return diff; + return a[1] - b[1]; + }); - deserialize({ read }) { - const err = new this.Type(); + if (sortedSizeFilteredExtendedPairCombinations.length === 0) return; - err.message = read(); - err.stack = read(); + const pair = sortedSizeFilteredExtendedPairCombinations[0]; - return err; + chunkGraph.integrateChunks(pair[2], pair[3]); + compilation.chunks.delete(pair[3]); + return true; + } + ); + }); } } - -module.exports = ErrorObjectSerializer; +module.exports = MinChunkSizePlugin; /***/ }), -/***/ 65321: +/***/ 85305: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const { constants } = __webpack_require__(14300); -const { pipeline } = __webpack_require__(12781); -const { - createBrotliCompress, - createBrotliDecompress, - createGzip, - createGunzip, - constants: zConstants -} = __webpack_require__(59796); -const createHash = __webpack_require__(49835); -const { dirname, join, mkdirp } = __webpack_require__(17139); -const memoize = __webpack_require__(78676); -const SerializerMiddleware = __webpack_require__(83137); - -/** @typedef {typeof import("../util/Hash")} Hash */ -/** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */ -/** @typedef {import("./types").BufferSerializableType} BufferSerializableType */ +const SizeFormatHelpers = __webpack_require__(71070); +const WebpackError = __webpack_require__(53799); -/* -Format: +class MinMaxSizeWarning extends WebpackError { + constructor(keys, minSize, maxSize) { + let keysMessage = "Fallback cache group"; + if (keys) { + keysMessage = + keys.length > 1 + ? `Cache groups ${keys.sort().join(", ")}` + : `Cache group ${keys[0]}`; + } + super( + `SplitChunksPlugin\n` + + `${keysMessage}\n` + + `Configured minSize (${SizeFormatHelpers.formatSize(minSize)}) is ` + + `bigger than maxSize (${SizeFormatHelpers.formatSize(maxSize)}).\n` + + "This seem to be a invalid optimization.splitChunks configuration." + ); + } +} -File -> Header Section* +module.exports = MinMaxSizeWarning; -Version -> u32 -AmountOfSections -> u32 -SectionSize -> i32 (if less than zero represents lazy value) -Header -> Version AmountOfSections SectionSize* +/***/ }), -Buffer -> n bytes -Section -> Buffer +/***/ 74844: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -// "wpc" + 1 in little-endian -const VERSION = 0x01637077; -const WRITE_LIMIT_TOTAL = 0x7fff0000; -const WRITE_LIMIT_CHUNK = 511 * 1024 * 1024; - -/** - * @param {Buffer[]} buffers buffers - * @param {string | Hash} hashFunction hash function to use - * @returns {string} hash - */ -const hashForName = (buffers, hashFunction) => { - const hash = createHash(hashFunction); - for (const buf of buffers) hash.update(buf); - return /** @type {string} */ (hash.digest("hex")); -}; - -const COMPRESSION_CHUNK_SIZE = 100 * 1024 * 1024; -const DECOMPRESSION_CHUNK_SIZE = 100 * 1024 * 1024; - -const writeUInt64LE = Buffer.prototype.writeBigUInt64LE - ? (buf, value, offset) => { - buf.writeBigUInt64LE(BigInt(value), offset); - } - : (buf, value, offset) => { - const low = value % 0x100000000; - const high = (value - low) / 0x100000000; - buf.writeUInt32LE(low, offset); - buf.writeUInt32LE(high, offset + 4); - }; - -const readUInt64LE = Buffer.prototype.readBigUInt64LE - ? (buf, offset) => { - return Number(buf.readBigUInt64LE(offset)); - } - : (buf, offset) => { - const low = buf.readUInt32LE(offset); - const high = buf.readUInt32LE(offset + 4); - return high * 0x100000000 + low; - }; -/** - * @typedef {Object} SerializeResult - * @property {string | false} name - * @property {number} size - * @property {Promise=} backgroundJob - */ -/** - * @param {FileMiddleware} middleware this - * @param {BufferSerializableType[] | Promise} data data to be serialized - * @param {string | boolean} name file base name - * @param {function(string | false, Buffer[], number): Promise} writeFile writes a file - * @param {string | Hash} hashFunction hash function to use - * @returns {Promise} resulting file pointer and promise - */ -const serialize = async ( - middleware, - data, - name, - writeFile, - hashFunction = "md4" -) => { - /** @type {(Buffer[] | Buffer | SerializeResult | Promise)[]} */ - const processedData = []; - /** @type {WeakMap>} */ - const resultToLazy = new WeakMap(); - /** @type {Buffer[]} */ - let lastBuffers = undefined; - for (const item of await data) { - if (typeof item === "function") { - if (!SerializerMiddleware.isLazy(item)) - throw new Error("Unexpected function"); - if (!SerializerMiddleware.isLazy(item, middleware)) { - throw new Error( - "Unexpected lazy value with non-this target (can't pass through lazy values)" - ); - } - lastBuffers = undefined; - const serializedInfo = SerializerMiddleware.getLazySerializedValue(item); - if (serializedInfo) { - if (typeof serializedInfo === "function") { - throw new Error( - "Unexpected lazy value with non-this target (can't pass through lazy values)" - ); - } else { - processedData.push(serializedInfo); - } - } else { - const content = item(); - if (content) { - const options = SerializerMiddleware.getLazyOptions(item); - processedData.push( - serialize( - middleware, - content, - (options && options.name) || true, - writeFile, - hashFunction - ).then(result => { - /** @type {any} */ (item).options.size = result.size; - resultToLazy.set(result, item); - return result; - }) - ); - } else { - throw new Error( - "Unexpected falsy value returned by lazy value function" - ); - } - } - } else if (item) { - if (lastBuffers) { - lastBuffers.push(item); - } else { - lastBuffers = [item]; - processedData.push(lastBuffers); - } - } else { - throw new Error("Unexpected falsy value in items array"); - } - } - /** @type {Promise[]} */ - const backgroundJobs = []; - const resolvedData = ( - await Promise.all( - /** @type {Promise[]} */ ( - processedData - ) - ) - ).map(item => { - if (Array.isArray(item) || Buffer.isBuffer(item)) return item; +const asyncLib = __webpack_require__(78175); +const ChunkGraph = __webpack_require__(64971); +const ModuleGraph = __webpack_require__(99988); +const { STAGE_DEFAULT } = __webpack_require__(80057); +const HarmonyImportDependency = __webpack_require__(57154); +const { compareModulesByIdentifier } = __webpack_require__(29579); +const { + intersectRuntime, + mergeRuntimeOwned, + filterRuntime, + runtimeToString, + mergeRuntime +} = __webpack_require__(17156); +const ConcatenatedModule = __webpack_require__(97198); - backgroundJobs.push(item.backgroundJob); - // create pointer buffer from size and name - const name = /** @type {string} */ (item.name); - const nameBuffer = Buffer.from(name); - const buf = Buffer.allocUnsafe(8 + nameBuffer.length); - writeUInt64LE(buf, item.size, 0); - nameBuffer.copy(buf, 8, 0); - const lazy = resultToLazy.get(item); - SerializerMiddleware.setLazySerializedValue(lazy, buf); - return buf; - }); - const lengths = []; - for (const item of resolvedData) { - if (Array.isArray(item)) { - let l = 0; - for (const b of item) l += b.length; - while (l > 0x7fffffff) { - lengths.push(0x7fffffff); - l -= 0x7fffffff; - } - lengths.push(l); - } else if (item) { - lengths.push(-item.length); - } else { - throw new Error("Unexpected falsy value in resolved data " + item); - } - } - const header = Buffer.allocUnsafe(8 + lengths.length * 4); - header.writeUInt32LE(VERSION, 0); - header.writeUInt32LE(lengths.length, 4); - for (let i = 0; i < lengths.length; i++) { - header.writeInt32LE(lengths[i], 8 + i * 4); - } - const buf = [header]; - for (const item of resolvedData) { - if (Array.isArray(item)) { - for (const b of item) buf.push(b); - } else if (item) { - buf.push(item); - } - } - if (name === true) { - name = hashForName(buf, hashFunction); - } - let size = 0; - for (const b of buf) size += b.length; - backgroundJobs.push(writeFile(name, buf, size)); - return { - size, - name, - backgroundJob: - backgroundJobs.length === 1 - ? backgroundJobs[0] - : Promise.all(backgroundJobs) - }; -}; +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ /** - * @param {FileMiddleware} middleware this - * @param {string | false} name filename - * @param {function(string | false): Promise} readFile read content of a file - * @returns {Promise} deserialized data - */ -const deserialize = async (middleware, name, readFile) => { - const contents = await readFile(name); - if (contents.length === 0) throw new Error("Empty file " + name); - let contentsIndex = 0; - let contentItem = contents[0]; - let contentItemLength = contentItem.length; - let contentPosition = 0; - if (contentItemLength === 0) throw new Error("Empty file " + name); - const nextContent = () => { - contentsIndex++; - contentItem = contents[contentsIndex]; - contentItemLength = contentItem.length; - contentPosition = 0; - }; - const ensureData = n => { - if (contentPosition === contentItemLength) { - nextContent(); - } - while (contentItemLength - contentPosition < n) { - const remaining = contentItem.slice(contentPosition); - let lengthFromNext = n - remaining.length; - const buffers = [remaining]; - for (let i = contentsIndex + 1; i < contents.length; i++) { - const l = contents[i].length; - if (l > lengthFromNext) { - buffers.push(contents[i].slice(0, lengthFromNext)); - contents[i] = contents[i].slice(lengthFromNext); - lengthFromNext = 0; - break; - } else { - buffers.push(contents[i]); - contentsIndex = i; - lengthFromNext -= l; - } - } - if (lengthFromNext > 0) throw new Error("Unexpected end of data"); - contentItem = Buffer.concat(buffers, n); - contentItemLength = n; - contentPosition = 0; - } - }; - const readUInt32LE = () => { - ensureData(4); - const value = contentItem.readUInt32LE(contentPosition); - contentPosition += 4; - return value; - }; - const readInt32LE = () => { - ensureData(4); - const value = contentItem.readInt32LE(contentPosition); - contentPosition += 4; - return value; - }; - const readSlice = l => { - ensureData(l); - if (contentPosition === 0 && contentItemLength === l) { - const result = contentItem; - if (contentsIndex + 1 < contents.length) { - nextContent(); - } else { - contentPosition = l; - } - return result; - } - const result = contentItem.slice(contentPosition, contentPosition + l); - contentPosition += l; - // we clone the buffer here to allow the original content to be garbage collected - return l * 2 < contentItem.buffer.byteLength ? Buffer.from(result) : result; - }; - const version = readUInt32LE(); - if (version !== VERSION) { - throw new Error("Invalid file version"); - } - const sectionCount = readUInt32LE(); - const lengths = []; - let lastLengthPositive = false; - for (let i = 0; i < sectionCount; i++) { - const value = readInt32LE(); - const valuePositive = value >= 0; - if (lastLengthPositive && valuePositive) { - lengths[lengths.length - 1] += value; - } else { - lengths.push(value); - lastLengthPositive = valuePositive; - } + * @typedef {Object} Statistics + * @property {number} cached + * @property {number} alreadyInConfig + * @property {number} invalidModule + * @property {number} incorrectChunks + * @property {number} incorrectDependency + * @property {number} incorrectModuleDependency + * @property {number} incorrectChunksOfImporter + * @property {number} incorrectRuntimeCondition + * @property {number} importerFailed + * @property {number} added + */ + +const formatBailoutReason = msg => { + return "ModuleConcatenation bailout: " + msg; +}; + +class ModuleConcatenationPlugin { + constructor(options) { + if (typeof options !== "object") options = {}; + this.options = options; } - const result = []; - for (let length of lengths) { - if (length < 0) { - const slice = readSlice(-length); - const size = Number(readUInt64LE(slice, 0)); - const nameBuffer = slice.slice(8); - const name = nameBuffer.toString(); - result.push( - SerializerMiddleware.createLazy( - memoize(() => deserialize(middleware, name, readFile)), - middleware, - { - name, - size - }, - slice - ) - ); - } else { - if (contentPosition === contentItemLength) { - nextContent(); - } else if (contentPosition !== 0) { - if (length <= contentItemLength - contentPosition) { - result.push( - Buffer.from( - contentItem.buffer, - contentItem.byteOffset + contentPosition, - length - ) + + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const { _backCompat: backCompat } = compiler; + compiler.hooks.compilation.tap("ModuleConcatenationPlugin", compilation => { + const moduleGraph = compilation.moduleGraph; + const bailoutReasonMap = new Map(); + + const setBailoutReason = (module, reason) => { + setInnerBailoutReason(module, reason); + moduleGraph + .getOptimizationBailout(module) + .push( + typeof reason === "function" + ? rs => formatBailoutReason(reason(rs)) + : formatBailoutReason(reason) ); - contentPosition += length; - length = 0; - } else { - const l = contentItemLength - contentPosition; - result.push( - Buffer.from( - contentItem.buffer, - contentItem.byteOffset + contentPosition, - l - ) + }; + + const setInnerBailoutReason = (module, reason) => { + bailoutReasonMap.set(module, reason); + }; + + const getInnerBailoutReason = (module, requestShortener) => { + const reason = bailoutReasonMap.get(module); + if (typeof reason === "function") return reason(requestShortener); + return reason; + }; + + const formatBailoutWarning = (module, problem) => requestShortener => { + if (typeof problem === "function") { + return formatBailoutReason( + `Cannot concat with ${module.readableIdentifier( + requestShortener + )}: ${problem(requestShortener)}` ); - length -= l; - contentPosition = contentItemLength; } - } else { - if (length >= contentItemLength) { - result.push(contentItem); - length -= contentItemLength; - contentPosition = contentItemLength; - } else { - result.push( - Buffer.from(contentItem.buffer, contentItem.byteOffset, length) + const reason = getInnerBailoutReason(module, requestShortener); + const reasonWithPrefix = reason ? `: ${reason}` : ""; + if (module === problem) { + return formatBailoutReason( + `Cannot concat with ${module.readableIdentifier( + requestShortener + )}${reasonWithPrefix}` ); - contentPosition += length; - length = 0; - } - } - while (length > 0) { - nextContent(); - if (length >= contentItemLength) { - result.push(contentItem); - length -= contentItemLength; - contentPosition = contentItemLength; } else { - result.push( - Buffer.from(contentItem.buffer, contentItem.byteOffset, length) + return formatBailoutReason( + `Cannot concat with ${module.readableIdentifier( + requestShortener + )} because of ${problem.readableIdentifier( + requestShortener + )}${reasonWithPrefix}` ); - contentPosition += length; - length = 0; } - } - } - } - return result; -}; + }; -/** - * @typedef {BufferSerializableType[]} DeserializedType - * @typedef {true} SerializedType - * @extends {SerializerMiddleware} - */ -class FileMiddleware extends SerializerMiddleware { - /** - * @param {IntermediateFileSystem} fs filesystem - * @param {string | Hash} hashFunction hash function to use - */ - constructor(fs, hashFunction = "md4") { - super(); - this.fs = fs; - this._hashFunction = hashFunction; - } - /** - * @param {DeserializedType} data data - * @param {Object} context context object - * @returns {SerializedType|Promise} serialized data - */ - serialize(data, context) { - const { filename, extension = "" } = context; - return new Promise((resolve, reject) => { - mkdirp(this.fs, dirname(this.fs, filename), err => { - if (err) return reject(err); + compilation.hooks.optimizeChunkModules.tapAsync( + { + name: "ModuleConcatenationPlugin", + stage: STAGE_DEFAULT + }, + (allChunks, modules, callback) => { + const logger = compilation.getLogger( + "webpack.ModuleConcatenationPlugin" + ); + const { chunkGraph, moduleGraph } = compilation; + const relevantModules = []; + const possibleInners = new Set(); + const context = { + chunkGraph, + moduleGraph + }; + logger.time("select relevant modules"); + for (const module of modules) { + let canBeRoot = true; + let canBeInner = true; - // It's important that we don't touch existing files during serialization - // because serialize may read existing files (when deserializing) - const allWrittenFiles = new Set(); - const writeFile = async (name, content, size) => { - const file = name - ? join(this.fs, filename, `../${name}${extension}`) - : filename; - await new Promise((resolve, reject) => { - let stream = this.fs.createWriteStream(file + "_"); - let compression; - if (file.endsWith(".gz")) { - compression = createGzip({ - chunkSize: COMPRESSION_CHUNK_SIZE, - level: zConstants.Z_BEST_SPEED - }); - } else if (file.endsWith(".br")) { - compression = createBrotliCompress({ - chunkSize: COMPRESSION_CHUNK_SIZE, - params: { - [zConstants.BROTLI_PARAM_MODE]: zConstants.BROTLI_MODE_TEXT, - [zConstants.BROTLI_PARAM_QUALITY]: 2, - [zConstants.BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING]: true, - [zConstants.BROTLI_PARAM_SIZE_HINT]: size - } - }); + const bailoutReason = module.getConcatenationBailoutReason(context); + if (bailoutReason) { + setBailoutReason(module, bailoutReason); + continue; } - if (compression) { - pipeline(compression, stream, reject); - stream = compression; - stream.on("finish", () => resolve()); - } else { - stream.on("error", err => reject(err)); - stream.on("finish", () => resolve()); + + // Must not be an async module + if (moduleGraph.isAsync(module)) { + setBailoutReason(module, `Module is async`); + continue; } - // split into chunks for WRITE_LIMIT_CHUNK size - const chunks = []; - for (const b of content) { - if (b.length < WRITE_LIMIT_CHUNK) { - chunks.push(b); + + // Must be in strict mode + if (!module.buildInfo.strict) { + setBailoutReason(module, `Module is not in strict mode`); + continue; + } + + // Module must be in any chunk (we don't want to do useless work) + if (chunkGraph.getNumberOfModuleChunks(module) === 0) { + setBailoutReason(module, "Module is not in any chunk"); + continue; + } + + // Exports must be known (and not dynamic) + const exportsInfo = moduleGraph.getExportsInfo(module); + const relevantExports = exportsInfo.getRelevantExports(undefined); + const unknownReexports = relevantExports.filter(exportInfo => { + return ( + exportInfo.isReexport() && !exportInfo.getTarget(moduleGraph) + ); + }); + if (unknownReexports.length > 0) { + setBailoutReason( + module, + `Reexports in this module do not have a static target (${Array.from( + unknownReexports, + exportInfo => + `${ + exportInfo.name || "other exports" + }: ${exportInfo.getUsedInfo()}` + ).join(", ")})` + ); + continue; + } + + // Root modules must have a static list of exports + const unknownProvidedExports = relevantExports.filter( + exportInfo => { + return exportInfo.provided !== true; + } + ); + if (unknownProvidedExports.length > 0) { + setBailoutReason( + module, + `List of module exports is dynamic (${Array.from( + unknownProvidedExports, + exportInfo => + `${ + exportInfo.name || "other exports" + }: ${exportInfo.getProvidedInfo()} and ${exportInfo.getUsedInfo()}` + ).join(", ")})` + ); + canBeRoot = false; + } + + // Module must not be an entry point + if (chunkGraph.isEntryModule(module)) { + setInnerBailoutReason(module, "Module is an entry point"); + canBeInner = false; + } + + if (canBeRoot) relevantModules.push(module); + if (canBeInner) possibleInners.add(module); + } + logger.timeEnd("select relevant modules"); + logger.debug( + `${relevantModules.length} potential root modules, ${possibleInners.size} potential inner modules` + ); + // sort by depth + // modules with lower depth are more likely suited as roots + // this improves performance, because modules already selected as inner are skipped + logger.time("sort relevant modules"); + relevantModules.sort((a, b) => { + return moduleGraph.getDepth(a) - moduleGraph.getDepth(b); + }); + logger.timeEnd("sort relevant modules"); + + /** @type {Statistics} */ + const stats = { + cached: 0, + alreadyInConfig: 0, + invalidModule: 0, + incorrectChunks: 0, + incorrectDependency: 0, + incorrectModuleDependency: 0, + incorrectChunksOfImporter: 0, + incorrectRuntimeCondition: 0, + importerFailed: 0, + added: 0 + }; + let statsCandidates = 0; + let statsSizeSum = 0; + let statsEmptyConfigurations = 0; + + logger.time("find modules to concatenate"); + const concatConfigurations = []; + const usedAsInner = new Set(); + for (const currentRoot of relevantModules) { + // when used by another configuration as inner: + // the other configuration is better and we can skip this one + // TODO reconsider that when it's only used in a different runtime + if (usedAsInner.has(currentRoot)) continue; + + let chunkRuntime = undefined; + for (const r of chunkGraph.getModuleRuntimes(currentRoot)) { + chunkRuntime = mergeRuntimeOwned(chunkRuntime, r); + } + const exportsInfo = moduleGraph.getExportsInfo(currentRoot); + const filteredRuntime = filterRuntime(chunkRuntime, r => + exportsInfo.isModuleUsed(r) + ); + const activeRuntime = + filteredRuntime === true + ? chunkRuntime + : filteredRuntime === false + ? undefined + : filteredRuntime; + + // create a configuration with the root + const currentConfiguration = new ConcatConfiguration( + currentRoot, + activeRuntime + ); + + // cache failures to add modules + const failureCache = new Map(); + + // potential optional import candidates + /** @type {Set} */ + const candidates = new Set(); + + // try to add all imports + for (const imp of this._getImports( + compilation, + currentRoot, + activeRuntime + )) { + candidates.add(imp); + } + + for (const imp of candidates) { + const impCandidates = new Set(); + const problem = this._tryToAdd( + compilation, + currentConfiguration, + imp, + chunkRuntime, + activeRuntime, + possibleInners, + impCandidates, + failureCache, + chunkGraph, + true, + stats + ); + if (problem) { + failureCache.set(imp, problem); + currentConfiguration.addWarning(imp, problem); } else { - for (let i = 0; i < b.length; i += WRITE_LIMIT_CHUNK) { - chunks.push(b.slice(i, i + WRITE_LIMIT_CHUNK)); + for (const c of impCandidates) { + candidates.add(c); } } } + statsCandidates += candidates.size; + if (!currentConfiguration.isEmpty()) { + const modules = currentConfiguration.getModules(); + statsSizeSum += modules.size; + concatConfigurations.push(currentConfiguration); + for (const module of modules) { + if (module !== currentConfiguration.rootModule) { + usedAsInner.add(module); + } + } + } else { + statsEmptyConfigurations++; + const optimizationBailouts = + moduleGraph.getOptimizationBailout(currentRoot); + for (const warning of currentConfiguration.getWarningsSorted()) { + optimizationBailouts.push( + formatBailoutWarning(warning[0], warning[1]) + ); + } + } + } + logger.timeEnd("find modules to concatenate"); + logger.debug( + `${ + concatConfigurations.length + } successful concat configurations (avg size: ${ + statsSizeSum / concatConfigurations.length + }), ${statsEmptyConfigurations} bailed out completely` + ); + logger.debug( + `${statsCandidates} candidates were considered for adding (${stats.cached} cached failure, ${stats.alreadyInConfig} already in config, ${stats.invalidModule} invalid module, ${stats.incorrectChunks} incorrect chunks, ${stats.incorrectDependency} incorrect dependency, ${stats.incorrectChunksOfImporter} incorrect chunks of importer, ${stats.incorrectModuleDependency} incorrect module dependency, ${stats.incorrectRuntimeCondition} incorrect runtime condition, ${stats.importerFailed} importer failed, ${stats.added} added)` + ); + // HACK: Sort configurations by length and start with the longest one + // to get the biggest groups possible. Used modules are marked with usedModules + // TODO: Allow to reuse existing configuration while trying to add dependencies. + // This would improve performance. O(n^2) -> O(n) + logger.time(`sort concat configurations`); + concatConfigurations.sort((a, b) => { + return b.modules.size - a.modules.size; + }); + logger.timeEnd(`sort concat configurations`); + const usedModules = new Set(); - const len = chunks.length; - let i = 0; - const batchWrite = err => { - // will be handled in "on" error handler - if (err) return; + logger.time("create concatenated modules"); + asyncLib.each( + concatConfigurations, + (concatConfiguration, callback) => { + const rootModule = concatConfiguration.rootModule; + + // Avoid overlapping configurations + // TODO: remove this when todo above is fixed + if (usedModules.has(rootModule)) return callback(); + const modules = concatConfiguration.getModules(); + for (const m of modules) { + usedModules.add(m); + } + + // Create a new ConcatenatedModule + let newModule = ConcatenatedModule.create( + rootModule, + modules, + concatConfiguration.runtime, + compiler.root, + compilation.outputOptions.hashFunction + ); + + const build = () => { + newModule.build( + compiler.options, + compilation, + null, + null, + err => { + if (err) { + if (!err.module) { + err.module = newModule; + } + return callback(err); + } + integrate(); + } + ); + }; + + const integrate = () => { + if (backCompat) { + ChunkGraph.setChunkGraphForModule(newModule, chunkGraph); + ModuleGraph.setModuleGraphForModule(newModule, moduleGraph); + } + + for (const warning of concatConfiguration.getWarningsSorted()) { + moduleGraph + .getOptimizationBailout(newModule) + .push(formatBailoutWarning(warning[0], warning[1])); + } + moduleGraph.cloneModuleAttributes(rootModule, newModule); + for (const m of modules) { + // add to builtModules when one of the included modules was built + if (compilation.builtModules.has(m)) { + compilation.builtModules.add(newModule); + } + if (m !== rootModule) { + // attach external references to the concatenated module too + moduleGraph.copyOutgoingModuleConnections( + m, + newModule, + c => { + return ( + c.originModule === m && + !( + c.dependency instanceof HarmonyImportDependency && + modules.has(c.module) + ) + ); + } + ); + // remove module from chunk + for (const chunk of chunkGraph.getModuleChunksIterable( + rootModule + )) { + chunkGraph.disconnectChunkAndModule(chunk, m); + } + } + } + compilation.modules.delete(rootModule); + ChunkGraph.clearChunkGraphForModule(rootModule); + ModuleGraph.clearModuleGraphForModule(rootModule); - if (i === len) { - stream.end(); - return; - } + // remove module from chunk + chunkGraph.replaceModule(rootModule, newModule); + // replace module references with the concatenated module + moduleGraph.moveModuleConnections(rootModule, newModule, c => { + const otherModule = + c.module === rootModule ? c.originModule : c.module; + const innerConnection = + c.dependency instanceof HarmonyImportDependency && + modules.has(otherModule); + return !innerConnection; + }); + // add concatenated module to the compilation + compilation.modules.add(newModule); - // queue up a batch of chunks up to the write limit - // end is exclusive - let end = i; - let sum = chunks[end++].length; - while (end < len) { - sum += chunks[end].length; - if (sum > WRITE_LIMIT_TOTAL) break; - end++; - } - while (i < end - 1) { - stream.write(chunks[i++]); - } - stream.write(chunks[i++], batchWrite); - }; - batchWrite(); - }); - if (name) allWrittenFiles.add(file); - }; + callback(); + }; - resolve( - serialize(this, data, false, writeFile, this._hashFunction).then( - async ({ backgroundJob }) => { - await backgroundJob; + build(); + }, + err => { + logger.timeEnd("create concatenated modules"); + process.nextTick(callback.bind(null, err)); + } + ); + } + ); + }); + } - // Rename the index file to disallow access during inconsistent file state - await new Promise(resolve => - this.fs.rename(filename, filename + ".old", err => { - resolve(); - }) - ); + /** + * @param {Compilation} compilation the compilation + * @param {Module} module the module to be added + * @param {RuntimeSpec} runtime the runtime scope + * @returns {Set} the imported modules + */ + _getImports(compilation, module, runtime) { + const moduleGraph = compilation.moduleGraph; + const set = new Set(); + for (const dep of module.dependencies) { + // Get reference info only for harmony Dependencies + if (!(dep instanceof HarmonyImportDependency)) continue; - // update all written files - await Promise.all( - Array.from( - allWrittenFiles, - file => - new Promise((resolve, reject) => { - this.fs.rename(file + "_", file, err => { - if (err) return reject(err); - resolve(); - }); - }) - ) - ); + const connection = moduleGraph.getConnection(dep); + // Reference is valid and has a module + if ( + !connection || + !connection.module || + !connection.isTargetActive(runtime) + ) { + continue; + } - // As final step automatically update the index file to have a consistent pack again - await new Promise(resolve => { - this.fs.rename(filename + "_", filename, err => { - if (err) return reject(err); - resolve(); - }); - }); - return /** @type {true} */ (true); - } - ) - ); - }); - }); + const importedNames = compilation.getDependencyReferencedExports( + dep, + undefined + ); + + if ( + importedNames.every(i => + Array.isArray(i) ? i.length > 0 : i.name.length > 0 + ) || + Array.isArray(moduleGraph.getProvidedExports(module)) + ) { + set.add(connection.module); + } + } + return set; } /** - * @param {SerializedType} data data - * @param {Object} context context object - * @returns {DeserializedType|Promise} deserialized data + * @param {Compilation} compilation webpack compilation + * @param {ConcatConfiguration} config concat configuration (will be modified when added) + * @param {Module} module the module to be added + * @param {RuntimeSpec} runtime the runtime scope of the generated code + * @param {RuntimeSpec} activeRuntime the runtime scope of the root module + * @param {Set} possibleModules modules that are candidates + * @param {Set} candidates list of potential candidates (will be added to) + * @param {Map} failureCache cache for problematic modules to be more performant + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {boolean} avoidMutateOnFailure avoid mutating the config when adding fails + * @param {Statistics} statistics gathering metrics + * @returns {Module | function(RequestShortener): string} the problematic module */ - deserialize(data, context) { - const { filename, extension = "" } = context; - const readFile = name => - new Promise((resolve, reject) => { - const file = name - ? join(this.fs, filename, `../${name}${extension}`) - : filename; - this.fs.stat(file, (err, stats) => { - if (err) { - reject(err); - return; - } - let remaining = /** @type {number} */ (stats.size); - let currentBuffer; - let currentBufferUsed; - const buf = []; - let decompression; - if (file.endsWith(".gz")) { - decompression = createGunzip({ - chunkSize: DECOMPRESSION_CHUNK_SIZE - }); - } else if (file.endsWith(".br")) { - decompression = createBrotliDecompress({ - chunkSize: DECOMPRESSION_CHUNK_SIZE - }); - } - if (decompression) { - let newResolve, newReject; - resolve( - Promise.all([ - new Promise((rs, rj) => { - newResolve = rs; - newReject = rj; - }), - new Promise((resolve, reject) => { - decompression.on("data", chunk => buf.push(chunk)); - decompression.on("end", () => resolve()); - decompression.on("error", err => reject(err)); - }) - ]).then(() => buf) - ); - resolve = newResolve; - reject = newReject; - } - this.fs.open(file, "r", (err, fd) => { - if (err) { - reject(err); - return; - } - const read = () => { - if (currentBuffer === undefined) { - currentBuffer = Buffer.allocUnsafeSlow( - Math.min( - constants.MAX_LENGTH, - remaining, - decompression ? DECOMPRESSION_CHUNK_SIZE : Infinity - ) - ); - currentBufferUsed = 0; - } - let readBuffer = currentBuffer; - let readOffset = currentBufferUsed; - let readLength = currentBuffer.length - currentBufferUsed; - // values passed to fs.read must be valid int32 values - if (readOffset > 0x7fffffff) { - readBuffer = currentBuffer.slice(readOffset); - readOffset = 0; - } - if (readLength > 0x7fffffff) { - readLength = 0x7fffffff; - } - this.fs.read( - fd, - readBuffer, - readOffset, - readLength, - null, - (err, bytesRead) => { - if (err) { - this.fs.close(fd, () => { - reject(err); - }); - return; - } - currentBufferUsed += bytesRead; - remaining -= bytesRead; - if (currentBufferUsed === currentBuffer.length) { - if (decompression) { - decompression.write(currentBuffer); - } else { - buf.push(currentBuffer); - } - currentBuffer = undefined; - if (remaining === 0) { - if (decompression) { - decompression.end(); - } - this.fs.close(fd, err => { - if (err) { - reject(err); - return; - } - resolve(buf); - }); - return; - } - } - read(); - } - ); - }; - read(); - }); + _tryToAdd( + compilation, + config, + module, + runtime, + activeRuntime, + possibleModules, + candidates, + failureCache, + chunkGraph, + avoidMutateOnFailure, + statistics + ) { + const cacheEntry = failureCache.get(module); + if (cacheEntry) { + statistics.cached++; + return cacheEntry; + } + + // Already added? + if (config.has(module)) { + statistics.alreadyInConfig++; + return null; + } + + // Not possible to add? + if (!possibleModules.has(module)) { + statistics.invalidModule++; + failureCache.set(module, module); // cache failures for performance + return module; + } + + // Module must be in the correct chunks + const missingChunks = Array.from( + chunkGraph.getModuleChunksIterable(config.rootModule) + ).filter(chunk => !chunkGraph.isModuleInChunk(module, chunk)); + if (missingChunks.length > 0) { + const problem = requestShortener => { + const missingChunksList = Array.from( + new Set(missingChunks.map(chunk => chunk.name || "unnamed chunk(s)")) + ).sort(); + const chunks = Array.from( + new Set( + Array.from(chunkGraph.getModuleChunksIterable(module)).map( + chunk => chunk.name || "unnamed chunk(s)" + ) + ) + ).sort(); + return `Module ${module.readableIdentifier( + requestShortener + )} is not in the same chunk(s) (expected in chunk(s) ${missingChunksList.join( + ", " + )}, module is in chunk(s) ${chunks.join(", ")})`; + }; + statistics.incorrectChunks++; + failureCache.set(module, problem); // cache failures for performance + return problem; + } + + const moduleGraph = compilation.moduleGraph; + + const incomingConnections = + moduleGraph.getIncomingConnectionsByOriginModule(module); + + const incomingConnectionsFromNonModules = + incomingConnections.get(null) || incomingConnections.get(undefined); + if (incomingConnectionsFromNonModules) { + const activeNonModulesConnections = + incomingConnectionsFromNonModules.filter(connection => { + // We are not interested in inactive connections + // or connections without dependency + return connection.isActive(runtime) || connection.dependency; }); - }); - return deserialize(this, false, readFile); - } -} + if (activeNonModulesConnections.length > 0) { + const problem = requestShortener => { + const importingExplanations = new Set( + activeNonModulesConnections.map(c => c.explanation).filter(Boolean) + ); + const explanations = Array.from(importingExplanations).sort(); + return `Module ${module.readableIdentifier( + requestShortener + )} is referenced ${ + explanations.length > 0 + ? `by: ${explanations.join(", ")}` + : "in an unsupported way" + }`; + }; + statistics.incorrectDependency++; + failureCache.set(module, problem); // cache failures for performance + return problem; + } + } -module.exports = FileMiddleware; + /** @type {Map} */ + const incomingConnectionsFromModules = new Map(); + for (const [originModule, connections] of incomingConnections) { + if (originModule) { + // Ignore connection from orphan modules + if (chunkGraph.getNumberOfModuleChunks(originModule) === 0) continue; + // We don't care for connections from other runtimes + let originRuntime = undefined; + for (const r of chunkGraph.getModuleRuntimes(originModule)) { + originRuntime = mergeRuntimeOwned(originRuntime, r); + } -/***/ }), + if (!intersectRuntime(runtime, originRuntime)) continue; -/***/ 86791: -/***/ (function(module) { + // We are not interested in inactive connections + const activeConnections = connections.filter(connection => + connection.isActive(runtime) + ); + if (activeConnections.length > 0) + incomingConnectionsFromModules.set(originModule, activeConnections); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + const incomingModules = Array.from(incomingConnectionsFromModules.keys()); + // Module must be in the same chunks like the referencing module + const otherChunkModules = incomingModules.filter(originModule => { + for (const chunk of chunkGraph.getModuleChunksIterable( + config.rootModule + )) { + if (!chunkGraph.isModuleInChunk(originModule, chunk)) { + return true; + } + } + return false; + }); + if (otherChunkModules.length > 0) { + const problem = requestShortener => { + const names = otherChunkModules + .map(m => m.readableIdentifier(requestShortener)) + .sort(); + return `Module ${module.readableIdentifier( + requestShortener + )} is referenced from different chunks by these modules: ${names.join( + ", " + )}`; + }; + statistics.incorrectChunksOfImporter++; + failureCache.set(module, problem); // cache failures for performance + return problem; + } + /** @type {Map} */ + const nonHarmonyConnections = new Map(); + for (const [originModule, connections] of incomingConnectionsFromModules) { + const selected = connections.filter( + connection => + !connection.dependency || + !(connection.dependency instanceof HarmonyImportDependency) + ); + if (selected.length > 0) + nonHarmonyConnections.set(originModule, connections); + } + if (nonHarmonyConnections.size > 0) { + const problem = requestShortener => { + const names = Array.from(nonHarmonyConnections) + .map(([originModule, connections]) => { + return `${originModule.readableIdentifier( + requestShortener + )} (referenced with ${Array.from( + new Set( + connections + .map(c => c.dependency && c.dependency.type) + .filter(Boolean) + ) + ) + .sort() + .join(", ")})`; + }) + .sort(); + return `Module ${module.readableIdentifier( + requestShortener + )} is referenced from these modules with unsupported syntax: ${names.join( + ", " + )}`; + }; + statistics.incorrectModuleDependency++; + failureCache.set(module, problem); // cache failures for performance + return problem; + } -class MapObjectSerializer { - serialize(obj, { write }) { - write(obj.size); - for (const key of obj.keys()) { - write(key); + if (runtime !== undefined && typeof runtime !== "string") { + // Module must be consistently referenced in the same runtimes + /** @type {{ originModule: Module, runtimeCondition: RuntimeSpec }[]} */ + const otherRuntimeConnections = []; + outer: for (const [ + originModule, + connections + ] of incomingConnectionsFromModules) { + /** @type {false | RuntimeSpec} */ + let currentRuntimeCondition = false; + for (const connection of connections) { + const runtimeCondition = filterRuntime(runtime, runtime => { + return connection.isTargetActive(runtime); + }); + if (runtimeCondition === false) continue; + if (runtimeCondition === true) continue outer; + if (currentRuntimeCondition !== false) { + currentRuntimeCondition = mergeRuntime( + currentRuntimeCondition, + runtimeCondition + ); + } else { + currentRuntimeCondition = runtimeCondition; + } + } + if (currentRuntimeCondition !== false) { + otherRuntimeConnections.push({ + originModule, + runtimeCondition: currentRuntimeCondition + }); + } + } + if (otherRuntimeConnections.length > 0) { + const problem = requestShortener => { + return `Module ${module.readableIdentifier( + requestShortener + )} is runtime-dependent referenced by these modules: ${Array.from( + otherRuntimeConnections, + ({ originModule, runtimeCondition }) => + `${originModule.readableIdentifier( + requestShortener + )} (expected runtime ${runtimeToString( + runtime + )}, module is only referenced in ${runtimeToString( + /** @type {RuntimeSpec} */ (runtimeCondition) + )})` + ).join(", ")}`; + }; + statistics.incorrectRuntimeCondition++; + failureCache.set(module, problem); // cache failures for performance + return problem; + } } - for (const value of obj.values()) { - write(value); + + let backup; + if (avoidMutateOnFailure) { + backup = config.snapshot(); } - } - deserialize({ read }) { - let size = read(); - const map = new Map(); - const keys = []; - for (let i = 0; i < size; i++) { - keys.push(read()); + + // Add the module + config.add(module); + + incomingModules.sort(compareModulesByIdentifier); + + // Every module which depends on the added module must be in the configuration too. + for (const originModule of incomingModules) { + const problem = this._tryToAdd( + compilation, + config, + originModule, + runtime, + activeRuntime, + possibleModules, + candidates, + failureCache, + chunkGraph, + false, + statistics + ); + if (problem) { + if (backup !== undefined) config.rollback(backup); + statistics.importerFailed++; + failureCache.set(module, problem); // cache failures for performance + return problem; + } } - for (let i = 0; i < size; i++) { - map.set(keys[i], read()); + + // Add imports to possible candidates list + for (const imp of this._getImports(compilation, module, runtime)) { + candidates.add(imp); } - return map; + statistics.added++; + return null; } } -module.exports = MapObjectSerializer; +class ConcatConfiguration { + /** + * @param {Module} rootModule the root module + * @param {RuntimeSpec} runtime the runtime + */ + constructor(rootModule, runtime) { + this.rootModule = rootModule; + this.runtime = runtime; + /** @type {Set} */ + this.modules = new Set(); + this.modules.add(rootModule); + /** @type {Map} */ + this.warnings = new Map(); + } + add(module) { + this.modules.add(module); + } -/***/ }), + has(module) { + return this.modules.has(module); + } -/***/ 21048: -/***/ (function(module) { + isEmpty() { + return this.modules.size === 1; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + addWarning(module, problem) { + this.warnings.set(module, problem); + } + getWarningsSorted() { + return new Map( + Array.from(this.warnings).sort((a, b) => { + const ai = a[0].identifier(); + const bi = b[0].identifier(); + if (ai < bi) return -1; + if (ai > bi) return 1; + return 0; + }) + ); + } + /** + * @returns {Set} modules as set + */ + getModules() { + return this.modules; + } -class NullPrototypeObjectSerializer { - serialize(obj, { write }) { - const keys = Object.keys(obj); - for (const key of keys) { - write(key); - } - write(null); - for (const key of keys) { - write(obj[key]); - } + snapshot() { + return this.modules.size; } - deserialize({ read }) { - const obj = Object.create(null); - const keys = []; - let key = read(); - while (key !== null) { - keys.push(key); - key = read(); - } - for (const key of keys) { - obj[key] = read(); + + rollback(snapshot) { + const modules = this.modules; + for (const m of modules) { + if (snapshot === 0) { + modules.delete(m); + } else { + snapshot--; + } } - return obj; } } -module.exports = NullPrototypeObjectSerializer; +module.exports = ModuleConcatenationPlugin; /***/ }), -/***/ 34795: -/***/ (function(module, exports, __webpack_require__) { +/***/ 46043: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ +const { SyncBailHook } = __webpack_require__(41242); +const { RawSource, CachedSource, CompatSource } = __webpack_require__(51255); +const Compilation = __webpack_require__(85720); +const WebpackError = __webpack_require__(53799); +const { compareSelect, compareStrings } = __webpack_require__(29579); const createHash = __webpack_require__(49835); -const ArraySerializer = __webpack_require__(41721); -const DateObjectSerializer = __webpack_require__(93475); -const ErrorObjectSerializer = __webpack_require__(79479); -const MapObjectSerializer = __webpack_require__(86791); -const NullPrototypeObjectSerializer = __webpack_require__(21048); -const PlainObjectSerializer = __webpack_require__(33040); -const RegExpObjectSerializer = __webpack_require__(57328); -const SerializerMiddleware = __webpack_require__(83137); -const SetObjectSerializer = __webpack_require__(79240); -/** @typedef {typeof import("../util/Hash")} Hash */ -/** @typedef {import("./types").ComplexSerializableType} ComplexSerializableType */ -/** @typedef {import("./types").PrimitiveSerializableType} PrimitiveSerializableType */ - -/** @typedef {new (...params: any[]) => any} Constructor */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("../Compiler")} Compiler */ -/* +const EMPTY_SET = new Set(); -Format: +const addToList = (itemOrItems, list) => { + if (Array.isArray(itemOrItems)) { + for (const item of itemOrItems) { + list.add(item); + } + } else if (itemOrItems) { + list.add(itemOrItems); + } +}; -File -> Section* -Section -> ObjectSection | ReferenceSection | EscapeSection | OtherSection +/** + * @template T + * @param {T[]} input list + * @param {function(T): Buffer} fn map function + * @returns {Buffer[]} buffers without duplicates + */ +const mapAndDeduplicateBuffers = (input, fn) => { + // Buffer.equals compares size first so this should be efficient enough + // If it becomes a performance problem we can use a map and group by size + // instead of looping over all assets. + const result = []; + outer: for (const value of input) { + const buf = fn(value); + for (const other of result) { + if (buf.equals(other)) continue outer; + } + result.push(buf); + } + return result; +}; -ObjectSection -> ESCAPE ( - number:relativeOffset (number > 0) | - string:request (string|null):export -) Section:value* ESCAPE ESCAPE_END_OBJECT -ReferenceSection -> ESCAPE number:relativeOffset (number < 0) -EscapeSection -> ESCAPE ESCAPE_ESCAPE_VALUE (escaped value ESCAPE) -EscapeSection -> ESCAPE ESCAPE_UNDEFINED (escaped value ESCAPE) -OtherSection -> any (except ESCAPE) +/** + * Escapes regular expression metacharacters + * @param {string} str String to quote + * @returns {string} Escaped string + */ +const quoteMeta = str => { + return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); +}; -Why using null as escape value? -Multiple null values can merged by the BinaryMiddleware, which makes it very efficient -Technically any value can be used. +const cachedSourceMap = new WeakMap(); -*/ +const toCachedSource = source => { + if (source instanceof CachedSource) { + return source; + } + const entry = cachedSourceMap.get(source); + if (entry !== undefined) return entry; + const newSource = new CachedSource(CompatSource.from(source)); + cachedSourceMap.set(source, newSource); + return newSource; +}; /** - * @typedef {Object} ObjectSerializerContext - * @property {function(any): void} write + * @typedef {Object} AssetInfoForRealContentHash + * @property {string} name + * @property {AssetInfo} info + * @property {Source} source + * @property {RawSource | undefined} newSource + * @property {RawSource | undefined} newSourceWithoutOwn + * @property {string} content + * @property {Set} ownHashes + * @property {Promise} contentComputePromise + * @property {Promise} contentComputeWithoutOwnPromise + * @property {Set} referencedHashes + * @property {Set} hashes */ /** - * @typedef {Object} ObjectDeserializerContext - * @property {function(): any} read + * @typedef {Object} CompilationHooks + * @property {SyncBailHook<[Buffer[], string], string>} updateHash */ -/** - * @typedef {Object} ObjectSerializer - * @property {function(any, ObjectSerializerContext): void} serialize - * @property {function(ObjectDeserializerContext): any} deserialize - */ +/** @type {WeakMap} */ +const compilationHooksMap = new WeakMap(); -const setSetSize = (set, size) => { - let i = 0; - for (const item of set) { - if (i++ >= size) { - set.delete(item); +class RealContentHashPlugin { + /** + * @param {Compilation} compilation the compilation + * @returns {CompilationHooks} the attached hooks + */ + static getCompilationHooks(compilation) { + if (!(compilation instanceof Compilation)) { + throw new TypeError( + "The 'compilation' argument must be an instance of Compilation" + ); + } + let hooks = compilationHooksMap.get(compilation); + if (hooks === undefined) { + hooks = { + updateHash: new SyncBailHook(["content", "oldHash"]) + }; + compilationHooksMap.set(compilation, hooks); } + return hooks; } -}; -const setMapSize = (map, size) => { - let i = 0; - for (const item of map.keys()) { - if (i++ >= size) { - map.delete(item); - } + constructor({ hashFunction, hashDigest }) { + this._hashFunction = hashFunction; + this._hashDigest = hashDigest; } -}; -/** - * @param {Buffer} buffer buffer - * @param {string | Hash} hashFunction hash function to use - * @returns {string} hash - */ -const toHash = (buffer, hashFunction) => { - const hash = createHash(hashFunction); - hash.update(buffer); - return /** @type {string} */ (hash.digest("latin1")); -}; + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap("RealContentHashPlugin", compilation => { + const cacheAnalyse = compilation.getCache( + "RealContentHashPlugin|analyse" + ); + const cacheGenerate = compilation.getCache( + "RealContentHashPlugin|generate" + ); + const hooks = RealContentHashPlugin.getCompilationHooks(compilation); + compilation.hooks.processAssets.tapPromise( + { + name: "RealContentHashPlugin", + stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH + }, + async () => { + const assets = compilation.getAssets(); + /** @type {AssetInfoForRealContentHash[]} */ + const assetsWithInfo = []; + const hashToAssets = new Map(); + for (const { source, info, name } of assets) { + const cachedSource = toCachedSource(source); + const content = cachedSource.source(); + /** @type {Set} */ + const hashes = new Set(); + addToList(info.contenthash, hashes); + const data = { + name, + info, + source: cachedSource, + /** @type {RawSource | undefined} */ + newSource: undefined, + /** @type {RawSource | undefined} */ + newSourceWithoutOwn: undefined, + content, + /** @type {Set} */ + ownHashes: undefined, + contentComputePromise: undefined, + contentComputeWithoutOwnPromise: undefined, + /** @type {Set} */ + referencedHashes: undefined, + hashes + }; + assetsWithInfo.push(data); + for (const hash of hashes) { + const list = hashToAssets.get(hash); + if (list === undefined) { + hashToAssets.set(hash, [data]); + } else { + list.push(data); + } + } + } + if (hashToAssets.size === 0) return; + const hashRegExp = new RegExp( + Array.from(hashToAssets.keys(), quoteMeta).join("|"), + "g" + ); + await Promise.all( + assetsWithInfo.map(async asset => { + const { name, source, content, hashes } = asset; + if (Buffer.isBuffer(content)) { + asset.referencedHashes = EMPTY_SET; + asset.ownHashes = EMPTY_SET; + return; + } + const etag = cacheAnalyse.mergeEtags( + cacheAnalyse.getLazyHashedEtag(source), + Array.from(hashes).join("|") + ); + [asset.referencedHashes, asset.ownHashes] = + await cacheAnalyse.providePromise(name, etag, () => { + const referencedHashes = new Set(); + let ownHashes = new Set(); + const inContent = content.match(hashRegExp); + if (inContent) { + for (const hash of inContent) { + if (hashes.has(hash)) { + ownHashes.add(hash); + continue; + } + referencedHashes.add(hash); + } + } + return [referencedHashes, ownHashes]; + }); + }) + ); + const getDependencies = hash => { + const assets = hashToAssets.get(hash); + if (!assets) { + const referencingAssets = assetsWithInfo.filter(asset => + asset.referencedHashes.has(hash) + ); + const err = new WebpackError(`RealContentHashPlugin +Some kind of unexpected caching problem occurred. +An asset was cached with a reference to another asset (${hash}) that's not in the compilation anymore. +Either the asset was incorrectly cached, or the referenced asset should also be restored from cache. +Referenced by: +${referencingAssets + .map(a => { + const match = new RegExp(`.{0,20}${quoteMeta(hash)}.{0,20}`).exec( + a.content + ); + return ` - ${a.name}: ...${match ? match[0] : "???"}...`; + }) + .join("\n")}`); + compilation.errors.push(err); + return undefined; + } + const hashes = new Set(); + for (const { referencedHashes, ownHashes } of assets) { + if (!ownHashes.has(hash)) { + for (const hash of ownHashes) { + hashes.add(hash); + } + } + for (const hash of referencedHashes) { + hashes.add(hash); + } + } + return hashes; + }; + const hashInfo = hash => { + const assets = hashToAssets.get(hash); + return `${hash} (${Array.from(assets, a => a.name)})`; + }; + const hashesInOrder = new Set(); + for (const hash of hashToAssets.keys()) { + const add = (hash, stack) => { + const deps = getDependencies(hash); + if (!deps) return; + stack.add(hash); + for (const dep of deps) { + if (hashesInOrder.has(dep)) continue; + if (stack.has(dep)) { + throw new Error( + `Circular hash dependency ${Array.from( + stack, + hashInfo + ).join(" -> ")} -> ${hashInfo(dep)}` + ); + } + add(dep, stack); + } + hashesInOrder.add(hash); + stack.delete(hash); + }; + if (hashesInOrder.has(hash)) continue; + add(hash, new Set()); + } + const hashToNewHash = new Map(); + const getEtag = asset => + cacheGenerate.mergeEtags( + cacheGenerate.getLazyHashedEtag(asset.source), + Array.from(asset.referencedHashes, hash => + hashToNewHash.get(hash) + ).join("|") + ); + const computeNewContent = asset => { + if (asset.contentComputePromise) return asset.contentComputePromise; + return (asset.contentComputePromise = (async () => { + if ( + asset.ownHashes.size > 0 || + Array.from(asset.referencedHashes).some( + hash => hashToNewHash.get(hash) !== hash + ) + ) { + const identifier = asset.name; + const etag = getEtag(asset); + asset.newSource = await cacheGenerate.providePromise( + identifier, + etag, + () => { + const newContent = asset.content.replace(hashRegExp, hash => + hashToNewHash.get(hash) + ); + return new RawSource(newContent); + } + ); + } + })()); + }; + const computeNewContentWithoutOwn = asset => { + if (asset.contentComputeWithoutOwnPromise) + return asset.contentComputeWithoutOwnPromise; + return (asset.contentComputeWithoutOwnPromise = (async () => { + if ( + asset.ownHashes.size > 0 || + Array.from(asset.referencedHashes).some( + hash => hashToNewHash.get(hash) !== hash + ) + ) { + const identifier = asset.name + "|without-own"; + const etag = getEtag(asset); + asset.newSourceWithoutOwn = await cacheGenerate.providePromise( + identifier, + etag, + () => { + const newContent = asset.content.replace( + hashRegExp, + hash => { + if (asset.ownHashes.has(hash)) { + return ""; + } + return hashToNewHash.get(hash); + } + ); + return new RawSource(newContent); + } + ); + } + })()); + }; + const comparator = compareSelect(a => a.name, compareStrings); + for (const oldHash of hashesInOrder) { + const assets = hashToAssets.get(oldHash); + assets.sort(comparator); + const hash = createHash(this._hashFunction); + await Promise.all( + assets.map(asset => + asset.ownHashes.has(oldHash) + ? computeNewContentWithoutOwn(asset) + : computeNewContent(asset) + ) + ); + const assetsContent = mapAndDeduplicateBuffers(assets, asset => { + if (asset.ownHashes.has(oldHash)) { + return asset.newSourceWithoutOwn + ? asset.newSourceWithoutOwn.buffer() + : asset.source.buffer(); + } else { + return asset.newSource + ? asset.newSource.buffer() + : asset.source.buffer(); + } + }); + let newHash = hooks.updateHash.call(assetsContent, oldHash); + if (!newHash) { + for (const content of assetsContent) { + hash.update(content); + } + const digest = hash.digest(this._hashDigest); + newHash = /** @type {string} */ (digest.slice(0, oldHash.length)); + } + hashToNewHash.set(oldHash, newHash); + } + await Promise.all( + assetsWithInfo.map(async asset => { + await computeNewContent(asset); + const newName = asset.name.replace(hashRegExp, hash => + hashToNewHash.get(hash) + ); + + const infoUpdate = {}; + const hash = asset.info.contenthash; + infoUpdate.contenthash = Array.isArray(hash) + ? hash.map(hash => hashToNewHash.get(hash)) + : hashToNewHash.get(hash); -const ESCAPE = null; -const ESCAPE_ESCAPE_VALUE = null; -const ESCAPE_END_OBJECT = true; -const ESCAPE_UNDEFINED = false; + if (asset.newSource !== undefined) { + compilation.updateAsset( + asset.name, + asset.newSource, + infoUpdate + ); + } else { + compilation.updateAsset(asset.name, asset.source, infoUpdate); + } -const CURRENT_VERSION = 2; + if (asset.name !== newName) { + compilation.renameAsset(asset.name, newName); + } + }) + ); + } + ); + }); + } +} -const serializers = new Map(); -const serializerInversed = new Map(); +module.exports = RealContentHashPlugin; -const loadedRequests = new Set(); -const NOT_SERIALIZABLE = {}; +/***/ }), -const jsTypes = new Map(); -jsTypes.set(Object, new PlainObjectSerializer()); -jsTypes.set(Array, new ArraySerializer()); -jsTypes.set(null, new NullPrototypeObjectSerializer()); -jsTypes.set(Map, new MapObjectSerializer()); -jsTypes.set(Set, new SetObjectSerializer()); -jsTypes.set(Date, new DateObjectSerializer()); -jsTypes.set(RegExp, new RegExpObjectSerializer()); -jsTypes.set(Error, new ErrorObjectSerializer(Error)); -jsTypes.set(EvalError, new ErrorObjectSerializer(EvalError)); -jsTypes.set(RangeError, new ErrorObjectSerializer(RangeError)); -jsTypes.set(ReferenceError, new ErrorObjectSerializer(ReferenceError)); -jsTypes.set(SyntaxError, new ErrorObjectSerializer(SyntaxError)); -jsTypes.set(TypeError, new ErrorObjectSerializer(TypeError)); +/***/ 84760: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -// If in a sandboxed environment (e. g. jest), this escapes the sandbox and registers -// real Object and Array types to. These types may occur in the wild too, e. g. when -// using Structured Clone in postMessage. -if (exports.constructor !== Object) { - const Obj = /** @type {typeof Object} */ (exports.constructor); - const Fn = /** @type {typeof Function} */ (Obj.constructor); - for (const [type, config] of Array.from(jsTypes)) { - if (type) { - const Type = new Fn(`return ${type.name};`)(); - jsTypes.set(Type, config); - } - } -} +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -{ - let i = 1; - for (const [type, serializer] of jsTypes) { - serializers.set(type, { - request: "", - name: i++, - serializer - }); - } -} -for (const { request, name, serializer } of serializers.values()) { - serializerInversed.set(`${request}/${name}`, serializer); -} -/** @type {Map boolean>} */ -const loaders = new Map(); +const { STAGE_BASIC, STAGE_ADVANCED } = __webpack_require__(80057); -/** - * @typedef {ComplexSerializableType[]} DeserializedType - * @typedef {PrimitiveSerializableType[]} SerializedType - * @extends {SerializerMiddleware} - */ -class ObjectMiddleware extends SerializerMiddleware { - /** - * @param {function(any): void} extendContext context extensions - * @param {string | Hash} hashFunction hash function to use - */ - constructor(extendContext, hashFunction = "md4") { - super(); - this.extendContext = extendContext; - this._hashFunction = hashFunction; - } - /** - * @param {RegExp} regExp RegExp for which the request is tested - * @param {function(string): boolean} loader loader to load the request, returns true when successful - * @returns {void} - */ - static registerLoader(regExp, loader) { - loaders.set(regExp, loader); - } +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compiler")} Compiler */ +class RemoveEmptyChunksPlugin { /** - * @param {Constructor} Constructor the constructor - * @param {string} request the request which will be required when deserializing - * @param {string} name the name to make multiple serializer unique when sharing a request - * @param {ObjectSerializer} serializer the serializer + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - static register(Constructor, request, name, serializer) { - const key = request + "/" + name; + apply(compiler) { + compiler.hooks.compilation.tap("RemoveEmptyChunksPlugin", compilation => { + /** + * @param {Iterable} chunks the chunks array + * @returns {void} + */ + const handler = chunks => { + const chunkGraph = compilation.chunkGraph; + for (const chunk of chunks) { + if ( + chunkGraph.getNumberOfChunkModules(chunk) === 0 && + !chunk.hasRuntime() && + chunkGraph.getNumberOfEntryModules(chunk) === 0 + ) { + compilation.chunkGraph.disconnectChunk(chunk); + compilation.chunks.delete(chunk); + } + } + }; - if (serializers.has(Constructor)) { - throw new Error( - `ObjectMiddleware.register: serializer for ${Constructor.name} is already registered` + // TODO do it once + compilation.hooks.optimizeChunks.tap( + { + name: "RemoveEmptyChunksPlugin", + stage: STAGE_BASIC + }, + handler ); - } - - if (serializerInversed.has(key)) { - throw new Error( - `ObjectMiddleware.register: serializer for ${key} is already registered` + compilation.hooks.optimizeChunks.tap( + { + name: "RemoveEmptyChunksPlugin", + stage: STAGE_ADVANCED + }, + handler ); - } - - serializers.set(Constructor, { - request, - name, - serializer }); - - serializerInversed.set(key, serializer); } +} +module.exports = RemoveEmptyChunksPlugin; - /** - * @param {Constructor} Constructor the constructor - * @returns {void} - */ - static registerNotSerializable(Constructor) { - if (serializers.has(Constructor)) { - throw new Error( - `ObjectMiddleware.registerNotSerializable: serializer for ${Constructor.name} is already registered` - ); - } - - serializers.set(Constructor, NOT_SERIALIZABLE); - } - static getSerializerFor(object) { - const proto = Object.getPrototypeOf(object); - let c; - if (proto === null) { - // Object created with Object.create(null) - c = null; - } else { - c = proto.constructor; - if (!c) { - throw new Error( - "Serialization of objects with prototype without valid constructor property not possible" - ); - } - } - const config = serializers.get(c); +/***/ }), - if (!config) throw new Error(`No serializer registered for ${c.name}`); - if (config === NOT_SERIALIZABLE) throw NOT_SERIALIZABLE; +/***/ 7081: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - return config; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - static getDeserializerFor(request, name) { - const key = request + "/" + name; - const serializer = serializerInversed.get(key); - if (serializer === undefined) { - throw new Error(`No deserializer registered for ${key}`); - } - return serializer; - } +const { STAGE_BASIC } = __webpack_require__(80057); +const Queue = __webpack_require__(65930); +const { intersect } = __webpack_require__(93347); - static _getDeserializerForWithoutError(request, name) { - const key = request + "/" + name; - const serializer = serializerInversed.get(key); - return serializer; - } +/** @typedef {import("../Compiler")} Compiler */ +class RemoveParentModulesPlugin { /** - * @param {DeserializedType} data data - * @param {Object} context context object - * @returns {SerializedType|Promise} serialized data + * @param {Compiler} compiler the compiler + * @returns {void} */ - serialize(data, context) { - /** @type {any[]} */ - let result = [CURRENT_VERSION]; - let currentPos = 0; - let referenceable = new Map(); - const addReferenceable = item => { - referenceable.set(item, currentPos++); - }; - let bufferDedupeMap = new Map(); - const dedupeBuffer = buf => { - const len = buf.length; - const entry = bufferDedupeMap.get(len); - if (entry === undefined) { - bufferDedupeMap.set(len, buf); - return buf; - } - if (Buffer.isBuffer(entry)) { - if (len < 32) { - if (buf.equals(entry)) { - return entry; - } - bufferDedupeMap.set(len, [entry, buf]); - return buf; - } else { - const hash = toHash(entry, this._hashFunction); - const newMap = new Map(); - newMap.set(hash, entry); - bufferDedupeMap.set(len, newMap); - const hashBuf = toHash(buf, this._hashFunction); - if (hash === hashBuf) { - return entry; + apply(compiler) { + compiler.hooks.compilation.tap("RemoveParentModulesPlugin", compilation => { + const handler = (chunks, chunkGroups) => { + const chunkGraph = compilation.chunkGraph; + const queue = new Queue(); + const availableModulesMap = new WeakMap(); + + for (const chunkGroup of compilation.entrypoints.values()) { + // initialize available modules for chunks without parents + availableModulesMap.set(chunkGroup, new Set()); + for (const child of chunkGroup.childrenIterable) { + queue.enqueue(child); } - return buf; } - } else if (Array.isArray(entry)) { - if (entry.length < 16) { - for (const item of entry) { - if (buf.equals(item)) { - return item; - } - } - entry.push(buf); - return buf; - } else { - const newMap = new Map(); - const hash = toHash(buf, this._hashFunction); - let found; - for (const item of entry) { - const itemHash = toHash(item, this._hashFunction); - newMap.set(itemHash, item); - if (found === undefined && itemHash === hash) found = item; - } - bufferDedupeMap.set(len, newMap); - if (found === undefined) { - newMap.set(hash, buf); - return buf; - } else { - return found; + for (const chunkGroup of compilation.asyncEntrypoints) { + // initialize available modules for chunks without parents + availableModulesMap.set(chunkGroup, new Set()); + for (const child of chunkGroup.childrenIterable) { + queue.enqueue(child); } } - } else { - const hash = toHash(buf, this._hashFunction); - const item = entry.get(hash); - if (item !== undefined) { - return item; - } - entry.set(hash, buf); - return buf; - } - }; - let currentPosTypeLookup = 0; - let objectTypeLookup = new Map(); - const cycleStack = new Set(); - const stackToString = item => { - const arr = Array.from(cycleStack); - arr.push(item); - return arr - .map(item => { - if (typeof item === "string") { - if (item.length > 100) { - return `String ${JSON.stringify(item.slice(0, 100)).slice( - 0, - -1 - )}..."`; - } - return `String ${JSON.stringify(item)}`; - } - try { - const { request, name } = ObjectMiddleware.getSerializerFor(item); - if (request) { - return `${request}${name ? `.${name}` : ""}`; - } - } catch (e) { - // ignore -> fallback - } - if (typeof item === "object" && item !== null) { - if (item.constructor) { - if (item.constructor === Object) - return `Object { ${Object.keys(item).join(", ")} }`; - if (item.constructor === Map) return `Map { ${item.size} items }`; - if (item.constructor === Array) - return `Array { ${item.length} items }`; - if (item.constructor === Set) return `Set { ${item.size} items }`; - if (item.constructor === RegExp) return item.toString(); - return `${item.constructor.name}`; + + while (queue.length > 0) { + const chunkGroup = queue.dequeue(); + let availableModules = availableModulesMap.get(chunkGroup); + let changed = false; + for (const parent of chunkGroup.parentsIterable) { + const availableModulesInParent = availableModulesMap.get(parent); + if (availableModulesInParent !== undefined) { + // If we know the available modules in parent: process these + if (availableModules === undefined) { + // if we have not own info yet: create new entry + availableModules = new Set(availableModulesInParent); + for (const chunk of parent.chunks) { + for (const m of chunkGraph.getChunkModulesIterable(chunk)) { + availableModules.add(m); + } + } + availableModulesMap.set(chunkGroup, availableModules); + changed = true; + } else { + for (const m of availableModules) { + if ( + !chunkGraph.isModuleInChunkGroup(m, parent) && + !availableModulesInParent.has(m) + ) { + availableModules.delete(m); + changed = true; + } + } + } } - return `Object [null prototype] { ${Object.keys(item).join( - ", " - )} }`; - } - try { - return `${item}`; - } catch (e) { - return `(${e.message})`; } - }) - .join(" -> "); - }; - let hasDebugInfoAttached; - let ctx = { - write(value, key) { - try { - process(value); - } catch (e) { - if (e !== NOT_SERIALIZABLE) { - if (hasDebugInfoAttached === undefined) - hasDebugInfoAttached = new WeakSet(); - if (!hasDebugInfoAttached.has(e)) { - e.message += `\nwhile serializing ${stackToString(value)}`; - hasDebugInfoAttached.add(e); + if (changed) { + // if something changed: enqueue our children + for (const child of chunkGroup.childrenIterable) { + queue.enqueue(child); } } - throw e; - } - }, - setCircularReference(ref) { - addReferenceable(ref); - }, - snapshot() { - return { - length: result.length, - cycleStackSize: cycleStack.size, - referenceableSize: referenceable.size, - currentPos, - objectTypeLookupSize: objectTypeLookup.size, - currentPosTypeLookup - }; - }, - rollback(snapshot) { - result.length = snapshot.length; - setSetSize(cycleStack, snapshot.cycleStackSize); - setMapSize(referenceable, snapshot.referenceableSize); - currentPos = snapshot.currentPos; - setMapSize(objectTypeLookup, snapshot.objectTypeLookupSize); - currentPosTypeLookup = snapshot.currentPosTypeLookup; - }, - ...context - }; - this.extendContext(ctx); - const process = item => { - if (Buffer.isBuffer(item)) { - // check if we can emit a reference - const ref = referenceable.get(item); - if (ref !== undefined) { - result.push(ESCAPE, ref - currentPos); - return; - } - const alreadyUsedBuffer = dedupeBuffer(item); - if (alreadyUsedBuffer !== item) { - const ref = referenceable.get(alreadyUsedBuffer); - if (ref !== undefined) { - referenceable.set(item, ref); - result.push(ESCAPE, ref - currentPos); - return; - } - item = alreadyUsedBuffer; } - addReferenceable(item); - result.push(item); - } else if (item === ESCAPE) { - result.push(ESCAPE, ESCAPE_ESCAPE_VALUE); - } else if ( - typeof item === "object" - // We don't have to check for null as ESCAPE is null and this has been checked before - ) { - // check if we can emit a reference - const ref = referenceable.get(item); - if (ref !== undefined) { - result.push(ESCAPE, ref - currentPos); - return; + // now we have available modules for every chunk + for (const chunk of chunks) { + const availableModulesSets = Array.from( + chunk.groupsIterable, + chunkGroup => availableModulesMap.get(chunkGroup) + ); + if (availableModulesSets.some(s => s === undefined)) continue; // No info about this chunk group + const availableModules = + availableModulesSets.length === 1 + ? availableModulesSets[0] + : intersect(availableModulesSets); + const numberOfModules = chunkGraph.getNumberOfChunkModules(chunk); + const toRemove = new Set(); + if (numberOfModules < availableModules.size) { + for (const m of chunkGraph.getChunkModulesIterable(chunk)) { + if (availableModules.has(m)) { + toRemove.add(m); + } + } + } else { + for (const m of availableModules) { + if (chunkGraph.isModuleInChunk(m, chunk)) { + toRemove.add(m); + } + } + } + for (const module of toRemove) { + chunkGraph.disconnectChunkAndModule(chunk, module); + } } + }; + compilation.hooks.optimizeChunks.tap( + { + name: "RemoveParentModulesPlugin", + stage: STAGE_BASIC + }, + handler + ); + }); + } +} +module.exports = RemoveParentModulesPlugin; - if (cycleStack.has(item)) { - throw new Error( - `This is a circular references. To serialize circular references use 'setCircularReference' somewhere in the circle during serialize and deserialize.` - ); - } - const { request, name, serializer } = - ObjectMiddleware.getSerializerFor(item); - const key = `${request}/${name}`; - const lastIndex = objectTypeLookup.get(key); +/***/ }), - if (lastIndex === undefined) { - objectTypeLookup.set(key, currentPosTypeLookup++); +/***/ 2837: +/***/ (function(module) { - result.push(ESCAPE, request, name); - } else { - result.push(ESCAPE, currentPosTypeLookup - lastIndex); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - cycleStack.add(item); - try { - serializer.serialize(item, ctx); - } finally { - cycleStack.delete(item); - } - result.push(ESCAPE, ESCAPE_END_OBJECT); +/** @typedef {import("../Compiler")} Compiler */ - addReferenceable(item); - } else if (typeof item === "string") { - if (item.length > 1) { - // short strings are shorter when not emitting a reference (this saves 1 byte per empty string) - // check if we can emit a reference - const ref = referenceable.get(item); - if (ref !== undefined) { - result.push(ESCAPE, ref - currentPos); - return; +class RuntimeChunkPlugin { + constructor(options) { + this.options = { + name: entrypoint => `runtime~${entrypoint.name}`, + ...options + }; + } + + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.thisCompilation.tap("RuntimeChunkPlugin", compilation => { + compilation.hooks.addEntry.tap( + "RuntimeChunkPlugin", + (_, { name: entryName }) => { + if (entryName === undefined) return; + const data = compilation.entries.get(entryName); + if (data.options.runtime === undefined && !data.options.dependOn) { + // Determine runtime chunk name + let name = this.options.name; + if (typeof name === "function") { + name = name({ name: entryName }); + } + data.options.runtime = name; } - addReferenceable(item); } + ); + }); + } +} - if (item.length > 102400 && context.logger) { - context.logger.warn( - `Serializing big strings (${Math.round( - item.length / 1024 - )}kiB) impacts deserialization performance (consider using Buffer instead and decode when needed)` - ); - } +module.exports = RuntimeChunkPlugin; - result.push(item); - } else if (typeof item === "function") { - if (!SerializerMiddleware.isLazy(item)) - throw new Error("Unexpected function " + item); - /** @type {SerializedType} */ - const serializedData = - SerializerMiddleware.getLazySerializedValue(item); - if (serializedData !== undefined) { - if (typeof serializedData === "function") { - result.push(serializedData); - } else { - throw new Error("Not implemented"); - } - } else if (SerializerMiddleware.isLazy(item, this)) { - throw new Error("Not implemented"); - } else { - const data = SerializerMiddleware.serializeLazy(item, data => - this.serialize([data], context) - ); - SerializerMiddleware.setLazySerializedValue(item, data); - result.push(data); - } - } else if (item === undefined) { - result.push(ESCAPE, ESCAPE_UNDEFINED); - } else { - result.push(item); - } - }; - try { - for (const item of data) { - process(item); - } - return result; - } catch (e) { - if (e === NOT_SERIALIZABLE) return null; +/***/ }), - throw e; - } finally { - // Get rid of these references to avoid leaking memory - // This happens because the optimized code v8 generates - // is optimized for our "ctx.write" method so it will reference - // it from e. g. Dependency.prototype.serialize -(IC)-> ctx.write - data = - result = - referenceable = - bufferDedupeMap = - objectTypeLookup = - ctx = - undefined; - } - } +/***/ 84800: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {SerializedType} data data - * @param {Object} context context object - * @returns {DeserializedType|Promise} deserialized data - */ - deserialize(data, context) { - let currentDataPos = 0; - const read = () => { - if (currentDataPos >= data.length) - throw new Error("Unexpected end of stream"); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - return data[currentDataPos++]; - }; - if (read() !== CURRENT_VERSION) - throw new Error("Version mismatch, serializer changed"); - let currentPos = 0; - let referenceable = []; - const addReferenceable = item => { - referenceable.push(item); - currentPos++; - }; - let currentPosTypeLookup = 0; - let objectTypeLookup = []; - let result = []; - let ctx = { - read() { - return decodeValue(); - }, - setCircularReference(ref) { - addReferenceable(ref); - }, - ...context - }; - this.extendContext(ctx); - const decodeValue = () => { - const item = read(); +const glob2regexp = __webpack_require__(86140); +const { STAGE_DEFAULT } = __webpack_require__(80057); +const HarmonyExportImportedSpecifierDependency = __webpack_require__(67157); +const HarmonyImportSpecifierDependency = __webpack_require__(14077); +const formatLocation = __webpack_require__(16734); - if (item === ESCAPE) { - const nextItem = read(); +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ - if (nextItem === ESCAPE_ESCAPE_VALUE) { - return ESCAPE; - } else if (nextItem === ESCAPE_UNDEFINED) { - return undefined; - } else if (nextItem === ESCAPE_END_OBJECT) { - throw new Error( - `Unexpected end of object at position ${currentDataPos - 1}` - ); - } else { - const request = nextItem; - let serializer; +/** + * @typedef {Object} ExportInModule + * @property {Module} module the module + * @property {string} exportName the name of the export + * @property {boolean} checked if the export is conditional + */ - if (typeof request === "number") { - if (request < 0) { - // relative reference - return referenceable[currentPos + request]; - } - serializer = objectTypeLookup[currentPosTypeLookup - request]; - } else { - if (typeof request !== "string") { - throw new Error( - `Unexpected type (${typeof request}) of request ` + - `at position ${currentDataPos - 1}` - ); +/** + * @typedef {Object} ReexportInfo + * @property {Map} static + * @property {Map>} dynamic + */ + +/** @type {WeakMap>} */ +const globToRegexpCache = new WeakMap(); + +/** + * @param {string} glob the pattern + * @param {Map} cache the glob to RegExp cache + * @returns {RegExp} a regular expression + */ +const globToRegexp = (glob, cache) => { + const cacheEntry = cache.get(glob); + if (cacheEntry !== undefined) return cacheEntry; + if (!glob.includes("/")) { + glob = `**/${glob}`; + } + const baseRegexp = glob2regexp(glob, { globstar: true, extended: true }); + const regexpSource = baseRegexp.source; + const regexp = new RegExp("^(\\./)?" + regexpSource.slice(1)); + cache.set(glob, regexp); + return regexp; +}; + +class SideEffectsFlagPlugin { + /** + * @param {boolean} analyseSource analyse source code for side effects + */ + constructor(analyseSource = true) { + this._analyseSource = analyseSource; + } + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + let cache = globToRegexpCache.get(compiler.root); + if (cache === undefined) { + cache = new Map(); + globToRegexpCache.set(compiler.root, cache); + } + compiler.hooks.compilation.tap( + "SideEffectsFlagPlugin", + (compilation, { normalModuleFactory }) => { + const moduleGraph = compilation.moduleGraph; + normalModuleFactory.hooks.module.tap( + "SideEffectsFlagPlugin", + (module, data) => { + const resolveData = data.resourceResolveData; + if ( + resolveData && + resolveData.descriptionFileData && + resolveData.relativePath + ) { + const sideEffects = resolveData.descriptionFileData.sideEffects; + if (sideEffects !== undefined) { + if (module.factoryMeta === undefined) { + module.factoryMeta = {}; + } + const hasSideEffects = + SideEffectsFlagPlugin.moduleHasSideEffects( + resolveData.relativePath, + sideEffects, + cache + ); + module.factoryMeta.sideEffectFree = !hasSideEffects; + } } - const name = read(); - serializer = ObjectMiddleware._getDeserializerForWithoutError( - request, - name + return module; + } + ); + normalModuleFactory.hooks.module.tap( + "SideEffectsFlagPlugin", + (module, data) => { + if (typeof data.settings.sideEffects === "boolean") { + if (module.factoryMeta === undefined) { + module.factoryMeta = {}; + } + module.factoryMeta.sideEffectFree = !data.settings.sideEffects; + } + return module; + } + ); + if (this._analyseSource) { + /** + * @param {JavascriptParser} parser the parser + * @returns {void} + */ + const parserHandler = parser => { + let sideEffectsStatement; + parser.hooks.program.tap("SideEffectsFlagPlugin", () => { + sideEffectsStatement = undefined; + }); + parser.hooks.statement.tap( + { name: "SideEffectsFlagPlugin", stage: -100 }, + statement => { + if (sideEffectsStatement) return; + if (parser.scope.topLevelScope !== true) return; + switch (statement.type) { + case "ExpressionStatement": + if ( + !parser.isPure(statement.expression, statement.range[0]) + ) { + sideEffectsStatement = statement; + } + break; + case "IfStatement": + case "WhileStatement": + case "DoWhileStatement": + if (!parser.isPure(statement.test, statement.range[0])) { + sideEffectsStatement = statement; + } + // statement hook will be called for child statements too + break; + case "ForStatement": + if ( + !parser.isPure(statement.init, statement.range[0]) || + !parser.isPure( + statement.test, + statement.init + ? statement.init.range[1] + : statement.range[0] + ) || + !parser.isPure( + statement.update, + statement.test + ? statement.test.range[1] + : statement.init + ? statement.init.range[1] + : statement.range[0] + ) + ) { + sideEffectsStatement = statement; + } + // statement hook will be called for child statements too + break; + case "SwitchStatement": + if ( + !parser.isPure(statement.discriminant, statement.range[0]) + ) { + sideEffectsStatement = statement; + } + // statement hook will be called for child statements too + break; + case "VariableDeclaration": + case "ClassDeclaration": + case "FunctionDeclaration": + if (!parser.isPure(statement, statement.range[0])) { + sideEffectsStatement = statement; + } + break; + case "ExportNamedDeclaration": + case "ExportDefaultDeclaration": + if ( + !parser.isPure(statement.declaration, statement.range[0]) + ) { + sideEffectsStatement = statement; + } + break; + case "LabeledStatement": + case "BlockStatement": + // statement hook will be called for child statements too + break; + case "EmptyStatement": + break; + case "ExportAllDeclaration": + case "ImportDeclaration": + // imports will be handled by the dependencies + break; + default: + sideEffectsStatement = statement; + break; + } + } + ); + parser.hooks.finish.tap("SideEffectsFlagPlugin", () => { + if (sideEffectsStatement === undefined) { + parser.state.module.buildMeta.sideEffectFree = true; + } else { + const { loc, type } = sideEffectsStatement; + moduleGraph + .getOptimizationBailout(parser.state.module) + .push( + () => + `Statement (${type}) with side effects in source code at ${formatLocation( + loc + )}` + ); + } + }); + }; + for (const key of [ + "javascript/auto", + "javascript/esm", + "javascript/dynamic" + ]) { + normalModuleFactory.hooks.parser + .for(key) + .tap("SideEffectsFlagPlugin", parserHandler); + } + } + compilation.hooks.optimizeDependencies.tap( + { + name: "SideEffectsFlagPlugin", + stage: STAGE_DEFAULT + }, + modules => { + const logger = compilation.getLogger( + "webpack.SideEffectsFlagPlugin" ); - if (serializer === undefined) { - if (request && !loadedRequests.has(request)) { - let loaded = false; - for (const [regExp, loader] of loaders) { - if (regExp.test(request)) { - if (loader(request)) { - loaded = true; - break; + logger.time("update dependencies"); + for (const module of modules) { + if (module.getSideEffectsConnectionState(moduleGraph) === false) { + const exportsInfo = moduleGraph.getExportsInfo(module); + for (const connection of moduleGraph.getIncomingConnections( + module + )) { + const dep = connection.dependency; + let isReexport; + if ( + (isReexport = + dep instanceof + HarmonyExportImportedSpecifierDependency) || + (dep instanceof HarmonyImportSpecifierDependency && + !dep.namespaceObjectAsContext) + ) { + // TODO improve for export * + if (isReexport && dep.name) { + const exportInfo = moduleGraph.getExportInfo( + connection.originModule, + dep.name + ); + exportInfo.moveTarget( + moduleGraph, + ({ module }) => + module.getSideEffectsConnectionState(moduleGraph) === + false, + ({ module: newModule, export: exportName }) => { + moduleGraph.updateModule(dep, newModule); + moduleGraph.addExplanation( + dep, + "(skipped side-effect-free modules)" + ); + const ids = dep.getIds(moduleGraph); + dep.setIds( + moduleGraph, + exportName + ? [...exportName, ...ids.slice(1)] + : ids.slice(1) + ); + return moduleGraph.getConnection(dep); + } + ); + continue; + } + // TODO improve for nested imports + const ids = dep.getIds(moduleGraph); + if (ids.length > 0) { + const exportInfo = exportsInfo.getExportInfo(ids[0]); + const target = exportInfo.getTarget( + moduleGraph, + ({ module }) => + module.getSideEffectsConnectionState(moduleGraph) === + false + ); + if (!target) continue; + + moduleGraph.updateModule(dep, target.module); + moduleGraph.addExplanation( + dep, + "(skipped side-effect-free modules)" + ); + dep.setIds( + moduleGraph, + target.export + ? [...target.export, ...ids.slice(1)] + : ids.slice(1) + ); } } } - if (!loaded) { - require(request); - } - - loadedRequests.add(request); - } - - serializer = ObjectMiddleware.getDeserializerFor(request, name); - } - - objectTypeLookup.push(serializer); - currentPosTypeLookup++; - } - try { - const item = serializer.deserialize(ctx); - const end1 = read(); - - if (end1 !== ESCAPE) { - throw new Error("Expected end of object"); - } - - const end2 = read(); - - if (end2 !== ESCAPE_END_OBJECT) { - throw new Error("Expected end of object"); - } - - addReferenceable(item); - - return item; - } catch (err) { - // As this is only for error handling, we omit creating a Map for - // faster access to this information, as this would affect performance - // in the good case - let serializerEntry; - for (const entry of serializers) { - if (entry[1].serializer === serializer) { - serializerEntry = entry; - break; } } - const name = !serializerEntry - ? "unknown" - : !serializerEntry[1].request - ? serializerEntry[0].name - : serializerEntry[1].name - ? `${serializerEntry[1].request} ${serializerEntry[1].name}` - : serializerEntry[1].request; - err.message += `\n(during deserialization of ${name})`; - throw err; + logger.timeEnd("update dependencies"); } - } - } else if (typeof item === "string") { - if (item.length > 1) { - addReferenceable(item); - } - - return item; - } else if (Buffer.isBuffer(item)) { - addReferenceable(item); - - return item; - } else if (typeof item === "function") { - return SerializerMiddleware.deserializeLazy( - item, - data => this.deserialize(data, context)[0] ); - } else { - return item; } - }; + ); + } - try { - while (currentDataPos < data.length) { - result.push(decodeValue()); - } - return result; - } finally { - // Get rid of these references to avoid leaking memory - // This happens because the optimized code v8 generates - // is optimized for our "ctx.read" method so it will reference - // it from e. g. Dependency.prototype.deserialize -(IC)-> ctx.read - result = referenceable = data = objectTypeLookup = ctx = undefined; + static moduleHasSideEffects(moduleName, flagValue, cache) { + switch (typeof flagValue) { + case "undefined": + return true; + case "boolean": + return flagValue; + case "string": + return globToRegexp(flagValue, cache).test(moduleName); + case "object": + return flagValue.some(glob => + SideEffectsFlagPlugin.moduleHasSideEffects(moduleName, glob, cache) + ); } } } - -module.exports = ObjectMiddleware; -module.exports.NOT_SERIALIZABLE = NOT_SERIALIZABLE; +module.exports = SideEffectsFlagPlugin; /***/ }), -/***/ 33040: -/***/ (function(module) { +/***/ 21478: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const cache = new WeakMap(); +const Chunk = __webpack_require__(39385); +const { STAGE_ADVANCED } = __webpack_require__(80057); +const WebpackError = __webpack_require__(53799); +const { requestToId } = __webpack_require__(63290); +const { isSubset } = __webpack_require__(93347); +const SortableSet = __webpack_require__(13098); +const { + compareModulesByIdentifier, + compareIterables +} = __webpack_require__(29579); +const createHash = __webpack_require__(49835); +const deterministicGrouping = __webpack_require__(59836); +const { makePathsRelative } = __webpack_require__(82186); +const memoize = __webpack_require__(78676); +const MinMaxSizeWarning = __webpack_require__(85305); -class ObjectStructure { - constructor() { - this.keys = undefined; - this.children = undefined; - } +/** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksCacheGroup} OptimizationSplitChunksCacheGroup */ +/** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksGetCacheGroups} OptimizationSplitChunksGetCacheGroups */ +/** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksOptions} OptimizationSplitChunksOptions */ +/** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksSizes} OptimizationSplitChunksSizes */ +/** @typedef {import("../../declarations/WebpackOptions").Output} OutputOptions */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ +/** @typedef {import("../Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("../Compilation").PathData} PathData */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/deterministicGrouping").GroupedItems} DeterministicGroupingGroupedItemsForModule */ +/** @typedef {import("../util/deterministicGrouping").Options} DeterministicGroupingOptionsForModule */ - getKeys(keys) { - if (this.keys === undefined) this.keys = keys; - return this.keys; - } +/** @typedef {Record} SplitChunksSizes */ - key(key) { - if (this.children === undefined) this.children = new Map(); - const child = this.children.get(key); - if (child !== undefined) return child; - const newChild = new ObjectStructure(); - this.children.set(key, newChild); - return newChild; - } -} +/** + * @callback ChunkFilterFunction + * @param {Chunk} chunk + * @returns {boolean} + */ -const getCachedKeys = (keys, cacheAssoc) => { - let root = cache.get(cacheAssoc); - if (root === undefined) { - root = new ObjectStructure(); - cache.set(cacheAssoc, root); - } - let current = root; - for (const key of keys) { - current = current.key(key); - } - return current.getKeys(keys); -}; +/** + * @callback CombineSizeFunction + * @param {number} a + * @param {number} b + * @returns {number} + */ -class PlainObjectSerializer { - serialize(obj, { write }) { - const keys = Object.keys(obj); - if (keys.length > 128) { - // Objects with so many keys are unlikely to share structure - // with other objects - write(keys); - for (const key of keys) { - write(obj[key]); - } - } else if (keys.length > 1) { - write(getCachedKeys(keys, write)); - for (const key of keys) { - write(obj[key]); - } - } else if (keys.length === 1) { - const key = keys[0]; - write(key); - write(obj[key]); - } else { - write(null); - } - } - deserialize({ read }) { - const keys = read(); - const obj = {}; - if (Array.isArray(keys)) { - for (const key of keys) { - obj[key] = read(); - } - } else if (keys !== null) { - obj[keys] = read(); - } - return obj; - } -} +/** + * @typedef {Object} CacheGroupSource + * @property {string=} key + * @property {number=} priority + * @property {GetName=} getName + * @property {ChunkFilterFunction=} chunksFilter + * @property {boolean=} enforce + * @property {SplitChunksSizes} minSize + * @property {SplitChunksSizes} minSizeReduction + * @property {SplitChunksSizes} minRemainingSize + * @property {SplitChunksSizes} enforceSizeThreshold + * @property {SplitChunksSizes} maxAsyncSize + * @property {SplitChunksSizes} maxInitialSize + * @property {number=} minChunks + * @property {number=} maxAsyncRequests + * @property {number=} maxInitialRequests + * @property {(string | function(PathData, AssetInfo=): string)=} filename + * @property {string=} idHint + * @property {string} automaticNameDelimiter + * @property {boolean=} reuseExistingChunk + * @property {boolean=} usedExports + */ -module.exports = PlainObjectSerializer; +/** + * @typedef {Object} CacheGroup + * @property {string} key + * @property {number=} priority + * @property {GetName=} getName + * @property {ChunkFilterFunction=} chunksFilter + * @property {SplitChunksSizes} minSize + * @property {SplitChunksSizes} minSizeReduction + * @property {SplitChunksSizes} minRemainingSize + * @property {SplitChunksSizes} enforceSizeThreshold + * @property {SplitChunksSizes} maxAsyncSize + * @property {SplitChunksSizes} maxInitialSize + * @property {number=} minChunks + * @property {number=} maxAsyncRequests + * @property {number=} maxInitialRequests + * @property {(string | function(PathData, AssetInfo=): string)=} filename + * @property {string=} idHint + * @property {string} automaticNameDelimiter + * @property {boolean} reuseExistingChunk + * @property {boolean} usedExports + * @property {boolean} _validateSize + * @property {boolean} _validateRemainingSize + * @property {SplitChunksSizes} _minSizeForMaxSize + * @property {boolean} _conditionalEnforce + */ +/** + * @typedef {Object} FallbackCacheGroup + * @property {ChunkFilterFunction} chunksFilter + * @property {SplitChunksSizes} minSize + * @property {SplitChunksSizes} maxAsyncSize + * @property {SplitChunksSizes} maxInitialSize + * @property {string} automaticNameDelimiter + */ -/***/ }), +/** + * @typedef {Object} CacheGroupsContext + * @property {ModuleGraph} moduleGraph + * @property {ChunkGraph} chunkGraph + */ -/***/ 57328: -/***/ (function(module) { +/** + * @callback GetCacheGroups + * @param {Module} module + * @param {CacheGroupsContext} context + * @returns {CacheGroupSource[]} + */ -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ +/** + * @callback GetName + * @param {Module=} module + * @param {Chunk[]=} chunks + * @param {string=} key + * @returns {string=} + */ + +/** + * @typedef {Object} SplitChunksOptions + * @property {ChunkFilterFunction} chunksFilter + * @property {string[]} defaultSizeTypes + * @property {SplitChunksSizes} minSize + * @property {SplitChunksSizes} minSizeReduction + * @property {SplitChunksSizes} minRemainingSize + * @property {SplitChunksSizes} enforceSizeThreshold + * @property {SplitChunksSizes} maxInitialSize + * @property {SplitChunksSizes} maxAsyncSize + * @property {number} minChunks + * @property {number} maxAsyncRequests + * @property {number} maxInitialRequests + * @property {boolean} hidePathInfo + * @property {string | function(PathData, AssetInfo=): string} filename + * @property {string} automaticNameDelimiter + * @property {GetCacheGroups} getCacheGroups + * @property {GetName} getName + * @property {boolean} usedExports + * @property {FallbackCacheGroup} fallbackCacheGroup + */ +/** + * @typedef {Object} ChunksInfoItem + * @property {SortableSet} modules + * @property {CacheGroup} cacheGroup + * @property {number} cacheGroupIndex + * @property {string} name + * @property {Record} sizes + * @property {Set} chunks + * @property {Set} reuseableChunks + * @property {Set} chunksKeys + */ +const defaultGetName = /** @type {GetName} */ (() => {}); -class RegExpObjectSerializer { - serialize(obj, { write }) { - write(obj.source); - write(obj.flags); - } - deserialize({ read }) { - return new RegExp(read(), read()); +const deterministicGroupingForModules = + /** @type {function(DeterministicGroupingOptionsForModule): DeterministicGroupingGroupedItemsForModule[]} */ ( + deterministicGrouping + ); + +/** @type {WeakMap} */ +const getKeyCache = new WeakMap(); + +/** + * @param {string} name a filename to hash + * @param {OutputOptions} outputOptions hash function used + * @returns {string} hashed filename + */ +const hashFilename = (name, outputOptions) => { + const digest = /** @type {string} */ ( + createHash(outputOptions.hashFunction) + .update(name) + .digest(outputOptions.hashDigest) + ); + return digest.slice(0, 8); +}; + +/** + * @param {Chunk} chunk the chunk + * @returns {number} the number of requests + */ +const getRequests = chunk => { + let requests = 0; + for (const chunkGroup of chunk.groupsIterable) { + requests = Math.max(requests, chunkGroup.chunks.length); } -} + return requests; +}; -module.exports = RegExpObjectSerializer; +const mapObject = (obj, fn) => { + const newObj = Object.create(null); + for (const key of Object.keys(obj)) { + newObj[key] = fn(obj[key], key); + } + return newObj; +}; +/** + * @template T + * @param {Set} a set + * @param {Set} b other set + * @returns {boolean} true if at least one item of a is in b + */ +const isOverlap = (a, b) => { + for (const item of a) { + if (b.has(item)) return true; + } + return false; +}; -/***/ }), +const compareModuleIterables = compareIterables(compareModulesByIdentifier); -/***/ 53080: -/***/ (function(module) { +/** + * @param {ChunksInfoItem} a item + * @param {ChunksInfoItem} b item + * @returns {number} compare result + */ +const compareEntries = (a, b) => { + // 1. by priority + const diffPriority = a.cacheGroup.priority - b.cacheGroup.priority; + if (diffPriority) return diffPriority; + // 2. by number of chunks + const diffCount = a.chunks.size - b.chunks.size; + if (diffCount) return diffCount; + // 3. by size reduction + const aSizeReduce = totalSize(a.sizes) * (a.chunks.size - 1); + const bSizeReduce = totalSize(b.sizes) * (b.chunks.size - 1); + const diffSizeReduce = aSizeReduce - bSizeReduce; + if (diffSizeReduce) return diffSizeReduce; + // 4. by cache group index + const indexDiff = b.cacheGroupIndex - a.cacheGroupIndex; + if (indexDiff) return indexDiff; + // 5. by number of modules (to be able to compare by identifier) + const modulesA = a.modules; + const modulesB = b.modules; + const diff = modulesA.size - modulesB.size; + if (diff) return diff; + // 6. by module identifiers + modulesA.sort(); + modulesB.sort(); + return compareModuleIterables(modulesA, modulesB); +}; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ +const INITIAL_CHUNK_FILTER = chunk => chunk.canBeInitial(); +const ASYNC_CHUNK_FILTER = chunk => !chunk.canBeInitial(); +const ALL_CHUNK_FILTER = chunk => true; +/** + * @param {OptimizationSplitChunksSizes} value the sizes + * @param {string[]} defaultSizeTypes the default size types + * @returns {SplitChunksSizes} normalized representation + */ +const normalizeSizes = (value, defaultSizeTypes) => { + if (typeof value === "number") { + /** @type {Record} */ + const o = {}; + for (const sizeType of defaultSizeTypes) o[sizeType] = value; + return o; + } else if (typeof value === "object" && value !== null) { + return { ...value }; + } else { + return {}; + } +}; +/** + * @param {...SplitChunksSizes} sizes the sizes + * @returns {SplitChunksSizes} the merged sizes + */ +const mergeSizes = (...sizes) => { + /** @type {SplitChunksSizes} */ + let merged = {}; + for (let i = sizes.length - 1; i >= 0; i--) { + merged = Object.assign(merged, sizes[i]); + } + return merged; +}; -class Serializer { - constructor(middlewares, context) { - this.serializeMiddlewares = middlewares.slice(); - this.deserializeMiddlewares = middlewares.slice().reverse(); - this.context = context; +/** + * @param {SplitChunksSizes} sizes the sizes + * @returns {boolean} true, if there are sizes > 0 + */ +const hasNonZeroSizes = sizes => { + for (const key of Object.keys(sizes)) { + if (sizes[key] > 0) return true; } + return false; +}; - serialize(obj, context) { - const ctx = { ...context, ...this.context }; - let current = obj; - for (const middleware of this.serializeMiddlewares) { - if (current && typeof current.then === "function") { - current = current.then(data => data && middleware.serialize(data, ctx)); - } else if (current) { - try { - current = middleware.serialize(current, ctx); - } catch (err) { - current = Promise.reject(err); - } - } else break; +/** + * @param {SplitChunksSizes} a first sizes + * @param {SplitChunksSizes} b second sizes + * @param {CombineSizeFunction} combine a function to combine sizes + * @returns {SplitChunksSizes} the combine sizes + */ +const combineSizes = (a, b, combine) => { + const aKeys = new Set(Object.keys(a)); + const bKeys = new Set(Object.keys(b)); + /** @type {SplitChunksSizes} */ + const result = {}; + for (const key of aKeys) { + if (bKeys.has(key)) { + result[key] = combine(a[key], b[key]); + } else { + result[key] = a[key]; + } + } + for (const key of bKeys) { + if (!aKeys.has(key)) { + result[key] = b[key]; } - return current; } + return result; +}; - deserialize(value, context) { - const ctx = { ...context, ...this.context }; - /** @type {any} */ - let current = value; - for (const middleware of this.deserializeMiddlewares) { - if (current && typeof current.then === "function") { - current = current.then(data => middleware.deserialize(data, ctx)); - } else { - current = middleware.deserialize(current, ctx); - } - } - return current; +/** + * @param {SplitChunksSizes} sizes the sizes + * @param {SplitChunksSizes} minSize the min sizes + * @returns {boolean} true if there are sizes and all existing sizes are at least `minSize` + */ +const checkMinSize = (sizes, minSize) => { + for (const key of Object.keys(minSize)) { + const size = sizes[key]; + if (size === undefined || size === 0) continue; + if (size < minSize[key]) return false; } -} - -module.exports = Serializer; - - -/***/ }), - -/***/ 83137: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - - -const memoize = __webpack_require__(78676); - -const LAZY_TARGET = Symbol("lazy serialization target"); -const LAZY_SERIALIZED_VALUE = Symbol("lazy serialization data"); + return true; +}; /** - * @template DeserializedType - * @template SerializedType + * @param {SplitChunksSizes} sizes the sizes + * @param {SplitChunksSizes} minSizeReduction the min sizes + * @param {number} chunkCount number of chunks + * @returns {boolean} true if there are sizes and all existing sizes are at least `minSizeReduction` */ -class SerializerMiddleware { - /* istanbul ignore next */ - /** - * @abstract - * @param {DeserializedType} data data - * @param {Object} context context object - * @returns {SerializedType|Promise} serialized data - */ - serialize(data, context) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); +const checkMinSizeReduction = (sizes, minSizeReduction, chunkCount) => { + for (const key of Object.keys(minSizeReduction)) { + const size = sizes[key]; + if (size === undefined || size === 0) continue; + if (size * chunkCount < minSizeReduction[key]) return false; } + return true; +}; - /* istanbul ignore next */ - /** - * @abstract - * @param {SerializedType} data data - * @param {Object} context context object - * @returns {DeserializedType|Promise} deserialized data - */ - deserialize(data, context) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); +/** + * @param {SplitChunksSizes} sizes the sizes + * @param {SplitChunksSizes} minSize the min sizes + * @returns {undefined | string[]} list of size types that are below min size + */ +const getViolatingMinSizes = (sizes, minSize) => { + let list; + for (const key of Object.keys(minSize)) { + const size = sizes[key]; + if (size === undefined || size === 0) continue; + if (size < minSize[key]) { + if (list === undefined) list = [key]; + else list.push(key); + } } + return list; +}; - /** - * @param {any | function(): Promise | any} value contained value or function to value - * @param {SerializerMiddleware} target target middleware - * @param {object=} options lazy options - * @param {any=} serializedValue serialized value - * @returns {function(): Promise | any} lazy function - */ - static createLazy(value, target, options = {}, serializedValue) { - if (SerializerMiddleware.isLazy(value, target)) return value; - const fn = typeof value === "function" ? value : () => value; - fn[LAZY_TARGET] = target; - /** @type {any} */ (fn).options = options; - fn[LAZY_SERIALIZED_VALUE] = serializedValue; - return fn; +/** + * @param {SplitChunksSizes} sizes the sizes + * @returns {number} the total size + */ +const totalSize = sizes => { + let size = 0; + for (const key of Object.keys(sizes)) { + size += sizes[key]; } + return size; +}; - /** - * @param {function(): Promise | any} fn lazy function - * @param {SerializerMiddleware=} target target middleware - * @returns {boolean} true, when fn is a lazy function (optionally of that target) - */ - static isLazy(fn, target) { - if (typeof fn !== "function") return false; - const t = fn[LAZY_TARGET]; - return target ? t === target : !!t; +/** + * @param {false|string|Function} name the chunk name + * @returns {GetName} a function to get the name of the chunk + */ +const normalizeName = name => { + if (typeof name === "string") { + return () => name; } - - /** - * @param {function(): Promise | any} fn lazy function - * @returns {object} options - */ - static getLazyOptions(fn) { - if (typeof fn !== "function") return undefined; - return /** @type {any} */ (fn).options; + if (typeof name === "function") { + return /** @type {GetName} */ (name); } +}; - /** - * @param {function(): Promise | any} fn lazy function - * @returns {any} serialized value - */ - static getLazySerializedValue(fn) { - if (typeof fn !== "function") return undefined; - return fn[LAZY_SERIALIZED_VALUE]; +/** + * @param {OptimizationSplitChunksCacheGroup["chunks"]} chunks the chunk filter option + * @returns {ChunkFilterFunction} the chunk filter function + */ +const normalizeChunksFilter = chunks => { + if (chunks === "initial") { + return INITIAL_CHUNK_FILTER; } - - /** - * @param {function(): Promise | any} fn lazy function - * @param {any} value serialized value - * @returns {void} - */ - static setLazySerializedValue(fn, value) { - fn[LAZY_SERIALIZED_VALUE] = value; + if (chunks === "async") { + return ASYNC_CHUNK_FILTER; } - - /** - * @param {function(): Promise | any} lazy lazy function - * @param {function(any): Promise | any} serialize serialize function - * @returns {function(): Promise | any} new lazy - */ - static serializeLazy(lazy, serialize) { - const fn = memoize(() => { - const r = lazy(); - if (r && typeof r.then === "function") { - return r.then(data => data && serialize(data)); - } - return serialize(r); - }); - fn[LAZY_TARGET] = lazy[LAZY_TARGET]; - /** @type {any} */ (fn).options = /** @type {any} */ (lazy).options; - lazy[LAZY_SERIALIZED_VALUE] = fn; - return fn; + if (chunks === "all") { + return ALL_CHUNK_FILTER; } - - /** - * @param {function(): Promise | any} lazy lazy function - * @param {function(any): Promise | any} deserialize deserialize function - * @returns {function(): Promise | any} new lazy - */ - static deserializeLazy(lazy, deserialize) { - const fn = memoize(() => { - const r = lazy(); - if (r && typeof r.then === "function") { - return r.then(data => deserialize(data)); - } - return deserialize(r); - }); - fn[LAZY_TARGET] = lazy[LAZY_TARGET]; - /** @type {any} */ (fn).options = /** @type {any} */ (lazy).options; - fn[LAZY_SERIALIZED_VALUE] = lazy; - return fn; + if (typeof chunks === "function") { + return chunks; } +}; - /** - * @param {function(): Promise | any} lazy lazy function - * @returns {function(): Promise | any} new lazy - */ - static unMemoizeLazy(lazy) { - if (!SerializerMiddleware.isLazy(lazy)) return lazy; - const fn = () => { - throw new Error( - "A lazy value that has been unmemorized can't be called again" - ); +/** + * @param {GetCacheGroups | Record} cacheGroups the cache group options + * @param {string[]} defaultSizeTypes the default size types + * @returns {GetCacheGroups} a function to get the cache groups + */ +const normalizeCacheGroups = (cacheGroups, defaultSizeTypes) => { + if (typeof cacheGroups === "function") { + return cacheGroups; + } + if (typeof cacheGroups === "object" && cacheGroups !== null) { + /** @type {(function(Module, CacheGroupsContext, CacheGroupSource[]): void)[]} */ + const handlers = []; + for (const key of Object.keys(cacheGroups)) { + const option = cacheGroups[key]; + if (option === false) { + continue; + } + if (typeof option === "string" || option instanceof RegExp) { + const source = createCacheGroupSource({}, key, defaultSizeTypes); + handlers.push((module, context, results) => { + if (checkTest(option, module, context)) { + results.push(source); + } + }); + } else if (typeof option === "function") { + const cache = new WeakMap(); + handlers.push((module, context, results) => { + const result = option(module); + if (result) { + const groups = Array.isArray(result) ? result : [result]; + for (const group of groups) { + const cachedSource = cache.get(group); + if (cachedSource !== undefined) { + results.push(cachedSource); + } else { + const source = createCacheGroupSource( + group, + key, + defaultSizeTypes + ); + cache.set(group, source); + results.push(source); + } + } + } + }); + } else { + const source = createCacheGroupSource(option, key, defaultSizeTypes); + handlers.push((module, context, results) => { + if ( + checkTest(option.test, module, context) && + checkModuleType(option.type, module) && + checkModuleLayer(option.layer, module) + ) { + results.push(source); + } + }); + } + } + /** + * @param {Module} module the current module + * @param {CacheGroupsContext} context the current context + * @returns {CacheGroupSource[]} the matching cache groups + */ + const fn = (module, context) => { + /** @type {CacheGroupSource[]} */ + let results = []; + for (const fn of handlers) { + fn(module, context, results); + } + return results; }; - fn[LAZY_SERIALIZED_VALUE] = SerializerMiddleware.unMemoizeLazy( - lazy[LAZY_SERIALIZED_VALUE] - ); - fn[LAZY_TARGET] = lazy[LAZY_TARGET]; - fn.options = /** @type {any} */ (lazy).options; return fn; } -} - -module.exports = SerializerMiddleware; - - -/***/ }), - -/***/ 79240: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - + return () => null; +}; -class SetObjectSerializer { - serialize(obj, { write }) { - write(obj.size); - for (const value of obj) { - write(value); - } +/** + * @param {undefined|boolean|string|RegExp|Function} test test option + * @param {Module} module the module + * @param {CacheGroupsContext} context context object + * @returns {boolean} true, if the module should be selected + */ +const checkTest = (test, module, context) => { + if (test === undefined) return true; + if (typeof test === "function") { + return test(module, context); } - deserialize({ read }) { - let size = read(); - const set = new Set(); - for (let i = 0; i < size; i++) { - set.add(read()); - } - return set; + if (typeof test === "boolean") return test; + if (typeof test === "string") { + const name = module.nameForCondition(); + return name && name.startsWith(test); } -} - -module.exports = SetObjectSerializer; - + if (test instanceof RegExp) { + const name = module.nameForCondition(); + return name && test.test(name); + } + return false; +}; -/***/ }), +/** + * @param {undefined|string|RegExp|Function} test type option + * @param {Module} module the module + * @returns {boolean} true, if the module should be selected + */ +const checkModuleType = (test, module) => { + if (test === undefined) return true; + if (typeof test === "function") { + return test(module.type); + } + if (typeof test === "string") { + const type = module.type; + return test === type; + } + if (test instanceof RegExp) { + const type = module.type; + return test.test(type); + } + return false; +}; -/***/ 65112: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * @param {undefined|string|RegExp|Function} test type option + * @param {Module} module the module + * @returns {boolean} true, if the module should be selected + */ +const checkModuleLayer = (test, module) => { + if (test === undefined) return true; + if (typeof test === "function") { + return test(module.layer); + } + if (typeof test === "string") { + const layer = module.layer; + return test === "" ? !layer : layer && layer.startsWith(test); + } + if (test instanceof RegExp) { + const layer = module.layer; + return test.test(layer); + } + return false; +}; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ +/** + * @param {OptimizationSplitChunksCacheGroup} options the group options + * @param {string} key key of cache group + * @param {string[]} defaultSizeTypes the default size types + * @returns {CacheGroupSource} the normalized cached group + */ +const createCacheGroupSource = (options, key, defaultSizeTypes) => { + const minSize = normalizeSizes(options.minSize, defaultSizeTypes); + const minSizeReduction = normalizeSizes( + options.minSizeReduction, + defaultSizeTypes + ); + const maxSize = normalizeSizes(options.maxSize, defaultSizeTypes); + return { + key, + priority: options.priority, + getName: normalizeName(options.name), + chunksFilter: normalizeChunksFilter(options.chunks), + enforce: options.enforce, + minSize, + minSizeReduction, + minRemainingSize: mergeSizes( + normalizeSizes(options.minRemainingSize, defaultSizeTypes), + minSize + ), + enforceSizeThreshold: normalizeSizes( + options.enforceSizeThreshold, + defaultSizeTypes + ), + maxAsyncSize: mergeSizes( + normalizeSizes(options.maxAsyncSize, defaultSizeTypes), + maxSize + ), + maxInitialSize: mergeSizes( + normalizeSizes(options.maxInitialSize, defaultSizeTypes), + maxSize + ), + minChunks: options.minChunks, + maxAsyncRequests: options.maxAsyncRequests, + maxInitialRequests: options.maxInitialRequests, + filename: options.filename, + idHint: options.idHint, + automaticNameDelimiter: options.automaticNameDelimiter, + reuseExistingChunk: options.reuseExistingChunk, + usedExports: options.usedExports + }; +}; +module.exports = class SplitChunksPlugin { + /** + * @param {OptimizationSplitChunksOptions=} options plugin options + */ + constructor(options = {}) { + const defaultSizeTypes = options.defaultSizeTypes || [ + "javascript", + "unknown" + ]; + const fallbackCacheGroup = options.fallbackCacheGroup || {}; + const minSize = normalizeSizes(options.minSize, defaultSizeTypes); + const minSizeReduction = normalizeSizes( + options.minSizeReduction, + defaultSizeTypes + ); + const maxSize = normalizeSizes(options.maxSize, defaultSizeTypes); + /** @type {SplitChunksOptions} */ + this.options = { + chunksFilter: normalizeChunksFilter(options.chunks || "all"), + defaultSizeTypes, + minSize, + minSizeReduction, + minRemainingSize: mergeSizes( + normalizeSizes(options.minRemainingSize, defaultSizeTypes), + minSize + ), + enforceSizeThreshold: normalizeSizes( + options.enforceSizeThreshold, + defaultSizeTypes + ), + maxAsyncSize: mergeSizes( + normalizeSizes(options.maxAsyncSize, defaultSizeTypes), + maxSize + ), + maxInitialSize: mergeSizes( + normalizeSizes(options.maxInitialSize, defaultSizeTypes), + maxSize + ), + minChunks: options.minChunks || 1, + maxAsyncRequests: options.maxAsyncRequests || 1, + maxInitialRequests: options.maxInitialRequests || 1, + hidePathInfo: options.hidePathInfo || false, + filename: options.filename || undefined, + getCacheGroups: normalizeCacheGroups( + options.cacheGroups, + defaultSizeTypes + ), + getName: options.name ? normalizeName(options.name) : defaultGetName, + automaticNameDelimiter: options.automaticNameDelimiter, + usedExports: options.usedExports, + fallbackCacheGroup: { + chunksFilter: normalizeChunksFilter( + fallbackCacheGroup.chunks || options.chunks || "all" + ), + minSize: mergeSizes( + normalizeSizes(fallbackCacheGroup.minSize, defaultSizeTypes), + minSize + ), + maxAsyncSize: mergeSizes( + normalizeSizes(fallbackCacheGroup.maxAsyncSize, defaultSizeTypes), + normalizeSizes(fallbackCacheGroup.maxSize, defaultSizeTypes), + normalizeSizes(options.maxAsyncSize, defaultSizeTypes), + normalizeSizes(options.maxSize, defaultSizeTypes) + ), + maxInitialSize: mergeSizes( + normalizeSizes(fallbackCacheGroup.maxInitialSize, defaultSizeTypes), + normalizeSizes(fallbackCacheGroup.maxSize, defaultSizeTypes), + normalizeSizes(options.maxInitialSize, defaultSizeTypes), + normalizeSizes(options.maxSize, defaultSizeTypes) + ), + automaticNameDelimiter: + fallbackCacheGroup.automaticNameDelimiter || + options.automaticNameDelimiter || + "~" + } + }; -const SerializerMiddleware = __webpack_require__(83137); + /** @type {WeakMap} */ + this._cacheGroupCache = new WeakMap(); + } -/** - * @typedef {any} DeserializedType - * @typedef {any[]} SerializedType - * @extends {SerializerMiddleware} - */ -class SingleItemMiddleware extends SerializerMiddleware { /** - * @param {DeserializedType} data data - * @param {Object} context context object - * @returns {SerializedType|Promise} serialized data + * @param {CacheGroupSource} cacheGroupSource source + * @returns {CacheGroup} the cache group (cached) */ - serialize(data, context) { - return [data]; + _getCacheGroup(cacheGroupSource) { + const cacheEntry = this._cacheGroupCache.get(cacheGroupSource); + if (cacheEntry !== undefined) return cacheEntry; + const minSize = mergeSizes( + cacheGroupSource.minSize, + cacheGroupSource.enforce ? undefined : this.options.minSize + ); + const minSizeReduction = mergeSizes( + cacheGroupSource.minSizeReduction, + cacheGroupSource.enforce ? undefined : this.options.minSizeReduction + ); + const minRemainingSize = mergeSizes( + cacheGroupSource.minRemainingSize, + cacheGroupSource.enforce ? undefined : this.options.minRemainingSize + ); + const enforceSizeThreshold = mergeSizes( + cacheGroupSource.enforceSizeThreshold, + cacheGroupSource.enforce ? undefined : this.options.enforceSizeThreshold + ); + const cacheGroup = { + key: cacheGroupSource.key, + priority: cacheGroupSource.priority || 0, + chunksFilter: cacheGroupSource.chunksFilter || this.options.chunksFilter, + minSize, + minSizeReduction, + minRemainingSize, + enforceSizeThreshold, + maxAsyncSize: mergeSizes( + cacheGroupSource.maxAsyncSize, + cacheGroupSource.enforce ? undefined : this.options.maxAsyncSize + ), + maxInitialSize: mergeSizes( + cacheGroupSource.maxInitialSize, + cacheGroupSource.enforce ? undefined : this.options.maxInitialSize + ), + minChunks: + cacheGroupSource.minChunks !== undefined + ? cacheGroupSource.minChunks + : cacheGroupSource.enforce + ? 1 + : this.options.minChunks, + maxAsyncRequests: + cacheGroupSource.maxAsyncRequests !== undefined + ? cacheGroupSource.maxAsyncRequests + : cacheGroupSource.enforce + ? Infinity + : this.options.maxAsyncRequests, + maxInitialRequests: + cacheGroupSource.maxInitialRequests !== undefined + ? cacheGroupSource.maxInitialRequests + : cacheGroupSource.enforce + ? Infinity + : this.options.maxInitialRequests, + getName: + cacheGroupSource.getName !== undefined + ? cacheGroupSource.getName + : this.options.getName, + usedExports: + cacheGroupSource.usedExports !== undefined + ? cacheGroupSource.usedExports + : this.options.usedExports, + filename: + cacheGroupSource.filename !== undefined + ? cacheGroupSource.filename + : this.options.filename, + automaticNameDelimiter: + cacheGroupSource.automaticNameDelimiter !== undefined + ? cacheGroupSource.automaticNameDelimiter + : this.options.automaticNameDelimiter, + idHint: + cacheGroupSource.idHint !== undefined + ? cacheGroupSource.idHint + : cacheGroupSource.key, + reuseExistingChunk: cacheGroupSource.reuseExistingChunk || false, + _validateSize: hasNonZeroSizes(minSize), + _validateRemainingSize: hasNonZeroSizes(minRemainingSize), + _minSizeForMaxSize: mergeSizes( + cacheGroupSource.minSize, + this.options.minSize + ), + _conditionalEnforce: hasNonZeroSizes(enforceSizeThreshold) + }; + this._cacheGroupCache.set(cacheGroupSource, cacheGroup); + return cacheGroup; } /** - * @param {SerializedType} data data - * @param {Object} context context object - * @returns {DeserializedType|Promise} deserialized data + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - deserialize(data, context) { - return data[0]; - } -} - -module.exports = SingleItemMiddleware; - - -/***/ }), - -/***/ 58831: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const ModuleDependency = __webpack_require__(80321); -const makeSerializable = __webpack_require__(33032); - -class ConsumeSharedFallbackDependency extends ModuleDependency { - constructor(request) { - super(request); - } - - get type() { - return "consume shared fallback"; - } - - get category() { - return "esm"; - } -} - -makeSerializable( - ConsumeSharedFallbackDependency, - "webpack/lib/sharing/ConsumeSharedFallbackDependency" -); - -module.exports = ConsumeSharedFallbackDependency; - - -/***/ }), + apply(compiler) { + const cachedMakePathsRelative = makePathsRelative.bindContextCache( + compiler.context, + compiler.root + ); + compiler.hooks.thisCompilation.tap("SplitChunksPlugin", compilation => { + const logger = compilation.getLogger("webpack.SplitChunksPlugin"); + let alreadyOptimized = false; + compilation.hooks.unseal.tap("SplitChunksPlugin", () => { + alreadyOptimized = false; + }); + compilation.hooks.optimizeChunks.tap( + { + name: "SplitChunksPlugin", + stage: STAGE_ADVANCED + }, + chunks => { + if (alreadyOptimized) return; + alreadyOptimized = true; + logger.time("prepare"); + const chunkGraph = compilation.chunkGraph; + const moduleGraph = compilation.moduleGraph; + // Give each selected chunk an index (to create strings from chunks) + /** @type {Map} */ + const chunkIndexMap = new Map(); + const ZERO = BigInt("0"); + const ONE = BigInt("1"); + const START = ONE << BigInt("31"); + let index = START; + for (const chunk of chunks) { + chunkIndexMap.set( + chunk, + index | BigInt((Math.random() * 0x7fffffff) | 0) + ); + index = index << ONE; + } + /** + * @param {Iterable} chunks list of chunks + * @returns {bigint | Chunk} key of the chunks + */ + const getKey = chunks => { + const iterator = chunks[Symbol.iterator](); + let result = iterator.next(); + if (result.done) return ZERO; + const first = result.value; + result = iterator.next(); + if (result.done) return first; + let key = + chunkIndexMap.get(first) | chunkIndexMap.get(result.value); + while (!(result = iterator.next()).done) { + const raw = chunkIndexMap.get(result.value); + key = key ^ raw; + } + return key; + }; + const keyToString = key => { + if (typeof key === "bigint") return key.toString(16); + return chunkIndexMap.get(key).toString(16); + }; -/***/ 62286: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + const getChunkSetsInGraph = memoize(() => { + /** @type {Map>} */ + const chunkSetsInGraph = new Map(); + /** @type {Set} */ + const singleChunkSets = new Set(); + for (const module of compilation.modules) { + const chunks = chunkGraph.getModuleChunksIterable(module); + const chunksKey = getKey(chunks); + if (typeof chunksKey === "bigint") { + if (!chunkSetsInGraph.has(chunksKey)) { + chunkSetsInGraph.set(chunksKey, new Set(chunks)); + } + } else { + singleChunkSets.add(chunksKey); + } + } + return { chunkSetsInGraph, singleChunkSets }; + }); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {Module} module the module + * @returns {Iterable} groups of chunks with equal exports + */ + const groupChunksByExports = module => { + const exportsInfo = moduleGraph.getExportsInfo(module); + const groupedByUsedExports = new Map(); + for (const chunk of chunkGraph.getModuleChunksIterable(module)) { + const key = exportsInfo.getUsageKey(chunk.runtime); + const list = groupedByUsedExports.get(key); + if (list !== undefined) { + list.push(chunk); + } else { + groupedByUsedExports.set(key, [chunk]); + } + } + return groupedByUsedExports.values(); + }; + /** @type {Map>} */ + const groupedByExportsMap = new Map(); + const getExportsChunkSetsInGraph = memoize(() => { + /** @type {Map>} */ + const chunkSetsInGraph = new Map(); + /** @type {Set} */ + const singleChunkSets = new Set(); + for (const module of compilation.modules) { + const groupedChunks = Array.from(groupChunksByExports(module)); + groupedByExportsMap.set(module, groupedChunks); + for (const chunks of groupedChunks) { + if (chunks.length === 1) { + singleChunkSets.add(chunks[0]); + } else { + const chunksKey = /** @type {bigint} */ (getKey(chunks)); + if (!chunkSetsInGraph.has(chunksKey)) { + chunkSetsInGraph.set(chunksKey, new Set(chunks)); + } + } + } + } + return { chunkSetsInGraph, singleChunkSets }; + }); -const { RawSource } = __webpack_require__(51255); -const AsyncDependenciesBlock = __webpack_require__(47736); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); -const { rangeToString, stringifyHoley } = __webpack_require__(19702); -const ConsumeSharedFallbackDependency = __webpack_require__(58831); + // group these set of chunks by count + // to allow to check less sets via isSubset + // (only smaller sets can be subset) + const groupChunkSetsByCount = chunkSets => { + /** @type {Map>>} */ + const chunkSetsByCount = new Map(); + for (const chunksSet of chunkSets) { + const count = chunksSet.size; + let array = chunkSetsByCount.get(count); + if (array === undefined) { + array = []; + chunkSetsByCount.set(count, array); + } + array.push(chunksSet); + } + return chunkSetsByCount; + }; + const getChunkSetsByCount = memoize(() => + groupChunkSetsByCount( + getChunkSetsInGraph().chunkSetsInGraph.values() + ) + ); + const getExportsChunkSetsByCount = memoize(() => + groupChunkSetsByCount( + getExportsChunkSetsInGraph().chunkSetsInGraph.values() + ) + ); -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ -/** @typedef {import("../util/semver").SemVerRange} SemVerRange */ + // Create a list of possible combinations + const createGetCombinations = ( + chunkSets, + singleChunkSets, + chunkSetsByCount + ) => { + /** @type {Map | Chunk)[]>} */ + const combinationsCache = new Map(); -/** - * @typedef {Object} ConsumeOptions - * @property {string=} import fallback request - * @property {string=} importResolved resolved fallback request - * @property {string} shareKey global share key - * @property {string} shareScope share scope - * @property {SemVerRange | false | undefined} requiredVersion version requirement - * @property {string} packageName package name to determine required version automatically - * @property {boolean} strictVersion don't use shared version even if version isn't valid - * @property {boolean} singleton use single global version - * @property {boolean} eager include the fallback module in a sync way - */ + return key => { + const cacheEntry = combinationsCache.get(key); + if (cacheEntry !== undefined) return cacheEntry; + if (key instanceof Chunk) { + const result = [key]; + combinationsCache.set(key, result); + return result; + } + const chunksSet = chunkSets.get(key); + /** @type {(Set | Chunk)[]} */ + const array = [chunksSet]; + for (const [count, setArray] of chunkSetsByCount) { + // "equal" is not needed because they would have been merge in the first step + if (count < chunksSet.size) { + for (const set of setArray) { + if (isSubset(chunksSet, set)) { + array.push(set); + } + } + } + } + for (const chunk of singleChunkSets) { + if (chunksSet.has(chunk)) { + array.push(chunk); + } + } + combinationsCache.set(key, array); + return array; + }; + }; -const TYPES = new Set(["consume-shared"]); + const getCombinationsFactory = memoize(() => { + const { chunkSetsInGraph, singleChunkSets } = getChunkSetsInGraph(); + return createGetCombinations( + chunkSetsInGraph, + singleChunkSets, + getChunkSetsByCount() + ); + }); + const getCombinations = key => getCombinationsFactory()(key); -class ConsumeSharedModule extends Module { - /** - * @param {string} context context - * @param {ConsumeOptions} options consume options - */ - constructor(context, options) { - super("consume-shared-module", context); - this.options = options; - } + const getExportsCombinationsFactory = memoize(() => { + const { chunkSetsInGraph, singleChunkSets } = + getExportsChunkSetsInGraph(); + return createGetCombinations( + chunkSetsInGraph, + singleChunkSets, + getExportsChunkSetsByCount() + ); + }); + const getExportsCombinations = key => + getExportsCombinationsFactory()(key); - /** - * @returns {string} a unique identifier of the module - */ - identifier() { - const { - shareKey, - shareScope, - importResolved, - requiredVersion, - strictVersion, - singleton, - eager - } = this.options; - return `consume-shared-module|${shareScope}|${shareKey}|${ - requiredVersion && rangeToString(requiredVersion) - }|${strictVersion}|${importResolved}|${singleton}|${eager}`; - } + /** + * @typedef {Object} SelectedChunksResult + * @property {Chunk[]} chunks the list of chunks + * @property {bigint | Chunk} key a key of the list + */ - /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module - */ - readableIdentifier(requestShortener) { - const { - shareKey, - shareScope, - importResolved, - requiredVersion, - strictVersion, - singleton, - eager - } = this.options; - return `consume shared module (${shareScope}) ${shareKey}@${ - requiredVersion ? rangeToString(requiredVersion) : "*" - }${strictVersion ? " (strict)" : ""}${singleton ? " (singleton)" : ""}${ - importResolved - ? ` (fallback: ${requestShortener.shorten(importResolved)})` - : "" - }${eager ? " (eager)" : ""}`; - } + /** @type {WeakMap | Chunk, WeakMap>} */ + const selectedChunksCacheByChunksSet = new WeakMap(); - /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion - */ - libIdent(options) { - const { shareKey, shareScope, import: request } = this.options; - return `${ - this.layer ? `(${this.layer})/` : "" - }webpack/sharing/consume/${shareScope}/${shareKey}${ - request ? `/${request}` : "" - }`; - } + /** + * get list and key by applying the filter function to the list + * It is cached for performance reasons + * @param {Set | Chunk} chunks list of chunks + * @param {ChunkFilterFunction} chunkFilter filter function for chunks + * @returns {SelectedChunksResult} list and key + */ + const getSelectedChunks = (chunks, chunkFilter) => { + let entry = selectedChunksCacheByChunksSet.get(chunks); + if (entry === undefined) { + entry = new WeakMap(); + selectedChunksCacheByChunksSet.set(chunks, entry); + } + /** @type {SelectedChunksResult} */ + let entry2 = entry.get(chunkFilter); + if (entry2 === undefined) { + /** @type {Chunk[]} */ + const selectedChunks = []; + if (chunks instanceof Chunk) { + if (chunkFilter(chunks)) selectedChunks.push(chunks); + } else { + for (const chunk of chunks) { + if (chunkFilter(chunk)) selectedChunks.push(chunk); + } + } + entry2 = { + chunks: selectedChunks, + key: getKey(selectedChunks) + }; + entry.set(chunkFilter, entry2); + } + return entry2; + }; - /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} - */ - needBuild(context, callback) { - callback(null, !this.buildInfo); - } + /** @type {Map} */ + const alreadyValidatedParents = new Map(); + /** @type {Set} */ + const alreadyReportedErrors = new Set(); - /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} - */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = {}; - this.buildInfo = {}; - if (this.options.import) { - const dep = new ConsumeSharedFallbackDependency(this.options.import); - if (this.options.eager) { - this.addDependency(dep); - } else { - const block = new AsyncDependenciesBlock({}); - block.addDependency(dep); - this.addBlock(block); - } - } - callback(); - } + // Map a list of chunks to a list of modules + // For the key the chunk "index" is used, the value is a SortableSet of modules + /** @type {Map} */ + const chunksInfoMap = new Map(); - /** - * @returns {Set} types available (do not mutate) - */ - getSourceTypes() { - return TYPES; - } + /** + * @param {CacheGroup} cacheGroup the current cache group + * @param {number} cacheGroupIndex the index of the cache group of ordering + * @param {Chunk[]} selectedChunks chunks selected for this module + * @param {bigint | Chunk} selectedChunksKey a key of selectedChunks + * @param {Module} module the current module + * @returns {void} + */ + const addModuleToChunksInfoMap = ( + cacheGroup, + cacheGroupIndex, + selectedChunks, + selectedChunksKey, + module + ) => { + // Break if minimum number of chunks is not reached + if (selectedChunks.length < cacheGroup.minChunks) return; + // Determine name for split chunk + const name = cacheGroup.getName( + module, + selectedChunks, + cacheGroup.key + ); + // Check if the name is ok + const existingChunk = compilation.namedChunks.get(name); + if (existingChunk) { + const parentValidationKey = `${name}|${ + typeof selectedChunksKey === "bigint" + ? selectedChunksKey + : selectedChunksKey.debugId + }`; + const valid = alreadyValidatedParents.get(parentValidationKey); + if (valid === false) return; + if (valid === undefined) { + // Module can only be moved into the existing chunk if the existing chunk + // is a parent of all selected chunks + let isInAllParents = true; + /** @type {Set} */ + const queue = new Set(); + for (const chunk of selectedChunks) { + for (const group of chunk.groupsIterable) { + queue.add(group); + } + } + for (const group of queue) { + if (existingChunk.isInGroup(group)) continue; + let hasParent = false; + for (const parent of group.parentsIterable) { + hasParent = true; + queue.add(parent); + } + if (!hasParent) { + isInAllParents = false; + } + } + const valid = isInAllParents; + alreadyValidatedParents.set(parentValidationKey, valid); + if (!valid) { + if (!alreadyReportedErrors.has(name)) { + alreadyReportedErrors.add(name); + compilation.errors.push( + new WebpackError( + "SplitChunksPlugin\n" + + `Cache group "${cacheGroup.key}" conflicts with existing chunk.\n` + + `Both have the same name "${name}" and existing chunk is not a parent of the selected modules.\n` + + "Use a different name for the cache group or make sure that the existing chunk is a parent (e. g. via dependOn).\n" + + 'HINT: You can omit "name" to automatically create a name.\n' + + "BREAKING CHANGE: webpack < 5 used to allow to use an entrypoint as splitChunk. " + + "This is no longer allowed when the entrypoint is not a parent of the selected modules.\n" + + "Remove this entrypoint and add modules to cache group's 'test' instead. " + + "If you need modules to be evaluated on startup, add them to the existing entrypoints (make them arrays). " + + "See migration guide of more info." + ) + ); + } + return; + } + } + } + // Create key for maps + // When it has a name we use the name as key + // Otherwise we create the key from chunks and cache group key + // This automatically merges equal names + const key = + cacheGroup.key + + (name + ? ` name:${name}` + : ` chunks:${keyToString(selectedChunksKey)}`); + // Add module to maps + let info = chunksInfoMap.get(key); + if (info === undefined) { + chunksInfoMap.set( + key, + (info = { + modules: new SortableSet( + undefined, + compareModulesByIdentifier + ), + cacheGroup, + cacheGroupIndex, + name, + sizes: {}, + chunks: new Set(), + reuseableChunks: new Set(), + chunksKeys: new Set() + }) + ); + } + const oldSize = info.modules.size; + info.modules.add(module); + if (info.modules.size !== oldSize) { + for (const type of module.getSourceTypes()) { + info.sizes[type] = (info.sizes[type] || 0) + module.size(type); + } + } + const oldChunksKeysSize = info.chunksKeys.size; + info.chunksKeys.add(selectedChunksKey); + if (oldChunksKeysSize !== info.chunksKeys.size) { + for (const chunk of selectedChunks) { + info.chunks.add(chunk); + } + } + }; - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - return 42; - } + const context = { + moduleGraph, + chunkGraph + }; - /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - hash.update(JSON.stringify(this.options)); - super.updateHash(hash, context); - } + logger.timeEnd("prepare"); - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration({ chunkGraph, moduleGraph, runtimeTemplate }) { - const runtimeRequirements = new Set([RuntimeGlobals.shareScopeMap]); - const { - shareScope, - shareKey, - strictVersion, - requiredVersion, - import: request, - singleton, - eager - } = this.options; - let fallbackCode; - if (request) { - if (eager) { - const dep = this.dependencies[0]; - fallbackCode = runtimeTemplate.syncModuleFactory({ - dependency: dep, - chunkGraph, - runtimeRequirements, - request: this.options.import - }); - } else { - const block = this.blocks[0]; - fallbackCode = runtimeTemplate.asyncModuleFactory({ - block, - chunkGraph, - runtimeRequirements, - request: this.options.import - }); - } - } - let fn = "load"; - const args = [JSON.stringify(shareScope), JSON.stringify(shareKey)]; - if (requiredVersion) { - if (strictVersion) { - fn += "Strict"; - } - if (singleton) { - fn += "Singleton"; - } - args.push(stringifyHoley(requiredVersion)); - fn += "VersionCheck"; - } else { - if (singleton) { - fn += "Singleton"; - } - } - if (fallbackCode) { - fn += "Fallback"; - args.push(fallbackCode); - } - const code = runtimeTemplate.returningFunction(`${fn}(${args.join(", ")})`); - const sources = new Map(); - sources.set("consume-shared", new RawSource(code)); - return { - runtimeRequirements, - sources - }; - } + logger.time("modules"); - serialize(context) { - const { write } = context; - write(this.options); - super.serialize(context); - } + // Walk through all modules + for (const module of compilation.modules) { + // Get cache group + let cacheGroups = this.options.getCacheGroups(module, context); + if (!Array.isArray(cacheGroups) || cacheGroups.length === 0) { + continue; + } - deserialize(context) { - const { read } = context; - this.options = read(); - super.deserialize(context); - } -} + // Prepare some values (usedExports = false) + const getCombs = memoize(() => { + const chunks = chunkGraph.getModuleChunksIterable(module); + const chunksKey = getKey(chunks); + return getCombinations(chunksKey); + }); -makeSerializable( - ConsumeSharedModule, - "webpack/lib/sharing/ConsumeSharedModule" -); + // Prepare some values (usedExports = true) + const getCombsByUsedExports = memoize(() => { + // fill the groupedByExportsMap + getExportsChunkSetsInGraph(); + /** @type {Set | Chunk>} */ + const set = new Set(); + const groupedByUsedExports = groupedByExportsMap.get(module); + for (const chunks of groupedByUsedExports) { + const chunksKey = getKey(chunks); + for (const comb of getExportsCombinations(chunksKey)) + set.add(comb); + } + return set; + }); -module.exports = ConsumeSharedModule; + let cacheGroupIndex = 0; + for (const cacheGroupSource of cacheGroups) { + const cacheGroup = this._getCacheGroup(cacheGroupSource); + const combs = cacheGroup.usedExports + ? getCombsByUsedExports() + : getCombs(); + // For all combination of chunk selection + for (const chunkCombination of combs) { + // Break if minimum number of chunks is not reached + const count = + chunkCombination instanceof Chunk ? 1 : chunkCombination.size; + if (count < cacheGroup.minChunks) continue; + // Select chunks by configuration + const { chunks: selectedChunks, key: selectedChunksKey } = + getSelectedChunks(chunkCombination, cacheGroup.chunksFilter); -/***/ }), + addModuleToChunksInfoMap( + cacheGroup, + cacheGroupIndex, + selectedChunks, + selectedChunksKey, + module + ); + } + cacheGroupIndex++; + } + } -/***/ 15046: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + logger.timeEnd("modules"); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + logger.time("queue"); + /** + * @param {ChunksInfoItem} info entry + * @param {string[]} sourceTypes source types to be removed + */ + const removeModulesWithSourceType = (info, sourceTypes) => { + for (const module of info.modules) { + const types = module.getSourceTypes(); + if (sourceTypes.some(type => types.has(type))) { + info.modules.delete(module); + for (const type of types) { + info.sizes[type] -= module.size(type); + } + } + } + }; + /** + * @param {ChunksInfoItem} info entry + * @returns {boolean} true, if entry become empty + */ + const removeMinSizeViolatingModules = info => { + if (!info.cacheGroup._validateSize) return false; + const violatingSizes = getViolatingMinSizes( + info.sizes, + info.cacheGroup.minSize + ); + if (violatingSizes === undefined) return false; + removeModulesWithSourceType(info, violatingSizes); + return info.modules.size === 0; + }; -const ModuleNotFoundError = __webpack_require__(32882); -const RuntimeGlobals = __webpack_require__(16475); -const WebpackError = __webpack_require__(53799); -const { parseOptions } = __webpack_require__(3083); -const LazySet = __webpack_require__(38938); -const createSchemaValidation = __webpack_require__(32540); -const { parseRange } = __webpack_require__(19702); -const ConsumeSharedFallbackDependency = __webpack_require__(58831); -const ConsumeSharedModule = __webpack_require__(62286); -const ConsumeSharedRuntimeModule = __webpack_require__(10394); -const ProvideForSharedDependency = __webpack_require__(40017); -const { resolveMatchedConfigs } = __webpack_require__(3591); -const { - isRequiredVersion, - getDescriptionFile, - getRequiredVersionFromDescriptionFile -} = __webpack_require__(84379); + // Filter items were size < minSize + for (const [key, info] of chunksInfoMap) { + if (removeMinSizeViolatingModules(info)) { + chunksInfoMap.delete(key); + } else if ( + !checkMinSizeReduction( + info.sizes, + info.cacheGroup.minSizeReduction, + info.chunks.size + ) + ) { + chunksInfoMap.delete(key); + } + } -/** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumeSharedPluginOptions} ConsumeSharedPluginOptions */ -/** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumesConfig} ConsumesConfig */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../ResolverFactory").ResolveOptionsWithDependencyType} ResolveOptionsWithDependencyType */ -/** @typedef {import("./ConsumeSharedModule").ConsumeOptions} ConsumeOptions */ + /** + * @typedef {Object} MaxSizeQueueItem + * @property {SplitChunksSizes} minSize + * @property {SplitChunksSizes} maxAsyncSize + * @property {SplitChunksSizes} maxInitialSize + * @property {string} automaticNameDelimiter + * @property {string[]} keys + */ -const validate = createSchemaValidation( - __webpack_require__(6464), - () => __webpack_require__(16116), - { - name: "Consume Shared Plugin", - baseDataPath: "options" - } -); + /** @type {Map} */ + const maxSizeQueueMap = new Map(); -/** @type {ResolveOptionsWithDependencyType} */ -const RESOLVE_OPTIONS = { dependencyType: "esm" }; -const PLUGIN_NAME = "ConsumeSharedPlugin"; + while (chunksInfoMap.size > 0) { + // Find best matching entry + let bestEntryKey; + let bestEntry; + for (const pair of chunksInfoMap) { + const key = pair[0]; + const info = pair[1]; + if ( + bestEntry === undefined || + compareEntries(bestEntry, info) < 0 + ) { + bestEntry = info; + bestEntryKey = key; + } + } -class ConsumeSharedPlugin { - /** - * @param {ConsumeSharedPluginOptions} options options - */ - constructor(options) { - if (typeof options !== "string") { - validate(options); - } + const item = bestEntry; + chunksInfoMap.delete(bestEntryKey); - /** @type {[string, ConsumeOptions][]} */ - this._consumes = parseOptions( - options.consumes, - (item, key) => { - if (Array.isArray(item)) throw new Error("Unexpected array in options"); - /** @type {ConsumeOptions} */ - let result = - item === key || !isRequiredVersion(item) - ? // item is a request/key - { - import: key, - shareScope: options.shareScope || "default", - shareKey: key, - requiredVersion: undefined, - packageName: undefined, - strictVersion: false, - singleton: false, - eager: false - } - : // key is a request/key - // item is a version - { - import: key, - shareScope: options.shareScope || "default", - shareKey: key, - requiredVersion: parseRange(item), - strictVersion: true, - packageName: undefined, - singleton: false, - eager: false - }; - return result; - }, - (item, key) => ({ - import: item.import === false ? undefined : item.import || key, - shareScope: item.shareScope || options.shareScope || "default", - shareKey: item.shareKey || key, - requiredVersion: - typeof item.requiredVersion === "string" - ? parseRange(item.requiredVersion) - : item.requiredVersion, - strictVersion: - typeof item.strictVersion === "boolean" - ? item.strictVersion - : item.import !== false && !item.singleton, - packageName: item.packageName, - singleton: !!item.singleton, - eager: !!item.eager - }) - ); - } + let chunkName = item.name; + // Variable for the new chunk (lazy created) + /** @type {Chunk} */ + let newChunk; + // When no chunk name, check if we can reuse a chunk instead of creating a new one + let isExistingChunk = false; + let isReusedWithAllModules = false; + if (chunkName) { + const chunkByName = compilation.namedChunks.get(chunkName); + if (chunkByName !== undefined) { + newChunk = chunkByName; + const oldSize = item.chunks.size; + item.chunks.delete(newChunk); + isExistingChunk = item.chunks.size !== oldSize; + } + } else if (item.cacheGroup.reuseExistingChunk) { + outer: for (const chunk of item.chunks) { + if ( + chunkGraph.getNumberOfChunkModules(chunk) !== + item.modules.size + ) { + continue; + } + if ( + item.chunks.size > 1 && + chunkGraph.getNumberOfEntryModules(chunk) > 0 + ) { + continue; + } + for (const module of item.modules) { + if (!chunkGraph.isModuleInChunk(module, chunk)) { + continue outer; + } + } + if (!newChunk || !newChunk.name) { + newChunk = chunk; + } else if ( + chunk.name && + chunk.name.length < newChunk.name.length + ) { + newChunk = chunk; + } else if ( + chunk.name && + chunk.name.length === newChunk.name.length && + chunk.name < newChunk.name + ) { + newChunk = chunk; + } + } + if (newChunk) { + item.chunks.delete(newChunk); + chunkName = undefined; + isExistingChunk = true; + isReusedWithAllModules = true; + } + } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - PLUGIN_NAME, - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - ConsumeSharedFallbackDependency, - normalModuleFactory - ); + const enforced = + item.cacheGroup._conditionalEnforce && + checkMinSize(item.sizes, item.cacheGroup.enforceSizeThreshold); - let unresolvedConsumes, resolvedConsumes, prefixedConsumes; - const promise = resolveMatchedConfigs(compilation, this._consumes).then( - ({ resolved, unresolved, prefixed }) => { - resolvedConsumes = resolved; - unresolvedConsumes = unresolved; - prefixedConsumes = prefixed; - } - ); + const usedChunks = new Set(item.chunks); - const resolver = compilation.resolverFactory.get( - "normal", - RESOLVE_OPTIONS - ); + // Check if maxRequests condition can be fulfilled + if ( + !enforced && + (Number.isFinite(item.cacheGroup.maxInitialRequests) || + Number.isFinite(item.cacheGroup.maxAsyncRequests)) + ) { + for (const chunk of usedChunks) { + // respect max requests + const maxRequests = chunk.isOnlyInitial() + ? item.cacheGroup.maxInitialRequests + : chunk.canBeInitial() + ? Math.min( + item.cacheGroup.maxInitialRequests, + item.cacheGroup.maxAsyncRequests + ) + : item.cacheGroup.maxAsyncRequests; + if ( + isFinite(maxRequests) && + getRequests(chunk) >= maxRequests + ) { + usedChunks.delete(chunk); + } + } + } - /** - * @param {string} context issuer directory - * @param {string} request request - * @param {ConsumeOptions} config options - * @returns {Promise} create module - */ - const createConsumeSharedModule = (context, request, config) => { - const requiredVersionWarning = details => { - const error = new WebpackError( - `No required version specified and unable to automatically determine one. ${details}` - ); - error.file = `shared module ${request}`; - compilation.warnings.push(error); - }; - const directFallback = - config.import && - /^(\.\.?(\/|$)|\/|[A-Za-z]:|\\\\)/.test(config.import); - return Promise.all([ - new Promise(resolve => { - if (!config.import) return resolve(); - const resolveContext = { - /** @type {LazySet} */ - fileDependencies: new LazySet(), - /** @type {LazySet} */ - contextDependencies: new LazySet(), - /** @type {LazySet} */ - missingDependencies: new LazySet() - }; - resolver.resolve( - {}, - directFallback ? compiler.context : context, - config.import, - resolveContext, - (err, result) => { - compilation.contextDependencies.addAll( - resolveContext.contextDependencies - ); - compilation.fileDependencies.addAll( - resolveContext.fileDependencies - ); - compilation.missingDependencies.addAll( - resolveContext.missingDependencies + outer: for (const chunk of usedChunks) { + for (const module of item.modules) { + if (chunkGraph.isModuleInChunk(module, chunk)) continue outer; + } + usedChunks.delete(chunk); + } + + // Were some (invalid) chunks removed from usedChunks? + // => readd all modules to the queue, as things could have been changed + if (usedChunks.size < item.chunks.size) { + if (isExistingChunk) usedChunks.add(newChunk); + if (usedChunks.size >= item.cacheGroup.minChunks) { + const chunksArr = Array.from(usedChunks); + for (const module of item.modules) { + addModuleToChunksInfoMap( + item.cacheGroup, + item.cacheGroupIndex, + chunksArr, + getKey(usedChunks), + module ); - if (err) { - compilation.errors.push( - new ModuleNotFoundError(null, err, { - name: `resolving fallback for shared module ${request}` - }) - ); - return resolve(); + } + } + continue; + } + + // Validate minRemainingSize constraint when a single chunk is left over + if ( + !enforced && + item.cacheGroup._validateRemainingSize && + usedChunks.size === 1 + ) { + const [chunk] = usedChunks; + let chunkSizes = Object.create(null); + for (const module of chunkGraph.getChunkModulesIterable(chunk)) { + if (!item.modules.has(module)) { + for (const type of module.getSourceTypes()) { + chunkSizes[type] = + (chunkSizes[type] || 0) + module.size(type); } - resolve(result); } + } + const violatingSizes = getViolatingMinSizes( + chunkSizes, + item.cacheGroup.minRemainingSize ); - }), - new Promise(resolve => { - if (config.requiredVersion !== undefined) - return resolve(config.requiredVersion); - let packageName = config.packageName; - if (packageName === undefined) { - if (/^(\/|[A-Za-z]:|\\\\)/.test(request)) { - // For relative or absolute requests we don't automatically use a packageName. - // If wished one can specify one with the packageName option. - return resolve(); + if (violatingSizes !== undefined) { + const oldModulesSize = item.modules.size; + removeModulesWithSourceType(item, violatingSizes); + if ( + item.modules.size > 0 && + item.modules.size !== oldModulesSize + ) { + // queue this item again to be processed again + // without violating modules + chunksInfoMap.set(bestEntryKey, item); } - const match = /^((?:@[^\\/]+[\\/])?[^\\/]+)/.exec(request); - if (!match) { - requiredVersionWarning( - "Unable to extract the package name from request." - ); - return resolve(); + continue; + } + } + + // Create the new chunk if not reusing one + if (newChunk === undefined) { + newChunk = compilation.addChunk(chunkName); + } + // Walk through all chunks + for (const chunk of usedChunks) { + // Add graph connections for splitted chunk + chunk.split(newChunk); + } + + // Add a note to the chunk + newChunk.chunkReason = + (newChunk.chunkReason ? newChunk.chunkReason + ", " : "") + + (isReusedWithAllModules + ? "reused as split chunk" + : "split chunk"); + if (item.cacheGroup.key) { + newChunk.chunkReason += ` (cache group: ${item.cacheGroup.key})`; + } + if (chunkName) { + newChunk.chunkReason += ` (name: ${chunkName})`; + } + if (item.cacheGroup.filename) { + newChunk.filenameTemplate = item.cacheGroup.filename; + } + if (item.cacheGroup.idHint) { + newChunk.idNameHints.add(item.cacheGroup.idHint); + } + if (!isReusedWithAllModules) { + // Add all modules to the new chunk + for (const module of item.modules) { + if (!module.chunkCondition(newChunk, compilation)) continue; + // Add module to new chunk + chunkGraph.connectChunkAndModule(newChunk, module); + // Remove module from used chunks + for (const chunk of usedChunks) { + chunkGraph.disconnectChunkAndModule(chunk, module); + } + } + } else { + // Remove all modules from used chunks + for (const module of item.modules) { + for (const chunk of usedChunks) { + chunkGraph.disconnectChunkAndModule(chunk, module); } - packageName = match[0]; } + } - getDescriptionFile( - compilation.inputFileSystem, - context, - ["package.json"], - (err, result) => { - if (err) { - requiredVersionWarning( - `Unable to read description file: ${err}` - ); - return resolve(); + if ( + Object.keys(item.cacheGroup.maxAsyncSize).length > 0 || + Object.keys(item.cacheGroup.maxInitialSize).length > 0 + ) { + const oldMaxSizeSettings = maxSizeQueueMap.get(newChunk); + maxSizeQueueMap.set(newChunk, { + minSize: oldMaxSizeSettings + ? combineSizes( + oldMaxSizeSettings.minSize, + item.cacheGroup._minSizeForMaxSize, + Math.max + ) + : item.cacheGroup.minSize, + maxAsyncSize: oldMaxSizeSettings + ? combineSizes( + oldMaxSizeSettings.maxAsyncSize, + item.cacheGroup.maxAsyncSize, + Math.min + ) + : item.cacheGroup.maxAsyncSize, + maxInitialSize: oldMaxSizeSettings + ? combineSizes( + oldMaxSizeSettings.maxInitialSize, + item.cacheGroup.maxInitialSize, + Math.min + ) + : item.cacheGroup.maxInitialSize, + automaticNameDelimiter: item.cacheGroup.automaticNameDelimiter, + keys: oldMaxSizeSettings + ? oldMaxSizeSettings.keys.concat(item.cacheGroup.key) + : [item.cacheGroup.key] + }); + } + + // remove all modules from other entries and update size + for (const [key, info] of chunksInfoMap) { + if (isOverlap(info.chunks, usedChunks)) { + // update modules and total size + // may remove it from the map when < minSize + let updated = false; + for (const module of item.modules) { + if (info.modules.has(module)) { + // remove module + info.modules.delete(module); + // update size + for (const key of module.getSourceTypes()) { + info.sizes[key] -= module.size(key); + } + updated = true; } - const { data, path: descriptionPath } = result; - if (!data) { - requiredVersionWarning( - `Unable to find description file in ${context}.` - ); - return resolve(); + } + if (updated) { + if (info.modules.size === 0) { + chunksInfoMap.delete(key); + continue; } - const requiredVersion = getRequiredVersionFromDescriptionFile( - data, - packageName - ); - if (typeof requiredVersion !== "string") { - requiredVersionWarning( - `Unable to find required version for "${packageName}" in description file (${descriptionPath}). It need to be in dependencies, devDependencies or peerDependencies.` - ); - return resolve(); + if ( + removeMinSizeViolatingModules(info) || + !checkMinSizeReduction( + info.sizes, + info.cacheGroup.minSizeReduction, + info.chunks.size + ) + ) { + chunksInfoMap.delete(key); + continue; } - resolve(parseRange(requiredVersion)); } - ); - }) - ]).then(([importResolved, requiredVersion]) => { - return new ConsumeSharedModule( - directFallback ? compiler.context : context, - { - ...config, - importResolved, - import: importResolved ? config.import : undefined, - requiredVersion } - ); - }); - }; + } + } - normalModuleFactory.hooks.factorize.tapPromise( - PLUGIN_NAME, - ({ context, request, dependencies }) => - // wait for resolving to be complete - promise.then(() => { + logger.timeEnd("queue"); + + logger.time("maxSize"); + + /** @type {Set} */ + const incorrectMinMaxSizeSet = new Set(); + + const { outputOptions } = compilation; + + // Make sure that maxSize is fulfilled + const { fallbackCacheGroup } = this.options; + for (const chunk of Array.from(compilation.chunks)) { + const chunkConfig = maxSizeQueueMap.get(chunk); + const { + minSize, + maxAsyncSize, + maxInitialSize, + automaticNameDelimiter + } = chunkConfig || fallbackCacheGroup; + if (!chunkConfig && !fallbackCacheGroup.chunksFilter(chunk)) + continue; + /** @type {SplitChunksSizes} */ + let maxSize; + if (chunk.isOnlyInitial()) { + maxSize = maxInitialSize; + } else if (chunk.canBeInitial()) { + maxSize = combineSizes(maxAsyncSize, maxInitialSize, Math.min); + } else { + maxSize = maxAsyncSize; + } + if (Object.keys(maxSize).length === 0) { + continue; + } + for (const key of Object.keys(maxSize)) { + const maxSizeValue = maxSize[key]; + const minSizeValue = minSize[key]; if ( - dependencies[0] instanceof ConsumeSharedFallbackDependency || - dependencies[0] instanceof ProvideForSharedDependency + typeof minSizeValue === "number" && + minSizeValue > maxSizeValue ) { - return; - } - const match = unresolvedConsumes.get(request); - if (match !== undefined) { - return createConsumeSharedModule(context, request, match); + const keys = chunkConfig && chunkConfig.keys; + const warningKey = `${ + keys && keys.join() + } ${minSizeValue} ${maxSizeValue}`; + if (!incorrectMinMaxSizeSet.has(warningKey)) { + incorrectMinMaxSizeSet.add(warningKey); + compilation.warnings.push( + new MinMaxSizeWarning(keys, minSizeValue, maxSizeValue) + ); + } } - for (const [prefix, options] of prefixedConsumes) { - if (request.startsWith(prefix)) { - const remainder = request.slice(prefix.length); - return createConsumeSharedModule(context, request, { - ...options, - import: options.import - ? options.import + remainder - : undefined, - shareKey: options.shareKey + remainder - }); + } + const results = deterministicGroupingForModules({ + minSize, + maxSize: mapObject(maxSize, (value, key) => { + const minSizeValue = minSize[key]; + return typeof minSizeValue === "number" + ? Math.max(value, minSizeValue) + : value; + }), + items: chunkGraph.getChunkModulesIterable(chunk), + getKey(module) { + const cache = getKeyCache.get(module); + if (cache !== undefined) return cache; + const ident = cachedMakePathsRelative(module.identifier()); + const nameForCondition = + module.nameForCondition && module.nameForCondition(); + const name = nameForCondition + ? cachedMakePathsRelative(nameForCondition) + : ident.replace(/^.*!|\?[^?!]*$/g, ""); + const fullKey = + name + + automaticNameDelimiter + + hashFilename(ident, outputOptions); + const key = requestToId(fullKey); + getKeyCache.set(module, key); + return key; + }, + getSize(module) { + const size = Object.create(null); + for (const key of module.getSourceTypes()) { + size[key] = module.size(key); } + return size; } - }) - ); - normalModuleFactory.hooks.createModule.tapPromise( - PLUGIN_NAME, - ({ resource }, { context, dependencies }) => { - if ( - dependencies[0] instanceof ConsumeSharedFallbackDependency || - dependencies[0] instanceof ProvideForSharedDependency - ) { - return Promise.resolve(); + }); + if (results.length <= 1) { + continue; } - const options = resolvedConsumes.get(resource); - if (options !== undefined) { - return createConsumeSharedModule(context, resource, options); + for (let i = 0; i < results.length; i++) { + const group = results[i]; + const key = this.options.hidePathInfo + ? hashFilename(group.key, outputOptions) + : group.key; + let name = chunk.name + ? chunk.name + automaticNameDelimiter + key + : null; + if (name && name.length > 100) { + name = + name.slice(0, 100) + + automaticNameDelimiter + + hashFilename(name, outputOptions); + } + if (i !== results.length - 1) { + const newPart = compilation.addChunk(name); + chunk.split(newPart); + newPart.chunkReason = chunk.chunkReason; + // Add all modules to the new chunk + for (const module of group.items) { + if (!module.chunkCondition(newPart, compilation)) { + continue; + } + // Add module to new chunk + chunkGraph.connectChunkAndModule(newPart, module); + // Remove module from used chunks + chunkGraph.disconnectChunkAndModule(chunk, module); + } + } else { + // change the chunk to be a part + chunk.name = name; + } } - return Promise.resolve(); - } - ); - compilation.hooks.additionalTreeRuntimeRequirements.tap( - PLUGIN_NAME, - (chunk, set) => { - set.add(RuntimeGlobals.module); - set.add(RuntimeGlobals.moduleCache); - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - set.add(RuntimeGlobals.shareScopeMap); - set.add(RuntimeGlobals.initializeSharing); - set.add(RuntimeGlobals.hasOwnProperty); - compilation.addRuntimeModule( - chunk, - new ConsumeSharedRuntimeModule(set) - ); } - ); - } - ); + logger.timeEnd("maxSize"); + } + ); + }); } -} - -module.exports = ConsumeSharedPlugin; +}; /***/ }), -/***/ 10394: +/***/ 52149: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Sean Larkin @thelarkinn */ -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); -const { - parseVersionRuntimeCode, - versionLtRuntimeCode, - rangeToStringRuntimeCode, - satisfyRuntimeCode -} = __webpack_require__(19702); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("./ConsumeSharedModule")} ConsumeSharedModule */ +const { formatSize } = __webpack_require__(71070); +const WebpackError = __webpack_require__(53799); -class ConsumeSharedRuntimeModule extends RuntimeModule { - constructor(runtimeRequirements) { - super("consumes", RuntimeModule.STAGE_ATTACH); - this._runtimeRequirements = runtimeRequirements; - } +/** @typedef {import("./SizeLimitsPlugin").AssetDetails} AssetDetails */ +module.exports = class AssetsOverSizeLimitWarning extends WebpackError { /** - * @returns {string} runtime code + * @param {AssetDetails[]} assetsOverSizeLimit the assets + * @param {number} assetLimit the size limit */ - generate() { - const { compilation, chunkGraph } = this; - const { runtimeTemplate, codeGenerationResults } = compilation; - const chunkToModuleMapping = {}; - /** @type {Map} */ - const moduleIdToSourceMapping = new Map(); - const initialConsumes = []; - /** - * - * @param {Iterable} modules modules - * @param {Chunk} chunk the chunk - * @param {(string | number)[]} list list of ids - */ - const addModules = (modules, chunk, list) => { - for (const m of modules) { - const module = /** @type {ConsumeSharedModule} */ (m); - const id = chunkGraph.getModuleId(module); - list.push(id); - moduleIdToSourceMapping.set( - id, - codeGenerationResults.getSource( - module, - chunk.runtime, - "consume-shared" - ) - ); - } - }; - for (const chunk of this.chunk.getAllAsyncChunks()) { - const modules = chunkGraph.getChunkModulesIterableBySourceType( - chunk, - "consume-shared" - ); - if (!modules) continue; - addModules(modules, chunk, (chunkToModuleMapping[chunk.id] = [])); - } - for (const chunk of this.chunk.getAllInitialChunks()) { - const modules = chunkGraph.getChunkModulesIterableBySourceType( - chunk, - "consume-shared" - ); - if (!modules) continue; - addModules(modules, chunk, initialConsumes); - } - if (moduleIdToSourceMapping.size === 0) return null; - return Template.asString([ - parseVersionRuntimeCode(runtimeTemplate), - versionLtRuntimeCode(runtimeTemplate), - rangeToStringRuntimeCode(runtimeTemplate), - satisfyRuntimeCode(runtimeTemplate), - `var ensureExistence = ${runtimeTemplate.basicFunction("scopeName, key", [ - `var scope = ${RuntimeGlobals.shareScopeMap}[scopeName];`, - `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) throw new Error("Shared module " + key + " doesn't exist in shared scope " + scopeName);`, - "return scope;" - ])};`, - `var findVersion = ${runtimeTemplate.basicFunction("scope, key", [ - "var versions = scope[key];", - `var key = Object.keys(versions).reduce(${runtimeTemplate.basicFunction( - "a, b", - ["return !a || versionLt(a, b) ? b : a;"] - )}, 0);`, - "return key && versions[key]" - ])};`, - `var findSingletonVersionKey = ${runtimeTemplate.basicFunction( - "scope, key", - [ - "var versions = scope[key];", - `return Object.keys(versions).reduce(${runtimeTemplate.basicFunction( - "a, b", - ["return !a || (!versions[a].loaded && versionLt(a, b)) ? b : a;"] - )}, 0);` - ] - )};`, - `var getInvalidSingletonVersionMessage = ${runtimeTemplate.basicFunction( - "scope, key, version, requiredVersion", - [ - `return "Unsatisfied version " + version + " from " + (version && scope[key][version].from) + " of shared singleton module " + key + " (required " + rangeToString(requiredVersion) + ")"` - ] - )};`, - `var getSingleton = ${runtimeTemplate.basicFunction( - "scope, scopeName, key, requiredVersion", - [ - "var version = findSingletonVersionKey(scope, key);", - "return get(scope[key][version]);" - ] - )};`, - `var getSingletonVersion = ${runtimeTemplate.basicFunction( - "scope, scopeName, key, requiredVersion", - [ - "var version = findSingletonVersionKey(scope, key);", - "if (!satisfy(requiredVersion, version)) " + - 'typeof console !== "undefined" && console.warn && console.warn(getInvalidSingletonVersionMessage(scope, key, version, requiredVersion));', - "return get(scope[key][version]);" - ] - )};`, - `var getStrictSingletonVersion = ${runtimeTemplate.basicFunction( - "scope, scopeName, key, requiredVersion", - [ - "var version = findSingletonVersionKey(scope, key);", - "if (!satisfy(requiredVersion, version)) " + - "throw new Error(getInvalidSingletonVersionMessage(scope, key, version, requiredVersion));", - "return get(scope[key][version]);" - ] - )};`, - `var findValidVersion = ${runtimeTemplate.basicFunction( - "scope, key, requiredVersion", - [ - "var versions = scope[key];", - `var key = Object.keys(versions).reduce(${runtimeTemplate.basicFunction( - "a, b", - [ - "if (!satisfy(requiredVersion, b)) return a;", - "return !a || versionLt(a, b) ? b : a;" - ] - )}, 0);`, - "return key && versions[key]" - ] - )};`, - `var getInvalidVersionMessage = ${runtimeTemplate.basicFunction( - "scope, scopeName, key, requiredVersion", - [ - "var versions = scope[key];", - 'return "No satisfying version (" + rangeToString(requiredVersion) + ") of shared module " + key + " found in shared scope " + scopeName + ".\\n" +', - `\t"Available versions: " + Object.keys(versions).map(${runtimeTemplate.basicFunction( - "key", - ['return key + " from " + versions[key].from;'] - )}).join(", ");` - ] - )};`, - `var getValidVersion = ${runtimeTemplate.basicFunction( - "scope, scopeName, key, requiredVersion", - [ - "var entry = findValidVersion(scope, key, requiredVersion);", - "if(entry) return get(entry);", - "throw new Error(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));" - ] - )};`, - `var warnInvalidVersion = ${runtimeTemplate.basicFunction( - "scope, scopeName, key, requiredVersion", - [ - 'typeof console !== "undefined" && console.warn && console.warn(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));' - ] - )};`, - `var get = ${runtimeTemplate.basicFunction("entry", [ - "entry.loaded = 1;", - "return entry.get()" - ])};`, - `var init = ${runtimeTemplate.returningFunction( - Template.asString([ - "function(scopeName, a, b, c) {", - Template.indent([ - `var promise = ${RuntimeGlobals.initializeSharing}(scopeName);`, - `if (promise && promise.then) return promise.then(fn.bind(fn, scopeName, ${RuntimeGlobals.shareScopeMap}[scopeName], a, b, c));`, - `return fn(scopeName, ${RuntimeGlobals.shareScopeMap}[scopeName], a, b, c);` - ]), - "}" - ]), - "fn" - )};`, - "", - `var load = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key", - [ - "ensureExistence(scopeName, key);", - "return get(findVersion(scope, key));" - ] - )});`, - `var loadFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, fallback", - [ - `return scope && ${RuntimeGlobals.hasOwnProperty}(scope, key) ? get(findVersion(scope, key)) : fallback();` - ] - )});`, - `var loadVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, version", - [ - "ensureExistence(scopeName, key);", - "return get(findValidVersion(scope, key, version) || warnInvalidVersion(scope, scopeName, key, version) || findVersion(scope, key));" - ] - )});`, - `var loadSingleton = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key", - [ - "ensureExistence(scopeName, key);", - "return getSingleton(scope, scopeName, key);" - ] - )});`, - `var loadSingletonVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, version", - [ - "ensureExistence(scopeName, key);", - "return getSingletonVersion(scope, scopeName, key, version);" - ] - )});`, - `var loadStrictVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, version", - [ - "ensureExistence(scopeName, key);", - "return getValidVersion(scope, scopeName, key, version);" - ] - )});`, - `var loadStrictSingletonVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, version", - [ - "ensureExistence(scopeName, key);", - "return getStrictSingletonVersion(scope, scopeName, key, version);" - ] - )});`, - `var loadVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, version, fallback", - [ - `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`, - "return get(findValidVersion(scope, key, version) || warnInvalidVersion(scope, scopeName, key, version) || findVersion(scope, key));" - ] - )});`, - `var loadSingletonFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, fallback", - [ - `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`, - "return getSingleton(scope, scopeName, key);" - ] - )});`, - `var loadSingletonVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, version, fallback", - [ - `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`, - "return getSingletonVersion(scope, scopeName, key, version);" - ] - )});`, - `var loadStrictVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, version, fallback", - [ - `var entry = scope && ${RuntimeGlobals.hasOwnProperty}(scope, key) && findValidVersion(scope, key, version);`, - `return entry ? get(entry) : fallback();` - ] - )});`, - `var loadStrictSingletonVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, version, fallback", - [ - `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`, - "return getStrictSingletonVersion(scope, scopeName, key, version);" - ] - )});`, - "var installedModules = {};", - "var moduleToHandlerMapping = {", - Template.indent( - Array.from( - moduleIdToSourceMapping, - ([key, source]) => `${JSON.stringify(key)}: ${source.source()}` - ).join(",\n") - ), - "};", + constructor(assetsOverSizeLimit, assetLimit) { + const assetLists = assetsOverSizeLimit + .map(asset => `\n ${asset.name} (${formatSize(asset.size)})`) + .join(""); - initialConsumes.length > 0 - ? Template.asString([ - `var initialConsumes = ${JSON.stringify(initialConsumes)};`, - `initialConsumes.forEach(${runtimeTemplate.basicFunction("id", [ - `${ - RuntimeGlobals.moduleFactories - }[id] = ${runtimeTemplate.basicFunction("module", [ - "// Handle case when module is used sync", - "installedModules[id] = 0;", - `delete ${RuntimeGlobals.moduleCache}[id];`, - "var factory = moduleToHandlerMapping[id]();", - 'if(typeof factory !== "function") throw new Error("Shared module is not available for eager consumption: " + id);', - `module.exports = factory();` - ])}` - ])});` - ]) - : "// no consumes in initial chunks", - this._runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers) - ? Template.asString([ - `var chunkMapping = ${JSON.stringify( - chunkToModuleMapping, - null, - "\t" - )};`, - `${ - RuntimeGlobals.ensureChunkHandlers - }.consumes = ${runtimeTemplate.basicFunction("chunkId, promises", [ - `if(${RuntimeGlobals.hasOwnProperty}(chunkMapping, chunkId)) {`, - Template.indent([ - `chunkMapping[chunkId].forEach(${runtimeTemplate.basicFunction( - "id", - [ - `if(${RuntimeGlobals.hasOwnProperty}(installedModules, id)) return promises.push(installedModules[id]);`, - `var onFactory = ${runtimeTemplate.basicFunction( - "factory", - [ - "installedModules[id] = 0;", - `${ - RuntimeGlobals.moduleFactories - }[id] = ${runtimeTemplate.basicFunction("module", [ - `delete ${RuntimeGlobals.moduleCache}[id];`, - "module.exports = factory();" - ])}` - ] - )};`, - `var onError = ${runtimeTemplate.basicFunction("error", [ - "delete installedModules[id];", - `${ - RuntimeGlobals.moduleFactories - }[id] = ${runtimeTemplate.basicFunction("module", [ - `delete ${RuntimeGlobals.moduleCache}[id];`, - "throw error;" - ])}` - ])};`, - "try {", - Template.indent([ - "var promise = moduleToHandlerMapping[id]();", - "if(promise.then) {", - Template.indent( - "promises.push(installedModules[id] = promise.then(onFactory)['catch'](onError));" - ), - "} else onFactory(promise);" - ]), - "} catch(e) { onError(e); }" - ] - )});` - ]), - "}" - ])}` - ]) - : "// no chunk loading of consumes" - ]); - } -} + super(`asset size limit: The following asset(s) exceed the recommended size limit (${formatSize( + assetLimit + )}). +This can impact web performance. +Assets: ${assetLists}`); -module.exports = ConsumeSharedRuntimeModule; + this.name = "AssetsOverSizeLimitWarning"; + this.assets = assetsOverSizeLimit; + } +}; /***/ }), -/***/ 40017: +/***/ 84229: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Sean Larkin @thelarkinn */ -const ModuleDependency = __webpack_require__(80321); -const makeSerializable = __webpack_require__(33032); +const { formatSize } = __webpack_require__(71070); +const WebpackError = __webpack_require__(53799); -class ProvideForSharedDependency extends ModuleDependency { +/** @typedef {import("./SizeLimitsPlugin").EntrypointDetails} EntrypointDetails */ + +module.exports = class EntrypointsOverSizeLimitWarning extends WebpackError { /** - * - * @param {string} request request string + * @param {EntrypointDetails[]} entrypoints the entrypoints + * @param {number} entrypointLimit the size limit */ - constructor(request) { - super(request); - } - - get type() { - return "provide module for shared"; - } + constructor(entrypoints, entrypointLimit) { + const entrypointList = entrypoints + .map( + entrypoint => + `\n ${entrypoint.name} (${formatSize( + entrypoint.size + )})\n${entrypoint.files.map(asset => ` ${asset}`).join("\n")}` + ) + .join(""); + super(`entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (${formatSize( + entrypointLimit + )}). This can impact web performance. +Entrypoints:${entrypointList}\n`); - get category() { - return "esm"; + this.name = "EntrypointsOverSizeLimitWarning"; + this.entrypoints = entrypoints; } -} - -makeSerializable( - ProvideForSharedDependency, - "webpack/lib/sharing/ProvideForSharedDependency" -); - -module.exports = ProvideForSharedDependency; +}; /***/ }), -/***/ 1798: +/***/ 17791: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Sean Larkin @thelarkinn */ -const Dependency = __webpack_require__(54912); -const makeSerializable = __webpack_require__(33032); - -class ProvideSharedDependency extends Dependency { - constructor(shareScope, name, version, request, eager) { - super(); - this.shareScope = shareScope; - this.name = name; - this.version = version; - this.request = request; - this.eager = eager; - } - - get type() { - return "provide shared module"; - } - - /** - * @returns {string | null} an identifier to merge equal requests - */ - getResourceIdentifier() { - return `provide module (${this.shareScope}) ${this.request} as ${ - this.name - } @ ${this.version}${this.eager ? " (eager)" : ""}`; - } - - serialize(context) { - context.write(this.shareScope); - context.write(this.name); - context.write(this.request); - context.write(this.version); - context.write(this.eager); - super.serialize(context); - } +const WebpackError = __webpack_require__(53799); - static deserialize(context) { - const { read } = context; - const obj = new ProvideSharedDependency( - read(), - read(), - read(), - read(), - read() +module.exports = class NoAsyncChunksWarning extends WebpackError { + constructor() { + super( + "webpack performance recommendations: \n" + + "You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.\n" + + "For more info visit https://webpack.js.org/guides/code-splitting/" ); - this.shareScope = context.read(); - obj.deserialize(context); - return obj; - } -} - -makeSerializable( - ProvideSharedDependency, - "webpack/lib/sharing/ProvideSharedDependency" -); -module.exports = ProvideSharedDependency; + this.name = "NoAsyncChunksWarning"; + } +}; /***/ }), -/***/ 50821: +/***/ 32557: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy + Author Sean Larkin @thelarkinn */ -const AsyncDependenciesBlock = __webpack_require__(47736); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); -const ProvideForSharedDependency = __webpack_require__(40017); +const { find } = __webpack_require__(93347); +const AssetsOverSizeLimitWarning = __webpack_require__(52149); +const EntrypointsOverSizeLimitWarning = __webpack_require__(84229); +const NoAsyncChunksWarning = __webpack_require__(17791); -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").PerformanceOptions} PerformanceOptions */ /** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Entrypoint")} Entrypoint */ /** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ -const TYPES = new Set(["share-init"]); +/** + * @typedef {Object} AssetDetails + * @property {string} name + * @property {number} size + */ -class ProvideSharedModule extends Module { - /** - * @param {string} shareScope shared scope name - * @param {string} name shared key - * @param {string | false} version version - * @param {string} request request to the provided module - * @param {boolean} eager include the module in sync way - */ - constructor(shareScope, name, version, request, eager) { - super("provide-module"); - this._shareScope = shareScope; - this._name = name; - this._version = version; - this._request = request; - this._eager = eager; - } +/** + * @typedef {Object} EntrypointDetails + * @property {string} name + * @property {number} size + * @property {string[]} files + */ - /** - * @returns {string} a unique identifier of the module - */ - identifier() { - return `provide module (${this._shareScope}) ${this._name}@${this._version} = ${this._request}`; - } +const isOverSizeLimitSet = new WeakSet(); - /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module - */ - readableIdentifier(requestShortener) { - return `provide shared module (${this._shareScope}) ${this._name}@${ - this._version - } = ${requestShortener.shorten(this._request)}`; - } +const excludeSourceMap = (name, source, info) => !info.development; +module.exports = class SizeLimitsPlugin { /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion + * @param {PerformanceOptions} options the plugin options */ - libIdent(options) { - return `${this.layer ? `(${this.layer})/` : ""}webpack/sharing/provide/${ - this._shareScope - }/${this._name}`; + constructor(options) { + this.hints = options.hints; + this.maxAssetSize = options.maxAssetSize; + this.maxEntrypointSize = options.maxEntrypointSize; + this.assetFilter = options.assetFilter; } /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} + * @param {ChunkGroup | Source} thing the resource to test + * @returns {boolean} true if over the limit */ - needBuild(context, callback) { - callback(null, !this.buildInfo); + static isOverSizeLimit(thing) { + return isOverSizeLimitSet.has(thing); } /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = {}; - this.buildInfo = { - strict: true - }; + apply(compiler) { + const entrypointSizeLimit = this.maxEntrypointSize; + const assetSizeLimit = this.maxAssetSize; + const hints = this.hints; + const assetFilter = this.assetFilter || excludeSourceMap; - this.clearDependenciesAndBlocks(); - const dep = new ProvideForSharedDependency(this._request); - if (this._eager) { - this.addDependency(dep); - } else { - const block = new AsyncDependenciesBlock({}); - block.addDependency(dep); - this.addBlock(block); - } + compiler.hooks.afterEmit.tap("SizeLimitsPlugin", compilation => { + /** @type {WebpackError[]} */ + const warnings = []; - callback(); - } + /** + * @param {Entrypoint} entrypoint an entrypoint + * @returns {number} the size of the entrypoint + */ + const getEntrypointSize = entrypoint => { + let size = 0; + for (const file of entrypoint.getFiles()) { + const asset = compilation.getAsset(file); + if ( + asset && + assetFilter(asset.name, asset.source, asset.info) && + asset.source + ) { + size += asset.info.size || asset.source.size(); + } + } + return size; + }; - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - return 42; - } + /** @type {AssetDetails[]} */ + const assetsOverSizeLimit = []; + for (const { name, source, info } of compilation.getAssets()) { + if (!assetFilter(name, source, info) || !source) { + continue; + } - /** - * @returns {Set} types available (do not mutate) - */ - getSourceTypes() { - return TYPES; - } + const size = info.size || source.size(); + if (size > assetSizeLimit) { + assetsOverSizeLimit.push({ + name, + size + }); + isOverSizeLimitSet.add(source); + } + } - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { - const runtimeRequirements = new Set([RuntimeGlobals.initializeSharing]); - const code = `register(${JSON.stringify(this._name)}, ${JSON.stringify( - this._version || "0" - )}, ${ - this._eager - ? runtimeTemplate.syncModuleFactory({ - dependency: this.dependencies[0], - chunkGraph, - request: this._request, - runtimeRequirements - }) - : runtimeTemplate.asyncModuleFactory({ - block: this.blocks[0], - chunkGraph, - request: this._request, - runtimeRequirements - }) - }${this._eager ? ", 1" : ""});`; - const sources = new Map(); - const data = new Map(); - data.set("share-init", [ - { - shareScope: this._shareScope, - initStage: 10, - init: code + const fileFilter = name => { + const asset = compilation.getAsset(name); + return asset && assetFilter(asset.name, asset.source, asset.info); + }; + + /** @type {EntrypointDetails[]} */ + const entrypointsOverLimit = []; + for (const [name, entry] of compilation.entrypoints) { + const size = getEntrypointSize(entry); + + if (size > entrypointSizeLimit) { + entrypointsOverLimit.push({ + name: name, + size: size, + files: entry.getFiles().filter(fileFilter) + }); + isOverSizeLimitSet.add(entry); + } } - ]); - return { sources, data, runtimeRequirements }; - } - serialize(context) { - const { write } = context; - write(this._shareScope); - write(this._name); - write(this._version); - write(this._request); - write(this._eager); - super.serialize(context); - } + if (hints) { + // 1. Individual Chunk: Size < 250kb + // 2. Collective Initial Chunks [entrypoint] (Each Set?): Size < 250kb + // 3. No Async Chunks + // if !1, then 2, if !2 return + if (assetsOverSizeLimit.length > 0) { + warnings.push( + new AssetsOverSizeLimitWarning(assetsOverSizeLimit, assetSizeLimit) + ); + } + if (entrypointsOverLimit.length > 0) { + warnings.push( + new EntrypointsOverSizeLimitWarning( + entrypointsOverLimit, + entrypointSizeLimit + ) + ); + } - static deserialize(context) { - const { read } = context; - const obj = new ProvideSharedModule(read(), read(), read(), read(), read()); - obj.deserialize(context); - return obj; - } -} + if (warnings.length > 0) { + const someAsyncChunk = find( + compilation.chunks, + chunk => !chunk.canBeInitial() + ); -makeSerializable( - ProvideSharedModule, - "webpack/lib/sharing/ProvideSharedModule" -); + if (!someAsyncChunk) { + warnings.push(new NoAsyncChunksWarning()); + } -module.exports = ProvideSharedModule; + if (hints === "error") { + compilation.errors.push(...warnings); + } else { + compilation.warnings.push(...warnings); + } + } + } + }); + } +}; /***/ }), -/***/ 39344: +/***/ 95175: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy */ -const ModuleFactory = __webpack_require__(51010); -const ProvideSharedModule = __webpack_require__(50821); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); -/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ -/** @typedef {import("../ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ -/** @typedef {import("./ProvideSharedDependency")} ProvideSharedDependency */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -class ProvideSharedModuleFactory extends ModuleFactory { +class ChunkPrefetchFunctionRuntimeModule extends RuntimeModule { /** - * @param {ModuleFactoryCreateData} data data object - * @param {function(Error=, ModuleFactoryResult=): void} callback callback - * @returns {void} + * @param {string} childType TODO + * @param {string} runtimeFunction TODO + * @param {string} runtimeHandlers TODO */ - create(data, callback) { - const dep = /** @type {ProvideSharedDependency} */ (data.dependencies[0]); - callback(null, { - module: new ProvideSharedModule( - dep.shareScope, - dep.name, - dep.version, - dep.request, - dep.eager - ) - }); + constructor(childType, runtimeFunction, runtimeHandlers) { + super(`chunk ${childType} function`); + this.childType = childType; + this.runtimeFunction = runtimeFunction; + this.runtimeHandlers = runtimeHandlers; + } + + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeFunction, runtimeHandlers } = this; + const { runtimeTemplate } = this.compilation; + return Template.asString([ + `${runtimeHandlers} = {};`, + `${runtimeFunction} = ${runtimeTemplate.basicFunction("chunkId", [ + // map is shorter than forEach + `Object.keys(${runtimeHandlers}).map(${runtimeTemplate.basicFunction( + "key", + `${runtimeHandlers}[key](chunkId);` + )});` + ])}` + ]); } } -module.exports = ProvideSharedModuleFactory; +module.exports = ChunkPrefetchFunctionRuntimeModule; /***/ }), -/***/ 31225: +/***/ 33895: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy + Author Tobias Koppers @sokra */ -const WebpackError = __webpack_require__(53799); -const { parseOptions } = __webpack_require__(3083); -const createSchemaValidation = __webpack_require__(32540); -const ProvideForSharedDependency = __webpack_require__(40017); -const ProvideSharedDependency = __webpack_require__(1798); -const ProvideSharedModuleFactory = __webpack_require__(39344); +const RuntimeGlobals = __webpack_require__(16475); +const ChunkPrefetchFunctionRuntimeModule = __webpack_require__(95175); +const ChunkPrefetchStartupRuntimeModule = __webpack_require__(15294); +const ChunkPrefetchTriggerRuntimeModule = __webpack_require__(98441); +const ChunkPreloadTriggerRuntimeModule = __webpack_require__(56236); -/** @typedef {import("../../declarations/plugins/sharing/ProvideSharedPlugin").ProvideSharedPluginOptions} ProvideSharedPluginOptions */ -/** @typedef {import("../Compilation")} Compilation */ /** @typedef {import("../Compiler")} Compiler */ -const validate = createSchemaValidation( - __webpack_require__(91924), - () => __webpack_require__(438), - { - name: "Provide Shared Plugin", - baseDataPath: "options" - } -); - -/** - * @typedef {Object} ProvideOptions - * @property {string} shareKey - * @property {string} shareScope - * @property {string | undefined | false} version - * @property {boolean} eager - */ - -/** @typedef {Map} ResolvedProvideMap */ - -class ProvideSharedPlugin { - /** - * @param {ProvideSharedPluginOptions} options options - */ - constructor(options) { - validate(options); - - /** @type {[string, ProvideOptions][]} */ - this._provides = parseOptions( - options.provides, - item => { - if (Array.isArray(item)) - throw new Error("Unexpected array of provides"); - /** @type {ProvideOptions} */ - const result = { - shareKey: item, - version: undefined, - shareScope: options.shareScope || "default", - eager: false - }; - return result; - }, - item => ({ - shareKey: item.shareKey, - version: item.version, - shareScope: item.shareScope || options.shareScope || "default", - eager: !!item.eager - }) - ); - this._provides.sort(([a], [b]) => { - if (a < b) return -1; - if (b < a) return 1; - return 0; - }); - } - +class ChunkPrefetchPreloadPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {Compiler} compiler the compiler * @returns {void} */ apply(compiler) { - /** @type {WeakMap} */ - const compilationData = new WeakMap(); - compiler.hooks.compilation.tap( - "ProvideSharedPlugin", - (compilation, { normalModuleFactory }) => { - /** @type {ResolvedProvideMap} */ - const resolvedProvideMap = new Map(); - /** @type {Map} */ - const matchProvides = new Map(); - /** @type {Map} */ - const prefixMatchProvides = new Map(); - for (const [request, config] of this._provides) { - if (/^(\/|[A-Za-z]:\\|\\\\|\.\.?(\/|$))/.test(request)) { - // relative request - resolvedProvideMap.set(request, { - config, - version: config.version - }); - } else if (/^(\/|[A-Za-z]:\\|\\\\)/.test(request)) { - // absolute path - resolvedProvideMap.set(request, { - config, - version: config.version - }); - } else if (request.endsWith("/")) { - // module request prefix - prefixMatchProvides.set(request, config); - } else { - // module request - matchProvides.set(request, config); - } - } - compilationData.set(compilation, resolvedProvideMap); - const provideSharedModule = ( - key, - config, - resource, - resourceResolveData - ) => { - let version = config.version; - if (version === undefined) { - let details = ""; - if (!resourceResolveData) { - details = `No resolve data provided from resolver.`; - } else { - const descriptionFileData = - resourceResolveData.descriptionFileData; - if (!descriptionFileData) { - details = - "No description file (usually package.json) found. Add description file with name and version, or manually specify version in shared config."; - } else if (!descriptionFileData.version) { - details = - "No version in description file (usually package.json). Add version to description file, or manually specify version in shared config."; - } else { - version = descriptionFileData.version; - } - } - if (!version) { - const error = new WebpackError( - `No version specified and unable to automatically determine one. ${details}` - ); - error.file = `shared module ${key} -> ${resource}`; - compilation.warnings.push(error); - } - } - resolvedProvideMap.set(resource, { - config, - version - }); - }; - normalModuleFactory.hooks.module.tap( - "ProvideSharedPlugin", - (module, { resource, resourceResolveData }, resolveData) => { - if (resolvedProvideMap.has(resource)) { - return module; - } - const { request } = resolveData; - { - const config = matchProvides.get(request); - if (config !== undefined) { - provideSharedModule( - request, - config, - resource, - resourceResolveData - ); - resolveData.cacheable = false; - } + "ChunkPrefetchPreloadPlugin", + compilation => { + compilation.hooks.additionalChunkRuntimeRequirements.tap( + "ChunkPrefetchPreloadPlugin", + (chunk, set, { chunkGraph }) => { + if (chunkGraph.getNumberOfEntryModules(chunk) === 0) return; + const startupChildChunks = chunk.getChildrenOfTypeInOrder( + chunkGraph, + "prefetchOrder" + ); + if (startupChildChunks) { + set.add(RuntimeGlobals.prefetchChunk); + set.add(RuntimeGlobals.onChunksLoaded); + compilation.addRuntimeModule( + chunk, + new ChunkPrefetchStartupRuntimeModule(startupChildChunks) + ); } - for (const [prefix, config] of prefixMatchProvides) { - if (request.startsWith(prefix)) { - const remainder = request.slice(prefix.length); - provideSharedModule( - resource, - { - ...config, - shareKey: config.shareKey + remainder - }, - resource, - resourceResolveData - ); - resolveData.cacheable = false; - } + } + ); + compilation.hooks.additionalTreeRuntimeRequirements.tap( + "ChunkPrefetchPreloadPlugin", + (chunk, set, { chunkGraph }) => { + const chunkMap = chunk.getChildIdsByOrdersMap(chunkGraph, false); + + if (chunkMap.prefetch) { + set.add(RuntimeGlobals.prefetchChunk); + compilation.addRuntimeModule( + chunk, + new ChunkPrefetchTriggerRuntimeModule(chunkMap.prefetch) + ); + } + if (chunkMap.preload) { + set.add(RuntimeGlobals.preloadChunk); + compilation.addRuntimeModule( + chunk, + new ChunkPreloadTriggerRuntimeModule(chunkMap.preload) + ); } - return module; } ); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.prefetchChunk) + .tap("ChunkPrefetchPreloadPlugin", (chunk, set) => { + compilation.addRuntimeModule( + chunk, + new ChunkPrefetchFunctionRuntimeModule( + "prefetch", + RuntimeGlobals.prefetchChunk, + RuntimeGlobals.prefetchChunkHandlers + ) + ); + set.add(RuntimeGlobals.prefetchChunkHandlers); + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.preloadChunk) + .tap("ChunkPrefetchPreloadPlugin", (chunk, set) => { + compilation.addRuntimeModule( + chunk, + new ChunkPrefetchFunctionRuntimeModule( + "preload", + RuntimeGlobals.preloadChunk, + RuntimeGlobals.preloadChunkHandlers + ) + ); + set.add(RuntimeGlobals.preloadChunkHandlers); + }); } ); - compiler.hooks.finishMake.tapPromise("ProvideSharedPlugin", compilation => { - const resolvedProvideMap = compilationData.get(compilation); - if (!resolvedProvideMap) return Promise.resolve(); - return Promise.all( - Array.from( - resolvedProvideMap, - ([resource, { config, version }]) => - new Promise((resolve, reject) => { - compilation.addInclude( - compiler.context, - new ProvideSharedDependency( - config.shareScope, - config.shareKey, - version || false, - resource, - config.eager - ), - { - name: undefined - }, - err => { - if (err) return reject(err); - resolve(); - } - ); - }) - ) - ).then(() => {}); - }); + } +} - compiler.hooks.compilation.tap( - "ProvideSharedPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - ProvideForSharedDependency, - normalModuleFactory - ); +module.exports = ChunkPrefetchPreloadPlugin; - compilation.dependencyFactories.set( - ProvideSharedDependency, - new ProvideSharedModuleFactory() - ); - } + +/***/ }), + +/***/ 15294: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); + +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ + +class ChunkPrefetchStartupRuntimeModule extends RuntimeModule { + /** + * @param {{ onChunks: Chunk[], chunks: Set }[]} startupChunks chunk ids to trigger when chunks are loaded + */ + constructor(startupChunks) { + super("startup prefetch", RuntimeModule.STAGE_TRIGGER); + this.startupChunks = startupChunks; + } + + /** + * @returns {string} runtime code + */ + generate() { + const { startupChunks, chunk } = this; + const { runtimeTemplate } = this.compilation; + return Template.asString( + startupChunks.map( + ({ onChunks, chunks }) => + `${RuntimeGlobals.onChunksLoaded}(0, ${JSON.stringify( + // This need to include itself to delay execution after this chunk has been fully loaded + onChunks.filter(c => c === chunk).map(c => c.id) + )}, ${runtimeTemplate.basicFunction( + "", + chunks.size < 3 + ? Array.from( + chunks, + c => + `${RuntimeGlobals.prefetchChunk}(${JSON.stringify(c.id)});` + ) + : `${JSON.stringify(Array.from(chunks, c => c.id))}.map(${ + RuntimeGlobals.prefetchChunk + });` + )}, 5);` + ) ); } } -module.exports = ProvideSharedPlugin; +module.exports = ChunkPrefetchStartupRuntimeModule; /***/ }), -/***/ 26335: +/***/ 98441: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy */ -const { parseOptions } = __webpack_require__(3083); -const ConsumeSharedPlugin = __webpack_require__(15046); -const ProvideSharedPlugin = __webpack_require__(31225); -const { isRequiredVersion } = __webpack_require__(84379); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); -/** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumeSharedPluginOptions} ConsumeSharedPluginOptions */ -/** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumesConfig} ConsumesConfig */ -/** @typedef {import("../../declarations/plugins/sharing/ProvideSharedPlugin").ProvideSharedPluginOptions} ProvideSharedPluginOptions */ -/** @typedef {import("../../declarations/plugins/sharing/ProvideSharedPlugin").ProvidesConfig} ProvidesConfig */ -/** @typedef {import("../../declarations/plugins/sharing/SharePlugin").SharePluginOptions} SharePluginOptions */ -/** @typedef {import("../../declarations/plugins/sharing/SharePlugin").SharedConfig} SharedConfig */ -/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -class SharePlugin { +class ChunkPrefetchTriggerRuntimeModule extends RuntimeModule { /** - * @param {SharePluginOptions} options options + * @param {Record} chunkMap map from chunk to */ - constructor(options) { - /** @type {[string, SharedConfig][]} */ - const sharedOptions = parseOptions( - options.shared, - (item, key) => { - if (typeof item !== "string") - throw new Error("Unexpected array in shared"); - /** @type {SharedConfig} */ - const config = - item === key || !isRequiredVersion(item) - ? { - import: item - } - : { - import: key, - requiredVersion: item - }; - return config; - }, - item => item - ); - /** @type {Record[]} */ - const consumes = sharedOptions.map(([key, options]) => ({ - [key]: { - import: options.import, - shareKey: options.shareKey || key, - shareScope: options.shareScope, - requiredVersion: options.requiredVersion, - strictVersion: options.strictVersion, - singleton: options.singleton, - packageName: options.packageName, - eager: options.eager - } - })); - /** @type {Record[]} */ - const provides = sharedOptions - .filter(([, options]) => options.import !== false) - .map(([key, options]) => ({ - [options.import || key]: { - shareKey: options.shareKey || key, - shareScope: options.shareScope, - version: options.version, - eager: options.eager - } - })); - this._shareScope = options.shareScope; - this._consumes = consumes; - this._provides = provides; + constructor(chunkMap) { + super(`chunk prefetch trigger`, RuntimeModule.STAGE_TRIGGER); + this.chunkMap = chunkMap; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @returns {string} runtime code */ - apply(compiler) { - new ConsumeSharedPlugin({ - shareScope: this._shareScope, - consumes: this._consumes - }).apply(compiler); - new ProvideSharedPlugin({ - shareScope: this._shareScope, - provides: this._provides - }).apply(compiler); + generate() { + const { chunkMap } = this; + const { runtimeTemplate } = this.compilation; + const body = [ + "var chunks = chunkToChildrenMap[chunkId];", + `Array.isArray(chunks) && chunks.map(${RuntimeGlobals.prefetchChunk});` + ]; + return Template.asString([ + Template.asString([ + `var chunkToChildrenMap = ${JSON.stringify(chunkMap, null, "\t")};`, + `${ + RuntimeGlobals.ensureChunkHandlers + }.prefetch = ${runtimeTemplate.expressionFunction( + `Promise.all(promises).then(${runtimeTemplate.basicFunction( + "", + body + )})`, + "chunkId, promises" + )};` + ]) + ]); } } -module.exports = SharePlugin; +module.exports = ChunkPrefetchTriggerRuntimeModule; /***/ }), -/***/ 96066: +/***/ 56236: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ const RuntimeGlobals = __webpack_require__(16475); const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); -const { - compareModulesByIdentifier, - compareStrings -} = __webpack_require__(29579); +const Template = __webpack_require__(39722); -class ShareRuntimeModule extends RuntimeModule { - constructor() { - super("sharing"); +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ + +class ChunkPreloadTriggerRuntimeModule extends RuntimeModule { + /** + * @param {Record} chunkMap map from chunk to chunks + */ + constructor(chunkMap) { + super(`chunk preload trigger`, RuntimeModule.STAGE_TRIGGER); + this.chunkMap = chunkMap; } /** * @returns {string} runtime code */ generate() { - const { compilation, chunkGraph } = this; - const { - runtimeTemplate, - codeGenerationResults, - outputOptions: { uniqueName } - } = compilation; - /** @type {Map>>} */ - const initCodePerScope = new Map(); - for (const chunk of this.chunk.getAllReferencedChunks()) { - const modules = chunkGraph.getOrderedChunkModulesIterableBySourceType( - chunk, - "share-init", - compareModulesByIdentifier - ); - if (!modules) continue; - for (const m of modules) { - const data = codeGenerationResults.getData( - m, - chunk.runtime, - "share-init" - ); - if (!data) continue; - for (const item of data) { - const { shareScope, initStage, init } = item; - let stages = initCodePerScope.get(shareScope); - if (stages === undefined) { - initCodePerScope.set(shareScope, (stages = new Map())); - } - let list = stages.get(initStage || 0); - if (list === undefined) { - stages.set(initStage || 0, (list = new Set())); - } - list.add(init); - } - } - } + const { chunkMap } = this; + const { runtimeTemplate } = this.compilation; + const body = [ + "var chunks = chunkToChildrenMap[chunkId];", + `Array.isArray(chunks) && chunks.map(${RuntimeGlobals.preloadChunk});` + ]; return Template.asString([ - `${RuntimeGlobals.shareScopeMap} = {};`, - "var initPromises = {};", - "var initTokens = {};", - `${RuntimeGlobals.initializeSharing} = ${runtimeTemplate.basicFunction( - "name, initScope", - [ - "if(!initScope) initScope = [];", - "// handling circular init calls", - "var initToken = initTokens[name];", - "if(!initToken) initToken = initTokens[name] = {};", - "if(initScope.indexOf(initToken) >= 0) return;", - "initScope.push(initToken);", - "// only runs once", - "if(initPromises[name]) return initPromises[name];", - "// creates a new share scope if needed", - `if(!${RuntimeGlobals.hasOwnProperty}(${RuntimeGlobals.shareScopeMap}, name)) ${RuntimeGlobals.shareScopeMap}[name] = {};`, - "// runs all init snippets from all modules reachable", - `var scope = ${RuntimeGlobals.shareScopeMap}[name];`, - `var warn = ${runtimeTemplate.returningFunction( - 'typeof console !== "undefined" && console.warn && console.warn(msg)', - "msg" - )};`, - `var uniqueName = ${JSON.stringify(uniqueName || undefined)};`, - `var register = ${runtimeTemplate.basicFunction( - "name, version, factory, eager", - [ - "var versions = scope[name] = scope[name] || {};", - "var activeVersion = versions[version];", - "if(!activeVersion || (!activeVersion.loaded && (!eager != !activeVersion.eager ? eager : uniqueName > activeVersion.from))) versions[version] = { get: factory, from: uniqueName, eager: !!eager };" - ] - )};`, - `var initExternal = ${runtimeTemplate.basicFunction("id", [ - `var handleError = ${runtimeTemplate.expressionFunction( - 'warn("Initialization of sharing external failed: " + err)', - "err" - )};`, - "try {", - Template.indent([ - "var module = __webpack_require__(id);", - "if(!module) return;", - `var initFn = ${runtimeTemplate.returningFunction( - `module && module.init && module.init(${RuntimeGlobals.shareScopeMap}[name], initScope)`, - "module" - )}`, - "if(module.then) return promises.push(module.then(initFn, handleError));", - "var initResult = initFn(module);", - "if(initResult && initResult.then) return promises.push(initResult['catch'](handleError));" - ]), - "} catch(err) { handleError(err); }" - ])}`, - "var promises = [];", - "switch(name) {", - ...Array.from(initCodePerScope) - .sort(([a], [b]) => compareStrings(a, b)) - .map(([name, stages]) => - Template.indent([ - `case ${JSON.stringify(name)}: {`, - Template.indent( - Array.from(stages) - .sort(([a], [b]) => a - b) - .map(([, initCode]) => - Template.asString(Array.from(initCode)) - ) - ), - "}", - "break;" - ]) - ), - "}", - "if(!promises.length) return initPromises[name] = 1;", - `return initPromises[name] = Promise.all(promises).then(${runtimeTemplate.returningFunction( - "initPromises[name] = 1" - )});` - ] - )};` + Template.asString([ + `var chunkToChildrenMap = ${JSON.stringify(chunkMap, null, "\t")};`, + `${ + RuntimeGlobals.ensureChunkHandlers + }.preload = ${runtimeTemplate.basicFunction("chunkId", body)};` + ]) ]); } } -module.exports = ShareRuntimeModule; +module.exports = ChunkPreloadTriggerRuntimeModule; /***/ }), -/***/ 3591: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 30318: +/***/ (function(module) { "use strict"; /* @@ -116394,96 +114966,44 @@ module.exports = ShareRuntimeModule; -const ModuleNotFoundError = __webpack_require__(32882); -const LazySet = __webpack_require__(38938); - -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../ResolverFactory").ResolveOptionsWithDependencyType} ResolveOptionsWithDependencyType */ +/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */ -/** - * @template T - * @typedef {Object} MatchedConfigs - * @property {Map} resolved - * @property {Map} unresolved - * @property {Map} prefixed - */ +class BasicEffectRulePlugin { + constructor(ruleProperty, effectType) { + this.ruleProperty = ruleProperty; + this.effectType = effectType || ruleProperty; + } -/** @type {ResolveOptionsWithDependencyType} */ -const RESOLVE_OPTIONS = { dependencyType: "esm" }; + /** + * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler + * @returns {void} + */ + apply(ruleSetCompiler) { + ruleSetCompiler.hooks.rule.tap( + "BasicEffectRulePlugin", + (path, rule, unhandledProperties, result, references) => { + if (unhandledProperties.has(this.ruleProperty)) { + unhandledProperties.delete(this.ruleProperty); -/** - * @template T - * @param {Compilation} compilation the compilation - * @param {[string, T][]} configs to be processed configs - * @returns {Promise>} resolved matchers - */ -exports.resolveMatchedConfigs = (compilation, configs) => { - /** @type {Map} */ - const resolved = new Map(); - /** @type {Map} */ - const unresolved = new Map(); - /** @type {Map} */ - const prefixed = new Map(); - const resolveContext = { - /** @type {LazySet} */ - fileDependencies: new LazySet(), - /** @type {LazySet} */ - contextDependencies: new LazySet(), - /** @type {LazySet} */ - missingDependencies: new LazySet() - }; - const resolver = compilation.resolverFactory.get("normal", RESOLVE_OPTIONS); - const context = compilation.compiler.context; + const value = rule[this.ruleProperty]; - return Promise.all( - configs.map(([request, config]) => { - if (/^\.\.?(\/|$)/.test(request)) { - // relative request - return new Promise(resolve => { - resolver.resolve( - {}, - context, - request, - resolveContext, - (err, result) => { - if (err || result === false) { - err = err || new Error(`Can't resolve ${request}`); - compilation.errors.push( - new ModuleNotFoundError(null, err, { - name: `shared module ${request}` - }) - ); - return resolve(); - } - resolved.set(result, config); - resolve(); - } - ); - }); - } else if (/^(\/|[A-Za-z]:\\|\\\\)/.test(request)) { - // absolute path - resolved.set(request, config); - } else if (request.endsWith("/")) { - // module request prefix - prefixed.set(request, config); - } else { - // module request - unresolved.set(request, config); + result.effects.push({ + type: this.effectType, + value + }); + } } - }) - ).then(() => { - compilation.contextDependencies.addAll(resolveContext.contextDependencies); - compilation.fileDependencies.addAll(resolveContext.fileDependencies); - compilation.missingDependencies.addAll(resolveContext.missingDependencies); - return { resolved, unresolved, prefixed }; - }); -}; + ); + } +} + +module.exports = BasicEffectRulePlugin; /***/ }), -/***/ 84379: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 94215: +/***/ (function(module) { "use strict"; /* @@ -116493,95 +115013,52 @@ exports.resolveMatchedConfigs = (compilation, configs) => { -const { join, dirname, readJson } = __webpack_require__(17139); - -/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */ +/** @typedef {import("./RuleSetCompiler").RuleCondition} RuleCondition */ -/** - * @param {string} str maybe required version - * @returns {boolean} true, if it looks like a version - */ -exports.isRequiredVersion = str => { - return /^([\d^=v<>~]|[*xX]$)/.test(str); -}; +class BasicMatcherRulePlugin { + constructor(ruleProperty, dataProperty, invert) { + this.ruleProperty = ruleProperty; + this.dataProperty = dataProperty || ruleProperty; + this.invert = invert || false; + } -/** - * - * @param {InputFileSystem} fs file system - * @param {string} directory directory to start looking into - * @param {string[]} descriptionFiles possible description filenames - * @param {function((Error | null)=, {data: object, path: string}=): void} callback callback - */ -const getDescriptionFile = (fs, directory, descriptionFiles, callback) => { - let i = 0; - const tryLoadCurrent = () => { - if (i >= descriptionFiles.length) { - const parentDirectory = dirname(fs, directory); - if (!parentDirectory || parentDirectory === directory) return callback(); - return getDescriptionFile( - fs, - parentDirectory, - descriptionFiles, - callback - ); - } - const filePath = join(fs, directory, descriptionFiles[i]); - readJson(fs, filePath, (err, data) => { - if (err) { - if ("code" in err && err.code === "ENOENT") { - i++; - return tryLoadCurrent(); + /** + * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler + * @returns {void} + */ + apply(ruleSetCompiler) { + ruleSetCompiler.hooks.rule.tap( + "BasicMatcherRulePlugin", + (path, rule, unhandledProperties, result) => { + if (unhandledProperties.has(this.ruleProperty)) { + unhandledProperties.delete(this.ruleProperty); + const value = rule[this.ruleProperty]; + const condition = ruleSetCompiler.compileCondition( + `${path}.${this.ruleProperty}`, + value + ); + const fn = condition.fn; + result.conditions.push({ + property: this.dataProperty, + matchWhenEmpty: this.invert + ? !condition.matchWhenEmpty + : condition.matchWhenEmpty, + fn: this.invert ? v => !fn(v) : fn + }); } - return callback(err); } - if (!data || typeof data !== "object" || Array.isArray(data)) { - return callback( - new Error(`Description file ${filePath} is not an object`) - ); - } - callback(null, { data, path: filePath }); - }); - }; - tryLoadCurrent(); -}; -exports.getDescriptionFile = getDescriptionFile; - -exports.getRequiredVersionFromDescriptionFile = (data, packageName) => { - if ( - data.optionalDependencies && - typeof data.optionalDependencies === "object" && - packageName in data.optionalDependencies - ) { - return data.optionalDependencies[packageName]; - } - if ( - data.dependencies && - typeof data.dependencies === "object" && - packageName in data.dependencies - ) { - return data.dependencies[packageName]; - } - if ( - data.peerDependencies && - typeof data.peerDependencies === "object" && - packageName in data.peerDependencies - ) { - return data.peerDependencies[packageName]; - } - if ( - data.devDependencies && - typeof data.devDependencies === "object" && - packageName in data.devDependencies - ) { - return data.devDependencies[packageName]; + ); } -}; +} + +module.exports = BasicMatcherRulePlugin; /***/ }), -/***/ 71760: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 72021: +/***/ (function(module) { "use strict"; /* @@ -116591,4124 +115068,2401 @@ exports.getRequiredVersionFromDescriptionFile = (data, packageName) => { -const util = __webpack_require__(73837); -const ModuleDependency = __webpack_require__(80321); -const formatLocation = __webpack_require__(16734); -const { LogType } = __webpack_require__(32597); -const AggressiveSplittingPlugin = __webpack_require__(15543); -const SizeLimitsPlugin = __webpack_require__(32557); -const { countIterable } = __webpack_require__(39104); -const { - compareLocations, - compareChunksById, - compareNumbers, - compareIds, - concatComparators, - compareSelect, - compareModulesByIdentifier -} = __webpack_require__(29579); -const { makePathsRelative, parseResource } = __webpack_require__(82186); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../ChunkGroup").OriginRecord} OriginRecord */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Compilation").Asset} Asset */ -/** @typedef {import("../Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("../Compilation").NormalizedStatsOptions} NormalizedStatsOptions */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("../ModuleProfile")} ModuleProfile */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @template T @typedef {import("../util/comparators").Comparator} Comparator */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -/** @typedef {import("../util/smartGrouping").GroupConfig} GroupConfig */ -/** @typedef {import("./StatsFactory")} StatsFactory */ -/** @typedef {import("./StatsFactory").StatsFactoryContext} StatsFactoryContext */ - -/** @typedef {KnownStatsCompilation & Record} StatsCompilation */ -/** - * @typedef {Object} KnownStatsCompilation - * @property {any=} env - * @property {string=} name - * @property {string=} hash - * @property {string=} version - * @property {number=} time - * @property {number=} builtAt - * @property {boolean=} needAdditionalPass - * @property {string=} publicPath - * @property {string=} outputPath - * @property {Record=} assetsByChunkName - * @property {StatsAsset[]=} assets - * @property {number=} filteredAssets - * @property {StatsChunk[]=} chunks - * @property {StatsModule[]=} modules - * @property {number=} filteredModules - * @property {Record=} entrypoints - * @property {Record=} namedChunkGroups - * @property {StatsError[]=} errors - * @property {number=} errorsCount - * @property {StatsError[]=} warnings - * @property {number=} warningsCount - * @property {StatsCompilation[]=} children - * @property {Record=} logging - */ - -/** @typedef {KnownStatsLogging & Record} StatsLogging */ -/** - * @typedef {Object} KnownStatsLogging - * @property {StatsLoggingEntry[]} entries - * @property {number} filteredEntries - * @property {boolean} debug - */ - -/** @typedef {KnownStatsLoggingEntry & Record} StatsLoggingEntry */ -/** - * @typedef {Object} KnownStatsLoggingEntry - * @property {string} type - * @property {string} message - * @property {string[]=} trace - * @property {StatsLoggingEntry[]=} children - * @property {any[]=} args - * @property {number=} time - */ - -/** @typedef {KnownStatsAsset & Record} StatsAsset */ -/** - * @typedef {Object} KnownStatsAsset - * @property {string} type - * @property {string} name - * @property {AssetInfo} info - * @property {number} size - * @property {boolean} emitted - * @property {boolean} comparedForEmit - * @property {boolean} cached - * @property {StatsAsset[]=} related - * @property {(string|number)[]=} chunkNames - * @property {(string|number)[]=} chunkIdHints - * @property {(string|number)[]=} chunks - * @property {(string|number)[]=} auxiliaryChunkNames - * @property {(string|number)[]=} auxiliaryChunks - * @property {(string|number)[]=} auxiliaryChunkIdHints - * @property {number=} filteredRelated - * @property {boolean=} isOverSizeLimit - */ - -/** @typedef {KnownStatsChunkGroup & Record} StatsChunkGroup */ -/** - * @typedef {Object} KnownStatsChunkGroup - * @property {string=} name - * @property {(string|number)[]=} chunks - * @property {({ name: string, size?: number })[]=} assets - * @property {number=} filteredAssets - * @property {number=} assetsSize - * @property {({ name: string, size?: number })[]=} auxiliaryAssets - * @property {number=} filteredAuxiliaryAssets - * @property {number=} auxiliaryAssetsSize - * @property {{ [x: string]: StatsChunkGroup[] }=} children - * @property {{ [x: string]: string[] }=} childAssets - * @property {boolean=} isOverSizeLimit - */ - -/** @typedef {KnownStatsModule & Record} StatsModule */ -/** - * @typedef {Object} KnownStatsModule - * @property {string=} type - * @property {string=} moduleType - * @property {string=} layer - * @property {string=} identifier - * @property {string=} name - * @property {string=} nameForCondition - * @property {number=} index - * @property {number=} preOrderIndex - * @property {number=} index2 - * @property {number=} postOrderIndex - * @property {number=} size - * @property {{[x: string]: number}=} sizes - * @property {boolean=} cacheable - * @property {boolean=} built - * @property {boolean=} codeGenerated - * @property {boolean=} buildTimeExecuted - * @property {boolean=} cached - * @property {boolean=} optional - * @property {boolean=} orphan - * @property {string|number=} id - * @property {string|number=} issuerId - * @property {(string|number)[]=} chunks - * @property {(string|number)[]=} assets - * @property {boolean=} dependent - * @property {string=} issuer - * @property {string=} issuerName - * @property {StatsModuleIssuer[]=} issuerPath - * @property {boolean=} failed - * @property {number=} errors - * @property {number=} warnings - * @property {StatsProfile=} profile - * @property {StatsModuleReason[]=} reasons - * @property {(boolean | string[])=} usedExports - * @property {string[]=} providedExports - * @property {string[]=} optimizationBailout - * @property {number=} depth - * @property {StatsModule[]=} modules - * @property {number=} filteredModules - * @property {ReturnType=} source - */ - -/** @typedef {KnownStatsProfile & Record} StatsProfile */ -/** - * @typedef {Object} KnownStatsProfile - * @property {number} total - * @property {number} resolving - * @property {number} restoring - * @property {number} building - * @property {number} integration - * @property {number} storing - * @property {number} additionalResolving - * @property {number} additionalIntegration - * @property {number} factory - * @property {number} dependencies - */ +/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */ +/** @typedef {import("./RuleSetCompiler").RuleCondition} RuleCondition */ -/** @typedef {KnownStatsModuleIssuer & Record} StatsModuleIssuer */ -/** - * @typedef {Object} KnownStatsModuleIssuer - * @property {string=} identifier - * @property {string=} name - * @property {(string|number)=} id - * @property {StatsProfile=} profile - */ +class ObjectMatcherRulePlugin { + constructor(ruleProperty, dataProperty) { + this.ruleProperty = ruleProperty; + this.dataProperty = dataProperty || ruleProperty; + } -/** @typedef {KnownStatsModuleReason & Record} StatsModuleReason */ -/** - * @typedef {Object} KnownStatsModuleReason - * @property {string=} moduleIdentifier - * @property {string=} module - * @property {string=} moduleName - * @property {string=} resolvedModuleIdentifier - * @property {string=} resolvedModule - * @property {string=} type - * @property {boolean} active - * @property {string=} explanation - * @property {string=} userRequest - * @property {string=} loc - * @property {(string|number)=} moduleId - * @property {(string|number)=} resolvedModuleId - */ + /** + * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler + * @returns {void} + */ + apply(ruleSetCompiler) { + const { ruleProperty, dataProperty } = this; + ruleSetCompiler.hooks.rule.tap( + "ObjectMatcherRulePlugin", + (path, rule, unhandledProperties, result) => { + if (unhandledProperties.has(ruleProperty)) { + unhandledProperties.delete(ruleProperty); + const value = rule[ruleProperty]; + for (const property of Object.keys(value)) { + const nestedDataProperties = property.split("."); + const condition = ruleSetCompiler.compileCondition( + `${path}.${ruleProperty}.${property}`, + value[property] + ); + result.conditions.push({ + property: [dataProperty, ...nestedDataProperties], + matchWhenEmpty: condition.matchWhenEmpty, + fn: condition.fn + }); + } + } + } + ); + } +} -/** @typedef {KnownStatsChunk & Record} StatsChunk */ -/** - * @typedef {Object} KnownStatsChunk - * @property {boolean} rendered - * @property {boolean} initial - * @property {boolean} entry - * @property {boolean} recorded - * @property {string=} reason - * @property {number} size - * @property {Record=} sizes - * @property {string[]=} names - * @property {string[]=} idHints - * @property {string[]=} runtime - * @property {string[]=} files - * @property {string[]=} auxiliaryFiles - * @property {string} hash - * @property {Record=} childrenByOrder - * @property {(string|number)=} id - * @property {(string|number)[]=} siblings - * @property {(string|number)[]=} parents - * @property {(string|number)[]=} children - * @property {StatsModule[]=} modules - * @property {number=} filteredModules - * @property {StatsChunkOrigin[]=} origins - */ +module.exports = ObjectMatcherRulePlugin; -/** @typedef {KnownStatsChunkOrigin & Record} StatsChunkOrigin */ -/** - * @typedef {Object} KnownStatsChunkOrigin - * @property {string=} module - * @property {string=} moduleIdentifier - * @property {string=} moduleName - * @property {string=} loc - * @property {string=} request - * @property {(string|number)=} moduleId - */ -/** @typedef {KnownStatsModuleTraceItem & Record} StatsModuleTraceItem */ -/** - * @typedef {Object} KnownStatsModuleTraceItem - * @property {string=} originIdentifier - * @property {string=} originName - * @property {string=} moduleIdentifier - * @property {string=} moduleName - * @property {StatsModuleTraceDependency[]=} dependencies - * @property {(string|number)=} originId - * @property {(string|number)=} moduleId - */ +/***/ }), -/** @typedef {KnownStatsModuleTraceDependency & Record} StatsModuleTraceDependency */ -/** - * @typedef {Object} KnownStatsModuleTraceDependency - * @property {string=} loc - */ +/***/ 83349: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** @typedef {KnownStatsError & Record} StatsError */ -/** - * @typedef {Object} KnownStatsError - * @property {string} message - * @property {string=} chunkName - * @property {boolean=} chunkEntry - * @property {boolean=} chunkInitial - * @property {string=} file - * @property {string=} moduleIdentifier - * @property {string=} moduleName - * @property {string=} loc - * @property {string|number=} chunkId - * @property {string|number=} moduleId - * @property {StatsModuleTraceItem[]=} moduleTrace - * @property {any=} details - * @property {string=} stack - */ +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/** @typedef {Asset & { type: string, related: PreprocessedAsset[] }} PreprocessedAsset */ -/** - * @template T - * @template O - * @typedef {Record void>} ExtractorsByOption - */ -/** - * @typedef {Object} SimpleExtractors - * @property {ExtractorsByOption} compilation - * @property {ExtractorsByOption} asset - * @property {ExtractorsByOption} asset$visible - * @property {ExtractorsByOption<{ name: string, chunkGroup: ChunkGroup }, StatsChunkGroup>} chunkGroup - * @property {ExtractorsByOption} module - * @property {ExtractorsByOption} module$visible - * @property {ExtractorsByOption} moduleIssuer - * @property {ExtractorsByOption} profile - * @property {ExtractorsByOption} moduleReason - * @property {ExtractorsByOption} chunk - * @property {ExtractorsByOption} chunkOrigin - * @property {ExtractorsByOption} error - * @property {ExtractorsByOption} warning - * @property {ExtractorsByOption<{ origin: Module, module: Module }, StatsModuleTraceItem>} moduleTraceItem - * @property {ExtractorsByOption} moduleTraceDependency - */ +const { SyncHook } = __webpack_require__(41242); /** - * @template T - * @template I - * @param {Iterable} items items to select from - * @param {function(T): Iterable} selector selector function to select values from item - * @returns {I[]} array of values + * @typedef {Object} RuleCondition + * @property {string | string[]} property + * @property {boolean} matchWhenEmpty + * @property {function(string): boolean} fn */ -const uniqueArray = (items, selector) => { - /** @type {Set} */ - const set = new Set(); - for (const item of items) { - for (const i of selector(item)) { - set.add(i); - } - } - return Array.from(set); -}; /** - * @template T - * @template I - * @param {Iterable} items items to select from - * @param {function(T): Iterable} selector selector function to select values from item - * @param {Comparator} comparator comparator function - * @returns {I[]} array of values - */ -const uniqueOrderedArray = (items, selector, comparator) => { - return uniqueArray(items, selector).sort(comparator); -}; + * @typedef {Object} Condition + * @property {boolean} matchWhenEmpty + * @property {function(string): boolean} fn + */ -/** @template T @template R @typedef {{ [P in keyof T]: R }} MappedValues */ +/** + * @typedef {Object} CompiledRule + * @property {RuleCondition[]} conditions + * @property {(Effect|function(object): Effect[])[]} effects + * @property {CompiledRule[]=} rules + * @property {CompiledRule[]=} oneOf + */ /** - * @template T - * @template R - * @param {T} obj object to be mapped - * @param {function(T[keyof T], keyof T): R} fn mapping function - * @returns {MappedValues} mapped object + * @typedef {Object} Effect + * @property {string} type + * @property {any} value */ -const mapObject = (obj, fn) => { - const newObj = Object.create(null); - for (const key of Object.keys(obj)) { - newObj[key] = fn(obj[key], /** @type {keyof T} */ (key)); - } - return newObj; -}; /** - * @param {Compilation} compilation the compilation - * @param {function(Compilation, string): any[]} getItems get items - * @returns {number} total number + * @typedef {Object} RuleSet + * @property {Map} references map of references in the rule set (may grow over time) + * @property {function(object): Effect[]} exec execute the rule set */ -const countWithChildren = (compilation, getItems) => { - let count = getItems(compilation, "").length; - for (const child of compilation.children) { - count += countWithChildren(child, (c, type) => - getItems(c, `.children[].compilation${type}`) - ); - } - return count; -}; -/** @type {ExtractorsByOption} */ -const EXTRACT_ERROR = { - _: (object, error, context, { requestShortener }) => { - // TODO webpack 6 disallow strings in the errors/warnings list - if (typeof error === "string") { - object.message = error; - } else { - if (error.chunk) { - object.chunkName = error.chunk.name; - object.chunkEntry = error.chunk.hasRuntime(); - object.chunkInitial = error.chunk.canBeInitial(); - } - if (error.file) { - object.file = error.file; +class RuleSetCompiler { + constructor(plugins) { + this.hooks = Object.freeze({ + /** @type {SyncHook<[string, object, Set, CompiledRule, Map]>} */ + rule: new SyncHook([ + "path", + "rule", + "unhandledProperties", + "compiledRule", + "references" + ]) + }); + if (plugins) { + for (const plugin of plugins) { + plugin.apply(this); } - if (error.module) { - object.moduleIdentifier = error.module.identifier(); - object.moduleName = error.module.readableIdentifier(requestShortener); + } + } + + /** + * @param {object[]} ruleSet raw user provided rules + * @returns {RuleSet} compiled RuleSet + */ + compile(ruleSet) { + const refs = new Map(); + const rules = this.compileRules("ruleSet", ruleSet, refs); + + /** + * @param {object} data data passed in + * @param {CompiledRule} rule the compiled rule + * @param {Effect[]} effects an array where effects are pushed to + * @returns {boolean} true, if the rule has matched + */ + const execRule = (data, rule, effects) => { + for (const condition of rule.conditions) { + const p = condition.property; + if (Array.isArray(p)) { + let current = data; + for (const subProperty of p) { + if ( + current && + typeof current === "object" && + Object.prototype.hasOwnProperty.call(current, subProperty) + ) { + current = current[subProperty]; + } else { + current = undefined; + break; + } + } + if (current !== undefined) { + if (!condition.fn(current)) return false; + continue; + } + } else if (p in data) { + const value = data[p]; + if (value !== undefined) { + if (!condition.fn(value)) return false; + continue; + } + } + if (!condition.matchWhenEmpty) { + return false; + } } - if (error.loc) { - object.loc = formatLocation(error.loc); + for (const effect of rule.effects) { + if (typeof effect === "function") { + const returnedEffects = effect(data); + for (const effect of returnedEffects) { + effects.push(effect); + } + } else { + effects.push(effect); + } } - object.message = error.message; - } - }, - ids: (object, error, { compilation: { chunkGraph } }) => { - if (typeof error !== "string") { - if (error.chunk) { - object.chunkId = error.chunk.id; + if (rule.rules) { + for (const childRule of rule.rules) { + execRule(data, childRule, effects); + } } - if (error.module) { - object.moduleId = chunkGraph.getModuleId(error.module); + if (rule.oneOf) { + for (const childRule of rule.oneOf) { + if (execRule(data, childRule, effects)) { + break; + } + } } - } - }, - moduleTrace: (object, error, context, options, factory) => { - if (typeof error !== "string" && error.module) { - const { - type, - compilation: { moduleGraph } - } = context; - /** @type {Set} */ - const visitedModules = new Set(); - const moduleTrace = []; - let current = error.module; - while (current) { - if (visitedModules.has(current)) break; // circular (technically impossible, but how knows) - visitedModules.add(current); - const origin = moduleGraph.getIssuer(current); - if (!origin) break; - moduleTrace.push({ origin, module: current }); - current = origin; + return true; + }; + + return { + references: refs, + exec: data => { + /** @type {Effect[]} */ + const effects = []; + for (const rule of rules) { + execRule(data, rule, effects); + } + return effects; } - object.moduleTrace = factory.create( - `${type}.moduleTrace`, - moduleTrace, - context - ); + }; + } + + /** + * @param {string} path current path + * @param {object[]} rules the raw rules provided by user + * @param {Map} refs references + * @returns {CompiledRule[]} rules + */ + compileRules(path, rules, refs) { + return rules.map((rule, i) => + this.compileRule(`${path}[${i}]`, rule, refs) + ); + } + + /** + * @param {string} path current path + * @param {object} rule the raw rule provided by user + * @param {Map} refs references + * @returns {CompiledRule} normalized and compiled rule for processing + */ + compileRule(path, rule, refs) { + const unhandledProperties = new Set( + Object.keys(rule).filter(key => rule[key] !== undefined) + ); + + /** @type {CompiledRule} */ + const compiledRule = { + conditions: [], + effects: [], + rules: undefined, + oneOf: undefined + }; + + this.hooks.rule.call(path, rule, unhandledProperties, compiledRule, refs); + + if (unhandledProperties.has("rules")) { + unhandledProperties.delete("rules"); + const rules = rule.rules; + if (!Array.isArray(rules)) + throw this.error(path, rules, "Rule.rules must be an array of rules"); + compiledRule.rules = this.compileRules(`${path}.rules`, rules, refs); } - }, - errorDetails: ( - object, - error, - { type, compilation, cachedGetErrors, cachedGetWarnings }, - { errorDetails } - ) => { - if ( - typeof error !== "string" && - (errorDetails === true || - (type.endsWith(".error") && cachedGetErrors(compilation).length < 3)) - ) { - object.details = error.details; + + if (unhandledProperties.has("oneOf")) { + unhandledProperties.delete("oneOf"); + const oneOf = rule.oneOf; + if (!Array.isArray(oneOf)) + throw this.error(path, oneOf, "Rule.oneOf must be an array of rules"); + compiledRule.oneOf = this.compileRules(`${path}.oneOf`, oneOf, refs); } - }, - errorStack: (object, error) => { - if (typeof error !== "string") { - object.stack = error.stack; + + if (unhandledProperties.size > 0) { + throw this.error( + path, + rule, + `Properties ${Array.from(unhandledProperties).join(", ")} are unknown` + ); } + + return compiledRule; } -}; -/** @type {SimpleExtractors} */ -const SIMPLE_EXTRACTORS = { - compilation: { - _: (object, compilation, context, options) => { - if (!context.makePathsRelative) { - context.makePathsRelative = makePathsRelative.bindContextCache( - compilation.compiler.context, - compilation.compiler.root - ); - } - if (!context.cachedGetErrors) { - const map = new WeakMap(); - context.cachedGetErrors = compilation => { - return ( - map.get(compilation) || - (errors => (map.set(compilation, errors), errors))( - compilation.getErrors() - ) - ); + /** + * @param {string} path current path + * @param {any} condition user provided condition value + * @returns {Condition} compiled condition + */ + compileCondition(path, condition) { + if (condition === "") { + return { + matchWhenEmpty: true, + fn: str => str === "" + }; + } + if (!condition) { + throw this.error( + path, + condition, + "Expected condition but got falsy value" + ); + } + if (typeof condition === "string") { + return { + matchWhenEmpty: condition.length === 0, + fn: str => typeof str === "string" && str.startsWith(condition) + }; + } + if (typeof condition === "function") { + try { + return { + matchWhenEmpty: condition(""), + fn: condition }; + } catch (err) { + throw this.error( + path, + condition, + "Evaluation of condition function threw error" + ); } - if (!context.cachedGetWarnings) { - const map = new WeakMap(); - context.cachedGetWarnings = compilation => { - return ( - map.get(compilation) || - (warnings => (map.set(compilation, warnings), warnings))( - compilation.getWarnings() - ) + } + if (condition instanceof RegExp) { + return { + matchWhenEmpty: condition.test(""), + fn: v => typeof v === "string" && condition.test(v) + }; + } + if (Array.isArray(condition)) { + const items = condition.map((c, i) => + this.compileCondition(`${path}[${i}]`, c) + ); + return this.combineConditionsOr(items); + } + + if (typeof condition !== "object") { + throw this.error( + path, + condition, + `Unexpected ${typeof condition} when condition was expected` + ); + } + + const conditions = []; + for (const key of Object.keys(condition)) { + const value = condition[key]; + switch (key) { + case "or": + if (value) { + if (!Array.isArray(value)) { + throw this.error( + `${path}.or`, + condition.and, + "Expected array of conditions" + ); + } + conditions.push(this.compileCondition(`${path}.or`, value)); + } + break; + case "and": + if (value) { + if (!Array.isArray(value)) { + throw this.error( + `${path}.and`, + condition.and, + "Expected array of conditions" + ); + } + let i = 0; + for (const item of value) { + conditions.push(this.compileCondition(`${path}.and[${i}]`, item)); + i++; + } + } + break; + case "not": + if (value) { + const matcher = this.compileCondition(`${path}.not`, value); + const fn = matcher.fn; + conditions.push({ + matchWhenEmpty: !matcher.matchWhenEmpty, + fn: v => !fn(v) + }); + } + break; + default: + throw this.error( + `${path}.${key}`, + condition[key], + `Unexpected property ${key} in condition` ); - }; - } - if (compilation.name) { - object.name = compilation.name; - } - if (compilation.needAdditionalPass) { - object.needAdditionalPass = true; } + } + if (conditions.length === 0) { + throw this.error( + path, + condition, + "Expected condition, but got empty thing" + ); + } + return this.combineConditionsAnd(conditions); + } - const { logging, loggingDebug, loggingTrace } = options; - if (logging || (loggingDebug && loggingDebug.length > 0)) { - const util = __webpack_require__(73837); - object.logging = {}; - let acceptedTypes; - let collapsedGroups = false; - switch (logging) { - default: - acceptedTypes = new Set(); - break; - case "error": - acceptedTypes = new Set([LogType.error]); - break; - case "warn": - acceptedTypes = new Set([LogType.error, LogType.warn]); - break; - case "info": - acceptedTypes = new Set([ - LogType.error, - LogType.warn, - LogType.info - ]); - break; - case "log": - acceptedTypes = new Set([ - LogType.error, - LogType.warn, - LogType.info, - LogType.log, - LogType.group, - LogType.groupEnd, - LogType.groupCollapsed, - LogType.clear - ]); - break; - case "verbose": - acceptedTypes = new Set([ - LogType.error, - LogType.warn, - LogType.info, - LogType.log, - LogType.group, - LogType.groupEnd, - LogType.groupCollapsed, - LogType.profile, - LogType.profileEnd, - LogType.time, - LogType.status, - LogType.clear - ]); - collapsedGroups = true; - break; - } - const cachedMakePathsRelative = makePathsRelative.bindContextCache( - options.context, - compilation.compiler.root - ); - let depthInCollapsedGroup = 0; - for (const [origin, logEntries] of compilation.logging) { - const debugMode = loggingDebug.some(fn => fn(origin)); - if (logging === false && !debugMode) continue; - /** @type {KnownStatsLoggingEntry[]} */ - const groupStack = []; - /** @type {KnownStatsLoggingEntry[]} */ - const rootList = []; - let currentList = rootList; - let processedLogEntries = 0; - for (const entry of logEntries) { - let type = entry.type; - if (!debugMode && !acceptedTypes.has(type)) continue; + /** + * @param {Condition[]} conditions some conditions + * @returns {Condition} merged condition + */ + combineConditionsOr(conditions) { + if (conditions.length === 0) { + return { + matchWhenEmpty: false, + fn: () => false + }; + } else if (conditions.length === 1) { + return conditions[0]; + } else { + return { + matchWhenEmpty: conditions.some(c => c.matchWhenEmpty), + fn: v => conditions.some(c => c.fn(v)) + }; + } + } + + /** + * @param {Condition[]} conditions some conditions + * @returns {Condition} merged condition + */ + combineConditionsAnd(conditions) { + if (conditions.length === 0) { + return { + matchWhenEmpty: false, + fn: () => false + }; + } else if (conditions.length === 1) { + return conditions[0]; + } else { + return { + matchWhenEmpty: conditions.every(c => c.matchWhenEmpty), + fn: v => conditions.every(c => c.fn(v)) + }; + } + } - // Expand groups in verbose and debug modes - if ( - type === LogType.groupCollapsed && - (debugMode || collapsedGroups) - ) - type = LogType.group; + /** + * @param {string} path current path + * @param {any} value value at the error location + * @param {string} message message explaining the problem + * @returns {Error} an error object + */ + error(path, value, message) { + return new Error( + `Compiling RuleSet failed: ${message} (at ${path}: ${value})` + ); + } +} - if (depthInCollapsedGroup === 0) { - processedLogEntries++; +module.exports = RuleSetCompiler; + + +/***/ }), + +/***/ 84977: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const util = __webpack_require__(73837); + +/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */ +/** @typedef {import("./RuleSetCompiler").Effect} Effect */ + +class UseEffectRulePlugin { + /** + * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler + * @returns {void} + */ + apply(ruleSetCompiler) { + ruleSetCompiler.hooks.rule.tap( + "UseEffectRulePlugin", + (path, rule, unhandledProperties, result, references) => { + const conflictWith = (property, correctProperty) => { + if (unhandledProperties.has(property)) { + throw ruleSetCompiler.error( + `${path}.${property}`, + rule[property], + `A Rule must not have a '${property}' property when it has a '${correctProperty}' property` + ); + } + }; + + if (unhandledProperties.has("use")) { + unhandledProperties.delete("use"); + unhandledProperties.delete("enforce"); + + conflictWith("loader", "use"); + conflictWith("options", "use"); + + const use = rule.use; + const enforce = rule.enforce; + + const type = enforce ? `use-${enforce}` : "use"; + + /** + * + * @param {string} path options path + * @param {string} defaultIdent default ident when none is provided + * @param {object} item user provided use value + * @returns {Effect|function(any): Effect[]} effect + */ + const useToEffect = (path, defaultIdent, item) => { + if (typeof item === "function") { + return data => useToEffectsWithoutIdent(path, item(data)); + } else { + return useToEffectRaw(path, defaultIdent, item); } + }; - if (type === LogType.groupEnd) { - groupStack.pop(); - if (groupStack.length > 0) { - currentList = groupStack[groupStack.length - 1].children; - } else { - currentList = rootList; + /** + * + * @param {string} path options path + * @param {string} defaultIdent default ident when none is provided + * @param {object} item user provided use value + * @returns {Effect} effect + */ + const useToEffectRaw = (path, defaultIdent, item) => { + if (typeof item === "string") { + return { + type, + value: { + loader: item, + options: undefined, + ident: undefined + } + }; + } else { + const loader = item.loader; + const options = item.options; + let ident = item.ident; + if (options && typeof options === "object") { + if (!ident) ident = defaultIdent; + references.set(ident, options); } - if (depthInCollapsedGroup > 0) depthInCollapsedGroup--; - continue; + if (typeof options === "string") { + util.deprecate( + () => {}, + `Using a string as loader options is deprecated (${path}.options)`, + "DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING" + )(); + } + return { + type: enforce ? `use-${enforce}` : "use", + value: { + loader, + options, + ident + } + }; } - let message = undefined; - if (entry.type === LogType.time) { - message = `${entry.args[0]}: ${ - entry.args[1] * 1000 + entry.args[2] / 1000000 - } ms`; - } else if (entry.args && entry.args.length > 0) { - message = util.format(entry.args[0], ...entry.args.slice(1)); + }; + + /** + * @param {string} path options path + * @param {any} items user provided use value + * @returns {Effect[]} effects + */ + const useToEffectsWithoutIdent = (path, items) => { + if (Array.isArray(items)) { + return items.map((item, idx) => + useToEffectRaw(`${path}[${idx}]`, "[[missing ident]]", item) + ); } - /** @type {KnownStatsLoggingEntry} */ - const newEntry = { - ...entry, - type, - message, - trace: loggingTrace ? entry.trace : undefined, - children: - type === LogType.group || type === LogType.groupCollapsed - ? [] - : undefined - }; - currentList.push(newEntry); - if (newEntry.children) { - groupStack.push(newEntry); - currentList = newEntry.children; - if (depthInCollapsedGroup > 0) { - depthInCollapsedGroup++; - } else if (type === LogType.groupCollapsed) { - depthInCollapsedGroup = 1; - } + return [useToEffectRaw(path, "[[missing ident]]", items)]; + }; + + /** + * @param {string} path current path + * @param {any} items user provided use value + * @returns {(Effect|function(any): Effect[])[]} effects + */ + const useToEffects = (path, items) => { + if (Array.isArray(items)) { + return items.map((item, idx) => { + const subPath = `${path}[${idx}]`; + return useToEffect(subPath, subPath, item); + }); } - } - let name = cachedMakePathsRelative(origin).replace(/\|/g, " "); - if (name in object.logging) { - let i = 1; - while (`${name}#${i}` in object.logging) { - i++; + return [useToEffect(path, path, items)]; + }; + + if (typeof use === "function") { + result.effects.push(data => + useToEffectsWithoutIdent(`${path}.use`, use(data)) + ); + } else { + for (const effect of useToEffects(`${path}.use`, use)) { + result.effects.push(effect); } - name = `${name}#${i}`; } - object.logging[name] = { - entries: rootList, - filteredEntries: logEntries.length - processedLogEntries, - debug: debugMode - }; } - } - }, - hash: (object, compilation) => { - object.hash = compilation.hash; - }, - version: object => { - object.version = (__webpack_require__(32702)/* .version */ .i8); - }, - env: (object, compilation, context, { _env }) => { - object.env = _env; - }, - timings: (object, compilation) => { - object.time = compilation.endTime - compilation.startTime; - }, - builtAt: (object, compilation) => { - object.builtAt = compilation.endTime; - }, - publicPath: (object, compilation) => { - object.publicPath = compilation.getPath( - compilation.outputOptions.publicPath - ); - }, - outputPath: (object, compilation) => { - object.outputPath = compilation.outputOptions.path; - }, - assets: (object, compilation, context, options, factory) => { - const { type } = context; - /** @type {Map} */ - const compilationFileToChunks = new Map(); - /** @type {Map} */ - const compilationAuxiliaryFileToChunks = new Map(); - for (const chunk of compilation.chunks) { - for (const file of chunk.files) { - let array = compilationFileToChunks.get(file); - if (array === undefined) { - array = []; - compilationFileToChunks.set(file, array); + + if (unhandledProperties.has("loader")) { + unhandledProperties.delete("loader"); + unhandledProperties.delete("options"); + unhandledProperties.delete("enforce"); + + const loader = rule.loader; + const options = rule.options; + const enforce = rule.enforce; + + if (loader.includes("!")) { + throw ruleSetCompiler.error( + `${path}.loader`, + loader, + "Exclamation mark separated loader lists has been removed in favor of the 'use' property with arrays" + ); } - array.push(chunk); - } - for (const file of chunk.auxiliaryFiles) { - let array = compilationAuxiliaryFileToChunks.get(file); - if (array === undefined) { - array = []; - compilationAuxiliaryFileToChunks.set(file, array); + + if (loader.includes("?")) { + throw ruleSetCompiler.error( + `${path}.loader`, + loader, + "Query arguments on 'loader' has been removed in favor of the 'options' property" + ); } - array.push(chunk); - } - } - /** @type {Map} */ - const assetMap = new Map(); - /** @type {Set} */ - const assets = new Set(); - for (const asset of compilation.getAssets()) { - /** @type {PreprocessedAsset} */ - const item = { - ...asset, - type: "asset", - related: undefined - }; - assets.add(item); - assetMap.set(asset.name, item); - } - for (const item of assetMap.values()) { - const related = item.info.related; - if (!related) continue; - for (const type of Object.keys(related)) { - const relatedEntry = related[type]; - const deps = Array.isArray(relatedEntry) - ? relatedEntry - : [relatedEntry]; - for (const dep of deps) { - const depItem = assetMap.get(dep); - if (!depItem) continue; - assets.delete(depItem); - depItem.type = type; - item.related = item.related || []; - item.related.push(depItem); + + if (typeof options === "string") { + util.deprecate( + () => {}, + `Using a string as loader options is deprecated (${path}.options)`, + "DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING" + )(); } + + const ident = + options && typeof options === "object" ? path : undefined; + references.set(ident, options); + result.effects.push({ + type: enforce ? `use-${enforce}` : "use", + value: { + loader, + options, + ident + } + }); } } + ); + } + + useItemToEffects(path, item) {} +} + +module.exports = UseEffectRulePlugin; + + +/***/ }), + +/***/ 63672: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const HelperRuntimeModule = __webpack_require__(82444); + +class AsyncModuleRuntimeModule extends HelperRuntimeModule { + constructor() { + super("async module"); + } + + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeTemplate } = this.compilation; + const fn = RuntimeGlobals.asyncModule; + return Template.asString([ + 'var webpackThen = typeof Symbol === "function" ? Symbol("webpack then") : "__webpack_then__";', + 'var webpackExports = typeof Symbol === "function" ? Symbol("webpack exports") : "__webpack_exports__";', + 'var webpackError = typeof Symbol === "function" ? Symbol("webpack error") : "__webpack_error__";', + `var completeQueue = ${runtimeTemplate.basicFunction("queue", [ + "if(queue) {", + Template.indent([ + `queue.forEach(${runtimeTemplate.expressionFunction( + "fn.r--", + "fn" + )});`, + `queue.forEach(${runtimeTemplate.expressionFunction( + "fn.r-- ? fn.r++ : fn()", + "fn" + )});` + ]), + "}" + ])}`, + `var completeFunction = ${runtimeTemplate.expressionFunction( + "!--fn.r && fn()", + "fn" + )};`, + `var queueFunction = ${runtimeTemplate.expressionFunction( + "queue ? queue.push(fn) : completeFunction(fn)", + "queue, fn" + )};`, + `var wrapDeps = ${runtimeTemplate.returningFunction( + `deps.map(${runtimeTemplate.basicFunction("dep", [ + 'if(dep !== null && typeof dep === "object") {', + Template.indent([ + "if(dep[webpackThen]) return dep;", + "if(dep.then) {", + Template.indent([ + "var queue = [];", + `dep.then(${runtimeTemplate.basicFunction("r", [ + "obj[webpackExports] = r;", + "completeQueue(queue);", + "queue = 0;" + ])}, ${runtimeTemplate.basicFunction("e", [ + "obj[webpackError] = e;", + "completeQueue(queue);", + "queue = 0;" + ])});`, + "var obj = {};", + `obj[webpackThen] = ${runtimeTemplate.expressionFunction( + "queueFunction(queue, fn), dep['catch'](reject)", + "fn, reject" + )};`, + "return obj;" + ]), + "}" + ]), + "}", + "var ret = {};", + `ret[webpackThen] = ${runtimeTemplate.expressionFunction( + "completeFunction(fn)", + "fn" + )};`, + "ret[webpackExports] = dep;", + "return ret;" + ])})`, + "deps" + )};`, + `${fn} = ${runtimeTemplate.basicFunction("module, body, hasAwait", [ + "var queue = hasAwait && [];", + "var exports = module.exports;", + "var currentDeps;", + "var outerResolve;", + "var reject;", + "var isEvaluating = true;", + "var nested = false;", + `var whenAll = ${runtimeTemplate.basicFunction( + "deps, onResolve, onReject", + [ + "if (nested) return;", + "nested = true;", + "onResolve.r += deps.length;", + `deps.map(${runtimeTemplate.expressionFunction( + "dep[webpackThen](onResolve, onReject)", + "dep, i" + )});`, + "nested = false;" + ] + )};`, + `var promise = new Promise(${runtimeTemplate.basicFunction( + "resolve, rej", + [ + "reject = rej;", + `outerResolve = ${runtimeTemplate.expressionFunction( + "resolve(exports), completeQueue(queue), queue = 0" + )};` + ] + )});`, + "promise[webpackExports] = exports;", + `promise[webpackThen] = ${runtimeTemplate.basicFunction( + "fn, rejectFn", + [ + "if (isEvaluating) { return completeFunction(fn); }", + "if (currentDeps) whenAll(currentDeps, fn, rejectFn);", + "queueFunction(queue, fn);", + "promise['catch'](rejectFn);" + ] + )};`, + "module.exports = promise;", + `body(${runtimeTemplate.basicFunction("deps", [ + "currentDeps = wrapDeps(deps);", + "var fn;", + `var getResult = ${runtimeTemplate.returningFunction( + `currentDeps.map(${runtimeTemplate.basicFunction("d", [ + "if(d[webpackError]) throw d[webpackError];", + "return d[webpackExports];" + ])})` + )}`, + `var promise = new Promise(${runtimeTemplate.basicFunction( + "resolve, reject", + [ + `fn = ${runtimeTemplate.expressionFunction( + "resolve(getResult)" + )};`, + "fn.r = 0;", + "whenAll(currentDeps, fn, reject);" + ] + )});`, + "return fn.r ? promise : getResult();" + ])}, ${runtimeTemplate.expressionFunction( + "err && reject(promise[webpackError] = err), outerResolve()", + "err" + )});`, + "isEvaluating = false;" + ])};` + ]); + } +} + +module.exports = AsyncModuleRuntimeModule; + + +/***/ }), + +/***/ 66532: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ - object.assetsByChunkName = {}; - for (const [file, chunks] of compilationFileToChunks) { - for (const chunk of chunks) { - const name = chunk.name; - if (!name) continue; - if ( - !Object.prototype.hasOwnProperty.call( - object.assetsByChunkName, - name - ) - ) { - object.assetsByChunkName[name] = []; - } - object.assetsByChunkName[name].push(file); - } - } - const groupedAssets = factory.create( - `${type}.assets`, - Array.from(assets), - { - ...context, - compilationFileToChunks, - compilationAuxiliaryFileToChunks - } - ); - const limited = spaceLimited(groupedAssets, options.assetsSpace); - object.assets = limited.children; - object.filteredAssets = limited.filteredChildren; - }, - chunks: (object, compilation, context, options, factory) => { - const { type } = context; - object.chunks = factory.create( - `${type}.chunks`, - Array.from(compilation.chunks), - context - ); - }, - modules: (object, compilation, context, options, factory) => { - const { type } = context; - const array = Array.from(compilation.modules); - const groupedModules = factory.create(`${type}.modules`, array, context); - const limited = spaceLimited(groupedModules, options.modulesSpace); - object.modules = limited.children; - object.filteredModules = limited.filteredChildren; - }, - entrypoints: ( - object, - compilation, - context, - { entrypoints, chunkGroups, chunkGroupAuxiliary, chunkGroupChildren }, - factory - ) => { - const { type } = context; - const array = Array.from(compilation.entrypoints, ([key, value]) => ({ - name: key, - chunkGroup: value - })); - if (entrypoints === "auto" && !chunkGroups) { - if (array.length > 5) return; - if ( - !chunkGroupChildren && - array.every(({ chunkGroup }) => { - if (chunkGroup.chunks.length !== 1) return false; - const chunk = chunkGroup.chunks[0]; - return ( - chunk.files.size === 1 && - (!chunkGroupAuxiliary || chunk.auxiliaryFiles.size === 0) - ); - }) - ) { - return; - } - } - object.entrypoints = factory.create( - `${type}.entrypoints`, - array, - context - ); - }, - chunkGroups: (object, compilation, context, options, factory) => { - const { type } = context; - const array = Array.from( - compilation.namedChunkGroups, - ([key, value]) => ({ - name: key, - chunkGroup: value - }) - ); - object.namedChunkGroups = factory.create( - `${type}.namedChunkGroups`, - array, - context - ); - }, - errors: (object, compilation, context, options, factory) => { - const { type, cachedGetErrors } = context; - object.errors = factory.create( - `${type}.errors`, - cachedGetErrors(compilation), - context - ); - }, - errorsCount: (object, compilation, { cachedGetErrors }) => { - object.errorsCount = countWithChildren(compilation, c => - cachedGetErrors(c) - ); - }, - warnings: (object, compilation, context, options, factory) => { - const { type, cachedGetWarnings } = context; - object.warnings = factory.create( - `${type}.warnings`, - cachedGetWarnings(compilation), - context - ); - }, - warningsCount: ( - object, - compilation, - context, - { warningsFilter }, - factory - ) => { - const { type, cachedGetWarnings } = context; - object.warningsCount = countWithChildren(compilation, (c, childType) => { - if (!warningsFilter && warningsFilter.length === 0) - return cachedGetWarnings(c); - return factory - .create(`${type}${childType}.warnings`, cachedGetWarnings(c), context) - .filter(warning => { - const warningString = Object.keys(warning) - .map(key => `${warning[key]}`) - .join("\n"); - return !warningsFilter.some(filter => - filter(warning, warningString) - ); - }); - }); - }, - errorDetails: ( - object, - compilation, - { cachedGetErrors, cachedGetWarnings }, - { errorDetails, errors, warnings } - ) => { - if (errorDetails === "auto") { - if (warnings) { - const warnings = cachedGetWarnings(compilation); - object.filteredWarningDetailsCount = warnings - .map(e => typeof e !== "string" && e.details) - .filter(Boolean).length; - } - if (errors) { - const errors = cachedGetErrors(compilation); - if (errors.length >= 3) { - object.filteredErrorDetailsCount = errors - .map(e => typeof e !== "string" && e.details) - .filter(Boolean).length; - } - } - } - }, - children: (object, compilation, context, options, factory) => { - const { type } = context; - object.children = factory.create( - `${type}.children`, - compilation.children, - context - ); - } - }, - asset: { - _: (object, asset, context, options, factory) => { - const { compilation } = context; - object.type = asset.type; - object.name = asset.name; - object.size = asset.source.size(); - object.emitted = compilation.emittedAssets.has(asset.name); - object.comparedForEmit = compilation.comparedForEmitAssets.has( - asset.name - ); - const cached = !object.emitted && !object.comparedForEmit; - object.cached = cached; - object.info = asset.info; - if (!cached || options.cachedAssets) { - Object.assign( - object, - factory.create(`${context.type}$visible`, asset, context) - ); - } - } - }, - asset$visible: { - _: ( - object, - asset, - { compilation, compilationFileToChunks, compilationAuxiliaryFileToChunks } - ) => { - const chunks = compilationFileToChunks.get(asset.name) || []; - const auxiliaryChunks = - compilationAuxiliaryFileToChunks.get(asset.name) || []; - object.chunkNames = uniqueOrderedArray( - chunks, - c => (c.name ? [c.name] : []), - compareIds - ); - object.chunkIdHints = uniqueOrderedArray( - chunks, - c => Array.from(c.idNameHints), - compareIds - ); - object.auxiliaryChunkNames = uniqueOrderedArray( - auxiliaryChunks, - c => (c.name ? [c.name] : []), - compareIds - ); - object.auxiliaryChunkIdHints = uniqueOrderedArray( - auxiliaryChunks, - c => Array.from(c.idNameHints), - compareIds - ); - object.filteredRelated = asset.related ? asset.related.length : undefined; - }, - relatedAssets: (object, asset, context, options, factory) => { - const { type } = context; - object.related = factory.create( - `${type.slice(0, -8)}.related`, - asset.related, - context - ); - object.filteredRelated = asset.related - ? asset.related.length - object.related.length - : undefined; - }, - ids: ( - object, - asset, - { compilationFileToChunks, compilationAuxiliaryFileToChunks } - ) => { - const chunks = compilationFileToChunks.get(asset.name) || []; - const auxiliaryChunks = - compilationAuxiliaryFileToChunks.get(asset.name) || []; - object.chunks = uniqueOrderedArray(chunks, c => c.ids, compareIds); - object.auxiliaryChunks = uniqueOrderedArray( - auxiliaryChunks, - c => c.ids, - compareIds - ); - }, - performance: (object, asset) => { - object.isOverSizeLimit = SizeLimitsPlugin.isOverSizeLimit(asset.source); - } - }, - chunkGroup: { - _: ( - object, - { name, chunkGroup }, - { compilation, compilation: { moduleGraph, chunkGraph } }, - { ids, chunkGroupAuxiliary, chunkGroupChildren, chunkGroupMaxAssets } - ) => { - const children = - chunkGroupChildren && - chunkGroup.getChildrenByOrders(moduleGraph, chunkGraph); - /** - * @param {string} name Name - * @returns {{ name: string, size: number }} Asset object - */ - const toAsset = name => { - const asset = compilation.getAsset(name); - return { - name, - size: asset ? asset.info.size : -1 - }; - }; - /** @type {(total: number, asset: { size: number }) => number} */ - const sizeReducer = (total, { size }) => total + size; - const assets = uniqueArray(chunkGroup.chunks, c => c.files).map(toAsset); - const auxiliaryAssets = uniqueOrderedArray( - chunkGroup.chunks, - c => c.auxiliaryFiles, - compareIds - ).map(toAsset); - const assetsSize = assets.reduce(sizeReducer, 0); - const auxiliaryAssetsSize = auxiliaryAssets.reduce(sizeReducer, 0); - /** @type {KnownStatsChunkGroup} */ - const statsChunkGroup = { - name, - chunks: ids ? chunkGroup.chunks.map(c => c.id) : undefined, - assets: assets.length <= chunkGroupMaxAssets ? assets : undefined, - filteredAssets: - assets.length <= chunkGroupMaxAssets ? 0 : assets.length, - assetsSize, - auxiliaryAssets: - chunkGroupAuxiliary && auxiliaryAssets.length <= chunkGroupMaxAssets - ? auxiliaryAssets - : undefined, - filteredAuxiliaryAssets: - chunkGroupAuxiliary && auxiliaryAssets.length <= chunkGroupMaxAssets - ? 0 - : auxiliaryAssets.length, - auxiliaryAssetsSize, - children: children - ? mapObject(children, groups => - groups.map(group => { - const assets = uniqueArray(group.chunks, c => c.files).map( - toAsset - ); - const auxiliaryAssets = uniqueOrderedArray( - group.chunks, - c => c.auxiliaryFiles, - compareIds - ).map(toAsset); - /** @type {KnownStatsChunkGroup} */ - const childStatsChunkGroup = { - name: group.name, - chunks: ids ? group.chunks.map(c => c.id) : undefined, - assets: - assets.length <= chunkGroupMaxAssets ? assets : undefined, - filteredAssets: - assets.length <= chunkGroupMaxAssets ? 0 : assets.length, - auxiliaryAssets: - chunkGroupAuxiliary && - auxiliaryAssets.length <= chunkGroupMaxAssets - ? auxiliaryAssets - : undefined, - filteredAuxiliaryAssets: - chunkGroupAuxiliary && - auxiliaryAssets.length <= chunkGroupMaxAssets - ? 0 - : auxiliaryAssets.length - }; +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); +const JavascriptModulesPlugin = __webpack_require__(89464); +const { getUndoPath } = __webpack_require__(82186); - return childStatsChunkGroup; - }) - ) - : undefined, - childAssets: children - ? mapObject(children, groups => { - /** @type {Set} */ - const set = new Set(); - for (const group of groups) { - for (const chunk of group.chunks) { - for (const asset of chunk.files) { - set.add(asset); - } - } - } - return Array.from(set); - }) - : undefined - }; - Object.assign(object, statsChunkGroup); - }, - performance: (object, { chunkGroup }) => { - object.isOverSizeLimit = SizeLimitsPlugin.isOverSizeLimit(chunkGroup); - } - }, - module: { - _: (object, module, context, options, factory) => { - const { compilation, type } = context; - const built = compilation.builtModules.has(module); - const codeGenerated = compilation.codeGeneratedModules.has(module); - const buildTimeExecuted = - compilation.buildTimeExecutedModules.has(module); - /** @type {{[x: string]: number}} */ - const sizes = {}; - for (const sourceType of module.getSourceTypes()) { - sizes[sourceType] = module.size(sourceType); +class AutoPublicPathRuntimeModule extends RuntimeModule { + constructor() { + super("publicPath", RuntimeModule.STAGE_BASIC); + } + + /** + * @returns {string} runtime code + */ + generate() { + const { compilation } = this; + const { scriptType, importMetaName, path } = compilation.outputOptions; + const chunkName = compilation.getPath( + JavascriptModulesPlugin.getChunkFilenameTemplate( + this.chunk, + compilation.outputOptions + ), + { + chunk: this.chunk, + contentHashType: "javascript" } - /** @type {KnownStatsModule} */ - const statsModule = { - type: "module", - moduleType: module.type, - layer: module.layer, - size: module.size(), - sizes, - built, - codeGenerated, - buildTimeExecuted, - cached: !built && !codeGenerated - }; - Object.assign(object, statsModule); + ); + const undoPath = getUndoPath(chunkName, path, false); + + return Template.asString([ + "var scriptUrl;", + scriptType === "module" + ? `if (typeof ${importMetaName}.url === "string") scriptUrl = ${importMetaName}.url` + : Template.asString([ + `if (${RuntimeGlobals.global}.importScripts) scriptUrl = ${RuntimeGlobals.global}.location + "";`, + `var document = ${RuntimeGlobals.global}.document;`, + "if (!scriptUrl && document) {", + Template.indent([ + `if (document.currentScript)`, + Template.indent(`scriptUrl = document.currentScript.src`), + "if (!scriptUrl) {", + Template.indent([ + 'var scripts = document.getElementsByTagName("script");', + "if(scripts.length) scriptUrl = scripts[scripts.length - 1].src" + ]), + "}" + ]), + "}" + ]), + "// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration", + '// or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.', + 'if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");', + 'scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\\?.*$/, "").replace(/\\/[^\\/]+$/, "/");', + !undoPath + ? `${RuntimeGlobals.publicPath} = scriptUrl;` + : `${RuntimeGlobals.publicPath} = scriptUrl + ${JSON.stringify( + undoPath + )};` + ]); + } +} + +module.exports = AutoPublicPathRuntimeModule; + + +/***/ }), + +/***/ 84519: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); + +class ChunkNameRuntimeModule extends RuntimeModule { + /** + * @param {string} chunkName the chunk's name + */ + constructor(chunkName) { + super("chunkName"); + this.chunkName = chunkName; + } + + /** + * @returns {string} runtime code + */ + generate() { + return `${RuntimeGlobals.chunkName} = ${JSON.stringify(this.chunkName)};`; + } +} + +module.exports = ChunkNameRuntimeModule; + + +/***/ }), + +/***/ 44793: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const HelperRuntimeModule = __webpack_require__(82444); + +class CompatGetDefaultExportRuntimeModule extends HelperRuntimeModule { + constructor() { + super("compat get default export"); + } + + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeTemplate } = this.compilation; + const fn = RuntimeGlobals.compatGetDefaultExport; + return Template.asString([ + "// getDefaultExport function for compatibility with non-harmony modules", + `${fn} = ${runtimeTemplate.basicFunction("module", [ + "var getter = module && module.__esModule ?", + Template.indent([ + `${runtimeTemplate.returningFunction("module['default']")} :`, + `${runtimeTemplate.returningFunction("module")};` + ]), + `${RuntimeGlobals.definePropertyGetters}(getter, { a: getter });`, + "return getter;" + ])};` + ]); + } +} - if (built || codeGenerated || options.cachedModules) { - Object.assign( - object, - factory.create(`${type}$visible`, module, context) - ); - } - } - }, - module$visible: { - _: (object, module, context, { requestShortener }, factory) => { - const { compilation, type, rootModules } = context; - const { moduleGraph } = compilation; - /** @type {Module[]} */ - const path = []; - const issuer = moduleGraph.getIssuer(module); - let current = issuer; - while (current) { - path.push(current); - current = moduleGraph.getIssuer(current); - } - path.reverse(); - const profile = moduleGraph.getProfile(module); - const errors = module.getErrors(); - const errorsCount = errors !== undefined ? countIterable(errors) : 0; - const warnings = module.getWarnings(); - const warningsCount = - warnings !== undefined ? countIterable(warnings) : 0; - /** @type {{[x: string]: number}} */ - const sizes = {}; - for (const sourceType of module.getSourceTypes()) { - sizes[sourceType] = module.size(sourceType); - } - /** @type {KnownStatsModule} */ - const statsModule = { - identifier: module.identifier(), - name: module.readableIdentifier(requestShortener), - nameForCondition: module.nameForCondition(), - index: moduleGraph.getPreOrderIndex(module), - preOrderIndex: moduleGraph.getPreOrderIndex(module), - index2: moduleGraph.getPostOrderIndex(module), - postOrderIndex: moduleGraph.getPostOrderIndex(module), - cacheable: module.buildInfo.cacheable, - optional: module.isOptional(moduleGraph), - orphan: - !type.endsWith("module.modules[].module$visible") && - compilation.chunkGraph.getNumberOfModuleChunks(module) === 0, - dependent: rootModules ? !rootModules.has(module) : undefined, - issuer: issuer && issuer.identifier(), - issuerName: issuer && issuer.readableIdentifier(requestShortener), - issuerPath: - issuer && - factory.create(`${type.slice(0, -8)}.issuerPath`, path, context), - failed: errorsCount > 0, - errors: errorsCount, - warnings: warningsCount - }; - Object.assign(object, statsModule); - if (profile) { - object.profile = factory.create( - `${type.slice(0, -8)}.profile`, - profile, - context - ); - } - }, - ids: (object, module, { compilation: { chunkGraph, moduleGraph } }) => { - object.id = chunkGraph.getModuleId(module); - const issuer = moduleGraph.getIssuer(module); - object.issuerId = issuer && chunkGraph.getModuleId(issuer); - object.chunks = Array.from( - chunkGraph.getOrderedModuleChunksIterable(module, compareChunksById), - chunk => chunk.id - ); - }, - moduleAssets: (object, module) => { - object.assets = module.buildInfo.assets - ? Object.keys(module.buildInfo.assets) - : []; - }, - reasons: (object, module, context, options, factory) => { - const { - type, - compilation: { moduleGraph } - } = context; - const groupsReasons = factory.create( - `${type.slice(0, -8)}.reasons`, - Array.from(moduleGraph.getIncomingConnections(module)), - context +module.exports = CompatGetDefaultExportRuntimeModule; + + +/***/ }), + +/***/ 88234: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); + +/** @typedef {import("../MainTemplate")} MainTemplate */ + +class CompatRuntimeModule extends RuntimeModule { + constructor() { + super("compat", RuntimeModule.STAGE_ATTACH); + this.fullHash = true; + } + + /** + * @returns {string} runtime code + */ + generate() { + const { chunkGraph, chunk, compilation } = this; + const { + runtimeTemplate, + mainTemplate, + moduleTemplates, + dependencyTemplates + } = compilation; + const bootstrap = mainTemplate.hooks.bootstrap.call( + "", + chunk, + compilation.hash || "XXXX", + moduleTemplates.javascript, + dependencyTemplates + ); + const localVars = mainTemplate.hooks.localVars.call( + "", + chunk, + compilation.hash || "XXXX" + ); + const requireExtensions = mainTemplate.hooks.requireExtensions.call( + "", + chunk, + compilation.hash || "XXXX" + ); + const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk); + let requireEnsure = ""; + if (runtimeRequirements.has(RuntimeGlobals.ensureChunk)) { + const requireEnsureHandler = mainTemplate.hooks.requireEnsure.call( + "", + chunk, + compilation.hash || "XXXX", + "chunkId" ); - const limited = spaceLimited(groupsReasons, options.reasonsSpace); - object.reasons = limited.children; - object.filteredReasons = limited.filteredChildren; - }, - usedExports: ( - object, - module, - { runtime, compilation: { moduleGraph } } - ) => { - const usedExports = moduleGraph.getUsedExports(module, runtime); - if (usedExports === null) { - object.usedExports = null; - } else if (typeof usedExports === "boolean") { - object.usedExports = usedExports; - } else { - object.usedExports = Array.from(usedExports); - } - }, - providedExports: (object, module, { compilation: { moduleGraph } }) => { - const providedExports = moduleGraph.getProvidedExports(module); - object.providedExports = Array.isArray(providedExports) - ? providedExports - : null; - }, - optimizationBailout: ( - object, - module, - { compilation: { moduleGraph } }, - { requestShortener } - ) => { - object.optimizationBailout = moduleGraph - .getOptimizationBailout(module) - .map(item => { - if (typeof item === "function") return item(requestShortener); - return item; - }); - }, - depth: (object, module, { compilation: { moduleGraph } }) => { - object.depth = moduleGraph.getDepth(module); - }, - nestedModules: (object, module, context, options, factory) => { - const { type } = context; - const innerModules = /** @type {Module & { modules?: Module[] }} */ ( - module - ).modules; - if (Array.isArray(innerModules)) { - const groupedModules = factory.create( - `${type.slice(0, -8)}.modules`, - innerModules, - context - ); - const limited = spaceLimited( - groupedModules, - options.nestedModulesSpace - ); - object.modules = limited.children; - object.filteredModules = limited.filteredChildren; - } - }, - source: (object, module) => { - const originalSource = module.originalSource(); - if (originalSource) { - object.source = originalSource.source(); - } - } - }, - profile: { - _: (object, profile) => { - /** @type {KnownStatsProfile} */ - const statsProfile = { - total: - profile.factory + - profile.restoring + - profile.integration + - profile.building + - profile.storing, - resolving: profile.factory, - restoring: profile.restoring, - building: profile.building, - integration: profile.integration, - storing: profile.storing, - additionalResolving: profile.additionalFactories, - additionalIntegration: profile.additionalIntegration, - // TODO remove this in webpack 6 - factory: profile.factory, - // TODO remove this in webpack 6 - dependencies: profile.additionalFactories - }; - Object.assign(object, statsProfile); - } - }, - moduleIssuer: { - _: (object, module, context, { requestShortener }, factory) => { - const { compilation, type } = context; - const { moduleGraph } = compilation; - const profile = moduleGraph.getProfile(module); - /** @type {KnownStatsModuleIssuer} */ - const statsModuleIssuer = { - identifier: module.identifier(), - name: module.readableIdentifier(requestShortener) - }; - Object.assign(object, statsModuleIssuer); - if (profile) { - object.profile = factory.create(`${type}.profile`, profile, context); - } - }, - ids: (object, module, { compilation: { chunkGraph } }) => { - object.id = chunkGraph.getModuleId(module); - } - }, - moduleReason: { - _: (object, reason, { runtime }, { requestShortener }) => { - const dep = reason.dependency; - const moduleDep = - dep && dep instanceof ModuleDependency ? dep : undefined; - /** @type {KnownStatsModuleReason} */ - const statsModuleReason = { - moduleIdentifier: reason.originModule - ? reason.originModule.identifier() - : null, - module: reason.originModule - ? reason.originModule.readableIdentifier(requestShortener) - : null, - moduleName: reason.originModule - ? reason.originModule.readableIdentifier(requestShortener) - : null, - resolvedModuleIdentifier: reason.resolvedOriginModule - ? reason.resolvedOriginModule.identifier() - : null, - resolvedModule: reason.resolvedOriginModule - ? reason.resolvedOriginModule.readableIdentifier(requestShortener) - : null, - type: reason.dependency ? reason.dependency.type : null, - active: reason.isActive(runtime), - explanation: reason.explanation, - userRequest: (moduleDep && moduleDep.userRequest) || null - }; - Object.assign(object, statsModuleReason); - if (reason.dependency) { - const locInfo = formatLocation(reason.dependency.loc); - if (locInfo) { - object.loc = locInfo; - } + if (requireEnsureHandler) { + requireEnsure = `${ + RuntimeGlobals.ensureChunkHandlers + }.compat = ${runtimeTemplate.basicFunction( + "chunkId, promises", + requireEnsureHandler + )};`; } - }, - ids: (object, reason, { compilation: { chunkGraph } }) => { - object.moduleId = reason.originModule - ? chunkGraph.getModuleId(reason.originModule) - : null; - object.resolvedModuleId = reason.resolvedOriginModule - ? chunkGraph.getModuleId(reason.resolvedOriginModule) - : null; } - }, - chunk: { - _: (object, chunk, { makePathsRelative, compilation: { chunkGraph } }) => { - const childIdByOrder = chunk.getChildIdsByOrders(chunkGraph); + return [bootstrap, localVars, requireEnsure, requireExtensions] + .filter(Boolean) + .join("\n"); + } - /** @type {KnownStatsChunk} */ - const statsChunk = { - rendered: chunk.rendered, - initial: chunk.canBeInitial(), - entry: chunk.hasRuntime(), - recorded: AggressiveSplittingPlugin.wasChunkRecorded(chunk), - reason: chunk.chunkReason, - size: chunkGraph.getChunkModulesSize(chunk), - sizes: chunkGraph.getChunkModulesSizes(chunk), - names: chunk.name ? [chunk.name] : [], - idHints: Array.from(chunk.idNameHints), - runtime: - chunk.runtime === undefined - ? undefined - : typeof chunk.runtime === "string" - ? [makePathsRelative(chunk.runtime)] - : Array.from(chunk.runtime.sort(), makePathsRelative), - files: Array.from(chunk.files), - auxiliaryFiles: Array.from(chunk.auxiliaryFiles).sort(compareIds), - hash: chunk.renderedHash, - childrenByOrder: childIdByOrder - }; - Object.assign(object, statsChunk); - }, - ids: (object, chunk) => { - object.id = chunk.id; - }, - chunkRelations: (object, chunk, { compilation: { chunkGraph } }) => { - /** @type {Set} */ - const parents = new Set(); - /** @type {Set} */ - const children = new Set(); - /** @type {Set} */ - const siblings = new Set(); + /** + * @returns {boolean} true, if the runtime module should get it's own scope + */ + shouldIsolate() { + // We avoid isolating this to have better backward-compat + return false; + } +} - for (const chunkGroup of chunk.groupsIterable) { - for (const parentGroup of chunkGroup.parentsIterable) { - for (const chunk of parentGroup.chunks) { - parents.add(chunk.id); - } - } - for (const childGroup of chunkGroup.childrenIterable) { - for (const chunk of childGroup.chunks) { - children.add(chunk.id); - } - } - for (const sibling of chunkGroup.chunks) { - if (sibling !== chunk) siblings.add(sibling.id); - } - } - object.siblings = Array.from(siblings).sort(compareIds); - object.parents = Array.from(parents).sort(compareIds); - object.children = Array.from(children).sort(compareIds); - }, - chunkModules: (object, chunk, context, options, factory) => { - const { - type, - compilation: { chunkGraph } - } = context; - const array = chunkGraph.getChunkModules(chunk); - const groupedModules = factory.create(`${type}.modules`, array, { - ...context, - runtime: chunk.runtime, - rootModules: new Set(chunkGraph.getChunkRootModules(chunk)) - }); - const limited = spaceLimited(groupedModules, options.chunkModulesSpace); - object.modules = limited.children; - object.filteredModules = limited.filteredChildren; - }, - chunkOrigins: (object, chunk, context, options, factory) => { - const { - type, - compilation: { chunkGraph } - } = context; - /** @type {Set} */ - const originsKeySet = new Set(); - const origins = []; - for (const g of chunk.groupsIterable) { - origins.push(...g.origins); - } - const array = origins.filter(origin => { - const key = [ - origin.module ? chunkGraph.getModuleId(origin.module) : undefined, - formatLocation(origin.loc), - origin.request - ].join(); - if (originsKeySet.has(key)) return false; - originsKeySet.add(key); - return true; - }); - object.origins = factory.create(`${type}.origins`, array, context); - } - }, - chunkOrigin: { - _: (object, origin, context, { requestShortener }) => { - /** @type {KnownStatsChunkOrigin} */ - const statsChunkOrigin = { - module: origin.module ? origin.module.identifier() : "", - moduleIdentifier: origin.module ? origin.module.identifier() : "", - moduleName: origin.module - ? origin.module.readableIdentifier(requestShortener) - : "", - loc: formatLocation(origin.loc), - request: origin.request - }; - Object.assign(object, statsChunkOrigin); - }, - ids: (object, origin, { compilation: { chunkGraph } }) => { - object.moduleId = origin.module - ? chunkGraph.getModuleId(origin.module) - : undefined; - } - }, - error: EXTRACT_ERROR, - warning: EXTRACT_ERROR, - moduleTraceItem: { - _: (object, { origin, module }, context, { requestShortener }, factory) => { - const { - type, - compilation: { moduleGraph } - } = context; - object.originIdentifier = origin.identifier(); - object.originName = origin.readableIdentifier(requestShortener); - object.moduleIdentifier = module.identifier(); - object.moduleName = module.readableIdentifier(requestShortener); - const dependencies = Array.from( - moduleGraph.getIncomingConnections(module) - ) - .filter(c => c.resolvedOriginModule === origin && c.dependency) - .map(c => c.dependency); - object.dependencies = factory.create( - `${type}.dependencies`, - Array.from(new Set(dependencies)), - context - ); - }, - ids: (object, { origin, module }, { compilation: { chunkGraph } }) => { - object.originId = chunkGraph.getModuleId(origin); - object.moduleId = chunkGraph.getModuleId(module); - } - }, - moduleTraceDependency: { - _: (object, dependency) => { - object.loc = formatLocation(dependency.loc); - } +module.exports = CompatRuntimeModule; + + +/***/ }), + +/***/ 94669: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const HelperRuntimeModule = __webpack_require__(82444); + +class CreateFakeNamespaceObjectRuntimeModule extends HelperRuntimeModule { + constructor() { + super("create fake namespace object"); + } + + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeTemplate } = this.compilation; + const fn = RuntimeGlobals.createFakeNamespaceObject; + return Template.asString([ + `var getProto = Object.getPrototypeOf ? ${runtimeTemplate.returningFunction( + "Object.getPrototypeOf(obj)", + "obj" + )} : ${runtimeTemplate.returningFunction("obj.__proto__", "obj")};`, + "var leafPrototypes;", + "// create a fake namespace object", + "// mode & 1: value is a module id, require it", + "// mode & 2: merge all properties of value into the ns", + "// mode & 4: return value when already ns object", + "// mode & 16: return value when it's Promise-like", + "// mode & 8|1: behave like require", + // Note: must be a function (not arrow), because this is used in body! + `${fn} = function(value, mode) {`, + Template.indent([ + `if(mode & 1) value = this(value);`, + `if(mode & 8) return value;`, + "if(typeof value === 'object' && value) {", + Template.indent([ + "if((mode & 4) && value.__esModule) return value;", + "if((mode & 16) && typeof value.then === 'function') return value;" + ]), + "}", + "var ns = Object.create(null);", + `${RuntimeGlobals.makeNamespaceObject}(ns);`, + "var def = {};", + "leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];", + "for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {", + Template.indent([ + `Object.getOwnPropertyNames(current).forEach(${runtimeTemplate.expressionFunction( + `def[key] = ${runtimeTemplate.returningFunction("value[key]", "")}`, + "key" + )});` + ]), + "}", + `def['default'] = ${runtimeTemplate.returningFunction("value", "")};`, + `${RuntimeGlobals.definePropertyGetters}(ns, def);`, + "return ns;" + ]), + "};" + ]); } -}; +} -/** @type {Record boolean | undefined>>} */ -const FILTER = { - "module.reasons": { - "!orphanModules": (reason, { compilation: { chunkGraph } }) => { - if ( - reason.originModule && - chunkGraph.getNumberOfModuleChunks(reason.originModule) === 0 - ) { - return false; - } - } - } -}; +module.exports = CreateFakeNamespaceObjectRuntimeModule; -/** @type {Record boolean | undefined>>} */ -const FILTER_RESULTS = { - "compilation.warnings": { - warningsFilter: util.deprecate( - (warning, context, { warningsFilter }) => { - const warningString = Object.keys(warning) - .map(key => `${warning[key]}`) - .join("\n"); - return !warningsFilter.some(filter => filter(warning, warningString)); - }, - "config.stats.warningsFilter is deprecated in favor of config.ignoreWarnings", - "DEP_WEBPACK_STATS_WARNINGS_FILTER" - ) + +/***/ }), + +/***/ 2759: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const HelperRuntimeModule = __webpack_require__(82444); + +class CreateScriptRuntimeModule extends HelperRuntimeModule { + constructor() { + super("trusted types script"); } -}; -/** @type {Record void>} */ -const MODULES_SORTER = { - _: (comparators, { compilation: { moduleGraph } }) => { - comparators.push( - compareSelect( - /** - * @param {Module} m module - * @returns {number} depth - */ - m => moduleGraph.getDepth(m), - compareNumbers - ), - compareSelect( - /** - * @param {Module} m module - * @returns {number} index - */ - m => moduleGraph.getPreOrderIndex(m), - compareNumbers - ), - compareSelect( - /** - * @param {Module} m module - * @returns {string} identifier - */ - m => m.identifier(), - compareIds - ) + /** + * @returns {string} runtime code + */ + generate() { + const { compilation } = this; + const { runtimeTemplate, outputOptions } = compilation; + const { trustedTypes } = outputOptions; + const fn = RuntimeGlobals.createScript; + + return Template.asString( + `${fn} = ${runtimeTemplate.returningFunction( + trustedTypes + ? `${RuntimeGlobals.getTrustedTypesPolicy}().createScript(script)` + : "script", + "script" + )};` ); } -}; +} -/** @type {Record void>>} */ -const SORTERS = { - "compilation.chunks": { - _: comparators => { - comparators.push(compareSelect(c => c.id, compareIds)); - } - }, - "compilation.modules": MODULES_SORTER, - "chunk.rootModules": MODULES_SORTER, - "chunk.modules": MODULES_SORTER, - "module.modules": MODULES_SORTER, - "module.reasons": { - _: (comparators, { compilation: { chunkGraph } }) => { - comparators.push( - compareSelect(x => x.originModule, compareModulesByIdentifier) - ); - comparators.push( - compareSelect(x => x.resolvedOriginModule, compareModulesByIdentifier) - ); - comparators.push( - compareSelect( - x => x.dependency, - concatComparators( - compareSelect( - /** - * @param {Dependency} x dependency - * @returns {DependencyLocation} location - */ - x => x.loc, - compareLocations - ), - compareSelect(x => x.type, compareIds) - ) - ) - ); - } - }, - "chunk.origins": { - _: (comparators, { compilation: { chunkGraph } }) => { - comparators.push( - compareSelect( - origin => - origin.module ? chunkGraph.getModuleId(origin.module) : undefined, - compareIds - ), - compareSelect(origin => formatLocation(origin.loc), compareIds), - compareSelect(origin => origin.request, compareIds) - ); - } - } -}; +module.exports = CreateScriptRuntimeModule; -const getItemSize = item => { - // Each item takes 1 line - // + the size of the children - // + 1 extra line when it has children and filteredChildren - return !item.children - ? 1 - : item.filteredChildren - ? 2 + getTotalSize(item.children) - : 1 + getTotalSize(item.children); -}; -const getTotalSize = children => { - let size = 0; - for (const child of children) { - size += getItemSize(child); +/***/ }), + +/***/ 21213: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const HelperRuntimeModule = __webpack_require__(82444); + +class CreateScriptUrlRuntimeModule extends HelperRuntimeModule { + constructor() { + super("trusted types script url"); } - return size; -}; -const getTotalItems = children => { - let count = 0; - for (const child of children) { - if (!child.children && !child.filteredChildren) { - count++; - } else { - if (child.children) count += getTotalItems(child.children); - if (child.filteredChildren) count += child.filteredChildren; - } + /** + * @returns {string} runtime code + */ + generate() { + const { compilation } = this; + const { runtimeTemplate, outputOptions } = compilation; + const { trustedTypes } = outputOptions; + const fn = RuntimeGlobals.createScriptUrl; + + return Template.asString( + `${fn} = ${runtimeTemplate.returningFunction( + trustedTypes + ? `${RuntimeGlobals.getTrustedTypesPolicy}().createScriptURL(url)` + : "url", + "url" + )};` + ); } - return count; -}; +} -const collapse = children => { - // After collapse each child must take exactly one line - const newChildren = []; - for (const child of children) { - if (child.children) { - let filteredChildren = child.filteredChildren || 0; - filteredChildren += getTotalItems(child.children); - newChildren.push({ - ...child, - children: undefined, - filteredChildren - }); - } else { - newChildren.push(child); - } +module.exports = CreateScriptUrlRuntimeModule; + + +/***/ }), + +/***/ 75481: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const HelperRuntimeModule = __webpack_require__(82444); + +class DefinePropertyGettersRuntimeModule extends HelperRuntimeModule { + constructor() { + super("define property getters"); } - return newChildren; -}; -const spaceLimited = ( - itemsAndGroups, - max, - filteredChildrenLineReserved = false -) => { - if (max < 1) { - return { - children: undefined, - filteredChildren: getTotalItems(itemsAndGroups) - }; + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeTemplate } = this.compilation; + const fn = RuntimeGlobals.definePropertyGetters; + return Template.asString([ + "// define getter functions for harmony exports", + `${fn} = ${runtimeTemplate.basicFunction("exports, definition", [ + `for(var key in definition) {`, + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(definition, key) && !${RuntimeGlobals.hasOwnProperty}(exports, key)) {`, + Template.indent([ + "Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });" + ]), + "}" + ]), + "}" + ])};` + ]); } - /** @type {any[] | undefined} */ - let children = undefined; - /** @type {number | undefined} */ - let filteredChildren = undefined; - // This are the groups, which take 1+ lines each - const groups = []; - // The sizes of the groups are stored in groupSizes - const groupSizes = []; - // This are the items, which take 1 line each - const items = []; - // The total of group sizes - let groupsSize = 0; +} - for (const itemOrGroup of itemsAndGroups) { - // is item - if (!itemOrGroup.children && !itemOrGroup.filteredChildren) { - items.push(itemOrGroup); - } else { - groups.push(itemOrGroup); - const size = getItemSize(itemOrGroup); - groupSizes.push(size); - groupsSize += size; - } +module.exports = DefinePropertyGettersRuntimeModule; + + +/***/ }), + +/***/ 71519: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); + +class EnsureChunkRuntimeModule extends RuntimeModule { + constructor(runtimeRequirements) { + super("ensure chunk"); + this.runtimeRequirements = runtimeRequirements; } - if (groupsSize + items.length <= max) { - // The total size in the current state fits into the max - // keep all - children = groups.length > 0 ? groups.concat(items) : items; - } else if (groups.length === 0) { - // slice items to max - // inner space marks that lines for filteredChildren already reserved - const limit = max - (filteredChildrenLineReserved ? 0 : 1); - filteredChildren = items.length - limit; - items.length = limit; - children = items; - } else { - // limit is the size when all groups are collapsed - const limit = - groups.length + - (filteredChildrenLineReserved || items.length === 0 ? 0 : 1); - if (limit < max) { - // calculate how much we are over the size limit - // this allows to approach the limit faster - let oversize; - // If each group would take 1 line the total would be below the maximum - // collapse some groups, keep items - while ( - (oversize = - groupsSize + - items.length + - (filteredChildren && !filteredChildrenLineReserved ? 1 : 0) - - max) > 0 - ) { - // Find the maximum group and process only this one - const maxGroupSize = Math.max(...groupSizes); - if (maxGroupSize < items.length) { - filteredChildren = items.length; - items.length = 0; - continue; - } - for (let i = 0; i < groups.length; i++) { - if (groupSizes[i] === maxGroupSize) { - const group = groups[i]; - // run this algorithm recursively and limit the size of the children to - // current size - oversize / number of groups - // So it should always end up being smaller - const headerSize = group.filteredChildren ? 2 : 1; - const limited = spaceLimited( - group.children, - maxGroupSize - - // we should use ceil to always feet in max - Math.ceil(oversize / groups.length) - - // we substitute size of group head - headerSize, - headerSize === 2 - ); - groups[i] = { - ...group, - children: limited.children, - filteredChildren: limited.filteredChildren - ? (group.filteredChildren || 0) + limited.filteredChildren - : group.filteredChildren - }; - const newSize = getItemSize(groups[i]); - groupsSize -= maxGroupSize - newSize; - groupSizes[i] = newSize; - break; - } - } - } - children = groups.concat(items); - } else if (limit === max) { - // If we have only enough space to show one line per group and one line for the filtered items - // collapse all groups and items - children = collapse(groups); - filteredChildren = items.length; + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeTemplate } = this.compilation; + // Check if there are non initial chunks which need to be imported using require-ensure + if (this.runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers)) { + const handlers = RuntimeGlobals.ensureChunkHandlers; + return Template.asString([ + `${handlers} = {};`, + "// This file contains only the entry chunk.", + "// The chunk loading function for additional chunks", + `${RuntimeGlobals.ensureChunk} = ${runtimeTemplate.basicFunction( + "chunkId", + [ + `return Promise.all(Object.keys(${handlers}).reduce(${runtimeTemplate.basicFunction( + "promises, key", + [`${handlers}[key](chunkId, promises);`, "return promises;"] + )}, []));` + ] + )};` + ]); } else { - // If we have no space - // collapse complete group - filteredChildren = getTotalItems(itemsAndGroups); + // There ensureChunk is used somewhere in the tree, so we need an empty requireEnsure + // function. This can happen with multiple entrypoints. + return Template.asString([ + "// The chunk loading function for additional chunks", + "// Since all referenced chunks are already included", + "// in this file, this function is empty here.", + `${RuntimeGlobals.ensureChunk} = ${runtimeTemplate.returningFunction( + "Promise.resolve()" + )};` + ]); } } +} - return { - children, - filteredChildren - }; -}; +module.exports = EnsureChunkRuntimeModule; -const assetGroup = (children, assets) => { - let size = 0; - for (const asset of children) { - size += asset.size; - } - return { - size - }; -}; -const moduleGroup = (children, modules) => { - let size = 0; - const sizes = {}; - for (const module of children) { - size += module.size; - for (const key of Object.keys(module.sizes)) { - sizes[key] = (sizes[key] || 0) + module.sizes[key]; - } - } - return { - size, - sizes - }; -}; +/***/ }), + +/***/ 34277: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); +const { first } = __webpack_require__(93347); + +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("../Compilation").PathData} PathData */ + +/** @typedef {function(PathData, AssetInfo=): string} FilenameFunction */ -const reasonGroup = (children, reasons) => { - let active = false; - for (const reason of children) { - active = active || reason.active; +class GetChunkFilenameRuntimeModule extends RuntimeModule { + /** + * @param {string} contentType the contentType to use the content hash for + * @param {string} name kind of filename + * @param {string} global function name to be assigned + * @param {function(Chunk): string | FilenameFunction} getFilenameForChunk functor to get the filename or function + * @param {boolean} allChunks when false, only async chunks are included + */ + constructor(contentType, name, global, getFilenameForChunk, allChunks) { + super(`get ${name} chunk filename`); + this.contentType = contentType; + this.global = global; + this.getFilenameForChunk = getFilenameForChunk; + this.allChunks = allChunks; + this.dependentHash = true; } - return { - active - }; -}; -const GROUP_EXTENSION_REGEXP = /(\.[^.]+?)(?:\?|(?: \+ \d+ modules?)?$)/; -const GROUP_PATH_REGEXP = /(.+)[/\\][^/\\]+?(?:\?|(?: \+ \d+ modules?)?$)/; + /** + * @returns {string} runtime code + */ + generate() { + const { + global, + chunk, + chunkGraph, + contentType, + getFilenameForChunk, + allChunks, + compilation + } = this; + const { runtimeTemplate } = compilation; -/** @type {Record void>} */ -const ASSETS_GROUPERS = { - _: (groupConfigs, context, options) => { - const groupByFlag = (name, exclude) => { - groupConfigs.push({ - getKeys: asset => { - return asset[name] ? ["1"] : undefined; - }, - getOptions: () => { - return { - groupChildren: !exclude, - force: exclude - }; - }, - createGroup: (key, children, assets) => { - return exclude - ? { - type: "assets by status", - [name]: !!key, - filteredChildren: assets.length, - ...assetGroup(children, assets) - } - : { - type: "assets by status", - [name]: !!key, - children, - ...assetGroup(children, assets) - }; + /** @type {Map>} */ + const chunkFilenames = new Map(); + let maxChunks = 0; + /** @type {string} */ + let dynamicFilename; + + /** + * @param {Chunk} c the chunk + * @returns {void} + */ + const addChunk = c => { + const chunkFilename = getFilenameForChunk(c); + if (chunkFilename) { + let set = chunkFilenames.get(chunkFilename); + if (set === undefined) { + chunkFilenames.set(chunkFilename, (set = new Set())); } - }); - }; - const { - groupAssetsByEmitStatus, - groupAssetsByPath, - groupAssetsByExtension - } = options; - if (groupAssetsByEmitStatus) { - groupByFlag("emitted"); - groupByFlag("comparedForEmit"); - groupByFlag("isOverSizeLimit"); - } - if (groupAssetsByEmitStatus || !options.cachedAssets) { - groupByFlag("cached", !options.cachedAssets); - } - if (groupAssetsByPath || groupAssetsByExtension) { - groupConfigs.push({ - getKeys: asset => { - const extensionMatch = - groupAssetsByExtension && GROUP_EXTENSION_REGEXP.exec(asset.name); - const extension = extensionMatch ? extensionMatch[1] : ""; - const pathMatch = - groupAssetsByPath && GROUP_PATH_REGEXP.exec(asset.name); - const path = pathMatch ? pathMatch[1].split(/[/\\]/) : []; - const keys = []; - if (groupAssetsByPath) { - keys.push("."); - if (extension) - keys.push( - path.length - ? `${path.join("/")}/*${extension}` - : `*${extension}` - ); - while (path.length > 0) { - keys.push(path.join("/") + "/"); - path.pop(); + set.add(c); + if (typeof chunkFilename === "string") { + if (set.size < maxChunks) return; + if (set.size === maxChunks) { + if (chunkFilename.length < dynamicFilename.length) return; + if (chunkFilename.length === dynamicFilename.length) { + if (chunkFilename < dynamicFilename) return; } - } else { - if (extension) keys.push(`*${extension}`); } - return keys; - }, - createGroup: (key, children, assets) => { - return { - type: groupAssetsByPath ? "assets by path" : "assets by extension", - name: key, - children, - ...assetGroup(children, assets) - }; - } - }); - } - }, - groupAssetsByInfo: (groupConfigs, context, options) => { - const groupByAssetInfoFlag = name => { - groupConfigs.push({ - getKeys: asset => { - return asset.info && asset.info[name] ? ["1"] : undefined; - }, - createGroup: (key, children, assets) => { - return { - type: "assets by info", - info: { - [name]: !!key - }, - children, - ...assetGroup(children, assets) - }; - } - }); - }; - groupByAssetInfoFlag("immutable"); - groupByAssetInfoFlag("development"); - groupByAssetInfoFlag("hotModuleReplacement"); - }, - groupAssetsByChunk: (groupConfigs, context, options) => { - const groupByNames = name => { - groupConfigs.push({ - getKeys: asset => { - return asset[name]; - }, - createGroup: (key, children, assets) => { - return { - type: "assets by chunk", - [name]: [key], - children, - ...assetGroup(children, assets) - }; + maxChunks = set.size; + dynamicFilename = chunkFilename; } - }); + } }; - groupByNames("chunkNames"); - groupByNames("auxiliaryChunkNames"); - groupByNames("chunkIdHints"); - groupByNames("auxiliaryChunkIdHints"); - }, - excludeAssets: (groupConfigs, context, { excludeAssets }) => { - groupConfigs.push({ - getKeys: asset => { - const ident = asset.name; - const excluded = excludeAssets.some(fn => fn(ident, asset)); - if (excluded) return ["excluded"]; - }, - getOptions: () => ({ - groupChildren: false, - force: true - }), - createGroup: (key, children, assets) => ({ - type: "hidden assets", - filteredChildren: assets.length, - ...assetGroup(children, assets) - }) - }); - } -}; -/** @type {function("module" | "chunk" | "root-of-chunk" | "nested"): Record void>} */ -const MODULES_GROUPERS = type => ({ - _: (groupConfigs, context, options) => { - const groupByFlag = (name, type, exclude) => { - groupConfigs.push({ - getKeys: module => { - return module[name] ? ["1"] : undefined; - }, - getOptions: () => { - return { - groupChildren: !exclude, - force: exclude - }; - }, - createGroup: (key, children, modules) => { - return { - type, - [name]: !!key, - ...(exclude ? { filteredChildren: modules.length } : { children }), - ...moduleGroup(children, modules) - }; + /** @type {string[]} */ + const includedChunksMessages = []; + if (allChunks) { + includedChunksMessages.push("all chunks"); + for (const c of chunk.getAllReferencedChunks()) { + addChunk(c); + } + } else { + includedChunksMessages.push("async chunks"); + for (const c of chunk.getAllAsyncChunks()) { + addChunk(c); + } + const includeEntries = chunkGraph + .getTreeRuntimeRequirements(chunk) + .has(RuntimeGlobals.ensureChunkIncludeEntries); + if (includeEntries) { + includedChunksMessages.push("sibling chunks for the entrypoint"); + for (const c of chunkGraph.getChunkEntryDependentChunksIterable( + chunk + )) { + addChunk(c); } - }); - }; - const { - groupModulesByCacheStatus, - groupModulesByLayer, - groupModulesByAttributes, - groupModulesByType, - groupModulesByPath, - groupModulesByExtension - } = options; - if (groupModulesByAttributes) { - groupByFlag("errors", "modules with errors"); - groupByFlag("warnings", "modules with warnings"); - groupByFlag("assets", "modules with assets"); - groupByFlag("optional", "optional modules"); - } - if (groupModulesByCacheStatus) { - groupByFlag("cacheable", "cacheable modules"); - groupByFlag("built", "built modules"); - groupByFlag("codeGenerated", "code generated modules"); - } - if (groupModulesByCacheStatus || !options.cachedModules) { - groupByFlag("cached", "cached modules", !options.cachedModules); - } - if (groupModulesByAttributes || !options.orphanModules) { - groupByFlag("orphan", "orphan modules", !options.orphanModules); - } - if (groupModulesByAttributes || !options.dependentModules) { - groupByFlag("dependent", "dependent modules", !options.dependentModules); + } } - if (groupModulesByType || !options.runtimeModules) { - groupConfigs.push({ - getKeys: module => { - if (!module.moduleType) return; - if (groupModulesByType) { - return [module.moduleType.split("/", 1)[0]]; - } else if (module.moduleType === "runtime") { - return ["runtime"]; - } - }, - getOptions: key => { - const exclude = key === "runtime" && !options.runtimeModules; - return { - groupChildren: !exclude, - force: exclude - }; - }, - createGroup: (key, children, modules) => { - const exclude = key === "runtime" && !options.runtimeModules; - return { - type: `${key} modules`, - moduleType: key, - ...(exclude ? { filteredChildren: modules.length } : { children }), - ...moduleGroup(children, modules) - }; - } - }); + for (const entrypoint of chunk.getAllReferencedAsyncEntrypoints()) { + addChunk(entrypoint.chunks[entrypoint.chunks.length - 1]); } - if (groupModulesByLayer) { - groupConfigs.push({ - getKeys: module => { - return [module.layer]; - }, - createGroup: (key, children, modules) => { - return { - type: "modules by layer", - layer: key, - children, - ...moduleGroup(children, modules) - }; + + /** @type {Map>} */ + const staticUrls = new Map(); + /** @type {Set} */ + const dynamicUrlChunks = new Set(); + + /** + * @param {Chunk} c the chunk + * @param {string | FilenameFunction} chunkFilename the filename template for the chunk + * @returns {void} + */ + const addStaticUrl = (c, chunkFilename) => { + /** + * @param {string | number} value a value + * @returns {string} string to put in quotes + */ + const unquotedStringify = value => { + const str = `${value}`; + if (str.length >= 5 && str === `${c.id}`) { + // This is shorter and generates the same result + return '" + chunkId + "'; } - }); - } - if (groupModulesByPath || groupModulesByExtension) { - groupConfigs.push({ - getKeys: module => { - if (!module.name) return; - const resource = parseResource(module.name.split("!").pop()).path; - const dataUrl = /^data:[^,;]+/.exec(resource); - if (dataUrl) return [dataUrl[0]]; - const extensionMatch = - groupModulesByExtension && GROUP_EXTENSION_REGEXP.exec(resource); - const extension = extensionMatch ? extensionMatch[1] : ""; - const pathMatch = - groupModulesByPath && GROUP_PATH_REGEXP.exec(resource); - const path = pathMatch ? pathMatch[1].split(/[/\\]/) : []; - const keys = []; - if (groupModulesByPath) { - if (extension) - keys.push( - path.length - ? `${path.join("/")}/*${extension}` - : `*${extension}` - ); - while (path.length > 0) { - keys.push(path.join("/") + "/"); - path.pop(); - } - } else { - if (extension) keys.push(`*${extension}`); + const s = JSON.stringify(str); + return s.slice(1, s.length - 1); + }; + const unquotedStringifyWithLength = value => length => + unquotedStringify(`${value}`.slice(0, length)); + const chunkFilenameValue = + typeof chunkFilename === "function" + ? JSON.stringify( + chunkFilename({ + chunk: c, + contentHashType: contentType + }) + ) + : JSON.stringify(chunkFilename); + const staticChunkFilename = compilation.getPath(chunkFilenameValue, { + hash: `" + ${RuntimeGlobals.getFullHash}() + "`, + hashWithLength: length => + `" + ${RuntimeGlobals.getFullHash}().slice(0, ${length}) + "`, + chunk: { + id: unquotedStringify(c.id), + hash: unquotedStringify(c.renderedHash), + hashWithLength: unquotedStringifyWithLength(c.renderedHash), + name: unquotedStringify(c.name || c.id), + contentHash: { + [contentType]: unquotedStringify(c.contentHash[contentType]) + }, + contentHashWithLength: { + [contentType]: unquotedStringifyWithLength( + c.contentHash[contentType] + ) } - return keys; }, - createGroup: (key, children, modules) => { - const isDataUrl = key.startsWith("data:"); - return { - type: isDataUrl - ? "modules by mime type" - : groupModulesByPath - ? "modules by path" - : "modules by extension", - name: isDataUrl ? key.slice(/* 'data:'.length */ 5) : key, - children, - ...moduleGroup(children, modules) - }; - } + contentHashType: contentType }); + let set = staticUrls.get(staticChunkFilename); + if (set === undefined) { + staticUrls.set(staticChunkFilename, (set = new Set())); + } + set.add(c.id); + }; + + for (const [filename, chunks] of chunkFilenames) { + if (filename !== dynamicFilename) { + for (const c of chunks) addStaticUrl(c, filename); + } else { + for (const c of chunks) dynamicUrlChunks.add(c); + } } - }, - excludeModules: (groupConfigs, context, { excludeModules }) => { - groupConfigs.push({ - getKeys: module => { - const name = module.name; - if (name) { - const excluded = excludeModules.some(fn => fn(name, module, type)); - if (excluded) return ["1"]; + + /** + * @param {function(Chunk): string | number} fn function from chunk to value + * @returns {string} code with static mapping of results of fn + */ + const createMap = fn => { + const obj = {}; + let useId = false; + let lastKey; + let entries = 0; + for (const c of dynamicUrlChunks) { + const value = fn(c); + if (value === c.id) { + useId = true; + } else { + obj[c.id] = value; + lastKey = c.id; + entries++; } - }, - getOptions: () => ({ - groupChildren: false, - force: true - }), - createGroup: (key, children, modules) => ({ - type: "hidden modules", - filteredChildren: children.length, - ...moduleGroup(children, modules) - }) - }); - } -}); + } + if (entries === 0) return "chunkId"; + if (entries === 1) { + return useId + ? `(chunkId === ${JSON.stringify(lastKey)} ? ${JSON.stringify( + obj[lastKey] + )} : chunkId)` + : JSON.stringify(obj[lastKey]); + } + return useId + ? `(${JSON.stringify(obj)}[chunkId] || chunkId)` + : `${JSON.stringify(obj)}[chunkId]`; + }; -/** @type {Record void>>} */ -const RESULT_GROUPERS = { - "compilation.assets": ASSETS_GROUPERS, - "asset.related": ASSETS_GROUPERS, - "compilation.modules": MODULES_GROUPERS("module"), - "chunk.modules": MODULES_GROUPERS("chunk"), - "chunk.rootModules": MODULES_GROUPERS("root-of-chunk"), - "module.modules": MODULES_GROUPERS("nested"), - "module.reasons": { - groupReasonsByOrigin: groupConfigs => { - groupConfigs.push({ - getKeys: reason => { - return [reason.module]; + /** + * @param {function(Chunk): string | number} fn function from chunk to value + * @returns {string} code with static mapping of results of fn for including in quoted string + */ + const mapExpr = fn => { + return `" + ${createMap(fn)} + "`; + }; + + /** + * @param {function(Chunk): string | number} fn function from chunk to value + * @returns {function(number): string} function which generates code with static mapping of results of fn for including in quoted string for specific length + */ + const mapExprWithLength = fn => length => { + return `" + ${createMap(c => `${fn(c)}`.slice(0, length))} + "`; + }; + + const url = + dynamicFilename && + compilation.getPath(JSON.stringify(dynamicFilename), { + hash: `" + ${RuntimeGlobals.getFullHash}() + "`, + hashWithLength: length => + `" + ${RuntimeGlobals.getFullHash}().slice(0, ${length}) + "`, + chunk: { + id: `" + chunkId + "`, + hash: mapExpr(c => c.renderedHash), + hashWithLength: mapExprWithLength(c => c.renderedHash), + name: mapExpr(c => c.name || c.id), + contentHash: { + [contentType]: mapExpr(c => c.contentHash[contentType]) + }, + contentHashWithLength: { + [contentType]: mapExprWithLength(c => c.contentHash[contentType]) + } }, - createGroup: (key, children, reasons) => { - return { - type: "from origin", - module: key, - children, - ...reasonGroup(children, reasons) - }; - } + contentHashType: contentType }); - } - } -}; -// remove a prefixed "!" that can be specified to reverse sort order -const normalizeFieldKey = field => { - if (field[0] === "!") { - return field.substr(1); + return Template.asString([ + `// This function allow to reference ${includedChunksMessages.join( + " and " + )}`, + `${global} = ${runtimeTemplate.basicFunction( + "chunkId", + + staticUrls.size > 0 + ? [ + "// return url for filenames not based on template", + // it minimizes to `x===1?"...":x===2?"...":"..."` + Template.asString( + Array.from(staticUrls, ([url, ids]) => { + const condition = + ids.size === 1 + ? `chunkId === ${JSON.stringify(first(ids))}` + : `{${Array.from( + ids, + id => `${JSON.stringify(id)}:1` + ).join(",")}}[chunkId]`; + return `if (${condition}) return ${url};`; + }) + ), + "// return url for filenames based on template", + `return ${url};` + ] + : ["// return url for filenames based on template", `return ${url};`] + )};` + ]); } - return field; -}; +} -// if a field is prefixed by a "!" reverse sort order -const sortOrderRegular = field => { - if (field[0] === "!") { - return false; +module.exports = GetChunkFilenameRuntimeModule; + + +/***/ }), + +/***/ 88732: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); + +/** @typedef {import("../Compilation")} Compilation */ + +class GetFullHashRuntimeModule extends RuntimeModule { + constructor() { + super("getFullHash"); + this.fullHash = true; } - return true; -}; -/** - * @param {string} field field name - * @returns {function(Object, Object): number} comparators - */ -const sortByField = field => { - if (!field) { - /** - * @param {any} a first - * @param {any} b second - * @returns {-1|0|1} zero - */ - const noSort = (a, b) => 0; - return noSort; + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeTemplate } = this.compilation; + return `${RuntimeGlobals.getFullHash} = ${runtimeTemplate.returningFunction( + JSON.stringify(this.compilation.hash || "XXXX") + )}`; } +} - const fieldKey = normalizeFieldKey(field); +module.exports = GetFullHashRuntimeModule; - let sortFn = compareSelect(m => m[fieldKey], compareIds); - // if a field is prefixed with a "!" the sort is reversed! - const sortIsRegular = sortOrderRegular(field); +/***/ }), - if (!sortIsRegular) { - const oldSortFn = sortFn; - sortFn = (a, b) => oldSortFn(b, a); +/***/ 10029: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); + +/** @typedef {import("../Compilation")} Compilation */ + +class GetMainFilenameRuntimeModule extends RuntimeModule { + /** + * @param {string} name readable name + * @param {string} global global object binding + * @param {string} filename main file name + */ + constructor(name, global, filename) { + super(`get ${name} filename`); + this.global = global; + this.filename = filename; } - return sortFn; -}; + /** + * @returns {string} runtime code + */ + generate() { + const { global, filename, compilation, chunk } = this; + const { runtimeTemplate } = compilation; + const url = compilation.getPath(JSON.stringify(filename), { + hash: `" + ${RuntimeGlobals.getFullHash}() + "`, + hashWithLength: length => + `" + ${RuntimeGlobals.getFullHash}().slice(0, ${length}) + "`, + chunk, + runtime: chunk.runtime + }); + return Template.asString([ + `${global} = ${runtimeTemplate.returningFunction(url)};` + ]); + } +} -const ASSET_SORTERS = { - /** @type {(comparators: Function[], context: StatsFactoryContext, options: NormalizedStatsOptions) => void} */ - assetsSort: (comparators, context, { assetsSort }) => { - comparators.push(sortByField(assetsSort)); - }, - _: comparators => { - comparators.push(compareSelect(a => a.name, compareIds)); +module.exports = GetMainFilenameRuntimeModule; + + +/***/ }), + +/***/ 38713: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const HelperRuntimeModule = __webpack_require__(82444); + +class GetTrustedTypesPolicyRuntimeModule extends HelperRuntimeModule { + /** + * @param {Set} runtimeRequirements runtime requirements + */ + constructor(runtimeRequirements) { + super("trusted types policy"); + this.runtimeRequirements = runtimeRequirements; } -}; -/** @type {Record void>>} */ -const RESULT_SORTERS = { - "compilation.chunks": { - chunksSort: (comparators, context, { chunksSort }) => { - comparators.push(sortByField(chunksSort)); - } - }, - "compilation.modules": { - modulesSort: (comparators, context, { modulesSort }) => { - comparators.push(sortByField(modulesSort)); - } - }, - "chunk.modules": { - chunkModulesSort: (comparators, context, { chunkModulesSort }) => { - comparators.push(sortByField(chunkModulesSort)); - } - }, - "module.modules": { - nestedModulesSort: (comparators, context, { nestedModulesSort }) => { - comparators.push(sortByField(nestedModulesSort)); - } - }, - "compilation.assets": ASSET_SORTERS, - "asset.related": ASSET_SORTERS -}; + /** + * @returns {string} runtime code + */ + generate() { + const { compilation } = this; + const { runtimeTemplate, outputOptions } = compilation; + const { trustedTypes } = outputOptions; + const fn = RuntimeGlobals.getTrustedTypesPolicy; -/** - * @param {Record>} config the config see above - * @param {NormalizedStatsOptions} options stats options - * @param {function(string, Function): void} fn handler function called for every active line in config - * @returns {void} - */ -const iterateConfig = (config, options, fn) => { - for (const hookFor of Object.keys(config)) { - const subConfig = config[hookFor]; - for (const option of Object.keys(subConfig)) { - if (option !== "_") { - if (option.startsWith("!")) { - if (options[option.slice(1)]) continue; - } else { - const value = options[option]; - if ( - value === false || - value === undefined || - (Array.isArray(value) && value.length === 0) - ) - continue; - } - } - fn(hookFor, subConfig[option]); - } + return Template.asString([ + "var policy;", + `${fn} = ${runtimeTemplate.basicFunction("", [ + "// Create Trusted Type policy if Trusted Types are available and the policy doesn't exist yet.", + "if (policy === undefined) {", + Template.indent([ + "policy = {", + Template.indent( + [ + ...(this.runtimeRequirements.has(RuntimeGlobals.createScript) + ? [ + `createScript: ${runtimeTemplate.returningFunction( + "script", + "script" + )}` + ] + : []), + ...(this.runtimeRequirements.has(RuntimeGlobals.createScriptUrl) + ? [ + `createScriptURL: ${runtimeTemplate.returningFunction( + "url", + "url" + )}` + ] + : []) + ].join(",\n") + ), + "};", + ...(trustedTypes + ? [ + 'if (typeof trustedTypes !== "undefined" && trustedTypes.createPolicy) {', + Template.indent([ + `policy = trustedTypes.createPolicy(${JSON.stringify( + trustedTypes.policyName + )}, policy);` + ]), + "}" + ] + : []) + ]), + "}", + "return policy;" + ])};` + ]); } -}; +} -/** @type {Record} */ -const ITEM_NAMES = { - "compilation.children[]": "compilation", - "compilation.modules[]": "module", - "compilation.entrypoints[]": "chunkGroup", - "compilation.namedChunkGroups[]": "chunkGroup", - "compilation.errors[]": "error", - "compilation.warnings[]": "warning", - "chunk.modules[]": "module", - "chunk.rootModules[]": "module", - "chunk.origins[]": "chunkOrigin", - "compilation.chunks[]": "chunk", - "compilation.assets[]": "asset", - "asset.related[]": "asset", - "module.issuerPath[]": "moduleIssuer", - "module.reasons[]": "moduleReason", - "module.modules[]": "module", - "module.children[]": "module", - "moduleTrace[]": "moduleTraceItem", - "moduleTraceItem.dependencies[]": "moduleTraceDependency" -}; +module.exports = GetTrustedTypesPolicyRuntimeModule; -/** - * @param {Object[]} items items to be merged - * @returns {Object} an object - */ -const mergeToObject = items => { - const obj = Object.create(null); - for (const item of items) { - obj[item.name] = item; + +/***/ }), + +/***/ 23255: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); + +class GlobalRuntimeModule extends RuntimeModule { + constructor() { + super("global"); } - return obj; -}; -/** @type {Record any>} */ -const MERGER = { - "compilation.entrypoints": mergeToObject, - "compilation.namedChunkGroups": mergeToObject -}; + /** + * @returns {string} runtime code + */ + generate() { + return Template.asString([ + `${RuntimeGlobals.global} = (function() {`, + Template.indent([ + "if (typeof globalThis === 'object') return globalThis;", + "try {", + Template.indent( + // This works in non-strict mode + // or + // This works if eval is allowed (see CSP) + "return this || new Function('return this')();" + ), + "} catch (e) {", + Template.indent( + // This works if the window reference is available + "if (typeof window === 'object') return window;" + ), + "}" + // It can still be `undefined`, but nothing to do about it... + // We return `undefined`, instead of nothing here, so it's + // easier to handle this case: + // if (!global) { … } + ]), + "})();" + ]); + } +} + +module.exports = GlobalRuntimeModule; + + +/***/ }), + +/***/ 8011: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Sergey Melyukov @smelukov +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); + +class HasOwnPropertyRuntimeModule extends RuntimeModule { + constructor() { + super("hasOwnProperty shorthand"); + } -class DefaultStatsFactoryPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @returns {string} runtime code */ - apply(compiler) { - compiler.hooks.compilation.tap("DefaultStatsFactoryPlugin", compilation => { - compilation.hooks.statsFactory.tap( - "DefaultStatsFactoryPlugin", - (stats, options, context) => { - iterateConfig(SIMPLE_EXTRACTORS, options, (hookFor, fn) => { - stats.hooks.extract - .for(hookFor) - .tap("DefaultStatsFactoryPlugin", (obj, data, ctx) => - fn(obj, data, ctx, options, stats) - ); - }); - iterateConfig(FILTER, options, (hookFor, fn) => { - stats.hooks.filter - .for(hookFor) - .tap("DefaultStatsFactoryPlugin", (item, ctx, idx, i) => - fn(item, ctx, options, idx, i) - ); - }); - iterateConfig(FILTER_RESULTS, options, (hookFor, fn) => { - stats.hooks.filterResults - .for(hookFor) - .tap("DefaultStatsFactoryPlugin", (item, ctx, idx, i) => - fn(item, ctx, options, idx, i) - ); - }); - iterateConfig(SORTERS, options, (hookFor, fn) => { - stats.hooks.sort - .for(hookFor) - .tap("DefaultStatsFactoryPlugin", (comparators, ctx) => - fn(comparators, ctx, options) - ); - }); - iterateConfig(RESULT_SORTERS, options, (hookFor, fn) => { - stats.hooks.sortResults - .for(hookFor) - .tap("DefaultStatsFactoryPlugin", (comparators, ctx) => - fn(comparators, ctx, options) - ); - }); - iterateConfig(RESULT_GROUPERS, options, (hookFor, fn) => { - stats.hooks.groupResults - .for(hookFor) - .tap("DefaultStatsFactoryPlugin", (groupConfigs, ctx) => - fn(groupConfigs, ctx, options) - ); - }); - for (const key of Object.keys(ITEM_NAMES)) { - const itemName = ITEM_NAMES[key]; - stats.hooks.getItemName - .for(key) - .tap("DefaultStatsFactoryPlugin", () => itemName); - } - for (const key of Object.keys(MERGER)) { - const merger = MERGER[key]; - stats.hooks.merge.for(key).tap("DefaultStatsFactoryPlugin", merger); - } - if (options.children) { - if (Array.isArray(options.children)) { - stats.hooks.getItemFactory - .for("compilation.children[].compilation") - .tap("DefaultStatsFactoryPlugin", (comp, { _index: idx }) => { - if (idx < options.children.length) { - return compilation.createStatsFactory( - compilation.createStatsOptions( - options.children[idx], - context - ) - ); - } - }); - } else if (options.children !== true) { - const childFactory = compilation.createStatsFactory( - compilation.createStatsOptions(options.children, context) - ); - stats.hooks.getItemFactory - .for("compilation.children[].compilation") - .tap("DefaultStatsFactoryPlugin", () => { - return childFactory; - }); - } - } - } - ); - }); + generate() { + const { runtimeTemplate } = this.compilation; + + return Template.asString([ + `${RuntimeGlobals.hasOwnProperty} = ${runtimeTemplate.returningFunction( + "Object.prototype.hasOwnProperty.call(obj, prop)", + "obj, prop" + )}` + ]); } } -module.exports = DefaultStatsFactoryPlugin; + +module.exports = HasOwnPropertyRuntimeModule; /***/ }), -/***/ 55442: +/***/ 82444: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const RequestShortener = __webpack_require__(73406); - -/** @typedef {import("../../declarations/WebpackOptions").StatsOptions} StatsOptions */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Compilation").CreateStatsOptionsContext} CreateStatsOptionsContext */ -/** @typedef {import("../Compiler")} Compiler */ +const RuntimeModule = __webpack_require__(16963); -const applyDefaults = (options, defaults) => { - for (const key of Object.keys(defaults)) { - if (typeof options[key] === "undefined") { - options[key] = defaults[key]; - } +class HelperRuntimeModule extends RuntimeModule { + /** + * @param {string} name a readable name + */ + constructor(name) { + super(name); } -}; +} -const NAMED_PRESETS = { - verbose: { - hash: true, - builtAt: true, - relatedAssets: true, - entrypoints: true, - chunkGroups: true, - ids: true, - modules: false, - chunks: true, - chunkRelations: true, - chunkModules: true, - dependentModules: true, - chunkOrigins: true, - depth: true, - env: true, - reasons: true, - usedExports: true, - providedExports: true, - optimizationBailout: true, - errorDetails: true, - errorStack: true, - publicPath: true, - logging: "verbose", - orphanModules: true, - runtimeModules: true, - exclude: false, - modulesSpace: Infinity, - chunkModulesSpace: Infinity, - assetsSpace: Infinity, - reasonsSpace: Infinity, - children: true - }, - detailed: { - hash: true, - builtAt: true, - relatedAssets: true, - entrypoints: true, - chunkGroups: true, - ids: true, - chunks: true, - chunkRelations: true, - chunkModules: false, - chunkOrigins: true, - depth: true, - usedExports: true, - providedExports: true, - optimizationBailout: true, - errorDetails: true, - publicPath: true, - logging: true, - runtimeModules: true, - exclude: false, - modulesSpace: 1000, - assetsSpace: 1000, - reasonsSpace: 1000 - }, - minimal: { - all: false, - version: true, - timings: true, - modules: true, - modulesSpace: 0, - assets: true, - assetsSpace: 0, - errors: true, - errorsCount: true, - warnings: true, - warningsCount: true, - logging: "warn" - }, - "errors-only": { - all: false, - errors: true, - errorsCount: true, - moduleTrace: true, - logging: "error" - }, - "errors-warnings": { - all: false, - errors: true, - errorsCount: true, - warnings: true, - warningsCount: true, - logging: "warn" - }, - summary: { - all: false, - version: true, - errorsCount: true, - warningsCount: true - }, - none: { - all: false - } -}; +module.exports = HelperRuntimeModule; -const NORMAL_ON = ({ all }) => all !== false; -const NORMAL_OFF = ({ all }) => all === true; -const ON_FOR_TO_STRING = ({ all }, { forToString }) => - forToString ? all !== false : all === true; -const OFF_FOR_TO_STRING = ({ all }, { forToString }) => - forToString ? all === true : all !== false; -const AUTO_FOR_TO_STRING = ({ all }, { forToString }) => { - if (all === false) return false; - if (all === true) return true; - if (forToString) return "auto"; - return true; -}; -/** @type {Record any>} */ -const DEFAULTS = { - context: (options, context, compilation) => compilation.compiler.context, - requestShortener: (options, context, compilation) => - compilation.compiler.context === options.context - ? compilation.requestShortener - : new RequestShortener(options.context, compilation.compiler.root), - performance: NORMAL_ON, - hash: OFF_FOR_TO_STRING, - env: NORMAL_OFF, - version: NORMAL_ON, - timings: NORMAL_ON, - builtAt: OFF_FOR_TO_STRING, - assets: NORMAL_ON, - entrypoints: AUTO_FOR_TO_STRING, - chunkGroups: OFF_FOR_TO_STRING, - chunkGroupAuxiliary: OFF_FOR_TO_STRING, - chunkGroupChildren: OFF_FOR_TO_STRING, - chunkGroupMaxAssets: (o, { forToString }) => (forToString ? 5 : Infinity), - chunks: OFF_FOR_TO_STRING, - chunkRelations: OFF_FOR_TO_STRING, - chunkModules: ({ all, modules }) => { - if (all === false) return false; - if (all === true) return true; - if (modules) return false; - return true; - }, - dependentModules: OFF_FOR_TO_STRING, - chunkOrigins: OFF_FOR_TO_STRING, - ids: OFF_FOR_TO_STRING, - modules: ({ all, chunks, chunkModules }, { forToString }) => { - if (all === false) return false; - if (all === true) return true; - if (forToString && chunks && chunkModules) return false; - return true; - }, - nestedModules: OFF_FOR_TO_STRING, - groupModulesByType: ON_FOR_TO_STRING, - groupModulesByCacheStatus: ON_FOR_TO_STRING, - groupModulesByLayer: ON_FOR_TO_STRING, - groupModulesByAttributes: ON_FOR_TO_STRING, - groupModulesByPath: ON_FOR_TO_STRING, - groupModulesByExtension: ON_FOR_TO_STRING, - modulesSpace: (o, { forToString }) => (forToString ? 15 : Infinity), - chunkModulesSpace: (o, { forToString }) => (forToString ? 10 : Infinity), - nestedModulesSpace: (o, { forToString }) => (forToString ? 10 : Infinity), - relatedAssets: OFF_FOR_TO_STRING, - groupAssetsByEmitStatus: ON_FOR_TO_STRING, - groupAssetsByInfo: ON_FOR_TO_STRING, - groupAssetsByPath: ON_FOR_TO_STRING, - groupAssetsByExtension: ON_FOR_TO_STRING, - groupAssetsByChunk: ON_FOR_TO_STRING, - assetsSpace: (o, { forToString }) => (forToString ? 15 : Infinity), - orphanModules: OFF_FOR_TO_STRING, - runtimeModules: ({ all, runtime }, { forToString }) => - runtime !== undefined - ? runtime - : forToString - ? all === true - : all !== false, - cachedModules: ({ all, cached }, { forToString }) => - cached !== undefined ? cached : forToString ? all === true : all !== false, - moduleAssets: OFF_FOR_TO_STRING, - depth: OFF_FOR_TO_STRING, - cachedAssets: OFF_FOR_TO_STRING, - reasons: OFF_FOR_TO_STRING, - reasonsSpace: (o, { forToString }) => (forToString ? 15 : Infinity), - groupReasonsByOrigin: ON_FOR_TO_STRING, - usedExports: OFF_FOR_TO_STRING, - providedExports: OFF_FOR_TO_STRING, - optimizationBailout: OFF_FOR_TO_STRING, - children: OFF_FOR_TO_STRING, - source: NORMAL_OFF, - moduleTrace: NORMAL_ON, - errors: NORMAL_ON, - errorsCount: NORMAL_ON, - errorDetails: AUTO_FOR_TO_STRING, - errorStack: OFF_FOR_TO_STRING, - warnings: NORMAL_ON, - warningsCount: NORMAL_ON, - publicPath: OFF_FOR_TO_STRING, - logging: ({ all }, { forToString }) => - forToString && all !== false ? "info" : false, - loggingDebug: () => [], - loggingTrace: OFF_FOR_TO_STRING, - excludeModules: () => [], - excludeAssets: () => [], - modulesSort: () => "depth", - chunkModulesSort: () => "name", - nestedModulesSort: () => false, - chunksSort: () => false, - assetsSort: () => "!size", - outputPath: OFF_FOR_TO_STRING, - colors: () => false -}; +/***/ }), -const normalizeFilter = item => { - if (typeof item === "string") { - const regExp = new RegExp( - `[\\\\/]${item.replace( - // eslint-disable-next-line no-useless-escape - /[-[\]{}()*+?.\\^$|]/g, - "\\$&" - )}([\\\\/]|$|!|\\?)` - ); - return ident => regExp.test(ident); - } - if (item && typeof item === "object" && typeof item.test === "function") { - return ident => item.test(ident); - } - if (typeof item === "function") { - return item; - } - if (typeof item === "boolean") { - return () => item; - } -}; +/***/ 19942: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -const NORMALIZER = { - excludeModules: value => { - if (!Array.isArray(value)) { - value = value ? [value] : []; - } - return value.map(normalizeFilter); - }, - excludeAssets: value => { - if (!Array.isArray(value)) { - value = value ? [value] : []; - } - return value.map(normalizeFilter); - }, - warningsFilter: value => { - if (!Array.isArray(value)) { - value = value ? [value] : []; - } - return value.map(filter => { - if (typeof filter === "string") { - return (warning, warningString) => warningString.includes(filter); - } - if (filter instanceof RegExp) { - return (warning, warningString) => filter.test(warningString); - } - if (typeof filter === "function") { - return filter; - } - throw new Error( - `Can only filter warnings with Strings or RegExps. (Given: ${filter})` +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const { SyncWaterfallHook } = __webpack_require__(41242); +const Compilation = __webpack_require__(85720); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const HelperRuntimeModule = __webpack_require__(82444); + +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compiler")} Compiler */ + +/** + * @typedef {Object} LoadScriptCompilationHooks + * @property {SyncWaterfallHook<[string, Chunk]>} createScript + */ + +/** @type {WeakMap} */ +const compilationHooksMap = new WeakMap(); + +class LoadScriptRuntimeModule extends HelperRuntimeModule { + /** + * @param {Compilation} compilation the compilation + * @returns {LoadScriptCompilationHooks} hooks + */ + static getCompilationHooks(compilation) { + if (!(compilation instanceof Compilation)) { + throw new TypeError( + "The 'compilation' argument must be an instance of Compilation" ); - }); - }, - logging: value => { - if (value === true) value = "log"; - return value; - }, - loggingDebug: value => { - if (!Array.isArray(value)) { - value = value ? [value] : []; } - return value.map(normalizeFilter); + let hooks = compilationHooksMap.get(compilation); + if (hooks === undefined) { + hooks = { + createScript: new SyncWaterfallHook(["source", "chunk"]) + }; + compilationHooksMap.set(compilation, hooks); + } + return hooks; } -}; -class DefaultStatsPresetPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {boolean=} withCreateScriptUrl use create script url for trusted types */ - apply(compiler) { - compiler.hooks.compilation.tap("DefaultStatsPresetPlugin", compilation => { - for (const key of Object.keys(NAMED_PRESETS)) { - const defaults = NAMED_PRESETS[key]; - compilation.hooks.statsPreset - .for(key) - .tap("DefaultStatsPresetPlugin", (options, context) => { - applyDefaults(options, defaults); - }); - } - compilation.hooks.statsNormalize.tap( - "DefaultStatsPresetPlugin", - (options, context) => { - for (const key of Object.keys(DEFAULTS)) { - if (options[key] === undefined) - options[key] = DEFAULTS[key](options, context, compilation); - } - for (const key of Object.keys(NORMALIZER)) { - options[key] = NORMALIZER[key](options[key]); - } - } - ); - }); + constructor(withCreateScriptUrl) { + super("load script"); + this._withCreateScriptUrl = withCreateScriptUrl; + } + + /** + * @returns {string} runtime code + */ + generate() { + const { compilation } = this; + const { runtimeTemplate, outputOptions } = compilation; + const { + scriptType, + chunkLoadTimeout: loadTimeout, + crossOriginLoading, + uniqueName, + charset + } = outputOptions; + const fn = RuntimeGlobals.loadScript; + + const { createScript } = + LoadScriptRuntimeModule.getCompilationHooks(compilation); + + const code = Template.asString([ + "script = document.createElement('script');", + scriptType ? `script.type = ${JSON.stringify(scriptType)};` : "", + charset ? "script.charset = 'utf-8';" : "", + `script.timeout = ${loadTimeout / 1000};`, + `if (${RuntimeGlobals.scriptNonce}) {`, + Template.indent( + `script.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});` + ), + "}", + uniqueName + ? 'script.setAttribute("data-webpack", dataWebpackPrefix + key);' + : "", + `script.src = ${ + this._withCreateScriptUrl + ? `${RuntimeGlobals.createScriptUrl}(url)` + : "url" + };`, + crossOriginLoading + ? Template.asString([ + "if (script.src.indexOf(window.location.origin + '/') !== 0) {", + Template.indent( + `script.crossOrigin = ${JSON.stringify(crossOriginLoading)};` + ), + "}" + ]) + : "" + ]); + + return Template.asString([ + "var inProgress = {};", + uniqueName + ? `var dataWebpackPrefix = ${JSON.stringify(uniqueName + ":")};` + : "// data-webpack is not used as build has no uniqueName", + "// loadScript function to load a script via script tag", + `${fn} = ${runtimeTemplate.basicFunction("url, done, key, chunkId", [ + "if(inProgress[url]) { inProgress[url].push(done); return; }", + "var script, needAttach;", + "if(key !== undefined) {", + Template.indent([ + 'var scripts = document.getElementsByTagName("script");', + "for(var i = 0; i < scripts.length; i++) {", + Template.indent([ + "var s = scripts[i];", + `if(s.getAttribute("src") == url${ + uniqueName + ? ' || s.getAttribute("data-webpack") == dataWebpackPrefix + key' + : "" + }) { script = s; break; }` + ]), + "}" + ]), + "}", + "if(!script) {", + Template.indent([ + "needAttach = true;", + createScript.call(code, this.chunk) + ]), + "}", + "inProgress[url] = [done];", + "var onScriptComplete = " + + runtimeTemplate.basicFunction( + "prev, event", + Template.asString([ + "// avoid mem leaks in IE.", + "script.onerror = script.onload = null;", + "clearTimeout(timeout);", + "var doneFns = inProgress[url];", + "delete inProgress[url];", + "script.parentNode && script.parentNode.removeChild(script);", + `doneFns && doneFns.forEach(${runtimeTemplate.returningFunction( + "fn(event)", + "fn" + )});`, + "if(prev) return prev(event);" + ]) + ), + ";", + `var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), ${loadTimeout});`, + "script.onerror = onScriptComplete.bind(null, script.onerror);", + "script.onload = onScriptComplete.bind(null, script.onload);", + "needAttach && document.head.appendChild(script);" + ])};` + ]); } } -module.exports = DefaultStatsPresetPlugin; + +module.exports = LoadScriptRuntimeModule; /***/ }), -/***/ 58692: +/***/ 65714: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("./StatsPrinter")} StatsPrinter */ -/** @typedef {import("./StatsPrinter").StatsPrinterContext} StatsPrinterContext */ - -const DATA_URI_CONTENT_LENGTH = 16; +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const HelperRuntimeModule = __webpack_require__(82444); -const plural = (n, singular, plural) => (n === 1 ? singular : plural); +class MakeNamespaceObjectRuntimeModule extends HelperRuntimeModule { + constructor() { + super("make namespace object"); + } -/** - * @param {Record} sizes sizes by source type - * @param {Object} options options - * @param {(number) => string=} options.formatSize size formatter - * @returns {string} text - */ -const printSizes = (sizes, { formatSize = n => `${n}` }) => { - const keys = Object.keys(sizes); - if (keys.length > 1) { - return keys.map(key => `${formatSize(sizes[key])} (${key})`).join(" "); - } else if (keys.length === 1) { - return formatSize(sizes[keys[0]]); + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeTemplate } = this.compilation; + const fn = RuntimeGlobals.makeNamespaceObject; + return Template.asString([ + "// define __esModule on exports", + `${fn} = ${runtimeTemplate.basicFunction("exports", [ + "if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {", + Template.indent([ + "Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });" + ]), + "}", + "Object.defineProperty(exports, '__esModule', { value: true });" + ])};` + ]); } -}; - -const getResourceName = resource => { - const dataUrl = /^data:[^,]+,/.exec(resource); - if (!dataUrl) return resource; - - const len = dataUrl[0].length + DATA_URI_CONTENT_LENGTH; - if (resource.length < len) return resource; - return `${resource.slice( - 0, - Math.min(resource.length - /* '..'.length */ 2, len) - )}..`; -}; - -const getModuleName = name => { - const [, prefix, resource] = /^(.*!)?([^!]*)$/.exec(name); - return [prefix, getResourceName(resource)]; -}; +} -const mapLines = (str, fn) => str.split("\n").map(fn).join("\n"); +module.exports = MakeNamespaceObjectRuntimeModule; -/** - * @param {number} n a number - * @returns {string} number as two digit string, leading 0 - */ -const twoDigit = n => (n >= 10 ? `${n}` : `0${n}`); -const isValidId = id => { - return typeof id === "number" || id; -}; +/***/ }), -const moreCount = (list, count) => { - return list && list.length > 0 ? `+ ${count}` : `${count}`; -}; +/***/ 44518: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** @type {Record string | void>} */ -const SIMPLE_PRINTERS = { - "compilation.summary!": ( - _, - { - type, - bold, - green, - red, - yellow, - formatDateTime, - formatTime, - compilation: { - name, - hash, - version, - time, - builtAt, - errorsCount, - warningsCount - } - } - ) => { - const root = type === "compilation.summary!"; - const warningsMessage = - warningsCount > 0 - ? yellow( - `${warningsCount} ${plural(warningsCount, "warning", "warnings")}` - ) - : ""; - const errorsMessage = - errorsCount > 0 - ? red(`${errorsCount} ${plural(errorsCount, "error", "errors")}`) - : ""; - const timeMessage = root && time ? ` in ${formatTime(time)}` : ""; - const hashMessage = hash ? ` (${hash})` : ""; - const builtAtMessage = - root && builtAt ? `${formatDateTime(builtAt)}: ` : ""; - const versionMessage = root && version ? `webpack ${version}` : ""; - const nameMessage = - root && name - ? bold(name) - : name - ? `Child ${bold(name)}` - : root - ? "" - : "Child"; - const subjectMessage = - nameMessage && versionMessage - ? `${nameMessage} (${versionMessage})` - : versionMessage || nameMessage || "webpack"; - let statusMessage; - if (errorsMessage && warningsMessage) { - statusMessage = `compiled with ${errorsMessage} and ${warningsMessage}`; - } else if (errorsMessage) { - statusMessage = `compiled with ${errorsMessage}`; - } else if (warningsMessage) { - statusMessage = `compiled with ${warningsMessage}`; - } else if (errorsCount === 0 && warningsCount === 0) { - statusMessage = `compiled ${green("successfully")}`; - } else { - statusMessage = `compiled`; - } - if ( - builtAtMessage || - versionMessage || - errorsMessage || - warningsMessage || - (errorsCount === 0 && warningsCount === 0) || - timeMessage || - hashMessage - ) - return `${builtAtMessage}${subjectMessage} ${statusMessage}${timeMessage}${hashMessage}`; - }, - "compilation.filteredWarningDetailsCount": count => - count - ? `${count} ${plural( - count, - "warning has", - "warnings have" - )} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.` - : undefined, - "compilation.filteredErrorDetailsCount": (count, { yellow }) => - count - ? yellow( - `${count} ${plural( - count, - "error has", - "errors have" - )} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.` - ) - : undefined, - "compilation.env": (env, { bold }) => - env - ? `Environment (--env): ${bold(JSON.stringify(env, null, 2))}` - : undefined, - "compilation.publicPath": (publicPath, { bold }) => - `PublicPath: ${bold(publicPath || "(none)")}`, - "compilation.entrypoints": (entrypoints, context, printer) => - Array.isArray(entrypoints) - ? undefined - : printer.print(context.type, Object.values(entrypoints), { - ...context, - chunkGroupKind: "Entrypoint" - }), - "compilation.namedChunkGroups": (namedChunkGroups, context, printer) => { - if (!Array.isArray(namedChunkGroups)) { - const { - compilation: { entrypoints } - } = context; - let chunkGroups = Object.values(namedChunkGroups); - if (entrypoints) { - chunkGroups = chunkGroups.filter( - group => - !Object.prototype.hasOwnProperty.call(entrypoints, group.name) - ); - } - return printer.print(context.type, chunkGroups, { - ...context, - chunkGroupKind: "Chunk Group" - }); - } - }, - "compilation.assetsByChunkName": () => "", +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ - "compilation.filteredModules": ( - filteredModules, - { compilation: { modules } } - ) => - filteredModules > 0 - ? `${moreCount(modules, filteredModules)} ${plural( - filteredModules, - "module", - "modules" - )}` - : undefined, - "compilation.filteredAssets": (filteredAssets, { compilation: { assets } }) => - filteredAssets > 0 - ? `${moreCount(assets, filteredAssets)} ${plural( - filteredAssets, - "asset", - "assets" - )}` - : undefined, - "compilation.logging": (logging, context, printer) => - Array.isArray(logging) - ? undefined - : printer.print( - context.type, - Object.entries(logging).map(([name, value]) => ({ ...value, name })), - context - ), - "compilation.warningsInChildren!": (_, { yellow, compilation }) => { - if ( - !compilation.children && - compilation.warningsCount > 0 && - compilation.warnings - ) { - const childWarnings = - compilation.warningsCount - compilation.warnings.length; - if (childWarnings > 0) { - return yellow( - `${childWarnings} ${plural( - childWarnings, - "WARNING", - "WARNINGS" - )} in child compilations${ - compilation.children - ? "" - : " (Use 'stats.children: true' resp. '--stats-children' for more details)" - }` - ); - } - } - }, - "compilation.errorsInChildren!": (_, { red, compilation }) => { - if ( - !compilation.children && - compilation.errorsCount > 0 && - compilation.errors - ) { - const childErrors = compilation.errorsCount - compilation.errors.length; - if (childErrors > 0) { - return red( - `${childErrors} ${plural( - childErrors, - "ERROR", - "ERRORS" - )} in child compilations${ - compilation.children - ? "" - : " (Use 'stats.children: true' resp. '--stats-children' for more details)" - }` - ); - } - } - }, - "asset.type": type => type, - "asset.name": (name, { formatFilename, asset: { isOverSizeLimit } }) => - formatFilename(name, isOverSizeLimit), - "asset.size": ( - size, - { asset: { isOverSizeLimit }, yellow, green, formatSize } - ) => (isOverSizeLimit ? yellow(formatSize(size)) : formatSize(size)), - "asset.emitted": (emitted, { green, formatFlag }) => - emitted ? green(formatFlag("emitted")) : undefined, - "asset.comparedForEmit": (comparedForEmit, { yellow, formatFlag }) => - comparedForEmit ? yellow(formatFlag("compared for emit")) : undefined, - "asset.cached": (cached, { green, formatFlag }) => - cached ? green(formatFlag("cached")) : undefined, - "asset.isOverSizeLimit": (isOverSizeLimit, { yellow, formatFlag }) => - isOverSizeLimit ? yellow(formatFlag("big")) : undefined, - "asset.info.immutable": (immutable, { green, formatFlag }) => - immutable ? green(formatFlag("immutable")) : undefined, - "asset.info.javascriptModule": (javascriptModule, { formatFlag }) => - javascriptModule ? formatFlag("javascript module") : undefined, - "asset.info.sourceFilename": (sourceFilename, { formatFlag }) => - sourceFilename - ? formatFlag( - sourceFilename === true - ? "from source file" - : `from: ${sourceFilename}` - ) - : undefined, - "asset.info.development": (development, { green, formatFlag }) => - development ? green(formatFlag("dev")) : undefined, - "asset.info.hotModuleReplacement": ( - hotModuleReplacement, - { green, formatFlag } - ) => (hotModuleReplacement ? green(formatFlag("hmr")) : undefined), - "asset.separator!": () => "\n", - "asset.filteredRelated": (filteredRelated, { asset: { related } }) => - filteredRelated > 0 - ? `${moreCount(related, filteredRelated)} related ${plural( - filteredRelated, - "asset", - "assets" - )}` - : undefined, - "asset.filteredChildren": (filteredChildren, { asset: { children } }) => - filteredChildren > 0 - ? `${moreCount(children, filteredChildren)} ${plural( - filteredChildren, - "asset", - "assets" - )}` - : undefined, +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); - assetChunk: (id, { formatChunkId }) => formatChunkId(id), +class OnChunksLoadedRuntimeModule extends RuntimeModule { + constructor() { + super("chunk loaded"); + } - assetChunkName: name => name, - assetChunkIdHint: name => name, + /** + * @returns {string} runtime code + */ + generate() { + const { compilation } = this; + const { runtimeTemplate } = compilation; + return Template.asString([ + "var deferred = [];", + `${RuntimeGlobals.onChunksLoaded} = ${runtimeTemplate.basicFunction( + "result, chunkIds, fn, priority", + [ + "if(chunkIds) {", + Template.indent([ + "priority = priority || 0;", + "for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];", + "deferred[i] = [chunkIds, fn, priority];", + "return;" + ]), + "}", + "var notFulfilled = Infinity;", + "for (var i = 0; i < deferred.length; i++) {", + Template.indent([ + runtimeTemplate.destructureArray( + ["chunkIds", "fn", "priority"], + "deferred[i]" + ), + "var fulfilled = true;", + "for (var j = 0; j < chunkIds.length; j++) {", + Template.indent([ + `if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(${ + RuntimeGlobals.onChunksLoaded + }).every(${runtimeTemplate.returningFunction( + `${RuntimeGlobals.onChunksLoaded}[key](chunkIds[j])`, + "key" + )})) {`, + Template.indent(["chunkIds.splice(j--, 1);"]), + "} else {", + Template.indent([ + "fulfilled = false;", + "if(priority < notFulfilled) notFulfilled = priority;" + ]), + "}" + ]), + "}", + "if(fulfilled) {", + Template.indent([ + "deferred.splice(i--, 1)", + "var r = fn();", + "if (r !== undefined) result = r;" + ]), + "}" + ]), + "}", + "return result;" + ] + )};` + ]); + } +} - "module.type": type => (type !== "module" ? type : undefined), - "module.id": (id, { formatModuleId }) => - isValidId(id) ? formatModuleId(id) : undefined, - "module.name": (name, { bold }) => { - const [prefix, resource] = getModuleName(name); - return `${prefix || ""}${bold(resource || "")}`; - }, - "module.identifier": identifier => undefined, - "module.layer": (layer, { formatLayer }) => - layer ? formatLayer(layer) : undefined, - "module.sizes": printSizes, - "module.chunks[]": (id, { formatChunkId }) => formatChunkId(id), - "module.depth": (depth, { formatFlag }) => - depth !== null ? formatFlag(`depth ${depth}`) : undefined, - "module.cacheable": (cacheable, { formatFlag, red }) => - cacheable === false ? red(formatFlag("not cacheable")) : undefined, - "module.orphan": (orphan, { formatFlag, yellow }) => - orphan ? yellow(formatFlag("orphan")) : undefined, - "module.runtime": (runtime, { formatFlag, yellow }) => - runtime ? yellow(formatFlag("runtime")) : undefined, - "module.optional": (optional, { formatFlag, yellow }) => - optional ? yellow(formatFlag("optional")) : undefined, - "module.dependent": (dependent, { formatFlag, cyan }) => - dependent ? cyan(formatFlag("dependent")) : undefined, - "module.built": (built, { formatFlag, yellow }) => - built ? yellow(formatFlag("built")) : undefined, - "module.codeGenerated": (codeGenerated, { formatFlag, yellow }) => - codeGenerated ? yellow(formatFlag("code generated")) : undefined, - "module.buildTimeExecuted": (buildTimeExecuted, { formatFlag, green }) => - buildTimeExecuted ? green(formatFlag("build time executed")) : undefined, - "module.cached": (cached, { formatFlag, green }) => - cached ? green(formatFlag("cached")) : undefined, - "module.assets": (assets, { formatFlag, magenta }) => - assets && assets.length - ? magenta( - formatFlag( - `${assets.length} ${plural(assets.length, "asset", "assets")}` - ) - ) - : undefined, - "module.warnings": (warnings, { formatFlag, yellow }) => - warnings === true - ? yellow(formatFlag("warnings")) - : warnings - ? yellow( - formatFlag(`${warnings} ${plural(warnings, "warning", "warnings")}`) - ) - : undefined, - "module.errors": (errors, { formatFlag, red }) => - errors === true - ? red(formatFlag("errors")) - : errors - ? red(formatFlag(`${errors} ${plural(errors, "error", "errors")}`)) - : undefined, - "module.providedExports": (providedExports, { formatFlag, cyan }) => { - if (Array.isArray(providedExports)) { - if (providedExports.length === 0) return cyan(formatFlag("no exports")); - return cyan(formatFlag(`exports: ${providedExports.join(", ")}`)); - } - }, - "module.usedExports": (usedExports, { formatFlag, cyan, module }) => { - if (usedExports !== true) { - if (usedExports === null) return cyan(formatFlag("used exports unknown")); - if (usedExports === false) return cyan(formatFlag("module unused")); - if (Array.isArray(usedExports)) { - if (usedExports.length === 0) - return cyan(formatFlag("no exports used")); - const providedExportsCount = Array.isArray(module.providedExports) - ? module.providedExports.length - : null; - if ( - providedExportsCount !== null && - providedExportsCount === usedExports.length - ) { - return cyan(formatFlag("all exports used")); - } else { - return cyan( - formatFlag(`only some exports used: ${usedExports.join(", ")}`) - ); - } - } - } - }, - "module.optimizationBailout[]": (optimizationBailout, { yellow }) => - yellow(optimizationBailout), - "module.issuerPath": (issuerPath, { module }) => - module.profile ? undefined : "", - "module.profile": profile => undefined, - "module.filteredModules": (filteredModules, { module: { modules } }) => - filteredModules > 0 - ? `${moreCount(modules, filteredModules)} nested ${plural( - filteredModules, - "module", - "modules" - )}` - : undefined, - "module.filteredReasons": (filteredReasons, { module: { reasons } }) => - filteredReasons > 0 - ? `${moreCount(reasons, filteredReasons)} ${plural( - filteredReasons, - "reason", - "reasons" - )}` - : undefined, - "module.filteredChildren": (filteredChildren, { module: { children } }) => - filteredChildren > 0 - ? `${moreCount(children, filteredChildren)} ${plural( - filteredChildren, - "module", - "modules" - )}` - : undefined, - "module.separator!": () => "\n", +module.exports = OnChunksLoadedRuntimeModule; - "moduleIssuer.id": (id, { formatModuleId }) => formatModuleId(id), - "moduleIssuer.profile.total": (value, { formatTime }) => formatTime(value), - "moduleReason.type": type => type, - "moduleReason.userRequest": (userRequest, { cyan }) => - cyan(getResourceName(userRequest)), - "moduleReason.moduleId": (moduleId, { formatModuleId }) => - isValidId(moduleId) ? formatModuleId(moduleId) : undefined, - "moduleReason.module": (module, { magenta }) => magenta(module), - "moduleReason.loc": loc => loc, - "moduleReason.explanation": (explanation, { cyan }) => cyan(explanation), - "moduleReason.active": (active, { formatFlag }) => - active ? undefined : formatFlag("inactive"), - "moduleReason.resolvedModule": (module, { magenta }) => magenta(module), - "moduleReason.filteredChildren": ( - filteredChildren, - { moduleReason: { children } } - ) => - filteredChildren > 0 - ? `${moreCount(children, filteredChildren)} ${plural( - filteredChildren, - "reason", - "reasons" - )}` - : undefined, +/***/ }), - "module.profile.total": (value, { formatTime }) => formatTime(value), - "module.profile.resolving": (value, { formatTime }) => - `resolving: ${formatTime(value)}`, - "module.profile.restoring": (value, { formatTime }) => - `restoring: ${formatTime(value)}`, - "module.profile.integration": (value, { formatTime }) => - `integration: ${formatTime(value)}`, - "module.profile.building": (value, { formatTime }) => - `building: ${formatTime(value)}`, - "module.profile.storing": (value, { formatTime }) => - `storing: ${formatTime(value)}`, - "module.profile.additionalResolving": (value, { formatTime }) => - value ? `additional resolving: ${formatTime(value)}` : undefined, - "module.profile.additionalIntegration": (value, { formatTime }) => - value ? `additional integration: ${formatTime(value)}` : undefined, +/***/ 56030: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - "chunkGroup.kind!": (_, { chunkGroupKind }) => chunkGroupKind, - "chunkGroup.separator!": () => "\n", - "chunkGroup.name": (name, { bold }) => bold(name), - "chunkGroup.isOverSizeLimit": (isOverSizeLimit, { formatFlag, yellow }) => - isOverSizeLimit ? yellow(formatFlag("big")) : undefined, - "chunkGroup.assetsSize": (size, { formatSize }) => - size ? formatSize(size) : undefined, - "chunkGroup.auxiliaryAssetsSize": (size, { formatSize }) => - size ? `(${formatSize(size)})` : undefined, - "chunkGroup.filteredAssets": (n, { chunkGroup: { assets } }) => - n > 0 - ? `${moreCount(assets, n)} ${plural(n, "asset", "assets")}` - : undefined, - "chunkGroup.filteredAuxiliaryAssets": ( - n, - { chunkGroup: { auxiliaryAssets } } - ) => - n > 0 - ? `${moreCount(auxiliaryAssets, n)} auxiliary ${plural( - n, - "asset", - "assets" - )}` - : undefined, - "chunkGroup.is!": () => "=", - "chunkGroupAsset.name": (asset, { green }) => green(asset), - "chunkGroupAsset.size": (size, { formatSize, chunkGroup }) => - chunkGroup.assets.length > 1 || - (chunkGroup.auxiliaryAssets && chunkGroup.auxiliaryAssets.length > 0) - ? formatSize(size) - : undefined, - "chunkGroup.children": (children, context, printer) => - Array.isArray(children) - ? undefined - : printer.print( - context.type, - Object.keys(children).map(key => ({ - type: key, - children: children[key] - })), - context - ), - "chunkGroupChildGroup.type": type => `${type}:`, - "chunkGroupChild.assets[]": (file, { formatFilename }) => - formatFilename(file), - "chunkGroupChild.chunks[]": (id, { formatChunkId }) => formatChunkId(id), - "chunkGroupChild.name": name => (name ? `(name: ${name})` : undefined), +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ - "chunk.id": (id, { formatChunkId }) => formatChunkId(id), - "chunk.files[]": (file, { formatFilename }) => formatFilename(file), - "chunk.names[]": name => name, - "chunk.idHints[]": name => name, - "chunk.runtime[]": name => name, - "chunk.sizes": (sizes, context) => printSizes(sizes, context), - "chunk.parents[]": (parents, context) => - context.formatChunkId(parents, "parent"), - "chunk.siblings[]": (siblings, context) => - context.formatChunkId(siblings, "sibling"), - "chunk.children[]": (children, context) => - context.formatChunkId(children, "child"), - "chunk.childrenByOrder": (childrenByOrder, context, printer) => - Array.isArray(childrenByOrder) - ? undefined - : printer.print( - context.type, - Object.keys(childrenByOrder).map(key => ({ - type: key, - children: childrenByOrder[key] - })), - context - ), - "chunk.childrenByOrder[].type": type => `${type}:`, - "chunk.childrenByOrder[].children[]": (id, { formatChunkId }) => - isValidId(id) ? formatChunkId(id) : undefined, - "chunk.entry": (entry, { formatFlag, yellow }) => - entry ? yellow(formatFlag("entry")) : undefined, - "chunk.initial": (initial, { formatFlag, yellow }) => - initial ? yellow(formatFlag("initial")) : undefined, - "chunk.rendered": (rendered, { formatFlag, green }) => - rendered ? green(formatFlag("rendered")) : undefined, - "chunk.recorded": (recorded, { formatFlag, green }) => - recorded ? green(formatFlag("recorded")) : undefined, - "chunk.reason": (reason, { yellow }) => (reason ? yellow(reason) : undefined), - "chunk.filteredModules": (filteredModules, { chunk: { modules } }) => - filteredModules > 0 - ? `${moreCount(modules, filteredModules)} chunk ${plural( - filteredModules, - "module", - "modules" - )}` - : undefined, - "chunk.separator!": () => "\n", - "chunkOrigin.request": request => request, - "chunkOrigin.moduleId": (moduleId, { formatModuleId }) => - isValidId(moduleId) ? formatModuleId(moduleId) : undefined, - "chunkOrigin.moduleName": (moduleName, { bold }) => bold(moduleName), - "chunkOrigin.loc": loc => loc, - "error.compilerPath": (compilerPath, { bold }) => - compilerPath ? bold(`(${compilerPath})`) : undefined, - "error.chunkId": (chunkId, { formatChunkId }) => - isValidId(chunkId) ? formatChunkId(chunkId) : undefined, - "error.chunkEntry": (chunkEntry, { formatFlag }) => - chunkEntry ? formatFlag("entry") : undefined, - "error.chunkInitial": (chunkInitial, { formatFlag }) => - chunkInitial ? formatFlag("initial") : undefined, - "error.file": (file, { bold }) => bold(file), - "error.moduleName": (moduleName, { bold }) => { - return moduleName.includes("!") - ? `${bold(moduleName.replace(/^(\s|\S)*!/, ""))} (${moduleName})` - : `${bold(moduleName)}`; - }, - "error.loc": (loc, { green }) => green(loc), - "error.message": (message, { bold, formatError }) => - message.includes("\u001b[") ? message : bold(formatError(message)), - "error.details": (details, { formatError }) => formatError(details), - "error.stack": stack => stack, - "error.moduleTrace": moduleTrace => undefined, - "error.separator!": () => "\n", +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); - "loggingEntry(error).loggingEntry.message": (message, { red }) => - mapLines(message, x => ` ${red(x)}`), - "loggingEntry(warn).loggingEntry.message": (message, { yellow }) => - mapLines(message, x => ` ${yellow(x)}`), - "loggingEntry(info).loggingEntry.message": (message, { green }) => - mapLines(message, x => ` ${green(x)}`), - "loggingEntry(log).loggingEntry.message": (message, { bold }) => - mapLines(message, x => ` ${bold(x)}`), - "loggingEntry(debug).loggingEntry.message": message => - mapLines(message, x => ` ${x}`), - "loggingEntry(trace).loggingEntry.message": message => - mapLines(message, x => ` ${x}`), - "loggingEntry(status).loggingEntry.message": (message, { magenta }) => - mapLines(message, x => ` ${magenta(x)}`), - "loggingEntry(profile).loggingEntry.message": (message, { magenta }) => - mapLines(message, x => `

${magenta(x)}`), - "loggingEntry(profileEnd).loggingEntry.message": (message, { magenta }) => - mapLines(message, x => `

${magenta(x)}`), - "loggingEntry(time).loggingEntry.message": (message, { magenta }) => - mapLines(message, x => ` ${magenta(x)}`), - "loggingEntry(group).loggingEntry.message": (message, { cyan }) => - mapLines(message, x => `<-> ${cyan(x)}`), - "loggingEntry(groupCollapsed).loggingEntry.message": (message, { cyan }) => - mapLines(message, x => `<+> ${cyan(x)}`), - "loggingEntry(clear).loggingEntry": () => " -------", - "loggingEntry(groupCollapsed).loggingEntry.children": () => "", - "loggingEntry.trace[]": trace => - trace ? mapLines(trace, x => `| ${x}`) : undefined, +class PublicPathRuntimeModule extends RuntimeModule { + constructor(publicPath) { + super("publicPath", RuntimeModule.STAGE_BASIC); + this.publicPath = publicPath; + } - "moduleTraceItem.originName": originName => originName, + /** + * @returns {string} runtime code + */ + generate() { + const { compilation, publicPath } = this; - loggingGroup: loggingGroup => - loggingGroup.entries.length === 0 ? "" : undefined, - "loggingGroup.debug": (flag, { red }) => (flag ? red("DEBUG") : undefined), - "loggingGroup.name": (name, { bold }) => bold(`LOG from ${name}`), - "loggingGroup.separator!": () => "\n", - "loggingGroup.filteredEntries": filteredEntries => - filteredEntries > 0 ? `+ ${filteredEntries} hidden lines` : undefined, + return `${RuntimeGlobals.publicPath} = ${JSON.stringify( + compilation.getPath(publicPath || "", { + hash: compilation.hash || "XXXX" + }) + )};`; + } +} - "moduleTraceDependency.loc": loc => loc -}; +module.exports = PublicPathRuntimeModule; -/** @type {Record} */ -const ITEM_NAMES = { - "compilation.assets[]": "asset", - "compilation.modules[]": "module", - "compilation.chunks[]": "chunk", - "compilation.entrypoints[]": "chunkGroup", - "compilation.namedChunkGroups[]": "chunkGroup", - "compilation.errors[]": "error", - "compilation.warnings[]": "error", - "compilation.logging[]": "loggingGroup", - "compilation.children[]": "compilation", - "asset.related[]": "asset", - "asset.children[]": "asset", - "asset.chunks[]": "assetChunk", - "asset.auxiliaryChunks[]": "assetChunk", - "asset.chunkNames[]": "assetChunkName", - "asset.chunkIdHints[]": "assetChunkIdHint", - "asset.auxiliaryChunkNames[]": "assetChunkName", - "asset.auxiliaryChunkIdHints[]": "assetChunkIdHint", - "chunkGroup.assets[]": "chunkGroupAsset", - "chunkGroup.auxiliaryAssets[]": "chunkGroupAsset", - "chunkGroupChild.assets[]": "chunkGroupAsset", - "chunkGroupChild.auxiliaryAssets[]": "chunkGroupAsset", - "chunkGroup.children[]": "chunkGroupChildGroup", - "chunkGroupChildGroup.children[]": "chunkGroupChild", - "module.modules[]": "module", - "module.children[]": "module", - "module.reasons[]": "moduleReason", - "moduleReason.children[]": "moduleReason", - "module.issuerPath[]": "moduleIssuer", - "chunk.origins[]": "chunkOrigin", - "chunk.modules[]": "module", - "loggingGroup.entries[]": logEntry => - `loggingEntry(${logEntry.type}).loggingEntry`, - "loggingEntry.children[]": logEntry => - `loggingEntry(${logEntry.type}).loggingEntry`, - "error.moduleTrace[]": "moduleTraceItem", - "moduleTraceItem.dependencies[]": "moduleTraceDependency" -}; -const ERROR_PREFERRED_ORDER = [ - "compilerPath", - "chunkId", - "chunkEntry", - "chunkInitial", - "file", - "separator!", - "moduleName", - "loc", - "separator!", - "message", - "separator!", - "details", - "separator!", - "stack", - "separator!", - "missing", - "separator!", - "moduleTrace" -]; +/***/ }), -/** @type {Record} */ -const PREFERRED_ORDERS = { - compilation: [ - "name", - "hash", - "version", - "time", - "builtAt", - "env", - "publicPath", - "assets", - "filteredAssets", - "entrypoints", - "namedChunkGroups", - "chunks", - "modules", - "filteredModules", - "children", - "logging", - "warnings", - "warningsInChildren!", - "filteredWarningDetailsCount", - "errors", - "errorsInChildren!", - "filteredErrorDetailsCount", - "summary!", - "needAdditionalPass" - ], - asset: [ - "type", - "name", - "size", - "chunks", - "auxiliaryChunks", - "emitted", - "comparedForEmit", - "cached", - "info", - "isOverSizeLimit", - "chunkNames", - "auxiliaryChunkNames", - "chunkIdHints", - "auxiliaryChunkIdHints", - "related", - "filteredRelated", - "children", - "filteredChildren" - ], - "asset.info": [ - "immutable", - "sourceFilename", - "javascriptModule", - "development", - "hotModuleReplacement" - ], - chunkGroup: [ - "kind!", - "name", - "isOverSizeLimit", - "assetsSize", - "auxiliaryAssetsSize", - "is!", - "assets", - "filteredAssets", - "auxiliaryAssets", - "filteredAuxiliaryAssets", - "separator!", - "children" - ], - chunkGroupAsset: ["name", "size"], - chunkGroupChildGroup: ["type", "children"], - chunkGroupChild: ["assets", "chunks", "name"], - module: [ - "type", - "name", - "identifier", - "id", - "layer", - "sizes", - "chunks", - "depth", - "cacheable", - "orphan", - "runtime", - "optional", - "dependent", - "built", - "codeGenerated", - "cached", - "assets", - "failed", - "warnings", - "errors", - "children", - "filteredChildren", - "providedExports", - "usedExports", - "optimizationBailout", - "reasons", - "filteredReasons", - "issuerPath", - "profile", - "modules", - "filteredModules" - ], - moduleReason: [ - "active", - "type", - "userRequest", - "moduleId", - "module", - "resolvedModule", - "loc", - "explanation", - "children", - "filteredChildren" - ], - "module.profile": [ - "total", - "separator!", - "resolving", - "restoring", - "integration", - "building", - "storing", - "additionalResolving", - "additionalIntegration" - ], - chunk: [ - "id", - "runtime", - "files", - "names", - "idHints", - "sizes", - "parents", - "siblings", - "children", - "childrenByOrder", - "entry", - "initial", - "rendered", - "recorded", - "reason", - "separator!", - "origins", - "separator!", - "modules", - "separator!", - "filteredModules" - ], - chunkOrigin: ["request", "moduleId", "moduleName", "loc"], - error: ERROR_PREFERRED_ORDER, - warning: ERROR_PREFERRED_ORDER, - "chunk.childrenByOrder[]": ["type", "children"], - loggingGroup: [ - "debug", - "name", - "separator!", - "entries", - "separator!", - "filteredEntries" - ], - loggingEntry: ["message", "trace", "children"] -}; +/***/ 4537: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -const itemsJoinOneLine = items => items.filter(Boolean).join(" "); -const itemsJoinOneLineBrackets = items => - items.length > 0 ? `(${items.filter(Boolean).join(" ")})` : undefined; -const itemsJoinMoreSpacing = items => items.filter(Boolean).join("\n\n"); -const itemsJoinComma = items => items.filter(Boolean).join(", "); -const itemsJoinCommaBrackets = items => - items.length > 0 ? `(${items.filter(Boolean).join(", ")})` : undefined; -const itemsJoinCommaBracketsWithName = name => items => - items.length > 0 - ? `(${name}: ${items.filter(Boolean).join(", ")})` - : undefined; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ -/** @type {Record string>} */ -const SIMPLE_ITEMS_JOINER = { - "chunk.parents": itemsJoinOneLine, - "chunk.siblings": itemsJoinOneLine, - "chunk.children": itemsJoinOneLine, - "chunk.names": itemsJoinCommaBrackets, - "chunk.idHints": itemsJoinCommaBracketsWithName("id hint"), - "chunk.runtime": itemsJoinCommaBracketsWithName("runtime"), - "chunk.files": itemsJoinComma, - "chunk.childrenByOrder": itemsJoinOneLine, - "chunk.childrenByOrder[].children": itemsJoinOneLine, - "chunkGroup.assets": itemsJoinOneLine, - "chunkGroup.auxiliaryAssets": itemsJoinOneLineBrackets, - "chunkGroupChildGroup.children": itemsJoinComma, - "chunkGroupChild.assets": itemsJoinOneLine, - "chunkGroupChild.auxiliaryAssets": itemsJoinOneLineBrackets, - "asset.chunks": itemsJoinComma, - "asset.auxiliaryChunks": itemsJoinCommaBrackets, - "asset.chunkNames": itemsJoinCommaBracketsWithName("name"), - "asset.auxiliaryChunkNames": itemsJoinCommaBracketsWithName("auxiliary name"), - "asset.chunkIdHints": itemsJoinCommaBracketsWithName("id hint"), - "asset.auxiliaryChunkIdHints": - itemsJoinCommaBracketsWithName("auxiliary id hint"), - "module.chunks": itemsJoinOneLine, - "module.issuerPath": items => - items - .filter(Boolean) - .map(item => `${item} ->`) - .join(" "), - "compilation.errors": itemsJoinMoreSpacing, - "compilation.warnings": itemsJoinMoreSpacing, - "compilation.logging": itemsJoinMoreSpacing, - "compilation.children": items => indent(itemsJoinMoreSpacing(items), " "), - "moduleTraceItem.dependencies": itemsJoinOneLine, - "loggingEntry.children": items => - indent(items.filter(Boolean).join("\n"), " ", false) -}; -const joinOneLine = items => - items - .map(item => item.content) - .filter(Boolean) - .join(" "); -const joinInBrackets = items => { - const res = []; - let mode = 0; - for (const item of items) { - if (item.element === "separator!") { - switch (mode) { - case 0: - case 1: - mode += 2; - break; - case 4: - res.push(")"); - mode = 3; - break; - } - } - if (!item.content) continue; - switch (mode) { - case 0: - mode = 1; - break; - case 1: - res.push(" "); - break; - case 2: - res.push("("); - mode = 4; - break; - case 3: - res.push(" ("); - mode = 4; - break; - case 4: - res.push(", "); - break; - } - res.push(item.content); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const HelperRuntimeModule = __webpack_require__(82444); + +class RelativeUrlRuntimeModule extends HelperRuntimeModule { + constructor() { + super("relative url"); + } + + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeTemplate } = this.compilation; + return Template.asString([ + `${RuntimeGlobals.relativeUrl} = function RelativeURL(url) {`, + Template.indent([ + 'var realUrl = new URL(url, "x:/");', + "var values = {};", + "for (var key in realUrl) values[key] = realUrl[key];", + "values.href = url;", + 'values.pathname = url.replace(/[?#].*/, "");', + 'values.origin = values.protocol = "";', + `values.toString = values.toJSON = ${runtimeTemplate.returningFunction( + "url" + )};`, + "for (var key in values) Object.defineProperty(this, key, { enumerable: true, configurable: true, value: values[key] });" + ]), + "};", + `${RuntimeGlobals.relativeUrl}.prototype = URL.prototype;` + ]); } - if (mode === 4) res.push(")"); - return res.join(""); -}; +} -const indent = (str, prefix, noPrefixInFirstLine) => { - const rem = str.replace(/\n([^\n])/g, "\n" + prefix + "$1"); - if (noPrefixInFirstLine) return rem; - const ind = str[0] === "\n" ? "" : prefix; - return ind + rem; -}; +module.exports = RelativeUrlRuntimeModule; -const joinExplicitNewLine = (items, indenter) => { - let firstInLine = true; - let first = true; - return items - .map(item => { - if (!item || !item.content) return; - let content = indent(item.content, first ? "" : indenter, !firstInLine); - if (firstInLine) { - content = content.replace(/^\n+/, ""); - } - if (!content) return; - first = false; - const noJoiner = firstInLine || content.startsWith("\n"); - firstInLine = content.endsWith("\n"); - return noJoiner ? content : " " + content; - }) - .filter(Boolean) - .join("") - .trim(); -}; -const joinError = - error => - (items, { red, yellow }) => - `${error ? red("ERROR") : yellow("WARNING")} in ${joinExplicitNewLine( - items, - "" - )}`; +/***/ }), -/** @type {Record string>} */ -const SIMPLE_ELEMENT_JOINERS = { - compilation: items => { - const result = []; - let lastNeedMore = false; - for (const item of items) { - if (!item.content) continue; - const needMoreSpace = - item.element === "warnings" || - item.element === "filteredWarningDetailsCount" || - item.element === "errors" || - item.element === "filteredErrorDetailsCount" || - item.element === "logging"; - if (result.length !== 0) { - result.push(needMoreSpace || lastNeedMore ? "\n\n" : "\n"); - } - result.push(item.content); - lastNeedMore = needMoreSpace; - } - if (lastNeedMore) result.push("\n"); - return result.join(""); - }, - asset: items => - joinExplicitNewLine( - items.map(item => { - if ( - (item.element === "related" || item.element === "children") && - item.content - ) { - return { - ...item, - content: `\n${item.content}\n` - }; - } - return item; - }), - " " - ), - "asset.info": joinOneLine, - module: (items, { module }) => { - let hasName = false; - return joinExplicitNewLine( - items.map(item => { - switch (item.element) { - case "id": - if (module.id === module.name) { - if (hasName) return false; - if (item.content) hasName = true; - } - break; - case "name": - if (hasName) return false; - if (item.content) hasName = true; - break; - case "providedExports": - case "usedExports": - case "optimizationBailout": - case "reasons": - case "issuerPath": - case "profile": - case "children": - case "modules": - if (item.content) { - return { - ...item, - content: `\n${item.content}\n` - }; - } - break; - } - return item; - }), - " " - ); - }, - chunk: items => { - let hasEntry = false; - return ( - "chunk " + - joinExplicitNewLine( - items.filter(item => { - switch (item.element) { - case "entry": - if (item.content) hasEntry = true; - break; - case "initial": - if (hasEntry) return false; - break; - } - return true; - }), - " " - ) - ); - }, - "chunk.childrenByOrder[]": items => `(${joinOneLine(items)})`, - chunkGroup: items => joinExplicitNewLine(items, " "), - chunkGroupAsset: joinOneLine, - chunkGroupChildGroup: joinOneLine, - chunkGroupChild: joinOneLine, - // moduleReason: (items, { moduleReason }) => { - // let hasName = false; - // return joinOneLine( - // items.filter(item => { - // switch (item.element) { - // case "moduleId": - // if (moduleReason.moduleId === moduleReason.module && item.content) - // hasName = true; - // break; - // case "module": - // if (hasName) return false; - // break; - // case "resolvedModule": - // return ( - // moduleReason.module !== moduleReason.resolvedModule && - // item.content - // ); - // } - // return true; - // }) - // ); - // }, - moduleReason: (items, { moduleReason }) => { - let hasName = false; - return joinExplicitNewLine( - items.map(item => { - switch (item.element) { - case "moduleId": - if (moduleReason.moduleId === moduleReason.module && item.content) - hasName = true; - break; - case "module": - if (hasName) return false; - break; - case "resolvedModule": - if (moduleReason.module === moduleReason.resolvedModule) - return false; - break; - case "children": - if (item.content) { - return { - ...item, - content: `\n${item.content}\n` - }; - } - break; - } - return item; - }), - " " - ); - }, - "module.profile": joinInBrackets, - moduleIssuer: joinOneLine, - chunkOrigin: items => "> " + joinOneLine(items), - "errors[].error": joinError(true), - "warnings[].error": joinError(false), - loggingGroup: items => joinExplicitNewLine(items, "").trimRight(), - moduleTraceItem: items => " @ " + joinOneLine(items), - moduleTraceDependency: joinOneLine -}; +/***/ 97115: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -const AVAILABLE_COLORS = { - bold: "\u001b[1m", - yellow: "\u001b[1m\u001b[33m", - red: "\u001b[1m\u001b[31m", - green: "\u001b[1m\u001b[32m", - cyan: "\u001b[1m\u001b[36m", - magenta: "\u001b[1m\u001b[35m" -}; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ -const AVAILABLE_FORMATS = { - formatChunkId: (id, { yellow }, direction) => { - switch (direction) { - case "parent": - return `<{${yellow(id)}}>`; - case "sibling": - return `={${yellow(id)}}=`; - case "child": - return `>{${yellow(id)}}<`; - default: - return `{${yellow(id)}}`; - } - }, - formatModuleId: id => `[${id}]`, - formatFilename: (filename, { green, yellow }, oversize) => - (oversize ? yellow : green)(filename), - formatFlag: flag => `[${flag}]`, - formatLayer: layer => `(in ${layer})`, - formatSize: (__webpack_require__(71070).formatSize), - formatDateTime: (dateTime, { bold }) => { - const d = new Date(dateTime); - const x = twoDigit; - const date = `${d.getFullYear()}-${x(d.getMonth() + 1)}-${x(d.getDate())}`; - const time = `${x(d.getHours())}:${x(d.getMinutes())}:${x(d.getSeconds())}`; - return `${date} ${bold(time)}`; - }, - formatTime: ( - time, - { timeReference, bold, green, yellow, red }, - boldQuantity - ) => { - const unit = " ms"; - if (timeReference && time !== timeReference) { - const times = [ - timeReference / 2, - timeReference / 4, - timeReference / 8, - timeReference / 16 - ]; - if (time < times[3]) return `${time}${unit}`; - else if (time < times[2]) return bold(`${time}${unit}`); - else if (time < times[1]) return green(`${time}${unit}`); - else if (time < times[0]) return yellow(`${time}${unit}`); - else return red(`${time}${unit}`); - } else { - return `${boldQuantity ? bold(time) : time}${unit}`; - } - }, - formatError: (message, { green, yellow, red }) => { - if (message.includes("\u001b[")) return message; - const highlights = [ - { regExp: /(Did you mean .+)/g, format: green }, - { - regExp: /(Set 'mode' option to 'development' or 'production')/g, - format: green - }, - { regExp: /(\(module has no exports\))/g, format: red }, - { regExp: /\(possible exports: (.+)\)/g, format: green }, - { regExp: /(?:^|\n)(.* doesn't exist)/g, format: red }, - { regExp: /('\w+' option has not been set)/g, format: red }, - { - regExp: /(Emitted value instead of an instance of Error)/g, - format: yellow - }, - { regExp: /(Used? .+ instead)/gi, format: yellow }, - { regExp: /\b(deprecated|must|required)\b/g, format: yellow }, - { - regExp: /\b(BREAKING CHANGE)\b/gi, - format: red - }, - { - regExp: - /\b(error|failed|unexpected|invalid|not found|not supported|not available|not possible|not implemented|doesn't support|conflict|conflicting|not existing|duplicate)\b/gi, - format: red - } - ]; - for (const { regExp, format } of highlights) { - message = message.replace(regExp, (match, content) => { - return match.replace(content, format(content)); - }); - } - return message; - } -}; -const RESULT_MODIFIER = { - "module.modules": result => { - return indent(result, "| "); + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); + +class RuntimeIdRuntimeModule extends RuntimeModule { + constructor() { + super("runtimeId"); } -}; -const createOrder = (array, preferredOrder) => { - const originalArray = array.slice(); - const set = new Set(array); - const usedSet = new Set(); - array.length = 0; - for (const element of preferredOrder) { - if (element.endsWith("!") || set.has(element)) { - array.push(element); - usedSet.add(element); - } + /** + * @returns {string} runtime code + */ + generate() { + const { chunkGraph, chunk } = this; + const runtime = chunk.runtime; + if (typeof runtime !== "string") + throw new Error("RuntimeIdRuntimeModule must be in a single runtime"); + const id = chunkGraph.getRuntimeId(runtime); + return `${RuntimeGlobals.runtimeId} = ${JSON.stringify(id)};`; } - for (const element of originalArray) { - if (!usedSet.has(element)) { - array.push(element); - } +} + +module.exports = RuntimeIdRuntimeModule; + + +/***/ }), + +/***/ 22339: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const StartupChunkDependenciesRuntimeModule = __webpack_require__(38157); +const StartupEntrypointRuntimeModule = __webpack_require__(97672); + +/** @typedef {import("../Compiler")} Compiler */ + +class StartupChunkDependenciesPlugin { + constructor(options) { + this.chunkLoading = options.chunkLoading; + this.asyncChunkLoading = + typeof options.asyncChunkLoading === "boolean" + ? options.asyncChunkLoading + : true; } - return array; -}; -class DefaultStatsPrinterPlugin { /** * Apply the plugin * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap("DefaultStatsPrinterPlugin", compilation => { - compilation.hooks.statsPrinter.tap( - "DefaultStatsPrinterPlugin", - (stats, options, context) => { - // Put colors into context - stats.hooks.print - .for("compilation") - .tap("DefaultStatsPrinterPlugin", (compilation, context) => { - for (const color of Object.keys(AVAILABLE_COLORS)) { - let start; - if (options.colors) { - if ( - typeof options.colors === "object" && - typeof options.colors[color] === "string" - ) { - start = options.colors[color]; - } else { - start = AVAILABLE_COLORS[color]; - } - } - if (start) { - context[color] = str => - `${start}${ - typeof str === "string" - ? str.replace( - /((\u001b\[39m|\u001b\[22m|\u001b\[0m)+)/g, - `$1${start}` - ) - : str - }\u001b[39m\u001b[22m`; - } else { - context[color] = str => str; - } - } - for (const format of Object.keys(AVAILABLE_FORMATS)) { - context[format] = (content, ...args) => - AVAILABLE_FORMATS[format](content, context, ...args); - } - context.timeReference = compilation.time; - }); - - for (const key of Object.keys(SIMPLE_PRINTERS)) { - stats.hooks.print - .for(key) - .tap("DefaultStatsPrinterPlugin", (obj, ctx) => - SIMPLE_PRINTERS[key](obj, ctx, stats) - ); - } - - for (const key of Object.keys(PREFERRED_ORDERS)) { - const preferredOrder = PREFERRED_ORDERS[key]; - stats.hooks.sortElements - .for(key) - .tap("DefaultStatsPrinterPlugin", (elements, context) => { - createOrder(elements, preferredOrder); - }); - } - - for (const key of Object.keys(ITEM_NAMES)) { - const itemName = ITEM_NAMES[key]; - stats.hooks.getItemName - .for(key) - .tap( - "DefaultStatsPrinterPlugin", - typeof itemName === "string" ? () => itemName : itemName + compiler.hooks.thisCompilation.tap( + "StartupChunkDependenciesPlugin", + compilation => { + const globalChunkLoading = compilation.outputOptions.chunkLoading; + const isEnabledForChunk = chunk => { + const options = chunk.getEntryOptions(); + const chunkLoading = + options && options.chunkLoading !== undefined + ? options.chunkLoading + : globalChunkLoading; + return chunkLoading === this.chunkLoading; + }; + compilation.hooks.additionalTreeRuntimeRequirements.tap( + "StartupChunkDependenciesPlugin", + (chunk, set, { chunkGraph }) => { + if (!isEnabledForChunk(chunk)) return; + if (chunkGraph.hasChunkEntryDependentChunks(chunk)) { + set.add(RuntimeGlobals.startup); + set.add(RuntimeGlobals.ensureChunk); + set.add(RuntimeGlobals.ensureChunkIncludeEntries); + compilation.addRuntimeModule( + chunk, + new StartupChunkDependenciesRuntimeModule( + this.asyncChunkLoading + ) ); + } } - - for (const key of Object.keys(SIMPLE_ITEMS_JOINER)) { - const joiner = SIMPLE_ITEMS_JOINER[key]; - stats.hooks.printItems - .for(key) - .tap("DefaultStatsPrinterPlugin", joiner); - } - - for (const key of Object.keys(SIMPLE_ELEMENT_JOINERS)) { - const joiner = SIMPLE_ELEMENT_JOINERS[key]; - stats.hooks.printElements - .for(key) - .tap("DefaultStatsPrinterPlugin", joiner); - } - - for (const key of Object.keys(RESULT_MODIFIER)) { - const modifier = RESULT_MODIFIER[key]; - stats.hooks.result - .for(key) - .tap("DefaultStatsPrinterPlugin", modifier); - } - } - ); - }); + ); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.startupEntrypoint) + .tap("StartupChunkDependenciesPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.require); + set.add(RuntimeGlobals.ensureChunk); + set.add(RuntimeGlobals.ensureChunkIncludeEntries); + compilation.addRuntimeModule( + chunk, + new StartupEntrypointRuntimeModule(this.asyncChunkLoading) + ); + }); + } + ); } } -module.exports = DefaultStatsPrinterPlugin; + +module.exports = StartupChunkDependenciesPlugin; /***/ }), -/***/ 92629: +/***/ 38157: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -120719,554 +117473,227 @@ module.exports = DefaultStatsPrinterPlugin; -const { HookMap, SyncBailHook, SyncWaterfallHook } = __webpack_require__(6967); -const { concatComparators, keepOriginalOrder } = __webpack_require__(29579); -const smartGrouping = __webpack_require__(15652); - -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - -/** @typedef {import("../util/smartGrouping").GroupConfig} GroupConfig */ - -/** - * @typedef {Object} KnownStatsFactoryContext - * @property {string} type - * @property {function(string): string=} makePathsRelative - * @property {Compilation=} compilation - * @property {Set=} rootModules - * @property {Map=} compilationFileToChunks - * @property {Map=} compilationAuxiliaryFileToChunks - * @property {RuntimeSpec=} runtime - * @property {function(Compilation): WebpackError[]=} cachedGetErrors - * @property {function(Compilation): WebpackError[]=} cachedGetWarnings - */ - -/** @typedef {KnownStatsFactoryContext & Record} StatsFactoryContext */ - -class StatsFactory { - constructor() { - this.hooks = Object.freeze({ - /** @type {HookMap>} */ - extract: new HookMap( - () => new SyncBailHook(["object", "data", "context"]) - ), - /** @type {HookMap>} */ - filter: new HookMap( - () => new SyncBailHook(["item", "context", "index", "unfilteredIndex"]) - ), - /** @type {HookMap>} */ - sort: new HookMap(() => new SyncBailHook(["comparators", "context"])), - /** @type {HookMap>} */ - filterSorted: new HookMap( - () => new SyncBailHook(["item", "context", "index", "unfilteredIndex"]) - ), - /** @type {HookMap>} */ - groupResults: new HookMap( - () => new SyncBailHook(["groupConfigs", "context"]) - ), - /** @type {HookMap>} */ - sortResults: new HookMap( - () => new SyncBailHook(["comparators", "context"]) - ), - /** @type {HookMap>} */ - filterResults: new HookMap( - () => new SyncBailHook(["item", "context", "index", "unfilteredIndex"]) - ), - /** @type {HookMap>} */ - merge: new HookMap(() => new SyncBailHook(["items", "context"])), - /** @type {HookMap>} */ - result: new HookMap(() => new SyncWaterfallHook(["result", "context"])), - /** @type {HookMap>} */ - getItemName: new HookMap(() => new SyncBailHook(["item", "context"])), - /** @type {HookMap>} */ - getItemFactory: new HookMap(() => new SyncBailHook(["item", "context"])) - }); - const hooks = this.hooks; - this._caches = - /** @type {Record[]>>} */ ({}); - for (const key of Object.keys(hooks)) { - this._caches[key] = new Map(); - } - this._inCreate = false; - } - - _getAllLevelHooks(hookMap, cache, type) { - const cacheEntry = cache.get(type); - if (cacheEntry !== undefined) { - return cacheEntry; - } - const hooks = []; - const typeParts = type.split("."); - for (let i = 0; i < typeParts.length; i++) { - const hook = hookMap.get(typeParts.slice(i).join(".")); - if (hook) { - hooks.push(hook); - } - } - cache.set(type, hooks); - return hooks; - } - - _forEachLevel(hookMap, cache, type, fn) { - for (const hook of this._getAllLevelHooks(hookMap, cache, type)) { - const result = fn(hook); - if (result !== undefined) return result; - } - } - - _forEachLevelWaterfall(hookMap, cache, type, data, fn) { - for (const hook of this._getAllLevelHooks(hookMap, cache, type)) { - data = fn(hook, data); - } - return data; - } +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); - _forEachLevelFilter(hookMap, cache, type, items, fn, forceClone) { - const hooks = this._getAllLevelHooks(hookMap, cache, type); - if (hooks.length === 0) return forceClone ? items.slice() : items; - let i = 0; - return items.filter((item, idx) => { - for (const hook of hooks) { - const r = fn(hook, item, idx, i); - if (r !== undefined) { - if (r) i++; - return r; - } - } - i++; - return true; - }); +class StartupChunkDependenciesRuntimeModule extends RuntimeModule { + constructor(asyncChunkLoading) { + super("startup chunk dependencies", RuntimeModule.STAGE_TRIGGER); + this.asyncChunkLoading = asyncChunkLoading; } /** - * @param {string} type type - * @param {any} data factory data - * @param {Omit} baseContext context used as base - * @returns {any} created object + * @returns {string} runtime code */ - create(type, data, baseContext) { - if (this._inCreate) { - return this._create(type, data, baseContext); - } else { - try { - this._inCreate = true; - return this._create(type, data, baseContext); - } finally { - for (const key of Object.keys(this._caches)) this._caches[key].clear(); - this._inCreate = false; - } - } + generate() { + const { chunkGraph, chunk, compilation } = this; + const { runtimeTemplate } = compilation; + const chunkIds = Array.from( + chunkGraph.getChunkEntryDependentChunksIterable(chunk) + ).map(chunk => { + return chunk.id; + }); + return Template.asString([ + `var next = ${RuntimeGlobals.startup};`, + `${RuntimeGlobals.startup} = ${runtimeTemplate.basicFunction( + "", + !this.asyncChunkLoading + ? chunkIds + .map( + id => `${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)});` + ) + .concat("return next();") + : chunkIds.length === 1 + ? `return ${RuntimeGlobals.ensureChunk}(${JSON.stringify( + chunkIds[0] + )}).then(next);` + : chunkIds.length > 2 + ? [ + // using map is shorter for 3 or more chunks + `return Promise.all(${JSON.stringify(chunkIds)}.map(${ + RuntimeGlobals.ensureChunk + }, __webpack_require__)).then(next);` + ] + : [ + // calling ensureChunk directly is shorter for 0 - 2 chunks + "return Promise.all([", + Template.indent( + chunkIds + .map( + id => `${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)})` + ) + .join(",\n") + ), + "]).then(next);" + ] + )};` + ]); } +} - _create(type, data, baseContext) { - const context = { - ...baseContext, - type, - [type]: data - }; - if (Array.isArray(data)) { - // run filter on unsorted items - const items = this._forEachLevelFilter( - this.hooks.filter, - this._caches.filter, - type, - data, - (h, r, idx, i) => h.call(r, context, idx, i), - true - ); - - // sort items - const comparators = []; - this._forEachLevel(this.hooks.sort, this._caches.sort, type, h => - h.call(comparators, context) - ); - if (comparators.length > 0) { - items.sort( - // @ts-expect-error number of arguments is correct - concatComparators(...comparators, keepOriginalOrder(items)) - ); - } - - // run filter on sorted items - const items2 = this._forEachLevelFilter( - this.hooks.filterSorted, - this._caches.filterSorted, - type, - items, - (h, r, idx, i) => h.call(r, context, idx, i), - false - ); - - // for each item - let resultItems = items2.map((item, i) => { - const itemContext = { - ...context, - _index: i - }; +module.exports = StartupChunkDependenciesRuntimeModule; - // run getItemName - const itemName = this._forEachLevel( - this.hooks.getItemName, - this._caches.getItemName, - `${type}[]`, - h => h.call(item, itemContext) - ); - if (itemName) itemContext[itemName] = item; - const innerType = itemName ? `${type}[].${itemName}` : `${type}[]`; - // run getItemFactory - const itemFactory = - this._forEachLevel( - this.hooks.getItemFactory, - this._caches.getItemFactory, - innerType, - h => h.call(item, itemContext) - ) || this; +/***/ }), - // run item factory - return itemFactory.create(innerType, item, itemContext); - }); +/***/ 97672: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // sort result items - const comparators2 = []; - this._forEachLevel( - this.hooks.sortResults, - this._caches.sortResults, - type, - h => h.call(comparators2, context) - ); - if (comparators2.length > 0) { - resultItems.sort( - // @ts-expect-error number of arguments is correct - concatComparators(...comparators2, keepOriginalOrder(resultItems)) - ); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ - // group result items - const groupConfigs = []; - this._forEachLevel( - this.hooks.groupResults, - this._caches.groupResults, - type, - h => h.call(groupConfigs, context) - ); - if (groupConfigs.length > 0) { - resultItems = smartGrouping(resultItems, groupConfigs); - } - // run filter on sorted result items - const finalResultItems = this._forEachLevelFilter( - this.hooks.filterResults, - this._caches.filterResults, - type, - resultItems, - (h, r, idx, i) => h.call(r, context, idx, i), - false - ); - // run merge on mapped items - let result = this._forEachLevel( - this.hooks.merge, - this._caches.merge, - type, - h => h.call(finalResultItems, context) - ); - if (result === undefined) result = finalResultItems; +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); - // run result on merged items - return this._forEachLevelWaterfall( - this.hooks.result, - this._caches.result, - type, - result, - (h, r) => h.call(r, context) - ); - } else { - const object = {}; +/** @typedef {import("../MainTemplate")} MainTemplate */ - // run extract on value - this._forEachLevel(this.hooks.extract, this._caches.extract, type, h => - h.call(object, data, context) - ); +class StartupEntrypointRuntimeModule extends RuntimeModule { + constructor(asyncChunkLoading) { + super("startup entrypoint"); + this.asyncChunkLoading = asyncChunkLoading; + } - // run result on extracted object - return this._forEachLevelWaterfall( - this.hooks.result, - this._caches.result, - type, - object, - (h, r) => h.call(r, context) - ); - } + /** + * @returns {string} runtime code + */ + generate() { + const { compilation } = this; + const { runtimeTemplate } = compilation; + return `${ + RuntimeGlobals.startupEntrypoint + } = ${runtimeTemplate.basicFunction("result, chunkIds, fn", [ + "// arguments: chunkIds, moduleId are deprecated", + "var moduleId = chunkIds;", + `if(!fn) chunkIds = result, fn = ${runtimeTemplate.returningFunction( + `__webpack_require__(${RuntimeGlobals.entryModuleId} = moduleId)` + )};`, + ...(this.asyncChunkLoading + ? [ + `return Promise.all(chunkIds.map(${ + RuntimeGlobals.ensureChunk + }, __webpack_require__)).then(${runtimeTemplate.basicFunction("", [ + "var r = fn();", + "return r === undefined ? result : r;" + ])})` + ] + : [ + `chunkIds.map(${RuntimeGlobals.ensureChunk}, __webpack_require__)`, + "var r = fn();", + "return r === undefined ? result : r;" + ]) + ])}`; } } -module.exports = StatsFactory; + +module.exports = StartupEntrypointRuntimeModule; /***/ }), -/***/ 30198: +/***/ 80655: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const { HookMap, SyncWaterfallHook, SyncBailHook } = __webpack_require__(6967); - -/** @template T @typedef {import("tapable").AsArray} AsArray */ -/** @typedef {import("tapable").Hook} Hook */ -/** @typedef {import("./DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */ -/** @typedef {import("./DefaultStatsFactoryPlugin").StatsChunk} StatsChunk */ -/** @typedef {import("./DefaultStatsFactoryPlugin").StatsChunkGroup} StatsChunkGroup */ -/** @typedef {import("./DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */ -/** @typedef {import("./DefaultStatsFactoryPlugin").StatsModule} StatsModule */ -/** @typedef {import("./DefaultStatsFactoryPlugin").StatsModuleReason} StatsModuleReason */ - -/** - * @typedef {Object} PrintedElement - * @property {string} element - * @property {string} content - */ - -/** - * @typedef {Object} KnownStatsPrinterContext - * @property {string=} type - * @property {StatsCompilation=} compilation - * @property {StatsChunkGroup=} chunkGroup - * @property {StatsAsset=} asset - * @property {StatsModule=} module - * @property {StatsChunk=} chunk - * @property {StatsModuleReason=} moduleReason - * @property {(str: string) => string=} bold - * @property {(str: string) => string=} yellow - * @property {(str: string) => string=} red - * @property {(str: string) => string=} green - * @property {(str: string) => string=} magenta - * @property {(str: string) => string=} cyan - * @property {(file: string, oversize?: boolean) => string=} formatFilename - * @property {(id: string) => string=} formatModuleId - * @property {(id: string, direction?: "parent"|"child"|"sibling") => string=} formatChunkId - * @property {(size: number) => string=} formatSize - * @property {(dateTime: number) => string=} formatDateTime - * @property {(flag: string) => string=} formatFlag - * @property {(time: number, boldQuantity?: boolean) => string=} formatTime - * @property {string=} chunkGroupKind - */ +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); -/** @typedef {KnownStatsPrinterContext & Record} StatsPrinterContext */ +/** @typedef {import("../Compilation")} Compilation */ -class StatsPrinter { +class SystemContextRuntimeModule extends RuntimeModule { constructor() { - this.hooks = Object.freeze({ - /** @type {HookMap>} */ - sortElements: new HookMap( - () => new SyncBailHook(["elements", "context"]) - ), - /** @type {HookMap>} */ - printElements: new HookMap( - () => new SyncBailHook(["printedElements", "context"]) - ), - /** @type {HookMap>} */ - sortItems: new HookMap(() => new SyncBailHook(["items", "context"])), - /** @type {HookMap>} */ - getItemName: new HookMap(() => new SyncBailHook(["item", "context"])), - /** @type {HookMap>} */ - printItems: new HookMap( - () => new SyncBailHook(["printedItems", "context"]) - ), - /** @type {HookMap>} */ - print: new HookMap(() => new SyncBailHook(["object", "context"])), - /** @type {HookMap>} */ - result: new HookMap(() => new SyncWaterfallHook(["result", "context"])) - }); - /** @type {Map, Map>} */ - this._levelHookCache = new Map(); - this._inPrint = false; - } - - /** - * get all level hooks - * @private - * @template {Hook} T - * @param {HookMap} hookMap HookMap - * @param {string} type type - * @returns {T[]} hooks - */ - _getAllLevelHooks(hookMap, type) { - let cache = /** @type {Map} */ ( - this._levelHookCache.get(hookMap) - ); - if (cache === undefined) { - cache = new Map(); - this._levelHookCache.set(hookMap, cache); - } - const cacheEntry = cache.get(type); - if (cacheEntry !== undefined) { - return cacheEntry; - } - /** @type {T[]} */ - const hooks = []; - const typeParts = type.split("."); - for (let i = 0; i < typeParts.length; i++) { - const hook = hookMap.get(typeParts.slice(i).join(".")); - if (hook) { - hooks.push(hook); - } - } - cache.set(type, hooks); - return hooks; - } - - /** - * Run `fn` for each level - * @private - * @template T - * @template R - * @param {HookMap>} hookMap HookMap - * @param {string} type type - * @param {(hook: SyncBailHook) => R} fn function - * @returns {R} result of `fn` - */ - _forEachLevel(hookMap, type, fn) { - for (const hook of this._getAllLevelHooks(hookMap, type)) { - const result = fn(hook); - if (result !== undefined) return result; - } - } - - /** - * Run `fn` for each level - * @private - * @template T - * @param {HookMap>} hookMap HookMap - * @param {string} type type - * @param {AsArray[0]} data data - * @param {(hook: SyncWaterfallHook, data: AsArray[0]) => AsArray[0]} fn function - * @returns {AsArray[0]} result of `fn` - */ - _forEachLevelWaterfall(hookMap, type, data, fn) { - for (const hook of this._getAllLevelHooks(hookMap, type)) { - data = fn(hook, data); - } - return data; + super("__system_context__"); } /** - * @param {string} type The type - * @param {Object} object Object to print - * @param {Object=} baseContext The base context - * @returns {string} printed result + * @returns {string} runtime code */ - print(type, object, baseContext) { - if (this._inPrint) { - return this._print(type, object, baseContext); - } else { - try { - this._inPrint = true; - return this._print(type, object, baseContext); - } finally { - this._levelHookCache.clear(); - this._inPrint = false; - } - } + generate() { + return `${RuntimeGlobals.systemContext} = __system_context__;`; } +} + +module.exports = SystemContextRuntimeModule; + + +/***/ }), + +/***/ 64820: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const NormalModule = __webpack_require__(39); + +/** @typedef {import("../Compiler")} Compiler */ + +// data URL scheme: "data:text/javascript;charset=utf-8;base64,some-string" +// http://www.ietf.org/rfc/rfc2397.txt +const URIRegEx = /^data:([^;,]+)?((?:;[^;,]+)*?)(?:;(base64))?,(.*)$/i; + +const decodeDataURI = uri => { + const match = URIRegEx.exec(uri); + if (!match) return null; + const isBase64 = match[3]; + const body = match[4]; + return isBase64 + ? Buffer.from(body, "base64") + : Buffer.from(decodeURIComponent(body), "ascii"); +}; + +class DataUriPlugin { /** - * @private - * @param {string} type type - * @param {Object} object object - * @param {Object=} baseContext context - * @returns {string} printed result + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - _print(type, object, baseContext) { - const context = { - ...baseContext, - type, - [type]: object - }; - - let printResult = this._forEachLevel(this.hooks.print, type, hook => - hook.call(object, context) - ); - if (printResult === undefined) { - if (Array.isArray(object)) { - const sortedItems = object.slice(); - this._forEachLevel(this.hooks.sortItems, type, h => - h.call(sortedItems, context) - ); - const printedItems = sortedItems.map((item, i) => { - const itemContext = { - ...context, - _index: i - }; - const itemName = this._forEachLevel( - this.hooks.getItemName, - `${type}[]`, - h => h.call(item, itemContext) - ); - if (itemName) itemContext[itemName] = item; - return this.print( - itemName ? `${type}[].${itemName}` : `${type}[]`, - item, - itemContext - ); - }); - printResult = this._forEachLevel(this.hooks.printItems, type, h => - h.call(printedItems, context) - ); - if (printResult === undefined) { - const result = printedItems.filter(Boolean); - if (result.length > 0) printResult = result.join("\n"); - } - } else if (object !== null && typeof object === "object") { - const elements = Object.keys(object).filter( - key => object[key] !== undefined - ); - this._forEachLevel(this.hooks.sortElements, type, h => - h.call(elements, context) - ); - const printedElements = elements.map(element => { - const content = this.print(`${type}.${element}`, object[element], { - ...context, - _parent: object, - _element: element, - [element]: object[element] + apply(compiler) { + compiler.hooks.compilation.tap( + "DataUriPlugin", + (compilation, { normalModuleFactory }) => { + normalModuleFactory.hooks.resolveForScheme + .for("data") + .tap("DataUriPlugin", resourceData => { + const match = URIRegEx.exec(resourceData.resource); + if (match) { + resourceData.data.mimetype = match[1] || ""; + resourceData.data.parameters = match[2] || ""; + resourceData.data.encoding = match[3] || false; + resourceData.data.encodedContent = match[4] || ""; + } }); - return { element, content }; - }); - printResult = this._forEachLevel(this.hooks.printElements, type, h => - h.call(printedElements, context) - ); - if (printResult === undefined) { - const result = printedElements.map(e => e.content).filter(Boolean); - if (result.length > 0) printResult = result.join("\n"); - } + NormalModule.getCompilationHooks(compilation) + .readResourceForScheme.for("data") + .tap("DataUriPlugin", resource => decodeDataURI(resource)); } - } - - return this._forEachLevelWaterfall( - this.hooks.result, - type, - printResult, - (h, r) => h.call(r, context) ); } } -module.exports = StatsPrinter; + +module.exports = DataUriPlugin; /***/ }), -/***/ 84953: -/***/ (function(__unused_webpack_module, exports) { +/***/ 57637: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -121276,49 +117703,54 @@ module.exports = StatsPrinter; -/** - * Compare two arrays or strings by performing strict equality check for each value. - * @template T [T=any] - * @param {ArrayLike} a Array of values to be compared - * @param {ArrayLike} b Array of values to be compared - * @returns {boolean} returns true if all the elements of passed arrays are strictly equal. - */ +const { URL, fileURLToPath } = __webpack_require__(57310); +const { NormalModule } = __webpack_require__(91919); -exports.equals = (a, b) => { - if (a.length !== b.length) return false; - for (let i = 0; i < a.length; i++) { - if (a[i] !== b[i]) return false; +/** @typedef {import("../Compiler")} Compiler */ + +class FileUriPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "FileUriPlugin", + (compilation, { normalModuleFactory }) => { + normalModuleFactory.hooks.resolveForScheme + .for("file") + .tap("FileUriPlugin", resourceData => { + const url = new URL(resourceData.resource); + const path = fileURLToPath(url); + const query = url.search; + const fragment = url.hash; + resourceData.path = path; + resourceData.query = query; + resourceData.fragment = fragment; + resourceData.resource = path + query + fragment; + return true; + }); + const hooks = NormalModule.getCompilationHooks(compilation); + hooks.readResource + .for(undefined) + .tapAsync("FileUriPlugin", (loaderContext, callback) => { + const { resourcePath } = loaderContext; + loaderContext.addDependency(resourcePath); + loaderContext.fs.readFile(resourcePath, callback); + }); + } + ); } - return true; -}; +} -/** - * Partition an array by calling a predicate function on each value. - * @template T [T=any] - * @param {Array} arr Array of values to be partitioned - * @param {(value: T) => boolean} fn Partition function which partitions based on truthiness of result. - * @returns {[Array, Array]} returns the values of `arr` partitioned into two new arrays based on fn predicate. - */ -exports.groupBy = (arr = [], fn) => { - return arr.reduce( - /** - * @param {[Array, Array]} groups An accumulator storing already partitioned values returned from previous call. - * @param {T} value The value of the current element - * @returns {[Array, Array]} returns an array of partitioned groups accumulator resulting from calling a predicate on the current value. - */ - (groups, value) => { - groups[fn(value) ? 0 : 1].push(value); - return groups; - }, - [[], []] - ); -}; +module.exports = FileUriPlugin; /***/ }), -/***/ 41792: -/***/ (function(module) { +/***/ 42110: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -121328,3473 +117760,4064 @@ exports.groupBy = (arr = [], fn) => { +const { extname, basename } = __webpack_require__(71017); +const { URL } = __webpack_require__(57310); +const { createGunzip, createBrotliDecompress, createInflate } = __webpack_require__(59796); +const NormalModule = __webpack_require__(39); +const createSchemaValidation = __webpack_require__(32540); +const createHash = __webpack_require__(49835); +const { mkdirp, dirname, join } = __webpack_require__(17139); +const memoize = __webpack_require__(78676); + +/** @typedef {import("../../declarations/plugins/schemes/HttpUriPlugin").HttpUriPluginOptions} HttpUriPluginOptions */ +/** @typedef {import("../Compiler")} Compiler */ + +const getHttp = memoize(() => __webpack_require__(13685)); +const getHttps = memoize(() => __webpack_require__(95687)); + +/** @type {(() => void)[] | undefined} */ +let inProgressWrite = undefined; + +const validate = createSchemaValidation( + __webpack_require__(67263), + () => __webpack_require__(27256), + { + name: "Http Uri Plugin", + baseDataPath: "options" + } +); + +const toSafePath = str => + str + .replace(/^[^a-zA-Z0-9]+|[^a-zA-Z0-9]+$/g, "") + .replace(/[^a-zA-Z0-9._-]+/g, "_"); + +const computeIntegrity = content => { + const hash = createHash("sha512"); + hash.update(content); + const integrity = "sha512-" + hash.digest("base64"); + return integrity; +}; + +const verifyIntegrity = (content, integrity) => { + if (integrity === "ignore") return true; + return computeIntegrity(content) === integrity; +}; + /** - * @template T + * @param {string} str input + * @returns {Record} parsed */ -class ArrayQueue { - /** - * @param {Iterable=} items The initial elements. - */ - constructor(items) { - /** @private @type {T[]} */ - this._list = items ? Array.from(items) : []; - /** @private @type {T[]} */ - this._listReversed = []; +const parseKeyValuePairs = str => { + /** @type {Record} */ + const result = {}; + for (const item of str.split(",")) { + const i = item.indexOf("="); + if (i >= 0) { + const key = item.slice(0, i).trim(); + const value = item.slice(i + 1).trim(); + result[key] = value; + } else { + const key = item.trim(); + if (!key) continue; + result[key] = key; + } } + return result; +}; - /** - * Returns the number of elements in this queue. - * @returns {number} The number of elements in this queue. - */ - get length() { - return this._list.length + this._listReversed.length; +const parseCacheControl = (cacheControl, requestTime) => { + // When false resource is not stored in cache + let storeCache = true; + // When false resource is not stored in lockfile cache + let storeLock = true; + // Resource is only revalidated, after that timestamp and when upgrade is chosen + let validUntil = 0; + if (cacheControl) { + const parsed = parseKeyValuePairs(cacheControl); + if (parsed["no-cache"]) storeCache = storeLock = false; + if (parsed["max-age"] && !isNaN(+parsed["max-age"])) { + validUntil = requestTime + +parsed["max-age"] * 1000; + } + if (parsed["must-revalidate"]) validUntil = 0; } + return { + storeLock, + storeCache, + validUntil + }; +}; - /** - * Empties the queue. - */ - clear() { - this._list.length = 0; - this._listReversed.length = 0; +/** + * @typedef {Object} LockfileEntry + * @property {string} resolved + * @property {string} integrity + * @property {string} contentType + */ + +const areLockfileEntriesEqual = (a, b) => { + return ( + a.resolved === b.resolved && + a.integrity === b.integrity && + a.contentType === b.contentType + ); +}; + +const entryToString = entry => { + return `resolved: ${entry.resolved}, integrity: ${entry.integrity}, contentType: ${entry.contentType}`; +}; + +class Lockfile { + constructor() { + this.version = 1; + /** @type {Map} */ + this.entries = new Map(); } - /** - * Appends the specified element to this queue. - * @param {T} item The element to add. - * @returns {void} - */ - enqueue(item) { - this._list.push(item); + static parse(content) { + // TODO handle merge conflicts + const data = JSON.parse(content); + if (data.version !== 1) + throw new Error(`Unsupported lockfile version ${data.version}`); + const lockfile = new Lockfile(); + for (const key of Object.keys(data)) { + if (key === "version") continue; + const entry = data[key]; + lockfile.entries.set( + key, + typeof entry === "string" + ? entry + : { + resolved: key, + ...entry + } + ); + } + return lockfile; + } + + toString() { + let str = "{\n"; + const entries = Array.from(this.entries).sort(([a], [b]) => + a < b ? -1 : 1 + ); + for (const [key, entry] of entries) { + if (typeof entry === "string") { + str += ` ${JSON.stringify(key)}: ${JSON.stringify(entry)},\n`; + } else { + str += ` ${JSON.stringify(key)}: { `; + if (entry.resolved !== key) + str += `"resolved": ${JSON.stringify(entry.resolved)}, `; + str += `"integrity": ${JSON.stringify( + entry.integrity + )}, "contentType": ${JSON.stringify(entry.contentType)} },\n`; + } + } + str += ` "version": ${this.version}\n}\n`; + return str; } +} + +/** + * @template R + * @param {function(function(Error=, R=): void): void} fn function + * @returns {function(function((Error | null)=, R=): void): void} cached function + */ +const cachedWithoutKey = fn => { + let inFlight = false; + /** @type {Error | undefined} */ + let cachedError = undefined; + /** @type {R | undefined} */ + let cachedResult = undefined; + /** @type {(function(Error=, R=): void)[] | undefined} */ + let cachedCallbacks = undefined; + return callback => { + if (inFlight) { + if (cachedResult !== undefined) return callback(null, cachedResult); + if (cachedError !== undefined) return callback(cachedError); + if (cachedCallbacks === undefined) cachedCallbacks = [callback]; + else cachedCallbacks.push(callback); + return; + } + inFlight = true; + fn((err, result) => { + if (err) cachedError = err; + else cachedResult = result; + const callbacks = cachedCallbacks; + cachedCallbacks = undefined; + callback(err, result); + if (callbacks !== undefined) for (const cb of callbacks) cb(err, result); + }); + }; +}; + +/** + * @template T + * @template R + * @param {function(T, function(Error=, R=): void): void} fn function + * @param {function(T, function(Error=, R=): void): void=} forceFn function for the second try + * @returns {(function(T, function((Error | null)=, R=): void): void) & { force: function(T, function((Error | null)=, R=): void): void }} cached function + */ +const cachedWithKey = (fn, forceFn = fn) => { + /** @typedef {{ result?: R, error?: Error, callbacks?: (function((Error | null)=, R=): void)[], force?: true }} CacheEntry */ + /** @type {Map} */ + const cache = new Map(); + const resultFn = (arg, callback) => { + const cacheEntry = cache.get(arg); + if (cacheEntry !== undefined) { + if (cacheEntry.result !== undefined) + return callback(null, cacheEntry.result); + if (cacheEntry.error !== undefined) return callback(cacheEntry.error); + if (cacheEntry.callbacks === undefined) cacheEntry.callbacks = [callback]; + else cacheEntry.callbacks.push(callback); + return; + } + /** @type {CacheEntry} */ + const newCacheEntry = { + result: undefined, + error: undefined, + callbacks: undefined + }; + cache.set(arg, newCacheEntry); + fn(arg, (err, result) => { + if (err) newCacheEntry.error = err; + else newCacheEntry.result = result; + const callbacks = newCacheEntry.callbacks; + newCacheEntry.callbacks = undefined; + callback(err, result); + if (callbacks !== undefined) for (const cb of callbacks) cb(err, result); + }); + }; + resultFn.force = (arg, callback) => { + const cacheEntry = cache.get(arg); + if (cacheEntry !== undefined && cacheEntry.force) { + if (cacheEntry.result !== undefined) + return callback(null, cacheEntry.result); + if (cacheEntry.error !== undefined) return callback(cacheEntry.error); + if (cacheEntry.callbacks === undefined) cacheEntry.callbacks = [callback]; + else cacheEntry.callbacks.push(callback); + return; + } + /** @type {CacheEntry} */ + const newCacheEntry = { + result: undefined, + error: undefined, + callbacks: undefined, + force: true + }; + cache.set(arg, newCacheEntry); + forceFn(arg, (err, result) => { + if (err) newCacheEntry.error = err; + else newCacheEntry.result = result; + const callbacks = newCacheEntry.callbacks; + newCacheEntry.callbacks = undefined; + callback(err, result); + if (callbacks !== undefined) for (const cb of callbacks) cb(err, result); + }); + }; + return resultFn; +}; +class HttpUriPlugin { /** - * Retrieves and removes the head of this queue. - * @returns {T | undefined} The head of the queue of `undefined` if this queue is empty. + * @param {HttpUriPluginOptions} options options */ - dequeue() { - if (this._listReversed.length === 0) { - if (this._list.length === 0) return undefined; - if (this._list.length === 1) return this._list.pop(); - if (this._list.length < 16) return this._list.shift(); - const temp = this._listReversed; - this._listReversed = this._list; - this._listReversed.reverse(); - this._list = temp; - } - return this._listReversed.pop(); + constructor(options) { + validate(options); + this._lockfileLocation = options.lockfileLocation; + this._cacheLocation = options.cacheLocation; + this._upgrade = options.upgrade; + this._frozen = options.frozen; + this._allowedUris = options.allowedUris; } /** - * Finds and removes an item - * @param {T} item the item + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - delete(item) { - const i = this._list.indexOf(item); - if (i >= 0) { - this._list.splice(i, 1); - } else { - const i = this._listReversed.indexOf(item); - if (i >= 0) this._listReversed.splice(i, 1); - } - } - - [Symbol.iterator]() { - let i = -1; - let reversed = false; - return { - next: () => { - if (!reversed) { - i++; - if (i < this._list.length) { - return { - done: false, - value: this._list[i] - }; - } - reversed = true; - i = this._listReversed.length; - } - i--; - if (i < 0) { - return { - done: true, - value: undefined - }; - } - return { - done: false, - value: this._listReversed[i] - }; + apply(compiler) { + const schemes = [ + { + scheme: "http", + fetch: (url, options, callback) => getHttp().get(url, options, callback) + }, + { + scheme: "https", + fetch: (url, options, callback) => + getHttps().get(url, options, callback) } - }; - } -} - -module.exports = ArrayQueue; - - -/***/ }), - -/***/ 12260: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + ]; + let lockfileCache; + compiler.hooks.compilation.tap( + "HttpUriPlugin", + (compilation, { normalModuleFactory }) => { + const intermediateFs = compiler.intermediateFileSystem; + const fs = compilation.inputFileSystem; + const cache = compilation.getCache("webpack.HttpUriPlugin"); + const logger = compilation.getLogger("webpack.HttpUriPlugin"); + const lockfileLocation = + this._lockfileLocation || + join( + intermediateFs, + compiler.context, + compiler.name + ? `${toSafePath(compiler.name)}.webpack.lock` + : "webpack.lock" + ); + const cacheLocation = + this._cacheLocation !== undefined + ? this._cacheLocation + : lockfileLocation + ".data"; + const upgrade = this._upgrade || false; + const frozen = this._frozen || false; + const hashFunction = "sha512"; + const hashDigest = "hex"; + const hashDigestLength = 20; + const allowedUris = this._allowedUris; + let warnedAboutEol = false; + const cacheKeyCache = new Map(); + /** + * @param {string} url the url + * @returns {string} the key + */ + const getCacheKey = url => { + const cachedResult = cacheKeyCache.get(url); + if (cachedResult !== undefined) return cachedResult; + const result = _getCacheKey(url); + cacheKeyCache.set(url, result); + return result; + }; -const { SyncHook, AsyncSeriesHook } = __webpack_require__(6967); -const { makeWebpackError } = __webpack_require__(11351); -const WebpackError = __webpack_require__(53799); -const ArrayQueue = __webpack_require__(41792); + /** + * @param {string} url the url + * @returns {string} the key + */ + const _getCacheKey = url => { + const parsedUrl = new URL(url); + const folder = toSafePath(parsedUrl.origin); + const name = toSafePath(parsedUrl.pathname); + const query = toSafePath(parsedUrl.search); + let ext = extname(name); + if (ext.length > 20) ext = ""; + const basename = ext ? name.slice(0, -ext.length) : name; + const hash = createHash(hashFunction); + hash.update(url); + const digest = hash.digest(hashDigest).slice(0, hashDigestLength); + return `${folder.slice(-50)}/${`${basename}${ + query ? `_${query}` : "" + }`.slice(0, 150)}_${digest}${ext}`; + }; -const QUEUED_STATE = 0; -const PROCESSING_STATE = 1; -const DONE_STATE = 2; + const getLockfile = cachedWithoutKey( + /** + * @param {function((Error | null)=, Lockfile=): void} callback callback + * @returns {void} + */ + callback => { + const readLockfile = () => { + intermediateFs.readFile(lockfileLocation, (err, buffer) => { + if (err && err.code !== "ENOENT") { + compilation.missingDependencies.add(lockfileLocation); + return callback(err); + } + compilation.fileDependencies.add(lockfileLocation); + compilation.fileSystemInfo.createSnapshot( + compiler.fsStartTime, + buffer ? [lockfileLocation] : [], + [], + buffer ? [] : [lockfileLocation], + { timestamp: true }, + (err, snapshot) => { + if (err) return callback(err); + const lockfile = buffer + ? Lockfile.parse(buffer.toString("utf-8")) + : new Lockfile(); + lockfileCache = { + lockfile, + snapshot + }; + callback(null, lockfile); + } + ); + }); + }; + if (lockfileCache) { + compilation.fileSystemInfo.checkSnapshotValid( + lockfileCache.snapshot, + (err, valid) => { + if (err) return callback(err); + if (!valid) return readLockfile(); + callback(null, lockfileCache.lockfile); + } + ); + } else { + readLockfile(); + } + } + ); -let inHandleResult = 0; + /** @type {Map | undefined} */ + let lockfileUpdates = undefined; + const storeLockEntry = (lockfile, url, entry) => { + const oldEntry = lockfile.entries.get(url); + if (lockfileUpdates === undefined) lockfileUpdates = new Map(); + lockfileUpdates.set(url, entry); + lockfile.entries.set(url, entry); + if (!oldEntry) { + logger.log(`${url} added to lockfile`); + } else if (typeof oldEntry === "string") { + if (typeof entry === "string") { + logger.log(`${url} updated in lockfile: ${oldEntry} -> ${entry}`); + } else { + logger.log( + `${url} updated in lockfile: ${oldEntry} -> ${entry.resolved}` + ); + } + } else if (typeof entry === "string") { + logger.log( + `${url} updated in lockfile: ${oldEntry.resolved} -> ${entry}` + ); + } else if (oldEntry.resolved !== entry.resolved) { + logger.log( + `${url} updated in lockfile: ${oldEntry.resolved} -> ${entry.resolved}` + ); + } else if (oldEntry.integrity !== entry.integrity) { + logger.log(`${url} updated in lockfile: content changed`); + } else if (oldEntry.contentType !== entry.contentType) { + logger.log( + `${url} updated in lockfile: ${oldEntry.contentType} -> ${entry.contentType}` + ); + } else { + logger.log(`${url} updated in lockfile`); + } + }; -/** - * @template T - * @callback Callback - * @param {(WebpackError | null)=} err - * @param {T=} result - */ + const storeResult = (lockfile, url, result, callback) => { + if (result.storeLock) { + storeLockEntry(lockfile, url, result.entry); + if (!cacheLocation || !result.content) + return callback(null, result); + const key = getCacheKey(result.entry.resolved); + const filePath = join(intermediateFs, cacheLocation, key); + mkdirp(intermediateFs, dirname(intermediateFs, filePath), err => { + if (err) return callback(err); + intermediateFs.writeFile(filePath, result.content, err => { + if (err) return callback(err); + callback(null, result); + }); + }); + } else { + storeLockEntry(lockfile, url, "no-cache"); + callback(null, result); + } + }; -/** - * @template T - * @template K - * @template R - */ -class AsyncQueueEntry { - /** - * @param {T} item the item - * @param {Callback} callback the callback - */ - constructor(item, callback) { - this.item = item; - /** @type {typeof QUEUED_STATE | typeof PROCESSING_STATE | typeof DONE_STATE} */ - this.state = QUEUED_STATE; - this.callback = callback; - /** @type {Callback[] | undefined} */ - this.callbacks = undefined; - this.result = undefined; - /** @type {WebpackError | undefined} */ - this.error = undefined; - } -} + for (const { scheme, fetch } of schemes) { + /** + * + * @param {string} url URL + * @param {string} integrity integrity + * @param {function((Error | null)=, { entry: LockfileEntry, content: Buffer, storeLock: boolean }=): void} callback callback + */ + const resolveContent = (url, integrity, callback) => { + const handleResult = (err, result) => { + if (err) return callback(err); + if ("location" in result) { + return resolveContent( + result.location, + integrity, + (err, innerResult) => { + if (err) return callback(err); + callback(null, { + entry: innerResult.entry, + content: innerResult.content, + storeLock: innerResult.storeLock && result.storeLock + }); + } + ); + } else { + if ( + !result.fresh && + integrity && + result.entry.integrity !== integrity && + !verifyIntegrity(result.content, integrity) + ) { + return fetchContent.force(url, handleResult); + } + return callback(null, { + entry: result.entry, + content: result.content, + storeLock: result.storeLock + }); + } + }; + fetchContent(url, handleResult); + }; -/** - * @template T - * @template K - * @template R - */ -class AsyncQueue { - /** - * @param {Object} options options object - * @param {string=} options.name name of the queue - * @param {number=} options.parallelism how many items should be processed at once - * @param {AsyncQueue=} options.parent parent queue, which will have priority over this queue and with shared parallelism - * @param {function(T): K=} options.getKey extract key from item - * @param {function(T, Callback): void} options.processor async function to process items - */ - constructor({ name, parallelism, parent, processor, getKey }) { - this._name = name; - this._parallelism = parallelism || 1; - this._processor = processor; - this._getKey = - getKey || /** @type {(T) => K} */ (item => /** @type {any} */ (item)); - /** @type {Map>} */ - this._entries = new Map(); - /** @type {ArrayQueue>} */ - this._queued = new ArrayQueue(); - /** @type {AsyncQueue[]} */ - this._children = undefined; - this._activeTasks = 0; - this._willEnsureProcessing = false; - this._needProcessing = false; - this._stopped = false; - this._root = parent ? parent._root : this; - if (parent) { - if (this._root._children === undefined) { - this._root._children = [this]; - } else { - this._root._children.push(this); - } - } + /** @typedef {{ storeCache: boolean, storeLock: boolean, validUntil: number, etag: string | undefined, fresh: boolean }} FetchResultMeta */ + /** @typedef {FetchResultMeta & { location: string }} RedirectFetchResult */ + /** @typedef {FetchResultMeta & { entry: LockfileEntry, content: Buffer }} ContentFetchResult */ + /** @typedef {RedirectFetchResult | ContentFetchResult} FetchResult */ - this.hooks = { - /** @type {AsyncSeriesHook<[T]>} */ - beforeAdd: new AsyncSeriesHook(["item"]), - /** @type {SyncHook<[T]>} */ - added: new SyncHook(["item"]), - /** @type {AsyncSeriesHook<[T]>} */ - beforeStart: new AsyncSeriesHook(["item"]), - /** @type {SyncHook<[T]>} */ - started: new SyncHook(["item"]), - /** @type {SyncHook<[T, Error, R]>} */ - result: new SyncHook(["item", "error", "result"]) - }; + /** + * @param {string} url URL + * @param {FetchResult | RedirectFetchResult} cachedResult result from cache + * @param {function((Error | null)=, FetchResult=): void} callback callback + * @returns {void} + */ + const fetchContentRaw = (url, cachedResult, callback) => { + const requestTime = Date.now(); + fetch( + new URL(url), + { + headers: { + "accept-encoding": "gzip, deflate, br", + "user-agent": "webpack", + "if-none-match": cachedResult + ? cachedResult.etag || null + : null + } + }, + res => { + const etag = res.headers["etag"]; + const location = res.headers["location"]; + const cacheControl = res.headers["cache-control"]; + const { storeLock, storeCache, validUntil } = parseCacheControl( + cacheControl, + requestTime + ); + /** + * @param {Partial> & (Pick | Pick)} partialResult result + * @returns {void} + */ + const finishWith = partialResult => { + if ("location" in partialResult) { + logger.debug( + `GET ${url} [${res.statusCode}] -> ${partialResult.location}` + ); + } else { + logger.debug( + `GET ${url} [${res.statusCode}] ${Math.ceil( + partialResult.content.length / 1024 + )} kB${!storeLock ? " no-cache" : ""}` + ); + } + const result = { + ...partialResult, + fresh: true, + storeLock, + storeCache, + validUntil, + etag + }; + if (!storeCache) { + logger.log( + `${url} can't be stored in cache, due to Cache-Control header: ${cacheControl}` + ); + return callback(null, result); + } + cache.store( + url, + null, + { + ...result, + fresh: false + }, + err => { + if (err) { + logger.warn( + `${url} can't be stored in cache: ${err.message}` + ); + logger.debug(err.stack); + } + callback(null, result); + } + ); + }; + if (res.statusCode === 304) { + if ( + cachedResult.validUntil < validUntil || + cachedResult.storeLock !== storeLock || + cachedResult.storeCache !== storeCache || + cachedResult.etag !== etag + ) { + return finishWith(cachedResult); + } else { + logger.debug(`GET ${url} [${res.statusCode}] (unchanged)`); + return callback(null, { + ...cachedResult, + fresh: true + }); + } + } + if ( + location && + res.statusCode >= 301 && + res.statusCode <= 308 + ) { + const result = { + location: new URL(location, url).href + }; + if ( + !cachedResult || + !("location" in cachedResult) || + cachedResult.location !== result.location || + cachedResult.validUntil < validUntil || + cachedResult.storeLock !== storeLock || + cachedResult.storeCache !== storeCache || + cachedResult.etag !== etag + ) { + return finishWith(result); + } else { + logger.debug(`GET ${url} [${res.statusCode}] (unchanged)`); + return callback(null, { + ...result, + fresh: true, + storeLock, + storeCache, + validUntil, + etag + }); + } + } + const contentType = res.headers["content-type"] || ""; + const bufferArr = []; - this._ensureProcessing = this._ensureProcessing.bind(this); - } + const contentEncoding = res.headers["content-encoding"]; + let stream = res; + if (contentEncoding === "gzip") { + stream = stream.pipe(createGunzip()); + } else if (contentEncoding === "br") { + stream = stream.pipe(createBrotliDecompress()); + } else if (contentEncoding === "deflate") { + stream = stream.pipe(createInflate()); + } - /** - * @param {T} item an item - * @param {Callback} callback callback function - * @returns {void} - */ - add(item, callback) { - if (this._stopped) return callback(new WebpackError("Queue was stopped")); - this.hooks.beforeAdd.callAsync(item, err => { - if (err) { - callback( - makeWebpackError(err, `AsyncQueue(${this._name}).hooks.beforeAdd`) - ); - return; - } - const key = this._getKey(item); - const entry = this._entries.get(key); - if (entry !== undefined) { - if (entry.state === DONE_STATE) { - if (inHandleResult++ > 3) { - process.nextTick(() => callback(entry.error, entry.result)); - } else { - callback(entry.error, entry.result); - } - inHandleResult--; - } else if (entry.callbacks === undefined) { - entry.callbacks = [callback]; - } else { - entry.callbacks.push(callback); - } - return; - } - const newEntry = new AsyncQueueEntry(item, callback); - if (this._stopped) { - this.hooks.added.call(item); - this._root._activeTasks++; - process.nextTick(() => - this._handleResult(newEntry, new WebpackError("Queue was stopped")) - ); - } else { - this._entries.set(key, newEntry); - this._queued.enqueue(newEntry); - const root = this._root; - root._needProcessing = true; - if (root._willEnsureProcessing === false) { - root._willEnsureProcessing = true; - setImmediate(root._ensureProcessing); - } - this.hooks.added.call(item); - } - }); - } + stream.on("data", chunk => { + bufferArr.push(chunk); + }); - /** - * @param {T} item an item - * @returns {void} - */ - invalidate(item) { - const key = this._getKey(item); - const entry = this._entries.get(key); - this._entries.delete(key); - if (entry.state === QUEUED_STATE) { - this._queued.delete(entry); - } - } + stream.on("end", () => { + if (!res.complete) { + logger.log(`GET ${url} [${res.statusCode}] (terminated)`); + return callback(new Error(`${url} request was terminated`)); + } - /** - * Waits for an already started item - * @param {T} item an item - * @param {Callback} callback callback function - * @returns {void} - */ - waitFor(item, callback) { - const key = this._getKey(item); - const entry = this._entries.get(key); - if (entry === undefined) { - return callback( - new WebpackError( - "waitFor can only be called for an already started item" - ) - ); - } - if (entry.state === DONE_STATE) { - process.nextTick(() => callback(entry.error, entry.result)); - } else if (entry.callbacks === undefined) { - entry.callbacks = [callback]; - } else { - entry.callbacks.push(callback); - } - } + const content = Buffer.concat(bufferArr); - /** - * @returns {void} - */ - stop() { - this._stopped = true; - const queue = this._queued; - this._queued = new ArrayQueue(); - const root = this._root; - for (const entry of queue) { - this._entries.delete(this._getKey(entry.item)); - root._activeTasks++; - this._handleResult(entry, new WebpackError("Queue was stopped")); - } - } + if (res.statusCode !== 200) { + logger.log(`GET ${url} [${res.statusCode}]`); + return callback( + new Error( + `${url} request status code = ${ + res.statusCode + }\n${content.toString("utf-8")}` + ) + ); + } - /** - * @returns {void} - */ - increaseParallelism() { - const root = this._root; - root._parallelism++; - /* istanbul ignore next */ - if (root._willEnsureProcessing === false && root._needProcessing) { - root._willEnsureProcessing = true; - setImmediate(root._ensureProcessing); - } - } + const integrity = computeIntegrity(content); + const entry = { resolved: url, integrity, contentType }; - /** - * @returns {void} - */ - decreaseParallelism() { - const root = this._root; - root._parallelism--; - } + finishWith({ + entry, + content + }); + }); + } + ).on("error", err => { + logger.log(`GET ${url} (error)`); + err.message += `\nwhile fetching ${url}`; + callback(err); + }); + }; - /** - * @param {T} item an item - * @returns {boolean} true, if the item is currently being processed - */ - isProcessing(item) { - const key = this._getKey(item); - const entry = this._entries.get(key); - return entry !== undefined && entry.state === PROCESSING_STATE; - } + const fetchContent = cachedWithKey( + /** + * @param {string} url URL + * @param {function((Error | null)=, { validUntil: number, etag?: string, entry: LockfileEntry, content: Buffer, fresh: boolean } | { validUntil: number, etag?: string, location: string, fresh: boolean }=): void} callback callback + * @returns {void} + */ (url, callback) => { + cache.get(url, null, (err, cachedResult) => { + if (err) return callback(err); + if (cachedResult) { + const isValid = cachedResult.validUntil >= Date.now(); + if (isValid) return callback(null, cachedResult); + } + fetchContentRaw(url, cachedResult, callback); + }); + }, + (url, callback) => fetchContentRaw(url, undefined, callback) + ); - /** - * @param {T} item an item - * @returns {boolean} true, if the item is currently queued - */ - isQueued(item) { - const key = this._getKey(item); - const entry = this._entries.get(key); - return entry !== undefined && entry.state === QUEUED_STATE; - } + const isAllowed = uri => { + for (const allowed of allowedUris) { + if (typeof allowed === "string") { + if (uri.startsWith(allowed)) return true; + } else if (typeof allowed === "function") { + if (allowed(uri)) return true; + } else { + if (allowed.test(uri)) return true; + } + } + return false; + }; - /** - * @param {T} item an item - * @returns {boolean} true, if the item is currently queued - */ - isDone(item) { - const key = this._getKey(item); - const entry = this._entries.get(key); - return entry !== undefined && entry.state === DONE_STATE; - } + const getInfo = cachedWithKey( + /** + * @param {string} url the url + * @param {function((Error | null)=, { entry: LockfileEntry, content: Buffer }=): void} callback callback + * @returns {void} + */ + (url, callback) => { + if (!isAllowed(url)) { + return callback( + new Error( + `${url} doesn't match the allowedUris policy. These URIs are allowed:\n${allowedUris + .map(uri => ` - ${uri}`) + .join("\n")}` + ) + ); + } + getLockfile((err, lockfile) => { + if (err) return callback(err); + const entryOrString = lockfile.entries.get(url); + if (!entryOrString) { + if (frozen) { + return callback( + new Error( + `${url} has no lockfile entry and lockfile is frozen` + ) + ); + } + resolveContent(url, null, (err, result) => { + if (err) return callback(err); + storeResult(lockfile, url, result, callback); + }); + return; + } + if (typeof entryOrString === "string") { + const entryTag = entryOrString; + resolveContent(url, null, (err, result) => { + if (err) return callback(err); + if (!result.storeLock || entryTag === "ignore") + return callback(null, result); + if (frozen) { + return callback( + new Error( + `${url} used to have ${entryTag} lockfile entry and has content now, but lockfile is frozen` + ) + ); + } + if (!upgrade) { + return callback( + new Error( + `${url} used to have ${entryTag} lockfile entry and has content now. +This should be reflected in the lockfile, so this lockfile entry must be upgraded, but upgrading is not enabled. +Remove this line from the lockfile to force upgrading.` + ) + ); + } + storeResult(lockfile, url, result, callback); + }); + return; + } + let entry = entryOrString; + const doFetch = lockedContent => { + resolveContent(url, entry.integrity, (err, result) => { + if (err) { + if (lockedContent) { + logger.warn( + `Upgrade request to ${url} failed: ${err.message}` + ); + logger.debug(err.stack); + return callback(null, { + entry, + content: lockedContent + }); + } + return callback(err); + } + if (!result.storeLock) { + // When the lockfile entry should be no-cache + // we need to update the lockfile + if (frozen) { + return callback( + new Error( + `${url} has a lockfile entry and is no-cache now, but lockfile is frozen\nLockfile: ${entryToString( + entry + )}` + ) + ); + } + storeResult(lockfile, url, result, callback); + return; + } + if (!areLockfileEntriesEqual(result.entry, entry)) { + // When the lockfile entry is outdated + // we need to update the lockfile + if (frozen) { + return callback( + new Error( + `${url} has an outdated lockfile entry, but lockfile is frozen\nLockfile: ${entryToString( + entry + )}\nExpected: ${entryToString(result.entry)}` + ) + ); + } + storeResult(lockfile, url, result, callback); + return; + } + if (!lockedContent && cacheLocation) { + // When the lockfile cache content is missing + // we need to update the lockfile + if (frozen) { + return callback( + new Error( + `${url} is missing content in the lockfile cache, but lockfile is frozen\nLockfile: ${entryToString( + entry + )}` + ) + ); + } + storeResult(lockfile, url, result, callback); + return; + } + return callback(null, result); + }); + }; + if (cacheLocation) { + // When there is a lockfile cache + // we read the content from there + const key = getCacheKey(entry.resolved); + const filePath = join(intermediateFs, cacheLocation, key); + fs.readFile(filePath, (err, result) => { + const content = /** @type {Buffer} */ (result); + if (err) { + if (err.code === "ENOENT") return doFetch(); + return callback(err); + } + const continueWithCachedContent = result => { + if (!upgrade) { + // When not in upgrade mode, we accept the result from the lockfile cache + return callback(null, { entry, content }); + } + return doFetch(content); + }; + if (!verifyIntegrity(content, entry.integrity)) { + let contentWithChangedEol; + let isEolChanged = false; + try { + contentWithChangedEol = Buffer.from( + content.toString("utf-8").replace(/\r\n/g, "\n") + ); + isEolChanged = verifyIntegrity( + contentWithChangedEol, + entry.integrity + ); + } catch (e) { + // ignore + } + if (isEolChanged) { + if (!warnedAboutEol) { + const explainer = `Incorrect end of line sequence was detected in the lockfile cache. +The lockfile cache is protected by integrity checks, so any external modification will lead to a corrupted lockfile cache. +When using git make sure to configure .gitattributes correctly for the lockfile cache: + **/*webpack.lock.data/** -text +This will avoid that the end of line sequence is changed by git on Windows.`; + if (frozen) { + logger.error(explainer); + } else { + logger.warn(explainer); + logger.info( + "Lockfile cache will be automatically fixed now, but when lockfile is frozen this would result in an error." + ); + } + warnedAboutEol = true; + } + if (!frozen) { + // "fix" the end of line sequence of the lockfile content + logger.log( + `${filePath} fixed end of line sequence (\\r\\n instead of \\n).` + ); + intermediateFs.writeFile( + filePath, + contentWithChangedEol, + err => { + if (err) return callback(err); + continueWithCachedContent(contentWithChangedEol); + } + ); + return; + } + } + if (frozen) { + return callback( + new Error( + `${ + entry.resolved + } integrity mismatch, expected content with integrity ${ + entry.integrity + } but got ${computeIntegrity(content)}. +Lockfile corrupted (${ + isEolChanged + ? "end of line sequence was unexpectedly changed" + : "incorrectly merged? changed by other tools?" + }). +Run build with un-frozen lockfile to automatically fix lockfile.` + ) + ); + } else { + // "fix" the lockfile entry to the correct integrity + // the content has priority over the integrity value + entry = { + ...entry, + integrity: computeIntegrity(content) + }; + storeLockEntry(lockfile, url, entry); + } + } + continueWithCachedContent(result); + }); + } else { + doFetch(); + } + }); + } + ); - /** - * @returns {void} - */ - _ensureProcessing() { - while (this._activeTasks < this._parallelism) { - const entry = this._queued.dequeue(); - if (entry === undefined) break; - this._activeTasks++; - entry.state = PROCESSING_STATE; - this._startProcessing(entry); - } - this._willEnsureProcessing = false; - if (this._queued.length > 0) return; - if (this._children !== undefined) { - for (const child of this._children) { - while (this._activeTasks < this._parallelism) { - const entry = child._queued.dequeue(); - if (entry === undefined) break; - this._activeTasks++; - entry.state = PROCESSING_STATE; - child._startProcessing(entry); + const respondWithUrlModule = (url, resourceData, callback) => { + getInfo(url.href, (err, result) => { + if (err) return callback(err); + resourceData.resource = url.href; + resourceData.path = url.origin + url.pathname; + resourceData.query = url.search; + resourceData.fragment = url.hash; + resourceData.context = new URL( + ".", + result.entry.resolved + ).href.slice(0, -1); + resourceData.data.mimetype = result.entry.contentType; + callback(null, true); + }); + }; + normalModuleFactory.hooks.resolveForScheme + .for(scheme) + .tapAsync( + "HttpUriPlugin", + (resourceData, resolveData, callback) => { + respondWithUrlModule( + new URL(resourceData.resource), + resourceData, + callback + ); + } + ); + normalModuleFactory.hooks.resolveInScheme + .for(scheme) + .tapAsync("HttpUriPlugin", (resourceData, data, callback) => { + // Only handle relative urls (./xxx, ../xxx, /xxx, //xxx) + if ( + data.dependencyType !== "url" && + !/^\.{0,2}\//.test(resourceData.resource) + ) { + return callback(); + } + respondWithUrlModule( + new URL(resourceData.resource, data.context + "/"), + resourceData, + callback + ); + }); + const hooks = NormalModule.getCompilationHooks(compilation); + hooks.readResourceForScheme + .for(scheme) + .tapAsync("HttpUriPlugin", (resource, module, callback) => { + return getInfo(resource, (err, result) => { + if (err) return callback(err); + module.buildInfo.resourceIntegrity = result.entry.integrity; + callback(null, result.content); + }); + }); + hooks.needBuild.tapAsync( + "HttpUriPlugin", + (module, context, callback) => { + if ( + module.resource && + module.resource.startsWith(`${scheme}://`) + ) { + getInfo(module.resource, (err, result) => { + if (err) return callback(err); + if ( + result.entry.integrity !== + module.buildInfo.resourceIntegrity + ) { + return callback(null, true); + } + callback(); + }); + } else { + return callback(); + } + } + ); } - if (child._queued.length > 0) return; - } - } - if (!this._willEnsureProcessing) this._needProcessing = false; - } - - /** - * @param {AsyncQueueEntry} entry the entry - * @returns {void} - */ - _startProcessing(entry) { - this.hooks.beforeStart.callAsync(entry.item, err => { - if (err) { - this._handleResult( - entry, - makeWebpackError(err, `AsyncQueue(${this._name}).hooks.beforeStart`) - ); - return; - } - let inCallback = false; - try { - this._processor(entry.item, (e, r) => { - inCallback = true; - this._handleResult(entry, e, r); - }); - } catch (err) { - if (inCallback) throw err; - this._handleResult(entry, err, null); - } - this.hooks.started.call(entry.item); - }); - } - - /** - * @param {AsyncQueueEntry} entry the entry - * @param {WebpackError=} err error, if any - * @param {R=} result result, if any - * @returns {void} - */ - _handleResult(entry, err, result) { - this.hooks.result.callAsync(entry.item, err, result, hookError => { - const error = hookError - ? makeWebpackError(hookError, `AsyncQueue(${this._name}).hooks.result`) - : err; - - const callback = entry.callback; - const callbacks = entry.callbacks; - entry.state = DONE_STATE; - entry.callback = undefined; - entry.callbacks = undefined; - entry.result = result; - entry.error = error; - - const root = this._root; - root._activeTasks--; - if (root._willEnsureProcessing === false && root._needProcessing) { - root._willEnsureProcessing = true; - setImmediate(root._ensureProcessing); - } + compilation.hooks.finishModules.tapAsync( + "HttpUriPlugin", + (modules, callback) => { + if (!lockfileUpdates) return callback(); + const ext = extname(lockfileLocation); + const tempFile = join( + intermediateFs, + dirname(intermediateFs, lockfileLocation), + `.${basename(lockfileLocation, ext)}.${ + (Math.random() * 10000) | 0 + }${ext}` + ); - if (inHandleResult++ > 3) { - process.nextTick(() => { - callback(error, result); - if (callbacks !== undefined) { - for (const callback of callbacks) { - callback(error, result); + const writeDone = () => { + const nextOperation = inProgressWrite.shift(); + if (nextOperation) { + nextOperation(); + } else { + inProgressWrite = undefined; + } + }; + const runWrite = () => { + intermediateFs.readFile(lockfileLocation, (err, buffer) => { + if (err && err.code !== "ENOENT") { + writeDone(); + return callback(err); + } + const lockfile = buffer + ? Lockfile.parse(buffer.toString("utf-8")) + : new Lockfile(); + for (const [key, value] of lockfileUpdates) { + lockfile.entries.set(key, value); + } + intermediateFs.writeFile(tempFile, lockfile.toString(), err => { + if (err) { + writeDone(); + return intermediateFs.unlink(tempFile, () => callback(err)); + } + intermediateFs.rename(tempFile, lockfileLocation, err => { + if (err) { + writeDone(); + return intermediateFs.unlink(tempFile, () => + callback(err) + ); + } + writeDone(); + callback(); + }); + }); + }); + }; + if (inProgressWrite) { + inProgressWrite.push(runWrite); + } else { + inProgressWrite = []; + runWrite(); } } - }); - } else { - callback(error, result); - if (callbacks !== undefined) { - for (const callback of callbacks) { - callback(error, result); - } - } + ); } - inHandleResult--; - }); - } - - clear() { - this._entries.clear(); - this._queued.clear(); - this._activeTasks = 0; - this._willEnsureProcessing = false; - this._needProcessing = false; - this._stopped = false; + ); } } -module.exports = AsyncQueue; +module.exports = HttpUriPlugin; /***/ }), -/***/ 36692: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 41721: +/***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -class Hash { - /* istanbul ignore next */ - /** - * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} - * @abstract - * @param {string|Buffer} data data - * @param {string=} inputEncoding data encoding - * @returns {this} updated hash - */ - update(data, inputEncoding) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); +class ArraySerializer { + serialize(array, { write }) { + write(array.length); + for (const item of array) write(item); } - - /* istanbul ignore next */ - /** - * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} - * @abstract - * @param {string=} encoding encoding of the return value - * @returns {string|Buffer} digest - */ - digest(encoding) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + deserialize({ read }) { + const length = read(); + const array = []; + for (let i = 0; i < length; i++) { + array.push(read()); + } + return array; } } -module.exports = Hash; - - -/***/ }), - -/***/ 39104: -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** - * @template T - * @param {Iterable} set a set - * @returns {T | undefined} last item - */ -const last = set => { - let last; - for (const item of set) last = item; - return last; -}; - -/** - * @template T - * @param {Iterable} iterable iterable - * @param {function(T): boolean} filter predicate - * @returns {boolean} true, if some items match the filter predicate - */ -const someInIterable = (iterable, filter) => { - for (const item of iterable) { - if (filter(item)) return true; - } - return false; -}; - -/** - * @template T - * @param {Iterable} iterable an iterable - * @returns {number} count of items - */ -const countIterable = iterable => { - let i = 0; - // eslint-disable-next-line no-unused-vars - for (const _ of iterable) i++; - return i; -}; - -exports.last = last; -exports.someInIterable = someInIterable; -exports.countIterable = countIterable; +module.exports = ArraySerializer; /***/ }), -/***/ 48424: +/***/ 97059: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const { first } = __webpack_require__(93347); -const SortableSet = __webpack_require__(13098); - -/** - * Multi layer bucket sorted set: - * Supports adding non-existing items (DO NOT ADD ITEM TWICE), - * Supports removing exiting items (DO NOT REMOVE ITEM NOT IN SET), - * Supports popping the first items according to defined order, - * Supports iterating all items without order, - * Supports updating an item in an efficient way, - * Supports size property, which is the number of items, - * Items are lazy partially sorted when needed - * @template T - * @template K - */ -class LazyBucketSortedSet { - /** - * @param {function(T): K} getKey function to get key from item - * @param {function(K, K): number} comparator comparator to sort keys - * @param {...((function(T): any) | (function(any, any): number))} args more pairs of getKey and comparator plus optional final comparator for the last layer - */ - constructor(getKey, comparator, ...args) { - this._getKey = getKey; - this._innerArgs = args; - this._leaf = args.length <= 1; - this._keys = new SortableSet(undefined, comparator); - /** @type {Map | SortableSet>} */ - this._map = new Map(); - this._unsortedItems = new Set(); - this.size = 0; - } +const memoize = __webpack_require__(78676); +const SerializerMiddleware = __webpack_require__(83137); - /** - * @param {T} item an item - * @returns {void} - */ - add(item) { - this.size++; - this._unsortedItems.add(item); - } +/** @typedef {import("./types").BufferSerializableType} BufferSerializableType */ +/** @typedef {import("./types").PrimitiveSerializableType} PrimitiveSerializableType */ - /** - * @param {K} key key of item - * @param {T} item the item - * @returns {void} - */ - _addInternal(key, item) { - let entry = this._map.get(key); - if (entry === undefined) { - entry = this._leaf - ? new SortableSet(undefined, this._innerArgs[0]) - : new /** @type {any} */ (LazyBucketSortedSet)(...this._innerArgs); - this._keys.add(key); - this._map.set(key, entry); - } - entry.add(item); - } +/* +Format: - /** - * @param {T} item an item - * @returns {void} - */ - delete(item) { - this.size--; - if (this._unsortedItems.has(item)) { - this._unsortedItems.delete(item); - return; - } - const key = this._getKey(item); - const entry = this._map.get(key); - entry.delete(item); - if (entry.size === 0) { - this._deleteKey(key); - } - } +File -> Section* - /** - * @param {K} key key to be removed - * @returns {void} - */ - _deleteKey(key) { - this._keys.delete(key); - this._map.delete(key); - } +Section -> NullsSection | + BooleansSection | + F64NumbersSection | + I32NumbersSection | + I8NumbersSection | + ShortStringSection | + StringSection | + BufferSection | + NopSection - /** - * @returns {T | undefined} an item - */ - popFirst() { - if (this.size === 0) return undefined; - this.size--; - if (this._unsortedItems.size > 0) { - for (const item of this._unsortedItems) { - const key = this._getKey(item); - this._addInternal(key, item); - } - this._unsortedItems.clear(); - } - this._keys.sort(); - const key = first(this._keys); - const entry = this._map.get(key); - if (this._leaf) { - const leafEntry = /** @type {SortableSet} */ (entry); - leafEntry.sort(); - const item = first(leafEntry); - leafEntry.delete(item); - if (leafEntry.size === 0) { - this._deleteKey(key); - } - return item; - } else { - const nodeEntry = /** @type {LazyBucketSortedSet} */ (entry); - const item = nodeEntry.popFirst(); - if (nodeEntry.size === 0) { - this._deleteKey(key); - } - return item; - } - } - /** - * @param {T} item to be updated item - * @returns {function(true=): void} finish update - */ - startUpdate(item) { - if (this._unsortedItems.has(item)) { - return remove => { - if (remove) { - this._unsortedItems.delete(item); - this.size--; - return; - } - }; - } - const key = this._getKey(item); - if (this._leaf) { - const oldEntry = /** @type {SortableSet} */ (this._map.get(key)); - return remove => { - if (remove) { - this.size--; - oldEntry.delete(item); - if (oldEntry.size === 0) { - this._deleteKey(key); - } - return; - } - const newKey = this._getKey(item); - if (key === newKey) { - // This flags the sortable set as unordered - oldEntry.add(item); - } else { - oldEntry.delete(item); - if (oldEntry.size === 0) { - this._deleteKey(key); - } - this._addInternal(newKey, item); - } - }; - } else { - const oldEntry = /** @type {LazyBucketSortedSet} */ ( - this._map.get(key) - ); - const finishUpdate = oldEntry.startUpdate(item); - return remove => { - if (remove) { - this.size--; - finishUpdate(true); - if (oldEntry.size === 0) { - this._deleteKey(key); - } - return; - } - const newKey = this._getKey(item); - if (key === newKey) { - finishUpdate(); - } else { - finishUpdate(true); - if (oldEntry.size === 0) { - this._deleteKey(key); - } - this._addInternal(newKey, item); - } - }; - } - } - /** - * @param {Iterator[]} iterators list of iterators to append to - * @returns {void} - */ - _appendIterators(iterators) { - if (this._unsortedItems.size > 0) - iterators.push(this._unsortedItems[Symbol.iterator]()); - for (const key of this._keys) { - const entry = this._map.get(key); - if (this._leaf) { - const leafEntry = /** @type {SortableSet} */ (entry); - const iterator = leafEntry[Symbol.iterator](); - iterators.push(iterator); - } else { - const nodeEntry = /** @type {LazyBucketSortedSet} */ (entry); - nodeEntry._appendIterators(iterators); - } - } - } +NullsSection -> + NullHeaderByte | Null2HeaderByte | Null3HeaderByte | + Nulls8HeaderByte 0xnn (n:count - 4) | + Nulls32HeaderByte n:ui32 (n:count - 260) | +BooleansSection -> TrueHeaderByte | FalseHeaderByte | BooleansSectionHeaderByte BooleansCountAndBitsByte +F64NumbersSection -> F64NumbersSectionHeaderByte f64* +I32NumbersSection -> I32NumbersSectionHeaderByte i32* +I8NumbersSection -> I8NumbersSectionHeaderByte i8* +ShortStringSection -> ShortStringSectionHeaderByte ascii-byte* +StringSection -> StringSectionHeaderByte i32:length utf8-byte* +BufferSection -> BufferSectionHeaderByte i32:length byte* +NopSection --> NopSectionHeaderByte - /** - * @returns {Iterator} the iterator - */ - [Symbol.iterator]() { - const iterators = []; - this._appendIterators(iterators); - iterators.reverse(); - let currentIterator = iterators.pop(); - return { - next: () => { - const res = currentIterator.next(); - if (res.done) { - if (iterators.length === 0) return res; - currentIterator = iterators.pop(); - return currentIterator.next(); - } - return res; - } - }; - } -} +ShortStringSectionHeaderByte -> 0b1nnn_nnnn (n:length) -module.exports = LazyBucketSortedSet; +F64NumbersSectionHeaderByte -> 0b001n_nnnn (n:count - 1) +I32NumbersSectionHeaderByte -> 0b010n_nnnn (n:count - 1) +I8NumbersSectionHeaderByte -> 0b011n_nnnn (n:count - 1) +NullsSectionHeaderByte -> 0b0001_nnnn (n:count - 1) +BooleansCountAndBitsByte -> + 0b0000_1xxx (count = 3) | + 0b0001_xxxx (count = 4) | + 0b001x_xxxx (count = 5) | + 0b01xx_xxxx (count = 6) | + 0b1nnn_nnnn (n:count - 7, 7 <= count <= 133) + 0xff n:ui32 (n:count, 134 <= count < 2^32) -/***/ }), +StringSectionHeaderByte -> 0b0000_1110 +BufferSectionHeaderByte -> 0b0000_1111 +NopSectionHeaderByte -> 0b0000_1011 +FalseHeaderByte -> 0b0000_1100 +TrueHeaderByte -> 0b0000_1101 -/***/ 38938: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +RawNumber -> n (n <= 10) -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ +const LAZY_HEADER = 0x0b; +const TRUE_HEADER = 0x0c; +const FALSE_HEADER = 0x0d; +const BOOLEANS_HEADER = 0x0e; +const NULL_HEADER = 0x10; +const NULL2_HEADER = 0x11; +const NULL3_HEADER = 0x12; +const NULLS8_HEADER = 0x13; +const NULLS32_HEADER = 0x14; +const NULL_AND_I8_HEADER = 0x15; +const NULL_AND_I32_HEADER = 0x16; +const NULL_AND_TRUE_HEADER = 0x17; +const NULL_AND_FALSE_HEADER = 0x18; +const STRING_HEADER = 0x1e; +const BUFFER_HEADER = 0x1f; +const I8_HEADER = 0x60; +const I32_HEADER = 0x40; +const F64_HEADER = 0x20; +const SHORT_STRING_HEADER = 0x80; +/** Uplift high-order bits */ +const NUMBERS_HEADER_MASK = 0xe0; +const NUMBERS_COUNT_MASK = 0x1f; // 0b0001_1111 +const SHORT_STRING_LENGTH_MASK = 0x7f; // 0b0111_1111 -const makeSerializable = __webpack_require__(33032); +const HEADER_SIZE = 1; +const I8_SIZE = 1; +const I32_SIZE = 4; +const F64_SIZE = 8; -/** - * @template T - * @param {Set} targetSet set where items should be added - * @param {Set>} toMerge iterables to be merged - * @returns {void} - */ -const merge = (targetSet, toMerge) => { - for (const set of toMerge) { - for (const item of set) { - targetSet.add(item); - } - } -}; +const MEASURE_START_OPERATION = Symbol("MEASURE_START_OPERATION"); +const MEASURE_END_OPERATION = Symbol("MEASURE_END_OPERATION"); -/** - * @template T - * @param {Set>} targetSet set where iterables should be added - * @param {Array>} toDeepMerge lazy sets to be flattened - * @returns {void} - */ -const flatten = (targetSet, toDeepMerge) => { - for (const set of toDeepMerge) { - if (set._set.size > 0) targetSet.add(set._set); - if (set._needMerge) { - for (const mergedSet of set._toMerge) { - targetSet.add(mergedSet); - } - flatten(targetSet, set._toDeepMerge); - } +/** @typedef {typeof MEASURE_START_OPERATION} MEASURE_START_OPERATION_TYPE */ +/** @typedef {typeof MEASURE_END_OPERATION} MEASURE_END_OPERATION_TYPE */ + +const identifyNumber = n => { + if (n === (n | 0)) { + if (n <= 127 && n >= -128) return 0; + if (n <= 2147483647 && n >= -2147483648) return 1; } + return 2; }; /** - * Like Set but with an addAll method to eventually add items from another iterable. - * Access methods make sure that all delayed operations are executed. - * Iteration methods deopts to normal Set performance until clear is called again (because of the chance of modifications during iteration). - * @template T + * @typedef {PrimitiveSerializableType[]} DeserializedType + * @typedef {BufferSerializableType[]} SerializedType + * @extends {SerializerMiddleware} */ -class LazySet { +class BinaryMiddleware extends SerializerMiddleware { /** - * @param {Iterable=} iterable init iterable + * @param {DeserializedType} data data + * @param {Object} context context object + * @returns {SerializedType|Promise} serialized data */ - constructor(iterable) { - /** @type {Set} */ - this._set = new Set(iterable); - /** @type {Set>} */ - this._toMerge = new Set(); - /** @type {Array>} */ - this._toDeepMerge = []; - this._needMerge = false; - this._deopt = false; - } - - _flatten() { - flatten(this._toMerge, this._toDeepMerge); - this._toDeepMerge.length = 0; - } - - _merge() { - this._flatten(); - merge(this._set, this._toMerge); - this._toMerge.clear(); - this._needMerge = false; + serialize(data, context) { + return this._serialize(data, context); } - _isEmpty() { - return ( - this._set.size === 0 && - this._toMerge.size === 0 && - this._toDeepMerge.length === 0 + _serializeLazy(fn, context) { + return SerializerMiddleware.serializeLazy(fn, data => + this._serialize(data, context) ); } - get size() { - if (this._needMerge) this._merge(); - return this._set.size; - } - /** - * @param {T} item an item - * @returns {this} itself + * @param {DeserializedType} data data + * @param {Object} context context object + * @param {{ leftOverBuffer: Buffer | null, allocationSize: number, increaseCounter: number }} allocationScope allocation scope + * @returns {SerializedType} serialized data */ - add(item) { - this._set.add(item); - return this; - } + _serialize( + data, + context, + allocationScope = { + allocationSize: 1024, + increaseCounter: 0, + leftOverBuffer: null + } + ) { + /** @type {Buffer} */ + let leftOverBuffer = null; + /** @type {BufferSerializableType[]} */ + let buffers = []; + /** @type {Buffer} */ + let currentBuffer = allocationScope ? allocationScope.leftOverBuffer : null; + allocationScope.leftOverBuffer = null; + let currentPosition = 0; + if (currentBuffer === null) { + currentBuffer = Buffer.allocUnsafe(allocationScope.allocationSize); + } + const allocate = bytesNeeded => { + if (currentBuffer !== null) { + if (currentBuffer.length - currentPosition >= bytesNeeded) return; + flush(); + } + if (leftOverBuffer && leftOverBuffer.length >= bytesNeeded) { + currentBuffer = leftOverBuffer; + leftOverBuffer = null; + } else { + currentBuffer = Buffer.allocUnsafe( + Math.max(bytesNeeded, allocationScope.allocationSize) + ); + if ( + !(allocationScope.increaseCounter = + (allocationScope.increaseCounter + 1) % 4) && + allocationScope.allocationSize < 16777216 + ) { + allocationScope.allocationSize = allocationScope.allocationSize << 1; + } + } + }; + const flush = () => { + if (currentBuffer !== null) { + if (currentPosition > 0) { + buffers.push( + Buffer.from( + currentBuffer.buffer, + currentBuffer.byteOffset, + currentPosition + ) + ); + } + if ( + !leftOverBuffer || + leftOverBuffer.length < currentBuffer.length - currentPosition + ) { + leftOverBuffer = Buffer.from( + currentBuffer.buffer, + currentBuffer.byteOffset + currentPosition, + currentBuffer.byteLength - currentPosition + ); + } - /** - * @param {Iterable | LazySet} iterable a immutable iterable or another immutable LazySet which will eventually be merged into the Set - * @returns {this} itself - */ - addAll(iterable) { - if (this._deopt) { - const _set = this._set; - for (const item of iterable) { - _set.add(item); + currentBuffer = null; + currentPosition = 0; } - } else { - if (iterable instanceof LazySet) { - if (iterable._isEmpty()) return this; - this._toDeepMerge.push(iterable); - this._needMerge = true; - if (this._toDeepMerge.length > 100000) { - this._flatten(); + }; + const writeU8 = byte => { + currentBuffer.writeUInt8(byte, currentPosition++); + }; + const writeU32 = ui32 => { + currentBuffer.writeUInt32LE(ui32, currentPosition); + currentPosition += 4; + }; + const measureStack = []; + const measureStart = () => { + measureStack.push(buffers.length, currentPosition); + }; + const measureEnd = () => { + const oldPos = measureStack.pop(); + const buffersIndex = measureStack.pop(); + let size = currentPosition - oldPos; + for (let i = buffersIndex; i < buffers.length; i++) { + size += buffers[i].length; + } + return size; + }; + for (let i = 0; i < data.length; i++) { + const thing = data[i]; + switch (typeof thing) { + case "function": { + if (!SerializerMiddleware.isLazy(thing)) + throw new Error("Unexpected function " + thing); + /** @type {SerializedType | (() => SerializedType)} */ + let serializedData = + SerializerMiddleware.getLazySerializedValue(thing); + if (serializedData === undefined) { + if (SerializerMiddleware.isLazy(thing, this)) { + flush(); + allocationScope.leftOverBuffer = leftOverBuffer; + const result = + /** @type {(Exclude>)[]} */ ( + thing() + ); + const data = this._serialize(result, context, allocationScope); + leftOverBuffer = allocationScope.leftOverBuffer; + allocationScope.leftOverBuffer = null; + SerializerMiddleware.setLazySerializedValue(thing, data); + serializedData = data; + } else { + serializedData = this._serializeLazy(thing, context); + flush(); + buffers.push(serializedData); + break; + } + } else { + if (typeof serializedData === "function") { + flush(); + buffers.push(serializedData); + break; + } + } + const lengths = []; + for (const item of serializedData) { + let last; + if (typeof item === "function") { + lengths.push(0); + } else if (item.length === 0) { + // ignore + } else if ( + lengths.length > 0 && + (last = lengths[lengths.length - 1]) !== 0 + ) { + const remaining = 0xffffffff - last; + if (remaining >= item.length) { + lengths[lengths.length - 1] += item.length; + } else { + lengths.push(item.length - remaining); + lengths[lengths.length - 2] = 0xffffffff; + } + } else { + lengths.push(item.length); + } + } + allocate(5 + lengths.length * 4); + writeU8(LAZY_HEADER); + writeU32(lengths.length); + for (const l of lengths) { + writeU32(l); + } + flush(); + for (const item of serializedData) { + buffers.push(item); + } + break; + } + case "string": { + const len = Buffer.byteLength(thing); + if (len >= 128 || len !== thing.length) { + allocate(len + HEADER_SIZE + I32_SIZE); + writeU8(STRING_HEADER); + writeU32(len); + currentBuffer.write(thing, currentPosition); + currentPosition += len; + } else if (len >= 70) { + allocate(len + HEADER_SIZE); + writeU8(SHORT_STRING_HEADER | len); + + currentBuffer.write(thing, currentPosition, "latin1"); + currentPosition += len; + } else { + allocate(len + HEADER_SIZE); + writeU8(SHORT_STRING_HEADER | len); + + for (let i = 0; i < len; i++) { + currentBuffer[currentPosition++] = thing.charCodeAt(i); + } + } + break; + } + case "number": { + const type = identifyNumber(thing); + if (type === 0 && thing >= 0 && thing <= 10) { + // shortcut for very small numbers + allocate(I8_SIZE); + writeU8(thing); + break; + } + /** + * amount of numbers to write + * @type {number} + */ + let n = 1; + for (; n < 32 && i + n < data.length; n++) { + const item = data[i + n]; + if (typeof item !== "number") break; + if (identifyNumber(item) !== type) break; + } + switch (type) { + case 0: + allocate(HEADER_SIZE + I8_SIZE * n); + writeU8(I8_HEADER | (n - 1)); + while (n > 0) { + currentBuffer.writeInt8( + /** @type {number} */ (data[i]), + currentPosition + ); + currentPosition += I8_SIZE; + n--; + i++; + } + break; + case 1: + allocate(HEADER_SIZE + I32_SIZE * n); + writeU8(I32_HEADER | (n - 1)); + while (n > 0) { + currentBuffer.writeInt32LE( + /** @type {number} */ (data[i]), + currentPosition + ); + currentPosition += I32_SIZE; + n--; + i++; + } + break; + case 2: + allocate(HEADER_SIZE + F64_SIZE * n); + writeU8(F64_HEADER | (n - 1)); + while (n > 0) { + currentBuffer.writeDoubleLE( + /** @type {number} */ (data[i]), + currentPosition + ); + currentPosition += F64_SIZE; + n--; + i++; + } + break; + } + + i--; + break; + } + case "boolean": { + let lastByte = thing === true ? 1 : 0; + const bytes = []; + let count = 1; + let n; + for (n = 1; n < 0xffffffff && i + n < data.length; n++) { + const item = data[i + n]; + if (typeof item !== "boolean") break; + const pos = count & 0x7; + if (pos === 0) { + bytes.push(lastByte); + lastByte = item === true ? 1 : 0; + } else if (item === true) { + lastByte |= 1 << pos; + } + count++; + } + i += count - 1; + if (count === 1) { + allocate(HEADER_SIZE); + writeU8(lastByte === 1 ? TRUE_HEADER : FALSE_HEADER); + } else if (count === 2) { + allocate(HEADER_SIZE * 2); + writeU8(lastByte & 1 ? TRUE_HEADER : FALSE_HEADER); + writeU8(lastByte & 2 ? TRUE_HEADER : FALSE_HEADER); + } else if (count <= 6) { + allocate(HEADER_SIZE + I8_SIZE); + writeU8(BOOLEANS_HEADER); + writeU8((1 << count) | lastByte); + } else if (count <= 133) { + allocate(HEADER_SIZE + I8_SIZE + I8_SIZE * bytes.length + I8_SIZE); + writeU8(BOOLEANS_HEADER); + writeU8(0x80 | (count - 7)); + for (const byte of bytes) writeU8(byte); + writeU8(lastByte); + } else { + allocate( + HEADER_SIZE + + I8_SIZE + + I32_SIZE + + I8_SIZE * bytes.length + + I8_SIZE + ); + writeU8(BOOLEANS_HEADER); + writeU8(0xff); + writeU32(count); + for (const byte of bytes) writeU8(byte); + writeU8(lastByte); + } + break; + } + case "object": { + if (thing === null) { + let n; + for (n = 1; n < 0x100000104 && i + n < data.length; n++) { + const item = data[i + n]; + if (item !== null) break; + } + i += n - 1; + if (n === 1) { + if (i + 1 < data.length) { + const next = data[i + 1]; + if (next === true) { + allocate(HEADER_SIZE); + writeU8(NULL_AND_TRUE_HEADER); + i++; + } else if (next === false) { + allocate(HEADER_SIZE); + writeU8(NULL_AND_FALSE_HEADER); + i++; + } else if (typeof next === "number") { + const type = identifyNumber(next); + if (type === 0) { + allocate(HEADER_SIZE + I8_SIZE); + writeU8(NULL_AND_I8_HEADER); + currentBuffer.writeInt8(next, currentPosition); + currentPosition += I8_SIZE; + i++; + } else if (type === 1) { + allocate(HEADER_SIZE + I32_SIZE); + writeU8(NULL_AND_I32_HEADER); + currentBuffer.writeInt32LE(next, currentPosition); + currentPosition += I32_SIZE; + i++; + } else { + allocate(HEADER_SIZE); + writeU8(NULL_HEADER); + } + } else { + allocate(HEADER_SIZE); + writeU8(NULL_HEADER); + } + } else { + allocate(HEADER_SIZE); + writeU8(NULL_HEADER); + } + } else if (n === 2) { + allocate(HEADER_SIZE); + writeU8(NULL2_HEADER); + } else if (n === 3) { + allocate(HEADER_SIZE); + writeU8(NULL3_HEADER); + } else if (n < 260) { + allocate(HEADER_SIZE + I8_SIZE); + writeU8(NULLS8_HEADER); + writeU8(n - 4); + } else { + allocate(HEADER_SIZE + I32_SIZE); + writeU8(NULLS32_HEADER); + writeU32(n - 260); + } + } else if (Buffer.isBuffer(thing)) { + if (thing.length < 8192) { + allocate(HEADER_SIZE + I32_SIZE + thing.length); + writeU8(BUFFER_HEADER); + writeU32(thing.length); + thing.copy(currentBuffer, currentPosition); + currentPosition += thing.length; + } else { + allocate(HEADER_SIZE + I32_SIZE); + writeU8(BUFFER_HEADER); + writeU32(thing.length); + flush(); + buffers.push(thing); + } + } + break; + } + case "symbol": { + if (thing === MEASURE_START_OPERATION) { + measureStart(); + } else if (thing === MEASURE_END_OPERATION) { + const size = measureEnd(); + allocate(HEADER_SIZE + I32_SIZE); + writeU8(I32_HEADER); + currentBuffer.writeInt32LE(size, currentPosition); + currentPosition += I32_SIZE; + } + break; } - } else { - this._toMerge.add(iterable); - this._needMerge = true; } - if (this._toMerge.size > 100000) this._merge(); } - return this; - } - - clear() { - this._set.clear(); - this._toMerge.clear(); - this._toDeepMerge.length = 0; - this._needMerge = false; - this._deopt = false; - } - - /** - * @param {T} value an item - * @returns {boolean} true, if the value was in the Set before - */ - delete(value) { - if (this._needMerge) this._merge(); - return this._set.delete(value); - } + flush(); - entries() { - this._deopt = true; - if (this._needMerge) this._merge(); - return this._set.entries(); - } + allocationScope.leftOverBuffer = leftOverBuffer; - /** - * @param {function(T, T, Set): void} callbackFn function called for each entry - * @param {any} thisArg this argument for the callbackFn - * @returns {void} - */ - forEach(callbackFn, thisArg) { - this._deopt = true; - if (this._needMerge) this._merge(); - this._set.forEach(callbackFn, thisArg); + // avoid leaking memory + currentBuffer = null; + leftOverBuffer = null; + allocationScope = undefined; + const _buffers = buffers; + buffers = undefined; + return _buffers; } /** - * @param {T} item an item - * @returns {boolean} true, when the item is in the Set + * @param {SerializedType} data data + * @param {Object} context context object + * @returns {DeserializedType|Promise} deserialized data */ - has(item) { - if (this._needMerge) this._merge(); - return this._set.has(item); - } - - keys() { - this._deopt = true; - if (this._needMerge) this._merge(); - return this._set.keys(); - } - - values() { - this._deopt = true; - if (this._needMerge) this._merge(); - return this._set.values(); - } - - [Symbol.iterator]() { - this._deopt = true; - if (this._needMerge) this._merge(); - return this._set[Symbol.iterator](); - } - - /* istanbul ignore next */ - get [Symbol.toStringTag]() { - return "LazySet"; - } - - serialize({ write }) { - if (this._needMerge) this._merge(); - write(this._set.size); - for (const item of this._set) write(item); - } - - static deserialize({ read }) { - const count = read(); - const items = []; - for (let i = 0; i < count; i++) { - items.push(read()); - } - return new LazySet(items); - } -} - -makeSerializable(LazySet, "webpack/lib/util/LazySet"); - -module.exports = LazySet; - - -/***/ }), - -/***/ 82482: -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** - * @template K - * @template V - * @param {Map} map a map - * @param {K} key the key - * @param {function(): V} computer compute value - * @returns {V} value - */ -exports.provide = (map, key, computer) => { - const value = map.get(key); - if (value !== undefined) return value; - const newValue = computer(); - map.set(key, newValue); - return newValue; -}; - - -/***/ }), - -/***/ 50780: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const binarySearchBounds = __webpack_require__(92229); - -class ParallelismFactorCalculator { - constructor() { - this._rangePoints = []; - this._rangeCallbacks = []; - } - - range(start, end, callback) { - if (start === end) return callback(1); - this._rangePoints.push(start); - this._rangePoints.push(end); - this._rangeCallbacks.push(callback); + deserialize(data, context) { + return this._deserialize(data, context); } - calculate() { - const segments = Array.from(new Set(this._rangePoints)).sort((a, b) => - a < b ? -1 : 1 + _createLazyDeserialized(content, context) { + return SerializerMiddleware.createLazy( + memoize(() => this._deserialize(content, context)), + this, + undefined, + content ); - const parallelism = segments.map(() => 0); - const rangeStartIndices = []; - for (let i = 0; i < this._rangePoints.length; i += 2) { - const start = this._rangePoints[i]; - const end = this._rangePoints[i + 1]; - let idx = binarySearchBounds.eq(segments, start); - rangeStartIndices.push(idx); - do { - parallelism[idx]++; - idx++; - } while (segments[idx] < end); - } - for (let i = 0; i < this._rangeCallbacks.length; i++) { - const start = this._rangePoints[i * 2]; - const end = this._rangePoints[i * 2 + 1]; - let idx = rangeStartIndices[i]; - let sum = 0; - let totalDuration = 0; - let current = start; - do { - const p = parallelism[idx]; - idx++; - const duration = segments[idx] - current; - totalDuration += duration; - current = segments[idx]; - sum += p * duration; - } while (current < end); - this._rangeCallbacks[i](sum / totalDuration); - } - } -} - -module.exports = ParallelismFactorCalculator; - - -/***/ }), - -/***/ 65930: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** - * @template T - */ -class Queue { - /** - * @param {Iterable=} items The initial elements. - */ - constructor(items) { - /** @private @type {Set} */ - this._set = new Set(items); - /** @private @type {Iterator} */ - this._iterator = this._set[Symbol.iterator](); - } - - /** - * Returns the number of elements in this queue. - * @returns {number} The number of elements in this queue. - */ - get length() { - return this._set.size; } - /** - * Appends the specified element to this queue. - * @param {T} item The element to add. - * @returns {void} - */ - enqueue(item) { - this._set.add(item); + _deserializeLazy(fn, context) { + return SerializerMiddleware.deserializeLazy(fn, data => + this._deserialize(data, context) + ); } /** - * Retrieves and removes the head of this queue. - * @returns {T | undefined} The head of the queue of `undefined` if this queue is empty. + * @param {SerializedType} data data + * @param {Object} context context object + * @returns {DeserializedType} deserialized data */ - dequeue() { - const result = this._iterator.next(); - if (result.done) return undefined; - this._set.delete(result.value); - return result.value; - } -} - -module.exports = Queue; - - -/***/ }), - -/***/ 93347: -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + _deserialize(data, context) { + let currentDataItem = 0; + let currentBuffer = data[0]; + let currentIsBuffer = Buffer.isBuffer(currentBuffer); + let currentPosition = 0; + const retainedBuffer = context.retainedBuffer || (x => x); + const checkOverflow = () => { + if (currentPosition >= currentBuffer.length) { + currentPosition = 0; + currentDataItem++; + currentBuffer = + currentDataItem < data.length ? data[currentDataItem] : null; + currentIsBuffer = Buffer.isBuffer(currentBuffer); + } + }; + const isInCurrentBuffer = n => { + return currentIsBuffer && n + currentPosition <= currentBuffer.length; + }; + const ensureBuffer = () => { + if (!currentIsBuffer) { + throw new Error( + currentBuffer === null + ? "Unexpected end of stream" + : "Unexpected lazy element in stream" + ); + } + }; + /** + * Reads n bytes + * @param {number} n amount of bytes to read + * @returns {Buffer} buffer with bytes + */ + const read = n => { + ensureBuffer(); + const rem = currentBuffer.length - currentPosition; + if (rem < n) { + const buffers = [read(rem)]; + n -= rem; + ensureBuffer(); + while (currentBuffer.length < n) { + const b = /** @type {Buffer} */ (currentBuffer); + buffers.push(b); + n -= b.length; + currentDataItem++; + currentBuffer = + currentDataItem < data.length ? data[currentDataItem] : null; + currentIsBuffer = Buffer.isBuffer(currentBuffer); + ensureBuffer(); + } + buffers.push(read(n)); + return Buffer.concat(buffers); + } + const b = /** @type {Buffer} */ (currentBuffer); + const res = Buffer.from(b.buffer, b.byteOffset + currentPosition, n); + currentPosition += n; + checkOverflow(); + return res; + }; + /** + * Reads up to n bytes + * @param {number} n amount of bytes to read + * @returns {Buffer} buffer with bytes + */ + const readUpTo = n => { + ensureBuffer(); + const rem = currentBuffer.length - currentPosition; + if (rem < n) { + n = rem; + } + const b = /** @type {Buffer} */ (currentBuffer); + const res = Buffer.from(b.buffer, b.byteOffset + currentPosition, n); + currentPosition += n; + checkOverflow(); + return res; + }; + const readU8 = () => { + ensureBuffer(); + /** + * There is no need to check remaining buffer size here + * since {@link checkOverflow} guarantees at least one byte remaining + */ + const byte = /** @type {Buffer} */ (currentBuffer).readUInt8( + currentPosition + ); + currentPosition += I8_SIZE; + checkOverflow(); + return byte; + }; + const readU32 = () => { + return read(I32_SIZE).readUInt32LE(0); + }; + const readBits = (data, n) => { + let mask = 1; + while (n !== 0) { + result.push((data & mask) !== 0); + mask = mask << 1; + n--; + } + }; + const dispatchTable = Array.from({ length: 256 }).map((_, header) => { + switch (header) { + case LAZY_HEADER: + return () => { + const count = readU32(); + const lengths = Array.from({ length: count }).map(() => readU32()); + const content = []; + for (let l of lengths) { + if (l === 0) { + if (typeof currentBuffer !== "function") { + throw new Error("Unexpected non-lazy element in stream"); + } + content.push(currentBuffer); + currentDataItem++; + currentBuffer = + currentDataItem < data.length ? data[currentDataItem] : null; + currentIsBuffer = Buffer.isBuffer(currentBuffer); + } else { + do { + const buf = readUpTo(l); + l -= buf.length; + content.push(retainedBuffer(buf)); + } while (l > 0); + } + } + result.push(this._createLazyDeserialized(content, context)); + }; + case BUFFER_HEADER: + return () => { + const len = readU32(); + result.push(retainedBuffer(read(len))); + }; + case TRUE_HEADER: + return () => result.push(true); + case FALSE_HEADER: + return () => result.push(false); + case NULL3_HEADER: + return () => result.push(null, null, null); + case NULL2_HEADER: + return () => result.push(null, null); + case NULL_HEADER: + return () => result.push(null); + case NULL_AND_TRUE_HEADER: + return () => result.push(null, true); + case NULL_AND_FALSE_HEADER: + return () => result.push(null, false); + case NULL_AND_I8_HEADER: + return () => { + if (currentIsBuffer) { + result.push( + null, + /** @type {Buffer} */ (currentBuffer).readInt8(currentPosition) + ); + currentPosition += I8_SIZE; + checkOverflow(); + } else { + result.push(null, read(I8_SIZE).readInt8(0)); + } + }; + case NULL_AND_I32_HEADER: + return () => { + result.push(null); + if (isInCurrentBuffer(I32_SIZE)) { + result.push( + /** @type {Buffer} */ (currentBuffer).readInt32LE( + currentPosition + ) + ); + currentPosition += I32_SIZE; + checkOverflow(); + } else { + result.push(read(I32_SIZE).readInt32LE(0)); + } + }; + case NULLS8_HEADER: + return () => { + const len = readU8() + 4; + for (let i = 0; i < len; i++) { + result.push(null); + } + }; + case NULLS32_HEADER: + return () => { + const len = readU32() + 260; + for (let i = 0; i < len; i++) { + result.push(null); + } + }; + case BOOLEANS_HEADER: + return () => { + const innerHeader = readU8(); + if ((innerHeader & 0xf0) === 0) { + readBits(innerHeader, 3); + } else if ((innerHeader & 0xe0) === 0) { + readBits(innerHeader, 4); + } else if ((innerHeader & 0xc0) === 0) { + readBits(innerHeader, 5); + } else if ((innerHeader & 0x80) === 0) { + readBits(innerHeader, 6); + } else if (innerHeader !== 0xff) { + let count = (innerHeader & 0x7f) + 7; + while (count > 8) { + readBits(readU8(), 8); + count -= 8; + } + readBits(readU8(), count); + } else { + let count = readU32(); + while (count > 8) { + readBits(readU8(), 8); + count -= 8; + } + readBits(readU8(), count); + } + }; + case STRING_HEADER: + return () => { + const len = readU32(); + if (isInCurrentBuffer(len) && currentPosition + len < 0x7fffffff) { + result.push( + currentBuffer.toString( + undefined, + currentPosition, + currentPosition + len + ) + ); + currentPosition += len; + checkOverflow(); + } else { + result.push(read(len).toString()); + } + }; + case SHORT_STRING_HEADER: + return () => result.push(""); + case SHORT_STRING_HEADER | 1: + return () => { + if (currentIsBuffer && currentPosition < 0x7ffffffe) { + result.push( + currentBuffer.toString( + "latin1", + currentPosition, + currentPosition + 1 + ) + ); + currentPosition++; + checkOverflow(); + } else { + result.push(read(1).toString("latin1")); + } + }; + case I8_HEADER: + return () => { + if (currentIsBuffer) { + result.push( + /** @type {Buffer} */ (currentBuffer).readInt8(currentPosition) + ); + currentPosition++; + checkOverflow(); + } else { + result.push(read(1).readInt8(0)); + } + }; + default: + if (header <= 10) { + return () => result.push(header); + } else if ((header & SHORT_STRING_HEADER) === SHORT_STRING_HEADER) { + const len = header & SHORT_STRING_LENGTH_MASK; + return () => { + if ( + isInCurrentBuffer(len) && + currentPosition + len < 0x7fffffff + ) { + result.push( + currentBuffer.toString( + "latin1", + currentPosition, + currentPosition + len + ) + ); + currentPosition += len; + checkOverflow(); + } else { + result.push(read(len).toString("latin1")); + } + }; + } else if ((header & NUMBERS_HEADER_MASK) === F64_HEADER) { + const len = (header & NUMBERS_COUNT_MASK) + 1; + return () => { + const need = F64_SIZE * len; + if (isInCurrentBuffer(need)) { + for (let i = 0; i < len; i++) { + result.push( + /** @type {Buffer} */ (currentBuffer).readDoubleLE( + currentPosition + ) + ); + currentPosition += F64_SIZE; + } + checkOverflow(); + } else { + const buf = read(need); + for (let i = 0; i < len; i++) { + result.push(buf.readDoubleLE(i * F64_SIZE)); + } + } + }; + } else if ((header & NUMBERS_HEADER_MASK) === I32_HEADER) { + const len = (header & NUMBERS_COUNT_MASK) + 1; + return () => { + const need = I32_SIZE * len; + if (isInCurrentBuffer(need)) { + for (let i = 0; i < len; i++) { + result.push( + /** @type {Buffer} */ (currentBuffer).readInt32LE( + currentPosition + ) + ); + currentPosition += I32_SIZE; + } + checkOverflow(); + } else { + const buf = read(need); + for (let i = 0; i < len; i++) { + result.push(buf.readInt32LE(i * I32_SIZE)); + } + } + }; + } else if ((header & NUMBERS_HEADER_MASK) === I8_HEADER) { + const len = (header & NUMBERS_COUNT_MASK) + 1; + return () => { + const need = I8_SIZE * len; + if (isInCurrentBuffer(need)) { + for (let i = 0; i < len; i++) { + result.push( + /** @type {Buffer} */ (currentBuffer).readInt8( + currentPosition + ) + ); + currentPosition += I8_SIZE; + } + checkOverflow(); + } else { + const buf = read(need); + for (let i = 0; i < len; i++) { + result.push(buf.readInt8(i * I8_SIZE)); + } + } + }; + } else { + return () => { + throw new Error( + `Unexpected header byte 0x${header.toString(16)}` + ); + }; + } + } + }); -/** - * intersect creates Set containing the intersection of elements between all sets - * @template T - * @param {Set[]} sets an array of sets being checked for shared elements - * @returns {Set} returns a new Set containing the intersecting items - */ -const intersect = sets => { - if (sets.length === 0) return new Set(); - if (sets.length === 1) return new Set(sets[0]); - let minSize = Infinity; - let minIndex = -1; - for (let i = 0; i < sets.length; i++) { - const size = sets[i].size; - if (size < minSize) { - minIndex = i; - minSize = size; - } - } - const current = new Set(sets[minIndex]); - for (let i = 0; i < sets.length; i++) { - if (i === minIndex) continue; - const set = sets[i]; - for (const item of current) { - if (!set.has(item)) { - current.delete(item); + /** @type {DeserializedType} */ + let result = []; + while (currentBuffer !== null) { + if (typeof currentBuffer === "function") { + result.push(this._deserializeLazy(currentBuffer, context)); + currentDataItem++; + currentBuffer = + currentDataItem < data.length ? data[currentDataItem] : null; + currentIsBuffer = Buffer.isBuffer(currentBuffer); + } else { + const header = readU8(); + dispatchTable[header](); } } - } - return current; -}; - -/** - * Checks if a set is the subset of another set - * @template T - * @param {Set} bigSet a Set which contains the original elements to compare against - * @param {Set} smallSet the set whose elements might be contained inside of bigSet - * @returns {boolean} returns true if smallSet contains all elements inside of the bigSet - */ -const isSubset = (bigSet, smallSet) => { - if (bigSet.size < smallSet.size) return false; - for (const item of smallSet) { - if (!bigSet.has(item)) return false; - } - return true; -}; -/** - * @template T - * @param {Set} set a set - * @param {function(T): boolean} fn selector function - * @returns {T | undefined} found item - */ -const find = (set, fn) => { - for (const item of set) { - if (fn(item)) return item; + // avoid leaking memory in context + let _result = result; + result = undefined; + return _result; } -}; - -/** - * @template T - * @param {Set} set a set - * @returns {T | undefined} first item - */ -const first = set => { - const entry = set.values().next(); - return entry.done ? undefined : entry.value; -}; +} -/** - * @template T - * @param {Set} a first - * @param {Set} b second - * @returns {Set} combined set, may be identical to a or b - */ -const combine = (a, b) => { - if (b.size === 0) return a; - if (a.size === 0) return b; - const set = new Set(a); - for (const item of b) set.add(item); - return set; -}; +module.exports = BinaryMiddleware; -exports.intersect = intersect; -exports.isSubset = isSubset; -exports.find = find; -exports.first = first; -exports.combine = combine; +module.exports.MEASURE_START_OPERATION = MEASURE_START_OPERATION; +module.exports.MEASURE_END_OPERATION = MEASURE_END_OPERATION; /***/ }), -/***/ 13098: +/***/ 93475: /***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const NONE = Symbol("not sorted"); - -/** - * A subset of Set that offers sorting functionality - * @template T item type in set - * @extends {Set} - */ -class SortableSet extends Set { - /** - * Create a new sortable set - * @param {Iterable=} initialIterable The initial iterable value - * @typedef {function(T, T): number} SortFunction - * @param {SortFunction=} defaultSort Default sorting function - */ - constructor(initialIterable, defaultSort) { - super(initialIterable); - /** @private @type {undefined | function(T, T): number}} */ - this._sortFn = defaultSort; - /** @private @type {typeof NONE | undefined | function(T, T): number}} */ - this._lastActiveSortFn = NONE; - /** @private @type {Map | undefined} */ - this._cache = undefined; - /** @private @type {Map | undefined} */ - this._cacheOrderIndependent = undefined; - } - - /** - * @param {T} value value to add to set - * @returns {this} returns itself - */ - add(value) { - this._lastActiveSortFn = NONE; - this._invalidateCache(); - this._invalidateOrderedCache(); - super.add(value); - return this; - } - - /** - * @param {T} value value to delete - * @returns {boolean} true if value existed in set, false otherwise - */ - delete(value) { - this._invalidateCache(); - this._invalidateOrderedCache(); - return super.delete(value); - } - - /** - * @returns {void} - */ - clear() { - this._invalidateCache(); - this._invalidateOrderedCache(); - return super.clear(); - } - - /** - * Sort with a comparer function - * @param {SortFunction} sortFn Sorting comparer function - * @returns {void} - */ - sortWith(sortFn) { - if (this.size <= 1 || sortFn === this._lastActiveSortFn) { - // already sorted - nothing to do - return; - } - - const sortedArray = Array.from(this).sort(sortFn); - super.clear(); - for (let i = 0; i < sortedArray.length; i += 1) { - super.add(sortedArray[i]); - } - this._lastActiveSortFn = sortFn; - this._invalidateCache(); - } - - sort() { - this.sortWith(this._sortFn); - return this; - } - - /** - * Get data from cache - * @template R - * @param {function(SortableSet): R} fn function to calculate value - * @returns {R} returns result of fn(this), cached until set changes - */ - getFromCache(fn) { - if (this._cache === undefined) { - this._cache = new Map(); - } else { - const result = this._cache.get(fn); - const data = /** @type {R} */ (result); - if (data !== undefined) { - return data; - } - } - const newData = fn(this); - this._cache.set(fn, newData); - return newData; - } - - /** - * Get data from cache (ignoring sorting) - * @template R - * @param {function(SortableSet): R} fn function to calculate value - * @returns {R} returns result of fn(this), cached until set changes - */ - getFromUnorderedCache(fn) { - if (this._cacheOrderIndependent === undefined) { - this._cacheOrderIndependent = new Map(); - } else { - const result = this._cacheOrderIndependent.get(fn); - const data = /** @type {R} */ (result); - if (data !== undefined) { - return data; - } - } - const newData = fn(this); - this._cacheOrderIndependent.set(fn, newData); - return newData; - } - - /** - * @private - * @returns {void} - */ - _invalidateCache() { - if (this._cache !== undefined) { - this._cache.clear(); - } - } - - /** - * @private - * @returns {void} - */ - _invalidateOrderedCache() { - if (this._cacheOrderIndependent !== undefined) { - this._cacheOrderIndependent.clear(); - } +class DateObjectSerializer { + serialize(obj, { write }) { + write(obj.getTime()); } - - /** - * @returns {T[]} the raw array - */ - toJSON() { - return Array.from(this); + deserialize({ read }) { + return new Date(read()); } } -module.exports = SortableSet; +module.exports = DateObjectSerializer; /***/ }), -/***/ 64985: +/***/ 79479: /***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -/** - * @template K - * @template V - */ -class StackedCacheMap { - constructor() { - /** @type {Map} */ - this.map = new Map(); - /** @type {ReadonlyMap[]} */ - this.stack = []; - } - - /** - * @param {ReadonlyMap} map map to add - * @param {boolean} immutable if 'map' is immutable and StackedCacheMap can keep referencing it - */ - addAll(map, immutable) { - if (immutable) { - this.stack.push(map); - - // largest map should go first - for (let i = this.stack.length - 1; i > 0; i--) { - const beforeLast = this.stack[i - 1]; - if (beforeLast.size >= map.size) break; - this.stack[i] = beforeLast; - this.stack[i - 1] = map; - } - } else { - for (const [key, value] of map) { - this.map.set(key, value); - } - } - } - - /** - * @param {K} item the key of the element to add - * @param {V} value the value of the element to add - * @returns {void} - */ - set(item, value) { - this.map.set(item, value); - } - - /** - * @param {K} item the item to delete - * @returns {void} - */ - delete(item) { - throw new Error("Items can't be deleted from a StackedCacheMap"); - } - - /** - * @param {K} item the item to test - * @returns {boolean} true if the item exists in this set - */ - has(item) { - throw new Error( - "Checking StackedCacheMap.has before reading is inefficient, use StackedCacheMap.get and check for undefined" - ); +class ErrorObjectSerializer { + constructor(Type) { + this.Type = Type; } - /** - * @param {K} item the key of the element to return - * @returns {V} the value of the element - */ - get(item) { - for (const map of this.stack) { - const value = map.get(item); - if (value !== undefined) return value; - } - return this.map.get(item); + serialize(obj, { write }) { + write(obj.message); + write(obj.stack); } - clear() { - this.stack.length = 0; - this.map.clear(); - } + deserialize({ read }) { + const err = new this.Type(); - get size() { - let size = this.map.size; - for (const map of this.stack) { - size += map.size; - } - return size; - } + err.message = read(); + err.stack = read(); - [Symbol.iterator]() { - const iterators = this.stack.map(map => map[Symbol.iterator]()); - let current = this.map[Symbol.iterator](); - return { - next() { - let result = current.next(); - while (result.done && iterators.length > 0) { - current = iterators.pop(); - result = current.next(); - } - return result; - } - }; + return err; } } -module.exports = StackedCacheMap; +module.exports = ErrorObjectSerializer; /***/ }), -/***/ 58845: -/***/ (function(module) { +/***/ 65321: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const TOMBSTONE = Symbol("tombstone"); -const UNDEFINED_MARKER = Symbol("undefined"); +const { constants } = __webpack_require__(14300); +const { pipeline } = __webpack_require__(12781); +const { + createBrotliCompress, + createBrotliDecompress, + createGzip, + createGunzip, + constants: zConstants +} = __webpack_require__(59796); +const createHash = __webpack_require__(49835); +const { dirname, join, mkdirp } = __webpack_require__(17139); +const memoize = __webpack_require__(78676); +const SerializerMiddleware = __webpack_require__(83137); -/** - * @template T - * @typedef {T | undefined} Cell - */ +/** @typedef {typeof import("../util/Hash")} Hash */ +/** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */ +/** @typedef {import("./types").BufferSerializableType} BufferSerializableType */ -/** - * @template T - * @typedef {T | typeof TOMBSTONE | typeof UNDEFINED_MARKER} InternalCell - */ +/* +Format: + +File -> Header Section* + +Version -> u32 +AmountOfSections -> u32 +SectionSize -> i32 (if less than zero represents lazy value) + +Header -> Version AmountOfSections SectionSize* + +Buffer -> n bytes +Section -> Buffer + +*/ + +// "wpc" + 1 in little-endian +const VERSION = 0x01637077; +const WRITE_LIMIT_TOTAL = 0x7fff0000; +const WRITE_LIMIT_CHUNK = 511 * 1024 * 1024; /** - * @template K - * @template V - * @param {[K, InternalCell]} pair the internal cell - * @returns {[K, Cell]} its “safe” representation + * @param {Buffer[]} buffers buffers + * @param {string | Hash} hashFunction hash function to use + * @returns {string} hash */ -const extractPair = pair => { - const key = pair[0]; - const val = pair[1]; - if (val === UNDEFINED_MARKER || val === TOMBSTONE) { - return [key, undefined]; - } else { - return /** @type {[K, Cell]} */ (pair); - } +const hashForName = (buffers, hashFunction) => { + const hash = createHash(hashFunction); + for (const buf of buffers) hash.update(buf); + return /** @type {string} */ (hash.digest("hex")); }; -/** - * @template K - * @template V - */ -class StackedMap { - /** - * @param {Map>[]=} parentStack an optional parent - */ - constructor(parentStack) { - /** @type {Map>} */ - this.map = new Map(); - /** @type {Map>[]} */ - this.stack = parentStack === undefined ? [] : parentStack.slice(); - this.stack.push(this.map); - } +const COMPRESSION_CHUNK_SIZE = 100 * 1024 * 1024; +const DECOMPRESSION_CHUNK_SIZE = 100 * 1024 * 1024; - /** - * @param {K} item the key of the element to add - * @param {V} value the value of the element to add - * @returns {void} - */ - set(item, value) { - this.map.set(item, value === undefined ? UNDEFINED_MARKER : value); - } +const writeUInt64LE = Buffer.prototype.writeBigUInt64LE + ? (buf, value, offset) => { + buf.writeBigUInt64LE(BigInt(value), offset); + } + : (buf, value, offset) => { + const low = value % 0x100000000; + const high = (value - low) / 0x100000000; + buf.writeUInt32LE(low, offset); + buf.writeUInt32LE(high, offset + 4); + }; - /** - * @param {K} item the item to delete - * @returns {void} - */ - delete(item) { - if (this.stack.length > 1) { - this.map.set(item, TOMBSTONE); - } else { - this.map.delete(item); - } - } +const readUInt64LE = Buffer.prototype.readBigUInt64LE + ? (buf, offset) => { + return Number(buf.readBigUInt64LE(offset)); + } + : (buf, offset) => { + const low = buf.readUInt32LE(offset); + const high = buf.readUInt32LE(offset + 4); + return high * 0x100000000 + low; + }; - /** - * @param {K} item the item to test - * @returns {boolean} true if the item exists in this set - */ - has(item) { - const topValue = this.map.get(item); - if (topValue !== undefined) { - return topValue !== TOMBSTONE; - } - if (this.stack.length > 1) { - for (let i = this.stack.length - 2; i >= 0; i--) { - const value = this.stack[i].get(item); - if (value !== undefined) { - this.map.set(item, value); - return value !== TOMBSTONE; - } - } - this.map.set(item, TOMBSTONE); - } - return false; - } +/** + * @typedef {Object} SerializeResult + * @property {string | false} name + * @property {number} size + * @property {Promise=} backgroundJob + */ - /** - * @param {K} item the key of the element to return - * @returns {Cell} the value of the element - */ - get(item) { - const topValue = this.map.get(item); - if (topValue !== undefined) { - return topValue === TOMBSTONE || topValue === UNDEFINED_MARKER - ? undefined - : topValue; - } - if (this.stack.length > 1) { - for (let i = this.stack.length - 2; i >= 0; i--) { - const value = this.stack[i].get(item); - if (value !== undefined) { - this.map.set(item, value); - return value === TOMBSTONE || value === UNDEFINED_MARKER - ? undefined - : value; - } +/** + * @param {FileMiddleware} middleware this + * @param {BufferSerializableType[] | Promise} data data to be serialized + * @param {string | boolean} name file base name + * @param {function(string | false, Buffer[], number): Promise} writeFile writes a file + * @param {string | Hash} hashFunction hash function to use + * @returns {Promise} resulting file pointer and promise + */ +const serialize = async ( + middleware, + data, + name, + writeFile, + hashFunction = "md4" +) => { + /** @type {(Buffer[] | Buffer | SerializeResult | Promise)[]} */ + const processedData = []; + /** @type {WeakMap>} */ + const resultToLazy = new WeakMap(); + /** @type {Buffer[]} */ + let lastBuffers = undefined; + for (const item of await data) { + if (typeof item === "function") { + if (!SerializerMiddleware.isLazy(item)) + throw new Error("Unexpected function"); + if (!SerializerMiddleware.isLazy(item, middleware)) { + throw new Error( + "Unexpected lazy value with non-this target (can't pass through lazy values)" + ); } - this.map.set(item, TOMBSTONE); - } - return undefined; - } - - _compress() { - if (this.stack.length === 1) return; - this.map = new Map(); - for (const data of this.stack) { - for (const pair of data) { - if (pair[1] === TOMBSTONE) { - this.map.delete(pair[0]); + lastBuffers = undefined; + const serializedInfo = SerializerMiddleware.getLazySerializedValue(item); + if (serializedInfo) { + if (typeof serializedInfo === "function") { + throw new Error( + "Unexpected lazy value with non-this target (can't pass through lazy values)" + ); } else { - this.map.set(pair[0], pair[1]); + processedData.push(serializedInfo); + } + } else { + const content = item(); + if (content) { + const options = SerializerMiddleware.getLazyOptions(item); + processedData.push( + serialize( + middleware, + content, + (options && options.name) || true, + writeFile, + hashFunction + ).then(result => { + /** @type {any} */ (item).options.size = result.size; + resultToLazy.set(result, item); + return result; + }) + ); + } else { + throw new Error( + "Unexpected falsy value returned by lazy value function" + ); } } + } else if (item) { + if (lastBuffers) { + lastBuffers.push(item); + } else { + lastBuffers = [item]; + processedData.push(lastBuffers); + } + } else { + throw new Error("Unexpected falsy value in items array"); } - this.stack = [this.map]; - } - - asArray() { - this._compress(); - return Array.from(this.map.keys()); - } - - asSet() { - this._compress(); - return new Set(this.map.keys()); - } - - asPairArray() { - this._compress(); - return Array.from(this.map.entries(), extractPair); } + /** @type {Promise[]} */ + const backgroundJobs = []; + const resolvedData = ( + await Promise.all( + /** @type {Promise[]} */ ( + processedData + ) + ) + ).map(item => { + if (Array.isArray(item) || Buffer.isBuffer(item)) return item; - asMap() { - return new Map(this.asPairArray()); + backgroundJobs.push(item.backgroundJob); + // create pointer buffer from size and name + const name = /** @type {string} */ (item.name); + const nameBuffer = Buffer.from(name); + const buf = Buffer.allocUnsafe(8 + nameBuffer.length); + writeUInt64LE(buf, item.size, 0); + nameBuffer.copy(buf, 8, 0); + const lazy = resultToLazy.get(item); + SerializerMiddleware.setLazySerializedValue(lazy, buf); + return buf; + }); + const lengths = []; + for (const item of resolvedData) { + if (Array.isArray(item)) { + let l = 0; + for (const b of item) l += b.length; + while (l > 0x7fffffff) { + lengths.push(0x7fffffff); + l -= 0x7fffffff; + } + lengths.push(l); + } else if (item) { + lengths.push(-item.length); + } else { + throw new Error("Unexpected falsy value in resolved data " + item); + } } - - get size() { - this._compress(); - return this.map.size; + const header = Buffer.allocUnsafe(8 + lengths.length * 4); + header.writeUInt32LE(VERSION, 0); + header.writeUInt32LE(lengths.length, 4); + for (let i = 0; i < lengths.length; i++) { + header.writeInt32LE(lengths[i], 8 + i * 4); } - - createChild() { - return new StackedMap(this.stack); + const buf = [header]; + for (const item of resolvedData) { + if (Array.isArray(item)) { + for (const b of item) buf.push(b); + } else if (item) { + buf.push(item); + } } -} - -module.exports = StackedMap; - - -/***/ }), - -/***/ 40293: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -class StringXor { - constructor() { - this._value = undefined; + if (name === true) { + name = hashForName(buf, hashFunction); } + let size = 0; + for (const b of buf) size += b.length; + backgroundJobs.push(writeFile(name, buf, size)); + return { + size, + name, + backgroundJob: + backgroundJobs.length === 1 + ? backgroundJobs[0] + : Promise.all(backgroundJobs) + }; +}; - /** - * @param {string} str string - * @returns {void} - */ - add(str) { - const len = str.length; - const value = this._value; - if (value === undefined) { - const newValue = (this._value = Buffer.allocUnsafe(len)); - for (let i = 0; i < len; i++) { - newValue[i] = str.charCodeAt(i); +/** + * @param {FileMiddleware} middleware this + * @param {string | false} name filename + * @param {function(string | false): Promise} readFile read content of a file + * @returns {Promise} deserialized data + */ +const deserialize = async (middleware, name, readFile) => { + const contents = await readFile(name); + if (contents.length === 0) throw new Error("Empty file " + name); + let contentsIndex = 0; + let contentItem = contents[0]; + let contentItemLength = contentItem.length; + let contentPosition = 0; + if (contentItemLength === 0) throw new Error("Empty file " + name); + const nextContent = () => { + contentsIndex++; + contentItem = contents[contentsIndex]; + contentItemLength = contentItem.length; + contentPosition = 0; + }; + const ensureData = n => { + if (contentPosition === contentItemLength) { + nextContent(); + } + while (contentItemLength - contentPosition < n) { + const remaining = contentItem.slice(contentPosition); + let lengthFromNext = n - remaining.length; + const buffers = [remaining]; + for (let i = contentsIndex + 1; i < contents.length; i++) { + const l = contents[i].length; + if (l > lengthFromNext) { + buffers.push(contents[i].slice(0, lengthFromNext)); + contents[i] = contents[i].slice(lengthFromNext); + lengthFromNext = 0; + break; + } else { + buffers.push(contents[i]); + contentsIndex = i; + lengthFromNext -= l; + } } - return; + if (lengthFromNext > 0) throw new Error("Unexpected end of data"); + contentItem = Buffer.concat(buffers, n); + contentItemLength = n; + contentPosition = 0; } - const valueLen = value.length; - if (valueLen < len) { - const newValue = (this._value = Buffer.allocUnsafe(len)); - let i; - for (i = 0; i < valueLen; i++) { - newValue[i] = value[i] ^ str.charCodeAt(i); + }; + const readUInt32LE = () => { + ensureData(4); + const value = contentItem.readUInt32LE(contentPosition); + contentPosition += 4; + return value; + }; + const readInt32LE = () => { + ensureData(4); + const value = contentItem.readInt32LE(contentPosition); + contentPosition += 4; + return value; + }; + const readSlice = l => { + ensureData(l); + if (contentPosition === 0 && contentItemLength === l) { + const result = contentItem; + if (contentsIndex + 1 < contents.length) { + nextContent(); + } else { + contentPosition = l; } - for (; i < len; i++) { - newValue[i] = str.charCodeAt(i); + return result; + } + const result = contentItem.slice(contentPosition, contentPosition + l); + contentPosition += l; + // we clone the buffer here to allow the original content to be garbage collected + return l * 2 < contentItem.buffer.byteLength ? Buffer.from(result) : result; + }; + const version = readUInt32LE(); + if (version !== VERSION) { + throw new Error("Invalid file version"); + } + const sectionCount = readUInt32LE(); + const lengths = []; + let lastLengthPositive = false; + for (let i = 0; i < sectionCount; i++) { + const value = readInt32LE(); + const valuePositive = value >= 0; + if (lastLengthPositive && valuePositive) { + lengths[lengths.length - 1] += value; + } else { + lengths.push(value); + lastLengthPositive = valuePositive; + } + } + const result = []; + for (let length of lengths) { + if (length < 0) { + const slice = readSlice(-length); + const size = Number(readUInt64LE(slice, 0)); + const nameBuffer = slice.slice(8); + const name = nameBuffer.toString(); + result.push( + SerializerMiddleware.createLazy( + memoize(() => deserialize(middleware, name, readFile)), + middleware, + { + name, + size + }, + slice + ) + ); + } else { + if (contentPosition === contentItemLength) { + nextContent(); + } else if (contentPosition !== 0) { + if (length <= contentItemLength - contentPosition) { + result.push( + Buffer.from( + contentItem.buffer, + contentItem.byteOffset + contentPosition, + length + ) + ); + contentPosition += length; + length = 0; + } else { + const l = contentItemLength - contentPosition; + result.push( + Buffer.from( + contentItem.buffer, + contentItem.byteOffset + contentPosition, + l + ) + ); + length -= l; + contentPosition = contentItemLength; + } + } else { + if (length >= contentItemLength) { + result.push(contentItem); + length -= contentItemLength; + contentPosition = contentItemLength; + } else { + result.push( + Buffer.from(contentItem.buffer, contentItem.byteOffset, length) + ); + contentPosition += length; + length = 0; + } } - } else { - for (let i = 0; i < len; i++) { - value[i] = value[i] ^ str.charCodeAt(i); + while (length > 0) { + nextContent(); + if (length >= contentItemLength) { + result.push(contentItem); + length -= contentItemLength; + contentPosition = contentItemLength; + } else { + result.push( + Buffer.from(contentItem.buffer, contentItem.byteOffset, length) + ); + contentPosition += length; + length = 0; + } } } } + return result; +}; - toString() { - const value = this._value; - return value === undefined ? "" : value.toString("latin1"); - } - - updateHash(hash) { - const value = this._value; - if (value !== undefined) hash.update(value); +/** + * @typedef {BufferSerializableType[]} DeserializedType + * @typedef {true} SerializedType + * @extends {SerializerMiddleware} + */ +class FileMiddleware extends SerializerMiddleware { + /** + * @param {IntermediateFileSystem} fs filesystem + * @param {string | Hash} hashFunction hash function to use + */ + constructor(fs, hashFunction = "md4") { + super(); + this.fs = fs; + this._hashFunction = hashFunction; } -} - -module.exports = StringXor; - - -/***/ }), + /** + * @param {DeserializedType} data data + * @param {Object} context context object + * @returns {SerializedType|Promise} serialized data + */ + serialize(data, context) { + const { filename, extension = "" } = context; + return new Promise((resolve, reject) => { + mkdirp(this.fs, dirname(this.fs, filename), err => { + if (err) return reject(err); -/***/ 38415: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // It's important that we don't touch existing files during serialization + // because serialize may read existing files (when deserializing) + const allWrittenFiles = new Set(); + const writeFile = async (name, content, size) => { + const file = name + ? join(this.fs, filename, `../${name}${extension}`) + : filename; + await new Promise((resolve, reject) => { + let stream = this.fs.createWriteStream(file + "_"); + let compression; + if (file.endsWith(".gz")) { + compression = createGzip({ + chunkSize: COMPRESSION_CHUNK_SIZE, + level: zConstants.Z_BEST_SPEED + }); + } else if (file.endsWith(".br")) { + compression = createBrotliCompress({ + chunkSize: COMPRESSION_CHUNK_SIZE, + params: { + [zConstants.BROTLI_PARAM_MODE]: zConstants.BROTLI_MODE_TEXT, + [zConstants.BROTLI_PARAM_QUALITY]: 2, + [zConstants.BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING]: true, + [zConstants.BROTLI_PARAM_SIZE_HINT]: size + } + }); + } + if (compression) { + pipeline(compression, stream, reject); + stream = compression; + stream.on("finish", () => resolve()); + } else { + stream.on("error", err => reject(err)); + stream.on("finish", () => resolve()); + } + // split into chunks for WRITE_LIMIT_CHUNK size + const chunks = []; + for (const b of content) { + if (b.length < WRITE_LIMIT_CHUNK) { + chunks.push(b); + } else { + for (let i = 0; i < b.length; i += WRITE_LIMIT_CHUNK) { + chunks.push(b.slice(i, i + WRITE_LIMIT_CHUNK)); + } + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const len = chunks.length; + let i = 0; + const batchWrite = err => { + // will be handled in "on" error handler + if (err) return; + if (i === len) { + stream.end(); + return; + } + // queue up a batch of chunks up to the write limit + // end is exclusive + let end = i; + let sum = chunks[end++].length; + while (end < len) { + sum += chunks[end].length; + if (sum > WRITE_LIMIT_TOTAL) break; + end++; + } + while (i < end - 1) { + stream.write(chunks[i++]); + } + stream.write(chunks[i++], batchWrite); + }; + batchWrite(); + }); + if (name) allWrittenFiles.add(file); + }; -const TupleSet = __webpack_require__(76455); + resolve( + serialize(this, data, false, writeFile, this._hashFunction).then( + async ({ backgroundJob }) => { + await backgroundJob; -/** - * @template {any[]} T - */ -class TupleQueue { - /** - * @param {Iterable=} items The initial elements. - */ - constructor(items) { - /** @private @type {TupleSet} */ - this._set = new TupleSet(items); - /** @private @type {Iterator} */ - this._iterator = this._set[Symbol.iterator](); - } + // Rename the index file to disallow access during inconsistent file state + await new Promise(resolve => + this.fs.rename(filename, filename + ".old", err => { + resolve(); + }) + ); - /** - * Returns the number of elements in this queue. - * @returns {number} The number of elements in this queue. - */ - get length() { - return this._set.size; - } + // update all written files + await Promise.all( + Array.from( + allWrittenFiles, + file => + new Promise((resolve, reject) => { + this.fs.rename(file + "_", file, err => { + if (err) return reject(err); + resolve(); + }); + }) + ) + ); - /** - * Appends the specified element to this queue. - * @param {T} item The element to add. - * @returns {void} - */ - enqueue(...item) { - this._set.add(...item); + // As final step automatically update the index file to have a consistent pack again + await new Promise(resolve => { + this.fs.rename(filename + "_", filename, err => { + if (err) return reject(err); + resolve(); + }); + }); + return /** @type {true} */ (true); + } + ) + ); + }); + }); } /** - * Retrieves and removes the head of this queue. - * @returns {T | undefined} The head of the queue of `undefined` if this queue is empty. + * @param {SerializedType} data data + * @param {Object} context context object + * @returns {DeserializedType|Promise} deserialized data */ - dequeue() { - const result = this._iterator.next(); - if (result.done) { - if (this._set.size > 0) { - this._iterator = this._set[Symbol.iterator](); - const value = this._iterator.next().value; - this._set.delete(...value); - return value; - } - return undefined; - } - this._set.delete(...result.value); - return result.value; + deserialize(data, context) { + const { filename, extension = "" } = context; + const readFile = name => + new Promise((resolve, reject) => { + const file = name + ? join(this.fs, filename, `../${name}${extension}`) + : filename; + this.fs.stat(file, (err, stats) => { + if (err) { + reject(err); + return; + } + let remaining = /** @type {number} */ (stats.size); + let currentBuffer; + let currentBufferUsed; + const buf = []; + let decompression; + if (file.endsWith(".gz")) { + decompression = createGunzip({ + chunkSize: DECOMPRESSION_CHUNK_SIZE + }); + } else if (file.endsWith(".br")) { + decompression = createBrotliDecompress({ + chunkSize: DECOMPRESSION_CHUNK_SIZE + }); + } + if (decompression) { + let newResolve, newReject; + resolve( + Promise.all([ + new Promise((rs, rj) => { + newResolve = rs; + newReject = rj; + }), + new Promise((resolve, reject) => { + decompression.on("data", chunk => buf.push(chunk)); + decompression.on("end", () => resolve()); + decompression.on("error", err => reject(err)); + }) + ]).then(() => buf) + ); + resolve = newResolve; + reject = newReject; + } + this.fs.open(file, "r", (err, fd) => { + if (err) { + reject(err); + return; + } + const read = () => { + if (currentBuffer === undefined) { + currentBuffer = Buffer.allocUnsafeSlow( + Math.min( + constants.MAX_LENGTH, + remaining, + decompression ? DECOMPRESSION_CHUNK_SIZE : Infinity + ) + ); + currentBufferUsed = 0; + } + let readBuffer = currentBuffer; + let readOffset = currentBufferUsed; + let readLength = currentBuffer.length - currentBufferUsed; + // values passed to fs.read must be valid int32 values + if (readOffset > 0x7fffffff) { + readBuffer = currentBuffer.slice(readOffset); + readOffset = 0; + } + if (readLength > 0x7fffffff) { + readLength = 0x7fffffff; + } + this.fs.read( + fd, + readBuffer, + readOffset, + readLength, + null, + (err, bytesRead) => { + if (err) { + this.fs.close(fd, () => { + reject(err); + }); + return; + } + currentBufferUsed += bytesRead; + remaining -= bytesRead; + if (currentBufferUsed === currentBuffer.length) { + if (decompression) { + decompression.write(currentBuffer); + } else { + buf.push(currentBuffer); + } + currentBuffer = undefined; + if (remaining === 0) { + if (decompression) { + decompression.end(); + } + this.fs.close(fd, err => { + if (err) { + reject(err); + return; + } + resolve(buf); + }); + return; + } + } + read(); + } + ); + }; + read(); + }); + }); + }); + return deserialize(this, false, readFile); } } -module.exports = TupleQueue; +module.exports = FileMiddleware; /***/ }), -/***/ 76455: +/***/ 86791: /***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -/** - * @template {any[]} T - */ -class TupleSet { - constructor(init) { - this._map = new Map(); - this.size = 0; - if (init) { - for (const tuple of init) { - this.add(...tuple); - } - } - } - - /** - * @param {T} args tuple - * @returns {void} - */ - add(...args) { - let map = this._map; - for (let i = 0; i < args.length - 2; i++) { - const arg = args[i]; - const innerMap = map.get(arg); - if (innerMap === undefined) { - map.set(arg, (map = new Map())); - } else { - map = innerMap; - } +class MapObjectSerializer { + serialize(obj, { write }) { + write(obj.size); + for (const key of obj.keys()) { + write(key); } - - const beforeLast = args[args.length - 2]; - let set = map.get(beforeLast); - if (set === undefined) { - map.set(beforeLast, (set = new Set())); + for (const value of obj.values()) { + write(value); } - - const last = args[args.length - 1]; - this.size -= set.size; - set.add(last); - this.size += set.size; } - - /** - * @param {T} args tuple - * @returns {boolean} true, if the tuple is in the Set - */ - has(...args) { - let map = this._map; - for (let i = 0; i < args.length - 2; i++) { - const arg = args[i]; - map = map.get(arg); - if (map === undefined) { - return false; - } + deserialize({ read }) { + let size = read(); + const map = new Map(); + const keys = []; + for (let i = 0; i < size; i++) { + keys.push(read()); } - - const beforeLast = args[args.length - 2]; - let set = map.get(beforeLast); - if (set === undefined) { - return false; + for (let i = 0; i < size; i++) { + map.set(keys[i], read()); } - - const last = args[args.length - 1]; - return set.has(last); + return map; } +} - /** - * @param {T} args tuple - * @returns {void} - */ - delete(...args) { - let map = this._map; - for (let i = 0; i < args.length - 2; i++) { - const arg = args[i]; - map = map.get(arg); - if (map === undefined) { - return; - } - } +module.exports = MapObjectSerializer; - const beforeLast = args[args.length - 2]; - let set = map.get(beforeLast); - if (set === undefined) { - return; - } - const last = args[args.length - 1]; - this.size -= set.size; - set.delete(last); - this.size += set.size; - } +/***/ }), - /** - * @returns {Iterator} iterator - */ - [Symbol.iterator]() { - const iteratorStack = []; - const tuple = []; - let currentSetIterator = undefined; +/***/ 21048: +/***/ (function(module) { - const next = it => { - const result = it.next(); - if (result.done) { - if (iteratorStack.length === 0) return false; - tuple.pop(); - return next(iteratorStack.pop()); - } - const [key, value] = result.value; - iteratorStack.push(it); - tuple.push(key); - if (value instanceof Set) { - currentSetIterator = value[Symbol.iterator](); - return true; - } else { - return next(value[Symbol.iterator]()); - } - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ - next(this._map[Symbol.iterator]()); - return { - next() { - while (currentSetIterator) { - const result = currentSetIterator.next(); - if (result.done) { - tuple.pop(); - if (!next(iteratorStack.pop())) { - currentSetIterator = undefined; - } - } else { - return { - done: false, - value: /** @type {T} */ (tuple.concat(result.value)) - }; - } - } - return { done: true, value: undefined }; - } - }; + +class NullPrototypeObjectSerializer { + serialize(obj, { write }) { + const keys = Object.keys(obj); + for (const key of keys) { + write(key); + } + write(null); + for (const key of keys) { + write(obj[key]); + } + } + deserialize({ read }) { + const obj = Object.create(null); + const keys = []; + let key = read(); + while (key !== null) { + keys.push(key); + key = read(); + } + for (const key of keys) { + obj[key] = read(); + } + return obj; } } -module.exports = TupleSet; +module.exports = NullPrototypeObjectSerializer; /***/ }), -/***/ 54500: -/***/ (function(__unused_webpack_module, exports) { +/***/ 34795: +/***/ (function(module, exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop */ -/** @typedef {import("./fs").InputFileSystem} InputFileSystem */ -/** @typedef {(error: Error|null, result?: Buffer) => void} ErrorFirstCallback */ +const createHash = __webpack_require__(49835); +const ArraySerializer = __webpack_require__(41721); +const DateObjectSerializer = __webpack_require__(93475); +const ErrorObjectSerializer = __webpack_require__(79479); +const MapObjectSerializer = __webpack_require__(86791); +const NullPrototypeObjectSerializer = __webpack_require__(21048); +const PlainObjectSerializer = __webpack_require__(33040); +const RegExpObjectSerializer = __webpack_require__(57328); +const SerializerMiddleware = __webpack_require__(83137); +const SetObjectSerializer = __webpack_require__(79240); + +/** @typedef {typeof import("../util/Hash")} Hash */ +/** @typedef {import("./types").ComplexSerializableType} ComplexSerializableType */ +/** @typedef {import("./types").PrimitiveSerializableType} PrimitiveSerializableType */ + +/** @typedef {new (...params: any[]) => any} Constructor */ + +/* + +Format: + +File -> Section* +Section -> ObjectSection | ReferenceSection | EscapeSection | OtherSection + +ObjectSection -> ESCAPE ( + number:relativeOffset (number > 0) | + string:request (string|null):export +) Section:value* ESCAPE ESCAPE_END_OBJECT +ReferenceSection -> ESCAPE number:relativeOffset (number < 0) +EscapeSection -> ESCAPE ESCAPE_ESCAPE_VALUE (escaped value ESCAPE) +EscapeSection -> ESCAPE ESCAPE_UNDEFINED (escaped value ESCAPE) +OtherSection -> any (except ESCAPE) + +Why using null as escape value? +Multiple null values can merged by the BinaryMiddleware, which makes it very efficient +Technically any value can be used. + +*/ -const backSlashCharCode = "\\".charCodeAt(0); -const slashCharCode = "/".charCodeAt(0); -const aLowerCaseCharCode = "a".charCodeAt(0); -const zLowerCaseCharCode = "z".charCodeAt(0); -const aUpperCaseCharCode = "A".charCodeAt(0); -const zUpperCaseCharCode = "Z".charCodeAt(0); -const _0CharCode = "0".charCodeAt(0); -const _9CharCode = "9".charCodeAt(0); -const plusCharCode = "+".charCodeAt(0); -const hyphenCharCode = "-".charCodeAt(0); -const colonCharCode = ":".charCodeAt(0); -const hashCharCode = "#".charCodeAt(0); -const queryCharCode = "?".charCodeAt(0); /** - * Get scheme if specifier is an absolute URL specifier - * e.g. Absolute specifiers like 'file:///user/webpack/index.js' - * https://tools.ietf.org/html/rfc3986#section-3.1 - * @param {string} specifier specifier - * @returns {string|undefined} scheme if absolute URL specifier provided + * @typedef {Object} ObjectSerializerContext + * @property {function(any): void} write */ -function getScheme(specifier) { - const start = specifier.charCodeAt(0); - // First char maybe only a letter - if ( - (start < aLowerCaseCharCode || start > zLowerCaseCharCode) && - (start < aUpperCaseCharCode || start > zUpperCaseCharCode) - ) { - return undefined; - } +/** + * @typedef {Object} ObjectDeserializerContext + * @property {function(): any} read + */ - let i = 1; - let ch = specifier.charCodeAt(i); +/** + * @typedef {Object} ObjectSerializer + * @property {function(any, ObjectSerializerContext): void} serialize + * @property {function(ObjectDeserializerContext): any} deserialize + */ - while ( - (ch >= aLowerCaseCharCode && ch <= zLowerCaseCharCode) || - (ch >= aUpperCaseCharCode && ch <= zUpperCaseCharCode) || - (ch >= _0CharCode && ch <= _9CharCode) || - ch === plusCharCode || - ch === hyphenCharCode - ) { - if (++i === specifier.length) return undefined; - ch = specifier.charCodeAt(i); +const setSetSize = (set, size) => { + let i = 0; + for (const item of set) { + if (i++ >= size) { + set.delete(item); + } } +}; - // Scheme must end with colon - if (ch !== colonCharCode) return undefined; - - // Check for Windows absolute path - // https://url.spec.whatwg.org/#url-miscellaneous - if (i === 1) { - const nextChar = i + 1 < specifier.length ? specifier.charCodeAt(i + 1) : 0; - if ( - nextChar === 0 || - nextChar === backSlashCharCode || - nextChar === slashCharCode || - nextChar === hashCharCode || - nextChar === queryCharCode - ) { - return undefined; +const setMapSize = (map, size) => { + let i = 0; + for (const item of map.keys()) { + if (i++ >= size) { + map.delete(item); } } - - return specifier.slice(0, i).toLowerCase(); -} +}; /** - * @param {string} specifier specifier - * @returns {string|null} protocol if absolute URL specifier provided + * @param {Buffer} buffer buffer + * @param {string | Hash} hashFunction hash function to use + * @returns {string} hash */ -function getProtocol(specifier) { - const scheme = getScheme(specifier); - return scheme === undefined ? undefined : scheme + ":"; -} +const toHash = (buffer, hashFunction) => { + const hash = createHash(hashFunction); + hash.update(buffer); + return /** @type {string} */ (hash.digest("latin1")); +}; -exports.getScheme = getScheme; -exports.getProtocol = getProtocol; +const ESCAPE = null; +const ESCAPE_ESCAPE_VALUE = null; +const ESCAPE_END_OBJECT = true; +const ESCAPE_UNDEFINED = false; +const CURRENT_VERSION = 2; -/***/ }), +const serializers = new Map(); +const serializerInversed = new Map(); -/***/ 28745: -/***/ (function(module) { +const loadedRequests = new Set(); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +const NOT_SERIALIZABLE = {}; + +const jsTypes = new Map(); +jsTypes.set(Object, new PlainObjectSerializer()); +jsTypes.set(Array, new ArraySerializer()); +jsTypes.set(null, new NullPrototypeObjectSerializer()); +jsTypes.set(Map, new MapObjectSerializer()); +jsTypes.set(Set, new SetObjectSerializer()); +jsTypes.set(Date, new DateObjectSerializer()); +jsTypes.set(RegExp, new RegExpObjectSerializer()); +jsTypes.set(Error, new ErrorObjectSerializer(Error)); +jsTypes.set(EvalError, new ErrorObjectSerializer(EvalError)); +jsTypes.set(RangeError, new ErrorObjectSerializer(RangeError)); +jsTypes.set(ReferenceError, new ErrorObjectSerializer(ReferenceError)); +jsTypes.set(SyntaxError, new ErrorObjectSerializer(SyntaxError)); +jsTypes.set(TypeError, new ErrorObjectSerializer(TypeError)); + +// If in a sandboxed environment (e. g. jest), this escapes the sandbox and registers +// real Object and Array types to. These types may occur in the wild too, e. g. when +// using Structured Clone in postMessage. +if (exports.constructor !== Object) { + const Obj = /** @type {typeof Object} */ (exports.constructor); + const Fn = /** @type {typeof Function} */ (Obj.constructor); + for (const [type, config] of Array.from(jsTypes)) { + if (type) { + const Type = new Fn(`return ${type.name};`)(); + jsTypes.set(Type, config); + } + } +} +{ + let i = 1; + for (const [type, serializer] of jsTypes) { + serializers.set(type, { + request: "", + name: i++, + serializer + }); + } +} +for (const { request, name, serializer } of serializers.values()) { + serializerInversed.set(`${request}/${name}`, serializer); +} -const isWeakKey = thing => typeof thing === "object" && thing !== null; +/** @type {Map boolean>} */ +const loaders = new Map(); /** - * @template {any[]} T - * @template V + * @typedef {ComplexSerializableType[]} DeserializedType + * @typedef {PrimitiveSerializableType[]} SerializedType + * @extends {SerializerMiddleware} */ -class WeakTupleMap { - constructor() { - /** @private */ - this.f = 0; - /** @private @type {any} */ - this.v = undefined; - /** @private @type {Map> | undefined} */ - this.m = undefined; - /** @private @type {WeakMap> | undefined} */ - this.w = undefined; - } - +class ObjectMiddleware extends SerializerMiddleware { /** - * @param {[...T, V]} args tuple - * @returns {void} + * @param {function(any): void} extendContext context extensions + * @param {string | Hash} hashFunction hash function to use */ - set(...args) { - /** @type {WeakTupleMap} */ - let node = this; - for (let i = 0; i < args.length - 1; i++) { - node = node._get(args[i]); - } - node._setValue(args[args.length - 1]); + constructor(extendContext, hashFunction = "md4") { + super(); + this.extendContext = extendContext; + this._hashFunction = hashFunction; } - /** - * @param {T} args tuple - * @returns {boolean} true, if the tuple is in the Set + * @param {RegExp} regExp RegExp for which the request is tested + * @param {function(string): boolean} loader loader to load the request, returns true when successful + * @returns {void} */ - has(...args) { - /** @type {WeakTupleMap} */ - let node = this; - for (let i = 0; i < args.length; i++) { - node = node._peek(args[i]); - if (node === undefined) return false; - } - return node._hasValue(); + static registerLoader(regExp, loader) { + loaders.set(regExp, loader); } /** - * @param {T} args tuple - * @returns {V} the value + * @param {Constructor} Constructor the constructor + * @param {string} request the request which will be required when deserializing + * @param {string} name the name to make multiple serializer unique when sharing a request + * @param {ObjectSerializer} serializer the serializer + * @returns {void} */ - get(...args) { - /** @type {WeakTupleMap} */ - let node = this; - for (let i = 0; i < args.length; i++) { - node = node._peek(args[i]); - if (node === undefined) return undefined; + static register(Constructor, request, name, serializer) { + const key = request + "/" + name; + + if (serializers.has(Constructor)) { + throw new Error( + `ObjectMiddleware.register: serializer for ${Constructor.name} is already registered` + ); } - return node._getValue(); - } - /** - * @param {[...T, function(): V]} args tuple - * @returns {V} the value - */ - provide(...args) { - /** @type {WeakTupleMap} */ - let node = this; - for (let i = 0; i < args.length - 1; i++) { - node = node._get(args[i]); + if (serializerInversed.has(key)) { + throw new Error( + `ObjectMiddleware.register: serializer for ${key} is already registered` + ); } - if (node._hasValue()) return node._getValue(); - const fn = args[args.length - 1]; - const newValue = fn(...args.slice(0, -1)); - node._setValue(newValue); - return newValue; + + serializers.set(Constructor, { + request, + name, + serializer + }); + + serializerInversed.set(key, serializer); } /** - * @param {T} args tuple + * @param {Constructor} Constructor the constructor * @returns {void} */ - delete(...args) { - /** @type {WeakTupleMap} */ - let node = this; - for (let i = 0; i < args.length; i++) { - node = node._peek(args[i]); - if (node === undefined) return; + static registerNotSerializable(Constructor) { + if (serializers.has(Constructor)) { + throw new Error( + `ObjectMiddleware.registerNotSerializable: serializer for ${Constructor.name} is already registered` + ); } - node._deleteValue(); - } - /** - * @returns {void} - */ - clear() { - this.f = 0; - this.v = undefined; - this.w = undefined; - this.m = undefined; + serializers.set(Constructor, NOT_SERIALIZABLE); } - _getValue() { - return this.v; + static getSerializerFor(object) { + const proto = Object.getPrototypeOf(object); + let c; + if (proto === null) { + // Object created with Object.create(null) + c = null; + } else { + c = proto.constructor; + if (!c) { + throw new Error( + "Serialization of objects with prototype without valid constructor property not possible" + ); + } + } + const config = serializers.get(c); + + if (!config) throw new Error(`No serializer registered for ${c.name}`); + if (config === NOT_SERIALIZABLE) throw NOT_SERIALIZABLE; + + return config; } - _hasValue() { - return (this.f & 1) === 1; + static getDeserializerFor(request, name) { + const key = request + "/" + name; + const serializer = serializerInversed.get(key); + + if (serializer === undefined) { + throw new Error(`No deserializer registered for ${key}`); + } + + return serializer; } - _setValue(v) { - this.f |= 1; - this.v = v; + static _getDeserializerForWithoutError(request, name) { + const key = request + "/" + name; + const serializer = serializerInversed.get(key); + return serializer; } - _deleteValue() { - this.f &= 6; - this.v = undefined; - } + /** + * @param {DeserializedType} data data + * @param {Object} context context object + * @returns {SerializedType|Promise} serialized data + */ + serialize(data, context) { + /** @type {any[]} */ + let result = [CURRENT_VERSION]; + let currentPos = 0; + let referenceable = new Map(); + const addReferenceable = item => { + referenceable.set(item, currentPos++); + }; + let bufferDedupeMap = new Map(); + const dedupeBuffer = buf => { + const len = buf.length; + const entry = bufferDedupeMap.get(len); + if (entry === undefined) { + bufferDedupeMap.set(len, buf); + return buf; + } + if (Buffer.isBuffer(entry)) { + if (len < 32) { + if (buf.equals(entry)) { + return entry; + } + bufferDedupeMap.set(len, [entry, buf]); + return buf; + } else { + const hash = toHash(entry, this._hashFunction); + const newMap = new Map(); + newMap.set(hash, entry); + bufferDedupeMap.set(len, newMap); + const hashBuf = toHash(buf, this._hashFunction); + if (hash === hashBuf) { + return entry; + } + return buf; + } + } else if (Array.isArray(entry)) { + if (entry.length < 16) { + for (const item of entry) { + if (buf.equals(item)) { + return item; + } + } + entry.push(buf); + return buf; + } else { + const newMap = new Map(); + const hash = toHash(buf, this._hashFunction); + let found; + for (const item of entry) { + const itemHash = toHash(item, this._hashFunction); + newMap.set(itemHash, item); + if (found === undefined && itemHash === hash) found = item; + } + bufferDedupeMap.set(len, newMap); + if (found === undefined) { + newMap.set(hash, buf); + return buf; + } else { + return found; + } + } + } else { + const hash = toHash(buf, this._hashFunction); + const item = entry.get(hash); + if (item !== undefined) { + return item; + } + entry.set(hash, buf); + return buf; + } + }; + let currentPosTypeLookup = 0; + let objectTypeLookup = new Map(); + const cycleStack = new Set(); + const stackToString = item => { + const arr = Array.from(cycleStack); + arr.push(item); + return arr + .map(item => { + if (typeof item === "string") { + if (item.length > 100) { + return `String ${JSON.stringify(item.slice(0, 100)).slice( + 0, + -1 + )}..."`; + } + return `String ${JSON.stringify(item)}`; + } + try { + const { request, name } = ObjectMiddleware.getSerializerFor(item); + if (request) { + return `${request}${name ? `.${name}` : ""}`; + } + } catch (e) { + // ignore -> fallback + } + if (typeof item === "object" && item !== null) { + if (item.constructor) { + if (item.constructor === Object) + return `Object { ${Object.keys(item).join(", ")} }`; + if (item.constructor === Map) return `Map { ${item.size} items }`; + if (item.constructor === Array) + return `Array { ${item.length} items }`; + if (item.constructor === Set) return `Set { ${item.size} items }`; + if (item.constructor === RegExp) return item.toString(); + return `${item.constructor.name}`; + } + return `Object [null prototype] { ${Object.keys(item).join( + ", " + )} }`; + } + try { + return `${item}`; + } catch (e) { + return `(${e.message})`; + } + }) + .join(" -> "); + }; + let hasDebugInfoAttached; + let ctx = { + write(value, key) { + try { + process(value); + } catch (e) { + if (e !== NOT_SERIALIZABLE) { + if (hasDebugInfoAttached === undefined) + hasDebugInfoAttached = new WeakSet(); + if (!hasDebugInfoAttached.has(e)) { + e.message += `\nwhile serializing ${stackToString(value)}`; + hasDebugInfoAttached.add(e); + } + } + throw e; + } + }, + setCircularReference(ref) { + addReferenceable(ref); + }, + snapshot() { + return { + length: result.length, + cycleStackSize: cycleStack.size, + referenceableSize: referenceable.size, + currentPos, + objectTypeLookupSize: objectTypeLookup.size, + currentPosTypeLookup + }; + }, + rollback(snapshot) { + result.length = snapshot.length; + setSetSize(cycleStack, snapshot.cycleStackSize); + setMapSize(referenceable, snapshot.referenceableSize); + currentPos = snapshot.currentPos; + setMapSize(objectTypeLookup, snapshot.objectTypeLookupSize); + currentPosTypeLookup = snapshot.currentPosTypeLookup; + }, + ...context + }; + this.extendContext(ctx); + const process = item => { + if (Buffer.isBuffer(item)) { + // check if we can emit a reference + const ref = referenceable.get(item); + if (ref !== undefined) { + result.push(ESCAPE, ref - currentPos); + return; + } + const alreadyUsedBuffer = dedupeBuffer(item); + if (alreadyUsedBuffer !== item) { + const ref = referenceable.get(alreadyUsedBuffer); + if (ref !== undefined) { + referenceable.set(item, ref); + result.push(ESCAPE, ref - currentPos); + return; + } + item = alreadyUsedBuffer; + } + addReferenceable(item); + + result.push(item); + } else if (item === ESCAPE) { + result.push(ESCAPE, ESCAPE_ESCAPE_VALUE); + } else if ( + typeof item === "object" + // We don't have to check for null as ESCAPE is null and this has been checked before + ) { + // check if we can emit a reference + const ref = referenceable.get(item); + if (ref !== undefined) { + result.push(ESCAPE, ref - currentPos); + return; + } - _peek(thing) { - if (isWeakKey(thing)) { - if ((this.f & 4) !== 4) return undefined; - return this.w.get(thing); - } else { - if ((this.f & 2) !== 2) return undefined; - return this.m.get(thing); - } - } + if (cycleStack.has(item)) { + throw new Error( + `This is a circular references. To serialize circular references use 'setCircularReference' somewhere in the circle during serialize and deserialize.` + ); + } - _get(thing) { - if (isWeakKey(thing)) { - if ((this.f & 4) !== 4) { - const newMap = new WeakMap(); - this.f |= 4; - const newNode = new WeakTupleMap(); - (this.w = newMap).set(thing, newNode); - return newNode; - } - const entry = this.w.get(thing); - if (entry !== undefined) { - return entry; - } - const newNode = new WeakTupleMap(); - this.w.set(thing, newNode); - return newNode; - } else { - if ((this.f & 2) !== 2) { - const newMap = new Map(); - this.f |= 2; - const newNode = new WeakTupleMap(); - (this.m = newMap).set(thing, newNode); - return newNode; - } - const entry = this.m.get(thing); - if (entry !== undefined) { - return entry; - } - const newNode = new WeakTupleMap(); - this.m.set(thing, newNode); - return newNode; - } - } -} + const { request, name, serializer } = + ObjectMiddleware.getSerializerFor(item); + const key = `${request}/${name}`; + const lastIndex = objectTypeLookup.get(key); -module.exports = WeakTupleMap; + if (lastIndex === undefined) { + objectTypeLookup.set(key, currentPosTypeLookup++); + result.push(ESCAPE, request, name); + } else { + result.push(ESCAPE, currentPosTypeLookup - lastIndex); + } -/***/ }), + cycleStack.add(item); -/***/ 92229: -/***/ (function(module) { + try { + serializer.serialize(item, ctx); + } finally { + cycleStack.delete(item); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Mikola Lysenko @mikolalysenko -*/ + result.push(ESCAPE, ESCAPE_END_OBJECT); + addReferenceable(item); + } else if (typeof item === "string") { + if (item.length > 1) { + // short strings are shorter when not emitting a reference (this saves 1 byte per empty string) + // check if we can emit a reference + const ref = referenceable.get(item); + if (ref !== undefined) { + result.push(ESCAPE, ref - currentPos); + return; + } + addReferenceable(item); + } + if (item.length > 102400 && context.logger) { + context.logger.warn( + `Serializing big strings (${Math.round( + item.length / 1024 + )}kiB) impacts deserialization performance (consider using Buffer instead and decode when needed)` + ); + } -/* cspell:disable-next-line */ -// Refactor: Peter Somogyvari @petermetz + result.push(item); + } else if (typeof item === "function") { + if (!SerializerMiddleware.isLazy(item)) + throw new Error("Unexpected function " + item); + /** @type {SerializedType} */ + const serializedData = + SerializerMiddleware.getLazySerializedValue(item); + if (serializedData !== undefined) { + if (typeof serializedData === "function") { + result.push(serializedData); + } else { + throw new Error("Not implemented"); + } + } else if (SerializerMiddleware.isLazy(item, this)) { + throw new Error("Not implemented"); + } else { + const data = SerializerMiddleware.serializeLazy(item, data => + this.serialize([data], context) + ); + SerializerMiddleware.setLazySerializedValue(item, data); + result.push(data); + } + } else if (item === undefined) { + result.push(ESCAPE, ESCAPE_UNDEFINED); + } else { + result.push(item); + } + }; -const compileSearch = (funcName, predicate, reversed, extraArgs, earlyOut) => { - const code = [ - "function ", - funcName, - "(a,l,h,", - extraArgs.join(","), - "){", - earlyOut ? "" : "var i=", - reversed ? "l-1" : "h+1", - ";while(l<=h){var m=(l+h)>>>1,x=a[m]" - ]; + try { + for (const item of data) { + process(item); + } + return result; + } catch (e) { + if (e === NOT_SERIALIZABLE) return null; - if (earlyOut) { - if (predicate.indexOf("c") < 0) { - code.push(";if(x===y){return m}else if(x<=y){"); - } else { - code.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"); + throw e; + } finally { + // Get rid of these references to avoid leaking memory + // This happens because the optimized code v8 generates + // is optimized for our "ctx.write" method so it will reference + // it from e. g. Dependency.prototype.serialize -(IC)-> ctx.write + data = + result = + referenceable = + bufferDedupeMap = + objectTypeLookup = + ctx = + undefined; } - } else { - code.push(";if(", predicate, "){i=m;"); - } - if (reversed) { - code.push("l=m+1}else{h=m-1}"); - } else { - code.push("h=m-1}else{l=m+1}"); - } - code.push("}"); - if (earlyOut) { - code.push("return -1};"); - } else { - code.push("return i};"); - } - return code.join(""); -}; - -const compileBoundsSearch = (predicate, reversed, suffix, earlyOut) => { - const arg1 = compileSearch( - "A", - "x" + predicate + "y", - reversed, - ["y"], - earlyOut - ); - - const arg2 = compileSearch( - "P", - "c(x,y)" + predicate + "0", - reversed, - ["y", "c"], - earlyOut - ); - - const fnHeader = "function dispatchBinarySearch"; - - const fnBody = - "(a,y,c,l,h){\ -if(typeof(c)==='function'){\ -return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)\ -}else{\ -return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)\ -}}\ -return dispatchBinarySearch"; - - const fnArgList = [arg1, arg2, fnHeader, suffix, fnBody, suffix]; - const fnSource = fnArgList.join(""); - const result = new Function(fnSource); - return result(); -}; - -module.exports = { - ge: compileBoundsSearch(">=", false, "GE"), - gt: compileBoundsSearch(">", false, "GT"), - lt: compileBoundsSearch("<", true, "LT"), - le: compileBoundsSearch("<=", true, "LE"), - eq: compileBoundsSearch("-", true, "EQ", true) -}; - - -/***/ }), - -/***/ 60839: -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** @type {WeakMap>} */ -const mergeCache = new WeakMap(); -/** @type {WeakMap>>} */ -const setPropertyCache = new WeakMap(); -const DELETE = Symbol("DELETE"); -const DYNAMIC_INFO = Symbol("cleverMerge dynamic info"); - -/** - * Merges two given objects and caches the result to avoid computation if same objects passed as arguments again. - * @template T - * @template O - * @example - * // performs cleverMerge(first, second), stores the result in WeakMap and returns result - * cachedCleverMerge({a: 1}, {a: 2}) - * {a: 2} - * // when same arguments passed, gets the result from WeakMap and returns it. - * cachedCleverMerge({a: 1}, {a: 2}) - * {a: 2} - * @param {T} first first object - * @param {O} second second object - * @returns {T & O | T | O} merged object of first and second object - */ -const cachedCleverMerge = (first, second) => { - if (second === undefined) return first; - if (first === undefined) return second; - if (typeof second !== "object" || second === null) return second; - if (typeof first !== "object" || first === null) return first; - - let innerCache = mergeCache.get(first); - if (innerCache === undefined) { - innerCache = new WeakMap(); - mergeCache.set(first, innerCache); } - const prevMerge = innerCache.get(second); - if (prevMerge !== undefined) return prevMerge; - const newMerge = _cleverMerge(first, second, true); - innerCache.set(second, newMerge); - return newMerge; -}; - -/** - * @template T - * @param {Partial} obj object - * @param {string} property property - * @param {string|number|boolean} value assignment value - * @returns {T} new object - */ -const cachedSetProperty = (obj, property, value) => { - let mapByProperty = setPropertyCache.get(obj); - if (mapByProperty === undefined) { - mapByProperty = new Map(); - setPropertyCache.set(obj, mapByProperty); - } + /** + * @param {SerializedType} data data + * @param {Object} context context object + * @returns {DeserializedType|Promise} deserialized data + */ + deserialize(data, context) { + let currentDataPos = 0; + const read = () => { + if (currentDataPos >= data.length) + throw new Error("Unexpected end of stream"); - let mapByValue = mapByProperty.get(property); + return data[currentDataPos++]; + }; - if (mapByValue === undefined) { - mapByValue = new Map(); - mapByProperty.set(property, mapByValue); - } + if (read() !== CURRENT_VERSION) + throw new Error("Version mismatch, serializer changed"); - let result = mapByValue.get(value); + let currentPos = 0; + let referenceable = []; + const addReferenceable = item => { + referenceable.push(item); + currentPos++; + }; + let currentPosTypeLookup = 0; + let objectTypeLookup = []; + let result = []; + let ctx = { + read() { + return decodeValue(); + }, + setCircularReference(ref) { + addReferenceable(ref); + }, + ...context + }; + this.extendContext(ctx); + const decodeValue = () => { + const item = read(); - if (result) return result; + if (item === ESCAPE) { + const nextItem = read(); - result = { - ...obj, - [property]: value - }; - mapByValue.set(value, result); + if (nextItem === ESCAPE_ESCAPE_VALUE) { + return ESCAPE; + } else if (nextItem === ESCAPE_UNDEFINED) { + return undefined; + } else if (nextItem === ESCAPE_END_OBJECT) { + throw new Error( + `Unexpected end of object at position ${currentDataPos - 1}` + ); + } else { + const request = nextItem; + let serializer; - return result; -}; + if (typeof request === "number") { + if (request < 0) { + // relative reference + return referenceable[currentPos + request]; + } + serializer = objectTypeLookup[currentPosTypeLookup - request]; + } else { + if (typeof request !== "string") { + throw new Error( + `Unexpected type (${typeof request}) of request ` + + `at position ${currentDataPos - 1}` + ); + } + const name = read(); -/** - * @typedef {Object} ObjectParsedPropertyEntry - * @property {any | undefined} base base value - * @property {string | undefined} byProperty the name of the selector property - * @property {Map} byValues value depending on selector property, merged with base - */ + serializer = ObjectMiddleware._getDeserializerForWithoutError( + request, + name + ); -/** - * @typedef {Object} ParsedObject - * @property {Map} static static properties (key is property name) - * @property {{ byProperty: string, fn: Function } | undefined} dynamic dynamic part - */ + if (serializer === undefined) { + if (request && !loadedRequests.has(request)) { + let loaded = false; + for (const [regExp, loader] of loaders) { + if (regExp.test(request)) { + if (loader(request)) { + loaded = true; + break; + } + } + } + if (!loaded) { + require(request); + } -/** @type {WeakMap} */ -const parseCache = new WeakMap(); + loadedRequests.add(request); + } -/** - * @param {object} obj the object - * @returns {ParsedObject} parsed object - */ -const cachedParseObject = obj => { - const entry = parseCache.get(obj); - if (entry !== undefined) return entry; - const result = parseObject(obj); - parseCache.set(obj, result); - return result; -}; + serializer = ObjectMiddleware.getDeserializerFor(request, name); + } -/** - * @param {object} obj the object - * @returns {ParsedObject} parsed object - */ -const parseObject = obj => { - const info = new Map(); - let dynamicInfo; - const getInfo = p => { - const entry = info.get(p); - if (entry !== undefined) return entry; - const newEntry = { - base: undefined, - byProperty: undefined, - byValues: undefined - }; - info.set(p, newEntry); - return newEntry; - }; - for (const key of Object.keys(obj)) { - if (key.startsWith("by")) { - const byProperty = key; - const byObj = obj[byProperty]; - if (typeof byObj === "object") { - for (const byValue of Object.keys(byObj)) { - const obj = byObj[byValue]; - for (const key of Object.keys(obj)) { - const entry = getInfo(key); - if (entry.byProperty === undefined) { - entry.byProperty = byProperty; - entry.byValues = new Map(); - } else if (entry.byProperty !== byProperty) { - throw new Error( - `${byProperty} and ${entry.byProperty} for a single property is not supported` - ); + objectTypeLookup.push(serializer); + currentPosTypeLookup++; + } + try { + const item = serializer.deserialize(ctx); + const end1 = read(); + + if (end1 !== ESCAPE) { + throw new Error("Expected end of object"); } - entry.byValues.set(byValue, obj[key]); - if (byValue === "default") { - for (const otherByValue of Object.keys(byObj)) { - if (!entry.byValues.has(otherByValue)) - entry.byValues.set(otherByValue, undefined); + + const end2 = read(); + + if (end2 !== ESCAPE_END_OBJECT) { + throw new Error("Expected end of object"); + } + + addReferenceable(item); + + return item; + } catch (err) { + // As this is only for error handling, we omit creating a Map for + // faster access to this information, as this would affect performance + // in the good case + let serializerEntry; + for (const entry of serializers) { + if (entry[1].serializer === serializer) { + serializerEntry = entry; + break; } } + const name = !serializerEntry + ? "unknown" + : !serializerEntry[1].request + ? serializerEntry[0].name + : serializerEntry[1].name + ? `${serializerEntry[1].request} ${serializerEntry[1].name}` + : serializerEntry[1].request; + err.message += `\n(during deserialization of ${name})`; + throw err; } } - } else if (typeof byObj === "function") { - if (dynamicInfo === undefined) { - dynamicInfo = { - byProperty: key, - fn: byObj - }; - } else { - throw new Error( - `${key} and ${dynamicInfo.byProperty} when both are functions is not supported` - ); + } else if (typeof item === "string") { + if (item.length > 1) { + addReferenceable(item); } + + return item; + } else if (Buffer.isBuffer(item)) { + addReferenceable(item); + + return item; + } else if (typeof item === "function") { + return SerializerMiddleware.deserializeLazy( + item, + data => this.deserialize(data, context)[0] + ); } else { - const entry = getInfo(key); - entry.base = obj[key]; + return item; } - } else { - const entry = getInfo(key); - entry.base = obj[key]; - } - } - return { - static: info, - dynamic: dynamicInfo - }; -}; + }; -/** - * @param {Map} info static properties (key is property name) - * @param {{ byProperty: string, fn: Function } | undefined} dynamicInfo dynamic part - * @returns {object} the object - */ -const serializeObject = (info, dynamicInfo) => { - const obj = {}; - // Setup byProperty structure - for (const entry of info.values()) { - if (entry.byProperty !== undefined) { - const byObj = (obj[entry.byProperty] = obj[entry.byProperty] || {}); - for (const byValue of entry.byValues.keys()) { - byObj[byValue] = byObj[byValue] || {}; - } - } - } - for (const [key, entry] of info) { - if (entry.base !== undefined) { - obj[key] = entry.base; - } - // Fill byProperty structure - if (entry.byProperty !== undefined) { - const byObj = (obj[entry.byProperty] = obj[entry.byProperty] || {}); - for (const byValue of Object.keys(byObj)) { - const value = getFromByValues(entry.byValues, byValue); - if (value !== undefined) byObj[byValue][key] = value; + try { + while (currentDataPos < data.length) { + result.push(decodeValue()); } + return result; + } finally { + // Get rid of these references to avoid leaking memory + // This happens because the optimized code v8 generates + // is optimized for our "ctx.read" method so it will reference + // it from e. g. Dependency.prototype.deserialize -(IC)-> ctx.read + result = referenceable = data = objectTypeLookup = ctx = undefined; } } - if (dynamicInfo !== undefined) { - obj[dynamicInfo.byProperty] = dynamicInfo.fn; - } - return obj; -}; +} -const VALUE_TYPE_UNDEFINED = 0; -const VALUE_TYPE_ATOM = 1; -const VALUE_TYPE_ARRAY_EXTEND = 2; -const VALUE_TYPE_OBJECT = 3; -const VALUE_TYPE_DELETE = 4; +module.exports = ObjectMiddleware; +module.exports.NOT_SERIALIZABLE = NOT_SERIALIZABLE; -/** - * @param {any} value a single value - * @returns {VALUE_TYPE_UNDEFINED | VALUE_TYPE_ATOM | VALUE_TYPE_ARRAY_EXTEND | VALUE_TYPE_OBJECT | VALUE_TYPE_DELETE} value type - */ -const getValueType = value => { - if (value === undefined) { - return VALUE_TYPE_UNDEFINED; - } else if (value === DELETE) { - return VALUE_TYPE_DELETE; - } else if (Array.isArray(value)) { - if (value.lastIndexOf("...") !== -1) return VALUE_TYPE_ARRAY_EXTEND; - return VALUE_TYPE_ATOM; - } else if ( - typeof value === "object" && - value !== null && - (!value.constructor || value.constructor === Object) - ) { - return VALUE_TYPE_OBJECT; - } - return VALUE_TYPE_ATOM; -}; -/** - * Merges two objects. Objects are deeply clever merged. - * Arrays might reference the old value with "...". - * Non-object values take preference over object values. - * @template T - * @template O - * @param {T} first first object - * @param {O} second second object - * @returns {T & O | T | O} merged object of first and second object - */ -const cleverMerge = (first, second) => { - if (second === undefined) return first; - if (first === undefined) return second; - if (typeof second !== "object" || second === null) return second; - if (typeof first !== "object" || first === null) return first; +/***/ }), - return _cleverMerge(first, second, false); -}; +/***/ 33040: +/***/ (function(module) { -/** - * Merges two objects. Objects are deeply clever merged. - * @param {object} first first object - * @param {object} second second object - * @param {boolean} internalCaching should parsing of objects and nested merges be cached - * @returns {object} merged object of first and second object - */ -const _cleverMerge = (first, second, internalCaching = false) => { - const firstObject = internalCaching - ? cachedParseObject(first) - : parseObject(first); - const { static: firstInfo, dynamic: firstDynamicInfo } = firstObject; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ - // If the first argument has a dynamic part we modify the dynamic part to merge the second argument - if (firstDynamicInfo !== undefined) { - let { byProperty, fn } = firstDynamicInfo; - const fnInfo = fn[DYNAMIC_INFO]; - if (fnInfo) { - second = internalCaching - ? cachedCleverMerge(fnInfo[1], second) - : cleverMerge(fnInfo[1], second); - fn = fnInfo[0]; - } - const newFn = (...args) => { - const fnResult = fn(...args); - return internalCaching - ? cachedCleverMerge(fnResult, second) - : cleverMerge(fnResult, second); - }; - newFn[DYNAMIC_INFO] = [fn, second]; - return serializeObject(firstObject.static, { byProperty, fn: newFn }); - } - // If the first part is static only, we merge the static parts and keep the dynamic part of the second argument - const secondObject = internalCaching - ? cachedParseObject(second) - : parseObject(second); - const { static: secondInfo, dynamic: secondDynamicInfo } = secondObject; - /** @type {Map} */ - const resultInfo = new Map(); - for (const [key, firstEntry] of firstInfo) { - const secondEntry = secondInfo.get(key); - const entry = - secondEntry !== undefined - ? mergeEntries(firstEntry, secondEntry, internalCaching) - : firstEntry; - resultInfo.set(key, entry); - } - for (const [key, secondEntry] of secondInfo) { - if (!firstInfo.has(key)) { - resultInfo.set(key, secondEntry); - } - } - return serializeObject(resultInfo, secondDynamicInfo); -}; -/** - * @param {ObjectParsedPropertyEntry} firstEntry a - * @param {ObjectParsedPropertyEntry} secondEntry b - * @param {boolean} internalCaching should parsing of objects and nested merges be cached - * @returns {ObjectParsedPropertyEntry} new entry - */ -const mergeEntries = (firstEntry, secondEntry, internalCaching) => { - switch (getValueType(secondEntry.base)) { - case VALUE_TYPE_ATOM: - case VALUE_TYPE_DELETE: - // No need to consider firstEntry at all - // second value override everything - // = second.base + second.byProperty - return secondEntry; - case VALUE_TYPE_UNDEFINED: - if (!firstEntry.byProperty) { - // = first.base + second.byProperty - return { - base: firstEntry.base, - byProperty: secondEntry.byProperty, - byValues: secondEntry.byValues - }; - } else if (firstEntry.byProperty !== secondEntry.byProperty) { - throw new Error( - `${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported` - ); - } else { - // = first.base + (first.byProperty + second.byProperty) - // need to merge first and second byValues - const newByValues = new Map(firstEntry.byValues); - for (const [key, value] of secondEntry.byValues) { - const firstValue = getFromByValues(firstEntry.byValues, key); - newByValues.set( - key, - mergeSingleValue(firstValue, value, internalCaching) - ); - } - return { - base: firstEntry.base, - byProperty: firstEntry.byProperty, - byValues: newByValues - }; - } - default: { - if (!firstEntry.byProperty) { - // The simple case - // = (first.base + second.base) + second.byProperty - return { - base: mergeSingleValue( - firstEntry.base, - secondEntry.base, - internalCaching - ), - byProperty: secondEntry.byProperty, - byValues: secondEntry.byValues - }; - } - let newBase; - const intermediateByValues = new Map(firstEntry.byValues); - for (const [key, value] of intermediateByValues) { - intermediateByValues.set( - key, - mergeSingleValue(value, secondEntry.base, internalCaching) - ); - } - if ( - Array.from(firstEntry.byValues.values()).every(value => { - const type = getValueType(value); - return type === VALUE_TYPE_ATOM || type === VALUE_TYPE_DELETE; - }) - ) { - // = (first.base + second.base) + ((first.byProperty + second.base) + second.byProperty) - newBase = mergeSingleValue( - firstEntry.base, - secondEntry.base, - internalCaching - ); - } else { - // = first.base + ((first.byProperty (+default) + second.base) + second.byProperty) - newBase = firstEntry.base; - if (!intermediateByValues.has("default")) - intermediateByValues.set("default", secondEntry.base); - } - if (!secondEntry.byProperty) { - // = first.base + (first.byProperty + second.base) - return { - base: newBase, - byProperty: firstEntry.byProperty, - byValues: intermediateByValues - }; - } else if (firstEntry.byProperty !== secondEntry.byProperty) { - throw new Error( - `${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported` - ); - } - const newByValues = new Map(intermediateByValues); - for (const [key, value] of secondEntry.byValues) { - const firstValue = getFromByValues(intermediateByValues, key); - newByValues.set( - key, - mergeSingleValue(firstValue, value, internalCaching) - ); - } - return { - base: newBase, - byProperty: firstEntry.byProperty, - byValues: newByValues - }; - } +const cache = new WeakMap(); + +class ObjectStructure { + constructor() { + this.keys = undefined; + this.children = undefined; } -}; -/** - * @param {Map} byValues all values - * @param {string} key value of the selector - * @returns {any | undefined} value - */ -const getFromByValues = (byValues, key) => { - if (key !== "default" && byValues.has(key)) { - return byValues.get(key); + getKeys(keys) { + if (this.keys === undefined) this.keys = keys; + return this.keys; } - return byValues.get("default"); -}; -/** - * @param {any} a value - * @param {any} b value - * @param {boolean} internalCaching should parsing of objects and nested merges be cached - * @returns {any} value - */ -const mergeSingleValue = (a, b, internalCaching) => { - const bType = getValueType(b); - const aType = getValueType(a); - switch (bType) { - case VALUE_TYPE_DELETE: - case VALUE_TYPE_ATOM: - return b; - case VALUE_TYPE_OBJECT: { - return aType !== VALUE_TYPE_OBJECT - ? b - : internalCaching - ? cachedCleverMerge(a, b) - : cleverMerge(a, b); - } - case VALUE_TYPE_UNDEFINED: - return a; - case VALUE_TYPE_ARRAY_EXTEND: - switch ( - aType !== VALUE_TYPE_ATOM - ? aType - : Array.isArray(a) - ? VALUE_TYPE_ARRAY_EXTEND - : VALUE_TYPE_OBJECT - ) { - case VALUE_TYPE_UNDEFINED: - return b; - case VALUE_TYPE_DELETE: - return b.filter(item => item !== "..."); - case VALUE_TYPE_ARRAY_EXTEND: { - const newArray = []; - for (const item of b) { - if (item === "...") { - for (const item of a) { - newArray.push(item); - } - } else { - newArray.push(item); - } - } - return newArray; - } - case VALUE_TYPE_OBJECT: - return b.map(item => (item === "..." ? a : item)); - default: - throw new Error("Not implemented"); - } - default: - throw new Error("Not implemented"); + key(key) { + if (this.children === undefined) this.children = new Map(); + const child = this.children.get(key); + if (child !== undefined) return child; + const newChild = new ObjectStructure(); + this.children.set(key, newChild); + return newChild; } -}; +} -/** - * @template T - * @param {T} obj the object - * @returns {T} the object without operations like "..." or DELETE - */ -const removeOperations = obj => { - const newObj = /** @type {T} */ ({}); - for (const key of Object.keys(obj)) { - const value = obj[key]; - const type = getValueType(value); - switch (type) { - case VALUE_TYPE_UNDEFINED: - case VALUE_TYPE_DELETE: - break; - case VALUE_TYPE_OBJECT: - newObj[key] = removeOperations(value); - break; - case VALUE_TYPE_ARRAY_EXTEND: - newObj[key] = value.filter(i => i !== "..."); - break; - default: - newObj[key] = value; - break; - } +const getCachedKeys = (keys, cacheAssoc) => { + let root = cache.get(cacheAssoc); + if (root === undefined) { + root = new ObjectStructure(); + cache.set(cacheAssoc, root); } - return newObj; + let current = root; + for (const key of keys) { + current = current.key(key); + } + return current.getKeys(keys); }; -/** - * @template T - * @template {string} P - * @param {T} obj the object - * @param {P} byProperty the by description - * @param {...any} values values - * @returns {Omit} object with merged byProperty - */ -const resolveByProperty = (obj, byProperty, ...values) => { - if (typeof obj !== "object" || obj === null || !(byProperty in obj)) { - return obj; - } - const { [byProperty]: _byValue, ..._remaining } = /** @type {object} */ (obj); - const remaining = /** @type {T} */ (_remaining); - const byValue = /** @type {Record | function(...any[]): T} */ ( - _byValue - ); - if (typeof byValue === "object") { - const key = values[0]; - if (key in byValue) { - return cachedCleverMerge(remaining, byValue[key]); - } else if ("default" in byValue) { - return cachedCleverMerge(remaining, byValue.default); +class PlainObjectSerializer { + serialize(obj, { write }) { + const keys = Object.keys(obj); + if (keys.length > 128) { + // Objects with so many keys are unlikely to share structure + // with other objects + write(keys); + for (const key of keys) { + write(obj[key]); + } + } else if (keys.length > 1) { + write(getCachedKeys(keys, write)); + for (const key of keys) { + write(obj[key]); + } + } else if (keys.length === 1) { + const key = keys[0]; + write(key); + write(obj[key]); } else { - return /** @type {T} */ (remaining); + write(null); } - } else if (typeof byValue === "function") { - const result = byValue.apply(null, values); - return cachedCleverMerge( - remaining, - resolveByProperty(result, byProperty, ...values) - ); } -}; + deserialize({ read }) { + const keys = read(); + const obj = {}; + if (Array.isArray(keys)) { + for (const key of keys) { + obj[key] = read(); + } + } else if (keys !== null) { + obj[keys] = read(); + } + return obj; + } +} -exports.cachedSetProperty = cachedSetProperty; -exports.cachedCleverMerge = cachedCleverMerge; -exports.cleverMerge = cleverMerge; -exports.resolveByProperty = resolveByProperty; -exports.removeOperations = removeOperations; -exports.DELETE = DELETE; +module.exports = PlainObjectSerializer; /***/ }), -/***/ 29579: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 57328: +/***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const { compareRuntime } = __webpack_require__(17156); +class RegExpObjectSerializer { + serialize(obj, { write }) { + write(obj.source); + write(obj.flags); + } + deserialize({ read }) { + return new RegExp(read(), read()); + } +} -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ +module.exports = RegExpObjectSerializer; -/** @template T @typedef {function(T, T): -1|0|1} Comparator */ -/** @template TArg @template T @typedef {function(TArg, T, T): -1|0|1} RawParameterizedComparator */ -/** @template TArg @template T @typedef {function(TArg): Comparator} ParameterizedComparator */ -/** - * @template T - * @param {RawParameterizedComparator} fn comparator with argument - * @returns {ParameterizedComparator} comparator - */ -const createCachedParameterizedComparator = fn => { - /** @type {WeakMap>} */ - const map = new WeakMap(); - return arg => { - const cachedResult = map.get(arg); - if (cachedResult !== undefined) return cachedResult; - /** - * @param {T} a first item - * @param {T} b second item - * @returns {-1|0|1} compare result - */ - const result = fn.bind(null, arg); - map.set(arg, result); - return result; - }; -}; +/***/ }), -/** - * @param {Chunk} a chunk - * @param {Chunk} b chunk - * @returns {-1|0|1} compare result - */ -exports.compareChunksById = (a, b) => { - return compareIds(a.id, b.id); -}; +/***/ 53080: +/***/ (function(module) { -/** - * @param {Module} a module - * @param {Module} b module - * @returns {-1|0|1} compare result - */ -exports.compareModulesByIdentifier = (a, b) => { - return compareIds(a.identifier(), b.identifier()); -}; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ -/** - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {Module} a module - * @param {Module} b module - * @returns {-1|0|1} compare result - */ -const compareModulesById = (chunkGraph, a, b) => { - return compareIds(chunkGraph.getModuleId(a), chunkGraph.getModuleId(b)); -}; -/** @type {ParameterizedComparator} */ -exports.compareModulesById = - createCachedParameterizedComparator(compareModulesById); -/** - * @param {number} a number - * @param {number} b number - * @returns {-1|0|1} compare result - */ -const compareNumbers = (a, b) => { - if (typeof a !== typeof b) { - return typeof a < typeof b ? -1 : 1; + +class Serializer { + constructor(middlewares, context) { + this.serializeMiddlewares = middlewares.slice(); + this.deserializeMiddlewares = middlewares.slice().reverse(); + this.context = context; } - if (a < b) return -1; - if (a > b) return 1; - return 0; -}; -exports.compareNumbers = compareNumbers; -/** - * @param {string} a string - * @param {string} b string - * @returns {-1|0|1} compare result - */ -const compareStringsNumeric = (a, b) => { - const partsA = a.split(/(\d+)/); - const partsB = b.split(/(\d+)/); - const len = Math.min(partsA.length, partsB.length); - for (let i = 0; i < len; i++) { - const pA = partsA[i]; - const pB = partsB[i]; - if (i % 2 === 0) { - if (pA.length > pB.length) { - if (pA.slice(0, pB.length) > pB) return 1; - return -1; - } else if (pB.length > pA.length) { - if (pB.slice(0, pA.length) > pA) return -1; - return 1; + serialize(obj, context) { + const ctx = { ...context, ...this.context }; + let current = obj; + for (const middleware of this.serializeMiddlewares) { + if (current && typeof current.then === "function") { + current = current.then(data => data && middleware.serialize(data, ctx)); + } else if (current) { + try { + current = middleware.serialize(current, ctx); + } catch (err) { + current = Promise.reject(err); + } + } else break; + } + return current; + } + + deserialize(value, context) { + const ctx = { ...context, ...this.context }; + /** @type {any} */ + let current = value; + for (const middleware of this.deserializeMiddlewares) { + if (current && typeof current.then === "function") { + current = current.then(data => middleware.deserialize(data, ctx)); } else { - if (pA < pB) return -1; - if (pA > pB) return 1; + current = middleware.deserialize(current, ctx); } - } else { - const nA = +pA; - const nB = +pB; - if (nA < nB) return -1; - if (nA > nB) return 1; } + return current; } - if (partsB.length < partsA.length) return 1; - if (partsB.length > partsA.length) return -1; - return 0; -}; -exports.compareStringsNumeric = compareStringsNumeric; - -/** - * @param {ModuleGraph} moduleGraph the module graph - * @param {Module} a module - * @param {Module} b module - * @returns {-1|0|1} compare result - */ -const compareModulesByPostOrderIndexOrIdentifier = (moduleGraph, a, b) => { - const cmp = compareNumbers( - moduleGraph.getPostOrderIndex(a), - moduleGraph.getPostOrderIndex(b) - ); - if (cmp !== 0) return cmp; - return compareIds(a.identifier(), b.identifier()); -}; -/** @type {ParameterizedComparator} */ -exports.compareModulesByPostOrderIndexOrIdentifier = - createCachedParameterizedComparator( - compareModulesByPostOrderIndexOrIdentifier - ); +} -/** - * @param {ModuleGraph} moduleGraph the module graph - * @param {Module} a module - * @param {Module} b module - * @returns {-1|0|1} compare result - */ -const compareModulesByPreOrderIndexOrIdentifier = (moduleGraph, a, b) => { - const cmp = compareNumbers( - moduleGraph.getPreOrderIndex(a), - moduleGraph.getPreOrderIndex(b) - ); - if (cmp !== 0) return cmp; - return compareIds(a.identifier(), b.identifier()); -}; -/** @type {ParameterizedComparator} */ -exports.compareModulesByPreOrderIndexOrIdentifier = - createCachedParameterizedComparator( - compareModulesByPreOrderIndexOrIdentifier - ); +module.exports = Serializer; -/** - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {Module} a module - * @param {Module} b module - * @returns {-1|0|1} compare result - */ -const compareModulesByIdOrIdentifier = (chunkGraph, a, b) => { - const cmp = compareIds(chunkGraph.getModuleId(a), chunkGraph.getModuleId(b)); - if (cmp !== 0) return cmp; - return compareIds(a.identifier(), b.identifier()); -}; -/** @type {ParameterizedComparator} */ -exports.compareModulesByIdOrIdentifier = createCachedParameterizedComparator( - compareModulesByIdOrIdentifier -); -/** - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {Chunk} a chunk - * @param {Chunk} b chunk - * @returns {-1|0|1} compare result - */ -const compareChunks = (chunkGraph, a, b) => { - return chunkGraph.compareChunks(a, b); -}; -/** @type {ParameterizedComparator} */ -exports.compareChunks = createCachedParameterizedComparator(compareChunks); +/***/ }), -/** - * @param {string|number} a first id - * @param {string|number} b second id - * @returns {-1|0|1} compare result - */ -const compareIds = (a, b) => { - if (typeof a !== typeof b) { - return typeof a < typeof b ? -1 : 1; - } - if (a < b) return -1; - if (a > b) return 1; - return 0; -}; +/***/ 83137: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -exports.compareIds = compareIds; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ -/** - * @param {string} a first string - * @param {string} b second string - * @returns {-1|0|1} compare result - */ -const compareStrings = (a, b) => { - if (a < b) return -1; - if (a > b) return 1; - return 0; -}; -exports.compareStrings = compareStrings; -/** - * @param {ChunkGroup} a first chunk group - * @param {ChunkGroup} b second chunk group - * @returns {-1|0|1} compare result - */ -const compareChunkGroupsByIndex = (a, b) => { - return a.index < b.index ? -1 : 1; -}; +const memoize = __webpack_require__(78676); -exports.compareChunkGroupsByIndex = compareChunkGroupsByIndex; +const LAZY_TARGET = Symbol("lazy serialization target"); +const LAZY_SERIALIZED_VALUE = Symbol("lazy serialization data"); /** - * @template K1 {Object} - * @template K2 - * @template T + * @template DeserializedType + * @template SerializedType */ -class TwoKeyWeakMap { - constructor() { - /** @private @type {WeakMap>} */ - this._map = new WeakMap(); +class SerializerMiddleware { + /* istanbul ignore next */ + /** + * @abstract + * @param {DeserializedType} data data + * @param {Object} context context object + * @returns {SerializedType|Promise} serialized data + */ + serialize(data, context) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } + /* istanbul ignore next */ /** - * @param {K1} key1 first key - * @param {K2} key2 second key - * @returns {T | undefined} value + * @abstract + * @param {SerializedType} data data + * @param {Object} context context object + * @returns {DeserializedType|Promise} deserialized data */ - get(key1, key2) { - const childMap = this._map.get(key1); - if (childMap === undefined) { - return undefined; - } - return childMap.get(key2); + deserialize(data, context) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } /** - * @param {K1} key1 first key - * @param {K2} key2 second key - * @param {T | undefined} value new value - * @returns {void} + * @param {any | function(): Promise | any} value contained value or function to value + * @param {SerializerMiddleware} target target middleware + * @param {object=} options lazy options + * @param {any=} serializedValue serialized value + * @returns {function(): Promise | any} lazy function */ - set(key1, key2, value) { - let childMap = this._map.get(key1); - if (childMap === undefined) { - childMap = new WeakMap(); - this._map.set(key1, childMap); - } - childMap.set(key2, value); + static createLazy(value, target, options = {}, serializedValue) { + if (SerializerMiddleware.isLazy(value, target)) return value; + const fn = typeof value === "function" ? value : () => value; + fn[LAZY_TARGET] = target; + /** @type {any} */ (fn).options = options; + fn[LAZY_SERIALIZED_VALUE] = serializedValue; + return fn; } -} -/** @type {TwoKeyWeakMap, Comparator, Comparator>}} */ -const concatComparatorsCache = new TwoKeyWeakMap(); - -/** - * @template T - * @param {Comparator} c1 comparator - * @param {Comparator} c2 comparator - * @param {Comparator[]} cRest comparators - * @returns {Comparator} comparator - */ -const concatComparators = (c1, c2, ...cRest) => { - if (cRest.length > 0) { - const [c3, ...cRest2] = cRest; - return concatComparators(c1, concatComparators(c2, c3, ...cRest2)); + /** + * @param {function(): Promise | any} fn lazy function + * @param {SerializerMiddleware=} target target middleware + * @returns {boolean} true, when fn is a lazy function (optionally of that target) + */ + static isLazy(fn, target) { + if (typeof fn !== "function") return false; + const t = fn[LAZY_TARGET]; + return target ? t === target : !!t; } - const cacheEntry = /** @type {Comparator} */ ( - concatComparatorsCache.get(c1, c2) - ); - if (cacheEntry !== undefined) return cacheEntry; + /** - * @param {T} a first value - * @param {T} b second value - * @returns {-1|0|1} compare result + * @param {function(): Promise | any} fn lazy function + * @returns {object} options */ - const result = (a, b) => { - const res = c1(a, b); - if (res !== 0) return res; - return c2(a, b); - }; - concatComparatorsCache.set(c1, c2, result); - return result; -}; -exports.concatComparators = concatComparators; + static getLazyOptions(fn) { + if (typeof fn !== "function") return undefined; + return /** @type {any} */ (fn).options; + } -/** @template A, B @typedef {(input: A) => B} Selector */ + /** + * @param {function(): Promise | any} fn lazy function + * @returns {any} serialized value + */ + static getLazySerializedValue(fn) { + if (typeof fn !== "function") return undefined; + return fn[LAZY_SERIALIZED_VALUE]; + } -/** @type {TwoKeyWeakMap, Comparator, Comparator>}} */ -const compareSelectCache = new TwoKeyWeakMap(); + /** + * @param {function(): Promise | any} fn lazy function + * @param {any} value serialized value + * @returns {void} + */ + static setLazySerializedValue(fn, value) { + fn[LAZY_SERIALIZED_VALUE] = value; + } -/** - * @template T - * @template R - * @param {Selector} getter getter for value - * @param {Comparator} comparator comparator - * @returns {Comparator} comparator - */ -const compareSelect = (getter, comparator) => { - const cacheEntry = compareSelectCache.get(getter, comparator); - if (cacheEntry !== undefined) return cacheEntry; /** - * @param {T} a first value - * @param {T} b second value - * @returns {-1|0|1} compare result + * @param {function(): Promise | any} lazy lazy function + * @param {function(any): Promise | any} serialize serialize function + * @returns {function(): Promise | any} new lazy */ - const result = (a, b) => { - const aValue = getter(a); - const bValue = getter(b); - if (aValue !== undefined && aValue !== null) { - if (bValue !== undefined && bValue !== null) { - return comparator(aValue, bValue); + static serializeLazy(lazy, serialize) { + const fn = memoize(() => { + const r = lazy(); + if (r && typeof r.then === "function") { + return r.then(data => data && serialize(data)); } - return -1; - } else { - if (bValue !== undefined && bValue !== null) { - return 1; + return serialize(r); + }); + fn[LAZY_TARGET] = lazy[LAZY_TARGET]; + /** @type {any} */ (fn).options = /** @type {any} */ (lazy).options; + lazy[LAZY_SERIALIZED_VALUE] = fn; + return fn; + } + + /** + * @param {function(): Promise | any} lazy lazy function + * @param {function(any): Promise | any} deserialize deserialize function + * @returns {function(): Promise | any} new lazy + */ + static deserializeLazy(lazy, deserialize) { + const fn = memoize(() => { + const r = lazy(); + if (r && typeof r.then === "function") { + return r.then(data => deserialize(data)); } - return 0; + return deserialize(r); + }); + fn[LAZY_TARGET] = lazy[LAZY_TARGET]; + /** @type {any} */ (fn).options = /** @type {any} */ (lazy).options; + fn[LAZY_SERIALIZED_VALUE] = lazy; + return fn; + } + + /** + * @param {function(): Promise | any} lazy lazy function + * @returns {function(): Promise | any} new lazy + */ + static unMemoizeLazy(lazy) { + if (!SerializerMiddleware.isLazy(lazy)) return lazy; + const fn = () => { + throw new Error( + "A lazy value that has been unmemorized can't be called again" + ); + }; + fn[LAZY_SERIALIZED_VALUE] = SerializerMiddleware.unMemoizeLazy( + lazy[LAZY_SERIALIZED_VALUE] + ); + fn[LAZY_TARGET] = lazy[LAZY_TARGET]; + fn.options = /** @type {any} */ (lazy).options; + return fn; + } +} + +module.exports = SerializerMiddleware; + + +/***/ }), + +/***/ 79240: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +class SetObjectSerializer { + serialize(obj, { write }) { + write(obj.size); + for (const value of obj) { + write(value); } - }; - compareSelectCache.set(getter, comparator, result); - return result; -}; -exports.compareSelect = compareSelect; + } + deserialize({ read }) { + let size = read(); + const set = new Set(); + for (let i = 0; i < size; i++) { + set.add(read()); + } + return set; + } +} -/** @type {WeakMap, Comparator>>} */ -const compareIteratorsCache = new WeakMap(); +module.exports = SetObjectSerializer; + + +/***/ }), + +/***/ 65112: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const SerializerMiddleware = __webpack_require__(83137); /** - * @template T - * @param {Comparator} elementComparator comparator for elements - * @returns {Comparator>} comparator for iterables of elements + * @typedef {any} DeserializedType + * @typedef {any[]} SerializedType + * @extends {SerializerMiddleware} */ -const compareIterables = elementComparator => { - const cacheEntry = compareIteratorsCache.get(elementComparator); - if (cacheEntry !== undefined) return cacheEntry; +class SingleItemMiddleware extends SerializerMiddleware { /** - * @param {Iterable} a first value - * @param {Iterable} b second value - * @returns {-1|0|1} compare result + * @param {DeserializedType} data data + * @param {Object} context context object + * @returns {SerializedType|Promise} serialized data */ - const result = (a, b) => { - const aI = a[Symbol.iterator](); - const bI = b[Symbol.iterator](); - // eslint-disable-next-line no-constant-condition - while (true) { - const aItem = aI.next(); - const bItem = bI.next(); - if (aItem.done) { - return bItem.done ? 0 : -1; - } else if (bItem.done) { - return 1; - } - const res = elementComparator(aItem.value, bItem.value); - if (res !== 0) return res; - } - }; - compareIteratorsCache.set(elementComparator, result); - return result; -}; -exports.compareIterables = compareIterables; + serialize(data, context) { + return [data]; + } -// TODO this is no longer needed when minimum node.js version is >= 12 -// since these versions ship with a stable sort function -/** - * @template T - * @param {Iterable} iterable original ordered list - * @returns {Comparator} comparator - */ -exports.keepOriginalOrder = iterable => { - /** @type {Map} */ - const map = new Map(); - let i = 0; - for (const item of iterable) { - map.set(item, i++); + /** + * @param {SerializedType} data data + * @param {Object} context context object + * @returns {DeserializedType|Promise} deserialized data + */ + deserialize(data, context) { + return data[0]; } - return (a, b) => compareNumbers(map.get(a), map.get(b)); -}; +} -/** - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {Comparator} comparator - */ -exports.compareChunksNatural = chunkGraph => { - const cmpFn = exports.compareModulesById(chunkGraph); - const cmpIterableFn = compareIterables(cmpFn); - return concatComparators( - compareSelect(chunk => chunk.name, compareIds), - compareSelect(chunk => chunk.runtime, compareRuntime), - compareSelect( - /** - * @param {Chunk} chunk a chunk - * @returns {Iterable} modules - */ - chunk => chunkGraph.getOrderedChunkModulesIterable(chunk, cmpFn), - cmpIterableFn - ) - ); -}; +module.exports = SingleItemMiddleware; -/** - * Compare two locations - * @param {DependencyLocation} a A location node - * @param {DependencyLocation} b A location node - * @returns {-1|0|1} sorting comparator value - */ -exports.compareLocations = (a, b) => { - let isObjectA = typeof a === "object" && a !== null; - let isObjectB = typeof b === "object" && b !== null; - if (!isObjectA || !isObjectB) { - if (isObjectA) return 1; - if (isObjectB) return -1; - return 0; + +/***/ }), + +/***/ 58831: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ModuleDependency = __webpack_require__(80321); +const makeSerializable = __webpack_require__(33032); + +class ConsumeSharedFallbackDependency extends ModuleDependency { + constructor(request) { + super(request); } - if ("start" in a) { - if ("start" in b) { - const ap = a.start; - const bp = b.start; - if (ap.line < bp.line) return -1; - if (ap.line > bp.line) return 1; - if (ap.column < bp.column) return -1; - if (ap.column > bp.column) return 1; - } else return -1; - } else if ("start" in b) return 1; - if ("name" in a) { - if ("name" in b) { - if (a.name < b.name) return -1; - if (a.name > b.name) return 1; - } else return -1; - } else if ("name" in b) return 1; - if ("index" in a) { - if ("index" in b) { - if (a.index < b.index) return -1; - if (a.index > b.index) return 1; - } else return -1; - } else if ("index" in b) return 1; - return 0; -}; + + get type() { + return "consume shared fallback"; + } + + get category() { + return "esm"; + } +} + +makeSerializable( + ConsumeSharedFallbackDependency, + "webpack/lib/sharing/ConsumeSharedFallbackDependency" +); + +module.exports = ConsumeSharedFallbackDependency; /***/ }), -/***/ 29404: -/***/ (function(module) { +/***/ 62286: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -124804,246 +121827,255 @@ exports.compareLocations = (a, b) => { -const quoteMeta = str => { - return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); -}; +const { RawSource } = __webpack_require__(51255); +const AsyncDependenciesBlock = __webpack_require__(47736); +const Module = __webpack_require__(73208); +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); +const { rangeToString, stringifyHoley } = __webpack_require__(19702); +const ConsumeSharedFallbackDependency = __webpack_require__(58831); -const toSimpleString = str => { - if (`${+str}` === str) { - return str; - } - return JSON.stringify(str); -}; +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("../util/semver").SemVerRange} SemVerRange */ /** - * @param {Record} map value map - * @returns {boolean|(function(string): string)} true/false, when unconditionally true/false, or a template function to determine the value at runtime + * @typedef {Object} ConsumeOptions + * @property {string=} import fallback request + * @property {string=} importResolved resolved fallback request + * @property {string} shareKey global share key + * @property {string} shareScope share scope + * @property {SemVerRange | false | undefined} requiredVersion version requirement + * @property {string} packageName package name to determine required version automatically + * @property {boolean} strictVersion don't use shared version even if version isn't valid + * @property {boolean} singleton use single global version + * @property {boolean} eager include the fallback module in a sync way */ -const compileBooleanMatcher = map => { - const positiveItems = Object.keys(map).filter(i => map[i]); - const negativeItems = Object.keys(map).filter(i => !map[i]); - if (positiveItems.length === 0) return false; - if (negativeItems.length === 0) return true; - return compileBooleanMatcherFromLists(positiveItems, negativeItems); -}; -/** - * @param {string[]} positiveItems positive items - * @param {string[]} negativeItems negative items - * @returns {function(string): string} a template function to determine the value at runtime - */ -const compileBooleanMatcherFromLists = (positiveItems, negativeItems) => { - if (positiveItems.length === 0) return () => "false"; - if (negativeItems.length === 0) return () => "true"; - if (positiveItems.length === 1) - return value => `${toSimpleString(positiveItems[0])} == ${value}`; - if (negativeItems.length === 1) - return value => `${toSimpleString(negativeItems[0])} != ${value}`; - const positiveRegexp = itemsToRegexp(positiveItems); - const negativeRegexp = itemsToRegexp(negativeItems); - if (positiveRegexp.length <= negativeRegexp.length) { - return value => `/^${positiveRegexp}$/.test(${value})`; - } else { - return value => `!/^${negativeRegexp}$/.test(${value})`; - } -}; +const TYPES = new Set(["consume-shared"]); -const popCommonItems = (itemsSet, getKey, condition) => { - const map = new Map(); - for (const item of itemsSet) { - const key = getKey(item); - if (key) { - let list = map.get(key); - if (list === undefined) { - list = []; - map.set(key, list); - } - list.push(item); - } - } - const result = []; - for (const list of map.values()) { - if (condition(list)) { - for (const item of list) { - itemsSet.delete(item); - } - result.push(list); - } +class ConsumeSharedModule extends Module { + /** + * @param {string} context context + * @param {ConsumeOptions} options consume options + */ + constructor(context, options) { + super("consume-shared-module", context); + this.options = options; } - return result; -}; -const getCommonPrefix = items => { - let prefix = items[0]; - for (let i = 1; i < items.length; i++) { - const item = items[i]; - for (let p = 0; p < prefix.length; p++) { - if (item[p] !== prefix[p]) { - prefix = prefix.slice(0, p); - break; - } - } + /** + * @returns {string} a unique identifier of the module + */ + identifier() { + const { + shareKey, + shareScope, + importResolved, + requiredVersion, + strictVersion, + singleton, + eager + } = this.options; + return `consume-shared-module|${shareScope}|${shareKey}|${ + requiredVersion && rangeToString(requiredVersion) + }|${strictVersion}|${importResolved}|${singleton}|${eager}`; } - return prefix; -}; -const getCommonSuffix = items => { - let suffix = items[0]; - for (let i = 1; i < items.length; i++) { - const item = items[i]; - for (let p = item.length - 1, s = suffix.length - 1; s >= 0; p--, s--) { - if (item[p] !== suffix[s]) { - suffix = suffix.slice(s + 1); - break; - } - } + /** + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + const { + shareKey, + shareScope, + importResolved, + requiredVersion, + strictVersion, + singleton, + eager + } = this.options; + return `consume shared module (${shareScope}) ${shareKey}@${ + requiredVersion ? rangeToString(requiredVersion) : "*" + }${strictVersion ? " (strict)" : ""}${singleton ? " (singleton)" : ""}${ + importResolved + ? ` (fallback: ${requestShortener.shorten(importResolved)})` + : "" + }${eager ? " (eager)" : ""}`; } - return suffix; -}; -const itemsToRegexp = itemsArr => { - if (itemsArr.length === 1) { - return quoteMeta(itemsArr[0]); + /** + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion + */ + libIdent(options) { + const { shareKey, shareScope, import: request } = this.options; + return `${ + this.layer ? `(${this.layer})/` : "" + }webpack/sharing/consume/${shareScope}/${shareKey}${ + request ? `/${request}` : "" + }`; } - const finishedItems = []; - // merge single char items: (a|b|c|d|ef) => ([abcd]|ef) - let countOfSingleCharItems = 0; - for (const item of itemsArr) { - if (item.length === 1) { - countOfSingleCharItems++; - } - } - // special case for only single char items - if (countOfSingleCharItems === itemsArr.length) { - return `[${quoteMeta(itemsArr.sort().join(""))}]`; + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + callback(null, !this.buildInfo); } - const items = new Set(itemsArr.sort()); - if (countOfSingleCharItems > 2) { - let singleCharItems = ""; - for (const item of items) { - if (item.length === 1) { - singleCharItems += item; - items.delete(item); + + /** + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + this.buildMeta = {}; + this.buildInfo = {}; + if (this.options.import) { + const dep = new ConsumeSharedFallbackDependency(this.options.import); + if (this.options.eager) { + this.addDependency(dep); + } else { + const block = new AsyncDependenciesBlock({}); + block.addDependency(dep); + this.addBlock(block); } } - finishedItems.push(`[${quoteMeta(singleCharItems)}]`); + callback(); } - // special case for 2 items with common prefix/suffix - if (finishedItems.length === 0 && items.size === 2) { - const prefix = getCommonPrefix(itemsArr); - const suffix = getCommonSuffix( - itemsArr.map(item => item.slice(prefix.length)) - ); - if (prefix.length > 0 || suffix.length > 0) { - return `${quoteMeta(prefix)}${itemsToRegexp( - itemsArr.map(i => i.slice(prefix.length, -suffix.length || undefined)) - )}${quoteMeta(suffix)}`; - } + /** + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + return TYPES; } - // special case for 2 items with common suffix - if (finishedItems.length === 0 && items.size === 2) { - const it = items[Symbol.iterator](); - const a = it.next().value; - const b = it.next().value; - if (a.length > 0 && b.length > 0 && a.slice(-1) === b.slice(-1)) { - return `${itemsToRegexp([a.slice(0, -1), b.slice(0, -1)])}${quoteMeta( - a.slice(-1) - )}`; - } + /** + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + return 42; } - // find common prefix: (a1|a2|a3|a4|b5) => (a(1|2|3|4)|b5) - const prefixed = popCommonItems( - items, - item => (item.length >= 1 ? item[0] : false), - list => { - if (list.length >= 3) return true; - if (list.length <= 1) return false; - return list[0][1] === list[1][1]; - } - ); - for (const prefixedItems of prefixed) { - const prefix = getCommonPrefix(prefixedItems); - finishedItems.push( - `${quoteMeta(prefix)}${itemsToRegexp( - prefixedItems.map(i => i.slice(prefix.length)) - )}` - ); + /** + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + hash.update(JSON.stringify(this.options)); + super.updateHash(hash, context); } - // find common suffix: (a1|b1|c1|d1|e2) => ((a|b|c|d)1|e2) - const suffixed = popCommonItems( - items, - item => (item.length >= 1 ? item.slice(-1) : false), - list => { - if (list.length >= 3) return true; - if (list.length <= 1) return false; - return list[0].slice(-2) === list[1].slice(-2); + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration({ chunkGraph, moduleGraph, runtimeTemplate }) { + const runtimeRequirements = new Set([RuntimeGlobals.shareScopeMap]); + const { + shareScope, + shareKey, + strictVersion, + requiredVersion, + import: request, + singleton, + eager + } = this.options; + let fallbackCode; + if (request) { + if (eager) { + const dep = this.dependencies[0]; + fallbackCode = runtimeTemplate.syncModuleFactory({ + dependency: dep, + chunkGraph, + runtimeRequirements, + request: this.options.import + }); + } else { + const block = this.blocks[0]; + fallbackCode = runtimeTemplate.asyncModuleFactory({ + block, + chunkGraph, + runtimeRequirements, + request: this.options.import + }); + } + } + let fn = "load"; + const args = [JSON.stringify(shareScope), JSON.stringify(shareKey)]; + if (requiredVersion) { + if (strictVersion) { + fn += "Strict"; + } + if (singleton) { + fn += "Singleton"; + } + args.push(stringifyHoley(requiredVersion)); + fn += "VersionCheck"; + } else { + if (singleton) { + fn += "Singleton"; + } } - ); - for (const suffixedItems of suffixed) { - const suffix = getCommonSuffix(suffixedItems); - finishedItems.push( - `${itemsToRegexp( - suffixedItems.map(i => i.slice(0, -suffix.length)) - )}${quoteMeta(suffix)}` - ); + if (fallbackCode) { + fn += "Fallback"; + args.push(fallbackCode); + } + const code = runtimeTemplate.returningFunction(`${fn}(${args.join(", ")})`); + const sources = new Map(); + sources.set("consume-shared", new RawSource(code)); + return { + runtimeRequirements, + sources + }; } - // TODO further optimize regexp, i. e. - // use ranges: (1|2|3|4|a) => [1-4a] - const conditional = finishedItems.concat(Array.from(items, quoteMeta)); - if (conditional.length === 1) return conditional[0]; - return `(${conditional.join("|")})`; -}; - -compileBooleanMatcher.fromLists = compileBooleanMatcherFromLists; -compileBooleanMatcher.itemsToRegexp = itemsToRegexp; -module.exports = compileBooleanMatcher; - - -/***/ }), - -/***/ 32540: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const memoize = __webpack_require__(78676); + serialize(context) { + const { write } = context; + write(this.options); + super.serialize(context); + } -const getValidate = memoize(() => (__webpack_require__(38476).validate)); + deserialize(context) { + const { read } = context; + this.options = read(); + super.deserialize(context); + } +} -const createSchemaValidation = (check, getSchema, options) => { - getSchema = memoize(getSchema); - return value => { - if (check && !check(value)) { - getValidate()(getSchema(), value, options); - if (check) { - (__webpack_require__(73837).deprecate)( - () => {}, - "webpack bug: Pre-compiled schema reports error while real schema is happy. This has performance drawbacks.", - "DEP_WEBPACK_PRE_COMPILED_SCHEMA_INVALID" - )(); - } - } - }; -}; +makeSerializable( + ConsumeSharedModule, + "webpack/lib/sharing/ConsumeSharedModule" +); -module.exports = createSchemaValidation; +module.exports = ConsumeSharedModule; /***/ }), -/***/ 49835: +/***/ 15046: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -125054,176 +122086,324 @@ module.exports = createSchemaValidation; -const Hash = __webpack_require__(36692); - -const BULK_SIZE = 2000; +const ModuleNotFoundError = __webpack_require__(32882); +const RuntimeGlobals = __webpack_require__(16475); +const WebpackError = __webpack_require__(53799); +const { parseOptions } = __webpack_require__(3083); +const LazySet = __webpack_require__(38938); +const createSchemaValidation = __webpack_require__(32540); +const { parseRange } = __webpack_require__(19702); +const ConsumeSharedFallbackDependency = __webpack_require__(58831); +const ConsumeSharedModule = __webpack_require__(62286); +const ConsumeSharedRuntimeModule = __webpack_require__(10394); +const ProvideForSharedDependency = __webpack_require__(40017); +const { resolveMatchedConfigs } = __webpack_require__(3591); +const { + isRequiredVersion, + getDescriptionFile, + getRequiredVersionFromDescriptionFile +} = __webpack_require__(84379); -// We are using an object instead of a Map as this will stay static during the runtime -// so access to it can be optimized by v8 -const digestCaches = {}; +/** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumeSharedPluginOptions} ConsumeSharedPluginOptions */ +/** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumesConfig} ConsumesConfig */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../ResolverFactory").ResolveOptionsWithDependencyType} ResolveOptionsWithDependencyType */ +/** @typedef {import("./ConsumeSharedModule").ConsumeOptions} ConsumeOptions */ -class BulkUpdateDecorator extends Hash { - /** - * @param {Hash | function(): Hash} hashOrFactory function to create a hash - * @param {string=} hashKey key for caching - */ - constructor(hashOrFactory, hashKey) { - super(); - this.hashKey = hashKey; - if (typeof hashOrFactory === "function") { - this.hashFactory = hashOrFactory; - this.hash = undefined; - } else { - this.hashFactory = undefined; - this.hash = hashOrFactory; - } - this.buffer = ""; +const validate = createSchemaValidation( + __webpack_require__(6464), + () => __webpack_require__(16116), + { + name: "Consume Shared Plugin", + baseDataPath: "options" } +); - /** - * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} - * @param {string|Buffer} data data - * @param {string=} inputEncoding data encoding - * @returns {this} updated hash - */ - update(data, inputEncoding) { - if ( - inputEncoding !== undefined || - typeof data !== "string" || - data.length > BULK_SIZE - ) { - if (this.hash === undefined) this.hash = this.hashFactory(); - if (this.buffer.length > 0) { - this.hash.update(this.buffer); - this.buffer = ""; - } - this.hash.update(data, inputEncoding); - } else { - this.buffer += data; - if (this.buffer.length > BULK_SIZE) { - if (this.hash === undefined) this.hash = this.hashFactory(); - this.hash.update(this.buffer); - this.buffer = ""; - } - } - return this; - } +/** @type {ResolveOptionsWithDependencyType} */ +const RESOLVE_OPTIONS = { dependencyType: "esm" }; +const PLUGIN_NAME = "ConsumeSharedPlugin"; +class ConsumeSharedPlugin { /** - * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} - * @param {string=} encoding encoding of the return value - * @returns {string|Buffer} digest + * @param {ConsumeSharedPluginOptions} options options */ - digest(encoding) { - let digestCache; - const buffer = this.buffer; - if (this.hash === undefined) { - // short data for hash, we can use caching - const cacheKey = `${this.hashKey}-${encoding}`; - digestCache = digestCaches[cacheKey]; - if (digestCache === undefined) { - digestCache = digestCaches[cacheKey] = new Map(); - } - const cacheEntry = digestCache.get(buffer); - if (cacheEntry !== undefined) return cacheEntry; - this.hash = this.hashFactory(); - } - if (buffer.length > 0) { - this.hash.update(buffer); - } - const digestResult = this.hash.digest(encoding); - const result = - typeof digestResult === "string" ? digestResult : digestResult.toString(); - if (digestCache !== undefined) { - digestCache.set(buffer, result); + constructor(options) { + if (typeof options !== "string") { + validate(options); } - return result; - } -} -/* istanbul ignore next */ -class DebugHash extends Hash { - constructor() { - super(); - this.string = ""; + /** @type {[string, ConsumeOptions][]} */ + this._consumes = parseOptions( + options.consumes, + (item, key) => { + if (Array.isArray(item)) throw new Error("Unexpected array in options"); + /** @type {ConsumeOptions} */ + let result = + item === key || !isRequiredVersion(item) + ? // item is a request/key + { + import: key, + shareScope: options.shareScope || "default", + shareKey: key, + requiredVersion: undefined, + packageName: undefined, + strictVersion: false, + singleton: false, + eager: false + } + : // key is a request/key + // item is a version + { + import: key, + shareScope: options.shareScope || "default", + shareKey: key, + requiredVersion: parseRange(item), + strictVersion: true, + packageName: undefined, + singleton: false, + eager: false + }; + return result; + }, + (item, key) => ({ + import: item.import === false ? undefined : item.import || key, + shareScope: item.shareScope || options.shareScope || "default", + shareKey: item.shareKey || key, + requiredVersion: + typeof item.requiredVersion === "string" + ? parseRange(item.requiredVersion) + : item.requiredVersion, + strictVersion: + typeof item.strictVersion === "boolean" + ? item.strictVersion + : item.import !== false && !item.singleton, + packageName: item.packageName, + singleton: !!item.singleton, + eager: !!item.eager + }) + ); } /** - * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} - * @param {string|Buffer} data data - * @param {string=} inputEncoding data encoding - * @returns {this} updated hash + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - update(data, inputEncoding) { - if (typeof data !== "string") data = data.toString("utf-8"); - if (data.startsWith("debug-digest-")) { - data = Buffer.from(data.slice("debug-digest-".length), "hex").toString(); - } - this.string += `[${data}](${new Error().stack.split("\n", 3)[2]})\n`; - return this; - } + apply(compiler) { + compiler.hooks.thisCompilation.tap( + PLUGIN_NAME, + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + ConsumeSharedFallbackDependency, + normalModuleFactory + ); - /** - * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} - * @param {string=} encoding encoding of the return value - * @returns {string|Buffer} digest - */ - digest(encoding) { - return "debug-digest-" + Buffer.from(this.string).toString("hex"); - } -} + let unresolvedConsumes, resolvedConsumes, prefixedConsumes; + const promise = resolveMatchedConfigs(compilation, this._consumes).then( + ({ resolved, unresolved, prefixed }) => { + resolvedConsumes = resolved; + unresolvedConsumes = unresolved; + prefixedConsumes = prefixed; + } + ); -let crypto = undefined; -let createXXHash64 = undefined; -let createMd4 = undefined; -let BatchedHash = undefined; + const resolver = compilation.resolverFactory.get( + "normal", + RESOLVE_OPTIONS + ); -/** - * Creates a hash by name or function - * @param {string | typeof Hash} algorithm the algorithm name or a constructor creating a hash - * @returns {Hash} the hash - */ -module.exports = algorithm => { - if (typeof algorithm === "function") { - return new BulkUpdateDecorator(() => new algorithm()); - } - switch (algorithm) { - // TODO add non-cryptographic algorithm here - case "debug": - return new DebugHash(); - case "xxhash64": - if (createXXHash64 === undefined) { - createXXHash64 = __webpack_require__(35028); - if (BatchedHash === undefined) { - BatchedHash = __webpack_require__(59461); - } - } - return new BatchedHash(createXXHash64()); - case "md4": - if (createMd4 === undefined) { - createMd4 = __webpack_require__(86884); - if (BatchedHash === undefined) { - BatchedHash = __webpack_require__(59461); - } + /** + * @param {string} context issuer directory + * @param {string} request request + * @param {ConsumeOptions} config options + * @returns {Promise} create module + */ + const createConsumeSharedModule = (context, request, config) => { + const requiredVersionWarning = details => { + const error = new WebpackError( + `No required version specified and unable to automatically determine one. ${details}` + ); + error.file = `shared module ${request}`; + compilation.warnings.push(error); + }; + const directFallback = + config.import && + /^(\.\.?(\/|$)|\/|[A-Za-z]:|\\\\)/.test(config.import); + return Promise.all([ + new Promise(resolve => { + if (!config.import) return resolve(); + const resolveContext = { + /** @type {LazySet} */ + fileDependencies: new LazySet(), + /** @type {LazySet} */ + contextDependencies: new LazySet(), + /** @type {LazySet} */ + missingDependencies: new LazySet() + }; + resolver.resolve( + {}, + directFallback ? compiler.context : context, + config.import, + resolveContext, + (err, result) => { + compilation.contextDependencies.addAll( + resolveContext.contextDependencies + ); + compilation.fileDependencies.addAll( + resolveContext.fileDependencies + ); + compilation.missingDependencies.addAll( + resolveContext.missingDependencies + ); + if (err) { + compilation.errors.push( + new ModuleNotFoundError(null, err, { + name: `resolving fallback for shared module ${request}` + }) + ); + return resolve(); + } + resolve(result); + } + ); + }), + new Promise(resolve => { + if (config.requiredVersion !== undefined) + return resolve(config.requiredVersion); + let packageName = config.packageName; + if (packageName === undefined) { + if (/^(\/|[A-Za-z]:|\\\\)/.test(request)) { + // For relative or absolute requests we don't automatically use a packageName. + // If wished one can specify one with the packageName option. + return resolve(); + } + const match = /^((?:@[^\\/]+[\\/])?[^\\/]+)/.exec(request); + if (!match) { + requiredVersionWarning( + "Unable to extract the package name from request." + ); + return resolve(); + } + packageName = match[0]; + } + + getDescriptionFile( + compilation.inputFileSystem, + context, + ["package.json"], + (err, result) => { + if (err) { + requiredVersionWarning( + `Unable to read description file: ${err}` + ); + return resolve(); + } + const { data, path: descriptionPath } = result; + if (!data) { + requiredVersionWarning( + `Unable to find description file in ${context}.` + ); + return resolve(); + } + const requiredVersion = getRequiredVersionFromDescriptionFile( + data, + packageName + ); + if (typeof requiredVersion !== "string") { + requiredVersionWarning( + `Unable to find required version for "${packageName}" in description file (${descriptionPath}). It need to be in dependencies, devDependencies or peerDependencies.` + ); + return resolve(); + } + resolve(parseRange(requiredVersion)); + } + ); + }) + ]).then(([importResolved, requiredVersion]) => { + return new ConsumeSharedModule( + directFallback ? compiler.context : context, + { + ...config, + importResolved, + import: importResolved ? config.import : undefined, + requiredVersion + } + ); + }); + }; + + normalModuleFactory.hooks.factorize.tapPromise( + PLUGIN_NAME, + ({ context, request, dependencies }) => + // wait for resolving to be complete + promise.then(() => { + if ( + dependencies[0] instanceof ConsumeSharedFallbackDependency || + dependencies[0] instanceof ProvideForSharedDependency + ) { + return; + } + const match = unresolvedConsumes.get(request); + if (match !== undefined) { + return createConsumeSharedModule(context, request, match); + } + for (const [prefix, options] of prefixedConsumes) { + if (request.startsWith(prefix)) { + const remainder = request.slice(prefix.length); + return createConsumeSharedModule(context, request, { + ...options, + import: options.import + ? options.import + remainder + : undefined, + shareKey: options.shareKey + remainder + }); + } + } + }) + ); + normalModuleFactory.hooks.createModule.tapPromise( + PLUGIN_NAME, + ({ resource }, { context, dependencies }) => { + if ( + dependencies[0] instanceof ConsumeSharedFallbackDependency || + dependencies[0] instanceof ProvideForSharedDependency + ) { + return Promise.resolve(); + } + const options = resolvedConsumes.get(resource); + if (options !== undefined) { + return createConsumeSharedModule(context, resource, options); + } + return Promise.resolve(); + } + ); + compilation.hooks.additionalTreeRuntimeRequirements.tap( + PLUGIN_NAME, + (chunk, set) => { + set.add(RuntimeGlobals.module); + set.add(RuntimeGlobals.moduleCache); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + set.add(RuntimeGlobals.shareScopeMap); + set.add(RuntimeGlobals.initializeSharing); + set.add(RuntimeGlobals.hasOwnProperty); + compilation.addRuntimeModule( + chunk, + new ConsumeSharedRuntimeModule(set) + ); + } + ); } - return new BatchedHash(createMd4()); - case "native-md4": - if (crypto === undefined) crypto = __webpack_require__(6113); - return new BulkUpdateDecorator(() => crypto.createHash("md4"), "md4"); - default: - if (crypto === undefined) crypto = __webpack_require__(6113); - return new BulkUpdateDecorator( - () => crypto.createHash(algorithm), - algorithm - ); + ); } -}; +} + +module.exports = ConsumeSharedPlugin; /***/ }), -/***/ 64518: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 10394: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -125233,269 +122413,407 @@ module.exports = algorithm => { -const util = __webpack_require__(73837); - -/** @type {Map} */ -const deprecationCache = new Map(); - -/** - * @typedef {Object} FakeHookMarker - * @property {true} _fakeHook it's a fake hook - */ - -/** @template T @typedef {T & FakeHookMarker} FakeHook */ - -/** - * @param {string} message deprecation message - * @param {string} code deprecation code - * @returns {Function} function to trigger deprecation - */ -const createDeprecation = (message, code) => { - const cached = deprecationCache.get(message); - if (cached !== undefined) return cached; - const fn = util.deprecate( - () => {}, - message, - "DEP_WEBPACK_DEPRECATION_" + code - ); - deprecationCache.set(message, fn); - return fn; -}; - -const COPY_METHODS = [ - "concat", - "entry", - "filter", - "find", - "findIndex", - "includes", - "indexOf", - "join", - "lastIndexOf", - "map", - "reduce", - "reduceRight", - "slice", - "some" -]; +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); +const { + parseVersionRuntimeCode, + versionLtRuntimeCode, + rangeToStringRuntimeCode, + satisfyRuntimeCode +} = __webpack_require__(19702); -const DISABLED_METHODS = [ - "copyWithin", - "entries", - "fill", - "keys", - "pop", - "reverse", - "shift", - "splice", - "sort", - "unshift" -]; +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("./ConsumeSharedModule")} ConsumeSharedModule */ -/** - * @param {any} set new set - * @param {string} name property name - * @returns {void} - */ -exports.arrayToSetDeprecation = (set, name) => { - for (const method of COPY_METHODS) { - if (set[method]) continue; - const d = createDeprecation( - `${name} was changed from Array to Set (using Array method '${method}' is deprecated)`, - "ARRAY_TO_SET" - ); - /** - * @deprecated - * @this {Set} - * @returns {number} count - */ - set[method] = function () { - d(); - const array = Array.from(this); - return Array.prototype[method].apply(array, arguments); - }; +class ConsumeSharedRuntimeModule extends RuntimeModule { + constructor(runtimeRequirements) { + super("consumes", RuntimeModule.STAGE_ATTACH); + this._runtimeRequirements = runtimeRequirements; } - const dPush = createDeprecation( - `${name} was changed from Array to Set (using Array method 'push' is deprecated)`, - "ARRAY_TO_SET_PUSH" - ); - const dLength = createDeprecation( - `${name} was changed from Array to Set (using Array property 'length' is deprecated)`, - "ARRAY_TO_SET_LENGTH" - ); - const dIndexer = createDeprecation( - `${name} was changed from Array to Set (indexing Array is deprecated)`, - "ARRAY_TO_SET_INDEXER" - ); + /** - * @deprecated - * @this {Set} - * @returns {number} count + * @returns {string} runtime code */ - set.push = function () { - dPush(); - for (const item of Array.from(arguments)) { - this.add(item); - } - return this.size; - }; - for (const method of DISABLED_METHODS) { - if (set[method]) continue; - set[method] = () => { - throw new Error( - `${name} was changed from Array to Set (using Array method '${method}' is not possible)` - ); - }; - } - const createIndexGetter = index => { + generate() { + const { compilation, chunkGraph } = this; + const { runtimeTemplate, codeGenerationResults } = compilation; + const chunkToModuleMapping = {}; + /** @type {Map} */ + const moduleIdToSourceMapping = new Map(); + const initialConsumes = []; /** - * @this {Set} a Set - * @returns {any} the value at this location + * + * @param {Iterable} modules modules + * @param {Chunk} chunk the chunk + * @param {(string | number)[]} list list of ids */ - const fn = function () { - dIndexer(); - let i = 0; - for (const item of this) { - if (i++ === index) return item; - } - return undefined; - }; - return fn; - }; - const defineIndexGetter = index => { - Object.defineProperty(set, index, { - get: createIndexGetter(index), - set(value) { - throw new Error( - `${name} was changed from Array to Set (indexing Array with write is not possible)` + const addModules = (modules, chunk, list) => { + for (const m of modules) { + const module = /** @type {ConsumeSharedModule} */ (m); + const id = chunkGraph.getModuleId(module); + list.push(id); + moduleIdToSourceMapping.set( + id, + codeGenerationResults.getSource( + module, + chunk.runtime, + "consume-shared" + ) ); } - }); - }; - defineIndexGetter(0); - let indexerDefined = 1; - Object.defineProperty(set, "length", { - get() { - dLength(); - const length = this.size; - for (indexerDefined; indexerDefined < length + 1; indexerDefined++) { - defineIndexGetter(indexerDefined); - } - return length; - }, - set(value) { - throw new Error( - `${name} was changed from Array to Set (writing to Array property 'length' is not possible)` + }; + for (const chunk of this.chunk.getAllAsyncChunks()) { + const modules = chunkGraph.getChunkModulesIterableBySourceType( + chunk, + "consume-shared" ); + if (!modules) continue; + addModules(modules, chunk, (chunkToModuleMapping[chunk.id] = [])); } - }); - set[Symbol.isConcatSpreadable] = true; -}; - -exports.createArrayToSetDeprecationSet = name => { - let initialized = false; - class SetDeprecatedArray extends Set { - constructor(items) { - super(items); - if (!initialized) { - initialized = true; - exports.arrayToSetDeprecation(SetDeprecatedArray.prototype, name); - } + for (const chunk of this.chunk.getAllInitialChunks()) { + const modules = chunkGraph.getChunkModulesIterableBySourceType( + chunk, + "consume-shared" + ); + if (!modules) continue; + addModules(modules, chunk, initialConsumes); } + if (moduleIdToSourceMapping.size === 0) return null; + return Template.asString([ + parseVersionRuntimeCode(runtimeTemplate), + versionLtRuntimeCode(runtimeTemplate), + rangeToStringRuntimeCode(runtimeTemplate), + satisfyRuntimeCode(runtimeTemplate), + `var ensureExistence = ${runtimeTemplate.basicFunction("scopeName, key", [ + `var scope = ${RuntimeGlobals.shareScopeMap}[scopeName];`, + `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) throw new Error("Shared module " + key + " doesn't exist in shared scope " + scopeName);`, + "return scope;" + ])};`, + `var findVersion = ${runtimeTemplate.basicFunction("scope, key", [ + "var versions = scope[key];", + `var key = Object.keys(versions).reduce(${runtimeTemplate.basicFunction( + "a, b", + ["return !a || versionLt(a, b) ? b : a;"] + )}, 0);`, + "return key && versions[key]" + ])};`, + `var findSingletonVersionKey = ${runtimeTemplate.basicFunction( + "scope, key", + [ + "var versions = scope[key];", + `return Object.keys(versions).reduce(${runtimeTemplate.basicFunction( + "a, b", + ["return !a || (!versions[a].loaded && versionLt(a, b)) ? b : a;"] + )}, 0);` + ] + )};`, + `var getInvalidSingletonVersionMessage = ${runtimeTemplate.basicFunction( + "scope, key, version, requiredVersion", + [ + `return "Unsatisfied version " + version + " from " + (version && scope[key][version].from) + " of shared singleton module " + key + " (required " + rangeToString(requiredVersion) + ")"` + ] + )};`, + `var getSingleton = ${runtimeTemplate.basicFunction( + "scope, scopeName, key, requiredVersion", + [ + "var version = findSingletonVersionKey(scope, key);", + "return get(scope[key][version]);" + ] + )};`, + `var getSingletonVersion = ${runtimeTemplate.basicFunction( + "scope, scopeName, key, requiredVersion", + [ + "var version = findSingletonVersionKey(scope, key);", + "if (!satisfy(requiredVersion, version)) " + + 'typeof console !== "undefined" && console.warn && console.warn(getInvalidSingletonVersionMessage(scope, key, version, requiredVersion));', + "return get(scope[key][version]);" + ] + )};`, + `var getStrictSingletonVersion = ${runtimeTemplate.basicFunction( + "scope, scopeName, key, requiredVersion", + [ + "var version = findSingletonVersionKey(scope, key);", + "if (!satisfy(requiredVersion, version)) " + + "throw new Error(getInvalidSingletonVersionMessage(scope, key, version, requiredVersion));", + "return get(scope[key][version]);" + ] + )};`, + `var findValidVersion = ${runtimeTemplate.basicFunction( + "scope, key, requiredVersion", + [ + "var versions = scope[key];", + `var key = Object.keys(versions).reduce(${runtimeTemplate.basicFunction( + "a, b", + [ + "if (!satisfy(requiredVersion, b)) return a;", + "return !a || versionLt(a, b) ? b : a;" + ] + )}, 0);`, + "return key && versions[key]" + ] + )};`, + `var getInvalidVersionMessage = ${runtimeTemplate.basicFunction( + "scope, scopeName, key, requiredVersion", + [ + "var versions = scope[key];", + 'return "No satisfying version (" + rangeToString(requiredVersion) + ") of shared module " + key + " found in shared scope " + scopeName + ".\\n" +', + `\t"Available versions: " + Object.keys(versions).map(${runtimeTemplate.basicFunction( + "key", + ['return key + " from " + versions[key].from;'] + )}).join(", ");` + ] + )};`, + `var getValidVersion = ${runtimeTemplate.basicFunction( + "scope, scopeName, key, requiredVersion", + [ + "var entry = findValidVersion(scope, key, requiredVersion);", + "if(entry) return get(entry);", + "throw new Error(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));" + ] + )};`, + `var warnInvalidVersion = ${runtimeTemplate.basicFunction( + "scope, scopeName, key, requiredVersion", + [ + 'typeof console !== "undefined" && console.warn && console.warn(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));' + ] + )};`, + `var get = ${runtimeTemplate.basicFunction("entry", [ + "entry.loaded = 1;", + "return entry.get()" + ])};`, + `var init = ${runtimeTemplate.returningFunction( + Template.asString([ + "function(scopeName, a, b, c) {", + Template.indent([ + `var promise = ${RuntimeGlobals.initializeSharing}(scopeName);`, + `if (promise && promise.then) return promise.then(fn.bind(fn, scopeName, ${RuntimeGlobals.shareScopeMap}[scopeName], a, b, c));`, + `return fn(scopeName, ${RuntimeGlobals.shareScopeMap}[scopeName], a, b, c);` + ]), + "}" + ]), + "fn" + )};`, + "", + `var load = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key", + [ + "ensureExistence(scopeName, key);", + "return get(findVersion(scope, key));" + ] + )});`, + `var loadFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, fallback", + [ + `return scope && ${RuntimeGlobals.hasOwnProperty}(scope, key) ? get(findVersion(scope, key)) : fallback();` + ] + )});`, + `var loadVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, version", + [ + "ensureExistence(scopeName, key);", + "return get(findValidVersion(scope, key, version) || warnInvalidVersion(scope, scopeName, key, version) || findVersion(scope, key));" + ] + )});`, + `var loadSingleton = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key", + [ + "ensureExistence(scopeName, key);", + "return getSingleton(scope, scopeName, key);" + ] + )});`, + `var loadSingletonVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, version", + [ + "ensureExistence(scopeName, key);", + "return getSingletonVersion(scope, scopeName, key, version);" + ] + )});`, + `var loadStrictVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, version", + [ + "ensureExistence(scopeName, key);", + "return getValidVersion(scope, scopeName, key, version);" + ] + )});`, + `var loadStrictSingletonVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, version", + [ + "ensureExistence(scopeName, key);", + "return getStrictSingletonVersion(scope, scopeName, key, version);" + ] + )});`, + `var loadVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, version, fallback", + [ + `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`, + "return get(findValidVersion(scope, key, version) || warnInvalidVersion(scope, scopeName, key, version) || findVersion(scope, key));" + ] + )});`, + `var loadSingletonFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, fallback", + [ + `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`, + "return getSingleton(scope, scopeName, key);" + ] + )});`, + `var loadSingletonVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, version, fallback", + [ + `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`, + "return getSingletonVersion(scope, scopeName, key, version);" + ] + )});`, + `var loadStrictVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, version, fallback", + [ + `var entry = scope && ${RuntimeGlobals.hasOwnProperty}(scope, key) && findValidVersion(scope, key, version);`, + `return entry ? get(entry) : fallback();` + ] + )});`, + `var loadStrictSingletonVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, version, fallback", + [ + `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`, + "return getStrictSingletonVersion(scope, scopeName, key, version);" + ] + )});`, + "var installedModules = {};", + "var moduleToHandlerMapping = {", + Template.indent( + Array.from( + moduleIdToSourceMapping, + ([key, source]) => `${JSON.stringify(key)}: ${source.source()}` + ).join(",\n") + ), + "};", + + initialConsumes.length > 0 + ? Template.asString([ + `var initialConsumes = ${JSON.stringify(initialConsumes)};`, + `initialConsumes.forEach(${runtimeTemplate.basicFunction("id", [ + `${ + RuntimeGlobals.moduleFactories + }[id] = ${runtimeTemplate.basicFunction("module", [ + "// Handle case when module is used sync", + "installedModules[id] = 0;", + `delete ${RuntimeGlobals.moduleCache}[id];`, + "var factory = moduleToHandlerMapping[id]();", + 'if(typeof factory !== "function") throw new Error("Shared module is not available for eager consumption: " + id);', + `module.exports = factory();` + ])}` + ])});` + ]) + : "// no consumes in initial chunks", + this._runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers) + ? Template.asString([ + `var chunkMapping = ${JSON.stringify( + chunkToModuleMapping, + null, + "\t" + )};`, + `${ + RuntimeGlobals.ensureChunkHandlers + }.consumes = ${runtimeTemplate.basicFunction("chunkId, promises", [ + `if(${RuntimeGlobals.hasOwnProperty}(chunkMapping, chunkId)) {`, + Template.indent([ + `chunkMapping[chunkId].forEach(${runtimeTemplate.basicFunction( + "id", + [ + `if(${RuntimeGlobals.hasOwnProperty}(installedModules, id)) return promises.push(installedModules[id]);`, + `var onFactory = ${runtimeTemplate.basicFunction( + "factory", + [ + "installedModules[id] = 0;", + `${ + RuntimeGlobals.moduleFactories + }[id] = ${runtimeTemplate.basicFunction("module", [ + `delete ${RuntimeGlobals.moduleCache}[id];`, + "module.exports = factory();" + ])}` + ] + )};`, + `var onError = ${runtimeTemplate.basicFunction("error", [ + "delete installedModules[id];", + `${ + RuntimeGlobals.moduleFactories + }[id] = ${runtimeTemplate.basicFunction("module", [ + `delete ${RuntimeGlobals.moduleCache}[id];`, + "throw error;" + ])}` + ])};`, + "try {", + Template.indent([ + "var promise = moduleToHandlerMapping[id]();", + "if(promise.then) {", + Template.indent( + "promises.push(installedModules[id] = promise.then(onFactory)['catch'](onError));" + ), + "} else onFactory(promise);" + ]), + "} catch(e) { onError(e); }" + ] + )});` + ]), + "}" + ])}` + ]) + : "// no chunk loading of consumes" + ]); } - return SetDeprecatedArray; -}; +} -exports.soonFrozenObjectDeprecation = (obj, name, code, note = "") => { - const message = `${name} will be frozen in future, all modifications are deprecated.${ - note && `\n${note}` - }`; - return new Proxy(obj, { - set: util.deprecate( - (target, property, value, receiver) => - Reflect.set(target, property, value, receiver), - message, - code - ), - defineProperty: util.deprecate( - (target, property, descriptor) => - Reflect.defineProperty(target, property, descriptor), - message, - code - ), - deleteProperty: util.deprecate( - (target, property) => Reflect.deleteProperty(target, property), - message, - code - ), - setPrototypeOf: util.deprecate( - (target, proto) => Reflect.setPrototypeOf(target, proto), - message, - code - ) - }); -}; +module.exports = ConsumeSharedRuntimeModule; -/** - * @template T - * @param {T} obj object - * @param {string} message deprecation message - * @param {string} code deprecation code - * @returns {T} object with property access deprecated - */ -const deprecateAllProperties = (obj, message, code) => { - const newObj = {}; - const descriptors = Object.getOwnPropertyDescriptors(obj); - for (const name of Object.keys(descriptors)) { - const descriptor = descriptors[name]; - if (typeof descriptor.value === "function") { - Object.defineProperty(newObj, name, { - ...descriptor, - value: util.deprecate(descriptor.value, message, code) - }); - } else if (descriptor.get || descriptor.set) { - Object.defineProperty(newObj, name, { - ...descriptor, - get: descriptor.get && util.deprecate(descriptor.get, message, code), - set: descriptor.set && util.deprecate(descriptor.set, message, code) - }); - } else { - let value = descriptor.value; - Object.defineProperty(newObj, name, { - configurable: descriptor.configurable, - enumerable: descriptor.enumerable, - get: util.deprecate(() => value, message, code), - set: descriptor.writable - ? util.deprecate(v => (value = v), message, code) - : undefined - }); - } + +/***/ }), + +/***/ 40017: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ModuleDependency = __webpack_require__(80321); +const makeSerializable = __webpack_require__(33032); + +class ProvideForSharedDependency extends ModuleDependency { + /** + * + * @param {string} request request string + */ + constructor(request) { + super(request); } - return /** @type {T} */ (newObj); -}; -exports.deprecateAllProperties = deprecateAllProperties; -/** - * @template T - * @param {T} fakeHook fake hook implementation - * @param {string=} message deprecation message (not deprecated when unset) - * @param {string=} code deprecation code (not deprecated when unset) - * @returns {FakeHook} fake hook which redirects - */ -exports.createFakeHook = (fakeHook, message, code) => { - if (message && code) { - fakeHook = deprecateAllProperties(fakeHook, message, code); + get type() { + return "provide module for shared"; } - return Object.freeze( - Object.assign(fakeHook, { _fakeHook: /** @type {true} */ (true) }) - ); -}; + + get category() { + return "esm"; + } +} + +makeSerializable( + ProvideForSharedDependency, + "webpack/lib/sharing/ProvideForSharedDependency" +); + +module.exports = ProvideForSharedDependency; /***/ }), -/***/ 59836: -/***/ (function(module) { +/***/ 1798: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -125505,539 +122823,648 @@ exports.createFakeHook = (fakeHook, message, code) => { -// Simulations show these probabilities for a single change -// 93.1% that one group is invalidated -// 4.8% that two groups are invalidated -// 1.1% that 3 groups are invalidated -// 0.1% that 4 or more groups are invalidated -// -// And these for removing/adding 10 lexically adjacent files -// 64.5% that one group is invalidated -// 24.8% that two groups are invalidated -// 7.8% that 3 groups are invalidated -// 2.7% that 4 or more groups are invalidated -// -// And these for removing/adding 3 random files -// 0% that one group is invalidated -// 3.7% that two groups are invalidated -// 80.8% that 3 groups are invalidated -// 12.3% that 4 groups are invalidated -// 3.2% that 5 or more groups are invalidated +const Dependency = __webpack_require__(54912); +const makeSerializable = __webpack_require__(33032); -/** - * - * @param {string} a key - * @param {string} b key - * @returns {number} the similarity as number - */ -const similarity = (a, b) => { - const l = Math.min(a.length, b.length); - let dist = 0; - for (let i = 0; i < l; i++) { - const ca = a.charCodeAt(i); - const cb = b.charCodeAt(i); - dist += Math.max(0, 10 - Math.abs(ca - cb)); +class ProvideSharedDependency extends Dependency { + constructor(shareScope, name, version, request, eager) { + super(); + this.shareScope = shareScope; + this.name = name; + this.version = version; + this.request = request; + this.eager = eager; } - return dist; -}; -/** - * @param {string} a key - * @param {string} b key - * @param {Set} usedNames set of already used names - * @returns {string} the common part and a single char for the difference - */ -const getName = (a, b, usedNames) => { - const l = Math.min(a.length, b.length); - let i = 0; - while (i < l) { - if (a.charCodeAt(i) !== b.charCodeAt(i)) { - i++; - break; - } - i++; + get type() { + return "provide shared module"; } - while (i < l) { - const name = a.slice(0, i); - const lowerName = name.toLowerCase(); - if (!usedNames.has(lowerName)) { - usedNames.add(lowerName); - return name; - } - i++; + + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + return `provide module (${this.shareScope}) ${this.request} as ${ + this.name + } @ ${this.version}${this.eager ? " (eager)" : ""}`; } - // names always contain a hash, so this is always unique - // we don't need to check usedNames nor add it - return a; -}; -/** - * @param {Record} total total size - * @param {Record} size single size - * @returns {void} - */ -const addSizeTo = (total, size) => { - for (const key of Object.keys(size)) { - total[key] = (total[key] || 0) + size[key]; + serialize(context) { + context.write(this.shareScope); + context.write(this.name); + context.write(this.request); + context.write(this.version); + context.write(this.eager); + super.serialize(context); } -}; -/** - * @param {Record} total total size - * @param {Record} size single size - * @returns {void} - */ -const subtractSizeFrom = (total, size) => { - for (const key of Object.keys(size)) { - total[key] -= size[key]; + static deserialize(context) { + const { read } = context; + const obj = new ProvideSharedDependency( + read(), + read(), + read(), + read(), + read() + ); + this.shareScope = context.read(); + obj.deserialize(context); + return obj; } -}; +} -/** - * @param {Iterable} nodes some nodes - * @returns {Record} total size - */ -const sumSize = nodes => { - const sum = Object.create(null); - for (const node of nodes) { - addSizeTo(sum, node.size); +makeSerializable( + ProvideSharedDependency, + "webpack/lib/sharing/ProvideSharedDependency" +); + +module.exports = ProvideSharedDependency; + + +/***/ }), + +/***/ 50821: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy +*/ + + + +const AsyncDependenciesBlock = __webpack_require__(47736); +const Module = __webpack_require__(73208); +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); +const ProvideForSharedDependency = __webpack_require__(40017); + +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ + +const TYPES = new Set(["share-init"]); + +class ProvideSharedModule extends Module { + /** + * @param {string} shareScope shared scope name + * @param {string} name shared key + * @param {string | false} version version + * @param {string} request request to the provided module + * @param {boolean} eager include the module in sync way + */ + constructor(shareScope, name, version, request, eager) { + super("provide-module"); + this._shareScope = shareScope; + this._name = name; + this._version = version; + this._request = request; + this._eager = eager; } - return sum; -}; -const isTooBig = (size, maxSize) => { - for (const key of Object.keys(size)) { - const s = size[key]; - if (s === 0) continue; - const maxSizeValue = maxSize[key]; - if (typeof maxSizeValue === "number") { - if (s > maxSizeValue) return true; - } + /** + * @returns {string} a unique identifier of the module + */ + identifier() { + return `provide module (${this._shareScope}) ${this._name}@${this._version} = ${this._request}`; } - return false; -}; -const isTooSmall = (size, minSize) => { - for (const key of Object.keys(size)) { - const s = size[key]; - if (s === 0) continue; - const minSizeValue = minSize[key]; - if (typeof minSizeValue === "number") { - if (s < minSizeValue) return true; - } + /** + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + return `provide shared module (${this._shareScope}) ${this._name}@${ + this._version + } = ${requestShortener.shorten(this._request)}`; } - return false; -}; -const getTooSmallTypes = (size, minSize) => { - const types = new Set(); - for (const key of Object.keys(size)) { - const s = size[key]; - if (s === 0) continue; - const minSizeValue = minSize[key]; - if (typeof minSizeValue === "number") { - if (s < minSizeValue) types.add(key); - } + /** + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion + */ + libIdent(options) { + return `${this.layer ? `(${this.layer})/` : ""}webpack/sharing/provide/${ + this._shareScope + }/${this._name}`; } - return types; -}; -const getNumberOfMatchingSizeTypes = (size, types) => { - let i = 0; - for (const key of Object.keys(size)) { - if (size[key] !== 0 && types.has(key)) i++; + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + callback(null, !this.buildInfo); } - return i; -}; -const selectiveSizeSum = (size, types) => { - let sum = 0; - for (const key of Object.keys(size)) { - if (size[key] !== 0 && types.has(key)) sum += size[key]; + /** + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + this.buildMeta = {}; + this.buildInfo = { + strict: true + }; + + this.clearDependenciesAndBlocks(); + const dep = new ProvideForSharedDependency(this._request); + if (this._eager) { + this.addDependency(dep); + } else { + const block = new AsyncDependenciesBlock({}); + block.addDependency(dep); + this.addBlock(block); + } + + callback(); } - return sum; -}; -/** - * @template T - */ -class Node { /** - * @param {T} item item - * @param {string} key key - * @param {Record} size size + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) */ - constructor(item, key, size) { - this.item = item; - this.key = key; - this.size = size; + size(type) { + return 42; } -} -/** - * @template T - */ -class Group { /** - * @param {Node[]} nodes nodes - * @param {number[]} similarities similarities between the nodes (length = nodes.length - 1) - * @param {Record=} size size of the group + * @returns {Set} types available (do not mutate) */ - constructor(nodes, similarities, size) { - this.nodes = nodes; - this.similarities = similarities; - this.size = size || sumSize(nodes); - /** @type {string} */ - this.key = undefined; + getSourceTypes() { + return TYPES; + } + + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { + const runtimeRequirements = new Set([RuntimeGlobals.initializeSharing]); + const code = `register(${JSON.stringify(this._name)}, ${JSON.stringify( + this._version || "0" + )}, ${ + this._eager + ? runtimeTemplate.syncModuleFactory({ + dependency: this.dependencies[0], + chunkGraph, + request: this._request, + runtimeRequirements + }) + : runtimeTemplate.asyncModuleFactory({ + block: this.blocks[0], + chunkGraph, + request: this._request, + runtimeRequirements + }) + }${this._eager ? ", 1" : ""});`; + const sources = new Map(); + const data = new Map(); + data.set("share-init", [ + { + shareScope: this._shareScope, + initStage: 10, + init: code + } + ]); + return { sources, data, runtimeRequirements }; } + serialize(context) { + const { write } = context; + write(this._shareScope); + write(this._name); + write(this._version); + write(this._request); + write(this._eager); + super.serialize(context); + } + + static deserialize(context) { + const { read } = context; + const obj = new ProvideSharedModule(read(), read(), read(), read(), read()); + obj.deserialize(context); + return obj; + } +} + +makeSerializable( + ProvideSharedModule, + "webpack/lib/sharing/ProvideSharedModule" +); + +module.exports = ProvideSharedModule; + + +/***/ }), + +/***/ 39344: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy +*/ + + + +const ModuleFactory = __webpack_require__(51010); +const ProvideSharedModule = __webpack_require__(50821); + +/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ +/** @typedef {import("../ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ +/** @typedef {import("./ProvideSharedDependency")} ProvideSharedDependency */ + +class ProvideSharedModuleFactory extends ModuleFactory { /** - * @param {function(Node): boolean} filter filter function - * @returns {Node[]} removed nodes + * @param {ModuleFactoryCreateData} data data object + * @param {function(Error=, ModuleFactoryResult=): void} callback callback + * @returns {void} */ - popNodes(filter) { - const newNodes = []; - const newSimilarities = []; - const resultNodes = []; - let lastNode; - for (let i = 0; i < this.nodes.length; i++) { - const node = this.nodes[i]; - if (filter(node)) { - resultNodes.push(node); - } else { - if (newNodes.length > 0) { - newSimilarities.push( - lastNode === this.nodes[i - 1] - ? this.similarities[i - 1] - : similarity(lastNode.key, node.key) - ); - } - newNodes.push(node); - lastNode = node; - } - } - if (resultNodes.length === this.nodes.length) return undefined; - this.nodes = newNodes; - this.similarities = newSimilarities; - this.size = sumSize(newNodes); - return resultNodes; + create(data, callback) { + const dep = /** @type {ProvideSharedDependency} */ (data.dependencies[0]); + callback(null, { + module: new ProvideSharedModule( + dep.shareScope, + dep.name, + dep.version, + dep.request, + dep.eager + ) + }); } } -/** - * @param {Iterable} nodes nodes - * @returns {number[]} similarities - */ -const getSimilarities = nodes => { - // calculate similarities between lexically adjacent nodes - /** @type {number[]} */ - const similarities = []; - let last = undefined; - for (const node of nodes) { - if (last !== undefined) { - similarities.push(similarity(last.key, node.key)); - } - last = node; - } - return similarities; -}; +module.exports = ProvideSharedModuleFactory; -/** - * @template T - * @typedef {Object} GroupedItems - * @property {string} key - * @property {T[]} items - * @property {Record} size - */ -/** - * @template T - * @typedef {Object} Options - * @property {Record} maxSize maximum size of a group - * @property {Record} minSize minimum size of a group (preferred over maximum size) - * @property {Iterable} items a list of items - * @property {function(T): Record} getSize function to get size of an item - * @property {function(T): string} getKey function to get the key of an item - */ +/***/ }), -/** - * @template T - * @param {Options} options options object - * @returns {GroupedItems[]} grouped items - */ -module.exports = ({ maxSize, minSize, items, getSize, getKey }) => { - /** @type {Group[]} */ - const result = []; +/***/ 31225: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const nodes = Array.from( - items, - item => new Node(item, getKey(item), getSize(item)) - ); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy +*/ - /** @type {Node[]} */ - const initialNodes = []; - // lexically ordering of keys - nodes.sort((a, b) => { - if (a.key < b.key) return -1; - if (a.key > b.key) return 1; - return 0; - }); - // return nodes bigger than maxSize directly as group - // But make sure that minSize is not violated - for (const node of nodes) { - if (isTooBig(node.size, maxSize) && !isTooSmall(node.size, minSize)) { - result.push(new Group([node], [])); - } else { - initialNodes.push(node); - } - } +const WebpackError = __webpack_require__(53799); +const { parseOptions } = __webpack_require__(3083); +const createSchemaValidation = __webpack_require__(32540); +const ProvideForSharedDependency = __webpack_require__(40017); +const ProvideSharedDependency = __webpack_require__(1798); +const ProvideSharedModuleFactory = __webpack_require__(39344); - if (initialNodes.length > 0) { - const initialGroup = new Group(initialNodes, getSimilarities(initialNodes)); +/** @typedef {import("../../declarations/plugins/sharing/ProvideSharedPlugin").ProvideSharedPluginOptions} ProvideSharedPluginOptions */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Compiler")} Compiler */ - const removeProblematicNodes = (group, consideredSize = group.size) => { - const problemTypes = getTooSmallTypes(consideredSize, minSize); - if (problemTypes.size > 0) { - // We hit an edge case where the working set is already smaller than minSize - // We merge problematic nodes with the smallest result node to keep minSize intact - const problemNodes = group.popNodes( - n => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0 - ); - if (problemNodes === undefined) return false; - // Only merge it with result nodes that have the problematic size type - const possibleResultGroups = result.filter( - n => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0 - ); - if (possibleResultGroups.length > 0) { - const bestGroup = possibleResultGroups.reduce((min, group) => { - const minMatches = getNumberOfMatchingSizeTypes(min, problemTypes); - const groupMatches = getNumberOfMatchingSizeTypes( - group, - problemTypes - ); - if (minMatches !== groupMatches) - return minMatches < groupMatches ? group : min; - if ( - selectiveSizeSum(min.size, problemTypes) > - selectiveSizeSum(group.size, problemTypes) - ) - return group; - return min; - }); - for (const node of problemNodes) bestGroup.nodes.push(node); - bestGroup.nodes.sort((a, b) => { - if (a.key < b.key) return -1; - if (a.key > b.key) return 1; - return 0; - }); - } else { - // There are no other nodes with the same size types - // We create a new group and have to accept that it's smaller than minSize - result.push(new Group(problemNodes, null)); - } - return true; - } else { - return false; - } - }; +const validate = createSchemaValidation( + __webpack_require__(91924), + () => __webpack_require__(438), + { + name: "Provide Shared Plugin", + baseDataPath: "options" + } +); - if (initialGroup.nodes.length > 0) { - const queue = [initialGroup]; +/** + * @typedef {Object} ProvideOptions + * @property {string} shareKey + * @property {string} shareScope + * @property {string | undefined | false} version + * @property {boolean} eager + */ - while (queue.length) { - const group = queue.pop(); - // only groups bigger than maxSize need to be splitted - if (!isTooBig(group.size, maxSize)) { - result.push(group); - continue; - } - // If the group is already too small - // we try to work only with the unproblematic nodes - if (removeProblematicNodes(group)) { - // This changed something, so we try this group again - queue.push(group); - continue; - } +/** @typedef {Map} ResolvedProvideMap */ - // find unsplittable area from left and right - // going minSize from left and right - // at least one node need to be included otherwise we get stuck - let left = 1; - let leftSize = Object.create(null); - addSizeTo(leftSize, group.nodes[0].size); - while (left < group.nodes.length && isTooSmall(leftSize, minSize)) { - addSizeTo(leftSize, group.nodes[left].size); - left++; - } - let right = group.nodes.length - 2; - let rightSize = Object.create(null); - addSizeTo(rightSize, group.nodes[group.nodes.length - 1].size); - while (right >= 0 && isTooSmall(rightSize, minSize)) { - addSizeTo(rightSize, group.nodes[right].size); - right--; - } +class ProvideSharedPlugin { + /** + * @param {ProvideSharedPluginOptions} options options + */ + constructor(options) { + validate(options); - // left v v right - // [ O O O ] O O O [ O O O ] - // ^^^^^^^^^ leftSize - // rightSize ^^^^^^^^^ - // leftSize > minSize - // rightSize > minSize + /** @type {[string, ProvideOptions][]} */ + this._provides = parseOptions( + options.provides, + item => { + if (Array.isArray(item)) + throw new Error("Unexpected array of provides"); + /** @type {ProvideOptions} */ + const result = { + shareKey: item, + version: undefined, + shareScope: options.shareScope || "default", + eager: false + }; + return result; + }, + item => ({ + shareKey: item.shareKey, + version: item.version, + shareScope: item.shareScope || options.shareScope || "default", + eager: !!item.eager + }) + ); + this._provides.sort(([a], [b]) => { + if (a < b) return -1; + if (b < a) return 1; + return 0; + }); + } - // Perfect split: [ O O O ] [ O O O ] - // right === left - 1 + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + /** @type {WeakMap} */ + const compilationData = new WeakMap(); - if (left - 1 > right) { - // We try to remove some problematic nodes to "fix" that - let prevSize; - if (right < group.nodes.length - left) { - subtractSizeFrom(rightSize, group.nodes[right + 1].size); - prevSize = rightSize; + compiler.hooks.compilation.tap( + "ProvideSharedPlugin", + (compilation, { normalModuleFactory }) => { + /** @type {ResolvedProvideMap} */ + const resolvedProvideMap = new Map(); + /** @type {Map} */ + const matchProvides = new Map(); + /** @type {Map} */ + const prefixMatchProvides = new Map(); + for (const [request, config] of this._provides) { + if (/^(\/|[A-Za-z]:\\|\\\\|\.\.?(\/|$))/.test(request)) { + // relative request + resolvedProvideMap.set(request, { + config, + version: config.version + }); + } else if (/^(\/|[A-Za-z]:\\|\\\\)/.test(request)) { + // absolute path + resolvedProvideMap.set(request, { + config, + version: config.version + }); + } else if (request.endsWith("/")) { + // module request prefix + prefixMatchProvides.set(request, config); } else { - subtractSizeFrom(leftSize, group.nodes[left - 1].size); - prevSize = leftSize; - } - if (removeProblematicNodes(group, prevSize)) { - // This changed something, so we try this group again - queue.push(group); - continue; + // module request + matchProvides.set(request, config); } - // can't split group while holding minSize - // because minSize is preferred of maxSize we return - // the problematic nodes as result here even while it's too big - // To avoid this make sure maxSize > minSize * 3 - result.push(group); - continue; } - if (left <= right) { - // when there is a area between left and right - // we look for best split point - // we split at the minimum similarity - // here key space is separated the most - // But we also need to make sure to not create too small groups - let best = -1; - let bestSimilarity = Infinity; - let pos = left; - let rightSize = sumSize(group.nodes.slice(pos)); - - // pos v v right - // [ O O O ] O O O [ O O O ] - // ^^^^^^^^^ leftSize - // rightSize ^^^^^^^^^^^^^^^ - - while (pos <= right + 1) { - const similarity = group.similarities[pos - 1]; - if ( - similarity < bestSimilarity && - !isTooSmall(leftSize, minSize) && - !isTooSmall(rightSize, minSize) - ) { - best = pos; - bestSimilarity = similarity; + compilationData.set(compilation, resolvedProvideMap); + const provideSharedModule = ( + key, + config, + resource, + resourceResolveData + ) => { + let version = config.version; + if (version === undefined) { + let details = ""; + if (!resourceResolveData) { + details = `No resolve data provided from resolver.`; + } else { + const descriptionFileData = + resourceResolveData.descriptionFileData; + if (!descriptionFileData) { + details = + "No description file (usually package.json) found. Add description file with name and version, or manually specify version in shared config."; + } else if (!descriptionFileData.version) { + details = + "No version in description file (usually package.json). Add version to description file, or manually specify version in shared config."; + } else { + version = descriptionFileData.version; + } + } + if (!version) { + const error = new WebpackError( + `No version specified and unable to automatically determine one. ${details}` + ); + error.file = `shared module ${key} -> ${resource}`; + compilation.warnings.push(error); } - addSizeTo(leftSize, group.nodes[pos].size); - subtractSizeFrom(rightSize, group.nodes[pos].size); - pos++; } - if (best < 0) { - // This can't happen - // but if that assumption is wrong - // fallback to a big group - result.push(group); - continue; + resolvedProvideMap.set(resource, { + config, + version + }); + }; + normalModuleFactory.hooks.module.tap( + "ProvideSharedPlugin", + (module, { resource, resourceResolveData }, resolveData) => { + if (resolvedProvideMap.has(resource)) { + return module; + } + const { request } = resolveData; + { + const config = matchProvides.get(request); + if (config !== undefined) { + provideSharedModule( + request, + config, + resource, + resourceResolveData + ); + resolveData.cacheable = false; + } + } + for (const [prefix, config] of prefixMatchProvides) { + if (request.startsWith(prefix)) { + const remainder = request.slice(prefix.length); + provideSharedModule( + resource, + { + ...config, + shareKey: config.shareKey + remainder + }, + resource, + resourceResolveData + ); + resolveData.cacheable = false; + } + } + return module; } - left = best; - right = best - 1; - } - - // create two new groups for left and right area - // and queue them up - const rightNodes = [group.nodes[right + 1]]; - /** @type {number[]} */ - const rightSimilarities = []; - for (let i = right + 2; i < group.nodes.length; i++) { - rightSimilarities.push(group.similarities[i - 1]); - rightNodes.push(group.nodes[i]); - } - queue.push(new Group(rightNodes, rightSimilarities)); - - const leftNodes = [group.nodes[0]]; - /** @type {number[]} */ - const leftSimilarities = []; - for (let i = 1; i < left; i++) { - leftSimilarities.push(group.similarities[i - 1]); - leftNodes.push(group.nodes[i]); - } - queue.push(new Group(leftNodes, leftSimilarities)); + ); } - } - } - - // lexically ordering - result.sort((a, b) => { - if (a.nodes[0].key < b.nodes[0].key) return -1; - if (a.nodes[0].key > b.nodes[0].key) return 1; - return 0; - }); + ); + compiler.hooks.finishMake.tapPromise("ProvideSharedPlugin", compilation => { + const resolvedProvideMap = compilationData.get(compilation); + if (!resolvedProvideMap) return Promise.resolve(); + return Promise.all( + Array.from( + resolvedProvideMap, + ([resource, { config, version }]) => + new Promise((resolve, reject) => { + compilation.addInclude( + compiler.context, + new ProvideSharedDependency( + config.shareScope, + config.shareKey, + version || false, + resource, + config.eager + ), + { + name: undefined + }, + err => { + if (err) return reject(err); + resolve(); + } + ); + }) + ) + ).then(() => {}); + }); - // give every group a name - const usedNames = new Set(); - for (let i = 0; i < result.length; i++) { - const group = result[i]; - if (group.nodes.length === 1) { - group.key = group.nodes[0].key; - } else { - const first = group.nodes[0]; - const last = group.nodes[group.nodes.length - 1]; - const name = getName(first.key, last.key, usedNames); - group.key = name; - } + compiler.hooks.compilation.tap( + "ProvideSharedPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + ProvideForSharedDependency, + normalModuleFactory + ); + + compilation.dependencyFactories.set( + ProvideSharedDependency, + new ProvideSharedModuleFactory() + ); + } + ); } +} - // return the results - return result.map(group => { - /** @type {GroupedItems} */ - return { - key: group.key, - items: group.nodes.map(node => node.item), - size: group.size - }; - }); -}; +module.exports = ProvideSharedPlugin; /***/ }), -/***/ 11850: -/***/ (function(module) { +/***/ 26335: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Sam Chen @chenxsan + Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy */ -/** - * @param {string} urlAndGlobal the script request - * @returns {string[]} script url and its global variable - */ -module.exports = function extractUrlAndGlobal(urlAndGlobal) { - const index = urlAndGlobal.indexOf("@"); - if (index <= 0 || index === urlAndGlobal.length - 1) { - throw new Error(`Invalid request "${urlAndGlobal}"`); +const { parseOptions } = __webpack_require__(3083); +const ConsumeSharedPlugin = __webpack_require__(15046); +const ProvideSharedPlugin = __webpack_require__(31225); +const { isRequiredVersion } = __webpack_require__(84379); + +/** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumeSharedPluginOptions} ConsumeSharedPluginOptions */ +/** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumesConfig} ConsumesConfig */ +/** @typedef {import("../../declarations/plugins/sharing/ProvideSharedPlugin").ProvideSharedPluginOptions} ProvideSharedPluginOptions */ +/** @typedef {import("../../declarations/plugins/sharing/ProvideSharedPlugin").ProvidesConfig} ProvidesConfig */ +/** @typedef {import("../../declarations/plugins/sharing/SharePlugin").SharePluginOptions} SharePluginOptions */ +/** @typedef {import("../../declarations/plugins/sharing/SharePlugin").SharedConfig} SharedConfig */ +/** @typedef {import("../Compiler")} Compiler */ + +class SharePlugin { + /** + * @param {SharePluginOptions} options options + */ + constructor(options) { + /** @type {[string, SharedConfig][]} */ + const sharedOptions = parseOptions( + options.shared, + (item, key) => { + if (typeof item !== "string") + throw new Error("Unexpected array in shared"); + /** @type {SharedConfig} */ + const config = + item === key || !isRequiredVersion(item) + ? { + import: item + } + : { + import: key, + requiredVersion: item + }; + return config; + }, + item => item + ); + /** @type {Record[]} */ + const consumes = sharedOptions.map(([key, options]) => ({ + [key]: { + import: options.import, + shareKey: options.shareKey || key, + shareScope: options.shareScope, + requiredVersion: options.requiredVersion, + strictVersion: options.strictVersion, + singleton: options.singleton, + packageName: options.packageName, + eager: options.eager + } + })); + /** @type {Record[]} */ + const provides = sharedOptions + .filter(([, options]) => options.import !== false) + .map(([key, options]) => ({ + [options.import || key]: { + shareKey: options.shareKey || key, + shareScope: options.shareScope, + version: options.version, + eager: options.eager + } + })); + this._shareScope = options.shareScope; + this._consumes = consumes; + this._provides = provides; } - return [urlAndGlobal.substring(index + 1), urlAndGlobal.substring(0, index)]; -}; + + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + new ConsumeSharedPlugin({ + shareScope: this._shareScope, + consumes: this._consumes + }).apply(compiler); + new ProvideSharedPlugin({ + shareScope: this._shareScope, + provides: this._provides + }).apply(compiler); + } +} + +module.exports = SharePlugin; /***/ }), -/***/ 6261: -/***/ (function(module) { +/***/ 96066: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -126047,234 +123474,343 @@ module.exports = function extractUrlAndGlobal(urlAndGlobal) { -const NO_MARKER = 0; -const IN_PROGRESS_MARKER = 1; -const DONE_MARKER = 2; -const DONE_MAYBE_ROOT_CYCLE_MARKER = 3; -const DONE_AND_ROOT_MARKER = 4; +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); +const { + compareModulesByIdentifier, + compareStrings +} = __webpack_require__(29579); + +class ShareRuntimeModule extends RuntimeModule { + constructor() { + super("sharing"); + } -/** - * @template T - */ -class Node { /** - * @param {T} item the value of the node + * @returns {string} runtime code */ - constructor(item) { - this.item = item; - /** @type {Set>} */ - this.dependencies = new Set(); - this.marker = NO_MARKER; - /** @type {Cycle | undefined} */ - this.cycle = undefined; - this.incoming = 0; + generate() { + const { compilation, chunkGraph } = this; + const { + runtimeTemplate, + codeGenerationResults, + outputOptions: { uniqueName } + } = compilation; + /** @type {Map>>} */ + const initCodePerScope = new Map(); + for (const chunk of this.chunk.getAllReferencedChunks()) { + const modules = chunkGraph.getOrderedChunkModulesIterableBySourceType( + chunk, + "share-init", + compareModulesByIdentifier + ); + if (!modules) continue; + for (const m of modules) { + const data = codeGenerationResults.getData( + m, + chunk.runtime, + "share-init" + ); + if (!data) continue; + for (const item of data) { + const { shareScope, initStage, init } = item; + let stages = initCodePerScope.get(shareScope); + if (stages === undefined) { + initCodePerScope.set(shareScope, (stages = new Map())); + } + let list = stages.get(initStage || 0); + if (list === undefined) { + stages.set(initStage || 0, (list = new Set())); + } + list.add(init); + } + } + } + return Template.asString([ + `${RuntimeGlobals.shareScopeMap} = {};`, + "var initPromises = {};", + "var initTokens = {};", + `${RuntimeGlobals.initializeSharing} = ${runtimeTemplate.basicFunction( + "name, initScope", + [ + "if(!initScope) initScope = [];", + "// handling circular init calls", + "var initToken = initTokens[name];", + "if(!initToken) initToken = initTokens[name] = {};", + "if(initScope.indexOf(initToken) >= 0) return;", + "initScope.push(initToken);", + "// only runs once", + "if(initPromises[name]) return initPromises[name];", + "// creates a new share scope if needed", + `if(!${RuntimeGlobals.hasOwnProperty}(${RuntimeGlobals.shareScopeMap}, name)) ${RuntimeGlobals.shareScopeMap}[name] = {};`, + "// runs all init snippets from all modules reachable", + `var scope = ${RuntimeGlobals.shareScopeMap}[name];`, + `var warn = ${runtimeTemplate.returningFunction( + 'typeof console !== "undefined" && console.warn && console.warn(msg)', + "msg" + )};`, + `var uniqueName = ${JSON.stringify(uniqueName || undefined)};`, + `var register = ${runtimeTemplate.basicFunction( + "name, version, factory, eager", + [ + "var versions = scope[name] = scope[name] || {};", + "var activeVersion = versions[version];", + "if(!activeVersion || (!activeVersion.loaded && (!eager != !activeVersion.eager ? eager : uniqueName > activeVersion.from))) versions[version] = { get: factory, from: uniqueName, eager: !!eager };" + ] + )};`, + `var initExternal = ${runtimeTemplate.basicFunction("id", [ + `var handleError = ${runtimeTemplate.expressionFunction( + 'warn("Initialization of sharing external failed: " + err)', + "err" + )};`, + "try {", + Template.indent([ + "var module = __webpack_require__(id);", + "if(!module) return;", + `var initFn = ${runtimeTemplate.returningFunction( + `module && module.init && module.init(${RuntimeGlobals.shareScopeMap}[name], initScope)`, + "module" + )}`, + "if(module.then) return promises.push(module.then(initFn, handleError));", + "var initResult = initFn(module);", + "if(initResult && initResult.then) return promises.push(initResult['catch'](handleError));" + ]), + "} catch(err) { handleError(err); }" + ])}`, + "var promises = [];", + "switch(name) {", + ...Array.from(initCodePerScope) + .sort(([a], [b]) => compareStrings(a, b)) + .map(([name, stages]) => + Template.indent([ + `case ${JSON.stringify(name)}: {`, + Template.indent( + Array.from(stages) + .sort(([a], [b]) => a - b) + .map(([, initCode]) => + Template.asString(Array.from(initCode)) + ) + ), + "}", + "break;" + ]) + ), + "}", + "if(!promises.length) return initPromises[name] = 1;", + `return initPromises[name] = Promise.all(promises).then(${runtimeTemplate.returningFunction( + "initPromises[name] = 1" + )});` + ] + )};` + ]); } } -/** - * @template T - */ -class Cycle { - constructor() { - /** @type {Set>} */ - this.nodes = new Set(); - } -} +module.exports = ShareRuntimeModule; + + +/***/ }), + +/***/ 3591: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ModuleNotFoundError = __webpack_require__(32882); +const LazySet = __webpack_require__(38938); + +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../ResolverFactory").ResolveOptionsWithDependencyType} ResolveOptionsWithDependencyType */ /** * @template T - * @typedef {Object} StackEntry - * @property {Node} node - * @property {Node[]} openEdges + * @typedef {Object} MatchedConfigs + * @property {Map} resolved + * @property {Map} unresolved + * @property {Map} prefixed */ +/** @type {ResolveOptionsWithDependencyType} */ +const RESOLVE_OPTIONS = { dependencyType: "esm" }; + /** * @template T - * @param {Iterable} items list of items - * @param {function(T): Iterable} getDependencies function to get dependencies of an item (items that are not in list are ignored) - * @returns {Iterable} graph roots of the items + * @param {Compilation} compilation the compilation + * @param {[string, T][]} configs to be processed configs + * @returns {Promise>} resolved matchers */ -module.exports = (items, getDependencies) => { - /** @type {Map>} */ - const itemToNode = new Map(); - for (const item of items) { - const node = new Node(item); - itemToNode.set(item, node); - } - - // early exit when there is only a single item - if (itemToNode.size <= 1) return items; +exports.resolveMatchedConfigs = (compilation, configs) => { + /** @type {Map} */ + const resolved = new Map(); + /** @type {Map} */ + const unresolved = new Map(); + /** @type {Map} */ + const prefixed = new Map(); + const resolveContext = { + /** @type {LazySet} */ + fileDependencies: new LazySet(), + /** @type {LazySet} */ + contextDependencies: new LazySet(), + /** @type {LazySet} */ + missingDependencies: new LazySet() + }; + const resolver = compilation.resolverFactory.get("normal", RESOLVE_OPTIONS); + const context = compilation.compiler.context; - // grab all the dependencies - for (const node of itemToNode.values()) { - for (const dep of getDependencies(node.item)) { - const depNode = itemToNode.get(dep); - if (depNode !== undefined) { - node.dependencies.add(depNode); + return Promise.all( + configs.map(([request, config]) => { + if (/^\.\.?(\/|$)/.test(request)) { + // relative request + return new Promise(resolve => { + resolver.resolve( + {}, + context, + request, + resolveContext, + (err, result) => { + if (err || result === false) { + err = err || new Error(`Can't resolve ${request}`); + compilation.errors.push( + new ModuleNotFoundError(null, err, { + name: `shared module ${request}` + }) + ); + return resolve(); + } + resolved.set(result, config); + resolve(); + } + ); + }); + } else if (/^(\/|[A-Za-z]:\\|\\\\)/.test(request)) { + // absolute path + resolved.set(request, config); + } else if (request.endsWith("/")) { + // module request prefix + prefixed.set(request, config); + } else { + // module request + unresolved.set(request, config); } - } - } + }) + ).then(() => { + compilation.contextDependencies.addAll(resolveContext.contextDependencies); + compilation.fileDependencies.addAll(resolveContext.fileDependencies); + compilation.missingDependencies.addAll(resolveContext.missingDependencies); + return { resolved, unresolved, prefixed }; + }); +}; - // Set of current root modules - // items will be removed if a new reference to it has been found - /** @type {Set>} */ - const roots = new Set(); - // Set of current cycles without references to it - // cycles will be removed if a new reference to it has been found - // that is not part of the cycle - /** @type {Set>} */ - const rootCycles = new Set(); +/***/ }), - // For all non-marked nodes - for (const selectedNode of itemToNode.values()) { - if (selectedNode.marker === NO_MARKER) { - // deep-walk all referenced modules - // in a non-recursive way +/***/ 84379: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - // start by entering the selected node - selectedNode.marker = IN_PROGRESS_MARKER; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // keep a stack to avoid recursive walk - /** @type {StackEntry[]} */ - const stack = [ - { - node: selectedNode, - openEdges: Array.from(selectedNode.dependencies) - } - ]; - // process the top item until stack is empty - while (stack.length > 0) { - const topOfStack = stack[stack.length - 1]; - // Are there still edges unprocessed in the current node? - if (topOfStack.openEdges.length > 0) { - // Process one dependency - const dependency = topOfStack.openEdges.pop(); - switch (dependency.marker) { - case NO_MARKER: - // dependency has not be visited yet - // mark it as in-progress and recurse - stack.push({ - node: dependency, - openEdges: Array.from(dependency.dependencies) - }); - dependency.marker = IN_PROGRESS_MARKER; - break; - case IN_PROGRESS_MARKER: { - // It's a in-progress cycle - let cycle = dependency.cycle; - if (!cycle) { - cycle = new Cycle(); - cycle.nodes.add(dependency); - dependency.cycle = cycle; - } - // set cycle property for each node in the cycle - // if nodes are already part of a cycle - // we merge the cycles to a shared cycle - for ( - let i = stack.length - 1; - stack[i].node !== dependency; - i-- - ) { - const node = stack[i].node; - if (node.cycle) { - if (node.cycle !== cycle) { - // merge cycles - for (const cycleNode of node.cycle.nodes) { - cycleNode.cycle = cycle; - cycle.nodes.add(cycleNode); - } - } - } else { - node.cycle = cycle; - cycle.nodes.add(node); - } - } - // don't recurse into dependencies - // these are already on the stack - break; - } - case DONE_AND_ROOT_MARKER: - // This node has be visited yet and is currently a root node - // But as this is a new reference to the node - // it's not really a root - // so we have to convert it to a normal node - dependency.marker = DONE_MARKER; - roots.delete(dependency); - break; - case DONE_MAYBE_ROOT_CYCLE_MARKER: - // This node has be visited yet and - // is maybe currently part of a completed root cycle - // we found a new reference to the cycle - // so it's not really a root cycle - // remove the cycle from the root cycles - // and convert it to a normal node - rootCycles.delete(dependency.cycle); - dependency.marker = DONE_MARKER; - break; - // DONE_MARKER: nothing to do, don't recurse into dependencies - } - } else { - // All dependencies of the current node has been visited - // we leave the node - stack.pop(); - topOfStack.node.marker = DONE_MARKER; +const { join, dirname, readJson } = __webpack_require__(17139); + +/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ + +/** + * @param {string} str maybe required version + * @returns {boolean} true, if it looks like a version + */ +exports.isRequiredVersion = str => { + return /^([\d^=v<>~]|[*xX]$)/.test(str); +}; + +/** + * + * @param {InputFileSystem} fs file system + * @param {string} directory directory to start looking into + * @param {string[]} descriptionFiles possible description filenames + * @param {function((Error | null)=, {data: object, path: string}=): void} callback callback + */ +const getDescriptionFile = (fs, directory, descriptionFiles, callback) => { + let i = 0; + const tryLoadCurrent = () => { + if (i >= descriptionFiles.length) { + const parentDirectory = dirname(fs, directory); + if (!parentDirectory || parentDirectory === directory) return callback(); + return getDescriptionFile( + fs, + parentDirectory, + descriptionFiles, + callback + ); + } + const filePath = join(fs, directory, descriptionFiles[i]); + readJson(fs, filePath, (err, data) => { + if (err) { + if ("code" in err && err.code === "ENOENT") { + i++; + return tryLoadCurrent(); } + return callback(err); } - const cycle = selectedNode.cycle; - if (cycle) { - for (const node of cycle.nodes) { - node.marker = DONE_MAYBE_ROOT_CYCLE_MARKER; - } - rootCycles.add(cycle); - } else { - selectedNode.marker = DONE_AND_ROOT_MARKER; - roots.add(selectedNode); + if (!data || typeof data !== "object" || Array.isArray(data)) { + return callback( + new Error(`Description file ${filePath} is not an object`) + ); } - } - } + callback(null, { data, path: filePath }); + }); + }; + tryLoadCurrent(); +}; +exports.getDescriptionFile = getDescriptionFile; - // Extract roots from root cycles - // We take the nodes with most incoming edges - // inside of the cycle - for (const cycle of rootCycles) { - let max = 0; - /** @type {Set>} */ - const cycleRoots = new Set(); - const nodes = cycle.nodes; - for (const node of nodes) { - for (const dep of node.dependencies) { - if (nodes.has(dep)) { - dep.incoming++; - if (dep.incoming < max) continue; - if (dep.incoming > max) { - cycleRoots.clear(); - max = dep.incoming; - } - cycleRoots.add(dep); - } - } - } - for (const cycleRoot of cycleRoots) { - roots.add(cycleRoot); - } +exports.getRequiredVersionFromDescriptionFile = (data, packageName) => { + if ( + data.optionalDependencies && + typeof data.optionalDependencies === "object" && + packageName in data.optionalDependencies + ) { + return data.optionalDependencies[packageName]; } - - // When roots were found, return them - if (roots.size > 0) { - return Array.from(roots, r => r.item); - } else { - throw new Error("Implementation of findGraphRoots is broken"); + if ( + data.dependencies && + typeof data.dependencies === "object" && + packageName in data.dependencies + ) { + return data.dependencies[packageName]; + } + if ( + data.peerDependencies && + typeof data.peerDependencies === "object" && + packageName in data.peerDependencies + ) { + return data.peerDependencies[packageName]; + } + if ( + data.devDependencies && + typeof data.devDependencies === "object" && + packageName in data.devDependencies + ) { + return data.devDependencies[packageName]; } }; /***/ }), -/***/ 17139: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 71760: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -126284,3168 +123820,4125 @@ module.exports = (items, getDependencies) => { -const path = __webpack_require__(71017); +const util = __webpack_require__(73837); +const ModuleDependency = __webpack_require__(80321); +const formatLocation = __webpack_require__(16734); +const { LogType } = __webpack_require__(32597); +const AggressiveSplittingPlugin = __webpack_require__(15543); +const SizeLimitsPlugin = __webpack_require__(32557); +const { countIterable } = __webpack_require__(39104); +const { + compareLocations, + compareChunksById, + compareNumbers, + compareIds, + concatComparators, + compareSelect, + compareModulesByIdentifier +} = __webpack_require__(29579); +const { makePathsRelative, parseResource } = __webpack_require__(82186); -/** @typedef {import("../../declarations/WebpackOptions").WatchOptions} WatchOptions */ -/** @typedef {import("../FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ +/** @typedef {import("../ChunkGroup").OriginRecord} OriginRecord */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Compilation").Asset} Asset */ +/** @typedef {import("../Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("../Compilation").NormalizedStatsOptions} NormalizedStatsOptions */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("../ModuleProfile")} ModuleProfile */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @template T @typedef {import("../util/comparators").Comparator} Comparator */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +/** @typedef {import("../util/smartGrouping").GroupConfig} GroupConfig */ +/** @typedef {import("./StatsFactory")} StatsFactory */ +/** @typedef {import("./StatsFactory").StatsFactoryContext} StatsFactoryContext */ +/** @typedef {KnownStatsCompilation & Record} StatsCompilation */ /** - * @typedef {Object} IStats - * @property {() => boolean} isFile - * @property {() => boolean} isDirectory - * @property {() => boolean} isBlockDevice - * @property {() => boolean} isCharacterDevice - * @property {() => boolean} isSymbolicLink - * @property {() => boolean} isFIFO - * @property {() => boolean} isSocket - * @property {number | bigint} dev - * @property {number | bigint} ino - * @property {number | bigint} mode - * @property {number | bigint} nlink - * @property {number | bigint} uid - * @property {number | bigint} gid - * @property {number | bigint} rdev - * @property {number | bigint} size - * @property {number | bigint} blksize - * @property {number | bigint} blocks - * @property {number | bigint} atimeMs - * @property {number | bigint} mtimeMs - * @property {number | bigint} ctimeMs - * @property {number | bigint} birthtimeMs - * @property {Date} atime - * @property {Date} mtime - * @property {Date} ctime - * @property {Date} birthtime + * @typedef {Object} KnownStatsCompilation + * @property {any=} env + * @property {string=} name + * @property {string=} hash + * @property {string=} version + * @property {number=} time + * @property {number=} builtAt + * @property {boolean=} needAdditionalPass + * @property {string=} publicPath + * @property {string=} outputPath + * @property {Record=} assetsByChunkName + * @property {StatsAsset[]=} assets + * @property {number=} filteredAssets + * @property {StatsChunk[]=} chunks + * @property {StatsModule[]=} modules + * @property {number=} filteredModules + * @property {Record=} entrypoints + * @property {Record=} namedChunkGroups + * @property {StatsError[]=} errors + * @property {number=} errorsCount + * @property {StatsError[]=} warnings + * @property {number=} warningsCount + * @property {StatsCompilation[]=} children + * @property {Record=} logging */ +/** @typedef {KnownStatsLogging & Record} StatsLogging */ /** - * @typedef {Object} IDirent - * @property {() => boolean} isFile - * @property {() => boolean} isDirectory - * @property {() => boolean} isBlockDevice - * @property {() => boolean} isCharacterDevice - * @property {() => boolean} isSymbolicLink - * @property {() => boolean} isFIFO - * @property {() => boolean} isSocket - * @property {string | Buffer} name + * @typedef {Object} KnownStatsLogging + * @property {StatsLoggingEntry[]} entries + * @property {number} filteredEntries + * @property {boolean} debug */ -/** @typedef {function((NodeJS.ErrnoException | null)=): void} Callback */ -/** @typedef {function((NodeJS.ErrnoException | null)=, Buffer=): void} BufferCallback */ -/** @typedef {function((NodeJS.ErrnoException | null)=, Buffer|string=): void} BufferOrStringCallback */ -/** @typedef {function((NodeJS.ErrnoException | null)=, (string | Buffer)[] | IDirent[]=): void} DirentArrayCallback */ -/** @typedef {function((NodeJS.ErrnoException | null)=, string=): void} StringCallback */ -/** @typedef {function((NodeJS.ErrnoException | null)=, number=): void} NumberCallback */ -/** @typedef {function((NodeJS.ErrnoException | null)=, IStats=): void} StatsCallback */ -/** @typedef {function((NodeJS.ErrnoException | Error | null)=, any=): void} ReadJsonCallback */ -/** @typedef {function((NodeJS.ErrnoException | Error | null)=, IStats|string=): void} LstatReadlinkAbsoluteCallback */ +/** @typedef {KnownStatsLoggingEntry & Record} StatsLoggingEntry */ +/** + * @typedef {Object} KnownStatsLoggingEntry + * @property {string} type + * @property {string} message + * @property {string[]=} trace + * @property {StatsLoggingEntry[]=} children + * @property {any[]=} args + * @property {number=} time + */ +/** @typedef {KnownStatsAsset & Record} StatsAsset */ /** - * @typedef {Object} WatcherInfo - * @property {Set} changes get current aggregated changes that have not yet send to callback - * @property {Set} removals get current aggregated removals that have not yet send to callback - * @property {Map} fileTimeInfoEntries get info about files - * @property {Map} contextTimeInfoEntries get info about directories + * @typedef {Object} KnownStatsAsset + * @property {string} type + * @property {string} name + * @property {AssetInfo} info + * @property {number} size + * @property {boolean} emitted + * @property {boolean} comparedForEmit + * @property {boolean} cached + * @property {StatsAsset[]=} related + * @property {(string|number)[]=} chunkNames + * @property {(string|number)[]=} chunkIdHints + * @property {(string|number)[]=} chunks + * @property {(string|number)[]=} auxiliaryChunkNames + * @property {(string|number)[]=} auxiliaryChunks + * @property {(string|number)[]=} auxiliaryChunkIdHints + * @property {number=} filteredRelated + * @property {boolean=} isOverSizeLimit */ -// TODO webpack 6 deprecate missing getInfo +/** @typedef {KnownStatsChunkGroup & Record} StatsChunkGroup */ /** - * @typedef {Object} Watcher - * @property {function(): void} close closes the watcher and all underlying file watchers - * @property {function(): void} pause closes the watcher, but keeps underlying file watchers alive until the next watch call - * @property {function(): Set=} getAggregatedChanges get current aggregated changes that have not yet send to callback - * @property {function(): Set=} getAggregatedRemovals get current aggregated removals that have not yet send to callback - * @property {function(): Map} getFileTimeInfoEntries get info about files - * @property {function(): Map} getContextTimeInfoEntries get info about directories - * @property {function(): WatcherInfo=} getInfo get info about timestamps and changes + * @typedef {Object} KnownStatsChunkGroup + * @property {string=} name + * @property {(string|number)[]=} chunks + * @property {({ name: string, size?: number })[]=} assets + * @property {number=} filteredAssets + * @property {number=} assetsSize + * @property {({ name: string, size?: number })[]=} auxiliaryAssets + * @property {number=} filteredAuxiliaryAssets + * @property {number=} auxiliaryAssetsSize + * @property {{ [x: string]: StatsChunkGroup[] }=} children + * @property {{ [x: string]: string[] }=} childAssets + * @property {boolean=} isOverSizeLimit */ +/** @typedef {KnownStatsModule & Record} StatsModule */ /** - * @callback WatchMethod - * @param {Iterable} files watched files - * @param {Iterable} directories watched directories - * @param {Iterable} missing watched exitance entries - * @param {number} startTime timestamp of start time - * @param {WatchOptions} options options object - * @param {function(Error=, Map, Map, Set, Set): void} callback aggregated callback - * @param {function(string, number): void} callbackUndelayed callback when the first change was detected - * @returns {Watcher} a watcher + * @typedef {Object} KnownStatsModule + * @property {string=} type + * @property {string=} moduleType + * @property {string=} layer + * @property {string=} identifier + * @property {string=} name + * @property {string=} nameForCondition + * @property {number=} index + * @property {number=} preOrderIndex + * @property {number=} index2 + * @property {number=} postOrderIndex + * @property {number=} size + * @property {{[x: string]: number}=} sizes + * @property {boolean=} cacheable + * @property {boolean=} built + * @property {boolean=} codeGenerated + * @property {boolean=} buildTimeExecuted + * @property {boolean=} cached + * @property {boolean=} optional + * @property {boolean=} orphan + * @property {string|number=} id + * @property {string|number=} issuerId + * @property {(string|number)[]=} chunks + * @property {(string|number)[]=} assets + * @property {boolean=} dependent + * @property {string=} issuer + * @property {string=} issuerName + * @property {StatsModuleIssuer[]=} issuerPath + * @property {boolean=} failed + * @property {number=} errors + * @property {number=} warnings + * @property {StatsProfile=} profile + * @property {StatsModuleReason[]=} reasons + * @property {(boolean | string[])=} usedExports + * @property {string[]=} providedExports + * @property {string[]=} optimizationBailout + * @property {number=} depth + * @property {StatsModule[]=} modules + * @property {number=} filteredModules + * @property {ReturnType=} source */ -// TODO webpack 6 make optional methods required +/** @typedef {KnownStatsProfile & Record} StatsProfile */ +/** + * @typedef {Object} KnownStatsProfile + * @property {number} total + * @property {number} resolving + * @property {number} restoring + * @property {number} building + * @property {number} integration + * @property {number} storing + * @property {number} additionalResolving + * @property {number} additionalIntegration + * @property {number} factory + * @property {number} dependencies + */ +/** @typedef {KnownStatsModuleIssuer & Record} StatsModuleIssuer */ /** - * @typedef {Object} OutputFileSystem - * @property {function(string, Buffer|string, Callback): void} writeFile - * @property {function(string, Callback): void} mkdir - * @property {function(string, DirentArrayCallback): void=} readdir - * @property {function(string, Callback): void=} rmdir - * @property {function(string, Callback): void=} unlink - * @property {function(string, StatsCallback): void} stat - * @property {function(string, StatsCallback): void=} lstat - * @property {function(string, BufferOrStringCallback): void} readFile - * @property {(function(string, string): string)=} join - * @property {(function(string, string): string)=} relative - * @property {(function(string): string)=} dirname + * @typedef {Object} KnownStatsModuleIssuer + * @property {string=} identifier + * @property {string=} name + * @property {(string|number)=} id + * @property {StatsProfile=} profile */ +/** @typedef {KnownStatsModuleReason & Record} StatsModuleReason */ /** - * @typedef {Object} InputFileSystem - * @property {function(string, BufferOrStringCallback): void} readFile - * @property {(function(string, ReadJsonCallback): void)=} readJson - * @property {function(string, BufferOrStringCallback): void} readlink - * @property {function(string, DirentArrayCallback): void} readdir - * @property {function(string, StatsCallback): void} stat - * @property {function(string, StatsCallback): void=} lstat - * @property {(function(string, BufferOrStringCallback): void)=} realpath - * @property {(function(string=): void)=} purge - * @property {(function(string, string): string)=} join - * @property {(function(string, string): string)=} relative - * @property {(function(string): string)=} dirname + * @typedef {Object} KnownStatsModuleReason + * @property {string=} moduleIdentifier + * @property {string=} module + * @property {string=} moduleName + * @property {string=} resolvedModuleIdentifier + * @property {string=} resolvedModule + * @property {string=} type + * @property {boolean} active + * @property {string=} explanation + * @property {string=} userRequest + * @property {string=} loc + * @property {(string|number)=} moduleId + * @property {(string|number)=} resolvedModuleId */ +/** @typedef {KnownStatsChunk & Record} StatsChunk */ /** - * @typedef {Object} WatchFileSystem - * @property {WatchMethod} watch + * @typedef {Object} KnownStatsChunk + * @property {boolean} rendered + * @property {boolean} initial + * @property {boolean} entry + * @property {boolean} recorded + * @property {string=} reason + * @property {number} size + * @property {Record=} sizes + * @property {string[]=} names + * @property {string[]=} idHints + * @property {string[]=} runtime + * @property {string[]=} files + * @property {string[]=} auxiliaryFiles + * @property {string} hash + * @property {Record=} childrenByOrder + * @property {(string|number)=} id + * @property {(string|number)[]=} siblings + * @property {(string|number)[]=} parents + * @property {(string|number)[]=} children + * @property {StatsModule[]=} modules + * @property {number=} filteredModules + * @property {StatsChunkOrigin[]=} origins */ +/** @typedef {KnownStatsChunkOrigin & Record} StatsChunkOrigin */ /** - * @typedef {Object} IntermediateFileSystemExtras - * @property {function(string): void} mkdirSync - * @property {function(string): NodeJS.WritableStream} createWriteStream - * @property {function(string, string, NumberCallback): void} open - * @property {function(number, Buffer, number, number, number, NumberCallback): void} read - * @property {function(number, Callback): void} close - * @property {function(string, string, Callback): void} rename + * @typedef {Object} KnownStatsChunkOrigin + * @property {string=} module + * @property {string=} moduleIdentifier + * @property {string=} moduleName + * @property {string=} loc + * @property {string=} request + * @property {(string|number)=} moduleId */ -/** @typedef {InputFileSystem & OutputFileSystem & IntermediateFileSystemExtras} IntermediateFileSystem */ +/** @typedef {KnownStatsModuleTraceItem & Record} StatsModuleTraceItem */ +/** + * @typedef {Object} KnownStatsModuleTraceItem + * @property {string=} originIdentifier + * @property {string=} originName + * @property {string=} moduleIdentifier + * @property {string=} moduleName + * @property {StatsModuleTraceDependency[]=} dependencies + * @property {(string|number)=} originId + * @property {(string|number)=} moduleId + */ +/** @typedef {KnownStatsModuleTraceDependency & Record} StatsModuleTraceDependency */ /** - * - * @param {InputFileSystem|OutputFileSystem|undefined} fs a file system - * @param {string} rootPath the root path - * @param {string} targetPath the target path - * @returns {string} location of targetPath relative to rootPath + * @typedef {Object} KnownStatsModuleTraceDependency + * @property {string=} loc */ -const relative = (fs, rootPath, targetPath) => { - if (fs && fs.relative) { - return fs.relative(rootPath, targetPath); - } else if (path.posix.isAbsolute(rootPath)) { - return path.posix.relative(rootPath, targetPath); - } else if (path.win32.isAbsolute(rootPath)) { - return path.win32.relative(rootPath, targetPath); - } else { - throw new Error( - `${rootPath} is neither a posix nor a windows path, and there is no 'relative' method defined in the file system` - ); - } -}; -exports.relative = relative; +/** @typedef {KnownStatsError & Record} StatsError */ /** - * @param {InputFileSystem|OutputFileSystem|undefined} fs a file system - * @param {string} rootPath a path - * @param {string} filename a filename - * @returns {string} the joined path + * @typedef {Object} KnownStatsError + * @property {string} message + * @property {string=} chunkName + * @property {boolean=} chunkEntry + * @property {boolean=} chunkInitial + * @property {string=} file + * @property {string=} moduleIdentifier + * @property {string=} moduleName + * @property {string=} loc + * @property {string|number=} chunkId + * @property {string|number=} moduleId + * @property {StatsModuleTraceItem[]=} moduleTrace + * @property {any=} details + * @property {string=} stack + */ + +/** @typedef {Asset & { type: string, related: PreprocessedAsset[] }} PreprocessedAsset */ + +/** + * @template T + * @template O + * @typedef {Record void>} ExtractorsByOption + */ + +/** + * @typedef {Object} SimpleExtractors + * @property {ExtractorsByOption} compilation + * @property {ExtractorsByOption} asset + * @property {ExtractorsByOption} asset$visible + * @property {ExtractorsByOption<{ name: string, chunkGroup: ChunkGroup }, StatsChunkGroup>} chunkGroup + * @property {ExtractorsByOption} module + * @property {ExtractorsByOption} module$visible + * @property {ExtractorsByOption} moduleIssuer + * @property {ExtractorsByOption} profile + * @property {ExtractorsByOption} moduleReason + * @property {ExtractorsByOption} chunk + * @property {ExtractorsByOption} chunkOrigin + * @property {ExtractorsByOption} error + * @property {ExtractorsByOption} warning + * @property {ExtractorsByOption<{ origin: Module, module: Module }, StatsModuleTraceItem>} moduleTraceItem + * @property {ExtractorsByOption} moduleTraceDependency */ -const join = (fs, rootPath, filename) => { - if (fs && fs.join) { - return fs.join(rootPath, filename); - } else if (path.posix.isAbsolute(rootPath)) { - return path.posix.join(rootPath, filename); - } else if (path.win32.isAbsolute(rootPath)) { - return path.win32.join(rootPath, filename); - } else { - throw new Error( - `${rootPath} is neither a posix nor a windows path, and there is no 'join' method defined in the file system` - ); - } -}; -exports.join = join; /** - * @param {InputFileSystem|OutputFileSystem|undefined} fs a file system - * @param {string} absPath an absolute path - * @returns {string} the parent directory of the absolute path + * @template T + * @template I + * @param {Iterable} items items to select from + * @param {function(T): Iterable} selector selector function to select values from item + * @returns {I[]} array of values */ -const dirname = (fs, absPath) => { - if (fs && fs.dirname) { - return fs.dirname(absPath); - } else if (path.posix.isAbsolute(absPath)) { - return path.posix.dirname(absPath); - } else if (path.win32.isAbsolute(absPath)) { - return path.win32.dirname(absPath); - } else { - throw new Error( - `${absPath} is neither a posix nor a windows path, and there is no 'dirname' method defined in the file system` - ); +const uniqueArray = (items, selector) => { + /** @type {Set} */ + const set = new Set(); + for (const item of items) { + for (const i of selector(item)) { + set.add(i); + } } + return Array.from(set); }; -exports.dirname = dirname; /** - * @param {OutputFileSystem} fs a file system - * @param {string} p an absolute path - * @param {function(Error=): void} callback callback function for the error - * @returns {void} + * @template T + * @template I + * @param {Iterable} items items to select from + * @param {function(T): Iterable} selector selector function to select values from item + * @param {Comparator} comparator comparator function + * @returns {I[]} array of values */ -const mkdirp = (fs, p, callback) => { - fs.mkdir(p, err => { - if (err) { - if (err.code === "ENOENT") { - const dir = dirname(fs, p); - if (dir === p) { - callback(err); - return; - } - mkdirp(fs, dir, err => { - if (err) { - callback(err); - return; - } - fs.mkdir(p, err => { - if (err) { - if (err.code === "EEXIST") { - callback(); - return; - } - callback(err); - return; - } - callback(); - }); - }); - return; - } else if (err.code === "EEXIST") { - callback(); - return; - } - callback(err); - return; - } - callback(); - }); +const uniqueOrderedArray = (items, selector, comparator) => { + return uniqueArray(items, selector).sort(comparator); }; -exports.mkdirp = mkdirp; + +/** @template T @template R @typedef {{ [P in keyof T]: R }} MappedValues */ /** - * @param {IntermediateFileSystem} fs a file system - * @param {string} p an absolute path - * @returns {void} + * @template T + * @template R + * @param {T} obj object to be mapped + * @param {function(T[keyof T], keyof T): R} fn mapping function + * @returns {MappedValues} mapped object */ -const mkdirpSync = (fs, p) => { - try { - fs.mkdirSync(p); - } catch (err) { - if (err) { - if (err.code === "ENOENT") { - const dir = dirname(fs, p); - if (dir === p) { - throw err; - } - mkdirpSync(fs, dir); - fs.mkdirSync(p); - return; - } else if (err.code === "EEXIST") { - return; - } - throw err; - } +const mapObject = (obj, fn) => { + const newObj = Object.create(null); + for (const key of Object.keys(obj)) { + newObj[key] = fn(obj[key], /** @type {keyof T} */ (key)); } + return newObj; }; -exports.mkdirpSync = mkdirpSync; /** - * @param {InputFileSystem} fs a file system - * @param {string} p an absolute path - * @param {ReadJsonCallback} callback callback - * @returns {void} + * @param {Compilation} compilation the compilation + * @param {function(Compilation, string): any[]} getItems get items + * @returns {number} total number */ -const readJson = (fs, p, callback) => { - if ("readJson" in fs) return fs.readJson(p, callback); - fs.readFile(p, (err, buf) => { - if (err) return callback(err); - let data; - try { - data = JSON.parse(buf.toString("utf-8")); - } catch (e) { - return callback(e); - } - return callback(null, data); - }); +const countWithChildren = (compilation, getItems) => { + let count = getItems(compilation, "").length; + for (const child of compilation.children) { + count += countWithChildren(child, (c, type) => + getItems(c, `.children[].compilation${type}`) + ); + } + return count; }; -exports.readJson = readJson; -/** - * @param {InputFileSystem} fs a file system - * @param {string} p an absolute path - * @param {ReadJsonCallback} callback callback - * @returns {void} - */ -const lstatReadlinkAbsolute = (fs, p, callback) => { - let i = 3; - const doReadLink = () => { - fs.readlink(p, (err, target) => { - if (err && --i > 0) { - // It might was just changed from symlink to file - // we retry 2 times to catch this case before throwing the error - return doStat(); - } - if (err || !target) return doStat(); - const value = target.toString(); - callback(null, join(fs, dirname(fs, p), value)); - }); - }; - const doStat = () => { - if ("lstat" in fs) { - return fs.lstat(p, (err, stats) => { - if (err) return callback(err); - if (stats.isSymbolicLink()) { - return doReadLink(); - } - callback(null, stats); - }); +/** @type {ExtractorsByOption} */ +const EXTRACT_ERROR = { + _: (object, error, context, { requestShortener }) => { + // TODO webpack 6 disallow strings in the errors/warnings list + if (typeof error === "string") { + object.message = error; } else { - return fs.stat(p, callback); + if (error.chunk) { + object.chunkName = error.chunk.name; + object.chunkEntry = error.chunk.hasRuntime(); + object.chunkInitial = error.chunk.canBeInitial(); + } + if (error.file) { + object.file = error.file; + } + if (error.module) { + object.moduleIdentifier = error.module.identifier(); + object.moduleName = error.module.readableIdentifier(requestShortener); + } + if (error.loc) { + object.loc = formatLocation(error.loc); + } + object.message = error.message; } - }; - if ("lstat" in fs) return doStat(); - doReadLink(); -}; -exports.lstatReadlinkAbsolute = lstatReadlinkAbsolute; - - -/***/ }), - -/***/ 59461: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const Hash = __webpack_require__(36692); -const MAX_SHORT_STRING = (__webpack_require__(1842).MAX_SHORT_STRING); - -class BatchedHash extends Hash { - constructor(hash) { - super(); - this.string = undefined; - this.encoding = undefined; - this.hash = hash; - } - - /** - * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} - * @param {string|Buffer} data data - * @param {string=} inputEncoding data encoding - * @returns {this} updated hash - */ - update(data, inputEncoding) { - if (this.string !== undefined) { - if ( - typeof data === "string" && - inputEncoding === this.encoding && - this.string.length + data.length < MAX_SHORT_STRING - ) { - this.string += data; - return this; + }, + ids: (object, error, { compilation: { chunkGraph } }) => { + if (typeof error !== "string") { + if (error.chunk) { + object.chunkId = error.chunk.id; + } + if (error.module) { + object.moduleId = chunkGraph.getModuleId(error.module); } - this.hash.update(this.string, this.encoding); - this.string = undefined; } - if (typeof data === "string") { - if ( - data.length < MAX_SHORT_STRING && - // base64 encoding is not valid since it may contain padding chars - (!inputEncoding || !inputEncoding.startsWith("ba")) - ) { - this.string = data; - this.encoding = inputEncoding; - } else { - this.hash.update(data, inputEncoding); + }, + moduleTrace: (object, error, context, options, factory) => { + if (typeof error !== "string" && error.module) { + const { + type, + compilation: { moduleGraph } + } = context; + /** @type {Set} */ + const visitedModules = new Set(); + const moduleTrace = []; + let current = error.module; + while (current) { + if (visitedModules.has(current)) break; // circular (technically impossible, but how knows) + visitedModules.add(current); + const origin = moduleGraph.getIssuer(current); + if (!origin) break; + moduleTrace.push({ origin, module: current }); + current = origin; } - } else { - this.hash.update(data); + object.moduleTrace = factory.create( + `${type}.moduleTrace`, + moduleTrace, + context + ); } - return this; - } - - /** - * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} - * @param {string=} encoding encoding of the return value - * @returns {string|Buffer} digest - */ - digest(encoding) { - if (this.string !== undefined) { - this.hash.update(this.string, this.encoding); + }, + errorDetails: ( + object, + error, + { type, compilation, cachedGetErrors, cachedGetWarnings }, + { errorDetails } + ) => { + if ( + typeof error !== "string" && + (errorDetails === true || + (type.endsWith(".error") && cachedGetErrors(compilation).length < 3)) + ) { + object.details = error.details; + } + }, + errorStack: (object, error) => { + if (typeof error !== "string") { + object.stack = error.stack; } - return this.hash.digest(encoding); } -} - -module.exports = BatchedHash; - - -/***/ }), - -/***/ 86884: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const create = __webpack_require__(1842); - -//#region wasm code: md4 (../../../assembly/hash/md4.asm.ts) --initialMemory 1 -const md4 = new WebAssembly.Module( - Buffer.from( - // 2156 bytes - "AGFzbQEAAAABCAJgAX8AYAAAAwUEAQAAAAUDAQABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwciBARpbml0AAAGdXBkYXRlAAIFZmluYWwAAwZtZW1vcnkCAAqLEAQmAEGBxpS6BiQBQYnXtv5+JAJB/rnrxXkkA0H2qMmBASQEQQAkAAvSCgEZfyMBIQUjAiECIwMhAyMEIQQDQCAAIAFLBEAgASgCJCISIAEoAiAiEyABKAIcIgkgASgCGCIIIAEoAhQiByABKAIQIg4gASgCDCIGIAEoAggiDyABKAIEIhAgASgCACIRIAMgBHMgAnEgBHMgBWpqQQN3IgogAiADc3EgA3MgBGpqQQd3IgsgAiAKc3EgAnMgA2pqQQt3IgwgCiALc3EgCnMgAmpqQRN3Ig0gCyAMc3EgC3MgCmpqQQN3IgogDCANc3EgDHMgC2pqQQd3IgsgCiANc3EgDXMgDGpqQQt3IgwgCiALc3EgCnMgDWpqQRN3Ig0gCyAMc3EgC3MgCmpqQQN3IhQgDCANc3EgDHMgC2pqQQd3IRUgASgCLCILIAEoAigiCiAMIA0gDSAUcyAVcXNqakELdyIWIBQgFXNxIBRzIA1qakETdyEXIAEoAjQiGCABKAIwIhkgFSAWcyAXcSAVcyAUampBA3ciFCAWIBdzcSAWcyAVampBB3chFSABKAI8Ig0gASgCOCIMIBQgF3MgFXEgF3MgFmpqQQt3IhYgFCAVc3EgFHMgF2pqQRN3IRcgEyAOIBEgFCAVIBZyIBdxIBUgFnFyampBmfOJ1AVqQQN3IhQgFiAXcnEgFiAXcXIgFWpqQZnzidQFakEFdyIVIBQgF3JxIBQgF3FyIBZqakGZ84nUBWpBCXchFiAPIBggEiAWIAcgFSAQIBQgGSAUIBVyIBZxIBQgFXFyIBdqakGZ84nUBWpBDXciFCAVIBZycSAVIBZxcmpqQZnzidQFakEDdyIVIBQgFnJxIBQgFnFyampBmfOJ1AVqQQV3IhcgFCAVcnEgFCAVcXJqakGZ84nUBWpBCXciFiAVIBdycSAVIBdxciAUampBmfOJ1AVqQQ13IhQgFiAXcnEgFiAXcXIgFWpqQZnzidQFakEDdyEVIBEgBiAVIAwgFCAKIBYgCCAUIBZyIBVxIBQgFnFyIBdqakGZ84nUBWpBBXciFyAUIBVycSAUIBVxcmpqQZnzidQFakEJdyIWIBUgF3JxIBUgF3FyampBmfOJ1AVqQQ13IhQgFiAXcnEgFiAXcXJqakGZ84nUBWpBA3ciFSALIBYgCSAUIBZyIBVxIBQgFnFyIBdqakGZ84nUBWpBBXciFiAUIBVycSAUIBVxcmpqQZnzidQFakEJdyIXIA0gFSAWciAXcSAVIBZxciAUampBmfOJ1AVqQQ13IhRzIBZzampBodfn9gZqQQN3IREgByAIIA4gFCARIBcgESAUc3MgFmogE2pBodfn9gZqQQl3IhNzcyAXampBodfn9gZqQQt3Ig4gDyARIBMgDiARIA4gE3NzIBRqIBlqQaHX5/YGakEPdyIRc3NqakGh1+f2BmpBA3ciDyAOIA8gEXNzIBNqIApqQaHX5/YGakEJdyIKcyARc2pqQaHX5/YGakELdyIIIBAgDyAKIAggDCAPIAggCnNzIBFqakGh1+f2BmpBD3ciDHNzampBodfn9gZqQQN3Ig4gEiAIIAwgDnNzIApqakGh1+f2BmpBCXciCHMgDHNqakGh1+f2BmpBC3chByAFIAYgCCAHIBggDiAHIAhzcyAMampBodfn9gZqQQ93IgpzcyAOampBodfn9gZqQQN3IgZqIQUgDSAGIAkgByAGIAsgByAGIApzcyAIampBodfn9gZqQQl3IgdzIApzampBodfn9gZqQQt3IgYgB3NzIApqakGh1+f2BmpBD3cgAmohAiADIAZqIQMgBCAHaiEEIAFBQGshAQwBCwsgBSQBIAIkAiADJAMgBCQECw0AIAAQASAAIwBqJAAL/wQCA38BfiAAIwBqrUIDhiEEIABByABqQUBxIgJBCGshAyAAIgFBAWohACABQYABOgAAA0AgACACSUEAIABBB3EbBEAgAEEAOgAAIABBAWohAAwBCwsDQCAAIAJJBEAgAEIANwMAIABBCGohAAwBCwsgAyAENwMAIAIQAUEAIwGtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEIIwKtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEQIwOtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEYIwStIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAAs=", - "base64" - ) -); -//#endregion - -module.exports = create.bind(null, md4, [], 64, 32); - - -/***/ }), - -/***/ 1842: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - +}; +/** @type {SimpleExtractors} */ +const SIMPLE_EXTRACTORS = { + compilation: { + _: (object, compilation, context, options) => { + if (!context.makePathsRelative) { + context.makePathsRelative = makePathsRelative.bindContextCache( + compilation.compiler.context, + compilation.compiler.root + ); + } + if (!context.cachedGetErrors) { + const map = new WeakMap(); + context.cachedGetErrors = compilation => { + return ( + map.get(compilation) || + (errors => (map.set(compilation, errors), errors))( + compilation.getErrors() + ) + ); + }; + } + if (!context.cachedGetWarnings) { + const map = new WeakMap(); + context.cachedGetWarnings = compilation => { + return ( + map.get(compilation) || + (warnings => (map.set(compilation, warnings), warnings))( + compilation.getWarnings() + ) + ); + }; + } + if (compilation.name) { + object.name = compilation.name; + } + if (compilation.needAdditionalPass) { + object.needAdditionalPass = true; + } -// 65536 is the size of a wasm memory page -// 64 is the maximum chunk size for every possible wasm hash implementation -// 4 is the maximum number of bytes per char for string encoding (max is utf-8) -// ~3 makes sure that it's always a block of 4 chars, so avoid partially encoded bytes for base64 -const MAX_SHORT_STRING = Math.floor((65536 - 64) / 4) & ~3; + const { logging, loggingDebug, loggingTrace } = options; + if (logging || (loggingDebug && loggingDebug.length > 0)) { + const util = __webpack_require__(73837); + object.logging = {}; + let acceptedTypes; + let collapsedGroups = false; + switch (logging) { + default: + acceptedTypes = new Set(); + break; + case "error": + acceptedTypes = new Set([LogType.error]); + break; + case "warn": + acceptedTypes = new Set([LogType.error, LogType.warn]); + break; + case "info": + acceptedTypes = new Set([ + LogType.error, + LogType.warn, + LogType.info + ]); + break; + case "log": + acceptedTypes = new Set([ + LogType.error, + LogType.warn, + LogType.info, + LogType.log, + LogType.group, + LogType.groupEnd, + LogType.groupCollapsed, + LogType.clear + ]); + break; + case "verbose": + acceptedTypes = new Set([ + LogType.error, + LogType.warn, + LogType.info, + LogType.log, + LogType.group, + LogType.groupEnd, + LogType.groupCollapsed, + LogType.profile, + LogType.profileEnd, + LogType.time, + LogType.status, + LogType.clear + ]); + collapsedGroups = true; + break; + } + const cachedMakePathsRelative = makePathsRelative.bindContextCache( + options.context, + compilation.compiler.root + ); + let depthInCollapsedGroup = 0; + for (const [origin, logEntries] of compilation.logging) { + const debugMode = loggingDebug.some(fn => fn(origin)); + if (logging === false && !debugMode) continue; + /** @type {KnownStatsLoggingEntry[]} */ + const groupStack = []; + /** @type {KnownStatsLoggingEntry[]} */ + const rootList = []; + let currentList = rootList; + let processedLogEntries = 0; + for (const entry of logEntries) { + let type = entry.type; + if (!debugMode && !acceptedTypes.has(type)) continue; -class WasmHash { - /** - * @param {WebAssembly.Instance} instance wasm instance - * @param {WebAssembly.Instance[]} instancesPool pool of instances - * @param {number} chunkSize size of data chunks passed to wasm - * @param {number} digestSize size of digest returned by wasm - */ - constructor(instance, instancesPool, chunkSize, digestSize) { - const exports = /** @type {any} */ (instance.exports); - exports.init(); - this.exports = exports; - this.mem = Buffer.from(exports.memory.buffer, 0, 65536); - this.buffered = 0; - this.instancesPool = instancesPool; - this.chunkSize = chunkSize; - this.digestSize = digestSize; - } + // Expand groups in verbose and debug modes + if ( + type === LogType.groupCollapsed && + (debugMode || collapsedGroups) + ) + type = LogType.group; - reset() { - this.buffered = 0; - this.exports.init(); - } + if (depthInCollapsedGroup === 0) { + processedLogEntries++; + } - /** - * @param {Buffer | string} data data - * @param {BufferEncoding=} encoding encoding - * @returns {this} itself - */ - update(data, encoding) { - if (typeof data === "string") { - while (data.length > MAX_SHORT_STRING) { - this._updateWithShortString(data.slice(0, MAX_SHORT_STRING), encoding); - data = data.slice(MAX_SHORT_STRING); + if (type === LogType.groupEnd) { + groupStack.pop(); + if (groupStack.length > 0) { + currentList = groupStack[groupStack.length - 1].children; + } else { + currentList = rootList; + } + if (depthInCollapsedGroup > 0) depthInCollapsedGroup--; + continue; + } + let message = undefined; + if (entry.type === LogType.time) { + message = `${entry.args[0]}: ${ + entry.args[1] * 1000 + entry.args[2] / 1000000 + } ms`; + } else if (entry.args && entry.args.length > 0) { + message = util.format(entry.args[0], ...entry.args.slice(1)); + } + /** @type {KnownStatsLoggingEntry} */ + const newEntry = { + ...entry, + type, + message, + trace: loggingTrace ? entry.trace : undefined, + children: + type === LogType.group || type === LogType.groupCollapsed + ? [] + : undefined + }; + currentList.push(newEntry); + if (newEntry.children) { + groupStack.push(newEntry); + currentList = newEntry.children; + if (depthInCollapsedGroup > 0) { + depthInCollapsedGroup++; + } else if (type === LogType.groupCollapsed) { + depthInCollapsedGroup = 1; + } + } + } + let name = cachedMakePathsRelative(origin).replace(/\|/g, " "); + if (name in object.logging) { + let i = 1; + while (`${name}#${i}` in object.logging) { + i++; + } + name = `${name}#${i}`; + } + object.logging[name] = { + entries: rootList, + filteredEntries: logEntries.length - processedLogEntries, + debug: debugMode + }; + } } - this._updateWithShortString(data, encoding); - return this; - } - this._updateWithBuffer(data); - return this; - } - - /** - * @param {string} data data - * @param {BufferEncoding=} encoding encoding - * @returns {void} - */ - _updateWithShortString(data, encoding) { - const { exports, buffered, mem, chunkSize } = this; - let endPos; - if (data.length < 70) { - if (!encoding || encoding === "utf-8" || encoding === "utf8") { - endPos = buffered; - for (let i = 0; i < data.length; i++) { - const cc = data.charCodeAt(i); - if (cc < 0x80) mem[endPos++] = cc; - else if (cc < 0x800) { - mem[endPos] = (cc >> 6) | 0xc0; - mem[endPos + 1] = (cc & 0x3f) | 0x80; - endPos += 2; - } else { - // bail-out for weird chars - endPos += mem.write(data.slice(i), endPos, encoding); - break; + }, + hash: (object, compilation) => { + object.hash = compilation.hash; + }, + version: object => { + object.version = (__webpack_require__(32702)/* .version */ .i8); + }, + env: (object, compilation, context, { _env }) => { + object.env = _env; + }, + timings: (object, compilation) => { + object.time = compilation.endTime - compilation.startTime; + }, + builtAt: (object, compilation) => { + object.builtAt = compilation.endTime; + }, + publicPath: (object, compilation) => { + object.publicPath = compilation.getPath( + compilation.outputOptions.publicPath + ); + }, + outputPath: (object, compilation) => { + object.outputPath = compilation.outputOptions.path; + }, + assets: (object, compilation, context, options, factory) => { + const { type } = context; + /** @type {Map} */ + const compilationFileToChunks = new Map(); + /** @type {Map} */ + const compilationAuxiliaryFileToChunks = new Map(); + for (const chunk of compilation.chunks) { + for (const file of chunk.files) { + let array = compilationFileToChunks.get(file); + if (array === undefined) { + array = []; + compilationFileToChunks.set(file, array); } + array.push(chunk); } - } else if (encoding === "latin1") { - endPos = buffered; - for (let i = 0; i < data.length; i++) { - const cc = data.charCodeAt(i); - mem[endPos++] = cc; + for (const file of chunk.auxiliaryFiles) { + let array = compilationAuxiliaryFileToChunks.get(file); + if (array === undefined) { + array = []; + compilationAuxiliaryFileToChunks.set(file, array); + } + array.push(chunk); } - } else { - endPos = buffered + mem.write(data, buffered, encoding); } - } else { - endPos = buffered + mem.write(data, buffered, encoding); - } - if (endPos < chunkSize) { - this.buffered = endPos; - } else { - const l = endPos & ~(this.chunkSize - 1); - exports.update(l); - const newBuffered = endPos - l; - this.buffered = newBuffered; - if (newBuffered > 0) mem.copyWithin(0, l, endPos); - } - } - - /** - * @param {Buffer} data data - * @returns {void} - */ - _updateWithBuffer(data) { - const { exports, buffered, mem } = this; - const length = data.length; - if (buffered + length < this.chunkSize) { - data.copy(mem, buffered, 0, length); - this.buffered += length; - } else { - const l = (buffered + length) & ~(this.chunkSize - 1); - if (l > 65536) { - let i = 65536 - buffered; - data.copy(mem, buffered, 0, i); - exports.update(65536); - const stop = l - buffered - 65536; - while (i < stop) { - data.copy(mem, 0, i, i + 65536); - exports.update(65536); - i += 65536; + /** @type {Map} */ + const assetMap = new Map(); + /** @type {Set} */ + const assets = new Set(); + for (const asset of compilation.getAssets()) { + /** @type {PreprocessedAsset} */ + const item = { + ...asset, + type: "asset", + related: undefined + }; + assets.add(item); + assetMap.set(asset.name, item); + } + for (const item of assetMap.values()) { + const related = item.info.related; + if (!related) continue; + for (const type of Object.keys(related)) { + const relatedEntry = related[type]; + const deps = Array.isArray(relatedEntry) + ? relatedEntry + : [relatedEntry]; + for (const dep of deps) { + const depItem = assetMap.get(dep); + if (!depItem) continue; + assets.delete(depItem); + depItem.type = type; + item.related = item.related || []; + item.related.push(depItem); + } } - data.copy(mem, 0, i, l - buffered); - exports.update(l - buffered - i); - } else { - data.copy(mem, buffered, 0, l - buffered); - exports.update(l); } - const newBuffered = length + buffered - l; - this.buffered = newBuffered; - if (newBuffered > 0) data.copy(mem, 0, length - newBuffered, length); - } - } - - digest(type) { - const { exports, buffered, mem, digestSize } = this; - exports.final(buffered); - this.instancesPool.push(this); - const hex = mem.toString("latin1", 0, digestSize); - if (type === "hex") return hex; - if (type === "binary" || !type) return Buffer.from(hex, "hex"); - return Buffer.from(hex, "hex").toString(type); - } -} - -const create = (wasmModule, instancesPool, chunkSize, digestSize) => { - if (instancesPool.length > 0) { - const old = instancesPool.pop(); - old.reset(); - return old; - } else { - return new WasmHash( - new WebAssembly.Instance(wasmModule), - instancesPool, - chunkSize, - digestSize - ); - } -}; - -module.exports = create; -module.exports.MAX_SHORT_STRING = MAX_SHORT_STRING; - - -/***/ }), - -/***/ 35028: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const create = __webpack_require__(1842); - -//#region wasm code: xxhash64 (../../../assembly/hash/xxhash64.asm.ts) --initialMemory 1 -const xxhash64 = new WebAssembly.Module( - Buffer.from( - // 1170 bytes - "AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrIIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEEIAUgASkDGELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEFIAAgAUEgaiIBSw0ACyACJAAgAyQBIAQkAiAFJAMLqAYCAX8EfiMEQgBSBH4jACICQgGJIwEiA0IHiXwjAiIEQgyJfCMDIgVCEol8IAJCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0gA0LP1tO+0ser2UJ+Qh+JQoeVr6+Ytt6bnn9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSAEQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IAVCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0FQsXP2bLx5brqJwsjBCAArXx8IQIDQCABQQhqIABNBEAgAiABKQMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQIgAUEIaiEBDAELCyABQQRqIABNBEAgAiABNQIAQoeVr6+Ytt6bnn9+hUIXiULP1tO+0ser2UJ+Qvnz3fGZ9pmrFnwhAiABQQRqIQELA0AgACABRwRAIAIgATEAAELFz9my8eW66id+hUILiUKHla+vmLbem55/fiECIAFBAWohAQwBCwtBACACIAJCIYiFQs/W077Sx6vZQn4iAkIdiCAChUL5893xmfaZqxZ+IgJCIIggAoUiAkIgiCIDQv//A4NCIIYgA0KAgPz/D4NCEIiEIgNC/4GAgPAfg0IQhiADQoD+g4CA4D+DQgiIhCIDQo+AvIDwgcAHg0IIhiADQvCBwIeAnoD4AINCBIiEIgNChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IANCsODAgYOGjJgwhHw3AwBBCCACQv////8PgyICQv//A4NCIIYgAkKAgPz/D4NCEIiEIgJC/4GAgPAfg0IQhiACQoD+g4CA4D+DQgiIhCICQo+AvIDwgcAHg0IIhiACQvCBwIeAnoD4AINCBIiEIgJChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IAJCsODAgYOGjJgwhHw3AwAL", - "base64" - ) -); -//#endregion - -module.exports = create.bind(null, xxhash64, [], 32, 16); - - -/***/ }), - -/***/ 82186: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - + object.assetsByChunkName = {}; + for (const [file, chunks] of compilationFileToChunks) { + for (const chunk of chunks) { + const name = chunk.name; + if (!name) continue; + if ( + !Object.prototype.hasOwnProperty.call( + object.assetsByChunkName, + name + ) + ) { + object.assetsByChunkName[name] = []; + } + object.assetsByChunkName[name].push(file); + } + } -const path = __webpack_require__(71017); - -const WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/; -const SEGMENTS_SPLIT_REGEXP = /([|!])/; -const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g; - -/** - * @typedef {Object} MakeRelativePathsCache - * @property {Map>=} relativePaths - */ - -const relativePathToRequest = relativePath => { - if (relativePath === "") return "./."; - if (relativePath === "..") return "../."; - if (relativePath.startsWith("../")) return relativePath; - return `./${relativePath}`; -}; - -/** - * @param {string} context context for relative path - * @param {string} maybeAbsolutePath path to make relative - * @returns {string} relative path in request style - */ -const absoluteToRequest = (context, maybeAbsolutePath) => { - if (maybeAbsolutePath[0] === "/") { - if ( - maybeAbsolutePath.length > 1 && - maybeAbsolutePath[maybeAbsolutePath.length - 1] === "/" - ) { - // this 'path' is actually a regexp generated by dynamic requires. - // Don't treat it as an absolute path. - return maybeAbsolutePath; + const groupedAssets = factory.create( + `${type}.assets`, + Array.from(assets), + { + ...context, + compilationFileToChunks, + compilationAuxiliaryFileToChunks + } + ); + const limited = spaceLimited(groupedAssets, options.assetsSpace); + object.assets = limited.children; + object.filteredAssets = limited.filteredChildren; + }, + chunks: (object, compilation, context, options, factory) => { + const { type } = context; + object.chunks = factory.create( + `${type}.chunks`, + Array.from(compilation.chunks), + context + ); + }, + modules: (object, compilation, context, options, factory) => { + const { type } = context; + const array = Array.from(compilation.modules); + const groupedModules = factory.create(`${type}.modules`, array, context); + const limited = spaceLimited(groupedModules, options.modulesSpace); + object.modules = limited.children; + object.filteredModules = limited.filteredChildren; + }, + entrypoints: ( + object, + compilation, + context, + { entrypoints, chunkGroups, chunkGroupAuxiliary, chunkGroupChildren }, + factory + ) => { + const { type } = context; + const array = Array.from(compilation.entrypoints, ([key, value]) => ({ + name: key, + chunkGroup: value + })); + if (entrypoints === "auto" && !chunkGroups) { + if (array.length > 5) return; + if ( + !chunkGroupChildren && + array.every(({ chunkGroup }) => { + if (chunkGroup.chunks.length !== 1) return false; + const chunk = chunkGroup.chunks[0]; + return ( + chunk.files.size === 1 && + (!chunkGroupAuxiliary || chunk.auxiliaryFiles.size === 0) + ); + }) + ) { + return; + } + } + object.entrypoints = factory.create( + `${type}.entrypoints`, + array, + context + ); + }, + chunkGroups: (object, compilation, context, options, factory) => { + const { type } = context; + const array = Array.from( + compilation.namedChunkGroups, + ([key, value]) => ({ + name: key, + chunkGroup: value + }) + ); + object.namedChunkGroups = factory.create( + `${type}.namedChunkGroups`, + array, + context + ); + }, + errors: (object, compilation, context, options, factory) => { + const { type, cachedGetErrors } = context; + object.errors = factory.create( + `${type}.errors`, + cachedGetErrors(compilation), + context + ); + }, + errorsCount: (object, compilation, { cachedGetErrors }) => { + object.errorsCount = countWithChildren(compilation, c => + cachedGetErrors(c) + ); + }, + warnings: (object, compilation, context, options, factory) => { + const { type, cachedGetWarnings } = context; + object.warnings = factory.create( + `${type}.warnings`, + cachedGetWarnings(compilation), + context + ); + }, + warningsCount: ( + object, + compilation, + context, + { warningsFilter }, + factory + ) => { + const { type, cachedGetWarnings } = context; + object.warningsCount = countWithChildren(compilation, (c, childType) => { + if (!warningsFilter && warningsFilter.length === 0) + return cachedGetWarnings(c); + return factory + .create(`${type}${childType}.warnings`, cachedGetWarnings(c), context) + .filter(warning => { + const warningString = Object.keys(warning) + .map(key => `${warning[key]}`) + .join("\n"); + return !warningsFilter.some(filter => + filter(warning, warningString) + ); + }); + }); + }, + errorDetails: ( + object, + compilation, + { cachedGetErrors, cachedGetWarnings }, + { errorDetails, errors, warnings } + ) => { + if (errorDetails === "auto") { + if (warnings) { + const warnings = cachedGetWarnings(compilation); + object.filteredWarningDetailsCount = warnings + .map(e => typeof e !== "string" && e.details) + .filter(Boolean).length; + } + if (errors) { + const errors = cachedGetErrors(compilation); + if (errors.length >= 3) { + object.filteredErrorDetailsCount = errors + .map(e => typeof e !== "string" && e.details) + .filter(Boolean).length; + } + } + } + }, + children: (object, compilation, context, options, factory) => { + const { type } = context; + object.children = factory.create( + `${type}.children`, + compilation.children, + context + ); } - - const querySplitPos = maybeAbsolutePath.indexOf("?"); - let resource = - querySplitPos === -1 - ? maybeAbsolutePath - : maybeAbsolutePath.slice(0, querySplitPos); - resource = relativePathToRequest(path.posix.relative(context, resource)); - return querySplitPos === -1 - ? resource - : resource + maybeAbsolutePath.slice(querySplitPos); - } - - if (WINDOWS_ABS_PATH_REGEXP.test(maybeAbsolutePath)) { - const querySplitPos = maybeAbsolutePath.indexOf("?"); - let resource = - querySplitPos === -1 - ? maybeAbsolutePath - : maybeAbsolutePath.slice(0, querySplitPos); - resource = path.win32.relative(context, resource); - if (!WINDOWS_ABS_PATH_REGEXP.test(resource)) { - resource = relativePathToRequest( - resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, "/") + }, + asset: { + _: (object, asset, context, options, factory) => { + const { compilation } = context; + object.type = asset.type; + object.name = asset.name; + object.size = asset.source.size(); + object.emitted = compilation.emittedAssets.has(asset.name); + object.comparedForEmit = compilation.comparedForEmitAssets.has( + asset.name ); + const cached = !object.emitted && !object.comparedForEmit; + object.cached = cached; + object.info = asset.info; + if (!cached || options.cachedAssets) { + Object.assign( + object, + factory.create(`${context.type}$visible`, asset, context) + ); + } } - return querySplitPos === -1 - ? resource - : resource + maybeAbsolutePath.slice(querySplitPos); - } - - // not an absolute path - return maybeAbsolutePath; -}; - -/** - * @param {string} context context for relative path - * @param {string} relativePath path - * @returns {string} absolute path - */ -const requestToAbsolute = (context, relativePath) => { - if (relativePath.startsWith("./") || relativePath.startsWith("../")) - return path.join(context, relativePath); - return relativePath; -}; - -const makeCacheable = realFn => { - /** @type {WeakMap>} */ - const cache = new WeakMap(); - - const getCache = associatedObjectForCache => { - const entry = cache.get(associatedObjectForCache); - if (entry !== undefined) return entry; - /** @type {Map} */ - const map = new Map(); - cache.set(associatedObjectForCache, map); - return map; - }; - - /** - * @param {string} str the path with query and fragment - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {ParsedResource} parsed parts - */ - const fn = (str, associatedObjectForCache) => { - if (!associatedObjectForCache) return realFn(str); - const cache = getCache(associatedObjectForCache); - const entry = cache.get(str); - if (entry !== undefined) return entry; - const result = realFn(str); - cache.set(str, result); - return result; - }; - - fn.bindCache = associatedObjectForCache => { - const cache = getCache(associatedObjectForCache); - return str => { - const entry = cache.get(str); - if (entry !== undefined) return entry; - const result = realFn(str); - cache.set(str, result); - return result; - }; - }; - - return fn; -}; - -const makeCacheableWithContext = fn => { - /** @type {WeakMap>>} */ - const cache = new WeakMap(); - - /** - * @param {string} context context used to create relative path - * @param {string} identifier identifier used to create relative path - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {string} the returned relative path - */ - const cachedFn = (context, identifier, associatedObjectForCache) => { - if (!associatedObjectForCache) return fn(context, identifier); - - let innerCache = cache.get(associatedObjectForCache); - if (innerCache === undefined) { - innerCache = new Map(); - cache.set(associatedObjectForCache, innerCache); + }, + asset$visible: { + _: ( + object, + asset, + { compilation, compilationFileToChunks, compilationAuxiliaryFileToChunks } + ) => { + const chunks = compilationFileToChunks.get(asset.name) || []; + const auxiliaryChunks = + compilationAuxiliaryFileToChunks.get(asset.name) || []; + object.chunkNames = uniqueOrderedArray( + chunks, + c => (c.name ? [c.name] : []), + compareIds + ); + object.chunkIdHints = uniqueOrderedArray( + chunks, + c => Array.from(c.idNameHints), + compareIds + ); + object.auxiliaryChunkNames = uniqueOrderedArray( + auxiliaryChunks, + c => (c.name ? [c.name] : []), + compareIds + ); + object.auxiliaryChunkIdHints = uniqueOrderedArray( + auxiliaryChunks, + c => Array.from(c.idNameHints), + compareIds + ); + object.filteredRelated = asset.related ? asset.related.length : undefined; + }, + relatedAssets: (object, asset, context, options, factory) => { + const { type } = context; + object.related = factory.create( + `${type.slice(0, -8)}.related`, + asset.related, + context + ); + object.filteredRelated = asset.related + ? asset.related.length - object.related.length + : undefined; + }, + ids: ( + object, + asset, + { compilationFileToChunks, compilationAuxiliaryFileToChunks } + ) => { + const chunks = compilationFileToChunks.get(asset.name) || []; + const auxiliaryChunks = + compilationAuxiliaryFileToChunks.get(asset.name) || []; + object.chunks = uniqueOrderedArray(chunks, c => c.ids, compareIds); + object.auxiliaryChunks = uniqueOrderedArray( + auxiliaryChunks, + c => c.ids, + compareIds + ); + }, + performance: (object, asset) => { + object.isOverSizeLimit = SizeLimitsPlugin.isOverSizeLimit(asset.source); } + }, + chunkGroup: { + _: ( + object, + { name, chunkGroup }, + { compilation, compilation: { moduleGraph, chunkGraph } }, + { ids, chunkGroupAuxiliary, chunkGroupChildren, chunkGroupMaxAssets } + ) => { + const children = + chunkGroupChildren && + chunkGroup.getChildrenByOrders(moduleGraph, chunkGraph); + /** + * @param {string} name Name + * @returns {{ name: string, size: number }} Asset object + */ + const toAsset = name => { + const asset = compilation.getAsset(name); + return { + name, + size: asset ? asset.info.size : -1 + }; + }; + /** @type {(total: number, asset: { size: number }) => number} */ + const sizeReducer = (total, { size }) => total + size; + const assets = uniqueArray(chunkGroup.chunks, c => c.files).map(toAsset); + const auxiliaryAssets = uniqueOrderedArray( + chunkGroup.chunks, + c => c.auxiliaryFiles, + compareIds + ).map(toAsset); + const assetsSize = assets.reduce(sizeReducer, 0); + const auxiliaryAssetsSize = auxiliaryAssets.reduce(sizeReducer, 0); + /** @type {KnownStatsChunkGroup} */ + const statsChunkGroup = { + name, + chunks: ids ? chunkGroup.chunks.map(c => c.id) : undefined, + assets: assets.length <= chunkGroupMaxAssets ? assets : undefined, + filteredAssets: + assets.length <= chunkGroupMaxAssets ? 0 : assets.length, + assetsSize, + auxiliaryAssets: + chunkGroupAuxiliary && auxiliaryAssets.length <= chunkGroupMaxAssets + ? auxiliaryAssets + : undefined, + filteredAuxiliaryAssets: + chunkGroupAuxiliary && auxiliaryAssets.length <= chunkGroupMaxAssets + ? 0 + : auxiliaryAssets.length, + auxiliaryAssetsSize, + children: children + ? mapObject(children, groups => + groups.map(group => { + const assets = uniqueArray(group.chunks, c => c.files).map( + toAsset + ); + const auxiliaryAssets = uniqueOrderedArray( + group.chunks, + c => c.auxiliaryFiles, + compareIds + ).map(toAsset); - let cachedResult; - let innerSubCache = innerCache.get(context); - if (innerSubCache === undefined) { - innerCache.set(context, (innerSubCache = new Map())); - } else { - cachedResult = innerSubCache.get(identifier); - } + /** @type {KnownStatsChunkGroup} */ + const childStatsChunkGroup = { + name: group.name, + chunks: ids ? group.chunks.map(c => c.id) : undefined, + assets: + assets.length <= chunkGroupMaxAssets ? assets : undefined, + filteredAssets: + assets.length <= chunkGroupMaxAssets ? 0 : assets.length, + auxiliaryAssets: + chunkGroupAuxiliary && + auxiliaryAssets.length <= chunkGroupMaxAssets + ? auxiliaryAssets + : undefined, + filteredAuxiliaryAssets: + chunkGroupAuxiliary && + auxiliaryAssets.length <= chunkGroupMaxAssets + ? 0 + : auxiliaryAssets.length + }; - if (cachedResult !== undefined) { - return cachedResult; - } else { - const result = fn(context, identifier); - innerSubCache.set(identifier, result); - return result; + return childStatsChunkGroup; + }) + ) + : undefined, + childAssets: children + ? mapObject(children, groups => { + /** @type {Set} */ + const set = new Set(); + for (const group of groups) { + for (const chunk of group.chunks) { + for (const asset of chunk.files) { + set.add(asset); + } + } + } + return Array.from(set); + }) + : undefined + }; + Object.assign(object, statsChunkGroup); + }, + performance: (object, { chunkGroup }) => { + object.isOverSizeLimit = SizeLimitsPlugin.isOverSizeLimit(chunkGroup); } - }; + }, + module: { + _: (object, module, context, options, factory) => { + const { compilation, type } = context; + const built = compilation.builtModules.has(module); + const codeGenerated = compilation.codeGeneratedModules.has(module); + const buildTimeExecuted = + compilation.buildTimeExecutedModules.has(module); + /** @type {{[x: string]: number}} */ + const sizes = {}; + for (const sourceType of module.getSourceTypes()) { + sizes[sourceType] = module.size(sourceType); + } + /** @type {KnownStatsModule} */ + const statsModule = { + type: "module", + moduleType: module.type, + layer: module.layer, + size: module.size(), + sizes, + built, + codeGenerated, + buildTimeExecuted, + cached: !built && !codeGenerated + }; + Object.assign(object, statsModule); - /** - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {function(string, string): string} cached function - */ - cachedFn.bindCache = associatedObjectForCache => { - let innerCache; - if (associatedObjectForCache) { - innerCache = cache.get(associatedObjectForCache); - if (innerCache === undefined) { - innerCache = new Map(); - cache.set(associatedObjectForCache, innerCache); + if (built || codeGenerated || options.cachedModules) { + Object.assign( + object, + factory.create(`${type}$visible`, module, context) + ); } - } else { - innerCache = new Map(); } - - /** - * @param {string} context context used to create relative path - * @param {string} identifier identifier used to create relative path - * @returns {string} the returned relative path - */ - const boundFn = (context, identifier) => { - let cachedResult; - let innerSubCache = innerCache.get(context); - if (innerSubCache === undefined) { - innerCache.set(context, (innerSubCache = new Map())); - } else { - cachedResult = innerSubCache.get(identifier); + }, + module$visible: { + _: (object, module, context, { requestShortener }, factory) => { + const { compilation, type, rootModules } = context; + const { moduleGraph } = compilation; + /** @type {Module[]} */ + const path = []; + const issuer = moduleGraph.getIssuer(module); + let current = issuer; + while (current) { + path.push(current); + current = moduleGraph.getIssuer(current); } - - if (cachedResult !== undefined) { - return cachedResult; + path.reverse(); + const profile = moduleGraph.getProfile(module); + const errors = module.getErrors(); + const errorsCount = errors !== undefined ? countIterable(errors) : 0; + const warnings = module.getWarnings(); + const warningsCount = + warnings !== undefined ? countIterable(warnings) : 0; + /** @type {{[x: string]: number}} */ + const sizes = {}; + for (const sourceType of module.getSourceTypes()) { + sizes[sourceType] = module.size(sourceType); + } + /** @type {KnownStatsModule} */ + const statsModule = { + identifier: module.identifier(), + name: module.readableIdentifier(requestShortener), + nameForCondition: module.nameForCondition(), + index: moduleGraph.getPreOrderIndex(module), + preOrderIndex: moduleGraph.getPreOrderIndex(module), + index2: moduleGraph.getPostOrderIndex(module), + postOrderIndex: moduleGraph.getPostOrderIndex(module), + cacheable: module.buildInfo.cacheable, + optional: module.isOptional(moduleGraph), + orphan: + !type.endsWith("module.modules[].module$visible") && + compilation.chunkGraph.getNumberOfModuleChunks(module) === 0, + dependent: rootModules ? !rootModules.has(module) : undefined, + issuer: issuer && issuer.identifier(), + issuerName: issuer && issuer.readableIdentifier(requestShortener), + issuerPath: + issuer && + factory.create(`${type.slice(0, -8)}.issuerPath`, path, context), + failed: errorsCount > 0, + errors: errorsCount, + warnings: warningsCount + }; + Object.assign(object, statsModule); + if (profile) { + object.profile = factory.create( + `${type.slice(0, -8)}.profile`, + profile, + context + ); + } + }, + ids: (object, module, { compilation: { chunkGraph, moduleGraph } }) => { + object.id = chunkGraph.getModuleId(module); + const issuer = moduleGraph.getIssuer(module); + object.issuerId = issuer && chunkGraph.getModuleId(issuer); + object.chunks = Array.from( + chunkGraph.getOrderedModuleChunksIterable(module, compareChunksById), + chunk => chunk.id + ); + }, + moduleAssets: (object, module) => { + object.assets = module.buildInfo.assets + ? Object.keys(module.buildInfo.assets) + : []; + }, + reasons: (object, module, context, options, factory) => { + const { + type, + compilation: { moduleGraph } + } = context; + const groupsReasons = factory.create( + `${type.slice(0, -8)}.reasons`, + Array.from(moduleGraph.getIncomingConnections(module)), + context + ); + const limited = spaceLimited(groupsReasons, options.reasonsSpace); + object.reasons = limited.children; + object.filteredReasons = limited.filteredChildren; + }, + usedExports: ( + object, + module, + { runtime, compilation: { moduleGraph } } + ) => { + const usedExports = moduleGraph.getUsedExports(module, runtime); + if (usedExports === null) { + object.usedExports = null; + } else if (typeof usedExports === "boolean") { + object.usedExports = usedExports; } else { - const result = fn(context, identifier); - innerSubCache.set(identifier, result); - return result; + object.usedExports = Array.from(usedExports); } - }; - - return boundFn; - }; - - /** - * @param {string} context context used to create relative path - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {function(string): string} cached function - */ - cachedFn.bindContextCache = (context, associatedObjectForCache) => { - let innerSubCache; - if (associatedObjectForCache) { - let innerCache = cache.get(associatedObjectForCache); - if (innerCache === undefined) { - innerCache = new Map(); - cache.set(associatedObjectForCache, innerCache); + }, + providedExports: (object, module, { compilation: { moduleGraph } }) => { + const providedExports = moduleGraph.getProvidedExports(module); + object.providedExports = Array.isArray(providedExports) + ? providedExports + : null; + }, + optimizationBailout: ( + object, + module, + { compilation: { moduleGraph } }, + { requestShortener } + ) => { + object.optimizationBailout = moduleGraph + .getOptimizationBailout(module) + .map(item => { + if (typeof item === "function") return item(requestShortener); + return item; + }); + }, + depth: (object, module, { compilation: { moduleGraph } }) => { + object.depth = moduleGraph.getDepth(module); + }, + nestedModules: (object, module, context, options, factory) => { + const { type } = context; + const innerModules = /** @type {Module & { modules?: Module[] }} */ ( + module + ).modules; + if (Array.isArray(innerModules)) { + const groupedModules = factory.create( + `${type.slice(0, -8)}.modules`, + innerModules, + context + ); + const limited = spaceLimited( + groupedModules, + options.nestedModulesSpace + ); + object.modules = limited.children; + object.filteredModules = limited.filteredChildren; } - - innerSubCache = innerCache.get(context); - if (innerSubCache === undefined) { - innerCache.set(context, (innerSubCache = new Map())); + }, + source: (object, module) => { + const originalSource = module.originalSource(); + if (originalSource) { + object.source = originalSource.source(); } - } else { - innerSubCache = new Map(); } - - /** - * @param {string} identifier identifier used to create relative path - * @returns {string} the returned relative path - */ - const boundFn = identifier => { - const cachedResult = innerSubCache.get(identifier); - if (cachedResult !== undefined) { - return cachedResult; - } else { - const result = fn(context, identifier); - innerSubCache.set(identifier, result); - return result; + }, + profile: { + _: (object, profile) => { + /** @type {KnownStatsProfile} */ + const statsProfile = { + total: + profile.factory + + profile.restoring + + profile.integration + + profile.building + + profile.storing, + resolving: profile.factory, + restoring: profile.restoring, + building: profile.building, + integration: profile.integration, + storing: profile.storing, + additionalResolving: profile.additionalFactories, + additionalIntegration: profile.additionalIntegration, + // TODO remove this in webpack 6 + factory: profile.factory, + // TODO remove this in webpack 6 + dependencies: profile.additionalFactories + }; + Object.assign(object, statsProfile); + } + }, + moduleIssuer: { + _: (object, module, context, { requestShortener }, factory) => { + const { compilation, type } = context; + const { moduleGraph } = compilation; + const profile = moduleGraph.getProfile(module); + /** @type {KnownStatsModuleIssuer} */ + const statsModuleIssuer = { + identifier: module.identifier(), + name: module.readableIdentifier(requestShortener) + }; + Object.assign(object, statsModuleIssuer); + if (profile) { + object.profile = factory.create(`${type}.profile`, profile, context); } - }; - - return boundFn; - }; - - return cachedFn; -}; - -/** - * - * @param {string} context context for relative path - * @param {string} identifier identifier for path - * @returns {string} a converted relative path - */ -const _makePathsRelative = (context, identifier) => { - return identifier - .split(SEGMENTS_SPLIT_REGEXP) - .map(str => absoluteToRequest(context, str)) - .join(""); -}; - -exports.makePathsRelative = makeCacheableWithContext(_makePathsRelative); - -/** - * - * @param {string} context context for relative path - * @param {string} identifier identifier for path - * @returns {string} a converted relative path - */ -const _makePathsAbsolute = (context, identifier) => { - return identifier - .split(SEGMENTS_SPLIT_REGEXP) - .map(str => requestToAbsolute(context, str)) - .join(""); -}; - -exports.makePathsAbsolute = makeCacheableWithContext(_makePathsAbsolute); - -/** - * @param {string} context absolute context path - * @param {string} request any request string may containing absolute paths, query string, etc. - * @returns {string} a new request string avoiding absolute paths when possible - */ -const _contextify = (context, request) => { - return request - .split("!") - .map(r => absoluteToRequest(context, r)) - .join("!"); -}; - -const contextify = makeCacheableWithContext(_contextify); -exports.contextify = contextify; - -/** - * @param {string} context absolute context path - * @param {string} request any request string - * @returns {string} a new request string using absolute paths when possible - */ -const _absolutify = (context, request) => { - return request - .split("!") - .map(r => requestToAbsolute(context, r)) - .join("!"); -}; - -const absolutify = makeCacheableWithContext(_absolutify); -exports.absolutify = absolutify; - -const PATH_QUERY_FRAGMENT_REGEXP = - /^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/; -const PATH_QUERY_REGEXP = /^((?:\0.|[^?\0])*)(\?.*)?$/; - -/** @typedef {{ resource: string, path: string, query: string, fragment: string }} ParsedResource */ -/** @typedef {{ resource: string, path: string, query: string }} ParsedResourceWithoutFragment */ - -/** - * @param {string} str the path with query and fragment - * @returns {ParsedResource} parsed parts - */ -const _parseResource = str => { - const match = PATH_QUERY_FRAGMENT_REGEXP.exec(str); - return { - resource: str, - path: match[1].replace(/\0(.)/g, "$1"), - query: match[2] ? match[2].replace(/\0(.)/g, "$1") : "", - fragment: match[3] || "" - }; -}; -exports.parseResource = makeCacheable(_parseResource); - -/** - * Parse resource, skips fragment part - * @param {string} str the path with query and fragment - * @returns {ParsedResourceWithoutFragment} parsed parts - */ -const _parseResourceWithoutFragment = str => { - const match = PATH_QUERY_REGEXP.exec(str); - return { - resource: str, - path: match[1].replace(/\0(.)/g, "$1"), - query: match[2] ? match[2].replace(/\0(.)/g, "$1") : "" - }; -}; -exports.parseResourceWithoutFragment = makeCacheable( - _parseResourceWithoutFragment -); - -/** - * @param {string} filename the filename which should be undone - * @param {string} outputPath the output path that is restored (only relevant when filename contains "..") - * @param {boolean} enforceRelative true returns ./ for empty paths - * @returns {string} repeated ../ to leave the directory of the provided filename to be back on output dir - */ -exports.getUndoPath = (filename, outputPath, enforceRelative) => { - let depth = -1; - let append = ""; - outputPath = outputPath.replace(/[\\/]$/, ""); - for (const part of filename.split(/[/\\]+/)) { - if (part === "..") { - if (depth > -1) { - depth--; - } else { - const i = outputPath.lastIndexOf("/"); - const j = outputPath.lastIndexOf("\\"); - const pos = i < 0 ? j : j < 0 ? i : Math.max(i, j); - if (pos < 0) return outputPath + "/"; - append = outputPath.slice(pos + 1) + "/" + append; - outputPath = outputPath.slice(0, pos); + }, + ids: (object, module, { compilation: { chunkGraph } }) => { + object.id = chunkGraph.getModuleId(module); + } + }, + moduleReason: { + _: (object, reason, { runtime }, { requestShortener }) => { + const dep = reason.dependency; + const moduleDep = + dep && dep instanceof ModuleDependency ? dep : undefined; + /** @type {KnownStatsModuleReason} */ + const statsModuleReason = { + moduleIdentifier: reason.originModule + ? reason.originModule.identifier() + : null, + module: reason.originModule + ? reason.originModule.readableIdentifier(requestShortener) + : null, + moduleName: reason.originModule + ? reason.originModule.readableIdentifier(requestShortener) + : null, + resolvedModuleIdentifier: reason.resolvedOriginModule + ? reason.resolvedOriginModule.identifier() + : null, + resolvedModule: reason.resolvedOriginModule + ? reason.resolvedOriginModule.readableIdentifier(requestShortener) + : null, + type: reason.dependency ? reason.dependency.type : null, + active: reason.isActive(runtime), + explanation: reason.explanation, + userRequest: (moduleDep && moduleDep.userRequest) || null + }; + Object.assign(object, statsModuleReason); + if (reason.dependency) { + const locInfo = formatLocation(reason.dependency.loc); + if (locInfo) { + object.loc = locInfo; + } } - } else if (part !== ".") { - depth++; + }, + ids: (object, reason, { compilation: { chunkGraph } }) => { + object.moduleId = reason.originModule + ? chunkGraph.getModuleId(reason.originModule) + : null; + object.resolvedModuleId = reason.resolvedOriginModule + ? chunkGraph.getModuleId(reason.resolvedOriginModule) + : null; } - } - return depth > 0 - ? `${"../".repeat(depth)}${append}` - : enforceRelative - ? `./${append}` - : append; -}; - - -/***/ }), - -/***/ 53023: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - + }, + chunk: { + _: (object, chunk, { makePathsRelative, compilation: { chunkGraph } }) => { + const childIdByOrder = chunk.getChildIdsByOrders(chunkGraph); -// We need to include a list of requires here -// to allow webpack to be bundled with only static requires -// We could use a dynamic require(`../${request}`) but this -// would include too many modules and not every tool is able -// to process this -module.exports = { - AsyncDependenciesBlock: () => __webpack_require__(47736), - CommentCompilationWarning: () => __webpack_require__(98427), - ContextModule: () => __webpack_require__(76729), - "cache/PackFileCacheStrategy": () => - __webpack_require__(86180), - "cache/ResolverCachePlugin": () => __webpack_require__(97347), - "container/ContainerEntryDependency": () => - __webpack_require__(64813), - "container/ContainerEntryModule": () => - __webpack_require__(80580), - "container/ContainerExposedDependency": () => - __webpack_require__(72374), - "container/FallbackDependency": () => - __webpack_require__(57764), - "container/FallbackItemDependency": () => - __webpack_require__(29593), - "container/FallbackModule": () => __webpack_require__(82886), - "container/RemoteModule": () => __webpack_require__(62916), - "container/RemoteToExternalDependency": () => - __webpack_require__(14389), - "dependencies/AMDDefineDependency": () => - __webpack_require__(96816), - "dependencies/AMDRequireArrayDependency": () => - __webpack_require__(33516), - "dependencies/AMDRequireContextDependency": () => - __webpack_require__(96123), - "dependencies/AMDRequireDependenciesBlock": () => - __webpack_require__(76932), - "dependencies/AMDRequireDependency": () => - __webpack_require__(43911), - "dependencies/AMDRequireItemDependency": () => - __webpack_require__(71806), - "dependencies/CachedConstDependency": () => - __webpack_require__(57403), - "dependencies/CreateScriptUrlDependency": () => - __webpack_require__(79062), - "dependencies/CommonJsRequireContextDependency": () => - __webpack_require__(23962), - "dependencies/CommonJsExportRequireDependency": () => - __webpack_require__(62892), - "dependencies/CommonJsExportsDependency": () => - __webpack_require__(45598), - "dependencies/CommonJsFullRequireDependency": () => - __webpack_require__(59440), - "dependencies/CommonJsRequireDependency": () => - __webpack_require__(21264), - "dependencies/CommonJsSelfReferenceDependency": () => - __webpack_require__(52225), - "dependencies/ConstDependency": () => - __webpack_require__(76911), - "dependencies/ContextDependency": () => - __webpack_require__(88101), - "dependencies/ContextElementDependency": () => - __webpack_require__(58477), - "dependencies/CriticalDependencyWarning": () => - __webpack_require__(15427), - "dependencies/CssImportDependency": () => - __webpack_require__(90542), - "dependencies/CssLocalIdentifierDependency": () => - __webpack_require__(92328), - "dependencies/CssSelfLocalIdentifierDependency": () => - __webpack_require__(29094), - "dependencies/CssExportDependency": () => - __webpack_require__(76760), - "dependencies/CssUrlDependency": () => - __webpack_require__(70749), - "dependencies/DelegatedSourceDependency": () => - __webpack_require__(22914), - "dependencies/DllEntryDependency": () => - __webpack_require__(95666), - "dependencies/EntryDependency": () => - __webpack_require__(3979), - "dependencies/ExportsInfoDependency": () => - __webpack_require__(78988), - "dependencies/HarmonyAcceptDependency": () => - __webpack_require__(23624), - "dependencies/HarmonyAcceptImportDependency": () => - __webpack_require__(99843), - "dependencies/HarmonyCompatibilityDependency": () => - __webpack_require__(72906), - "dependencies/HarmonyExportExpressionDependency": () => - __webpack_require__(51340), - "dependencies/HarmonyExportHeaderDependency": () => - __webpack_require__(38873), - "dependencies/HarmonyExportImportedSpecifierDependency": () => - __webpack_require__(67157), - "dependencies/HarmonyExportSpecifierDependency": () => - __webpack_require__(48567), - "dependencies/HarmonyImportSideEffectDependency": () => - __webpack_require__(73132), - "dependencies/HarmonyImportSpecifierDependency": () => - __webpack_require__(14077), - "dependencies/ImportContextDependency": () => - __webpack_require__(1902), - "dependencies/ImportDependency": () => - __webpack_require__(89376), - "dependencies/ImportEagerDependency": () => - __webpack_require__(50718), - "dependencies/ImportWeakDependency": () => - __webpack_require__(82483), - "dependencies/JsonExportsDependency": () => - __webpack_require__(750), - "dependencies/LocalModule": () => __webpack_require__(5826), - "dependencies/LocalModuleDependency": () => - __webpack_require__(52805), - "dependencies/ModuleDecoratorDependency": () => - __webpack_require__(88488), - "dependencies/ModuleHotAcceptDependency": () => - __webpack_require__(47511), - "dependencies/ModuleHotDeclineDependency": () => - __webpack_require__(86301), - "dependencies/ImportMetaHotAcceptDependency": () => - __webpack_require__(51274), - "dependencies/ImportMetaHotDeclineDependency": () => - __webpack_require__(53141), - "dependencies/ProvidedDependency": () => - __webpack_require__(95770), - "dependencies/PureExpressionDependency": () => - __webpack_require__(55799), - "dependencies/RequireContextDependency": () => - __webpack_require__(46917), - "dependencies/RequireEnsureDependenciesBlock": () => - __webpack_require__(27153), - "dependencies/RequireEnsureDependency": () => - __webpack_require__(27223), - "dependencies/RequireEnsureItemDependency": () => - __webpack_require__(50329), - "dependencies/RequireHeaderDependency": () => - __webpack_require__(89183), - "dependencies/RequireIncludeDependency": () => - __webpack_require__(71284), - "dependencies/RequireIncludeDependencyParserPlugin": () => - __webpack_require__(35768), - "dependencies/RequireResolveContextDependency": () => - __webpack_require__(55627), - "dependencies/RequireResolveDependency": () => - __webpack_require__(68582), - "dependencies/RequireResolveHeaderDependency": () => - __webpack_require__(9880), - "dependencies/RuntimeRequirementsDependency": () => - __webpack_require__(24187), - "dependencies/StaticExportsDependency": () => - __webpack_require__(91418), - "dependencies/SystemPlugin": () => __webpack_require__(97981), - "dependencies/UnsupportedDependency": () => - __webpack_require__(51669), - "dependencies/URLDependency": () => __webpack_require__(58612), - "dependencies/WebAssemblyExportImportedDependency": () => - __webpack_require__(52204), - "dependencies/WebAssemblyImportDependency": () => - __webpack_require__(5239), - "dependencies/WebpackIsIncludedDependency": () => - __webpack_require__(26505), - "dependencies/WorkerDependency": () => - __webpack_require__(1466), - "json/JsonData": () => __webpack_require__(90490), - "optimize/ConcatenatedModule": () => - __webpack_require__(97198), - DelegatedModule: () => __webpack_require__(28623), - DependenciesBlock: () => __webpack_require__(71040), - DllModule: () => __webpack_require__(28280), - ExternalModule: () => __webpack_require__(73071), - FileSystemInfo: () => __webpack_require__(79453), - InitFragment: () => __webpack_require__(55870), - InvalidDependenciesModuleWarning: () => - __webpack_require__(68257), - Module: () => __webpack_require__(73208), - ModuleBuildError: () => __webpack_require__(21305), - ModuleDependencyWarning: () => __webpack_require__(29656), - ModuleError: () => __webpack_require__(23744), - ModuleGraph: () => __webpack_require__(99988), - ModuleParseError: () => __webpack_require__(58443), - ModuleWarning: () => __webpack_require__(11234), - NormalModule: () => __webpack_require__(39), - RawDataUrlModule: () => __webpack_require__(19684), - RawModule: () => __webpack_require__(84929), - "sharing/ConsumeSharedModule": () => - __webpack_require__(62286), - "sharing/ConsumeSharedFallbackDependency": () => - __webpack_require__(58831), - "sharing/ProvideSharedModule": () => - __webpack_require__(50821), - "sharing/ProvideSharedDependency": () => - __webpack_require__(1798), - "sharing/ProvideForSharedDependency": () => - __webpack_require__(40017), - UnsupportedFeatureWarning: () => __webpack_require__(42495), - "util/LazySet": () => __webpack_require__(38938), - UnhandledSchemeError: () => __webpack_require__(68099), - NodeStuffInWebError: () => __webpack_require__(6325), - WebpackError: () => __webpack_require__(53799), + /** @type {KnownStatsChunk} */ + const statsChunk = { + rendered: chunk.rendered, + initial: chunk.canBeInitial(), + entry: chunk.hasRuntime(), + recorded: AggressiveSplittingPlugin.wasChunkRecorded(chunk), + reason: chunk.chunkReason, + size: chunkGraph.getChunkModulesSize(chunk), + sizes: chunkGraph.getChunkModulesSizes(chunk), + names: chunk.name ? [chunk.name] : [], + idHints: Array.from(chunk.idNameHints), + runtime: + chunk.runtime === undefined + ? undefined + : typeof chunk.runtime === "string" + ? [makePathsRelative(chunk.runtime)] + : Array.from(chunk.runtime.sort(), makePathsRelative), + files: Array.from(chunk.files), + auxiliaryFiles: Array.from(chunk.auxiliaryFiles).sort(compareIds), + hash: chunk.renderedHash, + childrenByOrder: childIdByOrder + }; + Object.assign(object, statsChunk); + }, + ids: (object, chunk) => { + object.id = chunk.id; + }, + chunkRelations: (object, chunk, { compilation: { chunkGraph } }) => { + /** @type {Set} */ + const parents = new Set(); + /** @type {Set} */ + const children = new Set(); + /** @type {Set} */ + const siblings = new Set(); - "util/registerExternalSerializer": () => { - // already registered + for (const chunkGroup of chunk.groupsIterable) { + for (const parentGroup of chunkGroup.parentsIterable) { + for (const chunk of parentGroup.chunks) { + parents.add(chunk.id); + } + } + for (const childGroup of chunkGroup.childrenIterable) { + for (const chunk of childGroup.chunks) { + children.add(chunk.id); + } + } + for (const sibling of chunkGroup.chunks) { + if (sibling !== chunk) siblings.add(sibling.id); + } + } + object.siblings = Array.from(siblings).sort(compareIds); + object.parents = Array.from(parents).sort(compareIds); + object.children = Array.from(children).sort(compareIds); + }, + chunkModules: (object, chunk, context, options, factory) => { + const { + type, + compilation: { chunkGraph } + } = context; + const array = chunkGraph.getChunkModules(chunk); + const groupedModules = factory.create(`${type}.modules`, array, { + ...context, + runtime: chunk.runtime, + rootModules: new Set(chunkGraph.getChunkRootModules(chunk)) + }); + const limited = spaceLimited(groupedModules, options.chunkModulesSpace); + object.modules = limited.children; + object.filteredModules = limited.filteredChildren; + }, + chunkOrigins: (object, chunk, context, options, factory) => { + const { + type, + compilation: { chunkGraph } + } = context; + /** @type {Set} */ + const originsKeySet = new Set(); + const origins = []; + for (const g of chunk.groupsIterable) { + origins.push(...g.origins); + } + const array = origins.filter(origin => { + const key = [ + origin.module ? chunkGraph.getModuleId(origin.module) : undefined, + formatLocation(origin.loc), + origin.request + ].join(); + if (originsKeySet.has(key)) return false; + originsKeySet.add(key); + return true; + }); + object.origins = factory.create(`${type}.origins`, array, context); + } + }, + chunkOrigin: { + _: (object, origin, context, { requestShortener }) => { + /** @type {KnownStatsChunkOrigin} */ + const statsChunkOrigin = { + module: origin.module ? origin.module.identifier() : "", + moduleIdentifier: origin.module ? origin.module.identifier() : "", + moduleName: origin.module + ? origin.module.readableIdentifier(requestShortener) + : "", + loc: formatLocation(origin.loc), + request: origin.request + }; + Object.assign(object, statsChunkOrigin); + }, + ids: (object, origin, { compilation: { chunkGraph } }) => { + object.moduleId = origin.module + ? chunkGraph.getModuleId(origin.module) + : undefined; + } + }, + error: EXTRACT_ERROR, + warning: EXTRACT_ERROR, + moduleTraceItem: { + _: (object, { origin, module }, context, { requestShortener }, factory) => { + const { + type, + compilation: { moduleGraph } + } = context; + object.originIdentifier = origin.identifier(); + object.originName = origin.readableIdentifier(requestShortener); + object.moduleIdentifier = module.identifier(); + object.moduleName = module.readableIdentifier(requestShortener); + const dependencies = Array.from( + moduleGraph.getIncomingConnections(module) + ) + .filter(c => c.resolvedOriginModule === origin && c.dependency) + .map(c => c.dependency); + object.dependencies = factory.create( + `${type}.dependencies`, + Array.from(new Set(dependencies)), + context + ); + }, + ids: (object, { origin, module }, { compilation: { chunkGraph } }) => { + object.originId = chunkGraph.getModuleId(origin); + object.moduleId = chunkGraph.getModuleId(module); + } + }, + moduleTraceDependency: { + _: (object, dependency) => { + object.loc = formatLocation(dependency.loc); + } } }; - -/***/ }), - -/***/ 33032: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - - -const { register } = __webpack_require__(8282); - -class ClassSerializer { - constructor(Constructor) { - this.Constructor = Constructor; - } - - serialize(obj, context) { - obj.serialize(context); - } - - deserialize(context) { - if (typeof this.Constructor.deserialize === "function") { - return this.Constructor.deserialize(context); +/** @type {Record boolean | undefined>>} */ +const FILTER = { + "module.reasons": { + "!orphanModules": (reason, { compilation: { chunkGraph } }) => { + if ( + reason.originModule && + chunkGraph.getNumberOfModuleChunks(reason.originModule) === 0 + ) { + return false; + } } - const obj = new this.Constructor(); - obj.deserialize(context); - return obj; } -} - -module.exports = (Constructor, request, name = null) => { - register(Constructor, request, name, new ClassSerializer(Constructor)); }; - -/***/ }), - -/***/ 78676: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - - -/** @template T @typedef {function(): T} FunctionReturning */ - -/** - * @template T - * @param {FunctionReturning} fn memorized function - * @returns {FunctionReturning} new function - */ -const memoize = fn => { - let cache = false; - /** @type {T} */ - let result = undefined; - return () => { - if (cache) { - return result; - } else { - result = fn(); - cache = true; - // Allow to clean up memory for fn - // and all dependent resources - fn = undefined; - return result; - } - }; +/** @type {Record boolean | undefined>>} */ +const FILTER_RESULTS = { + "compilation.warnings": { + warningsFilter: util.deprecate( + (warning, context, { warningsFilter }) => { + const warningString = Object.keys(warning) + .map(key => `${warning[key]}`) + .join("\n"); + return !warningsFilter.some(filter => filter(warning, warningString)); + }, + "config.stats.warningsFilter is deprecated in favor of config.ignoreWarnings", + "DEP_WEBPACK_STATS_WARNINGS_FILTER" + ) + } }; -module.exports = memoize; - - -/***/ }), - -/***/ 55668: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ - - - -const A_CODE = "a".charCodeAt(0); - -/** - * @param {string} hash hash - * @param {number} hashLength hash length - * @returns {string} returns hash that has at least one non numeric char - */ -module.exports = (hash, hashLength) => { - if (hashLength < 1) return ""; - const slice = hash.slice(0, hashLength); - if (slice.match(/[^\d]/)) return slice; - return `${String.fromCharCode( - A_CODE + (parseInt(hash[0], 10) % 6) - )}${slice.slice(1)}`; +/** @type {Record void>} */ +const MODULES_SORTER = { + _: (comparators, { compilation: { moduleGraph } }) => { + comparators.push( + compareSelect( + /** + * @param {Module} m module + * @returns {number} depth + */ + m => moduleGraph.getDepth(m), + compareNumbers + ), + compareSelect( + /** + * @param {Module} m module + * @returns {number} index + */ + m => moduleGraph.getPreOrderIndex(m), + compareNumbers + ), + compareSelect( + /** + * @param {Module} m module + * @returns {string} identifier + */ + m => m.identifier(), + compareIds + ) + ); + } }; - -/***/ }), - -/***/ 70002: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const SAFE_LIMIT = 0x80000000; -const SAFE_PART = SAFE_LIMIT - 1; -const COUNT = 4; -const arr = [0, 0, 0, 0, 0]; -const primes = [3, 7, 17, 19]; - -module.exports = (str, range) => { - arr.fill(0); - for (let i = 0; i < str.length; i++) { - const c = str.charCodeAt(i); - for (let j = 0; j < COUNT; j++) { - const p = (j + COUNT - 1) % COUNT; - arr[j] = (arr[j] + c * primes[j] + arr[p]) & SAFE_PART; - } - for (let j = 0; j < COUNT; j++) { - const q = arr[j] % COUNT; - arr[j] = arr[j] ^ (arr[q] >> 1); - } - } - if (range <= SAFE_PART) { - let sum = 0; - for (let j = 0; j < COUNT; j++) { - sum = (sum + arr[j]) % range; +/** @type {Record void>>} */ +const SORTERS = { + "compilation.chunks": { + _: comparators => { + comparators.push(compareSelect(c => c.id, compareIds)); } - return sum; - } else { - let sum1 = 0; - let sum2 = 0; - const rangeExt = Math.floor(range / SAFE_LIMIT); - for (let j = 0; j < COUNT; j += 2) { - sum1 = (sum1 + arr[j]) & SAFE_PART; + }, + "compilation.modules": MODULES_SORTER, + "chunk.rootModules": MODULES_SORTER, + "chunk.modules": MODULES_SORTER, + "module.modules": MODULES_SORTER, + "module.reasons": { + _: (comparators, { compilation: { chunkGraph } }) => { + comparators.push( + compareSelect(x => x.originModule, compareModulesByIdentifier) + ); + comparators.push( + compareSelect(x => x.resolvedOriginModule, compareModulesByIdentifier) + ); + comparators.push( + compareSelect( + x => x.dependency, + concatComparators( + compareSelect( + /** + * @param {Dependency} x dependency + * @returns {DependencyLocation} location + */ + x => x.loc, + compareLocations + ), + compareSelect(x => x.type, compareIds) + ) + ) + ); } - for (let j = 1; j < COUNT; j += 2) { - sum2 = (sum2 + arr[j]) % rangeExt; + }, + "chunk.origins": { + _: (comparators, { compilation: { chunkGraph } }) => { + comparators.push( + compareSelect( + origin => + origin.module ? chunkGraph.getModuleId(origin.module) : undefined, + compareIds + ), + compareSelect(origin => formatLocation(origin.loc), compareIds), + compareSelect(origin => origin.request, compareIds) + ); } - return (sum2 * SAFE_LIMIT + sum1) % range; } }; +const getItemSize = item => { + // Each item takes 1 line + // + the size of the children + // + 1 extra line when it has children and filteredChildren + return !item.children + ? 1 + : item.filteredChildren + ? 2 + getTotalSize(item.children) + : 1 + getTotalSize(item.children); +}; -/***/ }), - -/***/ 42791: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** - * @template T - * @template {Error} E - * @param {Iterable} items initial items - * @param {number} concurrency number of items running in parallel - * @param {function(T, function(T): void, function(E=): void): void} processor worker which pushes more items - * @param {function(E=): void} callback all items processed - * @returns {void} - */ -const processAsyncTree = (items, concurrency, processor, callback) => { - const queue = Array.from(items); - if (queue.length === 0) return callback(); - let processing = 0; - let finished = false; - let processScheduled = true; - - const push = item => { - queue.push(item); - if (!processScheduled && processing < concurrency) { - processScheduled = true; - process.nextTick(processQueue); - } - }; +const getTotalSize = children => { + let size = 0; + for (const child of children) { + size += getItemSize(child); + } + return size; +}; - const processorCallback = err => { - processing--; - if (err && !finished) { - finished = true; - callback(err); - return; - } - if (!processScheduled) { - processScheduled = true; - process.nextTick(processQueue); +const getTotalItems = children => { + let count = 0; + for (const child of children) { + if (!child.children && !child.filteredChildren) { + count++; + } else { + if (child.children) count += getTotalItems(child.children); + if (child.filteredChildren) count += child.filteredChildren; } - }; + } + return count; +}; - const processQueue = () => { - if (finished) return; - while (processing < concurrency && queue.length > 0) { - processing++; - const item = queue.pop(); - processor(item, push, processorCallback); - } - processScheduled = false; - if (queue.length === 0 && processing === 0 && !finished) { - finished = true; - callback(); +const collapse = children => { + // After collapse each child must take exactly one line + const newChildren = []; + for (const child of children) { + if (child.children) { + let filteredChildren = child.filteredChildren || 0; + filteredChildren += getTotalItems(child.children); + newChildren.push({ + ...child, + children: undefined, + filteredChildren + }); + } else { + newChildren.push(child); } - }; - - processQueue(); + } + return newChildren; }; -module.exports = processAsyncTree; - - -/***/ }), - -/***/ 54190: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const SAFE_IDENTIFIER = /^[_a-zA-Z$][_a-zA-Z$0-9]*$/; -const RESERVED_IDENTIFIER = new Set([ - "break", - "case", - "catch", - "class", - "const", - "continue", - "debugger", - "default", - "delete", - "do", - "else", - "export", - "extends", - "finally", - "for", - "function", - "if", - "import", - "in", - "instanceof", - "new", - "return", - "super", - "switch", - "this", - "throw", - "try", - "typeof", - "var", - "void", - "while", - "with", - "enum", - // strict mode - "implements", - "interface", - "let", - "package", - "private", - "protected", - "public", - "static", - "yield", - "yield", - // module code - "await", - // skip future reserved keywords defined under ES1 till ES3 - // additional - "null", - "true", - "false" -]); +const spaceLimited = ( + itemsAndGroups, + max, + filteredChildrenLineReserved = false +) => { + if (max < 1) { + return { + children: undefined, + filteredChildren: getTotalItems(itemsAndGroups) + }; + } + /** @type {any[] | undefined} */ + let children = undefined; + /** @type {number | undefined} */ + let filteredChildren = undefined; + // This are the groups, which take 1+ lines each + const groups = []; + // The sizes of the groups are stored in groupSizes + const groupSizes = []; + // This are the items, which take 1 line each + const items = []; + // The total of group sizes + let groupsSize = 0; -const propertyAccess = (properties, start = 0) => { - let str = ""; - for (let i = start; i < properties.length; i++) { - const p = properties[i]; - if (`${+p}` === p) { - str += `[${p}]`; - } else if (SAFE_IDENTIFIER.test(p) && !RESERVED_IDENTIFIER.has(p)) { - str += `.${p}`; + for (const itemOrGroup of itemsAndGroups) { + // is item + if (!itemOrGroup.children && !itemOrGroup.filteredChildren) { + items.push(itemOrGroup); } else { - str += `[${JSON.stringify(p)}]`; + groups.push(itemOrGroup); + const size = getItemSize(itemOrGroup); + groupSizes.push(size); + groupsSize += size; } } - return str; -}; - -module.exports = propertyAccess; - - -/***/ }), - -/***/ 26611: -/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { register } = __webpack_require__(8282); - -const Position = /** @type {TODO} */ (__webpack_require__(31988).Position); -const SourceLocation = (__webpack_require__(31988).SourceLocation); -const ValidationError = (__webpack_require__(54983)/* ["default"] */ .Z); -const { - CachedSource, - ConcatSource, - OriginalSource, - PrefixSource, - RawSource, - ReplaceSource, - SourceMapSource -} = __webpack_require__(51255); - -/** @typedef {import("acorn").Position} Position */ -/** @typedef {import("../Dependency").RealDependencyLocation} RealDependencyLocation */ -/** @typedef {import("../Dependency").SourcePosition} SourcePosition */ -/** @typedef {import("./serialization").ObjectDeserializerContext} ObjectDeserializerContext */ -/** @typedef {import("./serialization").ObjectSerializerContext} ObjectSerializerContext */ - -/** @typedef {ObjectSerializerContext & { writeLazy?: (any) => void }} WebpackObjectSerializerContext */ - -const CURRENT_MODULE = "webpack/lib/util/registerExternalSerializer"; -register( - CachedSource, - CURRENT_MODULE, - "webpack-sources/CachedSource", - new (class CachedSourceSerializer { - /** - * @param {CachedSource} source the cached source to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(source, { write, writeLazy }) { - if (writeLazy) { - writeLazy(source.originalLazy()); - } else { - write(source.original()); + if (groupsSize + items.length <= max) { + // The total size in the current state fits into the max + // keep all + children = groups.length > 0 ? groups.concat(items) : items; + } else if (groups.length === 0) { + // slice items to max + // inner space marks that lines for filteredChildren already reserved + const limit = max - (filteredChildrenLineReserved ? 0 : 1); + filteredChildren = items.length - limit; + items.length = limit; + children = items; + } else { + // limit is the size when all groups are collapsed + const limit = + groups.length + + (filteredChildrenLineReserved || items.length === 0 ? 0 : 1); + if (limit < max) { + // calculate how much we are over the size limit + // this allows to approach the limit faster + let oversize; + // If each group would take 1 line the total would be below the maximum + // collapse some groups, keep items + while ( + (oversize = + groupsSize + + items.length + + (filteredChildren && !filteredChildrenLineReserved ? 1 : 0) - + max) > 0 + ) { + // Find the maximum group and process only this one + const maxGroupSize = Math.max(...groupSizes); + if (maxGroupSize < items.length) { + filteredChildren = items.length; + items.length = 0; + continue; + } + for (let i = 0; i < groups.length; i++) { + if (groupSizes[i] === maxGroupSize) { + const group = groups[i]; + // run this algorithm recursively and limit the size of the children to + // current size - oversize / number of groups + // So it should always end up being smaller + const headerSize = group.filteredChildren ? 2 : 1; + const limited = spaceLimited( + group.children, + maxGroupSize - + // we should use ceil to always feet in max + Math.ceil(oversize / groups.length) - + // we substitute size of group head + headerSize, + headerSize === 2 + ); + groups[i] = { + ...group, + children: limited.children, + filteredChildren: limited.filteredChildren + ? (group.filteredChildren || 0) + limited.filteredChildren + : group.filteredChildren + }; + const newSize = getItemSize(groups[i]); + groupsSize -= maxGroupSize - newSize; + groupSizes[i] = newSize; + break; + } + } } - write(source.getCachedData()); - } - - /** - * @param {ObjectDeserializerContext} context context - * @returns {CachedSource} cached source - */ - deserialize({ read }) { - const source = read(); - const cachedData = read(); - return new CachedSource(source, cachedData); + children = groups.concat(items); + } else if (limit === max) { + // If we have only enough space to show one line per group and one line for the filtered items + // collapse all groups and items + children = collapse(groups); + filteredChildren = items.length; + } else { + // If we have no space + // collapse complete group + filteredChildren = getTotalItems(itemsAndGroups); } - })() -); + } -register( - RawSource, - CURRENT_MODULE, - "webpack-sources/RawSource", - new (class RawSourceSerializer { - /** - * @param {RawSource} source the raw source to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(source, { write }) { - write(source.buffer()); - write(!source.isBuffer()); - } + return { + children, + filteredChildren + }; +}; - /** - * @param {ObjectDeserializerContext} context context - * @returns {RawSource} raw source - */ - deserialize({ read }) { - const source = read(); - const convertToString = read(); - return new RawSource(source, convertToString); - } - })() -); +const assetGroup = (children, assets) => { + let size = 0; + for (const asset of children) { + size += asset.size; + } + return { + size + }; +}; -register( - ConcatSource, - CURRENT_MODULE, - "webpack-sources/ConcatSource", - new (class ConcatSourceSerializer { - /** - * @param {ConcatSource} source the concat source to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(source, { write }) { - write(source.getChildren()); +const moduleGroup = (children, modules) => { + let size = 0; + const sizes = {}; + for (const module of children) { + size += module.size; + for (const key of Object.keys(module.sizes)) { + sizes[key] = (sizes[key] || 0) + module.sizes[key]; } + } + return { + size, + sizes + }; +}; - /** - * @param {ObjectDeserializerContext} context context - * @returns {ConcatSource} concat source - */ - deserialize({ read }) { - const source = new ConcatSource(); - source.addAllSkipOptimizing(read()); - return source; - } - })() -); +const reasonGroup = (children, reasons) => { + let active = false; + for (const reason of children) { + active = active || reason.active; + } + return { + active + }; +}; -register( - PrefixSource, - CURRENT_MODULE, - "webpack-sources/PrefixSource", - new (class PrefixSourceSerializer { - /** - * @param {PrefixSource} source the prefix source to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(source, { write }) { - write(source.getPrefix()); - write(source.original()); - } +const GROUP_EXTENSION_REGEXP = /(\.[^.]+?)(?:\?|(?: \+ \d+ modules?)?$)/; +const GROUP_PATH_REGEXP = /(.+)[/\\][^/\\]+?(?:\?|(?: \+ \d+ modules?)?$)/; - /** - * @param {ObjectDeserializerContext} context context - * @returns {PrefixSource} prefix source - */ - deserialize({ read }) { - return new PrefixSource(read(), read()); +/** @type {Record void>} */ +const ASSETS_GROUPERS = { + _: (groupConfigs, context, options) => { + const groupByFlag = (name, exclude) => { + groupConfigs.push({ + getKeys: asset => { + return asset[name] ? ["1"] : undefined; + }, + getOptions: () => { + return { + groupChildren: !exclude, + force: exclude + }; + }, + createGroup: (key, children, assets) => { + return exclude + ? { + type: "assets by status", + [name]: !!key, + filteredChildren: assets.length, + ...assetGroup(children, assets) + } + : { + type: "assets by status", + [name]: !!key, + children, + ...assetGroup(children, assets) + }; + } + }); + }; + const { + groupAssetsByEmitStatus, + groupAssetsByPath, + groupAssetsByExtension + } = options; + if (groupAssetsByEmitStatus) { + groupByFlag("emitted"); + groupByFlag("comparedForEmit"); + groupByFlag("isOverSizeLimit"); } - })() -); - -register( - ReplaceSource, - CURRENT_MODULE, - "webpack-sources/ReplaceSource", - new (class ReplaceSourceSerializer { - /** - * @param {ReplaceSource} source the replace source to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(source, { write }) { - write(source.original()); - write(source.getName()); - const replacements = source.getReplacements(); - write(replacements.length); - for (const repl of replacements) { - write(repl.start); - write(repl.end); - } - for (const repl of replacements) { - write(repl.content); - write(repl.name); - } + if (groupAssetsByEmitStatus || !options.cachedAssets) { + groupByFlag("cached", !options.cachedAssets); } - - /** - * @param {ObjectDeserializerContext} context context - * @returns {ReplaceSource} replace source - */ - deserialize({ read }) { - const source = new ReplaceSource(read(), read()); - const len = read(); - const startEndBuffer = []; - for (let i = 0; i < len; i++) { - startEndBuffer.push(read(), read()); - } - let j = 0; - for (let i = 0; i < len; i++) { - source.replace( - startEndBuffer[j++], - startEndBuffer[j++], - read(), - read() - ); - } - return source; + if (groupAssetsByPath || groupAssetsByExtension) { + groupConfigs.push({ + getKeys: asset => { + const extensionMatch = + groupAssetsByExtension && GROUP_EXTENSION_REGEXP.exec(asset.name); + const extension = extensionMatch ? extensionMatch[1] : ""; + const pathMatch = + groupAssetsByPath && GROUP_PATH_REGEXP.exec(asset.name); + const path = pathMatch ? pathMatch[1].split(/[/\\]/) : []; + const keys = []; + if (groupAssetsByPath) { + keys.push("."); + if (extension) + keys.push( + path.length + ? `${path.join("/")}/*${extension}` + : `*${extension}` + ); + while (path.length > 0) { + keys.push(path.join("/") + "/"); + path.pop(); + } + } else { + if (extension) keys.push(`*${extension}`); + } + return keys; + }, + createGroup: (key, children, assets) => { + return { + type: groupAssetsByPath ? "assets by path" : "assets by extension", + name: key, + children, + ...assetGroup(children, assets) + }; + } + }); } - })() -); + }, + groupAssetsByInfo: (groupConfigs, context, options) => { + const groupByAssetInfoFlag = name => { + groupConfigs.push({ + getKeys: asset => { + return asset.info && asset.info[name] ? ["1"] : undefined; + }, + createGroup: (key, children, assets) => { + return { + type: "assets by info", + info: { + [name]: !!key + }, + children, + ...assetGroup(children, assets) + }; + } + }); + }; + groupByAssetInfoFlag("immutable"); + groupByAssetInfoFlag("development"); + groupByAssetInfoFlag("hotModuleReplacement"); + }, + groupAssetsByChunk: (groupConfigs, context, options) => { + const groupByNames = name => { + groupConfigs.push({ + getKeys: asset => { + return asset[name]; + }, + createGroup: (key, children, assets) => { + return { + type: "assets by chunk", + [name]: [key], + children, + ...assetGroup(children, assets) + }; + } + }); + }; + groupByNames("chunkNames"); + groupByNames("auxiliaryChunkNames"); + groupByNames("chunkIdHints"); + groupByNames("auxiliaryChunkIdHints"); + }, + excludeAssets: (groupConfigs, context, { excludeAssets }) => { + groupConfigs.push({ + getKeys: asset => { + const ident = asset.name; + const excluded = excludeAssets.some(fn => fn(ident, asset)); + if (excluded) return ["excluded"]; + }, + getOptions: () => ({ + groupChildren: false, + force: true + }), + createGroup: (key, children, assets) => ({ + type: "hidden assets", + filteredChildren: assets.length, + ...assetGroup(children, assets) + }) + }); + } +}; -register( - OriginalSource, - CURRENT_MODULE, - "webpack-sources/OriginalSource", - new (class OriginalSourceSerializer { - /** - * @param {OriginalSource} source the original source to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(source, { write }) { - write(source.buffer()); - write(source.getName()); +/** @type {function("module" | "chunk" | "root-of-chunk" | "nested"): Record void>} */ +const MODULES_GROUPERS = type => ({ + _: (groupConfigs, context, options) => { + const groupByFlag = (name, type, exclude) => { + groupConfigs.push({ + getKeys: module => { + return module[name] ? ["1"] : undefined; + }, + getOptions: () => { + return { + groupChildren: !exclude, + force: exclude + }; + }, + createGroup: (key, children, modules) => { + return { + type, + [name]: !!key, + ...(exclude ? { filteredChildren: modules.length } : { children }), + ...moduleGroup(children, modules) + }; + } + }); + }; + const { + groupModulesByCacheStatus, + groupModulesByLayer, + groupModulesByAttributes, + groupModulesByType, + groupModulesByPath, + groupModulesByExtension + } = options; + if (groupModulesByAttributes) { + groupByFlag("errors", "modules with errors"); + groupByFlag("warnings", "modules with warnings"); + groupByFlag("assets", "modules with assets"); + groupByFlag("optional", "optional modules"); } - - /** - * @param {ObjectDeserializerContext} context context - * @returns {OriginalSource} original source - */ - deserialize({ read }) { - const buffer = read(); - const name = read(); - return new OriginalSource(buffer, name); + if (groupModulesByCacheStatus) { + groupByFlag("cacheable", "cacheable modules"); + groupByFlag("built", "built modules"); + groupByFlag("codeGenerated", "code generated modules"); } - })() -); - -register( - SourceLocation, - CURRENT_MODULE, - "acorn/SourceLocation", - new (class SourceLocationSerializer { - /** - * @param {SourceLocation} loc the location to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(loc, { write }) { - write(loc.start.line); - write(loc.start.column); - write(loc.end.line); - write(loc.end.column); + if (groupModulesByCacheStatus || !options.cachedModules) { + groupByFlag("cached", "cached modules", !options.cachedModules); } - - /** - * @param {ObjectDeserializerContext} context context - * @returns {RealDependencyLocation} location - */ - deserialize({ read }) { - return { - start: { - line: read(), - column: read() + if (groupModulesByAttributes || !options.orphanModules) { + groupByFlag("orphan", "orphan modules", !options.orphanModules); + } + if (groupModulesByAttributes || !options.dependentModules) { + groupByFlag("dependent", "dependent modules", !options.dependentModules); + } + if (groupModulesByType || !options.runtimeModules) { + groupConfigs.push({ + getKeys: module => { + if (!module.moduleType) return; + if (groupModulesByType) { + return [module.moduleType.split("/", 1)[0]]; + } else if (module.moduleType === "runtime") { + return ["runtime"]; + } }, - end: { - line: read(), - column: read() + getOptions: key => { + const exclude = key === "runtime" && !options.runtimeModules; + return { + groupChildren: !exclude, + force: exclude + }; + }, + createGroup: (key, children, modules) => { + const exclude = key === "runtime" && !options.runtimeModules; + return { + type: `${key} modules`, + moduleType: key, + ...(exclude ? { filteredChildren: modules.length } : { children }), + ...moduleGroup(children, modules) + }; } - }; + }); } - })() -); - -register( - Position, - CURRENT_MODULE, - "acorn/Position", - new (class PositionSerializer { - /** - * @param {Position} pos the position to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(pos, { write }) { - write(pos.line); - write(pos.column); + if (groupModulesByLayer) { + groupConfigs.push({ + getKeys: module => { + return [module.layer]; + }, + createGroup: (key, children, modules) => { + return { + type: "modules by layer", + layer: key, + children, + ...moduleGroup(children, modules) + }; + } + }); } - - /** - * @param {ObjectDeserializerContext} context context - * @returns {SourcePosition} position - */ - deserialize({ read }) { - return { - line: read(), - column: read() - }; + if (groupModulesByPath || groupModulesByExtension) { + groupConfigs.push({ + getKeys: module => { + if (!module.name) return; + const resource = parseResource(module.name.split("!").pop()).path; + const dataUrl = /^data:[^,;]+/.exec(resource); + if (dataUrl) return [dataUrl[0]]; + const extensionMatch = + groupModulesByExtension && GROUP_EXTENSION_REGEXP.exec(resource); + const extension = extensionMatch ? extensionMatch[1] : ""; + const pathMatch = + groupModulesByPath && GROUP_PATH_REGEXP.exec(resource); + const path = pathMatch ? pathMatch[1].split(/[/\\]/) : []; + const keys = []; + if (groupModulesByPath) { + if (extension) + keys.push( + path.length + ? `${path.join("/")}/*${extension}` + : `*${extension}` + ); + while (path.length > 0) { + keys.push(path.join("/") + "/"); + path.pop(); + } + } else { + if (extension) keys.push(`*${extension}`); + } + return keys; + }, + createGroup: (key, children, modules) => { + const isDataUrl = key.startsWith("data:"); + return { + type: isDataUrl + ? "modules by mime type" + : groupModulesByPath + ? "modules by path" + : "modules by extension", + name: isDataUrl ? key.slice(/* 'data:'.length */ 5) : key, + children, + ...moduleGroup(children, modules) + }; + } + }); } - })() -); + }, + excludeModules: (groupConfigs, context, { excludeModules }) => { + groupConfigs.push({ + getKeys: module => { + const name = module.name; + if (name) { + const excluded = excludeModules.some(fn => fn(name, module, type)); + if (excluded) return ["1"]; + } + }, + getOptions: () => ({ + groupChildren: false, + force: true + }), + createGroup: (key, children, modules) => ({ + type: "hidden modules", + filteredChildren: children.length, + ...moduleGroup(children, modules) + }) + }); + } +}); -register( - SourceMapSource, - CURRENT_MODULE, - "webpack-sources/SourceMapSource", - new (class SourceMapSourceSerializer { - /** - * @param {SourceMapSource} source the source map source to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(source, { write }) { - write(source.getArgsAsBuffers()); +/** @type {Record void>>} */ +const RESULT_GROUPERS = { + "compilation.assets": ASSETS_GROUPERS, + "asset.related": ASSETS_GROUPERS, + "compilation.modules": MODULES_GROUPERS("module"), + "chunk.modules": MODULES_GROUPERS("chunk"), + "chunk.rootModules": MODULES_GROUPERS("root-of-chunk"), + "module.modules": MODULES_GROUPERS("nested"), + "module.reasons": { + groupReasonsByOrigin: groupConfigs => { + groupConfigs.push({ + getKeys: reason => { + return [reason.module]; + }, + createGroup: (key, children, reasons) => { + return { + type: "from origin", + module: key, + children, + ...reasonGroup(children, reasons) + }; + } + }); } + } +}; - /** - * @param {ObjectDeserializerContext} context context - * @returns {SourceMapSource} source source map source - */ - deserialize({ read }) { - // @ts-expect-error - return new SourceMapSource(...read()); - } - })() -); +// remove a prefixed "!" that can be specified to reverse sort order +const normalizeFieldKey = field => { + if (field[0] === "!") { + return field.substr(1); + } + return field; +}; -register( - ValidationError, - CURRENT_MODULE, - "schema-utils/ValidationError", - new (class ValidationErrorSerializer { - // TODO error should be ValidationError, but this fails the type checks - /** - * @param {TODO} error the source map source to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(error, { write }) { - write(error.errors); - write(error.schema); - write({ - name: error.headerName, - baseDataPath: error.baseDataPath, - postFormatter: error.postFormatter - }); - } +// if a field is prefixed by a "!" reverse sort order +const sortOrderRegular = field => { + if (field[0] === "!") { + return false; + } + return true; +}; +/** + * @param {string} field field name + * @returns {function(Object, Object): number} comparators + */ +const sortByField = field => { + if (!field) { /** - * @param {ObjectDeserializerContext} context context - * @returns {TODO} error + * @param {any} a first + * @param {any} b second + * @returns {-1|0|1} zero */ - deserialize({ read }) { - return new ValidationError(read(), read(), read()); - } - })() -); + const noSort = (a, b) => 0; + return noSort; + } + const fieldKey = normalizeFieldKey(field); -/***/ }), + let sortFn = compareSelect(m => m[fieldKey], compareIds); -/***/ 17156: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + // if a field is prefixed with a "!" the sort is reversed! + const sortIsRegular = sortOrderRegular(field); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (!sortIsRegular) { + const oldSortFn = sortFn; + sortFn = (a, b) => oldSortFn(b, a); + } + return sortFn; +}; +const ASSET_SORTERS = { + /** @type {(comparators: Function[], context: StatsFactoryContext, options: NormalizedStatsOptions) => void} */ + assetsSort: (comparators, context, { assetsSort }) => { + comparators.push(sortByField(assetsSort)); + }, + _: comparators => { + comparators.push(compareSelect(a => a.name, compareIds)); + } +}; -const SortableSet = __webpack_require__(13098); +/** @type {Record void>>} */ +const RESULT_SORTERS = { + "compilation.chunks": { + chunksSort: (comparators, context, { chunksSort }) => { + comparators.push(sortByField(chunksSort)); + } + }, + "compilation.modules": { + modulesSort: (comparators, context, { modulesSort }) => { + comparators.push(sortByField(modulesSort)); + } + }, + "chunk.modules": { + chunkModulesSort: (comparators, context, { chunkModulesSort }) => { + comparators.push(sortByField(chunkModulesSort)); + } + }, + "module.modules": { + nestedModulesSort: (comparators, context, { nestedModulesSort }) => { + comparators.push(sortByField(nestedModulesSort)); + } + }, + "compilation.assets": ASSET_SORTERS, + "asset.related": ASSET_SORTERS +}; -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Entrypoint").EntryOptions} EntryOptions */ +/** + * @param {Record>} config the config see above + * @param {NormalizedStatsOptions} options stats options + * @param {function(string, Function): void} fn handler function called for every active line in config + * @returns {void} + */ +const iterateConfig = (config, options, fn) => { + for (const hookFor of Object.keys(config)) { + const subConfig = config[hookFor]; + for (const option of Object.keys(subConfig)) { + if (option !== "_") { + if (option.startsWith("!")) { + if (options[option.slice(1)]) continue; + } else { + const value = options[option]; + if ( + value === false || + value === undefined || + (Array.isArray(value) && value.length === 0) + ) + continue; + } + } + fn(hookFor, subConfig[option]); + } + } +}; -/** @typedef {string | SortableSet | undefined} RuntimeSpec */ -/** @typedef {RuntimeSpec | boolean} RuntimeCondition */ +/** @type {Record} */ +const ITEM_NAMES = { + "compilation.children[]": "compilation", + "compilation.modules[]": "module", + "compilation.entrypoints[]": "chunkGroup", + "compilation.namedChunkGroups[]": "chunkGroup", + "compilation.errors[]": "error", + "compilation.warnings[]": "warning", + "chunk.modules[]": "module", + "chunk.rootModules[]": "module", + "chunk.origins[]": "chunkOrigin", + "compilation.chunks[]": "chunk", + "compilation.assets[]": "asset", + "asset.related[]": "asset", + "module.issuerPath[]": "moduleIssuer", + "module.reasons[]": "moduleReason", + "module.modules[]": "module", + "module.children[]": "module", + "moduleTrace[]": "moduleTraceItem", + "moduleTraceItem.dependencies[]": "moduleTraceDependency" +}; /** - * @param {Compilation} compilation the compilation - * @param {string} name name of the entry - * @param {EntryOptions=} options optionally already received entry options - * @returns {RuntimeSpec} runtime + * @param {Object[]} items items to be merged + * @returns {Object} an object */ -exports.getEntryRuntime = (compilation, name, options) => { - let dependOn; - let runtime; - if (options) { - ({ dependOn, runtime } = options); - } else { - const entry = compilation.entries.get(name); - if (!entry) return name; - ({ dependOn, runtime } = entry.options); +const mergeToObject = items => { + const obj = Object.create(null); + for (const item of items) { + obj[item.name] = item; } - if (dependOn) { - /** @type {RuntimeSpec} */ - let result = undefined; - const queue = new Set(dependOn); - for (const name of queue) { - const dep = compilation.entries.get(name); - if (!dep) continue; - const { dependOn, runtime } = dep.options; - if (dependOn) { - for (const name of dependOn) { - queue.add(name); + return obj; +}; + +/** @type {Record any>} */ +const MERGER = { + "compilation.entrypoints": mergeToObject, + "compilation.namedChunkGroups": mergeToObject +}; + +class DefaultStatsFactoryPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap("DefaultStatsFactoryPlugin", compilation => { + compilation.hooks.statsFactory.tap( + "DefaultStatsFactoryPlugin", + (stats, options, context) => { + iterateConfig(SIMPLE_EXTRACTORS, options, (hookFor, fn) => { + stats.hooks.extract + .for(hookFor) + .tap("DefaultStatsFactoryPlugin", (obj, data, ctx) => + fn(obj, data, ctx, options, stats) + ); + }); + iterateConfig(FILTER, options, (hookFor, fn) => { + stats.hooks.filter + .for(hookFor) + .tap("DefaultStatsFactoryPlugin", (item, ctx, idx, i) => + fn(item, ctx, options, idx, i) + ); + }); + iterateConfig(FILTER_RESULTS, options, (hookFor, fn) => { + stats.hooks.filterResults + .for(hookFor) + .tap("DefaultStatsFactoryPlugin", (item, ctx, idx, i) => + fn(item, ctx, options, idx, i) + ); + }); + iterateConfig(SORTERS, options, (hookFor, fn) => { + stats.hooks.sort + .for(hookFor) + .tap("DefaultStatsFactoryPlugin", (comparators, ctx) => + fn(comparators, ctx, options) + ); + }); + iterateConfig(RESULT_SORTERS, options, (hookFor, fn) => { + stats.hooks.sortResults + .for(hookFor) + .tap("DefaultStatsFactoryPlugin", (comparators, ctx) => + fn(comparators, ctx, options) + ); + }); + iterateConfig(RESULT_GROUPERS, options, (hookFor, fn) => { + stats.hooks.groupResults + .for(hookFor) + .tap("DefaultStatsFactoryPlugin", (groupConfigs, ctx) => + fn(groupConfigs, ctx, options) + ); + }); + for (const key of Object.keys(ITEM_NAMES)) { + const itemName = ITEM_NAMES[key]; + stats.hooks.getItemName + .for(key) + .tap("DefaultStatsFactoryPlugin", () => itemName); + } + for (const key of Object.keys(MERGER)) { + const merger = MERGER[key]; + stats.hooks.merge.for(key).tap("DefaultStatsFactoryPlugin", merger); + } + if (options.children) { + if (Array.isArray(options.children)) { + stats.hooks.getItemFactory + .for("compilation.children[].compilation") + .tap("DefaultStatsFactoryPlugin", (comp, { _index: idx }) => { + if (idx < options.children.length) { + return compilation.createStatsFactory( + compilation.createStatsOptions( + options.children[idx], + context + ) + ); + } + }); + } else if (options.children !== true) { + const childFactory = compilation.createStatsFactory( + compilation.createStatsOptions(options.children, context) + ); + stats.hooks.getItemFactory + .for("compilation.children[].compilation") + .tap("DefaultStatsFactoryPlugin", () => { + return childFactory; + }); + } + } } - } else { - result = mergeRuntimeOwned(result, runtime || name); - } - } - return result || name; - } else { - return runtime || name; + ); + }); } -}; +} +module.exports = DefaultStatsFactoryPlugin; -/** - * @param {RuntimeSpec} runtime runtime - * @param {function(string): void} fn functor - * @param {boolean} deterministicOrder enforce a deterministic order - * @returns {void} - */ -exports.forEachRuntime = (runtime, fn, deterministicOrder = false) => { - if (runtime === undefined) { - fn(undefined); - } else if (typeof runtime === "string") { - fn(runtime); - } else { - if (deterministicOrder) runtime.sort(); - for (const r of runtime) { - fn(r); - } - } -}; -const getRuntimesKey = set => { - set.sort(); - return Array.from(set).join("\n"); -}; +/***/ }), -/** - * @param {RuntimeSpec} runtime runtime(s) - * @returns {string} key of runtimes - */ -const getRuntimeKey = runtime => { - if (runtime === undefined) return "*"; - if (typeof runtime === "string") return runtime; - return runtime.getFromUnorderedCache(getRuntimesKey); -}; -exports.getRuntimeKey = getRuntimeKey; +/***/ 55442: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** - * @param {string} key key of runtimes - * @returns {RuntimeSpec} runtime(s) - */ -const keyToRuntime = key => { - if (key === "*") return undefined; - const items = key.split("\n"); - if (items.length === 1) return items[0]; - return new SortableSet(items); -}; -exports.keyToRuntime = keyToRuntime; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -const getRuntimesString = set => { - set.sort(); - return Array.from(set).join("+"); -}; -/** - * @param {RuntimeSpec} runtime runtime(s) - * @returns {string} readable version - */ -const runtimeToString = runtime => { - if (runtime === undefined) return "*"; - if (typeof runtime === "string") return runtime; - return runtime.getFromUnorderedCache(getRuntimesString); -}; -exports.runtimeToString = runtimeToString; -/** - * @param {RuntimeCondition} runtimeCondition runtime condition - * @returns {string} readable version - */ -exports.runtimeConditionToString = runtimeCondition => { - if (runtimeCondition === true) return "true"; - if (runtimeCondition === false) return "false"; - return runtimeToString(runtimeCondition); -}; +const RequestShortener = __webpack_require__(73406); -/** - * @param {RuntimeSpec} a first - * @param {RuntimeSpec} b second - * @returns {boolean} true, when they are equal - */ -const runtimeEqual = (a, b) => { - if (a === b) { - return true; - } else if ( - a === undefined || - b === undefined || - typeof a === "string" || - typeof b === "string" - ) { - return false; - } else if (a.size !== b.size) { - return false; - } else { - a.sort(); - b.sort(); - const aIt = a[Symbol.iterator](); - const bIt = b[Symbol.iterator](); - for (;;) { - const aV = aIt.next(); - if (aV.done) return true; - const bV = bIt.next(); - if (aV.value !== bV.value) return false; +/** @typedef {import("../../declarations/WebpackOptions").StatsOptions} StatsOptions */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Compilation").CreateStatsOptionsContext} CreateStatsOptionsContext */ +/** @typedef {import("../Compiler")} Compiler */ + +const applyDefaults = (options, defaults) => { + for (const key of Object.keys(defaults)) { + if (typeof options[key] === "undefined") { + options[key] = defaults[key]; } } }; -exports.runtimeEqual = runtimeEqual; -/** - * @param {RuntimeSpec} a first - * @param {RuntimeSpec} b second - * @returns {-1|0|1} compare - */ -exports.compareRuntime = (a, b) => { - if (a === b) { - return 0; - } else if (a === undefined) { - return -1; - } else if (b === undefined) { - return 1; - } else { - const aKey = getRuntimeKey(a); - const bKey = getRuntimeKey(b); - if (aKey < bKey) return -1; - if (aKey > bKey) return 1; - return 0; +const NAMED_PRESETS = { + verbose: { + hash: true, + builtAt: true, + relatedAssets: true, + entrypoints: true, + chunkGroups: true, + ids: true, + modules: false, + chunks: true, + chunkRelations: true, + chunkModules: true, + dependentModules: true, + chunkOrigins: true, + depth: true, + env: true, + reasons: true, + usedExports: true, + providedExports: true, + optimizationBailout: true, + errorDetails: true, + errorStack: true, + publicPath: true, + logging: "verbose", + orphanModules: true, + runtimeModules: true, + exclude: false, + modulesSpace: Infinity, + chunkModulesSpace: Infinity, + assetsSpace: Infinity, + reasonsSpace: Infinity, + children: true + }, + detailed: { + hash: true, + builtAt: true, + relatedAssets: true, + entrypoints: true, + chunkGroups: true, + ids: true, + chunks: true, + chunkRelations: true, + chunkModules: false, + chunkOrigins: true, + depth: true, + usedExports: true, + providedExports: true, + optimizationBailout: true, + errorDetails: true, + publicPath: true, + logging: true, + runtimeModules: true, + exclude: false, + modulesSpace: 1000, + assetsSpace: 1000, + reasonsSpace: 1000 + }, + minimal: { + all: false, + version: true, + timings: true, + modules: true, + modulesSpace: 0, + assets: true, + assetsSpace: 0, + errors: true, + errorsCount: true, + warnings: true, + warningsCount: true, + logging: "warn" + }, + "errors-only": { + all: false, + errors: true, + errorsCount: true, + moduleTrace: true, + logging: "error" + }, + "errors-warnings": { + all: false, + errors: true, + errorsCount: true, + warnings: true, + warningsCount: true, + logging: "warn" + }, + summary: { + all: false, + version: true, + errorsCount: true, + warningsCount: true + }, + none: { + all: false } }; -/** - * @param {RuntimeSpec} a first - * @param {RuntimeSpec} b second - * @returns {RuntimeSpec} merged - */ -const mergeRuntime = (a, b) => { - if (a === undefined) { - return b; - } else if (b === undefined) { - return a; - } else if (a === b) { - return a; - } else if (typeof a === "string") { - if (typeof b === "string") { - const set = new SortableSet(); - set.add(a); - set.add(b); - return set; - } else if (b.has(a)) { - return b; - } else { - const set = new SortableSet(b); - set.add(a); - return set; - } - } else { - if (typeof b === "string") { - if (a.has(b)) return a; - const set = new SortableSet(a); - set.add(b); - return set; - } else { - const set = new SortableSet(a); - for (const item of b) set.add(item); - if (set.size === a.size) return a; - return set; - } - } +const NORMAL_ON = ({ all }) => all !== false; +const NORMAL_OFF = ({ all }) => all === true; +const ON_FOR_TO_STRING = ({ all }, { forToString }) => + forToString ? all !== false : all === true; +const OFF_FOR_TO_STRING = ({ all }, { forToString }) => + forToString ? all === true : all !== false; +const AUTO_FOR_TO_STRING = ({ all }, { forToString }) => { + if (all === false) return false; + if (all === true) return true; + if (forToString) return "auto"; + return true; }; -exports.mergeRuntime = mergeRuntime; -/** - * @param {RuntimeCondition} a first - * @param {RuntimeCondition} b second - * @param {RuntimeSpec} runtime full runtime - * @returns {RuntimeCondition} result - */ -exports.mergeRuntimeCondition = (a, b, runtime) => { - if (a === false) return b; - if (b === false) return a; - if (a === true || b === true) return true; - const merged = mergeRuntime(a, b); - if (merged === undefined) return undefined; - if (typeof merged === "string") { - if (typeof runtime === "string" && merged === runtime) return true; - return merged; - } - if (typeof runtime === "string" || runtime === undefined) return merged; - if (merged.size === runtime.size) return true; - return merged; +/** @type {Record any>} */ +const DEFAULTS = { + context: (options, context, compilation) => compilation.compiler.context, + requestShortener: (options, context, compilation) => + compilation.compiler.context === options.context + ? compilation.requestShortener + : new RequestShortener(options.context, compilation.compiler.root), + performance: NORMAL_ON, + hash: OFF_FOR_TO_STRING, + env: NORMAL_OFF, + version: NORMAL_ON, + timings: NORMAL_ON, + builtAt: OFF_FOR_TO_STRING, + assets: NORMAL_ON, + entrypoints: AUTO_FOR_TO_STRING, + chunkGroups: OFF_FOR_TO_STRING, + chunkGroupAuxiliary: OFF_FOR_TO_STRING, + chunkGroupChildren: OFF_FOR_TO_STRING, + chunkGroupMaxAssets: (o, { forToString }) => (forToString ? 5 : Infinity), + chunks: OFF_FOR_TO_STRING, + chunkRelations: OFF_FOR_TO_STRING, + chunkModules: ({ all, modules }) => { + if (all === false) return false; + if (all === true) return true; + if (modules) return false; + return true; + }, + dependentModules: OFF_FOR_TO_STRING, + chunkOrigins: OFF_FOR_TO_STRING, + ids: OFF_FOR_TO_STRING, + modules: ({ all, chunks, chunkModules }, { forToString }) => { + if (all === false) return false; + if (all === true) return true; + if (forToString && chunks && chunkModules) return false; + return true; + }, + nestedModules: OFF_FOR_TO_STRING, + groupModulesByType: ON_FOR_TO_STRING, + groupModulesByCacheStatus: ON_FOR_TO_STRING, + groupModulesByLayer: ON_FOR_TO_STRING, + groupModulesByAttributes: ON_FOR_TO_STRING, + groupModulesByPath: ON_FOR_TO_STRING, + groupModulesByExtension: ON_FOR_TO_STRING, + modulesSpace: (o, { forToString }) => (forToString ? 15 : Infinity), + chunkModulesSpace: (o, { forToString }) => (forToString ? 10 : Infinity), + nestedModulesSpace: (o, { forToString }) => (forToString ? 10 : Infinity), + relatedAssets: OFF_FOR_TO_STRING, + groupAssetsByEmitStatus: ON_FOR_TO_STRING, + groupAssetsByInfo: ON_FOR_TO_STRING, + groupAssetsByPath: ON_FOR_TO_STRING, + groupAssetsByExtension: ON_FOR_TO_STRING, + groupAssetsByChunk: ON_FOR_TO_STRING, + assetsSpace: (o, { forToString }) => (forToString ? 15 : Infinity), + orphanModules: OFF_FOR_TO_STRING, + runtimeModules: ({ all, runtime }, { forToString }) => + runtime !== undefined + ? runtime + : forToString + ? all === true + : all !== false, + cachedModules: ({ all, cached }, { forToString }) => + cached !== undefined ? cached : forToString ? all === true : all !== false, + moduleAssets: OFF_FOR_TO_STRING, + depth: OFF_FOR_TO_STRING, + cachedAssets: OFF_FOR_TO_STRING, + reasons: OFF_FOR_TO_STRING, + reasonsSpace: (o, { forToString }) => (forToString ? 15 : Infinity), + groupReasonsByOrigin: ON_FOR_TO_STRING, + usedExports: OFF_FOR_TO_STRING, + providedExports: OFF_FOR_TO_STRING, + optimizationBailout: OFF_FOR_TO_STRING, + children: OFF_FOR_TO_STRING, + source: NORMAL_OFF, + moduleTrace: NORMAL_ON, + errors: NORMAL_ON, + errorsCount: NORMAL_ON, + errorDetails: AUTO_FOR_TO_STRING, + errorStack: OFF_FOR_TO_STRING, + warnings: NORMAL_ON, + warningsCount: NORMAL_ON, + publicPath: OFF_FOR_TO_STRING, + logging: ({ all }, { forToString }) => + forToString && all !== false ? "info" : false, + loggingDebug: () => [], + loggingTrace: OFF_FOR_TO_STRING, + excludeModules: () => [], + excludeAssets: () => [], + modulesSort: () => "depth", + chunkModulesSort: () => "name", + nestedModulesSort: () => false, + chunksSort: () => false, + assetsSort: () => "!size", + outputPath: OFF_FOR_TO_STRING, + colors: () => false }; -/** - * @param {RuntimeSpec | true} a first - * @param {RuntimeSpec | true} b second - * @param {RuntimeSpec} runtime full runtime - * @returns {RuntimeSpec | true} result - */ -exports.mergeRuntimeConditionNonFalse = (a, b, runtime) => { - if (a === true || b === true) return true; - const merged = mergeRuntime(a, b); - if (merged === undefined) return undefined; - if (typeof merged === "string") { - if (typeof runtime === "string" && merged === runtime) return true; - return merged; +const normalizeFilter = item => { + if (typeof item === "string") { + const regExp = new RegExp( + `[\\\\/]${item.replace( + // eslint-disable-next-line no-useless-escape + /[-[\]{}()*+?.\\^$|]/g, + "\\$&" + )}([\\\\/]|$|!|\\?)` + ); + return ident => regExp.test(ident); } - if (typeof runtime === "string" || runtime === undefined) return merged; - if (merged.size === runtime.size) return true; - return merged; -}; - -/** - * @param {RuntimeSpec} a first (may be modified) - * @param {RuntimeSpec} b second - * @returns {RuntimeSpec} merged - */ -const mergeRuntimeOwned = (a, b) => { - if (b === undefined) { - return a; - } else if (a === b) { - return a; - } else if (a === undefined) { - if (typeof b === "string") { - return b; - } else { - return new SortableSet(b); - } - } else if (typeof a === "string") { - if (typeof b === "string") { - const set = new SortableSet(); - set.add(a); - set.add(b); - return set; - } else { - const set = new SortableSet(b); - set.add(a); - return set; - } - } else { - if (typeof b === "string") { - a.add(b); - return a; - } else { - for (const item of b) a.add(item); - return a; - } + if (item && typeof item === "object" && typeof item.test === "function") { + return ident => item.test(ident); } -}; -exports.mergeRuntimeOwned = mergeRuntimeOwned; - -/** - * @param {RuntimeSpec} a first - * @param {RuntimeSpec} b second - * @returns {RuntimeSpec} merged - */ -exports.intersectRuntime = (a, b) => { - if (a === undefined) { - return b; - } else if (b === undefined) { - return a; - } else if (a === b) { - return a; - } else if (typeof a === "string") { - if (typeof b === "string") { - return undefined; - } else if (b.has(a)) { - return a; - } else { - return undefined; - } - } else { - if (typeof b === "string") { - if (a.has(b)) return b; - return undefined; - } else { - const set = new SortableSet(); - for (const item of b) { - if (a.has(item)) set.add(item); - } - if (set.size === 0) return undefined; - if (set.size === 1) for (const item of set) return item; - return set; - } + if (typeof item === "function") { + return item; + } + if (typeof item === "boolean") { + return () => item; } }; -/** - * @param {RuntimeSpec} a first - * @param {RuntimeSpec} b second - * @returns {RuntimeSpec} result - */ -const subtractRuntime = (a, b) => { - if (a === undefined) { - return undefined; - } else if (b === undefined) { - return a; - } else if (a === b) { - return undefined; - } else if (typeof a === "string") { - if (typeof b === "string") { - return a; - } else if (b.has(a)) { - return undefined; - } else { - return a; +const NORMALIZER = { + excludeModules: value => { + if (!Array.isArray(value)) { + value = value ? [value] : []; } - } else { - if (typeof b === "string") { - if (!a.has(b)) return a; - if (a.size === 2) { - for (const item of a) { - if (item !== b) return item; - } + return value.map(normalizeFilter); + }, + excludeAssets: value => { + if (!Array.isArray(value)) { + value = value ? [value] : []; + } + return value.map(normalizeFilter); + }, + warningsFilter: value => { + if (!Array.isArray(value)) { + value = value ? [value] : []; + } + return value.map(filter => { + if (typeof filter === "string") { + return (warning, warningString) => warningString.includes(filter); } - const set = new SortableSet(a); - set.delete(b); - } else { - const set = new SortableSet(); - for (const item of a) { - if (!b.has(item)) set.add(item); + if (filter instanceof RegExp) { + return (warning, warningString) => filter.test(warningString); } - if (set.size === 0) return undefined; - if (set.size === 1) for (const item of set) return item; - return set; + if (typeof filter === "function") { + return filter; + } + throw new Error( + `Can only filter warnings with Strings or RegExps. (Given: ${filter})` + ); + }); + }, + logging: value => { + if (value === true) value = "log"; + return value; + }, + loggingDebug: value => { + if (!Array.isArray(value)) { + value = value ? [value] : []; } + return value.map(normalizeFilter); } }; -exports.subtractRuntime = subtractRuntime; -/** - * @param {RuntimeCondition} a first - * @param {RuntimeCondition} b second - * @param {RuntimeSpec} runtime runtime - * @returns {RuntimeCondition} result - */ -exports.subtractRuntimeCondition = (a, b, runtime) => { - if (b === true) return false; - if (b === false) return a; - if (a === false) return false; - const result = subtractRuntime(a === true ? runtime : a, b); - return result === undefined ? false : result; -}; +class DefaultStatsPresetPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap("DefaultStatsPresetPlugin", compilation => { + for (const key of Object.keys(NAMED_PRESETS)) { + const defaults = NAMED_PRESETS[key]; + compilation.hooks.statsPreset + .for(key) + .tap("DefaultStatsPresetPlugin", (options, context) => { + applyDefaults(options, defaults); + }); + } + compilation.hooks.statsNormalize.tap( + "DefaultStatsPresetPlugin", + (options, context) => { + for (const key of Object.keys(DEFAULTS)) { + if (options[key] === undefined) + options[key] = DEFAULTS[key](options, context, compilation); + } + for (const key of Object.keys(NORMALIZER)) { + options[key] = NORMALIZER[key](options[key]); + } + } + ); + }); + } +} +module.exports = DefaultStatsPresetPlugin; + + +/***/ }), + +/***/ 58692: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("./StatsPrinter")} StatsPrinter */ +/** @typedef {import("./StatsPrinter").StatsPrinterContext} StatsPrinterContext */ + +const DATA_URI_CONTENT_LENGTH = 16; + +const plural = (n, singular, plural) => (n === 1 ? singular : plural); /** - * @param {RuntimeSpec} runtime runtime - * @param {function(RuntimeSpec): boolean} filter filter function - * @returns {boolean | RuntimeSpec} true/false if filter is constant for all runtimes, otherwise runtimes that are active + * @param {Record} sizes sizes by source type + * @param {Object} options options + * @param {(number) => string=} options.formatSize size formatter + * @returns {string} text */ -exports.filterRuntime = (runtime, filter) => { - if (runtime === undefined) return filter(undefined); - if (typeof runtime === "string") return filter(runtime); - let some = false; - let every = true; - let result = undefined; - for (const r of runtime) { - const v = filter(r); - if (v) { - some = true; - result = mergeRuntimeOwned(result, r); - } else { - every = false; - } +const printSizes = (sizes, { formatSize = n => `${n}` }) => { + const keys = Object.keys(sizes); + if (keys.length > 1) { + return keys.map(key => `${formatSize(sizes[key])} (${key})`).join(" "); + } else if (keys.length === 1) { + return formatSize(sizes[keys[0]]); } - if (!some) return false; - if (every) return true; - return result; }; +const getResourceName = resource => { + const dataUrl = /^data:[^,]+,/.exec(resource); + if (!dataUrl) return resource; + + const len = dataUrl[0].length + DATA_URI_CONTENT_LENGTH; + if (resource.length < len) return resource; + return `${resource.slice( + 0, + Math.min(resource.length - /* '..'.length */ 2, len) + )}..`; +}; + +const getModuleName = name => { + const [, prefix, resource] = /^(.*!)?([^!]*)$/.exec(name); + return [prefix, getResourceName(resource)]; +}; + +const mapLines = (str, fn) => str.split("\n").map(fn).join("\n"); + /** - * @template T + * @param {number} n a number + * @returns {string} number as two digit string, leading 0 */ -class RuntimeSpecMap { - /** - * @param {RuntimeSpecMap=} clone copy form this - */ - constructor(clone) { - this._mode = clone ? clone._mode : 0; // 0 = empty, 1 = single entry, 2 = map - /** @type {RuntimeSpec} */ - this._singleRuntime = clone ? clone._singleRuntime : undefined; - /** @type {T} */ - this._singleValue = clone ? clone._singleValue : undefined; - /** @type {Map | undefined} */ - this._map = clone && clone._map ? new Map(clone._map) : undefined; - } - - /** - * @param {RuntimeSpec} runtime the runtimes - * @returns {T} value - */ - get(runtime) { - switch (this._mode) { - case 0: - return undefined; - case 1: - return runtimeEqual(this._singleRuntime, runtime) - ? this._singleValue - : undefined; - default: - return this._map.get(getRuntimeKey(runtime)); - } - } +const twoDigit = n => (n >= 10 ? `${n}` : `0${n}`); - /** - * @param {RuntimeSpec} runtime the runtimes - * @returns {boolean} true, when the runtime is stored - */ - has(runtime) { - switch (this._mode) { - case 0: - return false; - case 1: - return runtimeEqual(this._singleRuntime, runtime); - default: - return this._map.has(getRuntimeKey(runtime)); - } - } +const isValidId = id => { + return typeof id === "number" || id; +}; - set(runtime, value) { - switch (this._mode) { - case 0: - this._mode = 1; - this._singleRuntime = runtime; - this._singleValue = value; - break; - case 1: - if (runtimeEqual(this._singleRuntime, runtime)) { - this._singleValue = value; - break; - } - this._mode = 2; - this._map = new Map(); - this._map.set(getRuntimeKey(this._singleRuntime), this._singleValue); - this._singleRuntime = undefined; - this._singleValue = undefined; - /* falls through */ - default: - this._map.set(getRuntimeKey(runtime), value); - } - } +const moreCount = (list, count) => { + return list && list.length > 0 ? `+ ${count}` : `${count}`; +}; - provide(runtime, computer) { - switch (this._mode) { - case 0: - this._mode = 1; - this._singleRuntime = runtime; - return (this._singleValue = computer()); - case 1: { - if (runtimeEqual(this._singleRuntime, runtime)) { - return this._singleValue; - } - this._mode = 2; - this._map = new Map(); - this._map.set(getRuntimeKey(this._singleRuntime), this._singleValue); - this._singleRuntime = undefined; - this._singleValue = undefined; - const newValue = computer(); - this._map.set(getRuntimeKey(runtime), newValue); - return newValue; - } - default: { - const key = getRuntimeKey(runtime); - const value = this._map.get(key); - if (value !== undefined) return value; - const newValue = computer(); - this._map.set(key, newValue); - return newValue; +/** @type {Record string | void>} */ +const SIMPLE_PRINTERS = { + "compilation.summary!": ( + _, + { + type, + bold, + green, + red, + yellow, + formatDateTime, + formatTime, + compilation: { + name, + hash, + version, + time, + builtAt, + errorsCount, + warningsCount } } - } - - delete(runtime) { - switch (this._mode) { - case 0: - return; - case 1: - if (runtimeEqual(this._singleRuntime, runtime)) { - this._mode = 0; - this._singleRuntime = undefined; - this._singleValue = undefined; - } - return; - default: - this._map.delete(getRuntimeKey(runtime)); + ) => { + const root = type === "compilation.summary!"; + const warningsMessage = + warningsCount > 0 + ? yellow( + `${warningsCount} ${plural(warningsCount, "warning", "warnings")}` + ) + : ""; + const errorsMessage = + errorsCount > 0 + ? red(`${errorsCount} ${plural(errorsCount, "error", "errors")}`) + : ""; + const timeMessage = root && time ? ` in ${formatTime(time)}` : ""; + const hashMessage = hash ? ` (${hash})` : ""; + const builtAtMessage = + root && builtAt ? `${formatDateTime(builtAt)}: ` : ""; + const versionMessage = root && version ? `webpack ${version}` : ""; + const nameMessage = + root && name + ? bold(name) + : name + ? `Child ${bold(name)}` + : root + ? "" + : "Child"; + const subjectMessage = + nameMessage && versionMessage + ? `${nameMessage} (${versionMessage})` + : versionMessage || nameMessage || "webpack"; + let statusMessage; + if (errorsMessage && warningsMessage) { + statusMessage = `compiled with ${errorsMessage} and ${warningsMessage}`; + } else if (errorsMessage) { + statusMessage = `compiled with ${errorsMessage}`; + } else if (warningsMessage) { + statusMessage = `compiled with ${warningsMessage}`; + } else if (errorsCount === 0 && warningsCount === 0) { + statusMessage = `compiled ${green("successfully")}`; + } else { + statusMessage = `compiled`; } - } + if ( + builtAtMessage || + versionMessage || + errorsMessage || + warningsMessage || + (errorsCount === 0 && warningsCount === 0) || + timeMessage || + hashMessage + ) + return `${builtAtMessage}${subjectMessage} ${statusMessage}${timeMessage}${hashMessage}`; + }, + "compilation.filteredWarningDetailsCount": count => + count + ? `${count} ${plural( + count, + "warning has", + "warnings have" + )} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.` + : undefined, + "compilation.filteredErrorDetailsCount": (count, { yellow }) => + count + ? yellow( + `${count} ${plural( + count, + "error has", + "errors have" + )} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.` + ) + : undefined, + "compilation.env": (env, { bold }) => + env + ? `Environment (--env): ${bold(JSON.stringify(env, null, 2))}` + : undefined, + "compilation.publicPath": (publicPath, { bold }) => + `PublicPath: ${bold(publicPath || "(none)")}`, + "compilation.entrypoints": (entrypoints, context, printer) => + Array.isArray(entrypoints) + ? undefined + : printer.print(context.type, Object.values(entrypoints), { + ...context, + chunkGroupKind: "Entrypoint" + }), + "compilation.namedChunkGroups": (namedChunkGroups, context, printer) => { + if (!Array.isArray(namedChunkGroups)) { + const { + compilation: { entrypoints } + } = context; + let chunkGroups = Object.values(namedChunkGroups); + if (entrypoints) { + chunkGroups = chunkGroups.filter( + group => + !Object.prototype.hasOwnProperty.call(entrypoints, group.name) + ); + } + return printer.print(context.type, chunkGroups, { + ...context, + chunkGroupKind: "Chunk Group" + }); + } + }, + "compilation.assetsByChunkName": () => "", - update(runtime, fn) { - switch (this._mode) { - case 0: - throw new Error("runtime passed to update must exist"); - case 1: { - if (runtimeEqual(this._singleRuntime, runtime)) { - this._singleValue = fn(this._singleValue); - break; - } - const newValue = fn(undefined); - if (newValue !== undefined) { - this._mode = 2; - this._map = new Map(); - this._map.set(getRuntimeKey(this._singleRuntime), this._singleValue); - this._singleRuntime = undefined; - this._singleValue = undefined; - this._map.set(getRuntimeKey(runtime), newValue); - } - break; + "compilation.filteredModules": ( + filteredModules, + { compilation: { modules } } + ) => + filteredModules > 0 + ? `${moreCount(modules, filteredModules)} ${plural( + filteredModules, + "module", + "modules" + )}` + : undefined, + "compilation.filteredAssets": (filteredAssets, { compilation: { assets } }) => + filteredAssets > 0 + ? `${moreCount(assets, filteredAssets)} ${plural( + filteredAssets, + "asset", + "assets" + )}` + : undefined, + "compilation.logging": (logging, context, printer) => + Array.isArray(logging) + ? undefined + : printer.print( + context.type, + Object.entries(logging).map(([name, value]) => ({ ...value, name })), + context + ), + "compilation.warningsInChildren!": (_, { yellow, compilation }) => { + if ( + !compilation.children && + compilation.warningsCount > 0 && + compilation.warnings + ) { + const childWarnings = + compilation.warningsCount - compilation.warnings.length; + if (childWarnings > 0) { + return yellow( + `${childWarnings} ${plural( + childWarnings, + "WARNING", + "WARNINGS" + )} in child compilations${ + compilation.children + ? "" + : " (Use 'stats.children: true' resp. '--stats-children' for more details)" + }` + ); } - default: { - const key = getRuntimeKey(runtime); - const oldValue = this._map.get(key); - const newValue = fn(oldValue); - if (newValue !== oldValue) this._map.set(key, newValue); + } + }, + "compilation.errorsInChildren!": (_, { red, compilation }) => { + if ( + !compilation.children && + compilation.errorsCount > 0 && + compilation.errors + ) { + const childErrors = compilation.errorsCount - compilation.errors.length; + if (childErrors > 0) { + return red( + `${childErrors} ${plural( + childErrors, + "ERROR", + "ERRORS" + )} in child compilations${ + compilation.children + ? "" + : " (Use 'stats.children: true' resp. '--stats-children' for more details)" + }` + ); } } - } + }, - keys() { - switch (this._mode) { - case 0: - return []; - case 1: - return [this._singleRuntime]; - default: - return Array.from(this._map.keys(), keyToRuntime); - } - } + "asset.type": type => type, + "asset.name": (name, { formatFilename, asset: { isOverSizeLimit } }) => + formatFilename(name, isOverSizeLimit), + "asset.size": ( + size, + { asset: { isOverSizeLimit }, yellow, green, formatSize } + ) => (isOverSizeLimit ? yellow(formatSize(size)) : formatSize(size)), + "asset.emitted": (emitted, { green, formatFlag }) => + emitted ? green(formatFlag("emitted")) : undefined, + "asset.comparedForEmit": (comparedForEmit, { yellow, formatFlag }) => + comparedForEmit ? yellow(formatFlag("compared for emit")) : undefined, + "asset.cached": (cached, { green, formatFlag }) => + cached ? green(formatFlag("cached")) : undefined, + "asset.isOverSizeLimit": (isOverSizeLimit, { yellow, formatFlag }) => + isOverSizeLimit ? yellow(formatFlag("big")) : undefined, - values() { - switch (this._mode) { - case 0: - return [][Symbol.iterator](); - case 1: - return [this._singleValue][Symbol.iterator](); - default: - return this._map.values(); - } - } + "asset.info.immutable": (immutable, { green, formatFlag }) => + immutable ? green(formatFlag("immutable")) : undefined, + "asset.info.javascriptModule": (javascriptModule, { formatFlag }) => + javascriptModule ? formatFlag("javascript module") : undefined, + "asset.info.sourceFilename": (sourceFilename, { formatFlag }) => + sourceFilename + ? formatFlag( + sourceFilename === true + ? "from source file" + : `from: ${sourceFilename}` + ) + : undefined, + "asset.info.development": (development, { green, formatFlag }) => + development ? green(formatFlag("dev")) : undefined, + "asset.info.hotModuleReplacement": ( + hotModuleReplacement, + { green, formatFlag } + ) => (hotModuleReplacement ? green(formatFlag("hmr")) : undefined), + "asset.separator!": () => "\n", + "asset.filteredRelated": (filteredRelated, { asset: { related } }) => + filteredRelated > 0 + ? `${moreCount(related, filteredRelated)} related ${plural( + filteredRelated, + "asset", + "assets" + )}` + : undefined, + "asset.filteredChildren": (filteredChildren, { asset: { children } }) => + filteredChildren > 0 + ? `${moreCount(children, filteredChildren)} ${plural( + filteredChildren, + "asset", + "assets" + )}` + : undefined, - get size() { - if (this._mode <= 1) return this._mode; - return this._map.size; - } -} + assetChunk: (id, { formatChunkId }) => formatChunkId(id), -exports.RuntimeSpecMap = RuntimeSpecMap; + assetChunkName: name => name, + assetChunkIdHint: name => name, -class RuntimeSpecSet { - constructor(iterable) { - /** @type {Map} */ - this._map = new Map(); - if (iterable) { - for (const item of iterable) { - this.add(item); + "module.type": type => (type !== "module" ? type : undefined), + "module.id": (id, { formatModuleId }) => + isValidId(id) ? formatModuleId(id) : undefined, + "module.name": (name, { bold }) => { + const [prefix, resource] = getModuleName(name); + return `${prefix || ""}${bold(resource || "")}`; + }, + "module.identifier": identifier => undefined, + "module.layer": (layer, { formatLayer }) => + layer ? formatLayer(layer) : undefined, + "module.sizes": printSizes, + "module.chunks[]": (id, { formatChunkId }) => formatChunkId(id), + "module.depth": (depth, { formatFlag }) => + depth !== null ? formatFlag(`depth ${depth}`) : undefined, + "module.cacheable": (cacheable, { formatFlag, red }) => + cacheable === false ? red(formatFlag("not cacheable")) : undefined, + "module.orphan": (orphan, { formatFlag, yellow }) => + orphan ? yellow(formatFlag("orphan")) : undefined, + "module.runtime": (runtime, { formatFlag, yellow }) => + runtime ? yellow(formatFlag("runtime")) : undefined, + "module.optional": (optional, { formatFlag, yellow }) => + optional ? yellow(formatFlag("optional")) : undefined, + "module.dependent": (dependent, { formatFlag, cyan }) => + dependent ? cyan(formatFlag("dependent")) : undefined, + "module.built": (built, { formatFlag, yellow }) => + built ? yellow(formatFlag("built")) : undefined, + "module.codeGenerated": (codeGenerated, { formatFlag, yellow }) => + codeGenerated ? yellow(formatFlag("code generated")) : undefined, + "module.buildTimeExecuted": (buildTimeExecuted, { formatFlag, green }) => + buildTimeExecuted ? green(formatFlag("build time executed")) : undefined, + "module.cached": (cached, { formatFlag, green }) => + cached ? green(formatFlag("cached")) : undefined, + "module.assets": (assets, { formatFlag, magenta }) => + assets && assets.length + ? magenta( + formatFlag( + `${assets.length} ${plural(assets.length, "asset", "assets")}` + ) + ) + : undefined, + "module.warnings": (warnings, { formatFlag, yellow }) => + warnings === true + ? yellow(formatFlag("warnings")) + : warnings + ? yellow( + formatFlag(`${warnings} ${plural(warnings, "warning", "warnings")}`) + ) + : undefined, + "module.errors": (errors, { formatFlag, red }) => + errors === true + ? red(formatFlag("errors")) + : errors + ? red(formatFlag(`${errors} ${plural(errors, "error", "errors")}`)) + : undefined, + "module.providedExports": (providedExports, { formatFlag, cyan }) => { + if (Array.isArray(providedExports)) { + if (providedExports.length === 0) return cyan(formatFlag("no exports")); + return cyan(formatFlag(`exports: ${providedExports.join(", ")}`)); + } + }, + "module.usedExports": (usedExports, { formatFlag, cyan, module }) => { + if (usedExports !== true) { + if (usedExports === null) return cyan(formatFlag("used exports unknown")); + if (usedExports === false) return cyan(formatFlag("module unused")); + if (Array.isArray(usedExports)) { + if (usedExports.length === 0) + return cyan(formatFlag("no exports used")); + const providedExportsCount = Array.isArray(module.providedExports) + ? module.providedExports.length + : null; + if ( + providedExportsCount !== null && + providedExportsCount === usedExports.length + ) { + return cyan(formatFlag("all exports used")); + } else { + return cyan( + formatFlag(`only some exports used: ${usedExports.join(", ")}`) + ); + } } } - } - - add(runtime) { - this._map.set(getRuntimeKey(runtime), runtime); - } - - has(runtime) { - return this._map.has(getRuntimeKey(runtime)); - } - - [Symbol.iterator]() { - return this._map.values(); - } - - get size() { - return this._map.size; - } -} - -exports.RuntimeSpecSet = RuntimeSpecSet; - - -/***/ }), - -/***/ 19702: -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** @typedef {(string|number|undefined|[])[]} SemVerRange */ + }, + "module.optimizationBailout[]": (optimizationBailout, { yellow }) => + yellow(optimizationBailout), + "module.issuerPath": (issuerPath, { module }) => + module.profile ? undefined : "", + "module.profile": profile => undefined, + "module.filteredModules": (filteredModules, { module: { modules } }) => + filteredModules > 0 + ? `${moreCount(modules, filteredModules)} nested ${plural( + filteredModules, + "module", + "modules" + )}` + : undefined, + "module.filteredReasons": (filteredReasons, { module: { reasons } }) => + filteredReasons > 0 + ? `${moreCount(reasons, filteredReasons)} ${plural( + filteredReasons, + "reason", + "reasons" + )}` + : undefined, + "module.filteredChildren": (filteredChildren, { module: { children } }) => + filteredChildren > 0 + ? `${moreCount(children, filteredChildren)} ${plural( + filteredChildren, + "module", + "modules" + )}` + : undefined, + "module.separator!": () => "\n", -/** - * @param {string} str version string - * @returns {(string|number|undefined|[])[]} parsed version - */ -const parseVersion = str => { - var splitAndConvert = function (str) { - return str.split(".").map(function (item) { - // eslint-disable-next-line eqeqeq - return +item == item ? +item : item; - }); - }; - var match = /^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(str); - /** @type {(string|number|undefined|[])[]} */ - var ver = match[1] ? splitAndConvert(match[1]) : []; - if (match[2]) { - ver.length++; - ver.push.apply(ver, splitAndConvert(match[2])); - } - if (match[3]) { - ver.push([]); - ver.push.apply(ver, splitAndConvert(match[3])); - } - return ver; -}; -exports.parseVersion = parseVersion; + "moduleIssuer.id": (id, { formatModuleId }) => formatModuleId(id), + "moduleIssuer.profile.total": (value, { formatTime }) => formatTime(value), -/* eslint-disable eqeqeq */ -/** - * @param {string} a version - * @param {string} b version - * @returns {boolean} true, iff a < b - */ -const versionLt = (a, b) => { - // @ts-expect-error - a = parseVersion(a); - // @ts-expect-error - b = parseVersion(b); - var i = 0; - for (;;) { - // a b EOA object undefined number string - // EOA a == b a < b b < a a < b a < b - // object b < a (0) b < a a < b a < b - // undefined a < b a < b (0) a < b a < b - // number b < a b < a b < a (1) a < b - // string b < a b < a b < a b < a (1) - // EOA end of array - // (0) continue on - // (1) compare them via "<" + "moduleReason.type": type => type, + "moduleReason.userRequest": (userRequest, { cyan }) => + cyan(getResourceName(userRequest)), + "moduleReason.moduleId": (moduleId, { formatModuleId }) => + isValidId(moduleId) ? formatModuleId(moduleId) : undefined, + "moduleReason.module": (module, { magenta }) => magenta(module), + "moduleReason.loc": loc => loc, + "moduleReason.explanation": (explanation, { cyan }) => cyan(explanation), + "moduleReason.active": (active, { formatFlag }) => + active ? undefined : formatFlag("inactive"), + "moduleReason.resolvedModule": (module, { magenta }) => magenta(module), + "moduleReason.filteredChildren": ( + filteredChildren, + { moduleReason: { children } } + ) => + filteredChildren > 0 + ? `${moreCount(children, filteredChildren)} ${plural( + filteredChildren, + "reason", + "reasons" + )}` + : undefined, - // Handles first row in table - if (i >= a.length) return i < b.length && (typeof b[i])[0] != "u"; + "module.profile.total": (value, { formatTime }) => formatTime(value), + "module.profile.resolving": (value, { formatTime }) => + `resolving: ${formatTime(value)}`, + "module.profile.restoring": (value, { formatTime }) => + `restoring: ${formatTime(value)}`, + "module.profile.integration": (value, { formatTime }) => + `integration: ${formatTime(value)}`, + "module.profile.building": (value, { formatTime }) => + `building: ${formatTime(value)}`, + "module.profile.storing": (value, { formatTime }) => + `storing: ${formatTime(value)}`, + "module.profile.additionalResolving": (value, { formatTime }) => + value ? `additional resolving: ${formatTime(value)}` : undefined, + "module.profile.additionalIntegration": (value, { formatTime }) => + value ? `additional integration: ${formatTime(value)}` : undefined, - var aValue = a[i]; - var aType = (typeof aValue)[0]; + "chunkGroup.kind!": (_, { chunkGroupKind }) => chunkGroupKind, + "chunkGroup.separator!": () => "\n", + "chunkGroup.name": (name, { bold }) => bold(name), + "chunkGroup.isOverSizeLimit": (isOverSizeLimit, { formatFlag, yellow }) => + isOverSizeLimit ? yellow(formatFlag("big")) : undefined, + "chunkGroup.assetsSize": (size, { formatSize }) => + size ? formatSize(size) : undefined, + "chunkGroup.auxiliaryAssetsSize": (size, { formatSize }) => + size ? `(${formatSize(size)})` : undefined, + "chunkGroup.filteredAssets": (n, { chunkGroup: { assets } }) => + n > 0 + ? `${moreCount(assets, n)} ${plural(n, "asset", "assets")}` + : undefined, + "chunkGroup.filteredAuxiliaryAssets": ( + n, + { chunkGroup: { auxiliaryAssets } } + ) => + n > 0 + ? `${moreCount(auxiliaryAssets, n)} auxiliary ${plural( + n, + "asset", + "assets" + )}` + : undefined, + "chunkGroup.is!": () => "=", + "chunkGroupAsset.name": (asset, { green }) => green(asset), + "chunkGroupAsset.size": (size, { formatSize, chunkGroup }) => + chunkGroup.assets.length > 1 || + (chunkGroup.auxiliaryAssets && chunkGroup.auxiliaryAssets.length > 0) + ? formatSize(size) + : undefined, + "chunkGroup.children": (children, context, printer) => + Array.isArray(children) + ? undefined + : printer.print( + context.type, + Object.keys(children).map(key => ({ + type: key, + children: children[key] + })), + context + ), + "chunkGroupChildGroup.type": type => `${type}:`, + "chunkGroupChild.assets[]": (file, { formatFilename }) => + formatFilename(file), + "chunkGroupChild.chunks[]": (id, { formatChunkId }) => formatChunkId(id), + "chunkGroupChild.name": name => (name ? `(name: ${name})` : undefined), - // Handles first column in table - if (i >= b.length) return aType == "u"; + "chunk.id": (id, { formatChunkId }) => formatChunkId(id), + "chunk.files[]": (file, { formatFilename }) => formatFilename(file), + "chunk.names[]": name => name, + "chunk.idHints[]": name => name, + "chunk.runtime[]": name => name, + "chunk.sizes": (sizes, context) => printSizes(sizes, context), + "chunk.parents[]": (parents, context) => + context.formatChunkId(parents, "parent"), + "chunk.siblings[]": (siblings, context) => + context.formatChunkId(siblings, "sibling"), + "chunk.children[]": (children, context) => + context.formatChunkId(children, "child"), + "chunk.childrenByOrder": (childrenByOrder, context, printer) => + Array.isArray(childrenByOrder) + ? undefined + : printer.print( + context.type, + Object.keys(childrenByOrder).map(key => ({ + type: key, + children: childrenByOrder[key] + })), + context + ), + "chunk.childrenByOrder[].type": type => `${type}:`, + "chunk.childrenByOrder[].children[]": (id, { formatChunkId }) => + isValidId(id) ? formatChunkId(id) : undefined, + "chunk.entry": (entry, { formatFlag, yellow }) => + entry ? yellow(formatFlag("entry")) : undefined, + "chunk.initial": (initial, { formatFlag, yellow }) => + initial ? yellow(formatFlag("initial")) : undefined, + "chunk.rendered": (rendered, { formatFlag, green }) => + rendered ? green(formatFlag("rendered")) : undefined, + "chunk.recorded": (recorded, { formatFlag, green }) => + recorded ? green(formatFlag("recorded")) : undefined, + "chunk.reason": (reason, { yellow }) => (reason ? yellow(reason) : undefined), + "chunk.filteredModules": (filteredModules, { chunk: { modules } }) => + filteredModules > 0 + ? `${moreCount(modules, filteredModules)} chunk ${plural( + filteredModules, + "module", + "modules" + )}` + : undefined, + "chunk.separator!": () => "\n", - var bValue = b[i]; - var bType = (typeof bValue)[0]; + "chunkOrigin.request": request => request, + "chunkOrigin.moduleId": (moduleId, { formatModuleId }) => + isValidId(moduleId) ? formatModuleId(moduleId) : undefined, + "chunkOrigin.moduleName": (moduleName, { bold }) => bold(moduleName), + "chunkOrigin.loc": loc => loc, - if (aType == bType) { - if (aType != "o" && aType != "u" && aValue != bValue) { - return aValue < bValue; - } - i++; - } else { - // Handles remaining cases - if (aType == "o" && bType == "n") return true; - return bType == "s" || aType == "u"; - } - } -}; -/* eslint-enable eqeqeq */ -exports.versionLt = versionLt; + "error.compilerPath": (compilerPath, { bold }) => + compilerPath ? bold(`(${compilerPath})`) : undefined, + "error.chunkId": (chunkId, { formatChunkId }) => + isValidId(chunkId) ? formatChunkId(chunkId) : undefined, + "error.chunkEntry": (chunkEntry, { formatFlag }) => + chunkEntry ? formatFlag("entry") : undefined, + "error.chunkInitial": (chunkInitial, { formatFlag }) => + chunkInitial ? formatFlag("initial") : undefined, + "error.file": (file, { bold }) => bold(file), + "error.moduleName": (moduleName, { bold }) => { + return moduleName.includes("!") + ? `${bold(moduleName.replace(/^(\s|\S)*!/, ""))} (${moduleName})` + : `${bold(moduleName)}`; + }, + "error.loc": (loc, { green }) => green(loc), + "error.message": (message, { bold, formatError }) => + message.includes("\u001b[") ? message : bold(formatError(message)), + "error.details": (details, { formatError }) => formatError(details), + "error.stack": stack => stack, + "error.moduleTrace": moduleTrace => undefined, + "error.separator!": () => "\n", -/** - * @param {string} str range string - * @returns {SemVerRange} parsed range - */ -exports.parseRange = str => { - const splitAndConvert = str => { - return str - .split(".") - .map(item => (item !== "NaN" && `${+item}` === item ? +item : item)); - }; - // see https://docs.npmjs.com/misc/semver#range-grammar for grammar - const parsePartial = str => { - const match = /^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(str); - /** @type {(string|number|undefined|[])[]} */ - const ver = match[1] ? [0, ...splitAndConvert(match[1])] : [0]; - if (match[2]) { - ver.length++; - ver.push.apply(ver, splitAndConvert(match[2])); - } + "loggingEntry(error).loggingEntry.message": (message, { red }) => + mapLines(message, x => ` ${red(x)}`), + "loggingEntry(warn).loggingEntry.message": (message, { yellow }) => + mapLines(message, x => ` ${yellow(x)}`), + "loggingEntry(info).loggingEntry.message": (message, { green }) => + mapLines(message, x => ` ${green(x)}`), + "loggingEntry(log).loggingEntry.message": (message, { bold }) => + mapLines(message, x => ` ${bold(x)}`), + "loggingEntry(debug).loggingEntry.message": message => + mapLines(message, x => ` ${x}`), + "loggingEntry(trace).loggingEntry.message": message => + mapLines(message, x => ` ${x}`), + "loggingEntry(status).loggingEntry.message": (message, { magenta }) => + mapLines(message, x => ` ${magenta(x)}`), + "loggingEntry(profile).loggingEntry.message": (message, { magenta }) => + mapLines(message, x => `

${magenta(x)}`), + "loggingEntry(profileEnd).loggingEntry.message": (message, { magenta }) => + mapLines(message, x => `

${magenta(x)}`), + "loggingEntry(time).loggingEntry.message": (message, { magenta }) => + mapLines(message, x => ` ${magenta(x)}`), + "loggingEntry(group).loggingEntry.message": (message, { cyan }) => + mapLines(message, x => `<-> ${cyan(x)}`), + "loggingEntry(groupCollapsed).loggingEntry.message": (message, { cyan }) => + mapLines(message, x => `<+> ${cyan(x)}`), + "loggingEntry(clear).loggingEntry": () => " -------", + "loggingEntry(groupCollapsed).loggingEntry.children": () => "", + "loggingEntry.trace[]": trace => + trace ? mapLines(trace, x => `| ${x}`) : undefined, - // remove trailing any matchers - let last = ver[ver.length - 1]; - while ( - ver.length && - (last === undefined || /^[*xX]$/.test(/** @type {string} */ (last))) - ) { - ver.pop(); - last = ver[ver.length - 1]; - } + "moduleTraceItem.originName": originName => originName, - return ver; - }; - const toFixed = range => { - if (range.length === 1) { - // Special case for "*" is "x.x.x" instead of "=" - return [0]; - } else if (range.length === 2) { - // Special case for "1" is "1.x.x" instead of "=1" - return [1, ...range.slice(1)]; - } else if (range.length === 3) { - // Special case for "1.2" is "1.2.x" instead of "=1.2" - return [2, ...range.slice(1)]; - } else { - return [range.length, ...range.slice(1)]; - } - }; - const negate = range => { - return [-range[0] - 1, ...range.slice(1)]; - }; - const parseSimple = str => { - // simple ::= primitive | partial | tilde | caret - // primitive ::= ( '<' | '>' | '>=' | '<=' | '=' | '!' ) ( ' ' ) * partial - // tilde ::= '~' ( ' ' ) * partial - // caret ::= '^' ( ' ' ) * partial - const match = /^(\^|~|<=|<|>=|>|=|v|!)/.exec(str); - const start = match ? match[0] : ""; - const remainder = parsePartial( - start.length ? str.slice(start.length).trim() : str.trim() - ); - switch (start) { - case "^": - if (remainder.length > 1 && remainder[1] === 0) { - if (remainder.length > 2 && remainder[2] === 0) { - return [3, ...remainder.slice(1)]; - } - return [2, ...remainder.slice(1)]; - } - return [1, ...remainder.slice(1)]; - case "~": - return [2, ...remainder.slice(1)]; - case ">=": - return remainder; - case "=": - case "v": - case "": - return toFixed(remainder); - case "<": - return negate(remainder); - case ">": { - // and( >=, not( = ) ) => >=, =, not, and - const fixed = toFixed(remainder); - // eslint-disable-next-line no-sparse-arrays - return [, fixed, 0, remainder, 2]; - } - case "<=": - // or( <, = ) => <, =, or - // eslint-disable-next-line no-sparse-arrays - return [, toFixed(remainder), negate(remainder), 1]; - case "!": { - // not = - const fixed = toFixed(remainder); - // eslint-disable-next-line no-sparse-arrays - return [, fixed, 0]; - } - default: - throw new Error("Unexpected start value"); - } - }; - const combine = (items, fn) => { - if (items.length === 1) return items[0]; - const arr = []; - for (const item of items.slice().reverse()) { - if (0 in item) { - arr.push(item); - } else { - arr.push(...item.slice(1)); - } - } - // eslint-disable-next-line no-sparse-arrays - return [, ...arr, ...items.slice(1).map(() => fn)]; - }; - const parseRange = str => { - // range ::= hyphen | simple ( ' ' ( ' ' ) * simple ) * | '' - // hyphen ::= partial ( ' ' ) * ' - ' ( ' ' ) * partial - const items = str.split(/\s+-\s+/); - if (items.length === 1) { - const items = str - .trim() - .split(/(?<=[-0-9A-Za-z])\s+/g) - .map(parseSimple); - return combine(items, 2); - } - const a = parsePartial(items[0]); - const b = parsePartial(items[1]); - // >=a <=b => and( >=a, or( >=a, { - // range-set ::= range ( logical-or range ) * - // logical-or ::= ( ' ' ) * '||' ( ' ' ) * - const items = str.split(/\s*\|\|\s*/).map(parseRange); - return combine(items, 1); - }; - return parseLogicalOr(str); -}; + loggingGroup: loggingGroup => + loggingGroup.entries.length === 0 ? "" : undefined, + "loggingGroup.debug": (flag, { red }) => (flag ? red("DEBUG") : undefined), + "loggingGroup.name": (name, { bold }) => bold(`LOG from ${name}`), + "loggingGroup.separator!": () => "\n", + "loggingGroup.filteredEntries": filteredEntries => + filteredEntries > 0 ? `+ ${filteredEntries} hidden lines` : undefined, -/* eslint-disable eqeqeq */ -const rangeToString = range => { - var fixCount = range[0]; - var str = ""; - if (range.length === 1) { - return "*"; - } else if (fixCount + 0.5) { - str += - fixCount == 0 - ? ">=" - : fixCount == -1 - ? "<" - : fixCount == 1 - ? "^" - : fixCount == 2 - ? "~" - : fixCount > 0 - ? "=" - : "!="; - var needDot = 1; - // eslint-disable-next-line no-redeclare - for (var i = 1; i < range.length; i++) { - var item = range[i]; - var t = (typeof item)[0]; - needDot--; - str += - t == "u" - ? // undefined: prerelease marker, add an "-" - "-" - : // number or string: add the item, set flag to add an "." between two of them - (needDot > 0 ? "." : "") + ((needDot = 2), item); - } - return str; - } else { - var stack = []; - // eslint-disable-next-line no-redeclare - for (var i = 1; i < range.length; i++) { - // eslint-disable-next-line no-redeclare - var item = range[i]; - stack.push( - item === 0 - ? "not(" + pop() + ")" - : item === 1 - ? "(" + pop() + " || " + pop() + ")" - : item === 2 - ? stack.pop() + " " + stack.pop() - : rangeToString(item) - ); - } - return pop(); - } - function pop() { - return stack.pop().replace(/^\((.+)\)$/, "$1"); - } + "moduleTraceDependency.loc": loc => loc }; -/* eslint-enable eqeqeq */ -exports.rangeToString = rangeToString; -/* eslint-disable eqeqeq */ -/** - * @param {SemVerRange} range version range - * @param {string} version the version - * @returns {boolean} if version satisfy the range - */ -const satisfy = (range, version) => { - if (0 in range) { - // @ts-expect-error - version = parseVersion(version); - var fixCount = range[0]; - // when negated is set it swill set for < instead of >= - var negated = fixCount < 0; - if (negated) fixCount = -fixCount - 1; - for (var i = 0, j = 1, isEqual = true; ; j++, i++) { - // cspell:word nequal nequ +/** @type {Record} */ +const ITEM_NAMES = { + "compilation.assets[]": "asset", + "compilation.modules[]": "module", + "compilation.chunks[]": "chunk", + "compilation.entrypoints[]": "chunkGroup", + "compilation.namedChunkGroups[]": "chunkGroup", + "compilation.errors[]": "error", + "compilation.warnings[]": "error", + "compilation.logging[]": "loggingGroup", + "compilation.children[]": "compilation", + "asset.related[]": "asset", + "asset.children[]": "asset", + "asset.chunks[]": "assetChunk", + "asset.auxiliaryChunks[]": "assetChunk", + "asset.chunkNames[]": "assetChunkName", + "asset.chunkIdHints[]": "assetChunkIdHint", + "asset.auxiliaryChunkNames[]": "assetChunkName", + "asset.auxiliaryChunkIdHints[]": "assetChunkIdHint", + "chunkGroup.assets[]": "chunkGroupAsset", + "chunkGroup.auxiliaryAssets[]": "chunkGroupAsset", + "chunkGroupChild.assets[]": "chunkGroupAsset", + "chunkGroupChild.auxiliaryAssets[]": "chunkGroupAsset", + "chunkGroup.children[]": "chunkGroupChildGroup", + "chunkGroupChildGroup.children[]": "chunkGroupChild", + "module.modules[]": "module", + "module.children[]": "module", + "module.reasons[]": "moduleReason", + "moduleReason.children[]": "moduleReason", + "module.issuerPath[]": "moduleIssuer", + "chunk.origins[]": "chunkOrigin", + "chunk.modules[]": "module", + "loggingGroup.entries[]": logEntry => + `loggingEntry(${logEntry.type}).loggingEntry`, + "loggingEntry.children[]": logEntry => + `loggingEntry(${logEntry.type}).loggingEntry`, + "error.moduleTrace[]": "moduleTraceItem", + "moduleTraceItem.dependencies[]": "moduleTraceDependency" +}; - // when isEqual = true: - // range version: EOA/object undefined number string - // EOA equal block big-ver big-ver - // undefined bigger next big-ver big-ver - // number smaller block cmp big-cmp - // fixed number smaller block cmp-fix differ - // string smaller block differ cmp - // fixed string smaller block small-cmp cmp-fix +const ERROR_PREFERRED_ORDER = [ + "compilerPath", + "chunkId", + "chunkEntry", + "chunkInitial", + "file", + "separator!", + "moduleName", + "loc", + "separator!", + "message", + "separator!", + "details", + "separator!", + "stack", + "separator!", + "missing", + "separator!", + "moduleTrace" +]; - // when isEqual = false: - // range version: EOA/object undefined number string - // EOA nequal block next-ver next-ver - // undefined nequal block next-ver next-ver - // number nequal block next next - // fixed number nequal block next next (this never happens) - // string nequal block next next - // fixed string nequal block next next (this never happens) +/** @type {Record} */ +const PREFERRED_ORDERS = { + compilation: [ + "name", + "hash", + "version", + "time", + "builtAt", + "env", + "publicPath", + "assets", + "filteredAssets", + "entrypoints", + "namedChunkGroups", + "chunks", + "modules", + "filteredModules", + "children", + "logging", + "warnings", + "warningsInChildren!", + "filteredWarningDetailsCount", + "errors", + "errorsInChildren!", + "filteredErrorDetailsCount", + "summary!", + "needAdditionalPass" + ], + asset: [ + "type", + "name", + "size", + "chunks", + "auxiliaryChunks", + "emitted", + "comparedForEmit", + "cached", + "info", + "isOverSizeLimit", + "chunkNames", + "auxiliaryChunkNames", + "chunkIdHints", + "auxiliaryChunkIdHints", + "related", + "filteredRelated", + "children", + "filteredChildren" + ], + "asset.info": [ + "immutable", + "sourceFilename", + "javascriptModule", + "development", + "hotModuleReplacement" + ], + chunkGroup: [ + "kind!", + "name", + "isOverSizeLimit", + "assetsSize", + "auxiliaryAssetsSize", + "is!", + "assets", + "filteredAssets", + "auxiliaryAssets", + "filteredAuxiliaryAssets", + "separator!", + "children" + ], + chunkGroupAsset: ["name", "size"], + chunkGroupChildGroup: ["type", "children"], + chunkGroupChild: ["assets", "chunks", "name"], + module: [ + "type", + "name", + "identifier", + "id", + "layer", + "sizes", + "chunks", + "depth", + "cacheable", + "orphan", + "runtime", + "optional", + "dependent", + "built", + "codeGenerated", + "cached", + "assets", + "failed", + "warnings", + "errors", + "children", + "filteredChildren", + "providedExports", + "usedExports", + "optimizationBailout", + "reasons", + "filteredReasons", + "issuerPath", + "profile", + "modules", + "filteredModules" + ], + moduleReason: [ + "active", + "type", + "userRequest", + "moduleId", + "module", + "resolvedModule", + "loc", + "explanation", + "children", + "filteredChildren" + ], + "module.profile": [ + "total", + "separator!", + "resolving", + "restoring", + "integration", + "building", + "storing", + "additionalResolving", + "additionalIntegration" + ], + chunk: [ + "id", + "runtime", + "files", + "names", + "idHints", + "sizes", + "parents", + "siblings", + "children", + "childrenByOrder", + "entry", + "initial", + "rendered", + "recorded", + "reason", + "separator!", + "origins", + "separator!", + "modules", + "separator!", + "filteredModules" + ], + chunkOrigin: ["request", "moduleId", "moduleName", "loc"], + error: ERROR_PREFERRED_ORDER, + warning: ERROR_PREFERRED_ORDER, + "chunk.childrenByOrder[]": ["type", "children"], + loggingGroup: [ + "debug", + "name", + "separator!", + "entries", + "separator!", + "filteredEntries" + ], + loggingEntry: ["message", "trace", "children"] +}; - // EOA end of array - // equal (version is equal range): - // when !negated: return true, - // when negated: return false - // bigger (version is bigger as range): - // when fixed: return false, - // when !negated: return true, - // when negated: return false, - // smaller (version is smaller as range): - // when !negated: return false, - // when negated: return true - // nequal (version is not equal range (> resp <)): return true - // block (version is in different prerelease area): return false - // differ (version is different from fixed range (string vs. number)): return false - // next: continues to the next items - // next-ver: when fixed: return false, continues to the next item only for the version, sets isEqual=false - // big-ver: when fixed || negated: return false, continues to the next item only for the version, sets isEqual=false - // next-nequ: continues to the next items, sets isEqual=false - // cmp (negated === false): version < range => return false, version > range => next-nequ, else => next - // cmp (negated === true): version > range => return false, version < range => next-nequ, else => next - // cmp-fix: version == range => next, else => return false - // big-cmp: when negated => return false, else => next-nequ - // small-cmp: when negated => next-nequ, else => return false +const itemsJoinOneLine = items => items.filter(Boolean).join(" "); +const itemsJoinOneLineBrackets = items => + items.length > 0 ? `(${items.filter(Boolean).join(" ")})` : undefined; +const itemsJoinMoreSpacing = items => items.filter(Boolean).join("\n\n"); +const itemsJoinComma = items => items.filter(Boolean).join(", "); +const itemsJoinCommaBrackets = items => + items.length > 0 ? `(${items.filter(Boolean).join(", ")})` : undefined; +const itemsJoinCommaBracketsWithName = name => items => + items.length > 0 + ? `(${name}: ${items.filter(Boolean).join(", ")})` + : undefined; - var rangeType = j < range.length ? (typeof range[j])[0] : ""; +/** @type {Record string>} */ +const SIMPLE_ITEMS_JOINER = { + "chunk.parents": itemsJoinOneLine, + "chunk.siblings": itemsJoinOneLine, + "chunk.children": itemsJoinOneLine, + "chunk.names": itemsJoinCommaBrackets, + "chunk.idHints": itemsJoinCommaBracketsWithName("id hint"), + "chunk.runtime": itemsJoinCommaBracketsWithName("runtime"), + "chunk.files": itemsJoinComma, + "chunk.childrenByOrder": itemsJoinOneLine, + "chunk.childrenByOrder[].children": itemsJoinOneLine, + "chunkGroup.assets": itemsJoinOneLine, + "chunkGroup.auxiliaryAssets": itemsJoinOneLineBrackets, + "chunkGroupChildGroup.children": itemsJoinComma, + "chunkGroupChild.assets": itemsJoinOneLine, + "chunkGroupChild.auxiliaryAssets": itemsJoinOneLineBrackets, + "asset.chunks": itemsJoinComma, + "asset.auxiliaryChunks": itemsJoinCommaBrackets, + "asset.chunkNames": itemsJoinCommaBracketsWithName("name"), + "asset.auxiliaryChunkNames": itemsJoinCommaBracketsWithName("auxiliary name"), + "asset.chunkIdHints": itemsJoinCommaBracketsWithName("id hint"), + "asset.auxiliaryChunkIdHints": + itemsJoinCommaBracketsWithName("auxiliary id hint"), + "module.chunks": itemsJoinOneLine, + "module.issuerPath": items => + items + .filter(Boolean) + .map(item => `${item} ->`) + .join(" "), + "compilation.errors": itemsJoinMoreSpacing, + "compilation.warnings": itemsJoinMoreSpacing, + "compilation.logging": itemsJoinMoreSpacing, + "compilation.children": items => indent(itemsJoinMoreSpacing(items), " "), + "moduleTraceItem.dependencies": itemsJoinOneLine, + "loggingEntry.children": items => + indent(items.filter(Boolean).join("\n"), " ", false) +}; - var versionValue; - var versionType; +const joinOneLine = items => + items + .map(item => item.content) + .filter(Boolean) + .join(" "); - // Handles first column in both tables (end of version or object) - if ( - i >= version.length || - ((versionValue = version[i]), - (versionType = (typeof versionValue)[0]) == "o") - ) { - // Handles nequal - if (!isEqual) return true; - // Handles bigger - if (rangeType == "u") return j > fixCount && !negated; - // Handles equal and smaller: (range === EOA) XOR negated - return (rangeType == "") != negated; // equal + smaller +const joinInBrackets = items => { + const res = []; + let mode = 0; + for (const item of items) { + if (item.element === "separator!") { + switch (mode) { + case 0: + case 1: + mode += 2; + break; + case 4: + res.push(")"); + mode = 3; + break; } + } + if (!item.content) continue; + switch (mode) { + case 0: + mode = 1; + break; + case 1: + res.push(" "); + break; + case 2: + res.push("("); + mode = 4; + break; + case 3: + res.push(" ("); + mode = 4; + break; + case 4: + res.push(", "); + break; + } + res.push(item.content); + } + if (mode === 4) res.push(")"); + return res.join(""); +}; - // Handles second column in both tables (version = undefined) - if (versionType == "u") { - if (!isEqual || rangeType != "u") { - return false; - } +const indent = (str, prefix, noPrefixInFirstLine) => { + const rem = str.replace(/\n([^\n])/g, "\n" + prefix + "$1"); + if (noPrefixInFirstLine) return rem; + const ind = str[0] === "\n" ? "" : prefix; + return ind + rem; +}; + +const joinExplicitNewLine = (items, indenter) => { + let firstInLine = true; + let first = true; + return items + .map(item => { + if (!item || !item.content) return; + let content = indent(item.content, first ? "" : indenter, !firstInLine); + if (firstInLine) { + content = content.replace(/^\n+/, ""); } + if (!content) return; + first = false; + const noJoiner = firstInLine || content.startsWith("\n"); + firstInLine = content.endsWith("\n"); + return noJoiner ? content : " " + content; + }) + .filter(Boolean) + .join("") + .trim(); +}; - // switch between first and second table - else if (isEqual) { - // Handle diagonal - if (rangeType == versionType) { - if (j <= fixCount) { - // Handles "cmp-fix" cases - if (versionValue != range[j]) { - return false; +const joinError = + error => + (items, { red, yellow }) => + `${error ? red("ERROR") : yellow("WARNING")} in ${joinExplicitNewLine( + items, + "" + )}`; + +/** @type {Record string>} */ +const SIMPLE_ELEMENT_JOINERS = { + compilation: items => { + const result = []; + let lastNeedMore = false; + for (const item of items) { + if (!item.content) continue; + const needMoreSpace = + item.element === "warnings" || + item.element === "filteredWarningDetailsCount" || + item.element === "errors" || + item.element === "filteredErrorDetailsCount" || + item.element === "logging"; + if (result.length !== 0) { + result.push(needMoreSpace || lastNeedMore ? "\n\n" : "\n"); + } + result.push(item.content); + lastNeedMore = needMoreSpace; + } + if (lastNeedMore) result.push("\n"); + return result.join(""); + }, + asset: items => + joinExplicitNewLine( + items.map(item => { + if ( + (item.element === "related" || item.element === "children") && + item.content + ) { + return { + ...item, + content: `\n${item.content}\n` + }; + } + return item; + }), + " " + ), + "asset.info": joinOneLine, + module: (items, { module }) => { + let hasName = false; + return joinExplicitNewLine( + items.map(item => { + switch (item.element) { + case "id": + if (module.id === module.name) { + if (hasName) return false; + if (item.content) hasName = true; } - } else { - // Handles "cmp" cases - if (negated ? versionValue > range[j] : versionValue < range[j]) { - return false; + break; + case "name": + if (hasName) return false; + if (item.content) hasName = true; + break; + case "providedExports": + case "usedExports": + case "optimizationBailout": + case "reasons": + case "issuerPath": + case "profile": + case "children": + case "modules": + if (item.content) { + return { + ...item, + content: `\n${item.content}\n` + }; } - if (versionValue != range[j]) isEqual = false; - } + break; } - - // Handle big-ver - else if (rangeType != "s" && rangeType != "n") { - if (negated || j <= fixCount) return false; - isEqual = false; - j--; + return item; + }), + " " + ); + }, + chunk: items => { + let hasEntry = false; + return ( + "chunk " + + joinExplicitNewLine( + items.filter(item => { + switch (item.element) { + case "entry": + if (item.content) hasEntry = true; + break; + case "initial": + if (hasEntry) return false; + break; + } + return true; + }), + " " + ) + ); + }, + "chunk.childrenByOrder[]": items => `(${joinOneLine(items)})`, + chunkGroup: items => joinExplicitNewLine(items, " "), + chunkGroupAsset: joinOneLine, + chunkGroupChildGroup: joinOneLine, + chunkGroupChild: joinOneLine, + // moduleReason: (items, { moduleReason }) => { + // let hasName = false; + // return joinOneLine( + // items.filter(item => { + // switch (item.element) { + // case "moduleId": + // if (moduleReason.moduleId === moduleReason.module && item.content) + // hasName = true; + // break; + // case "module": + // if (hasName) return false; + // break; + // case "resolvedModule": + // return ( + // moduleReason.module !== moduleReason.resolvedModule && + // item.content + // ); + // } + // return true; + // }) + // ); + // }, + moduleReason: (items, { moduleReason }) => { + let hasName = false; + return joinExplicitNewLine( + items.map(item => { + switch (item.element) { + case "moduleId": + if (moduleReason.moduleId === moduleReason.module && item.content) + hasName = true; + break; + case "module": + if (hasName) return false; + break; + case "resolvedModule": + if (moduleReason.module === moduleReason.resolvedModule) + return false; + break; + case "children": + if (item.content) { + return { + ...item, + content: `\n${item.content}\n` + }; + } + break; } + return item; + }), + " " + ); + }, + "module.profile": joinInBrackets, + moduleIssuer: joinOneLine, + chunkOrigin: items => "> " + joinOneLine(items), + "errors[].error": joinError(true), + "warnings[].error": joinError(false), + loggingGroup: items => joinExplicitNewLine(items, "").trimRight(), + moduleTraceItem: items => " @ " + joinOneLine(items), + moduleTraceDependency: joinOneLine +}; - // Handle differ, big-cmp and small-cmp - else if (j <= fixCount || versionType < rangeType != negated) { - return false; - } else { - isEqual = false; - } - } else { - // Handles all "next-ver" cases in the second table - if (rangeType != "s" && rangeType != "n") { - isEqual = false; - j--; - } +const AVAILABLE_COLORS = { + bold: "\u001b[1m", + yellow: "\u001b[1m\u001b[33m", + red: "\u001b[1m\u001b[31m", + green: "\u001b[1m\u001b[32m", + cyan: "\u001b[1m\u001b[36m", + magenta: "\u001b[1m\u001b[35m" +}; - // next is applied by default +const AVAILABLE_FORMATS = { + formatChunkId: (id, { yellow }, direction) => { + switch (direction) { + case "parent": + return `<{${yellow(id)}}>`; + case "sibling": + return `={${yellow(id)}}=`; + case "child": + return `>{${yellow(id)}}<`; + default: + return `{${yellow(id)}}`; + } + }, + formatModuleId: id => `[${id}]`, + formatFilename: (filename, { green, yellow }, oversize) => + (oversize ? yellow : green)(filename), + formatFlag: flag => `[${flag}]`, + formatLayer: layer => `(in ${layer})`, + formatSize: (__webpack_require__(71070).formatSize), + formatDateTime: (dateTime, { bold }) => { + const d = new Date(dateTime); + const x = twoDigit; + const date = `${d.getFullYear()}-${x(d.getMonth() + 1)}-${x(d.getDate())}`; + const time = `${x(d.getHours())}:${x(d.getMinutes())}:${x(d.getSeconds())}`; + return `${date} ${bold(time)}`; + }, + formatTime: ( + time, + { timeReference, bold, green, yellow, red }, + boldQuantity + ) => { + const unit = " ms"; + if (timeReference && time !== timeReference) { + const times = [ + timeReference / 2, + timeReference / 4, + timeReference / 8, + timeReference / 16 + ]; + if (time < times[3]) return `${time}${unit}`; + else if (time < times[2]) return bold(`${time}${unit}`); + else if (time < times[1]) return green(`${time}${unit}`); + else if (time < times[0]) return yellow(`${time}${unit}`); + else return red(`${time}${unit}`); + } else { + return `${boldQuantity ? bold(time) : time}${unit}`; + } + }, + formatError: (message, { green, yellow, red }) => { + if (message.includes("\u001b[")) return message; + const highlights = [ + { regExp: /(Did you mean .+)/g, format: green }, + { + regExp: /(Set 'mode' option to 'development' or 'production')/g, + format: green + }, + { regExp: /(\(module has no exports\))/g, format: red }, + { regExp: /\(possible exports: (.+)\)/g, format: green }, + { regExp: /(?:^|\n)(.* doesn't exist)/g, format: red }, + { regExp: /('\w+' option has not been set)/g, format: red }, + { + regExp: /(Emitted value instead of an instance of Error)/g, + format: yellow + }, + { regExp: /(Used? .+ instead)/gi, format: yellow }, + { regExp: /\b(deprecated|must|required)\b/g, format: yellow }, + { + regExp: /\b(BREAKING CHANGE)\b/gi, + format: red + }, + { + regExp: + /\b(error|failed|unexpected|invalid|not found|not supported|not available|not possible|not implemented|doesn't support|conflict|conflicting|not existing|duplicate)\b/gi, + format: red } + ]; + for (const { regExp, format } of highlights) { + message = message.replace(regExp, (match, content) => { + return match.replace(content, format(content)); + }); } + return message; } - /** @type {(boolean | number)[]} */ - var stack = []; - var p = stack.pop.bind(stack); - // eslint-disable-next-line no-redeclare - for (var i = 1; i < range.length; i++) { - var item = /** @type {SemVerRange | 0 | 1 | 2} */ (range[i]); - stack.push( - item == 1 - ? p() | p() - : item == 2 - ? p() & p() - : item - ? satisfy(item, version) - : !p() - ); - } - return !!p(); }; -/* eslint-enable eqeqeq */ -exports.satisfy = satisfy; -exports.stringifyHoley = json => { - switch (typeof json) { - case "undefined": - return ""; - case "object": - if (Array.isArray(json)) { - let str = "["; - for (let i = 0; i < json.length; i++) { - if (i !== 0) str += ","; - str += this.stringifyHoley(json[i]); - } - str += "]"; - return str; - } else { - return JSON.stringify(json); - } - default: - return JSON.stringify(json); +const RESULT_MODIFIER = { + "module.modules": result => { + return indent(result, "| "); } }; -//#region runtime code: parseVersion -exports.parseVersionRuntimeCode = runtimeTemplate => - `var parseVersion = ${runtimeTemplate.basicFunction("str", [ - "// see webpack/lib/util/semver.js for original code", - `var p=${ - runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)" - }{return p.split(".").map((${ - runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)" - }{return+p==p?+p:p}))},n=/^([^-+]+)?(?:-([^+]+))?(?:\\+(.+))?$/.exec(str),r=n[1]?p(n[1]):[];return n[2]&&(r.length++,r.push.apply(r,p(n[2]))),n[3]&&(r.push([]),r.push.apply(r,p(n[3]))),r;` - ])}`; -//#endregion - -//#region runtime code: versionLt -exports.versionLtRuntimeCode = runtimeTemplate => - `var versionLt = ${runtimeTemplate.basicFunction("a, b", [ - "// see webpack/lib/util/semver.js for original code", - 'a=parseVersion(a),b=parseVersion(b);for(var r=0;;){if(r>=a.length)return r=b.length)return"u"==n;var t=b[r],f=(typeof t)[0];if(n!=f)return"o"==n&&"n"==f||("s"==f||"u"==n);if("o"!=n&&"u"!=n&&e!=t)return e - `var rangeToString = ${runtimeTemplate.basicFunction("range", [ - "// see webpack/lib/util/semver.js for original code", - 'var r=range[0],n="";if(1===range.length)return"*";if(r+.5){n+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var e=1,a=1;a0?".":"")+(e=2,t)}return n}var g=[];for(a=1;a - `var satisfy = ${runtimeTemplate.basicFunction("range, version", [ - "// see webpack/lib/util/semver.js for original code", - 'if(0 in range){version=parseVersion(version);var e=range[0],r=e<0;r&&(e=-e-1);for(var n=0,i=1,a=!0;;i++,n++){var f,s,g=i=version.length||"o"==(s=(typeof(f=version[n]))[0]))return!a||("u"==g?i>e&&!r:""==g!=r);if("u"==s){if(!a||"u"!=g)return!1}else if(a)if(g==s)if(i<=e){if(f!=range[i])return!1}else{if(r?f>range[i]:f { + const originalArray = array.slice(); + const set = new Set(array); + const usedSet = new Set(); + array.length = 0; + for (const element of preferredOrder) { + if (element.endsWith("!") || set.has(element)) { + array.push(element); + usedSet.add(element); + } + } + for (const element of originalArray) { + if (!usedSet.has(element)) { + array.push(element); + } + } + return array; +}; -/** @typedef {import("../serialization/BinaryMiddleware").MEASURE_END_OPERATION_TYPE} MEASURE_END_OPERATION */ -/** @typedef {import("../serialization/BinaryMiddleware").MEASURE_START_OPERATION_TYPE} MEASURE_START_OPERATION */ -/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */ -/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */ -/** @typedef {import("../serialization/Serializer")} Serializer */ +class DefaultStatsPrinterPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap("DefaultStatsPrinterPlugin", compilation => { + compilation.hooks.statsPrinter.tap( + "DefaultStatsPrinterPlugin", + (stats, options, context) => { + // Put colors into context + stats.hooks.print + .for("compilation") + .tap("DefaultStatsPrinterPlugin", (compilation, context) => { + for (const color of Object.keys(AVAILABLE_COLORS)) { + let start; + if (options.colors) { + if ( + typeof options.colors === "object" && + typeof options.colors[color] === "string" + ) { + start = options.colors[color]; + } else { + start = AVAILABLE_COLORS[color]; + } + } + if (start) { + context[color] = str => + `${start}${ + typeof str === "string" + ? str.replace( + /((\u001b\[39m|\u001b\[22m|\u001b\[0m)+)/g, + `$1${start}` + ) + : str + }\u001b[39m\u001b[22m`; + } else { + context[color] = str => str; + } + } + for (const format of Object.keys(AVAILABLE_FORMATS)) { + context[format] = (content, ...args) => + AVAILABLE_FORMATS[format](content, context, ...args); + } + context.timeReference = compilation.time; + }); -const getBinaryMiddleware = memoize(() => - __webpack_require__(97059) -); -const getObjectMiddleware = memoize(() => - __webpack_require__(34795) -); -const getSingleItemMiddleware = memoize(() => - __webpack_require__(65112) -); -const getSerializer = memoize(() => __webpack_require__(53080)); -const getSerializerMiddleware = memoize(() => - __webpack_require__(83137) -); + for (const key of Object.keys(SIMPLE_PRINTERS)) { + stats.hooks.print + .for(key) + .tap("DefaultStatsPrinterPlugin", (obj, ctx) => + SIMPLE_PRINTERS[key](obj, ctx, stats) + ); + } -const getBinaryMiddlewareInstance = memoize( - () => new (getBinaryMiddleware())() -); + for (const key of Object.keys(PREFERRED_ORDERS)) { + const preferredOrder = PREFERRED_ORDERS[key]; + stats.hooks.sortElements + .for(key) + .tap("DefaultStatsPrinterPlugin", (elements, context) => { + createOrder(elements, preferredOrder); + }); + } -const registerSerializers = memoize(() => { - __webpack_require__(26611); + for (const key of Object.keys(ITEM_NAMES)) { + const itemName = ITEM_NAMES[key]; + stats.hooks.getItemName + .for(key) + .tap( + "DefaultStatsPrinterPlugin", + typeof itemName === "string" ? () => itemName : itemName + ); + } - // Load internal paths with a relative require - // This allows bundling all internal serializers - const internalSerializables = __webpack_require__(53023); - getObjectMiddleware().registerLoader(/^webpack\/lib\//, req => { - const loader = internalSerializables[req.slice("webpack/lib/".length)]; - if (loader) { - loader(); - } else { - console.warn(`${req} not found in internalSerializables`); - } - return true; - }); -}); + for (const key of Object.keys(SIMPLE_ITEMS_JOINER)) { + const joiner = SIMPLE_ITEMS_JOINER[key]; + stats.hooks.printItems + .for(key) + .tap("DefaultStatsPrinterPlugin", joiner); + } -/** @type {Serializer} */ -let buffersSerializer; + for (const key of Object.keys(SIMPLE_ELEMENT_JOINERS)) { + const joiner = SIMPLE_ELEMENT_JOINERS[key]; + stats.hooks.printElements + .for(key) + .tap("DefaultStatsPrinterPlugin", joiner); + } -// Expose serialization API -module.exports = { - get register() { - return getObjectMiddleware().register; - }, - get registerLoader() { - return getObjectMiddleware().registerLoader; - }, - get registerNotSerializable() { - return getObjectMiddleware().registerNotSerializable; - }, - get NOT_SERIALIZABLE() { - return getObjectMiddleware().NOT_SERIALIZABLE; - }, - /** @type {MEASURE_START_OPERATION} */ - get MEASURE_START_OPERATION() { - return getBinaryMiddleware().MEASURE_START_OPERATION; - }, - /** @type {MEASURE_END_OPERATION} */ - get MEASURE_END_OPERATION() { - return getBinaryMiddleware().MEASURE_END_OPERATION; - }, - get buffersSerializer() { - if (buffersSerializer !== undefined) return buffersSerializer; - registerSerializers(); - const Serializer = getSerializer(); - const binaryMiddleware = getBinaryMiddlewareInstance(); - const SerializerMiddleware = getSerializerMiddleware(); - const SingleItemMiddleware = getSingleItemMiddleware(); - return (buffersSerializer = new Serializer([ - new SingleItemMiddleware(), - new (getObjectMiddleware())(context => { - if (context.write) { - context.writeLazy = value => { - context.write( - SerializerMiddleware.createLazy(value, binaryMiddleware) - ); - }; - } - }, "md4"), - binaryMiddleware - ])); - }, - createFileSerializer: (fs, hashFunction) => { - registerSerializers(); - const Serializer = getSerializer(); - const FileMiddleware = __webpack_require__(65321); - const fileMiddleware = new FileMiddleware(fs, hashFunction); - const binaryMiddleware = getBinaryMiddlewareInstance(); - const SerializerMiddleware = getSerializerMiddleware(); - const SingleItemMiddleware = getSingleItemMiddleware(); - return new Serializer([ - new SingleItemMiddleware(), - new (getObjectMiddleware())(context => { - if (context.write) { - context.writeLazy = value => { - context.write( - SerializerMiddleware.createLazy(value, binaryMiddleware) - ); - }; - context.writeSeparate = (value, options) => { - const lazy = SerializerMiddleware.createLazy( - value, - fileMiddleware, - options - ); - context.write(lazy); - return lazy; - }; + for (const key of Object.keys(RESULT_MODIFIER)) { + const modifier = RESULT_MODIFIER[key]; + stats.hooks.result + .for(key) + .tap("DefaultStatsPrinterPlugin", modifier); + } } - }, hashFunction), - binaryMiddleware, - fileMiddleware - ]); + ); + }); } -}; +} +module.exports = DefaultStatsPrinterPlugin; /***/ }), -/***/ 15652: -/***/ (function(module) { +/***/ 92629: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -129455,211 +127948,297 @@ module.exports = { -/** - * @typedef {Object} GroupOptions - * @property {boolean=} groupChildren - * @property {boolean=} force - * @property {number=} targetGroupCount - */ +const { HookMap, SyncBailHook, SyncWaterfallHook } = __webpack_require__(41242); +const { concatComparators, keepOriginalOrder } = __webpack_require__(29579); +const smartGrouping = __webpack_require__(15652); -/** - * @template T - * @template R - * @typedef {Object} GroupConfig - * @property {function(T): string[]} getKeys - * @property {function(string, (R | T)[], T[]): R} createGroup - * @property {function(string, T[]): GroupOptions=} getOptions - */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -/** - * @template T - * @template R - * @typedef {Object} ItemWithGroups - * @property {T} item - * @property {Set>} groups - */ +/** @typedef {import("../util/smartGrouping").GroupConfig} GroupConfig */ /** - * @template T - * @template R - * @typedef {{ config: GroupConfig, name: string, alreadyGrouped: boolean, items: Set> | undefined }} Group + * @typedef {Object} KnownStatsFactoryContext + * @property {string} type + * @property {function(string): string=} makePathsRelative + * @property {Compilation=} compilation + * @property {Set=} rootModules + * @property {Map=} compilationFileToChunks + * @property {Map=} compilationAuxiliaryFileToChunks + * @property {RuntimeSpec=} runtime + * @property {function(Compilation): WebpackError[]=} cachedGetErrors + * @property {function(Compilation): WebpackError[]=} cachedGetWarnings */ -/** - * @template T - * @template R - * @param {T[]} items the list of items - * @param {GroupConfig[]} groupConfigs configuration - * @returns {(R | T)[]} grouped items - */ -const smartGrouping = (items, groupConfigs) => { - /** @type {Set>} */ - const itemsWithGroups = new Set(); - /** @type {Map>} */ - const allGroups = new Map(); - for (const item of items) { - /** @type {Set>} */ - const groups = new Set(); - for (let i = 0; i < groupConfigs.length; i++) { - const groupConfig = groupConfigs[i]; - const keys = groupConfig.getKeys(item); - if (keys) { - for (const name of keys) { - const key = `${i}:${name}`; - let group = allGroups.get(key); - if (group === undefined) { - allGroups.set( - key, - (group = { - config: groupConfig, - name, - alreadyGrouped: false, - items: undefined - }) - ); - } - groups.add(group); - } +/** @typedef {KnownStatsFactoryContext & Record} StatsFactoryContext */ + +class StatsFactory { + constructor() { + this.hooks = Object.freeze({ + /** @type {HookMap>} */ + extract: new HookMap( + () => new SyncBailHook(["object", "data", "context"]) + ), + /** @type {HookMap>} */ + filter: new HookMap( + () => new SyncBailHook(["item", "context", "index", "unfilteredIndex"]) + ), + /** @type {HookMap>} */ + sort: new HookMap(() => new SyncBailHook(["comparators", "context"])), + /** @type {HookMap>} */ + filterSorted: new HookMap( + () => new SyncBailHook(["item", "context", "index", "unfilteredIndex"]) + ), + /** @type {HookMap>} */ + groupResults: new HookMap( + () => new SyncBailHook(["groupConfigs", "context"]) + ), + /** @type {HookMap>} */ + sortResults: new HookMap( + () => new SyncBailHook(["comparators", "context"]) + ), + /** @type {HookMap>} */ + filterResults: new HookMap( + () => new SyncBailHook(["item", "context", "index", "unfilteredIndex"]) + ), + /** @type {HookMap>} */ + merge: new HookMap(() => new SyncBailHook(["items", "context"])), + /** @type {HookMap>} */ + result: new HookMap(() => new SyncWaterfallHook(["result", "context"])), + /** @type {HookMap>} */ + getItemName: new HookMap(() => new SyncBailHook(["item", "context"])), + /** @type {HookMap>} */ + getItemFactory: new HookMap(() => new SyncBailHook(["item", "context"])) + }); + const hooks = this.hooks; + this._caches = + /** @type {Record[]>>} */ ({}); + for (const key of Object.keys(hooks)) { + this._caches[key] = new Map(); + } + this._inCreate = false; + } + + _getAllLevelHooks(hookMap, cache, type) { + const cacheEntry = cache.get(type); + if (cacheEntry !== undefined) { + return cacheEntry; + } + const hooks = []; + const typeParts = type.split("."); + for (let i = 0; i < typeParts.length; i++) { + const hook = hookMap.get(typeParts.slice(i).join(".")); + if (hook) { + hooks.push(hook); } } - itemsWithGroups.add({ - item, - groups + cache.set(type, hooks); + return hooks; + } + + _forEachLevel(hookMap, cache, type, fn) { + for (const hook of this._getAllLevelHooks(hookMap, cache, type)) { + const result = fn(hook); + if (result !== undefined) return result; + } + } + + _forEachLevelWaterfall(hookMap, cache, type, data, fn) { + for (const hook of this._getAllLevelHooks(hookMap, cache, type)) { + data = fn(hook, data); + } + return data; + } + + _forEachLevelFilter(hookMap, cache, type, items, fn, forceClone) { + const hooks = this._getAllLevelHooks(hookMap, cache, type); + if (hooks.length === 0) return forceClone ? items.slice() : items; + let i = 0; + return items.filter((item, idx) => { + for (const hook of hooks) { + const r = fn(hook, item, idx, i); + if (r !== undefined) { + if (r) i++; + return r; + } + } + i++; + return true; }); } + /** - * @param {Set>} itemsWithGroups input items with groups - * @returns {(T | R)[]} groups items + * @param {string} type type + * @param {any} data factory data + * @param {Omit} baseContext context used as base + * @returns {any} created object */ - const runGrouping = itemsWithGroups => { - const totalSize = itemsWithGroups.size; - for (const entry of itemsWithGroups) { - for (const group of entry.groups) { - if (group.alreadyGrouped) continue; - const items = group.items; - if (items === undefined) { - group.items = new Set([entry]); - } else { - items.add(entry); - } - } - } - /** @type {Map, { items: Set>, options: GroupOptions | false | undefined, used: boolean }>} */ - const groupMap = new Map(); - for (const group of allGroups.values()) { - if (group.items) { - const items = group.items; - group.items = undefined; - groupMap.set(group, { - items, - options: undefined, - used: false - }); + create(type, data, baseContext) { + if (this._inCreate) { + return this._create(type, data, baseContext); + } else { + try { + this._inCreate = true; + return this._create(type, data, baseContext); + } finally { + for (const key of Object.keys(this._caches)) this._caches[key].clear(); + this._inCreate = false; } } - /** @type {(T | R)[]} */ - const results = []; - for (;;) { - /** @type {Group} */ - let bestGroup = undefined; - let bestGroupSize = -1; - let bestGroupItems = undefined; - let bestGroupOptions = undefined; - for (const [group, state] of groupMap) { - const { items, used } = state; - let options = state.options; - if (options === undefined) { - const groupConfig = group.config; - state.options = options = - (groupConfig.getOptions && - groupConfig.getOptions( - group.name, - Array.from(items, ({ item }) => item) - )) || - false; - } + } - const force = options && options.force; - if (!force) { - if (bestGroupOptions && bestGroupOptions.force) continue; - if (used) continue; - if (items.size <= 1 || totalSize - items.size <= 1) { - continue; - } - } - const targetGroupCount = (options && options.targetGroupCount) || 4; - let sizeValue = force - ? items.size - : Math.min( - items.size, - (totalSize * 2) / targetGroupCount + - itemsWithGroups.size - - items.size - ); - if ( - sizeValue > bestGroupSize || - (force && (!bestGroupOptions || !bestGroupOptions.force)) - ) { - bestGroup = group; - bestGroupSize = sizeValue; - bestGroupItems = items; - bestGroupOptions = options; - } - } - if (bestGroup === undefined) { - break; + _create(type, data, baseContext) { + const context = { + ...baseContext, + type, + [type]: data + }; + if (Array.isArray(data)) { + // run filter on unsorted items + const items = this._forEachLevelFilter( + this.hooks.filter, + this._caches.filter, + type, + data, + (h, r, idx, i) => h.call(r, context, idx, i), + true + ); + + // sort items + const comparators = []; + this._forEachLevel(this.hooks.sort, this._caches.sort, type, h => + h.call(comparators, context) + ); + if (comparators.length > 0) { + items.sort( + // @ts-expect-error number of arguments is correct + concatComparators(...comparators, keepOriginalOrder(items)) + ); } - const items = new Set(bestGroupItems); - const options = bestGroupOptions; - const groupChildren = !options || options.groupChildren !== false; + // run filter on sorted items + const items2 = this._forEachLevelFilter( + this.hooks.filterSorted, + this._caches.filterSorted, + type, + items, + (h, r, idx, i) => h.call(r, context, idx, i), + false + ); + + // for each item + let resultItems = items2.map((item, i) => { + const itemContext = { + ...context, + _index: i + }; + + // run getItemName + const itemName = this._forEachLevel( + this.hooks.getItemName, + this._caches.getItemName, + `${type}[]`, + h => h.call(item, itemContext) + ); + if (itemName) itemContext[itemName] = item; + const innerType = itemName ? `${type}[].${itemName}` : `${type}[]`; + + // run getItemFactory + const itemFactory = + this._forEachLevel( + this.hooks.getItemFactory, + this._caches.getItemFactory, + innerType, + h => h.call(item, itemContext) + ) || this; + + // run item factory + return itemFactory.create(innerType, item, itemContext); + }); + + // sort result items + const comparators2 = []; + this._forEachLevel( + this.hooks.sortResults, + this._caches.sortResults, + type, + h => h.call(comparators2, context) + ); + if (comparators2.length > 0) { + resultItems.sort( + // @ts-expect-error number of arguments is correct + concatComparators(...comparators2, keepOriginalOrder(resultItems)) + ); + } - for (const item of items) { - itemsWithGroups.delete(item); - // Remove all groups that items have from the map to not select them again - for (const group of item.groups) { - const state = groupMap.get(group); - if (state !== undefined) { - state.items.delete(item); - if (state.items.size === 0) { - groupMap.delete(group); - } else { - state.options = undefined; - if (groupChildren) { - state.used = true; - } - } - } - } + // group result items + const groupConfigs = []; + this._forEachLevel( + this.hooks.groupResults, + this._caches.groupResults, + type, + h => h.call(groupConfigs, context) + ); + if (groupConfigs.length > 0) { + resultItems = smartGrouping(resultItems, groupConfigs); } - groupMap.delete(bestGroup); - const key = bestGroup.name; - const groupConfig = bestGroup.config; + // run filter on sorted result items + const finalResultItems = this._forEachLevelFilter( + this.hooks.filterResults, + this._caches.filterResults, + type, + resultItems, + (h, r, idx, i) => h.call(r, context, idx, i), + false + ); - const allItems = Array.from(items, ({ item }) => item); + // run merge on mapped items + let result = this._forEachLevel( + this.hooks.merge, + this._caches.merge, + type, + h => h.call(finalResultItems, context) + ); + if (result === undefined) result = finalResultItems; - bestGroup.alreadyGrouped = true; - const children = groupChildren ? runGrouping(items) : allItems; - bestGroup.alreadyGrouped = false; + // run result on merged items + return this._forEachLevelWaterfall( + this.hooks.result, + this._caches.result, + type, + result, + (h, r) => h.call(r, context) + ); + } else { + const object = {}; - results.push(groupConfig.createGroup(key, children, allItems)); - } - for (const { item } of itemsWithGroups) { - results.push(item); - } - return results; - }; - return runGrouping(itemsWithGroups); -}; + // run extract on value + this._forEachLevel(this.hooks.extract, this._caches.extract, type, h => + h.call(object, data, context) + ); -module.exports = smartGrouping; + // run result on extracted object + return this._forEachLevelWaterfall( + this.hooks.result, + this._caches.result, + type, + object, + (h, r) => h.call(r, context) + ); + } + } +} +module.exports = StatsFactory; /***/ }), -/***/ 41245: -/***/ (function(__unused_webpack_module, exports) { +/***/ 30198: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -129669,249 +128248,254 @@ module.exports = smartGrouping; -/** @typedef {import("webpack-sources").Source} Source */ +const { HookMap, SyncWaterfallHook, SyncBailHook } = __webpack_require__(41242); -/** @type {WeakMap>} */ -const equalityCache = new WeakMap(); +/** @template T @typedef {import("tapable").AsArray} AsArray */ +/** @typedef {import("tapable").Hook} Hook */ +/** @typedef {import("./DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */ +/** @typedef {import("./DefaultStatsFactoryPlugin").StatsChunk} StatsChunk */ +/** @typedef {import("./DefaultStatsFactoryPlugin").StatsChunkGroup} StatsChunkGroup */ +/** @typedef {import("./DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */ +/** @typedef {import("./DefaultStatsFactoryPlugin").StatsModule} StatsModule */ +/** @typedef {import("./DefaultStatsFactoryPlugin").StatsModuleReason} StatsModuleReason */ /** - * @param {Source} a a source - * @param {Source} b another source - * @returns {boolean} true, when both sources are equal + * @typedef {Object} PrintedElement + * @property {string} element + * @property {string} content */ -const _isSourceEqual = (a, b) => { - // prefer .buffer(), it's called anyway during emit - /** @type {Buffer|string} */ - let aSource = typeof a.buffer === "function" ? a.buffer() : a.source(); - /** @type {Buffer|string} */ - let bSource = typeof b.buffer === "function" ? b.buffer() : b.source(); - if (aSource === bSource) return true; - if (typeof aSource === "string" && typeof bSource === "string") return false; - if (!Buffer.isBuffer(aSource)) aSource = Buffer.from(aSource, "utf-8"); - if (!Buffer.isBuffer(bSource)) bSource = Buffer.from(bSource, "utf-8"); - return aSource.equals(bSource); -}; /** - * @param {Source} a a source - * @param {Source} b another source - * @returns {boolean} true, when both sources are equal + * @typedef {Object} KnownStatsPrinterContext + * @property {string=} type + * @property {StatsCompilation=} compilation + * @property {StatsChunkGroup=} chunkGroup + * @property {StatsAsset=} asset + * @property {StatsModule=} module + * @property {StatsChunk=} chunk + * @property {StatsModuleReason=} moduleReason + * @property {(str: string) => string=} bold + * @property {(str: string) => string=} yellow + * @property {(str: string) => string=} red + * @property {(str: string) => string=} green + * @property {(str: string) => string=} magenta + * @property {(str: string) => string=} cyan + * @property {(file: string, oversize?: boolean) => string=} formatFilename + * @property {(id: string) => string=} formatModuleId + * @property {(id: string, direction?: "parent"|"child"|"sibling") => string=} formatChunkId + * @property {(size: number) => string=} formatSize + * @property {(dateTime: number) => string=} formatDateTime + * @property {(flag: string) => string=} formatFlag + * @property {(time: number, boldQuantity?: boolean) => string=} formatTime + * @property {string=} chunkGroupKind */ -const isSourceEqual = (a, b) => { - if (a === b) return true; - const cache1 = equalityCache.get(a); - if (cache1 !== undefined) { - const result = cache1.get(b); - if (result !== undefined) return result; - } - const result = _isSourceEqual(a, b); - if (cache1 !== undefined) { - cache1.set(b, result); - } else { - const map = new WeakMap(); - map.set(b, result); - equalityCache.set(a, map); - } - const cache2 = equalityCache.get(b); - if (cache2 !== undefined) { - cache2.set(a, result); - } else { - const map = new WeakMap(); - map.set(a, result); - equalityCache.set(b, map); - } - return result; -}; -exports.isSourceEqual = isSourceEqual; - - -/***/ }), -/***/ 12047: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** @typedef {KnownStatsPrinterContext & Record} StatsPrinterContext */ +class StatsPrinter { + constructor() { + this.hooks = Object.freeze({ + /** @type {HookMap>} */ + sortElements: new HookMap( + () => new SyncBailHook(["elements", "context"]) + ), + /** @type {HookMap>} */ + printElements: new HookMap( + () => new SyncBailHook(["printedElements", "context"]) + ), + /** @type {HookMap>} */ + sortItems: new HookMap(() => new SyncBailHook(["items", "context"])), + /** @type {HookMap>} */ + getItemName: new HookMap(() => new SyncBailHook(["item", "context"])), + /** @type {HookMap>} */ + printItems: new HookMap( + () => new SyncBailHook(["printedItems", "context"]) + ), + /** @type {HookMap>} */ + print: new HookMap(() => new SyncBailHook(["object", "context"])), + /** @type {HookMap>} */ + result: new HookMap(() => new SyncWaterfallHook(["result", "context"])) + }); + /** @type {Map, Map>} */ + this._levelHookCache = new Map(); + this._inPrint = false; + } + /** + * get all level hooks + * @private + * @template {Hook} T + * @param {HookMap} hookMap HookMap + * @param {string} type type + * @returns {T[]} hooks + */ + _getAllLevelHooks(hookMap, type) { + let cache = /** @type {Map} */ ( + this._levelHookCache.get(hookMap) + ); + if (cache === undefined) { + cache = new Map(); + this._levelHookCache.set(hookMap, cache); + } + const cacheEntry = cache.get(type); + if (cacheEntry !== undefined) { + return cacheEntry; + } + /** @type {T[]} */ + const hooks = []; + const typeParts = type.split("."); + for (let i = 0; i < typeParts.length; i++) { + const hook = hookMap.get(typeParts.slice(i).join(".")); + if (hook) { + hooks.push(hook); + } + } + cache.set(type, hooks); + return hooks; + } -const { validate } = __webpack_require__(38476); + /** + * Run `fn` for each level + * @private + * @template T + * @template R + * @param {HookMap>} hookMap HookMap + * @param {string} type type + * @param {(hook: SyncBailHook) => R} fn function + * @returns {R} result of `fn` + */ + _forEachLevel(hookMap, type, fn) { + for (const hook of this._getAllLevelHooks(hookMap, type)) { + const result = fn(hook); + if (result !== undefined) return result; + } + } -/* cSpell:disable */ -const DID_YOU_MEAN = { - rules: "module.rules", - loaders: "module.rules or module.rules.*.use", - query: "module.rules.*.options (BREAKING CHANGE since webpack 5)", - noParse: "module.noParse", - filename: "output.filename or module.rules.*.generator.filename", - file: "output.filename", - chunkFilename: "output.chunkFilename", - chunkfilename: "output.chunkFilename", - ecmaVersion: - "output.environment (output.ecmaVersion was a temporary configuration option during webpack 5 beta)", - ecmaversion: - "output.environment (output.ecmaVersion was a temporary configuration option during webpack 5 beta)", - ecma: "output.environment (output.ecmaVersion was a temporary configuration option during webpack 5 beta)", - path: "output.path", - pathinfo: "output.pathinfo", - pathInfo: "output.pathinfo", - jsonpFunction: "output.chunkLoadingGlobal (BREAKING CHANGE since webpack 5)", - chunkCallbackName: - "output.chunkLoadingGlobal (BREAKING CHANGE since webpack 5)", - jsonpScriptType: "output.scriptType (BREAKING CHANGE since webpack 5)", - hotUpdateFunction: "output.hotUpdateGlobal (BREAKING CHANGE since webpack 5)", - splitChunks: "optimization.splitChunks", - immutablePaths: "snapshot.immutablePaths", - managedPaths: "snapshot.managedPaths", - maxModules: "stats.modulesSpace (BREAKING CHANGE since webpack 5)", - hashedModuleIds: - 'optimization.moduleIds: "hashed" (BREAKING CHANGE since webpack 5)', - namedChunks: - 'optimization.chunkIds: "named" (BREAKING CHANGE since webpack 5)', - namedModules: - 'optimization.moduleIds: "named" (BREAKING CHANGE since webpack 5)', - occurrenceOrder: - 'optimization.chunkIds: "size" and optimization.moduleIds: "size" (BREAKING CHANGE since webpack 5)', - automaticNamePrefix: - "optimization.splitChunks.[cacheGroups.*].idHint (BREAKING CHANGE since webpack 5)", - noEmitOnErrors: - "optimization.emitOnErrors (BREAKING CHANGE since webpack 5: logic is inverted to avoid negative flags)", - Buffer: - "to use the ProvidePlugin to process the Buffer variable to modules as polyfill\n" + - "BREAKING CHANGE: webpack 5 no longer provided Node.js polyfills by default.\n" + - "Note: if you are using 'node.Buffer: false', you can just remove that as this is the default behavior now.\n" + - "To provide a polyfill to modules use:\n" + - 'new ProvidePlugin({ Buffer: ["buffer", "Buffer"] }) and npm install buffer.', - process: - "to use the ProvidePlugin to process the process variable to modules as polyfill\n" + - "BREAKING CHANGE: webpack 5 no longer provided Node.js polyfills by default.\n" + - "Note: if you are using 'node.process: false', you can just remove that as this is the default behavior now.\n" + - "To provide a polyfill to modules use:\n" + - 'new ProvidePlugin({ process: "process" }) and npm install buffer.' -}; + /** + * Run `fn` for each level + * @private + * @template T + * @param {HookMap>} hookMap HookMap + * @param {string} type type + * @param {AsArray[0]} data data + * @param {(hook: SyncWaterfallHook, data: AsArray[0]) => AsArray[0]} fn function + * @returns {AsArray[0]} result of `fn` + */ + _forEachLevelWaterfall(hookMap, type, data, fn) { + for (const hook of this._getAllLevelHooks(hookMap, type)) { + data = fn(hook, data); + } + return data; + } -const REMOVED = { - concord: - "BREAKING CHANGE: resolve.concord has been removed and is no longer available.", - devtoolLineToLine: - "BREAKING CHANGE: output.devtoolLineToLine has been removed and is no longer available." -}; -/* cSpell:enable */ + /** + * @param {string} type The type + * @param {Object} object Object to print + * @param {Object=} baseContext The base context + * @returns {string} printed result + */ + print(type, object, baseContext) { + if (this._inPrint) { + return this._print(type, object, baseContext); + } else { + try { + this._inPrint = true; + return this._print(type, object, baseContext); + } finally { + this._levelHookCache.clear(); + this._inPrint = false; + } + } + } -/** - * @param {Parameters[0]} schema a json schema - * @param {Parameters[1]} options the options that should be validated - * @param {Parameters[2]=} validationConfiguration configuration for generating errors - * @returns {void} - */ -const validateSchema = (schema, options, validationConfiguration) => { - validate( - schema, - options, - validationConfiguration || { - name: "Webpack", - postFormatter: (formattedError, error) => { - const children = error.children; - if ( - children && - children.some( - child => - child.keyword === "absolutePath" && - child.dataPath === ".output.filename" - ) - ) { - return `${formattedError}\nPlease use output.path to specify absolute path and output.filename for the file name.`; - } + /** + * @private + * @param {string} type type + * @param {Object} object object + * @param {Object=} baseContext context + * @returns {string} printed result + */ + _print(type, object, baseContext) { + const context = { + ...baseContext, + type, + [type]: object + }; - if ( - children && - children.some( - child => - child.keyword === "pattern" && child.dataPath === ".devtool" - ) - ) { - return ( - `${formattedError}\n` + - "BREAKING CHANGE since webpack 5: The devtool option is more strict.\n" + - "Please strictly follow the order of the keywords in the pattern." + let printResult = this._forEachLevel(this.hooks.print, type, hook => + hook.call(object, context) + ); + if (printResult === undefined) { + if (Array.isArray(object)) { + const sortedItems = object.slice(); + this._forEachLevel(this.hooks.sortItems, type, h => + h.call(sortedItems, context) + ); + const printedItems = sortedItems.map((item, i) => { + const itemContext = { + ...context, + _index: i + }; + const itemName = this._forEachLevel( + this.hooks.getItemName, + `${type}[]`, + h => h.call(item, itemContext) + ); + if (itemName) itemContext[itemName] = item; + return this.print( + itemName ? `${type}[].${itemName}` : `${type}[]`, + item, + itemContext ); + }); + printResult = this._forEachLevel(this.hooks.printItems, type, h => + h.call(printedItems, context) + ); + if (printResult === undefined) { + const result = printedItems.filter(Boolean); + if (result.length > 0) printResult = result.join("\n"); } - - if (error.keyword === "additionalProperties") { - const params = - /** @type {import("ajv").AdditionalPropertiesParams} */ ( - error.params - ); - if ( - Object.prototype.hasOwnProperty.call( - DID_YOU_MEAN, - params.additionalProperty - ) - ) { - return `${formattedError}\nDid you mean ${ - DID_YOU_MEAN[params.additionalProperty] - }?`; - } - - if ( - Object.prototype.hasOwnProperty.call( - REMOVED, - params.additionalProperty - ) - ) { - return `${formattedError}\n${REMOVED[params.additionalProperty]}?`; - } - - if (!error.dataPath) { - if (params.additionalProperty === "debug") { - return ( - `${formattedError}\n` + - "The 'debug' property was removed in webpack 2.0.0.\n" + - "Loaders should be updated to allow passing this option via loader options in module.rules.\n" + - "Until loaders are updated one can use the LoaderOptionsPlugin to switch loaders into debug mode:\n" + - "plugins: [\n" + - " new webpack.LoaderOptionsPlugin({\n" + - " debug: true\n" + - " })\n" + - "]" - ); - } - - if (params.additionalProperty) { - return ( - `${formattedError}\n` + - "For typos: please correct them.\n" + - "For loader options: webpack >= v2.0.0 no longer allows custom properties in configuration.\n" + - " Loaders should be updated to allow passing options via loader options in module.rules.\n" + - " Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:\n" + - " plugins: [\n" + - " new webpack.LoaderOptionsPlugin({\n" + - " // test: /\\.xxx$/, // may apply this only for some modules\n" + - " options: {\n" + - ` ${params.additionalProperty}: …\n` + - " }\n" + - " })\n" + - " ]" - ); - } - } + } else if (object !== null && typeof object === "object") { + const elements = Object.keys(object).filter( + key => object[key] !== undefined + ); + this._forEachLevel(this.hooks.sortElements, type, h => + h.call(elements, context) + ); + const printedElements = elements.map(element => { + const content = this.print(`${type}.${element}`, object[element], { + ...context, + _parent: object, + _element: element, + [element]: object[element] + }); + return { element, content }; + }); + printResult = this._forEachLevel(this.hooks.printElements, type, h => + h.call(printedElements, context) + ); + if (printResult === undefined) { + const result = printedElements.map(e => e.content).filter(Boolean); + if (result.length > 0) printResult = result.join("\n"); } - - return formattedError; } } - ); -}; -module.exports = validateSchema; + + return this._forEachLevelWaterfall( + this.hooks.result, + type, + printResult, + (h, r) => h.call(r, context) + ); + } +} +module.exports = StatsPrinter; /***/ }), -/***/ 5434: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 84953: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* @@ -129921,83 +128505,49 @@ module.exports = validateSchema; -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); - -class AsyncWasmLoadingRuntimeModule extends RuntimeModule { - constructor({ generateLoadBinaryCode, supportsStreaming }) { - super("wasm loading", RuntimeModule.STAGE_NORMAL); - this.generateLoadBinaryCode = generateLoadBinaryCode; - this.supportsStreaming = supportsStreaming; - } +/** + * Compare two arrays or strings by performing strict equality check for each value. + * @template T [T=any] + * @param {ArrayLike} a Array of values to be compared + * @param {ArrayLike} b Array of values to be compared + * @returns {boolean} returns true if all the elements of passed arrays are strictly equal. + */ - /** - * @returns {string} runtime code - */ - generate() { - const { compilation, chunk } = this; - const { outputOptions, runtimeTemplate } = compilation; - const fn = RuntimeGlobals.instantiateWasm; - const wasmModuleSrcPath = compilation.getPath( - JSON.stringify(outputOptions.webassemblyModuleFilename), - { - hash: `" + ${RuntimeGlobals.getFullHash}() + "`, - hashWithLength: length => - `" + ${RuntimeGlobals.getFullHash}}().slice(0, ${length}) + "`, - module: { - id: '" + wasmModuleId + "', - hash: `" + wasmModuleHash + "`, - hashWithLength(length) { - return `" + wasmModuleHash.slice(0, ${length}) + "`; - } - }, - runtime: chunk.runtime - } - ); - return `${fn} = ${runtimeTemplate.basicFunction( - "exports, wasmModuleId, wasmModuleHash, importsObj", - [ - `var req = ${this.generateLoadBinaryCode(wasmModuleSrcPath)};`, - this.supportsStreaming - ? Template.asString([ - "if (typeof WebAssembly.instantiateStreaming === 'function') {", - Template.indent([ - "return WebAssembly.instantiateStreaming(req, importsObj)", - Template.indent([ - `.then(${runtimeTemplate.returningFunction( - "Object.assign(exports, res.instance.exports)", - "res" - )});` - ]) - ]), - "}" - ]) - : "// no support for streaming compilation", - "return req", - Template.indent([ - `.then(${runtimeTemplate.returningFunction("x.arrayBuffer()", "x")})`, - `.then(${runtimeTemplate.returningFunction( - "WebAssembly.instantiate(bytes, importsObj)", - "bytes" - )})`, - `.then(${runtimeTemplate.returningFunction( - "Object.assign(exports, res.instance.exports)", - "res" - )});` - ]) - ] - )};`; +exports.equals = (a, b) => { + if (a.length !== b.length) return false; + for (let i = 0; i < a.length; i++) { + if (a[i] !== b[i]) return false; } -} + return true; +}; -module.exports = AsyncWasmLoadingRuntimeModule; +/** + * Partition an array by calling a predicate function on each value. + * @template T [T=any] + * @param {Array} arr Array of values to be partitioned + * @param {(value: T) => boolean} fn Partition function which partitions based on truthiness of result. + * @returns {[Array, Array]} returns the values of `arr` partitioned into two new arrays based on fn predicate. + */ +exports.groupBy = (arr = [], fn) => { + return arr.reduce( + /** + * @param {[Array, Array]} groups An accumulator storing already partitioned values returned from previous call. + * @param {T} value The value of the current element + * @returns {[Array, Array]} returns an array of partitioned groups accumulator resulting from calling a predicate on the current value. + */ + (groups, value) => { + groups[fn(value) ? 0 : 1].push(value); + return groups; + }, + [[], []] + ); +}; /***/ }), -/***/ 58461: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 41792: +/***/ (function(module) { "use strict"; /* @@ -130007,57 +128557,115 @@ module.exports = AsyncWasmLoadingRuntimeModule; -const Generator = __webpack_require__(93401); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../NormalModule")} NormalModule */ +/** + * @template T + */ +class ArrayQueue { + /** + * @param {Iterable=} items The initial elements. + */ + constructor(items) { + /** @private @type {T[]} */ + this._list = items ? Array.from(items) : []; + /** @private @type {T[]} */ + this._listReversed = []; + } -const TYPES = new Set(["webassembly"]); + /** + * Returns the number of elements in this queue. + * @returns {number} The number of elements in this queue. + */ + get length() { + return this._list.length + this._listReversed.length; + } -class AsyncWebAssemblyGenerator extends Generator { - constructor(options) { - super(); - this.options = options; + /** + * Empties the queue. + */ + clear() { + this._list.length = 0; + this._listReversed.length = 0; } /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) + * Appends the specified element to this queue. + * @param {T} item The element to add. + * @returns {void} */ - getTypes(module) { - return TYPES; + enqueue(item) { + this._list.push(item); } /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module + * Retrieves and removes the head of this queue. + * @returns {T | undefined} The head of the queue of `undefined` if this queue is empty. */ - getSize(module, type) { - const originalSource = module.originalSource(); - if (!originalSource) { - return 0; + dequeue() { + if (this._listReversed.length === 0) { + if (this._list.length === 0) return undefined; + if (this._list.length === 1) return this._list.pop(); + if (this._list.length < 16) return this._list.shift(); + const temp = this._listReversed; + this._listReversed = this._list; + this._listReversed.reverse(); + this._list = temp; } - return originalSource.size(); + return this._listReversed.pop(); } /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code + * Finds and removes an item + * @param {T} item the item + * @returns {void} */ - generate(module, generateContext) { - return module.originalSource(); + delete(item) { + const i = this._list.indexOf(item); + if (i >= 0) { + this._list.splice(i, 1); + } else { + const i = this._listReversed.indexOf(item); + if (i >= 0) this._listReversed.splice(i, 1); + } + } + + [Symbol.iterator]() { + let i = -1; + let reversed = false; + return { + next: () => { + if (!reversed) { + i++; + if (i < this._list.length) { + return { + done: false, + value: this._list[i] + }; + } + reversed = true; + i = this._listReversed.length; + } + i--; + if (i < 0) { + return { + done: true, + value: undefined + }; + } + return { + done: false, + value: this._listReversed[i] + }; + } + }; } } -module.exports = AsyncWebAssemblyGenerator; +module.exports = ArrayQueue; /***/ }), -/***/ 95614: +/***/ 12260: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -130068,404 +128676,377 @@ module.exports = AsyncWebAssemblyGenerator; -const { RawSource } = __webpack_require__(51255); -const Generator = __webpack_require__(93401); -const InitFragment = __webpack_require__(55870); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const WebAssemblyImportDependency = __webpack_require__(5239); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../NormalModule")} NormalModule */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +const { SyncHook, AsyncSeriesHook } = __webpack_require__(41242); +const { makeWebpackError } = __webpack_require__(11351); +const WebpackError = __webpack_require__(53799); +const ArrayQueue = __webpack_require__(41792); -const TYPES = new Set(["webassembly"]); +const QUEUED_STATE = 0; +const PROCESSING_STATE = 1; +const DONE_STATE = 2; -class AsyncWebAssemblyJavascriptGenerator extends Generator { - constructor(filenameTemplate) { - super(); - this.filenameTemplate = filenameTemplate; - } +let inHandleResult = 0; - /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) - */ - getTypes(module) { - return TYPES; - } +/** + * @template T + * @callback Callback + * @param {(WebpackError | null)=} err + * @param {T=} result + */ +/** + * @template T + * @template K + * @template R + */ +class AsyncQueueEntry { /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module + * @param {T} item the item + * @param {Callback} callback the callback */ - getSize(module, type) { - return 40 + module.dependencies.length * 10; + constructor(item, callback) { + this.item = item; + /** @type {typeof QUEUED_STATE | typeof PROCESSING_STATE | typeof DONE_STATE} */ + this.state = QUEUED_STATE; + this.callback = callback; + /** @type {Callback[] | undefined} */ + this.callbacks = undefined; + this.result = undefined; + /** @type {WebpackError | undefined} */ + this.error = undefined; } +} +/** + * @template T + * @template K + * @template R + */ +class AsyncQueue { /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code + * @param {Object} options options object + * @param {string=} options.name name of the queue + * @param {number=} options.parallelism how many items should be processed at once + * @param {AsyncQueue=} options.parent parent queue, which will have priority over this queue and with shared parallelism + * @param {function(T): K=} options.getKey extract key from item + * @param {function(T, Callback): void} options.processor async function to process items */ - generate(module, generateContext) { - const { - runtimeTemplate, - chunkGraph, - moduleGraph, - runtimeRequirements, - runtime - } = generateContext; - runtimeRequirements.add(RuntimeGlobals.module); - runtimeRequirements.add(RuntimeGlobals.moduleId); - runtimeRequirements.add(RuntimeGlobals.exports); - runtimeRequirements.add(RuntimeGlobals.instantiateWasm); - /** @type {InitFragment[]} */ - const initFragments = []; - /** @type {Map} */ - const depModules = new Map(); - /** @type {Map} */ - const wasmDepsByRequest = new Map(); - for (const dep of module.dependencies) { - if (dep instanceof WebAssemblyImportDependency) { - const module = moduleGraph.getModule(dep); - if (!depModules.has(module)) { - depModules.set(module, { - request: dep.request, - importVar: `WEBPACK_IMPORTED_MODULE_${depModules.size}` - }); - } - let list = wasmDepsByRequest.get(dep.request); - if (list === undefined) { - list = []; - wasmDepsByRequest.set(dep.request, list); - } - list.push(dep); + constructor({ name, parallelism, parent, processor, getKey }) { + this._name = name; + this._parallelism = parallelism || 1; + this._processor = processor; + this._getKey = + getKey || /** @type {(T) => K} */ (item => /** @type {any} */ (item)); + /** @type {Map>} */ + this._entries = new Map(); + /** @type {ArrayQueue>} */ + this._queued = new ArrayQueue(); + /** @type {AsyncQueue[]} */ + this._children = undefined; + this._activeTasks = 0; + this._willEnsureProcessing = false; + this._needProcessing = false; + this._stopped = false; + this._root = parent ? parent._root : this; + if (parent) { + if (this._root._children === undefined) { + this._root._children = [this]; + } else { + this._root._children.push(this); } } - const promises = []; - - const importStatements = Array.from( - depModules, - ([importedModule, { request, importVar }]) => { - if (moduleGraph.isAsync(importedModule)) { - promises.push(importVar); - } - return runtimeTemplate.importStatement({ - update: false, - module: importedModule, - chunkGraph, - request, - originModule: module, - importVar, - runtimeRequirements - }); - } - ); - const importsCode = importStatements.map(([x]) => x).join(""); - const importsCompatCode = importStatements.map(([_, x]) => x).join(""); - - const importObjRequestItems = Array.from( - wasmDepsByRequest, - ([request, deps]) => { - const exportItems = deps.map(dep => { - const importedModule = moduleGraph.getModule(dep); - const importVar = depModules.get(importedModule).importVar; - return `${JSON.stringify( - dep.name - )}: ${runtimeTemplate.exportFromImport({ - moduleGraph, - module: importedModule, - request, - exportName: dep.name, - originModule: module, - asiSafe: true, - isCall: false, - callContext: false, - defaultInterop: true, - importVar, - initFragments, - runtime, - runtimeRequirements - })}`; - }); - return Template.asString([ - `${JSON.stringify(request)}: {`, - Template.indent(exportItems.join(",\n")), - "}" - ]); - } - ); - - const importsObj = - importObjRequestItems.length > 0 - ? Template.asString([ - "{", - Template.indent(importObjRequestItems.join(",\n")), - "}" - ]) - : undefined; - - const instantiateCall = - `${RuntimeGlobals.instantiateWasm}(${module.exportsArgument}, ${ - module.moduleArgument - }.id, ${JSON.stringify( - chunkGraph.getRenderedModuleHash(module, runtime) - )}` + (importsObj ? `, ${importsObj})` : `)`); - - if (promises.length > 0) - runtimeRequirements.add(RuntimeGlobals.asyncModule); - - const source = new RawSource( - promises.length > 0 - ? Template.asString([ - `var __webpack_instantiate__ = ${runtimeTemplate.basicFunction( - `[${promises.join(", ")}]`, - `${importsCompatCode}return ${instantiateCall};` - )}`, - `${RuntimeGlobals.asyncModule}(${ - module.moduleArgument - }, async ${runtimeTemplate.basicFunction( - "__webpack_handle_async_dependencies__, __webpack_async_result__", - [ - "try {", - importsCode, - `var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${promises.join( - ", " - )}]);`, - `var [${promises.join( - ", " - )}] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__;`, - `${importsCompatCode}await ${instantiateCall};`, - "__webpack_async_result__();", - "} catch(e) { __webpack_async_result__(e); }" - ] - )}, 1);` - ]) - : `${importsCode}${importsCompatCode}module.exports = ${instantiateCall};` - ); - - return InitFragment.addToSource(source, initFragments, generateContext); - } -} - -module.exports = AsyncWebAssemblyJavascriptGenerator; - - -/***/ }), + this.hooks = { + /** @type {AsyncSeriesHook<[T]>} */ + beforeAdd: new AsyncSeriesHook(["item"]), + /** @type {SyncHook<[T]>} */ + added: new SyncHook(["item"]), + /** @type {AsyncSeriesHook<[T]>} */ + beforeStart: new AsyncSeriesHook(["item"]), + /** @type {SyncHook<[T]>} */ + started: new SyncHook(["item"]), + /** @type {SyncHook<[T, Error, R]>} */ + result: new SyncHook(["item", "error", "result"]) + }; -/***/ 7538: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + this._ensureProcessing = this._ensureProcessing.bind(this); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {T} item an item + * @param {Callback} callback callback function + * @returns {void} + */ + add(item, callback) { + if (this._stopped) return callback(new WebpackError("Queue was stopped")); + this.hooks.beforeAdd.callAsync(item, err => { + if (err) { + callback( + makeWebpackError(err, `AsyncQueue(${this._name}).hooks.beforeAdd`) + ); + return; + } + const key = this._getKey(item); + const entry = this._entries.get(key); + if (entry !== undefined) { + if (entry.state === DONE_STATE) { + if (inHandleResult++ > 3) { + process.nextTick(() => callback(entry.error, entry.result)); + } else { + callback(entry.error, entry.result); + } + inHandleResult--; + } else if (entry.callbacks === undefined) { + entry.callbacks = [callback]; + } else { + entry.callbacks.push(callback); + } + return; + } + const newEntry = new AsyncQueueEntry(item, callback); + if (this._stopped) { + this.hooks.added.call(item); + this._root._activeTasks++; + process.nextTick(() => + this._handleResult(newEntry, new WebpackError("Queue was stopped")) + ); + } else { + this._entries.set(key, newEntry); + this._queued.enqueue(newEntry); + const root = this._root; + root._needProcessing = true; + if (root._willEnsureProcessing === false) { + root._willEnsureProcessing = true; + setImmediate(root._ensureProcessing); + } + this.hooks.added.call(item); + } + }); + } + /** + * @param {T} item an item + * @returns {void} + */ + invalidate(item) { + const key = this._getKey(item); + const entry = this._entries.get(key); + this._entries.delete(key); + if (entry.state === QUEUED_STATE) { + this._queued.delete(entry); + } + } + /** + * Waits for an already started item + * @param {T} item an item + * @param {Callback} callback callback function + * @returns {void} + */ + waitFor(item, callback) { + const key = this._getKey(item); + const entry = this._entries.get(key); + if (entry === undefined) { + return callback( + new WebpackError( + "waitFor can only be called for an already started item" + ) + ); + } + if (entry.state === DONE_STATE) { + process.nextTick(() => callback(entry.error, entry.result)); + } else if (entry.callbacks === undefined) { + entry.callbacks = [callback]; + } else { + entry.callbacks.push(callback); + } + } -const { SyncWaterfallHook } = __webpack_require__(6967); -const Compilation = __webpack_require__(85720); -const Generator = __webpack_require__(93401); -const { tryRunOrWebpackError } = __webpack_require__(11351); -const WebAssemblyImportDependency = __webpack_require__(5239); -const { compareModulesByIdentifier } = __webpack_require__(29579); -const memoize = __webpack_require__(78676); + /** + * @returns {void} + */ + stop() { + this._stopped = true; + const queue = this._queued; + this._queued = new ArrayQueue(); + const root = this._root; + for (const entry of queue) { + this._entries.delete(this._getKey(entry.item)); + root._activeTasks++; + this._handleResult(entry, new WebpackError("Queue was stopped")); + } + } -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../CodeGenerationResults")} CodeGenerationResults */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("../Template").RenderManifestEntry} RenderManifestEntry */ -/** @typedef {import("../Template").RenderManifestOptions} RenderManifestOptions */ + /** + * @returns {void} + */ + increaseParallelism() { + const root = this._root; + root._parallelism++; + /* istanbul ignore next */ + if (root._willEnsureProcessing === false && root._needProcessing) { + root._willEnsureProcessing = true; + setImmediate(root._ensureProcessing); + } + } -const getAsyncWebAssemblyGenerator = memoize(() => - __webpack_require__(58461) -); -const getAsyncWebAssemblyJavascriptGenerator = memoize(() => - __webpack_require__(95614) -); -const getAsyncWebAssemblyParser = memoize(() => - __webpack_require__(96305) -); + /** + * @returns {void} + */ + decreaseParallelism() { + const root = this._root; + root._parallelism--; + } -/** - * @typedef {Object} WebAssemblyRenderContext - * @property {Chunk} chunk the chunk - * @property {DependencyTemplates} dependencyTemplates the dependency templates - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {CodeGenerationResults} codeGenerationResults results of code generation - */ + /** + * @param {T} item an item + * @returns {boolean} true, if the item is currently being processed + */ + isProcessing(item) { + const key = this._getKey(item); + const entry = this._entries.get(key); + return entry !== undefined && entry.state === PROCESSING_STATE; + } -/** - * @typedef {Object} CompilationHooks - * @property {SyncWaterfallHook<[Source, Module, WebAssemblyRenderContext]>} renderModuleContent - */ + /** + * @param {T} item an item + * @returns {boolean} true, if the item is currently queued + */ + isQueued(item) { + const key = this._getKey(item); + const entry = this._entries.get(key); + return entry !== undefined && entry.state === QUEUED_STATE; + } -/** @type {WeakMap} */ -const compilationHooksMap = new WeakMap(); + /** + * @param {T} item an item + * @returns {boolean} true, if the item is currently queued + */ + isDone(item) { + const key = this._getKey(item); + const entry = this._entries.get(key); + return entry !== undefined && entry.state === DONE_STATE; + } -class AsyncWebAssemblyModulesPlugin { /** - * @param {Compilation} compilation the compilation - * @returns {CompilationHooks} the attached hooks + * @returns {void} */ - static getCompilationHooks(compilation) { - if (!(compilation instanceof Compilation)) { - throw new TypeError( - "The 'compilation' argument must be an instance of Compilation" - ); + _ensureProcessing() { + while (this._activeTasks < this._parallelism) { + const entry = this._queued.dequeue(); + if (entry === undefined) break; + this._activeTasks++; + entry.state = PROCESSING_STATE; + this._startProcessing(entry); } - let hooks = compilationHooksMap.get(compilation); - if (hooks === undefined) { - hooks = { - renderModuleContent: new SyncWaterfallHook([ - "source", - "module", - "renderContext" - ]) - }; - compilationHooksMap.set(compilation, hooks); + this._willEnsureProcessing = false; + if (this._queued.length > 0) return; + if (this._children !== undefined) { + for (const child of this._children) { + while (this._activeTasks < this._parallelism) { + const entry = child._queued.dequeue(); + if (entry === undefined) break; + this._activeTasks++; + entry.state = PROCESSING_STATE; + child._startProcessing(entry); + } + if (child._queued.length > 0) return; + } } - return hooks; - } - - constructor(options) { - this.options = options; + if (!this._willEnsureProcessing) this._needProcessing = false; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {AsyncQueueEntry} entry the entry * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap( - "AsyncWebAssemblyModulesPlugin", - (compilation, { normalModuleFactory }) => { - const hooks = - AsyncWebAssemblyModulesPlugin.getCompilationHooks(compilation); - compilation.dependencyFactories.set( - WebAssemblyImportDependency, - normalModuleFactory + _startProcessing(entry) { + this.hooks.beforeStart.callAsync(entry.item, err => { + if (err) { + this._handleResult( + entry, + makeWebpackError(err, `AsyncQueue(${this._name}).hooks.beforeStart`) ); + return; + } + let inCallback = false; + try { + this._processor(entry.item, (e, r) => { + inCallback = true; + this._handleResult(entry, e, r); + }); + } catch (err) { + if (inCallback) throw err; + this._handleResult(entry, err, null); + } + this.hooks.started.call(entry.item); + }); + } - normalModuleFactory.hooks.createParser - .for("webassembly/async") - .tap("AsyncWebAssemblyModulesPlugin", () => { - const AsyncWebAssemblyParser = getAsyncWebAssemblyParser(); - - return new AsyncWebAssemblyParser(); - }); - normalModuleFactory.hooks.createGenerator - .for("webassembly/async") - .tap("AsyncWebAssemblyModulesPlugin", () => { - const AsyncWebAssemblyJavascriptGenerator = - getAsyncWebAssemblyJavascriptGenerator(); - const AsyncWebAssemblyGenerator = getAsyncWebAssemblyGenerator(); - - return Generator.byType({ - javascript: new AsyncWebAssemblyJavascriptGenerator( - compilation.outputOptions.webassemblyModuleFilename - ), - webassembly: new AsyncWebAssemblyGenerator(this.options) - }); - }); + /** + * @param {AsyncQueueEntry} entry the entry + * @param {WebpackError=} err error, if any + * @param {R=} result result, if any + * @returns {void} + */ + _handleResult(entry, err, result) { + this.hooks.result.callAsync(entry.item, err, result, hookError => { + const error = hookError + ? makeWebpackError(hookError, `AsyncQueue(${this._name}).hooks.result`) + : err; - compilation.hooks.renderManifest.tap( - "WebAssemblyModulesPlugin", - (result, options) => { - const { moduleGraph, chunkGraph, runtimeTemplate } = compilation; - const { - chunk, - outputOptions, - dependencyTemplates, - codeGenerationResults - } = options; + const callback = entry.callback; + const callbacks = entry.callbacks; + entry.state = DONE_STATE; + entry.callback = undefined; + entry.callbacks = undefined; + entry.result = result; + entry.error = error; - for (const module of chunkGraph.getOrderedChunkModulesIterable( - chunk, - compareModulesByIdentifier - )) { - if (module.type === "webassembly/async") { - const filenameTemplate = - outputOptions.webassemblyModuleFilename; + const root = this._root; + root._activeTasks--; + if (root._willEnsureProcessing === false && root._needProcessing) { + root._willEnsureProcessing = true; + setImmediate(root._ensureProcessing); + } - result.push({ - render: () => - this.renderModule( - module, - { - chunk, - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - codeGenerationResults - }, - hooks - ), - filenameTemplate, - pathOptions: { - module, - runtime: chunk.runtime, - chunkGraph - }, - auxiliary: true, - identifier: `webassemblyAsyncModule${chunkGraph.getModuleId( - module - )}`, - hash: chunkGraph.getModuleHash(module, chunk.runtime) - }); - } + if (inHandleResult++ > 3) { + process.nextTick(() => { + callback(error, result); + if (callbacks !== undefined) { + for (const callback of callbacks) { + callback(error, result); } - - return result; } - ); + }); + } else { + callback(error, result); + if (callbacks !== undefined) { + for (const callback of callbacks) { + callback(error, result); + } + } } - ); + inHandleResult--; + }); } - renderModule(module, renderContext, hooks) { - const { codeGenerationResults, chunk } = renderContext; - try { - const moduleSource = codeGenerationResults.getSource( - module, - chunk.runtime, - "webassembly" - ); - return tryRunOrWebpackError( - () => - hooks.renderModuleContent.call(moduleSource, module, renderContext), - "AsyncWebAssemblyModulesPlugin.getCompilationHooks().renderModuleContent" - ); - } catch (e) { - e.module = module; - throw e; - } + clear() { + this._entries.clear(); + this._queued.clear(); + this._activeTasks = 0; + this._willEnsureProcessing = false; + this._needProcessing = false; + this._stopped = false; } } -module.exports = AsyncWebAssemblyModulesPlugin; +module.exports = AsyncQueue; /***/ }), -/***/ 96305: +/***/ 36692: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -130476,573 +129057,337 @@ module.exports = AsyncWebAssemblyModulesPlugin; -const t = __webpack_require__(51826); -const { decode } = __webpack_require__(73726); -const Parser = __webpack_require__(11715); -const StaticExportsDependency = __webpack_require__(91418); -const WebAssemblyImportDependency = __webpack_require__(5239); - -/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ - -const decoderOpts = { - ignoreCodeSection: true, - ignoreDataSection: true, - - // this will avoid having to lookup with identifiers in the ModuleContext - ignoreCustomNameSection: true -}; - -class WebAssemblyParser extends Parser { - constructor(options) { - super(); - this.hooks = Object.freeze({}); - this.options = options; +class Hash { + /* istanbul ignore next */ + /** + * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} + * @abstract + * @param {string|Buffer} data data + * @param {string=} inputEncoding data encoding + * @returns {this} updated hash + */ + update(data, inputEncoding) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } + /* istanbul ignore next */ /** - * @param {string | Buffer | PreparsedAst} source the source to parse - * @param {ParserState} state the parser state - * @returns {ParserState} the parser state + * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} + * @abstract + * @param {string=} encoding encoding of the return value + * @returns {string|Buffer} digest */ - parse(source, state) { - if (!Buffer.isBuffer(source)) { - throw new Error("WebAssemblyParser input must be a Buffer"); - } - - // flag it as async module - state.module.buildInfo.strict = true; - state.module.buildMeta.exportsType = "namespace"; - state.module.buildMeta.async = true; - - // parse it - const program = decode(source, decoderOpts); - const module = program.body[0]; - - const exports = []; - t.traverse(module, { - ModuleExport({ node }) { - exports.push(node.name); - }, - - ModuleImport({ node }) { - const dep = new WebAssemblyImportDependency( - node.module, - node.name, - node.descr, - false - ); - - state.module.addDependency(dep); - } - }); - - state.module.addDependency(new StaticExportsDependency(exports, false)); - - return state; + digest(encoding) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } } -module.exports = WebAssemblyParser; +module.exports = Hash; /***/ }), -/***/ 78455: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 39104: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const WebpackError = __webpack_require__(53799); +/** + * @template T + * @param {Iterable} set a set + * @returns {T | undefined} last item + */ +const last = set => { + let last; + for (const item of set) last = item; + return last; +}; -module.exports = class UnsupportedWebAssemblyFeatureError extends WebpackError { - /** @param {string} message Error message */ - constructor(message) { - super(message); - this.name = "UnsupportedWebAssemblyFeatureError"; - this.hideStack = true; +/** + * @template T + * @param {Iterable} iterable iterable + * @param {function(T): boolean} filter predicate + * @returns {boolean} true, if some items match the filter predicate + */ +const someInIterable = (iterable, filter) => { + for (const item of iterable) { + if (filter(item)) return true; } + return false; }; +/** + * @template T + * @param {Iterable} iterable an iterable + * @returns {number} count of items + */ +const countIterable = iterable => { + let i = 0; + // eslint-disable-next-line no-unused-vars + for (const _ of iterable) i++; + return i; +}; + +exports.last = last; +exports.someInIterable = someInIterable; +exports.countIterable = countIterable; + /***/ }), -/***/ 87394: +/***/ 48424: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); -const { compareModulesByIdentifier } = __webpack_require__(29579); -const WebAssemblyUtils = __webpack_require__(18650); - -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - -// TODO webpack 6 remove the whole folder - -// Get all wasm modules -const getAllWasmModules = (moduleGraph, chunkGraph, chunk) => { - const wasmModules = chunk.getAllAsyncChunks(); - const array = []; - for (const chunk of wasmModules) { - for (const m of chunkGraph.getOrderedChunkModulesIterable( - chunk, - compareModulesByIdentifier - )) { - if (m.type.startsWith("webassembly")) { - array.push(m); - } - } - } - - return array; -}; +const { first } = __webpack_require__(93347); +const SortableSet = __webpack_require__(13098); /** - * generates the import object function for a module - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {Module} module the module - * @param {boolean} mangle mangle imports - * @param {string[]} declarations array where declarations are pushed to - * @param {RuntimeSpec} runtime the runtime - * @returns {string} source code + * Multi layer bucket sorted set: + * Supports adding non-existing items (DO NOT ADD ITEM TWICE), + * Supports removing exiting items (DO NOT REMOVE ITEM NOT IN SET), + * Supports popping the first items according to defined order, + * Supports iterating all items without order, + * Supports updating an item in an efficient way, + * Supports size property, which is the number of items, + * Items are lazy partially sorted when needed + * @template T + * @template K */ -const generateImportObject = ( - chunkGraph, - module, - mangle, - declarations, - runtime -) => { - const moduleGraph = chunkGraph.moduleGraph; - const waitForInstances = new Map(); - const properties = []; - const usedWasmDependencies = WebAssemblyUtils.getUsedDependencies( - moduleGraph, - module, - mangle - ); - for (const usedDep of usedWasmDependencies) { - const dep = usedDep.dependency; - const importedModule = moduleGraph.getModule(dep); - const exportName = dep.name; - const usedName = - importedModule && - moduleGraph - .getExportsInfo(importedModule) - .getUsedName(exportName, runtime); - const description = dep.description; - const direct = dep.onlyDirectImport; - - const module = usedDep.module; - const name = usedDep.name; - - if (direct) { - const instanceVar = `m${waitForInstances.size}`; - waitForInstances.set(instanceVar, chunkGraph.getModuleId(importedModule)); - properties.push({ - module, - name, - value: `${instanceVar}[${JSON.stringify(usedName)}]` - }); - } else { - const params = description.signature.params.map( - (param, k) => "p" + k + param.valtype - ); - - const mod = `${RuntimeGlobals.moduleCache}[${JSON.stringify( - chunkGraph.getModuleId(importedModule) - )}]`; - const modExports = `${mod}.exports`; +class LazyBucketSortedSet { + /** + * @param {function(T): K} getKey function to get key from item + * @param {function(K, K): number} comparator comparator to sort keys + * @param {...((function(T): any) | (function(any, any): number))} args more pairs of getKey and comparator plus optional final comparator for the last layer + */ + constructor(getKey, comparator, ...args) { + this._getKey = getKey; + this._innerArgs = args; + this._leaf = args.length <= 1; + this._keys = new SortableSet(undefined, comparator); + /** @type {Map | SortableSet>} */ + this._map = new Map(); + this._unsortedItems = new Set(); + this.size = 0; + } - const cache = `wasmImportedFuncCache${declarations.length}`; - declarations.push(`var ${cache};`); + /** + * @param {T} item an item + * @returns {void} + */ + add(item) { + this.size++; + this._unsortedItems.add(item); + } - properties.push({ - module, - name, - value: Template.asString([ - (importedModule.type.startsWith("webassembly") - ? `${mod} ? ${modExports}[${JSON.stringify(usedName)}] : ` - : "") + `function(${params}) {`, - Template.indent([ - `if(${cache} === undefined) ${cache} = ${modExports};`, - `return ${cache}[${JSON.stringify(usedName)}](${params});` - ]), - "}" - ]) - }); + /** + * @param {K} key key of item + * @param {T} item the item + * @returns {void} + */ + _addInternal(key, item) { + let entry = this._map.get(key); + if (entry === undefined) { + entry = this._leaf + ? new SortableSet(undefined, this._innerArgs[0]) + : new /** @type {any} */ (LazyBucketSortedSet)(...this._innerArgs); + this._keys.add(key); + this._map.set(key, entry); } + entry.add(item); } - let importObject; - if (mangle) { - importObject = [ - "return {", - Template.indent([ - properties.map(p => `${JSON.stringify(p.name)}: ${p.value}`).join(",\n") - ]), - "};" - ]; - } else { - const propertiesByModule = new Map(); - for (const p of properties) { - let list = propertiesByModule.get(p.module); - if (list === undefined) { - propertiesByModule.set(p.module, (list = [])); - } - list.push(p); + /** + * @param {T} item an item + * @returns {void} + */ + delete(item) { + this.size--; + if (this._unsortedItems.has(item)) { + this._unsortedItems.delete(item); + return; + } + const key = this._getKey(item); + const entry = this._map.get(key); + entry.delete(item); + if (entry.size === 0) { + this._deleteKey(key); } - importObject = [ - "return {", - Template.indent([ - Array.from(propertiesByModule, ([module, list]) => { - return Template.asString([ - `${JSON.stringify(module)}: {`, - Template.indent([ - list.map(p => `${JSON.stringify(p.name)}: ${p.value}`).join(",\n") - ]), - "}" - ]); - }).join(",\n") - ]), - "};" - ]; } - const moduleIdStringified = JSON.stringify(chunkGraph.getModuleId(module)); - if (waitForInstances.size === 1) { - const moduleId = Array.from(waitForInstances.values())[0]; - const promise = `installedWasmModules[${JSON.stringify(moduleId)}]`; - const variable = Array.from(waitForInstances.keys())[0]; - return Template.asString([ - `${moduleIdStringified}: function() {`, - Template.indent([ - `return promiseResolve().then(function() { return ${promise}; }).then(function(${variable}) {`, - Template.indent(importObject), - "});" - ]), - "}," - ]); - } else if (waitForInstances.size > 0) { - const promises = Array.from( - waitForInstances.values(), - id => `installedWasmModules[${JSON.stringify(id)}]` - ).join(", "); - const variables = Array.from( - waitForInstances.keys(), - (name, i) => `${name} = array[${i}]` - ).join(", "); - return Template.asString([ - `${moduleIdStringified}: function() {`, - Template.indent([ - `return promiseResolve().then(function() { return Promise.all([${promises}]); }).then(function(array) {`, - Template.indent([`var ${variables};`, ...importObject]), - "});" - ]), - "}," - ]); - } else { - return Template.asString([ - `${moduleIdStringified}: function() {`, - Template.indent(importObject), - "}," - ]); + /** + * @param {K} key key to be removed + * @returns {void} + */ + _deleteKey(key) { + this._keys.delete(key); + this._map.delete(key); } -}; -class WasmChunkLoadingRuntimeModule extends RuntimeModule { - constructor({ - generateLoadBinaryCode, - supportsStreaming, - mangleImports, - runtimeRequirements - }) { - super("wasm chunk loading", RuntimeModule.STAGE_ATTACH); - this.generateLoadBinaryCode = generateLoadBinaryCode; - this.supportsStreaming = supportsStreaming; - this.mangleImports = mangleImports; - this._runtimeRequirements = runtimeRequirements; + /** + * @returns {T | undefined} an item + */ + popFirst() { + if (this.size === 0) return undefined; + this.size--; + if (this._unsortedItems.size > 0) { + for (const item of this._unsortedItems) { + const key = this._getKey(item); + this._addInternal(key, item); + } + this._unsortedItems.clear(); + } + this._keys.sort(); + const key = first(this._keys); + const entry = this._map.get(key); + if (this._leaf) { + const leafEntry = /** @type {SortableSet} */ (entry); + leafEntry.sort(); + const item = first(leafEntry); + leafEntry.delete(item); + if (leafEntry.size === 0) { + this._deleteKey(key); + } + return item; + } else { + const nodeEntry = /** @type {LazyBucketSortedSet} */ (entry); + const item = nodeEntry.popFirst(); + if (nodeEntry.size === 0) { + this._deleteKey(key); + } + return item; + } } /** - * @returns {string} runtime code + * @param {T} item to be updated item + * @returns {function(true=): void} finish update */ - generate() { - const { chunkGraph, compilation, chunk, mangleImports } = this; - const { moduleGraph, outputOptions } = compilation; - const fn = RuntimeGlobals.ensureChunkHandlers; - const withHmr = this._runtimeRequirements.has( - RuntimeGlobals.hmrDownloadUpdateHandlers - ); - const wasmModules = getAllWasmModules(moduleGraph, chunkGraph, chunk); - const declarations = []; - const importObjects = wasmModules.map(module => { - return generateImportObject( - chunkGraph, - module, - this.mangleImports, - declarations, - chunk.runtime - ); - }); - const chunkModuleIdMap = chunkGraph.getChunkModuleIdMap(chunk, m => - m.type.startsWith("webassembly") - ); - const createImportObject = content => - mangleImports - ? `{ ${JSON.stringify(WebAssemblyUtils.MANGLED_MODULE)}: ${content} }` - : content; - const wasmModuleSrcPath = compilation.getPath( - JSON.stringify(outputOptions.webassemblyModuleFilename), - { - hash: `" + ${RuntimeGlobals.getFullHash}() + "`, - hashWithLength: length => - `" + ${RuntimeGlobals.getFullHash}}().slice(0, ${length}) + "`, - module: { - id: '" + wasmModuleId + "', - hash: `" + ${JSON.stringify( - chunkGraph.getChunkModuleRenderedHashMap(chunk, m => - m.type.startsWith("webassembly") - ) - )}[chunkId][wasmModuleId] + "`, - hashWithLength(length) { - return `" + ${JSON.stringify( - chunkGraph.getChunkModuleRenderedHashMap( - chunk, - m => m.type.startsWith("webassembly"), - length - ) - )}[chunkId][wasmModuleId] + "`; + startUpdate(item) { + if (this._unsortedItems.has(item)) { + return remove => { + if (remove) { + this._unsortedItems.delete(item); + this.size--; + return; + } + }; + } + const key = this._getKey(item); + if (this._leaf) { + const oldEntry = /** @type {SortableSet} */ (this._map.get(key)); + return remove => { + if (remove) { + this.size--; + oldEntry.delete(item); + if (oldEntry.size === 0) { + this._deleteKey(key); } - }, - runtime: chunk.runtime - } - ); - - const stateExpression = withHmr - ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_wasm` - : undefined; - - return Template.asString([ - "// object to store loaded and loading wasm modules", - `var installedWasmModules = ${ - stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" - }{};`, - "", - // This function is used to delay reading the installed wasm module promises - // by a microtask. Sorting them doesn't help because there are edge cases where - // sorting is not possible (modules splitted into different chunks). - // So we not even trying and solve this by a microtask delay. - "function promiseResolve() { return Promise.resolve(); }", - "", - Template.asString(declarations), - "var wasmImportObjects = {", - Template.indent(importObjects), - "};", - "", - `var wasmModuleMap = ${JSON.stringify( - chunkModuleIdMap, - undefined, - "\t" - )};`, - "", - "// object with all WebAssembly.instance exports", - `${RuntimeGlobals.wasmInstances} = {};`, - "", - "// Fetch + compile chunk loading for webassembly", - `${fn}.wasm = function(chunkId, promises) {`, - Template.indent([ - "", - `var wasmModules = wasmModuleMap[chunkId] || [];`, - "", - "wasmModules.forEach(function(wasmModuleId, idx) {", - Template.indent([ - "var installedWasmModuleData = installedWasmModules[wasmModuleId];", - "", - '// a Promise means "currently loading" or "already loaded".', - "if(installedWasmModuleData)", - Template.indent(["promises.push(installedWasmModuleData);"]), - "else {", - Template.indent([ - `var importObject = wasmImportObjects[wasmModuleId]();`, - `var req = ${this.generateLoadBinaryCode(wasmModuleSrcPath)};`, - "var promise;", - this.supportsStreaming - ? Template.asString([ - "if(importObject && typeof importObject.then === 'function' && typeof WebAssembly.compileStreaming === 'function') {", - Template.indent([ - "promise = Promise.all([WebAssembly.compileStreaming(req), importObject]).then(function(items) {", - Template.indent([ - `return WebAssembly.instantiate(items[0], ${createImportObject( - "items[1]" - )});` - ]), - "});" - ]), - "} else if(typeof WebAssembly.instantiateStreaming === 'function') {", - Template.indent([ - `promise = WebAssembly.instantiateStreaming(req, ${createImportObject( - "importObject" - )});` - ]) - ]) - : Template.asString([ - "if(importObject && typeof importObject.then === 'function') {", - Template.indent([ - "var bytesPromise = req.then(function(x) { return x.arrayBuffer(); });", - "promise = Promise.all([", - Template.indent([ - "bytesPromise.then(function(bytes) { return WebAssembly.compile(bytes); }),", - "importObject" - ]), - "]).then(function(items) {", - Template.indent([ - `return WebAssembly.instantiate(items[0], ${createImportObject( - "items[1]" - )});` - ]), - "});" - ]) - ]), - "} else {", - Template.indent([ - "var bytesPromise = req.then(function(x) { return x.arrayBuffer(); });", - "promise = bytesPromise.then(function(bytes) {", - Template.indent([ - `return WebAssembly.instantiate(bytes, ${createImportObject( - "importObject" - )});` - ]), - "});" - ]), - "}", - "promises.push(installedWasmModules[wasmModuleId] = promise.then(function(res) {", - Template.indent([ - `return ${RuntimeGlobals.wasmInstances}[wasmModuleId] = (res.instance || res).exports;` - ]), - "}));" - ]), - "}" - ]), - "});" - ]), - "};" - ]); + return; + } + const newKey = this._getKey(item); + if (key === newKey) { + // This flags the sortable set as unordered + oldEntry.add(item); + } else { + oldEntry.delete(item); + if (oldEntry.size === 0) { + this._deleteKey(key); + } + this._addInternal(newKey, item); + } + }; + } else { + const oldEntry = /** @type {LazyBucketSortedSet} */ ( + this._map.get(key) + ); + const finishUpdate = oldEntry.startUpdate(item); + return remove => { + if (remove) { + this.size--; + finishUpdate(true); + if (oldEntry.size === 0) { + this._deleteKey(key); + } + return; + } + const newKey = this._getKey(item); + if (key === newKey) { + finishUpdate(); + } else { + finishUpdate(true); + if (oldEntry.size === 0) { + this._deleteKey(key); + } + this._addInternal(newKey, item); + } + }; + } } -} - -module.exports = WasmChunkLoadingRuntimeModule; - - -/***/ }), - -/***/ 19810: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const formatLocation = __webpack_require__(16734); -const UnsupportedWebAssemblyFeatureError = __webpack_require__(78455); - -/** @typedef {import("../Compiler")} Compiler */ - -class WasmFinalizeExportsPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {Iterator[]} iterators list of iterators to append to * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap("WasmFinalizeExportsPlugin", compilation => { - compilation.hooks.finishModules.tap( - "WasmFinalizeExportsPlugin", - modules => { - for (const module of modules) { - // 1. if a WebAssembly module - if (module.type.startsWith("webassembly") === true) { - const jsIncompatibleExports = - module.buildMeta.jsIncompatibleExports; - - if (jsIncompatibleExports === undefined) { - continue; - } - - for (const connection of compilation.moduleGraph.getIncomingConnections( - module - )) { - // 2. is active and referenced by a non-WebAssembly module - if ( - connection.isTargetActive(undefined) && - connection.originModule.type.startsWith("webassembly") === - false - ) { - const referencedExports = - compilation.getDependencyReferencedExports( - connection.dependency, - undefined - ); + _appendIterators(iterators) { + if (this._unsortedItems.size > 0) + iterators.push(this._unsortedItems[Symbol.iterator]()); + for (const key of this._keys) { + const entry = this._map.get(key); + if (this._leaf) { + const leafEntry = /** @type {SortableSet} */ (entry); + const iterator = leafEntry[Symbol.iterator](); + iterators.push(iterator); + } else { + const nodeEntry = /** @type {LazyBucketSortedSet} */ (entry); + nodeEntry._appendIterators(iterators); + } + } + } - for (const info of referencedExports) { - const names = Array.isArray(info) ? info : info.name; - if (names.length === 0) continue; - const name = names[0]; - if (typeof name === "object") continue; - // 3. and uses a func with an incompatible JS signature - if ( - Object.prototype.hasOwnProperty.call( - jsIncompatibleExports, - name - ) - ) { - // 4. error - const error = new UnsupportedWebAssemblyFeatureError( - `Export "${name}" with ${jsIncompatibleExports[name]} can only be used for direct wasm to wasm dependencies\n` + - `It's used from ${connection.originModule.readableIdentifier( - compilation.requestShortener - )} at ${formatLocation(connection.dependency.loc)}.` - ); - error.module = module; - compilation.errors.push(error); - } - } - } - } - } - } + /** + * @returns {Iterator} the iterator + */ + [Symbol.iterator]() { + const iterators = []; + this._appendIterators(iterators); + iterators.reverse(); + let currentIterator = iterators.pop(); + return { + next: () => { + const res = currentIterator.next(); + if (res.done) { + if (iterators.length === 0) return res; + currentIterator = iterators.pop(); + return currentIterator.next(); } - ); - }); + return res; + } + }; } } -module.exports = WasmFinalizeExportsPlugin; +module.exports = LazyBucketSortedSet; /***/ }), -/***/ 47012: +/***/ 38938: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -131053,620 +129398,471 @@ module.exports = WasmFinalizeExportsPlugin; -const { RawSource } = __webpack_require__(51255); -const Generator = __webpack_require__(93401); -const WebAssemblyUtils = __webpack_require__(18650); - -const t = __webpack_require__(51826); -const { moduleContextFromModuleAST } = __webpack_require__(51826); -const { editWithAST, addWithAST } = __webpack_require__(87362); -const { decode } = __webpack_require__(73726); - -const WebAssemblyExportImportedDependency = __webpack_require__(52204); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../NormalModule")} NormalModule */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -/** @typedef {import("./WebAssemblyUtils").UsedWasmDependency} UsedWasmDependency */ - -/** - * @typedef {(ArrayBuffer) => ArrayBuffer} ArrayBufferTransform - */ +const makeSerializable = __webpack_require__(33032); /** * @template T - * @param {Function[]} fns transforms - * @returns {Function} composed transform - */ -const compose = (...fns) => { - return fns.reduce( - (prevFn, nextFn) => { - return value => nextFn(prevFn(value)); - }, - value => value - ); -}; - -/** - * Removes the start instruction - * - * @param {Object} state unused state - * @returns {ArrayBufferTransform} transform - */ -const removeStartFunc = state => bin => { - return editWithAST(state.ast, bin, { - Start(path) { - path.remove(); - } - }); -}; - -/** - * Get imported globals - * - * @param {Object} ast Module's AST - * @returns {Array} - nodes + * @param {Set} targetSet set where items should be added + * @param {Set>} toMerge iterables to be merged + * @returns {void} */ -const getImportedGlobals = ast => { - const importedGlobals = []; - - t.traverse(ast, { - ModuleImport({ node }) { - if (t.isGlobalType(node.descr)) { - importedGlobals.push(node); - } +const merge = (targetSet, toMerge) => { + for (const set of toMerge) { + for (const item of set) { + targetSet.add(item); } - }); - - return importedGlobals; + } }; /** - * Get the count for imported func - * - * @param {Object} ast Module's AST - * @returns {Number} - count + * @template T + * @param {Set>} targetSet set where iterables should be added + * @param {Array>} toDeepMerge lazy sets to be flattened + * @returns {void} */ -const getCountImportedFunc = ast => { - let count = 0; - - t.traverse(ast, { - ModuleImport({ node }) { - if (t.isFuncImportDescr(node.descr)) { - count++; +const flatten = (targetSet, toDeepMerge) => { + for (const set of toDeepMerge) { + if (set._set.size > 0) targetSet.add(set._set); + if (set._needMerge) { + for (const mergedSet of set._toMerge) { + targetSet.add(mergedSet); } + flatten(targetSet, set._toDeepMerge); } - }); - - return count; -}; - -/** - * Get next type index - * - * @param {Object} ast Module's AST - * @returns {t.Index} - index - */ -const getNextTypeIndex = ast => { - const typeSectionMetadata = t.getSectionMetadata(ast, "type"); - - if (typeSectionMetadata === undefined) { - return t.indexLiteral(0); } - - return t.indexLiteral(typeSectionMetadata.vectorOfSize.value); }; /** - * Get next func index - * - * The Func section metadata provide informations for implemented funcs - * in order to have the correct index we shift the index by number of external - * functions. - * - * @param {Object} ast Module's AST - * @param {Number} countImportedFunc number of imported funcs - * @returns {t.Index} - index + * Like Set but with an addAll method to eventually add items from another iterable. + * Access methods make sure that all delayed operations are executed. + * Iteration methods deopts to normal Set performance until clear is called again (because of the chance of modifications during iteration). + * @template T */ -const getNextFuncIndex = (ast, countImportedFunc) => { - const funcSectionMetadata = t.getSectionMetadata(ast, "func"); - - if (funcSectionMetadata === undefined) { - return t.indexLiteral(0 + countImportedFunc); +class LazySet { + /** + * @param {Iterable=} iterable init iterable + */ + constructor(iterable) { + /** @type {Set} */ + this._set = new Set(iterable); + /** @type {Set>} */ + this._toMerge = new Set(); + /** @type {Array>} */ + this._toDeepMerge = []; + this._needMerge = false; + this._deopt = false; } - const vectorOfSize = funcSectionMetadata.vectorOfSize.value; - - return t.indexLiteral(vectorOfSize + countImportedFunc); -}; - -/** - * Creates an init instruction for a global type - * @param {t.GlobalType} globalType the global type - * @returns {t.Instruction} init expression - */ -const createDefaultInitForGlobal = globalType => { - if (globalType.valtype[0] === "i") { - // create NumberLiteral global initializer - return t.objectInstruction("const", globalType.valtype, [ - t.numberLiteralFromRaw(66) - ]); - } else if (globalType.valtype[0] === "f") { - // create FloatLiteral global initializer - return t.objectInstruction("const", globalType.valtype, [ - t.floatLiteral(66, false, false, "66") - ]); - } else { - throw new Error("unknown type: " + globalType.valtype); + _flatten() { + flatten(this._toMerge, this._toDeepMerge); + this._toDeepMerge.length = 0; } -}; - -/** - * Rewrite the import globals: - * - removes the ModuleImport instruction - * - injects at the same offset a mutable global of the same type - * - * Since the imported globals are before the other global declarations, our - * indices will be preserved. - * - * Note that globals will become mutable. - * - * @param {Object} state unused state - * @returns {ArrayBufferTransform} transform - */ -const rewriteImportedGlobals = state => bin => { - const additionalInitCode = state.additionalInitCode; - const newGlobals = []; - bin = editWithAST(state.ast, bin, { - ModuleImport(path) { - if (t.isGlobalType(path.node.descr)) { - const globalType = path.node.descr; + _merge() { + this._flatten(); + merge(this._set, this._toMerge); + this._toMerge.clear(); + this._needMerge = false; + } - globalType.mutability = "var"; + _isEmpty() { + return ( + this._set.size === 0 && + this._toMerge.size === 0 && + this._toDeepMerge.length === 0 + ); + } - const init = [ - createDefaultInitForGlobal(globalType), - t.instruction("end") - ]; + get size() { + if (this._needMerge) this._merge(); + return this._set.size; + } - newGlobals.push(t.global(globalType, init)); + /** + * @param {T} item an item + * @returns {this} itself + */ + add(item) { + this._set.add(item); + return this; + } - path.remove(); + /** + * @param {Iterable | LazySet} iterable a immutable iterable or another immutable LazySet which will eventually be merged into the Set + * @returns {this} itself + */ + addAll(iterable) { + if (this._deopt) { + const _set = this._set; + for (const item of iterable) { + _set.add(item); } - }, - - // in order to preserve non-imported global's order we need to re-inject - // those as well - Global(path) { - const { node } = path; - const [init] = node.init; - - if (init.id === "get_global") { - node.globalType.mutability = "var"; - - const initialGlobalIdx = init.args[0]; - - node.init = [ - createDefaultInitForGlobal(node.globalType), - t.instruction("end") - ]; - - additionalInitCode.push( - /** - * get_global in global initializer only works for imported globals. - * They have the same indices as the init params, so use the - * same index. - */ - t.instruction("get_local", [initialGlobalIdx]), - t.instruction("set_global", [t.indexLiteral(newGlobals.length)]) - ); + } else { + if (iterable instanceof LazySet) { + if (iterable._isEmpty()) return this; + this._toDeepMerge.push(iterable); + this._needMerge = true; + if (this._toDeepMerge.length > 100000) { + this._flatten(); + } + } else { + this._toMerge.add(iterable); + this._needMerge = true; } - - newGlobals.push(node); - - path.remove(); + if (this._toMerge.size > 100000) this._merge(); } - }); + return this; + } - // Add global declaration instructions - return addWithAST(state.ast, bin, newGlobals); -}; + clear() { + this._set.clear(); + this._toMerge.clear(); + this._toDeepMerge.length = 0; + this._needMerge = false; + this._deopt = false; + } -/** - * Rewrite the export names - * @param {Object} state state - * @param {Object} state.ast Module's ast - * @param {Module} state.module Module - * @param {ModuleGraph} state.moduleGraph module graph - * @param {Set} state.externalExports Module - * @param {RuntimeSpec} state.runtime runtime - * @returns {ArrayBufferTransform} transform - */ -const rewriteExportNames = - ({ ast, moduleGraph, module, externalExports, runtime }) => - bin => { - return editWithAST(ast, bin, { - ModuleExport(path) { - const isExternal = externalExports.has(path.node.name); - if (isExternal) { - path.remove(); - return; - } - const usedName = moduleGraph - .getExportsInfo(module) - .getUsedName(path.node.name, runtime); - if (!usedName) { - path.remove(); - return; - } - path.node.name = usedName; - } - }); - }; + /** + * @param {T} value an item + * @returns {boolean} true, if the value was in the Set before + */ + delete(value) { + if (this._needMerge) this._merge(); + return this._set.delete(value); + } -/** - * Mangle import names and modules - * @param {Object} state state - * @param {Object} state.ast Module's ast - * @param {Map} state.usedDependencyMap mappings to mangle names - * @returns {ArrayBufferTransform} transform - */ -const rewriteImports = - ({ ast, usedDependencyMap }) => - bin => { - return editWithAST(ast, bin, { - ModuleImport(path) { - const result = usedDependencyMap.get( - path.node.module + ":" + path.node.name - ); + entries() { + this._deopt = true; + if (this._needMerge) this._merge(); + return this._set.entries(); + } + + /** + * @param {function(T, T, Set): void} callbackFn function called for each entry + * @param {any} thisArg this argument for the callbackFn + * @returns {void} + */ + forEach(callbackFn, thisArg) { + this._deopt = true; + if (this._needMerge) this._merge(); + this._set.forEach(callbackFn, thisArg); + } - if (result !== undefined) { - path.node.module = result.module; - path.node.name = result.name; - } - } - }); - }; + /** + * @param {T} item an item + * @returns {boolean} true, when the item is in the Set + */ + has(item) { + if (this._needMerge) this._merge(); + return this._set.has(item); + } -/** - * Add an init function. - * - * The init function fills the globals given input arguments. - * - * @param {Object} state transformation state - * @param {Object} state.ast Module's ast - * @param {t.Identifier} state.initFuncId identifier of the init function - * @param {t.Index} state.startAtFuncOffset index of the start function - * @param {t.ModuleImport[]} state.importedGlobals list of imported globals - * @param {t.Instruction[]} state.additionalInitCode list of addition instructions for the init function - * @param {t.Index} state.nextFuncIndex index of the next function - * @param {t.Index} state.nextTypeIndex index of the next type - * @returns {ArrayBufferTransform} transform - */ -const addInitFunction = - ({ - ast, - initFuncId, - startAtFuncOffset, - importedGlobals, - additionalInitCode, - nextFuncIndex, - nextTypeIndex - }) => - bin => { - const funcParams = importedGlobals.map(importedGlobal => { - // used for debugging - const id = t.identifier( - `${importedGlobal.module}.${importedGlobal.name}` - ); + keys() { + this._deopt = true; + if (this._needMerge) this._merge(); + return this._set.keys(); + } - return t.funcParam(importedGlobal.descr.valtype, id); - }); + values() { + this._deopt = true; + if (this._needMerge) this._merge(); + return this._set.values(); + } - const funcBody = []; - importedGlobals.forEach((importedGlobal, index) => { - const args = [t.indexLiteral(index)]; - const body = [ - t.instruction("get_local", args), - t.instruction("set_global", args) - ]; + [Symbol.iterator]() { + this._deopt = true; + if (this._needMerge) this._merge(); + return this._set[Symbol.iterator](); + } - funcBody.push(...body); - }); + /* istanbul ignore next */ + get [Symbol.toStringTag]() { + return "LazySet"; + } - if (typeof startAtFuncOffset === "number") { - funcBody.push( - t.callInstruction(t.numberLiteralFromRaw(startAtFuncOffset)) - ); - } + serialize({ write }) { + if (this._needMerge) this._merge(); + write(this._set.size); + for (const item of this._set) write(item); + } - for (const instr of additionalInitCode) { - funcBody.push(instr); + static deserialize({ read }) { + const count = read(); + const items = []; + for (let i = 0; i < count; i++) { + items.push(read()); } + return new LazySet(items); + } +} - funcBody.push(t.instruction("end")); +makeSerializable(LazySet, "webpack/lib/util/LazySet"); - const funcResults = []; +module.exports = LazySet; - // Code section - const funcSignature = t.signature(funcParams, funcResults); - const func = t.func(initFuncId, funcSignature, funcBody); - // Type section - const functype = t.typeInstruction(undefined, funcSignature); +/***/ }), - // Func section - const funcindex = t.indexInFuncSection(nextTypeIndex); +/***/ 82482: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // Export section - const moduleExport = t.moduleExport( - initFuncId.value, - t.moduleExportDescr("Func", nextFuncIndex) - ); - return addWithAST(ast, bin, [func, moduleExport, funcindex, functype]); - }; /** - * Extract mangle mappings from module - * @param {ModuleGraph} moduleGraph module graph - * @param {Module} module current module - * @param {boolean} mangle mangle imports - * @returns {Map} mappings to mangled names + * @template K + * @template V + * @param {Map} map a map + * @param {K} key the key + * @param {function(): V} computer compute value + * @returns {V} value */ -const getUsedDependencyMap = (moduleGraph, module, mangle) => { - /** @type {Map} */ - const map = new Map(); - for (const usedDep of WebAssemblyUtils.getUsedDependencies( - moduleGraph, - module, - mangle - )) { - const dep = usedDep.dependency; - const request = dep.request; - const exportName = dep.name; - map.set(request + ":" + exportName, usedDep); - } - return map; +exports.provide = (map, key, computer) => { + const value = map.get(key); + if (value !== undefined) return value; + const newValue = computer(); + map.set(key, newValue); + return newValue; }; -const TYPES = new Set(["webassembly"]); -class WebAssemblyGenerator extends Generator { - constructor(options) { - super(); - this.options = options; - } +/***/ }), - /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) - */ - getTypes(module) { - return TYPES; - } +/***/ 50780: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module - */ - getSize(module, type) { - const originalSource = module.originalSource(); - if (!originalSource) { - return 0; - } - return originalSource.size(); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code - */ - generate(module, { moduleGraph, runtime }) { - const bin = module.originalSource().source(); - const initFuncId = t.identifier(""); - // parse it - const ast = decode(bin, { - ignoreDataSection: true, - ignoreCodeSection: true, - ignoreCustomNameSection: true - }); +const binarySearchBounds = __webpack_require__(92229); - const moduleContext = moduleContextFromModuleAST(ast.body[0]); +class ParallelismFactorCalculator { + constructor() { + this._rangePoints = []; + this._rangeCallbacks = []; + } - const importedGlobals = getImportedGlobals(ast); - const countImportedFunc = getCountImportedFunc(ast); - const startAtFuncOffset = moduleContext.getStart(); - const nextFuncIndex = getNextFuncIndex(ast, countImportedFunc); - const nextTypeIndex = getNextTypeIndex(ast); + range(start, end, callback) { + if (start === end) return callback(1); + this._rangePoints.push(start); + this._rangePoints.push(end); + this._rangeCallbacks.push(callback); + } - const usedDependencyMap = getUsedDependencyMap( - moduleGraph, - module, - this.options.mangleImports - ); - const externalExports = new Set( - module.dependencies - .filter(d => d instanceof WebAssemblyExportImportedDependency) - .map(d => { - const wasmDep = /** @type {WebAssemblyExportImportedDependency} */ ( - d - ); - return wasmDep.exportName; - }) + calculate() { + const segments = Array.from(new Set(this._rangePoints)).sort((a, b) => + a < b ? -1 : 1 ); + const parallelism = segments.map(() => 0); + const rangeStartIndices = []; + for (let i = 0; i < this._rangePoints.length; i += 2) { + const start = this._rangePoints[i]; + const end = this._rangePoints[i + 1]; + let idx = binarySearchBounds.eq(segments, start); + rangeStartIndices.push(idx); + do { + parallelism[idx]++; + idx++; + } while (segments[idx] < end); + } + for (let i = 0; i < this._rangeCallbacks.length; i++) { + const start = this._rangePoints[i * 2]; + const end = this._rangePoints[i * 2 + 1]; + let idx = rangeStartIndices[i]; + let sum = 0; + let totalDuration = 0; + let current = start; + do { + const p = parallelism[idx]; + idx++; + const duration = segments[idx] - current; + totalDuration += duration; + current = segments[idx]; + sum += p * duration; + } while (current < end); + this._rangeCallbacks[i](sum / totalDuration); + } + } +} - /** @type {t.Instruction[]} */ - const additionalInitCode = []; +module.exports = ParallelismFactorCalculator; - const transform = compose( - rewriteExportNames({ - ast, - moduleGraph, - module, - externalExports, - runtime - }), - removeStartFunc({ ast }), +/***/ }), - rewriteImportedGlobals({ ast, additionalInitCode }), +/***/ 65930: +/***/ (function(module) { - rewriteImports({ - ast, - usedDependencyMap - }), +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - addInitFunction({ - ast, - initFuncId, - importedGlobals, - additionalInitCode, - startAtFuncOffset, - nextFuncIndex, - nextTypeIndex - }) - ); - const newBin = transform(bin); - const newBuf = Buffer.from(newBin); +/** + * @template T + */ +class Queue { + /** + * @param {Iterable=} items The initial elements. + */ + constructor(items) { + /** @private @type {Set} */ + this._set = new Set(items); + /** @private @type {Iterator} */ + this._iterator = this._set[Symbol.iterator](); + } - return new RawSource(newBuf); + /** + * Returns the number of elements in this queue. + * @returns {number} The number of elements in this queue. + */ + get length() { + return this._set.size; + } + + /** + * Appends the specified element to this queue. + * @param {T} item The element to add. + * @returns {void} + */ + enqueue(item) { + this._set.add(item); + } + + /** + * Retrieves and removes the head of this queue. + * @returns {T | undefined} The head of the queue of `undefined` if this queue is empty. + */ + dequeue() { + const result = this._iterator.next(); + if (result.done) return undefined; + this._set.delete(result.value); + return result.value; } } -module.exports = WebAssemblyGenerator; +module.exports = Queue; /***/ }), -/***/ 47342: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 93347: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const WebpackError = __webpack_require__(53799); - -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../RequestShortener")} RequestShortener */ - /** - * @param {Module} module module to get chains from - * @param {ModuleGraph} moduleGraph the module graph - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {RequestShortener} requestShortener to make readable identifiers - * @returns {string[]} all chains to the module + * intersect creates Set containing the intersection of elements between all sets + * @template T + * @param {Set[]} sets an array of sets being checked for shared elements + * @returns {Set} returns a new Set containing the intersecting items */ -const getInitialModuleChains = ( - module, - moduleGraph, - chunkGraph, - requestShortener -) => { - const queue = [ - { head: module, message: module.readableIdentifier(requestShortener) } - ]; - /** @type {Set} */ - const results = new Set(); - /** @type {Set} */ - const incompleteResults = new Set(); - /** @type {Set} */ - const visitedModules = new Set(); - - for (const chain of queue) { - const { head, message } = chain; - let final = true; - /** @type {Set} */ - const alreadyReferencedModules = new Set(); - for (const connection of moduleGraph.getIncomingConnections(head)) { - const newHead = connection.originModule; - if (newHead) { - if (!chunkGraph.getModuleChunks(newHead).some(c => c.canBeInitial())) - continue; - final = false; - if (alreadyReferencedModules.has(newHead)) continue; - alreadyReferencedModules.add(newHead); - const moduleName = newHead.readableIdentifier(requestShortener); - const detail = connection.explanation - ? ` (${connection.explanation})` - : ""; - const newMessage = `${moduleName}${detail} --> ${message}`; - if (visitedModules.has(newHead)) { - incompleteResults.add(`... --> ${newMessage}`); - continue; - } - visitedModules.add(newHead); - queue.push({ - head: newHead, - message: newMessage - }); - } else { - final = false; - const newMessage = connection.explanation - ? `(${connection.explanation}) --> ${message}` - : message; - results.add(newMessage); - } - } - if (final) { - results.add(message); +const intersect = sets => { + if (sets.length === 0) return new Set(); + if (sets.length === 1) return new Set(sets[0]); + let minSize = Infinity; + let minIndex = -1; + for (let i = 0; i < sets.length; i++) { + const size = sets[i].size; + if (size < minSize) { + minIndex = i; + minSize = size; } } - for (const result of incompleteResults) { - results.add(result); + const current = new Set(sets[minIndex]); + for (let i = 0; i < sets.length; i++) { + if (i === minIndex) continue; + const set = sets[i]; + for (const item of current) { + if (!set.has(item)) { + current.delete(item); + } + } } - return Array.from(results); + return current; }; -module.exports = class WebAssemblyInInitialChunkError extends WebpackError { - /** - * @param {Module} module WASM module - * @param {ModuleGraph} moduleGraph the module graph - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {RequestShortener} requestShortener request shortener - */ - constructor(module, moduleGraph, chunkGraph, requestShortener) { - const moduleChains = getInitialModuleChains( - module, - moduleGraph, - chunkGraph, - requestShortener - ); - const message = `WebAssembly module is included in initial chunk. -This is not allowed, because WebAssembly download and compilation must happen asynchronous. -Add an async split point (i. e. import()) somewhere between your entrypoint and the WebAssembly module: -${moduleChains.map(s => `* ${s}`).join("\n")}`; +/** + * Checks if a set is the subset of another set + * @template T + * @param {Set} bigSet a Set which contains the original elements to compare against + * @param {Set} smallSet the set whose elements might be contained inside of bigSet + * @returns {boolean} returns true if smallSet contains all elements inside of the bigSet + */ +const isSubset = (bigSet, smallSet) => { + if (bigSet.size < smallSet.size) return false; + for (const item of smallSet) { + if (!bigSet.has(item)) return false; + } + return true; +}; - super(message); - this.name = "WebAssemblyInInitialChunkError"; - this.hideStack = true; - this.module = module; +/** + * @template T + * @param {Set} set a set + * @param {function(T): boolean} fn selector function + * @returns {T | undefined} found item + */ +const find = (set, fn) => { + for (const item of set) { + if (fn(item)) return item; } }; +/** + * @template T + * @param {Set} set a set + * @returns {T | undefined} first item + */ +const first = set => { + const entry = set.values().next(); + return entry.done ? undefined : entry.value; +}; + +/** + * @template T + * @param {Set} a first + * @param {Set} b second + * @returns {Set} combined set, may be identical to a or b + */ +const combine = (a, b) => { + if (b.size === 0) return a; + if (a.size === 0) return b; + const set = new Set(a); + for (const item of b) set.add(item); + return set; +}; + +exports.intersect = intersect; +exports.isSubset = isSubset; +exports.find = find; +exports.first = first; +exports.combine = combine; + /***/ }), -/***/ 46545: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 13098: +/***/ (function(module) { "use strict"; /* @@ -131676,221 +129872,165 @@ ${moduleChains.map(s => `* ${s}`).join("\n")}`; -const { RawSource } = __webpack_require__(51255); -const { UsageState } = __webpack_require__(63686); -const Generator = __webpack_require__(93401); -const InitFragment = __webpack_require__(55870); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(1626); -const ModuleDependency = __webpack_require__(80321); -const WebAssemblyExportImportedDependency = __webpack_require__(52204); -const WebAssemblyImportDependency = __webpack_require__(5239); +const NONE = Symbol("not sorted"); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../NormalModule")} NormalModule */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** + * A subset of Set that offers sorting functionality + * @template T item type in set + * @extends {Set} + */ +class SortableSet extends Set { + /** + * Create a new sortable set + * @param {Iterable=} initialIterable The initial iterable value + * @typedef {function(T, T): number} SortFunction + * @param {SortFunction=} defaultSort Default sorting function + */ + constructor(initialIterable, defaultSort) { + super(initialIterable); + /** @private @type {undefined | function(T, T): number}} */ + this._sortFn = defaultSort; + /** @private @type {typeof NONE | undefined | function(T, T): number}} */ + this._lastActiveSortFn = NONE; + /** @private @type {Map | undefined} */ + this._cache = undefined; + /** @private @type {Map | undefined} */ + this._cacheOrderIndependent = undefined; + } -const TYPES = new Set(["webassembly"]); + /** + * @param {T} value value to add to set + * @returns {this} returns itself + */ + add(value) { + this._lastActiveSortFn = NONE; + this._invalidateCache(); + this._invalidateOrderedCache(); + super.add(value); + return this; + } -class WebAssemblyJavascriptGenerator extends Generator { /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) + * @param {T} value value to delete + * @returns {boolean} true if value existed in set, false otherwise */ - getTypes(module) { - return TYPES; + delete(value) { + this._invalidateCache(); + this._invalidateOrderedCache(); + return super.delete(value); } /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module + * @returns {void} */ - getSize(module, type) { - return 95 + module.dependencies.length * 5; + clear() { + this._invalidateCache(); + this._invalidateOrderedCache(); + return super.clear(); } /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code + * Sort with a comparer function + * @param {SortFunction} sortFn Sorting comparer function + * @returns {void} */ - generate(module, generateContext) { - const { - runtimeTemplate, - moduleGraph, - chunkGraph, - runtimeRequirements, - runtime - } = generateContext; - /** @type {InitFragment[]} */ - const initFragments = []; + sortWith(sortFn) { + if (this.size <= 1 || sortFn === this._lastActiveSortFn) { + // already sorted - nothing to do + return; + } - const exportsInfo = moduleGraph.getExportsInfo(module); + const sortedArray = Array.from(this).sort(sortFn); + super.clear(); + for (let i = 0; i < sortedArray.length; i += 1) { + super.add(sortedArray[i]); + } + this._lastActiveSortFn = sortFn; + this._invalidateCache(); + } - let needExportsCopy = false; - const importedModules = new Map(); - const initParams = []; - let index = 0; - for (const dep of module.dependencies) { - const moduleDep = - dep && dep instanceof ModuleDependency ? dep : undefined; - if (moduleGraph.getModule(dep)) { - let importData = importedModules.get(moduleGraph.getModule(dep)); - if (importData === undefined) { - importedModules.set( - moduleGraph.getModule(dep), - (importData = { - importVar: `m${index}`, - index, - request: (moduleDep && moduleDep.userRequest) || undefined, - names: new Set(), - reexports: [] - }) - ); - index++; - } - if (dep instanceof WebAssemblyImportDependency) { - importData.names.add(dep.name); - if (dep.description.type === "GlobalType") { - const exportName = dep.name; - const importedModule = moduleGraph.getModule(dep); + sort() { + this.sortWith(this._sortFn); + return this; + } - if (importedModule) { - const usedName = moduleGraph - .getExportsInfo(importedModule) - .getUsedName(exportName, runtime); - if (usedName) { - initParams.push( - runtimeTemplate.exportFromImport({ - moduleGraph, - module: importedModule, - request: dep.request, - importVar: importData.importVar, - originModule: module, - exportName: dep.name, - asiSafe: true, - isCall: false, - callContext: null, - defaultInterop: true, - initFragments, - runtime, - runtimeRequirements - }) - ); - } - } - } - } - if (dep instanceof WebAssemblyExportImportedDependency) { - importData.names.add(dep.name); - const usedName = moduleGraph - .getExportsInfo(module) - .getUsedName(dep.exportName, runtime); - if (usedName) { - runtimeRequirements.add(RuntimeGlobals.exports); - const exportProp = `${module.exportsArgument}[${JSON.stringify( - usedName - )}]`; - const defineStatement = Template.asString([ - `${exportProp} = ${runtimeTemplate.exportFromImport({ - moduleGraph, - module: moduleGraph.getModule(dep), - request: dep.request, - importVar: importData.importVar, - originModule: module, - exportName: dep.name, - asiSafe: true, - isCall: false, - callContext: null, - defaultInterop: true, - initFragments, - runtime, - runtimeRequirements - })};`, - `if(WebAssembly.Global) ${exportProp} = ` + - `new WebAssembly.Global({ value: ${JSON.stringify( - dep.valueType - )} }, ${exportProp});` - ]); - importData.reexports.push(defineStatement); - needExportsCopy = true; - } - } + /** + * Get data from cache + * @template R + * @param {function(SortableSet): R} fn function to calculate value + * @returns {R} returns result of fn(this), cached until set changes + */ + getFromCache(fn) { + if (this._cache === undefined) { + this._cache = new Map(); + } else { + const result = this._cache.get(fn); + const data = /** @type {R} */ (result); + if (data !== undefined) { + return data; } } - const importsCode = Template.asString( - Array.from( - importedModules, - ([module, { importVar, request, reexports }]) => { - const importStatement = runtimeTemplate.importStatement({ - module, - chunkGraph, - request, - importVar, - originModule: module, - runtimeRequirements - }); - return importStatement[0] + importStatement[1] + reexports.join("\n"); - } - ) - ); - - const copyAllExports = - exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused && - !needExportsCopy; + const newData = fn(this); + this._cache.set(fn, newData); + return newData; + } - // need these globals - runtimeRequirements.add(RuntimeGlobals.module); - runtimeRequirements.add(RuntimeGlobals.moduleId); - runtimeRequirements.add(RuntimeGlobals.wasmInstances); - if (exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused) { - runtimeRequirements.add(RuntimeGlobals.makeNamespaceObject); - runtimeRequirements.add(RuntimeGlobals.exports); - } - if (!copyAllExports) { - runtimeRequirements.add(RuntimeGlobals.exports); + /** + * Get data from cache (ignoring sorting) + * @template R + * @param {function(SortableSet): R} fn function to calculate value + * @returns {R} returns result of fn(this), cached until set changes + */ + getFromUnorderedCache(fn) { + if (this._cacheOrderIndependent === undefined) { + this._cacheOrderIndependent = new Map(); + } else { + const result = this._cacheOrderIndependent.get(fn); + const data = /** @type {R} */ (result); + if (data !== undefined) { + return data; + } } + const newData = fn(this); + this._cacheOrderIndependent.set(fn, newData); + return newData; + } - // create source - const source = new RawSource( - [ - '"use strict";', - "// Instantiate WebAssembly module", - `var wasmExports = ${RuntimeGlobals.wasmInstances}[${module.moduleArgument}.id];`, + /** + * @private + * @returns {void} + */ + _invalidateCache() { + if (this._cache !== undefined) { + this._cache.clear(); + } + } - exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused - ? `${RuntimeGlobals.makeNamespaceObject}(${module.exportsArgument});` - : "", + /** + * @private + * @returns {void} + */ + _invalidateOrderedCache() { + if (this._cacheOrderIndependent !== undefined) { + this._cacheOrderIndependent.clear(); + } + } - // this must be before import for circular dependencies - "// export exports from WebAssembly module", - copyAllExports - ? `${module.moduleArgument}.exports = wasmExports;` - : "for(var name in wasmExports) " + - `if(name) ` + - `${module.exportsArgument}[name] = wasmExports[name];`, - "// exec imports from WebAssembly module (for esm order)", - importsCode, - "", - "// exec wasm module", - `wasmExports[""](${initParams.join(", ")})` - ].join("\n") - ); - return InitFragment.addToSource(source, initFragments, generateContext); + /** + * @returns {T[]} the raw array + */ + toJSON() { + return Array.from(this); } } -module.exports = WebAssemblyJavascriptGenerator; +module.exports = SortableSet; /***/ }), -/***/ 53639: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 64985: +/***/ (function(module) { "use strict"; /* @@ -131900,147 +130040,115 @@ module.exports = WebAssemblyJavascriptGenerator; -const Generator = __webpack_require__(93401); -const WebAssemblyExportImportedDependency = __webpack_require__(52204); -const WebAssemblyImportDependency = __webpack_require__(5239); -const { compareModulesByIdentifier } = __webpack_require__(29579); -const memoize = __webpack_require__(78676); -const WebAssemblyInInitialChunkError = __webpack_require__(47342); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleTemplate")} ModuleTemplate */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ +/** + * @template K + * @template V + */ +class StackedCacheMap { + constructor() { + /** @type {Map} */ + this.map = new Map(); + /** @type {ReadonlyMap[]} */ + this.stack = []; + } -const getWebAssemblyGenerator = memoize(() => - __webpack_require__(47012) -); -const getWebAssemblyJavascriptGenerator = memoize(() => - __webpack_require__(46545) -); -const getWebAssemblyParser = memoize(() => __webpack_require__(57059)); + /** + * @param {ReadonlyMap} map map to add + * @param {boolean} immutable if 'map' is immutable and StackedCacheMap can keep referencing it + */ + addAll(map, immutable) { + if (immutable) { + this.stack.push(map); -class WebAssemblyModulesPlugin { - constructor(options) { - this.options = options; + // largest map should go first + for (let i = this.stack.length - 1; i > 0; i--) { + const beforeLast = this.stack[i - 1]; + if (beforeLast.size >= map.size) break; + this.stack[i] = beforeLast; + this.stack[i - 1] = map; + } + } else { + for (const [key, value] of map) { + this.map.set(key, value); + } + } } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {K} item the key of the element to add + * @param {V} value the value of the element to add * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap( - "WebAssemblyModulesPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - WebAssemblyImportDependency, - normalModuleFactory - ); - - compilation.dependencyFactories.set( - WebAssemblyExportImportedDependency, - normalModuleFactory - ); - - normalModuleFactory.hooks.createParser - .for("webassembly/sync") - .tap("WebAssemblyModulesPlugin", () => { - const WebAssemblyParser = getWebAssemblyParser(); - - return new WebAssemblyParser(); - }); - - normalModuleFactory.hooks.createGenerator - .for("webassembly/sync") - .tap("WebAssemblyModulesPlugin", () => { - const WebAssemblyJavascriptGenerator = - getWebAssemblyJavascriptGenerator(); - const WebAssemblyGenerator = getWebAssemblyGenerator(); - - return Generator.byType({ - javascript: new WebAssemblyJavascriptGenerator(), - webassembly: new WebAssemblyGenerator(this.options) - }); - }); + set(item, value) { + this.map.set(item, value); + } - compilation.hooks.renderManifest.tap( - "WebAssemblyModulesPlugin", - (result, options) => { - const { chunkGraph } = compilation; - const { chunk, outputOptions, codeGenerationResults } = options; + /** + * @param {K} item the item to delete + * @returns {void} + */ + delete(item) { + throw new Error("Items can't be deleted from a StackedCacheMap"); + } - for (const module of chunkGraph.getOrderedChunkModulesIterable( - chunk, - compareModulesByIdentifier - )) { - if (module.type === "webassembly/sync") { - const filenameTemplate = - outputOptions.webassemblyModuleFilename; + /** + * @param {K} item the item to test + * @returns {boolean} true if the item exists in this set + */ + has(item) { + throw new Error( + "Checking StackedCacheMap.has before reading is inefficient, use StackedCacheMap.get and check for undefined" + ); + } - result.push({ - render: () => - codeGenerationResults.getSource( - module, - chunk.runtime, - "webassembly" - ), - filenameTemplate, - pathOptions: { - module, - runtime: chunk.runtime, - chunkGraph - }, - auxiliary: true, - identifier: `webassemblyModule${chunkGraph.getModuleId( - module - )}`, - hash: chunkGraph.getModuleHash(module, chunk.runtime) - }); - } - } + /** + * @param {K} item the key of the element to return + * @returns {V} the value of the element + */ + get(item) { + for (const map of this.stack) { + const value = map.get(item); + if (value !== undefined) return value; + } + return this.map.get(item); + } - return result; - } - ); + clear() { + this.stack.length = 0; + this.map.clear(); + } - compilation.hooks.afterChunks.tap("WebAssemblyModulesPlugin", () => { - const chunkGraph = compilation.chunkGraph; - const initialWasmModules = new Set(); - for (const chunk of compilation.chunks) { - if (chunk.canBeInitial()) { - for (const module of chunkGraph.getChunkModulesIterable(chunk)) { - if (module.type === "webassembly/sync") { - initialWasmModules.add(module); - } - } - } - } - for (const module of initialWasmModules) { - compilation.errors.push( - new WebAssemblyInInitialChunkError( - module, - compilation.moduleGraph, - compilation.chunkGraph, - compilation.requestShortener - ) - ); - } - }); + get size() { + let size = this.map.size; + for (const map of this.stack) { + size += map.size; + } + return size; + } + + [Symbol.iterator]() { + const iterators = this.stack.map(map => map[Symbol.iterator]()); + let current = this.map[Symbol.iterator](); + return { + next() { + let result = current.next(); + while (result.done && iterators.length > 0) { + current = iterators.pop(); + result = current.next(); + } + return result; } - ); + }; } } -module.exports = WebAssemblyModulesPlugin; +module.exports = StackedCacheMap; /***/ }), -/***/ 57059: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 58845: +/***/ (function(module) { "use strict"; /* @@ -132050,270 +130158,171 @@ module.exports = WebAssemblyModulesPlugin; -const t = __webpack_require__(51826); -const { moduleContextFromModuleAST } = __webpack_require__(51826); -const { decode } = __webpack_require__(73726); -const Parser = __webpack_require__(11715); -const StaticExportsDependency = __webpack_require__(91418); -const WebAssemblyExportImportedDependency = __webpack_require__(52204); -const WebAssemblyImportDependency = __webpack_require__(5239); +const TOMBSTONE = Symbol("tombstone"); +const UNDEFINED_MARKER = Symbol("undefined"); -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ +/** + * @template T + * @typedef {T | undefined} Cell + */ -const JS_COMPAT_TYPES = new Set(["i32", "f32", "f64"]); +/** + * @template T + * @typedef {T | typeof TOMBSTONE | typeof UNDEFINED_MARKER} InternalCell + */ /** - * @param {t.Signature} signature the func signature - * @returns {null | string} the type incompatible with js types + * @template K + * @template V + * @param {[K, InternalCell]} pair the internal cell + * @returns {[K, Cell]} its “safe” representation */ -const getJsIncompatibleType = signature => { - for (const param of signature.params) { - if (!JS_COMPAT_TYPES.has(param.valtype)) { - return `${param.valtype} as parameter`; - } - } - for (const type of signature.results) { - if (!JS_COMPAT_TYPES.has(type)) return `${type} as result`; +const extractPair = pair => { + const key = pair[0]; + const val = pair[1]; + if (val === UNDEFINED_MARKER || val === TOMBSTONE) { + return [key, undefined]; + } else { + return /** @type {[K, Cell]} */ (pair); } - return null; }; /** - * TODO why are there two different Signature types? - * @param {t.FuncSignature} signature the func signature - * @returns {null | string} the type incompatible with js types + * @template K + * @template V */ -const getJsIncompatibleTypeOfFuncSignature = signature => { - for (const param of signature.args) { - if (!JS_COMPAT_TYPES.has(param)) { - return `${param} as parameter`; - } - } - for (const type of signature.result) { - if (!JS_COMPAT_TYPES.has(type)) return `${type} as result`; +class StackedMap { + /** + * @param {Map>[]=} parentStack an optional parent + */ + constructor(parentStack) { + /** @type {Map>} */ + this.map = new Map(); + /** @type {Map>[]} */ + this.stack = parentStack === undefined ? [] : parentStack.slice(); + this.stack.push(this.map); } - return null; -}; - -const decoderOpts = { - ignoreCodeSection: true, - ignoreDataSection: true, - - // this will avoid having to lookup with identifiers in the ModuleContext - ignoreCustomNameSection: true -}; -class WebAssemblyParser extends Parser { - constructor(options) { - super(); - this.hooks = Object.freeze({}); - this.options = options; + /** + * @param {K} item the key of the element to add + * @param {V} value the value of the element to add + * @returns {void} + */ + set(item, value) { + this.map.set(item, value === undefined ? UNDEFINED_MARKER : value); } /** - * @param {string | Buffer | PreparsedAst} source the source to parse - * @param {ParserState} state the parser state - * @returns {ParserState} the parser state + * @param {K} item the item to delete + * @returns {void} */ - parse(source, state) { - if (!Buffer.isBuffer(source)) { - throw new Error("WebAssemblyParser input must be a Buffer"); + delete(item) { + if (this.stack.length > 1) { + this.map.set(item, TOMBSTONE); + } else { + this.map.delete(item); } + } - // flag it as ESM - state.module.buildInfo.strict = true; - state.module.buildMeta.exportsType = "namespace"; - - // parse it - const program = decode(source, decoderOpts); - const module = program.body[0]; - - const moduleContext = moduleContextFromModuleAST(module); - - // extract imports and exports - const exports = []; - let jsIncompatibleExports = (state.module.buildMeta.jsIncompatibleExports = - undefined); - - const importedGlobals = []; - t.traverse(module, { - ModuleExport({ node }) { - const descriptor = node.descr; - - if (descriptor.exportType === "Func") { - const funcIdx = descriptor.id.value; - - /** @type {t.FuncSignature} */ - const funcSignature = moduleContext.getFunction(funcIdx); - - const incompatibleType = - getJsIncompatibleTypeOfFuncSignature(funcSignature); - - if (incompatibleType) { - if (jsIncompatibleExports === undefined) { - jsIncompatibleExports = - state.module.buildMeta.jsIncompatibleExports = {}; - } - jsIncompatibleExports[node.name] = incompatibleType; - } - } - - exports.push(node.name); - - if (node.descr && node.descr.exportType === "Global") { - const refNode = importedGlobals[node.descr.id.value]; - if (refNode) { - const dep = new WebAssemblyExportImportedDependency( - node.name, - refNode.module, - refNode.name, - refNode.descr.valtype - ); - - state.module.addDependency(dep); - } - } - }, - - Global({ node }) { - const init = node.init[0]; - - let importNode = null; - - if (init.id === "get_global") { - const globalIdx = init.args[0].value; - - if (globalIdx < importedGlobals.length) { - importNode = importedGlobals[globalIdx]; - } + /** + * @param {K} item the item to test + * @returns {boolean} true if the item exists in this set + */ + has(item) { + const topValue = this.map.get(item); + if (topValue !== undefined) { + return topValue !== TOMBSTONE; + } + if (this.stack.length > 1) { + for (let i = this.stack.length - 2; i >= 0; i--) { + const value = this.stack[i].get(item); + if (value !== undefined) { + this.map.set(item, value); + return value !== TOMBSTONE; } + } + this.map.set(item, TOMBSTONE); + } + return false; + } - importedGlobals.push(importNode); - }, - - ModuleImport({ node }) { - /** @type {false | string} */ - let onlyDirectImport = false; - - if (t.isMemory(node.descr) === true) { - onlyDirectImport = "Memory"; - } else if (t.isTable(node.descr) === true) { - onlyDirectImport = "Table"; - } else if (t.isFuncImportDescr(node.descr) === true) { - const incompatibleType = getJsIncompatibleType(node.descr.signature); - if (incompatibleType) { - onlyDirectImport = `Non-JS-compatible Func Signature (${incompatibleType})`; - } - } else if (t.isGlobalType(node.descr) === true) { - const type = node.descr.valtype; - if (!JS_COMPAT_TYPES.has(type)) { - onlyDirectImport = `Non-JS-compatible Global Type (${type})`; - } + /** + * @param {K} item the key of the element to return + * @returns {Cell} the value of the element + */ + get(item) { + const topValue = this.map.get(item); + if (topValue !== undefined) { + return topValue === TOMBSTONE || topValue === UNDEFINED_MARKER + ? undefined + : topValue; + } + if (this.stack.length > 1) { + for (let i = this.stack.length - 2; i >= 0; i--) { + const value = this.stack[i].get(item); + if (value !== undefined) { + this.map.set(item, value); + return value === TOMBSTONE || value === UNDEFINED_MARKER + ? undefined + : value; } + } + this.map.set(item, TOMBSTONE); + } + return undefined; + } - const dep = new WebAssemblyImportDependency( - node.module, - node.name, - node.descr, - onlyDirectImport - ); - - state.module.addDependency(dep); - - if (t.isGlobalType(node.descr)) { - importedGlobals.push(node); + _compress() { + if (this.stack.length === 1) return; + this.map = new Map(); + for (const data of this.stack) { + for (const pair of data) { + if (pair[1] === TOMBSTONE) { + this.map.delete(pair[0]); + } else { + this.map.set(pair[0], pair[1]); } } - }); - - state.module.addDependency(new StaticExportsDependency(exports, false)); - - return state; + } + this.stack = [this.map]; } -} - -module.exports = WebAssemblyParser; - - -/***/ }), - -/***/ 18650: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const Template = __webpack_require__(1626); -const WebAssemblyImportDependency = __webpack_require__(5239); + asArray() { + this._compress(); + return Array.from(this.map.keys()); + } -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ + asSet() { + this._compress(); + return new Set(this.map.keys()); + } -/** @typedef {Object} UsedWasmDependency - * @property {WebAssemblyImportDependency} dependency the dependency - * @property {string} name the export name - * @property {string} module the module name - */ + asPairArray() { + this._compress(); + return Array.from(this.map.entries(), extractPair); + } -const MANGLED_MODULE = "a"; + asMap() { + return new Map(this.asPairArray()); + } -/** - * @param {ModuleGraph} moduleGraph the module graph - * @param {Module} module the module - * @param {boolean} mangle mangle module and export names - * @returns {UsedWasmDependency[]} used dependencies and (mangled) name - */ -const getUsedDependencies = (moduleGraph, module, mangle) => { - /** @type {UsedWasmDependency[]} */ - const array = []; - let importIndex = 0; - for (const dep of module.dependencies) { - if (dep instanceof WebAssemblyImportDependency) { - if ( - dep.description.type === "GlobalType" || - moduleGraph.getModule(dep) === null - ) { - continue; - } + get size() { + this._compress(); + return this.map.size; + } - const exportName = dep.name; - // TODO add the following 3 lines when removing of ModuleExport is possible - // const importedModule = moduleGraph.getModule(dep); - // const usedName = importedModule && moduleGraph.getExportsInfo(importedModule).getUsedName(exportName, runtime); - // if (usedName !== false) { - if (mangle) { - array.push({ - dependency: dep, - name: Template.numberToIdentifier(importIndex++), - module: MANGLED_MODULE - }); - } else { - array.push({ - dependency: dep, - name: exportName, - module: dep.request - }); - } - } + createChild() { + return new StackedMap(this.stack); } - return array; -}; +} -exports.getUsedDependencies = getUsedDependencies; -exports.MANGLED_MODULE = MANGLED_MODULE; +module.exports = StackedMap; /***/ }), -/***/ 78613: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 40293: +/***/ (function(module) { "use strict"; /* @@ -132323,122 +130332,59 @@ exports.MANGLED_MODULE = MANGLED_MODULE; -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").WasmLoadingType} WasmLoadingType */ -/** @typedef {import("../Compiler")} Compiler */ - -/** @type {WeakMap>} */ -const enabledTypes = new WeakMap(); - -const getEnabledTypes = compiler => { - let set = enabledTypes.get(compiler); - if (set === undefined) { - set = new Set(); - enabledTypes.set(compiler, set); - } - return set; -}; - -class EnableWasmLoadingPlugin { - /** - * @param {WasmLoadingType} type library type that should be available - */ - constructor(type) { - this.type = type; - } - - /** - * @param {Compiler} compiler the compiler instance - * @param {WasmLoadingType} type type of library - * @returns {void} - */ - static setEnabled(compiler, type) { - getEnabledTypes(compiler).add(type); +class StringXor { + constructor() { + this._value = undefined; } /** - * @param {Compiler} compiler the compiler instance - * @param {WasmLoadingType} type type of library + * @param {string} str string * @returns {void} */ - static checkEnabled(compiler, type) { - if (!getEnabledTypes(compiler).has(type)) { - throw new Error( - `Library type "${type}" is not enabled. ` + - "EnableWasmLoadingPlugin need to be used to enable this type of wasm loading. " + - 'This usually happens through the "output.enabledWasmLoadingTypes" option. ' + - 'If you are using a function as entry which sets "wasmLoading", you need to add all potential library types to "output.enabledWasmLoadingTypes". ' + - "These types are enabled: " + - Array.from(getEnabledTypes(compiler)).join(", ") - ); + add(str) { + const len = str.length; + const value = this._value; + if (value === undefined) { + const newValue = (this._value = Buffer.allocUnsafe(len)); + for (let i = 0; i < len; i++) { + newValue[i] = str.charCodeAt(i); + } + return; } - } - - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const { type } = this; - - // Only enable once - const enabled = getEnabledTypes(compiler); - if (enabled.has(type)) return; - enabled.add(type); - - if (typeof type === "string") { - switch (type) { - case "fetch": { - // TODO webpack 6 remove FetchCompileWasmPlugin - const FetchCompileWasmPlugin = __webpack_require__(35537); - const FetchCompileAsyncWasmPlugin = __webpack_require__(8437); - new FetchCompileWasmPlugin({ - mangleImports: compiler.options.optimization.mangleWasmImports - }).apply(compiler); - new FetchCompileAsyncWasmPlugin().apply(compiler); - break; - } - case "async-node": { - // TODO webpack 6 remove ReadFileCompileWasmPlugin - const ReadFileCompileWasmPlugin = __webpack_require__(98939); - // @ts-expect-error typescript bug for duplicate require - const ReadFileCompileAsyncWasmPlugin = __webpack_require__(73163); - new ReadFileCompileWasmPlugin({ - mangleImports: compiler.options.optimization.mangleWasmImports - }).apply(compiler); - new ReadFileCompileAsyncWasmPlugin({ type }).apply(compiler); - break; - } - case "async-node-module": { - // @ts-expect-error typescript bug for duplicate require - const ReadFileCompileAsyncWasmPlugin = __webpack_require__(73163); - new ReadFileCompileAsyncWasmPlugin({ type, import: true }).apply( - compiler - ); - break; - } - case "universal": - throw new Error( - "Universal WebAssembly Loading is not implemented yet" - ); - default: - throw new Error(`Unsupported wasm loading type ${type}. -Plugins which provide custom wasm loading types must call EnableWasmLoadingPlugin.setEnabled(compiler, type) to disable this error.`); + const valueLen = value.length; + if (valueLen < len) { + const newValue = (this._value = Buffer.allocUnsafe(len)); + let i; + for (i = 0; i < valueLen; i++) { + newValue[i] = value[i] ^ str.charCodeAt(i); + } + for (; i < len; i++) { + newValue[i] = str.charCodeAt(i); } } else { - // TODO support plugin instances here - // apply them to the compiler + for (let i = 0; i < len; i++) { + value[i] = value[i] ^ str.charCodeAt(i); + } } } + + toString() { + const value = this._value; + return value === undefined ? "" : value.toString("latin1"); + } + + updateHash(hash) { + const value = this._value; + if (value !== undefined) hash.update(value); + } } -module.exports = EnableWasmLoadingPlugin; +module.exports = StringXor; /***/ }), -/***/ 8437: +/***/ 38415: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -132449,67 +130395,66 @@ module.exports = EnableWasmLoadingPlugin; -const RuntimeGlobals = __webpack_require__(16475); -const AsyncWasmLoadingRuntimeModule = __webpack_require__(5434); +const TupleSet = __webpack_require__(76455); -/** @typedef {import("../Compiler")} Compiler */ +/** + * @template {any[]} T + */ +class TupleQueue { + /** + * @param {Iterable=} items The initial elements. + */ + constructor(items) { + /** @private @type {TupleSet} */ + this._set = new TupleSet(items); + /** @private @type {Iterator} */ + this._iterator = this._set[Symbol.iterator](); + } -class FetchCompileAsyncWasmPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * Returns the number of elements in this queue. + * @returns {number} The number of elements in this queue. + */ + get length() { + return this._set.size; + } + + /** + * Appends the specified element to this queue. + * @param {T} item The element to add. * @returns {void} */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - "FetchCompileAsyncWasmPlugin", - compilation => { - const globalWasmLoading = compilation.outputOptions.wasmLoading; - const isEnabledForChunk = chunk => { - const options = chunk.getEntryOptions(); - const wasmLoading = - options && options.wasmLoading !== undefined - ? options.wasmLoading - : globalWasmLoading; - return wasmLoading === "fetch"; - }; - const generateLoadBinaryCode = path => - `fetch(${RuntimeGlobals.publicPath} + ${path})`; + enqueue(...item) { + this._set.add(...item); + } - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.instantiateWasm) - .tap("FetchCompileAsyncWasmPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - const chunkGraph = compilation.chunkGraph; - if ( - !chunkGraph.hasModuleInGraph( - chunk, - m => m.type === "webassembly/async" - ) - ) { - return; - } - set.add(RuntimeGlobals.publicPath); - compilation.addRuntimeModule( - chunk, - new AsyncWasmLoadingRuntimeModule({ - generateLoadBinaryCode, - supportsStreaming: true - }) - ); - }); + /** + * Retrieves and removes the head of this queue. + * @returns {T | undefined} The head of the queue of `undefined` if this queue is empty. + */ + dequeue() { + const result = this._iterator.next(); + if (result.done) { + if (this._set.size > 0) { + this._iterator = this._set[Symbol.iterator](); + const value = this._iterator.next().value; + this._set.delete(...value); + return value; } - ); + return undefined; + } + this._set.delete(...result.value); + return result.value; } } -module.exports = FetchCompileAsyncWasmPlugin; +module.exports = TupleQueue; /***/ }), -/***/ 35537: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 76455: +/***/ (function(module) { "use strict"; /* @@ -132519,76 +130464,250 @@ module.exports = FetchCompileAsyncWasmPlugin; -const RuntimeGlobals = __webpack_require__(16475); -const WasmChunkLoadingRuntimeModule = __webpack_require__(87394); +/** + * @template {any[]} T + */ +class TupleSet { + constructor(init) { + this._map = new Map(); + this.size = 0; + if (init) { + for (const tuple of init) { + this.add(...tuple); + } + } + } -/** @typedef {import("../Compiler")} Compiler */ + /** + * @param {T} args tuple + * @returns {void} + */ + add(...args) { + let map = this._map; + for (let i = 0; i < args.length - 2; i++) { + const arg = args[i]; + const innerMap = map.get(arg); + if (innerMap === undefined) { + map.set(arg, (map = new Map())); + } else { + map = innerMap; + } + } -// TODO webpack 6 remove + const beforeLast = args[args.length - 2]; + let set = map.get(beforeLast); + if (set === undefined) { + map.set(beforeLast, (set = new Set())); + } -class FetchCompileWasmPlugin { - constructor(options) { - this.options = options || {}; + const last = args[args.length - 1]; + this.size -= set.size; + set.add(last); + this.size += set.size; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {T} args tuple + * @returns {boolean} true, if the tuple is in the Set + */ + has(...args) { + let map = this._map; + for (let i = 0; i < args.length - 2; i++) { + const arg = args[i]; + map = map.get(arg); + if (map === undefined) { + return false; + } + } + + const beforeLast = args[args.length - 2]; + let set = map.get(beforeLast); + if (set === undefined) { + return false; + } + + const last = args[args.length - 1]; + return set.has(last); + } + + /** + * @param {T} args tuple * @returns {void} */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - "FetchCompileWasmPlugin", - compilation => { - const globalWasmLoading = compilation.outputOptions.wasmLoading; - const isEnabledForChunk = chunk => { - const options = chunk.getEntryOptions(); - const wasmLoading = - options && options.wasmLoading !== undefined - ? options.wasmLoading - : globalWasmLoading; - return wasmLoading === "fetch"; - }; - const generateLoadBinaryCode = path => - `fetch(${RuntimeGlobals.publicPath} + ${path})`; + delete(...args) { + let map = this._map; + for (let i = 0; i < args.length - 2; i++) { + const arg = args[i]; + map = map.get(arg); + if (map === undefined) { + return; + } + } - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("FetchCompileWasmPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - const chunkGraph = compilation.chunkGraph; - if ( - !chunkGraph.hasModuleInGraph( - chunk, - m => m.type === "webassembly/sync" - ) - ) { - return; + const beforeLast = args[args.length - 2]; + let set = map.get(beforeLast); + if (set === undefined) { + return; + } + + const last = args[args.length - 1]; + this.size -= set.size; + set.delete(last); + this.size += set.size; + } + + /** + * @returns {Iterator} iterator + */ + [Symbol.iterator]() { + const iteratorStack = []; + const tuple = []; + let currentSetIterator = undefined; + + const next = it => { + const result = it.next(); + if (result.done) { + if (iteratorStack.length === 0) return false; + tuple.pop(); + return next(iteratorStack.pop()); + } + const [key, value] = result.value; + iteratorStack.push(it); + tuple.push(key); + if (value instanceof Set) { + currentSetIterator = value[Symbol.iterator](); + return true; + } else { + return next(value[Symbol.iterator]()); + } + }; + + next(this._map[Symbol.iterator]()); + + return { + next() { + while (currentSetIterator) { + const result = currentSetIterator.next(); + if (result.done) { + tuple.pop(); + if (!next(iteratorStack.pop())) { + currentSetIterator = undefined; } - set.add(RuntimeGlobals.moduleCache); - set.add(RuntimeGlobals.publicPath); - compilation.addRuntimeModule( - chunk, - new WasmChunkLoadingRuntimeModule({ - generateLoadBinaryCode, - supportsStreaming: true, - mangleImports: this.options.mangleImports, - runtimeRequirements: set - }) - ); - }); + } else { + return { + done: false, + value: /** @type {T} */ (tuple.concat(result.value)) + }; + } + } + return { done: true, value: undefined }; } - ); + }; } } -module.exports = FetchCompileWasmPlugin; +module.exports = TupleSet; /***/ }), -/***/ 83121: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 54500: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ + + + +/** @typedef {import("./fs").InputFileSystem} InputFileSystem */ +/** @typedef {(error: Error|null, result?: Buffer) => void} ErrorFirstCallback */ + +const backSlashCharCode = "\\".charCodeAt(0); +const slashCharCode = "/".charCodeAt(0); +const aLowerCaseCharCode = "a".charCodeAt(0); +const zLowerCaseCharCode = "z".charCodeAt(0); +const aUpperCaseCharCode = "A".charCodeAt(0); +const zUpperCaseCharCode = "Z".charCodeAt(0); +const _0CharCode = "0".charCodeAt(0); +const _9CharCode = "9".charCodeAt(0); +const plusCharCode = "+".charCodeAt(0); +const hyphenCharCode = "-".charCodeAt(0); +const colonCharCode = ":".charCodeAt(0); +const hashCharCode = "#".charCodeAt(0); +const queryCharCode = "?".charCodeAt(0); +/** + * Get scheme if specifier is an absolute URL specifier + * e.g. Absolute specifiers like 'file:///user/webpack/index.js' + * https://tools.ietf.org/html/rfc3986#section-3.1 + * @param {string} specifier specifier + * @returns {string|undefined} scheme if absolute URL specifier provided + */ +function getScheme(specifier) { + const start = specifier.charCodeAt(0); + + // First char maybe only a letter + if ( + (start < aLowerCaseCharCode || start > zLowerCaseCharCode) && + (start < aUpperCaseCharCode || start > zUpperCaseCharCode) + ) { + return undefined; + } + + let i = 1; + let ch = specifier.charCodeAt(i); + + while ( + (ch >= aLowerCaseCharCode && ch <= zLowerCaseCharCode) || + (ch >= aUpperCaseCharCode && ch <= zUpperCaseCharCode) || + (ch >= _0CharCode && ch <= _9CharCode) || + ch === plusCharCode || + ch === hyphenCharCode + ) { + if (++i === specifier.length) return undefined; + ch = specifier.charCodeAt(i); + } + + // Scheme must end with colon + if (ch !== colonCharCode) return undefined; + + // Check for Windows absolute path + // https://url.spec.whatwg.org/#url-miscellaneous + if (i === 1) { + const nextChar = i + 1 < specifier.length ? specifier.charCodeAt(i + 1) : 0; + if ( + nextChar === 0 || + nextChar === backSlashCharCode || + nextChar === slashCharCode || + nextChar === hashCharCode || + nextChar === queryCharCode + ) { + return undefined; + } + } + + return specifier.slice(0, i).toLowerCase(); +} + +/** + * @param {string} specifier specifier + * @returns {string|null} protocol if absolute URL specifier provided + */ +function getProtocol(specifier) { + const scheme = getScheme(specifier); + return scheme === undefined ? undefined : scheme + ":"; +} + +exports.getScheme = getScheme; +exports.getProtocol = getProtocol; + + +/***/ }), + +/***/ 28745: +/***/ (function(module) { "use strict"; /* @@ -132598,544 +130717,270 @@ module.exports = FetchCompileWasmPlugin; -const RuntimeGlobals = __webpack_require__(16475); -const JsonpChunkLoadingRuntimeModule = __webpack_require__(84154); +const isWeakKey = thing => typeof thing === "object" && thing !== null; -/** @typedef {import("../Compiler")} Compiler */ +/** + * @template {any[]} T + * @template V + */ +class WeakTupleMap { + constructor() { + /** @private */ + this.f = 0; + /** @private @type {any} */ + this.v = undefined; + /** @private @type {Map> | undefined} */ + this.m = undefined; + /** @private @type {WeakMap> | undefined} */ + this.w = undefined; + } -class JsonpChunkLoadingPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {[...T, V]} args tuple * @returns {void} */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - "JsonpChunkLoadingPlugin", - compilation => { - const globalChunkLoading = compilation.outputOptions.chunkLoading; - const isEnabledForChunk = chunk => { - const options = chunk.getEntryOptions(); - const chunkLoading = - options && options.chunkLoading !== undefined - ? options.chunkLoading - : globalChunkLoading; - return chunkLoading === "jsonp"; - }; - const onceForChunkSet = new WeakSet(); - const handler = (chunk, set) => { - if (onceForChunkSet.has(chunk)) return; - onceForChunkSet.add(chunk); - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - set.add(RuntimeGlobals.hasOwnProperty); - compilation.addRuntimeModule( - chunk, - new JsonpChunkLoadingRuntimeModule(set) - ); - }; - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("JsonpChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadUpdateHandlers) - .tap("JsonpChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadManifest) - .tap("JsonpChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.baseURI) - .tap("JsonpChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.onChunksLoaded) - .tap("JsonpChunkLoadingPlugin", handler); + set(...args) { + /** @type {WeakTupleMap} */ + let node = this; + for (let i = 0; i < args.length - 1; i++) { + node = node._get(args[i]); + } + node._setValue(args[args.length - 1]); + } - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("JsonpChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.publicPath); - set.add(RuntimeGlobals.loadScript); - set.add(RuntimeGlobals.getChunkScriptFilename); - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadUpdateHandlers) - .tap("JsonpChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.publicPath); - set.add(RuntimeGlobals.loadScript); - set.add(RuntimeGlobals.getChunkUpdateScriptFilename); - set.add(RuntimeGlobals.moduleCache); - set.add(RuntimeGlobals.hmrModuleData); - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadManifest) - .tap("JsonpChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.publicPath); - set.add(RuntimeGlobals.getUpdateManifestFilename); - }); - } - ); + /** + * @param {T} args tuple + * @returns {boolean} true, if the tuple is in the Set + */ + has(...args) { + /** @type {WeakTupleMap} */ + let node = this; + for (let i = 0; i < args.length; i++) { + node = node._peek(args[i]); + if (node === undefined) return false; + } + return node._hasValue(); + } + + /** + * @param {T} args tuple + * @returns {V} the value + */ + get(...args) { + /** @type {WeakTupleMap} */ + let node = this; + for (let i = 0; i < args.length; i++) { + node = node._peek(args[i]); + if (node === undefined) return undefined; + } + return node._getValue(); + } + + /** + * @param {[...T, function(): V]} args tuple + * @returns {V} the value + */ + provide(...args) { + /** @type {WeakTupleMap} */ + let node = this; + for (let i = 0; i < args.length - 1; i++) { + node = node._get(args[i]); + } + if (node._hasValue()) return node._getValue(); + const fn = args[args.length - 1]; + const newValue = fn(...args.slice(0, -1)); + node._setValue(newValue); + return newValue; } -} - -module.exports = JsonpChunkLoadingPlugin; - - -/***/ }), - -/***/ 84154: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + /** + * @param {T} args tuple + * @returns {void} + */ + delete(...args) { + /** @type {WeakTupleMap} */ + let node = this; + for (let i = 0; i < args.length; i++) { + node = node._peek(args[i]); + if (node === undefined) return; + } + node._deleteValue(); + } + /** + * @returns {void} + */ + clear() { + this.f = 0; + this.v = undefined; + this.w = undefined; + this.m = undefined; + } -const { SyncWaterfallHook } = __webpack_require__(6967); -const Compilation = __webpack_require__(85720); -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); -const chunkHasJs = (__webpack_require__(89464).chunkHasJs); -const { getInitialChunkIds } = __webpack_require__(98124); -const compileBooleanMatcher = __webpack_require__(29404); + _getValue() { + return this.v; + } -/** @typedef {import("../Chunk")} Chunk */ + _hasValue() { + return (this.f & 1) === 1; + } -/** - * @typedef {Object} JsonpCompilationPluginHooks - * @property {SyncWaterfallHook<[string, Chunk]>} linkPreload - * @property {SyncWaterfallHook<[string, Chunk]>} linkPrefetch - */ + _setValue(v) { + this.f |= 1; + this.v = v; + } -/** @type {WeakMap} */ -const compilationHooksMap = new WeakMap(); + _deleteValue() { + this.f &= 6; + this.v = undefined; + } -class JsonpChunkLoadingRuntimeModule extends RuntimeModule { - /** - * @param {Compilation} compilation the compilation - * @returns {JsonpCompilationPluginHooks} hooks - */ - static getCompilationHooks(compilation) { - if (!(compilation instanceof Compilation)) { - throw new TypeError( - "The 'compilation' argument must be an instance of Compilation" - ); - } - let hooks = compilationHooksMap.get(compilation); - if (hooks === undefined) { - hooks = { - linkPreload: new SyncWaterfallHook(["source", "chunk"]), - linkPrefetch: new SyncWaterfallHook(["source", "chunk"]) - }; - compilationHooksMap.set(compilation, hooks); + _peek(thing) { + if (isWeakKey(thing)) { + if ((this.f & 4) !== 4) return undefined; + return this.w.get(thing); + } else { + if ((this.f & 2) !== 2) return undefined; + return this.m.get(thing); } - return hooks; } - constructor(runtimeRequirements) { - super("jsonp chunk loading", RuntimeModule.STAGE_ATTACH); - this._runtimeRequirements = runtimeRequirements; + _get(thing) { + if (isWeakKey(thing)) { + if ((this.f & 4) !== 4) { + const newMap = new WeakMap(); + this.f |= 4; + const newNode = new WeakTupleMap(); + (this.w = newMap).set(thing, newNode); + return newNode; + } + const entry = this.w.get(thing); + if (entry !== undefined) { + return entry; + } + const newNode = new WeakTupleMap(); + this.w.set(thing, newNode); + return newNode; + } else { + if ((this.f & 2) !== 2) { + const newMap = new Map(); + this.f |= 2; + const newNode = new WeakTupleMap(); + (this.m = newMap).set(thing, newNode); + return newNode; + } + const entry = this.m.get(thing); + if (entry !== undefined) { + return entry; + } + const newNode = new WeakTupleMap(); + this.m.set(thing, newNode); + return newNode; + } } +} - /** - * @returns {string} runtime code - */ - generate() { - const { chunkGraph, compilation, chunk } = this; - const { - runtimeTemplate, - outputOptions: { - chunkLoadingGlobal, - hotUpdateGlobal, - crossOriginLoading, - scriptType - } - } = compilation; - const globalObject = runtimeTemplate.globalObject; - const { linkPreload, linkPrefetch } = - JsonpChunkLoadingRuntimeModule.getCompilationHooks(compilation); - const fn = RuntimeGlobals.ensureChunkHandlers; - const withBaseURI = this._runtimeRequirements.has(RuntimeGlobals.baseURI); - const withLoading = this._runtimeRequirements.has( - RuntimeGlobals.ensureChunkHandlers - ); - const withCallback = this._runtimeRequirements.has( - RuntimeGlobals.chunkCallback - ); - const withOnChunkLoad = this._runtimeRequirements.has( - RuntimeGlobals.onChunksLoaded - ); - const withHmr = this._runtimeRequirements.has( - RuntimeGlobals.hmrDownloadUpdateHandlers - ); - const withHmrManifest = this._runtimeRequirements.has( - RuntimeGlobals.hmrDownloadManifest - ); - const withPrefetch = this._runtimeRequirements.has( - RuntimeGlobals.prefetchChunkHandlers - ); - const withPreload = this._runtimeRequirements.has( - RuntimeGlobals.preloadChunkHandlers - ); - const chunkLoadingGlobalExpr = `${globalObject}[${JSON.stringify( - chunkLoadingGlobal - )}]`; - const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs); - const hasJsMatcher = compileBooleanMatcher(conditionMap); - const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); +module.exports = WeakTupleMap; - const stateExpression = withHmr - ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_jsonp` - : undefined; - return Template.asString([ - withBaseURI - ? Template.asString([ - `${RuntimeGlobals.baseURI} = document.baseURI || self.location.href;` - ]) - : "// no baseURI", - "", - "// object to store loaded and loading chunks", - "// undefined = chunk not loaded, null = chunk preloaded/prefetched", - "// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded", - `var installedChunks = ${ - stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" - }{`, - Template.indent( - Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join( - ",\n" - ) - ), - "};", - "", - withLoading - ? Template.asString([ - `${fn}.j = ${runtimeTemplate.basicFunction( - "chunkId, promises", - hasJsMatcher !== false - ? Template.indent([ - "// JSONP chunk loading for javascript", - `var installedChunkData = ${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;`, - 'if(installedChunkData !== 0) { // 0 means "already installed".', - Template.indent([ - "", - '// a Promise means "currently loading".', - "if(installedChunkData) {", - Template.indent([ - "promises.push(installedChunkData[2]);" - ]), - "} else {", - Template.indent([ - hasJsMatcher === true - ? "if(true) { // all chunks have JS" - : `if(${hasJsMatcher("chunkId")}) {`, - Template.indent([ - "// setup Promise in chunk cache", - `var promise = new Promise(${runtimeTemplate.expressionFunction( - `installedChunkData = installedChunks[chunkId] = [resolve, reject]`, - "resolve, reject" - )});`, - "promises.push(installedChunkData[2] = promise);", - "", - "// start chunk loading", - `var url = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId);`, - "// create error before stack unwound to get useful stacktrace later", - "var error = new Error();", - `var loadingEnded = ${runtimeTemplate.basicFunction( - "event", - [ - `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId)) {`, - Template.indent([ - "installedChunkData = installedChunks[chunkId];", - "if(installedChunkData !== 0) installedChunks[chunkId] = undefined;", - "if(installedChunkData) {", - Template.indent([ - "var errorType = event && (event.type === 'load' ? 'missing' : event.type);", - "var realSrc = event && event.target && event.target.src;", - "error.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", - "error.name = 'ChunkLoadError';", - "error.type = errorType;", - "error.request = realSrc;", - "installedChunkData[1](error);" - ]), - "}" - ]), - "}" - ] - )};`, - `${RuntimeGlobals.loadScript}(url, loadingEnded, "chunk-" + chunkId, chunkId);` - ]), - "} else installedChunks[chunkId] = 0;" - ]), - "}" - ]), - "}" - ]) - : Template.indent(["installedChunks[chunkId] = 0;"]) - )};` - ]) - : "// no chunk on demand loading", - "", - withPrefetch && hasJsMatcher !== false - ? `${ - RuntimeGlobals.prefetchChunkHandlers - }.j = ${runtimeTemplate.basicFunction("chunkId", [ - `if((!${ - RuntimeGlobals.hasOwnProperty - }(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && ${ - hasJsMatcher === true ? "true" : hasJsMatcher("chunkId") - }) {`, - Template.indent([ - "installedChunks[chunkId] = null;", - linkPrefetch.call( - Template.asString([ - "var link = document.createElement('link');", - crossOriginLoading - ? `link.crossOrigin = ${JSON.stringify( - crossOriginLoading - )};` - : "", - `if (${RuntimeGlobals.scriptNonce}) {`, - Template.indent( - `link.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});` - ), - "}", - 'link.rel = "prefetch";', - 'link.as = "script";', - `link.href = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId);` - ]), - chunk - ), - "document.head.appendChild(link);" - ]), - "}" - ])};` - : "// no prefetching", - "", - withPreload && hasJsMatcher !== false - ? `${ - RuntimeGlobals.preloadChunkHandlers - }.j = ${runtimeTemplate.basicFunction("chunkId", [ - `if((!${ - RuntimeGlobals.hasOwnProperty - }(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && ${ - hasJsMatcher === true ? "true" : hasJsMatcher("chunkId") - }) {`, - Template.indent([ - "installedChunks[chunkId] = null;", - linkPreload.call( - Template.asString([ - "var link = document.createElement('link');", - scriptType - ? `link.type = ${JSON.stringify(scriptType)};` - : "", - "link.charset = 'utf-8';", - `if (${RuntimeGlobals.scriptNonce}) {`, - Template.indent( - `link.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});` - ), - "}", - 'link.rel = "preload";', - 'link.as = "script";', - `link.href = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId);`, - crossOriginLoading - ? Template.asString([ - "if (link.href.indexOf(window.location.origin + '/') !== 0) {", - Template.indent( - `link.crossOrigin = ${JSON.stringify( - crossOriginLoading - )};` - ), - "}" - ]) - : "" - ]), - chunk - ), - "document.head.appendChild(link);" - ]), - "}" - ])};` - : "// no preloaded", - "", - withHmr - ? Template.asString([ - "var currentUpdatedModulesList;", - "var waitingUpdateResolves = {};", - "function loadUpdateChunk(chunkId) {", - Template.indent([ - `return new Promise(${runtimeTemplate.basicFunction( - "resolve, reject", - [ - "waitingUpdateResolves[chunkId] = resolve;", - "// start update chunk loading", - `var url = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId);`, - "// create error before stack unwound to get useful stacktrace later", - "var error = new Error();", - `var loadingEnded = ${runtimeTemplate.basicFunction("event", [ - "if(waitingUpdateResolves[chunkId]) {", - Template.indent([ - "waitingUpdateResolves[chunkId] = undefined", - "var errorType = event && (event.type === 'load' ? 'missing' : event.type);", - "var realSrc = event && event.target && event.target.src;", - "error.message = 'Loading hot update chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", - "error.name = 'ChunkLoadError';", - "error.type = errorType;", - "error.request = realSrc;", - "reject(error);" - ]), - "}" - ])};`, - `${RuntimeGlobals.loadScript}(url, loadingEnded);` - ] - )});` - ]), - "}", - "", - `${globalObject}[${JSON.stringify( - hotUpdateGlobal - )}] = ${runtimeTemplate.basicFunction( - "chunkId, moreModules, runtime", - [ - "for(var moduleId in moreModules) {", - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, - Template.indent([ - "currentUpdate[moduleId] = moreModules[moduleId];", - "if(currentUpdatedModulesList) currentUpdatedModulesList.push(moduleId);" - ]), - "}" - ]), - "}", - "if(runtime) currentUpdateRuntime.push(runtime);", - "if(waitingUpdateResolves[chunkId]) {", - Template.indent([ - "waitingUpdateResolves[chunkId]();", - "waitingUpdateResolves[chunkId] = undefined;" - ]), - "}" - ] - )};`, - "", - Template.getFunctionContent( - require('./JavascriptHotModuleReplacement.runtime.js') - ) - .replace(/\$key\$/g, "jsonp") - .replace(/\$installedChunks\$/g, "installedChunks") - .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") - .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) - .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) - .replace( - /\$ensureChunkHandlers\$/g, - RuntimeGlobals.ensureChunkHandlers - ) - .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) - .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) - .replace( - /\$hmrDownloadUpdateHandlers\$/g, - RuntimeGlobals.hmrDownloadUpdateHandlers - ) - .replace( - /\$hmrInvalidateModuleHandlers\$/g, - RuntimeGlobals.hmrInvalidateModuleHandlers - ) - ]) - : "// no HMR", - "", - withHmrManifest - ? Template.asString([ - `${ - RuntimeGlobals.hmrDownloadManifest - } = ${runtimeTemplate.basicFunction("", [ - 'if (typeof fetch === "undefined") throw new Error("No browser support: need fetch API");', - `return fetch(${RuntimeGlobals.publicPath} + ${ - RuntimeGlobals.getUpdateManifestFilename - }()).then(${runtimeTemplate.basicFunction("response", [ - "if(response.status === 404) return; // no update available", - 'if(!response.ok) throw new Error("Failed to fetch update manifest " + response.statusText);', - "return response.json();" - ])});` - ])};` - ]) - : "// no HMR manifest", - "", - withOnChunkLoad - ? `${ - RuntimeGlobals.onChunksLoaded - }.j = ${runtimeTemplate.returningFunction( - "installedChunks[chunkId] === 0", - "chunkId" - )};` - : "// no on chunks loaded", - "", - withCallback || withLoading - ? Template.asString([ - "// install a JSONP callback for chunk loading", - `var webpackJsonpCallback = ${runtimeTemplate.basicFunction( - "parentChunkLoadingFunction, data", - [ - runtimeTemplate.destructureArray( - ["chunkIds", "moreModules", "runtime"], - "data" - ), - '// add "moreModules" to the modules object,', - '// then flag all "chunkIds" as loaded and fire callback', - "var moduleId, chunkId, i = 0;", - `if(chunkIds.some(${runtimeTemplate.returningFunction( - "installedChunks[id] !== 0", - "id" - )})) {`, - Template.indent([ - "for(moduleId in moreModules) {", - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, - Template.indent( - `${RuntimeGlobals.moduleFactories}[moduleId] = moreModules[moduleId];` - ), - "}" - ]), - "}", - "if(runtime) var result = runtime(__webpack_require__);" - ]), - "}", - "if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);", - "for(;i < chunkIds.length; i++) {", - Template.indent([ - "chunkId = chunkIds[i];", - `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) && installedChunks[chunkId]) {`, - Template.indent("installedChunks[chunkId][0]();"), - "}", - "installedChunks[chunkId] = 0;" - ]), - "}", - withOnChunkLoad - ? `return ${RuntimeGlobals.onChunksLoaded}(result);` - : "" - ] - )}`, - "", - `var chunkLoadingGlobal = ${chunkLoadingGlobalExpr} = ${chunkLoadingGlobalExpr} || [];`, - "chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));", - "chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));" - ]) - : "// no jsonp function" - ]); +/***/ }), + +/***/ 92229: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Mikola Lysenko @mikolalysenko +*/ + + + +/* cspell:disable-next-line */ +// Refactor: Peter Somogyvari @petermetz + +const compileSearch = (funcName, predicate, reversed, extraArgs, earlyOut) => { + const code = [ + "function ", + funcName, + "(a,l,h,", + extraArgs.join(","), + "){", + earlyOut ? "" : "var i=", + reversed ? "l-1" : "h+1", + ";while(l<=h){var m=(l+h)>>>1,x=a[m]" + ]; + + if (earlyOut) { + if (predicate.indexOf("c") < 0) { + code.push(";if(x===y){return m}else if(x<=y){"); + } else { + code.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"); + } + } else { + code.push(";if(", predicate, "){i=m;"); } -} + if (reversed) { + code.push("l=m+1}else{h=m-1}"); + } else { + code.push("h=m-1}else{l=m+1}"); + } + code.push("}"); + if (earlyOut) { + code.push("return -1};"); + } else { + code.push("return i};"); + } + return code.join(""); +}; -module.exports = JsonpChunkLoadingRuntimeModule; +const compileBoundsSearch = (predicate, reversed, suffix, earlyOut) => { + const arg1 = compileSearch( + "A", + "x" + predicate + "y", + reversed, + ["y"], + earlyOut + ); + + const arg2 = compileSearch( + "P", + "c(x,y)" + predicate + "0", + reversed, + ["y", "c"], + earlyOut + ); + + const fnHeader = "function dispatchBinarySearch"; + + const fnBody = + "(a,y,c,l,h){\ +if(typeof(c)==='function'){\ +return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)\ +}else{\ +return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)\ +}}\ +return dispatchBinarySearch"; + + const fnArgList = [arg1, arg2, fnHeader, suffix, fnBody, suffix]; + const fnSource = fnArgList.join(""); + const result = new Function(fnSource); + return result(); +}; + +module.exports = { + ge: compileBoundsSearch(">=", false, "GE"), + gt: compileBoundsSearch(">", false, "GT"), + lt: compileBoundsSearch("<", true, "LT"), + le: compileBoundsSearch("<=", true, "LE"), + eq: compileBoundsSearch("-", true, "EQ", true) +}; /***/ }), -/***/ 4607: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 60839: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* @@ -133145,43 +130990,573 @@ module.exports = JsonpChunkLoadingRuntimeModule; -const ArrayPushCallbackChunkFormatPlugin = __webpack_require__(18535); -const EnableChunkLoadingPlugin = __webpack_require__(61291); -const JsonpChunkLoadingRuntimeModule = __webpack_require__(84154); +/** @type {WeakMap>} */ +const mergeCache = new WeakMap(); +/** @type {WeakMap>>} */ +const setPropertyCache = new WeakMap(); +const DELETE = Symbol("DELETE"); +const DYNAMIC_INFO = Symbol("cleverMerge dynamic info"); + +/** + * Merges two given objects and caches the result to avoid computation if same objects passed as arguments again. + * @template T + * @template O + * @example + * // performs cleverMerge(first, second), stores the result in WeakMap and returns result + * cachedCleverMerge({a: 1}, {a: 2}) + * {a: 2} + * // when same arguments passed, gets the result from WeakMap and returns it. + * cachedCleverMerge({a: 1}, {a: 2}) + * {a: 2} + * @param {T} first first object + * @param {O} second second object + * @returns {T & O | T | O} merged object of first and second object + */ +const cachedCleverMerge = (first, second) => { + if (second === undefined) return first; + if (first === undefined) return second; + if (typeof second !== "object" || second === null) return second; + if (typeof first !== "object" || first === null) return first; + + let innerCache = mergeCache.get(first); + if (innerCache === undefined) { + innerCache = new WeakMap(); + mergeCache.set(first, innerCache); + } + const prevMerge = innerCache.get(second); + if (prevMerge !== undefined) return prevMerge; + const newMerge = _cleverMerge(first, second, true); + innerCache.set(second, newMerge); + return newMerge; +}; + +/** + * @template T + * @param {Partial} obj object + * @param {string} property property + * @param {string|number|boolean} value assignment value + * @returns {T} new object + */ +const cachedSetProperty = (obj, property, value) => { + let mapByProperty = setPropertyCache.get(obj); + + if (mapByProperty === undefined) { + mapByProperty = new Map(); + setPropertyCache.set(obj, mapByProperty); + } + + let mapByValue = mapByProperty.get(property); + + if (mapByValue === undefined) { + mapByValue = new Map(); + mapByProperty.set(property, mapByValue); + } + + let result = mapByValue.get(value); + + if (result) return result; + + result = { + ...obj, + [property]: value + }; + mapByValue.set(value, result); + + return result; +}; + +/** + * @typedef {Object} ObjectParsedPropertyEntry + * @property {any | undefined} base base value + * @property {string | undefined} byProperty the name of the selector property + * @property {Map} byValues value depending on selector property, merged with base + */ + +/** + * @typedef {Object} ParsedObject + * @property {Map} static static properties (key is property name) + * @property {{ byProperty: string, fn: Function } | undefined} dynamic dynamic part + */ + +/** @type {WeakMap} */ +const parseCache = new WeakMap(); + +/** + * @param {object} obj the object + * @returns {ParsedObject} parsed object + */ +const cachedParseObject = obj => { + const entry = parseCache.get(obj); + if (entry !== undefined) return entry; + const result = parseObject(obj); + parseCache.set(obj, result); + return result; +}; + +/** + * @param {object} obj the object + * @returns {ParsedObject} parsed object + */ +const parseObject = obj => { + const info = new Map(); + let dynamicInfo; + const getInfo = p => { + const entry = info.get(p); + if (entry !== undefined) return entry; + const newEntry = { + base: undefined, + byProperty: undefined, + byValues: undefined + }; + info.set(p, newEntry); + return newEntry; + }; + for (const key of Object.keys(obj)) { + if (key.startsWith("by")) { + const byProperty = key; + const byObj = obj[byProperty]; + if (typeof byObj === "object") { + for (const byValue of Object.keys(byObj)) { + const obj = byObj[byValue]; + for (const key of Object.keys(obj)) { + const entry = getInfo(key); + if (entry.byProperty === undefined) { + entry.byProperty = byProperty; + entry.byValues = new Map(); + } else if (entry.byProperty !== byProperty) { + throw new Error( + `${byProperty} and ${entry.byProperty} for a single property is not supported` + ); + } + entry.byValues.set(byValue, obj[key]); + if (byValue === "default") { + for (const otherByValue of Object.keys(byObj)) { + if (!entry.byValues.has(otherByValue)) + entry.byValues.set(otherByValue, undefined); + } + } + } + } + } else if (typeof byObj === "function") { + if (dynamicInfo === undefined) { + dynamicInfo = { + byProperty: key, + fn: byObj + }; + } else { + throw new Error( + `${key} and ${dynamicInfo.byProperty} when both are functions is not supported` + ); + } + } else { + const entry = getInfo(key); + entry.base = obj[key]; + } + } else { + const entry = getInfo(key); + entry.base = obj[key]; + } + } + return { + static: info, + dynamic: dynamicInfo + }; +}; + +/** + * @param {Map} info static properties (key is property name) + * @param {{ byProperty: string, fn: Function } | undefined} dynamicInfo dynamic part + * @returns {object} the object + */ +const serializeObject = (info, dynamicInfo) => { + const obj = {}; + // Setup byProperty structure + for (const entry of info.values()) { + if (entry.byProperty !== undefined) { + const byObj = (obj[entry.byProperty] = obj[entry.byProperty] || {}); + for (const byValue of entry.byValues.keys()) { + byObj[byValue] = byObj[byValue] || {}; + } + } + } + for (const [key, entry] of info) { + if (entry.base !== undefined) { + obj[key] = entry.base; + } + // Fill byProperty structure + if (entry.byProperty !== undefined) { + const byObj = (obj[entry.byProperty] = obj[entry.byProperty] || {}); + for (const byValue of Object.keys(byObj)) { + const value = getFromByValues(entry.byValues, byValue); + if (value !== undefined) byObj[byValue][key] = value; + } + } + } + if (dynamicInfo !== undefined) { + obj[dynamicInfo.byProperty] = dynamicInfo.fn; + } + return obj; +}; + +const VALUE_TYPE_UNDEFINED = 0; +const VALUE_TYPE_ATOM = 1; +const VALUE_TYPE_ARRAY_EXTEND = 2; +const VALUE_TYPE_OBJECT = 3; +const VALUE_TYPE_DELETE = 4; + +/** + * @param {any} value a single value + * @returns {VALUE_TYPE_UNDEFINED | VALUE_TYPE_ATOM | VALUE_TYPE_ARRAY_EXTEND | VALUE_TYPE_OBJECT | VALUE_TYPE_DELETE} value type + */ +const getValueType = value => { + if (value === undefined) { + return VALUE_TYPE_UNDEFINED; + } else if (value === DELETE) { + return VALUE_TYPE_DELETE; + } else if (Array.isArray(value)) { + if (value.lastIndexOf("...") !== -1) return VALUE_TYPE_ARRAY_EXTEND; + return VALUE_TYPE_ATOM; + } else if ( + typeof value === "object" && + value !== null && + (!value.constructor || value.constructor === Object) + ) { + return VALUE_TYPE_OBJECT; + } + return VALUE_TYPE_ATOM; +}; + +/** + * Merges two objects. Objects are deeply clever merged. + * Arrays might reference the old value with "...". + * Non-object values take preference over object values. + * @template T + * @template O + * @param {T} first first object + * @param {O} second second object + * @returns {T & O | T | O} merged object of first and second object + */ +const cleverMerge = (first, second) => { + if (second === undefined) return first; + if (first === undefined) return second; + if (typeof second !== "object" || second === null) return second; + if (typeof first !== "object" || first === null) return first; + + return _cleverMerge(first, second, false); +}; + +/** + * Merges two objects. Objects are deeply clever merged. + * @param {object} first first object + * @param {object} second second object + * @param {boolean} internalCaching should parsing of objects and nested merges be cached + * @returns {object} merged object of first and second object + */ +const _cleverMerge = (first, second, internalCaching = false) => { + const firstObject = internalCaching + ? cachedParseObject(first) + : parseObject(first); + const { static: firstInfo, dynamic: firstDynamicInfo } = firstObject; + + // If the first argument has a dynamic part we modify the dynamic part to merge the second argument + if (firstDynamicInfo !== undefined) { + let { byProperty, fn } = firstDynamicInfo; + const fnInfo = fn[DYNAMIC_INFO]; + if (fnInfo) { + second = internalCaching + ? cachedCleverMerge(fnInfo[1], second) + : cleverMerge(fnInfo[1], second); + fn = fnInfo[0]; + } + const newFn = (...args) => { + const fnResult = fn(...args); + return internalCaching + ? cachedCleverMerge(fnResult, second) + : cleverMerge(fnResult, second); + }; + newFn[DYNAMIC_INFO] = [fn, second]; + return serializeObject(firstObject.static, { byProperty, fn: newFn }); + } + + // If the first part is static only, we merge the static parts and keep the dynamic part of the second argument + const secondObject = internalCaching + ? cachedParseObject(second) + : parseObject(second); + const { static: secondInfo, dynamic: secondDynamicInfo } = secondObject; + /** @type {Map} */ + const resultInfo = new Map(); + for (const [key, firstEntry] of firstInfo) { + const secondEntry = secondInfo.get(key); + const entry = + secondEntry !== undefined + ? mergeEntries(firstEntry, secondEntry, internalCaching) + : firstEntry; + resultInfo.set(key, entry); + } + for (const [key, secondEntry] of secondInfo) { + if (!firstInfo.has(key)) { + resultInfo.set(key, secondEntry); + } + } + return serializeObject(resultInfo, secondDynamicInfo); +}; + +/** + * @param {ObjectParsedPropertyEntry} firstEntry a + * @param {ObjectParsedPropertyEntry} secondEntry b + * @param {boolean} internalCaching should parsing of objects and nested merges be cached + * @returns {ObjectParsedPropertyEntry} new entry + */ +const mergeEntries = (firstEntry, secondEntry, internalCaching) => { + switch (getValueType(secondEntry.base)) { + case VALUE_TYPE_ATOM: + case VALUE_TYPE_DELETE: + // No need to consider firstEntry at all + // second value override everything + // = second.base + second.byProperty + return secondEntry; + case VALUE_TYPE_UNDEFINED: + if (!firstEntry.byProperty) { + // = first.base + second.byProperty + return { + base: firstEntry.base, + byProperty: secondEntry.byProperty, + byValues: secondEntry.byValues + }; + } else if (firstEntry.byProperty !== secondEntry.byProperty) { + throw new Error( + `${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported` + ); + } else { + // = first.base + (first.byProperty + second.byProperty) + // need to merge first and second byValues + const newByValues = new Map(firstEntry.byValues); + for (const [key, value] of secondEntry.byValues) { + const firstValue = getFromByValues(firstEntry.byValues, key); + newByValues.set( + key, + mergeSingleValue(firstValue, value, internalCaching) + ); + } + return { + base: firstEntry.base, + byProperty: firstEntry.byProperty, + byValues: newByValues + }; + } + default: { + if (!firstEntry.byProperty) { + // The simple case + // = (first.base + second.base) + second.byProperty + return { + base: mergeSingleValue( + firstEntry.base, + secondEntry.base, + internalCaching + ), + byProperty: secondEntry.byProperty, + byValues: secondEntry.byValues + }; + } + let newBase; + const intermediateByValues = new Map(firstEntry.byValues); + for (const [key, value] of intermediateByValues) { + intermediateByValues.set( + key, + mergeSingleValue(value, secondEntry.base, internalCaching) + ); + } + if ( + Array.from(firstEntry.byValues.values()).every(value => { + const type = getValueType(value); + return type === VALUE_TYPE_ATOM || type === VALUE_TYPE_DELETE; + }) + ) { + // = (first.base + second.base) + ((first.byProperty + second.base) + second.byProperty) + newBase = mergeSingleValue( + firstEntry.base, + secondEntry.base, + internalCaching + ); + } else { + // = first.base + ((first.byProperty (+default) + second.base) + second.byProperty) + newBase = firstEntry.base; + if (!intermediateByValues.has("default")) + intermediateByValues.set("default", secondEntry.base); + } + if (!secondEntry.byProperty) { + // = first.base + (first.byProperty + second.base) + return { + base: newBase, + byProperty: firstEntry.byProperty, + byValues: intermediateByValues + }; + } else if (firstEntry.byProperty !== secondEntry.byProperty) { + throw new Error( + `${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported` + ); + } + const newByValues = new Map(intermediateByValues); + for (const [key, value] of secondEntry.byValues) { + const firstValue = getFromByValues(intermediateByValues, key); + newByValues.set( + key, + mergeSingleValue(firstValue, value, internalCaching) + ); + } + return { + base: newBase, + byProperty: firstEntry.byProperty, + byValues: newByValues + }; + } + } +}; + +/** + * @param {Map} byValues all values + * @param {string} key value of the selector + * @returns {any | undefined} value + */ +const getFromByValues = (byValues, key) => { + if (key !== "default" && byValues.has(key)) { + return byValues.get(key); + } + return byValues.get("default"); +}; -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Compiler")} Compiler */ +/** + * @param {any} a value + * @param {any} b value + * @param {boolean} internalCaching should parsing of objects and nested merges be cached + * @returns {any} value + */ +const mergeSingleValue = (a, b, internalCaching) => { + const bType = getValueType(b); + const aType = getValueType(a); + switch (bType) { + case VALUE_TYPE_DELETE: + case VALUE_TYPE_ATOM: + return b; + case VALUE_TYPE_OBJECT: { + return aType !== VALUE_TYPE_OBJECT + ? b + : internalCaching + ? cachedCleverMerge(a, b) + : cleverMerge(a, b); + } + case VALUE_TYPE_UNDEFINED: + return a; + case VALUE_TYPE_ARRAY_EXTEND: + switch ( + aType !== VALUE_TYPE_ATOM + ? aType + : Array.isArray(a) + ? VALUE_TYPE_ARRAY_EXTEND + : VALUE_TYPE_OBJECT + ) { + case VALUE_TYPE_UNDEFINED: + return b; + case VALUE_TYPE_DELETE: + return b.filter(item => item !== "..."); + case VALUE_TYPE_ARRAY_EXTEND: { + const newArray = []; + for (const item of b) { + if (item === "...") { + for (const item of a) { + newArray.push(item); + } + } else { + newArray.push(item); + } + } + return newArray; + } + case VALUE_TYPE_OBJECT: + return b.map(item => (item === "..." ? a : item)); + default: + throw new Error("Not implemented"); + } + default: + throw new Error("Not implemented"); + } +}; -class JsonpTemplatePlugin { - /** - * @deprecated use JsonpChunkLoadingRuntimeModule.getCompilationHooks instead - * @param {Compilation} compilation the compilation - * @returns {JsonpChunkLoadingRuntimeModule.JsonpCompilationPluginHooks} hooks - */ - static getCompilationHooks(compilation) { - return JsonpChunkLoadingRuntimeModule.getCompilationHooks(compilation); +/** + * @template T + * @param {T} obj the object + * @returns {T} the object without operations like "..." or DELETE + */ +const removeOperations = obj => { + const newObj = /** @type {T} */ ({}); + for (const key of Object.keys(obj)) { + const value = obj[key]; + const type = getValueType(value); + switch (type) { + case VALUE_TYPE_UNDEFINED: + case VALUE_TYPE_DELETE: + break; + case VALUE_TYPE_OBJECT: + newObj[key] = removeOperations(value); + break; + case VALUE_TYPE_ARRAY_EXTEND: + newObj[key] = value.filter(i => i !== "..."); + break; + default: + newObj[key] = value; + break; + } } + return newObj; +}; - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.options.output.chunkLoading = "jsonp"; - new ArrayPushCallbackChunkFormatPlugin().apply(compiler); - new EnableChunkLoadingPlugin("jsonp").apply(compiler); +/** + * @template T + * @template {string} P + * @param {T} obj the object + * @param {P} byProperty the by description + * @param {...any} values values + * @returns {Omit} object with merged byProperty + */ +const resolveByProperty = (obj, byProperty, ...values) => { + if (typeof obj !== "object" || obj === null || !(byProperty in obj)) { + return obj; } -} + const { [byProperty]: _byValue, ..._remaining } = /** @type {object} */ (obj); + const remaining = /** @type {T} */ (_remaining); + const byValue = /** @type {Record | function(...any[]): T} */ ( + _byValue + ); + if (typeof byValue === "object") { + const key = values[0]; + if (key in byValue) { + return cachedCleverMerge(remaining, byValue[key]); + } else if ("default" in byValue) { + return cachedCleverMerge(remaining, byValue.default); + } else { + return /** @type {T} */ (remaining); + } + } else if (typeof byValue === "function") { + const result = byValue.apply(null, values); + return cachedCleverMerge( + remaining, + resolveByProperty(result, byProperty, ...values) + ); + } +}; -module.exports = JsonpTemplatePlugin; +exports.cachedSetProperty = cachedSetProperty; +exports.cachedCleverMerge = cachedCleverMerge; +exports.cleverMerge = cleverMerge; +exports.resolveByProperty = resolveByProperty; +exports.removeOperations = removeOperations; +exports.DELETE = DELETE; /***/ }), -/***/ 36243: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 29579: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -133191,514 +131566,464 @@ module.exports = JsonpTemplatePlugin; -const util = __webpack_require__(73837); -const webpackOptionsSchemaCheck = __webpack_require__(10382); -const webpackOptionsSchema = __webpack_require__(73342); -const Compiler = __webpack_require__(70845); -const MultiCompiler = __webpack_require__(33370); -const WebpackOptionsApply = __webpack_require__(88422); -const { - applyWebpackOptionsDefaults, - applyWebpackOptionsBaseDefaults -} = __webpack_require__(92988); -const { getNormalizedWebpackOptions } = __webpack_require__(26693); -const NodeEnvironmentPlugin = __webpack_require__(7553); -const memoize = __webpack_require__(78676); +const { compareRuntime } = __webpack_require__(17156); -/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} WebpackOptions */ -/** @typedef {import("./Compiler").WatchOptions} WatchOptions */ -/** @typedef {import("./MultiCompiler").MultiCompilerOptions} MultiCompilerOptions */ -/** @typedef {import("./MultiStats")} MultiStats */ -/** @typedef {import("./Stats")} Stats */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ +/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ -const getValidateSchema = memoize(() => __webpack_require__(12047)); +/** @template T @typedef {function(T, T): -1|0|1} Comparator */ +/** @template TArg @template T @typedef {function(TArg, T, T): -1|0|1} RawParameterizedComparator */ +/** @template TArg @template T @typedef {function(TArg): Comparator} ParameterizedComparator */ /** * @template T - * @callback Callback - * @param {Error=} err - * @param {T=} stats - * @returns {void} + * @param {RawParameterizedComparator} fn comparator with argument + * @returns {ParameterizedComparator} comparator */ +const createCachedParameterizedComparator = fn => { + /** @type {WeakMap>} */ + const map = new WeakMap(); + return arg => { + const cachedResult = map.get(arg); + if (cachedResult !== undefined) return cachedResult; + /** + * @param {T} a first item + * @param {T} b second item + * @returns {-1|0|1} compare result + */ + const result = fn.bind(null, arg); + map.set(arg, result); + return result; + }; +}; /** - * @param {ReadonlyArray} childOptions options array - * @param {MultiCompilerOptions} options options - * @returns {MultiCompiler} a multi-compiler + * @param {Chunk} a chunk + * @param {Chunk} b chunk + * @returns {-1|0|1} compare result */ -const createMultiCompiler = (childOptions, options) => { - const compilers = childOptions.map(options => createCompiler(options)); - const compiler = new MultiCompiler(compilers, options); - for (const childCompiler of compilers) { - if (childCompiler.options.dependencies) { - compiler.setDependencies( - childCompiler, - childCompiler.options.dependencies - ); - } +exports.compareChunksById = (a, b) => { + return compareIds(a.id, b.id); +}; + +/** + * @param {Module} a module + * @param {Module} b module + * @returns {-1|0|1} compare result + */ +exports.compareModulesByIdentifier = (a, b) => { + return compareIds(a.identifier(), b.identifier()); +}; + +/** + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {Module} a module + * @param {Module} b module + * @returns {-1|0|1} compare result + */ +const compareModulesById = (chunkGraph, a, b) => { + return compareIds(chunkGraph.getModuleId(a), chunkGraph.getModuleId(b)); +}; +/** @type {ParameterizedComparator} */ +exports.compareModulesById = + createCachedParameterizedComparator(compareModulesById); + +/** + * @param {number} a number + * @param {number} b number + * @returns {-1|0|1} compare result + */ +const compareNumbers = (a, b) => { + if (typeof a !== typeof b) { + return typeof a < typeof b ? -1 : 1; } - return compiler; + if (a < b) return -1; + if (a > b) return 1; + return 0; }; +exports.compareNumbers = compareNumbers; /** - * @param {WebpackOptions} rawOptions options object - * @returns {Compiler} a compiler + * @param {string} a string + * @param {string} b string + * @returns {-1|0|1} compare result */ -const createCompiler = rawOptions => { - const options = getNormalizedWebpackOptions(rawOptions); - applyWebpackOptionsBaseDefaults(options); - const compiler = new Compiler(options.context, options); - new NodeEnvironmentPlugin({ - infrastructureLogging: options.infrastructureLogging - }).apply(compiler); - if (Array.isArray(options.plugins)) { - for (const plugin of options.plugins) { - if (typeof plugin === "function") { - plugin.call(compiler, compiler); +const compareStringsNumeric = (a, b) => { + const partsA = a.split(/(\d+)/); + const partsB = b.split(/(\d+)/); + const len = Math.min(partsA.length, partsB.length); + for (let i = 0; i < len; i++) { + const pA = partsA[i]; + const pB = partsB[i]; + if (i % 2 === 0) { + if (pA.length > pB.length) { + if (pA.slice(0, pB.length) > pB) return 1; + return -1; + } else if (pB.length > pA.length) { + if (pB.slice(0, pA.length) > pA) return -1; + return 1; } else { - plugin.apply(compiler); + if (pA < pB) return -1; + if (pA > pB) return 1; } + } else { + const nA = +pA; + const nB = +pB; + if (nA < nB) return -1; + if (nA > nB) return 1; } } - applyWebpackOptionsDefaults(options); - compiler.hooks.environment.call(); - compiler.hooks.afterEnvironment.call(); - new WebpackOptionsApply().process(options, compiler); - compiler.hooks.initialize.call(); - return compiler; + if (partsB.length < partsA.length) return 1; + if (partsB.length > partsA.length) return -1; + return 0; }; +exports.compareStringsNumeric = compareStringsNumeric; /** - * @callback WebpackFunctionSingle - * @param {WebpackOptions} options options object - * @param {Callback=} callback callback - * @returns {Compiler} the compiler object + * @param {ModuleGraph} moduleGraph the module graph + * @param {Module} a module + * @param {Module} b module + * @returns {-1|0|1} compare result */ +const compareModulesByPostOrderIndexOrIdentifier = (moduleGraph, a, b) => { + const cmp = compareNumbers( + moduleGraph.getPostOrderIndex(a), + moduleGraph.getPostOrderIndex(b) + ); + if (cmp !== 0) return cmp; + return compareIds(a.identifier(), b.identifier()); +}; +/** @type {ParameterizedComparator} */ +exports.compareModulesByPostOrderIndexOrIdentifier = + createCachedParameterizedComparator( + compareModulesByPostOrderIndexOrIdentifier + ); /** - * @callback WebpackFunctionMulti - * @param {ReadonlyArray & MultiCompilerOptions} options options objects - * @param {Callback=} callback callback - * @returns {MultiCompiler} the multi compiler object + * @param {ModuleGraph} moduleGraph the module graph + * @param {Module} a module + * @param {Module} b module + * @returns {-1|0|1} compare result */ +const compareModulesByPreOrderIndexOrIdentifier = (moduleGraph, a, b) => { + const cmp = compareNumbers( + moduleGraph.getPreOrderIndex(a), + moduleGraph.getPreOrderIndex(b) + ); + if (cmp !== 0) return cmp; + return compareIds(a.identifier(), b.identifier()); +}; +/** @type {ParameterizedComparator} */ +exports.compareModulesByPreOrderIndexOrIdentifier = + createCachedParameterizedComparator( + compareModulesByPreOrderIndexOrIdentifier + ); -const asArray = options => - Array.isArray(options) ? Array.from(options) : [options]; +/** + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {Module} a module + * @param {Module} b module + * @returns {-1|0|1} compare result + */ +const compareModulesByIdOrIdentifier = (chunkGraph, a, b) => { + const cmp = compareIds(chunkGraph.getModuleId(a), chunkGraph.getModuleId(b)); + if (cmp !== 0) return cmp; + return compareIds(a.identifier(), b.identifier()); +}; +/** @type {ParameterizedComparator} */ +exports.compareModulesByIdOrIdentifier = createCachedParameterizedComparator( + compareModulesByIdOrIdentifier +); + +/** + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {Chunk} a chunk + * @param {Chunk} b chunk + * @returns {-1|0|1} compare result + */ +const compareChunks = (chunkGraph, a, b) => { + return chunkGraph.compareChunks(a, b); +}; +/** @type {ParameterizedComparator} */ +exports.compareChunks = createCachedParameterizedComparator(compareChunks); + +/** + * @param {string|number} a first id + * @param {string|number} b second id + * @returns {-1|0|1} compare result + */ +const compareIds = (a, b) => { + if (typeof a !== typeof b) { + return typeof a < typeof b ? -1 : 1; + } + if (a < b) return -1; + if (a > b) return 1; + return 0; +}; + +exports.compareIds = compareIds; + +/** + * @param {string} a first string + * @param {string} b second string + * @returns {-1|0|1} compare result + */ +const compareStrings = (a, b) => { + if (a < b) return -1; + if (a > b) return 1; + return 0; +}; + +exports.compareStrings = compareStrings; + +/** + * @param {ChunkGroup} a first chunk group + * @param {ChunkGroup} b second chunk group + * @returns {-1|0|1} compare result + */ +const compareChunkGroupsByIndex = (a, b) => { + return a.index < b.index ? -1 : 1; +}; + +exports.compareChunkGroupsByIndex = compareChunkGroupsByIndex; + +/** + * @template K1 {Object} + * @template K2 + * @template T + */ +class TwoKeyWeakMap { + constructor() { + /** @private @type {WeakMap>} */ + this._map = new WeakMap(); + } -const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ ( /** - * @param {WebpackOptions | (ReadonlyArray & MultiCompilerOptions)} options options - * @param {Callback & Callback=} callback callback - * @returns {Compiler | MultiCompiler} + * @param {K1} key1 first key + * @param {K2} key2 second key + * @returns {T | undefined} value */ - (options, callback) => { - const create = () => { - if (!asArray(options).every(webpackOptionsSchemaCheck)) { - getValidateSchema()(webpackOptionsSchema, options); - util.deprecate( - () => {}, - "webpack bug: Pre-compiled schema reports error while real schema is happy. This has performance drawbacks.", - "DEP_WEBPACK_PRE_COMPILED_SCHEMA_INVALID" - )(); - } - /** @type {MultiCompiler|Compiler} */ - let compiler; - let watch = false; - /** @type {WatchOptions|WatchOptions[]} */ - let watchOptions; - if (Array.isArray(options)) { - /** @type {MultiCompiler} */ - compiler = createMultiCompiler( - options, - /** @type {MultiCompilerOptions} */ (options) - ); - watch = options.some(options => options.watch); - watchOptions = options.map(options => options.watchOptions || {}); - } else { - const webpackOptions = /** @type {WebpackOptions} */ (options); - /** @type {Compiler} */ - compiler = createCompiler(webpackOptions); - watch = webpackOptions.watch; - watchOptions = webpackOptions.watchOptions || {}; - } - return { compiler, watch, watchOptions }; - }; - if (callback) { - try { - const { compiler, watch, watchOptions } = create(); - if (watch) { - compiler.watch(watchOptions, callback); - } else { - compiler.run((err, stats) => { - compiler.close(err2 => { - callback(err || err2, stats); - }); - }); - } - return compiler; - } catch (err) { - process.nextTick(() => callback(err)); - return null; - } - } else { - const { compiler, watch } = create(); - if (watch) { - util.deprecate( - () => {}, - "A 'callback' argument needs to be provided to the 'webpack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.", - "DEP_WEBPACK_WATCH_WITHOUT_CALLBACK" - )(); - } - return compiler; + get(key1, key2) { + const childMap = this._map.get(key1); + if (childMap === undefined) { + return undefined; } + return childMap.get(key2); } -); - -module.exports = webpack; - - -/***/ }), - -/***/ 54182: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const StartupChunkDependenciesPlugin = __webpack_require__(22339); -const ImportScriptsChunkLoadingRuntimeModule = __webpack_require__(96952); - -/** @typedef {import("../Compiler")} Compiler */ -class ImportScriptsChunkLoadingPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {K1} key1 first key + * @param {K2} key2 second key + * @param {T | undefined} value new value * @returns {void} */ - apply(compiler) { - new StartupChunkDependenciesPlugin({ - chunkLoading: "import-scripts", - asyncChunkLoading: true - }).apply(compiler); - compiler.hooks.thisCompilation.tap( - "ImportScriptsChunkLoadingPlugin", - compilation => { - const globalChunkLoading = compilation.outputOptions.chunkLoading; - const isEnabledForChunk = chunk => { - const options = chunk.getEntryOptions(); - const chunkLoading = - options && options.chunkLoading !== undefined - ? options.chunkLoading - : globalChunkLoading; - return chunkLoading === "import-scripts"; - }; - const onceForChunkSet = new WeakSet(); - const handler = (chunk, set) => { - if (onceForChunkSet.has(chunk)) return; - onceForChunkSet.add(chunk); - if (!isEnabledForChunk(chunk)) return; - const withCreateScriptUrl = !!compilation.outputOptions.trustedTypes; - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - set.add(RuntimeGlobals.hasOwnProperty); - if (withCreateScriptUrl) { - set.add(RuntimeGlobals.createScriptUrl); - } - compilation.addRuntimeModule( - chunk, - new ImportScriptsChunkLoadingRuntimeModule(set, withCreateScriptUrl) - ); - }; - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("ImportScriptsChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadUpdateHandlers) - .tap("ImportScriptsChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadManifest) - .tap("ImportScriptsChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.baseURI) - .tap("ImportScriptsChunkLoadingPlugin", handler); - - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("ImportScriptsChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.publicPath); - set.add(RuntimeGlobals.getChunkScriptFilename); - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadUpdateHandlers) - .tap("ImportScriptsChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.publicPath); - set.add(RuntimeGlobals.getChunkUpdateScriptFilename); - set.add(RuntimeGlobals.moduleCache); - set.add(RuntimeGlobals.hmrModuleData); - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadManifest) - .tap("ImportScriptsChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.publicPath); - set.add(RuntimeGlobals.getUpdateManifestFilename); - }); - } - ); + set(key1, key2, value) { + let childMap = this._map.get(key1); + if (childMap === undefined) { + childMap = new WeakMap(); + this._map.set(key1, childMap); + } + childMap.set(key2, value); } } -module.exports = ImportScriptsChunkLoadingPlugin; - -/***/ }), - -/***/ 96952: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** @type {TwoKeyWeakMap, Comparator, Comparator>}} */ +const concatComparatorsCache = new TwoKeyWeakMap(); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ +/** + * @template T + * @param {Comparator} c1 comparator + * @param {Comparator} c2 comparator + * @param {Comparator[]} cRest comparators + * @returns {Comparator} comparator + */ +const concatComparators = (c1, c2, ...cRest) => { + if (cRest.length > 0) { + const [c3, ...cRest2] = cRest; + return concatComparators(c1, concatComparators(c2, c3, ...cRest2)); + } + const cacheEntry = /** @type {Comparator} */ ( + concatComparatorsCache.get(c1, c2) + ); + if (cacheEntry !== undefined) return cacheEntry; + /** + * @param {T} a first value + * @param {T} b second value + * @returns {-1|0|1} compare result + */ + const result = (a, b) => { + const res = c1(a, b); + if (res !== 0) return res; + return c2(a, b); + }; + concatComparatorsCache.set(c1, c2, result); + return result; +}; +exports.concatComparators = concatComparators; +/** @template A, B @typedef {(input: A) => B} Selector */ +/** @type {TwoKeyWeakMap, Comparator, Comparator>}} */ +const compareSelectCache = new TwoKeyWeakMap(); -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(1626); -const { - getChunkFilenameTemplate, - chunkHasJs -} = __webpack_require__(89464); -const { getInitialChunkIds } = __webpack_require__(98124); -const compileBooleanMatcher = __webpack_require__(29404); -const { getUndoPath } = __webpack_require__(82186); +/** + * @template T + * @template R + * @param {Selector} getter getter for value + * @param {Comparator} comparator comparator + * @returns {Comparator} comparator + */ +const compareSelect = (getter, comparator) => { + const cacheEntry = compareSelectCache.get(getter, comparator); + if (cacheEntry !== undefined) return cacheEntry; + /** + * @param {T} a first value + * @param {T} b second value + * @returns {-1|0|1} compare result + */ + const result = (a, b) => { + const aValue = getter(a); + const bValue = getter(b); + if (aValue !== undefined && aValue !== null) { + if (bValue !== undefined && bValue !== null) { + return comparator(aValue, bValue); + } + return -1; + } else { + if (bValue !== undefined && bValue !== null) { + return 1; + } + return 0; + } + }; + compareSelectCache.set(getter, comparator, result); + return result; +}; +exports.compareSelect = compareSelect; -class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule { - constructor(runtimeRequirements, withCreateScriptUrl) { - super("importScripts chunk loading", RuntimeModule.STAGE_ATTACH); - this.runtimeRequirements = runtimeRequirements; - this._withCreateScriptUrl = withCreateScriptUrl; - } +/** @type {WeakMap, Comparator>>} */ +const compareIteratorsCache = new WeakMap(); +/** + * @template T + * @param {Comparator} elementComparator comparator for elements + * @returns {Comparator>} comparator for iterables of elements + */ +const compareIterables = elementComparator => { + const cacheEntry = compareIteratorsCache.get(elementComparator); + if (cacheEntry !== undefined) return cacheEntry; /** - * @returns {string} runtime code + * @param {Iterable} a first value + * @param {Iterable} b second value + * @returns {-1|0|1} compare result */ - generate() { - const { - chunk, - chunkGraph, - compilation: { - runtimeTemplate, - outputOptions: { chunkLoadingGlobal, hotUpdateGlobal } - }, - _withCreateScriptUrl: withCreateScriptUrl - } = this; - const globalObject = runtimeTemplate.globalObject; - const fn = RuntimeGlobals.ensureChunkHandlers; - const withBaseURI = this.runtimeRequirements.has(RuntimeGlobals.baseURI); - const withLoading = this.runtimeRequirements.has( - RuntimeGlobals.ensureChunkHandlers - ); - const withHmr = this.runtimeRequirements.has( - RuntimeGlobals.hmrDownloadUpdateHandlers - ); - const withHmrManifest = this.runtimeRequirements.has( - RuntimeGlobals.hmrDownloadManifest - ); - const chunkLoadingGlobalExpr = `${globalObject}[${JSON.stringify( - chunkLoadingGlobal - )}]`; - const hasJsMatcher = compileBooleanMatcher( - chunkGraph.getChunkConditionMap(chunk, chunkHasJs) - ); - const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); - - const outputName = this.compilation.getPath( - getChunkFilenameTemplate(chunk, this.compilation.outputOptions), - { - chunk, - contentHashType: "javascript" + const result = (a, b) => { + const aI = a[Symbol.iterator](); + const bI = b[Symbol.iterator](); + // eslint-disable-next-line no-constant-condition + while (true) { + const aItem = aI.next(); + const bItem = bI.next(); + if (aItem.done) { + return bItem.done ? 0 : -1; + } else if (bItem.done) { + return 1; } - ); - const rootOutputDir = getUndoPath( - outputName, - this.compilation.outputOptions.path, - false - ); - - const stateExpression = withHmr - ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_importScripts` - : undefined; + const res = elementComparator(aItem.value, bItem.value); + if (res !== 0) return res; + } + }; + compareIteratorsCache.set(elementComparator, result); + return result; +}; +exports.compareIterables = compareIterables; - return Template.asString([ - withBaseURI - ? Template.asString([ - `${RuntimeGlobals.baseURI} = self.location + ${JSON.stringify( - rootOutputDir ? "/../" + rootOutputDir : "" - )};` - ]) - : "// no baseURI", - "", - "// object to store loaded chunks", - '// "1" means "already loaded"', - `var installedChunks = ${ - stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" - }{`, - Template.indent( - Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 1`).join( - ",\n" - ) - ), - "};", - "", - withLoading - ? Template.asString([ - "// importScripts chunk loading", - `var installChunk = ${runtimeTemplate.basicFunction("data", [ - runtimeTemplate.destructureArray( - ["chunkIds", "moreModules", "runtime"], - "data" - ), - "for(var moduleId in moreModules) {", - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, - Template.indent( - `${RuntimeGlobals.moduleFactories}[moduleId] = moreModules[moduleId];` - ), - "}" - ]), - "}", - "if(runtime) runtime(__webpack_require__);", - "while(chunkIds.length)", - Template.indent("installedChunks[chunkIds.pop()] = 1;"), - "parentChunkLoadingFunction(data);" - ])};` - ]) - : "// no chunk install function needed", - withLoading - ? Template.asString([ - `${fn}.i = ${runtimeTemplate.basicFunction( - "chunkId, promises", - hasJsMatcher !== false - ? [ - '// "1" is the signal for "already loaded"', - "if(!installedChunks[chunkId]) {", - Template.indent([ - hasJsMatcher === true - ? "if(true) { // all chunks have JS" - : `if(${hasJsMatcher("chunkId")}) {`, - Template.indent( - `importScripts(${ - withCreateScriptUrl - ? `${RuntimeGlobals.createScriptUrl}(${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId))` - : `${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId)` - });` - ), - "}" - ]), - "}" - ] - : "installedChunks[chunkId] = 1;" - )};`, - "", - `var chunkLoadingGlobal = ${chunkLoadingGlobalExpr} = ${chunkLoadingGlobalExpr} || [];`, - "var parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);", - "chunkLoadingGlobal.push = installChunk;" - ]) - : "// no chunk loading", - "", - withHmr - ? Template.asString([ - "function loadUpdateChunk(chunkId, updatedModulesList) {", - Template.indent([ - "var success = false;", - `${globalObject}[${JSON.stringify( - hotUpdateGlobal - )}] = ${runtimeTemplate.basicFunction("_, moreModules, runtime", [ - "for(var moduleId in moreModules) {", - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, - Template.indent([ - "currentUpdate[moduleId] = moreModules[moduleId];", - "if(updatedModulesList) updatedModulesList.push(moduleId);" - ]), - "}" - ]), - "}", - "if(runtime) currentUpdateRuntime.push(runtime);", - "success = true;" - ])};`, - "// start update chunk loading", - `importScripts(${ - withCreateScriptUrl - ? `${RuntimeGlobals.createScriptUrl}(${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId))` - : `${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId)` - });`, - 'if(!success) throw new Error("Loading update chunk failed for unknown reason");' - ]), - "}", - "", - Template.getFunctionContent( - require('./JavascriptHotModuleReplacement.runtime.js') - ) - .replace(/\$key\$/g, "importScrips") - .replace(/\$installedChunks\$/g, "installedChunks") - .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") - .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) - .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) - .replace( - /\$ensureChunkHandlers\$/g, - RuntimeGlobals.ensureChunkHandlers - ) - .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) - .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) - .replace( - /\$hmrDownloadUpdateHandlers\$/g, - RuntimeGlobals.hmrDownloadUpdateHandlers - ) - .replace( - /\$hmrInvalidateModuleHandlers\$/g, - RuntimeGlobals.hmrInvalidateModuleHandlers - ) - ]) - : "// no HMR", - "", - withHmrManifest - ? Template.asString([ - `${ - RuntimeGlobals.hmrDownloadManifest - } = ${runtimeTemplate.basicFunction("", [ - 'if (typeof fetch === "undefined") throw new Error("No browser support: need fetch API");', - `return fetch(${RuntimeGlobals.publicPath} + ${ - RuntimeGlobals.getUpdateManifestFilename - }()).then(${runtimeTemplate.basicFunction("response", [ - "if(response.status === 404) return; // no update available", - 'if(!response.ok) throw new Error("Failed to fetch update manifest " + response.statusText);', - "return response.json();" - ])});` - ])};` - ]) - : "// no HMR manifest" - ]); +// TODO this is no longer needed when minimum node.js version is >= 12 +// since these versions ship with a stable sort function +/** + * @template T + * @param {Iterable} iterable original ordered list + * @returns {Comparator} comparator + */ +exports.keepOriginalOrder = iterable => { + /** @type {Map} */ + const map = new Map(); + let i = 0; + for (const item of iterable) { + map.set(item, i++); } -} + return (a, b) => compareNumbers(map.get(a), map.get(b)); +}; -module.exports = ImportScriptsChunkLoadingRuntimeModule; +/** + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {Comparator} comparator + */ +exports.compareChunksNatural = chunkGraph => { + const cmpFn = exports.compareModulesById(chunkGraph); + const cmpIterableFn = compareIterables(cmpFn); + return concatComparators( + compareSelect(chunk => chunk.name, compareIds), + compareSelect(chunk => chunk.runtime, compareRuntime), + compareSelect( + /** + * @param {Chunk} chunk a chunk + * @returns {Iterable} modules + */ + chunk => chunkGraph.getOrderedChunkModulesIterable(chunk, cmpFn), + cmpIterableFn + ) + ); +}; + +/** + * Compare two locations + * @param {DependencyLocation} a A location node + * @param {DependencyLocation} b A location node + * @returns {-1|0|1} sorting comparator value + */ +exports.compareLocations = (a, b) => { + let isObjectA = typeof a === "object" && a !== null; + let isObjectB = typeof b === "object" && b !== null; + if (!isObjectA || !isObjectB) { + if (isObjectA) return 1; + if (isObjectB) return -1; + return 0; + } + if ("start" in a) { + if ("start" in b) { + const ap = a.start; + const bp = b.start; + if (ap.line < bp.line) return -1; + if (ap.line > bp.line) return 1; + if (ap.column < bp.column) return -1; + if (ap.column > bp.column) return 1; + } else return -1; + } else if ("start" in b) return 1; + if ("name" in a) { + if ("name" in b) { + if (a.name < b.name) return -1; + if (a.name > b.name) return 1; + } else return -1; + } else if ("name" in b) return 1; + if ("index" in a) { + if ("index" in b) { + if (a.index < b.index) return -1; + if (a.index > b.index) return 1; + } else return -1; + } else if ("index" in b) return 1; + return 0; +}; /***/ }), -/***/ 68693: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 29404: +/***/ (function(module) { "use strict"; /* @@ -133708,129 +132033,210 @@ module.exports = ImportScriptsChunkLoadingRuntimeModule; -const ArrayPushCallbackChunkFormatPlugin = __webpack_require__(18535); -const EnableChunkLoadingPlugin = __webpack_require__(61291); - -/** @typedef {import("../Compiler")} Compiler */ +const quoteMeta = str => { + return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); +}; -class WebWorkerTemplatePlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.options.output.chunkLoading = "import-scripts"; - new ArrayPushCallbackChunkFormatPlugin().apply(compiler); - new EnableChunkLoadingPlugin("import-scripts").apply(compiler); +const toSimpleString = str => { + if (`${+str}` === str) { + return str; } -} -module.exports = WebWorkerTemplatePlugin; + return JSON.stringify(str); +}; +/** + * @param {Record} map value map + * @returns {boolean|(function(string): string)} true/false, when unconditionally true/false, or a template function to determine the value at runtime + */ +const compileBooleanMatcher = map => { + const positiveItems = Object.keys(map).filter(i => map[i]); + const negativeItems = Object.keys(map).filter(i => !map[i]); + if (positiveItems.length === 0) return false; + if (negativeItems.length === 0) return true; + return compileBooleanMatcherFromLists(positiveItems, negativeItems); +}; -/***/ }), +/** + * @param {string[]} positiveItems positive items + * @param {string[]} negativeItems negative items + * @returns {function(string): string} a template function to determine the value at runtime + */ +const compileBooleanMatcherFromLists = (positiveItems, negativeItems) => { + if (positiveItems.length === 0) return () => "false"; + if (negativeItems.length === 0) return () => "true"; + if (positiveItems.length === 1) + return value => `${toSimpleString(positiveItems[0])} == ${value}`; + if (negativeItems.length === 1) + return value => `${toSimpleString(negativeItems[0])} != ${value}`; + const positiveRegexp = itemsToRegexp(positiveItems); + const negativeRegexp = itemsToRegexp(negativeItems); + if (positiveRegexp.length <= negativeRegexp.length) { + return value => `/^${positiveRegexp}$/.test(${value})`; + } else { + return value => `!/^${negativeRegexp}$/.test(${value})`; + } +}; -/***/ 14819: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +const popCommonItems = (itemsSet, getKey, condition) => { + const map = new Map(); + for (const item of itemsSet) { + const key = getKey(item); + if (key) { + let list = map.get(key); + if (list === undefined) { + list = []; + map.set(key, list); + } + list.push(item); + } + } + const result = []; + for (const list of map.values()) { + if (condition(list)) { + for (const item of list) { + itemsSet.delete(item); + } + result.push(list); + } + } + return result; +}; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +const getCommonPrefix = items => { + let prefix = items[0]; + for (let i = 1; i < items.length; i++) { + const item = items[i]; + for (let p = 0; p < prefix.length; p++) { + if (item[p] !== prefix[p]) { + prefix = prefix.slice(0, p); + break; + } + } + } + return prefix; +}; +const getCommonSuffix = items => { + let suffix = items[0]; + for (let i = 1; i < items.length; i++) { + const item = items[i]; + for (let p = item.length - 1, s = suffix.length - 1; s >= 0; p--, s--) { + if (item[p] !== suffix[s]) { + suffix = suffix.slice(s + 1); + break; + } + } + } + return suffix; +}; +const itemsToRegexp = itemsArr => { + if (itemsArr.length === 1) { + return quoteMeta(itemsArr[0]); + } + const finishedItems = []; -const DescriptionFileUtils = __webpack_require__(25424); -const getInnerRequest = __webpack_require__(47956); + // merge single char items: (a|b|c|d|ef) => ([abcd]|ef) + let countOfSingleCharItems = 0; + for (const item of itemsArr) { + if (item.length === 1) { + countOfSingleCharItems++; + } + } + // special case for only single char items + if (countOfSingleCharItems === itemsArr.length) { + return `[${quoteMeta(itemsArr.sort().join(""))}]`; + } + const items = new Set(itemsArr.sort()); + if (countOfSingleCharItems > 2) { + let singleCharItems = ""; + for (const item of items) { + if (item.length === 1) { + singleCharItems += item; + items.delete(item); + } + } + finishedItems.push(`[${quoteMeta(singleCharItems)}]`); + } -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + // special case for 2 items with common prefix/suffix + if (finishedItems.length === 0 && items.size === 2) { + const prefix = getCommonPrefix(itemsArr); + const suffix = getCommonSuffix( + itemsArr.map(item => item.slice(prefix.length)) + ); + if (prefix.length > 0 || suffix.length > 0) { + return `${quoteMeta(prefix)}${itemsToRegexp( + itemsArr.map(i => i.slice(prefix.length, -suffix.length || undefined)) + )}${quoteMeta(suffix)}`; + } + } -module.exports = class AliasFieldPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string | Array} field field - * @param {string | ResolveStepHook} target target - */ - constructor(source, field, target) { - this.source = source; - this.field = field; - this.target = target; + // special case for 2 items with common suffix + if (finishedItems.length === 0 && items.size === 2) { + const it = items[Symbol.iterator](); + const a = it.next().value; + const b = it.next().value; + if (a.length > 0 && b.length > 0 && a.slice(-1) === b.slice(-1)) { + return `${itemsToRegexp([a.slice(0, -1), b.slice(0, -1)])}${quoteMeta( + a.slice(-1) + )}`; + } } - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("AliasFieldPlugin", (request, resolveContext, callback) => { - if (!request.descriptionFileData) return callback(); - const innerRequest = getInnerRequest(resolver, request); - if (!innerRequest) return callback(); - const fieldData = DescriptionFileUtils.getField( - request.descriptionFileData, - this.field - ); - if (fieldData === null || typeof fieldData !== "object") { - if (resolveContext.log) - resolveContext.log( - "Field '" + - this.field + - "' doesn't contain a valid alias configuration" - ); - return callback(); - } - const data1 = fieldData[innerRequest]; - const data2 = fieldData[innerRequest.replace(/^\.\//, "")]; - const data = typeof data1 !== "undefined" ? data1 : data2; - if (data === innerRequest) return callback(); - if (data === undefined) return callback(); - if (data === false) { - /** @type {ResolveRequest} */ - const ignoreObj = { - ...request, - path: false - }; - return callback(null, ignoreObj); - } - const obj = { - ...request, - path: request.descriptionFileRoot, - request: data, - fullySpecified: false - }; - resolver.doResolve( - target, - obj, - "aliased from description file " + - request.descriptionFilePath + - " with mapping '" + - innerRequest + - "' to '" + - data + - "'", - resolveContext, - (err, result) => { - if (err) return callback(err); + // find common prefix: (a1|a2|a3|a4|b5) => (a(1|2|3|4)|b5) + const prefixed = popCommonItems( + items, + item => (item.length >= 1 ? item[0] : false), + list => { + if (list.length >= 3) return true; + if (list.length <= 1) return false; + return list[0][1] === list[1][1]; + } + ); + for (const prefixedItems of prefixed) { + const prefix = getCommonPrefix(prefixedItems); + finishedItems.push( + `${quoteMeta(prefix)}${itemsToRegexp( + prefixedItems.map(i => i.slice(prefix.length)) + )}` + ); + } - // Don't allow other aliasing or raw request - if (result === undefined) return callback(null, null); - callback(null, result); - } - ); - }); + // find common suffix: (a1|b1|c1|d1|e2) => ((a|b|c|d)1|e2) + const suffixed = popCommonItems( + items, + item => (item.length >= 1 ? item.slice(-1) : false), + list => { + if (list.length >= 3) return true; + if (list.length <= 1) return false; + return list[0].slice(-2) === list[1].slice(-2); + } + ); + for (const suffixedItems of suffixed) { + const suffix = getCommonSuffix(suffixedItems); + finishedItems.push( + `${itemsToRegexp( + suffixedItems.map(i => i.slice(0, -suffix.length)) + )}${quoteMeta(suffix)}` + ); } + + // TODO further optimize regexp, i. e. + // use ranges: (1|2|3|4|a) => [1-4a] + const conditional = finishedItems.concat(Array.from(items, quoteMeta)); + if (conditional.length === 1) return conditional[0]; + return `(${conditional.join("|")})`; }; +compileBooleanMatcher.fromLists = compileBooleanMatcherFromLists; +compileBooleanMatcher.itemsToRegexp = itemsToRegexp; +module.exports = compileBooleanMatcher; + /***/ }), -/***/ 63676: +/***/ 32540: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -133841,114 +132247,33 @@ module.exports = class AliasFieldPlugin { -const forEachBail = __webpack_require__(78565); - -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -/** @typedef {{alias: string|Array|false, name: string, onlyModule?: boolean}} AliasOption */ - -module.exports = class AliasPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {AliasOption | Array} options options - * @param {string | ResolveStepHook} target target - */ - constructor(source, options, target) { - this.source = source; - this.options = Array.isArray(options) ? options : [options]; - this.target = target; - } +const memoize = __webpack_require__(78676); - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("AliasPlugin", (request, resolveContext, callback) => { - const innerRequest = request.request || request.path; - if (!innerRequest) return callback(); - forEachBail( - this.options, - (item, callback) => { - let shouldStop = false; - if ( - innerRequest === item.name || - (!item.onlyModule && innerRequest.startsWith(item.name + "/")) - ) { - const remainingRequest = innerRequest.substr(item.name.length); - const resolveWithAlias = (alias, callback) => { - if (alias === false) { - const ignoreObj = { - ...request, - path: false - }; - return callback(null, ignoreObj); - } - if ( - innerRequest !== alias && - !innerRequest.startsWith(alias + "/") - ) { - shouldStop = true; - const newRequestStr = alias + remainingRequest; - const obj = { - ...request, - request: newRequestStr, - fullySpecified: false - }; - return resolver.doResolve( - target, - obj, - "aliased with mapping '" + - item.name + - "': '" + - alias + - "' to '" + - newRequestStr + - "'", - resolveContext, - (err, result) => { - if (err) return callback(err); - if (result) return callback(null, result); - return callback(); - } - ); - } - return callback(); - }; - const stoppingCallback = (err, result) => { - if (err) return callback(err); +const getValidate = memoize(() => (__webpack_require__(38476).validate)); - if (result) return callback(null, result); - // Don't allow other aliasing or raw request - if (shouldStop) return callback(null, null); - return callback(); - }; - if (Array.isArray(item.alias)) { - return forEachBail( - item.alias, - resolveWithAlias, - stoppingCallback - ); - } else { - return resolveWithAlias(item.alias, stoppingCallback); - } - } - return callback(); - }, - callback - ); - }); - } +const createSchemaValidation = (check, getSchema, options) => { + getSchema = memoize(getSchema); + return value => { + if (check && !check(value)) { + getValidate()(getSchema(), value, options); + if (check) { + (__webpack_require__(73837).deprecate)( + () => {}, + "webpack bug: Pre-compiled schema reports error while real schema is happy. This has performance drawbacks.", + "DEP_WEBPACK_PRE_COMPILED_SCHEMA_INVALID" + )(); + } + } + }; }; +module.exports = createSchemaValidation; + /***/ }), -/***/ 92088: -/***/ (function(module) { +/***/ 49835: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -133958,52 +132283,176 @@ module.exports = class AliasPlugin { -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +const Hash = __webpack_require__(36692); + +const BULK_SIZE = 2000; + +// We are using an object instead of a Map as this will stay static during the runtime +// so access to it can be optimized by v8 +const digestCaches = {}; + +class BulkUpdateDecorator extends Hash { + /** + * @param {Hash | function(): Hash} hashOrFactory function to create a hash + * @param {string=} hashKey key for caching + */ + constructor(hashOrFactory, hashKey) { + super(); + this.hashKey = hashKey; + if (typeof hashOrFactory === "function") { + this.hashFactory = hashOrFactory; + this.hash = undefined; + } else { + this.hashFactory = undefined; + this.hash = hashOrFactory; + } + this.buffer = ""; + } + + /** + * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} + * @param {string|Buffer} data data + * @param {string=} inputEncoding data encoding + * @returns {this} updated hash + */ + update(data, inputEncoding) { + if ( + inputEncoding !== undefined || + typeof data !== "string" || + data.length > BULK_SIZE + ) { + if (this.hash === undefined) this.hash = this.hashFactory(); + if (this.buffer.length > 0) { + this.hash.update(this.buffer); + this.buffer = ""; + } + this.hash.update(data, inputEncoding); + } else { + this.buffer += data; + if (this.buffer.length > BULK_SIZE) { + if (this.hash === undefined) this.hash = this.hashFactory(); + this.hash.update(this.buffer); + this.buffer = ""; + } + } + return this; + } + + /** + * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} + * @param {string=} encoding encoding of the return value + * @returns {string|Buffer} digest + */ + digest(encoding) { + let digestCache; + const buffer = this.buffer; + if (this.hash === undefined) { + // short data for hash, we can use caching + const cacheKey = `${this.hashKey}-${encoding}`; + digestCache = digestCaches[cacheKey]; + if (digestCache === undefined) { + digestCache = digestCaches[cacheKey] = new Map(); + } + const cacheEntry = digestCache.get(buffer); + if (cacheEntry !== undefined) return cacheEntry; + this.hash = this.hashFactory(); + } + if (buffer.length > 0) { + this.hash.update(buffer); + } + const digestResult = this.hash.digest(encoding); + const result = + typeof digestResult === "string" ? digestResult : digestResult.toString(); + if (digestCache !== undefined) { + digestCache.set(buffer, result); + } + return result; + } +} + +/* istanbul ignore next */ +class DebugHash extends Hash { + constructor() { + super(); + this.string = ""; + } + + /** + * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} + * @param {string|Buffer} data data + * @param {string=} inputEncoding data encoding + * @returns {this} updated hash + */ + update(data, inputEncoding) { + if (typeof data !== "string") data = data.toString("utf-8"); + if (data.startsWith("debug-digest-")) { + data = Buffer.from(data.slice("debug-digest-".length), "hex").toString(); + } + this.string += `[${data}](${new Error().stack.split("\n", 3)[2]})\n`; + return this; + } -module.exports = class AppendPlugin { /** - * @param {string | ResolveStepHook} source source - * @param {string} appending appending - * @param {string | ResolveStepHook} target target + * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} + * @param {string=} encoding encoding of the return value + * @returns {string|Buffer} digest */ - constructor(source, appending, target) { - this.source = source; - this.appending = appending; - this.target = target; + digest(encoding) { + return "debug-digest-" + Buffer.from(this.string).toString("hex"); } +} - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("AppendPlugin", (request, resolveContext, callback) => { - const obj = { - ...request, - path: request.path + this.appending, - relativePath: - request.relativePath && request.relativePath + this.appending - }; - resolver.doResolve( - target, - obj, - this.appending, - resolveContext, - callback - ); - }); +let crypto = undefined; +let createXXHash64 = undefined; +let createMd4 = undefined; +let BatchedHash = undefined; + +/** + * Creates a hash by name or function + * @param {string | typeof Hash} algorithm the algorithm name or a constructor creating a hash + * @returns {Hash} the hash + */ +module.exports = algorithm => { + if (typeof algorithm === "function") { + return new BulkUpdateDecorator(() => new algorithm()); + } + switch (algorithm) { + // TODO add non-cryptographic algorithm here + case "debug": + return new DebugHash(); + case "xxhash64": + if (createXXHash64 === undefined) { + createXXHash64 = __webpack_require__(35028); + if (BatchedHash === undefined) { + BatchedHash = __webpack_require__(59461); + } + } + return new BatchedHash(createXXHash64()); + case "md4": + if (createMd4 === undefined) { + createMd4 = __webpack_require__(86884); + if (BatchedHash === undefined) { + BatchedHash = __webpack_require__(59461); + } + } + return new BatchedHash(createMd4()); + case "native-md4": + if (crypto === undefined) crypto = __webpack_require__(6113); + return new BulkUpdateDecorator(() => crypto.createHash("md4"), "md4"); + default: + if (crypto === undefined) crypto = __webpack_require__(6113); + return new BulkUpdateDecorator( + () => crypto.createHash(algorithm), + algorithm + ); } }; /***/ }), -/***/ 52788: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 64518: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -134013,534 +132462,810 @@ module.exports = class AppendPlugin { -const nextTick = (__webpack_require__(77282).nextTick); +const util = __webpack_require__(73837); -/** @typedef {import("./Resolver").FileSystem} FileSystem */ -/** @typedef {import("./Resolver").SyncFileSystem} SyncFileSystem */ +/** @type {Map} */ +const deprecationCache = new Map(); -const dirname = path => { - let idx = path.length - 1; - while (idx >= 0) { - const c = path.charCodeAt(idx); - // slash or backslash - if (c === 47 || c === 92) break; - idx--; - } - if (idx < 0) return ""; - return path.slice(0, idx); +/** + * @typedef {Object} FakeHookMarker + * @property {true} _fakeHook it's a fake hook + */ + +/** @template T @typedef {T & FakeHookMarker} FakeHook */ + +/** + * @param {string} message deprecation message + * @param {string} code deprecation code + * @returns {Function} function to trigger deprecation + */ +const createDeprecation = (message, code) => { + const cached = deprecationCache.get(message); + if (cached !== undefined) return cached; + const fn = util.deprecate( + () => {}, + message, + "DEP_WEBPACK_DEPRECATION_" + code + ); + deprecationCache.set(message, fn); + return fn; }; -const runCallbacks = (callbacks, err, result) => { - if (callbacks.length === 1) { - callbacks[0](err, result); - callbacks.length = 0; - return; +const COPY_METHODS = [ + "concat", + "entry", + "filter", + "find", + "findIndex", + "includes", + "indexOf", + "join", + "lastIndexOf", + "map", + "reduce", + "reduceRight", + "slice", + "some" +]; + +const DISABLED_METHODS = [ + "copyWithin", + "entries", + "fill", + "keys", + "pop", + "reverse", + "shift", + "splice", + "sort", + "unshift" +]; + +/** + * @param {any} set new set + * @param {string} name property name + * @returns {void} + */ +exports.arrayToSetDeprecation = (set, name) => { + for (const method of COPY_METHODS) { + if (set[method]) continue; + const d = createDeprecation( + `${name} was changed from Array to Set (using Array method '${method}' is deprecated)`, + "ARRAY_TO_SET" + ); + /** + * @deprecated + * @this {Set} + * @returns {number} count + */ + set[method] = function () { + d(); + const array = Array.from(this); + return Array.prototype[method].apply(array, arguments); + }; } - let error; - for (const callback of callbacks) { - try { - callback(err, result); - } catch (e) { - if (!error) error = e; + const dPush = createDeprecation( + `${name} was changed from Array to Set (using Array method 'push' is deprecated)`, + "ARRAY_TO_SET_PUSH" + ); + const dLength = createDeprecation( + `${name} was changed from Array to Set (using Array property 'length' is deprecated)`, + "ARRAY_TO_SET_LENGTH" + ); + const dIndexer = createDeprecation( + `${name} was changed from Array to Set (indexing Array is deprecated)`, + "ARRAY_TO_SET_INDEXER" + ); + /** + * @deprecated + * @this {Set} + * @returns {number} count + */ + set.push = function () { + dPush(); + for (const item of Array.from(arguments)) { + this.add(item); } + return this.size; + }; + for (const method of DISABLED_METHODS) { + if (set[method]) continue; + set[method] = () => { + throw new Error( + `${name} was changed from Array to Set (using Array method '${method}' is not possible)` + ); + }; } - callbacks.length = 0; - if (error) throw error; + const createIndexGetter = index => { + /** + * @this {Set} a Set + * @returns {any} the value at this location + */ + const fn = function () { + dIndexer(); + let i = 0; + for (const item of this) { + if (i++ === index) return item; + } + return undefined; + }; + return fn; + }; + const defineIndexGetter = index => { + Object.defineProperty(set, index, { + get: createIndexGetter(index), + set(value) { + throw new Error( + `${name} was changed from Array to Set (indexing Array with write is not possible)` + ); + } + }); + }; + defineIndexGetter(0); + let indexerDefined = 1; + Object.defineProperty(set, "length", { + get() { + dLength(); + const length = this.size; + for (indexerDefined; indexerDefined < length + 1; indexerDefined++) { + defineIndexGetter(indexerDefined); + } + return length; + }, + set(value) { + throw new Error( + `${name} was changed from Array to Set (writing to Array property 'length' is not possible)` + ); + } + }); + set[Symbol.isConcatSpreadable] = true; }; -class OperationMergerBackend { - /** - * @param {any} provider async method - * @param {any} syncProvider sync method - * @param {any} providerContext call context for the provider methods - */ - constructor(provider, syncProvider, providerContext) { - this._provider = provider; - this._syncProvider = syncProvider; - this._providerContext = providerContext; - this._activeAsyncOperations = new Map(); - - this.provide = this._provider - ? (path, options, callback) => { - if (typeof options === "function") { - callback = options; - options = undefined; - } - if (options) { - return this._provider.call( - this._providerContext, - path, - options, - callback - ); - } - if (typeof path !== "string") { - callback(new TypeError("path must be a string")); - return; - } - let callbacks = this._activeAsyncOperations.get(path); - if (callbacks) { - callbacks.push(callback); - return; - } - this._activeAsyncOperations.set(path, (callbacks = [callback])); - provider(path, (err, result) => { - this._activeAsyncOperations.delete(path); - runCallbacks(callbacks, err, result); - }); - } - : null; - this.provideSync = this._syncProvider - ? (path, options) => { - return this._syncProvider.call(this._providerContext, path, options); - } - : null; +exports.createArrayToSetDeprecationSet = name => { + let initialized = false; + class SetDeprecatedArray extends Set { + constructor(items) { + super(items); + if (!initialized) { + initialized = true; + exports.arrayToSetDeprecation(SetDeprecatedArray.prototype, name); + } + } } + return SetDeprecatedArray; +}; - purge() {} - purgeParent() {} -} +exports.soonFrozenObjectDeprecation = (obj, name, code, note = "") => { + const message = `${name} will be frozen in future, all modifications are deprecated.${ + note && `\n${note}` + }`; + return new Proxy(obj, { + set: util.deprecate( + (target, property, value, receiver) => + Reflect.set(target, property, value, receiver), + message, + code + ), + defineProperty: util.deprecate( + (target, property, descriptor) => + Reflect.defineProperty(target, property, descriptor), + message, + code + ), + deleteProperty: util.deprecate( + (target, property) => Reflect.deleteProperty(target, property), + message, + code + ), + setPrototypeOf: util.deprecate( + (target, proto) => Reflect.setPrototypeOf(target, proto), + message, + code + ) + }); +}; -/* +/** + * @template T + * @param {T} obj object + * @param {string} message deprecation message + * @param {string} code deprecation code + * @returns {T} object with property access deprecated + */ +const deprecateAllProperties = (obj, message, code) => { + const newObj = {}; + const descriptors = Object.getOwnPropertyDescriptors(obj); + for (const name of Object.keys(descriptors)) { + const descriptor = descriptors[name]; + if (typeof descriptor.value === "function") { + Object.defineProperty(newObj, name, { + ...descriptor, + value: util.deprecate(descriptor.value, message, code) + }); + } else if (descriptor.get || descriptor.set) { + Object.defineProperty(newObj, name, { + ...descriptor, + get: descriptor.get && util.deprecate(descriptor.get, message, code), + set: descriptor.set && util.deprecate(descriptor.set, message, code) + }); + } else { + let value = descriptor.value; + Object.defineProperty(newObj, name, { + configurable: descriptor.configurable, + enumerable: descriptor.enumerable, + get: util.deprecate(() => value, message, code), + set: descriptor.writable + ? util.deprecate(v => (value = v), message, code) + : undefined + }); + } + } + return /** @type {T} */ (newObj); +}; +exports.deprecateAllProperties = deprecateAllProperties; -IDLE: - insert data: goto SYNC +/** + * @template T + * @param {T} fakeHook fake hook implementation + * @param {string=} message deprecation message (not deprecated when unset) + * @param {string=} code deprecation code (not deprecated when unset) + * @returns {FakeHook} fake hook which redirects + */ +exports.createFakeHook = (fakeHook, message, code) => { + if (message && code) { + fakeHook = deprecateAllProperties(fakeHook, message, code); + } + return Object.freeze( + Object.assign(fakeHook, { _fakeHook: /** @type {true} */ (true) }) + ); +}; -SYNC: - before provide: run ticks - event loop tick: goto ASYNC_ACTIVE -ASYNC: - timeout: run tick, goto ASYNC_PASSIVE +/***/ }), -ASYNC_PASSIVE: - before provide: run ticks +/***/ 59836: +/***/ (function(module) { -IDLE --[insert data]--> SYNC --[event loop tick]--> ASYNC_ACTIVE --[interval tick]-> ASYNC_PASSIVE - ^ | - +---------[insert data]-------+ +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const STORAGE_MODE_IDLE = 0; -const STORAGE_MODE_SYNC = 1; -const STORAGE_MODE_ASYNC = 2; -class CacheBackend { - /** - * @param {number} duration max cache duration of items - * @param {any} provider async method - * @param {any} syncProvider sync method - * @param {any} providerContext call context for the provider methods - */ - constructor(duration, provider, syncProvider, providerContext) { - this._duration = duration; - this._provider = provider; - this._syncProvider = syncProvider; - this._providerContext = providerContext; - /** @type {Map} */ - this._activeAsyncOperations = new Map(); - /** @type {Map }>} */ - this._data = new Map(); - /** @type {Set[]} */ - this._levels = []; - for (let i = 0; i < 10; i++) this._levels.push(new Set()); - for (let i = 5000; i < duration; i += 500) this._levels.push(new Set()); - this._currentLevel = 0; - this._tickInterval = Math.floor(duration / this._levels.length); - /** @type {STORAGE_MODE_IDLE | STORAGE_MODE_SYNC | STORAGE_MODE_ASYNC} */ - this._mode = STORAGE_MODE_IDLE; - /** @type {NodeJS.Timeout | undefined} */ - this._timeout = undefined; - /** @type {number | undefined} */ - this._nextDecay = undefined; +// Simulations show these probabilities for a single change +// 93.1% that one group is invalidated +// 4.8% that two groups are invalidated +// 1.1% that 3 groups are invalidated +// 0.1% that 4 or more groups are invalidated +// +// And these for removing/adding 10 lexically adjacent files +// 64.5% that one group is invalidated +// 24.8% that two groups are invalidated +// 7.8% that 3 groups are invalidated +// 2.7% that 4 or more groups are invalidated +// +// And these for removing/adding 3 random files +// 0% that one group is invalidated +// 3.7% that two groups are invalidated +// 80.8% that 3 groups are invalidated +// 12.3% that 4 groups are invalidated +// 3.2% that 5 or more groups are invalidated - this.provide = provider ? this.provide.bind(this) : null; - this.provideSync = syncProvider ? this.provideSync.bind(this) : null; +/** + * + * @param {string} a key + * @param {string} b key + * @returns {number} the similarity as number + */ +const similarity = (a, b) => { + const l = Math.min(a.length, b.length); + let dist = 0; + for (let i = 0; i < l; i++) { + const ca = a.charCodeAt(i); + const cb = b.charCodeAt(i); + dist += Math.max(0, 10 - Math.abs(ca - cb)); } + return dist; +}; - provide(path, options, callback) { - if (typeof options === "function") { - callback = options; - options = undefined; - } - if (typeof path !== "string") { - callback(new TypeError("path must be a string")); - return; - } - if (options) { - return this._provider.call( - this._providerContext, - path, - options, - callback - ); - } - - // When in sync mode we can move to async mode - if (this._mode === STORAGE_MODE_SYNC) { - this._enterAsyncMode(); - } - - // Check in cache - let cacheEntry = this._data.get(path); - if (cacheEntry !== undefined) { - if (cacheEntry.err) return nextTick(callback, cacheEntry.err); - return nextTick(callback, null, cacheEntry.result); +/** + * @param {string} a key + * @param {string} b key + * @param {Set} usedNames set of already used names + * @returns {string} the common part and a single char for the difference + */ +const getName = (a, b, usedNames) => { + const l = Math.min(a.length, b.length); + let i = 0; + while (i < l) { + if (a.charCodeAt(i) !== b.charCodeAt(i)) { + i++; + break; } - - // Check if there is already the same operation running - let callbacks = this._activeAsyncOperations.get(path); - if (callbacks !== undefined) { - callbacks.push(callback); - return; + i++; + } + while (i < l) { + const name = a.slice(0, i); + const lowerName = name.toLowerCase(); + if (!usedNames.has(lowerName)) { + usedNames.add(lowerName); + return name; } - this._activeAsyncOperations.set(path, (callbacks = [callback])); + i++; + } + // names always contain a hash, so this is always unique + // we don't need to check usedNames nor add it + return a; +}; - // Run the operation - this._provider.call(this._providerContext, path, (err, result) => { - this._activeAsyncOperations.delete(path); - this._storeResult(path, err, result); +/** + * @param {Record} total total size + * @param {Record} size single size + * @returns {void} + */ +const addSizeTo = (total, size) => { + for (const key of Object.keys(size)) { + total[key] = (total[key] || 0) + size[key]; + } +}; - // Enter async mode if not yet done - this._enterAsyncMode(); +/** + * @param {Record} total total size + * @param {Record} size single size + * @returns {void} + */ +const subtractSizeFrom = (total, size) => { + for (const key of Object.keys(size)) { + total[key] -= size[key]; + } +}; - runCallbacks(callbacks, err, result); - }); +/** + * @param {Iterable} nodes some nodes + * @returns {Record} total size + */ +const sumSize = nodes => { + const sum = Object.create(null); + for (const node of nodes) { + addSizeTo(sum, node.size); } + return sum; +}; - provideSync(path, options) { - if (typeof path !== "string") { - throw new TypeError("path must be a string"); - } - if (options) { - return this._syncProvider.call(this._providerContext, path, options); +const isTooBig = (size, maxSize) => { + for (const key of Object.keys(size)) { + const s = size[key]; + if (s === 0) continue; + const maxSizeValue = maxSize[key]; + if (typeof maxSizeValue === "number") { + if (s > maxSizeValue) return true; } + } + return false; +}; - // In sync mode we may have to decay some cache items - if (this._mode === STORAGE_MODE_SYNC) { - this._runDecays(); +const isTooSmall = (size, minSize) => { + for (const key of Object.keys(size)) { + const s = size[key]; + if (s === 0) continue; + const minSizeValue = minSize[key]; + if (typeof minSizeValue === "number") { + if (s < minSizeValue) return true; } + } + return false; +}; - // Check in cache - let cacheEntry = this._data.get(path); - if (cacheEntry !== undefined) { - if (cacheEntry.err) throw cacheEntry.err; - return cacheEntry.result; +const getTooSmallTypes = (size, minSize) => { + const types = new Set(); + for (const key of Object.keys(size)) { + const s = size[key]; + if (s === 0) continue; + const minSizeValue = minSize[key]; + if (typeof minSizeValue === "number") { + if (s < minSizeValue) types.add(key); } + } + return types; +}; - // Get all active async operations - // This sync operation will also complete them - const callbacks = this._activeAsyncOperations.get(path); - this._activeAsyncOperations.delete(path); +const getNumberOfMatchingSizeTypes = (size, types) => { + let i = 0; + for (const key of Object.keys(size)) { + if (size[key] !== 0 && types.has(key)) i++; + } + return i; +}; - // Run the operation - // When in idle mode, we will enter sync mode - let result; - try { - result = this._syncProvider.call(this._providerContext, path); - } catch (err) { - this._storeResult(path, err, undefined); - this._enterSyncModeWhenIdle(); - if (callbacks) runCallbacks(callbacks, err, undefined); - throw err; - } - this._storeResult(path, undefined, result); - this._enterSyncModeWhenIdle(); - if (callbacks) runCallbacks(callbacks, undefined, result); - return result; +const selectiveSizeSum = (size, types) => { + let sum = 0; + for (const key of Object.keys(size)) { + if (size[key] !== 0 && types.has(key)) sum += size[key]; } + return sum; +}; - purge(what) { - if (!what) { - if (this._mode !== STORAGE_MODE_IDLE) { - this._data.clear(); - for (const level of this._levels) { - level.clear(); - } - this._enterIdleMode(); - } - } else if (typeof what === "string") { - for (let [key, data] of this._data) { - if (key.startsWith(what)) { - this._data.delete(key); - data.level.delete(key); - } - } - if (this._data.size === 0) { - this._enterIdleMode(); - } - } else { - for (let [key, data] of this._data) { - for (const item of what) { - if (key.startsWith(item)) { - this._data.delete(key); - data.level.delete(key); - break; - } +/** + * @template T + */ +class Node { + /** + * @param {T} item item + * @param {string} key key + * @param {Record} size size + */ + constructor(item, key, size) { + this.item = item; + this.key = key; + this.size = size; + } +} + +/** + * @template T + */ +class Group { + /** + * @param {Node[]} nodes nodes + * @param {number[]} similarities similarities between the nodes (length = nodes.length - 1) + * @param {Record=} size size of the group + */ + constructor(nodes, similarities, size) { + this.nodes = nodes; + this.similarities = similarities; + this.size = size || sumSize(nodes); + /** @type {string} */ + this.key = undefined; + } + + /** + * @param {function(Node): boolean} filter filter function + * @returns {Node[]} removed nodes + */ + popNodes(filter) { + const newNodes = []; + const newSimilarities = []; + const resultNodes = []; + let lastNode; + for (let i = 0; i < this.nodes.length; i++) { + const node = this.nodes[i]; + if (filter(node)) { + resultNodes.push(node); + } else { + if (newNodes.length > 0) { + newSimilarities.push( + lastNode === this.nodes[i - 1] + ? this.similarities[i - 1] + : similarity(lastNode.key, node.key) + ); } - } - if (this._data.size === 0) { - this._enterIdleMode(); + newNodes.push(node); + lastNode = node; } } + if (resultNodes.length === this.nodes.length) return undefined; + this.nodes = newNodes; + this.similarities = newSimilarities; + this.size = sumSize(newNodes); + return resultNodes; } +} - purgeParent(what) { - if (!what) { - this.purge(); - } else if (typeof what === "string") { - this.purge(dirname(what)); - } else { - const set = new Set(); - for (const item of what) { - set.add(dirname(item)); - } - this.purge(set); +/** + * @param {Iterable} nodes nodes + * @returns {number[]} similarities + */ +const getSimilarities = nodes => { + // calculate similarities between lexically adjacent nodes + /** @type {number[]} */ + const similarities = []; + let last = undefined; + for (const node of nodes) { + if (last !== undefined) { + similarities.push(similarity(last.key, node.key)); } + last = node; } + return similarities; +}; - _storeResult(path, err, result) { - if (this._data.has(path)) return; - const level = this._levels[this._currentLevel]; - this._data.set(path, { err, result, level }); - level.add(path); - } +/** + * @template T + * @typedef {Object} GroupedItems + * @property {string} key + * @property {T[]} items + * @property {Record} size + */ - _decayLevel() { - const nextLevel = (this._currentLevel + 1) % this._levels.length; - const decay = this._levels[nextLevel]; - this._currentLevel = nextLevel; - for (let item of decay) { - this._data.delete(item); - } - decay.clear(); - if (this._data.size === 0) { - this._enterIdleMode(); +/** + * @template T + * @typedef {Object} Options + * @property {Record} maxSize maximum size of a group + * @property {Record} minSize minimum size of a group (preferred over maximum size) + * @property {Iterable} items a list of items + * @property {function(T): Record} getSize function to get size of an item + * @property {function(T): string} getKey function to get the key of an item + */ + +/** + * @template T + * @param {Options} options options object + * @returns {GroupedItems[]} grouped items + */ +module.exports = ({ maxSize, minSize, items, getSize, getKey }) => { + /** @type {Group[]} */ + const result = []; + + const nodes = Array.from( + items, + item => new Node(item, getKey(item), getSize(item)) + ); + + /** @type {Node[]} */ + const initialNodes = []; + + // lexically ordering of keys + nodes.sort((a, b) => { + if (a.key < b.key) return -1; + if (a.key > b.key) return 1; + return 0; + }); + + // return nodes bigger than maxSize directly as group + // But make sure that minSize is not violated + for (const node of nodes) { + if (isTooBig(node.size, maxSize) && !isTooSmall(node.size, minSize)) { + result.push(new Group([node], [])); } else { - // @ts-ignore _nextDecay is always a number in sync mode - this._nextDecay += this._tickInterval; + initialNodes.push(node); } } - _runDecays() { - while ( - /** @type {number} */ (this._nextDecay) <= Date.now() && - this._mode !== STORAGE_MODE_IDLE - ) { - this._decayLevel(); - } - } + if (initialNodes.length > 0) { + const initialGroup = new Group(initialNodes, getSimilarities(initialNodes)); - _enterAsyncMode() { - let timeout = 0; - switch (this._mode) { - case STORAGE_MODE_ASYNC: - return; - case STORAGE_MODE_IDLE: - this._nextDecay = Date.now() + this._tickInterval; - timeout = this._tickInterval; - break; - case STORAGE_MODE_SYNC: - this._runDecays(); - // @ts-ignore _runDecays may change the mode - if (this._mode === STORAGE_MODE_IDLE) return; - timeout = Math.max( - 0, - /** @type {number} */ (this._nextDecay) - Date.now() + const removeProblematicNodes = (group, consideredSize = group.size) => { + const problemTypes = getTooSmallTypes(consideredSize, minSize); + if (problemTypes.size > 0) { + // We hit an edge case where the working set is already smaller than minSize + // We merge problematic nodes with the smallest result node to keep minSize intact + const problemNodes = group.popNodes( + n => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0 ); - break; - } - this._mode = STORAGE_MODE_ASYNC; - const ref = setTimeout(() => { - this._mode = STORAGE_MODE_SYNC; - this._runDecays(); - }, timeout); - if (ref.unref) ref.unref(); - this._timeout = ref; - } + if (problemNodes === undefined) return false; + // Only merge it with result nodes that have the problematic size type + const possibleResultGroups = result.filter( + n => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0 + ); + if (possibleResultGroups.length > 0) { + const bestGroup = possibleResultGroups.reduce((min, group) => { + const minMatches = getNumberOfMatchingSizeTypes(min, problemTypes); + const groupMatches = getNumberOfMatchingSizeTypes( + group, + problemTypes + ); + if (minMatches !== groupMatches) + return minMatches < groupMatches ? group : min; + if ( + selectiveSizeSum(min.size, problemTypes) > + selectiveSizeSum(group.size, problemTypes) + ) + return group; + return min; + }); + for (const node of problemNodes) bestGroup.nodes.push(node); + bestGroup.nodes.sort((a, b) => { + if (a.key < b.key) return -1; + if (a.key > b.key) return 1; + return 0; + }); + } else { + // There are no other nodes with the same size types + // We create a new group and have to accept that it's smaller than minSize + result.push(new Group(problemNodes, null)); + } + return true; + } else { + return false; + } + }; - _enterSyncModeWhenIdle() { - if (this._mode === STORAGE_MODE_IDLE) { - this._mode = STORAGE_MODE_SYNC; - this._nextDecay = Date.now() + this._tickInterval; - } - } + if (initialGroup.nodes.length > 0) { + const queue = [initialGroup]; - _enterIdleMode() { - this._mode = STORAGE_MODE_IDLE; - this._nextDecay = undefined; - if (this._timeout) clearTimeout(this._timeout); - } -} + while (queue.length) { + const group = queue.pop(); + // only groups bigger than maxSize need to be splitted + if (!isTooBig(group.size, maxSize)) { + result.push(group); + continue; + } + // If the group is already too small + // we try to work only with the unproblematic nodes + if (removeProblematicNodes(group)) { + // This changed something, so we try this group again + queue.push(group); + continue; + } -const createBackend = (duration, provider, syncProvider, providerContext) => { - if (duration > 0) { - return new CacheBackend(duration, provider, syncProvider, providerContext); - } - return new OperationMergerBackend(provider, syncProvider, providerContext); -}; + // find unsplittable area from left and right + // going minSize from left and right + // at least one node need to be included otherwise we get stuck + let left = 1; + let leftSize = Object.create(null); + addSizeTo(leftSize, group.nodes[0].size); + while (left < group.nodes.length && isTooSmall(leftSize, minSize)) { + addSizeTo(leftSize, group.nodes[left].size); + left++; + } + let right = group.nodes.length - 2; + let rightSize = Object.create(null); + addSizeTo(rightSize, group.nodes[group.nodes.length - 1].size); + while (right >= 0 && isTooSmall(rightSize, minSize)) { + addSizeTo(rightSize, group.nodes[right].size); + right--; + } -module.exports = class CachedInputFileSystem { - constructor(fileSystem, duration) { - this.fileSystem = fileSystem; + // left v v right + // [ O O O ] O O O [ O O O ] + // ^^^^^^^^^ leftSize + // rightSize ^^^^^^^^^ + // leftSize > minSize + // rightSize > minSize - this._lstatBackend = createBackend( - duration, - this.fileSystem.lstat, - this.fileSystem.lstatSync, - this.fileSystem - ); - const lstat = this._lstatBackend.provide; - this.lstat = /** @type {FileSystem["lstat"]} */ (lstat); - const lstatSync = this._lstatBackend.provideSync; - this.lstatSync = /** @type {SyncFileSystem["lstatSync"]} */ (lstatSync); + // Perfect split: [ O O O ] [ O O O ] + // right === left - 1 - this._statBackend = createBackend( - duration, - this.fileSystem.stat, - this.fileSystem.statSync, - this.fileSystem - ); - const stat = this._statBackend.provide; - this.stat = /** @type {FileSystem["stat"]} */ (stat); - const statSync = this._statBackend.provideSync; - this.statSync = /** @type {SyncFileSystem["statSync"]} */ (statSync); + if (left - 1 > right) { + // We try to remove some problematic nodes to "fix" that + let prevSize; + if (right < group.nodes.length - left) { + subtractSizeFrom(rightSize, group.nodes[right + 1].size); + prevSize = rightSize; + } else { + subtractSizeFrom(leftSize, group.nodes[left - 1].size); + prevSize = leftSize; + } + if (removeProblematicNodes(group, prevSize)) { + // This changed something, so we try this group again + queue.push(group); + continue; + } + // can't split group while holding minSize + // because minSize is preferred of maxSize we return + // the problematic nodes as result here even while it's too big + // To avoid this make sure maxSize > minSize * 3 + result.push(group); + continue; + } + if (left <= right) { + // when there is a area between left and right + // we look for best split point + // we split at the minimum similarity + // here key space is separated the most + // But we also need to make sure to not create too small groups + let best = -1; + let bestSimilarity = Infinity; + let pos = left; + let rightSize = sumSize(group.nodes.slice(pos)); - this._readdirBackend = createBackend( - duration, - this.fileSystem.readdir, - this.fileSystem.readdirSync, - this.fileSystem - ); - const readdir = this._readdirBackend.provide; - this.readdir = /** @type {FileSystem["readdir"]} */ (readdir); - const readdirSync = this._readdirBackend.provideSync; - this.readdirSync = /** @type {SyncFileSystem["readdirSync"]} */ (readdirSync); + // pos v v right + // [ O O O ] O O O [ O O O ] + // ^^^^^^^^^ leftSize + // rightSize ^^^^^^^^^^^^^^^ - this._readFileBackend = createBackend( - duration, - this.fileSystem.readFile, - this.fileSystem.readFileSync, - this.fileSystem - ); - const readFile = this._readFileBackend.provide; - this.readFile = /** @type {FileSystem["readFile"]} */ (readFile); - const readFileSync = this._readFileBackend.provideSync; - this.readFileSync = /** @type {SyncFileSystem["readFileSync"]} */ (readFileSync); + while (pos <= right + 1) { + const similarity = group.similarities[pos - 1]; + if ( + similarity < bestSimilarity && + !isTooSmall(leftSize, minSize) && + !isTooSmall(rightSize, minSize) + ) { + best = pos; + bestSimilarity = similarity; + } + addSizeTo(leftSize, group.nodes[pos].size); + subtractSizeFrom(rightSize, group.nodes[pos].size); + pos++; + } + if (best < 0) { + // This can't happen + // but if that assumption is wrong + // fallback to a big group + result.push(group); + continue; + } + left = best; + right = best - 1; + } - this._readJsonBackend = createBackend( - duration, - this.fileSystem.readJson || - (this.readFile && - ((path, callback) => { - // @ts-ignore - this.readFile(path, (err, buffer) => { - if (err) return callback(err); - if (!buffer || buffer.length === 0) - return callback(new Error("No file content")); - let data; - try { - data = JSON.parse(buffer.toString("utf-8")); - } catch (e) { - return callback(e); - } - callback(null, data); - }); - })), - this.fileSystem.readJsonSync || - (this.readFileSync && - (path => { - const buffer = this.readFileSync(path); - const data = JSON.parse(buffer.toString("utf-8")); - return data; - })), - this.fileSystem - ); - const readJson = this._readJsonBackend.provide; - this.readJson = /** @type {FileSystem["readJson"]} */ (readJson); - const readJsonSync = this._readJsonBackend.provideSync; - this.readJsonSync = /** @type {SyncFileSystem["readJsonSync"]} */ (readJsonSync); + // create two new groups for left and right area + // and queue them up + const rightNodes = [group.nodes[right + 1]]; + /** @type {number[]} */ + const rightSimilarities = []; + for (let i = right + 2; i < group.nodes.length; i++) { + rightSimilarities.push(group.similarities[i - 1]); + rightNodes.push(group.nodes[i]); + } + queue.push(new Group(rightNodes, rightSimilarities)); - this._readlinkBackend = createBackend( - duration, - this.fileSystem.readlink, - this.fileSystem.readlinkSync, - this.fileSystem - ); - const readlink = this._readlinkBackend.provide; - this.readlink = /** @type {FileSystem["readlink"]} */ (readlink); - const readlinkSync = this._readlinkBackend.provideSync; - this.readlinkSync = /** @type {SyncFileSystem["readlinkSync"]} */ (readlinkSync); + const leftNodes = [group.nodes[0]]; + /** @type {number[]} */ + const leftSimilarities = []; + for (let i = 1; i < left; i++) { + leftSimilarities.push(group.similarities[i - 1]); + leftNodes.push(group.nodes[i]); + } + queue.push(new Group(leftNodes, leftSimilarities)); + } + } } - purge(what) { - this._statBackend.purge(what); - this._lstatBackend.purge(what); - this._readdirBackend.purgeParent(what); - this._readFileBackend.purge(what); - this._readlinkBackend.purge(what); - this._readJsonBackend.purge(what); + // lexically ordering + result.sort((a, b) => { + if (a.nodes[0].key < b.nodes[0].key) return -1; + if (a.nodes[0].key > b.nodes[0].key) return 1; + return 0; + }); + + // give every group a name + const usedNames = new Set(); + for (let i = 0; i < result.length; i++) { + const group = result[i]; + if (group.nodes.length === 1) { + group.key = group.nodes[0].key; + } else { + const first = group.nodes[0]; + const last = group.nodes[group.nodes.length - 1]; + const name = getName(first.key, last.key, usedNames); + group.key = name; + } } + + // return the results + return result.map(group => { + /** @type {GroupedItems} */ + return { + key: group.key, + items: group.nodes.map(node => node.item), + size: group.size + }; + }); }; /***/ }), -/***/ 22254: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 11850: +/***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Sam Chen @chenxsan */ -const basename = (__webpack_require__(82918).basename); - -/** @typedef {import("./Resolver")} Resolver */ - -module.exports = class CloneBasenamePlugin { - constructor(source, target) { - this.source = source; - this.target = target; - } - - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("CloneBasenamePlugin", (request, resolveContext, callback) => { - const filename = basename(request.path); - const filePath = resolver.join(request.path, filename); - const obj = { - ...request, - path: filePath, - relativePath: - request.relativePath && - resolver.join(request.relativePath, filename) - }; - resolver.doResolve( - target, - obj, - "using path: " + filePath, - resolveContext, - callback - ); - }); +/** + * @param {string} urlAndGlobal the script request + * @returns {string[]} script url and its global variable + */ +module.exports = function extractUrlAndGlobal(urlAndGlobal) { + const index = urlAndGlobal.indexOf("@"); + if (index <= 0 || index === urlAndGlobal.length - 1) { + throw new Error(`Invalid request "${urlAndGlobal}"`); } + return [urlAndGlobal.substring(index + 1), urlAndGlobal.substring(0, index)]; }; /***/ }), -/***/ 6953: +/***/ 6261: /***/ (function(module) { "use strict"; @@ -134551,167 +133276,233 @@ module.exports = class CloneBasenamePlugin { -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +const NO_MARKER = 0; +const IN_PROGRESS_MARKER = 1; +const DONE_MARKER = 2; +const DONE_MAYBE_ROOT_CYCLE_MARKER = 3; +const DONE_AND_ROOT_MARKER = 4; -module.exports = class ConditionalPlugin { +/** + * @template T + */ +class Node { /** - * @param {string | ResolveStepHook} source source - * @param {Partial} test compare object - * @param {string | null} message log message - * @param {boolean} allowAlternatives when false, do not continue with the current step when "test" matches - * @param {string | ResolveStepHook} target target + * @param {T} item the value of the node */ - constructor(source, test, message, allowAlternatives, target) { - this.source = source; - this.test = test; - this.message = message; - this.allowAlternatives = allowAlternatives; - this.target = target; + constructor(item) { + this.item = item; + /** @type {Set>} */ + this.dependencies = new Set(); + this.marker = NO_MARKER; + /** @type {Cycle | undefined} */ + this.cycle = undefined; + this.incoming = 0; } +} - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - const { test, message, allowAlternatives } = this; - const keys = Object.keys(test); - resolver - .getHook(this.source) - .tapAsync("ConditionalPlugin", (request, resolveContext, callback) => { - for (const prop of keys) { - if (request[prop] !== test[prop]) return callback(); - } - resolver.doResolve( - target, - request, - message, - resolveContext, - allowAlternatives - ? callback - : (err, result) => { - if (err) return callback(err); - - // Don't allow other alternatives - if (result === undefined) return callback(null, null); - callback(null, result); - } - ); - }); +/** + * @template T + */ +class Cycle { + constructor() { + /** @type {Set>} */ + this.nodes = new Set(); } -}; +} +/** + * @template T + * @typedef {Object} StackEntry + * @property {Node} node + * @property {Node[]} openEdges + */ -/***/ }), +/** + * @template T + * @param {Iterable} items list of items + * @param {function(T): Iterable} getDependencies function to get dependencies of an item (items that are not in list are ignored) + * @returns {Iterable} graph roots of the items + */ +module.exports = (items, getDependencies) => { + /** @type {Map>} */ + const itemToNode = new Map(); + for (const item of items) { + const node = new Node(item); + itemToNode.set(item, node); + } -/***/ 44112: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // early exit when there is only a single item + if (itemToNode.size <= 1) return items; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // grab all the dependencies + for (const node of itemToNode.values()) { + for (const dep of getDependencies(node.item)) { + const depNode = itemToNode.get(dep); + if (depNode !== undefined) { + node.dependencies.add(depNode); + } + } + } + // Set of current root modules + // items will be removed if a new reference to it has been found + /** @type {Set>} */ + const roots = new Set(); + // Set of current cycles without references to it + // cycles will be removed if a new reference to it has been found + // that is not part of the cycle + /** @type {Set>} */ + const rootCycles = new Set(); -const DescriptionFileUtils = __webpack_require__(25424); + // For all non-marked nodes + for (const selectedNode of itemToNode.values()) { + if (selectedNode.marker === NO_MARKER) { + // deep-walk all referenced modules + // in a non-recursive way -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + // start by entering the selected node + selectedNode.marker = IN_PROGRESS_MARKER; -module.exports = class DescriptionFilePlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string[]} filenames filenames - * @param {boolean} pathIsFile pathIsFile - * @param {string | ResolveStepHook} target target - */ - constructor(source, filenames, pathIsFile, target) { - this.source = source; - this.filenames = filenames; - this.pathIsFile = pathIsFile; - this.target = target; - } + // keep a stack to avoid recursive walk + /** @type {StackEntry[]} */ + const stack = [ + { + node: selectedNode, + openEdges: Array.from(selectedNode.dependencies) + } + ]; - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync( - "DescriptionFilePlugin", - (request, resolveContext, callback) => { - const path = request.path; - if (!path) return callback(); - const directory = this.pathIsFile - ? DescriptionFileUtils.cdUp(path) - : path; - if (!directory) return callback(); - DescriptionFileUtils.loadDescriptionFile( - resolver, - directory, - this.filenames, - request.descriptionFilePath - ? { - path: request.descriptionFilePath, - content: request.descriptionFileData, - directory: /** @type {string} */ (request.descriptionFileRoot) - } - : undefined, - resolveContext, - (err, result) => { - if (err) return callback(err); - if (!result) { - if (resolveContext.log) - resolveContext.log( - `No description file found in ${directory} or above` - ); - return callback(); - } - const relativePath = - "." + path.substr(result.directory.length).replace(/\\/g, "/"); - const obj = { - ...request, - descriptionFilePath: result.path, - descriptionFileData: result.content, - descriptionFileRoot: result.directory, - relativePath: relativePath - }; - resolver.doResolve( - target, - obj, - "using description file: " + - result.path + - " (relative path: " + - relativePath + - ")", - resolveContext, - (err, result) => { - if (err) return callback(err); + // process the top item until stack is empty + while (stack.length > 0) { + const topOfStack = stack[stack.length - 1]; - // Don't allow other processing - if (result === undefined) return callback(null, null); - callback(null, result); + // Are there still edges unprocessed in the current node? + if (topOfStack.openEdges.length > 0) { + // Process one dependency + const dependency = topOfStack.openEdges.pop(); + switch (dependency.marker) { + case NO_MARKER: + // dependency has not be visited yet + // mark it as in-progress and recurse + stack.push({ + node: dependency, + openEdges: Array.from(dependency.dependencies) + }); + dependency.marker = IN_PROGRESS_MARKER; + break; + case IN_PROGRESS_MARKER: { + // It's a in-progress cycle + let cycle = dependency.cycle; + if (!cycle) { + cycle = new Cycle(); + cycle.nodes.add(dependency); + dependency.cycle = cycle; + } + // set cycle property for each node in the cycle + // if nodes are already part of a cycle + // we merge the cycles to a shared cycle + for ( + let i = stack.length - 1; + stack[i].node !== dependency; + i-- + ) { + const node = stack[i].node; + if (node.cycle) { + if (node.cycle !== cycle) { + // merge cycles + for (const cycleNode of node.cycle.nodes) { + cycleNode.cycle = cycle; + cycle.nodes.add(cycleNode); + } + } + } else { + node.cycle = cycle; + cycle.nodes.add(node); } - ); + } + // don't recurse into dependencies + // these are already on the stack + break; } - ); + case DONE_AND_ROOT_MARKER: + // This node has be visited yet and is currently a root node + // But as this is a new reference to the node + // it's not really a root + // so we have to convert it to a normal node + dependency.marker = DONE_MARKER; + roots.delete(dependency); + break; + case DONE_MAYBE_ROOT_CYCLE_MARKER: + // This node has be visited yet and + // is maybe currently part of a completed root cycle + // we found a new reference to the cycle + // so it's not really a root cycle + // remove the cycle from the root cycles + // and convert it to a normal node + rootCycles.delete(dependency.cycle); + dependency.marker = DONE_MARKER; + break; + // DONE_MARKER: nothing to do, don't recurse into dependencies + } + } else { + // All dependencies of the current node has been visited + // we leave the node + stack.pop(); + topOfStack.node.marker = DONE_MARKER; + } + } + const cycle = selectedNode.cycle; + if (cycle) { + for (const node of cycle.nodes) { + node.marker = DONE_MAYBE_ROOT_CYCLE_MARKER; + } + rootCycles.add(cycle); + } else { + selectedNode.marker = DONE_AND_ROOT_MARKER; + roots.add(selectedNode); + } + } + } + + // Extract roots from root cycles + // We take the nodes with most incoming edges + // inside of the cycle + for (const cycle of rootCycles) { + let max = 0; + /** @type {Set>} */ + const cycleRoots = new Set(); + const nodes = cycle.nodes; + for (const node of nodes) { + for (const dep of node.dependencies) { + if (nodes.has(dep)) { + dep.incoming++; + if (dep.incoming < max) continue; + if (dep.incoming > max) { + cycleRoots.clear(); + max = dep.incoming; + } + cycleRoots.add(dep); } - ); + } + } + for (const cycleRoot of cycleRoots) { + roots.add(cycleRoot); + } + } + + // When roots were found, return them + if (roots.size > 0) { + return Array.from(roots, r => r.item); + } else { + throw new Error("Implementation of findGraphRoots is broken"); } }; /***/ }), -/***/ 25424: +/***/ 17139: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; @@ -134722,403 +133513,418 @@ module.exports = class DescriptionFilePlugin { -const forEachBail = __webpack_require__(78565); +const path = __webpack_require__(71017); -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveContext} ResolveContext */ +/** @typedef {import("../../declarations/WebpackOptions").WatchOptions} WatchOptions */ +/** @typedef {import("../FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */ /** - * @typedef {Object} DescriptionFileInfo - * @property {any=} content - * @property {string} path - * @property {string} directory + * @typedef {Object} IStats + * @property {() => boolean} isFile + * @property {() => boolean} isDirectory + * @property {() => boolean} isBlockDevice + * @property {() => boolean} isCharacterDevice + * @property {() => boolean} isSymbolicLink + * @property {() => boolean} isFIFO + * @property {() => boolean} isSocket + * @property {number | bigint} dev + * @property {number | bigint} ino + * @property {number | bigint} mode + * @property {number | bigint} nlink + * @property {number | bigint} uid + * @property {number | bigint} gid + * @property {number | bigint} rdev + * @property {number | bigint} size + * @property {number | bigint} blksize + * @property {number | bigint} blocks + * @property {number | bigint} atimeMs + * @property {number | bigint} mtimeMs + * @property {number | bigint} ctimeMs + * @property {number | bigint} birthtimeMs + * @property {Date} atime + * @property {Date} mtime + * @property {Date} ctime + * @property {Date} birthtime */ /** - * @callback ErrorFirstCallback - * @param {Error|null=} error - * @param {DescriptionFileInfo=} result + * @typedef {Object} IDirent + * @property {() => boolean} isFile + * @property {() => boolean} isDirectory + * @property {() => boolean} isBlockDevice + * @property {() => boolean} isCharacterDevice + * @property {() => boolean} isSymbolicLink + * @property {() => boolean} isFIFO + * @property {() => boolean} isSocket + * @property {string | Buffer} name */ +/** @typedef {function((NodeJS.ErrnoException | null)=): void} Callback */ +/** @typedef {function((NodeJS.ErrnoException | null)=, Buffer=): void} BufferCallback */ +/** @typedef {function((NodeJS.ErrnoException | null)=, Buffer|string=): void} BufferOrStringCallback */ +/** @typedef {function((NodeJS.ErrnoException | null)=, (string | Buffer)[] | IDirent[]=): void} DirentArrayCallback */ +/** @typedef {function((NodeJS.ErrnoException | null)=, string=): void} StringCallback */ +/** @typedef {function((NodeJS.ErrnoException | null)=, number=): void} NumberCallback */ +/** @typedef {function((NodeJS.ErrnoException | null)=, IStats=): void} StatsCallback */ +/** @typedef {function((NodeJS.ErrnoException | Error | null)=, any=): void} ReadJsonCallback */ +/** @typedef {function((NodeJS.ErrnoException | Error | null)=, IStats|string=): void} LstatReadlinkAbsoluteCallback */ + /** - * @param {Resolver} resolver resolver - * @param {string} directory directory - * @param {string[]} filenames filenames - * @param {DescriptionFileInfo|undefined} oldInfo oldInfo - * @param {ResolveContext} resolveContext resolveContext - * @param {ErrorFirstCallback} callback callback + * @typedef {Object} WatcherInfo + * @property {Set} changes get current aggregated changes that have not yet send to callback + * @property {Set} removals get current aggregated removals that have not yet send to callback + * @property {Map} fileTimeInfoEntries get info about files + * @property {Map} contextTimeInfoEntries get info about directories */ -function loadDescriptionFile( - resolver, - directory, - filenames, - oldInfo, - resolveContext, - callback -) { - (function findDescriptionFile() { - if (oldInfo && oldInfo.directory === directory) { - // We already have info for this directory and can reuse it - return callback(null, oldInfo); - } - forEachBail( - filenames, - (filename, callback) => { - const descriptionFilePath = resolver.join(directory, filename); - if (resolver.fileSystem.readJson) { - resolver.fileSystem.readJson(descriptionFilePath, (err, content) => { - if (err) { - if (typeof err.code !== "undefined") { - if (resolveContext.missingDependencies) { - resolveContext.missingDependencies.add(descriptionFilePath); - } - return callback(); - } - if (resolveContext.fileDependencies) { - resolveContext.fileDependencies.add(descriptionFilePath); - } - return onJson(err); - } - if (resolveContext.fileDependencies) { - resolveContext.fileDependencies.add(descriptionFilePath); - } - onJson(null, content); - }); - } else { - resolver.fileSystem.readFile(descriptionFilePath, (err, content) => { - if (err) { - if (resolveContext.missingDependencies) { - resolveContext.missingDependencies.add(descriptionFilePath); - } - return callback(); - } - if (resolveContext.fileDependencies) { - resolveContext.fileDependencies.add(descriptionFilePath); - } - let json; - - if (content) { - try { - json = JSON.parse(content.toString()); - } catch (e) { - return onJson(e); - } - } else { - return onJson(new Error("No content in file")); - } - - onJson(null, json); - }); - } - - function onJson(err, content) { - if (err) { - if (resolveContext.log) - resolveContext.log( - descriptionFilePath + " (directory description file): " + err - ); - else - err.message = - descriptionFilePath + " (directory description file): " + err; - return callback(err); - } - callback(null, { - content, - directory, - path: descriptionFilePath - }); - } - }, - (err, result) => { - if (err) return callback(err); - if (result) { - return callback(null, result); - } else { - const dir = cdUp(directory); - if (!dir) { - return callback(); - } else { - directory = dir; - return findDescriptionFile(); - } - } - } - ); - })(); -} +// TODO webpack 6 deprecate missing getInfo /** - * @param {any} content content - * @param {string|string[]} field field - * @returns {object|string|number|boolean|undefined} field data + * @typedef {Object} Watcher + * @property {function(): void} close closes the watcher and all underlying file watchers + * @property {function(): void} pause closes the watcher, but keeps underlying file watchers alive until the next watch call + * @property {function(): Set=} getAggregatedChanges get current aggregated changes that have not yet send to callback + * @property {function(): Set=} getAggregatedRemovals get current aggregated removals that have not yet send to callback + * @property {function(): Map} getFileTimeInfoEntries get info about files + * @property {function(): Map} getContextTimeInfoEntries get info about directories + * @property {function(): WatcherInfo=} getInfo get info about timestamps and changes */ -function getField(content, field) { - if (!content) return undefined; - if (Array.isArray(field)) { - let current = content; - for (let j = 0; j < field.length; j++) { - if (current === null || typeof current !== "object") { - current = null; - break; - } - current = current[field[j]]; - } - return current; - } else { - return content[field]; - } -} /** - * @param {string} directory directory - * @returns {string|null} parent directory or null + * @callback WatchMethod + * @param {Iterable} files watched files + * @param {Iterable} directories watched directories + * @param {Iterable} missing watched exitance entries + * @param {number} startTime timestamp of start time + * @param {WatchOptions} options options object + * @param {function(Error=, Map, Map, Set, Set): void} callback aggregated callback + * @param {function(string, number): void} callbackUndelayed callback when the first change was detected + * @returns {Watcher} a watcher */ -function cdUp(directory) { - if (directory === "/") return null; - const i = directory.lastIndexOf("/"), - j = directory.lastIndexOf("\\"); - const p = i < 0 ? j : j < 0 ? i : i < j ? j : i; - if (p < 0) return null; - return directory.substr(0, p || 1); -} -exports.loadDescriptionFile = loadDescriptionFile; -exports.getField = getField; -exports.cdUp = cdUp; +// TODO webpack 6 make optional methods required +/** + * @typedef {Object} OutputFileSystem + * @property {function(string, Buffer|string, Callback): void} writeFile + * @property {function(string, Callback): void} mkdir + * @property {function(string, DirentArrayCallback): void=} readdir + * @property {function(string, Callback): void=} rmdir + * @property {function(string, Callback): void=} unlink + * @property {function(string, StatsCallback): void} stat + * @property {function(string, StatsCallback): void=} lstat + * @property {function(string, BufferOrStringCallback): void} readFile + * @property {(function(string, string): string)=} join + * @property {(function(string, string): string)=} relative + * @property {(function(string): string)=} dirname + */ -/***/ }), +/** + * @typedef {Object} InputFileSystem + * @property {function(string, BufferOrStringCallback): void} readFile + * @property {(function(string, ReadJsonCallback): void)=} readJson + * @property {function(string, BufferOrStringCallback): void} readlink + * @property {function(string, DirentArrayCallback): void} readdir + * @property {function(string, StatsCallback): void} stat + * @property {function(string, StatsCallback): void=} lstat + * @property {(function(string, BufferOrStringCallback): void)=} realpath + * @property {(function(string=): void)=} purge + * @property {(function(string, string): string)=} join + * @property {(function(string, string): string)=} relative + * @property {(function(string): string)=} dirname + */ -/***/ 60895: -/***/ (function(module) { +/** + * @typedef {Object} WatchFileSystem + * @property {WatchMethod} watch + */ -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** + * @typedef {Object} IntermediateFileSystemExtras + * @property {function(string): void} mkdirSync + * @property {function(string): NodeJS.WritableStream} createWriteStream + * @property {function(string, string, NumberCallback): void} open + * @property {function(number, Buffer, number, number, number, NumberCallback): void} read + * @property {function(number, Callback): void} close + * @property {function(string, string, Callback): void} rename + */ +/** @typedef {InputFileSystem & OutputFileSystem & IntermediateFileSystemExtras} IntermediateFileSystem */ +/** + * + * @param {InputFileSystem|OutputFileSystem|undefined} fs a file system + * @param {string} rootPath the root path + * @param {string} targetPath the target path + * @returns {string} location of targetPath relative to rootPath + */ +const relative = (fs, rootPath, targetPath) => { + if (fs && fs.relative) { + return fs.relative(rootPath, targetPath); + } else if (path.posix.isAbsolute(rootPath)) { + return path.posix.relative(rootPath, targetPath); + } else if (path.win32.isAbsolute(rootPath)) { + return path.win32.relative(rootPath, targetPath); + } else { + throw new Error( + `${rootPath} is neither a posix nor a windows path, and there is no 'relative' method defined in the file system` + ); + } +}; +exports.relative = relative; -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +/** + * @param {InputFileSystem|OutputFileSystem|undefined} fs a file system + * @param {string} rootPath a path + * @param {string} filename a filename + * @returns {string} the joined path + */ +const join = (fs, rootPath, filename) => { + if (fs && fs.join) { + return fs.join(rootPath, filename); + } else if (path.posix.isAbsolute(rootPath)) { + return path.posix.join(rootPath, filename); + } else if (path.win32.isAbsolute(rootPath)) { + return path.win32.join(rootPath, filename); + } else { + throw new Error( + `${rootPath} is neither a posix nor a windows path, and there is no 'join' method defined in the file system` + ); + } +}; +exports.join = join; -module.exports = class DirectoryExistsPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string | ResolveStepHook} target target - */ - constructor(source, target) { - this.source = source; - this.target = target; +/** + * @param {InputFileSystem|OutputFileSystem|undefined} fs a file system + * @param {string} absPath an absolute path + * @returns {string} the parent directory of the absolute path + */ +const dirname = (fs, absPath) => { + if (fs && fs.dirname) { + return fs.dirname(absPath); + } else if (path.posix.isAbsolute(absPath)) { + return path.posix.dirname(absPath); + } else if (path.win32.isAbsolute(absPath)) { + return path.win32.dirname(absPath); + } else { + throw new Error( + `${absPath} is neither a posix nor a windows path, and there is no 'dirname' method defined in the file system` + ); } +}; +exports.dirname = dirname; - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync( - "DirectoryExistsPlugin", - (request, resolveContext, callback) => { - const fs = resolver.fileSystem; - const directory = request.path; - if (!directory) return callback(); - fs.stat(directory, (err, stat) => { - if (err || !stat) { - if (resolveContext.missingDependencies) - resolveContext.missingDependencies.add(directory); - if (resolveContext.log) - resolveContext.log(directory + " doesn't exist"); - return callback(); - } - if (!stat.isDirectory()) { - if (resolveContext.missingDependencies) - resolveContext.missingDependencies.add(directory); - if (resolveContext.log) - resolveContext.log(directory + " is not a directory"); - return callback(); +/** + * @param {OutputFileSystem} fs a file system + * @param {string} p an absolute path + * @param {function(Error=): void} callback callback function for the error + * @returns {void} + */ +const mkdirp = (fs, p, callback) => { + fs.mkdir(p, err => { + if (err) { + if (err.code === "ENOENT") { + const dir = dirname(fs, p); + if (dir === p) { + callback(err); + return; + } + mkdirp(fs, dir, err => { + if (err) { + callback(err); + return; + } + fs.mkdir(p, err => { + if (err) { + if (err.code === "EEXIST") { + callback(); + return; + } + callback(err); + return; } - if (resolveContext.fileDependencies) - resolveContext.fileDependencies.add(directory); - resolver.doResolve( - target, - request, - `existing directory ${directory}`, - resolveContext, - callback - ); + callback(); }); + }); + return; + } else if (err.code === "EEXIST") { + callback(); + return; + } + callback(err); + return; + } + callback(); + }); +}; +exports.mkdirp = mkdirp; + +/** + * @param {IntermediateFileSystem} fs a file system + * @param {string} p an absolute path + * @returns {void} + */ +const mkdirpSync = (fs, p) => { + try { + fs.mkdirSync(p); + } catch (err) { + if (err) { + if (err.code === "ENOENT") { + const dir = dirname(fs, p); + if (dir === p) { + throw err; + } + mkdirpSync(fs, dir); + fs.mkdirSync(p); + return; + } else if (err.code === "EEXIST") { + return; + } + throw err; + } + } +}; +exports.mkdirpSync = mkdirpSync; + +/** + * @param {InputFileSystem} fs a file system + * @param {string} p an absolute path + * @param {ReadJsonCallback} callback callback + * @returns {void} + */ +const readJson = (fs, p, callback) => { + if ("readJson" in fs) return fs.readJson(p, callback); + fs.readFile(p, (err, buf) => { + if (err) return callback(err); + let data; + try { + data = JSON.parse(buf.toString("utf-8")); + } catch (e) { + return callback(e); + } + return callback(null, data); + }); +}; +exports.readJson = readJson; + +/** + * @param {InputFileSystem} fs a file system + * @param {string} p an absolute path + * @param {ReadJsonCallback} callback callback + * @returns {void} + */ +const lstatReadlinkAbsolute = (fs, p, callback) => { + let i = 3; + const doReadLink = () => { + fs.readlink(p, (err, target) => { + if (err && --i > 0) { + // It might was just changed from symlink to file + // we retry 2 times to catch this case before throwing the error + return doStat(); + } + if (err || !target) return doStat(); + const value = target.toString(); + callback(null, join(fs, dirname(fs, p), value)); + }); + }; + const doStat = () => { + if ("lstat" in fs) { + return fs.lstat(p, (err, stats) => { + if (err) return callback(err); + if (stats.isSymbolicLink()) { + return doReadLink(); } - ); - } + callback(null, stats); + }); + } else { + return fs.stat(p, callback); + } + }; + if ("lstat" in fs) return doStat(); + doReadLink(); }; +exports.lstatReadlinkAbsolute = lstatReadlinkAbsolute; /***/ }), -/***/ 83849: +/***/ 59461: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ -const path = __webpack_require__(71017); -const DescriptionFileUtils = __webpack_require__(25424); -const forEachBail = __webpack_require__(78565); -const { processExportsField } = __webpack_require__(55863); -const { parseIdentifier } = __webpack_require__(71053); -const { checkExportsFieldTarget } = __webpack_require__(67079); +const Hash = __webpack_require__(36692); +const MAX_SHORT_STRING = (__webpack_require__(1842).MAX_SHORT_STRING); -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -/** @typedef {import("./util/entrypoints").ExportsField} ExportsField */ -/** @typedef {import("./util/entrypoints").FieldProcessor} FieldProcessor */ +class BatchedHash extends Hash { + constructor(hash) { + super(); + this.string = undefined; + this.encoding = undefined; + this.hash = hash; + } -module.exports = class ExportsFieldPlugin { /** - * @param {string | ResolveStepHook} source source - * @param {Set} conditionNames condition names - * @param {string | string[]} fieldNamePath name path - * @param {string | ResolveStepHook} target target + * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} + * @param {string|Buffer} data data + * @param {string=} inputEncoding data encoding + * @returns {this} updated hash */ - constructor(source, conditionNames, fieldNamePath, target) { - this.source = source; - this.target = target; - this.conditionNames = conditionNames; - this.fieldName = fieldNamePath; - /** @type {WeakMap} */ - this.fieldProcessorCache = new WeakMap(); + update(data, inputEncoding) { + if (this.string !== undefined) { + if ( + typeof data === "string" && + inputEncoding === this.encoding && + this.string.length + data.length < MAX_SHORT_STRING + ) { + this.string += data; + return this; + } + this.hash.update(this.string, this.encoding); + this.string = undefined; + } + if (typeof data === "string") { + if ( + data.length < MAX_SHORT_STRING && + // base64 encoding is not valid since it may contain padding chars + (!inputEncoding || !inputEncoding.startsWith("ba")) + ) { + this.string = data; + this.encoding = inputEncoding; + } else { + this.hash.update(data, inputEncoding); + } + } else { + this.hash.update(data); + } + return this; } /** - * @param {Resolver} resolver the resolver - * @returns {void} + * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} + * @param {string=} encoding encoding of the return value + * @returns {string|Buffer} digest */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("ExportsFieldPlugin", (request, resolveContext, callback) => { - // When there is no description file, abort - if (!request.descriptionFilePath) return callback(); - if ( - // When the description file is inherited from parent, abort - // (There is no description file inside of this package) - request.relativePath !== "." || - request.request === undefined - ) - return callback(); - - const remainingRequest = - request.query || request.fragment - ? (request.request === "." ? "./" : request.request) + - request.query + - request.fragment - : request.request; - /** @type {ExportsField|null} */ - const exportsField = DescriptionFileUtils.getField( - request.descriptionFileData, - this.fieldName - ); - if (!exportsField) return callback(); - - if (request.directory) { - return callback( - new Error( - `Resolving to directories is not possible with the exports field (request was ${remainingRequest}/)` - ) - ); - } - - let paths; - - try { - // We attach the cache to the description file instead of the exportsField value - // because we use a WeakMap and the exportsField could be a string too. - // Description file is always an object when exports field can be accessed. - let fieldProcessor = this.fieldProcessorCache.get( - request.descriptionFileData - ); - if (fieldProcessor === undefined) { - fieldProcessor = processExportsField(exportsField); - this.fieldProcessorCache.set( - request.descriptionFileData, - fieldProcessor - ); - } - paths = fieldProcessor(remainingRequest, this.conditionNames); - } catch (err) { - if (resolveContext.log) { - resolveContext.log( - `Exports field in ${request.descriptionFilePath} can't be processed: ${err}` - ); - } - return callback(err); - } - - if (paths.length === 0) { - return callback( - new Error( - `Package path ${remainingRequest} is not exported from package ${request.descriptionFileRoot} (see exports field in ${request.descriptionFilePath})` - ) - ); - } - - forEachBail( - paths, - (p, callback) => { - const parsedIdentifier = parseIdentifier(p); - - if (!parsedIdentifier) return callback(); - - const [relativePath, query, fragment] = parsedIdentifier; - - const error = checkExportsFieldTarget(relativePath); - - if (error) { - return callback(error); - } - - const obj = { - ...request, - request: undefined, - path: path.join( - /** @type {string} */ (request.descriptionFileRoot), - relativePath - ), - relativePath, - query, - fragment - }; - - resolver.doResolve( - target, - obj, - "using exports field: " + p, - resolveContext, - callback - ); - }, - (err, result) => callback(err, result || null) - ); - }); + digest(encoding) { + if (this.string !== undefined) { + this.hash.update(this.string, this.encoding); + } + return this.hash.digest(encoding); } -}; +} + +module.exports = BatchedHash; /***/ }), -/***/ 50295: -/***/ (function(module) { +/***/ 86884: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -135128,314 +133934,196 @@ module.exports = class ExportsFieldPlugin { -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +const create = __webpack_require__(1842); -module.exports = class FileExistsPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string | ResolveStepHook} target target - */ - constructor(source, target) { - this.source = source; - this.target = target; - } +//#region wasm code: md4 (../../../assembly/hash/md4.asm.ts) --initialMemory 1 +const md4 = new WebAssembly.Module( + Buffer.from( + // 2156 bytes + "AGFzbQEAAAABCAJgAX8AYAAAAwUEAQAAAAUDAQABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwciBARpbml0AAAGdXBkYXRlAAIFZmluYWwAAwZtZW1vcnkCAAqLEAQmAEGBxpS6BiQBQYnXtv5+JAJB/rnrxXkkA0H2qMmBASQEQQAkAAvSCgEZfyMBIQUjAiECIwMhAyMEIQQDQCAAIAFLBEAgASgCJCISIAEoAiAiEyABKAIcIgkgASgCGCIIIAEoAhQiByABKAIQIg4gASgCDCIGIAEoAggiDyABKAIEIhAgASgCACIRIAMgBHMgAnEgBHMgBWpqQQN3IgogAiADc3EgA3MgBGpqQQd3IgsgAiAKc3EgAnMgA2pqQQt3IgwgCiALc3EgCnMgAmpqQRN3Ig0gCyAMc3EgC3MgCmpqQQN3IgogDCANc3EgDHMgC2pqQQd3IgsgCiANc3EgDXMgDGpqQQt3IgwgCiALc3EgCnMgDWpqQRN3Ig0gCyAMc3EgC3MgCmpqQQN3IhQgDCANc3EgDHMgC2pqQQd3IRUgASgCLCILIAEoAigiCiAMIA0gDSAUcyAVcXNqakELdyIWIBQgFXNxIBRzIA1qakETdyEXIAEoAjQiGCABKAIwIhkgFSAWcyAXcSAVcyAUampBA3ciFCAWIBdzcSAWcyAVampBB3chFSABKAI8Ig0gASgCOCIMIBQgF3MgFXEgF3MgFmpqQQt3IhYgFCAVc3EgFHMgF2pqQRN3IRcgEyAOIBEgFCAVIBZyIBdxIBUgFnFyampBmfOJ1AVqQQN3IhQgFiAXcnEgFiAXcXIgFWpqQZnzidQFakEFdyIVIBQgF3JxIBQgF3FyIBZqakGZ84nUBWpBCXchFiAPIBggEiAWIAcgFSAQIBQgGSAUIBVyIBZxIBQgFXFyIBdqakGZ84nUBWpBDXciFCAVIBZycSAVIBZxcmpqQZnzidQFakEDdyIVIBQgFnJxIBQgFnFyampBmfOJ1AVqQQV3IhcgFCAVcnEgFCAVcXJqakGZ84nUBWpBCXciFiAVIBdycSAVIBdxciAUampBmfOJ1AVqQQ13IhQgFiAXcnEgFiAXcXIgFWpqQZnzidQFakEDdyEVIBEgBiAVIAwgFCAKIBYgCCAUIBZyIBVxIBQgFnFyIBdqakGZ84nUBWpBBXciFyAUIBVycSAUIBVxcmpqQZnzidQFakEJdyIWIBUgF3JxIBUgF3FyampBmfOJ1AVqQQ13IhQgFiAXcnEgFiAXcXJqakGZ84nUBWpBA3ciFSALIBYgCSAUIBZyIBVxIBQgFnFyIBdqakGZ84nUBWpBBXciFiAUIBVycSAUIBVxcmpqQZnzidQFakEJdyIXIA0gFSAWciAXcSAVIBZxciAUampBmfOJ1AVqQQ13IhRzIBZzampBodfn9gZqQQN3IREgByAIIA4gFCARIBcgESAUc3MgFmogE2pBodfn9gZqQQl3IhNzcyAXampBodfn9gZqQQt3Ig4gDyARIBMgDiARIA4gE3NzIBRqIBlqQaHX5/YGakEPdyIRc3NqakGh1+f2BmpBA3ciDyAOIA8gEXNzIBNqIApqQaHX5/YGakEJdyIKcyARc2pqQaHX5/YGakELdyIIIBAgDyAKIAggDCAPIAggCnNzIBFqakGh1+f2BmpBD3ciDHNzampBodfn9gZqQQN3Ig4gEiAIIAwgDnNzIApqakGh1+f2BmpBCXciCHMgDHNqakGh1+f2BmpBC3chByAFIAYgCCAHIBggDiAHIAhzcyAMampBodfn9gZqQQ93IgpzcyAOampBodfn9gZqQQN3IgZqIQUgDSAGIAkgByAGIAsgByAGIApzcyAIampBodfn9gZqQQl3IgdzIApzampBodfn9gZqQQt3IgYgB3NzIApqakGh1+f2BmpBD3cgAmohAiADIAZqIQMgBCAHaiEEIAFBQGshAQwBCwsgBSQBIAIkAiADJAMgBCQECw0AIAAQASAAIwBqJAAL/wQCA38BfiAAIwBqrUIDhiEEIABByABqQUBxIgJBCGshAyAAIgFBAWohACABQYABOgAAA0AgACACSUEAIABBB3EbBEAgAEEAOgAAIABBAWohAAwBCwsDQCAAIAJJBEAgAEIANwMAIABBCGohAAwBCwsgAyAENwMAIAIQAUEAIwGtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEIIwKtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEQIwOtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEYIwStIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAAs=", + "base64" + ) +); +//#endregion - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - const fs = resolver.fileSystem; - resolver - .getHook(this.source) - .tapAsync("FileExistsPlugin", (request, resolveContext, callback) => { - const file = request.path; - if (!file) return callback(); - fs.stat(file, (err, stat) => { - if (err || !stat) { - if (resolveContext.missingDependencies) - resolveContext.missingDependencies.add(file); - if (resolveContext.log) resolveContext.log(file + " doesn't exist"); - return callback(); - } - if (!stat.isFile()) { - if (resolveContext.missingDependencies) - resolveContext.missingDependencies.add(file); - if (resolveContext.log) resolveContext.log(file + " is not a file"); - return callback(); - } - if (resolveContext.fileDependencies) - resolveContext.fileDependencies.add(file); - resolver.doResolve( - target, - request, - "existing file: " + file, - resolveContext, - callback - ); - }); - }); - } -}; +module.exports = create.bind(null, md4, [], 64, 32); /***/ }), -/***/ 7317: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 1842: +/***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ -const path = __webpack_require__(71017); -const DescriptionFileUtils = __webpack_require__(25424); -const forEachBail = __webpack_require__(78565); -const { processImportsField } = __webpack_require__(55863); -const { parseIdentifier } = __webpack_require__(71053); +// 65536 is the size of a wasm memory page +// 64 is the maximum chunk size for every possible wasm hash implementation +// 4 is the maximum number of bytes per char for string encoding (max is utf-8) +// ~3 makes sure that it's always a block of 4 chars, so avoid partially encoded bytes for base64 +const MAX_SHORT_STRING = Math.floor((65536 - 64) / 4) & ~3; -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -/** @typedef {import("./util/entrypoints").FieldProcessor} FieldProcessor */ -/** @typedef {import("./util/entrypoints").ImportsField} ImportsField */ +class WasmHash { + /** + * @param {WebAssembly.Instance} instance wasm instance + * @param {WebAssembly.Instance[]} instancesPool pool of instances + * @param {number} chunkSize size of data chunks passed to wasm + * @param {number} digestSize size of digest returned by wasm + */ + constructor(instance, instancesPool, chunkSize, digestSize) { + const exports = /** @type {any} */ (instance.exports); + exports.init(); + this.exports = exports; + this.mem = Buffer.from(exports.memory.buffer, 0, 65536); + this.buffered = 0; + this.instancesPool = instancesPool; + this.chunkSize = chunkSize; + this.digestSize = digestSize; + } -const dotCode = ".".charCodeAt(0); + reset() { + this.buffered = 0; + this.exports.init(); + } -module.exports = class ImportsFieldPlugin { /** - * @param {string | ResolveStepHook} source source - * @param {Set} conditionNames condition names - * @param {string | string[]} fieldNamePath name path - * @param {string | ResolveStepHook} targetFile target file - * @param {string | ResolveStepHook} targetPackage target package + * @param {Buffer | string} data data + * @param {BufferEncoding=} encoding encoding + * @returns {this} itself */ - constructor( - source, - conditionNames, - fieldNamePath, - targetFile, - targetPackage - ) { - this.source = source; - this.targetFile = targetFile; - this.targetPackage = targetPackage; - this.conditionNames = conditionNames; - this.fieldName = fieldNamePath; - /** @type {WeakMap} */ - this.fieldProcessorCache = new WeakMap(); + update(data, encoding) { + if (typeof data === "string") { + while (data.length > MAX_SHORT_STRING) { + this._updateWithShortString(data.slice(0, MAX_SHORT_STRING), encoding); + data = data.slice(MAX_SHORT_STRING); + } + this._updateWithShortString(data, encoding); + return this; + } + this._updateWithBuffer(data); + return this; } /** - * @param {Resolver} resolver the resolver + * @param {string} data data + * @param {BufferEncoding=} encoding encoding * @returns {void} */ - apply(resolver) { - const targetFile = resolver.ensureHook(this.targetFile); - const targetPackage = resolver.ensureHook(this.targetPackage); - - resolver - .getHook(this.source) - .tapAsync("ImportsFieldPlugin", (request, resolveContext, callback) => { - // When there is no description file, abort - if (!request.descriptionFilePath || request.request === undefined) { - return callback(); - } - - const remainingRequest = - request.request + request.query + request.fragment; - /** @type {ImportsField|null} */ - const importsField = DescriptionFileUtils.getField( - request.descriptionFileData, - this.fieldName - ); - if (!importsField) return callback(); - - if (request.directory) { - return callback( - new Error( - `Resolving to directories is not possible with the imports field (request was ${remainingRequest}/)` - ) - ); - } - - let paths; - - try { - // We attach the cache to the description file instead of the importsField value - // because we use a WeakMap and the importsField could be a string too. - // Description file is always an object when exports field can be accessed. - let fieldProcessor = this.fieldProcessorCache.get( - request.descriptionFileData - ); - if (fieldProcessor === undefined) { - fieldProcessor = processImportsField(importsField); - this.fieldProcessorCache.set( - request.descriptionFileData, - fieldProcessor - ); - } - paths = fieldProcessor(remainingRequest, this.conditionNames); - } catch (err) { - if (resolveContext.log) { - resolveContext.log( - `Imports field in ${request.descriptionFilePath} can't be processed: ${err}` - ); + _updateWithShortString(data, encoding) { + const { exports, buffered, mem, chunkSize } = this; + let endPos; + if (data.length < 70) { + if (!encoding || encoding === "utf-8" || encoding === "utf8") { + endPos = buffered; + for (let i = 0; i < data.length; i++) { + const cc = data.charCodeAt(i); + if (cc < 0x80) mem[endPos++] = cc; + else if (cc < 0x800) { + mem[endPos] = (cc >> 6) | 0xc0; + mem[endPos + 1] = (cc & 0x3f) | 0x80; + endPos += 2; + } else { + // bail-out for weird chars + endPos += mem.write(data.slice(i), endPos, encoding); + break; } - return callback(err); - } - - if (paths.length === 0) { - return callback( - new Error( - `Package import ${remainingRequest} is not imported from package ${request.descriptionFileRoot} (see imports field in ${request.descriptionFilePath})` - ) - ); } - - forEachBail( - paths, - (p, callback) => { - const parsedIdentifier = parseIdentifier(p); - - if (!parsedIdentifier) return callback(); - - const [path_, query, fragment] = parsedIdentifier; - - switch (path_.charCodeAt(0)) { - // should be relative - case dotCode: { - const obj = { - ...request, - request: undefined, - path: path.join( - /** @type {string} */ (request.descriptionFileRoot), - path_ - ), - relativePath: path_, - query, - fragment - }; - - resolver.doResolve( - targetFile, - obj, - "using imports field: " + p, - resolveContext, - callback - ); - break; - } - - // package resolving - default: { - const obj = { - ...request, - request: path_, - relativePath: path_, - fullySpecified: true, - query, - fragment - }; - - resolver.doResolve( - targetPackage, - obj, - "using imports field: " + p, - resolveContext, - callback - ); - } - } - }, - (err, result) => callback(err, result || null) - ); - }); - } -}; - - -/***/ }), - -/***/ 35949: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - -const namespaceStartCharCode = "@".charCodeAt(0); - -module.exports = class JoinRequestPartPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string | ResolveStepHook} target target - */ - constructor(source, target) { - this.source = source; - this.target = target; + } else if (encoding === "latin1") { + endPos = buffered; + for (let i = 0; i < data.length; i++) { + const cc = data.charCodeAt(i); + mem[endPos++] = cc; + } + } else { + endPos = buffered + mem.write(data, buffered, encoding); + } + } else { + endPos = buffered + mem.write(data, buffered, encoding); + } + if (endPos < chunkSize) { + this.buffered = endPos; + } else { + const l = endPos & ~(this.chunkSize - 1); + exports.update(l); + const newBuffered = endPos - l; + this.buffered = newBuffered; + if (newBuffered > 0) mem.copyWithin(0, l, endPos); + } } /** - * @param {Resolver} resolver the resolver + * @param {Buffer} data data * @returns {void} */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync( - "JoinRequestPartPlugin", - (request, resolveContext, callback) => { - const req = request.request || ""; - let i = req.indexOf("/", 3); + _updateWithBuffer(data) { + const { exports, buffered, mem } = this; + const length = data.length; + if (buffered + length < this.chunkSize) { + data.copy(mem, buffered, 0, length); + this.buffered += length; + } else { + const l = (buffered + length) & ~(this.chunkSize - 1); + if (l > 65536) { + let i = 65536 - buffered; + data.copy(mem, buffered, 0, i); + exports.update(65536); + const stop = l - buffered - 65536; + while (i < stop) { + data.copy(mem, 0, i, i + 65536); + exports.update(65536); + i += 65536; + } + data.copy(mem, 0, i, l - buffered); + exports.update(l - buffered - i); + } else { + data.copy(mem, buffered, 0, l - buffered); + exports.update(l); + } + const newBuffered = length + buffered - l; + this.buffered = newBuffered; + if (newBuffered > 0) data.copy(mem, 0, length - newBuffered, length); + } + } - if (i >= 0 && req.charCodeAt(2) === namespaceStartCharCode) { - i = req.indexOf("/", i + 1); - } + digest(type) { + const { exports, buffered, mem, digestSize } = this; + exports.final(buffered); + this.instancesPool.push(this); + const hex = mem.toString("latin1", 0, digestSize); + if (type === "hex") return hex; + if (type === "binary" || !type) return Buffer.from(hex, "hex"); + return Buffer.from(hex, "hex").toString(type); + } +} - let moduleName, remainingRequest, fullySpecified; - if (i < 0) { - moduleName = req; - remainingRequest = "."; - fullySpecified = false; - } else { - moduleName = req.slice(0, i); - remainingRequest = "." + req.slice(i); - fullySpecified = request.fullySpecified; - } - const obj = { - ...request, - path: resolver.join(request.path, moduleName), - relativePath: - request.relativePath && - resolver.join(request.relativePath, moduleName), - request: remainingRequest, - fullySpecified - }; - resolver.doResolve(target, obj, null, resolveContext, callback); - } - ); +const create = (wasmModule, instancesPool, chunkSize, digestSize) => { + if (instancesPool.length > 0) { + const old = instancesPool.pop(); + old.reset(); + return old; + } else { + return new WasmHash( + new WebAssembly.Instance(wasmModule), + instancesPool, + chunkSize, + digestSize + ); } }; +module.exports = create; +module.exports.MAX_SHORT_STRING = MAX_SHORT_STRING; + /***/ }), -/***/ 5190: -/***/ (function(module) { +/***/ 35028: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -135445,336 +134133,410 @@ module.exports = class JoinRequestPartPlugin { -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +const create = __webpack_require__(1842); -module.exports = class JoinRequestPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string | ResolveStepHook} target target - */ - constructor(source, target) { - this.source = source; - this.target = target; - } +//#region wasm code: xxhash64 (../../../assembly/hash/xxhash64.asm.ts) --initialMemory 1 +const xxhash64 = new WebAssembly.Module( + Buffer.from( + // 1170 bytes + "AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrIIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEEIAUgASkDGELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEFIAAgAUEgaiIBSw0ACyACJAAgAyQBIAQkAiAFJAMLqAYCAX8EfiMEQgBSBH4jACICQgGJIwEiA0IHiXwjAiIEQgyJfCMDIgVCEol8IAJCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0gA0LP1tO+0ser2UJ+Qh+JQoeVr6+Ytt6bnn9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSAEQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IAVCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0FQsXP2bLx5brqJwsjBCAArXx8IQIDQCABQQhqIABNBEAgAiABKQMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQIgAUEIaiEBDAELCyABQQRqIABNBEAgAiABNQIAQoeVr6+Ytt6bnn9+hUIXiULP1tO+0ser2UJ+Qvnz3fGZ9pmrFnwhAiABQQRqIQELA0AgACABRwRAIAIgATEAAELFz9my8eW66id+hUILiUKHla+vmLbem55/fiECIAFBAWohAQwBCwtBACACIAJCIYiFQs/W077Sx6vZQn4iAkIdiCAChUL5893xmfaZqxZ+IgJCIIggAoUiAkIgiCIDQv//A4NCIIYgA0KAgPz/D4NCEIiEIgNC/4GAgPAfg0IQhiADQoD+g4CA4D+DQgiIhCIDQo+AvIDwgcAHg0IIhiADQvCBwIeAnoD4AINCBIiEIgNChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IANCsODAgYOGjJgwhHw3AwBBCCACQv////8PgyICQv//A4NCIIYgAkKAgPz/D4NCEIiEIgJC/4GAgPAfg0IQhiACQoD+g4CA4D+DQgiIhCICQo+AvIDwgcAHg0IIhiACQvCBwIeAnoD4AINCBIiEIgJChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IAJCsODAgYOGjJgwhHw3AwAL", + "base64" + ) +); +//#endregion - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("JoinRequestPlugin", (request, resolveContext, callback) => { - const obj = { - ...request, - path: resolver.join(request.path, request.request), - relativePath: - request.relativePath && - resolver.join(request.relativePath, request.request), - request: undefined - }; - resolver.doResolve(target, obj, null, resolveContext, callback); - }); - } -}; +module.exports = create.bind(null, xxhash64, [], 32, 16); /***/ }), -/***/ 5049: -/***/ (function(module) { +/***/ 82186: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -/** @typedef {import("./Resolver")} Resolver */ - -module.exports = class LogInfoPlugin { - constructor(source) { - this.source = source; - } +const path = __webpack_require__(71017); - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const source = this.source; - resolver - .getHook(this.source) - .tapAsync("LogInfoPlugin", (request, resolveContext, callback) => { - if (!resolveContext.log) return callback(); - const log = resolveContext.log; - const prefix = "[" + source + "] "; - if (request.path) - log(prefix + "Resolving in directory: " + request.path); - if (request.request) - log(prefix + "Resolving request: " + request.request); - if (request.module) log(prefix + "Request is an module request."); - if (request.directory) log(prefix + "Request is a directory request."); - if (request.query) - log(prefix + "Resolving request query: " + request.query); - if (request.fragment) - log(prefix + "Resolving request fragment: " + request.fragment); - if (request.descriptionFilePath) - log( - prefix + "Has description data from " + request.descriptionFilePath - ); - if (request.relativePath) - log( - prefix + - "Relative path from description file is: " + - request.relativePath - ); - callback(); - }); - } -}; +const WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/; +const SEGMENTS_SPLIT_REGEXP = /([|!])/; +const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g; +/** + * @typedef {Object} MakeRelativePathsCache + * @property {Map>=} relativePaths + */ -/***/ }), +const relativePathToRequest = relativePath => { + if (relativePath === "") return "./."; + if (relativePath === "..") return "../."; + if (relativePath.startsWith("../")) return relativePath; + return `./${relativePath}`; +}; -/***/ 47450: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * @param {string} context context for relative path + * @param {string} maybeAbsolutePath path to make relative + * @returns {string} relative path in request style + */ +const absoluteToRequest = (context, maybeAbsolutePath) => { + if (maybeAbsolutePath[0] === "/") { + if ( + maybeAbsolutePath.length > 1 && + maybeAbsolutePath[maybeAbsolutePath.length - 1] === "/" + ) { + // this 'path' is actually a regexp generated by dynamic requires. + // Don't treat it as an absolute path. + return maybeAbsolutePath; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const querySplitPos = maybeAbsolutePath.indexOf("?"); + let resource = + querySplitPos === -1 + ? maybeAbsolutePath + : maybeAbsolutePath.slice(0, querySplitPos); + resource = relativePathToRequest(path.posix.relative(context, resource)); + return querySplitPos === -1 + ? resource + : resource + maybeAbsolutePath.slice(querySplitPos); + } + if (WINDOWS_ABS_PATH_REGEXP.test(maybeAbsolutePath)) { + const querySplitPos = maybeAbsolutePath.indexOf("?"); + let resource = + querySplitPos === -1 + ? maybeAbsolutePath + : maybeAbsolutePath.slice(0, querySplitPos); + resource = path.win32.relative(context, resource); + if (!WINDOWS_ABS_PATH_REGEXP.test(resource)) { + resource = relativePathToRequest( + resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, "/") + ); + } + return querySplitPos === -1 + ? resource + : resource + maybeAbsolutePath.slice(querySplitPos); + } + // not an absolute path + return maybeAbsolutePath; +}; -const path = __webpack_require__(71017); -const DescriptionFileUtils = __webpack_require__(25424); +/** + * @param {string} context context for relative path + * @param {string} relativePath path + * @returns {string} absolute path + */ +const requestToAbsolute = (context, relativePath) => { + if (relativePath.startsWith("./") || relativePath.startsWith("../")) + return path.join(context, relativePath); + return relativePath; +}; -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -/** @typedef {{name: string|Array, forceRelative: boolean}} MainFieldOptions */ +const makeCacheable = realFn => { + /** @type {WeakMap>} */ + const cache = new WeakMap(); -const alreadyTriedMainField = Symbol("alreadyTriedMainField"); + const getCache = associatedObjectForCache => { + const entry = cache.get(associatedObjectForCache); + if (entry !== undefined) return entry; + /** @type {Map} */ + const map = new Map(); + cache.set(associatedObjectForCache, map); + return map; + }; -module.exports = class MainFieldPlugin { /** - * @param {string | ResolveStepHook} source source - * @param {MainFieldOptions} options options - * @param {string | ResolveStepHook} target target + * @param {string} str the path with query and fragment + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {ParsedResource} parsed parts */ - constructor(source, options, target) { - this.source = source; - this.options = options; - this.target = target; - } + const fn = (str, associatedObjectForCache) => { + if (!associatedObjectForCache) return realFn(str); + const cache = getCache(associatedObjectForCache); + const entry = cache.get(str); + if (entry !== undefined) return entry; + const result = realFn(str); + cache.set(str, result); + return result; + }; - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("MainFieldPlugin", (request, resolveContext, callback) => { - if ( - request.path !== request.descriptionFileRoot || - request[alreadyTriedMainField] === request.descriptionFilePath || - !request.descriptionFilePath - ) - return callback(); - const filename = path.basename(request.descriptionFilePath); - let mainModule = DescriptionFileUtils.getField( - request.descriptionFileData, - this.options.name - ); + fn.bindCache = associatedObjectForCache => { + const cache = getCache(associatedObjectForCache); + return str => { + const entry = cache.get(str); + if (entry !== undefined) return entry; + const result = realFn(str); + cache.set(str, result); + return result; + }; + }; - if ( - !mainModule || - typeof mainModule !== "string" || - mainModule === "." || - mainModule === "./" - ) { - return callback(); - } - if (this.options.forceRelative && !/^\.\.?\//.test(mainModule)) - mainModule = "./" + mainModule; - const obj = { - ...request, - request: mainModule, - module: false, - directory: mainModule.endsWith("/"), - [alreadyTriedMainField]: request.descriptionFilePath - }; - return resolver.doResolve( - target, - obj, - "use " + - mainModule + - " from " + - this.options.name + - " in " + - filename, - resolveContext, - callback - ); - }); - } + return fn; }; +const makeCacheableWithContext = fn => { + /** @type {WeakMap>>} */ + const cache = new WeakMap(); -/***/ }), + /** + * @param {string} context context used to create relative path + * @param {string} identifier identifier used to create relative path + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {string} the returned relative path + */ + const cachedFn = (context, identifier, associatedObjectForCache) => { + if (!associatedObjectForCache) return fn(context, identifier); -/***/ 79024: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + let innerCache = cache.get(associatedObjectForCache); + if (innerCache === undefined) { + innerCache = new Map(); + cache.set(associatedObjectForCache, innerCache); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + let cachedResult; + let innerSubCache = innerCache.get(context); + if (innerSubCache === undefined) { + innerCache.set(context, (innerSubCache = new Map())); + } else { + cachedResult = innerSubCache.get(identifier); + } + if (cachedResult !== undefined) { + return cachedResult; + } else { + const result = fn(context, identifier); + innerSubCache.set(identifier, result); + return result; + } + }; + /** + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {function(string, string): string} cached function + */ + cachedFn.bindCache = associatedObjectForCache => { + let innerCache; + if (associatedObjectForCache) { + innerCache = cache.get(associatedObjectForCache); + if (innerCache === undefined) { + innerCache = new Map(); + cache.set(associatedObjectForCache, innerCache); + } + } else { + innerCache = new Map(); + } -const forEachBail = __webpack_require__(78565); -const getPaths = __webpack_require__(82918); + /** + * @param {string} context context used to create relative path + * @param {string} identifier identifier used to create relative path + * @returns {string} the returned relative path + */ + const boundFn = (context, identifier) => { + let cachedResult; + let innerSubCache = innerCache.get(context); + if (innerSubCache === undefined) { + innerCache.set(context, (innerSubCache = new Map())); + } else { + cachedResult = innerSubCache.get(identifier); + } -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + if (cachedResult !== undefined) { + return cachedResult; + } else { + const result = fn(context, identifier); + innerSubCache.set(identifier, result); + return result; + } + }; + + return boundFn; + }; -module.exports = class ModulesInHierarchicalDirectoriesPlugin { /** - * @param {string | ResolveStepHook} source source - * @param {string | Array} directories directories - * @param {string | ResolveStepHook} target target + * @param {string} context context used to create relative path + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {function(string): string} cached function */ - constructor(source, directories, target) { - this.source = source; - this.directories = /** @type {Array} */ ([]).concat(directories); - this.target = target; - } + cachedFn.bindContextCache = (context, associatedObjectForCache) => { + let innerSubCache; + if (associatedObjectForCache) { + let innerCache = cache.get(associatedObjectForCache); + if (innerCache === undefined) { + innerCache = new Map(); + cache.set(associatedObjectForCache, innerCache); + } + + innerSubCache = innerCache.get(context); + if (innerSubCache === undefined) { + innerCache.set(context, (innerSubCache = new Map())); + } + } else { + innerSubCache = new Map(); + } + + /** + * @param {string} identifier identifier used to create relative path + * @returns {string} the returned relative path + */ + const boundFn = identifier => { + const cachedResult = innerSubCache.get(identifier); + if (cachedResult !== undefined) { + return cachedResult; + } else { + const result = fn(context, identifier); + innerSubCache.set(identifier, result); + return result; + } + }; + + return boundFn; + }; + + return cachedFn; +}; + +/** + * + * @param {string} context context for relative path + * @param {string} identifier identifier for path + * @returns {string} a converted relative path + */ +const _makePathsRelative = (context, identifier) => { + return identifier + .split(SEGMENTS_SPLIT_REGEXP) + .map(str => absoluteToRequest(context, str)) + .join(""); +}; - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync( - "ModulesInHierarchicalDirectoriesPlugin", - (request, resolveContext, callback) => { - const fs = resolver.fileSystem; - const addrs = getPaths(request.path) - .paths.map(p => { - return this.directories.map(d => resolver.join(p, d)); - }) - .reduce((array, p) => { - array.push.apply(array, p); - return array; - }, []); - forEachBail( - addrs, - (addr, callback) => { - fs.stat(addr, (err, stat) => { - if (!err && stat && stat.isDirectory()) { - const obj = { - ...request, - path: addr, - request: "./" + request.request, - module: false - }; - const message = "looking for modules in " + addr; - return resolver.doResolve( - target, - obj, - message, - resolveContext, - callback - ); - } - if (resolveContext.log) - resolveContext.log( - addr + " doesn't exist or is not a directory" - ); - if (resolveContext.missingDependencies) - resolveContext.missingDependencies.add(addr); - return callback(); - }); - }, - callback - ); - } - ); - } +exports.makePathsRelative = makeCacheableWithContext(_makePathsRelative); + +/** + * + * @param {string} context context for relative path + * @param {string} identifier identifier for path + * @returns {string} a converted relative path + */ +const _makePathsAbsolute = (context, identifier) => { + return identifier + .split(SEGMENTS_SPLIT_REGEXP) + .map(str => requestToAbsolute(context, str)) + .join(""); }; +exports.makePathsAbsolute = makeCacheableWithContext(_makePathsAbsolute); -/***/ }), +/** + * @param {string} context absolute context path + * @param {string} request any request string may containing absolute paths, query string, etc. + * @returns {string} a new request string avoiding absolute paths when possible + */ +const _contextify = (context, request) => { + return request + .split("!") + .map(r => absoluteToRequest(context, r)) + .join("!"); +}; -/***/ 88138: -/***/ (function(module) { +const contextify = makeCacheableWithContext(_contextify); +exports.contextify = contextify; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** + * @param {string} context absolute context path + * @param {string} request any request string + * @returns {string} a new request string using absolute paths when possible + */ +const _absolutify = (context, request) => { + return request + .split("!") + .map(r => requestToAbsolute(context, r)) + .join("!"); +}; +const absolutify = makeCacheableWithContext(_absolutify); +exports.absolutify = absolutify; +const PATH_QUERY_FRAGMENT_REGEXP = + /^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/; +const PATH_QUERY_REGEXP = /^((?:\0.|[^?\0])*)(\?.*)?$/; -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +/** @typedef {{ resource: string, path: string, query: string, fragment: string }} ParsedResource */ +/** @typedef {{ resource: string, path: string, query: string }} ParsedResourceWithoutFragment */ -module.exports = class ModulesInRootPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string} path path - * @param {string | ResolveStepHook} target target - */ - constructor(source, path, target) { - this.source = source; - this.path = path; - this.target = target; - } +/** + * @param {string} str the path with query and fragment + * @returns {ParsedResource} parsed parts + */ +const _parseResource = str => { + const match = PATH_QUERY_FRAGMENT_REGEXP.exec(str); + return { + resource: str, + path: match[1].replace(/\0(.)/g, "$1"), + query: match[2] ? match[2].replace(/\0(.)/g, "$1") : "", + fragment: match[3] || "" + }; +}; +exports.parseResource = makeCacheable(_parseResource); - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("ModulesInRootPlugin", (request, resolveContext, callback) => { - const obj = { - ...request, - path: this.path, - request: "./" + request.request, - module: false - }; - resolver.doResolve( - target, - obj, - "looking for modules in " + this.path, - resolveContext, - callback - ); - }); +/** + * Parse resource, skips fragment part + * @param {string} str the path with query and fragment + * @returns {ParsedResourceWithoutFragment} parsed parts + */ +const _parseResourceWithoutFragment = str => { + const match = PATH_QUERY_REGEXP.exec(str); + return { + resource: str, + path: match[1].replace(/\0(.)/g, "$1"), + query: match[2] ? match[2].replace(/\0(.)/g, "$1") : "" + }; +}; +exports.parseResourceWithoutFragment = makeCacheable( + _parseResourceWithoutFragment +); + +/** + * @param {string} filename the filename which should be undone + * @param {string} outputPath the output path that is restored (only relevant when filename contains "..") + * @param {boolean} enforceRelative true returns ./ for empty paths + * @returns {string} repeated ../ to leave the directory of the provided filename to be back on output dir + */ +exports.getUndoPath = (filename, outputPath, enforceRelative) => { + let depth = -1; + let append = ""; + outputPath = outputPath.replace(/[\\/]$/, ""); + for (const part of filename.split(/[/\\]+/)) { + if (part === "..") { + if (depth > -1) { + depth--; + } else { + const i = outputPath.lastIndexOf("/"); + const j = outputPath.lastIndexOf("\\"); + const pos = i < 0 ? j : j < 0 ? i : Math.max(i, j); + if (pos < 0) return outputPath + "/"; + append = outputPath.slice(pos + 1) + "/" + append; + outputPath = outputPath.slice(0, pos); + } + } else if (part !== ".") { + depth++; + } } + return depth > 0 + ? `${"../".repeat(depth)}${append}` + : enforceRelative + ? `./${append}` + : append; }; /***/ }), -/***/ 40777: -/***/ (function(module) { +/***/ 53023: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -135784,231 +134546,322 @@ module.exports = class ModulesInRootPlugin { -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - -module.exports = class NextPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string | ResolveStepHook} target target - */ - constructor(source, target) { - this.source = source; - this.target = target; - } +// We need to include a list of requires here +// to allow webpack to be bundled with only static requires +// We could use a dynamic require(`../${request}`) but this +// would include too many modules and not every tool is able +// to process this +module.exports = { + AsyncDependenciesBlock: () => __webpack_require__(47736), + CommentCompilationWarning: () => __webpack_require__(98427), + ContextModule: () => __webpack_require__(76729), + "cache/PackFileCacheStrategy": () => + __webpack_require__(86180), + "cache/ResolverCachePlugin": () => __webpack_require__(97347), + "container/ContainerEntryDependency": () => + __webpack_require__(64813), + "container/ContainerEntryModule": () => + __webpack_require__(80580), + "container/ContainerExposedDependency": () => + __webpack_require__(72374), + "container/FallbackDependency": () => + __webpack_require__(57764), + "container/FallbackItemDependency": () => + __webpack_require__(29593), + "container/FallbackModule": () => __webpack_require__(82886), + "container/RemoteModule": () => __webpack_require__(62916), + "container/RemoteToExternalDependency": () => + __webpack_require__(14389), + "dependencies/AMDDefineDependency": () => + __webpack_require__(96816), + "dependencies/AMDRequireArrayDependency": () => + __webpack_require__(33516), + "dependencies/AMDRequireContextDependency": () => + __webpack_require__(96123), + "dependencies/AMDRequireDependenciesBlock": () => + __webpack_require__(76932), + "dependencies/AMDRequireDependency": () => + __webpack_require__(43911), + "dependencies/AMDRequireItemDependency": () => + __webpack_require__(71806), + "dependencies/CachedConstDependency": () => + __webpack_require__(57403), + "dependencies/CreateScriptUrlDependency": () => + __webpack_require__(79062), + "dependencies/CommonJsRequireContextDependency": () => + __webpack_require__(23962), + "dependencies/CommonJsExportRequireDependency": () => + __webpack_require__(62892), + "dependencies/CommonJsExportsDependency": () => + __webpack_require__(45598), + "dependencies/CommonJsFullRequireDependency": () => + __webpack_require__(59440), + "dependencies/CommonJsRequireDependency": () => + __webpack_require__(21264), + "dependencies/CommonJsSelfReferenceDependency": () => + __webpack_require__(52225), + "dependencies/ConstDependency": () => + __webpack_require__(76911), + "dependencies/ContextDependency": () => + __webpack_require__(88101), + "dependencies/ContextElementDependency": () => + __webpack_require__(58477), + "dependencies/CriticalDependencyWarning": () => + __webpack_require__(15427), + "dependencies/CssImportDependency": () => + __webpack_require__(90542), + "dependencies/CssLocalIdentifierDependency": () => + __webpack_require__(92328), + "dependencies/CssSelfLocalIdentifierDependency": () => + __webpack_require__(29094), + "dependencies/CssExportDependency": () => + __webpack_require__(76760), + "dependencies/CssUrlDependency": () => + __webpack_require__(70749), + "dependencies/DelegatedSourceDependency": () => + __webpack_require__(22914), + "dependencies/DllEntryDependency": () => + __webpack_require__(95666), + "dependencies/EntryDependency": () => + __webpack_require__(3979), + "dependencies/ExportsInfoDependency": () => + __webpack_require__(78988), + "dependencies/HarmonyAcceptDependency": () => + __webpack_require__(23624), + "dependencies/HarmonyAcceptImportDependency": () => + __webpack_require__(99843), + "dependencies/HarmonyCompatibilityDependency": () => + __webpack_require__(72906), + "dependencies/HarmonyExportExpressionDependency": () => + __webpack_require__(51340), + "dependencies/HarmonyExportHeaderDependency": () => + __webpack_require__(38873), + "dependencies/HarmonyExportImportedSpecifierDependency": () => + __webpack_require__(67157), + "dependencies/HarmonyExportSpecifierDependency": () => + __webpack_require__(48567), + "dependencies/HarmonyImportSideEffectDependency": () => + __webpack_require__(73132), + "dependencies/HarmonyImportSpecifierDependency": () => + __webpack_require__(14077), + "dependencies/ImportContextDependency": () => + __webpack_require__(1902), + "dependencies/ImportDependency": () => + __webpack_require__(89376), + "dependencies/ImportEagerDependency": () => + __webpack_require__(50718), + "dependencies/ImportWeakDependency": () => + __webpack_require__(82483), + "dependencies/JsonExportsDependency": () => + __webpack_require__(750), + "dependencies/LocalModule": () => __webpack_require__(5826), + "dependencies/LocalModuleDependency": () => + __webpack_require__(52805), + "dependencies/ModuleDecoratorDependency": () => + __webpack_require__(88488), + "dependencies/ModuleHotAcceptDependency": () => + __webpack_require__(47511), + "dependencies/ModuleHotDeclineDependency": () => + __webpack_require__(86301), + "dependencies/ImportMetaHotAcceptDependency": () => + __webpack_require__(51274), + "dependencies/ImportMetaHotDeclineDependency": () => + __webpack_require__(53141), + "dependencies/ProvidedDependency": () => + __webpack_require__(95770), + "dependencies/PureExpressionDependency": () => + __webpack_require__(55799), + "dependencies/RequireContextDependency": () => + __webpack_require__(46917), + "dependencies/RequireEnsureDependenciesBlock": () => + __webpack_require__(27153), + "dependencies/RequireEnsureDependency": () => + __webpack_require__(27223), + "dependencies/RequireEnsureItemDependency": () => + __webpack_require__(50329), + "dependencies/RequireHeaderDependency": () => + __webpack_require__(89183), + "dependencies/RequireIncludeDependency": () => + __webpack_require__(71284), + "dependencies/RequireIncludeDependencyParserPlugin": () => + __webpack_require__(35768), + "dependencies/RequireResolveContextDependency": () => + __webpack_require__(55627), + "dependencies/RequireResolveDependency": () => + __webpack_require__(68582), + "dependencies/RequireResolveHeaderDependency": () => + __webpack_require__(9880), + "dependencies/RuntimeRequirementsDependency": () => + __webpack_require__(24187), + "dependencies/StaticExportsDependency": () => + __webpack_require__(91418), + "dependencies/SystemPlugin": () => __webpack_require__(97981), + "dependencies/UnsupportedDependency": () => + __webpack_require__(51669), + "dependencies/URLDependency": () => __webpack_require__(58612), + "dependencies/WebAssemblyExportImportedDependency": () => + __webpack_require__(52204), + "dependencies/WebAssemblyImportDependency": () => + __webpack_require__(5239), + "dependencies/WebpackIsIncludedDependency": () => + __webpack_require__(26505), + "dependencies/WorkerDependency": () => + __webpack_require__(1466), + "json/JsonData": () => __webpack_require__(90490), + "optimize/ConcatenatedModule": () => + __webpack_require__(97198), + DelegatedModule: () => __webpack_require__(28623), + DependenciesBlock: () => __webpack_require__(71040), + DllModule: () => __webpack_require__(28280), + ExternalModule: () => __webpack_require__(73071), + FileSystemInfo: () => __webpack_require__(79453), + InitFragment: () => __webpack_require__(55870), + InvalidDependenciesModuleWarning: () => + __webpack_require__(68257), + Module: () => __webpack_require__(73208), + ModuleBuildError: () => __webpack_require__(21305), + ModuleDependencyWarning: () => __webpack_require__(29656), + ModuleError: () => __webpack_require__(23744), + ModuleGraph: () => __webpack_require__(99988), + ModuleParseError: () => __webpack_require__(58443), + ModuleWarning: () => __webpack_require__(11234), + NormalModule: () => __webpack_require__(39), + RawDataUrlModule: () => __webpack_require__(19684), + RawModule: () => __webpack_require__(84929), + "sharing/ConsumeSharedModule": () => + __webpack_require__(62286), + "sharing/ConsumeSharedFallbackDependency": () => + __webpack_require__(58831), + "sharing/ProvideSharedModule": () => + __webpack_require__(50821), + "sharing/ProvideSharedDependency": () => + __webpack_require__(1798), + "sharing/ProvideForSharedDependency": () => + __webpack_require__(40017), + UnsupportedFeatureWarning: () => __webpack_require__(42495), + "util/LazySet": () => __webpack_require__(38938), + UnhandledSchemeError: () => __webpack_require__(68099), + NodeStuffInWebError: () => __webpack_require__(6325), + WebpackError: () => __webpack_require__(53799), - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("NextPlugin", (request, resolveContext, callback) => { - resolver.doResolve(target, request, null, resolveContext, callback); - }); + "util/registerExternalSerializer": () => { + // already registered } }; /***/ }), -/***/ 97849: -/***/ (function(module) { +/***/ 33032: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +const { register } = __webpack_require__(8282); -module.exports = class ParsePlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {Partial} requestOptions request options - * @param {string | ResolveStepHook} target target - */ - constructor(source, requestOptions, target) { - this.source = source; - this.requestOptions = requestOptions; - this.target = target; +class ClassSerializer { + constructor(Constructor) { + this.Constructor = Constructor; } - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("ParsePlugin", (request, resolveContext, callback) => { - const parsed = resolver.parse(/** @type {string} */ (request.request)); - const obj = { ...request, ...parsed, ...this.requestOptions }; - if (request.query && !parsed.query) { - obj.query = request.query; - } - if (request.fragment && !parsed.fragment) { - obj.fragment = request.fragment; - } - if (parsed && resolveContext.log) { - if (parsed.module) resolveContext.log("Parsed request is a module"); - if (parsed.directory) - resolveContext.log("Parsed request is a directory"); - } - // There is an edge-case where a request with # can be a path or a fragment -> try both - if (obj.request && !obj.query && obj.fragment) { - const directory = obj.fragment.endsWith("/"); - const alternative = { - ...obj, - directory, - request: - obj.request + - (obj.directory ? "/" : "") + - (directory ? obj.fragment.slice(0, -1) : obj.fragment), - fragment: "" - }; - resolver.doResolve( - target, - alternative, - null, - resolveContext, - (err, result) => { - if (err) return callback(err); - if (result) return callback(null, result); - resolver.doResolve(target, obj, null, resolveContext, callback); - } - ); - return; - } - resolver.doResolve(target, obj, null, resolveContext, callback); - }); + serialize(obj, context) { + obj.serialize(context); + } + + deserialize(context) { + if (typeof this.Constructor.deserialize === "function") { + return this.Constructor.deserialize(context); + } + const obj = new this.Constructor(); + obj.deserialize(context); + return obj; } +} + +module.exports = (Constructor, request, name = null) => { + register(Constructor, request, name, new ClassSerializer(Constructor)); }; /***/ }), -/***/ 44222: +/***/ 78676: /***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Maël Nison @arcanis */ -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +/** @template T @typedef {function(): T} FunctionReturning */ + /** - * @typedef {Object} PnpApiImpl - * @property {function(string, string, object): string} resolveToUnqualified + * @template T + * @param {FunctionReturning} fn memorized function + * @returns {FunctionReturning} new function */ +const memoize = fn => { + let cache = false; + /** @type {T} */ + let result = undefined; + return () => { + if (cache) { + return result; + } else { + result = fn(); + cache = true; + // Allow to clean up memory for fn + // and all dependent resources + fn = undefined; + return result; + } + }; +}; -module.exports = class PnpPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {PnpApiImpl} pnpApi pnpApi - * @param {string | ResolveStepHook} target target - */ - constructor(source, pnpApi, target) { - this.source = source; - this.pnpApi = pnpApi; - this.target = target; - } +module.exports = memoize; - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("PnpPlugin", (request, resolveContext, callback) => { - const req = request.request; - if (!req) return callback(); - // The trailing slash indicates to PnP that this value is a folder rather than a file - const issuer = `${request.path}/`; +/***/ }), - const packageMatch = /^(@[^/]+\/)?[^/]+/.exec(req); - if (!packageMatch) return callback(); +/***/ 55668: +/***/ (function(module) { - const packageName = packageMatch[0]; - const innerRequest = `.${req.slice(packageName.length)}`; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ - let resolution; - let apiResolution; - try { - resolution = this.pnpApi.resolveToUnqualified(packageName, issuer, { - considerBuiltins: false - }); - if (resolveContext.fileDependencies) { - apiResolution = this.pnpApi.resolveToUnqualified("pnpapi", issuer, { - considerBuiltins: false - }); - } - } catch (error) { - if ( - error.code === "MODULE_NOT_FOUND" && - error.pnpCode === "UNDECLARED_DEPENDENCY" - ) { - // This is not a PnP managed dependency. - // Try to continue resolving with our alternatives - if (resolveContext.log) { - resolveContext.log(`request is not managed by the pnpapi`); - for (const line of error.message.split("\n").filter(Boolean)) - resolveContext.log(` ${line}`); - } - return callback(); - } - return callback(error); - } - if (resolution === packageName) return callback(); - if (apiResolution && resolveContext.fileDependencies) { - resolveContext.fileDependencies.add(apiResolution); - } +const A_CODE = "a".charCodeAt(0); - const obj = { - ...request, - path: resolution, - request: innerRequest, - ignoreSymlinks: true, - fullySpecified: request.fullySpecified && innerRequest !== "." - }; - resolver.doResolve( - target, - obj, - `resolved by pnp to ${resolution}`, - resolveContext, - (err, result) => { - if (err) return callback(err); - if (result) return callback(null, result); - // Skip alternatives - return callback(null, null); - } - ); - }); - } +/** + * @param {string} hash hash + * @param {number} hashLength hash length + * @returns {string} returns hash that has at least one non numeric char + */ +module.exports = (hash, hashLength) => { + if (hashLength < 1) return ""; + const slice = hash.slice(0, hashLength); + if (slice.match(/[^\d]/)) return slice; + return `${String.fromCharCode( + A_CODE + (parseInt(hash[0], 10) % 6) + )}${slice.slice(1)}`; }; /***/ }), -/***/ 55516: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 70002: +/***/ (function(module) { "use strict"; /* @@ -136018,499 +134871,550 @@ module.exports = class PnpPlugin { -const { AsyncSeriesBailHook, AsyncSeriesHook, SyncHook } = __webpack_require__(6967); -const createInnerContext = __webpack_require__(81218); -const { parseIdentifier } = __webpack_require__(71053); -const { - normalize, - cachedJoin: join, - getType, - PathType -} = __webpack_require__(67079); +const SAFE_LIMIT = 0x80000000; +const SAFE_PART = SAFE_LIMIT - 1; +const COUNT = 4; +const arr = [0, 0, 0, 0, 0]; +const primes = [3, 7, 17, 19]; -/** @typedef {import("./ResolverFactory").ResolveOptions} ResolveOptions */ +module.exports = (str, range) => { + arr.fill(0); + for (let i = 0; i < str.length; i++) { + const c = str.charCodeAt(i); + for (let j = 0; j < COUNT; j++) { + const p = (j + COUNT - 1) % COUNT; + arr[j] = (arr[j] + c * primes[j] + arr[p]) & SAFE_PART; + } + for (let j = 0; j < COUNT; j++) { + const q = arr[j] % COUNT; + arr[j] = arr[j] ^ (arr[q] >> 1); + } + } + if (range <= SAFE_PART) { + let sum = 0; + for (let j = 0; j < COUNT; j++) { + sum = (sum + arr[j]) % range; + } + return sum; + } else { + let sum1 = 0; + let sum2 = 0; + const rangeExt = Math.floor(range / SAFE_LIMIT); + for (let j = 0; j < COUNT; j += 2) { + sum1 = (sum1 + arr[j]) & SAFE_PART; + } + for (let j = 1; j < COUNT; j += 2) { + sum2 = (sum2 + arr[j]) % rangeExt; + } + return (sum2 * SAFE_LIMIT + sum1) % range; + } +}; -/** - * @typedef {Object} FileSystemStats - * @property {function(): boolean} isDirectory - * @property {function(): boolean} isFile - */ -/** - * @typedef {Object} FileSystemDirent - * @property {Buffer | string} name - * @property {function(): boolean} isDirectory - * @property {function(): boolean} isFile - */ +/***/ }), -/** - * @typedef {Object} PossibleFileSystemError - * @property {string=} code - * @property {number=} errno - * @property {string=} path - * @property {string=} syscall - */ +/***/ 42791: +/***/ (function(module) { -/** - * @template T - * @callback FileSystemCallback - * @param {PossibleFileSystemError & Error | null | undefined} err - * @param {T=} result - */ +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/** - * @typedef {Object} FileSystem - * @property {(function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void} readFile - * @property {(function(string, FileSystemCallback<(Buffer | string)[] | FileSystemDirent[]>): void) & function(string, object, FileSystemCallback<(Buffer | string)[] | FileSystemDirent[]>): void} readdir - * @property {((function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void)=} readJson - * @property {(function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void} readlink - * @property {(function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void=} lstat - * @property {(function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void} stat - */ -/** - * @typedef {Object} SyncFileSystem - * @property {function(string, object=): Buffer | string} readFileSync - * @property {function(string, object=): (Buffer | string)[] | FileSystemDirent[]} readdirSync - * @property {(function(string, object=): object)=} readJsonSync - * @property {function(string, object=): Buffer | string} readlinkSync - * @property {function(string, object=): FileSystemStats=} lstatSync - * @property {function(string, object=): FileSystemStats} statSync - */ /** - * @typedef {Object} ParsedIdentifier - * @property {string} request - * @property {string} query - * @property {string} fragment - * @property {boolean} directory - * @property {boolean} module - * @property {boolean} file - * @property {boolean} internal + * @template T + * @template {Error} E + * @param {Iterable} items initial items + * @param {number} concurrency number of items running in parallel + * @param {function(T, function(T): void, function(E=): void): void} processor worker which pushes more items + * @param {function(E=): void} callback all items processed + * @returns {void} */ +const processAsyncTree = (items, concurrency, processor, callback) => { + const queue = Array.from(items); + if (queue.length === 0) return callback(); + let processing = 0; + let finished = false; + let processScheduled = true; -/** - * @typedef {Object} BaseResolveRequest - * @property {string | false} path - * @property {string=} descriptionFilePath - * @property {string=} descriptionFileRoot - * @property {object=} descriptionFileData - * @property {string=} relativePath - * @property {boolean=} ignoreSymlinks - * @property {boolean=} fullySpecified - */ + const push = item => { + queue.push(item); + if (!processScheduled && processing < concurrency) { + processScheduled = true; + process.nextTick(processQueue); + } + }; -/** @typedef {BaseResolveRequest & Partial} ResolveRequest */ + const processorCallback = err => { + processing--; + if (err && !finished) { + finished = true; + callback(err); + return; + } + if (!processScheduled) { + processScheduled = true; + process.nextTick(processQueue); + } + }; -/** - * String with special formatting - * @typedef {string} StackEntry - */ + const processQueue = () => { + if (finished) return; + while (processing < concurrency && queue.length > 0) { + processing++; + const item = queue.pop(); + processor(item, push, processorCallback); + } + processScheduled = false; + if (queue.length === 0 && processing === 0 && !finished) { + finished = true; + callback(); + } + }; -/** @template T @typedef {{ add: (T) => void }} WriteOnlySet */ + processQueue(); +}; -/** - * Resolve context - * @typedef {Object} ResolveContext - * @property {WriteOnlySet=} contextDependencies - * @property {WriteOnlySet=} fileDependencies files that was found on file system - * @property {WriteOnlySet=} missingDependencies dependencies that was not found on file system - * @property {Set=} stack set of hooks' calls. For instance, `resolve → parsedResolve → describedResolve`, - * @property {(function(string): void)=} log log function - * @property {(function (ResolveRequest): void)=} yield yield result, if provided plugins can return several results - */ +module.exports = processAsyncTree; -/** @typedef {AsyncSeriesBailHook<[ResolveRequest, ResolveContext], ResolveRequest | null>} ResolveStepHook */ -/** - * @param {string} str input string - * @returns {string} in camel case - */ -function toCamelCase(str) { - return str.replace(/-([a-z])/g, str => str.substr(1).toUpperCase()); -} +/***/ }), -class Resolver { - /** - * @param {ResolveStepHook} hook hook - * @param {ResolveRequest} request request - * @returns {StackEntry} stack entry - */ - static createStackEntry(hook, request) { - return ( - hook.name + - ": (" + - request.path + - ") " + - (request.request || "") + - (request.query || "") + - (request.fragment || "") + - (request.directory ? " directory" : "") + - (request.module ? " module" : "") - ); - } +/***/ 54190: +/***/ (function(module) { - /** - * @param {FileSystem} fileSystem a filesystem - * @param {ResolveOptions} options options - */ - constructor(fileSystem, options) { - this.fileSystem = fileSystem; - this.options = options; - this.hooks = { - /** @type {SyncHook<[ResolveStepHook, ResolveRequest], void>} */ - resolveStep: new SyncHook(["hook", "request"], "resolveStep"), - /** @type {SyncHook<[ResolveRequest, Error]>} */ - noResolve: new SyncHook(["request", "error"], "noResolve"), - /** @type {ResolveStepHook} */ - resolve: new AsyncSeriesBailHook( - ["request", "resolveContext"], - "resolve" - ), - /** @type {AsyncSeriesHook<[ResolveRequest, ResolveContext]>} */ - result: new AsyncSeriesHook(["result", "resolveContext"], "result") - }; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {string | ResolveStepHook} name hook name or hook itself - * @returns {ResolveStepHook} the hook - */ - ensureHook(name) { - if (typeof name !== "string") { - return name; - } - name = toCamelCase(name); - if (/^before/.test(name)) { - return /** @type {ResolveStepHook} */ (this.ensureHook( - name[6].toLowerCase() + name.substr(7) - ).withOptions({ - stage: -10 - })); - } - if (/^after/.test(name)) { - return /** @type {ResolveStepHook} */ (this.ensureHook( - name[5].toLowerCase() + name.substr(6) - ).withOptions({ - stage: 10 - })); - } - const hook = this.hooks[name]; - if (!hook) { - return (this.hooks[name] = new AsyncSeriesBailHook( - ["request", "resolveContext"], - name - )); - } - return hook; - } - /** - * @param {string | ResolveStepHook} name hook name or hook itself - * @returns {ResolveStepHook} the hook - */ - getHook(name) { - if (typeof name !== "string") { - return name; - } - name = toCamelCase(name); - if (/^before/.test(name)) { - return /** @type {ResolveStepHook} */ (this.getHook( - name[6].toLowerCase() + name.substr(7) - ).withOptions({ - stage: -10 - })); - } - if (/^after/.test(name)) { - return /** @type {ResolveStepHook} */ (this.getHook( - name[5].toLowerCase() + name.substr(6) - ).withOptions({ - stage: 10 - })); - } - const hook = this.hooks[name]; - if (!hook) { - throw new Error(`Hook ${name} doesn't exist`); - } - return hook; - } - /** - * @param {object} context context information object - * @param {string} path context path - * @param {string} request request string - * @returns {string | false} result - */ - resolveSync(context, path, request) { - /** @type {Error | null | undefined} */ - let err = undefined; - /** @type {string | false | undefined} */ - let result = undefined; - let sync = false; - this.resolve(context, path, request, {}, (e, r) => { - err = e; - result = r; - sync = true; - }); - if (!sync) { - throw new Error( - "Cannot 'resolveSync' because the fileSystem is not sync. Use 'resolve'!" - ); +const SAFE_IDENTIFIER = /^[_a-zA-Z$][_a-zA-Z$0-9]*$/; +const RESERVED_IDENTIFIER = new Set([ + "break", + "case", + "catch", + "class", + "const", + "continue", + "debugger", + "default", + "delete", + "do", + "else", + "export", + "extends", + "finally", + "for", + "function", + "if", + "import", + "in", + "instanceof", + "new", + "return", + "super", + "switch", + "this", + "throw", + "try", + "typeof", + "var", + "void", + "while", + "with", + "enum", + // strict mode + "implements", + "interface", + "let", + "package", + "private", + "protected", + "public", + "static", + "yield", + "yield", + // module code + "await", + // skip future reserved keywords defined under ES1 till ES3 + // additional + "null", + "true", + "false" +]); + +const propertyAccess = (properties, start = 0) => { + let str = ""; + for (let i = start; i < properties.length; i++) { + const p = properties[i]; + if (`${+p}` === p) { + str += `[${p}]`; + } else if (SAFE_IDENTIFIER.test(p) && !RESERVED_IDENTIFIER.has(p)) { + str += `.${p}`; + } else { + str += `[${JSON.stringify(p)}]`; } - if (err) throw err; - if (result === undefined) throw new Error("No result"); - return result; } + return str; +}; - /** - * @param {object} context context information object - * @param {string} path context path - * @param {string} request request string - * @param {ResolveContext} resolveContext resolve context - * @param {function(Error | null, (string|false)=, ResolveRequest=): void} callback callback function - * @returns {void} - */ - resolve(context, path, request, resolveContext, callback) { - if (!context || typeof context !== "object") - return callback(new Error("context argument is not an object")); - if (typeof path !== "string") - return callback(new Error("path argument is not a string")); - if (typeof request !== "string") - return callback(new Error("path argument is not a string")); - if (!resolveContext) - return callback(new Error("resolveContext argument is not set")); - - const obj = { - context: context, - path: path, - request: request - }; +module.exports = propertyAccess; - let yield_; - let yieldCalled = false; - if (typeof resolveContext.yield === "function") { - const old = resolveContext.yield; - yield_ = obj => { - yieldCalled = true; - old(obj); - }; - } - const message = `resolve '${request}' in '${path}'`; +/***/ }), - const finishResolved = result => { - return callback( - null, - result.path === false - ? false - : `${result.path.replace(/#/g, "\0#")}${ - result.query ? result.query.replace(/#/g, "\0#") : "" - }${result.fragment || ""}`, - result - ); - }; +/***/ 26611: +/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { - const finishWithoutResolve = log => { - /** - * @type {Error & {details?: string}} - */ - const error = new Error("Can't " + message); - error.details = log.join("\n"); - this.hooks.noResolve.call(obj, error); - return callback(error); - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (resolveContext.log) { - // We need log anyway to capture it in case of an error - const parentLog = resolveContext.log; - const log = []; - return this.doResolve( - this.hooks.resolve, - obj, - message, - { - log: msg => { - parentLog(msg); - log.push(msg); - }, - yield: yield_, - fileDependencies: resolveContext.fileDependencies, - contextDependencies: resolveContext.contextDependencies, - missingDependencies: resolveContext.missingDependencies, - stack: resolveContext.stack - }, - (err, result) => { - if (err) return callback(err); - if (result) return finishResolved(result); - if (yieldCalled) return callback(null); - return finishWithoutResolve(log); - } - ); - } else { - // Try to resolve assuming there is no error - // We don't log stuff in this case - return this.doResolve( - this.hooks.resolve, - obj, - message, - { - log: undefined, - yield: yield_, - fileDependencies: resolveContext.fileDependencies, - contextDependencies: resolveContext.contextDependencies, - missingDependencies: resolveContext.missingDependencies, - stack: resolveContext.stack - }, - (err, result) => { - if (err) return callback(err); +const { register } = __webpack_require__(8282); - if (result) return finishResolved(result); - if (yieldCalled) return callback(null); +const Position = /** @type {TODO} */ (__webpack_require__(31988).Position); +const SourceLocation = (__webpack_require__(31988).SourceLocation); +const ValidationError = (__webpack_require__(54983)/* ["default"] */ .Z); +const { + CachedSource, + ConcatSource, + OriginalSource, + PrefixSource, + RawSource, + ReplaceSource, + SourceMapSource +} = __webpack_require__(51255); - // log is missing for the error details - // so we redo the resolving for the log info - // this is more expensive to the success case - // is assumed by default +/** @typedef {import("acorn").Position} Position */ +/** @typedef {import("../Dependency").RealDependencyLocation} RealDependencyLocation */ +/** @typedef {import("../Dependency").SourcePosition} SourcePosition */ +/** @typedef {import("./serialization").ObjectDeserializerContext} ObjectDeserializerContext */ +/** @typedef {import("./serialization").ObjectSerializerContext} ObjectSerializerContext */ - const log = []; +/** @typedef {ObjectSerializerContext & { writeLazy?: (any) => void }} WebpackObjectSerializerContext */ - return this.doResolve( - this.hooks.resolve, - obj, - message, - { - log: msg => log.push(msg), - yield: yield_, - stack: resolveContext.stack - }, - err => { - if (err) return callback(err); +const CURRENT_MODULE = "webpack/lib/util/registerExternalSerializer"; - // In a case that there is a race condition and yield will be called - if (yieldCalled) return callback(null); +register( + CachedSource, + CURRENT_MODULE, + "webpack-sources/CachedSource", + new (class CachedSourceSerializer { + /** + * @param {CachedSource} source the cached source to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(source, { write, writeLazy }) { + if (writeLazy) { + writeLazy(source.originalLazy()); + } else { + write(source.original()); + } + write(source.getCachedData()); + } - return finishWithoutResolve(log); - } - ); - } - ); + /** + * @param {ObjectDeserializerContext} context context + * @returns {CachedSource} cached source + */ + deserialize({ read }) { + const source = read(); + const cachedData = read(); + return new CachedSource(source, cachedData); } - } + })() +); - doResolve(hook, request, message, resolveContext, callback) { - const stackEntry = Resolver.createStackEntry(hook, request); +register( + RawSource, + CURRENT_MODULE, + "webpack-sources/RawSource", + new (class RawSourceSerializer { + /** + * @param {RawSource} source the raw source to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(source, { write }) { + write(source.buffer()); + write(!source.isBuffer()); + } - let newStack; - if (resolveContext.stack) { - newStack = new Set(resolveContext.stack); - if (resolveContext.stack.has(stackEntry)) { - /** - * Prevent recursion - * @type {Error & {recursion?: boolean}} - */ - const recursionError = new Error( - "Recursion in resolving\nStack:\n " + - Array.from(newStack).join("\n ") - ); - recursionError.recursion = true; - if (resolveContext.log) - resolveContext.log("abort resolving because of recursion"); - return callback(recursionError); - } - newStack.add(stackEntry); - } else { - newStack = new Set([stackEntry]); + /** + * @param {ObjectDeserializerContext} context context + * @returns {RawSource} raw source + */ + deserialize({ read }) { + const source = read(); + const convertToString = read(); + return new RawSource(source, convertToString); } - this.hooks.resolveStep.call(hook, request); + })() +); - if (hook.isUsed()) { - const innerContext = createInnerContext( - { - log: resolveContext.log, - yield: resolveContext.yield, - fileDependencies: resolveContext.fileDependencies, - contextDependencies: resolveContext.contextDependencies, - missingDependencies: resolveContext.missingDependencies, - stack: newStack - }, - message - ); - return hook.callAsync(request, innerContext, (err, result) => { - if (err) return callback(err); - if (result) return callback(null, result); - callback(); - }); - } else { - callback(); +register( + ConcatSource, + CURRENT_MODULE, + "webpack-sources/ConcatSource", + new (class ConcatSourceSerializer { + /** + * @param {ConcatSource} source the concat source to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(source, { write }) { + write(source.getChildren()); } - } - /** - * @param {string} identifier identifier - * @returns {ParsedIdentifier} parsed identifier - */ - parse(identifier) { - const part = { - request: "", - query: "", - fragment: "", - module: false, - directory: false, - file: false, - internal: false - }; + /** + * @param {ObjectDeserializerContext} context context + * @returns {ConcatSource} concat source + */ + deserialize({ read }) { + const source = new ConcatSource(); + source.addAllSkipOptimizing(read()); + return source; + } + })() +); - const parsedIdentifier = parseIdentifier(identifier); +register( + PrefixSource, + CURRENT_MODULE, + "webpack-sources/PrefixSource", + new (class PrefixSourceSerializer { + /** + * @param {PrefixSource} source the prefix source to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(source, { write }) { + write(source.getPrefix()); + write(source.original()); + } - if (!parsedIdentifier) return part; + /** + * @param {ObjectDeserializerContext} context context + * @returns {PrefixSource} prefix source + */ + deserialize({ read }) { + return new PrefixSource(read(), read()); + } + })() +); - [part.request, part.query, part.fragment] = parsedIdentifier; +register( + ReplaceSource, + CURRENT_MODULE, + "webpack-sources/ReplaceSource", + new (class ReplaceSourceSerializer { + /** + * @param {ReplaceSource} source the replace source to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(source, { write }) { + write(source.original()); + write(source.getName()); + const replacements = source.getReplacements(); + write(replacements.length); + for (const repl of replacements) { + write(repl.start); + write(repl.end); + } + for (const repl of replacements) { + write(repl.content); + write(repl.name); + } + } - if (part.request.length > 0) { - part.internal = this.isPrivate(identifier); - part.module = this.isModule(part.request); - part.directory = this.isDirectory(part.request); - if (part.directory) { - part.request = part.request.substr(0, part.request.length - 1); + /** + * @param {ObjectDeserializerContext} context context + * @returns {ReplaceSource} replace source + */ + deserialize({ read }) { + const source = new ReplaceSource(read(), read()); + const len = read(); + const startEndBuffer = []; + for (let i = 0; i < len; i++) { + startEndBuffer.push(read(), read()); + } + let j = 0; + for (let i = 0; i < len; i++) { + source.replace( + startEndBuffer[j++], + startEndBuffer[j++], + read(), + read() + ); } + return source; } + })() +); - return part; - } +register( + OriginalSource, + CURRENT_MODULE, + "webpack-sources/OriginalSource", + new (class OriginalSourceSerializer { + /** + * @param {OriginalSource} source the original source to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(source, { write }) { + write(source.buffer()); + write(source.getName()); + } - isModule(path) { - return getType(path) === PathType.Normal; - } + /** + * @param {ObjectDeserializerContext} context context + * @returns {OriginalSource} original source + */ + deserialize({ read }) { + const buffer = read(); + const name = read(); + return new OriginalSource(buffer, name); + } + })() +); - isPrivate(path) { - return getType(path) === PathType.Internal; - } +register( + SourceLocation, + CURRENT_MODULE, + "acorn/SourceLocation", + new (class SourceLocationSerializer { + /** + * @param {SourceLocation} loc the location to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(loc, { write }) { + write(loc.start.line); + write(loc.start.column); + write(loc.end.line); + write(loc.end.column); + } - /** - * @param {string} path a path - * @returns {boolean} true, if the path is a directory path - */ - isDirectory(path) { - return path.endsWith("/"); - } + /** + * @param {ObjectDeserializerContext} context context + * @returns {RealDependencyLocation} location + */ + deserialize({ read }) { + return { + start: { + line: read(), + column: read() + }, + end: { + line: read(), + column: read() + } + }; + } + })() +); - join(path, request) { - return join(path, request); - } +register( + Position, + CURRENT_MODULE, + "acorn/Position", + new (class PositionSerializer { + /** + * @param {Position} pos the position to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(pos, { write }) { + write(pos.line); + write(pos.column); + } - normalize(path) { - return normalize(path); - } -} + /** + * @param {ObjectDeserializerContext} context context + * @returns {SourcePosition} position + */ + deserialize({ read }) { + return { + line: read(), + column: read() + }; + } + })() +); + +register( + SourceMapSource, + CURRENT_MODULE, + "webpack-sources/SourceMapSource", + new (class SourceMapSourceSerializer { + /** + * @param {SourceMapSource} source the source map source to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(source, { write }) { + write(source.getArgsAsBuffers()); + } + + /** + * @param {ObjectDeserializerContext} context context + * @returns {SourceMapSource} source source map source + */ + deserialize({ read }) { + // @ts-expect-error + return new SourceMapSource(...read()); + } + })() +); + +register( + ValidationError, + CURRENT_MODULE, + "schema-utils/ValidationError", + new (class ValidationErrorSerializer { + // TODO error should be ValidationError, but this fails the type checks + /** + * @param {TODO} error the source map source to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(error, { write }) { + write(error.errors); + write(error.schema); + write({ + name: error.headerName, + baseDataPath: error.baseDataPath, + postFormatter: error.postFormatter + }); + } -module.exports = Resolver; + /** + * @param {ObjectDeserializerContext} context context + * @returns {TODO} error + */ + deserialize({ read }) { + return new ValidationError(read(), read(), read()); + } + })() +); /***/ }), -/***/ 47716: +/***/ 17156: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; @@ -136521,859 +135425,1256 @@ module.exports = Resolver; -const versions = (__webpack_require__(77282).versions); -const Resolver = __webpack_require__(55516); -const { getType, PathType } = __webpack_require__(67079); - -const SyncAsyncFileSystemDecorator = __webpack_require__(87474); - -const AliasFieldPlugin = __webpack_require__(14819); -const AliasPlugin = __webpack_require__(63676); -const AppendPlugin = __webpack_require__(92088); -const ConditionalPlugin = __webpack_require__(6953); -const DescriptionFilePlugin = __webpack_require__(44112); -const DirectoryExistsPlugin = __webpack_require__(60895); -const ExportsFieldPlugin = __webpack_require__(83849); -const FileExistsPlugin = __webpack_require__(50295); -const ImportsFieldPlugin = __webpack_require__(7317); -const JoinRequestPartPlugin = __webpack_require__(35949); -const JoinRequestPlugin = __webpack_require__(5190); -const MainFieldPlugin = __webpack_require__(47450); -const ModulesInHierarchicalDirectoriesPlugin = __webpack_require__(79024); -const ModulesInRootPlugin = __webpack_require__(88138); -const NextPlugin = __webpack_require__(40777); -const ParsePlugin = __webpack_require__(97849); -const PnpPlugin = __webpack_require__(44222); -const RestrictionsPlugin = __webpack_require__(36400); -const ResultPlugin = __webpack_require__(13965); -const RootsPlugin = __webpack_require__(66737); -const SelfReferencePlugin = __webpack_require__(52232); -const SymlinkPlugin = __webpack_require__(58885); -const TryNextPlugin = __webpack_require__(99324); -const UnsafeCachePlugin = __webpack_require__(41606); -const UseFilePlugin = __webpack_require__(96972); +const SortableSet = __webpack_require__(13098); -/** @typedef {import("./AliasPlugin").AliasOption} AliasOptionEntry */ -/** @typedef {import("./PnpPlugin").PnpApiImpl} PnpApi */ -/** @typedef {import("./Resolver").FileSystem} FileSystem */ -/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ -/** @typedef {import("./Resolver").SyncFileSystem} SyncFileSystem */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Entrypoint").EntryOptions} EntryOptions */ -/** @typedef {string|string[]|false} AliasOptionNewRequest */ -/** @typedef {{[k: string]: AliasOptionNewRequest}} AliasOptions */ -/** @typedef {{apply: function(Resolver): void} | function(this: Resolver, Resolver): void} Plugin */ +/** @typedef {string | SortableSet | undefined} RuntimeSpec */ +/** @typedef {RuntimeSpec | boolean} RuntimeCondition */ /** - * @typedef {Object} UserResolveOptions - * @property {(AliasOptions | AliasOptionEntry[])=} alias A list of module alias configurations or an object which maps key to value - * @property {(AliasOptions | AliasOptionEntry[])=} fallback A list of module alias configurations or an object which maps key to value, applied only after modules option - * @property {(string | string[])[]=} aliasFields A list of alias fields in description files - * @property {(function(ResolveRequest): boolean)=} cachePredicate A function which decides whether a request should be cached or not. An object is passed with at least `path` and `request` properties. - * @property {boolean=} cacheWithContext Whether or not the unsafeCache should include request context as part of the cache key. - * @property {string[]=} descriptionFiles A list of description files to read from - * @property {string[]=} conditionNames A list of exports field condition names. - * @property {boolean=} enforceExtension Enforce that a extension from extensions must be used - * @property {(string | string[])[]=} exportsFields A list of exports fields in description files - * @property {(string | string[])[]=} importsFields A list of imports fields in description files - * @property {string[]=} extensions A list of extensions which should be tried for files - * @property {FileSystem} fileSystem The file system which should be used - * @property {(object | boolean)=} unsafeCache Use this cache object to unsafely cache the successful requests - * @property {boolean=} symlinks Resolve symlinks to their symlinked location - * @property {Resolver=} resolver A prepared Resolver to which the plugins are attached - * @property {string[] | string=} modules A list of directories to resolve modules from, can be absolute path or folder name - * @property {(string | string[] | {name: string | string[], forceRelative: boolean})[]=} mainFields A list of main fields in description files - * @property {string[]=} mainFiles A list of main files in directories - * @property {Plugin[]=} plugins A list of additional resolve plugins which should be applied - * @property {PnpApi | null=} pnpApi A PnP API that should be used - null is "never", undefined is "auto" - * @property {string[]=} roots A list of root paths - * @property {boolean=} fullySpecified The request is already fully specified and no extensions or directories are resolved for it - * @property {boolean=} resolveToContext Resolve to a context instead of a file - * @property {(string|RegExp)[]=} restrictions A list of resolve restrictions - * @property {boolean=} useSyncFileSystemCalls Use only the sync constraints of the file system calls - * @property {boolean=} preferRelative Prefer to resolve module requests as relative requests before falling back to modules - * @property {boolean=} preferAbsolute Prefer to resolve server-relative urls as absolute paths before falling back to resolve in roots + * @param {Compilation} compilation the compilation + * @param {string} name name of the entry + * @param {EntryOptions=} options optionally already received entry options + * @returns {RuntimeSpec} runtime */ +exports.getEntryRuntime = (compilation, name, options) => { + let dependOn; + let runtime; + if (options) { + ({ dependOn, runtime } = options); + } else { + const entry = compilation.entries.get(name); + if (!entry) return name; + ({ dependOn, runtime } = entry.options); + } + if (dependOn) { + /** @type {RuntimeSpec} */ + let result = undefined; + const queue = new Set(dependOn); + for (const name of queue) { + const dep = compilation.entries.get(name); + if (!dep) continue; + const { dependOn, runtime } = dep.options; + if (dependOn) { + for (const name of dependOn) { + queue.add(name); + } + } else { + result = mergeRuntimeOwned(result, runtime || name); + } + } + return result || name; + } else { + return runtime || name; + } +}; /** - * @typedef {Object} ResolveOptions - * @property {AliasOptionEntry[]} alias - * @property {AliasOptionEntry[]} fallback - * @property {Set} aliasFields - * @property {(function(ResolveRequest): boolean)} cachePredicate - * @property {boolean} cacheWithContext - * @property {Set} conditionNames A list of exports field condition names. - * @property {string[]} descriptionFiles - * @property {boolean} enforceExtension - * @property {Set} exportsFields - * @property {Set} importsFields - * @property {Set} extensions - * @property {FileSystem} fileSystem - * @property {object | false} unsafeCache - * @property {boolean} symlinks - * @property {Resolver=} resolver - * @property {Array} modules - * @property {{name: string[], forceRelative: boolean}[]} mainFields - * @property {Set} mainFiles - * @property {Plugin[]} plugins - * @property {PnpApi | null} pnpApi - * @property {Set} roots - * @property {boolean} fullySpecified - * @property {boolean} resolveToContext - * @property {Set} restrictions - * @property {boolean} preferRelative - * @property {boolean} preferAbsolute + * @param {RuntimeSpec} runtime runtime + * @param {function(string): void} fn functor + * @param {boolean} deterministicOrder enforce a deterministic order + * @returns {void} */ +exports.forEachRuntime = (runtime, fn, deterministicOrder = false) => { + if (runtime === undefined) { + fn(undefined); + } else if (typeof runtime === "string") { + fn(runtime); + } else { + if (deterministicOrder) runtime.sort(); + for (const r of runtime) { + fn(r); + } + } +}; + +const getRuntimesKey = set => { + set.sort(); + return Array.from(set).join("\n"); +}; /** - * @param {PnpApi | null=} option option - * @returns {PnpApi | null} processed option + * @param {RuntimeSpec} runtime runtime(s) + * @returns {string} key of runtimes */ -function processPnpApiOption(option) { - if ( - option === undefined && - /** @type {NodeJS.ProcessVersions & {pnp: string}} */ versions.pnp - ) { - // @ts-ignore - return __webpack_require__(35125); // eslint-disable-line node/no-missing-require - } - - return option || null; -} +const getRuntimeKey = runtime => { + if (runtime === undefined) return "*"; + if (typeof runtime === "string") return runtime; + return runtime.getFromUnorderedCache(getRuntimesKey); +}; +exports.getRuntimeKey = getRuntimeKey; /** - * @param {AliasOptions | AliasOptionEntry[] | undefined} alias alias - * @returns {AliasOptionEntry[]} normalized aliases + * @param {string} key key of runtimes + * @returns {RuntimeSpec} runtime(s) */ -function normalizeAlias(alias) { - return typeof alias === "object" && !Array.isArray(alias) && alias !== null - ? Object.keys(alias).map(key => { - /** @type {AliasOptionEntry} */ - const obj = { name: key, onlyModule: false, alias: alias[key] }; +const keyToRuntime = key => { + if (key === "*") return undefined; + const items = key.split("\n"); + if (items.length === 1) return items[0]; + return new SortableSet(items); +}; +exports.keyToRuntime = keyToRuntime; - if (/\$$/.test(key)) { - obj.onlyModule = true; - obj.name = key.substr(0, key.length - 1); - } +const getRuntimesString = set => { + set.sort(); + return Array.from(set).join("+"); +}; - return obj; - }) - : /** @type {Array} */ (alias) || []; -} +/** + * @param {RuntimeSpec} runtime runtime(s) + * @returns {string} readable version + */ +const runtimeToString = runtime => { + if (runtime === undefined) return "*"; + if (typeof runtime === "string") return runtime; + return runtime.getFromUnorderedCache(getRuntimesString); +}; +exports.runtimeToString = runtimeToString; /** - * @param {UserResolveOptions} options input options - * @returns {ResolveOptions} output options + * @param {RuntimeCondition} runtimeCondition runtime condition + * @returns {string} readable version */ -function createOptions(options) { - const mainFieldsSet = new Set(options.mainFields || ["main"]); - const mainFields = []; +exports.runtimeConditionToString = runtimeCondition => { + if (runtimeCondition === true) return "true"; + if (runtimeCondition === false) return "false"; + return runtimeToString(runtimeCondition); +}; - for (const item of mainFieldsSet) { - if (typeof item === "string") { - mainFields.push({ - name: [item], - forceRelative: true - }); - } else if (Array.isArray(item)) { - mainFields.push({ - name: item, - forceRelative: true - }); - } else { - mainFields.push({ - name: Array.isArray(item.name) ? item.name : [item.name], - forceRelative: item.forceRelative - }); +/** + * @param {RuntimeSpec} a first + * @param {RuntimeSpec} b second + * @returns {boolean} true, when they are equal + */ +const runtimeEqual = (a, b) => { + if (a === b) { + return true; + } else if ( + a === undefined || + b === undefined || + typeof a === "string" || + typeof b === "string" + ) { + return false; + } else if (a.size !== b.size) { + return false; + } else { + a.sort(); + b.sort(); + const aIt = a[Symbol.iterator](); + const bIt = b[Symbol.iterator](); + for (;;) { + const aV = aIt.next(); + if (aV.done) return true; + const bV = bIt.next(); + if (aV.value !== bV.value) return false; } } - - return { - alias: normalizeAlias(options.alias), - fallback: normalizeAlias(options.fallback), - aliasFields: new Set(options.aliasFields), - cachePredicate: - options.cachePredicate || - function () { - return true; - }, - cacheWithContext: - typeof options.cacheWithContext !== "undefined" - ? options.cacheWithContext - : true, - exportsFields: new Set(options.exportsFields || ["exports"]), - importsFields: new Set(options.importsFields || ["imports"]), - conditionNames: new Set(options.conditionNames), - descriptionFiles: Array.from( - new Set(options.descriptionFiles || ["package.json"]) - ), - enforceExtension: - options.enforceExtension === undefined - ? options.extensions && options.extensions.includes("") - ? true - : false - : options.enforceExtension, - extensions: new Set(options.extensions || [".js", ".json", ".node"]), - fileSystem: options.useSyncFileSystemCalls - ? new SyncAsyncFileSystemDecorator( - /** @type {SyncFileSystem} */ ( - /** @type {unknown} */ (options.fileSystem) - ) - ) - : options.fileSystem, - unsafeCache: - options.unsafeCache && typeof options.unsafeCache !== "object" - ? {} - : options.unsafeCache || false, - symlinks: typeof options.symlinks !== "undefined" ? options.symlinks : true, - resolver: options.resolver, - modules: mergeFilteredToArray( - Array.isArray(options.modules) - ? options.modules - : options.modules - ? [options.modules] - : ["node_modules"], - item => { - const type = getType(item); - return type === PathType.Normal || type === PathType.Relative; - } - ), - mainFields, - mainFiles: new Set(options.mainFiles || ["index"]), - plugins: options.plugins || [], - pnpApi: processPnpApiOption(options.pnpApi), - roots: new Set(options.roots || undefined), - fullySpecified: options.fullySpecified || false, - resolveToContext: options.resolveToContext || false, - preferRelative: options.preferRelative || false, - preferAbsolute: options.preferAbsolute || false, - restrictions: new Set(options.restrictions) - }; -} +}; +exports.runtimeEqual = runtimeEqual; /** - * @param {UserResolveOptions} options resolve options - * @returns {Resolver} created resolver + * @param {RuntimeSpec} a first + * @param {RuntimeSpec} b second + * @returns {-1|0|1} compare */ -exports.createResolver = function (options) { - const normalizedOptions = createOptions(options); - - const { - alias, - fallback, - aliasFields, - cachePredicate, - cacheWithContext, - conditionNames, - descriptionFiles, - enforceExtension, - exportsFields, - importsFields, - extensions, - fileSystem, - fullySpecified, - mainFields, - mainFiles, - modules, - plugins: userPlugins, - pnpApi, - resolveToContext, - preferRelative, - preferAbsolute, - symlinks, - unsafeCache, - resolver: customResolver, - restrictions, - roots - } = normalizedOptions; - - const plugins = userPlugins.slice(); - - const resolver = customResolver - ? customResolver - : new Resolver(fileSystem, normalizedOptions); +exports.compareRuntime = (a, b) => { + if (a === b) { + return 0; + } else if (a === undefined) { + return -1; + } else if (b === undefined) { + return 1; + } else { + const aKey = getRuntimeKey(a); + const bKey = getRuntimeKey(b); + if (aKey < bKey) return -1; + if (aKey > bKey) return 1; + return 0; + } +}; - //// pipeline //// +/** + * @param {RuntimeSpec} a first + * @param {RuntimeSpec} b second + * @returns {RuntimeSpec} merged + */ +const mergeRuntime = (a, b) => { + if (a === undefined) { + return b; + } else if (b === undefined) { + return a; + } else if (a === b) { + return a; + } else if (typeof a === "string") { + if (typeof b === "string") { + const set = new SortableSet(); + set.add(a); + set.add(b); + return set; + } else if (b.has(a)) { + return b; + } else { + const set = new SortableSet(b); + set.add(a); + return set; + } + } else { + if (typeof b === "string") { + if (a.has(b)) return a; + const set = new SortableSet(a); + set.add(b); + return set; + } else { + const set = new SortableSet(a); + for (const item of b) set.add(item); + if (set.size === a.size) return a; + return set; + } + } +}; +exports.mergeRuntime = mergeRuntime; - resolver.ensureHook("resolve"); - resolver.ensureHook("internalResolve"); - resolver.ensureHook("newInternalResolve"); - resolver.ensureHook("parsedResolve"); - resolver.ensureHook("describedResolve"); - resolver.ensureHook("internal"); - resolver.ensureHook("rawModule"); - resolver.ensureHook("module"); - resolver.ensureHook("resolveAsModule"); - resolver.ensureHook("undescribedResolveInPackage"); - resolver.ensureHook("resolveInPackage"); - resolver.ensureHook("resolveInExistingDirectory"); - resolver.ensureHook("relative"); - resolver.ensureHook("describedRelative"); - resolver.ensureHook("directory"); - resolver.ensureHook("undescribedExistingDirectory"); - resolver.ensureHook("existingDirectory"); - resolver.ensureHook("undescribedRawFile"); - resolver.ensureHook("rawFile"); - resolver.ensureHook("file"); - resolver.ensureHook("finalFile"); - resolver.ensureHook("existingFile"); - resolver.ensureHook("resolved"); +/** + * @param {RuntimeCondition} a first + * @param {RuntimeCondition} b second + * @param {RuntimeSpec} runtime full runtime + * @returns {RuntimeCondition} result + */ +exports.mergeRuntimeCondition = (a, b, runtime) => { + if (a === false) return b; + if (b === false) return a; + if (a === true || b === true) return true; + const merged = mergeRuntime(a, b); + if (merged === undefined) return undefined; + if (typeof merged === "string") { + if (typeof runtime === "string" && merged === runtime) return true; + return merged; + } + if (typeof runtime === "string" || runtime === undefined) return merged; + if (merged.size === runtime.size) return true; + return merged; +}; - // TODO remove in next major - // cspell:word Interal - // Backward-compat - resolver.hooks.newInteralResolve = resolver.hooks.newInternalResolve; +/** + * @param {RuntimeSpec | true} a first + * @param {RuntimeSpec | true} b second + * @param {RuntimeSpec} runtime full runtime + * @returns {RuntimeSpec | true} result + */ +exports.mergeRuntimeConditionNonFalse = (a, b, runtime) => { + if (a === true || b === true) return true; + const merged = mergeRuntime(a, b); + if (merged === undefined) return undefined; + if (typeof merged === "string") { + if (typeof runtime === "string" && merged === runtime) return true; + return merged; + } + if (typeof runtime === "string" || runtime === undefined) return merged; + if (merged.size === runtime.size) return true; + return merged; +}; - // resolve - for (const { source, resolveOptions } of [ - { source: "resolve", resolveOptions: { fullySpecified } }, - { source: "internal-resolve", resolveOptions: { fullySpecified: false } } - ]) { - if (unsafeCache) { - plugins.push( - new UnsafeCachePlugin( - source, - cachePredicate, - unsafeCache, - cacheWithContext, - `new-${source}` - ) - ); - plugins.push( - new ParsePlugin(`new-${source}`, resolveOptions, "parsed-resolve") - ); +/** + * @param {RuntimeSpec} a first (may be modified) + * @param {RuntimeSpec} b second + * @returns {RuntimeSpec} merged + */ +const mergeRuntimeOwned = (a, b) => { + if (b === undefined) { + return a; + } else if (a === b) { + return a; + } else if (a === undefined) { + if (typeof b === "string") { + return b; } else { - plugins.push(new ParsePlugin(source, resolveOptions, "parsed-resolve")); + return new SortableSet(b); + } + } else if (typeof a === "string") { + if (typeof b === "string") { + const set = new SortableSet(); + set.add(a); + set.add(b); + return set; + } else { + const set = new SortableSet(b); + set.add(a); + return set; + } + } else { + if (typeof b === "string") { + a.add(b); + return a; + } else { + for (const item of b) a.add(item); + return a; } } +}; +exports.mergeRuntimeOwned = mergeRuntimeOwned; - // parsed-resolve - plugins.push( - new DescriptionFilePlugin( - "parsed-resolve", - descriptionFiles, - false, - "described-resolve" - ) - ); - plugins.push(new NextPlugin("after-parsed-resolve", "described-resolve")); - - // described-resolve - plugins.push(new NextPlugin("described-resolve", "normal-resolve")); - if (fallback.length > 0) { - plugins.push( - new AliasPlugin("described-resolve", fallback, "internal-resolve") - ); - } - - // normal-resolve - if (alias.length > 0) - plugins.push(new AliasPlugin("normal-resolve", alias, "internal-resolve")); - aliasFields.forEach(item => { - plugins.push( - new AliasFieldPlugin("normal-resolve", item, "internal-resolve") - ); - }); - if (preferRelative) { - plugins.push(new JoinRequestPlugin("after-normal-resolve", "relative")); - } - plugins.push( - new ConditionalPlugin( - "after-normal-resolve", - { module: true }, - "resolve as module", - false, - "raw-module" - ) - ); - plugins.push( - new ConditionalPlugin( - "after-normal-resolve", - { internal: true }, - "resolve as internal import", - false, - "internal" - ) - ); - if (preferAbsolute) { - plugins.push(new JoinRequestPlugin("after-normal-resolve", "relative")); - } - if (roots.size > 0) { - plugins.push(new RootsPlugin("after-normal-resolve", roots, "relative")); - } - if (!preferRelative && !preferAbsolute) { - plugins.push(new JoinRequestPlugin("after-normal-resolve", "relative")); +/** + * @param {RuntimeSpec} a first + * @param {RuntimeSpec} b second + * @returns {RuntimeSpec} merged + */ +exports.intersectRuntime = (a, b) => { + if (a === undefined) { + return b; + } else if (b === undefined) { + return a; + } else if (a === b) { + return a; + } else if (typeof a === "string") { + if (typeof b === "string") { + return undefined; + } else if (b.has(a)) { + return a; + } else { + return undefined; + } + } else { + if (typeof b === "string") { + if (a.has(b)) return b; + return undefined; + } else { + const set = new SortableSet(); + for (const item of b) { + if (a.has(item)) set.add(item); + } + if (set.size === 0) return undefined; + if (set.size === 1) for (const item of set) return item; + return set; + } } +}; - // internal - importsFields.forEach(importsField => { - plugins.push( - new ImportsFieldPlugin( - "internal", - conditionNames, - importsField, - "relative", - "internal-resolve" - ) - ); - }); - - // raw-module - exportsFields.forEach(exportsField => { - plugins.push( - new SelfReferencePlugin("raw-module", exportsField, "resolve-as-module") - ); - }); - modules.forEach(item => { - if (Array.isArray(item)) { - if (item.includes("node_modules") && pnpApi) { - plugins.push( - new ModulesInHierarchicalDirectoriesPlugin( - "raw-module", - item.filter(i => i !== "node_modules"), - "module" - ) - ); - plugins.push( - new PnpPlugin("raw-module", pnpApi, "undescribed-resolve-in-package") - ); - } else { - plugins.push( - new ModulesInHierarchicalDirectoriesPlugin( - "raw-module", - item, - "module" - ) - ); +/** + * @param {RuntimeSpec} a first + * @param {RuntimeSpec} b second + * @returns {RuntimeSpec} result + */ +const subtractRuntime = (a, b) => { + if (a === undefined) { + return undefined; + } else if (b === undefined) { + return a; + } else if (a === b) { + return undefined; + } else if (typeof a === "string") { + if (typeof b === "string") { + return a; + } else if (b.has(a)) { + return undefined; + } else { + return a; + } + } else { + if (typeof b === "string") { + if (!a.has(b)) return a; + if (a.size === 2) { + for (const item of a) { + if (item !== b) return item; + } } + const set = new SortableSet(a); + set.delete(b); } else { - plugins.push(new ModulesInRootPlugin("raw-module", item, "module")); + const set = new SortableSet(); + for (const item of a) { + if (!b.has(item)) set.add(item); + } + if (set.size === 0) return undefined; + if (set.size === 1) for (const item of set) return item; + return set; } - }); - - // module - plugins.push(new JoinRequestPartPlugin("module", "resolve-as-module")); - - // resolve-as-module - if (!resolveToContext) { - plugins.push( - new ConditionalPlugin( - "resolve-as-module", - { directory: false, request: "." }, - "single file module", - true, - "undescribed-raw-file" - ) - ); } - plugins.push( - new DirectoryExistsPlugin( - "resolve-as-module", - "undescribed-resolve-in-package" - ) - ); - - // undescribed-resolve-in-package - plugins.push( - new DescriptionFilePlugin( - "undescribed-resolve-in-package", - descriptionFiles, - false, - "resolve-in-package" - ) - ); - plugins.push( - new NextPlugin("after-undescribed-resolve-in-package", "resolve-in-package") - ); +}; +exports.subtractRuntime = subtractRuntime; - // resolve-in-package - exportsFields.forEach(exportsField => { - plugins.push( - new ExportsFieldPlugin( - "resolve-in-package", - conditionNames, - exportsField, - "relative" - ) - ); - }); - plugins.push( - new NextPlugin("resolve-in-package", "resolve-in-existing-directory") - ); +/** + * @param {RuntimeCondition} a first + * @param {RuntimeCondition} b second + * @param {RuntimeSpec} runtime runtime + * @returns {RuntimeCondition} result + */ +exports.subtractRuntimeCondition = (a, b, runtime) => { + if (b === true) return false; + if (b === false) return a; + if (a === false) return false; + const result = subtractRuntime(a === true ? runtime : a, b); + return result === undefined ? false : result; +}; - // resolve-in-existing-directory - plugins.push( - new JoinRequestPlugin("resolve-in-existing-directory", "relative") - ); +/** + * @param {RuntimeSpec} runtime runtime + * @param {function(RuntimeSpec): boolean} filter filter function + * @returns {boolean | RuntimeSpec} true/false if filter is constant for all runtimes, otherwise runtimes that are active + */ +exports.filterRuntime = (runtime, filter) => { + if (runtime === undefined) return filter(undefined); + if (typeof runtime === "string") return filter(runtime); + let some = false; + let every = true; + let result = undefined; + for (const r of runtime) { + const v = filter(r); + if (v) { + some = true; + result = mergeRuntimeOwned(result, r); + } else { + every = false; + } + } + if (!some) return false; + if (every) return true; + return result; +}; - // relative - plugins.push( - new DescriptionFilePlugin( - "relative", - descriptionFiles, - true, - "described-relative" - ) - ); - plugins.push(new NextPlugin("after-relative", "described-relative")); +/** + * @template T + */ +class RuntimeSpecMap { + /** + * @param {RuntimeSpecMap=} clone copy form this + */ + constructor(clone) { + this._mode = clone ? clone._mode : 0; // 0 = empty, 1 = single entry, 2 = map + /** @type {RuntimeSpec} */ + this._singleRuntime = clone ? clone._singleRuntime : undefined; + /** @type {T} */ + this._singleValue = clone ? clone._singleValue : undefined; + /** @type {Map | undefined} */ + this._map = clone && clone._map ? new Map(clone._map) : undefined; + } - // described-relative - if (resolveToContext) { - plugins.push(new NextPlugin("described-relative", "directory")); - } else { - plugins.push( - new ConditionalPlugin( - "described-relative", - { directory: false }, - null, - true, - "raw-file" - ) - ); - plugins.push( - new ConditionalPlugin( - "described-relative", - { fullySpecified: false }, - "as directory", - true, - "directory" - ) - ); + /** + * @param {RuntimeSpec} runtime the runtimes + * @returns {T} value + */ + get(runtime) { + switch (this._mode) { + case 0: + return undefined; + case 1: + return runtimeEqual(this._singleRuntime, runtime) + ? this._singleValue + : undefined; + default: + return this._map.get(getRuntimeKey(runtime)); + } } - // directory - plugins.push( - new DirectoryExistsPlugin("directory", "undescribed-existing-directory") - ); + /** + * @param {RuntimeSpec} runtime the runtimes + * @returns {boolean} true, when the runtime is stored + */ + has(runtime) { + switch (this._mode) { + case 0: + return false; + case 1: + return runtimeEqual(this._singleRuntime, runtime); + default: + return this._map.has(getRuntimeKey(runtime)); + } + } - if (resolveToContext) { - // undescribed-existing-directory - plugins.push(new NextPlugin("undescribed-existing-directory", "resolved")); - } else { - // undescribed-existing-directory - plugins.push( - new DescriptionFilePlugin( - "undescribed-existing-directory", - descriptionFiles, - false, - "existing-directory" - ) - ); - mainFiles.forEach(item => { - plugins.push( - new UseFilePlugin( - "undescribed-existing-directory", - item, - "undescribed-raw-file" - ) - ); - }); + set(runtime, value) { + switch (this._mode) { + case 0: + this._mode = 1; + this._singleRuntime = runtime; + this._singleValue = value; + break; + case 1: + if (runtimeEqual(this._singleRuntime, runtime)) { + this._singleValue = value; + break; + } + this._mode = 2; + this._map = new Map(); + this._map.set(getRuntimeKey(this._singleRuntime), this._singleValue); + this._singleRuntime = undefined; + this._singleValue = undefined; + /* falls through */ + default: + this._map.set(getRuntimeKey(runtime), value); + } + } - // described-existing-directory - mainFields.forEach(item => { - plugins.push( - new MainFieldPlugin( - "existing-directory", - item, - "resolve-in-existing-directory" - ) - ); - }); - mainFiles.forEach(item => { - plugins.push( - new UseFilePlugin("existing-directory", item, "undescribed-raw-file") - ); - }); + provide(runtime, computer) { + switch (this._mode) { + case 0: + this._mode = 1; + this._singleRuntime = runtime; + return (this._singleValue = computer()); + case 1: { + if (runtimeEqual(this._singleRuntime, runtime)) { + return this._singleValue; + } + this._mode = 2; + this._map = new Map(); + this._map.set(getRuntimeKey(this._singleRuntime), this._singleValue); + this._singleRuntime = undefined; + this._singleValue = undefined; + const newValue = computer(); + this._map.set(getRuntimeKey(runtime), newValue); + return newValue; + } + default: { + const key = getRuntimeKey(runtime); + const value = this._map.get(key); + if (value !== undefined) return value; + const newValue = computer(); + this._map.set(key, newValue); + return newValue; + } + } + } - // undescribed-raw-file - plugins.push( - new DescriptionFilePlugin( - "undescribed-raw-file", - descriptionFiles, - true, - "raw-file" - ) - ); - plugins.push(new NextPlugin("after-undescribed-raw-file", "raw-file")); + delete(runtime) { + switch (this._mode) { + case 0: + return; + case 1: + if (runtimeEqual(this._singleRuntime, runtime)) { + this._mode = 0; + this._singleRuntime = undefined; + this._singleValue = undefined; + } + return; + default: + this._map.delete(getRuntimeKey(runtime)); + } + } - // raw-file - plugins.push( - new ConditionalPlugin( - "raw-file", - { fullySpecified: true }, - null, - false, - "file" - ) - ); - if (!enforceExtension) { - plugins.push(new TryNextPlugin("raw-file", "no extension", "file")); + update(runtime, fn) { + switch (this._mode) { + case 0: + throw new Error("runtime passed to update must exist"); + case 1: { + if (runtimeEqual(this._singleRuntime, runtime)) { + this._singleValue = fn(this._singleValue); + break; + } + const newValue = fn(undefined); + if (newValue !== undefined) { + this._mode = 2; + this._map = new Map(); + this._map.set(getRuntimeKey(this._singleRuntime), this._singleValue); + this._singleRuntime = undefined; + this._singleValue = undefined; + this._map.set(getRuntimeKey(runtime), newValue); + } + break; + } + default: { + const key = getRuntimeKey(runtime); + const oldValue = this._map.get(key); + const newValue = fn(oldValue); + if (newValue !== oldValue) this._map.set(key, newValue); + } } - extensions.forEach(item => { - plugins.push(new AppendPlugin("raw-file", item, "file")); - }); - - // file - if (alias.length > 0) - plugins.push(new AliasPlugin("file", alias, "internal-resolve")); - aliasFields.forEach(item => { - plugins.push(new AliasFieldPlugin("file", item, "internal-resolve")); - }); - plugins.push(new NextPlugin("file", "final-file")); + } - // final-file - plugins.push(new FileExistsPlugin("final-file", "existing-file")); + keys() { + switch (this._mode) { + case 0: + return []; + case 1: + return [this._singleRuntime]; + default: + return Array.from(this._map.keys(), keyToRuntime); + } + } - // existing-file - if (symlinks) - plugins.push(new SymlinkPlugin("existing-file", "existing-file")); - plugins.push(new NextPlugin("existing-file", "resolved")); + values() { + switch (this._mode) { + case 0: + return [][Symbol.iterator](); + case 1: + return [this._singleValue][Symbol.iterator](); + default: + return this._map.values(); + } } - // resolved - if (restrictions.size > 0) { - plugins.push(new RestrictionsPlugin(resolver.hooks.resolved, restrictions)); + get size() { + if (this._mode <= 1) return this._mode; + return this._map.size; } - plugins.push(new ResultPlugin(resolver.hooks.resolved)); +} - //// RESOLVER //// +exports.RuntimeSpecMap = RuntimeSpecMap; - for (const plugin of plugins) { - if (typeof plugin === "function") { - plugin.call(resolver, resolver); - } else { - plugin.apply(resolver); +class RuntimeSpecSet { + constructor(iterable) { + /** @type {Map} */ + this._map = new Map(); + if (iterable) { + for (const item of iterable) { + this.add(item); + } } } - return resolver; -}; + add(runtime) { + this._map.set(getRuntimeKey(runtime), runtime); + } -/** - * Merging filtered elements - * @param {string[]} array source array - * @param {function(string): boolean} filter predicate - * @returns {Array} merge result - */ -function mergeFilteredToArray(array, filter) { - /** @type {Array} */ - const result = []; - const set = new Set(array); + has(runtime) { + return this._map.has(getRuntimeKey(runtime)); + } - for (const item of set) { - if (filter(item)) { - const lastElement = - result.length > 0 ? result[result.length - 1] : undefined; - if (Array.isArray(lastElement)) { - lastElement.push(item); - } else { - result.push([item]); - } - } else { - result.push(item); - } + [Symbol.iterator]() { + return this._map.values(); } - return result; + get size() { + return this._map.size; + } } +exports.RuntimeSpecSet = RuntimeSpecSet; + /***/ }), -/***/ 36400: -/***/ (function(module) { +/***/ 19702: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +/** @typedef {(string|number|undefined|[])[]} SemVerRange */ -const slashCode = "/".charCodeAt(0); -const backslashCode = "\\".charCodeAt(0); +/** + * @param {string} str version string + * @returns {(string|number|undefined|[])[]} parsed version + */ +const parseVersion = str => { + var splitAndConvert = function (str) { + return str.split(".").map(function (item) { + // eslint-disable-next-line eqeqeq + return +item == item ? +item : item; + }); + }; + var match = /^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(str); + /** @type {(string|number|undefined|[])[]} */ + var ver = match[1] ? splitAndConvert(match[1]) : []; + if (match[2]) { + ver.length++; + ver.push.apply(ver, splitAndConvert(match[2])); + } + if (match[3]) { + ver.push([]); + ver.push.apply(ver, splitAndConvert(match[3])); + } + return ver; +}; +exports.parseVersion = parseVersion; -const isInside = (path, parent) => { - if (!path.startsWith(parent)) return false; - if (path.length === parent.length) return true; - const charCode = path.charCodeAt(parent.length); - return charCode === slashCode || charCode === backslashCode; +/* eslint-disable eqeqeq */ +/** + * @param {string} a version + * @param {string} b version + * @returns {boolean} true, iff a < b + */ +const versionLt = (a, b) => { + // @ts-expect-error + a = parseVersion(a); + // @ts-expect-error + b = parseVersion(b); + var i = 0; + for (;;) { + // a b EOA object undefined number string + // EOA a == b a < b b < a a < b a < b + // object b < a (0) b < a a < b a < b + // undefined a < b a < b (0) a < b a < b + // number b < a b < a b < a (1) a < b + // string b < a b < a b < a b < a (1) + // EOA end of array + // (0) continue on + // (1) compare them via "<" + + // Handles first row in table + if (i >= a.length) return i < b.length && (typeof b[i])[0] != "u"; + + var aValue = a[i]; + var aType = (typeof aValue)[0]; + + // Handles first column in table + if (i >= b.length) return aType == "u"; + + var bValue = b[i]; + var bType = (typeof bValue)[0]; + + if (aType == bType) { + if (aType != "o" && aType != "u" && aValue != bValue) { + return aValue < bValue; + } + i++; + } else { + // Handles remaining cases + if (aType == "o" && bType == "n") return true; + return bType == "s" || aType == "u"; + } + } }; +/* eslint-enable eqeqeq */ +exports.versionLt = versionLt; -module.exports = class RestrictionsPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {Set} restrictions restrictions - */ - constructor(source, restrictions) { - this.source = source; - this.restrictions = restrictions; +/** + * @param {string} str range string + * @returns {SemVerRange} parsed range + */ +exports.parseRange = str => { + const splitAndConvert = str => { + return str + .split(".") + .map(item => (item !== "NaN" && `${+item}` === item ? +item : item)); + }; + // see https://docs.npmjs.com/misc/semver#range-grammar for grammar + const parsePartial = str => { + const match = /^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(str); + /** @type {(string|number|undefined|[])[]} */ + const ver = match[1] ? [0, ...splitAndConvert(match[1])] : [0]; + if (match[2]) { + ver.length++; + ver.push.apply(ver, splitAndConvert(match[2])); + } + + // remove trailing any matchers + let last = ver[ver.length - 1]; + while ( + ver.length && + (last === undefined || /^[*xX]$/.test(/** @type {string} */ (last))) + ) { + ver.pop(); + last = ver[ver.length - 1]; + } + + return ver; + }; + const toFixed = range => { + if (range.length === 1) { + // Special case for "*" is "x.x.x" instead of "=" + return [0]; + } else if (range.length === 2) { + // Special case for "1" is "1.x.x" instead of "=1" + return [1, ...range.slice(1)]; + } else if (range.length === 3) { + // Special case for "1.2" is "1.2.x" instead of "=1.2" + return [2, ...range.slice(1)]; + } else { + return [range.length, ...range.slice(1)]; + } + }; + const negate = range => { + return [-range[0] - 1, ...range.slice(1)]; + }; + const parseSimple = str => { + // simple ::= primitive | partial | tilde | caret + // primitive ::= ( '<' | '>' | '>=' | '<=' | '=' | '!' ) ( ' ' ) * partial + // tilde ::= '~' ( ' ' ) * partial + // caret ::= '^' ( ' ' ) * partial + const match = /^(\^|~|<=|<|>=|>|=|v|!)/.exec(str); + const start = match ? match[0] : ""; + const remainder = parsePartial( + start.length ? str.slice(start.length).trim() : str.trim() + ); + switch (start) { + case "^": + if (remainder.length > 1 && remainder[1] === 0) { + if (remainder.length > 2 && remainder[2] === 0) { + return [3, ...remainder.slice(1)]; + } + return [2, ...remainder.slice(1)]; + } + return [1, ...remainder.slice(1)]; + case "~": + return [2, ...remainder.slice(1)]; + case ">=": + return remainder; + case "=": + case "v": + case "": + return toFixed(remainder); + case "<": + return negate(remainder); + case ">": { + // and( >=, not( = ) ) => >=, =, not, and + const fixed = toFixed(remainder); + // eslint-disable-next-line no-sparse-arrays + return [, fixed, 0, remainder, 2]; + } + case "<=": + // or( <, = ) => <, =, or + // eslint-disable-next-line no-sparse-arrays + return [, toFixed(remainder), negate(remainder), 1]; + case "!": { + // not = + const fixed = toFixed(remainder); + // eslint-disable-next-line no-sparse-arrays + return [, fixed, 0]; + } + default: + throw new Error("Unexpected start value"); + } + }; + const combine = (items, fn) => { + if (items.length === 1) return items[0]; + const arr = []; + for (const item of items.slice().reverse()) { + if (0 in item) { + arr.push(item); + } else { + arr.push(...item.slice(1)); + } + } + // eslint-disable-next-line no-sparse-arrays + return [, ...arr, ...items.slice(1).map(() => fn)]; + }; + const parseRange = str => { + // range ::= hyphen | simple ( ' ' ( ' ' ) * simple ) * | '' + // hyphen ::= partial ( ' ' ) * ' - ' ( ' ' ) * partial + const items = str.split(/\s+-\s+/); + if (items.length === 1) { + const items = str + .trim() + .split(/(?<=[-0-9A-Za-z])\s+/g) + .map(parseSimple); + return combine(items, 2); + } + const a = parsePartial(items[0]); + const b = parsePartial(items[1]); + // >=a <=b => and( >=a, or( >=a, { + // range-set ::= range ( logical-or range ) * + // logical-or ::= ( ' ' ) * '||' ( ' ' ) * + const items = str.split(/\s*\|\|\s*/).map(parseRange); + return combine(items, 1); + }; + return parseLogicalOr(str); +}; + +/* eslint-disable eqeqeq */ +const rangeToString = range => { + var fixCount = range[0]; + var str = ""; + if (range.length === 1) { + return "*"; + } else if (fixCount + 0.5) { + str += + fixCount == 0 + ? ">=" + : fixCount == -1 + ? "<" + : fixCount == 1 + ? "^" + : fixCount == 2 + ? "~" + : fixCount > 0 + ? "=" + : "!="; + var needDot = 1; + // eslint-disable-next-line no-redeclare + for (var i = 1; i < range.length; i++) { + var item = range[i]; + var t = (typeof item)[0]; + needDot--; + str += + t == "u" + ? // undefined: prerelease marker, add an "-" + "-" + : // number or string: add the item, set flag to add an "." between two of them + (needDot > 0 ? "." : "") + ((needDot = 2), item); + } + return str; + } else { + var stack = []; + // eslint-disable-next-line no-redeclare + for (var i = 1; i < range.length; i++) { + // eslint-disable-next-line no-redeclare + var item = range[i]; + stack.push( + item === 0 + ? "not(" + pop() + ")" + : item === 1 + ? "(" + pop() + " || " + pop() + ")" + : item === 2 + ? stack.pop() + " " + stack.pop() + : rangeToString(item) + ); + } + return pop(); + } + function pop() { + return stack.pop().replace(/^\((.+)\)$/, "$1"); } +}; +/* eslint-enable eqeqeq */ +exports.rangeToString = rangeToString; - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - resolver - .getHook(this.source) - .tapAsync("RestrictionsPlugin", (request, resolveContext, callback) => { - if (typeof request.path === "string") { - const path = request.path; - for (const rule of this.restrictions) { - if (typeof rule === "string") { - if (!isInside(path, rule)) { - if (resolveContext.log) { - resolveContext.log( - `${path} is not inside of the restriction ${rule}` - ); - } - return callback(null, null); - } - } else if (!rule.test(path)) { - if (resolveContext.log) { - resolveContext.log( - `${path} doesn't match the restriction ${rule}` - ); - } - return callback(null, null); +/* eslint-disable eqeqeq */ +/** + * @param {SemVerRange} range version range + * @param {string} version the version + * @returns {boolean} if version satisfy the range + */ +const satisfy = (range, version) => { + if (0 in range) { + // @ts-expect-error + version = parseVersion(version); + var fixCount = range[0]; + // when negated is set it swill set for < instead of >= + var negated = fixCount < 0; + if (negated) fixCount = -fixCount - 1; + for (var i = 0, j = 1, isEqual = true; ; j++, i++) { + // cspell:word nequal nequ + + // when isEqual = true: + // range version: EOA/object undefined number string + // EOA equal block big-ver big-ver + // undefined bigger next big-ver big-ver + // number smaller block cmp big-cmp + // fixed number smaller block cmp-fix differ + // string smaller block differ cmp + // fixed string smaller block small-cmp cmp-fix + + // when isEqual = false: + // range version: EOA/object undefined number string + // EOA nequal block next-ver next-ver + // undefined nequal block next-ver next-ver + // number nequal block next next + // fixed number nequal block next next (this never happens) + // string nequal block next next + // fixed string nequal block next next (this never happens) + + // EOA end of array + // equal (version is equal range): + // when !negated: return true, + // when negated: return false + // bigger (version is bigger as range): + // when fixed: return false, + // when !negated: return true, + // when negated: return false, + // smaller (version is smaller as range): + // when !negated: return false, + // when negated: return true + // nequal (version is not equal range (> resp <)): return true + // block (version is in different prerelease area): return false + // differ (version is different from fixed range (string vs. number)): return false + // next: continues to the next items + // next-ver: when fixed: return false, continues to the next item only for the version, sets isEqual=false + // big-ver: when fixed || negated: return false, continues to the next item only for the version, sets isEqual=false + // next-nequ: continues to the next items, sets isEqual=false + // cmp (negated === false): version < range => return false, version > range => next-nequ, else => next + // cmp (negated === true): version > range => return false, version < range => next-nequ, else => next + // cmp-fix: version == range => next, else => return false + // big-cmp: when negated => return false, else => next-nequ + // small-cmp: when negated => next-nequ, else => return false + + var rangeType = j < range.length ? (typeof range[j])[0] : ""; + + var versionValue; + var versionType; + + // Handles first column in both tables (end of version or object) + if ( + i >= version.length || + ((versionValue = version[i]), + (versionType = (typeof versionValue)[0]) == "o") + ) { + // Handles nequal + if (!isEqual) return true; + // Handles bigger + if (rangeType == "u") return j > fixCount && !negated; + // Handles equal and smaller: (range === EOA) XOR negated + return (rangeType == "") != negated; // equal + smaller + } + + // Handles second column in both tables (version = undefined) + if (versionType == "u") { + if (!isEqual || rangeType != "u") { + return false; + } + } + + // switch between first and second table + else if (isEqual) { + // Handle diagonal + if (rangeType == versionType) { + if (j <= fixCount) { + // Handles "cmp-fix" cases + if (versionValue != range[j]) { + return false; + } + } else { + // Handles "cmp" cases + if (negated ? versionValue > range[j] : versionValue < range[j]) { + return false; } + if (versionValue != range[j]) isEqual = false; } } - callback(); - }); - } -}; - - -/***/ }), - -/***/ 13965: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - + // Handle big-ver + else if (rangeType != "s" && rangeType != "n") { + if (negated || j <= fixCount) return false; + isEqual = false; + j--; + } -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + // Handle differ, big-cmp and small-cmp + else if (j <= fixCount || versionType < rangeType != negated) { + return false; + } else { + isEqual = false; + } + } else { + // Handles all "next-ver" cases in the second table + if (rangeType != "s" && rangeType != "n") { + isEqual = false; + j--; + } -module.exports = class ResultPlugin { - /** - * @param {ResolveStepHook} source source - */ - constructor(source) { - this.source = source; + // next is applied by default + } + } + } + /** @type {(boolean | number)[]} */ + var stack = []; + var p = stack.pop.bind(stack); + // eslint-disable-next-line no-redeclare + for (var i = 1; i < range.length; i++) { + var item = /** @type {SemVerRange | 0 | 1 | 2} */ (range[i]); + stack.push( + item == 1 + ? p() | p() + : item == 2 + ? p() & p() + : item + ? satisfy(item, version) + : !p() + ); } + return !!p(); +}; +/* eslint-enable eqeqeq */ +exports.satisfy = satisfy; - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - this.source.tapAsync( - "ResultPlugin", - (request, resolverContext, callback) => { - const obj = { ...request }; - if (resolverContext.log) - resolverContext.log("reporting result " + obj.path); - resolver.hooks.result.callAsync(obj, resolverContext, err => { - if (err) return callback(err); - if (typeof resolverContext.yield === "function") { - resolverContext.yield(obj); - callback(null, null); - } else { - callback(null, obj); - } - }); +exports.stringifyHoley = json => { + switch (typeof json) { + case "undefined": + return ""; + case "object": + if (Array.isArray(json)) { + let str = "["; + for (let i = 0; i < json.length; i++) { + if (i !== 0) str += ","; + str += this.stringifyHoley(json[i]); + } + str += "]"; + return str; + } else { + return JSON.stringify(json); } - ); + default: + return JSON.stringify(json); } }; +//#region runtime code: parseVersion +exports.parseVersionRuntimeCode = runtimeTemplate => + `var parseVersion = ${runtimeTemplate.basicFunction("str", [ + "// see webpack/lib/util/semver.js for original code", + `var p=${ + runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)" + }{return p.split(".").map((${ + runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)" + }{return+p==p?+p:p}))},n=/^([^-+]+)?(?:-([^+]+))?(?:\\+(.+))?$/.exec(str),r=n[1]?p(n[1]):[];return n[2]&&(r.length++,r.push.apply(r,p(n[2]))),n[3]&&(r.push([]),r.push.apply(r,p(n[3]))),r;` + ])}`; +//#endregion + +//#region runtime code: versionLt +exports.versionLtRuntimeCode = runtimeTemplate => + `var versionLt = ${runtimeTemplate.basicFunction("a, b", [ + "// see webpack/lib/util/semver.js for original code", + 'a=parseVersion(a),b=parseVersion(b);for(var r=0;;){if(r>=a.length)return r=b.length)return"u"==n;var t=b[r],f=(typeof t)[0];if(n!=f)return"o"==n&&"n"==f||("s"==f||"u"==n);if("o"!=n&&"u"!=n&&e!=t)return e + `var rangeToString = ${runtimeTemplate.basicFunction("range", [ + "// see webpack/lib/util/semver.js for original code", + 'var r=range[0],n="";if(1===range.length)return"*";if(r+.5){n+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var e=1,a=1;a0?".":"")+(e=2,t)}return n}var g=[];for(a=1;a + `var satisfy = ${runtimeTemplate.basicFunction("range, version", [ + "// see webpack/lib/util/semver.js for original code", + 'if(0 in range){version=parseVersion(version);var e=range[0],r=e<0;r&&(e=-e-1);for(var n=0,i=1,a=!0;;i++,n++){var f,s,g=i=version.length||"o"==(s=(typeof(f=version[n]))[0]))return!a||("u"==g?i>e&&!r:""==g!=r);if("u"==s){if(!a||"u"!=g)return!1}else if(a)if(g==s)if(i<=e){if(f!=range[i])return!1}else{if(r?f>range[i]:f} roots roots - * @param {string | ResolveStepHook} target target hook - */ - constructor(source, roots, target) { - this.roots = Array.from(roots); - this.source = source; - this.target = target; - } +const getBinaryMiddleware = memoize(() => + __webpack_require__(97059) +); +const getObjectMiddleware = memoize(() => + __webpack_require__(34795) +); +const getSingleItemMiddleware = memoize(() => + __webpack_require__(65112) +); +const getSerializer = memoize(() => __webpack_require__(53080)); +const getSerializerMiddleware = memoize(() => + __webpack_require__(83137) +); - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); +const getBinaryMiddlewareInstance = memoize( + () => new (getBinaryMiddleware())() +); - resolver - .getHook(this.source) - .tapAsync("RootsPlugin", (request, resolveContext, callback) => { - const req = request.request; - if (!req) return callback(); - if (!req.startsWith("/")) return callback(); +const registerSerializers = memoize(() => { + __webpack_require__(26611); - forEachBail( - this.roots, - (root, callback) => { - const path = resolver.join(root, req.slice(1)); - const obj = { - ...request, - path, - relativePath: request.relativePath && path - }; - resolver.doResolve( - target, - obj, - `root path ${root}`, - resolveContext, - callback + // Load internal paths with a relative require + // This allows bundling all internal serializers + const internalSerializables = __webpack_require__(53023); + getObjectMiddleware().registerLoader(/^webpack\/lib\//, req => { + const loader = internalSerializables[req.slice("webpack/lib/".length)]; + if (loader) { + loader(); + } else { + console.warn(`${req} not found in internalSerializables`); + } + return true; + }); +}); + +/** @type {Serializer} */ +let buffersSerializer; + +// Expose serialization API +module.exports = { + get register() { + return getObjectMiddleware().register; + }, + get registerLoader() { + return getObjectMiddleware().registerLoader; + }, + get registerNotSerializable() { + return getObjectMiddleware().registerNotSerializable; + }, + get NOT_SERIALIZABLE() { + return getObjectMiddleware().NOT_SERIALIZABLE; + }, + /** @type {MEASURE_START_OPERATION} */ + get MEASURE_START_OPERATION() { + return getBinaryMiddleware().MEASURE_START_OPERATION; + }, + /** @type {MEASURE_END_OPERATION} */ + get MEASURE_END_OPERATION() { + return getBinaryMiddleware().MEASURE_END_OPERATION; + }, + get buffersSerializer() { + if (buffersSerializer !== undefined) return buffersSerializer; + registerSerializers(); + const Serializer = getSerializer(); + const binaryMiddleware = getBinaryMiddlewareInstance(); + const SerializerMiddleware = getSerializerMiddleware(); + const SingleItemMiddleware = getSingleItemMiddleware(); + return (buffersSerializer = new Serializer([ + new SingleItemMiddleware(), + new (getObjectMiddleware())(context => { + if (context.write) { + context.writeLazy = value => { + context.write( + SerializerMiddleware.createLazy(value, binaryMiddleware) ); - }, - callback - ); - }); + }; + } + }, "md4"), + binaryMiddleware + ])); + }, + createFileSerializer: (fs, hashFunction) => { + registerSerializers(); + const Serializer = getSerializer(); + const FileMiddleware = __webpack_require__(65321); + const fileMiddleware = new FileMiddleware(fs, hashFunction); + const binaryMiddleware = getBinaryMiddlewareInstance(); + const SerializerMiddleware = getSerializerMiddleware(); + const SingleItemMiddleware = getSingleItemMiddleware(); + return new Serializer([ + new SingleItemMiddleware(), + new (getObjectMiddleware())(context => { + if (context.write) { + context.writeLazy = value => { + context.write( + SerializerMiddleware.createLazy(value, binaryMiddleware) + ); + }; + context.writeSeparate = (value, options) => { + const lazy = SerializerMiddleware.createLazy( + value, + fileMiddleware, + options + ); + context.write(lazy); + return lazy; + }; + } + }, hashFunction), + binaryMiddleware, + fileMiddleware + ]); } -} - -module.exports = RootsPlugin; +}; /***/ }), -/***/ 52232: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 15652: +/***/ (function(module) { "use strict"; /* @@ -137383,181 +136684,211 @@ module.exports = RootsPlugin; -const DescriptionFileUtils = __webpack_require__(25424); +/** + * @typedef {Object} GroupOptions + * @property {boolean=} groupChildren + * @property {boolean=} force + * @property {number=} targetGroupCount + */ -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +/** + * @template T + * @template R + * @typedef {Object} GroupConfig + * @property {function(T): string[]} getKeys + * @property {function(string, (R | T)[], T[]): R} createGroup + * @property {function(string, T[]): GroupOptions=} getOptions + */ -const slashCode = "/".charCodeAt(0); +/** + * @template T + * @template R + * @typedef {Object} ItemWithGroups + * @property {T} item + * @property {Set>} groups + */ -module.exports = class SelfReferencePlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string | string[]} fieldNamePath name path - * @param {string | ResolveStepHook} target target - */ - constructor(source, fieldNamePath, target) { - this.source = source; - this.target = target; - this.fieldName = fieldNamePath; - } +/** + * @template T + * @template R + * @typedef {{ config: GroupConfig, name: string, alreadyGrouped: boolean, items: Set> | undefined }} Group + */ +/** + * @template T + * @template R + * @param {T[]} items the list of items + * @param {GroupConfig[]} groupConfigs configuration + * @returns {(R | T)[]} grouped items + */ +const smartGrouping = (items, groupConfigs) => { + /** @type {Set>} */ + const itemsWithGroups = new Set(); + /** @type {Map>} */ + const allGroups = new Map(); + for (const item of items) { + /** @type {Set>} */ + const groups = new Set(); + for (let i = 0; i < groupConfigs.length; i++) { + const groupConfig = groupConfigs[i]; + const keys = groupConfig.getKeys(item); + if (keys) { + for (const name of keys) { + const key = `${i}:${name}`; + let group = allGroups.get(key); + if (group === undefined) { + allGroups.set( + key, + (group = { + config: groupConfig, + name, + alreadyGrouped: false, + items: undefined + }) + ); + } + groups.add(group); + } + } + } + itemsWithGroups.add({ + item, + groups + }); + } /** - * @param {Resolver} resolver the resolver - * @returns {void} + * @param {Set>} itemsWithGroups input items with groups + * @returns {(T | R)[]} groups items */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("SelfReferencePlugin", (request, resolveContext, callback) => { - if (!request.descriptionFilePath) return callback(); - - const req = request.request; - if (!req) return callback(); - - // Feature is only enabled when an exports field is present - const exportsField = DescriptionFileUtils.getField( - request.descriptionFileData, - this.fieldName - ); - if (!exportsField) return callback(); - - const name = DescriptionFileUtils.getField( - request.descriptionFileData, - "name" - ); - if (typeof name !== "string") return callback(); + const runGrouping = itemsWithGroups => { + const totalSize = itemsWithGroups.size; + for (const entry of itemsWithGroups) { + for (const group of entry.groups) { + if (group.alreadyGrouped) continue; + const items = group.items; + if (items === undefined) { + group.items = new Set([entry]); + } else { + items.add(entry); + } + } + } + /** @type {Map, { items: Set>, options: GroupOptions | false | undefined, used: boolean }>} */ + const groupMap = new Map(); + for (const group of allGroups.values()) { + if (group.items) { + const items = group.items; + group.items = undefined; + groupMap.set(group, { + items, + options: undefined, + used: false + }); + } + } + /** @type {(T | R)[]} */ + const results = []; + for (;;) { + /** @type {Group} */ + let bestGroup = undefined; + let bestGroupSize = -1; + let bestGroupItems = undefined; + let bestGroupOptions = undefined; + for (const [group, state] of groupMap) { + const { items, used } = state; + let options = state.options; + if (options === undefined) { + const groupConfig = group.config; + state.options = options = + (groupConfig.getOptions && + groupConfig.getOptions( + group.name, + Array.from(items, ({ item }) => item) + )) || + false; + } + const force = options && options.force; + if (!force) { + if (bestGroupOptions && bestGroupOptions.force) continue; + if (used) continue; + if (items.size <= 1 || totalSize - items.size <= 1) { + continue; + } + } + const targetGroupCount = (options && options.targetGroupCount) || 4; + let sizeValue = force + ? items.size + : Math.min( + items.size, + (totalSize * 2) / targetGroupCount + + itemsWithGroups.size - + items.size + ); if ( - req.startsWith(name) && - (req.length === name.length || - req.charCodeAt(name.length) === slashCode) + sizeValue > bestGroupSize || + (force && (!bestGroupOptions || !bestGroupOptions.force)) ) { - const remainingRequest = `.${req.slice(name.length)}`; - - const obj = { - ...request, - request: remainingRequest, - path: /** @type {string} */ (request.descriptionFileRoot), - relativePath: "." - }; - - resolver.doResolve( - target, - obj, - "self reference", - resolveContext, - callback - ); - } else { - return callback(); + bestGroup = group; + bestGroupSize = sizeValue; + bestGroupItems = items; + bestGroupOptions = options; } - }); - } -}; - - -/***/ }), - -/***/ 58885: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - + } + if (bestGroup === undefined) { + break; + } + const items = new Set(bestGroupItems); + const options = bestGroupOptions; + const groupChildren = !options || options.groupChildren !== false; -const forEachBail = __webpack_require__(78565); -const getPaths = __webpack_require__(82918); -const { getType, PathType } = __webpack_require__(67079); + for (const item of items) { + itemsWithGroups.delete(item); + // Remove all groups that items have from the map to not select them again + for (const group of item.groups) { + const state = groupMap.get(group); + if (state !== undefined) { + state.items.delete(item); + if (state.items.size === 0) { + groupMap.delete(group); + } else { + state.options = undefined; + if (groupChildren) { + state.used = true; + } + } + } + } + } + groupMap.delete(bestGroup); -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + const key = bestGroup.name; + const groupConfig = bestGroup.config; -module.exports = class SymlinkPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string | ResolveStepHook} target target - */ - constructor(source, target) { - this.source = source; - this.target = target; - } + const allItems = Array.from(items, ({ item }) => item); - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - const fs = resolver.fileSystem; - resolver - .getHook(this.source) - .tapAsync("SymlinkPlugin", (request, resolveContext, callback) => { - if (request.ignoreSymlinks) return callback(); - const pathsResult = getPaths(request.path); - const pathSegments = pathsResult.segments; - const paths = pathsResult.paths; + bestGroup.alreadyGrouped = true; + const children = groupChildren ? runGrouping(items) : allItems; + bestGroup.alreadyGrouped = false; - let containsSymlink = false; - let idx = -1; - forEachBail( - paths, - (path, callback) => { - idx++; - if (resolveContext.fileDependencies) - resolveContext.fileDependencies.add(path); - fs.readlink(path, (err, result) => { - if (!err && result) { - pathSegments[idx] = result; - containsSymlink = true; - // Shortcut when absolute symlink found - const resultType = getType(result.toString()); - if ( - resultType === PathType.AbsoluteWin || - resultType === PathType.AbsolutePosix - ) { - return callback(null, idx); - } - } - callback(); - }); - }, - (err, idx) => { - if (!containsSymlink) return callback(); - const resultSegments = - typeof idx === "number" - ? pathSegments.slice(0, idx + 1) - : pathSegments.slice(); - const result = resultSegments.reduceRight((a, b) => { - return resolver.join(a, b); - }); - const obj = { - ...request, - path: result - }; - resolver.doResolve( - target, - obj, - "resolved symlink to " + result, - resolveContext, - callback - ); - } - ); - }); - } + results.push(groupConfig.createGroup(key, children, allItems)); + } + for (const { item } of itemsWithGroups) { + results.push(item); + } + return results; + }; + return runGrouping(itemsWithGroups); }; +module.exports = smartGrouping; + /***/ }), -/***/ 87474: -/***/ (function(module) { +/***/ 41245: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* @@ -137567,100 +136898,66 @@ module.exports = class SymlinkPlugin { -/** @typedef {import("./Resolver").FileSystem} FileSystem */ -/** @typedef {import("./Resolver").SyncFileSystem} SyncFileSystem */ +/** @typedef {import("webpack-sources").Source} Source */ + +/** @type {WeakMap>} */ +const equalityCache = new WeakMap(); /** - * @param {SyncFileSystem} fs file system implementation - * @constructor + * @param {Source} a a source + * @param {Source} b another source + * @returns {boolean} true, when both sources are equal */ -function SyncAsyncFileSystemDecorator(fs) { - this.fs = fs; +const _isSourceEqual = (a, b) => { + // prefer .buffer(), it's called anyway during emit + /** @type {Buffer|string} */ + let aSource = typeof a.buffer === "function" ? a.buffer() : a.source(); + /** @type {Buffer|string} */ + let bSource = typeof b.buffer === "function" ? b.buffer() : b.source(); + if (aSource === bSource) return true; + if (typeof aSource === "string" && typeof bSource === "string") return false; + if (!Buffer.isBuffer(aSource)) aSource = Buffer.from(aSource, "utf-8"); + if (!Buffer.isBuffer(bSource)) bSource = Buffer.from(bSource, "utf-8"); + return aSource.equals(bSource); +}; - this.lstat = undefined; - this.lstatSync = undefined; - const lstatSync = fs.lstatSync; - if (lstatSync) { - this.lstat = (arg, options, callback) => { - let result; - try { - result = lstatSync.call(fs, arg); - } catch (e) { - return (callback || options)(e); - } - (callback || options)(null, result); - }; - this.lstatSync = (arg, options) => lstatSync.call(fs, arg, options); +/** + * @param {Source} a a source + * @param {Source} b another source + * @returns {boolean} true, when both sources are equal + */ +const isSourceEqual = (a, b) => { + if (a === b) return true; + const cache1 = equalityCache.get(a); + if (cache1 !== undefined) { + const result = cache1.get(b); + if (result !== undefined) return result; } - - this.stat = (arg, options, callback) => { - let result; - try { - result = callback ? fs.statSync(arg, options) : fs.statSync(arg); - } catch (e) { - return (callback || options)(e); - } - (callback || options)(null, result); - }; - this.statSync = (arg, options) => fs.statSync(arg, options); - - this.readdir = (arg, options, callback) => { - let result; - try { - result = fs.readdirSync(arg); - } catch (e) { - return (callback || options)(e); - } - (callback || options)(null, result); - }; - this.readdirSync = (arg, options) => fs.readdirSync(arg, options); - - this.readFile = (arg, options, callback) => { - let result; - try { - result = fs.readFileSync(arg); - } catch (e) { - return (callback || options)(e); - } - (callback || options)(null, result); - }; - this.readFileSync = (arg, options) => fs.readFileSync(arg, options); - - this.readlink = (arg, options, callback) => { - let result; - try { - result = fs.readlinkSync(arg); - } catch (e) { - return (callback || options)(e); - } - (callback || options)(null, result); - }; - this.readlinkSync = (arg, options) => fs.readlinkSync(arg, options); - - this.readJson = undefined; - this.readJsonSync = undefined; - const readJsonSync = fs.readJsonSync; - if (readJsonSync) { - this.readJson = (arg, options, callback) => { - let result; - try { - result = readJsonSync.call(fs, arg); - } catch (e) { - return (callback || options)(e); - } - (callback || options)(null, result); - }; - - this.readJsonSync = (arg, options) => readJsonSync.call(fs, arg, options); + const result = _isSourceEqual(a, b); + if (cache1 !== undefined) { + cache1.set(b, result); + } else { + const map = new WeakMap(); + map.set(b, result); + equalityCache.set(a, map); } -} -module.exports = SyncAsyncFileSystemDecorator; + const cache2 = equalityCache.get(b); + if (cache2 !== undefined) { + cache2.set(a, result); + } else { + const map = new WeakMap(); + map.set(a, result); + equalityCache.set(b, map); + } + return result; +}; +exports.isSourceEqual = isSourceEqual; /***/ }), -/***/ 99324: -/***/ (function(module) { +/***/ 12047: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -137670,121 +136967,180 @@ module.exports = SyncAsyncFileSystemDecorator; -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - -module.exports = class TryNextPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string} message message - * @param {string | ResolveStepHook} target target - */ - constructor(source, message, target) { - this.source = source; - this.message = message; - this.target = target; - } +const { validate } = __webpack_require__(38476); - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("TryNextPlugin", (request, resolveContext, callback) => { - resolver.doResolve( - target, - request, - this.message, - resolveContext, - callback - ); - }); - } +/* cSpell:disable */ +const DID_YOU_MEAN = { + rules: "module.rules", + loaders: "module.rules or module.rules.*.use", + query: "module.rules.*.options (BREAKING CHANGE since webpack 5)", + noParse: "module.noParse", + filename: "output.filename or module.rules.*.generator.filename", + file: "output.filename", + chunkFilename: "output.chunkFilename", + chunkfilename: "output.chunkFilename", + ecmaVersion: + "output.environment (output.ecmaVersion was a temporary configuration option during webpack 5 beta)", + ecmaversion: + "output.environment (output.ecmaVersion was a temporary configuration option during webpack 5 beta)", + ecma: "output.environment (output.ecmaVersion was a temporary configuration option during webpack 5 beta)", + path: "output.path", + pathinfo: "output.pathinfo", + pathInfo: "output.pathinfo", + jsonpFunction: "output.chunkLoadingGlobal (BREAKING CHANGE since webpack 5)", + chunkCallbackName: + "output.chunkLoadingGlobal (BREAKING CHANGE since webpack 5)", + jsonpScriptType: "output.scriptType (BREAKING CHANGE since webpack 5)", + hotUpdateFunction: "output.hotUpdateGlobal (BREAKING CHANGE since webpack 5)", + splitChunks: "optimization.splitChunks", + immutablePaths: "snapshot.immutablePaths", + managedPaths: "snapshot.managedPaths", + maxModules: "stats.modulesSpace (BREAKING CHANGE since webpack 5)", + hashedModuleIds: + 'optimization.moduleIds: "hashed" (BREAKING CHANGE since webpack 5)', + namedChunks: + 'optimization.chunkIds: "named" (BREAKING CHANGE since webpack 5)', + namedModules: + 'optimization.moduleIds: "named" (BREAKING CHANGE since webpack 5)', + occurrenceOrder: + 'optimization.chunkIds: "size" and optimization.moduleIds: "size" (BREAKING CHANGE since webpack 5)', + automaticNamePrefix: + "optimization.splitChunks.[cacheGroups.*].idHint (BREAKING CHANGE since webpack 5)", + noEmitOnErrors: + "optimization.emitOnErrors (BREAKING CHANGE since webpack 5: logic is inverted to avoid negative flags)", + Buffer: + "to use the ProvidePlugin to process the Buffer variable to modules as polyfill\n" + + "BREAKING CHANGE: webpack 5 no longer provided Node.js polyfills by default.\n" + + "Note: if you are using 'node.Buffer: false', you can just remove that as this is the default behavior now.\n" + + "To provide a polyfill to modules use:\n" + + 'new ProvidePlugin({ Buffer: ["buffer", "Buffer"] }) and npm install buffer.', + process: + "to use the ProvidePlugin to process the process variable to modules as polyfill\n" + + "BREAKING CHANGE: webpack 5 no longer provided Node.js polyfills by default.\n" + + "Note: if you are using 'node.process: false', you can just remove that as this is the default behavior now.\n" + + "To provide a polyfill to modules use:\n" + + 'new ProvidePlugin({ process: "process" }) and npm install buffer.' }; +const REMOVED = { + concord: + "BREAKING CHANGE: resolve.concord has been removed and is no longer available.", + devtoolLineToLine: + "BREAKING CHANGE: output.devtoolLineToLine has been removed and is no longer available." +}; +/* cSpell:enable */ -/***/ }), - -/***/ 41606: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - +/** + * @param {Parameters[0]} schema a json schema + * @param {Parameters[1]} options the options that should be validated + * @param {Parameters[2]=} validationConfiguration configuration for generating errors + * @returns {void} + */ +const validateSchema = (schema, options, validationConfiguration) => { + validate( + schema, + options, + validationConfiguration || { + name: "Webpack", + postFormatter: (formattedError, error) => { + const children = error.children; + if ( + children && + children.some( + child => + child.keyword === "absolutePath" && + child.dataPath === ".output.filename" + ) + ) { + return `${formattedError}\nPlease use output.path to specify absolute path and output.filename for the file name.`; + } + if ( + children && + children.some( + child => + child.keyword === "pattern" && child.dataPath === ".devtool" + ) + ) { + return ( + `${formattedError}\n` + + "BREAKING CHANGE since webpack 5: The devtool option is more strict.\n" + + "Please strictly follow the order of the keywords in the pattern." + ); + } -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -/** @typedef {{[k: string]: any}} Cache */ + if (error.keyword === "additionalProperties") { + const params = + /** @type {import("ajv").AdditionalPropertiesParams} */ ( + error.params + ); + if ( + Object.prototype.hasOwnProperty.call( + DID_YOU_MEAN, + params.additionalProperty + ) + ) { + return `${formattedError}\nDid you mean ${ + DID_YOU_MEAN[params.additionalProperty] + }?`; + } -function getCacheId(request, withContext) { - return JSON.stringify({ - context: withContext ? request.context : "", - path: request.path, - query: request.query, - fragment: request.fragment, - request: request.request - }); -} + if ( + Object.prototype.hasOwnProperty.call( + REMOVED, + params.additionalProperty + ) + ) { + return `${formattedError}\n${REMOVED[params.additionalProperty]}?`; + } -module.exports = class UnsafeCachePlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {function(ResolveRequest): boolean} filterPredicate filterPredicate - * @param {Cache} cache cache - * @param {boolean} withContext withContext - * @param {string | ResolveStepHook} target target - */ - constructor(source, filterPredicate, cache, withContext, target) { - this.source = source; - this.filterPredicate = filterPredicate; - this.withContext = withContext; - this.cache = cache; - this.target = target; - } + if (!error.dataPath) { + if (params.additionalProperty === "debug") { + return ( + `${formattedError}\n` + + "The 'debug' property was removed in webpack 2.0.0.\n" + + "Loaders should be updated to allow passing this option via loader options in module.rules.\n" + + "Until loaders are updated one can use the LoaderOptionsPlugin to switch loaders into debug mode:\n" + + "plugins: [\n" + + " new webpack.LoaderOptionsPlugin({\n" + + " debug: true\n" + + " })\n" + + "]" + ); + } - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("UnsafeCachePlugin", (request, resolveContext, callback) => { - if (!this.filterPredicate(request)) return callback(); - const cacheId = getCacheId(request, this.withContext); - const cacheEntry = this.cache[cacheId]; - if (cacheEntry) { - return callback(null, cacheEntry); - } - resolver.doResolve( - target, - request, - null, - resolveContext, - (err, result) => { - if (err) return callback(err); - if (result) return callback(null, (this.cache[cacheId] = result)); - callback(); + if (params.additionalProperty) { + return ( + `${formattedError}\n` + + "For typos: please correct them.\n" + + "For loader options: webpack >= v2.0.0 no longer allows custom properties in configuration.\n" + + " Loaders should be updated to allow passing options via loader options in module.rules.\n" + + " Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:\n" + + " plugins: [\n" + + " new webpack.LoaderOptionsPlugin({\n" + + " // test: /\\.xxx$/, // may apply this only for some modules\n" + + " options: {\n" + + ` ${params.additionalProperty}: …\n` + + " }\n" + + " })\n" + + " ]" + ); + } } - ); - }); - } + } + + return formattedError; + } + } + ); }; +module.exports = validateSchema; /***/ }), -/***/ 96972: -/***/ (function(module) { +/***/ 5434: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -137794,99 +137150,83 @@ module.exports = class UnsafeCachePlugin { -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); -module.exports = class UseFilePlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string} filename filename - * @param {string | ResolveStepHook} target target - */ - constructor(source, filename, target) { - this.source = source; - this.filename = filename; - this.target = target; +class AsyncWasmLoadingRuntimeModule extends RuntimeModule { + constructor({ generateLoadBinaryCode, supportsStreaming }) { + super("wasm loading", RuntimeModule.STAGE_NORMAL); + this.generateLoadBinaryCode = generateLoadBinaryCode; + this.supportsStreaming = supportsStreaming; } /** - * @param {Resolver} resolver the resolver - * @returns {void} + * @returns {string} runtime code */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("UseFilePlugin", (request, resolveContext, callback) => { - const filePath = resolver.join(request.path, this.filename); - const obj = { - ...request, - path: filePath, - relativePath: - request.relativePath && - resolver.join(request.relativePath, this.filename) - }; - resolver.doResolve( - target, - obj, - "using path: " + filePath, - resolveContext, - callback - ); - }); + generate() { + const { compilation, chunk } = this; + const { outputOptions, runtimeTemplate } = compilation; + const fn = RuntimeGlobals.instantiateWasm; + const wasmModuleSrcPath = compilation.getPath( + JSON.stringify(outputOptions.webassemblyModuleFilename), + { + hash: `" + ${RuntimeGlobals.getFullHash}() + "`, + hashWithLength: length => + `" + ${RuntimeGlobals.getFullHash}}().slice(0, ${length}) + "`, + module: { + id: '" + wasmModuleId + "', + hash: `" + wasmModuleHash + "`, + hashWithLength(length) { + return `" + wasmModuleHash.slice(0, ${length}) + "`; + } + }, + runtime: chunk.runtime + } + ); + return `${fn} = ${runtimeTemplate.basicFunction( + "exports, wasmModuleId, wasmModuleHash, importsObj", + [ + `var req = ${this.generateLoadBinaryCode(wasmModuleSrcPath)};`, + this.supportsStreaming + ? Template.asString([ + "if (typeof WebAssembly.instantiateStreaming === 'function') {", + Template.indent([ + "return WebAssembly.instantiateStreaming(req, importsObj)", + Template.indent([ + `.then(${runtimeTemplate.returningFunction( + "Object.assign(exports, res.instance.exports)", + "res" + )});` + ]) + ]), + "}" + ]) + : "// no support for streaming compilation", + "return req", + Template.indent([ + `.then(${runtimeTemplate.returningFunction("x.arrayBuffer()", "x")})`, + `.then(${runtimeTemplate.returningFunction( + "WebAssembly.instantiate(bytes, importsObj)", + "bytes" + )})`, + `.then(${runtimeTemplate.returningFunction( + "Object.assign(exports, res.instance.exports)", + "res" + )});` + ]) + ] + )};`; } -}; - - -/***/ }), - -/***/ 81218: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - +} -module.exports = function createInnerContext( - options, - message, - messageOptional -) { - let messageReported = false; - let innerLog = undefined; - if (options.log) { - if (message) { - innerLog = msg => { - if (!messageReported) { - options.log(message); - messageReported = true; - } - options.log(" " + msg); - }; - } else { - innerLog = options.log; - } - } - const childContext = { - log: innerLog, - yield: options.yield, - fileDependencies: options.fileDependencies, - contextDependencies: options.contextDependencies, - missingDependencies: options.missingDependencies, - stack: options.stack - }; - return childContext; -}; +module.exports = AsyncWasmLoadingRuntimeModule; /***/ }), -/***/ 78565: -/***/ (function(module) { +/***/ 58461: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -137896,109 +137236,57 @@ module.exports = function createInnerContext( -module.exports = function forEachBail(array, iterator, callback) { - if (array.length === 0) return callback(); - - let i = 0; - const next = () => { - let loop = undefined; - iterator(array[i++], (err, result) => { - if (err || result !== undefined || i >= array.length) { - return callback(err, result); - } - if (loop === false) while (next()); - loop = true; - }); - if (!loop) loop = false; - return loop; - }; - while (next()); -}; - - -/***/ }), +const Generator = __webpack_require__(93401); -/***/ 47956: -/***/ (function(module) { +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../NormalModule")} NormalModule */ -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +const TYPES = new Set(["webassembly"]); +class AsyncWebAssemblyGenerator extends Generator { + constructor(options) { + super(); + this.options = options; + } + /** + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) + */ + getTypes(module) { + return TYPES; + } -module.exports = function getInnerRequest(resolver, request) { - if ( - typeof request.__innerRequest === "string" && - request.__innerRequest_request === request.request && - request.__innerRequest_relativePath === request.relativePath - ) - return request.__innerRequest; - let innerRequest; - if (request.request) { - innerRequest = request.request; - if (/^\.\.?(?:\/|$)/.test(innerRequest) && request.relativePath) { - innerRequest = resolver.join(request.relativePath, innerRequest); + /** + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module + */ + getSize(module, type) { + const originalSource = module.originalSource(); + if (!originalSource) { + return 0; } - } else { - innerRequest = request.relativePath; + return originalSource.size(); } - request.__innerRequest_request = request.request; - request.__innerRequest_relativePath = request.relativePath; - return (request.__innerRequest = innerRequest); -}; - - -/***/ }), - -/***/ 82918: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -module.exports = function getPaths(path) { - if (path === "/") return { paths: ["/"], segments: [""] }; - const parts = path.split(/(.*?[\\/]+)/); - const paths = [path]; - const segments = [parts[parts.length - 1]]; - let part = parts[parts.length - 1]; - path = path.substr(0, path.length - part.length - 1); - for (let i = parts.length - 2; i > 2; i -= 2) { - paths.push(path); - part = parts[i]; - path = path.substr(0, path.length - part.length) || "/"; - segments.push(part.substr(0, part.length - 1)); + /** + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code + */ + generate(module, generateContext) { + return module.originalSource(); } - part = parts[1]; - segments.push(part); - paths.push(part); - return { - paths: paths, - segments: segments - }; -}; +} -module.exports.basename = function basename(path) { - const i = path.lastIndexOf("/"), - j = path.lastIndexOf("\\"); - const p = i < 0 ? j : j < 0 ? i : i < j ? j : i; - if (p < 0) return null; - const s = path.substr(p + 1); - return s; -}; +module.exports = AsyncWebAssemblyGenerator; /***/ }), -/***/ 9256: +/***/ 95614: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -138009,845 +137297,982 @@ module.exports.basename = function basename(path) { -const fs = __webpack_require__(90552); -const CachedInputFileSystem = __webpack_require__(52788); -const ResolverFactory = __webpack_require__(47716); - -/** @typedef {import("./PnpPlugin").PnpApiImpl} PnpApi */ -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").FileSystem} FileSystem */ -/** @typedef {import("./Resolver").ResolveContext} ResolveContext */ -/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ -/** @typedef {import("./ResolverFactory").Plugin} Plugin */ -/** @typedef {import("./ResolverFactory").UserResolveOptions} ResolveOptions */ +const { RawSource } = __webpack_require__(51255); +const Generator = __webpack_require__(93401); +const InitFragment = __webpack_require__(55870); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const WebAssemblyImportDependency = __webpack_require__(5239); -const nodeFileSystem = new CachedInputFileSystem(fs, 4000); +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -const nodeContext = { - environments: ["node+es3+es5+process+native"] -}; +const TYPES = new Set(["webassembly"]); -const asyncResolver = ResolverFactory.createResolver({ - conditionNames: ["node"], - extensions: [".js", ".json", ".node"], - fileSystem: nodeFileSystem -}); -function resolve(context, path, request, resolveContext, callback) { - if (typeof context === "string") { - callback = resolveContext; - resolveContext = request; - request = path; - path = context; - context = nodeContext; +class AsyncWebAssemblyJavascriptGenerator extends Generator { + constructor(filenameTemplate) { + super(); + this.filenameTemplate = filenameTemplate; } - if (typeof callback !== "function") { - callback = resolveContext; + + /** + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) + */ + getTypes(module) { + return TYPES; } - asyncResolver.resolve(context, path, request, resolveContext, callback); -} -const syncResolver = ResolverFactory.createResolver({ - conditionNames: ["node"], - extensions: [".js", ".json", ".node"], - useSyncFileSystemCalls: true, - fileSystem: nodeFileSystem -}); -function resolveSync(context, path, request) { - if (typeof context === "string") { - request = path; - path = context; - context = nodeContext; + /** + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module + */ + getSize(module, type) { + return 40 + module.dependencies.length * 10; } - return syncResolver.resolveSync(context, path, request); -} -function create(options) { - options = { - fileSystem: nodeFileSystem, - ...options - }; - const resolver = ResolverFactory.createResolver(options); - return function (context, path, request, resolveContext, callback) { - if (typeof context === "string") { - callback = resolveContext; - resolveContext = request; - request = path; - path = context; - context = nodeContext; - } - if (typeof callback !== "function") { - callback = resolveContext; + /** + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code + */ + generate(module, generateContext) { + const { + runtimeTemplate, + chunkGraph, + moduleGraph, + runtimeRequirements, + runtime + } = generateContext; + runtimeRequirements.add(RuntimeGlobals.module); + runtimeRequirements.add(RuntimeGlobals.moduleId); + runtimeRequirements.add(RuntimeGlobals.exports); + runtimeRequirements.add(RuntimeGlobals.instantiateWasm); + /** @type {InitFragment[]} */ + const initFragments = []; + /** @type {Map} */ + const depModules = new Map(); + /** @type {Map} */ + const wasmDepsByRequest = new Map(); + for (const dep of module.dependencies) { + if (dep instanceof WebAssemblyImportDependency) { + const module = moduleGraph.getModule(dep); + if (!depModules.has(module)) { + depModules.set(module, { + request: dep.request, + importVar: `WEBPACK_IMPORTED_MODULE_${depModules.size}` + }); + } + let list = wasmDepsByRequest.get(dep.request); + if (list === undefined) { + list = []; + wasmDepsByRequest.set(dep.request, list); + } + list.push(dep); + } } - resolver.resolve(context, path, request, resolveContext, callback); - }; -} -function createSync(options) { - options = { - useSyncFileSystemCalls: true, - fileSystem: nodeFileSystem, - ...options - }; - const resolver = ResolverFactory.createResolver(options); - return function (context, path, request) { - if (typeof context === "string") { - request = path; - path = context; - context = nodeContext; - } - return resolver.resolveSync(context, path, request); - }; + const promises = []; + + const importStatements = Array.from( + depModules, + ([importedModule, { request, importVar }]) => { + if (moduleGraph.isAsync(importedModule)) { + promises.push(importVar); + } + return runtimeTemplate.importStatement({ + update: false, + module: importedModule, + chunkGraph, + request, + originModule: module, + importVar, + runtimeRequirements + }); + } + ); + const importsCode = importStatements.map(([x]) => x).join(""); + const importsCompatCode = importStatements.map(([_, x]) => x).join(""); + + const importObjRequestItems = Array.from( + wasmDepsByRequest, + ([request, deps]) => { + const exportItems = deps.map(dep => { + const importedModule = moduleGraph.getModule(dep); + const importVar = depModules.get(importedModule).importVar; + return `${JSON.stringify( + dep.name + )}: ${runtimeTemplate.exportFromImport({ + moduleGraph, + module: importedModule, + request, + exportName: dep.name, + originModule: module, + asiSafe: true, + isCall: false, + callContext: false, + defaultInterop: true, + importVar, + initFragments, + runtime, + runtimeRequirements + })}`; + }); + return Template.asString([ + `${JSON.stringify(request)}: {`, + Template.indent(exportItems.join(",\n")), + "}" + ]); + } + ); + + const importsObj = + importObjRequestItems.length > 0 + ? Template.asString([ + "{", + Template.indent(importObjRequestItems.join(",\n")), + "}" + ]) + : undefined; + + const instantiateCall = + `${RuntimeGlobals.instantiateWasm}(${module.exportsArgument}, ${ + module.moduleArgument + }.id, ${JSON.stringify( + chunkGraph.getRenderedModuleHash(module, runtime) + )}` + (importsObj ? `, ${importsObj})` : `)`); + + if (promises.length > 0) + runtimeRequirements.add(RuntimeGlobals.asyncModule); + + const source = new RawSource( + promises.length > 0 + ? Template.asString([ + `var __webpack_instantiate__ = ${runtimeTemplate.basicFunction( + `[${promises.join(", ")}]`, + `${importsCompatCode}return ${instantiateCall};` + )}`, + `${RuntimeGlobals.asyncModule}(${ + module.moduleArgument + }, async ${runtimeTemplate.basicFunction( + "__webpack_handle_async_dependencies__, __webpack_async_result__", + [ + "try {", + importsCode, + `var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${promises.join( + ", " + )}]);`, + `var [${promises.join( + ", " + )}] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__;`, + `${importsCompatCode}await ${instantiateCall};`, + "__webpack_async_result__();", + "} catch(e) { __webpack_async_result__(e); }" + ] + )}, 1);` + ]) + : `${importsCode}${importsCompatCode}module.exports = ${instantiateCall};` + ); + + return InitFragment.addToSource(source, initFragments, generateContext); + } } -/** - * @template A - * @template B - * @param {A} obj input a - * @param {B} exports input b - * @returns {A & B} merged - */ -const mergeExports = (obj, exports) => { - const descriptors = Object.getOwnPropertyDescriptors(exports); - Object.defineProperties(obj, descriptors); - return /** @type {A & B} */ (Object.freeze(obj)); -}; - -module.exports = mergeExports(resolve, { - get sync() { - return resolveSync; - }, - create: mergeExports(create, { - get sync() { - return createSync; - } - }), - ResolverFactory, - CachedInputFileSystem, - get CloneBasenamePlugin() { - return __webpack_require__(22254); - }, - get LogInfoPlugin() { - return __webpack_require__(5049); - }, - get forEachBail() { - return __webpack_require__(78565); - } -}); +module.exports = AsyncWebAssemblyJavascriptGenerator; /***/ }), -/***/ 55863: -/***/ (function(module) { +/***/ 7538: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ -/** @typedef {string|(string|ConditionalMapping)[]} DirectMapping */ -/** @typedef {{[k: string]: MappingValue}} ConditionalMapping */ -/** @typedef {ConditionalMapping|DirectMapping|null} MappingValue */ -/** @typedef {Record|ConditionalMapping|DirectMapping} ExportsField */ -/** @typedef {Record} ImportsField */ - -/** - * @typedef {Object} PathTreeNode - * @property {Map|null} children - * @property {MappingValue} folder - * @property {Map|null} wildcards - * @property {Map} files - */ - -/** - * Processing exports/imports field - * @callback FieldProcessor - * @param {string} request request - * @param {Set} conditionNames condition names - * @returns {string[]} resolved paths - */ - -/* -Example exports field: -{ - ".": "./main.js", - "./feature": { - "browser": "./feature-browser.js", - "default": "./feature.js" - } -} -Terminology: - -Enhanced-resolve name keys ("." and "./feature") as exports field keys. - -If value is string or string[], mapping is called as a direct mapping -and value called as a direct export. - -If value is key-value object, mapping is called as a conditional mapping -and value called as a conditional export. - -Key in conditional mapping is called condition name. - -Conditional mapping nested in another conditional mapping is called nested mapping. - ----------- - -Example imports field: -{ - "#a": "./main.js", - "#moment": { - "browser": "./moment/index.js", - "default": "moment" - }, - "#moment/": { - "browser": "./moment/", - "default": "moment/" - } -} -Terminology: - -Enhanced-resolve name keys ("#a" and "#moment/", "#moment") as imports field keys. - -If value is string or string[], mapping is called as a direct mapping -and value called as a direct export. - -If value is key-value object, mapping is called as a conditional mapping -and value called as a conditional export. - -Key in conditional mapping is called condition name. - -Conditional mapping nested in another conditional mapping is called nested mapping. - -*/ +const { SyncWaterfallHook } = __webpack_require__(41242); +const Compilation = __webpack_require__(85720); +const Generator = __webpack_require__(93401); +const { tryRunOrWebpackError } = __webpack_require__(11351); +const WebAssemblyImportDependency = __webpack_require__(5239); +const { compareModulesByIdentifier } = __webpack_require__(29579); +const memoize = __webpack_require__(78676); -const slashCode = "/".charCodeAt(0); -const dotCode = ".".charCodeAt(0); -const hashCode = "#".charCodeAt(0); +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../CodeGenerationResults")} CodeGenerationResults */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../Template").RenderManifestEntry} RenderManifestEntry */ +/** @typedef {import("../Template").RenderManifestOptions} RenderManifestOptions */ -/** - * @param {ExportsField} exportsField the exports field - * @returns {FieldProcessor} process callback - */ -module.exports.processExportsField = function processExportsField( - exportsField -) { - return createFieldProcessor( - buildExportsFieldPathTree(exportsField), - assertExportsFieldRequest, - assertExportTarget - ); -}; +const getAsyncWebAssemblyGenerator = memoize(() => + __webpack_require__(58461) +); +const getAsyncWebAssemblyJavascriptGenerator = memoize(() => + __webpack_require__(95614) +); +const getAsyncWebAssemblyParser = memoize(() => + __webpack_require__(96305) +); /** - * @param {ImportsField} importsField the exports field - * @returns {FieldProcessor} process callback + * @typedef {Object} WebAssemblyRenderContext + * @property {Chunk} chunk the chunk + * @property {DependencyTemplates} dependencyTemplates the dependency templates + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {CodeGenerationResults} codeGenerationResults results of code generation */ -module.exports.processImportsField = function processImportsField( - importsField -) { - return createFieldProcessor( - buildImportsFieldPathTree(importsField), - assertImportsFieldRequest, - assertImportTarget - ); -}; /** - * @param {PathTreeNode} treeRoot root - * @param {(s: string) => string} assertRequest assertRequest - * @param {(s: string, f: boolean) => void} assertTarget assertTarget - * @returns {FieldProcessor} field processor + * @typedef {Object} CompilationHooks + * @property {SyncWaterfallHook<[Source, Module, WebAssemblyRenderContext]>} renderModuleContent */ -function createFieldProcessor(treeRoot, assertRequest, assertTarget) { - return function fieldProcessor(request, conditionNames) { - request = assertRequest(request); - const match = findMatch(request, treeRoot); - - if (match === null) return []; - - const [mapping, remainRequestIndex] = match; - - /** @type {DirectMapping|null} */ - let direct = null; +/** @type {WeakMap} */ +const compilationHooksMap = new WeakMap(); - if (isConditionalMapping(mapping)) { - direct = conditionalMapping( - /** @type {ConditionalMapping} */ (mapping), - conditionNames +class AsyncWebAssemblyModulesPlugin { + /** + * @param {Compilation} compilation the compilation + * @returns {CompilationHooks} the attached hooks + */ + static getCompilationHooks(compilation) { + if (!(compilation instanceof Compilation)) { + throw new TypeError( + "The 'compilation' argument must be an instance of Compilation" ); - - // matching not found - if (direct === null) return []; - } else { - direct = /** @type {DirectMapping} */ (mapping); } + let hooks = compilationHooksMap.get(compilation); + if (hooks === undefined) { + hooks = { + renderModuleContent: new SyncWaterfallHook([ + "source", + "module", + "renderContext" + ]) + }; + compilationHooksMap.set(compilation, hooks); + } + return hooks; + } - const remainingRequest = - remainRequestIndex === request.length + 1 - ? undefined - : remainRequestIndex < 0 - ? request.slice(-remainRequestIndex - 1) - : request.slice(remainRequestIndex); + constructor(options) { + this.options = options; + } - return directMapping( - remainingRequest, - remainRequestIndex < 0, - direct, - conditionNames, - assertTarget - ); - }; -} + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "AsyncWebAssemblyModulesPlugin", + (compilation, { normalModuleFactory }) => { + const hooks = + AsyncWebAssemblyModulesPlugin.getCompilationHooks(compilation); + compilation.dependencyFactories.set( + WebAssemblyImportDependency, + normalModuleFactory + ); -/** - * @param {string} request request - * @returns {string} updated request - */ -function assertExportsFieldRequest(request) { - if (request.charCodeAt(0) !== dotCode) { - throw new Error('Request should be relative path and start with "."'); - } - if (request.length === 1) return ""; - if (request.charCodeAt(1) !== slashCode) { - throw new Error('Request should be relative path and start with "./"'); - } - if (request.charCodeAt(request.length - 1) === slashCode) { - throw new Error("Only requesting file allowed"); - } + normalModuleFactory.hooks.createParser + .for("webassembly/async") + .tap("AsyncWebAssemblyModulesPlugin", () => { + const AsyncWebAssemblyParser = getAsyncWebAssemblyParser(); - return request.slice(2); -} + return new AsyncWebAssemblyParser(); + }); + normalModuleFactory.hooks.createGenerator + .for("webassembly/async") + .tap("AsyncWebAssemblyModulesPlugin", () => { + const AsyncWebAssemblyJavascriptGenerator = + getAsyncWebAssemblyJavascriptGenerator(); + const AsyncWebAssemblyGenerator = getAsyncWebAssemblyGenerator(); -/** - * @param {string} request request - * @returns {string} updated request - */ -function assertImportsFieldRequest(request) { - if (request.charCodeAt(0) !== hashCode) { - throw new Error('Request should start with "#"'); - } - if (request.length === 1) { - throw new Error("Request should have at least 2 characters"); - } - if (request.charCodeAt(1) === slashCode) { - throw new Error('Request should not start with "#/"'); - } - if (request.charCodeAt(request.length - 1) === slashCode) { - throw new Error("Only requesting file allowed"); - } + return Generator.byType({ + javascript: new AsyncWebAssemblyJavascriptGenerator( + compilation.outputOptions.webassemblyModuleFilename + ), + webassembly: new AsyncWebAssemblyGenerator(this.options) + }); + }); - return request.slice(1); -} + compilation.hooks.renderManifest.tap( + "WebAssemblyModulesPlugin", + (result, options) => { + const { moduleGraph, chunkGraph, runtimeTemplate } = compilation; + const { + chunk, + outputOptions, + dependencyTemplates, + codeGenerationResults + } = options; -/** - * @param {string} exp export target - * @param {boolean} expectFolder is folder expected - */ -function assertExportTarget(exp, expectFolder) { - if ( - exp.charCodeAt(0) === slashCode || - (exp.charCodeAt(0) === dotCode && exp.charCodeAt(1) !== slashCode) - ) { - throw new Error( - `Export should be relative path and start with "./", got ${JSON.stringify( - exp - )}.` - ); - } + for (const module of chunkGraph.getOrderedChunkModulesIterable( + chunk, + compareModulesByIdentifier + )) { + if (module.type === "webassembly/async") { + const filenameTemplate = + outputOptions.webassemblyModuleFilename; - const isFolder = exp.charCodeAt(exp.length - 1) === slashCode; + result.push({ + render: () => + this.renderModule( + module, + { + chunk, + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + codeGenerationResults + }, + hooks + ), + filenameTemplate, + pathOptions: { + module, + runtime: chunk.runtime, + chunkGraph + }, + auxiliary: true, + identifier: `webassemblyAsyncModule${chunkGraph.getModuleId( + module + )}`, + hash: chunkGraph.getModuleHash(module, chunk.runtime) + }); + } + } - if (isFolder !== expectFolder) { - throw new Error( - expectFolder - ? `Expecting folder to folder mapping. ${JSON.stringify( - exp - )} should end with "/"` - : `Expecting file to file mapping. ${JSON.stringify( - exp - )} should not end with "/"` + return result; + } + ); + } ); } -} - -/** - * @param {string} imp import target - * @param {boolean} expectFolder is folder expected - */ -function assertImportTarget(imp, expectFolder) { - const isFolder = imp.charCodeAt(imp.length - 1) === slashCode; - if (isFolder !== expectFolder) { - throw new Error( - expectFolder - ? `Expecting folder to folder mapping. ${JSON.stringify( - imp - )} should end with "/"` - : `Expecting file to file mapping. ${JSON.stringify( - imp - )} should not end with "/"` - ); + renderModule(module, renderContext, hooks) { + const { codeGenerationResults, chunk } = renderContext; + try { + const moduleSource = codeGenerationResults.getSource( + module, + chunk.runtime, + "webassembly" + ); + return tryRunOrWebpackError( + () => + hooks.renderModuleContent.call(moduleSource, module, renderContext), + "AsyncWebAssemblyModulesPlugin.getCompilationHooks().renderModuleContent" + ); + } catch (e) { + e.module = module; + throw e; + } } } -/** - * Trying to match request to field - * @param {string} request request - * @param {PathTreeNode} treeRoot path tree root - * @returns {[MappingValue, number]|null} match or null, number is negative and one less when it's a folder mapping, number is request.length + 1 for direct mappings - */ -function findMatch(request, treeRoot) { - if (request.length === 0) { - const value = treeRoot.files.get(""); +module.exports = AsyncWebAssemblyModulesPlugin; - return value ? [value, 1] : null; - } - if ( - treeRoot.children === null && - treeRoot.folder === null && - treeRoot.wildcards === null - ) { - const value = treeRoot.files.get(request); +/***/ }), - return value ? [value, request.length + 1] : null; - } +/***/ 96305: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - let node = treeRoot; - let lastNonSlashIndex = 0; - let slashIndex = request.indexOf("/", 0); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** @type {[MappingValue, number]|null} */ - let lastFolderMatch = null; - const applyFolderMapping = () => { - const folderMapping = node.folder; - if (folderMapping) { - if (lastFolderMatch) { - lastFolderMatch[0] = folderMapping; - lastFolderMatch[1] = -lastNonSlashIndex - 1; - } else { - lastFolderMatch = [folderMapping, -lastNonSlashIndex - 1]; - } - } - }; - const applyWildcardMappings = (wildcardMappings, remainingRequest) => { - if (wildcardMappings) { - for (const [key, target] of wildcardMappings) { - if (remainingRequest.startsWith(key)) { - if (!lastFolderMatch) { - lastFolderMatch = [target, lastNonSlashIndex + key.length]; - } else if (lastFolderMatch[1] < lastNonSlashIndex + key.length) { - lastFolderMatch[0] = target; - lastFolderMatch[1] = lastNonSlashIndex + key.length; - } - } - } - } - }; +const t = __webpack_require__(51826); +const { decode } = __webpack_require__(73726); +const Parser = __webpack_require__(11715); +const StaticExportsDependency = __webpack_require__(91418); +const WebAssemblyImportDependency = __webpack_require__(5239); - while (slashIndex !== -1) { - applyFolderMapping(); +/** @typedef {import("../Parser").ParserState} ParserState */ +/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ - const wildcardMappings = node.wildcards; +const decoderOpts = { + ignoreCodeSection: true, + ignoreDataSection: true, - if (!wildcardMappings && node.children === null) return lastFolderMatch; + // this will avoid having to lookup with identifiers in the ModuleContext + ignoreCustomNameSection: true +}; - const folder = request.slice(lastNonSlashIndex, slashIndex); +class WebAssemblyParser extends Parser { + constructor(options) { + super(); + this.hooks = Object.freeze({}); + this.options = options; + } - applyWildcardMappings(wildcardMappings, folder); + /** + * @param {string | Buffer | PreparsedAst} source the source to parse + * @param {ParserState} state the parser state + * @returns {ParserState} the parser state + */ + parse(source, state) { + if (!Buffer.isBuffer(source)) { + throw new Error("WebAssemblyParser input must be a Buffer"); + } - if (node.children === null) return lastFolderMatch; + // flag it as async module + state.module.buildInfo.strict = true; + state.module.buildMeta.exportsType = "namespace"; + state.module.buildMeta.async = true; - const newNode = node.children.get(folder); + // parse it + const program = decode(source, decoderOpts); + const module = program.body[0]; - if (!newNode) { - return lastFolderMatch; - } + const exports = []; + t.traverse(module, { + ModuleExport({ node }) { + exports.push(node.name); + }, - node = newNode; - lastNonSlashIndex = slashIndex + 1; - slashIndex = request.indexOf("/", lastNonSlashIndex); - } + ModuleImport({ node }) { + const dep = new WebAssemblyImportDependency( + node.module, + node.name, + node.descr, + false + ); - const remainingRequest = - lastNonSlashIndex > 0 ? request.slice(lastNonSlashIndex) : request; + state.module.addDependency(dep); + } + }); - const value = node.files.get(remainingRequest); + state.module.addDependency(new StaticExportsDependency(exports, false)); - if (value) { - return [value, request.length + 1]; + return state; } +} - applyFolderMapping(); +module.exports = WebAssemblyParser; - applyWildcardMappings(node.wildcards, remainingRequest); - return lastFolderMatch; -} +/***/ }), -/** - * @param {ConditionalMapping|DirectMapping|null} mapping mapping - * @returns {boolean} is conditional mapping - */ -function isConditionalMapping(mapping) { - return ( - mapping !== null && typeof mapping === "object" && !Array.isArray(mapping) - ); -} +/***/ 78455: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** - * @param {string|undefined} remainingRequest remaining request when folder mapping, undefined for file mappings - * @param {boolean} subpathMapping true, for subpath mappings - * @param {DirectMapping|null} mappingTarget direct export - * @param {Set} conditionNames condition names - * @param {(d: string, f: boolean) => void} assert asserting direct value - * @returns {string[]} mapping result - */ -function directMapping( - remainingRequest, - subpathMapping, - mappingTarget, - conditionNames, - assert -) { - if (mappingTarget === null) return []; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ - if (typeof mappingTarget === "string") { - return [ - targetMapping(remainingRequest, subpathMapping, mappingTarget, assert) - ]; - } - const targets = []; - for (const exp of mappingTarget) { - if (typeof exp === "string") { - targets.push( - targetMapping(remainingRequest, subpathMapping, exp, assert) - ); - continue; - } +const WebpackError = __webpack_require__(53799); - const mapping = conditionalMapping(exp, conditionNames); - if (!mapping) continue; - const innerExports = directMapping( - remainingRequest, - subpathMapping, - mapping, - conditionNames, - assert - ); - for (const innerExport of innerExports) { - targets.push(innerExport); - } +module.exports = class UnsupportedWebAssemblyFeatureError extends WebpackError { + /** @param {string} message Error message */ + constructor(message) { + super(message); + this.name = "UnsupportedWebAssemblyFeatureError"; + this.hideStack = true; } +}; - return targets; -} -/** - * @param {string|undefined} remainingRequest remaining request when folder mapping, undefined for file mappings - * @param {boolean} subpathMapping true, for subpath mappings - * @param {string} mappingTarget direct export - * @param {(d: string, f: boolean) => void} assert asserting direct value - * @returns {string} mapping result - */ -function targetMapping( - remainingRequest, - subpathMapping, - mappingTarget, - assert -) { - if (remainingRequest === undefined) { - assert(mappingTarget, false); - return mappingTarget; - } - if (subpathMapping) { - assert(mappingTarget, true); - return mappingTarget + remainingRequest; - } - assert(mappingTarget, false); - return mappingTarget.replace(/\*/g, remainingRequest.replace(/\$/g, "$$")); -} +/***/ }), -/** - * @param {ConditionalMapping} conditionalMapping_ conditional mapping - * @param {Set} conditionNames condition names - * @returns {DirectMapping|null} direct mapping if found - */ -function conditionalMapping(conditionalMapping_, conditionNames) { - /** @type {[ConditionalMapping, string[], number][]} */ - let lookup = [[conditionalMapping_, Object.keys(conditionalMapping_), 0]]; +/***/ 87394: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - loop: while (lookup.length > 0) { - const [mapping, conditions, j] = lookup[lookup.length - 1]; - const last = conditions.length - 1; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ - for (let i = j; i < conditions.length; i++) { - const condition = conditions[i]; - // assert default. Could be last only - if (i !== last) { - if (condition === "default") { - throw new Error("Default condition should be last one"); - } - } else if (condition === "default") { - const innerMapping = mapping[condition]; - // is nested - if (isConditionalMapping(innerMapping)) { - const conditionalMapping = /** @type {ConditionalMapping} */ (innerMapping); - lookup[lookup.length - 1][2] = i + 1; - lookup.push([conditionalMapping, Object.keys(conditionalMapping), 0]); - continue loop; - } - return /** @type {DirectMapping} */ (innerMapping); - } +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); +const { compareModulesByIdentifier } = __webpack_require__(29579); +const WebAssemblyUtils = __webpack_require__(18650); - if (conditionNames.has(condition)) { - const innerMapping = mapping[condition]; - // is nested - if (isConditionalMapping(innerMapping)) { - const conditionalMapping = /** @type {ConditionalMapping} */ (innerMapping); - lookup[lookup.length - 1][2] = i + 1; - lookup.push([conditionalMapping, Object.keys(conditionalMapping), 0]); - continue loop; - } +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - return /** @type {DirectMapping} */ (innerMapping); +// TODO webpack 6 remove the whole folder + +// Get all wasm modules +const getAllWasmModules = (moduleGraph, chunkGraph, chunk) => { + const wasmModules = chunk.getAllAsyncChunks(); + const array = []; + for (const chunk of wasmModules) { + for (const m of chunkGraph.getOrderedChunkModulesIterable( + chunk, + compareModulesByIdentifier + )) { + if (m.type.startsWith("webassembly")) { + array.push(m); } } - - lookup.pop(); } - return null; -} + return array; +}; /** - * Internal helper to create path tree node - * to ensure that each node gets the same hidden class - * @returns {PathTreeNode} node + * generates the import object function for a module + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {Module} module the module + * @param {boolean} mangle mangle imports + * @param {string[]} declarations array where declarations are pushed to + * @param {RuntimeSpec} runtime the runtime + * @returns {string} source code */ -function createNode() { - return { - children: null, - folder: null, - wildcards: null, - files: new Map() - }; -} +const generateImportObject = ( + chunkGraph, + module, + mangle, + declarations, + runtime +) => { + const moduleGraph = chunkGraph.moduleGraph; + const waitForInstances = new Map(); + const properties = []; + const usedWasmDependencies = WebAssemblyUtils.getUsedDependencies( + moduleGraph, + module, + mangle + ); + for (const usedDep of usedWasmDependencies) { + const dep = usedDep.dependency; + const importedModule = moduleGraph.getModule(dep); + const exportName = dep.name; + const usedName = + importedModule && + moduleGraph + .getExportsInfo(importedModule) + .getUsedName(exportName, runtime); + const description = dep.description; + const direct = dep.onlyDirectImport; -/** - * Internal helper for building path tree - * @param {PathTreeNode} root root - * @param {string} path path - * @param {MappingValue} target target - */ -function walkPath(root, path, target) { - if (path.length === 0) { - root.folder = target; - return; - } + const module = usedDep.module; + const name = usedDep.name; - let node = root; - // Typical path tree can looks like - // root - // - files: ["a.js", "b.js"] - // - children: - // node1: - // - files: ["a.js", "b.js"] - let lastNonSlashIndex = 0; - let slashIndex = path.indexOf("/", 0); + if (direct) { + const instanceVar = `m${waitForInstances.size}`; + waitForInstances.set(instanceVar, chunkGraph.getModuleId(importedModule)); + properties.push({ + module, + name, + value: `${instanceVar}[${JSON.stringify(usedName)}]` + }); + } else { + const params = description.signature.params.map( + (param, k) => "p" + k + param.valtype + ); - while (slashIndex !== -1) { - const folder = path.slice(lastNonSlashIndex, slashIndex); - let newNode; + const mod = `${RuntimeGlobals.moduleCache}[${JSON.stringify( + chunkGraph.getModuleId(importedModule) + )}]`; + const modExports = `${mod}.exports`; - if (node.children === null) { - newNode = createNode(); - node.children = new Map(); - node.children.set(folder, newNode); - } else { - newNode = node.children.get(folder); + const cache = `wasmImportedFuncCache${declarations.length}`; + declarations.push(`var ${cache};`); - if (!newNode) { - newNode = createNode(); - node.children.set(folder, newNode); - } + properties.push({ + module, + name, + value: Template.asString([ + (importedModule.type.startsWith("webassembly") + ? `${mod} ? ${modExports}[${JSON.stringify(usedName)}] : ` + : "") + `function(${params}) {`, + Template.indent([ + `if(${cache} === undefined) ${cache} = ${modExports};`, + `return ${cache}[${JSON.stringify(usedName)}](${params});` + ]), + "}" + ]) + }); } - - node = newNode; - lastNonSlashIndex = slashIndex + 1; - slashIndex = path.indexOf("/", lastNonSlashIndex); } - if (lastNonSlashIndex >= path.length) { - node.folder = target; + let importObject; + if (mangle) { + importObject = [ + "return {", + Template.indent([ + properties.map(p => `${JSON.stringify(p.name)}: ${p.value}`).join(",\n") + ]), + "};" + ]; } else { - const file = lastNonSlashIndex > 0 ? path.slice(lastNonSlashIndex) : path; - if (file.endsWith("*")) { - if (node.wildcards === null) node.wildcards = new Map(); - node.wildcards.set(file.slice(0, -1), target); - } else { - node.files.set(file, target); + const propertiesByModule = new Map(); + for (const p of properties) { + let list = propertiesByModule.get(p.module); + if (list === undefined) { + propertiesByModule.set(p.module, (list = [])); + } + list.push(p); } + importObject = [ + "return {", + Template.indent([ + Array.from(propertiesByModule, ([module, list]) => { + return Template.asString([ + `${JSON.stringify(module)}: {`, + Template.indent([ + list.map(p => `${JSON.stringify(p.name)}: ${p.value}`).join(",\n") + ]), + "}" + ]); + }).join(",\n") + ]), + "};" + ]; } -} - -/** - * @param {ExportsField} field exports field - * @returns {PathTreeNode} tree root - */ -function buildExportsFieldPathTree(field) { - const root = createNode(); - - // handle syntax sugar, if exports field is direct mapping for "." - if (typeof field === "string") { - root.files.set("", field); - return root; - } else if (Array.isArray(field)) { - root.files.set("", field.slice()); - - return root; + const moduleIdStringified = JSON.stringify(chunkGraph.getModuleId(module)); + if (waitForInstances.size === 1) { + const moduleId = Array.from(waitForInstances.values())[0]; + const promise = `installedWasmModules[${JSON.stringify(moduleId)}]`; + const variable = Array.from(waitForInstances.keys())[0]; + return Template.asString([ + `${moduleIdStringified}: function() {`, + Template.indent([ + `return promiseResolve().then(function() { return ${promise}; }).then(function(${variable}) {`, + Template.indent(importObject), + "});" + ]), + "}," + ]); + } else if (waitForInstances.size > 0) { + const promises = Array.from( + waitForInstances.values(), + id => `installedWasmModules[${JSON.stringify(id)}]` + ).join(", "); + const variables = Array.from( + waitForInstances.keys(), + (name, i) => `${name} = array[${i}]` + ).join(", "); + return Template.asString([ + `${moduleIdStringified}: function() {`, + Template.indent([ + `return promiseResolve().then(function() { return Promise.all([${promises}]); }).then(function(array) {`, + Template.indent([`var ${variables};`, ...importObject]), + "});" + ]), + "}," + ]); + } else { + return Template.asString([ + `${moduleIdStringified}: function() {`, + Template.indent(importObject), + "}," + ]); } +}; - const keys = Object.keys(field); - - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; +class WasmChunkLoadingRuntimeModule extends RuntimeModule { + constructor({ + generateLoadBinaryCode, + supportsStreaming, + mangleImports, + runtimeRequirements + }) { + super("wasm chunk loading", RuntimeModule.STAGE_ATTACH); + this.generateLoadBinaryCode = generateLoadBinaryCode; + this.supportsStreaming = supportsStreaming; + this.mangleImports = mangleImports; + this._runtimeRequirements = runtimeRequirements; + } - if (key.charCodeAt(0) !== dotCode) { - // handle syntax sugar, if exports field is conditional mapping for "." - if (i === 0) { - while (i < keys.length) { - const charCode = keys[i].charCodeAt(0); - if (charCode === dotCode || charCode === slashCode) { - throw new Error( - `Exports field key should be relative path and start with "." (key: ${JSON.stringify( - key - )})` - ); + /** + * @returns {string} runtime code + */ + generate() { + const { chunkGraph, compilation, chunk, mangleImports } = this; + const { moduleGraph, outputOptions } = compilation; + const fn = RuntimeGlobals.ensureChunkHandlers; + const withHmr = this._runtimeRequirements.has( + RuntimeGlobals.hmrDownloadUpdateHandlers + ); + const wasmModules = getAllWasmModules(moduleGraph, chunkGraph, chunk); + const declarations = []; + const importObjects = wasmModules.map(module => { + return generateImportObject( + chunkGraph, + module, + this.mangleImports, + declarations, + chunk.runtime + ); + }); + const chunkModuleIdMap = chunkGraph.getChunkModuleIdMap(chunk, m => + m.type.startsWith("webassembly") + ); + const createImportObject = content => + mangleImports + ? `{ ${JSON.stringify(WebAssemblyUtils.MANGLED_MODULE)}: ${content} }` + : content; + const wasmModuleSrcPath = compilation.getPath( + JSON.stringify(outputOptions.webassemblyModuleFilename), + { + hash: `" + ${RuntimeGlobals.getFullHash}() + "`, + hashWithLength: length => + `" + ${RuntimeGlobals.getFullHash}}().slice(0, ${length}) + "`, + module: { + id: '" + wasmModuleId + "', + hash: `" + ${JSON.stringify( + chunkGraph.getChunkModuleRenderedHashMap(chunk, m => + m.type.startsWith("webassembly") + ) + )}[chunkId][wasmModuleId] + "`, + hashWithLength(length) { + return `" + ${JSON.stringify( + chunkGraph.getChunkModuleRenderedHashMap( + chunk, + m => m.type.startsWith("webassembly"), + length + ) + )}[chunkId][wasmModuleId] + "`; } - i++; - } - - root.files.set("", field); - return root; + }, + runtime: chunk.runtime } + ); - throw new Error( - `Exports field key should be relative path and start with "." (key: ${JSON.stringify( - key - )})` - ); - } - - if (key.length === 1) { - root.files.set("", field[key]); - continue; - } - - if (key.charCodeAt(1) !== slashCode) { - throw new Error( - `Exports field key should be relative path and start with "./" (key: ${JSON.stringify( - key - )})` - ); - } + const stateExpression = withHmr + ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_wasm` + : undefined; - walkPath(root, key.slice(2), field[key]); + return Template.asString([ + "// object to store loaded and loading wasm modules", + `var installedWasmModules = ${ + stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" + }{};`, + "", + // This function is used to delay reading the installed wasm module promises + // by a microtask. Sorting them doesn't help because there are edge cases where + // sorting is not possible (modules splitted into different chunks). + // So we not even trying and solve this by a microtask delay. + "function promiseResolve() { return Promise.resolve(); }", + "", + Template.asString(declarations), + "var wasmImportObjects = {", + Template.indent(importObjects), + "};", + "", + `var wasmModuleMap = ${JSON.stringify( + chunkModuleIdMap, + undefined, + "\t" + )};`, + "", + "// object with all WebAssembly.instance exports", + `${RuntimeGlobals.wasmInstances} = {};`, + "", + "// Fetch + compile chunk loading for webassembly", + `${fn}.wasm = function(chunkId, promises) {`, + Template.indent([ + "", + `var wasmModules = wasmModuleMap[chunkId] || [];`, + "", + "wasmModules.forEach(function(wasmModuleId, idx) {", + Template.indent([ + "var installedWasmModuleData = installedWasmModules[wasmModuleId];", + "", + '// a Promise means "currently loading" or "already loaded".', + "if(installedWasmModuleData)", + Template.indent(["promises.push(installedWasmModuleData);"]), + "else {", + Template.indent([ + `var importObject = wasmImportObjects[wasmModuleId]();`, + `var req = ${this.generateLoadBinaryCode(wasmModuleSrcPath)};`, + "var promise;", + this.supportsStreaming + ? Template.asString([ + "if(importObject && typeof importObject.then === 'function' && typeof WebAssembly.compileStreaming === 'function') {", + Template.indent([ + "promise = Promise.all([WebAssembly.compileStreaming(req), importObject]).then(function(items) {", + Template.indent([ + `return WebAssembly.instantiate(items[0], ${createImportObject( + "items[1]" + )});` + ]), + "});" + ]), + "} else if(typeof WebAssembly.instantiateStreaming === 'function') {", + Template.indent([ + `promise = WebAssembly.instantiateStreaming(req, ${createImportObject( + "importObject" + )});` + ]) + ]) + : Template.asString([ + "if(importObject && typeof importObject.then === 'function') {", + Template.indent([ + "var bytesPromise = req.then(function(x) { return x.arrayBuffer(); });", + "promise = Promise.all([", + Template.indent([ + "bytesPromise.then(function(bytes) { return WebAssembly.compile(bytes); }),", + "importObject" + ]), + "]).then(function(items) {", + Template.indent([ + `return WebAssembly.instantiate(items[0], ${createImportObject( + "items[1]" + )});` + ]), + "});" + ]) + ]), + "} else {", + Template.indent([ + "var bytesPromise = req.then(function(x) { return x.arrayBuffer(); });", + "promise = bytesPromise.then(function(bytes) {", + Template.indent([ + `return WebAssembly.instantiate(bytes, ${createImportObject( + "importObject" + )});` + ]), + "});" + ]), + "}", + "promises.push(installedWasmModules[wasmModuleId] = promise.then(function(res) {", + Template.indent([ + `return ${RuntimeGlobals.wasmInstances}[wasmModuleId] = (res.instance || res).exports;` + ]), + "}));" + ]), + "}" + ]), + "});" + ]), + "};" + ]); } - - return root; } -/** - * @param {ImportsField} field imports field - * @returns {PathTreeNode} root - */ -function buildImportsFieldPathTree(field) { - const root = createNode(); - - const keys = Object.keys(field); - - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - - if (key.charCodeAt(0) !== hashCode) { - throw new Error( - `Imports field key should start with "#" (key: ${JSON.stringify(key)})` - ); - } - - if (key.length === 1) { - throw new Error( - `Imports field key should have at least 2 characters (key: ${JSON.stringify( - key - )})` - ); - } - - if (key.charCodeAt(1) === slashCode) { - throw new Error( - `Imports field key should not start with "#/" (key: ${JSON.stringify( - key - )})` - ); - } - - walkPath(root, key.slice(1), field[key]); - } - - return root; -} +module.exports = WasmChunkLoadingRuntimeModule; /***/ }), -/***/ 71053: -/***/ (function(module) { +/***/ 19810: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ -const PATH_QUERY_FRAGMENT_REGEXP = /^(#?(?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/; +const formatLocation = __webpack_require__(16734); +const UnsupportedWebAssemblyFeatureError = __webpack_require__(78455); -/** - * @param {string} identifier identifier - * @returns {[string, string, string]|null} parsed identifier - */ -function parseIdentifier(identifier) { - const match = PATH_QUERY_FRAGMENT_REGEXP.exec(identifier); +/** @typedef {import("../Compiler")} Compiler */ - if (!match) return null; +class WasmFinalizeExportsPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap("WasmFinalizeExportsPlugin", compilation => { + compilation.hooks.finishModules.tap( + "WasmFinalizeExportsPlugin", + modules => { + for (const module of modules) { + // 1. if a WebAssembly module + if (module.type.startsWith("webassembly") === true) { + const jsIncompatibleExports = + module.buildMeta.jsIncompatibleExports; - return [ - match[1].replace(/\0(.)/g, "$1"), - match[2] ? match[2].replace(/\0(.)/g, "$1") : "", - match[3] || "" - ]; + if (jsIncompatibleExports === undefined) { + continue; + } + + for (const connection of compilation.moduleGraph.getIncomingConnections( + module + )) { + // 2. is active and referenced by a non-WebAssembly module + if ( + connection.isTargetActive(undefined) && + connection.originModule.type.startsWith("webassembly") === + false + ) { + const referencedExports = + compilation.getDependencyReferencedExports( + connection.dependency, + undefined + ); + + for (const info of referencedExports) { + const names = Array.isArray(info) ? info : info.name; + if (names.length === 0) continue; + const name = names[0]; + if (typeof name === "object") continue; + // 3. and uses a func with an incompatible JS signature + if ( + Object.prototype.hasOwnProperty.call( + jsIncompatibleExports, + name + ) + ) { + // 4. error + const error = new UnsupportedWebAssemblyFeatureError( + `Export "${name}" with ${jsIncompatibleExports[name]} can only be used for direct wasm to wasm dependencies\n` + + `It's used from ${connection.originModule.readableIdentifier( + compilation.requestShortener + )} at ${formatLocation(connection.dependency.loc)}.` + ); + error.module = module; + compilation.errors.push(error); + } + } + } + } + } + } + } + ); + }); + } } -module.exports.parseIdentifier = parseIdentifier; +module.exports = WasmFinalizeExportsPlugin; /***/ }), -/***/ 67079: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 47012: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -138857,942 +138282,1194 @@ module.exports.parseIdentifier = parseIdentifier; -const path = __webpack_require__(71017); +const { RawSource } = __webpack_require__(51255); +const Generator = __webpack_require__(93401); +const WebAssemblyUtils = __webpack_require__(18650); -const CHAR_HASH = "#".charCodeAt(0); -const CHAR_SLASH = "/".charCodeAt(0); -const CHAR_BACKSLASH = "\\".charCodeAt(0); -const CHAR_A = "A".charCodeAt(0); -const CHAR_Z = "Z".charCodeAt(0); -const CHAR_LOWER_A = "a".charCodeAt(0); -const CHAR_LOWER_Z = "z".charCodeAt(0); -const CHAR_DOT = ".".charCodeAt(0); -const CHAR_COLON = ":".charCodeAt(0); +const t = __webpack_require__(51826); +const { moduleContextFromModuleAST } = __webpack_require__(51826); +const { editWithAST, addWithAST } = __webpack_require__(87362); +const { decode } = __webpack_require__(73726); -const posixNormalize = path.posix.normalize; -const winNormalize = path.win32.normalize; +const WebAssemblyExportImportedDependency = __webpack_require__(52204); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +/** @typedef {import("./WebAssemblyUtils").UsedWasmDependency} UsedWasmDependency */ /** - * @enum {number} + * @typedef {(ArrayBuffer) => ArrayBuffer} ArrayBufferTransform */ -const PathType = Object.freeze({ - Empty: 0, - Normal: 1, - Relative: 2, - AbsoluteWin: 3, - AbsolutePosix: 4, - Internal: 5 -}); -exports.PathType = PathType; /** - * @param {string} p a path - * @returns {PathType} type of path + * @template T + * @param {Function[]} fns transforms + * @returns {Function} composed transform */ -const getType = p => { - switch (p.length) { - case 0: - return PathType.Empty; - case 1: { - const c0 = p.charCodeAt(0); - switch (c0) { - case CHAR_DOT: - return PathType.Relative; - case CHAR_SLASH: - return PathType.AbsolutePosix; - case CHAR_HASH: - return PathType.Internal; - } - return PathType.Normal; +const compose = (...fns) => { + return fns.reduce( + (prevFn, nextFn) => { + return value => nextFn(prevFn(value)); + }, + value => value + ); +}; + +/** + * Removes the start instruction + * + * @param {Object} state unused state + * @returns {ArrayBufferTransform} transform + */ +const removeStartFunc = state => bin => { + return editWithAST(state.ast, bin, { + Start(path) { + path.remove(); } - case 2: { - const c0 = p.charCodeAt(0); - switch (c0) { - case CHAR_DOT: { - const c1 = p.charCodeAt(1); - switch (c1) { - case CHAR_DOT: - case CHAR_SLASH: - return PathType.Relative; - } - return PathType.Normal; - } - case CHAR_SLASH: - return PathType.AbsolutePosix; - case CHAR_HASH: - return PathType.Internal; - } - const c1 = p.charCodeAt(1); - if (c1 === CHAR_COLON) { - if ( - (c0 >= CHAR_A && c0 <= CHAR_Z) || - (c0 >= CHAR_LOWER_A && c0 <= CHAR_LOWER_Z) - ) { - return PathType.AbsoluteWin; - } + }); +}; + +/** + * Get imported globals + * + * @param {Object} ast Module's AST + * @returns {Array} - nodes + */ +const getImportedGlobals = ast => { + const importedGlobals = []; + + t.traverse(ast, { + ModuleImport({ node }) { + if (t.isGlobalType(node.descr)) { + importedGlobals.push(node); } - return PathType.Normal; } - } - const c0 = p.charCodeAt(0); - switch (c0) { - case CHAR_DOT: { - const c1 = p.charCodeAt(1); - switch (c1) { - case CHAR_SLASH: - return PathType.Relative; - case CHAR_DOT: { - const c2 = p.charCodeAt(2); - if (c2 === CHAR_SLASH) return PathType.Relative; - return PathType.Normal; - } + }); + + return importedGlobals; +}; + +/** + * Get the count for imported func + * + * @param {Object} ast Module's AST + * @returns {Number} - count + */ +const getCountImportedFunc = ast => { + let count = 0; + + t.traverse(ast, { + ModuleImport({ node }) { + if (t.isFuncImportDescr(node.descr)) { + count++; } - return PathType.Normal; - } - case CHAR_SLASH: - return PathType.AbsolutePosix; - case CHAR_HASH: - return PathType.Internal; - } - const c1 = p.charCodeAt(1); - if (c1 === CHAR_COLON) { - const c2 = p.charCodeAt(2); - if ( - (c2 === CHAR_BACKSLASH || c2 === CHAR_SLASH) && - ((c0 >= CHAR_A && c0 <= CHAR_Z) || - (c0 >= CHAR_LOWER_A && c0 <= CHAR_LOWER_Z)) - ) { - return PathType.AbsoluteWin; } - } - return PathType.Normal; + }); + + return count; }; -exports.getType = getType; /** - * @param {string} p a path - * @returns {string} the normalized path + * Get next type index + * + * @param {Object} ast Module's AST + * @returns {t.Index} - index */ -const normalize = p => { - switch (getType(p)) { - case PathType.Empty: - return p; - case PathType.AbsoluteWin: - return winNormalize(p); - case PathType.Relative: { - const r = posixNormalize(p); - return getType(r) === PathType.Relative ? r : `./${r}`; - } +const getNextTypeIndex = ast => { + const typeSectionMetadata = t.getSectionMetadata(ast, "type"); + + if (typeSectionMetadata === undefined) { + return t.indexLiteral(0); } - return posixNormalize(p); + + return t.indexLiteral(typeSectionMetadata.vectorOfSize.value); }; -exports.normalize = normalize; /** - * @param {string} rootPath the root path - * @param {string | undefined} request the request path - * @returns {string} the joined path + * Get next func index + * + * The Func section metadata provide informations for implemented funcs + * in order to have the correct index we shift the index by number of external + * functions. + * + * @param {Object} ast Module's AST + * @param {Number} countImportedFunc number of imported funcs + * @returns {t.Index} - index */ -const join = (rootPath, request) => { - if (!request) return normalize(rootPath); - const requestType = getType(request); - switch (requestType) { - case PathType.AbsolutePosix: - return posixNormalize(request); - case PathType.AbsoluteWin: - return winNormalize(request); - } - switch (getType(rootPath)) { - case PathType.Normal: - case PathType.Relative: - case PathType.AbsolutePosix: - return posixNormalize(`${rootPath}/${request}`); - case PathType.AbsoluteWin: - return winNormalize(`${rootPath}\\${request}`); - } - switch (requestType) { - case PathType.Empty: - return rootPath; - case PathType.Relative: { - const r = posixNormalize(rootPath); - return getType(r) === PathType.Relative ? r : `./${r}`; - } +const getNextFuncIndex = (ast, countImportedFunc) => { + const funcSectionMetadata = t.getSectionMetadata(ast, "func"); + + if (funcSectionMetadata === undefined) { + return t.indexLiteral(0 + countImportedFunc); } - return posixNormalize(rootPath); -}; -exports.join = join; -const joinCache = new Map(); + const vectorOfSize = funcSectionMetadata.vectorOfSize.value; + + return t.indexLiteral(vectorOfSize + countImportedFunc); +}; /** - * @param {string} rootPath the root path - * @param {string | undefined} request the request path - * @returns {string} the joined path + * Creates an init instruction for a global type + * @param {t.GlobalType} globalType the global type + * @returns {t.Instruction} init expression */ -const cachedJoin = (rootPath, request) => { - let cacheEntry; - let cache = joinCache.get(rootPath); - if (cache === undefined) { - joinCache.set(rootPath, (cache = new Map())); +const createDefaultInitForGlobal = globalType => { + if (globalType.valtype[0] === "i") { + // create NumberLiteral global initializer + return t.objectInstruction("const", globalType.valtype, [ + t.numberLiteralFromRaw(66) + ]); + } else if (globalType.valtype[0] === "f") { + // create FloatLiteral global initializer + return t.objectInstruction("const", globalType.valtype, [ + t.floatLiteral(66, false, false, "66") + ]); } else { - cacheEntry = cache.get(request); - if (cacheEntry !== undefined) return cacheEntry; + throw new Error("unknown type: " + globalType.valtype); } - cacheEntry = join(rootPath, request); - cache.set(request, cacheEntry); - return cacheEntry; }; -exports.cachedJoin = cachedJoin; -const checkExportsFieldTarget = relativePath => { - let lastNonSlashIndex = 2; - let slashIndex = relativePath.indexOf("/", 2); - let cd = 0; +/** + * Rewrite the import globals: + * - removes the ModuleImport instruction + * - injects at the same offset a mutable global of the same type + * + * Since the imported globals are before the other global declarations, our + * indices will be preserved. + * + * Note that globals will become mutable. + * + * @param {Object} state unused state + * @returns {ArrayBufferTransform} transform + */ +const rewriteImportedGlobals = state => bin => { + const additionalInitCode = state.additionalInitCode; + const newGlobals = []; - while (slashIndex !== -1) { - const folder = relativePath.slice(lastNonSlashIndex, slashIndex); + bin = editWithAST(state.ast, bin, { + ModuleImport(path) { + if (t.isGlobalType(path.node.descr)) { + const globalType = path.node.descr; - switch (folder) { - case "..": { - cd--; - if (cd < 0) - return new Error( - `Trying to access out of package scope. Requesting ${relativePath}` - ); - break; + globalType.mutability = "var"; + + const init = [ + createDefaultInitForGlobal(globalType), + t.instruction("end") + ]; + + newGlobals.push(t.global(globalType, init)); + + path.remove(); } - default: - cd++; - break; + }, + + // in order to preserve non-imported global's order we need to re-inject + // those as well + Global(path) { + const { node } = path; + const [init] = node.init; + + if (init.id === "get_global") { + node.globalType.mutability = "var"; + + const initialGlobalIdx = init.args[0]; + + node.init = [ + createDefaultInitForGlobal(node.globalType), + t.instruction("end") + ]; + + additionalInitCode.push( + /** + * get_global in global initializer only works for imported globals. + * They have the same indices as the init params, so use the + * same index. + */ + t.instruction("get_local", [initialGlobalIdx]), + t.instruction("set_global", [t.indexLiteral(newGlobals.length)]) + ); + } + + newGlobals.push(node); + + path.remove(); } + }); - lastNonSlashIndex = slashIndex + 1; - slashIndex = relativePath.indexOf("/", lastNonSlashIndex); - } + // Add global declaration instructions + return addWithAST(state.ast, bin, newGlobals); }; -exports.checkExportsFieldTarget = checkExportsFieldTarget; +/** + * Rewrite the export names + * @param {Object} state state + * @param {Object} state.ast Module's ast + * @param {Module} state.module Module + * @param {ModuleGraph} state.moduleGraph module graph + * @param {Set} state.externalExports Module + * @param {RuntimeSpec} state.runtime runtime + * @returns {ArrayBufferTransform} transform + */ +const rewriteExportNames = + ({ ast, moduleGraph, module, externalExports, runtime }) => + bin => { + return editWithAST(ast, bin, { + ModuleExport(path) { + const isExternal = externalExports.has(path.node.name); + if (isExternal) { + path.remove(); + return; + } + const usedName = moduleGraph + .getExportsInfo(module) + .getUsedName(path.node.name, runtime); + if (!usedName) { + path.remove(); + return; + } + path.node.name = usedName; + } + }); + }; -/***/ }), +/** + * Mangle import names and modules + * @param {Object} state state + * @param {Object} state.ast Module's ast + * @param {Map} state.usedDependencyMap mappings to mangle names + * @returns {ArrayBufferTransform} transform + */ +const rewriteImports = + ({ ast, usedDependencyMap }) => + bin => { + return editWithAST(ast, bin, { + ModuleImport(path) { + const result = usedDependencyMap.get( + path.node.module + ":" + path.node.name + ); -/***/ 39102: -/***/ (function(module) { + if (result !== undefined) { + path.node.module = result.module; + path.node.name = result.name; + } + } + }); + }; -"use strict"; +/** + * Add an init function. + * + * The init function fills the globals given input arguments. + * + * @param {Object} state transformation state + * @param {Object} state.ast Module's ast + * @param {t.Identifier} state.initFuncId identifier of the init function + * @param {t.Index} state.startAtFuncOffset index of the start function + * @param {t.ModuleImport[]} state.importedGlobals list of imported globals + * @param {t.Instruction[]} state.additionalInitCode list of addition instructions for the init function + * @param {t.Index} state.nextFuncIndex index of the next function + * @param {t.Index} state.nextTypeIndex index of the next type + * @returns {ArrayBufferTransform} transform + */ +const addInitFunction = + ({ + ast, + initFuncId, + startAtFuncOffset, + importedGlobals, + additionalInitCode, + nextFuncIndex, + nextTypeIndex + }) => + bin => { + const funcParams = importedGlobals.map(importedGlobal => { + // used for debugging + const id = t.identifier( + `${importedGlobal.module}.${importedGlobal.name}` + ); + return t.funcParam(importedGlobal.descr.valtype, id); + }); -class LoadingLoaderError extends Error { - constructor(message) { - super(message); - this.name = "LoaderRunnerError"; - Error.captureStackTrace(this, this.constructor); - } -} + const funcBody = []; + importedGlobals.forEach((importedGlobal, index) => { + const args = [t.indexLiteral(index)]; + const body = [ + t.instruction("get_local", args), + t.instruction("set_global", args) + ]; -module.exports = LoadingLoaderError; + funcBody.push(...body); + }); + if (typeof startAtFuncOffset === "number") { + funcBody.push( + t.callInstruction(t.numberLiteralFromRaw(startAtFuncOffset)) + ); + } -/***/ }), + for (const instr of additionalInitCode) { + funcBody.push(instr); + } -/***/ 8255: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + funcBody.push(t.instruction("end")); -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -var fs = __webpack_require__(57147); -var readFile = fs.readFile.bind(fs); -var loadLoader = __webpack_require__(44690); + const funcResults = []; -function utf8BufferToString(buf) { - var str = buf.toString("utf-8"); - if(str.charCodeAt(0) === 0xFEFF) { - return str.substr(1); - } else { - return str; - } -} + // Code section + const funcSignature = t.signature(funcParams, funcResults); + const func = t.func(initFuncId, funcSignature, funcBody); -const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/; + // Type section + const functype = t.typeInstruction(undefined, funcSignature); + + // Func section + const funcindex = t.indexInFuncSection(nextTypeIndex); + + // Export section + const moduleExport = t.moduleExport( + initFuncId.value, + t.moduleExportDescr("Func", nextFuncIndex) + ); + + return addWithAST(ast, bin, [func, moduleExport, funcindex, functype]); + }; /** - * @param {string} str the path with query and fragment - * @returns {{ path: string, query: string, fragment: string }} parsed parts + * Extract mangle mappings from module + * @param {ModuleGraph} moduleGraph module graph + * @param {Module} module current module + * @param {boolean} mangle mangle imports + * @returns {Map} mappings to mangled names */ -function parsePathQueryFragment(str) { - var match = PATH_QUERY_FRAGMENT_REGEXP.exec(str); - return { - path: match[1].replace(/\0(.)/g, "$1"), - query: match[2] ? match[2].replace(/\0(.)/g, "$1") : "", - fragment: match[3] || "" - }; -} +const getUsedDependencyMap = (moduleGraph, module, mangle) => { + /** @type {Map} */ + const map = new Map(); + for (const usedDep of WebAssemblyUtils.getUsedDependencies( + moduleGraph, + module, + mangle + )) { + const dep = usedDep.dependency; + const request = dep.request; + const exportName = dep.name; + map.set(request + ":" + exportName, usedDep); + } + return map; +}; -function dirname(path) { - if(path === "/") return "/"; - var i = path.lastIndexOf("/"); - var j = path.lastIndexOf("\\"); - var i2 = path.indexOf("/"); - var j2 = path.indexOf("\\"); - var idx = i > j ? i : j; - var idx2 = i > j ? i2 : j2; - if(idx < 0) return path; - if(idx === idx2) return path.substr(0, idx + 1); - return path.substr(0, idx); -} +const TYPES = new Set(["webassembly"]); -function createLoaderObject(loader) { - var obj = { - path: null, - query: null, - fragment: null, - options: null, - ident: null, - normal: null, - pitch: null, - raw: null, - data: null, - pitchExecuted: false, - normalExecuted: false - }; - Object.defineProperty(obj, "request", { - enumerable: true, - get: function() { - return obj.path.replace(/#/g, "\0#") + obj.query.replace(/#/g, "\0#") + obj.fragment; - }, - set: function(value) { - if(typeof value === "string") { - var splittedRequest = parsePathQueryFragment(value); - obj.path = splittedRequest.path; - obj.query = splittedRequest.query; - obj.fragment = splittedRequest.fragment; - obj.options = undefined; - obj.ident = undefined; - } else { - if(!value.loader) - throw new Error("request should be a string or object with loader and options (" + JSON.stringify(value) + ")"); - obj.path = value.loader; - obj.fragment = value.fragment || ""; - obj.type = value.type; - obj.options = value.options; - obj.ident = value.ident; - if(obj.options === null) - obj.query = ""; - else if(obj.options === undefined) - obj.query = ""; - else if(typeof obj.options === "string") - obj.query = "?" + obj.options; - else if(obj.ident) - obj.query = "??" + obj.ident; - else if(typeof obj.options === "object" && obj.options.ident) - obj.query = "??" + obj.options.ident; - else - obj.query = "?" + JSON.stringify(obj.options); - } - } - }); - obj.request = loader; - if(Object.preventExtensions) { - Object.preventExtensions(obj); +class WebAssemblyGenerator extends Generator { + constructor(options) { + super(); + this.options = options; } - return obj; -} -function runSyncOrAsync(fn, context, args, callback) { - var isSync = true; - var isDone = false; - var isError = false; // internal error - var reportedError = false; - context.async = function async() { - if(isDone) { - if(reportedError) return; // ignore - throw new Error("async(): The callback was already called."); - } - isSync = false; - return innerCallback; - }; - var innerCallback = context.callback = function() { - if(isDone) { - if(reportedError) return; // ignore - throw new Error("callback(): The callback was already called."); - } - isDone = true; - isSync = false; - try { - callback.apply(null, arguments); - } catch(e) { - isError = true; - throw e; - } - }; - try { - var result = (function LOADER_EXECUTION() { - return fn.apply(context, args); - }()); - if(isSync) { - isDone = true; - if(result === undefined) - return callback(); - if(result && typeof result === "object" && typeof result.then === "function") { - return result.then(function(r) { - callback(null, r); - }, callback); - } - return callback(null, result); - } - } catch(e) { - if(isError) throw e; - if(isDone) { - // loader is already "done", so we cannot use the callback function - // for better debugging we print the error on the console - if(typeof e === "object" && e.stack) console.error(e.stack); - else console.error(e); - return; + /** + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) + */ + getTypes(module) { + return TYPES; + } + + /** + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module + */ + getSize(module, type) { + const originalSource = module.originalSource(); + if (!originalSource) { + return 0; } - isDone = true; - reportedError = true; - callback(e); + return originalSource.size(); } -} + /** + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code + */ + generate(module, { moduleGraph, runtime }) { + const bin = module.originalSource().source(); + + const initFuncId = t.identifier(""); + + // parse it + const ast = decode(bin, { + ignoreDataSection: true, + ignoreCodeSection: true, + ignoreCustomNameSection: true + }); + + const moduleContext = moduleContextFromModuleAST(ast.body[0]); + + const importedGlobals = getImportedGlobals(ast); + const countImportedFunc = getCountImportedFunc(ast); + const startAtFuncOffset = moduleContext.getStart(); + const nextFuncIndex = getNextFuncIndex(ast, countImportedFunc); + const nextTypeIndex = getNextTypeIndex(ast); + + const usedDependencyMap = getUsedDependencyMap( + moduleGraph, + module, + this.options.mangleImports + ); + const externalExports = new Set( + module.dependencies + .filter(d => d instanceof WebAssemblyExportImportedDependency) + .map(d => { + const wasmDep = /** @type {WebAssemblyExportImportedDependency} */ ( + d + ); + return wasmDep.exportName; + }) + ); + + /** @type {t.Instruction[]} */ + const additionalInitCode = []; + + const transform = compose( + rewriteExportNames({ + ast, + moduleGraph, + module, + externalExports, + runtime + }), + + removeStartFunc({ ast }), + + rewriteImportedGlobals({ ast, additionalInitCode }), + + rewriteImports({ + ast, + usedDependencyMap + }), + + addInitFunction({ + ast, + initFuncId, + importedGlobals, + additionalInitCode, + startAtFuncOffset, + nextFuncIndex, + nextTypeIndex + }) + ); + + const newBin = transform(bin); -function convertArgs(args, raw) { - if(!raw && Buffer.isBuffer(args[0])) - args[0] = utf8BufferToString(args[0]); - else if(raw && typeof args[0] === "string") - args[0] = Buffer.from(args[0], "utf-8"); + const newBuf = Buffer.from(newBin); + + return new RawSource(newBuf); + } } -function iteratePitchingLoaders(options, loaderContext, callback) { - // abort after last loader - if(loaderContext.loaderIndex >= loaderContext.loaders.length) - return processResource(options, loaderContext, callback); +module.exports = WebAssemblyGenerator; - var currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex]; - // iterate - if(currentLoaderObject.pitchExecuted) { - loaderContext.loaderIndex++; - return iteratePitchingLoaders(options, loaderContext, callback); - } +/***/ }), - // load loader module - loadLoader(currentLoaderObject, function(err) { - if(err) { - loaderContext.cacheable(false); - return callback(err); - } - var fn = currentLoaderObject.pitch; - currentLoaderObject.pitchExecuted = true; - if(!fn) return iteratePitchingLoaders(options, loaderContext, callback); +/***/ 47342: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - runSyncOrAsync( - fn, - loaderContext, [loaderContext.remainingRequest, loaderContext.previousRequest, currentLoaderObject.data = {}], - function(err) { - if(err) return callback(err); - var args = Array.prototype.slice.call(arguments, 1); - // Determine whether to continue the pitching process based on - // argument values (as opposed to argument presence) in order - // to support synchronous and asynchronous usages. - var hasArg = args.some(function(value) { - return value !== undefined; - }); - if(hasArg) { - loaderContext.loaderIndex--; - iterateNormalLoaders(options, loaderContext, args, callback); - } else { - iteratePitchingLoaders(options, loaderContext, callback); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const WebpackError = __webpack_require__(53799); + +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../RequestShortener")} RequestShortener */ + +/** + * @param {Module} module module to get chains from + * @param {ModuleGraph} moduleGraph the module graph + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {RequestShortener} requestShortener to make readable identifiers + * @returns {string[]} all chains to the module + */ +const getInitialModuleChains = ( + module, + moduleGraph, + chunkGraph, + requestShortener +) => { + const queue = [ + { head: module, message: module.readableIdentifier(requestShortener) } + ]; + /** @type {Set} */ + const results = new Set(); + /** @type {Set} */ + const incompleteResults = new Set(); + /** @type {Set} */ + const visitedModules = new Set(); + + for (const chain of queue) { + const { head, message } = chain; + let final = true; + /** @type {Set} */ + const alreadyReferencedModules = new Set(); + for (const connection of moduleGraph.getIncomingConnections(head)) { + const newHead = connection.originModule; + if (newHead) { + if (!chunkGraph.getModuleChunks(newHead).some(c => c.canBeInitial())) + continue; + final = false; + if (alreadyReferencedModules.has(newHead)) continue; + alreadyReferencedModules.add(newHead); + const moduleName = newHead.readableIdentifier(requestShortener); + const detail = connection.explanation + ? ` (${connection.explanation})` + : ""; + const newMessage = `${moduleName}${detail} --> ${message}`; + if (visitedModules.has(newHead)) { + incompleteResults.add(`... --> ${newMessage}`); + continue; } + visitedModules.add(newHead); + queue.push({ + head: newHead, + message: newMessage + }); + } else { + final = false; + const newMessage = connection.explanation + ? `(${connection.explanation}) --> ${message}` + : message; + results.add(newMessage); } - ); - }); -} + } + if (final) { + results.add(message); + } + } + for (const result of incompleteResults) { + results.add(result); + } + return Array.from(results); +}; -function processResource(options, loaderContext, callback) { - // set loader index to last loader - loaderContext.loaderIndex = loaderContext.loaders.length - 1; +module.exports = class WebAssemblyInInitialChunkError extends WebpackError { + /** + * @param {Module} module WASM module + * @param {ModuleGraph} moduleGraph the module graph + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {RequestShortener} requestShortener request shortener + */ + constructor(module, moduleGraph, chunkGraph, requestShortener) { + const moduleChains = getInitialModuleChains( + module, + moduleGraph, + chunkGraph, + requestShortener + ); + const message = `WebAssembly module is included in initial chunk. +This is not allowed, because WebAssembly download and compilation must happen asynchronous. +Add an async split point (i. e. import()) somewhere between your entrypoint and the WebAssembly module: +${moduleChains.map(s => `* ${s}`).join("\n")}`; - var resourcePath = loaderContext.resourcePath; - if(resourcePath) { - options.processResource(loaderContext, resourcePath, function(err, buffer) { - if(err) return callback(err); - options.resourceBuffer = buffer; - iterateNormalLoaders(options, loaderContext, [buffer], callback); - }); - } else { - iterateNormalLoaders(options, loaderContext, [null], callback); + super(message); + this.name = "WebAssemblyInInitialChunkError"; + this.hideStack = true; + this.module = module; } -} +}; -function iterateNormalLoaders(options, loaderContext, args, callback) { - if(loaderContext.loaderIndex < 0) - return callback(null, args); - var currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex]; +/***/ }), - // iterate - if(currentLoaderObject.normalExecuted) { - loaderContext.loaderIndex--; - return iterateNormalLoaders(options, loaderContext, args, callback); - } +/***/ 46545: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - var fn = currentLoaderObject.normal; - currentLoaderObject.normalExecuted = true; - if(!fn) { - return iterateNormalLoaders(options, loaderContext, args, callback); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - convertArgs(args, currentLoaderObject.raw); - runSyncOrAsync(fn, loaderContext, args, function(err) { - if(err) return callback(err); - var args = Array.prototype.slice.call(arguments, 1); - iterateNormalLoaders(options, loaderContext, args, callback); - }); -} +const { RawSource } = __webpack_require__(51255); +const { UsageState } = __webpack_require__(63686); +const Generator = __webpack_require__(93401); +const InitFragment = __webpack_require__(55870); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(39722); +const ModuleDependency = __webpack_require__(80321); +const WebAssemblyExportImportedDependency = __webpack_require__(52204); +const WebAssemblyImportDependency = __webpack_require__(5239); -exports.getContext = function getContext(resource) { - var path = parsePathQueryFragment(resource).path; - return dirname(path); -}; +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -exports.runLoaders = function runLoaders(options, callback) { - // read options - var resource = options.resource || ""; - var loaders = options.loaders || []; - var loaderContext = options.context || {}; - var processResource = options.processResource || ((readResource, context, resource, callback) => { - context.addDependency(resource); - readResource(resource, callback); - }).bind(null, options.readResource || readFile); +const TYPES = new Set(["webassembly"]); - // - var splittedResource = resource && parsePathQueryFragment(resource); - var resourcePath = splittedResource ? splittedResource.path : undefined; - var resourceQuery = splittedResource ? splittedResource.query : undefined; - var resourceFragment = splittedResource ? splittedResource.fragment : undefined; - var contextDirectory = resourcePath ? dirname(resourcePath) : null; +class WebAssemblyJavascriptGenerator extends Generator { + /** + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) + */ + getTypes(module) { + return TYPES; + } - // execution state - var requestCacheable = true; - var fileDependencies = []; - var contextDependencies = []; - var missingDependencies = []; + /** + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module + */ + getSize(module, type) { + return 95 + module.dependencies.length * 5; + } - // prepare loader objects - loaders = loaders.map(createLoaderObject); + /** + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code + */ + generate(module, generateContext) { + const { + runtimeTemplate, + moduleGraph, + chunkGraph, + runtimeRequirements, + runtime + } = generateContext; + /** @type {InitFragment[]} */ + const initFragments = []; - loaderContext.context = contextDirectory; - loaderContext.loaderIndex = 0; - loaderContext.loaders = loaders; - loaderContext.resourcePath = resourcePath; - loaderContext.resourceQuery = resourceQuery; - loaderContext.resourceFragment = resourceFragment; - loaderContext.async = null; - loaderContext.callback = null; - loaderContext.cacheable = function cacheable(flag) { - if(flag === false) { - requestCacheable = false; - } - }; - loaderContext.dependency = loaderContext.addDependency = function addDependency(file) { - fileDependencies.push(file); - }; - loaderContext.addContextDependency = function addContextDependency(context) { - contextDependencies.push(context); - }; - loaderContext.addMissingDependency = function addMissingDependency(context) { - missingDependencies.push(context); - }; - loaderContext.getDependencies = function getDependencies() { - return fileDependencies.slice(); - }; - loaderContext.getContextDependencies = function getContextDependencies() { - return contextDependencies.slice(); - }; - loaderContext.getMissingDependencies = function getMissingDependencies() { - return missingDependencies.slice(); - }; - loaderContext.clearDependencies = function clearDependencies() { - fileDependencies.length = 0; - contextDependencies.length = 0; - missingDependencies.length = 0; - requestCacheable = true; - }; - Object.defineProperty(loaderContext, "resource", { - enumerable: true, - get: function() { - if(loaderContext.resourcePath === undefined) - return undefined; - return loaderContext.resourcePath.replace(/#/g, "\0#") + loaderContext.resourceQuery.replace(/#/g, "\0#") + loaderContext.resourceFragment; - }, - set: function(value) { - var splittedResource = value && parsePathQueryFragment(value); - loaderContext.resourcePath = splittedResource ? splittedResource.path : undefined; - loaderContext.resourceQuery = splittedResource ? splittedResource.query : undefined; - loaderContext.resourceFragment = splittedResource ? splittedResource.fragment : undefined; - } - }); - Object.defineProperty(loaderContext, "request", { - enumerable: true, - get: function() { - return loaderContext.loaders.map(function(o) { - return o.request; - }).concat(loaderContext.resource || "").join("!"); - } - }); - Object.defineProperty(loaderContext, "remainingRequest", { - enumerable: true, - get: function() { - if(loaderContext.loaderIndex >= loaderContext.loaders.length - 1 && !loaderContext.resource) - return ""; - return loaderContext.loaders.slice(loaderContext.loaderIndex + 1).map(function(o) { - return o.request; - }).concat(loaderContext.resource || "").join("!"); - } - }); - Object.defineProperty(loaderContext, "currentRequest", { - enumerable: true, - get: function() { - return loaderContext.loaders.slice(loaderContext.loaderIndex).map(function(o) { - return o.request; - }).concat(loaderContext.resource || "").join("!"); - } - }); - Object.defineProperty(loaderContext, "previousRequest", { - enumerable: true, - get: function() { - return loaderContext.loaders.slice(0, loaderContext.loaderIndex).map(function(o) { - return o.request; - }).join("!"); + const exportsInfo = moduleGraph.getExportsInfo(module); + + let needExportsCopy = false; + const importedModules = new Map(); + const initParams = []; + let index = 0; + for (const dep of module.dependencies) { + const moduleDep = + dep && dep instanceof ModuleDependency ? dep : undefined; + if (moduleGraph.getModule(dep)) { + let importData = importedModules.get(moduleGraph.getModule(dep)); + if (importData === undefined) { + importedModules.set( + moduleGraph.getModule(dep), + (importData = { + importVar: `m${index}`, + index, + request: (moduleDep && moduleDep.userRequest) || undefined, + names: new Set(), + reexports: [] + }) + ); + index++; + } + if (dep instanceof WebAssemblyImportDependency) { + importData.names.add(dep.name); + if (dep.description.type === "GlobalType") { + const exportName = dep.name; + const importedModule = moduleGraph.getModule(dep); + + if (importedModule) { + const usedName = moduleGraph + .getExportsInfo(importedModule) + .getUsedName(exportName, runtime); + if (usedName) { + initParams.push( + runtimeTemplate.exportFromImport({ + moduleGraph, + module: importedModule, + request: dep.request, + importVar: importData.importVar, + originModule: module, + exportName: dep.name, + asiSafe: true, + isCall: false, + callContext: null, + defaultInterop: true, + initFragments, + runtime, + runtimeRequirements + }) + ); + } + } + } + } + if (dep instanceof WebAssemblyExportImportedDependency) { + importData.names.add(dep.name); + const usedName = moduleGraph + .getExportsInfo(module) + .getUsedName(dep.exportName, runtime); + if (usedName) { + runtimeRequirements.add(RuntimeGlobals.exports); + const exportProp = `${module.exportsArgument}[${JSON.stringify( + usedName + )}]`; + const defineStatement = Template.asString([ + `${exportProp} = ${runtimeTemplate.exportFromImport({ + moduleGraph, + module: moduleGraph.getModule(dep), + request: dep.request, + importVar: importData.importVar, + originModule: module, + exportName: dep.name, + asiSafe: true, + isCall: false, + callContext: null, + defaultInterop: true, + initFragments, + runtime, + runtimeRequirements + })};`, + `if(WebAssembly.Global) ${exportProp} = ` + + `new WebAssembly.Global({ value: ${JSON.stringify( + dep.valueType + )} }, ${exportProp});` + ]); + importData.reexports.push(defineStatement); + needExportsCopy = true; + } + } + } } - }); - Object.defineProperty(loaderContext, "query", { - enumerable: true, - get: function() { - var entry = loaderContext.loaders[loaderContext.loaderIndex]; - return entry.options && typeof entry.options === "object" ? entry.options : entry.query; + const importsCode = Template.asString( + Array.from( + importedModules, + ([module, { importVar, request, reexports }]) => { + const importStatement = runtimeTemplate.importStatement({ + module, + chunkGraph, + request, + importVar, + originModule: module, + runtimeRequirements + }); + return importStatement[0] + importStatement[1] + reexports.join("\n"); + } + ) + ); + + const copyAllExports = + exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused && + !needExportsCopy; + + // need these globals + runtimeRequirements.add(RuntimeGlobals.module); + runtimeRequirements.add(RuntimeGlobals.moduleId); + runtimeRequirements.add(RuntimeGlobals.wasmInstances); + if (exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused) { + runtimeRequirements.add(RuntimeGlobals.makeNamespaceObject); + runtimeRequirements.add(RuntimeGlobals.exports); } - }); - Object.defineProperty(loaderContext, "data", { - enumerable: true, - get: function() { - return loaderContext.loaders[loaderContext.loaderIndex].data; + if (!copyAllExports) { + runtimeRequirements.add(RuntimeGlobals.exports); } - }); - // finish loader context - if(Object.preventExtensions) { - Object.preventExtensions(loaderContext); + // create source + const source = new RawSource( + [ + '"use strict";', + "// Instantiate WebAssembly module", + `var wasmExports = ${RuntimeGlobals.wasmInstances}[${module.moduleArgument}.id];`, + + exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused + ? `${RuntimeGlobals.makeNamespaceObject}(${module.exportsArgument});` + : "", + + // this must be before import for circular dependencies + "// export exports from WebAssembly module", + copyAllExports + ? `${module.moduleArgument}.exports = wasmExports;` + : "for(var name in wasmExports) " + + `if(name) ` + + `${module.exportsArgument}[name] = wasmExports[name];`, + "// exec imports from WebAssembly module (for esm order)", + importsCode, + "", + "// exec wasm module", + `wasmExports[""](${initParams.join(", ")})` + ].join("\n") + ); + return InitFragment.addToSource(source, initFragments, generateContext); } +} - var processOptions = { - resourceBuffer: null, - processResource: processResource - }; - iteratePitchingLoaders(processOptions, loaderContext, function(err, result) { - if(err) { - return callback(err, { - cacheable: requestCacheable, - fileDependencies: fileDependencies, - contextDependencies: contextDependencies, - missingDependencies: missingDependencies - }); - } - callback(null, { - result: result, - resourceBuffer: processOptions.resourceBuffer, - cacheable: requestCacheable, - fileDependencies: fileDependencies, - contextDependencies: contextDependencies, - missingDependencies: missingDependencies - }); - }); -}; +module.exports = WebAssemblyJavascriptGenerator; /***/ }), -/***/ 44690: +/***/ 53639: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -var LoaderLoadingError = __webpack_require__(39102); -var url; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -module.exports = function loadLoader(loader, callback) { - if(loader.type === "module") { - try { - if(url === undefined) url = __webpack_require__(57310); - var loaderUrl = url.pathToFileURL(loader.path); - var modulePromise = eval("import(" + JSON.stringify(loaderUrl.toString()) + ")"); - modulePromise.then(function(module) { - handleResult(loader, module, callback); - }, callback); - return; - } catch(e) { - callback(e); - } - } else { - try { - var module = require(loader.path); - } catch(e) { - // it is possible for node to choke on a require if the FD descriptor - // limit has been reached. give it a chance to recover. - if(e instanceof Error && e.code === "EMFILE") { - var retry = loadLoader.bind(null, loader, callback); - if(typeof setImmediate === "function") { - // node >= 0.9.0 - return setImmediate(retry); - } else { - // node < 0.9.0 - return process.nextTick(retry); - } - } - return callback(e); - } - return handleResult(loader, module, callback); - } -}; -function handleResult(loader, module, callback) { - if(typeof module !== "function" && typeof module !== "object") { - return callback(new LoaderLoadingError( - "Module '" + loader.path + "' is not a loader (export function or es6 module)" - )); - } - loader.normal = typeof module === "function" ? module : module.default; - loader.pitch = module.pitch; - loader.raw = module.raw; - if(typeof loader.normal !== "function" && typeof loader.pitch !== "function") { - return callback(new LoaderLoadingError( - "Module '" + loader.path + "' is not a loader (must have normal or pitch function)" - )); - } - callback(); -} +const Generator = __webpack_require__(93401); +const WebAssemblyExportImportedDependency = __webpack_require__(52204); +const WebAssemblyImportDependency = __webpack_require__(5239); +const { compareModulesByIdentifier } = __webpack_require__(29579); +const memoize = __webpack_require__(78676); +const WebAssemblyInInitialChunkError = __webpack_require__(47342); -/***/ }), +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleTemplate")} ModuleTemplate */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ -/***/ 50569: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +const getWebAssemblyGenerator = memoize(() => + __webpack_require__(47012) +); +const getWebAssemblyJavascriptGenerator = memoize(() => + __webpack_require__(46545) +); +const getWebAssemblyParser = memoize(() => __webpack_require__(57059)); -/*! - * mime-db - * Copyright(c) 2014 Jonathan Ong - * MIT Licensed - */ +class WebAssemblyModulesPlugin { + constructor(options) { + this.options = options; + } -/** - * Module exports. - */ + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "WebAssemblyModulesPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + WebAssemblyImportDependency, + normalModuleFactory + ); -module.exports = __webpack_require__(58750) + compilation.dependencyFactories.set( + WebAssemblyExportImportedDependency, + normalModuleFactory + ); + normalModuleFactory.hooks.createParser + .for("webassembly/sync") + .tap("WebAssemblyModulesPlugin", () => { + const WebAssemblyParser = getWebAssemblyParser(); -/***/ }), + return new WebAssemblyParser(); + }); -/***/ 78585: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + normalModuleFactory.hooks.createGenerator + .for("webassembly/sync") + .tap("WebAssemblyModulesPlugin", () => { + const WebAssemblyJavascriptGenerator = + getWebAssemblyJavascriptGenerator(); + const WebAssemblyGenerator = getWebAssemblyGenerator(); -"use strict"; -/*! - * mime-types - * Copyright(c) 2014 Jonathan Ong - * Copyright(c) 2015 Douglas Christopher Wilson - * MIT Licensed - */ + return Generator.byType({ + javascript: new WebAssemblyJavascriptGenerator(), + webassembly: new WebAssemblyGenerator(this.options) + }); + }); + compilation.hooks.renderManifest.tap( + "WebAssemblyModulesPlugin", + (result, options) => { + const { chunkGraph } = compilation; + const { chunk, outputOptions, codeGenerationResults } = options; + for (const module of chunkGraph.getOrderedChunkModulesIterable( + chunk, + compareModulesByIdentifier + )) { + if (module.type === "webassembly/sync") { + const filenameTemplate = + outputOptions.webassemblyModuleFilename; -/** - * Module dependencies. - * @private - */ + result.push({ + render: () => + codeGenerationResults.getSource( + module, + chunk.runtime, + "webassembly" + ), + filenameTemplate, + pathOptions: { + module, + runtime: chunk.runtime, + chunkGraph + }, + auxiliary: true, + identifier: `webassemblyModule${chunkGraph.getModuleId( + module + )}`, + hash: chunkGraph.getModuleHash(module, chunk.runtime) + }); + } + } -var db = __webpack_require__(50569) -var extname = (__webpack_require__(71017).extname) + return result; + } + ); -/** - * Module variables. - * @private - */ + compilation.hooks.afterChunks.tap("WebAssemblyModulesPlugin", () => { + const chunkGraph = compilation.chunkGraph; + const initialWasmModules = new Set(); + for (const chunk of compilation.chunks) { + if (chunk.canBeInitial()) { + for (const module of chunkGraph.getChunkModulesIterable(chunk)) { + if (module.type === "webassembly/sync") { + initialWasmModules.add(module); + } + } + } + } + for (const module of initialWasmModules) { + compilation.errors.push( + new WebAssemblyInInitialChunkError( + module, + compilation.moduleGraph, + compilation.chunkGraph, + compilation.requestShortener + ) + ); + } + }); + } + ); + } +} -var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/ -var TEXT_TYPE_REGEXP = /^text\//i +module.exports = WebAssemblyModulesPlugin; -/** - * Module exports. - * @public - */ -exports.charset = charset -exports.charsets = { lookup: charset } -exports.contentType = contentType -exports.extension = extension -exports.extensions = Object.create(null) -exports.lookup = lookup -exports.types = Object.create(null) +/***/ }), -// Populate the extensions/types maps -populateMaps(exports.extensions, exports.types) +/***/ 57059: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** - * Get the default charset for a MIME type. - * - * @param {string} type - * @return {boolean|string} - */ +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -function charset (type) { - if (!type || typeof type !== 'string') { - return false - } - // TODO: use media-typer - var match = EXTRACT_TYPE_REGEXP.exec(type) - var mime = match && db[match[1].toLowerCase()] - if (mime && mime.charset) { - return mime.charset - } +const t = __webpack_require__(51826); +const { moduleContextFromModuleAST } = __webpack_require__(51826); +const { decode } = __webpack_require__(73726); +const Parser = __webpack_require__(11715); +const StaticExportsDependency = __webpack_require__(91418); +const WebAssemblyExportImportedDependency = __webpack_require__(52204); +const WebAssemblyImportDependency = __webpack_require__(5239); - // default text/* to utf-8 - if (match && TEXT_TYPE_REGEXP.test(match[1])) { - return 'UTF-8' - } +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../Parser").ParserState} ParserState */ +/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ - return false -} +const JS_COMPAT_TYPES = new Set(["i32", "f32", "f64"]); /** - * Create a full Content-Type header given a MIME type or extension. - * - * @param {string} str - * @return {boolean|string} + * @param {t.Signature} signature the func signature + * @returns {null | string} the type incompatible with js types */ +const getJsIncompatibleType = signature => { + for (const param of signature.params) { + if (!JS_COMPAT_TYPES.has(param.valtype)) { + return `${param.valtype} as parameter`; + } + } + for (const type of signature.results) { + if (!JS_COMPAT_TYPES.has(type)) return `${type} as result`; + } + return null; +}; -function contentType (str) { - // TODO: should this even be in this module? - if (!str || typeof str !== 'string') { - return false - } +/** + * TODO why are there two different Signature types? + * @param {t.FuncSignature} signature the func signature + * @returns {null | string} the type incompatible with js types + */ +const getJsIncompatibleTypeOfFuncSignature = signature => { + for (const param of signature.args) { + if (!JS_COMPAT_TYPES.has(param)) { + return `${param} as parameter`; + } + } + for (const type of signature.result) { + if (!JS_COMPAT_TYPES.has(type)) return `${type} as result`; + } + return null; +}; - var mime = str.indexOf('/') === -1 - ? exports.lookup(str) - : str +const decoderOpts = { + ignoreCodeSection: true, + ignoreDataSection: true, - if (!mime) { - return false - } + // this will avoid having to lookup with identifiers in the ModuleContext + ignoreCustomNameSection: true +}; - // TODO: use content-type or other module - if (mime.indexOf('charset') === -1) { - var charset = exports.charset(mime) - if (charset) mime += '; charset=' + charset.toLowerCase() - } +class WebAssemblyParser extends Parser { + constructor(options) { + super(); + this.hooks = Object.freeze({}); + this.options = options; + } - return mime -} + /** + * @param {string | Buffer | PreparsedAst} source the source to parse + * @param {ParserState} state the parser state + * @returns {ParserState} the parser state + */ + parse(source, state) { + if (!Buffer.isBuffer(source)) { + throw new Error("WebAssemblyParser input must be a Buffer"); + } -/** - * Get the default extension for a MIME type. - * - * @param {string} type - * @return {boolean|string} - */ + // flag it as ESM + state.module.buildInfo.strict = true; + state.module.buildMeta.exportsType = "namespace"; -function extension (type) { - if (!type || typeof type !== 'string') { - return false - } + // parse it + const program = decode(source, decoderOpts); + const module = program.body[0]; - // TODO: use media-typer - var match = EXTRACT_TYPE_REGEXP.exec(type) + const moduleContext = moduleContextFromModuleAST(module); - // get extensions - var exts = match && exports.extensions[match[1].toLowerCase()] + // extract imports and exports + const exports = []; + let jsIncompatibleExports = (state.module.buildMeta.jsIncompatibleExports = + undefined); - if (!exts || !exts.length) { - return false - } + const importedGlobals = []; + t.traverse(module, { + ModuleExport({ node }) { + const descriptor = node.descr; - return exts[0] -} + if (descriptor.exportType === "Func") { + const funcIdx = descriptor.id.value; -/** - * Lookup the MIME type for a file path/extension. - * - * @param {string} path - * @return {boolean|string} - */ + /** @type {t.FuncSignature} */ + const funcSignature = moduleContext.getFunction(funcIdx); -function lookup (path) { - if (!path || typeof path !== 'string') { - return false - } + const incompatibleType = + getJsIncompatibleTypeOfFuncSignature(funcSignature); - // get the extension ("ext" or ".ext" or full path) - var extension = extname('x.' + path) - .toLowerCase() - .substr(1) + if (incompatibleType) { + if (jsIncompatibleExports === undefined) { + jsIncompatibleExports = + state.module.buildMeta.jsIncompatibleExports = {}; + } + jsIncompatibleExports[node.name] = incompatibleType; + } + } - if (!extension) { - return false - } + exports.push(node.name); - return exports.types[extension] || false -} + if (node.descr && node.descr.exportType === "Global") { + const refNode = importedGlobals[node.descr.id.value]; + if (refNode) { + const dep = new WebAssemblyExportImportedDependency( + node.name, + refNode.module, + refNode.name, + refNode.descr.valtype + ); -/** - * Populate the extensions and types maps. - * @private - */ + state.module.addDependency(dep); + } + } + }, -function populateMaps (extensions, types) { - // source preference (least -> most) - var preference = ['nginx', 'apache', undefined, 'iana'] + Global({ node }) { + const init = node.init[0]; - Object.keys(db).forEach(function forEachMimeType (type) { - var mime = db[type] - var exts = mime.extensions + let importNode = null; - if (!exts || !exts.length) { - return - } + if (init.id === "get_global") { + const globalIdx = init.args[0].value; - // mime -> extensions - extensions[type] = exts + if (globalIdx < importedGlobals.length) { + importNode = importedGlobals[globalIdx]; + } + } - // extension -> mime - for (var i = 0; i < exts.length; i++) { - var extension = exts[i] + importedGlobals.push(importNode); + }, + + ModuleImport({ node }) { + /** @type {false | string} */ + let onlyDirectImport = false; + + if (t.isMemory(node.descr) === true) { + onlyDirectImport = "Memory"; + } else if (t.isTable(node.descr) === true) { + onlyDirectImport = "Table"; + } else if (t.isFuncImportDescr(node.descr) === true) { + const incompatibleType = getJsIncompatibleType(node.descr.signature); + if (incompatibleType) { + onlyDirectImport = `Non-JS-compatible Func Signature (${incompatibleType})`; + } + } else if (t.isGlobalType(node.descr) === true) { + const type = node.descr.valtype; + if (!JS_COMPAT_TYPES.has(type)) { + onlyDirectImport = `Non-JS-compatible Global Type (${type})`; + } + } + + const dep = new WebAssemblyImportDependency( + node.module, + node.name, + node.descr, + onlyDirectImport + ); + + state.module.addDependency(dep); - if (types[extension]) { - var from = preference.indexOf(db[types[extension]].source) - var to = preference.indexOf(mime.source) + if (t.isGlobalType(node.descr)) { + importedGlobals.push(node); + } + } + }); - if (types[extension] !== 'application/octet-stream' && - (from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) { - // skip the remapping - continue - } - } + state.module.addDependency(new StaticExportsDependency(exports, false)); - // set the extension -> mime - types[extension] = type - } - }) + return state; + } } +module.exports = WebAssemblyParser; + /***/ }), -/***/ 76297: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 18650: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -139801,90 +139478,70 @@ function populateMaps (extensions, types) { */ -const Hook = __webpack_require__(72258); -const HookCodeFactory = __webpack_require__(177); -class AsyncParallelBailHookCodeFactory extends HookCodeFactory { - content({ onError, onResult, onDone }) { - let code = ""; - code += `var _results = new Array(${this.options.taps.length});\n`; - code += "var _checkDone = function() {\n"; - code += "for(var i = 0; i < _results.length; i++) {\n"; - code += "var item = _results[i];\n"; - code += "if(item === undefined) return false;\n"; - code += "if(item.result !== undefined) {\n"; - code += onResult("item.result"); - code += "return true;\n"; - code += "}\n"; - code += "if(item.error) {\n"; - code += onError("item.error"); - code += "return true;\n"; - code += "}\n"; - code += "}\n"; - code += "return false;\n"; - code += "}\n"; - code += this.callTapsParallel({ - onError: (i, err, done, doneBreak) => { - let code = ""; - code += `if(${i} < _results.length && ((_results.length = ${i + - 1}), (_results[${i}] = { error: ${err} }), _checkDone())) {\n`; - code += doneBreak(true); - code += "} else {\n"; - code += done(); - code += "}\n"; - return code; - }, - onResult: (i, result, done, doneBreak) => { - let code = ""; - code += `if(${i} < _results.length && (${result} !== undefined && (_results.length = ${i + - 1}), (_results[${i}] = { result: ${result} }), _checkDone())) {\n`; - code += doneBreak(true); - code += "} else {\n"; - code += done(); - code += "}\n"; - return code; - }, - onTap: (i, run, done, doneBreak) => { - let code = ""; - if (i > 0) { - code += `if(${i} >= _results.length) {\n`; - code += done(); - code += "} else {\n"; - } - code += run(); - if (i > 0) code += "}\n"; - return code; - }, - onDone - }); - return code; - } -} +const Template = __webpack_require__(39722); +const WebAssemblyImportDependency = __webpack_require__(5239); -const factory = new AsyncParallelBailHookCodeFactory(); +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; +/** @typedef {Object} UsedWasmDependency + * @property {WebAssemblyImportDependency} dependency the dependency + * @property {string} name the export name + * @property {string} module the module name + */ -function AsyncParallelBailHook(args = [], name = undefined) { - const hook = new Hook(args, name); - hook.constructor = AsyncParallelBailHook; - hook.compile = COMPILE; - hook._call = undefined; - hook.call = undefined; - return hook; -} +const MANGLED_MODULE = "a"; -AsyncParallelBailHook.prototype = null; +/** + * @param {ModuleGraph} moduleGraph the module graph + * @param {Module} module the module + * @param {boolean} mangle mangle module and export names + * @returns {UsedWasmDependency[]} used dependencies and (mangled) name + */ +const getUsedDependencies = (moduleGraph, module, mangle) => { + /** @type {UsedWasmDependency[]} */ + const array = []; + let importIndex = 0; + for (const dep of module.dependencies) { + if (dep instanceof WebAssemblyImportDependency) { + if ( + dep.description.type === "GlobalType" || + moduleGraph.getModule(dep) === null + ) { + continue; + } -module.exports = AsyncParallelBailHook; + const exportName = dep.name; + // TODO add the following 3 lines when removing of ModuleExport is possible + // const importedModule = moduleGraph.getModule(dep); + // const usedName = importedModule && moduleGraph.getExportsInfo(importedModule).getUsedName(exportName, runtime); + // if (usedName !== false) { + if (mangle) { + array.push({ + dependency: dep, + name: Template.numberToIdentifier(importIndex++), + module: MANGLED_MODULE + }); + } else { + array.push({ + dependency: dep, + name: exportName, + module: dep.request + }); + } + } + } + return array; +}; + +exports.getUsedDependencies = getUsedDependencies; +exports.MANGLED_MODULE = MANGLED_MODULE; /***/ }), -/***/ 45874: +/***/ 78613: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -139894,92 +139551,123 @@ module.exports = AsyncParallelBailHook; */ -const Hook = __webpack_require__(72258); -const HookCodeFactory = __webpack_require__(177); -class AsyncParallelHookCodeFactory extends HookCodeFactory { - content({ onError, onDone }) { - return this.callTapsParallel({ - onError: (i, err, done, doneBreak) => onError(err) + doneBreak(true), - onDone - }); - } -} +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").WasmLoadingType} WasmLoadingType */ +/** @typedef {import("../Compiler")} Compiler */ -const factory = new AsyncParallelHookCodeFactory(); +/** @type {WeakMap>} */ +const enabledTypes = new WeakMap(); -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); +const getEnabledTypes = compiler => { + let set = enabledTypes.get(compiler); + if (set === undefined) { + set = new Set(); + enabledTypes.set(compiler, set); + } + return set; }; -function AsyncParallelHook(args = [], name = undefined) { - const hook = new Hook(args, name); - hook.constructor = AsyncParallelHook; - hook.compile = COMPILE; - hook._call = undefined; - hook.call = undefined; - return hook; -} - -AsyncParallelHook.prototype = null; - -module.exports = AsyncParallelHook; - - -/***/ }), - -/***/ 13633: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - +class EnableWasmLoadingPlugin { + /** + * @param {WasmLoadingType} type library type that should be available + */ + constructor(type) { + this.type = type; + } -const Hook = __webpack_require__(72258); -const HookCodeFactory = __webpack_require__(177); + /** + * @param {Compiler} compiler the compiler instance + * @param {WasmLoadingType} type type of library + * @returns {void} + */ + static setEnabled(compiler, type) { + getEnabledTypes(compiler).add(type); + } -class AsyncSeriesBailHookCodeFactory extends HookCodeFactory { - content({ onError, onResult, resultReturns, onDone }) { - return this.callTapsSeries({ - onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), - onResult: (i, result, next) => - `if(${result} !== undefined) {\n${onResult( - result - )}\n} else {\n${next()}}\n`, - resultReturns, - onDone - }); + /** + * @param {Compiler} compiler the compiler instance + * @param {WasmLoadingType} type type of library + * @returns {void} + */ + static checkEnabled(compiler, type) { + if (!getEnabledTypes(compiler).has(type)) { + throw new Error( + `Library type "${type}" is not enabled. ` + + "EnableWasmLoadingPlugin need to be used to enable this type of wasm loading. " + + 'This usually happens through the "output.enabledWasmLoadingTypes" option. ' + + 'If you are using a function as entry which sets "wasmLoading", you need to add all potential library types to "output.enabledWasmLoadingTypes". ' + + "These types are enabled: " + + Array.from(getEnabledTypes(compiler)).join(", ") + ); + } } -} -const factory = new AsyncSeriesBailHookCodeFactory(); + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const { type } = this; -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; + // Only enable once + const enabled = getEnabledTypes(compiler); + if (enabled.has(type)) return; + enabled.add(type); -function AsyncSeriesBailHook(args = [], name = undefined) { - const hook = new Hook(args, name); - hook.constructor = AsyncSeriesBailHook; - hook.compile = COMPILE; - hook._call = undefined; - hook.call = undefined; - return hook; + if (typeof type === "string") { + switch (type) { + case "fetch": { + // TODO webpack 6 remove FetchCompileWasmPlugin + const FetchCompileWasmPlugin = __webpack_require__(35537); + const FetchCompileAsyncWasmPlugin = __webpack_require__(8437); + new FetchCompileWasmPlugin({ + mangleImports: compiler.options.optimization.mangleWasmImports + }).apply(compiler); + new FetchCompileAsyncWasmPlugin().apply(compiler); + break; + } + case "async-node": { + // TODO webpack 6 remove ReadFileCompileWasmPlugin + const ReadFileCompileWasmPlugin = __webpack_require__(98939); + // @ts-expect-error typescript bug for duplicate require + const ReadFileCompileAsyncWasmPlugin = __webpack_require__(73163); + new ReadFileCompileWasmPlugin({ + mangleImports: compiler.options.optimization.mangleWasmImports + }).apply(compiler); + new ReadFileCompileAsyncWasmPlugin({ type }).apply(compiler); + break; + } + case "async-node-module": { + // @ts-expect-error typescript bug for duplicate require + const ReadFileCompileAsyncWasmPlugin = __webpack_require__(73163); + new ReadFileCompileAsyncWasmPlugin({ type, import: true }).apply( + compiler + ); + break; + } + case "universal": + throw new Error( + "Universal WebAssembly Loading is not implemented yet" + ); + default: + throw new Error(`Unsupported wasm loading type ${type}. +Plugins which provide custom wasm loading types must call EnableWasmLoadingPlugin.setEnabled(compiler, type) to disable this error.`); + } + } else { + // TODO support plugin instances here + // apply them to the compiler + } + } } -AsyncSeriesBailHook.prototype = null; - -module.exports = AsyncSeriesBailHook; +module.exports = EnableWasmLoadingPlugin; /***/ }), -/***/ 40436: +/***/ 8437: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -139989,42 +139677,67 @@ module.exports = AsyncSeriesBailHook; */ -const Hook = __webpack_require__(72258); -const HookCodeFactory = __webpack_require__(177); -class AsyncSeriesHookCodeFactory extends HookCodeFactory { - content({ onError, onDone }) { - return this.callTapsSeries({ - onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), - onDone - }); - } -} +const RuntimeGlobals = __webpack_require__(16475); +const AsyncWasmLoadingRuntimeModule = __webpack_require__(5434); -const factory = new AsyncSeriesHookCodeFactory(); +/** @typedef {import("../Compiler")} Compiler */ -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; +class FetchCompileAsyncWasmPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "FetchCompileAsyncWasmPlugin", + compilation => { + const globalWasmLoading = compilation.outputOptions.wasmLoading; + const isEnabledForChunk = chunk => { + const options = chunk.getEntryOptions(); + const wasmLoading = + options && options.wasmLoading !== undefined + ? options.wasmLoading + : globalWasmLoading; + return wasmLoading === "fetch"; + }; + const generateLoadBinaryCode = path => + `fetch(${RuntimeGlobals.publicPath} + ${path})`; -function AsyncSeriesHook(args = [], name = undefined) { - const hook = new Hook(args, name); - hook.constructor = AsyncSeriesHook; - hook.compile = COMPILE; - hook._call = undefined; - hook.call = undefined; - return hook; + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.instantiateWasm) + .tap("FetchCompileAsyncWasmPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + const chunkGraph = compilation.chunkGraph; + if ( + !chunkGraph.hasModuleInGraph( + chunk, + m => m.type === "webassembly/async" + ) + ) { + return; + } + set.add(RuntimeGlobals.publicPath); + compilation.addRuntimeModule( + chunk, + new AsyncWasmLoadingRuntimeModule({ + generateLoadBinaryCode, + supportsStreaming: true + }) + ); + }); + } + ); + } } -AsyncSeriesHook.prototype = null; - -module.exports = AsyncSeriesHook; +module.exports = FetchCompileAsyncWasmPlugin; /***/ }), -/***/ 34656: +/***/ 35537: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -140034,42 +139747,76 @@ module.exports = AsyncSeriesHook; */ -const Hook = __webpack_require__(72258); -const HookCodeFactory = __webpack_require__(177); -class AsyncSeriesLoopHookCodeFactory extends HookCodeFactory { - content({ onError, onDone }) { - return this.callTapsLooping({ - onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), - onDone - }); - } -} +const RuntimeGlobals = __webpack_require__(16475); +const WasmChunkLoadingRuntimeModule = __webpack_require__(87394); -const factory = new AsyncSeriesLoopHookCodeFactory(); +/** @typedef {import("../Compiler")} Compiler */ -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; +// TODO webpack 6 remove -function AsyncSeriesLoopHook(args = [], name = undefined) { - const hook = new Hook(args, name); - hook.constructor = AsyncSeriesLoopHook; - hook.compile = COMPILE; - hook._call = undefined; - hook.call = undefined; - return hook; -} +class FetchCompileWasmPlugin { + constructor(options) { + this.options = options || {}; + } -AsyncSeriesLoopHook.prototype = null; + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "FetchCompileWasmPlugin", + compilation => { + const globalWasmLoading = compilation.outputOptions.wasmLoading; + const isEnabledForChunk = chunk => { + const options = chunk.getEntryOptions(); + const wasmLoading = + options && options.wasmLoading !== undefined + ? options.wasmLoading + : globalWasmLoading; + return wasmLoading === "fetch"; + }; + const generateLoadBinaryCode = path => + `fetch(${RuntimeGlobals.publicPath} + ${path})`; -module.exports = AsyncSeriesLoopHook; + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("FetchCompileWasmPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + const chunkGraph = compilation.chunkGraph; + if ( + !chunkGraph.hasModuleInGraph( + chunk, + m => m.type === "webassembly/sync" + ) + ) { + return; + } + set.add(RuntimeGlobals.moduleCache); + set.add(RuntimeGlobals.publicPath); + compilation.addRuntimeModule( + chunk, + new WasmChunkLoadingRuntimeModule({ + generateLoadBinaryCode, + supportsStreaming: true, + mangleImports: this.options.mangleImports, + runtimeRequirements: set + }) + ); + }); + } + ); + } +} + +module.exports = FetchCompileWasmPlugin; /***/ }), -/***/ 47794: +/***/ 83121: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -140079,236 +139826,591 @@ module.exports = AsyncSeriesLoopHook; */ -const Hook = __webpack_require__(72258); -const HookCodeFactory = __webpack_require__(177); -class AsyncSeriesWaterfallHookCodeFactory extends HookCodeFactory { - content({ onError, onResult, onDone }) { - return this.callTapsSeries({ - onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), - onResult: (i, result, next) => { - let code = ""; - code += `if(${result} !== undefined) {\n`; - code += `${this._args[0]} = ${result};\n`; - code += `}\n`; - code += next(); - return code; - }, - onDone: () => onResult(this._args[0]) - }); +const RuntimeGlobals = __webpack_require__(16475); +const JsonpChunkLoadingRuntimeModule = __webpack_require__(84154); + +/** @typedef {import("../Compiler")} Compiler */ + +class JsonpChunkLoadingPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "JsonpChunkLoadingPlugin", + compilation => { + const globalChunkLoading = compilation.outputOptions.chunkLoading; + const isEnabledForChunk = chunk => { + const options = chunk.getEntryOptions(); + const chunkLoading = + options && options.chunkLoading !== undefined + ? options.chunkLoading + : globalChunkLoading; + return chunkLoading === "jsonp"; + }; + const onceForChunkSet = new WeakSet(); + const handler = (chunk, set) => { + if (onceForChunkSet.has(chunk)) return; + onceForChunkSet.add(chunk); + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + set.add(RuntimeGlobals.hasOwnProperty); + compilation.addRuntimeModule( + chunk, + new JsonpChunkLoadingRuntimeModule(set) + ); + }; + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("JsonpChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadUpdateHandlers) + .tap("JsonpChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadManifest) + .tap("JsonpChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.baseURI) + .tap("JsonpChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.onChunksLoaded) + .tap("JsonpChunkLoadingPlugin", handler); + + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("JsonpChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.publicPath); + set.add(RuntimeGlobals.loadScript); + set.add(RuntimeGlobals.getChunkScriptFilename); + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadUpdateHandlers) + .tap("JsonpChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.publicPath); + set.add(RuntimeGlobals.loadScript); + set.add(RuntimeGlobals.getChunkUpdateScriptFilename); + set.add(RuntimeGlobals.moduleCache); + set.add(RuntimeGlobals.hmrModuleData); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadManifest) + .tap("JsonpChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.publicPath); + set.add(RuntimeGlobals.getUpdateManifestFilename); + }); + } + ); } } -const factory = new AsyncSeriesWaterfallHookCodeFactory(); - -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; - -function AsyncSeriesWaterfallHook(args = [], name = undefined) { - if (args.length < 1) - throw new Error("Waterfall hooks must have at least one argument"); - const hook = new Hook(args, name); - hook.constructor = AsyncSeriesWaterfallHook; - hook.compile = COMPILE; - hook._call = undefined; - hook.call = undefined; - return hook; -} - -AsyncSeriesWaterfallHook.prototype = null; - -module.exports = AsyncSeriesWaterfallHook; +module.exports = JsonpChunkLoadingPlugin; /***/ }), -/***/ 72258: +/***/ 84154: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const util = __webpack_require__(73837); -const deprecateContext = util.deprecate(() => {}, -"Hook.context is deprecated and will be removed"); +const { SyncWaterfallHook } = __webpack_require__(41242); +const Compilation = __webpack_require__(85720); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); +const chunkHasJs = (__webpack_require__(89464).chunkHasJs); +const { getInitialChunkIds } = __webpack_require__(98124); +const compileBooleanMatcher = __webpack_require__(29404); -const CALL_DELEGATE = function(...args) { - this.call = this._createCall("sync"); - return this.call(...args); -}; -const CALL_ASYNC_DELEGATE = function(...args) { - this.callAsync = this._createCall("async"); - return this.callAsync(...args); -}; -const PROMISE_DELEGATE = function(...args) { - this.promise = this._createCall("promise"); - return this.promise(...args); -}; +/** @typedef {import("../Chunk")} Chunk */ -class Hook { - constructor(args = [], name = undefined) { - this._args = args; - this.name = name; - this.taps = []; - this.interceptors = []; - this._call = CALL_DELEGATE; - this.call = CALL_DELEGATE; - this._callAsync = CALL_ASYNC_DELEGATE; - this.callAsync = CALL_ASYNC_DELEGATE; - this._promise = PROMISE_DELEGATE; - this.promise = PROMISE_DELEGATE; - this._x = undefined; +/** + * @typedef {Object} JsonpCompilationPluginHooks + * @property {SyncWaterfallHook<[string, Chunk]>} linkPreload + * @property {SyncWaterfallHook<[string, Chunk]>} linkPrefetch + */ - this.compile = this.compile; - this.tap = this.tap; - this.tapAsync = this.tapAsync; - this.tapPromise = this.tapPromise; +/** @type {WeakMap} */ +const compilationHooksMap = new WeakMap(); + +class JsonpChunkLoadingRuntimeModule extends RuntimeModule { + /** + * @param {Compilation} compilation the compilation + * @returns {JsonpCompilationPluginHooks} hooks + */ + static getCompilationHooks(compilation) { + if (!(compilation instanceof Compilation)) { + throw new TypeError( + "The 'compilation' argument must be an instance of Compilation" + ); + } + let hooks = compilationHooksMap.get(compilation); + if (hooks === undefined) { + hooks = { + linkPreload: new SyncWaterfallHook(["source", "chunk"]), + linkPrefetch: new SyncWaterfallHook(["source", "chunk"]) + }; + compilationHooksMap.set(compilation, hooks); + } + return hooks; } - compile(options) { - throw new Error("Abstract: should be overridden"); + constructor(runtimeRequirements) { + super("jsonp chunk loading", RuntimeModule.STAGE_ATTACH); + this._runtimeRequirements = runtimeRequirements; } - _createCall(type) { - return this.compile({ - taps: this.taps, - interceptors: this.interceptors, - args: this._args, - type: type - }); + /** + * @returns {string} runtime code + */ + generate() { + const { chunkGraph, compilation, chunk } = this; + const { + runtimeTemplate, + outputOptions: { + chunkLoadingGlobal, + hotUpdateGlobal, + crossOriginLoading, + scriptType + } + } = compilation; + const globalObject = runtimeTemplate.globalObject; + const { linkPreload, linkPrefetch } = + JsonpChunkLoadingRuntimeModule.getCompilationHooks(compilation); + const fn = RuntimeGlobals.ensureChunkHandlers; + const withBaseURI = this._runtimeRequirements.has(RuntimeGlobals.baseURI); + const withLoading = this._runtimeRequirements.has( + RuntimeGlobals.ensureChunkHandlers + ); + const withCallback = this._runtimeRequirements.has( + RuntimeGlobals.chunkCallback + ); + const withOnChunkLoad = this._runtimeRequirements.has( + RuntimeGlobals.onChunksLoaded + ); + const withHmr = this._runtimeRequirements.has( + RuntimeGlobals.hmrDownloadUpdateHandlers + ); + const withHmrManifest = this._runtimeRequirements.has( + RuntimeGlobals.hmrDownloadManifest + ); + const withPrefetch = this._runtimeRequirements.has( + RuntimeGlobals.prefetchChunkHandlers + ); + const withPreload = this._runtimeRequirements.has( + RuntimeGlobals.preloadChunkHandlers + ); + const chunkLoadingGlobalExpr = `${globalObject}[${JSON.stringify( + chunkLoadingGlobal + )}]`; + const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs); + const hasJsMatcher = compileBooleanMatcher(conditionMap); + const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); + + const stateExpression = withHmr + ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_jsonp` + : undefined; + + return Template.asString([ + withBaseURI + ? Template.asString([ + `${RuntimeGlobals.baseURI} = document.baseURI || self.location.href;` + ]) + : "// no baseURI", + "", + "// object to store loaded and loading chunks", + "// undefined = chunk not loaded, null = chunk preloaded/prefetched", + "// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded", + `var installedChunks = ${ + stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" + }{`, + Template.indent( + Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join( + ",\n" + ) + ), + "};", + "", + withLoading + ? Template.asString([ + `${fn}.j = ${runtimeTemplate.basicFunction( + "chunkId, promises", + hasJsMatcher !== false + ? Template.indent([ + "// JSONP chunk loading for javascript", + `var installedChunkData = ${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;`, + 'if(installedChunkData !== 0) { // 0 means "already installed".', + Template.indent([ + "", + '// a Promise means "currently loading".', + "if(installedChunkData) {", + Template.indent([ + "promises.push(installedChunkData[2]);" + ]), + "} else {", + Template.indent([ + hasJsMatcher === true + ? "if(true) { // all chunks have JS" + : `if(${hasJsMatcher("chunkId")}) {`, + Template.indent([ + "// setup Promise in chunk cache", + `var promise = new Promise(${runtimeTemplate.expressionFunction( + `installedChunkData = installedChunks[chunkId] = [resolve, reject]`, + "resolve, reject" + )});`, + "promises.push(installedChunkData[2] = promise);", + "", + "// start chunk loading", + `var url = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId);`, + "// create error before stack unwound to get useful stacktrace later", + "var error = new Error();", + `var loadingEnded = ${runtimeTemplate.basicFunction( + "event", + [ + `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId)) {`, + Template.indent([ + "installedChunkData = installedChunks[chunkId];", + "if(installedChunkData !== 0) installedChunks[chunkId] = undefined;", + "if(installedChunkData) {", + Template.indent([ + "var errorType = event && (event.type === 'load' ? 'missing' : event.type);", + "var realSrc = event && event.target && event.target.src;", + "error.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", + "error.name = 'ChunkLoadError';", + "error.type = errorType;", + "error.request = realSrc;", + "installedChunkData[1](error);" + ]), + "}" + ]), + "}" + ] + )};`, + `${RuntimeGlobals.loadScript}(url, loadingEnded, "chunk-" + chunkId, chunkId);` + ]), + "} else installedChunks[chunkId] = 0;" + ]), + "}" + ]), + "}" + ]) + : Template.indent(["installedChunks[chunkId] = 0;"]) + )};` + ]) + : "// no chunk on demand loading", + "", + withPrefetch && hasJsMatcher !== false + ? `${ + RuntimeGlobals.prefetchChunkHandlers + }.j = ${runtimeTemplate.basicFunction("chunkId", [ + `if((!${ + RuntimeGlobals.hasOwnProperty + }(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && ${ + hasJsMatcher === true ? "true" : hasJsMatcher("chunkId") + }) {`, + Template.indent([ + "installedChunks[chunkId] = null;", + linkPrefetch.call( + Template.asString([ + "var link = document.createElement('link');", + crossOriginLoading + ? `link.crossOrigin = ${JSON.stringify( + crossOriginLoading + )};` + : "", + `if (${RuntimeGlobals.scriptNonce}) {`, + Template.indent( + `link.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});` + ), + "}", + 'link.rel = "prefetch";', + 'link.as = "script";', + `link.href = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId);` + ]), + chunk + ), + "document.head.appendChild(link);" + ]), + "}" + ])};` + : "// no prefetching", + "", + withPreload && hasJsMatcher !== false + ? `${ + RuntimeGlobals.preloadChunkHandlers + }.j = ${runtimeTemplate.basicFunction("chunkId", [ + `if((!${ + RuntimeGlobals.hasOwnProperty + }(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && ${ + hasJsMatcher === true ? "true" : hasJsMatcher("chunkId") + }) {`, + Template.indent([ + "installedChunks[chunkId] = null;", + linkPreload.call( + Template.asString([ + "var link = document.createElement('link');", + scriptType + ? `link.type = ${JSON.stringify(scriptType)};` + : "", + "link.charset = 'utf-8';", + `if (${RuntimeGlobals.scriptNonce}) {`, + Template.indent( + `link.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});` + ), + "}", + 'link.rel = "preload";', + 'link.as = "script";', + `link.href = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId);`, + crossOriginLoading + ? Template.asString([ + "if (link.href.indexOf(window.location.origin + '/') !== 0) {", + Template.indent( + `link.crossOrigin = ${JSON.stringify( + crossOriginLoading + )};` + ), + "}" + ]) + : "" + ]), + chunk + ), + "document.head.appendChild(link);" + ]), + "}" + ])};` + : "// no preloaded", + "", + withHmr + ? Template.asString([ + "var currentUpdatedModulesList;", + "var waitingUpdateResolves = {};", + "function loadUpdateChunk(chunkId) {", + Template.indent([ + `return new Promise(${runtimeTemplate.basicFunction( + "resolve, reject", + [ + "waitingUpdateResolves[chunkId] = resolve;", + "// start update chunk loading", + `var url = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId);`, + "// create error before stack unwound to get useful stacktrace later", + "var error = new Error();", + `var loadingEnded = ${runtimeTemplate.basicFunction("event", [ + "if(waitingUpdateResolves[chunkId]) {", + Template.indent([ + "waitingUpdateResolves[chunkId] = undefined", + "var errorType = event && (event.type === 'load' ? 'missing' : event.type);", + "var realSrc = event && event.target && event.target.src;", + "error.message = 'Loading hot update chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", + "error.name = 'ChunkLoadError';", + "error.type = errorType;", + "error.request = realSrc;", + "reject(error);" + ]), + "}" + ])};`, + `${RuntimeGlobals.loadScript}(url, loadingEnded);` + ] + )});` + ]), + "}", + "", + `${globalObject}[${JSON.stringify( + hotUpdateGlobal + )}] = ${runtimeTemplate.basicFunction( + "chunkId, moreModules, runtime", + [ + "for(var moduleId in moreModules) {", + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, + Template.indent([ + "currentUpdate[moduleId] = moreModules[moduleId];", + "if(currentUpdatedModulesList) currentUpdatedModulesList.push(moduleId);" + ]), + "}" + ]), + "}", + "if(runtime) currentUpdateRuntime.push(runtime);", + "if(waitingUpdateResolves[chunkId]) {", + Template.indent([ + "waitingUpdateResolves[chunkId]();", + "waitingUpdateResolves[chunkId] = undefined;" + ]), + "}" + ] + )};`, + "", + Template.getFunctionContent( + require('./JavascriptHotModuleReplacement.runtime.js') + ) + .replace(/\$key\$/g, "jsonp") + .replace(/\$installedChunks\$/g, "installedChunks") + .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") + .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) + .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) + .replace( + /\$ensureChunkHandlers\$/g, + RuntimeGlobals.ensureChunkHandlers + ) + .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) + .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) + .replace( + /\$hmrDownloadUpdateHandlers\$/g, + RuntimeGlobals.hmrDownloadUpdateHandlers + ) + .replace( + /\$hmrInvalidateModuleHandlers\$/g, + RuntimeGlobals.hmrInvalidateModuleHandlers + ) + ]) + : "// no HMR", + "", + withHmrManifest + ? Template.asString([ + `${ + RuntimeGlobals.hmrDownloadManifest + } = ${runtimeTemplate.basicFunction("", [ + 'if (typeof fetch === "undefined") throw new Error("No browser support: need fetch API");', + `return fetch(${RuntimeGlobals.publicPath} + ${ + RuntimeGlobals.getUpdateManifestFilename + }()).then(${runtimeTemplate.basicFunction("response", [ + "if(response.status === 404) return; // no update available", + 'if(!response.ok) throw new Error("Failed to fetch update manifest " + response.statusText);', + "return response.json();" + ])});` + ])};` + ]) + : "// no HMR manifest", + "", + withOnChunkLoad + ? `${ + RuntimeGlobals.onChunksLoaded + }.j = ${runtimeTemplate.returningFunction( + "installedChunks[chunkId] === 0", + "chunkId" + )};` + : "// no on chunks loaded", + "", + withCallback || withLoading + ? Template.asString([ + "// install a JSONP callback for chunk loading", + `var webpackJsonpCallback = ${runtimeTemplate.basicFunction( + "parentChunkLoadingFunction, data", + [ + runtimeTemplate.destructureArray( + ["chunkIds", "moreModules", "runtime"], + "data" + ), + '// add "moreModules" to the modules object,', + '// then flag all "chunkIds" as loaded and fire callback', + "var moduleId, chunkId, i = 0;", + `if(chunkIds.some(${runtimeTemplate.returningFunction( + "installedChunks[id] !== 0", + "id" + )})) {`, + Template.indent([ + "for(moduleId in moreModules) {", + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, + Template.indent( + `${RuntimeGlobals.moduleFactories}[moduleId] = moreModules[moduleId];` + ), + "}" + ]), + "}", + "if(runtime) var result = runtime(__webpack_require__);" + ]), + "}", + "if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);", + "for(;i < chunkIds.length; i++) {", + Template.indent([ + "chunkId = chunkIds[i];", + `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) && installedChunks[chunkId]) {`, + Template.indent("installedChunks[chunkId][0]();"), + "}", + "installedChunks[chunkId] = 0;" + ]), + "}", + withOnChunkLoad + ? `return ${RuntimeGlobals.onChunksLoaded}(result);` + : "" + ] + )}`, + "", + `var chunkLoadingGlobal = ${chunkLoadingGlobalExpr} = ${chunkLoadingGlobalExpr} || [];`, + "chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));", + "chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));" + ]) + : "// no jsonp function" + ]); } +} - _tap(type, options, fn) { - if (typeof options === "string") { - options = { - name: options.trim() - }; - } else if (typeof options !== "object" || options === null) { - throw new Error("Invalid tap options"); - } - if (typeof options.name !== "string" || options.name === "") { - throw new Error("Missing name for tap"); - } - if (typeof options.context !== "undefined") { - deprecateContext(); - } - options = Object.assign({ type, fn }, options); - options = this._runRegisterInterceptors(options); - this._insert(options); - } +module.exports = JsonpChunkLoadingRuntimeModule; - tap(options, fn) { - this._tap("sync", options, fn); - } - tapAsync(options, fn) { - this._tap("async", options, fn); - } +/***/ }), - tapPromise(options, fn) { - this._tap("promise", options, fn); - } +/***/ 4607: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - _runRegisterInterceptors(options) { - for (const interceptor of this.interceptors) { - if (interceptor.register) { - const newOptions = interceptor.register(options); - if (newOptions !== undefined) { - options = newOptions; - } - } - } - return options; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - withOptions(options) { - const mergeOptions = opt => - Object.assign({}, options, typeof opt === "string" ? { name: opt } : opt); - return { - name: this.name, - tap: (opt, fn) => this.tap(mergeOptions(opt), fn), - tapAsync: (opt, fn) => this.tapAsync(mergeOptions(opt), fn), - tapPromise: (opt, fn) => this.tapPromise(mergeOptions(opt), fn), - intercept: interceptor => this.intercept(interceptor), - isUsed: () => this.isUsed(), - withOptions: opt => this.withOptions(mergeOptions(opt)) - }; - } - isUsed() { - return this.taps.length > 0 || this.interceptors.length > 0; - } +const ArrayPushCallbackChunkFormatPlugin = __webpack_require__(18535); +const EnableChunkLoadingPlugin = __webpack_require__(61291); +const JsonpChunkLoadingRuntimeModule = __webpack_require__(84154); - intercept(interceptor) { - this._resetCompilation(); - this.interceptors.push(Object.assign({}, interceptor)); - if (interceptor.register) { - for (let i = 0; i < this.taps.length; i++) { - this.taps[i] = interceptor.register(this.taps[i]); - } - } - } +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Compiler")} Compiler */ - _resetCompilation() { - this.call = this._call; - this.callAsync = this._callAsync; - this.promise = this._promise; +class JsonpTemplatePlugin { + /** + * @deprecated use JsonpChunkLoadingRuntimeModule.getCompilationHooks instead + * @param {Compilation} compilation the compilation + * @returns {JsonpChunkLoadingRuntimeModule.JsonpCompilationPluginHooks} hooks + */ + static getCompilationHooks(compilation) { + return JsonpChunkLoadingRuntimeModule.getCompilationHooks(compilation); } - _insert(item) { - this._resetCompilation(); - let before; - if (typeof item.before === "string") { - before = new Set([item.before]); - } else if (Array.isArray(item.before)) { - before = new Set(item.before); - } - let stage = 0; - if (typeof item.stage === "number") { - stage = item.stage; - } - let i = this.taps.length; - while (i > 0) { - i--; - const x = this.taps[i]; - this.taps[i + 1] = x; - const xStage = x.stage || 0; - if (before) { - if (before.has(x.name)) { - before.delete(x.name); - continue; - } - if (before.size > 0) { - continue; - } - } - if (xStage > stage) { - continue; - } - i++; - break; - } - this.taps[i] = item; + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.options.output.chunkLoading = "jsonp"; + new ArrayPushCallbackChunkFormatPlugin().apply(compiler); + new EnableChunkLoadingPlugin("jsonp").apply(compiler); } } -Object.setPrototypeOf(Hook.prototype, null); - -module.exports = Hook; +module.exports = JsonpTemplatePlugin; /***/ }), -/***/ 177: -/***/ (function(module) { +/***/ 36243: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -140317,473 +140419,514 @@ module.exports = Hook; */ -class HookCodeFactory { - constructor(config) { - this.config = config; - this.options = undefined; - this._args = undefined; - } - create(options) { - this.init(options); - let fn; - switch (this.options.type) { - case "sync": - fn = new Function( - this.args(), - '"use strict";\n' + - this.header() + - this.contentWithInterceptors({ - onError: err => `throw ${err};\n`, - onResult: result => `return ${result};\n`, - resultReturns: true, - onDone: () => "", - rethrowIfPossible: true - }) - ); - break; - case "async": - fn = new Function( - this.args({ - after: "_callback" - }), - '"use strict";\n' + - this.header() + - this.contentWithInterceptors({ - onError: err => `_callback(${err});\n`, - onResult: result => `_callback(null, ${result});\n`, - onDone: () => "_callback();\n" - }) - ); - break; - case "promise": - let errorHelperUsed = false; - const content = this.contentWithInterceptors({ - onError: err => { - errorHelperUsed = true; - return `_error(${err});\n`; - }, - onResult: result => `_resolve(${result});\n`, - onDone: () => "_resolve();\n" - }); - let code = ""; - code += '"use strict";\n'; - code += this.header(); - code += "return new Promise((function(_resolve, _reject) {\n"; - if (errorHelperUsed) { - code += "var _sync = true;\n"; - code += "function _error(_err) {\n"; - code += "if(_sync)\n"; - code += - "_resolve(Promise.resolve().then((function() { throw _err; })));\n"; - code += "else\n"; - code += "_reject(_err);\n"; - code += "};\n"; - } - code += content; - if (errorHelperUsed) { - code += "_sync = false;\n"; - } - code += "}));\n"; - fn = new Function(this.args(), code); - break; - } - this.deinit(); - return fn; - } +const util = __webpack_require__(73837); +const webpackOptionsSchemaCheck = __webpack_require__(10382); +const webpackOptionsSchema = __webpack_require__(73342); +const Compiler = __webpack_require__(70845); +const MultiCompiler = __webpack_require__(33370); +const WebpackOptionsApply = __webpack_require__(88422); +const { + applyWebpackOptionsDefaults, + applyWebpackOptionsBaseDefaults +} = __webpack_require__(92988); +const { getNormalizedWebpackOptions } = __webpack_require__(26693); +const NodeEnvironmentPlugin = __webpack_require__(7553); +const memoize = __webpack_require__(78676); - setup(instance, options) { - instance._x = options.taps.map(t => t.fn); - } +/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} WebpackOptions */ +/** @typedef {import("./Compiler").WatchOptions} WatchOptions */ +/** @typedef {import("./MultiCompiler").MultiCompilerOptions} MultiCompilerOptions */ +/** @typedef {import("./MultiStats")} MultiStats */ +/** @typedef {import("./Stats")} Stats */ - /** - * @param {{ type: "sync" | "promise" | "async", taps: Array, interceptors: Array }} options - */ - init(options) { - this.options = options; - this._args = options.args.slice(); - } +const getValidateSchema = memoize(() => __webpack_require__(12047)); - deinit() { - this.options = undefined; - this._args = undefined; - } +/** + * @template T + * @callback Callback + * @param {Error=} err + * @param {T=} stats + * @returns {void} + */ - contentWithInterceptors(options) { - if (this.options.interceptors.length > 0) { - const onError = options.onError; - const onResult = options.onResult; - const onDone = options.onDone; - let code = ""; - for (let i = 0; i < this.options.interceptors.length; i++) { - const interceptor = this.options.interceptors[i]; - if (interceptor.call) { - code += `${this.getInterceptor(i)}.call(${this.args({ - before: interceptor.context ? "_context" : undefined - })});\n`; - } - } - code += this.content( - Object.assign(options, { - onError: - onError && - (err => { - let code = ""; - for (let i = 0; i < this.options.interceptors.length; i++) { - const interceptor = this.options.interceptors[i]; - if (interceptor.error) { - code += `${this.getInterceptor(i)}.error(${err});\n`; - } - } - code += onError(err); - return code; - }), - onResult: - onResult && - (result => { - let code = ""; - for (let i = 0; i < this.options.interceptors.length; i++) { - const interceptor = this.options.interceptors[i]; - if (interceptor.result) { - code += `${this.getInterceptor(i)}.result(${result});\n`; - } - } - code += onResult(result); - return code; - }), - onDone: - onDone && - (() => { - let code = ""; - for (let i = 0; i < this.options.interceptors.length; i++) { - const interceptor = this.options.interceptors[i]; - if (interceptor.done) { - code += `${this.getInterceptor(i)}.done();\n`; - } - } - code += onDone(); - return code; - }) - }) +/** + * @param {ReadonlyArray} childOptions options array + * @param {MultiCompilerOptions} options options + * @returns {MultiCompiler} a multi-compiler + */ +const createMultiCompiler = (childOptions, options) => { + const compilers = childOptions.map(options => createCompiler(options)); + const compiler = new MultiCompiler(compilers, options); + for (const childCompiler of compilers) { + if (childCompiler.options.dependencies) { + compiler.setDependencies( + childCompiler, + childCompiler.options.dependencies ); - return code; - } else { - return this.content(options); - } - } - - header() { - let code = ""; - if (this.needContext()) { - code += "var _context = {};\n"; - } else { - code += "var _context;\n"; - } - code += "var _x = this._x;\n"; - if (this.options.interceptors.length > 0) { - code += "var _taps = this.taps;\n"; - code += "var _interceptors = this.interceptors;\n"; - } - return code; - } - - needContext() { - for (const tap of this.options.taps) if (tap.context) return true; - return false; - } - - callTap(tapIndex, { onError, onResult, onDone, rethrowIfPossible }) { - let code = ""; - let hasTapCached = false; - for (let i = 0; i < this.options.interceptors.length; i++) { - const interceptor = this.options.interceptors[i]; - if (interceptor.tap) { - if (!hasTapCached) { - code += `var _tap${tapIndex} = ${this.getTap(tapIndex)};\n`; - hasTapCached = true; - } - code += `${this.getInterceptor(i)}.tap(${ - interceptor.context ? "_context, " : "" - }_tap${tapIndex});\n`; - } - } - code += `var _fn${tapIndex} = ${this.getTapFn(tapIndex)};\n`; - const tap = this.options.taps[tapIndex]; - switch (tap.type) { - case "sync": - if (!rethrowIfPossible) { - code += `var _hasError${tapIndex} = false;\n`; - code += "try {\n"; - } - if (onResult) { - code += `var _result${tapIndex} = _fn${tapIndex}(${this.args({ - before: tap.context ? "_context" : undefined - })});\n`; - } else { - code += `_fn${tapIndex}(${this.args({ - before: tap.context ? "_context" : undefined - })});\n`; - } - if (!rethrowIfPossible) { - code += "} catch(_err) {\n"; - code += `_hasError${tapIndex} = true;\n`; - code += onError("_err"); - code += "}\n"; - code += `if(!_hasError${tapIndex}) {\n`; - } - if (onResult) { - code += onResult(`_result${tapIndex}`); - } - if (onDone) { - code += onDone(); - } - if (!rethrowIfPossible) { - code += "}\n"; - } - break; - case "async": - let cbCode = ""; - if (onResult) - cbCode += `(function(_err${tapIndex}, _result${tapIndex}) {\n`; - else cbCode += `(function(_err${tapIndex}) {\n`; - cbCode += `if(_err${tapIndex}) {\n`; - cbCode += onError(`_err${tapIndex}`); - cbCode += "} else {\n"; - if (onResult) { - cbCode += onResult(`_result${tapIndex}`); - } - if (onDone) { - cbCode += onDone(); - } - cbCode += "}\n"; - cbCode += "})"; - code += `_fn${tapIndex}(${this.args({ - before: tap.context ? "_context" : undefined, - after: cbCode - })});\n`; - break; - case "promise": - code += `var _hasResult${tapIndex} = false;\n`; - code += `var _promise${tapIndex} = _fn${tapIndex}(${this.args({ - before: tap.context ? "_context" : undefined - })});\n`; - code += `if (!_promise${tapIndex} || !_promise${tapIndex}.then)\n`; - code += ` throw new Error('Tap function (tapPromise) did not return promise (returned ' + _promise${tapIndex} + ')');\n`; - code += `_promise${tapIndex}.then((function(_result${tapIndex}) {\n`; - code += `_hasResult${tapIndex} = true;\n`; - if (onResult) { - code += onResult(`_result${tapIndex}`); - } - if (onDone) { - code += onDone(); - } - code += `}), function(_err${tapIndex}) {\n`; - code += `if(_hasResult${tapIndex}) throw _err${tapIndex};\n`; - code += onError(`_err${tapIndex}`); - code += "});\n"; - break; - } - return code; - } - - callTapsSeries({ - onError, - onResult, - resultReturns, - onDone, - doneReturns, - rethrowIfPossible - }) { - if (this.options.taps.length === 0) return onDone(); - const firstAsync = this.options.taps.findIndex(t => t.type !== "sync"); - const somethingReturns = resultReturns || doneReturns; - let code = ""; - let current = onDone; - let unrollCounter = 0; - for (let j = this.options.taps.length - 1; j >= 0; j--) { - const i = j; - const unroll = - current !== onDone && - (this.options.taps[i].type !== "sync" || unrollCounter++ > 20); - if (unroll) { - unrollCounter = 0; - code += `function _next${i}() {\n`; - code += current(); - code += `}\n`; - current = () => `${somethingReturns ? "return " : ""}_next${i}();\n`; - } - const done = current; - const doneBreak = skipDone => { - if (skipDone) return ""; - return onDone(); - }; - const content = this.callTap(i, { - onError: error => onError(i, error, done, doneBreak), - onResult: - onResult && - (result => { - return onResult(i, result, done, doneBreak); - }), - onDone: !onResult && done, - rethrowIfPossible: - rethrowIfPossible && (firstAsync < 0 || i < firstAsync) - }); - current = () => content; } - code += current(); - return code; } + return compiler; +}; - callTapsLooping({ onError, onDone, rethrowIfPossible }) { - if (this.options.taps.length === 0) return onDone(); - const syncOnly = this.options.taps.every(t => t.type === "sync"); - let code = ""; - if (!syncOnly) { - code += "var _looper = (function() {\n"; - code += "var _loopAsync = false;\n"; - } - code += "var _loop;\n"; - code += "do {\n"; - code += "_loop = false;\n"; - for (let i = 0; i < this.options.interceptors.length; i++) { - const interceptor = this.options.interceptors[i]; - if (interceptor.loop) { - code += `${this.getInterceptor(i)}.loop(${this.args({ - before: interceptor.context ? "_context" : undefined - })});\n`; +/** + * @param {WebpackOptions} rawOptions options object + * @returns {Compiler} a compiler + */ +const createCompiler = rawOptions => { + const options = getNormalizedWebpackOptions(rawOptions); + applyWebpackOptionsBaseDefaults(options); + const compiler = new Compiler(options.context, options); + new NodeEnvironmentPlugin({ + infrastructureLogging: options.infrastructureLogging + }).apply(compiler); + if (Array.isArray(options.plugins)) { + for (const plugin of options.plugins) { + if (typeof plugin === "function") { + plugin.call(compiler, compiler); + } else { + plugin.apply(compiler); } } - code += this.callTapsSeries({ - onError, - onResult: (i, result, next, doneBreak) => { - let code = ""; - code += `if(${result} !== undefined) {\n`; - code += "_loop = true;\n"; - if (!syncOnly) code += "if(_loopAsync) _looper();\n"; - code += doneBreak(true); - code += `} else {\n`; - code += next(); - code += `}\n`; - return code; - }, - onDone: - onDone && - (() => { - let code = ""; - code += "if(!_loop) {\n"; - code += onDone(); - code += "}\n"; - return code; - }), - rethrowIfPossible: rethrowIfPossible && syncOnly - }); - code += "} while(_loop);\n"; - if (!syncOnly) { - code += "_loopAsync = true;\n"; - code += "});\n"; - code += "_looper();\n"; - } - return code; } + applyWebpackOptionsDefaults(options); + compiler.hooks.environment.call(); + compiler.hooks.afterEnvironment.call(); + new WebpackOptionsApply().process(options, compiler); + compiler.hooks.initialize.call(); + return compiler; +}; - callTapsParallel({ - onError, - onResult, - onDone, - rethrowIfPossible, - onTap = (i, run) => run() - }) { - if (this.options.taps.length <= 1) { - return this.callTapsSeries({ - onError, - onResult, - onDone, - rethrowIfPossible - }); - } - let code = ""; - code += "do {\n"; - code += `var _counter = ${this.options.taps.length};\n`; - if (onDone) { - code += "var _done = (function() {\n"; - code += onDone(); - code += "});\n"; - } - for (let i = 0; i < this.options.taps.length; i++) { - const done = () => { - if (onDone) return "if(--_counter === 0) _done();\n"; - else return "--_counter;"; - }; - const doneBreak = skipDone => { - if (skipDone || !onDone) return "_counter = 0;\n"; - else return "_counter = 0;\n_done();\n"; - }; - code += "if(_counter <= 0) break;\n"; - code += onTap( - i, - () => - this.callTap(i, { - onError: error => { - let code = ""; - code += "if(_counter > 0) {\n"; - code += onError(i, error, done, doneBreak); - code += "}\n"; - return code; - }, - onResult: - onResult && - (result => { - let code = ""; - code += "if(_counter > 0) {\n"; - code += onResult(i, result, done, doneBreak); - code += "}\n"; - return code; - }), - onDone: - !onResult && - (() => { - return done(); - }), - rethrowIfPossible - }), - done, - doneBreak - ); - } - code += "} while(false);\n"; - return code; - } +/** + * @callback WebpackFunctionSingle + * @param {WebpackOptions} options options object + * @param {Callback=} callback callback + * @returns {Compiler} the compiler object + */ - args({ before, after } = {}) { - let allArgs = this._args; - if (before) allArgs = [before].concat(allArgs); - if (after) allArgs = allArgs.concat(after); - if (allArgs.length === 0) { - return ""; +/** + * @callback WebpackFunctionMulti + * @param {ReadonlyArray & MultiCompilerOptions} options options objects + * @param {Callback=} callback callback + * @returns {MultiCompiler} the multi compiler object + */ + +const asArray = options => + Array.isArray(options) ? Array.from(options) : [options]; + +const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ ( + /** + * @param {WebpackOptions | (ReadonlyArray & MultiCompilerOptions)} options options + * @param {Callback & Callback=} callback callback + * @returns {Compiler | MultiCompiler} + */ + (options, callback) => { + const create = () => { + if (!asArray(options).every(webpackOptionsSchemaCheck)) { + getValidateSchema()(webpackOptionsSchema, options); + util.deprecate( + () => {}, + "webpack bug: Pre-compiled schema reports error while real schema is happy. This has performance drawbacks.", + "DEP_WEBPACK_PRE_COMPILED_SCHEMA_INVALID" + )(); + } + /** @type {MultiCompiler|Compiler} */ + let compiler; + let watch = false; + /** @type {WatchOptions|WatchOptions[]} */ + let watchOptions; + if (Array.isArray(options)) { + /** @type {MultiCompiler} */ + compiler = createMultiCompiler( + options, + /** @type {MultiCompilerOptions} */ (options) + ); + watch = options.some(options => options.watch); + watchOptions = options.map(options => options.watchOptions || {}); + } else { + const webpackOptions = /** @type {WebpackOptions} */ (options); + /** @type {Compiler} */ + compiler = createCompiler(webpackOptions); + watch = webpackOptions.watch; + watchOptions = webpackOptions.watchOptions || {}; + } + return { compiler, watch, watchOptions }; + }; + if (callback) { + try { + const { compiler, watch, watchOptions } = create(); + if (watch) { + compiler.watch(watchOptions, callback); + } else { + compiler.run((err, stats) => { + compiler.close(err2 => { + callback(err || err2, stats); + }); + }); + } + return compiler; + } catch (err) { + process.nextTick(() => callback(err)); + return null; + } } else { - return allArgs.join(", "); + const { compiler, watch } = create(); + if (watch) { + util.deprecate( + () => {}, + "A 'callback' argument needs to be provided to the 'webpack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.", + "DEP_WEBPACK_WATCH_WITHOUT_CALLBACK" + )(); + } + return compiler; } } +); - getTapFn(idx) { - return `_x[${idx}]`; +module.exports = webpack; + + +/***/ }), + +/***/ 54182: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const StartupChunkDependenciesPlugin = __webpack_require__(22339); +const ImportScriptsChunkLoadingRuntimeModule = __webpack_require__(96952); + +/** @typedef {import("../Compiler")} Compiler */ + +class ImportScriptsChunkLoadingPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + new StartupChunkDependenciesPlugin({ + chunkLoading: "import-scripts", + asyncChunkLoading: true + }).apply(compiler); + compiler.hooks.thisCompilation.tap( + "ImportScriptsChunkLoadingPlugin", + compilation => { + const globalChunkLoading = compilation.outputOptions.chunkLoading; + const isEnabledForChunk = chunk => { + const options = chunk.getEntryOptions(); + const chunkLoading = + options && options.chunkLoading !== undefined + ? options.chunkLoading + : globalChunkLoading; + return chunkLoading === "import-scripts"; + }; + const onceForChunkSet = new WeakSet(); + const handler = (chunk, set) => { + if (onceForChunkSet.has(chunk)) return; + onceForChunkSet.add(chunk); + if (!isEnabledForChunk(chunk)) return; + const withCreateScriptUrl = !!compilation.outputOptions.trustedTypes; + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + set.add(RuntimeGlobals.hasOwnProperty); + if (withCreateScriptUrl) { + set.add(RuntimeGlobals.createScriptUrl); + } + compilation.addRuntimeModule( + chunk, + new ImportScriptsChunkLoadingRuntimeModule(set, withCreateScriptUrl) + ); + }; + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("ImportScriptsChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadUpdateHandlers) + .tap("ImportScriptsChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadManifest) + .tap("ImportScriptsChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.baseURI) + .tap("ImportScriptsChunkLoadingPlugin", handler); + + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("ImportScriptsChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.publicPath); + set.add(RuntimeGlobals.getChunkScriptFilename); + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadUpdateHandlers) + .tap("ImportScriptsChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.publicPath); + set.add(RuntimeGlobals.getChunkUpdateScriptFilename); + set.add(RuntimeGlobals.moduleCache); + set.add(RuntimeGlobals.hmrModuleData); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadManifest) + .tap("ImportScriptsChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.publicPath); + set.add(RuntimeGlobals.getUpdateManifestFilename); + }); + } + ); } +} +module.exports = ImportScriptsChunkLoadingPlugin; - getTap(idx) { - return `_taps[${idx}]`; + +/***/ }), + +/***/ 96952: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(39722); +const { + getChunkFilenameTemplate, + chunkHasJs +} = __webpack_require__(89464); +const { getInitialChunkIds } = __webpack_require__(98124); +const compileBooleanMatcher = __webpack_require__(29404); +const { getUndoPath } = __webpack_require__(82186); + +class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule { + constructor(runtimeRequirements, withCreateScriptUrl) { + super("importScripts chunk loading", RuntimeModule.STAGE_ATTACH); + this.runtimeRequirements = runtimeRequirements; + this._withCreateScriptUrl = withCreateScriptUrl; } - getInterceptor(idx) { - return `_interceptors[${idx}]`; + /** + * @returns {string} runtime code + */ + generate() { + const { + chunk, + chunkGraph, + compilation: { + runtimeTemplate, + outputOptions: { chunkLoadingGlobal, hotUpdateGlobal } + }, + _withCreateScriptUrl: withCreateScriptUrl + } = this; + const globalObject = runtimeTemplate.globalObject; + const fn = RuntimeGlobals.ensureChunkHandlers; + const withBaseURI = this.runtimeRequirements.has(RuntimeGlobals.baseURI); + const withLoading = this.runtimeRequirements.has( + RuntimeGlobals.ensureChunkHandlers + ); + const withHmr = this.runtimeRequirements.has( + RuntimeGlobals.hmrDownloadUpdateHandlers + ); + const withHmrManifest = this.runtimeRequirements.has( + RuntimeGlobals.hmrDownloadManifest + ); + const chunkLoadingGlobalExpr = `${globalObject}[${JSON.stringify( + chunkLoadingGlobal + )}]`; + const hasJsMatcher = compileBooleanMatcher( + chunkGraph.getChunkConditionMap(chunk, chunkHasJs) + ); + const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); + + const outputName = this.compilation.getPath( + getChunkFilenameTemplate(chunk, this.compilation.outputOptions), + { + chunk, + contentHashType: "javascript" + } + ); + const rootOutputDir = getUndoPath( + outputName, + this.compilation.outputOptions.path, + false + ); + + const stateExpression = withHmr + ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_importScripts` + : undefined; + + return Template.asString([ + withBaseURI + ? Template.asString([ + `${RuntimeGlobals.baseURI} = self.location + ${JSON.stringify( + rootOutputDir ? "/../" + rootOutputDir : "" + )};` + ]) + : "// no baseURI", + "", + "// object to store loaded chunks", + '// "1" means "already loaded"', + `var installedChunks = ${ + stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" + }{`, + Template.indent( + Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 1`).join( + ",\n" + ) + ), + "};", + "", + withLoading + ? Template.asString([ + "// importScripts chunk loading", + `var installChunk = ${runtimeTemplate.basicFunction("data", [ + runtimeTemplate.destructureArray( + ["chunkIds", "moreModules", "runtime"], + "data" + ), + "for(var moduleId in moreModules) {", + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, + Template.indent( + `${RuntimeGlobals.moduleFactories}[moduleId] = moreModules[moduleId];` + ), + "}" + ]), + "}", + "if(runtime) runtime(__webpack_require__);", + "while(chunkIds.length)", + Template.indent("installedChunks[chunkIds.pop()] = 1;"), + "parentChunkLoadingFunction(data);" + ])};` + ]) + : "// no chunk install function needed", + withLoading + ? Template.asString([ + `${fn}.i = ${runtimeTemplate.basicFunction( + "chunkId, promises", + hasJsMatcher !== false + ? [ + '// "1" is the signal for "already loaded"', + "if(!installedChunks[chunkId]) {", + Template.indent([ + hasJsMatcher === true + ? "if(true) { // all chunks have JS" + : `if(${hasJsMatcher("chunkId")}) {`, + Template.indent( + `importScripts(${ + withCreateScriptUrl + ? `${RuntimeGlobals.createScriptUrl}(${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId))` + : `${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId)` + });` + ), + "}" + ]), + "}" + ] + : "installedChunks[chunkId] = 1;" + )};`, + "", + `var chunkLoadingGlobal = ${chunkLoadingGlobalExpr} = ${chunkLoadingGlobalExpr} || [];`, + "var parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);", + "chunkLoadingGlobal.push = installChunk;" + ]) + : "// no chunk loading", + "", + withHmr + ? Template.asString([ + "function loadUpdateChunk(chunkId, updatedModulesList) {", + Template.indent([ + "var success = false;", + `${globalObject}[${JSON.stringify( + hotUpdateGlobal + )}] = ${runtimeTemplate.basicFunction("_, moreModules, runtime", [ + "for(var moduleId in moreModules) {", + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, + Template.indent([ + "currentUpdate[moduleId] = moreModules[moduleId];", + "if(updatedModulesList) updatedModulesList.push(moduleId);" + ]), + "}" + ]), + "}", + "if(runtime) currentUpdateRuntime.push(runtime);", + "success = true;" + ])};`, + "// start update chunk loading", + `importScripts(${ + withCreateScriptUrl + ? `${RuntimeGlobals.createScriptUrl}(${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId))` + : `${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId)` + });`, + 'if(!success) throw new Error("Loading update chunk failed for unknown reason");' + ]), + "}", + "", + Template.getFunctionContent( + require('./JavascriptHotModuleReplacement.runtime.js') + ) + .replace(/\$key\$/g, "importScrips") + .replace(/\$installedChunks\$/g, "installedChunks") + .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") + .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) + .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) + .replace( + /\$ensureChunkHandlers\$/g, + RuntimeGlobals.ensureChunkHandlers + ) + .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) + .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) + .replace( + /\$hmrDownloadUpdateHandlers\$/g, + RuntimeGlobals.hmrDownloadUpdateHandlers + ) + .replace( + /\$hmrInvalidateModuleHandlers\$/g, + RuntimeGlobals.hmrInvalidateModuleHandlers + ) + ]) + : "// no HMR", + "", + withHmrManifest + ? Template.asString([ + `${ + RuntimeGlobals.hmrDownloadManifest + } = ${runtimeTemplate.basicFunction("", [ + 'if (typeof fetch === "undefined") throw new Error("No browser support: need fetch API");', + `return fetch(${RuntimeGlobals.publicPath} + ${ + RuntimeGlobals.getUpdateManifestFilename + }()).then(${runtimeTemplate.basicFunction("response", [ + "if(response.status === 404) return; // no update available", + 'if(!response.ok) throw new Error("Failed to fetch update manifest " + response.statusText);', + "return response.json();" + ])});` + ])};` + ]) + : "// no HMR manifest" + ]); } } -module.exports = HookCodeFactory; +module.exports = ImportScriptsChunkLoadingRuntimeModule; /***/ }), -/***/ 5504: +/***/ 68693: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -140793,383 +140936,240 @@ module.exports = HookCodeFactory; */ -const util = __webpack_require__(73837); - -const defaultFactory = (key, hook) => hook; - -class HookMap { - constructor(factory, name = undefined) { - this._map = new Map(); - this.name = name; - this._factory = factory; - this._interceptors = []; - } - get(key) { - return this._map.get(key); - } +const ArrayPushCallbackChunkFormatPlugin = __webpack_require__(18535); +const EnableChunkLoadingPlugin = __webpack_require__(61291); - for(key) { - const hook = this.get(key); - if (hook !== undefined) { - return hook; - } - let newHook = this._factory(key); - const interceptors = this._interceptors; - for (let i = 0; i < interceptors.length; i++) { - newHook = interceptors[i].factory(key, newHook); - } - this._map.set(key, newHook); - return newHook; - } +/** @typedef {import("../Compiler")} Compiler */ - intercept(interceptor) { - this._interceptors.push( - Object.assign( - { - factory: defaultFactory - }, - interceptor - ) - ); +class WebWorkerTemplatePlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.options.output.chunkLoading = "import-scripts"; + new ArrayPushCallbackChunkFormatPlugin().apply(compiler); + new EnableChunkLoadingPlugin("import-scripts").apply(compiler); } } - -HookMap.prototype.tap = util.deprecate(function(key, options, fn) { - return this.for(key).tap(options, fn); -}, "HookMap#tap(key,…) is deprecated. Use HookMap#for(key).tap(…) instead."); - -HookMap.prototype.tapAsync = util.deprecate(function(key, options, fn) { - return this.for(key).tapAsync(options, fn); -}, "HookMap#tapAsync(key,…) is deprecated. Use HookMap#for(key).tapAsync(…) instead."); - -HookMap.prototype.tapPromise = util.deprecate(function(key, options, fn) { - return this.for(key).tapPromise(options, fn); -}, "HookMap#tapPromise(key,…) is deprecated. Use HookMap#for(key).tapPromise(…) instead."); - -module.exports = HookMap; +module.exports = WebWorkerTemplatePlugin; /***/ }), -/***/ 1081: +/***/ 50569: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const Hook = __webpack_require__(72258); - -class MultiHook { - constructor(hooks, name = undefined) { - this.hooks = hooks; - this.name = name; - } - - tap(options, fn) { - for (const hook of this.hooks) { - hook.tap(options, fn); - } - } - - tapAsync(options, fn) { - for (const hook of this.hooks) { - hook.tapAsync(options, fn); - } - } - - tapPromise(options, fn) { - for (const hook of this.hooks) { - hook.tapPromise(options, fn); - } - } - - isUsed() { - for (const hook of this.hooks) { - if (hook.isUsed()) return true; - } - return false; - } - - intercept(interceptor) { - for (const hook of this.hooks) { - hook.intercept(interceptor); - } - } +/*! + * mime-db + * Copyright(c) 2014 Jonathan Ong + * MIT Licensed + */ - withOptions(options) { - return new MultiHook( - this.hooks.map(h => h.withOptions(options)), - this.name - ); - } -} +/** + * Module exports. + */ -module.exports = MultiHook; +module.exports = __webpack_require__(58750) /***/ }), -/***/ 79106: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 78585: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const Hook = __webpack_require__(72258); -const HookCodeFactory = __webpack_require__(177); +/*! + * mime-types + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ -class SyncBailHookCodeFactory extends HookCodeFactory { - content({ onError, onResult, resultReturns, onDone, rethrowIfPossible }) { - return this.callTapsSeries({ - onError: (i, err) => onError(err), - onResult: (i, result, next) => - `if(${result} !== undefined) {\n${onResult( - result - )};\n} else {\n${next()}}\n`, - resultReturns, - onDone, - rethrowIfPossible - }); - } -} -const factory = new SyncBailHookCodeFactory(); -const TAP_ASYNC = () => { - throw new Error("tapAsync is not supported on a SyncBailHook"); -}; +/** + * Module dependencies. + * @private + */ -const TAP_PROMISE = () => { - throw new Error("tapPromise is not supported on a SyncBailHook"); -}; +var db = __webpack_require__(50569) +var extname = (__webpack_require__(71017).extname) -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; +/** + * Module variables. + * @private + */ -function SyncBailHook(args = [], name = undefined) { - const hook = new Hook(args, name); - hook.constructor = SyncBailHook; - hook.tapAsync = TAP_ASYNC; - hook.tapPromise = TAP_PROMISE; - hook.compile = COMPILE; - return hook; -} +var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/ +var TEXT_TYPE_REGEXP = /^text\//i -SyncBailHook.prototype = null; +/** + * Module exports. + * @public + */ -module.exports = SyncBailHook; +exports.charset = charset +exports.charsets = { lookup: charset } +exports.contentType = contentType +exports.extension = extension +exports.extensions = Object.create(null) +exports.lookup = lookup +exports.types = Object.create(null) +// Populate the extensions/types maps +populateMaps(exports.extensions, exports.types) -/***/ }), +/** + * Get the default charset for a MIME type. + * + * @param {string} type + * @return {boolean|string} + */ -/***/ 10533: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +function charset (type) { + if (!type || typeof type !== 'string') { + return false + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // TODO: use media-typer + var match = EXTRACT_TYPE_REGEXP.exec(type) + var mime = match && db[match[1].toLowerCase()] + if (mime && mime.charset) { + return mime.charset + } -const Hook = __webpack_require__(72258); -const HookCodeFactory = __webpack_require__(177); + // default text/* to utf-8 + if (match && TEXT_TYPE_REGEXP.test(match[1])) { + return 'UTF-8' + } -class SyncHookCodeFactory extends HookCodeFactory { - content({ onError, onDone, rethrowIfPossible }) { - return this.callTapsSeries({ - onError: (i, err) => onError(err), - onDone, - rethrowIfPossible - }); - } + return false } -const factory = new SyncHookCodeFactory(); - -const TAP_ASYNC = () => { - throw new Error("tapAsync is not supported on a SyncHook"); -}; - -const TAP_PROMISE = () => { - throw new Error("tapPromise is not supported on a SyncHook"); -}; +/** + * Create a full Content-Type header given a MIME type or extension. + * + * @param {string} str + * @return {boolean|string} + */ -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; +function contentType (str) { + // TODO: should this even be in this module? + if (!str || typeof str !== 'string') { + return false + } -function SyncHook(args = [], name = undefined) { - const hook = new Hook(args, name); - hook.constructor = SyncHook; - hook.tapAsync = TAP_ASYNC; - hook.tapPromise = TAP_PROMISE; - hook.compile = COMPILE; - return hook; -} + var mime = str.indexOf('/') === -1 + ? exports.lookup(str) + : str -SyncHook.prototype = null; + if (!mime) { + return false + } -module.exports = SyncHook; + // TODO: use content-type or other module + if (mime.indexOf('charset') === -1) { + var charset = exports.charset(mime) + if (charset) mime += '; charset=' + charset.toLowerCase() + } + return mime +} -/***/ }), +/** + * Get the default extension for a MIME type. + * + * @param {string} type + * @return {boolean|string} + */ -/***/ 95854: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +function extension (type) { + if (!type || typeof type !== 'string') { + return false + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // TODO: use media-typer + var match = EXTRACT_TYPE_REGEXP.exec(type) + // get extensions + var exts = match && exports.extensions[match[1].toLowerCase()] -const Hook = __webpack_require__(72258); -const HookCodeFactory = __webpack_require__(177); + if (!exts || !exts.length) { + return false + } -class SyncLoopHookCodeFactory extends HookCodeFactory { - content({ onError, onDone, rethrowIfPossible }) { - return this.callTapsLooping({ - onError: (i, err) => onError(err), - onDone, - rethrowIfPossible - }); - } + return exts[0] } -const factory = new SyncLoopHookCodeFactory(); +/** + * Lookup the MIME type for a file path/extension. + * + * @param {string} path + * @return {boolean|string} + */ -const TAP_ASYNC = () => { - throw new Error("tapAsync is not supported on a SyncLoopHook"); -}; +function lookup (path) { + if (!path || typeof path !== 'string') { + return false + } -const TAP_PROMISE = () => { - throw new Error("tapPromise is not supported on a SyncLoopHook"); -}; + // get the extension ("ext" or ".ext" or full path) + var extension = extname('x.' + path) + .toLowerCase() + .substr(1) -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; + if (!extension) { + return false + } -function SyncLoopHook(args = [], name = undefined) { - const hook = new Hook(args, name); - hook.constructor = SyncLoopHook; - hook.tapAsync = TAP_ASYNC; - hook.tapPromise = TAP_PROMISE; - hook.compile = COMPILE; - return hook; + return exports.types[extension] || false } -SyncLoopHook.prototype = null; - -module.exports = SyncLoopHook; - - -/***/ }), - -/***/ 60176: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** + * Populate the extensions and types maps. + * @private + */ +function populateMaps (extensions, types) { + // source preference (least -> most) + var preference = ['nginx', 'apache', undefined, 'iana'] -const Hook = __webpack_require__(72258); -const HookCodeFactory = __webpack_require__(177); + Object.keys(db).forEach(function forEachMimeType (type) { + var mime = db[type] + var exts = mime.extensions -class SyncWaterfallHookCodeFactory extends HookCodeFactory { - content({ onError, onResult, resultReturns, rethrowIfPossible }) { - return this.callTapsSeries({ - onError: (i, err) => onError(err), - onResult: (i, result, next) => { - let code = ""; - code += `if(${result} !== undefined) {\n`; - code += `${this._args[0]} = ${result};\n`; - code += `}\n`; - code += next(); - return code; - }, - onDone: () => onResult(this._args[0]), - doneReturns: resultReturns, - rethrowIfPossible - }); - } -} + if (!exts || !exts.length) { + return + } -const factory = new SyncWaterfallHookCodeFactory(); + // mime -> extensions + extensions[type] = exts -const TAP_ASYNC = () => { - throw new Error("tapAsync is not supported on a SyncWaterfallHook"); -}; + // extension -> mime + for (var i = 0; i < exts.length; i++) { + var extension = exts[i] -const TAP_PROMISE = () => { - throw new Error("tapPromise is not supported on a SyncWaterfallHook"); -}; + if (types[extension]) { + var from = preference.indexOf(db[types[extension]].source) + var to = preference.indexOf(mime.source) -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; + if (types[extension] !== 'application/octet-stream' && + (from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) { + // skip the remapping + continue + } + } -function SyncWaterfallHook(args = [], name = undefined) { - if (args.length < 1) - throw new Error("Waterfall hooks must have at least one argument"); - const hook = new Hook(args, name); - hook.constructor = SyncWaterfallHook; - hook.tapAsync = TAP_ASYNC; - hook.tapPromise = TAP_PROMISE; - hook.compile = COMPILE; - return hook; + // set the extension -> mime + types[extension] = type + } + }) } -SyncWaterfallHook.prototype = null; - -module.exports = SyncWaterfallHook; - - -/***/ }), - -/***/ 6967: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -exports.__esModule = true; -exports.SyncHook = __webpack_require__(10533); -exports.SyncBailHook = __webpack_require__(79106); -exports.SyncWaterfallHook = __webpack_require__(60176); -exports.SyncLoopHook = __webpack_require__(95854); -exports.AsyncParallelHook = __webpack_require__(45874); -exports.AsyncParallelBailHook = __webpack_require__(76297); -exports.AsyncSeriesHook = __webpack_require__(40436); -exports.AsyncSeriesBailHook = __webpack_require__(13633); -exports.AsyncSeriesLoopHook = __webpack_require__(34656); -exports.AsyncSeriesWaterfallHook = __webpack_require__(47794); -exports.HookMap = __webpack_require__(5504); -exports.MultiHook = __webpack_require__(1081); - /***/ }), diff --git a/packages/next/package.json b/packages/next/package.json index ec8306abc3115a2..d6f6742520defc2 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -239,7 +239,7 @@ "querystring-es3": "0.2.1", "raw-body": "2.4.1", "react-is": "17.0.2", - "react-refresh": "0.8.3", + "react-refresh": "0.12.0", "react-server-dom-webpack": "0.0.0-experimental-577f2de46-20220320", "regenerator-runtime": "0.13.4", "sass-loader": "12.4.0", diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json index e9d6b69a68e3d6f..78a09006d82a907 100644 --- a/packages/react-refresh-utils/package.json +++ b/packages/react-refresh-utils/package.json @@ -19,7 +19,7 @@ "dev": "tsc -d -w -p tsconfig.json" }, "peerDependencies": { - "react-refresh": "0.8.3", + "react-refresh": "0.12.0", "webpack": "^4 || ^5" }, "peerDependenciesMeta": { @@ -28,6 +28,6 @@ } }, "devDependencies": { - "react-refresh": "0.8.3" + "react-refresh": "0.12.0" } } diff --git a/yarn.lock b/yarn.lock index d877bd8e6b7eee7..3720f64a30b9c45 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17821,10 +17821,10 @@ react-lifecycles-compat@^3.0.4: resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362" integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA== -react-refresh@0.8.3: - version "0.8.3" - resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.8.3.tgz#721d4657672d400c5e3c75d063c4a85fb2d5d68f" - integrity sha512-X8jZHc7nCMjaCqoU+V2I0cOhNW+QMBwSUkeXnTi8IPe6zaRWfn60ZzvFDZqWPfmSJfjub7dDW1SP0jaHWLu/hg== +react-refresh@0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.12.0.tgz#28ac0a2c30ef2bb3433d5fd0621e69a6d774c3a4" + integrity sha512-suLIhrU2IHKL5JEKR/fAwJv7bbeq4kJ+pJopf77jHwuR+HmJS/HbrPIGsTBUVfw7tXPOmYv7UJ7PCaN49e8x4A== react-server-dom-webpack@0.0.0-experimental-577f2de46-20220320: version "0.0.0-experimental-577f2de46-20220320" From efacbc544c9e53399df7144c906d438b495acb9a Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Wed, 30 Mar 2022 10:50:09 +0200 Subject: [PATCH 04/15] update compiled --- .../babel-packages/packages-bundle.js | 149 +- packages/next/compiled/webpack/bundle5.js | 224756 +++++++-------- 2 files changed, 112415 insertions(+), 112490 deletions(-) diff --git a/packages/next/compiled/babel-packages/packages-bundle.js b/packages/next/compiled/babel-packages/packages-bundle.js index 2e08e4b794c84ed..bb4d6b512b29600 100644 --- a/packages/next/compiled/babel-packages/packages-bundle.js +++ b/packages/next/compiled/babel-packages/packages-bundle.js @@ -1,15 +1,15 @@ -(()=>{var e={7548:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.codeFrameColumns=codeFrameColumns;t["default"]=_default;var s=_interopRequireWildcard(r(2421));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}let a=false;function getDefs(e){return{gutter:e.grey,marker:e.red.bold,message:e.red.bold}}const n=/\r\n|[\n\r\u2028\u2029]/;function getMarkerLines(e,t,r){const s=Object.assign({column:0,line:-1},e.start);const a=Object.assign({},s,e.end);const{linesAbove:n=2,linesBelow:o=3}=r||{};const i=s.line;const l=s.column;const c=a.line;const u=a.column;let p=Math.max(i-(n+1),0);let d=Math.min(t.length,c+o);if(i===-1){p=0}if(c===-1){d=t.length}const f=c-i;const m={};if(f){for(let e=0;e<=f;e++){const r=e+i;if(!l){m[r]=true}else if(e===0){const e=t[r-1].length;m[r]=[l,e-l+1]}else if(e===f){m[r]=[0,u]}else{const s=t[r-e].length;m[r]=[0,s]}}}else{if(l===u){if(l){m[i]=[l,0]}else{m[i]=true}}else{m[i]=[l,u-l]}}return{start:p,end:d,markerLines:m}}function codeFrameColumns(e,t,r={}){const a=(r.highlightCode||r.forceColor)&&(0,s.shouldHighlight)(r);const o=(0,s.getChalk)(r);const i=getDefs(o);const maybeHighlight=(e,t)=>a?e(t):t;const l=e.split(n);const{start:c,end:u,markerLines:p}=getMarkerLines(t,l,r);const d=t.start&&typeof t.start.column==="number";const f=String(u).length;const m=a?(0,s.default)(e,r):e;let y=m.split(n).slice(c,u).map(((e,t)=>{const s=c+1+t;const a=` ${s}`.slice(-f);const n=` ${a} | `;const o=p[s];const l=!p[s+1];if(o){let t="";if(Array.isArray(o)){const s=e.slice(0,Math.max(o[0]-1,0)).replace(/[^\t]/g," ");const a=o[1]||1;t=["\n ",maybeHighlight(i.gutter,n.replace(/\d/g," ")),s,maybeHighlight(i.marker,"^").repeat(a)].join("");if(l&&r.message){t+=" "+maybeHighlight(i.message,r.message)}}return[maybeHighlight(i.marker,">"),maybeHighlight(i.gutter,n),e,t].join("")}else{return` ${maybeHighlight(i.gutter,n)}${e}`}})).join("\n");if(r.message&&!d){y=`${" ".repeat(f+1)}${r.message}\n${y}`}if(a){return o.reset(y)}else{return y}}function _default(e,t,r,s={}){if(!a){a=true;const e="Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";if(process.emitWarning){process.emitWarning(e,"DeprecationWarning")}else{const t=new Error(e);t.name="DeprecationWarning";console.warn(new Error(e))}}r=Math.max(r,0);const n={start:{column:r,line:t}};return codeFrameColumns(e,n,s)}},7043:(e,t,r)=>{e.exports=r(5619)},2119:(e,t,r)=>{e.exports=r(7286)},1498:(e,t,r)=>{"use strict";const s=r(3654);const a=Object.freeze(Object.keys(s));for(const e of a){Object.freeze(s[e])}Object.freeze(s);const n=new Set(["parent","leadingComments","trailingComments"]);function filterKey(e){return!n.has(e)&&e[0]!=="_"}e.exports=Object.freeze({KEYS:s,getKeys(e){return Object.keys(e).filter(filterKey)},unionWith(e){const t=Object.assign({},s);for(const r of Object.keys(e)){if(t.hasOwnProperty(r)){const s=new Set(e[r]);for(const e of t[r]){s.add(e)}t[r]=Object.freeze(Array.from(s))}else{t[r]=Object.freeze(Array.from(e[r]))}}return Object.freeze(t)}})},2155:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=annotateAsPure;var s=r(8622);const a="#__PURE__";const isPureAnnotated=({leadingComments:e})=>!!e&&e.some((e=>/[@#]__PURE__/.test(e.value)));function annotateAsPure(e){const t=e["node"]||e;if(isPureAnnotated(t)){return}s.addComment(t,"leading",a)}},6951:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(3223);var a=r(8622);function _default(e){const{build:t,operator:r}=e;return{AssignmentExpression(e){const{node:n,scope:o}=e;if(n.operator!==r+"=")return;const i=[];const l=(0,s.default)(n.left,i,this,o);i.push(a.assignmentExpression("=",l.ref,t(l.uid,n.right)));e.replaceWith(a.sequenceExpression(i))},BinaryExpression(e){const{node:s}=e;if(s.operator===r){e.replaceWith(t(s.left,s.right))}}}}},9750:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getInclusionReasons=getInclusionReasons;var s=r(7849);var a=r(4794);var n=r(3406);function getInclusionReasons(e,t,r){const o=r[e]||{};return Object.keys(t).reduce(((e,r)=>{const i=(0,n.getLowestImplementedVersion)(o,r);const l=t[r];if(!i){e[r]=(0,a.prettifyVersion)(l)}else{const t=(0,n.isUnreleasedVersion)(i,r);const o=(0,n.isUnreleasedVersion)(l,r);if(!o&&(t||s.lt(l.toString(),(0,n.semverify)(i)))){e[r]=(0,a.prettifyVersion)(l)}}return e}),{})}},9578:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.targetsSupported=targetsSupported;t.isRequired=isRequired;t["default"]=filterItems;var s=r(7849);var a=r(2119);var n=r(3406);function targetsSupported(e,t){const r=Object.keys(e);if(r.length===0){return false}const a=r.filter((r=>{const a=(0,n.getLowestImplementedVersion)(t,r);if(!a){return true}const o=e[r];if((0,n.isUnreleasedVersion)(o,r)){return false}if((0,n.isUnreleasedVersion)(a,r)){return true}if(!s.valid(o.toString())){throw new Error(`Invalid version passed for target "${r}": "${o}". `+"Versions must be in semver format (major.minor.patch)")}return s.gt((0,n.semverify)(a),o.toString())}));return a.length===0}function isRequired(e,t,{compatData:r=a,includes:s,excludes:n}={}){if(n!=null&&n.has(e))return false;if(s!=null&&s.has(e))return true;return!targetsSupported(t,r[e])}function filterItems(e,t,r,s,a,n,o){const i=new Set;const l={compatData:e,includes:t,excludes:r};for(const t in e){if(isRequired(t,s,l)){i.add(t)}else if(o){const e=o.get(t);if(e){i.add(e)}}}if(a){a.forEach((e=>!r.has(e)&&i.add(e)))}if(n){n.forEach((e=>!t.has(e)&&i.delete(e)))}return i}},797:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isBrowsersQueryValid=isBrowsersQueryValid;t["default"]=getTargets;Object.defineProperty(t,"unreleasedLabels",{enumerable:true,get:function(){return i.unreleasedLabels}});Object.defineProperty(t,"TargetNames",{enumerable:true,get:function(){return l.TargetNames}});Object.defineProperty(t,"prettifyTargets",{enumerable:true,get:function(){return c.prettifyTargets}});Object.defineProperty(t,"getInclusionReasons",{enumerable:true,get:function(){return u.getInclusionReasons}});Object.defineProperty(t,"filterItems",{enumerable:true,get:function(){return p.default}});Object.defineProperty(t,"isRequired",{enumerable:true,get:function(){return p.isRequired}});var s=r(4907);var a=r(7347);var n=r(7043);var o=r(3406);var i=r(6555);var l=r(5748);var c=r(4794);var u=r(9750);var p=r(9578);const d=n["es6.module"];const f=new a.OptionValidator("@babel/helper-compilation-targets");function validateTargetNames(e){const t=Object.keys(l.TargetNames);for(const r of Object.keys(e)){if(!(r in l.TargetNames)){throw new Error(f.formatMessage(`'${r}' is not a valid target\n- Did you mean '${(0,a.findSuggestion)(r,t)}'?`))}}return e}function isBrowsersQueryValid(e){return typeof e==="string"||Array.isArray(e)&&e.every((e=>typeof e==="string"))}function validateBrowsers(e){f.invariant(e===undefined||isBrowsersQueryValid(e),`'${String(e)}' is not a valid browserslist query`);return e}function getLowestVersions(e){return e.reduce(((e,t)=>{const[r,s]=t.split(" ");const a=i.browserNameMap[r];if(!a){return e}try{const t=s.split("-")[0].toLowerCase();const n=(0,o.isUnreleasedVersion)(t,r);if(!e[a]){e[a]=n?t:(0,o.semverify)(t);return e}const i=e[a];const l=(0,o.isUnreleasedVersion)(i,r);if(l&&n){e[a]=(0,o.getLowestUnreleased)(i,t,r)}else if(l){e[a]=(0,o.semverify)(t)}else if(!l&&!n){const r=(0,o.semverify)(t);e[a]=(0,o.semverMin)(i,r)}}catch(e){}return e}),{})}function outputDecimalWarning(e){if(!e.length){return}console.warn("Warning, the following targets are using a decimal version:\n");e.forEach((({target:e,value:t})=>console.warn(` ${e}: ${t}`)));console.warn(`\nWe recommend using a string for minor/patch versions to avoid numbers like 6.10\ngetting parsed as 6.1, which can lead to unexpected behavior.\n`)}function semverifyTarget(e,t){try{return(0,o.semverify)(t)}catch(r){throw new Error(f.formatMessage(`'${t}' is not a valid value for 'targets.${e}'.`))}}const m={__default(e,t){const r=(0,o.isUnreleasedVersion)(t,e)?t.toLowerCase():semverifyTarget(e,t);return[e,r]},node(e,t){const r=t===true||t==="current"?process.versions.node:semverifyTarget(e,t);return[e,r]}};function generateTargets(e){const t=Object.assign({},e);delete t.esmodules;delete t.browsers;return t}function resolveTargets(e){const t=s(e,{mobileToDesktop:true});return getLowestVersions(t)}function getTargets(e={},t={}){var r;let{browsers:a,esmodules:n}=e;const{configPath:i="."}=t;validateBrowsers(a);const l=generateTargets(e);let c=validateTargetNames(l);const u=!!a;const p=u||Object.keys(c).length>0;const f=!t.ignoreBrowserslistConfig&&!p;if(!a&&f){a=s.loadConfig({config:t.configFile,path:i,env:t.browserslistEnv});if(a==null){{a=[]}}}if(n&&(n!=="intersect"||!((r=a)!=null&&r.length))){a=Object.keys(d).map((e=>`${e} >= ${d[e]}`)).join(", ");n=false}if(a){const e=resolveTargets(a);if(n==="intersect"){for(const t of Object.keys(e)){const r=e[t];if(d[t]){e[t]=(0,o.getHighestUnreleased)(r,(0,o.semverify)(d[t]),t)}else{delete e[t]}}}c=Object.assign(e,c)}const y={};const g=[];for(const e of Object.keys(c).sort()){var h;const t=c[e];if(typeof t==="number"&&t%1!==0){g.push({target:e,value:t})}const r=(h=m[e])!=null?h:m.__default;const[s,a]=r(e,t);if(a){y[s]=a}}outputDecimalWarning(g);return y}},5748:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.TargetNames=void 0;const r={node:"node",chrome:"chrome",opera:"opera",edge:"edge",firefox:"firefox",safari:"safari",ie:"ie",ios:"ios",android:"android",electron:"electron",samsung:"samsung"};t.TargetNames=r},4794:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.prettifyVersion=prettifyVersion;t.prettifyTargets=prettifyTargets;var s=r(7849);var a=r(6555);function prettifyVersion(e){if(typeof e!=="string"){return e}const t=[s.major(e)];const r=s.minor(e);const a=s.patch(e);if(r||a){t.push(r)}if(a){t.push(a)}return t.join(".")}function prettifyTargets(e){return Object.keys(e).reduce(((t,r)=>{let s=e[r];const n=a.unreleasedLabels[r];if(typeof s==="string"&&n!==s){s=prettifyVersion(s)}t[r]=s;return t}),{})}},6555:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.browserNameMap=t.unreleasedLabels=void 0;const r={safari:"tp"};t.unreleasedLabels=r;const s={and_chr:"chrome",and_ff:"firefox",android:"android",chrome:"chrome",edge:"edge",firefox:"firefox",ie:"ie",ie_mob:"ie",ios_saf:"ios",node:"node",op_mob:"opera",opera:"opera",safari:"safari",samsung:"samsung"};t.browserNameMap=s},3406:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.semverMin=semverMin;t.semverify=semverify;t.isUnreleasedVersion=isUnreleasedVersion;t.getLowestUnreleased=getLowestUnreleased;t.getHighestUnreleased=getHighestUnreleased;t.getLowestImplementedVersion=getLowestImplementedVersion;var s=r(7849);var a=r(7347);var n=r(6555);const o=/^(\d+|\d+.\d+)$/;const i=new a.OptionValidator("@babel/helper-compilation-targets");function semverMin(e,t){return e&&s.lt(e,t)?e:t}function semverify(e){if(typeof e==="string"&&s.valid(e)){return e}i.invariant(typeof e==="number"||typeof e==="string"&&o.test(e),`'${e}' is not a valid version`);const t=e.toString().split(".");while(t.length<3){t.push("0")}return t.join(".")}function isUnreleasedVersion(e,t){const r=n.unreleasedLabels[t];return!!r&&r===e.toString().toLowerCase()}function getLowestUnreleased(e,t,r){const s=n.unreleasedLabels[r];const a=[e,t].some((e=>e===s));if(a){return e===a?t:e||t}return semverMin(e,t)}function getHighestUnreleased(e,t,r){return getLowestUnreleased(e,t,r)===e?t:e}function getLowestImplementedVersion(e,t){const r=e[t];if(!r&&t==="android"){return e.chrome}return r}},6429:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasOwnDecorators=hasOwnDecorators;t.hasDecorators=hasDecorators;t.buildDecoratedClass=buildDecoratedClass;var s=r(8304);var a=r(6833);var n=r(550);function hasOwnDecorators(e){return!!(e.decorators&&e.decorators.length)}function hasDecorators(e){return hasOwnDecorators(e)||e.body.body.some(hasOwnDecorators)}function prop(e,t){if(!t)return null;return s.types.objectProperty(s.types.identifier(e),t)}function method(e,t){return s.types.objectMethod("method",s.types.identifier(e),[],s.types.blockStatement(t))}function takeDecorators(e){let t;if(e.decorators&&e.decorators.length>0){t=s.types.arrayExpression(e.decorators.map((e=>e.expression)))}e.decorators=undefined;return t}function getKey(e){if(e.computed){return e.key}else if(s.types.isIdentifier(e.key)){return s.types.stringLiteral(e.key.name)}else{return s.types.stringLiteral(String(e.key.value))}}function extractElementDescriptor(e,t,r){const{node:o,scope:i}=r;const l=r.isClassMethod();if(r.isPrivate()){throw r.buildCodeFrameError(`Private ${l?"methods":"fields"} in decorated classes are not supported yet.`)}new a.default({methodPath:r,objectRef:e,superRef:t,file:this,refToPreserve:e}).replace();const c=[prop("kind",s.types.stringLiteral(l?o.kind:"field")),prop("decorators",takeDecorators(o)),prop("static",o.static&&s.types.booleanLiteral(true)),prop("key",getKey(o))].filter(Boolean);if(l){const e=o.computed?null:o.key;s.types.toExpression(o);c.push(prop("value",(0,n.default)({node:o,id:e,scope:i})||o))}else if(o.value){c.push(method("value",s.template.statements.ast`return ${o.value}`))}else{c.push(prop("value",i.buildUndefinedNode()))}r.remove();return s.types.objectExpression(c)}function addDecorateHelper(e){try{return e.addHelper("decorate")}catch(e){if(e.code==="BABEL_HELPER_UNKNOWN"){e.message+="\n '@babel/plugin-transform-decorators' in non-legacy mode"+" requires '@babel/core' version ^7.0.2 and you appear to be using"+" an older version."}throw e}}function buildDecoratedClass(e,t,r,a){const{node:n,scope:o}=t;const i=o.generateUidIdentifier("initialize");const l=n.id&&t.isDeclaration();const c=t.isInStrictMode();const{superClass:u}=n;n.type="ClassDeclaration";if(!n.id)n.id=s.types.cloneNode(e);let p;if(u){p=o.generateUidIdentifierBasedOnNode(n.superClass,"super");n.superClass=p}const d=takeDecorators(n);const f=s.types.arrayExpression(r.filter((e=>!e.node.abstract)).map(extractElementDescriptor.bind(a,n.id,p)));const m=s.template.expression.ast` +(()=>{var e={7043:(e,t,r)=>{e.exports=r(5619)},2119:(e,t,r)=>{e.exports=r(7286)},1498:(e,t,r)=>{"use strict";const s=r(3654);const a=Object.freeze(Object.keys(s));for(const e of a){Object.freeze(s[e])}Object.freeze(s);const n=new Set(["parent","leadingComments","trailingComments"]);function filterKey(e){return!n.has(e)&&e[0]!=="_"}e.exports=Object.freeze({KEYS:s,getKeys(e){return Object.keys(e).filter(filterKey)},unionWith(e){const t=Object.assign({},s);for(const r of Object.keys(e)){if(t.hasOwnProperty(r)){const s=new Set(e[r]);for(const e of t[r]){s.add(e)}t[r]=Object.freeze(Array.from(s))}else{t[r]=Object.freeze(Array.from(e[r]))}}return Object.freeze(t)}})},2155:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=annotateAsPure;var s=r(8622);const a="#__PURE__";const isPureAnnotated=({leadingComments:e})=>!!e&&e.some((e=>/[@#]__PURE__/.test(e.value)));function annotateAsPure(e){const t=e["node"]||e;if(isPureAnnotated(t)){return}s.addComment(t,"leading",a)}},6951:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(3223);var a=r(8622);function _default(e){const{build:t,operator:r}=e;return{AssignmentExpression(e){const{node:n,scope:o}=e;if(n.operator!==r+"=")return;const i=[];const l=(0,s.default)(n.left,i,this,o);i.push(a.assignmentExpression("=",l.ref,t(l.uid,n.right)));e.replaceWith(a.sequenceExpression(i))},BinaryExpression(e){const{node:s}=e;if(s.operator===r){e.replaceWith(t(s.left,s.right))}}}}},9750:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getInclusionReasons=getInclusionReasons;var s=r(7849);var a=r(4794);var n=r(3406);function getInclusionReasons(e,t,r){const o=r[e]||{};return Object.keys(t).reduce(((e,r)=>{const i=(0,n.getLowestImplementedVersion)(o,r);const l=t[r];if(!i){e[r]=(0,a.prettifyVersion)(l)}else{const t=(0,n.isUnreleasedVersion)(i,r);const o=(0,n.isUnreleasedVersion)(l,r);if(!o&&(t||s.lt(l.toString(),(0,n.semverify)(i)))){e[r]=(0,a.prettifyVersion)(l)}}return e}),{})}},9578:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.targetsSupported=targetsSupported;t.isRequired=isRequired;t["default"]=filterItems;var s=r(7849);var a=r(2119);var n=r(3406);function targetsSupported(e,t){const r=Object.keys(e);if(r.length===0){return false}const a=r.filter((r=>{const a=(0,n.getLowestImplementedVersion)(t,r);if(!a){return true}const o=e[r];if((0,n.isUnreleasedVersion)(o,r)){return false}if((0,n.isUnreleasedVersion)(a,r)){return true}if(!s.valid(o.toString())){throw new Error(`Invalid version passed for target "${r}": "${o}". `+"Versions must be in semver format (major.minor.patch)")}return s.gt((0,n.semverify)(a),o.toString())}));return a.length===0}function isRequired(e,t,{compatData:r=a,includes:s,excludes:n}={}){if(n!=null&&n.has(e))return false;if(s!=null&&s.has(e))return true;return!targetsSupported(t,r[e])}function filterItems(e,t,r,s,a,n,o){const i=new Set;const l={compatData:e,includes:t,excludes:r};for(const t in e){if(isRequired(t,s,l)){i.add(t)}else if(o){const e=o.get(t);if(e){i.add(e)}}}if(a){a.forEach((e=>!r.has(e)&&i.add(e)))}if(n){n.forEach((e=>!t.has(e)&&i.delete(e)))}return i}},797:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isBrowsersQueryValid=isBrowsersQueryValid;t["default"]=getTargets;Object.defineProperty(t,"unreleasedLabels",{enumerable:true,get:function(){return i.unreleasedLabels}});Object.defineProperty(t,"TargetNames",{enumerable:true,get:function(){return l.TargetNames}});Object.defineProperty(t,"prettifyTargets",{enumerable:true,get:function(){return c.prettifyTargets}});Object.defineProperty(t,"getInclusionReasons",{enumerable:true,get:function(){return u.getInclusionReasons}});Object.defineProperty(t,"filterItems",{enumerable:true,get:function(){return p.default}});Object.defineProperty(t,"isRequired",{enumerable:true,get:function(){return p.isRequired}});var s=r(4907);var a=r(7347);var n=r(7043);var o=r(3406);var i=r(6555);var l=r(5748);var c=r(4794);var u=r(9750);var p=r(9578);const f=n["es6.module"];const d=new a.OptionValidator("@babel/helper-compilation-targets");function validateTargetNames(e){const t=Object.keys(l.TargetNames);for(const r of Object.keys(e)){if(!(r in l.TargetNames)){throw new Error(d.formatMessage(`'${r}' is not a valid target\n- Did you mean '${(0,a.findSuggestion)(r,t)}'?`))}}return e}function isBrowsersQueryValid(e){return typeof e==="string"||Array.isArray(e)&&e.every((e=>typeof e==="string"))}function validateBrowsers(e){d.invariant(e===undefined||isBrowsersQueryValid(e),`'${String(e)}' is not a valid browserslist query`);return e}function getLowestVersions(e){return e.reduce(((e,t)=>{const[r,s]=t.split(" ");const a=i.browserNameMap[r];if(!a){return e}try{const t=s.split("-")[0].toLowerCase();const n=(0,o.isUnreleasedVersion)(t,r);if(!e[a]){e[a]=n?t:(0,o.semverify)(t);return e}const i=e[a];const l=(0,o.isUnreleasedVersion)(i,r);if(l&&n){e[a]=(0,o.getLowestUnreleased)(i,t,r)}else if(l){e[a]=(0,o.semverify)(t)}else if(!l&&!n){const r=(0,o.semverify)(t);e[a]=(0,o.semverMin)(i,r)}}catch(e){}return e}),{})}function outputDecimalWarning(e){if(!e.length){return}console.warn("Warning, the following targets are using a decimal version:\n");e.forEach((({target:e,value:t})=>console.warn(` ${e}: ${t}`)));console.warn(`\nWe recommend using a string for minor/patch versions to avoid numbers like 6.10\ngetting parsed as 6.1, which can lead to unexpected behavior.\n`)}function semverifyTarget(e,t){try{return(0,o.semverify)(t)}catch(r){throw new Error(d.formatMessage(`'${t}' is not a valid value for 'targets.${e}'.`))}}const m={__default(e,t){const r=(0,o.isUnreleasedVersion)(t,e)?t.toLowerCase():semverifyTarget(e,t);return[e,r]},node(e,t){const r=t===true||t==="current"?process.versions.node:semverifyTarget(e,t);return[e,r]}};function generateTargets(e){const t=Object.assign({},e);delete t.esmodules;delete t.browsers;return t}function resolveTargets(e){const t=s(e,{mobileToDesktop:true});return getLowestVersions(t)}function getTargets(e={},t={}){var r;let{browsers:a,esmodules:n}=e;const{configPath:i="."}=t;validateBrowsers(a);const l=generateTargets(e);let c=validateTargetNames(l);const u=!!a;const p=u||Object.keys(c).length>0;const d=!t.ignoreBrowserslistConfig&&!p;if(!a&&d){a=s.loadConfig({config:t.configFile,path:i,env:t.browserslistEnv});if(a==null){{a=[]}}}if(n&&(n!=="intersect"||!((r=a)!=null&&r.length))){a=Object.keys(f).map((e=>`${e} >= ${f[e]}`)).join(", ");n=false}if(a){const e=resolveTargets(a);if(n==="intersect"){for(const t of Object.keys(e)){const r=e[t];if(f[t]){e[t]=(0,o.getHighestUnreleased)(r,(0,o.semverify)(f[t]),t)}else{delete e[t]}}}c=Object.assign(e,c)}const y={};const g=[];for(const e of Object.keys(c).sort()){var h;const t=c[e];if(typeof t==="number"&&t%1!==0){g.push({target:e,value:t})}const r=(h=m[e])!=null?h:m.__default;const[s,a]=r(e,t);if(a){y[s]=a}}outputDecimalWarning(g);return y}},5748:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.TargetNames=void 0;const r={node:"node",chrome:"chrome",opera:"opera",edge:"edge",firefox:"firefox",safari:"safari",ie:"ie",ios:"ios",android:"android",electron:"electron",samsung:"samsung"};t.TargetNames=r},4794:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.prettifyVersion=prettifyVersion;t.prettifyTargets=prettifyTargets;var s=r(7849);var a=r(6555);function prettifyVersion(e){if(typeof e!=="string"){return e}const t=[s.major(e)];const r=s.minor(e);const a=s.patch(e);if(r||a){t.push(r)}if(a){t.push(a)}return t.join(".")}function prettifyTargets(e){return Object.keys(e).reduce(((t,r)=>{let s=e[r];const n=a.unreleasedLabels[r];if(typeof s==="string"&&n!==s){s=prettifyVersion(s)}t[r]=s;return t}),{})}},6555:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.browserNameMap=t.unreleasedLabels=void 0;const r={safari:"tp"};t.unreleasedLabels=r;const s={and_chr:"chrome",and_ff:"firefox",android:"android",chrome:"chrome",edge:"edge",firefox:"firefox",ie:"ie",ie_mob:"ie",ios_saf:"ios",node:"node",op_mob:"opera",opera:"opera",safari:"safari",samsung:"samsung"};t.browserNameMap=s},3406:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.semverMin=semverMin;t.semverify=semverify;t.isUnreleasedVersion=isUnreleasedVersion;t.getLowestUnreleased=getLowestUnreleased;t.getHighestUnreleased=getHighestUnreleased;t.getLowestImplementedVersion=getLowestImplementedVersion;var s=r(7849);var a=r(7347);var n=r(6555);const o=/^(\d+|\d+.\d+)$/;const i=new a.OptionValidator("@babel/helper-compilation-targets");function semverMin(e,t){return e&&s.lt(e,t)?e:t}function semverify(e){if(typeof e==="string"&&s.valid(e)){return e}i.invariant(typeof e==="number"||typeof e==="string"&&o.test(e),`'${e}' is not a valid version`);const t=e.toString().split(".");while(t.length<3){t.push("0")}return t.join(".")}function isUnreleasedVersion(e,t){const r=n.unreleasedLabels[t];return!!r&&r===e.toString().toLowerCase()}function getLowestUnreleased(e,t,r){const s=n.unreleasedLabels[r];const a=[e,t].some((e=>e===s));if(a){return e===a?t:e||t}return semverMin(e,t)}function getHighestUnreleased(e,t,r){return getLowestUnreleased(e,t,r)===e?t:e}function getLowestImplementedVersion(e,t){const r=e[t];if(!r&&t==="android"){return e.chrome}return r}},6429:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasOwnDecorators=hasOwnDecorators;t.hasDecorators=hasDecorators;t.buildDecoratedClass=buildDecoratedClass;var s=r(8304);var a=r(6833);var n=r(550);function hasOwnDecorators(e){return!!(e.decorators&&e.decorators.length)}function hasDecorators(e){return hasOwnDecorators(e)||e.body.body.some(hasOwnDecorators)}function prop(e,t){if(!t)return null;return s.types.objectProperty(s.types.identifier(e),t)}function method(e,t){return s.types.objectMethod("method",s.types.identifier(e),[],s.types.blockStatement(t))}function takeDecorators(e){let t;if(e.decorators&&e.decorators.length>0){t=s.types.arrayExpression(e.decorators.map((e=>e.expression)))}e.decorators=undefined;return t}function getKey(e){if(e.computed){return e.key}else if(s.types.isIdentifier(e.key)){return s.types.stringLiteral(e.key.name)}else{return s.types.stringLiteral(String(e.key.value))}}function extractElementDescriptor(e,t,r){const{node:o,scope:i}=r;const l=r.isClassMethod();if(r.isPrivate()){throw r.buildCodeFrameError(`Private ${l?"methods":"fields"} in decorated classes are not supported yet.`)}new a.default({methodPath:r,objectRef:e,superRef:t,file:this,refToPreserve:e}).replace();const c=[prop("kind",s.types.stringLiteral(l?o.kind:"field")),prop("decorators",takeDecorators(o)),prop("static",o.static&&s.types.booleanLiteral(true)),prop("key",getKey(o))].filter(Boolean);if(l){const e=o.computed?null:o.key;s.types.toExpression(o);c.push(prop("value",(0,n.default)({node:o,id:e,scope:i})||o))}else if(o.value){c.push(method("value",s.template.statements.ast`return ${o.value}`))}else{c.push(prop("value",i.buildUndefinedNode()))}r.remove();return s.types.objectExpression(c)}function addDecorateHelper(e){try{return e.addHelper("decorate")}catch(e){if(e.code==="BABEL_HELPER_UNKNOWN"){e.message+="\n '@babel/plugin-transform-decorators' in non-legacy mode"+" requires '@babel/core' version ^7.0.2 and you appear to be using"+" an older version."}throw e}}function buildDecoratedClass(e,t,r,a){const{node:n,scope:o}=t;const i=o.generateUidIdentifier("initialize");const l=n.id&&t.isDeclaration();const c=t.isInStrictMode();const{superClass:u}=n;n.type="ClassDeclaration";if(!n.id)n.id=s.types.cloneNode(e);let p;if(u){p=o.generateUidIdentifierBasedOnNode(n.superClass,"super");n.superClass=p}const f=takeDecorators(n);const d=s.types.arrayExpression(r.filter((e=>!e.node.abstract)).map(extractElementDescriptor.bind(a,n.id,p)));const m=s.template.expression.ast` ${addDecorateHelper(a)}( - ${d||s.types.nullLiteral()}, + ${f||s.types.nullLiteral()}, function (${i}, ${u?s.types.cloneNode(p):null}) { ${n} - return { F: ${s.types.cloneNode(n.id)}, d: ${f} }; + return { F: ${s.types.cloneNode(n.id)}, d: ${d} }; }, ${u} ) - `;if(!c){m.arguments[1].body.directives.push(s.types.directive(s.types.directiveLiteral("use strict")))}let y=m;let g="arguments.1.body.body.0";if(l){y=s.template.statement.ast`let ${e} = ${m}`;g="declarations.0.init."+g}return{instanceNodes:[s.template.statement.ast`${s.types.cloneNode(i)}(this)`],wrapClass(e){e.replaceWith(y);return e.get(g)}}}},7497:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.enableFeature=enableFeature;t.isLoose=isLoose;t.verifyUsedFeatures=verifyUsedFeatures;t.FEATURES=void 0;var s=r(6429);const a=Object.freeze({fields:1<<1,privateMethods:1<<2,decorators:1<<3,privateIn:1<<4,staticBlocks:1<<5});t.FEATURES=a;const n=new Map([[a.fields,"@babel/plugin-proposal-class-properties"],[a.privateMethods,"@babel/plugin-proposal-private-methods"],[a.privateIn,"@babel/plugin-proposal-private-property-in-object"]]);const o="@babel/plugin-class-features/featuresKey";const i="@babel/plugin-class-features/looseKey";const l="@babel/plugin-class-features/looseLowPriorityKey/#__internal__@babel/preset-env__please-overwrite-loose-instead-of-throwing";function enableFeature(e,t,r){if(!hasFeature(e,t)||canIgnoreLoose(e,t)){e.set(o,e.get(o)|t);if(r==="#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error"){setLoose(e,t,true);e.set(l,e.get(l)|t)}else if(r==="#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"){setLoose(e,t,false);e.set(l,e.get(l)|t)}else{setLoose(e,t,r)}}let s;let a;for(const[t,r]of n){if(!hasFeature(e,t))continue;const n=isLoose(e,t);if(canIgnoreLoose(e,t)){continue}else if(s===!n){throw new Error("'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, "+"@babel/plugin-proposal-private-methods and "+"@babel/plugin-proposal-private-property-in-object (when they are enabled).")}else{s=n;a=r}}if(s!==undefined){for(const[t,r]of n){if(hasFeature(e,t)&&isLoose(e,t)!==s){setLoose(e,t,s);console.warn(`Though the "loose" option was set to "${!s}" in your @babel/preset-env `+`config, it will not be used for ${r} since the "loose" mode option was set to `+`"${s}" for ${a}.\nThe "loose" option must be the `+`same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods `+`and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can `+`silence this warning by explicitly adding\n`+`\t["${r}", { "loose": ${s} }]\n`+`to the "plugins" section of your Babel config.`)}}}}function hasFeature(e,t){return!!(e.get(o)&t)}function isLoose(e,t){return!!(e.get(i)&t)}function setLoose(e,t,r){if(r)e.set(i,e.get(i)|t);else e.set(i,e.get(i)&~t);e.set(l,e.get(l)&~t)}function canIgnoreLoose(e,t){return!!(e.get(l)&t)}function verifyUsedFeatures(e,t){if((0,s.hasOwnDecorators)(e.node)){if(!hasFeature(t,a.decorators)){throw e.buildCodeFrameError("Decorators are not enabled."+"\nIf you are using "+'["@babel/plugin-proposal-decorators", { "legacy": true }], '+'make sure it comes *before* "@babel/plugin-proposal-class-properties" '+"and enable loose mode, like so:\n"+'\t["@babel/plugin-proposal-decorators", { "legacy": true }]\n'+'\t["@babel/plugin-proposal-class-properties", { "loose": true }]')}if(e.isPrivate()){throw e.buildCodeFrameError(`Private ${e.isClassMethod()?"methods":"fields"} in decorated classes are not supported yet.`)}}if(e.isPrivateMethod!=null&&e.isPrivateMethod()){if(!hasFeature(t,a.privateMethods)){throw e.buildCodeFrameError("Class private methods are not enabled.")}}if(e.isPrivateName()&&e.parentPath.isBinaryExpression({operator:"in",left:e.node})){if(!hasFeature(t,a.privateIn)){throw e.buildCodeFrameError("Private property in checks are not enabled.")}}if(e.isProperty()){if(!hasFeature(t,a.fields)){throw e.buildCodeFrameError("Class fields are not enabled.")}}if(e.isStaticBlock!=null&&e.isStaticBlock()){if(!hasFeature(t,a.staticBlocks)){throw e.buildCodeFrameError("Static class blocks are not enabled. "+"Please add `@babel/plugin-proposal-class-static-block` to your configuration.")}}}},3647:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.buildPrivateNamesMap=buildPrivateNamesMap;t.buildPrivateNamesNodes=buildPrivateNamesNodes;t.transformPrivateNamesUsage=transformPrivateNamesUsage;t.buildFieldsInitNodes=buildFieldsInitNodes;var s=r(8304);var a=r(6833);var n=r(3316);var o=r(6721);var i=r(2155);var l=r(6782);function buildPrivateNamesMap(e){const t=new Map;for(const r of e){const e=r.isPrivate();const s=!r.isProperty();const a=!r.node.static;if(e){const{name:e}=r.node.key.id;const n=t.has(e)?t.get(e):{id:r.scope.generateUidIdentifier(e),static:!a,method:s};if(r.node.kind==="get"){n.getId=r.scope.generateUidIdentifier(`get_${e}`)}else if(r.node.kind==="set"){n.setId=r.scope.generateUidIdentifier(`set_${e}`)}else if(r.node.kind==="method"){n.methodId=r.scope.generateUidIdentifier(e)}t.set(e,n)}}return t}function buildPrivateNamesNodes(e,t,r){const a=[];for(const[n,o]of e){const{static:e,method:l,getId:c,setId:u}=o;const p=c||u;const d=s.types.cloneNode(o.id);let f;if(t){f=s.types.callExpression(r.addHelper("classPrivateFieldLooseKey"),[s.types.stringLiteral(n)])}else if(!e){f=s.types.newExpression(s.types.identifier(!l||p?"WeakMap":"WeakSet"),[])}if(f){(0,i.default)(f);a.push(s.template.statement.ast`var ${d} = ${f}`)}}return a}function privateNameVisitorFactory(e){const t=Object.assign({},e,{Class(e){const{privateNamesMap:s}=this;const a=e.get("body.body");const n=new Map(s);const o=[];for(const e of a){if(!e.isPrivate())continue;const{name:t}=e.node.key.id;n.delete(t);o.push(t)}if(!o.length){return}e.get("body").traverse(r,Object.assign({},this,{redeclared:o}));e.traverse(t,Object.assign({},this,{privateNamesMap:n}));e.skipKey("body")}});const r=s.traverse.visitors.merge([Object.assign({},e),a.environmentVisitor]);return t}const c=privateNameVisitorFactory({PrivateName(e,{noDocumentAll:t}){const{privateNamesMap:r,redeclared:s}=this;const{node:a,parentPath:n}=e;if(!n.isMemberExpression({property:a})&&!n.isOptionalMemberExpression({property:a})){return}const{name:o}=a.id;if(!r.has(o))return;if(s&&s.includes(o))return;this.handle(n,t)}});const u=privateNameVisitorFactory({BinaryExpression(e){const{operator:t,left:r,right:a}=e.node;if(t!=="in")return;if(!e.get("left").isPrivateName())return;const{privateFieldsAsProperties:n,privateNamesMap:o,redeclared:i}=this;const{name:l}=r.id;if(!o.has(l))return;if(i&&i.includes(l))return;if(n){const{id:t}=o.get(l);e.replaceWith(s.template.expression.ast` + `;if(!c){m.arguments[1].body.directives.push(s.types.directive(s.types.directiveLiteral("use strict")))}let y=m;let g="arguments.1.body.body.0";if(l){y=s.template.statement.ast`let ${e} = ${m}`;g="declarations.0.init."+g}return{instanceNodes:[s.template.statement.ast`${s.types.cloneNode(i)}(this)`],wrapClass(e){e.replaceWith(y);return e.get(g)}}}},7497:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.enableFeature=enableFeature;t.isLoose=isLoose;t.verifyUsedFeatures=verifyUsedFeatures;t.FEATURES=void 0;var s=r(6429);const a=Object.freeze({fields:1<<1,privateMethods:1<<2,decorators:1<<3,privateIn:1<<4,staticBlocks:1<<5});t.FEATURES=a;const n=new Map([[a.fields,"@babel/plugin-proposal-class-properties"],[a.privateMethods,"@babel/plugin-proposal-private-methods"],[a.privateIn,"@babel/plugin-proposal-private-property-in-object"]]);const o="@babel/plugin-class-features/featuresKey";const i="@babel/plugin-class-features/looseKey";const l="@babel/plugin-class-features/looseLowPriorityKey/#__internal__@babel/preset-env__please-overwrite-loose-instead-of-throwing";function enableFeature(e,t,r){if(!hasFeature(e,t)||canIgnoreLoose(e,t)){e.set(o,e.get(o)|t);if(r==="#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error"){setLoose(e,t,true);e.set(l,e.get(l)|t)}else if(r==="#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"){setLoose(e,t,false);e.set(l,e.get(l)|t)}else{setLoose(e,t,r)}}let s;let a;for(const[t,r]of n){if(!hasFeature(e,t))continue;const n=isLoose(e,t);if(canIgnoreLoose(e,t)){continue}else if(s===!n){throw new Error("'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, "+"@babel/plugin-proposal-private-methods and "+"@babel/plugin-proposal-private-property-in-object (when they are enabled).")}else{s=n;a=r}}if(s!==undefined){for(const[t,r]of n){if(hasFeature(e,t)&&isLoose(e,t)!==s){setLoose(e,t,s);console.warn(`Though the "loose" option was set to "${!s}" in your @babel/preset-env `+`config, it will not be used for ${r} since the "loose" mode option was set to `+`"${s}" for ${a}.\nThe "loose" option must be the `+`same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods `+`and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can `+`silence this warning by explicitly adding\n`+`\t["${r}", { "loose": ${s} }]\n`+`to the "plugins" section of your Babel config.`)}}}}function hasFeature(e,t){return!!(e.get(o)&t)}function isLoose(e,t){return!!(e.get(i)&t)}function setLoose(e,t,r){if(r)e.set(i,e.get(i)|t);else e.set(i,e.get(i)&~t);e.set(l,e.get(l)&~t)}function canIgnoreLoose(e,t){return!!(e.get(l)&t)}function verifyUsedFeatures(e,t){if((0,s.hasOwnDecorators)(e.node)){if(!hasFeature(t,a.decorators)){throw e.buildCodeFrameError("Decorators are not enabled."+"\nIf you are using "+'["@babel/plugin-proposal-decorators", { "legacy": true }], '+'make sure it comes *before* "@babel/plugin-proposal-class-properties" '+"and enable loose mode, like so:\n"+'\t["@babel/plugin-proposal-decorators", { "legacy": true }]\n'+'\t["@babel/plugin-proposal-class-properties", { "loose": true }]')}if(e.isPrivate()){throw e.buildCodeFrameError(`Private ${e.isClassMethod()?"methods":"fields"} in decorated classes are not supported yet.`)}}if(e.isPrivateMethod!=null&&e.isPrivateMethod()){if(!hasFeature(t,a.privateMethods)){throw e.buildCodeFrameError("Class private methods are not enabled.")}}if(e.isPrivateName()&&e.parentPath.isBinaryExpression({operator:"in",left:e.node})){if(!hasFeature(t,a.privateIn)){throw e.buildCodeFrameError("Private property in checks are not enabled.")}}if(e.isProperty()){if(!hasFeature(t,a.fields)){throw e.buildCodeFrameError("Class fields are not enabled.")}}if(e.isStaticBlock!=null&&e.isStaticBlock()){if(!hasFeature(t,a.staticBlocks)){throw e.buildCodeFrameError("Static class blocks are not enabled. "+"Please add `@babel/plugin-proposal-class-static-block` to your configuration.")}}}},3647:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.buildPrivateNamesMap=buildPrivateNamesMap;t.buildPrivateNamesNodes=buildPrivateNamesNodes;t.transformPrivateNamesUsage=transformPrivateNamesUsage;t.buildFieldsInitNodes=buildFieldsInitNodes;var s=r(8304);var a=r(6833);var n=r(3316);var o=r(6721);var i=r(2155);var l=r(6339);function buildPrivateNamesMap(e){const t=new Map;for(const r of e){const e=r.isPrivate();const s=!r.isProperty();const a=!r.node.static;if(e){const{name:e}=r.node.key.id;const n=t.has(e)?t.get(e):{id:r.scope.generateUidIdentifier(e),static:!a,method:s};if(r.node.kind==="get"){n.getId=r.scope.generateUidIdentifier(`get_${e}`)}else if(r.node.kind==="set"){n.setId=r.scope.generateUidIdentifier(`set_${e}`)}else if(r.node.kind==="method"){n.methodId=r.scope.generateUidIdentifier(e)}t.set(e,n)}}return t}function buildPrivateNamesNodes(e,t,r){const a=[];for(const[n,o]of e){const{static:e,method:l,getId:c,setId:u}=o;const p=c||u;const f=s.types.cloneNode(o.id);let d;if(t){d=s.types.callExpression(r.addHelper("classPrivateFieldLooseKey"),[s.types.stringLiteral(n)])}else if(!e){d=s.types.newExpression(s.types.identifier(!l||p?"WeakMap":"WeakSet"),[])}if(d){(0,i.default)(d);a.push(s.template.statement.ast`var ${f} = ${d}`)}}return a}function privateNameVisitorFactory(e){const t=Object.assign({},e,{Class(e){const{privateNamesMap:s}=this;const a=e.get("body.body");const n=new Map(s);const o=[];for(const e of a){if(!e.isPrivate())continue;const{name:t}=e.node.key.id;n.delete(t);o.push(t)}if(!o.length){return}e.get("body").traverse(r,Object.assign({},this,{redeclared:o}));e.traverse(t,Object.assign({},this,{privateNamesMap:n}));e.skipKey("body")}});const r=s.traverse.visitors.merge([Object.assign({},e),a.environmentVisitor]);return t}const c=privateNameVisitorFactory({PrivateName(e,{noDocumentAll:t}){const{privateNamesMap:r,redeclared:s}=this;const{node:a,parentPath:n}=e;if(!n.isMemberExpression({property:a})&&!n.isOptionalMemberExpression({property:a})){return}const{name:o}=a.id;if(!r.has(o))return;if(s&&s.includes(o))return;this.handle(n,t)}});const u=privateNameVisitorFactory({BinaryExpression(e){const{operator:t,left:r,right:a}=e.node;if(t!=="in")return;if(!e.get("left").isPrivateName())return;const{privateFieldsAsProperties:n,privateNamesMap:o,redeclared:i}=this;const{name:l}=r.id;if(!o.has(l))return;if(i&&i.includes(l))return;if(n){const{id:t}=o.get(l);e.replaceWith(s.template.expression.ast` Object.prototype.hasOwnProperty.call(${a}, ${s.types.cloneNode(t)}) - `);return}const{id:c,static:u}=o.get(l);if(u){e.replaceWith(s.template.expression.ast`${a} === ${this.classRef}`);return}e.replaceWith(s.template.expression.ast`${s.types.cloneNode(c)}.has(${a})`)}});const p={memoise(e,t){const{scope:r}=e;const{object:s}=e.node;const a=r.maybeGenerateMemoised(s);if(!a){return}this.memoiser.set(s,a,t)},receiver(e){const{object:t}=e.node;if(this.memoiser.has(t)){return s.types.cloneNode(this.memoiser.get(t))}return s.types.cloneNode(t)},get(e){const{classRef:t,privateNamesMap:r,file:a}=this;const{name:n}=e.node.property.id;const{id:o,static:i,method:l,methodId:c,getId:u,setId:p}=r.get(n);const d=u||p;if(i){const r=l&&!d?"classStaticPrivateMethodGet":"classStaticPrivateFieldSpecGet";return s.types.callExpression(a.addHelper(r),[this.receiver(e),s.types.cloneNode(t),s.types.cloneNode(o)])}if(l){if(d){if(!u&&p){if(a.availableHelper("writeOnlyError")){return s.types.sequenceExpression([this.receiver(e),s.types.callExpression(a.addHelper("writeOnlyError"),[s.types.stringLiteral(`#${n}`)])])}console.warn(`@babel/helpers is outdated, update it to silence this warning.`)}return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])}return s.types.callExpression(a.addHelper("classPrivateMethodGet"),[this.receiver(e),s.types.cloneNode(o),s.types.cloneNode(c)])}return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])},boundGet(e){this.memoise(e,1);return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[this.receiver(e)])},set(e,t){const{classRef:r,privateNamesMap:a,file:n}=this;const{name:o}=e.node.property.id;const{id:i,static:l,method:c,setId:u,getId:p}=a.get(o);const d=p||u;if(l){const a=c&&!d?"classStaticPrivateMethodSet":"classStaticPrivateFieldSpecSet";return s.types.callExpression(n.addHelper(a),[this.receiver(e),s.types.cloneNode(r),s.types.cloneNode(i),t])}if(c){if(u){return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])}return s.types.sequenceExpression([this.receiver(e),t,s.types.callExpression(n.addHelper("readOnlyError"),[s.types.stringLiteral(`#${o}`)])])}return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])},destructureSet(e){const{classRef:t,privateNamesMap:r,file:a}=this;const{name:n}=e.node.property.id;const{id:o,static:i}=r.get(n);if(i){try{var l=a.addHelper("classStaticPrivateFieldDestructureSet")}catch(e){throw new Error("Babel can not transpile `[C.#p] = [0]` with @babel/helpers < 7.13.10, \n"+"please update @babel/helpers to the latest version.")}return s.types.memberExpression(s.types.callExpression(l,[this.receiver(e),s.types.cloneNode(t),s.types.cloneNode(o)]),s.types.identifier("value"))}return s.types.memberExpression(s.types.callExpression(a.addHelper("classPrivateFieldDestructureSet"),[this.receiver(e),s.types.cloneNode(o)]),s.types.identifier("value"))},call(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,false)},optionalCall(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,true)}};const d={get(e){const{privateNamesMap:t,file:r}=this;const{object:a}=e.node;const{name:n}=e.node.property.id;return s.template.expression`BASE(REF, PROP)[PROP]`({BASE:r.addHelper("classPrivateFieldLooseBase"),REF:s.types.cloneNode(a),PROP:s.types.cloneNode(t.get(n).id)})},boundGet(e){return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[s.types.cloneNode(e.node.object)])},simpleSet(e){return this.get(e)},destructureSet(e){return this.get(e)},call(e,t){return s.types.callExpression(this.get(e),t)},optionalCall(e,t){return s.types.optionalCallExpression(this.get(e),t,true)}};function transformPrivateNamesUsage(e,t,r,{privateFieldsAsProperties:s,noDocumentAll:a},o){if(!r.size)return;const i=t.get("body");const l=s?d:p;(0,n.default)(i,c,Object.assign({privateNamesMap:r,classRef:e,file:o},l,{noDocumentAll:a}));i.traverse(u,{privateNamesMap:r,classRef:e,file:o,privateFieldsAsProperties:s})}function buildPrivateFieldInitLoose(e,t,r){const{id:a}=r.get(t.node.key.id.name);const n=t.node.value||t.scope.buildUndefinedNode();return s.template.statement.ast` + `);return}const{id:c,static:u}=o.get(l);if(u){e.replaceWith(s.template.expression.ast`${a} === ${this.classRef}`);return}e.replaceWith(s.template.expression.ast`${s.types.cloneNode(c)}.has(${a})`)}});const p={memoise(e,t){const{scope:r}=e;const{object:s}=e.node;const a=r.maybeGenerateMemoised(s);if(!a){return}this.memoiser.set(s,a,t)},receiver(e){const{object:t}=e.node;if(this.memoiser.has(t)){return s.types.cloneNode(this.memoiser.get(t))}return s.types.cloneNode(t)},get(e){const{classRef:t,privateNamesMap:r,file:a}=this;const{name:n}=e.node.property.id;const{id:o,static:i,method:l,methodId:c,getId:u,setId:p}=r.get(n);const f=u||p;if(i){const r=l&&!f?"classStaticPrivateMethodGet":"classStaticPrivateFieldSpecGet";return s.types.callExpression(a.addHelper(r),[this.receiver(e),s.types.cloneNode(t),s.types.cloneNode(o)])}if(l){if(f){if(!u&&p){if(a.availableHelper("writeOnlyError")){return s.types.sequenceExpression([this.receiver(e),s.types.callExpression(a.addHelper("writeOnlyError"),[s.types.stringLiteral(`#${n}`)])])}console.warn(`@babel/helpers is outdated, update it to silence this warning.`)}return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])}return s.types.callExpression(a.addHelper("classPrivateMethodGet"),[this.receiver(e),s.types.cloneNode(o),s.types.cloneNode(c)])}return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])},boundGet(e){this.memoise(e,1);return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[this.receiver(e)])},set(e,t){const{classRef:r,privateNamesMap:a,file:n}=this;const{name:o}=e.node.property.id;const{id:i,static:l,method:c,setId:u,getId:p}=a.get(o);const f=p||u;if(l){const a=c&&!f?"classStaticPrivateMethodSet":"classStaticPrivateFieldSpecSet";return s.types.callExpression(n.addHelper(a),[this.receiver(e),s.types.cloneNode(r),s.types.cloneNode(i),t])}if(c){if(u){return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])}return s.types.sequenceExpression([this.receiver(e),t,s.types.callExpression(n.addHelper("readOnlyError"),[s.types.stringLiteral(`#${o}`)])])}return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])},destructureSet(e){const{classRef:t,privateNamesMap:r,file:a}=this;const{name:n}=e.node.property.id;const{id:o,static:i}=r.get(n);if(i){try{var l=a.addHelper("classStaticPrivateFieldDestructureSet")}catch(e){throw new Error("Babel can not transpile `[C.#p] = [0]` with @babel/helpers < 7.13.10, \n"+"please update @babel/helpers to the latest version.")}return s.types.memberExpression(s.types.callExpression(l,[this.receiver(e),s.types.cloneNode(t),s.types.cloneNode(o)]),s.types.identifier("value"))}return s.types.memberExpression(s.types.callExpression(a.addHelper("classPrivateFieldDestructureSet"),[this.receiver(e),s.types.cloneNode(o)]),s.types.identifier("value"))},call(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,false)},optionalCall(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,true)}};const f={get(e){const{privateNamesMap:t,file:r}=this;const{object:a}=e.node;const{name:n}=e.node.property.id;return s.template.expression`BASE(REF, PROP)[PROP]`({BASE:r.addHelper("classPrivateFieldLooseBase"),REF:s.types.cloneNode(a),PROP:s.types.cloneNode(t.get(n).id)})},boundGet(e){return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[s.types.cloneNode(e.node.object)])},simpleSet(e){return this.get(e)},destructureSet(e){return this.get(e)},call(e,t){return s.types.callExpression(this.get(e),t)},optionalCall(e,t){return s.types.optionalCallExpression(this.get(e),t,true)}};function transformPrivateNamesUsage(e,t,r,{privateFieldsAsProperties:s,noDocumentAll:a},o){if(!r.size)return;const i=t.get("body");const l=s?f:p;(0,n.default)(i,c,Object.assign({privateNamesMap:r,classRef:e,file:o},l,{noDocumentAll:a}));i.traverse(u,{privateNamesMap:r,classRef:e,file:o,privateFieldsAsProperties:s})}function buildPrivateFieldInitLoose(e,t,r){const{id:a}=r.get(t.node.key.id.name);const n=t.node.value||t.scope.buildUndefinedNode();return s.template.statement.ast` Object.defineProperty(${e}, ${s.types.cloneNode(a)}, { // configurable is false by default // enumerable is false by default @@ -71,91 +71,16 @@ // writable is false by default value: ${i.name} }); - `}function buildPrivateMethodDeclaration(e,t,r=false){const a=t.get(e.node.key.id.name);const{id:n,methodId:o,getId:i,setId:l,getterDeclared:c,setterDeclared:u,static:p}=a;const{params:d,body:f,generator:m,async:y}=e.node;const g=i&&!c&&d.length===0;const h=l&&!u&&d.length>0;let b=o;if(g){t.set(e.node.key.id.name,Object.assign({},a,{getterDeclared:true}));b=i}else if(h){t.set(e.node.key.id.name,Object.assign({},a,{setterDeclared:true}));b=l}else if(p&&!r){b=n}return s.types.functionDeclaration(s.types.cloneNode(b),d,f,m,y)}const f=s.traverse.visitors.merge([{ThisExpression(e,t){t.needsClassRef=true;e.replaceWith(s.types.cloneNode(t.classRef))}},a.environmentVisitor]);const m={ReferencedIdentifier(e,t){if(e.scope.bindingIdentifierEquals(e.node.name,t.innerBinding)){t.needsClassRef=true;e.node.name=t.classRef.name}}};function replaceThisContext(e,t,r,n,o,i,l){var c;const u={classRef:t,needsClassRef:false,innerBinding:l};const p=new a.default({methodPath:e,constantSuper:i,file:n,refToPreserve:t,getSuperRef:r,getObjectRef(){u.needsClassRef=true;return o||e.node.static?t:s.types.memberExpression(t,s.types.identifier("prototype"))}});p.replace();if(o||e.isProperty()){e.traverse(f,u)}if((c=u.classRef)!=null&&c.name&&u.classRef.name!==(l==null?void 0:l.name)){e.traverse(m,u)}return u.needsClassRef}function buildFieldsInitNodes(e,t,r,a,n,o,i,c,u){let p=false;let d;const f=[];const m=[];const y=[];const g=s.types.isIdentifier(t)?()=>t:()=>{var e;(e=d)!=null?e:d=r[0].scope.generateUidIdentifierBasedOnNode(t);return d};for(const t of r){l.assertFieldTransformed(t);const r=t.node.static;const d=!r;const h=t.isPrivate();const b=!h;const x=t.isProperty();const v=!x;const E=t.isStaticBlock==null?void 0:t.isStaticBlock();if(r||v&&h||E){const r=replaceThisContext(t,e,g,n,E,c,u);p=p||r}switch(true){case E:f.push(s.template.statement.ast`(() => ${s.types.blockStatement(t.node.body)})()`);break;case r&&h&&x&&i:p=true;f.push(buildPrivateFieldInitLoose(s.types.cloneNode(e),t,a));break;case r&&h&&x&&!i:p=true;f.push(buildPrivateStaticFieldInitSpec(t,a));break;case r&&b&&x&&o:p=true;f.push(buildPublicFieldInitLoose(s.types.cloneNode(e),t));break;case r&&b&&x&&!o:p=true;f.push(buildPublicFieldInitSpec(s.types.cloneNode(e),t,n));break;case d&&h&&x&&i:m.push(buildPrivateFieldInitLoose(s.types.thisExpression(),t,a));break;case d&&h&&x&&!i:m.push(buildPrivateInstanceFieldInitSpec(s.types.thisExpression(),t,a));break;case d&&h&&v&&i:m.unshift(buildPrivateMethodInitLoose(s.types.thisExpression(),t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case d&&h&&v&&!i:m.unshift(buildPrivateInstanceMethodInitSpec(s.types.thisExpression(),t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case r&&h&&v&&!i:p=true;f.unshift(buildPrivateStaticFieldInitSpec(t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case r&&h&&v&&i:p=true;f.unshift(buildPrivateStaticMethodInitLoose(s.types.cloneNode(e),t,n,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case d&&b&&x&&o:m.push(buildPublicFieldInitLoose(s.types.thisExpression(),t));break;case d&&b&&x&&!o:m.push(buildPublicFieldInitSpec(s.types.thisExpression(),t,n));break;default:throw new Error("Unreachable.")}}return{staticNodes:f.filter(Boolean),instanceNodes:m.filter(Boolean),pureStaticNodes:y.filter(Boolean),wrapClass(t){for(const e of r){e.remove()}if(d){t.scope.push({id:s.types.cloneNode(d)});t.set("superClass",s.types.assignmentExpression("=",d,t.node.superClass))}if(!p)return t;if(t.isClassExpression()){t.scope.push({id:e});t.replaceWith(s.types.assignmentExpression("=",s.types.cloneNode(e),t.node))}else if(!t.node.id){t.node.id=e}return t}}}},6758:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.createClassFeaturePlugin=createClassFeaturePlugin;Object.defineProperty(t,"injectInitialization",{enumerable:true,get:function(){return l.injectInitialization}});Object.defineProperty(t,"enableFeature",{enumerable:true,get:function(){return c.enableFeature}});Object.defineProperty(t,"FEATURES",{enumerable:true,get:function(){return c.FEATURES}});var s=r(8304);var a=r(550);var n=r(7058);var o=r(3647);var i=r(6429);var l=r(5617);var c=r(7497);const u="7.14.6".split(".").reduce(((e,t)=>e*1e5+ +t),0);const p="@babel/plugin-class-features/version";function createClassFeaturePlugin({name:e,feature:t,loose:r,manipulateOptions:d,api:f={assumption:()=>{}}}){const m=f.assumption("setPublicClassFields");const y=f.assumption("privateFieldsAsProperties");const g=f.assumption("constantSuper");const h=f.assumption("noDocumentAll");if(r===true){const t=[];if(m!==undefined){t.push(`"setPublicClassFields"`)}if(y!==undefined){t.push(`"privateFieldsAsProperties"`)}if(t.length!==0){console.warn(`[${e}]: You are using the "loose: true" option and you are`+` explicitly setting a value for the ${t.join(" and ")}`+` assumption${t.length>1?"s":""}. The "loose" option`+` can cause incompatibilities with the other class features`+` plugins, so it's recommended that you replace it with the`+` following top-level option:\n`+`\t"assumptions": {\n`+`\t\t"setPublicClassFields": true,\n`+`\t\t"privateFieldsAsProperties": true\n`+`\t}`)}}return{name:e,manipulateOptions:d,pre(){(0,c.enableFeature)(this.file,t,r);if(!this.file.get(p)||this.file.get(p)0){(0,l.injectInitialization)(e,d,D,((e,t)=>{if(f)return;for(const r of b){if(r.node.static)continue;r.traverse(e,t)}}))}e=C(e);e.insertBefore([...O,...k]);if(P.length>0){e.insertAfter(P)}if(I.length>0){e.find((e=>e.isStatement()||e.isDeclaration())).insertAfter(I)}},PrivateName(e){if(this.file.get(p)!==u||e.parentPath.isPrivate({key:e.node})){return}throw e.buildCodeFrameError(`Unknown PrivateName "${e}"`)},ExportDefaultDeclaration(e){if(this.file.get(p)!==u)return;const t=e.get("declaration");if(t.isClassDeclaration()&&(0,i.hasDecorators)(t.node)){if(t.node.id){(0,n.default)(e)}else{t.node.type="ClassExpression"}}}}}}},5617:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.injectInitialization=injectInitialization;t.extractComputedKeys=extractComputedKeys;var s=r(8304);var a=r(6833);const n=s.traverse.visitors.merge([{Super(e){const{node:t,parentPath:r}=e;if(r.isCallExpression({callee:t})){this.push(r)}}},a.environmentVisitor]);const o={"TSTypeAnnotation|TypeAnnotation"(e){e.skip()},ReferencedIdentifier(e){if(this.scope.hasOwnBinding(e.node.name)){this.scope.rename(e.node.name);e.skip()}}};function handleClassTDZ(e,t){if(t.classBinding&&t.classBinding===e.scope.getBinding(e.node.name)){const r=t.file.addHelper("classNameTDZError");const a=s.types.callExpression(r,[s.types.stringLiteral(e.node.name)]);e.replaceWith(s.types.sequenceExpression([a,e.node]));e.skip()}}const i={ReferencedIdentifier:handleClassTDZ};function injectInitialization(e,t,r,a){if(!r.length)return;const i=!!e.node.superClass;if(!t){const r=s.types.classMethod("constructor",s.types.identifier("constructor"),[],s.types.blockStatement([]));if(i){r.params=[s.types.restElement(s.types.identifier("args"))];r.body.body.push(s.template.statement.ast`super(...args)`)}[t]=e.get("body").unshiftContainer("body",r)}if(a){a(o,{scope:t.scope})}if(i){const e=[];t.traverse(n,e);let a=true;for(const t of e){if(a){t.insertAfter(r);a=false}else{t.insertAfter(r.map((e=>s.types.cloneNode(e))))}}}else{t.get("body").unshiftContainer("body",r)}}function extractComputedKeys(e,t,r,a){const n=[];const o={classBinding:t.node.id&&t.scope.getBinding(t.node.id.name),file:a};for(const e of r){const r=e.get("key");if(r.isReferencedIdentifier()){handleClassTDZ(r,o)}else{r.traverse(i,o)}const a=e.node;if(!r.isConstantExpression()){const e=t.scope.generateUidIdentifierBasedOnNode(a.key);t.scope.push({id:e,kind:"let"});n.push(s.types.expressionStatement(s.types.assignmentExpression("=",s.types.cloneNode(e),a.key)));a.key=s.types.cloneNode(e)}}return n}},6782:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.assertFieldTransformed=assertFieldTransformed;function assertFieldTransformed(e){if(e.node.declare){throw e.buildCodeFrameError(`TypeScript 'declare' fields must first be transformed by `+`@babel/plugin-transform-typescript.\n`+`If you have already enabled that plugin (or '@babel/preset-typescript'), make sure `+`that it runs before any plugin related to additional class features:\n`+` - @babel/plugin-proposal-class-properties\n`+` - @babel/plugin-proposal-private-methods\n`+` - @babel/plugin-proposal-decorators`)}}},3316:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(8622);function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach((function(r){if(r!=="default"){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:true,get:function(){return e[r]}})}}))}t["default"]=e;return Object.freeze(t)}var a=_interopNamespace(s);function willPathCastToBoolean(e){const t=e;const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}class AssignmentMemoiser{constructor(){this._map=void 0;this._map=new WeakMap}has(e){return this._map.has(e)}get(e){if(!this.has(e))return;const t=this._map.get(e);const{value:r}=t;t.count--;if(t.count===0){return a.assignmentExpression("=",r,e)}return r}set(e,t,r){return this._map.set(e,{count:r,value:t})}}function toNonOptional(e,t){const{node:r}=e;if(e.isOptionalMemberExpression()){return a.memberExpression(t,r.property,r.computed)}if(e.isOptionalCallExpression()){const s=e.get("callee");if(e.node.optional&&s.isOptionalMemberExpression()){const{object:n}=s.node;const o=e.scope.maybeGenerateMemoised(n)||n;s.get("object").replaceWith(a.assignmentExpression("=",o,n));return a.callExpression(a.memberExpression(t,a.identifier("call")),[o,...r.arguments])}return a.callExpression(t,r.arguments)}return e.node}function isInDetachedTree(e){while(e){if(e.isProgram())break;const{parentPath:t,container:r,listKey:s}=e;const a=t.node;if(s){if(r!==a[s])return true}else{if(r!==a)return true}e=t}return false}const n={memoise(){},handle(e,t){const{node:r,parent:s,parentPath:n,scope:o}=e;if(e.isOptionalMemberExpression()){if(isInDetachedTree(e))return;const i=e.find((({node:t,parent:r,parentPath:s})=>{if(s.isOptionalMemberExpression()){return r.optional||r.object!==t}if(s.isOptionalCallExpression()){return t!==e.node&&r.optional||r.callee!==t}return true}));if(o.path.isPattern()){i.replaceWith(a.callExpression(a.arrowFunctionExpression([],i.node),[]));return}const l=willPathCastToBoolean(i);const c=i.parentPath;if(c.isUpdateExpression({argument:r})||c.isAssignmentExpression({left:r})){throw e.buildCodeFrameError(`can't handle assignment`)}const u=c.isUnaryExpression({operator:"delete"});if(u&&i.isOptionalMemberExpression()&&i.get("property").isPrivateName()){throw e.buildCodeFrameError(`can't delete a private class element`)}let p=e;for(;;){if(p.isOptionalMemberExpression()){if(p.node.optional)break;p=p.get("object");continue}else if(p.isOptionalCallExpression()){if(p.node.optional)break;p=p.get("callee");continue}throw new Error(`Internal error: unexpected ${p.node.type}`)}const d=p.isOptionalMemberExpression()?"object":"callee";const f=p.node[d];const m=o.maybeGenerateMemoised(f);const y=m!=null?m:f;const g=n.isOptionalCallExpression({callee:r});const h=n.isCallExpression({callee:r});p.replaceWith(toNonOptional(p,y));if(g){if(s.optional){n.replaceWith(this.optionalCall(e,s.arguments))}else{n.replaceWith(this.call(e,s.arguments))}}else if(h){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}let b=e.node;for(let t=e;t!==i;){const{parentPath:e}=t;if(e===i&&g&&s.optional){b=e.node;break}b=toNonOptional(e,b);t=e}let x;const v=i.parentPath;if(a.isMemberExpression(b)&&v.isOptionalCallExpression({callee:i.node,optional:true})){const{object:t}=b;x=e.scope.maybeGenerateMemoised(t);if(x){b.object=a.assignmentExpression("=",x,t)}}let E=i;if(u){E=v;b=v.node}const j=m?a.assignmentExpression("=",a.cloneNode(y),a.cloneNode(f)):a.cloneNode(y);if(l){let e;if(t){e=a.binaryExpression("!=",j,a.nullLiteral())}else{e=a.logicalExpression("&&",a.binaryExpression("!==",j,a.nullLiteral()),a.binaryExpression("!==",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.logicalExpression("&&",e,b))}else{let e;if(t){e=a.binaryExpression("==",j,a.nullLiteral())}else{e=a.logicalExpression("||",a.binaryExpression("===",j,a.nullLiteral()),a.binaryExpression("===",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.conditionalExpression(e,u?a.booleanLiteral(true):o.buildUndefinedNode(),b))}if(x){const e=v.node;v.replaceWith(a.optionalCallExpression(a.optionalMemberExpression(e.callee,a.identifier("call"),false,true),[a.cloneNode(x),...e.arguments],false))}return}if(n.isUpdateExpression({argument:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,prefix:o}=s;this.memoise(e,2);const i=a.binaryExpression(t[0],a.unaryExpression("+",this.get(e)),a.numericLiteral(1));if(o){n.replaceWith(this.set(e,i))}else{const{scope:t}=e;const s=t.generateUidIdentifierBasedOnNode(r);t.push({id:s});i.left=a.assignmentExpression("=",a.cloneNode(s),i.left);n.replaceWith(a.sequenceExpression([this.set(e,i),a.cloneNode(s)]))}return}if(n.isAssignmentExpression({left:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,right:r}=s;if(t==="="){n.replaceWith(this.set(e,r))}else{const s=t.slice(0,-1);if(a.LOGICAL_OPERATORS.includes(s)){this.memoise(e,1);n.replaceWith(a.logicalExpression(s,this.get(e),this.set(e,r)))}else{this.memoise(e,2);n.replaceWith(this.set(e,a.binaryExpression(s,this.get(e),r)))}}return}if(n.isCallExpression({callee:r})){n.replaceWith(this.call(e,s.arguments));return}if(n.isOptionalCallExpression({callee:r})){if(o.path.isPattern()){n.replaceWith(a.callExpression(a.arrowFunctionExpression([],n.node),[]));return}n.replaceWith(this.optionalCall(e,s.arguments));return}if(n.isForXStatement({left:r})||n.isObjectProperty({value:r})&&n.parentPath.isObjectPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isObjectProperty({value:s})&&n.parentPath.parentPath.isObjectPattern()||n.isArrayPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isArrayPattern()||n.isRestElement()){e.replaceWith(this.destructureSet(e));return}e.replaceWith(this.get(e))}};function memberExpressionToFunctions(e,t,r){e.traverse(t,Object.assign({},n,r,{memoiser:new AssignmentMemoiser}))}t["default"]=memberExpressionToFunctions},3852:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.enableFeature=enableFeature;t.hasFeature=hasFeature;t.runtimeKey=t.featuresKey=t.FEATURES=void 0;const r=Object.freeze({unicodeFlag:1<<0,dotAllFlag:1<<1,unicodePropertyEscape:1<<2,namedCaptureGroups:1<<3});t.FEATURES=r;const s="@babel/plugin-regexp-features/featuresKey";t.featuresKey=s;const a="@babel/plugin-regexp-features/runtimeKey";t.runtimeKey=a;function enableFeature(e,t){return e|t}function hasFeature(e,t){return!!(e&t)}},6550:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.createRegExpFeaturePlugin=createRegExpFeaturePlugin;var s=r(5756);var a=r(3852);var n=r(3889);var o=r(8304);var i=r(2155);function pullFlag(e,t){e.flags=e.flags.replace(t,"")}const l="7.14.5".split(".").reduce(((e,t)=>e*1e5+ +t),0);const c="@babel/plugin-regexp-features/version";function createRegExpFeaturePlugin({name:e,feature:t,options:r={}}){return{name:e,pre(){var e;const{file:s}=this;const n=(e=s.get(a.featuresKey))!=null?e:0;let o=(0,a.enableFeature)(n,a.FEATURES[t]);const{useUnicodeFlag:i,runtime:u=true}=r;if(i===false){o=(0,a.enableFeature)(o,a.FEATURES.unicodeFlag)}if(o!==n){s.set(a.featuresKey,o)}if(!u){s.set(a.runtimeKey,false)}if(!s.has(c)||s.get(c){d[e]=t}}r.pattern=s(r.pattern,r.flags,p);if(p.namedGroup&&Object.keys(d).length>0&&u&&!isRegExpTest(e)){const t=o.types.callExpression(this.addHelper("wrapRegExp"),[r,o.types.valueToNode(d)]);(0,i.default)(t);e.replaceWith(t)}if((0,a.hasFeature)(c,a.FEATURES.unicodeFlag)){pullFlag(r,"u")}if((0,a.hasFeature)(c,a.FEATURES.dotAllFlag)){pullFlag(r,"s")}}}}}function isRegExpTest(e){return e.parentPath.isMemberExpression({object:e.node,computed:false})&&e.parentPath.get("property").isIdentifier({name:"test"})}},3889:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generateRegexpuOptions=generateRegexpuOptions;var s=r(3852);function generateRegexpuOptions(e,t){let r=false,a=false,n=false,o=false;const{flags:i,pattern:l}=e;const c=i.includes("u");if(c){if(!(0,s.hasFeature)(t,s.FEATURES.unicodeFlag)){r=true}if((0,s.hasFeature)(t,s.FEATURES.unicodePropertyEscape)&&/\\[pP]{/.test(l)){n=true}}if((0,s.hasFeature)(t,s.FEATURES.dotAllFlag)&&i.indexOf("s")>=0){a=true}if((0,s.hasFeature)(t,s.FEATURES.namedCaptureGroups)&&/\(\?<(?![=!])/.test(l)){o=true}if(!o&&!n&&!a&&(!c||r)){return null}if(c&&i.indexOf("s")>=0){a=true}return{useUnicodeFlag:r,onNamedGroup:()=>{},namedGroup:o,unicodePropertyEscape:n,dotAllFlag:a,lookbehind:true}}},2062:(e,t,r)=>{"use strict";t.__esModule=true;t.stringifyTargetsMultiline=stringifyTargetsMultiline;t.stringifyTargets=stringifyTargets;t.presetEnvSilentDebugHeader=void 0;var s=r(797);const a="#__secret_key__@babel/preset-env__don't_log_debug_header_and_resolved_targets";t.presetEnvSilentDebugHeader=a;function stringifyTargetsMultiline(e){return JSON.stringify((0,s.prettifyTargets)(e),null,2)}function stringifyTargets(e){return JSON.stringify(e).replace(/,/g,", ").replace(/^\{"/,'{ "').replace(/"\}$/,'" }')}},4299:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:a}=s.default||s;class ImportsCache{constructor(e){this._imports=new WeakMap;this._anonymousImports=new WeakMap;this._lastImports=new WeakMap;this._resolver=e}storeAnonymous(e,t,r){const s=this._normalizeKey(e,t);const n=this._ensure(this._anonymousImports,e,Set);if(n.has(s))return;const o=r(e.node.sourceType==="script",a.stringLiteral(this._resolver(t)));n.add(s);this._injectImport(e,o)}storeNamed(e,t,r,s){const n=this._normalizeKey(e,t,r);const o=this._ensure(this._imports,e,Map);if(!o.has(n)){const{node:i,name:l}=s(e.node.sourceType==="script",a.stringLiteral(this._resolver(t)),a.identifier(r));o.set(n,l);this._injectImport(e,i)}return a.identifier(o.get(n))}_injectImport(e,t){let r=this._lastImports.get(e);if(r&&r.node&&r.parent===e.node&&r.container===e.node.body){r=r.insertAfter(t)}else{r=e.unshiftContainer("body",t)}r=r[r.length-1];this._lastImports.set(e,r)}_ensure(e,t,r){let s=e.get(t);if(!s){s=new r;e.set(t,s)}return s}_normalizeKey(e,t,r=""){const{sourceType:s}=e.node;return`${r&&s}::${t}::${r}`}}t["default"]=ImportsCache},8038:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=definePolyfillProvider;var s=r(1403);var a=_interopRequireWildcard(r(797));var n=r(4182);var o=_interopRequireDefault(r(4299));var i=r(2062);var l=r(1522);var c=_interopRequireWildcard(r(9313));var u=_interopRequireWildcard(r(6814));var p=_interopRequireDefault(r(8510));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var r={};var s=Object.keys(e);var a,n;for(n=0;n=0)continue;r[a]=e[a]}return r}const d=a.default.default||a.default;function resolveOptions(e,t){const{method:r,targets:s,ignoreBrowserslistConfig:a,configPath:n,debug:o,shouldInjectPolyfill:i,absoluteImports:l}=e,c=_objectWithoutPropertiesLoose(e,["method","targets","ignoreBrowserslistConfig","configPath","debug","shouldInjectPolyfill","absoluteImports"]);let u;if(r==="usage-global")u="usageGlobal";else if(r==="entry-global")u="entryGlobal";else if(r==="usage-pure")u="usagePure";else if(typeof r!=="string"){throw new Error(".method must be a string")}else{throw new Error(`.method must be one of "entry-global", "usage-global"`+` or "usage-pure" (received ${JSON.stringify(r)})`)}if(typeof i==="function"){if(e.include||e.exclude){throw new Error(`.include and .exclude are not supported when using the`+` .shouldInjectPolyfill function.`)}}else if(i!=null){throw new Error(`.shouldInjectPolyfill must be a function, or undefined`+` (received ${JSON.stringify(i)})`)}if(l!=null&&typeof l!=="boolean"&&typeof l!=="string"){throw new Error(`.absoluteImports must be a boolean, a string, or undefined`+` (received ${JSON.stringify(l)})`)}let p;if(s||n||a){const e=typeof s==="string"||Array.isArray(s)?{browsers:s}:s;p=d(e,{ignoreBrowserslistConfig:a,configPath:n})}else{p=t.targets()}return{method:r,methodName:u,targets:p,absoluteImports:l!=null?l:false,shouldInjectPolyfill:i,debug:!!o,providerOptions:c}}function instantiateProvider(e,t,r,s,i,c){const{method:d,methodName:f,targets:m,debug:y,shouldInjectPolyfill:g,providerOptions:h,absoluteImports:b}=resolveOptions(t,c);const x=(0,n.createUtilsGetter)(new o.default((e=>u.resolve(s,e,b))));let v,E;let j;let w;let _;const S=new Map;const O={babel:c,getUtils:x,method:t.method,targets:m,createMetaResolver:p.default,shouldInjectPolyfill(t){if(w===undefined){throw new Error(`Internal error in the ${e.name} provider: `+`shouldInjectPolyfill() can't be called during initialization.`)}if(!w.has(t)){console.warn(`Internal error in the ${k.name} provider: `+`unknown polyfill "${t}".`)}if(_&&!_(t))return false;let r=(0,a.isRequired)(t,m,{compatData:j,includes:v,excludes:E});if(g){r=g(t,r);if(typeof r!=="boolean"){throw new Error(`.shouldInjectPolyfill must return a boolean.`)}}return r},debug(e){i().found=true;if(!y||!e)return;if(i().polyfills.has(k.name))return;i().polyfills.set(e,j&&e&&j[e])},assertDependency(e,t="*"){if(r===false)return;if(b){return}const a=t==="*"?e:`${e}@^${t}`;const n=r.all?false:mapGetOr(S,`${e} :: ${s}`,(()=>u.has(s,e)));if(!n){i().missingDeps.add(a)}}};const k=e(O,h,s);if(typeof k[f]!=="function"){throw new Error(`The "${k.name||e.name}" provider doesn't `+`support the "${d}" polyfilling method.`)}if(Array.isArray(k.polyfills)){w=new Set(k.polyfills);_=k.filterPolyfills}else if(k.polyfills){w=new Set(Object.keys(k.polyfills));j=k.polyfills;_=k.filterPolyfills}else{w=new Set}({include:v,exclude:E}=(0,l.validateIncludeExclude)(k.name||e.name,w,h.include||[],h.exclude||[]));return{debug:y,method:d,targets:m,provider:k,callProvider(e,t){const r=x(t);k[f](e,r,t)}}}function definePolyfillProvider(e){return(0,s.declare)(((t,r,s)=>{t.assertVersion(7);const{traverse:n}=t;let o;const p=(0,l.applyMissingDependenciesDefaults)(r,t);const{debug:d,method:f,targets:m,provider:y,callProvider:g}=instantiateProvider(e,r,p,s,(()=>o),t);const h=f==="entry-global"?c.entry:c.usage;const b=y.visitor?n.visitors.merge([h(g),y.visitor]):h(g);if(d&&d!==i.presetEnvSilentDebugHeader){console.log(`${y.name}: \`DEBUG\` option`);console.log(`\nUsing targets: ${(0,i.stringifyTargetsMultiline)(m)}`);console.log(`\nUsing polyfills with \`${f}\` method:`)}return{name:"inject-polyfills",visitor:b,pre(){var e;o={polyfills:new Map,found:false,providers:new Set,missingDeps:new Set};(e=y.pre)==null?void 0:e.apply(this,arguments)},post(){var e;(e=y.post)==null?void 0:e.apply(this,arguments);if(p!==false){if(p.log==="per-file"){u.logMissing(o.missingDeps)}else{u.laterLogMissing(o.missingDeps)}}if(!d)return;if(this.filename)console.log(`\n[${this.filename}]`);if(o.polyfills.size===0){console.log(f==="entry-global"?o.found?`Based on your targets, the ${y.name} polyfill did not add any polyfill.`:`The entry point for the ${y.name} polyfill has not been found.`:`Based on your code and targets, the ${y.name} polyfill did not add any polyfill.`);return}if(f==="entry-global"){console.log(`The ${y.name} polyfill entry has been replaced with `+`the following polyfills:`)}else{console.log(`The ${y.name} polyfill added the following polyfills:`)}for(const[e,t]of o.polyfills){if(t){const r=(0,a.getInclusionReasons)(e,m,t);const s=JSON.stringify(r).replace(/,/g,", ").replace(/^\{"/,'{ "').replace(/"\}$/,'" }');console.log(` ${e} ${s}`)}else{console.log(` ${e}`)}}}}}))}function mapGetOr(e,t,r){let s=e.get(t);if(s===undefined){s=r();e.set(t,s)}return s}},8510:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=createMetaResolver;var s=r(4182);const a=new Set(["global","globalThis","self","window"]);function createMetaResolver(e){const{static:t,instance:r,global:n}=e;return e=>{if(e.kind==="global"&&n&&(0,s.has)(n,e.name)){return{kind:"global",desc:n[e.name],name:e.name}}if(e.kind==="property"||e.kind==="in"){const{placement:o,object:i,key:l}=e;if(i&&o==="static"){if(n&&a.has(i)&&(0,s.has)(n,l)){return{kind:"global",desc:n[l],name:l}}if(t&&(0,s.has)(t,i)&&(0,s.has)(t[i],l)){return{kind:"static",desc:t[i][l],name:`${i}$${l}`}}}if(r&&(0,s.has)(r,l)){return{kind:"instance",desc:r[l],name:`${l}`}}}}}},6814:(e,t,r)=>{"use strict";t.__esModule=true;t.resolve=resolve;t.has=has;t.logMissing=logMissing;t.laterLogMissing=laterLogMissing;var s=_interopRequireDefault(r(1017));var a=_interopRequireDefault(r(6240));var n=_interopRequireDefault(r(9820));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const o=parseFloat(process.versions.node)>=8.9;function resolve(e,t,r){if(r===false)return t;let a=e;if(typeof r==="string"){a=s.default.resolve(a,r)}let i,l;let c=t.indexOf("/");if(t[0]==="@"){c=t.indexOf("/",c+1)}if(c===-1){i=t;l=""}else{i=t.slice(0,c);l=t.slice(c)}try{let e;if(o){e=require.resolve(`${i}/package.json`,{paths:[a]})}else{e=n.default.sync(`${i}/package.json`,{basedir:a})}return s.default.dirname(e)+l}catch(r){if(r.code!=="MODULE_NOT_FOUND")throw r;throw Object.assign(new Error(`Failed to resolve "${t}" relative to "${e}"`),{code:"BABEL_POLYFILL_NOT_FOUND",polyfill:t,dirname:e})}}function has(e,t){try{if(o){require.resolve(t,{paths:[e]})}else{n.default.sync(t,{basedir:e})}return true}catch(e){return false}}function logMissing(e){if(e.size===0)return;const t=Array.from(e).sort().join(" ");console.warn("\nSome polyfills have been added but are not present in your dependencies.\n"+"Please run one of the following commands:\n"+`\tnpm install --save ${t}\n`+`\tyarn add ${t}\n`);process.exitCode=1}let i=new Set;const l=(0,a.default)((()=>{logMissing(i);i=new Set}),100);function laterLogMissing(e){if(e.size===0)return;e.forEach((e=>i.add(e)));l()}},1522:(e,t,r)=>{"use strict";t.__esModule=true;t.validateIncludeExclude=validateIncludeExclude;t.applyMissingDependenciesDefaults=applyMissingDependenciesDefaults;var s=r(4182);function patternToRegExp(e){if(e instanceof RegExp)return e;try{return new RegExp(`^${e}$`)}catch(e){return null}}function buildUnusedError(e,t){if(!t.length)return"";return` - The following "${e}" patterns didn't match any polyfill:\n`+t.map((e=>` ${String(e)}\n`)).join("")}function buldDuplicatesError(e){if(!e.size)return"";return` - The following polyfills were matched both by "include" and "exclude" patterns:\n`+Array.from(e,(e=>` ${e}\n`)).join("")}function validateIncludeExclude(e,t,r,a){let n;const filter=e=>{const r=patternToRegExp(e);if(!r)return false;let s=false;for(const e of t){if(r.test(e)){s=true;n.add(e)}}return!s};const o=n=new Set;const i=Array.from(r).filter(filter);const l=n=new Set;const c=Array.from(a).filter(filter);const u=(0,s.intersection)(o,l);if(u.size>0||i.length>0||c.length>0){throw new Error(`Error while validating the "${e}" provider options:\n`+buildUnusedError("include",i)+buildUnusedError("exclude",c)+buldDuplicatesError(u))}return{include:o,exclude:l}}function applyMissingDependenciesDefaults(e,t){const{missingDependencies:r={}}=e;if(r===false)return false;const s=t.caller((e=>e==null?void 0:e.name));const{log:a="deferred",inject:n=(s==="rollup-plugin-babel"?"throw":"import"),all:o=false}=r;return{log:a,inject:n,all:o}}},4182:(e,t,r)=>{"use strict";t.__esModule=true;t.intersection=intersection;t.has=has;t.resolveKey=resolveKey;t.resolveSource=resolveSource;t.getImportSource=getImportSource;t.getRequireSource=getRequireSource;t.createUtilsGetter=createUtilsGetter;var s=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:a,template:n}=s.default||s;function intersection(e,t){const r=new Set;e.forEach((e=>t.has(e)&&r.add(e)));return r}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function getType(e){return Object.prototype.toString.call(e).slice(8,-1)}function resolveId(e){if(e.isIdentifier()&&!e.scope.hasBinding(e.node.name,true)){return e.node.name}const{deopt:t}=e.evaluate();if(t&&t.isIdentifier()){return t.node.name}}function resolveKey(e,t=false){const{node:r,parent:s,scope:a}=e;if(e.isStringLiteral())return r.value;const{name:n}=r;const o=e.isIdentifier();if(o&&!(t||s.computed))return n;if(t&&e.isMemberExpression()&&e.get("object").isIdentifier({name:"Symbol"})&&!a.hasBinding("Symbol",true)){const t=resolveKey(e.get("property"),e.node.computed);if(t)return"Symbol."+t}if(!o||a.hasBinding(n,true)){const{value:t}=e.evaluate();if(typeof t==="string")return t}}function resolveSource(e){if(e.isMemberExpression()&&e.get("property").isIdentifier({name:"prototype"})){const t=resolveId(e.get("object"));if(t){return{id:t,placement:"prototype"}}return{id:null,placement:null}}const t=resolveId(e);if(t){return{id:t,placement:"static"}}const{value:r}=e.evaluate();if(r!==undefined){return{id:getType(r),placement:"prototype"}}else if(e.isRegExpLiteral()){return{id:"RegExp",placement:"prototype"}}else if(e.isFunction()){return{id:"Function",placement:"prototype"}}return{id:null,placement:null}}function getImportSource({node:e}){if(e.specifiers.length===0)return e.source.value}function getRequireSource({node:e}){if(!a.isExpressionStatement(e))return;const{expression:t}=e;const r=a.isCallExpression(t)&&a.isIdentifier(t.callee)&&t.callee.name==="require"&&t.arguments.length===1&&a.isStringLiteral(t.arguments[0]);if(r)return t.arguments[0].value}function hoist(e){e._blockHoist=3;return e}function createUtilsGetter(e){return t=>{const r=t.findParent((e=>e.isProgram()));return{injectGlobalImport(t){e.storeAnonymous(r,t,((e,t)=>e?n.statement.ast`require(${t})`:a.importDeclaration([],t)))},injectNamedImport(t,s,o=s){return e.storeNamed(r,t,s,((e,t,s)=>{const i=r.scope.generateUidIdentifier(o);return{node:e?hoist(n.statement.ast` + `}function buildPrivateMethodDeclaration(e,t,r=false){const a=t.get(e.node.key.id.name);const{id:n,methodId:o,getId:i,setId:l,getterDeclared:c,setterDeclared:u,static:p}=a;const{params:f,body:d,generator:m,async:y}=e.node;const g=i&&!c&&f.length===0;const h=l&&!u&&f.length>0;let b=o;if(g){t.set(e.node.key.id.name,Object.assign({},a,{getterDeclared:true}));b=i}else if(h){t.set(e.node.key.id.name,Object.assign({},a,{setterDeclared:true}));b=l}else if(p&&!r){b=n}return s.types.functionDeclaration(s.types.cloneNode(b),f,d,m,y)}const d=s.traverse.visitors.merge([{ThisExpression(e,t){t.needsClassRef=true;e.replaceWith(s.types.cloneNode(t.classRef))}},a.environmentVisitor]);const m={ReferencedIdentifier(e,t){if(e.scope.bindingIdentifierEquals(e.node.name,t.innerBinding)){t.needsClassRef=true;e.node.name=t.classRef.name}}};function replaceThisContext(e,t,r,n,o,i,l){var c;const u={classRef:t,needsClassRef:false,innerBinding:l};const p=new a.default({methodPath:e,constantSuper:i,file:n,refToPreserve:t,getSuperRef:r,getObjectRef(){u.needsClassRef=true;return o||e.node.static?t:s.types.memberExpression(t,s.types.identifier("prototype"))}});p.replace();if(o||e.isProperty()){e.traverse(d,u)}if((c=u.classRef)!=null&&c.name&&u.classRef.name!==(l==null?void 0:l.name)){e.traverse(m,u)}return u.needsClassRef}function buildFieldsInitNodes(e,t,r,a,n,o,i,c,u){let p=false;let f;const d=[];const m=[];const y=[];const g=s.types.isIdentifier(t)?()=>t:()=>{var e;(e=f)!=null?e:f=r[0].scope.generateUidIdentifierBasedOnNode(t);return f};for(const t of r){l.assertFieldTransformed(t);const r=t.node.static;const f=!r;const h=t.isPrivate();const b=!h;const x=t.isProperty();const v=!x;const E=t.isStaticBlock==null?void 0:t.isStaticBlock();if(r||v&&h||E){const r=replaceThisContext(t,e,g,n,E,c,u);p=p||r}switch(true){case E:d.push(s.template.statement.ast`(() => ${s.types.blockStatement(t.node.body)})()`);break;case r&&h&&x&&i:p=true;d.push(buildPrivateFieldInitLoose(s.types.cloneNode(e),t,a));break;case r&&h&&x&&!i:p=true;d.push(buildPrivateStaticFieldInitSpec(t,a));break;case r&&b&&x&&o:p=true;d.push(buildPublicFieldInitLoose(s.types.cloneNode(e),t));break;case r&&b&&x&&!o:p=true;d.push(buildPublicFieldInitSpec(s.types.cloneNode(e),t,n));break;case f&&h&&x&&i:m.push(buildPrivateFieldInitLoose(s.types.thisExpression(),t,a));break;case f&&h&&x&&!i:m.push(buildPrivateInstanceFieldInitSpec(s.types.thisExpression(),t,a));break;case f&&h&&v&&i:m.unshift(buildPrivateMethodInitLoose(s.types.thisExpression(),t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case f&&h&&v&&!i:m.unshift(buildPrivateInstanceMethodInitSpec(s.types.thisExpression(),t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case r&&h&&v&&!i:p=true;d.unshift(buildPrivateStaticFieldInitSpec(t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case r&&h&&v&&i:p=true;d.unshift(buildPrivateStaticMethodInitLoose(s.types.cloneNode(e),t,n,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case f&&b&&x&&o:m.push(buildPublicFieldInitLoose(s.types.thisExpression(),t));break;case f&&b&&x&&!o:m.push(buildPublicFieldInitSpec(s.types.thisExpression(),t,n));break;default:throw new Error("Unreachable.")}}return{staticNodes:d.filter(Boolean),instanceNodes:m.filter(Boolean),pureStaticNodes:y.filter(Boolean),wrapClass(t){for(const e of r){e.remove()}if(f){t.scope.push({id:s.types.cloneNode(f)});t.set("superClass",s.types.assignmentExpression("=",f,t.node.superClass))}if(!p)return t;if(t.isClassExpression()){t.scope.push({id:e});t.replaceWith(s.types.assignmentExpression("=",s.types.cloneNode(e),t.node))}else if(!t.node.id){t.node.id=e}return t}}}},6758:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.createClassFeaturePlugin=createClassFeaturePlugin;Object.defineProperty(t,"injectInitialization",{enumerable:true,get:function(){return l.injectInitialization}});Object.defineProperty(t,"enableFeature",{enumerable:true,get:function(){return c.enableFeature}});Object.defineProperty(t,"FEATURES",{enumerable:true,get:function(){return c.FEATURES}});var s=r(8304);var a=r(550);var n=r(7058);var o=r(3647);var i=r(6429);var l=r(5617);var c=r(7497);const u="7.14.6".split(".").reduce(((e,t)=>e*1e5+ +t),0);const p="@babel/plugin-class-features/version";function createClassFeaturePlugin({name:e,feature:t,loose:r,manipulateOptions:f,api:d={assumption:()=>{}}}){const m=d.assumption("setPublicClassFields");const y=d.assumption("privateFieldsAsProperties");const g=d.assumption("constantSuper");const h=d.assumption("noDocumentAll");if(r===true){const t=[];if(m!==undefined){t.push(`"setPublicClassFields"`)}if(y!==undefined){t.push(`"privateFieldsAsProperties"`)}if(t.length!==0){console.warn(`[${e}]: You are using the "loose: true" option and you are`+` explicitly setting a value for the ${t.join(" and ")}`+` assumption${t.length>1?"s":""}. The "loose" option`+` can cause incompatibilities with the other class features`+` plugins, so it's recommended that you replace it with the`+` following top-level option:\n`+`\t"assumptions": {\n`+`\t\t"setPublicClassFields": true,\n`+`\t\t"privateFieldsAsProperties": true\n`+`\t}`)}}return{name:e,manipulateOptions:f,pre(){(0,c.enableFeature)(this.file,t,r);if(!this.file.get(p)||this.file.get(p)0){(0,l.injectInitialization)(e,f,D,((e,t)=>{if(d)return;for(const r of b){if(r.node.static)continue;r.traverse(e,t)}}))}e=C(e);e.insertBefore([...k,...O]);if(I.length>0){e.insertAfter(I)}if(P.length>0){e.find((e=>e.isStatement()||e.isDeclaration())).insertAfter(P)}},PrivateName(e){if(this.file.get(p)!==u||e.parentPath.isPrivate({key:e.node})){return}throw e.buildCodeFrameError(`Unknown PrivateName "${e}"`)},ExportDefaultDeclaration(e){if(this.file.get(p)!==u)return;const t=e.get("declaration");if(t.isClassDeclaration()&&(0,i.hasDecorators)(t.node)){if(t.node.id){(0,n.default)(e)}else{t.node.type="ClassExpression"}}}}}}},5617:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.injectInitialization=injectInitialization;t.extractComputedKeys=extractComputedKeys;var s=r(8304);var a=r(6833);const n=s.traverse.visitors.merge([{Super(e){const{node:t,parentPath:r}=e;if(r.isCallExpression({callee:t})){this.push(r)}}},a.environmentVisitor]);const o={"TSTypeAnnotation|TypeAnnotation"(e){e.skip()},ReferencedIdentifier(e){if(this.scope.hasOwnBinding(e.node.name)){this.scope.rename(e.node.name);e.skip()}}};function handleClassTDZ(e,t){if(t.classBinding&&t.classBinding===e.scope.getBinding(e.node.name)){const r=t.file.addHelper("classNameTDZError");const a=s.types.callExpression(r,[s.types.stringLiteral(e.node.name)]);e.replaceWith(s.types.sequenceExpression([a,e.node]));e.skip()}}const i={ReferencedIdentifier:handleClassTDZ};function injectInitialization(e,t,r,a){if(!r.length)return;const i=!!e.node.superClass;if(!t){const r=s.types.classMethod("constructor",s.types.identifier("constructor"),[],s.types.blockStatement([]));if(i){r.params=[s.types.restElement(s.types.identifier("args"))];r.body.body.push(s.template.statement.ast`super(...args)`)}[t]=e.get("body").unshiftContainer("body",r)}if(a){a(o,{scope:t.scope})}if(i){const e=[];t.traverse(n,e);let a=true;for(const t of e){if(a){t.insertAfter(r);a=false}else{t.insertAfter(r.map((e=>s.types.cloneNode(e))))}}}else{t.get("body").unshiftContainer("body",r)}}function extractComputedKeys(e,t,r,a){const n=[];const o={classBinding:t.node.id&&t.scope.getBinding(t.node.id.name),file:a};for(const e of r){const r=e.get("key");if(r.isReferencedIdentifier()){handleClassTDZ(r,o)}else{r.traverse(i,o)}const a=e.node;if(!r.isConstantExpression()){const e=t.scope.generateUidIdentifierBasedOnNode(a.key);t.scope.push({id:e,kind:"let"});n.push(s.types.expressionStatement(s.types.assignmentExpression("=",s.types.cloneNode(e),a.key)));a.key=s.types.cloneNode(e)}}return n}},6339:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.assertFieldTransformed=assertFieldTransformed;function assertFieldTransformed(e){if(e.node.declare){throw e.buildCodeFrameError(`TypeScript 'declare' fields must first be transformed by `+`@babel/plugin-transform-typescript.\n`+`If you have already enabled that plugin (or '@babel/preset-typescript'), make sure `+`that it runs before any plugin related to additional class features:\n`+` - @babel/plugin-proposal-class-properties\n`+` - @babel/plugin-proposal-private-methods\n`+` - @babel/plugin-proposal-decorators`)}}},3316:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(8622);function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach((function(r){if(r!=="default"){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:true,get:function(){return e[r]}})}}))}t["default"]=e;return Object.freeze(t)}var a=_interopNamespace(s);function willPathCastToBoolean(e){const t=e;const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}class AssignmentMemoiser{constructor(){this._map=void 0;this._map=new WeakMap}has(e){return this._map.has(e)}get(e){if(!this.has(e))return;const t=this._map.get(e);const{value:r}=t;t.count--;if(t.count===0){return a.assignmentExpression("=",r,e)}return r}set(e,t,r){return this._map.set(e,{count:r,value:t})}}function toNonOptional(e,t){const{node:r}=e;if(e.isOptionalMemberExpression()){return a.memberExpression(t,r.property,r.computed)}if(e.isOptionalCallExpression()){const s=e.get("callee");if(e.node.optional&&s.isOptionalMemberExpression()){const{object:n}=s.node;const o=e.scope.maybeGenerateMemoised(n)||n;s.get("object").replaceWith(a.assignmentExpression("=",o,n));return a.callExpression(a.memberExpression(t,a.identifier("call")),[o,...r.arguments])}return a.callExpression(t,r.arguments)}return e.node}function isInDetachedTree(e){while(e){if(e.isProgram())break;const{parentPath:t,container:r,listKey:s}=e;const a=t.node;if(s){if(r!==a[s])return true}else{if(r!==a)return true}e=t}return false}const n={memoise(){},handle(e,t){const{node:r,parent:s,parentPath:n,scope:o}=e;if(e.isOptionalMemberExpression()){if(isInDetachedTree(e))return;const i=e.find((({node:t,parent:r,parentPath:s})=>{if(s.isOptionalMemberExpression()){return r.optional||r.object!==t}if(s.isOptionalCallExpression()){return t!==e.node&&r.optional||r.callee!==t}return true}));if(o.path.isPattern()){i.replaceWith(a.callExpression(a.arrowFunctionExpression([],i.node),[]));return}const l=willPathCastToBoolean(i);const c=i.parentPath;if(c.isUpdateExpression({argument:r})||c.isAssignmentExpression({left:r})){throw e.buildCodeFrameError(`can't handle assignment`)}const u=c.isUnaryExpression({operator:"delete"});if(u&&i.isOptionalMemberExpression()&&i.get("property").isPrivateName()){throw e.buildCodeFrameError(`can't delete a private class element`)}let p=e;for(;;){if(p.isOptionalMemberExpression()){if(p.node.optional)break;p=p.get("object");continue}else if(p.isOptionalCallExpression()){if(p.node.optional)break;p=p.get("callee");continue}throw new Error(`Internal error: unexpected ${p.node.type}`)}const f=p.isOptionalMemberExpression()?"object":"callee";const d=p.node[f];const m=o.maybeGenerateMemoised(d);const y=m!=null?m:d;const g=n.isOptionalCallExpression({callee:r});const h=n.isCallExpression({callee:r});p.replaceWith(toNonOptional(p,y));if(g){if(s.optional){n.replaceWith(this.optionalCall(e,s.arguments))}else{n.replaceWith(this.call(e,s.arguments))}}else if(h){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}let b=e.node;for(let t=e;t!==i;){const{parentPath:e}=t;if(e===i&&g&&s.optional){b=e.node;break}b=toNonOptional(e,b);t=e}let x;const v=i.parentPath;if(a.isMemberExpression(b)&&v.isOptionalCallExpression({callee:i.node,optional:true})){const{object:t}=b;x=e.scope.maybeGenerateMemoised(t);if(x){b.object=a.assignmentExpression("=",x,t)}}let E=i;if(u){E=v;b=v.node}const j=m?a.assignmentExpression("=",a.cloneNode(y),a.cloneNode(d)):a.cloneNode(y);if(l){let e;if(t){e=a.binaryExpression("!=",j,a.nullLiteral())}else{e=a.logicalExpression("&&",a.binaryExpression("!==",j,a.nullLiteral()),a.binaryExpression("!==",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.logicalExpression("&&",e,b))}else{let e;if(t){e=a.binaryExpression("==",j,a.nullLiteral())}else{e=a.logicalExpression("||",a.binaryExpression("===",j,a.nullLiteral()),a.binaryExpression("===",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.conditionalExpression(e,u?a.booleanLiteral(true):o.buildUndefinedNode(),b))}if(x){const e=v.node;v.replaceWith(a.optionalCallExpression(a.optionalMemberExpression(e.callee,a.identifier("call"),false,true),[a.cloneNode(x),...e.arguments],false))}return}if(n.isUpdateExpression({argument:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,prefix:o}=s;this.memoise(e,2);const i=a.binaryExpression(t[0],a.unaryExpression("+",this.get(e)),a.numericLiteral(1));if(o){n.replaceWith(this.set(e,i))}else{const{scope:t}=e;const s=t.generateUidIdentifierBasedOnNode(r);t.push({id:s});i.left=a.assignmentExpression("=",a.cloneNode(s),i.left);n.replaceWith(a.sequenceExpression([this.set(e,i),a.cloneNode(s)]))}return}if(n.isAssignmentExpression({left:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,right:r}=s;if(t==="="){n.replaceWith(this.set(e,r))}else{const s=t.slice(0,-1);if(a.LOGICAL_OPERATORS.includes(s)){this.memoise(e,1);n.replaceWith(a.logicalExpression(s,this.get(e),this.set(e,r)))}else{this.memoise(e,2);n.replaceWith(this.set(e,a.binaryExpression(s,this.get(e),r)))}}return}if(n.isCallExpression({callee:r})){n.replaceWith(this.call(e,s.arguments));return}if(n.isOptionalCallExpression({callee:r})){if(o.path.isPattern()){n.replaceWith(a.callExpression(a.arrowFunctionExpression([],n.node),[]));return}n.replaceWith(this.optionalCall(e,s.arguments));return}if(n.isForXStatement({left:r})||n.isObjectProperty({value:r})&&n.parentPath.isObjectPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isObjectProperty({value:s})&&n.parentPath.parentPath.isObjectPattern()||n.isArrayPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isArrayPattern()||n.isRestElement()){e.replaceWith(this.destructureSet(e));return}e.replaceWith(this.get(e))}};function memberExpressionToFunctions(e,t,r){e.traverse(t,Object.assign({},n,r,{memoiser:new AssignmentMemoiser}))}t["default"]=memberExpressionToFunctions},3852:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.enableFeature=enableFeature;t.hasFeature=hasFeature;t.runtimeKey=t.featuresKey=t.FEATURES=void 0;const r=Object.freeze({unicodeFlag:1<<0,dotAllFlag:1<<1,unicodePropertyEscape:1<<2,namedCaptureGroups:1<<3});t.FEATURES=r;const s="@babel/plugin-regexp-features/featuresKey";t.featuresKey=s;const a="@babel/plugin-regexp-features/runtimeKey";t.runtimeKey=a;function enableFeature(e,t){return e|t}function hasFeature(e,t){return!!(e&t)}},6550:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.createRegExpFeaturePlugin=createRegExpFeaturePlugin;var s=r(5756);var a=r(3852);var n=r(3889);var o=r(8304);var i=r(2155);function pullFlag(e,t){e.flags=e.flags.replace(t,"")}const l="7.14.5".split(".").reduce(((e,t)=>e*1e5+ +t),0);const c="@babel/plugin-regexp-features/version";function createRegExpFeaturePlugin({name:e,feature:t,options:r={}}){return{name:e,pre(){var e;const{file:s}=this;const n=(e=s.get(a.featuresKey))!=null?e:0;let o=(0,a.enableFeature)(n,a.FEATURES[t]);const{useUnicodeFlag:i,runtime:u=true}=r;if(i===false){o=(0,a.enableFeature)(o,a.FEATURES.unicodeFlag)}if(o!==n){s.set(a.featuresKey,o)}if(!u){s.set(a.runtimeKey,false)}if(!s.has(c)||s.get(c){f[e]=t}}r.pattern=s(r.pattern,r.flags,p);if(p.namedGroup&&Object.keys(f).length>0&&u&&!isRegExpTest(e)){const t=o.types.callExpression(this.addHelper("wrapRegExp"),[r,o.types.valueToNode(f)]);(0,i.default)(t);e.replaceWith(t)}if((0,a.hasFeature)(c,a.FEATURES.unicodeFlag)){pullFlag(r,"u")}if((0,a.hasFeature)(c,a.FEATURES.dotAllFlag)){pullFlag(r,"s")}}}}}function isRegExpTest(e){return e.parentPath.isMemberExpression({object:e.node,computed:false})&&e.parentPath.get("property").isIdentifier({name:"test"})}},3889:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generateRegexpuOptions=generateRegexpuOptions;var s=r(3852);function generateRegexpuOptions(e,t){let r=false,a=false,n=false,o=false;const{flags:i,pattern:l}=e;const c=i.includes("u");if(c){if(!(0,s.hasFeature)(t,s.FEATURES.unicodeFlag)){r=true}if((0,s.hasFeature)(t,s.FEATURES.unicodePropertyEscape)&&/\\[pP]{/.test(l)){n=true}}if((0,s.hasFeature)(t,s.FEATURES.dotAllFlag)&&i.indexOf("s")>=0){a=true}if((0,s.hasFeature)(t,s.FEATURES.namedCaptureGroups)&&/\(\?<(?![=!])/.test(l)){o=true}if(!o&&!n&&!a&&(!c||r)){return null}if(c&&i.indexOf("s")>=0){a=true}return{useUnicodeFlag:r,onNamedGroup:()=>{},namedGroup:o,unicodePropertyEscape:n,dotAllFlag:a,lookbehind:true}}},2062:(e,t,r)=>{"use strict";t.__esModule=true;t.stringifyTargetsMultiline=stringifyTargetsMultiline;t.stringifyTargets=stringifyTargets;t.presetEnvSilentDebugHeader=void 0;var s=r(797);const a="#__secret_key__@babel/preset-env__don't_log_debug_header_and_resolved_targets";t.presetEnvSilentDebugHeader=a;function stringifyTargetsMultiline(e){return JSON.stringify((0,s.prettifyTargets)(e),null,2)}function stringifyTargets(e){return JSON.stringify(e).replace(/,/g,", ").replace(/^\{"/,'{ "').replace(/"\}$/,'" }')}},4299:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:a}=s.default||s;class ImportsCache{constructor(e){this._imports=new WeakMap;this._anonymousImports=new WeakMap;this._lastImports=new WeakMap;this._resolver=e}storeAnonymous(e,t,r){const s=this._normalizeKey(e,t);const n=this._ensure(this._anonymousImports,e,Set);if(n.has(s))return;const o=r(e.node.sourceType==="script",a.stringLiteral(this._resolver(t)));n.add(s);this._injectImport(e,o)}storeNamed(e,t,r,s){const n=this._normalizeKey(e,t,r);const o=this._ensure(this._imports,e,Map);if(!o.has(n)){const{node:i,name:l}=s(e.node.sourceType==="script",a.stringLiteral(this._resolver(t)),a.identifier(r));o.set(n,l);this._injectImport(e,i)}return a.identifier(o.get(n))}_injectImport(e,t){let r=this._lastImports.get(e);if(r&&r.node&&r.parent===e.node&&r.container===e.node.body){r=r.insertAfter(t)}else{r=e.unshiftContainer("body",t)}r=r[r.length-1];this._lastImports.set(e,r)}_ensure(e,t,r){let s=e.get(t);if(!s){s=new r;e.set(t,s)}return s}_normalizeKey(e,t,r=""){const{sourceType:s}=e.node;return`${r&&s}::${t}::${r}`}}t["default"]=ImportsCache},8038:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=definePolyfillProvider;var s=r(1403);var a=_interopRequireWildcard(r(797));var n=r(4182);var o=_interopRequireDefault(r(4299));var i=r(2062);var l=r(1522);var c=_interopRequireWildcard(r(9313));var u=_interopRequireWildcard(r(6814));var p=_interopRequireDefault(r(8510));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var r={};var s=Object.keys(e);var a,n;for(n=0;n=0)continue;r[a]=e[a]}return r}const f=a.default.default||a.default;function resolveOptions(e,t){const{method:r,targets:s,ignoreBrowserslistConfig:a,configPath:n,debug:o,shouldInjectPolyfill:i,absoluteImports:l}=e,c=_objectWithoutPropertiesLoose(e,["method","targets","ignoreBrowserslistConfig","configPath","debug","shouldInjectPolyfill","absoluteImports"]);let u;if(r==="usage-global")u="usageGlobal";else if(r==="entry-global")u="entryGlobal";else if(r==="usage-pure")u="usagePure";else if(typeof r!=="string"){throw new Error(".method must be a string")}else{throw new Error(`.method must be one of "entry-global", "usage-global"`+` or "usage-pure" (received ${JSON.stringify(r)})`)}if(typeof i==="function"){if(e.include||e.exclude){throw new Error(`.include and .exclude are not supported when using the`+` .shouldInjectPolyfill function.`)}}else if(i!=null){throw new Error(`.shouldInjectPolyfill must be a function, or undefined`+` (received ${JSON.stringify(i)})`)}if(l!=null&&typeof l!=="boolean"&&typeof l!=="string"){throw new Error(`.absoluteImports must be a boolean, a string, or undefined`+` (received ${JSON.stringify(l)})`)}let p;if(s||n||a){const e=typeof s==="string"||Array.isArray(s)?{browsers:s}:s;p=f(e,{ignoreBrowserslistConfig:a,configPath:n})}else{p=t.targets()}return{method:r,methodName:u,targets:p,absoluteImports:l!=null?l:false,shouldInjectPolyfill:i,debug:!!o,providerOptions:c}}function instantiateProvider(e,t,r,s,i,c){const{method:f,methodName:d,targets:m,debug:y,shouldInjectPolyfill:g,providerOptions:h,absoluteImports:b}=resolveOptions(t,c);const x=(0,n.createUtilsGetter)(new o.default((e=>u.resolve(s,e,b))));let v,E;let j;let w;let _;const S=new Map;const k={babel:c,getUtils:x,method:t.method,targets:m,createMetaResolver:p.default,shouldInjectPolyfill(t){if(w===undefined){throw new Error(`Internal error in the ${e.name} provider: `+`shouldInjectPolyfill() can't be called during initialization.`)}if(!w.has(t)){console.warn(`Internal error in the ${O.name} provider: `+`unknown polyfill "${t}".`)}if(_&&!_(t))return false;let r=(0,a.isRequired)(t,m,{compatData:j,includes:v,excludes:E});if(g){r=g(t,r);if(typeof r!=="boolean"){throw new Error(`.shouldInjectPolyfill must return a boolean.`)}}return r},debug(e){i().found=true;if(!y||!e)return;if(i().polyfills.has(O.name))return;i().polyfills.set(e,j&&e&&j[e])},assertDependency(e,t="*"){if(r===false)return;if(b){return}const a=t==="*"?e:`${e}@^${t}`;const n=r.all?false:mapGetOr(S,`${e} :: ${s}`,(()=>u.has(s,e)));if(!n){i().missingDeps.add(a)}}};const O=e(k,h,s);if(typeof O[d]!=="function"){throw new Error(`The "${O.name||e.name}" provider doesn't `+`support the "${f}" polyfilling method.`)}if(Array.isArray(O.polyfills)){w=new Set(O.polyfills);_=O.filterPolyfills}else if(O.polyfills){w=new Set(Object.keys(O.polyfills));j=O.polyfills;_=O.filterPolyfills}else{w=new Set}({include:v,exclude:E}=(0,l.validateIncludeExclude)(O.name||e.name,w,h.include||[],h.exclude||[]));return{debug:y,method:f,targets:m,provider:O,callProvider(e,t){const r=x(t);O[d](e,r,t)}}}function definePolyfillProvider(e){return(0,s.declare)(((t,r,s)=>{t.assertVersion(7);const{traverse:n}=t;let o;const p=(0,l.applyMissingDependenciesDefaults)(r,t);const{debug:f,method:d,targets:m,provider:y,callProvider:g}=instantiateProvider(e,r,p,s,(()=>o),t);const h=d==="entry-global"?c.entry:c.usage;const b=y.visitor?n.visitors.merge([h(g),y.visitor]):h(g);if(f&&f!==i.presetEnvSilentDebugHeader){console.log(`${y.name}: \`DEBUG\` option`);console.log(`\nUsing targets: ${(0,i.stringifyTargetsMultiline)(m)}`);console.log(`\nUsing polyfills with \`${d}\` method:`)}return{name:"inject-polyfills",visitor:b,pre(){var e;o={polyfills:new Map,found:false,providers:new Set,missingDeps:new Set};(e=y.pre)==null?void 0:e.apply(this,arguments)},post(){var e;(e=y.post)==null?void 0:e.apply(this,arguments);if(p!==false){if(p.log==="per-file"){u.logMissing(o.missingDeps)}else{u.laterLogMissing(o.missingDeps)}}if(!f)return;if(this.filename)console.log(`\n[${this.filename}]`);if(o.polyfills.size===0){console.log(d==="entry-global"?o.found?`Based on your targets, the ${y.name} polyfill did not add any polyfill.`:`The entry point for the ${y.name} polyfill has not been found.`:`Based on your code and targets, the ${y.name} polyfill did not add any polyfill.`);return}if(d==="entry-global"){console.log(`The ${y.name} polyfill entry has been replaced with `+`the following polyfills:`)}else{console.log(`The ${y.name} polyfill added the following polyfills:`)}for(const[e,t]of o.polyfills){if(t){const r=(0,a.getInclusionReasons)(e,m,t);const s=JSON.stringify(r).replace(/,/g,", ").replace(/^\{"/,'{ "').replace(/"\}$/,'" }');console.log(` ${e} ${s}`)}else{console.log(` ${e}`)}}}}}))}function mapGetOr(e,t,r){let s=e.get(t);if(s===undefined){s=r();e.set(t,s)}return s}},8510:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=createMetaResolver;var s=r(4182);const a=new Set(["global","globalThis","self","window"]);function createMetaResolver(e){const{static:t,instance:r,global:n}=e;return e=>{if(e.kind==="global"&&n&&(0,s.has)(n,e.name)){return{kind:"global",desc:n[e.name],name:e.name}}if(e.kind==="property"||e.kind==="in"){const{placement:o,object:i,key:l}=e;if(i&&o==="static"){if(n&&a.has(i)&&(0,s.has)(n,l)){return{kind:"global",desc:n[l],name:l}}if(t&&(0,s.has)(t,i)&&(0,s.has)(t[i],l)){return{kind:"static",desc:t[i][l],name:`${i}$${l}`}}}if(r&&(0,s.has)(r,l)){return{kind:"instance",desc:r[l],name:`${l}`}}}}}},6814:(e,t,r)=>{"use strict";t.__esModule=true;t.resolve=resolve;t.has=has;t.logMissing=logMissing;t.laterLogMissing=laterLogMissing;var s=_interopRequireDefault(r(1017));var a=_interopRequireDefault(r(6240));var n=_interopRequireDefault(r(9820));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const o=parseFloat(process.versions.node)>=8.9;function resolve(e,t,r){if(r===false)return t;let a=e;if(typeof r==="string"){a=s.default.resolve(a,r)}let i,l;let c=t.indexOf("/");if(t[0]==="@"){c=t.indexOf("/",c+1)}if(c===-1){i=t;l=""}else{i=t.slice(0,c);l=t.slice(c)}try{let e;if(o){e=require.resolve(`${i}/package.json`,{paths:[a]})}else{e=n.default.sync(`${i}/package.json`,{basedir:a})}return s.default.dirname(e)+l}catch(r){if(r.code!=="MODULE_NOT_FOUND")throw r;throw Object.assign(new Error(`Failed to resolve "${t}" relative to "${e}"`),{code:"BABEL_POLYFILL_NOT_FOUND",polyfill:t,dirname:e})}}function has(e,t){try{if(o){require.resolve(t,{paths:[e]})}else{n.default.sync(t,{basedir:e})}return true}catch(e){return false}}function logMissing(e){if(e.size===0)return;const t=Array.from(e).sort().join(" ");console.warn("\nSome polyfills have been added but are not present in your dependencies.\n"+"Please run one of the following commands:\n"+`\tnpm install --save ${t}\n`+`\tyarn add ${t}\n`);process.exitCode=1}let i=new Set;const l=(0,a.default)((()=>{logMissing(i);i=new Set}),100);function laterLogMissing(e){if(e.size===0)return;e.forEach((e=>i.add(e)));l()}},1522:(e,t,r)=>{"use strict";t.__esModule=true;t.validateIncludeExclude=validateIncludeExclude;t.applyMissingDependenciesDefaults=applyMissingDependenciesDefaults;var s=r(4182);function patternToRegExp(e){if(e instanceof RegExp)return e;try{return new RegExp(`^${e}$`)}catch(e){return null}}function buildUnusedError(e,t){if(!t.length)return"";return` - The following "${e}" patterns didn't match any polyfill:\n`+t.map((e=>` ${String(e)}\n`)).join("")}function buldDuplicatesError(e){if(!e.size)return"";return` - The following polyfills were matched both by "include" and "exclude" patterns:\n`+Array.from(e,(e=>` ${e}\n`)).join("")}function validateIncludeExclude(e,t,r,a){let n;const filter=e=>{const r=patternToRegExp(e);if(!r)return false;let s=false;for(const e of t){if(r.test(e)){s=true;n.add(e)}}return!s};const o=n=new Set;const i=Array.from(r).filter(filter);const l=n=new Set;const c=Array.from(a).filter(filter);const u=(0,s.intersection)(o,l);if(u.size>0||i.length>0||c.length>0){throw new Error(`Error while validating the "${e}" provider options:\n`+buildUnusedError("include",i)+buildUnusedError("exclude",c)+buldDuplicatesError(u))}return{include:o,exclude:l}}function applyMissingDependenciesDefaults(e,t){const{missingDependencies:r={}}=e;if(r===false)return false;const s=t.caller((e=>e==null?void 0:e.name));const{log:a="deferred",inject:n=(s==="rollup-plugin-babel"?"throw":"import"),all:o=false}=r;return{log:a,inject:n,all:o}}},4182:(e,t,r)=>{"use strict";t.__esModule=true;t.intersection=intersection;t.has=has;t.resolveKey=resolveKey;t.resolveSource=resolveSource;t.getImportSource=getImportSource;t.getRequireSource=getRequireSource;t.createUtilsGetter=createUtilsGetter;var s=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:a,template:n}=s.default||s;function intersection(e,t){const r=new Set;e.forEach((e=>t.has(e)&&r.add(e)));return r}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function getType(e){return Object.prototype.toString.call(e).slice(8,-1)}function resolveId(e){if(e.isIdentifier()&&!e.scope.hasBinding(e.node.name,true)){return e.node.name}const{deopt:t}=e.evaluate();if(t&&t.isIdentifier()){return t.node.name}}function resolveKey(e,t=false){const{node:r,parent:s,scope:a}=e;if(e.isStringLiteral())return r.value;const{name:n}=r;const o=e.isIdentifier();if(o&&!(t||s.computed))return n;if(t&&e.isMemberExpression()&&e.get("object").isIdentifier({name:"Symbol"})&&!a.hasBinding("Symbol",true)){const t=resolveKey(e.get("property"),e.node.computed);if(t)return"Symbol."+t}if(!o||a.hasBinding(n,true)){const{value:t}=e.evaluate();if(typeof t==="string")return t}}function resolveSource(e){if(e.isMemberExpression()&&e.get("property").isIdentifier({name:"prototype"})){const t=resolveId(e.get("object"));if(t){return{id:t,placement:"prototype"}}return{id:null,placement:null}}const t=resolveId(e);if(t){return{id:t,placement:"static"}}const{value:r}=e.evaluate();if(r!==undefined){return{id:getType(r),placement:"prototype"}}else if(e.isRegExpLiteral()){return{id:"RegExp",placement:"prototype"}}else if(e.isFunction()){return{id:"Function",placement:"prototype"}}return{id:null,placement:null}}function getImportSource({node:e}){if(e.specifiers.length===0)return e.source.value}function getRequireSource({node:e}){if(!a.isExpressionStatement(e))return;const{expression:t}=e;const r=a.isCallExpression(t)&&a.isIdentifier(t.callee)&&t.callee.name==="require"&&t.arguments.length===1&&a.isStringLiteral(t.arguments[0]);if(r)return t.arguments[0].value}function hoist(e){e._blockHoist=3;return e}function createUtilsGetter(e){return t=>{const r=t.findParent((e=>e.isProgram()));return{injectGlobalImport(t){e.storeAnonymous(r,t,((e,t)=>e?n.statement.ast`require(${t})`:a.importDeclaration([],t)))},injectNamedImport(t,s,o=s){return e.storeNamed(r,t,s,((e,t,s)=>{const i=r.scope.generateUidIdentifier(o);return{node:e?hoist(n.statement.ast` var ${i} = require(${t}).${s} - `):a.importDeclaration([a.importSpecifier(i,s)],t),name:i.name}}))},injectDefaultImport(t,s=t){return e.storeNamed(r,t,"default",((e,t)=>{const o=r.scope.generateUidIdentifier(s);return{node:e?hoist(n.statement.ast`var ${o} = require(${t})`):a.importDeclaration([a.importDefaultSpecifier(o)],t),name:o.name}}))}}}}},8160:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=r(4182);var _default=e=>({ImportDeclaration(t){const r=(0,s.getImportSource)(t);if(!r)return;e({kind:"import",source:r},t)},Program(t){t.get("body").forEach((t=>{const r=(0,s.getRequireSource)(t);if(!r)return;e({kind:"import",source:r},t)}))}});t["default"]=_default},9313:(e,t,r)=>{"use strict";t.__esModule=true;t.entry=t.usage=void 0;var s=_interopRequireDefault(r(6527));t.usage=s.default;var a=_interopRequireDefault(r(8160));t.entry=a.default;function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}},6527:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=r(4182);var _default=e=>{function property(t,r,s,a){return e({kind:"property",object:t,key:r,placement:s},a)}return{ReferencedIdentifier(t){const{node:{name:r},scope:s}=t;if(s.getBindingIdentifier(r))return;e({kind:"global",name:r},t)},MemberExpression(e){const t=(0,s.resolveKey)(e.get("property"),e.node.computed);if(!t||t==="prototype")return;const r=e.get("object");const a=r.scope.getBinding(r.node.name);if(a&&a.path.isImportNamespaceSpecifier())return;const n=(0,s.resolveSource)(r);return property(n.id,t,n.placement,e)},ObjectPattern(e){const{parentPath:t,parent:r}=e;let a;if(t.isVariableDeclarator()){a=t.get("init")}else if(t.isAssignmentExpression()){a=t.get("right")}else if(t.isFunction()){const s=t.parentPath;if(s.isCallExpression()||s.isNewExpression()){if(s.node.callee===r){a=s.get("arguments")[e.key]}}}let n=null;let o=null;if(a)({id:n,placement:o}=(0,s.resolveSource)(a));for(const t of e.get("properties")){if(t.isObjectProperty()){const e=(0,s.resolveKey)(t.get("key"));if(e)property(n,e,o,t)}}},BinaryExpression(t){if(t.node.operator!=="in")return;const r=(0,s.resolveSource)(t.get("right"));const a=(0,s.resolveKey)(t.get("left"),true);if(!a)return;e({kind:"in",object:r.id,key:a,placement:r.placement},t)}}};t["default"]=_default},1403:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9820:(e,t,r)=>{var s=r(7462);s.core=r(9118);s.isCore=r(779);s.sync=r(5565);e.exports=s},7462:(e,t,r)=>{var s=r(7147);var a=r(1017);var n=r(7673);var o=r(7901);var i=r(7023);var l=r(8746);var c=s.realpath&&typeof s.realpath.native==="function"?s.realpath.native:s.realpath;var u=function isFile(e,t){s.stat(e,(function(e,r){if(!e){return t(null,r.isFile()||r.isFIFO())}if(e.code==="ENOENT"||e.code==="ENOTDIR")return t(null,false);return t(e)}))};var p=function isDirectory(e,t){s.stat(e,(function(e,r){if(!e){return t(null,r.isDirectory())}if(e.code==="ENOENT"||e.code==="ENOTDIR")return t(null,false);return t(e)}))};var d=function realpath(e,t){c(e,(function(r,s){if(r&&r.code!=="ENOENT")t(r);else t(null,r?e:s)}))};var f=function maybeRealpath(e,t,r,s){if(r&&r.preserveSymlinks===false){e(t,s)}else{s(null,t)}};var m=function defaultReadPackage(e,t,r){e(t,(function(e,t){if(e)r(e);else{try{var s=JSON.parse(t);r(null,s)}catch(e){r(null)}}}))};var y=function getPackageCandidates(e,t,r){var s=o(t,r,e);for(var n=0;n{e.exports=function(){var e=Error.prepareStackTrace;Error.prepareStackTrace=function(e,t){return t};var t=(new Error).stack;Error.prepareStackTrace=e;return t[2].getFileName()}},9118:(e,t,r)=>{var s=process.versions&&process.versions.node&&process.versions.node.split(".")||[];function specifierIncluded(e){var t=e.split(" ");var r=t.length>1?t[0]:"=";var a=(t.length>1?t[1]:t[0]).split(".");for(var n=0;n<3;++n){var o=parseInt(s[n]||0,10);var i=parseInt(a[n]||0,10);if(o===i){continue}if(r==="<"){return o="){return o>=i}else{return false}}return r===">="}function matchesRange(e){var t=e.split(/ ?&& ?/);if(t.length===0){return false}for(var r=0;r{var s=r(8746);e.exports=function isCore(e){return s(e)}},7901:(e,t,r)=>{var s=r(1017);var a=s.parse||r(2742);var n=function getNodeModulesDirs(e,t){var r="/";if(/^([A-Za-z]:)/.test(e)){r=""}else if(/^\\\\/.test(e)){r="\\\\"}var n=[e];var o=a(e);while(o.dir!==n[n.length-1]){n.push(o.dir);o=a(o.dir)}return n.reduce((function(e,a){return e.concat(t.map((function(e){return s.resolve(r,a,e)})))}),[])};e.exports=function nodeModulesPaths(e,t,r){var s=t&&t.moduleDirectory?[].concat(t.moduleDirectory):["node_modules"];if(t&&typeof t.paths==="function"){return t.paths(r,e,(function(){return n(e,s)}),t)}var a=n(e,s);return t&&t.paths?a.concat(t.paths):a}},7023:e=>{e.exports=function(e,t){return t||{}}},5565:(e,t,r)=>{var s=r(8746);var a=r(7147);var n=r(1017);var o=r(7673);var i=r(7901);var l=r(7023);var c=a.realpathSync&&typeof a.realpathSync.native==="function"?a.realpathSync.native:a.realpathSync;var u=function isFile(e){try{var t=a.statSync(e)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return false;throw e}return t.isFile()||t.isFIFO()};var p=function isDirectory(e){try{var t=a.statSync(e)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return false;throw e}return t.isDirectory()};var d=function realpathSync(e){try{return c(e)}catch(e){if(e.code!=="ENOENT"){throw e}}return e};var f=function maybeRealpathSync(e,t,r){if(r&&r.preserveSymlinks===false){return e(t)}return t};var m=function defaultReadPackageSync(e,t){var r=e(t);try{var s=JSON.parse(r);return s}catch(e){}};var y=function getPackageCandidates(e,t,r){var s=i(t,r,e);for(var a=0;a{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(8622);function getObjRef(e,t,r){let a;if(s.isIdentifier(e)){if(r.hasBinding(e.name)){return e}else{a=e}}else if(s.isMemberExpression(e)){a=e.object;if(s.isSuper(a)||s.isIdentifier(a)&&r.hasBinding(a.name)){return a}}else{throw new Error(`We can't explode this node type ${e["type"]}`)}const n=r.generateUidIdentifierBasedOnNode(a);r.push({id:n});t.push(s.assignmentExpression("=",s.cloneNode(n),s.cloneNode(a)));return n}function getPropRef(e,t,r){const a=e.property;if(s.isPrivateName(a)){throw new Error("We can't generate property ref for private name, please install `@babel/plugin-proposal-class-properties`")}const n=s.toComputedKey(e,a);if(s.isLiteral(n)&&s.isPureish(n))return n;const o=r.generateUidIdentifierBasedOnNode(a);r.push({id:o});t.push(s.assignmentExpression("=",s.cloneNode(o),s.cloneNode(a)));return o}function _default(e,t,r,a,n){let o;if(s.isIdentifier(e)&&n){o=e}else{o=getObjRef(e,t,a)}let i,l;if(s.isIdentifier(e)){i=s.cloneNode(e);l=o}else{const r=getPropRef(e,t,a);const n=e.computed||s.isLiteral(r);l=s.memberExpression(s.cloneNode(o),s.cloneNode(r),n);i=s.memberExpression(s.cloneNode(o),s.cloneNode(r),n)}return{uid:l,ref:i}}},550:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(3811);var a=r(153);var n=r(8622);const o=(0,a.default)(`\n (function (FUNCTION_KEY) {\n function FUNCTION_ID() {\n return FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n }\n\n return FUNCTION_ID;\n })(FUNCTION)\n`);const i=(0,a.default)(`\n (function (FUNCTION_KEY) {\n function* FUNCTION_ID() {\n return yield* FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n };\n\n return FUNCTION_ID;\n })(FUNCTION)\n`);const l={"ReferencedIdentifier|BindingIdentifier"(e,t){if(e.node.name!==t.name)return;const r=e.scope.getBindingIdentifier(t.name);if(r!==t.outerDeclar)return;t.selfReference=true;e.stop()}};function getNameFromLiteralId(e){if(n.isNullLiteral(e)){return"null"}if(n.isRegExpLiteral(e)){return`_${e.pattern}_${e.flags}`}if(n.isTemplateLiteral(e)){return e.quasis.map((e=>e.value.raw)).join("")}if(e.value!==undefined){return e.value+""}return""}function wrap(e,t,r,a){if(e.selfReference){if(a.hasBinding(r.name)&&!a.hasGlobal(r.name)){a.rename(r.name)}else{if(!n.isFunction(t))return;let e=o;if(t.generator){e=i}const l=e({FUNCTION:t,FUNCTION_ID:r,FUNCTION_KEY:a.generateUidIdentifier(r.name)}).expression;const c=l.callee.body.body[0].params;for(let e=0,r=(0,s.default)(t);e{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=hoistVariables;var s=r(8622);const a={Scope(e,t){if(t.kind==="let")e.skip()},FunctionParent(e){e.skip()},VariableDeclaration(e,t){if(t.kind&&e.node.kind!==t.kind)return;const r=[];const a=e.get("declarations");let n;for(const e of a){n=e.node.id;if(e.node.init){r.push(s.expressionStatement(s.assignmentExpression("=",e.node.id,e.node.init)))}for(const r of Object.keys(e.getBindingIdentifiers())){t.emit(s.identifier(r),r,e.node.init!==null)}}if(e.parentPath.isFor({left:e.node})){e.replaceWith(n)}else{e.replaceWithMultiple(r)}}};function hoistVariables(e,t,r="var"){e.traverse(a,{kind:r,emit:t})}},3546:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=memberExpressionToFunctions;var s=_interopRequireWildcard(r(8622));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}class AssignmentMemoiser{constructor(){this._map=new WeakMap}has(e){return this._map.has(e)}get(e){if(!this.has(e))return;const t=this._map.get(e);const{value:r}=t;t.count--;if(t.count===0){return s.assignmentExpression("=",r,e)}return r}set(e,t,r){return this._map.set(e,{count:r,value:t})}}function toNonOptional(e,t){const{node:r}=e;if(e.isOptionalMemberExpression()){return s.memberExpression(t,r.property,r.computed)}if(e.isOptionalCallExpression()){const a=e.get("callee");if(e.node.optional&&a.isOptionalMemberExpression()){const{object:n}=a.node;const o=e.scope.maybeGenerateMemoised(n)||n;a.get("object").replaceWith(s.assignmentExpression("=",o,n));return s.callExpression(s.memberExpression(t,s.identifier("call")),[o,...r.arguments])}return s.callExpression(t,r.arguments)}return e.node}function isInDetachedTree(e){while(e){if(e.isProgram())break;const{parentPath:t,container:r,listKey:s}=e;const a=t.node;if(s){if(r!==a[s])return true}else{if(r!==a)return true}e=t}return false}const a={memoise(){},handle(e){const{node:t,parent:r,parentPath:a,scope:n}=e;if(e.isOptionalMemberExpression()){if(isInDetachedTree(e))return;const o=e.find((({node:t,parent:r,parentPath:s})=>{if(s.isOptionalMemberExpression()){return r.optional||r.object!==t}if(s.isOptionalCallExpression()){return t!==e.node&&r.optional||r.callee!==t}return true}));if(n.path.isPattern()){o.replaceWith(s.callExpression(s.arrowFunctionExpression([],o.node),[]));return}const i=o.parentPath;if(i.isUpdateExpression({argument:t})||i.isAssignmentExpression({left:t})){throw e.buildCodeFrameError(`can't handle assignment`)}const l=i.isUnaryExpression({operator:"delete"});if(l&&o.isOptionalMemberExpression()&&o.get("property").isPrivateName()){throw e.buildCodeFrameError(`can't delete a private class element`)}let c=e;for(;;){if(c.isOptionalMemberExpression()){if(c.node.optional)break;c=c.get("object");continue}else if(c.isOptionalCallExpression()){if(c.node.optional)break;c=c.get("callee");continue}throw new Error(`Internal error: unexpected ${c.node.type}`)}const u=c.isOptionalMemberExpression()?"object":"callee";const p=c.node[u];const d=n.maybeGenerateMemoised(p);const f=d!=null?d:p;const m=a.isOptionalCallExpression({callee:t});const y=a.isCallExpression({callee:t});c.replaceWith(toNonOptional(c,f));if(m){if(r.optional){a.replaceWith(this.optionalCall(e,r.arguments))}else{a.replaceWith(this.call(e,r.arguments))}}else if(y){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}let g=e.node;for(let t=e;t!==o;){const{parentPath:e}=t;if(e===o&&m&&r.optional){g=e.node;break}g=toNonOptional(e,g);t=e}let h;const b=o.parentPath;if(s.isMemberExpression(g)&&b.isOptionalCallExpression({callee:o.node,optional:true})){const{object:t}=g;h=e.scope.maybeGenerateMemoised(t);if(h){g.object=s.assignmentExpression("=",h,t)}}let x=o;if(l){x=b;g=b.node}x.replaceWith(s.conditionalExpression(s.logicalExpression("||",s.binaryExpression("===",d?s.assignmentExpression("=",s.cloneNode(f),s.cloneNode(p)):s.cloneNode(f),s.nullLiteral()),s.binaryExpression("===",s.cloneNode(f),n.buildUndefinedNode())),l?s.booleanLiteral(true):n.buildUndefinedNode(),g));if(h){const e=b.node;b.replaceWith(s.optionalCallExpression(s.optionalMemberExpression(e.callee,s.identifier("call"),false,true),[s.cloneNode(h),...e.arguments],false))}return}if(a.isUpdateExpression({argument:t})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:n,prefix:o}=r;this.memoise(e,2);const i=s.binaryExpression(n[0],s.unaryExpression("+",this.get(e)),s.numericLiteral(1));if(o){a.replaceWith(this.set(e,i))}else{const{scope:r}=e;const n=r.generateUidIdentifierBasedOnNode(t);r.push({id:n});i.left=s.assignmentExpression("=",s.cloneNode(n),i.left);a.replaceWith(s.sequenceExpression([this.set(e,i),s.cloneNode(n)]))}return}if(a.isAssignmentExpression({left:t})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,right:n}=r;if(t==="="){a.replaceWith(this.set(e,n))}else{const r=t.slice(0,-1);if(s.LOGICAL_OPERATORS.includes(r)){this.memoise(e,1);a.replaceWith(s.logicalExpression(r,this.get(e),this.set(e,n)))}else{this.memoise(e,2);a.replaceWith(this.set(e,s.binaryExpression(r,this.get(e),n)))}}return}if(a.isCallExpression({callee:t})){a.replaceWith(this.call(e,r.arguments));return}if(a.isOptionalCallExpression({callee:t})){if(n.path.isPattern()){a.replaceWith(s.callExpression(s.arrowFunctionExpression([],a.node),[]));return}a.replaceWith(this.optionalCall(e,r.arguments));return}if(a.isForXStatement({left:t})||a.isObjectProperty({value:t})&&a.parentPath.isObjectPattern()||a.isAssignmentPattern({left:t})&&a.parentPath.isObjectProperty({value:r})&&a.parentPath.parentPath.isObjectPattern()||a.isArrayPattern()||a.isAssignmentPattern({left:t})&&a.parentPath.isArrayPattern()||a.isRestElement()){e.replaceWith(this.destructureSet(e));return}e.replaceWith(this.get(e))}};function memberExpressionToFunctions(e,t,r){e.traverse(t,Object.assign({},a,r,{memoiser:new AssignmentMemoiser}))}},6591:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9491);var a=r(8622);class ImportBuilder{constructor(e,t,r){this._statements=[];this._resultName=null;this._scope=null;this._hub=null;this._importedSource=void 0;this._scope=t;this._hub=r;this._importedSource=e}done(){return{statements:this._statements,resultName:this._resultName}}import(){this._statements.push(a.importDeclaration([],a.stringLiteral(this._importedSource)));return this}require(){this._statements.push(a.expressionStatement(a.callExpression(a.identifier("require"),[a.stringLiteral(this._importedSource)])));return this}namespace(e="namespace"){const t=this._scope.generateUidIdentifier(e);const r=this._statements[this._statements.length-1];s(r.type==="ImportDeclaration");s(r.specifiers.length===0);r.specifiers=[a.importNamespaceSpecifier(t)];this._resultName=a.cloneNode(t);return this}default(e){e=this._scope.generateUidIdentifier(e);const t=this._statements[this._statements.length-1];s(t.type==="ImportDeclaration");s(t.specifiers.length===0);t.specifiers=[a.importDefaultSpecifier(e)];this._resultName=a.cloneNode(e);return this}named(e,t){if(t==="default")return this.default(e);e=this._scope.generateUidIdentifier(e);const r=this._statements[this._statements.length-1];s(r.type==="ImportDeclaration");s(r.specifiers.length===0);r.specifiers=[a.importSpecifier(e,a.identifier(t))];this._resultName=a.cloneNode(e);return this}var(e){e=this._scope.generateUidIdentifier(e);let t=this._statements[this._statements.length-1];if(t.type!=="ExpressionStatement"){s(this._resultName);t=a.expressionStatement(this._resultName);this._statements.push(t)}this._statements[this._statements.length-1]=a.variableDeclaration("var",[a.variableDeclarator(e,t.expression)]);this._resultName=a.cloneNode(e);return this}defaultInterop(){return this._interop(this._hub.addHelper("interopRequireDefault"))}wildcardInterop(){return this._interop(this._hub.addHelper("interopRequireWildcard"))}_interop(e){const t=this._statements[this._statements.length-1];if(t.type==="ExpressionStatement"){t.expression=a.callExpression(e,[t.expression])}else if(t.type==="VariableDeclaration"){s(t.declarations.length===1);t.declarations[0].init=a.callExpression(e,[t.declarations[0].init])}else{s.fail("Unexpected type.")}return this}prop(e){const t=this._statements[this._statements.length-1];if(t.type==="ExpressionStatement"){t.expression=a.memberExpression(t.expression,a.identifier(e))}else if(t.type==="VariableDeclaration"){s(t.declarations.length===1);t.declarations[0].init=a.memberExpression(t.declarations[0].init,a.identifier(e))}else{s.fail("Unexpected type:"+t.type)}return this}read(e){this._resultName=a.memberExpression(this._resultName,a.identifier(e))}}t["default"]=ImportBuilder},4872:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9491);var a=r(8622);var n=r(6591);var o=r(1719);class ImportInjector{constructor(e,t,r){this._defaultOpts={importedSource:null,importedType:"commonjs",importedInterop:"babel",importingInterop:"babel",ensureLiveReference:false,ensureNoContext:false,importPosition:"before"};const s=e.find((e=>e.isProgram()));this._programPath=s;this._programScope=s.scope;this._hub=s.hub;this._defaultOpts=this._applyDefaults(t,r,true)}addDefault(e,t){return this.addNamed("default",e,t)}addNamed(e,t,r){s(typeof e==="string");return this._generateImport(this._applyDefaults(t,r),e)}addNamespace(e,t){return this._generateImport(this._applyDefaults(e,t),null)}addSideEffect(e,t){return this._generateImport(this._applyDefaults(e,t),false)}_applyDefaults(e,t,r=false){const a=[];if(typeof e==="string"){a.push({importedSource:e});a.push(t)}else{s(!t,"Unexpected secondary arguments.");a.push(e)}const n=Object.assign({},this._defaultOpts);for(const e of a){if(!e)continue;Object.keys(n).forEach((t=>{if(e[t]!==undefined)n[t]=e[t]}));if(!r){if(e.nameHint!==undefined)n.nameHint=e.nameHint;if(e.blockHoist!==undefined)n.blockHoist=e.blockHoist}}return n}_generateImport(e,t){const r=t==="default";const s=!!t&&!r;const i=t===null;const{importedSource:l,importedType:c,importedInterop:u,importingInterop:p,ensureLiveReference:d,ensureNoContext:f,nameHint:m,importPosition:y,blockHoist:g}=e;let h=m||t;const b=(0,o.default)(this._programPath);const x=b&&p==="node";const v=b&&p==="babel";if(y==="after"&&!b){throw new Error(`"importPosition": "after" is only supported in modules`)}const E=new n.default(l,this._programScope,this._hub);if(c==="es6"){if(!x&&!v){throw new Error("Cannot import an ES6 module from CommonJS")}E.import();if(i){E.namespace(m||l)}else if(r||s){E.named(h,t)}}else if(c!=="commonjs"){throw new Error(`Unexpected interopType "${c}"`)}else if(u==="babel"){if(x){h=h!=="default"?h:l;const e=`${l}$es6Default`;E.import();if(i){E.default(e).var(h||l).wildcardInterop()}else if(r){if(d){E.default(e).var(h||l).defaultInterop().read("default")}else{E.default(e).var(h).defaultInterop().prop(t)}}else if(s){E.default(e).read(t)}}else if(v){E.import();if(i){E.namespace(h||l)}else if(r||s){E.named(h,t)}}else{E.require();if(i){E.var(h||l).wildcardInterop()}else if((r||s)&&d){if(r){h=h!=="default"?h:l;E.var(h).read(t);E.defaultInterop()}else{E.var(l).read(t)}}else if(r){E.var(h).defaultInterop().prop(t)}else if(s){E.var(h).prop(t)}}}else if(u==="compiled"){if(x){E.import();if(i){E.default(h||l)}else if(r||s){E.default(l).read(h)}}else if(v){E.import();if(i){E.namespace(h||l)}else if(r||s){E.named(h,t)}}else{E.require();if(i){E.var(h||l)}else if(r||s){if(d){E.var(l).read(h)}else{E.prop(t).var(h)}}}}else if(u==="uncompiled"){if(r&&d){throw new Error("No live reference for commonjs default")}if(x){E.import();if(i){E.default(h||l)}else if(r){E.default(h)}else if(s){E.default(l).read(h)}}else if(v){E.import();if(i){E.default(h||l)}else if(r){E.default(h)}else if(s){E.named(h,t)}}else{E.require();if(i){E.var(h||l)}else if(r){E.var(h)}else if(s){if(d){E.var(l).read(h)}else{E.var(h).prop(t)}}}}else{throw new Error(`Unknown importedInterop "${u}".`)}const{statements:j,resultName:w}=E.done();this._insertStatements(j,y,g);if((r||s)&&f&&w.type!=="Identifier"){return a.sequenceExpression([a.numericLiteral(0),w])}return w}_insertStatements(e,t="before",r=3){const s=this._programPath.get("body");if(t==="after"){for(let t=s.length-1;t>=0;t--){if(s[t].isImportDeclaration()){s[t].insertAfter(e);return}}}else{e.forEach((e=>{e._blockHoist=r}));const t=s.find((e=>{const t=e.node._blockHoist;return Number.isFinite(t)&&t<4}));if(t){t.insertBefore(e);return}}this._programPath.unshiftContainer("body",e)}}t["default"]=ImportInjector},6039:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.addDefault=addDefault;t.addNamed=addNamed;t.addNamespace=addNamespace;t.addSideEffect=addSideEffect;Object.defineProperty(t,"ImportInjector",{enumerable:true,get:function(){return s.default}});Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return a.default}});var s=r(4872);var a=r(1719);function addDefault(e,t,r){return new s.default(e).addDefault(t,r)}function addNamed(e,t,r,a){return new s.default(e).addNamed(t,r,a)}function addNamespace(e,t,r){return new s.default(e).addNamespace(t,r)}function addSideEffect(e,t,r){return new s.default(e).addSideEffect(t,r)}},1719:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=isModule;function isModule(e){const{sourceType:t}=e.node;if(t!=="module"&&t!=="script"){throw e.buildCodeFrameError(`Unknown sourceType "${t}", cannot transform.`)}return e.node.sourceType==="module"}},6721:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=optimiseCallExpression;var s=r(8622);function optimiseCallExpression(e,t,r,a){if(r.length===1&&s.isSpreadElement(r[0])&&s.isIdentifier(r[0].argument,{name:"arguments"})){if(a){return s.optionalCallExpression(s.optionalMemberExpression(e,s.identifier("apply"),false,true),[t,r[0].argument],false)}return s.callExpression(s.memberExpression(e,s.identifier("apply")),[t,r[0].argument])}else{if(a){return s.optionalCallExpression(s.optionalMemberExpression(e,s.identifier("call"),false,true),[t,...r],false)}return s.callExpression(s.memberExpression(e,s.identifier("call")),[t,...r])}}},9055:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,r,s)=>{if(!t.assertVersion){t=Object.assign(copyApiObject(t),{assertVersion(e){throwVersionError(e,t.version)}})}return e(t,r||{},s)}}function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7120:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(6946);var a=r(2155);var n=r(8622);const o={Function(e){e.skip()},AwaitExpression(e,{wrapAwait:t}){const r=e.get("argument");if(e.parentPath.isYieldExpression()){e.replaceWith(r.node);return}e.replaceWith(n.yieldExpression(t?n.callExpression(n.cloneNode(t),[r.node]):r.node))}};function _default(e,t,r){e.traverse(o,{wrapAwait:t.wrapAwait});const i=checkIsIIFE(e);e.node.async=false;e.node.generator=true;(0,s.default)(e,n.cloneNode(t.wrapAsync),r);const l=e.isObjectMethod()||e.isClassMethod()||e.parentPath.isObjectProperty()||e.parentPath.isClassProperty();if(!l&&!i&&e.isExpression()){(0,a.default)(e)}function checkIsIIFE(e){if(e.parentPath.isCallExpression({callee:e.node})){return true}const{parentPath:t}=e;if(t.isMemberExpression()&&n.isIdentifier(t.node.property,{name:"bind"})){const{parentPath:e}=t;return e.isCallExpression()&&e.node.arguments.length===1&&n.isThisExpression(e.node.arguments[0])&&e.parentPath.isCallExpression({callee:e.node})}return false}}},6833:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.skipAllButComputedKey=skipAllButComputedKey;t["default"]=t.environmentVisitor=void 0;var s=r(7369);var a=r(7281);var n=r(6721);var o=r(8622);function getPrototypeOfExpression(e,t,r,s){e=o.cloneNode(e);const a=t||s?e:o.memberExpression(e,o.identifier("prototype"));return o.callExpression(r.addHelper("getPrototypeOf"),[a])}function skipAllButComputedKey(e){if(!e.node.computed){e.skip();return}const t=o.VISITOR_KEYS[e.type];for(const r of t){if(r!=="key")e.skipKey(r)}}const i={[`${o.staticBlock?"StaticBlock|":""}ClassPrivateProperty|TypeAnnotation`](e){e.skip()},Function(e){if(e.isMethod())return;if(e.isArrowFunctionExpression())return;e.skip()},"Method|ClassProperty"(e){skipAllButComputedKey(e)}};t.environmentVisitor=i;const l=s.default.visitors.merge([i,{Super(e,t){const{node:r,parentPath:s}=e;if(!s.isMemberExpression({object:r}))return;t.handle(s)}}]);const c=s.default.visitors.merge([i,{Scopable(e,{refName:t}){const r=e.scope.getOwnBinding(t);if(r&&r.identifier.name===t){e.scope.rename(t)}}}]);const u={memoise(e,t){const{scope:r,node:s}=e;const{computed:a,property:n}=s;if(!a){return}const o=r.maybeGenerateMemoised(n);if(!o){return}this.memoiser.set(n,o,t)},prop(e){const{computed:t,property:r}=e.node;if(this.memoiser.has(r)){return o.cloneNode(this.memoiser.get(r))}if(t){return o.cloneNode(r)}return o.stringLiteral(r.name)},get(e){return this._get(e,this._getThisRefs())},_get(e,t){const r=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("get"),[t.memo?o.sequenceExpression([t.memo,r]):r,this.prop(e),t.this])},_getThisRefs(){if(!this.isDerivedConstructor){return{this:o.thisExpression()}}const e=this.scope.generateDeclaredUidIdentifier("thisSuper");return{memo:o.assignmentExpression("=",e,o.thisExpression()),this:o.cloneNode(e)}},set(e,t){const r=this._getThisRefs();const s=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("set"),[r.memo?o.sequenceExpression([r.memo,s]):s,this.prop(e),t,r.this,o.booleanLiteral(e.isInStrictMode())])},destructureSet(e){throw e.buildCodeFrameError(`Destructuring to a super field is not supported yet.`)},call(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,false)},optionalCall(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,true)}};const p=Object.assign({},u,{prop(e){const{property:t}=e.node;if(this.memoiser.has(t)){return o.cloneNode(this.memoiser.get(t))}return o.cloneNode(t)},get(e){const{isStatic:t,getSuperRef:r}=this;const{computed:s}=e.node;const a=this.prop(e);let n;if(t){var i;n=(i=r())!=null?i:o.memberExpression(o.identifier("Function"),o.identifier("prototype"))}else{var l;n=o.memberExpression((l=r())!=null?l:o.identifier("Object"),o.identifier("prototype"))}return o.memberExpression(n,a,s)},set(e,t){const{computed:r}=e.node;const s=this.prop(e);return o.assignmentExpression("=",o.memberExpression(o.thisExpression(),s,r),t)},destructureSet(e){const{computed:t}=e.node;const r=this.prop(e);return o.memberExpression(o.thisExpression(),r,t)},call(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,false)},optionalCall(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,true)}});class ReplaceSupers{constructor(e){var t;const r=e.methodPath;this.methodPath=r;this.isDerivedConstructor=r.isClassMethod({kind:"constructor"})&&!!e.superRef;this.isStatic=r.isObjectMethod()||r.node.static||(r.isStaticBlock==null?void 0:r.isStaticBlock());this.isPrivateMethod=r.isPrivate()&&r.isMethod();this.file=e.file;this.constantSuper=(t=e.constantSuper)!=null?t:e.isLoose;this.opts=e}getObjectRef(){return o.cloneNode(this.opts.objectRef||this.opts.getObjectRef())}getSuperRef(){if(this.opts.superRef)return o.cloneNode(this.opts.superRef);if(this.opts.getSuperRef)return o.cloneNode(this.opts.getSuperRef())}replace(){if(this.opts.refToPreserve){this.methodPath.traverse(c,{refName:this.opts.refToPreserve.name})}const e=this.constantSuper?p:u;(0,a.default)(this.methodPath,l,Object.assign({file:this.file,scope:this.methodPath.scope,isDerivedConstructor:this.isDerivedConstructor,isStatic:this.isStatic,isPrivateMethod:this.isPrivateMethod,getObjectRef:this.getObjectRef.bind(this),getSuperRef:this.getSuperRef.bind(this)},e))}}t["default"]=ReplaceSupers},7281:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(8622);function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach((function(r){if(r!=="default"){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:true,get:function(){return e[r]}})}}))}t["default"]=e;return Object.freeze(t)}var a=_interopNamespace(s);function willPathCastToBoolean(e){const t=e;const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}class AssignmentMemoiser{constructor(){this._map=void 0;this._map=new WeakMap}has(e){return this._map.has(e)}get(e){if(!this.has(e))return;const t=this._map.get(e);const{value:r}=t;t.count--;if(t.count===0){return a.assignmentExpression("=",r,e)}return r}set(e,t,r){return this._map.set(e,{count:r,value:t})}}function toNonOptional(e,t){const{node:r}=e;if(e.isOptionalMemberExpression()){return a.memberExpression(t,r.property,r.computed)}if(e.isOptionalCallExpression()){const s=e.get("callee");if(e.node.optional&&s.isOptionalMemberExpression()){const{object:n}=s.node;const o=e.scope.maybeGenerateMemoised(n)||n;s.get("object").replaceWith(a.assignmentExpression("=",o,n));return a.callExpression(a.memberExpression(t,a.identifier("call")),[o,...r.arguments])}return a.callExpression(t,r.arguments)}return e.node}function isInDetachedTree(e){while(e){if(e.isProgram())break;const{parentPath:t,container:r,listKey:s}=e;const a=t.node;if(s){if(r!==a[s])return true}else{if(r!==a)return true}e=t}return false}const n={memoise(){},handle(e,t){const{node:r,parent:s,parentPath:n,scope:o}=e;if(e.isOptionalMemberExpression()){if(isInDetachedTree(e))return;const i=e.find((({node:t,parent:r,parentPath:s})=>{if(s.isOptionalMemberExpression()){return r.optional||r.object!==t}if(s.isOptionalCallExpression()){return t!==e.node&&r.optional||r.callee!==t}return true}));if(o.path.isPattern()){i.replaceWith(a.callExpression(a.arrowFunctionExpression([],i.node),[]));return}const l=willPathCastToBoolean(i);const c=i.parentPath;if(c.isUpdateExpression({argument:r})||c.isAssignmentExpression({left:r})){throw e.buildCodeFrameError(`can't handle assignment`)}const u=c.isUnaryExpression({operator:"delete"});if(u&&i.isOptionalMemberExpression()&&i.get("property").isPrivateName()){throw e.buildCodeFrameError(`can't delete a private class element`)}let p=e;for(;;){if(p.isOptionalMemberExpression()){if(p.node.optional)break;p=p.get("object");continue}else if(p.isOptionalCallExpression()){if(p.node.optional)break;p=p.get("callee");continue}throw new Error(`Internal error: unexpected ${p.node.type}`)}const d=p.isOptionalMemberExpression()?"object":"callee";const f=p.node[d];const m=o.maybeGenerateMemoised(f);const y=m!=null?m:f;const g=n.isOptionalCallExpression({callee:r});const h=n.isCallExpression({callee:r});p.replaceWith(toNonOptional(p,y));if(g){if(s.optional){n.replaceWith(this.optionalCall(e,s.arguments))}else{n.replaceWith(this.call(e,s.arguments))}}else if(h){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}let b=e.node;for(let t=e;t!==i;){const{parentPath:e}=t;if(e===i&&g&&s.optional){b=e.node;break}b=toNonOptional(e,b);t=e}let x;const v=i.parentPath;if(a.isMemberExpression(b)&&v.isOptionalCallExpression({callee:i.node,optional:true})){const{object:t}=b;x=e.scope.maybeGenerateMemoised(t);if(x){b.object=a.assignmentExpression("=",x,t)}}let E=i;if(u){E=v;b=v.node}const j=m?a.assignmentExpression("=",a.cloneNode(y),a.cloneNode(f)):a.cloneNode(y);if(l){let e;if(t){e=a.binaryExpression("!=",j,a.nullLiteral())}else{e=a.logicalExpression("&&",a.binaryExpression("!==",j,a.nullLiteral()),a.binaryExpression("!==",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.logicalExpression("&&",e,b))}else{let e;if(t){e=a.binaryExpression("==",j,a.nullLiteral())}else{e=a.logicalExpression("||",a.binaryExpression("===",j,a.nullLiteral()),a.binaryExpression("===",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.conditionalExpression(e,u?a.booleanLiteral(true):o.buildUndefinedNode(),b))}if(x){const e=v.node;v.replaceWith(a.optionalCallExpression(a.optionalMemberExpression(e.callee,a.identifier("call"),false,true),[a.cloneNode(x),...e.arguments],false))}return}if(n.isUpdateExpression({argument:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,prefix:o}=s;this.memoise(e,2);const i=a.binaryExpression(t[0],a.unaryExpression("+",this.get(e)),a.numericLiteral(1));if(o){n.replaceWith(this.set(e,i))}else{const{scope:t}=e;const s=t.generateUidIdentifierBasedOnNode(r);t.push({id:s});i.left=a.assignmentExpression("=",a.cloneNode(s),i.left);n.replaceWith(a.sequenceExpression([this.set(e,i),a.cloneNode(s)]))}return}if(n.isAssignmentExpression({left:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,right:r}=s;if(t==="="){n.replaceWith(this.set(e,r))}else{const s=t.slice(0,-1);if(a.LOGICAL_OPERATORS.includes(s)){this.memoise(e,1);n.replaceWith(a.logicalExpression(s,this.get(e),this.set(e,r)))}else{this.memoise(e,2);n.replaceWith(this.set(e,a.binaryExpression(s,this.get(e),r)))}}return}if(n.isCallExpression({callee:r})){n.replaceWith(this.call(e,s.arguments));return}if(n.isOptionalCallExpression({callee:r})){if(o.path.isPattern()){n.replaceWith(a.callExpression(a.arrowFunctionExpression([],n.node),[]));return}n.replaceWith(this.optionalCall(e,s.arguments));return}if(n.isForXStatement({left:r})||n.isObjectProperty({value:r})&&n.parentPath.isObjectPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isObjectProperty({value:s})&&n.parentPath.parentPath.isObjectPattern()||n.isArrayPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isArrayPattern()||n.isRestElement()){e.replaceWith(this.destructureSet(e));return}e.replaceWith(this.get(e))}};function memberExpressionToFunctions(e,t,r){e.traverse(t,Object.assign({},n,r,{memoiser:new AssignmentMemoiser}))}t["default"]=memberExpressionToFunctions},5480:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isTransparentExprWrapper=isTransparentExprWrapper;t.skipTransparentExprWrappers=skipTransparentExprWrappers;var s=r(8622);function isTransparentExprWrapper(e){return s.isTSAsExpression(e)||s.isTSTypeAssertion(e)||s.isTSNonNullExpression(e)||s.isTypeCastExpression(e)||s.isParenthesizedExpression(e)}function skipTransparentExprWrappers(e){while(isTransparentExprWrapper(e.node)){e=e.get("expression")}return e}},7058:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=splitExportDeclaration;var s=r(8622);function splitExportDeclaration(e){if(!e.isExportDeclaration()){throw new Error("Only export declarations can be split.")}const t=e.isExportDefaultDeclaration();const r=e.get("declaration");const a=r.isClassDeclaration();if(t){const t=r.isFunctionDeclaration()||a;const n=r.isScope()?r.scope.parent:r.scope;let o=r.node.id;let i=false;if(!o){i=true;o=n.generateUidIdentifier("default");if(t||r.isFunctionExpression()||r.isClassExpression()){r.node.id=s.cloneNode(o)}}const l=t?r:s.variableDeclaration("var",[s.variableDeclarator(s.cloneNode(o),r.node)]);const c=s.exportNamedDeclaration(null,[s.exportSpecifier(s.cloneNode(o),s.identifier("default"))]);e.insertAfter(c);e.replaceWith(l);if(i){n.registerDeclaration(e)}return e}if(e.get("specifiers").length>0){throw new Error("It doesn't make sense to split exported specifiers.")}const n=r.getOuterBindingIdentifiers();const o=Object.keys(n).map((e=>s.exportSpecifier(s.identifier(e),s.identifier(e))));const i=s.exportNamedDeclaration(null,o);e.insertAfter(i);e.replaceWith(r.node);return e}},9115:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0,s=Array.from(e);r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(9115);var a=r(5390)},5390:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},8785:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.findSuggestion=findSuggestion;const{min:r}=Math;function levenshtein(e,t){let s=[],a=[],n,o;const i=e.length,l=t.length;if(!i){return l}if(!l){return i}for(o=0;o<=l;o++){s[o]=o}for(n=1;n<=i;n++){for(a=[n],o=1;o<=l;o++){a[o]=e[n-1]===t[o-1]?s[o-1]:r(s[o-1],s[o],a[o-1])+1}s=a}return a[l]}function findSuggestion(e,t){const s=t.map((t=>levenshtein(t,e)));return t[s.indexOf(r(...s))]}},7347:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"OptionValidator",{enumerable:true,get:function(){return s.OptionValidator}});Object.defineProperty(t,"findSuggestion",{enumerable:true,get:function(){return a.findSuggestion}});var s=r(6885);var a=r(8785)},6885:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.OptionValidator=void 0;var s=r(8785);class OptionValidator{constructor(e){this.descriptor=e}validateTopLevelOptions(e,t){const r=Object.keys(t);for(const t of Object.keys(e)){if(!r.includes(t)){throw new Error(this.formatMessage(`'${t}' is not a valid top-level option.\n- Did you mean '${(0,s.findSuggestion)(t,r)}'?`))}}}validateBooleanOption(e,t,r){if(t===undefined){return r}else{this.invariant(typeof t==="boolean",`'${e}' option must be a boolean.`)}return t}validateStringOption(e,t,r){if(t===undefined){return r}else{this.invariant(typeof t==="string",`'${e}' option must be a string.`)}return t}invariant(e,t){if(!e){throw new Error(this.formatMessage(t))}}formatMessage(e){return`${this.descriptor}: ${e}`}}t.OptionValidator=OptionValidator},6946:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=wrapFunction;var s=r(550);var a=r(153);var n=r(8622);const o=a.default.expression(`\n (function () {\n var REF = FUNCTION;\n return function NAME(PARAMS) {\n return REF.apply(this, arguments);\n };\n })()\n`);const i=a.default.expression(`\n (function () {\n var REF = FUNCTION;\n function NAME(PARAMS) {\n return REF.apply(this, arguments);\n }\n return NAME;\n })()\n`);const l=(0,a.default)(`\n function NAME(PARAMS) { return REF.apply(this, arguments); }\n function REF() {\n REF = FUNCTION;\n return REF.apply(this, arguments);\n }\n`);function classOrObjectMethod(e,t){const r=e.node;const s=r.body;const a=n.functionExpression(null,[],n.blockStatement(s.body),true);s.body=[n.returnStatement(n.callExpression(n.callExpression(t,[a]),[]))];r.async=false;r.generator=false;e.get("body.body.0.argument.callee.arguments.0").unwrapFunctionEnvironment()}function plainFunction(e,t,r){const a=e.node;const c=e.isFunctionDeclaration();const u=a.id;const p=c?l:u?i:o;if(e.isArrowFunctionExpression()){e.arrowFunctionToExpression({noNewArrows:r})}a.id=null;if(c){a.type="FunctionExpression"}const d=n.callExpression(t,[a]);const f=p({NAME:u||null,REF:e.scope.generateUidIdentifier(u?u.name:"ref"),FUNCTION:d,PARAMS:a.params.reduce(((t,r)=>{t.done=t.done||n.isAssignmentPattern(r)||n.isRestElement(r);if(!t.done){t.params.push(e.scope.generateUidIdentifier("x"))}return t}),{params:[],done:false}).params});if(c){e.replaceWith(f[0]);e.insertAfter(f[1])}else{const t=f.callee.body.body[1].argument;if(!u){(0,s.default)({node:t,parent:e.parent,scope:e.scope})}if(!t||t.id||a.params.length){e.replaceWith(f)}else{e.replaceWith(d)}}}function wrapFunction(e,t,r=true){if(e.isMethod()){classOrObjectMethod(e,t)}else{plainFunction(e,t,r)}}},2421:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.shouldHighlight=shouldHighlight;t.getChalk=getChalk;t["default"]=highlight;var s=_interopRequireWildcard(r(8035));var a=r(9586);var n=_interopRequireDefault(r(8542));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function getDefs(e){return{keyword:e.cyan,capitalized:e.yellow,jsx_tag:e.yellow,punctuator:e.yellow,number:e.magenta,string:e.green,regex:e.magenta,comment:e.grey,invalid:e.white.bgRed.bold}}const o=/\r\n|[\n\r\u2028\u2029]/;const i=/^[a-z][\w-]*$/i;const l=/^[()[\]{}]$/;function getTokenType(e){const[t,r]=e.slice(-2);const n=(0,s.matchToToken)(e);if(n.type==="name"){if((0,a.isKeyword)(n.value)||(0,a.isReservedWord)(n.value)){return"keyword"}if(i.test(n.value)&&(r[t-1]==="<"||r.substr(t-2,2)=="s(e))).join("\n")}else{return t[0]}}))}function shouldHighlight(e){return n.default.supportsColor||e.forceColor}function getChalk(e){let t=n.default;if(e.forceColor){t=new n.default.constructor({enabled:true,level:1})}return t}function highlight(e,t={}){if(shouldHighlight(t)){const r=getChalk(t);const s=getDefs(r);return highlightTokens(s,e)}else{return e}}},8027:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(249);var a=r(4026);var n=(0,s.declare)(((e,t)=>{e.assertVersion(7);return(0,a.createClassFeaturePlugin)({name:"proposal-class-properties",api:e,feature:a.FEATURES.fields,loose:t.loose,manipulateOptions(e,t){t.plugins.push("classProperties","classPrivateProperties")}})}));t["default"]=n},9009:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasOwnDecorators=hasOwnDecorators;t.hasDecorators=hasDecorators;t.buildDecoratedClass=buildDecoratedClass;var s=r(8304);var a=_interopRequireDefault(r(2768));var n=_interopRequireDefault(r(8486));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function hasOwnDecorators(e){return!!(e.decorators&&e.decorators.length)}function hasDecorators(e){return hasOwnDecorators(e)||e.body.body.some(hasOwnDecorators)}function prop(e,t){if(!t)return null;return s.types.objectProperty(s.types.identifier(e),t)}function method(e,t){return s.types.objectMethod("method",s.types.identifier(e),[],s.types.blockStatement(t))}function takeDecorators(e){let t;if(e.decorators&&e.decorators.length>0){t=s.types.arrayExpression(e.decorators.map((e=>e.expression)))}e.decorators=undefined;return t}function getKey(e){if(e.computed){return e.key}else if(s.types.isIdentifier(e.key)){return s.types.stringLiteral(e.key.name)}else{return s.types.stringLiteral(String(e.key.value))}}function extractElementDescriptor(e,t,r){const{node:o,scope:i}=r;const l=r.isClassMethod();if(r.isPrivate()){throw r.buildCodeFrameError(`Private ${l?"methods":"fields"} in decorated classes are not supported yet.`)}new a.default({methodPath:r,methodNode:o,objectRef:e,isStatic:o.static,superRef:t,scope:i,file:this},true).replace();const c=[prop("kind",s.types.stringLiteral(l?o.kind:"field")),prop("decorators",takeDecorators(o)),prop("static",o.static&&s.types.booleanLiteral(true)),prop("key",getKey(o))].filter(Boolean);if(l){const e=o.computed?null:o.key;s.types.toExpression(o);c.push(prop("value",(0,n.default)({node:o,id:e,scope:i})||o))}else if(o.value){c.push(method("value",s.template.statements.ast`return ${o.value}`))}else{c.push(prop("value",i.buildUndefinedNode()))}r.remove();return s.types.objectExpression(c)}function addDecorateHelper(e){try{return e.addHelper("decorate")}catch(e){if(e.code==="BABEL_HELPER_UNKNOWN"){e.message+="\n '@babel/plugin-transform-decorators' in non-legacy mode"+" requires '@babel/core' version ^7.0.2 and you appear to be using"+" an older version."}throw e}}function buildDecoratedClass(e,t,r,a){const{node:n,scope:o}=t;const i=o.generateUidIdentifier("initialize");const l=n.id&&t.isDeclaration();const c=t.isInStrictMode();const{superClass:u}=n;n.type="ClassDeclaration";if(!n.id)n.id=s.types.cloneNode(e);let p;if(u){p=o.generateUidIdentifierBasedOnNode(n.superClass,"super");n.superClass=p}const d=takeDecorators(n);const f=s.types.arrayExpression(r.filter((e=>!e.node.abstract)).map(extractElementDescriptor.bind(a,n.id,p)));let m=s.template.expression.ast` - ${addDecorateHelper(a)}( - ${d||s.types.nullLiteral()}, - function (${i}, ${u?s.types.cloneNode(p):null}) { - ${n} - return { F: ${s.types.cloneNode(n.id)}, d: ${f} }; - }, - ${u} - ) - `;let y="arguments.1.body.body.0";if(!c){m.arguments[1].body.directives.push(s.types.directive(s.types.directiveLiteral("use strict")))}if(l){m=s.template.ast`let ${e} = ${m}`;y="declarations.0.init."+y}return{instanceNodes:[s.template.statement.ast`${s.types.cloneNode(i)}(this)`],wrapClass(e){e.replaceWith(m);return e.get(y)}}}},889:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.enableFeature=enableFeature;t.isLoose=isLoose;t.verifyUsedFeatures=verifyUsedFeatures;t.FEATURES=void 0;var s=r(9009);const a=Object.freeze({fields:1<<1,privateMethods:1<<2,decorators:1<<3,privateIn:1<<4});t.FEATURES=a;const n=new Map([[a.fields,"@babel/plugin-proposal-class-properties"],[a.privateMethods,"@babel/plugin-proposal-private-methods"],[a.privateIn,"@babel/plugin-proposal-private-private-property-in-object"]]);const o="@babel/plugin-class-features/featuresKey";const i="@babel/plugin-class-features/looseKey";const l="@babel/plugin-class-features/looseLowPriorityKey/#__internal__@babel/preset-env__please-overwrite-loose-instead-of-throwing";function enableFeature(e,t,r){if(!hasFeature(e,t)||canIgnoreLoose(e,t)){e.set(o,e.get(o)|t);if(r==="#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error"){setLoose(e,t,true);e.set(l,e.get(l)|t)}else if(r==="#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"){setLoose(e,t,false);e.set(l,e.get(l)|t)}else{setLoose(e,t,r)}}let s;let a;for(const[t,r]of n){if(!hasFeature(e,t))continue;const n=isLoose(e,t);if(canIgnoreLoose(e,t)){continue}else if(s===!n){throw new Error("'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, "+"@babel/plugin-proposal-private-methods and "+"@babel/plugin-proposal-private-property-in-object (when they are enabled).")}else{s=n;a=r}}if(s!==undefined){for(const[t,r]of n){if(hasFeature(e,t)&&isLoose(e,t)!==s){setLoose(e,t,s);console.warn(`Though the "loose" option was set to "${!s}" in your @babel/preset-env `+`config, it will not be used for ${r} since the "loose" mode option was set to `+`"${s}" for ${a}.\nThe "loose" option must be the `+`same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods `+`and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can `+`silence this warning by explicitly adding\n`+`\t["${r}", { "loose": ${s} }]\n`+`to the "plugins" section of your Babel config.`)}}}}function hasFeature(e,t){return!!(e.get(o)&t)}function isLoose(e,t){return!!(e.get(i)&t)}function setLoose(e,t,r){if(r)e.set(i,e.get(i)|t);else e.set(i,e.get(i)&~t);e.set(l,e.get(l)&~t)}function canIgnoreLoose(e,t){return!!(e.get(l)&t)}function verifyUsedFeatures(e,t){if((0,s.hasOwnDecorators)(e.node)){if(!hasFeature(t,a.decorators)){throw e.buildCodeFrameError("Decorators are not enabled."+"\nIf you are using "+'["@babel/plugin-proposal-decorators", { "legacy": true }], '+'make sure it comes *before* "@babel/plugin-proposal-class-properties" '+"and enable loose mode, like so:\n"+'\t["@babel/plugin-proposal-decorators", { "legacy": true }]\n'+'\t["@babel/plugin-proposal-class-properties", { "loose": true }]')}if(e.isPrivate()){throw e.buildCodeFrameError(`Private ${e.isClassMethod()?"methods":"fields"} in decorated classes are not supported yet.`)}}if(e.isPrivate()&&e.isMethod()){if(!hasFeature(t,a.privateMethods)){throw e.buildCodeFrameError("Class private methods are not enabled.")}}if(e.isPrivateName()&&e.parentPath.isBinaryExpression({operator:"in",left:e.node})){if(!hasFeature(t,a.privateIn)){throw e.buildCodeFrameError("Private property in checks are not enabled.")}}if(e.isProperty()){if(!hasFeature(t,a.fields)){throw e.buildCodeFrameError("Class fields are not enabled.")}}}},7988:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.buildPrivateNamesMap=buildPrivateNamesMap;t.buildPrivateNamesNodes=buildPrivateNamesNodes;t.transformPrivateNamesUsage=transformPrivateNamesUsage;t.buildFieldsInitNodes=buildFieldsInitNodes;var s=r(8304);var a=_interopRequireWildcard(r(2768));var n=_interopRequireDefault(r(3546));var o=_interopRequireDefault(r(6351));var i=_interopRequireWildcard(r(3121));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function buildPrivateNamesMap(e){const t=new Map;for(const r of e){const e=r.isPrivate();const s=!r.isProperty();const a=!r.node.static;if(e){const{name:e}=r.node.key.id;const n=t.has(e)?t.get(e):{id:r.scope.generateUidIdentifier(e),static:!a,method:s};if(r.node.kind==="get"){n.getId=r.scope.generateUidIdentifier(`get_${e}`)}else if(r.node.kind==="set"){n.setId=r.scope.generateUidIdentifier(`set_${e}`)}else if(r.node.kind==="method"){n.methodId=r.scope.generateUidIdentifier(e)}t.set(e,n)}}return t}function buildPrivateNamesNodes(e,t,r){const a=[];for(const[n,o]of e){const{static:e,method:i,getId:l,setId:c}=o;const u=l||c;const p=s.types.cloneNode(o.id);if(t){a.push(s.template.statement.ast` - var ${p} = ${r.addHelper("classPrivateFieldLooseKey")}("${n}") - `)}else if(i&&!e){if(u){a.push(s.template.statement.ast`var ${p} = new WeakMap();`)}else{a.push(s.template.statement.ast`var ${p} = new WeakSet();`)}}else if(!e){a.push(s.template.statement.ast`var ${p} = new WeakMap();`)}}return a}function privateNameVisitorFactory(e){const t=Object.assign({},e,{Class(e){const{privateNamesMap:s}=this;const a=e.get("body.body");const n=new Map(s);const o=[];for(const e of a){if(!e.isPrivate())continue;const{name:t}=e.node.key.id;n.delete(t);o.push(t)}if(!o.length){return}e.get("body").traverse(r,Object.assign({},this,{redeclared:o}));e.traverse(t,Object.assign({},this,{privateNamesMap:n}));e.skipKey("body")}});const r=s.traverse.visitors.merge([Object.assign({},e),a.environmentVisitor]);return t}const l=privateNameVisitorFactory({PrivateName(e){const{privateNamesMap:t,redeclared:r}=this;const{node:s,parentPath:a}=e;if(!a.isMemberExpression({property:s})&&!a.isOptionalMemberExpression({property:s})){return}const{name:n}=s.id;if(!t.has(n))return;if(r&&r.includes(n))return;this.handle(a)}});const c=privateNameVisitorFactory({BinaryExpression(e){const{operator:t,left:r,right:a}=e.node;if(t!=="in")return;if(!e.get("left").isPrivateName())return;const{loose:n,privateNamesMap:o,redeclared:i}=this;const{name:l}=r.id;if(!o.has(l))return;if(i&&i.includes(l))return;if(n){const{id:t}=o.get(l);e.replaceWith(s.template.expression.ast` - Object.prototype.hasOwnProperty.call(${a}, ${s.types.cloneNode(t)}) - `);return}const{id:c,static:u}=o.get(l);if(u){e.replaceWith(s.template.expression.ast`${a} === ${this.classRef}`);return}e.replaceWith(s.template.expression.ast`${s.types.cloneNode(c)}.has(${a})`)}});const u={memoise(e,t){const{scope:r}=e;const{object:s}=e.node;const a=r.maybeGenerateMemoised(s);if(!a){return}this.memoiser.set(s,a,t)},receiver(e){const{object:t}=e.node;if(this.memoiser.has(t)){return s.types.cloneNode(this.memoiser.get(t))}return s.types.cloneNode(t)},get(e){const{classRef:t,privateNamesMap:r,file:a}=this;const{name:n}=e.node.property.id;const{id:o,static:i,method:l,methodId:c,getId:u,setId:p}=r.get(n);const d=u||p;if(i){const r=l&&!d?"classStaticPrivateMethodGet":"classStaticPrivateFieldSpecGet";return s.types.callExpression(a.addHelper(r),[this.receiver(e),s.types.cloneNode(t),s.types.cloneNode(o)])}if(l){if(d){return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])}return s.types.callExpression(a.addHelper("classPrivateMethodGet"),[this.receiver(e),s.types.cloneNode(o),s.types.cloneNode(c)])}return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])},boundGet(e){this.memoise(e,1);return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[this.receiver(e)])},set(e,t){const{classRef:r,privateNamesMap:a,file:n}=this;const{name:o}=e.node.property.id;const{id:i,static:l,method:c,setId:u,getId:p}=a.get(o);const d=p||u;if(l){const a=c&&!d?"classStaticPrivateMethodSet":"classStaticPrivateFieldSpecSet";return s.types.callExpression(n.addHelper(a),[this.receiver(e),s.types.cloneNode(r),s.types.cloneNode(i),t])}if(c){if(u){return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])}return s.types.callExpression(n.addHelper("classPrivateMethodSet"),[])}return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])},destructureSet(e){const{privateNamesMap:t,file:r}=this;const{name:a}=e.node.property.id;const{id:n}=t.get(a);return s.types.memberExpression(s.types.callExpression(r.addHelper("classPrivateFieldDestructureSet"),[this.receiver(e),s.types.cloneNode(n)]),s.types.identifier("value"))},call(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,false)},optionalCall(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,true)}};const p={get(e){const{privateNamesMap:t,file:r}=this;const{object:a}=e.node;const{name:n}=e.node.property.id;return s.template.expression`BASE(REF, PROP)[PROP]`({BASE:r.addHelper("classPrivateFieldLooseBase"),REF:s.types.cloneNode(a),PROP:s.types.cloneNode(t.get(n).id)})},boundGet(e){return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[s.types.cloneNode(e.node.object)])},simpleSet(e){return this.get(e)},destructureSet(e){return this.get(e)},call(e,t){return s.types.callExpression(this.get(e),t)},optionalCall(e,t){return s.types.optionalCallExpression(this.get(e),t,true)}};function transformPrivateNamesUsage(e,t,r,s,a){if(!r.size)return;const o=t.get("body");const i=s?p:u;(0,n.default)(o,l,Object.assign({privateNamesMap:r,classRef:e,file:a},i));o.traverse(c,{privateNamesMap:r,classRef:e,file:a,loose:s})}function buildPrivateFieldInitLoose(e,t,r){const{id:a}=r.get(t.node.key.id.name);const n=t.node.value||t.scope.buildUndefinedNode();return s.template.statement.ast` - Object.defineProperty(${e}, ${s.types.cloneNode(a)}, { - // configurable is false by default - // enumerable is false by default - writable: true, - value: ${n} - }); - `}function buildPrivateInstanceFieldInitSpec(e,t,r){const{id:a}=r.get(t.node.key.id.name);const n=t.node.value||t.scope.buildUndefinedNode();return s.template.statement.ast`${s.types.cloneNode(a)}.set(${e}, { - // configurable is always false for private elements - // enumerable is always false for private elements - writable: true, - value: ${n}, - })`}function buildPrivateStaticFieldInitSpec(e,t){const r=t.get(e.node.key.id.name);const{id:a,getId:n,setId:o,initAdded:i}=r;const l=n||o;if(!e.isProperty()&&(i||!l))return;if(l){t.set(e.node.key.id.name,Object.assign({},r,{initAdded:true}));return s.template.statement.ast` - var ${s.types.cloneNode(a)} = { - // configurable is false by default - // enumerable is false by default - // writable is false by default - get: ${n?n.name:e.scope.buildUndefinedNode()}, - set: ${o?o.name:e.scope.buildUndefinedNode()} - } - `}const c=e.node.value||e.scope.buildUndefinedNode();return s.template.statement.ast` - var ${s.types.cloneNode(a)} = { - // configurable is false by default - // enumerable is false by default - writable: true, - value: ${c} - }; - `}function buildPrivateMethodInitLoose(e,t,r){const a=r.get(t.node.key.id.name);const{methodId:n,id:o,getId:i,setId:l,initAdded:c}=a;if(c)return;if(n){return s.template.statement.ast` - Object.defineProperty(${e}, ${o}, { - // configurable is false by default - // enumerable is false by default - // writable is false by default - value: ${n.name} - }); - `}const u=i||l;if(u){r.set(t.node.key.id.name,Object.assign({},a,{initAdded:true}));return s.template.statement.ast` - Object.defineProperty(${e}, ${o}, { - // configurable is false by default - // enumerable is false by default - // writable is false by default - get: ${i?i.name:t.scope.buildUndefinedNode()}, - set: ${l?l.name:t.scope.buildUndefinedNode()} - }); - `}}function buildPrivateInstanceMethodInitSpec(e,t,r){const a=r.get(t.node.key.id.name);const{id:n,getId:o,setId:i,initAdded:l}=a;if(l)return;const c=o||i;if(c){r.set(t.node.key.id.name,Object.assign({},a,{initAdded:true}));return s.template.statement.ast` - ${n}.set(${e}, { - get: ${o?o.name:t.scope.buildUndefinedNode()}, - set: ${i?i.name:t.scope.buildUndefinedNode()} - }); - `}return s.template.statement.ast`${n}.add(${e})`}function buildPublicFieldInitLoose(e,t){const{key:r,computed:a}=t.node;const n=t.node.value||t.scope.buildUndefinedNode();return s.types.expressionStatement(s.types.assignmentExpression("=",s.types.memberExpression(e,r,a||s.types.isLiteral(r)),n))}function buildPublicFieldInitSpec(e,t,r){const{key:a,computed:n}=t.node;const o=t.node.value||t.scope.buildUndefinedNode();return s.types.expressionStatement(s.types.callExpression(r.addHelper("defineProperty"),[e,n||s.types.isLiteral(a)?a:s.types.stringLiteral(a.name),o]))}function buildPrivateStaticMethodInitLoose(e,t,r,a){const n=a.get(t.node.key.id.name);const{id:o,methodId:i,getId:l,setId:c,initAdded:u}=n;if(u)return;const p=l||c;if(p){a.set(t.node.key.id.name,Object.assign({},n,{initAdded:true}));return s.template.statement.ast` - Object.defineProperty(${e}, ${o}, { - // configurable is false by default - // enumerable is false by default - // writable is false by default - get: ${l?l.name:t.scope.buildUndefinedNode()}, - set: ${c?c.name:t.scope.buildUndefinedNode()} - }) - `}return s.template.statement.ast` - Object.defineProperty(${e}, ${o}, { - // configurable is false by default - // enumerable is false by default - // writable is false by default - value: ${i.name} - }); - `}function buildPrivateMethodDeclaration(e,t,r=false){const a=t.get(e.node.key.id.name);const{id:n,methodId:o,getId:i,setId:l,getterDeclared:c,setterDeclared:u,static:p}=a;const{params:d,body:f,generator:m,async:y}=e.node;const g=s.types.functionExpression(o,d,f,m,y);const h=i&&!c&&d.length===0;const b=l&&!u&&d.length>0;if(h){t.set(e.node.key.id.name,Object.assign({},a,{getterDeclared:true}));return s.types.variableDeclaration("var",[s.types.variableDeclarator(i,g)])}if(b){t.set(e.node.key.id.name,Object.assign({},a,{setterDeclared:true}));return s.types.variableDeclaration("var",[s.types.variableDeclarator(l,g)])}if(p&&!r){return s.types.variableDeclaration("var",[s.types.variableDeclarator(s.types.cloneNode(n),s.types.functionExpression(n,d,f,m,y))])}return s.types.variableDeclaration("var",[s.types.variableDeclarator(s.types.cloneNode(o),g)])}const d=s.traverse.visitors.merge([{ThisExpression(e,t){t.needsClassRef=true;e.replaceWith(s.types.cloneNode(t.classRef))}},a.environmentVisitor]);function replaceThisContext(e,t,r,n,o){const i={classRef:t,needsClassRef:false};const l=new a.default({methodPath:e,isLoose:o,superRef:r,file:n,getObjectRef(){i.needsClassRef=true;return e.node.static?t:s.types.memberExpression(t,s.types.identifier("prototype"))}});l.replace();if(e.isProperty()){e.traverse(d,i)}return i.needsClassRef}function buildFieldsInitNodes(e,t,r,a,n,o){const l=[];const c=[];let u=false;for(const p of r){i.assertFieldTransformed(p);const r=p.node.static;const d=!r;const f=p.isPrivate();const m=!f;const y=p.isProperty();const g=!y;if(r||g&&f){const r=replaceThisContext(p,e,t,n,o);u=u||r}switch(true){case r&&f&&y&&o:u=true;l.push(buildPrivateFieldInitLoose(s.types.cloneNode(e),p,a));break;case r&&f&&y&&!o:u=true;l.push(buildPrivateStaticFieldInitSpec(p,a));break;case r&&m&&y&&o:u=true;l.push(buildPublicFieldInitLoose(s.types.cloneNode(e),p));break;case r&&m&&y&&!o:u=true;l.push(buildPublicFieldInitSpec(s.types.cloneNode(e),p,n));break;case d&&f&&y&&o:c.push(buildPrivateFieldInitLoose(s.types.thisExpression(),p,a));break;case d&&f&&y&&!o:c.push(buildPrivateInstanceFieldInitSpec(s.types.thisExpression(),p,a));break;case d&&f&&g&&o:c.unshift(buildPrivateMethodInitLoose(s.types.thisExpression(),p,a));l.push(buildPrivateMethodDeclaration(p,a,o));break;case d&&f&&g&&!o:c.unshift(buildPrivateInstanceMethodInitSpec(s.types.thisExpression(),p,a));l.push(buildPrivateMethodDeclaration(p,a,o));break;case r&&f&&g&&!o:u=true;l.push(buildPrivateStaticFieldInitSpec(p,a));l.unshift(buildPrivateMethodDeclaration(p,a,o));break;case r&&f&&g&&o:u=true;l.push(buildPrivateStaticMethodInitLoose(s.types.cloneNode(e),p,n,a));l.unshift(buildPrivateMethodDeclaration(p,a,o));break;case d&&m&&y&&o:c.push(buildPublicFieldInitLoose(s.types.thisExpression(),p));break;case d&&m&&y&&!o:c.push(buildPublicFieldInitSpec(s.types.thisExpression(),p,n));break;default:throw new Error("Unreachable.")}}return{staticNodes:l.filter(Boolean),instanceNodes:c.filter(Boolean),wrapClass(t){for(const e of r){e.remove()}if(!u)return t;if(t.isClassExpression()){t.scope.push({id:e});t.replaceWith(s.types.assignmentExpression("=",s.types.cloneNode(e),t.node))}else if(!t.node.id){t.node.id=e}return t}}}},4026:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.createClassFeaturePlugin=createClassFeaturePlugin;Object.defineProperty(t,"injectInitialization",{enumerable:true,get:function(){return l.injectInitialization}});Object.defineProperty(t,"FEATURES",{enumerable:true,get:function(){return c.FEATURES}});var s=r(8304);var a=_interopRequireDefault(r(8486));var n=_interopRequireDefault(r(2046));var o=r(7988);var i=r(9009);var l=r(751);var c=r(889);var u=_interopRequireDefault(r(6190));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const p=u.default.version.split(".").reduce(((e,t)=>e*1e5+ +t),0);const d="@babel/plugin-class-features/version";function createClassFeaturePlugin({name:e,feature:t,loose:r,manipulateOptions:u}){return{name:e,manipulateOptions:u,pre(){(0,c.enableFeature)(this.file,t,r);if(!this.file.get(d)||this.file.get(d)0){(0,l.injectInitialization)(e,u,_,((e,t)=>{if(f)return;for(const r of m){if(r.node.static)continue;r.traverse(e,t)}}))}e=S(e);e.insertBefore([...E,...j]);e.insertAfter(w)},PrivateName(e){if(this.file.get(d)!==p||e.parentPath.isPrivate({key:e.node})){return}throw e.buildCodeFrameError(`Unknown PrivateName "${e}"`)},ExportDefaultDeclaration(e){if(this.file.get(d)!==p)return;const t=e.get("declaration");if(t.isClassDeclaration()&&(0,i.hasDecorators)(t.node)){if(t.node.id){(0,n.default)(e)}else{t.node.type="ClassExpression"}}}}}}},751:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.injectInitialization=injectInitialization;t.extractComputedKeys=extractComputedKeys;var s=r(8304);var a=r(2768);const n=s.traverse.visitors.merge([{Super(e){const{node:t,parentPath:r}=e;if(r.isCallExpression({callee:t})){this.push(r)}}},a.environmentVisitor]);const o={"TSTypeAnnotation|TypeAnnotation"(e){e.skip()},ReferencedIdentifier(e){if(this.scope.hasOwnBinding(e.node.name)){this.scope.rename(e.node.name);e.skip()}}};function handleClassTDZ(e,t){if(t.classBinding&&t.classBinding===e.scope.getBinding(e.node.name)){const r=t.file.addHelper("classNameTDZError");const a=s.types.callExpression(r,[s.types.stringLiteral(e.node.name)]);e.replaceWith(s.types.sequenceExpression([a,e.node]));e.skip()}}const i={ReferencedIdentifier:handleClassTDZ};function injectInitialization(e,t,r,a){if(!r.length)return;const i=!!e.node.superClass;if(!t){const r=s.types.classMethod("constructor",s.types.identifier("constructor"),[],s.types.blockStatement([]));if(i){r.params=[s.types.restElement(s.types.identifier("args"))];r.body.body.push(s.template.statement.ast`super(...args)`)}[t]=e.get("body").unshiftContainer("body",r)}if(a){a(o,{scope:t.scope})}if(i){const e=[];t.traverse(n,e);let a=true;for(const t of e){if(a){t.insertAfter(r);a=false}else{t.insertAfter(r.map((e=>s.types.cloneNode(e))))}}}else{t.get("body").unshiftContainer("body",r)}}function extractComputedKeys(e,t,r,a){const n=[];const o={classBinding:t.node.id&&t.scope.getBinding(t.node.id.name),file:a};for(const e of r){const r=e.get("key");if(r.isReferencedIdentifier()){handleClassTDZ(r,o)}else{r.traverse(i,o)}const a=e.node;if(!r.isConstantExpression()){const e=t.scope.generateUidIdentifierBasedOnNode(a.key);t.scope.push({id:e,kind:"let"});n.push(s.types.expressionStatement(s.types.assignmentExpression("=",s.types.cloneNode(e),a.key)));a.key=s.types.cloneNode(e)}}return n}},3121:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.assertFieldTransformed=assertFieldTransformed;function assertFieldTransformed(e){if(e.node.declare){throw e.buildCodeFrameError(`TypeScript 'declare' fields must first be transformed by `+`@babel/plugin-transform-typescript.\n`+`If you have already enabled that plugin (or '@babel/preset-typescript'), make sure `+`that it runs before any plugin related to additional class features:\n`+` - @babel/plugin-proposal-class-properties\n`+` - @babel/plugin-proposal-private-methods\n`+` - @babel/plugin-proposal-decorators`)}}},8486:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=_interopRequireDefault(r(1393));var a=_interopRequireDefault(r(4489));var n=_interopRequireWildcard(r(8622));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const o=(0,a.default)(`\n (function (FUNCTION_KEY) {\n function FUNCTION_ID() {\n return FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n }\n\n return FUNCTION_ID;\n })(FUNCTION)\n`);const i=(0,a.default)(`\n (function (FUNCTION_KEY) {\n function* FUNCTION_ID() {\n return yield* FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n };\n\n return FUNCTION_ID;\n })(FUNCTION)\n`);const l={"ReferencedIdentifier|BindingIdentifier"(e,t){if(e.node.name!==t.name)return;const r=e.scope.getBindingIdentifier(t.name);if(r!==t.outerDeclar)return;t.selfReference=true;e.stop()}};function getNameFromLiteralId(e){if(n.isNullLiteral(e)){return"null"}if(n.isRegExpLiteral(e)){return`_${e.pattern}_${e.flags}`}if(n.isTemplateLiteral(e)){return e.quasis.map((e=>e.value.raw)).join("")}if(e.value!==undefined){return e.value+""}return""}function wrap(e,t,r,a){if(e.selfReference){if(a.hasBinding(r.name)&&!a.hasGlobal(r.name)){a.rename(r.name)}else{if(!n.isFunction(t))return;let e=o;if(t.generator){e=i}const l=e({FUNCTION:t,FUNCTION_ID:r,FUNCTION_KEY:a.generateUidIdentifier(r.name)}).expression;const c=l.callee.body.body[0].params;for(let e=0,r=(0,s.default)(t);e{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=_interopRequireWildcard(r(8622));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _default(e,t,r,a){if(r.length===1&&s.isSpreadElement(r[0])&&s.isIdentifier(r[0].argument,{name:"arguments"})){return s.callExpression(s.memberExpression(e,s.identifier("apply")),[t,r[0].argument])}else{if(a){return s.optionalCallExpression(s.optionalMemberExpression(e,s.identifier("call"),false,true),[t,...r],false)}return s.callExpression(s.memberExpression(e,s.identifier("call")),[t,...r])}}},249:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},2768:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.skipAllButComputedKey=skipAllButComputedKey;t["default"]=t.environmentVisitor=void 0;var s=_interopRequireDefault(r(7369));var a=_interopRequireDefault(r(3546));var n=_interopRequireDefault(r(6351));var o=_interopRequireWildcard(r(8622));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function getPrototypeOfExpression(e,t,r,s){e=o.cloneNode(e);const a=t||s?e:o.memberExpression(e,o.identifier("prototype"));return o.callExpression(r.addHelper("getPrototypeOf"),[a])}function skipAllButComputedKey(e){if(!e.node.computed){e.skip();return}const t=o.VISITOR_KEYS[e.type];for(const r of t){if(r!=="key")e.skipKey(r)}}const i={[`${o.StaticBlock?"StaticBlock|":""}ClassPrivateProperty|TypeAnnotation`](e){e.skip()},Function(e){if(e.isMethod())return;if(e.isArrowFunctionExpression())return;e.skip()},"Method|ClassProperty"(e){skipAllButComputedKey(e)}};t.environmentVisitor=i;const l=s.default.visitors.merge([i,{Super(e,t){const{node:r,parentPath:s}=e;if(!s.isMemberExpression({object:r}))return;t.handle(s)}}]);const c={memoise(e,t){const{scope:r,node:s}=e;const{computed:a,property:n}=s;if(!a){return}const o=r.maybeGenerateMemoised(n);if(!o){return}this.memoiser.set(n,o,t)},prop(e){const{computed:t,property:r}=e.node;if(this.memoiser.has(r)){return o.cloneNode(this.memoiser.get(r))}if(t){return o.cloneNode(r)}return o.stringLiteral(r.name)},get(e){return this._get(e,this._getThisRefs())},_get(e,t){const r=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("get"),[t.memo?o.sequenceExpression([t.memo,r]):r,this.prop(e),t.this])},_getThisRefs(){if(!this.isDerivedConstructor){return{this:o.thisExpression()}}const e=this.scope.generateDeclaredUidIdentifier("thisSuper");return{memo:o.assignmentExpression("=",e,o.thisExpression()),this:o.cloneNode(e)}},set(e,t){const r=this._getThisRefs();const s=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("set"),[r.memo?o.sequenceExpression([r.memo,s]):s,this.prop(e),t,r.this,o.booleanLiteral(e.isInStrictMode())])},destructureSet(e){throw e.buildCodeFrameError(`Destructuring to a super field is not supported yet.`)},call(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,false)},optionalCall(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,true)}};const u=Object.assign({},c,{prop(e){const{property:t}=e.node;if(this.memoiser.has(t)){return o.cloneNode(this.memoiser.get(t))}return o.cloneNode(t)},get(e){const{isStatic:t,superRef:r}=this;const{computed:s}=e.node;const a=this.prop(e);let n;if(t){n=r?o.cloneNode(r):o.memberExpression(o.identifier("Function"),o.identifier("prototype"))}else{n=r?o.memberExpression(o.cloneNode(r),o.identifier("prototype")):o.memberExpression(o.identifier("Object"),o.identifier("prototype"))}return o.memberExpression(n,a,s)},set(e,t){const{computed:r}=e.node;const s=this.prop(e);return o.assignmentExpression("=",o.memberExpression(o.thisExpression(),s,r),t)},destructureSet(e){const{computed:t}=e.node;const r=this.prop(e);return o.memberExpression(o.thisExpression(),r,t)},call(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,false)},optionalCall(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,true)}});class ReplaceSupers{constructor(e){const t=e.methodPath;this.methodPath=t;this.isDerivedConstructor=t.isClassMethod({kind:"constructor"})&&!!e.superRef;this.isStatic=t.isObjectMethod()||t.node.static;this.isPrivateMethod=t.isPrivate()&&t.isMethod();this.file=e.file;this.superRef=e.superRef;this.isLoose=e.isLoose;this.opts=e}getObjectRef(){return o.cloneNode(this.opts.objectRef||this.opts.getObjectRef())}replace(){const e=this.isLoose?u:c;(0,a.default)(this.methodPath,l,Object.assign({file:this.file,scope:this.methodPath.scope,isDerivedConstructor:this.isDerivedConstructor,isStatic:this.isStatic,isPrivateMethod:this.isPrivateMethod,getObjectRef:this.getObjectRef.bind(this),superRef:this.superRef},e))}}t["default"]=ReplaceSupers},2046:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=splitExportDeclaration;var s=_interopRequireWildcard(r(8622));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function splitExportDeclaration(e){if(!e.isExportDeclaration()){throw new Error("Only export declarations can be split.")}const t=e.isExportDefaultDeclaration();const r=e.get("declaration");const a=r.isClassDeclaration();if(t){const t=r.isFunctionDeclaration()||a;const n=r.isScope()?r.scope.parent:r.scope;let o=r.node.id;let i=false;if(!o){i=true;o=n.generateUidIdentifier("default");if(t||r.isFunctionExpression()||r.isClassExpression()){r.node.id=s.cloneNode(o)}}const l=t?r:s.variableDeclaration("var",[s.variableDeclarator(s.cloneNode(o),r.node)]);const c=s.exportNamedDeclaration(null,[s.exportSpecifier(s.cloneNode(o),s.identifier("default"))]);e.insertAfter(c);e.replaceWith(l);if(i){n.registerDeclaration(e)}return e}if(e.get("specifiers").length>0){throw new Error("It doesn't make sense to split exported specifiers.")}const n=r.getOuterBindingIdentifiers();const o=Object.keys(n).map((e=>s.exportSpecifier(s.identifier(e),s.identifier(e))));const i=s.exportNamedDeclaration(null,o);e.insertAfter(i);e.replaceWith(r.node);return e}},891:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=createTemplateBuilder;var s=r(4429);var a=_interopRequireDefault(r(9430));var n=_interopRequireDefault(r(9221));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const o=(0,s.validate)({placeholderPattern:false});function createTemplateBuilder(e,t){const r=new WeakMap;const i=new WeakMap;const l=t||(0,s.validate)(null);return Object.assign(((t,...o)=>{if(typeof t==="string"){if(o.length>1)throw new Error("Unexpected extra params.");return extendedTrace((0,a.default)(e,t,(0,s.merge)(l,(0,s.validate)(o[0]))))}else if(Array.isArray(t)){let s=r.get(t);if(!s){s=(0,n.default)(e,t,l);r.set(t,s)}return extendedTrace(s(o))}else if(typeof t==="object"&&t){if(o.length>0)throw new Error("Unexpected extra params.");return createTemplateBuilder(e,(0,s.merge)(l,(0,s.validate)(t)))}throw new Error(`Unexpected template param ${typeof t}`)}),{ast:(t,...r)=>{if(typeof t==="string"){if(r.length>1)throw new Error("Unexpected extra params.");return(0,a.default)(e,t,(0,s.merge)((0,s.merge)(l,(0,s.validate)(r[0])),o))()}else if(Array.isArray(t)){let a=i.get(t);if(!a){a=(0,n.default)(e,t,(0,s.merge)(l,o));i.set(t,a)}return a(r)()}throw new Error(`Unexpected template param ${typeof t}`)}})}function extendedTrace(e){let t="";try{throw new Error}catch(e){if(e.stack){t=e.stack.split("\n").slice(3).join("\n")}}return r=>{try{return e(r)}catch(e){e.stack+=`\n =============\n${t}`;throw e}}}},119:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.program=t.expression=t.statement=t.statements=t.smart=void 0;var s=_interopRequireWildcard(r(8622));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function makeStatementFormatter(e){return{code:e=>`/* @babel/template */;\n${e}`,validate:()=>{},unwrap:t=>e(t.program.body.slice(1))}}const a=makeStatementFormatter((e=>{if(e.length>1){return e}else{return e[0]}}));t.smart=a;const n=makeStatementFormatter((e=>e));t.statements=n;const o=makeStatementFormatter((e=>{if(e.length===0){throw new Error("Found nothing to return.")}if(e.length>1){throw new Error("Found multiple statements but wanted one")}return e[0]}));t.statement=o;const i={code:e=>`(\n${e}\n)`,validate:e=>{if(e.program.body.length>1){throw new Error("Found multiple statements but wanted one")}if(i.unwrap(e).start===0){throw new Error("Parse result included parens.")}},unwrap:({program:e})=>{const[t]=e.body;s.assertExpressionStatement(t);return t.expression}};t.expression=i;const l={code:e=>e,validate:()=>{},unwrap:e=>e.program};t.program=l},4489:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=t.program=t.expression=t.statements=t.statement=t.smart=void 0;var s=_interopRequireWildcard(r(119));var a=_interopRequireDefault(r(891));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const n=(0,a.default)(s.smart);t.smart=n;const o=(0,a.default)(s.statement);t.statement=o;const i=(0,a.default)(s.statements);t.statements=i;const l=(0,a.default)(s.expression);t.expression=l;const c=(0,a.default)(s.program);t.program=c;var u=Object.assign(n.bind(undefined),{smart:n,statement:o,statements:i,expression:l,program:c,ast:n.ast});t["default"]=u},9221:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=literalTemplate;var s=r(4429);var a=_interopRequireDefault(r(5475));var n=_interopRequireDefault(r(553));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function literalTemplate(e,t,r){const{metadata:a,names:o}=buildLiteralData(e,t,r);return t=>{const r={};t.forEach(((e,t)=>{r[o[t]]=e}));return t=>{const o=(0,s.normalizeReplacements)(t);if(o){Object.keys(o).forEach((e=>{if(Object.prototype.hasOwnProperty.call(r,e)){throw new Error("Unexpected replacement overlap.")}}))}return e.unwrap((0,n.default)(a,o?Object.assign(o,r):r))}}}function buildLiteralData(e,t,r){let s;let n;let o;let i="";do{i+="$";const l=buildTemplateCode(t,i);s=l.names;n=new Set(s);o=(0,a.default)(e,e.code(l.code),{parser:r.parser,placeholderWhitelist:new Set(l.names.concat(r.placeholderWhitelist?Array.from(r.placeholderWhitelist):[])),placeholderPattern:r.placeholderPattern,preserveComments:r.preserveComments,syntacticPlaceholders:r.syntacticPlaceholders})}while(o.placeholders.some((e=>e.isDuplicate&&n.has(e.name))));return{metadata:o,names:s}}function buildTemplateCode(e,t){const r=[];let s=e[0];for(let a=1;a{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.merge=merge;t.validate=validate;t.normalizeReplacements=normalizeReplacements;function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var r={};var s=Object.keys(e);var a,n;for(n=0;n=0)continue;r[a]=e[a]}return r}function merge(e,t){const{placeholderWhitelist:r=e.placeholderWhitelist,placeholderPattern:s=e.placeholderPattern,preserveComments:a=e.preserveComments,syntacticPlaceholders:n=e.syntacticPlaceholders}=t;return{parser:Object.assign({},e.parser,t.parser),placeholderWhitelist:r,placeholderPattern:s,preserveComments:a,syntacticPlaceholders:n}}function validate(e){if(e!=null&&typeof e!=="object"){throw new Error("Unknown template options.")}const t=e||{},{placeholderWhitelist:r,placeholderPattern:s,preserveComments:a,syntacticPlaceholders:n}=t,o=_objectWithoutPropertiesLoose(t,["placeholderWhitelist","placeholderPattern","preserveComments","syntacticPlaceholders"]);if(r!=null&&!(r instanceof Set)){throw new Error("'.placeholderWhitelist' must be a Set, null, or undefined")}if(s!=null&&!(s instanceof RegExp)&&s!==false){throw new Error("'.placeholderPattern' must be a RegExp, false, null, or undefined")}if(a!=null&&typeof a!=="boolean"){throw new Error("'.preserveComments' must be a boolean, null, or undefined")}if(n!=null&&typeof n!=="boolean"){throw new Error("'.syntacticPlaceholders' must be a boolean, null, or undefined")}if(n===true&&(r!=null||s!=null)){throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible"+" with '.syntacticPlaceholders: true'")}return{parser:o,placeholderWhitelist:r||undefined,placeholderPattern:s==null?undefined:s,preserveComments:a==null?undefined:a,syntacticPlaceholders:n==null?undefined:n}}function normalizeReplacements(e){if(Array.isArray(e)){return e.reduce(((e,t,r)=>{e["$"+r]=t;return e}),{})}else if(typeof e==="object"||e==null){return e||undefined}throw new Error("Template replacements must be an array, object, null, or undefined")}},5475:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=parseAndBuildMetadata;var s=_interopRequireWildcard(r(8622));var a=r(6949);var n=r(7548);function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const o=/^[_$A-Z0-9]+$/;function parseAndBuildMetadata(e,t,r){const{placeholderWhitelist:a,placeholderPattern:n,preserveComments:o,syntacticPlaceholders:i}=r;const l=parseWithCodeFrame(t,r.parser,i);s.removePropertiesDeep(l,{preserveComments:o});e.validate(l);const c={placeholders:[],placeholderNames:new Set};const u={placeholders:[],placeholderNames:new Set};const p={value:undefined};s.traverse(l,placeholderVisitorHandler,{syntactic:c,legacy:u,isLegacyRef:p,placeholderWhitelist:a,placeholderPattern:n,syntacticPlaceholders:i});return Object.assign({ast:l},p.value?u:c)}function placeholderVisitorHandler(e,t,r){var a;let n;if(s.isPlaceholder(e)){if(r.syntacticPlaceholders===false){throw new Error("%%foo%%-style placeholders can't be used when "+"'.syntacticPlaceholders' is false.")}else{n=e.name.name;r.isLegacyRef.value=false}}else if(r.isLegacyRef.value===false||r.syntacticPlaceholders){return}else if(s.isIdentifier(e)||s.isJSXIdentifier(e)){n=e.name;r.isLegacyRef.value=true}else if(s.isStringLiteral(e)){n=e.value;r.isLegacyRef.value=true}else{return}if(!r.isLegacyRef.value&&(r.placeholderPattern!=null||r.placeholderWhitelist!=null)){throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible"+" with '.syntacticPlaceholders: true'")}if(r.isLegacyRef.value&&(r.placeholderPattern===false||!(r.placeholderPattern||o).test(n))&&!((a=r.placeholderWhitelist)==null?void 0:a.has(n))){return}t=t.slice();const{node:i,key:l}=t[t.length-1];let c;if(s.isStringLiteral(e)||s.isPlaceholder(e,{expectedNode:"StringLiteral"})){c="string"}else if(s.isNewExpression(i)&&l==="arguments"||s.isCallExpression(i)&&l==="arguments"||s.isFunction(i)&&l==="params"){c="param"}else if(s.isExpressionStatement(i)&&!s.isPlaceholder(e)){c="statement";t=t.slice(0,-1)}else if(s.isStatement(e)&&s.isPlaceholder(e)){c="statement"}else{c="other"}const{placeholders:u,placeholderNames:p}=r.isLegacyRef.value?r.legacy:r.syntactic;u.push({name:n,type:c,resolve:e=>resolveAncestors(e,t),isDuplicate:p.has(n)});p.add(n)}function resolveAncestors(e,t){let r=e;for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=populatePlaceholders;var s=_interopRequireWildcard(r(8622));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function populatePlaceholders(e,t){const r=s.cloneNode(e.ast);if(t){e.placeholders.forEach((e=>{if(!Object.prototype.hasOwnProperty.call(t,e.name)){const t=e.name;throw new Error(`Error: No substitution given for "${t}". If this is not meant to be a\n placeholder you may want to consider passing one of the following options to @babel/template:\n - { placeholderPattern: false, placeholderWhitelist: new Set(['${t}'])}\n - { placeholderPattern: /^${t}$/ }`)}}));Object.keys(t).forEach((t=>{if(!e.placeholderNames.has(t)){throw new Error(`Unknown substitution "${t}" given`)}}))}e.placeholders.slice().reverse().forEach((e=>{try{applyReplacement(e,r,t&&t[e.name]||null)}catch(t){t.message=`@babel/template placeholder "${e.name}": ${t.message}`;throw t}}));return r}function applyReplacement(e,t,r){if(e.isDuplicate){if(Array.isArray(r)){r=r.map((e=>s.cloneNode(e)))}else if(typeof r==="object"){r=s.cloneNode(r)}}const{parent:a,key:n,index:o}=e.resolve(t);if(e.type==="string"){if(typeof r==="string"){r=s.stringLiteral(r)}if(!r||!s.isStringLiteral(r)){throw new Error("Expected string substitution")}}else if(e.type==="statement"){if(o===undefined){if(!r){r=s.emptyStatement()}else if(Array.isArray(r)){r=s.blockStatement(r)}else if(typeof r==="string"){r=s.expressionStatement(s.identifier(r))}else if(!s.isStatement(r)){r=s.expressionStatement(r)}}else{if(r&&!Array.isArray(r)){if(typeof r==="string"){r=s.identifier(r)}if(!s.isStatement(r)){r=s.expressionStatement(r)}}}}else if(e.type==="param"){if(typeof r==="string"){r=s.identifier(r)}if(o===undefined)throw new Error("Assertion failure.")}else{if(typeof r==="string"){r=s.identifier(r)}if(Array.isArray(r)){throw new Error("Cannot replace single expression with an array.")}}if(o===undefined){s.validate(a,n,r);a[n]=r}else{const t=a[n].slice();if(e.type==="statement"||e.type==="param"){if(r==null){t.splice(o,1)}else if(Array.isArray(r)){t.splice(o,1,...r)}else{t[o]=r}}else{t[o]=r}s.validate(a,n,t);a[n]=t}}},9430:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=stringTemplate;var s=r(4429);var a=_interopRequireDefault(r(5475));var n=_interopRequireDefault(r(553));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function stringTemplate(e,t,r){t=e.code(t);let o;return i=>{const l=(0,s.normalizeReplacements)(i);if(!o)o=(0,a.default)(e,t,r);return e.unwrap((0,n.default)(o,l))}}},4920:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3497);var a=r(2074);const n=["commonjs","amd","systemjs"];const o=`@babel/plugin-proposal-dynamic-import depends on a modules\ntransform plugin. Supported plugins are:\n - @babel/plugin-transform-modules-commonjs ^7.4.0\n - @babel/plugin-transform-modules-amd ^7.4.0\n - @babel/plugin-transform-modules-systemjs ^7.4.0\n\nIf you are using Webpack or Rollup and thus don't want\nBabel to transpile your imports and exports, you can use\nthe @babel/plugin-syntax-dynamic-import plugin and let your\nbundler handle dynamic imports.\n`;var i=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-dynamic-import",inherits:a.default,pre(){this.file.set("@babel/plugin-proposal-dynamic-import","7.14.5")},visitor:{Program(){const e=this.file.get("@babel/plugin-transform-modules-*");if(!n.includes(e)){throw new Error(o)}}}}}));t["default"]=i},3497:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9579:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(791);var a=r(1454);var n=r(8304);var o=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-export-namespace-from",inherits:a.default,visitor:{ExportNamedDeclaration(e){var t;const{node:r,scope:s}=e;const{specifiers:a}=r;const o=n.types.isExportDefaultSpecifier(a[0])?1:0;if(!n.types.isExportNamespaceSpecifier(a[o]))return;const i=[];if(o===1){i.push(n.types.exportNamedDeclaration(null,[a.shift()],r.source))}const l=a.shift();const{exported:c}=l;const u=s.generateUidIdentifier((t=c.name)!=null?t:c.value);i.push(n.types.importDeclaration([n.types.importNamespaceSpecifier(u)],n.types.cloneNode(r.source)),n.types.exportNamedDeclaration(null,[n.types.exportSpecifier(n.types.cloneNode(u),c)]));if(r.specifiers.length>=1){i.push(r)}const[p]=e.replaceWithMultiple(i);e.scope.registerDeclaration(p)}}}}));t["default"]=o},791:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7703:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(169);var a=r(3030);var n=(0,s.declare)((e=>{e.assertVersion(7);const t=/(\\*)([\u2028\u2029])/g;function replace(e,t,r){const s=t.length%2===1;if(s)return e;return`${t}\\u${r.charCodeAt(0).toString(16)}`}return{name:"proposal-json-strings",inherits:a.default,visitor:{"DirectiveLiteral|StringLiteral"({node:e}){const{extra:r}=e;if(!(r!=null&&r.raw))return;r.raw=r.raw.replace(t,replace)}}}}));t["default"]=n},169:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1195:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(7010);var a=r(5945);var n=r(8304);var o=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-logical-assignment-operators",inherits:a.default,visitor:{AssignmentExpression(e){const{node:t,scope:r}=e;const{operator:s,left:a,right:o}=t;const i=s.slice(0,-1);if(!n.types.LOGICAL_OPERATORS.includes(i)){return}const l=n.types.cloneNode(a);if(n.types.isMemberExpression(a)){const{object:e,property:t,computed:s}=a;const o=r.maybeGenerateMemoised(e);if(o){a.object=o;l.object=n.types.assignmentExpression("=",n.types.cloneNode(o),e)}if(s){const e=r.maybeGenerateMemoised(t);if(e){a.property=e;l.property=n.types.assignmentExpression("=",n.types.cloneNode(e),t)}}}e.replaceWith(n.types.logicalExpression(i,l,n.types.assignmentExpression("=",a,o)))}}}}));t["default"]=o},7010:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5353:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6080);var a=r(5879);var n=r(8304);var o=(0,s.declare)(((e,{loose:t=false})=>{var r;e.assertVersion(7);const s=(r=e.assumption("noDocumentAll"))!=null?r:t;return{name:"proposal-nullish-coalescing-operator",inherits:a.default,visitor:{LogicalExpression(e){const{node:t,scope:r}=e;if(t.operator!=="??"){return}let a;let o;if(r.isStatic(t.left)){a=t.left;o=n.types.cloneNode(t.left)}else if(r.path.isPattern()){e.replaceWith(n.template.ast`(() => ${e.node})()`);return}else{a=r.generateUidIdentifierBasedOnNode(t.left);r.push({id:n.types.cloneNode(a)});o=n.types.assignmentExpression("=",a,t.left)}e.replaceWith(n.types.conditionalExpression(s?n.types.binaryExpression("!=",o,n.types.nullLiteral()):n.types.logicalExpression("&&",n.types.binaryExpression("!==",o,n.types.nullLiteral()),n.types.binaryExpression("!==",n.types.cloneNode(a),r.buildUndefinedNode())),n.types.cloneNode(a),t.right))}}}}));t["default"]=o},6080:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7300:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(5071);var a=r(1816);function remover({node:e}){var t;const{extra:r}=e;if(r!=null&&(t=r.raw)!=null&&t.includes("_")){r.raw=r.raw.replace(/_/g,"")}}var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-numeric-separator",inherits:a.default,visitor:{NumericLiteral:remover,BigIntLiteral:remover}}}));t["default"]=n},5071:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},6309:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8711);var a=r(4499);var n=r(8304);var o=r(3714);var i=r(797);var l=r(5732);const c=(()=>{const e=n.types.identifier("a");const t=n.types.objectProperty(n.types.identifier("key"),e);const r=n.types.objectPattern([t]);return n.types.isReferenced(e,t,r)?1:0})();var u=(0,s.declare)(((e,t)=>{var r,s,u,p;e.assertVersion(7);const d=e.targets();const f=!(0,i.isRequired)("es6.object.assign",d,{compatData:l});const{useBuiltIns:m=f,loose:y=false}=t;if(typeof y!=="boolean"){throw new Error(".loose must be a boolean, or undefined")}const g=(r=e.assumption("ignoreFunctionLength"))!=null?r:y;const h=(s=e.assumption("objectRestNoSymbols"))!=null?s:y;const b=(u=e.assumption("pureGetters"))!=null?u:y;const x=(p=e.assumption("setSpreadProperties"))!=null?p:y;function getExtendsHelper(e){return m?n.types.memberExpression(n.types.identifier("Object"),n.types.identifier("assign")):e.addHelper("extends")}function hasRestElement(e){let t=false;visitRestElements(e,(e=>{t=true;e.stop()}));return t}function hasObjectPatternRestElement(e){let t=false;visitRestElements(e,(e=>{if(e.parentPath.isObjectPattern()){t=true;e.stop()}}));return t}function visitRestElements(e,t){e.traverse({Expression(e){const t=e.parent.type;if(t==="AssignmentPattern"&&e.key==="right"||t==="ObjectProperty"&&e.parent.computed&&e.key==="key"){e.skip()}},RestElement:t})}function hasSpread(e){for(const t of e.properties){if(n.types.isSpreadElement(t)){return true}}return false}function extractNormalizedKeys(e){const t=e.node.properties;const r=[];let s=true;let a=false;for(const e of t){if(n.types.isIdentifier(e.key)&&!e.computed){r.push(n.types.stringLiteral(e.key.name))}else if(n.types.isTemplateLiteral(e.key)){r.push(n.types.cloneNode(e.key));a=true}else if(n.types.isLiteral(e.key)){r.push(n.types.stringLiteral(String(e.key.value)))}else{r.push(n.types.cloneNode(e.key));s=false}}return{keys:r,allLiteral:s,hasTemplateLiteral:a}}function replaceImpureComputedKeys(e,t){const r=[];for(const s of e){const e=s.get("key");if(s.node.computed&&!e.isPure()){const s=t.generateUidBasedOnNode(e.node);const a=n.types.variableDeclarator(n.types.identifier(s),e.node);r.push(a);e.replaceWith(n.types.identifier(s))}}return r}function removeUnusedExcludedKeys(e){const t=e.getOuterBindingIdentifierPaths();Object.keys(t).forEach((r=>{const s=t[r].parentPath;if(e.scope.getBinding(r).references>c||!s.isObjectProperty()){return}s.remove()}))}function createObjectRest(e,t,r){const s=e.get("properties");const a=s[s.length-1];n.types.assertRestElement(a.node);const o=n.types.cloneNode(a.node);a.remove();const i=replaceImpureComputedKeys(e.get("properties"),e.scope);const{keys:l,allLiteral:c,hasTemplateLiteral:u}=extractNormalizedKeys(e);if(l.length===0){return[i,o.argument,n.types.callExpression(getExtendsHelper(t),[n.types.objectExpression([]),n.types.cloneNode(r)])]}let p;if(!c){p=n.types.callExpression(n.types.memberExpression(n.types.arrayExpression(l),n.types.identifier("map")),[t.addHelper("toPropertyKey")])}else{p=n.types.arrayExpression(l);if(!u&&!n.types.isProgram(e.scope.block)){const t=e.findParent((e=>e.isProgram()));const r=e.scope.generateUidIdentifier("excluded");t.scope.push({id:r,init:p,kind:"const"});p=n.types.cloneNode(r)}}return[i,o.argument,n.types.callExpression(t.addHelper(`objectWithoutProperties${h?"Loose":""}`),[n.types.cloneNode(r),p])]}function replaceRestElement(e,t,r){if(t.isAssignmentPattern()){replaceRestElement(e,t.get("left"),r);return}if(t.isArrayPattern()&&hasRestElement(t)){const s=t.get("elements");for(let t=0;te.skip(),"ReferencedIdentifier|BindingIdentifier":IdentifierHandler},e.scope)}}}if(!a){for(let e=0;ee>=n-1||r.has(e);(0,o.convertFunctionParams)(e,g,shouldTransformParam,replaceRestElement)}},VariableDeclarator(e,t){if(!e.get("id").isObjectPattern()){return}let r=e;const s=e;visitRestElements(e.get("id"),(e=>{if(!e.parentPath.isObjectPattern()){return}if(s.node.id.properties.length>1&&!n.types.isIdentifier(s.node.init)){const t=e.scope.generateUidIdentifierBasedOnNode(s.node.init,"ref");s.insertBefore(n.types.variableDeclarator(t,s.node.init));s.replaceWith(n.types.variableDeclarator(s.node.id,n.types.cloneNode(t)));return}let a=s.node.init;const o=[];let i;e.findParent((e=>{if(e.isObjectProperty()){o.unshift(e)}else if(e.isVariableDeclarator()){i=e.parentPath.node.kind;return true}}));const l=replaceImpureComputedKeys(o,e.scope);o.forEach((e=>{const{node:t}=e;a=n.types.memberExpression(a,n.types.cloneNode(t.key),t.computed||n.types.isLiteral(t.key))}));const c=e.findParent((e=>e.isObjectPattern()));const[u,p,d]=createObjectRest(c,t,a);if(b){removeUnusedExcludedKeys(c)}n.types.assertIdentifier(p);r.insertBefore(u);r.insertBefore(l);r.insertAfter(n.types.variableDeclarator(p,d));r=r.getSibling(r.key+1);e.scope.registerBinding(i,r);if(c.node.properties.length===0){c.findParent((e=>e.isObjectProperty()||e.isVariableDeclarator())).remove()}}))},ExportNamedDeclaration(e){const t=e.get("declaration");if(!t.isVariableDeclaration())return;const r=t.get("declarations").some((e=>hasObjectPatternRestElement(e.get("id"))));if(!r)return;const s=[];for(const t of Object.keys(e.getOuterBindingIdentifiers(e))){s.push(n.types.exportSpecifier(n.types.identifier(t),n.types.identifier(t)))}e.replaceWith(t.node);e.insertAfter(n.types.exportNamedDeclaration(null,s))},CatchClause(e){const t=e.get("param");replaceRestElement(t.parentPath,t)},AssignmentExpression(e,t){const r=e.get("left");if(r.isObjectPattern()&&hasRestElement(r)){const s=[];const a=e.scope.generateUidBasedOnNode(e.node.right,"ref");s.push(n.types.variableDeclaration("var",[n.types.variableDeclarator(n.types.identifier(a),e.node.right)]));const[o,i,l]=createObjectRest(r,t,n.types.identifier(a));if(o.length>0){s.push(n.types.variableDeclaration("var",o))}const c=n.types.cloneNode(e.node);c.right=n.types.identifier(a);s.push(n.types.expressionStatement(c));s.push(n.types.toStatement(n.types.assignmentExpression("=",i,l)));s.push(n.types.expressionStatement(n.types.identifier(a)));e.replaceWithMultiple(s)}},ForXStatement(e){const{node:t,scope:r}=e;const s=e.get("left");const a=t.left;if(!hasObjectPatternRestElement(s)){return}if(!n.types.isVariableDeclaration(a)){const s=r.generateUidIdentifier("ref");t.left=n.types.variableDeclaration("var",[n.types.variableDeclarator(s)]);e.ensureBlock();if(t.body.body.length===0&&e.isCompletionRecord()){t.body.body.unshift(n.types.expressionStatement(r.buildUndefinedNode()))}t.body.body.unshift(n.types.expressionStatement(n.types.assignmentExpression("=",a,n.types.cloneNode(s))))}else{const s=a.declarations[0].id;const o=r.generateUidIdentifier("ref");t.left=n.types.variableDeclaration(a.kind,[n.types.variableDeclarator(o,null)]);e.ensureBlock();t.body.body.unshift(n.types.variableDeclaration(t.left.kind,[n.types.variableDeclarator(s,n.types.cloneNode(o))]))}},ArrayPattern(e){const t=[];visitRestElements(e,(e=>{if(!e.parentPath.isObjectPattern()){return}const r=e.parentPath;const s=e.scope.generateUidIdentifier("ref");t.push(n.types.variableDeclarator(r.node,s));r.replaceWith(n.types.cloneNode(s));e.skip()}));if(t.length>0){const r=e.getStatementParent();r.insertAfter(n.types.variableDeclaration(r.node.kind||"var",t))}},ObjectExpression(e,t){if(!hasSpread(e.node))return;let r;if(x){r=getExtendsHelper(t)}else{try{r=t.addHelper("objectSpread2")}catch(e){this.file.declarations["objectSpread2"]=null;r=t.addHelper("objectSpread")}}let s=null;let a=[];function make(){const e=a.length>0;const t=n.types.objectExpression(a);a=[];if(!s){s=n.types.callExpression(r,[t]);return}if(b){if(e){s.arguments.push(t)}return}s=n.types.callExpression(n.types.cloneNode(r),[s,...e?[n.types.objectExpression([]),t]:[]])}for(const t of e.node.properties){if(n.types.isSpreadElement(t)){make();s.arguments.push(t.argument)}else{a.push(t)}}if(a.length)make();e.replaceWith(s)}}}}));t["default"]=u},5732:(e,t,r)=>{e.exports=r(5880)},8711:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},4195:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6970);var a=r(7452);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-optional-catch-binding",inherits:a.default,visitor:{CatchClause(e){if(!e.node.param){const t=e.scope.generateUidIdentifier("unused");const r=e.get("param");r.replaceWith(t)}}}}}));t["default"]=n},6970:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7490:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(2262);var a=r(79);var n=r(8304);var o=r(5480);function _interopDefaultLegacy(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var i=_interopDefaultLegacy(a);function willPathCastToBoolean(e){const t=findOutermostTransparentParent(e);const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}function findOutermostTransparentParent(e){let t=e;e.findParent((e=>{if(!o.isTransparentExprWrapper(e))return true;t=e}));return t}const{ast:l}=n.template.expression;function isSimpleMemberExpression(e){e=o.skipTransparentExprWrappers(e);return n.types.isIdentifier(e)||n.types.isSuper(e)||n.types.isMemberExpression(e)&&!e.computed&&isSimpleMemberExpression(e.object)}function needsMemoize(e){let t=e;const{scope:r}=e;while(t.isOptionalMemberExpression()||t.isOptionalCallExpression()){const{node:e}=t;const s=t.isOptionalMemberExpression()?"object":"callee";const a=o.skipTransparentExprWrappers(t.get(s));if(e.optional){return!r.isStatic(a.node)}t=a}}function transform(e,{pureGetters:t,noDocumentAll:r}){const{scope:s}=e;const a=findOutermostTransparentParent(e);const{parentPath:i}=a;const c=willPathCastToBoolean(a);let u=false;const p=i.isCallExpression({callee:a.node})&&e.isOptionalMemberExpression();const d=[];let f=e;if(s.path.isPattern()&&needsMemoize(f)){e.replaceWith(n.template.ast`(() => ${e.node})()`);return}while(f.isOptionalMemberExpression()||f.isOptionalCallExpression()){const{node:e}=f;if(e.optional){d.push(e)}if(f.isOptionalMemberExpression()){f.node.type="MemberExpression";f=o.skipTransparentExprWrappers(f.get("object"))}else if(f.isOptionalCallExpression()){f.node.type="CallExpression";f=o.skipTransparentExprWrappers(f.get("callee"))}}let m=e;if(i.isUnaryExpression({operator:"delete"})){m=i;u=true}for(let e=d.length-1;e>=0;e--){const a=d[e];const i=n.types.isCallExpression(a);const f=i?"callee":"object";const g=a[f];let h=g;while(o.isTransparentExprWrapper(h)){h=h.expression}let b;let x;if(i&&n.types.isIdentifier(h,{name:"eval"})){x=b=h;a[f]=n.types.sequenceExpression([n.types.numericLiteral(0),b])}else if(t&&i&&isSimpleMemberExpression(h)){x=b=g}else{b=s.maybeGenerateMemoised(h);if(b){x=n.types.assignmentExpression("=",n.types.cloneNode(b),g);a[f]=b}else{x=b=g}}if(i&&n.types.isMemberExpression(h)){if(t&&isSimpleMemberExpression(h)){a.callee=g}else{const{object:e}=h;let t=s.maybeGenerateMemoised(e);if(t){h.object=n.types.assignmentExpression("=",t,e)}else if(n.types.isSuper(e)){t=n.types.thisExpression()}else{t=e}a.arguments.unshift(n.types.cloneNode(t));a.callee=n.types.memberExpression(a.callee,n.types.identifier("call"))}}let v=m.node;if(e===0&&p){var y;const e=o.skipTransparentExprWrappers(m.get("object")).node;let r;if(!t||!isSimpleMemberExpression(e)){r=s.maybeGenerateMemoised(e);if(r){v.object=n.types.assignmentExpression("=",r,e)}}v=n.types.callExpression(n.types.memberExpression(v,n.types.identifier("bind")),[n.types.cloneNode((y=r)!=null?y:e)])}if(c){const e=r?l`${n.types.cloneNode(x)} != null`:l` + `):a.importDeclaration([a.importSpecifier(i,s)],t),name:i.name}}))},injectDefaultImport(t,s=t){return e.storeNamed(r,t,"default",((e,t)=>{const o=r.scope.generateUidIdentifier(s);return{node:e?hoist(n.statement.ast`var ${o} = require(${t})`):a.importDeclaration([a.importDefaultSpecifier(o)],t),name:o.name}}))}}}}},8160:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=r(4182);var _default=e=>({ImportDeclaration(t){const r=(0,s.getImportSource)(t);if(!r)return;e({kind:"import",source:r},t)},Program(t){t.get("body").forEach((t=>{const r=(0,s.getRequireSource)(t);if(!r)return;e({kind:"import",source:r},t)}))}});t["default"]=_default},9313:(e,t,r)=>{"use strict";t.__esModule=true;t.entry=t.usage=void 0;var s=_interopRequireDefault(r(6527));t.usage=s.default;var a=_interopRequireDefault(r(8160));t.entry=a.default;function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}},6527:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=r(4182);var _default=e=>{function property(t,r,s,a){return e({kind:"property",object:t,key:r,placement:s},a)}return{ReferencedIdentifier(t){const{node:{name:r},scope:s}=t;if(s.getBindingIdentifier(r))return;e({kind:"global",name:r},t)},MemberExpression(e){const t=(0,s.resolveKey)(e.get("property"),e.node.computed);if(!t||t==="prototype")return;const r=e.get("object");const a=r.scope.getBinding(r.node.name);if(a&&a.path.isImportNamespaceSpecifier())return;const n=(0,s.resolveSource)(r);return property(n.id,t,n.placement,e)},ObjectPattern(e){const{parentPath:t,parent:r}=e;let a;if(t.isVariableDeclarator()){a=t.get("init")}else if(t.isAssignmentExpression()){a=t.get("right")}else if(t.isFunction()){const s=t.parentPath;if(s.isCallExpression()||s.isNewExpression()){if(s.node.callee===r){a=s.get("arguments")[e.key]}}}let n=null;let o=null;if(a)({id:n,placement:o}=(0,s.resolveSource)(a));for(const t of e.get("properties")){if(t.isObjectProperty()){const e=(0,s.resolveKey)(t.get("key"));if(e)property(n,e,o,t)}}},BinaryExpression(t){if(t.node.operator!=="in")return;const r=(0,s.resolveSource)(t.get("right"));const a=(0,s.resolveKey)(t.get("left"),true);if(!a)return;e({kind:"in",object:r.id,key:a,placement:r.placement},t)}}};t["default"]=_default},1403:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9820:(e,t,r)=>{var s=r(7462);s.core=r(9118);s.isCore=r(779);s.sync=r(5565);e.exports=s},7462:(e,t,r)=>{var s=r(7147);var a=r(1017);var n=r(7673);var o=r(7901);var i=r(7023);var l=r(8746);var c=s.realpath&&typeof s.realpath.native==="function"?s.realpath.native:s.realpath;var u=function isFile(e,t){s.stat(e,(function(e,r){if(!e){return t(null,r.isFile()||r.isFIFO())}if(e.code==="ENOENT"||e.code==="ENOTDIR")return t(null,false);return t(e)}))};var p=function isDirectory(e,t){s.stat(e,(function(e,r){if(!e){return t(null,r.isDirectory())}if(e.code==="ENOENT"||e.code==="ENOTDIR")return t(null,false);return t(e)}))};var f=function realpath(e,t){c(e,(function(r,s){if(r&&r.code!=="ENOENT")t(r);else t(null,r?e:s)}))};var d=function maybeRealpath(e,t,r,s){if(r&&r.preserveSymlinks===false){e(t,s)}else{s(null,t)}};var m=function defaultReadPackage(e,t,r){e(t,(function(e,t){if(e)r(e);else{try{var s=JSON.parse(t);r(null,s)}catch(e){r(null)}}}))};var y=function getPackageCandidates(e,t,r){var s=o(t,r,e);for(var n=0;n{e.exports=function(){var e=Error.prepareStackTrace;Error.prepareStackTrace=function(e,t){return t};var t=(new Error).stack;Error.prepareStackTrace=e;return t[2].getFileName()}},9118:(e,t,r)=>{var s=process.versions&&process.versions.node&&process.versions.node.split(".")||[];function specifierIncluded(e){var t=e.split(" ");var r=t.length>1?t[0]:"=";var a=(t.length>1?t[1]:t[0]).split(".");for(var n=0;n<3;++n){var o=parseInt(s[n]||0,10);var i=parseInt(a[n]||0,10);if(o===i){continue}if(r==="<"){return o="){return o>=i}else{return false}}return r===">="}function matchesRange(e){var t=e.split(/ ?&& ?/);if(t.length===0){return false}for(var r=0;r{var s=r(8746);e.exports=function isCore(e){return s(e)}},7901:(e,t,r)=>{var s=r(1017);var a=s.parse||r(2742);var n=function getNodeModulesDirs(e,t){var r="/";if(/^([A-Za-z]:)/.test(e)){r=""}else if(/^\\\\/.test(e)){r="\\\\"}var n=[e];var o=a(e);while(o.dir!==n[n.length-1]){n.push(o.dir);o=a(o.dir)}return n.reduce((function(e,a){return e.concat(t.map((function(e){return s.resolve(r,a,e)})))}),[])};e.exports=function nodeModulesPaths(e,t,r){var s=t&&t.moduleDirectory?[].concat(t.moduleDirectory):["node_modules"];if(t&&typeof t.paths==="function"){return t.paths(r,e,(function(){return n(e,s)}),t)}var a=n(e,s);return t&&t.paths?a.concat(t.paths):a}},7023:e=>{e.exports=function(e,t){return t||{}}},5565:(e,t,r)=>{var s=r(8746);var a=r(7147);var n=r(1017);var o=r(7673);var i=r(7901);var l=r(7023);var c=a.realpathSync&&typeof a.realpathSync.native==="function"?a.realpathSync.native:a.realpathSync;var u=function isFile(e){try{var t=a.statSync(e)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return false;throw e}return t.isFile()||t.isFIFO()};var p=function isDirectory(e){try{var t=a.statSync(e)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return false;throw e}return t.isDirectory()};var f=function realpathSync(e){try{return c(e)}catch(e){if(e.code!=="ENOENT"){throw e}}return e};var d=function maybeRealpathSync(e,t,r){if(r&&r.preserveSymlinks===false){return e(t)}return t};var m=function defaultReadPackageSync(e,t){var r=e(t);try{var s=JSON.parse(r);return s}catch(e){}};var y=function getPackageCandidates(e,t,r){var s=i(t,r,e);for(var a=0;a{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(8622);function getObjRef(e,t,r){let a;if(s.isIdentifier(e)){if(r.hasBinding(e.name)){return e}else{a=e}}else if(s.isMemberExpression(e)){a=e.object;if(s.isSuper(a)||s.isIdentifier(a)&&r.hasBinding(a.name)){return a}}else{throw new Error(`We can't explode this node type ${e["type"]}`)}const n=r.generateUidIdentifierBasedOnNode(a);r.push({id:n});t.push(s.assignmentExpression("=",s.cloneNode(n),s.cloneNode(a)));return n}function getPropRef(e,t,r){const a=e.property;if(s.isPrivateName(a)){throw new Error("We can't generate property ref for private name, please install `@babel/plugin-proposal-class-properties`")}const n=s.toComputedKey(e,a);if(s.isLiteral(n)&&s.isPureish(n))return n;const o=r.generateUidIdentifierBasedOnNode(a);r.push({id:o});t.push(s.assignmentExpression("=",s.cloneNode(o),s.cloneNode(a)));return o}function _default(e,t,r,a,n){let o;if(s.isIdentifier(e)&&n){o=e}else{o=getObjRef(e,t,a)}let i,l;if(s.isIdentifier(e)){i=s.cloneNode(e);l=o}else{const r=getPropRef(e,t,a);const n=e.computed||s.isLiteral(r);l=s.memberExpression(s.cloneNode(o),s.cloneNode(r),n);i=s.memberExpression(s.cloneNode(o),s.cloneNode(r),n)}return{uid:l,ref:i}}},550:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(3811);var a=r(153);var n=r(8622);const o=(0,a.default)(`\n (function (FUNCTION_KEY) {\n function FUNCTION_ID() {\n return FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n }\n\n return FUNCTION_ID;\n })(FUNCTION)\n`);const i=(0,a.default)(`\n (function (FUNCTION_KEY) {\n function* FUNCTION_ID() {\n return yield* FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n };\n\n return FUNCTION_ID;\n })(FUNCTION)\n`);const l={"ReferencedIdentifier|BindingIdentifier"(e,t){if(e.node.name!==t.name)return;const r=e.scope.getBindingIdentifier(t.name);if(r!==t.outerDeclar)return;t.selfReference=true;e.stop()}};function getNameFromLiteralId(e){if(n.isNullLiteral(e)){return"null"}if(n.isRegExpLiteral(e)){return`_${e.pattern}_${e.flags}`}if(n.isTemplateLiteral(e)){return e.quasis.map((e=>e.value.raw)).join("")}if(e.value!==undefined){return e.value+""}return""}function wrap(e,t,r,a){if(e.selfReference){if(a.hasBinding(r.name)&&!a.hasGlobal(r.name)){a.rename(r.name)}else{if(!n.isFunction(t))return;let e=o;if(t.generator){e=i}const l=e({FUNCTION:t,FUNCTION_ID:r,FUNCTION_KEY:a.generateUidIdentifier(r.name)}).expression;const c=l.callee.body.body[0].params;for(let e=0,r=(0,s.default)(t);e{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=hoistVariables;var s=r(8622);const a={Scope(e,t){if(t.kind==="let")e.skip()},FunctionParent(e){e.skip()},VariableDeclaration(e,t){if(t.kind&&e.node.kind!==t.kind)return;const r=[];const a=e.get("declarations");let n;for(const e of a){n=e.node.id;if(e.node.init){r.push(s.expressionStatement(s.assignmentExpression("=",e.node.id,e.node.init)))}for(const r of Object.keys(e.getBindingIdentifiers())){t.emit(s.identifier(r),r,e.node.init!==null)}}if(e.parentPath.isFor({left:e.node})){e.replaceWith(n)}else{e.replaceWithMultiple(r)}}};function hoistVariables(e,t,r="var"){e.traverse(a,{kind:r,emit:t})}},6591:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9491);var a=r(8622);class ImportBuilder{constructor(e,t,r){this._statements=[];this._resultName=null;this._scope=null;this._hub=null;this._importedSource=void 0;this._scope=t;this._hub=r;this._importedSource=e}done(){return{statements:this._statements,resultName:this._resultName}}import(){this._statements.push(a.importDeclaration([],a.stringLiteral(this._importedSource)));return this}require(){this._statements.push(a.expressionStatement(a.callExpression(a.identifier("require"),[a.stringLiteral(this._importedSource)])));return this}namespace(e="namespace"){const t=this._scope.generateUidIdentifier(e);const r=this._statements[this._statements.length-1];s(r.type==="ImportDeclaration");s(r.specifiers.length===0);r.specifiers=[a.importNamespaceSpecifier(t)];this._resultName=a.cloneNode(t);return this}default(e){e=this._scope.generateUidIdentifier(e);const t=this._statements[this._statements.length-1];s(t.type==="ImportDeclaration");s(t.specifiers.length===0);t.specifiers=[a.importDefaultSpecifier(e)];this._resultName=a.cloneNode(e);return this}named(e,t){if(t==="default")return this.default(e);e=this._scope.generateUidIdentifier(e);const r=this._statements[this._statements.length-1];s(r.type==="ImportDeclaration");s(r.specifiers.length===0);r.specifiers=[a.importSpecifier(e,a.identifier(t))];this._resultName=a.cloneNode(e);return this}var(e){e=this._scope.generateUidIdentifier(e);let t=this._statements[this._statements.length-1];if(t.type!=="ExpressionStatement"){s(this._resultName);t=a.expressionStatement(this._resultName);this._statements.push(t)}this._statements[this._statements.length-1]=a.variableDeclaration("var",[a.variableDeclarator(e,t.expression)]);this._resultName=a.cloneNode(e);return this}defaultInterop(){return this._interop(this._hub.addHelper("interopRequireDefault"))}wildcardInterop(){return this._interop(this._hub.addHelper("interopRequireWildcard"))}_interop(e){const t=this._statements[this._statements.length-1];if(t.type==="ExpressionStatement"){t.expression=a.callExpression(e,[t.expression])}else if(t.type==="VariableDeclaration"){s(t.declarations.length===1);t.declarations[0].init=a.callExpression(e,[t.declarations[0].init])}else{s.fail("Unexpected type.")}return this}prop(e){const t=this._statements[this._statements.length-1];if(t.type==="ExpressionStatement"){t.expression=a.memberExpression(t.expression,a.identifier(e))}else if(t.type==="VariableDeclaration"){s(t.declarations.length===1);t.declarations[0].init=a.memberExpression(t.declarations[0].init,a.identifier(e))}else{s.fail("Unexpected type:"+t.type)}return this}read(e){this._resultName=a.memberExpression(this._resultName,a.identifier(e))}}t["default"]=ImportBuilder},4872:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9491);var a=r(8622);var n=r(6591);var o=r(1719);class ImportInjector{constructor(e,t,r){this._defaultOpts={importedSource:null,importedType:"commonjs",importedInterop:"babel",importingInterop:"babel",ensureLiveReference:false,ensureNoContext:false,importPosition:"before"};const s=e.find((e=>e.isProgram()));this._programPath=s;this._programScope=s.scope;this._hub=s.hub;this._defaultOpts=this._applyDefaults(t,r,true)}addDefault(e,t){return this.addNamed("default",e,t)}addNamed(e,t,r){s(typeof e==="string");return this._generateImport(this._applyDefaults(t,r),e)}addNamespace(e,t){return this._generateImport(this._applyDefaults(e,t),null)}addSideEffect(e,t){return this._generateImport(this._applyDefaults(e,t),false)}_applyDefaults(e,t,r=false){const a=[];if(typeof e==="string"){a.push({importedSource:e});a.push(t)}else{s(!t,"Unexpected secondary arguments.");a.push(e)}const n=Object.assign({},this._defaultOpts);for(const e of a){if(!e)continue;Object.keys(n).forEach((t=>{if(e[t]!==undefined)n[t]=e[t]}));if(!r){if(e.nameHint!==undefined)n.nameHint=e.nameHint;if(e.blockHoist!==undefined)n.blockHoist=e.blockHoist}}return n}_generateImport(e,t){const r=t==="default";const s=!!t&&!r;const i=t===null;const{importedSource:l,importedType:c,importedInterop:u,importingInterop:p,ensureLiveReference:f,ensureNoContext:d,nameHint:m,importPosition:y,blockHoist:g}=e;let h=m||t;const b=(0,o.default)(this._programPath);const x=b&&p==="node";const v=b&&p==="babel";if(y==="after"&&!b){throw new Error(`"importPosition": "after" is only supported in modules`)}const E=new n.default(l,this._programScope,this._hub);if(c==="es6"){if(!x&&!v){throw new Error("Cannot import an ES6 module from CommonJS")}E.import();if(i){E.namespace(m||l)}else if(r||s){E.named(h,t)}}else if(c!=="commonjs"){throw new Error(`Unexpected interopType "${c}"`)}else if(u==="babel"){if(x){h=h!=="default"?h:l;const e=`${l}$es6Default`;E.import();if(i){E.default(e).var(h||l).wildcardInterop()}else if(r){if(f){E.default(e).var(h||l).defaultInterop().read("default")}else{E.default(e).var(h).defaultInterop().prop(t)}}else if(s){E.default(e).read(t)}}else if(v){E.import();if(i){E.namespace(h||l)}else if(r||s){E.named(h,t)}}else{E.require();if(i){E.var(h||l).wildcardInterop()}else if((r||s)&&f){if(r){h=h!=="default"?h:l;E.var(h).read(t);E.defaultInterop()}else{E.var(l).read(t)}}else if(r){E.var(h).defaultInterop().prop(t)}else if(s){E.var(h).prop(t)}}}else if(u==="compiled"){if(x){E.import();if(i){E.default(h||l)}else if(r||s){E.default(l).read(h)}}else if(v){E.import();if(i){E.namespace(h||l)}else if(r||s){E.named(h,t)}}else{E.require();if(i){E.var(h||l)}else if(r||s){if(f){E.var(l).read(h)}else{E.prop(t).var(h)}}}}else if(u==="uncompiled"){if(r&&f){throw new Error("No live reference for commonjs default")}if(x){E.import();if(i){E.default(h||l)}else if(r){E.default(h)}else if(s){E.default(l).read(h)}}else if(v){E.import();if(i){E.default(h||l)}else if(r){E.default(h)}else if(s){E.named(h,t)}}else{E.require();if(i){E.var(h||l)}else if(r){E.var(h)}else if(s){if(f){E.var(l).read(h)}else{E.var(h).prop(t)}}}}else{throw new Error(`Unknown importedInterop "${u}".`)}const{statements:j,resultName:w}=E.done();this._insertStatements(j,y,g);if((r||s)&&d&&w.type!=="Identifier"){return a.sequenceExpression([a.numericLiteral(0),w])}return w}_insertStatements(e,t="before",r=3){const s=this._programPath.get("body");if(t==="after"){for(let t=s.length-1;t>=0;t--){if(s[t].isImportDeclaration()){s[t].insertAfter(e);return}}}else{e.forEach((e=>{e._blockHoist=r}));const t=s.find((e=>{const t=e.node._blockHoist;return Number.isFinite(t)&&t<4}));if(t){t.insertBefore(e);return}}this._programPath.unshiftContainer("body",e)}}t["default"]=ImportInjector},9115:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.addDefault=addDefault;t.addNamed=addNamed;t.addNamespace=addNamespace;t.addSideEffect=addSideEffect;Object.defineProperty(t,"ImportInjector",{enumerable:true,get:function(){return s.default}});Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return a.default}});var s=r(4872);var a=r(1719);function addDefault(e,t,r){return new s.default(e).addDefault(t,r)}function addNamed(e,t,r,a){return new s.default(e).addNamed(t,r,a)}function addNamespace(e,t,r){return new s.default(e).addNamespace(t,r)}function addSideEffect(e,t,r){return new s.default(e).addSideEffect(t,r)}},1719:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=isModule;function isModule(e){const{sourceType:t}=e.node;if(t!=="module"&&t!=="script"){throw e.buildCodeFrameError(`Unknown sourceType "${t}", cannot transform.`)}return e.node.sourceType==="module"}},6721:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=optimiseCallExpression;var s=r(8622);function optimiseCallExpression(e,t,r,a){if(r.length===1&&s.isSpreadElement(r[0])&&s.isIdentifier(r[0].argument,{name:"arguments"})){if(a){return s.optionalCallExpression(s.optionalMemberExpression(e,s.identifier("apply"),false,true),[t,r[0].argument],false)}return s.callExpression(s.memberExpression(e,s.identifier("apply")),[t,r[0].argument])}else{if(a){return s.optionalCallExpression(s.optionalMemberExpression(e,s.identifier("call"),false,true),[t,...r],false)}return s.callExpression(s.memberExpression(e,s.identifier("call")),[t,...r])}}},9055:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,r,s)=>{if(!t.assertVersion){t=Object.assign(copyApiObject(t),{assertVersion(e){throwVersionError(e,t.version)}})}return e(t,r||{},s)}}function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7120:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(6946);var a=r(2155);var n=r(8622);const o={Function(e){e.skip()},AwaitExpression(e,{wrapAwait:t}){const r=e.get("argument");if(e.parentPath.isYieldExpression()){e.replaceWith(r.node);return}e.replaceWith(n.yieldExpression(t?n.callExpression(n.cloneNode(t),[r.node]):r.node))}};function _default(e,t,r){e.traverse(o,{wrapAwait:t.wrapAwait});const i=checkIsIIFE(e);e.node.async=false;e.node.generator=true;(0,s.default)(e,n.cloneNode(t.wrapAsync),r);const l=e.isObjectMethod()||e.isClassMethod()||e.parentPath.isObjectProperty()||e.parentPath.isClassProperty();if(!l&&!i&&e.isExpression()){(0,a.default)(e)}function checkIsIIFE(e){if(e.parentPath.isCallExpression({callee:e.node})){return true}const{parentPath:t}=e;if(t.isMemberExpression()&&n.isIdentifier(t.node.property,{name:"bind"})){const{parentPath:e}=t;return e.isCallExpression()&&e.node.arguments.length===1&&n.isThisExpression(e.node.arguments[0])&&e.parentPath.isCallExpression({callee:e.node})}return false}}},6833:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.skipAllButComputedKey=skipAllButComputedKey;t["default"]=t.environmentVisitor=void 0;var s=r(7369);var a=r(7281);var n=r(6721);var o=r(8622);function getPrototypeOfExpression(e,t,r,s){e=o.cloneNode(e);const a=t||s?e:o.memberExpression(e,o.identifier("prototype"));return o.callExpression(r.addHelper("getPrototypeOf"),[a])}function skipAllButComputedKey(e){if(!e.node.computed){e.skip();return}const t=o.VISITOR_KEYS[e.type];for(const r of t){if(r!=="key")e.skipKey(r)}}const i={[`${o.staticBlock?"StaticBlock|":""}ClassPrivateProperty|TypeAnnotation`](e){e.skip()},Function(e){if(e.isMethod())return;if(e.isArrowFunctionExpression())return;e.skip()},"Method|ClassProperty"(e){skipAllButComputedKey(e)}};t.environmentVisitor=i;const l=s.default.visitors.merge([i,{Super(e,t){const{node:r,parentPath:s}=e;if(!s.isMemberExpression({object:r}))return;t.handle(s)}}]);const c=s.default.visitors.merge([i,{Scopable(e,{refName:t}){const r=e.scope.getOwnBinding(t);if(r&&r.identifier.name===t){e.scope.rename(t)}}}]);const u={memoise(e,t){const{scope:r,node:s}=e;const{computed:a,property:n}=s;if(!a){return}const o=r.maybeGenerateMemoised(n);if(!o){return}this.memoiser.set(n,o,t)},prop(e){const{computed:t,property:r}=e.node;if(this.memoiser.has(r)){return o.cloneNode(this.memoiser.get(r))}if(t){return o.cloneNode(r)}return o.stringLiteral(r.name)},get(e){return this._get(e,this._getThisRefs())},_get(e,t){const r=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("get"),[t.memo?o.sequenceExpression([t.memo,r]):r,this.prop(e),t.this])},_getThisRefs(){if(!this.isDerivedConstructor){return{this:o.thisExpression()}}const e=this.scope.generateDeclaredUidIdentifier("thisSuper");return{memo:o.assignmentExpression("=",e,o.thisExpression()),this:o.cloneNode(e)}},set(e,t){const r=this._getThisRefs();const s=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("set"),[r.memo?o.sequenceExpression([r.memo,s]):s,this.prop(e),t,r.this,o.booleanLiteral(e.isInStrictMode())])},destructureSet(e){throw e.buildCodeFrameError(`Destructuring to a super field is not supported yet.`)},call(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,false)},optionalCall(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,true)}};const p=Object.assign({},u,{prop(e){const{property:t}=e.node;if(this.memoiser.has(t)){return o.cloneNode(this.memoiser.get(t))}return o.cloneNode(t)},get(e){const{isStatic:t,getSuperRef:r}=this;const{computed:s}=e.node;const a=this.prop(e);let n;if(t){var i;n=(i=r())!=null?i:o.memberExpression(o.identifier("Function"),o.identifier("prototype"))}else{var l;n=o.memberExpression((l=r())!=null?l:o.identifier("Object"),o.identifier("prototype"))}return o.memberExpression(n,a,s)},set(e,t){const{computed:r}=e.node;const s=this.prop(e);return o.assignmentExpression("=",o.memberExpression(o.thisExpression(),s,r),t)},destructureSet(e){const{computed:t}=e.node;const r=this.prop(e);return o.memberExpression(o.thisExpression(),r,t)},call(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,false)},optionalCall(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,true)}});class ReplaceSupers{constructor(e){var t;const r=e.methodPath;this.methodPath=r;this.isDerivedConstructor=r.isClassMethod({kind:"constructor"})&&!!e.superRef;this.isStatic=r.isObjectMethod()||r.node.static||(r.isStaticBlock==null?void 0:r.isStaticBlock());this.isPrivateMethod=r.isPrivate()&&r.isMethod();this.file=e.file;this.constantSuper=(t=e.constantSuper)!=null?t:e.isLoose;this.opts=e}getObjectRef(){return o.cloneNode(this.opts.objectRef||this.opts.getObjectRef())}getSuperRef(){if(this.opts.superRef)return o.cloneNode(this.opts.superRef);if(this.opts.getSuperRef)return o.cloneNode(this.opts.getSuperRef())}replace(){if(this.opts.refToPreserve){this.methodPath.traverse(c,{refName:this.opts.refToPreserve.name})}const e=this.constantSuper?p:u;(0,a.default)(this.methodPath,l,Object.assign({file:this.file,scope:this.methodPath.scope,isDerivedConstructor:this.isDerivedConstructor,isStatic:this.isStatic,isPrivateMethod:this.isPrivateMethod,getObjectRef:this.getObjectRef.bind(this),getSuperRef:this.getSuperRef.bind(this)},e))}}t["default"]=ReplaceSupers},7281:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(8622);function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach((function(r){if(r!=="default"){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:true,get:function(){return e[r]}})}}))}t["default"]=e;return Object.freeze(t)}var a=_interopNamespace(s);function willPathCastToBoolean(e){const t=e;const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}class AssignmentMemoiser{constructor(){this._map=void 0;this._map=new WeakMap}has(e){return this._map.has(e)}get(e){if(!this.has(e))return;const t=this._map.get(e);const{value:r}=t;t.count--;if(t.count===0){return a.assignmentExpression("=",r,e)}return r}set(e,t,r){return this._map.set(e,{count:r,value:t})}}function toNonOptional(e,t){const{node:r}=e;if(e.isOptionalMemberExpression()){return a.memberExpression(t,r.property,r.computed)}if(e.isOptionalCallExpression()){const s=e.get("callee");if(e.node.optional&&s.isOptionalMemberExpression()){const{object:n}=s.node;const o=e.scope.maybeGenerateMemoised(n)||n;s.get("object").replaceWith(a.assignmentExpression("=",o,n));return a.callExpression(a.memberExpression(t,a.identifier("call")),[o,...r.arguments])}return a.callExpression(t,r.arguments)}return e.node}function isInDetachedTree(e){while(e){if(e.isProgram())break;const{parentPath:t,container:r,listKey:s}=e;const a=t.node;if(s){if(r!==a[s])return true}else{if(r!==a)return true}e=t}return false}const n={memoise(){},handle(e,t){const{node:r,parent:s,parentPath:n,scope:o}=e;if(e.isOptionalMemberExpression()){if(isInDetachedTree(e))return;const i=e.find((({node:t,parent:r,parentPath:s})=>{if(s.isOptionalMemberExpression()){return r.optional||r.object!==t}if(s.isOptionalCallExpression()){return t!==e.node&&r.optional||r.callee!==t}return true}));if(o.path.isPattern()){i.replaceWith(a.callExpression(a.arrowFunctionExpression([],i.node),[]));return}const l=willPathCastToBoolean(i);const c=i.parentPath;if(c.isUpdateExpression({argument:r})||c.isAssignmentExpression({left:r})){throw e.buildCodeFrameError(`can't handle assignment`)}const u=c.isUnaryExpression({operator:"delete"});if(u&&i.isOptionalMemberExpression()&&i.get("property").isPrivateName()){throw e.buildCodeFrameError(`can't delete a private class element`)}let p=e;for(;;){if(p.isOptionalMemberExpression()){if(p.node.optional)break;p=p.get("object");continue}else if(p.isOptionalCallExpression()){if(p.node.optional)break;p=p.get("callee");continue}throw new Error(`Internal error: unexpected ${p.node.type}`)}const f=p.isOptionalMemberExpression()?"object":"callee";const d=p.node[f];const m=o.maybeGenerateMemoised(d);const y=m!=null?m:d;const g=n.isOptionalCallExpression({callee:r});const h=n.isCallExpression({callee:r});p.replaceWith(toNonOptional(p,y));if(g){if(s.optional){n.replaceWith(this.optionalCall(e,s.arguments))}else{n.replaceWith(this.call(e,s.arguments))}}else if(h){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}let b=e.node;for(let t=e;t!==i;){const{parentPath:e}=t;if(e===i&&g&&s.optional){b=e.node;break}b=toNonOptional(e,b);t=e}let x;const v=i.parentPath;if(a.isMemberExpression(b)&&v.isOptionalCallExpression({callee:i.node,optional:true})){const{object:t}=b;x=e.scope.maybeGenerateMemoised(t);if(x){b.object=a.assignmentExpression("=",x,t)}}let E=i;if(u){E=v;b=v.node}const j=m?a.assignmentExpression("=",a.cloneNode(y),a.cloneNode(d)):a.cloneNode(y);if(l){let e;if(t){e=a.binaryExpression("!=",j,a.nullLiteral())}else{e=a.logicalExpression("&&",a.binaryExpression("!==",j,a.nullLiteral()),a.binaryExpression("!==",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.logicalExpression("&&",e,b))}else{let e;if(t){e=a.binaryExpression("==",j,a.nullLiteral())}else{e=a.logicalExpression("||",a.binaryExpression("===",j,a.nullLiteral()),a.binaryExpression("===",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.conditionalExpression(e,u?a.booleanLiteral(true):o.buildUndefinedNode(),b))}if(x){const e=v.node;v.replaceWith(a.optionalCallExpression(a.optionalMemberExpression(e.callee,a.identifier("call"),false,true),[a.cloneNode(x),...e.arguments],false))}return}if(n.isUpdateExpression({argument:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,prefix:o}=s;this.memoise(e,2);const i=a.binaryExpression(t[0],a.unaryExpression("+",this.get(e)),a.numericLiteral(1));if(o){n.replaceWith(this.set(e,i))}else{const{scope:t}=e;const s=t.generateUidIdentifierBasedOnNode(r);t.push({id:s});i.left=a.assignmentExpression("=",a.cloneNode(s),i.left);n.replaceWith(a.sequenceExpression([this.set(e,i),a.cloneNode(s)]))}return}if(n.isAssignmentExpression({left:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,right:r}=s;if(t==="="){n.replaceWith(this.set(e,r))}else{const s=t.slice(0,-1);if(a.LOGICAL_OPERATORS.includes(s)){this.memoise(e,1);n.replaceWith(a.logicalExpression(s,this.get(e),this.set(e,r)))}else{this.memoise(e,2);n.replaceWith(this.set(e,a.binaryExpression(s,this.get(e),r)))}}return}if(n.isCallExpression({callee:r})){n.replaceWith(this.call(e,s.arguments));return}if(n.isOptionalCallExpression({callee:r})){if(o.path.isPattern()){n.replaceWith(a.callExpression(a.arrowFunctionExpression([],n.node),[]));return}n.replaceWith(this.optionalCall(e,s.arguments));return}if(n.isForXStatement({left:r})||n.isObjectProperty({value:r})&&n.parentPath.isObjectPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isObjectProperty({value:s})&&n.parentPath.parentPath.isObjectPattern()||n.isArrayPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isArrayPattern()||n.isRestElement()){e.replaceWith(this.destructureSet(e));return}e.replaceWith(this.get(e))}};function memberExpressionToFunctions(e,t,r){e.traverse(t,Object.assign({},n,r,{memoiser:new AssignmentMemoiser}))}t["default"]=memberExpressionToFunctions},5480:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isTransparentExprWrapper=isTransparentExprWrapper;t.skipTransparentExprWrappers=skipTransparentExprWrappers;var s=r(8622);function isTransparentExprWrapper(e){return s.isTSAsExpression(e)||s.isTSTypeAssertion(e)||s.isTSNonNullExpression(e)||s.isTypeCastExpression(e)||s.isParenthesizedExpression(e)}function skipTransparentExprWrappers(e){while(isTransparentExprWrapper(e.node)){e=e.get("expression")}return e}},7058:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=splitExportDeclaration;var s=r(8622);function splitExportDeclaration(e){if(!e.isExportDeclaration()){throw new Error("Only export declarations can be split.")}const t=e.isExportDefaultDeclaration();const r=e.get("declaration");const a=r.isClassDeclaration();if(t){const t=r.isFunctionDeclaration()||a;const n=r.isScope()?r.scope.parent:r.scope;let o=r.node.id;let i=false;if(!o){i=true;o=n.generateUidIdentifier("default");if(t||r.isFunctionExpression()||r.isClassExpression()){r.node.id=s.cloneNode(o)}}const l=t?r:s.variableDeclaration("var",[s.variableDeclarator(s.cloneNode(o),r.node)]);const c=s.exportNamedDeclaration(null,[s.exportSpecifier(s.cloneNode(o),s.identifier("default"))]);e.insertAfter(c);e.replaceWith(l);if(i){n.registerDeclaration(e)}return e}if(e.get("specifiers").length>0){throw new Error("It doesn't make sense to split exported specifiers.")}const n=r.getOuterBindingIdentifiers();const o=Object.keys(n).map((e=>s.exportSpecifier(s.identifier(e),s.identifier(e))));const i=s.exportNamedDeclaration(null,o);e.insertAfter(i);e.replaceWith(r.node);return e}},8785:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.findSuggestion=findSuggestion;const{min:r}=Math;function levenshtein(e,t){let s=[],a=[],n,o;const i=e.length,l=t.length;if(!i){return l}if(!l){return i}for(o=0;o<=l;o++){s[o]=o}for(n=1;n<=i;n++){for(a=[n],o=1;o<=l;o++){a[o]=e[n-1]===t[o-1]?s[o-1]:r(s[o-1],s[o],a[o-1])+1}s=a}return a[l]}function findSuggestion(e,t){const s=t.map((t=>levenshtein(t,e)));return t[s.indexOf(r(...s))]}},7347:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"OptionValidator",{enumerable:true,get:function(){return s.OptionValidator}});Object.defineProperty(t,"findSuggestion",{enumerable:true,get:function(){return a.findSuggestion}});var s=r(6885);var a=r(8785)},6885:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.OptionValidator=void 0;var s=r(8785);class OptionValidator{constructor(e){this.descriptor=e}validateTopLevelOptions(e,t){const r=Object.keys(t);for(const t of Object.keys(e)){if(!r.includes(t)){throw new Error(this.formatMessage(`'${t}' is not a valid top-level option.\n- Did you mean '${(0,s.findSuggestion)(t,r)}'?`))}}}validateBooleanOption(e,t,r){if(t===undefined){return r}else{this.invariant(typeof t==="boolean",`'${e}' option must be a boolean.`)}return t}validateStringOption(e,t,r){if(t===undefined){return r}else{this.invariant(typeof t==="string",`'${e}' option must be a string.`)}return t}invariant(e,t){if(!e){throw new Error(this.formatMessage(t))}}formatMessage(e){return`${this.descriptor}: ${e}`}}t.OptionValidator=OptionValidator},6946:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=wrapFunction;var s=r(550);var a=r(153);var n=r(8622);const o=a.default.expression(`\n (function () {\n var REF = FUNCTION;\n return function NAME(PARAMS) {\n return REF.apply(this, arguments);\n };\n })()\n`);const i=a.default.expression(`\n (function () {\n var REF = FUNCTION;\n function NAME(PARAMS) {\n return REF.apply(this, arguments);\n }\n return NAME;\n })()\n`);const l=(0,a.default)(`\n function NAME(PARAMS) { return REF.apply(this, arguments); }\n function REF() {\n REF = FUNCTION;\n return REF.apply(this, arguments);\n }\n`);function classOrObjectMethod(e,t){const r=e.node;const s=r.body;const a=n.functionExpression(null,[],n.blockStatement(s.body),true);s.body=[n.returnStatement(n.callExpression(n.callExpression(t,[a]),[]))];r.async=false;r.generator=false;e.get("body.body.0.argument.callee.arguments.0").unwrapFunctionEnvironment()}function plainFunction(e,t,r){const a=e.node;const c=e.isFunctionDeclaration();const u=a.id;const p=c?l:u?i:o;if(e.isArrowFunctionExpression()){e.arrowFunctionToExpression({noNewArrows:r})}a.id=null;if(c){a.type="FunctionExpression"}const f=n.callExpression(t,[a]);const d=p({NAME:u||null,REF:e.scope.generateUidIdentifier(u?u.name:"ref"),FUNCTION:f,PARAMS:a.params.reduce(((t,r)=>{t.done=t.done||n.isAssignmentPattern(r)||n.isRestElement(r);if(!t.done){t.params.push(e.scope.generateUidIdentifier("x"))}return t}),{params:[],done:false}).params});if(c){e.replaceWith(d[0]);e.insertAfter(d[1])}else{const t=d.callee.body.body[1].argument;if(!u){(0,s.default)({node:t,parent:e.parent,scope:e.scope})}if(!t||t.id||a.params.length){e.replaceWith(d)}else{e.replaceWith(f)}}}function wrapFunction(e,t,r=true){if(e.isMethod()){classOrObjectMethod(e,t)}else{plainFunction(e,t,r)}}},8027:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(249);var a=r(6758);var n=(0,s.declare)(((e,t)=>{e.assertVersion(7);return(0,a.createClassFeaturePlugin)({name:"proposal-class-properties",api:e,feature:a.FEATURES.fields,loose:t.loose,manipulateOptions(e,t){t.plugins.push("classProperties","classPrivateProperties")}})}));t["default"]=n},249:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},4920:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3497);var a=r(2074);const n=["commonjs","amd","systemjs"];const o=`@babel/plugin-proposal-dynamic-import depends on a modules\ntransform plugin. Supported plugins are:\n - @babel/plugin-transform-modules-commonjs ^7.4.0\n - @babel/plugin-transform-modules-amd ^7.4.0\n - @babel/plugin-transform-modules-systemjs ^7.4.0\n\nIf you are using Webpack or Rollup and thus don't want\nBabel to transpile your imports and exports, you can use\nthe @babel/plugin-syntax-dynamic-import plugin and let your\nbundler handle dynamic imports.\n`;var i=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-dynamic-import",inherits:a.default,pre(){this.file.set("@babel/plugin-proposal-dynamic-import","7.14.5")},visitor:{Program(){const e=this.file.get("@babel/plugin-transform-modules-*");if(!n.includes(e)){throw new Error(o)}}}}}));t["default"]=i},3497:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9579:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(791);var a=r(1454);var n=r(8304);var o=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-export-namespace-from",inherits:a.default,visitor:{ExportNamedDeclaration(e){var t;const{node:r,scope:s}=e;const{specifiers:a}=r;const o=n.types.isExportDefaultSpecifier(a[0])?1:0;if(!n.types.isExportNamespaceSpecifier(a[o]))return;const i=[];if(o===1){i.push(n.types.exportNamedDeclaration(null,[a.shift()],r.source))}const l=a.shift();const{exported:c}=l;const u=s.generateUidIdentifier((t=c.name)!=null?t:c.value);i.push(n.types.importDeclaration([n.types.importNamespaceSpecifier(u)],n.types.cloneNode(r.source)),n.types.exportNamedDeclaration(null,[n.types.exportSpecifier(n.types.cloneNode(u),c)]));if(r.specifiers.length>=1){i.push(r)}const[p]=e.replaceWithMultiple(i);e.scope.registerDeclaration(p)}}}}));t["default"]=o},791:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7703:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(169);var a=r(3030);var n=(0,s.declare)((e=>{e.assertVersion(7);const t=/(\\*)([\u2028\u2029])/g;function replace(e,t,r){const s=t.length%2===1;if(s)return e;return`${t}\\u${r.charCodeAt(0).toString(16)}`}return{name:"proposal-json-strings",inherits:a.default,visitor:{"DirectiveLiteral|StringLiteral"({node:e}){const{extra:r}=e;if(!(r!=null&&r.raw))return;r.raw=r.raw.replace(t,replace)}}}}));t["default"]=n},169:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1195:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(7010);var a=r(5945);var n=r(8304);var o=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-logical-assignment-operators",inherits:a.default,visitor:{AssignmentExpression(e){const{node:t,scope:r}=e;const{operator:s,left:a,right:o}=t;const i=s.slice(0,-1);if(!n.types.LOGICAL_OPERATORS.includes(i)){return}const l=n.types.cloneNode(a);if(n.types.isMemberExpression(a)){const{object:e,property:t,computed:s}=a;const o=r.maybeGenerateMemoised(e);if(o){a.object=o;l.object=n.types.assignmentExpression("=",n.types.cloneNode(o),e)}if(s){const e=r.maybeGenerateMemoised(t);if(e){a.property=e;l.property=n.types.assignmentExpression("=",n.types.cloneNode(e),t)}}}e.replaceWith(n.types.logicalExpression(i,l,n.types.assignmentExpression("=",a,o)))}}}}));t["default"]=o},7010:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5353:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6080);var a=r(5879);var n=r(8304);var o=(0,s.declare)(((e,{loose:t=false})=>{var r;e.assertVersion(7);const s=(r=e.assumption("noDocumentAll"))!=null?r:t;return{name:"proposal-nullish-coalescing-operator",inherits:a.default,visitor:{LogicalExpression(e){const{node:t,scope:r}=e;if(t.operator!=="??"){return}let a;let o;if(r.isStatic(t.left)){a=t.left;o=n.types.cloneNode(t.left)}else if(r.path.isPattern()){e.replaceWith(n.template.ast`(() => ${e.node})()`);return}else{a=r.generateUidIdentifierBasedOnNode(t.left);r.push({id:n.types.cloneNode(a)});o=n.types.assignmentExpression("=",a,t.left)}e.replaceWith(n.types.conditionalExpression(s?n.types.binaryExpression("!=",o,n.types.nullLiteral()):n.types.logicalExpression("&&",n.types.binaryExpression("!==",o,n.types.nullLiteral()),n.types.binaryExpression("!==",n.types.cloneNode(a),r.buildUndefinedNode())),n.types.cloneNode(a),t.right))}}}}));t["default"]=o},6080:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7300:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(5071);var a=r(1816);function remover({node:e}){var t;const{extra:r}=e;if(r!=null&&(t=r.raw)!=null&&t.includes("_")){r.raw=r.raw.replace(/_/g,"")}}var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-numeric-separator",inherits:a.default,visitor:{NumericLiteral:remover,BigIntLiteral:remover}}}));t["default"]=n},5071:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},6309:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8711);var a=r(4499);var n=r(8304);var o=r(3714);var i=r(797);var l=r(5732);const c=(()=>{const e=n.types.identifier("a");const t=n.types.objectProperty(n.types.identifier("key"),e);const r=n.types.objectPattern([t]);return n.types.isReferenced(e,t,r)?1:0})();var u=(0,s.declare)(((e,t)=>{var r,s,u,p;e.assertVersion(7);const f=e.targets();const d=!(0,i.isRequired)("es6.object.assign",f,{compatData:l});const{useBuiltIns:m=d,loose:y=false}=t;if(typeof y!=="boolean"){throw new Error(".loose must be a boolean, or undefined")}const g=(r=e.assumption("ignoreFunctionLength"))!=null?r:y;const h=(s=e.assumption("objectRestNoSymbols"))!=null?s:y;const b=(u=e.assumption("pureGetters"))!=null?u:y;const x=(p=e.assumption("setSpreadProperties"))!=null?p:y;function getExtendsHelper(e){return m?n.types.memberExpression(n.types.identifier("Object"),n.types.identifier("assign")):e.addHelper("extends")}function hasRestElement(e){let t=false;visitRestElements(e,(e=>{t=true;e.stop()}));return t}function hasObjectPatternRestElement(e){let t=false;visitRestElements(e,(e=>{if(e.parentPath.isObjectPattern()){t=true;e.stop()}}));return t}function visitRestElements(e,t){e.traverse({Expression(e){const t=e.parent.type;if(t==="AssignmentPattern"&&e.key==="right"||t==="ObjectProperty"&&e.parent.computed&&e.key==="key"){e.skip()}},RestElement:t})}function hasSpread(e){for(const t of e.properties){if(n.types.isSpreadElement(t)){return true}}return false}function extractNormalizedKeys(e){const t=e.node.properties;const r=[];let s=true;let a=false;for(const e of t){if(n.types.isIdentifier(e.key)&&!e.computed){r.push(n.types.stringLiteral(e.key.name))}else if(n.types.isTemplateLiteral(e.key)){r.push(n.types.cloneNode(e.key));a=true}else if(n.types.isLiteral(e.key)){r.push(n.types.stringLiteral(String(e.key.value)))}else{r.push(n.types.cloneNode(e.key));s=false}}return{keys:r,allLiteral:s,hasTemplateLiteral:a}}function replaceImpureComputedKeys(e,t){const r=[];for(const s of e){const e=s.get("key");if(s.node.computed&&!e.isPure()){const s=t.generateUidBasedOnNode(e.node);const a=n.types.variableDeclarator(n.types.identifier(s),e.node);r.push(a);e.replaceWith(n.types.identifier(s))}}return r}function removeUnusedExcludedKeys(e){const t=e.getOuterBindingIdentifierPaths();Object.keys(t).forEach((r=>{const s=t[r].parentPath;if(e.scope.getBinding(r).references>c||!s.isObjectProperty()){return}s.remove()}))}function createObjectRest(e,t,r){const s=e.get("properties");const a=s[s.length-1];n.types.assertRestElement(a.node);const o=n.types.cloneNode(a.node);a.remove();const i=replaceImpureComputedKeys(e.get("properties"),e.scope);const{keys:l,allLiteral:c,hasTemplateLiteral:u}=extractNormalizedKeys(e);if(l.length===0){return[i,o.argument,n.types.callExpression(getExtendsHelper(t),[n.types.objectExpression([]),n.types.cloneNode(r)])]}let p;if(!c){p=n.types.callExpression(n.types.memberExpression(n.types.arrayExpression(l),n.types.identifier("map")),[t.addHelper("toPropertyKey")])}else{p=n.types.arrayExpression(l);if(!u&&!n.types.isProgram(e.scope.block)){const t=e.findParent((e=>e.isProgram()));const r=e.scope.generateUidIdentifier("excluded");t.scope.push({id:r,init:p,kind:"const"});p=n.types.cloneNode(r)}}return[i,o.argument,n.types.callExpression(t.addHelper(`objectWithoutProperties${h?"Loose":""}`),[n.types.cloneNode(r),p])]}function replaceRestElement(e,t,r){if(t.isAssignmentPattern()){replaceRestElement(e,t.get("left"),r);return}if(t.isArrayPattern()&&hasRestElement(t)){const s=t.get("elements");for(let t=0;te.skip(),"ReferencedIdentifier|BindingIdentifier":IdentifierHandler},e.scope)}}}if(!a){for(let e=0;ee>=n-1||r.has(e);(0,o.convertFunctionParams)(e,g,shouldTransformParam,replaceRestElement)}},VariableDeclarator(e,t){if(!e.get("id").isObjectPattern()){return}let r=e;const s=e;visitRestElements(e.get("id"),(e=>{if(!e.parentPath.isObjectPattern()){return}if(s.node.id.properties.length>1&&!n.types.isIdentifier(s.node.init)){const t=e.scope.generateUidIdentifierBasedOnNode(s.node.init,"ref");s.insertBefore(n.types.variableDeclarator(t,s.node.init));s.replaceWith(n.types.variableDeclarator(s.node.id,n.types.cloneNode(t)));return}let a=s.node.init;const o=[];let i;e.findParent((e=>{if(e.isObjectProperty()){o.unshift(e)}else if(e.isVariableDeclarator()){i=e.parentPath.node.kind;return true}}));const l=replaceImpureComputedKeys(o,e.scope);o.forEach((e=>{const{node:t}=e;a=n.types.memberExpression(a,n.types.cloneNode(t.key),t.computed||n.types.isLiteral(t.key))}));const c=e.findParent((e=>e.isObjectPattern()));const[u,p,f]=createObjectRest(c,t,a);if(b){removeUnusedExcludedKeys(c)}n.types.assertIdentifier(p);r.insertBefore(u);r.insertBefore(l);r.insertAfter(n.types.variableDeclarator(p,f));r=r.getSibling(r.key+1);e.scope.registerBinding(i,r);if(c.node.properties.length===0){c.findParent((e=>e.isObjectProperty()||e.isVariableDeclarator())).remove()}}))},ExportNamedDeclaration(e){const t=e.get("declaration");if(!t.isVariableDeclaration())return;const r=t.get("declarations").some((e=>hasObjectPatternRestElement(e.get("id"))));if(!r)return;const s=[];for(const t of Object.keys(e.getOuterBindingIdentifiers(e))){s.push(n.types.exportSpecifier(n.types.identifier(t),n.types.identifier(t)))}e.replaceWith(t.node);e.insertAfter(n.types.exportNamedDeclaration(null,s))},CatchClause(e){const t=e.get("param");replaceRestElement(t.parentPath,t)},AssignmentExpression(e,t){const r=e.get("left");if(r.isObjectPattern()&&hasRestElement(r)){const s=[];const a=e.scope.generateUidBasedOnNode(e.node.right,"ref");s.push(n.types.variableDeclaration("var",[n.types.variableDeclarator(n.types.identifier(a),e.node.right)]));const[o,i,l]=createObjectRest(r,t,n.types.identifier(a));if(o.length>0){s.push(n.types.variableDeclaration("var",o))}const c=n.types.cloneNode(e.node);c.right=n.types.identifier(a);s.push(n.types.expressionStatement(c));s.push(n.types.toStatement(n.types.assignmentExpression("=",i,l)));s.push(n.types.expressionStatement(n.types.identifier(a)));e.replaceWithMultiple(s)}},ForXStatement(e){const{node:t,scope:r}=e;const s=e.get("left");const a=t.left;if(!hasObjectPatternRestElement(s)){return}if(!n.types.isVariableDeclaration(a)){const s=r.generateUidIdentifier("ref");t.left=n.types.variableDeclaration("var",[n.types.variableDeclarator(s)]);e.ensureBlock();if(t.body.body.length===0&&e.isCompletionRecord()){t.body.body.unshift(n.types.expressionStatement(r.buildUndefinedNode()))}t.body.body.unshift(n.types.expressionStatement(n.types.assignmentExpression("=",a,n.types.cloneNode(s))))}else{const s=a.declarations[0].id;const o=r.generateUidIdentifier("ref");t.left=n.types.variableDeclaration(a.kind,[n.types.variableDeclarator(o,null)]);e.ensureBlock();t.body.body.unshift(n.types.variableDeclaration(t.left.kind,[n.types.variableDeclarator(s,n.types.cloneNode(o))]))}},ArrayPattern(e){const t=[];visitRestElements(e,(e=>{if(!e.parentPath.isObjectPattern()){return}const r=e.parentPath;const s=e.scope.generateUidIdentifier("ref");t.push(n.types.variableDeclarator(r.node,s));r.replaceWith(n.types.cloneNode(s));e.skip()}));if(t.length>0){const r=e.getStatementParent();r.insertAfter(n.types.variableDeclaration(r.node.kind||"var",t))}},ObjectExpression(e,t){if(!hasSpread(e.node))return;let r;if(x){r=getExtendsHelper(t)}else{try{r=t.addHelper("objectSpread2")}catch(e){this.file.declarations["objectSpread2"]=null;r=t.addHelper("objectSpread")}}let s=null;let a=[];function make(){const e=a.length>0;const t=n.types.objectExpression(a);a=[];if(!s){s=n.types.callExpression(r,[t]);return}if(b){if(e){s.arguments.push(t)}return}s=n.types.callExpression(n.types.cloneNode(r),[s,...e?[n.types.objectExpression([]),t]:[]])}for(const t of e.node.properties){if(n.types.isSpreadElement(t)){make();s.arguments.push(t.argument)}else{a.push(t)}}if(a.length)make();e.replaceWith(s)}}}}));t["default"]=u},5732:(e,t,r)=>{e.exports=r(5880)},8711:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},4195:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6970);var a=r(7452);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"proposal-optional-catch-binding",inherits:a.default,visitor:{CatchClause(e){if(!e.node.param){const t=e.scope.generateUidIdentifier("unused");const r=e.get("param");r.replaceWith(t)}}}}}));t["default"]=n},6970:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7490:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(2262);var a=r(79);var n=r(8304);var o=r(5480);function _interopDefaultLegacy(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var i=_interopDefaultLegacy(a);function willPathCastToBoolean(e){const t=findOutermostTransparentParent(e);const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}function findOutermostTransparentParent(e){let t=e;e.findParent((e=>{if(!o.isTransparentExprWrapper(e))return true;t=e}));return t}const{ast:l}=n.template.expression;function isSimpleMemberExpression(e){e=o.skipTransparentExprWrappers(e);return n.types.isIdentifier(e)||n.types.isSuper(e)||n.types.isMemberExpression(e)&&!e.computed&&isSimpleMemberExpression(e.object)}function needsMemoize(e){let t=e;const{scope:r}=e;while(t.isOptionalMemberExpression()||t.isOptionalCallExpression()){const{node:e}=t;const s=t.isOptionalMemberExpression()?"object":"callee";const a=o.skipTransparentExprWrappers(t.get(s));if(e.optional){return!r.isStatic(a.node)}t=a}}function transform(e,{pureGetters:t,noDocumentAll:r}){const{scope:s}=e;const a=findOutermostTransparentParent(e);const{parentPath:i}=a;const c=willPathCastToBoolean(a);let u=false;const p=i.isCallExpression({callee:a.node})&&e.isOptionalMemberExpression();const f=[];let d=e;if(s.path.isPattern()&&needsMemoize(d)){e.replaceWith(n.template.ast`(() => ${e.node})()`);return}while(d.isOptionalMemberExpression()||d.isOptionalCallExpression()){const{node:e}=d;if(e.optional){f.push(e)}if(d.isOptionalMemberExpression()){d.node.type="MemberExpression";d=o.skipTransparentExprWrappers(d.get("object"))}else if(d.isOptionalCallExpression()){d.node.type="CallExpression";d=o.skipTransparentExprWrappers(d.get("callee"))}}let m=e;if(i.isUnaryExpression({operator:"delete"})){m=i;u=true}for(let e=f.length-1;e>=0;e--){const a=f[e];const i=n.types.isCallExpression(a);const d=i?"callee":"object";const g=a[d];let h=g;while(o.isTransparentExprWrapper(h)){h=h.expression}let b;let x;if(i&&n.types.isIdentifier(h,{name:"eval"})){x=b=h;a[d]=n.types.sequenceExpression([n.types.numericLiteral(0),b])}else if(t&&i&&isSimpleMemberExpression(h)){x=b=g}else{b=s.maybeGenerateMemoised(h);if(b){x=n.types.assignmentExpression("=",n.types.cloneNode(b),g);a[d]=b}else{x=b=g}}if(i&&n.types.isMemberExpression(h)){if(t&&isSimpleMemberExpression(h)){a.callee=g}else{const{object:e}=h;let t=s.maybeGenerateMemoised(e);if(t){h.object=n.types.assignmentExpression("=",t,e)}else if(n.types.isSuper(e)){t=n.types.thisExpression()}else{t=e}a.arguments.unshift(n.types.cloneNode(t));a.callee=n.types.memberExpression(a.callee,n.types.identifier("call"))}}let v=m.node;if(e===0&&p){var y;const e=o.skipTransparentExprWrappers(m.get("object")).node;let r;if(!t||!isSimpleMemberExpression(e)){r=s.maybeGenerateMemoised(e);if(r){v.object=n.types.assignmentExpression("=",r,e)}}v=n.types.callExpression(n.types.memberExpression(v,n.types.identifier("bind")),[n.types.cloneNode((y=r)!=null?y:e)])}if(c){const e=r?l`${n.types.cloneNode(x)} != null`:l` ${n.types.cloneNode(x)} !== null && ${n.types.cloneNode(b)} !== void 0`;m.replaceWith(n.types.logicalExpression("&&",e,v));m=o.skipTransparentExprWrappers(m.get("right"))}else{const e=r?l`${n.types.cloneNode(x)} == null`:l` - ${n.types.cloneNode(x)} === null || ${n.types.cloneNode(b)} === void 0`;const t=u?l`true`:l`void 0`;m.replaceWith(n.types.conditionalExpression(e,t,v));m=o.skipTransparentExprWrappers(m.get("alternate"))}}}var c=s.declare(((e,t)=>{var r,s;e.assertVersion(7);const{loose:a=false}=t;const n=(r=e.assumption("noDocumentAll"))!=null?r:a;const o=(s=e.assumption("pureGetters"))!=null?s:a;return{name:"proposal-optional-chaining",inherits:i["default"].default,visitor:{"OptionalCallExpression|OptionalMemberExpression"(e){transform(e,{noDocumentAll:n,pureGetters:o})}}}}));t["default"]=c;t.transform=transform},2262:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9062:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(1667);var a=r(6758);var n=(0,s.declare)(((e,t)=>{e.assertVersion(7);return(0,a.createClassFeaturePlugin)({name:"proposal-private-methods",api:e,feature:a.FEATURES.privateMethods,loose:t.loose,manipulateOptions(e,t){t.plugins.push("classPrivateMethods")}})}));t["default"]=n},1667:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},2074:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-dynamic-import",manipulateOptions(e,t){t.plugins.push("dynamicImport")}}}));t["default"]=a},1454:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-export-namespace-from",manipulateOptions(e,t){t.plugins.push("exportNamespaceFrom")}}}));t["default"]=a},3030:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-json-strings",manipulateOptions(e,t){t.plugins.push("jsonStrings")}}}));t["default"]=a},8926:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(4476);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-jsx",manipulateOptions(e,t){if(t.plugins.some((e=>(Array.isArray(e)?e[0]:e)==="typescript"))){return}t.plugins.push("jsx")}}}));t["default"]=a},4476:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5945:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-logical-assignment-operators",manipulateOptions(e,t){t.plugins.push("logicalAssignment")}}}));t["default"]=a},5879:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-nullish-coalescing-operator",manipulateOptions(e,t){t.plugins.push("nullishCoalescingOperator")}}}));t["default"]=a},1816:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-numeric-separator",manipulateOptions(e,t){t.plugins.push("numericSeparator")}}}));t["default"]=a},4499:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-object-rest-spread",manipulateOptions(e,t){t.plugins.push("objectRestSpread")}}}));t["default"]=a},7452:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-optional-catch-binding",manipulateOptions(e,t){t.plugins.push("optionalCatchBinding")}}}));t["default"]=a},79:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-optional-chaining",manipulateOptions(e,t){t.plugins.push("optionalChaining")}}}));t["default"]=a},4893:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3799);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-top-level-await",manipulateOptions(e,t){t.plugins.push("topLevelAwait")}}}));t["default"]=a},3799:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},513:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8845);var a=(0,s.declare)(((e,t)=>{var r;e.assertVersion(7);const s=(r=e.assumption("noNewArrows"))!=null?r:!t.spec;return{name:"transform-arrow-functions",visitor:{ArrowFunctionExpression(e){if(!e.isArrowFunctionExpression())return;e.arrowFunctionToExpression({allowInsertArrow:false,noNewArrows:s,specCompliant:!s})}}}}));t["default"]=a},8845:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},6413:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9203);var a=r(7120);var n=r(6039);var o=r(8304);var i=(0,s.declare)(((e,t)=>{e.assertVersion(7);const{method:r,module:s}=t;const i=e.assumption("noNewArrows");if(r&&s){return{name:"transform-async-to-generator",visitor:{Function(e,t){if(!e.node.async||e.node.generator)return;let l=t.methodWrapper;if(l){l=o.types.cloneNode(l)}else{l=t.methodWrapper=(0,n.addNamed)(e,r,s)}(0,a.default)(e,{wrapAsync:l},i)}}}}return{name:"transform-async-to-generator",visitor:{Function(e,t){if(!e.node.async||e.node.generator)return;(0,a.default)(e,{wrapAsync:t.addHelper("asyncToGenerator")},i)}}}}));t["default"]=i},9203:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8363:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6014);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);function statementList(e,t){const r=t.get(e);for(const e of r){const t=e.node;if(!e.isFunctionDeclaration())continue;const r=a.types.variableDeclaration("let",[a.types.variableDeclarator(t.id,a.types.toExpression(t))]);r._blockHoist=2;t.id=null;e.replaceWith(r)}}return{name:"transform-block-scoped-functions",visitor:{BlockStatement(e){const{node:t,parent:r}=e;if(a.types.isFunction(r,{body:t})||a.types.isExportDeclaration(r)){return}statementList("body",e)},SwitchCase(e){statementList("consequent",e)}}}}));t["default"]=n},6014:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1630:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8723);var a=r(4642);var n=r(8304);const o=new WeakSet;var i=(0,s.declare)(((e,t)=>{e.assertVersion(7);const{throwIfClosureRequired:r=false,tdz:s=false}=t;if(typeof r!=="boolean"){throw new Error(`.throwIfClosureRequired must be a boolean, or undefined`)}if(typeof s!=="boolean"){throw new Error(`.tdz must be a boolean, or undefined`)}return{name:"transform-block-scoping",visitor:{VariableDeclaration(e){const{node:t,parent:r,scope:s}=e;if(!isBlockScoped(t))return;convertBlockScopedToVar(e,null,r,s,true);if(t._tdzThis){const r=[t];for(let e=0;ee.isLoop()||e.isFunction()));return t==null?void 0:t.isLoop()}function convertBlockScopedToVar(e,t,r,s,a=false){if(!t){t=e.node}if(isInLoop(e)&&!n.types.isFor(r)){for(let e=0;e0){e.traverse(u,t)}else{e.traverse(a.visitor,t)}return e.skip()}},a.visitor]);const u=n.traverse.visitors.merge([{ReferencedIdentifier(e,t){const r=t.letReferences.get(e.node.name);if(!r)return;const s=e.scope.getBindingIdentifier(e.node.name);if(s&&s!==r)return;t.closurify=true}},a.visitor]);const p={enter(e,t){const{node:r,parent:s}=e;if(e.isForStatement()){if(isVar(r.init,r)){const e=t.pushDeclar(r.init);if(e.length===1){r.init=e[0]}else{r.init=n.types.sequenceExpression(e)}}}else if(e.isFor()){if(isVar(r.left,r)){t.pushDeclar(r.left);r.left=r.left.declarations[0].id}}else if(isVar(r,s)){e.replaceWithMultiple(t.pushDeclar(r).map((e=>n.types.expressionStatement(e))))}else if(e.isFunction()){return e.skip()}}};const d={LabeledStatement({node:e},t){t.innerLabels.push(e.label.name)}};const f={enter(e,t){if(e.isAssignmentExpression()||e.isUpdateExpression()){for(const r of Object.keys(e.getBindingIdentifiers())){if(t.outsideReferences.get(r)!==e.scope.getBindingIdentifier(r)){continue}t.reassignments[r]=true}}else if(e.isReturnStatement()){t.returnStatements.push(e)}}};function loopNodeTo(e){if(n.types.isBreakStatement(e)){return"break"}else if(n.types.isContinueStatement(e)){return"continue"}}const m={Loop(e,t){const r=t.ignoreLabeless;t.ignoreLabeless=true;e.traverse(m,t);t.ignoreLabeless=r;e.skip()},Function(e){e.skip()},SwitchCase(e,t){const r=t.inSwitchCase;t.inSwitchCase=true;e.traverse(m,t);t.inSwitchCase=r;e.skip()},"BreakStatement|ContinueStatement|ReturnStatement"(e,t){const{node:r,scope:s}=e;if(r[this.LOOP_IGNORE])return;let a;let o=loopNodeTo(r);if(o){if(r.label){if(t.innerLabels.indexOf(r.label.name)>=0){return}o=`${o}|${r.label.name}`}else{if(t.ignoreLabeless)return;if(n.types.isBreakStatement(r)&&t.inSwitchCase)return}t.hasBreakContinue=true;t.map[o]=r;a=n.types.stringLiteral(o)}if(e.isReturnStatement()){t.hasReturn=true;a=n.types.objectExpression([n.types.objectProperty(n.types.identifier("v"),r.argument||s.buildUndefinedNode())])}if(a){a=n.types.returnStatement(a);a[this.LOOP_IGNORE]=true;e.skip();e.replaceWith(n.types.inherits(a,r))}}};function isStrict(e){return!!e.find((({node:e})=>{if(n.types.isProgram(e)){if(e.sourceType==="module")return true}else if(!n.types.isBlockStatement(e))return false;return e.directives.some((e=>e.value.value==="use strict"))}))}class BlockScoping{constructor(e,t,r,s,a,o,i){this.parent=r;this.scope=s;this.state=i;this.throwIfClosureRequired=a;this.tdzEnabled=o;this.blockPath=t;this.block=t.node;this.outsideLetReferences=new Map;this.hasLetReferences=false;this.letReferences=new Map;this.body=[];if(e){this.loopParent=e.parent;this.loopLabel=n.types.isLabeledStatement(this.loopParent)&&this.loopParent.label;this.loopPath=e;this.loop=e.node}}run(){const e=this.block;if(o.has(e))return;o.add(e);const t=this.getLetReferences();this.checkConstants();if(n.types.isFunction(this.parent)||n.types.isProgram(this.block)){this.updateScopeInfo();return}if(!this.hasLetReferences)return;if(t){this.wrapClosure()}else{this.remap()}this.updateScopeInfo(t);if(this.loopLabel&&!n.types.isLabeledStatement(this.loopParent)){return n.types.labeledStatement(this.loopLabel,this.loop)}}checkConstants(){const e=this.scope;const t=this.state;for(const r of Object.keys(e.bindings)){const s=e.bindings[r];if(s.kind!=="const")continue;for(const e of s.constantViolations){const s=t.addHelper("readOnlyError");const a=n.types.callExpression(s,[n.types.stringLiteral(r)]);if(e.isAssignmentExpression()){const{operator:t}=e.node;if(t==="="){e.replaceWith(n.types.sequenceExpression([e.get("right").node,a]))}else if(["&&=","||=","??="].includes(t)){e.replaceWith(n.types.logicalExpression(t.slice(0,-1),e.get("left").node,n.types.sequenceExpression([e.get("right").node,a])))}else{e.replaceWith(n.types.sequenceExpression([n.types.binaryExpression(t.slice(0,-1),e.get("left").node,e.get("right").node),a]))}}else if(e.isUpdateExpression()){e.replaceWith(n.types.sequenceExpression([n.types.unaryExpression("+",e.get("argument").node),a]))}else if(e.isForXStatement()){e.ensureBlock();e.get("left").replaceWith(n.types.variableDeclaration("var",[n.types.variableDeclarator(e.scope.generateUidIdentifier(r))]));e.node.body.body.unshift(n.types.expressionStatement(a))}}}}updateScopeInfo(e){const t=this.blockPath.scope;const r=t.getFunctionParent()||t.getProgramParent();const s=this.letReferences;for(const a of s.keys()){const n=s.get(a);const o=t.getBinding(n.name);if(!o)continue;if(o.kind==="let"||o.kind==="const"){o.kind="var";if(e){if(t.hasOwnBinding(n.name)){t.removeBinding(n.name)}}else{t.moveBindingTo(n.name,r)}}}}remap(){const e=this.letReferences;const t=this.outsideLetReferences;const r=this.scope;const s=this.blockPath.scope;for(const t of e.keys()){const a=e.get(t);if(r.parentHasBinding(t)||r.hasGlobal(t)){const e=r.getOwnBinding(t);if(e){const s=r.parent.getOwnBinding(t);if(e.kind==="hoisted"&&!e.path.node.async&&!e.path.node.generator&&(!s||isVar(s.path.parent))&&!isStrict(e.path.parentPath)){continue}r.rename(a.name)}if(s.hasOwnBinding(t)){s.rename(a.name)}}}for(const r of t.keys()){const t=e.get(r);if(isInLoop(this.blockPath)&&s.hasOwnBinding(r)){s.rename(t.name)}}}wrapClosure(){if(this.throwIfClosureRequired){throw this.blockPath.buildCodeFrameError("Compiling let/const in this block would add a closure "+"(throwIfClosureRequired).")}const e=this.block;const t=this.outsideLetReferences;if(this.loop){for(const e of Array.from(t.keys())){const r=t.get(e);if(this.scope.hasGlobal(r.name)||this.scope.parentHasBinding(r.name)){t.delete(r.name);this.letReferences.delete(r.name);this.scope.rename(r.name);this.letReferences.set(r.name,r);t.set(r.name,r)}}}this.has=this.checkLoop();this.hoistVarDeclarations();const r=Array.from(t.values(),(e=>n.types.cloneNode(e)));const s=r.map((e=>n.types.cloneNode(e)));const a=this.blockPath.isSwitchStatement();const o=n.types.functionExpression(null,s,n.types.blockStatement(a?[e]:e.body));this.addContinuations(o);let i=n.types.callExpression(n.types.nullLiteral(),r);let l=".callee";const c=n.traverse.hasType(o.body,"YieldExpression",n.types.FUNCTION_TYPES);if(c){o.generator=true;i=n.types.yieldExpression(i,true);l=".argument"+l}const u=n.traverse.hasType(o.body,"AwaitExpression",n.types.FUNCTION_TYPES);if(u){o.async=true;i=n.types.awaitExpression(i);l=".argument"+l}let p;let d;if(this.has.hasReturn||this.has.hasBreakContinue){const e=this.scope.generateUid("ret");this.body.push(n.types.variableDeclaration("var",[n.types.variableDeclarator(n.types.identifier(e),i)]));p="declarations.0.init"+l;d=this.body.length-1;this.buildHas(e)}else{this.body.push(n.types.expressionStatement(i));p="expression"+l;d=this.body.length-1}let f;if(a){const{parentPath:e,listKey:t,key:r}=this.blockPath;this.blockPath.replaceWithMultiple(this.body);f=e.get(t)[r+d]}else{e.body=this.body;f=this.blockPath.get("body")[d]}const m=f.get(p);let y;if(this.loop){const e=this.scope.generateUid("loop");const t=this.loopPath.insertBefore(n.types.variableDeclaration("var",[n.types.variableDeclarator(n.types.identifier(e),o)]));m.replaceWith(n.types.identifier(e));y=t[0].get("declarations.0.init")}else{m.replaceWith(o);y=m}y.unwrapFunctionEnvironment()}addContinuations(e){const t={reassignments:{},returnStatements:[],outsideReferences:this.outsideLetReferences};this.scope.traverse(e,f,t);for(let r=0;r{e.insertBefore(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.identifier(a),n.types.identifier(o))))}));e.body.body.push(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.identifier(a),n.types.identifier(o))))}}getLetReferences(){const e=this.block;const t=[];if(this.loop){const e=this.loop.left||this.loop.init;if(isBlockScoped(e)){t.push(e);const r=n.types.getBindingIdentifiers(e);for(const e of Object.keys(r)){this.outsideLetReferences.set(e,r[e])}}}const addDeclarationsFromChild=(r,s)=>{s=s||r.node;if(n.types.isClassDeclaration(s)||n.types.isFunctionDeclaration(s)||isBlockScoped(s)){if(isBlockScoped(s)){convertBlockScopedToVar(r,s,e,this.scope)}if(s.declarations){for(let e=0;ethis.state.addHelper(e)};if(isInLoop(this.blockPath)){r.loopDepth++}this.blockPath.traverse(c,r);return r.closurify}checkLoop(){const e={hasBreakContinue:false,ignoreLabeless:false,inSwitchCase:false,innerLabels:[],hasReturn:false,isLoop:!!this.loop,map:{},LOOP_IGNORE:Symbol()};this.blockPath.traverse(d,e);this.blockPath.traverse(m,e);return e}hoistVarDeclarations(){this.blockPath.traverse(p,this)}pushDeclar(e){const t=[];const r=n.types.getBindingIdentifiers(e);for(const e of Object.keys(r)){t.push(n.types.variableDeclarator(r[e]))}this.body.push(n.types.variableDeclaration(e.kind,t));const s=[];for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.visitor=void 0;var s=r(8304);function getTDZStatus(e,t){const r=t._guessExecutionStatusRelativeTo(e);if(r==="before"){return"outside"}else if(r==="after"){return"inside"}else{return"maybe"}}function buildTDZAssert(e,t){return s.types.callExpression(t.addHelper("temporalRef"),[e,s.types.stringLiteral(e.name)])}function isReference(e,t,r){const s=r.letReferences.get(e.name);if(!s)return false;return t.getBindingIdentifier(e.name)===s}const a=new WeakSet;const n={ReferencedIdentifier(e,t){if(!t.tdzEnabled)return;const{node:r,parent:n,scope:o}=e;if(e.parentPath.isFor({left:r}))return;if(!isReference(r,o,t))return;const i=o.getBinding(r.name).path;if(i.isFunctionDeclaration())return;const l=getTDZStatus(e,i);if(l==="outside")return;if(l==="maybe"){if(a.has(r)){return}a.add(r);const o=buildTDZAssert(r,t);i.parent._tdzThis=true;if(e.parentPath.isUpdateExpression()){if(n._ignoreBlockScopingTDZ)return;e.parentPath.replaceWith(s.types.sequenceExpression([o,n]))}else{e.replaceWith(o)}}else if(l==="inside"){e.replaceWith(s.template.ast`${t.addHelper("tdz")}("${r.name}")`)}},AssignmentExpression:{exit(e,t){if(!t.tdzEnabled)return;const{node:r}=e;if(r._ignoreBlockScopingTDZ)return;const a=[];const n=e.getBindingIdentifiers();for(const r of Object.keys(n)){const s=n[r];if(isReference(s,e.scope,t)){a.push(s)}}if(a.length){r._ignoreBlockScopingTDZ=true;a.push(r);e.replaceWithMultiple(a.map((e=>s.types.expressionStatement(e))))}}}};t.visitor=n},8723:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8120:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8432);var a=r(8304);var n=(0,s.declare)(((e,t)=>{var r;e.assertVersion(7);const s=(r=e.assumption("setComputedProperties"))!=null?r:t.loose;const n=s?pushComputedPropsLoose:pushComputedPropsSpec;const o=(0,a.template)(`\n MUTATOR_MAP_REF[KEY] = MUTATOR_MAP_REF[KEY] || {};\n MUTATOR_MAP_REF[KEY].KIND = VALUE;\n `);function getValue(e){if(a.types.isObjectProperty(e)){return e.value}else if(a.types.isObjectMethod(e)){return a.types.functionExpression(null,e.params,e.body,e.generator,e.async)}}function pushAssign(e,t,r){if(t.kind==="get"&&t.kind==="set"){pushMutatorDefine(e,t,r)}else{r.push(a.types.expressionStatement(a.types.assignmentExpression("=",a.types.memberExpression(a.types.cloneNode(e),t.key,t.computed||a.types.isLiteral(t.key)),getValue(t))))}}function pushMutatorDefine({body:e,getMutatorId:t,scope:r},s){let n=!s.computed&&a.types.isIdentifier(s.key)?a.types.stringLiteral(s.key.name):s.key;const i=r.maybeGenerateMemoised(n);if(i){e.push(a.types.expressionStatement(a.types.assignmentExpression("=",i,n)));n=i}e.push(...o({MUTATOR_MAP_REF:t(),KEY:a.types.cloneNode(n),VALUE:getValue(s),KIND:a.types.identifier(s.kind)}))}function pushComputedPropsLoose(e){for(const t of e.computedProps){if(t.kind==="get"||t.kind==="set"){pushMutatorDefine(e,t)}else{pushAssign(a.types.cloneNode(e.objId),t,e.body)}}}function pushComputedPropsSpec(e){const{objId:t,body:r,computedProps:s,state:n}=e;for(const o of s){const i=a.types.toComputedKey(o);if(o.kind==="get"||o.kind==="set"){pushMutatorDefine(e,o)}else{if(s.length===1){return a.types.callExpression(n.addHelper("defineProperty"),[e.initPropExpression,i,getValue(o)])}else{r.push(a.types.expressionStatement(a.types.callExpression(n.addHelper("defineProperty"),[a.types.cloneNode(t),i,getValue(o)])))}}}}return{name:"transform-computed-properties",visitor:{ObjectExpression:{exit(e,t){const{node:r,parent:s,scope:o}=e;let i=false;for(const e of r.properties){i=e.computed===true;if(i)break}if(!i)return;const l=[];const c=[];let u=false;for(const e of r.properties){if(e.computed){u=true}if(u){c.push(e)}else{l.push(e)}}const p=o.generateUidIdentifierBasedOnNode(s);const d=a.types.objectExpression(l);const f=[];f.push(a.types.variableDeclaration("var",[a.types.variableDeclarator(p,d)]));let m;const getMutatorId=function(){if(!m){m=o.generateUidIdentifier("mutatorMap");f.push(a.types.variableDeclaration("var",[a.types.variableDeclarator(m,a.types.objectExpression([]))]))}return a.types.cloneNode(m)};const y=n({scope:o,objId:p,body:f,computedProps:c,initPropExpression:d,getMutatorId:getMutatorId,state:t});if(m){f.push(a.types.expressionStatement(a.types.callExpression(t.addHelper("defineEnumerableProperties"),[a.types.cloneNode(p),a.types.cloneNode(m)])))}if(y){e.replaceWith(y)}else{f.push(a.types.expressionStatement(a.types.cloneNode(p)));e.replaceWithMultiple(f)}}}}}}));t["default"]=n},8432:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7850:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(4050);var a=r(8304);function getName(e){if(a.types.isIdentifier(e)){return e.name}return e.value.toString()}var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-duplicate-keys",visitor:{ObjectExpression(e){const{node:t}=e;const r=t.properties.filter((e=>!a.types.isSpreadElement(e)&&!e.computed));const s=Object.create(null);const n=Object.create(null);const o=Object.create(null);for(const e of r){const t=getName(e.key);let r=false;switch(e.kind){case"get":if(s[t]||n[t]){r=true}n[t]=true;break;case"set":if(s[t]||o[t]){r=true}o[t]=true;break;default:if(s[t]||n[t]||o[t]){r=true}s[t]=true}if(r){e.computed=true;e.key=a.types.stringLiteral(t)}}}}}}));t["default"]=n},4050:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1176:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3651);var a=r(6951);var n=r(8304);var o=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-exponentiation-operator",visitor:(0,a.default)({operator:"**",build(e,t){return n.types.callExpression(n.types.memberExpression(n.types.identifier("Math"),n.types.identifier("pow")),[e,t])}})}}));t["default"]=o},3651:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9488:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(2388);var a=r(8304);var n=r(8591);var o=(0,s.declare)(((e,t)=>{var r,s,o;e.assertVersion(7);{const{assumeArray:r,allowArrayLike:s,loose:a}=t;if(a===true&&r===true){throw new Error(`The loose and assumeArray options cannot be used together in @babel/plugin-transform-for-of`)}if(r===true&&s===true){throw new Error(`The assumeArray and allowArrayLike options cannot be used together in @babel/plugin-transform-for-of`)}if(s&&/^7\.\d\./.test(e.version)){throw new Error(`The allowArrayLike is only supported when using @babel/core@^7.10.0`)}}const i=(r=t.assumeArray)!=null?r:!t.loose&&e.assumption("iterableIsArray");const l=(s=t.allowArrayLike)!=null?s:e.assumption("arrayLikeIsIterable");const c=(o=e.assumption("skipForOfIteratorClosing"))!=null?o:t.loose;if(i&&l){throw new Error(`The "iterableIsArray" and "arrayLikeIsIterable" assumptions are not compatible.`)}if(i){return{name:"transform-for-of",visitor:{ForOfStatement(e){const{scope:t}=e;const{left:r,right:s,await:n}=e.node;if(n){return}const o=t.generateUidIdentifier("i");let i=t.maybeGenerateMemoised(s,true);const l=[a.types.variableDeclarator(o,a.types.numericLiteral(0))];if(i){l.push(a.types.variableDeclarator(i,s))}else{i=s}const c=a.types.memberExpression(a.types.cloneNode(i),a.types.cloneNode(o),true);let u;if(a.types.isVariableDeclaration(r)){u=r;u.declarations[0].init=c}else{u=a.types.expressionStatement(a.types.assignmentExpression("=",r,c))}let p;const d=e.get("body");if(d.isBlockStatement()&&Object.keys(e.getBindingIdentifiers()).some((e=>d.scope.hasOwnBinding(e)))){p=a.types.blockStatement([u,d.node])}else{p=a.types.toBlock(d.node);p.body.unshift(u)}e.replaceWith(a.types.forStatement(a.types.variableDeclaration("let",l),a.types.binaryExpression("<",a.types.cloneNode(o),a.types.memberExpression(a.types.cloneNode(i),a.types.identifier("length"))),a.types.updateExpression("++",a.types.cloneNode(o)),p))}}}}const u=(0,a.template)` + ${n.types.cloneNode(x)} === null || ${n.types.cloneNode(b)} === void 0`;const t=u?l`true`:l`void 0`;m.replaceWith(n.types.conditionalExpression(e,t,v));m=o.skipTransparentExprWrappers(m.get("alternate"))}}}var c=s.declare(((e,t)=>{var r,s;e.assertVersion(7);const{loose:a=false}=t;const n=(r=e.assumption("noDocumentAll"))!=null?r:a;const o=(s=e.assumption("pureGetters"))!=null?s:a;return{name:"proposal-optional-chaining",inherits:i["default"].default,visitor:{"OptionalCallExpression|OptionalMemberExpression"(e){transform(e,{noDocumentAll:n,pureGetters:o})}}}}));t["default"]=c;t.transform=transform},2262:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9062:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(1667);var a=r(6758);var n=(0,s.declare)(((e,t)=>{e.assertVersion(7);return(0,a.createClassFeaturePlugin)({name:"proposal-private-methods",api:e,feature:a.FEATURES.privateMethods,loose:t.loose,manipulateOptions(e,t){t.plugins.push("classPrivateMethods")}})}));t["default"]=n},1667:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},2074:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-dynamic-import",manipulateOptions(e,t){t.plugins.push("dynamicImport")}}}));t["default"]=a},1454:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-export-namespace-from",manipulateOptions(e,t){t.plugins.push("exportNamespaceFrom")}}}));t["default"]=a},3030:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-json-strings",manipulateOptions(e,t){t.plugins.push("jsonStrings")}}}));t["default"]=a},8926:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(4476);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-jsx",manipulateOptions(e,t){if(t.plugins.some((e=>(Array.isArray(e)?e[0]:e)==="typescript"))){return}t.plugins.push("jsx")}}}));t["default"]=a},4476:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5945:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-logical-assignment-operators",manipulateOptions(e,t){t.plugins.push("logicalAssignment")}}}));t["default"]=a},5879:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-nullish-coalescing-operator",manipulateOptions(e,t){t.plugins.push("nullishCoalescingOperator")}}}));t["default"]=a},1816:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-numeric-separator",manipulateOptions(e,t){t.plugins.push("numericSeparator")}}}));t["default"]=a},4499:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-object-rest-spread",manipulateOptions(e,t){t.plugins.push("objectRestSpread")}}}));t["default"]=a},7452:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-optional-catch-binding",manipulateOptions(e,t){t.plugins.push("optionalCatchBinding")}}}));t["default"]=a},79:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9055);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-optional-chaining",manipulateOptions(e,t){t.plugins.push("optionalChaining")}}}));t["default"]=a},4893:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3799);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-top-level-await",manipulateOptions(e,t){t.plugins.push("topLevelAwait")}}}));t["default"]=a},3799:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},513:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8845);var a=(0,s.declare)(((e,t)=>{var r;e.assertVersion(7);const s=(r=e.assumption("noNewArrows"))!=null?r:!t.spec;return{name:"transform-arrow-functions",visitor:{ArrowFunctionExpression(e){if(!e.isArrowFunctionExpression())return;e.arrowFunctionToExpression({allowInsertArrow:false,noNewArrows:s,specCompliant:!s})}}}}));t["default"]=a},8845:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},6413:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9203);var a=r(7120);var n=r(9115);var o=r(8304);var i=(0,s.declare)(((e,t)=>{e.assertVersion(7);const{method:r,module:s}=t;const i=e.assumption("noNewArrows");if(r&&s){return{name:"transform-async-to-generator",visitor:{Function(e,t){if(!e.node.async||e.node.generator)return;let l=t.methodWrapper;if(l){l=o.types.cloneNode(l)}else{l=t.methodWrapper=(0,n.addNamed)(e,r,s)}(0,a.default)(e,{wrapAsync:l},i)}}}}return{name:"transform-async-to-generator",visitor:{Function(e,t){if(!e.node.async||e.node.generator)return;(0,a.default)(e,{wrapAsync:t.addHelper("asyncToGenerator")},i)}}}}));t["default"]=i},9203:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8363:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6014);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);function statementList(e,t){const r=t.get(e);for(const e of r){const t=e.node;if(!e.isFunctionDeclaration())continue;const r=a.types.variableDeclaration("let",[a.types.variableDeclarator(t.id,a.types.toExpression(t))]);r._blockHoist=2;t.id=null;e.replaceWith(r)}}return{name:"transform-block-scoped-functions",visitor:{BlockStatement(e){const{node:t,parent:r}=e;if(a.types.isFunction(r,{body:t})||a.types.isExportDeclaration(r)){return}statementList("body",e)},SwitchCase(e){statementList("consequent",e)}}}}));t["default"]=n},6014:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1630:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8723);var a=r(4642);var n=r(8304);const o=new WeakSet;var i=(0,s.declare)(((e,t)=>{e.assertVersion(7);const{throwIfClosureRequired:r=false,tdz:s=false}=t;if(typeof r!=="boolean"){throw new Error(`.throwIfClosureRequired must be a boolean, or undefined`)}if(typeof s!=="boolean"){throw new Error(`.tdz must be a boolean, or undefined`)}return{name:"transform-block-scoping",visitor:{VariableDeclaration(e){const{node:t,parent:r,scope:s}=e;if(!isBlockScoped(t))return;convertBlockScopedToVar(e,null,r,s,true);if(t._tdzThis){const r=[t];for(let e=0;ee.isLoop()||e.isFunction()));return t==null?void 0:t.isLoop()}function convertBlockScopedToVar(e,t,r,s,a=false){if(!t){t=e.node}if(isInLoop(e)&&!n.types.isFor(r)){for(let e=0;e0){e.traverse(u,t)}else{e.traverse(a.visitor,t)}return e.skip()}},a.visitor]);const u=n.traverse.visitors.merge([{ReferencedIdentifier(e,t){const r=t.letReferences.get(e.node.name);if(!r)return;const s=e.scope.getBindingIdentifier(e.node.name);if(s&&s!==r)return;t.closurify=true}},a.visitor]);const p={enter(e,t){const{node:r,parent:s}=e;if(e.isForStatement()){if(isVar(r.init,r)){const e=t.pushDeclar(r.init);if(e.length===1){r.init=e[0]}else{r.init=n.types.sequenceExpression(e)}}}else if(e.isFor()){if(isVar(r.left,r)){t.pushDeclar(r.left);r.left=r.left.declarations[0].id}}else if(isVar(r,s)){e.replaceWithMultiple(t.pushDeclar(r).map((e=>n.types.expressionStatement(e))))}else if(e.isFunction()){return e.skip()}}};const f={LabeledStatement({node:e},t){t.innerLabels.push(e.label.name)}};const d={enter(e,t){if(e.isAssignmentExpression()||e.isUpdateExpression()){for(const r of Object.keys(e.getBindingIdentifiers())){if(t.outsideReferences.get(r)!==e.scope.getBindingIdentifier(r)){continue}t.reassignments[r]=true}}else if(e.isReturnStatement()){t.returnStatements.push(e)}}};function loopNodeTo(e){if(n.types.isBreakStatement(e)){return"break"}else if(n.types.isContinueStatement(e)){return"continue"}}const m={Loop(e,t){const r=t.ignoreLabeless;t.ignoreLabeless=true;e.traverse(m,t);t.ignoreLabeless=r;e.skip()},Function(e){e.skip()},SwitchCase(e,t){const r=t.inSwitchCase;t.inSwitchCase=true;e.traverse(m,t);t.inSwitchCase=r;e.skip()},"BreakStatement|ContinueStatement|ReturnStatement"(e,t){const{node:r,scope:s}=e;if(r[this.LOOP_IGNORE])return;let a;let o=loopNodeTo(r);if(o){if(r.label){if(t.innerLabels.indexOf(r.label.name)>=0){return}o=`${o}|${r.label.name}`}else{if(t.ignoreLabeless)return;if(n.types.isBreakStatement(r)&&t.inSwitchCase)return}t.hasBreakContinue=true;t.map[o]=r;a=n.types.stringLiteral(o)}if(e.isReturnStatement()){t.hasReturn=true;a=n.types.objectExpression([n.types.objectProperty(n.types.identifier("v"),r.argument||s.buildUndefinedNode())])}if(a){a=n.types.returnStatement(a);a[this.LOOP_IGNORE]=true;e.skip();e.replaceWith(n.types.inherits(a,r))}}};function isStrict(e){return!!e.find((({node:e})=>{if(n.types.isProgram(e)){if(e.sourceType==="module")return true}else if(!n.types.isBlockStatement(e))return false;return e.directives.some((e=>e.value.value==="use strict"))}))}class BlockScoping{constructor(e,t,r,s,a,o,i){this.parent=r;this.scope=s;this.state=i;this.throwIfClosureRequired=a;this.tdzEnabled=o;this.blockPath=t;this.block=t.node;this.outsideLetReferences=new Map;this.hasLetReferences=false;this.letReferences=new Map;this.body=[];if(e){this.loopParent=e.parent;this.loopLabel=n.types.isLabeledStatement(this.loopParent)&&this.loopParent.label;this.loopPath=e;this.loop=e.node}}run(){const e=this.block;if(o.has(e))return;o.add(e);const t=this.getLetReferences();this.checkConstants();if(n.types.isFunction(this.parent)||n.types.isProgram(this.block)){this.updateScopeInfo();return}if(!this.hasLetReferences)return;if(t){this.wrapClosure()}else{this.remap()}this.updateScopeInfo(t);if(this.loopLabel&&!n.types.isLabeledStatement(this.loopParent)){return n.types.labeledStatement(this.loopLabel,this.loop)}}checkConstants(){const e=this.scope;const t=this.state;for(const r of Object.keys(e.bindings)){const s=e.bindings[r];if(s.kind!=="const")continue;for(const e of s.constantViolations){const s=t.addHelper("readOnlyError");const a=n.types.callExpression(s,[n.types.stringLiteral(r)]);if(e.isAssignmentExpression()){const{operator:t}=e.node;if(t==="="){e.replaceWith(n.types.sequenceExpression([e.get("right").node,a]))}else if(["&&=","||=","??="].includes(t)){e.replaceWith(n.types.logicalExpression(t.slice(0,-1),e.get("left").node,n.types.sequenceExpression([e.get("right").node,a])))}else{e.replaceWith(n.types.sequenceExpression([n.types.binaryExpression(t.slice(0,-1),e.get("left").node,e.get("right").node),a]))}}else if(e.isUpdateExpression()){e.replaceWith(n.types.sequenceExpression([n.types.unaryExpression("+",e.get("argument").node),a]))}else if(e.isForXStatement()){e.ensureBlock();e.get("left").replaceWith(n.types.variableDeclaration("var",[n.types.variableDeclarator(e.scope.generateUidIdentifier(r))]));e.node.body.body.unshift(n.types.expressionStatement(a))}}}}updateScopeInfo(e){const t=this.blockPath.scope;const r=t.getFunctionParent()||t.getProgramParent();const s=this.letReferences;for(const a of s.keys()){const n=s.get(a);const o=t.getBinding(n.name);if(!o)continue;if(o.kind==="let"||o.kind==="const"){o.kind="var";if(e){if(t.hasOwnBinding(n.name)){t.removeBinding(n.name)}}else{t.moveBindingTo(n.name,r)}}}}remap(){const e=this.letReferences;const t=this.outsideLetReferences;const r=this.scope;const s=this.blockPath.scope;for(const t of e.keys()){const a=e.get(t);if(r.parentHasBinding(t)||r.hasGlobal(t)){const e=r.getOwnBinding(t);if(e){const s=r.parent.getOwnBinding(t);if(e.kind==="hoisted"&&!e.path.node.async&&!e.path.node.generator&&(!s||isVar(s.path.parent))&&!isStrict(e.path.parentPath)){continue}r.rename(a.name)}if(s.hasOwnBinding(t)){s.rename(a.name)}}}for(const r of t.keys()){const t=e.get(r);if(isInLoop(this.blockPath)&&s.hasOwnBinding(r)){s.rename(t.name)}}}wrapClosure(){if(this.throwIfClosureRequired){throw this.blockPath.buildCodeFrameError("Compiling let/const in this block would add a closure "+"(throwIfClosureRequired).")}const e=this.block;const t=this.outsideLetReferences;if(this.loop){for(const e of Array.from(t.keys())){const r=t.get(e);if(this.scope.hasGlobal(r.name)||this.scope.parentHasBinding(r.name)){t.delete(r.name);this.letReferences.delete(r.name);this.scope.rename(r.name);this.letReferences.set(r.name,r);t.set(r.name,r)}}}this.has=this.checkLoop();this.hoistVarDeclarations();const r=Array.from(t.values(),(e=>n.types.cloneNode(e)));const s=r.map((e=>n.types.cloneNode(e)));const a=this.blockPath.isSwitchStatement();const o=n.types.functionExpression(null,s,n.types.blockStatement(a?[e]:e.body));this.addContinuations(o);let i=n.types.callExpression(n.types.nullLiteral(),r);let l=".callee";const c=n.traverse.hasType(o.body,"YieldExpression",n.types.FUNCTION_TYPES);if(c){o.generator=true;i=n.types.yieldExpression(i,true);l=".argument"+l}const u=n.traverse.hasType(o.body,"AwaitExpression",n.types.FUNCTION_TYPES);if(u){o.async=true;i=n.types.awaitExpression(i);l=".argument"+l}let p;let f;if(this.has.hasReturn||this.has.hasBreakContinue){const e=this.scope.generateUid("ret");this.body.push(n.types.variableDeclaration("var",[n.types.variableDeclarator(n.types.identifier(e),i)]));p="declarations.0.init"+l;f=this.body.length-1;this.buildHas(e)}else{this.body.push(n.types.expressionStatement(i));p="expression"+l;f=this.body.length-1}let d;if(a){const{parentPath:e,listKey:t,key:r}=this.blockPath;this.blockPath.replaceWithMultiple(this.body);d=e.get(t)[r+f]}else{e.body=this.body;d=this.blockPath.get("body")[f]}const m=d.get(p);let y;if(this.loop){const e=this.scope.generateUid("loop");const t=this.loopPath.insertBefore(n.types.variableDeclaration("var",[n.types.variableDeclarator(n.types.identifier(e),o)]));m.replaceWith(n.types.identifier(e));y=t[0].get("declarations.0.init")}else{m.replaceWith(o);y=m}y.unwrapFunctionEnvironment()}addContinuations(e){const t={reassignments:{},returnStatements:[],outsideReferences:this.outsideLetReferences};this.scope.traverse(e,d,t);for(let r=0;r{e.insertBefore(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.identifier(a),n.types.identifier(o))))}));e.body.body.push(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.identifier(a),n.types.identifier(o))))}}getLetReferences(){const e=this.block;const t=[];if(this.loop){const e=this.loop.left||this.loop.init;if(isBlockScoped(e)){t.push(e);const r=n.types.getBindingIdentifiers(e);for(const e of Object.keys(r)){this.outsideLetReferences.set(e,r[e])}}}const addDeclarationsFromChild=(r,s)=>{s=s||r.node;if(n.types.isClassDeclaration(s)||n.types.isFunctionDeclaration(s)||isBlockScoped(s)){if(isBlockScoped(s)){convertBlockScopedToVar(r,s,e,this.scope)}if(s.declarations){for(let e=0;ethis.state.addHelper(e)};if(isInLoop(this.blockPath)){r.loopDepth++}this.blockPath.traverse(c,r);return r.closurify}checkLoop(){const e={hasBreakContinue:false,ignoreLabeless:false,inSwitchCase:false,innerLabels:[],hasReturn:false,isLoop:!!this.loop,map:{},LOOP_IGNORE:Symbol()};this.blockPath.traverse(f,e);this.blockPath.traverse(m,e);return e}hoistVarDeclarations(){this.blockPath.traverse(p,this)}pushDeclar(e){const t=[];const r=n.types.getBindingIdentifiers(e);for(const e of Object.keys(r)){t.push(n.types.variableDeclarator(r[e]))}this.body.push(n.types.variableDeclaration(e.kind,t));const s=[];for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.visitor=void 0;var s=r(8304);function getTDZStatus(e,t){const r=t._guessExecutionStatusRelativeTo(e);if(r==="before"){return"outside"}else if(r==="after"){return"inside"}else{return"maybe"}}function buildTDZAssert(e,t){return s.types.callExpression(t.addHelper("temporalRef"),[e,s.types.stringLiteral(e.name)])}function isReference(e,t,r){const s=r.letReferences.get(e.name);if(!s)return false;return t.getBindingIdentifier(e.name)===s}const a=new WeakSet;const n={ReferencedIdentifier(e,t){if(!t.tdzEnabled)return;const{node:r,parent:n,scope:o}=e;if(e.parentPath.isFor({left:r}))return;if(!isReference(r,o,t))return;const i=o.getBinding(r.name).path;if(i.isFunctionDeclaration())return;const l=getTDZStatus(e,i);if(l==="outside")return;if(l==="maybe"){if(a.has(r)){return}a.add(r);const o=buildTDZAssert(r,t);i.parent._tdzThis=true;if(e.parentPath.isUpdateExpression()){if(n._ignoreBlockScopingTDZ)return;e.parentPath.replaceWith(s.types.sequenceExpression([o,n]))}else{e.replaceWith(o)}}else if(l==="inside"){e.replaceWith(s.template.ast`${t.addHelper("tdz")}("${r.name}")`)}},AssignmentExpression:{exit(e,t){if(!t.tdzEnabled)return;const{node:r}=e;if(r._ignoreBlockScopingTDZ)return;const a=[];const n=e.getBindingIdentifiers();for(const r of Object.keys(n)){const s=n[r];if(isReference(s,e.scope,t)){a.push(s)}}if(a.length){r._ignoreBlockScopingTDZ=true;a.push(r);e.replaceWithMultiple(a.map((e=>s.types.expressionStatement(e))))}}}};t.visitor=n},8723:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8120:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8432);var a=r(8304);var n=(0,s.declare)(((e,t)=>{var r;e.assertVersion(7);const s=(r=e.assumption("setComputedProperties"))!=null?r:t.loose;const n=s?pushComputedPropsLoose:pushComputedPropsSpec;const o=(0,a.template)(`\n MUTATOR_MAP_REF[KEY] = MUTATOR_MAP_REF[KEY] || {};\n MUTATOR_MAP_REF[KEY].KIND = VALUE;\n `);function getValue(e){if(a.types.isObjectProperty(e)){return e.value}else if(a.types.isObjectMethod(e)){return a.types.functionExpression(null,e.params,e.body,e.generator,e.async)}}function pushAssign(e,t,r){if(t.kind==="get"&&t.kind==="set"){pushMutatorDefine(e,t,r)}else{r.push(a.types.expressionStatement(a.types.assignmentExpression("=",a.types.memberExpression(a.types.cloneNode(e),t.key,t.computed||a.types.isLiteral(t.key)),getValue(t))))}}function pushMutatorDefine({body:e,getMutatorId:t,scope:r},s){let n=!s.computed&&a.types.isIdentifier(s.key)?a.types.stringLiteral(s.key.name):s.key;const i=r.maybeGenerateMemoised(n);if(i){e.push(a.types.expressionStatement(a.types.assignmentExpression("=",i,n)));n=i}e.push(...o({MUTATOR_MAP_REF:t(),KEY:a.types.cloneNode(n),VALUE:getValue(s),KIND:a.types.identifier(s.kind)}))}function pushComputedPropsLoose(e){for(const t of e.computedProps){if(t.kind==="get"||t.kind==="set"){pushMutatorDefine(e,t)}else{pushAssign(a.types.cloneNode(e.objId),t,e.body)}}}function pushComputedPropsSpec(e){const{objId:t,body:r,computedProps:s,state:n}=e;for(const o of s){const i=a.types.toComputedKey(o);if(o.kind==="get"||o.kind==="set"){pushMutatorDefine(e,o)}else{if(s.length===1){return a.types.callExpression(n.addHelper("defineProperty"),[e.initPropExpression,i,getValue(o)])}else{r.push(a.types.expressionStatement(a.types.callExpression(n.addHelper("defineProperty"),[a.types.cloneNode(t),i,getValue(o)])))}}}}return{name:"transform-computed-properties",visitor:{ObjectExpression:{exit(e,t){const{node:r,parent:s,scope:o}=e;let i=false;for(const e of r.properties){i=e.computed===true;if(i)break}if(!i)return;const l=[];const c=[];let u=false;for(const e of r.properties){if(e.computed){u=true}if(u){c.push(e)}else{l.push(e)}}const p=o.generateUidIdentifierBasedOnNode(s);const f=a.types.objectExpression(l);const d=[];d.push(a.types.variableDeclaration("var",[a.types.variableDeclarator(p,f)]));let m;const getMutatorId=function(){if(!m){m=o.generateUidIdentifier("mutatorMap");d.push(a.types.variableDeclaration("var",[a.types.variableDeclarator(m,a.types.objectExpression([]))]))}return a.types.cloneNode(m)};const y=n({scope:o,objId:p,body:d,computedProps:c,initPropExpression:f,getMutatorId:getMutatorId,state:t});if(m){d.push(a.types.expressionStatement(a.types.callExpression(t.addHelper("defineEnumerableProperties"),[a.types.cloneNode(p),a.types.cloneNode(m)])))}if(y){e.replaceWith(y)}else{d.push(a.types.expressionStatement(a.types.cloneNode(p)));e.replaceWithMultiple(d)}}}}}}));t["default"]=n},8432:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7850:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(4050);var a=r(8304);function getName(e){if(a.types.isIdentifier(e)){return e.name}return e.value.toString()}var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-duplicate-keys",visitor:{ObjectExpression(e){const{node:t}=e;const r=t.properties.filter((e=>!a.types.isSpreadElement(e)&&!e.computed));const s=Object.create(null);const n=Object.create(null);const o=Object.create(null);for(const e of r){const t=getName(e.key);let r=false;switch(e.kind){case"get":if(s[t]||n[t]){r=true}n[t]=true;break;case"set":if(s[t]||o[t]){r=true}o[t]=true;break;default:if(s[t]||n[t]||o[t]){r=true}s[t]=true}if(r){e.computed=true;e.key=a.types.stringLiteral(t)}}}}}}));t["default"]=n},4050:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1176:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3651);var a=r(6951);var n=r(8304);var o=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-exponentiation-operator",visitor:(0,a.default)({operator:"**",build(e,t){return n.types.callExpression(n.types.memberExpression(n.types.identifier("Math"),n.types.identifier("pow")),[e,t])}})}}));t["default"]=o},3651:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9488:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(2388);var a=r(8304);var n=r(8591);var o=(0,s.declare)(((e,t)=>{var r,s,o;e.assertVersion(7);{const{assumeArray:r,allowArrayLike:s,loose:a}=t;if(a===true&&r===true){throw new Error(`The loose and assumeArray options cannot be used together in @babel/plugin-transform-for-of`)}if(r===true&&s===true){throw new Error(`The assumeArray and allowArrayLike options cannot be used together in @babel/plugin-transform-for-of`)}if(s&&/^7\.\d\./.test(e.version)){throw new Error(`The allowArrayLike is only supported when using @babel/core@^7.10.0`)}}const i=(r=t.assumeArray)!=null?r:!t.loose&&e.assumption("iterableIsArray");const l=(s=t.allowArrayLike)!=null?s:e.assumption("arrayLikeIsIterable");const c=(o=e.assumption("skipForOfIteratorClosing"))!=null?o:t.loose;if(i&&l){throw new Error(`The "iterableIsArray" and "arrayLikeIsIterable" assumptions are not compatible.`)}if(i){return{name:"transform-for-of",visitor:{ForOfStatement(e){const{scope:t}=e;const{left:r,right:s,await:n}=e.node;if(n){return}const o=t.generateUidIdentifier("i");let i=t.maybeGenerateMemoised(s,true);const l=[a.types.variableDeclarator(o,a.types.numericLiteral(0))];if(i){l.push(a.types.variableDeclarator(i,s))}else{i=s}const c=a.types.memberExpression(a.types.cloneNode(i),a.types.cloneNode(o),true);let u;if(a.types.isVariableDeclaration(r)){u=r;u.declarations[0].init=c}else{u=a.types.expressionStatement(a.types.assignmentExpression("=",r,c))}let p;const f=e.get("body");if(f.isBlockStatement()&&Object.keys(e.getBindingIdentifiers()).some((e=>f.scope.hasOwnBinding(e)))){p=a.types.blockStatement([u,f.node])}else{p=a.types.toBlock(f.node);p.body.unshift(u)}e.replaceWith(a.types.forStatement(a.types.variableDeclaration("let",l),a.types.binaryExpression("<",a.types.cloneNode(o),a.types.memberExpression(a.types.cloneNode(i),a.types.identifier("length"))),a.types.updateExpression("++",a.types.cloneNode(o)),p))}}}}const u=(0,a.template)` for (var KEY = 0, NAME = ARR; KEY < NAME.length; KEY++) BODY; `;const p=a.template.statements` for (var ITERATOR_HELPER = CREATE_ITERATOR_HELPER(OBJECT, ARRAY_LIKE_IS_ITERABLE), STEP_KEY; !(STEP_KEY = ITERATOR_HELPER()).done;) BODY; - `;const d=a.template.statements` + `;const f=a.template.statements` var ITERATOR_HELPER = CREATE_ITERATOR_HELPER(OBJECT, ARRAY_LIKE_IS_ITERABLE), STEP_KEY; try { for (ITERATOR_HELPER.s(); !(STEP_KEY = ITERATOR_HELPER.n()).done;) BODY; @@ -164,14 +89,14 @@ } finally { ITERATOR_HELPER.f(); } - `;const f=c?{build:p,helper:"createForOfIteratorHelperLoose",getContainer:e=>e}:{build:d,helper:"createForOfIteratorHelper",getContainer:e=>e[1].block.body};function _ForOfStatementArray(e){const{node:t,scope:r}=e;const s=r.generateUidIdentifierBasedOnNode(t.right,"arr");const n=r.generateUidIdentifier("i");const o=u({BODY:t.body,KEY:n,NAME:s,ARR:t.right});a.types.inherits(o,t);a.types.ensureBlock(o);const i=a.types.memberExpression(a.types.cloneNode(s),a.types.cloneNode(n),true);const l=t.left;if(a.types.isVariableDeclaration(l)){l.declarations[0].init=i;o.body.body.unshift(l)}else{o.body.body.unshift(a.types.expressionStatement(a.types.assignmentExpression("=",l,i)))}return o}return{name:"transform-for-of",visitor:{ForOfStatement(e,t){const r=e.get("right");if(r.isArrayExpression()||r.isGenericType("Array")||a.types.isArrayTypeAnnotation(r.getTypeAnnotation())){e.replaceWith(_ForOfStatementArray(e));return}if(!t.availableHelper(f.helper)){(0,n.default)(c,e,t);return}const{node:s,parent:o,scope:i}=e;const u=s.left;let p;const d=i.generateUid("step");const m=a.types.memberExpression(a.types.identifier(d),a.types.identifier("value"));if(a.types.isVariableDeclaration(u)){p=a.types.variableDeclaration(u.kind,[a.types.variableDeclarator(u.declarations[0].id,m)])}else{p=a.types.expressionStatement(a.types.assignmentExpression("=",u,m))}e.ensureBlock();s.body.body.unshift(p);const y=f.build({CREATE_ITERATOR_HELPER:t.addHelper(f.helper),ITERATOR_HELPER:i.generateUidIdentifier("iterator"),ARRAY_LIKE_IS_ITERABLE:l?a.types.booleanLiteral(true):null,STEP_KEY:a.types.identifier(d),OBJECT:s.right,BODY:s.body});const g=f.getContainer(y);a.types.inherits(g[0],s);a.types.inherits(g[0].body,s.body);if(a.types.isLabeledStatement(o)){g[0]=a.types.labeledStatement(o.label,g[0]);e.parentPath.replaceWithMultiple(y);e.skip()}else{e.replaceWithMultiple(y)}}}}}));t["default"]=o},8591:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transformWithoutHelper;var s=r(8304);function transformWithoutHelper(e,t,r){const a=e?pushComputedPropsLoose:pushComputedPropsSpec;const{node:n}=t;const o=a(t,r);const i=o.declar;const l=o.loop;const c=l.body;t.ensureBlock();if(i){c.body.push(i)}c.body=c.body.concat(n.body.body);s.types.inherits(l,n);s.types.inherits(l.body,n.body);if(o.replaceParent){t.parentPath.replaceWithMultiple(o.node);t.remove()}else{t.replaceWithMultiple(o.node)}}const a=(0,s.template)(`\n for (var LOOP_OBJECT = OBJECT,\n IS_ARRAY = Array.isArray(LOOP_OBJECT),\n INDEX = 0,\n LOOP_OBJECT = IS_ARRAY ? LOOP_OBJECT : LOOP_OBJECT[Symbol.iterator]();;) {\n INTERMEDIATE;\n if (IS_ARRAY) {\n if (INDEX >= LOOP_OBJECT.length) break;\n ID = LOOP_OBJECT[INDEX++];\n } else {\n INDEX = LOOP_OBJECT.next();\n if (INDEX.done) break;\n ID = INDEX.value;\n }\n }\n`);const n=(0,s.template)(`\n var ITERATOR_COMPLETION = true;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY = undefined;\n try {\n for (\n var ITERATOR_KEY = OBJECT[Symbol.iterator](), STEP_KEY;\n !(ITERATOR_COMPLETION = (STEP_KEY = ITERATOR_KEY.next()).done);\n ITERATOR_COMPLETION = true\n ) {}\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (!ITERATOR_COMPLETION && ITERATOR_KEY.return != null) {\n ITERATOR_KEY.return();\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n`);function pushComputedPropsLoose(e,t){const{node:r,scope:n,parent:o}=e;const{left:i}=r;let l,c,u;if(s.types.isIdentifier(i)||s.types.isPattern(i)||s.types.isMemberExpression(i)){c=i;u=null}else if(s.types.isVariableDeclaration(i)){c=n.generateUidIdentifier("ref");l=s.types.variableDeclaration(i.kind,[s.types.variableDeclarator(i.declarations[0].id,s.types.identifier(c.name))]);u=s.types.variableDeclaration("var",[s.types.variableDeclarator(s.types.identifier(c.name))])}else{throw t.buildCodeFrameError(i,`Unknown node type ${i.type} in ForStatement`)}const p=n.generateUidIdentifier("iterator");const d=n.generateUidIdentifier("isArray");const f=a({LOOP_OBJECT:p,IS_ARRAY:d,OBJECT:r.right,INDEX:n.generateUidIdentifier("i"),ID:c,INTERMEDIATE:u});const m=s.types.isLabeledStatement(o);let y;if(m){y=s.types.labeledStatement(o.label,f)}return{replaceParent:m,declar:l,node:y||f,loop:f}}function pushComputedPropsSpec(e,t){const{node:r,scope:a,parent:o}=e;const i=r.left;let l;const c=a.generateUid("step");const u=s.types.memberExpression(s.types.identifier(c),s.types.identifier("value"));if(s.types.isIdentifier(i)||s.types.isPattern(i)||s.types.isMemberExpression(i)){l=s.types.expressionStatement(s.types.assignmentExpression("=",i,u))}else if(s.types.isVariableDeclaration(i)){l=s.types.variableDeclaration(i.kind,[s.types.variableDeclarator(i.declarations[0].id,u)])}else{throw t.buildCodeFrameError(i,`Unknown node type ${i.type} in ForStatement`)}const p=n({ITERATOR_HAD_ERROR_KEY:a.generateUidIdentifier("didIteratorError"),ITERATOR_COMPLETION:a.generateUidIdentifier("iteratorNormalCompletion"),ITERATOR_ERROR_KEY:a.generateUidIdentifier("iteratorError"),ITERATOR_KEY:a.generateUidIdentifier("iterator"),STEP_KEY:s.types.identifier(c),OBJECT:r.right});const d=s.types.isLabeledStatement(o);const f=p[3].block.body;const m=f[0];if(d){f[0]=s.types.labeledStatement(o.label,m)}return{replaceParent:d,declar:l,loop:m,node:p}}},2388:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},715:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8566);var a=r(550);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-function-name",visitor:{FunctionExpression:{exit(e){if(e.key!=="value"&&!e.parentPath.isObjectProperty()){const t=(0,a.default)(e);if(t)e.replaceWith(t)}}},ObjectProperty(e){const t=e.get("value");if(t.isFunction()){const e=(0,a.default)(t);if(e)t.replaceWith(e)}}}}}));t["default"]=n},8566:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5072:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(5968);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-literals",visitor:{NumericLiteral({node:e}){if(e.extra&&/^0[ob]/i.test(e.extra.raw)){e.extra=undefined}},StringLiteral({node:e}){if(e.extra&&/\\[u]/gi.test(e.extra.raw)){e.extra=undefined}}}}}));t["default"]=a},5968:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},4674:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(1483);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-member-expression-literals",visitor:{MemberExpression:{exit({node:e}){const t=e.property;if(!e.computed&&a.types.isIdentifier(t)&&!a.types.isValidES3Identifier(t.name)){e.property=a.types.stringLiteral(t.name);e.computed=true}}}}}}));t["default"]=n},1483:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8657:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(1380);var a=r(9207);var n=r(8304);var o=r(7047);const i=(0,n.template)(`\n define(MODULE_NAME, AMD_ARGUMENTS, function(IMPORT_NAMES) {\n })\n`);const l=(0,n.template)(`\n define(["require"], function(REQUIRE) {\n })\n`);function injectWrapper(e,t){const{body:r,directives:s}=e.node;e.node.directives=[];e.node.body=[];const a=e.pushContainer("body",t)[0];const n=a.get("expression.arguments").filter((e=>e.isFunctionExpression()))[0].get("body");n.pushContainer("directives",s);n.pushContainer("body",r)}var c=(0,s.declare)(((e,t)=>{var r,s;e.assertVersion(7);const{allowTopLevelThis:c,strict:u,strictMode:p,importInterop:d,noInterop:f}=t;const m=(r=e.assumption("constantReexports"))!=null?r:t.loose;const y=(s=e.assumption("enumerableModuleMeta"))!=null?s:t.loose;return{name:"transform-modules-amd",pre(){this.file.set("@babel/plugin-transform-modules-*","amd")},visitor:{CallExpression(e,t){if(!this.file.has("@babel/plugin-proposal-dynamic-import"))return;if(!e.get("callee").isImport())return;let{requireId:r,resolveId:s,rejectId:i}=t;if(!r){r=e.scope.generateUidIdentifier("require");t.requireId=r}if(!s||!i){s=e.scope.generateUidIdentifier("resolve");i=e.scope.generateUidIdentifier("reject");t.resolveId=s;t.rejectId=i}let l=n.types.identifier("imported");if(!f)l=(0,a.wrapInterop)(e,l,"namespace");e.replaceWith(n.template.expression.ast` + `;const d=c?{build:p,helper:"createForOfIteratorHelperLoose",getContainer:e=>e}:{build:f,helper:"createForOfIteratorHelper",getContainer:e=>e[1].block.body};function _ForOfStatementArray(e){const{node:t,scope:r}=e;const s=r.generateUidIdentifierBasedOnNode(t.right,"arr");const n=r.generateUidIdentifier("i");const o=u({BODY:t.body,KEY:n,NAME:s,ARR:t.right});a.types.inherits(o,t);a.types.ensureBlock(o);const i=a.types.memberExpression(a.types.cloneNode(s),a.types.cloneNode(n),true);const l=t.left;if(a.types.isVariableDeclaration(l)){l.declarations[0].init=i;o.body.body.unshift(l)}else{o.body.body.unshift(a.types.expressionStatement(a.types.assignmentExpression("=",l,i)))}return o}return{name:"transform-for-of",visitor:{ForOfStatement(e,t){const r=e.get("right");if(r.isArrayExpression()||r.isGenericType("Array")||a.types.isArrayTypeAnnotation(r.getTypeAnnotation())){e.replaceWith(_ForOfStatementArray(e));return}if(!t.availableHelper(d.helper)){(0,n.default)(c,e,t);return}const{node:s,parent:o,scope:i}=e;const u=s.left;let p;const f=i.generateUid("step");const m=a.types.memberExpression(a.types.identifier(f),a.types.identifier("value"));if(a.types.isVariableDeclaration(u)){p=a.types.variableDeclaration(u.kind,[a.types.variableDeclarator(u.declarations[0].id,m)])}else{p=a.types.expressionStatement(a.types.assignmentExpression("=",u,m))}e.ensureBlock();s.body.body.unshift(p);const y=d.build({CREATE_ITERATOR_HELPER:t.addHelper(d.helper),ITERATOR_HELPER:i.generateUidIdentifier("iterator"),ARRAY_LIKE_IS_ITERABLE:l?a.types.booleanLiteral(true):null,STEP_KEY:a.types.identifier(f),OBJECT:s.right,BODY:s.body});const g=d.getContainer(y);a.types.inherits(g[0],s);a.types.inherits(g[0].body,s.body);if(a.types.isLabeledStatement(o)){g[0]=a.types.labeledStatement(o.label,g[0]);e.parentPath.replaceWithMultiple(y);e.skip()}else{e.replaceWithMultiple(y)}}}}}));t["default"]=o},8591:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transformWithoutHelper;var s=r(8304);function transformWithoutHelper(e,t,r){const a=e?pushComputedPropsLoose:pushComputedPropsSpec;const{node:n}=t;const o=a(t,r);const i=o.declar;const l=o.loop;const c=l.body;t.ensureBlock();if(i){c.body.push(i)}c.body=c.body.concat(n.body.body);s.types.inherits(l,n);s.types.inherits(l.body,n.body);if(o.replaceParent){t.parentPath.replaceWithMultiple(o.node);t.remove()}else{t.replaceWithMultiple(o.node)}}const a=(0,s.template)(`\n for (var LOOP_OBJECT = OBJECT,\n IS_ARRAY = Array.isArray(LOOP_OBJECT),\n INDEX = 0,\n LOOP_OBJECT = IS_ARRAY ? LOOP_OBJECT : LOOP_OBJECT[Symbol.iterator]();;) {\n INTERMEDIATE;\n if (IS_ARRAY) {\n if (INDEX >= LOOP_OBJECT.length) break;\n ID = LOOP_OBJECT[INDEX++];\n } else {\n INDEX = LOOP_OBJECT.next();\n if (INDEX.done) break;\n ID = INDEX.value;\n }\n }\n`);const n=(0,s.template)(`\n var ITERATOR_COMPLETION = true;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY = undefined;\n try {\n for (\n var ITERATOR_KEY = OBJECT[Symbol.iterator](), STEP_KEY;\n !(ITERATOR_COMPLETION = (STEP_KEY = ITERATOR_KEY.next()).done);\n ITERATOR_COMPLETION = true\n ) {}\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (!ITERATOR_COMPLETION && ITERATOR_KEY.return != null) {\n ITERATOR_KEY.return();\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n`);function pushComputedPropsLoose(e,t){const{node:r,scope:n,parent:o}=e;const{left:i}=r;let l,c,u;if(s.types.isIdentifier(i)||s.types.isPattern(i)||s.types.isMemberExpression(i)){c=i;u=null}else if(s.types.isVariableDeclaration(i)){c=n.generateUidIdentifier("ref");l=s.types.variableDeclaration(i.kind,[s.types.variableDeclarator(i.declarations[0].id,s.types.identifier(c.name))]);u=s.types.variableDeclaration("var",[s.types.variableDeclarator(s.types.identifier(c.name))])}else{throw t.buildCodeFrameError(i,`Unknown node type ${i.type} in ForStatement`)}const p=n.generateUidIdentifier("iterator");const f=n.generateUidIdentifier("isArray");const d=a({LOOP_OBJECT:p,IS_ARRAY:f,OBJECT:r.right,INDEX:n.generateUidIdentifier("i"),ID:c,INTERMEDIATE:u});const m=s.types.isLabeledStatement(o);let y;if(m){y=s.types.labeledStatement(o.label,d)}return{replaceParent:m,declar:l,node:y||d,loop:d}}function pushComputedPropsSpec(e,t){const{node:r,scope:a,parent:o}=e;const i=r.left;let l;const c=a.generateUid("step");const u=s.types.memberExpression(s.types.identifier(c),s.types.identifier("value"));if(s.types.isIdentifier(i)||s.types.isPattern(i)||s.types.isMemberExpression(i)){l=s.types.expressionStatement(s.types.assignmentExpression("=",i,u))}else if(s.types.isVariableDeclaration(i)){l=s.types.variableDeclaration(i.kind,[s.types.variableDeclarator(i.declarations[0].id,u)])}else{throw t.buildCodeFrameError(i,`Unknown node type ${i.type} in ForStatement`)}const p=n({ITERATOR_HAD_ERROR_KEY:a.generateUidIdentifier("didIteratorError"),ITERATOR_COMPLETION:a.generateUidIdentifier("iteratorNormalCompletion"),ITERATOR_ERROR_KEY:a.generateUidIdentifier("iteratorError"),ITERATOR_KEY:a.generateUidIdentifier("iterator"),STEP_KEY:s.types.identifier(c),OBJECT:r.right});const f=s.types.isLabeledStatement(o);const d=p[3].block.body;const m=d[0];if(f){d[0]=s.types.labeledStatement(o.label,m)}return{replaceParent:f,declar:l,loop:m,node:p}}},2388:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},715:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8566);var a=r(550);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-function-name",visitor:{FunctionExpression:{exit(e){if(e.key!=="value"&&!e.parentPath.isObjectProperty()){const t=(0,a.default)(e);if(t)e.replaceWith(t)}}},ObjectProperty(e){const t=e.get("value");if(t.isFunction()){const e=(0,a.default)(t);if(e)t.replaceWith(e)}}}}}));t["default"]=n},8566:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5072:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(5968);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-literals",visitor:{NumericLiteral({node:e}){if(e.extra&&/^0[ob]/i.test(e.extra.raw)){e.extra=undefined}},StringLiteral({node:e}){if(e.extra&&/\\[u]/gi.test(e.extra.raw)){e.extra=undefined}}}}}));t["default"]=a},5968:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},4674:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(1483);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-member-expression-literals",visitor:{MemberExpression:{exit({node:e}){const t=e.property;if(!e.computed&&a.types.isIdentifier(t)&&!a.types.isValidES3Identifier(t.name)){e.property=a.types.stringLiteral(t.name);e.computed=true}}}}}}));t["default"]=n},1483:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8657:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(1380);var a=r(9207);var n=r(8304);var o=r(7047);const i=(0,n.template)(`\n define(MODULE_NAME, AMD_ARGUMENTS, function(IMPORT_NAMES) {\n })\n`);const l=(0,n.template)(`\n define(["require"], function(REQUIRE) {\n })\n`);function injectWrapper(e,t){const{body:r,directives:s}=e.node;e.node.directives=[];e.node.body=[];const a=e.pushContainer("body",t)[0];const n=a.get("expression.arguments").filter((e=>e.isFunctionExpression()))[0].get("body");n.pushContainer("directives",s);n.pushContainer("body",r)}var c=(0,s.declare)(((e,t)=>{var r,s;e.assertVersion(7);const{allowTopLevelThis:c,strict:u,strictMode:p,importInterop:f,noInterop:d}=t;const m=(r=e.assumption("constantReexports"))!=null?r:t.loose;const y=(s=e.assumption("enumerableModuleMeta"))!=null?s:t.loose;return{name:"transform-modules-amd",pre(){this.file.set("@babel/plugin-transform-modules-*","amd")},visitor:{CallExpression(e,t){if(!this.file.has("@babel/plugin-proposal-dynamic-import"))return;if(!e.get("callee").isImport())return;let{requireId:r,resolveId:s,rejectId:i}=t;if(!r){r=e.scope.generateUidIdentifier("require");t.requireId=r}if(!s||!i){s=e.scope.generateUidIdentifier("resolve");i=e.scope.generateUidIdentifier("reject");t.resolveId=s;t.rejectId=i}let l=n.types.identifier("imported");if(!d)l=(0,a.wrapInterop)(e,l,"namespace");e.replaceWith(n.template.expression.ast` new Promise((${s}, ${i}) => ${r}( [${(0,o.getImportSource)(n.types,e.node)}], imported => ${n.types.cloneNode(s)}(${l}), ${n.types.cloneNode(i)} ) - )`)},Program:{exit(e,{requireId:r}){if(!(0,a.isModule)(e)){if(r){injectWrapper(e,l({REQUIRE:n.types.cloneNode(r)}))}return}const s=[];const o=[];if(r){s.push(n.types.stringLiteral("require"));o.push(n.types.cloneNode(r))}let g=(0,a.getModuleName)(this.file.opts,t);if(g)g=n.types.stringLiteral(g);const{meta:h,headers:b}=(0,a.rewriteModuleStatementsAndPrepareHeader)(e,{enumerableModuleMeta:y,constantReexports:m,strict:u,strictMode:p,allowTopLevelThis:c,importInterop:d,noInterop:f});if((0,a.hasExports)(h)){s.push(n.types.stringLiteral("exports"));o.push(n.types.identifier(h.exportName))}for(const[t,r]of h.source){s.push(n.types.stringLiteral(t));o.push(n.types.identifier(r.name));if(!(0,a.isSideEffectImport)(r)){const t=(0,a.wrapInterop)(e,n.types.identifier(r.name),r.interop);if(t){const e=n.types.expressionStatement(n.types.assignmentExpression("=",n.types.identifier(r.name),t));e.loc=r.loc;b.push(e)}}b.push(...(0,a.buildNamespaceInitStatements)(h,r,m))}(0,a.ensureStatementsHoisted)(b);e.unshiftContainer("body",b);injectWrapper(e,i({MODULE_NAME:g,AMD_ARGUMENTS:n.types.arrayExpression(s),IMPORT_NAMES:o}))}}}}}));t["default"]=c},3096:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=getModuleName;{const e=getModuleName;t["default"]=getModuleName=function getModuleName(t,r){var s,a,n,o;return e(t,{moduleId:(s=r.moduleId)!=null?s:t.moduleId,moduleIds:(a=r.moduleIds)!=null?a:t.moduleIds,getModuleId:(n=r.getModuleId)!=null?n:t.getModuleId,moduleRoot:(o=r.moduleRoot)!=null?o:t.moduleRoot})}}function getModuleName(e,t){const{filename:r,filenameRelative:s=r,sourceRoot:a=t.moduleRoot}=e;const{moduleId:n,moduleIds:o=!!n,getModuleId:i,moduleRoot:l=a}=t;if(!o)return null;if(n!=null&&!i){return n}let c=l!=null?l+"/":"";if(s){const e=a!=null?new RegExp("^"+a+"/?"):"";c+=s.replace(e,"").replace(/\.(\w*?)$/,"")}c=c.replace(/\\/g,"/");if(i){return i(c)||c}else{return c}}},9207:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.rewriteModuleStatementsAndPrepareHeader=rewriteModuleStatementsAndPrepareHeader;t.ensureStatementsHoisted=ensureStatementsHoisted;t.wrapInterop=wrapInterop;t.buildNamespaceInitStatements=buildNamespaceInitStatements;Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return o.isModule}});Object.defineProperty(t,"rewriteThis",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"hasExports",{enumerable:true,get:function(){return c.hasExports}});Object.defineProperty(t,"isSideEffectImport",{enumerable:true,get:function(){return c.isSideEffectImport}});Object.defineProperty(t,"getModuleName",{enumerable:true,get:function(){return u.default}});var s=r(9491);var a=r(8622);var n=r(153);var o=r(6039);var i=r(9736);var l=r(4025);var c=r(9152);var u=r(3096);function rewriteModuleStatementsAndPrepareHeader(e,{loose:t,exportName:r,strict:n,allowTopLevelThis:u,strictMode:p,noInterop:d,importInterop:f=(d?"none":"babel"),lazy:m,esNamespaceOnly:y,constantReexports:g=t,enumerableModuleMeta:h=t}){(0,c.validateImportInteropOption)(f);s((0,o.isModule)(e),"Cannot process module statements in a script");e.node.sourceType="script";const b=(0,c.default)(e,r,{importInterop:f,initializeReexports:g,lazy:m,esNamespaceOnly:y});if(!u){(0,i.default)(e)}(0,l.default)(e,b);if(p!==false){const t=e.node.directives.some((e=>e.value.value==="use strict"));if(!t){e.unshiftContainer("directives",a.directive(a.directiveLiteral("use strict")))}}const x=[];if((0,c.hasExports)(b)&&!n){x.push(buildESModuleHeader(b,h))}const v=buildExportNameListDeclaration(e,b);if(v){b.exportNameListName=v.name;x.push(v.statement)}x.push(...buildExportInitializationStatements(e,b,g));return{meta:b,headers:x}}function ensureStatementsHoisted(e){e.forEach((e=>{e._blockHoist=3}))}function wrapInterop(e,t,r){if(r==="none"){return null}if(r==="node-namespace"){return a.callExpression(e.hub.addHelper("interopRequireWildcard"),[t,a.booleanLiteral(true)])}else if(r==="node-default"){return null}let s;if(r==="default"){s="interopRequireDefault"}else if(r==="namespace"){s="interopRequireWildcard"}else{throw new Error(`Unknown interop: ${r}`)}return a.callExpression(e.hub.addHelper(s),[t])}function buildNamespaceInitStatements(e,t,r=false){const s=[];let o=a.identifier(t.name);if(t.lazy)o=a.callExpression(o,[]);for(const e of t.importsNamespace){if(e===t.name)continue;s.push(n.default.statement`var NAME = SOURCE;`({NAME:e,SOURCE:a.cloneNode(o)}))}if(r){s.push(...buildReexportsFromMeta(e,t,true))}for(const r of t.reexportNamespace){s.push((t.lazy?n.default.statement` + )`)},Program:{exit(e,{requireId:r}){if(!(0,a.isModule)(e)){if(r){injectWrapper(e,l({REQUIRE:n.types.cloneNode(r)}))}return}const s=[];const o=[];if(r){s.push(n.types.stringLiteral("require"));o.push(n.types.cloneNode(r))}let g=(0,a.getModuleName)(this.file.opts,t);if(g)g=n.types.stringLiteral(g);const{meta:h,headers:b}=(0,a.rewriteModuleStatementsAndPrepareHeader)(e,{enumerableModuleMeta:y,constantReexports:m,strict:u,strictMode:p,allowTopLevelThis:c,importInterop:f,noInterop:d});if((0,a.hasExports)(h)){s.push(n.types.stringLiteral("exports"));o.push(n.types.identifier(h.exportName))}for(const[t,r]of h.source){s.push(n.types.stringLiteral(t));o.push(n.types.identifier(r.name));if(!(0,a.isSideEffectImport)(r)){const t=(0,a.wrapInterop)(e,n.types.identifier(r.name),r.interop);if(t){const e=n.types.expressionStatement(n.types.assignmentExpression("=",n.types.identifier(r.name),t));e.loc=r.loc;b.push(e)}}b.push(...(0,a.buildNamespaceInitStatements)(h,r,m))}(0,a.ensureStatementsHoisted)(b);e.unshiftContainer("body",b);injectWrapper(e,i({MODULE_NAME:g,AMD_ARGUMENTS:n.types.arrayExpression(s),IMPORT_NAMES:o}))}}}}}));t["default"]=c},3096:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=getModuleName;{const e=getModuleName;t["default"]=getModuleName=function getModuleName(t,r){var s,a,n,o;return e(t,{moduleId:(s=r.moduleId)!=null?s:t.moduleId,moduleIds:(a=r.moduleIds)!=null?a:t.moduleIds,getModuleId:(n=r.getModuleId)!=null?n:t.getModuleId,moduleRoot:(o=r.moduleRoot)!=null?o:t.moduleRoot})}}function getModuleName(e,t){const{filename:r,filenameRelative:s=r,sourceRoot:a=t.moduleRoot}=e;const{moduleId:n,moduleIds:o=!!n,getModuleId:i,moduleRoot:l=a}=t;if(!o)return null;if(n!=null&&!i){return n}let c=l!=null?l+"/":"";if(s){const e=a!=null?new RegExp("^"+a+"/?"):"";c+=s.replace(e,"").replace(/\.(\w*?)$/,"")}c=c.replace(/\\/g,"/");if(i){return i(c)||c}else{return c}}},9207:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.rewriteModuleStatementsAndPrepareHeader=rewriteModuleStatementsAndPrepareHeader;t.ensureStatementsHoisted=ensureStatementsHoisted;t.wrapInterop=wrapInterop;t.buildNamespaceInitStatements=buildNamespaceInitStatements;Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return o.isModule}});Object.defineProperty(t,"rewriteThis",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"hasExports",{enumerable:true,get:function(){return c.hasExports}});Object.defineProperty(t,"isSideEffectImport",{enumerable:true,get:function(){return c.isSideEffectImport}});Object.defineProperty(t,"getModuleName",{enumerable:true,get:function(){return u.default}});var s=r(9491);var a=r(8622);var n=r(153);var o=r(9115);var i=r(9736);var l=r(4025);var c=r(9152);var u=r(3096);function rewriteModuleStatementsAndPrepareHeader(e,{loose:t,exportName:r,strict:n,allowTopLevelThis:u,strictMode:p,noInterop:f,importInterop:d=(f?"none":"babel"),lazy:m,esNamespaceOnly:y,constantReexports:g=t,enumerableModuleMeta:h=t}){(0,c.validateImportInteropOption)(d);s((0,o.isModule)(e),"Cannot process module statements in a script");e.node.sourceType="script";const b=(0,c.default)(e,r,{importInterop:d,initializeReexports:g,lazy:m,esNamespaceOnly:y});if(!u){(0,i.default)(e)}(0,l.default)(e,b);if(p!==false){const t=e.node.directives.some((e=>e.value.value==="use strict"));if(!t){e.unshiftContainer("directives",a.directive(a.directiveLiteral("use strict")))}}const x=[];if((0,c.hasExports)(b)&&!n){x.push(buildESModuleHeader(b,h))}const v=buildExportNameListDeclaration(e,b);if(v){b.exportNameListName=v.name;x.push(v.statement)}x.push(...buildExportInitializationStatements(e,b,g));return{meta:b,headers:x}}function ensureStatementsHoisted(e){e.forEach((e=>{e._blockHoist=3}))}function wrapInterop(e,t,r){if(r==="none"){return null}if(r==="node-namespace"){return a.callExpression(e.hub.addHelper("interopRequireWildcard"),[t,a.booleanLiteral(true)])}else if(r==="node-default"){return null}let s;if(r==="default"){s="interopRequireDefault"}else if(r==="namespace"){s="interopRequireWildcard"}else{throw new Error(`Unknown interop: ${r}`)}return a.callExpression(e.hub.addHelper(s),[t])}function buildNamespaceInitStatements(e,t,r=false){const s=[];let o=a.identifier(t.name);if(t.lazy)o=a.callExpression(o,[]);for(const e of t.importsNamespace){if(e===t.name)continue;s.push(n.default.statement`var NAME = SOURCE;`({NAME:e,SOURCE:a.cloneNode(o)}))}if(r){s.push(...buildReexportsFromMeta(e,t,true))}for(const r of t.reexportNamespace){s.push((t.lazy?n.default.statement` Object.defineProperty(EXPORTS, "NAME", { enumerable: true, get: function() { @@ -214,18 +139,18 @@ }); `)({NAMESPACE:t,EXPORTS:e.exportName,VERIFY_NAME_LIST:e.exportNameListName?(0,n.default)` if (Object.prototype.hasOwnProperty.call(EXPORTS_LIST, key)) return; - `({EXPORTS_LIST:e.exportNameListName}):null})}function buildExportNameListDeclaration(e,t){const r=Object.create(null);for(const e of t.local.values()){for(const t of e.names){r[t]=true}}let s=false;for(const e of t.source.values()){for(const t of e.reexports.keys()){r[t]=true}for(const t of e.reexportNamespace){r[t]=true}s=s||!!e.reexportAll}if(!s||Object.keys(r).length===0)return null;const n=e.scope.generateUidIdentifier("exportNames");delete r.default;return{name:n.name,statement:a.variableDeclaration("var",[a.variableDeclarator(n,a.valueToNode(r))])}}function buildExportInitializationStatements(e,t,r=false){const s=[];const n=[];for(const[e,r]of t.local){if(r.kind==="import"){}else if(r.kind==="hoisted"){s.push(buildInitStatement(t,r.names,a.identifier(e)))}else{n.push(...r.names)}}for(const e of t.source.values()){if(!r){s.push(...buildReexportsFromMeta(t,e,false))}for(const t of e.reexportNamespace){n.push(t)}}s.push(...chunk(n,100).map((r=>buildInitStatement(t,r,e.scope.buildUndefinedNode()))));return s}const d={computed:n.default.expression`EXPORTS["NAME"] = VALUE`,default:n.default.expression`EXPORTS.NAME = VALUE`};function buildInitStatement(e,t,r){const{stringSpecifiers:s,exportName:n}=e;return a.expressionStatement(t.reduce(((e,t)=>{const r={EXPORTS:n,NAME:t,VALUE:e};if(s.has(t)){return d.computed(r)}else{return d.default(r)}}),r))}function chunk(e,t){const r=[];for(let s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasExports=hasExports;t.isSideEffectImport=isSideEffectImport;t.validateImportInteropOption=validateImportInteropOption;t["default"]=normalizeModuleAndLoadMetadata;var s=r(1017);var a=r(6290);var n=r(7058);function hasExports(e){return e.hasExports}function isSideEffectImport(e){return e.imports.size===0&&e.importsNamespace.size===0&&e.reexports.size===0&&e.reexportNamespace.size===0&&!e.reexportAll}function validateImportInteropOption(e){if(typeof e!=="function"&&e!=="none"&&e!=="babel"&&e!=="node"){throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${e}).`)}return e}function resolveImportInterop(e,t){if(typeof e==="function"){return validateImportInteropOption(e(t))}return e}function normalizeModuleAndLoadMetadata(e,t,{importInterop:r,initializeReexports:s=false,lazy:a=false,esNamespaceOnly:n=false}){if(!t){t=e.scope.generateUidIdentifier("exports").name}const o=new Set;nameAnonymousExports(e);const{local:i,source:l,hasExports:c}=getModuleMetadata(e,{initializeReexports:s,lazy:a},o);removeModuleDeclarations(e);for(const[,e]of l){if(e.importsNamespace.size>0){e.name=e.importsNamespace.values().next().value}const t=resolveImportInterop(r,e.source);if(t==="none"){e.interop="none"}else if(t==="node"&&e.interop==="namespace"){e.interop="node-namespace"}else if(t==="node"&&e.interop==="default"){e.interop="node-default"}else if(n&&e.interop==="namespace"){e.interop="default"}}return{exportName:t,exportNameListName:null,hasExports:c,local:i,source:l,stringSpecifiers:o}}function getExportSpecifierName(e,t){if(e.isIdentifier()){return e.node.name}else if(e.isStringLiteral()){const r=e.node.value;if(!(0,a.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.node.type}`)}}function assertExportSpecifier(e){if(e.isExportSpecifier()){return}else if(e.isExportNamespaceSpecifier()){throw e.buildCodeFrameError("Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.")}else{throw e.buildCodeFrameError("Unexpected export specifier type")}}function getModuleMetadata(e,{lazy:t,initializeReexports:r},a){const n=getLocalExportMetadata(e,r,a);const o=new Map;const getData=t=>{const r=t.value;let a=o.get(r);if(!a){a={name:e.scope.generateUidIdentifier((0,s.basename)(r,(0,s.extname)(r))).name,interop:"none",loc:null,imports:new Map,importsNamespace:new Set,reexports:new Map,reexportNamespace:new Set,reexportAll:null,lazy:false,source:r};o.set(r,a)}return a};let i=false;e.get("body").forEach((e=>{if(e.isImportDeclaration()){const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{if(e.isImportDefaultSpecifier()){const r=e.get("local").node.name;t.imports.set(r,"default");const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexports.set(e,"default")}))}}else if(e.isImportNamespaceSpecifier()){const r=e.get("local").node.name;t.importsNamespace.add(r);const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexportNamespace.add(e)}))}}else if(e.isImportSpecifier()){const r=getExportSpecifierName(e.get("imported"),a);const s=e.get("local").node.name;t.imports.set(s,r);const o=n.get(s);if(o){n.delete(s);o.names.forEach((e=>{t.reexports.set(e,r)}))}}}))}else if(e.isExportAllDeclaration()){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;t.reexportAll={loc:e.node.loc}}else if(e.isExportNamedDeclaration()&&e.node.source){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{assertExportSpecifier(e);const r=getExportSpecifierName(e.get("local"),a);const s=getExportSpecifierName(e.get("exported"),a);t.reexports.set(s,r);if(s==="__esModule"){throw e.get("exported").buildCodeFrameError('Illegal export "__esModule".')}}))}else if(e.isExportNamedDeclaration()||e.isExportDefaultDeclaration()){i=true}}));for(const e of o.values()){let t=false;let r=false;if(e.importsNamespace.size>0){t=true;r=true}if(e.reexportAll){r=true}for(const s of e.imports.values()){if(s==="default")t=true;else r=true}for(const s of e.reexports.values()){if(s==="default")t=true;else r=true}if(t&&r){e.interop="namespace"}else if(t){e.interop="default"}}for(const[e,r]of o){if(t!==false&&!(isSideEffectImport(r)||r.reexportAll)){if(t===true){r.lazy=!/\./.test(e)}else if(Array.isArray(t)){r.lazy=t.indexOf(e)!==-1}else if(typeof t==="function"){r.lazy=t(e)}else{throw new Error(`.lazy must be a boolean, string array, or function`)}}}return{hasExports:i,local:n,source:o}}function getLocalExportMetadata(e,t,r){const s=new Map;e.get("body").forEach((e=>{let r;if(e.isImportDeclaration()){r="import"}else{if(e.isExportDefaultDeclaration())e=e.get("declaration");if(e.isExportNamedDeclaration()){if(e.node.declaration){e=e.get("declaration")}else if(t&&e.node.source&&e.get("source").isStringLiteral()){e.get("specifiers").forEach((e=>{assertExportSpecifier(e);s.set(e.get("local").node.name,"block")}));return}}if(e.isFunctionDeclaration()){r="hoisted"}else if(e.isClassDeclaration()){r="block"}else if(e.isVariableDeclaration({kind:"var"})){r="var"}else if(e.isVariableDeclaration()){r="block"}else{return}}Object.keys(e.getOuterBindingIdentifiers()).forEach((e=>{s.set(e,r)}))}));const a=new Map;const getLocalMetadata=e=>{const t=e.node.name;let r=a.get(t);if(!r){const n=s.get(t);if(n===undefined){throw e.buildCodeFrameError(`Exporting local "${t}", which is not declared.`)}r={names:[],kind:n};a.set(t,r)}return r};e.get("body").forEach((e=>{if(e.isExportNamedDeclaration()&&(t||!e.node.source)){if(e.node.declaration){const t=e.get("declaration");const r=t.getOuterBindingIdentifierPaths();Object.keys(r).forEach((e=>{if(e==="__esModule"){throw t.buildCodeFrameError('Illegal export "__esModule".')}getLocalMetadata(r[e]).names.push(e)}))}else{e.get("specifiers").forEach((e=>{const t=e.get("local");const s=e.get("exported");const a=getLocalMetadata(t);const n=getExportSpecifierName(s,r);if(n==="__esModule"){throw s.buildCodeFrameError('Illegal export "__esModule".')}a.names.push(n)}))}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){getLocalMetadata(t.get("id")).names.push("default")}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}}));return a}function nameAnonymousExports(e){e.get("body").forEach((e=>{if(!e.isExportDefaultDeclaration())return;(0,n.default)(e)}))}function removeModuleDeclarations(e){e.get("body").forEach((e=>{if(e.isImportDeclaration()){e.remove()}else if(e.isExportNamedDeclaration()){if(e.node.declaration){e.node.declaration._blockHoist=e.node._blockHoist;e.replaceWith(e.node.declaration)}else{e.remove()}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){t._blockHoist=e.node._blockHoist;e.replaceWith(t)}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}else if(e.isExportAllDeclaration()){e.remove()}}))}},4025:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteLiveReferences;var s=r(9491);var a=r(8622);var n=r(153);var o=r(3667);function rewriteLiveReferences(e,t){const r=new Map;const s=new Map;const requeueInParent=t=>{e.requeue(t)};for(const[e,s]of t.source){for(const[t,a]of s.imports){r.set(t,[e,a,null])}for(const t of s.importsNamespace){r.set(t,[e,null,t])}}for(const[e,r]of t.local){let t=s.get(e);if(!t){t=[];s.set(e,t)}t.push(...r.names)}const n={metadata:t,requeueInParent:requeueInParent,scope:e.scope,exported:s};e.traverse(i,n);(0,o.default)(e,new Set([...Array.from(r.keys()),...Array.from(s.keys())]));const c={seen:new WeakSet,metadata:t,requeueInParent:requeueInParent,scope:e.scope,imported:r,exported:s,buildImportReference:([e,r,s],n)=>{const o=t.source.get(e);if(s){if(o.lazy)n=a.callExpression(n,[]);return n}let i=a.identifier(o.name);if(o.lazy)i=a.callExpression(i,[]);if(r==="default"&&o.interop==="node-default"){return i}const l=t.stringSpecifiers.has(r);return a.memberExpression(i,l?a.stringLiteral(r):a.identifier(r),l)}};e.traverse(l,c)}const i={Scope(e){e.skip()},ClassDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;const{id:n}=e.node;if(!n)throw new Error("Expected class to have a name");const o=n.name;const i=r.get(o)||[];if(i.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,i,a.identifier(o)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}},VariableDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;Object.keys(e.getOuterBindingIdentifiers()).forEach((n=>{const o=r.get(n)||[];if(o.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,o,a.identifier(n)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}}))}};const buildBindingExportAssignmentExpression=(e,t,r)=>(t||[]).reduce(((t,r)=>{const{stringSpecifiers:s}=e;const n=s.has(r);return a.assignmentExpression("=",a.memberExpression(a.identifier(e.exportName),n?a.stringLiteral(r):a.identifier(r),n),t)}),r);const buildImportThrow=e=>n.default.expression.ast` + `({EXPORTS_LIST:e.exportNameListName}):null})}function buildExportNameListDeclaration(e,t){const r=Object.create(null);for(const e of t.local.values()){for(const t of e.names){r[t]=true}}let s=false;for(const e of t.source.values()){for(const t of e.reexports.keys()){r[t]=true}for(const t of e.reexportNamespace){r[t]=true}s=s||!!e.reexportAll}if(!s||Object.keys(r).length===0)return null;const n=e.scope.generateUidIdentifier("exportNames");delete r.default;return{name:n.name,statement:a.variableDeclaration("var",[a.variableDeclarator(n,a.valueToNode(r))])}}function buildExportInitializationStatements(e,t,r=false){const s=[];const n=[];for(const[e,r]of t.local){if(r.kind==="import"){}else if(r.kind==="hoisted"){s.push(buildInitStatement(t,r.names,a.identifier(e)))}else{n.push(...r.names)}}for(const e of t.source.values()){if(!r){s.push(...buildReexportsFromMeta(t,e,false))}for(const t of e.reexportNamespace){n.push(t)}}s.push(...chunk(n,100).map((r=>buildInitStatement(t,r,e.scope.buildUndefinedNode()))));return s}const f={computed:n.default.expression`EXPORTS["NAME"] = VALUE`,default:n.default.expression`EXPORTS.NAME = VALUE`};function buildInitStatement(e,t,r){const{stringSpecifiers:s,exportName:n}=e;return a.expressionStatement(t.reduce(((e,t)=>{const r={EXPORTS:n,NAME:t,VALUE:e};if(s.has(t)){return f.computed(r)}else{return f.default(r)}}),r))}function chunk(e,t){const r=[];for(let s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasExports=hasExports;t.isSideEffectImport=isSideEffectImport;t.validateImportInteropOption=validateImportInteropOption;t["default"]=normalizeModuleAndLoadMetadata;var s=r(1017);var a=r(6290);var n=r(7058);function hasExports(e){return e.hasExports}function isSideEffectImport(e){return e.imports.size===0&&e.importsNamespace.size===0&&e.reexports.size===0&&e.reexportNamespace.size===0&&!e.reexportAll}function validateImportInteropOption(e){if(typeof e!=="function"&&e!=="none"&&e!=="babel"&&e!=="node"){throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${e}).`)}return e}function resolveImportInterop(e,t){if(typeof e==="function"){return validateImportInteropOption(e(t))}return e}function normalizeModuleAndLoadMetadata(e,t,{importInterop:r,initializeReexports:s=false,lazy:a=false,esNamespaceOnly:n=false}){if(!t){t=e.scope.generateUidIdentifier("exports").name}const o=new Set;nameAnonymousExports(e);const{local:i,source:l,hasExports:c}=getModuleMetadata(e,{initializeReexports:s,lazy:a},o);removeModuleDeclarations(e);for(const[,e]of l){if(e.importsNamespace.size>0){e.name=e.importsNamespace.values().next().value}const t=resolveImportInterop(r,e.source);if(t==="none"){e.interop="none"}else if(t==="node"&&e.interop==="namespace"){e.interop="node-namespace"}else if(t==="node"&&e.interop==="default"){e.interop="node-default"}else if(n&&e.interop==="namespace"){e.interop="default"}}return{exportName:t,exportNameListName:null,hasExports:c,local:i,source:l,stringSpecifiers:o}}function getExportSpecifierName(e,t){if(e.isIdentifier()){return e.node.name}else if(e.isStringLiteral()){const r=e.node.value;if(!(0,a.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.node.type}`)}}function assertExportSpecifier(e){if(e.isExportSpecifier()){return}else if(e.isExportNamespaceSpecifier()){throw e.buildCodeFrameError("Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.")}else{throw e.buildCodeFrameError("Unexpected export specifier type")}}function getModuleMetadata(e,{lazy:t,initializeReexports:r},a){const n=getLocalExportMetadata(e,r,a);const o=new Map;const getData=t=>{const r=t.value;let a=o.get(r);if(!a){a={name:e.scope.generateUidIdentifier((0,s.basename)(r,(0,s.extname)(r))).name,interop:"none",loc:null,imports:new Map,importsNamespace:new Set,reexports:new Map,reexportNamespace:new Set,reexportAll:null,lazy:false,source:r};o.set(r,a)}return a};let i=false;e.get("body").forEach((e=>{if(e.isImportDeclaration()){const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{if(e.isImportDefaultSpecifier()){const r=e.get("local").node.name;t.imports.set(r,"default");const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexports.set(e,"default")}))}}else if(e.isImportNamespaceSpecifier()){const r=e.get("local").node.name;t.importsNamespace.add(r);const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexportNamespace.add(e)}))}}else if(e.isImportSpecifier()){const r=getExportSpecifierName(e.get("imported"),a);const s=e.get("local").node.name;t.imports.set(s,r);const o=n.get(s);if(o){n.delete(s);o.names.forEach((e=>{t.reexports.set(e,r)}))}}}))}else if(e.isExportAllDeclaration()){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;t.reexportAll={loc:e.node.loc}}else if(e.isExportNamedDeclaration()&&e.node.source){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{assertExportSpecifier(e);const r=getExportSpecifierName(e.get("local"),a);const s=getExportSpecifierName(e.get("exported"),a);t.reexports.set(s,r);if(s==="__esModule"){throw e.get("exported").buildCodeFrameError('Illegal export "__esModule".')}}))}else if(e.isExportNamedDeclaration()||e.isExportDefaultDeclaration()){i=true}}));for(const e of o.values()){let t=false;let r=false;if(e.importsNamespace.size>0){t=true;r=true}if(e.reexportAll){r=true}for(const s of e.imports.values()){if(s==="default")t=true;else r=true}for(const s of e.reexports.values()){if(s==="default")t=true;else r=true}if(t&&r){e.interop="namespace"}else if(t){e.interop="default"}}for(const[e,r]of o){if(t!==false&&!(isSideEffectImport(r)||r.reexportAll)){if(t===true){r.lazy=!/\./.test(e)}else if(Array.isArray(t)){r.lazy=t.indexOf(e)!==-1}else if(typeof t==="function"){r.lazy=t(e)}else{throw new Error(`.lazy must be a boolean, string array, or function`)}}}return{hasExports:i,local:n,source:o}}function getLocalExportMetadata(e,t,r){const s=new Map;e.get("body").forEach((e=>{let r;if(e.isImportDeclaration()){r="import"}else{if(e.isExportDefaultDeclaration())e=e.get("declaration");if(e.isExportNamedDeclaration()){if(e.node.declaration){e=e.get("declaration")}else if(t&&e.node.source&&e.get("source").isStringLiteral()){e.get("specifiers").forEach((e=>{assertExportSpecifier(e);s.set(e.get("local").node.name,"block")}));return}}if(e.isFunctionDeclaration()){r="hoisted"}else if(e.isClassDeclaration()){r="block"}else if(e.isVariableDeclaration({kind:"var"})){r="var"}else if(e.isVariableDeclaration()){r="block"}else{return}}Object.keys(e.getOuterBindingIdentifiers()).forEach((e=>{s.set(e,r)}))}));const a=new Map;const getLocalMetadata=e=>{const t=e.node.name;let r=a.get(t);if(!r){const n=s.get(t);if(n===undefined){throw e.buildCodeFrameError(`Exporting local "${t}", which is not declared.`)}r={names:[],kind:n};a.set(t,r)}return r};e.get("body").forEach((e=>{if(e.isExportNamedDeclaration()&&(t||!e.node.source)){if(e.node.declaration){const t=e.get("declaration");const r=t.getOuterBindingIdentifierPaths();Object.keys(r).forEach((e=>{if(e==="__esModule"){throw t.buildCodeFrameError('Illegal export "__esModule".')}getLocalMetadata(r[e]).names.push(e)}))}else{e.get("specifiers").forEach((e=>{const t=e.get("local");const s=e.get("exported");const a=getLocalMetadata(t);const n=getExportSpecifierName(s,r);if(n==="__esModule"){throw s.buildCodeFrameError('Illegal export "__esModule".')}a.names.push(n)}))}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){getLocalMetadata(t.get("id")).names.push("default")}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}}));return a}function nameAnonymousExports(e){e.get("body").forEach((e=>{if(!e.isExportDefaultDeclaration())return;(0,n.default)(e)}))}function removeModuleDeclarations(e){e.get("body").forEach((e=>{if(e.isImportDeclaration()){e.remove()}else if(e.isExportNamedDeclaration()){if(e.node.declaration){e.node.declaration._blockHoist=e.node._blockHoist;e.replaceWith(e.node.declaration)}else{e.remove()}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){t._blockHoist=e.node._blockHoist;e.replaceWith(t)}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}else if(e.isExportAllDeclaration()){e.remove()}}))}},4025:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteLiveReferences;var s=r(9491);var a=r(8622);var n=r(153);var o=r(3667);function rewriteLiveReferences(e,t){const r=new Map;const s=new Map;const requeueInParent=t=>{e.requeue(t)};for(const[e,s]of t.source){for(const[t,a]of s.imports){r.set(t,[e,a,null])}for(const t of s.importsNamespace){r.set(t,[e,null,t])}}for(const[e,r]of t.local){let t=s.get(e);if(!t){t=[];s.set(e,t)}t.push(...r.names)}const n={metadata:t,requeueInParent:requeueInParent,scope:e.scope,exported:s};e.traverse(i,n);(0,o.default)(e,new Set([...Array.from(r.keys()),...Array.from(s.keys())]));const c={seen:new WeakSet,metadata:t,requeueInParent:requeueInParent,scope:e.scope,imported:r,exported:s,buildImportReference:([e,r,s],n)=>{const o=t.source.get(e);if(s){if(o.lazy)n=a.callExpression(n,[]);return n}let i=a.identifier(o.name);if(o.lazy)i=a.callExpression(i,[]);if(r==="default"&&o.interop==="node-default"){return i}const l=t.stringSpecifiers.has(r);return a.memberExpression(i,l?a.stringLiteral(r):a.identifier(r),l)}};e.traverse(l,c)}const i={Scope(e){e.skip()},ClassDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;const{id:n}=e.node;if(!n)throw new Error("Expected class to have a name");const o=n.name;const i=r.get(o)||[];if(i.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,i,a.identifier(o)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}},VariableDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;Object.keys(e.getOuterBindingIdentifiers()).forEach((n=>{const o=r.get(n)||[];if(o.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,o,a.identifier(n)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}}))}};const buildBindingExportAssignmentExpression=(e,t,r)=>(t||[]).reduce(((t,r)=>{const{stringSpecifiers:s}=e;const n=s.has(r);return a.assignmentExpression("=",a.memberExpression(a.identifier(e.exportName),n?a.stringLiteral(r):a.identifier(r),n),t)}),r);const buildImportThrow=e=>n.default.expression.ast` (function() { throw new Error('"' + '${e}' + '" is read-only.'); })() - `;const l={ReferencedIdentifier(e){const{seen:t,buildImportReference:r,scope:s,imported:n,requeueInParent:o}=this;if(t.has(e.node))return;t.add(e.node);const i=e.node.name;const l=n.get(i);if(l){const t=e.scope.getBinding(i);const n=s.getBinding(i);if(n!==t)return;const c=r(l,e.node);c.loc=e.node.loc;if((e.parentPath.isCallExpression({callee:e.node})||e.parentPath.isOptionalCallExpression({callee:e.node})||e.parentPath.isTaggedTemplateExpression({tag:e.node}))&&a.isMemberExpression(c)){e.replaceWith(a.sequenceExpression([a.numericLiteral(0),c]))}else if(e.isJSXIdentifier()&&a.isMemberExpression(c)){const{object:t,property:r}=c;e.replaceWith(a.jsxMemberExpression(a.jsxIdentifier(t.name),a.jsxIdentifier(r.name)))}else{e.replaceWith(c)}o(e);e.skip()}},AssignmentExpression:{exit(e){const{scope:t,seen:r,imported:n,exported:o,requeueInParent:i,buildImportReference:l}=this;if(r.has(e.node))return;r.add(e.node);const c=e.get("left");if(c.isMemberExpression())return;if(c.isIdentifier()){const r=c.node.name;if(t.getBinding(r)!==e.scope.getBinding(r)){return}const u=o.get(r);const p=n.get(r);if((u==null?void 0:u.length)>0||p){s(e.node.operator==="=","Path was not simplified");const t=e.node;if(p){t.left=l(p,t.left);t.right=a.sequenceExpression([t.right,buildImportThrow(r)])}e.replaceWith(buildBindingExportAssignmentExpression(this.metadata,u,t));i(e)}}else{const r=c.getOuterBindingIdentifiers();const s=Object.keys(r).filter((r=>t.getBinding(r)===e.scope.getBinding(r)));const l=s.find((e=>n.has(e)));if(l){e.node.right=a.sequenceExpression([e.node.right,buildImportThrow(l)])}const u=[];s.forEach((e=>{const t=o.get(e)||[];if(t.length>0){u.push(buildBindingExportAssignmentExpression(this.metadata,t,a.identifier(e)))}}));if(u.length>0){let t=a.sequenceExpression(u);if(e.parentPath.isExpressionStatement()){t=a.expressionStatement(t);t._blockHoist=e.parentPath.node._blockHoist}const r=e.insertAfter(t)[0];i(r)}}}},"ForOfStatement|ForInStatement"(e){const{scope:t,node:r}=e;const{left:s}=r;const{exported:n,scope:o}=this;if(!a.isVariableDeclaration(s)){let r=false;const i=e.get("body");const l=i.scope;for(const e of Object.keys(a.getOuterBindingIdentifiers(s))){if(n.get(e)&&o.getBinding(e)===t.getBinding(e)){r=true;if(l.hasOwnBinding(e)){l.rename(e)}}}if(!r){return}const c=t.generateUidIdentifierBasedOnNode(s);i.unshiftContainer("body",a.expressionStatement(a.assignmentExpression("=",s,c)));e.get("left").replaceWith(a.variableDeclaration("let",[a.variableDeclarator(a.cloneNode(c))]));t.registerDeclaration(e.get("left"))}}}},9736:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteThis;var s=r(6833);var a=r(7369);var n=r(8622);function rewriteThis(e){(0,a.default)(e.node,Object.assign({},o,{noScope:true}))}const o=a.default.visitors.merge([s.environmentVisitor,{ThisExpression(e){e.replaceWith(n.unaryExpression("void",n.numericLiteral(0),true))}}])},1380:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},3667:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=simplifyAccess;var s=r(8622);function simplifyAccess(e,t){e.traverse(a,{scope:e.scope,bindingNames:t,seen:new WeakSet})}const a={UpdateExpression:{exit(e){const{scope:t,bindingNames:r}=this;const a=e.get("argument");if(!a.isIdentifier())return;const n=a.node.name;if(!r.has(n))return;if(t.getBinding(n)!==e.scope.getBinding(n)){return}if(e.parentPath.isExpressionStatement()&&!e.isCompletionRecord()){const t=e.node.operator=="++"?"+=":"-=";e.replaceWith(s.assignmentExpression(t,a.node,s.numericLiteral(1)))}else if(e.node.prefix){e.replaceWith(s.assignmentExpression("=",s.identifier(n),s.binaryExpression(e.node.operator[0],s.unaryExpression("+",a.node),s.numericLiteral(1))))}else{const t=e.scope.generateUidIdentifierBasedOnNode(a.node,"old");const r=t.name;e.scope.push({id:t});const n=s.binaryExpression(e.node.operator[0],s.identifier(r),s.numericLiteral(1));e.replaceWith(s.sequenceExpression([s.assignmentExpression("=",s.identifier(r),s.unaryExpression("+",a.node)),s.assignmentExpression("=",s.cloneNode(a.node),n),s.identifier(r)]))}}},AssignmentExpression:{exit(e){const{scope:t,seen:r,bindingNames:a}=this;if(e.node.operator==="=")return;if(r.has(e.node))return;r.add(e.node);const n=e.get("left");if(!n.isIdentifier())return;const o=n.node.name;if(!a.has(o))return;if(t.getBinding(o)!==e.scope.getBinding(o)){return}e.node.right=s.binaryExpression(e.node.operator.slice(0,-1),s.cloneNode(e.node.left),e.node.right);e.node.operator="="}}}},9417:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(9417);var a=r(7721)},7721:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},6186:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(457);var a=r(1056);var n=r(9553);var o=r(8304);var i=r(7047);var l=(0,s.declare)(((e,t)=>{var r,s,l;e.assertVersion(7);const c=(0,i.createDynamicImportTransform)(e);const{strictNamespace:u=false,mjsStrictNamespace:p=true,allowTopLevelThis:d,strict:f,strictMode:m,noInterop:y,importInterop:g,lazy:h=false,allowCommonJSExports:b=true}=t;const x=(r=e.assumption("constantReexports"))!=null?r:t.loose;const v=(s=e.assumption("enumerableModuleMeta"))!=null?s:t.loose;const E=(l=e.assumption("noIncompleteNsImportDetection"))!=null?l:false;if(typeof h!=="boolean"&&typeof h!=="function"&&(!Array.isArray(h)||!h.every((e=>typeof e==="string")))){throw new Error(`.lazy must be a boolean, array of strings, or a function`)}if(typeof u!=="boolean"){throw new Error(`.strictNamespace must be a boolean, or undefined`)}if(typeof p!=="boolean"){throw new Error(`.mjsStrictNamespace must be a boolean, or undefined`)}const getAssertion=e=>o.template.expression.ast` + `;const l={ReferencedIdentifier(e){const{seen:t,buildImportReference:r,scope:s,imported:n,requeueInParent:o}=this;if(t.has(e.node))return;t.add(e.node);const i=e.node.name;const l=n.get(i);if(l){const t=e.scope.getBinding(i);const n=s.getBinding(i);if(n!==t)return;const c=r(l,e.node);c.loc=e.node.loc;if((e.parentPath.isCallExpression({callee:e.node})||e.parentPath.isOptionalCallExpression({callee:e.node})||e.parentPath.isTaggedTemplateExpression({tag:e.node}))&&a.isMemberExpression(c)){e.replaceWith(a.sequenceExpression([a.numericLiteral(0),c]))}else if(e.isJSXIdentifier()&&a.isMemberExpression(c)){const{object:t,property:r}=c;e.replaceWith(a.jsxMemberExpression(a.jsxIdentifier(t.name),a.jsxIdentifier(r.name)))}else{e.replaceWith(c)}o(e);e.skip()}},AssignmentExpression:{exit(e){const{scope:t,seen:r,imported:n,exported:o,requeueInParent:i,buildImportReference:l}=this;if(r.has(e.node))return;r.add(e.node);const c=e.get("left");if(c.isMemberExpression())return;if(c.isIdentifier()){const r=c.node.name;if(t.getBinding(r)!==e.scope.getBinding(r)){return}const u=o.get(r);const p=n.get(r);if((u==null?void 0:u.length)>0||p){s(e.node.operator==="=","Path was not simplified");const t=e.node;if(p){t.left=l(p,t.left);t.right=a.sequenceExpression([t.right,buildImportThrow(r)])}e.replaceWith(buildBindingExportAssignmentExpression(this.metadata,u,t));i(e)}}else{const r=c.getOuterBindingIdentifiers();const s=Object.keys(r).filter((r=>t.getBinding(r)===e.scope.getBinding(r)));const l=s.find((e=>n.has(e)));if(l){e.node.right=a.sequenceExpression([e.node.right,buildImportThrow(l)])}const u=[];s.forEach((e=>{const t=o.get(e)||[];if(t.length>0){u.push(buildBindingExportAssignmentExpression(this.metadata,t,a.identifier(e)))}}));if(u.length>0){let t=a.sequenceExpression(u);if(e.parentPath.isExpressionStatement()){t=a.expressionStatement(t);t._blockHoist=e.parentPath.node._blockHoist}const r=e.insertAfter(t)[0];i(r)}}}},"ForOfStatement|ForInStatement"(e){const{scope:t,node:r}=e;const{left:s}=r;const{exported:n,scope:o}=this;if(!a.isVariableDeclaration(s)){let r=false;const i=e.get("body");const l=i.scope;for(const e of Object.keys(a.getOuterBindingIdentifiers(s))){if(n.get(e)&&o.getBinding(e)===t.getBinding(e)){r=true;if(l.hasOwnBinding(e)){l.rename(e)}}}if(!r){return}const c=t.generateUidIdentifierBasedOnNode(s);i.unshiftContainer("body",a.expressionStatement(a.assignmentExpression("=",s,c)));e.get("left").replaceWith(a.variableDeclaration("let",[a.variableDeclarator(a.cloneNode(c))]));t.registerDeclaration(e.get("left"))}}}},9736:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteThis;var s=r(6833);var a=r(7369);var n=r(8622);function rewriteThis(e){(0,a.default)(e.node,Object.assign({},o,{noScope:true}))}const o=a.default.visitors.merge([s.environmentVisitor,{ThisExpression(e){e.replaceWith(n.unaryExpression("void",n.numericLiteral(0),true))}}])},1380:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},3667:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=simplifyAccess;var s=r(8622);function simplifyAccess(e,t){e.traverse(a,{scope:e.scope,bindingNames:t,seen:new WeakSet})}const a={UpdateExpression:{exit(e){const{scope:t,bindingNames:r}=this;const a=e.get("argument");if(!a.isIdentifier())return;const n=a.node.name;if(!r.has(n))return;if(t.getBinding(n)!==e.scope.getBinding(n)){return}if(e.parentPath.isExpressionStatement()&&!e.isCompletionRecord()){const t=e.node.operator=="++"?"+=":"-=";e.replaceWith(s.assignmentExpression(t,a.node,s.numericLiteral(1)))}else if(e.node.prefix){e.replaceWith(s.assignmentExpression("=",s.identifier(n),s.binaryExpression(e.node.operator[0],s.unaryExpression("+",a.node),s.numericLiteral(1))))}else{const t=e.scope.generateUidIdentifierBasedOnNode(a.node,"old");const r=t.name;e.scope.push({id:t});const n=s.binaryExpression(e.node.operator[0],s.identifier(r),s.numericLiteral(1));e.replaceWith(s.sequenceExpression([s.assignmentExpression("=",s.identifier(r),s.unaryExpression("+",a.node)),s.assignmentExpression("=",s.cloneNode(a.node),n),s.identifier(r)]))}}},AssignmentExpression:{exit(e){const{scope:t,seen:r,bindingNames:a}=this;if(e.node.operator==="=")return;if(r.has(e.node))return;r.add(e.node);const n=e.get("left");if(!n.isIdentifier())return;const o=n.node.name;if(!a.has(o))return;if(t.getBinding(o)!==e.scope.getBinding(o)){return}e.node.right=s.binaryExpression(e.node.operator.slice(0,-1),s.cloneNode(e.node.left),e.node.right);e.node.operator="="}}}},9417:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(9417);var a=r(7721)},7721:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},6186:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(457);var a=r(1056);var n=r(9553);var o=r(8304);var i=r(7047);var l=(0,s.declare)(((e,t)=>{var r,s,l;e.assertVersion(7);const c=(0,i.createDynamicImportTransform)(e);const{strictNamespace:u=false,mjsStrictNamespace:p=true,allowTopLevelThis:f,strict:d,strictMode:m,noInterop:y,importInterop:g,lazy:h=false,allowCommonJSExports:b=true}=t;const x=(r=e.assumption("constantReexports"))!=null?r:t.loose;const v=(s=e.assumption("enumerableModuleMeta"))!=null?s:t.loose;const E=(l=e.assumption("noIncompleteNsImportDetection"))!=null?l:false;if(typeof h!=="boolean"&&typeof h!=="function"&&(!Array.isArray(h)||!h.every((e=>typeof e==="string")))){throw new Error(`.lazy must be a boolean, array of strings, or a function`)}if(typeof u!=="boolean"){throw new Error(`.strictNamespace must be a boolean, or undefined`)}if(typeof p!=="boolean"){throw new Error(`.mjsStrictNamespace must be a boolean, or undefined`)}const getAssertion=e=>o.template.expression.ast` (function(){ throw new Error( "The CommonJS '" + "${e}" + "' variable is not available in ES6 modules." + "Consider setting setting sourceType:script or sourceType:unambiguous in your " + "Babel config for this file."); })() - `;const j={ReferencedIdentifier(e){const t=e.node.name;if(t!=="module"&&t!=="exports")return;const r=e.scope.getBinding(t);const s=this.scope.getBinding(t);if(s!==r||e.parentPath.isObjectProperty({value:e.node})&&e.parentPath.parentPath.isObjectPattern()||e.parentPath.isAssignmentExpression({left:e.node})||e.isAssignmentExpression({left:e.node})){return}e.replaceWith(getAssertion(t))},AssignmentExpression(e){const t=e.get("left");if(t.isIdentifier()){const t=e.node.name;if(t!=="module"&&t!=="exports")return;const r=e.scope.getBinding(t);const s=this.scope.getBinding(t);if(s!==r)return;const a=e.get("right");a.replaceWith(o.types.sequenceExpression([a.node,getAssertion(t)]))}else if(t.isPattern()){const r=t.getOuterBindingIdentifiers();const s=Object.keys(r).filter((t=>{if(t!=="module"&&t!=="exports")return false;return this.scope.getBinding(t)===e.scope.getBinding(t)}))[0];if(s){const t=e.get("right");t.replaceWith(o.types.sequenceExpression([t.node,getAssertion(s)]))}}}};return{name:"transform-modules-commonjs",pre(){this.file.set("@babel/plugin-transform-modules-*","commonjs")},visitor:{CallExpression(e){if(!this.file.has("@babel/plugin-proposal-dynamic-import"))return;if(!e.get("callee").isImport())return;let{scope:t}=e;do{t.rename("require")}while(t=t.parent);c(this,e.get("callee"))},Program:{exit(e,r){if(!(0,a.isModule)(e))return;e.scope.rename("exports");e.scope.rename("module");e.scope.rename("require");e.scope.rename("__filename");e.scope.rename("__dirname");if(!b){(0,n.default)(e,new Set(["module","exports"]));e.traverse(j,{scope:e.scope})}let s=(0,a.getModuleName)(this.file.opts,t);if(s)s=o.types.stringLiteral(s);const{meta:i,headers:l}=(0,a.rewriteModuleStatementsAndPrepareHeader)(e,{exportName:"exports",constantReexports:x,enumerableModuleMeta:v,strict:f,strictMode:m,allowTopLevelThis:d,noInterop:y,importInterop:g,lazy:h,esNamespaceOnly:typeof r.filename==="string"&&/\.mjs$/.test(r.filename)?p:u,noIncompleteNsImportDetection:E});for(const[t,r]of i.source){const s=o.types.callExpression(o.types.identifier("require"),[o.types.stringLiteral(t)]);let n;if((0,a.isSideEffectImport)(r)){if(r.lazy)throw new Error("Assertion failure");n=o.types.expressionStatement(s)}else{const t=(0,a.wrapInterop)(e,s,r.interop)||s;if(r.lazy){n=o.template.ast` + `;const j={ReferencedIdentifier(e){const t=e.node.name;if(t!=="module"&&t!=="exports")return;const r=e.scope.getBinding(t);const s=this.scope.getBinding(t);if(s!==r||e.parentPath.isObjectProperty({value:e.node})&&e.parentPath.parentPath.isObjectPattern()||e.parentPath.isAssignmentExpression({left:e.node})||e.isAssignmentExpression({left:e.node})){return}e.replaceWith(getAssertion(t))},AssignmentExpression(e){const t=e.get("left");if(t.isIdentifier()){const t=e.node.name;if(t!=="module"&&t!=="exports")return;const r=e.scope.getBinding(t);const s=this.scope.getBinding(t);if(s!==r)return;const a=e.get("right");a.replaceWith(o.types.sequenceExpression([a.node,getAssertion(t)]))}else if(t.isPattern()){const r=t.getOuterBindingIdentifiers();const s=Object.keys(r).filter((t=>{if(t!=="module"&&t!=="exports")return false;return this.scope.getBinding(t)===e.scope.getBinding(t)}))[0];if(s){const t=e.get("right");t.replaceWith(o.types.sequenceExpression([t.node,getAssertion(s)]))}}}};return{name:"transform-modules-commonjs",pre(){this.file.set("@babel/plugin-transform-modules-*","commonjs")},visitor:{CallExpression(e){if(!this.file.has("@babel/plugin-proposal-dynamic-import"))return;if(!e.get("callee").isImport())return;let{scope:t}=e;do{t.rename("require")}while(t=t.parent);c(this,e.get("callee"))},Program:{exit(e,r){if(!(0,a.isModule)(e))return;e.scope.rename("exports");e.scope.rename("module");e.scope.rename("require");e.scope.rename("__filename");e.scope.rename("__dirname");if(!b){(0,n.default)(e,new Set(["module","exports"]));e.traverse(j,{scope:e.scope})}let s=(0,a.getModuleName)(this.file.opts,t);if(s)s=o.types.stringLiteral(s);const{meta:i,headers:l}=(0,a.rewriteModuleStatementsAndPrepareHeader)(e,{exportName:"exports",constantReexports:x,enumerableModuleMeta:v,strict:d,strictMode:m,allowTopLevelThis:f,noInterop:y,importInterop:g,lazy:h,esNamespaceOnly:typeof r.filename==="string"&&/\.mjs$/.test(r.filename)?p:u,noIncompleteNsImportDetection:E});for(const[t,r]of i.source){const s=o.types.callExpression(o.types.identifier("require"),[o.types.stringLiteral(t)]);let n;if((0,a.isSideEffectImport)(r)){if(r.lazy)throw new Error("Assertion failure");n=o.types.expressionStatement(s)}else{const t=(0,a.wrapInterop)(e,s,r.interop)||s;if(r.lazy){n=o.template.ast` function ${r.name}() { const data = ${t}; ${r.name} = function(){ return data; }; @@ -233,7 +158,7 @@ } `}else{n=o.template.ast` var ${r.name} = ${t}; - `}}n.loc=r.loc;l.push(n);l.push(...(0,a.buildNamespaceInitStatements)(i,r,x))}(0,a.ensureStatementsHoisted)(l);e.unshiftContainer("body",l)}}}}}));t["default"]=l},409:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(8622);function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach((function(r){if(r!=="default"){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:true,get:function(){return e[r]}})}}))}t["default"]=e;return Object.freeze(t)}var a=_interopNamespace(s);function willPathCastToBoolean(e){const t=e;const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}class AssignmentMemoiser{constructor(){this._map=void 0;this._map=new WeakMap}has(e){return this._map.has(e)}get(e){if(!this.has(e))return;const t=this._map.get(e);const{value:r}=t;t.count--;if(t.count===0){return a.assignmentExpression("=",r,e)}return r}set(e,t,r){return this._map.set(e,{count:r,value:t})}}function toNonOptional(e,t){const{node:r}=e;if(a.isOptionalMemberExpression(r)){return a.memberExpression(t,r.property,r.computed)}if(e.isOptionalCallExpression()){const r=e.get("callee");if(e.node.optional&&r.isOptionalMemberExpression()){const{object:s}=r.node;const n=e.scope.maybeGenerateMemoised(s)||s;r.get("object").replaceWith(a.assignmentExpression("=",n,s));return a.callExpression(a.memberExpression(t,a.identifier("call")),[n,...e.node.arguments])}return a.callExpression(t,e.node.arguments)}return e.node}function isInDetachedTree(e){while(e){if(e.isProgram())break;const{parentPath:t,container:r,listKey:s}=e;const a=t.node;if(s){if(r!==a[s])return true}else{if(r!==a)return true}e=t}return false}const n={memoise(){},handle(e,t){const{node:r,parent:s,parentPath:n,scope:o}=e;if(e.isOptionalMemberExpression()){if(isInDetachedTree(e))return;const i=e.find((({node:t,parent:r})=>{if(a.isOptionalMemberExpression(r)){return r.optional||r.object!==t}if(a.isOptionalCallExpression(r)){return t!==e.node&&r.optional||r.callee!==t}return true}));if(o.path.isPattern()){i.replaceWith(a.callExpression(a.arrowFunctionExpression([],i.node),[]));return}const l=willPathCastToBoolean(i);const c=i.parentPath;if(c.isUpdateExpression({argument:r})||c.isAssignmentExpression({left:r})){throw e.buildCodeFrameError(`can't handle assignment`)}const u=c.isUnaryExpression({operator:"delete"});if(u&&i.isOptionalMemberExpression()&&i.get("property").isPrivateName()){throw e.buildCodeFrameError(`can't delete a private class element`)}let p=e;for(;;){if(p.isOptionalMemberExpression()){if(p.node.optional)break;p=p.get("object");continue}else if(p.isOptionalCallExpression()){if(p.node.optional)break;p=p.get("callee");continue}throw new Error(`Internal error: unexpected ${p.node.type}`)}const d=p.isOptionalMemberExpression()?"object":"callee";const f=p.node[d];const m=o.maybeGenerateMemoised(f);const y=m!=null?m:f;const g=n.isOptionalCallExpression({callee:r});const isOptionalCall=e=>g;const h=n.isCallExpression({callee:r});p.replaceWith(toNonOptional(p,y));if(isOptionalCall()){if(s.optional){n.replaceWith(this.optionalCall(e,s.arguments))}else{n.replaceWith(this.call(e,s.arguments))}}else if(h){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}let b=e.node;for(let t=e;t!==i;){const e=t.parentPath;if(e===i&&isOptionalCall()&&s.optional){b=e.node;break}b=toNonOptional(e,b);t=e}let x;const v=i.parentPath;if(a.isMemberExpression(b)&&v.isOptionalCallExpression({callee:i.node,optional:true})){const{object:t}=b;x=e.scope.maybeGenerateMemoised(t);if(x){b.object=a.assignmentExpression("=",x,t)}}let E=i;if(u){E=v;b=v.node}const j=m?a.assignmentExpression("=",a.cloneNode(y),a.cloneNode(f)):a.cloneNode(y);if(l){let e;if(t){e=a.binaryExpression("!=",j,a.nullLiteral())}else{e=a.logicalExpression("&&",a.binaryExpression("!==",j,a.nullLiteral()),a.binaryExpression("!==",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.logicalExpression("&&",e,b))}else{let e;if(t){e=a.binaryExpression("==",j,a.nullLiteral())}else{e=a.logicalExpression("||",a.binaryExpression("===",j,a.nullLiteral()),a.binaryExpression("===",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.conditionalExpression(e,u?a.booleanLiteral(true):o.buildUndefinedNode(),b))}if(x){const e=v.node;v.replaceWith(a.optionalCallExpression(a.optionalMemberExpression(e.callee,a.identifier("call"),false,true),[a.cloneNode(x),...e.arguments],false))}return}if(a.isUpdateExpression(s,{argument:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,prefix:o}=s;this.memoise(e,2);const i=a.binaryExpression(t[0],a.unaryExpression("+",this.get(e)),a.numericLiteral(1));if(o){n.replaceWith(this.set(e,i))}else{const{scope:t}=e;const s=t.generateUidIdentifierBasedOnNode(r);t.push({id:s});i.left=a.assignmentExpression("=",a.cloneNode(s),i.left);n.replaceWith(a.sequenceExpression([this.set(e,i),a.cloneNode(s)]))}return}if(n.isAssignmentExpression({left:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,right:r}=n.node;if(t==="="){n.replaceWith(this.set(e,r))}else{const s=t.slice(0,-1);if(a.LOGICAL_OPERATORS.includes(s)){this.memoise(e,1);n.replaceWith(a.logicalExpression(s,this.get(e),this.set(e,r)))}else{this.memoise(e,2);n.replaceWith(this.set(e,a.binaryExpression(s,this.get(e),r)))}}return}if(n.isCallExpression({callee:r})){n.replaceWith(this.call(e,n.node.arguments));return}if(n.isOptionalCallExpression({callee:r})){if(o.path.isPattern()){n.replaceWith(a.callExpression(a.arrowFunctionExpression([],n.node),[]));return}n.replaceWith(this.optionalCall(e,n.node.arguments));return}if(n.isForXStatement({left:r})||n.isObjectProperty({value:r})&&n.parentPath.isObjectPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isObjectProperty({value:s})&&n.parentPath.parentPath.isObjectPattern()||n.isArrayPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isArrayPattern()||n.isRestElement()){e.replaceWith(this.destructureSet(e));return}if(n.isTaggedTemplateExpression()){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}}};function memberExpressionToFunctions(e,t,r){e.traverse(t,Object.assign({},n,r,{memoiser:new AssignmentMemoiser}))}t["default"]=memberExpressionToFunctions},939:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=getModuleName;{const e=getModuleName;t["default"]=getModuleName=function getModuleName(t,r){var s,a,n,o;return e(t,{moduleId:(s=r.moduleId)!=null?s:t.moduleId,moduleIds:(a=r.moduleIds)!=null?a:t.moduleIds,getModuleId:(n=r.getModuleId)!=null?n:t.getModuleId,moduleRoot:(o=r.moduleRoot)!=null?o:t.moduleRoot})}}function getModuleName(e,t){const{filename:r,filenameRelative:s=r,sourceRoot:a=t.moduleRoot}=e;const{moduleId:n,moduleIds:o=!!n,getModuleId:i,moduleRoot:l=a}=t;if(!o)return null;if(n!=null&&!i){return n}let c=l!=null?l+"/":"";if(s){const e=a!=null?new RegExp("^"+a+"/?"):"";c+=s.replace(e,"").replace(/\.(\w*?)$/,"")}c=c.replace(/\\/g,"/");if(i){return i(c)||c}else{return c}}},1056:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.rewriteModuleStatementsAndPrepareHeader=rewriteModuleStatementsAndPrepareHeader;t.ensureStatementsHoisted=ensureStatementsHoisted;t.wrapInterop=wrapInterop;t.buildNamespaceInitStatements=buildNamespaceInitStatements;Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return o.isModule}});Object.defineProperty(t,"rewriteThis",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"hasExports",{enumerable:true,get:function(){return c.hasExports}});Object.defineProperty(t,"isSideEffectImport",{enumerable:true,get:function(){return c.isSideEffectImport}});Object.defineProperty(t,"getModuleName",{enumerable:true,get:function(){return u.default}});var s=r(9491);var a=r(8622);var n=r(153);var o=r(6039);var i=r(8831);var l=r(9955);var c=r(6832);var u=r(939);function rewriteModuleStatementsAndPrepareHeader(e,{loose:t,exportName:r,strict:n,allowTopLevelThis:u,strictMode:p,noInterop:d,importInterop:f=(d?"none":"babel"),lazy:m,esNamespaceOnly:y,constantReexports:g=t,enumerableModuleMeta:h=t,noIncompleteNsImportDetection:b}){(0,c.validateImportInteropOption)(f);s((0,o.isModule)(e),"Cannot process module statements in a script");e.node.sourceType="script";const x=(0,c.default)(e,r,{importInterop:f,initializeReexports:g,lazy:m,esNamespaceOnly:y});if(!u){(0,i.default)(e)}(0,l.default)(e,x);if(p!==false){const t=e.node.directives.some((e=>e.value.value==="use strict"));if(!t){e.unshiftContainer("directives",a.directive(a.directiveLiteral("use strict")))}}const v=[];if((0,c.hasExports)(x)&&!n){v.push(buildESModuleHeader(x,h))}const E=buildExportNameListDeclaration(e,x);if(E){x.exportNameListName=E.name;v.push(E.statement)}v.push(...buildExportInitializationStatements(e,x,g,b));return{meta:x,headers:v}}function ensureStatementsHoisted(e){e.forEach((e=>{e._blockHoist=3}))}function wrapInterop(e,t,r){if(r==="none"){return null}if(r==="node-namespace"){return a.callExpression(e.hub.addHelper("interopRequireWildcard"),[t,a.booleanLiteral(true)])}else if(r==="node-default"){return null}let s;if(r==="default"){s="interopRequireDefault"}else if(r==="namespace"){s="interopRequireWildcard"}else{throw new Error(`Unknown interop: ${r}`)}return a.callExpression(e.hub.addHelper(s),[t])}function buildNamespaceInitStatements(e,t,r=false){const s=[];let o=a.identifier(t.name);if(t.lazy)o=a.callExpression(o,[]);for(const e of t.importsNamespace){if(e===t.name)continue;s.push(n.default.statement`var NAME = SOURCE;`({NAME:e,SOURCE:a.cloneNode(o)}))}if(r){s.push(...buildReexportsFromMeta(e,t,true))}for(const r of t.reexportNamespace){s.push((t.lazy?n.default.statement` + `}}n.loc=r.loc;l.push(n);l.push(...(0,a.buildNamespaceInitStatements)(i,r,x))}(0,a.ensureStatementsHoisted)(l);e.unshiftContainer("body",l)}}}}}));t["default"]=l},409:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(8622);function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach((function(r){if(r!=="default"){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:true,get:function(){return e[r]}})}}))}t["default"]=e;return Object.freeze(t)}var a=_interopNamespace(s);function willPathCastToBoolean(e){const t=e;const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}class AssignmentMemoiser{constructor(){this._map=void 0;this._map=new WeakMap}has(e){return this._map.has(e)}get(e){if(!this.has(e))return;const t=this._map.get(e);const{value:r}=t;t.count--;if(t.count===0){return a.assignmentExpression("=",r,e)}return r}set(e,t,r){return this._map.set(e,{count:r,value:t})}}function toNonOptional(e,t){const{node:r}=e;if(a.isOptionalMemberExpression(r)){return a.memberExpression(t,r.property,r.computed)}if(e.isOptionalCallExpression()){const r=e.get("callee");if(e.node.optional&&r.isOptionalMemberExpression()){const{object:s}=r.node;const n=e.scope.maybeGenerateMemoised(s)||s;r.get("object").replaceWith(a.assignmentExpression("=",n,s));return a.callExpression(a.memberExpression(t,a.identifier("call")),[n,...e.node.arguments])}return a.callExpression(t,e.node.arguments)}return e.node}function isInDetachedTree(e){while(e){if(e.isProgram())break;const{parentPath:t,container:r,listKey:s}=e;const a=t.node;if(s){if(r!==a[s])return true}else{if(r!==a)return true}e=t}return false}const n={memoise(){},handle(e,t){const{node:r,parent:s,parentPath:n,scope:o}=e;if(e.isOptionalMemberExpression()){if(isInDetachedTree(e))return;const i=e.find((({node:t,parent:r})=>{if(a.isOptionalMemberExpression(r)){return r.optional||r.object!==t}if(a.isOptionalCallExpression(r)){return t!==e.node&&r.optional||r.callee!==t}return true}));if(o.path.isPattern()){i.replaceWith(a.callExpression(a.arrowFunctionExpression([],i.node),[]));return}const l=willPathCastToBoolean(i);const c=i.parentPath;if(c.isUpdateExpression({argument:r})||c.isAssignmentExpression({left:r})){throw e.buildCodeFrameError(`can't handle assignment`)}const u=c.isUnaryExpression({operator:"delete"});if(u&&i.isOptionalMemberExpression()&&i.get("property").isPrivateName()){throw e.buildCodeFrameError(`can't delete a private class element`)}let p=e;for(;;){if(p.isOptionalMemberExpression()){if(p.node.optional)break;p=p.get("object");continue}else if(p.isOptionalCallExpression()){if(p.node.optional)break;p=p.get("callee");continue}throw new Error(`Internal error: unexpected ${p.node.type}`)}const f=p.isOptionalMemberExpression()?"object":"callee";const d=p.node[f];const m=o.maybeGenerateMemoised(d);const y=m!=null?m:d;const g=n.isOptionalCallExpression({callee:r});const isOptionalCall=e=>g;const h=n.isCallExpression({callee:r});p.replaceWith(toNonOptional(p,y));if(isOptionalCall()){if(s.optional){n.replaceWith(this.optionalCall(e,s.arguments))}else{n.replaceWith(this.call(e,s.arguments))}}else if(h){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}let b=e.node;for(let t=e;t!==i;){const e=t.parentPath;if(e===i&&isOptionalCall()&&s.optional){b=e.node;break}b=toNonOptional(e,b);t=e}let x;const v=i.parentPath;if(a.isMemberExpression(b)&&v.isOptionalCallExpression({callee:i.node,optional:true})){const{object:t}=b;x=e.scope.maybeGenerateMemoised(t);if(x){b.object=a.assignmentExpression("=",x,t)}}let E=i;if(u){E=v;b=v.node}const j=m?a.assignmentExpression("=",a.cloneNode(y),a.cloneNode(d)):a.cloneNode(y);if(l){let e;if(t){e=a.binaryExpression("!=",j,a.nullLiteral())}else{e=a.logicalExpression("&&",a.binaryExpression("!==",j,a.nullLiteral()),a.binaryExpression("!==",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.logicalExpression("&&",e,b))}else{let e;if(t){e=a.binaryExpression("==",j,a.nullLiteral())}else{e=a.logicalExpression("||",a.binaryExpression("===",j,a.nullLiteral()),a.binaryExpression("===",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.conditionalExpression(e,u?a.booleanLiteral(true):o.buildUndefinedNode(),b))}if(x){const e=v.node;v.replaceWith(a.optionalCallExpression(a.optionalMemberExpression(e.callee,a.identifier("call"),false,true),[a.cloneNode(x),...e.arguments],false))}return}if(a.isUpdateExpression(s,{argument:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,prefix:o}=s;this.memoise(e,2);const i=a.binaryExpression(t[0],a.unaryExpression("+",this.get(e)),a.numericLiteral(1));if(o){n.replaceWith(this.set(e,i))}else{const{scope:t}=e;const s=t.generateUidIdentifierBasedOnNode(r);t.push({id:s});i.left=a.assignmentExpression("=",a.cloneNode(s),i.left);n.replaceWith(a.sequenceExpression([this.set(e,i),a.cloneNode(s)]))}return}if(n.isAssignmentExpression({left:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,right:r}=n.node;if(t==="="){n.replaceWith(this.set(e,r))}else{const s=t.slice(0,-1);if(a.LOGICAL_OPERATORS.includes(s)){this.memoise(e,1);n.replaceWith(a.logicalExpression(s,this.get(e),this.set(e,r)))}else{this.memoise(e,2);n.replaceWith(this.set(e,a.binaryExpression(s,this.get(e),r)))}}return}if(n.isCallExpression({callee:r})){n.replaceWith(this.call(e,n.node.arguments));return}if(n.isOptionalCallExpression({callee:r})){if(o.path.isPattern()){n.replaceWith(a.callExpression(a.arrowFunctionExpression([],n.node),[]));return}n.replaceWith(this.optionalCall(e,n.node.arguments));return}if(n.isForXStatement({left:r})||n.isObjectProperty({value:r})&&n.parentPath.isObjectPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isObjectProperty({value:s})&&n.parentPath.parentPath.isObjectPattern()||n.isArrayPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isArrayPattern()||n.isRestElement()){e.replaceWith(this.destructureSet(e));return}if(n.isTaggedTemplateExpression()){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}}};function memberExpressionToFunctions(e,t,r){e.traverse(t,Object.assign({},n,r,{memoiser:new AssignmentMemoiser}))}t["default"]=memberExpressionToFunctions},939:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=getModuleName;{const e=getModuleName;t["default"]=getModuleName=function getModuleName(t,r){var s,a,n,o;return e(t,{moduleId:(s=r.moduleId)!=null?s:t.moduleId,moduleIds:(a=r.moduleIds)!=null?a:t.moduleIds,getModuleId:(n=r.getModuleId)!=null?n:t.getModuleId,moduleRoot:(o=r.moduleRoot)!=null?o:t.moduleRoot})}}function getModuleName(e,t){const{filename:r,filenameRelative:s=r,sourceRoot:a=t.moduleRoot}=e;const{moduleId:n,moduleIds:o=!!n,getModuleId:i,moduleRoot:l=a}=t;if(!o)return null;if(n!=null&&!i){return n}let c=l!=null?l+"/":"";if(s){const e=a!=null?new RegExp("^"+a+"/?"):"";c+=s.replace(e,"").replace(/\.(\w*?)$/,"")}c=c.replace(/\\/g,"/");if(i){return i(c)||c}else{return c}}},1056:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.rewriteModuleStatementsAndPrepareHeader=rewriteModuleStatementsAndPrepareHeader;t.ensureStatementsHoisted=ensureStatementsHoisted;t.wrapInterop=wrapInterop;t.buildNamespaceInitStatements=buildNamespaceInitStatements;Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return o.isModule}});Object.defineProperty(t,"rewriteThis",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"hasExports",{enumerable:true,get:function(){return c.hasExports}});Object.defineProperty(t,"isSideEffectImport",{enumerable:true,get:function(){return c.isSideEffectImport}});Object.defineProperty(t,"getModuleName",{enumerable:true,get:function(){return u.default}});var s=r(9491);var a=r(8622);var n=r(153);var o=r(9115);var i=r(8831);var l=r(9955);var c=r(6832);var u=r(939);function rewriteModuleStatementsAndPrepareHeader(e,{loose:t,exportName:r,strict:n,allowTopLevelThis:u,strictMode:p,noInterop:f,importInterop:d=(f?"none":"babel"),lazy:m,esNamespaceOnly:y,constantReexports:g=t,enumerableModuleMeta:h=t,noIncompleteNsImportDetection:b}){(0,c.validateImportInteropOption)(d);s((0,o.isModule)(e),"Cannot process module statements in a script");e.node.sourceType="script";const x=(0,c.default)(e,r,{importInterop:d,initializeReexports:g,lazy:m,esNamespaceOnly:y});if(!u){(0,i.default)(e)}(0,l.default)(e,x);if(p!==false){const t=e.node.directives.some((e=>e.value.value==="use strict"));if(!t){e.unshiftContainer("directives",a.directive(a.directiveLiteral("use strict")))}}const v=[];if((0,c.hasExports)(x)&&!n){v.push(buildESModuleHeader(x,h))}const E=buildExportNameListDeclaration(e,x);if(E){x.exportNameListName=E.name;v.push(E.statement)}v.push(...buildExportInitializationStatements(e,x,g,b));return{meta:x,headers:v}}function ensureStatementsHoisted(e){e.forEach((e=>{e._blockHoist=3}))}function wrapInterop(e,t,r){if(r==="none"){return null}if(r==="node-namespace"){return a.callExpression(e.hub.addHelper("interopRequireWildcard"),[t,a.booleanLiteral(true)])}else if(r==="node-default"){return null}let s;if(r==="default"){s="interopRequireDefault"}else if(r==="namespace"){s="interopRequireWildcard"}else{throw new Error(`Unknown interop: ${r}`)}return a.callExpression(e.hub.addHelper(s),[t])}function buildNamespaceInitStatements(e,t,r=false){const s=[];let o=a.identifier(t.name);if(t.lazy)o=a.callExpression(o,[]);for(const e of t.importsNamespace){if(e===t.name)continue;s.push(n.default.statement`var NAME = SOURCE;`({NAME:e,SOURCE:a.cloneNode(o)}))}if(r){s.push(...buildReexportsFromMeta(e,t,true))}for(const r of t.reexportNamespace){s.push((t.lazy?n.default.statement` Object.defineProperty(EXPORTS, "NAME", { enumerable: true, get: function() { @@ -276,11 +201,11 @@ }); `)({NAMESPACE:t,EXPORTS:e.exportName,VERIFY_NAME_LIST:e.exportNameListName?(0,n.default)` if (Object.prototype.hasOwnProperty.call(EXPORTS_LIST, key)) return; - `({EXPORTS_LIST:e.exportNameListName}):null})}function buildExportNameListDeclaration(e,t){const r=Object.create(null);for(const e of t.local.values()){for(const t of e.names){r[t]=true}}let s=false;for(const e of t.source.values()){for(const t of e.reexports.keys()){r[t]=true}for(const t of e.reexportNamespace){r[t]=true}s=s||!!e.reexportAll}if(!s||Object.keys(r).length===0)return null;const n=e.scope.generateUidIdentifier("exportNames");delete r.default;return{name:n.name,statement:a.variableDeclaration("var",[a.variableDeclarator(n,a.valueToNode(r))])}}function buildExportInitializationStatements(e,t,r=false,s=false){const n=[];const o=[];for(const[e,r]of t.local){if(r.kind==="import"){}else if(r.kind==="hoisted"){n.push(buildInitStatement(t,r.names,a.identifier(e)))}else{o.push(...r.names)}}for(const e of t.source.values()){if(!r){n.push(...buildReexportsFromMeta(t,e,false))}for(const t of e.reexportNamespace){o.push(t)}}if(!s){n.push(...chunk(o,100).map((r=>buildInitStatement(t,r,e.scope.buildUndefinedNode()))))}return n}const d={computed:n.default.expression`EXPORTS["NAME"] = VALUE`,default:n.default.expression`EXPORTS.NAME = VALUE`};function buildInitStatement(e,t,r){const{stringSpecifiers:s,exportName:n}=e;return a.expressionStatement(t.reduce(((e,t)=>{const r={EXPORTS:n,NAME:t,VALUE:e};if(s.has(t)){return d.computed(r)}else{return d.default(r)}}),r))}function chunk(e,t){const r=[];for(let s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasExports=hasExports;t.isSideEffectImport=isSideEffectImport;t.validateImportInteropOption=validateImportInteropOption;t["default"]=normalizeModuleAndLoadMetadata;var s=r(1017);var a=r(1826);var n=r(7058);function hasExports(e){return e.hasExports}function isSideEffectImport(e){return e.imports.size===0&&e.importsNamespace.size===0&&e.reexports.size===0&&e.reexportNamespace.size===0&&!e.reexportAll}function validateImportInteropOption(e){if(typeof e!=="function"&&e!=="none"&&e!=="babel"&&e!=="node"){throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${e}).`)}return e}function resolveImportInterop(e,t){if(typeof e==="function"){return validateImportInteropOption(e(t))}return e}function normalizeModuleAndLoadMetadata(e,t,{importInterop:r,initializeReexports:s=false,lazy:a=false,esNamespaceOnly:n=false}){if(!t){t=e.scope.generateUidIdentifier("exports").name}const o=new Set;nameAnonymousExports(e);const{local:i,source:l,hasExports:c}=getModuleMetadata(e,{initializeReexports:s,lazy:a},o);removeModuleDeclarations(e);for(const[,e]of l){if(e.importsNamespace.size>0){e.name=e.importsNamespace.values().next().value}const t=resolveImportInterop(r,e.source);if(t==="none"){e.interop="none"}else if(t==="node"&&e.interop==="namespace"){e.interop="node-namespace"}else if(t==="node"&&e.interop==="default"){e.interop="node-default"}else if(n&&e.interop==="namespace"){e.interop="default"}}return{exportName:t,exportNameListName:null,hasExports:c,local:i,source:l,stringSpecifiers:o}}function getExportSpecifierName(e,t){if(e.isIdentifier()){return e.node.name}else if(e.isStringLiteral()){const r=e.node.value;if(!(0,a.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.node.type}`)}}function assertExportSpecifier(e){if(e.isExportSpecifier()){return}else if(e.isExportNamespaceSpecifier()){throw e.buildCodeFrameError("Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.")}else{throw e.buildCodeFrameError("Unexpected export specifier type")}}function getModuleMetadata(e,{lazy:t,initializeReexports:r},a){const n=getLocalExportMetadata(e,r,a);const o=new Map;const getData=t=>{const r=t.value;let a=o.get(r);if(!a){a={name:e.scope.generateUidIdentifier((0,s.basename)(r,(0,s.extname)(r))).name,interop:"none",loc:null,imports:new Map,importsNamespace:new Set,reexports:new Map,reexportNamespace:new Set,reexportAll:null,lazy:false,source:r};o.set(r,a)}return a};let i=false;e.get("body").forEach((e=>{if(e.isImportDeclaration()){const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{if(e.isImportDefaultSpecifier()){const r=e.get("local").node.name;t.imports.set(r,"default");const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexports.set(e,"default")}))}}else if(e.isImportNamespaceSpecifier()){const r=e.get("local").node.name;t.importsNamespace.add(r);const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexportNamespace.add(e)}))}}else if(e.isImportSpecifier()){const r=getExportSpecifierName(e.get("imported"),a);const s=e.get("local").node.name;t.imports.set(s,r);const o=n.get(s);if(o){n.delete(s);o.names.forEach((e=>{t.reexports.set(e,r)}))}}}))}else if(e.isExportAllDeclaration()){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;t.reexportAll={loc:e.node.loc}}else if(e.isExportNamedDeclaration()&&e.node.source){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{assertExportSpecifier(e);const r=getExportSpecifierName(e.get("local"),a);const s=getExportSpecifierName(e.get("exported"),a);t.reexports.set(s,r);if(s==="__esModule"){throw e.get("exported").buildCodeFrameError('Illegal export "__esModule".')}}))}else if(e.isExportNamedDeclaration()||e.isExportDefaultDeclaration()){i=true}}));for(const e of o.values()){let t=false;let r=false;if(e.importsNamespace.size>0){t=true;r=true}if(e.reexportAll){r=true}for(const s of e.imports.values()){if(s==="default")t=true;else r=true}for(const s of e.reexports.values()){if(s==="default")t=true;else r=true}if(t&&r){e.interop="namespace"}else if(t){e.interop="default"}}for(const[e,r]of o){if(t!==false&&!(isSideEffectImport(r)||r.reexportAll)){if(t===true){r.lazy=!/\./.test(e)}else if(Array.isArray(t)){r.lazy=t.indexOf(e)!==-1}else if(typeof t==="function"){r.lazy=t(e)}else{throw new Error(`.lazy must be a boolean, string array, or function`)}}}return{hasExports:i,local:n,source:o}}function getLocalExportMetadata(e,t,r){const s=new Map;e.get("body").forEach((e=>{let r;if(e.isImportDeclaration()){r="import"}else{if(e.isExportDefaultDeclaration())e=e.get("declaration");if(e.isExportNamedDeclaration()){if(e.node.declaration){e=e.get("declaration")}else if(t&&e.node.source&&e.get("source").isStringLiteral()){e.get("specifiers").forEach((e=>{assertExportSpecifier(e);s.set(e.get("local").node.name,"block")}));return}}if(e.isFunctionDeclaration()){r="hoisted"}else if(e.isClassDeclaration()){r="block"}else if(e.isVariableDeclaration({kind:"var"})){r="var"}else if(e.isVariableDeclaration()){r="block"}else{return}}Object.keys(e.getOuterBindingIdentifiers()).forEach((e=>{s.set(e,r)}))}));const a=new Map;const getLocalMetadata=e=>{const t=e.node.name;let r=a.get(t);if(!r){const n=s.get(t);if(n===undefined){throw e.buildCodeFrameError(`Exporting local "${t}", which is not declared.`)}r={names:[],kind:n};a.set(t,r)}return r};e.get("body").forEach((e=>{if(e.isExportNamedDeclaration()&&(t||!e.node.source)){if(e.node.declaration){const t=e.get("declaration");const r=t.getOuterBindingIdentifierPaths();Object.keys(r).forEach((e=>{if(e==="__esModule"){throw t.buildCodeFrameError('Illegal export "__esModule".')}getLocalMetadata(r[e]).names.push(e)}))}else{e.get("specifiers").forEach((e=>{const t=e.get("local");const s=e.get("exported");const a=getLocalMetadata(t);const n=getExportSpecifierName(s,r);if(n==="__esModule"){throw s.buildCodeFrameError('Illegal export "__esModule".')}a.names.push(n)}))}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){getLocalMetadata(t.get("id")).names.push("default")}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}}));return a}function nameAnonymousExports(e){e.get("body").forEach((e=>{if(!e.isExportDefaultDeclaration())return;(0,n.default)(e)}))}function removeModuleDeclarations(e){e.get("body").forEach((e=>{if(e.isImportDeclaration()){e.remove()}else if(e.isExportNamedDeclaration()){if(e.node.declaration){e.node.declaration._blockHoist=e.node._blockHoist;e.replaceWith(e.node.declaration)}else{e.remove()}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){t._blockHoist=e.node._blockHoist;e.replaceWith(t)}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}else if(e.isExportAllDeclaration()){e.remove()}}))}},9955:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteLiveReferences;var s=r(9491);var a=r(8622);var n=r(153);var o=r(9553);function rewriteLiveReferences(e,t){const r=new Map;const s=new Map;const requeueInParent=t=>{e.requeue(t)};for(const[e,s]of t.source){for(const[t,a]of s.imports){r.set(t,[e,a,null])}for(const t of s.importsNamespace){r.set(t,[e,null,t])}}for(const[e,r]of t.local){let t=s.get(e);if(!t){t=[];s.set(e,t)}t.push(...r.names)}const n={metadata:t,requeueInParent:requeueInParent,scope:e.scope,exported:s};e.traverse(i,n);(0,o.default)(e,new Set([...Array.from(r.keys()),...Array.from(s.keys())]));const c={seen:new WeakSet,metadata:t,requeueInParent:requeueInParent,scope:e.scope,imported:r,exported:s,buildImportReference:([e,r,s],n)=>{const o=t.source.get(e);if(s){if(o.lazy)n=a.callExpression(n,[]);return n}let i=a.identifier(o.name);if(o.lazy)i=a.callExpression(i,[]);if(r==="default"&&o.interop==="node-default"){return i}const l=t.stringSpecifiers.has(r);return a.memberExpression(i,l?a.stringLiteral(r):a.identifier(r),l)}};e.traverse(l,c)}const i={Scope(e){e.skip()},ClassDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;const{id:n}=e.node;if(!n)throw new Error("Expected class to have a name");const o=n.name;const i=r.get(o)||[];if(i.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,i,a.identifier(o)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}},VariableDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;Object.keys(e.getOuterBindingIdentifiers()).forEach((n=>{const o=r.get(n)||[];if(o.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,o,a.identifier(n)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}}))}};const buildBindingExportAssignmentExpression=(e,t,r)=>(t||[]).reduce(((t,r)=>{const{stringSpecifiers:s}=e;const n=s.has(r);return a.assignmentExpression("=",a.memberExpression(a.identifier(e.exportName),n?a.stringLiteral(r):a.identifier(r),n),t)}),r);const buildImportThrow=e=>n.default.expression.ast` + `({EXPORTS_LIST:e.exportNameListName}):null})}function buildExportNameListDeclaration(e,t){const r=Object.create(null);for(const e of t.local.values()){for(const t of e.names){r[t]=true}}let s=false;for(const e of t.source.values()){for(const t of e.reexports.keys()){r[t]=true}for(const t of e.reexportNamespace){r[t]=true}s=s||!!e.reexportAll}if(!s||Object.keys(r).length===0)return null;const n=e.scope.generateUidIdentifier("exportNames");delete r.default;return{name:n.name,statement:a.variableDeclaration("var",[a.variableDeclarator(n,a.valueToNode(r))])}}function buildExportInitializationStatements(e,t,r=false,s=false){const n=[];const o=[];for(const[e,r]of t.local){if(r.kind==="import"){}else if(r.kind==="hoisted"){n.push(buildInitStatement(t,r.names,a.identifier(e)))}else{o.push(...r.names)}}for(const e of t.source.values()){if(!r){n.push(...buildReexportsFromMeta(t,e,false))}for(const t of e.reexportNamespace){o.push(t)}}if(!s){n.push(...chunk(o,100).map((r=>buildInitStatement(t,r,e.scope.buildUndefinedNode()))))}return n}const f={computed:n.default.expression`EXPORTS["NAME"] = VALUE`,default:n.default.expression`EXPORTS.NAME = VALUE`};function buildInitStatement(e,t,r){const{stringSpecifiers:s,exportName:n}=e;return a.expressionStatement(t.reduce(((e,t)=>{const r={EXPORTS:n,NAME:t,VALUE:e};if(s.has(t)){return f.computed(r)}else{return f.default(r)}}),r))}function chunk(e,t){const r=[];for(let s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasExports=hasExports;t.isSideEffectImport=isSideEffectImport;t.validateImportInteropOption=validateImportInteropOption;t["default"]=normalizeModuleAndLoadMetadata;var s=r(1017);var a=r(1826);var n=r(7058);function hasExports(e){return e.hasExports}function isSideEffectImport(e){return e.imports.size===0&&e.importsNamespace.size===0&&e.reexports.size===0&&e.reexportNamespace.size===0&&!e.reexportAll}function validateImportInteropOption(e){if(typeof e!=="function"&&e!=="none"&&e!=="babel"&&e!=="node"){throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${e}).`)}return e}function resolveImportInterop(e,t){if(typeof e==="function"){return validateImportInteropOption(e(t))}return e}function normalizeModuleAndLoadMetadata(e,t,{importInterop:r,initializeReexports:s=false,lazy:a=false,esNamespaceOnly:n=false}){if(!t){t=e.scope.generateUidIdentifier("exports").name}const o=new Set;nameAnonymousExports(e);const{local:i,source:l,hasExports:c}=getModuleMetadata(e,{initializeReexports:s,lazy:a},o);removeModuleDeclarations(e);for(const[,e]of l){if(e.importsNamespace.size>0){e.name=e.importsNamespace.values().next().value}const t=resolveImportInterop(r,e.source);if(t==="none"){e.interop="none"}else if(t==="node"&&e.interop==="namespace"){e.interop="node-namespace"}else if(t==="node"&&e.interop==="default"){e.interop="node-default"}else if(n&&e.interop==="namespace"){e.interop="default"}}return{exportName:t,exportNameListName:null,hasExports:c,local:i,source:l,stringSpecifiers:o}}function getExportSpecifierName(e,t){if(e.isIdentifier()){return e.node.name}else if(e.isStringLiteral()){const r=e.node.value;if(!(0,a.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.node.type}`)}}function assertExportSpecifier(e){if(e.isExportSpecifier()){return}else if(e.isExportNamespaceSpecifier()){throw e.buildCodeFrameError("Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.")}else{throw e.buildCodeFrameError("Unexpected export specifier type")}}function getModuleMetadata(e,{lazy:t,initializeReexports:r},a){const n=getLocalExportMetadata(e,r,a);const o=new Map;const getData=t=>{const r=t.value;let a=o.get(r);if(!a){a={name:e.scope.generateUidIdentifier((0,s.basename)(r,(0,s.extname)(r))).name,interop:"none",loc:null,imports:new Map,importsNamespace:new Set,reexports:new Map,reexportNamespace:new Set,reexportAll:null,lazy:false,source:r};o.set(r,a)}return a};let i=false;e.get("body").forEach((e=>{if(e.isImportDeclaration()){const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{if(e.isImportDefaultSpecifier()){const r=e.get("local").node.name;t.imports.set(r,"default");const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexports.set(e,"default")}))}}else if(e.isImportNamespaceSpecifier()){const r=e.get("local").node.name;t.importsNamespace.add(r);const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexportNamespace.add(e)}))}}else if(e.isImportSpecifier()){const r=getExportSpecifierName(e.get("imported"),a);const s=e.get("local").node.name;t.imports.set(s,r);const o=n.get(s);if(o){n.delete(s);o.names.forEach((e=>{t.reexports.set(e,r)}))}}}))}else if(e.isExportAllDeclaration()){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;t.reexportAll={loc:e.node.loc}}else if(e.isExportNamedDeclaration()&&e.node.source){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{assertExportSpecifier(e);const r=getExportSpecifierName(e.get("local"),a);const s=getExportSpecifierName(e.get("exported"),a);t.reexports.set(s,r);if(s==="__esModule"){throw e.get("exported").buildCodeFrameError('Illegal export "__esModule".')}}))}else if(e.isExportNamedDeclaration()||e.isExportDefaultDeclaration()){i=true}}));for(const e of o.values()){let t=false;let r=false;if(e.importsNamespace.size>0){t=true;r=true}if(e.reexportAll){r=true}for(const s of e.imports.values()){if(s==="default")t=true;else r=true}for(const s of e.reexports.values()){if(s==="default")t=true;else r=true}if(t&&r){e.interop="namespace"}else if(t){e.interop="default"}}for(const[e,r]of o){if(t!==false&&!(isSideEffectImport(r)||r.reexportAll)){if(t===true){r.lazy=!/\./.test(e)}else if(Array.isArray(t)){r.lazy=t.indexOf(e)!==-1}else if(typeof t==="function"){r.lazy=t(e)}else{throw new Error(`.lazy must be a boolean, string array, or function`)}}}return{hasExports:i,local:n,source:o}}function getLocalExportMetadata(e,t,r){const s=new Map;e.get("body").forEach((e=>{let r;if(e.isImportDeclaration()){r="import"}else{if(e.isExportDefaultDeclaration())e=e.get("declaration");if(e.isExportNamedDeclaration()){if(e.node.declaration){e=e.get("declaration")}else if(t&&e.node.source&&e.get("source").isStringLiteral()){e.get("specifiers").forEach((e=>{assertExportSpecifier(e);s.set(e.get("local").node.name,"block")}));return}}if(e.isFunctionDeclaration()){r="hoisted"}else if(e.isClassDeclaration()){r="block"}else if(e.isVariableDeclaration({kind:"var"})){r="var"}else if(e.isVariableDeclaration()){r="block"}else{return}}Object.keys(e.getOuterBindingIdentifiers()).forEach((e=>{s.set(e,r)}))}));const a=new Map;const getLocalMetadata=e=>{const t=e.node.name;let r=a.get(t);if(!r){const n=s.get(t);if(n===undefined){throw e.buildCodeFrameError(`Exporting local "${t}", which is not declared.`)}r={names:[],kind:n};a.set(t,r)}return r};e.get("body").forEach((e=>{if(e.isExportNamedDeclaration()&&(t||!e.node.source)){if(e.node.declaration){const t=e.get("declaration");const r=t.getOuterBindingIdentifierPaths();Object.keys(r).forEach((e=>{if(e==="__esModule"){throw t.buildCodeFrameError('Illegal export "__esModule".')}getLocalMetadata(r[e]).names.push(e)}))}else{e.get("specifiers").forEach((e=>{const t=e.get("local");const s=e.get("exported");const a=getLocalMetadata(t);const n=getExportSpecifierName(s,r);if(n==="__esModule"){throw s.buildCodeFrameError('Illegal export "__esModule".')}a.names.push(n)}))}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){getLocalMetadata(t.get("id")).names.push("default")}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}}));return a}function nameAnonymousExports(e){e.get("body").forEach((e=>{if(!e.isExportDefaultDeclaration())return;(0,n.default)(e)}))}function removeModuleDeclarations(e){e.get("body").forEach((e=>{if(e.isImportDeclaration()){e.remove()}else if(e.isExportNamedDeclaration()){if(e.node.declaration){e.node.declaration._blockHoist=e.node._blockHoist;e.replaceWith(e.node.declaration)}else{e.remove()}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){t._blockHoist=e.node._blockHoist;e.replaceWith(t)}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}else if(e.isExportAllDeclaration()){e.remove()}}))}},9955:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteLiveReferences;var s=r(9491);var a=r(8622);var n=r(153);var o=r(9553);function rewriteLiveReferences(e,t){const r=new Map;const s=new Map;const requeueInParent=t=>{e.requeue(t)};for(const[e,s]of t.source){for(const[t,a]of s.imports){r.set(t,[e,a,null])}for(const t of s.importsNamespace){r.set(t,[e,null,t])}}for(const[e,r]of t.local){let t=s.get(e);if(!t){t=[];s.set(e,t)}t.push(...r.names)}const n={metadata:t,requeueInParent:requeueInParent,scope:e.scope,exported:s};e.traverse(i,n);(0,o.default)(e,new Set([...Array.from(r.keys()),...Array.from(s.keys())]));const c={seen:new WeakSet,metadata:t,requeueInParent:requeueInParent,scope:e.scope,imported:r,exported:s,buildImportReference:([e,r,s],n)=>{const o=t.source.get(e);if(s){if(o.lazy)n=a.callExpression(n,[]);return n}let i=a.identifier(o.name);if(o.lazy)i=a.callExpression(i,[]);if(r==="default"&&o.interop==="node-default"){return i}const l=t.stringSpecifiers.has(r);return a.memberExpression(i,l?a.stringLiteral(r):a.identifier(r),l)}};e.traverse(l,c)}const i={Scope(e){e.skip()},ClassDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;const{id:n}=e.node;if(!n)throw new Error("Expected class to have a name");const o=n.name;const i=r.get(o)||[];if(i.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,i,a.identifier(o)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}},VariableDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;Object.keys(e.getOuterBindingIdentifiers()).forEach((n=>{const o=r.get(n)||[];if(o.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,o,a.identifier(n)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}}))}};const buildBindingExportAssignmentExpression=(e,t,r)=>(t||[]).reduce(((t,r)=>{const{stringSpecifiers:s}=e;const n=s.has(r);return a.assignmentExpression("=",a.memberExpression(a.identifier(e.exportName),n?a.stringLiteral(r):a.identifier(r),n),t)}),r);const buildImportThrow=e=>n.default.expression.ast` (function() { throw new Error('"' + '${e}' + '" is read-only.'); })() - `;const l={ReferencedIdentifier(e){const{seen:t,buildImportReference:r,scope:s,imported:n,requeueInParent:o}=this;if(t.has(e.node))return;t.add(e.node);const i=e.node.name;const l=n.get(i);if(l){const t=e.scope.getBinding(i);const n=s.getBinding(i);if(n!==t)return;const c=r(l,e.node);c.loc=e.node.loc;if((e.parentPath.isCallExpression({callee:e.node})||e.parentPath.isOptionalCallExpression({callee:e.node})||e.parentPath.isTaggedTemplateExpression({tag:e.node}))&&a.isMemberExpression(c)){e.replaceWith(a.sequenceExpression([a.numericLiteral(0),c]))}else if(e.isJSXIdentifier()&&a.isMemberExpression(c)){const{object:t,property:r}=c;e.replaceWith(a.jsxMemberExpression(a.jsxIdentifier(t.name),a.jsxIdentifier(r.name)))}else{e.replaceWith(c)}o(e);e.skip()}},AssignmentExpression:{exit(e){const{scope:t,seen:r,imported:n,exported:o,requeueInParent:i,buildImportReference:l}=this;if(r.has(e.node))return;r.add(e.node);const c=e.get("left");if(c.isMemberExpression())return;if(c.isIdentifier()){const r=c.node.name;if(t.getBinding(r)!==e.scope.getBinding(r)){return}const u=o.get(r);const p=n.get(r);if((u==null?void 0:u.length)>0||p){s(e.node.operator==="=","Path was not simplified");const t=e.node;if(p){t.left=l(p,t.left);t.right=a.sequenceExpression([t.right,buildImportThrow(r)])}e.replaceWith(buildBindingExportAssignmentExpression(this.metadata,u,t));i(e)}}else{const r=c.getOuterBindingIdentifiers();const s=Object.keys(r).filter((r=>t.getBinding(r)===e.scope.getBinding(r)));const l=s.find((e=>n.has(e)));if(l){e.node.right=a.sequenceExpression([e.node.right,buildImportThrow(l)])}const u=[];s.forEach((e=>{const t=o.get(e)||[];if(t.length>0){u.push(buildBindingExportAssignmentExpression(this.metadata,t,a.identifier(e)))}}));if(u.length>0){let t=a.sequenceExpression(u);if(e.parentPath.isExpressionStatement()){t=a.expressionStatement(t);t._blockHoist=e.parentPath.node._blockHoist}const r=e.insertAfter(t)[0];i(r)}}}},"ForOfStatement|ForInStatement"(e){const{scope:t,node:r}=e;const{left:s}=r;const{exported:n,imported:o,scope:i}=this;if(!a.isVariableDeclaration(s)){let r=false,l;const c=e.get("body").scope;for(const e of Object.keys(a.getOuterBindingIdentifiers(s))){if(i.getBinding(e)===t.getBinding(e)){if(n.has(e)){r=true;if(c.hasOwnBinding(e)){c.rename(e)}}if(o.has(e)&&!l){l=e}}}if(!r&&!l){return}e.ensureBlock();const u=e.get("body");const p=t.generateUidIdentifierBasedOnNode(s);e.get("left").replaceWith(a.variableDeclaration("let",[a.variableDeclarator(a.cloneNode(p))]));t.registerDeclaration(e.get("left"));if(r){u.unshiftContainer("body",a.expressionStatement(a.assignmentExpression("=",s,p)))}if(l){u.unshiftContainer("body",a.expressionStatement(buildImportThrow(l)))}}}}},8831:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteThis;var s=r(5438);var a=r(7369);var n=r(8622);function rewriteThis(e){(0,a.default)(e.node,Object.assign({},o,{noScope:true}))}const o=a.default.visitors.merge([s.environmentVisitor,{ThisExpression(e){e.replaceWith(n.unaryExpression("void",n.numericLiteral(0),true))}}])},457:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5438:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.skipAllButComputedKey=skipAllButComputedKey;t["default"]=t.environmentVisitor=void 0;var s=r(7369);var a=r(409);var n=r(6721);var o=r(8622);function getPrototypeOfExpression(e,t,r,s){e=o.cloneNode(e);const a=t||s?e:o.memberExpression(e,o.identifier("prototype"));return o.callExpression(r.addHelper("getPrototypeOf"),[a])}function skipAllButComputedKey(e){if(!e.node.computed){e.skip();return}const t=o.VISITOR_KEYS[e.type];for(const r of t){if(r!=="key")e.skipKey(r)}}const i={[`${o.staticBlock?"StaticBlock|":""}ClassPrivateProperty|TypeAnnotation`](e){e.skip()},Function(e){if(e.isMethod())return;if(e.isArrowFunctionExpression())return;e.skip()},"Method|ClassProperty"(e){skipAllButComputedKey(e)}};t.environmentVisitor=i;const l=s.default.visitors.merge([i,{Super(e,t){const{node:r,parentPath:s}=e;if(!s.isMemberExpression({object:r}))return;t.handle(s)}}]);const c=s.default.visitors.merge([i,{Scopable(e,{refName:t}){const r=e.scope.getOwnBinding(t);if(r&&r.identifier.name===t){e.scope.rename(t)}}}]);const u={memoise(e,t){const{scope:r,node:s}=e;const{computed:a,property:n}=s;if(!a){return}const o=r.maybeGenerateMemoised(n);if(!o){return}this.memoiser.set(n,o,t)},prop(e){const{computed:t,property:r}=e.node;if(this.memoiser.has(r)){return o.cloneNode(this.memoiser.get(r))}if(t){return o.cloneNode(r)}return o.stringLiteral(r.name)},get(e){return this._get(e,this._getThisRefs())},_get(e,t){const r=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("get"),[t.memo?o.sequenceExpression([t.memo,r]):r,this.prop(e),t.this])},_getThisRefs(){if(!this.isDerivedConstructor){return{this:o.thisExpression()}}const e=this.scope.generateDeclaredUidIdentifier("thisSuper");return{memo:o.assignmentExpression("=",e,o.thisExpression()),this:o.cloneNode(e)}},set(e,t){const r=this._getThisRefs();const s=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("set"),[r.memo?o.sequenceExpression([r.memo,s]):s,this.prop(e),t,r.this,o.booleanLiteral(e.isInStrictMode())])},destructureSet(e){throw e.buildCodeFrameError(`Destructuring to a super field is not supported yet.`)},call(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,false)},optionalCall(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,true)}};const p=Object.assign({},u,{prop(e){const{property:t}=e.node;if(this.memoiser.has(t)){return o.cloneNode(this.memoiser.get(t))}return o.cloneNode(t)},get(e){const{isStatic:t,getSuperRef:r}=this;const{computed:s}=e.node;const a=this.prop(e);let n;if(t){var i;n=(i=r())!=null?i:o.memberExpression(o.identifier("Function"),o.identifier("prototype"))}else{var l;n=o.memberExpression((l=r())!=null?l:o.identifier("Object"),o.identifier("prototype"))}return o.memberExpression(n,a,s)},set(e,t){const{computed:r}=e.node;const s=this.prop(e);return o.assignmentExpression("=",o.memberExpression(o.thisExpression(),s,r),t)},destructureSet(e){const{computed:t}=e.node;const r=this.prop(e);return o.memberExpression(o.thisExpression(),r,t)},call(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,false)},optionalCall(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,true)}});class ReplaceSupers{constructor(e){var t;const r=e.methodPath;this.methodPath=r;this.isDerivedConstructor=r.isClassMethod({kind:"constructor"})&&!!e.superRef;this.isStatic=r.isObjectMethod()||r.node.static||(r.isStaticBlock==null?void 0:r.isStaticBlock());this.isPrivateMethod=r.isPrivate()&&r.isMethod();this.file=e.file;this.constantSuper=(t=e.constantSuper)!=null?t:e.isLoose;this.opts=e}getObjectRef(){return o.cloneNode(this.opts.objectRef||this.opts.getObjectRef())}getSuperRef(){if(this.opts.superRef)return o.cloneNode(this.opts.superRef);if(this.opts.getSuperRef)return o.cloneNode(this.opts.getSuperRef())}replace(){if(this.opts.refToPreserve){this.methodPath.traverse(c,{refName:this.opts.refToPreserve.name})}const e=this.constantSuper?p:u;(0,a.default)(this.methodPath,l,Object.assign({file:this.file,scope:this.methodPath.scope,isDerivedConstructor:this.isDerivedConstructor,isStatic:this.isStatic,isPrivateMethod:this.isPrivateMethod,getObjectRef:this.getObjectRef.bind(this),getSuperRef:this.getSuperRef.bind(this),boundGet:e.get},e))}}t["default"]=ReplaceSupers},9553:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=simplifyAccess;var s=r(8622);function simplifyAccess(e,t){e.traverse(a,{scope:e.scope,bindingNames:t,seen:new WeakSet})}const a={UpdateExpression:{exit(e){const{scope:t,bindingNames:r}=this;const a=e.get("argument");if(!a.isIdentifier())return;const n=a.node.name;if(!r.has(n))return;if(t.getBinding(n)!==e.scope.getBinding(n)){return}if(e.parentPath.isExpressionStatement()&&!e.isCompletionRecord()){const t=e.node.operator=="++"?"+=":"-=";e.replaceWith(s.assignmentExpression(t,a.node,s.numericLiteral(1)))}else if(e.node.prefix){e.replaceWith(s.assignmentExpression("=",s.identifier(n),s.binaryExpression(e.node.operator[0],s.unaryExpression("+",a.node),s.numericLiteral(1))))}else{const t=e.scope.generateUidIdentifierBasedOnNode(a.node,"old");const r=t.name;e.scope.push({id:t});const n=s.binaryExpression(e.node.operator[0],s.identifier(r),s.numericLiteral(1));e.replaceWith(s.sequenceExpression([s.assignmentExpression("=",s.identifier(r),s.unaryExpression("+",a.node)),s.assignmentExpression("=",s.cloneNode(a.node),n),s.identifier(r)]))}}},AssignmentExpression:{exit(e){const{scope:t,seen:r,bindingNames:a}=this;if(e.node.operator==="=")return;if(r.has(e.node))return;r.add(e.node);const n=e.get("left");if(!n.isIdentifier())return;const o=n.node.name;if(!a.has(o))return;if(t.getBinding(o)!==e.scope.getBinding(o)){return}const i=e.node.operator.slice(0,-1);if(s.LOGICAL_OPERATORS.includes(i)){e.replaceWith(s.logicalExpression(i,e.node.left,s.assignmentExpression("=",s.cloneNode(e.node.left),e.node.right)))}else{e.node.right=s.binaryExpression(i,s.cloneNode(e.node.left),e.node.right);e.node.operator="="}}}}},199:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(199);var a=r(1683)},1683:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},730:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getExportSpecifierName=getExportSpecifierName;t["default"]=void 0;var s=r(4141);var a=r(5327);var n=r(8304);var o=r(7047);var i=r(2595);var l=r(1815);const c=(0,n.template)(`\n SYSTEM_REGISTER(MODULE_NAME, SOURCES, function (EXPORT_IDENTIFIER, CONTEXT_IDENTIFIER) {\n "use strict";\n BEFORE_BODY;\n return {\n setters: SETTERS,\n execute: EXECUTE,\n };\n });\n`);const u=(0,n.template)(`\n for (var KEY in TARGET) {\n if (KEY !== "default" && KEY !== "__esModule") EXPORT_OBJ[KEY] = TARGET[KEY];\n }\n`);const p=`WARNING: Dynamic import() transformation must be enabled using the\n @babel/plugin-proposal-dynamic-import plugin. Babel 8 will\n no longer transform import() without using that plugin.\n`;const d=null&&`ERROR: Dynamic import() transformation must be enabled using the\n @babel/plugin-proposal-dynamic-import plugin. Babel 8\n no longer transforms import() without using that plugin.\n`;function getExportSpecifierName(e,t){if(e.type==="Identifier"){return e.name}else if(e.type==="StringLiteral"){const r=e.value;if(!(0,l.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.type}`)}}function constructExportCall(e,t,r,s,a,o){const i=[];if(!a){if(r.length===1){i.push(n.types.expressionStatement(n.types.callExpression(t,[n.types.stringLiteral(r[0]),s[0]])))}else{const e=[];for(let t=0;t{e.assertVersion(7);const{systemGlobal:r="System",allowTopLevelThis:s=false}=t;const l=Symbol();const u={"AssignmentExpression|UpdateExpression"(e){if(e.node[l])return;e.node[l]=true;const t=e.get(e.isAssignmentExpression()?"left":"argument");if(t.isObjectPattern()||t.isArrayPattern()){const r=[e.node];for(const s of Object.keys(t.getBindingIdentifiers())){if(this.scope.getBinding(s)!==e.scope.getBinding(s)){return}const t=this.exports[s];if(!t)return;for(const e of t){r.push(this.buildCall(e,n.types.identifier(s)).expression)}}e.replaceWith(n.types.sequenceExpression(r));return}if(!t.isIdentifier())return;const r=t.node.name;if(this.scope.getBinding(r)!==e.scope.getBinding(r))return;const s=this.exports[r];if(!s)return;let a=e.node;const o=e.isUpdateExpression({prefix:false});if(o){a=n.types.binaryExpression(a.operator[0],n.types.unaryExpression("+",n.types.cloneNode(a.argument)),n.types.numericLiteral(1))}for(const e of s){a=this.buildCall(e,a).expression}if(o){a=n.types.sequenceExpression([a,e.node])}e.replaceWith(a)}};return{name:"transform-modules-systemjs",pre(){this.file.set("@babel/plugin-transform-modules-*","systemjs")},visitor:{CallExpression(e,t){if(n.types.isImport(e.node.callee)){if(!this.file.has("@babel/plugin-proposal-dynamic-import")){{console.warn(p)}}e.replaceWith(n.types.callExpression(n.types.memberExpression(n.types.identifier(t.contextIdent),n.types.identifier("import")),[(0,o.getImportSource)(n.types,e.node)]))}},MetaProperty(e,t){if(e.node.meta.name==="import"&&e.node.property.name==="meta"){e.replaceWith(n.types.memberExpression(n.types.identifier(t.contextIdent),n.types.identifier("meta")))}},ReferencedIdentifier(e,t){if(e.node.name==="__moduleName"&&!e.scope.hasBinding("__moduleName")){e.replaceWith(n.types.memberExpression(n.types.identifier(t.contextIdent),n.types.identifier("id")))}},Program:{enter(e,t){t.contextIdent=e.scope.generateUid("context");t.stringSpecifiers=new Set;if(!s){(0,i.rewriteThis)(e)}},exit(e,s){const o=e.scope;const l=o.generateUid("export");const{contextIdent:p,stringSpecifiers:d}=s;const f=Object.create(null);const m=[];let y=[];const g=[];const h=[];const b=[];const x=[];function addExportName(e,t){f[e]=f[e]||[];f[e].push(t)}function pushModule(e,t,r){let s;m.forEach((function(t){if(t.key===e){s=t}}));if(!s){m.push(s={key:e,imports:[],exports:[]})}s[t]=s[t].concat(r)}function buildExportCall(e,t){return n.types.expressionStatement(n.types.callExpression(n.types.identifier(l),[n.types.stringLiteral(e),t]))}const v=[];const E=[];const j=e.get("body");for(const e of j){if(e.isFunctionDeclaration()){y.push(e.node);x.push(e)}else if(e.isClassDeclaration()){b.push(n.types.cloneNode(e.node.id));e.replaceWith(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.cloneNode(e.node.id),n.types.toExpression(e.node))))}else if(e.isImportDeclaration()){const t=e.node.source.value;pushModule(t,"imports",e.node.specifiers);for(const t of Object.keys(e.getBindingIdentifiers())){o.removeBinding(t);b.push(n.types.identifier(t))}e.remove()}else if(e.isExportAllDeclaration()){pushModule(e.node.source.value,"exports",e.node);e.remove()}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");const r=t.node.id;if(t.isClassDeclaration()){if(r){v.push("default");E.push(o.buildUndefinedNode());b.push(n.types.cloneNode(r));addExportName(r.name,"default");e.replaceWith(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.cloneNode(r),n.types.toExpression(t.node))))}else{v.push("default");E.push(n.types.toExpression(t.node));x.push(e)}}else if(t.isFunctionDeclaration()){if(r){y.push(t.node);v.push("default");E.push(n.types.cloneNode(r));addExportName(r.name,"default")}else{v.push("default");E.push(n.types.toExpression(t.node))}x.push(e)}else{e.replaceWith(buildExportCall("default",t.node))}}else if(e.isExportNamedDeclaration()){const t=e.get("declaration");if(t.node){e.replaceWith(t);if(e.isFunction()){const r=t.node;const s=r.id.name;addExportName(s,s);y.push(r);v.push(s);E.push(n.types.cloneNode(r.id));x.push(e)}else if(e.isClass()){const r=t.node.id.name;v.push(r);E.push(o.buildUndefinedNode());b.push(n.types.cloneNode(t.node.id));e.replaceWith(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.cloneNode(t.node.id),n.types.toExpression(t.node))));addExportName(r,r)}else{for(const e of Object.keys(t.getBindingIdentifiers())){addExportName(e,e)}}}else{const t=e.node.specifiers;if(t!=null&&t.length){if(e.node.source){pushModule(e.node.source.value,"exports",t);e.remove()}else{const r=[];for(const e of t){const{local:t,exported:s}=e;const a=o.getBinding(t.name);const i=getExportSpecifierName(s,d);if(a&&n.types.isFunctionDeclaration(a.path.node)){v.push(i);E.push(n.types.cloneNode(t))}else if(!a){r.push(buildExportCall(i,t))}addExportName(t.name,i)}e.replaceWithMultiple(r)}}else{e.remove()}}}}m.forEach((function(t){let r=[];const s=o.generateUid(t.key);for(let e of t.imports){if(n.types.isImportNamespaceSpecifier(e)){r.push(n.types.expressionStatement(n.types.assignmentExpression("=",e.local,n.types.identifier(s))))}else if(n.types.isImportDefaultSpecifier(e)){e=n.types.importSpecifier(e.local,n.types.identifier("default"))}if(n.types.isImportSpecifier(e)){const{imported:t}=e;r.push(n.types.expressionStatement(n.types.assignmentExpression("=",e.local,n.types.memberExpression(n.types.identifier(s),e.imported,t.type==="StringLiteral"))))}}if(t.exports.length){const a=[];const o=[];let i=false;for(const e of t.exports){if(n.types.isExportAllDeclaration(e)){i=true}else if(n.types.isExportSpecifier(e)){const t=getExportSpecifierName(e.exported,d);a.push(t);o.push(n.types.memberExpression(n.types.identifier(s),e.local,n.types.isStringLiteral(e.local)))}else{}}r=r.concat(constructExportCall(e,n.types.identifier(l),a,o,i?n.types.identifier(s):null,d))}h.push(n.types.stringLiteral(t.key));g.push(n.types.functionExpression(null,[n.types.identifier(s)],n.types.blockStatement(r)))}));let w=(0,i.getModuleName)(this.file.opts,t);if(w)w=n.types.stringLiteral(w);(0,a.default)(e,((e,t,r)=>{b.push(e);if(!r&&t in f){for(const e of f[t]){v.push(e);E.push(o.buildUndefinedNode())}}}),null);if(b.length){y.unshift(n.types.variableDeclaration("var",b.map((e=>n.types.variableDeclarator(e)))))}if(v.length){y=y.concat(constructExportCall(e,n.types.identifier(l),v,E,null,d))}e.traverse(u,{exports:f,buildCall:buildExportCall,scope:o});for(const e of x){e.remove()}let _=false;e.traverse({AwaitExpression(e){_=true;e.stop()},Function(e){e.skip()},noScope:true});e.node.body=[c({SYSTEM_REGISTER:n.types.memberExpression(n.types.identifier(r),n.types.identifier("register")),BEFORE_BODY:y,MODULE_NAME:w,SETTERS:n.types.arrayExpression(g),EXECUTE:n.types.functionExpression(null,[],n.types.blockStatement(e.node.body),false,_),SOURCES:n.types.arrayExpression(h),EXPORT_IDENTIFIER:n.types.identifier(l),CONTEXT_IDENTIFIER:n.types.identifier(p)})]}}}}}));t["default"]=f},5210:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=getModuleName;{const e=getModuleName;t["default"]=getModuleName=function getModuleName(t,r){var s,a,n,o;return e(t,{moduleId:(s=r.moduleId)!=null?s:t.moduleId,moduleIds:(a=r.moduleIds)!=null?a:t.moduleIds,getModuleId:(n=r.getModuleId)!=null?n:t.getModuleId,moduleRoot:(o=r.moduleRoot)!=null?o:t.moduleRoot})}}function getModuleName(e,t){const{filename:r,filenameRelative:s=r,sourceRoot:a=t.moduleRoot}=e;const{moduleId:n,moduleIds:o=!!n,getModuleId:i,moduleRoot:l=a}=t;if(!o)return null;if(n!=null&&!i){return n}let c=l!=null?l+"/":"";if(s){const e=a!=null?new RegExp("^"+a+"/?"):"";c+=s.replace(e,"").replace(/\.(\w*?)$/,"")}c=c.replace(/\\/g,"/");if(i){return i(c)||c}else{return c}}},2595:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.rewriteModuleStatementsAndPrepareHeader=rewriteModuleStatementsAndPrepareHeader;t.ensureStatementsHoisted=ensureStatementsHoisted;t.wrapInterop=wrapInterop;t.buildNamespaceInitStatements=buildNamespaceInitStatements;Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return o.isModule}});Object.defineProperty(t,"rewriteThis",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"hasExports",{enumerable:true,get:function(){return c.hasExports}});Object.defineProperty(t,"isSideEffectImport",{enumerable:true,get:function(){return c.isSideEffectImport}});Object.defineProperty(t,"getModuleName",{enumerable:true,get:function(){return u.default}});var s=r(9491);var a=r(8622);var n=r(153);var o=r(6039);var i=r(2835);var l=r(1238);var c=r(2461);var u=r(5210);function rewriteModuleStatementsAndPrepareHeader(e,{loose:t,exportName:r,strict:n,allowTopLevelThis:u,strictMode:p,noInterop:d,importInterop:f=(d?"none":"babel"),lazy:m,esNamespaceOnly:y,constantReexports:g=t,enumerableModuleMeta:h=t}){(0,c.validateImportInteropOption)(f);s((0,o.isModule)(e),"Cannot process module statements in a script");e.node.sourceType="script";const b=(0,c.default)(e,r,{importInterop:f,initializeReexports:g,lazy:m,esNamespaceOnly:y});if(!u){(0,i.default)(e)}(0,l.default)(e,b);if(p!==false){const t=e.node.directives.some((e=>e.value.value==="use strict"));if(!t){e.unshiftContainer("directives",a.directive(a.directiveLiteral("use strict")))}}const x=[];if((0,c.hasExports)(b)&&!n){x.push(buildESModuleHeader(b,h))}const v=buildExportNameListDeclaration(e,b);if(v){b.exportNameListName=v.name;x.push(v.statement)}x.push(...buildExportInitializationStatements(e,b,g));return{meta:b,headers:x}}function ensureStatementsHoisted(e){e.forEach((e=>{e._blockHoist=3}))}function wrapInterop(e,t,r){if(r==="none"){return null}if(r==="node-namespace"){return a.callExpression(e.hub.addHelper("interopRequireWildcard"),[t,a.booleanLiteral(true)])}else if(r==="node-default"){return null}let s;if(r==="default"){s="interopRequireDefault"}else if(r==="namespace"){s="interopRequireWildcard"}else{throw new Error(`Unknown interop: ${r}`)}return a.callExpression(e.hub.addHelper(s),[t])}function buildNamespaceInitStatements(e,t,r=false){const s=[];let o=a.identifier(t.name);if(t.lazy)o=a.callExpression(o,[]);for(const e of t.importsNamespace){if(e===t.name)continue;s.push(n.default.statement`var NAME = SOURCE;`({NAME:e,SOURCE:a.cloneNode(o)}))}if(r){s.push(...buildReexportsFromMeta(e,t,true))}for(const r of t.reexportNamespace){s.push((t.lazy?n.default.statement` + `;const l={ReferencedIdentifier(e){const{seen:t,buildImportReference:r,scope:s,imported:n,requeueInParent:o}=this;if(t.has(e.node))return;t.add(e.node);const i=e.node.name;const l=n.get(i);if(l){const t=e.scope.getBinding(i);const n=s.getBinding(i);if(n!==t)return;const c=r(l,e.node);c.loc=e.node.loc;if((e.parentPath.isCallExpression({callee:e.node})||e.parentPath.isOptionalCallExpression({callee:e.node})||e.parentPath.isTaggedTemplateExpression({tag:e.node}))&&a.isMemberExpression(c)){e.replaceWith(a.sequenceExpression([a.numericLiteral(0),c]))}else if(e.isJSXIdentifier()&&a.isMemberExpression(c)){const{object:t,property:r}=c;e.replaceWith(a.jsxMemberExpression(a.jsxIdentifier(t.name),a.jsxIdentifier(r.name)))}else{e.replaceWith(c)}o(e);e.skip()}},AssignmentExpression:{exit(e){const{scope:t,seen:r,imported:n,exported:o,requeueInParent:i,buildImportReference:l}=this;if(r.has(e.node))return;r.add(e.node);const c=e.get("left");if(c.isMemberExpression())return;if(c.isIdentifier()){const r=c.node.name;if(t.getBinding(r)!==e.scope.getBinding(r)){return}const u=o.get(r);const p=n.get(r);if((u==null?void 0:u.length)>0||p){s(e.node.operator==="=","Path was not simplified");const t=e.node;if(p){t.left=l(p,t.left);t.right=a.sequenceExpression([t.right,buildImportThrow(r)])}e.replaceWith(buildBindingExportAssignmentExpression(this.metadata,u,t));i(e)}}else{const r=c.getOuterBindingIdentifiers();const s=Object.keys(r).filter((r=>t.getBinding(r)===e.scope.getBinding(r)));const l=s.find((e=>n.has(e)));if(l){e.node.right=a.sequenceExpression([e.node.right,buildImportThrow(l)])}const u=[];s.forEach((e=>{const t=o.get(e)||[];if(t.length>0){u.push(buildBindingExportAssignmentExpression(this.metadata,t,a.identifier(e)))}}));if(u.length>0){let t=a.sequenceExpression(u);if(e.parentPath.isExpressionStatement()){t=a.expressionStatement(t);t._blockHoist=e.parentPath.node._blockHoist}const r=e.insertAfter(t)[0];i(r)}}}},"ForOfStatement|ForInStatement"(e){const{scope:t,node:r}=e;const{left:s}=r;const{exported:n,imported:o,scope:i}=this;if(!a.isVariableDeclaration(s)){let r=false,l;const c=e.get("body").scope;for(const e of Object.keys(a.getOuterBindingIdentifiers(s))){if(i.getBinding(e)===t.getBinding(e)){if(n.has(e)){r=true;if(c.hasOwnBinding(e)){c.rename(e)}}if(o.has(e)&&!l){l=e}}}if(!r&&!l){return}e.ensureBlock();const u=e.get("body");const p=t.generateUidIdentifierBasedOnNode(s);e.get("left").replaceWith(a.variableDeclaration("let",[a.variableDeclarator(a.cloneNode(p))]));t.registerDeclaration(e.get("left"));if(r){u.unshiftContainer("body",a.expressionStatement(a.assignmentExpression("=",s,p)))}if(l){u.unshiftContainer("body",a.expressionStatement(buildImportThrow(l)))}}}}},8831:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteThis;var s=r(5438);var a=r(7369);var n=r(8622);function rewriteThis(e){(0,a.default)(e.node,Object.assign({},o,{noScope:true}))}const o=a.default.visitors.merge([s.environmentVisitor,{ThisExpression(e){e.replaceWith(n.unaryExpression("void",n.numericLiteral(0),true))}}])},457:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5438:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.skipAllButComputedKey=skipAllButComputedKey;t["default"]=t.environmentVisitor=void 0;var s=r(7369);var a=r(409);var n=r(6721);var o=r(8622);function getPrototypeOfExpression(e,t,r,s){e=o.cloneNode(e);const a=t||s?e:o.memberExpression(e,o.identifier("prototype"));return o.callExpression(r.addHelper("getPrototypeOf"),[a])}function skipAllButComputedKey(e){if(!e.node.computed){e.skip();return}const t=o.VISITOR_KEYS[e.type];for(const r of t){if(r!=="key")e.skipKey(r)}}const i={[`${o.staticBlock?"StaticBlock|":""}ClassPrivateProperty|TypeAnnotation`](e){e.skip()},Function(e){if(e.isMethod())return;if(e.isArrowFunctionExpression())return;e.skip()},"Method|ClassProperty"(e){skipAllButComputedKey(e)}};t.environmentVisitor=i;const l=s.default.visitors.merge([i,{Super(e,t){const{node:r,parentPath:s}=e;if(!s.isMemberExpression({object:r}))return;t.handle(s)}}]);const c=s.default.visitors.merge([i,{Scopable(e,{refName:t}){const r=e.scope.getOwnBinding(t);if(r&&r.identifier.name===t){e.scope.rename(t)}}}]);const u={memoise(e,t){const{scope:r,node:s}=e;const{computed:a,property:n}=s;if(!a){return}const o=r.maybeGenerateMemoised(n);if(!o){return}this.memoiser.set(n,o,t)},prop(e){const{computed:t,property:r}=e.node;if(this.memoiser.has(r)){return o.cloneNode(this.memoiser.get(r))}if(t){return o.cloneNode(r)}return o.stringLiteral(r.name)},get(e){return this._get(e,this._getThisRefs())},_get(e,t){const r=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("get"),[t.memo?o.sequenceExpression([t.memo,r]):r,this.prop(e),t.this])},_getThisRefs(){if(!this.isDerivedConstructor){return{this:o.thisExpression()}}const e=this.scope.generateDeclaredUidIdentifier("thisSuper");return{memo:o.assignmentExpression("=",e,o.thisExpression()),this:o.cloneNode(e)}},set(e,t){const r=this._getThisRefs();const s=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("set"),[r.memo?o.sequenceExpression([r.memo,s]):s,this.prop(e),t,r.this,o.booleanLiteral(e.isInStrictMode())])},destructureSet(e){throw e.buildCodeFrameError(`Destructuring to a super field is not supported yet.`)},call(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,false)},optionalCall(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,true)}};const p=Object.assign({},u,{prop(e){const{property:t}=e.node;if(this.memoiser.has(t)){return o.cloneNode(this.memoiser.get(t))}return o.cloneNode(t)},get(e){const{isStatic:t,getSuperRef:r}=this;const{computed:s}=e.node;const a=this.prop(e);let n;if(t){var i;n=(i=r())!=null?i:o.memberExpression(o.identifier("Function"),o.identifier("prototype"))}else{var l;n=o.memberExpression((l=r())!=null?l:o.identifier("Object"),o.identifier("prototype"))}return o.memberExpression(n,a,s)},set(e,t){const{computed:r}=e.node;const s=this.prop(e);return o.assignmentExpression("=",o.memberExpression(o.thisExpression(),s,r),t)},destructureSet(e){const{computed:t}=e.node;const r=this.prop(e);return o.memberExpression(o.thisExpression(),r,t)},call(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,false)},optionalCall(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,true)}});class ReplaceSupers{constructor(e){var t;const r=e.methodPath;this.methodPath=r;this.isDerivedConstructor=r.isClassMethod({kind:"constructor"})&&!!e.superRef;this.isStatic=r.isObjectMethod()||r.node.static||(r.isStaticBlock==null?void 0:r.isStaticBlock());this.isPrivateMethod=r.isPrivate()&&r.isMethod();this.file=e.file;this.constantSuper=(t=e.constantSuper)!=null?t:e.isLoose;this.opts=e}getObjectRef(){return o.cloneNode(this.opts.objectRef||this.opts.getObjectRef())}getSuperRef(){if(this.opts.superRef)return o.cloneNode(this.opts.superRef);if(this.opts.getSuperRef)return o.cloneNode(this.opts.getSuperRef())}replace(){if(this.opts.refToPreserve){this.methodPath.traverse(c,{refName:this.opts.refToPreserve.name})}const e=this.constantSuper?p:u;(0,a.default)(this.methodPath,l,Object.assign({file:this.file,scope:this.methodPath.scope,isDerivedConstructor:this.isDerivedConstructor,isStatic:this.isStatic,isPrivateMethod:this.isPrivateMethod,getObjectRef:this.getObjectRef.bind(this),getSuperRef:this.getSuperRef.bind(this),boundGet:e.get},e))}}t["default"]=ReplaceSupers},9553:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=simplifyAccess;var s=r(8622);function simplifyAccess(e,t){e.traverse(a,{scope:e.scope,bindingNames:t,seen:new WeakSet})}const a={UpdateExpression:{exit(e){const{scope:t,bindingNames:r}=this;const a=e.get("argument");if(!a.isIdentifier())return;const n=a.node.name;if(!r.has(n))return;if(t.getBinding(n)!==e.scope.getBinding(n)){return}if(e.parentPath.isExpressionStatement()&&!e.isCompletionRecord()){const t=e.node.operator=="++"?"+=":"-=";e.replaceWith(s.assignmentExpression(t,a.node,s.numericLiteral(1)))}else if(e.node.prefix){e.replaceWith(s.assignmentExpression("=",s.identifier(n),s.binaryExpression(e.node.operator[0],s.unaryExpression("+",a.node),s.numericLiteral(1))))}else{const t=e.scope.generateUidIdentifierBasedOnNode(a.node,"old");const r=t.name;e.scope.push({id:t});const n=s.binaryExpression(e.node.operator[0],s.identifier(r),s.numericLiteral(1));e.replaceWith(s.sequenceExpression([s.assignmentExpression("=",s.identifier(r),s.unaryExpression("+",a.node)),s.assignmentExpression("=",s.cloneNode(a.node),n),s.identifier(r)]))}}},AssignmentExpression:{exit(e){const{scope:t,seen:r,bindingNames:a}=this;if(e.node.operator==="=")return;if(r.has(e.node))return;r.add(e.node);const n=e.get("left");if(!n.isIdentifier())return;const o=n.node.name;if(!a.has(o))return;if(t.getBinding(o)!==e.scope.getBinding(o)){return}const i=e.node.operator.slice(0,-1);if(s.LOGICAL_OPERATORS.includes(i)){e.replaceWith(s.logicalExpression(i,e.node.left,s.assignmentExpression("=",s.cloneNode(e.node.left),e.node.right)))}else{e.node.right=s.binaryExpression(i,s.cloneNode(e.node.left),e.node.right);e.node.operator="="}}}}},199:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(199);var a=r(1683)},1683:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},730:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getExportSpecifierName=getExportSpecifierName;t["default"]=void 0;var s=r(119);var a=r(5327);var n=r(8304);var o=r(7047);var i=r(2595);var l=r(1815);const c=(0,n.template)(`\n SYSTEM_REGISTER(MODULE_NAME, SOURCES, function (EXPORT_IDENTIFIER, CONTEXT_IDENTIFIER) {\n "use strict";\n BEFORE_BODY;\n return {\n setters: SETTERS,\n execute: EXECUTE,\n };\n });\n`);const u=(0,n.template)(`\n for (var KEY in TARGET) {\n if (KEY !== "default" && KEY !== "__esModule") EXPORT_OBJ[KEY] = TARGET[KEY];\n }\n`);const p=`WARNING: Dynamic import() transformation must be enabled using the\n @babel/plugin-proposal-dynamic-import plugin. Babel 8 will\n no longer transform import() without using that plugin.\n`;const f=null&&`ERROR: Dynamic import() transformation must be enabled using the\n @babel/plugin-proposal-dynamic-import plugin. Babel 8\n no longer transforms import() without using that plugin.\n`;function getExportSpecifierName(e,t){if(e.type==="Identifier"){return e.name}else if(e.type==="StringLiteral"){const r=e.value;if(!(0,l.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.type}`)}}function constructExportCall(e,t,r,s,a,o){const i=[];if(!a){if(r.length===1){i.push(n.types.expressionStatement(n.types.callExpression(t,[n.types.stringLiteral(r[0]),s[0]])))}else{const e=[];for(let t=0;t{e.assertVersion(7);const{systemGlobal:r="System",allowTopLevelThis:s=false}=t;const l=Symbol();const u={"AssignmentExpression|UpdateExpression"(e){if(e.node[l])return;e.node[l]=true;const t=e.get(e.isAssignmentExpression()?"left":"argument");if(t.isObjectPattern()||t.isArrayPattern()){const r=[e.node];for(const s of Object.keys(t.getBindingIdentifiers())){if(this.scope.getBinding(s)!==e.scope.getBinding(s)){return}const t=this.exports[s];if(!t)return;for(const e of t){r.push(this.buildCall(e,n.types.identifier(s)).expression)}}e.replaceWith(n.types.sequenceExpression(r));return}if(!t.isIdentifier())return;const r=t.node.name;if(this.scope.getBinding(r)!==e.scope.getBinding(r))return;const s=this.exports[r];if(!s)return;let a=e.node;const o=e.isUpdateExpression({prefix:false});if(o){a=n.types.binaryExpression(a.operator[0],n.types.unaryExpression("+",n.types.cloneNode(a.argument)),n.types.numericLiteral(1))}for(const e of s){a=this.buildCall(e,a).expression}if(o){a=n.types.sequenceExpression([a,e.node])}e.replaceWith(a)}};return{name:"transform-modules-systemjs",pre(){this.file.set("@babel/plugin-transform-modules-*","systemjs")},visitor:{CallExpression(e,t){if(n.types.isImport(e.node.callee)){if(!this.file.has("@babel/plugin-proposal-dynamic-import")){{console.warn(p)}}e.replaceWith(n.types.callExpression(n.types.memberExpression(n.types.identifier(t.contextIdent),n.types.identifier("import")),[(0,o.getImportSource)(n.types,e.node)]))}},MetaProperty(e,t){if(e.node.meta.name==="import"&&e.node.property.name==="meta"){e.replaceWith(n.types.memberExpression(n.types.identifier(t.contextIdent),n.types.identifier("meta")))}},ReferencedIdentifier(e,t){if(e.node.name==="__moduleName"&&!e.scope.hasBinding("__moduleName")){e.replaceWith(n.types.memberExpression(n.types.identifier(t.contextIdent),n.types.identifier("id")))}},Program:{enter(e,t){t.contextIdent=e.scope.generateUid("context");t.stringSpecifiers=new Set;if(!s){(0,i.rewriteThis)(e)}},exit(e,s){const o=e.scope;const l=o.generateUid("export");const{contextIdent:p,stringSpecifiers:f}=s;const d=Object.create(null);const m=[];let y=[];const g=[];const h=[];const b=[];const x=[];function addExportName(e,t){d[e]=d[e]||[];d[e].push(t)}function pushModule(e,t,r){let s;m.forEach((function(t){if(t.key===e){s=t}}));if(!s){m.push(s={key:e,imports:[],exports:[]})}s[t]=s[t].concat(r)}function buildExportCall(e,t){return n.types.expressionStatement(n.types.callExpression(n.types.identifier(l),[n.types.stringLiteral(e),t]))}const v=[];const E=[];const j=e.get("body");for(const e of j){if(e.isFunctionDeclaration()){y.push(e.node);x.push(e)}else if(e.isClassDeclaration()){b.push(n.types.cloneNode(e.node.id));e.replaceWith(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.cloneNode(e.node.id),n.types.toExpression(e.node))))}else if(e.isImportDeclaration()){const t=e.node.source.value;pushModule(t,"imports",e.node.specifiers);for(const t of Object.keys(e.getBindingIdentifiers())){o.removeBinding(t);b.push(n.types.identifier(t))}e.remove()}else if(e.isExportAllDeclaration()){pushModule(e.node.source.value,"exports",e.node);e.remove()}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");const r=t.node.id;if(t.isClassDeclaration()){if(r){v.push("default");E.push(o.buildUndefinedNode());b.push(n.types.cloneNode(r));addExportName(r.name,"default");e.replaceWith(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.cloneNode(r),n.types.toExpression(t.node))))}else{v.push("default");E.push(n.types.toExpression(t.node));x.push(e)}}else if(t.isFunctionDeclaration()){if(r){y.push(t.node);v.push("default");E.push(n.types.cloneNode(r));addExportName(r.name,"default")}else{v.push("default");E.push(n.types.toExpression(t.node))}x.push(e)}else{e.replaceWith(buildExportCall("default",t.node))}}else if(e.isExportNamedDeclaration()){const t=e.get("declaration");if(t.node){e.replaceWith(t);if(e.isFunction()){const r=t.node;const s=r.id.name;addExportName(s,s);y.push(r);v.push(s);E.push(n.types.cloneNode(r.id));x.push(e)}else if(e.isClass()){const r=t.node.id.name;v.push(r);E.push(o.buildUndefinedNode());b.push(n.types.cloneNode(t.node.id));e.replaceWith(n.types.expressionStatement(n.types.assignmentExpression("=",n.types.cloneNode(t.node.id),n.types.toExpression(t.node))));addExportName(r,r)}else{for(const e of Object.keys(t.getBindingIdentifiers())){addExportName(e,e)}}}else{const t=e.node.specifiers;if(t!=null&&t.length){if(e.node.source){pushModule(e.node.source.value,"exports",t);e.remove()}else{const r=[];for(const e of t){const{local:t,exported:s}=e;const a=o.getBinding(t.name);const i=getExportSpecifierName(s,f);if(a&&n.types.isFunctionDeclaration(a.path.node)){v.push(i);E.push(n.types.cloneNode(t))}else if(!a){r.push(buildExportCall(i,t))}addExportName(t.name,i)}e.replaceWithMultiple(r)}}else{e.remove()}}}}m.forEach((function(t){let r=[];const s=o.generateUid(t.key);for(let e of t.imports){if(n.types.isImportNamespaceSpecifier(e)){r.push(n.types.expressionStatement(n.types.assignmentExpression("=",e.local,n.types.identifier(s))))}else if(n.types.isImportDefaultSpecifier(e)){e=n.types.importSpecifier(e.local,n.types.identifier("default"))}if(n.types.isImportSpecifier(e)){const{imported:t}=e;r.push(n.types.expressionStatement(n.types.assignmentExpression("=",e.local,n.types.memberExpression(n.types.identifier(s),e.imported,t.type==="StringLiteral"))))}}if(t.exports.length){const a=[];const o=[];let i=false;for(const e of t.exports){if(n.types.isExportAllDeclaration(e)){i=true}else if(n.types.isExportSpecifier(e)){const t=getExportSpecifierName(e.exported,f);a.push(t);o.push(n.types.memberExpression(n.types.identifier(s),e.local,n.types.isStringLiteral(e.local)))}else{}}r=r.concat(constructExportCall(e,n.types.identifier(l),a,o,i?n.types.identifier(s):null,f))}h.push(n.types.stringLiteral(t.key));g.push(n.types.functionExpression(null,[n.types.identifier(s)],n.types.blockStatement(r)))}));let w=(0,i.getModuleName)(this.file.opts,t);if(w)w=n.types.stringLiteral(w);(0,a.default)(e,((e,t,r)=>{b.push(e);if(!r&&t in d){for(const e of d[t]){v.push(e);E.push(o.buildUndefinedNode())}}}),null);if(b.length){y.unshift(n.types.variableDeclaration("var",b.map((e=>n.types.variableDeclarator(e)))))}if(v.length){y=y.concat(constructExportCall(e,n.types.identifier(l),v,E,null,f))}e.traverse(u,{exports:d,buildCall:buildExportCall,scope:o});for(const e of x){e.remove()}let _=false;e.traverse({AwaitExpression(e){_=true;e.stop()},Function(e){e.skip()},noScope:true});e.node.body=[c({SYSTEM_REGISTER:n.types.memberExpression(n.types.identifier(r),n.types.identifier("register")),BEFORE_BODY:y,MODULE_NAME:w,SETTERS:n.types.arrayExpression(g),EXECUTE:n.types.functionExpression(null,[],n.types.blockStatement(e.node.body),false,_),SOURCES:n.types.arrayExpression(h),EXPORT_IDENTIFIER:n.types.identifier(l),CONTEXT_IDENTIFIER:n.types.identifier(p)})]}}}}}));t["default"]=d},5210:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=getModuleName;{const e=getModuleName;t["default"]=getModuleName=function getModuleName(t,r){var s,a,n,o;return e(t,{moduleId:(s=r.moduleId)!=null?s:t.moduleId,moduleIds:(a=r.moduleIds)!=null?a:t.moduleIds,getModuleId:(n=r.getModuleId)!=null?n:t.getModuleId,moduleRoot:(o=r.moduleRoot)!=null?o:t.moduleRoot})}}function getModuleName(e,t){const{filename:r,filenameRelative:s=r,sourceRoot:a=t.moduleRoot}=e;const{moduleId:n,moduleIds:o=!!n,getModuleId:i,moduleRoot:l=a}=t;if(!o)return null;if(n!=null&&!i){return n}let c=l!=null?l+"/":"";if(s){const e=a!=null?new RegExp("^"+a+"/?"):"";c+=s.replace(e,"").replace(/\.(\w*?)$/,"")}c=c.replace(/\\/g,"/");if(i){return i(c)||c}else{return c}}},2595:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.rewriteModuleStatementsAndPrepareHeader=rewriteModuleStatementsAndPrepareHeader;t.ensureStatementsHoisted=ensureStatementsHoisted;t.wrapInterop=wrapInterop;t.buildNamespaceInitStatements=buildNamespaceInitStatements;Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return o.isModule}});Object.defineProperty(t,"rewriteThis",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"hasExports",{enumerable:true,get:function(){return c.hasExports}});Object.defineProperty(t,"isSideEffectImport",{enumerable:true,get:function(){return c.isSideEffectImport}});Object.defineProperty(t,"getModuleName",{enumerable:true,get:function(){return u.default}});var s=r(9491);var a=r(8622);var n=r(153);var o=r(9115);var i=r(2835);var l=r(1238);var c=r(2461);var u=r(5210);function rewriteModuleStatementsAndPrepareHeader(e,{loose:t,exportName:r,strict:n,allowTopLevelThis:u,strictMode:p,noInterop:f,importInterop:d=(f?"none":"babel"),lazy:m,esNamespaceOnly:y,constantReexports:g=t,enumerableModuleMeta:h=t}){(0,c.validateImportInteropOption)(d);s((0,o.isModule)(e),"Cannot process module statements in a script");e.node.sourceType="script";const b=(0,c.default)(e,r,{importInterop:d,initializeReexports:g,lazy:m,esNamespaceOnly:y});if(!u){(0,i.default)(e)}(0,l.default)(e,b);if(p!==false){const t=e.node.directives.some((e=>e.value.value==="use strict"));if(!t){e.unshiftContainer("directives",a.directive(a.directiveLiteral("use strict")))}}const x=[];if((0,c.hasExports)(b)&&!n){x.push(buildESModuleHeader(b,h))}const v=buildExportNameListDeclaration(e,b);if(v){b.exportNameListName=v.name;x.push(v.statement)}x.push(...buildExportInitializationStatements(e,b,g));return{meta:b,headers:x}}function ensureStatementsHoisted(e){e.forEach((e=>{e._blockHoist=3}))}function wrapInterop(e,t,r){if(r==="none"){return null}if(r==="node-namespace"){return a.callExpression(e.hub.addHelper("interopRequireWildcard"),[t,a.booleanLiteral(true)])}else if(r==="node-default"){return null}let s;if(r==="default"){s="interopRequireDefault"}else if(r==="namespace"){s="interopRequireWildcard"}else{throw new Error(`Unknown interop: ${r}`)}return a.callExpression(e.hub.addHelper(s),[t])}function buildNamespaceInitStatements(e,t,r=false){const s=[];let o=a.identifier(t.name);if(t.lazy)o=a.callExpression(o,[]);for(const e of t.importsNamespace){if(e===t.name)continue;s.push(n.default.statement`var NAME = SOURCE;`({NAME:e,SOURCE:a.cloneNode(o)}))}if(r){s.push(...buildReexportsFromMeta(e,t,true))}for(const r of t.reexportNamespace){s.push((t.lazy?n.default.statement` Object.defineProperty(EXPORTS, "NAME", { enumerable: true, get: function() { @@ -323,11 +248,11 @@ }); `)({NAMESPACE:t,EXPORTS:e.exportName,VERIFY_NAME_LIST:e.exportNameListName?(0,n.default)` if (Object.prototype.hasOwnProperty.call(EXPORTS_LIST, key)) return; - `({EXPORTS_LIST:e.exportNameListName}):null})}function buildExportNameListDeclaration(e,t){const r=Object.create(null);for(const e of t.local.values()){for(const t of e.names){r[t]=true}}let s=false;for(const e of t.source.values()){for(const t of e.reexports.keys()){r[t]=true}for(const t of e.reexportNamespace){r[t]=true}s=s||!!e.reexportAll}if(!s||Object.keys(r).length===0)return null;const n=e.scope.generateUidIdentifier("exportNames");delete r.default;return{name:n.name,statement:a.variableDeclaration("var",[a.variableDeclarator(n,a.valueToNode(r))])}}function buildExportInitializationStatements(e,t,r=false){const s=[];const n=[];for(const[e,r]of t.local){if(r.kind==="import"){}else if(r.kind==="hoisted"){s.push(buildInitStatement(t,r.names,a.identifier(e)))}else{n.push(...r.names)}}for(const e of t.source.values()){if(!r){s.push(...buildReexportsFromMeta(t,e,false))}for(const t of e.reexportNamespace){n.push(t)}}s.push(...chunk(n,100).map((r=>buildInitStatement(t,r,e.scope.buildUndefinedNode()))));return s}const d={computed:n.default.expression`EXPORTS["NAME"] = VALUE`,default:n.default.expression`EXPORTS.NAME = VALUE`};function buildInitStatement(e,t,r){const{stringSpecifiers:s,exportName:n}=e;return a.expressionStatement(t.reduce(((e,t)=>{const r={EXPORTS:n,NAME:t,VALUE:e};if(s.has(t)){return d.computed(r)}else{return d.default(r)}}),r))}function chunk(e,t){const r=[];for(let s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasExports=hasExports;t.isSideEffectImport=isSideEffectImport;t.validateImportInteropOption=validateImportInteropOption;t["default"]=normalizeModuleAndLoadMetadata;var s=r(1017);var a=r(1815);var n=r(7058);function hasExports(e){return e.hasExports}function isSideEffectImport(e){return e.imports.size===0&&e.importsNamespace.size===0&&e.reexports.size===0&&e.reexportNamespace.size===0&&!e.reexportAll}function validateImportInteropOption(e){if(typeof e!=="function"&&e!=="none"&&e!=="babel"&&e!=="node"){throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${e}).`)}return e}function resolveImportInterop(e,t){if(typeof e==="function"){return validateImportInteropOption(e(t))}return e}function normalizeModuleAndLoadMetadata(e,t,{importInterop:r,initializeReexports:s=false,lazy:a=false,esNamespaceOnly:n=false}){if(!t){t=e.scope.generateUidIdentifier("exports").name}const o=new Set;nameAnonymousExports(e);const{local:i,source:l,hasExports:c}=getModuleMetadata(e,{initializeReexports:s,lazy:a},o);removeModuleDeclarations(e);for(const[,e]of l){if(e.importsNamespace.size>0){e.name=e.importsNamespace.values().next().value}const t=resolveImportInterop(r,e.source);if(t==="none"){e.interop="none"}else if(t==="node"&&e.interop==="namespace"){e.interop="node-namespace"}else if(t==="node"&&e.interop==="default"){e.interop="node-default"}else if(n&&e.interop==="namespace"){e.interop="default"}}return{exportName:t,exportNameListName:null,hasExports:c,local:i,source:l,stringSpecifiers:o}}function getExportSpecifierName(e,t){if(e.isIdentifier()){return e.node.name}else if(e.isStringLiteral()){const r=e.node.value;if(!(0,a.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.node.type}`)}}function assertExportSpecifier(e){if(e.isExportSpecifier()){return}else if(e.isExportNamespaceSpecifier()){throw e.buildCodeFrameError("Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.")}else{throw e.buildCodeFrameError("Unexpected export specifier type")}}function getModuleMetadata(e,{lazy:t,initializeReexports:r},a){const n=getLocalExportMetadata(e,r,a);const o=new Map;const getData=t=>{const r=t.value;let a=o.get(r);if(!a){a={name:e.scope.generateUidIdentifier((0,s.basename)(r,(0,s.extname)(r))).name,interop:"none",loc:null,imports:new Map,importsNamespace:new Set,reexports:new Map,reexportNamespace:new Set,reexportAll:null,lazy:false,source:r};o.set(r,a)}return a};let i=false;e.get("body").forEach((e=>{if(e.isImportDeclaration()){const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{if(e.isImportDefaultSpecifier()){const r=e.get("local").node.name;t.imports.set(r,"default");const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexports.set(e,"default")}))}}else if(e.isImportNamespaceSpecifier()){const r=e.get("local").node.name;t.importsNamespace.add(r);const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexportNamespace.add(e)}))}}else if(e.isImportSpecifier()){const r=getExportSpecifierName(e.get("imported"),a);const s=e.get("local").node.name;t.imports.set(s,r);const o=n.get(s);if(o){n.delete(s);o.names.forEach((e=>{t.reexports.set(e,r)}))}}}))}else if(e.isExportAllDeclaration()){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;t.reexportAll={loc:e.node.loc}}else if(e.isExportNamedDeclaration()&&e.node.source){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{assertExportSpecifier(e);const r=getExportSpecifierName(e.get("local"),a);const s=getExportSpecifierName(e.get("exported"),a);t.reexports.set(s,r);if(s==="__esModule"){throw e.get("exported").buildCodeFrameError('Illegal export "__esModule".')}}))}else if(e.isExportNamedDeclaration()||e.isExportDefaultDeclaration()){i=true}}));for(const e of o.values()){let t=false;let r=false;if(e.importsNamespace.size>0){t=true;r=true}if(e.reexportAll){r=true}for(const s of e.imports.values()){if(s==="default")t=true;else r=true}for(const s of e.reexports.values()){if(s==="default")t=true;else r=true}if(t&&r){e.interop="namespace"}else if(t){e.interop="default"}}for(const[e,r]of o){if(t!==false&&!(isSideEffectImport(r)||r.reexportAll)){if(t===true){r.lazy=!/\./.test(e)}else if(Array.isArray(t)){r.lazy=t.indexOf(e)!==-1}else if(typeof t==="function"){r.lazy=t(e)}else{throw new Error(`.lazy must be a boolean, string array, or function`)}}}return{hasExports:i,local:n,source:o}}function getLocalExportMetadata(e,t,r){const s=new Map;e.get("body").forEach((e=>{let r;if(e.isImportDeclaration()){r="import"}else{if(e.isExportDefaultDeclaration())e=e.get("declaration");if(e.isExportNamedDeclaration()){if(e.node.declaration){e=e.get("declaration")}else if(t&&e.node.source&&e.get("source").isStringLiteral()){e.get("specifiers").forEach((e=>{assertExportSpecifier(e);s.set(e.get("local").node.name,"block")}));return}}if(e.isFunctionDeclaration()){r="hoisted"}else if(e.isClassDeclaration()){r="block"}else if(e.isVariableDeclaration({kind:"var"})){r="var"}else if(e.isVariableDeclaration()){r="block"}else{return}}Object.keys(e.getOuterBindingIdentifiers()).forEach((e=>{s.set(e,r)}))}));const a=new Map;const getLocalMetadata=e=>{const t=e.node.name;let r=a.get(t);if(!r){const n=s.get(t);if(n===undefined){throw e.buildCodeFrameError(`Exporting local "${t}", which is not declared.`)}r={names:[],kind:n};a.set(t,r)}return r};e.get("body").forEach((e=>{if(e.isExportNamedDeclaration()&&(t||!e.node.source)){if(e.node.declaration){const t=e.get("declaration");const r=t.getOuterBindingIdentifierPaths();Object.keys(r).forEach((e=>{if(e==="__esModule"){throw t.buildCodeFrameError('Illegal export "__esModule".')}getLocalMetadata(r[e]).names.push(e)}))}else{e.get("specifiers").forEach((e=>{const t=e.get("local");const s=e.get("exported");const a=getLocalMetadata(t);const n=getExportSpecifierName(s,r);if(n==="__esModule"){throw s.buildCodeFrameError('Illegal export "__esModule".')}a.names.push(n)}))}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){getLocalMetadata(t.get("id")).names.push("default")}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}}));return a}function nameAnonymousExports(e){e.get("body").forEach((e=>{if(!e.isExportDefaultDeclaration())return;(0,n.default)(e)}))}function removeModuleDeclarations(e){e.get("body").forEach((e=>{if(e.isImportDeclaration()){e.remove()}else if(e.isExportNamedDeclaration()){if(e.node.declaration){e.node.declaration._blockHoist=e.node._blockHoist;e.replaceWith(e.node.declaration)}else{e.remove()}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){t._blockHoist=e.node._blockHoist;e.replaceWith(t)}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}else if(e.isExportAllDeclaration()){e.remove()}}))}},1238:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteLiveReferences;var s=r(9491);var a=r(8622);var n=r(153);var o=r(8865);function rewriteLiveReferences(e,t){const r=new Map;const s=new Map;const requeueInParent=t=>{e.requeue(t)};for(const[e,s]of t.source){for(const[t,a]of s.imports){r.set(t,[e,a,null])}for(const t of s.importsNamespace){r.set(t,[e,null,t])}}for(const[e,r]of t.local){let t=s.get(e);if(!t){t=[];s.set(e,t)}t.push(...r.names)}const n={metadata:t,requeueInParent:requeueInParent,scope:e.scope,exported:s};e.traverse(i,n);(0,o.default)(e,new Set([...Array.from(r.keys()),...Array.from(s.keys())]));const c={seen:new WeakSet,metadata:t,requeueInParent:requeueInParent,scope:e.scope,imported:r,exported:s,buildImportReference:([e,r,s],n)=>{const o=t.source.get(e);if(s){if(o.lazy)n=a.callExpression(n,[]);return n}let i=a.identifier(o.name);if(o.lazy)i=a.callExpression(i,[]);if(r==="default"&&o.interop==="node-default"){return i}const l=t.stringSpecifiers.has(r);return a.memberExpression(i,l?a.stringLiteral(r):a.identifier(r),l)}};e.traverse(l,c)}const i={Scope(e){e.skip()},ClassDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;const{id:n}=e.node;if(!n)throw new Error("Expected class to have a name");const o=n.name;const i=r.get(o)||[];if(i.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,i,a.identifier(o)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}},VariableDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;Object.keys(e.getOuterBindingIdentifiers()).forEach((n=>{const o=r.get(n)||[];if(o.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,o,a.identifier(n)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}}))}};const buildBindingExportAssignmentExpression=(e,t,r)=>(t||[]).reduce(((t,r)=>{const{stringSpecifiers:s}=e;const n=s.has(r);return a.assignmentExpression("=",a.memberExpression(a.identifier(e.exportName),n?a.stringLiteral(r):a.identifier(r),n),t)}),r);const buildImportThrow=e=>n.default.expression.ast` + `({EXPORTS_LIST:e.exportNameListName}):null})}function buildExportNameListDeclaration(e,t){const r=Object.create(null);for(const e of t.local.values()){for(const t of e.names){r[t]=true}}let s=false;for(const e of t.source.values()){for(const t of e.reexports.keys()){r[t]=true}for(const t of e.reexportNamespace){r[t]=true}s=s||!!e.reexportAll}if(!s||Object.keys(r).length===0)return null;const n=e.scope.generateUidIdentifier("exportNames");delete r.default;return{name:n.name,statement:a.variableDeclaration("var",[a.variableDeclarator(n,a.valueToNode(r))])}}function buildExportInitializationStatements(e,t,r=false){const s=[];const n=[];for(const[e,r]of t.local){if(r.kind==="import"){}else if(r.kind==="hoisted"){s.push(buildInitStatement(t,r.names,a.identifier(e)))}else{n.push(...r.names)}}for(const e of t.source.values()){if(!r){s.push(...buildReexportsFromMeta(t,e,false))}for(const t of e.reexportNamespace){n.push(t)}}s.push(...chunk(n,100).map((r=>buildInitStatement(t,r,e.scope.buildUndefinedNode()))));return s}const f={computed:n.default.expression`EXPORTS["NAME"] = VALUE`,default:n.default.expression`EXPORTS.NAME = VALUE`};function buildInitStatement(e,t,r){const{stringSpecifiers:s,exportName:n}=e;return a.expressionStatement(t.reduce(((e,t)=>{const r={EXPORTS:n,NAME:t,VALUE:e};if(s.has(t)){return f.computed(r)}else{return f.default(r)}}),r))}function chunk(e,t){const r=[];for(let s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasExports=hasExports;t.isSideEffectImport=isSideEffectImport;t.validateImportInteropOption=validateImportInteropOption;t["default"]=normalizeModuleAndLoadMetadata;var s=r(1017);var a=r(1815);var n=r(7058);function hasExports(e){return e.hasExports}function isSideEffectImport(e){return e.imports.size===0&&e.importsNamespace.size===0&&e.reexports.size===0&&e.reexportNamespace.size===0&&!e.reexportAll}function validateImportInteropOption(e){if(typeof e!=="function"&&e!=="none"&&e!=="babel"&&e!=="node"){throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${e}).`)}return e}function resolveImportInterop(e,t){if(typeof e==="function"){return validateImportInteropOption(e(t))}return e}function normalizeModuleAndLoadMetadata(e,t,{importInterop:r,initializeReexports:s=false,lazy:a=false,esNamespaceOnly:n=false}){if(!t){t=e.scope.generateUidIdentifier("exports").name}const o=new Set;nameAnonymousExports(e);const{local:i,source:l,hasExports:c}=getModuleMetadata(e,{initializeReexports:s,lazy:a},o);removeModuleDeclarations(e);for(const[,e]of l){if(e.importsNamespace.size>0){e.name=e.importsNamespace.values().next().value}const t=resolveImportInterop(r,e.source);if(t==="none"){e.interop="none"}else if(t==="node"&&e.interop==="namespace"){e.interop="node-namespace"}else if(t==="node"&&e.interop==="default"){e.interop="node-default"}else if(n&&e.interop==="namespace"){e.interop="default"}}return{exportName:t,exportNameListName:null,hasExports:c,local:i,source:l,stringSpecifiers:o}}function getExportSpecifierName(e,t){if(e.isIdentifier()){return e.node.name}else if(e.isStringLiteral()){const r=e.node.value;if(!(0,a.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.node.type}`)}}function assertExportSpecifier(e){if(e.isExportSpecifier()){return}else if(e.isExportNamespaceSpecifier()){throw e.buildCodeFrameError("Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.")}else{throw e.buildCodeFrameError("Unexpected export specifier type")}}function getModuleMetadata(e,{lazy:t,initializeReexports:r},a){const n=getLocalExportMetadata(e,r,a);const o=new Map;const getData=t=>{const r=t.value;let a=o.get(r);if(!a){a={name:e.scope.generateUidIdentifier((0,s.basename)(r,(0,s.extname)(r))).name,interop:"none",loc:null,imports:new Map,importsNamespace:new Set,reexports:new Map,reexportNamespace:new Set,reexportAll:null,lazy:false,source:r};o.set(r,a)}return a};let i=false;e.get("body").forEach((e=>{if(e.isImportDeclaration()){const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{if(e.isImportDefaultSpecifier()){const r=e.get("local").node.name;t.imports.set(r,"default");const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexports.set(e,"default")}))}}else if(e.isImportNamespaceSpecifier()){const r=e.get("local").node.name;t.importsNamespace.add(r);const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexportNamespace.add(e)}))}}else if(e.isImportSpecifier()){const r=getExportSpecifierName(e.get("imported"),a);const s=e.get("local").node.name;t.imports.set(s,r);const o=n.get(s);if(o){n.delete(s);o.names.forEach((e=>{t.reexports.set(e,r)}))}}}))}else if(e.isExportAllDeclaration()){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;t.reexportAll={loc:e.node.loc}}else if(e.isExportNamedDeclaration()&&e.node.source){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{assertExportSpecifier(e);const r=getExportSpecifierName(e.get("local"),a);const s=getExportSpecifierName(e.get("exported"),a);t.reexports.set(s,r);if(s==="__esModule"){throw e.get("exported").buildCodeFrameError('Illegal export "__esModule".')}}))}else if(e.isExportNamedDeclaration()||e.isExportDefaultDeclaration()){i=true}}));for(const e of o.values()){let t=false;let r=false;if(e.importsNamespace.size>0){t=true;r=true}if(e.reexportAll){r=true}for(const s of e.imports.values()){if(s==="default")t=true;else r=true}for(const s of e.reexports.values()){if(s==="default")t=true;else r=true}if(t&&r){e.interop="namespace"}else if(t){e.interop="default"}}for(const[e,r]of o){if(t!==false&&!(isSideEffectImport(r)||r.reexportAll)){if(t===true){r.lazy=!/\./.test(e)}else if(Array.isArray(t)){r.lazy=t.indexOf(e)!==-1}else if(typeof t==="function"){r.lazy=t(e)}else{throw new Error(`.lazy must be a boolean, string array, or function`)}}}return{hasExports:i,local:n,source:o}}function getLocalExportMetadata(e,t,r){const s=new Map;e.get("body").forEach((e=>{let r;if(e.isImportDeclaration()){r="import"}else{if(e.isExportDefaultDeclaration())e=e.get("declaration");if(e.isExportNamedDeclaration()){if(e.node.declaration){e=e.get("declaration")}else if(t&&e.node.source&&e.get("source").isStringLiteral()){e.get("specifiers").forEach((e=>{assertExportSpecifier(e);s.set(e.get("local").node.name,"block")}));return}}if(e.isFunctionDeclaration()){r="hoisted"}else if(e.isClassDeclaration()){r="block"}else if(e.isVariableDeclaration({kind:"var"})){r="var"}else if(e.isVariableDeclaration()){r="block"}else{return}}Object.keys(e.getOuterBindingIdentifiers()).forEach((e=>{s.set(e,r)}))}));const a=new Map;const getLocalMetadata=e=>{const t=e.node.name;let r=a.get(t);if(!r){const n=s.get(t);if(n===undefined){throw e.buildCodeFrameError(`Exporting local "${t}", which is not declared.`)}r={names:[],kind:n};a.set(t,r)}return r};e.get("body").forEach((e=>{if(e.isExportNamedDeclaration()&&(t||!e.node.source)){if(e.node.declaration){const t=e.get("declaration");const r=t.getOuterBindingIdentifierPaths();Object.keys(r).forEach((e=>{if(e==="__esModule"){throw t.buildCodeFrameError('Illegal export "__esModule".')}getLocalMetadata(r[e]).names.push(e)}))}else{e.get("specifiers").forEach((e=>{const t=e.get("local");const s=e.get("exported");const a=getLocalMetadata(t);const n=getExportSpecifierName(s,r);if(n==="__esModule"){throw s.buildCodeFrameError('Illegal export "__esModule".')}a.names.push(n)}))}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){getLocalMetadata(t.get("id")).names.push("default")}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}}));return a}function nameAnonymousExports(e){e.get("body").forEach((e=>{if(!e.isExportDefaultDeclaration())return;(0,n.default)(e)}))}function removeModuleDeclarations(e){e.get("body").forEach((e=>{if(e.isImportDeclaration()){e.remove()}else if(e.isExportNamedDeclaration()){if(e.node.declaration){e.node.declaration._blockHoist=e.node._blockHoist;e.replaceWith(e.node.declaration)}else{e.remove()}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){t._blockHoist=e.node._blockHoist;e.replaceWith(t)}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}else if(e.isExportAllDeclaration()){e.remove()}}))}},1238:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteLiveReferences;var s=r(9491);var a=r(8622);var n=r(153);var o=r(8865);function rewriteLiveReferences(e,t){const r=new Map;const s=new Map;const requeueInParent=t=>{e.requeue(t)};for(const[e,s]of t.source){for(const[t,a]of s.imports){r.set(t,[e,a,null])}for(const t of s.importsNamespace){r.set(t,[e,null,t])}}for(const[e,r]of t.local){let t=s.get(e);if(!t){t=[];s.set(e,t)}t.push(...r.names)}const n={metadata:t,requeueInParent:requeueInParent,scope:e.scope,exported:s};e.traverse(i,n);(0,o.default)(e,new Set([...Array.from(r.keys()),...Array.from(s.keys())]));const c={seen:new WeakSet,metadata:t,requeueInParent:requeueInParent,scope:e.scope,imported:r,exported:s,buildImportReference:([e,r,s],n)=>{const o=t.source.get(e);if(s){if(o.lazy)n=a.callExpression(n,[]);return n}let i=a.identifier(o.name);if(o.lazy)i=a.callExpression(i,[]);if(r==="default"&&o.interop==="node-default"){return i}const l=t.stringSpecifiers.has(r);return a.memberExpression(i,l?a.stringLiteral(r):a.identifier(r),l)}};e.traverse(l,c)}const i={Scope(e){e.skip()},ClassDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;const{id:n}=e.node;if(!n)throw new Error("Expected class to have a name");const o=n.name;const i=r.get(o)||[];if(i.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,i,a.identifier(o)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}},VariableDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;Object.keys(e.getOuterBindingIdentifiers()).forEach((n=>{const o=r.get(n)||[];if(o.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,o,a.identifier(n)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}}))}};const buildBindingExportAssignmentExpression=(e,t,r)=>(t||[]).reduce(((t,r)=>{const{stringSpecifiers:s}=e;const n=s.has(r);return a.assignmentExpression("=",a.memberExpression(a.identifier(e.exportName),n?a.stringLiteral(r):a.identifier(r),n),t)}),r);const buildImportThrow=e=>n.default.expression.ast` (function() { throw new Error('"' + '${e}' + '" is read-only.'); })() - `;const l={ReferencedIdentifier(e){const{seen:t,buildImportReference:r,scope:s,imported:n,requeueInParent:o}=this;if(t.has(e.node))return;t.add(e.node);const i=e.node.name;const l=n.get(i);if(l){const t=e.scope.getBinding(i);const n=s.getBinding(i);if(n!==t)return;const c=r(l,e.node);c.loc=e.node.loc;if((e.parentPath.isCallExpression({callee:e.node})||e.parentPath.isOptionalCallExpression({callee:e.node})||e.parentPath.isTaggedTemplateExpression({tag:e.node}))&&a.isMemberExpression(c)){e.replaceWith(a.sequenceExpression([a.numericLiteral(0),c]))}else if(e.isJSXIdentifier()&&a.isMemberExpression(c)){const{object:t,property:r}=c;e.replaceWith(a.jsxMemberExpression(a.jsxIdentifier(t.name),a.jsxIdentifier(r.name)))}else{e.replaceWith(c)}o(e);e.skip()}},AssignmentExpression:{exit(e){const{scope:t,seen:r,imported:n,exported:o,requeueInParent:i,buildImportReference:l}=this;if(r.has(e.node))return;r.add(e.node);const c=e.get("left");if(c.isMemberExpression())return;if(c.isIdentifier()){const r=c.node.name;if(t.getBinding(r)!==e.scope.getBinding(r)){return}const u=o.get(r);const p=n.get(r);if((u==null?void 0:u.length)>0||p){s(e.node.operator==="=","Path was not simplified");const t=e.node;if(p){t.left=l(p,t.left);t.right=a.sequenceExpression([t.right,buildImportThrow(r)])}e.replaceWith(buildBindingExportAssignmentExpression(this.metadata,u,t));i(e)}}else{const r=c.getOuterBindingIdentifiers();const s=Object.keys(r).filter((r=>t.getBinding(r)===e.scope.getBinding(r)));const l=s.find((e=>n.has(e)));if(l){e.node.right=a.sequenceExpression([e.node.right,buildImportThrow(l)])}const u=[];s.forEach((e=>{const t=o.get(e)||[];if(t.length>0){u.push(buildBindingExportAssignmentExpression(this.metadata,t,a.identifier(e)))}}));if(u.length>0){let t=a.sequenceExpression(u);if(e.parentPath.isExpressionStatement()){t=a.expressionStatement(t);t._blockHoist=e.parentPath.node._blockHoist}const r=e.insertAfter(t)[0];i(r)}}}},"ForOfStatement|ForInStatement"(e){const{scope:t,node:r}=e;const{left:s}=r;const{exported:n,scope:o}=this;if(!a.isVariableDeclaration(s)){let r=false;const i=e.get("body");const l=i.scope;for(const e of Object.keys(a.getOuterBindingIdentifiers(s))){if(n.get(e)&&o.getBinding(e)===t.getBinding(e)){r=true;if(l.hasOwnBinding(e)){l.rename(e)}}}if(!r){return}const c=t.generateUidIdentifierBasedOnNode(s);i.unshiftContainer("body",a.expressionStatement(a.assignmentExpression("=",s,c)));e.get("left").replaceWith(a.variableDeclaration("let",[a.variableDeclarator(a.cloneNode(c))]));t.registerDeclaration(e.get("left"))}}}},2835:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteThis;var s=r(6833);var a=r(7369);var n=r(8622);function rewriteThis(e){(0,a.default)(e.node,Object.assign({},o,{noScope:true}))}const o=a.default.visitors.merge([s.environmentVisitor,{ThisExpression(e){e.replaceWith(n.unaryExpression("void",n.numericLiteral(0),true))}}])},4141:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8865:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=simplifyAccess;var s=r(8622);function simplifyAccess(e,t){e.traverse(a,{scope:e.scope,bindingNames:t,seen:new WeakSet})}const a={UpdateExpression:{exit(e){const{scope:t,bindingNames:r}=this;const a=e.get("argument");if(!a.isIdentifier())return;const n=a.node.name;if(!r.has(n))return;if(t.getBinding(n)!==e.scope.getBinding(n)){return}if(e.parentPath.isExpressionStatement()&&!e.isCompletionRecord()){const t=e.node.operator=="++"?"+=":"-=";e.replaceWith(s.assignmentExpression(t,a.node,s.numericLiteral(1)))}else if(e.node.prefix){e.replaceWith(s.assignmentExpression("=",s.identifier(n),s.binaryExpression(e.node.operator[0],s.unaryExpression("+",a.node),s.numericLiteral(1))))}else{const t=e.scope.generateUidIdentifierBasedOnNode(a.node,"old");const r=t.name;e.scope.push({id:t});const n=s.binaryExpression(e.node.operator[0],s.identifier(r),s.numericLiteral(1));e.replaceWith(s.sequenceExpression([s.assignmentExpression("=",s.identifier(r),s.unaryExpression("+",a.node)),s.assignmentExpression("=",s.cloneNode(a.node),n),s.identifier(r)]))}}},AssignmentExpression:{exit(e){const{scope:t,seen:r,bindingNames:a}=this;if(e.node.operator==="=")return;if(r.has(e.node))return;r.add(e.node);const n=e.get("left");if(!n.isIdentifier())return;const o=n.node.name;if(!a.has(o))return;if(t.getBinding(o)!==e.scope.getBinding(o)){return}e.node.right=s.binaryExpression(e.node.operator.slice(0,-1),s.cloneNode(e.node.left),e.node.right);e.node.operator="="}}}},397:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(397);var a=r(5085)},5085:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},9942:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3373);var a=r(1017);var n=r(9970);var o=r(8304);const i=(0,o.template)(`\n GLOBAL_REFERENCE = GLOBAL_REFERENCE || {}\n`);const l=(0,o.template)(`\n (function (global, factory) {\n if (typeof define === "function" && define.amd) {\n define(MODULE_NAME, AMD_ARGUMENTS, factory);\n } else if (typeof exports !== "undefined") {\n factory(COMMONJS_ARGUMENTS);\n } else {\n var mod = { exports: {} };\n factory(BROWSER_ARGUMENTS);\n\n GLOBAL_TO_ASSIGN;\n }\n })(\n typeof globalThis !== "undefined" ? globalThis\n : typeof self !== "undefined" ? self\n : this,\n function(IMPORT_NAMES) {\n })\n`);var c=(0,s.declare)(((e,t)=>{var r,s;e.assertVersion(7);const{globals:c,exactGlobals:u,allowTopLevelThis:p,strict:d,strictMode:f,noInterop:m,importInterop:y}=t;const g=(r=e.assumption("constantReexports"))!=null?r:t.loose;const h=(s=e.assumption("enumerableModuleMeta"))!=null?s:t.loose;function buildBrowserInit(e,t,r,s){const n=s?s.value:(0,a.basename)(r,(0,a.extname)(r));let l=o.types.memberExpression(o.types.identifier("global"),o.types.identifier(o.types.toIdentifier(n)));let c=[];if(t){const t=e[n];if(t){c=[];const e=t.split(".");l=e.slice(1).reduce(((e,t)=>{c.push(i({GLOBAL_REFERENCE:o.types.cloneNode(e)}));return o.types.memberExpression(e,o.types.identifier(t))}),o.types.memberExpression(o.types.identifier("global"),o.types.identifier(e[0])))}}c.push(o.types.expressionStatement(o.types.assignmentExpression("=",l,o.types.memberExpression(o.types.identifier("mod"),o.types.identifier("exports")))));return c}function buildBrowserArg(e,t,r){let s;if(t){const t=e[r];if(t){s=t.split(".").reduce(((e,t)=>o.types.memberExpression(e,o.types.identifier(t))),o.types.identifier("global"))}else{s=o.types.memberExpression(o.types.identifier("global"),o.types.identifier(o.types.toIdentifier(r)))}}else{const t=(0,a.basename)(r,(0,a.extname)(r));const n=e[t]||t;s=o.types.memberExpression(o.types.identifier("global"),o.types.identifier(o.types.toIdentifier(n)))}return s}return{name:"transform-modules-umd",visitor:{Program:{exit(e){if(!(0,n.isModule)(e))return;const r=c||{};let s=(0,n.getModuleName)(this.file.opts,t);if(s)s=o.types.stringLiteral(s);const{meta:a,headers:i}=(0,n.rewriteModuleStatementsAndPrepareHeader)(e,{constantReexports:g,enumerableModuleMeta:h,strict:d,strictMode:f,allowTopLevelThis:p,noInterop:m,importInterop:y});const b=[];const x=[];const v=[];const E=[];if((0,n.hasExports)(a)){b.push(o.types.stringLiteral("exports"));x.push(o.types.identifier("exports"));v.push(o.types.memberExpression(o.types.identifier("mod"),o.types.identifier("exports")));E.push(o.types.identifier(a.exportName))}for(const[t,s]of a.source){b.push(o.types.stringLiteral(t));x.push(o.types.callExpression(o.types.identifier("require"),[o.types.stringLiteral(t)]));v.push(buildBrowserArg(r,u,t));E.push(o.types.identifier(s.name));if(!(0,n.isSideEffectImport)(s)){const t=(0,n.wrapInterop)(e,o.types.identifier(s.name),s.interop);if(t){const e=o.types.expressionStatement(o.types.assignmentExpression("=",o.types.identifier(s.name),t));e.loc=a.loc;i.push(e)}}i.push(...(0,n.buildNamespaceInitStatements)(a,s,g))}(0,n.ensureStatementsHoisted)(i);e.unshiftContainer("body",i);const{body:j,directives:w}=e.node;e.node.directives=[];e.node.body=[];const _=e.pushContainer("body",[l({MODULE_NAME:s,AMD_ARGUMENTS:o.types.arrayExpression(b),COMMONJS_ARGUMENTS:x,BROWSER_ARGUMENTS:v,IMPORT_NAMES:E,GLOBAL_TO_ASSIGN:buildBrowserInit(r,u,this.filename||"unknown",s)})])[0];const S=_.get("expression.arguments")[1].get("body");S.pushContainer("directives",w);S.pushContainer("body",j)}}}}}));t["default"]=c},7945:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=getModuleName;{const e=getModuleName;t["default"]=getModuleName=function getModuleName(t,r){var s,a,n,o;return e(t,{moduleId:(s=r.moduleId)!=null?s:t.moduleId,moduleIds:(a=r.moduleIds)!=null?a:t.moduleIds,getModuleId:(n=r.getModuleId)!=null?n:t.getModuleId,moduleRoot:(o=r.moduleRoot)!=null?o:t.moduleRoot})}}function getModuleName(e,t){const{filename:r,filenameRelative:s=r,sourceRoot:a=t.moduleRoot}=e;const{moduleId:n,moduleIds:o=!!n,getModuleId:i,moduleRoot:l=a}=t;if(!o)return null;if(n!=null&&!i){return n}let c=l!=null?l+"/":"";if(s){const e=a!=null?new RegExp("^"+a+"/?"):"";c+=s.replace(e,"").replace(/\.(\w*?)$/,"")}c=c.replace(/\\/g,"/");if(i){return i(c)||c}else{return c}}},9970:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.rewriteModuleStatementsAndPrepareHeader=rewriteModuleStatementsAndPrepareHeader;t.ensureStatementsHoisted=ensureStatementsHoisted;t.wrapInterop=wrapInterop;t.buildNamespaceInitStatements=buildNamespaceInitStatements;Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return o.isModule}});Object.defineProperty(t,"rewriteThis",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"hasExports",{enumerable:true,get:function(){return c.hasExports}});Object.defineProperty(t,"isSideEffectImport",{enumerable:true,get:function(){return c.isSideEffectImport}});Object.defineProperty(t,"getModuleName",{enumerable:true,get:function(){return u.default}});var s=r(9491);var a=r(8622);var n=r(153);var o=r(6039);var i=r(5244);var l=r(4806);var c=r(7786);var u=r(7945);function rewriteModuleStatementsAndPrepareHeader(e,{loose:t,exportName:r,strict:n,allowTopLevelThis:u,strictMode:p,noInterop:d,importInterop:f=(d?"none":"babel"),lazy:m,esNamespaceOnly:y,constantReexports:g=t,enumerableModuleMeta:h=t}){(0,c.validateImportInteropOption)(f);s((0,o.isModule)(e),"Cannot process module statements in a script");e.node.sourceType="script";const b=(0,c.default)(e,r,{importInterop:f,initializeReexports:g,lazy:m,esNamespaceOnly:y});if(!u){(0,i.default)(e)}(0,l.default)(e,b);if(p!==false){const t=e.node.directives.some((e=>e.value.value==="use strict"));if(!t){e.unshiftContainer("directives",a.directive(a.directiveLiteral("use strict")))}}const x=[];if((0,c.hasExports)(b)&&!n){x.push(buildESModuleHeader(b,h))}const v=buildExportNameListDeclaration(e,b);if(v){b.exportNameListName=v.name;x.push(v.statement)}x.push(...buildExportInitializationStatements(e,b,g));return{meta:b,headers:x}}function ensureStatementsHoisted(e){e.forEach((e=>{e._blockHoist=3}))}function wrapInterop(e,t,r){if(r==="none"){return null}if(r==="node-namespace"){return a.callExpression(e.hub.addHelper("interopRequireWildcard"),[t,a.booleanLiteral(true)])}else if(r==="node-default"){return null}let s;if(r==="default"){s="interopRequireDefault"}else if(r==="namespace"){s="interopRequireWildcard"}else{throw new Error(`Unknown interop: ${r}`)}return a.callExpression(e.hub.addHelper(s),[t])}function buildNamespaceInitStatements(e,t,r=false){const s=[];let o=a.identifier(t.name);if(t.lazy)o=a.callExpression(o,[]);for(const e of t.importsNamespace){if(e===t.name)continue;s.push(n.default.statement`var NAME = SOURCE;`({NAME:e,SOURCE:a.cloneNode(o)}))}if(r){s.push(...buildReexportsFromMeta(e,t,true))}for(const r of t.reexportNamespace){s.push((t.lazy?n.default.statement` + `;const l={ReferencedIdentifier(e){const{seen:t,buildImportReference:r,scope:s,imported:n,requeueInParent:o}=this;if(t.has(e.node))return;t.add(e.node);const i=e.node.name;const l=n.get(i);if(l){const t=e.scope.getBinding(i);const n=s.getBinding(i);if(n!==t)return;const c=r(l,e.node);c.loc=e.node.loc;if((e.parentPath.isCallExpression({callee:e.node})||e.parentPath.isOptionalCallExpression({callee:e.node})||e.parentPath.isTaggedTemplateExpression({tag:e.node}))&&a.isMemberExpression(c)){e.replaceWith(a.sequenceExpression([a.numericLiteral(0),c]))}else if(e.isJSXIdentifier()&&a.isMemberExpression(c)){const{object:t,property:r}=c;e.replaceWith(a.jsxMemberExpression(a.jsxIdentifier(t.name),a.jsxIdentifier(r.name)))}else{e.replaceWith(c)}o(e);e.skip()}},AssignmentExpression:{exit(e){const{scope:t,seen:r,imported:n,exported:o,requeueInParent:i,buildImportReference:l}=this;if(r.has(e.node))return;r.add(e.node);const c=e.get("left");if(c.isMemberExpression())return;if(c.isIdentifier()){const r=c.node.name;if(t.getBinding(r)!==e.scope.getBinding(r)){return}const u=o.get(r);const p=n.get(r);if((u==null?void 0:u.length)>0||p){s(e.node.operator==="=","Path was not simplified");const t=e.node;if(p){t.left=l(p,t.left);t.right=a.sequenceExpression([t.right,buildImportThrow(r)])}e.replaceWith(buildBindingExportAssignmentExpression(this.metadata,u,t));i(e)}}else{const r=c.getOuterBindingIdentifiers();const s=Object.keys(r).filter((r=>t.getBinding(r)===e.scope.getBinding(r)));const l=s.find((e=>n.has(e)));if(l){e.node.right=a.sequenceExpression([e.node.right,buildImportThrow(l)])}const u=[];s.forEach((e=>{const t=o.get(e)||[];if(t.length>0){u.push(buildBindingExportAssignmentExpression(this.metadata,t,a.identifier(e)))}}));if(u.length>0){let t=a.sequenceExpression(u);if(e.parentPath.isExpressionStatement()){t=a.expressionStatement(t);t._blockHoist=e.parentPath.node._blockHoist}const r=e.insertAfter(t)[0];i(r)}}}},"ForOfStatement|ForInStatement"(e){const{scope:t,node:r}=e;const{left:s}=r;const{exported:n,scope:o}=this;if(!a.isVariableDeclaration(s)){let r=false;const i=e.get("body");const l=i.scope;for(const e of Object.keys(a.getOuterBindingIdentifiers(s))){if(n.get(e)&&o.getBinding(e)===t.getBinding(e)){r=true;if(l.hasOwnBinding(e)){l.rename(e)}}}if(!r){return}const c=t.generateUidIdentifierBasedOnNode(s);i.unshiftContainer("body",a.expressionStatement(a.assignmentExpression("=",s,c)));e.get("left").replaceWith(a.variableDeclaration("let",[a.variableDeclarator(a.cloneNode(c))]));t.registerDeclaration(e.get("left"))}}}},2835:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteThis;var s=r(6833);var a=r(7369);var n=r(8622);function rewriteThis(e){(0,a.default)(e.node,Object.assign({},o,{noScope:true}))}const o=a.default.visitors.merge([s.environmentVisitor,{ThisExpression(e){e.replaceWith(n.unaryExpression("void",n.numericLiteral(0),true))}}])},119:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8865:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=simplifyAccess;var s=r(8622);function simplifyAccess(e,t){e.traverse(a,{scope:e.scope,bindingNames:t,seen:new WeakSet})}const a={UpdateExpression:{exit(e){const{scope:t,bindingNames:r}=this;const a=e.get("argument");if(!a.isIdentifier())return;const n=a.node.name;if(!r.has(n))return;if(t.getBinding(n)!==e.scope.getBinding(n)){return}if(e.parentPath.isExpressionStatement()&&!e.isCompletionRecord()){const t=e.node.operator=="++"?"+=":"-=";e.replaceWith(s.assignmentExpression(t,a.node,s.numericLiteral(1)))}else if(e.node.prefix){e.replaceWith(s.assignmentExpression("=",s.identifier(n),s.binaryExpression(e.node.operator[0],s.unaryExpression("+",a.node),s.numericLiteral(1))))}else{const t=e.scope.generateUidIdentifierBasedOnNode(a.node,"old");const r=t.name;e.scope.push({id:t});const n=s.binaryExpression(e.node.operator[0],s.identifier(r),s.numericLiteral(1));e.replaceWith(s.sequenceExpression([s.assignmentExpression("=",s.identifier(r),s.unaryExpression("+",a.node)),s.assignmentExpression("=",s.cloneNode(a.node),n),s.identifier(r)]))}}},AssignmentExpression:{exit(e){const{scope:t,seen:r,bindingNames:a}=this;if(e.node.operator==="=")return;if(r.has(e.node))return;r.add(e.node);const n=e.get("left");if(!n.isIdentifier())return;const o=n.node.name;if(!a.has(o))return;if(t.getBinding(o)!==e.scope.getBinding(o)){return}e.node.right=s.binaryExpression(e.node.operator.slice(0,-1),s.cloneNode(e.node.left),e.node.right);e.node.operator="="}}}},397:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(397);var a=r(5085)},5085:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},9942:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3373);var a=r(1017);var n=r(9970);var o=r(8304);const i=(0,o.template)(`\n GLOBAL_REFERENCE = GLOBAL_REFERENCE || {}\n`);const l=(0,o.template)(`\n (function (global, factory) {\n if (typeof define === "function" && define.amd) {\n define(MODULE_NAME, AMD_ARGUMENTS, factory);\n } else if (typeof exports !== "undefined") {\n factory(COMMONJS_ARGUMENTS);\n } else {\n var mod = { exports: {} };\n factory(BROWSER_ARGUMENTS);\n\n GLOBAL_TO_ASSIGN;\n }\n })(\n typeof globalThis !== "undefined" ? globalThis\n : typeof self !== "undefined" ? self\n : this,\n function(IMPORT_NAMES) {\n })\n`);var c=(0,s.declare)(((e,t)=>{var r,s;e.assertVersion(7);const{globals:c,exactGlobals:u,allowTopLevelThis:p,strict:f,strictMode:d,noInterop:m,importInterop:y}=t;const g=(r=e.assumption("constantReexports"))!=null?r:t.loose;const h=(s=e.assumption("enumerableModuleMeta"))!=null?s:t.loose;function buildBrowserInit(e,t,r,s){const n=s?s.value:(0,a.basename)(r,(0,a.extname)(r));let l=o.types.memberExpression(o.types.identifier("global"),o.types.identifier(o.types.toIdentifier(n)));let c=[];if(t){const t=e[n];if(t){c=[];const e=t.split(".");l=e.slice(1).reduce(((e,t)=>{c.push(i({GLOBAL_REFERENCE:o.types.cloneNode(e)}));return o.types.memberExpression(e,o.types.identifier(t))}),o.types.memberExpression(o.types.identifier("global"),o.types.identifier(e[0])))}}c.push(o.types.expressionStatement(o.types.assignmentExpression("=",l,o.types.memberExpression(o.types.identifier("mod"),o.types.identifier("exports")))));return c}function buildBrowserArg(e,t,r){let s;if(t){const t=e[r];if(t){s=t.split(".").reduce(((e,t)=>o.types.memberExpression(e,o.types.identifier(t))),o.types.identifier("global"))}else{s=o.types.memberExpression(o.types.identifier("global"),o.types.identifier(o.types.toIdentifier(r)))}}else{const t=(0,a.basename)(r,(0,a.extname)(r));const n=e[t]||t;s=o.types.memberExpression(o.types.identifier("global"),o.types.identifier(o.types.toIdentifier(n)))}return s}return{name:"transform-modules-umd",visitor:{Program:{exit(e){if(!(0,n.isModule)(e))return;const r=c||{};let s=(0,n.getModuleName)(this.file.opts,t);if(s)s=o.types.stringLiteral(s);const{meta:a,headers:i}=(0,n.rewriteModuleStatementsAndPrepareHeader)(e,{constantReexports:g,enumerableModuleMeta:h,strict:f,strictMode:d,allowTopLevelThis:p,noInterop:m,importInterop:y});const b=[];const x=[];const v=[];const E=[];if((0,n.hasExports)(a)){b.push(o.types.stringLiteral("exports"));x.push(o.types.identifier("exports"));v.push(o.types.memberExpression(o.types.identifier("mod"),o.types.identifier("exports")));E.push(o.types.identifier(a.exportName))}for(const[t,s]of a.source){b.push(o.types.stringLiteral(t));x.push(o.types.callExpression(o.types.identifier("require"),[o.types.stringLiteral(t)]));v.push(buildBrowserArg(r,u,t));E.push(o.types.identifier(s.name));if(!(0,n.isSideEffectImport)(s)){const t=(0,n.wrapInterop)(e,o.types.identifier(s.name),s.interop);if(t){const e=o.types.expressionStatement(o.types.assignmentExpression("=",o.types.identifier(s.name),t));e.loc=a.loc;i.push(e)}}i.push(...(0,n.buildNamespaceInitStatements)(a,s,g))}(0,n.ensureStatementsHoisted)(i);e.unshiftContainer("body",i);const{body:j,directives:w}=e.node;e.node.directives=[];e.node.body=[];const _=e.pushContainer("body",[l({MODULE_NAME:s,AMD_ARGUMENTS:o.types.arrayExpression(b),COMMONJS_ARGUMENTS:x,BROWSER_ARGUMENTS:v,IMPORT_NAMES:E,GLOBAL_TO_ASSIGN:buildBrowserInit(r,u,this.filename||"unknown",s)})])[0];const S=_.get("expression.arguments")[1].get("body");S.pushContainer("directives",w);S.pushContainer("body",j)}}}}}));t["default"]=c},7945:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=getModuleName;{const e=getModuleName;t["default"]=getModuleName=function getModuleName(t,r){var s,a,n,o;return e(t,{moduleId:(s=r.moduleId)!=null?s:t.moduleId,moduleIds:(a=r.moduleIds)!=null?a:t.moduleIds,getModuleId:(n=r.getModuleId)!=null?n:t.getModuleId,moduleRoot:(o=r.moduleRoot)!=null?o:t.moduleRoot})}}function getModuleName(e,t){const{filename:r,filenameRelative:s=r,sourceRoot:a=t.moduleRoot}=e;const{moduleId:n,moduleIds:o=!!n,getModuleId:i,moduleRoot:l=a}=t;if(!o)return null;if(n!=null&&!i){return n}let c=l!=null?l+"/":"";if(s){const e=a!=null?new RegExp("^"+a+"/?"):"";c+=s.replace(e,"").replace(/\.(\w*?)$/,"")}c=c.replace(/\\/g,"/");if(i){return i(c)||c}else{return c}}},9970:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.rewriteModuleStatementsAndPrepareHeader=rewriteModuleStatementsAndPrepareHeader;t.ensureStatementsHoisted=ensureStatementsHoisted;t.wrapInterop=wrapInterop;t.buildNamespaceInitStatements=buildNamespaceInitStatements;Object.defineProperty(t,"isModule",{enumerable:true,get:function(){return o.isModule}});Object.defineProperty(t,"rewriteThis",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"hasExports",{enumerable:true,get:function(){return c.hasExports}});Object.defineProperty(t,"isSideEffectImport",{enumerable:true,get:function(){return c.isSideEffectImport}});Object.defineProperty(t,"getModuleName",{enumerable:true,get:function(){return u.default}});var s=r(9491);var a=r(8622);var n=r(153);var o=r(9115);var i=r(5244);var l=r(4806);var c=r(7786);var u=r(7945);function rewriteModuleStatementsAndPrepareHeader(e,{loose:t,exportName:r,strict:n,allowTopLevelThis:u,strictMode:p,noInterop:f,importInterop:d=(f?"none":"babel"),lazy:m,esNamespaceOnly:y,constantReexports:g=t,enumerableModuleMeta:h=t}){(0,c.validateImportInteropOption)(d);s((0,o.isModule)(e),"Cannot process module statements in a script");e.node.sourceType="script";const b=(0,c.default)(e,r,{importInterop:d,initializeReexports:g,lazy:m,esNamespaceOnly:y});if(!u){(0,i.default)(e)}(0,l.default)(e,b);if(p!==false){const t=e.node.directives.some((e=>e.value.value==="use strict"));if(!t){e.unshiftContainer("directives",a.directive(a.directiveLiteral("use strict")))}}const x=[];if((0,c.hasExports)(b)&&!n){x.push(buildESModuleHeader(b,h))}const v=buildExportNameListDeclaration(e,b);if(v){b.exportNameListName=v.name;x.push(v.statement)}x.push(...buildExportInitializationStatements(e,b,g));return{meta:b,headers:x}}function ensureStatementsHoisted(e){e.forEach((e=>{e._blockHoist=3}))}function wrapInterop(e,t,r){if(r==="none"){return null}if(r==="node-namespace"){return a.callExpression(e.hub.addHelper("interopRequireWildcard"),[t,a.booleanLiteral(true)])}else if(r==="node-default"){return null}let s;if(r==="default"){s="interopRequireDefault"}else if(r==="namespace"){s="interopRequireWildcard"}else{throw new Error(`Unknown interop: ${r}`)}return a.callExpression(e.hub.addHelper(s),[t])}function buildNamespaceInitStatements(e,t,r=false){const s=[];let o=a.identifier(t.name);if(t.lazy)o=a.callExpression(o,[]);for(const e of t.importsNamespace){if(e===t.name)continue;s.push(n.default.statement`var NAME = SOURCE;`({NAME:e,SOURCE:a.cloneNode(o)}))}if(r){s.push(...buildReexportsFromMeta(e,t,true))}for(const r of t.reexportNamespace){s.push((t.lazy?n.default.statement` Object.defineProperty(EXPORTS, "NAME", { enumerable: true, get: function() { @@ -370,15 +295,15 @@ }); `)({NAMESPACE:t,EXPORTS:e.exportName,VERIFY_NAME_LIST:e.exportNameListName?(0,n.default)` if (Object.prototype.hasOwnProperty.call(EXPORTS_LIST, key)) return; - `({EXPORTS_LIST:e.exportNameListName}):null})}function buildExportNameListDeclaration(e,t){const r=Object.create(null);for(const e of t.local.values()){for(const t of e.names){r[t]=true}}let s=false;for(const e of t.source.values()){for(const t of e.reexports.keys()){r[t]=true}for(const t of e.reexportNamespace){r[t]=true}s=s||!!e.reexportAll}if(!s||Object.keys(r).length===0)return null;const n=e.scope.generateUidIdentifier("exportNames");delete r.default;return{name:n.name,statement:a.variableDeclaration("var",[a.variableDeclarator(n,a.valueToNode(r))])}}function buildExportInitializationStatements(e,t,r=false){const s=[];const n=[];for(const[e,r]of t.local){if(r.kind==="import"){}else if(r.kind==="hoisted"){s.push(buildInitStatement(t,r.names,a.identifier(e)))}else{n.push(...r.names)}}for(const e of t.source.values()){if(!r){s.push(...buildReexportsFromMeta(t,e,false))}for(const t of e.reexportNamespace){n.push(t)}}s.push(...chunk(n,100).map((r=>buildInitStatement(t,r,e.scope.buildUndefinedNode()))));return s}const d={computed:n.default.expression`EXPORTS["NAME"] = VALUE`,default:n.default.expression`EXPORTS.NAME = VALUE`};function buildInitStatement(e,t,r){const{stringSpecifiers:s,exportName:n}=e;return a.expressionStatement(t.reduce(((e,t)=>{const r={EXPORTS:n,NAME:t,VALUE:e};if(s.has(t)){return d.computed(r)}else{return d.default(r)}}),r))}function chunk(e,t){const r=[];for(let s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasExports=hasExports;t.isSideEffectImport=isSideEffectImport;t.validateImportInteropOption=validateImportInteropOption;t["default"]=normalizeModuleAndLoadMetadata;var s=r(1017);var a=r(7442);var n=r(7058);function hasExports(e){return e.hasExports}function isSideEffectImport(e){return e.imports.size===0&&e.importsNamespace.size===0&&e.reexports.size===0&&e.reexportNamespace.size===0&&!e.reexportAll}function validateImportInteropOption(e){if(typeof e!=="function"&&e!=="none"&&e!=="babel"&&e!=="node"){throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${e}).`)}return e}function resolveImportInterop(e,t){if(typeof e==="function"){return validateImportInteropOption(e(t))}return e}function normalizeModuleAndLoadMetadata(e,t,{importInterop:r,initializeReexports:s=false,lazy:a=false,esNamespaceOnly:n=false}){if(!t){t=e.scope.generateUidIdentifier("exports").name}const o=new Set;nameAnonymousExports(e);const{local:i,source:l,hasExports:c}=getModuleMetadata(e,{initializeReexports:s,lazy:a},o);removeModuleDeclarations(e);for(const[,e]of l){if(e.importsNamespace.size>0){e.name=e.importsNamespace.values().next().value}const t=resolveImportInterop(r,e.source);if(t==="none"){e.interop="none"}else if(t==="node"&&e.interop==="namespace"){e.interop="node-namespace"}else if(t==="node"&&e.interop==="default"){e.interop="node-default"}else if(n&&e.interop==="namespace"){e.interop="default"}}return{exportName:t,exportNameListName:null,hasExports:c,local:i,source:l,stringSpecifiers:o}}function getExportSpecifierName(e,t){if(e.isIdentifier()){return e.node.name}else if(e.isStringLiteral()){const r=e.node.value;if(!(0,a.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.node.type}`)}}function assertExportSpecifier(e){if(e.isExportSpecifier()){return}else if(e.isExportNamespaceSpecifier()){throw e.buildCodeFrameError("Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.")}else{throw e.buildCodeFrameError("Unexpected export specifier type")}}function getModuleMetadata(e,{lazy:t,initializeReexports:r},a){const n=getLocalExportMetadata(e,r,a);const o=new Map;const getData=t=>{const r=t.value;let a=o.get(r);if(!a){a={name:e.scope.generateUidIdentifier((0,s.basename)(r,(0,s.extname)(r))).name,interop:"none",loc:null,imports:new Map,importsNamespace:new Set,reexports:new Map,reexportNamespace:new Set,reexportAll:null,lazy:false,source:r};o.set(r,a)}return a};let i=false;e.get("body").forEach((e=>{if(e.isImportDeclaration()){const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{if(e.isImportDefaultSpecifier()){const r=e.get("local").node.name;t.imports.set(r,"default");const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexports.set(e,"default")}))}}else if(e.isImportNamespaceSpecifier()){const r=e.get("local").node.name;t.importsNamespace.add(r);const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexportNamespace.add(e)}))}}else if(e.isImportSpecifier()){const r=getExportSpecifierName(e.get("imported"),a);const s=e.get("local").node.name;t.imports.set(s,r);const o=n.get(s);if(o){n.delete(s);o.names.forEach((e=>{t.reexports.set(e,r)}))}}}))}else if(e.isExportAllDeclaration()){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;t.reexportAll={loc:e.node.loc}}else if(e.isExportNamedDeclaration()&&e.node.source){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{assertExportSpecifier(e);const r=getExportSpecifierName(e.get("local"),a);const s=getExportSpecifierName(e.get("exported"),a);t.reexports.set(s,r);if(s==="__esModule"){throw e.get("exported").buildCodeFrameError('Illegal export "__esModule".')}}))}else if(e.isExportNamedDeclaration()||e.isExportDefaultDeclaration()){i=true}}));for(const e of o.values()){let t=false;let r=false;if(e.importsNamespace.size>0){t=true;r=true}if(e.reexportAll){r=true}for(const s of e.imports.values()){if(s==="default")t=true;else r=true}for(const s of e.reexports.values()){if(s==="default")t=true;else r=true}if(t&&r){e.interop="namespace"}else if(t){e.interop="default"}}for(const[e,r]of o){if(t!==false&&!(isSideEffectImport(r)||r.reexportAll)){if(t===true){r.lazy=!/\./.test(e)}else if(Array.isArray(t)){r.lazy=t.indexOf(e)!==-1}else if(typeof t==="function"){r.lazy=t(e)}else{throw new Error(`.lazy must be a boolean, string array, or function`)}}}return{hasExports:i,local:n,source:o}}function getLocalExportMetadata(e,t,r){const s=new Map;e.get("body").forEach((e=>{let r;if(e.isImportDeclaration()){r="import"}else{if(e.isExportDefaultDeclaration())e=e.get("declaration");if(e.isExportNamedDeclaration()){if(e.node.declaration){e=e.get("declaration")}else if(t&&e.node.source&&e.get("source").isStringLiteral()){e.get("specifiers").forEach((e=>{assertExportSpecifier(e);s.set(e.get("local").node.name,"block")}));return}}if(e.isFunctionDeclaration()){r="hoisted"}else if(e.isClassDeclaration()){r="block"}else if(e.isVariableDeclaration({kind:"var"})){r="var"}else if(e.isVariableDeclaration()){r="block"}else{return}}Object.keys(e.getOuterBindingIdentifiers()).forEach((e=>{s.set(e,r)}))}));const a=new Map;const getLocalMetadata=e=>{const t=e.node.name;let r=a.get(t);if(!r){const n=s.get(t);if(n===undefined){throw e.buildCodeFrameError(`Exporting local "${t}", which is not declared.`)}r={names:[],kind:n};a.set(t,r)}return r};e.get("body").forEach((e=>{if(e.isExportNamedDeclaration()&&(t||!e.node.source)){if(e.node.declaration){const t=e.get("declaration");const r=t.getOuterBindingIdentifierPaths();Object.keys(r).forEach((e=>{if(e==="__esModule"){throw t.buildCodeFrameError('Illegal export "__esModule".')}getLocalMetadata(r[e]).names.push(e)}))}else{e.get("specifiers").forEach((e=>{const t=e.get("local");const s=e.get("exported");const a=getLocalMetadata(t);const n=getExportSpecifierName(s,r);if(n==="__esModule"){throw s.buildCodeFrameError('Illegal export "__esModule".')}a.names.push(n)}))}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){getLocalMetadata(t.get("id")).names.push("default")}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}}));return a}function nameAnonymousExports(e){e.get("body").forEach((e=>{if(!e.isExportDefaultDeclaration())return;(0,n.default)(e)}))}function removeModuleDeclarations(e){e.get("body").forEach((e=>{if(e.isImportDeclaration()){e.remove()}else if(e.isExportNamedDeclaration()){if(e.node.declaration){e.node.declaration._blockHoist=e.node._blockHoist;e.replaceWith(e.node.declaration)}else{e.remove()}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){t._blockHoist=e.node._blockHoist;e.replaceWith(t)}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}else if(e.isExportAllDeclaration()){e.remove()}}))}},4806:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteLiveReferences;var s=r(9491);var a=r(8622);var n=r(153);var o=r(8140);function rewriteLiveReferences(e,t){const r=new Map;const s=new Map;const requeueInParent=t=>{e.requeue(t)};for(const[e,s]of t.source){for(const[t,a]of s.imports){r.set(t,[e,a,null])}for(const t of s.importsNamespace){r.set(t,[e,null,t])}}for(const[e,r]of t.local){let t=s.get(e);if(!t){t=[];s.set(e,t)}t.push(...r.names)}const n={metadata:t,requeueInParent:requeueInParent,scope:e.scope,exported:s};e.traverse(i,n);(0,o.default)(e,new Set([...Array.from(r.keys()),...Array.from(s.keys())]));const c={seen:new WeakSet,metadata:t,requeueInParent:requeueInParent,scope:e.scope,imported:r,exported:s,buildImportReference:([e,r,s],n)=>{const o=t.source.get(e);if(s){if(o.lazy)n=a.callExpression(n,[]);return n}let i=a.identifier(o.name);if(o.lazy)i=a.callExpression(i,[]);if(r==="default"&&o.interop==="node-default"){return i}const l=t.stringSpecifiers.has(r);return a.memberExpression(i,l?a.stringLiteral(r):a.identifier(r),l)}};e.traverse(l,c)}const i={Scope(e){e.skip()},ClassDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;const{id:n}=e.node;if(!n)throw new Error("Expected class to have a name");const o=n.name;const i=r.get(o)||[];if(i.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,i,a.identifier(o)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}},VariableDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;Object.keys(e.getOuterBindingIdentifiers()).forEach((n=>{const o=r.get(n)||[];if(o.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,o,a.identifier(n)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}}))}};const buildBindingExportAssignmentExpression=(e,t,r)=>(t||[]).reduce(((t,r)=>{const{stringSpecifiers:s}=e;const n=s.has(r);return a.assignmentExpression("=",a.memberExpression(a.identifier(e.exportName),n?a.stringLiteral(r):a.identifier(r),n),t)}),r);const buildImportThrow=e=>n.default.expression.ast` + `({EXPORTS_LIST:e.exportNameListName}):null})}function buildExportNameListDeclaration(e,t){const r=Object.create(null);for(const e of t.local.values()){for(const t of e.names){r[t]=true}}let s=false;for(const e of t.source.values()){for(const t of e.reexports.keys()){r[t]=true}for(const t of e.reexportNamespace){r[t]=true}s=s||!!e.reexportAll}if(!s||Object.keys(r).length===0)return null;const n=e.scope.generateUidIdentifier("exportNames");delete r.default;return{name:n.name,statement:a.variableDeclaration("var",[a.variableDeclarator(n,a.valueToNode(r))])}}function buildExportInitializationStatements(e,t,r=false){const s=[];const n=[];for(const[e,r]of t.local){if(r.kind==="import"){}else if(r.kind==="hoisted"){s.push(buildInitStatement(t,r.names,a.identifier(e)))}else{n.push(...r.names)}}for(const e of t.source.values()){if(!r){s.push(...buildReexportsFromMeta(t,e,false))}for(const t of e.reexportNamespace){n.push(t)}}s.push(...chunk(n,100).map((r=>buildInitStatement(t,r,e.scope.buildUndefinedNode()))));return s}const f={computed:n.default.expression`EXPORTS["NAME"] = VALUE`,default:n.default.expression`EXPORTS.NAME = VALUE`};function buildInitStatement(e,t,r){const{stringSpecifiers:s,exportName:n}=e;return a.expressionStatement(t.reduce(((e,t)=>{const r={EXPORTS:n,NAME:t,VALUE:e};if(s.has(t)){return f.computed(r)}else{return f.default(r)}}),r))}function chunk(e,t){const r=[];for(let s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasExports=hasExports;t.isSideEffectImport=isSideEffectImport;t.validateImportInteropOption=validateImportInteropOption;t["default"]=normalizeModuleAndLoadMetadata;var s=r(1017);var a=r(7442);var n=r(7058);function hasExports(e){return e.hasExports}function isSideEffectImport(e){return e.imports.size===0&&e.importsNamespace.size===0&&e.reexports.size===0&&e.reexportNamespace.size===0&&!e.reexportAll}function validateImportInteropOption(e){if(typeof e!=="function"&&e!=="none"&&e!=="babel"&&e!=="node"){throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${e}).`)}return e}function resolveImportInterop(e,t){if(typeof e==="function"){return validateImportInteropOption(e(t))}return e}function normalizeModuleAndLoadMetadata(e,t,{importInterop:r,initializeReexports:s=false,lazy:a=false,esNamespaceOnly:n=false}){if(!t){t=e.scope.generateUidIdentifier("exports").name}const o=new Set;nameAnonymousExports(e);const{local:i,source:l,hasExports:c}=getModuleMetadata(e,{initializeReexports:s,lazy:a},o);removeModuleDeclarations(e);for(const[,e]of l){if(e.importsNamespace.size>0){e.name=e.importsNamespace.values().next().value}const t=resolveImportInterop(r,e.source);if(t==="none"){e.interop="none"}else if(t==="node"&&e.interop==="namespace"){e.interop="node-namespace"}else if(t==="node"&&e.interop==="default"){e.interop="node-default"}else if(n&&e.interop==="namespace"){e.interop="default"}}return{exportName:t,exportNameListName:null,hasExports:c,local:i,source:l,stringSpecifiers:o}}function getExportSpecifierName(e,t){if(e.isIdentifier()){return e.node.name}else if(e.isStringLiteral()){const r=e.node.value;if(!(0,a.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.node.type}`)}}function assertExportSpecifier(e){if(e.isExportSpecifier()){return}else if(e.isExportNamespaceSpecifier()){throw e.buildCodeFrameError("Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.")}else{throw e.buildCodeFrameError("Unexpected export specifier type")}}function getModuleMetadata(e,{lazy:t,initializeReexports:r},a){const n=getLocalExportMetadata(e,r,a);const o=new Map;const getData=t=>{const r=t.value;let a=o.get(r);if(!a){a={name:e.scope.generateUidIdentifier((0,s.basename)(r,(0,s.extname)(r))).name,interop:"none",loc:null,imports:new Map,importsNamespace:new Set,reexports:new Map,reexportNamespace:new Set,reexportAll:null,lazy:false,source:r};o.set(r,a)}return a};let i=false;e.get("body").forEach((e=>{if(e.isImportDeclaration()){const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{if(e.isImportDefaultSpecifier()){const r=e.get("local").node.name;t.imports.set(r,"default");const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexports.set(e,"default")}))}}else if(e.isImportNamespaceSpecifier()){const r=e.get("local").node.name;t.importsNamespace.add(r);const s=n.get(r);if(s){n.delete(r);s.names.forEach((e=>{t.reexportNamespace.add(e)}))}}else if(e.isImportSpecifier()){const r=getExportSpecifierName(e.get("imported"),a);const s=e.get("local").node.name;t.imports.set(s,r);const o=n.get(s);if(o){n.delete(s);o.names.forEach((e=>{t.reexports.set(e,r)}))}}}))}else if(e.isExportAllDeclaration()){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;t.reexportAll={loc:e.node.loc}}else if(e.isExportNamedDeclaration()&&e.node.source){i=true;const t=getData(e.node.source);if(!t.loc)t.loc=e.node.loc;e.get("specifiers").forEach((e=>{assertExportSpecifier(e);const r=getExportSpecifierName(e.get("local"),a);const s=getExportSpecifierName(e.get("exported"),a);t.reexports.set(s,r);if(s==="__esModule"){throw e.get("exported").buildCodeFrameError('Illegal export "__esModule".')}}))}else if(e.isExportNamedDeclaration()||e.isExportDefaultDeclaration()){i=true}}));for(const e of o.values()){let t=false;let r=false;if(e.importsNamespace.size>0){t=true;r=true}if(e.reexportAll){r=true}for(const s of e.imports.values()){if(s==="default")t=true;else r=true}for(const s of e.reexports.values()){if(s==="default")t=true;else r=true}if(t&&r){e.interop="namespace"}else if(t){e.interop="default"}}for(const[e,r]of o){if(t!==false&&!(isSideEffectImport(r)||r.reexportAll)){if(t===true){r.lazy=!/\./.test(e)}else if(Array.isArray(t)){r.lazy=t.indexOf(e)!==-1}else if(typeof t==="function"){r.lazy=t(e)}else{throw new Error(`.lazy must be a boolean, string array, or function`)}}}return{hasExports:i,local:n,source:o}}function getLocalExportMetadata(e,t,r){const s=new Map;e.get("body").forEach((e=>{let r;if(e.isImportDeclaration()){r="import"}else{if(e.isExportDefaultDeclaration())e=e.get("declaration");if(e.isExportNamedDeclaration()){if(e.node.declaration){e=e.get("declaration")}else if(t&&e.node.source&&e.get("source").isStringLiteral()){e.get("specifiers").forEach((e=>{assertExportSpecifier(e);s.set(e.get("local").node.name,"block")}));return}}if(e.isFunctionDeclaration()){r="hoisted"}else if(e.isClassDeclaration()){r="block"}else if(e.isVariableDeclaration({kind:"var"})){r="var"}else if(e.isVariableDeclaration()){r="block"}else{return}}Object.keys(e.getOuterBindingIdentifiers()).forEach((e=>{s.set(e,r)}))}));const a=new Map;const getLocalMetadata=e=>{const t=e.node.name;let r=a.get(t);if(!r){const n=s.get(t);if(n===undefined){throw e.buildCodeFrameError(`Exporting local "${t}", which is not declared.`)}r={names:[],kind:n};a.set(t,r)}return r};e.get("body").forEach((e=>{if(e.isExportNamedDeclaration()&&(t||!e.node.source)){if(e.node.declaration){const t=e.get("declaration");const r=t.getOuterBindingIdentifierPaths();Object.keys(r).forEach((e=>{if(e==="__esModule"){throw t.buildCodeFrameError('Illegal export "__esModule".')}getLocalMetadata(r[e]).names.push(e)}))}else{e.get("specifiers").forEach((e=>{const t=e.get("local");const s=e.get("exported");const a=getLocalMetadata(t);const n=getExportSpecifierName(s,r);if(n==="__esModule"){throw s.buildCodeFrameError('Illegal export "__esModule".')}a.names.push(n)}))}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){getLocalMetadata(t.get("id")).names.push("default")}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}}));return a}function nameAnonymousExports(e){e.get("body").forEach((e=>{if(!e.isExportDefaultDeclaration())return;(0,n.default)(e)}))}function removeModuleDeclarations(e){e.get("body").forEach((e=>{if(e.isImportDeclaration()){e.remove()}else if(e.isExportNamedDeclaration()){if(e.node.declaration){e.node.declaration._blockHoist=e.node._blockHoist;e.replaceWith(e.node.declaration)}else{e.remove()}}else if(e.isExportDefaultDeclaration()){const t=e.get("declaration");if(t.isFunctionDeclaration()||t.isClassDeclaration()){t._blockHoist=e.node._blockHoist;e.replaceWith(t)}else{throw t.buildCodeFrameError("Unexpected default expression export.")}}else if(e.isExportAllDeclaration()){e.remove()}}))}},4806:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteLiveReferences;var s=r(9491);var a=r(8622);var n=r(153);var o=r(8140);function rewriteLiveReferences(e,t){const r=new Map;const s=new Map;const requeueInParent=t=>{e.requeue(t)};for(const[e,s]of t.source){for(const[t,a]of s.imports){r.set(t,[e,a,null])}for(const t of s.importsNamespace){r.set(t,[e,null,t])}}for(const[e,r]of t.local){let t=s.get(e);if(!t){t=[];s.set(e,t)}t.push(...r.names)}const n={metadata:t,requeueInParent:requeueInParent,scope:e.scope,exported:s};e.traverse(i,n);(0,o.default)(e,new Set([...Array.from(r.keys()),...Array.from(s.keys())]));const c={seen:new WeakSet,metadata:t,requeueInParent:requeueInParent,scope:e.scope,imported:r,exported:s,buildImportReference:([e,r,s],n)=>{const o=t.source.get(e);if(s){if(o.lazy)n=a.callExpression(n,[]);return n}let i=a.identifier(o.name);if(o.lazy)i=a.callExpression(i,[]);if(r==="default"&&o.interop==="node-default"){return i}const l=t.stringSpecifiers.has(r);return a.memberExpression(i,l?a.stringLiteral(r):a.identifier(r),l)}};e.traverse(l,c)}const i={Scope(e){e.skip()},ClassDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;const{id:n}=e.node;if(!n)throw new Error("Expected class to have a name");const o=n.name;const i=r.get(o)||[];if(i.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,i,a.identifier(o)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}},VariableDeclaration(e){const{requeueInParent:t,exported:r,metadata:s}=this;Object.keys(e.getOuterBindingIdentifiers()).forEach((n=>{const o=r.get(n)||[];if(o.length>0){const r=a.expressionStatement(buildBindingExportAssignmentExpression(s,o,a.identifier(n)));r._blockHoist=e.node._blockHoist;t(e.insertAfter(r)[0])}}))}};const buildBindingExportAssignmentExpression=(e,t,r)=>(t||[]).reduce(((t,r)=>{const{stringSpecifiers:s}=e;const n=s.has(r);return a.assignmentExpression("=",a.memberExpression(a.identifier(e.exportName),n?a.stringLiteral(r):a.identifier(r),n),t)}),r);const buildImportThrow=e=>n.default.expression.ast` (function() { throw new Error('"' + '${e}' + '" is read-only.'); })() - `;const l={ReferencedIdentifier(e){const{seen:t,buildImportReference:r,scope:s,imported:n,requeueInParent:o}=this;if(t.has(e.node))return;t.add(e.node);const i=e.node.name;const l=n.get(i);if(l){const t=e.scope.getBinding(i);const n=s.getBinding(i);if(n!==t)return;const c=r(l,e.node);c.loc=e.node.loc;if((e.parentPath.isCallExpression({callee:e.node})||e.parentPath.isOptionalCallExpression({callee:e.node})||e.parentPath.isTaggedTemplateExpression({tag:e.node}))&&a.isMemberExpression(c)){e.replaceWith(a.sequenceExpression([a.numericLiteral(0),c]))}else if(e.isJSXIdentifier()&&a.isMemberExpression(c)){const{object:t,property:r}=c;e.replaceWith(a.jsxMemberExpression(a.jsxIdentifier(t.name),a.jsxIdentifier(r.name)))}else{e.replaceWith(c)}o(e);e.skip()}},AssignmentExpression:{exit(e){const{scope:t,seen:r,imported:n,exported:o,requeueInParent:i,buildImportReference:l}=this;if(r.has(e.node))return;r.add(e.node);const c=e.get("left");if(c.isMemberExpression())return;if(c.isIdentifier()){const r=c.node.name;if(t.getBinding(r)!==e.scope.getBinding(r)){return}const u=o.get(r);const p=n.get(r);if((u==null?void 0:u.length)>0||p){s(e.node.operator==="=","Path was not simplified");const t=e.node;if(p){t.left=l(p,t.left);t.right=a.sequenceExpression([t.right,buildImportThrow(r)])}e.replaceWith(buildBindingExportAssignmentExpression(this.metadata,u,t));i(e)}}else{const r=c.getOuterBindingIdentifiers();const s=Object.keys(r).filter((r=>t.getBinding(r)===e.scope.getBinding(r)));const l=s.find((e=>n.has(e)));if(l){e.node.right=a.sequenceExpression([e.node.right,buildImportThrow(l)])}const u=[];s.forEach((e=>{const t=o.get(e)||[];if(t.length>0){u.push(buildBindingExportAssignmentExpression(this.metadata,t,a.identifier(e)))}}));if(u.length>0){let t=a.sequenceExpression(u);if(e.parentPath.isExpressionStatement()){t=a.expressionStatement(t);t._blockHoist=e.parentPath.node._blockHoist}const r=e.insertAfter(t)[0];i(r)}}}},"ForOfStatement|ForInStatement"(e){const{scope:t,node:r}=e;const{left:s}=r;const{exported:n,scope:o}=this;if(!a.isVariableDeclaration(s)){let r=false;const i=e.get("body");const l=i.scope;for(const e of Object.keys(a.getOuterBindingIdentifiers(s))){if(n.get(e)&&o.getBinding(e)===t.getBinding(e)){r=true;if(l.hasOwnBinding(e)){l.rename(e)}}}if(!r){return}const c=t.generateUidIdentifierBasedOnNode(s);i.unshiftContainer("body",a.expressionStatement(a.assignmentExpression("=",s,c)));e.get("left").replaceWith(a.variableDeclaration("let",[a.variableDeclarator(a.cloneNode(c))]));t.registerDeclaration(e.get("left"))}}}},5244:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteThis;var s=r(6833);var a=r(7369);var n=r(8622);function rewriteThis(e){(0,a.default)(e.node,Object.assign({},o,{noScope:true}))}const o=a.default.visitors.merge([s.environmentVisitor,{ThisExpression(e){e.replaceWith(n.unaryExpression("void",n.numericLiteral(0),true))}}])},3373:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8140:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=simplifyAccess;var s=r(8622);function simplifyAccess(e,t){e.traverse(a,{scope:e.scope,bindingNames:t,seen:new WeakSet})}const a={UpdateExpression:{exit(e){const{scope:t,bindingNames:r}=this;const a=e.get("argument");if(!a.isIdentifier())return;const n=a.node.name;if(!r.has(n))return;if(t.getBinding(n)!==e.scope.getBinding(n)){return}if(e.parentPath.isExpressionStatement()&&!e.isCompletionRecord()){const t=e.node.operator=="++"?"+=":"-=";e.replaceWith(s.assignmentExpression(t,a.node,s.numericLiteral(1)))}else if(e.node.prefix){e.replaceWith(s.assignmentExpression("=",s.identifier(n),s.binaryExpression(e.node.operator[0],s.unaryExpression("+",a.node),s.numericLiteral(1))))}else{const t=e.scope.generateUidIdentifierBasedOnNode(a.node,"old");const r=t.name;e.scope.push({id:t});const n=s.binaryExpression(e.node.operator[0],s.identifier(r),s.numericLiteral(1));e.replaceWith(s.sequenceExpression([s.assignmentExpression("=",s.identifier(r),s.unaryExpression("+",a.node)),s.assignmentExpression("=",s.cloneNode(a.node),n),s.identifier(r)]))}}},AssignmentExpression:{exit(e){const{scope:t,seen:r,bindingNames:a}=this;if(e.node.operator==="=")return;if(r.has(e.node))return;r.add(e.node);const n=e.get("left");if(!n.isIdentifier())return;const o=n.node.name;if(!a.has(o))return;if(t.getBinding(o)!==e.scope.getBinding(o)){return}e.node.right=s.binaryExpression(e.node.operator.slice(0,-1),s.cloneNode(e.node.left),e.node.right);e.node.operator="="}}}},4149:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(4149);var a=r(2013)},2013:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},9545:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(2178);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-new-target",visitor:{MetaProperty(e){const t=e.get("meta");const r=e.get("property");const{scope:s}=e;if(t.isIdentifier({name:"new"})&&r.isIdentifier({name:"target"})){const t=e.findParent((e=>{if(e.isClass())return true;if(e.isFunction()&&!e.isArrowFunctionExpression()){if(e.isClassMethod({kind:"constructor"})){return false}return true}return false}));if(!t){throw e.buildCodeFrameError("new.target must be under a (non-arrow) function or a class.")}const{node:r}=t;if(!r.id){if(t.isMethod()){e.replaceWith(s.buildUndefinedNode());return}r.id=s.generateUidIdentifier("target")}const n=a.types.memberExpression(a.types.thisExpression(),a.types.identifier("constructor"));if(t.isClass()){e.replaceWith(n);return}e.replaceWith(a.types.conditionalExpression(a.types.binaryExpression("instanceof",a.types.thisExpression(),a.types.cloneNode(r.id)),n,s.buildUndefinedNode()))}}}}}));t["default"]=n},2178:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},570:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(7471);var a=r(6833);var n=r(8304);function replacePropertySuper(e,t,r){const s=new a.default({getObjectRef:t,methodPath:e,file:r});s.replace()}var o=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-object-super",visitor:{ObjectExpression(e,t){let r;const getObjectRef=()=>r=r||e.scope.generateUidIdentifier("obj");e.get("properties").forEach((e=>{if(!e.isMethod())return;replacePropertySuper(e,getObjectRef,t)}));if(r){e.scope.push({id:n.types.cloneNode(r)});e.replaceWith(n.types.assignmentExpression("=",n.types.cloneNode(r),e.node))}}}}}));t["default"]=o},7471:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},3714:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"convertFunctionParams",{enumerable:true,get:function(){return a.default}});t["default"]=void 0;var s=r(9497);var a=r(1042);var n=r(258);var o=(0,s.declare)(((e,t)=>{var r;e.assertVersion(7);const s=(r=e.assumption("ignoreFunctionLength"))!=null?r:t.loose;const o=e.assumption("noNewArrows");return{name:"transform-parameters",visitor:{Function(e){if(e.isArrowFunctionExpression()&&e.get("params").some((e=>e.isRestElement()||e.isAssignmentPattern()))){e.arrowFunctionToExpression({noNewArrows:o})}const t=(0,n.default)(e);const r=(0,a.default)(e,s);if(t||r){e.scope.crawl()}}}}}));t["default"]=o},1042:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=convertFunctionParams;var s=r(8304);const a=(0,s.template)(`\n let VARIABLE_NAME =\n arguments.length > ARGUMENT_KEY && arguments[ARGUMENT_KEY] !== undefined ?\n arguments[ARGUMENT_KEY]\n :\n DEFAULT_VALUE;\n`);const n=(0,s.template)(`\n if (ASSIGNMENT_IDENTIFIER === UNDEFINED) {\n ASSIGNMENT_IDENTIFIER = DEFAULT_VALUE;\n }\n`);const o=(0,s.template)(`\n let ASSIGNMENT_IDENTIFIER = PARAMETER_NAME === UNDEFINED ? DEFAULT_VALUE : PARAMETER_NAME ;\n`);const i=(0,s.template)(`\n let $0 = arguments.length > $1 ? arguments[$1] : undefined;\n`);const l={"ReferencedIdentifier|BindingIdentifier"(e,t){const{scope:r,node:s}=e;const{name:a}=s;if(a==="eval"||r.getBinding(a)===t.scope.parent.getBinding(a)&&t.scope.hasOwnBinding(a)){t.needsOuterBinding=true;e.stop()}},"TypeAnnotation|TSTypeAnnotation|TypeParameterDeclaration|TSTypeParameterDeclaration":e=>e.skip()};function convertFunctionParams(e,t,r,c){const u=e.get("params");const p=u.every((e=>e.isIdentifier()));if(p)return false;const{node:d,scope:f}=e;const m={stop:false,needsOuterBinding:false,scope:f};const y=[];const g=new Set;for(const e of u){for(const t of Object.keys(e.getBindingIdentifiers())){var h;const e=(h=f.bindings[t])==null?void 0:h.constantViolations;if(e){for(const r of e){const e=r.node;switch(e.type){case"VariableDeclarator":{if(e.init===null){const e=r.parentPath;if(!e.parentPath.isFor()||e.parentPath.get("body")===e){r.remove();break}}g.add(t);break}case"FunctionDeclaration":g.add(t);break}}}}}if(g.size===0){for(const e of u){if(!e.isIdentifier())e.traverse(l,m);if(m.needsOuterBinding)break}}let b=null;for(let l=0;l0){y.push(buildScopeIIFE(g,e.get("body").node));e.set("body",s.types.blockStatement(y));const t=e.get("body.body");const r=t[t.length-1].get("argument.callee");r.arrowFunctionToExpression();r.node.generator=e.node.generator;r.node.async=e.node.async;e.node.generator=false}else{e.get("body").unshiftContainer("body",y)}return true}function buildScopeIIFE(e,t){const r=[];const a=[];for(const t of e){r.push(s.types.identifier(t));a.push(s.types.identifier(t))}return s.types.returnStatement(s.types.callExpression(s.types.arrowFunctionExpression(a,t),r))}},258:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=convertFunctionRest;var s=r(8304);const a=(0,s.template)(`\n for (var LEN = ARGUMENTS.length,\n ARRAY = new Array(ARRAY_LEN),\n KEY = START;\n KEY < LEN;\n KEY++) {\n ARRAY[ARRAY_KEY] = ARGUMENTS[KEY];\n }\n`);const n=(0,s.template)(`\n (INDEX < OFFSET || ARGUMENTS.length <= INDEX) ? undefined : ARGUMENTS[INDEX]\n`);const o=(0,s.template)(`\n REF = INDEX, (REF < OFFSET || ARGUMENTS.length <= REF) ? undefined : ARGUMENTS[REF]\n`);const i=(0,s.template)(`\n ARGUMENTS.length <= OFFSET ? 0 : ARGUMENTS.length - OFFSET\n`);function referencesRest(e,t){if(e.node.name===t.name){return e.scope.bindingIdentifierEquals(t.name,t.outerBinding)}return false}const l={Scope(e,t){if(!e.scope.bindingIdentifierEquals(t.name,t.outerBinding)){e.skip()}},Flow(e){if(e.isTypeCastExpression())return;e.skip()},Function(e,t){const r=t.noOptimise;t.noOptimise=true;e.traverse(l,t);t.noOptimise=r;e.skip()},ReferencedIdentifier(e,t){const{node:r}=e;if(r.name==="arguments"){t.deopted=true}if(!referencesRest(e,t))return;if(t.noOptimise){t.deopted=true}else{const{parentPath:s}=e;if(s.listKey==="params"&&s.key0&&s.types.isIdentifier(e.params[0],{name:"this"})){t-=1}return t}function hasRest(e){const t=e.params.length;return t>0&&s.types.isRestElement(e.params[t-1])}function optimiseIndexGetter(e,t,r){const a=s.types.numericLiteral(r);let i;if(s.types.isNumericLiteral(e.parent.property)){i=s.types.numericLiteral(e.parent.property.value+r)}else if(r===0){i=e.parent.property}else{i=s.types.binaryExpression("+",e.parent.property,s.types.cloneNode(a))}const{scope:l}=e;if(!l.isPure(i)){const r=l.generateUidIdentifierBasedOnNode(i);l.push({id:r,kind:"var"});e.parentPath.replaceWith(o({ARGUMENTS:t,OFFSET:a,INDEX:i,REF:s.types.cloneNode(r)}))}else{const r=e.parentPath;r.replaceWith(n({ARGUMENTS:t,OFFSET:a,INDEX:i}));const s=r.get("test").get("left");const o=s.evaluate();if(o.confident){if(o.value===true){r.replaceWith(r.scope.buildUndefinedNode())}else{r.get("test").replaceWith(r.get("test").get("right"))}}}}function optimiseLengthGetter(e,t,r){if(r){e.parentPath.replaceWith(i({ARGUMENTS:t,OFFSET:s.types.numericLiteral(r)}))}else{e.replaceWith(t)}}function convertFunctionRest(e){const{node:t,scope:r}=e;if(!hasRest(t))return false;let n=t.params.pop().argument;const o=s.types.identifier("arguments");if(s.types.isPattern(n)){const e=n;n=r.generateUidIdentifier("ref");const a=s.types.variableDeclaration("let",[s.types.variableDeclarator(e,n)]);t.body.body.unshift(a)}const i=getParamsCount(t);const c={references:[],offset:i,argumentsNode:o,outerBinding:r.getBindingIdentifier(n.name),candidates:[],name:n.name,deopted:false};e.traverse(l,c);if(!c.deopted&&!c.references.length){for(const{path:e,cause:t}of c.candidates){const r=s.types.cloneNode(o);switch(t){case"indexGetter":optimiseIndexGetter(e,r,c.offset);break;case"lengthGetter":optimiseLengthGetter(e,r,c.offset);break;default:e.replaceWith(r)}}return true}c.references=c.references.concat(c.candidates.map((({path:e})=>e)));const u=s.types.numericLiteral(i);const p=r.generateUidIdentifier("key");const d=r.generateUidIdentifier("len");let f,m;if(i){f=s.types.binaryExpression("-",s.types.cloneNode(p),s.types.cloneNode(u));m=s.types.conditionalExpression(s.types.binaryExpression(">",s.types.cloneNode(d),s.types.cloneNode(u)),s.types.binaryExpression("-",s.types.cloneNode(d),s.types.cloneNode(u)),s.types.numericLiteral(0))}else{f=s.types.identifier(p.name);m=s.types.identifier(d.name)}const y=a({ARGUMENTS:o,ARRAY_KEY:f,ARRAY_LEN:m,START:u,ARRAY:n,KEY:p,LEN:d});if(c.deopted){t.body.body.unshift(y)}else{let t=e.getEarliestCommonAncestorFrom(c.references).getStatementParent();t.findParent((e=>{if(e.isLoop()){t=e}else{return e.isFunction()}}));t.insertBefore(y)}return true}},9497:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},2970:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3392);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-property-literals",visitor:{ObjectProperty:{exit({node:e}){const t=e.key;if(!e.computed&&a.types.isIdentifier(t)&&!a.types.isValidES3Identifier(t.name)){e.key=a.types.stringLiteral(t.name)}}}}}}));t["default"]=n},3392:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},2625:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(5875);var a=r(1017);var n=r(8304);var o=(0,s.declare)((e=>{e.assertVersion(7);function addDisplayName(e,t){const r=t.arguments[0].properties;let s=true;for(let e=0;ee.name==="createReactClass";function isCreateClass(e){if(!e||!n.types.isCallExpression(e))return false;if(!t(e.callee)&&!isCreateClassAddon(e.callee)){return false}const r=e.arguments;if(r.length!==1)return false;const s=r[0];if(!n.types.isObjectExpression(s))return false;return true}return{name:"transform-react-display-name",visitor:{ExportDefaultDeclaration({node:e},t){if(isCreateClass(e.declaration)){const r=t.filename||"unknown";let s=a.basename(r,a.extname(r));if(s==="index"){s=a.basename(a.dirname(r))}addDisplayName(s,e.declaration)}},CallExpression(e){const{node:t}=e;if(!isCreateClass(t))return;let r;e.find((function(e){if(e.isAssignmentExpression()){r=e.node.left}else if(e.isObjectProperty()){r=e.node.key}else if(e.isVariableDeclarator()){r=e.node.id}else if(e.isStatement()){return true}if(r)return true}));if(!r)return;if(n.types.isMemberExpression(r)){r=r.property}if(n.types.isIdentifier(r)){addDisplayName(r.name,t)}}}}}));t["default"]=o},5875:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9833:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"default",{enumerable:true,get:function(){return s.default}});var s=r(309)},900:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},594:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=createPlugin;var s=r(8926);var a=r(900);var n=r(8304);var o=r(6039);var i=r(2155);const l={importSource:"react",runtime:"automatic",pragma:"React.createElement",pragmaFrag:"React.Fragment"};const c=/\*?\s*@jsxImportSource\s+([^\s]+)/;const u=/\*?\s*@jsxRuntime\s+([^\s]+)/;const p=/\*?\s*@jsx\s+([^\s]+)/;const d=/\*?\s*@jsxFrag\s+([^\s]+)/;const get=(e,t)=>e.get(`@babel/plugin-react-jsx/${t}`);const set=(e,t,r)=>e.set(`@babel/plugin-react-jsx/${t}`,r);function createPlugin({name:e,development:t}){return(0,a.declare)(((r,a)=>{const{pure:o,throwIfNamespace:f=true,filter:m,runtime:y=(t?"automatic":"classic"),importSource:g=l.importSource,pragma:h=l.pragma,pragmaFrag:b=l.pragmaFrag}=a;{var{useSpread:x=false,useBuiltIns:v=false}=a;if(y==="classic"){if(typeof x!=="boolean"){throw new Error("transform-react-jsx currently only accepts a boolean option for "+"useSpread (defaults to false)")}if(typeof v!=="boolean"){throw new Error("transform-react-jsx currently only accepts a boolean option for "+"useBuiltIns (defaults to false)")}if(x&&v){throw new Error("transform-react-jsx currently only accepts useBuiltIns or useSpread "+"but not both")}}}const E={JSXOpeningElement(e,t){for(const t of e.get("attributes")){if(!t.isJSXElement())continue;const{name:r}=t.node.name;if(r==="__source"||r==="__self"){throw e.buildCodeFrameError(`__source and __self should not be defined in props and are reserved for internal usage.`)}}const r=n.types.jsxAttribute(n.types.jsxIdentifier("__self"),n.types.jsxExpressionContainer(n.types.thisExpression()));const s=n.types.jsxAttribute(n.types.jsxIdentifier("__source"),n.types.jsxExpressionContainer(makeSource(e,t)));e.pushContainer("attributes",[r,s])}};return{name:e,inherits:s.default,visitor:{JSXNamespacedName(e){if(f){throw e.buildCodeFrameError(`Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can set \`throwIfNamespace: false\` to bypass this warning.`)}},JSXSpreadChild(e){throw e.buildCodeFrameError("Spread children are not supported in React.")},Program:{enter(e,r){const{file:s}=r;let o=y;let i=g;let f=h;let m=b;let x=!!a.importSource;let v=!!a.pragma;let j=!!a.pragmaFrag;if(s.ast.comments){for(const e of s.ast.comments){const t=c.exec(e.value);if(t){i=t[1];x=true}const r=u.exec(e.value);if(r){o=r[1]}const s=p.exec(e.value);if(s){f=s[1];v=true}const a=d.exec(e.value);if(a){m=a[1];j=true}}}set(r,"runtime",o);if(o==="classic"){if(x){throw e.buildCodeFrameError(`importSource cannot be set when runtime is classic.`)}const t=toMemberExpression(f);const s=toMemberExpression(m);set(r,"id/createElement",(()=>n.types.cloneNode(t)));set(r,"id/fragment",(()=>n.types.cloneNode(s)));set(r,"defaultPure",f===l.pragma)}else if(o==="automatic"){if(v||j){throw e.buildCodeFrameError(`pragma and pragmaFrag cannot be set when runtime is automatic.`)}const define=(t,s)=>set(r,t,createImportLazily(r,e,s,i));define("id/jsx",t?"jsxDEV":"jsx");define("id/jsxs",t?"jsxDEV":"jsxs");define("id/createElement","createElement");define("id/fragment","Fragment");set(r,"defaultPure",i===l.importSource)}else{throw e.buildCodeFrameError(`Runtime must be either "classic" or "automatic".`)}if(t){e.traverse(E,r)}}},JSXElement:{exit(e,t){let r;if(get(t,"runtime")==="classic"||shouldUseCreateElement(e)){r=buildCreateElementCall(e,t)}else{r=buildJSXElementCall(e,t)}e.replaceWith(n.types.inherits(r,e.node))}},JSXFragment:{exit(e,t){let r;if(get(t,"runtime")==="classic"){r=buildCreateElementFragmentCall(e,t)}else{r=buildJSXFragmentCall(e,t)}e.replaceWith(n.types.inherits(r,e.node))}},JSXAttribute(e){if(n.types.isJSXElement(e.node.value)){e.node.value=n.types.jsxExpressionContainer(e.node.value)}}}};function call(e,t,r){const s=n.types.callExpression(get(e,`id/${t}`)(),r);if(o!=null?o:get(e,"defaultPure"))(0,i.default)(s);return s}function shouldUseCreateElement(e){const t=e.get("openingElement");const r=t.node.attributes;let s=false;for(let e=0;e1){t=n.types.arrayExpression(e)}else{return undefined}return n.types.objectProperty(n.types.identifier("children"),t)}function buildJSXElementCall(e,r){const s=e.get("openingElement");const a=[getTag(s)];const o=[];const i=Object.create(null);for(const t of s.get("attributes")){if(t.isJSXAttribute()&&n.types.isJSXIdentifier(t.node.name)){const{name:r}=t.node.name;switch(r){case"__source":case"__self":if(i[r])throw sourceSelfError(e,r);case"key":{const e=convertAttributeValue(t.node.value);if(e===null){throw t.buildCodeFrameError('Please provide an explicit key value. Using "key" as a shorthand for "key={true}" is not allowed.')}i[r]=e;break}default:o.push(t)}}else{o.push(t)}}const l=n.types.react.buildChildren(e.node);let c;if(o.length||l.length){c=buildJSXOpeningElementAttributes(o,r,l)}else{c=n.types.objectExpression([])}a.push(c);if(t){var u,p,d;a.push((u=i.key)!=null?u:e.scope.buildUndefinedNode(),n.types.booleanLiteral(l.length>1),(p=i.__source)!=null?p:e.scope.buildUndefinedNode(),(d=i.__self)!=null?d:n.types.thisExpression())}else if(i.key!==undefined){a.push(i.key)}return call(r,l.length>1?"jsxs":"jsx",a)}function buildJSXOpeningElementAttributes(e,t,r){const s=e.reduce(accumulateAttribute,[]);if((r==null?void 0:r.length)>0){s.push(buildChildrenProperty(r))}return n.types.objectExpression(s)}function buildJSXFragmentCall(e,r){const s=[get(r,"id/fragment")()];const a=n.types.react.buildChildren(e.node);s.push(n.types.objectExpression(a.length>0?[buildChildrenProperty(a)]:[]));if(t){s.push(e.scope.buildUndefinedNode(),n.types.booleanLiteral(a.length>1))}return call(r,a.length>1?"jsxs":"jsx",s)}function buildCreateElementFragmentCall(e,t){if(m&&!m(e.node,t))return;return call(t,"createElement",[get(t,"id/fragment")(),n.types.nullLiteral(),...n.types.react.buildChildren(e.node)])}function buildCreateElementCall(e,t){const r=e.get("openingElement");return call(t,"createElement",[getTag(r),buildCreateElementOpeningElementAttributes(t,e,r.get("attributes")),...n.types.react.buildChildren(e.node)])}function getTag(e){const t=convertJSXIdentifier(e.node.name,e.node);let r;if(n.types.isIdentifier(t)){r=t.name}else if(n.types.isLiteral(t)){r=t.value}if(n.types.react.isCompatTag(r)){return n.types.stringLiteral(r)}else{return t}}function buildCreateElementOpeningElementAttributes(e,t,r){const s=get(e,"runtime");{if(s!=="automatic"){const t=[];const s=r.reduce(accumulateAttribute,[]);if(!x){let e=0;s.forEach(((r,a)=>{if(n.types.isSpreadElement(r)){if(a>e){t.push(n.types.objectExpression(s.slice(e,a)))}t.push(r.argument);e=a+1}}));if(s.length>e){t.push(n.types.objectExpression(s.slice(e)))}}else if(s.length){t.push(n.types.objectExpression(s))}if(!t.length){return n.types.nullLiteral()}if(t.length===1){return t[0]}if(!n.types.isObjectExpression(t[0])){t.unshift(n.types.objectExpression([]))}const a=v?n.types.memberExpression(n.types.identifier("Object"),n.types.identifier("assign")):e.addHelper("extends");return n.types.callExpression(a,t)}}const a=[];const o=Object.create(null);for(const e of r){const r=n.types.isJSXAttribute(e)&&n.types.isJSXIdentifier(e.name)&&e.name.name;if(s==="automatic"&&(r==="__source"||r==="__self")){if(o[r])throw sourceSelfError(t,r);o[r]=true}accumulateAttribute(a,e)}return a.length===1&&n.types.isSpreadElement(a[0])?a[0].argument:a.length>0?n.types.objectExpression(a):n.types.nullLiteral()}}));function getSource(e,r){switch(r){case"Fragment":return`${e}/${t?"jsx-dev-runtime":"jsx-runtime"}`;case"jsxDEV":return`${e}/jsx-dev-runtime`;case"jsx":case"jsxs":return`${e}/jsx-runtime`;case"createElement":return e}}function createImportLazily(e,t,r,s){return()=>{const a=getSource(s,r);if((0,o.isModule)(t)){let s=get(e,`imports/${r}`);if(s)return n.types.cloneNode(s);s=(0,o.addNamed)(t,r,a,{importedInterop:"uncompiled",importPosition:"after"});set(e,`imports/${r}`,s);return s}else{let s=get(e,`requires/${a}`);if(s){s=n.types.cloneNode(s)}else{s=(0,o.addNamespace)(t,a,{importedInterop:"uncompiled"});set(e,`requires/${a}`,s)}return n.types.memberExpression(s,n.types.identifier(r))}}}}function toMemberExpression(e){return e.split(".").map((e=>n.types.identifier(e))).reduce(((e,t)=>n.types.memberExpression(e,t)))}function makeSource(e,t){const r=e.node.loc;if(!r){return e.scope.buildUndefinedNode()}if(!t.fileNameIdentifier){const{filename:r=""}=t;const s=e.scope.generateUidIdentifier("_jsxFileName");const a=e.hub.getScope();if(a){a.push({id:s,init:n.types.stringLiteral(r)})}t.fileNameIdentifier=s}return makeTrace(n.types.cloneNode(t.fileNameIdentifier),r.start.line,r.start.column)}function makeTrace(e,t,r){const s=t!=null?n.types.numericLiteral(t):n.types.nullLiteral();const a=r!=null?n.types.numericLiteral(r+1):n.types.nullLiteral();const o=n.types.objectProperty(n.types.identifier("fileName"),e);const i=n.types.objectProperty(n.types.identifier("lineNumber"),s);const l=n.types.objectProperty(n.types.identifier("columnNumber"),a);return n.types.objectExpression([o,i,l])}function sourceSelfError(e,t){const r=`transform-react-jsx-${t.slice(2)}`;return e.buildCodeFrameError(`Duplicate ${t} prop found. You are most likely using the deprecated ${r} Babel plugin. Both __source and __self are automatically set when using the automatic runtime. Please remove transform-react-jsx-source and transform-react-jsx-self from your Babel config.`)}},309:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(594);var a=(0,s.default)({name:"transform-react-jsx/development",development:true});t["default"]=a},496:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3100);var a=r(2155);var n=r(8304);const o=new Map([["react",["cloneElement","createContext","createElement","createFactory","createRef","forwardRef","isValidElement","memo","lazy"]],["react-dom",["createPortal"]]]);var i=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-react-pure-annotations",visitor:{CallExpression(e){if(isReactCall(e)){(0,a.default)(e)}}}}}));t["default"]=i;function isReactCall(e){if(!n.types.isMemberExpression(e.node.callee)){const t=e.get("callee");for(const[e,r]of o){for(const s of r){if(t.referencesImport(e,s)){return true}}}return false}for(const[t,r]of o){const s=e.get("callee.object");if(s.referencesImport(t,"default")||s.referencesImport(t,"*")){for(const t of r){if(n.types.isIdentifier(e.node.callee.property,{name:t})){return true}}return false}}return false}},3100:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8720:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8403);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-reserved-words",visitor:{"BindingIdentifier|ReferencedIdentifier"(e){if(!a.types.isValidES3Identifier(e.node.name)){e.scope.rename(e.node.name)}}}}}));t["default"]=n},8403:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8648:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9836);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-shorthand-properties",visitor:{ObjectMethod(e){const{node:t}=e;if(t.kind==="method"){const r=a.types.functionExpression(null,t.params,t.body,t.generator,t.async);r.returnType=t.returnType;const s=a.types.toComputedKey(t);if(a.types.isStringLiteral(s,{value:"__proto__"})){e.replaceWith(a.types.objectProperty(s,r,true))}else{e.replaceWith(a.types.objectProperty(t.key,r,t.computed))}}},ObjectProperty(e){const{node:t}=e;if(t.shorthand){const r=a.types.toComputedKey(t);if(a.types.isStringLiteral(r,{value:"__proto__"})){e.replaceWith(a.types.objectProperty(r,t.value,true))}else{t.shorthand=false}}}}}}));t["default"]=n},9836:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8476:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(2763);var a=r(5480);var n=r(8304);var o=(0,s.declare)(((e,t)=>{var r,s;e.assertVersion(7);const o=(r=e.assumption("iterableIsArray"))!=null?r:t.loose;const i=(s=t.allowArrayLike)!=null?s:e.assumption("arrayLikeIsIterable");function getSpreadLiteral(e,t){if(o&&!n.types.isIdentifier(e.argument,{name:"arguments"})){return e.argument}else{return t.toArray(e.argument,true,i)}}function hasHole(e){return e.elements.some((e=>e===null))}function hasSpread(e){for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1245:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(7521);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-sticky-regex",visitor:{RegExpLiteral(e){const{node:t}=e;if(!t.flags.includes("y"))return;e.replaceWith(a.types.newExpression(a.types.identifier("RegExp"),[a.types.stringLiteral(t.pattern),a.types.stringLiteral(t.flags)]))}}}}));t["default"]=n},7521:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5356:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9116);var a=r(8304);var n=(0,s.declare)(((e,t)=>{var r,s;e.assertVersion(7);const n=(r=e.assumption("ignoreToPrimitiveHint"))!=null?r:t.loose;const o=(s=e.assumption("mutableTemplateObject"))!=null?s:t.loose;let i="taggedTemplateLiteral";if(o)i+="Loose";function buildConcatCallExpressions(e){let t=true;return e.reduce((function(e,r){let s=a.types.isLiteral(r);if(!s&&t){s=true;t=false}if(s&&a.types.isCallExpression(e)){e.arguments.push(r);return e}return a.types.callExpression(a.types.memberExpression(e,a.types.identifier("concat")),[r])}))}return{name:"transform-template-literals",visitor:{TaggedTemplateExpression(e){const{node:t}=e;const{quasi:r}=t;const s=[];const n=[];let o=true;for(const t of r.quasis){const{raw:r,cooked:i}=t.value;const l=i==null?e.scope.buildUndefinedNode():a.types.stringLiteral(i);s.push(l);n.push(a.types.stringLiteral(r));if(r!==i){o=false}}const l=[a.types.arrayExpression(s)];if(!o){l.push(a.types.arrayExpression(n))}const c=e.scope.generateUidIdentifier("templateObject");e.scope.getProgramParent().push({id:a.types.cloneNode(c)});e.replaceWith(a.types.callExpression(t.tag,[a.template.expression.ast` + `;const l={ReferencedIdentifier(e){const{seen:t,buildImportReference:r,scope:s,imported:n,requeueInParent:o}=this;if(t.has(e.node))return;t.add(e.node);const i=e.node.name;const l=n.get(i);if(l){const t=e.scope.getBinding(i);const n=s.getBinding(i);if(n!==t)return;const c=r(l,e.node);c.loc=e.node.loc;if((e.parentPath.isCallExpression({callee:e.node})||e.parentPath.isOptionalCallExpression({callee:e.node})||e.parentPath.isTaggedTemplateExpression({tag:e.node}))&&a.isMemberExpression(c)){e.replaceWith(a.sequenceExpression([a.numericLiteral(0),c]))}else if(e.isJSXIdentifier()&&a.isMemberExpression(c)){const{object:t,property:r}=c;e.replaceWith(a.jsxMemberExpression(a.jsxIdentifier(t.name),a.jsxIdentifier(r.name)))}else{e.replaceWith(c)}o(e);e.skip()}},AssignmentExpression:{exit(e){const{scope:t,seen:r,imported:n,exported:o,requeueInParent:i,buildImportReference:l}=this;if(r.has(e.node))return;r.add(e.node);const c=e.get("left");if(c.isMemberExpression())return;if(c.isIdentifier()){const r=c.node.name;if(t.getBinding(r)!==e.scope.getBinding(r)){return}const u=o.get(r);const p=n.get(r);if((u==null?void 0:u.length)>0||p){s(e.node.operator==="=","Path was not simplified");const t=e.node;if(p){t.left=l(p,t.left);t.right=a.sequenceExpression([t.right,buildImportThrow(r)])}e.replaceWith(buildBindingExportAssignmentExpression(this.metadata,u,t));i(e)}}else{const r=c.getOuterBindingIdentifiers();const s=Object.keys(r).filter((r=>t.getBinding(r)===e.scope.getBinding(r)));const l=s.find((e=>n.has(e)));if(l){e.node.right=a.sequenceExpression([e.node.right,buildImportThrow(l)])}const u=[];s.forEach((e=>{const t=o.get(e)||[];if(t.length>0){u.push(buildBindingExportAssignmentExpression(this.metadata,t,a.identifier(e)))}}));if(u.length>0){let t=a.sequenceExpression(u);if(e.parentPath.isExpressionStatement()){t=a.expressionStatement(t);t._blockHoist=e.parentPath.node._blockHoist}const r=e.insertAfter(t)[0];i(r)}}}},"ForOfStatement|ForInStatement"(e){const{scope:t,node:r}=e;const{left:s}=r;const{exported:n,scope:o}=this;if(!a.isVariableDeclaration(s)){let r=false;const i=e.get("body");const l=i.scope;for(const e of Object.keys(a.getOuterBindingIdentifiers(s))){if(n.get(e)&&o.getBinding(e)===t.getBinding(e)){r=true;if(l.hasOwnBinding(e)){l.rename(e)}}}if(!r){return}const c=t.generateUidIdentifierBasedOnNode(s);i.unshiftContainer("body",a.expressionStatement(a.assignmentExpression("=",s,c)));e.get("left").replaceWith(a.variableDeclaration("let",[a.variableDeclarator(a.cloneNode(c))]));t.registerDeclaration(e.get("left"))}}}},5244:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteThis;var s=r(6833);var a=r(7369);var n=r(8622);function rewriteThis(e){(0,a.default)(e.node,Object.assign({},o,{noScope:true}))}const o=a.default.visitors.merge([s.environmentVisitor,{ThisExpression(e){e.replaceWith(n.unaryExpression("void",n.numericLiteral(0),true))}}])},3373:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8140:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=simplifyAccess;var s=r(8622);function simplifyAccess(e,t){e.traverse(a,{scope:e.scope,bindingNames:t,seen:new WeakSet})}const a={UpdateExpression:{exit(e){const{scope:t,bindingNames:r}=this;const a=e.get("argument");if(!a.isIdentifier())return;const n=a.node.name;if(!r.has(n))return;if(t.getBinding(n)!==e.scope.getBinding(n)){return}if(e.parentPath.isExpressionStatement()&&!e.isCompletionRecord()){const t=e.node.operator=="++"?"+=":"-=";e.replaceWith(s.assignmentExpression(t,a.node,s.numericLiteral(1)))}else if(e.node.prefix){e.replaceWith(s.assignmentExpression("=",s.identifier(n),s.binaryExpression(e.node.operator[0],s.unaryExpression("+",a.node),s.numericLiteral(1))))}else{const t=e.scope.generateUidIdentifierBasedOnNode(a.node,"old");const r=t.name;e.scope.push({id:t});const n=s.binaryExpression(e.node.operator[0],s.identifier(r),s.numericLiteral(1));e.replaceWith(s.sequenceExpression([s.assignmentExpression("=",s.identifier(r),s.unaryExpression("+",a.node)),s.assignmentExpression("=",s.cloneNode(a.node),n),s.identifier(r)]))}}},AssignmentExpression:{exit(e){const{scope:t,seen:r,bindingNames:a}=this;if(e.node.operator==="=")return;if(r.has(e.node))return;r.add(e.node);const n=e.get("left");if(!n.isIdentifier())return;const o=n.node.name;if(!a.has(o))return;if(t.getBinding(o)!==e.scope.getBinding(o)){return}e.node.right=s.binaryExpression(e.node.operator.slice(0,-1),s.cloneNode(e.node.left),e.node.right);e.node.operator="="}}}},4149:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(4149);var a=r(2013)},2013:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},9545:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(2178);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-new-target",visitor:{MetaProperty(e){const t=e.get("meta");const r=e.get("property");const{scope:s}=e;if(t.isIdentifier({name:"new"})&&r.isIdentifier({name:"target"})){const t=e.findParent((e=>{if(e.isClass())return true;if(e.isFunction()&&!e.isArrowFunctionExpression()){if(e.isClassMethod({kind:"constructor"})){return false}return true}return false}));if(!t){throw e.buildCodeFrameError("new.target must be under a (non-arrow) function or a class.")}const{node:r}=t;if(!r.id){if(t.isMethod()){e.replaceWith(s.buildUndefinedNode());return}r.id=s.generateUidIdentifier("target")}const n=a.types.memberExpression(a.types.thisExpression(),a.types.identifier("constructor"));if(t.isClass()){e.replaceWith(n);return}e.replaceWith(a.types.conditionalExpression(a.types.binaryExpression("instanceof",a.types.thisExpression(),a.types.cloneNode(r.id)),n,s.buildUndefinedNode()))}}}}}));t["default"]=n},2178:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},570:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(7471);var a=r(6833);var n=r(8304);function replacePropertySuper(e,t,r){const s=new a.default({getObjectRef:t,methodPath:e,file:r});s.replace()}var o=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-object-super",visitor:{ObjectExpression(e,t){let r;const getObjectRef=()=>r=r||e.scope.generateUidIdentifier("obj");e.get("properties").forEach((e=>{if(!e.isMethod())return;replacePropertySuper(e,getObjectRef,t)}));if(r){e.scope.push({id:n.types.cloneNode(r)});e.replaceWith(n.types.assignmentExpression("=",n.types.cloneNode(r),e.node))}}}}}));t["default"]=o},7471:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},3714:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"convertFunctionParams",{enumerable:true,get:function(){return a.default}});t["default"]=void 0;var s=r(9497);var a=r(1042);var n=r(258);var o=(0,s.declare)(((e,t)=>{var r;e.assertVersion(7);const s=(r=e.assumption("ignoreFunctionLength"))!=null?r:t.loose;const o=e.assumption("noNewArrows");return{name:"transform-parameters",visitor:{Function(e){if(e.isArrowFunctionExpression()&&e.get("params").some((e=>e.isRestElement()||e.isAssignmentPattern()))){e.arrowFunctionToExpression({noNewArrows:o})}const t=(0,n.default)(e);const r=(0,a.default)(e,s);if(t||r){e.scope.crawl()}}}}}));t["default"]=o},1042:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=convertFunctionParams;var s=r(8304);const a=(0,s.template)(`\n let VARIABLE_NAME =\n arguments.length > ARGUMENT_KEY && arguments[ARGUMENT_KEY] !== undefined ?\n arguments[ARGUMENT_KEY]\n :\n DEFAULT_VALUE;\n`);const n=(0,s.template)(`\n if (ASSIGNMENT_IDENTIFIER === UNDEFINED) {\n ASSIGNMENT_IDENTIFIER = DEFAULT_VALUE;\n }\n`);const o=(0,s.template)(`\n let ASSIGNMENT_IDENTIFIER = PARAMETER_NAME === UNDEFINED ? DEFAULT_VALUE : PARAMETER_NAME ;\n`);const i=(0,s.template)(`\n let $0 = arguments.length > $1 ? arguments[$1] : undefined;\n`);const l={"ReferencedIdentifier|BindingIdentifier"(e,t){const{scope:r,node:s}=e;const{name:a}=s;if(a==="eval"||r.getBinding(a)===t.scope.parent.getBinding(a)&&t.scope.hasOwnBinding(a)){t.needsOuterBinding=true;e.stop()}},"TypeAnnotation|TSTypeAnnotation|TypeParameterDeclaration|TSTypeParameterDeclaration":e=>e.skip()};function convertFunctionParams(e,t,r,c){const u=e.get("params");const p=u.every((e=>e.isIdentifier()));if(p)return false;const{node:f,scope:d}=e;const m={stop:false,needsOuterBinding:false,scope:d};const y=[];const g=new Set;for(const e of u){for(const t of Object.keys(e.getBindingIdentifiers())){var h;const e=(h=d.bindings[t])==null?void 0:h.constantViolations;if(e){for(const r of e){const e=r.node;switch(e.type){case"VariableDeclarator":{if(e.init===null){const e=r.parentPath;if(!e.parentPath.isFor()||e.parentPath.get("body")===e){r.remove();break}}g.add(t);break}case"FunctionDeclaration":g.add(t);break}}}}}if(g.size===0){for(const e of u){if(!e.isIdentifier())e.traverse(l,m);if(m.needsOuterBinding)break}}let b=null;for(let l=0;l0){y.push(buildScopeIIFE(g,e.get("body").node));e.set("body",s.types.blockStatement(y));const t=e.get("body.body");const r=t[t.length-1].get("argument.callee");r.arrowFunctionToExpression();r.node.generator=e.node.generator;r.node.async=e.node.async;e.node.generator=false}else{e.get("body").unshiftContainer("body",y)}return true}function buildScopeIIFE(e,t){const r=[];const a=[];for(const t of e){r.push(s.types.identifier(t));a.push(s.types.identifier(t))}return s.types.returnStatement(s.types.callExpression(s.types.arrowFunctionExpression(a,t),r))}},258:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=convertFunctionRest;var s=r(8304);const a=(0,s.template)(`\n for (var LEN = ARGUMENTS.length,\n ARRAY = new Array(ARRAY_LEN),\n KEY = START;\n KEY < LEN;\n KEY++) {\n ARRAY[ARRAY_KEY] = ARGUMENTS[KEY];\n }\n`);const n=(0,s.template)(`\n (INDEX < OFFSET || ARGUMENTS.length <= INDEX) ? undefined : ARGUMENTS[INDEX]\n`);const o=(0,s.template)(`\n REF = INDEX, (REF < OFFSET || ARGUMENTS.length <= REF) ? undefined : ARGUMENTS[REF]\n`);const i=(0,s.template)(`\n ARGUMENTS.length <= OFFSET ? 0 : ARGUMENTS.length - OFFSET\n`);function referencesRest(e,t){if(e.node.name===t.name){return e.scope.bindingIdentifierEquals(t.name,t.outerBinding)}return false}const l={Scope(e,t){if(!e.scope.bindingIdentifierEquals(t.name,t.outerBinding)){e.skip()}},Flow(e){if(e.isTypeCastExpression())return;e.skip()},Function(e,t){const r=t.noOptimise;t.noOptimise=true;e.traverse(l,t);t.noOptimise=r;e.skip()},ReferencedIdentifier(e,t){const{node:r}=e;if(r.name==="arguments"){t.deopted=true}if(!referencesRest(e,t))return;if(t.noOptimise){t.deopted=true}else{const{parentPath:s}=e;if(s.listKey==="params"&&s.key0&&s.types.isIdentifier(e.params[0],{name:"this"})){t-=1}return t}function hasRest(e){const t=e.params.length;return t>0&&s.types.isRestElement(e.params[t-1])}function optimiseIndexGetter(e,t,r){const a=s.types.numericLiteral(r);let i;if(s.types.isNumericLiteral(e.parent.property)){i=s.types.numericLiteral(e.parent.property.value+r)}else if(r===0){i=e.parent.property}else{i=s.types.binaryExpression("+",e.parent.property,s.types.cloneNode(a))}const{scope:l}=e;if(!l.isPure(i)){const r=l.generateUidIdentifierBasedOnNode(i);l.push({id:r,kind:"var"});e.parentPath.replaceWith(o({ARGUMENTS:t,OFFSET:a,INDEX:i,REF:s.types.cloneNode(r)}))}else{const r=e.parentPath;r.replaceWith(n({ARGUMENTS:t,OFFSET:a,INDEX:i}));const s=r.get("test").get("left");const o=s.evaluate();if(o.confident){if(o.value===true){r.replaceWith(r.scope.buildUndefinedNode())}else{r.get("test").replaceWith(r.get("test").get("right"))}}}}function optimiseLengthGetter(e,t,r){if(r){e.parentPath.replaceWith(i({ARGUMENTS:t,OFFSET:s.types.numericLiteral(r)}))}else{e.replaceWith(t)}}function convertFunctionRest(e){const{node:t,scope:r}=e;if(!hasRest(t))return false;let n=t.params.pop().argument;const o=s.types.identifier("arguments");if(s.types.isPattern(n)){const e=n;n=r.generateUidIdentifier("ref");const a=s.types.variableDeclaration("let",[s.types.variableDeclarator(e,n)]);t.body.body.unshift(a)}const i=getParamsCount(t);const c={references:[],offset:i,argumentsNode:o,outerBinding:r.getBindingIdentifier(n.name),candidates:[],name:n.name,deopted:false};e.traverse(l,c);if(!c.deopted&&!c.references.length){for(const{path:e,cause:t}of c.candidates){const r=s.types.cloneNode(o);switch(t){case"indexGetter":optimiseIndexGetter(e,r,c.offset);break;case"lengthGetter":optimiseLengthGetter(e,r,c.offset);break;default:e.replaceWith(r)}}return true}c.references=c.references.concat(c.candidates.map((({path:e})=>e)));const u=s.types.numericLiteral(i);const p=r.generateUidIdentifier("key");const f=r.generateUidIdentifier("len");let d,m;if(i){d=s.types.binaryExpression("-",s.types.cloneNode(p),s.types.cloneNode(u));m=s.types.conditionalExpression(s.types.binaryExpression(">",s.types.cloneNode(f),s.types.cloneNode(u)),s.types.binaryExpression("-",s.types.cloneNode(f),s.types.cloneNode(u)),s.types.numericLiteral(0))}else{d=s.types.identifier(p.name);m=s.types.identifier(f.name)}const y=a({ARGUMENTS:o,ARRAY_KEY:d,ARRAY_LEN:m,START:u,ARRAY:n,KEY:p,LEN:f});if(c.deopted){t.body.body.unshift(y)}else{let t=e.getEarliestCommonAncestorFrom(c.references).getStatementParent();t.findParent((e=>{if(e.isLoop()){t=e}else{return e.isFunction()}}));t.insertBefore(y)}return true}},9497:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},2970:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3392);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-property-literals",visitor:{ObjectProperty:{exit({node:e}){const t=e.key;if(!e.computed&&a.types.isIdentifier(t)&&!a.types.isValidES3Identifier(t.name)){e.key=a.types.stringLiteral(t.name)}}}}}}));t["default"]=n},3392:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},2625:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(5875);var a=r(1017);var n=r(8304);var o=(0,s.declare)((e=>{e.assertVersion(7);function addDisplayName(e,t){const r=t.arguments[0].properties;let s=true;for(let e=0;ee.name==="createReactClass";function isCreateClass(e){if(!e||!n.types.isCallExpression(e))return false;if(!t(e.callee)&&!isCreateClassAddon(e.callee)){return false}const r=e.arguments;if(r.length!==1)return false;const s=r[0];if(!n.types.isObjectExpression(s))return false;return true}return{name:"transform-react-display-name",visitor:{ExportDefaultDeclaration({node:e},t){if(isCreateClass(e.declaration)){const r=t.filename||"unknown";let s=a.basename(r,a.extname(r));if(s==="index"){s=a.basename(a.dirname(r))}addDisplayName(s,e.declaration)}},CallExpression(e){const{node:t}=e;if(!isCreateClass(t))return;let r;e.find((function(e){if(e.isAssignmentExpression()){r=e.node.left}else if(e.isObjectProperty()){r=e.node.key}else if(e.isVariableDeclarator()){r=e.node.id}else if(e.isStatement()){return true}if(r)return true}));if(!r)return;if(n.types.isMemberExpression(r)){r=r.property}if(n.types.isIdentifier(r)){addDisplayName(r.name,t)}}}}}));t["default"]=o},5875:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9833:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"default",{enumerable:true,get:function(){return s.default}});var s=r(309)},900:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},594:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=createPlugin;var s=r(8926);var a=r(900);var n=r(8304);var o=r(9115);var i=r(2155);const l={importSource:"react",runtime:"automatic",pragma:"React.createElement",pragmaFrag:"React.Fragment"};const c=/\*?\s*@jsxImportSource\s+([^\s]+)/;const u=/\*?\s*@jsxRuntime\s+([^\s]+)/;const p=/\*?\s*@jsx\s+([^\s]+)/;const f=/\*?\s*@jsxFrag\s+([^\s]+)/;const get=(e,t)=>e.get(`@babel/plugin-react-jsx/${t}`);const set=(e,t,r)=>e.set(`@babel/plugin-react-jsx/${t}`,r);function createPlugin({name:e,development:t}){return(0,a.declare)(((r,a)=>{const{pure:o,throwIfNamespace:d=true,filter:m,runtime:y=(t?"automatic":"classic"),importSource:g=l.importSource,pragma:h=l.pragma,pragmaFrag:b=l.pragmaFrag}=a;{var{useSpread:x=false,useBuiltIns:v=false}=a;if(y==="classic"){if(typeof x!=="boolean"){throw new Error("transform-react-jsx currently only accepts a boolean option for "+"useSpread (defaults to false)")}if(typeof v!=="boolean"){throw new Error("transform-react-jsx currently only accepts a boolean option for "+"useBuiltIns (defaults to false)")}if(x&&v){throw new Error("transform-react-jsx currently only accepts useBuiltIns or useSpread "+"but not both")}}}const E={JSXOpeningElement(e,t){for(const t of e.get("attributes")){if(!t.isJSXElement())continue;const{name:r}=t.node.name;if(r==="__source"||r==="__self"){throw e.buildCodeFrameError(`__source and __self should not be defined in props and are reserved for internal usage.`)}}const r=n.types.jsxAttribute(n.types.jsxIdentifier("__self"),n.types.jsxExpressionContainer(n.types.thisExpression()));const s=n.types.jsxAttribute(n.types.jsxIdentifier("__source"),n.types.jsxExpressionContainer(makeSource(e,t)));e.pushContainer("attributes",[r,s])}};return{name:e,inherits:s.default,visitor:{JSXNamespacedName(e){if(d){throw e.buildCodeFrameError(`Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can set \`throwIfNamespace: false\` to bypass this warning.`)}},JSXSpreadChild(e){throw e.buildCodeFrameError("Spread children are not supported in React.")},Program:{enter(e,r){const{file:s}=r;let o=y;let i=g;let d=h;let m=b;let x=!!a.importSource;let v=!!a.pragma;let j=!!a.pragmaFrag;if(s.ast.comments){for(const e of s.ast.comments){const t=c.exec(e.value);if(t){i=t[1];x=true}const r=u.exec(e.value);if(r){o=r[1]}const s=p.exec(e.value);if(s){d=s[1];v=true}const a=f.exec(e.value);if(a){m=a[1];j=true}}}set(r,"runtime",o);if(o==="classic"){if(x){throw e.buildCodeFrameError(`importSource cannot be set when runtime is classic.`)}const t=toMemberExpression(d);const s=toMemberExpression(m);set(r,"id/createElement",(()=>n.types.cloneNode(t)));set(r,"id/fragment",(()=>n.types.cloneNode(s)));set(r,"defaultPure",d===l.pragma)}else if(o==="automatic"){if(v||j){throw e.buildCodeFrameError(`pragma and pragmaFrag cannot be set when runtime is automatic.`)}const define=(t,s)=>set(r,t,createImportLazily(r,e,s,i));define("id/jsx",t?"jsxDEV":"jsx");define("id/jsxs",t?"jsxDEV":"jsxs");define("id/createElement","createElement");define("id/fragment","Fragment");set(r,"defaultPure",i===l.importSource)}else{throw e.buildCodeFrameError(`Runtime must be either "classic" or "automatic".`)}if(t){e.traverse(E,r)}}},JSXElement:{exit(e,t){let r;if(get(t,"runtime")==="classic"||shouldUseCreateElement(e)){r=buildCreateElementCall(e,t)}else{r=buildJSXElementCall(e,t)}e.replaceWith(n.types.inherits(r,e.node))}},JSXFragment:{exit(e,t){let r;if(get(t,"runtime")==="classic"){r=buildCreateElementFragmentCall(e,t)}else{r=buildJSXFragmentCall(e,t)}e.replaceWith(n.types.inherits(r,e.node))}},JSXAttribute(e){if(n.types.isJSXElement(e.node.value)){e.node.value=n.types.jsxExpressionContainer(e.node.value)}}}};function call(e,t,r){const s=n.types.callExpression(get(e,`id/${t}`)(),r);if(o!=null?o:get(e,"defaultPure"))(0,i.default)(s);return s}function shouldUseCreateElement(e){const t=e.get("openingElement");const r=t.node.attributes;let s=false;for(let e=0;e1){t=n.types.arrayExpression(e)}else{return undefined}return n.types.objectProperty(n.types.identifier("children"),t)}function buildJSXElementCall(e,r){const s=e.get("openingElement");const a=[getTag(s)];const o=[];const i=Object.create(null);for(const t of s.get("attributes")){if(t.isJSXAttribute()&&n.types.isJSXIdentifier(t.node.name)){const{name:r}=t.node.name;switch(r){case"__source":case"__self":if(i[r])throw sourceSelfError(e,r);case"key":{const e=convertAttributeValue(t.node.value);if(e===null){throw t.buildCodeFrameError('Please provide an explicit key value. Using "key" as a shorthand for "key={true}" is not allowed.')}i[r]=e;break}default:o.push(t)}}else{o.push(t)}}const l=n.types.react.buildChildren(e.node);let c;if(o.length||l.length){c=buildJSXOpeningElementAttributes(o,r,l)}else{c=n.types.objectExpression([])}a.push(c);if(t){var u,p,f;a.push((u=i.key)!=null?u:e.scope.buildUndefinedNode(),n.types.booleanLiteral(l.length>1),(p=i.__source)!=null?p:e.scope.buildUndefinedNode(),(f=i.__self)!=null?f:n.types.thisExpression())}else if(i.key!==undefined){a.push(i.key)}return call(r,l.length>1?"jsxs":"jsx",a)}function buildJSXOpeningElementAttributes(e,t,r){const s=e.reduce(accumulateAttribute,[]);if((r==null?void 0:r.length)>0){s.push(buildChildrenProperty(r))}return n.types.objectExpression(s)}function buildJSXFragmentCall(e,r){const s=[get(r,"id/fragment")()];const a=n.types.react.buildChildren(e.node);s.push(n.types.objectExpression(a.length>0?[buildChildrenProperty(a)]:[]));if(t){s.push(e.scope.buildUndefinedNode(),n.types.booleanLiteral(a.length>1))}return call(r,a.length>1?"jsxs":"jsx",s)}function buildCreateElementFragmentCall(e,t){if(m&&!m(e.node,t))return;return call(t,"createElement",[get(t,"id/fragment")(),n.types.nullLiteral(),...n.types.react.buildChildren(e.node)])}function buildCreateElementCall(e,t){const r=e.get("openingElement");return call(t,"createElement",[getTag(r),buildCreateElementOpeningElementAttributes(t,e,r.get("attributes")),...n.types.react.buildChildren(e.node)])}function getTag(e){const t=convertJSXIdentifier(e.node.name,e.node);let r;if(n.types.isIdentifier(t)){r=t.name}else if(n.types.isLiteral(t)){r=t.value}if(n.types.react.isCompatTag(r)){return n.types.stringLiteral(r)}else{return t}}function buildCreateElementOpeningElementAttributes(e,t,r){const s=get(e,"runtime");{if(s!=="automatic"){const t=[];const s=r.reduce(accumulateAttribute,[]);if(!x){let e=0;s.forEach(((r,a)=>{if(n.types.isSpreadElement(r)){if(a>e){t.push(n.types.objectExpression(s.slice(e,a)))}t.push(r.argument);e=a+1}}));if(s.length>e){t.push(n.types.objectExpression(s.slice(e)))}}else if(s.length){t.push(n.types.objectExpression(s))}if(!t.length){return n.types.nullLiteral()}if(t.length===1){return t[0]}if(!n.types.isObjectExpression(t[0])){t.unshift(n.types.objectExpression([]))}const a=v?n.types.memberExpression(n.types.identifier("Object"),n.types.identifier("assign")):e.addHelper("extends");return n.types.callExpression(a,t)}}const a=[];const o=Object.create(null);for(const e of r){const r=n.types.isJSXAttribute(e)&&n.types.isJSXIdentifier(e.name)&&e.name.name;if(s==="automatic"&&(r==="__source"||r==="__self")){if(o[r])throw sourceSelfError(t,r);o[r]=true}accumulateAttribute(a,e)}return a.length===1&&n.types.isSpreadElement(a[0])?a[0].argument:a.length>0?n.types.objectExpression(a):n.types.nullLiteral()}}));function getSource(e,r){switch(r){case"Fragment":return`${e}/${t?"jsx-dev-runtime":"jsx-runtime"}`;case"jsxDEV":return`${e}/jsx-dev-runtime`;case"jsx":case"jsxs":return`${e}/jsx-runtime`;case"createElement":return e}}function createImportLazily(e,t,r,s){return()=>{const a=getSource(s,r);if((0,o.isModule)(t)){let s=get(e,`imports/${r}`);if(s)return n.types.cloneNode(s);s=(0,o.addNamed)(t,r,a,{importedInterop:"uncompiled",importPosition:"after"});set(e,`imports/${r}`,s);return s}else{let s=get(e,`requires/${a}`);if(s){s=n.types.cloneNode(s)}else{s=(0,o.addNamespace)(t,a,{importedInterop:"uncompiled"});set(e,`requires/${a}`,s)}return n.types.memberExpression(s,n.types.identifier(r))}}}}function toMemberExpression(e){return e.split(".").map((e=>n.types.identifier(e))).reduce(((e,t)=>n.types.memberExpression(e,t)))}function makeSource(e,t){const r=e.node.loc;if(!r){return e.scope.buildUndefinedNode()}if(!t.fileNameIdentifier){const{filename:r=""}=t;const s=e.scope.generateUidIdentifier("_jsxFileName");const a=e.hub.getScope();if(a){a.push({id:s,init:n.types.stringLiteral(r)})}t.fileNameIdentifier=s}return makeTrace(n.types.cloneNode(t.fileNameIdentifier),r.start.line,r.start.column)}function makeTrace(e,t,r){const s=t!=null?n.types.numericLiteral(t):n.types.nullLiteral();const a=r!=null?n.types.numericLiteral(r+1):n.types.nullLiteral();const o=n.types.objectProperty(n.types.identifier("fileName"),e);const i=n.types.objectProperty(n.types.identifier("lineNumber"),s);const l=n.types.objectProperty(n.types.identifier("columnNumber"),a);return n.types.objectExpression([o,i,l])}function sourceSelfError(e,t){const r=`transform-react-jsx-${t.slice(2)}`;return e.buildCodeFrameError(`Duplicate ${t} prop found. You are most likely using the deprecated ${r} Babel plugin. Both __source and __self are automatically set when using the automatic runtime. Please remove transform-react-jsx-source and transform-react-jsx-self from your Babel config.`)}},309:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(594);var a=(0,s.default)({name:"transform-react-jsx/development",development:true});t["default"]=a},496:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(3100);var a=r(2155);var n=r(8304);const o=new Map([["react",["cloneElement","createContext","createElement","createFactory","createRef","forwardRef","isValidElement","memo","lazy"]],["react-dom",["createPortal"]]]);var i=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-react-pure-annotations",visitor:{CallExpression(e){if(isReactCall(e)){(0,a.default)(e)}}}}}));t["default"]=i;function isReactCall(e){if(!n.types.isMemberExpression(e.node.callee)){const t=e.get("callee");for(const[e,r]of o){for(const s of r){if(t.referencesImport(e,s)){return true}}}return false}for(const[t,r]of o){const s=e.get("callee.object");if(s.referencesImport(t,"default")||s.referencesImport(t,"*")){for(const t of r){if(n.types.isIdentifier(e.node.callee.property,{name:t})){return true}}return false}}return false}},3100:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8720:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8403);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-reserved-words",visitor:{"BindingIdentifier|ReferencedIdentifier"(e){if(!a.types.isValidES3Identifier(e.node.name)){e.scope.rename(e.node.name)}}}}}));t["default"]=n},8403:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8648:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9836);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-shorthand-properties",visitor:{ObjectMethod(e){const{node:t}=e;if(t.kind==="method"){const r=a.types.functionExpression(null,t.params,t.body,t.generator,t.async);r.returnType=t.returnType;const s=a.types.toComputedKey(t);if(a.types.isStringLiteral(s,{value:"__proto__"})){e.replaceWith(a.types.objectProperty(s,r,true))}else{e.replaceWith(a.types.objectProperty(t.key,r,t.computed))}}},ObjectProperty(e){const{node:t}=e;if(t.shorthand){const r=a.types.toComputedKey(t);if(a.types.isStringLiteral(r,{value:"__proto__"})){e.replaceWith(a.types.objectProperty(r,t.value,true))}else{t.shorthand=false}}}}}}));t["default"]=n},9836:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8476:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(2763);var a=r(5480);var n=r(8304);var o=(0,s.declare)(((e,t)=>{var r,s;e.assertVersion(7);const o=(r=e.assumption("iterableIsArray"))!=null?r:t.loose;const i=(s=t.allowArrayLike)!=null?s:e.assumption("arrayLikeIsIterable");function getSpreadLiteral(e,t){if(o&&!n.types.isIdentifier(e.argument,{name:"arguments"})){return e.argument}else{return t.toArray(e.argument,true,i)}}function hasHole(e){return e.elements.some((e=>e===null))}function hasSpread(e){for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1245:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(7521);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-sticky-regex",visitor:{RegExpLiteral(e){const{node:t}=e;if(!t.flags.includes("y"))return;e.replaceWith(a.types.newExpression(a.types.identifier("RegExp"),[a.types.stringLiteral(t.pattern),a.types.stringLiteral(t.flags)]))}}}}));t["default"]=n},7521:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5356:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9116);var a=r(8304);var n=(0,s.declare)(((e,t)=>{var r,s;e.assertVersion(7);const n=(r=e.assumption("ignoreToPrimitiveHint"))!=null?r:t.loose;const o=(s=e.assumption("mutableTemplateObject"))!=null?s:t.loose;let i="taggedTemplateLiteral";if(o)i+="Loose";function buildConcatCallExpressions(e){let t=true;return e.reduce((function(e,r){let s=a.types.isLiteral(r);if(!s&&t){s=true;t=false}if(s&&a.types.isCallExpression(e)){e.arguments.push(r);return e}return a.types.callExpression(a.types.memberExpression(e,a.types.identifier("concat")),[r])}))}return{name:"transform-template-literals",visitor:{TaggedTemplateExpression(e){const{node:t}=e;const{quasi:r}=t;const s=[];const n=[];let o=true;for(const t of r.quasis){const{raw:r,cooked:i}=t.value;const l=i==null?e.scope.buildUndefinedNode():a.types.stringLiteral(i);s.push(l);n.push(a.types.stringLiteral(r));if(r!==i){o=false}}const l=[a.types.arrayExpression(s)];if(!o){l.push(a.types.arrayExpression(n))}const c=e.scope.generateUidIdentifier("templateObject");e.scope.getProgramParent().push({id:a.types.cloneNode(c)});e.replaceWith(a.types.callExpression(t.tag,[a.template.expression.ast` ${a.types.cloneNode(c)} || ( ${c} = ${this.addHelper(i)}(${l}) ) - `,...r.expressions]))},TemplateLiteral(e){const t=[];const r=e.get("expressions");let s=0;for(const n of e.node.quasis){if(n.value.cooked){t.push(a.types.stringLiteral(n.value.cooked))}if(s1){o=buildConcatCallExpressions(t)}e.replaceWith(o)}}}}));t["default"]=n},9116:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5502:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9001);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-typeof-symbol",visitor:{Scope({scope:e}){if(!e.getBinding("Symbol")){return}e.rename("Symbol")},UnaryExpression(e){const{node:t,parent:r}=e;if(t.operator!=="typeof")return;if(e.parentPath.isBinaryExpression()&&a.types.EQUALITY_BINARY_OPERATORS.indexOf(r.operator)>=0){const t=e.getOpposite();if(t.isLiteral()&&t.node.value!=="symbol"&&t.node.value!=="object"){return}}let s=e.findParent((e=>{if(e.isFunction()){var t;return((t=e.get("body.directives.0"))==null?void 0:t.node.value.value)==="@babel/helpers - typeof"}}));if(s)return;const n=this.addHelper("typeof");s=e.findParent((e=>e.isVariableDeclarator()&&e.node.id===n||e.isFunctionDeclaration()&&e.node.id&&e.node.id.name===n.name));if(s){return}const o=a.types.callExpression(n,[t.argument]);const i=e.get("argument");if(i.isIdentifier()&&!e.scope.hasBinding(i.node.name,true)){const r=a.types.unaryExpression("typeof",a.types.cloneNode(t.argument));e.replaceWith(a.types.conditionalExpression(a.types.binaryExpression("===",r,a.types.stringLiteral("undefined")),a.types.stringLiteral("undefined"),o))}else{e.replaceWith(o)}}}}}));t["default"]=n},9001:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},3448:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(728);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);const t=/[\ud800-\udfff]/g;const r=/(\\+)u\{([0-9a-fA-F]+)\}/g;function escape(e){let t=e.toString(16);while(t.length<4)t="0"+t;return"\\u"+t}function replacer(e,t,r){if(t.length%2===0){return e}const s=String.fromCodePoint(parseInt(r,16));const a=t.slice(0,-1)+escape(s.charCodeAt(0));return s.length===1?a:a+escape(s.charCodeAt(1))}function replaceUnicodeEscapes(e){return e.replace(r,replacer)}function getUnicodeEscape(e){let t;while(t=r.exec(e)){if(t[1].length%2===0)continue;r.lastIndex=0;return t[0]}return null}return{name:"transform-unicode-escapes",manipulateOptions({generatorOpts:e}){var t,r;if(!e.jsescOption){e.jsescOption={}}(r=(t=e.jsescOption).minimal)!=null?r:t.minimal=false},visitor:{Identifier(e){const{node:r,key:s}=e;const{name:n}=r;const o=n.replace(t,(e=>`_u${e.charCodeAt(0).toString(16)}`));if(n===o)return;const i=a.types.inherits(a.types.stringLiteral(n),r);if(s==="key"){e.replaceWith(i);return}const{parentPath:l,scope:c}=e;if(l.isMemberExpression({property:r})||l.isOptionalMemberExpression({property:r})){l.node.computed=true;e.replaceWith(i);return}const u=c.getBinding(n);if(u){c.rename(n,c.generateUid(o));return}throw e.buildCodeFrameError(`Can't reference '${n}' as a bare identifier`)},"StringLiteral|DirectiveLiteral"(e){const{node:t}=e;const{extra:r}=t;if(r!=null&&r.raw)r.raw=replaceUnicodeEscapes(r.raw)},TemplateElement(e){const{node:t,parentPath:r}=e;const{value:s}=t;const a=getUnicodeEscape(s.raw);if(!a)return;const n=r.parentPath;if(n.isTaggedTemplateExpression()){throw e.buildCodeFrameError(`Can't replace Unicode escape '${a}' inside tagged template literals. You can enable '@babel/plugin-transform-template-literals' to compile them to classic strings.`)}s.raw=replaceUnicodeEscapes(s.raw)}}}}));t["default"]=n},728:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},4122:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6550);var a=r(836);var n=(0,a.declare)((e=>{e.assertVersion(7);return(0,s.createRegExpFeaturePlugin)({name:"transform-unicode-regex",feature:"unicodeFlag"})}));t["default"]=n},836:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9453:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;const r={allowInsertArrow:false,specCompliant:false};var _default=({types:e})=>({name:"transform-async-arrows-in-class",visitor:{ArrowFunctionExpression(t){if(t.node.async&&t.findParent(e.isClassMethod)){t.arrowFunctionToExpression(r)}}}});t["default"]=_default;e.exports=t.default},489:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;var _default=({types:e})=>{const isArrowParent=t=>t.parentKey==="params"&&t.parentPath&&e.isArrowFunctionExpression(t.parentPath);return{name:"transform-edge-default-parameters",visitor:{AssignmentPattern(e){const t=e.find(isArrowParent);if(t&&e.parent.shorthand){e.parent.shorthand=false;(e.parent.extra||{}).shorthand=false;e.scope.rename(e.parent.key.name)}}}}};t["default"]=_default;e.exports=t.default},3258:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;var _default=({types:e})=>({name:"transform-edge-function-name",visitor:{FunctionExpression:{exit(t){if(!t.node.id&&e.isIdentifier(t.parent.id)){const r=e.cloneNode(t.parent.id);const s=t.scope.getBinding(r.name);if(s==null?void 0:s.constantViolations.length){t.scope.rename(r.name)}t.node.id=r}}}}});t["default"]=_default;e.exports=t.default},5899:(e,t)=>{"use strict";t.__esModule=true;t["default"]=_default;function _default({types:e}){return{name:"transform-safari-block-shadowing",visitor:{VariableDeclarator(t){const r=t.parent.kind;if(r!=="let"&&r!=="const")return;const s=t.scope.block;if(e.isFunction(s)||e.isProgram(s))return;const a=e.getOuterBindingIdentifiers(t.node.id);for(const r of Object.keys(a)){let s=t.scope;if(!s.hasOwnBinding(r))continue;while(s=s.parent){if(s.hasOwnBinding(r)){t.scope.rename(r);break}if(e.isFunction(s.block)||e.isProgram(s.block)){break}}}}}}}e.exports=t.default},6668:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;function handle(e){if(!e.isVariableDeclaration())return;const t=e.getFunctionParent();const{name:r}=e.node.declarations[0].id;if(t&&t.scope.hasOwnBinding(r)&&t.scope.getOwnBinding(r).kind==="param"){e.scope.rename(r)}}var _default=()=>({name:"transform-safari-for-shadowing",visitor:{ForXStatement(e){handle(e.get("left"))},ForStatement(e){handle(e.get("init"))}}});t["default"]=_default;e.exports=t.default},3744:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;var _default=({types:e})=>({name:"transform-tagged-template-caching",visitor:{TaggedTemplateExpression(t,r){let s=r.get("processed");if(!s){s=new Map;r.set("processed",s)}if(s.has(t.node))return t.skip();const a=t.node.quasi.expressions;let n=r.get("identity");if(!n){n=t.scope.getProgramParent().generateDeclaredUidIdentifier("_");r.set("identity",n);const s=t.scope.getBinding(n.name);s.path.get("init").replaceWith(e.arrowFunctionExpression([e.identifier("t")],e.identifier("t")))}const o=e.taggedTemplateExpression(n,e.templateLiteral(t.node.quasi.quasis,a.map((()=>e.numericLiteral(0)))));s.set(o,true);const i=t.scope.getProgramParent().generateDeclaredUidIdentifier("t");t.scope.getBinding(i.name).path.parent.kind="let";const l=e.logicalExpression("||",i,e.assignmentExpression("=",i,o));const c=e.callExpression(t.node.tag,[l,...a]);t.replaceWith(c)}}});t["default"]=_default;e.exports=t.default},8277:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(7534);var a=r(7420);var n=r(9833);var o=r(2625);var i=r(496);var l=r(7347);function _interopDefaultLegacy(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var c=_interopDefaultLegacy(a);var u=_interopDefaultLegacy(n);var p=_interopDefaultLegacy(o);var d=_interopDefaultLegacy(i);new l.OptionValidator("@babel/preset-react");function normalizeOptions(e={}){{let{pragma:t,pragmaFrag:r}=e;const{pure:s,throwIfNamespace:a=true,runtime:n="classic",importSource:o,useBuiltIns:i,useSpread:l}=e;if(n==="classic"){t=t||"React.createElement";r=r||"React.Fragment"}const c=!!e.development;return{development:c,importSource:o,pragma:t,pragmaFrag:r,pure:s,runtime:n,throwIfNamespace:a,useBuiltIns:i,useSpread:l}}}var f=s.declare(((e,t)=>{e.assertVersion(7);const{development:r,importSource:s,pragma:a,pragmaFrag:n,pure:o,runtime:i,throwIfNamespace:l}=normalizeOptions(t);return{plugins:[[r?u["default"]:c["default"],{importSource:s,pragma:a,pragmaFrag:n,runtime:i,throwIfNamespace:l,pure:o,useBuiltIns:!!t.useBuiltIns,useSpread:t.useSpread}],p["default"],o!==false&&d["default"]].filter(Boolean)}}));t["default"]=f},7534:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7005:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=createPlugin;var s=r(8926);var a=r(7534);var n=r(8304);var o=r(6039);var i=r(2155);const l={importSource:"react",runtime:"automatic",pragma:"React.createElement",pragmaFrag:"React.Fragment"};const c=/\*?\s*@jsxImportSource\s+([^\s]+)/;const u=/\*?\s*@jsxRuntime\s+([^\s]+)/;const p=/\*?\s*@jsx\s+([^\s]+)/;const d=/\*?\s*@jsxFrag\s+([^\s]+)/;const get=(e,t)=>e.get(`@babel/plugin-react-jsx/${t}`);const set=(e,t,r)=>e.set(`@babel/plugin-react-jsx/${t}`,r);function createPlugin({name:e,development:t}){return(0,a.declare)(((r,a)=>{const{pure:o,throwIfNamespace:f=true,filter:m,runtime:y=(t?"automatic":"classic"),importSource:g=l.importSource,pragma:h=l.pragma,pragmaFrag:b=l.pragmaFrag}=a;{var{useSpread:x=false,useBuiltIns:v=false}=a;if(y==="classic"){if(typeof x!=="boolean"){throw new Error("transform-react-jsx currently only accepts a boolean option for "+"useSpread (defaults to false)")}if(typeof v!=="boolean"){throw new Error("transform-react-jsx currently only accepts a boolean option for "+"useBuiltIns (defaults to false)")}if(x&&v){throw new Error("transform-react-jsx currently only accepts useBuiltIns or useSpread "+"but not both")}}}const E={JSXOpeningElement(e,t){for(const t of e.get("attributes")){if(!t.isJSXElement())continue;const{name:r}=t.node.name;if(r==="__source"||r==="__self"){throw e.buildCodeFrameError(`__source and __self should not be defined in props and are reserved for internal usage.`)}}const r=n.types.jsxAttribute(n.types.jsxIdentifier("__self"),n.types.jsxExpressionContainer(n.types.thisExpression()));const s=n.types.jsxAttribute(n.types.jsxIdentifier("__source"),n.types.jsxExpressionContainer(makeSource(e,t)));e.pushContainer("attributes",[r,s])}};return{name:e,inherits:s.default,visitor:{JSXNamespacedName(e){if(f){throw e.buildCodeFrameError(`Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can set \`throwIfNamespace: false\` to bypass this warning.`)}},JSXSpreadChild(e){throw e.buildCodeFrameError("Spread children are not supported in React.")},Program:{enter(e,r){const{file:s}=r;let o=y;let i=g;let f=h;let m=b;let x=!!a.importSource;let v=!!a.pragma;let j=!!a.pragmaFrag;if(s.ast.comments){for(const e of s.ast.comments){const t=c.exec(e.value);if(t){i=t[1];x=true}const r=u.exec(e.value);if(r){o=r[1]}const s=p.exec(e.value);if(s){f=s[1];v=true}const a=d.exec(e.value);if(a){m=a[1];j=true}}}set(r,"runtime",o);if(o==="classic"){if(x){throw e.buildCodeFrameError(`importSource cannot be set when runtime is classic.`)}const t=toMemberExpression(f);const s=toMemberExpression(m);set(r,"id/createElement",(()=>n.types.cloneNode(t)));set(r,"id/fragment",(()=>n.types.cloneNode(s)));set(r,"defaultPure",f===l.pragma)}else if(o==="automatic"){if(v||j){throw e.buildCodeFrameError(`pragma and pragmaFrag cannot be set when runtime is automatic.`)}const define=(t,s)=>set(r,t,createImportLazily(r,e,s,i));define("id/jsx",t?"jsxDEV":"jsx");define("id/jsxs",t?"jsxDEV":"jsxs");define("id/createElement","createElement");define("id/fragment","Fragment");set(r,"defaultPure",i===l.importSource)}else{throw e.buildCodeFrameError(`Runtime must be either "classic" or "automatic".`)}if(t){e.traverse(E,r)}}},JSXElement:{exit(e,t){let r;if(get(t,"runtime")==="classic"||shouldUseCreateElement(e)){r=buildCreateElementCall(e,t)}else{r=buildJSXElementCall(e,t)}e.replaceWith(n.types.inherits(r,e.node))}},JSXFragment:{exit(e,t){let r;if(get(t,"runtime")==="classic"){r=buildCreateElementFragmentCall(e,t)}else{r=buildJSXFragmentCall(e,t)}e.replaceWith(n.types.inherits(r,e.node))}},JSXAttribute(e){if(n.types.isJSXElement(e.node.value)){e.node.value=n.types.jsxExpressionContainer(e.node.value)}}}};function call(e,t,r){const s=n.types.callExpression(get(e,`id/${t}`)(),r);if(o!=null?o:get(e,"defaultPure"))(0,i.default)(s);return s}function shouldUseCreateElement(e){const t=e.get("openingElement");const r=t.node.attributes;let s=false;for(let e=0;e1){t=n.types.arrayExpression(e)}else{return undefined}return n.types.objectProperty(n.types.identifier("children"),t)}function buildJSXElementCall(e,r){const s=e.get("openingElement");const a=[getTag(s)];const o=[];const i=Object.create(null);for(const t of s.get("attributes")){if(t.isJSXAttribute()&&n.types.isJSXIdentifier(t.node.name)){const{name:r}=t.node.name;switch(r){case"__source":case"__self":if(i[r])throw sourceSelfError(e,r);case"key":{const e=convertAttributeValue(t.node.value);if(e===null){throw t.buildCodeFrameError('Please provide an explicit key value. Using "key" as a shorthand for "key={true}" is not allowed.')}i[r]=e;break}default:o.push(t)}}else{o.push(t)}}const l=n.types.react.buildChildren(e.node);let c;if(o.length||l.length){c=buildJSXOpeningElementAttributes(o,r,l)}else{c=n.types.objectExpression([])}a.push(c);if(t){var u,p,d;a.push((u=i.key)!=null?u:e.scope.buildUndefinedNode(),n.types.booleanLiteral(l.length>1),(p=i.__source)!=null?p:e.scope.buildUndefinedNode(),(d=i.__self)!=null?d:n.types.thisExpression())}else if(i.key!==undefined){a.push(i.key)}return call(r,l.length>1?"jsxs":"jsx",a)}function buildJSXOpeningElementAttributes(e,t,r){const s=e.reduce(accumulateAttribute,[]);if((r==null?void 0:r.length)>0){s.push(buildChildrenProperty(r))}return n.types.objectExpression(s)}function buildJSXFragmentCall(e,r){const s=[get(r,"id/fragment")()];const a=n.types.react.buildChildren(e.node);s.push(n.types.objectExpression(a.length>0?[buildChildrenProperty(a)]:[]));if(t){s.push(e.scope.buildUndefinedNode(),n.types.booleanLiteral(a.length>1))}return call(r,a.length>1?"jsxs":"jsx",s)}function buildCreateElementFragmentCall(e,t){if(m&&!m(e.node,t))return;return call(t,"createElement",[get(t,"id/fragment")(),n.types.nullLiteral(),...n.types.react.buildChildren(e.node)])}function buildCreateElementCall(e,t){const r=e.get("openingElement");return call(t,"createElement",[getTag(r),buildCreateElementOpeningElementAttributes(t,e,r.get("attributes")),...n.types.react.buildChildren(e.node)])}function getTag(e){const t=convertJSXIdentifier(e.node.name,e.node);let r;if(n.types.isIdentifier(t)){r=t.name}else if(n.types.isLiteral(t)){r=t.value}if(n.types.react.isCompatTag(r)){return n.types.stringLiteral(r)}else{return t}}function buildCreateElementOpeningElementAttributes(e,t,r){const s=get(e,"runtime");{if(s!=="automatic"){const t=[];const s=r.reduce(accumulateAttribute,[]);if(!x){let e=0;s.forEach(((r,a)=>{if(n.types.isSpreadElement(r)){if(a>e){t.push(n.types.objectExpression(s.slice(e,a)))}t.push(r.argument);e=a+1}}));if(s.length>e){t.push(n.types.objectExpression(s.slice(e)))}}else if(s.length){t.push(n.types.objectExpression(s))}if(!t.length){return n.types.nullLiteral()}if(t.length===1){return t[0]}if(!n.types.isObjectExpression(t[0])){t.unshift(n.types.objectExpression([]))}const a=v?n.types.memberExpression(n.types.identifier("Object"),n.types.identifier("assign")):e.addHelper("extends");return n.types.callExpression(a,t)}}const a=[];const o=Object.create(null);for(const e of r){const r=n.types.isJSXAttribute(e)&&n.types.isJSXIdentifier(e.name)&&e.name.name;if(s==="automatic"&&(r==="__source"||r==="__self")){if(o[r])throw sourceSelfError(t,r);o[r]=true}accumulateAttribute(a,e)}return a.length===1&&n.types.isSpreadElement(a[0])?a[0].argument:a.length>0?n.types.objectExpression(a):n.types.nullLiteral()}}));function getSource(e,r){switch(r){case"Fragment":return`${e}/${t?"jsx-dev-runtime":"jsx-runtime"}`;case"jsxDEV":return`${e}/jsx-dev-runtime`;case"jsx":case"jsxs":return`${e}/jsx-runtime`;case"createElement":return e}}function createImportLazily(e,t,r,s){return()=>{const a=getSource(s,r);if((0,o.isModule)(t)){let s=get(e,`imports/${r}`);if(s)return n.types.cloneNode(s);s=(0,o.addNamed)(t,r,a,{importedInterop:"uncompiled",importPosition:"after"});set(e,`imports/${r}`,s);return s}else{let s=get(e,`requires/${a}`);if(s){s=n.types.cloneNode(s)}else{s=(0,o.addNamespace)(t,a,{importedInterop:"uncompiled"});set(e,`requires/${a}`,s)}return n.types.memberExpression(s,n.types.identifier(r))}}}}function toMemberExpression(e){return e.split(".").map((e=>n.types.identifier(e))).reduce(((e,t)=>n.types.memberExpression(e,t)))}function makeSource(e,t){const r=e.node.loc;if(!r){return e.scope.buildUndefinedNode()}if(!t.fileNameIdentifier){const{filename:r=""}=t;const s=e.scope.generateUidIdentifier("_jsxFileName");const a=e.hub.getScope();if(a){a.push({id:s,init:n.types.stringLiteral(r)})}t.fileNameIdentifier=s}return makeTrace(n.types.cloneNode(t.fileNameIdentifier),r.start.line,r.start.column)}function makeTrace(e,t,r){const s=t!=null?n.types.numericLiteral(t):n.types.nullLiteral();const a=r!=null?n.types.numericLiteral(r+1):n.types.nullLiteral();const o=n.types.objectProperty(n.types.identifier("fileName"),e);const i=n.types.objectProperty(n.types.identifier("lineNumber"),s);const l=n.types.objectProperty(n.types.identifier("columnNumber"),a);return n.types.objectExpression([o,i,l])}function sourceSelfError(e,t){const r=`transform-react-jsx-${t.slice(2)}`;return e.buildCodeFrameError(`Duplicate ${t} prop found. You are most likely using the deprecated ${r} Babel plugin. Both __source and __self are automatically set when using the automatic runtime. Please remove transform-react-jsx-source and transform-react-jsx-self from your Babel config.`)}},7420:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(7005);var a=(0,s.default)({name:"transform-react-jsx",development:false});t["default"]=a},6919:e=>{function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}e.exports=_interopRequireDefault},449:(e,t,r)=>{var s=r(2810);function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function _getRequireWildcardCache(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||s(e)!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e){if(Object.prototype.hasOwnProperty.call(e,n)){var o=a?Object.getOwnPropertyDescriptor(e,n):null;if(o&&(o.get||o.set)){Object.defineProperty(r,n,o)}else{r[n]=e[n]}}}r["default"]=e;if(t){t.set(e,r)}return r}e.exports=_interopRequireWildcard},2810:e=>{function _typeof(t){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){e.exports=_typeof=function _typeof(e){return typeof e}}else{e.exports=_typeof=function _typeof(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}}return _typeof(t)}e.exports=_typeof},4309:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=createTemplateBuilder;var s=r(4578);var a=r(351);var n=r(5932);const o=(0,s.validate)({placeholderPattern:false});function createTemplateBuilder(e,t){const r=new WeakMap;const i=new WeakMap;const l=t||(0,s.validate)(null);return Object.assign(((t,...o)=>{if(typeof t==="string"){if(o.length>1)throw new Error("Unexpected extra params.");return extendedTrace((0,a.default)(e,t,(0,s.merge)(l,(0,s.validate)(o[0]))))}else if(Array.isArray(t)){let s=r.get(t);if(!s){s=(0,n.default)(e,t,l);r.set(t,s)}return extendedTrace(s(o))}else if(typeof t==="object"&&t){if(o.length>0)throw new Error("Unexpected extra params.");return createTemplateBuilder(e,(0,s.merge)(l,(0,s.validate)(t)))}throw new Error(`Unexpected template param ${typeof t}`)}),{ast:(t,...r)=>{if(typeof t==="string"){if(r.length>1)throw new Error("Unexpected extra params.");return(0,a.default)(e,t,(0,s.merge)((0,s.merge)(l,(0,s.validate)(r[0])),o))()}else if(Array.isArray(t)){let a=i.get(t);if(!a){a=(0,n.default)(e,t,(0,s.merge)(l,o));i.set(t,a)}return a(r)()}throw new Error(`Unexpected template param ${typeof t}`)}})}function extendedTrace(e){let t="";try{throw new Error}catch(e){if(e.stack){t=e.stack.split("\n").slice(3).join("\n")}}return r=>{try{return e(r)}catch(e){e.stack+=`\n =============\n${t}`;throw e}}}},7522:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.program=t.expression=t.statement=t.statements=t.smart=void 0;var s=r(8622);function makeStatementFormatter(e){return{code:e=>`/* @babel/template */;\n${e}`,validate:()=>{},unwrap:t=>e(t.program.body.slice(1))}}const a=makeStatementFormatter((e=>{if(e.length>1){return e}else{return e[0]}}));t.smart=a;const n=makeStatementFormatter((e=>e));t.statements=n;const o=makeStatementFormatter((e=>{if(e.length===0){throw new Error("Found nothing to return.")}if(e.length>1){throw new Error("Found multiple statements but wanted one")}return e[0]}));t.statement=o;const i={code:e=>`(\n${e}\n)`,validate:e=>{if(e.program.body.length>1){throw new Error("Found multiple statements but wanted one")}if(i.unwrap(e).start===0){throw new Error("Parse result included parens.")}},unwrap:({program:e})=>{const[t]=e.body;s.assertExpressionStatement(t);return t.expression}};t.expression=i;const l={code:e=>e,validate:()=>{},unwrap:e=>e.program};t.program=l},153:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=t.program=t.expression=t.statements=t.statement=t.smart=void 0;var s=r(7522);var a=r(4309);const n=(0,a.default)(s.smart);t.smart=n;const o=(0,a.default)(s.statement);t.statement=o;const i=(0,a.default)(s.statements);t.statements=i;const l=(0,a.default)(s.expression);t.expression=l;const c=(0,a.default)(s.program);t.program=c;var u=Object.assign(n.bind(undefined),{smart:n,statement:o,statements:i,expression:l,program:c,ast:n.ast});t["default"]=u},5932:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=literalTemplate;var s=r(4578);var a=r(8502);var n=r(7635);function literalTemplate(e,t,r){const{metadata:a,names:o}=buildLiteralData(e,t,r);return t=>{const r={};t.forEach(((e,t)=>{r[o[t]]=e}));return t=>{const o=(0,s.normalizeReplacements)(t);if(o){Object.keys(o).forEach((e=>{if(Object.prototype.hasOwnProperty.call(r,e)){throw new Error("Unexpected replacement overlap.")}}))}return e.unwrap((0,n.default)(a,o?Object.assign(o,r):r))}}}function buildLiteralData(e,t,r){let s;let n;let o;let i="";do{i+="$";const l=buildTemplateCode(t,i);s=l.names;n=new Set(s);o=(0,a.default)(e,e.code(l.code),{parser:r.parser,placeholderWhitelist:new Set(l.names.concat(r.placeholderWhitelist?Array.from(r.placeholderWhitelist):[])),placeholderPattern:r.placeholderPattern,preserveComments:r.preserveComments,syntacticPlaceholders:r.syntacticPlaceholders})}while(o.placeholders.some((e=>e.isDuplicate&&n.has(e.name))));return{metadata:o,names:s}}function buildTemplateCode(e,t){const r=[];let s=e[0];for(let a=1;a{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.merge=merge;t.validate=validate;t.normalizeReplacements=normalizeReplacements;function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var r={};var s=Object.keys(e);var a,n;for(n=0;n=0)continue;r[a]=e[a]}return r}function merge(e,t){const{placeholderWhitelist:r=e.placeholderWhitelist,placeholderPattern:s=e.placeholderPattern,preserveComments:a=e.preserveComments,syntacticPlaceholders:n=e.syntacticPlaceholders}=t;return{parser:Object.assign({},e.parser,t.parser),placeholderWhitelist:r,placeholderPattern:s,preserveComments:a,syntacticPlaceholders:n}}function validate(e){if(e!=null&&typeof e!=="object"){throw new Error("Unknown template options.")}const t=e||{},{placeholderWhitelist:r,placeholderPattern:s,preserveComments:a,syntacticPlaceholders:n}=t,o=_objectWithoutPropertiesLoose(t,["placeholderWhitelist","placeholderPattern","preserveComments","syntacticPlaceholders"]);if(r!=null&&!(r instanceof Set)){throw new Error("'.placeholderWhitelist' must be a Set, null, or undefined")}if(s!=null&&!(s instanceof RegExp)&&s!==false){throw new Error("'.placeholderPattern' must be a RegExp, false, null, or undefined")}if(a!=null&&typeof a!=="boolean"){throw new Error("'.preserveComments' must be a boolean, null, or undefined")}if(n!=null&&typeof n!=="boolean"){throw new Error("'.syntacticPlaceholders' must be a boolean, null, or undefined")}if(n===true&&(r!=null||s!=null)){throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible"+" with '.syntacticPlaceholders: true'")}return{parser:o,placeholderWhitelist:r||undefined,placeholderPattern:s==null?undefined:s,preserveComments:a==null?undefined:a,syntacticPlaceholders:n==null?undefined:n}}function normalizeReplacements(e){if(Array.isArray(e)){return e.reduce(((e,t,r)=>{e["$"+r]=t;return e}),{})}else if(typeof e==="object"||e==null){return e||undefined}throw new Error("Template replacements must be an array, object, null, or undefined")}},8502:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=parseAndBuildMetadata;var s=r(8622);var a=r(6949);var n=r(5694);const o=/^[_$A-Z0-9]+$/;function parseAndBuildMetadata(e,t,r){const{placeholderWhitelist:a,placeholderPattern:n,preserveComments:o,syntacticPlaceholders:i}=r;const l=parseWithCodeFrame(t,r.parser,i);s.removePropertiesDeep(l,{preserveComments:o});e.validate(l);const c={placeholders:[],placeholderNames:new Set};const u={placeholders:[],placeholderNames:new Set};const p={value:undefined};s.traverse(l,placeholderVisitorHandler,{syntactic:c,legacy:u,isLegacyRef:p,placeholderWhitelist:a,placeholderPattern:n,syntacticPlaceholders:i});return Object.assign({ast:l},p.value?u:c)}function placeholderVisitorHandler(e,t,r){var a;let n;if(s.isPlaceholder(e)){if(r.syntacticPlaceholders===false){throw new Error("%%foo%%-style placeholders can't be used when "+"'.syntacticPlaceholders' is false.")}else{n=e.name.name;r.isLegacyRef.value=false}}else if(r.isLegacyRef.value===false||r.syntacticPlaceholders){return}else if(s.isIdentifier(e)||s.isJSXIdentifier(e)){n=e.name;r.isLegacyRef.value=true}else if(s.isStringLiteral(e)){n=e.value;r.isLegacyRef.value=true}else{return}if(!r.isLegacyRef.value&&(r.placeholderPattern!=null||r.placeholderWhitelist!=null)){throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible"+" with '.syntacticPlaceholders: true'")}if(r.isLegacyRef.value&&(r.placeholderPattern===false||!(r.placeholderPattern||o).test(n))&&!((a=r.placeholderWhitelist)!=null&&a.has(n))){return}t=t.slice();const{node:i,key:l}=t[t.length-1];let c;if(s.isStringLiteral(e)||s.isPlaceholder(e,{expectedNode:"StringLiteral"})){c="string"}else if(s.isNewExpression(i)&&l==="arguments"||s.isCallExpression(i)&&l==="arguments"||s.isFunction(i)&&l==="params"){c="param"}else if(s.isExpressionStatement(i)&&!s.isPlaceholder(e)){c="statement";t=t.slice(0,-1)}else if(s.isStatement(e)&&s.isPlaceholder(e)){c="statement"}else{c="other"}const{placeholders:u,placeholderNames:p}=r.isLegacyRef.value?r.legacy:r.syntactic;u.push({name:n,type:c,resolve:e=>resolveAncestors(e,t),isDuplicate:p.has(n)});p.add(n)}function resolveAncestors(e,t){let r=e;for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=populatePlaceholders;var s=r(8622);function populatePlaceholders(e,t){const r=s.cloneNode(e.ast);if(t){e.placeholders.forEach((e=>{if(!Object.prototype.hasOwnProperty.call(t,e.name)){const t=e.name;throw new Error(`Error: No substitution given for "${t}". If this is not meant to be a\n placeholder you may want to consider passing one of the following options to @babel/template:\n - { placeholderPattern: false, placeholderWhitelist: new Set(['${t}'])}\n - { placeholderPattern: /^${t}$/ }`)}}));Object.keys(t).forEach((t=>{if(!e.placeholderNames.has(t)){throw new Error(`Unknown substitution "${t}" given`)}}))}e.placeholders.slice().reverse().forEach((e=>{try{applyReplacement(e,r,t&&t[e.name]||null)}catch(t){t.message=`@babel/template placeholder "${e.name}": ${t.message}`;throw t}}));return r}function applyReplacement(e,t,r){if(e.isDuplicate){if(Array.isArray(r)){r=r.map((e=>s.cloneNode(e)))}else if(typeof r==="object"){r=s.cloneNode(r)}}const{parent:a,key:n,index:o}=e.resolve(t);if(e.type==="string"){if(typeof r==="string"){r=s.stringLiteral(r)}if(!r||!s.isStringLiteral(r)){throw new Error("Expected string substitution")}}else if(e.type==="statement"){if(o===undefined){if(!r){r=s.emptyStatement()}else if(Array.isArray(r)){r=s.blockStatement(r)}else if(typeof r==="string"){r=s.expressionStatement(s.identifier(r))}else if(!s.isStatement(r)){r=s.expressionStatement(r)}}else{if(r&&!Array.isArray(r)){if(typeof r==="string"){r=s.identifier(r)}if(!s.isStatement(r)){r=s.expressionStatement(r)}}}}else if(e.type==="param"){if(typeof r==="string"){r=s.identifier(r)}if(o===undefined)throw new Error("Assertion failure.")}else{if(typeof r==="string"){r=s.identifier(r)}if(Array.isArray(r)){throw new Error("Cannot replace single expression with an array.")}}if(o===undefined){s.validate(a,n,r);a[n]=r}else{const t=a[n].slice();if(e.type==="statement"||e.type==="param"){if(r==null){t.splice(o,1)}else if(Array.isArray(r)){t.splice(o,1,...r)}else{t[o]=r}}else{t[o]=r}s.validate(a,n,t);a[n]=t}}},351:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=stringTemplate;var s=r(4578);var a=r(8502);var n=r(7635);function stringTemplate(e,t,r){t=e.code(t);let o;return i=>{const l=(0,s.normalizeReplacements)(i);if(!o)o=(0,a.default)(e,t,r);return e.unwrap((0,n.default)(o,l))}}},5694:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.codeFrameColumns=codeFrameColumns;t["default"]=_default;var s=r(2032);let a=false;function getDefs(e){return{gutter:e.grey,marker:e.red.bold,message:e.red.bold}}const n=/\r\n|[\n\r\u2028\u2029]/;function getMarkerLines(e,t,r){const s=Object.assign({column:0,line:-1},e.start);const a=Object.assign({},s,e.end);const{linesAbove:n=2,linesBelow:o=3}=r||{};const i=s.line;const l=s.column;const c=a.line;const u=a.column;let p=Math.max(i-(n+1),0);let d=Math.min(t.length,c+o);if(i===-1){p=0}if(c===-1){d=t.length}const f=c-i;const m={};if(f){for(let e=0;e<=f;e++){const r=e+i;if(!l){m[r]=true}else if(e===0){const e=t[r-1].length;m[r]=[l,e-l+1]}else if(e===f){m[r]=[0,u]}else{const s=t[r-e].length;m[r]=[0,s]}}}else{if(l===u){if(l){m[i]=[l,0]}else{m[i]=true}}else{m[i]=[l,u-l]}}return{start:p,end:d,markerLines:m}}function codeFrameColumns(e,t,r={}){const a=(r.highlightCode||r.forceColor)&&(0,s.shouldHighlight)(r);const o=(0,s.getChalk)(r);const i=getDefs(o);const maybeHighlight=(e,t)=>a?e(t):t;const l=e.split(n);const{start:c,end:u,markerLines:p}=getMarkerLines(t,l,r);const d=t.start&&typeof t.start.column==="number";const f=String(u).length;const m=a?(0,s.default)(e,r):e;let y=m.split(n).slice(c,u).map(((e,t)=>{const s=c+1+t;const a=` ${s}`.slice(-f);const n=` ${a} |`;const o=p[s];const l=!p[s+1];if(o){let t="";if(Array.isArray(o)){const s=e.slice(0,Math.max(o[0]-1,0)).replace(/[^\t]/g," ");const a=o[1]||1;t=["\n ",maybeHighlight(i.gutter,n.replace(/\d/g," "))," ",s,maybeHighlight(i.marker,"^").repeat(a)].join("");if(l&&r.message){t+=" "+maybeHighlight(i.message,r.message)}}return[maybeHighlight(i.marker,">"),maybeHighlight(i.gutter,n),e.length>0?` ${e}`:"",t].join("")}else{return` ${maybeHighlight(i.gutter,n)}${e.length>0?` ${e}`:""}`}})).join("\n");if(r.message&&!d){y=`${" ".repeat(f+1)}${r.message}\n${y}`}if(a){return o.reset(y)}else{return y}}function _default(e,t,r,s={}){if(!a){a=true;const e="Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";if(process.emitWarning){process.emitWarning(e,"DeprecationWarning")}else{const t=new Error(e);t.name="DeprecationWarning";console.warn(new Error(e))}}r=Math.max(r,0);const n={start:{column:r,line:t}};return codeFrameColumns(e,n,s)}},5002:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(5002);var a=r(7169)},7169:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},2032:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.shouldHighlight=shouldHighlight;t.getChalk=getChalk;t["default"]=highlight;var s=r(8035);var a=r(347);var n=r(8542);const o=new Set(["as","async","from","get","of","set"]);function getDefs(e){return{keyword:e.cyan,capitalized:e.yellow,jsxIdentifier:e.yellow,punctuator:e.yellow,number:e.magenta,string:e.green,regex:e.magenta,comment:e.grey,invalid:e.white.bgRed.bold}}const i=/\r\n|[\n\r\u2028\u2029]/;const l=/^[()[\]{}]$/;let c;{const e=/^[a-z][\w-]*$/i;const getTokenType=function(t,r,s){if(t.type==="name"){if((0,a.isKeyword)(t.value)||(0,a.isStrictReservedWord)(t.value,true)||o.has(t.value)){return"keyword"}if(e.test(t.value)&&(s[r-1]==="<"||s.substr(r-2,2)=="t(e))).join("\n")}else{r+=a}}return r}function shouldHighlight(e){return!!n.supportsColor||e.forceColor}function getChalk(e){return e.forceColor?new n.constructor({enabled:true,level:1}):n}function highlight(e,t={}){if(shouldHighlight(t)){const r=getChalk(t);const s=getDefs(r);return highlightTokens(s,e)}else{return e}}},8716:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var r=function(){function sliceIterator(e,t){var r=[];var s=true;var a=false;var n=undefined;try{for(var o=e[Symbol.iterator](),i;!(s=(i=o.next()).done);s=true){r.push(i.value);if(t&&r.length===t)break}}catch(e){a=true;n=e}finally{try{if(!s&&o["return"])o["return"]()}finally{if(a)throw n}}return r}return function(e,t){if(Array.isArray(e)){return e}else if(Symbol.iterator in Object(e)){return sliceIterator(e,t)}else{throw new TypeError("Invalid attempt to destructure non-iterable instance")}}}();t.getImportSource=getImportSource;t.createDynamicImportTransform=createDynamicImportTransform;function getImportSource(e,t){var s=t.arguments;var a=r(s,1),n=a[0];var o=e.isStringLiteral(n)||e.isTemplateLiteral(n);if(o){e.removeComments(n);return n}return e.templateLiteral([e.templateElement({raw:"",cooked:""}),e.templateElement({raw:"",cooked:""},true)],s)}function createDynamicImportTransform(e){var t=e.template,r=e.types;var s={static:{interop:t("Promise.resolve().then(() => INTEROP(require(SOURCE)))"),noInterop:t("Promise.resolve().then(() => require(SOURCE))")},dynamic:{interop:t("Promise.resolve(SOURCE).then(s => INTEROP(require(s)))"),noInterop:t("Promise.resolve(SOURCE).then(s => require(s))")}};var a=typeof WeakSet==="function"&&new WeakSet;var n=function isString(e){return r.isStringLiteral(e)||r.isTemplateLiteral(e)&&e.expressions.length===0};return function(e,t){if(a){if(a.has(t)){return}a.add(t)}var o=getImportSource(r,t.parent);var i=n(o)?s["static"]:s.dynamic;var l=e.opts.noInterop?i.noInterop({SOURCE:o}):i.interop({SOURCE:o,INTEROP:e.addHelper("interopRequireWildcard")});t.parentPath.replaceWith(l)}}},7047:(e,t,r)=>{e.exports=r(8716)},9065:(e,t,r)=>{"use strict";const s=r(1603);const{get:a,has:n,find:o}=r(8018);const getSortedObjectPaths=e=>{if(!e){return[]}return s(e).paths().filter((e=>e.length)).map((e=>e.join("."))).sort(((e,t)=>t.length-e.length))};const replaceAndEvaluateNode=(e,t,r)=>{t.replaceWith(e(r));if(t.parentPath.isBinaryExpression()){const r=t.parentPath.evaluate();if(r.confident){t.parentPath.replaceWith(e(r.value))}}};const processNode=(e,t,r,s)=>{const i=o(getSortedObjectPaths(e),(e=>s(t,e)));if(n(e,i)){replaceAndEvaluateNode(r,t,a(e,i))}};const memberExpressionComparator=(e,t)=>e.matchesPattern(t);const identifierComparator=(e,t)=>e.node.name===t;const unaryExpressionComparator=(e,t)=>e.node.argument.name===t;const i="typeof ";const plugin=function({types:e}){return{visitor:{MemberExpression(t,r){processNode(r.opts,t,e.valueToNode,memberExpressionComparator)},Identifier(t,r){processNode(r.opts,t,e.valueToNode,identifierComparator)},UnaryExpression(t,r){if(t.node.operator!=="typeof"){return}const{opts:s}=r;const a=Object.keys(s);const n={};a.forEach((e=>{if(e.substring(0,i.length)===i){n[e.substring(i.length)]=s[e]}}));processNode(n,t,e.valueToNode,unaryExpressionComparator)}}}};e.exports=plugin;e.exports["default"]=plugin;e.exports.getSortedObjectPaths=getSortedObjectPaths},6197:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=_interopRequireDefault(r(7835));var a=_interopRequireDefault(r(4640));var n=_interopRequireDefault(r(346));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectSpread(e){for(var t=1;t1&&arguments[1]!==undefined?arguments[1]:{};var o=n.as,i=o===void 0?"assignmentExpression":o;var l=t.expression('\n process.env.NODE_ENV !== "production" ? RIGHT : {}\n ',{placeholderPattern:/^(LEFT|RIGHT)$/})({RIGHT:a});switch(i){case"variableDeclarator":return r.variableDeclarator(s,l);case"assignmentExpression":return r.assignmentExpression("=",s,l);default:throw new Error("unrecognized template type ".concat(i))}},mode:p.opts.mode||"remove",ignoreFilenames:d,types:r,removeImport:p.opts.removeImport||false,libraries:(p.opts.additionalLibraries||[]).concat("prop-types"),classNameMatchers:f,createReactClassName:p.opts.createReactClassName||"createReactClass"};if(p.opts.plugins){var y=p;var g=p.opts.plugins.map((function(t){var r=typeof t==="string"?t:t[0];if(typeof t!=="string"){y.opts=_objectSpread({},y.opts,t[1])}var s=require(r);if(typeof s!=="function"){s=s.default}return s(e).visitor}));o(u.parent,o.visitors.merge(g),u.scope,y,u.parentPath)}u.traverse({ObjectProperty:{exit:function exit(e){var t=e.node;if(t.computed||t.key.name!=="propTypes"){return}var r=e.findParent((function(e){if(e.type!=="CallExpression"){return false}return e.get("callee").node.name===m.createReactClassName||e.get("callee").node.property&&e.get("callee").node.property.name==="createClass"}));if(r){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"createClass"})}}},ClassProperty:function ClassProperty(e){var t=e.node,r=e.scope;if(t.key.name==="propTypes"){var s=r.path;if(isReactClass(s.get("superClass"),r,m)){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"class static",pathClassDeclaration:s})}}},AssignmentExpression:function AssignmentExpression(e){var t=e.node,r=e.scope;if(t.left.computed||!t.left.property||t.left.property.name!=="propTypes"){return}var o=(0,s.default)(e.node.left);if(o){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"assign"});return}var i=t.left.object.name;var u=r.getBinding(i);if(!u){return}if(u.path.isClassDeclaration()){var p=u.path.get("superClass");if(isReactClass(p,r,m)){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"assign"})}}else if((0,a.default)(u.path)){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"assign"})}}});var h=0;var b={VariableDeclarator:function VariableDeclarator(e){if(e.scope.block.type!=="Program"){return}if(["ObjectPattern","ArrayPattern"].includes(e.node.id.type)){return}var t=e.node.id.name;if(!i.has(t)){return}var r=e.scope.getBinding(t),s=r.referencePaths;var a=s.some((function(e){var t=e.find((function(e){return l.has(e)}));return!t}));if(a){h+=1;return}l.add(e);i.delete(t);e.get("init").traverse(c);(0,n.default)(e,m,{type:"declarator"})}};var x=new Set;while(!areSetsEqual(i,x)&&i.size>0&&h0}));if(!n){e.remove()}}})}else{throw new Error('transform-react-remove-prop-type: removeImport = true and mode != "remove" can not be used at the same time.')}}}}}}},7835:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=isAnnotatedForRemoval;function isAnnotatedForRemoval(e){var t=e.trailingComments||[];return Boolean(t.find((function(e){var t=e.value;return t.trim()==="remove-proptypes"})))}},4640:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=isStatelessComponent;var r=Symbol("traversed");function isJSXElementOrReactCreateElement(e){var t=false;e.traverse({CallExpression:function CallExpression(e){var r=e.get("callee");if(r.matchesPattern("React.createElement")||r.matchesPattern("React.cloneElement")||r.node.name==="cloneElement"){t=true}},JSXElement:function JSXElement(){t=true}});return t}function isReturningJSXElement(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(e.node.init&&e.node.init.body&&isJSXElementOrReactCreateElement(e)){return true}if(t>20){throw new Error("transform-react-remove-prop-type: infinite loop detected.")}var s=false;e.traverse({ReturnStatement:function ReturnStatement(a){if(s){return}var n=a.get("argument");if(!n.node){return}if(isJSXElementOrReactCreateElement(a)){s=true;return}if(n.node.type==="CallExpression"){var o=n.get("callee").node.name;var i=e.scope.getBinding(o);if(!i){return}if(i.path[r]){return}i.path[r]=true;if(isReturningJSXElement(i.path,t+1)){s=true}}}});return s}var s=["VariableDeclarator","FunctionDeclaration"];function isStatelessComponent(e){if(s.indexOf(e.node.type)===-1){return false}if(isReturningJSXElement(e)){return true}return false}},346:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=remove;function isInside(e,t){if(!e.hub.file.opts){return true}var r=e.hub.file.opts.filename;if(!r){return true}if(!t){return false}return t.test(r)}function remove(e,t,r){var s=t.visitedKey,a=t.unsafeWrapTemplate,n=t.wrapTemplate,o=t.mode,i=t.ignoreFilenames,l=t.types;if(i&&isInside(e.scope,i)){return}if(e.node[s]){return}e.node[s]=true;if(o==="remove"){if(e.parentPath.type==="ConditionalExpression"){e.replaceWith(l.unaryExpression("void",l.numericLiteral(0)))}else{e.remove()}return}if(o==="wrap"||o==="unsafe-wrap"){switch(r.type){case"createClass":break;case"class static":{var c;var u=r.pathClassDeclaration;if(!u.isClassExpression()&&u.node.id){c=u.node.id}else{return}var p=l.expressionStatement(l.assignmentExpression("=",l.memberExpression(c,e.node.key),e.node.value));if(u.parentPath.isExportDeclaration()){u=u.parentPath}u.insertAfter(p);e.remove();break}case"assign":if(o==="unsafe-wrap"){e.replaceWith(a({NODE:e.node}))}else{e.replaceWith(n({LEFT:e.node.left,RIGHT:e.node.right}))}e.node[s]=true;break;case"declarator":e.replaceWith(n({LEFT:e.node.id,RIGHT:e.node.init},{as:"variableDeclarator"}));e.node[s]=true;break;default:break}return}throw new Error("transform-react-remove-prop-type: unsupported mode ".concat(o,"."))}},665:(e,t,r)=>{"use strict";const s=r(2971);class Definition{constructor(e,t,r,s,a,n){this.type=e;this.name=t;this.node=r;this.parent=s;this.index=a;this.kind=n}}class ParameterDefinition extends Definition{constructor(e,t,r,a){super(s.Parameter,e,t,null,r,null);this.rest=a}}e.exports={ParameterDefinition:ParameterDefinition,Definition:Definition}},6007:(e,t,r)=>{"use strict";const s=r(9491);const a=r(6988);const n=r(4585);const o=r(4945);const i=r(2971);const l=r(6313).Scope;const c=r(290).i8;function defaultOptions(){return{optimistic:false,directive:false,nodejsScope:false,impliedStrict:false,sourceType:"script",ecmaVersion:5,childVisitorKeys:null,fallback:"iteration"}}function updateDeeply(e,t){function isHashObject(e){return typeof e==="object"&&e instanceof Object&&!(e instanceof Array)&&!(e instanceof RegExp)}for(const r in t){if(Object.prototype.hasOwnProperty.call(t,r)){const s=t[r];if(isHashObject(s)){if(isHashObject(e[r])){updateDeeply(e[r],s)}else{e[r]=updateDeeply({},s)}}else{e[r]=s}}}return e}function analyze(e,t){const r=updateDeeply(defaultOptions(),t);const o=new a(r);const i=new n(r,o);i.visit(e);s(o.__currentScope===null,"currentScope should be null.");return o}e.exports={version:c,Reference:o,Variable:i,Scope:l,ScopeManager:a,analyze:analyze}},4162:(e,t,r)=>{"use strict";const s=r(8350).Syntax;const a=r(1217);function getLast(e){return e[e.length-1]||null}class PatternVisitor extends a.Visitor{static isPattern(e){const t=e.type;return t===s.Identifier||t===s.ObjectPattern||t===s.ArrayPattern||t===s.SpreadElement||t===s.RestElement||t===s.AssignmentPattern}constructor(e,t,r){super(null,e);this.rootPattern=t;this.callback=r;this.assignments=[];this.rightHandNodes=[];this.restElements=[]}Identifier(e){const t=getLast(this.restElements);this.callback(e,{topLevel:e===this.rootPattern,rest:t!==null&&t!==undefined&&t.argument===e,assignments:this.assignments})}Property(e){if(e.computed){this.rightHandNodes.push(e.key)}this.visit(e.value)}ArrayPattern(e){for(let t=0,r=e.elements.length;t{this.rightHandNodes.push(e)}));this.visit(e.callee)}}e.exports=PatternVisitor},4945:e=>{"use strict";const t=1;const r=2;const s=t|r;class Reference{constructor(e,t,r,s,a,n,o){this.identifier=e;this.from=t;this.tainted=false;this.resolved=null;this.flag=r;if(this.isWrite()){this.writeExpr=s;this.partial=n;this.init=o}this.__maybeImplicitGlobal=a}isStatic(){return!this.tainted&&this.resolved&&this.resolved.scope.isStatic()}isWrite(){return!!(this.flag&Reference.WRITE)}isRead(){return!!(this.flag&Reference.READ)}isReadOnly(){return this.flag===Reference.READ}isWriteOnly(){return this.flag===Reference.WRITE}isReadWrite(){return this.flag===Reference.RW}}Reference.READ=t;Reference.WRITE=r;Reference.RW=s;e.exports=Reference},4585:(e,t,r)=>{"use strict";const s=r(8350).Syntax;const a=r(1217);const n=r(4945);const o=r(2971);const i=r(4162);const l=r(665);const c=r(9491);const u=l.ParameterDefinition;const p=l.Definition;function traverseIdentifierInPattern(e,t,r,s){const a=new i(e,t,s);a.visit(t);if(r!==null&&r!==undefined){a.rightHandNodes.forEach(r.visit,r)}}class Importer extends a.Visitor{constructor(e,t){super(null,t.options);this.declaration=e;this.referencer=t}visitImport(e,t){this.referencer.visitPattern(e,(e=>{this.referencer.currentScope().__define(e,new p(o.ImportBinding,e,t,this.declaration,null,null))}))}ImportNamespaceSpecifier(e){const t=e.local||e.id;if(t){this.visitImport(t,e)}}ImportDefaultSpecifier(e){const t=e.local||e.id;this.visitImport(t,e)}ImportSpecifier(e){const t=e.local||e.id;if(e.name){this.visitImport(e.name,e)}else{this.visitImport(t,e)}}}class Referencer extends a.Visitor{constructor(e,t){super(null,e);this.options=e;this.scopeManager=t;this.parent=null;this.isInnerMethodDefinition=false}currentScope(){return this.scopeManager.__currentScope}close(e){while(this.currentScope()&&e===this.currentScope().block){this.scopeManager.__currentScope=this.currentScope().__close(this.scopeManager)}}pushInnerMethodDefinition(e){const t=this.isInnerMethodDefinition;this.isInnerMethodDefinition=e;return t}popInnerMethodDefinition(e){this.isInnerMethodDefinition=e}referencingDefaultValue(e,t,r,s){const a=this.currentScope();t.forEach((t=>{a.__referencing(e,n.WRITE,t.right,r,e!==t.left,s)}))}visitPattern(e,t,r){let s=t;let a=r;if(typeof t==="function"){a=t;s={processRightHandNodes:false}}traverseIdentifierInPattern(this.options,e,s.processRightHandNodes?this:null,a)}visitFunction(e){let t,r;if(e.type===s.FunctionDeclaration){this.currentScope().__define(e.id,new p(o.FunctionName,e.id,e,null,null,null))}if(e.type===s.FunctionExpression&&e.id){this.scopeManager.__nestFunctionExpressionNameScope(e)}this.scopeManager.__nestFunctionScope(e,this.isInnerMethodDefinition);const a=this;function visitPatternCallback(r,s){a.currentScope().__define(r,new u(r,e,t,s.rest));a.referencingDefaultValue(r,s.assignments,null,true)}for(t=0,r=e.params.length;t{this.currentScope().__define(t,new u(t,e,e.params.length,true))}))}if(e.body){if(e.body.type===s.BlockStatement){this.visitChildren(e.body)}else{this.visit(e.body)}}this.close(e)}visitClass(e){if(e.type===s.ClassDeclaration){this.currentScope().__define(e.id,new p(o.ClassName,e.id,e,null,null,null))}this.visit(e.superClass);this.scopeManager.__nestClassScope(e);if(e.id){this.currentScope().__define(e.id,new p(o.ClassName,e.id,e))}this.visit(e.body);this.close(e)}visitProperty(e){let t;if(e.computed){this.visit(e.key)}const r=e.type===s.MethodDefinition;if(r){t=this.pushInnerMethodDefinition(true)}this.visit(e.value);if(r){this.popInnerMethodDefinition(t)}}visitForIn(e){if(e.left.type===s.VariableDeclaration&&e.left.kind!=="var"){this.scopeManager.__nestForScope(e)}if(e.left.type===s.VariableDeclaration){this.visit(e.left);this.visitPattern(e.left.declarations[0].id,(t=>{this.currentScope().__referencing(t,n.WRITE,e.right,null,true,true)}))}else{this.visitPattern(e.left,{processRightHandNodes:true},((t,r)=>{let s=null;if(!this.currentScope().isStrict){s={pattern:t,node:e}}this.referencingDefaultValue(t,r.assignments,s,false);this.currentScope().__referencing(t,n.WRITE,e.right,s,true,false)}))}this.visit(e.right);this.visit(e.body);this.close(e)}visitVariableDeclaration(e,t,r,s){const a=r.declarations[s];const o=a.init;this.visitPattern(a.id,{processRightHandNodes:true},((i,l)=>{e.__define(i,new p(t,i,a,r,s,r.kind));this.referencingDefaultValue(i,l.assignments,null,true);if(o){this.currentScope().__referencing(i,n.WRITE,o,null,!l.topLevel,true)}}))}AssignmentExpression(e){if(i.isPattern(e.left)){if(e.operator==="="){this.visitPattern(e.left,{processRightHandNodes:true},((t,r)=>{let s=null;if(!this.currentScope().isStrict){s={pattern:t,node:e}}this.referencingDefaultValue(t,r.assignments,s,false);this.currentScope().__referencing(t,n.WRITE,e.right,s,!r.topLevel,false)}))}else{this.currentScope().__referencing(e.left,n.RW,e.right)}}else{this.visit(e.left)}this.visit(e.right)}CatchClause(e){this.scopeManager.__nestCatchScope(e);this.visitPattern(e.param,{processRightHandNodes:true},((t,r)=>{this.currentScope().__define(t,new p(o.CatchClause,e.param,e,null,null,null));this.referencingDefaultValue(t,r.assignments,null,true)}));this.visit(e.body);this.close(e)}Program(e){this.scopeManager.__nestGlobalScope(e);if(this.scopeManager.__isNodejsScope()){this.currentScope().isStrict=false;this.scopeManager.__nestFunctionScope(e,false)}if(this.scopeManager.__isES6()&&this.scopeManager.isModule()){this.scopeManager.__nestModuleScope(e)}if(this.scopeManager.isStrictModeSupported()&&this.scopeManager.isImpliedStrict()){this.currentScope().isStrict=true}this.visitChildren(e);this.close(e)}Identifier(e){this.currentScope().__referencing(e)}UpdateExpression(e){if(i.isPattern(e.argument)){this.currentScope().__referencing(e.argument,n.RW,null)}else{this.visitChildren(e)}}MemberExpression(e){this.visit(e.object);if(e.computed){this.visit(e.property)}}Property(e){this.visitProperty(e)}MethodDefinition(e){this.visitProperty(e)}BreakStatement(){}ContinueStatement(){}LabeledStatement(e){this.visit(e.body)}ForStatement(e){if(e.init&&e.init.type===s.VariableDeclaration&&e.init.kind!=="var"){this.scopeManager.__nestForScope(e)}this.visitChildren(e);this.close(e)}ClassExpression(e){this.visitClass(e)}ClassDeclaration(e){this.visitClass(e)}CallExpression(e){if(!this.scopeManager.__ignoreEval()&&e.callee.type===s.Identifier&&e.callee.name==="eval"){this.currentScope().variableScope.__detectEval()}this.visitChildren(e)}BlockStatement(e){if(this.scopeManager.__isES6()){this.scopeManager.__nestBlockScope(e)}this.visitChildren(e);this.close(e)}ThisExpression(){this.currentScope().variableScope.__detectThis()}WithStatement(e){this.visit(e.object);this.scopeManager.__nestWithScope(e);this.visit(e.body);this.close(e)}VariableDeclaration(e){const t=e.kind==="var"?this.currentScope().variableScope:this.currentScope();for(let r=0,s=e.declarations.length;r{"use strict";const s=r(6313);const a=r(9491);const n=s.GlobalScope;const o=s.CatchScope;const i=s.WithScope;const l=s.ModuleScope;const c=s.ClassScope;const u=s.SwitchScope;const p=s.FunctionScope;const d=s.ForScope;const f=s.FunctionExpressionNameScope;const m=s.BlockScope;class ScopeManager{constructor(e){this.scopes=[];this.globalScope=null;this.__nodeToScope=new WeakMap;this.__currentScope=null;this.__options=e;this.__declaredVariables=new WeakMap}__useDirective(){return this.__options.directive}__isOptimistic(){return this.__options.optimistic}__ignoreEval(){return this.__options.ignoreEval}__isNodejsScope(){return this.__options.nodejsScope}isModule(){return this.__options.sourceType==="module"}isImpliedStrict(){return this.__options.impliedStrict}isStrictModeSupported(){return this.__options.ecmaVersion>=5}__get(e){return this.__nodeToScope.get(e)}getDeclaredVariables(e){return this.__declaredVariables.get(e)||[]}acquire(e,t){function predicate(e){if(e.type==="function"&&e.functionExpressionScope){return false}return true}const r=this.__get(e);if(!r||r.length===0){return null}if(r.length===1){return r[0]}if(t){for(let e=r.length-1;e>=0;--e){const t=r[e];if(predicate(t)){return t}}}else{for(let e=0,t=r.length;e=6}}e.exports=ScopeManager},6313:(e,t,r)=>{"use strict";const s=r(8350).Syntax;const a=r(4945);const n=r(2971);const o=r(665).Definition;const i=r(9491);function isStrictScope(e,t,r,a){let n;if(e.upper&&e.upper.isStrict){return true}if(r){return true}if(e.type==="class"||e.type==="module"){return true}if(e.type==="block"||e.type==="switch"){return false}if(e.type==="function"){if(t.type===s.ArrowFunctionExpression&&t.body.type!==s.BlockStatement){return false}if(t.type===s.Program){n=t}else{n=t.body}if(!n){return false}}else if(e.type==="global"){n=t}else{return false}if(a){for(let e=0,t=n.body.length;e0&&s.every(shouldBeStatically)}__staticCloseRef(e){if(!this.__resolve(e)){this.__delegateToUpperScope(e)}}__dynamicCloseRef(e){let t=this;do{t.through.push(e);t=t.upper}while(t)}__globalCloseRef(e){if(this.__shouldStaticallyCloseForGlobal(e)){this.__staticCloseRef(e)}else{this.__dynamicCloseRef(e)}}__close(e){let t;if(this.__shouldStaticallyClose(e)){t=this.__staticCloseRef}else if(this.type!=="global"){t=this.__dynamicCloseRef}else{t=this.__globalCloseRef}for(let e=0,r=this.__left.length;ee.name.range[0]>=r)))}}class ForScope extends Scope{constructor(e,t,r){super(e,"for",t,r,false)}}class ClassScope extends Scope{constructor(e,t,r){super(e,"class",t,r,false)}}e.exports={Scope:Scope,GlobalScope:GlobalScope,ModuleScope:ModuleScope,FunctionExpressionNameScope:FunctionExpressionNameScope,CatchScope:CatchScope,WithScope:WithScope,BlockScope:BlockScope,SwitchScope:SwitchScope,FunctionScope:FunctionScope,ForScope:ForScope,ClassScope:ClassScope}},2971:e=>{"use strict";class Variable{constructor(e,t){this.name=e;this.identifiers=[];this.references=[];this.defs=[];this.tainted=false;this.stack=true;this.scope=t}}Variable.CatchClause="CatchClause";Variable.Parameter="Parameter";Variable.FunctionName="FunctionName";Variable.ClassName="ClassName";Variable.Variable="Variable";Variable.ImportBinding="ImportBinding";Variable.ImplicitGlobalVariable="ImplicitGlobalVariable";e.exports=Variable},1217:(e,t,r)=>{(function(){"use strict";var e=r(165);function isNode(e){if(e==null){return false}return typeof e==="object"&&typeof e.type==="string"}function isProperty(t,r){return(t===e.Syntax.ObjectExpression||t===e.Syntax.ObjectPattern)&&r==="properties"}function Visitor(t,r){r=r||{};this.__visitor=t||this;this.__childVisitorKeys=r.childVisitorKeys?Object.assign({},e.VisitorKeys,r.childVisitorKeys):e.VisitorKeys;if(r.fallback==="iteration"){this.__fallback=Object.keys}else if(typeof r.fallback==="function"){this.__fallback=r.fallback}}Visitor.prototype.visitChildren=function(t){var r,s,a,n,o,i,l;if(t==null){return}r=t.type||e.Syntax.Property;s=this.__childVisitorKeys[r];if(!s){if(this.__fallback){s=this.__fallback(t)}else{throw new Error("Unknown node type "+r+".")}}for(a=0,n=s.length;a{(function clone(e){"use strict";var t,r,s,a,n,o;function deepCopy(e){var t={},r,s;for(r in e){if(e.hasOwnProperty(r)){s=e[r];if(typeof s==="object"&&s!==null){t[r]=deepCopy(s)}else{t[r]=s}}}return t}function upperBound(e,t){var r,s,a,n;s=e.length;a=0;while(s){r=s>>>1;n=a+r;if(t(e[n])){s=r}else{a=n+1;s-=r+1}}return a}t={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ChainExpression:"ChainExpression",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"};s={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]};a={};n={};o={};r={Break:a,Skip:n,Remove:o};function Reference(e,t){this.parent=e;this.key=t}Reference.prototype.replace=function replace(e){this.parent[this.key]=e};Reference.prototype.remove=function remove(){if(Array.isArray(this.parent)){this.parent.splice(this.key,1);return true}else{this.replace(null);return false}};function Element(e,t,r,s){this.node=e;this.path=t;this.wrap=r;this.ref=s}function Controller(){}Controller.prototype.path=function path(){var e,t,r,s,a,n;function addToPath(e,t){if(Array.isArray(t)){for(r=0,s=t.length;r=0;--r){if(e[r].node===t){return true}}return false}Controller.prototype.traverse=function traverse(e,t){var r,s,o,i,l,c,u,p,d,f,m,y;this.__initialize(e,t);y={};r=this.__worklist;s=this.__leavelist;r.push(new Element(e,null,null,null));s.push(new Element(null,null,null,null));while(r.length){o=r.pop();if(o===y){o=s.pop();c=this.__execute(t.leave,o);if(this.__state===a||c===a){return}continue}if(o.node){c=this.__execute(t.enter,o);if(this.__state===a||c===a){return}r.push(y);s.push(o);if(this.__state===n||c===n){continue}i=o.node;l=i.type||o.wrap;f=this.__keys[l];if(!f){if(this.__fallback){f=this.__fallback(i)}else{throw new Error("Unknown node type "+l+".")}}p=f.length;while((p-=1)>=0){u=f[p];m=i[u];if(!m){continue}if(Array.isArray(m)){d=m.length;while((d-=1)>=0){if(!m[d]){continue}if(candidateExistsInLeaveList(s,m[d])){continue}if(isProperty(l,f[p])){o=new Element(m[d],[u,d],"Property",null)}else if(isNode(m[d])){o=new Element(m[d],[u,d],null,null)}else{continue}r.push(o)}}else if(isNode(m)){if(candidateExistsInLeaveList(s,m)){continue}r.push(new Element(m,u,null,null))}}}}};Controller.prototype.replace=function replace(e,t){var r,s,i,l,c,u,p,d,f,m,y,g,h;function removeElem(e){var t,s,a,n;if(e.ref.remove()){s=e.ref.key;n=e.ref.parent;t=r.length;while(t--){a=r[t];if(a.ref&&a.ref.parent===n){if(a.ref.key=0){h=f[p];m=i[h];if(!m){continue}if(Array.isArray(m)){d=m.length;while((d-=1)>=0){if(!m[d]){continue}if(isProperty(l,f[p])){u=new Element(m[d],[h,d],"Property",new Reference(m,d))}else if(isNode(m[d])){u=new Element(m[d],[h,d],null,new Reference(m,d))}else{continue}r.push(u)}}else if(isNode(m)){r.push(new Element(m,h,null,new Reference(i,h)))}}}return g.root};function traverse(e,t){var r=new Controller;return r.traverse(e,t)}function replace(e,t){var r=new Controller;return r.replace(e,t)}function extendCommentRange(e,t){var r;r=upperBound(t,(function search(t){return t.range[0]>e.range[0]}));e.extendedRange=[e.range[0],e.range[1]];if(r!==t.length){e.extendedRange[1]=t[r].range[0]}r-=1;if(r>=0){e.extendedRange[0]=t[r].range[1]}return e}function attachComments(e,t,s){var a=[],n,o,i,l;if(!e.range){throw new Error("attachComments needs range information")}if(!s.length){if(t.length){for(i=0,o=t.length;ie.range[0]){break}if(t.extendedRange[1]===e.range[0]){if(!e.leadingComments){e.leadingComments=[]}e.leadingComments.push(t);a.splice(l,1)}else{l+=1}}if(l===a.length){return r.Break}if(a[l].extendedRange[0]>e.range[1]){return r.Skip}}});l=0;traverse(e,{leave:function(e){var t;while(le.range[1]){return r.Skip}}});return e}e.Syntax=t;e.traverse=traverse;e.replace=replace;e.attachComments=attachComments;e.VisitorKeys=s;e.VisitorOption=r;e.Controller=Controller;e.cloneEnvironment=function(){return clone({})};return e})(t)},8350:(e,t,r)=>{(function clone(e){"use strict";var t,s,a,n,o,i;function deepCopy(e){var t={},r,s;for(r in e){if(e.hasOwnProperty(r)){s=e[r];if(typeof s==="object"&&s!==null){t[r]=deepCopy(s)}else{t[r]=s}}}return t}function upperBound(e,t){var r,s,a,n;s=e.length;a=0;while(s){r=s>>>1;n=a+r;if(t(e[n])){s=r}else{a=n+1;s-=r+1}}return a}t={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"};a={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]};n={};o={};i={};s={Break:n,Skip:o,Remove:i};function Reference(e,t){this.parent=e;this.key=t}Reference.prototype.replace=function replace(e){this.parent[this.key]=e};Reference.prototype.remove=function remove(){if(Array.isArray(this.parent)){this.parent.splice(this.key,1);return true}else{this.replace(null);return false}};function Element(e,t,r,s){this.node=e;this.path=t;this.wrap=r;this.ref=s}function Controller(){}Controller.prototype.path=function path(){var e,t,r,s,a,n;function addToPath(e,t){if(Array.isArray(t)){for(r=0,s=t.length;r=0){u=f[p];m=i[u];if(!m){continue}if(Array.isArray(m)){d=m.length;while((d-=1)>=0){if(!m[d]){continue}if(isProperty(l,f[p])){a=new Element(m[d],[u,d],"Property",null)}else if(isNode(m[d])){a=new Element(m[d],[u,d],null,null)}else{continue}r.push(a)}}else if(isNode(m)){r.push(new Element(m,u,null,null))}}}}};Controller.prototype.replace=function replace(e,t){var r,s,a,l,c,u,p,d,f,m,y,g,h;function removeElem(e){var t,s,a,n;if(e.ref.remove()){s=e.ref.key;n=e.ref.parent;t=r.length;while(t--){a=r[t];if(a.ref&&a.ref.parent===n){if(a.ref.key=0){h=f[p];m=a[h];if(!m){continue}if(Array.isArray(m)){d=m.length;while((d-=1)>=0){if(!m[d]){continue}if(isProperty(l,f[p])){u=new Element(m[d],[h,d],"Property",new Reference(m,d))}else if(isNode(m[d])){u=new Element(m[d],[h,d],null,new Reference(m,d))}else{continue}r.push(u)}}else if(isNode(m)){r.push(new Element(m,h,null,new Reference(a,h)))}}}return g.root};function traverse(e,t){var r=new Controller;return r.traverse(e,t)}function replace(e,t){var r=new Controller;return r.replace(e,t)}function extendCommentRange(e,t){var r;r=upperBound(t,(function search(t){return t.range[0]>e.range[0]}));e.extendedRange=[e.range[0],e.range[1]];if(r!==t.length){e.extendedRange[1]=t[r].range[0]}r-=1;if(r>=0){e.extendedRange[0]=t[r].range[1]}return e}function attachComments(e,t,r){var a=[],n,o,i,l;if(!e.range){throw new Error("attachComments needs range information")}if(!r.length){if(t.length){for(i=0,o=t.length;ie.range[0]){break}if(t.extendedRange[1]===e.range[0]){if(!e.leadingComments){e.leadingComments=[]}e.leadingComments.push(t);a.splice(l,1)}else{l+=1}}if(l===a.length){return s.Break}if(a[l].extendedRange[0]>e.range[1]){return s.Skip}}});l=0;traverse(e,{leave:function(e){var t;while(le.range[1]){return s.Skip}}});return e}e.version=r(5535).i8;e.Syntax=t;e.traverse=traverse;e.replace=replace;e.attachComments=attachComments;e.VisitorKeys=a;e.VisitorOption=s;e.Controller=Controller;e.cloneEnvironment=function(){return clone({})};return e})(t)},9733:e=>{"use strict";var t="Function.prototype.bind called on incompatible ";var r=Array.prototype.slice;var s=Object.prototype.toString;var a="[object Function]";e.exports=function bind(e){var n=this;if(typeof n!=="function"||s.call(n)!==a){throw new TypeError(t+n)}var o=r.call(arguments,1);var i;var binder=function(){if(this instanceof i){var t=n.apply(this,o.concat(r.call(arguments)));if(Object(t)===t){return t}return this}else{return n.apply(e,o.concat(r.call(arguments)))}};var l=Math.max(0,n.length-o.length);var c=[];for(var u=0;u{"use strict";var s=r(9733);e.exports=Function.prototype.bind||s},5548:(e,t,r)=>{"use strict";e.exports=r(964)},793:(e,t,r)=>{"use strict";var s=r(4517);e.exports=s.call(Function.call,Object.prototype.hasOwnProperty)},8746:(e,t,r)=>{"use strict";var s=r(793);function specifierIncluded(e,t){var r=e.split(".");var s=t.split(" ");var a=s.length>1?s[0]:"=";var n=(s.length>1?s[1]:s[0]).split(".");for(var o=0;o<3;++o){var i=parseInt(r[o]||0,10);var l=parseInt(n[o]||0,10);if(i===l){continue}if(a==="<"){return i="){return i>=l}return false}return a===">="}function matchesRange(e,t){var r=t.split(/ ?&& ?/);if(r.length===0){return false}for(var s=0;s{Object.defineProperty(t,"__esModule",{value:true});t["default"]=/((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;t.matchToToken=function(e){var t={type:"invalid",value:e[0],closed:undefined};if(e[1])t.type="string",t.closed=!!(e[3]||e[4]);else if(e[5])t.type="comment";else if(e[6])t.type="comment",t.closed=!!e[7];else if(e[8])t.type="regex";else if(e[9])t.type="number";else if(e[10])t.type="name";else if(e[11])t.type="punctuator";else if(e[12])t.type="whitespace";return t}},6240:e=>{var t="Expected a function";var r=0/0;var s="[object Symbol]";var a=/^\s+|\s+$/g;var n=/^[-+]0x[0-9a-f]+$/i;var o=/^0b[01]+$/i;var i=/^0o[0-7]+$/i;var l=parseInt;var c=typeof global=="object"&&global&&global.Object===Object&&global;var u=typeof self=="object"&&self&&self.Object===Object&&self;var p=c||u||Function("return this")();var d=Object.prototype;var f=d.toString;var m=Math.max,y=Math.min;var now=function(){return p.Date.now()};function debounce(e,r,s){var a,n,o,i,l,c,u=0,p=false,d=false,f=true;if(typeof e!="function"){throw new TypeError(t)}r=toNumber(r)||0;if(isObject(s)){p=!!s.leading;d="maxWait"in s;o=d?m(toNumber(s.maxWait)||0,r):o;f="trailing"in s?!!s.trailing:f}function invokeFunc(t){var r=a,s=n;a=n=undefined;u=t;i=e.apply(s,r);return i}function leadingEdge(e){u=e;l=setTimeout(timerExpired,r);return p?invokeFunc(e):i}function remainingWait(e){var t=e-c,s=e-u,a=r-t;return d?y(a,o-s):a}function shouldInvoke(e){var t=e-c,s=e-u;return c===undefined||t>=r||t<0||d&&s>=o}function timerExpired(){var e=now();if(shouldInvoke(e)){return trailingEdge(e)}l=setTimeout(timerExpired,remainingWait(e))}function trailingEdge(e){l=undefined;if(f&&a){return invokeFunc(e)}a=n=undefined;return i}function cancel(){if(l!==undefined){clearTimeout(l)}u=0;a=c=n=l=undefined}function flush(){return l===undefined?i:trailingEdge(now())}function debounced(){var e=now(),t=shouldInvoke(e);a=arguments;n=this;c=e;if(t){if(l===undefined){return leadingEdge(c)}if(d){l=setTimeout(timerExpired,r);return invokeFunc(c)}}if(l===undefined){l=setTimeout(timerExpired,r)}return i}debounced.cancel=cancel;debounced.flush=flush;return debounced}function isObject(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function isObjectLike(e){return!!e&&typeof e=="object"}function isSymbol(e){return typeof e=="symbol"||isObjectLike(e)&&f.call(e)==s}function toNumber(e){if(typeof e=="number"){return e}if(isSymbol(e)){return r}if(isObject(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=isObject(t)?t+"":t}if(typeof e!="string"){return e===0?e:+e}e=e.replace(a,"");var s=o.test(e);return s||i.test(e)?l(e.slice(2),s?2:8):n.test(e)?r:+e}e.exports=debounce},8018:function(e,t,r){e=r.nmd(e); + `,...r.expressions]))},TemplateLiteral(e){const t=[];const r=e.get("expressions");let s=0;for(const n of e.node.quasis){if(n.value.cooked){t.push(a.types.stringLiteral(n.value.cooked))}if(s1){o=buildConcatCallExpressions(t)}e.replaceWith(o)}}}}));t["default"]=n},9116:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},5502:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9001);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-typeof-symbol",visitor:{Scope({scope:e}){if(!e.getBinding("Symbol")){return}e.rename("Symbol")},UnaryExpression(e){const{node:t,parent:r}=e;if(t.operator!=="typeof")return;if(e.parentPath.isBinaryExpression()&&a.types.EQUALITY_BINARY_OPERATORS.indexOf(r.operator)>=0){const t=e.getOpposite();if(t.isLiteral()&&t.node.value!=="symbol"&&t.node.value!=="object"){return}}let s=e.findParent((e=>{if(e.isFunction()){var t;return((t=e.get("body.directives.0"))==null?void 0:t.node.value.value)==="@babel/helpers - typeof"}}));if(s)return;const n=this.addHelper("typeof");s=e.findParent((e=>e.isVariableDeclarator()&&e.node.id===n||e.isFunctionDeclaration()&&e.node.id&&e.node.id.name===n.name));if(s){return}const o=a.types.callExpression(n,[t.argument]);const i=e.get("argument");if(i.isIdentifier()&&!e.scope.hasBinding(i.node.name,true)){const r=a.types.unaryExpression("typeof",a.types.cloneNode(t.argument));e.replaceWith(a.types.conditionalExpression(a.types.binaryExpression("===",r,a.types.stringLiteral("undefined")),a.types.stringLiteral("undefined"),o))}else{e.replaceWith(o)}}}}}));t["default"]=n},9001:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},3448:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(728);var a=r(8304);var n=(0,s.declare)((e=>{e.assertVersion(7);const t=/[\ud800-\udfff]/g;const r=/(\\+)u\{([0-9a-fA-F]+)\}/g;function escape(e){let t=e.toString(16);while(t.length<4)t="0"+t;return"\\u"+t}function replacer(e,t,r){if(t.length%2===0){return e}const s=String.fromCodePoint(parseInt(r,16));const a=t.slice(0,-1)+escape(s.charCodeAt(0));return s.length===1?a:a+escape(s.charCodeAt(1))}function replaceUnicodeEscapes(e){return e.replace(r,replacer)}function getUnicodeEscape(e){let t;while(t=r.exec(e)){if(t[1].length%2===0)continue;r.lastIndex=0;return t[0]}return null}return{name:"transform-unicode-escapes",manipulateOptions({generatorOpts:e}){var t,r;if(!e.jsescOption){e.jsescOption={}}(r=(t=e.jsescOption).minimal)!=null?r:t.minimal=false},visitor:{Identifier(e){const{node:r,key:s}=e;const{name:n}=r;const o=n.replace(t,(e=>`_u${e.charCodeAt(0).toString(16)}`));if(n===o)return;const i=a.types.inherits(a.types.stringLiteral(n),r);if(s==="key"){e.replaceWith(i);return}const{parentPath:l,scope:c}=e;if(l.isMemberExpression({property:r})||l.isOptionalMemberExpression({property:r})){l.node.computed=true;e.replaceWith(i);return}const u=c.getBinding(n);if(u){c.rename(n,c.generateUid(o));return}throw e.buildCodeFrameError(`Can't reference '${n}' as a bare identifier`)},"StringLiteral|DirectiveLiteral"(e){const{node:t}=e;const{extra:r}=t;if(r!=null&&r.raw)r.raw=replaceUnicodeEscapes(r.raw)},TemplateElement(e){const{node:t,parentPath:r}=e;const{value:s}=t;const a=getUnicodeEscape(s.raw);if(!a)return;const n=r.parentPath;if(n.isTaggedTemplateExpression()){throw e.buildCodeFrameError(`Can't replace Unicode escape '${a}' inside tagged template literals. You can enable '@babel/plugin-transform-template-literals' to compile them to classic strings.`)}s.raw=replaceUnicodeEscapes(s.raw)}}}}));t["default"]=n},728:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},4122:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6550);var a=r(836);var n=(0,a.declare)((e=>{e.assertVersion(7);return(0,s.createRegExpFeaturePlugin)({name:"transform-unicode-regex",feature:"unicodeFlag"})}));t["default"]=n},836:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},9453:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;const r={allowInsertArrow:false,specCompliant:false};var _default=({types:e})=>({name:"transform-async-arrows-in-class",visitor:{ArrowFunctionExpression(t){if(t.node.async&&t.findParent(e.isClassMethod)){t.arrowFunctionToExpression(r)}}}});t["default"]=_default;e.exports=t.default},489:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;var _default=({types:e})=>{const isArrowParent=t=>t.parentKey==="params"&&t.parentPath&&e.isArrowFunctionExpression(t.parentPath);return{name:"transform-edge-default-parameters",visitor:{AssignmentPattern(e){const t=e.find(isArrowParent);if(t&&e.parent.shorthand){e.parent.shorthand=false;(e.parent.extra||{}).shorthand=false;e.scope.rename(e.parent.key.name)}}}}};t["default"]=_default;e.exports=t.default},3258:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;var _default=({types:e})=>({name:"transform-edge-function-name",visitor:{FunctionExpression:{exit(t){if(!t.node.id&&e.isIdentifier(t.parent.id)){const r=e.cloneNode(t.parent.id);const s=t.scope.getBinding(r.name);if(s==null?void 0:s.constantViolations.length){t.scope.rename(r.name)}t.node.id=r}}}}});t["default"]=_default;e.exports=t.default},5899:(e,t)=>{"use strict";t.__esModule=true;t["default"]=_default;function _default({types:e}){return{name:"transform-safari-block-shadowing",visitor:{VariableDeclarator(t){const r=t.parent.kind;if(r!=="let"&&r!=="const")return;const s=t.scope.block;if(e.isFunction(s)||e.isProgram(s))return;const a=e.getOuterBindingIdentifiers(t.node.id);for(const r of Object.keys(a)){let s=t.scope;if(!s.hasOwnBinding(r))continue;while(s=s.parent){if(s.hasOwnBinding(r)){t.scope.rename(r);break}if(e.isFunction(s.block)||e.isProgram(s.block)){break}}}}}}}e.exports=t.default},6668:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;function handle(e){if(!e.isVariableDeclaration())return;const t=e.getFunctionParent();const{name:r}=e.node.declarations[0].id;if(t&&t.scope.hasOwnBinding(r)&&t.scope.getOwnBinding(r).kind==="param"){e.scope.rename(r)}}var _default=()=>({name:"transform-safari-for-shadowing",visitor:{ForXStatement(e){handle(e.get("left"))},ForStatement(e){handle(e.get("init"))}}});t["default"]=_default;e.exports=t.default},3744:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;var _default=({types:e})=>({name:"transform-tagged-template-caching",visitor:{TaggedTemplateExpression(t,r){let s=r.get("processed");if(!s){s=new Map;r.set("processed",s)}if(s.has(t.node))return t.skip();const a=t.node.quasi.expressions;let n=r.get("identity");if(!n){n=t.scope.getProgramParent().generateDeclaredUidIdentifier("_");r.set("identity",n);const s=t.scope.getBinding(n.name);s.path.get("init").replaceWith(e.arrowFunctionExpression([e.identifier("t")],e.identifier("t")))}const o=e.taggedTemplateExpression(n,e.templateLiteral(t.node.quasi.quasis,a.map((()=>e.numericLiteral(0)))));s.set(o,true);const i=t.scope.getProgramParent().generateDeclaredUidIdentifier("t");t.scope.getBinding(i.name).path.parent.kind="let";const l=e.logicalExpression("||",i,e.assignmentExpression("=",i,o));const c=e.callExpression(t.node.tag,[l,...a]);t.replaceWith(c)}}});t["default"]=_default;e.exports=t.default},8277:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(7534);var a=r(7420);var n=r(9833);var o=r(2625);var i=r(496);var l=r(7347);function _interopDefaultLegacy(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var c=_interopDefaultLegacy(a);var u=_interopDefaultLegacy(n);var p=_interopDefaultLegacy(o);var f=_interopDefaultLegacy(i);new l.OptionValidator("@babel/preset-react");function normalizeOptions(e={}){{let{pragma:t,pragmaFrag:r}=e;const{pure:s,throwIfNamespace:a=true,runtime:n="classic",importSource:o,useBuiltIns:i,useSpread:l}=e;if(n==="classic"){t=t||"React.createElement";r=r||"React.Fragment"}const c=!!e.development;return{development:c,importSource:o,pragma:t,pragmaFrag:r,pure:s,runtime:n,throwIfNamespace:a,useBuiltIns:i,useSpread:l}}}var d=s.declare(((e,t)=>{e.assertVersion(7);const{development:r,importSource:s,pragma:a,pragmaFrag:n,pure:o,runtime:i,throwIfNamespace:l}=normalizeOptions(t);return{plugins:[[r?u["default"]:c["default"],{importSource:s,pragma:a,pragmaFrag:n,runtime:i,throwIfNamespace:l,pure:o,useBuiltIns:!!t.useBuiltIns,useSpread:t.useSpread}],p["default"],o!==false&&f["default"]].filter(Boolean)}}));t["default"]=d},7534:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7005:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=createPlugin;var s=r(8926);var a=r(7534);var n=r(8304);var o=r(9115);var i=r(2155);const l={importSource:"react",runtime:"automatic",pragma:"React.createElement",pragmaFrag:"React.Fragment"};const c=/\*?\s*@jsxImportSource\s+([^\s]+)/;const u=/\*?\s*@jsxRuntime\s+([^\s]+)/;const p=/\*?\s*@jsx\s+([^\s]+)/;const f=/\*?\s*@jsxFrag\s+([^\s]+)/;const get=(e,t)=>e.get(`@babel/plugin-react-jsx/${t}`);const set=(e,t,r)=>e.set(`@babel/plugin-react-jsx/${t}`,r);function createPlugin({name:e,development:t}){return(0,a.declare)(((r,a)=>{const{pure:o,throwIfNamespace:d=true,filter:m,runtime:y=(t?"automatic":"classic"),importSource:g=l.importSource,pragma:h=l.pragma,pragmaFrag:b=l.pragmaFrag}=a;{var{useSpread:x=false,useBuiltIns:v=false}=a;if(y==="classic"){if(typeof x!=="boolean"){throw new Error("transform-react-jsx currently only accepts a boolean option for "+"useSpread (defaults to false)")}if(typeof v!=="boolean"){throw new Error("transform-react-jsx currently only accepts a boolean option for "+"useBuiltIns (defaults to false)")}if(x&&v){throw new Error("transform-react-jsx currently only accepts useBuiltIns or useSpread "+"but not both")}}}const E={JSXOpeningElement(e,t){for(const t of e.get("attributes")){if(!t.isJSXElement())continue;const{name:r}=t.node.name;if(r==="__source"||r==="__self"){throw e.buildCodeFrameError(`__source and __self should not be defined in props and are reserved for internal usage.`)}}const r=n.types.jsxAttribute(n.types.jsxIdentifier("__self"),n.types.jsxExpressionContainer(n.types.thisExpression()));const s=n.types.jsxAttribute(n.types.jsxIdentifier("__source"),n.types.jsxExpressionContainer(makeSource(e,t)));e.pushContainer("attributes",[r,s])}};return{name:e,inherits:s.default,visitor:{JSXNamespacedName(e){if(d){throw e.buildCodeFrameError(`Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can set \`throwIfNamespace: false\` to bypass this warning.`)}},JSXSpreadChild(e){throw e.buildCodeFrameError("Spread children are not supported in React.")},Program:{enter(e,r){const{file:s}=r;let o=y;let i=g;let d=h;let m=b;let x=!!a.importSource;let v=!!a.pragma;let j=!!a.pragmaFrag;if(s.ast.comments){for(const e of s.ast.comments){const t=c.exec(e.value);if(t){i=t[1];x=true}const r=u.exec(e.value);if(r){o=r[1]}const s=p.exec(e.value);if(s){d=s[1];v=true}const a=f.exec(e.value);if(a){m=a[1];j=true}}}set(r,"runtime",o);if(o==="classic"){if(x){throw e.buildCodeFrameError(`importSource cannot be set when runtime is classic.`)}const t=toMemberExpression(d);const s=toMemberExpression(m);set(r,"id/createElement",(()=>n.types.cloneNode(t)));set(r,"id/fragment",(()=>n.types.cloneNode(s)));set(r,"defaultPure",d===l.pragma)}else if(o==="automatic"){if(v||j){throw e.buildCodeFrameError(`pragma and pragmaFrag cannot be set when runtime is automatic.`)}const define=(t,s)=>set(r,t,createImportLazily(r,e,s,i));define("id/jsx",t?"jsxDEV":"jsx");define("id/jsxs",t?"jsxDEV":"jsxs");define("id/createElement","createElement");define("id/fragment","Fragment");set(r,"defaultPure",i===l.importSource)}else{throw e.buildCodeFrameError(`Runtime must be either "classic" or "automatic".`)}if(t){e.traverse(E,r)}}},JSXElement:{exit(e,t){let r;if(get(t,"runtime")==="classic"||shouldUseCreateElement(e)){r=buildCreateElementCall(e,t)}else{r=buildJSXElementCall(e,t)}e.replaceWith(n.types.inherits(r,e.node))}},JSXFragment:{exit(e,t){let r;if(get(t,"runtime")==="classic"){r=buildCreateElementFragmentCall(e,t)}else{r=buildJSXFragmentCall(e,t)}e.replaceWith(n.types.inherits(r,e.node))}},JSXAttribute(e){if(n.types.isJSXElement(e.node.value)){e.node.value=n.types.jsxExpressionContainer(e.node.value)}}}};function call(e,t,r){const s=n.types.callExpression(get(e,`id/${t}`)(),r);if(o!=null?o:get(e,"defaultPure"))(0,i.default)(s);return s}function shouldUseCreateElement(e){const t=e.get("openingElement");const r=t.node.attributes;let s=false;for(let e=0;e1){t=n.types.arrayExpression(e)}else{return undefined}return n.types.objectProperty(n.types.identifier("children"),t)}function buildJSXElementCall(e,r){const s=e.get("openingElement");const a=[getTag(s)];const o=[];const i=Object.create(null);for(const t of s.get("attributes")){if(t.isJSXAttribute()&&n.types.isJSXIdentifier(t.node.name)){const{name:r}=t.node.name;switch(r){case"__source":case"__self":if(i[r])throw sourceSelfError(e,r);case"key":{const e=convertAttributeValue(t.node.value);if(e===null){throw t.buildCodeFrameError('Please provide an explicit key value. Using "key" as a shorthand for "key={true}" is not allowed.')}i[r]=e;break}default:o.push(t)}}else{o.push(t)}}const l=n.types.react.buildChildren(e.node);let c;if(o.length||l.length){c=buildJSXOpeningElementAttributes(o,r,l)}else{c=n.types.objectExpression([])}a.push(c);if(t){var u,p,f;a.push((u=i.key)!=null?u:e.scope.buildUndefinedNode(),n.types.booleanLiteral(l.length>1),(p=i.__source)!=null?p:e.scope.buildUndefinedNode(),(f=i.__self)!=null?f:n.types.thisExpression())}else if(i.key!==undefined){a.push(i.key)}return call(r,l.length>1?"jsxs":"jsx",a)}function buildJSXOpeningElementAttributes(e,t,r){const s=e.reduce(accumulateAttribute,[]);if((r==null?void 0:r.length)>0){s.push(buildChildrenProperty(r))}return n.types.objectExpression(s)}function buildJSXFragmentCall(e,r){const s=[get(r,"id/fragment")()];const a=n.types.react.buildChildren(e.node);s.push(n.types.objectExpression(a.length>0?[buildChildrenProperty(a)]:[]));if(t){s.push(e.scope.buildUndefinedNode(),n.types.booleanLiteral(a.length>1))}return call(r,a.length>1?"jsxs":"jsx",s)}function buildCreateElementFragmentCall(e,t){if(m&&!m(e.node,t))return;return call(t,"createElement",[get(t,"id/fragment")(),n.types.nullLiteral(),...n.types.react.buildChildren(e.node)])}function buildCreateElementCall(e,t){const r=e.get("openingElement");return call(t,"createElement",[getTag(r),buildCreateElementOpeningElementAttributes(t,e,r.get("attributes")),...n.types.react.buildChildren(e.node)])}function getTag(e){const t=convertJSXIdentifier(e.node.name,e.node);let r;if(n.types.isIdentifier(t)){r=t.name}else if(n.types.isLiteral(t)){r=t.value}if(n.types.react.isCompatTag(r)){return n.types.stringLiteral(r)}else{return t}}function buildCreateElementOpeningElementAttributes(e,t,r){const s=get(e,"runtime");{if(s!=="automatic"){const t=[];const s=r.reduce(accumulateAttribute,[]);if(!x){let e=0;s.forEach(((r,a)=>{if(n.types.isSpreadElement(r)){if(a>e){t.push(n.types.objectExpression(s.slice(e,a)))}t.push(r.argument);e=a+1}}));if(s.length>e){t.push(n.types.objectExpression(s.slice(e)))}}else if(s.length){t.push(n.types.objectExpression(s))}if(!t.length){return n.types.nullLiteral()}if(t.length===1){return t[0]}if(!n.types.isObjectExpression(t[0])){t.unshift(n.types.objectExpression([]))}const a=v?n.types.memberExpression(n.types.identifier("Object"),n.types.identifier("assign")):e.addHelper("extends");return n.types.callExpression(a,t)}}const a=[];const o=Object.create(null);for(const e of r){const r=n.types.isJSXAttribute(e)&&n.types.isJSXIdentifier(e.name)&&e.name.name;if(s==="automatic"&&(r==="__source"||r==="__self")){if(o[r])throw sourceSelfError(t,r);o[r]=true}accumulateAttribute(a,e)}return a.length===1&&n.types.isSpreadElement(a[0])?a[0].argument:a.length>0?n.types.objectExpression(a):n.types.nullLiteral()}}));function getSource(e,r){switch(r){case"Fragment":return`${e}/${t?"jsx-dev-runtime":"jsx-runtime"}`;case"jsxDEV":return`${e}/jsx-dev-runtime`;case"jsx":case"jsxs":return`${e}/jsx-runtime`;case"createElement":return e}}function createImportLazily(e,t,r,s){return()=>{const a=getSource(s,r);if((0,o.isModule)(t)){let s=get(e,`imports/${r}`);if(s)return n.types.cloneNode(s);s=(0,o.addNamed)(t,r,a,{importedInterop:"uncompiled",importPosition:"after"});set(e,`imports/${r}`,s);return s}else{let s=get(e,`requires/${a}`);if(s){s=n.types.cloneNode(s)}else{s=(0,o.addNamespace)(t,a,{importedInterop:"uncompiled"});set(e,`requires/${a}`,s)}return n.types.memberExpression(s,n.types.identifier(r))}}}}function toMemberExpression(e){return e.split(".").map((e=>n.types.identifier(e))).reduce(((e,t)=>n.types.memberExpression(e,t)))}function makeSource(e,t){const r=e.node.loc;if(!r){return e.scope.buildUndefinedNode()}if(!t.fileNameIdentifier){const{filename:r=""}=t;const s=e.scope.generateUidIdentifier("_jsxFileName");const a=e.hub.getScope();if(a){a.push({id:s,init:n.types.stringLiteral(r)})}t.fileNameIdentifier=s}return makeTrace(n.types.cloneNode(t.fileNameIdentifier),r.start.line,r.start.column)}function makeTrace(e,t,r){const s=t!=null?n.types.numericLiteral(t):n.types.nullLiteral();const a=r!=null?n.types.numericLiteral(r+1):n.types.nullLiteral();const o=n.types.objectProperty(n.types.identifier("fileName"),e);const i=n.types.objectProperty(n.types.identifier("lineNumber"),s);const l=n.types.objectProperty(n.types.identifier("columnNumber"),a);return n.types.objectExpression([o,i,l])}function sourceSelfError(e,t){const r=`transform-react-jsx-${t.slice(2)}`;return e.buildCodeFrameError(`Duplicate ${t} prop found. You are most likely using the deprecated ${r} Babel plugin. Both __source and __self are automatically set when using the automatic runtime. Please remove transform-react-jsx-source and transform-react-jsx-self from your Babel config.`)}},7420:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(7005);var a=(0,s.default)({name:"transform-react-jsx",development:false});t["default"]=a},6919:e=>{function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}e.exports=_interopRequireDefault},449:(e,t,r)=>{var s=r(2810);function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function _getRequireWildcardCache(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||s(e)!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e){if(Object.prototype.hasOwnProperty.call(e,n)){var o=a?Object.getOwnPropertyDescriptor(e,n):null;if(o&&(o.get||o.set)){Object.defineProperty(r,n,o)}else{r[n]=e[n]}}}r["default"]=e;if(t){t.set(e,r)}return r}e.exports=_interopRequireWildcard},2810:e=>{function _typeof(t){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){e.exports=_typeof=function _typeof(e){return typeof e}}else{e.exports=_typeof=function _typeof(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}}return _typeof(t)}e.exports=_typeof},4309:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=createTemplateBuilder;var s=r(4578);var a=r(351);var n=r(5932);const o=(0,s.validate)({placeholderPattern:false});function createTemplateBuilder(e,t){const r=new WeakMap;const i=new WeakMap;const l=t||(0,s.validate)(null);return Object.assign(((t,...o)=>{if(typeof t==="string"){if(o.length>1)throw new Error("Unexpected extra params.");return extendedTrace((0,a.default)(e,t,(0,s.merge)(l,(0,s.validate)(o[0]))))}else if(Array.isArray(t)){let s=r.get(t);if(!s){s=(0,n.default)(e,t,l);r.set(t,s)}return extendedTrace(s(o))}else if(typeof t==="object"&&t){if(o.length>0)throw new Error("Unexpected extra params.");return createTemplateBuilder(e,(0,s.merge)(l,(0,s.validate)(t)))}throw new Error(`Unexpected template param ${typeof t}`)}),{ast:(t,...r)=>{if(typeof t==="string"){if(r.length>1)throw new Error("Unexpected extra params.");return(0,a.default)(e,t,(0,s.merge)((0,s.merge)(l,(0,s.validate)(r[0])),o))()}else if(Array.isArray(t)){let a=i.get(t);if(!a){a=(0,n.default)(e,t,(0,s.merge)(l,o));i.set(t,a)}return a(r)()}throw new Error(`Unexpected template param ${typeof t}`)}})}function extendedTrace(e){let t="";try{throw new Error}catch(e){if(e.stack){t=e.stack.split("\n").slice(3).join("\n")}}return r=>{try{return e(r)}catch(e){e.stack+=`\n =============\n${t}`;throw e}}}},7522:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.program=t.expression=t.statement=t.statements=t.smart=void 0;var s=r(8622);function makeStatementFormatter(e){return{code:e=>`/* @babel/template */;\n${e}`,validate:()=>{},unwrap:t=>e(t.program.body.slice(1))}}const a=makeStatementFormatter((e=>{if(e.length>1){return e}else{return e[0]}}));t.smart=a;const n=makeStatementFormatter((e=>e));t.statements=n;const o=makeStatementFormatter((e=>{if(e.length===0){throw new Error("Found nothing to return.")}if(e.length>1){throw new Error("Found multiple statements but wanted one")}return e[0]}));t.statement=o;const i={code:e=>`(\n${e}\n)`,validate:e=>{if(e.program.body.length>1){throw new Error("Found multiple statements but wanted one")}if(i.unwrap(e).start===0){throw new Error("Parse result included parens.")}},unwrap:({program:e})=>{const[t]=e.body;s.assertExpressionStatement(t);return t.expression}};t.expression=i;const l={code:e=>e,validate:()=>{},unwrap:e=>e.program};t.program=l},153:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=t.program=t.expression=t.statements=t.statement=t.smart=void 0;var s=r(7522);var a=r(4309);const n=(0,a.default)(s.smart);t.smart=n;const o=(0,a.default)(s.statement);t.statement=o;const i=(0,a.default)(s.statements);t.statements=i;const l=(0,a.default)(s.expression);t.expression=l;const c=(0,a.default)(s.program);t.program=c;var u=Object.assign(n.bind(undefined),{smart:n,statement:o,statements:i,expression:l,program:c,ast:n.ast});t["default"]=u},5932:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=literalTemplate;var s=r(4578);var a=r(8502);var n=r(7635);function literalTemplate(e,t,r){const{metadata:a,names:o}=buildLiteralData(e,t,r);return t=>{const r={};t.forEach(((e,t)=>{r[o[t]]=e}));return t=>{const o=(0,s.normalizeReplacements)(t);if(o){Object.keys(o).forEach((e=>{if(Object.prototype.hasOwnProperty.call(r,e)){throw new Error("Unexpected replacement overlap.")}}))}return e.unwrap((0,n.default)(a,o?Object.assign(o,r):r))}}}function buildLiteralData(e,t,r){let s;let n;let o;let i="";do{i+="$";const l=buildTemplateCode(t,i);s=l.names;n=new Set(s);o=(0,a.default)(e,e.code(l.code),{parser:r.parser,placeholderWhitelist:new Set(l.names.concat(r.placeholderWhitelist?Array.from(r.placeholderWhitelist):[])),placeholderPattern:r.placeholderPattern,preserveComments:r.preserveComments,syntacticPlaceholders:r.syntacticPlaceholders})}while(o.placeholders.some((e=>e.isDuplicate&&n.has(e.name))));return{metadata:o,names:s}}function buildTemplateCode(e,t){const r=[];let s=e[0];for(let a=1;a{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.merge=merge;t.validate=validate;t.normalizeReplacements=normalizeReplacements;function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var r={};var s=Object.keys(e);var a,n;for(n=0;n=0)continue;r[a]=e[a]}return r}function merge(e,t){const{placeholderWhitelist:r=e.placeholderWhitelist,placeholderPattern:s=e.placeholderPattern,preserveComments:a=e.preserveComments,syntacticPlaceholders:n=e.syntacticPlaceholders}=t;return{parser:Object.assign({},e.parser,t.parser),placeholderWhitelist:r,placeholderPattern:s,preserveComments:a,syntacticPlaceholders:n}}function validate(e){if(e!=null&&typeof e!=="object"){throw new Error("Unknown template options.")}const t=e||{},{placeholderWhitelist:r,placeholderPattern:s,preserveComments:a,syntacticPlaceholders:n}=t,o=_objectWithoutPropertiesLoose(t,["placeholderWhitelist","placeholderPattern","preserveComments","syntacticPlaceholders"]);if(r!=null&&!(r instanceof Set)){throw new Error("'.placeholderWhitelist' must be a Set, null, or undefined")}if(s!=null&&!(s instanceof RegExp)&&s!==false){throw new Error("'.placeholderPattern' must be a RegExp, false, null, or undefined")}if(a!=null&&typeof a!=="boolean"){throw new Error("'.preserveComments' must be a boolean, null, or undefined")}if(n!=null&&typeof n!=="boolean"){throw new Error("'.syntacticPlaceholders' must be a boolean, null, or undefined")}if(n===true&&(r!=null||s!=null)){throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible"+" with '.syntacticPlaceholders: true'")}return{parser:o,placeholderWhitelist:r||undefined,placeholderPattern:s==null?undefined:s,preserveComments:a==null?undefined:a,syntacticPlaceholders:n==null?undefined:n}}function normalizeReplacements(e){if(Array.isArray(e)){return e.reduce(((e,t,r)=>{e["$"+r]=t;return e}),{})}else if(typeof e==="object"||e==null){return e||undefined}throw new Error("Template replacements must be an array, object, null, or undefined")}},8502:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=parseAndBuildMetadata;var s=r(8622);var a=r(6949);var n=r(5694);const o=/^[_$A-Z0-9]+$/;function parseAndBuildMetadata(e,t,r){const{placeholderWhitelist:a,placeholderPattern:n,preserveComments:o,syntacticPlaceholders:i}=r;const l=parseWithCodeFrame(t,r.parser,i);s.removePropertiesDeep(l,{preserveComments:o});e.validate(l);const c={placeholders:[],placeholderNames:new Set};const u={placeholders:[],placeholderNames:new Set};const p={value:undefined};s.traverse(l,placeholderVisitorHandler,{syntactic:c,legacy:u,isLegacyRef:p,placeholderWhitelist:a,placeholderPattern:n,syntacticPlaceholders:i});return Object.assign({ast:l},p.value?u:c)}function placeholderVisitorHandler(e,t,r){var a;let n;if(s.isPlaceholder(e)){if(r.syntacticPlaceholders===false){throw new Error("%%foo%%-style placeholders can't be used when "+"'.syntacticPlaceholders' is false.")}else{n=e.name.name;r.isLegacyRef.value=false}}else if(r.isLegacyRef.value===false||r.syntacticPlaceholders){return}else if(s.isIdentifier(e)||s.isJSXIdentifier(e)){n=e.name;r.isLegacyRef.value=true}else if(s.isStringLiteral(e)){n=e.value;r.isLegacyRef.value=true}else{return}if(!r.isLegacyRef.value&&(r.placeholderPattern!=null||r.placeholderWhitelist!=null)){throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible"+" with '.syntacticPlaceholders: true'")}if(r.isLegacyRef.value&&(r.placeholderPattern===false||!(r.placeholderPattern||o).test(n))&&!((a=r.placeholderWhitelist)!=null&&a.has(n))){return}t=t.slice();const{node:i,key:l}=t[t.length-1];let c;if(s.isStringLiteral(e)||s.isPlaceholder(e,{expectedNode:"StringLiteral"})){c="string"}else if(s.isNewExpression(i)&&l==="arguments"||s.isCallExpression(i)&&l==="arguments"||s.isFunction(i)&&l==="params"){c="param"}else if(s.isExpressionStatement(i)&&!s.isPlaceholder(e)){c="statement";t=t.slice(0,-1)}else if(s.isStatement(e)&&s.isPlaceholder(e)){c="statement"}else{c="other"}const{placeholders:u,placeholderNames:p}=r.isLegacyRef.value?r.legacy:r.syntactic;u.push({name:n,type:c,resolve:e=>resolveAncestors(e,t),isDuplicate:p.has(n)});p.add(n)}function resolveAncestors(e,t){let r=e;for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=populatePlaceholders;var s=r(8622);function populatePlaceholders(e,t){const r=s.cloneNode(e.ast);if(t){e.placeholders.forEach((e=>{if(!Object.prototype.hasOwnProperty.call(t,e.name)){const t=e.name;throw new Error(`Error: No substitution given for "${t}". If this is not meant to be a\n placeholder you may want to consider passing one of the following options to @babel/template:\n - { placeholderPattern: false, placeholderWhitelist: new Set(['${t}'])}\n - { placeholderPattern: /^${t}$/ }`)}}));Object.keys(t).forEach((t=>{if(!e.placeholderNames.has(t)){throw new Error(`Unknown substitution "${t}" given`)}}))}e.placeholders.slice().reverse().forEach((e=>{try{applyReplacement(e,r,t&&t[e.name]||null)}catch(t){t.message=`@babel/template placeholder "${e.name}": ${t.message}`;throw t}}));return r}function applyReplacement(e,t,r){if(e.isDuplicate){if(Array.isArray(r)){r=r.map((e=>s.cloneNode(e)))}else if(typeof r==="object"){r=s.cloneNode(r)}}const{parent:a,key:n,index:o}=e.resolve(t);if(e.type==="string"){if(typeof r==="string"){r=s.stringLiteral(r)}if(!r||!s.isStringLiteral(r)){throw new Error("Expected string substitution")}}else if(e.type==="statement"){if(o===undefined){if(!r){r=s.emptyStatement()}else if(Array.isArray(r)){r=s.blockStatement(r)}else if(typeof r==="string"){r=s.expressionStatement(s.identifier(r))}else if(!s.isStatement(r)){r=s.expressionStatement(r)}}else{if(r&&!Array.isArray(r)){if(typeof r==="string"){r=s.identifier(r)}if(!s.isStatement(r)){r=s.expressionStatement(r)}}}}else if(e.type==="param"){if(typeof r==="string"){r=s.identifier(r)}if(o===undefined)throw new Error("Assertion failure.")}else{if(typeof r==="string"){r=s.identifier(r)}if(Array.isArray(r)){throw new Error("Cannot replace single expression with an array.")}}if(o===undefined){s.validate(a,n,r);a[n]=r}else{const t=a[n].slice();if(e.type==="statement"||e.type==="param"){if(r==null){t.splice(o,1)}else if(Array.isArray(r)){t.splice(o,1,...r)}else{t[o]=r}}else{t[o]=r}s.validate(a,n,t);a[n]=t}}},351:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=stringTemplate;var s=r(4578);var a=r(8502);var n=r(7635);function stringTemplate(e,t,r){t=e.code(t);let o;return i=>{const l=(0,s.normalizeReplacements)(i);if(!o)o=(0,a.default)(e,t,r);return e.unwrap((0,n.default)(o,l))}}},5694:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.codeFrameColumns=codeFrameColumns;t["default"]=_default;var s=r(2032);let a=false;function getDefs(e){return{gutter:e.grey,marker:e.red.bold,message:e.red.bold}}const n=/\r\n|[\n\r\u2028\u2029]/;function getMarkerLines(e,t,r){const s=Object.assign({column:0,line:-1},e.start);const a=Object.assign({},s,e.end);const{linesAbove:n=2,linesBelow:o=3}=r||{};const i=s.line;const l=s.column;const c=a.line;const u=a.column;let p=Math.max(i-(n+1),0);let f=Math.min(t.length,c+o);if(i===-1){p=0}if(c===-1){f=t.length}const d=c-i;const m={};if(d){for(let e=0;e<=d;e++){const r=e+i;if(!l){m[r]=true}else if(e===0){const e=t[r-1].length;m[r]=[l,e-l+1]}else if(e===d){m[r]=[0,u]}else{const s=t[r-e].length;m[r]=[0,s]}}}else{if(l===u){if(l){m[i]=[l,0]}else{m[i]=true}}else{m[i]=[l,u-l]}}return{start:p,end:f,markerLines:m}}function codeFrameColumns(e,t,r={}){const a=(r.highlightCode||r.forceColor)&&(0,s.shouldHighlight)(r);const o=(0,s.getChalk)(r);const i=getDefs(o);const maybeHighlight=(e,t)=>a?e(t):t;const l=e.split(n);const{start:c,end:u,markerLines:p}=getMarkerLines(t,l,r);const f=t.start&&typeof t.start.column==="number";const d=String(u).length;const m=a?(0,s.default)(e,r):e;let y=m.split(n).slice(c,u).map(((e,t)=>{const s=c+1+t;const a=` ${s}`.slice(-d);const n=` ${a} |`;const o=p[s];const l=!p[s+1];if(o){let t="";if(Array.isArray(o)){const s=e.slice(0,Math.max(o[0]-1,0)).replace(/[^\t]/g," ");const a=o[1]||1;t=["\n ",maybeHighlight(i.gutter,n.replace(/\d/g," "))," ",s,maybeHighlight(i.marker,"^").repeat(a)].join("");if(l&&r.message){t+=" "+maybeHighlight(i.message,r.message)}}return[maybeHighlight(i.marker,">"),maybeHighlight(i.gutter,n),e.length>0?` ${e}`:"",t].join("")}else{return` ${maybeHighlight(i.gutter,n)}${e.length>0?` ${e}`:""}`}})).join("\n");if(r.message&&!f){y=`${" ".repeat(d+1)}${r.message}\n${y}`}if(a){return o.reset(y)}else{return y}}function _default(e,t,r,s={}){if(!a){a=true;const e="Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";if(process.emitWarning){process.emitWarning(e,"DeprecationWarning")}else{const t=new Error(e);t.name="DeprecationWarning";console.warn(new Error(e))}}r=Math.max(r,0);const n={start:{column:r,line:t}};return codeFrameColumns(e,n,s)}},5002:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isIdentifierStart=isIdentifierStart;t.isIdentifierChar=isIdentifierChar;t.isIdentifierName=isIdentifierName;let r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const a=new RegExp("["+r+"]");const n=new RegExp("["+r+s+"]");r=s=null;const o=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];const i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let r=65536;for(let s=0,a=t.length;se)return false;r+=t[s+1];if(r>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&a.test(String.fromCharCode(e))}return isInAstralSet(e,o)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&n.test(String.fromCharCode(e))}return isInAstralSet(e,o)||isInAstralSet(e,i)}function isIdentifierName(e){let t=true;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"isIdentifierName",{enumerable:true,get:function(){return s.isIdentifierName}});Object.defineProperty(t,"isIdentifierChar",{enumerable:true,get:function(){return s.isIdentifierChar}});Object.defineProperty(t,"isIdentifierStart",{enumerable:true,get:function(){return s.isIdentifierStart}});Object.defineProperty(t,"isReservedWord",{enumerable:true,get:function(){return a.isReservedWord}});Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:true,get:function(){return a.isStrictBindOnlyReservedWord}});Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:true,get:function(){return a.isStrictBindReservedWord}});Object.defineProperty(t,"isStrictReservedWord",{enumerable:true,get:function(){return a.isStrictReservedWord}});Object.defineProperty(t,"isKeyword",{enumerable:true,get:function(){return a.isKeyword}});var s=r(5002);var a=r(7169)},7169:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isReservedWord=isReservedWord;t.isStrictReservedWord=isStrictReservedWord;t.isStrictBindOnlyReservedWord=isStrictBindOnlyReservedWord;t.isStrictBindReservedWord=isStrictBindReservedWord;t.isKeyword=isKeyword;const r={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const s=new Set(r.keyword);const a=new Set(r.strict);const n=new Set(r.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||a.has(e)}function isStrictBindOnlyReservedWord(e){return n.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return s.has(e)}},2032:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.shouldHighlight=shouldHighlight;t.getChalk=getChalk;t["default"]=highlight;var s=r(8035);var a=r(347);var n=r(8542);const o=new Set(["as","async","from","get","of","set"]);function getDefs(e){return{keyword:e.cyan,capitalized:e.yellow,jsxIdentifier:e.yellow,punctuator:e.yellow,number:e.magenta,string:e.green,regex:e.magenta,comment:e.grey,invalid:e.white.bgRed.bold}}const i=/\r\n|[\n\r\u2028\u2029]/;const l=/^[()[\]{}]$/;let c;{const e=/^[a-z][\w-]*$/i;const getTokenType=function(t,r,s){if(t.type==="name"){if((0,a.isKeyword)(t.value)||(0,a.isStrictReservedWord)(t.value,true)||o.has(t.value)){return"keyword"}if(e.test(t.value)&&(s[r-1]==="<"||s.substr(r-2,2)=="t(e))).join("\n")}else{r+=a}}return r}function shouldHighlight(e){return!!n.supportsColor||e.forceColor}function getChalk(e){return e.forceColor?new n.constructor({enabled:true,level:1}):n}function highlight(e,t={}){if(shouldHighlight(t)){const r=getChalk(t);const s=getDefs(r);return highlightTokens(s,e)}else{return e}}},8716:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var r=function(){function sliceIterator(e,t){var r=[];var s=true;var a=false;var n=undefined;try{for(var o=e[Symbol.iterator](),i;!(s=(i=o.next()).done);s=true){r.push(i.value);if(t&&r.length===t)break}}catch(e){a=true;n=e}finally{try{if(!s&&o["return"])o["return"]()}finally{if(a)throw n}}return r}return function(e,t){if(Array.isArray(e)){return e}else if(Symbol.iterator in Object(e)){return sliceIterator(e,t)}else{throw new TypeError("Invalid attempt to destructure non-iterable instance")}}}();t.getImportSource=getImportSource;t.createDynamicImportTransform=createDynamicImportTransform;function getImportSource(e,t){var s=t.arguments;var a=r(s,1),n=a[0];var o=e.isStringLiteral(n)||e.isTemplateLiteral(n);if(o){e.removeComments(n);return n}return e.templateLiteral([e.templateElement({raw:"",cooked:""}),e.templateElement({raw:"",cooked:""},true)],s)}function createDynamicImportTransform(e){var t=e.template,r=e.types;var s={static:{interop:t("Promise.resolve().then(() => INTEROP(require(SOURCE)))"),noInterop:t("Promise.resolve().then(() => require(SOURCE))")},dynamic:{interop:t("Promise.resolve(SOURCE).then(s => INTEROP(require(s)))"),noInterop:t("Promise.resolve(SOURCE).then(s => require(s))")}};var a=typeof WeakSet==="function"&&new WeakSet;var n=function isString(e){return r.isStringLiteral(e)||r.isTemplateLiteral(e)&&e.expressions.length===0};return function(e,t){if(a){if(a.has(t)){return}a.add(t)}var o=getImportSource(r,t.parent);var i=n(o)?s["static"]:s.dynamic;var l=e.opts.noInterop?i.noInterop({SOURCE:o}):i.interop({SOURCE:o,INTEROP:e.addHelper("interopRequireWildcard")});t.parentPath.replaceWith(l)}}},7047:(e,t,r)=>{e.exports=r(8716)},9065:(e,t,r)=>{"use strict";const s=r(1603);const{get:a,has:n,find:o}=r(8018);const getSortedObjectPaths=e=>{if(!e){return[]}return s(e).paths().filter((e=>e.length)).map((e=>e.join("."))).sort(((e,t)=>t.length-e.length))};const replaceAndEvaluateNode=(e,t,r)=>{t.replaceWith(e(r));if(t.parentPath.isBinaryExpression()){const r=t.parentPath.evaluate();if(r.confident){t.parentPath.replaceWith(e(r.value))}}};const processNode=(e,t,r,s)=>{const i=o(getSortedObjectPaths(e),(e=>s(t,e)));if(n(e,i)){replaceAndEvaluateNode(r,t,a(e,i))}};const memberExpressionComparator=(e,t)=>e.matchesPattern(t);const identifierComparator=(e,t)=>e.node.name===t;const unaryExpressionComparator=(e,t)=>e.node.argument.name===t;const i="typeof ";const plugin=function({types:e}){return{visitor:{MemberExpression(t,r){processNode(r.opts,t,e.valueToNode,memberExpressionComparator)},Identifier(t,r){processNode(r.opts,t,e.valueToNode,identifierComparator)},UnaryExpression(t,r){if(t.node.operator!=="typeof"){return}const{opts:s}=r;const a=Object.keys(s);const n={};a.forEach((e=>{if(e.substring(0,i.length)===i){n[e.substring(i.length)]=s[e]}}));processNode(n,t,e.valueToNode,unaryExpressionComparator)}}}};e.exports=plugin;e.exports["default"]=plugin;e.exports.getSortedObjectPaths=getSortedObjectPaths},6197:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=_interopRequireDefault(r(7835));var a=_interopRequireDefault(r(4640));var n=_interopRequireDefault(r(346));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectSpread(e){for(var t=1;t1&&arguments[1]!==undefined?arguments[1]:{};var o=n.as,i=o===void 0?"assignmentExpression":o;var l=t.expression('\n process.env.NODE_ENV !== "production" ? RIGHT : {}\n ',{placeholderPattern:/^(LEFT|RIGHT)$/})({RIGHT:a});switch(i){case"variableDeclarator":return r.variableDeclarator(s,l);case"assignmentExpression":return r.assignmentExpression("=",s,l);default:throw new Error("unrecognized template type ".concat(i))}},mode:p.opts.mode||"remove",ignoreFilenames:f,types:r,removeImport:p.opts.removeImport||false,libraries:(p.opts.additionalLibraries||[]).concat("prop-types"),classNameMatchers:d,createReactClassName:p.opts.createReactClassName||"createReactClass"};if(p.opts.plugins){var y=p;var g=p.opts.plugins.map((function(t){var r=typeof t==="string"?t:t[0];if(typeof t!=="string"){y.opts=_objectSpread({},y.opts,t[1])}var s=require(r);if(typeof s!=="function"){s=s.default}return s(e).visitor}));o(u.parent,o.visitors.merge(g),u.scope,y,u.parentPath)}u.traverse({ObjectProperty:{exit:function exit(e){var t=e.node;if(t.computed||t.key.name!=="propTypes"){return}var r=e.findParent((function(e){if(e.type!=="CallExpression"){return false}return e.get("callee").node.name===m.createReactClassName||e.get("callee").node.property&&e.get("callee").node.property.name==="createClass"}));if(r){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"createClass"})}}},ClassProperty:function ClassProperty(e){var t=e.node,r=e.scope;if(t.key.name==="propTypes"){var s=r.path;if(isReactClass(s.get("superClass"),r,m)){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"class static",pathClassDeclaration:s})}}},AssignmentExpression:function AssignmentExpression(e){var t=e.node,r=e.scope;if(t.left.computed||!t.left.property||t.left.property.name!=="propTypes"){return}var o=(0,s.default)(e.node.left);if(o){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"assign"});return}var i=t.left.object.name;var u=r.getBinding(i);if(!u){return}if(u.path.isClassDeclaration()){var p=u.path.get("superClass");if(isReactClass(p,r,m)){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"assign"})}}else if((0,a.default)(u.path)){e.traverse(c);l.add(e);(0,n.default)(e,m,{type:"assign"})}}});var h=0;var b={VariableDeclarator:function VariableDeclarator(e){if(e.scope.block.type!=="Program"){return}if(["ObjectPattern","ArrayPattern"].includes(e.node.id.type)){return}var t=e.node.id.name;if(!i.has(t)){return}var r=e.scope.getBinding(t),s=r.referencePaths;var a=s.some((function(e){var t=e.find((function(e){return l.has(e)}));return!t}));if(a){h+=1;return}l.add(e);i.delete(t);e.get("init").traverse(c);(0,n.default)(e,m,{type:"declarator"})}};var x=new Set;while(!areSetsEqual(i,x)&&i.size>0&&h0}));if(!n){e.remove()}}})}else{throw new Error('transform-react-remove-prop-type: removeImport = true and mode != "remove" can not be used at the same time.')}}}}}}},7835:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=isAnnotatedForRemoval;function isAnnotatedForRemoval(e){var t=e.trailingComments||[];return Boolean(t.find((function(e){var t=e.value;return t.trim()==="remove-proptypes"})))}},4640:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=isStatelessComponent;var r=Symbol("traversed");function isJSXElementOrReactCreateElement(e){var t=false;e.traverse({CallExpression:function CallExpression(e){var r=e.get("callee");if(r.matchesPattern("React.createElement")||r.matchesPattern("React.cloneElement")||r.node.name==="cloneElement"){t=true}},JSXElement:function JSXElement(){t=true}});return t}function isReturningJSXElement(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(e.node.init&&e.node.init.body&&isJSXElementOrReactCreateElement(e)){return true}if(t>20){throw new Error("transform-react-remove-prop-type: infinite loop detected.")}var s=false;e.traverse({ReturnStatement:function ReturnStatement(a){if(s){return}var n=a.get("argument");if(!n.node){return}if(isJSXElementOrReactCreateElement(a)){s=true;return}if(n.node.type==="CallExpression"){var o=n.get("callee").node.name;var i=e.scope.getBinding(o);if(!i){return}if(i.path[r]){return}i.path[r]=true;if(isReturningJSXElement(i.path,t+1)){s=true}}}});return s}var s=["VariableDeclarator","FunctionDeclaration"];function isStatelessComponent(e){if(s.indexOf(e.node.type)===-1){return false}if(isReturningJSXElement(e)){return true}return false}},346:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=remove;function isInside(e,t){if(!e.hub.file.opts){return true}var r=e.hub.file.opts.filename;if(!r){return true}if(!t){return false}return t.test(r)}function remove(e,t,r){var s=t.visitedKey,a=t.unsafeWrapTemplate,n=t.wrapTemplate,o=t.mode,i=t.ignoreFilenames,l=t.types;if(i&&isInside(e.scope,i)){return}if(e.node[s]){return}e.node[s]=true;if(o==="remove"){if(e.parentPath.type==="ConditionalExpression"){e.replaceWith(l.unaryExpression("void",l.numericLiteral(0)))}else{e.remove()}return}if(o==="wrap"||o==="unsafe-wrap"){switch(r.type){case"createClass":break;case"class static":{var c;var u=r.pathClassDeclaration;if(!u.isClassExpression()&&u.node.id){c=u.node.id}else{return}var p=l.expressionStatement(l.assignmentExpression("=",l.memberExpression(c,e.node.key),e.node.value));if(u.parentPath.isExportDeclaration()){u=u.parentPath}u.insertAfter(p);e.remove();break}case"assign":if(o==="unsafe-wrap"){e.replaceWith(a({NODE:e.node}))}else{e.replaceWith(n({LEFT:e.node.left,RIGHT:e.node.right}))}e.node[s]=true;break;case"declarator":e.replaceWith(n({LEFT:e.node.id,RIGHT:e.node.init},{as:"variableDeclarator"}));e.node[s]=true;break;default:break}return}throw new Error("transform-react-remove-prop-type: unsupported mode ".concat(o,"."))}},665:(e,t,r)=>{"use strict";const s=r(2971);class Definition{constructor(e,t,r,s,a,n){this.type=e;this.name=t;this.node=r;this.parent=s;this.index=a;this.kind=n}}class ParameterDefinition extends Definition{constructor(e,t,r,a){super(s.Parameter,e,t,null,r,null);this.rest=a}}e.exports={ParameterDefinition:ParameterDefinition,Definition:Definition}},6007:(e,t,r)=>{"use strict";const s=r(9491);const a=r(6988);const n=r(4585);const o=r(4945);const i=r(2971);const l=r(6313).Scope;const c=r(290).i8;function defaultOptions(){return{optimistic:false,directive:false,nodejsScope:false,impliedStrict:false,sourceType:"script",ecmaVersion:5,childVisitorKeys:null,fallback:"iteration"}}function updateDeeply(e,t){function isHashObject(e){return typeof e==="object"&&e instanceof Object&&!(e instanceof Array)&&!(e instanceof RegExp)}for(const r in t){if(Object.prototype.hasOwnProperty.call(t,r)){const s=t[r];if(isHashObject(s)){if(isHashObject(e[r])){updateDeeply(e[r],s)}else{e[r]=updateDeeply({},s)}}else{e[r]=s}}}return e}function analyze(e,t){const r=updateDeeply(defaultOptions(),t);const o=new a(r);const i=new n(r,o);i.visit(e);s(o.__currentScope===null,"currentScope should be null.");return o}e.exports={version:c,Reference:o,Variable:i,Scope:l,ScopeManager:a,analyze:analyze}},4162:(e,t,r)=>{"use strict";const s=r(8350).Syntax;const a=r(1217);function getLast(e){return e[e.length-1]||null}class PatternVisitor extends a.Visitor{static isPattern(e){const t=e.type;return t===s.Identifier||t===s.ObjectPattern||t===s.ArrayPattern||t===s.SpreadElement||t===s.RestElement||t===s.AssignmentPattern}constructor(e,t,r){super(null,e);this.rootPattern=t;this.callback=r;this.assignments=[];this.rightHandNodes=[];this.restElements=[]}Identifier(e){const t=getLast(this.restElements);this.callback(e,{topLevel:e===this.rootPattern,rest:t!==null&&t!==undefined&&t.argument===e,assignments:this.assignments})}Property(e){if(e.computed){this.rightHandNodes.push(e.key)}this.visit(e.value)}ArrayPattern(e){for(let t=0,r=e.elements.length;t{this.rightHandNodes.push(e)}));this.visit(e.callee)}}e.exports=PatternVisitor},4945:e=>{"use strict";const t=1;const r=2;const s=t|r;class Reference{constructor(e,t,r,s,a,n,o){this.identifier=e;this.from=t;this.tainted=false;this.resolved=null;this.flag=r;if(this.isWrite()){this.writeExpr=s;this.partial=n;this.init=o}this.__maybeImplicitGlobal=a}isStatic(){return!this.tainted&&this.resolved&&this.resolved.scope.isStatic()}isWrite(){return!!(this.flag&Reference.WRITE)}isRead(){return!!(this.flag&Reference.READ)}isReadOnly(){return this.flag===Reference.READ}isWriteOnly(){return this.flag===Reference.WRITE}isReadWrite(){return this.flag===Reference.RW}}Reference.READ=t;Reference.WRITE=r;Reference.RW=s;e.exports=Reference},4585:(e,t,r)=>{"use strict";const s=r(8350).Syntax;const a=r(1217);const n=r(4945);const o=r(2971);const i=r(4162);const l=r(665);const c=r(9491);const u=l.ParameterDefinition;const p=l.Definition;function traverseIdentifierInPattern(e,t,r,s){const a=new i(e,t,s);a.visit(t);if(r!==null&&r!==undefined){a.rightHandNodes.forEach(r.visit,r)}}class Importer extends a.Visitor{constructor(e,t){super(null,t.options);this.declaration=e;this.referencer=t}visitImport(e,t){this.referencer.visitPattern(e,(e=>{this.referencer.currentScope().__define(e,new p(o.ImportBinding,e,t,this.declaration,null,null))}))}ImportNamespaceSpecifier(e){const t=e.local||e.id;if(t){this.visitImport(t,e)}}ImportDefaultSpecifier(e){const t=e.local||e.id;this.visitImport(t,e)}ImportSpecifier(e){const t=e.local||e.id;if(e.name){this.visitImport(e.name,e)}else{this.visitImport(t,e)}}}class Referencer extends a.Visitor{constructor(e,t){super(null,e);this.options=e;this.scopeManager=t;this.parent=null;this.isInnerMethodDefinition=false}currentScope(){return this.scopeManager.__currentScope}close(e){while(this.currentScope()&&e===this.currentScope().block){this.scopeManager.__currentScope=this.currentScope().__close(this.scopeManager)}}pushInnerMethodDefinition(e){const t=this.isInnerMethodDefinition;this.isInnerMethodDefinition=e;return t}popInnerMethodDefinition(e){this.isInnerMethodDefinition=e}referencingDefaultValue(e,t,r,s){const a=this.currentScope();t.forEach((t=>{a.__referencing(e,n.WRITE,t.right,r,e!==t.left,s)}))}visitPattern(e,t,r){let s=t;let a=r;if(typeof t==="function"){a=t;s={processRightHandNodes:false}}traverseIdentifierInPattern(this.options,e,s.processRightHandNodes?this:null,a)}visitFunction(e){let t,r;if(e.type===s.FunctionDeclaration){this.currentScope().__define(e.id,new p(o.FunctionName,e.id,e,null,null,null))}if(e.type===s.FunctionExpression&&e.id){this.scopeManager.__nestFunctionExpressionNameScope(e)}this.scopeManager.__nestFunctionScope(e,this.isInnerMethodDefinition);const a=this;function visitPatternCallback(r,s){a.currentScope().__define(r,new u(r,e,t,s.rest));a.referencingDefaultValue(r,s.assignments,null,true)}for(t=0,r=e.params.length;t{this.currentScope().__define(t,new u(t,e,e.params.length,true))}))}if(e.body){if(e.body.type===s.BlockStatement){this.visitChildren(e.body)}else{this.visit(e.body)}}this.close(e)}visitClass(e){if(e.type===s.ClassDeclaration){this.currentScope().__define(e.id,new p(o.ClassName,e.id,e,null,null,null))}this.visit(e.superClass);this.scopeManager.__nestClassScope(e);if(e.id){this.currentScope().__define(e.id,new p(o.ClassName,e.id,e))}this.visit(e.body);this.close(e)}visitProperty(e){let t;if(e.computed){this.visit(e.key)}const r=e.type===s.MethodDefinition;if(r){t=this.pushInnerMethodDefinition(true)}this.visit(e.value);if(r){this.popInnerMethodDefinition(t)}}visitForIn(e){if(e.left.type===s.VariableDeclaration&&e.left.kind!=="var"){this.scopeManager.__nestForScope(e)}if(e.left.type===s.VariableDeclaration){this.visit(e.left);this.visitPattern(e.left.declarations[0].id,(t=>{this.currentScope().__referencing(t,n.WRITE,e.right,null,true,true)}))}else{this.visitPattern(e.left,{processRightHandNodes:true},((t,r)=>{let s=null;if(!this.currentScope().isStrict){s={pattern:t,node:e}}this.referencingDefaultValue(t,r.assignments,s,false);this.currentScope().__referencing(t,n.WRITE,e.right,s,true,false)}))}this.visit(e.right);this.visit(e.body);this.close(e)}visitVariableDeclaration(e,t,r,s){const a=r.declarations[s];const o=a.init;this.visitPattern(a.id,{processRightHandNodes:true},((i,l)=>{e.__define(i,new p(t,i,a,r,s,r.kind));this.referencingDefaultValue(i,l.assignments,null,true);if(o){this.currentScope().__referencing(i,n.WRITE,o,null,!l.topLevel,true)}}))}AssignmentExpression(e){if(i.isPattern(e.left)){if(e.operator==="="){this.visitPattern(e.left,{processRightHandNodes:true},((t,r)=>{let s=null;if(!this.currentScope().isStrict){s={pattern:t,node:e}}this.referencingDefaultValue(t,r.assignments,s,false);this.currentScope().__referencing(t,n.WRITE,e.right,s,!r.topLevel,false)}))}else{this.currentScope().__referencing(e.left,n.RW,e.right)}}else{this.visit(e.left)}this.visit(e.right)}CatchClause(e){this.scopeManager.__nestCatchScope(e);this.visitPattern(e.param,{processRightHandNodes:true},((t,r)=>{this.currentScope().__define(t,new p(o.CatchClause,e.param,e,null,null,null));this.referencingDefaultValue(t,r.assignments,null,true)}));this.visit(e.body);this.close(e)}Program(e){this.scopeManager.__nestGlobalScope(e);if(this.scopeManager.__isNodejsScope()){this.currentScope().isStrict=false;this.scopeManager.__nestFunctionScope(e,false)}if(this.scopeManager.__isES6()&&this.scopeManager.isModule()){this.scopeManager.__nestModuleScope(e)}if(this.scopeManager.isStrictModeSupported()&&this.scopeManager.isImpliedStrict()){this.currentScope().isStrict=true}this.visitChildren(e);this.close(e)}Identifier(e){this.currentScope().__referencing(e)}UpdateExpression(e){if(i.isPattern(e.argument)){this.currentScope().__referencing(e.argument,n.RW,null)}else{this.visitChildren(e)}}MemberExpression(e){this.visit(e.object);if(e.computed){this.visit(e.property)}}Property(e){this.visitProperty(e)}MethodDefinition(e){this.visitProperty(e)}BreakStatement(){}ContinueStatement(){}LabeledStatement(e){this.visit(e.body)}ForStatement(e){if(e.init&&e.init.type===s.VariableDeclaration&&e.init.kind!=="var"){this.scopeManager.__nestForScope(e)}this.visitChildren(e);this.close(e)}ClassExpression(e){this.visitClass(e)}ClassDeclaration(e){this.visitClass(e)}CallExpression(e){if(!this.scopeManager.__ignoreEval()&&e.callee.type===s.Identifier&&e.callee.name==="eval"){this.currentScope().variableScope.__detectEval()}this.visitChildren(e)}BlockStatement(e){if(this.scopeManager.__isES6()){this.scopeManager.__nestBlockScope(e)}this.visitChildren(e);this.close(e)}ThisExpression(){this.currentScope().variableScope.__detectThis()}WithStatement(e){this.visit(e.object);this.scopeManager.__nestWithScope(e);this.visit(e.body);this.close(e)}VariableDeclaration(e){const t=e.kind==="var"?this.currentScope().variableScope:this.currentScope();for(let r=0,s=e.declarations.length;r{"use strict";const s=r(6313);const a=r(9491);const n=s.GlobalScope;const o=s.CatchScope;const i=s.WithScope;const l=s.ModuleScope;const c=s.ClassScope;const u=s.SwitchScope;const p=s.FunctionScope;const f=s.ForScope;const d=s.FunctionExpressionNameScope;const m=s.BlockScope;class ScopeManager{constructor(e){this.scopes=[];this.globalScope=null;this.__nodeToScope=new WeakMap;this.__currentScope=null;this.__options=e;this.__declaredVariables=new WeakMap}__useDirective(){return this.__options.directive}__isOptimistic(){return this.__options.optimistic}__ignoreEval(){return this.__options.ignoreEval}__isNodejsScope(){return this.__options.nodejsScope}isModule(){return this.__options.sourceType==="module"}isImpliedStrict(){return this.__options.impliedStrict}isStrictModeSupported(){return this.__options.ecmaVersion>=5}__get(e){return this.__nodeToScope.get(e)}getDeclaredVariables(e){return this.__declaredVariables.get(e)||[]}acquire(e,t){function predicate(e){if(e.type==="function"&&e.functionExpressionScope){return false}return true}const r=this.__get(e);if(!r||r.length===0){return null}if(r.length===1){return r[0]}if(t){for(let e=r.length-1;e>=0;--e){const t=r[e];if(predicate(t)){return t}}}else{for(let e=0,t=r.length;e=6}}e.exports=ScopeManager},6313:(e,t,r)=>{"use strict";const s=r(8350).Syntax;const a=r(4945);const n=r(2971);const o=r(665).Definition;const i=r(9491);function isStrictScope(e,t,r,a){let n;if(e.upper&&e.upper.isStrict){return true}if(r){return true}if(e.type==="class"||e.type==="module"){return true}if(e.type==="block"||e.type==="switch"){return false}if(e.type==="function"){if(t.type===s.ArrowFunctionExpression&&t.body.type!==s.BlockStatement){return false}if(t.type===s.Program){n=t}else{n=t.body}if(!n){return false}}else if(e.type==="global"){n=t}else{return false}if(a){for(let e=0,t=n.body.length;e0&&s.every(shouldBeStatically)}__staticCloseRef(e){if(!this.__resolve(e)){this.__delegateToUpperScope(e)}}__dynamicCloseRef(e){let t=this;do{t.through.push(e);t=t.upper}while(t)}__globalCloseRef(e){if(this.__shouldStaticallyCloseForGlobal(e)){this.__staticCloseRef(e)}else{this.__dynamicCloseRef(e)}}__close(e){let t;if(this.__shouldStaticallyClose(e)){t=this.__staticCloseRef}else if(this.type!=="global"){t=this.__dynamicCloseRef}else{t=this.__globalCloseRef}for(let e=0,r=this.__left.length;ee.name.range[0]>=r)))}}class ForScope extends Scope{constructor(e,t,r){super(e,"for",t,r,false)}}class ClassScope extends Scope{constructor(e,t,r){super(e,"class",t,r,false)}}e.exports={Scope:Scope,GlobalScope:GlobalScope,ModuleScope:ModuleScope,FunctionExpressionNameScope:FunctionExpressionNameScope,CatchScope:CatchScope,WithScope:WithScope,BlockScope:BlockScope,SwitchScope:SwitchScope,FunctionScope:FunctionScope,ForScope:ForScope,ClassScope:ClassScope}},2971:e=>{"use strict";class Variable{constructor(e,t){this.name=e;this.identifiers=[];this.references=[];this.defs=[];this.tainted=false;this.stack=true;this.scope=t}}Variable.CatchClause="CatchClause";Variable.Parameter="Parameter";Variable.FunctionName="FunctionName";Variable.ClassName="ClassName";Variable.Variable="Variable";Variable.ImportBinding="ImportBinding";Variable.ImplicitGlobalVariable="ImplicitGlobalVariable";e.exports=Variable},1217:(e,t,r)=>{(function(){"use strict";var e=r(165);function isNode(e){if(e==null){return false}return typeof e==="object"&&typeof e.type==="string"}function isProperty(t,r){return(t===e.Syntax.ObjectExpression||t===e.Syntax.ObjectPattern)&&r==="properties"}function Visitor(t,r){r=r||{};this.__visitor=t||this;this.__childVisitorKeys=r.childVisitorKeys?Object.assign({},e.VisitorKeys,r.childVisitorKeys):e.VisitorKeys;if(r.fallback==="iteration"){this.__fallback=Object.keys}else if(typeof r.fallback==="function"){this.__fallback=r.fallback}}Visitor.prototype.visitChildren=function(t){var r,s,a,n,o,i,l;if(t==null){return}r=t.type||e.Syntax.Property;s=this.__childVisitorKeys[r];if(!s){if(this.__fallback){s=this.__fallback(t)}else{throw new Error("Unknown node type "+r+".")}}for(a=0,n=s.length;a{(function clone(e){"use strict";var t,r,s,a,n,o;function deepCopy(e){var t={},r,s;for(r in e){if(e.hasOwnProperty(r)){s=e[r];if(typeof s==="object"&&s!==null){t[r]=deepCopy(s)}else{t[r]=s}}}return t}function upperBound(e,t){var r,s,a,n;s=e.length;a=0;while(s){r=s>>>1;n=a+r;if(t(e[n])){s=r}else{a=n+1;s-=r+1}}return a}t={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ChainExpression:"ChainExpression",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"};s={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]};a={};n={};o={};r={Break:a,Skip:n,Remove:o};function Reference(e,t){this.parent=e;this.key=t}Reference.prototype.replace=function replace(e){this.parent[this.key]=e};Reference.prototype.remove=function remove(){if(Array.isArray(this.parent)){this.parent.splice(this.key,1);return true}else{this.replace(null);return false}};function Element(e,t,r,s){this.node=e;this.path=t;this.wrap=r;this.ref=s}function Controller(){}Controller.prototype.path=function path(){var e,t,r,s,a,n;function addToPath(e,t){if(Array.isArray(t)){for(r=0,s=t.length;r=0;--r){if(e[r].node===t){return true}}return false}Controller.prototype.traverse=function traverse(e,t){var r,s,o,i,l,c,u,p,f,d,m,y;this.__initialize(e,t);y={};r=this.__worklist;s=this.__leavelist;r.push(new Element(e,null,null,null));s.push(new Element(null,null,null,null));while(r.length){o=r.pop();if(o===y){o=s.pop();c=this.__execute(t.leave,o);if(this.__state===a||c===a){return}continue}if(o.node){c=this.__execute(t.enter,o);if(this.__state===a||c===a){return}r.push(y);s.push(o);if(this.__state===n||c===n){continue}i=o.node;l=i.type||o.wrap;d=this.__keys[l];if(!d){if(this.__fallback){d=this.__fallback(i)}else{throw new Error("Unknown node type "+l+".")}}p=d.length;while((p-=1)>=0){u=d[p];m=i[u];if(!m){continue}if(Array.isArray(m)){f=m.length;while((f-=1)>=0){if(!m[f]){continue}if(candidateExistsInLeaveList(s,m[f])){continue}if(isProperty(l,d[p])){o=new Element(m[f],[u,f],"Property",null)}else if(isNode(m[f])){o=new Element(m[f],[u,f],null,null)}else{continue}r.push(o)}}else if(isNode(m)){if(candidateExistsInLeaveList(s,m)){continue}r.push(new Element(m,u,null,null))}}}}};Controller.prototype.replace=function replace(e,t){var r,s,i,l,c,u,p,f,d,m,y,g,h;function removeElem(e){var t,s,a,n;if(e.ref.remove()){s=e.ref.key;n=e.ref.parent;t=r.length;while(t--){a=r[t];if(a.ref&&a.ref.parent===n){if(a.ref.key=0){h=d[p];m=i[h];if(!m){continue}if(Array.isArray(m)){f=m.length;while((f-=1)>=0){if(!m[f]){continue}if(isProperty(l,d[p])){u=new Element(m[f],[h,f],"Property",new Reference(m,f))}else if(isNode(m[f])){u=new Element(m[f],[h,f],null,new Reference(m,f))}else{continue}r.push(u)}}else if(isNode(m)){r.push(new Element(m,h,null,new Reference(i,h)))}}}return g.root};function traverse(e,t){var r=new Controller;return r.traverse(e,t)}function replace(e,t){var r=new Controller;return r.replace(e,t)}function extendCommentRange(e,t){var r;r=upperBound(t,(function search(t){return t.range[0]>e.range[0]}));e.extendedRange=[e.range[0],e.range[1]];if(r!==t.length){e.extendedRange[1]=t[r].range[0]}r-=1;if(r>=0){e.extendedRange[0]=t[r].range[1]}return e}function attachComments(e,t,s){var a=[],n,o,i,l;if(!e.range){throw new Error("attachComments needs range information")}if(!s.length){if(t.length){for(i=0,o=t.length;ie.range[0]){break}if(t.extendedRange[1]===e.range[0]){if(!e.leadingComments){e.leadingComments=[]}e.leadingComments.push(t);a.splice(l,1)}else{l+=1}}if(l===a.length){return r.Break}if(a[l].extendedRange[0]>e.range[1]){return r.Skip}}});l=0;traverse(e,{leave:function(e){var t;while(le.range[1]){return r.Skip}}});return e}e.Syntax=t;e.traverse=traverse;e.replace=replace;e.attachComments=attachComments;e.VisitorKeys=s;e.VisitorOption=r;e.Controller=Controller;e.cloneEnvironment=function(){return clone({})};return e})(t)},8350:(e,t,r)=>{(function clone(e){"use strict";var t,s,a,n,o,i;function deepCopy(e){var t={},r,s;for(r in e){if(e.hasOwnProperty(r)){s=e[r];if(typeof s==="object"&&s!==null){t[r]=deepCopy(s)}else{t[r]=s}}}return t}function upperBound(e,t){var r,s,a,n;s=e.length;a=0;while(s){r=s>>>1;n=a+r;if(t(e[n])){s=r}else{a=n+1;s-=r+1}}return a}t={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"};a={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]};n={};o={};i={};s={Break:n,Skip:o,Remove:i};function Reference(e,t){this.parent=e;this.key=t}Reference.prototype.replace=function replace(e){this.parent[this.key]=e};Reference.prototype.remove=function remove(){if(Array.isArray(this.parent)){this.parent.splice(this.key,1);return true}else{this.replace(null);return false}};function Element(e,t,r,s){this.node=e;this.path=t;this.wrap=r;this.ref=s}function Controller(){}Controller.prototype.path=function path(){var e,t,r,s,a,n;function addToPath(e,t){if(Array.isArray(t)){for(r=0,s=t.length;r=0){u=d[p];m=i[u];if(!m){continue}if(Array.isArray(m)){f=m.length;while((f-=1)>=0){if(!m[f]){continue}if(isProperty(l,d[p])){a=new Element(m[f],[u,f],"Property",null)}else if(isNode(m[f])){a=new Element(m[f],[u,f],null,null)}else{continue}r.push(a)}}else if(isNode(m)){r.push(new Element(m,u,null,null))}}}}};Controller.prototype.replace=function replace(e,t){var r,s,a,l,c,u,p,f,d,m,y,g,h;function removeElem(e){var t,s,a,n;if(e.ref.remove()){s=e.ref.key;n=e.ref.parent;t=r.length;while(t--){a=r[t];if(a.ref&&a.ref.parent===n){if(a.ref.key=0){h=d[p];m=a[h];if(!m){continue}if(Array.isArray(m)){f=m.length;while((f-=1)>=0){if(!m[f]){continue}if(isProperty(l,d[p])){u=new Element(m[f],[h,f],"Property",new Reference(m,f))}else if(isNode(m[f])){u=new Element(m[f],[h,f],null,new Reference(m,f))}else{continue}r.push(u)}}else if(isNode(m)){r.push(new Element(m,h,null,new Reference(a,h)))}}}return g.root};function traverse(e,t){var r=new Controller;return r.traverse(e,t)}function replace(e,t){var r=new Controller;return r.replace(e,t)}function extendCommentRange(e,t){var r;r=upperBound(t,(function search(t){return t.range[0]>e.range[0]}));e.extendedRange=[e.range[0],e.range[1]];if(r!==t.length){e.extendedRange[1]=t[r].range[0]}r-=1;if(r>=0){e.extendedRange[0]=t[r].range[1]}return e}function attachComments(e,t,r){var a=[],n,o,i,l;if(!e.range){throw new Error("attachComments needs range information")}if(!r.length){if(t.length){for(i=0,o=t.length;ie.range[0]){break}if(t.extendedRange[1]===e.range[0]){if(!e.leadingComments){e.leadingComments=[]}e.leadingComments.push(t);a.splice(l,1)}else{l+=1}}if(l===a.length){return s.Break}if(a[l].extendedRange[0]>e.range[1]){return s.Skip}}});l=0;traverse(e,{leave:function(e){var t;while(le.range[1]){return s.Skip}}});return e}e.version=r(5535).i8;e.Syntax=t;e.traverse=traverse;e.replace=replace;e.attachComments=attachComments;e.VisitorKeys=a;e.VisitorOption=s;e.Controller=Controller;e.cloneEnvironment=function(){return clone({})};return e})(t)},9733:e=>{"use strict";var t="Function.prototype.bind called on incompatible ";var r=Array.prototype.slice;var s=Object.prototype.toString;var a="[object Function]";e.exports=function bind(e){var n=this;if(typeof n!=="function"||s.call(n)!==a){throw new TypeError(t+n)}var o=r.call(arguments,1);var i;var binder=function(){if(this instanceof i){var t=n.apply(this,o.concat(r.call(arguments)));if(Object(t)===t){return t}return this}else{return n.apply(e,o.concat(r.call(arguments)))}};var l=Math.max(0,n.length-o.length);var c=[];for(var u=0;u{"use strict";var s=r(9733);e.exports=Function.prototype.bind||s},5548:(e,t,r)=>{"use strict";e.exports=r(964)},793:(e,t,r)=>{"use strict";var s=r(4517);e.exports=s.call(Function.call,Object.prototype.hasOwnProperty)},8746:(e,t,r)=>{"use strict";var s=r(793);function specifierIncluded(e,t){var r=e.split(".");var s=t.split(" ");var a=s.length>1?s[0]:"=";var n=(s.length>1?s[1]:s[0]).split(".");for(var o=0;o<3;++o){var i=parseInt(r[o]||0,10);var l=parseInt(n[o]||0,10);if(i===l){continue}if(a==="<"){return i="){return i>=l}return false}return a===">="}function matchesRange(e,t){var r=t.split(/ ?&& ?/);if(r.length===0){return false}for(var s=0;s{Object.defineProperty(t,"__esModule",{value:true});t["default"]=/((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;t.matchToToken=function(e){var t={type:"invalid",value:e[0],closed:undefined};if(e[1])t.type="string",t.closed=!!(e[3]||e[4]);else if(e[5])t.type="comment";else if(e[6])t.type="comment",t.closed=!!e[7];else if(e[8])t.type="regex";else if(e[9])t.type="number";else if(e[10])t.type="name";else if(e[11])t.type="punctuator";else if(e[12])t.type="whitespace";return t}},6240:e=>{var t="Expected a function";var r=0/0;var s="[object Symbol]";var a=/^\s+|\s+$/g;var n=/^[-+]0x[0-9a-f]+$/i;var o=/^0b[01]+$/i;var i=/^0o[0-7]+$/i;var l=parseInt;var c=typeof global=="object"&&global&&global.Object===Object&&global;var u=typeof self=="object"&&self&&self.Object===Object&&self;var p=c||u||Function("return this")();var f=Object.prototype;var d=f.toString;var m=Math.max,y=Math.min;var now=function(){return p.Date.now()};function debounce(e,r,s){var a,n,o,i,l,c,u=0,p=false,f=false,d=true;if(typeof e!="function"){throw new TypeError(t)}r=toNumber(r)||0;if(isObject(s)){p=!!s.leading;f="maxWait"in s;o=f?m(toNumber(s.maxWait)||0,r):o;d="trailing"in s?!!s.trailing:d}function invokeFunc(t){var r=a,s=n;a=n=undefined;u=t;i=e.apply(s,r);return i}function leadingEdge(e){u=e;l=setTimeout(timerExpired,r);return p?invokeFunc(e):i}function remainingWait(e){var t=e-c,s=e-u,a=r-t;return f?y(a,o-s):a}function shouldInvoke(e){var t=e-c,s=e-u;return c===undefined||t>=r||t<0||f&&s>=o}function timerExpired(){var e=now();if(shouldInvoke(e)){return trailingEdge(e)}l=setTimeout(timerExpired,remainingWait(e))}function trailingEdge(e){l=undefined;if(d&&a){return invokeFunc(e)}a=n=undefined;return i}function cancel(){if(l!==undefined){clearTimeout(l)}u=0;a=c=n=l=undefined}function flush(){return l===undefined?i:trailingEdge(now())}function debounced(){var e=now(),t=shouldInvoke(e);a=arguments;n=this;c=e;if(t){if(l===undefined){return leadingEdge(c)}if(f){l=setTimeout(timerExpired,r);return invokeFunc(c)}}if(l===undefined){l=setTimeout(timerExpired,r)}return i}debounced.cancel=cancel;debounced.flush=flush;return debounced}function isObject(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function isObjectLike(e){return!!e&&typeof e=="object"}function isSymbol(e){return typeof e=="symbol"||isObjectLike(e)&&d.call(e)==s}function toNumber(e){if(typeof e=="number"){return e}if(isSymbol(e)){return r}if(isObject(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=isObject(t)?t+"":t}if(typeof e!="string"){return e===0?e:+e}e=e.replace(a,"");var s=o.test(e);return s||i.test(e)?l(e.slice(2),s?2:8):n.test(e)?r:+e}e.exports=debounce},8018:function(e,t,r){e=r.nmd(e); /** * @license * Lodash @@ -386,15 +311,15 @@ * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */(function(){var r;var s="4.17.20";var a=200;var n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function";var i="__lodash_hash_undefined__";var l=500;var c="__lodash_placeholder__";var u=1,p=2,d=4;var f=1,m=2;var y=1,g=2,h=4,b=8,x=16,v=32,E=64,j=128,w=256,_=512;var S=30,O="...";var k=800,P=16;var I=1,D=2,C=3;var A=1/0,R=9007199254740991,N=17976931348623157e292,M=0/0;var F=4294967295,L=F-1,B=F>>>1;var W=[["ary",j],["bind",y],["bindKey",g],["curry",b],["curryRight",x],["flip",_],["partial",v],["partialRight",E],["rearg",w]];var U="[object Arguments]",$="[object Array]",V="[object AsyncFunction]",q="[object Boolean]",G="[object Date]",H="[object DOMException]",z="[object Error]",K="[object Function]",X="[object GeneratorFunction]",Y="[object Map]",J="[object Number]",Z="[object Null]",Q="[object Object]",ee="[object Promise]",te="[object Proxy]",re="[object RegExp]",se="[object Set]",ae="[object String]",ne="[object Symbol]",oe="[object Undefined]",ie="[object WeakMap]",le="[object WeakSet]";var ce="[object ArrayBuffer]",ue="[object DataView]",pe="[object Float32Array]",de="[object Float64Array]",fe="[object Int8Array]",me="[object Int16Array]",ye="[object Int32Array]",ge="[object Uint8Array]",he="[object Uint8ClampedArray]",be="[object Uint16Array]",xe="[object Uint32Array]";var ve=/\b__p \+= '';/g,Ee=/\b(__p \+=) '' \+/g,je=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var we=/&(?:amp|lt|gt|quot|#39);/g,_e=/[&<>"']/g,Se=RegExp(we.source),Oe=RegExp(_e.source);var ke=/<%-([\s\S]+?)%>/g,Pe=/<%([\s\S]+?)%>/g,Ie=/<%=([\s\S]+?)%>/g;var De=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ce=/^\w*$/,Ae=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;var Re=/[\\^$.*+?()[\]{}|]/g,Ne=RegExp(Re.source);var Te=/^\s+|\s+$/g,Me=/^\s+/,Fe=/\s+$/;var Le=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Be=/\{\n\/\* \[wrapped with (.+)\] \*/,We=/,? & /;var Ue=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var $e=/\\(\\)?/g;var Ve=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var qe=/\w*$/;var Ge=/^[-+]0x[0-9a-f]+$/i;var He=/^0b[01]+$/i;var ze=/^\[object .+?Constructor\]$/;var Ke=/^0o[0-7]+$/i;var Xe=/^(?:0|[1-9]\d*)$/;var Ye=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;var Je=/($^)/;var Ze=/['\n\r\u2028\u2029\\]/g;var Qe="\\ud800-\\udfff",et="\\u0300-\\u036f",tt="\\ufe20-\\ufe2f",rt="\\u20d0-\\u20ff",st=et+tt+rt,at="\\u2700-\\u27bf",nt="a-z\\xdf-\\xf6\\xf8-\\xff",ot="\\xac\\xb1\\xd7\\xf7",ct="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ut="\\u2000-\\u206f",pt=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",dt="A-Z\\xc0-\\xd6\\xd8-\\xde",ft="\\ufe0e\\ufe0f",mt=ot+ct+ut+pt;var yt="['’]",ht="["+Qe+"]",bt="["+mt+"]",xt="["+st+"]",vt="\\d+",Et="["+at+"]",jt="["+nt+"]",wt="[^"+Qe+mt+vt+at+nt+dt+"]",_t="\\ud83c[\\udffb-\\udfff]",St="(?:"+xt+"|"+_t+")",Ot="[^"+Qe+"]",kt="(?:\\ud83c[\\udde6-\\uddff]){2}",Pt="[\\ud800-\\udbff][\\udc00-\\udfff]",It="["+dt+"]",Dt="\\u200d";var Ct="(?:"+jt+"|"+wt+")",At="(?:"+It+"|"+wt+")",Rt="(?:"+yt+"(?:d|ll|m|re|s|t|ve))?",Nt="(?:"+yt+"(?:D|LL|M|RE|S|T|VE))?",Tt=St+"?",Mt="["+ft+"]?",Ft="(?:"+Dt+"(?:"+[Ot,kt,Pt].join("|")+")"+Mt+Tt+")*",Lt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Bt="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Wt=Mt+Tt+Ft,Ut="(?:"+[Et,kt,Pt].join("|")+")"+Wt,$t="(?:"+[Ot+xt+"?",xt,kt,Pt,ht].join("|")+")";var Vt=RegExp(yt,"g");var qt=RegExp(xt,"g");var Gt=RegExp(_t+"(?="+_t+")|"+$t+Wt,"g");var Ht=RegExp([It+"?"+jt+"+"+Rt+"(?="+[bt,It,"$"].join("|")+")",At+"+"+Nt+"(?="+[bt,It+Ct,"$"].join("|")+")",It+"?"+Ct+"+"+Rt,It+"+"+Nt,Bt,Lt,vt,Ut].join("|"),"g");var zt=RegExp("["+Dt+Qe+st+ft+"]");var Kt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var Xt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"];var Yt=-1;var Jt={};Jt[pe]=Jt[de]=Jt[fe]=Jt[me]=Jt[ye]=Jt[ge]=Jt[he]=Jt[be]=Jt[xe]=true;Jt[U]=Jt[$]=Jt[ce]=Jt[q]=Jt[ue]=Jt[G]=Jt[z]=Jt[K]=Jt[Y]=Jt[J]=Jt[Q]=Jt[re]=Jt[se]=Jt[ae]=Jt[ie]=false;var Zt={};Zt[U]=Zt[$]=Zt[ce]=Zt[ue]=Zt[q]=Zt[G]=Zt[pe]=Zt[de]=Zt[fe]=Zt[me]=Zt[ye]=Zt[Y]=Zt[J]=Zt[Q]=Zt[re]=Zt[se]=Zt[ae]=Zt[ne]=Zt[ge]=Zt[he]=Zt[be]=Zt[xe]=true;Zt[z]=Zt[K]=Zt[ie]=false;var Qt={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"};var er={"&":"&","<":"<",">":">",'"':""","'":"'"};var tr={"&":"&","<":"<",">":">",""":'"',"'":"'"};var rr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};var sr=parseFloat,ar=parseInt;var nr=typeof global=="object"&&global&&global.Object===Object&&global;var or=typeof self=="object"&&self&&self.Object===Object&&self;var ir=nr||or||Function("return this")();var lr=true&&t&&!t.nodeType&&t;var cr=lr&&"object"=="object"&&e&&!e.nodeType&&e;var ur=cr&&cr.exports===lr;var pr=ur&&nr.process;var dr=function(){try{var e=cr&&cr.require&&cr.require("util").types;if(e){return e}return pr&&pr.binding&&pr.binding("util")}catch(e){}}();var fr=dr&&dr.isArrayBuffer,mr=dr&&dr.isDate,yr=dr&&dr.isMap,gr=dr&&dr.isRegExp,hr=dr&&dr.isSet,br=dr&&dr.isTypedArray;function apply(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function arrayAggregator(e,t,r,s){var a=-1,n=e==null?0:e.length;while(++a-1}function arrayIncludesWith(e,t,r){var s=-1,a=e==null?0:e.length;while(++s-1){}return r}function charsEndIndex(e,t){var r=e.length;while(r--&&baseIndexOf(t,e[r],0)>-1){}return r}function countHolders(e,t){var r=e.length,s=0;while(r--){if(e[r]===t){++s}}return s}var vr=basePropertyOf(Qt);var Er=basePropertyOf(er);function escapeStringChar(e){return"\\"+rr[e]}function getValue(e,t){return e==null?r:e[t]}function hasUnicode(e){return zt.test(e)}function hasUnicodeWord(e){return Kt.test(e)}function iteratorToArray(e){var t,r=[];while(!(t=e.next()).done){r.push(t.value)}return r}function mapToArray(e){var t=-1,r=Array(e.size);e.forEach((function(e,s){r[++t]=[s,e]}));return r}function overArg(e,t){return function(r){return e(t(r))}}function replaceHolders(e,t){var r=-1,s=e.length,a=0,n=[];while(++r-1}function listCacheSet(e,t){var r=this.__data__,s=assocIndexOf(r,e);if(s<0){++this.size;r.push([e,t])}else{r[s][1]=t}return this}ListCache.prototype.clear=listCacheClear;ListCache.prototype["delete"]=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;function MapCache(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t=t?e:t}}return e}function baseClone(e,t,s,a,n,o){var i,l=t&u,c=t&p,f=t&d;if(s){i=n?s(e,a,n,o):s(e)}if(i!==r){return i}if(!isObject(e)){return e}var m=Ns(e);if(m){i=initCloneArray(e);if(!l){return copyArray(e,i)}}else{var y=qr(e),g=y==K||y==X;if(Ms(e)){return cloneBuffer(e,l)}if(y==Q||y==U||g&&!n){i=c||g?{}:initCloneObject(e);if(!l){return c?copySymbolsIn(e,baseAssignIn(i,e)):copySymbols(e,baseAssign(i,e))}}else{if(!Zt[y]){return n?e:{}}i=initCloneByTag(e,y,l)}}o||(o=new Stack);var h=o.get(e);if(h){return h}o.set(e,i);if(Ws(e)){e.forEach((function(r){i.add(baseClone(r,t,s,r,e,o))}))}else if(Ls(e)){e.forEach((function(r,a){i.set(a,baseClone(r,t,s,a,e,o))}))}var b=f?c?getAllKeysIn:getAllKeys:c?keysIn:keys;var x=m?r:b(e);arrayEach(x||e,(function(r,a){if(x){a=r;r=e[a]}assignValue(i,a,baseClone(r,t,s,a,e,o))}));return i}function baseConforms(e){var t=keys(e);return function(r){return baseConformsTo(r,e,t)}}function baseConformsTo(e,t,s){var a=s.length;if(e==null){return!a}e=rt(e);while(a--){var n=s[a],o=t[n],i=e[n];if(i===r&&!(n in e)||!o(i)){return false}}return true}function baseDelay(e,t,s){if(typeof e!="function"){throw new nt(o)}return zr((function(){e.apply(r,s)}),t)}function baseDifference(e,t,r,s){var n=-1,o=arrayIncludes,i=true,l=e.length,c=[],u=t.length;if(!l){return c}if(r){t=arrayMap(t,baseUnary(r))}if(s){o=arrayIncludesWith;i=false}else if(t.length>=a){o=cacheHas;i=false;t=new SetCache(t)}e:while(++nn?0:n+s}a=a===r||a>n?n:toInteger(a);if(a<0){a+=n}a=s>a?0:toLength(a);while(s0&&r(i)){if(t>1){baseFlatten(i,t-1,r,s,a)}else{arrayPush(a,i)}}else if(!s){a[a.length]=i}}return a}var Nr=createBaseFor();var Tr=createBaseFor(true);function baseForOwn(e,t){return e&&Nr(e,t,keys)}function baseForOwnRight(e,t){return e&&Tr(e,t,keys)}function baseFunctions(e,t){return arrayFilter(t,(function(t){return isFunction(e[t])}))}function baseGet(e,t){t=castPath(t,e);var s=0,a=t.length;while(e!=null&&st}function baseHas(e,t){return e!=null&&ft.call(e,t)}function baseHasIn(e,t){return e!=null&&t in rt(e)}function baseInRange(e,t,r){return e>=Ht(t,r)&&e=120&&d.length>=120)?new SetCache(l&&d):r}d=e[0];var f=-1,m=c[0];e:while(++f-1){if(i!==e){Pt.call(i,l,1)}Pt.call(e,l,1)}}return e}function basePullAt(e,t){var r=e?t.length:0,s=r-1;while(r--){var a=t[r];if(r==s||a!==n){var n=a;if(isIndex(a)){Pt.call(e,a,1)}else{baseUnset(e,a)}}}return e}function baseRandom(e,t){return e+Ft(Qt()*(t-e+1))}function baseRange(e,r,s,a){var n=-1,o=Gt(Mt((r-e)/(s||1)),0),i=t(o);while(o--){i[a?o:++n]=e;e+=s}return i}function baseRepeat(e,t){var r="";if(!e||t<1||t>R){return r}do{if(t%2){r+=e}t=Ft(t/2);if(t){e+=e}}while(t);return r}function baseRest(e,t){return Kr(overRest(e,t,identity),e+"")}function baseSample(e){return arraySample(values(e))}function baseSampleSize(e,t){var r=values(e);return shuffleSelf(r,baseClamp(t,0,r.length))}function baseSet(e,t,s,a){if(!isObject(e)){return e}t=castPath(t,e);var n=-1,o=t.length,i=o-1,l=e;while(l!=null&&++nn?0:n+r}s=s>n?n:s;if(s<0){s+=n}n=r>s?0:s-r>>>0;r>>>=0;var o=t(n);while(++a>>1,o=e[n];if(o!==null&&!isSymbol(o)&&(r?o<=t:o=a){var u=t?null:Wr(e);if(u){return setToArray(u)}i=false;n=cacheHas;c=new SetCache}else{c=t?[]:l}e:while(++s=a?e:baseSlice(e,t,s)}var Br=Rt||function(e){return ir.clearTimeout(e)};function cloneBuffer(e,t){if(t){return e.slice()}var r=e.length,s=_t?_t(r):new e.constructor(r);e.copy(s);return s}function cloneArrayBuffer(e){var t=new e.constructor(e.byteLength);new wt(t).set(new wt(e));return t}function cloneDataView(e,t){var r=t?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function cloneRegExp(e){var t=new e.constructor(e.source,qe.exec(e));t.lastIndex=e.lastIndex;return t}function cloneSymbol(e){return Ir?rt(Ir.call(e)):{}}function cloneTypedArray(e,t){var r=t?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function compareAscending(e,t){if(e!==t){var s=e!==r,a=e===null,n=e===e,o=isSymbol(e);var i=t!==r,l=t===null,c=t===t,u=isSymbol(t);if(!l&&!u&&!o&&e>t||o&&i&&c&&!l&&!u||a&&i&&c||!s&&c||!n){return 1}if(!a&&!o&&!u&&e=i){return l}var c=r[s];return l*(c=="desc"?-1:1)}}return e.index-t.index}function composeArgs(e,r,s,a){var n=-1,o=e.length,i=s.length,l=-1,c=r.length,u=Gt(o-i,0),p=t(c+u),d=!a;while(++l1?s[n-1]:r,i=n>2?s[2]:r;o=e.length>3&&typeof o=="function"?(n--,o):r;if(i&&isIterateeCall(s[0],s[1],i)){o=n<3?r:o;n=1}t=rt(t);while(++a-1?n[o?t[i]:i]:r}}function createFlow(e){return flatRest((function(t){var s=t.length,a=s,n=LodashWrapper.prototype.thru;if(e){t.reverse()}while(a--){var i=t[a];if(typeof i!="function"){throw new nt(o)}if(n&&!l&&getFuncName(i)=="wrapper"){var l=new LodashWrapper([],true)}}a=l?a:s;while(++a1){y.reverse()}if(d&&ul)){return false}var u=o.get(e);var p=o.get(t);if(u&&p){return u==t&&p==e}var d=-1,y=true,g=s&m?new SetCache:r;o.set(e,t);o.set(t,e);while(++d1?"& ":"")+t[s];t=t.join(r>2?", ":" ");return e.replace(Le,"{\n/* [wrapped with "+t+"] */\n")}function isFlattenable(e){return Ns(e)||Rs(e)||!!(It&&e&&e[It])}function isIndex(e,t){var r=typeof e;t=t==null?R:t;return!!t&&(r=="number"||r!="symbol"&&Xe.test(e))&&(e>-1&&e%1==0&&e0){if(++t>=k){return arguments[0]}}else{t=0}return e.apply(r,arguments)}}function shuffleSelf(e,t){var s=-1,a=e.length,n=a-1;t=t===r?a:t;while(++s1?e[t-1]:r;s=typeof s=="function"?(e.pop(),s):r;return unzipWith(e,s)}));function chain(e){var t=lodash(e);t.__chain__=true;return t}function tap(e,t){t(e);return e}function thru(e,t){return t(e)}var fs=flatRest((function(e){var t=e.length,s=t?e[0]:0,a=this.__wrapped__,interceptor=function(t){return baseAt(t,e)};if(t>1||this.__actions__.length||!(a instanceof LazyWrapper)||!isIndex(s)){return this.thru(interceptor)}a=a.slice(s,+s+(t?1:0));a.__actions__.push({func:thru,args:[interceptor],thisArg:r});return new LodashWrapper(a,this.__chain__).thru((function(e){if(t&&!e.length){e.push(r)}return e}))}));function wrapperChain(){return chain(this)}function wrapperCommit(){return new LodashWrapper(this.value(),this.__chain__)}function wrapperNext(){if(this.__values__===r){this.__values__=toArray(this.value())}var e=this.__index__>=this.__values__.length,t=e?r:this.__values__[this.__index__++];return{done:e,value:t}}function wrapperToIterator(){return this}function wrapperPlant(e){var t,s=this;while(s instanceof baseLodash){var a=wrapperClone(s);a.__index__=0;a.__values__=r;if(t){n.__wrapped__=a}else{t=a}var n=a;s=s.__wrapped__}n.__wrapped__=e;return t}function wrapperReverse(){var e=this.__wrapped__;if(e instanceof LazyWrapper){var t=e;if(this.__actions__.length){t=new LazyWrapper(this)}t=t.reverse();t.__actions__.push({func:thru,args:[reverse],thisArg:r});return new LodashWrapper(t,this.__chain__)}return this.thru(reverse)}function wrapperValue(){return baseWrapperValue(this.__wrapped__,this.__actions__)}var ms=createAggregator((function(e,t,r){if(ft.call(e,r)){++e[r]}else{baseAssignValue(e,r,1)}}));function every(e,t,s){var a=Ns(e)?arrayEvery:baseEvery;if(s&&isIterateeCall(e,t,s)){t=r}return a(e,getIteratee(t,3))}function filter(e,t){var r=Ns(e)?arrayFilter:baseFilter;return r(e,getIteratee(t,3))}var ys=createFind(findIndex);var gs=createFind(findLastIndex);function flatMap(e,t){return baseFlatten(map(e,t),1)}function flatMapDeep(e,t){return baseFlatten(map(e,t),A)}function flatMapDepth(e,t,s){s=s===r?1:toInteger(s);return baseFlatten(map(e,t),s)}function forEach(e,t){var r=Ns(e)?arrayEach:Ar;return r(e,getIteratee(t,3))}function forEachRight(e,t){var r=Ns(e)?arrayEachRight:Rr;return r(e,getIteratee(t,3))}var hs=createAggregator((function(e,t,r){if(ft.call(e,r)){e[r].push(t)}else{baseAssignValue(e,r,[t])}}));function includes(e,t,r,s){e=isArrayLike(e)?e:values(e);r=r&&!s?toInteger(r):0;var a=e.length;if(r<0){r=Gt(a+r,0)}return isString(e)?r<=a&&e.indexOf(t,r)>-1:!!a&&baseIndexOf(e,t,r)>-1}var bs=baseRest((function(e,r,s){var a=-1,n=typeof r=="function",o=isArrayLike(e)?t(e.length):[];Ar(e,(function(e){o[++a]=n?apply(r,e,s):baseInvoke(e,r,s)}));return o}));var xs=createAggregator((function(e,t,r){baseAssignValue(e,r,t)}));function map(e,t){var r=Ns(e)?arrayMap:baseMap;return r(e,getIteratee(t,3))}function orderBy(e,t,s,a){if(e==null){return[]}if(!Ns(t)){t=t==null?[]:[t]}s=a?r:s;if(!Ns(s)){s=s==null?[]:[s]}return baseOrderBy(e,t,s)}var vs=createAggregator((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]}));function reduce(e,t,r){var s=Ns(e)?arrayReduce:baseReduce,a=arguments.length<3;return s(e,getIteratee(t,4),r,a,Ar)}function reduceRight(e,t,r){var s=Ns(e)?arrayReduceRight:baseReduce,a=arguments.length<3;return s(e,getIteratee(t,4),r,a,Rr)}function reject(e,t){var r=Ns(e)?arrayFilter:baseFilter;return r(e,negate(getIteratee(t,3)))}function sample(e){var t=Ns(e)?arraySample:baseSample;return t(e)}function sampleSize(e,t,s){if(s?isIterateeCall(e,t,s):t===r){t=1}else{t=toInteger(t)}var a=Ns(e)?arraySampleSize:baseSampleSize;return a(e,t)}function shuffle(e){var t=Ns(e)?arrayShuffle:baseShuffle;return t(e)}function size(e){if(e==null){return 0}if(isArrayLike(e)){return isString(e)?stringSize(e):e.length}var t=qr(e);if(t==Y||t==se){return e.size}return baseKeys(e).length}function some(e,t,s){var a=Ns(e)?arraySome:baseSome;if(s&&isIterateeCall(e,t,s)){t=r}return a(e,getIteratee(t,3))}var Es=baseRest((function(e,t){if(e==null){return[]}var r=t.length;if(r>1&&isIterateeCall(e,t[0],t[1])){t=[]}else if(r>2&&isIterateeCall(t[0],t[1],t[2])){t=[t[0]]}return baseOrderBy(e,baseFlatten(t,1),[])}));var js=Nt||function(){return ir.Date.now()};function after(e,t){if(typeof t!="function"){throw new nt(o)}e=toInteger(e);return function(){if(--e<1){return t.apply(this,arguments)}}}function ary(e,t,s){t=s?r:t;t=e&&t==null?e.length:t;return createWrap(e,j,r,r,r,r,t)}function before(e,t){var s;if(typeof t!="function"){throw new nt(o)}e=toInteger(e);return function(){if(--e>0){s=t.apply(this,arguments)}if(e<=1){t=r}return s}}var ws=baseRest((function(e,t,r){var s=y;if(r.length){var a=replaceHolders(r,getHolder(ws));s|=v}return createWrap(e,s,t,r,a)}));var _s=baseRest((function(e,t,r){var s=y|g;if(r.length){var a=replaceHolders(r,getHolder(_s));s|=v}return createWrap(t,s,e,r,a)}));function curry(e,t,s){t=s?r:t;var a=createWrap(e,b,r,r,r,r,r,t);a.placeholder=curry.placeholder;return a}function curryRight(e,t,s){t=s?r:t;var a=createWrap(e,x,r,r,r,r,r,t);a.placeholder=curryRight.placeholder;return a}function debounce(e,t,s){var a,n,i,l,c,u,p=0,d=false,f=false,m=true;if(typeof e!="function"){throw new nt(o)}t=toNumber(t)||0;if(isObject(s)){d=!!s.leading;f="maxWait"in s;i=f?Gt(toNumber(s.maxWait)||0,t):i;m="trailing"in s?!!s.trailing:m}function invokeFunc(t){var s=a,o=n;a=n=r;p=t;l=e.apply(o,s);return l}function leadingEdge(e){p=e;c=zr(timerExpired,t);return d?invokeFunc(e):l}function remainingWait(e){var r=e-u,s=e-p,a=t-r;return f?Ht(a,i-s):a}function shouldInvoke(e){var s=e-u,a=e-p;return u===r||s>=t||s<0||f&&a>=i}function timerExpired(){var e=js();if(shouldInvoke(e)){return trailingEdge(e)}c=zr(timerExpired,remainingWait(e))}function trailingEdge(e){c=r;if(m&&a){return invokeFunc(e)}a=n=r;return l}function cancel(){if(c!==r){Br(c)}p=0;a=u=n=c=r}function flush(){return c===r?l:trailingEdge(js())}function debounced(){var e=js(),s=shouldInvoke(e);a=arguments;n=this;u=e;if(s){if(c===r){return leadingEdge(u)}if(f){Br(c);c=zr(timerExpired,t);return invokeFunc(u)}}if(c===r){c=zr(timerExpired,t)}return l}debounced.cancel=cancel;debounced.flush=flush;return debounced}var Ss=baseRest((function(e,t){return baseDelay(e,1,t)}));var Os=baseRest((function(e,t,r){return baseDelay(e,toNumber(t)||0,r)}));function flip(e){return createWrap(e,_)}function memoize(e,t){if(typeof e!="function"||t!=null&&typeof t!="function"){throw new nt(o)}var memoized=function(){var r=arguments,s=t?t.apply(this,r):r[0],a=memoized.cache;if(a.has(s)){return a.get(s)}var n=e.apply(this,r);memoized.cache=a.set(s,n)||a;return n};memoized.cache=new(memoize.Cache||MapCache);return memoized}memoize.Cache=MapCache;function negate(e){if(typeof e!="function"){throw new nt(o)}return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function once(e){return before(2,e)}var ks=Lr((function(e,t){t=t.length==1&&Ns(t[0])?arrayMap(t[0],baseUnary(getIteratee())):arrayMap(baseFlatten(t,1),baseUnary(getIteratee()));var r=t.length;return baseRest((function(s){var a=-1,n=Ht(s.length,r);while(++a=t}));var Rs=baseIsArguments(function(){return arguments}())?baseIsArguments:function(e){return isObjectLike(e)&&ft.call(e,"callee")&&!kt.call(e,"callee")};var Ns=t.isArray;var Ts=fr?baseUnary(fr):baseIsArrayBuffer;function isArrayLike(e){return e!=null&&isLength(e.length)&&!isFunction(e)}function isArrayLikeObject(e){return isObjectLike(e)&&isArrayLike(e)}function isBoolean(e){return e===true||e===false||isObjectLike(e)&&baseGetTag(e)==q}var Ms=Bt||stubFalse;var Fs=mr?baseUnary(mr):baseIsDate;function isElement(e){return isObjectLike(e)&&e.nodeType===1&&!isPlainObject(e)}function isEmpty(e){if(e==null){return true}if(isArrayLike(e)&&(Ns(e)||typeof e=="string"||typeof e.splice=="function"||Ms(e)||Us(e)||Rs(e))){return!e.length}var t=qr(e);if(t==Y||t==se){return!e.size}if(isPrototype(e)){return!baseKeys(e).length}for(var r in e){if(ft.call(e,r)){return false}}return true}function isEqual(e,t){return baseIsEqual(e,t)}function isEqualWith(e,t,s){s=typeof s=="function"?s:r;var a=s?s(e,t):r;return a===r?baseIsEqual(e,t,r,s):!!a}function isError(e){if(!isObjectLike(e)){return false}var t=baseGetTag(e);return t==z||t==H||typeof e.message=="string"&&typeof e.name=="string"&&!isPlainObject(e)}function isFinite(e){return typeof e=="number"&&Wt(e)}function isFunction(e){if(!isObject(e)){return false}var t=baseGetTag(e);return t==K||t==X||t==V||t==te}function isInteger(e){return typeof e=="number"&&e==toInteger(e)}function isLength(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=R}function isObject(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function isObjectLike(e){return e!=null&&typeof e=="object"}var Ls=yr?baseUnary(yr):baseIsMap;function isMatch(e,t){return e===t||baseIsMatch(e,t,getMatchData(t))}function isMatchWith(e,t,s){s=typeof s=="function"?s:r;return baseIsMatch(e,t,getMatchData(t),s)}function isNaN(e){return isNumber(e)&&e!=+e}function isNative(e){if(Gr(e)){throw new Qe(n)}return baseIsNative(e)}function isNull(e){return e===null}function isNil(e){return e==null}function isNumber(e){return typeof e=="number"||isObjectLike(e)&&baseGetTag(e)==J}function isPlainObject(e){if(!isObjectLike(e)||baseGetTag(e)!=Q){return false}var t=St(e);if(t===null){return true}var r=ft.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&dt.call(r)==bt}var Bs=gr?baseUnary(gr):baseIsRegExp;function isSafeInteger(e){return isInteger(e)&&e>=-R&&e<=R}var Ws=hr?baseUnary(hr):baseIsSet;function isString(e){return typeof e=="string"||!Ns(e)&&isObjectLike(e)&&baseGetTag(e)==ae}function isSymbol(e){return typeof e=="symbol"||isObjectLike(e)&&baseGetTag(e)==ne}var Us=br?baseUnary(br):baseIsTypedArray;function isUndefined(e){return e===r}function isWeakMap(e){return isObjectLike(e)&&qr(e)==ie}function isWeakSet(e){return isObjectLike(e)&&baseGetTag(e)==le}var $s=createRelationalOperation(baseLt);var Vs=createRelationalOperation((function(e,t){return e<=t}));function toArray(e){if(!e){return[]}if(isArrayLike(e)){return isString(e)?stringToArray(e):copyArray(e)}if(Dt&&e[Dt]){return iteratorToArray(e[Dt]())}var t=qr(e),r=t==Y?mapToArray:t==se?setToArray:values;return r(e)}function toFinite(e){if(!e){return e===0?e:0}e=toNumber(e);if(e===A||e===-A){var t=e<0?-1:1;return t*N}return e===e?e:0}function toInteger(e){var t=toFinite(e),r=t%1;return t===t?r?t-r:t:0}function toLength(e){return e?baseClamp(toInteger(e),0,F):0}function toNumber(e){if(typeof e=="number"){return e}if(isSymbol(e)){return M}if(isObject(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=isObject(t)?t+"":t}if(typeof e!="string"){return e===0?e:+e}e=e.replace(Te,"");var r=He.test(e);return r||Ke.test(e)?ar(e.slice(2),r?2:8):Ge.test(e)?M:+e}function toPlainObject(e){return copyObject(e,keysIn(e))}function toSafeInteger(e){return e?baseClamp(toInteger(e),-R,R):e===0?e:0}function toString(e){return e==null?"":baseToString(e)}var qs=createAssigner((function(e,t){if(isPrototype(t)||isArrayLike(t)){copyObject(t,keys(t),e);return}for(var r in t){if(ft.call(t,r)){assignValue(e,r,t[r])}}}));var Gs=createAssigner((function(e,t){copyObject(t,keysIn(t),e)}));var Hs=createAssigner((function(e,t,r,s){copyObject(t,keysIn(t),e,s)}));var zs=createAssigner((function(e,t,r,s){copyObject(t,keys(t),e,s)}));var Ks=flatRest(baseAt);function create(e,t){var r=Cr(e);return t==null?r:baseAssign(r,t)}var Xs=baseRest((function(e,t){e=rt(e);var s=-1;var a=t.length;var n=a>2?t[2]:r;if(n&&isIterateeCall(t[0],t[1],n)){a=1}while(++s1);return t}));copyObject(e,getAllKeysIn(e),r);if(s){r=baseClone(r,u|p|d,customOmitClone)}var a=t.length;while(a--){baseUnset(r,t[a])}return r}));function omitBy(e,t){return pickBy(e,negate(getIteratee(t)))}var sa=flatRest((function(e,t){return e==null?{}:basePick(e,t)}));function pickBy(e,t){if(e==null){return{}}var r=arrayMap(getAllKeysIn(e),(function(e){return[e]}));t=getIteratee(t);return basePickBy(e,r,(function(e,r){return t(e,r[0])}))}function result(e,t,s){t=castPath(t,e);var a=-1,n=t.length;if(!n){n=1;e=r}while(++at){var a=e;e=t;t=a}if(s||e%1||t%1){var n=Qt();return Ht(e+n*(t-e+sr("1e-"+((n+"").length-1))),t)}return baseRandom(e,t)}var oa=createCompounder((function(e,t,r){t=t.toLowerCase();return e+(r?capitalize(t):t)}));function capitalize(e){return fa(toString(e).toLowerCase())}function deburr(e){e=toString(e);return e&&e.replace(Ye,vr).replace(qt,"")}function endsWith(e,t,s){e=toString(e);t=baseToString(t);var a=e.length;s=s===r?a:baseClamp(toInteger(s),0,a);var n=s;s-=t.length;return s>=0&&e.slice(s,n)==t}function escape(e){e=toString(e);return e&&Oe.test(e)?e.replace(_e,Er):e}function escapeRegExp(e){e=toString(e);return e&&Ne.test(e)?e.replace(Re,"\\$&"):e}var ia=createCompounder((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}));var la=createCompounder((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}));var ca=createCaseFirst("toLowerCase");function pad(e,t,r){e=toString(e);t=toInteger(t);var s=t?stringSize(e):0;if(!t||s>=t){return e}var a=(t-s)/2;return createPadding(Ft(a),r)+e+createPadding(Mt(a),r)}function padEnd(e,t,r){e=toString(e);t=toInteger(t);var s=t?stringSize(e):0;return t&&s>>0;if(!s){return[]}e=toString(e);if(e&&(typeof t=="string"||t!=null&&!Bs(t))){t=baseToString(t);if(!t&&hasUnicode(e)){return castSlice(stringToArray(e),0,s)}}return e.split(t,s)}var pa=createCompounder((function(e,t,r){return e+(r?" ":"")+fa(t)}));function startsWith(e,t,r){e=toString(e);r=r==null?0:baseClamp(toInteger(r),0,e.length);t=baseToString(t);return e.slice(r,r+t.length)==t}function template(e,t,s){var a=lodash.templateSettings;if(s&&isIterateeCall(e,t,s)){t=r}e=toString(e);t=Hs({},t,a,customDefaultsAssignIn);var n=Hs({},t.imports,a.imports,customDefaultsAssignIn),o=keys(n),i=baseValues(n,o);var l,c,u=0,p=t.interpolate||Je,d="__p += '";var f=st((t.escape||Je).source+"|"+p.source+"|"+(p===Ie?Ve:Je).source+"|"+(t.evaluate||Je).source+"|$","g");var m="//# sourceURL="+(ft.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Yt+"]")+"\n";e.replace(f,(function(t,r,s,a,n,o){s||(s=a);d+=e.slice(u,o).replace(Ze,escapeStringChar);if(r){l=true;d+="' +\n__e("+r+") +\n'"}if(n){c=true;d+="';\n"+n+";\n__p += '"}if(s){d+="' +\n((__t = ("+s+")) == null ? '' : __t) +\n'"}u=o+t.length;return t}));d+="';\n";var y=ft.call(t,"variable")&&t.variable;if(!y){d="with (obj) {\n"+d+"\n}\n"}d=(c?d.replace(ve,""):d).replace(Ee,"$1").replace(je,"$1;");d="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(l?", __e = _.escape":"")+(c?", __j = Array.prototype.join;\n"+"function print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=ma((function(){return et(o,m+"return "+d).apply(r,i)}));g.source=d;if(isError(g)){throw g}return g}function toLower(e){return toString(e).toLowerCase()}function toUpper(e){return toString(e).toUpperCase()}function trim(e,t,s){e=toString(e);if(e&&(s||t===r)){return e.replace(Te,"")}if(!e||!(t=baseToString(t))){return e}var a=stringToArray(e),n=stringToArray(t),o=charsStartIndex(a,n),i=charsEndIndex(a,n)+1;return castSlice(a,o,i).join("")}function trimEnd(e,t,s){e=toString(e);if(e&&(s||t===r)){return e.replace(Fe,"")}if(!e||!(t=baseToString(t))){return e}var a=stringToArray(e),n=charsEndIndex(a,stringToArray(t))+1;return castSlice(a,0,n).join("")}function trimStart(e,t,s){e=toString(e);if(e&&(s||t===r)){return e.replace(Me,"")}if(!e||!(t=baseToString(t))){return e}var a=stringToArray(e),n=charsStartIndex(a,stringToArray(t));return castSlice(a,n).join("")}function truncate(e,t){var s=S,a=O;if(isObject(t)){var n="separator"in t?t.separator:n;s="length"in t?toInteger(t.length):s;a="omission"in t?baseToString(t.omission):a}e=toString(e);var o=e.length;if(hasUnicode(e)){var i=stringToArray(e);o=i.length}if(s>=o){return e}var l=s-stringSize(a);if(l<1){return a}var c=i?castSlice(i,0,l).join(""):e.slice(0,l);if(n===r){return c+a}if(i){l+=c.length-l}if(Bs(n)){if(e.slice(l).search(n)){var u,p=c;if(!n.global){n=st(n.source,toString(qe.exec(n))+"g")}n.lastIndex=0;while(u=n.exec(p)){var d=u.index}c=c.slice(0,d===r?l:d)}}else if(e.indexOf(baseToString(n),l)!=l){var f=c.lastIndexOf(n);if(f>-1){c=c.slice(0,f)}}return c+a}function unescape(e){e=toString(e);return e&&Se.test(e)?e.replace(we,jr):e}var da=createCompounder((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}));var fa=createCaseFirst("toUpperCase");function words(e,t,s){e=toString(e);t=s?r:t;if(t===r){return hasUnicodeWord(e)?unicodeWords(e):asciiWords(e)}return e.match(t)||[]}var ma=baseRest((function(e,t){try{return apply(e,r,t)}catch(e){return isError(e)?e:new Qe(e)}}));var ya=flatRest((function(e,t){arrayEach(t,(function(t){t=toKey(t);baseAssignValue(e,t,ws(e[t],e))}));return e}));function cond(e){var t=e==null?0:e.length,r=getIteratee();e=!t?[]:arrayMap(e,(function(e){if(typeof e[1]!="function"){throw new nt(o)}return[r(e[0]),e[1]]}));return baseRest((function(r){var s=-1;while(++sR){return[]}var r=F,s=Ht(e,F);t=getIteratee(t);e-=F;var a=baseTimes(s,t);while(++r0||t<0)){return new LazyWrapper(s)}if(e<0){s=s.takeRight(-e)}else if(e){s=s.drop(e)}if(t!==r){t=toInteger(t);s=t<0?s.dropRight(-t):s.take(t-e)}return s};LazyWrapper.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()};LazyWrapper.prototype.toArray=function(){return this.take(F)};baseForOwn(LazyWrapper.prototype,(function(e,t){var s=/^(?:filter|find|map|reject)|While$/.test(t),a=/^(?:head|last)$/.test(t),n=lodash[a?"take"+(t=="last"?"Right":""):t],o=a||/^find/.test(t);if(!n){return}lodash.prototype[t]=function(){var t=this.__wrapped__,i=a?[1]:arguments,l=t instanceof LazyWrapper,c=i[0],u=l||Ns(t);var interceptor=function(e){var t=n.apply(lodash,arrayPush([e],i));return a&&p?t[0]:t};if(u&&s&&typeof c=="function"&&c.length!=1){l=u=false}var p=this.__chain__,d=!!this.__actions__.length,f=o&&!p,m=l&&!d;if(!o&&u){t=m?t:new LazyWrapper(this);var y=e.apply(t,i);y.__actions__.push({func:thru,args:[interceptor],thisArg:r});return new LodashWrapper(y,p)}if(f&&m){return e.apply(this,i)}y=this.thru(interceptor);return f?a?y.value()[0]:y.value():y}}));arrayEach(["pop","push","shift","sort","splice","unshift"],(function(e){var t=ot[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",s=/^(?:pop|shift)$/.test(e);lodash.prototype[e]=function(){var e=arguments;if(s&&!this.__chain__){var a=this.value();return t.apply(Ns(a)?a:[],e)}return this[r]((function(r){return t.apply(Ns(r)?r:[],e)}))}}));baseForOwn(LazyWrapper.prototype,(function(e,t){var r=lodash[t];if(r){var s=r.name+"";if(!ft.call(dr,s)){dr[s]=[]}dr[s].push({name:t,func:r})}}));dr[createHybrid(r,g).name]=[{name:"wrapper",func:r}];LazyWrapper.prototype.clone=lazyClone;LazyWrapper.prototype.reverse=lazyReverse;LazyWrapper.prototype.value=lazyValue;lodash.prototype.at=fs;lodash.prototype.chain=wrapperChain;lodash.prototype.commit=wrapperCommit;lodash.prototype.next=wrapperNext;lodash.prototype.plant=wrapperPlant;lodash.prototype.reverse=wrapperReverse;lodash.prototype.toJSON=lodash.prototype.valueOf=lodash.prototype.value=wrapperValue;lodash.prototype.first=lodash.prototype.head;if(Dt){lodash.prototype[Dt]=wrapperToIterator}return lodash};var _r=wr();if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){ir._=_r;define((function(){return _r}))}else if(cr){(cr.exports=_r)._=_r;lr._=_r}else{ir._=_r}}).call(this)},2742:e=>{"use strict";var t=process.platform==="win32";var r=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;var s=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/;var a={};function win32SplitPath(e){var t=r.exec(e),a=(t[1]||"")+(t[2]||""),n=t[3]||"";var o=s.exec(n),i=o[1],l=o[2],c=o[3];return[a,i,l,c]}a.parse=function(e){if(typeof e!=="string"){throw new TypeError("Parameter 'pathString' must be a string, not "+typeof e)}var t=win32SplitPath(e);if(!t||t.length!==4){throw new TypeError("Invalid path '"+e+"'")}return{root:t[0],dir:t[0]+t[1].slice(0,-1),base:t[2],ext:t[3],name:t[2].slice(0,t[2].length-t[3].length)}};var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var o={};function posixSplitPath(e){return n.exec(e).slice(1)}o.parse=function(e){if(typeof e!=="string"){throw new TypeError("Parameter 'pathString' must be a string, not "+typeof e)}var t=posixSplitPath(e);if(!t||t.length!==4){throw new TypeError("Invalid path '"+e+"'")}t[1]=t[1]||"";t[2]=t[2]||"";t[3]=t[3]||"";return{root:t[0],dir:t[0]+t[1].slice(0,-1),base:t[2],ext:t[3],name:t[2].slice(0,t[2].length-t[3].length)}};if(t)e.exports=a.parse;else e.exports=o.parse;e.exports.posix=o.parse;e.exports.win32=a.parse},1782:(e,t)=>{"use strict";var r=Object;var s=Object.defineProperty;var a=Object.create;function defProp(e,t,a){if(s)try{s.call(r,e,t,{value:a})}catch(r){e[t]=a}else{e[t]=a}}function makeSafeToCall(e){if(e){defProp(e,"call",e.call);defProp(e,"apply",e.apply)}return e}makeSafeToCall(s);makeSafeToCall(a);var n=makeSafeToCall(Object.prototype.hasOwnProperty);var o=makeSafeToCall(Number.prototype.toString);var i=makeSafeToCall(String.prototype.slice);var cloner=function(){};function create(e){if(a){return a.call(r,e)}cloner.prototype=e||null;return new cloner}var l=Math.random;var c=create(null);function makeUniqueKey(){do{var e=internString(i.call(o.call(l(),36),2))}while(n.call(c,e));return c[e]=e}function internString(e){var t={};t[e]=true;return Object.keys(t)[0]}t.makeUniqueKey=makeUniqueKey;var u=Object.getOwnPropertyNames;Object.getOwnPropertyNames=function getOwnPropertyNames(e){for(var t=u(e),r=0,s=0,a=t.length;rs){t[s]=t[r]}++s}}t.length=s;return t};function defaultCreatorFn(e){return create(null)}function makeAccessor(e){var t=makeUniqueKey();var r=create(null);e=e||defaultCreatorFn;function register(s){var a;function vault(t,n){if(t===r){return n?a=null:a||(a=e(s))}}defProp(s,t,vault)}function accessor(e){if(!n.call(e,t))register(e);return e[t](r)}accessor.forget=function(e){if(n.call(e,t))e[t](r,true)};return accessor}t.makeAccessor=makeAccessor},8741:function(e,t,r){e=r.nmd(e); -/*! https://mths.be/regenerate v1.3.3 by @mathias | MIT license */(function(r){var s=true&&t;var a=true&&e&&e.exports==s&&e;var n=typeof global=="object"&&global;if(n.global===n||n.window===n){r=n}var o={rangeOrder:"A range’s `stop` value must be greater than or equal "+"to the `start` value.",codePointRange:"Invalid code point value. Code points range from "+"U+000000 to U+10FFFF."};var i=55296;var l=56319;var c=56320;var u=57343;var p=/\\x00([^0123456789]|$)/g;var d={};var f=d.hasOwnProperty;var extend=function(e,t){var r;for(r in t){if(f.call(t,r)){e[r]=t[r]}}return e};var forEach=function(e,t){var r=-1;var s=e.length;while(++r=s&&tr){return e}if(t<=a&&r>=n){e.splice(s,2);continue}if(t>=a&&r=a&&t<=n){e[s+1]=t}else if(r>=a&&r<=n){e[s]=r+1;return e}s+=2}return e};var dataAdd=function(e,t){var r=0;var s;var a;var n=null;var i=e.length;if(t<0||t>1114111){throw RangeError(o.codePointRange)}while(r=s&&tt){e.splice(n!=null?n+2:0,0,t,t+1);return e}if(t==a){if(t+1==e[r+2]){e.splice(r,4,s,e[r+3]);return e}e[r+1]=t+1;return e}n=r;r+=2}e.push(t,t+1);return e};var dataAddData=function(e,t){var r=0;var s;var a;var n=e.slice();var o=t.length;while(r1114111||r<0||r>1114111){throw RangeError(o.codePointRange)}var s=0;var a;var n;var i=false;var l=e.length;while(sr){return e}if(a>=t&&a<=r){if(n>t&&n-1<=r){e.splice(s,2);s-=2}else{e.splice(s-1,2);s-=2}}}else if(a==r+1){e[s]=t;return e}else if(a>r){e.splice(s,0,t,r+1);return e}else if(t>=a&&t=a&&t=n){e[s]=t;e[s+1]=r+1;i=true}s+=2}if(!i){e.push(t,r+1)}return e};var dataContains=function(e,t){var r=0;var s=e.length;var a=e[r];var n=e[s-1];if(s>=2){if(tn){return false}}while(r=a&&t=40&&e<=43||e==46||e==47||e==63||e>=91&&e<=94||e>=123&&e<=125){t="\\"+b(e)}else if(e>=32&&e<=126){t=b(e)}else if(e<=255){t="\\x"+pad(hex(e),2)}else{t="\\u"+pad(hex(e),4)}return t};var codePointToStringUnicode=function(e){if(e<=65535){return codePointToString(e)}return"\\u{"+e.toString(16).toUpperCase()+"}"};var symbolToCodePoint=function(e){var t=e.length;var r=e.charCodeAt(0);var s;if(r>=i&&r<=l&&t>1){s=e.charCodeAt(1);return(r-i)*1024+s-c+65536}return r};var createBMPCharacterClasses=function(e){var t="";var r=0;var s;var a;var n=e.length;if(dataIsSingleton(e)){return codePointToString(e[0])}while(r=i&&p<=l){s.push(o,i);t.push(i,p+1)}if(p>=c&&p<=u){s.push(o,i);t.push(i,l+1);r.push(c,p+1)}if(p>u){s.push(o,i);t.push(i,l+1);r.push(c,u+1);if(p<=65535){s.push(u+1,p+1)}else{s.push(u+1,65535+1);a.push(65535+1,p+1)}}}else if(o>=i&&o<=l){if(p>=i&&p<=l){t.push(o,p+1)}if(p>=c&&p<=u){t.push(o,l+1);r.push(c,p+1)}if(p>u){t.push(o,l+1);r.push(c,u+1);if(p<=65535){s.push(u+1,p+1)}else{s.push(u+1,65535+1);a.push(65535+1,p+1)}}}else if(o>=c&&o<=u){if(p>=c&&p<=u){r.push(o,p+1)}if(p>u){r.push(o,u+1);if(p<=65535){s.push(u+1,p+1)}else{s.push(u+1,65535+1);a.push(65535+1,p+1)}}}else if(o>u&&o<=65535){if(p<=65535){s.push(o,p+1)}else{s.push(o,65535+1);a.push(65535+1,p+1)}}else{a.push(o,p+1)}n+=2}return{loneHighSurrogates:t,loneLowSurrogates:r,bmp:s,astral:a}};var optimizeSurrogateMappings=function(e){var t=[];var r=[];var s=false;var a;var n;var o;var i;var l;var c;var u=-1;var p=e.length;while(++u1){e=g.call(arguments)}if(this instanceof regenerate){this.data=[];return e?this.add(e):this}return(new regenerate).add(e)};regenerate.version="1.3.3";var x=regenerate.prototype;extend(x,{add:function(e){var t=this;if(e==null){return t}if(e instanceof regenerate){t.data=dataAddData(t.data,e.data);return t}if(arguments.length>1){e=g.call(arguments)}if(isArray(e)){forEach(e,(function(e){t.add(e)}));return t}t.data=dataAdd(t.data,isNumber(e)?e:symbolToCodePoint(e));return t},remove:function(e){var t=this;if(e==null){return t}if(e instanceof regenerate){t.data=dataRemoveData(t.data,e.data);return t}if(arguments.length>1){e=g.call(arguments)}if(isArray(e)){forEach(e,(function(e){t.remove(e)}));return t}t.data=dataRemove(t.data,isNumber(e)?e:symbolToCodePoint(e));return t},addRange:function(e,t){var r=this;r.data=dataAddRange(r.data,isNumber(e)?e:symbolToCodePoint(e),isNumber(t)?t:symbolToCodePoint(t));return r},removeRange:function(e,t){var r=this;var s=isNumber(e)?e:symbolToCodePoint(e);var a=isNumber(t)?t:symbolToCodePoint(t);r.data=dataRemoveRange(r.data,s,a);return r},intersection:function(e){var t=this;var r=e instanceof regenerate?dataToArray(e.data):e;t.data=dataIntersection(t.data,r);return t},contains:function(e){return dataContains(this.data,isNumber(e)?e:symbolToCodePoint(e))},clone:function(){var e=new regenerate;e.data=this.data.slice(0);return e},toString:function(e){var t=createCharacterClassesFromData(this.data,e?e.bmpOnly:false,e?e.hasUnicodeFlag:false);if(!t){return"[]"}return t.replace(p,"\\0$1")},toRegExp:function(e){var t=this.toString(e&&e.indexOf("u")!=-1?{hasUnicodeFlag:true}:null);return RegExp(t,e||"")},valueOf:function(){return dataToArray(this.data)}});x.toArray=x.valueOf;if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define((function(){return regenerate}))}else if(s&&!s.nodeType){if(a){a.exports=regenerate}else{s.regenerate=regenerate}}else{r.regenerate=regenerate}})(this)},6419:(e,t,r)=>{"use strict";var s=r(449);var a=r(6919);var n=a(r(9491));var o=s(r(9048));var i=s(r(3085));var l=s(r(6401));var c=Object.prototype.hasOwnProperty;function Emitter(e){n["default"].ok(this instanceof Emitter);l.getTypes().assertIdentifier(e);this.nextTempId=0;this.contextId=e;this.listing=[];this.marked=[true];this.insertedLocs=new Set;this.finalLoc=this.loc();this.tryEntries=[];this.leapManager=new o.LeapManager(this)}var u=Emitter.prototype;t.Emitter=Emitter;u.loc=function(){var e=l.getTypes().numericLiteral(-1);this.insertedLocs.add(e);return e};u.getInsertedLocs=function(){return this.insertedLocs};u.getContextId=function(){return l.getTypes().clone(this.contextId)};u.mark=function(e){l.getTypes().assertLiteral(e);var t=this.listing.length;if(e.value===-1){e.value=t}else{n["default"].strictEqual(e.value,t)}this.marked[t]=true;return e};u.emit=function(e){var t=l.getTypes();if(t.isExpression(e)){e=t.expressionStatement(e)}t.assertStatement(e);this.listing.push(e)};u.emitAssign=function(e,t){this.emit(this.assign(e,t));return e};u.assign=function(e,t){var r=l.getTypes();return r.expressionStatement(r.assignmentExpression("=",r.cloneDeep(e),t))};u.contextProperty=function(e,t){var r=l.getTypes();return r.memberExpression(this.getContextId(),t?r.stringLiteral(e):r.identifier(e),!!t)};u.stop=function(e){if(e){this.setReturnValue(e)}this.jump(this.finalLoc)};u.setReturnValue=function(e){l.getTypes().assertExpression(e.value);this.emitAssign(this.contextProperty("rval"),this.explodeExpression(e))};u.clearPendingException=function(e,t){var r=l.getTypes();r.assertLiteral(e);var s=r.callExpression(this.contextProperty("catch",true),[r.clone(e)]);if(t){this.emitAssign(t,s)}else{this.emit(s)}};u.jump=function(e){this.emitAssign(this.contextProperty("next"),e);this.emit(l.getTypes().breakStatement())};u.jumpIf=function(e,t){var r=l.getTypes();r.assertExpression(e);r.assertLiteral(t);this.emit(r.ifStatement(e,r.blockStatement([this.assign(this.contextProperty("next"),t),r.breakStatement()])))};u.jumpIfNot=function(e,t){var r=l.getTypes();r.assertExpression(e);r.assertLiteral(t);var s;if(r.isUnaryExpression(e)&&e.operator==="!"){s=e.argument}else{s=r.unaryExpression("!",e)}this.emit(r.ifStatement(s,r.blockStatement([this.assign(this.contextProperty("next"),t),r.breakStatement()])))};u.makeTempVar=function(){return this.contextProperty("t"+this.nextTempId++)};u.getContextFunction=function(e){var t=l.getTypes();return t.functionExpression(e||null,[this.getContextId()],t.blockStatement([this.getDispatchLoop()]),false,false)};u.getDispatchLoop=function(){var e=this;var t=l.getTypes();var r=[];var s;var a=false;e.listing.forEach((function(n,o){if(e.marked.hasOwnProperty(o)){r.push(t.switchCase(t.numericLiteral(o),s=[]));a=false}if(!a){s.push(n);if(t.isCompletionStatement(n))a=true}}));this.finalLoc.value=this.listing.length;r.push(t.switchCase(this.finalLoc,[]),t.switchCase(t.stringLiteral("end"),[t.returnStatement(t.callExpression(this.contextProperty("stop"),[]))]));return t.whileStatement(t.numericLiteral(1),t.switchStatement(t.assignmentExpression("=",this.contextProperty("prev"),this.contextProperty("next")),r))};u.getTryLocsList=function(){if(this.tryEntries.length===0){return null}var e=l.getTypes();var t=0;return e.arrayExpression(this.tryEntries.map((function(r){var s=r.firstLoc.value;n["default"].ok(s>=t,"try entries out of order");t=s;var a=r.catchEntry;var o=r.finallyEntry;var i=[r.firstLoc,a?a.firstLoc:null];if(o){i[2]=o.firstLoc;i[3]=o.afterLoc}return e.arrayExpression(i.map((function(t){return t&&e.clone(t)})))})))};u.explode=function(e,t){var r=l.getTypes();var s=e.node;var a=this;r.assertNode(s);if(r.isDeclaration(s))throw getDeclError(s);if(r.isStatement(s))return a.explodeStatement(e);if(r.isExpression(s))return a.explodeExpression(e,t);switch(s.type){case"Program":return e.get("body").map(a.explodeStatement,a);case"VariableDeclarator":throw getDeclError(s);case"Property":case"SwitchCase":case"CatchClause":throw new Error(s.type+" nodes should be handled by their parents");default:throw new Error("unknown Node of type "+JSON.stringify(s.type))}};function getDeclError(e){return new Error("all declarations should have been transformed into "+"assignments before the Exploder began its work: "+JSON.stringify(e))}u.explodeStatement=function(e,t){var r=l.getTypes();var s=e.node;var a=this;var c,u,d;r.assertStatement(s);if(t){r.assertIdentifier(t)}else{t=null}if(r.isBlockStatement(s)){e.get("body").forEach((function(e){a.explodeStatement(e)}));return}if(!i.containsLeap(s)){a.emit(s);return}switch(s.type){case"ExpressionStatement":a.explodeExpression(e.get("expression"),true);break;case"LabeledStatement":u=this.loc();a.leapManager.withEntry(new o.LabeledEntry(u,s.label),(function(){a.explodeStatement(e.get("body"),s.label)}));a.mark(u);break;case"WhileStatement":c=this.loc();u=this.loc();a.mark(c);a.jumpIfNot(a.explodeExpression(e.get("test")),u);a.leapManager.withEntry(new o.LoopEntry(u,c,t),(function(){a.explodeStatement(e.get("body"))}));a.jump(c);a.mark(u);break;case"DoWhileStatement":var f=this.loc();var m=this.loc();u=this.loc();a.mark(f);a.leapManager.withEntry(new o.LoopEntry(u,m,t),(function(){a.explode(e.get("body"))}));a.mark(m);a.jumpIf(a.explodeExpression(e.get("test")),f);a.mark(u);break;case"ForStatement":d=this.loc();var y=this.loc();u=this.loc();if(s.init){a.explode(e.get("init"),true)}a.mark(d);if(s.test){a.jumpIfNot(a.explodeExpression(e.get("test")),u)}else{}a.leapManager.withEntry(new o.LoopEntry(u,y,t),(function(){a.explodeStatement(e.get("body"))}));a.mark(y);if(s.update){a.explode(e.get("update"),true)}a.jump(d);a.mark(u);break;case"TypeCastExpression":return a.explodeExpression(e.get("expression"));case"ForInStatement":d=this.loc();u=this.loc();var g=a.makeTempVar();a.emitAssign(g,r.callExpression(l.runtimeProperty("keys"),[a.explodeExpression(e.get("right"))]));a.mark(d);var h=a.makeTempVar();a.jumpIf(r.memberExpression(r.assignmentExpression("=",h,r.callExpression(r.cloneDeep(g),[])),r.identifier("done"),false),u);a.emitAssign(s.left,r.memberExpression(r.cloneDeep(h),r.identifier("value"),false));a.leapManager.withEntry(new o.LoopEntry(u,d,t),(function(){a.explodeStatement(e.get("body"))}));a.jump(d);a.mark(u);break;case"BreakStatement":a.emitAbruptCompletion({type:"break",target:a.leapManager.getBreakLoc(s.label)});break;case"ContinueStatement":a.emitAbruptCompletion({type:"continue",target:a.leapManager.getContinueLoc(s.label)});break;case"SwitchStatement":var b=a.emitAssign(a.makeTempVar(),a.explodeExpression(e.get("discriminant")));u=this.loc();var x=this.loc();var v=x;var E=[];var j=s.cases||[];for(var w=j.length-1;w>=0;--w){var _=j[w];r.assertSwitchCase(_);if(_.test){v=r.conditionalExpression(r.binaryExpression("===",r.cloneDeep(b),_.test),E[w]=this.loc(),v)}else{E[w]=x}}var S=e.get("discriminant");l.replaceWithOrRemove(S,v);a.jump(a.explodeExpression(S));a.leapManager.withEntry(new o.SwitchEntry(u),(function(){e.get("cases").forEach((function(e){var t=e.key;a.mark(E[t]);e.get("consequent").forEach((function(e){a.explodeStatement(e)}))}))}));a.mark(u);if(x.value===-1){a.mark(x);n["default"].strictEqual(u.value,x.value)}break;case"IfStatement":var O=s.alternate&&this.loc();u=this.loc();a.jumpIfNot(a.explodeExpression(e.get("test")),O||u);a.explodeStatement(e.get("consequent"));if(O){a.jump(u);a.mark(O);a.explodeStatement(e.get("alternate"))}a.mark(u);break;case"ReturnStatement":a.emitAbruptCompletion({type:"return",value:a.explodeExpression(e.get("argument"))});break;case"WithStatement":throw new Error("WithStatement not supported in generator functions.");case"TryStatement":u=this.loc();var k=s.handler;var P=k&&this.loc();var I=P&&new o.CatchEntry(P,k.param);var D=s.finalizer&&this.loc();var C=D&&new o.FinallyEntry(D,u);var A=new o.TryEntry(a.getUnmarkedCurrentLoc(),I,C);a.tryEntries.push(A);a.updateContextPrevLoc(A.firstLoc);a.leapManager.withEntry(A,(function(){a.explodeStatement(e.get("block"));if(P){if(D){a.jump(D)}else{a.jump(u)}a.updateContextPrevLoc(a.mark(P));var t=e.get("handler.body");var s=a.makeTempVar();a.clearPendingException(A.firstLoc,s);t.traverse(p,{getSafeParam:function getSafeParam(){return r.cloneDeep(s)},catchParamName:k.param.name});a.leapManager.withEntry(I,(function(){a.explodeStatement(t)}))}if(D){a.updateContextPrevLoc(a.mark(D));a.leapManager.withEntry(C,(function(){a.explodeStatement(e.get("finalizer"))}));a.emit(r.returnStatement(r.callExpression(a.contextProperty("finish"),[C.firstLoc])))}}));a.mark(u);break;case"ThrowStatement":a.emit(r.throwStatement(a.explodeExpression(e.get("argument"))));break;default:throw new Error("unknown Statement of type "+JSON.stringify(s.type))}};var p={Identifier:function Identifier(e,t){if(e.node.name===t.catchParamName&&l.isReference(e)){l.replaceWithOrRemove(e,t.getSafeParam())}},Scope:function Scope(e,t){if(e.scope.hasOwnBinding(t.catchParamName)){e.skip()}}};u.emitAbruptCompletion=function(e){if(!isValidCompletion(e)){n["default"].ok(false,"invalid completion record: "+JSON.stringify(e))}n["default"].notStrictEqual(e.type,"normal","normal completions are not abrupt");var t=l.getTypes();var r=[t.stringLiteral(e.type)];if(e.type==="break"||e.type==="continue"){t.assertLiteral(e.target);r[1]=this.insertedLocs.has(e.target)?e.target:t.cloneDeep(e.target)}else if(e.type==="return"||e.type==="throw"){if(e.value){t.assertExpression(e.value);r[1]=this.insertedLocs.has(e.value)?e.value:t.cloneDeep(e.value)}}this.emit(t.returnStatement(t.callExpression(this.contextProperty("abrupt"),r)))};function isValidCompletion(e){var t=e.type;if(t==="normal"){return!c.call(e,"target")}if(t==="break"||t==="continue"){return!c.call(e,"value")&&l.getTypes().isLiteral(e.target)}if(t==="return"||t==="throw"){return c.call(e,"value")&&!c.call(e,"target")}return false}u.getUnmarkedCurrentLoc=function(){return l.getTypes().numericLiteral(this.listing.length)};u.updateContextPrevLoc=function(e){var t=l.getTypes();if(e){t.assertLiteral(e);if(e.value===-1){e.value=this.listing.length}else{n["default"].strictEqual(e.value,this.listing.length)}}else{e=this.getUnmarkedCurrentLoc()}this.emitAssign(this.contextProperty("prev"),e)};u.explodeExpression=function(e,t){var r=l.getTypes();var s=e.node;if(s){r.assertExpression(s)}else{return s}var a=this;var o;var c;function finish(e){r.assertExpression(e);if(t){a.emit(e)}else{return e}}if(!i.containsLeap(s)){return finish(s)}var u=i.containsLeap.onlyChildren(s);function explodeViaTempVar(e,t,s){n["default"].ok(!s||!e,"Ignoring the result of a child expression but forcing it to "+"be assigned to a temporary variable?");var o=a.explodeExpression(t,s);if(s){}else if(e||u&&!r.isLiteral(o)){o=a.emitAssign(e||a.makeTempVar(),o)}return o}switch(s.type){case"MemberExpression":return finish(r.memberExpression(a.explodeExpression(e.get("object")),s.computed?explodeViaTempVar(null,e.get("property")):s.property,s.computed));case"CallExpression":var p=e.get("callee");var d=e.get("arguments");var f;var m;var y=d.some((function(e){return i.containsLeap(e.node)}));var g=null;if(r.isMemberExpression(p.node)){if(y){var h=explodeViaTempVar(a.makeTempVar(),p.get("object"));var b=p.node.computed?explodeViaTempVar(null,p.get("property")):p.node.property;g=h;f=r.memberExpression(r.memberExpression(r.cloneDeep(h),b,p.node.computed),r.identifier("call"),false)}else{f=a.explodeExpression(p)}}else{f=explodeViaTempVar(null,p);if(r.isMemberExpression(f)){f=r.sequenceExpression([r.numericLiteral(0),r.cloneDeep(f)])}}if(y){m=d.map((function(e){return explodeViaTempVar(null,e)}));if(g)m.unshift(g);m=m.map((function(e){return r.cloneDeep(e)}))}else{m=e.node.arguments}return finish(r.callExpression(f,m));case"NewExpression":return finish(r.newExpression(explodeViaTempVar(null,e.get("callee")),e.get("arguments").map((function(e){return explodeViaTempVar(null,e)}))));case"ObjectExpression":return finish(r.objectExpression(e.get("properties").map((function(e){if(e.isObjectProperty()){return r.objectProperty(e.node.key,explodeViaTempVar(null,e.get("value")),e.node.computed)}else{return e.node}}))));case"ArrayExpression":return finish(r.arrayExpression(e.get("elements").map((function(e){if(e.isSpreadElement()){return r.spreadElement(explodeViaTempVar(null,e.get("argument")))}else{return explodeViaTempVar(null,e)}}))));case"SequenceExpression":var x=s.expressions.length-1;e.get("expressions").forEach((function(e){if(e.key===x){o=a.explodeExpression(e,t)}else{a.explodeExpression(e,true)}}));return o;case"LogicalExpression":c=this.loc();if(!t){o=a.makeTempVar()}var v=explodeViaTempVar(o,e.get("left"));if(s.operator==="&&"){a.jumpIfNot(v,c)}else{n["default"].strictEqual(s.operator,"||");a.jumpIf(v,c)}explodeViaTempVar(o,e.get("right"),t);a.mark(c);return o;case"ConditionalExpression":var E=this.loc();c=this.loc();var j=a.explodeExpression(e.get("test"));a.jumpIfNot(j,E);if(!t){o=a.makeTempVar()}explodeViaTempVar(o,e.get("consequent"),t);a.jump(c);a.mark(E);explodeViaTempVar(o,e.get("alternate"),t);a.mark(c);return o;case"UnaryExpression":return finish(r.unaryExpression(s.operator,a.explodeExpression(e.get("argument")),!!s.prefix));case"BinaryExpression":return finish(r.binaryExpression(s.operator,explodeViaTempVar(null,e.get("left")),explodeViaTempVar(null,e.get("right"))));case"AssignmentExpression":if(s.operator==="="){return finish(r.assignmentExpression(s.operator,a.explodeExpression(e.get("left")),a.explodeExpression(e.get("right"))))}var w=a.explodeExpression(e.get("left"));var _=a.emitAssign(a.makeTempVar(),w);return finish(r.assignmentExpression("=",r.cloneDeep(w),r.assignmentExpression(s.operator,r.cloneDeep(_),a.explodeExpression(e.get("right")))));case"UpdateExpression":return finish(r.updateExpression(s.operator,a.explodeExpression(e.get("argument")),s.prefix));case"YieldExpression":c=this.loc();var S=s.argument&&a.explodeExpression(e.get("argument"));if(S&&s.delegate){var O=a.makeTempVar();var k=r.returnStatement(r.callExpression(a.contextProperty("delegateYield"),[S,r.stringLiteral(O.property.name),c]));k.loc=s.loc;a.emit(k);a.mark(c);return O}a.emitAssign(a.contextProperty("next"),c);var P=r.returnStatement(r.cloneDeep(S)||null);P.loc=s.loc;a.emit(P);a.mark(c);return a.contextProperty("sent");default:throw new Error("unknown Expression of type "+JSON.stringify(s.type))}}},5604:(e,t,r)=>{"use strict";var s=r(449);var a=s(r(6401));var n=Object.prototype.hasOwnProperty;t.hoist=function(e){var t=a.getTypes();t.assertFunction(e.node);var r={};function varDeclToExpr(e,s){var a=e.node,n=e.scope;t.assertVariableDeclaration(a);var o=[];a.declarations.forEach((function(e){r[e.id.name]=t.identifier(e.id.name);n.removeBinding(e.id.name);if(e.init){o.push(t.assignmentExpression("=",e.id,e.init))}else if(s){o.push(e.id)}}));if(o.length===0)return null;if(o.length===1)return o[0];return t.sequenceExpression(o)}e.get("body").traverse({VariableDeclaration:{exit:function exit(e){var r=varDeclToExpr(e,false);if(r===null){e.remove()}else{a.replaceWithOrRemove(e,t.expressionStatement(r))}e.skip()}},ForStatement:function ForStatement(e){var t=e.get("init");if(t.isVariableDeclaration()){a.replaceWithOrRemove(t,varDeclToExpr(t,false))}},ForXStatement:function ForXStatement(e){var t=e.get("left");if(t.isVariableDeclaration()){a.replaceWithOrRemove(t,varDeclToExpr(t,true))}},FunctionDeclaration:function FunctionDeclaration(e){var s=e.node;r[s.id.name]=s.id;var n=t.expressionStatement(t.assignmentExpression("=",t.clone(s.id),t.functionExpression(e.scope.generateUidIdentifierBasedOnNode(s),s.params,s.body,s.generator,s.expression)));if(e.parentPath.isBlockStatement()){e.parentPath.unshiftContainer("body",n);e.remove()}else{a.replaceWithOrRemove(e,n)}e.scope.removeBinding(s.id.name);e.skip()},FunctionExpression:function FunctionExpression(e){e.skip()},ArrowFunctionExpression:function ArrowFunctionExpression(e){e.skip()}});var s={};e.get("params").forEach((function(e){var r=e.node;if(t.isIdentifier(r)){s[r.name]=r}else{}}));var o=[];Object.keys(r).forEach((function(e){if(!n.call(s,e)){o.push(t.variableDeclarator(r[e],null))}}));if(o.length===0){return null}return t.variableDeclaration("var",o)}},9522:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=_default;var s=r(5490);function _default(e){var t={visitor:(0,s.getVisitor)(e)};var r=e&&e.version;if(r&&parseInt(r,10)>=7){t.name="regenerator-transform"}return t}},9048:(e,t,r)=>{"use strict";var s=r(6919);var a=s(r(9491));var n=r(6419);var o=r(3837);var i=r(6401);function Entry(){a["default"].ok(this instanceof Entry)}function FunctionEntry(e){Entry.call(this);(0,i.getTypes)().assertLiteral(e);this.returnLoc=e}(0,o.inherits)(FunctionEntry,Entry);t.FunctionEntry=FunctionEntry;function LoopEntry(e,t,r){Entry.call(this);var s=(0,i.getTypes)();s.assertLiteral(e);s.assertLiteral(t);if(r){s.assertIdentifier(r)}else{r=null}this.breakLoc=e;this.continueLoc=t;this.label=r}(0,o.inherits)(LoopEntry,Entry);t.LoopEntry=LoopEntry;function SwitchEntry(e){Entry.call(this);(0,i.getTypes)().assertLiteral(e);this.breakLoc=e}(0,o.inherits)(SwitchEntry,Entry);t.SwitchEntry=SwitchEntry;function TryEntry(e,t,r){Entry.call(this);var s=(0,i.getTypes)();s.assertLiteral(e);if(t){a["default"].ok(t instanceof CatchEntry)}else{t=null}if(r){a["default"].ok(r instanceof FinallyEntry)}else{r=null}a["default"].ok(t||r);this.firstLoc=e;this.catchEntry=t;this.finallyEntry=r}(0,o.inherits)(TryEntry,Entry);t.TryEntry=TryEntry;function CatchEntry(e,t){Entry.call(this);var r=(0,i.getTypes)();r.assertLiteral(e);r.assertIdentifier(t);this.firstLoc=e;this.paramId=t}(0,o.inherits)(CatchEntry,Entry);t.CatchEntry=CatchEntry;function FinallyEntry(e,t){Entry.call(this);var r=(0,i.getTypes)();r.assertLiteral(e);r.assertLiteral(t);this.firstLoc=e;this.afterLoc=t}(0,o.inherits)(FinallyEntry,Entry);t.FinallyEntry=FinallyEntry;function LabeledEntry(e,t){Entry.call(this);var r=(0,i.getTypes)();r.assertLiteral(e);r.assertIdentifier(t);this.breakLoc=e;this.label=t}(0,o.inherits)(LabeledEntry,Entry);t.LabeledEntry=LabeledEntry;function LeapManager(e){a["default"].ok(this instanceof LeapManager);a["default"].ok(e instanceof n.Emitter);this.emitter=e;this.entryStack=[new FunctionEntry(e.finalLoc)]}var l=LeapManager.prototype;t.LeapManager=LeapManager;l.withEntry=function(e,t){a["default"].ok(e instanceof Entry);this.entryStack.push(e);try{t.call(this.emitter)}finally{var r=this.entryStack.pop();a["default"].strictEqual(r,e)}};l._findLeapLocation=function(e,t){for(var r=this.entryStack.length-1;r>=0;--r){var s=this.entryStack[r];var a=s[e];if(a){if(t){if(s.label&&s.label.name===t.name){return a}}else if(s instanceof LabeledEntry){}else{return a}}}return null};l.getBreakLoc=function(e){return this._findLeapLocation("breakLoc",e)};l.getContinueLoc=function(e){return this._findLeapLocation("continueLoc",e)}},3085:(e,t,r)=>{"use strict";var s=r(6919);var a=s(r(9491));var n=r(6401);var o=r(1782);var i=(0,o.makeAccessor)();var l=Object.prototype.hasOwnProperty;function makePredicate(e,t){function onlyChildren(e){var t=(0,n.getTypes)();t.assertNode(e);var r=false;function check(e){if(r){}else if(Array.isArray(e)){e.some(check)}else if(t.isNode(e)){a["default"].strictEqual(r,false);r=predicate(e)}return r}var s=t.VISITOR_KEYS[e.type];if(s){for(var o=0;o{"use strict";var s=r(449);t.__esModule=true;t["default"]=replaceShorthandObjectMethod;var a=s(r(6401));function replaceShorthandObjectMethod(e){var t=a.getTypes();if(!e.node||!t.isFunction(e.node)){throw new Error("replaceShorthandObjectMethod can only be called on Function AST node paths.")}if(!t.isObjectMethod(e.node)){return e}if(!e.node.generator){return e}var r=e.node.params.map((function(e){return t.cloneDeep(e)}));var s=t.functionExpression(null,r,t.cloneDeep(e.node.body),e.node.generator,e.node.async);a.replaceWithOrRemove(e,t.objectProperty(t.cloneDeep(e.node.key),s,e.node.computed,false));return e.get("value")}},6401:(e,t)=>{"use strict";t.__esModule=true;t.wrapWithTypes=wrapWithTypes;t.getTypes=getTypes;t.runtimeProperty=runtimeProperty;t.isReference=isReference;t.replaceWithOrRemove=replaceWithOrRemove;var r=null;function wrapWithTypes(e,t){return function(){var s=r;r=e;try{for(var a=arguments.length,n=new Array(a),o=0;o{"use strict";var s=r(449);var a=r(6919);var n=a(r(9491));var o=r(5604);var i=r(6419);var l=a(r(3539));var c=s(r(6401));var u=r(1782);t.getVisitor=function(e){var t=e.types;return{Method:function Method(e,r){var s=e.node;if(!shouldRegenerate(s,r))return;var a=t.functionExpression(null,[],t.cloneNode(s.body,false),s.generator,s.async);e.get("body").set("body",[t.returnStatement(t.callExpression(a,[]))]);s.async=false;s.generator=false;e.get("body.body.0.argument.callee").unwrapFunctionEnvironment()},Function:{exit:c.wrapWithTypes(t,(function(e,r){var s=e.node;if(!shouldRegenerate(s,r))return;e=(0,l["default"])(e);s=e.node;var a=e.scope.generateUidIdentifier("context");var n=e.scope.generateUidIdentifier("args");e.ensureBlock();var u=e.get("body");if(s.async){u.traverse(m)}u.traverse(f,{context:a});var p=[];var y=[];u.get("body").forEach((function(e){var r=e.node;if(t.isExpressionStatement(r)&&t.isStringLiteral(r.expression)){p.push(r)}else if(r&&r._blockHoist!=null){p.push(r)}else{y.push(r)}}));if(p.length>0){u.node.body=y}var g=getOuterFnExpr(e);t.assertIdentifier(s.id);var h=t.identifier(s.id.name+"$");var b=(0,o.hoist)(e);var x={usesThis:false,usesArguments:false,getArgsId:function getArgsId(){return t.clone(n)}};e.traverse(d,x);if(x.usesArguments){b=b||t.variableDeclaration("var",[]);b.declarations.push(t.variableDeclarator(t.clone(n),t.identifier("arguments")))}var v=new i.Emitter(a);v.explode(e.get("body"));if(b&&b.declarations.length>0){p.push(b)}var E=[v.getContextFunction(h)];var j=v.getTryLocsList();if(s.generator){E.push(g)}else if(x.usesThis||j||s.async){E.push(t.nullLiteral())}if(x.usesThis){E.push(t.thisExpression())}else if(j||s.async){E.push(t.nullLiteral())}if(j){E.push(j)}else if(s.async){E.push(t.nullLiteral())}if(s.async){var w=e.scope;do{if(w.hasOwnBinding("Promise"))w.rename("Promise")}while(w=w.parent);E.push(t.identifier("Promise"))}var _=t.callExpression(c.runtimeProperty(s.async?"async":"wrap"),E);p.push(t.returnStatement(_));s.body=t.blockStatement(p);e.get("body.body").forEach((function(e){return e.scope.registerDeclaration(e)}));var S=u.node.directives;if(S){s.body.directives=S}var O=s.generator;if(O){s.generator=false}if(s.async){s.async=false}if(O&&t.isExpression(s)){c.replaceWithOrRemove(e,t.callExpression(c.runtimeProperty("mark"),[s]));e.addComment("leading","#__PURE__")}var k=v.getInsertedLocs();e.traverse({NumericLiteral:function NumericLiteral(e){if(!k.has(e.node)){return}e.replaceWith(t.numericLiteral(e.node.value))}});e.requeue()}))}}};function shouldRegenerate(e,t){if(e.generator){if(e.async){return t.opts.asyncGenerators!==false}else{return t.opts.generators!==false}}else if(e.async){return t.opts.async!==false}else{return false}}function getOuterFnExpr(e){var t=c.getTypes();var r=e.node;t.assertFunction(r);if(!r.id){r.id=e.scope.parent.generateUidIdentifier("callee")}if(r.generator&&t.isFunctionDeclaration(r)){return getMarkedFunctionId(e)}return t.clone(r.id)}var p=(0,u.makeAccessor)();function getMarkedFunctionId(e){var t=c.getTypes();var r=e.node;t.assertIdentifier(r.id);var s=e.findParent((function(e){return e.isProgram()||e.isBlockStatement()}));if(!s){return r.id}var a=s.node;n["default"].ok(Array.isArray(a.body));var o=p(a);if(!o.decl){o.decl=t.variableDeclaration("var",[]);s.unshiftContainer("body",o.decl);o.declPath=s.get("body.0")}n["default"].strictEqual(o.declPath.node,o.decl);var i=s.scope.generateUidIdentifier("marked");var l=t.callExpression(c.runtimeProperty("mark"),[t.clone(r.id)]);var u=o.decl.declarations.push(t.variableDeclarator(i,l))-1;var d=o.declPath.get("declarations."+u+".init");n["default"].strictEqual(d.node,l);d.addComment("leading","#__PURE__");return t.clone(i)}var d={"FunctionExpression|FunctionDeclaration|Method":function FunctionExpressionFunctionDeclarationMethod(e){e.skip()},Identifier:function Identifier(e,t){if(e.node.name==="arguments"&&c.isReference(e)){c.replaceWithOrRemove(e,t.getArgsId());t.usesArguments=true}},ThisExpression:function ThisExpression(e,t){t.usesThis=true}};var f={MetaProperty:function MetaProperty(e){var t=e.node;if(t.meta.name==="function"&&t.property.name==="sent"){var r=c.getTypes();c.replaceWithOrRemove(e,r.memberExpression(r.clone(this.context),r.identifier("_sent")))}}};var m={Function:function Function(e){e.skip()},AwaitExpression:function AwaitExpression(e){var t=c.getTypes();var r=e.node.argument;c.replaceWithOrRemove(e,t.yieldExpression(t.callExpression(c.runtimeProperty("awrap"),[r]),false))}}},9924:(e,t,r)=>{"use strict";const s=r(8741);t.REGULAR=new Map([["d",s().addRange(48,57)],["D",s().addRange(0,47).addRange(58,65535)],["s",s(32,160,5760,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233)],["S",s().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,65535)],["w",s(95).addRange(48,57).addRange(65,90).addRange(97,122)],["W",s(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,65535)]]);t.UNICODE=new Map([["d",s().addRange(48,57)],["D",s().addRange(0,47).addRange(58,1114111)],["s",s(32,160,5760,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233)],["S",s().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111)],["w",s(95).addRange(48,57).addRange(65,90).addRange(97,122)],["W",s(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)]]);t.UNICODE_IGNORE_CASE=new Map([["d",s().addRange(48,57)],["D",s().addRange(0,47).addRange(58,1114111)],["s",s(32,160,5760,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233)],["S",s().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111)],["w",s(95,383,8490).addRange(48,57).addRange(65,90).addRange(97,122)],["W",s(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,382).addRange(384,8489).addRange(8491,1114111)]])},3354:e=>{e.exports=new Map([[75,8490],[83,383],[107,8490],[115,383],[181,924],[197,8491],[223,7838],[229,8491],[383,83],[452,453],[453,452],[455,456],[456,455],[458,459],[459,458],[497,498],[498,497],[837,8126],[914,976],[917,1013],[920,1012],[921,8126],[922,1008],[924,181],[928,982],[929,1009],[931,962],[934,981],[937,8486],[952,1012],[962,931],[969,8486],[976,914],[977,1012],[981,934],[982,928],[1008,922],[1009,929],[1012,[920,977,952]],[1013,917],[1042,7296],[1044,7297],[1054,7298],[1057,7299],[1058,7301],[1066,7302],[1122,7303],[7296,1042],[7297,1044],[7298,1054],[7299,1057],[7300,7301],[7301,[1058,7300]],[7302,1066],[7303,1122],[7304,42570],[7776,7835],[7835,7776],[7838,223],[8064,8072],[8065,8073],[8066,8074],[8067,8075],[8068,8076],[8069,8077],[8070,8078],[8071,8079],[8072,8064],[8073,8065],[8074,8066],[8075,8067],[8076,8068],[8077,8069],[8078,8070],[8079,8071],[8080,8088],[8081,8089],[8082,8090],[8083,8091],[8084,8092],[8085,8093],[8086,8094],[8087,8095],[8088,8080],[8089,8081],[8090,8082],[8091,8083],[8092,8084],[8093,8085],[8094,8086],[8095,8087],[8096,8104],[8097,8105],[8098,8106],[8099,8107],[8100,8108],[8101,8109],[8102,8110],[8103,8111],[8104,8096],[8105,8097],[8106,8098],[8107,8099],[8108,8100],[8109,8101],[8110,8102],[8111,8103],[8115,8124],[8124,8115],[8126,[837,921]],[8131,8140],[8140,8131],[8179,8188],[8188,8179],[8486,[937,969]],[8490,75],[8491,[197,229]],[42570,7304],[66560,66600],[66561,66601],[66562,66602],[66563,66603],[66564,66604],[66565,66605],[66566,66606],[66567,66607],[66568,66608],[66569,66609],[66570,66610],[66571,66611],[66572,66612],[66573,66613],[66574,66614],[66575,66615],[66576,66616],[66577,66617],[66578,66618],[66579,66619],[66580,66620],[66581,66621],[66582,66622],[66583,66623],[66584,66624],[66585,66625],[66586,66626],[66587,66627],[66588,66628],[66589,66629],[66590,66630],[66591,66631],[66592,66632],[66593,66633],[66594,66634],[66595,66635],[66596,66636],[66597,66637],[66598,66638],[66599,66639],[66600,66560],[66601,66561],[66602,66562],[66603,66563],[66604,66564],[66605,66565],[66606,66566],[66607,66567],[66608,66568],[66609,66569],[66610,66570],[66611,66571],[66612,66572],[66613,66573],[66614,66574],[66615,66575],[66616,66576],[66617,66577],[66618,66578],[66619,66579],[66620,66580],[66621,66581],[66622,66582],[66623,66583],[66624,66584],[66625,66585],[66626,66586],[66627,66587],[66628,66588],[66629,66589],[66630,66590],[66631,66591],[66632,66592],[66633,66593],[66634,66594],[66635,66595],[66636,66596],[66637,66597],[66638,66598],[66639,66599],[66736,66776],[66737,66777],[66738,66778],[66739,66779],[66740,66780],[66741,66781],[66742,66782],[66743,66783],[66744,66784],[66745,66785],[66746,66786],[66747,66787],[66748,66788],[66749,66789],[66750,66790],[66751,66791],[66752,66792],[66753,66793],[66754,66794],[66755,66795],[66756,66796],[66757,66797],[66758,66798],[66759,66799],[66760,66800],[66761,66801],[66762,66802],[66763,66803],[66764,66804],[66765,66805],[66766,66806],[66767,66807],[66768,66808],[66769,66809],[66770,66810],[66771,66811],[66776,66736],[66777,66737],[66778,66738],[66779,66739],[66780,66740],[66781,66741],[66782,66742],[66783,66743],[66784,66744],[66785,66745],[66786,66746],[66787,66747],[66788,66748],[66789,66749],[66790,66750],[66791,66751],[66792,66752],[66793,66753],[66794,66754],[66795,66755],[66796,66756],[66797,66757],[66798,66758],[66799,66759],[66800,66760],[66801,66761],[66802,66762],[66803,66763],[66804,66764],[66805,66765],[66806,66766],[66807,66767],[66808,66768],[66809,66769],[66810,66770],[66811,66771],[68736,68800],[68737,68801],[68738,68802],[68739,68803],[68740,68804],[68741,68805],[68742,68806],[68743,68807],[68744,68808],[68745,68809],[68746,68810],[68747,68811],[68748,68812],[68749,68813],[68750,68814],[68751,68815],[68752,68816],[68753,68817],[68754,68818],[68755,68819],[68756,68820],[68757,68821],[68758,68822],[68759,68823],[68760,68824],[68761,68825],[68762,68826],[68763,68827],[68764,68828],[68765,68829],[68766,68830],[68767,68831],[68768,68832],[68769,68833],[68770,68834],[68771,68835],[68772,68836],[68773,68837],[68774,68838],[68775,68839],[68776,68840],[68777,68841],[68778,68842],[68779,68843],[68780,68844],[68781,68845],[68782,68846],[68783,68847],[68784,68848],[68785,68849],[68786,68850],[68800,68736],[68801,68737],[68802,68738],[68803,68739],[68804,68740],[68805,68741],[68806,68742],[68807,68743],[68808,68744],[68809,68745],[68810,68746],[68811,68747],[68812,68748],[68813,68749],[68814,68750],[68815,68751],[68816,68752],[68817,68753],[68818,68754],[68819,68755],[68820,68756],[68821,68757],[68822,68758],[68823,68759],[68824,68760],[68825,68761],[68826,68762],[68827,68763],[68828,68764],[68829,68765],[68830,68766],[68831,68767],[68832,68768],[68833,68769],[68834,68770],[68835,68771],[68836,68772],[68837,68773],[68838,68774],[68839,68775],[68840,68776],[68841,68777],[68842,68778],[68843,68779],[68844,68780],[68845,68781],[68846,68782],[68847,68783],[68848,68784],[68849,68785],[68850,68786],[71840,71872],[71841,71873],[71842,71874],[71843,71875],[71844,71876],[71845,71877],[71846,71878],[71847,71879],[71848,71880],[71849,71881],[71850,71882],[71851,71883],[71852,71884],[71853,71885],[71854,71886],[71855,71887],[71856,71888],[71857,71889],[71858,71890],[71859,71891],[71860,71892],[71861,71893],[71862,71894],[71863,71895],[71864,71896],[71865,71897],[71866,71898],[71867,71899],[71868,71900],[71869,71901],[71870,71902],[71871,71903],[71872,71840],[71873,71841],[71874,71842],[71875,71843],[71876,71844],[71877,71845],[71878,71846],[71879,71847],[71880,71848],[71881,71849],[71882,71850],[71883,71851],[71884,71852],[71885,71853],[71886,71854],[71887,71855],[71888,71856],[71889,71857],[71890,71858],[71891,71859],[71892,71860],[71893,71861],[71894,71862],[71895,71863],[71896,71864],[71897,71865],[71898,71866],[71899,71867],[71900,71868],[71901,71869],[71902,71870],[71903,71871],[93760,93792],[93761,93793],[93762,93794],[93763,93795],[93764,93796],[93765,93797],[93766,93798],[93767,93799],[93768,93800],[93769,93801],[93770,93802],[93771,93803],[93772,93804],[93773,93805],[93774,93806],[93775,93807],[93776,93808],[93777,93809],[93778,93810],[93779,93811],[93780,93812],[93781,93813],[93782,93814],[93783,93815],[93784,93816],[93785,93817],[93786,93818],[93787,93819],[93788,93820],[93789,93821],[93790,93822],[93791,93823],[93792,93760],[93793,93761],[93794,93762],[93795,93763],[93796,93764],[93797,93765],[93798,93766],[93799,93767],[93800,93768],[93801,93769],[93802,93770],[93803,93771],[93804,93772],[93805,93773],[93806,93774],[93807,93775],[93808,93776],[93809,93777],[93810,93778],[93811,93779],[93812,93780],[93813,93781],[93814,93782],[93815,93783],[93816,93784],[93817,93785],[93818,93786],[93819,93787],[93820,93788],[93821,93789],[93822,93790],[93823,93791],[125184,125218],[125185,125219],[125186,125220],[125187,125221],[125188,125222],[125189,125223],[125190,125224],[125191,125225],[125192,125226],[125193,125227],[125194,125228],[125195,125229],[125196,125230],[125197,125231],[125198,125232],[125199,125233],[125200,125234],[125201,125235],[125202,125236],[125203,125237],[125204,125238],[125205,125239],[125206,125240],[125207,125241],[125208,125242],[125209,125243],[125210,125244],[125211,125245],[125212,125246],[125213,125247],[125214,125248],[125215,125249],[125216,125250],[125217,125251],[125218,125184],[125219,125185],[125220,125186],[125221,125187],[125222,125188],[125223,125189],[125224,125190],[125225,125191],[125226,125192],[125227,125193],[125228,125194],[125229,125195],[125230,125196],[125231,125197],[125232,125198],[125233,125199],[125234,125200],[125235,125201],[125236,125202],[125237,125203],[125238,125204],[125239,125205],[125240,125206],[125241,125207],[125242,125208],[125243,125209],[125244,125210],[125245,125211],[125246,125212],[125247,125213],[125248,125214],[125249,125215],[125250,125216],[125251,125217]])},5756:(e,t,r)=>{"use strict";const s=r(1770).generate;const a=r(9990).parse;const n=r(8741);const o=r(3042);const i=r(1317);const l=r(3354);const c=r(9924);const u=n().addRange(0,1114111);const p=n().addRange(0,65535);const d=u.clone().remove(10,13,8232,8233);const getCharacterClassEscapeSet=(e,t,r)=>{if(t){if(r){return c.UNICODE_IGNORE_CASE.get(e)}return c.UNICODE.get(e)}return c.REGULAR.get(e)};const getUnicodeDotSet=e=>e?u:d;const getUnicodePropertyValueSet=(e,t)=>{const r=t?`${e}/${t}`:`Binary_Property/${e}`;try{return require(`regenerate-unicode-properties/${r}.js`)}catch(r){throw new Error(`Failed to recognize value \`${t}\` for property `+`\`${e}\`.`)}};const handleLoneUnicodePropertyNameOrValue=e=>{try{const t="General_Category";const r=i(t,e);return getUnicodePropertyValueSet(t,r)}catch(e){}const t=o(e);return getUnicodePropertyValueSet(t)};const getUnicodePropertyEscapeSet=(e,t)=>{const r=e.split("=");const s=r[0];let a;if(r.length==1){a=handleLoneUnicodePropertyNameOrValue(s)}else{const e=o(s);const t=i(e,r[1]);a=getUnicodePropertyValueSet(e,t)}if(t){return u.clone().remove(a)}return a.clone()};n.prototype.iuAddRange=function(e,t){const r=this;do{const t=caseFold(e);if(t){r.add(t)}}while(++e<=t);return r};const update=(e,t)=>{let r=a(t,f.useUnicodeFlag?"u":"");switch(r.type){case"characterClass":case"group":case"value":break;default:r=wrap(r,t)}Object.assign(e,r)};const wrap=(e,t)=>({type:"group",behavior:"ignore",body:[e],raw:`(?:${t})`});const caseFold=e=>l.get(e)||false;const processCharacterClass=(e,t)=>{const r=n();for(const t of e.body){switch(t.type){case"value":r.add(t.codePoint);if(f.ignoreCase&&f.unicode&&!f.useUnicodeFlag){const e=caseFold(t.codePoint);if(e){r.add(e)}}break;case"characterClassRange":const e=t.min.codePoint;const s=t.max.codePoint;r.addRange(e,s);if(f.ignoreCase&&f.unicode&&!f.useUnicodeFlag){r.iuAddRange(e,s)}break;case"characterClassEscape":r.add(getCharacterClassEscapeSet(t.value,f.unicode,f.ignoreCase));break;case"unicodePropertyEscape":r.add(getUnicodePropertyEscapeSet(t.value,t.negative));break;default:throw new Error(`Unknown term type: ${t.type}`)}}if(e.negative){update(e,`(?!${r.toString(t)})[\\s\\S]`)}else{update(e,r.toString(t))}return e};const updateNamedReference=(e,t)=>{delete e.name;e.matchIndex=t};const assertNoUnmatchedReferences=e=>{const t=Object.keys(e.unmatchedReferences);if(t.length>0){throw new Error(`Unknown group names: ${t}`)}};const processTerm=(e,t,r)=>{switch(e.type){case"dot":if(f.useDotAllFlag){break}else if(f.unicode){update(e,getUnicodeDotSet(f.dotAll).toString(t))}else if(f.dotAll){update(e,"[\\s\\S]")}break;case"characterClass":e=processCharacterClass(e,t);break;case"unicodePropertyEscape":if(f.unicodePropertyEscape){update(e,getUnicodePropertyEscapeSet(e.value,e.negative).toString(t))}break;case"characterClassEscape":update(e,getCharacterClassEscapeSet(e.value,f.unicode,f.ignoreCase).toString(t));break;case"group":if(e.behavior=="normal"){r.lastIndex++}if(e.name&&f.namedGroup){const t=e.name.value;if(r.names[t]){throw new Error(`Multiple groups with the same name (${t}) are not allowed.`)}const s=r.lastIndex;delete e.name;r.names[t]=s;if(r.onNamedGroup){r.onNamedGroup.call(null,t,s)}if(r.unmatchedReferences[t]){r.unmatchedReferences[t].forEach((e=>{updateNamedReference(e,s)}));delete r.unmatchedReferences[t]}}case"alternative":case"disjunction":case"quantifier":e.body=e.body.map((e=>processTerm(e,t,r)));break;case"value":const s=e.codePoint;const a=n(s);if(f.ignoreCase&&f.unicode&&!f.useUnicodeFlag){const e=caseFold(s);if(e){a.add(e)}}update(e,a.toString(t));break;case"reference":if(e.name){const t=e.name.value;const s=r.names[t];if(s){updateNamedReference(e,s);break}if(!r.unmatchedReferences[t]){r.unmatchedReferences[t]=[]}r.unmatchedReferences[t].push(e)}break;case"anchor":case"empty":case"group":break;default:throw new Error(`Unknown term type: ${e.type}`)}return e};const f={ignoreCase:false,unicode:false,dotAll:false,useDotAllFlag:false,useUnicodeFlag:false,unicodePropertyEscape:false,namedGroup:false};const rewritePattern=(e,t,r)=>{f.unicode=t&&t.includes("u");const n={unicodePropertyEscape:f.unicode,namedGroups:true,lookbehind:r&&r.lookbehind};f.ignoreCase=t&&t.includes("i");const o=r&&r.dotAllFlag;f.dotAll=o&&t&&t.includes("s");f.namedGroup=r&&r.namedGroup;f.useDotAllFlag=r&&r.useDotAllFlag;f.useUnicodeFlag=r&&r.useUnicodeFlag;f.unicodePropertyEscape=r&&r.unicodePropertyEscape;if(o&&f.useDotAllFlag){throw new Error("`useDotAllFlag` and `dotAllFlag` cannot both be true!")}const i={hasUnicodeFlag:f.useUnicodeFlag,bmpOnly:!f.unicode};const l={onNamedGroup:r&&r.onNamedGroup,lastIndex:0,names:Object.create(null),unmatchedReferences:Object.create(null)};const c=a(e,t,n);processTerm(c,i,l);assertNoUnmatchedReferences(l);return s(c)};e.exports=rewritePattern},1770:function(e,t,r){e=r.nmd(e); + */(function(){var r;var s="4.17.20";var a=200;var n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function";var i="__lodash_hash_undefined__";var l=500;var c="__lodash_placeholder__";var u=1,p=2,f=4;var d=1,m=2;var y=1,g=2,h=4,b=8,x=16,v=32,E=64,j=128,w=256,_=512;var S=30,k="...";var O=800,I=16;var P=1,D=2,C=3;var A=1/0,R=9007199254740991,N=17976931348623157e292,M=0/0;var L=4294967295,F=L-1,B=L>>>1;var W=[["ary",j],["bind",y],["bindKey",g],["curry",b],["curryRight",x],["flip",_],["partial",v],["partialRight",E],["rearg",w]];var U="[object Arguments]",V="[object Array]",$="[object AsyncFunction]",q="[object Boolean]",G="[object Date]",H="[object DOMException]",z="[object Error]",K="[object Function]",X="[object GeneratorFunction]",Y="[object Map]",J="[object Number]",Z="[object Null]",Q="[object Object]",ee="[object Promise]",te="[object Proxy]",re="[object RegExp]",se="[object Set]",ae="[object String]",ne="[object Symbol]",oe="[object Undefined]",ie="[object WeakMap]",le="[object WeakSet]";var ce="[object ArrayBuffer]",ue="[object DataView]",pe="[object Float32Array]",fe="[object Float64Array]",de="[object Int8Array]",me="[object Int16Array]",ye="[object Int32Array]",ge="[object Uint8Array]",he="[object Uint8ClampedArray]",be="[object Uint16Array]",xe="[object Uint32Array]";var ve=/\b__p \+= '';/g,Ee=/\b(__p \+=) '' \+/g,je=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var we=/&(?:amp|lt|gt|quot|#39);/g,_e=/[&<>"']/g,Se=RegExp(we.source),ke=RegExp(_e.source);var Oe=/<%-([\s\S]+?)%>/g,Ie=/<%([\s\S]+?)%>/g,Pe=/<%=([\s\S]+?)%>/g;var De=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ce=/^\w*$/,Ae=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;var Re=/[\\^$.*+?()[\]{}|]/g,Ne=RegExp(Re.source);var Te=/^\s+|\s+$/g,Me=/^\s+/,Le=/\s+$/;var Fe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Be=/\{\n\/\* \[wrapped with (.+)\] \*/,We=/,? & /;var Ue=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var Ve=/\\(\\)?/g;var $e=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var qe=/\w*$/;var Ge=/^[-+]0x[0-9a-f]+$/i;var He=/^0b[01]+$/i;var ze=/^\[object .+?Constructor\]$/;var Ke=/^0o[0-7]+$/i;var Xe=/^(?:0|[1-9]\d*)$/;var Ye=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;var Je=/($^)/;var Ze=/['\n\r\u2028\u2029\\]/g;var Qe="\\ud800-\\udfff",et="\\u0300-\\u036f",tt="\\ufe20-\\ufe2f",rt="\\u20d0-\\u20ff",st=et+tt+rt,at="\\u2700-\\u27bf",nt="a-z\\xdf-\\xf6\\xf8-\\xff",ot="\\xac\\xb1\\xd7\\xf7",ct="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ut="\\u2000-\\u206f",pt=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ft="A-Z\\xc0-\\xd6\\xd8-\\xde",dt="\\ufe0e\\ufe0f",mt=ot+ct+ut+pt;var yt="['’]",ht="["+Qe+"]",bt="["+mt+"]",xt="["+st+"]",vt="\\d+",Et="["+at+"]",jt="["+nt+"]",wt="[^"+Qe+mt+vt+at+nt+ft+"]",_t="\\ud83c[\\udffb-\\udfff]",St="(?:"+xt+"|"+_t+")",kt="[^"+Qe+"]",Ot="(?:\\ud83c[\\udde6-\\uddff]){2}",It="[\\ud800-\\udbff][\\udc00-\\udfff]",Pt="["+ft+"]",Dt="\\u200d";var Ct="(?:"+jt+"|"+wt+")",At="(?:"+Pt+"|"+wt+")",Rt="(?:"+yt+"(?:d|ll|m|re|s|t|ve))?",Nt="(?:"+yt+"(?:D|LL|M|RE|S|T|VE))?",Tt=St+"?",Mt="["+dt+"]?",Lt="(?:"+Dt+"(?:"+[kt,Ot,It].join("|")+")"+Mt+Tt+")*",Ft="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Bt="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Wt=Mt+Tt+Lt,Ut="(?:"+[Et,Ot,It].join("|")+")"+Wt,Vt="(?:"+[kt+xt+"?",xt,Ot,It,ht].join("|")+")";var $t=RegExp(yt,"g");var qt=RegExp(xt,"g");var Gt=RegExp(_t+"(?="+_t+")|"+Vt+Wt,"g");var Ht=RegExp([Pt+"?"+jt+"+"+Rt+"(?="+[bt,Pt,"$"].join("|")+")",At+"+"+Nt+"(?="+[bt,Pt+Ct,"$"].join("|")+")",Pt+"?"+Ct+"+"+Rt,Pt+"+"+Nt,Bt,Ft,vt,Ut].join("|"),"g");var zt=RegExp("["+Dt+Qe+st+dt+"]");var Kt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var Xt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"];var Yt=-1;var Jt={};Jt[pe]=Jt[fe]=Jt[de]=Jt[me]=Jt[ye]=Jt[ge]=Jt[he]=Jt[be]=Jt[xe]=true;Jt[U]=Jt[V]=Jt[ce]=Jt[q]=Jt[ue]=Jt[G]=Jt[z]=Jt[K]=Jt[Y]=Jt[J]=Jt[Q]=Jt[re]=Jt[se]=Jt[ae]=Jt[ie]=false;var Zt={};Zt[U]=Zt[V]=Zt[ce]=Zt[ue]=Zt[q]=Zt[G]=Zt[pe]=Zt[fe]=Zt[de]=Zt[me]=Zt[ye]=Zt[Y]=Zt[J]=Zt[Q]=Zt[re]=Zt[se]=Zt[ae]=Zt[ne]=Zt[ge]=Zt[he]=Zt[be]=Zt[xe]=true;Zt[z]=Zt[K]=Zt[ie]=false;var Qt={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"};var er={"&":"&","<":"<",">":">",'"':""","'":"'"};var tr={"&":"&","<":"<",">":">",""":'"',"'":"'"};var rr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};var sr=parseFloat,ar=parseInt;var nr=typeof global=="object"&&global&&global.Object===Object&&global;var or=typeof self=="object"&&self&&self.Object===Object&&self;var ir=nr||or||Function("return this")();var lr=true&&t&&!t.nodeType&&t;var cr=lr&&"object"=="object"&&e&&!e.nodeType&&e;var ur=cr&&cr.exports===lr;var pr=ur&&nr.process;var fr=function(){try{var e=cr&&cr.require&&cr.require("util").types;if(e){return e}return pr&&pr.binding&&pr.binding("util")}catch(e){}}();var dr=fr&&fr.isArrayBuffer,mr=fr&&fr.isDate,yr=fr&&fr.isMap,gr=fr&&fr.isRegExp,hr=fr&&fr.isSet,br=fr&&fr.isTypedArray;function apply(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function arrayAggregator(e,t,r,s){var a=-1,n=e==null?0:e.length;while(++a-1}function arrayIncludesWith(e,t,r){var s=-1,a=e==null?0:e.length;while(++s-1){}return r}function charsEndIndex(e,t){var r=e.length;while(r--&&baseIndexOf(t,e[r],0)>-1){}return r}function countHolders(e,t){var r=e.length,s=0;while(r--){if(e[r]===t){++s}}return s}var vr=basePropertyOf(Qt);var Er=basePropertyOf(er);function escapeStringChar(e){return"\\"+rr[e]}function getValue(e,t){return e==null?r:e[t]}function hasUnicode(e){return zt.test(e)}function hasUnicodeWord(e){return Kt.test(e)}function iteratorToArray(e){var t,r=[];while(!(t=e.next()).done){r.push(t.value)}return r}function mapToArray(e){var t=-1,r=Array(e.size);e.forEach((function(e,s){r[++t]=[s,e]}));return r}function overArg(e,t){return function(r){return e(t(r))}}function replaceHolders(e,t){var r=-1,s=e.length,a=0,n=[];while(++r-1}function listCacheSet(e,t){var r=this.__data__,s=assocIndexOf(r,e);if(s<0){++this.size;r.push([e,t])}else{r[s][1]=t}return this}ListCache.prototype.clear=listCacheClear;ListCache.prototype["delete"]=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;function MapCache(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t=t?e:t}}return e}function baseClone(e,t,s,a,n,o){var i,l=t&u,c=t&p,d=t&f;if(s){i=n?s(e,a,n,o):s(e)}if(i!==r){return i}if(!isObject(e)){return e}var m=Ns(e);if(m){i=initCloneArray(e);if(!l){return copyArray(e,i)}}else{var y=qr(e),g=y==K||y==X;if(Ms(e)){return cloneBuffer(e,l)}if(y==Q||y==U||g&&!n){i=c||g?{}:initCloneObject(e);if(!l){return c?copySymbolsIn(e,baseAssignIn(i,e)):copySymbols(e,baseAssign(i,e))}}else{if(!Zt[y]){return n?e:{}}i=initCloneByTag(e,y,l)}}o||(o=new Stack);var h=o.get(e);if(h){return h}o.set(e,i);if(Ws(e)){e.forEach((function(r){i.add(baseClone(r,t,s,r,e,o))}))}else if(Fs(e)){e.forEach((function(r,a){i.set(a,baseClone(r,t,s,a,e,o))}))}var b=d?c?getAllKeysIn:getAllKeys:c?keysIn:keys;var x=m?r:b(e);arrayEach(x||e,(function(r,a){if(x){a=r;r=e[a]}assignValue(i,a,baseClone(r,t,s,a,e,o))}));return i}function baseConforms(e){var t=keys(e);return function(r){return baseConformsTo(r,e,t)}}function baseConformsTo(e,t,s){var a=s.length;if(e==null){return!a}e=rt(e);while(a--){var n=s[a],o=t[n],i=e[n];if(i===r&&!(n in e)||!o(i)){return false}}return true}function baseDelay(e,t,s){if(typeof e!="function"){throw new nt(o)}return zr((function(){e.apply(r,s)}),t)}function baseDifference(e,t,r,s){var n=-1,o=arrayIncludes,i=true,l=e.length,c=[],u=t.length;if(!l){return c}if(r){t=arrayMap(t,baseUnary(r))}if(s){o=arrayIncludesWith;i=false}else if(t.length>=a){o=cacheHas;i=false;t=new SetCache(t)}e:while(++nn?0:n+s}a=a===r||a>n?n:toInteger(a);if(a<0){a+=n}a=s>a?0:toLength(a);while(s0&&r(i)){if(t>1){baseFlatten(i,t-1,r,s,a)}else{arrayPush(a,i)}}else if(!s){a[a.length]=i}}return a}var Nr=createBaseFor();var Tr=createBaseFor(true);function baseForOwn(e,t){return e&&Nr(e,t,keys)}function baseForOwnRight(e,t){return e&&Tr(e,t,keys)}function baseFunctions(e,t){return arrayFilter(t,(function(t){return isFunction(e[t])}))}function baseGet(e,t){t=castPath(t,e);var s=0,a=t.length;while(e!=null&&st}function baseHas(e,t){return e!=null&&dt.call(e,t)}function baseHasIn(e,t){return e!=null&&t in rt(e)}function baseInRange(e,t,r){return e>=Ht(t,r)&&e=120&&f.length>=120)?new SetCache(l&&f):r}f=e[0];var d=-1,m=c[0];e:while(++d-1){if(i!==e){It.call(i,l,1)}It.call(e,l,1)}}return e}function basePullAt(e,t){var r=e?t.length:0,s=r-1;while(r--){var a=t[r];if(r==s||a!==n){var n=a;if(isIndex(a)){It.call(e,a,1)}else{baseUnset(e,a)}}}return e}function baseRandom(e,t){return e+Lt(Qt()*(t-e+1))}function baseRange(e,r,s,a){var n=-1,o=Gt(Mt((r-e)/(s||1)),0),i=t(o);while(o--){i[a?o:++n]=e;e+=s}return i}function baseRepeat(e,t){var r="";if(!e||t<1||t>R){return r}do{if(t%2){r+=e}t=Lt(t/2);if(t){e+=e}}while(t);return r}function baseRest(e,t){return Kr(overRest(e,t,identity),e+"")}function baseSample(e){return arraySample(values(e))}function baseSampleSize(e,t){var r=values(e);return shuffleSelf(r,baseClamp(t,0,r.length))}function baseSet(e,t,s,a){if(!isObject(e)){return e}t=castPath(t,e);var n=-1,o=t.length,i=o-1,l=e;while(l!=null&&++nn?0:n+r}s=s>n?n:s;if(s<0){s+=n}n=r>s?0:s-r>>>0;r>>>=0;var o=t(n);while(++a>>1,o=e[n];if(o!==null&&!isSymbol(o)&&(r?o<=t:o=a){var u=t?null:Wr(e);if(u){return setToArray(u)}i=false;n=cacheHas;c=new SetCache}else{c=t?[]:l}e:while(++s=a?e:baseSlice(e,t,s)}var Br=Rt||function(e){return ir.clearTimeout(e)};function cloneBuffer(e,t){if(t){return e.slice()}var r=e.length,s=_t?_t(r):new e.constructor(r);e.copy(s);return s}function cloneArrayBuffer(e){var t=new e.constructor(e.byteLength);new wt(t).set(new wt(e));return t}function cloneDataView(e,t){var r=t?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function cloneRegExp(e){var t=new e.constructor(e.source,qe.exec(e));t.lastIndex=e.lastIndex;return t}function cloneSymbol(e){return Pr?rt(Pr.call(e)):{}}function cloneTypedArray(e,t){var r=t?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function compareAscending(e,t){if(e!==t){var s=e!==r,a=e===null,n=e===e,o=isSymbol(e);var i=t!==r,l=t===null,c=t===t,u=isSymbol(t);if(!l&&!u&&!o&&e>t||o&&i&&c&&!l&&!u||a&&i&&c||!s&&c||!n){return 1}if(!a&&!o&&!u&&e=i){return l}var c=r[s];return l*(c=="desc"?-1:1)}}return e.index-t.index}function composeArgs(e,r,s,a){var n=-1,o=e.length,i=s.length,l=-1,c=r.length,u=Gt(o-i,0),p=t(c+u),f=!a;while(++l1?s[n-1]:r,i=n>2?s[2]:r;o=e.length>3&&typeof o=="function"?(n--,o):r;if(i&&isIterateeCall(s[0],s[1],i)){o=n<3?r:o;n=1}t=rt(t);while(++a-1?n[o?t[i]:i]:r}}function createFlow(e){return flatRest((function(t){var s=t.length,a=s,n=LodashWrapper.prototype.thru;if(e){t.reverse()}while(a--){var i=t[a];if(typeof i!="function"){throw new nt(o)}if(n&&!l&&getFuncName(i)=="wrapper"){var l=new LodashWrapper([],true)}}a=l?a:s;while(++a1){y.reverse()}if(f&&ul)){return false}var u=o.get(e);var p=o.get(t);if(u&&p){return u==t&&p==e}var f=-1,y=true,g=s&m?new SetCache:r;o.set(e,t);o.set(t,e);while(++f1?"& ":"")+t[s];t=t.join(r>2?", ":" ");return e.replace(Fe,"{\n/* [wrapped with "+t+"] */\n")}function isFlattenable(e){return Ns(e)||Rs(e)||!!(Pt&&e&&e[Pt])}function isIndex(e,t){var r=typeof e;t=t==null?R:t;return!!t&&(r=="number"||r!="symbol"&&Xe.test(e))&&(e>-1&&e%1==0&&e0){if(++t>=O){return arguments[0]}}else{t=0}return e.apply(r,arguments)}}function shuffleSelf(e,t){var s=-1,a=e.length,n=a-1;t=t===r?a:t;while(++s1?e[t-1]:r;s=typeof s=="function"?(e.pop(),s):r;return unzipWith(e,s)}));function chain(e){var t=lodash(e);t.__chain__=true;return t}function tap(e,t){t(e);return e}function thru(e,t){return t(e)}var ds=flatRest((function(e){var t=e.length,s=t?e[0]:0,a=this.__wrapped__,interceptor=function(t){return baseAt(t,e)};if(t>1||this.__actions__.length||!(a instanceof LazyWrapper)||!isIndex(s)){return this.thru(interceptor)}a=a.slice(s,+s+(t?1:0));a.__actions__.push({func:thru,args:[interceptor],thisArg:r});return new LodashWrapper(a,this.__chain__).thru((function(e){if(t&&!e.length){e.push(r)}return e}))}));function wrapperChain(){return chain(this)}function wrapperCommit(){return new LodashWrapper(this.value(),this.__chain__)}function wrapperNext(){if(this.__values__===r){this.__values__=toArray(this.value())}var e=this.__index__>=this.__values__.length,t=e?r:this.__values__[this.__index__++];return{done:e,value:t}}function wrapperToIterator(){return this}function wrapperPlant(e){var t,s=this;while(s instanceof baseLodash){var a=wrapperClone(s);a.__index__=0;a.__values__=r;if(t){n.__wrapped__=a}else{t=a}var n=a;s=s.__wrapped__}n.__wrapped__=e;return t}function wrapperReverse(){var e=this.__wrapped__;if(e instanceof LazyWrapper){var t=e;if(this.__actions__.length){t=new LazyWrapper(this)}t=t.reverse();t.__actions__.push({func:thru,args:[reverse],thisArg:r});return new LodashWrapper(t,this.__chain__)}return this.thru(reverse)}function wrapperValue(){return baseWrapperValue(this.__wrapped__,this.__actions__)}var ms=createAggregator((function(e,t,r){if(dt.call(e,r)){++e[r]}else{baseAssignValue(e,r,1)}}));function every(e,t,s){var a=Ns(e)?arrayEvery:baseEvery;if(s&&isIterateeCall(e,t,s)){t=r}return a(e,getIteratee(t,3))}function filter(e,t){var r=Ns(e)?arrayFilter:baseFilter;return r(e,getIteratee(t,3))}var ys=createFind(findIndex);var gs=createFind(findLastIndex);function flatMap(e,t){return baseFlatten(map(e,t),1)}function flatMapDeep(e,t){return baseFlatten(map(e,t),A)}function flatMapDepth(e,t,s){s=s===r?1:toInteger(s);return baseFlatten(map(e,t),s)}function forEach(e,t){var r=Ns(e)?arrayEach:Ar;return r(e,getIteratee(t,3))}function forEachRight(e,t){var r=Ns(e)?arrayEachRight:Rr;return r(e,getIteratee(t,3))}var hs=createAggregator((function(e,t,r){if(dt.call(e,r)){e[r].push(t)}else{baseAssignValue(e,r,[t])}}));function includes(e,t,r,s){e=isArrayLike(e)?e:values(e);r=r&&!s?toInteger(r):0;var a=e.length;if(r<0){r=Gt(a+r,0)}return isString(e)?r<=a&&e.indexOf(t,r)>-1:!!a&&baseIndexOf(e,t,r)>-1}var bs=baseRest((function(e,r,s){var a=-1,n=typeof r=="function",o=isArrayLike(e)?t(e.length):[];Ar(e,(function(e){o[++a]=n?apply(r,e,s):baseInvoke(e,r,s)}));return o}));var xs=createAggregator((function(e,t,r){baseAssignValue(e,r,t)}));function map(e,t){var r=Ns(e)?arrayMap:baseMap;return r(e,getIteratee(t,3))}function orderBy(e,t,s,a){if(e==null){return[]}if(!Ns(t)){t=t==null?[]:[t]}s=a?r:s;if(!Ns(s)){s=s==null?[]:[s]}return baseOrderBy(e,t,s)}var vs=createAggregator((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]}));function reduce(e,t,r){var s=Ns(e)?arrayReduce:baseReduce,a=arguments.length<3;return s(e,getIteratee(t,4),r,a,Ar)}function reduceRight(e,t,r){var s=Ns(e)?arrayReduceRight:baseReduce,a=arguments.length<3;return s(e,getIteratee(t,4),r,a,Rr)}function reject(e,t){var r=Ns(e)?arrayFilter:baseFilter;return r(e,negate(getIteratee(t,3)))}function sample(e){var t=Ns(e)?arraySample:baseSample;return t(e)}function sampleSize(e,t,s){if(s?isIterateeCall(e,t,s):t===r){t=1}else{t=toInteger(t)}var a=Ns(e)?arraySampleSize:baseSampleSize;return a(e,t)}function shuffle(e){var t=Ns(e)?arrayShuffle:baseShuffle;return t(e)}function size(e){if(e==null){return 0}if(isArrayLike(e)){return isString(e)?stringSize(e):e.length}var t=qr(e);if(t==Y||t==se){return e.size}return baseKeys(e).length}function some(e,t,s){var a=Ns(e)?arraySome:baseSome;if(s&&isIterateeCall(e,t,s)){t=r}return a(e,getIteratee(t,3))}var Es=baseRest((function(e,t){if(e==null){return[]}var r=t.length;if(r>1&&isIterateeCall(e,t[0],t[1])){t=[]}else if(r>2&&isIterateeCall(t[0],t[1],t[2])){t=[t[0]]}return baseOrderBy(e,baseFlatten(t,1),[])}));var js=Nt||function(){return ir.Date.now()};function after(e,t){if(typeof t!="function"){throw new nt(o)}e=toInteger(e);return function(){if(--e<1){return t.apply(this,arguments)}}}function ary(e,t,s){t=s?r:t;t=e&&t==null?e.length:t;return createWrap(e,j,r,r,r,r,t)}function before(e,t){var s;if(typeof t!="function"){throw new nt(o)}e=toInteger(e);return function(){if(--e>0){s=t.apply(this,arguments)}if(e<=1){t=r}return s}}var ws=baseRest((function(e,t,r){var s=y;if(r.length){var a=replaceHolders(r,getHolder(ws));s|=v}return createWrap(e,s,t,r,a)}));var _s=baseRest((function(e,t,r){var s=y|g;if(r.length){var a=replaceHolders(r,getHolder(_s));s|=v}return createWrap(t,s,e,r,a)}));function curry(e,t,s){t=s?r:t;var a=createWrap(e,b,r,r,r,r,r,t);a.placeholder=curry.placeholder;return a}function curryRight(e,t,s){t=s?r:t;var a=createWrap(e,x,r,r,r,r,r,t);a.placeholder=curryRight.placeholder;return a}function debounce(e,t,s){var a,n,i,l,c,u,p=0,f=false,d=false,m=true;if(typeof e!="function"){throw new nt(o)}t=toNumber(t)||0;if(isObject(s)){f=!!s.leading;d="maxWait"in s;i=d?Gt(toNumber(s.maxWait)||0,t):i;m="trailing"in s?!!s.trailing:m}function invokeFunc(t){var s=a,o=n;a=n=r;p=t;l=e.apply(o,s);return l}function leadingEdge(e){p=e;c=zr(timerExpired,t);return f?invokeFunc(e):l}function remainingWait(e){var r=e-u,s=e-p,a=t-r;return d?Ht(a,i-s):a}function shouldInvoke(e){var s=e-u,a=e-p;return u===r||s>=t||s<0||d&&a>=i}function timerExpired(){var e=js();if(shouldInvoke(e)){return trailingEdge(e)}c=zr(timerExpired,remainingWait(e))}function trailingEdge(e){c=r;if(m&&a){return invokeFunc(e)}a=n=r;return l}function cancel(){if(c!==r){Br(c)}p=0;a=u=n=c=r}function flush(){return c===r?l:trailingEdge(js())}function debounced(){var e=js(),s=shouldInvoke(e);a=arguments;n=this;u=e;if(s){if(c===r){return leadingEdge(u)}if(d){Br(c);c=zr(timerExpired,t);return invokeFunc(u)}}if(c===r){c=zr(timerExpired,t)}return l}debounced.cancel=cancel;debounced.flush=flush;return debounced}var Ss=baseRest((function(e,t){return baseDelay(e,1,t)}));var ks=baseRest((function(e,t,r){return baseDelay(e,toNumber(t)||0,r)}));function flip(e){return createWrap(e,_)}function memoize(e,t){if(typeof e!="function"||t!=null&&typeof t!="function"){throw new nt(o)}var memoized=function(){var r=arguments,s=t?t.apply(this,r):r[0],a=memoized.cache;if(a.has(s)){return a.get(s)}var n=e.apply(this,r);memoized.cache=a.set(s,n)||a;return n};memoized.cache=new(memoize.Cache||MapCache);return memoized}memoize.Cache=MapCache;function negate(e){if(typeof e!="function"){throw new nt(o)}return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function once(e){return before(2,e)}var Os=Fr((function(e,t){t=t.length==1&&Ns(t[0])?arrayMap(t[0],baseUnary(getIteratee())):arrayMap(baseFlatten(t,1),baseUnary(getIteratee()));var r=t.length;return baseRest((function(s){var a=-1,n=Ht(s.length,r);while(++a=t}));var Rs=baseIsArguments(function(){return arguments}())?baseIsArguments:function(e){return isObjectLike(e)&&dt.call(e,"callee")&&!Ot.call(e,"callee")};var Ns=t.isArray;var Ts=dr?baseUnary(dr):baseIsArrayBuffer;function isArrayLike(e){return e!=null&&isLength(e.length)&&!isFunction(e)}function isArrayLikeObject(e){return isObjectLike(e)&&isArrayLike(e)}function isBoolean(e){return e===true||e===false||isObjectLike(e)&&baseGetTag(e)==q}var Ms=Bt||stubFalse;var Ls=mr?baseUnary(mr):baseIsDate;function isElement(e){return isObjectLike(e)&&e.nodeType===1&&!isPlainObject(e)}function isEmpty(e){if(e==null){return true}if(isArrayLike(e)&&(Ns(e)||typeof e=="string"||typeof e.splice=="function"||Ms(e)||Us(e)||Rs(e))){return!e.length}var t=qr(e);if(t==Y||t==se){return!e.size}if(isPrototype(e)){return!baseKeys(e).length}for(var r in e){if(dt.call(e,r)){return false}}return true}function isEqual(e,t){return baseIsEqual(e,t)}function isEqualWith(e,t,s){s=typeof s=="function"?s:r;var a=s?s(e,t):r;return a===r?baseIsEqual(e,t,r,s):!!a}function isError(e){if(!isObjectLike(e)){return false}var t=baseGetTag(e);return t==z||t==H||typeof e.message=="string"&&typeof e.name=="string"&&!isPlainObject(e)}function isFinite(e){return typeof e=="number"&&Wt(e)}function isFunction(e){if(!isObject(e)){return false}var t=baseGetTag(e);return t==K||t==X||t==$||t==te}function isInteger(e){return typeof e=="number"&&e==toInteger(e)}function isLength(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=R}function isObject(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function isObjectLike(e){return e!=null&&typeof e=="object"}var Fs=yr?baseUnary(yr):baseIsMap;function isMatch(e,t){return e===t||baseIsMatch(e,t,getMatchData(t))}function isMatchWith(e,t,s){s=typeof s=="function"?s:r;return baseIsMatch(e,t,getMatchData(t),s)}function isNaN(e){return isNumber(e)&&e!=+e}function isNative(e){if(Gr(e)){throw new Qe(n)}return baseIsNative(e)}function isNull(e){return e===null}function isNil(e){return e==null}function isNumber(e){return typeof e=="number"||isObjectLike(e)&&baseGetTag(e)==J}function isPlainObject(e){if(!isObjectLike(e)||baseGetTag(e)!=Q){return false}var t=St(e);if(t===null){return true}var r=dt.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&ft.call(r)==bt}var Bs=gr?baseUnary(gr):baseIsRegExp;function isSafeInteger(e){return isInteger(e)&&e>=-R&&e<=R}var Ws=hr?baseUnary(hr):baseIsSet;function isString(e){return typeof e=="string"||!Ns(e)&&isObjectLike(e)&&baseGetTag(e)==ae}function isSymbol(e){return typeof e=="symbol"||isObjectLike(e)&&baseGetTag(e)==ne}var Us=br?baseUnary(br):baseIsTypedArray;function isUndefined(e){return e===r}function isWeakMap(e){return isObjectLike(e)&&qr(e)==ie}function isWeakSet(e){return isObjectLike(e)&&baseGetTag(e)==le}var Vs=createRelationalOperation(baseLt);var $s=createRelationalOperation((function(e,t){return e<=t}));function toArray(e){if(!e){return[]}if(isArrayLike(e)){return isString(e)?stringToArray(e):copyArray(e)}if(Dt&&e[Dt]){return iteratorToArray(e[Dt]())}var t=qr(e),r=t==Y?mapToArray:t==se?setToArray:values;return r(e)}function toFinite(e){if(!e){return e===0?e:0}e=toNumber(e);if(e===A||e===-A){var t=e<0?-1:1;return t*N}return e===e?e:0}function toInteger(e){var t=toFinite(e),r=t%1;return t===t?r?t-r:t:0}function toLength(e){return e?baseClamp(toInteger(e),0,L):0}function toNumber(e){if(typeof e=="number"){return e}if(isSymbol(e)){return M}if(isObject(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=isObject(t)?t+"":t}if(typeof e!="string"){return e===0?e:+e}e=e.replace(Te,"");var r=He.test(e);return r||Ke.test(e)?ar(e.slice(2),r?2:8):Ge.test(e)?M:+e}function toPlainObject(e){return copyObject(e,keysIn(e))}function toSafeInteger(e){return e?baseClamp(toInteger(e),-R,R):e===0?e:0}function toString(e){return e==null?"":baseToString(e)}var qs=createAssigner((function(e,t){if(isPrototype(t)||isArrayLike(t)){copyObject(t,keys(t),e);return}for(var r in t){if(dt.call(t,r)){assignValue(e,r,t[r])}}}));var Gs=createAssigner((function(e,t){copyObject(t,keysIn(t),e)}));var Hs=createAssigner((function(e,t,r,s){copyObject(t,keysIn(t),e,s)}));var zs=createAssigner((function(e,t,r,s){copyObject(t,keys(t),e,s)}));var Ks=flatRest(baseAt);function create(e,t){var r=Cr(e);return t==null?r:baseAssign(r,t)}var Xs=baseRest((function(e,t){e=rt(e);var s=-1;var a=t.length;var n=a>2?t[2]:r;if(n&&isIterateeCall(t[0],t[1],n)){a=1}while(++s1);return t}));copyObject(e,getAllKeysIn(e),r);if(s){r=baseClone(r,u|p|f,customOmitClone)}var a=t.length;while(a--){baseUnset(r,t[a])}return r}));function omitBy(e,t){return pickBy(e,negate(getIteratee(t)))}var sa=flatRest((function(e,t){return e==null?{}:basePick(e,t)}));function pickBy(e,t){if(e==null){return{}}var r=arrayMap(getAllKeysIn(e),(function(e){return[e]}));t=getIteratee(t);return basePickBy(e,r,(function(e,r){return t(e,r[0])}))}function result(e,t,s){t=castPath(t,e);var a=-1,n=t.length;if(!n){n=1;e=r}while(++at){var a=e;e=t;t=a}if(s||e%1||t%1){var n=Qt();return Ht(e+n*(t-e+sr("1e-"+((n+"").length-1))),t)}return baseRandom(e,t)}var oa=createCompounder((function(e,t,r){t=t.toLowerCase();return e+(r?capitalize(t):t)}));function capitalize(e){return da(toString(e).toLowerCase())}function deburr(e){e=toString(e);return e&&e.replace(Ye,vr).replace(qt,"")}function endsWith(e,t,s){e=toString(e);t=baseToString(t);var a=e.length;s=s===r?a:baseClamp(toInteger(s),0,a);var n=s;s-=t.length;return s>=0&&e.slice(s,n)==t}function escape(e){e=toString(e);return e&&ke.test(e)?e.replace(_e,Er):e}function escapeRegExp(e){e=toString(e);return e&&Ne.test(e)?e.replace(Re,"\\$&"):e}var ia=createCompounder((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}));var la=createCompounder((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}));var ca=createCaseFirst("toLowerCase");function pad(e,t,r){e=toString(e);t=toInteger(t);var s=t?stringSize(e):0;if(!t||s>=t){return e}var a=(t-s)/2;return createPadding(Lt(a),r)+e+createPadding(Mt(a),r)}function padEnd(e,t,r){e=toString(e);t=toInteger(t);var s=t?stringSize(e):0;return t&&s>>0;if(!s){return[]}e=toString(e);if(e&&(typeof t=="string"||t!=null&&!Bs(t))){t=baseToString(t);if(!t&&hasUnicode(e)){return castSlice(stringToArray(e),0,s)}}return e.split(t,s)}var pa=createCompounder((function(e,t,r){return e+(r?" ":"")+da(t)}));function startsWith(e,t,r){e=toString(e);r=r==null?0:baseClamp(toInteger(r),0,e.length);t=baseToString(t);return e.slice(r,r+t.length)==t}function template(e,t,s){var a=lodash.templateSettings;if(s&&isIterateeCall(e,t,s)){t=r}e=toString(e);t=Hs({},t,a,customDefaultsAssignIn);var n=Hs({},t.imports,a.imports,customDefaultsAssignIn),o=keys(n),i=baseValues(n,o);var l,c,u=0,p=t.interpolate||Je,f="__p += '";var d=st((t.escape||Je).source+"|"+p.source+"|"+(p===Pe?$e:Je).source+"|"+(t.evaluate||Je).source+"|$","g");var m="//# sourceURL="+(dt.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Yt+"]")+"\n";e.replace(d,(function(t,r,s,a,n,o){s||(s=a);f+=e.slice(u,o).replace(Ze,escapeStringChar);if(r){l=true;f+="' +\n__e("+r+") +\n'"}if(n){c=true;f+="';\n"+n+";\n__p += '"}if(s){f+="' +\n((__t = ("+s+")) == null ? '' : __t) +\n'"}u=o+t.length;return t}));f+="';\n";var y=dt.call(t,"variable")&&t.variable;if(!y){f="with (obj) {\n"+f+"\n}\n"}f=(c?f.replace(ve,""):f).replace(Ee,"$1").replace(je,"$1;");f="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(l?", __e = _.escape":"")+(c?", __j = Array.prototype.join;\n"+"function print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var g=ma((function(){return et(o,m+"return "+f).apply(r,i)}));g.source=f;if(isError(g)){throw g}return g}function toLower(e){return toString(e).toLowerCase()}function toUpper(e){return toString(e).toUpperCase()}function trim(e,t,s){e=toString(e);if(e&&(s||t===r)){return e.replace(Te,"")}if(!e||!(t=baseToString(t))){return e}var a=stringToArray(e),n=stringToArray(t),o=charsStartIndex(a,n),i=charsEndIndex(a,n)+1;return castSlice(a,o,i).join("")}function trimEnd(e,t,s){e=toString(e);if(e&&(s||t===r)){return e.replace(Le,"")}if(!e||!(t=baseToString(t))){return e}var a=stringToArray(e),n=charsEndIndex(a,stringToArray(t))+1;return castSlice(a,0,n).join("")}function trimStart(e,t,s){e=toString(e);if(e&&(s||t===r)){return e.replace(Me,"")}if(!e||!(t=baseToString(t))){return e}var a=stringToArray(e),n=charsStartIndex(a,stringToArray(t));return castSlice(a,n).join("")}function truncate(e,t){var s=S,a=k;if(isObject(t)){var n="separator"in t?t.separator:n;s="length"in t?toInteger(t.length):s;a="omission"in t?baseToString(t.omission):a}e=toString(e);var o=e.length;if(hasUnicode(e)){var i=stringToArray(e);o=i.length}if(s>=o){return e}var l=s-stringSize(a);if(l<1){return a}var c=i?castSlice(i,0,l).join(""):e.slice(0,l);if(n===r){return c+a}if(i){l+=c.length-l}if(Bs(n)){if(e.slice(l).search(n)){var u,p=c;if(!n.global){n=st(n.source,toString(qe.exec(n))+"g")}n.lastIndex=0;while(u=n.exec(p)){var f=u.index}c=c.slice(0,f===r?l:f)}}else if(e.indexOf(baseToString(n),l)!=l){var d=c.lastIndexOf(n);if(d>-1){c=c.slice(0,d)}}return c+a}function unescape(e){e=toString(e);return e&&Se.test(e)?e.replace(we,jr):e}var fa=createCompounder((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}));var da=createCaseFirst("toUpperCase");function words(e,t,s){e=toString(e);t=s?r:t;if(t===r){return hasUnicodeWord(e)?unicodeWords(e):asciiWords(e)}return e.match(t)||[]}var ma=baseRest((function(e,t){try{return apply(e,r,t)}catch(e){return isError(e)?e:new Qe(e)}}));var ya=flatRest((function(e,t){arrayEach(t,(function(t){t=toKey(t);baseAssignValue(e,t,ws(e[t],e))}));return e}));function cond(e){var t=e==null?0:e.length,r=getIteratee();e=!t?[]:arrayMap(e,(function(e){if(typeof e[1]!="function"){throw new nt(o)}return[r(e[0]),e[1]]}));return baseRest((function(r){var s=-1;while(++sR){return[]}var r=L,s=Ht(e,L);t=getIteratee(t);e-=L;var a=baseTimes(s,t);while(++r0||t<0)){return new LazyWrapper(s)}if(e<0){s=s.takeRight(-e)}else if(e){s=s.drop(e)}if(t!==r){t=toInteger(t);s=t<0?s.dropRight(-t):s.take(t-e)}return s};LazyWrapper.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()};LazyWrapper.prototype.toArray=function(){return this.take(L)};baseForOwn(LazyWrapper.prototype,(function(e,t){var s=/^(?:filter|find|map|reject)|While$/.test(t),a=/^(?:head|last)$/.test(t),n=lodash[a?"take"+(t=="last"?"Right":""):t],o=a||/^find/.test(t);if(!n){return}lodash.prototype[t]=function(){var t=this.__wrapped__,i=a?[1]:arguments,l=t instanceof LazyWrapper,c=i[0],u=l||Ns(t);var interceptor=function(e){var t=n.apply(lodash,arrayPush([e],i));return a&&p?t[0]:t};if(u&&s&&typeof c=="function"&&c.length!=1){l=u=false}var p=this.__chain__,f=!!this.__actions__.length,d=o&&!p,m=l&&!f;if(!o&&u){t=m?t:new LazyWrapper(this);var y=e.apply(t,i);y.__actions__.push({func:thru,args:[interceptor],thisArg:r});return new LodashWrapper(y,p)}if(d&&m){return e.apply(this,i)}y=this.thru(interceptor);return d?a?y.value()[0]:y.value():y}}));arrayEach(["pop","push","shift","sort","splice","unshift"],(function(e){var t=ot[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",s=/^(?:pop|shift)$/.test(e);lodash.prototype[e]=function(){var e=arguments;if(s&&!this.__chain__){var a=this.value();return t.apply(Ns(a)?a:[],e)}return this[r]((function(r){return t.apply(Ns(r)?r:[],e)}))}}));baseForOwn(LazyWrapper.prototype,(function(e,t){var r=lodash[t];if(r){var s=r.name+"";if(!dt.call(fr,s)){fr[s]=[]}fr[s].push({name:t,func:r})}}));fr[createHybrid(r,g).name]=[{name:"wrapper",func:r}];LazyWrapper.prototype.clone=lazyClone;LazyWrapper.prototype.reverse=lazyReverse;LazyWrapper.prototype.value=lazyValue;lodash.prototype.at=ds;lodash.prototype.chain=wrapperChain;lodash.prototype.commit=wrapperCommit;lodash.prototype.next=wrapperNext;lodash.prototype.plant=wrapperPlant;lodash.prototype.reverse=wrapperReverse;lodash.prototype.toJSON=lodash.prototype.valueOf=lodash.prototype.value=wrapperValue;lodash.prototype.first=lodash.prototype.head;if(Dt){lodash.prototype[Dt]=wrapperToIterator}return lodash};var _r=wr();if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){ir._=_r;define((function(){return _r}))}else if(cr){(cr.exports=_r)._=_r;lr._=_r}else{ir._=_r}}).call(this)},2742:e=>{"use strict";var t=process.platform==="win32";var r=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;var s=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/;var a={};function win32SplitPath(e){var t=r.exec(e),a=(t[1]||"")+(t[2]||""),n=t[3]||"";var o=s.exec(n),i=o[1],l=o[2],c=o[3];return[a,i,l,c]}a.parse=function(e){if(typeof e!=="string"){throw new TypeError("Parameter 'pathString' must be a string, not "+typeof e)}var t=win32SplitPath(e);if(!t||t.length!==4){throw new TypeError("Invalid path '"+e+"'")}return{root:t[0],dir:t[0]+t[1].slice(0,-1),base:t[2],ext:t[3],name:t[2].slice(0,t[2].length-t[3].length)}};var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var o={};function posixSplitPath(e){return n.exec(e).slice(1)}o.parse=function(e){if(typeof e!=="string"){throw new TypeError("Parameter 'pathString' must be a string, not "+typeof e)}var t=posixSplitPath(e);if(!t||t.length!==4){throw new TypeError("Invalid path '"+e+"'")}t[1]=t[1]||"";t[2]=t[2]||"";t[3]=t[3]||"";return{root:t[0],dir:t[0]+t[1].slice(0,-1),base:t[2],ext:t[3],name:t[2].slice(0,t[2].length-t[3].length)}};if(t)e.exports=a.parse;else e.exports=o.parse;e.exports.posix=o.parse;e.exports.win32=a.parse},1782:(e,t)=>{"use strict";var r=Object;var s=Object.defineProperty;var a=Object.create;function defProp(e,t,a){if(s)try{s.call(r,e,t,{value:a})}catch(r){e[t]=a}else{e[t]=a}}function makeSafeToCall(e){if(e){defProp(e,"call",e.call);defProp(e,"apply",e.apply)}return e}makeSafeToCall(s);makeSafeToCall(a);var n=makeSafeToCall(Object.prototype.hasOwnProperty);var o=makeSafeToCall(Number.prototype.toString);var i=makeSafeToCall(String.prototype.slice);var cloner=function(){};function create(e){if(a){return a.call(r,e)}cloner.prototype=e||null;return new cloner}var l=Math.random;var c=create(null);function makeUniqueKey(){do{var e=internString(i.call(o.call(l(),36),2))}while(n.call(c,e));return c[e]=e}function internString(e){var t={};t[e]=true;return Object.keys(t)[0]}t.makeUniqueKey=makeUniqueKey;var u=Object.getOwnPropertyNames;Object.getOwnPropertyNames=function getOwnPropertyNames(e){for(var t=u(e),r=0,s=0,a=t.length;rs){t[s]=t[r]}++s}}t.length=s;return t};function defaultCreatorFn(e){return create(null)}function makeAccessor(e){var t=makeUniqueKey();var r=create(null);e=e||defaultCreatorFn;function register(s){var a;function vault(t,n){if(t===r){return n?a=null:a||(a=e(s))}}defProp(s,t,vault)}function accessor(e){if(!n.call(e,t))register(e);return e[t](r)}accessor.forget=function(e){if(n.call(e,t))e[t](r,true)};return accessor}t.makeAccessor=makeAccessor},8741:function(e,t,r){e=r.nmd(e); +/*! https://mths.be/regenerate v1.3.3 by @mathias | MIT license */(function(r){var s=true&&t;var a=true&&e&&e.exports==s&&e;var n=typeof global=="object"&&global;if(n.global===n||n.window===n){r=n}var o={rangeOrder:"A range’s `stop` value must be greater than or equal "+"to the `start` value.",codePointRange:"Invalid code point value. Code points range from "+"U+000000 to U+10FFFF."};var i=55296;var l=56319;var c=56320;var u=57343;var p=/\\x00([^0123456789]|$)/g;var f={};var d=f.hasOwnProperty;var extend=function(e,t){var r;for(r in t){if(d.call(t,r)){e[r]=t[r]}}return e};var forEach=function(e,t){var r=-1;var s=e.length;while(++r=s&&tr){return e}if(t<=a&&r>=n){e.splice(s,2);continue}if(t>=a&&r=a&&t<=n){e[s+1]=t}else if(r>=a&&r<=n){e[s]=r+1;return e}s+=2}return e};var dataAdd=function(e,t){var r=0;var s;var a;var n=null;var i=e.length;if(t<0||t>1114111){throw RangeError(o.codePointRange)}while(r=s&&tt){e.splice(n!=null?n+2:0,0,t,t+1);return e}if(t==a){if(t+1==e[r+2]){e.splice(r,4,s,e[r+3]);return e}e[r+1]=t+1;return e}n=r;r+=2}e.push(t,t+1);return e};var dataAddData=function(e,t){var r=0;var s;var a;var n=e.slice();var o=t.length;while(r1114111||r<0||r>1114111){throw RangeError(o.codePointRange)}var s=0;var a;var n;var i=false;var l=e.length;while(sr){return e}if(a>=t&&a<=r){if(n>t&&n-1<=r){e.splice(s,2);s-=2}else{e.splice(s-1,2);s-=2}}}else if(a==r+1){e[s]=t;return e}else if(a>r){e.splice(s,0,t,r+1);return e}else if(t>=a&&t=a&&t=n){e[s]=t;e[s+1]=r+1;i=true}s+=2}if(!i){e.push(t,r+1)}return e};var dataContains=function(e,t){var r=0;var s=e.length;var a=e[r];var n=e[s-1];if(s>=2){if(tn){return false}}while(r=a&&t=40&&e<=43||e==46||e==47||e==63||e>=91&&e<=94||e>=123&&e<=125){t="\\"+b(e)}else if(e>=32&&e<=126){t=b(e)}else if(e<=255){t="\\x"+pad(hex(e),2)}else{t="\\u"+pad(hex(e),4)}return t};var codePointToStringUnicode=function(e){if(e<=65535){return codePointToString(e)}return"\\u{"+e.toString(16).toUpperCase()+"}"};var symbolToCodePoint=function(e){var t=e.length;var r=e.charCodeAt(0);var s;if(r>=i&&r<=l&&t>1){s=e.charCodeAt(1);return(r-i)*1024+s-c+65536}return r};var createBMPCharacterClasses=function(e){var t="";var r=0;var s;var a;var n=e.length;if(dataIsSingleton(e)){return codePointToString(e[0])}while(r=i&&p<=l){s.push(o,i);t.push(i,p+1)}if(p>=c&&p<=u){s.push(o,i);t.push(i,l+1);r.push(c,p+1)}if(p>u){s.push(o,i);t.push(i,l+1);r.push(c,u+1);if(p<=65535){s.push(u+1,p+1)}else{s.push(u+1,65535+1);a.push(65535+1,p+1)}}}else if(o>=i&&o<=l){if(p>=i&&p<=l){t.push(o,p+1)}if(p>=c&&p<=u){t.push(o,l+1);r.push(c,p+1)}if(p>u){t.push(o,l+1);r.push(c,u+1);if(p<=65535){s.push(u+1,p+1)}else{s.push(u+1,65535+1);a.push(65535+1,p+1)}}}else if(o>=c&&o<=u){if(p>=c&&p<=u){r.push(o,p+1)}if(p>u){r.push(o,u+1);if(p<=65535){s.push(u+1,p+1)}else{s.push(u+1,65535+1);a.push(65535+1,p+1)}}}else if(o>u&&o<=65535){if(p<=65535){s.push(o,p+1)}else{s.push(o,65535+1);a.push(65535+1,p+1)}}else{a.push(o,p+1)}n+=2}return{loneHighSurrogates:t,loneLowSurrogates:r,bmp:s,astral:a}};var optimizeSurrogateMappings=function(e){var t=[];var r=[];var s=false;var a;var n;var o;var i;var l;var c;var u=-1;var p=e.length;while(++u1){e=g.call(arguments)}if(this instanceof regenerate){this.data=[];return e?this.add(e):this}return(new regenerate).add(e)};regenerate.version="1.3.3";var x=regenerate.prototype;extend(x,{add:function(e){var t=this;if(e==null){return t}if(e instanceof regenerate){t.data=dataAddData(t.data,e.data);return t}if(arguments.length>1){e=g.call(arguments)}if(isArray(e)){forEach(e,(function(e){t.add(e)}));return t}t.data=dataAdd(t.data,isNumber(e)?e:symbolToCodePoint(e));return t},remove:function(e){var t=this;if(e==null){return t}if(e instanceof regenerate){t.data=dataRemoveData(t.data,e.data);return t}if(arguments.length>1){e=g.call(arguments)}if(isArray(e)){forEach(e,(function(e){t.remove(e)}));return t}t.data=dataRemove(t.data,isNumber(e)?e:symbolToCodePoint(e));return t},addRange:function(e,t){var r=this;r.data=dataAddRange(r.data,isNumber(e)?e:symbolToCodePoint(e),isNumber(t)?t:symbolToCodePoint(t));return r},removeRange:function(e,t){var r=this;var s=isNumber(e)?e:symbolToCodePoint(e);var a=isNumber(t)?t:symbolToCodePoint(t);r.data=dataRemoveRange(r.data,s,a);return r},intersection:function(e){var t=this;var r=e instanceof regenerate?dataToArray(e.data):e;t.data=dataIntersection(t.data,r);return t},contains:function(e){return dataContains(this.data,isNumber(e)?e:symbolToCodePoint(e))},clone:function(){var e=new regenerate;e.data=this.data.slice(0);return e},toString:function(e){var t=createCharacterClassesFromData(this.data,e?e.bmpOnly:false,e?e.hasUnicodeFlag:false);if(!t){return"[]"}return t.replace(p,"\\0$1")},toRegExp:function(e){var t=this.toString(e&&e.indexOf("u")!=-1?{hasUnicodeFlag:true}:null);return RegExp(t,e||"")},valueOf:function(){return dataToArray(this.data)}});x.toArray=x.valueOf;if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define((function(){return regenerate}))}else if(s&&!s.nodeType){if(a){a.exports=regenerate}else{s.regenerate=regenerate}}else{r.regenerate=regenerate}})(this)},6419:(e,t,r)=>{"use strict";var s=r(449);var a=r(6919);var n=a(r(9491));var o=s(r(9048));var i=s(r(3085));var l=s(r(6401));var c=Object.prototype.hasOwnProperty;function Emitter(e){n["default"].ok(this instanceof Emitter);l.getTypes().assertIdentifier(e);this.nextTempId=0;this.contextId=e;this.listing=[];this.marked=[true];this.insertedLocs=new Set;this.finalLoc=this.loc();this.tryEntries=[];this.leapManager=new o.LeapManager(this)}var u=Emitter.prototype;t.Emitter=Emitter;u.loc=function(){var e=l.getTypes().numericLiteral(-1);this.insertedLocs.add(e);return e};u.getInsertedLocs=function(){return this.insertedLocs};u.getContextId=function(){return l.getTypes().clone(this.contextId)};u.mark=function(e){l.getTypes().assertLiteral(e);var t=this.listing.length;if(e.value===-1){e.value=t}else{n["default"].strictEqual(e.value,t)}this.marked[t]=true;return e};u.emit=function(e){var t=l.getTypes();if(t.isExpression(e)){e=t.expressionStatement(e)}t.assertStatement(e);this.listing.push(e)};u.emitAssign=function(e,t){this.emit(this.assign(e,t));return e};u.assign=function(e,t){var r=l.getTypes();return r.expressionStatement(r.assignmentExpression("=",r.cloneDeep(e),t))};u.contextProperty=function(e,t){var r=l.getTypes();return r.memberExpression(this.getContextId(),t?r.stringLiteral(e):r.identifier(e),!!t)};u.stop=function(e){if(e){this.setReturnValue(e)}this.jump(this.finalLoc)};u.setReturnValue=function(e){l.getTypes().assertExpression(e.value);this.emitAssign(this.contextProperty("rval"),this.explodeExpression(e))};u.clearPendingException=function(e,t){var r=l.getTypes();r.assertLiteral(e);var s=r.callExpression(this.contextProperty("catch",true),[r.clone(e)]);if(t){this.emitAssign(t,s)}else{this.emit(s)}};u.jump=function(e){this.emitAssign(this.contextProperty("next"),e);this.emit(l.getTypes().breakStatement())};u.jumpIf=function(e,t){var r=l.getTypes();r.assertExpression(e);r.assertLiteral(t);this.emit(r.ifStatement(e,r.blockStatement([this.assign(this.contextProperty("next"),t),r.breakStatement()])))};u.jumpIfNot=function(e,t){var r=l.getTypes();r.assertExpression(e);r.assertLiteral(t);var s;if(r.isUnaryExpression(e)&&e.operator==="!"){s=e.argument}else{s=r.unaryExpression("!",e)}this.emit(r.ifStatement(s,r.blockStatement([this.assign(this.contextProperty("next"),t),r.breakStatement()])))};u.makeTempVar=function(){return this.contextProperty("t"+this.nextTempId++)};u.getContextFunction=function(e){var t=l.getTypes();return t.functionExpression(e||null,[this.getContextId()],t.blockStatement([this.getDispatchLoop()]),false,false)};u.getDispatchLoop=function(){var e=this;var t=l.getTypes();var r=[];var s;var a=false;e.listing.forEach((function(n,o){if(e.marked.hasOwnProperty(o)){r.push(t.switchCase(t.numericLiteral(o),s=[]));a=false}if(!a){s.push(n);if(t.isCompletionStatement(n))a=true}}));this.finalLoc.value=this.listing.length;r.push(t.switchCase(this.finalLoc,[]),t.switchCase(t.stringLiteral("end"),[t.returnStatement(t.callExpression(this.contextProperty("stop"),[]))]));return t.whileStatement(t.numericLiteral(1),t.switchStatement(t.assignmentExpression("=",this.contextProperty("prev"),this.contextProperty("next")),r))};u.getTryLocsList=function(){if(this.tryEntries.length===0){return null}var e=l.getTypes();var t=0;return e.arrayExpression(this.tryEntries.map((function(r){var s=r.firstLoc.value;n["default"].ok(s>=t,"try entries out of order");t=s;var a=r.catchEntry;var o=r.finallyEntry;var i=[r.firstLoc,a?a.firstLoc:null];if(o){i[2]=o.firstLoc;i[3]=o.afterLoc}return e.arrayExpression(i.map((function(t){return t&&e.clone(t)})))})))};u.explode=function(e,t){var r=l.getTypes();var s=e.node;var a=this;r.assertNode(s);if(r.isDeclaration(s))throw getDeclError(s);if(r.isStatement(s))return a.explodeStatement(e);if(r.isExpression(s))return a.explodeExpression(e,t);switch(s.type){case"Program":return e.get("body").map(a.explodeStatement,a);case"VariableDeclarator":throw getDeclError(s);case"Property":case"SwitchCase":case"CatchClause":throw new Error(s.type+" nodes should be handled by their parents");default:throw new Error("unknown Node of type "+JSON.stringify(s.type))}};function getDeclError(e){return new Error("all declarations should have been transformed into "+"assignments before the Exploder began its work: "+JSON.stringify(e))}u.explodeStatement=function(e,t){var r=l.getTypes();var s=e.node;var a=this;var c,u,f;r.assertStatement(s);if(t){r.assertIdentifier(t)}else{t=null}if(r.isBlockStatement(s)){e.get("body").forEach((function(e){a.explodeStatement(e)}));return}if(!i.containsLeap(s)){a.emit(s);return}switch(s.type){case"ExpressionStatement":a.explodeExpression(e.get("expression"),true);break;case"LabeledStatement":u=this.loc();a.leapManager.withEntry(new o.LabeledEntry(u,s.label),(function(){a.explodeStatement(e.get("body"),s.label)}));a.mark(u);break;case"WhileStatement":c=this.loc();u=this.loc();a.mark(c);a.jumpIfNot(a.explodeExpression(e.get("test")),u);a.leapManager.withEntry(new o.LoopEntry(u,c,t),(function(){a.explodeStatement(e.get("body"))}));a.jump(c);a.mark(u);break;case"DoWhileStatement":var d=this.loc();var m=this.loc();u=this.loc();a.mark(d);a.leapManager.withEntry(new o.LoopEntry(u,m,t),(function(){a.explode(e.get("body"))}));a.mark(m);a.jumpIf(a.explodeExpression(e.get("test")),d);a.mark(u);break;case"ForStatement":f=this.loc();var y=this.loc();u=this.loc();if(s.init){a.explode(e.get("init"),true)}a.mark(f);if(s.test){a.jumpIfNot(a.explodeExpression(e.get("test")),u)}else{}a.leapManager.withEntry(new o.LoopEntry(u,y,t),(function(){a.explodeStatement(e.get("body"))}));a.mark(y);if(s.update){a.explode(e.get("update"),true)}a.jump(f);a.mark(u);break;case"TypeCastExpression":return a.explodeExpression(e.get("expression"));case"ForInStatement":f=this.loc();u=this.loc();var g=a.makeTempVar();a.emitAssign(g,r.callExpression(l.runtimeProperty("keys"),[a.explodeExpression(e.get("right"))]));a.mark(f);var h=a.makeTempVar();a.jumpIf(r.memberExpression(r.assignmentExpression("=",h,r.callExpression(r.cloneDeep(g),[])),r.identifier("done"),false),u);a.emitAssign(s.left,r.memberExpression(r.cloneDeep(h),r.identifier("value"),false));a.leapManager.withEntry(new o.LoopEntry(u,f,t),(function(){a.explodeStatement(e.get("body"))}));a.jump(f);a.mark(u);break;case"BreakStatement":a.emitAbruptCompletion({type:"break",target:a.leapManager.getBreakLoc(s.label)});break;case"ContinueStatement":a.emitAbruptCompletion({type:"continue",target:a.leapManager.getContinueLoc(s.label)});break;case"SwitchStatement":var b=a.emitAssign(a.makeTempVar(),a.explodeExpression(e.get("discriminant")));u=this.loc();var x=this.loc();var v=x;var E=[];var j=s.cases||[];for(var w=j.length-1;w>=0;--w){var _=j[w];r.assertSwitchCase(_);if(_.test){v=r.conditionalExpression(r.binaryExpression("===",r.cloneDeep(b),_.test),E[w]=this.loc(),v)}else{E[w]=x}}var S=e.get("discriminant");l.replaceWithOrRemove(S,v);a.jump(a.explodeExpression(S));a.leapManager.withEntry(new o.SwitchEntry(u),(function(){e.get("cases").forEach((function(e){var t=e.key;a.mark(E[t]);e.get("consequent").forEach((function(e){a.explodeStatement(e)}))}))}));a.mark(u);if(x.value===-1){a.mark(x);n["default"].strictEqual(u.value,x.value)}break;case"IfStatement":var k=s.alternate&&this.loc();u=this.loc();a.jumpIfNot(a.explodeExpression(e.get("test")),k||u);a.explodeStatement(e.get("consequent"));if(k){a.jump(u);a.mark(k);a.explodeStatement(e.get("alternate"))}a.mark(u);break;case"ReturnStatement":a.emitAbruptCompletion({type:"return",value:a.explodeExpression(e.get("argument"))});break;case"WithStatement":throw new Error("WithStatement not supported in generator functions.");case"TryStatement":u=this.loc();var O=s.handler;var I=O&&this.loc();var P=I&&new o.CatchEntry(I,O.param);var D=s.finalizer&&this.loc();var C=D&&new o.FinallyEntry(D,u);var A=new o.TryEntry(a.getUnmarkedCurrentLoc(),P,C);a.tryEntries.push(A);a.updateContextPrevLoc(A.firstLoc);a.leapManager.withEntry(A,(function(){a.explodeStatement(e.get("block"));if(I){if(D){a.jump(D)}else{a.jump(u)}a.updateContextPrevLoc(a.mark(I));var t=e.get("handler.body");var s=a.makeTempVar();a.clearPendingException(A.firstLoc,s);t.traverse(p,{getSafeParam:function getSafeParam(){return r.cloneDeep(s)},catchParamName:O.param.name});a.leapManager.withEntry(P,(function(){a.explodeStatement(t)}))}if(D){a.updateContextPrevLoc(a.mark(D));a.leapManager.withEntry(C,(function(){a.explodeStatement(e.get("finalizer"))}));a.emit(r.returnStatement(r.callExpression(a.contextProperty("finish"),[C.firstLoc])))}}));a.mark(u);break;case"ThrowStatement":a.emit(r.throwStatement(a.explodeExpression(e.get("argument"))));break;default:throw new Error("unknown Statement of type "+JSON.stringify(s.type))}};var p={Identifier:function Identifier(e,t){if(e.node.name===t.catchParamName&&l.isReference(e)){l.replaceWithOrRemove(e,t.getSafeParam())}},Scope:function Scope(e,t){if(e.scope.hasOwnBinding(t.catchParamName)){e.skip()}}};u.emitAbruptCompletion=function(e){if(!isValidCompletion(e)){n["default"].ok(false,"invalid completion record: "+JSON.stringify(e))}n["default"].notStrictEqual(e.type,"normal","normal completions are not abrupt");var t=l.getTypes();var r=[t.stringLiteral(e.type)];if(e.type==="break"||e.type==="continue"){t.assertLiteral(e.target);r[1]=this.insertedLocs.has(e.target)?e.target:t.cloneDeep(e.target)}else if(e.type==="return"||e.type==="throw"){if(e.value){t.assertExpression(e.value);r[1]=this.insertedLocs.has(e.value)?e.value:t.cloneDeep(e.value)}}this.emit(t.returnStatement(t.callExpression(this.contextProperty("abrupt"),r)))};function isValidCompletion(e){var t=e.type;if(t==="normal"){return!c.call(e,"target")}if(t==="break"||t==="continue"){return!c.call(e,"value")&&l.getTypes().isLiteral(e.target)}if(t==="return"||t==="throw"){return c.call(e,"value")&&!c.call(e,"target")}return false}u.getUnmarkedCurrentLoc=function(){return l.getTypes().numericLiteral(this.listing.length)};u.updateContextPrevLoc=function(e){var t=l.getTypes();if(e){t.assertLiteral(e);if(e.value===-1){e.value=this.listing.length}else{n["default"].strictEqual(e.value,this.listing.length)}}else{e=this.getUnmarkedCurrentLoc()}this.emitAssign(this.contextProperty("prev"),e)};u.explodeExpression=function(e,t){var r=l.getTypes();var s=e.node;if(s){r.assertExpression(s)}else{return s}var a=this;var o;var c;function finish(e){r.assertExpression(e);if(t){a.emit(e)}else{return e}}if(!i.containsLeap(s)){return finish(s)}var u=i.containsLeap.onlyChildren(s);function explodeViaTempVar(e,t,s){n["default"].ok(!s||!e,"Ignoring the result of a child expression but forcing it to "+"be assigned to a temporary variable?");var o=a.explodeExpression(t,s);if(s){}else if(e||u&&!r.isLiteral(o)){o=a.emitAssign(e||a.makeTempVar(),o)}return o}switch(s.type){case"MemberExpression":return finish(r.memberExpression(a.explodeExpression(e.get("object")),s.computed?explodeViaTempVar(null,e.get("property")):s.property,s.computed));case"CallExpression":var p=e.get("callee");var f=e.get("arguments");var d;var m;var y=f.some((function(e){return i.containsLeap(e.node)}));var g=null;if(r.isMemberExpression(p.node)){if(y){var h=explodeViaTempVar(a.makeTempVar(),p.get("object"));var b=p.node.computed?explodeViaTempVar(null,p.get("property")):p.node.property;g=h;d=r.memberExpression(r.memberExpression(r.cloneDeep(h),b,p.node.computed),r.identifier("call"),false)}else{d=a.explodeExpression(p)}}else{d=explodeViaTempVar(null,p);if(r.isMemberExpression(d)){d=r.sequenceExpression([r.numericLiteral(0),r.cloneDeep(d)])}}if(y){m=f.map((function(e){return explodeViaTempVar(null,e)}));if(g)m.unshift(g);m=m.map((function(e){return r.cloneDeep(e)}))}else{m=e.node.arguments}return finish(r.callExpression(d,m));case"NewExpression":return finish(r.newExpression(explodeViaTempVar(null,e.get("callee")),e.get("arguments").map((function(e){return explodeViaTempVar(null,e)}))));case"ObjectExpression":return finish(r.objectExpression(e.get("properties").map((function(e){if(e.isObjectProperty()){return r.objectProperty(e.node.key,explodeViaTempVar(null,e.get("value")),e.node.computed)}else{return e.node}}))));case"ArrayExpression":return finish(r.arrayExpression(e.get("elements").map((function(e){if(e.isSpreadElement()){return r.spreadElement(explodeViaTempVar(null,e.get("argument")))}else{return explodeViaTempVar(null,e)}}))));case"SequenceExpression":var x=s.expressions.length-1;e.get("expressions").forEach((function(e){if(e.key===x){o=a.explodeExpression(e,t)}else{a.explodeExpression(e,true)}}));return o;case"LogicalExpression":c=this.loc();if(!t){o=a.makeTempVar()}var v=explodeViaTempVar(o,e.get("left"));if(s.operator==="&&"){a.jumpIfNot(v,c)}else{n["default"].strictEqual(s.operator,"||");a.jumpIf(v,c)}explodeViaTempVar(o,e.get("right"),t);a.mark(c);return o;case"ConditionalExpression":var E=this.loc();c=this.loc();var j=a.explodeExpression(e.get("test"));a.jumpIfNot(j,E);if(!t){o=a.makeTempVar()}explodeViaTempVar(o,e.get("consequent"),t);a.jump(c);a.mark(E);explodeViaTempVar(o,e.get("alternate"),t);a.mark(c);return o;case"UnaryExpression":return finish(r.unaryExpression(s.operator,a.explodeExpression(e.get("argument")),!!s.prefix));case"BinaryExpression":return finish(r.binaryExpression(s.operator,explodeViaTempVar(null,e.get("left")),explodeViaTempVar(null,e.get("right"))));case"AssignmentExpression":if(s.operator==="="){return finish(r.assignmentExpression(s.operator,a.explodeExpression(e.get("left")),a.explodeExpression(e.get("right"))))}var w=a.explodeExpression(e.get("left"));var _=a.emitAssign(a.makeTempVar(),w);return finish(r.assignmentExpression("=",r.cloneDeep(w),r.assignmentExpression(s.operator,r.cloneDeep(_),a.explodeExpression(e.get("right")))));case"UpdateExpression":return finish(r.updateExpression(s.operator,a.explodeExpression(e.get("argument")),s.prefix));case"YieldExpression":c=this.loc();var S=s.argument&&a.explodeExpression(e.get("argument"));if(S&&s.delegate){var k=a.makeTempVar();var O=r.returnStatement(r.callExpression(a.contextProperty("delegateYield"),[S,r.stringLiteral(k.property.name),c]));O.loc=s.loc;a.emit(O);a.mark(c);return k}a.emitAssign(a.contextProperty("next"),c);var I=r.returnStatement(r.cloneDeep(S)||null);I.loc=s.loc;a.emit(I);a.mark(c);return a.contextProperty("sent");default:throw new Error("unknown Expression of type "+JSON.stringify(s.type))}}},5604:(e,t,r)=>{"use strict";var s=r(449);var a=s(r(6401));var n=Object.prototype.hasOwnProperty;t.hoist=function(e){var t=a.getTypes();t.assertFunction(e.node);var r={};function varDeclToExpr(e,s){var a=e.node,n=e.scope;t.assertVariableDeclaration(a);var o=[];a.declarations.forEach((function(e){r[e.id.name]=t.identifier(e.id.name);n.removeBinding(e.id.name);if(e.init){o.push(t.assignmentExpression("=",e.id,e.init))}else if(s){o.push(e.id)}}));if(o.length===0)return null;if(o.length===1)return o[0];return t.sequenceExpression(o)}e.get("body").traverse({VariableDeclaration:{exit:function exit(e){var r=varDeclToExpr(e,false);if(r===null){e.remove()}else{a.replaceWithOrRemove(e,t.expressionStatement(r))}e.skip()}},ForStatement:function ForStatement(e){var t=e.get("init");if(t.isVariableDeclaration()){a.replaceWithOrRemove(t,varDeclToExpr(t,false))}},ForXStatement:function ForXStatement(e){var t=e.get("left");if(t.isVariableDeclaration()){a.replaceWithOrRemove(t,varDeclToExpr(t,true))}},FunctionDeclaration:function FunctionDeclaration(e){var s=e.node;r[s.id.name]=s.id;var n=t.expressionStatement(t.assignmentExpression("=",t.clone(s.id),t.functionExpression(e.scope.generateUidIdentifierBasedOnNode(s),s.params,s.body,s.generator,s.expression)));if(e.parentPath.isBlockStatement()){e.parentPath.unshiftContainer("body",n);e.remove()}else{a.replaceWithOrRemove(e,n)}e.scope.removeBinding(s.id.name);e.skip()},FunctionExpression:function FunctionExpression(e){e.skip()},ArrowFunctionExpression:function ArrowFunctionExpression(e){e.skip()}});var s={};e.get("params").forEach((function(e){var r=e.node;if(t.isIdentifier(r)){s[r.name]=r}else{}}));var o=[];Object.keys(r).forEach((function(e){if(!n.call(s,e)){o.push(t.variableDeclarator(r[e],null))}}));if(o.length===0){return null}return t.variableDeclaration("var",o)}},9522:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=_default;var s=r(5490);function _default(e){var t={visitor:(0,s.getVisitor)(e)};var r=e&&e.version;if(r&&parseInt(r,10)>=7){t.name="regenerator-transform"}return t}},9048:(e,t,r)=>{"use strict";var s=r(6919);var a=s(r(9491));var n=r(6419);var o=r(3837);var i=r(6401);function Entry(){a["default"].ok(this instanceof Entry)}function FunctionEntry(e){Entry.call(this);(0,i.getTypes)().assertLiteral(e);this.returnLoc=e}(0,o.inherits)(FunctionEntry,Entry);t.FunctionEntry=FunctionEntry;function LoopEntry(e,t,r){Entry.call(this);var s=(0,i.getTypes)();s.assertLiteral(e);s.assertLiteral(t);if(r){s.assertIdentifier(r)}else{r=null}this.breakLoc=e;this.continueLoc=t;this.label=r}(0,o.inherits)(LoopEntry,Entry);t.LoopEntry=LoopEntry;function SwitchEntry(e){Entry.call(this);(0,i.getTypes)().assertLiteral(e);this.breakLoc=e}(0,o.inherits)(SwitchEntry,Entry);t.SwitchEntry=SwitchEntry;function TryEntry(e,t,r){Entry.call(this);var s=(0,i.getTypes)();s.assertLiteral(e);if(t){a["default"].ok(t instanceof CatchEntry)}else{t=null}if(r){a["default"].ok(r instanceof FinallyEntry)}else{r=null}a["default"].ok(t||r);this.firstLoc=e;this.catchEntry=t;this.finallyEntry=r}(0,o.inherits)(TryEntry,Entry);t.TryEntry=TryEntry;function CatchEntry(e,t){Entry.call(this);var r=(0,i.getTypes)();r.assertLiteral(e);r.assertIdentifier(t);this.firstLoc=e;this.paramId=t}(0,o.inherits)(CatchEntry,Entry);t.CatchEntry=CatchEntry;function FinallyEntry(e,t){Entry.call(this);var r=(0,i.getTypes)();r.assertLiteral(e);r.assertLiteral(t);this.firstLoc=e;this.afterLoc=t}(0,o.inherits)(FinallyEntry,Entry);t.FinallyEntry=FinallyEntry;function LabeledEntry(e,t){Entry.call(this);var r=(0,i.getTypes)();r.assertLiteral(e);r.assertIdentifier(t);this.breakLoc=e;this.label=t}(0,o.inherits)(LabeledEntry,Entry);t.LabeledEntry=LabeledEntry;function LeapManager(e){a["default"].ok(this instanceof LeapManager);a["default"].ok(e instanceof n.Emitter);this.emitter=e;this.entryStack=[new FunctionEntry(e.finalLoc)]}var l=LeapManager.prototype;t.LeapManager=LeapManager;l.withEntry=function(e,t){a["default"].ok(e instanceof Entry);this.entryStack.push(e);try{t.call(this.emitter)}finally{var r=this.entryStack.pop();a["default"].strictEqual(r,e)}};l._findLeapLocation=function(e,t){for(var r=this.entryStack.length-1;r>=0;--r){var s=this.entryStack[r];var a=s[e];if(a){if(t){if(s.label&&s.label.name===t.name){return a}}else if(s instanceof LabeledEntry){}else{return a}}}return null};l.getBreakLoc=function(e){return this._findLeapLocation("breakLoc",e)};l.getContinueLoc=function(e){return this._findLeapLocation("continueLoc",e)}},3085:(e,t,r)=>{"use strict";var s=r(6919);var a=s(r(9491));var n=r(6401);var o=r(1782);var i=(0,o.makeAccessor)();var l=Object.prototype.hasOwnProperty;function makePredicate(e,t){function onlyChildren(e){var t=(0,n.getTypes)();t.assertNode(e);var r=false;function check(e){if(r){}else if(Array.isArray(e)){e.some(check)}else if(t.isNode(e)){a["default"].strictEqual(r,false);r=predicate(e)}return r}var s=t.VISITOR_KEYS[e.type];if(s){for(var o=0;o{"use strict";var s=r(449);t.__esModule=true;t["default"]=replaceShorthandObjectMethod;var a=s(r(6401));function replaceShorthandObjectMethod(e){var t=a.getTypes();if(!e.node||!t.isFunction(e.node)){throw new Error("replaceShorthandObjectMethod can only be called on Function AST node paths.")}if(!t.isObjectMethod(e.node)){return e}if(!e.node.generator){return e}var r=e.node.params.map((function(e){return t.cloneDeep(e)}));var s=t.functionExpression(null,r,t.cloneDeep(e.node.body),e.node.generator,e.node.async);a.replaceWithOrRemove(e,t.objectProperty(t.cloneDeep(e.node.key),s,e.node.computed,false));return e.get("value")}},6401:(e,t)=>{"use strict";t.__esModule=true;t.wrapWithTypes=wrapWithTypes;t.getTypes=getTypes;t.runtimeProperty=runtimeProperty;t.isReference=isReference;t.replaceWithOrRemove=replaceWithOrRemove;var r=null;function wrapWithTypes(e,t){return function(){var s=r;r=e;try{for(var a=arguments.length,n=new Array(a),o=0;o{"use strict";var s=r(449);var a=r(6919);var n=a(r(9491));var o=r(5604);var i=r(6419);var l=a(r(3539));var c=s(r(6401));var u=r(1782);t.getVisitor=function(e){var t=e.types;return{Method:function Method(e,r){var s=e.node;if(!shouldRegenerate(s,r))return;var a=t.functionExpression(null,[],t.cloneNode(s.body,false),s.generator,s.async);e.get("body").set("body",[t.returnStatement(t.callExpression(a,[]))]);s.async=false;s.generator=false;e.get("body.body.0.argument.callee").unwrapFunctionEnvironment()},Function:{exit:c.wrapWithTypes(t,(function(e,r){var s=e.node;if(!shouldRegenerate(s,r))return;e=(0,l["default"])(e);s=e.node;var a=e.scope.generateUidIdentifier("context");var n=e.scope.generateUidIdentifier("args");e.ensureBlock();var u=e.get("body");if(s.async){u.traverse(m)}u.traverse(d,{context:a});var p=[];var y=[];u.get("body").forEach((function(e){var r=e.node;if(t.isExpressionStatement(r)&&t.isStringLiteral(r.expression)){p.push(r)}else if(r&&r._blockHoist!=null){p.push(r)}else{y.push(r)}}));if(p.length>0){u.node.body=y}var g=getOuterFnExpr(e);t.assertIdentifier(s.id);var h=t.identifier(s.id.name+"$");var b=(0,o.hoist)(e);var x={usesThis:false,usesArguments:false,getArgsId:function getArgsId(){return t.clone(n)}};e.traverse(f,x);if(x.usesArguments){b=b||t.variableDeclaration("var",[]);b.declarations.push(t.variableDeclarator(t.clone(n),t.identifier("arguments")))}var v=new i.Emitter(a);v.explode(e.get("body"));if(b&&b.declarations.length>0){p.push(b)}var E=[v.getContextFunction(h)];var j=v.getTryLocsList();if(s.generator){E.push(g)}else if(x.usesThis||j||s.async){E.push(t.nullLiteral())}if(x.usesThis){E.push(t.thisExpression())}else if(j||s.async){E.push(t.nullLiteral())}if(j){E.push(j)}else if(s.async){E.push(t.nullLiteral())}if(s.async){var w=e.scope;do{if(w.hasOwnBinding("Promise"))w.rename("Promise")}while(w=w.parent);E.push(t.identifier("Promise"))}var _=t.callExpression(c.runtimeProperty(s.async?"async":"wrap"),E);p.push(t.returnStatement(_));s.body=t.blockStatement(p);e.get("body.body").forEach((function(e){return e.scope.registerDeclaration(e)}));var S=u.node.directives;if(S){s.body.directives=S}var k=s.generator;if(k){s.generator=false}if(s.async){s.async=false}if(k&&t.isExpression(s)){c.replaceWithOrRemove(e,t.callExpression(c.runtimeProperty("mark"),[s]));e.addComment("leading","#__PURE__")}var O=v.getInsertedLocs();e.traverse({NumericLiteral:function NumericLiteral(e){if(!O.has(e.node)){return}e.replaceWith(t.numericLiteral(e.node.value))}});e.requeue()}))}}};function shouldRegenerate(e,t){if(e.generator){if(e.async){return t.opts.asyncGenerators!==false}else{return t.opts.generators!==false}}else if(e.async){return t.opts.async!==false}else{return false}}function getOuterFnExpr(e){var t=c.getTypes();var r=e.node;t.assertFunction(r);if(!r.id){r.id=e.scope.parent.generateUidIdentifier("callee")}if(r.generator&&t.isFunctionDeclaration(r)){return getMarkedFunctionId(e)}return t.clone(r.id)}var p=(0,u.makeAccessor)();function getMarkedFunctionId(e){var t=c.getTypes();var r=e.node;t.assertIdentifier(r.id);var s=e.findParent((function(e){return e.isProgram()||e.isBlockStatement()}));if(!s){return r.id}var a=s.node;n["default"].ok(Array.isArray(a.body));var o=p(a);if(!o.decl){o.decl=t.variableDeclaration("var",[]);s.unshiftContainer("body",o.decl);o.declPath=s.get("body.0")}n["default"].strictEqual(o.declPath.node,o.decl);var i=s.scope.generateUidIdentifier("marked");var l=t.callExpression(c.runtimeProperty("mark"),[t.clone(r.id)]);var u=o.decl.declarations.push(t.variableDeclarator(i,l))-1;var f=o.declPath.get("declarations."+u+".init");n["default"].strictEqual(f.node,l);f.addComment("leading","#__PURE__");return t.clone(i)}var f={"FunctionExpression|FunctionDeclaration|Method":function FunctionExpressionFunctionDeclarationMethod(e){e.skip()},Identifier:function Identifier(e,t){if(e.node.name==="arguments"&&c.isReference(e)){c.replaceWithOrRemove(e,t.getArgsId());t.usesArguments=true}},ThisExpression:function ThisExpression(e,t){t.usesThis=true}};var d={MetaProperty:function MetaProperty(e){var t=e.node;if(t.meta.name==="function"&&t.property.name==="sent"){var r=c.getTypes();c.replaceWithOrRemove(e,r.memberExpression(r.clone(this.context),r.identifier("_sent")))}}};var m={Function:function Function(e){e.skip()},AwaitExpression:function AwaitExpression(e){var t=c.getTypes();var r=e.node.argument;c.replaceWithOrRemove(e,t.yieldExpression(t.callExpression(c.runtimeProperty("awrap"),[r]),false))}}},9924:(e,t,r)=>{"use strict";const s=r(8741);t.REGULAR=new Map([["d",s().addRange(48,57)],["D",s().addRange(0,47).addRange(58,65535)],["s",s(32,160,5760,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233)],["S",s().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,65535)],["w",s(95).addRange(48,57).addRange(65,90).addRange(97,122)],["W",s(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,65535)]]);t.UNICODE=new Map([["d",s().addRange(48,57)],["D",s().addRange(0,47).addRange(58,1114111)],["s",s(32,160,5760,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233)],["S",s().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111)],["w",s(95).addRange(48,57).addRange(65,90).addRange(97,122)],["W",s(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)]]);t.UNICODE_IGNORE_CASE=new Map([["d",s().addRange(48,57)],["D",s().addRange(0,47).addRange(58,1114111)],["s",s(32,160,5760,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233)],["S",s().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111)],["w",s(95,383,8490).addRange(48,57).addRange(65,90).addRange(97,122)],["W",s(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,382).addRange(384,8489).addRange(8491,1114111)]])},3354:e=>{e.exports=new Map([[75,8490],[83,383],[107,8490],[115,383],[181,924],[197,8491],[223,7838],[229,8491],[383,83],[452,453],[453,452],[455,456],[456,455],[458,459],[459,458],[497,498],[498,497],[837,8126],[914,976],[917,1013],[920,1012],[921,8126],[922,1008],[924,181],[928,982],[929,1009],[931,962],[934,981],[937,8486],[952,1012],[962,931],[969,8486],[976,914],[977,1012],[981,934],[982,928],[1008,922],[1009,929],[1012,[920,977,952]],[1013,917],[1042,7296],[1044,7297],[1054,7298],[1057,7299],[1058,7301],[1066,7302],[1122,7303],[7296,1042],[7297,1044],[7298,1054],[7299,1057],[7300,7301],[7301,[1058,7300]],[7302,1066],[7303,1122],[7304,42570],[7776,7835],[7835,7776],[7838,223],[8064,8072],[8065,8073],[8066,8074],[8067,8075],[8068,8076],[8069,8077],[8070,8078],[8071,8079],[8072,8064],[8073,8065],[8074,8066],[8075,8067],[8076,8068],[8077,8069],[8078,8070],[8079,8071],[8080,8088],[8081,8089],[8082,8090],[8083,8091],[8084,8092],[8085,8093],[8086,8094],[8087,8095],[8088,8080],[8089,8081],[8090,8082],[8091,8083],[8092,8084],[8093,8085],[8094,8086],[8095,8087],[8096,8104],[8097,8105],[8098,8106],[8099,8107],[8100,8108],[8101,8109],[8102,8110],[8103,8111],[8104,8096],[8105,8097],[8106,8098],[8107,8099],[8108,8100],[8109,8101],[8110,8102],[8111,8103],[8115,8124],[8124,8115],[8126,[837,921]],[8131,8140],[8140,8131],[8179,8188],[8188,8179],[8486,[937,969]],[8490,75],[8491,[197,229]],[42570,7304],[66560,66600],[66561,66601],[66562,66602],[66563,66603],[66564,66604],[66565,66605],[66566,66606],[66567,66607],[66568,66608],[66569,66609],[66570,66610],[66571,66611],[66572,66612],[66573,66613],[66574,66614],[66575,66615],[66576,66616],[66577,66617],[66578,66618],[66579,66619],[66580,66620],[66581,66621],[66582,66622],[66583,66623],[66584,66624],[66585,66625],[66586,66626],[66587,66627],[66588,66628],[66589,66629],[66590,66630],[66591,66631],[66592,66632],[66593,66633],[66594,66634],[66595,66635],[66596,66636],[66597,66637],[66598,66638],[66599,66639],[66600,66560],[66601,66561],[66602,66562],[66603,66563],[66604,66564],[66605,66565],[66606,66566],[66607,66567],[66608,66568],[66609,66569],[66610,66570],[66611,66571],[66612,66572],[66613,66573],[66614,66574],[66615,66575],[66616,66576],[66617,66577],[66618,66578],[66619,66579],[66620,66580],[66621,66581],[66622,66582],[66623,66583],[66624,66584],[66625,66585],[66626,66586],[66627,66587],[66628,66588],[66629,66589],[66630,66590],[66631,66591],[66632,66592],[66633,66593],[66634,66594],[66635,66595],[66636,66596],[66637,66597],[66638,66598],[66639,66599],[66736,66776],[66737,66777],[66738,66778],[66739,66779],[66740,66780],[66741,66781],[66742,66782],[66743,66783],[66744,66784],[66745,66785],[66746,66786],[66747,66787],[66748,66788],[66749,66789],[66750,66790],[66751,66791],[66752,66792],[66753,66793],[66754,66794],[66755,66795],[66756,66796],[66757,66797],[66758,66798],[66759,66799],[66760,66800],[66761,66801],[66762,66802],[66763,66803],[66764,66804],[66765,66805],[66766,66806],[66767,66807],[66768,66808],[66769,66809],[66770,66810],[66771,66811],[66776,66736],[66777,66737],[66778,66738],[66779,66739],[66780,66740],[66781,66741],[66782,66742],[66783,66743],[66784,66744],[66785,66745],[66786,66746],[66787,66747],[66788,66748],[66789,66749],[66790,66750],[66791,66751],[66792,66752],[66793,66753],[66794,66754],[66795,66755],[66796,66756],[66797,66757],[66798,66758],[66799,66759],[66800,66760],[66801,66761],[66802,66762],[66803,66763],[66804,66764],[66805,66765],[66806,66766],[66807,66767],[66808,66768],[66809,66769],[66810,66770],[66811,66771],[68736,68800],[68737,68801],[68738,68802],[68739,68803],[68740,68804],[68741,68805],[68742,68806],[68743,68807],[68744,68808],[68745,68809],[68746,68810],[68747,68811],[68748,68812],[68749,68813],[68750,68814],[68751,68815],[68752,68816],[68753,68817],[68754,68818],[68755,68819],[68756,68820],[68757,68821],[68758,68822],[68759,68823],[68760,68824],[68761,68825],[68762,68826],[68763,68827],[68764,68828],[68765,68829],[68766,68830],[68767,68831],[68768,68832],[68769,68833],[68770,68834],[68771,68835],[68772,68836],[68773,68837],[68774,68838],[68775,68839],[68776,68840],[68777,68841],[68778,68842],[68779,68843],[68780,68844],[68781,68845],[68782,68846],[68783,68847],[68784,68848],[68785,68849],[68786,68850],[68800,68736],[68801,68737],[68802,68738],[68803,68739],[68804,68740],[68805,68741],[68806,68742],[68807,68743],[68808,68744],[68809,68745],[68810,68746],[68811,68747],[68812,68748],[68813,68749],[68814,68750],[68815,68751],[68816,68752],[68817,68753],[68818,68754],[68819,68755],[68820,68756],[68821,68757],[68822,68758],[68823,68759],[68824,68760],[68825,68761],[68826,68762],[68827,68763],[68828,68764],[68829,68765],[68830,68766],[68831,68767],[68832,68768],[68833,68769],[68834,68770],[68835,68771],[68836,68772],[68837,68773],[68838,68774],[68839,68775],[68840,68776],[68841,68777],[68842,68778],[68843,68779],[68844,68780],[68845,68781],[68846,68782],[68847,68783],[68848,68784],[68849,68785],[68850,68786],[71840,71872],[71841,71873],[71842,71874],[71843,71875],[71844,71876],[71845,71877],[71846,71878],[71847,71879],[71848,71880],[71849,71881],[71850,71882],[71851,71883],[71852,71884],[71853,71885],[71854,71886],[71855,71887],[71856,71888],[71857,71889],[71858,71890],[71859,71891],[71860,71892],[71861,71893],[71862,71894],[71863,71895],[71864,71896],[71865,71897],[71866,71898],[71867,71899],[71868,71900],[71869,71901],[71870,71902],[71871,71903],[71872,71840],[71873,71841],[71874,71842],[71875,71843],[71876,71844],[71877,71845],[71878,71846],[71879,71847],[71880,71848],[71881,71849],[71882,71850],[71883,71851],[71884,71852],[71885,71853],[71886,71854],[71887,71855],[71888,71856],[71889,71857],[71890,71858],[71891,71859],[71892,71860],[71893,71861],[71894,71862],[71895,71863],[71896,71864],[71897,71865],[71898,71866],[71899,71867],[71900,71868],[71901,71869],[71902,71870],[71903,71871],[93760,93792],[93761,93793],[93762,93794],[93763,93795],[93764,93796],[93765,93797],[93766,93798],[93767,93799],[93768,93800],[93769,93801],[93770,93802],[93771,93803],[93772,93804],[93773,93805],[93774,93806],[93775,93807],[93776,93808],[93777,93809],[93778,93810],[93779,93811],[93780,93812],[93781,93813],[93782,93814],[93783,93815],[93784,93816],[93785,93817],[93786,93818],[93787,93819],[93788,93820],[93789,93821],[93790,93822],[93791,93823],[93792,93760],[93793,93761],[93794,93762],[93795,93763],[93796,93764],[93797,93765],[93798,93766],[93799,93767],[93800,93768],[93801,93769],[93802,93770],[93803,93771],[93804,93772],[93805,93773],[93806,93774],[93807,93775],[93808,93776],[93809,93777],[93810,93778],[93811,93779],[93812,93780],[93813,93781],[93814,93782],[93815,93783],[93816,93784],[93817,93785],[93818,93786],[93819,93787],[93820,93788],[93821,93789],[93822,93790],[93823,93791],[125184,125218],[125185,125219],[125186,125220],[125187,125221],[125188,125222],[125189,125223],[125190,125224],[125191,125225],[125192,125226],[125193,125227],[125194,125228],[125195,125229],[125196,125230],[125197,125231],[125198,125232],[125199,125233],[125200,125234],[125201,125235],[125202,125236],[125203,125237],[125204,125238],[125205,125239],[125206,125240],[125207,125241],[125208,125242],[125209,125243],[125210,125244],[125211,125245],[125212,125246],[125213,125247],[125214,125248],[125215,125249],[125216,125250],[125217,125251],[125218,125184],[125219,125185],[125220,125186],[125221,125187],[125222,125188],[125223,125189],[125224,125190],[125225,125191],[125226,125192],[125227,125193],[125228,125194],[125229,125195],[125230,125196],[125231,125197],[125232,125198],[125233,125199],[125234,125200],[125235,125201],[125236,125202],[125237,125203],[125238,125204],[125239,125205],[125240,125206],[125241,125207],[125242,125208],[125243,125209],[125244,125210],[125245,125211],[125246,125212],[125247,125213],[125248,125214],[125249,125215],[125250,125216],[125251,125217]])},5756:(e,t,r)=>{"use strict";const s=r(1770).generate;const a=r(9990).parse;const n=r(8741);const o=r(3042);const i=r(1317);const l=r(3354);const c=r(9924);const u=n().addRange(0,1114111);const p=n().addRange(0,65535);const f=u.clone().remove(10,13,8232,8233);const getCharacterClassEscapeSet=(e,t,r)=>{if(t){if(r){return c.UNICODE_IGNORE_CASE.get(e)}return c.UNICODE.get(e)}return c.REGULAR.get(e)};const getUnicodeDotSet=e=>e?u:f;const getUnicodePropertyValueSet=(e,t)=>{const r=t?`${e}/${t}`:`Binary_Property/${e}`;try{return require(`regenerate-unicode-properties/${r}.js`)}catch(r){throw new Error(`Failed to recognize value \`${t}\` for property `+`\`${e}\`.`)}};const handleLoneUnicodePropertyNameOrValue=e=>{try{const t="General_Category";const r=i(t,e);return getUnicodePropertyValueSet(t,r)}catch(e){}const t=o(e);return getUnicodePropertyValueSet(t)};const getUnicodePropertyEscapeSet=(e,t)=>{const r=e.split("=");const s=r[0];let a;if(r.length==1){a=handleLoneUnicodePropertyNameOrValue(s)}else{const e=o(s);const t=i(e,r[1]);a=getUnicodePropertyValueSet(e,t)}if(t){return u.clone().remove(a)}return a.clone()};n.prototype.iuAddRange=function(e,t){const r=this;do{const t=caseFold(e);if(t){r.add(t)}}while(++e<=t);return r};const update=(e,t)=>{let r=a(t,d.useUnicodeFlag?"u":"");switch(r.type){case"characterClass":case"group":case"value":break;default:r=wrap(r,t)}Object.assign(e,r)};const wrap=(e,t)=>({type:"group",behavior:"ignore",body:[e],raw:`(?:${t})`});const caseFold=e=>l.get(e)||false;const processCharacterClass=(e,t)=>{const r=n();for(const t of e.body){switch(t.type){case"value":r.add(t.codePoint);if(d.ignoreCase&&d.unicode&&!d.useUnicodeFlag){const e=caseFold(t.codePoint);if(e){r.add(e)}}break;case"characterClassRange":const e=t.min.codePoint;const s=t.max.codePoint;r.addRange(e,s);if(d.ignoreCase&&d.unicode&&!d.useUnicodeFlag){r.iuAddRange(e,s)}break;case"characterClassEscape":r.add(getCharacterClassEscapeSet(t.value,d.unicode,d.ignoreCase));break;case"unicodePropertyEscape":r.add(getUnicodePropertyEscapeSet(t.value,t.negative));break;default:throw new Error(`Unknown term type: ${t.type}`)}}if(e.negative){update(e,`(?!${r.toString(t)})[\\s\\S]`)}else{update(e,r.toString(t))}return e};const updateNamedReference=(e,t)=>{delete e.name;e.matchIndex=t};const assertNoUnmatchedReferences=e=>{const t=Object.keys(e.unmatchedReferences);if(t.length>0){throw new Error(`Unknown group names: ${t}`)}};const processTerm=(e,t,r)=>{switch(e.type){case"dot":if(d.useDotAllFlag){break}else if(d.unicode){update(e,getUnicodeDotSet(d.dotAll).toString(t))}else if(d.dotAll){update(e,"[\\s\\S]")}break;case"characterClass":e=processCharacterClass(e,t);break;case"unicodePropertyEscape":if(d.unicodePropertyEscape){update(e,getUnicodePropertyEscapeSet(e.value,e.negative).toString(t))}break;case"characterClassEscape":update(e,getCharacterClassEscapeSet(e.value,d.unicode,d.ignoreCase).toString(t));break;case"group":if(e.behavior=="normal"){r.lastIndex++}if(e.name&&d.namedGroup){const t=e.name.value;if(r.names[t]){throw new Error(`Multiple groups with the same name (${t}) are not allowed.`)}const s=r.lastIndex;delete e.name;r.names[t]=s;if(r.onNamedGroup){r.onNamedGroup.call(null,t,s)}if(r.unmatchedReferences[t]){r.unmatchedReferences[t].forEach((e=>{updateNamedReference(e,s)}));delete r.unmatchedReferences[t]}}case"alternative":case"disjunction":case"quantifier":e.body=e.body.map((e=>processTerm(e,t,r)));break;case"value":const s=e.codePoint;const a=n(s);if(d.ignoreCase&&d.unicode&&!d.useUnicodeFlag){const e=caseFold(s);if(e){a.add(e)}}update(e,a.toString(t));break;case"reference":if(e.name){const t=e.name.value;const s=r.names[t];if(s){updateNamedReference(e,s);break}if(!r.unmatchedReferences[t]){r.unmatchedReferences[t]=[]}r.unmatchedReferences[t].push(e)}break;case"anchor":case"empty":case"group":break;default:throw new Error(`Unknown term type: ${e.type}`)}return e};const d={ignoreCase:false,unicode:false,dotAll:false,useDotAllFlag:false,useUnicodeFlag:false,unicodePropertyEscape:false,namedGroup:false};const rewritePattern=(e,t,r)=>{d.unicode=t&&t.includes("u");const n={unicodePropertyEscape:d.unicode,namedGroups:true,lookbehind:r&&r.lookbehind};d.ignoreCase=t&&t.includes("i");const o=r&&r.dotAllFlag;d.dotAll=o&&t&&t.includes("s");d.namedGroup=r&&r.namedGroup;d.useDotAllFlag=r&&r.useDotAllFlag;d.useUnicodeFlag=r&&r.useUnicodeFlag;d.unicodePropertyEscape=r&&r.unicodePropertyEscape;if(o&&d.useDotAllFlag){throw new Error("`useDotAllFlag` and `dotAllFlag` cannot both be true!")}const i={hasUnicodeFlag:d.useUnicodeFlag,bmpOnly:!d.unicode};const l={onNamedGroup:r&&r.onNamedGroup,lastIndex:0,names:Object.create(null),unmatchedReferences:Object.create(null)};const c=a(e,t,n);processTerm(c,i,l);assertNoUnmatchedReferences(l);return s(c)};e.exports=rewritePattern},1770:function(e,t,r){e=r.nmd(e); /*! * regjsgen 0.5.1 * Copyright 2014-2019 Benjamin Tan * Available under MIT license - */(function(){"use strict";var r={function:true,object:true};var s=r[typeof window]&&window||this;var a=r[typeof t]&&t&&!t.nodeType&&t;var n=r["object"]&&e&&!e.nodeType;var o=a&&n&&typeof global=="object"&&global;if(o&&(o.global===o||o.window===o||o.self===o)){s=o}var i=Object.prototype.hasOwnProperty;function fromCodePoint(){var e=Number(arguments[0]);if(!isFinite(e)||e<0||e>1114111||Math.floor(e)!=e){throw RangeError("Invalid code point: "+e)}if(e<=65535){return String.fromCharCode(e)}else{e-=65536;var t=(e>>10)+55296;var r=e%1024+56320;return String.fromCharCode(t,r)}}var l={};function assertType(e,t){if(t.indexOf("|")==-1){if(e==t){return}throw Error("Invalid node type: "+e+"; expected type: "+t)}t=i.call(l,t)?l[t]:l[t]=RegExp("^(?:"+t+")$");if(t.test(e)){return}throw Error("Invalid node type: "+e+"; expected types: "+t)}function generate(e){var t=e.type;if(i.call(c,t)){return c[t](e)}throw Error("Invalid node type: "+t)}function generateAlternative(e){assertType(e.type,"alternative");var t=e.body,r=-1,s=t.length,a="";while(++r"}break;case"ignore":t+="?:";break;case"lookahead":t+="?=";break;case"negativeLookahead":t+="?!";break;case"lookbehind":t+="?<=";break;case"negativeLookbehind":t+="?"}throw new Error("Unknown reference type")}function generateTerm(e){assertType(e.type,"anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|unicodePropertyEscape|value|dot");return generate(e)}function generateValue(e){assertType(e.type,"value");var t=e.kind,r=e.codePoint;if(typeof r!="number"){throw new Error("Invalid code point: "+r)}switch(t){case"controlLetter":return"\\c"+fromCodePoint(r+64);case"hexadecimalEscape":return"\\x"+("00"+r.toString(16).toUpperCase()).slice(-2);case"identifier":return"\\"+fromCodePoint(r);case"null":return"\\"+r;case"octal":return"\\"+r.toString(8);case"singleEscape":switch(r){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r";default:throw Error("Invalid code point: "+r)}case"symbol":return fromCodePoint(r);case"unicodeEscape":return"\\u"+("0000"+r.toString(16).toUpperCase()).slice(-4);case"unicodeCodePointEscape":return"\\u{"+r.toString(16).toUpperCase()+"}";default:throw Error("Unsupported node kind: "+t)}}var c={alternative:generateAlternative,anchor:generateAnchor,characterClass:generateCharacterClass,characterClassEscape:generateCharacterClassEscape,characterClassRange:generateCharacterClassRange,unicodePropertyEscape:generateUnicodePropertyEscape,disjunction:generateDisjunction,dot:generateDot,group:generateGroup,quantifier:generateQuantifier,reference:generateReference,value:generateValue};var u={generate:generate};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define((function(){return u}));s.regjsgen=u}else if(a&&n){a.generate=generate}else{s.regjsgen=u}}).call(this)},9990:e=>{(function(){var t=String.fromCodePoint||function(){var e=String.fromCharCode;var t=Math.floor;return function fromCodePoint(){var r=16384;var s=[];var a;var n;var o=-1;var i=arguments.length;if(!i){return""}var l="";while(++o1114111||t(c)!=c){throw RangeError("Invalid code point: "+c)}if(c<=65535){s.push(c)}else{c-=65536;a=(c>>10)+55296;n=c%1024+56320;s.push(a,n)}if(o+1==i||s.length>r){l+=e.apply(null,s);s.length=0}}return l}}();function parse(e,r,s){if(!s){s={}}function addRaw(t){t.raw=e.substring(t.range[0],t.range[1]);return t}function updateRawStart(e,t){e.range[0]=t;return addRaw(e)}function createAnchor(e,t){return addRaw({type:"anchor",kind:e,range:[l-t,l]})}function createValue(e,t,r,s){return addRaw({type:"value",kind:e,codePoint:t,range:[r,s]})}function createEscaped(e,t,r,s){s=s||0;return createValue(e,t,l-(r.length+s),l)}function createCharacter(e){var t=e[0];var r=t.charCodeAt(0);if(i){var s;if(t.length===1&&r>=55296&&r<=56319){s=lookahead().charCodeAt(0);if(s>=56320&&s<=57343){l++;return createValue("symbol",(r-55296)*1024+s-56320+65536,l-2,l)}}}return createValue("symbol",r,l-1,l)}function createDisjunction(e,t,r){return addRaw({type:"disjunction",body:e,range:[t,r]})}function createDot(){return addRaw({type:"dot",range:[l-1,l]})}function createCharacterClassEscape(e){return addRaw({type:"characterClassEscape",value:e,range:[l-2,l]})}function createReference(e){return addRaw({type:"reference",matchIndex:parseInt(e,10),range:[l-1-e.length,l]})}function createNamedReference(e){return addRaw({type:"reference",name:e,range:[e.range[0]-3,l]})}function createGroup(e,t,r,s){return addRaw({type:"group",behavior:e,body:t,range:[r,s]})}function createQuantifier(e,t,r,s){if(s==null){r=l-1;s=l}return addRaw({type:"quantifier",min:e,max:t,greedy:true,body:null,range:[r,s]})}function createAlternative(e,t,r){return addRaw({type:"alternative",body:e,range:[t,r]})}function createCharacterClass(e,t,r,s){return addRaw({type:"characterClass",body:e,negative:t,range:[r,s]})}function createClassRange(e,t,r,s){if(e.codePoint>t.codePoint){bail("invalid range in character class",e.raw+"-"+t.raw,r,s)}return addRaw({type:"characterClassRange",min:e,max:t,range:[r,s]})}function flattenBody(e){if(e.type==="alternative"){return e.body}else{return[e]}}function isEmpty(e){return e.type==="empty"}function incr(t){t=t||1;var r=e.substring(l,l+t);l+=t||1;return r}function skip(e){if(!match(e)){bail("character",e)}}function match(t){if(e.indexOf(t,l)===l){return incr(t.length)}}function lookahead(){return e[l]}function current(t){return e.indexOf(t,l)===l}function next(t){return e[l+1]===t}function matchReg(t){var r=e.substring(l);var s=r.match(t);if(s){s.range=[];s.range[0]=l;incr(s[0].length);s.range[1]=l}return s}function parseDisjunction(){var e=[],t=l;e.push(parseAlternative());while(match("|")){e.push(parseAlternative())}if(e.length===1){return e[0]}return createDisjunction(e,t,l)}function parseAlternative(){var e=[],t=l;var r;while(r=parseTerm()){e.push(r)}if(e.length===1){return e[0]}return createAlternative(e,t,l)}function parseTerm(){if(l>=e.length||current("|")||current(")")){return null}var t=parseAnchor();if(t){return t}var r=parseAtomAndExtendedAtom();if(!r){bail("Expected atom")}var s=parseQuantifier()||false;if(s){s.body=flattenBody(r);updateRawStart(s,r.range[0]);return s}return r}function parseGroup(e,t,r,s){var a=null,n=l;if(match(e)){a=t}else if(match(r)){a=s}else{return false}return finishGroup(a,n)}function finishGroup(e,t){var r=parseDisjunction();if(!r){bail("Expected disjunction")}skip(")");var s=createGroup(e,flattenBody(r),t,l);if(e=="normal"){if(o){n++}}return s}function parseAnchor(){var e,t=l;if(match("^")){return createAnchor("start",1)}else if(match("$")){return createAnchor("end",1)}else if(match("\\b")){return createAnchor("boundary",2)}else if(match("\\B")){return createAnchor("not-boundary",2)}else{return parseGroup("(?=","lookahead","(?!","negativeLookahead")}}function parseQuantifier(){var e,t=l;var r;var s,a;if(match("*")){r=createQuantifier(0)}else if(match("+")){r=createQuantifier(1)}else if(match("?")){r=createQuantifier(0,1)}else if(e=matchReg(/^\{([0-9]+)\}/)){s=parseInt(e[1],10);r=createQuantifier(s,s,e.range[0],e.range[1])}else if(e=matchReg(/^\{([0-9]+),\}/)){s=parseInt(e[1],10);r=createQuantifier(s,undefined,e.range[0],e.range[1])}else if(e=matchReg(/^\{([0-9]+),([0-9]+)\}/)){s=parseInt(e[1],10);a=parseInt(e[2],10);if(s>a){bail("numbers out of order in {} quantifier","",t,l)}r=createQuantifier(s,a,e.range[0],e.range[1])}if(r){if(match("?")){r.greedy=false;r.range[1]+=1}}return r}function parseAtomAndExtendedAtom(){var e;if(e=matchReg(/^[^^$\\.*+?()[\]{}|]/)){return createCharacter(e)}else if(!i&&(e=matchReg(/^(?:]|})/))){return createCharacter(e)}else if(match(".")){return createDot()}else if(match("\\")){e=parseAtomEscape();if(!e){if(!i&&lookahead()=="c"){return createValue("symbol",92,l-1,l)}bail("atomEscape")}return e}else if(e=parseCharacterClass()){return e}else if(s.lookbehind&&(e=parseGroup("(?<=","lookbehind","(?");var r=finishGroup("normal",t.range[0]-3);r.name=t;return r}else{return parseGroup("(?:","ignore","(","normal")}}function parseUnicodeSurrogatePairEscape(e){if(i){var t,r;if(e.kind=="unicodeEscape"&&(t=e.codePoint)>=55296&&t<=56319&¤t("\\")&&next("u")){var s=l;l++;var a=parseClassEscape();if(a.kind=="unicodeEscape"&&(r=a.codePoint)>=56320&&r<=57343){e.range[1]=a.range[1];e.codePoint=(t-55296)*1024+r-56320+65536;e.type="value";e.kind="unicodeCodePointEscape";addRaw(e)}else{l=s}}}return e}function parseClassEscape(){return parseAtomEscape(true)}function parseAtomEscape(e){var t,r=l;t=parseDecimalEscape()||parseNamedReference();if(t){return t}if(e){if(match("b")){return createEscaped("singleEscape",8,"\\b")}else if(match("B")){bail("\\B not possible inside of CharacterClass","",r)}else if(!i&&(t=matchReg(/^c([0-9])/))){return createEscaped("controlLetter",t[1]+16,t[1],2)}if(match("-")&&i){return createEscaped("singleEscape",45,"\\-")}}t=parseCharacterEscape();return t}function parseDecimalEscape(){var e,t;if(e=matchReg(/^(?!0)\d+/)){t=e[0];var r=parseInt(e[0],10);if(r<=n){return createReference(e[0])}else{a.push(r);incr(-e[0].length);if(e=matchReg(/^[0-7]{1,3}/)){return createEscaped("octal",parseInt(e[0],8),e[0],1)}else{e=createCharacter(matchReg(/^[89]/));return updateRawStart(e,e.range[0]-1)}}}else if(e=matchReg(/^[0-7]{1,3}/)){t=e[0];if(/^0{1,3}$/.test(t)){return createEscaped("null",0,"0",t.length+1)}else{return createEscaped("octal",parseInt(t,8),t,1)}}else if(e=matchReg(/^[dDsSwW]/)){return createCharacterClassEscape(e[0])}return false}function parseNamedReference(){if(s.namedGroups&&matchReg(/^k<(?=.*?>)/)){var e=parseIdentifier();skip(">");return createNamedReference(e)}}function parseRegExpUnicodeEscapeSequence(){var e;if(e=matchReg(/^u([0-9a-fA-F]{4})/)){return parseUnicodeSurrogatePairEscape(createEscaped("unicodeEscape",parseInt(e[1],16),e[1],2))}else if(i&&(e=matchReg(/^u\{([0-9a-fA-F]+)\}/))){return createEscaped("unicodeCodePointEscape",parseInt(e[1],16),e[1],4)}}function parseCharacterEscape(){var e;var t=l;if(e=matchReg(/^[fnrtv]/)){var r=0;switch(e[0]){case"t":r=9;break;case"n":r=10;break;case"v":r=11;break;case"f":r=12;break;case"r":r=13;break}return createEscaped("singleEscape",r,"\\"+e[0])}else if(e=matchReg(/^c([a-zA-Z])/)){return createEscaped("controlLetter",e[1].charCodeAt(0)%32,e[1],2)}else if(e=matchReg(/^x([0-9a-fA-F]{2})/)){return createEscaped("hexadecimalEscape",parseInt(e[1],16),e[1],2)}else if(e=parseRegExpUnicodeEscapeSequence()){if(!e||e.codePoint>1114111){bail("Invalid escape sequence",null,t,l)}return e}else if(s.unicodePropertyEscape&&i&&(e=matchReg(/^([pP])\{([^\}]+)\}/))){return addRaw({type:"unicodePropertyEscape",negative:e[1]==="P",value:e[2],range:[e.range[0]-1,e.range[1]],raw:e[0]})}else{return parseIdentityEscape()}}function parseIdentifierAtom(r){var s=lookahead();var a=l;if(s==="\\"){incr();var n=parseRegExpUnicodeEscapeSequence();if(!n||!r(n.codePoint)){bail("Invalid escape sequence",null,a,l)}return t(n.codePoint)}var o=s.charCodeAt(0);if(o>=55296&&o<=56319){s+=e[l+1];var i=s.charCodeAt(1);if(i>=56320&&i<=57343){o=(o-55296)*1024+i-56320+65536}}if(!r(o))return;incr();if(o>65535)incr();return s}function parseIdentifier(){var e=l;var t=parseIdentifierAtom(isIdentifierStart);if(!t){bail("Invalid identifier")}var r;while(r=parseIdentifierAtom(isIdentifierPart)){t+=r}return addRaw({type:"identifier",value:t,range:[e,l]})}function isIdentifierStart(e){var r=/[\$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFF1]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=128&&r.test(t(e))}function isIdentifierPart(e){var r=/[0-9_\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDD30-\uDD39\uDF46-\uDF50]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC66-\uDC6F\uDC7F-\uDC82\uDCB0-\uDCBA\uDCF0-\uDCF9\uDD00-\uDD02\uDD27-\uDD34\uDD36-\uDD3F\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDD0-\uDDD9\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC50-\uDC59\uDC5E\uDCB0-\uDCC3\uDCD0-\uDCD9\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDE50-\uDE59\uDEAB-\uDEB7\uDEC0-\uDEC9\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC2C-\uDC3A\uDCE0-\uDCE9\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC50-\uDC59\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD50-\uDD59\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDDA0-\uDDA9\uDEF3-\uDEF6]|\uD81A[\uDE60-\uDE69\uDEF0-\uDEF4\uDF30-\uDF36\uDF50-\uDF59]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A\uDD50-\uDD59]|\uDB40[\uDD00-\uDDEF]/;return isIdentifierStart(e)||e>=48&&e<=57||e>=128&&r.test(t(e))}function parseIdentityEscape(){var e;var t=lookahead();if(i&&/[\^\$\.\*\+\?\(\)\\\[\]\{\}\|\/]/.test(t)||!i&&t!=="c"){if(t==="k"&&s.lookbehind){return null}e=incr();return createEscaped("identifier",e.charCodeAt(0),e,1)}return null}function parseCharacterClass(){var e,t=l;if(e=matchReg(/^\[\^/)){e=parseClassRanges();skip("]");return createCharacterClass(e,true,t,l)}else if(match("[")){e=parseClassRanges();skip("]");return createCharacterClass(e,false,t,l)}return null}function parseClassRanges(){var e;if(current("]")){return[]}else{e=parseNonemptyClassRanges();if(!e){bail("nonEmptyClassRanges")}return e}}function parseHelperClassRanges(e){var t,r,s;if(current("-")&&!next("]")){skip("-");s=parseClassAtom();if(!s){bail("classAtom")}r=l;var a=parseClassRanges();if(!a){bail("classRanges")}t=e.range[0];if(a.type==="empty"){return[createClassRange(e,s,t,r)]}return[createClassRange(e,s,t,r)].concat(a)}s=parseNonemptyClassRangesNoDash();if(!s){bail("nonEmptyClassRangesNoDash")}return[e].concat(s)}function parseNonemptyClassRanges(){var e=parseClassAtom();if(!e){bail("classAtom")}if(current("]")){return[e]}return parseHelperClassRanges(e)}function parseNonemptyClassRangesNoDash(){var e=parseClassAtom();if(!e){bail("classAtom")}if(current("]")){return e}return parseHelperClassRanges(e)}function parseClassAtom(){if(match("-")){return createCharacter("-")}else{return parseClassAtomNoDash()}}function parseClassAtomNoDash(){var e;if(e=matchReg(/^[^\\\]-]/)){return createCharacter(e[0])}else if(match("\\")){e=parseClassEscape();if(!e){bail("classEscape")}return parseUnicodeSurrogatePairEscape(e)}}function bail(t,r,s,a){s=s==null?l:s;a=a==null?s:a;var n=Math.max(0,s-10);var o=Math.min(a+10,e.length);var i=" "+e.substring(n,o);var c=" "+new Array(s-n+1).join(" ")+"^";throw SyntaxError(t+" at position "+s+(r?": "+r:"")+"\n"+i+"\n"+c)}var a=[];var n=0;var o=true;var i=(r||"").indexOf("u")!==-1;var l=0;e=String(e);if(e===""){e="(?:)"}var c=parseDisjunction();if(c.range[1]!==e.length){bail("Could not parse entire input - got stuck","",c.range[1])}for(var u=0;u{var t=e.exports=function(e){return new Traverse(e)};function Traverse(e){this.value=e}Traverse.prototype.get=function(e){var t=this.value;for(var r=0;r{e.exports=new Set(["General_Category","Script","Script_Extensions","Alphabetic","Any","ASCII","ASCII_Hex_Digit","Assigned","Bidi_Control","Bidi_Mirrored","Case_Ignorable","Cased","Changes_When_Casefolded","Changes_When_Casemapped","Changes_When_Lowercased","Changes_When_NFKC_Casefolded","Changes_When_Titlecased","Changes_When_Uppercased","Dash","Default_Ignorable_Code_Point","Deprecated","Diacritic","Emoji","Emoji_Component","Emoji_Modifier","Emoji_Modifier_Base","Emoji_Presentation","Extended_Pictographic","Extender","Grapheme_Base","Grapheme_Extend","Hex_Digit","ID_Continue","ID_Start","Ideographic","IDS_Binary_Operator","IDS_Trinary_Operator","Join_Control","Logical_Order_Exception","Lowercase","Math","Noncharacter_Code_Point","Pattern_Syntax","Pattern_White_Space","Quotation_Mark","Radical","Regional_Indicator","Sentence_Terminal","Soft_Dotted","Terminal_Punctuation","Unified_Ideograph","Uppercase","Variation_Selector","White_Space","XID_Continue","XID_Start"])},3042:(e,t,r)=>{"use strict";const s=r(7894);const a=r(864);const matchProperty=function(e){if(s.has(e)){return e}if(a.has(e)){return a.get(e)}throw new Error(`Unknown property: ${e}`)};e.exports=matchProperty},4703:e=>{e.exports=new Map([["General_Category",new Map([["C","Other"],["Cc","Control"],["cntrl","Control"],["Cf","Format"],["Cn","Unassigned"],["Co","Private_Use"],["Cs","Surrogate"],["L","Letter"],["LC","Cased_Letter"],["Ll","Lowercase_Letter"],["Lm","Modifier_Letter"],["Lo","Other_Letter"],["Lt","Titlecase_Letter"],["Lu","Uppercase_Letter"],["M","Mark"],["Combining_Mark","Mark"],["Mc","Spacing_Mark"],["Me","Enclosing_Mark"],["Mn","Nonspacing_Mark"],["N","Number"],["Nd","Decimal_Number"],["digit","Decimal_Number"],["Nl","Letter_Number"],["No","Other_Number"],["P","Punctuation"],["punct","Punctuation"],["Pc","Connector_Punctuation"],["Pd","Dash_Punctuation"],["Pe","Close_Punctuation"],["Pf","Final_Punctuation"],["Pi","Initial_Punctuation"],["Po","Other_Punctuation"],["Ps","Open_Punctuation"],["S","Symbol"],["Sc","Currency_Symbol"],["Sk","Modifier_Symbol"],["Sm","Math_Symbol"],["So","Other_Symbol"],["Z","Separator"],["Zl","Line_Separator"],["Zp","Paragraph_Separator"],["Zs","Space_Separator"],["Other","Other"],["Control","Control"],["Format","Format"],["Unassigned","Unassigned"],["Private_Use","Private_Use"],["Surrogate","Surrogate"],["Letter","Letter"],["Cased_Letter","Cased_Letter"],["Lowercase_Letter","Lowercase_Letter"],["Modifier_Letter","Modifier_Letter"],["Other_Letter","Other_Letter"],["Titlecase_Letter","Titlecase_Letter"],["Uppercase_Letter","Uppercase_Letter"],["Mark","Mark"],["Spacing_Mark","Spacing_Mark"],["Enclosing_Mark","Enclosing_Mark"],["Nonspacing_Mark","Nonspacing_Mark"],["Number","Number"],["Decimal_Number","Decimal_Number"],["Letter_Number","Letter_Number"],["Other_Number","Other_Number"],["Punctuation","Punctuation"],["Connector_Punctuation","Connector_Punctuation"],["Dash_Punctuation","Dash_Punctuation"],["Close_Punctuation","Close_Punctuation"],["Final_Punctuation","Final_Punctuation"],["Initial_Punctuation","Initial_Punctuation"],["Other_Punctuation","Other_Punctuation"],["Open_Punctuation","Open_Punctuation"],["Symbol","Symbol"],["Currency_Symbol","Currency_Symbol"],["Modifier_Symbol","Modifier_Symbol"],["Math_Symbol","Math_Symbol"],["Other_Symbol","Other_Symbol"],["Separator","Separator"],["Line_Separator","Line_Separator"],["Paragraph_Separator","Paragraph_Separator"],["Space_Separator","Space_Separator"]])],["Script",new Map([["Adlm","Adlam"],["Aghb","Caucasian_Albanian"],["Ahom","Ahom"],["Arab","Arabic"],["Armi","Imperial_Aramaic"],["Armn","Armenian"],["Avst","Avestan"],["Bali","Balinese"],["Bamu","Bamum"],["Bass","Bassa_Vah"],["Batk","Batak"],["Beng","Bengali"],["Bhks","Bhaiksuki"],["Bopo","Bopomofo"],["Brah","Brahmi"],["Brai","Braille"],["Bugi","Buginese"],["Buhd","Buhid"],["Cakm","Chakma"],["Cans","Canadian_Aboriginal"],["Cari","Carian"],["Cham","Cham"],["Cher","Cherokee"],["Chrs","Chorasmian"],["Copt","Coptic"],["Qaac","Coptic"],["Cprt","Cypriot"],["Cyrl","Cyrillic"],["Deva","Devanagari"],["Diak","Dives_Akuru"],["Dogr","Dogra"],["Dsrt","Deseret"],["Dupl","Duployan"],["Egyp","Egyptian_Hieroglyphs"],["Elba","Elbasan"],["Elym","Elymaic"],["Ethi","Ethiopic"],["Geor","Georgian"],["Glag","Glagolitic"],["Gong","Gunjala_Gondi"],["Gonm","Masaram_Gondi"],["Goth","Gothic"],["Gran","Grantha"],["Grek","Greek"],["Gujr","Gujarati"],["Guru","Gurmukhi"],["Hang","Hangul"],["Hani","Han"],["Hano","Hanunoo"],["Hatr","Hatran"],["Hebr","Hebrew"],["Hira","Hiragana"],["Hluw","Anatolian_Hieroglyphs"],["Hmng","Pahawh_Hmong"],["Hmnp","Nyiakeng_Puachue_Hmong"],["Hrkt","Katakana_Or_Hiragana"],["Hung","Old_Hungarian"],["Ital","Old_Italic"],["Java","Javanese"],["Kali","Kayah_Li"],["Kana","Katakana"],["Khar","Kharoshthi"],["Khmr","Khmer"],["Khoj","Khojki"],["Kits","Khitan_Small_Script"],["Knda","Kannada"],["Kthi","Kaithi"],["Lana","Tai_Tham"],["Laoo","Lao"],["Latn","Latin"],["Lepc","Lepcha"],["Limb","Limbu"],["Lina","Linear_A"],["Linb","Linear_B"],["Lisu","Lisu"],["Lyci","Lycian"],["Lydi","Lydian"],["Mahj","Mahajani"],["Maka","Makasar"],["Mand","Mandaic"],["Mani","Manichaean"],["Marc","Marchen"],["Medf","Medefaidrin"],["Mend","Mende_Kikakui"],["Merc","Meroitic_Cursive"],["Mero","Meroitic_Hieroglyphs"],["Mlym","Malayalam"],["Modi","Modi"],["Mong","Mongolian"],["Mroo","Mro"],["Mtei","Meetei_Mayek"],["Mult","Multani"],["Mymr","Myanmar"],["Nand","Nandinagari"],["Narb","Old_North_Arabian"],["Nbat","Nabataean"],["Newa","Newa"],["Nkoo","Nko"],["Nshu","Nushu"],["Ogam","Ogham"],["Olck","Ol_Chiki"],["Orkh","Old_Turkic"],["Orya","Oriya"],["Osge","Osage"],["Osma","Osmanya"],["Palm","Palmyrene"],["Pauc","Pau_Cin_Hau"],["Perm","Old_Permic"],["Phag","Phags_Pa"],["Phli","Inscriptional_Pahlavi"],["Phlp","Psalter_Pahlavi"],["Phnx","Phoenician"],["Plrd","Miao"],["Prti","Inscriptional_Parthian"],["Rjng","Rejang"],["Rohg","Hanifi_Rohingya"],["Runr","Runic"],["Samr","Samaritan"],["Sarb","Old_South_Arabian"],["Saur","Saurashtra"],["Sgnw","SignWriting"],["Shaw","Shavian"],["Shrd","Sharada"],["Sidd","Siddham"],["Sind","Khudawadi"],["Sinh","Sinhala"],["Sogd","Sogdian"],["Sogo","Old_Sogdian"],["Sora","Sora_Sompeng"],["Soyo","Soyombo"],["Sund","Sundanese"],["Sylo","Syloti_Nagri"],["Syrc","Syriac"],["Tagb","Tagbanwa"],["Takr","Takri"],["Tale","Tai_Le"],["Talu","New_Tai_Lue"],["Taml","Tamil"],["Tang","Tangut"],["Tavt","Tai_Viet"],["Telu","Telugu"],["Tfng","Tifinagh"],["Tglg","Tagalog"],["Thaa","Thaana"],["Thai","Thai"],["Tibt","Tibetan"],["Tirh","Tirhuta"],["Ugar","Ugaritic"],["Vaii","Vai"],["Wara","Warang_Citi"],["Wcho","Wancho"],["Xpeo","Old_Persian"],["Xsux","Cuneiform"],["Yezi","Yezidi"],["Yiii","Yi"],["Zanb","Zanabazar_Square"],["Zinh","Inherited"],["Qaai","Inherited"],["Zyyy","Common"],["Zzzz","Unknown"],["Adlam","Adlam"],["Caucasian_Albanian","Caucasian_Albanian"],["Arabic","Arabic"],["Imperial_Aramaic","Imperial_Aramaic"],["Armenian","Armenian"],["Avestan","Avestan"],["Balinese","Balinese"],["Bamum","Bamum"],["Bassa_Vah","Bassa_Vah"],["Batak","Batak"],["Bengali","Bengali"],["Bhaiksuki","Bhaiksuki"],["Bopomofo","Bopomofo"],["Brahmi","Brahmi"],["Braille","Braille"],["Buginese","Buginese"],["Buhid","Buhid"],["Chakma","Chakma"],["Canadian_Aboriginal","Canadian_Aboriginal"],["Carian","Carian"],["Cherokee","Cherokee"],["Chorasmian","Chorasmian"],["Coptic","Coptic"],["Cypriot","Cypriot"],["Cyrillic","Cyrillic"],["Devanagari","Devanagari"],["Dives_Akuru","Dives_Akuru"],["Dogra","Dogra"],["Deseret","Deseret"],["Duployan","Duployan"],["Egyptian_Hieroglyphs","Egyptian_Hieroglyphs"],["Elbasan","Elbasan"],["Elymaic","Elymaic"],["Ethiopic","Ethiopic"],["Georgian","Georgian"],["Glagolitic","Glagolitic"],["Gunjala_Gondi","Gunjala_Gondi"],["Masaram_Gondi","Masaram_Gondi"],["Gothic","Gothic"],["Grantha","Grantha"],["Greek","Greek"],["Gujarati","Gujarati"],["Gurmukhi","Gurmukhi"],["Hangul","Hangul"],["Han","Han"],["Hanunoo","Hanunoo"],["Hatran","Hatran"],["Hebrew","Hebrew"],["Hiragana","Hiragana"],["Anatolian_Hieroglyphs","Anatolian_Hieroglyphs"],["Pahawh_Hmong","Pahawh_Hmong"],["Nyiakeng_Puachue_Hmong","Nyiakeng_Puachue_Hmong"],["Katakana_Or_Hiragana","Katakana_Or_Hiragana"],["Old_Hungarian","Old_Hungarian"],["Old_Italic","Old_Italic"],["Javanese","Javanese"],["Kayah_Li","Kayah_Li"],["Katakana","Katakana"],["Kharoshthi","Kharoshthi"],["Khmer","Khmer"],["Khojki","Khojki"],["Khitan_Small_Script","Khitan_Small_Script"],["Kannada","Kannada"],["Kaithi","Kaithi"],["Tai_Tham","Tai_Tham"],["Lao","Lao"],["Latin","Latin"],["Lepcha","Lepcha"],["Limbu","Limbu"],["Linear_A","Linear_A"],["Linear_B","Linear_B"],["Lycian","Lycian"],["Lydian","Lydian"],["Mahajani","Mahajani"],["Makasar","Makasar"],["Mandaic","Mandaic"],["Manichaean","Manichaean"],["Marchen","Marchen"],["Medefaidrin","Medefaidrin"],["Mende_Kikakui","Mende_Kikakui"],["Meroitic_Cursive","Meroitic_Cursive"],["Meroitic_Hieroglyphs","Meroitic_Hieroglyphs"],["Malayalam","Malayalam"],["Mongolian","Mongolian"],["Mro","Mro"],["Meetei_Mayek","Meetei_Mayek"],["Multani","Multani"],["Myanmar","Myanmar"],["Nandinagari","Nandinagari"],["Old_North_Arabian","Old_North_Arabian"],["Nabataean","Nabataean"],["Nko","Nko"],["Nushu","Nushu"],["Ogham","Ogham"],["Ol_Chiki","Ol_Chiki"],["Old_Turkic","Old_Turkic"],["Oriya","Oriya"],["Osage","Osage"],["Osmanya","Osmanya"],["Palmyrene","Palmyrene"],["Pau_Cin_Hau","Pau_Cin_Hau"],["Old_Permic","Old_Permic"],["Phags_Pa","Phags_Pa"],["Inscriptional_Pahlavi","Inscriptional_Pahlavi"],["Psalter_Pahlavi","Psalter_Pahlavi"],["Phoenician","Phoenician"],["Miao","Miao"],["Inscriptional_Parthian","Inscriptional_Parthian"],["Rejang","Rejang"],["Hanifi_Rohingya","Hanifi_Rohingya"],["Runic","Runic"],["Samaritan","Samaritan"],["Old_South_Arabian","Old_South_Arabian"],["Saurashtra","Saurashtra"],["SignWriting","SignWriting"],["Shavian","Shavian"],["Sharada","Sharada"],["Siddham","Siddham"],["Khudawadi","Khudawadi"],["Sinhala","Sinhala"],["Sogdian","Sogdian"],["Old_Sogdian","Old_Sogdian"],["Sora_Sompeng","Sora_Sompeng"],["Soyombo","Soyombo"],["Sundanese","Sundanese"],["Syloti_Nagri","Syloti_Nagri"],["Syriac","Syriac"],["Tagbanwa","Tagbanwa"],["Takri","Takri"],["Tai_Le","Tai_Le"],["New_Tai_Lue","New_Tai_Lue"],["Tamil","Tamil"],["Tangut","Tangut"],["Tai_Viet","Tai_Viet"],["Telugu","Telugu"],["Tifinagh","Tifinagh"],["Tagalog","Tagalog"],["Thaana","Thaana"],["Tibetan","Tibetan"],["Tirhuta","Tirhuta"],["Ugaritic","Ugaritic"],["Vai","Vai"],["Warang_Citi","Warang_Citi"],["Wancho","Wancho"],["Old_Persian","Old_Persian"],["Cuneiform","Cuneiform"],["Yezidi","Yezidi"],["Yi","Yi"],["Zanabazar_Square","Zanabazar_Square"],["Inherited","Inherited"],["Common","Common"],["Unknown","Unknown"]])],["Script_Extensions",new Map([["Adlm","Adlam"],["Aghb","Caucasian_Albanian"],["Ahom","Ahom"],["Arab","Arabic"],["Armi","Imperial_Aramaic"],["Armn","Armenian"],["Avst","Avestan"],["Bali","Balinese"],["Bamu","Bamum"],["Bass","Bassa_Vah"],["Batk","Batak"],["Beng","Bengali"],["Bhks","Bhaiksuki"],["Bopo","Bopomofo"],["Brah","Brahmi"],["Brai","Braille"],["Bugi","Buginese"],["Buhd","Buhid"],["Cakm","Chakma"],["Cans","Canadian_Aboriginal"],["Cari","Carian"],["Cham","Cham"],["Cher","Cherokee"],["Chrs","Chorasmian"],["Copt","Coptic"],["Qaac","Coptic"],["Cprt","Cypriot"],["Cyrl","Cyrillic"],["Deva","Devanagari"],["Diak","Dives_Akuru"],["Dogr","Dogra"],["Dsrt","Deseret"],["Dupl","Duployan"],["Egyp","Egyptian_Hieroglyphs"],["Elba","Elbasan"],["Elym","Elymaic"],["Ethi","Ethiopic"],["Geor","Georgian"],["Glag","Glagolitic"],["Gong","Gunjala_Gondi"],["Gonm","Masaram_Gondi"],["Goth","Gothic"],["Gran","Grantha"],["Grek","Greek"],["Gujr","Gujarati"],["Guru","Gurmukhi"],["Hang","Hangul"],["Hani","Han"],["Hano","Hanunoo"],["Hatr","Hatran"],["Hebr","Hebrew"],["Hira","Hiragana"],["Hluw","Anatolian_Hieroglyphs"],["Hmng","Pahawh_Hmong"],["Hmnp","Nyiakeng_Puachue_Hmong"],["Hrkt","Katakana_Or_Hiragana"],["Hung","Old_Hungarian"],["Ital","Old_Italic"],["Java","Javanese"],["Kali","Kayah_Li"],["Kana","Katakana"],["Khar","Kharoshthi"],["Khmr","Khmer"],["Khoj","Khojki"],["Kits","Khitan_Small_Script"],["Knda","Kannada"],["Kthi","Kaithi"],["Lana","Tai_Tham"],["Laoo","Lao"],["Latn","Latin"],["Lepc","Lepcha"],["Limb","Limbu"],["Lina","Linear_A"],["Linb","Linear_B"],["Lisu","Lisu"],["Lyci","Lycian"],["Lydi","Lydian"],["Mahj","Mahajani"],["Maka","Makasar"],["Mand","Mandaic"],["Mani","Manichaean"],["Marc","Marchen"],["Medf","Medefaidrin"],["Mend","Mende_Kikakui"],["Merc","Meroitic_Cursive"],["Mero","Meroitic_Hieroglyphs"],["Mlym","Malayalam"],["Modi","Modi"],["Mong","Mongolian"],["Mroo","Mro"],["Mtei","Meetei_Mayek"],["Mult","Multani"],["Mymr","Myanmar"],["Nand","Nandinagari"],["Narb","Old_North_Arabian"],["Nbat","Nabataean"],["Newa","Newa"],["Nkoo","Nko"],["Nshu","Nushu"],["Ogam","Ogham"],["Olck","Ol_Chiki"],["Orkh","Old_Turkic"],["Orya","Oriya"],["Osge","Osage"],["Osma","Osmanya"],["Palm","Palmyrene"],["Pauc","Pau_Cin_Hau"],["Perm","Old_Permic"],["Phag","Phags_Pa"],["Phli","Inscriptional_Pahlavi"],["Phlp","Psalter_Pahlavi"],["Phnx","Phoenician"],["Plrd","Miao"],["Prti","Inscriptional_Parthian"],["Rjng","Rejang"],["Rohg","Hanifi_Rohingya"],["Runr","Runic"],["Samr","Samaritan"],["Sarb","Old_South_Arabian"],["Saur","Saurashtra"],["Sgnw","SignWriting"],["Shaw","Shavian"],["Shrd","Sharada"],["Sidd","Siddham"],["Sind","Khudawadi"],["Sinh","Sinhala"],["Sogd","Sogdian"],["Sogo","Old_Sogdian"],["Sora","Sora_Sompeng"],["Soyo","Soyombo"],["Sund","Sundanese"],["Sylo","Syloti_Nagri"],["Syrc","Syriac"],["Tagb","Tagbanwa"],["Takr","Takri"],["Tale","Tai_Le"],["Talu","New_Tai_Lue"],["Taml","Tamil"],["Tang","Tangut"],["Tavt","Tai_Viet"],["Telu","Telugu"],["Tfng","Tifinagh"],["Tglg","Tagalog"],["Thaa","Thaana"],["Thai","Thai"],["Tibt","Tibetan"],["Tirh","Tirhuta"],["Ugar","Ugaritic"],["Vaii","Vai"],["Wara","Warang_Citi"],["Wcho","Wancho"],["Xpeo","Old_Persian"],["Xsux","Cuneiform"],["Yezi","Yezidi"],["Yiii","Yi"],["Zanb","Zanabazar_Square"],["Zinh","Inherited"],["Qaai","Inherited"],["Zyyy","Common"],["Zzzz","Unknown"],["Adlam","Adlam"],["Caucasian_Albanian","Caucasian_Albanian"],["Arabic","Arabic"],["Imperial_Aramaic","Imperial_Aramaic"],["Armenian","Armenian"],["Avestan","Avestan"],["Balinese","Balinese"],["Bamum","Bamum"],["Bassa_Vah","Bassa_Vah"],["Batak","Batak"],["Bengali","Bengali"],["Bhaiksuki","Bhaiksuki"],["Bopomofo","Bopomofo"],["Brahmi","Brahmi"],["Braille","Braille"],["Buginese","Buginese"],["Buhid","Buhid"],["Chakma","Chakma"],["Canadian_Aboriginal","Canadian_Aboriginal"],["Carian","Carian"],["Cherokee","Cherokee"],["Chorasmian","Chorasmian"],["Coptic","Coptic"],["Cypriot","Cypriot"],["Cyrillic","Cyrillic"],["Devanagari","Devanagari"],["Dives_Akuru","Dives_Akuru"],["Dogra","Dogra"],["Deseret","Deseret"],["Duployan","Duployan"],["Egyptian_Hieroglyphs","Egyptian_Hieroglyphs"],["Elbasan","Elbasan"],["Elymaic","Elymaic"],["Ethiopic","Ethiopic"],["Georgian","Georgian"],["Glagolitic","Glagolitic"],["Gunjala_Gondi","Gunjala_Gondi"],["Masaram_Gondi","Masaram_Gondi"],["Gothic","Gothic"],["Grantha","Grantha"],["Greek","Greek"],["Gujarati","Gujarati"],["Gurmukhi","Gurmukhi"],["Hangul","Hangul"],["Han","Han"],["Hanunoo","Hanunoo"],["Hatran","Hatran"],["Hebrew","Hebrew"],["Hiragana","Hiragana"],["Anatolian_Hieroglyphs","Anatolian_Hieroglyphs"],["Pahawh_Hmong","Pahawh_Hmong"],["Nyiakeng_Puachue_Hmong","Nyiakeng_Puachue_Hmong"],["Katakana_Or_Hiragana","Katakana_Or_Hiragana"],["Old_Hungarian","Old_Hungarian"],["Old_Italic","Old_Italic"],["Javanese","Javanese"],["Kayah_Li","Kayah_Li"],["Katakana","Katakana"],["Kharoshthi","Kharoshthi"],["Khmer","Khmer"],["Khojki","Khojki"],["Khitan_Small_Script","Khitan_Small_Script"],["Kannada","Kannada"],["Kaithi","Kaithi"],["Tai_Tham","Tai_Tham"],["Lao","Lao"],["Latin","Latin"],["Lepcha","Lepcha"],["Limbu","Limbu"],["Linear_A","Linear_A"],["Linear_B","Linear_B"],["Lycian","Lycian"],["Lydian","Lydian"],["Mahajani","Mahajani"],["Makasar","Makasar"],["Mandaic","Mandaic"],["Manichaean","Manichaean"],["Marchen","Marchen"],["Medefaidrin","Medefaidrin"],["Mende_Kikakui","Mende_Kikakui"],["Meroitic_Cursive","Meroitic_Cursive"],["Meroitic_Hieroglyphs","Meroitic_Hieroglyphs"],["Malayalam","Malayalam"],["Mongolian","Mongolian"],["Mro","Mro"],["Meetei_Mayek","Meetei_Mayek"],["Multani","Multani"],["Myanmar","Myanmar"],["Nandinagari","Nandinagari"],["Old_North_Arabian","Old_North_Arabian"],["Nabataean","Nabataean"],["Nko","Nko"],["Nushu","Nushu"],["Ogham","Ogham"],["Ol_Chiki","Ol_Chiki"],["Old_Turkic","Old_Turkic"],["Oriya","Oriya"],["Osage","Osage"],["Osmanya","Osmanya"],["Palmyrene","Palmyrene"],["Pau_Cin_Hau","Pau_Cin_Hau"],["Old_Permic","Old_Permic"],["Phags_Pa","Phags_Pa"],["Inscriptional_Pahlavi","Inscriptional_Pahlavi"],["Psalter_Pahlavi","Psalter_Pahlavi"],["Phoenician","Phoenician"],["Miao","Miao"],["Inscriptional_Parthian","Inscriptional_Parthian"],["Rejang","Rejang"],["Hanifi_Rohingya","Hanifi_Rohingya"],["Runic","Runic"],["Samaritan","Samaritan"],["Old_South_Arabian","Old_South_Arabian"],["Saurashtra","Saurashtra"],["SignWriting","SignWriting"],["Shavian","Shavian"],["Sharada","Sharada"],["Siddham","Siddham"],["Khudawadi","Khudawadi"],["Sinhala","Sinhala"],["Sogdian","Sogdian"],["Old_Sogdian","Old_Sogdian"],["Sora_Sompeng","Sora_Sompeng"],["Soyombo","Soyombo"],["Sundanese","Sundanese"],["Syloti_Nagri","Syloti_Nagri"],["Syriac","Syriac"],["Tagbanwa","Tagbanwa"],["Takri","Takri"],["Tai_Le","Tai_Le"],["New_Tai_Lue","New_Tai_Lue"],["Tamil","Tamil"],["Tangut","Tangut"],["Tai_Viet","Tai_Viet"],["Telugu","Telugu"],["Tifinagh","Tifinagh"],["Tagalog","Tagalog"],["Thaana","Thaana"],["Tibetan","Tibetan"],["Tirhuta","Tirhuta"],["Ugaritic","Ugaritic"],["Vai","Vai"],["Warang_Citi","Warang_Citi"],["Wancho","Wancho"],["Old_Persian","Old_Persian"],["Cuneiform","Cuneiform"],["Yezidi","Yezidi"],["Yi","Yi"],["Zanabazar_Square","Zanabazar_Square"],["Inherited","Inherited"],["Common","Common"],["Unknown","Unknown"]])]])},1317:(e,t,r)=>{"use strict";const s=r(4703);const matchPropertyValue=function(e,t){const r=s.get(e);if(!r){throw new Error(`Unknown property \`${e}\`.`)}const a=r.get(t);if(a){return a}throw new Error(`Unknown value \`${t}\` for property \`${e}\`.`)};e.exports=matchPropertyValue},864:e=>{e.exports=new Map([["scx","Script_Extensions"],["sc","Script"],["gc","General_Category"],["AHex","ASCII_Hex_Digit"],["Alpha","Alphabetic"],["Bidi_C","Bidi_Control"],["Bidi_M","Bidi_Mirrored"],["Cased","Cased"],["CI","Case_Ignorable"],["CWCF","Changes_When_Casefolded"],["CWCM","Changes_When_Casemapped"],["CWKCF","Changes_When_NFKC_Casefolded"],["CWL","Changes_When_Lowercased"],["CWT","Changes_When_Titlecased"],["CWU","Changes_When_Uppercased"],["Dash","Dash"],["Dep","Deprecated"],["DI","Default_Ignorable_Code_Point"],["Dia","Diacritic"],["Ext","Extender"],["Gr_Base","Grapheme_Base"],["Gr_Ext","Grapheme_Extend"],["Hex","Hex_Digit"],["IDC","ID_Continue"],["Ideo","Ideographic"],["IDS","ID_Start"],["IDSB","IDS_Binary_Operator"],["IDST","IDS_Trinary_Operator"],["Join_C","Join_Control"],["LOE","Logical_Order_Exception"],["Lower","Lowercase"],["Math","Math"],["NChar","Noncharacter_Code_Point"],["Pat_Syn","Pattern_Syntax"],["Pat_WS","Pattern_White_Space"],["QMark","Quotation_Mark"],["Radical","Radical"],["RI","Regional_Indicator"],["SD","Soft_Dotted"],["STerm","Sentence_Terminal"],["Term","Terminal_Punctuation"],["UIdeo","Unified_Ideograph"],["Upper","Uppercase"],["VS","Variation_Selector"],["WSpace","White_Space"],["space","White_Space"],["XIDC","XID_Continue"],["XIDS","XID_Start"]])},3812:(e,t,r)=>{function eslintParser(){return r(8187)}function pluginProposalClassProperties(){return r(8027)}function pluginProposalExportNamespaceFrom(){return r(9579)}function pluginProposalNumericSeparator(){return r(7300)}function pluginProposalObjectRestSpread(){return r(6309)}function pluginSyntaxBigint(){return r(6762)}function pluginSyntaxDynamicImport(){return r(5163)}function pluginSyntaxImportAssertions(){return r(8356)}function pluginSyntaxJsx(){return r(8926)}function pluginTransformDefine(){return r(9065)}function pluginTransformModulesCommonjs(){return r(6186)}function pluginTransformReactRemovePropTypes(){return r(6197)}function pluginTransformRuntime(){return r(4722)}function presetEnv(){return r(9290)}function presetReact(){return r(8277)}function presetTypescript(){return r(1068)}e.exports={eslintParser:eslintParser,pluginProposalClassProperties:pluginProposalClassProperties,pluginProposalExportNamespaceFrom:pluginProposalExportNamespaceFrom,pluginProposalNumericSeparator:pluginProposalNumericSeparator,pluginProposalObjectRestSpread:pluginProposalObjectRestSpread,pluginSyntaxBigint:pluginSyntaxBigint,pluginSyntaxDynamicImport:pluginSyntaxDynamicImport,pluginSyntaxImportAssertions:pluginSyntaxImportAssertions,pluginSyntaxJsx:pluginSyntaxJsx,pluginTransformDefine:pluginTransformDefine,pluginTransformModulesCommonjs:pluginTransformModulesCommonjs,pluginTransformReactRemovePropTypes:pluginTransformReactRemovePropTypes,pluginTransformRuntime:pluginTransformRuntime,presetEnv:presetEnv,presetReact:presetReact,presetTypescript:presetTypescript}},2272:(e,t,r)=>{e.exports=r(4817)},9302:(e,t,r)=>{e.exports=r(8392)},7363:(e,t,r)=>{e.exports=r(5224)},3574:(e,t,r)=>{e.exports=r(4374)},5884:(e,t,r)=>{e.exports=r(7867)},6038:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getInclusionReasons=getInclusionReasons;var s=r(7849);var a=r(1610);var n=r(240);function getInclusionReasons(e,t,r){const o=r[e]||{};return Object.keys(t).reduce(((e,r)=>{const i=(0,n.getLowestImplementedVersion)(o,r);const l=t[r];if(!i){e[r]=(0,a.prettifyVersion)(l)}else{const t=(0,n.isUnreleasedVersion)(i,r);const o=(0,n.isUnreleasedVersion)(l,r);if(!o&&(t||s.lt(l.toString(),(0,n.semverify)(i)))){e[r]=(0,a.prettifyVersion)(l)}}return e}),{})}},4486:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.targetsSupported=targetsSupported;t.isRequired=isRequired;t["default"]=filterItems;var s=r(7849);var a=r(5884);var n=r(240);function targetsSupported(e,t){const r=Object.keys(e);if(r.length===0){return false}const a=r.filter((r=>{const a=(0,n.getLowestImplementedVersion)(t,r);if(!a){return true}const o=e[r];if((0,n.isUnreleasedVersion)(o,r)){return false}if((0,n.isUnreleasedVersion)(a,r)){return true}if(!s.valid(o.toString())){throw new Error(`Invalid version passed for target "${r}": "${o}". `+"Versions must be in semver format (major.minor.patch)")}return s.gt((0,n.semverify)(a),o.toString())}));return a.length===0}function isRequired(e,t,{compatData:r=a,includes:s,excludes:n}={}){if(n!=null&&n.has(e))return false;if(s!=null&&s.has(e))return true;return!targetsSupported(t,r[e])}function filterItems(e,t,r,s,a,n,o){const i=new Set;const l={compatData:e,includes:t,excludes:r};for(const t in e){if(isRequired(t,s,l)){i.add(t)}else if(o){const e=o.get(t);if(e){i.add(e)}}}if(a){a.forEach((e=>!r.has(e)&&i.add(e)))}if(n){n.forEach((e=>!t.has(e)&&i.delete(e)))}return i}},4413:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isBrowsersQueryValid=isBrowsersQueryValid;t["default"]=getTargets;Object.defineProperty(t,"unreleasedLabels",{enumerable:true,get:function(){return i.unreleasedLabels}});Object.defineProperty(t,"TargetNames",{enumerable:true,get:function(){return l.TargetNames}});Object.defineProperty(t,"prettifyTargets",{enumerable:true,get:function(){return c.prettifyTargets}});Object.defineProperty(t,"getInclusionReasons",{enumerable:true,get:function(){return u.getInclusionReasons}});Object.defineProperty(t,"filterItems",{enumerable:true,get:function(){return p.default}});Object.defineProperty(t,"isRequired",{enumerable:true,get:function(){return p.isRequired}});var s=r(4907);var a=r(7347);var n=r(9302);var o=r(240);var i=r(1915);var l=r(1888);var c=r(1610);var u=r(6038);var p=r(4486);const d=n["es6.module"];const f=new a.OptionValidator("@babel/helper-compilation-targets");function validateTargetNames(e){const t=Object.keys(l.TargetNames);for(const r of Object.keys(e)){if(!(r in l.TargetNames)){throw new Error(f.formatMessage(`'${r}' is not a valid target\n- Did you mean '${(0,a.findSuggestion)(r,t)}'?`))}}return e}function isBrowsersQueryValid(e){return typeof e==="string"||Array.isArray(e)&&e.every((e=>typeof e==="string"))}function validateBrowsers(e){f.invariant(e===undefined||isBrowsersQueryValid(e),`'${String(e)}' is not a valid browserslist query`);return e}function getLowestVersions(e){return e.reduce(((e,t)=>{const[r,s]=t.split(" ");const a=i.browserNameMap[r];if(!a){return e}try{const t=s.split("-")[0].toLowerCase();const n=(0,o.isUnreleasedVersion)(t,r);if(!e[a]){e[a]=n?t:(0,o.semverify)(t);return e}const i=e[a];const l=(0,o.isUnreleasedVersion)(i,r);if(l&&n){e[a]=(0,o.getLowestUnreleased)(i,t,r)}else if(l){e[a]=(0,o.semverify)(t)}else if(!l&&!n){const r=(0,o.semverify)(t);e[a]=(0,o.semverMin)(i,r)}}catch(e){}return e}),{})}function outputDecimalWarning(e){if(!e.length){return}console.warn("Warning, the following targets are using a decimal version:\n");e.forEach((({target:e,value:t})=>console.warn(` ${e}: ${t}`)));console.warn(`\nWe recommend using a string for minor/patch versions to avoid numbers like 6.10\ngetting parsed as 6.1, which can lead to unexpected behavior.\n`)}function semverifyTarget(e,t){try{return(0,o.semverify)(t)}catch(r){throw new Error(f.formatMessage(`'${t}' is not a valid value for 'targets.${e}'.`))}}const m={__default(e,t){const r=(0,o.isUnreleasedVersion)(t,e)?t.toLowerCase():semverifyTarget(e,t);return[e,r]},node(e,t){const r=t===true||t==="current"?process.versions.node:semverifyTarget(e,t);return[e,r]}};function generateTargets(e){const t=Object.assign({},e);delete t.esmodules;delete t.browsers;return t}function resolveTargets(e){const t=s(e,{mobileToDesktop:true});return getLowestVersions(t)}function getTargets(e={},t={}){var r;let{browsers:a,esmodules:n}=e;const{configPath:i="."}=t;validateBrowsers(a);const l=generateTargets(e);let c=validateTargetNames(l);const u=!!a;const p=u||Object.keys(c).length>0;const f=!t.ignoreBrowserslistConfig&&!p;if(!a&&f){a=s.loadConfig({config:t.configFile,path:i,env:t.browserslistEnv});if(a==null){{a=[]}}}if(n&&(n!=="intersect"||!((r=a)!=null&&r.length))){a=Object.keys(d).map((e=>`${e} >= ${d[e]}`)).join(", ");n=false}if(a){const e=resolveTargets(a);if(n==="intersect"){for(const t of Object.keys(e)){const r=e[t];if(d[t]){e[t]=(0,o.getHighestUnreleased)(r,(0,o.semverify)(d[t]),t)}else{delete e[t]}}}c=Object.assign(e,c)}const y={};const g=[];for(const e of Object.keys(c).sort()){var h;const t=c[e];if(typeof t==="number"&&t%1!==0){g.push({target:e,value:t})}const r=(h=m[e])!=null?h:m.__default;const[s,a]=r(e,t);if(a){y[s]=a}}outputDecimalWarning(g);return y}},1888:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.TargetNames=void 0;const r={node:"node",chrome:"chrome",opera:"opera",edge:"edge",firefox:"firefox",safari:"safari",ie:"ie",ios:"ios",android:"android",electron:"electron",samsung:"samsung",rhino:"rhino"};t.TargetNames=r},1610:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.prettifyVersion=prettifyVersion;t.prettifyTargets=prettifyTargets;var s=r(7849);var a=r(1915);function prettifyVersion(e){if(typeof e!=="string"){return e}const t=[s.major(e)];const r=s.minor(e);const a=s.patch(e);if(r||a){t.push(r)}if(a){t.push(a)}return t.join(".")}function prettifyTargets(e){return Object.keys(e).reduce(((t,r)=>{let s=e[r];const n=a.unreleasedLabels[r];if(typeof s==="string"&&n!==s){s=prettifyVersion(s)}t[r]=s;return t}),{})}},1915:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.browserNameMap=t.unreleasedLabels=void 0;const r={safari:"tp"};t.unreleasedLabels=r;const s={and_chr:"chrome",and_ff:"firefox",android:"android",chrome:"chrome",edge:"edge",firefox:"firefox",ie:"ie",ie_mob:"ie",ios_saf:"ios",node:"node",op_mob:"opera",opera:"opera",safari:"safari",samsung:"samsung"};t.browserNameMap=s},240:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.semverMin=semverMin;t.semverify=semverify;t.isUnreleasedVersion=isUnreleasedVersion;t.getLowestUnreleased=getLowestUnreleased;t.getHighestUnreleased=getHighestUnreleased;t.getLowestImplementedVersion=getLowestImplementedVersion;var s=r(7849);var a=r(7347);var n=r(1915);const o=/^(\d+|\d+.\d+)$/;const i=new a.OptionValidator("@babel/helper-compilation-targets");function semverMin(e,t){return e&&s.lt(e,t)?e:t}function semverify(e){if(typeof e==="string"&&s.valid(e)){return e}i.invariant(typeof e==="number"||typeof e==="string"&&o.test(e),`'${e}' is not a valid version`);const t=e.toString().split(".");while(t.length<3){t.push("0")}return t.join(".")}function isUnreleasedVersion(e,t){const r=n.unreleasedLabels[t];return!!r&&r===e.toString().toLowerCase()}function getLowestUnreleased(e,t,r){const s=n.unreleasedLabels[r];const a=[e,t].some((e=>e===s));if(a){return e===a?t:e||t}return semverMin(e,t)}function getHighestUnreleased(e,t,r){return getLowestUnreleased(e,t,r)===e?t:e}function getLowestImplementedVersion(e,t){const r=e[t];if(!r&&t==="android"){return e.chrome}return r}},5789:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(8622);function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach((function(r){if(r!=="default"){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:true,get:function(){return e[r]}})}}))}t["default"]=e;return Object.freeze(t)}var a=_interopNamespace(s);function willPathCastToBoolean(e){const t=e;const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}class AssignmentMemoiser{constructor(){this._map=void 0;this._map=new WeakMap}has(e){return this._map.has(e)}get(e){if(!this.has(e))return;const t=this._map.get(e);const{value:r}=t;t.count--;if(t.count===0){return a.assignmentExpression("=",r,e)}return r}set(e,t,r){return this._map.set(e,{count:r,value:t})}}function toNonOptional(e,t){const{node:r}=e;if(a.isOptionalMemberExpression(r)){return a.memberExpression(t,r.property,r.computed)}if(e.isOptionalCallExpression()){const r=e.get("callee");if(e.node.optional&&r.isOptionalMemberExpression()){const{object:s}=r.node;const n=e.scope.maybeGenerateMemoised(s)||s;r.get("object").replaceWith(a.assignmentExpression("=",n,s));return a.callExpression(a.memberExpression(t,a.identifier("call")),[n,...e.node.arguments])}return a.callExpression(t,e.node.arguments)}return e.node}function isInDetachedTree(e){while(e){if(e.isProgram())break;const{parentPath:t,container:r,listKey:s}=e;const a=t.node;if(s){if(r!==a[s])return true}else{if(r!==a)return true}e=t}return false}const n={memoise(){},handle(e,t){const{node:r,parent:s,parentPath:n,scope:o}=e;if(e.isOptionalMemberExpression()){if(isInDetachedTree(e))return;const i=e.find((({node:t,parent:r})=>{if(a.isOptionalMemberExpression(r)){return r.optional||r.object!==t}if(a.isOptionalCallExpression(r)){return t!==e.node&&r.optional||r.callee!==t}return true}));if(o.path.isPattern()){i.replaceWith(a.callExpression(a.arrowFunctionExpression([],i.node),[]));return}const l=willPathCastToBoolean(i);const c=i.parentPath;if(c.isUpdateExpression({argument:r})||c.isAssignmentExpression({left:r})){throw e.buildCodeFrameError(`can't handle assignment`)}const u=c.isUnaryExpression({operator:"delete"});if(u&&i.isOptionalMemberExpression()&&i.get("property").isPrivateName()){throw e.buildCodeFrameError(`can't delete a private class element`)}let p=e;for(;;){if(p.isOptionalMemberExpression()){if(p.node.optional)break;p=p.get("object");continue}else if(p.isOptionalCallExpression()){if(p.node.optional)break;p=p.get("callee");continue}throw new Error(`Internal error: unexpected ${p.node.type}`)}const d=p.isOptionalMemberExpression()?"object":"callee";const f=p.node[d];const m=o.maybeGenerateMemoised(f);const y=m!=null?m:f;const g=n.isOptionalCallExpression({callee:r});const isOptionalCall=e=>g;const h=n.isCallExpression({callee:r});p.replaceWith(toNonOptional(p,y));if(isOptionalCall()){if(s.optional){n.replaceWith(this.optionalCall(e,s.arguments))}else{n.replaceWith(this.call(e,s.arguments))}}else if(h){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}let b=e.node;for(let t=e;t!==i;){const e=t.parentPath;if(e===i&&isOptionalCall()&&s.optional){b=e.node;break}b=toNonOptional(e,b);t=e}let x;const v=i.parentPath;if(a.isMemberExpression(b)&&v.isOptionalCallExpression({callee:i.node,optional:true})){const{object:t}=b;x=e.scope.maybeGenerateMemoised(t);if(x){b.object=a.assignmentExpression("=",x,t)}}let E=i;if(u){E=v;b=v.node}const j=m?a.assignmentExpression("=",a.cloneNode(y),a.cloneNode(f)):a.cloneNode(y);if(l){let e;if(t){e=a.binaryExpression("!=",j,a.nullLiteral())}else{e=a.logicalExpression("&&",a.binaryExpression("!==",j,a.nullLiteral()),a.binaryExpression("!==",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.logicalExpression("&&",e,b))}else{let e;if(t){e=a.binaryExpression("==",j,a.nullLiteral())}else{e=a.logicalExpression("||",a.binaryExpression("===",j,a.nullLiteral()),a.binaryExpression("===",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.conditionalExpression(e,u?a.booleanLiteral(true):o.buildUndefinedNode(),b))}if(x){const e=v.node;v.replaceWith(a.optionalCallExpression(a.optionalMemberExpression(e.callee,a.identifier("call"),false,true),[a.cloneNode(x),...e.arguments],false))}return}if(a.isUpdateExpression(s,{argument:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,prefix:o}=s;this.memoise(e,2);const i=a.binaryExpression(t[0],a.unaryExpression("+",this.get(e)),a.numericLiteral(1));if(o){n.replaceWith(this.set(e,i))}else{const{scope:t}=e;const s=t.generateUidIdentifierBasedOnNode(r);t.push({id:s});i.left=a.assignmentExpression("=",a.cloneNode(s),i.left);n.replaceWith(a.sequenceExpression([this.set(e,i),a.cloneNode(s)]))}return}if(n.isAssignmentExpression({left:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,right:r}=n.node;if(t==="="){n.replaceWith(this.set(e,r))}else{const s=t.slice(0,-1);if(a.LOGICAL_OPERATORS.includes(s)){this.memoise(e,1);n.replaceWith(a.logicalExpression(s,this.get(e),this.set(e,r)))}else{this.memoise(e,2);n.replaceWith(this.set(e,a.binaryExpression(s,this.get(e),r)))}}return}if(n.isCallExpression({callee:r})){n.replaceWith(this.call(e,n.node.arguments));return}if(n.isOptionalCallExpression({callee:r})){if(o.path.isPattern()){n.replaceWith(a.callExpression(a.arrowFunctionExpression([],n.node),[]));return}n.replaceWith(this.optionalCall(e,n.node.arguments));return}if(n.isForXStatement({left:r})||n.isObjectProperty({value:r})&&n.parentPath.isObjectPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isObjectProperty({value:s})&&n.parentPath.parentPath.isObjectPattern()||n.isArrayPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isArrayPattern()||n.isRestElement()){e.replaceWith(this.destructureSet(e));return}if(n.isTaggedTemplateExpression()){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}}};function memberExpressionToFunctions(e,t,r){e.traverse(t,Object.assign({},n,r,{memoiser:new AssignmentMemoiser}))}t["default"]=memberExpressionToFunctions},558:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1626:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(558);var a=r(7490);var n=r(5480);var o=r(8304);function matchAffectedArguments(e){const t=e.findIndex((e=>o.types.isSpreadElement(e)));return t>=0&&t!==e.length-1}function shouldTransform(e){let t=e;const r=[];while(t.isOptionalMemberExpression()||t.isOptionalCallExpression()){const{node:e}=t;r.push(e);if(t.isOptionalMemberExpression()){t=n.skipTransparentExprWrappers(t.get("object"))}else if(t.isOptionalCallExpression()){t=n.skipTransparentExprWrappers(t.get("callee"))}}for(let e=0;e{e.assertVersion(7);const t=e.assumption("noDocumentAll");const r=e.assumption("pureGetters");return{name:"bugfix-v8-spread-parameters-in-optional-chaining",visitor:{"OptionalCallExpression|OptionalMemberExpression"(e){if(shouldTransform(e)){a.transform(e,{noDocumentAll:t,pureGetters:r})}}}}}));t["default"]=i},1023:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(8304);const a=(0,s.template)(`\n async function wrapper() {\n var ITERATOR_ABRUPT_COMPLETION = false;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY;\n try {\n for (\n var ITERATOR_KEY = GET_ITERATOR(OBJECT), STEP_KEY;\n ITERATOR_ABRUPT_COMPLETION = !(STEP_KEY = await ITERATOR_KEY.next()).done;\n ITERATOR_ABRUPT_COMPLETION = false\n ) {\n }\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (ITERATOR_ABRUPT_COMPLETION && ITERATOR_KEY.return != null) {\n await ITERATOR_KEY.return();\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n }\n`);function _default(e,{getAsyncIterator:t}){const{node:r,scope:n,parent:o}=e;const i=n.generateUidIdentifier("step");const l=s.types.memberExpression(i,s.types.identifier("value"));const c=r.left;let u;if(s.types.isIdentifier(c)||s.types.isPattern(c)||s.types.isMemberExpression(c)){u=s.types.expressionStatement(s.types.assignmentExpression("=",c,l))}else if(s.types.isVariableDeclaration(c)){u=s.types.variableDeclaration(c.kind,[s.types.variableDeclarator(c.declarations[0].id,l)])}let p=a({ITERATOR_HAD_ERROR_KEY:n.generateUidIdentifier("didIteratorError"),ITERATOR_ABRUPT_COMPLETION:n.generateUidIdentifier("iteratorAbruptCompletion"),ITERATOR_ERROR_KEY:n.generateUidIdentifier("iteratorError"),ITERATOR_KEY:n.generateUidIdentifier("iterator"),GET_ITERATOR:t,OBJECT:r.right,STEP_KEY:s.types.cloneNode(i)});p=p.body.body;const d=s.types.isLabeledStatement(o);const f=p[3].block.body;const m=f[0];if(d){f[0]=s.types.labeledStatement(o.label,m)}return{replaceParent:d,node:p,declar:u,loop:m}}},2271:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(7120);var n=r(1079);var o=r(8304);var i=r(1023);var l=(0,s.declare)((e=>{e.assertVersion(7);const t={Function(e){e.skip()},YieldExpression({node:e},t){if(!e.delegate)return;const r=t.addHelper("asyncGeneratorDelegate");e.argument=o.types.callExpression(r,[o.types.callExpression(t.addHelper("asyncIterator"),[e.argument]),t.addHelper("awaitAsyncGenerator")])}};const r={Function(e){e.skip()},ForOfStatement(e,{file:t}){const{node:r}=e;if(!r.await)return;const s=(0,i.default)(e,{getAsyncIterator:t.addHelper("asyncIterator")});const{declar:a,loop:n}=s;const l=n.body;e.ensureBlock();if(a){l.body.push(a)}l.body=l.body.concat(r.body.body);o.types.inherits(n,r);o.types.inherits(n.body,r.body);if(s.replaceParent){e.parentPath.replaceWithMultiple(s.node)}else{e.replaceWithMultiple(s.node)}}};const s={Function(e,s){if(!e.node.async)return;e.traverse(r,s);if(!e.node.generator)return;e.traverse(t,s);(0,a.default)(e,{wrapAsync:s.addHelper("wrapAsyncGenerator"),wrapAwait:s.addHelper("awaitAsyncGenerator")})}};return{name:"proposal-async-generator-functions",inherits:n.default,visitor:{Program(e,t){e.traverse(s,t)}}}}));t["default"]=l},5557:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(8142);var n=r(6758);function generateUid(e,t){const r="";let s;let a=1;do{s=e._generateUid(r,a);a++}while(t.has(s));return s}var o=(0,s.declare)((({types:e,template:t,assertVersion:r})=>{r("^7.12.0");return{name:"proposal-class-static-block",inherits:a.default,pre(){(0,n.enableFeature)(this.file,n.FEATURES.staticBlocks,false)},visitor:{ClassBody(r){const{scope:s}=r;const a=new Set;const n=r.get("body");for(const e of n){if(e.isPrivate()){a.add(e.get("key.id").node.name)}}for(const r of n){if(!r.isStaticBlock())continue;const n=generateUid(s,a);a.add(n);const o=e.privateName(e.identifier(n));r.replaceWith(e.classPrivateProperty(o,t.expression.ast`(() => { ${r.node.body} })()`,[],true))}}}}}));t["default"]=o},3181:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(7445);var n=r(6758);var o=r(2155);var i=(0,s.declare)((({assertVersion:e,types:t,template:r},{loose:s})=>{e(7);const i=new WeakMap;const l=new WeakMap;function unshadow(e,t,r){while(r!==t){if(r.hasOwnBinding(e))r.rename(e);r=r.parent}}function injectToFieldInit(e,r,s=false){if(e.node.value){if(s){e.get("value").insertBefore(r)}else{e.get("value").insertAfter(r)}}else{e.set("value",t.unaryExpression("void",r))}}function injectInitialization(e,r){let s;let a;for(const t of e.get("body.body")){if((t.isClassProperty()||t.isClassPrivateProperty())&&!t.node.static){s=t;break}if(!a&&t.isClassMethod({kind:"constructor"})){a=t}}if(s){injectToFieldInit(s,r,true)}else{(0,n.injectInitialization)(e,a,[t.expressionStatement(r)])}}function getWeakSetId(e,s,a,n="",l){let c=i.get(a.node);if(!c){c=s.scope.generateUidIdentifier(`${n||""} brandCheck`);i.set(a.node,c);l(a,r.expression.ast`${t.cloneNode(c)}.add(this)`);const e=t.newExpression(t.identifier("WeakSet"),[]);(0,o.default)(e);s.insertBefore(r.ast`var ${c} = ${e}`)}return t.cloneNode(c)}return{name:"proposal-private-property-in-object",inherits:a.default,pre(){(0,n.enableFeature)(this.file,n.FEATURES.privateIn,s)},visitor:{BinaryExpression(e){const{node:s}=e;if(s.operator!=="in")return;if(!t.isPrivateName(s.left))return;const{name:a}=s.left.id;let n;const o=e.findParent((e=>{if(!e.isClass())return false;n=e.get("body.body").find((({node:e})=>t.isPrivate(e)&&e.key.id.name===a));return!!n}));if(o.parentPath.scope.path.isPattern()){o.replaceWith(r.ast`(() => ${o.node})()`);return}if(n.isMethod()){if(n.node.static){if(o.node.id){unshadow(o.node.id.name,o.scope,e.scope)}else{o.set("id",e.scope.generateUidIdentifier("class"))}e.replaceWith(r.expression.ast` + */(function(){"use strict";var r={function:true,object:true};var s=r[typeof window]&&window||this;var a=r[typeof t]&&t&&!t.nodeType&&t;var n=r["object"]&&e&&!e.nodeType;var o=a&&n&&typeof global=="object"&&global;if(o&&(o.global===o||o.window===o||o.self===o)){s=o}var i=Object.prototype.hasOwnProperty;function fromCodePoint(){var e=Number(arguments[0]);if(!isFinite(e)||e<0||e>1114111||Math.floor(e)!=e){throw RangeError("Invalid code point: "+e)}if(e<=65535){return String.fromCharCode(e)}else{e-=65536;var t=(e>>10)+55296;var r=e%1024+56320;return String.fromCharCode(t,r)}}var l={};function assertType(e,t){if(t.indexOf("|")==-1){if(e==t){return}throw Error("Invalid node type: "+e+"; expected type: "+t)}t=i.call(l,t)?l[t]:l[t]=RegExp("^(?:"+t+")$");if(t.test(e)){return}throw Error("Invalid node type: "+e+"; expected types: "+t)}function generate(e){var t=e.type;if(i.call(c,t)){return c[t](e)}throw Error("Invalid node type: "+t)}function generateAlternative(e){assertType(e.type,"alternative");var t=e.body,r=-1,s=t.length,a="";while(++r"}break;case"ignore":t+="?:";break;case"lookahead":t+="?=";break;case"negativeLookahead":t+="?!";break;case"lookbehind":t+="?<=";break;case"negativeLookbehind":t+="?"}throw new Error("Unknown reference type")}function generateTerm(e){assertType(e.type,"anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|unicodePropertyEscape|value|dot");return generate(e)}function generateValue(e){assertType(e.type,"value");var t=e.kind,r=e.codePoint;if(typeof r!="number"){throw new Error("Invalid code point: "+r)}switch(t){case"controlLetter":return"\\c"+fromCodePoint(r+64);case"hexadecimalEscape":return"\\x"+("00"+r.toString(16).toUpperCase()).slice(-2);case"identifier":return"\\"+fromCodePoint(r);case"null":return"\\"+r;case"octal":return"\\"+r.toString(8);case"singleEscape":switch(r){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r";default:throw Error("Invalid code point: "+r)}case"symbol":return fromCodePoint(r);case"unicodeEscape":return"\\u"+("0000"+r.toString(16).toUpperCase()).slice(-4);case"unicodeCodePointEscape":return"\\u{"+r.toString(16).toUpperCase()+"}";default:throw Error("Unsupported node kind: "+t)}}var c={alternative:generateAlternative,anchor:generateAnchor,characterClass:generateCharacterClass,characterClassEscape:generateCharacterClassEscape,characterClassRange:generateCharacterClassRange,unicodePropertyEscape:generateUnicodePropertyEscape,disjunction:generateDisjunction,dot:generateDot,group:generateGroup,quantifier:generateQuantifier,reference:generateReference,value:generateValue};var u={generate:generate};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define((function(){return u}));s.regjsgen=u}else if(a&&n){a.generate=generate}else{s.regjsgen=u}}).call(this)},9990:e=>{(function(){var t=String.fromCodePoint||function(){var e=String.fromCharCode;var t=Math.floor;return function fromCodePoint(){var r=16384;var s=[];var a;var n;var o=-1;var i=arguments.length;if(!i){return""}var l="";while(++o1114111||t(c)!=c){throw RangeError("Invalid code point: "+c)}if(c<=65535){s.push(c)}else{c-=65536;a=(c>>10)+55296;n=c%1024+56320;s.push(a,n)}if(o+1==i||s.length>r){l+=e.apply(null,s);s.length=0}}return l}}();function parse(e,r,s){if(!s){s={}}function addRaw(t){t.raw=e.substring(t.range[0],t.range[1]);return t}function updateRawStart(e,t){e.range[0]=t;return addRaw(e)}function createAnchor(e,t){return addRaw({type:"anchor",kind:e,range:[l-t,l]})}function createValue(e,t,r,s){return addRaw({type:"value",kind:e,codePoint:t,range:[r,s]})}function createEscaped(e,t,r,s){s=s||0;return createValue(e,t,l-(r.length+s),l)}function createCharacter(e){var t=e[0];var r=t.charCodeAt(0);if(i){var s;if(t.length===1&&r>=55296&&r<=56319){s=lookahead().charCodeAt(0);if(s>=56320&&s<=57343){l++;return createValue("symbol",(r-55296)*1024+s-56320+65536,l-2,l)}}}return createValue("symbol",r,l-1,l)}function createDisjunction(e,t,r){return addRaw({type:"disjunction",body:e,range:[t,r]})}function createDot(){return addRaw({type:"dot",range:[l-1,l]})}function createCharacterClassEscape(e){return addRaw({type:"characterClassEscape",value:e,range:[l-2,l]})}function createReference(e){return addRaw({type:"reference",matchIndex:parseInt(e,10),range:[l-1-e.length,l]})}function createNamedReference(e){return addRaw({type:"reference",name:e,range:[e.range[0]-3,l]})}function createGroup(e,t,r,s){return addRaw({type:"group",behavior:e,body:t,range:[r,s]})}function createQuantifier(e,t,r,s){if(s==null){r=l-1;s=l}return addRaw({type:"quantifier",min:e,max:t,greedy:true,body:null,range:[r,s]})}function createAlternative(e,t,r){return addRaw({type:"alternative",body:e,range:[t,r]})}function createCharacterClass(e,t,r,s){return addRaw({type:"characterClass",body:e,negative:t,range:[r,s]})}function createClassRange(e,t,r,s){if(e.codePoint>t.codePoint){bail("invalid range in character class",e.raw+"-"+t.raw,r,s)}return addRaw({type:"characterClassRange",min:e,max:t,range:[r,s]})}function flattenBody(e){if(e.type==="alternative"){return e.body}else{return[e]}}function isEmpty(e){return e.type==="empty"}function incr(t){t=t||1;var r=e.substring(l,l+t);l+=t||1;return r}function skip(e){if(!match(e)){bail("character",e)}}function match(t){if(e.indexOf(t,l)===l){return incr(t.length)}}function lookahead(){return e[l]}function current(t){return e.indexOf(t,l)===l}function next(t){return e[l+1]===t}function matchReg(t){var r=e.substring(l);var s=r.match(t);if(s){s.range=[];s.range[0]=l;incr(s[0].length);s.range[1]=l}return s}function parseDisjunction(){var e=[],t=l;e.push(parseAlternative());while(match("|")){e.push(parseAlternative())}if(e.length===1){return e[0]}return createDisjunction(e,t,l)}function parseAlternative(){var e=[],t=l;var r;while(r=parseTerm()){e.push(r)}if(e.length===1){return e[0]}return createAlternative(e,t,l)}function parseTerm(){if(l>=e.length||current("|")||current(")")){return null}var t=parseAnchor();if(t){return t}var r=parseAtomAndExtendedAtom();if(!r){bail("Expected atom")}var s=parseQuantifier()||false;if(s){s.body=flattenBody(r);updateRawStart(s,r.range[0]);return s}return r}function parseGroup(e,t,r,s){var a=null,n=l;if(match(e)){a=t}else if(match(r)){a=s}else{return false}return finishGroup(a,n)}function finishGroup(e,t){var r=parseDisjunction();if(!r){bail("Expected disjunction")}skip(")");var s=createGroup(e,flattenBody(r),t,l);if(e=="normal"){if(o){n++}}return s}function parseAnchor(){var e,t=l;if(match("^")){return createAnchor("start",1)}else if(match("$")){return createAnchor("end",1)}else if(match("\\b")){return createAnchor("boundary",2)}else if(match("\\B")){return createAnchor("not-boundary",2)}else{return parseGroup("(?=","lookahead","(?!","negativeLookahead")}}function parseQuantifier(){var e,t=l;var r;var s,a;if(match("*")){r=createQuantifier(0)}else if(match("+")){r=createQuantifier(1)}else if(match("?")){r=createQuantifier(0,1)}else if(e=matchReg(/^\{([0-9]+)\}/)){s=parseInt(e[1],10);r=createQuantifier(s,s,e.range[0],e.range[1])}else if(e=matchReg(/^\{([0-9]+),\}/)){s=parseInt(e[1],10);r=createQuantifier(s,undefined,e.range[0],e.range[1])}else if(e=matchReg(/^\{([0-9]+),([0-9]+)\}/)){s=parseInt(e[1],10);a=parseInt(e[2],10);if(s>a){bail("numbers out of order in {} quantifier","",t,l)}r=createQuantifier(s,a,e.range[0],e.range[1])}if(r){if(match("?")){r.greedy=false;r.range[1]+=1}}return r}function parseAtomAndExtendedAtom(){var e;if(e=matchReg(/^[^^$\\.*+?()[\]{}|]/)){return createCharacter(e)}else if(!i&&(e=matchReg(/^(?:]|})/))){return createCharacter(e)}else if(match(".")){return createDot()}else if(match("\\")){e=parseAtomEscape();if(!e){if(!i&&lookahead()=="c"){return createValue("symbol",92,l-1,l)}bail("atomEscape")}return e}else if(e=parseCharacterClass()){return e}else if(s.lookbehind&&(e=parseGroup("(?<=","lookbehind","(?");var r=finishGroup("normal",t.range[0]-3);r.name=t;return r}else{return parseGroup("(?:","ignore","(","normal")}}function parseUnicodeSurrogatePairEscape(e){if(i){var t,r;if(e.kind=="unicodeEscape"&&(t=e.codePoint)>=55296&&t<=56319&¤t("\\")&&next("u")){var s=l;l++;var a=parseClassEscape();if(a.kind=="unicodeEscape"&&(r=a.codePoint)>=56320&&r<=57343){e.range[1]=a.range[1];e.codePoint=(t-55296)*1024+r-56320+65536;e.type="value";e.kind="unicodeCodePointEscape";addRaw(e)}else{l=s}}}return e}function parseClassEscape(){return parseAtomEscape(true)}function parseAtomEscape(e){var t,r=l;t=parseDecimalEscape()||parseNamedReference();if(t){return t}if(e){if(match("b")){return createEscaped("singleEscape",8,"\\b")}else if(match("B")){bail("\\B not possible inside of CharacterClass","",r)}else if(!i&&(t=matchReg(/^c([0-9])/))){return createEscaped("controlLetter",t[1]+16,t[1],2)}if(match("-")&&i){return createEscaped("singleEscape",45,"\\-")}}t=parseCharacterEscape();return t}function parseDecimalEscape(){var e,t;if(e=matchReg(/^(?!0)\d+/)){t=e[0];var r=parseInt(e[0],10);if(r<=n){return createReference(e[0])}else{a.push(r);incr(-e[0].length);if(e=matchReg(/^[0-7]{1,3}/)){return createEscaped("octal",parseInt(e[0],8),e[0],1)}else{e=createCharacter(matchReg(/^[89]/));return updateRawStart(e,e.range[0]-1)}}}else if(e=matchReg(/^[0-7]{1,3}/)){t=e[0];if(/^0{1,3}$/.test(t)){return createEscaped("null",0,"0",t.length+1)}else{return createEscaped("octal",parseInt(t,8),t,1)}}else if(e=matchReg(/^[dDsSwW]/)){return createCharacterClassEscape(e[0])}return false}function parseNamedReference(){if(s.namedGroups&&matchReg(/^k<(?=.*?>)/)){var e=parseIdentifier();skip(">");return createNamedReference(e)}}function parseRegExpUnicodeEscapeSequence(){var e;if(e=matchReg(/^u([0-9a-fA-F]{4})/)){return parseUnicodeSurrogatePairEscape(createEscaped("unicodeEscape",parseInt(e[1],16),e[1],2))}else if(i&&(e=matchReg(/^u\{([0-9a-fA-F]+)\}/))){return createEscaped("unicodeCodePointEscape",parseInt(e[1],16),e[1],4)}}function parseCharacterEscape(){var e;var t=l;if(e=matchReg(/^[fnrtv]/)){var r=0;switch(e[0]){case"t":r=9;break;case"n":r=10;break;case"v":r=11;break;case"f":r=12;break;case"r":r=13;break}return createEscaped("singleEscape",r,"\\"+e[0])}else if(e=matchReg(/^c([a-zA-Z])/)){return createEscaped("controlLetter",e[1].charCodeAt(0)%32,e[1],2)}else if(e=matchReg(/^x([0-9a-fA-F]{2})/)){return createEscaped("hexadecimalEscape",parseInt(e[1],16),e[1],2)}else if(e=parseRegExpUnicodeEscapeSequence()){if(!e||e.codePoint>1114111){bail("Invalid escape sequence",null,t,l)}return e}else if(s.unicodePropertyEscape&&i&&(e=matchReg(/^([pP])\{([^\}]+)\}/))){return addRaw({type:"unicodePropertyEscape",negative:e[1]==="P",value:e[2],range:[e.range[0]-1,e.range[1]],raw:e[0]})}else{return parseIdentityEscape()}}function parseIdentifierAtom(r){var s=lookahead();var a=l;if(s==="\\"){incr();var n=parseRegExpUnicodeEscapeSequence();if(!n||!r(n.codePoint)){bail("Invalid escape sequence",null,a,l)}return t(n.codePoint)}var o=s.charCodeAt(0);if(o>=55296&&o<=56319){s+=e[l+1];var i=s.charCodeAt(1);if(i>=56320&&i<=57343){o=(o-55296)*1024+i-56320+65536}}if(!r(o))return;incr();if(o>65535)incr();return s}function parseIdentifier(){var e=l;var t=parseIdentifierAtom(isIdentifierStart);if(!t){bail("Invalid identifier")}var r;while(r=parseIdentifierAtom(isIdentifierPart)){t+=r}return addRaw({type:"identifier",value:t,range:[e,l]})}function isIdentifierStart(e){var r=/[\$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFF1]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=128&&r.test(t(e))}function isIdentifierPart(e){var r=/[0-9_\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDD30-\uDD39\uDF46-\uDF50]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC66-\uDC6F\uDC7F-\uDC82\uDCB0-\uDCBA\uDCF0-\uDCF9\uDD00-\uDD02\uDD27-\uDD34\uDD36-\uDD3F\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDD0-\uDDD9\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC50-\uDC59\uDC5E\uDCB0-\uDCC3\uDCD0-\uDCD9\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDE50-\uDE59\uDEAB-\uDEB7\uDEC0-\uDEC9\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC2C-\uDC3A\uDCE0-\uDCE9\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC50-\uDC59\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD50-\uDD59\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDDA0-\uDDA9\uDEF3-\uDEF6]|\uD81A[\uDE60-\uDE69\uDEF0-\uDEF4\uDF30-\uDF36\uDF50-\uDF59]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A\uDD50-\uDD59]|\uDB40[\uDD00-\uDDEF]/;return isIdentifierStart(e)||e>=48&&e<=57||e>=128&&r.test(t(e))}function parseIdentityEscape(){var e;var t=lookahead();if(i&&/[\^\$\.\*\+\?\(\)\\\[\]\{\}\|\/]/.test(t)||!i&&t!=="c"){if(t==="k"&&s.lookbehind){return null}e=incr();return createEscaped("identifier",e.charCodeAt(0),e,1)}return null}function parseCharacterClass(){var e,t=l;if(e=matchReg(/^\[\^/)){e=parseClassRanges();skip("]");return createCharacterClass(e,true,t,l)}else if(match("[")){e=parseClassRanges();skip("]");return createCharacterClass(e,false,t,l)}return null}function parseClassRanges(){var e;if(current("]")){return[]}else{e=parseNonemptyClassRanges();if(!e){bail("nonEmptyClassRanges")}return e}}function parseHelperClassRanges(e){var t,r,s;if(current("-")&&!next("]")){skip("-");s=parseClassAtom();if(!s){bail("classAtom")}r=l;var a=parseClassRanges();if(!a){bail("classRanges")}t=e.range[0];if(a.type==="empty"){return[createClassRange(e,s,t,r)]}return[createClassRange(e,s,t,r)].concat(a)}s=parseNonemptyClassRangesNoDash();if(!s){bail("nonEmptyClassRangesNoDash")}return[e].concat(s)}function parseNonemptyClassRanges(){var e=parseClassAtom();if(!e){bail("classAtom")}if(current("]")){return[e]}return parseHelperClassRanges(e)}function parseNonemptyClassRangesNoDash(){var e=parseClassAtom();if(!e){bail("classAtom")}if(current("]")){return e}return parseHelperClassRanges(e)}function parseClassAtom(){if(match("-")){return createCharacter("-")}else{return parseClassAtomNoDash()}}function parseClassAtomNoDash(){var e;if(e=matchReg(/^[^\\\]-]/)){return createCharacter(e[0])}else if(match("\\")){e=parseClassEscape();if(!e){bail("classEscape")}return parseUnicodeSurrogatePairEscape(e)}}function bail(t,r,s,a){s=s==null?l:s;a=a==null?s:a;var n=Math.max(0,s-10);var o=Math.min(a+10,e.length);var i=" "+e.substring(n,o);var c=" "+new Array(s-n+1).join(" ")+"^";throw SyntaxError(t+" at position "+s+(r?": "+r:"")+"\n"+i+"\n"+c)}var a=[];var n=0;var o=true;var i=(r||"").indexOf("u")!==-1;var l=0;e=String(e);if(e===""){e="(?:)"}var c=parseDisjunction();if(c.range[1]!==e.length){bail("Could not parse entire input - got stuck","",c.range[1])}for(var u=0;u{var t=e.exports=function(e){return new Traverse(e)};function Traverse(e){this.value=e}Traverse.prototype.get=function(e){var t=this.value;for(var r=0;r{e.exports=new Set(["General_Category","Script","Script_Extensions","Alphabetic","Any","ASCII","ASCII_Hex_Digit","Assigned","Bidi_Control","Bidi_Mirrored","Case_Ignorable","Cased","Changes_When_Casefolded","Changes_When_Casemapped","Changes_When_Lowercased","Changes_When_NFKC_Casefolded","Changes_When_Titlecased","Changes_When_Uppercased","Dash","Default_Ignorable_Code_Point","Deprecated","Diacritic","Emoji","Emoji_Component","Emoji_Modifier","Emoji_Modifier_Base","Emoji_Presentation","Extended_Pictographic","Extender","Grapheme_Base","Grapheme_Extend","Hex_Digit","ID_Continue","ID_Start","Ideographic","IDS_Binary_Operator","IDS_Trinary_Operator","Join_Control","Logical_Order_Exception","Lowercase","Math","Noncharacter_Code_Point","Pattern_Syntax","Pattern_White_Space","Quotation_Mark","Radical","Regional_Indicator","Sentence_Terminal","Soft_Dotted","Terminal_Punctuation","Unified_Ideograph","Uppercase","Variation_Selector","White_Space","XID_Continue","XID_Start"])},3042:(e,t,r)=>{"use strict";const s=r(7894);const a=r(864);const matchProperty=function(e){if(s.has(e)){return e}if(a.has(e)){return a.get(e)}throw new Error(`Unknown property: ${e}`)};e.exports=matchProperty},4703:e=>{e.exports=new Map([["General_Category",new Map([["C","Other"],["Cc","Control"],["cntrl","Control"],["Cf","Format"],["Cn","Unassigned"],["Co","Private_Use"],["Cs","Surrogate"],["L","Letter"],["LC","Cased_Letter"],["Ll","Lowercase_Letter"],["Lm","Modifier_Letter"],["Lo","Other_Letter"],["Lt","Titlecase_Letter"],["Lu","Uppercase_Letter"],["M","Mark"],["Combining_Mark","Mark"],["Mc","Spacing_Mark"],["Me","Enclosing_Mark"],["Mn","Nonspacing_Mark"],["N","Number"],["Nd","Decimal_Number"],["digit","Decimal_Number"],["Nl","Letter_Number"],["No","Other_Number"],["P","Punctuation"],["punct","Punctuation"],["Pc","Connector_Punctuation"],["Pd","Dash_Punctuation"],["Pe","Close_Punctuation"],["Pf","Final_Punctuation"],["Pi","Initial_Punctuation"],["Po","Other_Punctuation"],["Ps","Open_Punctuation"],["S","Symbol"],["Sc","Currency_Symbol"],["Sk","Modifier_Symbol"],["Sm","Math_Symbol"],["So","Other_Symbol"],["Z","Separator"],["Zl","Line_Separator"],["Zp","Paragraph_Separator"],["Zs","Space_Separator"],["Other","Other"],["Control","Control"],["Format","Format"],["Unassigned","Unassigned"],["Private_Use","Private_Use"],["Surrogate","Surrogate"],["Letter","Letter"],["Cased_Letter","Cased_Letter"],["Lowercase_Letter","Lowercase_Letter"],["Modifier_Letter","Modifier_Letter"],["Other_Letter","Other_Letter"],["Titlecase_Letter","Titlecase_Letter"],["Uppercase_Letter","Uppercase_Letter"],["Mark","Mark"],["Spacing_Mark","Spacing_Mark"],["Enclosing_Mark","Enclosing_Mark"],["Nonspacing_Mark","Nonspacing_Mark"],["Number","Number"],["Decimal_Number","Decimal_Number"],["Letter_Number","Letter_Number"],["Other_Number","Other_Number"],["Punctuation","Punctuation"],["Connector_Punctuation","Connector_Punctuation"],["Dash_Punctuation","Dash_Punctuation"],["Close_Punctuation","Close_Punctuation"],["Final_Punctuation","Final_Punctuation"],["Initial_Punctuation","Initial_Punctuation"],["Other_Punctuation","Other_Punctuation"],["Open_Punctuation","Open_Punctuation"],["Symbol","Symbol"],["Currency_Symbol","Currency_Symbol"],["Modifier_Symbol","Modifier_Symbol"],["Math_Symbol","Math_Symbol"],["Other_Symbol","Other_Symbol"],["Separator","Separator"],["Line_Separator","Line_Separator"],["Paragraph_Separator","Paragraph_Separator"],["Space_Separator","Space_Separator"]])],["Script",new Map([["Adlm","Adlam"],["Aghb","Caucasian_Albanian"],["Ahom","Ahom"],["Arab","Arabic"],["Armi","Imperial_Aramaic"],["Armn","Armenian"],["Avst","Avestan"],["Bali","Balinese"],["Bamu","Bamum"],["Bass","Bassa_Vah"],["Batk","Batak"],["Beng","Bengali"],["Bhks","Bhaiksuki"],["Bopo","Bopomofo"],["Brah","Brahmi"],["Brai","Braille"],["Bugi","Buginese"],["Buhd","Buhid"],["Cakm","Chakma"],["Cans","Canadian_Aboriginal"],["Cari","Carian"],["Cham","Cham"],["Cher","Cherokee"],["Chrs","Chorasmian"],["Copt","Coptic"],["Qaac","Coptic"],["Cprt","Cypriot"],["Cyrl","Cyrillic"],["Deva","Devanagari"],["Diak","Dives_Akuru"],["Dogr","Dogra"],["Dsrt","Deseret"],["Dupl","Duployan"],["Egyp","Egyptian_Hieroglyphs"],["Elba","Elbasan"],["Elym","Elymaic"],["Ethi","Ethiopic"],["Geor","Georgian"],["Glag","Glagolitic"],["Gong","Gunjala_Gondi"],["Gonm","Masaram_Gondi"],["Goth","Gothic"],["Gran","Grantha"],["Grek","Greek"],["Gujr","Gujarati"],["Guru","Gurmukhi"],["Hang","Hangul"],["Hani","Han"],["Hano","Hanunoo"],["Hatr","Hatran"],["Hebr","Hebrew"],["Hira","Hiragana"],["Hluw","Anatolian_Hieroglyphs"],["Hmng","Pahawh_Hmong"],["Hmnp","Nyiakeng_Puachue_Hmong"],["Hrkt","Katakana_Or_Hiragana"],["Hung","Old_Hungarian"],["Ital","Old_Italic"],["Java","Javanese"],["Kali","Kayah_Li"],["Kana","Katakana"],["Khar","Kharoshthi"],["Khmr","Khmer"],["Khoj","Khojki"],["Kits","Khitan_Small_Script"],["Knda","Kannada"],["Kthi","Kaithi"],["Lana","Tai_Tham"],["Laoo","Lao"],["Latn","Latin"],["Lepc","Lepcha"],["Limb","Limbu"],["Lina","Linear_A"],["Linb","Linear_B"],["Lisu","Lisu"],["Lyci","Lycian"],["Lydi","Lydian"],["Mahj","Mahajani"],["Maka","Makasar"],["Mand","Mandaic"],["Mani","Manichaean"],["Marc","Marchen"],["Medf","Medefaidrin"],["Mend","Mende_Kikakui"],["Merc","Meroitic_Cursive"],["Mero","Meroitic_Hieroglyphs"],["Mlym","Malayalam"],["Modi","Modi"],["Mong","Mongolian"],["Mroo","Mro"],["Mtei","Meetei_Mayek"],["Mult","Multani"],["Mymr","Myanmar"],["Nand","Nandinagari"],["Narb","Old_North_Arabian"],["Nbat","Nabataean"],["Newa","Newa"],["Nkoo","Nko"],["Nshu","Nushu"],["Ogam","Ogham"],["Olck","Ol_Chiki"],["Orkh","Old_Turkic"],["Orya","Oriya"],["Osge","Osage"],["Osma","Osmanya"],["Palm","Palmyrene"],["Pauc","Pau_Cin_Hau"],["Perm","Old_Permic"],["Phag","Phags_Pa"],["Phli","Inscriptional_Pahlavi"],["Phlp","Psalter_Pahlavi"],["Phnx","Phoenician"],["Plrd","Miao"],["Prti","Inscriptional_Parthian"],["Rjng","Rejang"],["Rohg","Hanifi_Rohingya"],["Runr","Runic"],["Samr","Samaritan"],["Sarb","Old_South_Arabian"],["Saur","Saurashtra"],["Sgnw","SignWriting"],["Shaw","Shavian"],["Shrd","Sharada"],["Sidd","Siddham"],["Sind","Khudawadi"],["Sinh","Sinhala"],["Sogd","Sogdian"],["Sogo","Old_Sogdian"],["Sora","Sora_Sompeng"],["Soyo","Soyombo"],["Sund","Sundanese"],["Sylo","Syloti_Nagri"],["Syrc","Syriac"],["Tagb","Tagbanwa"],["Takr","Takri"],["Tale","Tai_Le"],["Talu","New_Tai_Lue"],["Taml","Tamil"],["Tang","Tangut"],["Tavt","Tai_Viet"],["Telu","Telugu"],["Tfng","Tifinagh"],["Tglg","Tagalog"],["Thaa","Thaana"],["Thai","Thai"],["Tibt","Tibetan"],["Tirh","Tirhuta"],["Ugar","Ugaritic"],["Vaii","Vai"],["Wara","Warang_Citi"],["Wcho","Wancho"],["Xpeo","Old_Persian"],["Xsux","Cuneiform"],["Yezi","Yezidi"],["Yiii","Yi"],["Zanb","Zanabazar_Square"],["Zinh","Inherited"],["Qaai","Inherited"],["Zyyy","Common"],["Zzzz","Unknown"],["Adlam","Adlam"],["Caucasian_Albanian","Caucasian_Albanian"],["Arabic","Arabic"],["Imperial_Aramaic","Imperial_Aramaic"],["Armenian","Armenian"],["Avestan","Avestan"],["Balinese","Balinese"],["Bamum","Bamum"],["Bassa_Vah","Bassa_Vah"],["Batak","Batak"],["Bengali","Bengali"],["Bhaiksuki","Bhaiksuki"],["Bopomofo","Bopomofo"],["Brahmi","Brahmi"],["Braille","Braille"],["Buginese","Buginese"],["Buhid","Buhid"],["Chakma","Chakma"],["Canadian_Aboriginal","Canadian_Aboriginal"],["Carian","Carian"],["Cherokee","Cherokee"],["Chorasmian","Chorasmian"],["Coptic","Coptic"],["Cypriot","Cypriot"],["Cyrillic","Cyrillic"],["Devanagari","Devanagari"],["Dives_Akuru","Dives_Akuru"],["Dogra","Dogra"],["Deseret","Deseret"],["Duployan","Duployan"],["Egyptian_Hieroglyphs","Egyptian_Hieroglyphs"],["Elbasan","Elbasan"],["Elymaic","Elymaic"],["Ethiopic","Ethiopic"],["Georgian","Georgian"],["Glagolitic","Glagolitic"],["Gunjala_Gondi","Gunjala_Gondi"],["Masaram_Gondi","Masaram_Gondi"],["Gothic","Gothic"],["Grantha","Grantha"],["Greek","Greek"],["Gujarati","Gujarati"],["Gurmukhi","Gurmukhi"],["Hangul","Hangul"],["Han","Han"],["Hanunoo","Hanunoo"],["Hatran","Hatran"],["Hebrew","Hebrew"],["Hiragana","Hiragana"],["Anatolian_Hieroglyphs","Anatolian_Hieroglyphs"],["Pahawh_Hmong","Pahawh_Hmong"],["Nyiakeng_Puachue_Hmong","Nyiakeng_Puachue_Hmong"],["Katakana_Or_Hiragana","Katakana_Or_Hiragana"],["Old_Hungarian","Old_Hungarian"],["Old_Italic","Old_Italic"],["Javanese","Javanese"],["Kayah_Li","Kayah_Li"],["Katakana","Katakana"],["Kharoshthi","Kharoshthi"],["Khmer","Khmer"],["Khojki","Khojki"],["Khitan_Small_Script","Khitan_Small_Script"],["Kannada","Kannada"],["Kaithi","Kaithi"],["Tai_Tham","Tai_Tham"],["Lao","Lao"],["Latin","Latin"],["Lepcha","Lepcha"],["Limbu","Limbu"],["Linear_A","Linear_A"],["Linear_B","Linear_B"],["Lycian","Lycian"],["Lydian","Lydian"],["Mahajani","Mahajani"],["Makasar","Makasar"],["Mandaic","Mandaic"],["Manichaean","Manichaean"],["Marchen","Marchen"],["Medefaidrin","Medefaidrin"],["Mende_Kikakui","Mende_Kikakui"],["Meroitic_Cursive","Meroitic_Cursive"],["Meroitic_Hieroglyphs","Meroitic_Hieroglyphs"],["Malayalam","Malayalam"],["Mongolian","Mongolian"],["Mro","Mro"],["Meetei_Mayek","Meetei_Mayek"],["Multani","Multani"],["Myanmar","Myanmar"],["Nandinagari","Nandinagari"],["Old_North_Arabian","Old_North_Arabian"],["Nabataean","Nabataean"],["Nko","Nko"],["Nushu","Nushu"],["Ogham","Ogham"],["Ol_Chiki","Ol_Chiki"],["Old_Turkic","Old_Turkic"],["Oriya","Oriya"],["Osage","Osage"],["Osmanya","Osmanya"],["Palmyrene","Palmyrene"],["Pau_Cin_Hau","Pau_Cin_Hau"],["Old_Permic","Old_Permic"],["Phags_Pa","Phags_Pa"],["Inscriptional_Pahlavi","Inscriptional_Pahlavi"],["Psalter_Pahlavi","Psalter_Pahlavi"],["Phoenician","Phoenician"],["Miao","Miao"],["Inscriptional_Parthian","Inscriptional_Parthian"],["Rejang","Rejang"],["Hanifi_Rohingya","Hanifi_Rohingya"],["Runic","Runic"],["Samaritan","Samaritan"],["Old_South_Arabian","Old_South_Arabian"],["Saurashtra","Saurashtra"],["SignWriting","SignWriting"],["Shavian","Shavian"],["Sharada","Sharada"],["Siddham","Siddham"],["Khudawadi","Khudawadi"],["Sinhala","Sinhala"],["Sogdian","Sogdian"],["Old_Sogdian","Old_Sogdian"],["Sora_Sompeng","Sora_Sompeng"],["Soyombo","Soyombo"],["Sundanese","Sundanese"],["Syloti_Nagri","Syloti_Nagri"],["Syriac","Syriac"],["Tagbanwa","Tagbanwa"],["Takri","Takri"],["Tai_Le","Tai_Le"],["New_Tai_Lue","New_Tai_Lue"],["Tamil","Tamil"],["Tangut","Tangut"],["Tai_Viet","Tai_Viet"],["Telugu","Telugu"],["Tifinagh","Tifinagh"],["Tagalog","Tagalog"],["Thaana","Thaana"],["Tibetan","Tibetan"],["Tirhuta","Tirhuta"],["Ugaritic","Ugaritic"],["Vai","Vai"],["Warang_Citi","Warang_Citi"],["Wancho","Wancho"],["Old_Persian","Old_Persian"],["Cuneiform","Cuneiform"],["Yezidi","Yezidi"],["Yi","Yi"],["Zanabazar_Square","Zanabazar_Square"],["Inherited","Inherited"],["Common","Common"],["Unknown","Unknown"]])],["Script_Extensions",new Map([["Adlm","Adlam"],["Aghb","Caucasian_Albanian"],["Ahom","Ahom"],["Arab","Arabic"],["Armi","Imperial_Aramaic"],["Armn","Armenian"],["Avst","Avestan"],["Bali","Balinese"],["Bamu","Bamum"],["Bass","Bassa_Vah"],["Batk","Batak"],["Beng","Bengali"],["Bhks","Bhaiksuki"],["Bopo","Bopomofo"],["Brah","Brahmi"],["Brai","Braille"],["Bugi","Buginese"],["Buhd","Buhid"],["Cakm","Chakma"],["Cans","Canadian_Aboriginal"],["Cari","Carian"],["Cham","Cham"],["Cher","Cherokee"],["Chrs","Chorasmian"],["Copt","Coptic"],["Qaac","Coptic"],["Cprt","Cypriot"],["Cyrl","Cyrillic"],["Deva","Devanagari"],["Diak","Dives_Akuru"],["Dogr","Dogra"],["Dsrt","Deseret"],["Dupl","Duployan"],["Egyp","Egyptian_Hieroglyphs"],["Elba","Elbasan"],["Elym","Elymaic"],["Ethi","Ethiopic"],["Geor","Georgian"],["Glag","Glagolitic"],["Gong","Gunjala_Gondi"],["Gonm","Masaram_Gondi"],["Goth","Gothic"],["Gran","Grantha"],["Grek","Greek"],["Gujr","Gujarati"],["Guru","Gurmukhi"],["Hang","Hangul"],["Hani","Han"],["Hano","Hanunoo"],["Hatr","Hatran"],["Hebr","Hebrew"],["Hira","Hiragana"],["Hluw","Anatolian_Hieroglyphs"],["Hmng","Pahawh_Hmong"],["Hmnp","Nyiakeng_Puachue_Hmong"],["Hrkt","Katakana_Or_Hiragana"],["Hung","Old_Hungarian"],["Ital","Old_Italic"],["Java","Javanese"],["Kali","Kayah_Li"],["Kana","Katakana"],["Khar","Kharoshthi"],["Khmr","Khmer"],["Khoj","Khojki"],["Kits","Khitan_Small_Script"],["Knda","Kannada"],["Kthi","Kaithi"],["Lana","Tai_Tham"],["Laoo","Lao"],["Latn","Latin"],["Lepc","Lepcha"],["Limb","Limbu"],["Lina","Linear_A"],["Linb","Linear_B"],["Lisu","Lisu"],["Lyci","Lycian"],["Lydi","Lydian"],["Mahj","Mahajani"],["Maka","Makasar"],["Mand","Mandaic"],["Mani","Manichaean"],["Marc","Marchen"],["Medf","Medefaidrin"],["Mend","Mende_Kikakui"],["Merc","Meroitic_Cursive"],["Mero","Meroitic_Hieroglyphs"],["Mlym","Malayalam"],["Modi","Modi"],["Mong","Mongolian"],["Mroo","Mro"],["Mtei","Meetei_Mayek"],["Mult","Multani"],["Mymr","Myanmar"],["Nand","Nandinagari"],["Narb","Old_North_Arabian"],["Nbat","Nabataean"],["Newa","Newa"],["Nkoo","Nko"],["Nshu","Nushu"],["Ogam","Ogham"],["Olck","Ol_Chiki"],["Orkh","Old_Turkic"],["Orya","Oriya"],["Osge","Osage"],["Osma","Osmanya"],["Palm","Palmyrene"],["Pauc","Pau_Cin_Hau"],["Perm","Old_Permic"],["Phag","Phags_Pa"],["Phli","Inscriptional_Pahlavi"],["Phlp","Psalter_Pahlavi"],["Phnx","Phoenician"],["Plrd","Miao"],["Prti","Inscriptional_Parthian"],["Rjng","Rejang"],["Rohg","Hanifi_Rohingya"],["Runr","Runic"],["Samr","Samaritan"],["Sarb","Old_South_Arabian"],["Saur","Saurashtra"],["Sgnw","SignWriting"],["Shaw","Shavian"],["Shrd","Sharada"],["Sidd","Siddham"],["Sind","Khudawadi"],["Sinh","Sinhala"],["Sogd","Sogdian"],["Sogo","Old_Sogdian"],["Sora","Sora_Sompeng"],["Soyo","Soyombo"],["Sund","Sundanese"],["Sylo","Syloti_Nagri"],["Syrc","Syriac"],["Tagb","Tagbanwa"],["Takr","Takri"],["Tale","Tai_Le"],["Talu","New_Tai_Lue"],["Taml","Tamil"],["Tang","Tangut"],["Tavt","Tai_Viet"],["Telu","Telugu"],["Tfng","Tifinagh"],["Tglg","Tagalog"],["Thaa","Thaana"],["Thai","Thai"],["Tibt","Tibetan"],["Tirh","Tirhuta"],["Ugar","Ugaritic"],["Vaii","Vai"],["Wara","Warang_Citi"],["Wcho","Wancho"],["Xpeo","Old_Persian"],["Xsux","Cuneiform"],["Yezi","Yezidi"],["Yiii","Yi"],["Zanb","Zanabazar_Square"],["Zinh","Inherited"],["Qaai","Inherited"],["Zyyy","Common"],["Zzzz","Unknown"],["Adlam","Adlam"],["Caucasian_Albanian","Caucasian_Albanian"],["Arabic","Arabic"],["Imperial_Aramaic","Imperial_Aramaic"],["Armenian","Armenian"],["Avestan","Avestan"],["Balinese","Balinese"],["Bamum","Bamum"],["Bassa_Vah","Bassa_Vah"],["Batak","Batak"],["Bengali","Bengali"],["Bhaiksuki","Bhaiksuki"],["Bopomofo","Bopomofo"],["Brahmi","Brahmi"],["Braille","Braille"],["Buginese","Buginese"],["Buhid","Buhid"],["Chakma","Chakma"],["Canadian_Aboriginal","Canadian_Aboriginal"],["Carian","Carian"],["Cherokee","Cherokee"],["Chorasmian","Chorasmian"],["Coptic","Coptic"],["Cypriot","Cypriot"],["Cyrillic","Cyrillic"],["Devanagari","Devanagari"],["Dives_Akuru","Dives_Akuru"],["Dogra","Dogra"],["Deseret","Deseret"],["Duployan","Duployan"],["Egyptian_Hieroglyphs","Egyptian_Hieroglyphs"],["Elbasan","Elbasan"],["Elymaic","Elymaic"],["Ethiopic","Ethiopic"],["Georgian","Georgian"],["Glagolitic","Glagolitic"],["Gunjala_Gondi","Gunjala_Gondi"],["Masaram_Gondi","Masaram_Gondi"],["Gothic","Gothic"],["Grantha","Grantha"],["Greek","Greek"],["Gujarati","Gujarati"],["Gurmukhi","Gurmukhi"],["Hangul","Hangul"],["Han","Han"],["Hanunoo","Hanunoo"],["Hatran","Hatran"],["Hebrew","Hebrew"],["Hiragana","Hiragana"],["Anatolian_Hieroglyphs","Anatolian_Hieroglyphs"],["Pahawh_Hmong","Pahawh_Hmong"],["Nyiakeng_Puachue_Hmong","Nyiakeng_Puachue_Hmong"],["Katakana_Or_Hiragana","Katakana_Or_Hiragana"],["Old_Hungarian","Old_Hungarian"],["Old_Italic","Old_Italic"],["Javanese","Javanese"],["Kayah_Li","Kayah_Li"],["Katakana","Katakana"],["Kharoshthi","Kharoshthi"],["Khmer","Khmer"],["Khojki","Khojki"],["Khitan_Small_Script","Khitan_Small_Script"],["Kannada","Kannada"],["Kaithi","Kaithi"],["Tai_Tham","Tai_Tham"],["Lao","Lao"],["Latin","Latin"],["Lepcha","Lepcha"],["Limbu","Limbu"],["Linear_A","Linear_A"],["Linear_B","Linear_B"],["Lycian","Lycian"],["Lydian","Lydian"],["Mahajani","Mahajani"],["Makasar","Makasar"],["Mandaic","Mandaic"],["Manichaean","Manichaean"],["Marchen","Marchen"],["Medefaidrin","Medefaidrin"],["Mende_Kikakui","Mende_Kikakui"],["Meroitic_Cursive","Meroitic_Cursive"],["Meroitic_Hieroglyphs","Meroitic_Hieroglyphs"],["Malayalam","Malayalam"],["Mongolian","Mongolian"],["Mro","Mro"],["Meetei_Mayek","Meetei_Mayek"],["Multani","Multani"],["Myanmar","Myanmar"],["Nandinagari","Nandinagari"],["Old_North_Arabian","Old_North_Arabian"],["Nabataean","Nabataean"],["Nko","Nko"],["Nushu","Nushu"],["Ogham","Ogham"],["Ol_Chiki","Ol_Chiki"],["Old_Turkic","Old_Turkic"],["Oriya","Oriya"],["Osage","Osage"],["Osmanya","Osmanya"],["Palmyrene","Palmyrene"],["Pau_Cin_Hau","Pau_Cin_Hau"],["Old_Permic","Old_Permic"],["Phags_Pa","Phags_Pa"],["Inscriptional_Pahlavi","Inscriptional_Pahlavi"],["Psalter_Pahlavi","Psalter_Pahlavi"],["Phoenician","Phoenician"],["Miao","Miao"],["Inscriptional_Parthian","Inscriptional_Parthian"],["Rejang","Rejang"],["Hanifi_Rohingya","Hanifi_Rohingya"],["Runic","Runic"],["Samaritan","Samaritan"],["Old_South_Arabian","Old_South_Arabian"],["Saurashtra","Saurashtra"],["SignWriting","SignWriting"],["Shavian","Shavian"],["Sharada","Sharada"],["Siddham","Siddham"],["Khudawadi","Khudawadi"],["Sinhala","Sinhala"],["Sogdian","Sogdian"],["Old_Sogdian","Old_Sogdian"],["Sora_Sompeng","Sora_Sompeng"],["Soyombo","Soyombo"],["Sundanese","Sundanese"],["Syloti_Nagri","Syloti_Nagri"],["Syriac","Syriac"],["Tagbanwa","Tagbanwa"],["Takri","Takri"],["Tai_Le","Tai_Le"],["New_Tai_Lue","New_Tai_Lue"],["Tamil","Tamil"],["Tangut","Tangut"],["Tai_Viet","Tai_Viet"],["Telugu","Telugu"],["Tifinagh","Tifinagh"],["Tagalog","Tagalog"],["Thaana","Thaana"],["Tibetan","Tibetan"],["Tirhuta","Tirhuta"],["Ugaritic","Ugaritic"],["Vai","Vai"],["Warang_Citi","Warang_Citi"],["Wancho","Wancho"],["Old_Persian","Old_Persian"],["Cuneiform","Cuneiform"],["Yezidi","Yezidi"],["Yi","Yi"],["Zanabazar_Square","Zanabazar_Square"],["Inherited","Inherited"],["Common","Common"],["Unknown","Unknown"]])]])},1317:(e,t,r)=>{"use strict";const s=r(4703);const matchPropertyValue=function(e,t){const r=s.get(e);if(!r){throw new Error(`Unknown property \`${e}\`.`)}const a=r.get(t);if(a){return a}throw new Error(`Unknown value \`${t}\` for property \`${e}\`.`)};e.exports=matchPropertyValue},864:e=>{e.exports=new Map([["scx","Script_Extensions"],["sc","Script"],["gc","General_Category"],["AHex","ASCII_Hex_Digit"],["Alpha","Alphabetic"],["Bidi_C","Bidi_Control"],["Bidi_M","Bidi_Mirrored"],["Cased","Cased"],["CI","Case_Ignorable"],["CWCF","Changes_When_Casefolded"],["CWCM","Changes_When_Casemapped"],["CWKCF","Changes_When_NFKC_Casefolded"],["CWL","Changes_When_Lowercased"],["CWT","Changes_When_Titlecased"],["CWU","Changes_When_Uppercased"],["Dash","Dash"],["Dep","Deprecated"],["DI","Default_Ignorable_Code_Point"],["Dia","Diacritic"],["Ext","Extender"],["Gr_Base","Grapheme_Base"],["Gr_Ext","Grapheme_Extend"],["Hex","Hex_Digit"],["IDC","ID_Continue"],["Ideo","Ideographic"],["IDS","ID_Start"],["IDSB","IDS_Binary_Operator"],["IDST","IDS_Trinary_Operator"],["Join_C","Join_Control"],["LOE","Logical_Order_Exception"],["Lower","Lowercase"],["Math","Math"],["NChar","Noncharacter_Code_Point"],["Pat_Syn","Pattern_Syntax"],["Pat_WS","Pattern_White_Space"],["QMark","Quotation_Mark"],["Radical","Radical"],["RI","Regional_Indicator"],["SD","Soft_Dotted"],["STerm","Sentence_Terminal"],["Term","Terminal_Punctuation"],["UIdeo","Unified_Ideograph"],["Upper","Uppercase"],["VS","Variation_Selector"],["WSpace","White_Space"],["space","White_Space"],["XIDC","XID_Continue"],["XIDS","XID_Start"]])},3812:(e,t,r)=>{function eslintParser(){return r(8187)}function pluginProposalClassProperties(){return r(8027)}function pluginProposalExportNamespaceFrom(){return r(9579)}function pluginProposalNumericSeparator(){return r(7300)}function pluginProposalObjectRestSpread(){return r(6309)}function pluginSyntaxBigint(){return r(6762)}function pluginSyntaxDynamicImport(){return r(5163)}function pluginSyntaxImportAssertions(){return r(8356)}function pluginSyntaxJsx(){return r(8926)}function pluginTransformDefine(){return r(9065)}function pluginTransformModulesCommonjs(){return r(6186)}function pluginTransformReactRemovePropTypes(){return r(6197)}function pluginTransformRuntime(){return r(4722)}function presetEnv(){return r(9290)}function presetReact(){return r(8277)}function presetTypescript(){return r(1068)}e.exports={eslintParser:eslintParser,pluginProposalClassProperties:pluginProposalClassProperties,pluginProposalExportNamespaceFrom:pluginProposalExportNamespaceFrom,pluginProposalNumericSeparator:pluginProposalNumericSeparator,pluginProposalObjectRestSpread:pluginProposalObjectRestSpread,pluginSyntaxBigint:pluginSyntaxBigint,pluginSyntaxDynamicImport:pluginSyntaxDynamicImport,pluginSyntaxImportAssertions:pluginSyntaxImportAssertions,pluginSyntaxJsx:pluginSyntaxJsx,pluginTransformDefine:pluginTransformDefine,pluginTransformModulesCommonjs:pluginTransformModulesCommonjs,pluginTransformReactRemovePropTypes:pluginTransformReactRemovePropTypes,pluginTransformRuntime:pluginTransformRuntime,presetEnv:presetEnv,presetReact:presetReact,presetTypescript:presetTypescript}},2272:(e,t,r)=>{e.exports=r(4817)},9302:(e,t,r)=>{e.exports=r(8392)},7363:(e,t,r)=>{e.exports=r(5224)},3574:(e,t,r)=>{e.exports=r(4374)},5884:(e,t,r)=>{e.exports=r(7867)},6038:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getInclusionReasons=getInclusionReasons;var s=r(7849);var a=r(1610);var n=r(240);function getInclusionReasons(e,t,r){const o=r[e]||{};return Object.keys(t).reduce(((e,r)=>{const i=(0,n.getLowestImplementedVersion)(o,r);const l=t[r];if(!i){e[r]=(0,a.prettifyVersion)(l)}else{const t=(0,n.isUnreleasedVersion)(i,r);const o=(0,n.isUnreleasedVersion)(l,r);if(!o&&(t||s.lt(l.toString(),(0,n.semverify)(i)))){e[r]=(0,a.prettifyVersion)(l)}}return e}),{})}},4486:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.targetsSupported=targetsSupported;t.isRequired=isRequired;t["default"]=filterItems;var s=r(7849);var a=r(5884);var n=r(240);function targetsSupported(e,t){const r=Object.keys(e);if(r.length===0){return false}const a=r.filter((r=>{const a=(0,n.getLowestImplementedVersion)(t,r);if(!a){return true}const o=e[r];if((0,n.isUnreleasedVersion)(o,r)){return false}if((0,n.isUnreleasedVersion)(a,r)){return true}if(!s.valid(o.toString())){throw new Error(`Invalid version passed for target "${r}": "${o}". `+"Versions must be in semver format (major.minor.patch)")}return s.gt((0,n.semverify)(a),o.toString())}));return a.length===0}function isRequired(e,t,{compatData:r=a,includes:s,excludes:n}={}){if(n!=null&&n.has(e))return false;if(s!=null&&s.has(e))return true;return!targetsSupported(t,r[e])}function filterItems(e,t,r,s,a,n,o){const i=new Set;const l={compatData:e,includes:t,excludes:r};for(const t in e){if(isRequired(t,s,l)){i.add(t)}else if(o){const e=o.get(t);if(e){i.add(e)}}}if(a){a.forEach((e=>!r.has(e)&&i.add(e)))}if(n){n.forEach((e=>!t.has(e)&&i.delete(e)))}return i}},4413:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isBrowsersQueryValid=isBrowsersQueryValid;t["default"]=getTargets;Object.defineProperty(t,"unreleasedLabels",{enumerable:true,get:function(){return i.unreleasedLabels}});Object.defineProperty(t,"TargetNames",{enumerable:true,get:function(){return l.TargetNames}});Object.defineProperty(t,"prettifyTargets",{enumerable:true,get:function(){return c.prettifyTargets}});Object.defineProperty(t,"getInclusionReasons",{enumerable:true,get:function(){return u.getInclusionReasons}});Object.defineProperty(t,"filterItems",{enumerable:true,get:function(){return p.default}});Object.defineProperty(t,"isRequired",{enumerable:true,get:function(){return p.isRequired}});var s=r(4907);var a=r(7347);var n=r(9302);var o=r(240);var i=r(1915);var l=r(1888);var c=r(1610);var u=r(6038);var p=r(4486);const f=n["es6.module"];const d=new a.OptionValidator("@babel/helper-compilation-targets");function validateTargetNames(e){const t=Object.keys(l.TargetNames);for(const r of Object.keys(e)){if(!(r in l.TargetNames)){throw new Error(d.formatMessage(`'${r}' is not a valid target\n- Did you mean '${(0,a.findSuggestion)(r,t)}'?`))}}return e}function isBrowsersQueryValid(e){return typeof e==="string"||Array.isArray(e)&&e.every((e=>typeof e==="string"))}function validateBrowsers(e){d.invariant(e===undefined||isBrowsersQueryValid(e),`'${String(e)}' is not a valid browserslist query`);return e}function getLowestVersions(e){return e.reduce(((e,t)=>{const[r,s]=t.split(" ");const a=i.browserNameMap[r];if(!a){return e}try{const t=s.split("-")[0].toLowerCase();const n=(0,o.isUnreleasedVersion)(t,r);if(!e[a]){e[a]=n?t:(0,o.semverify)(t);return e}const i=e[a];const l=(0,o.isUnreleasedVersion)(i,r);if(l&&n){e[a]=(0,o.getLowestUnreleased)(i,t,r)}else if(l){e[a]=(0,o.semverify)(t)}else if(!l&&!n){const r=(0,o.semverify)(t);e[a]=(0,o.semverMin)(i,r)}}catch(e){}return e}),{})}function outputDecimalWarning(e){if(!e.length){return}console.warn("Warning, the following targets are using a decimal version:\n");e.forEach((({target:e,value:t})=>console.warn(` ${e}: ${t}`)));console.warn(`\nWe recommend using a string for minor/patch versions to avoid numbers like 6.10\ngetting parsed as 6.1, which can lead to unexpected behavior.\n`)}function semverifyTarget(e,t){try{return(0,o.semverify)(t)}catch(r){throw new Error(d.formatMessage(`'${t}' is not a valid value for 'targets.${e}'.`))}}const m={__default(e,t){const r=(0,o.isUnreleasedVersion)(t,e)?t.toLowerCase():semverifyTarget(e,t);return[e,r]},node(e,t){const r=t===true||t==="current"?process.versions.node:semverifyTarget(e,t);return[e,r]}};function generateTargets(e){const t=Object.assign({},e);delete t.esmodules;delete t.browsers;return t}function resolveTargets(e){const t=s(e,{mobileToDesktop:true});return getLowestVersions(t)}function getTargets(e={},t={}){var r;let{browsers:a,esmodules:n}=e;const{configPath:i="."}=t;validateBrowsers(a);const l=generateTargets(e);let c=validateTargetNames(l);const u=!!a;const p=u||Object.keys(c).length>0;const d=!t.ignoreBrowserslistConfig&&!p;if(!a&&d){a=s.loadConfig({config:t.configFile,path:i,env:t.browserslistEnv});if(a==null){{a=[]}}}if(n&&(n!=="intersect"||!((r=a)!=null&&r.length))){a=Object.keys(f).map((e=>`${e} >= ${f[e]}`)).join(", ");n=false}if(a){const e=resolveTargets(a);if(n==="intersect"){for(const t of Object.keys(e)){const r=e[t];if(f[t]){e[t]=(0,o.getHighestUnreleased)(r,(0,o.semverify)(f[t]),t)}else{delete e[t]}}}c=Object.assign(e,c)}const y={};const g=[];for(const e of Object.keys(c).sort()){var h;const t=c[e];if(typeof t==="number"&&t%1!==0){g.push({target:e,value:t})}const r=(h=m[e])!=null?h:m.__default;const[s,a]=r(e,t);if(a){y[s]=a}}outputDecimalWarning(g);return y}},1888:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.TargetNames=void 0;const r={node:"node",chrome:"chrome",opera:"opera",edge:"edge",firefox:"firefox",safari:"safari",ie:"ie",ios:"ios",android:"android",electron:"electron",samsung:"samsung",rhino:"rhino"};t.TargetNames=r},1610:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.prettifyVersion=prettifyVersion;t.prettifyTargets=prettifyTargets;var s=r(7849);var a=r(1915);function prettifyVersion(e){if(typeof e!=="string"){return e}const t=[s.major(e)];const r=s.minor(e);const a=s.patch(e);if(r||a){t.push(r)}if(a){t.push(a)}return t.join(".")}function prettifyTargets(e){return Object.keys(e).reduce(((t,r)=>{let s=e[r];const n=a.unreleasedLabels[r];if(typeof s==="string"&&n!==s){s=prettifyVersion(s)}t[r]=s;return t}),{})}},1915:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.browserNameMap=t.unreleasedLabels=void 0;const r={safari:"tp"};t.unreleasedLabels=r;const s={and_chr:"chrome",and_ff:"firefox",android:"android",chrome:"chrome",edge:"edge",firefox:"firefox",ie:"ie",ie_mob:"ie",ios_saf:"ios",node:"node",op_mob:"opera",opera:"opera",safari:"safari",samsung:"samsung"};t.browserNameMap=s},240:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.semverMin=semverMin;t.semverify=semverify;t.isUnreleasedVersion=isUnreleasedVersion;t.getLowestUnreleased=getLowestUnreleased;t.getHighestUnreleased=getHighestUnreleased;t.getLowestImplementedVersion=getLowestImplementedVersion;var s=r(7849);var a=r(7347);var n=r(1915);const o=/^(\d+|\d+.\d+)$/;const i=new a.OptionValidator("@babel/helper-compilation-targets");function semverMin(e,t){return e&&s.lt(e,t)?e:t}function semverify(e){if(typeof e==="string"&&s.valid(e)){return e}i.invariant(typeof e==="number"||typeof e==="string"&&o.test(e),`'${e}' is not a valid version`);const t=e.toString().split(".");while(t.length<3){t.push("0")}return t.join(".")}function isUnreleasedVersion(e,t){const r=n.unreleasedLabels[t];return!!r&&r===e.toString().toLowerCase()}function getLowestUnreleased(e,t,r){const s=n.unreleasedLabels[r];const a=[e,t].some((e=>e===s));if(a){return e===a?t:e||t}return semverMin(e,t)}function getHighestUnreleased(e,t,r){return getLowestUnreleased(e,t,r)===e?t:e}function getLowestImplementedVersion(e,t){const r=e[t];if(!r&&t==="android"){return e.chrome}return r}},5789:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(8622);function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach((function(r){if(r!=="default"){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:true,get:function(){return e[r]}})}}))}t["default"]=e;return Object.freeze(t)}var a=_interopNamespace(s);function willPathCastToBoolean(e){const t=e;const{node:r,parentPath:s}=t;if(s.isLogicalExpression()){const{operator:e,right:t}=s.node;if(e==="&&"||e==="||"||e==="??"&&r===t){return willPathCastToBoolean(s)}}if(s.isSequenceExpression()){const{expressions:e}=s.node;if(e[e.length-1]===r){return willPathCastToBoolean(s)}else{return true}}return s.isConditional({test:r})||s.isUnaryExpression({operator:"!"})||s.isLoop({test:r})}class AssignmentMemoiser{constructor(){this._map=void 0;this._map=new WeakMap}has(e){return this._map.has(e)}get(e){if(!this.has(e))return;const t=this._map.get(e);const{value:r}=t;t.count--;if(t.count===0){return a.assignmentExpression("=",r,e)}return r}set(e,t,r){return this._map.set(e,{count:r,value:t})}}function toNonOptional(e,t){const{node:r}=e;if(a.isOptionalMemberExpression(r)){return a.memberExpression(t,r.property,r.computed)}if(e.isOptionalCallExpression()){const r=e.get("callee");if(e.node.optional&&r.isOptionalMemberExpression()){const{object:s}=r.node;const n=e.scope.maybeGenerateMemoised(s)||s;r.get("object").replaceWith(a.assignmentExpression("=",n,s));return a.callExpression(a.memberExpression(t,a.identifier("call")),[n,...e.node.arguments])}return a.callExpression(t,e.node.arguments)}return e.node}function isInDetachedTree(e){while(e){if(e.isProgram())break;const{parentPath:t,container:r,listKey:s}=e;const a=t.node;if(s){if(r!==a[s])return true}else{if(r!==a)return true}e=t}return false}const n={memoise(){},handle(e,t){const{node:r,parent:s,parentPath:n,scope:o}=e;if(e.isOptionalMemberExpression()){if(isInDetachedTree(e))return;const i=e.find((({node:t,parent:r})=>{if(a.isOptionalMemberExpression(r)){return r.optional||r.object!==t}if(a.isOptionalCallExpression(r)){return t!==e.node&&r.optional||r.callee!==t}return true}));if(o.path.isPattern()){i.replaceWith(a.callExpression(a.arrowFunctionExpression([],i.node),[]));return}const l=willPathCastToBoolean(i);const c=i.parentPath;if(c.isUpdateExpression({argument:r})||c.isAssignmentExpression({left:r})){throw e.buildCodeFrameError(`can't handle assignment`)}const u=c.isUnaryExpression({operator:"delete"});if(u&&i.isOptionalMemberExpression()&&i.get("property").isPrivateName()){throw e.buildCodeFrameError(`can't delete a private class element`)}let p=e;for(;;){if(p.isOptionalMemberExpression()){if(p.node.optional)break;p=p.get("object");continue}else if(p.isOptionalCallExpression()){if(p.node.optional)break;p=p.get("callee");continue}throw new Error(`Internal error: unexpected ${p.node.type}`)}const f=p.isOptionalMemberExpression()?"object":"callee";const d=p.node[f];const m=o.maybeGenerateMemoised(d);const y=m!=null?m:d;const g=n.isOptionalCallExpression({callee:r});const isOptionalCall=e=>g;const h=n.isCallExpression({callee:r});p.replaceWith(toNonOptional(p,y));if(isOptionalCall()){if(s.optional){n.replaceWith(this.optionalCall(e,s.arguments))}else{n.replaceWith(this.call(e,s.arguments))}}else if(h){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}let b=e.node;for(let t=e;t!==i;){const e=t.parentPath;if(e===i&&isOptionalCall()&&s.optional){b=e.node;break}b=toNonOptional(e,b);t=e}let x;const v=i.parentPath;if(a.isMemberExpression(b)&&v.isOptionalCallExpression({callee:i.node,optional:true})){const{object:t}=b;x=e.scope.maybeGenerateMemoised(t);if(x){b.object=a.assignmentExpression("=",x,t)}}let E=i;if(u){E=v;b=v.node}const j=m?a.assignmentExpression("=",a.cloneNode(y),a.cloneNode(d)):a.cloneNode(y);if(l){let e;if(t){e=a.binaryExpression("!=",j,a.nullLiteral())}else{e=a.logicalExpression("&&",a.binaryExpression("!==",j,a.nullLiteral()),a.binaryExpression("!==",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.logicalExpression("&&",e,b))}else{let e;if(t){e=a.binaryExpression("==",j,a.nullLiteral())}else{e=a.logicalExpression("||",a.binaryExpression("===",j,a.nullLiteral()),a.binaryExpression("===",a.cloneNode(y),o.buildUndefinedNode()))}E.replaceWith(a.conditionalExpression(e,u?a.booleanLiteral(true):o.buildUndefinedNode(),b))}if(x){const e=v.node;v.replaceWith(a.optionalCallExpression(a.optionalMemberExpression(e.callee,a.identifier("call"),false,true),[a.cloneNode(x),...e.arguments],false))}return}if(a.isUpdateExpression(s,{argument:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,prefix:o}=s;this.memoise(e,2);const i=a.binaryExpression(t[0],a.unaryExpression("+",this.get(e)),a.numericLiteral(1));if(o){n.replaceWith(this.set(e,i))}else{const{scope:t}=e;const s=t.generateUidIdentifierBasedOnNode(r);t.push({id:s});i.left=a.assignmentExpression("=",a.cloneNode(s),i.left);n.replaceWith(a.sequenceExpression([this.set(e,i),a.cloneNode(s)]))}return}if(n.isAssignmentExpression({left:r})){if(this.simpleSet){e.replaceWith(this.simpleSet(e));return}const{operator:t,right:r}=n.node;if(t==="="){n.replaceWith(this.set(e,r))}else{const s=t.slice(0,-1);if(a.LOGICAL_OPERATORS.includes(s)){this.memoise(e,1);n.replaceWith(a.logicalExpression(s,this.get(e),this.set(e,r)))}else{this.memoise(e,2);n.replaceWith(this.set(e,a.binaryExpression(s,this.get(e),r)))}}return}if(n.isCallExpression({callee:r})){n.replaceWith(this.call(e,n.node.arguments));return}if(n.isOptionalCallExpression({callee:r})){if(o.path.isPattern()){n.replaceWith(a.callExpression(a.arrowFunctionExpression([],n.node),[]));return}n.replaceWith(this.optionalCall(e,n.node.arguments));return}if(n.isForXStatement({left:r})||n.isObjectProperty({value:r})&&n.parentPath.isObjectPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isObjectProperty({value:s})&&n.parentPath.parentPath.isObjectPattern()||n.isArrayPattern()||n.isAssignmentPattern({left:r})&&n.parentPath.isArrayPattern()||n.isRestElement()){e.replaceWith(this.destructureSet(e));return}if(n.isTaggedTemplateExpression()){e.replaceWith(this.boundGet(e))}else{e.replaceWith(this.get(e))}}};function memberExpressionToFunctions(e,t,r){e.traverse(t,Object.assign({},n,r,{memoiser:new AssignmentMemoiser}))}t["default"]=memberExpressionToFunctions},558:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},1626:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(558);var a=r(7490);var n=r(5480);var o=r(8304);function matchAffectedArguments(e){const t=e.findIndex((e=>o.types.isSpreadElement(e)));return t>=0&&t!==e.length-1}function shouldTransform(e){let t=e;const r=[];while(t.isOptionalMemberExpression()||t.isOptionalCallExpression()){const{node:e}=t;r.push(e);if(t.isOptionalMemberExpression()){t=n.skipTransparentExprWrappers(t.get("object"))}else if(t.isOptionalCallExpression()){t=n.skipTransparentExprWrappers(t.get("callee"))}}for(let e=0;e{e.assertVersion(7);const t=e.assumption("noDocumentAll");const r=e.assumption("pureGetters");return{name:"bugfix-v8-spread-parameters-in-optional-chaining",visitor:{"OptionalCallExpression|OptionalMemberExpression"(e){if(shouldTransform(e)){a.transform(e,{noDocumentAll:t,pureGetters:r})}}}}}));t["default"]=i},1023:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(8304);const a=(0,s.template)(`\n async function wrapper() {\n var ITERATOR_ABRUPT_COMPLETION = false;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY;\n try {\n for (\n var ITERATOR_KEY = GET_ITERATOR(OBJECT), STEP_KEY;\n ITERATOR_ABRUPT_COMPLETION = !(STEP_KEY = await ITERATOR_KEY.next()).done;\n ITERATOR_ABRUPT_COMPLETION = false\n ) {\n }\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (ITERATOR_ABRUPT_COMPLETION && ITERATOR_KEY.return != null) {\n await ITERATOR_KEY.return();\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n }\n`);function _default(e,{getAsyncIterator:t}){const{node:r,scope:n,parent:o}=e;const i=n.generateUidIdentifier("step");const l=s.types.memberExpression(i,s.types.identifier("value"));const c=r.left;let u;if(s.types.isIdentifier(c)||s.types.isPattern(c)||s.types.isMemberExpression(c)){u=s.types.expressionStatement(s.types.assignmentExpression("=",c,l))}else if(s.types.isVariableDeclaration(c)){u=s.types.variableDeclaration(c.kind,[s.types.variableDeclarator(c.declarations[0].id,l)])}let p=a({ITERATOR_HAD_ERROR_KEY:n.generateUidIdentifier("didIteratorError"),ITERATOR_ABRUPT_COMPLETION:n.generateUidIdentifier("iteratorAbruptCompletion"),ITERATOR_ERROR_KEY:n.generateUidIdentifier("iteratorError"),ITERATOR_KEY:n.generateUidIdentifier("iterator"),GET_ITERATOR:t,OBJECT:r.right,STEP_KEY:s.types.cloneNode(i)});p=p.body.body;const f=s.types.isLabeledStatement(o);const d=p[3].block.body;const m=d[0];if(f){d[0]=s.types.labeledStatement(o.label,m)}return{replaceParent:f,node:p,declar:u,loop:m}}},2271:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(7120);var n=r(1079);var o=r(8304);var i=r(1023);var l=(0,s.declare)((e=>{e.assertVersion(7);const t={Function(e){e.skip()},YieldExpression({node:e},t){if(!e.delegate)return;const r=t.addHelper("asyncGeneratorDelegate");e.argument=o.types.callExpression(r,[o.types.callExpression(t.addHelper("asyncIterator"),[e.argument]),t.addHelper("awaitAsyncGenerator")])}};const r={Function(e){e.skip()},ForOfStatement(e,{file:t}){const{node:r}=e;if(!r.await)return;const s=(0,i.default)(e,{getAsyncIterator:t.addHelper("asyncIterator")});const{declar:a,loop:n}=s;const l=n.body;e.ensureBlock();if(a){l.body.push(a)}l.body=l.body.concat(r.body.body);o.types.inherits(n,r);o.types.inherits(n.body,r.body);if(s.replaceParent){e.parentPath.replaceWithMultiple(s.node)}else{e.replaceWithMultiple(s.node)}}};const s={Function(e,s){if(!e.node.async)return;e.traverse(r,s);if(!e.node.generator)return;e.traverse(t,s);(0,a.default)(e,{wrapAsync:s.addHelper("wrapAsyncGenerator"),wrapAwait:s.addHelper("awaitAsyncGenerator")})}};return{name:"proposal-async-generator-functions",inherits:n.default,visitor:{Program(e,t){e.traverse(s,t)}}}}));t["default"]=l},5557:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(8142);var n=r(6758);function generateUid(e,t){const r="";let s;let a=1;do{s=e._generateUid(r,a);a++}while(t.has(s));return s}var o=(0,s.declare)((({types:e,template:t,assertVersion:r})=>{r("^7.12.0");return{name:"proposal-class-static-block",inherits:a.default,pre(){(0,n.enableFeature)(this.file,n.FEATURES.staticBlocks,false)},visitor:{ClassBody(r){const{scope:s}=r;const a=new Set;const n=r.get("body");for(const e of n){if(e.isPrivate()){a.add(e.get("key.id").node.name)}}for(const r of n){if(!r.isStaticBlock())continue;const n=generateUid(s,a);a.add(n);const o=e.privateName(e.identifier(n));r.replaceWith(e.classPrivateProperty(o,t.expression.ast`(() => { ${r.node.body} })()`,[],true))}}}}}));t["default"]=o},3181:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(7445);var n=r(6758);var o=r(2155);var i=(0,s.declare)((({assertVersion:e,types:t,template:r},{loose:s})=>{e(7);const i=new WeakMap;const l=new WeakMap;function unshadow(e,t,r){while(r!==t){if(r.hasOwnBinding(e))r.rename(e);r=r.parent}}function injectToFieldInit(e,r,s=false){if(e.node.value){if(s){e.get("value").insertBefore(r)}else{e.get("value").insertAfter(r)}}else{e.set("value",t.unaryExpression("void",r))}}function injectInitialization(e,r){let s;let a;for(const t of e.get("body.body")){if((t.isClassProperty()||t.isClassPrivateProperty())&&!t.node.static){s=t;break}if(!a&&t.isClassMethod({kind:"constructor"})){a=t}}if(s){injectToFieldInit(s,r,true)}else{(0,n.injectInitialization)(e,a,[t.expressionStatement(r)])}}function getWeakSetId(e,s,a,n="",l){let c=i.get(a.node);if(!c){c=s.scope.generateUidIdentifier(`${n||""} brandCheck`);i.set(a.node,c);l(a,r.expression.ast`${t.cloneNode(c)}.add(this)`);const e=t.newExpression(t.identifier("WeakSet"),[]);(0,o.default)(e);s.insertBefore(r.ast`var ${c} = ${e}`)}return t.cloneNode(c)}return{name:"proposal-private-property-in-object",inherits:a.default,pre(){(0,n.enableFeature)(this.file,n.FEATURES.privateIn,s)},visitor:{BinaryExpression(e){const{node:s}=e;if(s.operator!=="in")return;if(!t.isPrivateName(s.left))return;const{name:a}=s.left.id;let n;const o=e.findParent((e=>{if(!e.isClass())return false;n=e.get("body.body").find((({node:e})=>t.isPrivate(e)&&e.key.id.name===a));return!!n}));if(o.parentPath.scope.path.isPattern()){o.replaceWith(r.ast`(() => ${o.node})()`);return}if(n.isMethod()){if(n.node.static){if(o.node.id){unshadow(o.node.id.name,o.scope,e.scope)}else{o.set("id",e.scope.generateUidIdentifier("class"))}e.replaceWith(r.expression.ast` ${t.cloneNode(o.node.id)} === ${e.node.right} - `)}else{var c;const t=getWeakSetId(i,o,o,(c=o.node.id)==null?void 0:c.name,injectInitialization);e.replaceWith(r.expression.ast`${t}.has(${e.node.right})`)}}else{const t=getWeakSetId(l,o,n,n.node.key.id.name,injectToFieldInit);e.replaceWith(r.expression.ast`${t}.has(${e.node.right})`)}}}}}));t["default"]=i},6092:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6550);var a=r(558);var n=(0,a.declare)(((e,t)=>{e.assertVersion(7);const{useUnicodeFlag:r=true}=t;if(typeof r!=="boolean"){throw new Error(".useUnicodeFlag must be a boolean, or undefined")}return(0,s.createRegExpFeaturePlugin)({name:"proposal-unicode-property-regex",feature:"unicodePropertyEscape",options:{useUnicodeFlag:r}})}));t["default"]=n},1079:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(631);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-async-generators",manipulateOptions(e,t){t.plugins.push("asyncGenerators")}}}));t["default"]=a},631:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,r,s)=>{if(!t.assertVersion){t=Object.assign(copyApiObject(t),{assertVersion(e){throwVersionError(e,t.version)}})}return e(t,r||{},s)}}function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},6762:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8853);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-bigint",manipulateOptions(e,t){t.plugins.push("bigInt")}}}));t["default"]=a},8853:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,r,s)=>{if(!t.assertVersion){t=Object.assign(copyApiObject(t),{assertVersion(e){throwVersionError(e,t.version)}})}return e(t,r||{},s)}}function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},947:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(93);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-class-properties",manipulateOptions(e,t){t.plugins.push("classProperties","classPrivateProperties","classPrivateMethods")}}}));t["default"]=a},93:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8142:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-class-static-block",manipulateOptions(e,t){t.plugins.push("classStaticBlock")}}}));t["default"]=a},5163:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(2083);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-dynamic-import",manipulateOptions(e,t){t.plugins.push("dynamicImport")}}}));t["default"]=a},2083:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,r,s)=>{if(!t.assertVersion){t=Object.assign(copyApiObject(t),{assertVersion(e){throwVersionError(e,t.version)}})}return e(t,r||{},s)}}function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8356:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9692);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-import-assertions",manipulateOptions(e,t){t.plugins.push(["importAssertions"])}}}));t["default"]=a},9692:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7445:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-private-property-in-object",manipulateOptions(e,t){t.plugins.push("privateIn")}}}));t["default"]=a},6050:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);function removePlugin(e,t){const r=[];e.forEach(((e,s)=>{const a=Array.isArray(e)?e[0]:e;if(a===t){r.unshift(s)}}));for(const t of r){e.splice(t,1)}}var a=(0,s.declare)(((e,{isTSX:t})=>{e.assertVersion(7);return{name:"syntax-typescript",manipulateOptions(e,r){const{plugins:s}=r;removePlugin(s,"flow");removePlugin(s,"jsx");r.plugins.push("typescript","classProperties");{r.plugins.push("objectRestSpread")}if(t){r.plugins.push("jsx")}}}}));t["default"]=a},6408:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(2155);var n=r(550);var o=r(7058);var i=r(8304);var l=r(5548);var c=r(4546);const getBuiltinClasses=e=>Object.keys(l[e]).filter((e=>/^[A-Z]/.test(e)));const u=new Set([...getBuiltinClasses("builtin"),...getBuiltinClasses("browser")]);var p=(0,s.declare)(((e,t)=>{var r,s,l,p;e.assertVersion(7);const{loose:d}=t;const f=(r=e.assumption("setClassMethods"))!=null?r:t.loose;const m=(s=e.assumption("constantSuper"))!=null?s:t.loose;const y=(l=e.assumption("superIsCallableConstructor"))!=null?l:t.loose;const g=(p=e.assumption("noClassCalls"))!=null?p:t.loose;const h=Symbol();return{name:"transform-classes",visitor:{ExportDefaultDeclaration(e){if(!e.get("declaration").isClassDeclaration())return;(0,o.default)(e)},ClassDeclaration(e){const{node:t}=e;const r=t.id||e.scope.generateUidIdentifier("class");e.replaceWith(i.types.variableDeclaration("let",[i.types.variableDeclarator(r,i.types.toExpression(t))]))},ClassExpression(e,t){const{node:r}=e;if(r[h])return;const s=(0,n.default)(e);if(s&&s!==r){e.replaceWith(s);return}r[h]=true;e.replaceWith((0,c.default)(e,t.file,u,d,{setClassMethods:f,constantSuper:m,superIsCallableConstructor:y,noClassCalls:g}));if(e.isCallExpression()){(0,a.default)(e);const t=e.get("callee");if(t.isArrowFunctionExpression()){t.arrowFunctionToExpression()}}}}}}));t["default"]=p},7677:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=addCreateSuperHelper;var s=r(8304);const a=new WeakMap;function addCreateSuperHelper(e){if(a.has(e)){return(s.types.cloneNode||s.types.clone)(a.get(e))}try{return e.addHelper("createSuper")}catch(e){}const t=e.scope.generateUidIdentifier("createSuper");a.set(e,t);const r=n({CREATE_SUPER:t,GET_PROTOTYPE_OF:e.addHelper("getPrototypeOf"),POSSIBLE_CONSTRUCTOR_RETURN:e.addHelper("possibleConstructorReturn")});e.path.unshiftContainer("body",[r]);e.scope.registerDeclaration(e.path.get("body.0"));return s.types.cloneNode(t)}const n=s.template.statement` + `)}else{var c;const t=getWeakSetId(i,o,o,(c=o.node.id)==null?void 0:c.name,injectInitialization);e.replaceWith(r.expression.ast`${t}.has(${e.node.right})`)}}else{const t=getWeakSetId(l,o,n,n.node.key.id.name,injectToFieldInit);e.replaceWith(r.expression.ast`${t}.has(${e.node.right})`)}}}}}));t["default"]=i},6092:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6550);var a=r(558);var n=(0,a.declare)(((e,t)=>{e.assertVersion(7);const{useUnicodeFlag:r=true}=t;if(typeof r!=="boolean"){throw new Error(".useUnicodeFlag must be a boolean, or undefined")}return(0,s.createRegExpFeaturePlugin)({name:"proposal-unicode-property-regex",feature:"unicodePropertyEscape",options:{useUnicodeFlag:r}})}));t["default"]=n},1079:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(631);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-async-generators",manipulateOptions(e,t){t.plugins.push("asyncGenerators")}}}));t["default"]=a},631:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,r,s)=>{if(!t.assertVersion){t=Object.assign(copyApiObject(t),{assertVersion(e){throwVersionError(e,t.version)}})}return e(t,r||{},s)}}function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},6762:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(8853);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-bigint",manipulateOptions(e,t){t.plugins.push("bigInt")}}}));t["default"]=a},8853:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,r,s)=>{if(!t.assertVersion){t=Object.assign(copyApiObject(t),{assertVersion(e){throwVersionError(e,t.version)}})}return e(t,r||{},s)}}function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},947:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(93);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-class-properties",manipulateOptions(e,t){t.plugins.push("classProperties","classPrivateProperties","classPrivateMethods")}}}));t["default"]=a},93:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8142:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-class-static-block",manipulateOptions(e,t){t.plugins.push("classStaticBlock")}}}));t["default"]=a},5163:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(2083);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-dynamic-import",manipulateOptions(e,t){t.plugins.push("dynamicImport")}}}));t["default"]=a},2083:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,r,s)=>{if(!t.assertVersion){t=Object.assign(copyApiObject(t),{assertVersion(e){throwVersionError(e,t.version)}})}return e(t,r||{},s)}}function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},8356:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9692);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-import-assertions",manipulateOptions(e,t){t.plugins.push(["importAssertions"])}}}));t["default"]=a},9692:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.declare=declare;function declare(e){return(t,s,a)=>{var n;let o;for(const e of Object.keys(r)){var i;if(t[e])continue;o=(i=o)!=null?i:copyApiObject(t);o[e]=r[e](o)}return e((n=o)!=null?n:t,s||{},a)}}const r={assertVersion:e=>t=>{throwVersionError(t,e.version)},targets:()=>()=>({}),assumption:()=>()=>{}};function copyApiObject(e){let t=null;if(typeof e.version==="string"&&/^7\./.test(e.version)){t=Object.getPrototypeOf(e);if(t&&(!has(t,"version")||!has(t,"transform")||!has(t,"template")||!has(t,"types"))){t=null}}return Object.assign({},t,e)}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function throwVersionError(e,t){if(typeof e==="number"){if(!Number.isInteger(e)){throw new Error("Expected string or integer value.")}e=`^${e}.0.0-0`}if(typeof e!=="string"){throw new Error("Expected string or integer value.")}const r=Error.stackTraceLimit;if(typeof r==="number"&&r<25){Error.stackTraceLimit=25}let s;if(t.slice(0,2)==="7."){s=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". `+`You'll need to update your @babel/core version.`)}else{s=new Error(`Requires Babel "${e}", but was loaded with "${t}". `+`If you are sure you have a compatible version of @babel/core, `+`it is likely that something in your build process is loading the `+`wrong version. Inspect the stack trace of this error to look for `+`the first entry that doesn't mention "@babel/core" or "babel-core" `+`to see what is calling Babel.`)}if(typeof r==="number"){Error.stackTraceLimit=r}throw Object.assign(s,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}},7445:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=(0,s.declare)((e=>{e.assertVersion(7);return{name:"syntax-private-property-in-object",manipulateOptions(e,t){t.plugins.push("privateIn")}}}));t["default"]=a},6050:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);function removePlugin(e,t){const r=[];e.forEach(((e,s)=>{const a=Array.isArray(e)?e[0]:e;if(a===t){r.unshift(s)}}));for(const t of r){e.splice(t,1)}}var a=(0,s.declare)(((e,{isTSX:t})=>{e.assertVersion(7);return{name:"syntax-typescript",manipulateOptions(e,r){const{plugins:s}=r;removePlugin(s,"flow");removePlugin(s,"jsx");r.plugins.push("typescript","classProperties");{r.plugins.push("objectRestSpread")}if(t){r.plugins.push("jsx")}}}}));t["default"]=a},6408:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(2155);var n=r(550);var o=r(7058);var i=r(8304);var l=r(5548);var c=r(4546);const getBuiltinClasses=e=>Object.keys(l[e]).filter((e=>/^[A-Z]/.test(e)));const u=new Set([...getBuiltinClasses("builtin"),...getBuiltinClasses("browser")]);var p=(0,s.declare)(((e,t)=>{var r,s,l,p;e.assertVersion(7);const{loose:f}=t;const d=(r=e.assumption("setClassMethods"))!=null?r:t.loose;const m=(s=e.assumption("constantSuper"))!=null?s:t.loose;const y=(l=e.assumption("superIsCallableConstructor"))!=null?l:t.loose;const g=(p=e.assumption("noClassCalls"))!=null?p:t.loose;const h=Symbol();return{name:"transform-classes",visitor:{ExportDefaultDeclaration(e){if(!e.get("declaration").isClassDeclaration())return;(0,o.default)(e)},ClassDeclaration(e){const{node:t}=e;const r=t.id||e.scope.generateUidIdentifier("class");e.replaceWith(i.types.variableDeclaration("let",[i.types.variableDeclarator(r,i.types.toExpression(t))]))},ClassExpression(e,t){const{node:r}=e;if(r[h])return;const s=(0,n.default)(e);if(s&&s!==r){e.replaceWith(s);return}r[h]=true;e.replaceWith((0,c.default)(e,t.file,u,f,{setClassMethods:d,constantSuper:m,superIsCallableConstructor:y,noClassCalls:g}));if(e.isCallExpression()){(0,a.default)(e);const t=e.get("callee");if(t.isArrowFunctionExpression()){t.arrowFunctionToExpression()}}}}}}));t["default"]=p},7677:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=addCreateSuperHelper;var s=r(8304);const a=new WeakMap;function addCreateSuperHelper(e){if(a.has(e)){return(s.types.cloneNode||s.types.clone)(a.get(e))}try{return e.addHelper("createSuper")}catch(e){}const t=e.scope.generateUidIdentifier("createSuper");a.set(e,t);const r=n({CREATE_SUPER:t,GET_PROTOTYPE_OF:e.addHelper("getPrototypeOf"),POSSIBLE_CONSTRUCTOR_RETURN:e.addHelper("possibleConstructorReturn")});e.path.unshiftContainer("body",[r]);e.scope.registerDeclaration(e.path.get("body.0"));return s.types.cloneNode(t)}const n=s.template.statement` function CREATE_SUPER(Derived) { function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; @@ -433,30 +358,30 @@ return POSSIBLE_CONSTRUCTOR_RETURN(this, result); } } -`},4546:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transformClass;var s=r(550);var a=r(6833);var n=r(6721);var o=r(8304);var i=r(2155);var l=r(7677);function buildConstructor(e,t,r){const s=o.types.functionDeclaration(o.types.cloneNode(e),[],t);o.types.inherits(s,r);return s}function transformClass(e,t,r,c,u){const p={parent:undefined,scope:undefined,node:undefined,path:undefined,file:undefined,classId:undefined,classRef:undefined,superFnId:undefined,superName:undefined,superReturns:[],isDerived:false,extendsNative:false,construct:undefined,constructorBody:undefined,userConstructor:undefined,userConstructorPath:undefined,hasConstructor:false,staticPropBody:[],body:[],superThises:[],pushedConstructor:false,pushedInherits:false,protoAlias:null,isLoose:false,dynamicKeys:new Map,methods:{instance:{hasComputed:false,list:[],map:new Map},static:{hasComputed:false,list:[],map:new Map}}};const setState=e=>{Object.assign(p,e)};const d=o.traverse.visitors.merge([a.environmentVisitor,{ThisExpression(e){p.superThises.push(e)}}]);function maybeCreateConstructor(){let e=false;const t=p.path.get("body.body");for(const r of t){e=r.equals("kind","constructor");if(e)break}if(e)return;let r,s;if(p.isDerived){const e=o.template.expression.ast` +`},4546:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transformClass;var s=r(550);var a=r(6833);var n=r(6721);var o=r(8304);var i=r(2155);var l=r(7677);function buildConstructor(e,t,r){const s=o.types.functionDeclaration(o.types.cloneNode(e),[],t);o.types.inherits(s,r);return s}function transformClass(e,t,r,c,u){const p={parent:undefined,scope:undefined,node:undefined,path:undefined,file:undefined,classId:undefined,classRef:undefined,superFnId:undefined,superName:undefined,superReturns:[],isDerived:false,extendsNative:false,construct:undefined,constructorBody:undefined,userConstructor:undefined,userConstructorPath:undefined,hasConstructor:false,staticPropBody:[],body:[],superThises:[],pushedConstructor:false,pushedInherits:false,protoAlias:null,isLoose:false,dynamicKeys:new Map,methods:{instance:{hasComputed:false,list:[],map:new Map},static:{hasComputed:false,list:[],map:new Map}}};const setState=e=>{Object.assign(p,e)};const f=o.traverse.visitors.merge([a.environmentVisitor,{ThisExpression(e){p.superThises.push(e)}}]);function maybeCreateConstructor(){let e=false;const t=p.path.get("body.body");for(const r of t){e=r.equals("kind","constructor");if(e)break}if(e)return;let r,s;if(p.isDerived){const e=o.template.expression.ast` (function () { super(...arguments); }) - `;r=e.params;s=e.body}else{r=[];s=o.types.blockStatement([])}p.path.get("body").unshiftContainer("body",o.types.classMethod("constructor",o.types.identifier("constructor"),r,s))}function buildBody(){maybeCreateConstructor();pushBody();verifyConstructor();if(p.userConstructor){const{constructorBody:e,userConstructor:t,construct:r}=p;e.body=e.body.concat(t.body.body);o.types.inherits(r,t);o.types.inherits(e,t.body)}pushDescriptors()}function pushBody(){const e=p.path.get("body.body");for(const t of e){const e=t.node;if(t.isClassProperty()){throw t.buildCodeFrameError("Missing class properties transform.")}if(e.decorators){throw t.buildCodeFrameError("Method has decorators, put the decorator plugin before the classes one.")}if(o.types.isClassMethod(e)){const r=e.kind==="constructor";const s=new a.default({methodPath:t,objectRef:p.classRef,superRef:p.superName,constantSuper:u.constantSuper,file:p.file,refToPreserve:p.classRef});s.replace();const n=[];t.traverse(o.traverse.visitors.merge([a.environmentVisitor,{ReturnStatement(e){if(!e.getFunctionParent().isArrowFunctionExpression()){n.push(e)}}}]));if(r){pushConstructor(n,e,t)}else{pushMethod(e,t)}}}}function pushDescriptors(){pushInheritsToBody();const{body:e}=p;const t={instance:null,static:null};for(const e of["static","instance"]){if(p.methods[e].list.length){t[e]=p.methods[e].list.map((e=>{const t=o.types.objectExpression([o.types.objectProperty(o.types.identifier("key"),e.key)]);for(const r of["get","set","value"]){if(e[r]!=null){t.properties.push(o.types.objectProperty(o.types.identifier(r),e[r]))}}return t}))}}if(t.instance||t.static){let r=[o.types.cloneNode(p.classRef),t.instance?o.types.arrayExpression(t.instance):o.types.nullLiteral(),t.static?o.types.arrayExpression(t.static):o.types.nullLiteral()];let s=0;for(let e=0;eo.types.cloneNode(t);return t};for(const e of p.superThises){const{node:t,parentPath:r}=e;if(r.isMemberExpression({object:t})){e.replaceWith(thisRef());continue}e.replaceWith(o.types.callExpression(p.file.addHelper("assertThisInitialized"),[thisRef()]))}const r=new Set;e.traverse(o.traverse.visitors.merge([a.environmentVisitor,{Super(e){const{node:t,parentPath:s}=e;if(s.isCallExpression({callee:t})){r.add(s)}}}]));let s=!!r.size;for(const a of r){wrapSuperCall(a,p.superName,thisRef,t);if(s){a.find((function(t){if(t===e){return true}if(t.isLoop()||t.isConditional()||t.isArrowFunctionExpression()){s=false;return true}}))}}let n;if(p.isLoose){n=e=>{const t=o.types.callExpression(p.file.addHelper("assertThisInitialized"),[thisRef()]);return e?o.types.logicalExpression("||",e,t):t}}else{n=e=>o.types.callExpression(p.file.addHelper("possibleConstructorReturn"),[thisRef()].concat(e||[]))}const i=t.get("body");if(!i.length||!i.pop().isReturnStatement()){t.pushContainer("body",o.types.returnStatement(s?thisRef():n()))}for(const e of p.superReturns){e.get("argument").replaceWith(n(e.node.argument))}}function pushMethod(e,t){const r=t?t.scope:p.scope;if(e.kind==="method"){if(processMethod(e,r))return}const a=e.static?"static":"instance";const n=p.methods[a];const i=e.kind==="method"?"value":e.kind;const l=o.types.isNumericLiteral(e.key)||o.types.isBigIntLiteral(e.key)?o.types.stringLiteral(String(e.key.value)):o.types.toComputedKey(e);let c=o.types.toExpression(e);if(o.types.isStringLiteral(l)){if(e.kind==="method"){c=(0,s.default)({id:l,node:e,scope:r})}}else{n.hasComputed=true}let u;if(!n.hasComputed&&n.map.has(l.value)){u=n.map.get(l.value);u[i]=c;if(i==="value"){u.get=null;u.set=null}else{u.value=null}}else{u={key:l,[i]:c};n.list.push(u);if(!n.hasComputed){n.map.set(l.value,u)}}}function processMethod(e,t){if(u.setClassMethods&&!e.decorators){let{classRef:r}=p;if(!e.static){insertProtoAliasOnce();r=p.protoAlias}const a=o.types.memberExpression(o.types.cloneNode(r),e.key,e.computed||o.types.isLiteral(e.key));let n=o.types.functionExpression(null,e.params,e.body,e.generator,e.async);o.types.inherits(n,e);const i=o.types.toComputedKey(e,e.key);if(o.types.isStringLiteral(i)){n=(0,s.default)({node:n,id:i,scope:t})}const l=o.types.expressionStatement(o.types.assignmentExpression("=",a,n));o.types.inheritsComments(l,e);p.body.push(l);return true}return false}function insertProtoAliasOnce(){if(p.protoAlias===null){setState({protoAlias:p.scope.generateUidIdentifier("proto")});const e=o.types.memberExpression(p.classRef,o.types.identifier("prototype"));const t=o.types.variableDeclaration("var",[o.types.variableDeclarator(p.protoAlias,e)]);p.body.push(t)}}function pushConstructor(e,t,r){setState({userConstructorPath:r,userConstructor:t,hasConstructor:true,superReturns:e});const{construct:s}=p;o.types.inheritsComments(s,t);s.params=t.params;o.types.inherits(s.body,t.body);s.body.directives=t.body.directives;pushConstructorToBody()}function pushConstructorToBody(){if(p.pushedConstructor)return;p.pushedConstructor=true;if(p.hasInstanceDescriptors||p.hasStaticDescriptors){pushDescriptors()}p.body.push(p.construct);pushInheritsToBody()}function pushInheritsToBody(){if(!p.isDerived||p.pushedInherits)return;const t=e.scope.generateUidIdentifier("super");setState({pushedInherits:true,superFnId:t});if(!u.superIsCallableConstructor){p.body.unshift(o.types.variableDeclaration("var",[o.types.variableDeclarator(t,o.types.callExpression((0,l.default)(p.file),[o.types.cloneNode(p.classRef)]))]))}p.body.unshift(o.types.expressionStatement(o.types.callExpression(p.file.addHelper(p.isLoose?"inheritsLoose":"inherits"),[o.types.cloneNode(p.classRef),o.types.cloneNode(p.superName)])))}function extractDynamicKeys(){const{dynamicKeys:e,node:t,scope:r}=p;for(const s of t.body.body){if(!o.types.isClassMethod(s)||!s.computed)continue;if(r.isPure(s.key,true))continue;const t=r.generateUidIdentifierBasedOnNode(s.key);e.set(t.name,s.key);s.key=t}}function setupClosureParamsArgs(){const{superName:e,dynamicKeys:t}=p;const r=[];const s=[];if(p.isDerived){let t=o.types.cloneNode(e);if(p.extendsNative){t=o.types.callExpression(p.file.addHelper("wrapNativeSuper"),[t]);(0,i.default)(t)}const a=p.scope.generateUidIdentifierBasedOnNode(e);r.push(a);s.push(t);setState({superName:o.types.cloneNode(a)})}for(const[e,a]of t){r.push(o.types.identifier(e));s.push(a)}return{closureParams:r,closureArgs:s}}function classTransformer(e,t,r,s){setState({parent:e.parent,scope:e.scope,node:e.node,path:e,file:t,isLoose:s});setState({classId:p.node.id,classRef:p.node.id?o.types.identifier(p.node.id.name):p.scope.generateUidIdentifier("class"),superName:p.node.superClass,isDerived:!!p.node.superClass,constructorBody:o.types.blockStatement([])});setState({extendsNative:p.isDerived&&r.has(p.superName.name)&&!p.scope.hasBinding(p.superName.name,true)});const{classRef:a,node:n,constructorBody:i}=p;setState({construct:buildConstructor(a,i,n)});extractDynamicKeys();let{body:l}=p;const{closureParams:c,closureArgs:d}=setupClosureParamsArgs();buildBody();if(!u.noClassCalls){i.body.unshift(o.types.expressionStatement(o.types.callExpression(p.file.addHelper("classCallCheck"),[o.types.thisExpression(),o.types.cloneNode(p.classRef)])))}l=l.concat(p.staticPropBody.map((e=>e(o.types.cloneNode(p.classRef)))));const f=e.isInStrictMode();let m=p.classId&&l.length===1;if(m&&!f){for(const e of p.construct.params){if(!o.types.isIdentifier(e)){m=false;break}}}const y=m?l[0].body.directives:[];if(!f){y.push(o.types.directive(o.types.directiveLiteral("use strict")))}if(m){return o.types.toExpression(l[0])}l.push(o.types.returnStatement(o.types.cloneNode(p.classRef)));const g=o.types.arrowFunctionExpression(c,o.types.blockStatement(l,y));return o.types.callExpression(g,d)}return classTransformer(e,t,r,c)}},5157:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(8304);var n=(0,s.declare)(((e,t)=>{var r,s,n;e.assertVersion(7);const{useBuiltIns:o=false}=t;const i=(r=e.assumption("iterableIsArray"))!=null?r:t.loose;const l=(s=t.allowArrayLike)!=null?s:e.assumption("arrayLikeIsIterable");const c=(n=e.assumption("objectRestNoSymbols"))!=null?n:t.loose;function getExtendsHelper(e){return o?a.types.memberExpression(a.types.identifier("Object"),a.types.identifier("assign")):e.addHelper("extends")}function variableDeclarationHasPattern(e){for(const t of e.declarations){if(a.types.isPattern(t.id)){return true}}return false}function hasRest(e){for(const t of e.elements){if(a.types.isRestElement(t)){return true}}return false}function hasObjectRest(e){for(const t of e.properties){if(a.types.isRestElement(t)){return true}}return false}const u={};const arrayUnpackVisitor=(e,t,r)=>{if(!t.length){return}if(a.types.isIdentifier(e)&&a.types.isReferenced(e,t[t.length-1])&&r.bindings[e.name]){r.deopt=true;throw u}};class DestructuringTransformer{constructor(e){this.blockHoist=e.blockHoist;this.operator=e.operator;this.arrays={};this.nodes=e.nodes||[];this.scope=e.scope;this.kind=e.kind;this.iterableIsArray=e.iterableIsArray;this.arrayLikeIsIterable=e.arrayLikeIsIterable;this.addHelper=e.addHelper}buildVariableAssignment(e,t){let r=this.operator;if(a.types.isMemberExpression(e))r="=";let s;if(r){s=a.types.expressionStatement(a.types.assignmentExpression(r,e,a.types.cloneNode(t)||this.scope.buildUndefinedNode()))}else{s=a.types.variableDeclaration(this.kind,[a.types.variableDeclarator(e,a.types.cloneNode(t))])}s._blockHoist=this.blockHoist;return s}buildVariableDeclaration(e,t){const r=a.types.variableDeclaration("var",[a.types.variableDeclarator(a.types.cloneNode(e),a.types.cloneNode(t))]);r._blockHoist=this.blockHoist;return r}push(e,t){const r=a.types.cloneNode(t);if(a.types.isObjectPattern(e)){this.pushObjectPattern(e,r)}else if(a.types.isArrayPattern(e)){this.pushArrayPattern(e,r)}else if(a.types.isAssignmentPattern(e)){this.pushAssignmentPattern(e,r)}else{this.nodes.push(this.buildVariableAssignment(e,r))}}toArray(e,t){if(this.iterableIsArray||a.types.isIdentifier(e)&&this.arrays[e.name]){return e}else{return this.scope.toArray(e,t,this.arrayLikeIsIterable)}}pushAssignmentPattern({left:e,right:t},r){const s=this.scope.generateUidIdentifierBasedOnNode(r);this.nodes.push(this.buildVariableDeclaration(s,r));const n=a.types.conditionalExpression(a.types.binaryExpression("===",a.types.cloneNode(s),this.scope.buildUndefinedNode()),t,a.types.cloneNode(s));if(a.types.isPattern(e)){let t;let r;if(this.kind==="const"||this.kind==="let"){t=this.scope.generateUidIdentifier(s.name);r=this.buildVariableDeclaration(t,n)}else{t=s;r=a.types.expressionStatement(a.types.assignmentExpression("=",a.types.cloneNode(s),n))}this.nodes.push(r);this.push(e,t)}else{this.nodes.push(this.buildVariableAssignment(e,n))}}pushObjectRest(e,t,r,s){const n=[];let o=true;let i=false;for(let t=0;t=s)break;if(a.types.isRestElement(r))continue;const l=r.key;if(a.types.isIdentifier(l)&&!r.computed){n.push(a.types.stringLiteral(l.name))}else if(a.types.isTemplateLiteral(l)){n.push(a.types.cloneNode(l));i=true}else if(a.types.isLiteral(l)){n.push(a.types.stringLiteral(String(l.value)))}else{n.push(a.types.cloneNode(l));o=false}}let l;if(n.length===0){l=a.types.callExpression(getExtendsHelper(this),[a.types.objectExpression([]),a.types.cloneNode(t)])}else{let e=a.types.arrayExpression(n);if(!o){e=a.types.callExpression(a.types.memberExpression(e,a.types.identifier("map")),[this.addHelper("toPropertyKey")])}else if(!i&&!a.types.isProgram(this.scope.block)){const t=this.scope.path.findParent((e=>e.isProgram()));const r=this.scope.generateUidIdentifier("excluded");t.scope.push({id:r,init:e,kind:"const"});e=a.types.cloneNode(r)}l=a.types.callExpression(this.addHelper(`objectWithoutProperties${c?"Loose":""}`),[a.types.cloneNode(t),e])}this.nodes.push(this.buildVariableAssignment(r.argument,l))}pushObjectProperty(e,t){if(a.types.isLiteral(e.key))e.computed=true;const r=e.value;const s=a.types.memberExpression(a.types.cloneNode(t),e.key,e.computed);if(a.types.isPattern(r)){this.push(r,s)}else{this.nodes.push(this.buildVariableAssignment(r,s))}}pushObjectPattern(e,t){if(!e.properties.length){this.nodes.push(a.types.expressionStatement(a.types.callExpression(this.addHelper("objectDestructuringEmpty"),[t])))}if(e.properties.length>1&&!this.scope.isStatic(t)){const e=this.scope.generateUidIdentifierBasedOnNode(t);this.nodes.push(this.buildVariableDeclaration(e,t));t=e}if(hasObjectRest(e)){let t;for(let r=0;rt.elements.length)return;if(e.elements.lengththis.addHelper(e)});u.init(n,o);e.ensureBlock();const p=t.body;p.body=c.concat(p.body)},CatchClause({node:e,scope:t}){const r=e.param;if(!a.types.isPattern(r))return;const s=t.generateUidIdentifier("ref");e.param=s;const n=[];const o=new DestructuringTransformer({kind:"let",scope:t,nodes:n,iterableIsArray:i,arrayLikeIsIterable:l,addHelper:e=>this.addHelper(e)});o.init(r,s);e.body.body=n.concat(e.body.body)},AssignmentExpression(e){const{node:t,scope:r}=e;if(!a.types.isPattern(t.left))return;const s=[];const n=new DestructuringTransformer({operator:t.operator,scope:r,nodes:s,iterableIsArray:i,arrayLikeIsIterable:l,addHelper:e=>this.addHelper(e)});let o;if(e.isCompletionRecord()||!e.parentPath.isExpressionStatement()){o=r.generateUidIdentifierBasedOnNode(t.right,"ref");s.push(a.types.variableDeclaration("var",[a.types.variableDeclarator(o,t.right)]));if(a.types.isArrayExpression(t.right)){n.arrays[o.name]=true}}n.init(t.left,o||t.right);if(o){if(e.parentPath.isArrowFunctionExpression()){e.replaceWith(a.types.blockStatement([]));s.push(a.types.returnStatement(a.types.cloneNode(o)))}else{s.push(a.types.expressionStatement(a.types.cloneNode(o)))}}e.replaceWithMultiple(s);e.scope.crawl()},VariableDeclaration(e){const{node:t,scope:r,parent:s}=e;if(a.types.isForXStatement(s))return;if(!s||!e.container)return;if(!variableDeclarationHasPattern(t))return;const n=t.kind;const o=t.loc;const c=[];let u;for(let e=0;ethis.addHelper(e)});if(a.types.isPattern(n)){o.init(n,s);if(+e!==t.declarations.length-1){a.types.inherits(c[c.length-1],u)}}else{c.push(a.types.inherits(o.buildVariableAssignment(u.id,a.types.cloneNode(u.init)),u))}}let p=null;const d=[];for(const e of c){if(p!==null&&a.types.isVariableDeclaration(e)){p.declarations.push(...e.declarations)}else{e.kind=n;if(!e.loc){e.loc=o}d.push(e);p=a.types.isVariableDeclaration(e)?e:null}}for(const e of d){if(!e.declarations)continue;for(const t of e.declarations){const{name:s}=t.id;if(r.bindings[s]){r.bindings[s].kind=e.kind}}}if(d.length===1){e.replaceWith(d[0])}else{e.replaceWithMultiple(d)}}}}}));t["default"]=n},5843:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6550);var a=r(558);var n=(0,a.declare)((e=>{e.assertVersion(7);return(0,s.createRegExpFeaturePlugin)({name:"transform-dotall-regex",feature:"dotAllFlag"})}));t["default"]=n},8447:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(6550);function _default(e,t){const{runtime:r=true}=t;if(typeof r!=="boolean"){throw new Error("The 'runtime' option must be boolean")}return(0,s.createRegExpFeaturePlugin)({name:"transform-named-capturing-groups-regex",feature:"namedCaptureGroups",options:{runtime:r}})}},5628:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9522);var a=s.default;t["default"]=a},2228:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(1017);var a=r(8188);function _default(e,t,r){if(r===false)return e;return resolveAbsoluteRuntime(e,s.resolve(t,r===true?".":r))}function resolveAbsoluteRuntime(e,t){try{return s.dirname((((e,t)=>(e=e.split("."),t=t.split("."),+e[0]>+t[0]||e[0]==t[0]&&+e[1]>=+t[1]))(process.versions.node,"8.9")?require.resolve:(e,{paths:[t]},s=r(8188))=>{let a=s._findPath(e,s._nodeModulePaths(t).concat(t));if(a)return a;a=new Error(`Cannot resolve module '${e}'`);a.code="MODULE_NOT_FOUND";throw a})(`${e}/package.json`,{paths:[t]})).replace(/\\/g,"/")}catch(r){if(r.code!=="MODULE_NOT_FOUND")throw r;throw Object.assign(new Error(`Failed to resolve "${e}" relative to "${t}"`),{code:"BABEL_RUNTIME_NOT_FOUND",runtime:e,dirname:t})}}},6339:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasMinVersion=hasMinVersion;var s=r(7849);function hasMinVersion(e,t){if(!t)return true;if(s.valid(t))t=`^${t}`;return!s.intersects(`<${e}`,t)&&!s.intersects(`>=8.0.0`,t)}},4722:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(6039);var n=r(8304);var o=r(6339);var i=r(2228);var l=r(9897);var c=r(5825);var u=r(7973);const p=l.default||l;const d=c.default||c;const f=u.default||u;const m="#__secret_key__@babel/runtime__compatibility";function supportsStaticESM(e){return!!(e!=null&&e.supportsStaticESM)}var y=(0,s.declare)(((e,t,r)=>{e.assertVersion(7);const{corejs:s,helpers:l=true,regenerator:c=true,useESModules:u=false,version:y="7.0.0-beta.0",absoluteRuntime:g=false}=t;let h=false;let b;if(typeof s==="object"&&s!==null){b=s.version;h=Boolean(s.proposals)}else{b=s}const x=b?Number(b):false;if(![false,2,3].includes(x)){throw new Error(`The \`core-js\` version must be false, 2 or 3, but got ${JSON.stringify(b)}.`)}if(h&&(!x||x<3)){throw new Error("The 'proposals' option is only supported when using 'corejs: 3'")}if(typeof c!=="boolean"){throw new Error("The 'regenerator' option must be undefined, or a boolean.")}if(typeof l!=="boolean"){throw new Error("The 'helpers' option must be undefined, or a boolean.")}if(typeof u!=="boolean"&&u!=="auto"){throw new Error("The 'useESModules' option must be undefined, or a boolean, or 'auto'.")}if(typeof g!=="boolean"&&typeof g!=="string"){throw new Error("The 'absoluteRuntime' option must be undefined, a boolean, or a string.")}if(typeof y!=="string"){throw new Error(`The 'version' option must be a version string.`)}const v="7.13.0";const E=(0,o.hasMinVersion)(v,y);function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}if(has(t,"useBuiltIns")){if(t.useBuiltIns){throw new Error("The 'useBuiltIns' option has been removed. The @babel/runtime "+"module now uses builtins by default.")}else{throw new Error("The 'useBuiltIns' option has been removed. Use the 'corejs'"+"option to polyfill with `core-js` via @babel/runtime.")}}if(has(t,"polyfill")){if(t.polyfill===false){throw new Error("The 'polyfill' option has been removed. The @babel/runtime "+"module now skips polyfilling by default.")}else{throw new Error("The 'polyfill' option has been removed. Use the 'corejs'"+"option to polyfill with `core-js` via @babel/runtime.")}}if(has(t,"moduleName")){throw new Error("The 'moduleName' option has been removed. @babel/transform-runtime "+"no longer supports arbitrary runtimes. If you were using this to "+"set an absolute path for Babel's standard runtimes, please use the "+"'absoluteRuntime' option.")}const j=u==="auto"?e.caller(supportsStaticESM):u;const w=x===2;const _=x===3;const S=_?"@babel/runtime-corejs3":w?"@babel/runtime-corejs2":"@babel/runtime";const O=["interopRequireWildcard","interopRequireDefault"];const k=(0,i.default)(S,r,g);function createCorejsPlgin(e,t,r){return(s,a,n)=>Object.assign({},e(s,t,n),{inherits:r})}function createRegeneratorPlugin(e){if(!c)return undefined;return(t,r,s)=>f(t,e,s)}const P=g?".js":"";return{name:"transform-runtime",inherits:w?createCorejsPlgin(p,{method:"usage-pure",[m]:{runtimeVersion:y,useBabelRuntime:k,ext:P}},createRegeneratorPlugin({method:"usage-pure",[m]:{useBabelRuntime:k}})):_?createCorejsPlgin(d,{method:"usage-pure",version:3,proposals:h,[m]:{useBabelRuntime:k,ext:P}},createRegeneratorPlugin({method:"usage-pure",[m]:{useBabelRuntime:k}})):createRegeneratorPlugin({method:"usage-pure",[m]:{useBabelRuntime:k}}),pre(e){if(!l)return;e.set("helperGenerator",(t=>{if(e.availableHelper&&!e.availableHelper(t,y)){return}const r=O.indexOf(t)!==-1;const s=r&&!(0,a.isModule)(e.path)?4:undefined;const n=j&&e.path.node.sourceType==="module"?"helpers/esm":"helpers";return addDefaultImport(`${k}/${n}/${t}`,t,s,true)}));const t=new Map;function addDefaultImport(r,s,o,i=false){const l=(0,a.isModule)(e.path);const c=`${r}:${s}:${l||""}`;let u=t.get(c);if(u){u=n.types.cloneNode(u)}else{u=(0,a.addDefault)(e.path,r,{importedInterop:i&&E?"compiled":"uncompiled",nameHint:s,blockHoist:o});t.set(c,u)}return u}}}}));t["default"]=y},749:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transpileConstEnum;var s=r(3803);function transpileConstEnum(e,t){const{name:r}=e.node.id;const a=e.parentPath.isExportNamedDeclaration();let n=a;if(!n&&t.isProgram(e.parent)){n=e.parent.body.some((e=>t.isExportNamedDeclaration(e)&&!e.source&&e.specifiers.some((e=>t.isExportSpecifier(e)&&e.local.name===r))))}const o=(0,s.translateEnumValues)(e,t);if(n){const s=t.objectExpression(o.map((([e,r])=>t.objectProperty(t.isValidIdentifier(e)?t.identifier(e):t.stringLiteral(e),r))));if(e.scope.hasOwnBinding(r)){(a?e.parentPath:e).replaceWith(t.expressionStatement(t.callExpression(t.memberExpression(t.identifier("Object"),t.identifier("assign")),[e.node.id,s])))}else{e.replaceWith(t.variableDeclaration("var",[t.variableDeclarator(e.node.id,s)]));e.scope.registerDeclaration(e)}return}const i=new Map(o);e.scope.path.traverse({Scope(e){if(e.scope.hasOwnBinding(r))e.skip()},MemberExpression(e){if(!t.isIdentifier(e.node.object,{name:r}))return;let s;if(e.node.computed){if(t.isStringLiteral(e.node.property)){s=e.node.property.value}else{return}}else if(t.isIdentifier(e.node.property)){s=e.node.property.name}else{return}if(!i.has(s))return;e.replaceWith(t.cloneNode(i.get(s)))}});e.remove()}},3803:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transpileEnum;t.translateEnumValues=translateEnumValues;var s=r(9491);var a=r(8304);function transpileEnum(e,t){const{node:r}=e;if(r.declare){e.remove();return}const s=r.id.name;const a=enumFill(e,t,r.id);switch(e.parent.type){case"BlockStatement":case"ExportNamedDeclaration":case"Program":{e.insertAfter(a);if(seen(e.parentPath)){e.remove()}else{const s=t.isProgram(e.parent);e.scope.registerDeclaration(e.replaceWith(makeVar(r.id,t,s?"var":"let"))[0])}break}default:throw new Error(`Unexpected enum parent '${e.parent.type}`)}function seen(e){if(e.isExportDeclaration()){return seen(e.parentPath)}if(e.getData(s)){return true}else{e.setData(s,true);return false}}}function makeVar(e,t,r){return t.variableDeclaration(r,[t.variableDeclarator(e)])}const n=(0,a.template)(`\n (function (ID) {\n ASSIGNMENTS;\n })(ID || (ID = {}));\n`);const o=(0,a.template)(`\n ENUM["NAME"] = VALUE;\n`);const i=(0,a.template)(`\n ENUM[ENUM["NAME"] = VALUE] = "NAME";\n`);const buildEnumMember=(e,t)=>(e?o:i)(t);function enumFill(e,t,r){const s=translateEnumValues(e,t);const a=s.map((([e,s])=>buildEnumMember(t.isStringLiteral(s),{ENUM:t.cloneNode(r),NAME:e,VALUE:s})));return n({ID:t.cloneNode(r),ASSIGNMENTS:a})}function translateEnumValues(e,t){const r=Object.create(null);let a=-1;return e.node.members.map((n=>{const o=t.isIdentifier(n.id)?n.id.name:n.id.value;const i=n.initializer;let l;if(i){const e=evaluate(i,r);if(e!==undefined){r[o]=e;if(typeof e==="number"){l=t.numericLiteral(e);a=e}else{s(typeof e==="string");l=t.stringLiteral(e);a=undefined}}else{l=i;a=undefined}}else{if(a!==undefined){a++;l=t.numericLiteral(a);r[o]=a}else{throw e.buildCodeFrameError("Enum member must have initializer.")}}return[o,l]}))}function evaluate(e,t){return evalConstant(e);function evalConstant(e){switch(e.type){case"StringLiteral":return e.value;case"UnaryExpression":return evalUnaryExpression(e);case"BinaryExpression":return evalBinaryExpression(e);case"NumericLiteral":return e.value;case"ParenthesizedExpression":return evalConstant(e.expression);case"Identifier":return t[e.name];case"TemplateLiteral":if(e.quasis.length===1){return e.quasis[0].value.cooked}default:return undefined}}function evalUnaryExpression({argument:e,operator:t}){const r=evalConstant(e);if(r===undefined){return undefined}switch(t){case"+":return r;case"-":return-r;case"~":return~r;default:return undefined}}function evalBinaryExpression(e){const t=evalConstant(e.left);if(t===undefined){return undefined}const r=evalConstant(e.right);if(r===undefined){return undefined}switch(e.operator){case"|":return t|r;case"&":return t&r;case">>":return t>>r;case">>>":return t>>>r;case"<<":return t<{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(6050);var n=r(8304);var o=r(738);var i=r(749);var l=r(3803);var c=r(8820);function isInType(e){switch(e.parent.type){case"TSTypeReference":case"TSQualifiedName":case"TSExpressionWithTypeArguments":case"TSTypeQuery":return true;case"ExportSpecifier":return e.parentPath.parent.exportKind==="type";default:return false}}const u=new WeakMap;const p=new WeakMap;const d=new WeakSet;function isGlobalType(e,t){const r=e.find((e=>e.isProgram())).node;if(e.scope.hasOwnBinding(t))return false;if(u.get(r).has(t))return true;console.warn(`The exported identifier "${t}" is not declared in Babel's scope tracker\n`+`as a JavaScript value binding, and "@babel/plugin-transform-typescript"\n`+`never encountered it as a TypeScript type declaration.\n`+`It will be treated as a JavaScript value.\n\n`+`This problem is likely caused by another plugin injecting\n`+`"${t}" without registering it in the scope tracker. If you are the author\n`+` of that plugin, please use "scope.registerDeclaration(declarationPath)".`);return false}function registerGlobalType(e,t){u.get(e.path.node).add(t)}var f=(0,s.declare)(((e,t)=>{e.assertVersion(7);const r=/\*?\s*@jsx((?:Frag)?)\s+([^\s]+)/;const{allowNamespaces:s=true,jsxPragma:f="React.createElement",jsxPragmaFrag:m="React.Fragment",onlyRemoveTypeImports:y=false,optimizeConstEnums:g=false}=t;{var{allowDeclareFields:h=false}=t}const b={field(e){const{node:t}=e;{if(!h&&t.declare){throw e.buildCodeFrameError(`The 'declare' modifier is only allowed when the 'allowDeclareFields' option of `+`@babel/plugin-transform-typescript or @babel/preset-typescript is enabled.`)}}if(t.declare){if(t.value){throw e.buildCodeFrameError(`Fields with the 'declare' modifier cannot be initialized here, but only in the constructor`)}if(!t.decorators){e.remove()}}else if(t.definite){if(t.value){throw e.buildCodeFrameError(`Definitely assigned fields cannot be initialized here, but only in the constructor`)}{if(!h&&!t.decorators){e.remove()}}}else{if(!h&&!t.value&&!t.decorators&&!n.types.isClassPrivateProperty(t)){e.remove()}}if(t.accessibility)t.accessibility=null;if(t.abstract)t.abstract=null;if(t.readonly)t.readonly=null;if(t.optional)t.optional=null;if(t.typeAnnotation)t.typeAnnotation=null;if(t.definite)t.definite=null;if(t.declare)t.declare=null;if(t.override)t.override=null},method({node:e}){if(e.accessibility)e.accessibility=null;if(e.abstract)e.abstract=null;if(e.optional)e.optional=null;if(e.override)e.override=null},constructor(e,t){if(e.node.accessibility)e.node.accessibility=null;const r=[];for(const t of e.node.params){if(t.type==="TSParameterProperty"&&!d.has(t.parameter)){d.add(t.parameter);r.push(t.parameter)}}if(r.length){const s=r.map((t=>{let r;if(n.types.isIdentifier(t)){r=t}else if(n.types.isAssignmentPattern(t)&&n.types.isIdentifier(t.left)){r=t.left}else{throw e.buildCodeFrameError("Parameter properties can not be destructuring patterns.")}return n.template.statement.ast` - this.${n.types.cloneNode(r)} = ${n.types.cloneNode(r)}`}));(0,o.injectInitialization)(t,e,s)}}};return{name:"transform-typescript",inherits:a.default,visitor:{Pattern:visitPattern,Identifier:visitPattern,RestElement:visitPattern,Program:{enter(e,t){const{file:s}=t;let a=null;let n=null;if(!u.has(e.node)){u.set(e.node,new Set)}if(s.ast.comments){for(const e of s.ast.comments){const t=r.exec(e.value);if(t){if(t[1]){n=t[2]}else{a=t[2]}}}}let o=a||f;if(o){[o]=o.split(".")}let i=n||m;if(i){[i]=i.split(".")}for(let r of e.get("body")){if(r.isImportDeclaration()){if(!p.has(t.file.ast.program)){p.set(t.file.ast.program,true)}if(r.node.importKind==="type"){r.remove();continue}if(y){p.set(e.node,false)}else{if(r.node.specifiers.length===0){p.set(e.node,false);continue}let t=true;const s=[];for(const a of r.node.specifiers){const n=r.scope.getBinding(a.local.name);if(n&&isImportTypeOnly({binding:n,programPath:e,pragmaImportName:o,pragmaFragImportName:i})){s.push(n.path)}else{t=false;p.set(e.node,false)}}if(t){r.remove()}else{for(const e of s){e.remove()}}}continue}if(r.isExportDeclaration()){r=r.get("declaration")}if(r.isVariableDeclaration({declare:true})){for(const t of Object.keys(r.getBindingIdentifiers())){registerGlobalType(e.scope,t)}}else if(r.isTSTypeAliasDeclaration()||r.isTSDeclareFunction()&&r.get("id").isIdentifier()||r.isTSInterfaceDeclaration()||r.isClassDeclaration({declare:true})||r.isTSEnumDeclaration({declare:true})||r.isTSModuleDeclaration({declare:true})&&r.get("id").isIdentifier()){registerGlobalType(e.scope,r.node.id.name)}}},exit(e){if(e.node.sourceType==="module"&&p.get(e.node)){e.pushContainer("body",n.types.exportNamedDeclaration())}}},ExportNamedDeclaration(e,t){if(!p.has(t.file.ast.program)){p.set(t.file.ast.program,true)}if(e.node.exportKind==="type"){e.remove();return}if(!e.node.source&&e.node.specifiers.length>0&&e.node.specifiers.every((({local:t})=>isGlobalType(e,t.name)))){e.remove();return}p.set(t.file.ast.program,false)},ExportSpecifier(e){if(!e.parent.source&&isGlobalType(e,e.node.local.name)){e.remove()}},ExportDefaultDeclaration(e,t){if(!p.has(t.file.ast.program)){p.set(t.file.ast.program,true)}if(n.types.isIdentifier(e.node.declaration)&&isGlobalType(e,e.node.declaration.name)){e.remove();return}p.set(t.file.ast.program,false)},TSDeclareFunction(e){e.remove()},TSDeclareMethod(e){e.remove()},VariableDeclaration(e){if(e.node.declare){e.remove()}},VariableDeclarator({node:e}){if(e.definite)e.definite=null},TSIndexSignature(e){e.remove()},ClassDeclaration(e){const{node:t}=e;if(t.declare){e.remove();return}},Class(e){const{node:t}=e;if(t.typeParameters)t.typeParameters=null;if(t.superTypeParameters)t.superTypeParameters=null;if(t.implements)t.implements=null;if(t.abstract)t.abstract=null;e.get("body.body").forEach((t=>{if(t.isClassMethod()||t.isClassPrivateMethod()){if(t.node.kind==="constructor"){b.constructor(t,e)}else{b.method(t)}}else if(t.isClassProperty()||t.isClassPrivateProperty()){b.field(t)}}))},Function(e){const{node:t,scope:r}=e;if(t.typeParameters)t.typeParameters=null;if(t.returnType)t.returnType=null;const s=t.params;if(s.length>0&&n.types.isIdentifier(s[0],{name:"this"})){s.shift()}const a=e.get("params");for(const e of a){if(e.type==="TSParameterProperty"){e.replaceWith(e.get("parameter"));r.registerBinding("param",e)}}},TSModuleDeclaration(e){(0,c.default)(e,n.types,s)},TSInterfaceDeclaration(e){e.remove()},TSTypeAliasDeclaration(e){e.remove()},TSEnumDeclaration(e){if(g&&e.node.const){(0,i.default)(e,n.types)}else{(0,l.default)(e,n.types)}},TSImportEqualsDeclaration(e){if(n.types.isTSExternalModuleReference(e.node.moduleReference)){throw e.buildCodeFrameError(`\`import ${e.node.id.name} = require('${e.node.moduleReference.expression.value}')\` `+"is not supported by @babel/plugin-transform-typescript\n"+"Please consider using "+`\`import ${e.node.id.name} from '${e.node.moduleReference.expression.value}';\` alongside `+"Typescript's --allowSyntheticDefaultImports option.")}e.replaceWith(n.types.variableDeclaration("var",[n.types.variableDeclarator(e.node.id,entityNameToExpr(e.node.moduleReference))]))},TSExportAssignment(e){throw e.buildCodeFrameError("`export =` is not supported by @babel/plugin-transform-typescript\n"+"Please consider using `export ;`.")},TSTypeAssertion(e){e.replaceWith(e.node.expression)},TSAsExpression(e){let{node:t}=e;do{t=t.expression}while(n.types.isTSAsExpression(t));e.replaceWith(t)},TSNonNullExpression(e){e.replaceWith(e.node.expression)},CallExpression(e){e.node.typeParameters=null},OptionalCallExpression(e){e.node.typeParameters=null},NewExpression(e){e.node.typeParameters=null},JSXOpeningElement(e){e.node.typeParameters=null},TaggedTemplateExpression(e){e.node.typeParameters=null}}};function entityNameToExpr(e){if(n.types.isTSQualifiedName(e)){return n.types.memberExpression(entityNameToExpr(e.left),e.right)}return e}function visitPattern({node:e}){if(e.typeAnnotation)e.typeAnnotation=null;if(n.types.isIdentifier(e)&&e.optional)e.optional=null}function isImportTypeOnly({binding:e,programPath:t,pragmaImportName:r,pragmaFragImportName:s}){for(const t of e.referencePaths){if(!isInType(t)){return false}}if(e.identifier.name!==r&&e.identifier.name!==s){return true}let a=false;t.traverse({"JSXElement|JSXFragment"(e){a=true;e.stop()}});return!a}}));t["default"]=f},8820:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transpileNamespace;var s=r(8304);function transpileNamespace(e,t,r){if(e.node.declare||e.node.id.type==="StringLiteral"){e.remove();return}if(!r){throw e.hub.file.buildCodeFrameError(e.node.id,"Namespace not marked type-only declare."+" Non-declarative namespaces are only supported experimentally in Babel."+" To enable and review caveats see:"+" https://babeljs.io/docs/en/babel-plugin-transform-typescript")}const s=e.node.id.name;const a=handleNested(e,t,t.cloneDeep(e.node));const n=e.scope.hasOwnBinding(s);if(e.parent.type==="ExportNamedDeclaration"){if(!n){e.parentPath.insertAfter(a);e.replaceWith(getDeclaration(t,s));e.scope.registerDeclaration(e.parentPath)}else{e.parentPath.replaceWith(a)}}else if(n){e.replaceWith(a)}else{e.scope.registerDeclaration(e.replaceWithMultiple([getDeclaration(t,s),a])[0])}}function getDeclaration(e,t){return e.variableDeclaration("let",[e.variableDeclarator(e.identifier(t))])}function getMemberExpression(e,t,r){return e.memberExpression(e.identifier(t),e.identifier(r))}function handleVariableDeclaration(e,t,r){if(e.kind!=="const"){throw r.file.buildCodeFrameError(e,"Namespaces exporting non-const are not supported by Babel."+" Change to const or see:"+" https://babeljs.io/docs/en/babel-plugin-transform-typescript")}const{declarations:a}=e;if(a.every((e=>s.types.isIdentifier(e.id)))){for(const e of a){e.init=s.types.assignmentExpression("=",getMemberExpression(s.types,t,e.id.name),e.init)}return[e]}const n=s.types.getBindingIdentifiers(e);const o=[];for(const e in n){o.push(s.types.assignmentExpression("=",getMemberExpression(s.types,t,e),s.types.cloneNode(n[e])))}return[e,s.types.expressionStatement(s.types.sequenceExpression(o))]}function handleNested(e,t,r,a){const n=new Set;const o=r.id;const i=e.scope.generateUid(o.name);const l=r.body.body;for(let r=0;r{const t=o.types.objectExpression([o.types.objectProperty(o.types.identifier("key"),e.key)]);for(const r of["get","set","value"]){if(e[r]!=null){t.properties.push(o.types.objectProperty(o.types.identifier(r),e[r]))}}return t}))}}if(t.instance||t.static){let r=[o.types.cloneNode(p.classRef),t.instance?o.types.arrayExpression(t.instance):o.types.nullLiteral(),t.static?o.types.arrayExpression(t.static):o.types.nullLiteral()];let s=0;for(let e=0;eo.types.cloneNode(t);return t};for(const e of p.superThises){const{node:t,parentPath:r}=e;if(r.isMemberExpression({object:t})){e.replaceWith(thisRef());continue}e.replaceWith(o.types.callExpression(p.file.addHelper("assertThisInitialized"),[thisRef()]))}const r=new Set;e.traverse(o.traverse.visitors.merge([a.environmentVisitor,{Super(e){const{node:t,parentPath:s}=e;if(s.isCallExpression({callee:t})){r.add(s)}}}]));let s=!!r.size;for(const a of r){wrapSuperCall(a,p.superName,thisRef,t);if(s){a.find((function(t){if(t===e){return true}if(t.isLoop()||t.isConditional()||t.isArrowFunctionExpression()){s=false;return true}}))}}let n;if(p.isLoose){n=e=>{const t=o.types.callExpression(p.file.addHelper("assertThisInitialized"),[thisRef()]);return e?o.types.logicalExpression("||",e,t):t}}else{n=e=>o.types.callExpression(p.file.addHelper("possibleConstructorReturn"),[thisRef()].concat(e||[]))}const i=t.get("body");if(!i.length||!i.pop().isReturnStatement()){t.pushContainer("body",o.types.returnStatement(s?thisRef():n()))}for(const e of p.superReturns){e.get("argument").replaceWith(n(e.node.argument))}}function pushMethod(e,t){const r=t?t.scope:p.scope;if(e.kind==="method"){if(processMethod(e,r))return}const a=e.static?"static":"instance";const n=p.methods[a];const i=e.kind==="method"?"value":e.kind;const l=o.types.isNumericLiteral(e.key)||o.types.isBigIntLiteral(e.key)?o.types.stringLiteral(String(e.key.value)):o.types.toComputedKey(e);let c=o.types.toExpression(e);if(o.types.isStringLiteral(l)){if(e.kind==="method"){c=(0,s.default)({id:l,node:e,scope:r})}}else{n.hasComputed=true}let u;if(!n.hasComputed&&n.map.has(l.value)){u=n.map.get(l.value);u[i]=c;if(i==="value"){u.get=null;u.set=null}else{u.value=null}}else{u={key:l,[i]:c};n.list.push(u);if(!n.hasComputed){n.map.set(l.value,u)}}}function processMethod(e,t){if(u.setClassMethods&&!e.decorators){let{classRef:r}=p;if(!e.static){insertProtoAliasOnce();r=p.protoAlias}const a=o.types.memberExpression(o.types.cloneNode(r),e.key,e.computed||o.types.isLiteral(e.key));let n=o.types.functionExpression(null,e.params,e.body,e.generator,e.async);o.types.inherits(n,e);const i=o.types.toComputedKey(e,e.key);if(o.types.isStringLiteral(i)){n=(0,s.default)({node:n,id:i,scope:t})}const l=o.types.expressionStatement(o.types.assignmentExpression("=",a,n));o.types.inheritsComments(l,e);p.body.push(l);return true}return false}function insertProtoAliasOnce(){if(p.protoAlias===null){setState({protoAlias:p.scope.generateUidIdentifier("proto")});const e=o.types.memberExpression(p.classRef,o.types.identifier("prototype"));const t=o.types.variableDeclaration("var",[o.types.variableDeclarator(p.protoAlias,e)]);p.body.push(t)}}function pushConstructor(e,t,r){setState({userConstructorPath:r,userConstructor:t,hasConstructor:true,superReturns:e});const{construct:s}=p;o.types.inheritsComments(s,t);s.params=t.params;o.types.inherits(s.body,t.body);s.body.directives=t.body.directives;pushConstructorToBody()}function pushConstructorToBody(){if(p.pushedConstructor)return;p.pushedConstructor=true;if(p.hasInstanceDescriptors||p.hasStaticDescriptors){pushDescriptors()}p.body.push(p.construct);pushInheritsToBody()}function pushInheritsToBody(){if(!p.isDerived||p.pushedInherits)return;const t=e.scope.generateUidIdentifier("super");setState({pushedInherits:true,superFnId:t});if(!u.superIsCallableConstructor){p.body.unshift(o.types.variableDeclaration("var",[o.types.variableDeclarator(t,o.types.callExpression((0,l.default)(p.file),[o.types.cloneNode(p.classRef)]))]))}p.body.unshift(o.types.expressionStatement(o.types.callExpression(p.file.addHelper(p.isLoose?"inheritsLoose":"inherits"),[o.types.cloneNode(p.classRef),o.types.cloneNode(p.superName)])))}function extractDynamicKeys(){const{dynamicKeys:e,node:t,scope:r}=p;for(const s of t.body.body){if(!o.types.isClassMethod(s)||!s.computed)continue;if(r.isPure(s.key,true))continue;const t=r.generateUidIdentifierBasedOnNode(s.key);e.set(t.name,s.key);s.key=t}}function setupClosureParamsArgs(){const{superName:e,dynamicKeys:t}=p;const r=[];const s=[];if(p.isDerived){let t=o.types.cloneNode(e);if(p.extendsNative){t=o.types.callExpression(p.file.addHelper("wrapNativeSuper"),[t]);(0,i.default)(t)}const a=p.scope.generateUidIdentifierBasedOnNode(e);r.push(a);s.push(t);setState({superName:o.types.cloneNode(a)})}for(const[e,a]of t){r.push(o.types.identifier(e));s.push(a)}return{closureParams:r,closureArgs:s}}function classTransformer(e,t,r,s){setState({parent:e.parent,scope:e.scope,node:e.node,path:e,file:t,isLoose:s});setState({classId:p.node.id,classRef:p.node.id?o.types.identifier(p.node.id.name):p.scope.generateUidIdentifier("class"),superName:p.node.superClass,isDerived:!!p.node.superClass,constructorBody:o.types.blockStatement([])});setState({extendsNative:p.isDerived&&r.has(p.superName.name)&&!p.scope.hasBinding(p.superName.name,true)});const{classRef:a,node:n,constructorBody:i}=p;setState({construct:buildConstructor(a,i,n)});extractDynamicKeys();let{body:l}=p;const{closureParams:c,closureArgs:f}=setupClosureParamsArgs();buildBody();if(!u.noClassCalls){i.body.unshift(o.types.expressionStatement(o.types.callExpression(p.file.addHelper("classCallCheck"),[o.types.thisExpression(),o.types.cloneNode(p.classRef)])))}l=l.concat(p.staticPropBody.map((e=>e(o.types.cloneNode(p.classRef)))));const d=e.isInStrictMode();let m=p.classId&&l.length===1;if(m&&!d){for(const e of p.construct.params){if(!o.types.isIdentifier(e)){m=false;break}}}const y=m?l[0].body.directives:[];if(!d){y.push(o.types.directive(o.types.directiveLiteral("use strict")))}if(m){return o.types.toExpression(l[0])}l.push(o.types.returnStatement(o.types.cloneNode(p.classRef)));const g=o.types.arrowFunctionExpression(c,o.types.blockStatement(l,y));return o.types.callExpression(g,f)}return classTransformer(e,t,r,c)}},5157:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(8304);var n=(0,s.declare)(((e,t)=>{var r,s,n;e.assertVersion(7);const{useBuiltIns:o=false}=t;const i=(r=e.assumption("iterableIsArray"))!=null?r:t.loose;const l=(s=t.allowArrayLike)!=null?s:e.assumption("arrayLikeIsIterable");const c=(n=e.assumption("objectRestNoSymbols"))!=null?n:t.loose;function getExtendsHelper(e){return o?a.types.memberExpression(a.types.identifier("Object"),a.types.identifier("assign")):e.addHelper("extends")}function variableDeclarationHasPattern(e){for(const t of e.declarations){if(a.types.isPattern(t.id)){return true}}return false}function hasRest(e){for(const t of e.elements){if(a.types.isRestElement(t)){return true}}return false}function hasObjectRest(e){for(const t of e.properties){if(a.types.isRestElement(t)){return true}}return false}const u={};const arrayUnpackVisitor=(e,t,r)=>{if(!t.length){return}if(a.types.isIdentifier(e)&&a.types.isReferenced(e,t[t.length-1])&&r.bindings[e.name]){r.deopt=true;throw u}};class DestructuringTransformer{constructor(e){this.blockHoist=e.blockHoist;this.operator=e.operator;this.arrays={};this.nodes=e.nodes||[];this.scope=e.scope;this.kind=e.kind;this.iterableIsArray=e.iterableIsArray;this.arrayLikeIsIterable=e.arrayLikeIsIterable;this.addHelper=e.addHelper}buildVariableAssignment(e,t){let r=this.operator;if(a.types.isMemberExpression(e))r="=";let s;if(r){s=a.types.expressionStatement(a.types.assignmentExpression(r,e,a.types.cloneNode(t)||this.scope.buildUndefinedNode()))}else{s=a.types.variableDeclaration(this.kind,[a.types.variableDeclarator(e,a.types.cloneNode(t))])}s._blockHoist=this.blockHoist;return s}buildVariableDeclaration(e,t){const r=a.types.variableDeclaration("var",[a.types.variableDeclarator(a.types.cloneNode(e),a.types.cloneNode(t))]);r._blockHoist=this.blockHoist;return r}push(e,t){const r=a.types.cloneNode(t);if(a.types.isObjectPattern(e)){this.pushObjectPattern(e,r)}else if(a.types.isArrayPattern(e)){this.pushArrayPattern(e,r)}else if(a.types.isAssignmentPattern(e)){this.pushAssignmentPattern(e,r)}else{this.nodes.push(this.buildVariableAssignment(e,r))}}toArray(e,t){if(this.iterableIsArray||a.types.isIdentifier(e)&&this.arrays[e.name]){return e}else{return this.scope.toArray(e,t,this.arrayLikeIsIterable)}}pushAssignmentPattern({left:e,right:t},r){const s=this.scope.generateUidIdentifierBasedOnNode(r);this.nodes.push(this.buildVariableDeclaration(s,r));const n=a.types.conditionalExpression(a.types.binaryExpression("===",a.types.cloneNode(s),this.scope.buildUndefinedNode()),t,a.types.cloneNode(s));if(a.types.isPattern(e)){let t;let r;if(this.kind==="const"||this.kind==="let"){t=this.scope.generateUidIdentifier(s.name);r=this.buildVariableDeclaration(t,n)}else{t=s;r=a.types.expressionStatement(a.types.assignmentExpression("=",a.types.cloneNode(s),n))}this.nodes.push(r);this.push(e,t)}else{this.nodes.push(this.buildVariableAssignment(e,n))}}pushObjectRest(e,t,r,s){const n=[];let o=true;let i=false;for(let t=0;t=s)break;if(a.types.isRestElement(r))continue;const l=r.key;if(a.types.isIdentifier(l)&&!r.computed){n.push(a.types.stringLiteral(l.name))}else if(a.types.isTemplateLiteral(l)){n.push(a.types.cloneNode(l));i=true}else if(a.types.isLiteral(l)){n.push(a.types.stringLiteral(String(l.value)))}else{n.push(a.types.cloneNode(l));o=false}}let l;if(n.length===0){l=a.types.callExpression(getExtendsHelper(this),[a.types.objectExpression([]),a.types.cloneNode(t)])}else{let e=a.types.arrayExpression(n);if(!o){e=a.types.callExpression(a.types.memberExpression(e,a.types.identifier("map")),[this.addHelper("toPropertyKey")])}else if(!i&&!a.types.isProgram(this.scope.block)){const t=this.scope.path.findParent((e=>e.isProgram()));const r=this.scope.generateUidIdentifier("excluded");t.scope.push({id:r,init:e,kind:"const"});e=a.types.cloneNode(r)}l=a.types.callExpression(this.addHelper(`objectWithoutProperties${c?"Loose":""}`),[a.types.cloneNode(t),e])}this.nodes.push(this.buildVariableAssignment(r.argument,l))}pushObjectProperty(e,t){if(a.types.isLiteral(e.key))e.computed=true;const r=e.value;const s=a.types.memberExpression(a.types.cloneNode(t),e.key,e.computed);if(a.types.isPattern(r)){this.push(r,s)}else{this.nodes.push(this.buildVariableAssignment(r,s))}}pushObjectPattern(e,t){if(!e.properties.length){this.nodes.push(a.types.expressionStatement(a.types.callExpression(this.addHelper("objectDestructuringEmpty"),[t])))}if(e.properties.length>1&&!this.scope.isStatic(t)){const e=this.scope.generateUidIdentifierBasedOnNode(t);this.nodes.push(this.buildVariableDeclaration(e,t));t=e}if(hasObjectRest(e)){let t;for(let r=0;rt.elements.length)return;if(e.elements.lengththis.addHelper(e)});u.init(n,o);e.ensureBlock();const p=t.body;p.body=c.concat(p.body)},CatchClause({node:e,scope:t}){const r=e.param;if(!a.types.isPattern(r))return;const s=t.generateUidIdentifier("ref");e.param=s;const n=[];const o=new DestructuringTransformer({kind:"let",scope:t,nodes:n,iterableIsArray:i,arrayLikeIsIterable:l,addHelper:e=>this.addHelper(e)});o.init(r,s);e.body.body=n.concat(e.body.body)},AssignmentExpression(e){const{node:t,scope:r}=e;if(!a.types.isPattern(t.left))return;const s=[];const n=new DestructuringTransformer({operator:t.operator,scope:r,nodes:s,iterableIsArray:i,arrayLikeIsIterable:l,addHelper:e=>this.addHelper(e)});let o;if(e.isCompletionRecord()||!e.parentPath.isExpressionStatement()){o=r.generateUidIdentifierBasedOnNode(t.right,"ref");s.push(a.types.variableDeclaration("var",[a.types.variableDeclarator(o,t.right)]));if(a.types.isArrayExpression(t.right)){n.arrays[o.name]=true}}n.init(t.left,o||t.right);if(o){if(e.parentPath.isArrowFunctionExpression()){e.replaceWith(a.types.blockStatement([]));s.push(a.types.returnStatement(a.types.cloneNode(o)))}else{s.push(a.types.expressionStatement(a.types.cloneNode(o)))}}e.replaceWithMultiple(s);e.scope.crawl()},VariableDeclaration(e){const{node:t,scope:r,parent:s}=e;if(a.types.isForXStatement(s))return;if(!s||!e.container)return;if(!variableDeclarationHasPattern(t))return;const n=t.kind;const o=t.loc;const c=[];let u;for(let e=0;ethis.addHelper(e)});if(a.types.isPattern(n)){o.init(n,s);if(+e!==t.declarations.length-1){a.types.inherits(c[c.length-1],u)}}else{c.push(a.types.inherits(o.buildVariableAssignment(u.id,a.types.cloneNode(u.init)),u))}}let p=null;const f=[];for(const e of c){if(p!==null&&a.types.isVariableDeclaration(e)){p.declarations.push(...e.declarations)}else{e.kind=n;if(!e.loc){e.loc=o}f.push(e);p=a.types.isVariableDeclaration(e)?e:null}}for(const e of f){if(!e.declarations)continue;for(const t of e.declarations){const{name:s}=t.id;if(r.bindings[s]){r.bindings[s].kind=e.kind}}}if(f.length===1){e.replaceWith(f[0])}else{e.replaceWithMultiple(f)}}}}}));t["default"]=n},5843:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(6550);var a=r(558);var n=(0,a.declare)((e=>{e.assertVersion(7);return(0,s.createRegExpFeaturePlugin)({name:"transform-dotall-regex",feature:"dotAllFlag"})}));t["default"]=n},8447:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(6550);function _default(e,t){const{runtime:r=true}=t;if(typeof r!=="boolean"){throw new Error("The 'runtime' option must be boolean")}return(0,s.createRegExpFeaturePlugin)({name:"transform-named-capturing-groups-regex",feature:"namedCaptureGroups",options:{runtime:r}})}},5628:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(9522);var a=s.default;t["default"]=a},2228:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(1017);var a=r(8188);function _default(e,t,r){if(r===false)return e;return resolveAbsoluteRuntime(e,s.resolve(t,r===true?".":r))}function resolveAbsoluteRuntime(e,t){try{return s.dirname((((e,t)=>(e=e.split("."),t=t.split("."),+e[0]>+t[0]||e[0]==t[0]&&+e[1]>=+t[1]))(process.versions.node,"8.9")?require.resolve:(e,{paths:[t]},s=r(8188))=>{let a=s._findPath(e,s._nodeModulePaths(t).concat(t));if(a)return a;a=new Error(`Cannot resolve module '${e}'`);a.code="MODULE_NOT_FOUND";throw a})(`${e}/package.json`,{paths:[t]})).replace(/\\/g,"/")}catch(r){if(r.code!=="MODULE_NOT_FOUND")throw r;throw Object.assign(new Error(`Failed to resolve "${e}" relative to "${t}"`),{code:"BABEL_RUNTIME_NOT_FOUND",runtime:e,dirname:t})}}},3286:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasMinVersion=hasMinVersion;var s=r(7849);function hasMinVersion(e,t){if(!t)return true;if(s.valid(t))t=`^${t}`;return!s.intersects(`<${e}`,t)&&!s.intersects(`>=8.0.0`,t)}},4722:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(9115);var n=r(8304);var o=r(3286);var i=r(2228);var l=r(9897);var c=r(5825);var u=r(7973);const p=l.default||l;const f=c.default||c;const d=u.default||u;const m="#__secret_key__@babel/runtime__compatibility";function supportsStaticESM(e){return!!(e!=null&&e.supportsStaticESM)}var y=(0,s.declare)(((e,t,r)=>{e.assertVersion(7);const{corejs:s,helpers:l=true,regenerator:c=true,useESModules:u=false,version:y="7.0.0-beta.0",absoluteRuntime:g=false}=t;let h=false;let b;if(typeof s==="object"&&s!==null){b=s.version;h=Boolean(s.proposals)}else{b=s}const x=b?Number(b):false;if(![false,2,3].includes(x)){throw new Error(`The \`core-js\` version must be false, 2 or 3, but got ${JSON.stringify(b)}.`)}if(h&&(!x||x<3)){throw new Error("The 'proposals' option is only supported when using 'corejs: 3'")}if(typeof c!=="boolean"){throw new Error("The 'regenerator' option must be undefined, or a boolean.")}if(typeof l!=="boolean"){throw new Error("The 'helpers' option must be undefined, or a boolean.")}if(typeof u!=="boolean"&&u!=="auto"){throw new Error("The 'useESModules' option must be undefined, or a boolean, or 'auto'.")}if(typeof g!=="boolean"&&typeof g!=="string"){throw new Error("The 'absoluteRuntime' option must be undefined, a boolean, or a string.")}if(typeof y!=="string"){throw new Error(`The 'version' option must be a version string.`)}const v="7.13.0";const E=(0,o.hasMinVersion)(v,y);function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}if(has(t,"useBuiltIns")){if(t.useBuiltIns){throw new Error("The 'useBuiltIns' option has been removed. The @babel/runtime "+"module now uses builtins by default.")}else{throw new Error("The 'useBuiltIns' option has been removed. Use the 'corejs'"+"option to polyfill with `core-js` via @babel/runtime.")}}if(has(t,"polyfill")){if(t.polyfill===false){throw new Error("The 'polyfill' option has been removed. The @babel/runtime "+"module now skips polyfilling by default.")}else{throw new Error("The 'polyfill' option has been removed. Use the 'corejs'"+"option to polyfill with `core-js` via @babel/runtime.")}}if(has(t,"moduleName")){throw new Error("The 'moduleName' option has been removed. @babel/transform-runtime "+"no longer supports arbitrary runtimes. If you were using this to "+"set an absolute path for Babel's standard runtimes, please use the "+"'absoluteRuntime' option.")}const j=u==="auto"?e.caller(supportsStaticESM):u;const w=x===2;const _=x===3;const S=_?"@babel/runtime-corejs3":w?"@babel/runtime-corejs2":"@babel/runtime";const k=["interopRequireWildcard","interopRequireDefault"];const O=(0,i.default)(S,r,g);function createCorejsPlgin(e,t,r){return(s,a,n)=>Object.assign({},e(s,t,n),{inherits:r})}function createRegeneratorPlugin(e){if(!c)return undefined;return(t,r,s)=>d(t,e,s)}const I=g?".js":"";return{name:"transform-runtime",inherits:w?createCorejsPlgin(p,{method:"usage-pure",[m]:{runtimeVersion:y,useBabelRuntime:O,ext:I}},createRegeneratorPlugin({method:"usage-pure",[m]:{useBabelRuntime:O}})):_?createCorejsPlgin(f,{method:"usage-pure",version:3,proposals:h,[m]:{useBabelRuntime:O,ext:I}},createRegeneratorPlugin({method:"usage-pure",[m]:{useBabelRuntime:O}})):createRegeneratorPlugin({method:"usage-pure",[m]:{useBabelRuntime:O}}),pre(e){if(!l)return;e.set("helperGenerator",(t=>{if(e.availableHelper&&!e.availableHelper(t,y)){return}const r=k.indexOf(t)!==-1;const s=r&&!(0,a.isModule)(e.path)?4:undefined;const n=j&&e.path.node.sourceType==="module"?"helpers/esm":"helpers";return addDefaultImport(`${O}/${n}/${t}`,t,s,true)}));const t=new Map;function addDefaultImport(r,s,o,i=false){const l=(0,a.isModule)(e.path);const c=`${r}:${s}:${l||""}`;let u=t.get(c);if(u){u=n.types.cloneNode(u)}else{u=(0,a.addDefault)(e.path,r,{importedInterop:i&&E?"compiled":"uncompiled",nameHint:s,blockHoist:o});t.set(c,u)}return u}}}}));t["default"]=y},749:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transpileConstEnum;var s=r(3803);function transpileConstEnum(e,t){const{name:r}=e.node.id;const a=e.parentPath.isExportNamedDeclaration();let n=a;if(!n&&t.isProgram(e.parent)){n=e.parent.body.some((e=>t.isExportNamedDeclaration(e)&&!e.source&&e.specifiers.some((e=>t.isExportSpecifier(e)&&e.local.name===r))))}const o=(0,s.translateEnumValues)(e,t);if(n){const s=t.objectExpression(o.map((([e,r])=>t.objectProperty(t.isValidIdentifier(e)?t.identifier(e):t.stringLiteral(e),r))));if(e.scope.hasOwnBinding(r)){(a?e.parentPath:e).replaceWith(t.expressionStatement(t.callExpression(t.memberExpression(t.identifier("Object"),t.identifier("assign")),[e.node.id,s])))}else{e.replaceWith(t.variableDeclaration("var",[t.variableDeclarator(e.node.id,s)]));e.scope.registerDeclaration(e)}return}const i=new Map(o);e.scope.path.traverse({Scope(e){if(e.scope.hasOwnBinding(r))e.skip()},MemberExpression(e){if(!t.isIdentifier(e.node.object,{name:r}))return;let s;if(e.node.computed){if(t.isStringLiteral(e.node.property)){s=e.node.property.value}else{return}}else if(t.isIdentifier(e.node.property)){s=e.node.property.name}else{return}if(!i.has(s))return;e.replaceWith(t.cloneNode(i.get(s)))}});e.remove()}},3803:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transpileEnum;t.translateEnumValues=translateEnumValues;var s=r(9491);var a=r(8304);function transpileEnum(e,t){const{node:r}=e;if(r.declare){e.remove();return}const s=r.id.name;const a=enumFill(e,t,r.id);switch(e.parent.type){case"BlockStatement":case"ExportNamedDeclaration":case"Program":{e.insertAfter(a);if(seen(e.parentPath)){e.remove()}else{const s=t.isProgram(e.parent);e.scope.registerDeclaration(e.replaceWith(makeVar(r.id,t,s?"var":"let"))[0])}break}default:throw new Error(`Unexpected enum parent '${e.parent.type}`)}function seen(e){if(e.isExportDeclaration()){return seen(e.parentPath)}if(e.getData(s)){return true}else{e.setData(s,true);return false}}}function makeVar(e,t,r){return t.variableDeclaration(r,[t.variableDeclarator(e)])}const n=(0,a.template)(`\n (function (ID) {\n ASSIGNMENTS;\n })(ID || (ID = {}));\n`);const o=(0,a.template)(`\n ENUM["NAME"] = VALUE;\n`);const i=(0,a.template)(`\n ENUM[ENUM["NAME"] = VALUE] = "NAME";\n`);const buildEnumMember=(e,t)=>(e?o:i)(t);function enumFill(e,t,r){const s=translateEnumValues(e,t);const a=s.map((([e,s])=>buildEnumMember(t.isStringLiteral(s),{ENUM:t.cloneNode(r),NAME:e,VALUE:s})));return n({ID:t.cloneNode(r),ASSIGNMENTS:a})}function translateEnumValues(e,t){const r=Object.create(null);let a=-1;return e.node.members.map((n=>{const o=t.isIdentifier(n.id)?n.id.name:n.id.value;const i=n.initializer;let l;if(i){const e=evaluate(i,r);if(e!==undefined){r[o]=e;if(typeof e==="number"){l=t.numericLiteral(e);a=e}else{s(typeof e==="string");l=t.stringLiteral(e);a=undefined}}else{l=i;a=undefined}}else{if(a!==undefined){a++;l=t.numericLiteral(a);r[o]=a}else{throw e.buildCodeFrameError("Enum member must have initializer.")}}return[o,l]}))}function evaluate(e,t){return evalConstant(e);function evalConstant(e){switch(e.type){case"StringLiteral":return e.value;case"UnaryExpression":return evalUnaryExpression(e);case"BinaryExpression":return evalBinaryExpression(e);case"NumericLiteral":return e.value;case"ParenthesizedExpression":return evalConstant(e.expression);case"Identifier":return t[e.name];case"TemplateLiteral":if(e.quasis.length===1){return e.quasis[0].value.cooked}default:return undefined}}function evalUnaryExpression({argument:e,operator:t}){const r=evalConstant(e);if(r===undefined){return undefined}switch(t){case"+":return r;case"-":return-r;case"~":return~r;default:return undefined}}function evalBinaryExpression(e){const t=evalConstant(e.left);if(t===undefined){return undefined}const r=evalConstant(e.right);if(r===undefined){return undefined}switch(e.operator){case"|":return t|r;case"&":return t&r;case">>":return t>>r;case">>>":return t>>>r;case"<<":return t<{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var s=r(558);var a=r(6050);var n=r(8304);var o=r(738);var i=r(749);var l=r(3803);var c=r(8820);function isInType(e){switch(e.parent.type){case"TSTypeReference":case"TSQualifiedName":case"TSExpressionWithTypeArguments":case"TSTypeQuery":return true;case"ExportSpecifier":return e.parentPath.parent.exportKind==="type";default:return false}}const u=new WeakMap;const p=new WeakMap;const f=new WeakSet;function isGlobalType(e,t){const r=e.find((e=>e.isProgram())).node;if(e.scope.hasOwnBinding(t))return false;if(u.get(r).has(t))return true;console.warn(`The exported identifier "${t}" is not declared in Babel's scope tracker\n`+`as a JavaScript value binding, and "@babel/plugin-transform-typescript"\n`+`never encountered it as a TypeScript type declaration.\n`+`It will be treated as a JavaScript value.\n\n`+`This problem is likely caused by another plugin injecting\n`+`"${t}" without registering it in the scope tracker. If you are the author\n`+` of that plugin, please use "scope.registerDeclaration(declarationPath)".`);return false}function registerGlobalType(e,t){u.get(e.path.node).add(t)}var d=(0,s.declare)(((e,t)=>{e.assertVersion(7);const r=/\*?\s*@jsx((?:Frag)?)\s+([^\s]+)/;const{allowNamespaces:s=true,jsxPragma:d="React.createElement",jsxPragmaFrag:m="React.Fragment",onlyRemoveTypeImports:y=false,optimizeConstEnums:g=false}=t;{var{allowDeclareFields:h=false}=t}const b={field(e){const{node:t}=e;{if(!h&&t.declare){throw e.buildCodeFrameError(`The 'declare' modifier is only allowed when the 'allowDeclareFields' option of `+`@babel/plugin-transform-typescript or @babel/preset-typescript is enabled.`)}}if(t.declare){if(t.value){throw e.buildCodeFrameError(`Fields with the 'declare' modifier cannot be initialized here, but only in the constructor`)}if(!t.decorators){e.remove()}}else if(t.definite){if(t.value){throw e.buildCodeFrameError(`Definitely assigned fields cannot be initialized here, but only in the constructor`)}{if(!h&&!t.decorators){e.remove()}}}else{if(!h&&!t.value&&!t.decorators&&!n.types.isClassPrivateProperty(t)){e.remove()}}if(t.accessibility)t.accessibility=null;if(t.abstract)t.abstract=null;if(t.readonly)t.readonly=null;if(t.optional)t.optional=null;if(t.typeAnnotation)t.typeAnnotation=null;if(t.definite)t.definite=null;if(t.declare)t.declare=null;if(t.override)t.override=null},method({node:e}){if(e.accessibility)e.accessibility=null;if(e.abstract)e.abstract=null;if(e.optional)e.optional=null;if(e.override)e.override=null},constructor(e,t){if(e.node.accessibility)e.node.accessibility=null;const r=[];for(const t of e.node.params){if(t.type==="TSParameterProperty"&&!f.has(t.parameter)){f.add(t.parameter);r.push(t.parameter)}}if(r.length){const s=r.map((t=>{let r;if(n.types.isIdentifier(t)){r=t}else if(n.types.isAssignmentPattern(t)&&n.types.isIdentifier(t.left)){r=t.left}else{throw e.buildCodeFrameError("Parameter properties can not be destructuring patterns.")}return n.template.statement.ast` + this.${n.types.cloneNode(r)} = ${n.types.cloneNode(r)}`}));(0,o.injectInitialization)(t,e,s)}}};return{name:"transform-typescript",inherits:a.default,visitor:{Pattern:visitPattern,Identifier:visitPattern,RestElement:visitPattern,Program:{enter(e,t){const{file:s}=t;let a=null;let n=null;if(!u.has(e.node)){u.set(e.node,new Set)}if(s.ast.comments){for(const e of s.ast.comments){const t=r.exec(e.value);if(t){if(t[1]){n=t[2]}else{a=t[2]}}}}let o=a||d;if(o){[o]=o.split(".")}let i=n||m;if(i){[i]=i.split(".")}for(let r of e.get("body")){if(r.isImportDeclaration()){if(!p.has(t.file.ast.program)){p.set(t.file.ast.program,true)}if(r.node.importKind==="type"){r.remove();continue}if(y){p.set(e.node,false)}else{if(r.node.specifiers.length===0){p.set(e.node,false);continue}let t=true;const s=[];for(const a of r.node.specifiers){const n=r.scope.getBinding(a.local.name);if(n&&isImportTypeOnly({binding:n,programPath:e,pragmaImportName:o,pragmaFragImportName:i})){s.push(n.path)}else{t=false;p.set(e.node,false)}}if(t){r.remove()}else{for(const e of s){e.remove()}}}continue}if(r.isExportDeclaration()){r=r.get("declaration")}if(r.isVariableDeclaration({declare:true})){for(const t of Object.keys(r.getBindingIdentifiers())){registerGlobalType(e.scope,t)}}else if(r.isTSTypeAliasDeclaration()||r.isTSDeclareFunction()&&r.get("id").isIdentifier()||r.isTSInterfaceDeclaration()||r.isClassDeclaration({declare:true})||r.isTSEnumDeclaration({declare:true})||r.isTSModuleDeclaration({declare:true})&&r.get("id").isIdentifier()){registerGlobalType(e.scope,r.node.id.name)}}},exit(e){if(e.node.sourceType==="module"&&p.get(e.node)){e.pushContainer("body",n.types.exportNamedDeclaration())}}},ExportNamedDeclaration(e,t){if(!p.has(t.file.ast.program)){p.set(t.file.ast.program,true)}if(e.node.exportKind==="type"){e.remove();return}if(!e.node.source&&e.node.specifiers.length>0&&e.node.specifiers.every((({local:t})=>isGlobalType(e,t.name)))){e.remove();return}p.set(t.file.ast.program,false)},ExportSpecifier(e){if(!e.parent.source&&isGlobalType(e,e.node.local.name)){e.remove()}},ExportDefaultDeclaration(e,t){if(!p.has(t.file.ast.program)){p.set(t.file.ast.program,true)}if(n.types.isIdentifier(e.node.declaration)&&isGlobalType(e,e.node.declaration.name)){e.remove();return}p.set(t.file.ast.program,false)},TSDeclareFunction(e){e.remove()},TSDeclareMethod(e){e.remove()},VariableDeclaration(e){if(e.node.declare){e.remove()}},VariableDeclarator({node:e}){if(e.definite)e.definite=null},TSIndexSignature(e){e.remove()},ClassDeclaration(e){const{node:t}=e;if(t.declare){e.remove();return}},Class(e){const{node:t}=e;if(t.typeParameters)t.typeParameters=null;if(t.superTypeParameters)t.superTypeParameters=null;if(t.implements)t.implements=null;if(t.abstract)t.abstract=null;e.get("body.body").forEach((t=>{if(t.isClassMethod()||t.isClassPrivateMethod()){if(t.node.kind==="constructor"){b.constructor(t,e)}else{b.method(t)}}else if(t.isClassProperty()||t.isClassPrivateProperty()){b.field(t)}}))},Function(e){const{node:t,scope:r}=e;if(t.typeParameters)t.typeParameters=null;if(t.returnType)t.returnType=null;const s=t.params;if(s.length>0&&n.types.isIdentifier(s[0],{name:"this"})){s.shift()}const a=e.get("params");for(const e of a){if(e.type==="TSParameterProperty"){e.replaceWith(e.get("parameter"));r.registerBinding("param",e)}}},TSModuleDeclaration(e){(0,c.default)(e,n.types,s)},TSInterfaceDeclaration(e){e.remove()},TSTypeAliasDeclaration(e){e.remove()},TSEnumDeclaration(e){if(g&&e.node.const){(0,i.default)(e,n.types)}else{(0,l.default)(e,n.types)}},TSImportEqualsDeclaration(e){if(n.types.isTSExternalModuleReference(e.node.moduleReference)){throw e.buildCodeFrameError(`\`import ${e.node.id.name} = require('${e.node.moduleReference.expression.value}')\` `+"is not supported by @babel/plugin-transform-typescript\n"+"Please consider using "+`\`import ${e.node.id.name} from '${e.node.moduleReference.expression.value}';\` alongside `+"Typescript's --allowSyntheticDefaultImports option.")}e.replaceWith(n.types.variableDeclaration("var",[n.types.variableDeclarator(e.node.id,entityNameToExpr(e.node.moduleReference))]))},TSExportAssignment(e){throw e.buildCodeFrameError("`export =` is not supported by @babel/plugin-transform-typescript\n"+"Please consider using `export ;`.")},TSTypeAssertion(e){e.replaceWith(e.node.expression)},TSAsExpression(e){let{node:t}=e;do{t=t.expression}while(n.types.isTSAsExpression(t));e.replaceWith(t)},TSNonNullExpression(e){e.replaceWith(e.node.expression)},CallExpression(e){e.node.typeParameters=null},OptionalCallExpression(e){e.node.typeParameters=null},NewExpression(e){e.node.typeParameters=null},JSXOpeningElement(e){e.node.typeParameters=null},TaggedTemplateExpression(e){e.node.typeParameters=null}}};function entityNameToExpr(e){if(n.types.isTSQualifiedName(e)){return n.types.memberExpression(entityNameToExpr(e.left),e.right)}return e}function visitPattern({node:e}){if(e.typeAnnotation)e.typeAnnotation=null;if(n.types.isIdentifier(e)&&e.optional)e.optional=null}function isImportTypeOnly({binding:e,programPath:t,pragmaImportName:r,pragmaFragImportName:s}){for(const t of e.referencePaths){if(!isInType(t)){return false}}if(e.identifier.name!==r&&e.identifier.name!==s){return true}let a=false;t.traverse({"JSXElement|JSXFragment"(e){a=true;e.stop()}});return!a}}));t["default"]=d},8820:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=transpileNamespace;var s=r(8304);function transpileNamespace(e,t,r){if(e.node.declare||e.node.id.type==="StringLiteral"){e.remove();return}if(!r){throw e.hub.file.buildCodeFrameError(e.node.id,"Namespace not marked type-only declare."+" Non-declarative namespaces are only supported experimentally in Babel."+" To enable and review caveats see:"+" https://babeljs.io/docs/en/babel-plugin-transform-typescript")}const s=e.node.id.name;const a=handleNested(e,t,t.cloneDeep(e.node));const n=e.scope.hasOwnBinding(s);if(e.parent.type==="ExportNamedDeclaration"){if(!n){e.parentPath.insertAfter(a);e.replaceWith(getDeclaration(t,s));e.scope.registerDeclaration(e.parentPath)}else{e.parentPath.replaceWith(a)}}else if(n){e.replaceWith(a)}else{e.scope.registerDeclaration(e.replaceWithMultiple([getDeclaration(t,s),a])[0])}}function getDeclaration(e,t){return e.variableDeclaration("let",[e.variableDeclarator(e.identifier(t))])}function getMemberExpression(e,t,r){return e.memberExpression(e.identifier(t),e.identifier(r))}function handleVariableDeclaration(e,t,r){if(e.kind!=="const"){throw r.file.buildCodeFrameError(e,"Namespaces exporting non-const are not supported by Babel."+" Change to const or see:"+" https://babeljs.io/docs/en/babel-plugin-transform-typescript")}const{declarations:a}=e;if(a.every((e=>s.types.isIdentifier(e.id)))){for(const e of a){e.init=s.types.assignmentExpression("=",getMemberExpression(s.types,t,e.id.name),e.init)}return[e]}const n=s.types.getBindingIdentifiers(e);const o=[];for(const e in n){o.push(s.types.assignmentExpression("=",getMemberExpression(s.types,t,e),s.types.cloneNode(n[e])))}return[e,s.types.expressionStatement(s.types.sequenceExpression(o))]}function handleNested(e,t,r,a){const n=new Set;const o=r.id;const i=e.scope.generateUid(o.name);const l=r.body.body;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasOwnDecorators=hasOwnDecorators;t.hasDecorators=hasDecorators;t.buildDecoratedClass=buildDecoratedClass;var s=r(8304);var a=r(4725);var n=r(550);function hasOwnDecorators(e){return!!(e.decorators&&e.decorators.length)}function hasDecorators(e){return hasOwnDecorators(e)||e.body.body.some(hasOwnDecorators)}function prop(e,t){if(!t)return null;return s.types.objectProperty(s.types.identifier(e),t)}function method(e,t){return s.types.objectMethod("method",s.types.identifier(e),[],s.types.blockStatement(t))}function takeDecorators(e){let t;if(e.decorators&&e.decorators.length>0){t=s.types.arrayExpression(e.decorators.map((e=>e.expression)))}e.decorators=undefined;return t}function getKey(e){if(e.computed){return e.key}else if(s.types.isIdentifier(e.key)){return s.types.stringLiteral(e.key.name)}else{return s.types.stringLiteral(String(e.key.value))}}function extractElementDescriptor(e,t,r){const{node:o,scope:i}=r;const l=r.isClassMethod();if(r.isPrivate()){throw r.buildCodeFrameError(`Private ${l?"methods":"fields"} in decorated classes are not supported yet.`)}new a.default({methodPath:r,objectRef:e,superRef:t,file:this,refToPreserve:e}).replace();const c=[prop("kind",s.types.stringLiteral(s.types.isClassMethod(o)?o.kind:"field")),prop("decorators",takeDecorators(o)),prop("static",o.static&&s.types.booleanLiteral(true)),prop("key",getKey(o))].filter(Boolean);if(s.types.isClassMethod(o)){const e=o.computed?null:o.key;s.types.toExpression(o);c.push(prop("value",(0,n.default)({node:o,id:e,scope:i})||o))}else if(s.types.isClassProperty(o)&&o.value){c.push(method("value",s.template.statements.ast`return ${o.value}`))}else{c.push(prop("value",i.buildUndefinedNode()))}r.remove();return s.types.objectExpression(c)}function addDecorateHelper(e){try{return e.addHelper("decorate")}catch(e){if(e.code==="BABEL_HELPER_UNKNOWN"){e.message+="\n '@babel/plugin-transform-decorators' in non-legacy mode"+" requires '@babel/core' version ^7.0.2 and you appear to be using"+" an older version."}throw e}}function buildDecoratedClass(e,t,r,a){const{node:n,scope:o}=t;const i=o.generateUidIdentifier("initialize");const l=n.id&&t.isDeclaration();const c=t.isInStrictMode();const{superClass:u}=n;n.type="ClassDeclaration";if(!n.id)n.id=s.types.cloneNode(e);let p;if(u){p=o.generateUidIdentifierBasedOnNode(n.superClass,"super");n.superClass=p}const d=takeDecorators(n);const f=s.types.arrayExpression(r.filter((e=>!e.node.abstract)).map(extractElementDescriptor.bind(a,n.id,p)));const m=s.template.expression.ast` + `}},7055:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.hasOwnDecorators=hasOwnDecorators;t.hasDecorators=hasDecorators;t.buildDecoratedClass=buildDecoratedClass;var s=r(8304);var a=r(4725);var n=r(550);function hasOwnDecorators(e){return!!(e.decorators&&e.decorators.length)}function hasDecorators(e){return hasOwnDecorators(e)||e.body.body.some(hasOwnDecorators)}function prop(e,t){if(!t)return null;return s.types.objectProperty(s.types.identifier(e),t)}function method(e,t){return s.types.objectMethod("method",s.types.identifier(e),[],s.types.blockStatement(t))}function takeDecorators(e){let t;if(e.decorators&&e.decorators.length>0){t=s.types.arrayExpression(e.decorators.map((e=>e.expression)))}e.decorators=undefined;return t}function getKey(e){if(e.computed){return e.key}else if(s.types.isIdentifier(e.key)){return s.types.stringLiteral(e.key.name)}else{return s.types.stringLiteral(String(e.key.value))}}function extractElementDescriptor(e,t,r){const{node:o,scope:i}=r;const l=r.isClassMethod();if(r.isPrivate()){throw r.buildCodeFrameError(`Private ${l?"methods":"fields"} in decorated classes are not supported yet.`)}new a.default({methodPath:r,objectRef:e,superRef:t,file:this,refToPreserve:e}).replace();const c=[prop("kind",s.types.stringLiteral(s.types.isClassMethod(o)?o.kind:"field")),prop("decorators",takeDecorators(o)),prop("static",o.static&&s.types.booleanLiteral(true)),prop("key",getKey(o))].filter(Boolean);if(s.types.isClassMethod(o)){const e=o.computed?null:o.key;s.types.toExpression(o);c.push(prop("value",(0,n.default)({node:o,id:e,scope:i})||o))}else if(s.types.isClassProperty(o)&&o.value){c.push(method("value",s.template.statements.ast`return ${o.value}`))}else{c.push(prop("value",i.buildUndefinedNode()))}r.remove();return s.types.objectExpression(c)}function addDecorateHelper(e){try{return e.addHelper("decorate")}catch(e){if(e.code==="BABEL_HELPER_UNKNOWN"){e.message+="\n '@babel/plugin-transform-decorators' in non-legacy mode"+" requires '@babel/core' version ^7.0.2 and you appear to be using"+" an older version."}throw e}}function buildDecoratedClass(e,t,r,a){const{node:n,scope:o}=t;const i=o.generateUidIdentifier("initialize");const l=n.id&&t.isDeclaration();const c=t.isInStrictMode();const{superClass:u}=n;n.type="ClassDeclaration";if(!n.id)n.id=s.types.cloneNode(e);let p;if(u){p=o.generateUidIdentifierBasedOnNode(n.superClass,"super");n.superClass=p}const f=takeDecorators(n);const d=s.types.arrayExpression(r.filter((e=>!e.node.abstract)).map(extractElementDescriptor.bind(a,n.id,p)));const m=s.template.expression.ast` ${addDecorateHelper(a)}( - ${d||s.types.nullLiteral()}, + ${f||s.types.nullLiteral()}, function (${i}, ${u?s.types.cloneNode(p):null}) { ${n} - return { F: ${s.types.cloneNode(n.id)}, d: ${f} }; + return { F: ${s.types.cloneNode(n.id)}, d: ${d} }; }, ${u} ) - `;if(!c){m.arguments[1].body.directives.push(s.types.directive(s.types.directiveLiteral("use strict")))}let y=m;let g="arguments.1.body.body.0";if(l){y=s.template.statement.ast`let ${e} = ${m}`;g="declarations.0.init."+g}return{instanceNodes:[s.template.statement.ast`${s.types.cloneNode(i)}(this)`],wrapClass(e){e.replaceWith(y);return e.get(g)}}}},5123:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.enableFeature=enableFeature;t.isLoose=isLoose;t.verifyUsedFeatures=verifyUsedFeatures;t.FEATURES=void 0;var s=r(7055);const a=Object.freeze({fields:1<<1,privateMethods:1<<2,decorators:1<<3,privateIn:1<<4,staticBlocks:1<<5});t.FEATURES=a;const n=new Map([[a.fields,"@babel/plugin-proposal-class-properties"],[a.privateMethods,"@babel/plugin-proposal-private-methods"],[a.privateIn,"@babel/plugin-proposal-private-property-in-object"]]);const o="@babel/plugin-class-features/featuresKey";const i="@babel/plugin-class-features/looseKey";const l="@babel/plugin-class-features/looseLowPriorityKey/#__internal__@babel/preset-env__please-overwrite-loose-instead-of-throwing";function enableFeature(e,t,r){if(!hasFeature(e,t)||canIgnoreLoose(e,t)){e.set(o,e.get(o)|t);if(r==="#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error"){setLoose(e,t,true);e.set(l,e.get(l)|t)}else if(r==="#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"){setLoose(e,t,false);e.set(l,e.get(l)|t)}else{setLoose(e,t,r)}}let s;let a;for(const[t,r]of n){if(!hasFeature(e,t))continue;const n=isLoose(e,t);if(canIgnoreLoose(e,t)){continue}else if(s===!n){throw new Error("'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, "+"@babel/plugin-proposal-private-methods and "+"@babel/plugin-proposal-private-property-in-object (when they are enabled).")}else{s=n;a=r}}if(s!==undefined){for(const[t,r]of n){if(hasFeature(e,t)&&isLoose(e,t)!==s){setLoose(e,t,s);console.warn(`Though the "loose" option was set to "${!s}" in your @babel/preset-env `+`config, it will not be used for ${r} since the "loose" mode option was set to `+`"${s}" for ${a}.\nThe "loose" option must be the `+`same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods `+`and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can `+`silence this warning by explicitly adding\n`+`\t["${r}", { "loose": ${s} }]\n`+`to the "plugins" section of your Babel config.`)}}}}function hasFeature(e,t){return!!(e.get(o)&t)}function isLoose(e,t){return!!(e.get(i)&t)}function setLoose(e,t,r){if(r)e.set(i,e.get(i)|t);else e.set(i,e.get(i)&~t);e.set(l,e.get(l)&~t)}function canIgnoreLoose(e,t){return!!(e.get(l)&t)}function verifyUsedFeatures(e,t){if((0,s.hasOwnDecorators)(e.node)){if(!hasFeature(t,a.decorators)){throw e.buildCodeFrameError("Decorators are not enabled."+"\nIf you are using "+'["@babel/plugin-proposal-decorators", { "legacy": true }], '+'make sure it comes *before* "@babel/plugin-proposal-class-properties" '+"and enable loose mode, like so:\n"+'\t["@babel/plugin-proposal-decorators", { "legacy": true }]\n'+'\t["@babel/plugin-proposal-class-properties", { "loose": true }]')}if(e.isPrivate()){throw e.buildCodeFrameError(`Private ${e.isClassMethod()?"methods":"fields"} in decorated classes are not supported yet.`)}}if(e.isClassPrivateMethod!=null&&e.isClassPrivateMethod()){if(!hasFeature(t,a.privateMethods)){throw e.buildCodeFrameError("Class private methods are not enabled.")}}if(e.isPrivateName()&&e.parentPath.isBinaryExpression({operator:"in",left:e.node})){if(!hasFeature(t,a.privateIn)){throw e.buildCodeFrameError("Private property in checks are not enabled.")}}if(e.isProperty()){if(!hasFeature(t,a.fields)){throw e.buildCodeFrameError("Class fields are not enabled.")}}if(e.isStaticBlock!=null&&e.isStaticBlock()){if(!hasFeature(t,a.staticBlocks)){throw e.buildCodeFrameError("Static class blocks are not enabled. "+"Please add `@babel/plugin-proposal-class-static-block` to your configuration.")}}}},196:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.buildPrivateNamesMap=buildPrivateNamesMap;t.buildPrivateNamesNodes=buildPrivateNamesNodes;t.transformPrivateNamesUsage=transformPrivateNamesUsage;t.buildFieldsInitNodes=buildFieldsInitNodes;var s=r(8304);var a=r(4725);var n=r(5789);var o=r(6721);var i=r(2155);var l=r(5464);function buildPrivateNamesMap(e){const t=new Map;for(const r of e){if(r.isPrivate()){const{name:e}=r.node.key.id;const s=t.has(e)?t.get(e):{id:r.scope.generateUidIdentifier(e),static:r.node.static,method:!r.isProperty()};if(r.isClassPrivateMethod()){if(r.node.kind==="get"){s.getId=r.scope.generateUidIdentifier(`get_${e}`)}else if(r.node.kind==="set"){s.setId=r.scope.generateUidIdentifier(`set_${e}`)}else if(r.node.kind==="method"){s.methodId=r.scope.generateUidIdentifier(e)}}t.set(e,s)}}return t}function buildPrivateNamesNodes(e,t,r){const a=[];for(const[n,o]of e){const{static:e,method:l,getId:c,setId:u}=o;const p=c||u;const d=s.types.cloneNode(o.id);let f;if(t){f=s.types.callExpression(r.addHelper("classPrivateFieldLooseKey"),[s.types.stringLiteral(n)])}else if(!e){f=s.types.newExpression(s.types.identifier(!l||p?"WeakMap":"WeakSet"),[])}if(f){(0,i.default)(f);a.push(s.template.statement.ast`var ${d} = ${f}`)}}return a}function privateNameVisitorFactory(e){const t=Object.assign({},e,{Class(e){const{privateNamesMap:s}=this;const a=e.get("body.body");const n=new Map(s);const o=[];for(const e of a){if(!e.isPrivate())continue;const{name:t}=e.node.key.id;n.delete(t);o.push(t)}if(!o.length){return}e.get("body").traverse(r,Object.assign({},this,{redeclared:o}));e.traverse(t,Object.assign({},this,{privateNamesMap:n}));e.skipKey("body")}});const r=s.traverse.visitors.merge([Object.assign({},e),a.environmentVisitor]);return t}const c=privateNameVisitorFactory({PrivateName(e,{noDocumentAll:t}){const{privateNamesMap:r,redeclared:s}=this;const{node:a,parentPath:n}=e;if(!n.isMemberExpression({property:a})&&!n.isOptionalMemberExpression({property:a})){return}const{name:o}=a.id;if(!r.has(o))return;if(s&&s.includes(o))return;this.handle(n,t)}});const u=privateNameVisitorFactory({BinaryExpression(e){const{operator:t,left:r,right:a}=e.node;if(t!=="in")return;if(!s.types.isPrivateName(r))return;const{privateFieldsAsProperties:n,privateNamesMap:o,redeclared:i}=this;const{name:l}=r.id;if(!o.has(l))return;if(i&&i.includes(l))return;if(n){const{id:t}=o.get(l);e.replaceWith(s.template.expression.ast` + `;if(!c){m.arguments[1].body.directives.push(s.types.directive(s.types.directiveLiteral("use strict")))}let y=m;let g="arguments.1.body.body.0";if(l){y=s.template.statement.ast`let ${e} = ${m}`;g="declarations.0.init."+g}return{instanceNodes:[s.template.statement.ast`${s.types.cloneNode(i)}(this)`],wrapClass(e){e.replaceWith(y);return e.get(g)}}}},5123:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.enableFeature=enableFeature;t.isLoose=isLoose;t.verifyUsedFeatures=verifyUsedFeatures;t.FEATURES=void 0;var s=r(7055);const a=Object.freeze({fields:1<<1,privateMethods:1<<2,decorators:1<<3,privateIn:1<<4,staticBlocks:1<<5});t.FEATURES=a;const n=new Map([[a.fields,"@babel/plugin-proposal-class-properties"],[a.privateMethods,"@babel/plugin-proposal-private-methods"],[a.privateIn,"@babel/plugin-proposal-private-property-in-object"]]);const o="@babel/plugin-class-features/featuresKey";const i="@babel/plugin-class-features/looseKey";const l="@babel/plugin-class-features/looseLowPriorityKey/#__internal__@babel/preset-env__please-overwrite-loose-instead-of-throwing";function enableFeature(e,t,r){if(!hasFeature(e,t)||canIgnoreLoose(e,t)){e.set(o,e.get(o)|t);if(r==="#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error"){setLoose(e,t,true);e.set(l,e.get(l)|t)}else if(r==="#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"){setLoose(e,t,false);e.set(l,e.get(l)|t)}else{setLoose(e,t,r)}}let s;let a;for(const[t,r]of n){if(!hasFeature(e,t))continue;const n=isLoose(e,t);if(canIgnoreLoose(e,t)){continue}else if(s===!n){throw new Error("'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, "+"@babel/plugin-proposal-private-methods and "+"@babel/plugin-proposal-private-property-in-object (when they are enabled).")}else{s=n;a=r}}if(s!==undefined){for(const[t,r]of n){if(hasFeature(e,t)&&isLoose(e,t)!==s){setLoose(e,t,s);console.warn(`Though the "loose" option was set to "${!s}" in your @babel/preset-env `+`config, it will not be used for ${r} since the "loose" mode option was set to `+`"${s}" for ${a}.\nThe "loose" option must be the `+`same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods `+`and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can `+`silence this warning by explicitly adding\n`+`\t["${r}", { "loose": ${s} }]\n`+`to the "plugins" section of your Babel config.`)}}}}function hasFeature(e,t){return!!(e.get(o)&t)}function isLoose(e,t){return!!(e.get(i)&t)}function setLoose(e,t,r){if(r)e.set(i,e.get(i)|t);else e.set(i,e.get(i)&~t);e.set(l,e.get(l)&~t)}function canIgnoreLoose(e,t){return!!(e.get(l)&t)}function verifyUsedFeatures(e,t){if((0,s.hasOwnDecorators)(e.node)){if(!hasFeature(t,a.decorators)){throw e.buildCodeFrameError("Decorators are not enabled."+"\nIf you are using "+'["@babel/plugin-proposal-decorators", { "legacy": true }], '+'make sure it comes *before* "@babel/plugin-proposal-class-properties" '+"and enable loose mode, like so:\n"+'\t["@babel/plugin-proposal-decorators", { "legacy": true }]\n'+'\t["@babel/plugin-proposal-class-properties", { "loose": true }]')}if(e.isPrivate()){throw e.buildCodeFrameError(`Private ${e.isClassMethod()?"methods":"fields"} in decorated classes are not supported yet.`)}}if(e.isClassPrivateMethod!=null&&e.isClassPrivateMethod()){if(!hasFeature(t,a.privateMethods)){throw e.buildCodeFrameError("Class private methods are not enabled.")}}if(e.isPrivateName()&&e.parentPath.isBinaryExpression({operator:"in",left:e.node})){if(!hasFeature(t,a.privateIn)){throw e.buildCodeFrameError("Private property in checks are not enabled.")}}if(e.isProperty()){if(!hasFeature(t,a.fields)){throw e.buildCodeFrameError("Class fields are not enabled.")}}if(e.isStaticBlock!=null&&e.isStaticBlock()){if(!hasFeature(t,a.staticBlocks)){throw e.buildCodeFrameError("Static class blocks are not enabled. "+"Please add `@babel/plugin-proposal-class-static-block` to your configuration.")}}}},196:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.buildPrivateNamesMap=buildPrivateNamesMap;t.buildPrivateNamesNodes=buildPrivateNamesNodes;t.transformPrivateNamesUsage=transformPrivateNamesUsage;t.buildFieldsInitNodes=buildFieldsInitNodes;var s=r(8304);var a=r(4725);var n=r(5789);var o=r(6721);var i=r(2155);var l=r(5464);function buildPrivateNamesMap(e){const t=new Map;for(const r of e){if(r.isPrivate()){const{name:e}=r.node.key.id;const s=t.has(e)?t.get(e):{id:r.scope.generateUidIdentifier(e),static:r.node.static,method:!r.isProperty()};if(r.isClassPrivateMethod()){if(r.node.kind==="get"){s.getId=r.scope.generateUidIdentifier(`get_${e}`)}else if(r.node.kind==="set"){s.setId=r.scope.generateUidIdentifier(`set_${e}`)}else if(r.node.kind==="method"){s.methodId=r.scope.generateUidIdentifier(e)}}t.set(e,s)}}return t}function buildPrivateNamesNodes(e,t,r){const a=[];for(const[n,o]of e){const{static:e,method:l,getId:c,setId:u}=o;const p=c||u;const f=s.types.cloneNode(o.id);let d;if(t){d=s.types.callExpression(r.addHelper("classPrivateFieldLooseKey"),[s.types.stringLiteral(n)])}else if(!e){d=s.types.newExpression(s.types.identifier(!l||p?"WeakMap":"WeakSet"),[])}if(d){(0,i.default)(d);a.push(s.template.statement.ast`var ${f} = ${d}`)}}return a}function privateNameVisitorFactory(e){const t=Object.assign({},e,{Class(e){const{privateNamesMap:s}=this;const a=e.get("body.body");const n=new Map(s);const o=[];for(const e of a){if(!e.isPrivate())continue;const{name:t}=e.node.key.id;n.delete(t);o.push(t)}if(!o.length){return}e.get("body").traverse(r,Object.assign({},this,{redeclared:o}));e.traverse(t,Object.assign({},this,{privateNamesMap:n}));e.skipKey("body")}});const r=s.traverse.visitors.merge([Object.assign({},e),a.environmentVisitor]);return t}const c=privateNameVisitorFactory({PrivateName(e,{noDocumentAll:t}){const{privateNamesMap:r,redeclared:s}=this;const{node:a,parentPath:n}=e;if(!n.isMemberExpression({property:a})&&!n.isOptionalMemberExpression({property:a})){return}const{name:o}=a.id;if(!r.has(o))return;if(s&&s.includes(o))return;this.handle(n,t)}});const u=privateNameVisitorFactory({BinaryExpression(e){const{operator:t,left:r,right:a}=e.node;if(t!=="in")return;if(!s.types.isPrivateName(r))return;const{privateFieldsAsProperties:n,privateNamesMap:o,redeclared:i}=this;const{name:l}=r.id;if(!o.has(l))return;if(i&&i.includes(l))return;if(n){const{id:t}=o.get(l);e.replaceWith(s.template.expression.ast` Object.prototype.hasOwnProperty.call(${a}, ${s.types.cloneNode(t)}) - `);return}const{id:c,static:u}=o.get(l);if(u){e.replaceWith(s.template.expression.ast`${a} === ${this.classRef}`);return}e.replaceWith(s.template.expression.ast`${s.types.cloneNode(c)}.has(${a})`)}});const p={memoise(e,t){const{scope:r}=e;const{object:s}=e.node;const a=r.maybeGenerateMemoised(s);if(!a){return}this.memoiser.set(s,a,t)},receiver(e){const{object:t}=e.node;if(this.memoiser.has(t)){return s.types.cloneNode(this.memoiser.get(t))}return s.types.cloneNode(t)},get(e){const{classRef:t,privateNamesMap:r,file:a}=this;const{name:n}=e.node.property.id;const{id:o,static:i,method:l,methodId:c,getId:u,setId:p}=r.get(n);const d=u||p;if(i){const r=l&&!d?"classStaticPrivateMethodGet":"classStaticPrivateFieldSpecGet";return s.types.callExpression(a.addHelper(r),[this.receiver(e),s.types.cloneNode(t),s.types.cloneNode(o)])}if(l){if(d){if(!u&&p){if(a.availableHelper("writeOnlyError")){return s.types.sequenceExpression([this.receiver(e),s.types.callExpression(a.addHelper("writeOnlyError"),[s.types.stringLiteral(`#${n}`)])])}console.warn(`@babel/helpers is outdated, update it to silence this warning.`)}return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])}return s.types.callExpression(a.addHelper("classPrivateMethodGet"),[this.receiver(e),s.types.cloneNode(o),s.types.cloneNode(c)])}return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])},boundGet(e){this.memoise(e,1);return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[this.receiver(e)])},set(e,t){const{classRef:r,privateNamesMap:a,file:n}=this;const{name:o}=e.node.property.id;const{id:i,static:l,method:c,setId:u,getId:p}=a.get(o);const d=p||u;if(l){const a=c&&!d?"classStaticPrivateMethodSet":"classStaticPrivateFieldSpecSet";return s.types.callExpression(n.addHelper(a),[this.receiver(e),s.types.cloneNode(r),s.types.cloneNode(i),t])}if(c){if(u){return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])}return s.types.sequenceExpression([this.receiver(e),t,s.types.callExpression(n.addHelper("readOnlyError"),[s.types.stringLiteral(`#${o}`)])])}return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])},destructureSet(e){const{classRef:t,privateNamesMap:r,file:a}=this;const{name:n}=e.node.property.id;const{id:o,static:i}=r.get(n);if(i){try{var l=a.addHelper("classStaticPrivateFieldDestructureSet")}catch(e){throw new Error("Babel can not transpile `[C.#p] = [0]` with @babel/helpers < 7.13.10, \n"+"please update @babel/helpers to the latest version.")}return s.types.memberExpression(s.types.callExpression(l,[this.receiver(e),s.types.cloneNode(t),s.types.cloneNode(o)]),s.types.identifier("value"))}return s.types.memberExpression(s.types.callExpression(a.addHelper("classPrivateFieldDestructureSet"),[this.receiver(e),s.types.cloneNode(o)]),s.types.identifier("value"))},call(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,false)},optionalCall(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,true)}};const d={get(e){const{privateNamesMap:t,file:r}=this;const{object:a}=e.node;const{name:n}=e.node.property.id;return s.template.expression`BASE(REF, PROP)[PROP]`({BASE:r.addHelper("classPrivateFieldLooseBase"),REF:s.types.cloneNode(a),PROP:s.types.cloneNode(t.get(n).id)})},set(){throw new Error("private name handler with loose = true don't need set()")},boundGet(e){return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[s.types.cloneNode(e.node.object)])},simpleSet(e){return this.get(e)},destructureSet(e){return this.get(e)},call(e,t){return s.types.callExpression(this.get(e),t)},optionalCall(e,t){return s.types.optionalCallExpression(this.get(e),t,true)}};function transformPrivateNamesUsage(e,t,r,{privateFieldsAsProperties:s,noDocumentAll:a},o){if(!r.size)return;const i=t.get("body");const l=s?d:p;(0,n.default)(i,c,Object.assign({privateNamesMap:r,classRef:e,file:o},l,{noDocumentAll:a}));i.traverse(u,{privateNamesMap:r,classRef:e,file:o,privateFieldsAsProperties:s})}function buildPrivateFieldInitLoose(e,t,r){const{id:a}=r.get(t.node.key.id.name);const n=t.node.value||t.scope.buildUndefinedNode();return s.template.statement.ast` + `);return}const{id:c,static:u}=o.get(l);if(u){e.replaceWith(s.template.expression.ast`${a} === ${this.classRef}`);return}e.replaceWith(s.template.expression.ast`${s.types.cloneNode(c)}.has(${a})`)}});const p={memoise(e,t){const{scope:r}=e;const{object:s}=e.node;const a=r.maybeGenerateMemoised(s);if(!a){return}this.memoiser.set(s,a,t)},receiver(e){const{object:t}=e.node;if(this.memoiser.has(t)){return s.types.cloneNode(this.memoiser.get(t))}return s.types.cloneNode(t)},get(e){const{classRef:t,privateNamesMap:r,file:a}=this;const{name:n}=e.node.property.id;const{id:o,static:i,method:l,methodId:c,getId:u,setId:p}=r.get(n);const f=u||p;if(i){const r=l&&!f?"classStaticPrivateMethodGet":"classStaticPrivateFieldSpecGet";return s.types.callExpression(a.addHelper(r),[this.receiver(e),s.types.cloneNode(t),s.types.cloneNode(o)])}if(l){if(f){if(!u&&p){if(a.availableHelper("writeOnlyError")){return s.types.sequenceExpression([this.receiver(e),s.types.callExpression(a.addHelper("writeOnlyError"),[s.types.stringLiteral(`#${n}`)])])}console.warn(`@babel/helpers is outdated, update it to silence this warning.`)}return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])}return s.types.callExpression(a.addHelper("classPrivateMethodGet"),[this.receiver(e),s.types.cloneNode(o),s.types.cloneNode(c)])}return s.types.callExpression(a.addHelper("classPrivateFieldGet"),[this.receiver(e),s.types.cloneNode(o)])},boundGet(e){this.memoise(e,1);return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[this.receiver(e)])},set(e,t){const{classRef:r,privateNamesMap:a,file:n}=this;const{name:o}=e.node.property.id;const{id:i,static:l,method:c,setId:u,getId:p}=a.get(o);const f=p||u;if(l){const a=c&&!f?"classStaticPrivateMethodSet":"classStaticPrivateFieldSpecSet";return s.types.callExpression(n.addHelper(a),[this.receiver(e),s.types.cloneNode(r),s.types.cloneNode(i),t])}if(c){if(u){return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])}return s.types.sequenceExpression([this.receiver(e),t,s.types.callExpression(n.addHelper("readOnlyError"),[s.types.stringLiteral(`#${o}`)])])}return s.types.callExpression(n.addHelper("classPrivateFieldSet"),[this.receiver(e),s.types.cloneNode(i),t])},destructureSet(e){const{classRef:t,privateNamesMap:r,file:a}=this;const{name:n}=e.node.property.id;const{id:o,static:i}=r.get(n);if(i){try{var l=a.addHelper("classStaticPrivateFieldDestructureSet")}catch(e){throw new Error("Babel can not transpile `[C.#p] = [0]` with @babel/helpers < 7.13.10, \n"+"please update @babel/helpers to the latest version.")}return s.types.memberExpression(s.types.callExpression(l,[this.receiver(e),s.types.cloneNode(t),s.types.cloneNode(o)]),s.types.identifier("value"))}return s.types.memberExpression(s.types.callExpression(a.addHelper("classPrivateFieldDestructureSet"),[this.receiver(e),s.types.cloneNode(o)]),s.types.identifier("value"))},call(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,false)},optionalCall(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,true)}};const f={get(e){const{privateNamesMap:t,file:r}=this;const{object:a}=e.node;const{name:n}=e.node.property.id;return s.template.expression`BASE(REF, PROP)[PROP]`({BASE:r.addHelper("classPrivateFieldLooseBase"),REF:s.types.cloneNode(a),PROP:s.types.cloneNode(t.get(n).id)})},set(){throw new Error("private name handler with loose = true don't need set()")},boundGet(e){return s.types.callExpression(s.types.memberExpression(this.get(e),s.types.identifier("bind")),[s.types.cloneNode(e.node.object)])},simpleSet(e){return this.get(e)},destructureSet(e){return this.get(e)},call(e,t){return s.types.callExpression(this.get(e),t)},optionalCall(e,t){return s.types.optionalCallExpression(this.get(e),t,true)}};function transformPrivateNamesUsage(e,t,r,{privateFieldsAsProperties:s,noDocumentAll:a},o){if(!r.size)return;const i=t.get("body");const l=s?f:p;(0,n.default)(i,c,Object.assign({privateNamesMap:r,classRef:e,file:o},l,{noDocumentAll:a}));i.traverse(u,{privateNamesMap:r,classRef:e,file:o,privateFieldsAsProperties:s})}function buildPrivateFieldInitLoose(e,t,r){const{id:a}=r.get(t.node.key.id.name);const n=t.node.value||t.scope.buildUndefinedNode();return s.template.statement.ast` Object.defineProperty(${e}, ${s.types.cloneNode(a)}, { // configurable is false by default // enumerable is false by default @@ -518,7 +443,7 @@ // writable is false by default value: ${i.name} }); - `}function buildPrivateMethodDeclaration(e,t,r=false){const a=t.get(e.node.key.id.name);const{id:n,methodId:o,getId:i,setId:l,getterDeclared:c,setterDeclared:u,static:p}=a;const{params:d,body:f,generator:m,async:y}=e.node;const g=i&&!c&&d.length===0;const h=l&&!u&&d.length>0;let b=o;if(g){t.set(e.node.key.id.name,Object.assign({},a,{getterDeclared:true}));b=i}else if(h){t.set(e.node.key.id.name,Object.assign({},a,{setterDeclared:true}));b=l}else if(p&&!r){b=n}return s.types.functionDeclaration(s.types.cloneNode(b),d,f,m,y)}const f=s.traverse.visitors.merge([{ThisExpression(e,t){t.needsClassRef=true;e.replaceWith(s.types.cloneNode(t.classRef))},MetaProperty(e){const t=e.get("meta");const r=e.get("property");const{scope:s}=e;if(t.isIdentifier({name:"new"})&&r.isIdentifier({name:"target"})){e.replaceWith(s.buildUndefinedNode())}}},a.environmentVisitor]);const m={ReferencedIdentifier(e,t){if(e.scope.bindingIdentifierEquals(e.node.name,t.innerBinding)){t.needsClassRef=true;e.node.name=t.classRef.name}}};function replaceThisContext(e,t,r,n,o,i,l){var c;const u={classRef:t,needsClassRef:false,innerBinding:l};const p=new a.default({methodPath:e,constantSuper:i,file:n,refToPreserve:t,getSuperRef:r,getObjectRef(){u.needsClassRef=true;return o||e.node.static?t:s.types.memberExpression(t,s.types.identifier("prototype"))}});p.replace();if(o||e.isProperty()){e.traverse(f,u)}if((c=u.classRef)!=null&&c.name&&u.classRef.name!==(l==null?void 0:l.name)){e.traverse(m,u)}return u.needsClassRef}function buildFieldsInitNodes(e,t,r,a,n,o,i,c,u){let p=false;let d;const f=[];const m=[];const y=[];const g=s.types.isIdentifier(t)?()=>t:()=>{var e;(e=d)!=null?e:d=r[0].scope.generateUidIdentifierBasedOnNode(t);return d};for(const t of r){t.isClassProperty()&&l.assertFieldTransformed(t);const r=t.node.static;const d=!r;const h=t.isPrivate();const b=!h;const x=t.isProperty();const v=!x;const E=t.isStaticBlock==null?void 0:t.isStaticBlock();if(r||v&&h||E){const r=replaceThisContext(t,e,g,n,E,c,u);p=p||r}switch(true){case E:f.push(s.template.statement.ast`(() => ${s.types.blockStatement(t.node.body)})()`);break;case r&&h&&x&&i:p=true;f.push(buildPrivateFieldInitLoose(s.types.cloneNode(e),t,a));break;case r&&h&&x&&!i:p=true;f.push(buildPrivateStaticFieldInitSpec(t,a));break;case r&&b&&x&&o:p=true;f.push(buildPublicFieldInitLoose(s.types.cloneNode(e),t));break;case r&&b&&x&&!o:p=true;f.push(buildPublicFieldInitSpec(s.types.cloneNode(e),t,n));break;case d&&h&&x&&i:m.push(buildPrivateFieldInitLoose(s.types.thisExpression(),t,a));break;case d&&h&&x&&!i:m.push(buildPrivateInstanceFieldInitSpec(s.types.thisExpression(),t,a));break;case d&&h&&v&&i:m.unshift(buildPrivateMethodInitLoose(s.types.thisExpression(),t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case d&&h&&v&&!i:m.unshift(buildPrivateInstanceMethodInitSpec(s.types.thisExpression(),t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case r&&h&&v&&!i:p=true;f.unshift(buildPrivateStaticFieldInitSpec(t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case r&&h&&v&&i:p=true;f.unshift(buildPrivateStaticMethodInitLoose(s.types.cloneNode(e),t,n,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case d&&b&&x&&o:m.push(buildPublicFieldInitLoose(s.types.thisExpression(),t));break;case d&&b&&x&&!o:m.push(buildPublicFieldInitSpec(s.types.thisExpression(),t,n));break;default:throw new Error("Unreachable.")}}return{staticNodes:f.filter(Boolean),instanceNodes:m.filter(Boolean),pureStaticNodes:y.filter(Boolean),wrapClass(t){for(const e of r){e.remove()}if(d){t.scope.push({id:s.types.cloneNode(d)});t.set("superClass",s.types.assignmentExpression("=",d,t.node.superClass))}if(!p)return t;if(t.isClassExpression()){t.scope.push({id:e});t.replaceWith(s.types.assignmentExpression("=",s.types.cloneNode(e),t.node))}else if(!t.node.id){t.node.id=e}return t}}}},738:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.createClassFeaturePlugin=createClassFeaturePlugin;Object.defineProperty(t,"injectInitialization",{enumerable:true,get:function(){return l.injectInitialization}});Object.defineProperty(t,"enableFeature",{enumerable:true,get:function(){return c.enableFeature}});Object.defineProperty(t,"FEATURES",{enumerable:true,get:function(){return c.FEATURES}});var s=r(8304);var a=r(550);var n=r(7058);var o=r(196);var i=r(7055);var l=r(3235);var c=r(5123);const u="7.15.0".split(".").reduce(((e,t)=>e*1e5+ +t),0);const p="@babel/plugin-class-features/version";function createClassFeaturePlugin({name:e,feature:t,loose:r,manipulateOptions:d,api:f={assumption:()=>void 0}}){const m=f.assumption("setPublicClassFields");const y=f.assumption("privateFieldsAsProperties");const g=f.assumption("constantSuper");const h=f.assumption("noDocumentAll");if(r===true){const t=[];if(m!==undefined){t.push(`"setPublicClassFields"`)}if(y!==undefined){t.push(`"privateFieldsAsProperties"`)}if(t.length!==0){console.warn(`[${e}]: You are using the "loose: true" option and you are`+` explicitly setting a value for the ${t.join(" and ")}`+` assumption${t.length>1?"s":""}. The "loose" option`+` can cause incompatibilities with the other class features`+` plugins, so it's recommended that you replace it with the`+` following top-level option:\n`+`\t"assumptions": {\n`+`\t\t"setPublicClassFields": true,\n`+`\t\t"privateFieldsAsProperties": true\n`+`\t}`)}}return{name:e,manipulateOptions:d,pre(){(0,c.enableFeature)(this.file,t,r);if(!this.file.get(p)||this.file.get(p)0){(0,l.injectInitialization)(e,d,I,((e,t)=>{if(f)return;for(const r of b){if(r.node.static)continue;r.traverse(e,t)}}))}const A=C(e);A.insertBefore([...O,...k]);if(P.length>0){A.insertAfter(P)}if(D.length>0){A.find((e=>e.isStatement()||e.isDeclaration())).insertAfter(D)}},PrivateName(e){if(this.file.get(p)!==u||e.parentPath.isPrivate({key:e.node})){return}throw e.buildCodeFrameError(`Unknown PrivateName "${e}"`)},ExportDefaultDeclaration(e){if(this.file.get(p)!==u)return;const t=e.get("declaration");if(t.isClassDeclaration()&&(0,i.hasDecorators)(t.node)){if(t.node.id){(0,n.default)(e)}else{t.node.type="ClassExpression"}}}}}}},3235:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.injectInitialization=injectInitialization;t.extractComputedKeys=extractComputedKeys;var s=r(8304);var a=r(4725);const n=s.traverse.visitors.merge([{Super(e){const{node:t,parentPath:r}=e;if(r.isCallExpression({callee:t})){this.push(r)}}},a.environmentVisitor]);const o={"TSTypeAnnotation|TypeAnnotation"(e){e.skip()},ReferencedIdentifier(e){if(this.scope.hasOwnBinding(e.node.name)){this.scope.rename(e.node.name);e.skip()}}};function handleClassTDZ(e,t){if(t.classBinding&&t.classBinding===e.scope.getBinding(e.node.name)){const r=t.file.addHelper("classNameTDZError");const a=s.types.callExpression(r,[s.types.stringLiteral(e.node.name)]);e.replaceWith(s.types.sequenceExpression([a,e.node]));e.skip()}}const i={ReferencedIdentifier:handleClassTDZ};function injectInitialization(e,t,r,a){if(!r.length)return;const i=!!e.node.superClass;if(!t){const r=s.types.classMethod("constructor",s.types.identifier("constructor"),[],s.types.blockStatement([]));if(i){r.params=[s.types.restElement(s.types.identifier("args"))];r.body.body.push(s.template.statement.ast`super(...args)`)}[t]=e.get("body").unshiftContainer("body",r)}if(a){a(o,{scope:t.scope})}if(i){const e=[];t.traverse(n,e);let a=true;for(const t of e){if(a){t.insertAfter(r);a=false}else{t.insertAfter(r.map((e=>s.types.cloneNode(e))))}}}else{t.get("body").unshiftContainer("body",r)}}function extractComputedKeys(e,t,r,a){const n=[];const o={classBinding:t.node.id&&t.scope.getBinding(t.node.id.name),file:a};for(const e of r){const r=e.get("key");if(r.isReferencedIdentifier()){handleClassTDZ(r,o)}else{r.traverse(i,o)}const a=e.node;if(!r.isConstantExpression()){const e=t.scope.generateUidIdentifierBasedOnNode(a.key);t.scope.push({id:e,kind:"let"});n.push(s.types.expressionStatement(s.types.assignmentExpression("=",s.types.cloneNode(e),a.key)));a.key=s.types.cloneNode(e)}}return n}},5464:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.assertFieldTransformed=assertFieldTransformed;function assertFieldTransformed(e){if(e.node.declare){throw e.buildCodeFrameError(`TypeScript 'declare' fields must first be transformed by `+`@babel/plugin-transform-typescript.\n`+`If you have already enabled that plugin (or '@babel/preset-typescript'), make sure `+`that it runs before any plugin related to additional class features:\n`+` - @babel/plugin-proposal-class-properties\n`+` - @babel/plugin-proposal-private-methods\n`+` - @babel/plugin-proposal-decorators`)}}},4725:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.skipAllButComputedKey=skipAllButComputedKey;t["default"]=t.environmentVisitor=void 0;var s=r(7369);var a=r(5789);var n=r(6721);var o=r(8622);function getPrototypeOfExpression(e,t,r,s){e=o.cloneNode(e);const a=t||s?e:o.memberExpression(e,o.identifier("prototype"));return o.callExpression(r.addHelper("getPrototypeOf"),[a])}function skipAllButComputedKey(e){if(!e.node.computed){e.skip();return}const t=o.VISITOR_KEYS[e.type];for(const r of t){if(r!=="key")e.skipKey(r)}}const i={[`${o.staticBlock?"StaticBlock|":""}ClassPrivateProperty|TypeAnnotation`](e){e.skip()},Function(e){if(e.isMethod())return;if(e.isArrowFunctionExpression())return;e.skip()},"Method|ClassProperty"(e){skipAllButComputedKey(e)}};t.environmentVisitor=i;const l=s.default.visitors.merge([i,{Super(e,t){const{node:r,parentPath:s}=e;if(!s.isMemberExpression({object:r}))return;t.handle(s)}}]);const c=s.default.visitors.merge([i,{Scopable(e,{refName:t}){const r=e.scope.getOwnBinding(t);if(r&&r.identifier.name===t){e.scope.rename(t)}}}]);const u={memoise(e,t){const{scope:r,node:s}=e;const{computed:a,property:n}=s;if(!a){return}const o=r.maybeGenerateMemoised(n);if(!o){return}this.memoiser.set(n,o,t)},prop(e){const{computed:t,property:r}=e.node;if(this.memoiser.has(r)){return o.cloneNode(this.memoiser.get(r))}if(t){return o.cloneNode(r)}return o.stringLiteral(r.name)},get(e){return this._get(e,this._getThisRefs())},_get(e,t){const r=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("get"),[t.memo?o.sequenceExpression([t.memo,r]):r,this.prop(e),t.this])},_getThisRefs(){if(!this.isDerivedConstructor){return{this:o.thisExpression()}}const e=this.scope.generateDeclaredUidIdentifier("thisSuper");return{memo:o.assignmentExpression("=",e,o.thisExpression()),this:o.cloneNode(e)}},set(e,t){const r=this._getThisRefs();const s=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("set"),[r.memo?o.sequenceExpression([r.memo,s]):s,this.prop(e),t,r.this,o.booleanLiteral(e.isInStrictMode())])},destructureSet(e){throw e.buildCodeFrameError(`Destructuring to a super field is not supported yet.`)},call(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,false)},optionalCall(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,true)}};const p=Object.assign({},u,{prop(e){const{property:t}=e.node;if(this.memoiser.has(t)){return o.cloneNode(this.memoiser.get(t))}return o.cloneNode(t)},get(e){const{isStatic:t,getSuperRef:r}=this;const{computed:s}=e.node;const a=this.prop(e);let n;if(t){var i;n=(i=r())!=null?i:o.memberExpression(o.identifier("Function"),o.identifier("prototype"))}else{var l;n=o.memberExpression((l=r())!=null?l:o.identifier("Object"),o.identifier("prototype"))}return o.memberExpression(n,a,s)},set(e,t){const{computed:r}=e.node;const s=this.prop(e);return o.assignmentExpression("=",o.memberExpression(o.thisExpression(),s,r),t)},destructureSet(e){const{computed:t}=e.node;const r=this.prop(e);return o.memberExpression(o.thisExpression(),r,t)},call(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,false)},optionalCall(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,true)}});class ReplaceSupers{constructor(e){var t;const r=e.methodPath;this.methodPath=r;this.isDerivedConstructor=r.isClassMethod({kind:"constructor"})&&!!e.superRef;this.isStatic=r.isObjectMethod()||r.node.static||(r.isStaticBlock==null?void 0:r.isStaticBlock());this.isPrivateMethod=r.isPrivate()&&r.isMethod();this.file=e.file;this.constantSuper=(t=e.constantSuper)!=null?t:e.isLoose;this.opts=e}getObjectRef(){return o.cloneNode(this.opts.objectRef||this.opts.getObjectRef())}getSuperRef(){if(this.opts.superRef)return o.cloneNode(this.opts.superRef);if(this.opts.getSuperRef)return o.cloneNode(this.opts.getSuperRef())}replace(){if(this.opts.refToPreserve){this.methodPath.traverse(c,{refName:this.opts.refToPreserve.name})}const e=this.constantSuper?p:u;(0,a.default)(this.methodPath,l,Object.assign({file:this.file,scope:this.methodPath.scope,isDerivedConstructor:this.isDerivedConstructor,isStatic:this.isStatic,isPrivateMethod:this.isPrivateMethod,getObjectRef:this.getObjectRef.bind(this),getSuperRef:this.getSuperRef.bind(this),boundGet:e.get},e))}}t["default"]=ReplaceSupers},4951:e=>{const t=new Set(["proposal-class-static-block"]);const r={"proposal-async-generator-functions":"syntax-async-generators","proposal-class-properties":"syntax-class-properties","proposal-class-static-block":"syntax-class-static-block","proposal-json-strings":"syntax-json-strings","proposal-nullish-coalescing-operator":"syntax-nullish-coalescing-operator","proposal-numeric-separator":"syntax-numeric-separator","proposal-object-rest-spread":"syntax-object-rest-spread","proposal-optional-catch-binding":"syntax-optional-catch-binding","proposal-optional-chaining":"syntax-optional-chaining","proposal-private-methods":"syntax-class-properties","proposal-private-property-in-object":"syntax-private-property-in-object","proposal-unicode-property-regex":null};const s=Object.keys(r).map((function(e){return[e,r[e]]}));const a=new Map(s);e.exports={pluginSyntaxMap:a,proposalPlugins:t}},9199:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.minVersions=t["default"]=void 0;var s=r(1079);var a=r(947);var n=r(8142);var o=r(5163);var i=r(1454);var l=r(3030);var c=r(5945);var u=r(5879);var p=r(1816);var d=r(4499);var f=r(7452);var m=r(79);var y=r(7445);var g=r(4893);var h=r(2271);var b=r(8027);var x=r(5557);var v=r(4920);var E=r(9579);var j=r(7703);var w=r(1195);var _=r(5353);var S=r(7300);var O=r(6309);var k=r(4195);var P=r(7490);var I=r(9062);var D=r(3181);var C=r(6092);var A=r(6413);var R=r(513);var N=r(8363);var M=r(1630);var F=r(6408);var L=r(8120);var B=r(5157);var W=r(5843);var U=r(7850);var $=r(1176);var V=r(9488);var q=r(715);var G=r(5072);var H=r(4674);var z=r(8657);var K=r(6186);var X=r(730);var Y=r(9942);var J=r(8447);var Z=r(9545);var Q=r(570);var ee=r(3714);var te=r(2970);var re=r(5628);var se=r(8720);var ae=r(8648);var ne=r(8476);var oe=r(1245);var ie=r(5356);var le=r(5502);var ce=r(3448);var ue=r(4122);var pe=r(9453);var de=r(489);var fe=r(3258);var me=r(3744);var ye=r(5899);var ge=r(6668);var he=r(1626);var be={"bugfix/transform-async-arrows-in-class":()=>pe,"bugfix/transform-edge-default-parameters":()=>de,"bugfix/transform-edge-function-name":()=>fe,"bugfix/transform-safari-block-shadowing":()=>ye,"bugfix/transform-safari-for-shadowing":()=>ge,"bugfix/transform-tagged-template-caching":()=>me,"bugfix/transform-v8-spread-parameters-in-optional-chaining":()=>he.default,"proposal-async-generator-functions":()=>h.default,"proposal-class-properties":()=>b.default,"proposal-class-static-block":()=>x.default,"proposal-dynamic-import":()=>v.default,"proposal-export-namespace-from":()=>E.default,"proposal-json-strings":()=>j.default,"proposal-logical-assignment-operators":()=>w.default,"proposal-nullish-coalescing-operator":()=>_.default,"proposal-numeric-separator":()=>S.default,"proposal-object-rest-spread":()=>O.default,"proposal-optional-catch-binding":()=>k.default,"proposal-optional-chaining":()=>P.default,"proposal-private-methods":()=>I.default,"proposal-private-property-in-object":()=>D.default,"proposal-unicode-property-regex":()=>C.default,"syntax-async-generators":()=>s,"syntax-class-properties":()=>a,"syntax-class-static-block":()=>n.default,"syntax-dynamic-import":()=>o,"syntax-export-namespace-from":()=>i,"syntax-json-strings":()=>l,"syntax-logical-assignment-operators":()=>c,"syntax-nullish-coalescing-operator":()=>u,"syntax-numeric-separator":()=>p,"syntax-object-rest-spread":()=>d,"syntax-optional-catch-binding":()=>f,"syntax-optional-chaining":()=>m,"syntax-private-property-in-object":()=>y.default,"syntax-top-level-await":()=>g.default,"transform-arrow-functions":()=>R.default,"transform-async-to-generator":()=>A.default,"transform-block-scoped-functions":()=>N.default,"transform-block-scoping":()=>M.default,"transform-classes":()=>F.default,"transform-computed-properties":()=>L.default,"transform-destructuring":()=>B.default,"transform-dotall-regex":()=>W.default,"transform-duplicate-keys":()=>U.default,"transform-exponentiation-operator":()=>$.default,"transform-for-of":()=>V.default,"transform-function-name":()=>q.default,"transform-literals":()=>G.default,"transform-member-expression-literals":()=>H.default,"transform-modules-amd":()=>z.default,"transform-modules-commonjs":()=>K.default,"transform-modules-systemjs":()=>X.default,"transform-modules-umd":()=>Y.default,"transform-named-capturing-groups-regex":()=>J.default,"transform-new-target":()=>Z.default,"transform-object-super":()=>Q.default,"transform-parameters":()=>ee.default,"transform-property-literals":()=>te.default,"transform-regenerator":()=>re.default,"transform-reserved-words":()=>se.default,"transform-shorthand-properties":()=>ae.default,"transform-spread":()=>ne.default,"transform-sticky-regex":()=>oe.default,"transform-template-literals":()=>ie.default,"transform-typeof-symbol":()=>le.default,"transform-unicode-escapes":()=>ce.default,"transform-unicode-regex":()=>ue.default};t["default"]=be;const xe={"proposal-class-static-block":"7.12.0","proposal-private-property-in-object":"7.10.0"};t.minVersions=xe},4188:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.logPlugin=void 0;var s=r(4413);const logPlugin=(e,t,r)=>{const a=(0,s.getInclusionReasons)(e,t,r);const n=r[e];if(!n){console.log(` ${e}`);return}let o=`{`;let i=true;for(const e of Object.keys(a)){if(!i)o+=`,`;i=false;o+=` ${e}`;if(n[e])o+=` < ${n[e]}`}o+=` }`;console.log(` ${e} ${o}`)};t.logPlugin=logPlugin},2709:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.removeUnnecessaryItems=removeUnnecessaryItems;t.removeUnsupportedItems=removeUnsupportedItems;var s=r(7849);var a=r(9199);const n=Function.call.bind(Object.hasOwnProperty);function removeUnnecessaryItems(e,t){e.forEach((r=>{var s;(s=t[r])==null?void 0:s.forEach((t=>e.delete(t)))}))}function removeUnsupportedItems(e,t){e.forEach((r=>{if(n(a.minVersions,r)&&(0,s.lt)(t,a.minVersions[r])){e.delete(r)}}))}},2196:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;const r=["transform-typeof-symbol"];function _default({loose:e}){return e?r:null}},9290:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isPluginRequired=isPluginRequired;t["default"]=t.getPolyfillPlugins=t.getModulesPluginNames=t.transformIncludesAndExcludes=void 0;var s=r(7849);var a=r(4188);var n=r(2196);var o=r(2709);var i=r(7538);var l=r(4820);var c=r(4951);var u=r(1119);var p=r(7363);var d=r(8170);var f=r(3867);var m=r(9897);var y=r(5825);var g=r(7973);var h=r(4413);var b=r(9199);var x=r(558);const v=m.default||m;const E=y.default||y;const j=g.default||g;function isPluginRequired(e,t){return(0,h.isRequired)("fake-name",e,{compatData:{"fake-name":t}})}function filterStageFromList(e,t){return Object.keys(e).reduce(((r,s)=>{if(!t.has(s)){r[s]=e[s]}return r}),{})}const w={withProposals:{withoutBugfixes:u.plugins,withBugfixes:Object.assign({},u.plugins,u.pluginsBugfixes)},withoutProposals:{withoutBugfixes:filterStageFromList(u.plugins,c.proposalPlugins),withBugfixes:filterStageFromList(Object.assign({},u.plugins,u.pluginsBugfixes),c.proposalPlugins)}};function getPluginList(e,t){if(e){if(t)return w.withProposals.withBugfixes;else return w.withProposals.withoutBugfixes}else{if(t)return w.withoutProposals.withBugfixes;else return w.withoutProposals.withoutBugfixes}}const getPlugin=e=>{const t=b.default[e]();if(!t){throw new Error(`Could not find plugin "${e}". Ensure there is an entry in ./available-plugins.js for it.`)}return t};const transformIncludesAndExcludes=e=>e.reduce(((e,t)=>{const r=t.match(/^(es|es6|es7|esnext|web)\./)?"builtIns":"plugins";e[r].add(t);return e}),{all:e,plugins:new Set,builtIns:new Set});t.transformIncludesAndExcludes=transformIncludesAndExcludes;const getModulesPluginNames=({modules:e,transformations:t,shouldTransformESM:r,shouldTransformDynamicImport:s,shouldTransformExportNamespaceFrom:a,shouldParseTopLevelAwait:n})=>{const o=[];if(e!==false&&t[e]){if(r){o.push(t[e])}if(s&&r&&e!=="umd"){o.push("proposal-dynamic-import")}else{if(s){console.warn("Dynamic import can only be supported when transforming ES modules"+" to AMD, CommonJS or SystemJS. Only the parser plugin will be enabled.")}o.push("syntax-dynamic-import")}}else{o.push("syntax-dynamic-import")}if(a){o.push("proposal-export-namespace-from")}else{o.push("syntax-export-namespace-from")}if(n){o.push("syntax-top-level-await")}return o};t.getModulesPluginNames=getModulesPluginNames;const getPolyfillPlugins=({useBuiltIns:e,corejs:t,polyfillTargets:r,include:s,exclude:a,proposals:n,shippedProposals:o,regenerator:i,debug:l})=>{const c=[];if(e==="usage"||e==="entry"){const u={method:`${e}-global`,version:t?t.toString():undefined,targets:r,include:s,exclude:a,proposals:n,shippedProposals:o,debug:l};if(t){if(e==="usage"){if(t.major===2){c.push([v,u],[f.default,{usage:true}])}else{c.push([E,u],[f.default,{usage:true,deprecated:true}])}if(i){c.push([j,{method:"usage-global",debug:l}])}}else{if(t.major===2){c.push([f.default,{regenerator:i}],[v,u])}else{c.push([E,u],[f.default,{deprecated:true}]);if(!i){c.push([d.default,u])}}}}}return c};t.getPolyfillPlugins=getPolyfillPlugins;function getLocalTargets(e,t,r,s){if(e!=null&&e.esmodules&&e.browsers){console.warn(`\n@babel/preset-env: esmodules and browsers targets have been specified together.\n\`browsers\` target, \`${e.browsers.toString()}\` will be ignored.\n`)}return(0,h.default)(e,{ignoreBrowserslistConfig:t,configPath:r,browserslistEnv:s})}function supportsStaticESM(e){return!!(e!=null&&e.supportsStaticESM)}function supportsDynamicImport(e){return!!(e!=null&&e.supportsDynamicImport)}function supportsExportNamespaceFrom(e){return!!(e!=null&&e.supportsExportNamespaceFrom)}function supportsTopLevelAwait(e){return!!(e!=null&&e.supportsTopLevelAwait)}var _=(0,x.declare)(((e,t)=>{e.assertVersion(7);const r=e.targets();const{bugfixes:u,configPath:d,debug:f,exclude:m,forceAllTransforms:y,ignoreBrowserslistConfig:g,include:b,loose:x,modules:v,shippedProposals:E,spec:j,targets:w,useBuiltIns:_,corejs:{version:S,proposals:O},browserslistEnv:k}=(0,l.default)(t);let P=r;if((0,s.lt)(e.version,"7.13.0")||t.targets||t.configPath||t.browserslistEnv||t.ignoreBrowserslistConfig){{var I=false;if(w!=null&&w.uglify){I=true;delete w.uglify;console.warn(`\nThe uglify target has been deprecated. Set the top level\noption \`forceAllTransforms: true\` instead.\n`)}}P=getLocalTargets(w,g,d,k)}const D=y||I?{}:P;const C=transformIncludesAndExcludes(b);const A=transformIncludesAndExcludes(m);const R=getPluginList(E,u);const N=v==="auto"&&(e.caller==null?void 0:e.caller(supportsExportNamespaceFrom))||v===false&&!(0,h.isRequired)("proposal-export-namespace-from",D,{compatData:R,includes:C.plugins,excludes:A.plugins});const M=getModulesPluginNames({modules:v,transformations:i.default,shouldTransformESM:v!=="auto"||!(e.caller!=null&&e.caller(supportsStaticESM)),shouldTransformDynamicImport:v!=="auto"||!(e.caller!=null&&e.caller(supportsDynamicImport)),shouldTransformExportNamespaceFrom:!N,shouldParseTopLevelAwait:!e.caller||e.caller(supportsTopLevelAwait)});const F=(0,h.filterItems)(R,C.plugins,A.plugins,D,M,(0,n.default)({loose:x}),c.pluginSyntaxMap);(0,o.removeUnnecessaryItems)(F,p);(0,o.removeUnsupportedItems)(F,e.version);const L=getPolyfillPlugins({useBuiltIns:_,corejs:S,polyfillTargets:P,include:C.builtIns,exclude:A.builtIns,proposals:O,shippedProposals:E,regenerator:F.has("transform-regenerator"),debug:f});const B=_!==false;const W=Array.from(F).map((e=>{if(e==="proposal-class-properties"||e==="proposal-private-methods"||e==="proposal-private-property-in-object"){return[getPlugin(e),{loose:x?"#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error":"#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"}]}return[getPlugin(e),{spec:j,loose:x,useBuiltIns:B}]})).concat(L);if(f){console.log("@babel/preset-env: `DEBUG` option");console.log("\nUsing targets:");console.log(JSON.stringify((0,h.prettifyTargets)(P),null,2));console.log(`\nUsing modules transform: ${v.toString()}`);console.log("\nUsing plugins:");F.forEach((e=>{(0,a.logPlugin)(e,P,R)}));if(!_){console.log("\nUsing polyfills: No polyfills were added, since the `useBuiltIns` option was not set.")}}return{plugins:W}}));t["default"]=_},7538:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var r={auto:"transform-modules-commonjs",amd:"transform-modules-amd",commonjs:"transform-modules-commonjs",cjs:"transform-modules-commonjs",systemjs:"transform-modules-systemjs",umd:"transform-modules-umd"};t["default"]=r},4820:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.normalizeCoreJSOption=normalizeCoreJSOption;t["default"]=normalizeOptions;t.validateUseBuiltInsOption=t.validateModulesOption=t.checkDuplicateIncludeExcludes=t.normalizePluginName=void 0;var s=r(6578);var a=r(7849);var n=r(2272);var o=r(1119);var i=r(7538);var l=r(7619);var c=r(7347);const u=["web.timers","web.immediate","web.dom.iterable"];const p=new c.OptionValidator("@babel/preset-env");const d=Object.keys(o.plugins);const f=["proposal-dynamic-import",...Object.keys(i.default).map((e=>i.default[e]))];const getValidIncludesAndExcludes=(e,t)=>new Set([...d,...e==="exclude"?f:[],...t?t==2?[...Object.keys(n),...u]:Object.keys(s):[]]);const pluginToRegExp=e=>{if(e instanceof RegExp)return e;try{return new RegExp(`^${normalizePluginName(e)}$`)}catch(e){return null}};const selectPlugins=(e,t,r)=>Array.from(getValidIncludesAndExcludes(t,r)).filter((t=>e instanceof RegExp&&e.test(t)));const flatten=e=>[].concat(...e);const expandIncludesAndExcludes=(e=[],t,r)=>{if(e.length===0)return[];const s=e.map((e=>selectPlugins(pluginToRegExp(e),t,r)));const a=e.filter(((e,t)=>s[t].length===0));p.invariant(a.length===0,`The plugins/built-ins '${a.join(", ")}' passed to the '${t}' option are not\n valid. Please check data/[plugin-features|built-in-features].js in babel-preset-env`);return flatten(s)};const normalizePluginName=e=>e.replace(/^(@babel\/|babel-)(plugin-)?/,"");t.normalizePluginName=normalizePluginName;const checkDuplicateIncludeExcludes=(e=[],t=[])=>{const r=e.filter((e=>t.indexOf(e)>=0));p.invariant(r.length===0,`The plugins/built-ins '${r.join(", ")}' were found in both the "include" and\n "exclude" options.`)};t.checkDuplicateIncludeExcludes=checkDuplicateIncludeExcludes;const normalizeTargets=e=>{if(typeof e==="string"||Array.isArray(e)){return{browsers:e}}return Object.assign({},e)};const validateModulesOption=(e=l.ModulesOption.auto)=>{p.invariant(l.ModulesOption[e.toString()]||e===l.ModulesOption.false,`The 'modules' option must be one of \n`+` - 'false' to indicate no module processing\n`+` - a specific module type: 'commonjs', 'amd', 'umd', 'systemjs'`+` - 'auto' (default) which will automatically select 'false' if the current\n`+` process is known to support ES module syntax, or "commonjs" otherwise\n`);return e};t.validateModulesOption=validateModulesOption;const validateUseBuiltInsOption=(e=false)=>{p.invariant(l.UseBuiltInsOption[e.toString()]||e===l.UseBuiltInsOption.false,`The 'useBuiltIns' option must be either\n 'false' (default) to indicate no polyfill,\n '"entry"' to indicate replacing the entry polyfill, or\n '"usage"' to import only used polyfills per file`);return e};t.validateUseBuiltInsOption=validateUseBuiltInsOption;function normalizeCoreJSOption(e,t){let r=false;let s;if(t&&e===undefined){s=2;console.warn("\nWARNING (@babel/preset-env): We noticed you're using the `useBuiltIns` option without declaring a "+"core-js version. Currently, we assume version 2.x when no version "+"is passed. Since this default version will likely change in future "+"versions of Babel, we recommend explicitly setting the core-js version "+"you are using via the `corejs` option.\n"+"\nYou should also be sure that the version you pass to the `corejs` "+"option matches the version specified in your `package.json`'s "+"`dependencies` section. If it doesn't, you need to run one of the "+"following commands:\n\n"+" npm install --save core-js@2 npm install --save core-js@3\n"+" yarn add core-js@2 yarn add core-js@3\n\n"+"More info about useBuiltIns: https://babeljs.io/docs/en/babel-preset-env#usebuiltins\n"+"More info about core-js: https://babeljs.io/docs/en/babel-preset-env#corejs")}else if(typeof e==="object"&&e!==null){s=e.version;r=Boolean(e.proposals)}else{s=e}const n=s?(0,a.coerce)(String(s)):false;if(!t&&n){console.warn("\nWARNING (@babel/preset-env): The `corejs` option only has an effect when the `useBuiltIns` option is not `false`\n")}if(t&&(!n||n.major<2||n.major>3)){throw new RangeError("Invalid Option: The version passed to `corejs` is invalid. Currently, "+"only core-js@2 and core-js@3 are supported.")}return{version:n,proposals:r}}function normalizeOptions(e){p.validateTopLevelOptions(e,l.TopLevelOptions);const t=validateUseBuiltInsOption(e.useBuiltIns);const r=normalizeCoreJSOption(e.corejs,t);const s=expandIncludesAndExcludes(e.include,l.TopLevelOptions.include,!!r.version&&r.version.major);const a=expandIncludesAndExcludes(e.exclude,l.TopLevelOptions.exclude,!!r.version&&r.version.major);checkDuplicateIncludeExcludes(s,a);return{bugfixes:p.validateBooleanOption(l.TopLevelOptions.bugfixes,e.bugfixes,false),configPath:p.validateStringOption(l.TopLevelOptions.configPath,e.configPath,process.cwd()),corejs:r,debug:p.validateBooleanOption(l.TopLevelOptions.debug,e.debug,false),include:s,exclude:a,forceAllTransforms:p.validateBooleanOption(l.TopLevelOptions.forceAllTransforms,e.forceAllTransforms,false),ignoreBrowserslistConfig:p.validateBooleanOption(l.TopLevelOptions.ignoreBrowserslistConfig,e.ignoreBrowserslistConfig,false),loose:p.validateBooleanOption(l.TopLevelOptions.loose,e.loose),modules:validateModulesOption(e.modules),shippedProposals:p.validateBooleanOption(l.TopLevelOptions.shippedProposals,e.shippedProposals,false),spec:p.validateBooleanOption(l.TopLevelOptions.spec,e.spec,false),targets:normalizeTargets(e.targets),useBuiltIns:t,browserslistEnv:p.validateStringOption(l.TopLevelOptions.browserslistEnv,e.browserslistEnv)}}},7619:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.UseBuiltInsOption=t.ModulesOption=t.TopLevelOptions=void 0;const r={bugfixes:"bugfixes",configPath:"configPath",corejs:"corejs",debug:"debug",exclude:"exclude",forceAllTransforms:"forceAllTransforms",ignoreBrowserslistConfig:"ignoreBrowserslistConfig",include:"include",loose:"loose",modules:"modules",shippedProposals:"shippedProposals",spec:"spec",targets:"targets",useBuiltIns:"useBuiltIns",browserslistEnv:"browserslistEnv"};t.TopLevelOptions=r;const s={false:false,auto:"auto",amd:"amd",commonjs:"commonjs",cjs:"cjs",systemjs:"systemjs",umd:"umd"};t.ModulesOption=s;const a={false:false,entry:"entry",usage:"usage"};t.UseBuiltInsOption=a},1119:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.pluginsBugfixes=t.plugins=void 0;var s=r(5884);var a=r(3574);var n=r(9199);const o={};t.plugins=o;const i={};t.pluginsBugfixes=i;for(const e of Object.keys(s)){if(Object.hasOwnProperty.call(n.default,e)){o[e]=s[e]}}for(const e of Object.keys(a)){if(Object.hasOwnProperty.call(n.default,e)){i[e]=a[e]}}o["proposal-class-properties"]=o["proposal-private-methods"]},3867:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(3931);var a=r(8622);const n=`\n \`@babel/polyfill\` is deprecated. Please, use required parts of \`core-js\`\n and \`regenerator-runtime/runtime\` separately`;const o=`\n When setting \`useBuiltIns: 'usage'\`, polyfills are automatically imported when needed.\n Please remove the direct import of \`SPECIFIER\` or use \`useBuiltIns: 'entry'\` instead.`;function _default({template:e},{regenerator:t,deprecated:r,usage:a}){return{name:"preset-env/replace-babel-polyfill",visitor:{ImportDeclaration(i){const l=(0,s.getImportSource)(i);if(a&&(0,s.isPolyfillSource)(l)){console.warn(o.replace("SPECIFIER",l));if(!r)i.remove()}else if(l==="@babel/polyfill"){if(r){console.warn(n)}else if(t){i.replaceWithMultiple(e.ast` + `}function buildPrivateMethodDeclaration(e,t,r=false){const a=t.get(e.node.key.id.name);const{id:n,methodId:o,getId:i,setId:l,getterDeclared:c,setterDeclared:u,static:p}=a;const{params:f,body:d,generator:m,async:y}=e.node;const g=i&&!c&&f.length===0;const h=l&&!u&&f.length>0;let b=o;if(g){t.set(e.node.key.id.name,Object.assign({},a,{getterDeclared:true}));b=i}else if(h){t.set(e.node.key.id.name,Object.assign({},a,{setterDeclared:true}));b=l}else if(p&&!r){b=n}return s.types.functionDeclaration(s.types.cloneNode(b),f,d,m,y)}const d=s.traverse.visitors.merge([{ThisExpression(e,t){t.needsClassRef=true;e.replaceWith(s.types.cloneNode(t.classRef))},MetaProperty(e){const t=e.get("meta");const r=e.get("property");const{scope:s}=e;if(t.isIdentifier({name:"new"})&&r.isIdentifier({name:"target"})){e.replaceWith(s.buildUndefinedNode())}}},a.environmentVisitor]);const m={ReferencedIdentifier(e,t){if(e.scope.bindingIdentifierEquals(e.node.name,t.innerBinding)){t.needsClassRef=true;e.node.name=t.classRef.name}}};function replaceThisContext(e,t,r,n,o,i,l){var c;const u={classRef:t,needsClassRef:false,innerBinding:l};const p=new a.default({methodPath:e,constantSuper:i,file:n,refToPreserve:t,getSuperRef:r,getObjectRef(){u.needsClassRef=true;return o||e.node.static?t:s.types.memberExpression(t,s.types.identifier("prototype"))}});p.replace();if(o||e.isProperty()){e.traverse(d,u)}if((c=u.classRef)!=null&&c.name&&u.classRef.name!==(l==null?void 0:l.name)){e.traverse(m,u)}return u.needsClassRef}function buildFieldsInitNodes(e,t,r,a,n,o,i,c,u){let p=false;let f;const d=[];const m=[];const y=[];const g=s.types.isIdentifier(t)?()=>t:()=>{var e;(e=f)!=null?e:f=r[0].scope.generateUidIdentifierBasedOnNode(t);return f};for(const t of r){t.isClassProperty()&&l.assertFieldTransformed(t);const r=t.node.static;const f=!r;const h=t.isPrivate();const b=!h;const x=t.isProperty();const v=!x;const E=t.isStaticBlock==null?void 0:t.isStaticBlock();if(r||v&&h||E){const r=replaceThisContext(t,e,g,n,E,c,u);p=p||r}switch(true){case E:d.push(s.template.statement.ast`(() => ${s.types.blockStatement(t.node.body)})()`);break;case r&&h&&x&&i:p=true;d.push(buildPrivateFieldInitLoose(s.types.cloneNode(e),t,a));break;case r&&h&&x&&!i:p=true;d.push(buildPrivateStaticFieldInitSpec(t,a));break;case r&&b&&x&&o:p=true;d.push(buildPublicFieldInitLoose(s.types.cloneNode(e),t));break;case r&&b&&x&&!o:p=true;d.push(buildPublicFieldInitSpec(s.types.cloneNode(e),t,n));break;case f&&h&&x&&i:m.push(buildPrivateFieldInitLoose(s.types.thisExpression(),t,a));break;case f&&h&&x&&!i:m.push(buildPrivateInstanceFieldInitSpec(s.types.thisExpression(),t,a));break;case f&&h&&v&&i:m.unshift(buildPrivateMethodInitLoose(s.types.thisExpression(),t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case f&&h&&v&&!i:m.unshift(buildPrivateInstanceMethodInitSpec(s.types.thisExpression(),t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case r&&h&&v&&!i:p=true;d.unshift(buildPrivateStaticFieldInitSpec(t,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case r&&h&&v&&i:p=true;d.unshift(buildPrivateStaticMethodInitLoose(s.types.cloneNode(e),t,n,a));y.push(buildPrivateMethodDeclaration(t,a,i));break;case f&&b&&x&&o:m.push(buildPublicFieldInitLoose(s.types.thisExpression(),t));break;case f&&b&&x&&!o:m.push(buildPublicFieldInitSpec(s.types.thisExpression(),t,n));break;default:throw new Error("Unreachable.")}}return{staticNodes:d.filter(Boolean),instanceNodes:m.filter(Boolean),pureStaticNodes:y.filter(Boolean),wrapClass(t){for(const e of r){e.remove()}if(f){t.scope.push({id:s.types.cloneNode(f)});t.set("superClass",s.types.assignmentExpression("=",f,t.node.superClass))}if(!p)return t;if(t.isClassExpression()){t.scope.push({id:e});t.replaceWith(s.types.assignmentExpression("=",s.types.cloneNode(e),t.node))}else if(!t.node.id){t.node.id=e}return t}}}},738:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.createClassFeaturePlugin=createClassFeaturePlugin;Object.defineProperty(t,"injectInitialization",{enumerable:true,get:function(){return l.injectInitialization}});Object.defineProperty(t,"enableFeature",{enumerable:true,get:function(){return c.enableFeature}});Object.defineProperty(t,"FEATURES",{enumerable:true,get:function(){return c.FEATURES}});var s=r(8304);var a=r(550);var n=r(7058);var o=r(196);var i=r(7055);var l=r(3235);var c=r(5123);const u="7.15.0".split(".").reduce(((e,t)=>e*1e5+ +t),0);const p="@babel/plugin-class-features/version";function createClassFeaturePlugin({name:e,feature:t,loose:r,manipulateOptions:f,api:d={assumption:()=>void 0}}){const m=d.assumption("setPublicClassFields");const y=d.assumption("privateFieldsAsProperties");const g=d.assumption("constantSuper");const h=d.assumption("noDocumentAll");if(r===true){const t=[];if(m!==undefined){t.push(`"setPublicClassFields"`)}if(y!==undefined){t.push(`"privateFieldsAsProperties"`)}if(t.length!==0){console.warn(`[${e}]: You are using the "loose: true" option and you are`+` explicitly setting a value for the ${t.join(" and ")}`+` assumption${t.length>1?"s":""}. The "loose" option`+` can cause incompatibilities with the other class features`+` plugins, so it's recommended that you replace it with the`+` following top-level option:\n`+`\t"assumptions": {\n`+`\t\t"setPublicClassFields": true,\n`+`\t\t"privateFieldsAsProperties": true\n`+`\t}`)}}return{name:e,manipulateOptions:f,pre(){(0,c.enableFeature)(this.file,t,r);if(!this.file.get(p)||this.file.get(p)0){(0,l.injectInitialization)(e,f,P,((e,t)=>{if(d)return;for(const r of b){if(r.node.static)continue;r.traverse(e,t)}}))}const A=C(e);A.insertBefore([...k,...O]);if(I.length>0){A.insertAfter(I)}if(D.length>0){A.find((e=>e.isStatement()||e.isDeclaration())).insertAfter(D)}},PrivateName(e){if(this.file.get(p)!==u||e.parentPath.isPrivate({key:e.node})){return}throw e.buildCodeFrameError(`Unknown PrivateName "${e}"`)},ExportDefaultDeclaration(e){if(this.file.get(p)!==u)return;const t=e.get("declaration");if(t.isClassDeclaration()&&(0,i.hasDecorators)(t.node)){if(t.node.id){(0,n.default)(e)}else{t.node.type="ClassExpression"}}}}}}},3235:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.injectInitialization=injectInitialization;t.extractComputedKeys=extractComputedKeys;var s=r(8304);var a=r(4725);const n=s.traverse.visitors.merge([{Super(e){const{node:t,parentPath:r}=e;if(r.isCallExpression({callee:t})){this.push(r)}}},a.environmentVisitor]);const o={"TSTypeAnnotation|TypeAnnotation"(e){e.skip()},ReferencedIdentifier(e){if(this.scope.hasOwnBinding(e.node.name)){this.scope.rename(e.node.name);e.skip()}}};function handleClassTDZ(e,t){if(t.classBinding&&t.classBinding===e.scope.getBinding(e.node.name)){const r=t.file.addHelper("classNameTDZError");const a=s.types.callExpression(r,[s.types.stringLiteral(e.node.name)]);e.replaceWith(s.types.sequenceExpression([a,e.node]));e.skip()}}const i={ReferencedIdentifier:handleClassTDZ};function injectInitialization(e,t,r,a){if(!r.length)return;const i=!!e.node.superClass;if(!t){const r=s.types.classMethod("constructor",s.types.identifier("constructor"),[],s.types.blockStatement([]));if(i){r.params=[s.types.restElement(s.types.identifier("args"))];r.body.body.push(s.template.statement.ast`super(...args)`)}[t]=e.get("body").unshiftContainer("body",r)}if(a){a(o,{scope:t.scope})}if(i){const e=[];t.traverse(n,e);let a=true;for(const t of e){if(a){t.insertAfter(r);a=false}else{t.insertAfter(r.map((e=>s.types.cloneNode(e))))}}}else{t.get("body").unshiftContainer("body",r)}}function extractComputedKeys(e,t,r,a){const n=[];const o={classBinding:t.node.id&&t.scope.getBinding(t.node.id.name),file:a};for(const e of r){const r=e.get("key");if(r.isReferencedIdentifier()){handleClassTDZ(r,o)}else{r.traverse(i,o)}const a=e.node;if(!r.isConstantExpression()){const e=t.scope.generateUidIdentifierBasedOnNode(a.key);t.scope.push({id:e,kind:"let"});n.push(s.types.expressionStatement(s.types.assignmentExpression("=",s.types.cloneNode(e),a.key)));a.key=s.types.cloneNode(e)}}return n}},5464:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.assertFieldTransformed=assertFieldTransformed;function assertFieldTransformed(e){if(e.node.declare){throw e.buildCodeFrameError(`TypeScript 'declare' fields must first be transformed by `+`@babel/plugin-transform-typescript.\n`+`If you have already enabled that plugin (or '@babel/preset-typescript'), make sure `+`that it runs before any plugin related to additional class features:\n`+` - @babel/plugin-proposal-class-properties\n`+` - @babel/plugin-proposal-private-methods\n`+` - @babel/plugin-proposal-decorators`)}}},4725:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.skipAllButComputedKey=skipAllButComputedKey;t["default"]=t.environmentVisitor=void 0;var s=r(7369);var a=r(5789);var n=r(6721);var o=r(8622);function getPrototypeOfExpression(e,t,r,s){e=o.cloneNode(e);const a=t||s?e:o.memberExpression(e,o.identifier("prototype"));return o.callExpression(r.addHelper("getPrototypeOf"),[a])}function skipAllButComputedKey(e){if(!e.node.computed){e.skip();return}const t=o.VISITOR_KEYS[e.type];for(const r of t){if(r!=="key")e.skipKey(r)}}const i={[`${o.staticBlock?"StaticBlock|":""}ClassPrivateProperty|TypeAnnotation`](e){e.skip()},Function(e){if(e.isMethod())return;if(e.isArrowFunctionExpression())return;e.skip()},"Method|ClassProperty"(e){skipAllButComputedKey(e)}};t.environmentVisitor=i;const l=s.default.visitors.merge([i,{Super(e,t){const{node:r,parentPath:s}=e;if(!s.isMemberExpression({object:r}))return;t.handle(s)}}]);const c=s.default.visitors.merge([i,{Scopable(e,{refName:t}){const r=e.scope.getOwnBinding(t);if(r&&r.identifier.name===t){e.scope.rename(t)}}}]);const u={memoise(e,t){const{scope:r,node:s}=e;const{computed:a,property:n}=s;if(!a){return}const o=r.maybeGenerateMemoised(n);if(!o){return}this.memoiser.set(n,o,t)},prop(e){const{computed:t,property:r}=e.node;if(this.memoiser.has(r)){return o.cloneNode(this.memoiser.get(r))}if(t){return o.cloneNode(r)}return o.stringLiteral(r.name)},get(e){return this._get(e,this._getThisRefs())},_get(e,t){const r=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("get"),[t.memo?o.sequenceExpression([t.memo,r]):r,this.prop(e),t.this])},_getThisRefs(){if(!this.isDerivedConstructor){return{this:o.thisExpression()}}const e=this.scope.generateDeclaredUidIdentifier("thisSuper");return{memo:o.assignmentExpression("=",e,o.thisExpression()),this:o.cloneNode(e)}},set(e,t){const r=this._getThisRefs();const s=getPrototypeOfExpression(this.getObjectRef(),this.isStatic,this.file,this.isPrivateMethod);return o.callExpression(this.file.addHelper("set"),[r.memo?o.sequenceExpression([r.memo,s]):s,this.prop(e),t,r.this,o.booleanLiteral(e.isInStrictMode())])},destructureSet(e){throw e.buildCodeFrameError(`Destructuring to a super field is not supported yet.`)},call(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,false)},optionalCall(e,t){const r=this._getThisRefs();return(0,n.default)(this._get(e,r),o.cloneNode(r.this),t,true)}};const p=Object.assign({},u,{prop(e){const{property:t}=e.node;if(this.memoiser.has(t)){return o.cloneNode(this.memoiser.get(t))}return o.cloneNode(t)},get(e){const{isStatic:t,getSuperRef:r}=this;const{computed:s}=e.node;const a=this.prop(e);let n;if(t){var i;n=(i=r())!=null?i:o.memberExpression(o.identifier("Function"),o.identifier("prototype"))}else{var l;n=o.memberExpression((l=r())!=null?l:o.identifier("Object"),o.identifier("prototype"))}return o.memberExpression(n,a,s)},set(e,t){const{computed:r}=e.node;const s=this.prop(e);return o.assignmentExpression("=",o.memberExpression(o.thisExpression(),s,r),t)},destructureSet(e){const{computed:t}=e.node;const r=this.prop(e);return o.memberExpression(o.thisExpression(),r,t)},call(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,false)},optionalCall(e,t){return(0,n.default)(this.get(e),o.thisExpression(),t,true)}});class ReplaceSupers{constructor(e){var t;const r=e.methodPath;this.methodPath=r;this.isDerivedConstructor=r.isClassMethod({kind:"constructor"})&&!!e.superRef;this.isStatic=r.isObjectMethod()||r.node.static||(r.isStaticBlock==null?void 0:r.isStaticBlock());this.isPrivateMethod=r.isPrivate()&&r.isMethod();this.file=e.file;this.constantSuper=(t=e.constantSuper)!=null?t:e.isLoose;this.opts=e}getObjectRef(){return o.cloneNode(this.opts.objectRef||this.opts.getObjectRef())}getSuperRef(){if(this.opts.superRef)return o.cloneNode(this.opts.superRef);if(this.opts.getSuperRef)return o.cloneNode(this.opts.getSuperRef())}replace(){if(this.opts.refToPreserve){this.methodPath.traverse(c,{refName:this.opts.refToPreserve.name})}const e=this.constantSuper?p:u;(0,a.default)(this.methodPath,l,Object.assign({file:this.file,scope:this.methodPath.scope,isDerivedConstructor:this.isDerivedConstructor,isStatic:this.isStatic,isPrivateMethod:this.isPrivateMethod,getObjectRef:this.getObjectRef.bind(this),getSuperRef:this.getSuperRef.bind(this),boundGet:e.get},e))}}t["default"]=ReplaceSupers},4951:e=>{const t=new Set(["proposal-class-static-block"]);const r={"proposal-async-generator-functions":"syntax-async-generators","proposal-class-properties":"syntax-class-properties","proposal-class-static-block":"syntax-class-static-block","proposal-json-strings":"syntax-json-strings","proposal-nullish-coalescing-operator":"syntax-nullish-coalescing-operator","proposal-numeric-separator":"syntax-numeric-separator","proposal-object-rest-spread":"syntax-object-rest-spread","proposal-optional-catch-binding":"syntax-optional-catch-binding","proposal-optional-chaining":"syntax-optional-chaining","proposal-private-methods":"syntax-class-properties","proposal-private-property-in-object":"syntax-private-property-in-object","proposal-unicode-property-regex":null};const s=Object.keys(r).map((function(e){return[e,r[e]]}));const a=new Map(s);e.exports={pluginSyntaxMap:a,proposalPlugins:t}},9199:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.minVersions=t["default"]=void 0;var s=r(1079);var a=r(947);var n=r(8142);var o=r(5163);var i=r(1454);var l=r(3030);var c=r(5945);var u=r(5879);var p=r(1816);var f=r(4499);var d=r(7452);var m=r(79);var y=r(7445);var g=r(4893);var h=r(2271);var b=r(8027);var x=r(5557);var v=r(4920);var E=r(9579);var j=r(7703);var w=r(1195);var _=r(5353);var S=r(7300);var k=r(6309);var O=r(4195);var I=r(7490);var P=r(9062);var D=r(3181);var C=r(6092);var A=r(6413);var R=r(513);var N=r(8363);var M=r(1630);var L=r(6408);var F=r(8120);var B=r(5157);var W=r(5843);var U=r(7850);var V=r(1176);var $=r(9488);var q=r(715);var G=r(5072);var H=r(4674);var z=r(8657);var K=r(6186);var X=r(730);var Y=r(9942);var J=r(8447);var Z=r(9545);var Q=r(570);var ee=r(3714);var te=r(2970);var re=r(5628);var se=r(8720);var ae=r(8648);var ne=r(8476);var oe=r(1245);var ie=r(5356);var le=r(5502);var ce=r(3448);var ue=r(4122);var pe=r(9453);var fe=r(489);var de=r(3258);var me=r(3744);var ye=r(5899);var ge=r(6668);var he=r(1626);var be={"bugfix/transform-async-arrows-in-class":()=>pe,"bugfix/transform-edge-default-parameters":()=>fe,"bugfix/transform-edge-function-name":()=>de,"bugfix/transform-safari-block-shadowing":()=>ye,"bugfix/transform-safari-for-shadowing":()=>ge,"bugfix/transform-tagged-template-caching":()=>me,"bugfix/transform-v8-spread-parameters-in-optional-chaining":()=>he.default,"proposal-async-generator-functions":()=>h.default,"proposal-class-properties":()=>b.default,"proposal-class-static-block":()=>x.default,"proposal-dynamic-import":()=>v.default,"proposal-export-namespace-from":()=>E.default,"proposal-json-strings":()=>j.default,"proposal-logical-assignment-operators":()=>w.default,"proposal-nullish-coalescing-operator":()=>_.default,"proposal-numeric-separator":()=>S.default,"proposal-object-rest-spread":()=>k.default,"proposal-optional-catch-binding":()=>O.default,"proposal-optional-chaining":()=>I.default,"proposal-private-methods":()=>P.default,"proposal-private-property-in-object":()=>D.default,"proposal-unicode-property-regex":()=>C.default,"syntax-async-generators":()=>s,"syntax-class-properties":()=>a,"syntax-class-static-block":()=>n.default,"syntax-dynamic-import":()=>o,"syntax-export-namespace-from":()=>i,"syntax-json-strings":()=>l,"syntax-logical-assignment-operators":()=>c,"syntax-nullish-coalescing-operator":()=>u,"syntax-numeric-separator":()=>p,"syntax-object-rest-spread":()=>f,"syntax-optional-catch-binding":()=>d,"syntax-optional-chaining":()=>m,"syntax-private-property-in-object":()=>y.default,"syntax-top-level-await":()=>g.default,"transform-arrow-functions":()=>R.default,"transform-async-to-generator":()=>A.default,"transform-block-scoped-functions":()=>N.default,"transform-block-scoping":()=>M.default,"transform-classes":()=>L.default,"transform-computed-properties":()=>F.default,"transform-destructuring":()=>B.default,"transform-dotall-regex":()=>W.default,"transform-duplicate-keys":()=>U.default,"transform-exponentiation-operator":()=>V.default,"transform-for-of":()=>$.default,"transform-function-name":()=>q.default,"transform-literals":()=>G.default,"transform-member-expression-literals":()=>H.default,"transform-modules-amd":()=>z.default,"transform-modules-commonjs":()=>K.default,"transform-modules-systemjs":()=>X.default,"transform-modules-umd":()=>Y.default,"transform-named-capturing-groups-regex":()=>J.default,"transform-new-target":()=>Z.default,"transform-object-super":()=>Q.default,"transform-parameters":()=>ee.default,"transform-property-literals":()=>te.default,"transform-regenerator":()=>re.default,"transform-reserved-words":()=>se.default,"transform-shorthand-properties":()=>ae.default,"transform-spread":()=>ne.default,"transform-sticky-regex":()=>oe.default,"transform-template-literals":()=>ie.default,"transform-typeof-symbol":()=>le.default,"transform-unicode-escapes":()=>ce.default,"transform-unicode-regex":()=>ue.default};t["default"]=be;const xe={"proposal-class-static-block":"7.12.0","proposal-private-property-in-object":"7.10.0"};t.minVersions=xe},4188:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.logPlugin=void 0;var s=r(4413);const logPlugin=(e,t,r)=>{const a=(0,s.getInclusionReasons)(e,t,r);const n=r[e];if(!n){console.log(` ${e}`);return}let o=`{`;let i=true;for(const e of Object.keys(a)){if(!i)o+=`,`;i=false;o+=` ${e}`;if(n[e])o+=` < ${n[e]}`}o+=` }`;console.log(` ${e} ${o}`)};t.logPlugin=logPlugin},2709:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.removeUnnecessaryItems=removeUnnecessaryItems;t.removeUnsupportedItems=removeUnsupportedItems;var s=r(7849);var a=r(9199);const n=Function.call.bind(Object.hasOwnProperty);function removeUnnecessaryItems(e,t){e.forEach((r=>{var s;(s=t[r])==null?void 0:s.forEach((t=>e.delete(t)))}))}function removeUnsupportedItems(e,t){e.forEach((r=>{if(n(a.minVersions,r)&&(0,s.lt)(t,a.minVersions[r])){e.delete(r)}}))}},2196:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;const r=["transform-typeof-symbol"];function _default({loose:e}){return e?r:null}},9290:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isPluginRequired=isPluginRequired;t["default"]=t.getPolyfillPlugins=t.getModulesPluginNames=t.transformIncludesAndExcludes=void 0;var s=r(7849);var a=r(4188);var n=r(2196);var o=r(2709);var i=r(7538);var l=r(4820);var c=r(4951);var u=r(1119);var p=r(7363);var f=r(8170);var d=r(3867);var m=r(9897);var y=r(5825);var g=r(7973);var h=r(4413);var b=r(9199);var x=r(558);const v=m.default||m;const E=y.default||y;const j=g.default||g;function isPluginRequired(e,t){return(0,h.isRequired)("fake-name",e,{compatData:{"fake-name":t}})}function filterStageFromList(e,t){return Object.keys(e).reduce(((r,s)=>{if(!t.has(s)){r[s]=e[s]}return r}),{})}const w={withProposals:{withoutBugfixes:u.plugins,withBugfixes:Object.assign({},u.plugins,u.pluginsBugfixes)},withoutProposals:{withoutBugfixes:filterStageFromList(u.plugins,c.proposalPlugins),withBugfixes:filterStageFromList(Object.assign({},u.plugins,u.pluginsBugfixes),c.proposalPlugins)}};function getPluginList(e,t){if(e){if(t)return w.withProposals.withBugfixes;else return w.withProposals.withoutBugfixes}else{if(t)return w.withoutProposals.withBugfixes;else return w.withoutProposals.withoutBugfixes}}const getPlugin=e=>{const t=b.default[e]();if(!t){throw new Error(`Could not find plugin "${e}". Ensure there is an entry in ./available-plugins.js for it.`)}return t};const transformIncludesAndExcludes=e=>e.reduce(((e,t)=>{const r=t.match(/^(es|es6|es7|esnext|web)\./)?"builtIns":"plugins";e[r].add(t);return e}),{all:e,plugins:new Set,builtIns:new Set});t.transformIncludesAndExcludes=transformIncludesAndExcludes;const getModulesPluginNames=({modules:e,transformations:t,shouldTransformESM:r,shouldTransformDynamicImport:s,shouldTransformExportNamespaceFrom:a,shouldParseTopLevelAwait:n})=>{const o=[];if(e!==false&&t[e]){if(r){o.push(t[e])}if(s&&r&&e!=="umd"){o.push("proposal-dynamic-import")}else{if(s){console.warn("Dynamic import can only be supported when transforming ES modules"+" to AMD, CommonJS or SystemJS. Only the parser plugin will be enabled.")}o.push("syntax-dynamic-import")}}else{o.push("syntax-dynamic-import")}if(a){o.push("proposal-export-namespace-from")}else{o.push("syntax-export-namespace-from")}if(n){o.push("syntax-top-level-await")}return o};t.getModulesPluginNames=getModulesPluginNames;const getPolyfillPlugins=({useBuiltIns:e,corejs:t,polyfillTargets:r,include:s,exclude:a,proposals:n,shippedProposals:o,regenerator:i,debug:l})=>{const c=[];if(e==="usage"||e==="entry"){const u={method:`${e}-global`,version:t?t.toString():undefined,targets:r,include:s,exclude:a,proposals:n,shippedProposals:o,debug:l};if(t){if(e==="usage"){if(t.major===2){c.push([v,u],[d.default,{usage:true}])}else{c.push([E,u],[d.default,{usage:true,deprecated:true}])}if(i){c.push([j,{method:"usage-global",debug:l}])}}else{if(t.major===2){c.push([d.default,{regenerator:i}],[v,u])}else{c.push([E,u],[d.default,{deprecated:true}]);if(!i){c.push([f.default,u])}}}}}return c};t.getPolyfillPlugins=getPolyfillPlugins;function getLocalTargets(e,t,r,s){if(e!=null&&e.esmodules&&e.browsers){console.warn(`\n@babel/preset-env: esmodules and browsers targets have been specified together.\n\`browsers\` target, \`${e.browsers.toString()}\` will be ignored.\n`)}return(0,h.default)(e,{ignoreBrowserslistConfig:t,configPath:r,browserslistEnv:s})}function supportsStaticESM(e){return!!(e!=null&&e.supportsStaticESM)}function supportsDynamicImport(e){return!!(e!=null&&e.supportsDynamicImport)}function supportsExportNamespaceFrom(e){return!!(e!=null&&e.supportsExportNamespaceFrom)}function supportsTopLevelAwait(e){return!!(e!=null&&e.supportsTopLevelAwait)}var _=(0,x.declare)(((e,t)=>{e.assertVersion(7);const r=e.targets();const{bugfixes:u,configPath:f,debug:d,exclude:m,forceAllTransforms:y,ignoreBrowserslistConfig:g,include:b,loose:x,modules:v,shippedProposals:E,spec:j,targets:w,useBuiltIns:_,corejs:{version:S,proposals:k},browserslistEnv:O}=(0,l.default)(t);let I=r;if((0,s.lt)(e.version,"7.13.0")||t.targets||t.configPath||t.browserslistEnv||t.ignoreBrowserslistConfig){{var P=false;if(w!=null&&w.uglify){P=true;delete w.uglify;console.warn(`\nThe uglify target has been deprecated. Set the top level\noption \`forceAllTransforms: true\` instead.\n`)}}I=getLocalTargets(w,g,f,O)}const D=y||P?{}:I;const C=transformIncludesAndExcludes(b);const A=transformIncludesAndExcludes(m);const R=getPluginList(E,u);const N=v==="auto"&&(e.caller==null?void 0:e.caller(supportsExportNamespaceFrom))||v===false&&!(0,h.isRequired)("proposal-export-namespace-from",D,{compatData:R,includes:C.plugins,excludes:A.plugins});const M=getModulesPluginNames({modules:v,transformations:i.default,shouldTransformESM:v!=="auto"||!(e.caller!=null&&e.caller(supportsStaticESM)),shouldTransformDynamicImport:v!=="auto"||!(e.caller!=null&&e.caller(supportsDynamicImport)),shouldTransformExportNamespaceFrom:!N,shouldParseTopLevelAwait:!e.caller||e.caller(supportsTopLevelAwait)});const L=(0,h.filterItems)(R,C.plugins,A.plugins,D,M,(0,n.default)({loose:x}),c.pluginSyntaxMap);(0,o.removeUnnecessaryItems)(L,p);(0,o.removeUnsupportedItems)(L,e.version);const F=getPolyfillPlugins({useBuiltIns:_,corejs:S,polyfillTargets:I,include:C.builtIns,exclude:A.builtIns,proposals:k,shippedProposals:E,regenerator:L.has("transform-regenerator"),debug:d});const B=_!==false;const W=Array.from(L).map((e=>{if(e==="proposal-class-properties"||e==="proposal-private-methods"||e==="proposal-private-property-in-object"){return[getPlugin(e),{loose:x?"#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error":"#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"}]}return[getPlugin(e),{spec:j,loose:x,useBuiltIns:B}]})).concat(F);if(d){console.log("@babel/preset-env: `DEBUG` option");console.log("\nUsing targets:");console.log(JSON.stringify((0,h.prettifyTargets)(I),null,2));console.log(`\nUsing modules transform: ${v.toString()}`);console.log("\nUsing plugins:");L.forEach((e=>{(0,a.logPlugin)(e,I,R)}));if(!_){console.log("\nUsing polyfills: No polyfills were added, since the `useBuiltIns` option was not set.")}}return{plugins:W}}));t["default"]=_},7538:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var r={auto:"transform-modules-commonjs",amd:"transform-modules-amd",commonjs:"transform-modules-commonjs",cjs:"transform-modules-commonjs",systemjs:"transform-modules-systemjs",umd:"transform-modules-umd"};t["default"]=r},4820:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.normalizeCoreJSOption=normalizeCoreJSOption;t["default"]=normalizeOptions;t.validateUseBuiltInsOption=t.validateModulesOption=t.checkDuplicateIncludeExcludes=t.normalizePluginName=void 0;var s=r(6578);var a=r(7849);var n=r(2272);var o=r(1119);var i=r(7538);var l=r(7619);var c=r(7347);const u=["web.timers","web.immediate","web.dom.iterable"];const p=new c.OptionValidator("@babel/preset-env");const f=Object.keys(o.plugins);const d=["proposal-dynamic-import",...Object.keys(i.default).map((e=>i.default[e]))];const getValidIncludesAndExcludes=(e,t)=>new Set([...f,...e==="exclude"?d:[],...t?t==2?[...Object.keys(n),...u]:Object.keys(s):[]]);const pluginToRegExp=e=>{if(e instanceof RegExp)return e;try{return new RegExp(`^${normalizePluginName(e)}$`)}catch(e){return null}};const selectPlugins=(e,t,r)=>Array.from(getValidIncludesAndExcludes(t,r)).filter((t=>e instanceof RegExp&&e.test(t)));const flatten=e=>[].concat(...e);const expandIncludesAndExcludes=(e=[],t,r)=>{if(e.length===0)return[];const s=e.map((e=>selectPlugins(pluginToRegExp(e),t,r)));const a=e.filter(((e,t)=>s[t].length===0));p.invariant(a.length===0,`The plugins/built-ins '${a.join(", ")}' passed to the '${t}' option are not\n valid. Please check data/[plugin-features|built-in-features].js in babel-preset-env`);return flatten(s)};const normalizePluginName=e=>e.replace(/^(@babel\/|babel-)(plugin-)?/,"");t.normalizePluginName=normalizePluginName;const checkDuplicateIncludeExcludes=(e=[],t=[])=>{const r=e.filter((e=>t.indexOf(e)>=0));p.invariant(r.length===0,`The plugins/built-ins '${r.join(", ")}' were found in both the "include" and\n "exclude" options.`)};t.checkDuplicateIncludeExcludes=checkDuplicateIncludeExcludes;const normalizeTargets=e=>{if(typeof e==="string"||Array.isArray(e)){return{browsers:e}}return Object.assign({},e)};const validateModulesOption=(e=l.ModulesOption.auto)=>{p.invariant(l.ModulesOption[e.toString()]||e===l.ModulesOption.false,`The 'modules' option must be one of \n`+` - 'false' to indicate no module processing\n`+` - a specific module type: 'commonjs', 'amd', 'umd', 'systemjs'`+` - 'auto' (default) which will automatically select 'false' if the current\n`+` process is known to support ES module syntax, or "commonjs" otherwise\n`);return e};t.validateModulesOption=validateModulesOption;const validateUseBuiltInsOption=(e=false)=>{p.invariant(l.UseBuiltInsOption[e.toString()]||e===l.UseBuiltInsOption.false,`The 'useBuiltIns' option must be either\n 'false' (default) to indicate no polyfill,\n '"entry"' to indicate replacing the entry polyfill, or\n '"usage"' to import only used polyfills per file`);return e};t.validateUseBuiltInsOption=validateUseBuiltInsOption;function normalizeCoreJSOption(e,t){let r=false;let s;if(t&&e===undefined){s=2;console.warn("\nWARNING (@babel/preset-env): We noticed you're using the `useBuiltIns` option without declaring a "+"core-js version. Currently, we assume version 2.x when no version "+"is passed. Since this default version will likely change in future "+"versions of Babel, we recommend explicitly setting the core-js version "+"you are using via the `corejs` option.\n"+"\nYou should also be sure that the version you pass to the `corejs` "+"option matches the version specified in your `package.json`'s "+"`dependencies` section. If it doesn't, you need to run one of the "+"following commands:\n\n"+" npm install --save core-js@2 npm install --save core-js@3\n"+" yarn add core-js@2 yarn add core-js@3\n\n"+"More info about useBuiltIns: https://babeljs.io/docs/en/babel-preset-env#usebuiltins\n"+"More info about core-js: https://babeljs.io/docs/en/babel-preset-env#corejs")}else if(typeof e==="object"&&e!==null){s=e.version;r=Boolean(e.proposals)}else{s=e}const n=s?(0,a.coerce)(String(s)):false;if(!t&&n){console.warn("\nWARNING (@babel/preset-env): The `corejs` option only has an effect when the `useBuiltIns` option is not `false`\n")}if(t&&(!n||n.major<2||n.major>3)){throw new RangeError("Invalid Option: The version passed to `corejs` is invalid. Currently, "+"only core-js@2 and core-js@3 are supported.")}return{version:n,proposals:r}}function normalizeOptions(e){p.validateTopLevelOptions(e,l.TopLevelOptions);const t=validateUseBuiltInsOption(e.useBuiltIns);const r=normalizeCoreJSOption(e.corejs,t);const s=expandIncludesAndExcludes(e.include,l.TopLevelOptions.include,!!r.version&&r.version.major);const a=expandIncludesAndExcludes(e.exclude,l.TopLevelOptions.exclude,!!r.version&&r.version.major);checkDuplicateIncludeExcludes(s,a);return{bugfixes:p.validateBooleanOption(l.TopLevelOptions.bugfixes,e.bugfixes,false),configPath:p.validateStringOption(l.TopLevelOptions.configPath,e.configPath,process.cwd()),corejs:r,debug:p.validateBooleanOption(l.TopLevelOptions.debug,e.debug,false),include:s,exclude:a,forceAllTransforms:p.validateBooleanOption(l.TopLevelOptions.forceAllTransforms,e.forceAllTransforms,false),ignoreBrowserslistConfig:p.validateBooleanOption(l.TopLevelOptions.ignoreBrowserslistConfig,e.ignoreBrowserslistConfig,false),loose:p.validateBooleanOption(l.TopLevelOptions.loose,e.loose),modules:validateModulesOption(e.modules),shippedProposals:p.validateBooleanOption(l.TopLevelOptions.shippedProposals,e.shippedProposals,false),spec:p.validateBooleanOption(l.TopLevelOptions.spec,e.spec,false),targets:normalizeTargets(e.targets),useBuiltIns:t,browserslistEnv:p.validateStringOption(l.TopLevelOptions.browserslistEnv,e.browserslistEnv)}}},7619:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.UseBuiltInsOption=t.ModulesOption=t.TopLevelOptions=void 0;const r={bugfixes:"bugfixes",configPath:"configPath",corejs:"corejs",debug:"debug",exclude:"exclude",forceAllTransforms:"forceAllTransforms",ignoreBrowserslistConfig:"ignoreBrowserslistConfig",include:"include",loose:"loose",modules:"modules",shippedProposals:"shippedProposals",spec:"spec",targets:"targets",useBuiltIns:"useBuiltIns",browserslistEnv:"browserslistEnv"};t.TopLevelOptions=r;const s={false:false,auto:"auto",amd:"amd",commonjs:"commonjs",cjs:"cjs",systemjs:"systemjs",umd:"umd"};t.ModulesOption=s;const a={false:false,entry:"entry",usage:"usage"};t.UseBuiltInsOption=a},1119:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.pluginsBugfixes=t.plugins=void 0;var s=r(5884);var a=r(3574);var n=r(9199);const o={};t.plugins=o;const i={};t.pluginsBugfixes=i;for(const e of Object.keys(s)){if(Object.hasOwnProperty.call(n.default,e)){o[e]=s[e]}}for(const e of Object.keys(a)){if(Object.hasOwnProperty.call(n.default,e)){i[e]=a[e]}}o["proposal-class-properties"]=o["proposal-private-methods"]},3867:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(3931);var a=r(8622);const n=`\n \`@babel/polyfill\` is deprecated. Please, use required parts of \`core-js\`\n and \`regenerator-runtime/runtime\` separately`;const o=`\n When setting \`useBuiltIns: 'usage'\`, polyfills are automatically imported when needed.\n Please remove the direct import of \`SPECIFIER\` or use \`useBuiltIns: 'entry'\` instead.`;function _default({template:e},{regenerator:t,deprecated:r,usage:a}){return{name:"preset-env/replace-babel-polyfill",visitor:{ImportDeclaration(i){const l=(0,s.getImportSource)(i);if(a&&(0,s.isPolyfillSource)(l)){console.warn(o.replace("SPECIFIER",l));if(!r)i.remove()}else if(l==="@babel/polyfill"){if(r){console.warn(n)}else if(t){i.replaceWithMultiple(e.ast` import "core-js"; import "regenerator-runtime/runtime.js"; `)}else{i.replaceWith(e.ast` @@ -528,6 +453,6 @@ require("regenerator-runtime/runtime.js"); `)}else{i.replaceWith(e.ast` require("core-js"); - `)}}}))}}}}},8170:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(3931);function isRegeneratorSource(e){return e==="regenerator-runtime/runtime"||e==="regenerator-runtime/runtime.js"}function _default(){const e={ImportDeclaration(e){if(isRegeneratorSource((0,s.getImportSource)(e))){this.regeneratorImportExcluded=true;e.remove()}},Program(e){e.get("body").forEach((e=>{if(isRegeneratorSource((0,s.getRequireSource)(e))){this.regeneratorImportExcluded=true;e.remove()}}))}};return{name:"preset-env/remove-regenerator",visitor:e,pre(){this.regeneratorImportExcluded=false},post(){if(this.opts.debug&&this.regeneratorImportExcluded){let e=this.file.opts.filename;if(process.env.BABEL_ENV==="test"){e=e.replace(/\\/g,"/")}console.log(`\n[${e}] Based on your targets, regenerator-runtime import excluded.`)}}}}},3931:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getImportSource=getImportSource;t.getRequireSource=getRequireSource;t.isPolyfillSource=isPolyfillSource;var s=r(8622);function getImportSource({node:e}){if(e.specifiers.length===0)return e.source.value}function getRequireSource({node:e}){if(!s.isExpressionStatement(e))return;const{expression:t}=e;if(s.isCallExpression(t)&&s.isIdentifier(t.callee)&&t.callee.name==="require"&&t.arguments.length===1&&s.isStringLiteral(t.arguments[0])){return t.arguments[0].value}}function isPolyfillSource(e){return e==="@babel/polyfill"||e==="core-js"}},1068:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(558);var a=r(4350);var n=r(7347);function _interopDefaultLegacy(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var o=_interopDefaultLegacy(a);const i=new n.OptionValidator("@babel/preset-typescript");function normalizeOptions(e={}){let{allowNamespaces:t=true,jsxPragma:r,onlyRemoveTypeImports:s}=e;const a={allExtensions:"allExtensions",allowNamespaces:"allowNamespaces",isTSX:"isTSX",jsxPragma:"jsxPragma",jsxPragmaFrag:"jsxPragmaFrag",onlyRemoveTypeImports:"onlyRemoveTypeImports",optimizeConstEnums:"optimizeConstEnums"};const n=i.validateStringOption(a.jsxPragmaFrag,e.jsxPragmaFrag,"React.Fragment");const o=i.validateBooleanOption(a.allExtensions,e.allExtensions,false);const l=i.validateBooleanOption(a.isTSX,e.isTSX,false);if(l){i.invariant(o,"isTSX:true requires allExtensions:true")}const c=i.validateBooleanOption(a.optimizeConstEnums,e.optimizeConstEnums,false);return{allExtensions:o,allowNamespaces:t,isTSX:l,jsxPragma:r,jsxPragmaFrag:n,onlyRemoveTypeImports:s,optimizeConstEnums:c}}var l=s.declare(((e,t)=>{e.assertVersion(7);const{allExtensions:r,allowNamespaces:s,isTSX:a,jsxPragma:n,jsxPragmaFrag:i,onlyRemoveTypeImports:l,optimizeConstEnums:c}=normalizeOptions(t);const pluginOptions=e=>({allowDeclareFields:t.allowDeclareFields,allowNamespaces:s,isTSX:e,jsxPragma:n,jsxPragmaFrag:i,onlyRemoveTypeImports:l,optimizeConstEnums:c});return{overrides:r?[{plugins:[[o["default"],pluginOptions(a)]]}]:[{test:/\.ts$/,plugins:[[o["default"],pluginOptions(false)]]},{test:/\.tsx$/,plugins:[[o["default"],pluginOptions(true)]]}]}}));t["default"]=l},372:(e,t)=>{"use strict";t.__esModule=true;t["default"]=_default;function _extends(){_extends=Object.assign||function(e){for(var t=1;te!=="node"));return _extends({},a,t==="usage-pure"?s:null,o||i?r:null)}},2816:(e,t,r)=>{"use strict";t.__esModule=true;t.StaticProperties=t.InstanceProperties=t.BuiltIns=t.CommonIterators=void 0;var s=_interopRequireDefault(r(1268));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const define=(e,t,r=[],s)=>({name:e,pure:t,global:r,meta:s});const pureAndGlobal=(e,t,r=null)=>define(t[0],e,t,{minRuntimeVersion:r});const globalOnly=e=>define(e[0],null,e);const pureOnly=(e,t)=>define(t,e,[]);const a=["es6.object.to-string","es6.array.iterator","web.dom.iterable"];const n=["es6.string.iterator",...a];t.CommonIterators=n;const o=["es6.object.to-string","es6.promise"];const i={DataView:globalOnly(["es6.typed.data-view"]),Float32Array:globalOnly(["es6.typed.float32-array"]),Float64Array:globalOnly(["es6.typed.float64-array"]),Int8Array:globalOnly(["es6.typed.int8-array"]),Int16Array:globalOnly(["es6.typed.int16-array"]),Int32Array:globalOnly(["es6.typed.int32-array"]),Map:pureAndGlobal("map",["es6.map",...n]),Number:globalOnly(["es6.number.constructor"]),Promise:pureAndGlobal("promise",o),RegExp:globalOnly(["es6.regexp.constructor"]),Set:pureAndGlobal("set",["es6.set",...n]),Symbol:pureAndGlobal("symbol",["es6.symbol"]),Uint8Array:globalOnly(["es6.typed.uint8-array"]),Uint8ClampedArray:globalOnly(["es6.typed.uint8-clamped-array"]),Uint16Array:globalOnly(["es6.typed.uint16-array"]),Uint32Array:globalOnly(["es6.typed.uint32-array"]),WeakMap:pureAndGlobal("weak-map",["es6.weak-map",...n]),WeakSet:pureAndGlobal("weak-set",["es6.weak-set",...n]),setImmediate:pureOnly("set-immediate","web.immediate"),clearImmediate:pureOnly("clear-immediate","web.immediate"),parseFloat:pureOnly("parse-float","es6.parse-float"),parseInt:pureOnly("parse-int","es6.parse-int")};t.BuiltIns=i;const l={__defineGetter__:globalOnly(["es7.object.define-getter"]),__defineSetter__:globalOnly(["es7.object.define-setter"]),__lookupGetter__:globalOnly(["es7.object.lookup-getter"]),__lookupSetter__:globalOnly(["es7.object.lookup-setter"]),anchor:globalOnly(["es6.string.anchor"]),big:globalOnly(["es6.string.big"]),bind:globalOnly(["es6.function.bind"]),blink:globalOnly(["es6.string.blink"]),bold:globalOnly(["es6.string.bold"]),codePointAt:globalOnly(["es6.string.code-point-at"]),copyWithin:globalOnly(["es6.array.copy-within"]),endsWith:globalOnly(["es6.string.ends-with"]),entries:globalOnly(a),every:globalOnly(["es6.array.every"]),fill:globalOnly(["es6.array.fill"]),filter:globalOnly(["es6.array.filter"]),finally:globalOnly(["es7.promise.finally",...o]),find:globalOnly(["es6.array.find"]),findIndex:globalOnly(["es6.array.find-index"]),fixed:globalOnly(["es6.string.fixed"]),flags:globalOnly(["es6.regexp.flags"]),flatMap:globalOnly(["es7.array.flat-map"]),fontcolor:globalOnly(["es6.string.fontcolor"]),fontsize:globalOnly(["es6.string.fontsize"]),forEach:globalOnly(["es6.array.for-each"]),includes:globalOnly(["es6.string.includes","es7.array.includes"]),indexOf:globalOnly(["es6.array.index-of"]),italics:globalOnly(["es6.string.italics"]),keys:globalOnly(a),lastIndexOf:globalOnly(["es6.array.last-index-of"]),link:globalOnly(["es6.string.link"]),map:globalOnly(["es6.array.map"]),match:globalOnly(["es6.regexp.match"]),name:globalOnly(["es6.function.name"]),padStart:globalOnly(["es7.string.pad-start"]),padEnd:globalOnly(["es7.string.pad-end"]),reduce:globalOnly(["es6.array.reduce"]),reduceRight:globalOnly(["es6.array.reduce-right"]),repeat:globalOnly(["es6.string.repeat"]),replace:globalOnly(["es6.regexp.replace"]),search:globalOnly(["es6.regexp.search"]),small:globalOnly(["es6.string.small"]),some:globalOnly(["es6.array.some"]),sort:globalOnly(["es6.array.sort"]),split:globalOnly(["es6.regexp.split"]),startsWith:globalOnly(["es6.string.starts-with"]),strike:globalOnly(["es6.string.strike"]),sub:globalOnly(["es6.string.sub"]),sup:globalOnly(["es6.string.sup"]),toISOString:globalOnly(["es6.date.to-iso-string"]),toJSON:globalOnly(["es6.date.to-json"]),toString:globalOnly(["es6.object.to-string","es6.date.to-string","es6.regexp.to-string"]),trim:globalOnly(["es6.string.trim"]),trimEnd:globalOnly(["es7.string.trim-right"]),trimLeft:globalOnly(["es7.string.trim-left"]),trimRight:globalOnly(["es7.string.trim-right"]),trimStart:globalOnly(["es7.string.trim-left"]),values:globalOnly(a)};t.InstanceProperties=l;if("es6.array.slice"in s.default){l.slice=globalOnly(["es6.array.slice"])}const c={Array:{from:pureAndGlobal("array/from",["es6.symbol","es6.array.from",...n]),isArray:pureAndGlobal("array/is-array",["es6.array.is-array"]),of:pureAndGlobal("array/of",["es6.array.of"])},Date:{now:pureAndGlobal("date/now",["es6.date.now"])},JSON:{stringify:pureOnly("json/stringify","es6.symbol")},Math:{acosh:pureAndGlobal("math/acosh",["es6.math.acosh"],"7.0.1"),asinh:pureAndGlobal("math/asinh",["es6.math.asinh"],"7.0.1"),atanh:pureAndGlobal("math/atanh",["es6.math.atanh"],"7.0.1"),cbrt:pureAndGlobal("math/cbrt",["es6.math.cbrt"],"7.0.1"),clz32:pureAndGlobal("math/clz32",["es6.math.clz32"],"7.0.1"),cosh:pureAndGlobal("math/cosh",["es6.math.cosh"],"7.0.1"),expm1:pureAndGlobal("math/expm1",["es6.math.expm1"],"7.0.1"),fround:pureAndGlobal("math/fround",["es6.math.fround"],"7.0.1"),hypot:pureAndGlobal("math/hypot",["es6.math.hypot"],"7.0.1"),imul:pureAndGlobal("math/imul",["es6.math.imul"],"7.0.1"),log1p:pureAndGlobal("math/log1p",["es6.math.log1p"],"7.0.1"),log10:pureAndGlobal("math/log10",["es6.math.log10"],"7.0.1"),log2:pureAndGlobal("math/log2",["es6.math.log2"],"7.0.1"),sign:pureAndGlobal("math/sign",["es6.math.sign"],"7.0.1"),sinh:pureAndGlobal("math/sinh",["es6.math.sinh"],"7.0.1"),tanh:pureAndGlobal("math/tanh",["es6.math.tanh"],"7.0.1"),trunc:pureAndGlobal("math/trunc",["es6.math.trunc"],"7.0.1")},Number:{EPSILON:pureAndGlobal("number/epsilon",["es6.number.epsilon"]),MIN_SAFE_INTEGER:pureAndGlobal("number/min-safe-integer",["es6.number.min-safe-integer"]),MAX_SAFE_INTEGER:pureAndGlobal("number/max-safe-integer",["es6.number.max-safe-integer"]),isFinite:pureAndGlobal("number/is-finite",["es6.number.is-finite"]),isInteger:pureAndGlobal("number/is-integer",["es6.number.is-integer"]),isSafeInteger:pureAndGlobal("number/is-safe-integer",["es6.number.is-safe-integer"]),isNaN:pureAndGlobal("number/is-nan",["es6.number.is-nan"]),parseFloat:pureAndGlobal("number/parse-float",["es6.number.parse-float"]),parseInt:pureAndGlobal("number/parse-int",["es6.number.parse-int"])},Object:{assign:pureAndGlobal("object/assign",["es6.object.assign"]),create:pureAndGlobal("object/create",["es6.object.create"]),defineProperties:pureAndGlobal("object/define-properties",["es6.object.define-properties"]),defineProperty:pureAndGlobal("object/define-property",["es6.object.define-property"]),entries:pureAndGlobal("object/entries",["es7.object.entries"]),freeze:pureAndGlobal("object/freeze",["es6.object.freeze"]),getOwnPropertyDescriptor:pureAndGlobal("object/get-own-property-descriptor",["es6.object.get-own-property-descriptor"]),getOwnPropertyDescriptors:pureAndGlobal("object/get-own-property-descriptors",["es7.object.get-own-property-descriptors"]),getOwnPropertyNames:pureAndGlobal("object/get-own-property-names",["es6.object.get-own-property-names"]),getOwnPropertySymbols:pureAndGlobal("object/get-own-property-symbols",["es6.symbol"]),getPrototypeOf:pureAndGlobal("object/get-prototype-of",["es6.object.get-prototype-of"]),is:pureAndGlobal("object/is",["es6.object.is"]),isExtensible:pureAndGlobal("object/is-extensible",["es6.object.is-extensible"]),isFrozen:pureAndGlobal("object/is-frozen",["es6.object.is-frozen"]),isSealed:pureAndGlobal("object/is-sealed",["es6.object.is-sealed"]),keys:pureAndGlobal("object/keys",["es6.object.keys"]),preventExtensions:pureAndGlobal("object/prevent-extensions",["es6.object.prevent-extensions"]),seal:pureAndGlobal("object/seal",["es6.object.seal"]),setPrototypeOf:pureAndGlobal("object/set-prototype-of",["es6.object.set-prototype-of"]),values:pureAndGlobal("object/values",["es7.object.values"])},Promise:{all:globalOnly(n),race:globalOnly(n)},Reflect:{apply:pureAndGlobal("reflect/apply",["es6.reflect.apply"]),construct:pureAndGlobal("reflect/construct",["es6.reflect.construct"]),defineProperty:pureAndGlobal("reflect/define-property",["es6.reflect.define-property"]),deleteProperty:pureAndGlobal("reflect/delete-property",["es6.reflect.delete-property"]),get:pureAndGlobal("reflect/get",["es6.reflect.get"]),getOwnPropertyDescriptor:pureAndGlobal("reflect/get-own-property-descriptor",["es6.reflect.get-own-property-descriptor"]),getPrototypeOf:pureAndGlobal("reflect/get-prototype-of",["es6.reflect.get-prototype-of"]),has:pureAndGlobal("reflect/has",["es6.reflect.has"]),isExtensible:pureAndGlobal("reflect/is-extensible",["es6.reflect.is-extensible"]),ownKeys:pureAndGlobal("reflect/own-keys",["es6.reflect.own-keys"]),preventExtensions:pureAndGlobal("reflect/prevent-extensions",["es6.reflect.prevent-extensions"]),set:pureAndGlobal("reflect/set",["es6.reflect.set"]),setPrototypeOf:pureAndGlobal("reflect/set-prototype-of",["es6.reflect.set-prototype-of"])},String:{at:pureOnly("string/at","es7.string.at"),fromCodePoint:pureAndGlobal("string/from-code-point",["es6.string.from-code-point"]),raw:pureAndGlobal("string/raw",["es6.string.raw"])},Symbol:{asyncIterator:globalOnly(["es6.symbol","es7.symbol.async-iterator"]),for:pureOnly("symbol/for","es6.symbol"),hasInstance:pureOnly("symbol/has-instance","es6.symbol"),isConcatSpreadable:pureOnly("symbol/is-concat-spreadable","es6.symbol"),iterator:define("es6.symbol","symbol/iterator",n),keyFor:pureOnly("symbol/key-for","es6.symbol"),match:pureAndGlobal("symbol/match",["es6.regexp.match"]),replace:pureOnly("symbol/replace","es6.symbol"),search:pureOnly("symbol/search","es6.symbol"),species:pureOnly("symbol/species","es6.symbol"),split:pureOnly("symbol/split","es6.symbol"),toPrimitive:pureOnly("symbol/to-primitive","es6.symbol"),toStringTag:pureOnly("symbol/to-string-tag","es6.symbol"),unscopables:pureOnly("symbol/unscopables","es6.symbol")}};t.StaticProperties=c},400:(e,t,r)=>{"use strict";t.__esModule=true;t.hasMinVersion=hasMinVersion;var s=_interopRequireDefault(r(7849));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function hasMinVersion(e,t){if(!t||!e)return true;if(s.default.valid(t))t=`^${t}`;return!s.default.intersects(`<${e}`,t)&&!s.default.intersects(`>=8.0.0`,t)}},9897:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireDefault(r(1268));var a=r(2816);var n=_interopRequireDefault(r(372));var o=r(400);var i=_interopRequireDefault(r(6389));var l=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const{types:c}=l.default||l;const u="#__secret_key__@babel/preset-env__compatibility";const p="#__secret_key__@babel/runtime__compatibility";const d=Function.call.bind(Object.hasOwnProperty);var f=(0,i.default)((function(e,{[u]:{entryInjectRegenerator:t}={},[p]:{useBabelRuntime:r,runtimeVersion:i,ext:l=".js"}={}}){const f=e.createMetaResolver({global:a.BuiltIns,static:a.StaticProperties,instance:a.InstanceProperties});const{debug:m,shouldInjectPolyfill:y,method:g}=e;const h=(0,n.default)(e.targets,g,s.default);const b=r?`${r}/core-js`:g==="usage-pure"?"core-js/library/fn":"core-js/modules";function inject(e,t){if(typeof e==="string"){if(d(h,e)&&y(e)){m(e);t.injectGlobalImport(`${b}/${e}.js`)}return}e.forEach((e=>inject(e,t)))}function maybeInjectPure(e,t,r){const{pure:s,meta:a,name:n}=e;if(!s||!y(n))return;if(i&&a&&a.minRuntimeVersion&&!(0,o.hasMinVersion)(a&&a.minRuntimeVersion,i)){return}return r.injectDefaultImport(`${b}/${s}${l}`,t)}return{name:"corejs2",polyfills:h,entryGlobal(e,r,s){if(e.kind==="import"&&e.source==="core-js"){m(null);inject(Object.keys(h),r);if(t){r.injectGlobalImport("regenerator-runtime/runtime.js")}s.remove()}},usageGlobal(e,t){const r=f(e);if(!r)return;let s=r.desc.global;if(r.kind!=="global"&&e.object&&e.placement==="prototype"){const t=e.object.toLowerCase();s=s.filter((e=>e.includes(t)))}inject(s,t)},usagePure(e,t,r){if(e.kind==="in"){if(e.key==="Symbol.iterator"){r.replaceWith(c.callExpression(t.injectDefaultImport(`${b}/is-iterable${l}`,"isIterable"),[r.node.right]))}return}if(r.parentPath.isUnaryExpression({operator:"delete"}))return;if(e.kind==="property"){if(!r.isMemberExpression())return;if(!r.isReferenced())return;if(e.key==="Symbol.iterator"&&y("es6.symbol")&&r.parentPath.isCallExpression({callee:r.node})&&r.parent.arguments.length===0){r.parentPath.replaceWith(c.callExpression(t.injectDefaultImport(`${b}/get-iterator${l}`,"getIterator"),[r.node.object]));r.skip();return}}const s=f(e);if(!s)return;const a=maybeInjectPure(s.desc,s.name,t);if(a)r.replaceWith(a)},visitor:g==="usage-global"&&{YieldExpression(t){if(t.node.delegate){inject("web.dom.iterable",e.getUtils(t))}},"ForOfStatement|ArrayPattern"(t){a.CommonIterators.forEach((r=>inject(r,e.getUtils(t))))}}}}));t["default"]=f},1268:(e,t,r)=>{e.exports=r(516)},9270:(e,t,r)=>{e.exports=r(5246)},559:(e,t,r)=>{e.exports=r(4812)},4245:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getInclusionReasons=getInclusionReasons;var s=r(7849);var a=r(834);var n=r(4208);function getInclusionReasons(e,t,r){const o=r[e]||{};return Object.keys(t).reduce(((e,r)=>{const i=(0,n.getLowestImplementedVersion)(o,r);const l=t[r];if(!i){e[r]=(0,a.prettifyVersion)(l)}else{const t=(0,n.isUnreleasedVersion)(i,r);const o=(0,n.isUnreleasedVersion)(l,r);if(!o&&(t||s.lt(l.toString(),(0,n.semverify)(i)))){e[r]=(0,a.prettifyVersion)(l)}}return e}),{})}},425:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.targetsSupported=targetsSupported;t.isRequired=isRequired;t["default"]=filterItems;var s=r(7849);var a=r(559);var n=r(4208);function targetsSupported(e,t){const r=Object.keys(e);if(r.length===0){return false}const a=r.filter((r=>{const a=(0,n.getLowestImplementedVersion)(t,r);if(!a){return true}const o=e[r];if((0,n.isUnreleasedVersion)(o,r)){return false}if((0,n.isUnreleasedVersion)(a,r)){return true}if(!s.valid(o.toString())){throw new Error(`Invalid version passed for target "${r}": "${o}". `+"Versions must be in semver format (major.minor.patch)")}return s.gt((0,n.semverify)(a),o.toString())}));return a.length===0}function isRequired(e,t,{compatData:r=a,includes:s,excludes:n}={}){if(n!=null&&n.has(e))return false;if(s!=null&&s.has(e))return true;return!targetsSupported(t,r[e])}function filterItems(e,t,r,s,a,n,o){const i=new Set;const l={compatData:e,includes:t,excludes:r};for(const t in e){if(isRequired(t,s,l)){i.add(t)}else if(o){const e=o.get(t);if(e){i.add(e)}}}if(a){a.forEach((e=>!r.has(e)&&i.add(e)))}if(n){n.forEach((e=>!t.has(e)&&i.delete(e)))}return i}},8097:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isBrowsersQueryValid=isBrowsersQueryValid;t["default"]=getTargets;Object.defineProperty(t,"unreleasedLabels",{enumerable:true,get:function(){return i.unreleasedLabels}});Object.defineProperty(t,"TargetNames",{enumerable:true,get:function(){return l.TargetNames}});Object.defineProperty(t,"prettifyTargets",{enumerable:true,get:function(){return c.prettifyTargets}});Object.defineProperty(t,"getInclusionReasons",{enumerable:true,get:function(){return u.getInclusionReasons}});Object.defineProperty(t,"filterItems",{enumerable:true,get:function(){return p.default}});Object.defineProperty(t,"isRequired",{enumerable:true,get:function(){return p.isRequired}});var s=r(4907);var a=r(7347);var n=r(9270);var o=r(4208);var i=r(6124);var l=r(7891);var c=r(834);var u=r(4245);var p=r(425);const d=n["es6.module"];const f=new a.OptionValidator("@babel/helper-compilation-targets");function validateTargetNames(e){const t=Object.keys(l.TargetNames);for(const r of Object.keys(e)){if(!(r in l.TargetNames)){throw new Error(f.formatMessage(`'${r}' is not a valid target\n- Did you mean '${(0,a.findSuggestion)(r,t)}'?`))}}return e}function isBrowsersQueryValid(e){return typeof e==="string"||Array.isArray(e)&&e.every((e=>typeof e==="string"))}function validateBrowsers(e){f.invariant(e===undefined||isBrowsersQueryValid(e),`'${String(e)}' is not a valid browserslist query`);return e}function getLowestVersions(e){return e.reduce(((e,t)=>{const[r,s]=t.split(" ");const a=i.browserNameMap[r];if(!a){return e}try{const t=s.split("-")[0].toLowerCase();const n=(0,o.isUnreleasedVersion)(t,r);if(!e[a]){e[a]=n?t:(0,o.semverify)(t);return e}const i=e[a];const l=(0,o.isUnreleasedVersion)(i,r);if(l&&n){e[a]=(0,o.getLowestUnreleased)(i,t,r)}else if(l){e[a]=(0,o.semverify)(t)}else if(!l&&!n){const r=(0,o.semverify)(t);e[a]=(0,o.semverMin)(i,r)}}catch(e){}return e}),{})}function outputDecimalWarning(e){if(!e.length){return}console.warn("Warning, the following targets are using a decimal version:\n");e.forEach((({target:e,value:t})=>console.warn(` ${e}: ${t}`)));console.warn(`\nWe recommend using a string for minor/patch versions to avoid numbers like 6.10\ngetting parsed as 6.1, which can lead to unexpected behavior.\n`)}function semverifyTarget(e,t){try{return(0,o.semverify)(t)}catch(r){throw new Error(f.formatMessage(`'${t}' is not a valid value for 'targets.${e}'.`))}}const m={__default(e,t){const r=(0,o.isUnreleasedVersion)(t,e)?t.toLowerCase():semverifyTarget(e,t);return[e,r]},node(e,t){const r=t===true||t==="current"?process.versions.node:semverifyTarget(e,t);return[e,r]}};function generateTargets(e){const t=Object.assign({},e);delete t.esmodules;delete t.browsers;return t}function resolveTargets(e){const t=s(e,{mobileToDesktop:true});return getLowestVersions(t)}function getTargets(e={},t={}){var r;let{browsers:a,esmodules:n}=e;const{configPath:i="."}=t;validateBrowsers(a);const l=generateTargets(e);let c=validateTargetNames(l);const u=!!a;const p=u||Object.keys(c).length>0;const f=!t.ignoreBrowserslistConfig&&!p;if(!a&&f){a=s.loadConfig({config:t.configFile,path:i,env:t.browserslistEnv});if(a==null){{a=[]}}}if(n&&(n!=="intersect"||!((r=a)!=null&&r.length))){a=Object.keys(d).map((e=>`${e} >= ${d[e]}`)).join(", ");n=false}if(a){const e=resolveTargets(a);if(n==="intersect"){for(const t of Object.keys(e)){const r=e[t];if(d[t]){e[t]=(0,o.getHighestUnreleased)(r,(0,o.semverify)(d[t]),t)}else{delete e[t]}}}c=Object.assign(e,c)}const y={};const g=[];for(const e of Object.keys(c).sort()){var h;const t=c[e];if(typeof t==="number"&&t%1!==0){g.push({target:e,value:t})}const r=(h=m[e])!=null?h:m.__default;const[s,a]=r(e,t);if(a){y[s]=a}}outputDecimalWarning(g);return y}},7891:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.TargetNames=void 0;const r={node:"node",chrome:"chrome",opera:"opera",edge:"edge",firefox:"firefox",safari:"safari",ie:"ie",ios:"ios",android:"android",electron:"electron",samsung:"samsung"};t.TargetNames=r},834:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.prettifyVersion=prettifyVersion;t.prettifyTargets=prettifyTargets;var s=r(7849);var a=r(6124);function prettifyVersion(e){if(typeof e!=="string"){return e}const t=[s.major(e)];const r=s.minor(e);const a=s.patch(e);if(r||a){t.push(r)}if(a){t.push(a)}return t.join(".")}function prettifyTargets(e){return Object.keys(e).reduce(((t,r)=>{let s=e[r];const n=a.unreleasedLabels[r];if(typeof s==="string"&&n!==s){s=prettifyVersion(s)}t[r]=s;return t}),{})}},6124:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.browserNameMap=t.unreleasedLabels=void 0;const r={safari:"tp"};t.unreleasedLabels=r;const s={and_chr:"chrome",and_ff:"firefox",android:"android",chrome:"chrome",edge:"edge",firefox:"firefox",ie:"ie",ie_mob:"ie",ios_saf:"ios",node:"node",op_mob:"opera",opera:"opera",safari:"safari",samsung:"samsung"};t.browserNameMap=s},4208:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.semverMin=semverMin;t.semverify=semverify;t.isUnreleasedVersion=isUnreleasedVersion;t.getLowestUnreleased=getLowestUnreleased;t.getHighestUnreleased=getHighestUnreleased;t.getLowestImplementedVersion=getLowestImplementedVersion;var s=r(7849);var a=r(7347);var n=r(6124);const o=/^(\d+|\d+.\d+)$/;const i=new a.OptionValidator("@babel/helper-compilation-targets");function semverMin(e,t){return e&&s.lt(e,t)?e:t}function semverify(e){if(typeof e==="string"&&s.valid(e)){return e}i.invariant(typeof e==="number"||typeof e==="string"&&o.test(e),`'${e}' is not a valid version`);const t=e.toString().split(".");while(t.length<3){t.push("0")}return t.join(".")}function isUnreleasedVersion(e,t){const r=n.unreleasedLabels[t];return!!r&&r===e.toString().toLowerCase()}function getLowestUnreleased(e,t,r){const s=n.unreleasedLabels[r];const a=[e,t].some((e=>e===s));if(a){return e===a?t:e||t}return semverMin(e,t)}function getHighestUnreleased(e,t,r){return getLowestUnreleased(e,t,r)===e?t:e}function getLowestImplementedVersion(e,t){const r=e[t];if(!r&&t==="android"){return e.chrome}return r}},3318:(e,t,r)=>{"use strict";t.__esModule=true;t.stringifyTargetsMultiline=stringifyTargetsMultiline;t.stringifyTargets=stringifyTargets;t.presetEnvSilentDebugHeader=void 0;var s=r(8097);const a="#__secret_key__@babel/preset-env__don't_log_debug_header_and_resolved_targets";t.presetEnvSilentDebugHeader=a;function stringifyTargetsMultiline(e){return JSON.stringify((0,s.prettifyTargets)(e),null,2)}function stringifyTargets(e){return JSON.stringify(e).replace(/,/g,", ").replace(/^\{"/,'{ "').replace(/"\}$/,'" }')}},2551:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:a}=s.default||s;class ImportsCache{constructor(e){this._imports=new WeakMap;this._anonymousImports=new WeakMap;this._lastImports=new WeakMap;this._resolver=e}storeAnonymous(e,t,r){const s=this._normalizeKey(e,t);const n=this._ensure(this._anonymousImports,e,Set);if(n.has(s))return;const o=r(e.node.sourceType==="script",a.stringLiteral(this._resolver(t)));n.add(s);this._injectImport(e,o)}storeNamed(e,t,r,s){const n=this._normalizeKey(e,t,r);const o=this._ensure(this._imports,e,Map);if(!o.has(n)){const{node:i,name:l}=s(e.node.sourceType==="script",a.stringLiteral(this._resolver(t)),a.identifier(r));o.set(n,l);this._injectImport(e,i)}return a.identifier(o.get(n))}_injectImport(e,t){let r=this._lastImports.get(e);if(r&&r.node&&r.parent===e.node&&r.container===e.node.body){r=r.insertAfter(t)}else{r=e.unshiftContainer("body",t)}r=r[r.length-1];this._lastImports.set(e,r)}_ensure(e,t,r){let s=e.get(t);if(!s){s=new r;e.set(t,s)}return s}_normalizeKey(e,t,r=""){const{sourceType:s}=e.node;return`${r&&s}::${t}::${r}`}}t["default"]=ImportsCache},6389:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=definePolyfillProvider;var s=r(558);var a=_interopRequireWildcard(r(8097));var n=r(3508);var o=_interopRequireDefault(r(2551));var i=r(3318);var l=r(8083);var c=_interopRequireWildcard(r(7107));var u=_interopRequireWildcard(r(3229));var p=_interopRequireDefault(r(4219));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var r={};var s=Object.keys(e);var a,n;for(n=0;n=0)continue;r[a]=e[a]}return r}const d=a.default.default||a.default;function resolveOptions(e,t){const{method:r,targets:s,ignoreBrowserslistConfig:a,configPath:n,debug:o,shouldInjectPolyfill:i,absoluteImports:l}=e,c=_objectWithoutPropertiesLoose(e,["method","targets","ignoreBrowserslistConfig","configPath","debug","shouldInjectPolyfill","absoluteImports"]);let u;if(r==="usage-global")u="usageGlobal";else if(r==="entry-global")u="entryGlobal";else if(r==="usage-pure")u="usagePure";else if(typeof r!=="string"){throw new Error(".method must be a string")}else{throw new Error(`.method must be one of "entry-global", "usage-global"`+` or "usage-pure" (received ${JSON.stringify(r)})`)}if(typeof i==="function"){if(e.include||e.exclude){throw new Error(`.include and .exclude are not supported when using the`+` .shouldInjectPolyfill function.`)}}else if(i!=null){throw new Error(`.shouldInjectPolyfill must be a function, or undefined`+` (received ${JSON.stringify(i)})`)}if(l!=null&&typeof l!=="boolean"&&typeof l!=="string"){throw new Error(`.absoluteImports must be a boolean, a string, or undefined`+` (received ${JSON.stringify(l)})`)}let p;if(s||n||a){const e=typeof s==="string"||Array.isArray(s)?{browsers:s}:s;p=d(e,{ignoreBrowserslistConfig:a,configPath:n})}else{p=t.targets()}return{method:r,methodName:u,targets:p,absoluteImports:l!=null?l:false,shouldInjectPolyfill:i,debug:!!o,providerOptions:c}}function instantiateProvider(e,t,r,s,i,c){const{method:d,methodName:f,targets:m,debug:y,shouldInjectPolyfill:g,providerOptions:h,absoluteImports:b}=resolveOptions(t,c);const x=(0,n.createUtilsGetter)(new o.default((e=>u.resolve(s,e,b))));let v,E;let j;let w;let _;const S=new Map;const O={babel:c,getUtils:x,method:t.method,targets:m,createMetaResolver:p.default,shouldInjectPolyfill(t){if(w===undefined){throw new Error(`Internal error in the ${e.name} provider: `+`shouldInjectPolyfill() can't be called during initialization.`)}if(!w.has(t)){console.warn(`Internal error in the ${k.name} provider: `+`unknown polyfill "${t}".`)}if(_&&!_(t))return false;let r=(0,a.isRequired)(t,m,{compatData:j,includes:v,excludes:E});if(g){r=g(t,r);if(typeof r!=="boolean"){throw new Error(`.shouldInjectPolyfill must return a boolean.`)}}return r},debug(e){i().found=true;if(!y||!e)return;if(i().polyfills.has(k.name))return;i().polyfills.set(e,j&&e&&j[e])},assertDependency(e,t="*"){if(r===false)return;if(b){return}const a=t==="*"?e:`${e}@^${t}`;const n=r.all?false:mapGetOr(S,`${e} :: ${s}`,(()=>u.has(s,e)));if(!n){i().missingDeps.add(a)}}};const k=e(O,h,s);if(typeof k[f]!=="function"){throw new Error(`The "${k.name||e.name}" provider doesn't `+`support the "${d}" polyfilling method.`)}if(Array.isArray(k.polyfills)){w=new Set(k.polyfills);_=k.filterPolyfills}else if(k.polyfills){w=new Set(Object.keys(k.polyfills));j=k.polyfills;_=k.filterPolyfills}else{w=new Set}({include:v,exclude:E}=(0,l.validateIncludeExclude)(k.name||e.name,w,h.include||[],h.exclude||[]));return{debug:y,method:d,targets:m,provider:k,callProvider(e,t){const r=x(t);k[f](e,r,t)}}}function definePolyfillProvider(e){return(0,s.declare)(((t,r,s)=>{t.assertVersion(7);const{traverse:n}=t;let o;const p=(0,l.applyMissingDependenciesDefaults)(r,t);const{debug:d,method:f,targets:m,provider:y,callProvider:g}=instantiateProvider(e,r,p,s,(()=>o),t);const h=f==="entry-global"?c.entry:c.usage;const b=y.visitor?n.visitors.merge([h(g),y.visitor]):h(g);if(d&&d!==i.presetEnvSilentDebugHeader){console.log(`${y.name}: \`DEBUG\` option`);console.log(`\nUsing targets: ${(0,i.stringifyTargetsMultiline)(m)}`);console.log(`\nUsing polyfills with \`${f}\` method:`)}return{name:"inject-polyfills",visitor:b,pre(){var e;o={polyfills:new Map,found:false,providers:new Set,missingDeps:new Set};(e=y.pre)==null?void 0:e.apply(this,arguments)},post(){var e;(e=y.post)==null?void 0:e.apply(this,arguments);if(p!==false){if(p.log==="per-file"){u.logMissing(o.missingDeps)}else{u.laterLogMissing(o.missingDeps)}}if(!d)return;if(this.filename)console.log(`\n[${this.filename}]`);if(o.polyfills.size===0){console.log(f==="entry-global"?o.found?`Based on your targets, the ${y.name} polyfill did not add any polyfill.`:`The entry point for the ${y.name} polyfill has not been found.`:`Based on your code and targets, the ${y.name} polyfill did not add any polyfill.`);return}if(f==="entry-global"){console.log(`The ${y.name} polyfill entry has been replaced with `+`the following polyfills:`)}else{console.log(`The ${y.name} polyfill added the following polyfills:`)}for(const[e,t]of o.polyfills){if(t){const r=(0,a.getInclusionReasons)(e,m,t);const s=JSON.stringify(r).replace(/,/g,", ").replace(/^\{"/,'{ "').replace(/"\}$/,'" }');console.log(` ${e} ${s}`)}else{console.log(` ${e}`)}}}}}))}function mapGetOr(e,t,r){let s=e.get(t);if(s===undefined){s=r();e.set(t,s)}return s}},4219:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=createMetaResolver;var s=r(3508);const a=new Set(["global","globalThis","self","window"]);function createMetaResolver(e){const{static:t,instance:r,global:n}=e;return e=>{if(e.kind==="global"&&n&&(0,s.has)(n,e.name)){return{kind:"global",desc:n[e.name],name:e.name}}if(e.kind==="property"||e.kind==="in"){const{placement:o,object:i,key:l}=e;if(i&&o==="static"){if(n&&a.has(i)&&(0,s.has)(n,l)){return{kind:"global",desc:n[l],name:l}}if(t&&(0,s.has)(t,i)&&(0,s.has)(t[i],l)){return{kind:"static",desc:t[i][l],name:`${i}$${l}`}}}if(r&&(0,s.has)(r,l)){return{kind:"instance",desc:r[l],name:`${l}`}}}}}},3229:(e,t,r)=>{"use strict";t.__esModule=true;t.resolve=resolve;t.has=has;t.logMissing=logMissing;t.laterLogMissing=laterLogMissing;var s=_interopRequireDefault(r(1017));var a=_interopRequireDefault(r(6240));var n=_interopRequireDefault(r(9485));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const o=parseFloat(process.versions.node)>=8.9;function resolve(e,t,r){if(r===false)return t;let a=e;if(typeof r==="string"){a=s.default.resolve(a,r)}let i,l;let c=t.indexOf("/");if(t[0]==="@"){c=t.indexOf("/",c+1)}if(c===-1){i=t;l=""}else{i=t.slice(0,c);l=t.slice(c)}try{let e;if(o){e=require.resolve(`${i}/package.json`,{paths:[a]})}else{e=n.default.sync(`${i}/package.json`,{basedir:a})}return s.default.dirname(e)+l}catch(r){if(r.code!=="MODULE_NOT_FOUND")throw r;throw Object.assign(new Error(`Failed to resolve "${t}" relative to "${e}"`),{code:"BABEL_POLYFILL_NOT_FOUND",polyfill:t,dirname:e})}}function has(e,t){try{if(o){require.resolve(t,{paths:[e]})}else{n.default.sync(t,{basedir:e})}return true}catch(e){return false}}function logMissing(e){if(e.size===0)return;const t=Array.from(e).sort().join(" ");console.warn("\nSome polyfills have been added but are not present in your dependencies.\n"+"Please run one of the following commands:\n"+`\tnpm install --save ${t}\n`+`\tyarn add ${t}\n`);process.exitCode=1}let i=new Set;const l=(0,a.default)((()=>{logMissing(i);i=new Set}),100);function laterLogMissing(e){if(e.size===0)return;e.forEach((e=>i.add(e)));l()}},8083:(e,t,r)=>{"use strict";t.__esModule=true;t.validateIncludeExclude=validateIncludeExclude;t.applyMissingDependenciesDefaults=applyMissingDependenciesDefaults;var s=r(3508);function patternToRegExp(e){if(e instanceof RegExp)return e;try{return new RegExp(`^${e}$`)}catch(e){return null}}function buildUnusedError(e,t){if(!t.length)return"";return` - The following "${e}" patterns didn't match any polyfill:\n`+t.map((e=>` ${String(e)}\n`)).join("")}function buldDuplicatesError(e){if(!e.size)return"";return` - The following polyfills were matched both by "include" and "exclude" patterns:\n`+Array.from(e,(e=>` ${e}\n`)).join("")}function validateIncludeExclude(e,t,r,a){let n;const filter=e=>{const r=patternToRegExp(e);if(!r)return false;let s=false;for(const e of t){if(r.test(e)){s=true;n.add(e)}}return!s};const o=n=new Set;const i=Array.from(r).filter(filter);const l=n=new Set;const c=Array.from(a).filter(filter);const u=(0,s.intersection)(o,l);if(u.size>0||i.length>0||c.length>0){throw new Error(`Error while validating the "${e}" provider options:\n`+buildUnusedError("include",i)+buildUnusedError("exclude",c)+buldDuplicatesError(u))}return{include:o,exclude:l}}function applyMissingDependenciesDefaults(e,t){const{missingDependencies:r={}}=e;if(r===false)return false;const s=t.caller((e=>e==null?void 0:e.name));const{log:a="deferred",inject:n=(s==="rollup-plugin-babel"?"throw":"import"),all:o=false}=r;return{log:a,inject:n,all:o}}},3508:(e,t,r)=>{"use strict";t.__esModule=true;t.intersection=intersection;t.has=has;t.resolveKey=resolveKey;t.resolveSource=resolveSource;t.getImportSource=getImportSource;t.getRequireSource=getRequireSource;t.createUtilsGetter=createUtilsGetter;var s=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:a,template:n}=s.default||s;function intersection(e,t){const r=new Set;e.forEach((e=>t.has(e)&&r.add(e)));return r}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function getType(e){return Object.prototype.toString.call(e).slice(8,-1)}function resolveId(e){if(e.isIdentifier()&&!e.scope.hasBinding(e.node.name,true)){return e.node.name}const{deopt:t}=e.evaluate();if(t&&t.isIdentifier()){return t.node.name}}function resolveKey(e,t=false){const{node:r,parent:s,scope:a}=e;if(e.isStringLiteral())return r.value;const{name:n}=r;const o=e.isIdentifier();if(o&&!(t||s.computed))return n;if(t&&e.isMemberExpression()&&e.get("object").isIdentifier({name:"Symbol"})&&!a.hasBinding("Symbol",true)){const t=resolveKey(e.get("property"),e.node.computed);if(t)return"Symbol."+t}if(!o||a.hasBinding(n,true)){const{value:t}=e.evaluate();if(typeof t==="string")return t}}function resolveSource(e){if(e.isMemberExpression()&&e.get("property").isIdentifier({name:"prototype"})){const t=resolveId(e.get("object"));if(t){return{id:t,placement:"prototype"}}return{id:null,placement:null}}const t=resolveId(e);if(t){return{id:t,placement:"static"}}const{value:r}=e.evaluate();if(r!==undefined){return{id:getType(r),placement:"prototype"}}else if(e.isRegExpLiteral()){return{id:"RegExp",placement:"prototype"}}else if(e.isFunction()){return{id:"Function",placement:"prototype"}}return{id:null,placement:null}}function getImportSource({node:e}){if(e.specifiers.length===0)return e.source.value}function getRequireSource({node:e}){if(!a.isExpressionStatement(e))return;const{expression:t}=e;const r=a.isCallExpression(t)&&a.isIdentifier(t.callee)&&t.callee.name==="require"&&t.arguments.length===1&&a.isStringLiteral(t.arguments[0]);if(r)return t.arguments[0].value}function hoist(e){e._blockHoist=3;return e}function createUtilsGetter(e){return t=>{const r=t.findParent((e=>e.isProgram()));return{injectGlobalImport(t){e.storeAnonymous(r,t,((e,t)=>e?n.statement.ast`require(${t})`:a.importDeclaration([],t)))},injectNamedImport(t,s,o=s){return e.storeNamed(r,t,s,((e,t,s)=>{const i=r.scope.generateUidIdentifier(o);return{node:e?hoist(n.statement.ast` + `)}}}))}}}}},8170:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=_default;var s=r(3931);function isRegeneratorSource(e){return e==="regenerator-runtime/runtime"||e==="regenerator-runtime/runtime.js"}function _default(){const e={ImportDeclaration(e){if(isRegeneratorSource((0,s.getImportSource)(e))){this.regeneratorImportExcluded=true;e.remove()}},Program(e){e.get("body").forEach((e=>{if(isRegeneratorSource((0,s.getRequireSource)(e))){this.regeneratorImportExcluded=true;e.remove()}}))}};return{name:"preset-env/remove-regenerator",visitor:e,pre(){this.regeneratorImportExcluded=false},post(){if(this.opts.debug&&this.regeneratorImportExcluded){let e=this.file.opts.filename;if(process.env.BABEL_ENV==="test"){e=e.replace(/\\/g,"/")}console.log(`\n[${e}] Based on your targets, regenerator-runtime import excluded.`)}}}}},3931:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getImportSource=getImportSource;t.getRequireSource=getRequireSource;t.isPolyfillSource=isPolyfillSource;var s=r(8622);function getImportSource({node:e}){if(e.specifiers.length===0)return e.source.value}function getRequireSource({node:e}){if(!s.isExpressionStatement(e))return;const{expression:t}=e;if(s.isCallExpression(t)&&s.isIdentifier(t.callee)&&t.callee.name==="require"&&t.arguments.length===1&&s.isStringLiteral(t.arguments[0])){return t.arguments[0].value}}function isPolyfillSource(e){return e==="@babel/polyfill"||e==="core-js"}},1068:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var s=r(558);var a=r(4350);var n=r(7347);function _interopDefaultLegacy(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var o=_interopDefaultLegacy(a);const i=new n.OptionValidator("@babel/preset-typescript");function normalizeOptions(e={}){let{allowNamespaces:t=true,jsxPragma:r,onlyRemoveTypeImports:s}=e;const a={allExtensions:"allExtensions",allowNamespaces:"allowNamespaces",isTSX:"isTSX",jsxPragma:"jsxPragma",jsxPragmaFrag:"jsxPragmaFrag",onlyRemoveTypeImports:"onlyRemoveTypeImports",optimizeConstEnums:"optimizeConstEnums"};const n=i.validateStringOption(a.jsxPragmaFrag,e.jsxPragmaFrag,"React.Fragment");const o=i.validateBooleanOption(a.allExtensions,e.allExtensions,false);const l=i.validateBooleanOption(a.isTSX,e.isTSX,false);if(l){i.invariant(o,"isTSX:true requires allExtensions:true")}const c=i.validateBooleanOption(a.optimizeConstEnums,e.optimizeConstEnums,false);return{allExtensions:o,allowNamespaces:t,isTSX:l,jsxPragma:r,jsxPragmaFrag:n,onlyRemoveTypeImports:s,optimizeConstEnums:c}}var l=s.declare(((e,t)=>{e.assertVersion(7);const{allExtensions:r,allowNamespaces:s,isTSX:a,jsxPragma:n,jsxPragmaFrag:i,onlyRemoveTypeImports:l,optimizeConstEnums:c}=normalizeOptions(t);const pluginOptions=e=>({allowDeclareFields:t.allowDeclareFields,allowNamespaces:s,isTSX:e,jsxPragma:n,jsxPragmaFrag:i,onlyRemoveTypeImports:l,optimizeConstEnums:c});return{overrides:r?[{plugins:[[o["default"],pluginOptions(a)]]}]:[{test:/\.ts$/,plugins:[[o["default"],pluginOptions(false)]]},{test:/\.tsx$/,plugins:[[o["default"],pluginOptions(true)]]}]}}));t["default"]=l},372:(e,t)=>{"use strict";t.__esModule=true;t["default"]=_default;function _extends(){_extends=Object.assign||function(e){for(var t=1;te!=="node"));return _extends({},a,t==="usage-pure"?s:null,o||i?r:null)}},2816:(e,t,r)=>{"use strict";t.__esModule=true;t.StaticProperties=t.InstanceProperties=t.BuiltIns=t.CommonIterators=void 0;var s=_interopRequireDefault(r(1268));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const define=(e,t,r=[],s)=>({name:e,pure:t,global:r,meta:s});const pureAndGlobal=(e,t,r=null)=>define(t[0],e,t,{minRuntimeVersion:r});const globalOnly=e=>define(e[0],null,e);const pureOnly=(e,t)=>define(t,e,[]);const a=["es6.object.to-string","es6.array.iterator","web.dom.iterable"];const n=["es6.string.iterator",...a];t.CommonIterators=n;const o=["es6.object.to-string","es6.promise"];const i={DataView:globalOnly(["es6.typed.data-view"]),Float32Array:globalOnly(["es6.typed.float32-array"]),Float64Array:globalOnly(["es6.typed.float64-array"]),Int8Array:globalOnly(["es6.typed.int8-array"]),Int16Array:globalOnly(["es6.typed.int16-array"]),Int32Array:globalOnly(["es6.typed.int32-array"]),Map:pureAndGlobal("map",["es6.map",...n]),Number:globalOnly(["es6.number.constructor"]),Promise:pureAndGlobal("promise",o),RegExp:globalOnly(["es6.regexp.constructor"]),Set:pureAndGlobal("set",["es6.set",...n]),Symbol:pureAndGlobal("symbol",["es6.symbol"]),Uint8Array:globalOnly(["es6.typed.uint8-array"]),Uint8ClampedArray:globalOnly(["es6.typed.uint8-clamped-array"]),Uint16Array:globalOnly(["es6.typed.uint16-array"]),Uint32Array:globalOnly(["es6.typed.uint32-array"]),WeakMap:pureAndGlobal("weak-map",["es6.weak-map",...n]),WeakSet:pureAndGlobal("weak-set",["es6.weak-set",...n]),setImmediate:pureOnly("set-immediate","web.immediate"),clearImmediate:pureOnly("clear-immediate","web.immediate"),parseFloat:pureOnly("parse-float","es6.parse-float"),parseInt:pureOnly("parse-int","es6.parse-int")};t.BuiltIns=i;const l={__defineGetter__:globalOnly(["es7.object.define-getter"]),__defineSetter__:globalOnly(["es7.object.define-setter"]),__lookupGetter__:globalOnly(["es7.object.lookup-getter"]),__lookupSetter__:globalOnly(["es7.object.lookup-setter"]),anchor:globalOnly(["es6.string.anchor"]),big:globalOnly(["es6.string.big"]),bind:globalOnly(["es6.function.bind"]),blink:globalOnly(["es6.string.blink"]),bold:globalOnly(["es6.string.bold"]),codePointAt:globalOnly(["es6.string.code-point-at"]),copyWithin:globalOnly(["es6.array.copy-within"]),endsWith:globalOnly(["es6.string.ends-with"]),entries:globalOnly(a),every:globalOnly(["es6.array.every"]),fill:globalOnly(["es6.array.fill"]),filter:globalOnly(["es6.array.filter"]),finally:globalOnly(["es7.promise.finally",...o]),find:globalOnly(["es6.array.find"]),findIndex:globalOnly(["es6.array.find-index"]),fixed:globalOnly(["es6.string.fixed"]),flags:globalOnly(["es6.regexp.flags"]),flatMap:globalOnly(["es7.array.flat-map"]),fontcolor:globalOnly(["es6.string.fontcolor"]),fontsize:globalOnly(["es6.string.fontsize"]),forEach:globalOnly(["es6.array.for-each"]),includes:globalOnly(["es6.string.includes","es7.array.includes"]),indexOf:globalOnly(["es6.array.index-of"]),italics:globalOnly(["es6.string.italics"]),keys:globalOnly(a),lastIndexOf:globalOnly(["es6.array.last-index-of"]),link:globalOnly(["es6.string.link"]),map:globalOnly(["es6.array.map"]),match:globalOnly(["es6.regexp.match"]),name:globalOnly(["es6.function.name"]),padStart:globalOnly(["es7.string.pad-start"]),padEnd:globalOnly(["es7.string.pad-end"]),reduce:globalOnly(["es6.array.reduce"]),reduceRight:globalOnly(["es6.array.reduce-right"]),repeat:globalOnly(["es6.string.repeat"]),replace:globalOnly(["es6.regexp.replace"]),search:globalOnly(["es6.regexp.search"]),small:globalOnly(["es6.string.small"]),some:globalOnly(["es6.array.some"]),sort:globalOnly(["es6.array.sort"]),split:globalOnly(["es6.regexp.split"]),startsWith:globalOnly(["es6.string.starts-with"]),strike:globalOnly(["es6.string.strike"]),sub:globalOnly(["es6.string.sub"]),sup:globalOnly(["es6.string.sup"]),toISOString:globalOnly(["es6.date.to-iso-string"]),toJSON:globalOnly(["es6.date.to-json"]),toString:globalOnly(["es6.object.to-string","es6.date.to-string","es6.regexp.to-string"]),trim:globalOnly(["es6.string.trim"]),trimEnd:globalOnly(["es7.string.trim-right"]),trimLeft:globalOnly(["es7.string.trim-left"]),trimRight:globalOnly(["es7.string.trim-right"]),trimStart:globalOnly(["es7.string.trim-left"]),values:globalOnly(a)};t.InstanceProperties=l;if("es6.array.slice"in s.default){l.slice=globalOnly(["es6.array.slice"])}const c={Array:{from:pureAndGlobal("array/from",["es6.symbol","es6.array.from",...n]),isArray:pureAndGlobal("array/is-array",["es6.array.is-array"]),of:pureAndGlobal("array/of",["es6.array.of"])},Date:{now:pureAndGlobal("date/now",["es6.date.now"])},JSON:{stringify:pureOnly("json/stringify","es6.symbol")},Math:{acosh:pureAndGlobal("math/acosh",["es6.math.acosh"],"7.0.1"),asinh:pureAndGlobal("math/asinh",["es6.math.asinh"],"7.0.1"),atanh:pureAndGlobal("math/atanh",["es6.math.atanh"],"7.0.1"),cbrt:pureAndGlobal("math/cbrt",["es6.math.cbrt"],"7.0.1"),clz32:pureAndGlobal("math/clz32",["es6.math.clz32"],"7.0.1"),cosh:pureAndGlobal("math/cosh",["es6.math.cosh"],"7.0.1"),expm1:pureAndGlobal("math/expm1",["es6.math.expm1"],"7.0.1"),fround:pureAndGlobal("math/fround",["es6.math.fround"],"7.0.1"),hypot:pureAndGlobal("math/hypot",["es6.math.hypot"],"7.0.1"),imul:pureAndGlobal("math/imul",["es6.math.imul"],"7.0.1"),log1p:pureAndGlobal("math/log1p",["es6.math.log1p"],"7.0.1"),log10:pureAndGlobal("math/log10",["es6.math.log10"],"7.0.1"),log2:pureAndGlobal("math/log2",["es6.math.log2"],"7.0.1"),sign:pureAndGlobal("math/sign",["es6.math.sign"],"7.0.1"),sinh:pureAndGlobal("math/sinh",["es6.math.sinh"],"7.0.1"),tanh:pureAndGlobal("math/tanh",["es6.math.tanh"],"7.0.1"),trunc:pureAndGlobal("math/trunc",["es6.math.trunc"],"7.0.1")},Number:{EPSILON:pureAndGlobal("number/epsilon",["es6.number.epsilon"]),MIN_SAFE_INTEGER:pureAndGlobal("number/min-safe-integer",["es6.number.min-safe-integer"]),MAX_SAFE_INTEGER:pureAndGlobal("number/max-safe-integer",["es6.number.max-safe-integer"]),isFinite:pureAndGlobal("number/is-finite",["es6.number.is-finite"]),isInteger:pureAndGlobal("number/is-integer",["es6.number.is-integer"]),isSafeInteger:pureAndGlobal("number/is-safe-integer",["es6.number.is-safe-integer"]),isNaN:pureAndGlobal("number/is-nan",["es6.number.is-nan"]),parseFloat:pureAndGlobal("number/parse-float",["es6.number.parse-float"]),parseInt:pureAndGlobal("number/parse-int",["es6.number.parse-int"])},Object:{assign:pureAndGlobal("object/assign",["es6.object.assign"]),create:pureAndGlobal("object/create",["es6.object.create"]),defineProperties:pureAndGlobal("object/define-properties",["es6.object.define-properties"]),defineProperty:pureAndGlobal("object/define-property",["es6.object.define-property"]),entries:pureAndGlobal("object/entries",["es7.object.entries"]),freeze:pureAndGlobal("object/freeze",["es6.object.freeze"]),getOwnPropertyDescriptor:pureAndGlobal("object/get-own-property-descriptor",["es6.object.get-own-property-descriptor"]),getOwnPropertyDescriptors:pureAndGlobal("object/get-own-property-descriptors",["es7.object.get-own-property-descriptors"]),getOwnPropertyNames:pureAndGlobal("object/get-own-property-names",["es6.object.get-own-property-names"]),getOwnPropertySymbols:pureAndGlobal("object/get-own-property-symbols",["es6.symbol"]),getPrototypeOf:pureAndGlobal("object/get-prototype-of",["es6.object.get-prototype-of"]),is:pureAndGlobal("object/is",["es6.object.is"]),isExtensible:pureAndGlobal("object/is-extensible",["es6.object.is-extensible"]),isFrozen:pureAndGlobal("object/is-frozen",["es6.object.is-frozen"]),isSealed:pureAndGlobal("object/is-sealed",["es6.object.is-sealed"]),keys:pureAndGlobal("object/keys",["es6.object.keys"]),preventExtensions:pureAndGlobal("object/prevent-extensions",["es6.object.prevent-extensions"]),seal:pureAndGlobal("object/seal",["es6.object.seal"]),setPrototypeOf:pureAndGlobal("object/set-prototype-of",["es6.object.set-prototype-of"]),values:pureAndGlobal("object/values",["es7.object.values"])},Promise:{all:globalOnly(n),race:globalOnly(n)},Reflect:{apply:pureAndGlobal("reflect/apply",["es6.reflect.apply"]),construct:pureAndGlobal("reflect/construct",["es6.reflect.construct"]),defineProperty:pureAndGlobal("reflect/define-property",["es6.reflect.define-property"]),deleteProperty:pureAndGlobal("reflect/delete-property",["es6.reflect.delete-property"]),get:pureAndGlobal("reflect/get",["es6.reflect.get"]),getOwnPropertyDescriptor:pureAndGlobal("reflect/get-own-property-descriptor",["es6.reflect.get-own-property-descriptor"]),getPrototypeOf:pureAndGlobal("reflect/get-prototype-of",["es6.reflect.get-prototype-of"]),has:pureAndGlobal("reflect/has",["es6.reflect.has"]),isExtensible:pureAndGlobal("reflect/is-extensible",["es6.reflect.is-extensible"]),ownKeys:pureAndGlobal("reflect/own-keys",["es6.reflect.own-keys"]),preventExtensions:pureAndGlobal("reflect/prevent-extensions",["es6.reflect.prevent-extensions"]),set:pureAndGlobal("reflect/set",["es6.reflect.set"]),setPrototypeOf:pureAndGlobal("reflect/set-prototype-of",["es6.reflect.set-prototype-of"])},String:{at:pureOnly("string/at","es7.string.at"),fromCodePoint:pureAndGlobal("string/from-code-point",["es6.string.from-code-point"]),raw:pureAndGlobal("string/raw",["es6.string.raw"])},Symbol:{asyncIterator:globalOnly(["es6.symbol","es7.symbol.async-iterator"]),for:pureOnly("symbol/for","es6.symbol"),hasInstance:pureOnly("symbol/has-instance","es6.symbol"),isConcatSpreadable:pureOnly("symbol/is-concat-spreadable","es6.symbol"),iterator:define("es6.symbol","symbol/iterator",n),keyFor:pureOnly("symbol/key-for","es6.symbol"),match:pureAndGlobal("symbol/match",["es6.regexp.match"]),replace:pureOnly("symbol/replace","es6.symbol"),search:pureOnly("symbol/search","es6.symbol"),species:pureOnly("symbol/species","es6.symbol"),split:pureOnly("symbol/split","es6.symbol"),toPrimitive:pureOnly("symbol/to-primitive","es6.symbol"),toStringTag:pureOnly("symbol/to-string-tag","es6.symbol"),unscopables:pureOnly("symbol/unscopables","es6.symbol")}};t.StaticProperties=c},400:(e,t,r)=>{"use strict";t.__esModule=true;t.hasMinVersion=hasMinVersion;var s=_interopRequireDefault(r(7849));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function hasMinVersion(e,t){if(!t||!e)return true;if(s.default.valid(t))t=`^${t}`;return!s.default.intersects(`<${e}`,t)&&!s.default.intersects(`>=8.0.0`,t)}},9897:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireDefault(r(1268));var a=r(2816);var n=_interopRequireDefault(r(372));var o=r(400);var i=_interopRequireDefault(r(6389));var l=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const{types:c}=l.default||l;const u="#__secret_key__@babel/preset-env__compatibility";const p="#__secret_key__@babel/runtime__compatibility";const f=Function.call.bind(Object.hasOwnProperty);var d=(0,i.default)((function(e,{[u]:{entryInjectRegenerator:t}={},[p]:{useBabelRuntime:r,runtimeVersion:i,ext:l=".js"}={}}){const d=e.createMetaResolver({global:a.BuiltIns,static:a.StaticProperties,instance:a.InstanceProperties});const{debug:m,shouldInjectPolyfill:y,method:g}=e;const h=(0,n.default)(e.targets,g,s.default);const b=r?`${r}/core-js`:g==="usage-pure"?"core-js/library/fn":"core-js/modules";function inject(e,t){if(typeof e==="string"){if(f(h,e)&&y(e)){m(e);t.injectGlobalImport(`${b}/${e}.js`)}return}e.forEach((e=>inject(e,t)))}function maybeInjectPure(e,t,r){const{pure:s,meta:a,name:n}=e;if(!s||!y(n))return;if(i&&a&&a.minRuntimeVersion&&!(0,o.hasMinVersion)(a&&a.minRuntimeVersion,i)){return}return r.injectDefaultImport(`${b}/${s}${l}`,t)}return{name:"corejs2",polyfills:h,entryGlobal(e,r,s){if(e.kind==="import"&&e.source==="core-js"){m(null);inject(Object.keys(h),r);if(t){r.injectGlobalImport("regenerator-runtime/runtime.js")}s.remove()}},usageGlobal(e,t){const r=d(e);if(!r)return;let s=r.desc.global;if(r.kind!=="global"&&e.object&&e.placement==="prototype"){const t=e.object.toLowerCase();s=s.filter((e=>e.includes(t)))}inject(s,t)},usagePure(e,t,r){if(e.kind==="in"){if(e.key==="Symbol.iterator"){r.replaceWith(c.callExpression(t.injectDefaultImport(`${b}/is-iterable${l}`,"isIterable"),[r.node.right]))}return}if(r.parentPath.isUnaryExpression({operator:"delete"}))return;if(e.kind==="property"){if(!r.isMemberExpression())return;if(!r.isReferenced())return;if(e.key==="Symbol.iterator"&&y("es6.symbol")&&r.parentPath.isCallExpression({callee:r.node})&&r.parent.arguments.length===0){r.parentPath.replaceWith(c.callExpression(t.injectDefaultImport(`${b}/get-iterator${l}`,"getIterator"),[r.node.object]));r.skip();return}}const s=d(e);if(!s)return;const a=maybeInjectPure(s.desc,s.name,t);if(a)r.replaceWith(a)},visitor:g==="usage-global"&&{YieldExpression(t){if(t.node.delegate){inject("web.dom.iterable",e.getUtils(t))}},"ForOfStatement|ArrayPattern"(t){a.CommonIterators.forEach((r=>inject(r,e.getUtils(t))))}}}}));t["default"]=d},1268:(e,t,r)=>{e.exports=r(516)},9270:(e,t,r)=>{e.exports=r(5246)},559:(e,t,r)=>{e.exports=r(4812)},4245:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getInclusionReasons=getInclusionReasons;var s=r(7849);var a=r(834);var n=r(4208);function getInclusionReasons(e,t,r){const o=r[e]||{};return Object.keys(t).reduce(((e,r)=>{const i=(0,n.getLowestImplementedVersion)(o,r);const l=t[r];if(!i){e[r]=(0,a.prettifyVersion)(l)}else{const t=(0,n.isUnreleasedVersion)(i,r);const o=(0,n.isUnreleasedVersion)(l,r);if(!o&&(t||s.lt(l.toString(),(0,n.semverify)(i)))){e[r]=(0,a.prettifyVersion)(l)}}return e}),{})}},425:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.targetsSupported=targetsSupported;t.isRequired=isRequired;t["default"]=filterItems;var s=r(7849);var a=r(559);var n=r(4208);function targetsSupported(e,t){const r=Object.keys(e);if(r.length===0){return false}const a=r.filter((r=>{const a=(0,n.getLowestImplementedVersion)(t,r);if(!a){return true}const o=e[r];if((0,n.isUnreleasedVersion)(o,r)){return false}if((0,n.isUnreleasedVersion)(a,r)){return true}if(!s.valid(o.toString())){throw new Error(`Invalid version passed for target "${r}": "${o}". `+"Versions must be in semver format (major.minor.patch)")}return s.gt((0,n.semverify)(a),o.toString())}));return a.length===0}function isRequired(e,t,{compatData:r=a,includes:s,excludes:n}={}){if(n!=null&&n.has(e))return false;if(s!=null&&s.has(e))return true;return!targetsSupported(t,r[e])}function filterItems(e,t,r,s,a,n,o){const i=new Set;const l={compatData:e,includes:t,excludes:r};for(const t in e){if(isRequired(t,s,l)){i.add(t)}else if(o){const e=o.get(t);if(e){i.add(e)}}}if(a){a.forEach((e=>!r.has(e)&&i.add(e)))}if(n){n.forEach((e=>!t.has(e)&&i.delete(e)))}return i}},8097:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isBrowsersQueryValid=isBrowsersQueryValid;t["default"]=getTargets;Object.defineProperty(t,"unreleasedLabels",{enumerable:true,get:function(){return i.unreleasedLabels}});Object.defineProperty(t,"TargetNames",{enumerable:true,get:function(){return l.TargetNames}});Object.defineProperty(t,"prettifyTargets",{enumerable:true,get:function(){return c.prettifyTargets}});Object.defineProperty(t,"getInclusionReasons",{enumerable:true,get:function(){return u.getInclusionReasons}});Object.defineProperty(t,"filterItems",{enumerable:true,get:function(){return p.default}});Object.defineProperty(t,"isRequired",{enumerable:true,get:function(){return p.isRequired}});var s=r(4907);var a=r(7347);var n=r(9270);var o=r(4208);var i=r(6124);var l=r(7891);var c=r(834);var u=r(4245);var p=r(425);const f=n["es6.module"];const d=new a.OptionValidator("@babel/helper-compilation-targets");function validateTargetNames(e){const t=Object.keys(l.TargetNames);for(const r of Object.keys(e)){if(!(r in l.TargetNames)){throw new Error(d.formatMessage(`'${r}' is not a valid target\n- Did you mean '${(0,a.findSuggestion)(r,t)}'?`))}}return e}function isBrowsersQueryValid(e){return typeof e==="string"||Array.isArray(e)&&e.every((e=>typeof e==="string"))}function validateBrowsers(e){d.invariant(e===undefined||isBrowsersQueryValid(e),`'${String(e)}' is not a valid browserslist query`);return e}function getLowestVersions(e){return e.reduce(((e,t)=>{const[r,s]=t.split(" ");const a=i.browserNameMap[r];if(!a){return e}try{const t=s.split("-")[0].toLowerCase();const n=(0,o.isUnreleasedVersion)(t,r);if(!e[a]){e[a]=n?t:(0,o.semverify)(t);return e}const i=e[a];const l=(0,o.isUnreleasedVersion)(i,r);if(l&&n){e[a]=(0,o.getLowestUnreleased)(i,t,r)}else if(l){e[a]=(0,o.semverify)(t)}else if(!l&&!n){const r=(0,o.semverify)(t);e[a]=(0,o.semverMin)(i,r)}}catch(e){}return e}),{})}function outputDecimalWarning(e){if(!e.length){return}console.warn("Warning, the following targets are using a decimal version:\n");e.forEach((({target:e,value:t})=>console.warn(` ${e}: ${t}`)));console.warn(`\nWe recommend using a string for minor/patch versions to avoid numbers like 6.10\ngetting parsed as 6.1, which can lead to unexpected behavior.\n`)}function semverifyTarget(e,t){try{return(0,o.semverify)(t)}catch(r){throw new Error(d.formatMessage(`'${t}' is not a valid value for 'targets.${e}'.`))}}const m={__default(e,t){const r=(0,o.isUnreleasedVersion)(t,e)?t.toLowerCase():semverifyTarget(e,t);return[e,r]},node(e,t){const r=t===true||t==="current"?process.versions.node:semverifyTarget(e,t);return[e,r]}};function generateTargets(e){const t=Object.assign({},e);delete t.esmodules;delete t.browsers;return t}function resolveTargets(e){const t=s(e,{mobileToDesktop:true});return getLowestVersions(t)}function getTargets(e={},t={}){var r;let{browsers:a,esmodules:n}=e;const{configPath:i="."}=t;validateBrowsers(a);const l=generateTargets(e);let c=validateTargetNames(l);const u=!!a;const p=u||Object.keys(c).length>0;const d=!t.ignoreBrowserslistConfig&&!p;if(!a&&d){a=s.loadConfig({config:t.configFile,path:i,env:t.browserslistEnv});if(a==null){{a=[]}}}if(n&&(n!=="intersect"||!((r=a)!=null&&r.length))){a=Object.keys(f).map((e=>`${e} >= ${f[e]}`)).join(", ");n=false}if(a){const e=resolveTargets(a);if(n==="intersect"){for(const t of Object.keys(e)){const r=e[t];if(f[t]){e[t]=(0,o.getHighestUnreleased)(r,(0,o.semverify)(f[t]),t)}else{delete e[t]}}}c=Object.assign(e,c)}const y={};const g=[];for(const e of Object.keys(c).sort()){var h;const t=c[e];if(typeof t==="number"&&t%1!==0){g.push({target:e,value:t})}const r=(h=m[e])!=null?h:m.__default;const[s,a]=r(e,t);if(a){y[s]=a}}outputDecimalWarning(g);return y}},7891:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.TargetNames=void 0;const r={node:"node",chrome:"chrome",opera:"opera",edge:"edge",firefox:"firefox",safari:"safari",ie:"ie",ios:"ios",android:"android",electron:"electron",samsung:"samsung"};t.TargetNames=r},834:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.prettifyVersion=prettifyVersion;t.prettifyTargets=prettifyTargets;var s=r(7849);var a=r(6124);function prettifyVersion(e){if(typeof e!=="string"){return e}const t=[s.major(e)];const r=s.minor(e);const a=s.patch(e);if(r||a){t.push(r)}if(a){t.push(a)}return t.join(".")}function prettifyTargets(e){return Object.keys(e).reduce(((t,r)=>{let s=e[r];const n=a.unreleasedLabels[r];if(typeof s==="string"&&n!==s){s=prettifyVersion(s)}t[r]=s;return t}),{})}},6124:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.browserNameMap=t.unreleasedLabels=void 0;const r={safari:"tp"};t.unreleasedLabels=r;const s={and_chr:"chrome",and_ff:"firefox",android:"android",chrome:"chrome",edge:"edge",firefox:"firefox",ie:"ie",ie_mob:"ie",ios_saf:"ios",node:"node",op_mob:"opera",opera:"opera",safari:"safari",samsung:"samsung"};t.browserNameMap=s},4208:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.semverMin=semverMin;t.semverify=semverify;t.isUnreleasedVersion=isUnreleasedVersion;t.getLowestUnreleased=getLowestUnreleased;t.getHighestUnreleased=getHighestUnreleased;t.getLowestImplementedVersion=getLowestImplementedVersion;var s=r(7849);var a=r(7347);var n=r(6124);const o=/^(\d+|\d+.\d+)$/;const i=new a.OptionValidator("@babel/helper-compilation-targets");function semverMin(e,t){return e&&s.lt(e,t)?e:t}function semverify(e){if(typeof e==="string"&&s.valid(e)){return e}i.invariant(typeof e==="number"||typeof e==="string"&&o.test(e),`'${e}' is not a valid version`);const t=e.toString().split(".");while(t.length<3){t.push("0")}return t.join(".")}function isUnreleasedVersion(e,t){const r=n.unreleasedLabels[t];return!!r&&r===e.toString().toLowerCase()}function getLowestUnreleased(e,t,r){const s=n.unreleasedLabels[r];const a=[e,t].some((e=>e===s));if(a){return e===a?t:e||t}return semverMin(e,t)}function getHighestUnreleased(e,t,r){return getLowestUnreleased(e,t,r)===e?t:e}function getLowestImplementedVersion(e,t){const r=e[t];if(!r&&t==="android"){return e.chrome}return r}},3318:(e,t,r)=>{"use strict";t.__esModule=true;t.stringifyTargetsMultiline=stringifyTargetsMultiline;t.stringifyTargets=stringifyTargets;t.presetEnvSilentDebugHeader=void 0;var s=r(8097);const a="#__secret_key__@babel/preset-env__don't_log_debug_header_and_resolved_targets";t.presetEnvSilentDebugHeader=a;function stringifyTargetsMultiline(e){return JSON.stringify((0,s.prettifyTargets)(e),null,2)}function stringifyTargets(e){return JSON.stringify(e).replace(/,/g,", ").replace(/^\{"/,'{ "').replace(/"\}$/,'" }')}},2551:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:a}=s.default||s;class ImportsCache{constructor(e){this._imports=new WeakMap;this._anonymousImports=new WeakMap;this._lastImports=new WeakMap;this._resolver=e}storeAnonymous(e,t,r){const s=this._normalizeKey(e,t);const n=this._ensure(this._anonymousImports,e,Set);if(n.has(s))return;const o=r(e.node.sourceType==="script",a.stringLiteral(this._resolver(t)));n.add(s);this._injectImport(e,o)}storeNamed(e,t,r,s){const n=this._normalizeKey(e,t,r);const o=this._ensure(this._imports,e,Map);if(!o.has(n)){const{node:i,name:l}=s(e.node.sourceType==="script",a.stringLiteral(this._resolver(t)),a.identifier(r));o.set(n,l);this._injectImport(e,i)}return a.identifier(o.get(n))}_injectImport(e,t){let r=this._lastImports.get(e);if(r&&r.node&&r.parent===e.node&&r.container===e.node.body){r=r.insertAfter(t)}else{r=e.unshiftContainer("body",t)}r=r[r.length-1];this._lastImports.set(e,r)}_ensure(e,t,r){let s=e.get(t);if(!s){s=new r;e.set(t,s)}return s}_normalizeKey(e,t,r=""){const{sourceType:s}=e.node;return`${r&&s}::${t}::${r}`}}t["default"]=ImportsCache},6389:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=definePolyfillProvider;var s=r(558);var a=_interopRequireWildcard(r(8097));var n=r(3508);var o=_interopRequireDefault(r(2551));var i=r(3318);var l=r(8083);var c=_interopRequireWildcard(r(7107));var u=_interopRequireWildcard(r(3229));var p=_interopRequireDefault(r(4219));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var r={};var s=Object.keys(e);var a,n;for(n=0;n=0)continue;r[a]=e[a]}return r}const f=a.default.default||a.default;function resolveOptions(e,t){const{method:r,targets:s,ignoreBrowserslistConfig:a,configPath:n,debug:o,shouldInjectPolyfill:i,absoluteImports:l}=e,c=_objectWithoutPropertiesLoose(e,["method","targets","ignoreBrowserslistConfig","configPath","debug","shouldInjectPolyfill","absoluteImports"]);let u;if(r==="usage-global")u="usageGlobal";else if(r==="entry-global")u="entryGlobal";else if(r==="usage-pure")u="usagePure";else if(typeof r!=="string"){throw new Error(".method must be a string")}else{throw new Error(`.method must be one of "entry-global", "usage-global"`+` or "usage-pure" (received ${JSON.stringify(r)})`)}if(typeof i==="function"){if(e.include||e.exclude){throw new Error(`.include and .exclude are not supported when using the`+` .shouldInjectPolyfill function.`)}}else if(i!=null){throw new Error(`.shouldInjectPolyfill must be a function, or undefined`+` (received ${JSON.stringify(i)})`)}if(l!=null&&typeof l!=="boolean"&&typeof l!=="string"){throw new Error(`.absoluteImports must be a boolean, a string, or undefined`+` (received ${JSON.stringify(l)})`)}let p;if(s||n||a){const e=typeof s==="string"||Array.isArray(s)?{browsers:s}:s;p=f(e,{ignoreBrowserslistConfig:a,configPath:n})}else{p=t.targets()}return{method:r,methodName:u,targets:p,absoluteImports:l!=null?l:false,shouldInjectPolyfill:i,debug:!!o,providerOptions:c}}function instantiateProvider(e,t,r,s,i,c){const{method:f,methodName:d,targets:m,debug:y,shouldInjectPolyfill:g,providerOptions:h,absoluteImports:b}=resolveOptions(t,c);const x=(0,n.createUtilsGetter)(new o.default((e=>u.resolve(s,e,b))));let v,E;let j;let w;let _;const S=new Map;const k={babel:c,getUtils:x,method:t.method,targets:m,createMetaResolver:p.default,shouldInjectPolyfill(t){if(w===undefined){throw new Error(`Internal error in the ${e.name} provider: `+`shouldInjectPolyfill() can't be called during initialization.`)}if(!w.has(t)){console.warn(`Internal error in the ${O.name} provider: `+`unknown polyfill "${t}".`)}if(_&&!_(t))return false;let r=(0,a.isRequired)(t,m,{compatData:j,includes:v,excludes:E});if(g){r=g(t,r);if(typeof r!=="boolean"){throw new Error(`.shouldInjectPolyfill must return a boolean.`)}}return r},debug(e){i().found=true;if(!y||!e)return;if(i().polyfills.has(O.name))return;i().polyfills.set(e,j&&e&&j[e])},assertDependency(e,t="*"){if(r===false)return;if(b){return}const a=t==="*"?e:`${e}@^${t}`;const n=r.all?false:mapGetOr(S,`${e} :: ${s}`,(()=>u.has(s,e)));if(!n){i().missingDeps.add(a)}}};const O=e(k,h,s);if(typeof O[d]!=="function"){throw new Error(`The "${O.name||e.name}" provider doesn't `+`support the "${f}" polyfilling method.`)}if(Array.isArray(O.polyfills)){w=new Set(O.polyfills);_=O.filterPolyfills}else if(O.polyfills){w=new Set(Object.keys(O.polyfills));j=O.polyfills;_=O.filterPolyfills}else{w=new Set}({include:v,exclude:E}=(0,l.validateIncludeExclude)(O.name||e.name,w,h.include||[],h.exclude||[]));return{debug:y,method:f,targets:m,provider:O,callProvider(e,t){const r=x(t);O[d](e,r,t)}}}function definePolyfillProvider(e){return(0,s.declare)(((t,r,s)=>{t.assertVersion(7);const{traverse:n}=t;let o;const p=(0,l.applyMissingDependenciesDefaults)(r,t);const{debug:f,method:d,targets:m,provider:y,callProvider:g}=instantiateProvider(e,r,p,s,(()=>o),t);const h=d==="entry-global"?c.entry:c.usage;const b=y.visitor?n.visitors.merge([h(g),y.visitor]):h(g);if(f&&f!==i.presetEnvSilentDebugHeader){console.log(`${y.name}: \`DEBUG\` option`);console.log(`\nUsing targets: ${(0,i.stringifyTargetsMultiline)(m)}`);console.log(`\nUsing polyfills with \`${d}\` method:`)}return{name:"inject-polyfills",visitor:b,pre(){var e;o={polyfills:new Map,found:false,providers:new Set,missingDeps:new Set};(e=y.pre)==null?void 0:e.apply(this,arguments)},post(){var e;(e=y.post)==null?void 0:e.apply(this,arguments);if(p!==false){if(p.log==="per-file"){u.logMissing(o.missingDeps)}else{u.laterLogMissing(o.missingDeps)}}if(!f)return;if(this.filename)console.log(`\n[${this.filename}]`);if(o.polyfills.size===0){console.log(d==="entry-global"?o.found?`Based on your targets, the ${y.name} polyfill did not add any polyfill.`:`The entry point for the ${y.name} polyfill has not been found.`:`Based on your code and targets, the ${y.name} polyfill did not add any polyfill.`);return}if(d==="entry-global"){console.log(`The ${y.name} polyfill entry has been replaced with `+`the following polyfills:`)}else{console.log(`The ${y.name} polyfill added the following polyfills:`)}for(const[e,t]of o.polyfills){if(t){const r=(0,a.getInclusionReasons)(e,m,t);const s=JSON.stringify(r).replace(/,/g,", ").replace(/^\{"/,'{ "').replace(/"\}$/,'" }');console.log(` ${e} ${s}`)}else{console.log(` ${e}`)}}}}}))}function mapGetOr(e,t,r){let s=e.get(t);if(s===undefined){s=r();e.set(t,s)}return s}},4219:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=createMetaResolver;var s=r(3508);const a=new Set(["global","globalThis","self","window"]);function createMetaResolver(e){const{static:t,instance:r,global:n}=e;return e=>{if(e.kind==="global"&&n&&(0,s.has)(n,e.name)){return{kind:"global",desc:n[e.name],name:e.name}}if(e.kind==="property"||e.kind==="in"){const{placement:o,object:i,key:l}=e;if(i&&o==="static"){if(n&&a.has(i)&&(0,s.has)(n,l)){return{kind:"global",desc:n[l],name:l}}if(t&&(0,s.has)(t,i)&&(0,s.has)(t[i],l)){return{kind:"static",desc:t[i][l],name:`${i}$${l}`}}}if(r&&(0,s.has)(r,l)){return{kind:"instance",desc:r[l],name:`${l}`}}}}}},3229:(e,t,r)=>{"use strict";t.__esModule=true;t.resolve=resolve;t.has=has;t.logMissing=logMissing;t.laterLogMissing=laterLogMissing;var s=_interopRequireDefault(r(1017));var a=_interopRequireDefault(r(6240));var n=_interopRequireDefault(r(9485));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const o=parseFloat(process.versions.node)>=8.9;function resolve(e,t,r){if(r===false)return t;let a=e;if(typeof r==="string"){a=s.default.resolve(a,r)}let i,l;let c=t.indexOf("/");if(t[0]==="@"){c=t.indexOf("/",c+1)}if(c===-1){i=t;l=""}else{i=t.slice(0,c);l=t.slice(c)}try{let e;if(o){e=require.resolve(`${i}/package.json`,{paths:[a]})}else{e=n.default.sync(`${i}/package.json`,{basedir:a})}return s.default.dirname(e)+l}catch(r){if(r.code!=="MODULE_NOT_FOUND")throw r;throw Object.assign(new Error(`Failed to resolve "${t}" relative to "${e}"`),{code:"BABEL_POLYFILL_NOT_FOUND",polyfill:t,dirname:e})}}function has(e,t){try{if(o){require.resolve(t,{paths:[e]})}else{n.default.sync(t,{basedir:e})}return true}catch(e){return false}}function logMissing(e){if(e.size===0)return;const t=Array.from(e).sort().join(" ");console.warn("\nSome polyfills have been added but are not present in your dependencies.\n"+"Please run one of the following commands:\n"+`\tnpm install --save ${t}\n`+`\tyarn add ${t}\n`);process.exitCode=1}let i=new Set;const l=(0,a.default)((()=>{logMissing(i);i=new Set}),100);function laterLogMissing(e){if(e.size===0)return;e.forEach((e=>i.add(e)));l()}},8083:(e,t,r)=>{"use strict";t.__esModule=true;t.validateIncludeExclude=validateIncludeExclude;t.applyMissingDependenciesDefaults=applyMissingDependenciesDefaults;var s=r(3508);function patternToRegExp(e){if(e instanceof RegExp)return e;try{return new RegExp(`^${e}$`)}catch(e){return null}}function buildUnusedError(e,t){if(!t.length)return"";return` - The following "${e}" patterns didn't match any polyfill:\n`+t.map((e=>` ${String(e)}\n`)).join("")}function buldDuplicatesError(e){if(!e.size)return"";return` - The following polyfills were matched both by "include" and "exclude" patterns:\n`+Array.from(e,(e=>` ${e}\n`)).join("")}function validateIncludeExclude(e,t,r,a){let n;const filter=e=>{const r=patternToRegExp(e);if(!r)return false;let s=false;for(const e of t){if(r.test(e)){s=true;n.add(e)}}return!s};const o=n=new Set;const i=Array.from(r).filter(filter);const l=n=new Set;const c=Array.from(a).filter(filter);const u=(0,s.intersection)(o,l);if(u.size>0||i.length>0||c.length>0){throw new Error(`Error while validating the "${e}" provider options:\n`+buildUnusedError("include",i)+buildUnusedError("exclude",c)+buldDuplicatesError(u))}return{include:o,exclude:l}}function applyMissingDependenciesDefaults(e,t){const{missingDependencies:r={}}=e;if(r===false)return false;const s=t.caller((e=>e==null?void 0:e.name));const{log:a="deferred",inject:n=(s==="rollup-plugin-babel"?"throw":"import"),all:o=false}=r;return{log:a,inject:n,all:o}}},3508:(e,t,r)=>{"use strict";t.__esModule=true;t.intersection=intersection;t.has=has;t.resolveKey=resolveKey;t.resolveSource=resolveSource;t.getImportSource=getImportSource;t.getRequireSource=getRequireSource;t.createUtilsGetter=createUtilsGetter;var s=_interopRequireWildcard(r(8304));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:a,template:n}=s.default||s;function intersection(e,t){const r=new Set;e.forEach((e=>t.has(e)&&r.add(e)));return r}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function getType(e){return Object.prototype.toString.call(e).slice(8,-1)}function resolveId(e){if(e.isIdentifier()&&!e.scope.hasBinding(e.node.name,true)){return e.node.name}const{deopt:t}=e.evaluate();if(t&&t.isIdentifier()){return t.node.name}}function resolveKey(e,t=false){const{node:r,parent:s,scope:a}=e;if(e.isStringLiteral())return r.value;const{name:n}=r;const o=e.isIdentifier();if(o&&!(t||s.computed))return n;if(t&&e.isMemberExpression()&&e.get("object").isIdentifier({name:"Symbol"})&&!a.hasBinding("Symbol",true)){const t=resolveKey(e.get("property"),e.node.computed);if(t)return"Symbol."+t}if(!o||a.hasBinding(n,true)){const{value:t}=e.evaluate();if(typeof t==="string")return t}}function resolveSource(e){if(e.isMemberExpression()&&e.get("property").isIdentifier({name:"prototype"})){const t=resolveId(e.get("object"));if(t){return{id:t,placement:"prototype"}}return{id:null,placement:null}}const t=resolveId(e);if(t){return{id:t,placement:"static"}}const{value:r}=e.evaluate();if(r!==undefined){return{id:getType(r),placement:"prototype"}}else if(e.isRegExpLiteral()){return{id:"RegExp",placement:"prototype"}}else if(e.isFunction()){return{id:"Function",placement:"prototype"}}return{id:null,placement:null}}function getImportSource({node:e}){if(e.specifiers.length===0)return e.source.value}function getRequireSource({node:e}){if(!a.isExpressionStatement(e))return;const{expression:t}=e;const r=a.isCallExpression(t)&&a.isIdentifier(t.callee)&&t.callee.name==="require"&&t.arguments.length===1&&a.isStringLiteral(t.arguments[0]);if(r)return t.arguments[0].value}function hoist(e){e._blockHoist=3;return e}function createUtilsGetter(e){return t=>{const r=t.findParent((e=>e.isProgram()));return{injectGlobalImport(t){e.storeAnonymous(r,t,((e,t)=>e?n.statement.ast`require(${t})`:a.importDeclaration([],t)))},injectNamedImport(t,s,o=s){return e.storeNamed(r,t,s,((e,t,s)=>{const i=r.scope.generateUidIdentifier(o);return{node:e?hoist(n.statement.ast` var ${i} = require(${t}).${s} - `):a.importDeclaration([a.importSpecifier(i,s)],t),name:i.name}}))},injectDefaultImport(t,s=t){return e.storeNamed(r,t,"default",((e,t)=>{const o=r.scope.generateUidIdentifier(s);return{node:e?hoist(n.statement.ast`var ${o} = require(${t})`):a.importDeclaration([a.importDefaultSpecifier(o)],t),name:o.name}}))}}}}},1783:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=r(3508);var _default=e=>({ImportDeclaration(t){const r=(0,s.getImportSource)(t);if(!r)return;e({kind:"import",source:r},t)},Program(t){t.get("body").forEach((t=>{const r=(0,s.getRequireSource)(t);if(!r)return;e({kind:"import",source:r},t)}))}});t["default"]=_default},7107:(e,t,r)=>{"use strict";t.__esModule=true;t.entry=t.usage=void 0;var s=_interopRequireDefault(r(8985));t.usage=s.default;var a=_interopRequireDefault(r(1783));t.entry=a.default;function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}},8985:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=r(3508);var _default=e=>{function property(t,r,s,a){return e({kind:"property",object:t,key:r,placement:s},a)}return{ReferencedIdentifier(t){const{node:{name:r},scope:s}=t;if(s.getBindingIdentifier(r))return;e({kind:"global",name:r},t)},MemberExpression(e){const t=(0,s.resolveKey)(e.get("property"),e.node.computed);if(!t||t==="prototype")return;const r=e.get("object");const a=r.scope.getBinding(r.node.name);if(a&&a.path.isImportNamespaceSpecifier())return;const n=(0,s.resolveSource)(r);return property(n.id,t,n.placement,e)},ObjectPattern(e){const{parentPath:t,parent:r}=e;let a;if(t.isVariableDeclarator()){a=t.get("init")}else if(t.isAssignmentExpression()){a=t.get("right")}else if(t.isFunction()){const s=t.parentPath;if(s.isCallExpression()||s.isNewExpression()){if(s.node.callee===r){a=s.get("arguments")[e.key]}}}let n=null;let o=null;if(a)({id:n,placement:o}=(0,s.resolveSource)(a));for(const t of e.get("properties")){if(t.isObjectProperty()){const e=(0,s.resolveKey)(t.get("key"));if(e)property(n,e,o,t)}}},BinaryExpression(t){if(t.node.operator!=="in")return;const r=(0,s.resolveSource)(t.get("right"));const a=(0,s.resolveKey)(t.get("left"),true);if(!a)return;e({kind:"in",object:r.id,key:a,placement:r.placement},t)}}};t["default"]=_default},8828:(e,t,r)=>{e.exports=r(935)},3039:(e,t,r)=>{e.exports=r(4323)},1532:(e,t,r)=>{e.exports=r(8374)},9396:(e,t,r)=>{"use strict";t.__esModule=true;t.CommonInstanceDependencies=t.InstanceProperties=t.StaticProperties=t.BuiltIns=t.PromiseDependenciesWithIterators=t.PromiseDependencies=t.CommonIterators=void 0;var s=_interopRequireDefault(r(8828));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const a={};Object.keys(s.default).forEach(((e,t)=>{a[e]=t}));const define=(e,t,r=t[0],s)=>({name:r,pure:e,global:t.sort(((e,t)=>a[e]-a[t])),exclude:s});const typed=e=>define(null,[e,...c]);const n=["es.array.iterator","web.dom-collections.iterator"];const o=["es.string.iterator",...n];t.CommonIterators=o;const i=["es.object.to-string",...n];const l=["es.object.to-string",...o];const c=["es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.object.to-string","es.array.iterator","es.array-buffer.slice"];const u={from:define(null,["es.typed-array.from"]),of:define(null,["es.typed-array.of"])};const p=["es.promise","es.object.to-string"];t.PromiseDependencies=p;const d=[...p,...o];t.PromiseDependenciesWithIterators=d;const f=["es.symbol","es.symbol.description","es.object.to-string"];const m=["es.map","esnext.map.delete-all","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.includes","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.reduce","esnext.map.some","esnext.map.update",...l];const y=["es.set","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union",...l];const g=["es.weak-map","esnext.weak-map.delete-all",...l];const h=["es.weak-set","esnext.weak-set.add-all","esnext.weak-set.delete-all",...l];const b=["web.url",...l];const x={AggregateError:define("aggregate-error",["esnext.aggregate-error",...o]),ArrayBuffer:define(null,["es.array-buffer.constructor","es.array-buffer.slice","es.object.to-string"]),DataView:define(null,["es.data-view","es.array-buffer.slice","es.object.to-string"]),Date:define(null,["es.date.to-string"]),Float32Array:typed("es.typed-array.float32-array"),Float64Array:typed("es.typed-array.float64-array"),Int8Array:typed("es.typed-array.int8-array"),Int16Array:typed("es.typed-array.int16-array"),Int32Array:typed("es.typed-array.int32-array"),Uint8Array:typed("es.typed-array.uint8-array"),Uint8ClampedArray:typed("es.typed-array.uint8-clamped-array"),Uint16Array:typed("es.typed-array.uint16-array"),Uint32Array:typed("es.typed-array.uint32-array"),Map:define("map/index",m),Number:define(null,["es.number.constructor"]),Observable:define("observable/index",["esnext.observable","esnext.symbol.observable","es.object.to-string",...l]),Promise:define("promise/index",p),RegExp:define(null,["es.regexp.constructor","es.regexp.exec","es.regexp.to-string"]),Set:define("set/index",y),Symbol:define("symbol/index",f),URL:define("url/index",["web.url",...b]),URLSearchParams:define("url-search-params/index",b),WeakMap:define("weak-map/index",g),WeakSet:define("weak-set/index",h),clearImmediate:define("clear-immediate",["web.immediate"]),compositeKey:define("composite-key",["esnext.composite-key"]),compositeSymbol:define("composite-symbol",["esnext.composite-symbol"]),fetch:define(null,p),globalThis:define("global-this",["es.global-this"]),parseFloat:define("parse-float",["es.parse-float"]),parseInt:define("parse-int",["es.parse-int"]),queueMicrotask:define("queue-microtask",["web.queue-microtask"]),setImmediate:define("set-immediate",["web.immediate"]),setInterval:define("set-interval",["web.timers"]),setTimeout:define("set-timeout",["web.timers"])};t.BuiltIns=x;const v={Array:{from:define("array/from",["es.array.from","es.string.iterator"]),isArray:define("array/is-array",["es.array.is-array"]),of:define("array/of",["es.array.of"])},ArrayBuffer:{isView:define(null,["es.array-buffer.is-view"])},Date:{now:define("date/now",["es.date.now"])},JSON:{stringify:define("json/stringify",[],"es.symbol")},Math:{DEG_PER_RAD:define("math/deg-per-rad",["esnext.math.deg-per-rad"]),RAD_PER_DEG:define("math/rad-per-deg",["esnext.math.rad-per-deg"]),acosh:define("math/acosh",["es.math.acosh"]),asinh:define("math/asinh",["es.math.asinh"]),atanh:define("math/atanh",["es.math.atanh"]),cbrt:define("math/cbrt",["es.math.cbrt"]),clamp:define("math/clamp",["esnext.math.clamp"]),clz32:define("math/clz32",["es.math.clz32"]),cosh:define("math/cosh",["es.math.cosh"]),degrees:define("math/degrees",["esnext.math.degrees"]),expm1:define("math/expm1",["es.math.expm1"]),fround:define("math/fround",["es.math.fround"]),fscale:define("math/fscale",["esnext.math.fscale"]),hypot:define("math/hypot",["es.math.hypot"]),iaddh:define("math/iaddh",["esnext.math.iaddh"]),imul:define("math/imul",["es.math.imul"]),imulh:define("math/imulh",["esnext.math.imulh"]),isubh:define("math/isubh",["esnext.math.isubh"]),log10:define("math/log10",["es.math.log10"]),log1p:define("math/log1p",["es.math.log1p"]),log2:define("math/log2",["es.math.log2"]),radians:define("math/radians",["esnext.math.radians"]),scale:define("math/scale",["esnext.math.scale"]),seededPRNG:define("math/seeded-prng",["esnext.math.seeded-prng"]),sign:define("math/sign",["es.math.sign"]),signbit:define("math/signbit",["esnext.math.signbit"]),sinh:define("math/sinh",["es.math.sinh"]),tanh:define("math/tanh",["es.math.tanh"]),trunc:define("math/trunc",["es.math.trunc"]),umulh:define("math/umulh",["esnext.math.umulh"])},Map:{from:define(null,["esnext.map.from",...m]),groupBy:define(null,["esnext.map.group-by",...m]),keyBy:define(null,["esnext.map.key-by",...m]),of:define(null,["esnext.map.of",...m])},Number:{EPSILON:define("number/epsilon",["es.number.epsilon"]),MAX_SAFE_INTEGER:define("number/max-safe-integer",["es.number.max-safe-integer"]),MIN_SAFE_INTEGER:define("number/min-safe-integer",["es.number.min-safe-integer"]),fromString:define("number/from-string",["esnext.number.from-string"]),isFinite:define("number/is-finite",["es.number.is-finite"]),isInteger:define("number/is-integer",["es.number.is-integer"]),isNaN:define("number/is-nan",["es.number.is-nan"]),isSafeInteger:define("number/is-safe-integer",["es.number.is-safe-integer"]),parseFloat:define("number/parse-float",["es.number.parse-float"]),parseInt:define("number/parse-int",["es.number.parse-int"])},Object:{assign:define("object/assign",["es.object.assign"]),create:define("object/create",["es.object.create"]),defineProperties:define("object/define-properties",["es.object.define-properties"]),defineProperty:define("object/define-property",["es.object.define-property"]),entries:define("object/entries",["es.object.entries"]),freeze:define("object/freeze",["es.object.freeze"]),fromEntries:define("object/from-entries",["es.object.from-entries","es.array.iterator"]),getOwnPropertyDescriptor:define("object/get-own-property-descriptor",["es.object.get-own-property-descriptor"]),getOwnPropertyDescriptors:define("object/get-own-property-descriptors",["es.object.get-own-property-descriptors"]),getOwnPropertyNames:define("object/get-own-property-names",["es.object.get-own-property-names"]),getOwnPropertySymbols:define("object/get-own-property-symbols",["es.symbol"]),getPrototypeOf:define("object/get-prototype-of",["es.object.get-prototype-of"]),hasOwn:define("object/has-own",["esnext.object.has-own"]),is:define("object/is",["es.object.is"]),isExtensible:define("object/is-extensible",["es.object.is-extensible"]),isFrozen:define("object/is-frozen",["es.object.is-frozen"]),isSealed:define("object/is-sealed",["es.object.is-sealed"]),keys:define("object/keys",["es.object.keys"]),preventExtensions:define("object/prevent-extensions",["es.object.prevent-extensions"]),seal:define("object/seal",["es.object.seal"]),setPrototypeOf:define("object/set-prototype-of",["es.object.set-prototype-of"]),values:define("object/values",["es.object.values"])},Promise:{all:define(null,d),allSettled:define(null,["es.promise.all-settled",...d]),any:define(null,["esnext.promise.any",...d]),race:define(null,d),try:define(null,["esnext.promise.try",...d])},Reflect:{apply:define("reflect/apply",["es.reflect.apply"]),construct:define("reflect/construct",["es.reflect.construct"]),defineMetadata:define("reflect/define-metadata",["esnext.reflect.define-metadata"]),defineProperty:define("reflect/define-property",["es.reflect.define-property"]),deleteMetadata:define("reflect/delete-metadata",["esnext.reflect.delete-metadata"]),deleteProperty:define("reflect/delete-property",["es.reflect.delete-property"]),get:define("reflect/get",["es.reflect.get"]),getMetadata:define("reflect/get-metadata",["esnext.reflect.get-metadata"]),getMetadataKeys:define("reflect/get-metadata-keys",["esnext.reflect.get-metadata-keys"]),getOwnMetadata:define("reflect/get-own-metadata",["esnext.reflect.get-own-metadata"]),getOwnMetadataKeys:define("reflect/get-own-metadata-keys",["esnext.reflect.get-own-metadata-keys"]),getOwnPropertyDescriptor:define("reflect/get-own-property-descriptor",["es.reflect.get-own-property-descriptor"]),getPrototypeOf:define("reflect/get-prototype-of",["es.reflect.get-prototype-of"]),has:define("reflect/has",["es.reflect.has"]),hasMetadata:define("reflect/has-metadata",["esnext.reflect.has-metadata"]),hasOwnMetadata:define("reflect/has-own-metadata",["esnext.reflect.has-own-metadata"]),isExtensible:define("reflect/is-extensible",["es.reflect.is-extensible"]),metadata:define("reflect/metadata",["esnext.reflect.metadata"]),ownKeys:define("reflect/own-keys",["es.reflect.own-keys"]),preventExtensions:define("reflect/prevent-extensions",["es.reflect.prevent-extensions"]),set:define("reflect/set",["es.reflect.set"]),setPrototypeOf:define("reflect/set-prototype-of",["es.reflect.set-prototype-of"])},Set:{from:define(null,["esnext.set.from",...y]),of:define(null,["esnext.set.of",...y])},String:{fromCodePoint:define("string/from-code-point",["es.string.from-code-point"]),raw:define("string/raw",["es.string.raw"])},Symbol:{asyncIterator:define("symbol/async-iterator",["es.symbol.async-iterator"]),dispose:define("symbol/dispose",["esnext.symbol.dispose"]),for:define("symbol/for",[],"es.symbol"),hasInstance:define("symbol/has-instance",["es.symbol.has-instance","es.function.has-instance"]),isConcatSpreadable:define("symbol/is-concat-spreadable",["es.symbol.is-concat-spreadable","es.array.concat"]),iterator:define("symbol/iterator",["es.symbol.iterator",...l]),keyFor:define("symbol/key-for",[],"es.symbol"),match:define("symbol/match",["es.symbol.match","es.string.match"]),observable:define("symbol/observable",["esnext.symbol.observable"]),patternMatch:define("symbol/pattern-match",["esnext.symbol.pattern-match"]),replace:define("symbol/replace",["es.symbol.replace","es.string.replace"]),search:define("symbol/search",["es.symbol.search","es.string.search"]),species:define("symbol/species",["es.symbol.species","es.array.species"]),split:define("symbol/split",["es.symbol.split","es.string.split"]),toPrimitive:define("symbol/to-primitive",["es.symbol.to-primitive","es.date.to-primitive"]),toStringTag:define("symbol/to-string-tag",["es.symbol.to-string-tag","es.object.to-string","es.math.to-string-tag","es.json.to-string-tag"]),unscopables:define("symbol/unscopables",["es.symbol.unscopables"])},WeakMap:{from:define(null,["esnext.weak-map.from",...g]),of:define(null,["esnext.weak-map.of",...g])},WeakSet:{from:define(null,["esnext.weak-set.from",...h]),of:define(null,["esnext.weak-set.of",...h])},Int8Array:u,Uint8Array:u,Uint8ClampedArray:u,Int16Array:u,Uint16Array:u,Int32Array:u,Uint32Array:u,Float32Array:u,Float64Array:u};t.StaticProperties=v;const E={at:define("instance/at",["esnext.string.at"]),anchor:define(null,["es.string.anchor"]),big:define(null,["es.string.big"]),bind:define("instance/bind",["es.function.bind"]),blink:define(null,["es.string.blink"]),bold:define(null,["es.string.bold"]),codePointAt:define("instance/code-point-at",["es.string.code-point-at"]),codePoints:define("instance/code-points",["esnext.string.code-points"]),concat:define("instance/concat",["es.array.concat"],undefined,["String"]),copyWithin:define("instance/copy-within",["es.array.copy-within"]),description:define(null,["es.symbol","es.symbol.description"]),endsWith:define("instance/ends-with",["es.string.ends-with"]),entries:define("instance/entries",i),every:define("instance/every",["es.array.every"]),exec:define(null,["es.regexp.exec"]),fill:define("instance/fill",["es.array.fill"]),filter:define("instance/filter",["es.array.filter"]),finally:define(null,["es.promise.finally",...p]),find:define("instance/find",["es.array.find"]),findIndex:define("instance/find-index",["es.array.find-index"]),fixed:define(null,["es.string.fixed"]),flags:define("instance/flags",["es.regexp.flags"]),flatMap:define("instance/flat-map",["es.array.flat-map","es.array.unscopables.flat-map"]),flat:define("instance/flat",["es.array.flat"]),fontcolor:define(null,["es.string.fontcolor"]),fontsize:define(null,["es.string.fontsize"]),forEach:define("instance/for-each",["es.array.for-each","web.dom-collections.for-each"]),includes:define("instance/includes",["es.array.includes","es.string.includes"]),indexOf:define("instance/index-of",["es.array.index-of"]),italic:define(null,["es.string.italics"]),join:define(null,["es.array.join"]),keys:define("instance/keys",i),lastIndex:define(null,["esnext.array.last-index"]),lastIndexOf:define("instance/last-index-of",["es.array.last-index-of"]),lastItem:define(null,["esnext.array.last-item"]),link:define(null,["es.string.link"]),map:define("instance/map",["es.array.map"]),match:define(null,["es.string.match","es.regexp.exec"]),matchAll:define("instance/match-all",["es.string.match-all"]),name:define(null,["es.function.name"]),padEnd:define("instance/pad-end",["es.string.pad-end"]),padStart:define("instance/pad-start",["es.string.pad-start"]),reduce:define("instance/reduce",["es.array.reduce"]),reduceRight:define("instance/reduce-right",["es.array.reduce-right"]),repeat:define("instance/repeat",["es.string.repeat"]),replace:define(null,["es.string.replace","es.regexp.exec"]),replaceAll:define("instance/replace-all",["esnext.string.replace-all"]),reverse:define("instance/reverse",["es.array.reverse"]),search:define(null,["es.string.search","es.regexp.exec"]),slice:define("instance/slice",["es.array.slice"]),small:define(null,["es.string.small"]),some:define("instance/some",["es.array.some"]),sort:define("instance/sort",["es.array.sort"]),splice:define("instance/splice",["es.array.splice"]),split:define(null,["es.string.split","es.regexp.exec"]),startsWith:define("instance/starts-with",["es.string.starts-with"]),strike:define(null,["es.string.strike"]),sub:define(null,["es.string.sub"]),sup:define(null,["es.string.sup"]),toFixed:define(null,["es.number.to-fixed"]),toISOString:define(null,["es.date.to-iso-string"]),toJSON:define(null,["es.date.to-json","web.url.to-json"]),toPrecision:define(null,["es.number.to-precision"]),toString:define(null,["es.object.to-string","es.regexp.to-string","es.date.to-string"]),trim:define("instance/trim",["es.string.trim"]),trimEnd:define("instance/trim-end",["es.string.trim-end"]),trimLeft:define("instance/trim-left",["es.string.trim-start"]),trimRight:define("instance/trim-right",["es.string.trim-end"]),trimStart:define("instance/trim-start",["es.string.trim-start"]),values:define("instance/values",i),__defineGetter__:define(null,["es.object.define-getter"]),__defineSetter__:define(null,["es.object.define-setter"]),__lookupGetter__:define(null,["es.object.lookup-getter"]),__lookupSetter__:define(null,["es.object.lookup-setter"])};t.InstanceProperties=E;const j=new Set(["es.object.to-string","es.object.define-getter","es.object.define-setter","es.object.lookup-getter","es.object.lookup-setter","es.regexp.exec"]);t.CommonInstanceDependencies=j},5825:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireDefault(r(8828));var a=_interopRequireDefault(r(6265));var n=_interopRequireDefault(r(1532));var o=r(9396);var i=_interopRequireWildcard(r(8304));var l=r(8520);var c=_interopRequireDefault(r(8038));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _extends(){_extends=Object.assign||function(e){for(var t=1;t{if(t(e))return true;if(!e.startsWith("es."))return false;const r=`esnext.${e.slice(3)}`;if(!s.default[r])return false;return t(r)};var d=(0,c.default)((function({getUtils:e,method:t,shouldInjectPolyfill:r,createMetaResolver:i,debug:c,babel:d},{version:f=3,proposals:m,shippedProposals:y,[p]:{useBabelRuntime:g,ext:h=".js"}={}}){const b=d.caller((e=>(e==null?void 0:e.name)==="babel-loader"));const x=i({global:o.BuiltIns,static:o.StaticProperties,instance:o.InstanceProperties});const v=new Set((0,n.default)(f));const E=g?m?`${g}/core-js`:`${g}/core-js-stable`:m?"core-js-pure/features":"core-js-pure/stable";function maybeInjectGlobalImpl(e,t){if(r(e)){c(e);t.injectGlobalImport((0,l.coreJSModule)(e));return true}return false}function maybeInjectGlobal(e,t,r=true){for(const s of e){if(r){esnextFallback(s,(e=>maybeInjectGlobalImpl(e,t)))}else{maybeInjectGlobalImpl(s,t)}}}function maybeInjectPure(e,t,s,a){if(e.pure&&!(a&&e.exclude&&e.exclude.includes(a))&&esnextFallback(e.name,r)){return s.injectDefaultImport(`${E}/${e.pure}${h}`,t)}}return{name:"corejs3",polyfills:s.default,filterPolyfills(e){if(!v.has(e))return false;if(m||t==="entry-global")return true;if(y&&a.default.has(e)){return true}return!e.startsWith("esnext.")},entryGlobal(e,t,s){if(e.kind!=="import")return;const a=(0,l.isCoreJSSource)(e.source);if(!a)return;if(a.length===1&&e.source===(0,l.coreJSModule)(a[0])&&r(a[0])){c(null);return}maybeInjectGlobal(a,t,false);s.remove()},usageGlobal(e,t){const r=x(e);if(!r)return;let s=r.desc.global;if(r.kind!=="global"&&e.object&&e.placement==="prototype"){const t=e.object.toLowerCase();s=s.filter((e=>e.includes(t)||o.CommonInstanceDependencies.has(e)))}maybeInjectGlobal(s,t)},usagePure(e,t,s){if(e.kind==="in"){if(e.key==="Symbol.iterator"){s.replaceWith(u.callExpression(t.injectDefaultImport((0,l.coreJSPureHelper)("is-iterable",g,h),"isIterable"),[s.node.right]))}return}if(s.parentPath.isUnaryExpression({operator:"delete"}))return;let a;if(e.kind==="property"){if(!s.isMemberExpression())return;if(!s.isReferenced())return;a=s.parentPath.isCallExpression({callee:s.node});if(e.key==="Symbol.iterator"){if(!r("es.symbol.iterator"))return;if(a){if(s.parent.arguments.length===0){s.parentPath.replaceWith(u.callExpression(t.injectDefaultImport((0,l.coreJSPureHelper)("get-iterator",g,h),"getIterator"),[s.node.object]));s.skip()}else{(0,l.callMethod)(s,t.injectDefaultImport((0,l.coreJSPureHelper)("get-iterator-method",g,h),"getIteratorMethod"))}}else{s.replaceWith(u.callExpression(t.injectDefaultImport((0,l.coreJSPureHelper)("get-iterator-method",g,h),"getIteratorMethod"),[s.node.object]))}return}}let n=x(e);if(!n)return;if(g&&n.desc.pure&&n.desc.pure.slice(-6)==="/index"){n=_extends({},n,{desc:_extends({},n.desc,{pure:n.desc.pure.slice(0,-6)})})}if(n.kind==="global"){const e=maybeInjectPure(n.desc,n.name,t);if(e)s.replaceWith(e)}else if(n.kind==="static"){const r=maybeInjectPure(n.desc,n.name,t,e.object);if(r)s.replaceWith(r)}else if(n.kind==="instance"){const r=maybeInjectPure(n.desc,`${n.name}InstanceProperty`,t,e.object);if(!r)return;if(a){(0,l.callMethod)(s,r)}else{s.replaceWith(u.callExpression(r,[s.node.object]))}}},visitor:t==="usage-global"&&{CallExpression(t){if(t.get("callee").isImport()){const r=e(t);if(b){maybeInjectGlobal(o.PromiseDependenciesWithIterators,r)}else{maybeInjectGlobal(o.PromiseDependencies,r)}}},Function(t){if(t.node.async){maybeInjectGlobal(o.PromiseDependencies,e(t))}},"ForOfStatement|ArrayPattern"(t){maybeInjectGlobal(o.CommonIterators,e(t))},SpreadElement(t){if(!t.parentPath.isObjectExpression()){maybeInjectGlobal(o.CommonIterators,e(t))}},YieldExpression(t){if(t.node.delegate){maybeInjectGlobal(o.CommonIterators,e(t))}}}}}));t["default"]=d},6265:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;var r=new Set(["esnext.global-this","esnext.string.match-all"]);t["default"]=r},8520:(e,t,r)=>{"use strict";t.__esModule=true;t.callMethod=callMethod;t.isCoreJSSource=isCoreJSSource;t.coreJSModule=coreJSModule;t.coreJSPureHelper=coreJSPureHelper;var s=_interopRequireWildcard(r(8304));var a=_interopRequireDefault(r(3039));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:n}=s.default||s;function callMethod(e,t){const{object:r}=e.node;let s,a;if(n.isIdentifier(r)){s=r;a=n.cloneNode(r)}else{s=e.scope.generateDeclaredUidIdentifier("context");a=n.assignmentExpression("=",n.cloneNode(s),r)}e.replaceWith(n.memberExpression(n.callExpression(t,[a]),n.identifier("call")));e.parentPath.unshiftContainer("arguments",s)}function isCoreJSSource(e){if(typeof e==="string"){e=e.replace(/\\/g,"/").replace(/(\/(index)?)?(\.js)?$/i,"").toLowerCase()}return hasOwnProperty.call(a.default,e)&&a.default[e]}function coreJSModule(e){return`core-js/modules/${e}.js`}function coreJSPureHelper(e,t,r){return t?`${t}/core-js/${e}${r}`:`core-js-pure/features/${e}.js`}},8374:(e,t,r)=>{"use strict";const{compare:s,intersection:a,semver:n}=r(2732);const o=r(4970);const i=r(2885);e.exports=function(e){const t=n(e);if(t.major!==3){throw RangeError("This version of `core-js-compat` works only with `core-js@3`.")}const r=[];for(const e of Object.keys(o)){if(s(e,"<=",t)){r.push(...o[e])}}return a(r,i)}},2732:(e,t,r)=>{"use strict";const s=r(3464);const a=r(6784);const n=Function.call.bind({}.hasOwnProperty);function compare(e,t,r){return s(a(e),t,a(r))}function intersection(e,t){const r=e instanceof Set?e:new Set(e);return t.filter((e=>r.has(e)))}function sortObjectByKey(e,t){return Object.keys(e).sort(t).reduce(((t,r)=>{t[r]=e[r];return t}),{})}e.exports={compare:compare,has:n,intersection:intersection,semver:a,sortObjectByKey:sortObjectByKey}},5620:(e,t,r)=>{const s=r(6766);const{MAX_LENGTH:a,MAX_SAFE_INTEGER:n}=r(6648);const{re:o,t:i}=r(3567);const{compareIdentifiers:l}=r(6736);class SemVer{constructor(e,t){if(!t||typeof t!=="object"){t={loose:!!t,includePrerelease:false}}if(e instanceof SemVer){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease){return e}else{e=e.version}}else if(typeof e!=="string"){throw new TypeError(`Invalid Version: ${e}`)}if(e.length>a){throw new TypeError(`version is longer than ${a} characters`)}s("SemVer",e,t);this.options=t;this.loose=!!t.loose;this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?o[i.LOOSE]:o[i.FULL]);if(!r){throw new TypeError(`Invalid Version: ${e}`)}this.raw=e;this.major=+r[1];this.minor=+r[2];this.patch=+r[3];if(this.major>n||this.major<0){throw new TypeError("Invalid major version")}if(this.minor>n||this.minor<0){throw new TypeError("Invalid minor version")}if(this.patch>n||this.patch<0){throw new TypeError("Invalid patch version")}if(!r[4]){this.prerelease=[]}else{this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0){if(typeof this.prerelease[e]==="number"){this.prerelease[e]++;e=-2}}if(e===-1){this.prerelease.push(0)}}if(t){if(this.prerelease[0]===t){if(isNaN(this.prerelease[1])){this.prerelease=[t,0]}}else{this.prerelease=[t,0]}}break;default:throw new Error(`invalid increment argument: ${e}`)}this.format();this.raw=this.version;return this}}e.exports=SemVer},3464:(e,t,r)=>{const s=r(1673);const a=r(532);const n=r(3547);const o=r(5478);const i=r(5401);const l=r(2568);const cmp=(e,t,r,c)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return s(e,r,c);case"!=":return a(e,r,c);case">":return n(e,r,c);case">=":return o(e,r,c);case"<":return i(e,r,c);case"<=":return l(e,r,c);default:throw new TypeError(`Invalid operator: ${t}`)}};e.exports=cmp},6784:(e,t,r)=>{const s=r(5620);const a=r(5032);const{re:n,t:o}=r(3567);const coerce=(e,t)=>{if(e instanceof s){return e}if(typeof e==="number"){e=String(e)}if(typeof e!=="string"){return null}t=t||{};let r=null;if(!t.rtl){r=e.match(n[o.COERCE])}else{let t;while((t=n[o.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||t.index+t[0].length!==r.index+r[0].length){r=t}n[o.COERCERTL].lastIndex=t.index+t[1].length+t[2].length}n[o.COERCERTL].lastIndex=-1}if(r===null)return null;return a(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};e.exports=coerce},8796:(e,t,r)=>{const s=r(5620);const compare=(e,t,r)=>new s(e,r).compare(new s(t,r));e.exports=compare},1673:(e,t,r)=>{const s=r(8796);const eq=(e,t,r)=>s(e,t,r)===0;e.exports=eq},3547:(e,t,r)=>{const s=r(8796);const gt=(e,t,r)=>s(e,t,r)>0;e.exports=gt},5478:(e,t,r)=>{const s=r(8796);const gte=(e,t,r)=>s(e,t,r)>=0;e.exports=gte},5401:(e,t,r)=>{const s=r(8796);const lt=(e,t,r)=>s(e,t,r)<0;e.exports=lt},2568:(e,t,r)=>{const s=r(8796);const lte=(e,t,r)=>s(e,t,r)<=0;e.exports=lte},532:(e,t,r)=>{const s=r(8796);const neq=(e,t,r)=>s(e,t,r)!==0;e.exports=neq},5032:(e,t,r)=>{const{MAX_LENGTH:s}=r(6648);const{re:a,t:n}=r(3567);const o=r(5620);const parse=(e,t)=>{if(!t||typeof t!=="object"){t={loose:!!t,includePrerelease:false}}if(e instanceof o){return e}if(typeof e!=="string"){return null}if(e.length>s){return null}const r=t.loose?a[n.LOOSE]:a[n.FULL];if(!r.test(e)){return null}try{return new o(e,t)}catch(e){return null}};e.exports=parse},6648:e=>{const t="2.0.0";const r=256;const s=Number.MAX_SAFE_INTEGER||9007199254740991;const a=16;e.exports={SEMVER_SPEC_VERSION:t,MAX_LENGTH:r,MAX_SAFE_INTEGER:s,MAX_SAFE_COMPONENT_LENGTH:a}},6766:e=>{const t=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},6736:e=>{const t=/^[0-9]+$/;const compareIdentifiers=(e,r)=>{const s=t.test(e);const a=t.test(r);if(s&&a){e=+e;r=+r}return e===r?0:s&&!a?-1:a&&!s?1:ecompareIdentifiers(t,e);e.exports={compareIdentifiers:compareIdentifiers,rcompareIdentifiers:rcompareIdentifiers}},3567:(e,t,r)=>{const{MAX_SAFE_COMPONENT_LENGTH:s}=r(6648);const a=r(6766);t=e.exports={};const n=t.re=[];const o=t.src=[];const i=t.t={};let l=0;const createToken=(e,t,r)=>{const s=l++;a(s,t);i[e]=s;o[s]=t;n[s]=new RegExp(t,r?"g":undefined)};createToken("NUMERICIDENTIFIER","0|[1-9]\\d*");createToken("NUMERICIDENTIFIERLOOSE","[0-9]+");createToken("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*");createToken("MAINVERSION",`(${o[i.NUMERICIDENTIFIER]})\\.`+`(${o[i.NUMERICIDENTIFIER]})\\.`+`(${o[i.NUMERICIDENTIFIER]})`);createToken("MAINVERSIONLOOSE",`(${o[i.NUMERICIDENTIFIERLOOSE]})\\.`+`(${o[i.NUMERICIDENTIFIERLOOSE]})\\.`+`(${o[i.NUMERICIDENTIFIERLOOSE]})`);createToken("PRERELEASEIDENTIFIER",`(?:${o[i.NUMERICIDENTIFIER]}|${o[i.NONNUMERICIDENTIFIER]})`);createToken("PRERELEASEIDENTIFIERLOOSE",`(?:${o[i.NUMERICIDENTIFIERLOOSE]}|${o[i.NONNUMERICIDENTIFIER]})`);createToken("PRERELEASE",`(?:-(${o[i.PRERELEASEIDENTIFIER]}(?:\\.${o[i.PRERELEASEIDENTIFIER]})*))`);createToken("PRERELEASELOOSE",`(?:-?(${o[i.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[i.PRERELEASEIDENTIFIERLOOSE]})*))`);createToken("BUILDIDENTIFIER","[0-9A-Za-z-]+");createToken("BUILD",`(?:\\+(${o[i.BUILDIDENTIFIER]}(?:\\.${o[i.BUILDIDENTIFIER]})*))`);createToken("FULLPLAIN",`v?${o[i.MAINVERSION]}${o[i.PRERELEASE]}?${o[i.BUILD]}?`);createToken("FULL",`^${o[i.FULLPLAIN]}$`);createToken("LOOSEPLAIN",`[v=\\s]*${o[i.MAINVERSIONLOOSE]}${o[i.PRERELEASELOOSE]}?${o[i.BUILD]}?`);createToken("LOOSE",`^${o[i.LOOSEPLAIN]}$`);createToken("GTLT","((?:<|>)?=?)");createToken("XRANGEIDENTIFIERLOOSE",`${o[i.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);createToken("XRANGEIDENTIFIER",`${o[i.NUMERICIDENTIFIER]}|x|X|\\*`);createToken("XRANGEPLAIN",`[v=\\s]*(${o[i.XRANGEIDENTIFIER]})`+`(?:\\.(${o[i.XRANGEIDENTIFIER]})`+`(?:\\.(${o[i.XRANGEIDENTIFIER]})`+`(?:${o[i.PRERELEASE]})?${o[i.BUILD]}?`+`)?)?`);createToken("XRANGEPLAINLOOSE",`[v=\\s]*(${o[i.XRANGEIDENTIFIERLOOSE]})`+`(?:\\.(${o[i.XRANGEIDENTIFIERLOOSE]})`+`(?:\\.(${o[i.XRANGEIDENTIFIERLOOSE]})`+`(?:${o[i.PRERELEASELOOSE]})?${o[i.BUILD]}?`+`)?)?`);createToken("XRANGE",`^${o[i.GTLT]}\\s*${o[i.XRANGEPLAIN]}$`);createToken("XRANGELOOSE",`^${o[i.GTLT]}\\s*${o[i.XRANGEPLAINLOOSE]}$`);createToken("COERCE",`${"(^|[^\\d])"+"(\\d{1,"}${s}})`+`(?:\\.(\\d{1,${s}}))?`+`(?:\\.(\\d{1,${s}}))?`+`(?:$|[^\\d])`);createToken("COERCERTL",o[i.COERCE],true);createToken("LONETILDE","(?:~>?)");createToken("TILDETRIM",`(\\s*)${o[i.LONETILDE]}\\s+`,true);t.tildeTrimReplace="$1~";createToken("TILDE",`^${o[i.LONETILDE]}${o[i.XRANGEPLAIN]}$`);createToken("TILDELOOSE",`^${o[i.LONETILDE]}${o[i.XRANGEPLAINLOOSE]}$`);createToken("LONECARET","(?:\\^)");createToken("CARETTRIM",`(\\s*)${o[i.LONECARET]}\\s+`,true);t.caretTrimReplace="$1^";createToken("CARET",`^${o[i.LONECARET]}${o[i.XRANGEPLAIN]}$`);createToken("CARETLOOSE",`^${o[i.LONECARET]}${o[i.XRANGEPLAINLOOSE]}$`);createToken("COMPARATORLOOSE",`^${o[i.GTLT]}\\s*(${o[i.LOOSEPLAIN]})$|^$`);createToken("COMPARATOR",`^${o[i.GTLT]}\\s*(${o[i.FULLPLAIN]})$|^$`);createToken("COMPARATORTRIM",`(\\s*)${o[i.GTLT]}\\s*(${o[i.LOOSEPLAIN]}|${o[i.XRANGEPLAIN]})`,true);t.comparatorTrimReplace="$1$2$3";createToken("HYPHENRANGE",`^\\s*(${o[i.XRANGEPLAIN]})`+`\\s+-\\s+`+`(${o[i.XRANGEPLAIN]})`+`\\s*$`);createToken("HYPHENRANGELOOSE",`^\\s*(${o[i.XRANGEPLAINLOOSE]})`+`\\s+-\\s+`+`(${o[i.XRANGEPLAINLOOSE]})`+`\\s*$`);createToken("STAR","(<|>)?=?\\s*\\*")},7973:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireDefault(r(8038));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const a="#__secret_key__@babel/runtime__compatibility";var n=(0,s.default)((({debug:e},t)=>{const{[a]:{useBabelRuntime:r}={}}=t;const s=r?`${r}/regenerator`:"regenerator-runtime";return{name:"regenerator",polyfills:["regenerator-runtime"],usageGlobal(t,r){if(isRegenerator(t)){e("regenerator-runtime");r.injectGlobalImport("regenerator-runtime/runtime.js")}},usagePure(e,t,r){if(isRegenerator(e)){r.replaceWith(t.injectDefaultImport(s,"regenerator-runtime"))}}}}));t["default"]=n;const isRegenerator=e=>e.kind==="global"&&e.name==="regeneratorRuntime"},9485:(e,t,r)=>{var s=r(3818);s.core=r(3011);s.isCore=r(7320);s.sync=r(7252);e.exports=s},3818:(e,t,r)=>{var s=r(7147);var a=r(1017);var n=r(4029);var o=r(1177);var i=r(607);var l=r(8746);var c=s.realpath&&typeof s.realpath.native==="function"?s.realpath.native:s.realpath;var u=function isFile(e,t){s.stat(e,(function(e,r){if(!e){return t(null,r.isFile()||r.isFIFO())}if(e.code==="ENOENT"||e.code==="ENOTDIR")return t(null,false);return t(e)}))};var p=function isDirectory(e,t){s.stat(e,(function(e,r){if(!e){return t(null,r.isDirectory())}if(e.code==="ENOENT"||e.code==="ENOTDIR")return t(null,false);return t(e)}))};var d=function realpath(e,t){c(e,(function(r,s){if(r&&r.code!=="ENOENT")t(r);else t(null,r?e:s)}))};var f=function maybeRealpath(e,t,r,s){if(r&&r.preserveSymlinks===false){e(t,s)}else{s(null,t)}};var m=function defaultReadPackage(e,t,r){e(t,(function(e,t){if(e)r(e);else{try{var s=JSON.parse(t);r(null,s)}catch(e){r(null)}}}))};var y=function getPackageCandidates(e,t,r){var s=o(t,r,e);for(var n=0;n{e.exports=function(){var e=Error.prepareStackTrace;Error.prepareStackTrace=function(e,t){return t};var t=(new Error).stack;Error.prepareStackTrace=e;return t[2].getFileName()}},3011:(e,t,r)=>{var s=process.versions&&process.versions.node&&process.versions.node.split(".")||[];function specifierIncluded(e){var t=e.split(" ");var r=t.length>1?t[0]:"=";var a=(t.length>1?t[1]:t[0]).split(".");for(var n=0;n<3;++n){var o=parseInt(s[n]||0,10);var i=parseInt(a[n]||0,10);if(o===i){continue}if(r==="<"){return o="){return o>=i}else{return false}}return r===">="}function matchesRange(e){var t=e.split(/ ?&& ?/);if(t.length===0){return false}for(var r=0;r{var s=r(8746);e.exports=function isCore(e){return s(e)}},1177:(e,t,r)=>{var s=r(1017);var a=s.parse||r(2742);var n=function getNodeModulesDirs(e,t){var r="/";if(/^([A-Za-z]:)/.test(e)){r=""}else if(/^\\\\/.test(e)){r="\\\\"}var n=[e];var o=a(e);while(o.dir!==n[n.length-1]){n.push(o.dir);o=a(o.dir)}return n.reduce((function(e,a){return e.concat(t.map((function(e){return s.resolve(r,a,e)})))}),[])};e.exports=function nodeModulesPaths(e,t,r){var s=t&&t.moduleDirectory?[].concat(t.moduleDirectory):["node_modules"];if(t&&typeof t.paths==="function"){return t.paths(r,e,(function(){return n(e,s)}),t)}var a=n(e,s);return t&&t.paths?a.concat(t.paths):a}},607:e=>{e.exports=function(e,t){return t||{}}},7252:(e,t,r)=>{var s=r(8746);var a=r(7147);var n=r(1017);var o=r(4029);var i=r(1177);var l=r(607);var c=a.realpathSync&&typeof a.realpathSync.native==="function"?a.realpathSync.native:a.realpathSync;var u=function isFile(e){try{var t=a.statSync(e)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return false;throw e}return t.isFile()||t.isFIFO()};var p=function isDirectory(e){try{var t=a.statSync(e)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return false;throw e}return t.isDirectory()};var d=function realpathSync(e){try{return c(e)}catch(e){if(e.code!=="ENOENT"){throw e}}return e};var f=function maybeRealpathSync(e,t,r){if(r&&r.preserveSymlinks===false){return e(t)}return t};var m=function defaultReadPackageSync(e,t){var r=e(t);try{var s=JSON.parse(r);return s}catch(e){}};var y=function getPackageCandidates(e,t,r){var s=i(t,r,e);for(var a=0;a{"use strict";e.exports=require("assert")},7147:e=>{"use strict";e.exports=require("fs")},8188:e=>{"use strict";e.exports=require("module")},8304:e=>{"use strict";e.exports=require("next/dist/compiled/babel/core")},6949:e=>{"use strict";e.exports=require("next/dist/compiled/babel/parser")},7369:e=>{"use strict";e.exports=require("next/dist/compiled/babel/traverse")},8622:e=>{"use strict";e.exports=require("next/dist/compiled/babel/types")},4907:e=>{"use strict";e.exports=require("next/dist/compiled/browserslist")},8542:e=>{"use strict";e.exports=require("next/dist/compiled/chalk")},7849:e=>{"use strict";e.exports=require("next/dist/compiled/semver")},1017:e=>{"use strict";e.exports=require("path")},3837:e=>{"use strict";e.exports=require("util")},1267:e=>{"use strict";e.exports=require("worker_threads")},614:(e,t,r)=>{function _classPrivateFieldGet(e,t){var r=_classExtractFieldDescriptor(e,t,"get");return _classApplyDescriptorGet(e,r)}function _classApplyDescriptorGet(e,t){if(t.get){return t.get.call(e)}return t.value}function _classPrivateFieldSet(e,t,r){var s=_classExtractFieldDescriptor(e,t,"set");_classApplyDescriptorSet(e,s,r);return r}function _classExtractFieldDescriptor(e,t,r){if(!t.has(e)){throw new TypeError("attempted to "+r+" private field on non-instance")}return t.get(e)}function _classApplyDescriptorSet(e,t,r){if(t.set){t.set.call(e,r)}else{if(!t.writable){throw new TypeError("attempted to set read only private field")}t.value=r}}const s=r(6007);const{Definition:a}=r(665);const n=r(4162);const o=r(4585);const{getKeys:i}=r(1498);let l;function getVisitorValues(e,t){if(l)return l[e];const{FLOW_FLIPPED_ALIAS_KEYS:r,VISITOR_KEYS:s}=t.getTypesInfo();const a=r.concat(["ArrayPattern","ClassDeclaration","ClassExpression","FunctionDeclaration","FunctionExpression","Identifier","ObjectPattern","RestElement"]);l=Object.entries(s).reduce(((e,[t,r])=>{if(!a.includes(r)){e[t]=r}return e}),{});return l[e]}const c={callProperties:{type:"loop",values:["value"]},indexers:{type:"loop",values:["key","value"]},properties:{type:"loop",values:["argument","value"]},types:{type:"loop"},params:{type:"loop"},argument:{type:"single"},elementType:{type:"single"},qualification:{type:"single"},rest:{type:"single"},returnType:{type:"single"},typeAnnotation:{type:"typeAnnotation"},typeParameters:{type:"typeParameters"},id:{type:"id"}};class PatternVisitor extends n{ArrayPattern(e){e.elements.forEach(this.visit,this)}ObjectPattern(e){e.properties.forEach(this.visit,this)}}var u=new WeakMap;class Referencer extends o{constructor(e,t,r){super(e,t);u.set(this,{writable:true,value:void 0});_classPrivateFieldSet(this,u,r)}visitPattern(e,t,r){if(!e){return}this._checkIdentifierOrVisit(e.typeAnnotation);if(e.type==="AssignmentPattern"){this._checkIdentifierOrVisit(e.left.typeAnnotation)}if(typeof t==="function"){r=t;t={processRightHandNodes:false}}const s=new PatternVisitor(this.options,e,r);s.visit(e);if(t.processRightHandNodes){s.rightHandNodes.forEach(this.visit,this)}}visitClass(e){this._visitArray(e.decorators);const t=this._nestTypeParamScope(e);this._visitTypeAnnotation(e.implements);this._visitTypeAnnotation(e.superTypeParameters&&e.superTypeParameters.params);super.visitClass(e);if(t){this.close(e)}}visitFunction(e){const t=this._nestTypeParamScope(e);this._checkIdentifierOrVisit(e.returnType);super.visitFunction(e);if(t){this.close(e)}}visitProperty(e){var t;if(((t=e.value)==null?void 0:t.type)==="TypeCastExpression"){this._visitTypeAnnotation(e.value)}this._visitArray(e.decorators);super.visitProperty(e)}InterfaceDeclaration(e){this._createScopeVariable(e,e.id);const t=this._nestTypeParamScope(e);this._visitArray(e.extends);this.visit(e.body);if(t){this.close(e)}}TypeAlias(e){this._createScopeVariable(e,e.id);const t=this._nestTypeParamScope(e);this.visit(e.right);if(t){this.close(e)}}ClassProperty(e){this._visitClassProperty(e)}ClassPrivateProperty(e){this._visitClassProperty(e)}PropertyDefinition(e){this._visitClassProperty(e)}ClassPrivateMethod(e){super.MethodDefinition(e)}DeclareModule(e){this._visitDeclareX(e)}DeclareFunction(e){this._visitDeclareX(e)}DeclareVariable(e){this._visitDeclareX(e)}DeclareClass(e){this._visitDeclareX(e)}OptionalMemberExpression(e){super.MemberExpression(e)}_visitClassProperty(e){this._visitTypeAnnotation(e.typeAnnotation);this.visitProperty(e)}_visitDeclareX(e){if(e.id){this._createScopeVariable(e,e.id)}const t=this._nestTypeParamScope(e);if(t){this.close(e)}}_createScopeVariable(e,t){this.currentScope().variableScope.__define(t,new a("Variable",t,e,null,null,null))}_nestTypeParamScope(e){if(!e.typeParameters){return null}const t=this.scopeManager.__currentScope;const r=new s.Scope(this.scopeManager,"type-parameters",t,e,false);this.scopeManager.__nestScope(r);for(let t=0;t{var s,a,n,o,i,l;function _classStaticPrivateFieldSpecSet(e,t,r,s){_classCheckPrivateStaticAccess(e,t);_classCheckPrivateStaticFieldDescriptor(r,"set");_classApplyDescriptorSet(e,r,s);return s}function _classStaticPrivateFieldSpecGet(e,t,r){_classCheckPrivateStaticAccess(e,t);_classCheckPrivateStaticFieldDescriptor(r,"get");return _classApplyDescriptorGet(e,r)}function _classCheckPrivateStaticFieldDescriptor(e,t){if(e===undefined){throw new TypeError("attempted to "+t+" private static field before its declaration")}}function _classCheckPrivateStaticAccess(e,t){if(e!==t){throw new TypeError("Private static access of wrong provenance")}}function _classPrivateFieldGet(e,t){var r=_classExtractFieldDescriptor(e,t,"get");return _classApplyDescriptorGet(e,r)}function _classApplyDescriptorGet(e,t){if(t.get){return t.get.call(e)}return t.value}function _classPrivateFieldSet(e,t,r){var s=_classExtractFieldDescriptor(e,t,"set");_classApplyDescriptorSet(e,s,r);return r}function _classExtractFieldDescriptor(e,t,r){if(!t.has(e)){throw new TypeError("attempted to "+r+" private field on non-instance")}return t.get(e)}function _classApplyDescriptorSet(e,t,r){if(t.set){t.set.call(e,r)}else{if(!t.writable){throw new TypeError("attempted to set read only private field")}t.value=r}}const c=r(1017);const u={GET_VERSION:"GET_VERSION",GET_TYPES_INFO:"GET_TYPES_INFO",GET_VISITOR_KEYS:"GET_VISITOR_KEYS",GET_TOKEN_LABELS:"GET_TOKEN_LABELS",MAYBE_PARSE:"MAYBE_PARSE",MAYBE_PARSE_SYNC:"MAYBE_PARSE_SYNC"};var p=new WeakMap;var d=new WeakMap;var f=new WeakMap;var m=new WeakMap;var y=new WeakMap;class Client{constructor(e){p.set(this,{writable:true,value:void 0});d.set(this,{writable:true,value:void 0});f.set(this,{writable:true,value:void 0});m.set(this,{writable:true,value:void 0});y.set(this,{writable:true,value:void 0});_classPrivateFieldSet(this,p,e)}getVersion(){var e;return(e=_classPrivateFieldGet(this,d))!=null?e:_classPrivateFieldSet(this,d,_classPrivateFieldGet(this,p).call(this,u.GET_VERSION,undefined))}getTypesInfo(){var e;return(e=_classPrivateFieldGet(this,f))!=null?e:_classPrivateFieldSet(this,f,_classPrivateFieldGet(this,p).call(this,u.GET_TYPES_INFO,undefined))}getVisitorKeys(){var e;return(e=_classPrivateFieldGet(this,m))!=null?e:_classPrivateFieldSet(this,m,_classPrivateFieldGet(this,p).call(this,u.GET_VISITOR_KEYS,undefined))}getTokLabels(){var e;return(e=_classPrivateFieldGet(this,y))!=null?e:_classPrivateFieldSet(this,y,_classPrivateFieldGet(this,p).call(this,u.GET_TOKEN_LABELS,undefined))}maybeParse(e,t){return _classPrivateFieldGet(this,p).call(this,u.MAYBE_PARSE,{code:e,options:t})}}t.WorkerClient=(o=(a=new WeakMap,n=new WeakMap,s=class WorkerClient extends Client{constructor(){super(((e,t)=>{_classPrivateFieldGet(this,n)[0]=0;const r=new(_classStaticPrivateFieldSpecGet(WorkerClient,s,i).MessageChannel);_classPrivateFieldGet(this,a).postMessage({signal:_classPrivateFieldGet(this,n),port:r.port1,action:e,payload:t},[r.port1]);Atomics.wait(_classPrivateFieldGet(this,n),0,0);const{message:o}=_classStaticPrivateFieldSpecGet(WorkerClient,s,i).receiveMessageOnPort(r.port2);if(o.error)throw Object.assign(o.error,o.errorData);else return o.result}));a.set(this,{writable:true,value:new(_classStaticPrivateFieldSpecGet(WorkerClient,s,i).Worker)(c.resolve(__dirname,"../lib/worker/index.cjs"),{env:_classStaticPrivateFieldSpecGet(WorkerClient,s,i).SHARE_ENV})});n.set(this,{writable:true,value:new Int32Array(new SharedArrayBuffer(4))});_classPrivateFieldGet(this,a).unref()}}),i={get:_get_worker_threads,set:void 0},l={writable:true,value:void 0},o);function _get_worker_threads(){var e;return(e=_classStaticPrivateFieldSpecGet(s,s,l))!=null?e:_classStaticPrivateFieldSpecSet(s,s,l,r(1267))}{var g,h,b;t.LocalClient=(h=g=class LocalClient extends Client{constructor(){var e;(e=_classStaticPrivateFieldSpecGet(LocalClient,g,b))!=null?e:_classStaticPrivateFieldSpecSet(LocalClient,g,b,r(2100));super(((e,t)=>_classStaticPrivateFieldSpecGet(LocalClient,g,b).call(LocalClient,e===u.MAYBE_PARSE?u.MAYBE_PARSE_SYNC:e,t)))}},b={writable:true,value:void 0},h)}},244:(e,t)=>{const r=["babelOptions","ecmaVersion","sourceType","allowImportExportEverywhere","requireConfigFile"];function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var r={};var s=Object.keys(e);var a,n;for(n=0;n=0)continue;r[a]=e[a]}return r}t.normalizeESLintConfig=function(e){const{babelOptions:t={},ecmaVersion:s=2020,sourceType:a="module",allowImportExportEverywhere:n=false,requireConfigFile:o=true}=e,i=_objectWithoutPropertiesLoose(e,r);return Object.assign({babelOptions:Object.assign({cwd:process.cwd()},t),ecmaVersion:s,sourceType:a,allowImportExportEverywhere:n,requireConfigFile:o},i)}},1527:e=>{function*it(e){if(Array.isArray(e))yield*e;else yield e}function traverse(e,t,r){const{type:s}=e;if(!s)return;const a=t[s];if(!a)return;for(const s of a){for(const a of it(e[s])){if(a&&typeof a==="object"){r.enter(a);traverse(a,t,r);r.exit(a)}}}}const t={enter(e){if(e.innerComments){delete e.innerComments}if(e.trailingComments){delete e.trailingComments}if(e.leadingComments){delete e.leadingComments}},exit(e){if(e.extra){delete e.extra}if(e!=null&&e.loc.identifierName){delete e.loc.identifierName}if(e.type==="TypeParameter"){e.type="Identifier";e.typeAnnotation=e.bound;delete e.bound}if(e.type==="QualifiedTypeIdentifier"){delete e.id}if(e.type==="ObjectTypeProperty"){delete e.key}if(e.type==="ObjectTypeIndexer"){delete e.id}if(e.type==="FunctionTypeParam"){delete e.name}if(e.type==="ImportDeclaration"){delete e.isType}if(e.type==="TemplateLiteral"){for(let t=0;tr.end){e.range[1]=r.end;e.loc.end.line=r.loc.end.line;e.loc.end.column=r.loc.end.column}}}else{if(!e.tokens.length){e.loc.start.line=1;e.loc.end.line=1}}if(e.body&&e.body.length>0){e.loc.start.line=e.body[0].loc.start.line;e.range[0]=e.body[0].start}}e.exports=function convertAST(e,t){convertNodes(e,t);convertProgramNode(e)}},5926:e=>{e.exports=function convertComments(e){for(const t of e){if(t.type==="CommentBlock"){t.type="Block"}else if(t.type==="CommentLine"){t.type="Line"}if(!t.range){t.range=[t.start,t.end]}}}},9530:e=>{function convertTemplateType(e,t){let r=null;let s=[];const a=[];function addTemplateType(){const e=s[0];const r=s[s.length-1];const n=s.reduce(((e,r)=>{if(r.value){e+=r.value}else if(r.type.label!==t.template){e+=r.type.label}return e}),"");a.push({type:"Template",value:n,start:e.start,end:r.end,loc:{start:e.loc.start,end:r.loc.end}});s=[]}e.forEach((e=>{switch(e.type.label){case t.backQuote:if(r){a.push(r);r=null}s.push(e);if(s.length>1){addTemplateType()}break;case t.dollarBraceL:s.push(e);addTemplateType();break;case t.braceR:if(r){a.push(r)}r=e;break;case t.template:if(r){s.push(r);r=null}s.push(e);break;case t.eof:if(r){a.push(r)}break;default:if(r){a.push(r);r=null}a.push(e)}}));return a}function convertToken(e,t,r){const{type:s}=e;const{label:a}=s;e.range=[e.start,e.end];if(a===r.name){e.type="Identifier"}else if(a===r.semi||a===r.comma||a===r.parenL||a===r.parenR||a===r.braceL||a===r.braceR||a===r.slash||a===r.dot||a===r.bracketL||a===r.bracketR||a===r.ellipsis||a===r.arrow||a===r.pipeline||a===r.star||a===r.incDec||a===r.colon||a===r.question||a===r.template||a===r.backQuote||a===r.dollarBraceL||a===r.at||a===r.logicalOR||a===r.logicalAND||a===r.nullishCoalescing||a===r.bitwiseOR||a===r.bitwiseXOR||a===r.bitwiseAND||a===r.equality||a===r.relational||a===r.bitShift||a===r.plusMin||a===r.modulo||a===r.exponent||a===r.bang||a===r.tilde||a===r.doubleColon||a===r.hash||a===r.questionDot||a===r.braceHashL||a===r.braceBarL||a===r.braceBarR||a===r.bracketHashL||a===r.bracketBarL||a===r.bracketBarR||s.isAssign){var n;e.type="Punctuator";(n=e.value)!=null?n:e.value=a}else if(a===r.jsxTagStart){e.type="Punctuator";e.value="<"}else if(a===r.jsxTagEnd){e.type="Punctuator";e.value=">"}else if(a===r.jsxName){e.type="JSXIdentifier"}else if(a===r.jsxText){e.type="JSXText"}else if(s.keyword==="null"){e.type="Null"}else if(s.keyword==="false"||s.keyword==="true"){e.type="Boolean"}else if(s.keyword){e.type="Keyword"}else if(a===r.num){e.type="Numeric";e.value=t.slice(e.start,e.end)}else if(a===r.string){e.type="String";e.value=t.slice(e.start,e.end)}else if(a===r.regexp){e.type="RegularExpression";const t=e.value;e.regex={pattern:t.pattern,flags:t.flags};e.value=`/${t.pattern}/${t.flags}`}else if(a===r.bigint){e.type="Numeric";e.value=`${e.value}n`}else if(a===r.privateName){e.type="PrivateIdentifier"}if(typeof e.type!=="string"){delete e.type.rightAssociative}return e}e.exports=function convertTokens(e,t,r){return convertTemplateType(e,r).filter((e=>e.type!=="CommentLine"&&e.type!=="CommentBlock")).map((e=>convertToken(e,t,r)))}},3773:(e,t,r)=>{const s=r(9530);const a=r(5926);const n=r(1527);t.ast=function convert(e,t,r,o){e.tokens=s(e.tokens,t,r);a(e.comments);n(e,o);return e};t.error=function convertError(e){if(e instanceof SyntaxError){e.lineNumber=e.loc.line;e.column=e.loc.column}return e}},8187:(e,t,r)=>{const{normalizeESLintConfig:s}=r(244);const a=r(614);const n=r(7854);const{LocalClient:o,WorkerClient:i}=r(7571);const l=new o;t.parse=function(e,t={}){return n(e,s(t),l)};t.parseForESLint=function(e,t={}){const r=s(t);const o=n(e,r,l);const i=a(o,r,l);return{ast:o,scopeManager:i,visitorKeys:l.getVisitorKeys()}}},7854:(e,t,r)=>{"use strict";const s=r(7849);const a=r(3773);function noop(){}const n=r(6949);noop((((e,t)=>(e=e.split("."),t=t.split("."),+e[0]>+t[0]||e[0]==t[0]&&+e[1]>=+t[1]))(process.versions.node,"8.9")?noop:(e,{paths:[t]},s=r(8188))=>{let a=s._findPath(e,s._nodeModulePaths(t).concat(t));if(a)return a;a=new Error(`Cannot resolve module '${e}'`);a.code="MODULE_NOT_FOUND";throw a})("@babel/parser",{paths:[noop("@babel/core/package.json")]}));let o=null;e.exports=function parse(e,t,r){const i=">=7.2.0";if(typeof o!=="boolean"){o=s.satisfies(r.getVersion(),i)}if(!o){throw new Error(`@babel/eslint-parser@${"7.15.0"} does not support @babel/core@${r.getVersion()}. Please upgrade to @babel/core@${i}.`)}const{ast:l,parserOptions:c}=r.maybeParse(e,t);if(l)return l;try{return a.ast(n.parse(e,c),e,r.getTokLabels(),r.getVisitorKeys())}catch(e){throw a.error(e)}}},76:(e,t,r)=>{const s=r(1498).KEYS;const a=r(6130);let n;t.getVisitorKeys=function getVisitorKeys(){if(!n){const e={ChainExpression:s.ChainExpression,ImportExpression:s.ImportExpression,Literal:s.Literal,MethodDefinition:["decorators"].concat(s.MethodDefinition),Property:["decorators"].concat(s.Property),PropertyDefinition:["decorators"].concat(s.PropertyDefinition)};const t={ClassPrivateMethod:["decorators"].concat(s.MethodDefinition),ExportAllDeclaration:s.ExportAllDeclaration};n=Object.assign({},e,a.types.VISITOR_KEYS,t)}return n};let o;t.getTokLabels=function getTokLabels(){return o||(o=(e=>e.reduce(((e,[t,r])=>Object.assign({},e,{[t]:r})),{}))(Object.entries(a.tokTypes).map((([e,t])=>[e,t.label]))))}},6130:(e,t,r)=>{function initialize(e){t.init=null;t.version=e.version;t.traverse=e.traverse;t.types=e.types;t.tokTypes=e.tokTypes;t.parseSync=e.parseSync;t.loadPartialConfigSync=e.loadPartialConfigSync;t.loadPartialConfigAsync=e.loadPartialConfigAsync;t.createConfigItem=e.createConfigItem}{initialize(r(8304))}},1542:(e,t,r)=>{function asyncGeneratorStep(e,t,r,s,a,n,o){try{var i=e[n](o);var l=i.value}catch(e){r(e);return}if(i.done){t(l)}else{Promise.resolve(l).then(s,a)}}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(s,a){var n=e.apply(t,r);function _next(e){asyncGeneratorStep(n,s,a,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(n,s,a,_next,_throw,"throw",e)}_next(undefined)}))}}const s=r(6130);function getParserPlugins(e){var t,r;const s=(t=(r=e.parserOpts)==null?void 0:r.plugins)!=null?t:[];const a={classFeatures:false};for(const e of s){if(Array.isArray(e)&&e[0]==="estree"){Object.assign(a,e[1]);break}}return[["estree",a],...s]}function normalizeParserOptions(e){return Object.assign({sourceType:e.sourceType,filename:e.filePath},e.babelOptions,{parserOpts:Object.assign({allowImportExportEverywhere:e.allowImportExportEverywhere,allowReturnOutsideFunction:true,allowSuperOutsideMethod:true},e.babelOptions.parserOpts,{plugins:getParserPlugins(e.babelOptions),attachComment:false,ranges:true,tokens:true}),caller:Object.assign({name:"@babel/eslint-parser"},e.babelOptions.caller)})}function validateResolvedConfig(e,t,r){if(e!==null){if(t.requireConfigFile!==false){if(!e.hasFilesystemConfig()){let t=`No Babel config file detected for ${e.options.filename}. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.`;if(e.options.filename.includes("node_modules")){t+=`\nIf you have a .babelrc.js file or use package.json#babel, keep in mind that it's not used when parsing dependencies. If you want your config to be applied to your whole app, consider using babel.config.js or babel.config.json instead.`}throw new Error(t)}}if(e.options)return e.options}return getDefaultParserOptions(r)}function getDefaultParserOptions(e){return Object.assign({plugins:[]},e,{babelrc:false,configFile:false,browserslistConfigFile:false,ignore:null,only:null})}t.normalizeBabelParseConfig=function(){var e=_asyncToGenerator((function*(e){const t=normalizeParserOptions(e);const r=yield s.loadPartialConfigAsync(t);return validateResolvedConfig(r,e,t)}));return function(t){return e.apply(this,arguments)}}();t.normalizeBabelParseConfigSync=function(e){const t=normalizeParserOptions(e);const r=s.loadPartialConfigSync(t);return validateResolvedConfig(r,e,t)}},2355:e=>{e.exports=function extractParserOptionsPlugin(){return{parserOverride(e,t){return t}}}},2100:(e,t,r)=>{const s=r(6130);const a=r(7495);const{getVisitorKeys:n,getTokLabels:o}=r(76);const{normalizeBabelParseConfig:i,normalizeBabelParseConfigSync:l}=r(1542);e.exports=function handleMessage(e,t){switch(e){case"GET_VERSION":return s.version;case"GET_TYPES_INFO":return{FLOW_FLIPPED_ALIAS_KEYS:s.types.FLIPPED_ALIAS_KEYS.Flow,VISITOR_KEYS:s.types.VISITOR_KEYS};case"GET_TOKEN_LABELS":return o();case"GET_VISITOR_KEYS":return n();case"MAYBE_PARSE":return i(t.options).then((e=>a(t.code,e)));case"MAYBE_PARSE_SYNC":{return a(t.code,l(t.options))}}throw new Error(`Unknown internal parser worker action: ${e}`)}},7495:(e,t,r)=>{const s=r(6130);const a=r(3773);const{getVisitorKeys:n,getTokLabels:o}=r(76);const i=r(2355);const l={};let c;const u=/More than one plugin attempted to override parsing/;e.exports=function maybeParse(e,t){if(!c){c=s.createConfigItem([i,l],{dirname:__dirname,type:"plugin"})}t.plugins.push(c);try{return{parserOptions:s.parseSync(e,t),ast:null}}catch(e){if(!u.test(e.message)){throw e}}let r;try{r=s.parseSync(e,t)}catch(e){throw a.error(e)}return{ast:a.ast(r,e,o(),n()),parserOptions:null}}},5619:e=>{"use strict";e.exports=JSON.parse('{"es6.module":{"chrome":"61","and_chr":"61","edge":"16","firefox":"60","and_ff":"60","node":"13.2.0","opera":"48","op_mob":"48","safari":"10.1","ios":"10.3","samsung":"8.2","android":"61","electron":"2.0","ios_saf":"10.3"}}')},7286:e=>{"use strict";e.exports=JSON.parse('{"proposal-class-static-block":{"chrome":"91","electron":"13.0"},"proposal-private-property-in-object":{"chrome":"91","firefox":"90","electron":"13.0"},"proposal-class-properties":{"chrome":"74","opera":"62","edge":"79","firefox":"90","safari":"14.1","node":"12","samsung":"11","electron":"6.0"},"proposal-private-methods":{"chrome":"84","opera":"70","edge":"84","firefox":"90","safari":"15","node":"14.6","electron":"10.0"},"proposal-numeric-separator":{"chrome":"75","opera":"62","edge":"79","firefox":"70","safari":"13","node":"12.5","ios":"13","samsung":"11","electron":"6.0"},"proposal-logical-assignment-operators":{"chrome":"85","opera":"71","edge":"85","firefox":"79","safari":"14","node":"15","ios":"14","electron":"10.0"},"proposal-nullish-coalescing-operator":{"chrome":"80","opera":"67","edge":"80","firefox":"72","safari":"13.1","node":"14","ios":"13.4","samsung":"13","electron":"8.0"},"proposal-optional-chaining":{"firefox":"74","safari":"13.1","ios":"13.4"},"proposal-json-strings":{"chrome":"66","opera":"53","edge":"79","firefox":"62","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"proposal-optional-catch-binding":{"chrome":"66","opera":"53","edge":"79","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-parameters":{"chrome":"49","opera":"36","edge":"18","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"proposal-async-generator-functions":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"proposal-object-rest-spread":{"chrome":"60","opera":"47","edge":"79","firefox":"55","safari":"11.1","node":"8.3","ios":"11.3","samsung":"8","electron":"2.0"},"transform-dotall-regex":{"chrome":"62","opera":"49","edge":"79","firefox":"78","safari":"11.1","node":"8.10","ios":"11.3","samsung":"8","electron":"3.0"},"proposal-unicode-property-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-named-capturing-groups-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-async-to-generator":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"11","node":"7.6","ios":"11","samsung":"6","electron":"1.6"},"transform-exponentiation-operator":{"chrome":"52","opera":"39","edge":"14","firefox":"52","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.3"},"transform-template-literals":{"chrome":"41","opera":"28","edge":"13","firefox":"34","safari":"13","node":"4","ios":"13","samsung":"3.4","electron":"0.21"},"transform-literals":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-function-name":{"chrome":"51","opera":"38","edge":"79","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-arrow-functions":{"chrome":"47","opera":"34","edge":"13","firefox":"45","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"transform-block-scoped-functions":{"chrome":"41","opera":"28","edge":"12","firefox":"46","safari":"10","node":"4","ie":"11","ios":"10","samsung":"3.4","electron":"0.21"},"transform-classes":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-object-super":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-shorthand-properties":{"chrome":"43","opera":"30","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.27"},"transform-duplicate-keys":{"chrome":"42","opera":"29","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.25"},"transform-computed-properties":{"chrome":"44","opera":"31","edge":"12","firefox":"34","safari":"7.1","node":"4","ios":"8","samsung":"4","electron":"0.30"},"transform-for-of":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-sticky-regex":{"chrome":"49","opera":"36","edge":"13","firefox":"3","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"transform-unicode-escapes":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-unicode-regex":{"chrome":"50","opera":"37","edge":"13","firefox":"46","safari":"12","node":"6","ios":"12","samsung":"5","electron":"1.1"},"transform-spread":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-destructuring":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-block-scoping":{"chrome":"49","opera":"36","edge":"14","firefox":"51","safari":"11","node":"6","ios":"11","samsung":"5","electron":"0.37"},"transform-typeof-symbol":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"transform-new-target":{"chrome":"46","opera":"33","edge":"14","firefox":"41","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-regenerator":{"chrome":"50","opera":"37","edge":"13","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"transform-member-expression-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"transform-property-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"transform-reserved-words":{"chrome":"13","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4.4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"proposal-export-namespace-from":{"chrome":"72","and_chr":"72","edge":"79","firefox":"80","and_ff":"80","node":"13.2","opera":"60","op_mob":"51","samsung":"11.0","android":"72","electron":"5.0"}}')},3654:e=>{"use strict";e.exports=JSON.parse('{"AssignmentExpression":["left","right"],"AssignmentPattern":["left","right"],"ArrayExpression":["elements"],"ArrayPattern":["elements"],"ArrowFunctionExpression":["params","body"],"AwaitExpression":["argument"],"BlockStatement":["body"],"BinaryExpression":["left","right"],"BreakStatement":["label"],"CallExpression":["callee","arguments"],"CatchClause":["param","body"],"ChainExpression":["expression"],"ClassBody":["body"],"ClassDeclaration":["id","superClass","body"],"ClassExpression":["id","superClass","body"],"ConditionalExpression":["test","consequent","alternate"],"ContinueStatement":["label"],"DebuggerStatement":[],"DoWhileStatement":["body","test"],"EmptyStatement":[],"ExportAllDeclaration":["exported","source"],"ExportDefaultDeclaration":["declaration"],"ExportNamedDeclaration":["declaration","specifiers","source"],"ExportSpecifier":["exported","local"],"ExpressionStatement":["expression"],"ExperimentalRestProperty":["argument"],"ExperimentalSpreadProperty":["argument"],"ForStatement":["init","test","update","body"],"ForInStatement":["left","right","body"],"ForOfStatement":["left","right","body"],"FunctionDeclaration":["id","params","body"],"FunctionExpression":["id","params","body"],"Identifier":[],"IfStatement":["test","consequent","alternate"],"ImportDeclaration":["specifiers","source"],"ImportDefaultSpecifier":["local"],"ImportExpression":["source"],"ImportNamespaceSpecifier":["local"],"ImportSpecifier":["imported","local"],"JSXAttribute":["name","value"],"JSXClosingElement":["name"],"JSXElement":["openingElement","children","closingElement"],"JSXEmptyExpression":[],"JSXExpressionContainer":["expression"],"JSXIdentifier":[],"JSXMemberExpression":["object","property"],"JSXNamespacedName":["namespace","name"],"JSXOpeningElement":["name","attributes"],"JSXSpreadAttribute":["argument"],"JSXText":[],"JSXFragment":["openingFragment","children","closingFragment"],"Literal":[],"LabeledStatement":["label","body"],"LogicalExpression":["left","right"],"MemberExpression":["object","property"],"MetaProperty":["meta","property"],"MethodDefinition":["key","value"],"NewExpression":["callee","arguments"],"ObjectExpression":["properties"],"ObjectPattern":["properties"],"PrivateIdentifier":[],"Program":["body"],"Property":["key","value"],"PropertyDefinition":["key","value"],"RestElement":["argument"],"ReturnStatement":["argument"],"SequenceExpression":["expressions"],"SpreadElement":["argument"],"Super":[],"SwitchStatement":["discriminant","cases"],"SwitchCase":["test","consequent"],"TaggedTemplateExpression":["tag","quasi"],"TemplateElement":[],"TemplateLiteral":["quasis","expressions"],"ThisExpression":[],"ThrowStatement":["argument"],"TryStatement":["block","handler","finalizer"],"UnaryExpression":["argument"],"UpdateExpression":["argument"],"VariableDeclaration":["declarations"],"VariableDeclarator":["id","init"],"WhileStatement":["test","body"],"WithStatement":["object","body"],"YieldExpression":["argument"]}')},5676:e=>{"use strict";e.exports=JSON.parse('{"assert":true,"assert/strict":">= 15","async_hooks":">= 8","buffer_ieee754":"< 0.9.7","buffer":true,"child_process":true,"cluster":true,"console":true,"constants":true,"crypto":true,"_debug_agent":">= 1 && < 8","_debugger":"< 8","dgram":true,"diagnostics_channel":">= 15.1","dns":true,"dns/promises":">= 15","domain":">= 0.7.12","events":true,"freelist":"< 6","fs":true,"fs/promises":[">= 10 && < 10.1",">= 14"],"_http_agent":">= 0.11.1","_http_client":">= 0.11.1","_http_common":">= 0.11.1","_http_incoming":">= 0.11.1","_http_outgoing":">= 0.11.1","_http_server":">= 0.11.1","http":true,"http2":">= 8.8","https":true,"inspector":">= 8.0.0","_linklist":"< 8","module":true,"net":true,"node-inspect/lib/_inspect":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6.0 && < 12","os":true,"path":true,"path/posix":">= 15.3","path/win32":">= 15.3","perf_hooks":">= 8.5","process":">= 1","punycode":true,"querystring":true,"readline":true,"repl":true,"smalloc":">= 0.11.5 && < 3","_stream_duplex":">= 0.9.4","_stream_transform":">= 0.9.4","_stream_wrap":">= 1.4.1","_stream_passthrough":">= 0.9.4","_stream_readable":">= 0.9.4","_stream_writable":">= 0.9.4","stream":true,"stream/promises":">= 15","string_decoder":true,"sys":[">= 0.6 && < 0.7",">= 0.8"],"timers":true,"timers/promises":">= 15","_tls_common":">= 0.11.13","_tls_legacy":">= 0.11.3 && < 10","_tls_wrap":">= 0.11.3","tls":true,"trace_events":">= 10","tty":true,"url":true,"util":true,"util/types":">= 15.3","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/consarray":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/csvparser":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/logreader":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/profile_view":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/splaytree":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8":">= 1","vm":true,"wasi":">= 13.4 && < 13.5","worker_threads":">= 11.7","zlib":true}')},6190:e=>{"use strict";e.exports=JSON.parse('{"name":"@babel/helper-create-class-features-plugin","version":"7.12.1","author":"The Babel Team (https://babeljs.io/team)","license":"MIT","description":"Compile class public and private fields, private methods and decorators to ES6","repository":{"type":"git","url":"https://github.com/babel/babel.git","directory":"packages/babel-helper-create-class-features-plugin"},"main":"lib/index.js","publishConfig":{"access":"public"},"keywords":["babel","babel-plugin"],"dependencies":{"@babel/helper-function-name":"^7.10.4","@babel/helper-member-expression-to-functions":"^7.12.1","@babel/helper-optimise-call-expression":"^7.10.4","@babel/helper-replace-supers":"^7.12.1","@babel/helper-split-export-declaration":"^7.10.4"},"peerDependencies":{"@babel/core":"^7.0.0"},"devDependencies":{"@babel/core":"^7.12.1","@babel/helper-plugin-test-runner":"7.10.4"}}')},5880:e=>{"use strict";e.exports=JSON.parse('{"es6.array.copy-within":{"chrome":"45","opera":"32","edge":"12","firefox":"32","safari":"9","node":"4","ios":"9","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.every":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.fill":{"chrome":"45","opera":"32","edge":"12","firefox":"31","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.filter":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.find":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.find-index":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es7.array.flat-map":{"chrome":"69","opera":"56","edge":"79","firefox":"62","safari":"12","node":"11","ios":"12","samsung":"10","electron":"4.0"},"es6.array.for-each":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.from":{"chrome":"51","opera":"38","edge":"15","firefox":"36","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.array.includes":{"chrome":"47","opera":"34","edge":"14","firefox":"43","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.array.index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.is-array":{"chrome":"5","opera":"10.50","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.iterator":{"chrome":"66","opera":"53","edge":"12","firefox":"60","safari":"9","node":"10","ios":"9","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es6.array.last-index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.map":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.of":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"9","node":"4","ios":"9","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.reduce":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.reduce-right":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.slice":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.some":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.sort":{"chrome":"63","opera":"50","edge":"12","firefox":"5","safari":"12","node":"10","ie":"9","ios":"12","samsung":"8","rhino":"1.7.13","electron":"3.0"},"es6.array.species":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.date.now":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-iso-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-json":{"chrome":"5","opera":"12.10","edge":"12","firefox":"4","safari":"10","node":"0.10","ie":"9","android":"4","ios":"10","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-primitive":{"chrome":"47","opera":"34","edge":"15","firefox":"44","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.date.to-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.function.bind":{"chrome":"7","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.function.has-instance":{"chrome":"51","opera":"38","edge":"15","firefox":"50","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.function.name":{"chrome":"5","opera":"10.50","edge":"14","firefox":"2","safari":"4","node":"0.10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.math.acosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.asinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.atanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.cbrt":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.clz32":{"chrome":"38","opera":"25","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.cosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.expm1":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.fround":{"chrome":"38","opera":"25","edge":"12","firefox":"26","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.hypot":{"chrome":"38","opera":"25","edge":"12","firefox":"27","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.imul":{"chrome":"30","opera":"17","edge":"12","firefox":"23","safari":"7","node":"0.12","android":"4.4","ios":"7","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.math.log1p":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.log10":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.log2":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.sign":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.sinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.tanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.trunc":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.number.constructor":{"chrome":"41","opera":"28","edge":"12","firefox":"36","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.number.epsilon":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.is-finite":{"chrome":"19","opera":"15","edge":"12","firefox":"16","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.number.is-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"16","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.is-nan":{"chrome":"19","opera":"15","edge":"12","firefox":"15","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.number.is-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"32","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.max-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.min-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.parse-float":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.parse-int":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.object.assign":{"chrome":"49","opera":"36","edge":"13","firefox":"36","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.object.create":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.object.define-getter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.define-setter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.define-property":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.object.define-properties":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.object.entries":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.freeze":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.get-own-property-descriptor":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es7.object.get-own-property-descriptors":{"chrome":"54","opera":"41","edge":"15","firefox":"50","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.get-own-property-names":{"chrome":"40","opera":"27","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.object.get-prototype-of":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es7.object.lookup-getter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.lookup-setter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.prevent-extensions":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.to-string":{"chrome":"57","opera":"44","edge":"15","firefox":"51","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es6.object.is":{"chrome":"19","opera":"15","edge":"12","firefox":"22","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.object.is-frozen":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.is-sealed":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.is-extensible":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.keys":{"chrome":"40","opera":"27","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.object.seal":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.set-prototype-of":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ie":"11","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es7.object.values":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.promise":{"chrome":"51","opera":"38","edge":"14","firefox":"45","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.promise.finally":{"chrome":"63","opera":"50","edge":"18","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"8","electron":"3.0"},"es6.reflect.apply":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.construct":{"chrome":"49","opera":"36","edge":"13","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.define-property":{"chrome":"49","opera":"36","edge":"13","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.delete-property":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-own-property-descriptor":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.has":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.is-extensible":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.own-keys":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.prevent-extensions":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.regexp.constructor":{"chrome":"50","opera":"37","edge":"79","firefox":"40","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.flags":{"chrome":"49","opera":"36","edge":"79","firefox":"37","safari":"9","node":"6","ios":"9","samsung":"5","electron":"0.37"},"es6.regexp.match":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"1.1"},"es6.regexp.replace":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.split":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.search":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"1.1"},"es6.regexp.to-string":{"chrome":"50","opera":"37","edge":"79","firefox":"39","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.symbol":{"chrome":"51","opera":"38","edge":"79","firefox":"51","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.symbol.async-iterator":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"es6.string.anchor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.big":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.blink":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.bold":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.code-point-at":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.ends-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.fixed":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontcolor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontsize":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.from-code-point":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.includes":{"chrome":"41","opera":"28","edge":"12","firefox":"40","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.italics":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.iterator":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.string.link":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es7.string.pad-start":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","rhino":"1.7.13","electron":"1.7"},"es7.string.pad-end":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","rhino":"1.7.13","electron":"1.7"},"es6.string.raw":{"chrome":"41","opera":"28","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.repeat":{"chrome":"41","opera":"28","edge":"12","firefox":"24","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.small":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.starts-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.strike":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sub":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sup":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.trim":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.string.trim-left":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es7.string.trim-right":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es6.typed.array-buffer":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.data-view":{"chrome":"5","opera":"12","edge":"12","firefox":"15","safari":"5.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.typed.int8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-clamped-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float64-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.weak-map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"},"es6.weak-set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"}}')},2166:e=>{"use strict";e.exports={version:"4.3.0"}},290:e=>{"use strict";e.exports={i8:"5.1.1"}},5535:e=>{"use strict";e.exports={i8:"4.3.0"}},964:e=>{"use strict";e.exports=JSON.parse('{"builtin":{"Array":false,"ArrayBuffer":false,"Atomics":false,"BigInt":false,"BigInt64Array":false,"BigUint64Array":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"globalThis":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"es5":{"Array":false,"Boolean":false,"constructor":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"propertyIsEnumerable":false,"RangeError":false,"ReferenceError":false,"RegExp":false,"String":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false},"es2015":{"Array":false,"ArrayBuffer":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"es2017":{"Array":false,"ArrayBuffer":false,"Atomics":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"browser":{"AbortController":false,"AbortSignal":false,"addEventListener":false,"alert":false,"AnalyserNode":false,"Animation":false,"AnimationEffectReadOnly":false,"AnimationEffectTiming":false,"AnimationEffectTimingReadOnly":false,"AnimationEvent":false,"AnimationPlaybackEvent":false,"AnimationTimeline":false,"applicationCache":false,"ApplicationCache":false,"ApplicationCacheErrorEvent":false,"atob":false,"Attr":false,"Audio":false,"AudioBuffer":false,"AudioBufferSourceNode":false,"AudioContext":false,"AudioDestinationNode":false,"AudioListener":false,"AudioNode":false,"AudioParam":false,"AudioProcessingEvent":false,"AudioScheduledSourceNode":false,"AudioWorkletGlobalScope ":false,"AudioWorkletNode":false,"AudioWorkletProcessor":false,"BarProp":false,"BaseAudioContext":false,"BatteryManager":false,"BeforeUnloadEvent":false,"BiquadFilterNode":false,"Blob":false,"BlobEvent":false,"blur":false,"BroadcastChannel":false,"btoa":false,"BudgetService":false,"ByteLengthQueuingStrategy":false,"Cache":false,"caches":false,"CacheStorage":false,"cancelAnimationFrame":false,"cancelIdleCallback":false,"CanvasCaptureMediaStreamTrack":false,"CanvasGradient":false,"CanvasPattern":false,"CanvasRenderingContext2D":false,"ChannelMergerNode":false,"ChannelSplitterNode":false,"CharacterData":false,"clearInterval":false,"clearTimeout":false,"clientInformation":false,"ClipboardEvent":false,"close":false,"closed":false,"CloseEvent":false,"Comment":false,"CompositionEvent":false,"confirm":false,"console":false,"ConstantSourceNode":false,"ConvolverNode":false,"CountQueuingStrategy":false,"createImageBitmap":false,"Credential":false,"CredentialsContainer":false,"crypto":false,"Crypto":false,"CryptoKey":false,"CSS":false,"CSSConditionRule":false,"CSSFontFaceRule":false,"CSSGroupingRule":false,"CSSImportRule":false,"CSSKeyframeRule":false,"CSSKeyframesRule":false,"CSSMediaRule":false,"CSSNamespaceRule":false,"CSSPageRule":false,"CSSRule":false,"CSSRuleList":false,"CSSStyleDeclaration":false,"CSSStyleRule":false,"CSSStyleSheet":false,"CSSSupportsRule":false,"CustomElementRegistry":false,"customElements":false,"CustomEvent":false,"DataTransfer":false,"DataTransferItem":false,"DataTransferItemList":false,"defaultstatus":false,"defaultStatus":false,"DelayNode":false,"DeviceMotionEvent":false,"DeviceOrientationEvent":false,"devicePixelRatio":false,"dispatchEvent":false,"document":false,"Document":false,"DocumentFragment":false,"DocumentType":false,"DOMError":false,"DOMException":false,"DOMImplementation":false,"DOMMatrix":false,"DOMMatrixReadOnly":false,"DOMParser":false,"DOMPoint":false,"DOMPointReadOnly":false,"DOMQuad":false,"DOMRect":false,"DOMRectReadOnly":false,"DOMStringList":false,"DOMStringMap":false,"DOMTokenList":false,"DragEvent":false,"DynamicsCompressorNode":false,"Element":false,"ErrorEvent":false,"event":false,"Event":false,"EventSource":false,"EventTarget":false,"external":false,"fetch":false,"File":false,"FileList":false,"FileReader":false,"find":false,"focus":false,"FocusEvent":false,"FontFace":false,"FontFaceSetLoadEvent":false,"FormData":false,"frameElement":false,"frames":false,"GainNode":false,"Gamepad":false,"GamepadButton":false,"GamepadEvent":false,"getComputedStyle":false,"getSelection":false,"HashChangeEvent":false,"Headers":false,"history":false,"History":false,"HTMLAllCollection":false,"HTMLAnchorElement":false,"HTMLAreaElement":false,"HTMLAudioElement":false,"HTMLBaseElement":false,"HTMLBodyElement":false,"HTMLBRElement":false,"HTMLButtonElement":false,"HTMLCanvasElement":false,"HTMLCollection":false,"HTMLContentElement":false,"HTMLDataElement":false,"HTMLDataListElement":false,"HTMLDetailsElement":false,"HTMLDialogElement":false,"HTMLDirectoryElement":false,"HTMLDivElement":false,"HTMLDListElement":false,"HTMLDocument":false,"HTMLElement":false,"HTMLEmbedElement":false,"HTMLFieldSetElement":false,"HTMLFontElement":false,"HTMLFormControlsCollection":false,"HTMLFormElement":false,"HTMLFrameElement":false,"HTMLFrameSetElement":false,"HTMLHeadElement":false,"HTMLHeadingElement":false,"HTMLHRElement":false,"HTMLHtmlElement":false,"HTMLIFrameElement":false,"HTMLImageElement":false,"HTMLInputElement":false,"HTMLLabelElement":false,"HTMLLegendElement":false,"HTMLLIElement":false,"HTMLLinkElement":false,"HTMLMapElement":false,"HTMLMarqueeElement":false,"HTMLMediaElement":false,"HTMLMenuElement":false,"HTMLMetaElement":false,"HTMLMeterElement":false,"HTMLModElement":false,"HTMLObjectElement":false,"HTMLOListElement":false,"HTMLOptGroupElement":false,"HTMLOptionElement":false,"HTMLOptionsCollection":false,"HTMLOutputElement":false,"HTMLParagraphElement":false,"HTMLParamElement":false,"HTMLPictureElement":false,"HTMLPreElement":false,"HTMLProgressElement":false,"HTMLQuoteElement":false,"HTMLScriptElement":false,"HTMLSelectElement":false,"HTMLShadowElement":false,"HTMLSlotElement":false,"HTMLSourceElement":false,"HTMLSpanElement":false,"HTMLStyleElement":false,"HTMLTableCaptionElement":false,"HTMLTableCellElement":false,"HTMLTableColElement":false,"HTMLTableElement":false,"HTMLTableRowElement":false,"HTMLTableSectionElement":false,"HTMLTemplateElement":false,"HTMLTextAreaElement":false,"HTMLTimeElement":false,"HTMLTitleElement":false,"HTMLTrackElement":false,"HTMLUListElement":false,"HTMLUnknownElement":false,"HTMLVideoElement":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"IdleDeadline":false,"IIRFilterNode":false,"Image":false,"ImageBitmap":false,"ImageBitmapRenderingContext":false,"ImageCapture":false,"ImageData":false,"indexedDB":false,"innerHeight":false,"innerWidth":false,"InputEvent":false,"IntersectionObserver":false,"IntersectionObserverEntry":false,"Intl":false,"isSecureContext":false,"KeyboardEvent":false,"KeyframeEffect":false,"KeyframeEffectReadOnly":false,"length":false,"localStorage":false,"location":true,"Location":false,"locationbar":false,"matchMedia":false,"MediaDeviceInfo":false,"MediaDevices":false,"MediaElementAudioSourceNode":false,"MediaEncryptedEvent":false,"MediaError":false,"MediaKeyMessageEvent":false,"MediaKeySession":false,"MediaKeyStatusMap":false,"MediaKeySystemAccess":false,"MediaList":false,"MediaQueryList":false,"MediaQueryListEvent":false,"MediaRecorder":false,"MediaSettingsRange":false,"MediaSource":false,"MediaStream":false,"MediaStreamAudioDestinationNode":false,"MediaStreamAudioSourceNode":false,"MediaStreamEvent":false,"MediaStreamTrack":false,"MediaStreamTrackEvent":false,"menubar":false,"MessageChannel":false,"MessageEvent":false,"MessagePort":false,"MIDIAccess":false,"MIDIConnectionEvent":false,"MIDIInput":false,"MIDIInputMap":false,"MIDIMessageEvent":false,"MIDIOutput":false,"MIDIOutputMap":false,"MIDIPort":false,"MimeType":false,"MimeTypeArray":false,"MouseEvent":false,"moveBy":false,"moveTo":false,"MutationEvent":false,"MutationObserver":false,"MutationRecord":false,"name":false,"NamedNodeMap":false,"NavigationPreloadManager":false,"navigator":false,"Navigator":false,"NetworkInformation":false,"Node":false,"NodeFilter":false,"NodeIterator":false,"NodeList":false,"Notification":false,"OfflineAudioCompletionEvent":false,"OfflineAudioContext":false,"offscreenBuffering":false,"OffscreenCanvas":true,"onabort":true,"onafterprint":true,"onanimationend":true,"onanimationiteration":true,"onanimationstart":true,"onappinstalled":true,"onauxclick":true,"onbeforeinstallprompt":true,"onbeforeprint":true,"onbeforeunload":true,"onblur":true,"oncancel":true,"oncanplay":true,"oncanplaythrough":true,"onchange":true,"onclick":true,"onclose":true,"oncontextmenu":true,"oncuechange":true,"ondblclick":true,"ondevicemotion":true,"ondeviceorientation":true,"ondeviceorientationabsolute":true,"ondrag":true,"ondragend":true,"ondragenter":true,"ondragleave":true,"ondragover":true,"ondragstart":true,"ondrop":true,"ondurationchange":true,"onemptied":true,"onended":true,"onerror":true,"onfocus":true,"ongotpointercapture":true,"onhashchange":true,"oninput":true,"oninvalid":true,"onkeydown":true,"onkeypress":true,"onkeyup":true,"onlanguagechange":true,"onload":true,"onloadeddata":true,"onloadedmetadata":true,"onloadstart":true,"onlostpointercapture":true,"onmessage":true,"onmessageerror":true,"onmousedown":true,"onmouseenter":true,"onmouseleave":true,"onmousemove":true,"onmouseout":true,"onmouseover":true,"onmouseup":true,"onmousewheel":true,"onoffline":true,"ononline":true,"onpagehide":true,"onpageshow":true,"onpause":true,"onplay":true,"onplaying":true,"onpointercancel":true,"onpointerdown":true,"onpointerenter":true,"onpointerleave":true,"onpointermove":true,"onpointerout":true,"onpointerover":true,"onpointerup":true,"onpopstate":true,"onprogress":true,"onratechange":true,"onrejectionhandled":true,"onreset":true,"onresize":true,"onscroll":true,"onsearch":true,"onseeked":true,"onseeking":true,"onselect":true,"onstalled":true,"onstorage":true,"onsubmit":true,"onsuspend":true,"ontimeupdate":true,"ontoggle":true,"ontransitionend":true,"onunhandledrejection":true,"onunload":true,"onvolumechange":true,"onwaiting":true,"onwheel":true,"open":false,"openDatabase":false,"opener":false,"Option":false,"origin":false,"OscillatorNode":false,"outerHeight":false,"outerWidth":false,"PageTransitionEvent":false,"pageXOffset":false,"pageYOffset":false,"PannerNode":false,"parent":false,"Path2D":false,"PaymentAddress":false,"PaymentRequest":false,"PaymentRequestUpdateEvent":false,"PaymentResponse":false,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceLongTaskTiming":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceNavigationTiming":false,"PerformanceObserver":false,"PerformanceObserverEntryList":false,"PerformancePaintTiming":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"PeriodicWave":false,"Permissions":false,"PermissionStatus":false,"personalbar":false,"PhotoCapabilities":false,"Plugin":false,"PluginArray":false,"PointerEvent":false,"PopStateEvent":false,"postMessage":false,"Presentation":false,"PresentationAvailability":false,"PresentationConnection":false,"PresentationConnectionAvailableEvent":false,"PresentationConnectionCloseEvent":false,"PresentationConnectionList":false,"PresentationReceiver":false,"PresentationRequest":false,"print":false,"ProcessingInstruction":false,"ProgressEvent":false,"PromiseRejectionEvent":false,"prompt":false,"PushManager":false,"PushSubscription":false,"PushSubscriptionOptions":false,"queueMicrotask":false,"RadioNodeList":false,"Range":false,"ReadableStream":false,"registerProcessor":false,"RemotePlayback":false,"removeEventListener":false,"Request":false,"requestAnimationFrame":false,"requestIdleCallback":false,"resizeBy":false,"ResizeObserver":false,"ResizeObserverEntry":false,"resizeTo":false,"Response":false,"RTCCertificate":false,"RTCDataChannel":false,"RTCDataChannelEvent":false,"RTCDtlsTransport":false,"RTCIceCandidate":false,"RTCIceGatherer":false,"RTCIceTransport":false,"RTCPeerConnection":false,"RTCPeerConnectionIceEvent":false,"RTCRtpContributingSource":false,"RTCRtpReceiver":false,"RTCRtpSender":false,"RTCSctpTransport":false,"RTCSessionDescription":false,"RTCStatsReport":false,"RTCTrackEvent":false,"screen":false,"Screen":false,"screenLeft":false,"ScreenOrientation":false,"screenTop":false,"screenX":false,"screenY":false,"ScriptProcessorNode":false,"scroll":false,"scrollbars":false,"scrollBy":false,"scrollTo":false,"scrollX":false,"scrollY":false,"SecurityPolicyViolationEvent":false,"Selection":false,"self":false,"ServiceWorker":false,"ServiceWorkerContainer":false,"ServiceWorkerRegistration":false,"sessionStorage":false,"setInterval":false,"setTimeout":false,"ShadowRoot":false,"SharedWorker":false,"SourceBuffer":false,"SourceBufferList":false,"speechSynthesis":false,"SpeechSynthesisEvent":false,"SpeechSynthesisUtterance":false,"StaticRange":false,"status":false,"statusbar":false,"StereoPannerNode":false,"stop":false,"Storage":false,"StorageEvent":false,"StorageManager":false,"styleMedia":false,"StyleSheet":false,"StyleSheetList":false,"SubtleCrypto":false,"SVGAElement":false,"SVGAngle":false,"SVGAnimatedAngle":false,"SVGAnimatedBoolean":false,"SVGAnimatedEnumeration":false,"SVGAnimatedInteger":false,"SVGAnimatedLength":false,"SVGAnimatedLengthList":false,"SVGAnimatedNumber":false,"SVGAnimatedNumberList":false,"SVGAnimatedPreserveAspectRatio":false,"SVGAnimatedRect":false,"SVGAnimatedString":false,"SVGAnimatedTransformList":false,"SVGAnimateElement":false,"SVGAnimateMotionElement":false,"SVGAnimateTransformElement":false,"SVGAnimationElement":false,"SVGCircleElement":false,"SVGClipPathElement":false,"SVGComponentTransferFunctionElement":false,"SVGDefsElement":false,"SVGDescElement":false,"SVGDiscardElement":false,"SVGElement":false,"SVGEllipseElement":false,"SVGFEBlendElement":false,"SVGFEColorMatrixElement":false,"SVGFEComponentTransferElement":false,"SVGFECompositeElement":false,"SVGFEConvolveMatrixElement":false,"SVGFEDiffuseLightingElement":false,"SVGFEDisplacementMapElement":false,"SVGFEDistantLightElement":false,"SVGFEDropShadowElement":false,"SVGFEFloodElement":false,"SVGFEFuncAElement":false,"SVGFEFuncBElement":false,"SVGFEFuncGElement":false,"SVGFEFuncRElement":false,"SVGFEGaussianBlurElement":false,"SVGFEImageElement":false,"SVGFEMergeElement":false,"SVGFEMergeNodeElement":false,"SVGFEMorphologyElement":false,"SVGFEOffsetElement":false,"SVGFEPointLightElement":false,"SVGFESpecularLightingElement":false,"SVGFESpotLightElement":false,"SVGFETileElement":false,"SVGFETurbulenceElement":false,"SVGFilterElement":false,"SVGForeignObjectElement":false,"SVGGElement":false,"SVGGeometryElement":false,"SVGGradientElement":false,"SVGGraphicsElement":false,"SVGImageElement":false,"SVGLength":false,"SVGLengthList":false,"SVGLinearGradientElement":false,"SVGLineElement":false,"SVGMarkerElement":false,"SVGMaskElement":false,"SVGMatrix":false,"SVGMetadataElement":false,"SVGMPathElement":false,"SVGNumber":false,"SVGNumberList":false,"SVGPathElement":false,"SVGPatternElement":false,"SVGPoint":false,"SVGPointList":false,"SVGPolygonElement":false,"SVGPolylineElement":false,"SVGPreserveAspectRatio":false,"SVGRadialGradientElement":false,"SVGRect":false,"SVGRectElement":false,"SVGScriptElement":false,"SVGSetElement":false,"SVGStopElement":false,"SVGStringList":false,"SVGStyleElement":false,"SVGSVGElement":false,"SVGSwitchElement":false,"SVGSymbolElement":false,"SVGTextContentElement":false,"SVGTextElement":false,"SVGTextPathElement":false,"SVGTextPositioningElement":false,"SVGTitleElement":false,"SVGTransform":false,"SVGTransformList":false,"SVGTSpanElement":false,"SVGUnitTypes":false,"SVGUseElement":false,"SVGViewElement":false,"TaskAttributionTiming":false,"Text":false,"TextDecoder":false,"TextEncoder":false,"TextEvent":false,"TextMetrics":false,"TextTrack":false,"TextTrackCue":false,"TextTrackCueList":false,"TextTrackList":false,"TimeRanges":false,"toolbar":false,"top":false,"Touch":false,"TouchEvent":false,"TouchList":false,"TrackEvent":false,"TransitionEvent":false,"TreeWalker":false,"UIEvent":false,"URL":false,"URLSearchParams":false,"ValidityState":false,"visualViewport":false,"VisualViewport":false,"VTTCue":false,"WaveShaperNode":false,"WebAssembly":false,"WebGL2RenderingContext":false,"WebGLActiveInfo":false,"WebGLBuffer":false,"WebGLContextEvent":false,"WebGLFramebuffer":false,"WebGLProgram":false,"WebGLQuery":false,"WebGLRenderbuffer":false,"WebGLRenderingContext":false,"WebGLSampler":false,"WebGLShader":false,"WebGLShaderPrecisionFormat":false,"WebGLSync":false,"WebGLTexture":false,"WebGLTransformFeedback":false,"WebGLUniformLocation":false,"WebGLVertexArrayObject":false,"WebSocket":false,"WheelEvent":false,"window":false,"Window":false,"Worker":false,"WritableStream":false,"XMLDocument":false,"XMLHttpRequest":false,"XMLHttpRequestEventTarget":false,"XMLHttpRequestUpload":false,"XMLSerializer":false,"XPathEvaluator":false,"XPathExpression":false,"XPathResult":false,"XSLTProcessor":false},"worker":{"addEventListener":false,"applicationCache":false,"atob":false,"Blob":false,"BroadcastChannel":false,"btoa":false,"Cache":false,"caches":false,"clearInterval":false,"clearTimeout":false,"close":true,"console":false,"fetch":false,"FileReaderSync":false,"FormData":false,"Headers":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"ImageData":false,"importScripts":true,"indexedDB":false,"location":false,"MessageChannel":false,"MessagePort":false,"name":false,"navigator":false,"Notification":false,"onclose":true,"onconnect":true,"onerror":true,"onlanguagechange":true,"onmessage":true,"onoffline":true,"ononline":true,"onrejectionhandled":true,"onunhandledrejection":true,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"postMessage":true,"Promise":false,"queueMicrotask":false,"removeEventListener":false,"Request":false,"Response":false,"self":true,"ServiceWorkerRegistration":false,"setInterval":false,"setTimeout":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false,"WebSocket":false,"Worker":false,"WorkerGlobalScope":false,"XMLHttpRequest":false},"node":{"__dirname":false,"__filename":false,"Buffer":false,"clearImmediate":false,"clearInterval":false,"clearTimeout":false,"console":false,"exports":true,"global":false,"Intl":false,"module":false,"process":false,"queueMicrotask":false,"require":false,"setImmediate":false,"setInterval":false,"setTimeout":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false},"commonjs":{"exports":true,"global":false,"module":false,"require":false},"amd":{"define":false,"require":false},"mocha":{"after":false,"afterEach":false,"before":false,"beforeEach":false,"context":false,"describe":false,"it":false,"mocha":false,"run":false,"setup":false,"specify":false,"suite":false,"suiteSetup":false,"suiteTeardown":false,"teardown":false,"test":false,"xcontext":false,"xdescribe":false,"xit":false,"xspecify":false},"jasmine":{"afterAll":false,"afterEach":false,"beforeAll":false,"beforeEach":false,"describe":false,"expect":false,"fail":false,"fdescribe":false,"fit":false,"it":false,"jasmine":false,"pending":false,"runs":false,"spyOn":false,"spyOnProperty":false,"waits":false,"waitsFor":false,"xdescribe":false,"xit":false},"jest":{"afterAll":false,"afterEach":false,"beforeAll":false,"beforeEach":false,"describe":false,"expect":false,"fdescribe":false,"fit":false,"it":false,"jest":false,"pit":false,"require":false,"test":false,"xdescribe":false,"xit":false,"xtest":false},"qunit":{"asyncTest":false,"deepEqual":false,"equal":false,"expect":false,"module":false,"notDeepEqual":false,"notEqual":false,"notOk":false,"notPropEqual":false,"notStrictEqual":false,"ok":false,"propEqual":false,"QUnit":false,"raises":false,"start":false,"stop":false,"strictEqual":false,"test":false,"throws":false},"phantomjs":{"console":true,"exports":true,"phantom":true,"require":true,"WebPage":true},"couch":{"emit":false,"exports":false,"getRow":false,"log":false,"module":false,"provides":false,"require":false,"respond":false,"send":false,"start":false,"sum":false},"rhino":{"defineClass":false,"deserialize":false,"gc":false,"help":false,"importClass":false,"importPackage":false,"java":false,"load":false,"loadClass":false,"Packages":false,"print":false,"quit":false,"readFile":false,"readUrl":false,"runCommand":false,"seal":false,"serialize":false,"spawn":false,"sync":false,"toint32":false,"version":false},"nashorn":{"__DIR__":false,"__FILE__":false,"__LINE__":false,"com":false,"edu":false,"exit":false,"java":false,"Java":false,"javafx":false,"JavaImporter":false,"javax":false,"JSAdapter":false,"load":false,"loadWithNewGlobal":false,"org":false,"Packages":false,"print":false,"quit":false},"wsh":{"ActiveXObject":true,"Enumerator":true,"GetObject":true,"ScriptEngine":true,"ScriptEngineBuildVersion":true,"ScriptEngineMajorVersion":true,"ScriptEngineMinorVersion":true,"VBArray":true,"WScript":true,"WSH":true,"XDomainRequest":true},"jquery":{"$":false,"jQuery":false},"yui":{"YAHOO":false,"YAHOO_config":false,"YUI":false,"YUI_config":false},"shelljs":{"cat":false,"cd":false,"chmod":false,"config":false,"cp":false,"dirs":false,"echo":false,"env":false,"error":false,"exec":false,"exit":false,"find":false,"grep":false,"ln":false,"ls":false,"mkdir":false,"mv":false,"popd":false,"pushd":false,"pwd":false,"rm":false,"sed":false,"set":false,"target":false,"tempdir":false,"test":false,"touch":false,"which":false},"prototypejs":{"$":false,"$$":false,"$A":false,"$break":false,"$continue":false,"$F":false,"$H":false,"$R":false,"$w":false,"Abstract":false,"Ajax":false,"Autocompleter":false,"Builder":false,"Class":false,"Control":false,"Draggable":false,"Draggables":false,"Droppables":false,"Effect":false,"Element":false,"Enumerable":false,"Event":false,"Field":false,"Form":false,"Hash":false,"Insertion":false,"ObjectRange":false,"PeriodicalExecuter":false,"Position":false,"Prototype":false,"Scriptaculous":false,"Selector":false,"Sortable":false,"SortableObserver":false,"Sound":false,"Template":false,"Toggle":false,"Try":false},"meteor":{"_":false,"$":false,"Accounts":false,"AccountsClient":false,"AccountsCommon":false,"AccountsServer":false,"App":false,"Assets":false,"Blaze":false,"check":false,"Cordova":false,"DDP":false,"DDPRateLimiter":false,"DDPServer":false,"Deps":false,"EJSON":false,"Email":false,"HTTP":false,"Log":false,"Match":false,"Meteor":false,"Mongo":false,"MongoInternals":false,"Npm":false,"Package":false,"Plugin":false,"process":false,"Random":false,"ReactiveDict":false,"ReactiveVar":false,"Router":false,"ServiceConfiguration":false,"Session":false,"share":false,"Spacebars":false,"Template":false,"Tinytest":false,"Tracker":false,"UI":false,"Utils":false,"WebApp":false,"WebAppInternals":false},"mongo":{"_isWindows":false,"_rand":false,"BulkWriteResult":false,"cat":false,"cd":false,"connect":false,"db":false,"getHostName":false,"getMemInfo":false,"hostname":false,"ISODate":false,"listFiles":false,"load":false,"ls":false,"md5sumFile":false,"mkdir":false,"Mongo":false,"NumberInt":false,"NumberLong":false,"ObjectId":false,"PlanCache":false,"print":false,"printjson":false,"pwd":false,"quit":false,"removeFile":false,"rs":false,"sh":false,"UUID":false,"version":false,"WriteResult":false},"applescript":{"$":false,"Application":false,"Automation":false,"console":false,"delay":false,"Library":false,"ObjC":false,"ObjectSpecifier":false,"Path":false,"Progress":false,"Ref":false},"serviceworker":{"addEventListener":false,"applicationCache":false,"atob":false,"Blob":false,"BroadcastChannel":false,"btoa":false,"Cache":false,"caches":false,"CacheStorage":false,"clearInterval":false,"clearTimeout":false,"Client":false,"clients":false,"Clients":false,"close":true,"console":false,"ExtendableEvent":false,"ExtendableMessageEvent":false,"fetch":false,"FetchEvent":false,"FileReaderSync":false,"FormData":false,"Headers":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"ImageData":false,"importScripts":false,"indexedDB":false,"location":false,"MessageChannel":false,"MessagePort":false,"name":false,"navigator":false,"Notification":false,"onclose":true,"onconnect":true,"onerror":true,"onfetch":true,"oninstall":true,"onlanguagechange":true,"onmessage":true,"onmessageerror":true,"onnotificationclick":true,"onnotificationclose":true,"onoffline":true,"ononline":true,"onpush":true,"onpushsubscriptionchange":true,"onrejectionhandled":true,"onsync":true,"onunhandledrejection":true,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"postMessage":true,"Promise":false,"queueMicrotask":false,"registration":false,"removeEventListener":false,"Request":false,"Response":false,"self":false,"ServiceWorker":false,"ServiceWorkerContainer":false,"ServiceWorkerGlobalScope":false,"ServiceWorkerMessageEvent":false,"ServiceWorkerRegistration":false,"setInterval":false,"setTimeout":false,"skipWaiting":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false,"WebSocket":false,"WindowClient":false,"Worker":false,"WorkerGlobalScope":false,"XMLHttpRequest":false},"atomtest":{"advanceClock":false,"fakeClearInterval":false,"fakeClearTimeout":false,"fakeSetInterval":false,"fakeSetTimeout":false,"resetTimeouts":false,"waitsForPromise":false},"embertest":{"andThen":false,"click":false,"currentPath":false,"currentRouteName":false,"currentURL":false,"fillIn":false,"find":false,"findAll":false,"findWithAssert":false,"keyEvent":false,"pauseTest":false,"resumeTest":false,"triggerEvent":false,"visit":false,"wait":false},"protractor":{"$":false,"$$":false,"browser":false,"by":false,"By":false,"DartObject":false,"element":false,"protractor":false},"shared-node-browser":{"clearInterval":false,"clearTimeout":false,"console":false,"setInterval":false,"setTimeout":false,"URL":false,"URLSearchParams":false},"webextensions":{"browser":false,"chrome":false,"opr":false},"greasemonkey":{"cloneInto":false,"createObjectIn":false,"exportFunction":false,"GM":false,"GM_addStyle":false,"GM_deleteValue":false,"GM_getResourceText":false,"GM_getResourceURL":false,"GM_getValue":false,"GM_info":false,"GM_listValues":false,"GM_log":false,"GM_openInTab":false,"GM_registerMenuCommand":false,"GM_setClipboard":false,"GM_setValue":false,"GM_xmlhttpRequest":false,"unsafeWindow":false},"devtools":{"$":false,"$_":false,"$$":false,"$0":false,"$1":false,"$2":false,"$3":false,"$4":false,"$x":false,"chrome":false,"clear":false,"copy":false,"debug":false,"dir":false,"dirxml":false,"getEventListeners":false,"inspect":false,"keys":false,"monitor":false,"monitorEvents":false,"profile":false,"profileEnd":false,"queryObjects":false,"table":false,"undebug":false,"unmonitor":false,"unmonitorEvents":false,"values":false}}')},4651:e=>{"use strict";e.exports=JSON.parse('{"assert":true,"assert/strict":">= 15","async_hooks":">= 8","buffer_ieee754":"< 0.9.7","buffer":true,"child_process":true,"cluster":true,"console":true,"constants":true,"crypto":true,"_debug_agent":">= 1 && < 8","_debugger":"< 8","dgram":true,"diagnostics_channel":">= 15.1","dns":true,"dns/promises":">= 15","domain":">= 0.7.12","events":true,"freelist":"< 6","fs":true,"fs/promises":[">= 10 && < 10.1",">= 14"],"_http_agent":">= 0.11.1","_http_client":">= 0.11.1","_http_common":">= 0.11.1","_http_incoming":">= 0.11.1","_http_outgoing":">= 0.11.1","_http_server":">= 0.11.1","http":true,"http2":">= 8.8","https":true,"inspector":">= 8.0.0","_linklist":"< 8","module":true,"net":true,"node-inspect/lib/_inspect":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6.0 && < 12","os":true,"path":true,"path/posix":">= 15.3","path/win32":">= 15.3","perf_hooks":">= 8.5","process":">= 1","punycode":true,"querystring":true,"readline":true,"repl":true,"smalloc":">= 0.11.5 && < 3","_stream_duplex":">= 0.9.4","_stream_transform":">= 0.9.4","_stream_wrap":">= 1.4.1","_stream_passthrough":">= 0.9.4","_stream_readable":">= 0.9.4","_stream_writable":">= 0.9.4","stream":true,"stream/promises":">= 15","string_decoder":true,"sys":[">= 0.6 && < 0.7",">= 0.8"],"timers":true,"timers/promises":">= 15","_tls_common":">= 0.11.13","_tls_legacy":">= 0.11.3 && < 10","_tls_wrap":">= 0.11.3","tls":true,"trace_events":">= 10","tty":true,"url":true,"util":true,"util/types":">= 15.3","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/consarray":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/csvparser":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/logreader":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/profile_view":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/splaytree":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8":">= 1","vm":true,"wasi":">= 13.4 && < 13.5","worker_threads":">= 11.7","zlib":true}')},4817:e=>{"use strict";e.exports=JSON.parse('{"es6.array.copy-within":{"chrome":"45","opera":"32","edge":"12","firefox":"32","safari":"9","node":"4","ios":"9","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.every":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.fill":{"chrome":"45","opera":"32","edge":"12","firefox":"31","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.filter":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.find":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.find-index":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es7.array.flat-map":{"chrome":"69","opera":"56","edge":"79","firefox":"62","safari":"12","node":"11","ios":"12","samsung":"10","electron":"4.0"},"es6.array.for-each":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.from":{"chrome":"51","opera":"38","edge":"15","firefox":"36","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.array.includes":{"chrome":"47","opera":"34","edge":"14","firefox":"43","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.array.index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.is-array":{"chrome":"5","opera":"10.50","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.iterator":{"chrome":"66","opera":"53","edge":"12","firefox":"60","safari":"9","node":"10","ios":"9","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es6.array.last-index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.map":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.of":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"9","node":"4","ios":"9","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.reduce":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.reduce-right":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.slice":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.some":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.sort":{"chrome":"63","opera":"50","edge":"12","firefox":"5","safari":"12","node":"10","ie":"9","ios":"12","samsung":"8","rhino":"1.7.13","electron":"3.0"},"es6.array.species":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.date.now":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-iso-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-json":{"chrome":"5","opera":"12.10","edge":"12","firefox":"4","safari":"10","node":"0.10","ie":"9","android":"4","ios":"10","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-primitive":{"chrome":"47","opera":"34","edge":"15","firefox":"44","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.date.to-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.function.bind":{"chrome":"7","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.function.has-instance":{"chrome":"51","opera":"38","edge":"15","firefox":"50","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.function.name":{"chrome":"5","opera":"10.50","edge":"14","firefox":"2","safari":"4","node":"0.10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.math.acosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.asinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.atanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.cbrt":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.clz32":{"chrome":"38","opera":"25","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.cosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.expm1":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.fround":{"chrome":"38","opera":"25","edge":"12","firefox":"26","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.hypot":{"chrome":"38","opera":"25","edge":"12","firefox":"27","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.imul":{"chrome":"30","opera":"17","edge":"12","firefox":"23","safari":"7","node":"0.12","android":"4.4","ios":"7","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.math.log1p":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.log10":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.log2":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.sign":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.sinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.tanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.trunc":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.number.constructor":{"chrome":"41","opera":"28","edge":"12","firefox":"36","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.number.epsilon":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.is-finite":{"chrome":"19","opera":"15","edge":"12","firefox":"16","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.number.is-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"16","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.is-nan":{"chrome":"19","opera":"15","edge":"12","firefox":"15","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.number.is-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"32","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.max-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.min-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.parse-float":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.parse-int":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.object.assign":{"chrome":"49","opera":"36","edge":"13","firefox":"36","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.object.create":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.object.define-getter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.define-setter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.define-property":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.object.define-properties":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.object.entries":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.freeze":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.get-own-property-descriptor":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es7.object.get-own-property-descriptors":{"chrome":"54","opera":"41","edge":"15","firefox":"50","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.get-own-property-names":{"chrome":"40","opera":"27","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.object.get-prototype-of":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es7.object.lookup-getter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.lookup-setter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.prevent-extensions":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.to-string":{"chrome":"57","opera":"44","edge":"15","firefox":"51","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es6.object.is":{"chrome":"19","opera":"15","edge":"12","firefox":"22","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.object.is-frozen":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.is-sealed":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.is-extensible":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.keys":{"chrome":"40","opera":"27","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.object.seal":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.set-prototype-of":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ie":"11","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es7.object.values":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.promise":{"chrome":"51","opera":"38","edge":"14","firefox":"45","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.promise.finally":{"chrome":"63","opera":"50","edge":"18","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"8","electron":"3.0"},"es6.reflect.apply":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.construct":{"chrome":"49","opera":"36","edge":"13","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.define-property":{"chrome":"49","opera":"36","edge":"13","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.delete-property":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-own-property-descriptor":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.has":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.is-extensible":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.own-keys":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.prevent-extensions":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.regexp.constructor":{"chrome":"50","opera":"37","edge":"79","firefox":"40","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.flags":{"chrome":"49","opera":"36","edge":"79","firefox":"37","safari":"9","node":"6","ios":"9","samsung":"5","electron":"0.37"},"es6.regexp.match":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"1.1"},"es6.regexp.replace":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.split":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.search":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"1.1"},"es6.regexp.to-string":{"chrome":"50","opera":"37","edge":"79","firefox":"39","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.symbol":{"chrome":"51","opera":"38","edge":"79","firefox":"51","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.symbol.async-iterator":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"es6.string.anchor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.big":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.blink":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.bold":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.code-point-at":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.ends-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.fixed":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontcolor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontsize":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.from-code-point":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.includes":{"chrome":"41","opera":"28","edge":"12","firefox":"40","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.italics":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.iterator":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.string.link":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es7.string.pad-start":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","rhino":"1.7.13","electron":"1.7"},"es7.string.pad-end":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","rhino":"1.7.13","electron":"1.7"},"es6.string.raw":{"chrome":"41","opera":"28","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.repeat":{"chrome":"41","opera":"28","edge":"12","firefox":"24","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.small":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.starts-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.strike":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sub":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sup":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.trim":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.string.trim-left":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es7.string.trim-right":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es6.typed.array-buffer":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.data-view":{"chrome":"5","opera":"12","edge":"12","firefox":"15","safari":"5.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.typed.int8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-clamped-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float64-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.weak-map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"},"es6.weak-set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"}}')},8392:e=>{"use strict";e.exports=JSON.parse('{"es6.module":{"chrome":"61","and_chr":"61","edge":"16","firefox":"60","and_ff":"60","node":"13.2.0","opera":"48","op_mob":"48","safari":"10.1","ios":"10.3","samsung":"8.2","android":"61","electron":"2.0","ios_saf":"10.3"}}')},5224:e=>{"use strict";e.exports=JSON.parse('{"transform-async-to-generator":["bugfix/transform-async-arrows-in-class"],"transform-parameters":["bugfix/transform-edge-default-parameters"],"transform-function-name":["bugfix/transform-edge-function-name"],"transform-block-scoping":["bugfix/transform-safari-block-shadowing","bugfix/transform-safari-for-shadowing"],"transform-template-literals":["bugfix/transform-tagged-template-caching"],"proposal-optional-chaining":["bugfix/transform-v8-spread-parameters-in-optional-chaining"]}')},4374:e=>{"use strict";e.exports=JSON.parse('{"transform-async-to-generator":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"10.1","node":"7.6","ios":"10.3","samsung":"6","electron":"1.6"},"bugfix/transform-async-arrows-in-class":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"11","node":"7.6","ios":"11","samsung":"6","electron":"1.6"},"transform-parameters":{"chrome":"49","opera":"36","edge":"15","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"bugfix/transform-edge-default-parameters":{"chrome":"49","opera":"36","edge":"18","firefox":"52","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"transform-function-name":{"chrome":"51","opera":"38","edge":"14","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"bugfix/transform-edge-function-name":{"chrome":"51","opera":"38","edge":"79","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-block-scoping":{"chrome":"49","opera":"36","edge":"14","firefox":"51","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"bugfix/transform-safari-block-shadowing":{"chrome":"49","opera":"36","edge":"12","firefox":"44","safari":"11","node":"6","ie":"11","ios":"11","samsung":"5","electron":"0.37"},"bugfix/transform-safari-for-shadowing":{"chrome":"49","opera":"36","edge":"12","firefox":"4","safari":"11","node":"6","ie":"11","ios":"11","samsung":"5","rhino":"1.7.13","electron":"0.37"},"transform-template-literals":{"chrome":"41","opera":"28","edge":"13","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"bugfix/transform-tagged-template-caching":{"chrome":"41","opera":"28","edge":"12","firefox":"34","safari":"13","node":"4","ios":"13","samsung":"3.4","electron":"0.21"},"proposal-optional-chaining":{"chrome":"80","opera":"67","edge":"80","firefox":"74","safari":"13.1","node":"14","ios":"13.4","samsung":"13","electron":"8.0"},"bugfix/transform-v8-spread-parameters-in-optional-chaining":{"firefox":"74","safari":"13.1","ios":"13.4"}}')},7867:e=>{"use strict";e.exports=JSON.parse('{"proposal-class-static-block":{"chrome":"91","electron":"13.0"},"proposal-private-property-in-object":{"chrome":"91","firefox":"90","electron":"13.0"},"proposal-class-properties":{"chrome":"74","opera":"62","edge":"79","firefox":"90","safari":"14.1","node":"12","samsung":"11","electron":"6.0"},"proposal-private-methods":{"chrome":"84","opera":"70","edge":"84","firefox":"90","safari":"15","node":"14.6","electron":"10.0"},"proposal-numeric-separator":{"chrome":"75","opera":"62","edge":"79","firefox":"70","safari":"13","node":"12.5","ios":"13","samsung":"11","electron":"6.0"},"proposal-logical-assignment-operators":{"chrome":"85","opera":"71","edge":"85","firefox":"79","safari":"14","node":"15","ios":"14","electron":"10.0"},"proposal-nullish-coalescing-operator":{"chrome":"80","opera":"67","edge":"80","firefox":"72","safari":"13.1","node":"14","ios":"13.4","samsung":"13","electron":"8.0"},"proposal-optional-chaining":{"firefox":"74","safari":"13.1","ios":"13.4"},"proposal-json-strings":{"chrome":"66","opera":"53","edge":"79","firefox":"62","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"proposal-optional-catch-binding":{"chrome":"66","opera":"53","edge":"79","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-parameters":{"chrome":"49","opera":"36","edge":"18","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"proposal-async-generator-functions":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"proposal-object-rest-spread":{"chrome":"60","opera":"47","edge":"79","firefox":"55","safari":"11.1","node":"8.3","ios":"11.3","samsung":"8","electron":"2.0"},"transform-dotall-regex":{"chrome":"62","opera":"49","edge":"79","firefox":"78","safari":"11.1","node":"8.10","ios":"11.3","samsung":"8","electron":"3.0"},"proposal-unicode-property-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-named-capturing-groups-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-async-to-generator":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"11","node":"7.6","ios":"11","samsung":"6","electron":"1.6"},"transform-exponentiation-operator":{"chrome":"52","opera":"39","edge":"14","firefox":"52","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.3"},"transform-template-literals":{"chrome":"41","opera":"28","edge":"13","firefox":"34","safari":"13","node":"4","ios":"13","samsung":"3.4","electron":"0.21"},"transform-literals":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-function-name":{"chrome":"51","opera":"38","edge":"79","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-arrow-functions":{"chrome":"47","opera":"34","edge":"13","firefox":"43","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"0.36"},"transform-block-scoped-functions":{"chrome":"41","opera":"28","edge":"12","firefox":"46","safari":"10","node":"4","ie":"11","ios":"10","samsung":"3.4","electron":"0.21"},"transform-classes":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-object-super":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-shorthand-properties":{"chrome":"43","opera":"30","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.27"},"transform-duplicate-keys":{"chrome":"42","opera":"29","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.25"},"transform-computed-properties":{"chrome":"44","opera":"31","edge":"12","firefox":"34","safari":"7.1","node":"4","ios":"8","samsung":"4","electron":"0.30"},"transform-for-of":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-sticky-regex":{"chrome":"49","opera":"36","edge":"13","firefox":"3","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"transform-unicode-escapes":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-unicode-regex":{"chrome":"50","opera":"37","edge":"13","firefox":"46","safari":"12","node":"6","ios":"12","samsung":"5","electron":"1.1"},"transform-spread":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-destructuring":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-block-scoping":{"chrome":"49","opera":"36","edge":"14","firefox":"51","safari":"11","node":"6","ios":"11","samsung":"5","electron":"0.37"},"transform-typeof-symbol":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"transform-new-target":{"chrome":"46","opera":"33","edge":"14","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-regenerator":{"chrome":"50","opera":"37","edge":"13","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"transform-member-expression-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"transform-property-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"transform-reserved-words":{"chrome":"13","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4.4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"proposal-export-namespace-from":{"chrome":"72","and_chr":"72","edge":"79","firefox":"80","and_ff":"80","node":"13.2","opera":"60","op_mob":"51","samsung":"11.0","android":"72","electron":"5.0"}}')},516:e=>{"use strict";e.exports=JSON.parse('{"es6.array.copy-within":{"chrome":"45","opera":"32","edge":"12","firefox":"32","safari":"9","node":"4","ios":"9","samsung":"5","electron":"0.31"},"es6.array.every":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.fill":{"chrome":"45","opera":"32","edge":"12","firefox":"31","safari":"7.1","node":"4","ios":"8","samsung":"5","electron":"0.31"},"es6.array.filter":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.find":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","electron":"0.31"},"es6.array.find-index":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","electron":"0.31"},"es7.array.flat-map":{"chrome":"69","opera":"56","edge":"79","firefox":"62","safari":"12","node":"11","ios":"12","samsung":"10","electron":"4.0"},"es6.array.for-each":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.from":{"chrome":"51","opera":"38","edge":"15","firefox":"36","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.array.includes":{"chrome":"47","opera":"34","edge":"14","firefox":"43","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.array.index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.is-array":{"chrome":"5","opera":"10.50","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.iterator":{"chrome":"66","opera":"53","edge":"12","firefox":"60","safari":"9","node":"10","ios":"9","samsung":"9","electron":"3.0"},"es6.array.last-index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.map":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.of":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"9","node":"4","ios":"9","samsung":"5","electron":"0.31"},"es6.array.reduce":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.reduce-right":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.slice":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.some":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.sort":{"chrome":"63","opera":"50","edge":"12","firefox":"5","safari":"12","node":"10","ie":"9","ios":"12","samsung":"8","electron":"3.0"},"es6.array.species":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.date.now":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.date.to-iso-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.date.to-json":{"chrome":"5","opera":"12.10","edge":"12","firefox":"4","safari":"10","node":"0.10","ie":"9","android":"4","ios":"10","samsung":"1","electron":"0.20"},"es6.date.to-primitive":{"chrome":"47","opera":"34","edge":"15","firefox":"44","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.date.to-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.function.bind":{"chrome":"7","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.function.has-instance":{"chrome":"51","opera":"38","edge":"15","firefox":"50","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.function.name":{"chrome":"5","opera":"10.50","edge":"14","firefox":"2","safari":"4","node":"0.10","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.math.acosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.asinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.atanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.cbrt":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.clz32":{"chrome":"38","opera":"25","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"es6.math.cosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.expm1":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.fround":{"chrome":"38","opera":"25","edge":"12","firefox":"26","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.hypot":{"chrome":"38","opera":"25","edge":"12","firefox":"27","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.imul":{"chrome":"30","opera":"17","edge":"12","firefox":"23","safari":"7","node":"0.12","android":"4.4","ios":"7","samsung":"2","electron":"0.20"},"es6.math.log1p":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.log10":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.log2":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.sign":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"es6.math.sinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.tanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.trunc":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.number.constructor":{"chrome":"41","opera":"28","edge":"12","firefox":"36","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.number.epsilon":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.is-finite":{"chrome":"19","opera":"15","edge":"12","firefox":"16","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","electron":"0.20"},"es6.number.is-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"16","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.is-nan":{"chrome":"19","opera":"15","edge":"12","firefox":"15","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","electron":"0.20"},"es6.number.is-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"32","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.max-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.min-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.parse-float":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.parse-int":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.object.assign":{"chrome":"49","opera":"36","edge":"13","firefox":"36","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.object.create":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es7.object.define-getter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.define-setter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.define-property":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.object.define-properties":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es7.object.entries":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.freeze":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.get-own-property-descriptor":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es7.object.get-own-property-descriptors":{"chrome":"54","opera":"41","edge":"15","firefox":"50","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.get-own-property-names":{"chrome":"40","opera":"27","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.object.get-prototype-of":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es7.object.lookup-getter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.lookup-setter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.prevent-extensions":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.to-string":{"chrome":"57","opera":"44","edge":"15","firefox":"51","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es6.object.is":{"chrome":"19","opera":"15","edge":"12","firefox":"22","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","electron":"0.20"},"es6.object.is-frozen":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.is-sealed":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.is-extensible":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.keys":{"chrome":"40","opera":"27","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.object.seal":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.set-prototype-of":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ie":"11","ios":"9","samsung":"2","electron":"0.20"},"es7.object.values":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.promise":{"chrome":"51","opera":"38","edge":"14","firefox":"45","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.promise.finally":{"chrome":"63","opera":"50","edge":"18","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"8","electron":"3.0"},"es6.reflect.apply":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.construct":{"chrome":"49","opera":"36","edge":"13","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.define-property":{"chrome":"49","opera":"36","edge":"13","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.delete-property":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-own-property-descriptor":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.has":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.is-extensible":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.own-keys":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.prevent-extensions":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.regexp.constructor":{"chrome":"50","opera":"37","edge":"79","firefox":"40","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.flags":{"chrome":"49","opera":"36","edge":"79","firefox":"37","safari":"9","node":"6","ios":"9","samsung":"5","electron":"0.37"},"es6.regexp.match":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.replace":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.split":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.search":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.to-string":{"chrome":"50","opera":"37","edge":"79","firefox":"39","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.symbol":{"chrome":"51","opera":"38","edge":"79","firefox":"51","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.symbol.async-iterator":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"es6.string.anchor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.big":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.blink":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.bold":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.code-point-at":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.ends-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.fixed":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontcolor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontsize":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.from-code-point":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.includes":{"chrome":"41","opera":"28","edge":"12","firefox":"40","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.italics":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.iterator":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"es6.string.link":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es7.string.pad-start":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es7.string.pad-end":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es6.string.raw":{"chrome":"41","opera":"28","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.repeat":{"chrome":"41","opera":"28","edge":"12","firefox":"24","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.small":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.starts-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.strike":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sub":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sup":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.trim":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es7.string.trim-left":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"es7.string.trim-right":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"es6.typed.array-buffer":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.data-view":{"chrome":"5","opera":"12","edge":"12","firefox":"15","safari":"5.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.typed.int8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-clamped-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float64-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.weak-map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"},"es6.weak-set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"}}')},5246:e=>{"use strict";e.exports=JSON.parse('{"es6.module":{"chrome":"61","and_chr":"61","edge":"16","firefox":"60","and_ff":"60","node":"13.2.0","opera":"48","op_mob":"48","safari":"10.1","ios":"10.3","samsung":"8.2","android":"61","electron":"2.0","ios_saf":"10.3"}}')},4812:e=>{"use strict";e.exports=JSON.parse('{"proposal-class-static-block":{"chrome":"91","electron":"13.0"},"proposal-private-property-in-object":{"chrome":"91","firefox":"90","electron":"13.0"},"proposal-class-properties":{"chrome":"74","opera":"62","edge":"79","firefox":"90","safari":"14.1","node":"12","samsung":"11","electron":"6.0"},"proposal-private-methods":{"chrome":"84","opera":"70","edge":"84","firefox":"90","safari":"15","node":"14.6","electron":"10.0"},"proposal-numeric-separator":{"chrome":"75","opera":"62","edge":"79","firefox":"70","safari":"13","node":"12.5","ios":"13","samsung":"11","electron":"6.0"},"proposal-logical-assignment-operators":{"chrome":"85","opera":"71","edge":"85","firefox":"79","safari":"14","node":"15","ios":"14","electron":"10.0"},"proposal-nullish-coalescing-operator":{"chrome":"80","opera":"67","edge":"80","firefox":"72","safari":"13.1","node":"14","ios":"13.4","samsung":"13","electron":"8.0"},"proposal-optional-chaining":{"firefox":"74","safari":"13.1","ios":"13.4"},"proposal-json-strings":{"chrome":"66","opera":"53","edge":"79","firefox":"62","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"proposal-optional-catch-binding":{"chrome":"66","opera":"53","edge":"79","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-parameters":{"chrome":"49","opera":"36","edge":"18","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"proposal-async-generator-functions":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"proposal-object-rest-spread":{"chrome":"60","opera":"47","edge":"79","firefox":"55","safari":"11.1","node":"8.3","ios":"11.3","samsung":"8","electron":"2.0"},"transform-dotall-regex":{"chrome":"62","opera":"49","edge":"79","firefox":"78","safari":"11.1","node":"8.10","ios":"11.3","samsung":"8","electron":"3.0"},"proposal-unicode-property-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-named-capturing-groups-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-async-to-generator":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"11","node":"7.6","ios":"11","samsung":"6","electron":"1.6"},"transform-exponentiation-operator":{"chrome":"52","opera":"39","edge":"14","firefox":"52","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.3"},"transform-template-literals":{"chrome":"41","opera":"28","edge":"13","firefox":"34","safari":"13","node":"4","ios":"13","samsung":"3.4","electron":"0.21"},"transform-literals":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-function-name":{"chrome":"51","opera":"38","edge":"79","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-arrow-functions":{"chrome":"47","opera":"34","edge":"13","firefox":"45","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"transform-block-scoped-functions":{"chrome":"41","opera":"28","edge":"12","firefox":"46","safari":"10","node":"4","ie":"11","ios":"10","samsung":"3.4","electron":"0.21"},"transform-classes":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-object-super":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-shorthand-properties":{"chrome":"43","opera":"30","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.27"},"transform-duplicate-keys":{"chrome":"42","opera":"29","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.25"},"transform-computed-properties":{"chrome":"44","opera":"31","edge":"12","firefox":"34","safari":"7.1","node":"4","ios":"8","samsung":"4","electron":"0.30"},"transform-for-of":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-sticky-regex":{"chrome":"49","opera":"36","edge":"13","firefox":"3","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"transform-unicode-escapes":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-unicode-regex":{"chrome":"50","opera":"37","edge":"13","firefox":"46","safari":"12","node":"6","ios":"12","samsung":"5","electron":"1.1"},"transform-spread":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-destructuring":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-block-scoping":{"chrome":"49","opera":"36","edge":"14","firefox":"51","safari":"11","node":"6","ios":"11","samsung":"5","electron":"0.37"},"transform-typeof-symbol":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"transform-new-target":{"chrome":"46","opera":"33","edge":"14","firefox":"41","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-regenerator":{"chrome":"50","opera":"37","edge":"13","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"transform-member-expression-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"transform-property-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"transform-reserved-words":{"chrome":"13","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4.4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"proposal-export-namespace-from":{"chrome":"72","and_chr":"72","edge":"79","firefox":"80","and_ff":"80","node":"13.2","opera":"60","op_mob":"51","samsung":"11.0","android":"72","electron":"5.0"}}')},935:e=>{"use strict";e.exports=JSON.parse('{"es.symbol":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.symbol.description":{"android":"70","chrome":"70","edge":"74","electron":"5.0","firefox":"63","ios":"12.2","node":"11.0","opera":"57","opera_mobile":"49","safari":"12.1","samsung":"10.0"},"es.symbol.async-iterator":{"android":"63","chrome":"63","edge":"74","electron":"3.0","firefox":"55","ios":"12.0","node":"10.0","opera":"50","opera_mobile":"46","safari":"12.0","samsung":"8.0"},"es.symbol.has-instance":{"android":"50","chrome":"50","edge":"15","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.is-concat-spreadable":{"android":"48","chrome":"48","edge":"15","electron":"0.37","firefox":"48","ios":"10.0","node":"6.0","opera":"35","opera_mobile":"35","safari":"10.0","samsung":"5.0"},"es.symbol.iterator":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"36","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.symbol.match":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"40","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.match-all":{"android":"73","chrome":"73","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.symbol.replace":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.search":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.species":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"41","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.symbol.split":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.to-primitive":{"android":"47","chrome":"47","edge":"15","electron":"0.36","firefox":"44","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.symbol.to-string-tag":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.symbol.unscopables":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"48","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.aggregate-error":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"es.array.concat":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.copy-within":{"android":"45","chrome":"45","edge":"12","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.every":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"9.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"8.0","samsung":"1.5"},"es.array.fill":{"android":"45","chrome":"45","edge":"12","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.filter":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.find":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.find-index":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.flat":{"android":"69","chrome":"69","edge":"74","electron":"4.0","firefox":"62","ios":"12.0","node":"11.0","opera":"56","opera_mobile":"48","safari":"12.0","samsung":"10.0"},"es.array.flat-map":{"android":"69","chrome":"69","edge":"74","electron":"4.0","firefox":"62","ios":"12.0","node":"11.0","opera":"56","opera_mobile":"48","safari":"12.0","samsung":"10.0"},"es.array.for-each":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"9.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"8.0","samsung":"1.5"},"es.array.from":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"9.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"9.0","samsung":"5.0"},"es.array.includes":{"android":"53","chrome":"53","edge":"14","electron":"1.4","firefox":"48","ios":"10.0","node":"7.0","opera":"40","opera_mobile":"40","safari":"10.0","samsung":"6.0"},"es.array.index-of":{"android":"51","chrome":"51","edge":"12","electron":"1.2","firefox":"4","ie":"9","ios":"9.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"8.0","samsung":"5.0"},"es.array.is-array":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"4.0","samsung":"1.0"},"es.array.iterator":{"android":"66","chrome":"66","edge":"15","electron":"3.0","firefox":"60","ios":"10.0","node":"10.0","opera":"53","opera_mobile":"47","safari":"10.0","samsung":"9.0"},"es.array.join":{"android":"4.4","chrome":"26","edge":"13","electron":"0.20","firefox":"4","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.array.last-index-of":{"android":"51","chrome":"51","edge":"12","electron":"1.2","firefox":"4","ie":"9","ios":"9.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"8.0","samsung":"5.0"},"es.array.map":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"50","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.of":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"25","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.reduce":{"android":"83","chrome":"83","edge":"12","electron":"9.0","firefox":"4","ie":"9","ios":"9.0","node":"6.0","opera":"69","opera_mobile":"59","safari":"8.0","samsung":"13.0"},"es.array.reduce-right":{"android":"83","chrome":"83","edge":"12","electron":"9.0","firefox":"4","ie":"9","ios":"9.0","node":"6.0","opera":"69","opera_mobile":"59","safari":"8.0","samsung":"13.0"},"es.array.reverse":{"android":"3.0","chrome":"1","edge":"12","electron":"0.20","firefox":"1","ie":"5.5","ios":"12.2","node":"0.0.3","opera":"10.50","opera_mobile":"10.50","safari":"12.0.2","samsung":"1.0"},"es.array.slice":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.some":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"9.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"8.0","samsung":"1.5"},"es.array.sort":{"android":"70","chrome":"70","edge":"74","electron":"5.0","firefox":"4","ios":"12.0","node":"11.0","opera":"57","opera_mobile":"49","safari":"12.0","samsung":"10.0"},"es.array.species":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.splice":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.unscopables.flat":{"android":"73","chrome":"73","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.array.unscopables.flat-map":{"android":"73","chrome":"73","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.array-buffer.constructor":{"android":"4.4","chrome":"26","edge":"14","electron":"0.20","firefox":"44","ios":"12.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"12.0","samsung":"1.5"},"es.array-buffer.is-view":{"android":"4.4.3","chrome":"32","edge":"12","electron":"0.20","firefox":"29","ie":"11","ios":"8.0","node":"0.11.9","opera":"19","opera_mobile":"19","safari":"7.1","samsung":"2.0"},"es.array-buffer.slice":{"android":"4.4.3","chrome":"31","edge":"12","electron":"0.20","firefox":"46","ie":"11","ios":"12.2","node":"0.11.8","opera":"18","opera_mobile":"18","safari":"12.1","samsung":"2.0"},"es.data-view":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"15","ie":"10","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.date.now":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ie":"9","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"4.0","samsung":"1.0"},"es.date.to-iso-string":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"7","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.date.to-json":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"10.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"10.0","samsung":"1.5"},"es.date.to-primitive":{"android":"47","chrome":"47","edge":"15","electron":"0.36","firefox":"44","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.date.to-string":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ie":"9","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.function.bind":{"android":"3.0","chrome":"7","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.101","opera":"12","opera_mobile":"12","phantom":"2.0","safari":"5.1","samsung":"1.0"},"es.function.has-instance":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"50","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.function.name":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"4.0","samsung":"1.0"},"es.global-this":{"android":"71","chrome":"71","edge":"74","electron":"5.0","firefox":"65","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"es.json.stringify":{"android":"72","chrome":"72","edge":"74","electron":"5.0","firefox":"64","ios":"12.2","node":"12.0","opera":"59","opera_mobile":"51","safari":"12.1","samsung":"11.0"},"es.json.to-string-tag":{"android":"50","chrome":"50","edge":"15","electron":"1.1","firefox":"51","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.map":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.math.acosh":{"android":"54","chrome":"54","edge":"13","electron":"1.4","firefox":"25","ios":"8.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"7.1","samsung":"6.0"},"es.math.asinh":{"android":"38","chrome":"38","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.atanh":{"android":"38","chrome":"38","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.cbrt":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.clz32":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"9.0","samsung":"3.0"},"es.math.cosh":{"android":"39","chrome":"39","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","safari":"7.1","samsung":"3.4"},"es.math.expm1":{"android":"39","chrome":"39","edge":"13","electron":"0.20","firefox":"46","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","safari":"7.1","samsung":"3.4"},"es.math.fround":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"26","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.hypot":{"android":"78","chrome":"78","edge":"12","electron":"7.0","firefox":"27","ios":"8.0","node":"13.0","opera":"65","opera_mobile":"56","safari":"7.1","samsung":"12.0"},"es.math.imul":{"android":"4.4","chrome":"28","edge":"13","electron":"0.20","firefox":"20","ios":"9.0","node":"0.11.1","opera":"16","opera_mobile":"16","safari":"9.0","samsung":"1.5"},"es.math.log10":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.log1p":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.log2":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.sign":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"9.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"9.0","samsung":"3.0"},"es.math.sinh":{"android":"39","chrome":"39","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","safari":"7.1","samsung":"3.4"},"es.math.tanh":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.to-string-tag":{"android":"50","chrome":"50","edge":"15","electron":"1.1","firefox":"51","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.math.trunc":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.number.constructor":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"46","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.number.epsilon":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"25","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.is-finite":{"android":"4.1","chrome":"19","edge":"12","electron":"0.20","firefox":"16","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","safari":"9.0","samsung":"1.5"},"es.number.is-integer":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"16","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.is-nan":{"android":"4.1","chrome":"19","edge":"12","electron":"0.20","firefox":"15","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","safari":"9.0","samsung":"1.5"},"es.number.is-safe-integer":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"32","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.max-safe-integer":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.min-safe-integer":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.parse-float":{"android":"37","chrome":"35","edge":"13","electron":"0.20","firefox":"39","ios":"11.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"11.0","samsung":"3.0"},"es.number.parse-int":{"android":"37","chrome":"35","edge":"13","electron":"0.20","firefox":"39","ios":"9.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"9.0","samsung":"3.0"},"es.number.to-fixed":{"android":"4.4","chrome":"26","edge":"74","electron":"0.20","firefox":"4","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.number.to-precision":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"8","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.object.assign":{"android":"49","chrome":"49","edge":"74","electron":"0.37","firefox":"36","ios":"9.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"9.0","samsung":"5.0"},"es.object.create":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"3.2","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"1.9","safari":"4.0","samsung":"1.0"},"es.object.define-getter":{"android":"62","chrome":"62","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","safari":"7.1","samsung":"8.0"},"es.object.define-properties":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"2.0","safari":"5.1","samsung":"1.0"},"es.object.define-property":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"2.0","safari":"5.1","samsung":"1.0"},"es.object.define-setter":{"android":"62","chrome":"62","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","safari":"7.1","samsung":"8.0"},"es.object.entries":{"android":"54","chrome":"54","edge":"14","electron":"1.4","firefox":"47","ios":"10.3","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.1","samsung":"6.0"},"es.object.freeze":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.from-entries":{"android":"73","chrome":"73","edge":"74","electron":"5.0","firefox":"63","ios":"12.2","node":"12.0","opera":"60","opera_mobile":"52","safari":"12.1","samsung":"11.0"},"es.object.get-own-property-descriptor":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.get-own-property-descriptors":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"50","ios":"10.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.0","samsung":"6.0"},"es.object.get-own-property-names":{"android":"40","chrome":"40","edge":"13","electron":"0.21","firefox":"34","ios":"9.0","node":"1.0","opera":"27","opera_mobile":"27","safari":"9.0","samsung":"3.4"},"es.object.get-prototype-of":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.is":{"android":"4.1","chrome":"19","edge":"12","electron":"0.20","firefox":"22","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","safari":"9.0","samsung":"1.5"},"es.object.is-extensible":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.is-frozen":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.is-sealed":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.keys":{"android":"40","chrome":"40","edge":"13","electron":"0.21","firefox":"35","ios":"9.0","node":"1.0","opera":"27","opera_mobile":"27","safari":"9.0","samsung":"3.4"},"es.object.lookup-getter":{"android":"62","chrome":"62","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","safari":"7.1","samsung":"8.0"},"es.object.lookup-setter":{"android":"62","chrome":"62","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","safari":"7.1","samsung":"8.0"},"es.object.prevent-extensions":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.seal":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.set-prototype-of":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"31","ie":"11","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.object.to-string":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.object.values":{"android":"54","chrome":"54","edge":"14","electron":"1.4","firefox":"47","ios":"10.3","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.1","samsung":"6.0"},"es.parse-float":{"android":"37","chrome":"35","edge":"12","electron":"0.20","firefox":"8","ie":"8","ios":"8.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"7.1","samsung":"3.0"},"es.parse-int":{"android":"37","chrome":"35","edge":"12","electron":"0.20","firefox":"21","ie":"9","ios":"8.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"7.1","samsung":"3.0"},"es.promise":{"android":"67","chrome":"67","edge":"74","electron":"4.0","firefox":"69","ios":"11.0","node":"10.4","opera":"54","opera_mobile":"48","safari":"11.0","samsung":"9.0"},"es.promise.all-settled":{"android":"76","chrome":"76","edge":"76","electron":"6.0","firefox":"71","ios":"13.0","node":"12.9","opera":"63","opera_mobile":"54","safari":"13","samsung":"12.0"},"es.promise.any":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"es.promise.finally":{"android":"67","chrome":"67","edge":"74","electron":"4.0","firefox":"69","ios":"13.2.3","node":"10.4","opera":"54","opera_mobile":"48","safari":"13.0.3","samsung":"9.0"},"es.reflect.apply":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.construct":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"44","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.define-property":{"android":"49","chrome":"49","edge":"13","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.delete-property":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get-own-property-descriptor":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get-prototype-of":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.has":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.is-extensible":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.own-keys":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.prevent-extensions":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.set":{"android":"49","chrome":"49","edge":"74","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.set-prototype-of":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.to-string-tag":{"android":"86","chrome":"86","edge":"86","electron":"11.0","firefox":"82","ios":"14.0","node":"15.0","opera":"72","opera_mobile":"61","safari":"14.0","samsung":"14.0"},"es.regexp.constructor":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.regexp.exec":{"android":"4.4","chrome":"26","edge":"13","electron":"0.20","firefox":"44","ios":"10.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"10.0","samsung":"1.5"},"es.regexp.flags":{"android":"49","chrome":"49","edge":"74","electron":"0.37","firefox":"37","ios":"9.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"9.0","samsung":"5.0"},"es.regexp.sticky":{"android":"49","chrome":"49","edge":"13","electron":"0.37","firefox":"3","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.regexp.test":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"46","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.regexp.to-string":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"46","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.set":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.code-point-at":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"29","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.ends-with":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.from-code-point":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"29","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.includes":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.iterator":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"36","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.match":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.match-all":{"android":"80","chrome":"80","edge":"80","electron":"8.0","firefox":"73","ios":"13.4","node":"14.0","opera":"67","opera_mobile":"57","safari":"13.1","samsung":"13.0"},"es.string.pad-end":{"android":"57","chrome":"57","edge":"15","electron":"1.7","firefox":"48","ios":"11.0","node":"8.0","opera":"44","opera_mobile":"43","safari":"11.0","samsung":"7.0"},"es.string.pad-start":{"android":"57","chrome":"57","edge":"15","electron":"1.7","firefox":"48","ios":"11.0","node":"8.0","opera":"44","opera_mobile":"43","safari":"11.0","samsung":"7.0"},"es.string.raw":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"34","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.repeat":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"24","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.replace":{"android":"64","chrome":"64","edge":"74","electron":"3.0","firefox":"78","ios":"14.0","node":"10.0","opera":"51","opera_mobile":"47","safari":"14.0","samsung":"9.0"},"es.string.replace-all":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"77","ios":"13.4","node":"15.0","opera":"71","opera_mobile":"60","safari":"13.1","samsung":"14.0"},"es.string.search":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.split":{"android":"54","chrome":"54","edge":"74","electron":"1.4","firefox":"49","ios":"10.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.0","samsung":"6.0"},"es.string.starts-with":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.trim":{"android":"59","chrome":"59","edge":"15","electron":"1.8","firefox":"52","ios":"12.2","node":"8.3","opera":"46","opera_mobile":"43","safari":"12.1","samsung":"7.0"},"es.string.trim-end":{"android":"66","chrome":"66","edge":"74","electron":"3.0","firefox":"61","ios":"12.2","node":"10.0","opera":"53","opera_mobile":"47","safari":"12.1","samsung":"9.0"},"es.string.trim-start":{"android":"66","chrome":"66","edge":"74","electron":"3.0","firefox":"61","ios":"12.0","node":"10.0","opera":"53","opera_mobile":"47","safari":"12.0","samsung":"9.0"},"es.string.anchor":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.big":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.blink":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.bold":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.fixed":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.fontcolor":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.fontsize":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.italics":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.link":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.small":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.strike":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.sub":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.sup":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.typed-array.float32-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.float64-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int8-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int16-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int32-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint8-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint8-clamped-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint16-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint32-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.copy-within":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"34","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.every":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.fill":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.filter":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.find":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.find-index":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.for-each":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.from":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.includes":{"android":"49","chrome":"49","edge":"14","electron":"0.37","firefox":"43","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.typed-array.index-of":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.iterator":{"android":"47","chrome":"47","edge":"13","electron":"0.36","firefox":"37","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.typed-array.join":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.last-index-of":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.map":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.of":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.reduce":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.reduce-right":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.reverse":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.set":{"android":"4.4","chrome":"26","edge":"13","electron":"0.20","firefox":"15","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.typed-array.slice":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.some":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.sort":{"android":"74","chrome":"74","edge":"74","electron":"6.0","firefox":"67","ios":"14.5","node":"12.0","opera":"61","opera_mobile":"53","safari":"14.1","samsung":"11.0"},"es.typed-array.subarray":{"android":"4.4","chrome":"26","edge":"13","electron":"0.20","firefox":"15","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.typed-array.to-locale-string":{"android":"45","chrome":"45","edge":"74","electron":"0.31","firefox":"51","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.to-string":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"51","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.weak-map":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.weak-set":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"esnext.aggregate-error":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"esnext.array.at":{"android":"92","chrome":"92","edge":"92","electron":"14.0","opera":"78"},"esnext.array.filter-out":{},"esnext.array.find-last":{},"esnext.array.find-last-index":{},"esnext.array.is-template-object":{},"esnext.array.last-index":{},"esnext.array.last-item":{},"esnext.array.unique-by":{},"esnext.async-iterator.constructor":{},"esnext.async-iterator.as-indexed-pairs":{},"esnext.async-iterator.drop":{},"esnext.async-iterator.every":{},"esnext.async-iterator.filter":{},"esnext.async-iterator.find":{},"esnext.async-iterator.flat-map":{},"esnext.async-iterator.for-each":{},"esnext.async-iterator.from":{},"esnext.async-iterator.map":{},"esnext.async-iterator.reduce":{},"esnext.async-iterator.some":{},"esnext.async-iterator.take":{},"esnext.async-iterator.to-array":{},"esnext.bigint.range":{},"esnext.composite-key":{},"esnext.composite-symbol":{},"esnext.global-this":{"android":"71","chrome":"71","edge":"74","electron":"5.0","firefox":"65","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"esnext.iterator.constructor":{},"esnext.iterator.as-indexed-pairs":{},"esnext.iterator.drop":{},"esnext.iterator.every":{},"esnext.iterator.filter":{},"esnext.iterator.find":{},"esnext.iterator.flat-map":{},"esnext.iterator.for-each":{},"esnext.iterator.from":{},"esnext.iterator.map":{},"esnext.iterator.reduce":{},"esnext.iterator.some":{},"esnext.iterator.take":{},"esnext.iterator.to-array":{},"esnext.map.delete-all":{},"esnext.map.emplace":{},"esnext.map.every":{},"esnext.map.filter":{},"esnext.map.find":{},"esnext.map.find-key":{},"esnext.map.from":{},"esnext.map.group-by":{},"esnext.map.includes":{},"esnext.map.key-by":{},"esnext.map.key-of":{},"esnext.map.map-keys":{},"esnext.map.map-values":{},"esnext.map.merge":{},"esnext.map.of":{},"esnext.map.reduce":{},"esnext.map.some":{},"esnext.map.update":{},"esnext.map.update-or-insert":{},"esnext.map.upsert":{},"esnext.math.clamp":{},"esnext.math.deg-per-rad":{},"esnext.math.degrees":{},"esnext.math.fscale":{},"esnext.math.iaddh":{},"esnext.math.imulh":{},"esnext.math.isubh":{},"esnext.math.rad-per-deg":{},"esnext.math.radians":{},"esnext.math.scale":{},"esnext.math.seeded-prng":{},"esnext.math.signbit":{},"esnext.math.umulh":{},"esnext.number.from-string":{},"esnext.number.range":{},"esnext.object.has-own":{},"esnext.object.iterate-entries":{},"esnext.object.iterate-keys":{},"esnext.object.iterate-values":{},"esnext.observable":{},"esnext.promise.all-settled":{"android":"76","chrome":"76","edge":"76","electron":"6.0","firefox":"71","ios":"13.0","node":"12.9","opera":"63","opera_mobile":"54","safari":"13","samsung":"12.0"},"esnext.promise.any":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"esnext.promise.try":{},"esnext.reflect.define-metadata":{},"esnext.reflect.delete-metadata":{},"esnext.reflect.get-metadata":{},"esnext.reflect.get-metadata-keys":{},"esnext.reflect.get-own-metadata":{},"esnext.reflect.get-own-metadata-keys":{},"esnext.reflect.has-metadata":{},"esnext.reflect.has-own-metadata":{},"esnext.reflect.metadata":{},"esnext.set.add-all":{},"esnext.set.delete-all":{},"esnext.set.difference":{},"esnext.set.every":{},"esnext.set.filter":{},"esnext.set.find":{},"esnext.set.from":{},"esnext.set.intersection":{},"esnext.set.is-disjoint-from":{},"esnext.set.is-subset-of":{},"esnext.set.is-superset-of":{},"esnext.set.join":{},"esnext.set.map":{},"esnext.set.of":{},"esnext.set.reduce":{},"esnext.set.some":{},"esnext.set.symmetric-difference":{},"esnext.set.union":{},"esnext.string.at":{},"esnext.string.code-points":{},"esnext.string.match-all":{"android":"80","chrome":"80","edge":"80","electron":"8.0","firefox":"73","ios":"13.4","node":"14.0","opera":"67","opera_mobile":"57","safari":"13.1","samsung":"13.0"},"esnext.string.replace-all":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"77","ios":"13.4","node":"15.0","opera":"71","opera_mobile":"60","safari":"13.1","samsung":"14.0"},"esnext.symbol.async-dispose":{},"esnext.symbol.dispose":{},"esnext.symbol.matcher":{},"esnext.symbol.metadata":{},"esnext.symbol.observable":{},"esnext.symbol.pattern-match":{},"esnext.symbol.replace-all":{},"esnext.typed-array.at":{"android":"92","chrome":"92","edge":"92","electron":"14.0","opera":"78"},"esnext.typed-array.filter-out":{},"esnext.typed-array.find-last":{},"esnext.typed-array.find-last-index":{},"esnext.typed-array.unique-by":{},"esnext.weak-map.delete-all":{},"esnext.weak-map.from":{},"esnext.weak-map.of":{},"esnext.weak-map.emplace":{},"esnext.weak-map.upsert":{},"esnext.weak-set.add-all":{},"esnext.weak-set.delete-all":{},"esnext.weak-set.from":{},"esnext.weak-set.of":{},"web.dom-collections.for-each":{"android":"58","chrome":"58","edge":"16","electron":"1.7","firefox":"50","ios":"10.0","node":"0.0.1","opera":"45","opera_mobile":"43","safari":"10.0","samsung":"7.0"},"web.dom-collections.iterator":{"android":"66","chrome":"66","edge":"74","electron":"3.0","firefox":"60","ios":"13.4","node":"0.0.1","opera":"53","opera_mobile":"47","safari":"13.1","samsung":"9.0"},"web.immediate":{"ie":"10","node":"0.9.1"},"web.queue-microtask":{"android":"71","chrome":"71","edge":"74","electron":"5.0","firefox":"69","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"web.timers":{"android":"1.5","chrome":"1","edge":"12","electron":"0.20","firefox":"1","ie":"10","ios":"1.0","node":"0.0.1","opera":"7","opera_mobile":"7","phantom":"1.9","safari":"1.0","samsung":"1.0"},"web.url":{"android":"67","chrome":"67","edge":"74","electron":"4.0","firefox":"57","ios":"14.0","node":"10.0","opera":"54","opera_mobile":"48","safari":"14.0","samsung":"9.0"},"web.url.to-json":{"android":"71","chrome":"71","edge":"74","electron":"5.0","firefox":"57","ios":"14.0","node":"10.0","opera":"58","opera_mobile":"50","safari":"14.0","samsung":"10.0"},"web.url-search-params":{"android":"67","chrome":"67","edge":"74","electron":"4.0","firefox":"57","ios":"14.0","node":"10.0","opera":"54","opera_mobile":"48","safari":"14.0","samsung":"9.0"}}')},4323:e=>{"use strict";e.exports=JSON.parse('{"core-js":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"core-js/es":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set"],"core-js/es/aggregate-error":["es.aggregate-error","es.string.iterator","web.dom-collections.iterator"],"core-js/es/array":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.string.iterator"],"core-js/es/array-buffer":["es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.object.to-string"],"core-js/es/array-buffer/constructor":["es.array-buffer.constructor","es.object.to-string"],"core-js/es/array-buffer/is-view":["es.array-buffer.is-view"],"core-js/es/array-buffer/slice":["es.array-buffer.slice"],"core-js/es/array/concat":["es.array.concat"],"core-js/es/array/copy-within":["es.array.copy-within"],"core-js/es/array/entries":["es.array.iterator"],"core-js/es/array/every":["es.array.every"],"core-js/es/array/fill":["es.array.fill"],"core-js/es/array/filter":["es.array.filter"],"core-js/es/array/find":["es.array.find"],"core-js/es/array/find-index":["es.array.find-index"],"core-js/es/array/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/es/array/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/es/array/for-each":["es.array.for-each"],"core-js/es/array/from":["es.array.from","es.string.iterator"],"core-js/es/array/includes":["es.array.includes"],"core-js/es/array/index-of":["es.array.index-of"],"core-js/es/array/is-array":["es.array.is-array"],"core-js/es/array/iterator":["es.array.iterator"],"core-js/es/array/join":["es.array.join"],"core-js/es/array/keys":["es.array.iterator"],"core-js/es/array/last-index-of":["es.array.last-index-of"],"core-js/es/array/map":["es.array.map"],"core-js/es/array/of":["es.array.of"],"core-js/es/array/reduce":["es.array.reduce"],"core-js/es/array/reduce-right":["es.array.reduce-right"],"core-js/es/array/reverse":["es.array.reverse"],"core-js/es/array/slice":["es.array.slice"],"core-js/es/array/some":["es.array.some"],"core-js/es/array/sort":["es.array.sort"],"core-js/es/array/splice":["es.array.splice"],"core-js/es/array/values":["es.array.iterator"],"core-js/es/array/virtual":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.includes","es.array.index-of","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map"],"core-js/es/array/virtual/concat":["es.array.concat"],"core-js/es/array/virtual/copy-within":["es.array.copy-within"],"core-js/es/array/virtual/entries":["es.array.iterator"],"core-js/es/array/virtual/every":["es.array.every"],"core-js/es/array/virtual/fill":["es.array.fill"],"core-js/es/array/virtual/filter":["es.array.filter"],"core-js/es/array/virtual/filter-out":["esnext.array.filter-out"],"core-js/es/array/virtual/find":["es.array.find"],"core-js/es/array/virtual/find-index":["es.array.find-index"],"core-js/es/array/virtual/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/es/array/virtual/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/es/array/virtual/for-each":["es.array.for-each"],"core-js/es/array/virtual/includes":["es.array.includes"],"core-js/es/array/virtual/index-of":["es.array.index-of"],"core-js/es/array/virtual/iterator":["es.array.iterator"],"core-js/es/array/virtual/join":["es.array.join"],"core-js/es/array/virtual/keys":["es.array.iterator"],"core-js/es/array/virtual/last-index-of":["es.array.last-index-of"],"core-js/es/array/virtual/map":["es.array.map"],"core-js/es/array/virtual/reduce":["es.array.reduce"],"core-js/es/array/virtual/reduce-right":["es.array.reduce-right"],"core-js/es/array/virtual/reverse":["es.array.reverse"],"core-js/es/array/virtual/slice":["es.array.slice"],"core-js/es/array/virtual/some":["es.array.some"],"core-js/es/array/virtual/sort":["es.array.sort"],"core-js/es/array/virtual/splice":["es.array.splice"],"core-js/es/array/virtual/values":["es.array.iterator"],"core-js/es/data-view":["es.data-view","es.object.to-string"],"core-js/es/date":["es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string"],"core-js/es/date/now":["es.date.now"],"core-js/es/date/to-iso-string":["es.date.to-iso-string","es.date.to-json"],"core-js/es/date/to-json":["es.date.to-json"],"core-js/es/date/to-primitive":["es.date.to-primitive"],"core-js/es/date/to-string":["es.date.to-string"],"core-js/es/function":["es.function.bind","es.function.has-instance","es.function.name"],"core-js/es/function/bind":["es.function.bind"],"core-js/es/function/has-instance":["es.function.has-instance"],"core-js/es/function/name":["es.function.name"],"core-js/es/function/virtual":["es.function.bind"],"core-js/es/function/virtual/bind":["es.function.bind"],"core-js/es/global-this":["es.global-this"],"core-js/es/instance/bind":["es.function.bind"],"core-js/es/instance/code-point-at":["es.string.code-point-at"],"core-js/es/instance/concat":["es.array.concat"],"core-js/es/instance/copy-within":["es.array.copy-within"],"core-js/es/instance/ends-with":["es.string.ends-with"],"core-js/es/instance/entries":["es.array.iterator"],"core-js/es/instance/every":["es.array.every"],"core-js/es/instance/fill":["es.array.fill"],"core-js/es/instance/filter":["es.array.filter"],"core-js/es/instance/find":["es.array.find"],"core-js/es/instance/find-index":["es.array.find-index"],"core-js/es/instance/flags":["es.regexp.flags"],"core-js/es/instance/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/es/instance/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/es/instance/for-each":["es.array.for-each"],"core-js/es/instance/includes":["es.array.includes","es.string.includes"],"core-js/es/instance/index-of":["es.array.index-of"],"core-js/es/instance/keys":["es.array.iterator"],"core-js/es/instance/last-index-of":["es.array.last-index-of"],"core-js/es/instance/map":["es.array.map"],"core-js/es/instance/match-all":["es.string.match-all"],"core-js/es/instance/pad-end":["es.string.pad-end"],"core-js/es/instance/pad-start":["es.string.pad-start"],"core-js/es/instance/reduce":["es.array.reduce"],"core-js/es/instance/reduce-right":["es.array.reduce-right"],"core-js/es/instance/repeat":["es.string.repeat"],"core-js/es/instance/replace-all":["es.string.replace-all"],"core-js/es/instance/reverse":["es.array.reverse"],"core-js/es/instance/slice":["es.array.slice"],"core-js/es/instance/some":["es.array.some"],"core-js/es/instance/sort":["es.array.sort"],"core-js/es/instance/splice":["es.array.splice"],"core-js/es/instance/starts-with":["es.string.starts-with"],"core-js/es/instance/trim":["es.string.trim"],"core-js/es/instance/trim-end":["es.string.trim-end"],"core-js/es/instance/trim-left":["es.string.trim-start"],"core-js/es/instance/trim-right":["es.string.trim-end"],"core-js/es/instance/trim-start":["es.string.trim-start"],"core-js/es/instance/values":["es.array.iterator"],"core-js/es/json":["es.json.stringify","es.json.to-string-tag"],"core-js/es/json/stringify":["es.json.stringify"],"core-js/es/json/to-string-tag":["es.json.to-string-tag"],"core-js/es/map":["es.map","es.object.to-string","es.string.iterator","web.dom-collections.iterator"],"core-js/es/math":["es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc"],"core-js/es/math/acosh":["es.math.acosh"],"core-js/es/math/asinh":["es.math.asinh"],"core-js/es/math/atanh":["es.math.atanh"],"core-js/es/math/cbrt":["es.math.cbrt"],"core-js/es/math/clz32":["es.math.clz32"],"core-js/es/math/cosh":["es.math.cosh"],"core-js/es/math/expm1":["es.math.expm1"],"core-js/es/math/fround":["es.math.fround"],"core-js/es/math/hypot":["es.math.hypot"],"core-js/es/math/imul":["es.math.imul"],"core-js/es/math/log10":["es.math.log10"],"core-js/es/math/log1p":["es.math.log1p"],"core-js/es/math/log2":["es.math.log2"],"core-js/es/math/sign":["es.math.sign"],"core-js/es/math/sinh":["es.math.sinh"],"core-js/es/math/tanh":["es.math.tanh"],"core-js/es/math/to-string-tag":["es.math.to-string-tag"],"core-js/es/math/trunc":["es.math.trunc"],"core-js/es/number":["es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision"],"core-js/es/number/constructor":["es.number.constructor"],"core-js/es/number/epsilon":["es.number.epsilon"],"core-js/es/number/is-finite":["es.number.is-finite"],"core-js/es/number/is-integer":["es.number.is-integer"],"core-js/es/number/is-nan":["es.number.is-nan"],"core-js/es/number/is-safe-integer":["es.number.is-safe-integer"],"core-js/es/number/max-safe-integer":["es.number.max-safe-integer"],"core-js/es/number/min-safe-integer":["es.number.min-safe-integer"],"core-js/es/number/parse-float":["es.number.parse-float"],"core-js/es/number/parse-int":["es.number.parse-int"],"core-js/es/number/to-fixed":["es.number.to-fixed"],"core-js/es/number/to-precision":["es.number.to-precision"],"core-js/es/number/virtual":["es.number.to-fixed","es.number.to-precision"],"core-js/es/number/virtual/to-fixed":["es.number.to-fixed"],"core-js/es/number/virtual/to-precision":["es.number.to-precision"],"core-js/es/object":["es.symbol","es.json.to-string-tag","es.math.to-string-tag","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.reflect.to-string-tag"],"core-js/es/object/assign":["es.object.assign"],"core-js/es/object/create":["es.object.create"],"core-js/es/object/define-getter":["es.object.define-getter"],"core-js/es/object/define-properties":["es.object.define-properties"],"core-js/es/object/define-property":["es.object.define-property"],"core-js/es/object/define-setter":["es.object.define-setter"],"core-js/es/object/entries":["es.object.entries"],"core-js/es/object/freeze":["es.object.freeze"],"core-js/es/object/from-entries":["es.array.iterator","es.object.from-entries"],"core-js/es/object/get-own-property-descriptor":["es.object.get-own-property-descriptor"],"core-js/es/object/get-own-property-descriptors":["es.object.get-own-property-descriptors"],"core-js/es/object/get-own-property-names":["es.object.get-own-property-names"],"core-js/es/object/get-own-property-symbols":["es.symbol"],"core-js/es/object/get-prototype-of":["es.object.get-prototype-of"],"core-js/es/object/is":["es.object.is"],"core-js/es/object/is-extensible":["es.object.is-extensible"],"core-js/es/object/is-frozen":["es.object.is-frozen"],"core-js/es/object/is-sealed":["es.object.is-sealed"],"core-js/es/object/keys":["es.object.keys"],"core-js/es/object/lookup-getter":["es.object.lookup-setter"],"core-js/es/object/lookup-setter":["es.object.lookup-setter"],"core-js/es/object/prevent-extensions":["es.object.prevent-extensions"],"core-js/es/object/seal":["es.object.seal"],"core-js/es/object/set-prototype-of":["es.object.set-prototype-of"],"core-js/es/object/to-string":["es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/es/object/values":["es.object.values"],"core-js/es/parse-float":["es.parse-float"],"core-js/es/parse-int":["es.parse-int"],"core-js/es/promise":["es.aggregate-error","es.object.to-string","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.string.iterator","web.dom-collections.iterator"],"core-js/es/promise/all-settled":["es.promise","es.promise.all-settled","es.string.iterator","web.dom-collections.iterator"],"core-js/es/promise/any":["es.aggregate-error","es.promise","es.promise.any","es.string.iterator","web.dom-collections.iterator"],"core-js/es/promise/finally":["es.promise","es.promise.finally"],"core-js/es/reflect":["es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag"],"core-js/es/reflect/apply":["es.reflect.apply"],"core-js/es/reflect/construct":["es.reflect.construct"],"core-js/es/reflect/define-property":["es.reflect.define-property"],"core-js/es/reflect/delete-property":["es.reflect.delete-property"],"core-js/es/reflect/get":["es.reflect.get"],"core-js/es/reflect/get-own-property-descriptor":["es.reflect.get-own-property-descriptor"],"core-js/es/reflect/get-prototype-of":["es.reflect.get-prototype-of"],"core-js/es/reflect/has":["es.reflect.has"],"core-js/es/reflect/is-extensible":["es.reflect.is-extensible"],"core-js/es/reflect/own-keys":["es.reflect.own-keys"],"core-js/es/reflect/prevent-extensions":["es.reflect.prevent-extensions"],"core-js/es/reflect/set":["es.reflect.set"],"core-js/es/reflect/set-prototype-of":["es.reflect.set-prototype-of"],"core-js/es/reflect/to-string-tag":["es.reflect.to-string-tag"],"core-js/es/regexp":["es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.string.match","es.string.replace","es.string.search","es.string.split"],"core-js/es/regexp/constructor":["es.regexp.constructor"],"core-js/es/regexp/flags":["es.regexp.flags"],"core-js/es/regexp/match":["es.string.match"],"core-js/es/regexp/replace":["es.string.replace"],"core-js/es/regexp/search":["es.string.search"],"core-js/es/regexp/split":["es.string.split"],"core-js/es/regexp/sticky":["es.regexp.sticky"],"core-js/es/regexp/test":["es.regexp.exec","es.regexp.test"],"core-js/es/regexp/to-string":["es.regexp.to-string"],"core-js/es/set":["es.object.to-string","es.set","es.string.iterator","web.dom-collections.iterator"],"core-js/es/string":["es.regexp.exec","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup"],"core-js/es/string/anchor":["es.string.anchor"],"core-js/es/string/big":["es.string.big"],"core-js/es/string/blink":["es.string.blink"],"core-js/es/string/bold":["es.string.bold"],"core-js/es/string/code-point-at":["es.string.code-point-at"],"core-js/es/string/ends-with":["es.string.ends-with"],"core-js/es/string/fixed":["es.string.fixed"],"core-js/es/string/fontcolor":["es.string.fontcolor"],"core-js/es/string/fontsize":["es.string.fontsize"],"core-js/es/string/from-code-point":["es.string.from-code-point"],"core-js/es/string/includes":["es.string.includes"],"core-js/es/string/italics":["es.string.italics"],"core-js/es/string/iterator":["es.string.iterator"],"core-js/es/string/link":["es.string.link"],"core-js/es/string/match":["es.regexp.exec","es.string.match"],"core-js/es/string/match-all":["es.string.match-all"],"core-js/es/string/pad-end":["es.string.pad-end"],"core-js/es/string/pad-start":["es.string.pad-start"],"core-js/es/string/raw":["es.string.raw"],"core-js/es/string/repeat":["es.string.repeat"],"core-js/es/string/replace":["es.regexp.exec","es.string.replace"],"core-js/es/string/replace-all":["es.string.replace-all"],"core-js/es/string/search":["es.regexp.exec","es.string.search"],"core-js/es/string/small":["es.string.small"],"core-js/es/string/split":["es.regexp.exec","es.string.split"],"core-js/es/string/starts-with":["es.string.starts-with"],"core-js/es/string/strike":["es.string.strike"],"core-js/es/string/sub":["es.string.sub"],"core-js/es/string/sup":["es.string.sup"],"core-js/es/string/trim":["es.string.trim"],"core-js/es/string/trim-end":["es.string.trim-end"],"core-js/es/string/trim-left":["es.string.trim-start"],"core-js/es/string/trim-right":["es.string.trim-end"],"core-js/es/string/trim-start":["es.string.trim-start"],"core-js/es/string/virtual":["es.string.code-point-at","es.string.ends-with","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup"],"core-js/es/string/virtual/anchor":["es.string.anchor"],"core-js/es/string/virtual/big":["es.string.big"],"core-js/es/string/virtual/blink":["es.string.blink"],"core-js/es/string/virtual/bold":["es.string.bold"],"core-js/es/string/virtual/code-point-at":["es.string.code-point-at"],"core-js/es/string/virtual/ends-with":["es.string.ends-with"],"core-js/es/string/virtual/fixed":["es.string.fixed"],"core-js/es/string/virtual/fontcolor":["es.string.fontcolor"],"core-js/es/string/virtual/fontsize":["es.string.fontsize"],"core-js/es/string/virtual/includes":["es.string.includes"],"core-js/es/string/virtual/italics":["es.string.italics"],"core-js/es/string/virtual/iterator":["es.string.iterator"],"core-js/es/string/virtual/link":["es.string.link"],"core-js/es/string/virtual/match-all":["es.string.match-all"],"core-js/es/string/virtual/pad-end":["es.string.pad-end"],"core-js/es/string/virtual/pad-start":["es.string.pad-start"],"core-js/es/string/virtual/repeat":["es.string.repeat"],"core-js/es/string/virtual/replace-all":["es.string.replace-all"],"core-js/es/string/virtual/small":["es.string.small"],"core-js/es/string/virtual/starts-with":["es.string.starts-with"],"core-js/es/string/virtual/strike":["es.string.strike"],"core-js/es/string/virtual/sub":["es.string.sub"],"core-js/es/string/virtual/sup":["es.string.sup"],"core-js/es/string/virtual/trim":["es.string.trim"],"core-js/es/string/virtual/trim-end":["es.string.trim-end"],"core-js/es/string/virtual/trim-left":["es.string.trim-start"],"core-js/es/string/virtual/trim-right":["es.string.trim-end"],"core-js/es/string/virtual/trim-start":["es.string.trim-start"],"core-js/es/symbol":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.array.concat","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/es/symbol/async-iterator":["es.symbol.async-iterator"],"core-js/es/symbol/description":["es.symbol.description"],"core-js/es/symbol/for":["es.symbol"],"core-js/es/symbol/has-instance":["es.symbol.has-instance","es.function.has-instance"],"core-js/es/symbol/is-concat-spreadable":["es.symbol.is-concat-spreadable","es.array.concat"],"core-js/es/symbol/iterator":["es.symbol.iterator","es.string.iterator","web.dom-collections.iterator"],"core-js/es/symbol/key-for":["es.symbol"],"core-js/es/symbol/match":["es.symbol.match","es.string.match"],"core-js/es/symbol/match-all":["es.symbol.match-all","es.string.match-all"],"core-js/es/symbol/replace":["es.symbol.replace","es.string.replace"],"core-js/es/symbol/search":["es.symbol.search","es.string.search"],"core-js/es/symbol/species":["es.symbol.species"],"core-js/es/symbol/split":["es.symbol.split","es.string.split"],"core-js/es/symbol/to-primitive":["es.symbol.to-primitive"],"core-js/es/symbol/to-string-tag":["es.symbol.to-string-tag","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/es/symbol/unscopables":["es.symbol.unscopables"],"core-js/es/typed-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/copy-within":["es.typed-array.copy-within"],"core-js/es/typed-array/entries":["es.typed-array.iterator"],"core-js/es/typed-array/every":["es.typed-array.every"],"core-js/es/typed-array/fill":["es.typed-array.fill"],"core-js/es/typed-array/filter":["es.typed-array.filter"],"core-js/es/typed-array/find":["es.typed-array.find"],"core-js/es/typed-array/find-index":["es.typed-array.find-index"],"core-js/es/typed-array/float32-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/float64-array":["es.object.to-string","es.typed-array.float64-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/for-each":["es.typed-array.for-each"],"core-js/es/typed-array/from":["es.typed-array.from"],"core-js/es/typed-array/includes":["es.typed-array.includes"],"core-js/es/typed-array/index-of":["es.typed-array.index-of"],"core-js/es/typed-array/int16-array":["es.object.to-string","es.typed-array.int16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/int32-array":["es.object.to-string","es.typed-array.int32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/int8-array":["es.object.to-string","es.typed-array.int8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/iterator":["es.typed-array.iterator"],"core-js/es/typed-array/join":["es.typed-array.join"],"core-js/es/typed-array/keys":["es.typed-array.iterator"],"core-js/es/typed-array/last-index-of":["es.typed-array.last-index-of"],"core-js/es/typed-array/map":["es.typed-array.map"],"core-js/es/typed-array/methods":["es.object.to-string","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/of":["es.typed-array.of"],"core-js/es/typed-array/reduce":["es.typed-array.reduce"],"core-js/es/typed-array/reduce-right":["es.typed-array.reduce-right"],"core-js/es/typed-array/reverse":["es.typed-array.reverse"],"core-js/es/typed-array/set":["es.typed-array.set"],"core-js/es/typed-array/slice":["es.typed-array.slice"],"core-js/es/typed-array/some":["es.typed-array.some"],"core-js/es/typed-array/sort":["es.typed-array.sort"],"core-js/es/typed-array/subarray":["es.typed-array.subarray"],"core-js/es/typed-array/to-locale-string":["es.typed-array.to-locale-string"],"core-js/es/typed-array/to-string":["es.typed-array.to-string"],"core-js/es/typed-array/uint16-array":["es.object.to-string","es.typed-array.uint16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/uint32-array":["es.object.to-string","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/uint8-array":["es.object.to-string","es.typed-array.uint8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/uint8-clamped-array":["es.object.to-string","es.typed-array.uint8-clamped-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/values":["es.typed-array.iterator"],"core-js/es/weak-map":["es.object.to-string","es.weak-map","web.dom-collections.iterator"],"core-js/es/weak-set":["es.object.to-string","es.weak-set","web.dom-collections.iterator"],"core-js/features":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"core-js/features/aggregate-error":["es.aggregate-error","es.string.iterator","esnext.aggregate-error","web.dom-collections.iterator"],"core-js/features/array":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.map","es.string.iterator","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by"],"core-js/features/array-buffer":["es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.object.to-string"],"core-js/features/array-buffer/constructor":["es.array-buffer.constructor","es.object.to-string"],"core-js/features/array-buffer/is-view":["es.array-buffer.is-view"],"core-js/features/array-buffer/slice":["es.array-buffer.slice"],"core-js/features/array/at":["esnext.array.at"],"core-js/features/array/concat":["es.array.concat"],"core-js/features/array/copy-within":["es.array.copy-within"],"core-js/features/array/entries":["es.array.iterator"],"core-js/features/array/every":["es.array.every"],"core-js/features/array/fill":["es.array.fill"],"core-js/features/array/filter":["es.array.filter"],"core-js/features/array/filter-out":["esnext.array.filter-out"],"core-js/features/array/find":["es.array.find"],"core-js/features/array/find-index":["es.array.find-index"],"core-js/features/array/find-last":["esnext.array.find-last"],"core-js/features/array/find-last-index":["esnext.array.find-last-index"],"core-js/features/array/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/features/array/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/features/array/for-each":["es.array.for-each"],"core-js/features/array/from":["es.array.from","es.string.iterator"],"core-js/features/array/includes":["es.array.includes"],"core-js/features/array/index-of":["es.array.index-of"],"core-js/features/array/is-array":["es.array.is-array"],"core-js/features/array/is-template-object":["esnext.array.is-template-object"],"core-js/features/array/iterator":["es.array.iterator"],"core-js/features/array/join":["es.array.join"],"core-js/features/array/keys":["es.array.iterator"],"core-js/features/array/last-index":["esnext.array.last-index"],"core-js/features/array/last-index-of":["es.array.last-index-of"],"core-js/features/array/last-item":["esnext.array.last-item"],"core-js/features/array/map":["es.array.map"],"core-js/features/array/of":["es.array.of"],"core-js/features/array/reduce":["es.array.reduce"],"core-js/features/array/reduce-right":["es.array.reduce-right"],"core-js/features/array/reverse":["es.array.reverse"],"core-js/features/array/slice":["es.array.slice"],"core-js/features/array/some":["es.array.some"],"core-js/features/array/sort":["es.array.sort"],"core-js/features/array/splice":["es.array.splice"],"core-js/features/array/unique-by":["es.map","esnext.array.unique-by"],"core-js/features/array/values":["es.array.iterator"],"core-js/features/array/virtual":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.includes","es.array.index-of","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.map","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.unique-by"],"core-js/features/array/virtual/at":["esnext.array.at"],"core-js/features/array/virtual/concat":["es.array.concat"],"core-js/features/array/virtual/copy-within":["es.array.copy-within"],"core-js/features/array/virtual/entries":["es.array.iterator"],"core-js/features/array/virtual/every":["es.array.every"],"core-js/features/array/virtual/fill":["es.array.fill"],"core-js/features/array/virtual/filter":["es.array.filter"],"core-js/features/array/virtual/filter-out":["esnext.array.filter-out"],"core-js/features/array/virtual/find":["es.array.find"],"core-js/features/array/virtual/find-index":["es.array.find-index"],"core-js/features/array/virtual/find-last":["esnext.array.find-last"],"core-js/features/array/virtual/find-last-index":["esnext.array.find-last-index"],"core-js/features/array/virtual/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/features/array/virtual/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/features/array/virtual/for-each":["es.array.for-each"],"core-js/features/array/virtual/includes":["es.array.includes"],"core-js/features/array/virtual/index-of":["es.array.index-of"],"core-js/features/array/virtual/iterator":["es.array.iterator"],"core-js/features/array/virtual/join":["es.array.join"],"core-js/features/array/virtual/keys":["es.array.iterator"],"core-js/features/array/virtual/last-index-of":["es.array.last-index-of"],"core-js/features/array/virtual/map":["es.array.map"],"core-js/features/array/virtual/reduce":["es.array.reduce"],"core-js/features/array/virtual/reduce-right":["es.array.reduce-right"],"core-js/features/array/virtual/reverse":["es.array.reverse"],"core-js/features/array/virtual/slice":["es.array.slice"],"core-js/features/array/virtual/some":["es.array.some"],"core-js/features/array/virtual/sort":["es.array.sort"],"core-js/features/array/virtual/splice":["es.array.splice"],"core-js/features/array/virtual/unique-by":["es.map","esnext.array.unique-by"],"core-js/features/array/virtual/values":["es.array.iterator"],"core-js/features/async-iterator":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","web.dom-collections.iterator"],"core-js/features/async-iterator/as-indexed-pairs":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","web.dom-collections.iterator"],"core-js/features/async-iterator/drop":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.drop","web.dom-collections.iterator"],"core-js/features/async-iterator/every":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.every","web.dom-collections.iterator"],"core-js/features/async-iterator/filter":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.filter","web.dom-collections.iterator"],"core-js/features/async-iterator/find":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.find","web.dom-collections.iterator"],"core-js/features/async-iterator/flat-map":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.flat-map","web.dom-collections.iterator"],"core-js/features/async-iterator/for-each":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.for-each","web.dom-collections.iterator"],"core-js/features/async-iterator/from":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.from","web.dom-collections.iterator"],"core-js/features/async-iterator/map":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.map","web.dom-collections.iterator"],"core-js/features/async-iterator/reduce":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.reduce","web.dom-collections.iterator"],"core-js/features/async-iterator/some":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.some","web.dom-collections.iterator"],"core-js/features/async-iterator/take":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.take","web.dom-collections.iterator"],"core-js/features/async-iterator/to-array":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.to-array","web.dom-collections.iterator"],"core-js/features/bigint":["esnext.bigint.range"],"core-js/features/bigint/range":["esnext.bigint.range"],"core-js/features/clear-immediate":["web.immediate"],"core-js/features/composite-key":["esnext.composite-key"],"core-js/features/composite-symbol":["es.symbol","esnext.composite-symbol"],"core-js/features/data-view":["es.data-view","es.object.to-string"],"core-js/features/date":["es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string"],"core-js/features/date/now":["es.date.now"],"core-js/features/date/to-iso-string":["es.date.to-iso-string","es.date.to-json"],"core-js/features/date/to-json":["es.date.to-json"],"core-js/features/date/to-primitive":["es.date.to-primitive"],"core-js/features/date/to-string":["es.date.to-string"],"core-js/features/dom-collections":["es.array.iterator","web.dom-collections.for-each","web.dom-collections.iterator"],"core-js/features/dom-collections/for-each":["web.dom-collections.for-each"],"core-js/features/dom-collections/iterator":["web.dom-collections.iterator"],"core-js/features/function":["es.function.bind","es.function.has-instance","es.function.name"],"core-js/features/function/bind":["es.function.bind"],"core-js/features/function/has-instance":["es.function.has-instance"],"core-js/features/function/name":["es.function.name"],"core-js/features/function/virtual":["es.function.bind"],"core-js/features/function/virtual/bind":["es.function.bind"],"core-js/features/get-iterator":["es.string.iterator","web.dom-collections.iterator"],"core-js/features/get-iterator-method":["es.string.iterator","web.dom-collections.iterator"],"core-js/features/global-this":["es.global-this","esnext.global-this"],"core-js/features/instance/at":["esnext.array.at","esnext.string.at"],"core-js/features/instance/bind":["es.function.bind"],"core-js/features/instance/code-point-at":["es.string.code-point-at"],"core-js/features/instance/code-points":["esnext.string.code-points"],"core-js/features/instance/concat":["es.array.concat"],"core-js/features/instance/copy-within":["es.array.copy-within"],"core-js/features/instance/ends-with":["es.string.ends-with"],"core-js/features/instance/entries":["es.array.iterator","web.dom-collections.iterator"],"core-js/features/instance/every":["es.array.every"],"core-js/features/instance/fill":["es.array.fill"],"core-js/features/instance/filter":["es.array.filter"],"core-js/features/instance/filter-out":["esnext.array.filter-out"],"core-js/features/instance/find":["es.array.find"],"core-js/features/instance/find-index":["es.array.find-index"],"core-js/features/instance/find-last":["esnext.array.find-last"],"core-js/features/instance/find-last-index":["esnext.array.find-last-index"],"core-js/features/instance/flags":["es.regexp.flags"],"core-js/features/instance/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/features/instance/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/features/instance/for-each":["es.array.for-each","web.dom-collections.iterator"],"core-js/features/instance/includes":["es.array.includes","es.string.includes"],"core-js/features/instance/index-of":["es.array.index-of"],"core-js/features/instance/keys":["es.array.iterator","web.dom-collections.iterator"],"core-js/features/instance/last-index-of":["es.array.last-index-of"],"core-js/features/instance/map":["es.array.map"],"core-js/features/instance/match-all":["es.string.match-all","esnext.string.match-all"],"core-js/features/instance/pad-end":["es.string.pad-end"],"core-js/features/instance/pad-start":["es.string.pad-start"],"core-js/features/instance/reduce":["es.array.reduce"],"core-js/features/instance/reduce-right":["es.array.reduce-right"],"core-js/features/instance/repeat":["es.string.repeat"],"core-js/features/instance/replace-all":["es.string.replace-all"],"core-js/features/instance/reverse":["es.array.reverse"],"core-js/features/instance/slice":["es.array.slice"],"core-js/features/instance/some":["es.array.some"],"core-js/features/instance/sort":["es.array.sort"],"core-js/features/instance/splice":["es.array.splice"],"core-js/features/instance/starts-with":["es.string.starts-with"],"core-js/features/instance/trim":["es.string.trim"],"core-js/features/instance/trim-end":["es.string.trim-end"],"core-js/features/instance/trim-left":["es.string.trim-start"],"core-js/features/instance/trim-right":["es.string.trim-end"],"core-js/features/instance/trim-start":["es.string.trim-start"],"core-js/features/instance/unique-by":["es.map","esnext.array.unique-by"],"core-js/features/instance/values":["es.array.iterator","web.dom-collections.iterator"],"core-js/features/is-iterable":["es.string.iterator","web.dom-collections.iterator"],"core-js/features/iterator":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","web.dom-collections.iterator"],"core-js/features/iterator/as-indexed-pairs":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","web.dom-collections.iterator"],"core-js/features/iterator/drop":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.drop","web.dom-collections.iterator"],"core-js/features/iterator/every":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.every","web.dom-collections.iterator"],"core-js/features/iterator/filter":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.filter","web.dom-collections.iterator"],"core-js/features/iterator/find":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.find","web.dom-collections.iterator"],"core-js/features/iterator/flat-map":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.flat-map","web.dom-collections.iterator"],"core-js/features/iterator/for-each":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.for-each","web.dom-collections.iterator"],"core-js/features/iterator/from":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.from","web.dom-collections.iterator"],"core-js/features/iterator/map":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.map","web.dom-collections.iterator"],"core-js/features/iterator/reduce":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.reduce","web.dom-collections.iterator"],"core-js/features/iterator/some":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.some","web.dom-collections.iterator"],"core-js/features/iterator/take":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.take","web.dom-collections.iterator"],"core-js/features/iterator/to-array":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.to-array","web.dom-collections.iterator"],"core-js/features/json":["es.json.stringify","es.json.to-string-tag"],"core-js/features/json/stringify":["es.json.stringify"],"core-js/features/json/to-string-tag":["es.json.to-string-tag"],"core-js/features/map":["es.map","es.object.to-string","es.string.iterator","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","web.dom-collections.iterator"],"core-js/features/map/delete-all":["es.map","esnext.map.delete-all"],"core-js/features/map/emplace":["es.map","esnext.map.emplace"],"core-js/features/map/every":["es.map","esnext.map.every"],"core-js/features/map/filter":["es.map","esnext.map.filter"],"core-js/features/map/find":["es.map","esnext.map.find"],"core-js/features/map/find-key":["es.map","esnext.map.find-key"],"core-js/features/map/from":["es.map","es.string.iterator","esnext.map.from","web.dom-collections.iterator"],"core-js/features/map/group-by":["es.map","esnext.map.group-by"],"core-js/features/map/includes":["es.map","esnext.map.includes"],"core-js/features/map/key-by":["es.map","esnext.map.key-by"],"core-js/features/map/key-of":["es.map","esnext.map.key-of"],"core-js/features/map/map-keys":["es.map","esnext.map.map-keys"],"core-js/features/map/map-values":["es.map","esnext.map.map-values"],"core-js/features/map/merge":["es.map","esnext.map.merge"],"core-js/features/map/of":["es.map","es.string.iterator","esnext.map.of","web.dom-collections.iterator"],"core-js/features/map/reduce":["es.map","esnext.map.reduce"],"core-js/features/map/some":["es.map","esnext.map.some"],"core-js/features/map/update":["es.map","esnext.map.update"],"core-js/features/map/update-or-insert":["es.map","esnext.map.update-or-insert"],"core-js/features/map/upsert":["es.map","esnext.map.upsert"],"core-js/features/math":["es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh"],"core-js/features/math/acosh":["es.math.acosh"],"core-js/features/math/asinh":["es.math.asinh"],"core-js/features/math/atanh":["es.math.atanh"],"core-js/features/math/cbrt":["es.math.cbrt"],"core-js/features/math/clamp":["esnext.math.clamp"],"core-js/features/math/clz32":["es.math.clz32"],"core-js/features/math/cosh":["es.math.cosh"],"core-js/features/math/deg-per-rad":["esnext.math.deg-per-rad"],"core-js/features/math/degrees":["esnext.math.degrees"],"core-js/features/math/expm1":["es.math.expm1"],"core-js/features/math/fround":["es.math.fround"],"core-js/features/math/fscale":["esnext.math.fscale"],"core-js/features/math/hypot":["es.math.hypot"],"core-js/features/math/iaddh":["esnext.math.iaddh"],"core-js/features/math/imul":["es.math.imul"],"core-js/features/math/imulh":["esnext.math.imulh"],"core-js/features/math/isubh":["esnext.math.isubh"],"core-js/features/math/log10":["es.math.log10"],"core-js/features/math/log1p":["es.math.log1p"],"core-js/features/math/log2":["es.math.log2"],"core-js/features/math/rad-per-deg":["esnext.math.rad-per-deg"],"core-js/features/math/radians":["esnext.math.radians"],"core-js/features/math/scale":["esnext.math.scale"],"core-js/features/math/seeded-prng":["esnext.math.seeded-prng"],"core-js/features/math/sign":["es.math.sign"],"core-js/features/math/signbit":["esnext.math.signbit"],"core-js/features/math/sinh":["es.math.sinh"],"core-js/features/math/tanh":["es.math.tanh"],"core-js/features/math/to-string-tag":["es.math.to-string-tag"],"core-js/features/math/trunc":["es.math.trunc"],"core-js/features/math/umulh":["esnext.math.umulh"],"core-js/features/number":["es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","esnext.number.from-string","esnext.number.range"],"core-js/features/number/constructor":["es.number.constructor"],"core-js/features/number/epsilon":["es.number.epsilon"],"core-js/features/number/from-string":["esnext.number.from-string"],"core-js/features/number/is-finite":["es.number.is-finite"],"core-js/features/number/is-integer":["es.number.is-integer"],"core-js/features/number/is-nan":["es.number.is-nan"],"core-js/features/number/is-safe-integer":["es.number.is-safe-integer"],"core-js/features/number/max-safe-integer":["es.number.max-safe-integer"],"core-js/features/number/min-safe-integer":["es.number.min-safe-integer"],"core-js/features/number/parse-float":["es.number.parse-float"],"core-js/features/number/parse-int":["es.number.parse-int"],"core-js/features/number/range":["esnext.number.range"],"core-js/features/number/to-fixed":["es.number.to-fixed"],"core-js/features/number/to-precision":["es.number.to-precision"],"core-js/features/number/virtual":["es.number.to-fixed","es.number.to-precision"],"core-js/features/number/virtual/to-fixed":["es.number.to-fixed"],"core-js/features/number/virtual/to-precision":["es.number.to-precision"],"core-js/features/object":["es.symbol","es.json.to-string-tag","es.math.to-string-tag","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.reflect.to-string-tag","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values"],"core-js/features/object/assign":["es.object.assign"],"core-js/features/object/create":["es.object.create"],"core-js/features/object/define-getter":["es.object.define-getter"],"core-js/features/object/define-properties":["es.object.define-properties"],"core-js/features/object/define-property":["es.object.define-property"],"core-js/features/object/define-setter":["es.object.define-setter"],"core-js/features/object/entries":["es.object.entries"],"core-js/features/object/freeze":["es.object.freeze"],"core-js/features/object/from-entries":["es.array.iterator","es.object.from-entries"],"core-js/features/object/get-own-property-descriptor":["es.object.get-own-property-descriptor"],"core-js/features/object/get-own-property-descriptors":["es.object.get-own-property-descriptors"],"core-js/features/object/get-own-property-names":["es.object.get-own-property-names"],"core-js/features/object/get-own-property-symbols":["es.symbol"],"core-js/features/object/get-prototype-of":["es.object.get-prototype-of"],"core-js/features/object/has-own":["esnext.object.has-own"],"core-js/features/object/is":["es.object.is"],"core-js/features/object/is-extensible":["es.object.is-extensible"],"core-js/features/object/is-frozen":["es.object.is-frozen"],"core-js/features/object/is-sealed":["es.object.is-sealed"],"core-js/features/object/iterate-entries":["esnext.object.iterate-entries"],"core-js/features/object/iterate-keys":["esnext.object.iterate-keys"],"core-js/features/object/iterate-values":["esnext.object.iterate-values"],"core-js/features/object/keys":["es.object.keys"],"core-js/features/object/lookup-getter":["es.object.lookup-setter"],"core-js/features/object/lookup-setter":["es.object.lookup-setter"],"core-js/features/object/prevent-extensions":["es.object.prevent-extensions"],"core-js/features/object/seal":["es.object.seal"],"core-js/features/object/set-prototype-of":["es.object.set-prototype-of"],"core-js/features/object/to-string":["es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/features/object/values":["es.object.values"],"core-js/features/observable":["es.object.to-string","es.string.iterator","esnext.observable","esnext.symbol.observable","web.dom-collections.iterator"],"core-js/features/parse-float":["es.parse-float"],"core-js/features/parse-int":["es.parse-int"],"core-js/features/promise":["es.aggregate-error","es.object.to-string","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.string.iterator","esnext.aggregate-error","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","web.dom-collections.iterator"],"core-js/features/promise/all-settled":["es.promise","es.promise.all-settled","es.string.iterator","esnext.promise.all-settled","web.dom-collections.iterator"],"core-js/features/promise/any":["es.aggregate-error","es.promise","es.promise.any","es.string.iterator","esnext.aggregate-error","esnext.promise.any","web.dom-collections.iterator"],"core-js/features/promise/finally":["es.promise","es.promise.finally"],"core-js/features/promise/try":["es.promise","esnext.promise.try"],"core-js/features/queue-microtask":["web.queue-microtask"],"core-js/features/reflect":["es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata"],"core-js/features/reflect/apply":["es.reflect.apply"],"core-js/features/reflect/construct":["es.reflect.construct"],"core-js/features/reflect/define-metadata":["esnext.reflect.define-metadata"],"core-js/features/reflect/define-property":["es.reflect.define-property"],"core-js/features/reflect/delete-metadata":["esnext.reflect.delete-metadata"],"core-js/features/reflect/delete-property":["es.reflect.delete-property"],"core-js/features/reflect/get":["es.reflect.get"],"core-js/features/reflect/get-metadata":["esnext.reflect.get-metadata"],"core-js/features/reflect/get-metadata-keys":["esnext.reflect.get-metadata-keys"],"core-js/features/reflect/get-own-metadata":["esnext.reflect.get-own-metadata"],"core-js/features/reflect/get-own-metadata-keys":["esnext.reflect.get-own-metadata-keys"],"core-js/features/reflect/get-own-property-descriptor":["es.reflect.get-own-property-descriptor"],"core-js/features/reflect/get-prototype-of":["es.reflect.get-prototype-of"],"core-js/features/reflect/has":["es.reflect.has"],"core-js/features/reflect/has-metadata":["esnext.reflect.has-metadata"],"core-js/features/reflect/has-own-metadata":["esnext.reflect.has-own-metadata"],"core-js/features/reflect/is-extensible":["es.reflect.is-extensible"],"core-js/features/reflect/metadata":["esnext.reflect.metadata"],"core-js/features/reflect/own-keys":["es.reflect.own-keys"],"core-js/features/reflect/prevent-extensions":["es.reflect.prevent-extensions"],"core-js/features/reflect/set":["es.reflect.set"],"core-js/features/reflect/set-prototype-of":["es.reflect.set-prototype-of"],"core-js/features/reflect/to-string-tag":["es.reflect.to-string-tag"],"core-js/features/regexp":["es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.string.match","es.string.replace","es.string.search","es.string.split"],"core-js/features/regexp/constructor":["es.regexp.constructor"],"core-js/features/regexp/flags":["es.regexp.flags"],"core-js/features/regexp/match":["es.string.match"],"core-js/features/regexp/replace":["es.string.replace"],"core-js/features/regexp/search":["es.string.search"],"core-js/features/regexp/split":["es.string.split"],"core-js/features/regexp/sticky":["es.regexp.sticky"],"core-js/features/regexp/test":["es.regexp.exec","es.regexp.test"],"core-js/features/regexp/to-string":["es.regexp.to-string"],"core-js/features/set":["es.object.to-string","es.set","es.string.iterator","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","web.dom-collections.iterator"],"core-js/features/set-immediate":["web.immediate"],"core-js/features/set-interval":["web.timers"],"core-js/features/set-timeout":["web.timers"],"core-js/features/set/add-all":["es.set","esnext.set.add-all"],"core-js/features/set/delete-all":["es.set","esnext.set.delete-all"],"core-js/features/set/difference":["es.set","es.string.iterator","esnext.set.difference","web.dom-collections.iterator"],"core-js/features/set/every":["es.set","esnext.set.every"],"core-js/features/set/filter":["es.set","esnext.set.filter"],"core-js/features/set/find":["es.set","esnext.set.find"],"core-js/features/set/from":["es.set","es.string.iterator","esnext.set.from","web.dom-collections.iterator"],"core-js/features/set/intersection":["es.set","esnext.set.intersection"],"core-js/features/set/is-disjoint-from":["es.set","esnext.set.is-disjoint-from"],"core-js/features/set/is-subset-of":["es.set","es.string.iterator","esnext.set.is-subset-of","web.dom-collections.iterator"],"core-js/features/set/is-superset-of":["es.set","esnext.set.is-superset-of"],"core-js/features/set/join":["es.set","esnext.set.join"],"core-js/features/set/map":["es.set","esnext.set.map"],"core-js/features/set/of":["es.set","es.string.iterator","esnext.set.of","web.dom-collections.iterator"],"core-js/features/set/reduce":["es.set","esnext.set.reduce"],"core-js/features/set/some":["es.set","esnext.set.some"],"core-js/features/set/symmetric-difference":["es.set","es.string.iterator","esnext.set.symmetric-difference","web.dom-collections.iterator"],"core-js/features/set/union":["es.set","es.string.iterator","esnext.set.union","web.dom-collections.iterator"],"core-js/features/string":["es.regexp.exec","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all"],"core-js/features/string/anchor":["es.string.anchor"],"core-js/features/string/at":["esnext.string.at"],"core-js/features/string/big":["es.string.big"],"core-js/features/string/blink":["es.string.blink"],"core-js/features/string/bold":["es.string.bold"],"core-js/features/string/code-point-at":["es.string.code-point-at"],"core-js/features/string/code-points":["esnext.string.code-points"],"core-js/features/string/ends-with":["es.string.ends-with"],"core-js/features/string/fixed":["es.string.fixed"],"core-js/features/string/fontcolor":["es.string.fontcolor"],"core-js/features/string/fontsize":["es.string.fontsize"],"core-js/features/string/from-code-point":["es.string.from-code-point"],"core-js/features/string/includes":["es.string.includes"],"core-js/features/string/italics":["es.string.italics"],"core-js/features/string/iterator":["es.string.iterator"],"core-js/features/string/link":["es.string.link"],"core-js/features/string/match":["es.regexp.exec","es.string.match"],"core-js/features/string/match-all":["es.string.match-all","esnext.string.match-all"],"core-js/features/string/pad-end":["es.string.pad-end"],"core-js/features/string/pad-start":["es.string.pad-start"],"core-js/features/string/raw":["es.string.raw"],"core-js/features/string/repeat":["es.string.repeat"],"core-js/features/string/replace":["es.regexp.exec","es.string.replace"],"core-js/features/string/replace-all":["es.string.replace-all","esnext.string.replace-all"],"core-js/features/string/search":["es.regexp.exec","es.string.search"],"core-js/features/string/small":["es.string.small"],"core-js/features/string/split":["es.regexp.exec","es.string.split"],"core-js/features/string/starts-with":["es.string.starts-with"],"core-js/features/string/strike":["es.string.strike"],"core-js/features/string/sub":["es.string.sub"],"core-js/features/string/sup":["es.string.sup"],"core-js/features/string/trim":["es.string.trim"],"core-js/features/string/trim-end":["es.string.trim-end"],"core-js/features/string/trim-left":["es.string.trim-start"],"core-js/features/string/trim-right":["es.string.trim-end"],"core-js/features/string/trim-start":["es.string.trim-start"],"core-js/features/string/virtual":["es.string.code-point-at","es.string.ends-with","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all"],"core-js/features/string/virtual/anchor":["es.string.anchor"],"core-js/features/string/virtual/at":["esnext.string.at"],"core-js/features/string/virtual/big":["es.string.big"],"core-js/features/string/virtual/blink":["es.string.blink"],"core-js/features/string/virtual/bold":["es.string.bold"],"core-js/features/string/virtual/code-point-at":["es.string.code-point-at"],"core-js/features/string/virtual/code-points":["esnext.string.code-points"],"core-js/features/string/virtual/ends-with":["es.string.ends-with"],"core-js/features/string/virtual/fixed":["es.string.fixed"],"core-js/features/string/virtual/fontcolor":["es.string.fontcolor"],"core-js/features/string/virtual/fontsize":["es.string.fontsize"],"core-js/features/string/virtual/includes":["es.string.includes"],"core-js/features/string/virtual/italics":["es.string.italics"],"core-js/features/string/virtual/iterator":["es.string.iterator"],"core-js/features/string/virtual/link":["es.string.link"],"core-js/features/string/virtual/match-all":["es.string.match-all","esnext.string.match-all"],"core-js/features/string/virtual/pad-end":["es.string.pad-end"],"core-js/features/string/virtual/pad-start":["es.string.pad-start"],"core-js/features/string/virtual/repeat":["es.string.repeat"],"core-js/features/string/virtual/replace-all":["es.string.replace-all","esnext.string.replace-all"],"core-js/features/string/virtual/small":["es.string.small"],"core-js/features/string/virtual/starts-with":["es.string.starts-with"],"core-js/features/string/virtual/strike":["es.string.strike"],"core-js/features/string/virtual/sub":["es.string.sub"],"core-js/features/string/virtual/sup":["es.string.sup"],"core-js/features/string/virtual/trim":["es.string.trim"],"core-js/features/string/virtual/trim-end":["es.string.trim-end"],"core-js/features/string/virtual/trim-left":["es.string.trim-start"],"core-js/features/string/virtual/trim-right":["es.string.trim-end"],"core-js/features/string/virtual/trim-start":["es.string.trim-start"],"core-js/features/symbol":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.array.concat","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all"],"core-js/features/symbol/async-dispose":["esnext.symbol.async-dispose"],"core-js/features/symbol/async-iterator":["es.symbol.async-iterator"],"core-js/features/symbol/description":["es.symbol.description"],"core-js/features/symbol/dispose":["esnext.symbol.dispose"],"core-js/features/symbol/for":["es.symbol"],"core-js/features/symbol/has-instance":["es.symbol.has-instance","es.function.has-instance"],"core-js/features/symbol/is-concat-spreadable":["es.symbol.is-concat-spreadable","es.array.concat"],"core-js/features/symbol/iterator":["es.symbol.iterator","es.string.iterator","web.dom-collections.iterator"],"core-js/features/symbol/key-for":["es.symbol"],"core-js/features/symbol/match":["es.symbol.match","es.string.match"],"core-js/features/symbol/match-all":["es.symbol.match-all","es.string.match-all"],"core-js/features/symbol/matcher":["esnext.symbol.matcher"],"core-js/features/symbol/metadata":["esnext.symbol.metadata"],"core-js/features/symbol/observable":["esnext.symbol.observable"],"core-js/features/symbol/pattern-match":["esnext.symbol.pattern-match"],"core-js/features/symbol/replace":["es.symbol.replace","es.string.replace"],"core-js/features/symbol/replace-all":["esnext.symbol.replace-all"],"core-js/features/symbol/search":["es.symbol.search","es.string.search"],"core-js/features/symbol/species":["es.symbol.species"],"core-js/features/symbol/split":["es.symbol.split","es.string.split"],"core-js/features/symbol/to-primitive":["es.symbol.to-primitive"],"core-js/features/symbol/to-string-tag":["es.symbol.to-string-tag","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/features/symbol/unscopables":["es.symbol.unscopables"],"core-js/features/typed-array":["es.map","es.object.to-string","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by"],"core-js/features/typed-array/at":["esnext.typed-array.at"],"core-js/features/typed-array/copy-within":["es.typed-array.copy-within"],"core-js/features/typed-array/entries":["es.typed-array.iterator"],"core-js/features/typed-array/every":["es.typed-array.every"],"core-js/features/typed-array/fill":["es.typed-array.fill"],"core-js/features/typed-array/filter":["es.typed-array.filter"],"core-js/features/typed-array/filter-out":["esnext.typed-array.filter-out"],"core-js/features/typed-array/find":["es.typed-array.find"],"core-js/features/typed-array/find-index":["es.typed-array.find-index"],"core-js/features/typed-array/find-last":["esnext.typed-array.find-last"],"core-js/features/typed-array/find-last-index":["esnext.typed-array.find-last-index"],"core-js/features/typed-array/float32-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/float64-array":["es.object.to-string","es.typed-array.float64-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/for-each":["es.typed-array.for-each"],"core-js/features/typed-array/from":["es.typed-array.from"],"core-js/features/typed-array/includes":["es.typed-array.includes"],"core-js/features/typed-array/index-of":["es.typed-array.index-of"],"core-js/features/typed-array/int16-array":["es.object.to-string","es.typed-array.int16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/int32-array":["es.object.to-string","es.typed-array.int32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/int8-array":["es.object.to-string","es.typed-array.int8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/iterator":["es.typed-array.iterator"],"core-js/features/typed-array/join":["es.typed-array.join"],"core-js/features/typed-array/keys":["es.typed-array.iterator"],"core-js/features/typed-array/last-index-of":["es.typed-array.last-index-of"],"core-js/features/typed-array/map":["es.typed-array.map"],"core-js/features/typed-array/of":["es.typed-array.of"],"core-js/features/typed-array/reduce":["es.typed-array.reduce"],"core-js/features/typed-array/reduce-right":["es.typed-array.reduce-right"],"core-js/features/typed-array/reverse":["es.typed-array.reverse"],"core-js/features/typed-array/set":["es.typed-array.set"],"core-js/features/typed-array/slice":["es.typed-array.slice"],"core-js/features/typed-array/some":["es.typed-array.some"],"core-js/features/typed-array/sort":["es.typed-array.sort"],"core-js/features/typed-array/subarray":["es.typed-array.subarray"],"core-js/features/typed-array/to-locale-string":["es.typed-array.to-locale-string"],"core-js/features/typed-array/to-string":["es.typed-array.to-string"],"core-js/features/typed-array/uint16-array":["es.object.to-string","es.typed-array.uint16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/uint32-array":["es.object.to-string","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/uint8-array":["es.object.to-string","es.typed-array.uint8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/uint8-clamped-array":["es.object.to-string","es.typed-array.uint8-clamped-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/unique-by":["es.map","esnext.typed-array.unique-by"],"core-js/features/typed-array/values":["es.typed-array.iterator"],"core-js/features/url":["web.url","web.url.to-json","web.url-search-params"],"core-js/features/url-search-params":["web.url-search-params"],"core-js/features/url/to-json":["web.url.to-json"],"core-js/features/weak-map":["es.object.to-string","es.weak-map","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","web.dom-collections.iterator"],"core-js/features/weak-map/delete-all":["es.weak-map","esnext.weak-map.delete-all"],"core-js/features/weak-map/emplace":["es.weak-map","esnext.weak-map.emplace"],"core-js/features/weak-map/from":["es.string.iterator","es.weak-map","esnext.weak-map.from","web.dom-collections.iterator"],"core-js/features/weak-map/of":["es.string.iterator","es.weak-map","esnext.weak-map.of","web.dom-collections.iterator"],"core-js/features/weak-map/upsert":["es.weak-map","esnext.weak-map.upsert"],"core-js/features/weak-set":["es.object.to-string","es.weak-set","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.iterator"],"core-js/features/weak-set/add-all":["es.weak-set","esnext.weak-set.add-all"],"core-js/features/weak-set/delete-all":["es.weak-set","esnext.weak-set.delete-all"],"core-js/features/weak-set/from":["es.string.iterator","es.weak-set","esnext.weak-set.from","web.dom-collections.iterator"],"core-js/features/weak-set/of":["es.string.iterator","es.weak-set","esnext.weak-set.of","web.dom-collections.iterator"],"core-js/modules/es.aggregate-error":["es.aggregate-error"],"core-js/modules/es.array-buffer.constructor":["es.array-buffer.constructor"],"core-js/modules/es.array-buffer.is-view":["es.array-buffer.is-view"],"core-js/modules/es.array-buffer.slice":["es.array-buffer.slice"],"core-js/modules/es.array.concat":["es.array.concat"],"core-js/modules/es.array.copy-within":["es.array.copy-within"],"core-js/modules/es.array.every":["es.array.every"],"core-js/modules/es.array.fill":["es.array.fill"],"core-js/modules/es.array.filter":["es.array.filter"],"core-js/modules/es.array.find":["es.array.find"],"core-js/modules/es.array.find-index":["es.array.find-index"],"core-js/modules/es.array.flat":["es.array.flat"],"core-js/modules/es.array.flat-map":["es.array.flat-map"],"core-js/modules/es.array.for-each":["es.array.for-each"],"core-js/modules/es.array.from":["es.array.from"],"core-js/modules/es.array.includes":["es.array.includes"],"core-js/modules/es.array.index-of":["es.array.index-of"],"core-js/modules/es.array.is-array":["es.array.is-array"],"core-js/modules/es.array.iterator":["es.array.iterator"],"core-js/modules/es.array.join":["es.array.join"],"core-js/modules/es.array.last-index-of":["es.array.last-index-of"],"core-js/modules/es.array.map":["es.array.map"],"core-js/modules/es.array.of":["es.array.of"],"core-js/modules/es.array.reduce":["es.array.reduce"],"core-js/modules/es.array.reduce-right":["es.array.reduce-right"],"core-js/modules/es.array.reverse":["es.array.reverse"],"core-js/modules/es.array.slice":["es.array.slice"],"core-js/modules/es.array.some":["es.array.some"],"core-js/modules/es.array.sort":["es.array.sort"],"core-js/modules/es.array.species":["es.array.species"],"core-js/modules/es.array.splice":["es.array.splice"],"core-js/modules/es.array.unscopables.flat":["es.array.unscopables.flat"],"core-js/modules/es.array.unscopables.flat-map":["es.array.unscopables.flat-map"],"core-js/modules/es.data-view":["es.data-view"],"core-js/modules/es.date.now":["es.date.now"],"core-js/modules/es.date.to-iso-string":["es.date.to-iso-string"],"core-js/modules/es.date.to-json":["es.date.to-json"],"core-js/modules/es.date.to-primitive":["es.date.to-primitive"],"core-js/modules/es.date.to-string":["es.date.to-string"],"core-js/modules/es.function.bind":["es.function.bind"],"core-js/modules/es.function.has-instance":["es.function.has-instance"],"core-js/modules/es.function.name":["es.function.name"],"core-js/modules/es.global-this":["es.global-this"],"core-js/modules/es.json.stringify":["es.json.stringify"],"core-js/modules/es.json.to-string-tag":["es.json.to-string-tag"],"core-js/modules/es.map":["es.map"],"core-js/modules/es.math.acosh":["es.math.acosh"],"core-js/modules/es.math.asinh":["es.math.asinh"],"core-js/modules/es.math.atanh":["es.math.atanh"],"core-js/modules/es.math.cbrt":["es.math.cbrt"],"core-js/modules/es.math.clz32":["es.math.clz32"],"core-js/modules/es.math.cosh":["es.math.cosh"],"core-js/modules/es.math.expm1":["es.math.expm1"],"core-js/modules/es.math.fround":["es.math.fround"],"core-js/modules/es.math.hypot":["es.math.hypot"],"core-js/modules/es.math.imul":["es.math.imul"],"core-js/modules/es.math.log10":["es.math.log10"],"core-js/modules/es.math.log1p":["es.math.log1p"],"core-js/modules/es.math.log2":["es.math.log2"],"core-js/modules/es.math.sign":["es.math.sign"],"core-js/modules/es.math.sinh":["es.math.sinh"],"core-js/modules/es.math.tanh":["es.math.tanh"],"core-js/modules/es.math.to-string-tag":["es.math.to-string-tag"],"core-js/modules/es.math.trunc":["es.math.trunc"],"core-js/modules/es.number.constructor":["es.number.constructor"],"core-js/modules/es.number.epsilon":["es.number.epsilon"],"core-js/modules/es.number.is-finite":["es.number.is-finite"],"core-js/modules/es.number.is-integer":["es.number.is-integer"],"core-js/modules/es.number.is-nan":["es.number.is-nan"],"core-js/modules/es.number.is-safe-integer":["es.number.is-safe-integer"],"core-js/modules/es.number.max-safe-integer":["es.number.max-safe-integer"],"core-js/modules/es.number.min-safe-integer":["es.number.min-safe-integer"],"core-js/modules/es.number.parse-float":["es.number.parse-float"],"core-js/modules/es.number.parse-int":["es.number.parse-int"],"core-js/modules/es.number.to-fixed":["es.number.to-fixed"],"core-js/modules/es.number.to-precision":["es.number.to-precision"],"core-js/modules/es.object.assign":["es.object.assign"],"core-js/modules/es.object.create":["es.object.create"],"core-js/modules/es.object.define-getter":["es.object.define-getter"],"core-js/modules/es.object.define-properties":["es.object.define-properties"],"core-js/modules/es.object.define-property":["es.object.define-property"],"core-js/modules/es.object.define-setter":["es.object.define-setter"],"core-js/modules/es.object.entries":["es.object.entries"],"core-js/modules/es.object.freeze":["es.object.freeze"],"core-js/modules/es.object.from-entries":["es.object.from-entries"],"core-js/modules/es.object.get-own-property-descriptor":["es.object.get-own-property-descriptor"],"core-js/modules/es.object.get-own-property-descriptors":["es.object.get-own-property-descriptors"],"core-js/modules/es.object.get-own-property-names":["es.object.get-own-property-names"],"core-js/modules/es.object.get-prototype-of":["es.object.get-prototype-of"],"core-js/modules/es.object.is":["es.object.is"],"core-js/modules/es.object.is-extensible":["es.object.is-extensible"],"core-js/modules/es.object.is-frozen":["es.object.is-frozen"],"core-js/modules/es.object.is-sealed":["es.object.is-sealed"],"core-js/modules/es.object.keys":["es.object.keys"],"core-js/modules/es.object.lookup-getter":["es.object.lookup-getter"],"core-js/modules/es.object.lookup-setter":["es.object.lookup-setter"],"core-js/modules/es.object.prevent-extensions":["es.object.prevent-extensions"],"core-js/modules/es.object.seal":["es.object.seal"],"core-js/modules/es.object.set-prototype-of":["es.object.set-prototype-of"],"core-js/modules/es.object.to-string":["es.object.to-string"],"core-js/modules/es.object.values":["es.object.values"],"core-js/modules/es.parse-float":["es.parse-float"],"core-js/modules/es.parse-int":["es.parse-int"],"core-js/modules/es.promise":["es.promise"],"core-js/modules/es.promise.all-settled":["es.promise.all-settled"],"core-js/modules/es.promise.any":["es.promise.any"],"core-js/modules/es.promise.finally":["es.promise.finally"],"core-js/modules/es.reflect.apply":["es.reflect.apply"],"core-js/modules/es.reflect.construct":["es.reflect.construct"],"core-js/modules/es.reflect.define-property":["es.reflect.define-property"],"core-js/modules/es.reflect.delete-property":["es.reflect.delete-property"],"core-js/modules/es.reflect.get":["es.reflect.get"],"core-js/modules/es.reflect.get-own-property-descriptor":["es.reflect.get-own-property-descriptor"],"core-js/modules/es.reflect.get-prototype-of":["es.reflect.get-prototype-of"],"core-js/modules/es.reflect.has":["es.reflect.has"],"core-js/modules/es.reflect.is-extensible":["es.reflect.is-extensible"],"core-js/modules/es.reflect.own-keys":["es.reflect.own-keys"],"core-js/modules/es.reflect.prevent-extensions":["es.reflect.prevent-extensions"],"core-js/modules/es.reflect.set":["es.reflect.set"],"core-js/modules/es.reflect.set-prototype-of":["es.reflect.set-prototype-of"],"core-js/modules/es.reflect.to-string-tag":["es.reflect.to-string-tag"],"core-js/modules/es.regexp.constructor":["es.regexp.constructor"],"core-js/modules/es.regexp.exec":["es.regexp.exec"],"core-js/modules/es.regexp.flags":["es.regexp.flags"],"core-js/modules/es.regexp.sticky":["es.regexp.sticky"],"core-js/modules/es.regexp.test":["es.regexp.test"],"core-js/modules/es.regexp.to-string":["es.regexp.to-string"],"core-js/modules/es.set":["es.set"],"core-js/modules/es.string.anchor":["es.string.anchor"],"core-js/modules/es.string.big":["es.string.big"],"core-js/modules/es.string.blink":["es.string.blink"],"core-js/modules/es.string.bold":["es.string.bold"],"core-js/modules/es.string.code-point-at":["es.string.code-point-at"],"core-js/modules/es.string.ends-with":["es.string.ends-with"],"core-js/modules/es.string.fixed":["es.string.fixed"],"core-js/modules/es.string.fontcolor":["es.string.fontcolor"],"core-js/modules/es.string.fontsize":["es.string.fontsize"],"core-js/modules/es.string.from-code-point":["es.string.from-code-point"],"core-js/modules/es.string.includes":["es.string.includes"],"core-js/modules/es.string.italics":["es.string.italics"],"core-js/modules/es.string.iterator":["es.string.iterator"],"core-js/modules/es.string.link":["es.string.link"],"core-js/modules/es.string.match":["es.string.match"],"core-js/modules/es.string.match-all":["es.string.match-all"],"core-js/modules/es.string.pad-end":["es.string.pad-end"],"core-js/modules/es.string.pad-start":["es.string.pad-start"],"core-js/modules/es.string.raw":["es.string.raw"],"core-js/modules/es.string.repeat":["es.string.repeat"],"core-js/modules/es.string.replace":["es.string.replace"],"core-js/modules/es.string.replace-all":["es.string.replace-all"],"core-js/modules/es.string.search":["es.string.search"],"core-js/modules/es.string.small":["es.string.small"],"core-js/modules/es.string.split":["es.string.split"],"core-js/modules/es.string.starts-with":["es.string.starts-with"],"core-js/modules/es.string.strike":["es.string.strike"],"core-js/modules/es.string.sub":["es.string.sub"],"core-js/modules/es.string.sup":["es.string.sup"],"core-js/modules/es.string.trim":["es.string.trim"],"core-js/modules/es.string.trim-end":["es.string.trim-end"],"core-js/modules/es.string.trim-start":["es.string.trim-start"],"core-js/modules/es.symbol":["es.symbol"],"core-js/modules/es.symbol.async-iterator":["es.symbol.async-iterator"],"core-js/modules/es.symbol.description":["es.symbol.description"],"core-js/modules/es.symbol.has-instance":["es.symbol.has-instance"],"core-js/modules/es.symbol.is-concat-spreadable":["es.symbol.is-concat-spreadable"],"core-js/modules/es.symbol.iterator":["es.symbol.iterator"],"core-js/modules/es.symbol.match":["es.symbol.match"],"core-js/modules/es.symbol.match-all":["es.symbol.match-all"],"core-js/modules/es.symbol.replace":["es.symbol.replace"],"core-js/modules/es.symbol.search":["es.symbol.search"],"core-js/modules/es.symbol.species":["es.symbol.species"],"core-js/modules/es.symbol.split":["es.symbol.split"],"core-js/modules/es.symbol.to-primitive":["es.symbol.to-primitive"],"core-js/modules/es.symbol.to-string-tag":["es.symbol.to-string-tag"],"core-js/modules/es.symbol.unscopables":["es.symbol.unscopables"],"core-js/modules/es.typed-array.copy-within":["es.typed-array.copy-within"],"core-js/modules/es.typed-array.every":["es.typed-array.every"],"core-js/modules/es.typed-array.fill":["es.typed-array.fill"],"core-js/modules/es.typed-array.filter":["es.typed-array.filter"],"core-js/modules/es.typed-array.find":["es.typed-array.find"],"core-js/modules/es.typed-array.find-index":["es.typed-array.find-index"],"core-js/modules/es.typed-array.float32-array":["es.typed-array.float32-array"],"core-js/modules/es.typed-array.float64-array":["es.typed-array.float64-array"],"core-js/modules/es.typed-array.for-each":["es.typed-array.for-each"],"core-js/modules/es.typed-array.from":["es.typed-array.from"],"core-js/modules/es.typed-array.includes":["es.typed-array.includes"],"core-js/modules/es.typed-array.index-of":["es.typed-array.index-of"],"core-js/modules/es.typed-array.int16-array":["es.typed-array.int16-array"],"core-js/modules/es.typed-array.int32-array":["es.typed-array.int32-array"],"core-js/modules/es.typed-array.int8-array":["es.typed-array.int8-array"],"core-js/modules/es.typed-array.iterator":["es.typed-array.iterator"],"core-js/modules/es.typed-array.join":["es.typed-array.join"],"core-js/modules/es.typed-array.last-index-of":["es.typed-array.last-index-of"],"core-js/modules/es.typed-array.map":["es.typed-array.map"],"core-js/modules/es.typed-array.of":["es.typed-array.of"],"core-js/modules/es.typed-array.reduce":["es.typed-array.reduce"],"core-js/modules/es.typed-array.reduce-right":["es.typed-array.reduce-right"],"core-js/modules/es.typed-array.reverse":["es.typed-array.reverse"],"core-js/modules/es.typed-array.set":["es.typed-array.set"],"core-js/modules/es.typed-array.slice":["es.typed-array.slice"],"core-js/modules/es.typed-array.some":["es.typed-array.some"],"core-js/modules/es.typed-array.sort":["es.typed-array.sort"],"core-js/modules/es.typed-array.subarray":["es.typed-array.subarray"],"core-js/modules/es.typed-array.to-locale-string":["es.typed-array.to-locale-string"],"core-js/modules/es.typed-array.to-string":["es.typed-array.to-string"],"core-js/modules/es.typed-array.uint16-array":["es.typed-array.uint16-array"],"core-js/modules/es.typed-array.uint32-array":["es.typed-array.uint32-array"],"core-js/modules/es.typed-array.uint8-array":["es.typed-array.uint8-array"],"core-js/modules/es.typed-array.uint8-clamped-array":["es.typed-array.uint8-clamped-array"],"core-js/modules/es.weak-map":["es.weak-map"],"core-js/modules/es.weak-set":["es.weak-set"],"core-js/modules/esnext.aggregate-error":["esnext.aggregate-error"],"core-js/modules/esnext.array.at":["esnext.array.at"],"core-js/modules/esnext.array.filter-out":["esnext.array.filter-out"],"core-js/modules/esnext.array.find-last":["esnext.array.find-last"],"core-js/modules/esnext.array.find-last-index":["esnext.array.find-last-index"],"core-js/modules/esnext.array.is-template-object":["esnext.array.is-template-object"],"core-js/modules/esnext.array.last-index":["esnext.array.last-index"],"core-js/modules/esnext.array.last-item":["esnext.array.last-item"],"core-js/modules/esnext.array.unique-by":["esnext.array.unique-by"],"core-js/modules/esnext.async-iterator.as-indexed-pairs":["esnext.async-iterator.as-indexed-pairs"],"core-js/modules/esnext.async-iterator.constructor":["esnext.async-iterator.constructor"],"core-js/modules/esnext.async-iterator.drop":["esnext.async-iterator.drop"],"core-js/modules/esnext.async-iterator.every":["esnext.async-iterator.every"],"core-js/modules/esnext.async-iterator.filter":["esnext.async-iterator.filter"],"core-js/modules/esnext.async-iterator.find":["esnext.async-iterator.find"],"core-js/modules/esnext.async-iterator.flat-map":["esnext.async-iterator.flat-map"],"core-js/modules/esnext.async-iterator.for-each":["esnext.async-iterator.for-each"],"core-js/modules/esnext.async-iterator.from":["esnext.async-iterator.from"],"core-js/modules/esnext.async-iterator.map":["esnext.async-iterator.map"],"core-js/modules/esnext.async-iterator.reduce":["esnext.async-iterator.reduce"],"core-js/modules/esnext.async-iterator.some":["esnext.async-iterator.some"],"core-js/modules/esnext.async-iterator.take":["esnext.async-iterator.take"],"core-js/modules/esnext.async-iterator.to-array":["esnext.async-iterator.to-array"],"core-js/modules/esnext.bigint.range":["esnext.bigint.range"],"core-js/modules/esnext.composite-key":["esnext.composite-key"],"core-js/modules/esnext.composite-symbol":["esnext.composite-symbol"],"core-js/modules/esnext.global-this":["esnext.global-this"],"core-js/modules/esnext.iterator.as-indexed-pairs":["esnext.iterator.as-indexed-pairs"],"core-js/modules/esnext.iterator.constructor":["esnext.iterator.constructor"],"core-js/modules/esnext.iterator.drop":["esnext.iterator.drop"],"core-js/modules/esnext.iterator.every":["esnext.iterator.every"],"core-js/modules/esnext.iterator.filter":["esnext.iterator.filter"],"core-js/modules/esnext.iterator.find":["esnext.iterator.find"],"core-js/modules/esnext.iterator.flat-map":["esnext.iterator.flat-map"],"core-js/modules/esnext.iterator.for-each":["esnext.iterator.for-each"],"core-js/modules/esnext.iterator.from":["esnext.iterator.from"],"core-js/modules/esnext.iterator.map":["esnext.iterator.map"],"core-js/modules/esnext.iterator.reduce":["esnext.iterator.reduce"],"core-js/modules/esnext.iterator.some":["esnext.iterator.some"],"core-js/modules/esnext.iterator.take":["esnext.iterator.take"],"core-js/modules/esnext.iterator.to-array":["esnext.iterator.to-array"],"core-js/modules/esnext.map.delete-all":["esnext.map.delete-all"],"core-js/modules/esnext.map.emplace":["esnext.map.emplace"],"core-js/modules/esnext.map.every":["esnext.map.every"],"core-js/modules/esnext.map.filter":["esnext.map.filter"],"core-js/modules/esnext.map.find":["esnext.map.find"],"core-js/modules/esnext.map.find-key":["esnext.map.find-key"],"core-js/modules/esnext.map.from":["esnext.map.from"],"core-js/modules/esnext.map.group-by":["esnext.map.group-by"],"core-js/modules/esnext.map.includes":["esnext.map.includes"],"core-js/modules/esnext.map.key-by":["esnext.map.key-by"],"core-js/modules/esnext.map.key-of":["esnext.map.key-of"],"core-js/modules/esnext.map.map-keys":["esnext.map.map-keys"],"core-js/modules/esnext.map.map-values":["esnext.map.map-values"],"core-js/modules/esnext.map.merge":["esnext.map.merge"],"core-js/modules/esnext.map.of":["esnext.map.of"],"core-js/modules/esnext.map.reduce":["esnext.map.reduce"],"core-js/modules/esnext.map.some":["esnext.map.some"],"core-js/modules/esnext.map.update":["esnext.map.update"],"core-js/modules/esnext.map.update-or-insert":["esnext.map.update-or-insert"],"core-js/modules/esnext.map.upsert":["esnext.map.upsert"],"core-js/modules/esnext.math.clamp":["esnext.math.clamp"],"core-js/modules/esnext.math.deg-per-rad":["esnext.math.deg-per-rad"],"core-js/modules/esnext.math.degrees":["esnext.math.degrees"],"core-js/modules/esnext.math.fscale":["esnext.math.fscale"],"core-js/modules/esnext.math.iaddh":["esnext.math.iaddh"],"core-js/modules/esnext.math.imulh":["esnext.math.imulh"],"core-js/modules/esnext.math.isubh":["esnext.math.isubh"],"core-js/modules/esnext.math.rad-per-deg":["esnext.math.rad-per-deg"],"core-js/modules/esnext.math.radians":["esnext.math.radians"],"core-js/modules/esnext.math.scale":["esnext.math.scale"],"core-js/modules/esnext.math.seeded-prng":["esnext.math.seeded-prng"],"core-js/modules/esnext.math.signbit":["esnext.math.signbit"],"core-js/modules/esnext.math.umulh":["esnext.math.umulh"],"core-js/modules/esnext.number.from-string":["esnext.number.from-string"],"core-js/modules/esnext.number.range":["esnext.number.range"],"core-js/modules/esnext.object.has-own":["esnext.object.has-own"],"core-js/modules/esnext.object.iterate-entries":["esnext.object.iterate-entries"],"core-js/modules/esnext.object.iterate-keys":["esnext.object.iterate-keys"],"core-js/modules/esnext.object.iterate-values":["esnext.object.iterate-values"],"core-js/modules/esnext.observable":["esnext.observable"],"core-js/modules/esnext.promise.all-settled":["esnext.promise.all-settled"],"core-js/modules/esnext.promise.any":["esnext.promise.any"],"core-js/modules/esnext.promise.try":["esnext.promise.try"],"core-js/modules/esnext.reflect.define-metadata":["esnext.reflect.define-metadata"],"core-js/modules/esnext.reflect.delete-metadata":["esnext.reflect.delete-metadata"],"core-js/modules/esnext.reflect.get-metadata":["esnext.reflect.get-metadata"],"core-js/modules/esnext.reflect.get-metadata-keys":["esnext.reflect.get-metadata-keys"],"core-js/modules/esnext.reflect.get-own-metadata":["esnext.reflect.get-own-metadata"],"core-js/modules/esnext.reflect.get-own-metadata-keys":["esnext.reflect.get-own-metadata-keys"],"core-js/modules/esnext.reflect.has-metadata":["esnext.reflect.has-metadata"],"core-js/modules/esnext.reflect.has-own-metadata":["esnext.reflect.has-own-metadata"],"core-js/modules/esnext.reflect.metadata":["esnext.reflect.metadata"],"core-js/modules/esnext.set.add-all":["esnext.set.add-all"],"core-js/modules/esnext.set.delete-all":["esnext.set.delete-all"],"core-js/modules/esnext.set.difference":["esnext.set.difference"],"core-js/modules/esnext.set.every":["esnext.set.every"],"core-js/modules/esnext.set.filter":["esnext.set.filter"],"core-js/modules/esnext.set.find":["esnext.set.find"],"core-js/modules/esnext.set.from":["esnext.set.from"],"core-js/modules/esnext.set.intersection":["esnext.set.intersection"],"core-js/modules/esnext.set.is-disjoint-from":["esnext.set.is-disjoint-from"],"core-js/modules/esnext.set.is-subset-of":["esnext.set.is-subset-of"],"core-js/modules/esnext.set.is-superset-of":["esnext.set.is-superset-of"],"core-js/modules/esnext.set.join":["esnext.set.join"],"core-js/modules/esnext.set.map":["esnext.set.map"],"core-js/modules/esnext.set.of":["esnext.set.of"],"core-js/modules/esnext.set.reduce":["esnext.set.reduce"],"core-js/modules/esnext.set.some":["esnext.set.some"],"core-js/modules/esnext.set.symmetric-difference":["esnext.set.symmetric-difference"],"core-js/modules/esnext.set.union":["esnext.set.union"],"core-js/modules/esnext.string.at":["esnext.string.at"],"core-js/modules/esnext.string.at-alternative":["esnext.string.at-alternative"],"core-js/modules/esnext.string.code-points":["esnext.string.code-points"],"core-js/modules/esnext.string.match-all":["esnext.string.match-all"],"core-js/modules/esnext.string.replace-all":["esnext.string.replace-all"],"core-js/modules/esnext.symbol.async-dispose":["esnext.symbol.async-dispose"],"core-js/modules/esnext.symbol.dispose":["esnext.symbol.dispose"],"core-js/modules/esnext.symbol.matcher":["esnext.symbol.matcher"],"core-js/modules/esnext.symbol.metadata":["esnext.symbol.metadata"],"core-js/modules/esnext.symbol.observable":["esnext.symbol.observable"],"core-js/modules/esnext.symbol.pattern-match":["esnext.symbol.pattern-match"],"core-js/modules/esnext.symbol.replace-all":["esnext.symbol.replace-all"],"core-js/modules/esnext.typed-array.at":["esnext.typed-array.at"],"core-js/modules/esnext.typed-array.filter-out":["esnext.typed-array.filter-out"],"core-js/modules/esnext.typed-array.find-last":["esnext.typed-array.find-last"],"core-js/modules/esnext.typed-array.find-last-index":["esnext.typed-array.find-last-index"],"core-js/modules/esnext.typed-array.unique-by":["esnext.typed-array.unique-by"],"core-js/modules/esnext.weak-map.delete-all":["esnext.weak-map.delete-all"],"core-js/modules/esnext.weak-map.emplace":["esnext.weak-map.emplace"],"core-js/modules/esnext.weak-map.from":["esnext.weak-map.from"],"core-js/modules/esnext.weak-map.of":["esnext.weak-map.of"],"core-js/modules/esnext.weak-map.upsert":["esnext.weak-map.upsert"],"core-js/modules/esnext.weak-set.add-all":["esnext.weak-set.add-all"],"core-js/modules/esnext.weak-set.delete-all":["esnext.weak-set.delete-all"],"core-js/modules/esnext.weak-set.from":["esnext.weak-set.from"],"core-js/modules/esnext.weak-set.of":["esnext.weak-set.of"],"core-js/modules/web.dom-collections.for-each":["web.dom-collections.for-each"],"core-js/modules/web.dom-collections.iterator":["web.dom-collections.iterator"],"core-js/modules/web.immediate":["web.immediate"],"core-js/modules/web.queue-microtask":["web.queue-microtask"],"core-js/modules/web.timers":["web.timers"],"core-js/modules/web.url":["web.url"],"core-js/modules/web.url-search-params":["web.url-search-params"],"core-js/modules/web.url.to-json":["web.url.to-json"],"core-js/proposals":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.url","web.url.to-json","web.url-search-params"],"core-js/proposals/accessible-object-hasownproperty":["esnext.object.has-own"],"core-js/proposals/array-filtering":["esnext.array.filter-out","esnext.typed-array.filter-out"],"core-js/proposals/array-find-from-last":["esnext.array.find-last","esnext.array.find-last-index","esnext.typed-array.find-last","esnext.typed-array.find-last-index"],"core-js/proposals/array-is-template-object":["esnext.array.is-template-object"],"core-js/proposals/array-last":["esnext.array.last-index","esnext.array.last-item"],"core-js/proposals/array-unique":["es.map","esnext.array.unique-by","esnext.typed-array.unique-by"],"core-js/proposals/collection-methods":["esnext.map.delete-all","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.set.add-all","esnext.set.delete-all","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.join","esnext.set.map","esnext.set.reduce","esnext.set.some","esnext.weak-map.delete-all","esnext.weak-set.add-all","esnext.weak-set.delete-all"],"core-js/proposals/collection-of-from":["esnext.map.from","esnext.map.of","esnext.set.from","esnext.set.of","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-set.from","esnext.weak-set.of"],"core-js/proposals/decorators":["esnext.symbol.metadata"],"core-js/proposals/efficient-64-bit-arithmetic":["esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.umulh"],"core-js/proposals/global-this":["esnext.global-this"],"core-js/proposals/iterator-helpers":["esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array"],"core-js/proposals/keys-composition":["esnext.composite-key","esnext.composite-symbol"],"core-js/proposals/map-update-or-insert":["esnext.map.emplace","esnext.map.update-or-insert","esnext.map.upsert","esnext.weak-map.emplace","esnext.weak-map.upsert"],"core-js/proposals/map-upsert":["esnext.map.emplace","esnext.map.update-or-insert","esnext.map.upsert","esnext.weak-map.emplace","esnext.weak-map.upsert"],"core-js/proposals/math-extensions":["esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale"],"core-js/proposals/math-signbit":["esnext.math.signbit"],"core-js/proposals/number-from-string":["esnext.number.from-string"],"core-js/proposals/number-range":["esnext.bigint.range","esnext.number.range"],"core-js/proposals/object-iteration":["esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values"],"core-js/proposals/observable":["esnext.observable","esnext.symbol.observable"],"core-js/proposals/pattern-matching":["esnext.symbol.matcher","esnext.symbol.pattern-match"],"core-js/proposals/promise-all-settled":["esnext.promise.all-settled"],"core-js/proposals/promise-any":["esnext.aggregate-error","esnext.promise.any"],"core-js/proposals/promise-try":["esnext.promise.try"],"core-js/proposals/reflect-metadata":["esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata"],"core-js/proposals/relative-indexing-method":["esnext.array.at","esnext.typed-array.at"],"core-js/proposals/seeded-random":["esnext.math.seeded-prng"],"core-js/proposals/set-methods":["esnext.set.difference","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.symmetric-difference","esnext.set.union"],"core-js/proposals/string-at":["esnext.string.at"],"core-js/proposals/string-code-points":["esnext.string.code-points"],"core-js/proposals/string-match-all":["esnext.string.match-all"],"core-js/proposals/string-replace-all":["esnext.string.replace-all","esnext.symbol.replace-all"],"core-js/proposals/url":["web.url","web.url.to-json","web.url-search-params"],"core-js/proposals/using-statement":["esnext.symbol.async-dispose","esnext.symbol.dispose"],"core-js/stable":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"core-js/stable/aggregate-error":["es.aggregate-error","es.string.iterator","esnext.aggregate-error","web.dom-collections.iterator"],"core-js/stable/array":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.string.iterator"],"core-js/stable/array-buffer":["es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.object.to-string"],"core-js/stable/array-buffer/constructor":["es.array-buffer.constructor","es.object.to-string"],"core-js/stable/array-buffer/is-view":["es.array-buffer.is-view"],"core-js/stable/array-buffer/slice":["es.array-buffer.slice"],"core-js/stable/array/concat":["es.array.concat"],"core-js/stable/array/copy-within":["es.array.copy-within"],"core-js/stable/array/entries":["es.array.iterator"],"core-js/stable/array/every":["es.array.every"],"core-js/stable/array/fill":["es.array.fill"],"core-js/stable/array/filter":["es.array.filter"],"core-js/stable/array/find":["es.array.find"],"core-js/stable/array/find-index":["es.array.find-index"],"core-js/stable/array/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/stable/array/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/stable/array/for-each":["es.array.for-each"],"core-js/stable/array/from":["es.array.from","es.string.iterator"],"core-js/stable/array/includes":["es.array.includes"],"core-js/stable/array/index-of":["es.array.index-of"],"core-js/stable/array/is-array":["es.array.is-array"],"core-js/stable/array/iterator":["es.array.iterator"],"core-js/stable/array/join":["es.array.join"],"core-js/stable/array/keys":["es.array.iterator"],"core-js/stable/array/last-index-of":["es.array.last-index-of"],"core-js/stable/array/map":["es.array.map"],"core-js/stable/array/of":["es.array.of"],"core-js/stable/array/reduce":["es.array.reduce"],"core-js/stable/array/reduce-right":["es.array.reduce-right"],"core-js/stable/array/reverse":["es.array.reverse"],"core-js/stable/array/slice":["es.array.slice"],"core-js/stable/array/some":["es.array.some"],"core-js/stable/array/sort":["es.array.sort"],"core-js/stable/array/splice":["es.array.splice"],"core-js/stable/array/values":["es.array.iterator"],"core-js/stable/array/virtual":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.includes","es.array.index-of","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map"],"core-js/stable/array/virtual/concat":["es.array.concat"],"core-js/stable/array/virtual/copy-within":["es.array.copy-within"],"core-js/stable/array/virtual/entries":["es.array.iterator"],"core-js/stable/array/virtual/every":["es.array.every"],"core-js/stable/array/virtual/fill":["es.array.fill"],"core-js/stable/array/virtual/filter":["es.array.filter"],"core-js/stable/array/virtual/find":["es.array.find"],"core-js/stable/array/virtual/find-index":["es.array.find-index"],"core-js/stable/array/virtual/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/stable/array/virtual/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/stable/array/virtual/for-each":["es.array.for-each"],"core-js/stable/array/virtual/includes":["es.array.includes"],"core-js/stable/array/virtual/index-of":["es.array.index-of"],"core-js/stable/array/virtual/iterator":["es.array.iterator"],"core-js/stable/array/virtual/join":["es.array.join"],"core-js/stable/array/virtual/keys":["es.array.iterator"],"core-js/stable/array/virtual/last-index-of":["es.array.last-index-of"],"core-js/stable/array/virtual/map":["es.array.map"],"core-js/stable/array/virtual/reduce":["es.array.reduce"],"core-js/stable/array/virtual/reduce-right":["es.array.reduce-right"],"core-js/stable/array/virtual/reverse":["es.array.reverse"],"core-js/stable/array/virtual/slice":["es.array.slice"],"core-js/stable/array/virtual/some":["es.array.some"],"core-js/stable/array/virtual/sort":["es.array.sort"],"core-js/stable/array/virtual/splice":["es.array.splice"],"core-js/stable/array/virtual/values":["es.array.iterator"],"core-js/stable/clear-immediate":["web.immediate"],"core-js/stable/data-view":["es.data-view","es.object.to-string"],"core-js/stable/date":["es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string"],"core-js/stable/date/now":["es.date.now"],"core-js/stable/date/to-iso-string":["es.date.to-iso-string","es.date.to-json"],"core-js/stable/date/to-json":["es.date.to-json"],"core-js/stable/date/to-primitive":["es.date.to-primitive"],"core-js/stable/date/to-string":["es.date.to-string"],"core-js/stable/dom-collections":["es.array.iterator","web.dom-collections.for-each","web.dom-collections.iterator"],"core-js/stable/dom-collections/for-each":["web.dom-collections.for-each"],"core-js/stable/dom-collections/iterator":["web.dom-collections.iterator"],"core-js/stable/function":["es.function.bind","es.function.has-instance","es.function.name"],"core-js/stable/function/bind":["es.function.bind"],"core-js/stable/function/has-instance":["es.function.has-instance"],"core-js/stable/function/name":["es.function.name"],"core-js/stable/function/virtual":["es.function.bind"],"core-js/stable/function/virtual/bind":["es.function.bind"],"core-js/stable/global-this":["es.global-this"],"core-js/stable/instance/bind":["es.function.bind"],"core-js/stable/instance/code-point-at":["es.string.code-point-at"],"core-js/stable/instance/concat":["es.array.concat"],"core-js/stable/instance/copy-within":["es.array.copy-within"],"core-js/stable/instance/ends-with":["es.string.ends-with"],"core-js/stable/instance/entries":["es.array.iterator","web.dom-collections.iterator"],"core-js/stable/instance/every":["es.array.every"],"core-js/stable/instance/fill":["es.array.fill"],"core-js/stable/instance/filter":["es.array.filter"],"core-js/stable/instance/find":["es.array.find"],"core-js/stable/instance/find-index":["es.array.find-index"],"core-js/stable/instance/flags":["es.regexp.flags"],"core-js/stable/instance/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/stable/instance/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/stable/instance/for-each":["es.array.for-each","web.dom-collections.iterator"],"core-js/stable/instance/includes":["es.array.includes","es.string.includes"],"core-js/stable/instance/index-of":["es.array.index-of"],"core-js/stable/instance/keys":["es.array.iterator","web.dom-collections.iterator"],"core-js/stable/instance/last-index-of":["es.array.last-index-of"],"core-js/stable/instance/map":["es.array.map"],"core-js/stable/instance/match-all":["es.string.match-all"],"core-js/stable/instance/pad-end":["es.string.pad-end"],"core-js/stable/instance/pad-start":["es.string.pad-start"],"core-js/stable/instance/reduce":["es.array.reduce"],"core-js/stable/instance/reduce-right":["es.array.reduce-right"],"core-js/stable/instance/repeat":["es.string.repeat"],"core-js/stable/instance/replace-all":["es.string.replace-all"],"core-js/stable/instance/reverse":["es.array.reverse"],"core-js/stable/instance/slice":["es.array.slice"],"core-js/stable/instance/some":["es.array.some"],"core-js/stable/instance/sort":["es.array.sort"],"core-js/stable/instance/splice":["es.array.splice"],"core-js/stable/instance/starts-with":["es.string.starts-with"],"core-js/stable/instance/trim":["es.string.trim"],"core-js/stable/instance/trim-end":["es.string.trim-end"],"core-js/stable/instance/trim-left":["es.string.trim-start"],"core-js/stable/instance/trim-right":["es.string.trim-end"],"core-js/stable/instance/trim-start":["es.string.trim-start"],"core-js/stable/instance/values":["es.array.iterator","web.dom-collections.iterator"],"core-js/stable/json":["es.json.stringify","es.json.to-string-tag"],"core-js/stable/json/stringify":["es.json.stringify"],"core-js/stable/json/to-string-tag":["es.json.to-string-tag"],"core-js/stable/map":["es.map","es.object.to-string","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/math":["es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc"],"core-js/stable/math/acosh":["es.math.acosh"],"core-js/stable/math/asinh":["es.math.asinh"],"core-js/stable/math/atanh":["es.math.atanh"],"core-js/stable/math/cbrt":["es.math.cbrt"],"core-js/stable/math/clz32":["es.math.clz32"],"core-js/stable/math/cosh":["es.math.cosh"],"core-js/stable/math/expm1":["es.math.expm1"],"core-js/stable/math/fround":["es.math.fround"],"core-js/stable/math/hypot":["es.math.hypot"],"core-js/stable/math/imul":["es.math.imul"],"core-js/stable/math/log10":["es.math.log10"],"core-js/stable/math/log1p":["es.math.log1p"],"core-js/stable/math/log2":["es.math.log2"],"core-js/stable/math/sign":["es.math.sign"],"core-js/stable/math/sinh":["es.math.sinh"],"core-js/stable/math/tanh":["es.math.tanh"],"core-js/stable/math/to-string-tag":["es.math.to-string-tag"],"core-js/stable/math/trunc":["es.math.trunc"],"core-js/stable/number":["es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision"],"core-js/stable/number/constructor":["es.number.constructor"],"core-js/stable/number/epsilon":["es.number.epsilon"],"core-js/stable/number/is-finite":["es.number.is-finite"],"core-js/stable/number/is-integer":["es.number.is-integer"],"core-js/stable/number/is-nan":["es.number.is-nan"],"core-js/stable/number/is-safe-integer":["es.number.is-safe-integer"],"core-js/stable/number/max-safe-integer":["es.number.max-safe-integer"],"core-js/stable/number/min-safe-integer":["es.number.min-safe-integer"],"core-js/stable/number/parse-float":["es.number.parse-float"],"core-js/stable/number/parse-int":["es.number.parse-int"],"core-js/stable/number/to-fixed":["es.number.to-fixed"],"core-js/stable/number/to-precision":["es.number.to-precision"],"core-js/stable/number/virtual":["es.number.to-fixed","es.number.to-precision"],"core-js/stable/number/virtual/to-fixed":["es.number.to-fixed"],"core-js/stable/number/virtual/to-precision":["es.number.to-precision"],"core-js/stable/object":["es.symbol","es.json.to-string-tag","es.math.to-string-tag","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.reflect.to-string-tag"],"core-js/stable/object/assign":["es.object.assign"],"core-js/stable/object/create":["es.object.create"],"core-js/stable/object/define-getter":["es.object.define-getter"],"core-js/stable/object/define-properties":["es.object.define-properties"],"core-js/stable/object/define-property":["es.object.define-property"],"core-js/stable/object/define-setter":["es.object.define-setter"],"core-js/stable/object/entries":["es.object.entries"],"core-js/stable/object/freeze":["es.object.freeze"],"core-js/stable/object/from-entries":["es.array.iterator","es.object.from-entries"],"core-js/stable/object/get-own-property-descriptor":["es.object.get-own-property-descriptor"],"core-js/stable/object/get-own-property-descriptors":["es.object.get-own-property-descriptors"],"core-js/stable/object/get-own-property-names":["es.object.get-own-property-names"],"core-js/stable/object/get-own-property-symbols":["es.symbol"],"core-js/stable/object/get-prototype-of":["es.object.get-prototype-of"],"core-js/stable/object/is":["es.object.is"],"core-js/stable/object/is-extensible":["es.object.is-extensible"],"core-js/stable/object/is-frozen":["es.object.is-frozen"],"core-js/stable/object/is-sealed":["es.object.is-sealed"],"core-js/stable/object/keys":["es.object.keys"],"core-js/stable/object/lookup-getter":["es.object.lookup-setter"],"core-js/stable/object/lookup-setter":["es.object.lookup-setter"],"core-js/stable/object/prevent-extensions":["es.object.prevent-extensions"],"core-js/stable/object/seal":["es.object.seal"],"core-js/stable/object/set-prototype-of":["es.object.set-prototype-of"],"core-js/stable/object/to-string":["es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/stable/object/values":["es.object.values"],"core-js/stable/parse-float":["es.parse-float"],"core-js/stable/parse-int":["es.parse-int"],"core-js/stable/promise":["es.aggregate-error","es.object.to-string","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/promise/all-settled":["es.promise","es.promise.all-settled","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/promise/any":["es.aggregate-error","es.promise","es.promise.any","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/promise/finally":["es.promise","es.promise.finally"],"core-js/stable/queue-microtask":["web.queue-microtask"],"core-js/stable/reflect":["es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag"],"core-js/stable/reflect/apply":["es.reflect.apply"],"core-js/stable/reflect/construct":["es.reflect.construct"],"core-js/stable/reflect/define-property":["es.reflect.define-property"],"core-js/stable/reflect/delete-property":["es.reflect.delete-property"],"core-js/stable/reflect/get":["es.reflect.get"],"core-js/stable/reflect/get-own-property-descriptor":["es.reflect.get-own-property-descriptor"],"core-js/stable/reflect/get-prototype-of":["es.reflect.get-prototype-of"],"core-js/stable/reflect/has":["es.reflect.has"],"core-js/stable/reflect/is-extensible":["es.reflect.is-extensible"],"core-js/stable/reflect/own-keys":["es.reflect.own-keys"],"core-js/stable/reflect/prevent-extensions":["es.reflect.prevent-extensions"],"core-js/stable/reflect/set":["es.reflect.set"],"core-js/stable/reflect/set-prototype-of":["es.reflect.set-prototype-of"],"core-js/stable/reflect/to-string-tag":["es.reflect.to-string-tag"],"core-js/stable/regexp":["es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.string.match","es.string.replace","es.string.search","es.string.split"],"core-js/stable/regexp/constructor":["es.regexp.constructor"],"core-js/stable/regexp/flags":["es.regexp.flags"],"core-js/stable/regexp/match":["es.string.match"],"core-js/stable/regexp/replace":["es.string.replace"],"core-js/stable/regexp/search":["es.string.search"],"core-js/stable/regexp/split":["es.string.split"],"core-js/stable/regexp/sticky":["es.regexp.sticky"],"core-js/stable/regexp/test":["es.regexp.exec","es.regexp.test"],"core-js/stable/regexp/to-string":["es.regexp.to-string"],"core-js/stable/set":["es.object.to-string","es.set","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/set-immediate":["web.immediate"],"core-js/stable/set-interval":["web.timers"],"core-js/stable/set-timeout":["web.timers"],"core-js/stable/string":["es.regexp.exec","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup"],"core-js/stable/string/anchor":["es.string.anchor"],"core-js/stable/string/big":["es.string.big"],"core-js/stable/string/blink":["es.string.blink"],"core-js/stable/string/bold":["es.string.bold"],"core-js/stable/string/code-point-at":["es.string.code-point-at"],"core-js/stable/string/ends-with":["es.string.ends-with"],"core-js/stable/string/fixed":["es.string.fixed"],"core-js/stable/string/fontcolor":["es.string.fontcolor"],"core-js/stable/string/fontsize":["es.string.fontsize"],"core-js/stable/string/from-code-point":["es.string.from-code-point"],"core-js/stable/string/includes":["es.string.includes"],"core-js/stable/string/italics":["es.string.italics"],"core-js/stable/string/iterator":["es.string.iterator"],"core-js/stable/string/link":["es.string.link"],"core-js/stable/string/match":["es.regexp.exec","es.string.match"],"core-js/stable/string/match-all":["es.string.match-all"],"core-js/stable/string/pad-end":["es.string.pad-end"],"core-js/stable/string/pad-start":["es.string.pad-start"],"core-js/stable/string/raw":["es.string.raw"],"core-js/stable/string/repeat":["es.string.repeat"],"core-js/stable/string/replace":["es.regexp.exec","es.string.replace"],"core-js/stable/string/replace-all":["es.string.replace-all"],"core-js/stable/string/search":["es.regexp.exec","es.string.search"],"core-js/stable/string/small":["es.string.small"],"core-js/stable/string/split":["es.regexp.exec","es.string.split"],"core-js/stable/string/starts-with":["es.string.starts-with"],"core-js/stable/string/strike":["es.string.strike"],"core-js/stable/string/sub":["es.string.sub"],"core-js/stable/string/sup":["es.string.sup"],"core-js/stable/string/trim":["es.string.trim"],"core-js/stable/string/trim-end":["es.string.trim-end"],"core-js/stable/string/trim-left":["es.string.trim-start"],"core-js/stable/string/trim-right":["es.string.trim-end"],"core-js/stable/string/trim-start":["es.string.trim-start"],"core-js/stable/string/virtual":["es.string.code-point-at","es.string.ends-with","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup"],"core-js/stable/string/virtual/anchor":["es.string.anchor"],"core-js/stable/string/virtual/big":["es.string.big"],"core-js/stable/string/virtual/blink":["es.string.blink"],"core-js/stable/string/virtual/bold":["es.string.bold"],"core-js/stable/string/virtual/code-point-at":["es.string.code-point-at"],"core-js/stable/string/virtual/ends-with":["es.string.ends-with"],"core-js/stable/string/virtual/fixed":["es.string.fixed"],"core-js/stable/string/virtual/fontcolor":["es.string.fontcolor"],"core-js/stable/string/virtual/fontsize":["es.string.fontsize"],"core-js/stable/string/virtual/includes":["es.string.includes"],"core-js/stable/string/virtual/italics":["es.string.italics"],"core-js/stable/string/virtual/iterator":["es.string.iterator"],"core-js/stable/string/virtual/link":["es.string.link"],"core-js/stable/string/virtual/match-all":["es.string.match-all"],"core-js/stable/string/virtual/pad-end":["es.string.pad-end"],"core-js/stable/string/virtual/pad-start":["es.string.pad-start"],"core-js/stable/string/virtual/repeat":["es.string.repeat"],"core-js/stable/string/virtual/replace-all":["es.string.replace-all"],"core-js/stable/string/virtual/small":["es.string.small"],"core-js/stable/string/virtual/starts-with":["es.string.starts-with"],"core-js/stable/string/virtual/strike":["es.string.strike"],"core-js/stable/string/virtual/sub":["es.string.sub"],"core-js/stable/string/virtual/sup":["es.string.sup"],"core-js/stable/string/virtual/trim":["es.string.trim"],"core-js/stable/string/virtual/trim-end":["es.string.trim-end"],"core-js/stable/string/virtual/trim-left":["es.string.trim-start"],"core-js/stable/string/virtual/trim-right":["es.string.trim-end"],"core-js/stable/string/virtual/trim-start":["es.string.trim-start"],"core-js/stable/symbol":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.array.concat","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/stable/symbol/async-iterator":["es.symbol.async-iterator"],"core-js/stable/symbol/description":["es.symbol.description"],"core-js/stable/symbol/for":["es.symbol"],"core-js/stable/symbol/has-instance":["es.symbol.has-instance","es.function.has-instance"],"core-js/stable/symbol/is-concat-spreadable":["es.symbol.is-concat-spreadable","es.array.concat"],"core-js/stable/symbol/iterator":["es.symbol.iterator","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/symbol/key-for":["es.symbol"],"core-js/stable/symbol/match":["es.symbol.match","es.string.match"],"core-js/stable/symbol/match-all":["es.symbol.match-all","es.string.match-all"],"core-js/stable/symbol/replace":["es.symbol.replace","es.string.replace"],"core-js/stable/symbol/search":["es.symbol.search","es.string.search"],"core-js/stable/symbol/species":["es.symbol.species"],"core-js/stable/symbol/split":["es.symbol.split","es.string.split"],"core-js/stable/symbol/to-primitive":["es.symbol.to-primitive"],"core-js/stable/symbol/to-string-tag":["es.symbol.to-string-tag","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/stable/symbol/unscopables":["es.symbol.unscopables"],"core-js/stable/typed-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/copy-within":["es.typed-array.copy-within"],"core-js/stable/typed-array/entries":["es.typed-array.iterator"],"core-js/stable/typed-array/every":["es.typed-array.every"],"core-js/stable/typed-array/fill":["es.typed-array.fill"],"core-js/stable/typed-array/filter":["es.typed-array.filter"],"core-js/stable/typed-array/find":["es.typed-array.find"],"core-js/stable/typed-array/find-index":["es.typed-array.find-index"],"core-js/stable/typed-array/float32-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/float64-array":["es.object.to-string","es.typed-array.float64-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/for-each":["es.typed-array.for-each"],"core-js/stable/typed-array/from":["es.typed-array.from"],"core-js/stable/typed-array/includes":["es.typed-array.includes"],"core-js/stable/typed-array/index-of":["es.typed-array.index-of"],"core-js/stable/typed-array/int16-array":["es.object.to-string","es.typed-array.int16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/int32-array":["es.object.to-string","es.typed-array.int32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/int8-array":["es.object.to-string","es.typed-array.int8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/iterator":["es.typed-array.iterator"],"core-js/stable/typed-array/join":["es.typed-array.join"],"core-js/stable/typed-array/keys":["es.typed-array.iterator"],"core-js/stable/typed-array/last-index-of":["es.typed-array.last-index-of"],"core-js/stable/typed-array/map":["es.typed-array.map"],"core-js/stable/typed-array/of":["es.typed-array.of"],"core-js/stable/typed-array/reduce":["es.typed-array.reduce"],"core-js/stable/typed-array/reduce-right":["es.typed-array.reduce-right"],"core-js/stable/typed-array/reverse":["es.typed-array.reverse"],"core-js/stable/typed-array/set":["es.typed-array.set"],"core-js/stable/typed-array/slice":["es.typed-array.slice"],"core-js/stable/typed-array/some":["es.typed-array.some"],"core-js/stable/typed-array/sort":["es.typed-array.sort"],"core-js/stable/typed-array/subarray":["es.typed-array.subarray"],"core-js/stable/typed-array/to-locale-string":["es.typed-array.to-locale-string"],"core-js/stable/typed-array/to-string":["es.typed-array.to-string"],"core-js/stable/typed-array/uint16-array":["es.object.to-string","es.typed-array.uint16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/uint32-array":["es.object.to-string","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/uint8-array":["es.object.to-string","es.typed-array.uint8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/uint8-clamped-array":["es.object.to-string","es.typed-array.uint8-clamped-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/values":["es.typed-array.iterator"],"core-js/stable/url":["web.url","web.url.to-json","web.url-search-params"],"core-js/stable/url-search-params":["web.url-search-params"],"core-js/stable/url/to-json":["web.url.to-json"],"core-js/stable/weak-map":["es.object.to-string","es.weak-map","web.dom-collections.iterator"],"core-js/stable/weak-set":["es.object.to-string","es.weak-set","web.dom-collections.iterator"],"core-js/stage":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.url","web.url.to-json","web.url-search-params"],"core-js/stage/0":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.url","web.url.to-json","web.url-search-params"],"core-js/stage/1":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of"],"core-js/stage/2":["esnext.aggregate-error","esnext.array.at","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.emplace","esnext.map.update-or-insert","esnext.map.upsert","esnext.object.has-own","esnext.promise.all-settled","esnext.promise.any","esnext.set.difference","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.symmetric-difference","esnext.set.union","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.metadata","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.weak-map.emplace","esnext.weak-map.upsert"],"core-js/stage/3":["esnext.aggregate-error","esnext.array.at","esnext.global-this","esnext.object.has-own","esnext.promise.all-settled","esnext.promise.any","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.replace-all","esnext.typed-array.at"],"core-js/stage/4":["esnext.aggregate-error","esnext.global-this","esnext.promise.all-settled","esnext.promise.any","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.replace-all"],"core-js/stage/pre":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.url","web.url.to-json","web.url-search-params"],"core-js/web":["web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"core-js/web/dom-collections":["web.dom-collections.for-each","web.dom-collections.iterator"],"core-js/web/immediate":["web.immediate"],"core-js/web/queue-microtask":["web.queue-microtask"],"core-js/web/timers":["web.timers"],"core-js/web/url":["web.url","web.url.to-json","web.url-search-params"],"core-js/web/url-search-params":["web.url-search-params"]}')},4970:e=>{"use strict";e.exports=JSON.parse('{"3.0":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","esnext.aggregate-error","esnext.array.last-index","esnext.array.last-item","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.map.delete-all","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.dispose","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"3.1":["es.string.match-all","es.symbol.match-all","esnext.symbol.replace-all"],"3.2":["es.promise.all-settled","esnext.array.is-template-object","esnext.map.update-or-insert","esnext.symbol.async-dispose"],"3.3":["es.global-this","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.upsert","esnext.weak-map.upsert"],"3.4":["es.json.stringify"],"3.5":["esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values"],"3.6":["es.regexp.sticky","es.regexp.test"],"3.7":["es.aggregate-error","es.promise.any","es.reflect.to-string-tag","es.string.replace-all","esnext.map.emplace","esnext.weak-map.emplace"],"3.8":["esnext.array.at","esnext.array.filter-out","esnext.array.unique-by","esnext.bigint.range","esnext.number.range","esnext.typed-array.at","esnext.typed-array.filter-out"],"3.9":["esnext.array.find-last","esnext.array.find-last-index","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by"],"3.11":["esnext.object.has-own"],"3.12":["esnext.symbol.matcher","esnext.symbol.metadata"]}')},2885:e=>{"use strict";e.exports=JSON.parse('["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"]')},6578:e=>{"use strict";e.exports=JSON.parse('{"es.symbol":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.symbol.description":{"android":"70","chrome":"70","deno":"1.0","edge":"74","electron":"5.0","firefox":"63","ios":"12.2","node":"11.0","opera":"57","opera_mobile":"49","safari":"12.1","samsung":"10.0"},"es.symbol.async-iterator":{"android":"63","chrome":"63","deno":"1.0","edge":"74","electron":"3.0","firefox":"55","ios":"12.0","node":"10.0","opera":"50","opera_mobile":"46","safari":"12.0","samsung":"8.0"},"es.symbol.has-instance":{"android":"50","chrome":"50","deno":"1.0","edge":"15","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.is-concat-spreadable":{"android":"48","chrome":"48","deno":"1.0","edge":"15","electron":"0.37","firefox":"48","ios":"10.0","node":"6.0","opera":"35","opera_mobile":"35","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.iterator":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"36","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.symbol.match":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"40","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.match-all":{"android":"73","chrome":"73","deno":"1.0","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.symbol.replace":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.search":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.species":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"41","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.split":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.to-primitive":{"android":"47","chrome":"47","deno":"1.0","edge":"15","electron":"0.36","firefox":"44","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.to-string-tag":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.unscopables":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"48","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.aggregate-error":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"es.array.concat":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.copy-within":{"android":"45","chrome":"45","deno":"1.0","edge":"12","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.every":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.array.fill":{"android":"45","chrome":"45","deno":"1.0","edge":"12","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.filter":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.find":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.find-index":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.flat":{"android":"69","chrome":"69","deno":"1.0","edge":"74","electron":"4.0","firefox":"62","ios":"12.0","node":"11.0","opera":"56","opera_mobile":"48","safari":"12.0","samsung":"10.0"},"es.array.flat-map":{"android":"69","chrome":"69","deno":"1.0","edge":"74","electron":"4.0","firefox":"62","ios":"12.0","node":"11.0","opera":"56","opera_mobile":"48","safari":"12.0","samsung":"10.0"},"es.array.for-each":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.array.from":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"9.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"9.0","samsung":"5.0"},"es.array.includes":{"android":"53","chrome":"53","deno":"1.0","edge":"14","electron":"1.4","firefox":"48","ios":"10.0","node":"7.0","opera":"40","opera_mobile":"40","safari":"10.0","samsung":"6.0"},"es.array.index-of":{"android":"51","chrome":"51","deno":"1.0","edge":"12","electron":"1.2","firefox":"4","ie":"9","ios":"8.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"7.1","samsung":"5.0"},"es.array.is-array":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"4.0","samsung":"1.0"},"es.array.iterator":{"android":"66","chrome":"66","deno":"1.0","edge":"15","electron":"3.0","firefox":"60","ios":"10.0","node":"10.0","opera":"53","opera_mobile":"47","safari":"10.0","samsung":"9.0"},"es.array.join":{"android":"4.4","chrome":"26","deno":"1.0","edge":"13","electron":"0.20","firefox":"4","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.array.last-index-of":{"android":"51","chrome":"51","deno":"1.0","edge":"12","electron":"1.2","firefox":"4","ie":"9","ios":"8.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"7.1","samsung":"5.0"},"es.array.map":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"50","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.of":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"25","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","rhino":"1.7.13","safari":"9.0","samsung":"5.0"},"es.array.reduce":{"android":"83","chrome":"83","deno":"1.0","edge":"12","electron":"9.0","firefox":"4","ie":"9","ios":"8.0","node":"6.0","opera":"69","opera_mobile":"59","rhino":"1.7.13","safari":"7.1","samsung":"13.0"},"es.array.reduce-right":{"android":"83","chrome":"83","deno":"1.0","edge":"12","electron":"9.0","firefox":"4","ie":"9","ios":"8.0","node":"6.0","opera":"69","opera_mobile":"59","rhino":"1.7.13","safari":"7.1","samsung":"13.0"},"es.array.reverse":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"5.5","ios":"12.2","node":"0.0.3","opera":"10.50","opera_mobile":"10.50","rhino":"1.7.13","safari":"12.0.2","samsung":"1.0"},"es.array.slice":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.some":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.array.sort":{"android":"70","chrome":"70","deno":"1.0","edge":"74","electron":"5.0","firefox":"4","ios":"12.0","node":"11.0","opera":"57","opera_mobile":"49","safari":"12.0","samsung":"10.0"},"es.array.species":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.splice":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.unscopables.flat":{"android":"73","chrome":"73","deno":"1.0","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.array.unscopables.flat-map":{"android":"73","chrome":"73","deno":"1.0","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.array-buffer.constructor":{"android":"4.4","chrome":"26","deno":"1.0","edge":"14","electron":"0.20","firefox":"44","ios":"12.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"12.0","samsung":"1.5"},"es.array-buffer.is-view":{"android":"4.4.3","chrome":"32","deno":"1.0","edge":"12","electron":"0.20","firefox":"29","ie":"11","ios":"8.0","node":"0.11.9","opera":"19","opera_mobile":"19","safari":"7.1","samsung":"2.0"},"es.array-buffer.slice":{"android":"4.4.3","chrome":"31","deno":"1.0","edge":"12","electron":"0.20","firefox":"46","ie":"11","ios":"12.2","node":"0.11.8","opera":"18","opera_mobile":"18","rhino":"1.7.13","safari":"12.1","samsung":"2.0"},"es.data-view":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"15","ie":"10","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.date.get-year":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"9","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.date.now":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ie":"9","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"4.0","samsung":"1.0"},"es.date.set-year":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"3","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.date.to-gmt-string":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"3","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.date.to-iso-string":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"7","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.date.to-json":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"10.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"10.0","samsung":"1.5"},"es.date.to-primitive":{"android":"47","chrome":"47","deno":"1.0","edge":"15","electron":"0.36","firefox":"44","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.date.to-string":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ie":"9","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.escape":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"3","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.function.bind":{"android":"3.0","chrome":"7","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.101","opera":"12","opera_mobile":"12","phantom":"2.0","rhino":"1.7.13","safari":"5.1","samsung":"1.0"},"es.function.has-instance":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"50","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.function.name":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"4.0","samsung":"1.0"},"es.global-this":{"android":"71","chrome":"71","deno":"1.0","edge":"74","electron":"5.0","firefox":"65","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"es.json.stringify":{"android":"72","chrome":"72","deno":"1.0","edge":"74","electron":"5.0","firefox":"64","ios":"12.2","node":"12.0","opera":"59","opera_mobile":"51","safari":"12.1","samsung":"11.0"},"es.json.to-string-tag":{"android":"50","chrome":"50","deno":"1.0","edge":"15","electron":"1.1","firefox":"51","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.map":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.math.acosh":{"android":"54","chrome":"54","deno":"1.0","edge":"13","electron":"1.4","firefox":"25","ios":"8.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"7.1","samsung":"6.0"},"es.math.asinh":{"android":"38","chrome":"38","deno":"1.0","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.atanh":{"android":"38","chrome":"38","deno":"1.0","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.cbrt":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.clz32":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"9.0","samsung":"3.0"},"es.math.cosh":{"android":"39","chrome":"39","deno":"1.0","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","rhino":"1.7.13","safari":"7.1","samsung":"3.4"},"es.math.expm1":{"android":"39","chrome":"39","deno":"1.0","edge":"13","electron":"0.20","firefox":"46","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","rhino":"1.7.13","safari":"7.1","samsung":"3.4"},"es.math.fround":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"26","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.hypot":{"android":"78","chrome":"78","deno":"1.0","edge":"12","electron":"7.0","firefox":"27","ios":"8.0","node":"13.0","opera":"65","opera_mobile":"56","rhino":"1.7.13","safari":"7.1","samsung":"12.0"},"es.math.imul":{"android":"4.4","chrome":"28","deno":"1.0","edge":"13","electron":"0.20","firefox":"20","ios":"9.0","node":"0.11.1","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"9.0","samsung":"1.5"},"es.math.log10":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.log1p":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.log2":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.sign":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"9.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"9.0","samsung":"3.0"},"es.math.sinh":{"android":"39","chrome":"39","deno":"1.0","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","rhino":"1.7.13","safari":"7.1","samsung":"3.4"},"es.math.tanh":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.to-string-tag":{"android":"50","chrome":"50","deno":"1.0","edge":"15","electron":"1.1","firefox":"51","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.math.trunc":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.number.constructor":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"46","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.number.epsilon":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.is-finite":{"android":"4.1","chrome":"19","deno":"1.0","edge":"12","electron":"0.20","firefox":"16","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","rhino":"1.7.13","safari":"9.0","samsung":"1.5"},"es.number.is-integer":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"16","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.number.is-nan":{"android":"4.1","chrome":"19","deno":"1.0","edge":"12","electron":"0.20","firefox":"15","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","rhino":"1.7.13","safari":"9.0","samsung":"1.5"},"es.number.is-safe-integer":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"32","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.number.max-safe-integer":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.number.min-safe-integer":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.number.parse-float":{"android":"37","chrome":"35","deno":"1.0","edge":"13","electron":"0.20","firefox":"39","ios":"11.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"11.0","samsung":"3.0"},"es.number.parse-int":{"android":"37","chrome":"35","deno":"1.0","edge":"13","electron":"0.20","firefox":"39","ios":"9.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"9.0","samsung":"3.0"},"es.number.to-fixed":{"android":"4.4","chrome":"26","deno":"1.0","edge":"74","electron":"0.20","firefox":"4","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.number.to-precision":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"8","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.object.assign":{"android":"49","chrome":"49","deno":"1.0","edge":"74","electron":"0.37","firefox":"36","ios":"9.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"9.0","samsung":"5.0"},"es.object.create":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"3.2","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"1.9","rhino":"1.7.13","safari":"4.0","samsung":"1.0"},"es.object.define-getter":{"android":"62","chrome":"62","deno":"1.0","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","rhino":"1.7.13","safari":"7.1","samsung":"8.0"},"es.object.define-properties":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"2.0","rhino":"1.7.13","safari":"5.1","samsung":"1.0"},"es.object.define-property":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"2.0","rhino":"1.7.13","safari":"5.1","samsung":"1.0"},"es.object.define-setter":{"android":"62","chrome":"62","deno":"1.0","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","rhino":"1.7.13","safari":"7.1","samsung":"8.0"},"es.object.entries":{"android":"54","chrome":"54","deno":"1.0","edge":"14","electron":"1.4","firefox":"47","ios":"10.3","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.1","samsung":"6.0"},"es.object.freeze":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.from-entries":{"android":"73","chrome":"73","deno":"1.0","edge":"74","electron":"5.0","firefox":"63","ios":"12.2","node":"12.0","opera":"60","opera_mobile":"52","safari":"12.1","samsung":"11.0"},"es.object.get-own-property-descriptor":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.get-own-property-descriptors":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"50","ios":"10.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.0","samsung":"6.0"},"es.object.get-own-property-names":{"android":"40","chrome":"40","deno":"1.0","edge":"13","electron":"0.21","firefox":"34","ios":"9.0","node":"1.0","opera":"27","opera_mobile":"27","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.object.get-prototype-of":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.is":{"android":"4.1","chrome":"19","deno":"1.0","edge":"12","electron":"0.20","firefox":"22","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","rhino":"1.7.13","safari":"9.0","samsung":"1.5"},"es.object.is-extensible":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.is-frozen":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.is-sealed":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.keys":{"android":"40","chrome":"40","deno":"1.0","edge":"13","electron":"0.21","firefox":"35","ios":"9.0","node":"1.0","opera":"27","opera_mobile":"27","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.object.lookup-getter":{"android":"62","chrome":"62","deno":"1.0","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","rhino":"1.7.13","safari":"7.1","samsung":"8.0"},"es.object.lookup-setter":{"android":"62","chrome":"62","deno":"1.0","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","rhino":"1.7.13","safari":"7.1","samsung":"8.0"},"es.object.prevent-extensions":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.seal":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.set-prototype-of":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"31","ie":"11","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.object.to-string":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.object.values":{"android":"54","chrome":"54","deno":"1.0","edge":"14","electron":"1.4","firefox":"47","ios":"10.3","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.1","samsung":"6.0"},"es.parse-float":{"android":"37","chrome":"35","deno":"1.0","edge":"12","electron":"0.20","firefox":"8","ie":"8","ios":"8.0","node":"0.11.13","opera":"22","opera_mobile":"22","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.parse-int":{"android":"37","chrome":"35","deno":"1.0","edge":"12","electron":"0.20","firefox":"21","ie":"9","ios":"8.0","node":"0.11.13","opera":"22","opera_mobile":"22","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.promise":{"android":"67","chrome":"67","deno":"1.0","edge":"74","electron":"4.0","firefox":"69","ios":"11.0","node":"10.4","opera":"54","opera_mobile":"48","safari":"11.0","samsung":"9.0"},"es.promise.all-settled":{"android":"76","chrome":"76","deno":"1.0","edge":"76","electron":"6.0","firefox":"71","ios":"13.0","node":"12.9","opera":"63","opera_mobile":"54","safari":"13","samsung":"12.0"},"es.promise.any":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"es.promise.finally":{"android":"67","chrome":"67","deno":"1.0","edge":"74","electron":"4.0","firefox":"69","ios":"13.2.3","node":"10.4","opera":"54","opera_mobile":"48","safari":"13.0.3","samsung":"9.0"},"es.reflect.apply":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.construct":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"44","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.define-property":{"android":"49","chrome":"49","deno":"1.0","edge":"13","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.delete-property":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get-own-property-descriptor":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get-prototype-of":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.has":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.is-extensible":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.own-keys":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.prevent-extensions":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.set":{"android":"49","chrome":"49","deno":"1.0","edge":"74","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.set-prototype-of":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.to-string-tag":{"android":"86","chrome":"86","deno":"1.3","edge":"86","electron":"11.0","firefox":"82","ios":"14.0","node":"15.0","opera":"72","opera_mobile":"61","safari":"14.0","samsung":"14.0"},"es.regexp.constructor":{"android":"64","chrome":"64","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"11.3","node":"10.0","opera":"51","opera_mobile":"47","safari":"11.1","samsung":"9.0"},"es.regexp.dot-all":{"android":"62","chrome":"62","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"11.3","node":"8.10","opera":"49","opera_mobile":"46","safari":"11.1","samsung":"8.0"},"es.regexp.exec":{"android":"64","chrome":"64","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"11.3","node":"10.0","opera":"51","opera_mobile":"47","safari":"11.1","samsung":"9.0"},"es.regexp.flags":{"android":"62","chrome":"62","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"11.3","node":"8.10","opera":"49","opera_mobile":"46","safari":"11.1","samsung":"8.0"},"es.regexp.sticky":{"android":"49","chrome":"49","deno":"1.0","edge":"13","electron":"0.37","firefox":"3","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.regexp.test":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"46","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.regexp.to-string":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"46","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.set":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.string.code-point-at":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"29","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.string.ends-with":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.from-code-point":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"29","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.string.includes":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.iterator":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"36","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.string.match":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.match-all":{"android":"80","chrome":"80","deno":"1.0","edge":"80","electron":"8.0","firefox":"73","ios":"13.4","node":"14.0","opera":"67","opera_mobile":"57","safari":"13.1","samsung":"13.0"},"es.string.pad-end":{"android":"57","chrome":"57","deno":"1.0","edge":"15","electron":"1.7","firefox":"48","ios":"11.0","node":"8.0","opera":"44","opera_mobile":"43","rhino":"1.7.13","safari":"11.0","samsung":"7.0"},"es.string.pad-start":{"android":"57","chrome":"57","deno":"1.0","edge":"15","electron":"1.7","firefox":"48","ios":"11.0","node":"8.0","opera":"44","opera_mobile":"43","rhino":"1.7.13","safari":"11.0","samsung":"7.0"},"es.string.raw":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"34","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.repeat":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"24","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.string.replace":{"android":"64","chrome":"64","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"14.0","node":"10.0","opera":"51","opera_mobile":"47","safari":"14.0","samsung":"9.0"},"es.string.replace-all":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"77","ios":"13.4","node":"15.0","opera":"71","opera_mobile":"60","safari":"13.1","samsung":"14.0"},"es.string.search":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.split":{"android":"54","chrome":"54","deno":"1.0","edge":"74","electron":"1.4","firefox":"49","ios":"10.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.0","samsung":"6.0"},"es.string.starts-with":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.substr":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"4","ios":"1.0","node":"0.0.3","opera":"4","opera_mobile":"4","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.string.trim":{"android":"59","chrome":"59","deno":"1.0","edge":"15","electron":"1.8","firefox":"52","ios":"12.2","node":"8.3","opera":"46","opera_mobile":"43","rhino":"1.7.13","safari":"12.1","samsung":"7.0"},"es.string.trim-end":{"android":"66","chrome":"66","deno":"1.0","edge":"74","electron":"3.0","firefox":"61","ios":"12.2","node":"10.0","opera":"53","opera_mobile":"47","safari":"12.1","samsung":"9.0"},"es.string.trim-start":{"android":"66","chrome":"66","deno":"1.0","edge":"74","electron":"3.0","firefox":"61","ios":"12.0","node":"10.0","opera":"53","opera_mobile":"47","safari":"12.0","samsung":"9.0"},"es.string.anchor":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.big":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.blink":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.bold":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.fixed":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.fontcolor":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.fontsize":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.italics":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.link":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.small":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.strike":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.sub":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.sup":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.typed-array.float32-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.float64-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int8-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int16-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int32-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint8-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint8-clamped-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint16-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint32-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.copy-within":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"34","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.every":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.fill":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.filter":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.find":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.find-index":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.for-each":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.from":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.includes":{"android":"49","chrome":"49","deno":"1.0","edge":"14","electron":"0.37","firefox":"43","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.typed-array.index-of":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.iterator":{"android":"47","chrome":"47","deno":"1.0","edge":"13","electron":"0.36","firefox":"37","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.typed-array.join":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.last-index-of":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.map":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.of":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.reduce":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.reduce-right":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.reverse":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.set":{"android":"4.4","chrome":"26","deno":"1.0","edge":"13","electron":"0.20","firefox":"15","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.typed-array.slice":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.some":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.sort":{"android":"74","chrome":"74","deno":"1.0","edge":"74","electron":"6.0","firefox":"67","ios":"14.5","node":"12.0","opera":"61","opera_mobile":"53","safari":"14.1","samsung":"11.0"},"es.typed-array.subarray":{"android":"4.4","chrome":"26","deno":"1.0","edge":"13","electron":"0.20","firefox":"15","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.typed-array.to-locale-string":{"android":"45","chrome":"45","deno":"1.0","edge":"74","electron":"0.31","firefox":"51","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.to-string":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"51","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.unescape":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"3","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.weak-map":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.weak-set":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"esnext.aggregate-error":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"esnext.array.at":{"android":"92","chrome":"92","deno":"1.12","edge":"92","electron":"14.0","firefox":"90","node":"16.6","opera":"78"},"esnext.array.filter-out":{},"esnext.array.filter-reject":{},"esnext.array.find-last":{},"esnext.array.find-last-index":{},"esnext.array.group-by":{},"esnext.array.is-template-object":{},"esnext.array.last-index":{},"esnext.array.last-item":{},"esnext.array.unique-by":{},"esnext.async-iterator.constructor":{},"esnext.async-iterator.as-indexed-pairs":{},"esnext.async-iterator.drop":{},"esnext.async-iterator.every":{},"esnext.async-iterator.filter":{},"esnext.async-iterator.find":{},"esnext.async-iterator.flat-map":{},"esnext.async-iterator.for-each":{},"esnext.async-iterator.from":{},"esnext.async-iterator.map":{},"esnext.async-iterator.reduce":{},"esnext.async-iterator.some":{},"esnext.async-iterator.take":{},"esnext.async-iterator.to-array":{},"esnext.bigint.range":{},"esnext.composite-key":{},"esnext.composite-symbol":{},"esnext.global-this":{"android":"71","chrome":"71","deno":"1.0","edge":"74","electron":"5.0","firefox":"65","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"esnext.iterator.constructor":{},"esnext.iterator.as-indexed-pairs":{},"esnext.iterator.drop":{},"esnext.iterator.every":{},"esnext.iterator.filter":{},"esnext.iterator.find":{},"esnext.iterator.flat-map":{},"esnext.iterator.for-each":{},"esnext.iterator.from":{},"esnext.iterator.map":{},"esnext.iterator.reduce":{},"esnext.iterator.some":{},"esnext.iterator.take":{},"esnext.iterator.to-array":{},"esnext.map.delete-all":{},"esnext.map.emplace":{},"esnext.map.every":{},"esnext.map.filter":{},"esnext.map.find":{},"esnext.map.find-key":{},"esnext.map.from":{},"esnext.map.group-by":{},"esnext.map.includes":{},"esnext.map.key-by":{},"esnext.map.key-of":{},"esnext.map.map-keys":{},"esnext.map.map-values":{},"esnext.map.merge":{},"esnext.map.of":{},"esnext.map.reduce":{},"esnext.map.some":{},"esnext.map.update":{},"esnext.map.update-or-insert":{},"esnext.map.upsert":{},"esnext.math.clamp":{},"esnext.math.deg-per-rad":{},"esnext.math.degrees":{},"esnext.math.fscale":{},"esnext.math.iaddh":{},"esnext.math.imulh":{},"esnext.math.isubh":{},"esnext.math.rad-per-deg":{},"esnext.math.radians":{},"esnext.math.scale":{},"esnext.math.seeded-prng":{},"esnext.math.signbit":{},"esnext.math.umulh":{},"esnext.number.from-string":{},"esnext.number.range":{},"esnext.object.has-own":{"android":"93","chrome":"93","deno":"1.13","edge":"93","electron":"14.0","firefox":"92","opera":"79"},"esnext.object.iterate-entries":{},"esnext.object.iterate-keys":{},"esnext.object.iterate-values":{},"esnext.observable":{},"esnext.promise.all-settled":{"android":"76","chrome":"76","deno":"1.0","edge":"76","electron":"6.0","firefox":"71","ios":"13.0","node":"12.9","opera":"63","opera_mobile":"54","safari":"13","samsung":"12.0"},"esnext.promise.any":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"esnext.promise.try":{},"esnext.reflect.define-metadata":{},"esnext.reflect.delete-metadata":{},"esnext.reflect.get-metadata":{},"esnext.reflect.get-metadata-keys":{},"esnext.reflect.get-own-metadata":{},"esnext.reflect.get-own-metadata-keys":{},"esnext.reflect.has-metadata":{},"esnext.reflect.has-own-metadata":{},"esnext.reflect.metadata":{},"esnext.set.add-all":{},"esnext.set.delete-all":{},"esnext.set.difference":{},"esnext.set.every":{},"esnext.set.filter":{},"esnext.set.find":{},"esnext.set.from":{},"esnext.set.intersection":{},"esnext.set.is-disjoint-from":{},"esnext.set.is-subset-of":{},"esnext.set.is-superset-of":{},"esnext.set.join":{},"esnext.set.map":{},"esnext.set.of":{},"esnext.set.reduce":{},"esnext.set.some":{},"esnext.set.symmetric-difference":{},"esnext.set.union":{},"esnext.string.at":{},"esnext.string.code-points":{},"esnext.string.match-all":{"android":"80","chrome":"80","deno":"1.0","edge":"80","electron":"8.0","firefox":"73","ios":"13.4","node":"14.0","opera":"67","opera_mobile":"57","safari":"13.1","samsung":"13.0"},"esnext.string.replace-all":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"77","ios":"13.4","node":"15.0","opera":"71","opera_mobile":"60","safari":"13.1","samsung":"14.0"},"esnext.symbol.async-dispose":{},"esnext.symbol.dispose":{},"esnext.symbol.matcher":{},"esnext.symbol.metadata":{},"esnext.symbol.observable":{},"esnext.symbol.pattern-match":{},"esnext.symbol.replace-all":{},"esnext.typed-array.at":{"android":"92","chrome":"92","deno":"1.12","edge":"92","electron":"14.0","firefox":"90","node":"16.6","opera":"78"},"esnext.typed-array.filter-out":{},"esnext.typed-array.filter-reject":{},"esnext.typed-array.find-last":{},"esnext.typed-array.find-last-index":{},"esnext.typed-array.group-by":{},"esnext.typed-array.unique-by":{},"esnext.weak-map.delete-all":{},"esnext.weak-map.from":{},"esnext.weak-map.of":{},"esnext.weak-map.emplace":{},"esnext.weak-map.upsert":{},"esnext.weak-set.add-all":{},"esnext.weak-set.delete-all":{},"esnext.weak-set.from":{},"esnext.weak-set.of":{},"web.dom-collections.for-each":{"android":"58","chrome":"58","deno":"1.0","edge":"16","electron":"1.7","firefox":"50","ios":"10.0","node":"0.0.1","opera":"45","opera_mobile":"43","rhino":"1.7.13","safari":"10.0","samsung":"7.0"},"web.dom-collections.iterator":{"android":"66","chrome":"66","deno":"1.0","edge":"74","electron":"3.0","firefox":"60","ios":"13.4","node":"0.0.1","opera":"53","opera_mobile":"47","rhino":"1.7.13","safari":"13.1","samsung":"9.0"},"web.immediate":{"ie":"10","node":"0.9.1"},"web.queue-microtask":{"android":"71","chrome":"71","deno":"1.0","edge":"74","electron":"5.0","firefox":"69","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"web.timers":{"android":"1.5","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"10","ios":"1.0","node":"0.0.1","opera":"7","opera_mobile":"7","phantom":"1.9","rhino":"1.7.13","safari":"1.0","samsung":"1.0"},"web.url":{"android":"67","chrome":"67","deno":"1.0","edge":"74","electron":"4.0","firefox":"57","ios":"14.0","node":"10.0","opera":"54","opera_mobile":"48","safari":"14.0","samsung":"9.0"},"web.url.to-json":{"android":"71","chrome":"71","deno":"1.0","edge":"74","electron":"5.0","firefox":"57","ios":"14.0","node":"10.0","opera":"58","opera_mobile":"50","safari":"14.0","samsung":"10.0"},"web.url-search-params":{"android":"67","chrome":"67","deno":"1.0","edge":"74","electron":"4.0","firefox":"57","ios":"14.0","node":"10.0","opera":"54","opera_mobile":"48","safari":"14.0","samsung":"9.0"}}')},4503:e=>{"use strict";e.exports=JSON.parse('{"assert":true,"assert/strict":">= 15","async_hooks":">= 8","buffer_ieee754":"< 0.9.7","buffer":true,"child_process":true,"cluster":true,"console":true,"constants":true,"crypto":true,"_debug_agent":">= 1 && < 8","_debugger":"< 8","dgram":true,"diagnostics_channel":">= 15.1","dns":true,"dns/promises":">= 15","domain":">= 0.7.12","events":true,"freelist":"< 6","fs":true,"fs/promises":[">= 10 && < 10.1",">= 14"],"_http_agent":">= 0.11.1","_http_client":">= 0.11.1","_http_common":">= 0.11.1","_http_incoming":">= 0.11.1","_http_outgoing":">= 0.11.1","_http_server":">= 0.11.1","http":true,"http2":">= 8.8","https":true,"inspector":">= 8.0.0","_linklist":"< 8","module":true,"net":true,"node-inspect/lib/_inspect":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6.0 && < 12","os":true,"path":true,"path/posix":">= 15.3","path/win32":">= 15.3","perf_hooks":">= 8.5","process":">= 1","punycode":true,"querystring":true,"readline":true,"repl":true,"smalloc":">= 0.11.5 && < 3","_stream_duplex":">= 0.9.4","_stream_transform":">= 0.9.4","_stream_wrap":">= 1.4.1","_stream_passthrough":">= 0.9.4","_stream_readable":">= 0.9.4","_stream_writable":">= 0.9.4","stream":true,"stream/promises":">= 15","string_decoder":true,"sys":[">= 0.6 && < 0.7",">= 0.8"],"timers":true,"timers/promises":">= 15","_tls_common":">= 0.11.13","_tls_legacy":">= 0.11.3 && < 10","_tls_wrap":">= 0.11.3","tls":true,"trace_events":">= 10","tty":true,"url":true,"util":true,"util/types":">= 15.3","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/consarray":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/csvparser":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/logreader":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/profile_view":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/splaytree":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8":">= 1","vm":true,"wasi":">= 13.4 && < 13.5","worker_threads":">= 11.7","zlib":true}')}};var t={};function __nccwpck_require__(r){var s=t[r];if(s!==undefined){return s.exports}var a=t[r]={id:r,loaded:false,exports:{}};var n=true;try{e[r].call(a.exports,a,a.exports,__nccwpck_require__);n=false}finally{if(n)delete t[r]}a.loaded=true;return a.exports}(()=>{__nccwpck_require__.nmd=e=>{e.paths=[];if(!e.children)e.children=[];return e}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(3812);module.exports=r})(); \ No newline at end of file + `):a.importDeclaration([a.importSpecifier(i,s)],t),name:i.name}}))},injectDefaultImport(t,s=t){return e.storeNamed(r,t,"default",((e,t)=>{const o=r.scope.generateUidIdentifier(s);return{node:e?hoist(n.statement.ast`var ${o} = require(${t})`):a.importDeclaration([a.importDefaultSpecifier(o)],t),name:o.name}}))}}}}},1783:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=r(3508);var _default=e=>({ImportDeclaration(t){const r=(0,s.getImportSource)(t);if(!r)return;e({kind:"import",source:r},t)},Program(t){t.get("body").forEach((t=>{const r=(0,s.getRequireSource)(t);if(!r)return;e({kind:"import",source:r},t)}))}});t["default"]=_default},7107:(e,t,r)=>{"use strict";t.__esModule=true;t.entry=t.usage=void 0;var s=_interopRequireDefault(r(8985));t.usage=s.default;var a=_interopRequireDefault(r(1783));t.entry=a.default;function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}},8985:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=r(3508);var _default=e=>{function property(t,r,s,a){return e({kind:"property",object:t,key:r,placement:s},a)}return{ReferencedIdentifier(t){const{node:{name:r},scope:s}=t;if(s.getBindingIdentifier(r))return;e({kind:"global",name:r},t)},MemberExpression(e){const t=(0,s.resolveKey)(e.get("property"),e.node.computed);if(!t||t==="prototype")return;const r=e.get("object");const a=r.scope.getBinding(r.node.name);if(a&&a.path.isImportNamespaceSpecifier())return;const n=(0,s.resolveSource)(r);return property(n.id,t,n.placement,e)},ObjectPattern(e){const{parentPath:t,parent:r}=e;let a;if(t.isVariableDeclarator()){a=t.get("init")}else if(t.isAssignmentExpression()){a=t.get("right")}else if(t.isFunction()){const s=t.parentPath;if(s.isCallExpression()||s.isNewExpression()){if(s.node.callee===r){a=s.get("arguments")[e.key]}}}let n=null;let o=null;if(a)({id:n,placement:o}=(0,s.resolveSource)(a));for(const t of e.get("properties")){if(t.isObjectProperty()){const e=(0,s.resolveKey)(t.get("key"));if(e)property(n,e,o,t)}}},BinaryExpression(t){if(t.node.operator!=="in")return;const r=(0,s.resolveSource)(t.get("right"));const a=(0,s.resolveKey)(t.get("left"),true);if(!a)return;e({kind:"in",object:r.id,key:a,placement:r.placement},t)}}};t["default"]=_default},8828:(e,t,r)=>{e.exports=r(935)},3039:(e,t,r)=>{e.exports=r(4323)},1532:(e,t,r)=>{e.exports=r(8374)},9396:(e,t,r)=>{"use strict";t.__esModule=true;t.CommonInstanceDependencies=t.InstanceProperties=t.StaticProperties=t.BuiltIns=t.PromiseDependenciesWithIterators=t.PromiseDependencies=t.CommonIterators=void 0;var s=_interopRequireDefault(r(8828));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const a={};Object.keys(s.default).forEach(((e,t)=>{a[e]=t}));const define=(e,t,r=t[0],s)=>({name:r,pure:e,global:t.sort(((e,t)=>a[e]-a[t])),exclude:s});const typed=e=>define(null,[e,...c]);const n=["es.array.iterator","web.dom-collections.iterator"];const o=["es.string.iterator",...n];t.CommonIterators=o;const i=["es.object.to-string",...n];const l=["es.object.to-string",...o];const c=["es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.object.to-string","es.array.iterator","es.array-buffer.slice"];const u={from:define(null,["es.typed-array.from"]),of:define(null,["es.typed-array.of"])};const p=["es.promise","es.object.to-string"];t.PromiseDependencies=p;const f=[...p,...o];t.PromiseDependenciesWithIterators=f;const d=["es.symbol","es.symbol.description","es.object.to-string"];const m=["es.map","esnext.map.delete-all","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.includes","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.reduce","esnext.map.some","esnext.map.update",...l];const y=["es.set","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union",...l];const g=["es.weak-map","esnext.weak-map.delete-all",...l];const h=["es.weak-set","esnext.weak-set.add-all","esnext.weak-set.delete-all",...l];const b=["web.url",...l];const x={AggregateError:define("aggregate-error",["esnext.aggregate-error",...o]),ArrayBuffer:define(null,["es.array-buffer.constructor","es.array-buffer.slice","es.object.to-string"]),DataView:define(null,["es.data-view","es.array-buffer.slice","es.object.to-string"]),Date:define(null,["es.date.to-string"]),Float32Array:typed("es.typed-array.float32-array"),Float64Array:typed("es.typed-array.float64-array"),Int8Array:typed("es.typed-array.int8-array"),Int16Array:typed("es.typed-array.int16-array"),Int32Array:typed("es.typed-array.int32-array"),Uint8Array:typed("es.typed-array.uint8-array"),Uint8ClampedArray:typed("es.typed-array.uint8-clamped-array"),Uint16Array:typed("es.typed-array.uint16-array"),Uint32Array:typed("es.typed-array.uint32-array"),Map:define("map/index",m),Number:define(null,["es.number.constructor"]),Observable:define("observable/index",["esnext.observable","esnext.symbol.observable","es.object.to-string",...l]),Promise:define("promise/index",p),RegExp:define(null,["es.regexp.constructor","es.regexp.exec","es.regexp.to-string"]),Set:define("set/index",y),Symbol:define("symbol/index",d),URL:define("url/index",["web.url",...b]),URLSearchParams:define("url-search-params/index",b),WeakMap:define("weak-map/index",g),WeakSet:define("weak-set/index",h),clearImmediate:define("clear-immediate",["web.immediate"]),compositeKey:define("composite-key",["esnext.composite-key"]),compositeSymbol:define("composite-symbol",["esnext.composite-symbol"]),fetch:define(null,p),globalThis:define("global-this",["es.global-this"]),parseFloat:define("parse-float",["es.parse-float"]),parseInt:define("parse-int",["es.parse-int"]),queueMicrotask:define("queue-microtask",["web.queue-microtask"]),setImmediate:define("set-immediate",["web.immediate"]),setInterval:define("set-interval",["web.timers"]),setTimeout:define("set-timeout",["web.timers"])};t.BuiltIns=x;const v={Array:{from:define("array/from",["es.array.from","es.string.iterator"]),isArray:define("array/is-array",["es.array.is-array"]),of:define("array/of",["es.array.of"])},ArrayBuffer:{isView:define(null,["es.array-buffer.is-view"])},Date:{now:define("date/now",["es.date.now"])},JSON:{stringify:define("json/stringify",[],"es.symbol")},Math:{DEG_PER_RAD:define("math/deg-per-rad",["esnext.math.deg-per-rad"]),RAD_PER_DEG:define("math/rad-per-deg",["esnext.math.rad-per-deg"]),acosh:define("math/acosh",["es.math.acosh"]),asinh:define("math/asinh",["es.math.asinh"]),atanh:define("math/atanh",["es.math.atanh"]),cbrt:define("math/cbrt",["es.math.cbrt"]),clamp:define("math/clamp",["esnext.math.clamp"]),clz32:define("math/clz32",["es.math.clz32"]),cosh:define("math/cosh",["es.math.cosh"]),degrees:define("math/degrees",["esnext.math.degrees"]),expm1:define("math/expm1",["es.math.expm1"]),fround:define("math/fround",["es.math.fround"]),fscale:define("math/fscale",["esnext.math.fscale"]),hypot:define("math/hypot",["es.math.hypot"]),iaddh:define("math/iaddh",["esnext.math.iaddh"]),imul:define("math/imul",["es.math.imul"]),imulh:define("math/imulh",["esnext.math.imulh"]),isubh:define("math/isubh",["esnext.math.isubh"]),log10:define("math/log10",["es.math.log10"]),log1p:define("math/log1p",["es.math.log1p"]),log2:define("math/log2",["es.math.log2"]),radians:define("math/radians",["esnext.math.radians"]),scale:define("math/scale",["esnext.math.scale"]),seededPRNG:define("math/seeded-prng",["esnext.math.seeded-prng"]),sign:define("math/sign",["es.math.sign"]),signbit:define("math/signbit",["esnext.math.signbit"]),sinh:define("math/sinh",["es.math.sinh"]),tanh:define("math/tanh",["es.math.tanh"]),trunc:define("math/trunc",["es.math.trunc"]),umulh:define("math/umulh",["esnext.math.umulh"])},Map:{from:define(null,["esnext.map.from",...m]),groupBy:define(null,["esnext.map.group-by",...m]),keyBy:define(null,["esnext.map.key-by",...m]),of:define(null,["esnext.map.of",...m])},Number:{EPSILON:define("number/epsilon",["es.number.epsilon"]),MAX_SAFE_INTEGER:define("number/max-safe-integer",["es.number.max-safe-integer"]),MIN_SAFE_INTEGER:define("number/min-safe-integer",["es.number.min-safe-integer"]),fromString:define("number/from-string",["esnext.number.from-string"]),isFinite:define("number/is-finite",["es.number.is-finite"]),isInteger:define("number/is-integer",["es.number.is-integer"]),isNaN:define("number/is-nan",["es.number.is-nan"]),isSafeInteger:define("number/is-safe-integer",["es.number.is-safe-integer"]),parseFloat:define("number/parse-float",["es.number.parse-float"]),parseInt:define("number/parse-int",["es.number.parse-int"])},Object:{assign:define("object/assign",["es.object.assign"]),create:define("object/create",["es.object.create"]),defineProperties:define("object/define-properties",["es.object.define-properties"]),defineProperty:define("object/define-property",["es.object.define-property"]),entries:define("object/entries",["es.object.entries"]),freeze:define("object/freeze",["es.object.freeze"]),fromEntries:define("object/from-entries",["es.object.from-entries","es.array.iterator"]),getOwnPropertyDescriptor:define("object/get-own-property-descriptor",["es.object.get-own-property-descriptor"]),getOwnPropertyDescriptors:define("object/get-own-property-descriptors",["es.object.get-own-property-descriptors"]),getOwnPropertyNames:define("object/get-own-property-names",["es.object.get-own-property-names"]),getOwnPropertySymbols:define("object/get-own-property-symbols",["es.symbol"]),getPrototypeOf:define("object/get-prototype-of",["es.object.get-prototype-of"]),hasOwn:define("object/has-own",["esnext.object.has-own"]),is:define("object/is",["es.object.is"]),isExtensible:define("object/is-extensible",["es.object.is-extensible"]),isFrozen:define("object/is-frozen",["es.object.is-frozen"]),isSealed:define("object/is-sealed",["es.object.is-sealed"]),keys:define("object/keys",["es.object.keys"]),preventExtensions:define("object/prevent-extensions",["es.object.prevent-extensions"]),seal:define("object/seal",["es.object.seal"]),setPrototypeOf:define("object/set-prototype-of",["es.object.set-prototype-of"]),values:define("object/values",["es.object.values"])},Promise:{all:define(null,f),allSettled:define(null,["es.promise.all-settled",...f]),any:define(null,["esnext.promise.any",...f]),race:define(null,f),try:define(null,["esnext.promise.try",...f])},Reflect:{apply:define("reflect/apply",["es.reflect.apply"]),construct:define("reflect/construct",["es.reflect.construct"]),defineMetadata:define("reflect/define-metadata",["esnext.reflect.define-metadata"]),defineProperty:define("reflect/define-property",["es.reflect.define-property"]),deleteMetadata:define("reflect/delete-metadata",["esnext.reflect.delete-metadata"]),deleteProperty:define("reflect/delete-property",["es.reflect.delete-property"]),get:define("reflect/get",["es.reflect.get"]),getMetadata:define("reflect/get-metadata",["esnext.reflect.get-metadata"]),getMetadataKeys:define("reflect/get-metadata-keys",["esnext.reflect.get-metadata-keys"]),getOwnMetadata:define("reflect/get-own-metadata",["esnext.reflect.get-own-metadata"]),getOwnMetadataKeys:define("reflect/get-own-metadata-keys",["esnext.reflect.get-own-metadata-keys"]),getOwnPropertyDescriptor:define("reflect/get-own-property-descriptor",["es.reflect.get-own-property-descriptor"]),getPrototypeOf:define("reflect/get-prototype-of",["es.reflect.get-prototype-of"]),has:define("reflect/has",["es.reflect.has"]),hasMetadata:define("reflect/has-metadata",["esnext.reflect.has-metadata"]),hasOwnMetadata:define("reflect/has-own-metadata",["esnext.reflect.has-own-metadata"]),isExtensible:define("reflect/is-extensible",["es.reflect.is-extensible"]),metadata:define("reflect/metadata",["esnext.reflect.metadata"]),ownKeys:define("reflect/own-keys",["es.reflect.own-keys"]),preventExtensions:define("reflect/prevent-extensions",["es.reflect.prevent-extensions"]),set:define("reflect/set",["es.reflect.set"]),setPrototypeOf:define("reflect/set-prototype-of",["es.reflect.set-prototype-of"])},Set:{from:define(null,["esnext.set.from",...y]),of:define(null,["esnext.set.of",...y])},String:{fromCodePoint:define("string/from-code-point",["es.string.from-code-point"]),raw:define("string/raw",["es.string.raw"])},Symbol:{asyncIterator:define("symbol/async-iterator",["es.symbol.async-iterator"]),dispose:define("symbol/dispose",["esnext.symbol.dispose"]),for:define("symbol/for",[],"es.symbol"),hasInstance:define("symbol/has-instance",["es.symbol.has-instance","es.function.has-instance"]),isConcatSpreadable:define("symbol/is-concat-spreadable",["es.symbol.is-concat-spreadable","es.array.concat"]),iterator:define("symbol/iterator",["es.symbol.iterator",...l]),keyFor:define("symbol/key-for",[],"es.symbol"),match:define("symbol/match",["es.symbol.match","es.string.match"]),observable:define("symbol/observable",["esnext.symbol.observable"]),patternMatch:define("symbol/pattern-match",["esnext.symbol.pattern-match"]),replace:define("symbol/replace",["es.symbol.replace","es.string.replace"]),search:define("symbol/search",["es.symbol.search","es.string.search"]),species:define("symbol/species",["es.symbol.species","es.array.species"]),split:define("symbol/split",["es.symbol.split","es.string.split"]),toPrimitive:define("symbol/to-primitive",["es.symbol.to-primitive","es.date.to-primitive"]),toStringTag:define("symbol/to-string-tag",["es.symbol.to-string-tag","es.object.to-string","es.math.to-string-tag","es.json.to-string-tag"]),unscopables:define("symbol/unscopables",["es.symbol.unscopables"])},WeakMap:{from:define(null,["esnext.weak-map.from",...g]),of:define(null,["esnext.weak-map.of",...g])},WeakSet:{from:define(null,["esnext.weak-set.from",...h]),of:define(null,["esnext.weak-set.of",...h])},Int8Array:u,Uint8Array:u,Uint8ClampedArray:u,Int16Array:u,Uint16Array:u,Int32Array:u,Uint32Array:u,Float32Array:u,Float64Array:u};t.StaticProperties=v;const E={at:define("instance/at",["esnext.string.at"]),anchor:define(null,["es.string.anchor"]),big:define(null,["es.string.big"]),bind:define("instance/bind",["es.function.bind"]),blink:define(null,["es.string.blink"]),bold:define(null,["es.string.bold"]),codePointAt:define("instance/code-point-at",["es.string.code-point-at"]),codePoints:define("instance/code-points",["esnext.string.code-points"]),concat:define("instance/concat",["es.array.concat"],undefined,["String"]),copyWithin:define("instance/copy-within",["es.array.copy-within"]),description:define(null,["es.symbol","es.symbol.description"]),endsWith:define("instance/ends-with",["es.string.ends-with"]),entries:define("instance/entries",i),every:define("instance/every",["es.array.every"]),exec:define(null,["es.regexp.exec"]),fill:define("instance/fill",["es.array.fill"]),filter:define("instance/filter",["es.array.filter"]),finally:define(null,["es.promise.finally",...p]),find:define("instance/find",["es.array.find"]),findIndex:define("instance/find-index",["es.array.find-index"]),fixed:define(null,["es.string.fixed"]),flags:define("instance/flags",["es.regexp.flags"]),flatMap:define("instance/flat-map",["es.array.flat-map","es.array.unscopables.flat-map"]),flat:define("instance/flat",["es.array.flat"]),fontcolor:define(null,["es.string.fontcolor"]),fontsize:define(null,["es.string.fontsize"]),forEach:define("instance/for-each",["es.array.for-each","web.dom-collections.for-each"]),includes:define("instance/includes",["es.array.includes","es.string.includes"]),indexOf:define("instance/index-of",["es.array.index-of"]),italic:define(null,["es.string.italics"]),join:define(null,["es.array.join"]),keys:define("instance/keys",i),lastIndex:define(null,["esnext.array.last-index"]),lastIndexOf:define("instance/last-index-of",["es.array.last-index-of"]),lastItem:define(null,["esnext.array.last-item"]),link:define(null,["es.string.link"]),map:define("instance/map",["es.array.map"]),match:define(null,["es.string.match","es.regexp.exec"]),matchAll:define("instance/match-all",["es.string.match-all"]),name:define(null,["es.function.name"]),padEnd:define("instance/pad-end",["es.string.pad-end"]),padStart:define("instance/pad-start",["es.string.pad-start"]),reduce:define("instance/reduce",["es.array.reduce"]),reduceRight:define("instance/reduce-right",["es.array.reduce-right"]),repeat:define("instance/repeat",["es.string.repeat"]),replace:define(null,["es.string.replace","es.regexp.exec"]),replaceAll:define("instance/replace-all",["esnext.string.replace-all"]),reverse:define("instance/reverse",["es.array.reverse"]),search:define(null,["es.string.search","es.regexp.exec"]),slice:define("instance/slice",["es.array.slice"]),small:define(null,["es.string.small"]),some:define("instance/some",["es.array.some"]),sort:define("instance/sort",["es.array.sort"]),splice:define("instance/splice",["es.array.splice"]),split:define(null,["es.string.split","es.regexp.exec"]),startsWith:define("instance/starts-with",["es.string.starts-with"]),strike:define(null,["es.string.strike"]),sub:define(null,["es.string.sub"]),sup:define(null,["es.string.sup"]),toFixed:define(null,["es.number.to-fixed"]),toISOString:define(null,["es.date.to-iso-string"]),toJSON:define(null,["es.date.to-json","web.url.to-json"]),toPrecision:define(null,["es.number.to-precision"]),toString:define(null,["es.object.to-string","es.regexp.to-string","es.date.to-string"]),trim:define("instance/trim",["es.string.trim"]),trimEnd:define("instance/trim-end",["es.string.trim-end"]),trimLeft:define("instance/trim-left",["es.string.trim-start"]),trimRight:define("instance/trim-right",["es.string.trim-end"]),trimStart:define("instance/trim-start",["es.string.trim-start"]),values:define("instance/values",i),__defineGetter__:define(null,["es.object.define-getter"]),__defineSetter__:define(null,["es.object.define-setter"]),__lookupGetter__:define(null,["es.object.lookup-getter"]),__lookupSetter__:define(null,["es.object.lookup-setter"])};t.InstanceProperties=E;const j=new Set(["es.object.to-string","es.object.define-getter","es.object.define-setter","es.object.lookup-getter","es.object.lookup-setter","es.regexp.exec"]);t.CommonInstanceDependencies=j},5825:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireDefault(r(8828));var a=_interopRequireDefault(r(6265));var n=_interopRequireDefault(r(1532));var o=r(9396);var i=_interopRequireWildcard(r(8304));var l=r(8520);var c=_interopRequireDefault(r(8038));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _extends(){_extends=Object.assign||function(e){for(var t=1;t{if(t(e))return true;if(!e.startsWith("es."))return false;const r=`esnext.${e.slice(3)}`;if(!s.default[r])return false;return t(r)};var f=(0,c.default)((function({getUtils:e,method:t,shouldInjectPolyfill:r,createMetaResolver:i,debug:c,babel:f},{version:d=3,proposals:m,shippedProposals:y,[p]:{useBabelRuntime:g,ext:h=".js"}={}}){const b=f.caller((e=>(e==null?void 0:e.name)==="babel-loader"));const x=i({global:o.BuiltIns,static:o.StaticProperties,instance:o.InstanceProperties});const v=new Set((0,n.default)(d));const E=g?m?`${g}/core-js`:`${g}/core-js-stable`:m?"core-js-pure/features":"core-js-pure/stable";function maybeInjectGlobalImpl(e,t){if(r(e)){c(e);t.injectGlobalImport((0,l.coreJSModule)(e));return true}return false}function maybeInjectGlobal(e,t,r=true){for(const s of e){if(r){esnextFallback(s,(e=>maybeInjectGlobalImpl(e,t)))}else{maybeInjectGlobalImpl(s,t)}}}function maybeInjectPure(e,t,s,a){if(e.pure&&!(a&&e.exclude&&e.exclude.includes(a))&&esnextFallback(e.name,r)){return s.injectDefaultImport(`${E}/${e.pure}${h}`,t)}}return{name:"corejs3",polyfills:s.default,filterPolyfills(e){if(!v.has(e))return false;if(m||t==="entry-global")return true;if(y&&a.default.has(e)){return true}return!e.startsWith("esnext.")},entryGlobal(e,t,s){if(e.kind!=="import")return;const a=(0,l.isCoreJSSource)(e.source);if(!a)return;if(a.length===1&&e.source===(0,l.coreJSModule)(a[0])&&r(a[0])){c(null);return}maybeInjectGlobal(a,t,false);s.remove()},usageGlobal(e,t){const r=x(e);if(!r)return;let s=r.desc.global;if(r.kind!=="global"&&e.object&&e.placement==="prototype"){const t=e.object.toLowerCase();s=s.filter((e=>e.includes(t)||o.CommonInstanceDependencies.has(e)))}maybeInjectGlobal(s,t)},usagePure(e,t,s){if(e.kind==="in"){if(e.key==="Symbol.iterator"){s.replaceWith(u.callExpression(t.injectDefaultImport((0,l.coreJSPureHelper)("is-iterable",g,h),"isIterable"),[s.node.right]))}return}if(s.parentPath.isUnaryExpression({operator:"delete"}))return;let a;if(e.kind==="property"){if(!s.isMemberExpression())return;if(!s.isReferenced())return;a=s.parentPath.isCallExpression({callee:s.node});if(e.key==="Symbol.iterator"){if(!r("es.symbol.iterator"))return;if(a){if(s.parent.arguments.length===0){s.parentPath.replaceWith(u.callExpression(t.injectDefaultImport((0,l.coreJSPureHelper)("get-iterator",g,h),"getIterator"),[s.node.object]));s.skip()}else{(0,l.callMethod)(s,t.injectDefaultImport((0,l.coreJSPureHelper)("get-iterator-method",g,h),"getIteratorMethod"))}}else{s.replaceWith(u.callExpression(t.injectDefaultImport((0,l.coreJSPureHelper)("get-iterator-method",g,h),"getIteratorMethod"),[s.node.object]))}return}}let n=x(e);if(!n)return;if(g&&n.desc.pure&&n.desc.pure.slice(-6)==="/index"){n=_extends({},n,{desc:_extends({},n.desc,{pure:n.desc.pure.slice(0,-6)})})}if(n.kind==="global"){const e=maybeInjectPure(n.desc,n.name,t);if(e)s.replaceWith(e)}else if(n.kind==="static"){const r=maybeInjectPure(n.desc,n.name,t,e.object);if(r)s.replaceWith(r)}else if(n.kind==="instance"){const r=maybeInjectPure(n.desc,`${n.name}InstanceProperty`,t,e.object);if(!r)return;if(a){(0,l.callMethod)(s,r)}else{s.replaceWith(u.callExpression(r,[s.node.object]))}}},visitor:t==="usage-global"&&{CallExpression(t){if(t.get("callee").isImport()){const r=e(t);if(b){maybeInjectGlobal(o.PromiseDependenciesWithIterators,r)}else{maybeInjectGlobal(o.PromiseDependencies,r)}}},Function(t){if(t.node.async){maybeInjectGlobal(o.PromiseDependencies,e(t))}},"ForOfStatement|ArrayPattern"(t){maybeInjectGlobal(o.CommonIterators,e(t))},SpreadElement(t){if(!t.parentPath.isObjectExpression()){maybeInjectGlobal(o.CommonIterators,e(t))}},YieldExpression(t){if(t.node.delegate){maybeInjectGlobal(o.CommonIterators,e(t))}}}}}));t["default"]=f},6265:(e,t)=>{"use strict";t.__esModule=true;t["default"]=void 0;var r=new Set(["esnext.global-this","esnext.string.match-all"]);t["default"]=r},8520:(e,t,r)=>{"use strict";t.__esModule=true;t.callMethod=callMethod;t.isCoreJSSource=isCoreJSSource;t.coreJSModule=coreJSModule;t.coreJSPureHelper=coreJSPureHelper;var s=_interopRequireWildcard(r(8304));var a=_interopRequireDefault(r(3039));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e){if(Object.prototype.hasOwnProperty.call(e,a)){var n=s?Object.getOwnPropertyDescriptor(e,a):null;if(n&&(n.get||n.set)){Object.defineProperty(r,a,n)}else{r[a]=e[a]}}}r.default=e;if(t){t.set(e,r)}return r}const{types:n}=s.default||s;function callMethod(e,t){const{object:r}=e.node;let s,a;if(n.isIdentifier(r)){s=r;a=n.cloneNode(r)}else{s=e.scope.generateDeclaredUidIdentifier("context");a=n.assignmentExpression("=",n.cloneNode(s),r)}e.replaceWith(n.memberExpression(n.callExpression(t,[a]),n.identifier("call")));e.parentPath.unshiftContainer("arguments",s)}function isCoreJSSource(e){if(typeof e==="string"){e=e.replace(/\\/g,"/").replace(/(\/(index)?)?(\.js)?$/i,"").toLowerCase()}return hasOwnProperty.call(a.default,e)&&a.default[e]}function coreJSModule(e){return`core-js/modules/${e}.js`}function coreJSPureHelper(e,t,r){return t?`${t}/core-js/${e}${r}`:`core-js-pure/features/${e}.js`}},8374:(e,t,r)=>{"use strict";const{compare:s,intersection:a,semver:n}=r(2732);const o=r(4970);const i=r(2885);e.exports=function(e){const t=n(e);if(t.major!==3){throw RangeError("This version of `core-js-compat` works only with `core-js@3`.")}const r=[];for(const e of Object.keys(o)){if(s(e,"<=",t)){r.push(...o[e])}}return a(r,i)}},2732:(e,t,r)=>{"use strict";const s=r(3464);const a=r(6784);const n=Function.call.bind({}.hasOwnProperty);function compare(e,t,r){return s(a(e),t,a(r))}function intersection(e,t){const r=e instanceof Set?e:new Set(e);return t.filter((e=>r.has(e)))}function sortObjectByKey(e,t){return Object.keys(e).sort(t).reduce(((t,r)=>{t[r]=e[r];return t}),{})}e.exports={compare:compare,has:n,intersection:intersection,semver:a,sortObjectByKey:sortObjectByKey}},5620:(e,t,r)=>{const s=r(6766);const{MAX_LENGTH:a,MAX_SAFE_INTEGER:n}=r(6648);const{re:o,t:i}=r(3567);const{compareIdentifiers:l}=r(6736);class SemVer{constructor(e,t){if(!t||typeof t!=="object"){t={loose:!!t,includePrerelease:false}}if(e instanceof SemVer){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease){return e}else{e=e.version}}else if(typeof e!=="string"){throw new TypeError(`Invalid Version: ${e}`)}if(e.length>a){throw new TypeError(`version is longer than ${a} characters`)}s("SemVer",e,t);this.options=t;this.loose=!!t.loose;this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?o[i.LOOSE]:o[i.FULL]);if(!r){throw new TypeError(`Invalid Version: ${e}`)}this.raw=e;this.major=+r[1];this.minor=+r[2];this.patch=+r[3];if(this.major>n||this.major<0){throw new TypeError("Invalid major version")}if(this.minor>n||this.minor<0){throw new TypeError("Invalid minor version")}if(this.patch>n||this.patch<0){throw new TypeError("Invalid patch version")}if(!r[4]){this.prerelease=[]}else{this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0){if(typeof this.prerelease[e]==="number"){this.prerelease[e]++;e=-2}}if(e===-1){this.prerelease.push(0)}}if(t){if(this.prerelease[0]===t){if(isNaN(this.prerelease[1])){this.prerelease=[t,0]}}else{this.prerelease=[t,0]}}break;default:throw new Error(`invalid increment argument: ${e}`)}this.format();this.raw=this.version;return this}}e.exports=SemVer},3464:(e,t,r)=>{const s=r(1673);const a=r(532);const n=r(3547);const o=r(5478);const i=r(5401);const l=r(2568);const cmp=(e,t,r,c)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return s(e,r,c);case"!=":return a(e,r,c);case">":return n(e,r,c);case">=":return o(e,r,c);case"<":return i(e,r,c);case"<=":return l(e,r,c);default:throw new TypeError(`Invalid operator: ${t}`)}};e.exports=cmp},6784:(e,t,r)=>{const s=r(5620);const a=r(5032);const{re:n,t:o}=r(3567);const coerce=(e,t)=>{if(e instanceof s){return e}if(typeof e==="number"){e=String(e)}if(typeof e!=="string"){return null}t=t||{};let r=null;if(!t.rtl){r=e.match(n[o.COERCE])}else{let t;while((t=n[o.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||t.index+t[0].length!==r.index+r[0].length){r=t}n[o.COERCERTL].lastIndex=t.index+t[1].length+t[2].length}n[o.COERCERTL].lastIndex=-1}if(r===null)return null;return a(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};e.exports=coerce},8796:(e,t,r)=>{const s=r(5620);const compare=(e,t,r)=>new s(e,r).compare(new s(t,r));e.exports=compare},1673:(e,t,r)=>{const s=r(8796);const eq=(e,t,r)=>s(e,t,r)===0;e.exports=eq},3547:(e,t,r)=>{const s=r(8796);const gt=(e,t,r)=>s(e,t,r)>0;e.exports=gt},5478:(e,t,r)=>{const s=r(8796);const gte=(e,t,r)=>s(e,t,r)>=0;e.exports=gte},5401:(e,t,r)=>{const s=r(8796);const lt=(e,t,r)=>s(e,t,r)<0;e.exports=lt},2568:(e,t,r)=>{const s=r(8796);const lte=(e,t,r)=>s(e,t,r)<=0;e.exports=lte},532:(e,t,r)=>{const s=r(8796);const neq=(e,t,r)=>s(e,t,r)!==0;e.exports=neq},5032:(e,t,r)=>{const{MAX_LENGTH:s}=r(6648);const{re:a,t:n}=r(3567);const o=r(5620);const parse=(e,t)=>{if(!t||typeof t!=="object"){t={loose:!!t,includePrerelease:false}}if(e instanceof o){return e}if(typeof e!=="string"){return null}if(e.length>s){return null}const r=t.loose?a[n.LOOSE]:a[n.FULL];if(!r.test(e)){return null}try{return new o(e,t)}catch(e){return null}};e.exports=parse},6648:e=>{const t="2.0.0";const r=256;const s=Number.MAX_SAFE_INTEGER||9007199254740991;const a=16;e.exports={SEMVER_SPEC_VERSION:t,MAX_LENGTH:r,MAX_SAFE_INTEGER:s,MAX_SAFE_COMPONENT_LENGTH:a}},6766:e=>{const t=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},6736:e=>{const t=/^[0-9]+$/;const compareIdentifiers=(e,r)=>{const s=t.test(e);const a=t.test(r);if(s&&a){e=+e;r=+r}return e===r?0:s&&!a?-1:a&&!s?1:ecompareIdentifiers(t,e);e.exports={compareIdentifiers:compareIdentifiers,rcompareIdentifiers:rcompareIdentifiers}},3567:(e,t,r)=>{const{MAX_SAFE_COMPONENT_LENGTH:s}=r(6648);const a=r(6766);t=e.exports={};const n=t.re=[];const o=t.src=[];const i=t.t={};let l=0;const createToken=(e,t,r)=>{const s=l++;a(s,t);i[e]=s;o[s]=t;n[s]=new RegExp(t,r?"g":undefined)};createToken("NUMERICIDENTIFIER","0|[1-9]\\d*");createToken("NUMERICIDENTIFIERLOOSE","[0-9]+");createToken("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*");createToken("MAINVERSION",`(${o[i.NUMERICIDENTIFIER]})\\.`+`(${o[i.NUMERICIDENTIFIER]})\\.`+`(${o[i.NUMERICIDENTIFIER]})`);createToken("MAINVERSIONLOOSE",`(${o[i.NUMERICIDENTIFIERLOOSE]})\\.`+`(${o[i.NUMERICIDENTIFIERLOOSE]})\\.`+`(${o[i.NUMERICIDENTIFIERLOOSE]})`);createToken("PRERELEASEIDENTIFIER",`(?:${o[i.NUMERICIDENTIFIER]}|${o[i.NONNUMERICIDENTIFIER]})`);createToken("PRERELEASEIDENTIFIERLOOSE",`(?:${o[i.NUMERICIDENTIFIERLOOSE]}|${o[i.NONNUMERICIDENTIFIER]})`);createToken("PRERELEASE",`(?:-(${o[i.PRERELEASEIDENTIFIER]}(?:\\.${o[i.PRERELEASEIDENTIFIER]})*))`);createToken("PRERELEASELOOSE",`(?:-?(${o[i.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[i.PRERELEASEIDENTIFIERLOOSE]})*))`);createToken("BUILDIDENTIFIER","[0-9A-Za-z-]+");createToken("BUILD",`(?:\\+(${o[i.BUILDIDENTIFIER]}(?:\\.${o[i.BUILDIDENTIFIER]})*))`);createToken("FULLPLAIN",`v?${o[i.MAINVERSION]}${o[i.PRERELEASE]}?${o[i.BUILD]}?`);createToken("FULL",`^${o[i.FULLPLAIN]}$`);createToken("LOOSEPLAIN",`[v=\\s]*${o[i.MAINVERSIONLOOSE]}${o[i.PRERELEASELOOSE]}?${o[i.BUILD]}?`);createToken("LOOSE",`^${o[i.LOOSEPLAIN]}$`);createToken("GTLT","((?:<|>)?=?)");createToken("XRANGEIDENTIFIERLOOSE",`${o[i.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);createToken("XRANGEIDENTIFIER",`${o[i.NUMERICIDENTIFIER]}|x|X|\\*`);createToken("XRANGEPLAIN",`[v=\\s]*(${o[i.XRANGEIDENTIFIER]})`+`(?:\\.(${o[i.XRANGEIDENTIFIER]})`+`(?:\\.(${o[i.XRANGEIDENTIFIER]})`+`(?:${o[i.PRERELEASE]})?${o[i.BUILD]}?`+`)?)?`);createToken("XRANGEPLAINLOOSE",`[v=\\s]*(${o[i.XRANGEIDENTIFIERLOOSE]})`+`(?:\\.(${o[i.XRANGEIDENTIFIERLOOSE]})`+`(?:\\.(${o[i.XRANGEIDENTIFIERLOOSE]})`+`(?:${o[i.PRERELEASELOOSE]})?${o[i.BUILD]}?`+`)?)?`);createToken("XRANGE",`^${o[i.GTLT]}\\s*${o[i.XRANGEPLAIN]}$`);createToken("XRANGELOOSE",`^${o[i.GTLT]}\\s*${o[i.XRANGEPLAINLOOSE]}$`);createToken("COERCE",`${"(^|[^\\d])"+"(\\d{1,"}${s}})`+`(?:\\.(\\d{1,${s}}))?`+`(?:\\.(\\d{1,${s}}))?`+`(?:$|[^\\d])`);createToken("COERCERTL",o[i.COERCE],true);createToken("LONETILDE","(?:~>?)");createToken("TILDETRIM",`(\\s*)${o[i.LONETILDE]}\\s+`,true);t.tildeTrimReplace="$1~";createToken("TILDE",`^${o[i.LONETILDE]}${o[i.XRANGEPLAIN]}$`);createToken("TILDELOOSE",`^${o[i.LONETILDE]}${o[i.XRANGEPLAINLOOSE]}$`);createToken("LONECARET","(?:\\^)");createToken("CARETTRIM",`(\\s*)${o[i.LONECARET]}\\s+`,true);t.caretTrimReplace="$1^";createToken("CARET",`^${o[i.LONECARET]}${o[i.XRANGEPLAIN]}$`);createToken("CARETLOOSE",`^${o[i.LONECARET]}${o[i.XRANGEPLAINLOOSE]}$`);createToken("COMPARATORLOOSE",`^${o[i.GTLT]}\\s*(${o[i.LOOSEPLAIN]})$|^$`);createToken("COMPARATOR",`^${o[i.GTLT]}\\s*(${o[i.FULLPLAIN]})$|^$`);createToken("COMPARATORTRIM",`(\\s*)${o[i.GTLT]}\\s*(${o[i.LOOSEPLAIN]}|${o[i.XRANGEPLAIN]})`,true);t.comparatorTrimReplace="$1$2$3";createToken("HYPHENRANGE",`^\\s*(${o[i.XRANGEPLAIN]})`+`\\s+-\\s+`+`(${o[i.XRANGEPLAIN]})`+`\\s*$`);createToken("HYPHENRANGELOOSE",`^\\s*(${o[i.XRANGEPLAINLOOSE]})`+`\\s+-\\s+`+`(${o[i.XRANGEPLAINLOOSE]})`+`\\s*$`);createToken("STAR","(<|>)?=?\\s*\\*")},7973:(e,t,r)=>{"use strict";t.__esModule=true;t["default"]=void 0;var s=_interopRequireDefault(r(8038));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const a="#__secret_key__@babel/runtime__compatibility";var n=(0,s.default)((({debug:e},t)=>{const{[a]:{useBabelRuntime:r}={}}=t;const s=r?`${r}/regenerator`:"regenerator-runtime";return{name:"regenerator",polyfills:["regenerator-runtime"],usageGlobal(t,r){if(isRegenerator(t)){e("regenerator-runtime");r.injectGlobalImport("regenerator-runtime/runtime.js")}},usagePure(e,t,r){if(isRegenerator(e)){r.replaceWith(t.injectDefaultImport(s,"regenerator-runtime"))}}}}));t["default"]=n;const isRegenerator=e=>e.kind==="global"&&e.name==="regeneratorRuntime"},9485:(e,t,r)=>{var s=r(3818);s.core=r(3011);s.isCore=r(7320);s.sync=r(7252);e.exports=s},3818:(e,t,r)=>{var s=r(7147);var a=r(1017);var n=r(4029);var o=r(1177);var i=r(607);var l=r(8746);var c=s.realpath&&typeof s.realpath.native==="function"?s.realpath.native:s.realpath;var u=function isFile(e,t){s.stat(e,(function(e,r){if(!e){return t(null,r.isFile()||r.isFIFO())}if(e.code==="ENOENT"||e.code==="ENOTDIR")return t(null,false);return t(e)}))};var p=function isDirectory(e,t){s.stat(e,(function(e,r){if(!e){return t(null,r.isDirectory())}if(e.code==="ENOENT"||e.code==="ENOTDIR")return t(null,false);return t(e)}))};var f=function realpath(e,t){c(e,(function(r,s){if(r&&r.code!=="ENOENT")t(r);else t(null,r?e:s)}))};var d=function maybeRealpath(e,t,r,s){if(r&&r.preserveSymlinks===false){e(t,s)}else{s(null,t)}};var m=function defaultReadPackage(e,t,r){e(t,(function(e,t){if(e)r(e);else{try{var s=JSON.parse(t);r(null,s)}catch(e){r(null)}}}))};var y=function getPackageCandidates(e,t,r){var s=o(t,r,e);for(var n=0;n{e.exports=function(){var e=Error.prepareStackTrace;Error.prepareStackTrace=function(e,t){return t};var t=(new Error).stack;Error.prepareStackTrace=e;return t[2].getFileName()}},3011:(e,t,r)=>{var s=process.versions&&process.versions.node&&process.versions.node.split(".")||[];function specifierIncluded(e){var t=e.split(" ");var r=t.length>1?t[0]:"=";var a=(t.length>1?t[1]:t[0]).split(".");for(var n=0;n<3;++n){var o=parseInt(s[n]||0,10);var i=parseInt(a[n]||0,10);if(o===i){continue}if(r==="<"){return o="){return o>=i}else{return false}}return r===">="}function matchesRange(e){var t=e.split(/ ?&& ?/);if(t.length===0){return false}for(var r=0;r{var s=r(8746);e.exports=function isCore(e){return s(e)}},1177:(e,t,r)=>{var s=r(1017);var a=s.parse||r(2742);var n=function getNodeModulesDirs(e,t){var r="/";if(/^([A-Za-z]:)/.test(e)){r=""}else if(/^\\\\/.test(e)){r="\\\\"}var n=[e];var o=a(e);while(o.dir!==n[n.length-1]){n.push(o.dir);o=a(o.dir)}return n.reduce((function(e,a){return e.concat(t.map((function(e){return s.resolve(r,a,e)})))}),[])};e.exports=function nodeModulesPaths(e,t,r){var s=t&&t.moduleDirectory?[].concat(t.moduleDirectory):["node_modules"];if(t&&typeof t.paths==="function"){return t.paths(r,e,(function(){return n(e,s)}),t)}var a=n(e,s);return t&&t.paths?a.concat(t.paths):a}},607:e=>{e.exports=function(e,t){return t||{}}},7252:(e,t,r)=>{var s=r(8746);var a=r(7147);var n=r(1017);var o=r(4029);var i=r(1177);var l=r(607);var c=a.realpathSync&&typeof a.realpathSync.native==="function"?a.realpathSync.native:a.realpathSync;var u=function isFile(e){try{var t=a.statSync(e)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return false;throw e}return t.isFile()||t.isFIFO()};var p=function isDirectory(e){try{var t=a.statSync(e)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return false;throw e}return t.isDirectory()};var f=function realpathSync(e){try{return c(e)}catch(e){if(e.code!=="ENOENT"){throw e}}return e};var d=function maybeRealpathSync(e,t,r){if(r&&r.preserveSymlinks===false){return e(t)}return t};var m=function defaultReadPackageSync(e,t){var r=e(t);try{var s=JSON.parse(r);return s}catch(e){}};var y=function getPackageCandidates(e,t,r){var s=i(t,r,e);for(var a=0;a{"use strict";e.exports=require("assert")},7147:e=>{"use strict";e.exports=require("fs")},8188:e=>{"use strict";e.exports=require("module")},8304:e=>{"use strict";e.exports=require("next/dist/compiled/babel/core")},6949:e=>{"use strict";e.exports=require("next/dist/compiled/babel/parser")},7369:e=>{"use strict";e.exports=require("next/dist/compiled/babel/traverse")},8622:e=>{"use strict";e.exports=require("next/dist/compiled/babel/types")},4907:e=>{"use strict";e.exports=require("next/dist/compiled/browserslist")},8542:e=>{"use strict";e.exports=require("next/dist/compiled/chalk")},7849:e=>{"use strict";e.exports=require("next/dist/compiled/semver")},1017:e=>{"use strict";e.exports=require("path")},3837:e=>{"use strict";e.exports=require("util")},1267:e=>{"use strict";e.exports=require("worker_threads")},614:(e,t,r)=>{function _classPrivateFieldGet(e,t){var r=_classExtractFieldDescriptor(e,t,"get");return _classApplyDescriptorGet(e,r)}function _classApplyDescriptorGet(e,t){if(t.get){return t.get.call(e)}return t.value}function _classPrivateFieldSet(e,t,r){var s=_classExtractFieldDescriptor(e,t,"set");_classApplyDescriptorSet(e,s,r);return r}function _classExtractFieldDescriptor(e,t,r){if(!t.has(e)){throw new TypeError("attempted to "+r+" private field on non-instance")}return t.get(e)}function _classApplyDescriptorSet(e,t,r){if(t.set){t.set.call(e,r)}else{if(!t.writable){throw new TypeError("attempted to set read only private field")}t.value=r}}const s=r(6007);const{Definition:a}=r(665);const n=r(4162);const o=r(4585);const{getKeys:i}=r(1498);let l;function getVisitorValues(e,t){if(l)return l[e];const{FLOW_FLIPPED_ALIAS_KEYS:r,VISITOR_KEYS:s}=t.getTypesInfo();const a=r.concat(["ArrayPattern","ClassDeclaration","ClassExpression","FunctionDeclaration","FunctionExpression","Identifier","ObjectPattern","RestElement"]);l=Object.entries(s).reduce(((e,[t,r])=>{if(!a.includes(r)){e[t]=r}return e}),{});return l[e]}const c={callProperties:{type:"loop",values:["value"]},indexers:{type:"loop",values:["key","value"]},properties:{type:"loop",values:["argument","value"]},types:{type:"loop"},params:{type:"loop"},argument:{type:"single"},elementType:{type:"single"},qualification:{type:"single"},rest:{type:"single"},returnType:{type:"single"},typeAnnotation:{type:"typeAnnotation"},typeParameters:{type:"typeParameters"},id:{type:"id"}};class PatternVisitor extends n{ArrayPattern(e){e.elements.forEach(this.visit,this)}ObjectPattern(e){e.properties.forEach(this.visit,this)}}var u=new WeakMap;class Referencer extends o{constructor(e,t,r){super(e,t);u.set(this,{writable:true,value:void 0});_classPrivateFieldSet(this,u,r)}visitPattern(e,t,r){if(!e){return}this._checkIdentifierOrVisit(e.typeAnnotation);if(e.type==="AssignmentPattern"){this._checkIdentifierOrVisit(e.left.typeAnnotation)}if(typeof t==="function"){r=t;t={processRightHandNodes:false}}const s=new PatternVisitor(this.options,e,r);s.visit(e);if(t.processRightHandNodes){s.rightHandNodes.forEach(this.visit,this)}}visitClass(e){this._visitArray(e.decorators);const t=this._nestTypeParamScope(e);this._visitTypeAnnotation(e.implements);this._visitTypeAnnotation(e.superTypeParameters&&e.superTypeParameters.params);super.visitClass(e);if(t){this.close(e)}}visitFunction(e){const t=this._nestTypeParamScope(e);this._checkIdentifierOrVisit(e.returnType);super.visitFunction(e);if(t){this.close(e)}}visitProperty(e){var t;if(((t=e.value)==null?void 0:t.type)==="TypeCastExpression"){this._visitTypeAnnotation(e.value)}this._visitArray(e.decorators);super.visitProperty(e)}InterfaceDeclaration(e){this._createScopeVariable(e,e.id);const t=this._nestTypeParamScope(e);this._visitArray(e.extends);this.visit(e.body);if(t){this.close(e)}}TypeAlias(e){this._createScopeVariable(e,e.id);const t=this._nestTypeParamScope(e);this.visit(e.right);if(t){this.close(e)}}ClassProperty(e){this._visitClassProperty(e)}ClassPrivateProperty(e){this._visitClassProperty(e)}PropertyDefinition(e){this._visitClassProperty(e)}ClassPrivateMethod(e){super.MethodDefinition(e)}DeclareModule(e){this._visitDeclareX(e)}DeclareFunction(e){this._visitDeclareX(e)}DeclareVariable(e){this._visitDeclareX(e)}DeclareClass(e){this._visitDeclareX(e)}OptionalMemberExpression(e){super.MemberExpression(e)}_visitClassProperty(e){this._visitTypeAnnotation(e.typeAnnotation);this.visitProperty(e)}_visitDeclareX(e){if(e.id){this._createScopeVariable(e,e.id)}const t=this._nestTypeParamScope(e);if(t){this.close(e)}}_createScopeVariable(e,t){this.currentScope().variableScope.__define(t,new a("Variable",t,e,null,null,null))}_nestTypeParamScope(e){if(!e.typeParameters){return null}const t=this.scopeManager.__currentScope;const r=new s.Scope(this.scopeManager,"type-parameters",t,e,false);this.scopeManager.__nestScope(r);for(let t=0;t{var s,a,n,o,i,l;function _classStaticPrivateFieldSpecSet(e,t,r,s){_classCheckPrivateStaticAccess(e,t);_classCheckPrivateStaticFieldDescriptor(r,"set");_classApplyDescriptorSet(e,r,s);return s}function _classStaticPrivateFieldSpecGet(e,t,r){_classCheckPrivateStaticAccess(e,t);_classCheckPrivateStaticFieldDescriptor(r,"get");return _classApplyDescriptorGet(e,r)}function _classCheckPrivateStaticFieldDescriptor(e,t){if(e===undefined){throw new TypeError("attempted to "+t+" private static field before its declaration")}}function _classCheckPrivateStaticAccess(e,t){if(e!==t){throw new TypeError("Private static access of wrong provenance")}}function _classPrivateFieldGet(e,t){var r=_classExtractFieldDescriptor(e,t,"get");return _classApplyDescriptorGet(e,r)}function _classApplyDescriptorGet(e,t){if(t.get){return t.get.call(e)}return t.value}function _classPrivateFieldSet(e,t,r){var s=_classExtractFieldDescriptor(e,t,"set");_classApplyDescriptorSet(e,s,r);return r}function _classExtractFieldDescriptor(e,t,r){if(!t.has(e)){throw new TypeError("attempted to "+r+" private field on non-instance")}return t.get(e)}function _classApplyDescriptorSet(e,t,r){if(t.set){t.set.call(e,r)}else{if(!t.writable){throw new TypeError("attempted to set read only private field")}t.value=r}}const c=r(1017);const u={GET_VERSION:"GET_VERSION",GET_TYPES_INFO:"GET_TYPES_INFO",GET_VISITOR_KEYS:"GET_VISITOR_KEYS",GET_TOKEN_LABELS:"GET_TOKEN_LABELS",MAYBE_PARSE:"MAYBE_PARSE",MAYBE_PARSE_SYNC:"MAYBE_PARSE_SYNC"};var p=new WeakMap;var f=new WeakMap;var d=new WeakMap;var m=new WeakMap;var y=new WeakMap;class Client{constructor(e){p.set(this,{writable:true,value:void 0});f.set(this,{writable:true,value:void 0});d.set(this,{writable:true,value:void 0});m.set(this,{writable:true,value:void 0});y.set(this,{writable:true,value:void 0});_classPrivateFieldSet(this,p,e)}getVersion(){var e;return(e=_classPrivateFieldGet(this,f))!=null?e:_classPrivateFieldSet(this,f,_classPrivateFieldGet(this,p).call(this,u.GET_VERSION,undefined))}getTypesInfo(){var e;return(e=_classPrivateFieldGet(this,d))!=null?e:_classPrivateFieldSet(this,d,_classPrivateFieldGet(this,p).call(this,u.GET_TYPES_INFO,undefined))}getVisitorKeys(){var e;return(e=_classPrivateFieldGet(this,m))!=null?e:_classPrivateFieldSet(this,m,_classPrivateFieldGet(this,p).call(this,u.GET_VISITOR_KEYS,undefined))}getTokLabels(){var e;return(e=_classPrivateFieldGet(this,y))!=null?e:_classPrivateFieldSet(this,y,_classPrivateFieldGet(this,p).call(this,u.GET_TOKEN_LABELS,undefined))}maybeParse(e,t){return _classPrivateFieldGet(this,p).call(this,u.MAYBE_PARSE,{code:e,options:t})}}t.WorkerClient=(o=(a=new WeakMap,n=new WeakMap,s=class WorkerClient extends Client{constructor(){super(((e,t)=>{_classPrivateFieldGet(this,n)[0]=0;const r=new(_classStaticPrivateFieldSpecGet(WorkerClient,s,i).MessageChannel);_classPrivateFieldGet(this,a).postMessage({signal:_classPrivateFieldGet(this,n),port:r.port1,action:e,payload:t},[r.port1]);Atomics.wait(_classPrivateFieldGet(this,n),0,0);const{message:o}=_classStaticPrivateFieldSpecGet(WorkerClient,s,i).receiveMessageOnPort(r.port2);if(o.error)throw Object.assign(o.error,o.errorData);else return o.result}));a.set(this,{writable:true,value:new(_classStaticPrivateFieldSpecGet(WorkerClient,s,i).Worker)(c.resolve(__dirname,"../lib/worker/index.cjs"),{env:_classStaticPrivateFieldSpecGet(WorkerClient,s,i).SHARE_ENV})});n.set(this,{writable:true,value:new Int32Array(new SharedArrayBuffer(4))});_classPrivateFieldGet(this,a).unref()}}),i={get:_get_worker_threads,set:void 0},l={writable:true,value:void 0},o);function _get_worker_threads(){var e;return(e=_classStaticPrivateFieldSpecGet(s,s,l))!=null?e:_classStaticPrivateFieldSpecSet(s,s,l,r(1267))}{var g,h,b;t.LocalClient=(h=g=class LocalClient extends Client{constructor(){var e;(e=_classStaticPrivateFieldSpecGet(LocalClient,g,b))!=null?e:_classStaticPrivateFieldSpecSet(LocalClient,g,b,r(2100));super(((e,t)=>_classStaticPrivateFieldSpecGet(LocalClient,g,b).call(LocalClient,e===u.MAYBE_PARSE?u.MAYBE_PARSE_SYNC:e,t)))}},b={writable:true,value:void 0},h)}},244:(e,t)=>{const r=["babelOptions","ecmaVersion","sourceType","allowImportExportEverywhere","requireConfigFile"];function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var r={};var s=Object.keys(e);var a,n;for(n=0;n=0)continue;r[a]=e[a]}return r}t.normalizeESLintConfig=function(e){const{babelOptions:t={},ecmaVersion:s=2020,sourceType:a="module",allowImportExportEverywhere:n=false,requireConfigFile:o=true}=e,i=_objectWithoutPropertiesLoose(e,r);return Object.assign({babelOptions:Object.assign({cwd:process.cwd()},t),ecmaVersion:s,sourceType:a,allowImportExportEverywhere:n,requireConfigFile:o},i)}},1527:e=>{function*it(e){if(Array.isArray(e))yield*e;else yield e}function traverse(e,t,r){const{type:s}=e;if(!s)return;const a=t[s];if(!a)return;for(const s of a){for(const a of it(e[s])){if(a&&typeof a==="object"){r.enter(a);traverse(a,t,r);r.exit(a)}}}}const t={enter(e){if(e.innerComments){delete e.innerComments}if(e.trailingComments){delete e.trailingComments}if(e.leadingComments){delete e.leadingComments}},exit(e){if(e.extra){delete e.extra}if(e!=null&&e.loc.identifierName){delete e.loc.identifierName}if(e.type==="TypeParameter"){e.type="Identifier";e.typeAnnotation=e.bound;delete e.bound}if(e.type==="QualifiedTypeIdentifier"){delete e.id}if(e.type==="ObjectTypeProperty"){delete e.key}if(e.type==="ObjectTypeIndexer"){delete e.id}if(e.type==="FunctionTypeParam"){delete e.name}if(e.type==="ImportDeclaration"){delete e.isType}if(e.type==="TemplateLiteral"){for(let t=0;tr.end){e.range[1]=r.end;e.loc.end.line=r.loc.end.line;e.loc.end.column=r.loc.end.column}}}else{if(!e.tokens.length){e.loc.start.line=1;e.loc.end.line=1}}if(e.body&&e.body.length>0){e.loc.start.line=e.body[0].loc.start.line;e.range[0]=e.body[0].start}}e.exports=function convertAST(e,t){convertNodes(e,t);convertProgramNode(e)}},5926:e=>{e.exports=function convertComments(e){for(const t of e){if(t.type==="CommentBlock"){t.type="Block"}else if(t.type==="CommentLine"){t.type="Line"}if(!t.range){t.range=[t.start,t.end]}}}},9530:e=>{function convertTemplateType(e,t){let r=null;let s=[];const a=[];function addTemplateType(){const e=s[0];const r=s[s.length-1];const n=s.reduce(((e,r)=>{if(r.value){e+=r.value}else if(r.type.label!==t.template){e+=r.type.label}return e}),"");a.push({type:"Template",value:n,start:e.start,end:r.end,loc:{start:e.loc.start,end:r.loc.end}});s=[]}e.forEach((e=>{switch(e.type.label){case t.backQuote:if(r){a.push(r);r=null}s.push(e);if(s.length>1){addTemplateType()}break;case t.dollarBraceL:s.push(e);addTemplateType();break;case t.braceR:if(r){a.push(r)}r=e;break;case t.template:if(r){s.push(r);r=null}s.push(e);break;case t.eof:if(r){a.push(r)}break;default:if(r){a.push(r);r=null}a.push(e)}}));return a}function convertToken(e,t,r){const{type:s}=e;const{label:a}=s;e.range=[e.start,e.end];if(a===r.name){e.type="Identifier"}else if(a===r.semi||a===r.comma||a===r.parenL||a===r.parenR||a===r.braceL||a===r.braceR||a===r.slash||a===r.dot||a===r.bracketL||a===r.bracketR||a===r.ellipsis||a===r.arrow||a===r.pipeline||a===r.star||a===r.incDec||a===r.colon||a===r.question||a===r.template||a===r.backQuote||a===r.dollarBraceL||a===r.at||a===r.logicalOR||a===r.logicalAND||a===r.nullishCoalescing||a===r.bitwiseOR||a===r.bitwiseXOR||a===r.bitwiseAND||a===r.equality||a===r.relational||a===r.bitShift||a===r.plusMin||a===r.modulo||a===r.exponent||a===r.bang||a===r.tilde||a===r.doubleColon||a===r.hash||a===r.questionDot||a===r.braceHashL||a===r.braceBarL||a===r.braceBarR||a===r.bracketHashL||a===r.bracketBarL||a===r.bracketBarR||s.isAssign){var n;e.type="Punctuator";(n=e.value)!=null?n:e.value=a}else if(a===r.jsxTagStart){e.type="Punctuator";e.value="<"}else if(a===r.jsxTagEnd){e.type="Punctuator";e.value=">"}else if(a===r.jsxName){e.type="JSXIdentifier"}else if(a===r.jsxText){e.type="JSXText"}else if(s.keyword==="null"){e.type="Null"}else if(s.keyword==="false"||s.keyword==="true"){e.type="Boolean"}else if(s.keyword){e.type="Keyword"}else if(a===r.num){e.type="Numeric";e.value=t.slice(e.start,e.end)}else if(a===r.string){e.type="String";e.value=t.slice(e.start,e.end)}else if(a===r.regexp){e.type="RegularExpression";const t=e.value;e.regex={pattern:t.pattern,flags:t.flags};e.value=`/${t.pattern}/${t.flags}`}else if(a===r.bigint){e.type="Numeric";e.value=`${e.value}n`}else if(a===r.privateName){e.type="PrivateIdentifier"}if(typeof e.type!=="string"){delete e.type.rightAssociative}return e}e.exports=function convertTokens(e,t,r){return convertTemplateType(e,r).filter((e=>e.type!=="CommentLine"&&e.type!=="CommentBlock")).map((e=>convertToken(e,t,r)))}},3773:(e,t,r)=>{const s=r(9530);const a=r(5926);const n=r(1527);t.ast=function convert(e,t,r,o){e.tokens=s(e.tokens,t,r);a(e.comments);n(e,o);return e};t.error=function convertError(e){if(e instanceof SyntaxError){e.lineNumber=e.loc.line;e.column=e.loc.column}return e}},8187:(e,t,r)=>{const{normalizeESLintConfig:s}=r(244);const a=r(614);const n=r(7854);const{LocalClient:o,WorkerClient:i}=r(7571);const l=new o;t.parse=function(e,t={}){return n(e,s(t),l)};t.parseForESLint=function(e,t={}){const r=s(t);const o=n(e,r,l);const i=a(o,r,l);return{ast:o,scopeManager:i,visitorKeys:l.getVisitorKeys()}}},7854:(e,t,r)=>{"use strict";const s=r(7849);const a=r(3773);function noop(){}const n=r(6949);noop((((e,t)=>(e=e.split("."),t=t.split("."),+e[0]>+t[0]||e[0]==t[0]&&+e[1]>=+t[1]))(process.versions.node,"8.9")?noop:(e,{paths:[t]},s=r(8188))=>{let a=s._findPath(e,s._nodeModulePaths(t).concat(t));if(a)return a;a=new Error(`Cannot resolve module '${e}'`);a.code="MODULE_NOT_FOUND";throw a})("@babel/parser",{paths:[noop("@babel/core/package.json")]}));let o=null;e.exports=function parse(e,t,r){const i=">=7.2.0";if(typeof o!=="boolean"){o=s.satisfies(r.getVersion(),i)}if(!o){throw new Error(`@babel/eslint-parser@${"7.15.0"} does not support @babel/core@${r.getVersion()}. Please upgrade to @babel/core@${i}.`)}const{ast:l,parserOptions:c}=r.maybeParse(e,t);if(l)return l;try{return a.ast(n.parse(e,c),e,r.getTokLabels(),r.getVisitorKeys())}catch(e){throw a.error(e)}}},76:(e,t,r)=>{const s=r(1498).KEYS;const a=r(6130);let n;t.getVisitorKeys=function getVisitorKeys(){if(!n){const e={ChainExpression:s.ChainExpression,ImportExpression:s.ImportExpression,Literal:s.Literal,MethodDefinition:["decorators"].concat(s.MethodDefinition),Property:["decorators"].concat(s.Property),PropertyDefinition:["decorators"].concat(s.PropertyDefinition)};const t={ClassPrivateMethod:["decorators"].concat(s.MethodDefinition),ExportAllDeclaration:s.ExportAllDeclaration};n=Object.assign({},e,a.types.VISITOR_KEYS,t)}return n};let o;t.getTokLabels=function getTokLabels(){return o||(o=(e=>e.reduce(((e,[t,r])=>Object.assign({},e,{[t]:r})),{}))(Object.entries(a.tokTypes).map((([e,t])=>[e,t.label]))))}},6130:(e,t,r)=>{function initialize(e){t.init=null;t.version=e.version;t.traverse=e.traverse;t.types=e.types;t.tokTypes=e.tokTypes;t.parseSync=e.parseSync;t.loadPartialConfigSync=e.loadPartialConfigSync;t.loadPartialConfigAsync=e.loadPartialConfigAsync;t.createConfigItem=e.createConfigItem}{initialize(r(8304))}},1542:(e,t,r)=>{function asyncGeneratorStep(e,t,r,s,a,n,o){try{var i=e[n](o);var l=i.value}catch(e){r(e);return}if(i.done){t(l)}else{Promise.resolve(l).then(s,a)}}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(s,a){var n=e.apply(t,r);function _next(e){asyncGeneratorStep(n,s,a,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(n,s,a,_next,_throw,"throw",e)}_next(undefined)}))}}const s=r(6130);function getParserPlugins(e){var t,r;const s=(t=(r=e.parserOpts)==null?void 0:r.plugins)!=null?t:[];const a={classFeatures:false};for(const e of s){if(Array.isArray(e)&&e[0]==="estree"){Object.assign(a,e[1]);break}}return[["estree",a],...s]}function normalizeParserOptions(e){return Object.assign({sourceType:e.sourceType,filename:e.filePath},e.babelOptions,{parserOpts:Object.assign({allowImportExportEverywhere:e.allowImportExportEverywhere,allowReturnOutsideFunction:true,allowSuperOutsideMethod:true},e.babelOptions.parserOpts,{plugins:getParserPlugins(e.babelOptions),attachComment:false,ranges:true,tokens:true}),caller:Object.assign({name:"@babel/eslint-parser"},e.babelOptions.caller)})}function validateResolvedConfig(e,t,r){if(e!==null){if(t.requireConfigFile!==false){if(!e.hasFilesystemConfig()){let t=`No Babel config file detected for ${e.options.filename}. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.`;if(e.options.filename.includes("node_modules")){t+=`\nIf you have a .babelrc.js file or use package.json#babel, keep in mind that it's not used when parsing dependencies. If you want your config to be applied to your whole app, consider using babel.config.js or babel.config.json instead.`}throw new Error(t)}}if(e.options)return e.options}return getDefaultParserOptions(r)}function getDefaultParserOptions(e){return Object.assign({plugins:[]},e,{babelrc:false,configFile:false,browserslistConfigFile:false,ignore:null,only:null})}t.normalizeBabelParseConfig=function(){var e=_asyncToGenerator((function*(e){const t=normalizeParserOptions(e);const r=yield s.loadPartialConfigAsync(t);return validateResolvedConfig(r,e,t)}));return function(t){return e.apply(this,arguments)}}();t.normalizeBabelParseConfigSync=function(e){const t=normalizeParserOptions(e);const r=s.loadPartialConfigSync(t);return validateResolvedConfig(r,e,t)}},2355:e=>{e.exports=function extractParserOptionsPlugin(){return{parserOverride(e,t){return t}}}},2100:(e,t,r)=>{const s=r(6130);const a=r(7495);const{getVisitorKeys:n,getTokLabels:o}=r(76);const{normalizeBabelParseConfig:i,normalizeBabelParseConfigSync:l}=r(1542);e.exports=function handleMessage(e,t){switch(e){case"GET_VERSION":return s.version;case"GET_TYPES_INFO":return{FLOW_FLIPPED_ALIAS_KEYS:s.types.FLIPPED_ALIAS_KEYS.Flow,VISITOR_KEYS:s.types.VISITOR_KEYS};case"GET_TOKEN_LABELS":return o();case"GET_VISITOR_KEYS":return n();case"MAYBE_PARSE":return i(t.options).then((e=>a(t.code,e)));case"MAYBE_PARSE_SYNC":{return a(t.code,l(t.options))}}throw new Error(`Unknown internal parser worker action: ${e}`)}},7495:(e,t,r)=>{const s=r(6130);const a=r(3773);const{getVisitorKeys:n,getTokLabels:o}=r(76);const i=r(2355);const l={};let c;const u=/More than one plugin attempted to override parsing/;e.exports=function maybeParse(e,t){if(!c){c=s.createConfigItem([i,l],{dirname:__dirname,type:"plugin"})}t.plugins.push(c);try{return{parserOptions:s.parseSync(e,t),ast:null}}catch(e){if(!u.test(e.message)){throw e}}let r;try{r=s.parseSync(e,t)}catch(e){throw a.error(e)}return{ast:a.ast(r,e,o(),n()),parserOptions:null}}},5619:e=>{"use strict";e.exports=JSON.parse('{"es6.module":{"chrome":"61","and_chr":"61","edge":"16","firefox":"60","and_ff":"60","node":"13.2.0","opera":"48","op_mob":"48","safari":"10.1","ios":"10.3","samsung":"8.2","android":"61","electron":"2.0","ios_saf":"10.3"}}')},7286:e=>{"use strict";e.exports=JSON.parse('{"proposal-class-static-block":{"chrome":"91","electron":"13.0"},"proposal-private-property-in-object":{"chrome":"91","firefox":"90","electron":"13.0"},"proposal-class-properties":{"chrome":"74","opera":"62","edge":"79","firefox":"90","safari":"14.1","node":"12","samsung":"11","electron":"6.0"},"proposal-private-methods":{"chrome":"84","opera":"70","edge":"84","firefox":"90","safari":"15","node":"14.6","electron":"10.0"},"proposal-numeric-separator":{"chrome":"75","opera":"62","edge":"79","firefox":"70","safari":"13","node":"12.5","ios":"13","samsung":"11","electron":"6.0"},"proposal-logical-assignment-operators":{"chrome":"85","opera":"71","edge":"85","firefox":"79","safari":"14","node":"15","ios":"14","electron":"10.0"},"proposal-nullish-coalescing-operator":{"chrome":"80","opera":"67","edge":"80","firefox":"72","safari":"13.1","node":"14","ios":"13.4","samsung":"13","electron":"8.0"},"proposal-optional-chaining":{"firefox":"74","safari":"13.1","ios":"13.4"},"proposal-json-strings":{"chrome":"66","opera":"53","edge":"79","firefox":"62","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"proposal-optional-catch-binding":{"chrome":"66","opera":"53","edge":"79","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-parameters":{"chrome":"49","opera":"36","edge":"18","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"proposal-async-generator-functions":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"proposal-object-rest-spread":{"chrome":"60","opera":"47","edge":"79","firefox":"55","safari":"11.1","node":"8.3","ios":"11.3","samsung":"8","electron":"2.0"},"transform-dotall-regex":{"chrome":"62","opera":"49","edge":"79","firefox":"78","safari":"11.1","node":"8.10","ios":"11.3","samsung":"8","electron":"3.0"},"proposal-unicode-property-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-named-capturing-groups-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-async-to-generator":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"11","node":"7.6","ios":"11","samsung":"6","electron":"1.6"},"transform-exponentiation-operator":{"chrome":"52","opera":"39","edge":"14","firefox":"52","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.3"},"transform-template-literals":{"chrome":"41","opera":"28","edge":"13","firefox":"34","safari":"13","node":"4","ios":"13","samsung":"3.4","electron":"0.21"},"transform-literals":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-function-name":{"chrome":"51","opera":"38","edge":"79","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-arrow-functions":{"chrome":"47","opera":"34","edge":"13","firefox":"45","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"transform-block-scoped-functions":{"chrome":"41","opera":"28","edge":"12","firefox":"46","safari":"10","node":"4","ie":"11","ios":"10","samsung":"3.4","electron":"0.21"},"transform-classes":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-object-super":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-shorthand-properties":{"chrome":"43","opera":"30","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.27"},"transform-duplicate-keys":{"chrome":"42","opera":"29","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.25"},"transform-computed-properties":{"chrome":"44","opera":"31","edge":"12","firefox":"34","safari":"7.1","node":"4","ios":"8","samsung":"4","electron":"0.30"},"transform-for-of":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-sticky-regex":{"chrome":"49","opera":"36","edge":"13","firefox":"3","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"transform-unicode-escapes":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-unicode-regex":{"chrome":"50","opera":"37","edge":"13","firefox":"46","safari":"12","node":"6","ios":"12","samsung":"5","electron":"1.1"},"transform-spread":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-destructuring":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-block-scoping":{"chrome":"49","opera":"36","edge":"14","firefox":"51","safari":"11","node":"6","ios":"11","samsung":"5","electron":"0.37"},"transform-typeof-symbol":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"transform-new-target":{"chrome":"46","opera":"33","edge":"14","firefox":"41","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-regenerator":{"chrome":"50","opera":"37","edge":"13","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"transform-member-expression-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"transform-property-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"transform-reserved-words":{"chrome":"13","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4.4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"proposal-export-namespace-from":{"chrome":"72","and_chr":"72","edge":"79","firefox":"80","and_ff":"80","node":"13.2","opera":"60","op_mob":"51","samsung":"11.0","android":"72","electron":"5.0"}}')},3654:e=>{"use strict";e.exports=JSON.parse('{"AssignmentExpression":["left","right"],"AssignmentPattern":["left","right"],"ArrayExpression":["elements"],"ArrayPattern":["elements"],"ArrowFunctionExpression":["params","body"],"AwaitExpression":["argument"],"BlockStatement":["body"],"BinaryExpression":["left","right"],"BreakStatement":["label"],"CallExpression":["callee","arguments"],"CatchClause":["param","body"],"ChainExpression":["expression"],"ClassBody":["body"],"ClassDeclaration":["id","superClass","body"],"ClassExpression":["id","superClass","body"],"ConditionalExpression":["test","consequent","alternate"],"ContinueStatement":["label"],"DebuggerStatement":[],"DoWhileStatement":["body","test"],"EmptyStatement":[],"ExportAllDeclaration":["exported","source"],"ExportDefaultDeclaration":["declaration"],"ExportNamedDeclaration":["declaration","specifiers","source"],"ExportSpecifier":["exported","local"],"ExpressionStatement":["expression"],"ExperimentalRestProperty":["argument"],"ExperimentalSpreadProperty":["argument"],"ForStatement":["init","test","update","body"],"ForInStatement":["left","right","body"],"ForOfStatement":["left","right","body"],"FunctionDeclaration":["id","params","body"],"FunctionExpression":["id","params","body"],"Identifier":[],"IfStatement":["test","consequent","alternate"],"ImportDeclaration":["specifiers","source"],"ImportDefaultSpecifier":["local"],"ImportExpression":["source"],"ImportNamespaceSpecifier":["local"],"ImportSpecifier":["imported","local"],"JSXAttribute":["name","value"],"JSXClosingElement":["name"],"JSXElement":["openingElement","children","closingElement"],"JSXEmptyExpression":[],"JSXExpressionContainer":["expression"],"JSXIdentifier":[],"JSXMemberExpression":["object","property"],"JSXNamespacedName":["namespace","name"],"JSXOpeningElement":["name","attributes"],"JSXSpreadAttribute":["argument"],"JSXText":[],"JSXFragment":["openingFragment","children","closingFragment"],"Literal":[],"LabeledStatement":["label","body"],"LogicalExpression":["left","right"],"MemberExpression":["object","property"],"MetaProperty":["meta","property"],"MethodDefinition":["key","value"],"NewExpression":["callee","arguments"],"ObjectExpression":["properties"],"ObjectPattern":["properties"],"PrivateIdentifier":[],"Program":["body"],"Property":["key","value"],"PropertyDefinition":["key","value"],"RestElement":["argument"],"ReturnStatement":["argument"],"SequenceExpression":["expressions"],"SpreadElement":["argument"],"Super":[],"SwitchStatement":["discriminant","cases"],"SwitchCase":["test","consequent"],"TaggedTemplateExpression":["tag","quasi"],"TemplateElement":[],"TemplateLiteral":["quasis","expressions"],"ThisExpression":[],"ThrowStatement":["argument"],"TryStatement":["block","handler","finalizer"],"UnaryExpression":["argument"],"UpdateExpression":["argument"],"VariableDeclaration":["declarations"],"VariableDeclarator":["id","init"],"WhileStatement":["test","body"],"WithStatement":["object","body"],"YieldExpression":["argument"]}')},5676:e=>{"use strict";e.exports=JSON.parse('{"assert":true,"assert/strict":">= 15","async_hooks":">= 8","buffer_ieee754":"< 0.9.7","buffer":true,"child_process":true,"cluster":true,"console":true,"constants":true,"crypto":true,"_debug_agent":">= 1 && < 8","_debugger":"< 8","dgram":true,"diagnostics_channel":">= 15.1","dns":true,"dns/promises":">= 15","domain":">= 0.7.12","events":true,"freelist":"< 6","fs":true,"fs/promises":[">= 10 && < 10.1",">= 14"],"_http_agent":">= 0.11.1","_http_client":">= 0.11.1","_http_common":">= 0.11.1","_http_incoming":">= 0.11.1","_http_outgoing":">= 0.11.1","_http_server":">= 0.11.1","http":true,"http2":">= 8.8","https":true,"inspector":">= 8.0.0","_linklist":"< 8","module":true,"net":true,"node-inspect/lib/_inspect":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6.0 && < 12","os":true,"path":true,"path/posix":">= 15.3","path/win32":">= 15.3","perf_hooks":">= 8.5","process":">= 1","punycode":true,"querystring":true,"readline":true,"repl":true,"smalloc":">= 0.11.5 && < 3","_stream_duplex":">= 0.9.4","_stream_transform":">= 0.9.4","_stream_wrap":">= 1.4.1","_stream_passthrough":">= 0.9.4","_stream_readable":">= 0.9.4","_stream_writable":">= 0.9.4","stream":true,"stream/promises":">= 15","string_decoder":true,"sys":[">= 0.6 && < 0.7",">= 0.8"],"timers":true,"timers/promises":">= 15","_tls_common":">= 0.11.13","_tls_legacy":">= 0.11.3 && < 10","_tls_wrap":">= 0.11.3","tls":true,"trace_events":">= 10","tty":true,"url":true,"util":true,"util/types":">= 15.3","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/consarray":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/csvparser":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/logreader":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/profile_view":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/splaytree":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8":">= 1","vm":true,"wasi":">= 13.4 && < 13.5","worker_threads":">= 11.7","zlib":true}')},5880:e=>{"use strict";e.exports=JSON.parse('{"es6.array.copy-within":{"chrome":"45","opera":"32","edge":"12","firefox":"32","safari":"9","node":"4","ios":"9","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.every":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.fill":{"chrome":"45","opera":"32","edge":"12","firefox":"31","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.filter":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.find":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.find-index":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es7.array.flat-map":{"chrome":"69","opera":"56","edge":"79","firefox":"62","safari":"12","node":"11","ios":"12","samsung":"10","electron":"4.0"},"es6.array.for-each":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.from":{"chrome":"51","opera":"38","edge":"15","firefox":"36","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.array.includes":{"chrome":"47","opera":"34","edge":"14","firefox":"43","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.array.index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.is-array":{"chrome":"5","opera":"10.50","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.iterator":{"chrome":"66","opera":"53","edge":"12","firefox":"60","safari":"9","node":"10","ios":"9","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es6.array.last-index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.map":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.of":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"9","node":"4","ios":"9","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.reduce":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.reduce-right":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.slice":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.some":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.sort":{"chrome":"63","opera":"50","edge":"12","firefox":"5","safari":"12","node":"10","ie":"9","ios":"12","samsung":"8","rhino":"1.7.13","electron":"3.0"},"es6.array.species":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.date.now":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-iso-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-json":{"chrome":"5","opera":"12.10","edge":"12","firefox":"4","safari":"10","node":"0.10","ie":"9","android":"4","ios":"10","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-primitive":{"chrome":"47","opera":"34","edge":"15","firefox":"44","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.date.to-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.function.bind":{"chrome":"7","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.function.has-instance":{"chrome":"51","opera":"38","edge":"15","firefox":"50","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.function.name":{"chrome":"5","opera":"10.50","edge":"14","firefox":"2","safari":"4","node":"0.10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.math.acosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.asinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.atanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.cbrt":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.clz32":{"chrome":"38","opera":"25","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.cosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.expm1":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.fround":{"chrome":"38","opera":"25","edge":"12","firefox":"26","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.hypot":{"chrome":"38","opera":"25","edge":"12","firefox":"27","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.imul":{"chrome":"30","opera":"17","edge":"12","firefox":"23","safari":"7","node":"0.12","android":"4.4","ios":"7","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.math.log1p":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.log10":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.log2":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.sign":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.sinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.tanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.trunc":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.number.constructor":{"chrome":"41","opera":"28","edge":"12","firefox":"36","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.number.epsilon":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.is-finite":{"chrome":"19","opera":"15","edge":"12","firefox":"16","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.number.is-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"16","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.is-nan":{"chrome":"19","opera":"15","edge":"12","firefox":"15","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.number.is-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"32","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.max-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.min-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.parse-float":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.parse-int":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.object.assign":{"chrome":"49","opera":"36","edge":"13","firefox":"36","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.object.create":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.object.define-getter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.define-setter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.define-property":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.object.define-properties":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.object.entries":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.freeze":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.get-own-property-descriptor":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es7.object.get-own-property-descriptors":{"chrome":"54","opera":"41","edge":"15","firefox":"50","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.get-own-property-names":{"chrome":"40","opera":"27","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.object.get-prototype-of":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es7.object.lookup-getter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.lookup-setter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.prevent-extensions":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.to-string":{"chrome":"57","opera":"44","edge":"15","firefox":"51","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es6.object.is":{"chrome":"19","opera":"15","edge":"12","firefox":"22","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.object.is-frozen":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.is-sealed":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.is-extensible":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.keys":{"chrome":"40","opera":"27","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.object.seal":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.set-prototype-of":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ie":"11","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es7.object.values":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.promise":{"chrome":"51","opera":"38","edge":"14","firefox":"45","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.promise.finally":{"chrome":"63","opera":"50","edge":"18","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"8","electron":"3.0"},"es6.reflect.apply":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.construct":{"chrome":"49","opera":"36","edge":"13","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.define-property":{"chrome":"49","opera":"36","edge":"13","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.delete-property":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-own-property-descriptor":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.has":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.is-extensible":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.own-keys":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.prevent-extensions":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.regexp.constructor":{"chrome":"50","opera":"37","edge":"79","firefox":"40","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.flags":{"chrome":"49","opera":"36","edge":"79","firefox":"37","safari":"9","node":"6","ios":"9","samsung":"5","electron":"0.37"},"es6.regexp.match":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"1.1"},"es6.regexp.replace":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.split":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.search":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"1.1"},"es6.regexp.to-string":{"chrome":"50","opera":"37","edge":"79","firefox":"39","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.symbol":{"chrome":"51","opera":"38","edge":"79","firefox":"51","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.symbol.async-iterator":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"es6.string.anchor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.big":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.blink":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.bold":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.code-point-at":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.ends-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.fixed":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontcolor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontsize":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.from-code-point":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.includes":{"chrome":"41","opera":"28","edge":"12","firefox":"40","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.italics":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.iterator":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.string.link":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es7.string.pad-start":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","rhino":"1.7.13","electron":"1.7"},"es7.string.pad-end":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","rhino":"1.7.13","electron":"1.7"},"es6.string.raw":{"chrome":"41","opera":"28","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.repeat":{"chrome":"41","opera":"28","edge":"12","firefox":"24","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.small":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.starts-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.strike":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sub":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sup":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.trim":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.string.trim-left":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es7.string.trim-right":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es6.typed.array-buffer":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.data-view":{"chrome":"5","opera":"12","edge":"12","firefox":"15","safari":"5.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.typed.int8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-clamped-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float64-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.weak-map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"},"es6.weak-set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"}}')},2166:e=>{"use strict";e.exports={version:"4.3.0"}},290:e=>{"use strict";e.exports={i8:"5.1.1"}},5535:e=>{"use strict";e.exports={i8:"4.3.0"}},964:e=>{"use strict";e.exports=JSON.parse('{"builtin":{"Array":false,"ArrayBuffer":false,"Atomics":false,"BigInt":false,"BigInt64Array":false,"BigUint64Array":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"globalThis":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"es5":{"Array":false,"Boolean":false,"constructor":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"propertyIsEnumerable":false,"RangeError":false,"ReferenceError":false,"RegExp":false,"String":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false},"es2015":{"Array":false,"ArrayBuffer":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"es2017":{"Array":false,"ArrayBuffer":false,"Atomics":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"browser":{"AbortController":false,"AbortSignal":false,"addEventListener":false,"alert":false,"AnalyserNode":false,"Animation":false,"AnimationEffectReadOnly":false,"AnimationEffectTiming":false,"AnimationEffectTimingReadOnly":false,"AnimationEvent":false,"AnimationPlaybackEvent":false,"AnimationTimeline":false,"applicationCache":false,"ApplicationCache":false,"ApplicationCacheErrorEvent":false,"atob":false,"Attr":false,"Audio":false,"AudioBuffer":false,"AudioBufferSourceNode":false,"AudioContext":false,"AudioDestinationNode":false,"AudioListener":false,"AudioNode":false,"AudioParam":false,"AudioProcessingEvent":false,"AudioScheduledSourceNode":false,"AudioWorkletGlobalScope ":false,"AudioWorkletNode":false,"AudioWorkletProcessor":false,"BarProp":false,"BaseAudioContext":false,"BatteryManager":false,"BeforeUnloadEvent":false,"BiquadFilterNode":false,"Blob":false,"BlobEvent":false,"blur":false,"BroadcastChannel":false,"btoa":false,"BudgetService":false,"ByteLengthQueuingStrategy":false,"Cache":false,"caches":false,"CacheStorage":false,"cancelAnimationFrame":false,"cancelIdleCallback":false,"CanvasCaptureMediaStreamTrack":false,"CanvasGradient":false,"CanvasPattern":false,"CanvasRenderingContext2D":false,"ChannelMergerNode":false,"ChannelSplitterNode":false,"CharacterData":false,"clearInterval":false,"clearTimeout":false,"clientInformation":false,"ClipboardEvent":false,"close":false,"closed":false,"CloseEvent":false,"Comment":false,"CompositionEvent":false,"confirm":false,"console":false,"ConstantSourceNode":false,"ConvolverNode":false,"CountQueuingStrategy":false,"createImageBitmap":false,"Credential":false,"CredentialsContainer":false,"crypto":false,"Crypto":false,"CryptoKey":false,"CSS":false,"CSSConditionRule":false,"CSSFontFaceRule":false,"CSSGroupingRule":false,"CSSImportRule":false,"CSSKeyframeRule":false,"CSSKeyframesRule":false,"CSSMediaRule":false,"CSSNamespaceRule":false,"CSSPageRule":false,"CSSRule":false,"CSSRuleList":false,"CSSStyleDeclaration":false,"CSSStyleRule":false,"CSSStyleSheet":false,"CSSSupportsRule":false,"CustomElementRegistry":false,"customElements":false,"CustomEvent":false,"DataTransfer":false,"DataTransferItem":false,"DataTransferItemList":false,"defaultstatus":false,"defaultStatus":false,"DelayNode":false,"DeviceMotionEvent":false,"DeviceOrientationEvent":false,"devicePixelRatio":false,"dispatchEvent":false,"document":false,"Document":false,"DocumentFragment":false,"DocumentType":false,"DOMError":false,"DOMException":false,"DOMImplementation":false,"DOMMatrix":false,"DOMMatrixReadOnly":false,"DOMParser":false,"DOMPoint":false,"DOMPointReadOnly":false,"DOMQuad":false,"DOMRect":false,"DOMRectReadOnly":false,"DOMStringList":false,"DOMStringMap":false,"DOMTokenList":false,"DragEvent":false,"DynamicsCompressorNode":false,"Element":false,"ErrorEvent":false,"event":false,"Event":false,"EventSource":false,"EventTarget":false,"external":false,"fetch":false,"File":false,"FileList":false,"FileReader":false,"find":false,"focus":false,"FocusEvent":false,"FontFace":false,"FontFaceSetLoadEvent":false,"FormData":false,"frameElement":false,"frames":false,"GainNode":false,"Gamepad":false,"GamepadButton":false,"GamepadEvent":false,"getComputedStyle":false,"getSelection":false,"HashChangeEvent":false,"Headers":false,"history":false,"History":false,"HTMLAllCollection":false,"HTMLAnchorElement":false,"HTMLAreaElement":false,"HTMLAudioElement":false,"HTMLBaseElement":false,"HTMLBodyElement":false,"HTMLBRElement":false,"HTMLButtonElement":false,"HTMLCanvasElement":false,"HTMLCollection":false,"HTMLContentElement":false,"HTMLDataElement":false,"HTMLDataListElement":false,"HTMLDetailsElement":false,"HTMLDialogElement":false,"HTMLDirectoryElement":false,"HTMLDivElement":false,"HTMLDListElement":false,"HTMLDocument":false,"HTMLElement":false,"HTMLEmbedElement":false,"HTMLFieldSetElement":false,"HTMLFontElement":false,"HTMLFormControlsCollection":false,"HTMLFormElement":false,"HTMLFrameElement":false,"HTMLFrameSetElement":false,"HTMLHeadElement":false,"HTMLHeadingElement":false,"HTMLHRElement":false,"HTMLHtmlElement":false,"HTMLIFrameElement":false,"HTMLImageElement":false,"HTMLInputElement":false,"HTMLLabelElement":false,"HTMLLegendElement":false,"HTMLLIElement":false,"HTMLLinkElement":false,"HTMLMapElement":false,"HTMLMarqueeElement":false,"HTMLMediaElement":false,"HTMLMenuElement":false,"HTMLMetaElement":false,"HTMLMeterElement":false,"HTMLModElement":false,"HTMLObjectElement":false,"HTMLOListElement":false,"HTMLOptGroupElement":false,"HTMLOptionElement":false,"HTMLOptionsCollection":false,"HTMLOutputElement":false,"HTMLParagraphElement":false,"HTMLParamElement":false,"HTMLPictureElement":false,"HTMLPreElement":false,"HTMLProgressElement":false,"HTMLQuoteElement":false,"HTMLScriptElement":false,"HTMLSelectElement":false,"HTMLShadowElement":false,"HTMLSlotElement":false,"HTMLSourceElement":false,"HTMLSpanElement":false,"HTMLStyleElement":false,"HTMLTableCaptionElement":false,"HTMLTableCellElement":false,"HTMLTableColElement":false,"HTMLTableElement":false,"HTMLTableRowElement":false,"HTMLTableSectionElement":false,"HTMLTemplateElement":false,"HTMLTextAreaElement":false,"HTMLTimeElement":false,"HTMLTitleElement":false,"HTMLTrackElement":false,"HTMLUListElement":false,"HTMLUnknownElement":false,"HTMLVideoElement":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"IdleDeadline":false,"IIRFilterNode":false,"Image":false,"ImageBitmap":false,"ImageBitmapRenderingContext":false,"ImageCapture":false,"ImageData":false,"indexedDB":false,"innerHeight":false,"innerWidth":false,"InputEvent":false,"IntersectionObserver":false,"IntersectionObserverEntry":false,"Intl":false,"isSecureContext":false,"KeyboardEvent":false,"KeyframeEffect":false,"KeyframeEffectReadOnly":false,"length":false,"localStorage":false,"location":true,"Location":false,"locationbar":false,"matchMedia":false,"MediaDeviceInfo":false,"MediaDevices":false,"MediaElementAudioSourceNode":false,"MediaEncryptedEvent":false,"MediaError":false,"MediaKeyMessageEvent":false,"MediaKeySession":false,"MediaKeyStatusMap":false,"MediaKeySystemAccess":false,"MediaList":false,"MediaQueryList":false,"MediaQueryListEvent":false,"MediaRecorder":false,"MediaSettingsRange":false,"MediaSource":false,"MediaStream":false,"MediaStreamAudioDestinationNode":false,"MediaStreamAudioSourceNode":false,"MediaStreamEvent":false,"MediaStreamTrack":false,"MediaStreamTrackEvent":false,"menubar":false,"MessageChannel":false,"MessageEvent":false,"MessagePort":false,"MIDIAccess":false,"MIDIConnectionEvent":false,"MIDIInput":false,"MIDIInputMap":false,"MIDIMessageEvent":false,"MIDIOutput":false,"MIDIOutputMap":false,"MIDIPort":false,"MimeType":false,"MimeTypeArray":false,"MouseEvent":false,"moveBy":false,"moveTo":false,"MutationEvent":false,"MutationObserver":false,"MutationRecord":false,"name":false,"NamedNodeMap":false,"NavigationPreloadManager":false,"navigator":false,"Navigator":false,"NetworkInformation":false,"Node":false,"NodeFilter":false,"NodeIterator":false,"NodeList":false,"Notification":false,"OfflineAudioCompletionEvent":false,"OfflineAudioContext":false,"offscreenBuffering":false,"OffscreenCanvas":true,"onabort":true,"onafterprint":true,"onanimationend":true,"onanimationiteration":true,"onanimationstart":true,"onappinstalled":true,"onauxclick":true,"onbeforeinstallprompt":true,"onbeforeprint":true,"onbeforeunload":true,"onblur":true,"oncancel":true,"oncanplay":true,"oncanplaythrough":true,"onchange":true,"onclick":true,"onclose":true,"oncontextmenu":true,"oncuechange":true,"ondblclick":true,"ondevicemotion":true,"ondeviceorientation":true,"ondeviceorientationabsolute":true,"ondrag":true,"ondragend":true,"ondragenter":true,"ondragleave":true,"ondragover":true,"ondragstart":true,"ondrop":true,"ondurationchange":true,"onemptied":true,"onended":true,"onerror":true,"onfocus":true,"ongotpointercapture":true,"onhashchange":true,"oninput":true,"oninvalid":true,"onkeydown":true,"onkeypress":true,"onkeyup":true,"onlanguagechange":true,"onload":true,"onloadeddata":true,"onloadedmetadata":true,"onloadstart":true,"onlostpointercapture":true,"onmessage":true,"onmessageerror":true,"onmousedown":true,"onmouseenter":true,"onmouseleave":true,"onmousemove":true,"onmouseout":true,"onmouseover":true,"onmouseup":true,"onmousewheel":true,"onoffline":true,"ononline":true,"onpagehide":true,"onpageshow":true,"onpause":true,"onplay":true,"onplaying":true,"onpointercancel":true,"onpointerdown":true,"onpointerenter":true,"onpointerleave":true,"onpointermove":true,"onpointerout":true,"onpointerover":true,"onpointerup":true,"onpopstate":true,"onprogress":true,"onratechange":true,"onrejectionhandled":true,"onreset":true,"onresize":true,"onscroll":true,"onsearch":true,"onseeked":true,"onseeking":true,"onselect":true,"onstalled":true,"onstorage":true,"onsubmit":true,"onsuspend":true,"ontimeupdate":true,"ontoggle":true,"ontransitionend":true,"onunhandledrejection":true,"onunload":true,"onvolumechange":true,"onwaiting":true,"onwheel":true,"open":false,"openDatabase":false,"opener":false,"Option":false,"origin":false,"OscillatorNode":false,"outerHeight":false,"outerWidth":false,"PageTransitionEvent":false,"pageXOffset":false,"pageYOffset":false,"PannerNode":false,"parent":false,"Path2D":false,"PaymentAddress":false,"PaymentRequest":false,"PaymentRequestUpdateEvent":false,"PaymentResponse":false,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceLongTaskTiming":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceNavigationTiming":false,"PerformanceObserver":false,"PerformanceObserverEntryList":false,"PerformancePaintTiming":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"PeriodicWave":false,"Permissions":false,"PermissionStatus":false,"personalbar":false,"PhotoCapabilities":false,"Plugin":false,"PluginArray":false,"PointerEvent":false,"PopStateEvent":false,"postMessage":false,"Presentation":false,"PresentationAvailability":false,"PresentationConnection":false,"PresentationConnectionAvailableEvent":false,"PresentationConnectionCloseEvent":false,"PresentationConnectionList":false,"PresentationReceiver":false,"PresentationRequest":false,"print":false,"ProcessingInstruction":false,"ProgressEvent":false,"PromiseRejectionEvent":false,"prompt":false,"PushManager":false,"PushSubscription":false,"PushSubscriptionOptions":false,"queueMicrotask":false,"RadioNodeList":false,"Range":false,"ReadableStream":false,"registerProcessor":false,"RemotePlayback":false,"removeEventListener":false,"Request":false,"requestAnimationFrame":false,"requestIdleCallback":false,"resizeBy":false,"ResizeObserver":false,"ResizeObserverEntry":false,"resizeTo":false,"Response":false,"RTCCertificate":false,"RTCDataChannel":false,"RTCDataChannelEvent":false,"RTCDtlsTransport":false,"RTCIceCandidate":false,"RTCIceGatherer":false,"RTCIceTransport":false,"RTCPeerConnection":false,"RTCPeerConnectionIceEvent":false,"RTCRtpContributingSource":false,"RTCRtpReceiver":false,"RTCRtpSender":false,"RTCSctpTransport":false,"RTCSessionDescription":false,"RTCStatsReport":false,"RTCTrackEvent":false,"screen":false,"Screen":false,"screenLeft":false,"ScreenOrientation":false,"screenTop":false,"screenX":false,"screenY":false,"ScriptProcessorNode":false,"scroll":false,"scrollbars":false,"scrollBy":false,"scrollTo":false,"scrollX":false,"scrollY":false,"SecurityPolicyViolationEvent":false,"Selection":false,"self":false,"ServiceWorker":false,"ServiceWorkerContainer":false,"ServiceWorkerRegistration":false,"sessionStorage":false,"setInterval":false,"setTimeout":false,"ShadowRoot":false,"SharedWorker":false,"SourceBuffer":false,"SourceBufferList":false,"speechSynthesis":false,"SpeechSynthesisEvent":false,"SpeechSynthesisUtterance":false,"StaticRange":false,"status":false,"statusbar":false,"StereoPannerNode":false,"stop":false,"Storage":false,"StorageEvent":false,"StorageManager":false,"styleMedia":false,"StyleSheet":false,"StyleSheetList":false,"SubtleCrypto":false,"SVGAElement":false,"SVGAngle":false,"SVGAnimatedAngle":false,"SVGAnimatedBoolean":false,"SVGAnimatedEnumeration":false,"SVGAnimatedInteger":false,"SVGAnimatedLength":false,"SVGAnimatedLengthList":false,"SVGAnimatedNumber":false,"SVGAnimatedNumberList":false,"SVGAnimatedPreserveAspectRatio":false,"SVGAnimatedRect":false,"SVGAnimatedString":false,"SVGAnimatedTransformList":false,"SVGAnimateElement":false,"SVGAnimateMotionElement":false,"SVGAnimateTransformElement":false,"SVGAnimationElement":false,"SVGCircleElement":false,"SVGClipPathElement":false,"SVGComponentTransferFunctionElement":false,"SVGDefsElement":false,"SVGDescElement":false,"SVGDiscardElement":false,"SVGElement":false,"SVGEllipseElement":false,"SVGFEBlendElement":false,"SVGFEColorMatrixElement":false,"SVGFEComponentTransferElement":false,"SVGFECompositeElement":false,"SVGFEConvolveMatrixElement":false,"SVGFEDiffuseLightingElement":false,"SVGFEDisplacementMapElement":false,"SVGFEDistantLightElement":false,"SVGFEDropShadowElement":false,"SVGFEFloodElement":false,"SVGFEFuncAElement":false,"SVGFEFuncBElement":false,"SVGFEFuncGElement":false,"SVGFEFuncRElement":false,"SVGFEGaussianBlurElement":false,"SVGFEImageElement":false,"SVGFEMergeElement":false,"SVGFEMergeNodeElement":false,"SVGFEMorphologyElement":false,"SVGFEOffsetElement":false,"SVGFEPointLightElement":false,"SVGFESpecularLightingElement":false,"SVGFESpotLightElement":false,"SVGFETileElement":false,"SVGFETurbulenceElement":false,"SVGFilterElement":false,"SVGForeignObjectElement":false,"SVGGElement":false,"SVGGeometryElement":false,"SVGGradientElement":false,"SVGGraphicsElement":false,"SVGImageElement":false,"SVGLength":false,"SVGLengthList":false,"SVGLinearGradientElement":false,"SVGLineElement":false,"SVGMarkerElement":false,"SVGMaskElement":false,"SVGMatrix":false,"SVGMetadataElement":false,"SVGMPathElement":false,"SVGNumber":false,"SVGNumberList":false,"SVGPathElement":false,"SVGPatternElement":false,"SVGPoint":false,"SVGPointList":false,"SVGPolygonElement":false,"SVGPolylineElement":false,"SVGPreserveAspectRatio":false,"SVGRadialGradientElement":false,"SVGRect":false,"SVGRectElement":false,"SVGScriptElement":false,"SVGSetElement":false,"SVGStopElement":false,"SVGStringList":false,"SVGStyleElement":false,"SVGSVGElement":false,"SVGSwitchElement":false,"SVGSymbolElement":false,"SVGTextContentElement":false,"SVGTextElement":false,"SVGTextPathElement":false,"SVGTextPositioningElement":false,"SVGTitleElement":false,"SVGTransform":false,"SVGTransformList":false,"SVGTSpanElement":false,"SVGUnitTypes":false,"SVGUseElement":false,"SVGViewElement":false,"TaskAttributionTiming":false,"Text":false,"TextDecoder":false,"TextEncoder":false,"TextEvent":false,"TextMetrics":false,"TextTrack":false,"TextTrackCue":false,"TextTrackCueList":false,"TextTrackList":false,"TimeRanges":false,"toolbar":false,"top":false,"Touch":false,"TouchEvent":false,"TouchList":false,"TrackEvent":false,"TransitionEvent":false,"TreeWalker":false,"UIEvent":false,"URL":false,"URLSearchParams":false,"ValidityState":false,"visualViewport":false,"VisualViewport":false,"VTTCue":false,"WaveShaperNode":false,"WebAssembly":false,"WebGL2RenderingContext":false,"WebGLActiveInfo":false,"WebGLBuffer":false,"WebGLContextEvent":false,"WebGLFramebuffer":false,"WebGLProgram":false,"WebGLQuery":false,"WebGLRenderbuffer":false,"WebGLRenderingContext":false,"WebGLSampler":false,"WebGLShader":false,"WebGLShaderPrecisionFormat":false,"WebGLSync":false,"WebGLTexture":false,"WebGLTransformFeedback":false,"WebGLUniformLocation":false,"WebGLVertexArrayObject":false,"WebSocket":false,"WheelEvent":false,"window":false,"Window":false,"Worker":false,"WritableStream":false,"XMLDocument":false,"XMLHttpRequest":false,"XMLHttpRequestEventTarget":false,"XMLHttpRequestUpload":false,"XMLSerializer":false,"XPathEvaluator":false,"XPathExpression":false,"XPathResult":false,"XSLTProcessor":false},"worker":{"addEventListener":false,"applicationCache":false,"atob":false,"Blob":false,"BroadcastChannel":false,"btoa":false,"Cache":false,"caches":false,"clearInterval":false,"clearTimeout":false,"close":true,"console":false,"fetch":false,"FileReaderSync":false,"FormData":false,"Headers":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"ImageData":false,"importScripts":true,"indexedDB":false,"location":false,"MessageChannel":false,"MessagePort":false,"name":false,"navigator":false,"Notification":false,"onclose":true,"onconnect":true,"onerror":true,"onlanguagechange":true,"onmessage":true,"onoffline":true,"ononline":true,"onrejectionhandled":true,"onunhandledrejection":true,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"postMessage":true,"Promise":false,"queueMicrotask":false,"removeEventListener":false,"Request":false,"Response":false,"self":true,"ServiceWorkerRegistration":false,"setInterval":false,"setTimeout":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false,"WebSocket":false,"Worker":false,"WorkerGlobalScope":false,"XMLHttpRequest":false},"node":{"__dirname":false,"__filename":false,"Buffer":false,"clearImmediate":false,"clearInterval":false,"clearTimeout":false,"console":false,"exports":true,"global":false,"Intl":false,"module":false,"process":false,"queueMicrotask":false,"require":false,"setImmediate":false,"setInterval":false,"setTimeout":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false},"commonjs":{"exports":true,"global":false,"module":false,"require":false},"amd":{"define":false,"require":false},"mocha":{"after":false,"afterEach":false,"before":false,"beforeEach":false,"context":false,"describe":false,"it":false,"mocha":false,"run":false,"setup":false,"specify":false,"suite":false,"suiteSetup":false,"suiteTeardown":false,"teardown":false,"test":false,"xcontext":false,"xdescribe":false,"xit":false,"xspecify":false},"jasmine":{"afterAll":false,"afterEach":false,"beforeAll":false,"beforeEach":false,"describe":false,"expect":false,"fail":false,"fdescribe":false,"fit":false,"it":false,"jasmine":false,"pending":false,"runs":false,"spyOn":false,"spyOnProperty":false,"waits":false,"waitsFor":false,"xdescribe":false,"xit":false},"jest":{"afterAll":false,"afterEach":false,"beforeAll":false,"beforeEach":false,"describe":false,"expect":false,"fdescribe":false,"fit":false,"it":false,"jest":false,"pit":false,"require":false,"test":false,"xdescribe":false,"xit":false,"xtest":false},"qunit":{"asyncTest":false,"deepEqual":false,"equal":false,"expect":false,"module":false,"notDeepEqual":false,"notEqual":false,"notOk":false,"notPropEqual":false,"notStrictEqual":false,"ok":false,"propEqual":false,"QUnit":false,"raises":false,"start":false,"stop":false,"strictEqual":false,"test":false,"throws":false},"phantomjs":{"console":true,"exports":true,"phantom":true,"require":true,"WebPage":true},"couch":{"emit":false,"exports":false,"getRow":false,"log":false,"module":false,"provides":false,"require":false,"respond":false,"send":false,"start":false,"sum":false},"rhino":{"defineClass":false,"deserialize":false,"gc":false,"help":false,"importClass":false,"importPackage":false,"java":false,"load":false,"loadClass":false,"Packages":false,"print":false,"quit":false,"readFile":false,"readUrl":false,"runCommand":false,"seal":false,"serialize":false,"spawn":false,"sync":false,"toint32":false,"version":false},"nashorn":{"__DIR__":false,"__FILE__":false,"__LINE__":false,"com":false,"edu":false,"exit":false,"java":false,"Java":false,"javafx":false,"JavaImporter":false,"javax":false,"JSAdapter":false,"load":false,"loadWithNewGlobal":false,"org":false,"Packages":false,"print":false,"quit":false},"wsh":{"ActiveXObject":true,"Enumerator":true,"GetObject":true,"ScriptEngine":true,"ScriptEngineBuildVersion":true,"ScriptEngineMajorVersion":true,"ScriptEngineMinorVersion":true,"VBArray":true,"WScript":true,"WSH":true,"XDomainRequest":true},"jquery":{"$":false,"jQuery":false},"yui":{"YAHOO":false,"YAHOO_config":false,"YUI":false,"YUI_config":false},"shelljs":{"cat":false,"cd":false,"chmod":false,"config":false,"cp":false,"dirs":false,"echo":false,"env":false,"error":false,"exec":false,"exit":false,"find":false,"grep":false,"ln":false,"ls":false,"mkdir":false,"mv":false,"popd":false,"pushd":false,"pwd":false,"rm":false,"sed":false,"set":false,"target":false,"tempdir":false,"test":false,"touch":false,"which":false},"prototypejs":{"$":false,"$$":false,"$A":false,"$break":false,"$continue":false,"$F":false,"$H":false,"$R":false,"$w":false,"Abstract":false,"Ajax":false,"Autocompleter":false,"Builder":false,"Class":false,"Control":false,"Draggable":false,"Draggables":false,"Droppables":false,"Effect":false,"Element":false,"Enumerable":false,"Event":false,"Field":false,"Form":false,"Hash":false,"Insertion":false,"ObjectRange":false,"PeriodicalExecuter":false,"Position":false,"Prototype":false,"Scriptaculous":false,"Selector":false,"Sortable":false,"SortableObserver":false,"Sound":false,"Template":false,"Toggle":false,"Try":false},"meteor":{"_":false,"$":false,"Accounts":false,"AccountsClient":false,"AccountsCommon":false,"AccountsServer":false,"App":false,"Assets":false,"Blaze":false,"check":false,"Cordova":false,"DDP":false,"DDPRateLimiter":false,"DDPServer":false,"Deps":false,"EJSON":false,"Email":false,"HTTP":false,"Log":false,"Match":false,"Meteor":false,"Mongo":false,"MongoInternals":false,"Npm":false,"Package":false,"Plugin":false,"process":false,"Random":false,"ReactiveDict":false,"ReactiveVar":false,"Router":false,"ServiceConfiguration":false,"Session":false,"share":false,"Spacebars":false,"Template":false,"Tinytest":false,"Tracker":false,"UI":false,"Utils":false,"WebApp":false,"WebAppInternals":false},"mongo":{"_isWindows":false,"_rand":false,"BulkWriteResult":false,"cat":false,"cd":false,"connect":false,"db":false,"getHostName":false,"getMemInfo":false,"hostname":false,"ISODate":false,"listFiles":false,"load":false,"ls":false,"md5sumFile":false,"mkdir":false,"Mongo":false,"NumberInt":false,"NumberLong":false,"ObjectId":false,"PlanCache":false,"print":false,"printjson":false,"pwd":false,"quit":false,"removeFile":false,"rs":false,"sh":false,"UUID":false,"version":false,"WriteResult":false},"applescript":{"$":false,"Application":false,"Automation":false,"console":false,"delay":false,"Library":false,"ObjC":false,"ObjectSpecifier":false,"Path":false,"Progress":false,"Ref":false},"serviceworker":{"addEventListener":false,"applicationCache":false,"atob":false,"Blob":false,"BroadcastChannel":false,"btoa":false,"Cache":false,"caches":false,"CacheStorage":false,"clearInterval":false,"clearTimeout":false,"Client":false,"clients":false,"Clients":false,"close":true,"console":false,"ExtendableEvent":false,"ExtendableMessageEvent":false,"fetch":false,"FetchEvent":false,"FileReaderSync":false,"FormData":false,"Headers":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"ImageData":false,"importScripts":false,"indexedDB":false,"location":false,"MessageChannel":false,"MessagePort":false,"name":false,"navigator":false,"Notification":false,"onclose":true,"onconnect":true,"onerror":true,"onfetch":true,"oninstall":true,"onlanguagechange":true,"onmessage":true,"onmessageerror":true,"onnotificationclick":true,"onnotificationclose":true,"onoffline":true,"ononline":true,"onpush":true,"onpushsubscriptionchange":true,"onrejectionhandled":true,"onsync":true,"onunhandledrejection":true,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"postMessage":true,"Promise":false,"queueMicrotask":false,"registration":false,"removeEventListener":false,"Request":false,"Response":false,"self":false,"ServiceWorker":false,"ServiceWorkerContainer":false,"ServiceWorkerGlobalScope":false,"ServiceWorkerMessageEvent":false,"ServiceWorkerRegistration":false,"setInterval":false,"setTimeout":false,"skipWaiting":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false,"WebSocket":false,"WindowClient":false,"Worker":false,"WorkerGlobalScope":false,"XMLHttpRequest":false},"atomtest":{"advanceClock":false,"fakeClearInterval":false,"fakeClearTimeout":false,"fakeSetInterval":false,"fakeSetTimeout":false,"resetTimeouts":false,"waitsForPromise":false},"embertest":{"andThen":false,"click":false,"currentPath":false,"currentRouteName":false,"currentURL":false,"fillIn":false,"find":false,"findAll":false,"findWithAssert":false,"keyEvent":false,"pauseTest":false,"resumeTest":false,"triggerEvent":false,"visit":false,"wait":false},"protractor":{"$":false,"$$":false,"browser":false,"by":false,"By":false,"DartObject":false,"element":false,"protractor":false},"shared-node-browser":{"clearInterval":false,"clearTimeout":false,"console":false,"setInterval":false,"setTimeout":false,"URL":false,"URLSearchParams":false},"webextensions":{"browser":false,"chrome":false,"opr":false},"greasemonkey":{"cloneInto":false,"createObjectIn":false,"exportFunction":false,"GM":false,"GM_addStyle":false,"GM_deleteValue":false,"GM_getResourceText":false,"GM_getResourceURL":false,"GM_getValue":false,"GM_info":false,"GM_listValues":false,"GM_log":false,"GM_openInTab":false,"GM_registerMenuCommand":false,"GM_setClipboard":false,"GM_setValue":false,"GM_xmlhttpRequest":false,"unsafeWindow":false},"devtools":{"$":false,"$_":false,"$$":false,"$0":false,"$1":false,"$2":false,"$3":false,"$4":false,"$x":false,"chrome":false,"clear":false,"copy":false,"debug":false,"dir":false,"dirxml":false,"getEventListeners":false,"inspect":false,"keys":false,"monitor":false,"monitorEvents":false,"profile":false,"profileEnd":false,"queryObjects":false,"table":false,"undebug":false,"unmonitor":false,"unmonitorEvents":false,"values":false}}')},4651:e=>{"use strict";e.exports=JSON.parse('{"assert":true,"assert/strict":">= 15","async_hooks":">= 8","buffer_ieee754":"< 0.9.7","buffer":true,"child_process":true,"cluster":true,"console":true,"constants":true,"crypto":true,"_debug_agent":">= 1 && < 8","_debugger":"< 8","dgram":true,"diagnostics_channel":">= 15.1","dns":true,"dns/promises":">= 15","domain":">= 0.7.12","events":true,"freelist":"< 6","fs":true,"fs/promises":[">= 10 && < 10.1",">= 14"],"_http_agent":">= 0.11.1","_http_client":">= 0.11.1","_http_common":">= 0.11.1","_http_incoming":">= 0.11.1","_http_outgoing":">= 0.11.1","_http_server":">= 0.11.1","http":true,"http2":">= 8.8","https":true,"inspector":">= 8.0.0","_linklist":"< 8","module":true,"net":true,"node-inspect/lib/_inspect":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6.0 && < 12","os":true,"path":true,"path/posix":">= 15.3","path/win32":">= 15.3","perf_hooks":">= 8.5","process":">= 1","punycode":true,"querystring":true,"readline":true,"repl":true,"smalloc":">= 0.11.5 && < 3","_stream_duplex":">= 0.9.4","_stream_transform":">= 0.9.4","_stream_wrap":">= 1.4.1","_stream_passthrough":">= 0.9.4","_stream_readable":">= 0.9.4","_stream_writable":">= 0.9.4","stream":true,"stream/promises":">= 15","string_decoder":true,"sys":[">= 0.6 && < 0.7",">= 0.8"],"timers":true,"timers/promises":">= 15","_tls_common":">= 0.11.13","_tls_legacy":">= 0.11.3 && < 10","_tls_wrap":">= 0.11.3","tls":true,"trace_events":">= 10","tty":true,"url":true,"util":true,"util/types":">= 15.3","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/consarray":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/csvparser":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/logreader":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/profile_view":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/splaytree":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8":">= 1","vm":true,"wasi":">= 13.4 && < 13.5","worker_threads":">= 11.7","zlib":true}')},4817:e=>{"use strict";e.exports=JSON.parse('{"es6.array.copy-within":{"chrome":"45","opera":"32","edge":"12","firefox":"32","safari":"9","node":"4","ios":"9","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.every":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.fill":{"chrome":"45","opera":"32","edge":"12","firefox":"31","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.filter":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.find":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.find-index":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es7.array.flat-map":{"chrome":"69","opera":"56","edge":"79","firefox":"62","safari":"12","node":"11","ios":"12","samsung":"10","electron":"4.0"},"es6.array.for-each":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.from":{"chrome":"51","opera":"38","edge":"15","firefox":"36","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.array.includes":{"chrome":"47","opera":"34","edge":"14","firefox":"43","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.array.index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.is-array":{"chrome":"5","opera":"10.50","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.iterator":{"chrome":"66","opera":"53","edge":"12","firefox":"60","safari":"9","node":"10","ios":"9","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es6.array.last-index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.map":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.of":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"9","node":"4","ios":"9","samsung":"5","rhino":"1.7.13","electron":"0.31"},"es6.array.reduce":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.reduce-right":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.slice":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.some":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.array.sort":{"chrome":"63","opera":"50","edge":"12","firefox":"5","safari":"12","node":"10","ie":"9","ios":"12","samsung":"8","rhino":"1.7.13","electron":"3.0"},"es6.array.species":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.date.now":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-iso-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-json":{"chrome":"5","opera":"12.10","edge":"12","firefox":"4","safari":"10","node":"0.10","ie":"9","android":"4","ios":"10","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.date.to-primitive":{"chrome":"47","opera":"34","edge":"15","firefox":"44","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.date.to-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.function.bind":{"chrome":"7","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.function.has-instance":{"chrome":"51","opera":"38","edge":"15","firefox":"50","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.function.name":{"chrome":"5","opera":"10.50","edge":"14","firefox":"2","safari":"4","node":"0.10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.math.acosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.asinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.atanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.cbrt":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.clz32":{"chrome":"38","opera":"25","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.cosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.expm1":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.fround":{"chrome":"38","opera":"25","edge":"12","firefox":"26","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.hypot":{"chrome":"38","opera":"25","edge":"12","firefox":"27","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.imul":{"chrome":"30","opera":"17","edge":"12","firefox":"23","safari":"7","node":"0.12","android":"4.4","ios":"7","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.math.log1p":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.log10":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.log2":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.sign":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.sinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.tanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.math.trunc":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.number.constructor":{"chrome":"41","opera":"28","edge":"12","firefox":"36","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.number.epsilon":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.is-finite":{"chrome":"19","opera":"15","edge":"12","firefox":"16","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.number.is-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"16","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.is-nan":{"chrome":"19","opera":"15","edge":"12","firefox":"15","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.number.is-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"32","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.max-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.min-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es6.number.parse-float":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.parse-int":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.object.assign":{"chrome":"49","opera":"36","edge":"13","firefox":"36","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.object.create":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.object.define-getter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.define-setter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.define-property":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.object.define-properties":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.object.entries":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.freeze":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.get-own-property-descriptor":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es7.object.get-own-property-descriptors":{"chrome":"54","opera":"41","edge":"15","firefox":"50","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.get-own-property-names":{"chrome":"40","opera":"27","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.object.get-prototype-of":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es7.object.lookup-getter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.lookup-setter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.prevent-extensions":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.to-string":{"chrome":"57","opera":"44","edge":"15","firefox":"51","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es6.object.is":{"chrome":"19","opera":"15","edge":"12","firefox":"22","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","rhino":"1.7.13","electron":"0.20"},"es6.object.is-frozen":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.is-sealed":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.is-extensible":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.keys":{"chrome":"40","opera":"27","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.object.seal":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","rhino":"1.7.13","electron":"0.30"},"es6.object.set-prototype-of":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ie":"11","ios":"9","samsung":"2","rhino":"1.7.13","electron":"0.20"},"es7.object.values":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.promise":{"chrome":"51","opera":"38","edge":"14","firefox":"45","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.promise.finally":{"chrome":"63","opera":"50","edge":"18","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"8","electron":"3.0"},"es6.reflect.apply":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.construct":{"chrome":"49","opera":"36","edge":"13","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.define-property":{"chrome":"49","opera":"36","edge":"13","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.delete-property":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-own-property-descriptor":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.has":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.is-extensible":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.own-keys":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.prevent-extensions":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.regexp.constructor":{"chrome":"50","opera":"37","edge":"79","firefox":"40","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.flags":{"chrome":"49","opera":"36","edge":"79","firefox":"37","safari":"9","node":"6","ios":"9","samsung":"5","electron":"0.37"},"es6.regexp.match":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"1.1"},"es6.regexp.replace":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.split":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.search":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"1.1"},"es6.regexp.to-string":{"chrome":"50","opera":"37","edge":"79","firefox":"39","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.symbol":{"chrome":"51","opera":"38","edge":"79","firefox":"51","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.symbol.async-iterator":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"es6.string.anchor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.big":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.blink":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.bold":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.code-point-at":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.ends-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.fixed":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontcolor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontsize":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.from-code-point":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.includes":{"chrome":"41","opera":"28","edge":"12","firefox":"40","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.italics":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.iterator":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"es6.string.link":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es7.string.pad-start":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","rhino":"1.7.13","electron":"1.7"},"es7.string.pad-end":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","rhino":"1.7.13","electron":"1.7"},"es6.string.raw":{"chrome":"41","opera":"28","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.repeat":{"chrome":"41","opera":"28","edge":"12","firefox":"24","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.small":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.starts-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","rhino":"1.7.13","electron":"0.21"},"es6.string.strike":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sub":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sup":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.trim":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es7.string.trim-left":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es7.string.trim-right":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","rhino":"1.7.13","electron":"3.0"},"es6.typed.array-buffer":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.data-view":{"chrome":"5","opera":"12","edge":"12","firefox":"15","safari":"5.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"es6.typed.int8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-clamped-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float64-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.weak-map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"},"es6.weak-set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"}}')},8392:e=>{"use strict";e.exports=JSON.parse('{"es6.module":{"chrome":"61","and_chr":"61","edge":"16","firefox":"60","and_ff":"60","node":"13.2.0","opera":"48","op_mob":"48","safari":"10.1","ios":"10.3","samsung":"8.2","android":"61","electron":"2.0","ios_saf":"10.3"}}')},5224:e=>{"use strict";e.exports=JSON.parse('{"transform-async-to-generator":["bugfix/transform-async-arrows-in-class"],"transform-parameters":["bugfix/transform-edge-default-parameters"],"transform-function-name":["bugfix/transform-edge-function-name"],"transform-block-scoping":["bugfix/transform-safari-block-shadowing","bugfix/transform-safari-for-shadowing"],"transform-template-literals":["bugfix/transform-tagged-template-caching"],"proposal-optional-chaining":["bugfix/transform-v8-spread-parameters-in-optional-chaining"]}')},4374:e=>{"use strict";e.exports=JSON.parse('{"transform-async-to-generator":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"10.1","node":"7.6","ios":"10.3","samsung":"6","electron":"1.6"},"bugfix/transform-async-arrows-in-class":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"11","node":"7.6","ios":"11","samsung":"6","electron":"1.6"},"transform-parameters":{"chrome":"49","opera":"36","edge":"15","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"bugfix/transform-edge-default-parameters":{"chrome":"49","opera":"36","edge":"18","firefox":"52","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"transform-function-name":{"chrome":"51","opera":"38","edge":"14","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"bugfix/transform-edge-function-name":{"chrome":"51","opera":"38","edge":"79","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-block-scoping":{"chrome":"49","opera":"36","edge":"14","firefox":"51","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"bugfix/transform-safari-block-shadowing":{"chrome":"49","opera":"36","edge":"12","firefox":"44","safari":"11","node":"6","ie":"11","ios":"11","samsung":"5","electron":"0.37"},"bugfix/transform-safari-for-shadowing":{"chrome":"49","opera":"36","edge":"12","firefox":"4","safari":"11","node":"6","ie":"11","ios":"11","samsung":"5","rhino":"1.7.13","electron":"0.37"},"transform-template-literals":{"chrome":"41","opera":"28","edge":"13","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"bugfix/transform-tagged-template-caching":{"chrome":"41","opera":"28","edge":"12","firefox":"34","safari":"13","node":"4","ios":"13","samsung":"3.4","electron":"0.21"},"proposal-optional-chaining":{"chrome":"80","opera":"67","edge":"80","firefox":"74","safari":"13.1","node":"14","ios":"13.4","samsung":"13","electron":"8.0"},"bugfix/transform-v8-spread-parameters-in-optional-chaining":{"firefox":"74","safari":"13.1","ios":"13.4"}}')},7867:e=>{"use strict";e.exports=JSON.parse('{"proposal-class-static-block":{"chrome":"91","electron":"13.0"},"proposal-private-property-in-object":{"chrome":"91","firefox":"90","electron":"13.0"},"proposal-class-properties":{"chrome":"74","opera":"62","edge":"79","firefox":"90","safari":"14.1","node":"12","samsung":"11","electron":"6.0"},"proposal-private-methods":{"chrome":"84","opera":"70","edge":"84","firefox":"90","safari":"15","node":"14.6","electron":"10.0"},"proposal-numeric-separator":{"chrome":"75","opera":"62","edge":"79","firefox":"70","safari":"13","node":"12.5","ios":"13","samsung":"11","electron":"6.0"},"proposal-logical-assignment-operators":{"chrome":"85","opera":"71","edge":"85","firefox":"79","safari":"14","node":"15","ios":"14","electron":"10.0"},"proposal-nullish-coalescing-operator":{"chrome":"80","opera":"67","edge":"80","firefox":"72","safari":"13.1","node":"14","ios":"13.4","samsung":"13","electron":"8.0"},"proposal-optional-chaining":{"firefox":"74","safari":"13.1","ios":"13.4"},"proposal-json-strings":{"chrome":"66","opera":"53","edge":"79","firefox":"62","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"proposal-optional-catch-binding":{"chrome":"66","opera":"53","edge":"79","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-parameters":{"chrome":"49","opera":"36","edge":"18","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"proposal-async-generator-functions":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"proposal-object-rest-spread":{"chrome":"60","opera":"47","edge":"79","firefox":"55","safari":"11.1","node":"8.3","ios":"11.3","samsung":"8","electron":"2.0"},"transform-dotall-regex":{"chrome":"62","opera":"49","edge":"79","firefox":"78","safari":"11.1","node":"8.10","ios":"11.3","samsung":"8","electron":"3.0"},"proposal-unicode-property-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-named-capturing-groups-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-async-to-generator":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"11","node":"7.6","ios":"11","samsung":"6","electron":"1.6"},"transform-exponentiation-operator":{"chrome":"52","opera":"39","edge":"14","firefox":"52","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.3"},"transform-template-literals":{"chrome":"41","opera":"28","edge":"13","firefox":"34","safari":"13","node":"4","ios":"13","samsung":"3.4","electron":"0.21"},"transform-literals":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-function-name":{"chrome":"51","opera":"38","edge":"79","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-arrow-functions":{"chrome":"47","opera":"34","edge":"13","firefox":"43","safari":"10","node":"6","ios":"10","samsung":"5","rhino":"1.7.13","electron":"0.36"},"transform-block-scoped-functions":{"chrome":"41","opera":"28","edge":"12","firefox":"46","safari":"10","node":"4","ie":"11","ios":"10","samsung":"3.4","electron":"0.21"},"transform-classes":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-object-super":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-shorthand-properties":{"chrome":"43","opera":"30","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.27"},"transform-duplicate-keys":{"chrome":"42","opera":"29","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.25"},"transform-computed-properties":{"chrome":"44","opera":"31","edge":"12","firefox":"34","safari":"7.1","node":"4","ios":"8","samsung":"4","electron":"0.30"},"transform-for-of":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-sticky-regex":{"chrome":"49","opera":"36","edge":"13","firefox":"3","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"transform-unicode-escapes":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-unicode-regex":{"chrome":"50","opera":"37","edge":"13","firefox":"46","safari":"12","node":"6","ios":"12","samsung":"5","electron":"1.1"},"transform-spread":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-destructuring":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-block-scoping":{"chrome":"49","opera":"36","edge":"14","firefox":"51","safari":"11","node":"6","ios":"11","samsung":"5","electron":"0.37"},"transform-typeof-symbol":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","rhino":"1.7.13","electron":"0.20"},"transform-new-target":{"chrome":"46","opera":"33","edge":"14","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-regenerator":{"chrome":"50","opera":"37","edge":"13","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"transform-member-expression-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"transform-property-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"transform-reserved-words":{"chrome":"13","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4.4","ios":"6","phantom":"2","samsung":"1","rhino":"1.7.13","electron":"0.20"},"proposal-export-namespace-from":{"chrome":"72","and_chr":"72","edge":"79","firefox":"80","and_ff":"80","node":"13.2","opera":"60","op_mob":"51","samsung":"11.0","android":"72","electron":"5.0"}}')},516:e=>{"use strict";e.exports=JSON.parse('{"es6.array.copy-within":{"chrome":"45","opera":"32","edge":"12","firefox":"32","safari":"9","node":"4","ios":"9","samsung":"5","electron":"0.31"},"es6.array.every":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.fill":{"chrome":"45","opera":"32","edge":"12","firefox":"31","safari":"7.1","node":"4","ios":"8","samsung":"5","electron":"0.31"},"es6.array.filter":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.find":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","electron":"0.31"},"es6.array.find-index":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"7.1","node":"4","ios":"8","samsung":"5","electron":"0.31"},"es7.array.flat-map":{"chrome":"69","opera":"56","edge":"79","firefox":"62","safari":"12","node":"11","ios":"12","samsung":"10","electron":"4.0"},"es6.array.for-each":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.from":{"chrome":"51","opera":"38","edge":"15","firefox":"36","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.array.includes":{"chrome":"47","opera":"34","edge":"14","firefox":"43","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.array.index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.is-array":{"chrome":"5","opera":"10.50","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.iterator":{"chrome":"66","opera":"53","edge":"12","firefox":"60","safari":"9","node":"10","ios":"9","samsung":"9","electron":"3.0"},"es6.array.last-index-of":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.map":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.of":{"chrome":"45","opera":"32","edge":"12","firefox":"25","safari":"9","node":"4","ios":"9","samsung":"5","electron":"0.31"},"es6.array.reduce":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.reduce-right":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.slice":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.array.some":{"chrome":"5","opera":"10.10","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.array.sort":{"chrome":"63","opera":"50","edge":"12","firefox":"5","safari":"12","node":"10","ie":"9","ios":"12","samsung":"8","electron":"3.0"},"es6.array.species":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.date.now":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.date.to-iso-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.date.to-json":{"chrome":"5","opera":"12.10","edge":"12","firefox":"4","safari":"10","node":"0.10","ie":"9","android":"4","ios":"10","samsung":"1","electron":"0.20"},"es6.date.to-primitive":{"chrome":"47","opera":"34","edge":"15","firefox":"44","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"es6.date.to-string":{"chrome":"5","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.function.bind":{"chrome":"7","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.function.has-instance":{"chrome":"51","opera":"38","edge":"15","firefox":"50","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.function.name":{"chrome":"5","opera":"10.50","edge":"14","firefox":"2","safari":"4","node":"0.10","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.math.acosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.asinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.atanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.cbrt":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.clz32":{"chrome":"38","opera":"25","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"es6.math.cosh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.expm1":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.fround":{"chrome":"38","opera":"25","edge":"12","firefox":"26","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.hypot":{"chrome":"38","opera":"25","edge":"12","firefox":"27","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.imul":{"chrome":"30","opera":"17","edge":"12","firefox":"23","safari":"7","node":"0.12","android":"4.4","ios":"7","samsung":"2","electron":"0.20"},"es6.math.log1p":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.log10":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.log2":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.sign":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"es6.math.sinh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.tanh":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.math.trunc":{"chrome":"38","opera":"25","edge":"12","firefox":"25","safari":"7.1","node":"0.12","ios":"8","samsung":"3","electron":"0.20"},"es6.number.constructor":{"chrome":"41","opera":"28","edge":"12","firefox":"36","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.number.epsilon":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.is-finite":{"chrome":"19","opera":"15","edge":"12","firefox":"16","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","electron":"0.20"},"es6.number.is-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"16","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.is-nan":{"chrome":"19","opera":"15","edge":"12","firefox":"15","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","electron":"0.20"},"es6.number.is-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"32","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.max-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.min-safe-integer":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.parse-float":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.number.parse-int":{"chrome":"34","opera":"21","edge":"12","firefox":"25","safari":"9","node":"0.12","ios":"9","samsung":"2","electron":"0.20"},"es6.object.assign":{"chrome":"49","opera":"36","edge":"13","firefox":"36","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.object.create":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es7.object.define-getter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.define-setter":{"chrome":"62","opera":"49","edge":"16","firefox":"48","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.define-property":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.object.define-properties":{"chrome":"5","opera":"12","edge":"12","firefox":"4","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es7.object.entries":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.freeze":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.get-own-property-descriptor":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es7.object.get-own-property-descriptors":{"chrome":"54","opera":"41","edge":"15","firefox":"50","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.object.get-own-property-names":{"chrome":"40","opera":"27","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.object.get-prototype-of":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es7.object.lookup-getter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es7.object.lookup-setter":{"chrome":"62","opera":"49","edge":"79","firefox":"36","safari":"9","node":"8.10","ios":"9","samsung":"8","electron":"3.0"},"es6.object.prevent-extensions":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.to-string":{"chrome":"57","opera":"44","edge":"15","firefox":"51","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es6.object.is":{"chrome":"19","opera":"15","edge":"12","firefox":"22","safari":"9","node":"0.12","android":"4.1","ios":"9","samsung":"1.5","electron":"0.20"},"es6.object.is-frozen":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.is-sealed":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.is-extensible":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.keys":{"chrome":"40","opera":"27","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.object.seal":{"chrome":"44","opera":"31","edge":"12","firefox":"35","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"es6.object.set-prototype-of":{"chrome":"34","opera":"21","edge":"12","firefox":"31","safari":"9","node":"0.12","ie":"11","ios":"9","samsung":"2","electron":"0.20"},"es7.object.values":{"chrome":"54","opera":"41","edge":"14","firefox":"47","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.4"},"es6.promise":{"chrome":"51","opera":"38","edge":"14","firefox":"45","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.promise.finally":{"chrome":"63","opera":"50","edge":"18","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"8","electron":"3.0"},"es6.reflect.apply":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.construct":{"chrome":"49","opera":"36","edge":"13","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.define-property":{"chrome":"49","opera":"36","edge":"13","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.delete-property":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-own-property-descriptor":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.get-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.has":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.is-extensible":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.own-keys":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.prevent-extensions":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.reflect.set-prototype-of":{"chrome":"49","opera":"36","edge":"12","firefox":"42","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"es6.regexp.constructor":{"chrome":"50","opera":"37","edge":"79","firefox":"40","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.flags":{"chrome":"49","opera":"36","edge":"79","firefox":"37","safari":"9","node":"6","ios":"9","samsung":"5","electron":"0.37"},"es6.regexp.match":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.replace":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.split":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.search":{"chrome":"50","opera":"37","edge":"79","firefox":"49","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.regexp.to-string":{"chrome":"50","opera":"37","edge":"79","firefox":"39","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"es6.set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.symbol":{"chrome":"51","opera":"38","edge":"79","firefox":"51","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es7.symbol.async-iterator":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"es6.string.anchor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.big":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.blink":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.bold":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.code-point-at":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.ends-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.fixed":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontcolor":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.fontsize":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.from-code-point":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.includes":{"chrome":"41","opera":"28","edge":"12","firefox":"40","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.italics":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.iterator":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"es6.string.link":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es7.string.pad-start":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es7.string.pad-end":{"chrome":"57","opera":"44","edge":"15","firefox":"48","safari":"10","node":"8","ios":"10","samsung":"7","electron":"1.7"},"es6.string.raw":{"chrome":"41","opera":"28","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.repeat":{"chrome":"41","opera":"28","edge":"12","firefox":"24","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.small":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.starts-with":{"chrome":"41","opera":"28","edge":"12","firefox":"29","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.21"},"es6.string.strike":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sub":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.sup":{"chrome":"5","opera":"15","edge":"12","firefox":"17","safari":"6","node":"0.10","android":"4","ios":"7","phantom":"2","samsung":"1","electron":"0.20"},"es6.string.trim":{"chrome":"5","opera":"10.50","edge":"12","firefox":"3.5","safari":"4","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es7.string.trim-left":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"es7.string.trim-right":{"chrome":"66","opera":"53","edge":"79","firefox":"61","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"es6.typed.array-buffer":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.data-view":{"chrome":"5","opera":"12","edge":"12","firefox":"15","safari":"5.1","node":"0.10","ie":"10","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"es6.typed.int8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint8-clamped-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint16-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.int32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.uint32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float32-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.typed.float64-array":{"chrome":"51","opera":"38","edge":"13","firefox":"48","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"es6.weak-map":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"},"es6.weak-set":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"9","node":"6.5","ios":"9","samsung":"5","electron":"1.2"}}')},5246:e=>{"use strict";e.exports=JSON.parse('{"es6.module":{"chrome":"61","and_chr":"61","edge":"16","firefox":"60","and_ff":"60","node":"13.2.0","opera":"48","op_mob":"48","safari":"10.1","ios":"10.3","samsung":"8.2","android":"61","electron":"2.0","ios_saf":"10.3"}}')},4812:e=>{"use strict";e.exports=JSON.parse('{"proposal-class-static-block":{"chrome":"91","electron":"13.0"},"proposal-private-property-in-object":{"chrome":"91","firefox":"90","electron":"13.0"},"proposal-class-properties":{"chrome":"74","opera":"62","edge":"79","firefox":"90","safari":"14.1","node":"12","samsung":"11","electron":"6.0"},"proposal-private-methods":{"chrome":"84","opera":"70","edge":"84","firefox":"90","safari":"15","node":"14.6","electron":"10.0"},"proposal-numeric-separator":{"chrome":"75","opera":"62","edge":"79","firefox":"70","safari":"13","node":"12.5","ios":"13","samsung":"11","electron":"6.0"},"proposal-logical-assignment-operators":{"chrome":"85","opera":"71","edge":"85","firefox":"79","safari":"14","node":"15","ios":"14","electron":"10.0"},"proposal-nullish-coalescing-operator":{"chrome":"80","opera":"67","edge":"80","firefox":"72","safari":"13.1","node":"14","ios":"13.4","samsung":"13","electron":"8.0"},"proposal-optional-chaining":{"firefox":"74","safari":"13.1","ios":"13.4"},"proposal-json-strings":{"chrome":"66","opera":"53","edge":"79","firefox":"62","safari":"12","node":"10","ios":"12","samsung":"9","electron":"3.0"},"proposal-optional-catch-binding":{"chrome":"66","opera":"53","edge":"79","firefox":"58","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-parameters":{"chrome":"49","opera":"36","edge":"18","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"proposal-async-generator-functions":{"chrome":"63","opera":"50","edge":"79","firefox":"57","safari":"12","node":"10","ios":"12","samsung":"8","electron":"3.0"},"proposal-object-rest-spread":{"chrome":"60","opera":"47","edge":"79","firefox":"55","safari":"11.1","node":"8.3","ios":"11.3","samsung":"8","electron":"2.0"},"transform-dotall-regex":{"chrome":"62","opera":"49","edge":"79","firefox":"78","safari":"11.1","node":"8.10","ios":"11.3","samsung":"8","electron":"3.0"},"proposal-unicode-property-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-named-capturing-groups-regex":{"chrome":"64","opera":"51","edge":"79","firefox":"78","safari":"11.1","node":"10","ios":"11.3","samsung":"9","electron":"3.0"},"transform-async-to-generator":{"chrome":"55","opera":"42","edge":"15","firefox":"52","safari":"11","node":"7.6","ios":"11","samsung":"6","electron":"1.6"},"transform-exponentiation-operator":{"chrome":"52","opera":"39","edge":"14","firefox":"52","safari":"10.1","node":"7","ios":"10.3","samsung":"6","electron":"1.3"},"transform-template-literals":{"chrome":"41","opera":"28","edge":"13","firefox":"34","safari":"13","node":"4","ios":"13","samsung":"3.4","electron":"0.21"},"transform-literals":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-function-name":{"chrome":"51","opera":"38","edge":"79","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-arrow-functions":{"chrome":"47","opera":"34","edge":"13","firefox":"45","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.36"},"transform-block-scoped-functions":{"chrome":"41","opera":"28","edge":"12","firefox":"46","safari":"10","node":"4","ie":"11","ios":"10","samsung":"3.4","electron":"0.21"},"transform-classes":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-object-super":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-shorthand-properties":{"chrome":"43","opera":"30","edge":"12","firefox":"33","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.27"},"transform-duplicate-keys":{"chrome":"42","opera":"29","edge":"12","firefox":"34","safari":"9","node":"4","ios":"9","samsung":"3.4","electron":"0.25"},"transform-computed-properties":{"chrome":"44","opera":"31","edge":"12","firefox":"34","safari":"7.1","node":"4","ios":"8","samsung":"4","electron":"0.30"},"transform-for-of":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-sticky-regex":{"chrome":"49","opera":"36","edge":"13","firefox":"3","safari":"10","node":"6","ios":"10","samsung":"5","electron":"0.37"},"transform-unicode-escapes":{"chrome":"44","opera":"31","edge":"12","firefox":"53","safari":"9","node":"4","ios":"9","samsung":"4","electron":"0.30"},"transform-unicode-regex":{"chrome":"50","opera":"37","edge":"13","firefox":"46","safari":"12","node":"6","ios":"12","samsung":"5","electron":"1.1"},"transform-spread":{"chrome":"46","opera":"33","edge":"13","firefox":"45","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-destructuring":{"chrome":"51","opera":"38","edge":"15","firefox":"53","safari":"10","node":"6.5","ios":"10","samsung":"5","electron":"1.2"},"transform-block-scoping":{"chrome":"49","opera":"36","edge":"14","firefox":"51","safari":"11","node":"6","ios":"11","samsung":"5","electron":"0.37"},"transform-typeof-symbol":{"chrome":"38","opera":"25","edge":"12","firefox":"36","safari":"9","node":"0.12","ios":"9","samsung":"3","electron":"0.20"},"transform-new-target":{"chrome":"46","opera":"33","edge":"14","firefox":"41","safari":"10","node":"5","ios":"10","samsung":"5","electron":"0.36"},"transform-regenerator":{"chrome":"50","opera":"37","edge":"13","firefox":"53","safari":"10","node":"6","ios":"10","samsung":"5","electron":"1.1"},"transform-member-expression-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"transform-property-literals":{"chrome":"7","opera":"12","edge":"12","firefox":"2","safari":"5.1","node":"0.10","ie":"9","android":"4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"transform-reserved-words":{"chrome":"13","opera":"10.50","edge":"12","firefox":"2","safari":"3.1","node":"0.10","ie":"9","android":"4.4","ios":"6","phantom":"2","samsung":"1","electron":"0.20"},"proposal-export-namespace-from":{"chrome":"72","and_chr":"72","edge":"79","firefox":"80","and_ff":"80","node":"13.2","opera":"60","op_mob":"51","samsung":"11.0","android":"72","electron":"5.0"}}')},935:e=>{"use strict";e.exports=JSON.parse('{"es.symbol":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.symbol.description":{"android":"70","chrome":"70","edge":"74","electron":"5.0","firefox":"63","ios":"12.2","node":"11.0","opera":"57","opera_mobile":"49","safari":"12.1","samsung":"10.0"},"es.symbol.async-iterator":{"android":"63","chrome":"63","edge":"74","electron":"3.0","firefox":"55","ios":"12.0","node":"10.0","opera":"50","opera_mobile":"46","safari":"12.0","samsung":"8.0"},"es.symbol.has-instance":{"android":"50","chrome":"50","edge":"15","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.is-concat-spreadable":{"android":"48","chrome":"48","edge":"15","electron":"0.37","firefox":"48","ios":"10.0","node":"6.0","opera":"35","opera_mobile":"35","safari":"10.0","samsung":"5.0"},"es.symbol.iterator":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"36","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.symbol.match":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"40","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.match-all":{"android":"73","chrome":"73","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.symbol.replace":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.search":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.species":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"41","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.symbol.split":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.symbol.to-primitive":{"android":"47","chrome":"47","edge":"15","electron":"0.36","firefox":"44","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.symbol.to-string-tag":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.symbol.unscopables":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"48","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.aggregate-error":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"es.array.concat":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.copy-within":{"android":"45","chrome":"45","edge":"12","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.every":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"9.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"8.0","samsung":"1.5"},"es.array.fill":{"android":"45","chrome":"45","edge":"12","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.filter":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.find":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.find-index":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.flat":{"android":"69","chrome":"69","edge":"74","electron":"4.0","firefox":"62","ios":"12.0","node":"11.0","opera":"56","opera_mobile":"48","safari":"12.0","samsung":"10.0"},"es.array.flat-map":{"android":"69","chrome":"69","edge":"74","electron":"4.0","firefox":"62","ios":"12.0","node":"11.0","opera":"56","opera_mobile":"48","safari":"12.0","samsung":"10.0"},"es.array.for-each":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"9.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"8.0","samsung":"1.5"},"es.array.from":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"9.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"9.0","samsung":"5.0"},"es.array.includes":{"android":"53","chrome":"53","edge":"14","electron":"1.4","firefox":"48","ios":"10.0","node":"7.0","opera":"40","opera_mobile":"40","safari":"10.0","samsung":"6.0"},"es.array.index-of":{"android":"51","chrome":"51","edge":"12","electron":"1.2","firefox":"4","ie":"9","ios":"9.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"8.0","samsung":"5.0"},"es.array.is-array":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"4.0","samsung":"1.0"},"es.array.iterator":{"android":"66","chrome":"66","edge":"15","electron":"3.0","firefox":"60","ios":"10.0","node":"10.0","opera":"53","opera_mobile":"47","safari":"10.0","samsung":"9.0"},"es.array.join":{"android":"4.4","chrome":"26","edge":"13","electron":"0.20","firefox":"4","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.array.last-index-of":{"android":"51","chrome":"51","edge":"12","electron":"1.2","firefox":"4","ie":"9","ios":"9.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"8.0","samsung":"5.0"},"es.array.map":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"50","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.of":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"25","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.reduce":{"android":"83","chrome":"83","edge":"12","electron":"9.0","firefox":"4","ie":"9","ios":"9.0","node":"6.0","opera":"69","opera_mobile":"59","safari":"8.0","samsung":"13.0"},"es.array.reduce-right":{"android":"83","chrome":"83","edge":"12","electron":"9.0","firefox":"4","ie":"9","ios":"9.0","node":"6.0","opera":"69","opera_mobile":"59","safari":"8.0","samsung":"13.0"},"es.array.reverse":{"android":"3.0","chrome":"1","edge":"12","electron":"0.20","firefox":"1","ie":"5.5","ios":"12.2","node":"0.0.3","opera":"10.50","opera_mobile":"10.50","safari":"12.0.2","samsung":"1.0"},"es.array.slice":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.some":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"9.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"8.0","samsung":"1.5"},"es.array.sort":{"android":"70","chrome":"70","edge":"74","electron":"5.0","firefox":"4","ios":"12.0","node":"11.0","opera":"57","opera_mobile":"49","safari":"12.0","samsung":"10.0"},"es.array.species":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.splice":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.unscopables.flat":{"android":"73","chrome":"73","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.array.unscopables.flat-map":{"android":"73","chrome":"73","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.array-buffer.constructor":{"android":"4.4","chrome":"26","edge":"14","electron":"0.20","firefox":"44","ios":"12.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"12.0","samsung":"1.5"},"es.array-buffer.is-view":{"android":"4.4.3","chrome":"32","edge":"12","electron":"0.20","firefox":"29","ie":"11","ios":"8.0","node":"0.11.9","opera":"19","opera_mobile":"19","safari":"7.1","samsung":"2.0"},"es.array-buffer.slice":{"android":"4.4.3","chrome":"31","edge":"12","electron":"0.20","firefox":"46","ie":"11","ios":"12.2","node":"0.11.8","opera":"18","opera_mobile":"18","safari":"12.1","samsung":"2.0"},"es.data-view":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"15","ie":"10","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.date.now":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ie":"9","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"4.0","samsung":"1.0"},"es.date.to-iso-string":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"7","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.date.to-json":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"10.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"10.0","samsung":"1.5"},"es.date.to-primitive":{"android":"47","chrome":"47","edge":"15","electron":"0.36","firefox":"44","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.date.to-string":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ie":"9","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.function.bind":{"android":"3.0","chrome":"7","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.101","opera":"12","opera_mobile":"12","phantom":"2.0","safari":"5.1","samsung":"1.0"},"es.function.has-instance":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"50","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.function.name":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"4.0","samsung":"1.0"},"es.global-this":{"android":"71","chrome":"71","edge":"74","electron":"5.0","firefox":"65","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"es.json.stringify":{"android":"72","chrome":"72","edge":"74","electron":"5.0","firefox":"64","ios":"12.2","node":"12.0","opera":"59","opera_mobile":"51","safari":"12.1","samsung":"11.0"},"es.json.to-string-tag":{"android":"50","chrome":"50","edge":"15","electron":"1.1","firefox":"51","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.map":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.math.acosh":{"android":"54","chrome":"54","edge":"13","electron":"1.4","firefox":"25","ios":"8.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"7.1","samsung":"6.0"},"es.math.asinh":{"android":"38","chrome":"38","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.atanh":{"android":"38","chrome":"38","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.cbrt":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.clz32":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"9.0","samsung":"3.0"},"es.math.cosh":{"android":"39","chrome":"39","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","safari":"7.1","samsung":"3.4"},"es.math.expm1":{"android":"39","chrome":"39","edge":"13","electron":"0.20","firefox":"46","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","safari":"7.1","samsung":"3.4"},"es.math.fround":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"26","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.hypot":{"android":"78","chrome":"78","edge":"12","electron":"7.0","firefox":"27","ios":"8.0","node":"13.0","opera":"65","opera_mobile":"56","safari":"7.1","samsung":"12.0"},"es.math.imul":{"android":"4.4","chrome":"28","edge":"13","electron":"0.20","firefox":"20","ios":"9.0","node":"0.11.1","opera":"16","opera_mobile":"16","safari":"9.0","samsung":"1.5"},"es.math.log10":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.log1p":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.log2":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.sign":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"9.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"9.0","samsung":"3.0"},"es.math.sinh":{"android":"39","chrome":"39","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","safari":"7.1","samsung":"3.4"},"es.math.tanh":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.math.to-string-tag":{"android":"50","chrome":"50","edge":"15","electron":"1.1","firefox":"51","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.math.trunc":{"android":"38","chrome":"38","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","safari":"7.1","samsung":"3.0"},"es.number.constructor":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"46","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.number.epsilon":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"25","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.is-finite":{"android":"4.1","chrome":"19","edge":"12","electron":"0.20","firefox":"16","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","safari":"9.0","samsung":"1.5"},"es.number.is-integer":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"16","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.is-nan":{"android":"4.1","chrome":"19","edge":"12","electron":"0.20","firefox":"15","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","safari":"9.0","samsung":"1.5"},"es.number.is-safe-integer":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"32","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.max-safe-integer":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.min-safe-integer":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.parse-float":{"android":"37","chrome":"35","edge":"13","electron":"0.20","firefox":"39","ios":"11.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"11.0","samsung":"3.0"},"es.number.parse-int":{"android":"37","chrome":"35","edge":"13","electron":"0.20","firefox":"39","ios":"9.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"9.0","samsung":"3.0"},"es.number.to-fixed":{"android":"4.4","chrome":"26","edge":"74","electron":"0.20","firefox":"4","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.number.to-precision":{"android":"4.4","chrome":"26","edge":"12","electron":"0.20","firefox":"4","ie":"8","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.object.assign":{"android":"49","chrome":"49","edge":"74","electron":"0.37","firefox":"36","ios":"9.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"9.0","samsung":"5.0"},"es.object.create":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"3.2","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"1.9","safari":"4.0","samsung":"1.0"},"es.object.define-getter":{"android":"62","chrome":"62","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","safari":"7.1","samsung":"8.0"},"es.object.define-properties":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"2.0","safari":"5.1","samsung":"1.0"},"es.object.define-property":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"2.0","safari":"5.1","samsung":"1.0"},"es.object.define-setter":{"android":"62","chrome":"62","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","safari":"7.1","samsung":"8.0"},"es.object.entries":{"android":"54","chrome":"54","edge":"14","electron":"1.4","firefox":"47","ios":"10.3","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.1","samsung":"6.0"},"es.object.freeze":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.from-entries":{"android":"73","chrome":"73","edge":"74","electron":"5.0","firefox":"63","ios":"12.2","node":"12.0","opera":"60","opera_mobile":"52","safari":"12.1","samsung":"11.0"},"es.object.get-own-property-descriptor":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.get-own-property-descriptors":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"50","ios":"10.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.0","samsung":"6.0"},"es.object.get-own-property-names":{"android":"40","chrome":"40","edge":"13","electron":"0.21","firefox":"34","ios":"9.0","node":"1.0","opera":"27","opera_mobile":"27","safari":"9.0","samsung":"3.4"},"es.object.get-prototype-of":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.is":{"android":"4.1","chrome":"19","edge":"12","electron":"0.20","firefox":"22","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","safari":"9.0","samsung":"1.5"},"es.object.is-extensible":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.is-frozen":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.is-sealed":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.keys":{"android":"40","chrome":"40","edge":"13","electron":"0.21","firefox":"35","ios":"9.0","node":"1.0","opera":"27","opera_mobile":"27","safari":"9.0","samsung":"3.4"},"es.object.lookup-getter":{"android":"62","chrome":"62","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","safari":"7.1","samsung":"8.0"},"es.object.lookup-setter":{"android":"62","chrome":"62","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","safari":"7.1","samsung":"8.0"},"es.object.prevent-extensions":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.seal":{"android":"44","chrome":"44","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","safari":"9.0","samsung":"4.0"},"es.object.set-prototype-of":{"android":"37","chrome":"34","edge":"12","electron":"0.20","firefox":"31","ie":"11","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.object.to-string":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.object.values":{"android":"54","chrome":"54","edge":"14","electron":"1.4","firefox":"47","ios":"10.3","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.1","samsung":"6.0"},"es.parse-float":{"android":"37","chrome":"35","edge":"12","electron":"0.20","firefox":"8","ie":"8","ios":"8.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"7.1","samsung":"3.0"},"es.parse-int":{"android":"37","chrome":"35","edge":"12","electron":"0.20","firefox":"21","ie":"9","ios":"8.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"7.1","samsung":"3.0"},"es.promise":{"android":"67","chrome":"67","edge":"74","electron":"4.0","firefox":"69","ios":"11.0","node":"10.4","opera":"54","opera_mobile":"48","safari":"11.0","samsung":"9.0"},"es.promise.all-settled":{"android":"76","chrome":"76","edge":"76","electron":"6.0","firefox":"71","ios":"13.0","node":"12.9","opera":"63","opera_mobile":"54","safari":"13","samsung":"12.0"},"es.promise.any":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"es.promise.finally":{"android":"67","chrome":"67","edge":"74","electron":"4.0","firefox":"69","ios":"13.2.3","node":"10.4","opera":"54","opera_mobile":"48","safari":"13.0.3","samsung":"9.0"},"es.reflect.apply":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.construct":{"android":"49","chrome":"49","edge":"15","electron":"0.37","firefox":"44","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.define-property":{"android":"49","chrome":"49","edge":"13","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.delete-property":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get-own-property-descriptor":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get-prototype-of":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.has":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.is-extensible":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.own-keys":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.prevent-extensions":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.set":{"android":"49","chrome":"49","edge":"74","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.set-prototype-of":{"android":"49","chrome":"49","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.to-string-tag":{"android":"86","chrome":"86","edge":"86","electron":"11.0","firefox":"82","ios":"14.0","node":"15.0","opera":"72","opera_mobile":"61","safari":"14.0","samsung":"14.0"},"es.regexp.constructor":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.regexp.exec":{"android":"4.4","chrome":"26","edge":"13","electron":"0.20","firefox":"44","ios":"10.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"10.0","samsung":"1.5"},"es.regexp.flags":{"android":"49","chrome":"49","edge":"74","electron":"0.37","firefox":"37","ios":"9.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"9.0","samsung":"5.0"},"es.regexp.sticky":{"android":"49","chrome":"49","edge":"13","electron":"0.37","firefox":"3","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.regexp.test":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"46","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.regexp.to-string":{"android":"50","chrome":"50","edge":"74","electron":"1.1","firefox":"46","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.set":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.code-point-at":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"29","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.ends-with":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.from-code-point":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"29","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.includes":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.iterator":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"36","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.match":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.match-all":{"android":"80","chrome":"80","edge":"80","electron":"8.0","firefox":"73","ios":"13.4","node":"14.0","opera":"67","opera_mobile":"57","safari":"13.1","samsung":"13.0"},"es.string.pad-end":{"android":"57","chrome":"57","edge":"15","electron":"1.7","firefox":"48","ios":"11.0","node":"8.0","opera":"44","opera_mobile":"43","safari":"11.0","samsung":"7.0"},"es.string.pad-start":{"android":"57","chrome":"57","edge":"15","electron":"1.7","firefox":"48","ios":"11.0","node":"8.0","opera":"44","opera_mobile":"43","safari":"11.0","samsung":"7.0"},"es.string.raw":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"34","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.repeat":{"android":"41","chrome":"41","edge":"13","electron":"0.21","firefox":"24","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.replace":{"android":"64","chrome":"64","edge":"74","electron":"3.0","firefox":"78","ios":"14.0","node":"10.0","opera":"51","opera_mobile":"47","safari":"14.0","samsung":"9.0"},"es.string.replace-all":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"77","ios":"13.4","node":"15.0","opera":"71","opera_mobile":"60","safari":"13.1","samsung":"14.0"},"es.string.search":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.split":{"android":"54","chrome":"54","edge":"74","electron":"1.4","firefox":"49","ios":"10.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.0","samsung":"6.0"},"es.string.starts-with":{"android":"51","chrome":"51","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.trim":{"android":"59","chrome":"59","edge":"15","electron":"1.8","firefox":"52","ios":"12.2","node":"8.3","opera":"46","opera_mobile":"43","safari":"12.1","samsung":"7.0"},"es.string.trim-end":{"android":"66","chrome":"66","edge":"74","electron":"3.0","firefox":"61","ios":"12.2","node":"10.0","opera":"53","opera_mobile":"47","safari":"12.1","samsung":"9.0"},"es.string.trim-start":{"android":"66","chrome":"66","edge":"74","electron":"3.0","firefox":"61","ios":"12.0","node":"10.0","opera":"53","opera_mobile":"47","safari":"12.0","samsung":"9.0"},"es.string.anchor":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.big":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.blink":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.bold":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.fixed":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.fontcolor":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.fontsize":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.italics":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.link":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.small":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.strike":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.sub":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.string.sup":{"android":"3.0","chrome":"5","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","safari":"3.1","samsung":"1.0"},"es.typed-array.float32-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.float64-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int8-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int16-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int32-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint8-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint8-clamped-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint16-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint32-array":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.copy-within":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"34","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.every":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.fill":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.filter":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.find":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.find-index":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.for-each":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.from":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.includes":{"android":"49","chrome":"49","edge":"14","electron":"0.37","firefox":"43","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.typed-array.index-of":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.iterator":{"android":"47","chrome":"47","edge":"13","electron":"0.36","firefox":"37","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.typed-array.join":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.last-index-of":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.map":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.of":{"android":"54","chrome":"54","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.reduce":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.reduce-right":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.reverse":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.set":{"android":"4.4","chrome":"26","edge":"13","electron":"0.20","firefox":"15","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.typed-array.slice":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.some":{"android":"45","chrome":"45","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.sort":{"android":"74","chrome":"74","edge":"74","electron":"6.0","firefox":"67","ios":"14.5","node":"12.0","opera":"61","opera_mobile":"53","safari":"14.1","samsung":"11.0"},"es.typed-array.subarray":{"android":"4.4","chrome":"26","edge":"13","electron":"0.20","firefox":"15","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.typed-array.to-locale-string":{"android":"45","chrome":"45","edge":"74","electron":"0.31","firefox":"51","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.to-string":{"android":"51","chrome":"51","edge":"13","electron":"1.2","firefox":"51","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.weak-map":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.weak-set":{"android":"51","chrome":"51","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"esnext.aggregate-error":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"esnext.array.at":{"android":"92","chrome":"92","edge":"92","electron":"14.0","opera":"78"},"esnext.array.filter-out":{},"esnext.array.find-last":{},"esnext.array.find-last-index":{},"esnext.array.is-template-object":{},"esnext.array.last-index":{},"esnext.array.last-item":{},"esnext.array.unique-by":{},"esnext.async-iterator.constructor":{},"esnext.async-iterator.as-indexed-pairs":{},"esnext.async-iterator.drop":{},"esnext.async-iterator.every":{},"esnext.async-iterator.filter":{},"esnext.async-iterator.find":{},"esnext.async-iterator.flat-map":{},"esnext.async-iterator.for-each":{},"esnext.async-iterator.from":{},"esnext.async-iterator.map":{},"esnext.async-iterator.reduce":{},"esnext.async-iterator.some":{},"esnext.async-iterator.take":{},"esnext.async-iterator.to-array":{},"esnext.bigint.range":{},"esnext.composite-key":{},"esnext.composite-symbol":{},"esnext.global-this":{"android":"71","chrome":"71","edge":"74","electron":"5.0","firefox":"65","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"esnext.iterator.constructor":{},"esnext.iterator.as-indexed-pairs":{},"esnext.iterator.drop":{},"esnext.iterator.every":{},"esnext.iterator.filter":{},"esnext.iterator.find":{},"esnext.iterator.flat-map":{},"esnext.iterator.for-each":{},"esnext.iterator.from":{},"esnext.iterator.map":{},"esnext.iterator.reduce":{},"esnext.iterator.some":{},"esnext.iterator.take":{},"esnext.iterator.to-array":{},"esnext.map.delete-all":{},"esnext.map.emplace":{},"esnext.map.every":{},"esnext.map.filter":{},"esnext.map.find":{},"esnext.map.find-key":{},"esnext.map.from":{},"esnext.map.group-by":{},"esnext.map.includes":{},"esnext.map.key-by":{},"esnext.map.key-of":{},"esnext.map.map-keys":{},"esnext.map.map-values":{},"esnext.map.merge":{},"esnext.map.of":{},"esnext.map.reduce":{},"esnext.map.some":{},"esnext.map.update":{},"esnext.map.update-or-insert":{},"esnext.map.upsert":{},"esnext.math.clamp":{},"esnext.math.deg-per-rad":{},"esnext.math.degrees":{},"esnext.math.fscale":{},"esnext.math.iaddh":{},"esnext.math.imulh":{},"esnext.math.isubh":{},"esnext.math.rad-per-deg":{},"esnext.math.radians":{},"esnext.math.scale":{},"esnext.math.seeded-prng":{},"esnext.math.signbit":{},"esnext.math.umulh":{},"esnext.number.from-string":{},"esnext.number.range":{},"esnext.object.has-own":{},"esnext.object.iterate-entries":{},"esnext.object.iterate-keys":{},"esnext.object.iterate-values":{},"esnext.observable":{},"esnext.promise.all-settled":{"android":"76","chrome":"76","edge":"76","electron":"6.0","firefox":"71","ios":"13.0","node":"12.9","opera":"63","opera_mobile":"54","safari":"13","samsung":"12.0"},"esnext.promise.any":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"esnext.promise.try":{},"esnext.reflect.define-metadata":{},"esnext.reflect.delete-metadata":{},"esnext.reflect.get-metadata":{},"esnext.reflect.get-metadata-keys":{},"esnext.reflect.get-own-metadata":{},"esnext.reflect.get-own-metadata-keys":{},"esnext.reflect.has-metadata":{},"esnext.reflect.has-own-metadata":{},"esnext.reflect.metadata":{},"esnext.set.add-all":{},"esnext.set.delete-all":{},"esnext.set.difference":{},"esnext.set.every":{},"esnext.set.filter":{},"esnext.set.find":{},"esnext.set.from":{},"esnext.set.intersection":{},"esnext.set.is-disjoint-from":{},"esnext.set.is-subset-of":{},"esnext.set.is-superset-of":{},"esnext.set.join":{},"esnext.set.map":{},"esnext.set.of":{},"esnext.set.reduce":{},"esnext.set.some":{},"esnext.set.symmetric-difference":{},"esnext.set.union":{},"esnext.string.at":{},"esnext.string.code-points":{},"esnext.string.match-all":{"android":"80","chrome":"80","edge":"80","electron":"8.0","firefox":"73","ios":"13.4","node":"14.0","opera":"67","opera_mobile":"57","safari":"13.1","samsung":"13.0"},"esnext.string.replace-all":{"android":"85","chrome":"85","edge":"85","electron":"10.0","firefox":"77","ios":"13.4","node":"15.0","opera":"71","opera_mobile":"60","safari":"13.1","samsung":"14.0"},"esnext.symbol.async-dispose":{},"esnext.symbol.dispose":{},"esnext.symbol.matcher":{},"esnext.symbol.metadata":{},"esnext.symbol.observable":{},"esnext.symbol.pattern-match":{},"esnext.symbol.replace-all":{},"esnext.typed-array.at":{"android":"92","chrome":"92","edge":"92","electron":"14.0","opera":"78"},"esnext.typed-array.filter-out":{},"esnext.typed-array.find-last":{},"esnext.typed-array.find-last-index":{},"esnext.typed-array.unique-by":{},"esnext.weak-map.delete-all":{},"esnext.weak-map.from":{},"esnext.weak-map.of":{},"esnext.weak-map.emplace":{},"esnext.weak-map.upsert":{},"esnext.weak-set.add-all":{},"esnext.weak-set.delete-all":{},"esnext.weak-set.from":{},"esnext.weak-set.of":{},"web.dom-collections.for-each":{"android":"58","chrome":"58","edge":"16","electron":"1.7","firefox":"50","ios":"10.0","node":"0.0.1","opera":"45","opera_mobile":"43","safari":"10.0","samsung":"7.0"},"web.dom-collections.iterator":{"android":"66","chrome":"66","edge":"74","electron":"3.0","firefox":"60","ios":"13.4","node":"0.0.1","opera":"53","opera_mobile":"47","safari":"13.1","samsung":"9.0"},"web.immediate":{"ie":"10","node":"0.9.1"},"web.queue-microtask":{"android":"71","chrome":"71","edge":"74","electron":"5.0","firefox":"69","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"web.timers":{"android":"1.5","chrome":"1","edge":"12","electron":"0.20","firefox":"1","ie":"10","ios":"1.0","node":"0.0.1","opera":"7","opera_mobile":"7","phantom":"1.9","safari":"1.0","samsung":"1.0"},"web.url":{"android":"67","chrome":"67","edge":"74","electron":"4.0","firefox":"57","ios":"14.0","node":"10.0","opera":"54","opera_mobile":"48","safari":"14.0","samsung":"9.0"},"web.url.to-json":{"android":"71","chrome":"71","edge":"74","electron":"5.0","firefox":"57","ios":"14.0","node":"10.0","opera":"58","opera_mobile":"50","safari":"14.0","samsung":"10.0"},"web.url-search-params":{"android":"67","chrome":"67","edge":"74","electron":"4.0","firefox":"57","ios":"14.0","node":"10.0","opera":"54","opera_mobile":"48","safari":"14.0","samsung":"9.0"}}')},4323:e=>{"use strict";e.exports=JSON.parse('{"core-js":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"core-js/es":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set"],"core-js/es/aggregate-error":["es.aggregate-error","es.string.iterator","web.dom-collections.iterator"],"core-js/es/array":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.string.iterator"],"core-js/es/array-buffer":["es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.object.to-string"],"core-js/es/array-buffer/constructor":["es.array-buffer.constructor","es.object.to-string"],"core-js/es/array-buffer/is-view":["es.array-buffer.is-view"],"core-js/es/array-buffer/slice":["es.array-buffer.slice"],"core-js/es/array/concat":["es.array.concat"],"core-js/es/array/copy-within":["es.array.copy-within"],"core-js/es/array/entries":["es.array.iterator"],"core-js/es/array/every":["es.array.every"],"core-js/es/array/fill":["es.array.fill"],"core-js/es/array/filter":["es.array.filter"],"core-js/es/array/find":["es.array.find"],"core-js/es/array/find-index":["es.array.find-index"],"core-js/es/array/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/es/array/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/es/array/for-each":["es.array.for-each"],"core-js/es/array/from":["es.array.from","es.string.iterator"],"core-js/es/array/includes":["es.array.includes"],"core-js/es/array/index-of":["es.array.index-of"],"core-js/es/array/is-array":["es.array.is-array"],"core-js/es/array/iterator":["es.array.iterator"],"core-js/es/array/join":["es.array.join"],"core-js/es/array/keys":["es.array.iterator"],"core-js/es/array/last-index-of":["es.array.last-index-of"],"core-js/es/array/map":["es.array.map"],"core-js/es/array/of":["es.array.of"],"core-js/es/array/reduce":["es.array.reduce"],"core-js/es/array/reduce-right":["es.array.reduce-right"],"core-js/es/array/reverse":["es.array.reverse"],"core-js/es/array/slice":["es.array.slice"],"core-js/es/array/some":["es.array.some"],"core-js/es/array/sort":["es.array.sort"],"core-js/es/array/splice":["es.array.splice"],"core-js/es/array/values":["es.array.iterator"],"core-js/es/array/virtual":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.includes","es.array.index-of","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map"],"core-js/es/array/virtual/concat":["es.array.concat"],"core-js/es/array/virtual/copy-within":["es.array.copy-within"],"core-js/es/array/virtual/entries":["es.array.iterator"],"core-js/es/array/virtual/every":["es.array.every"],"core-js/es/array/virtual/fill":["es.array.fill"],"core-js/es/array/virtual/filter":["es.array.filter"],"core-js/es/array/virtual/filter-out":["esnext.array.filter-out"],"core-js/es/array/virtual/find":["es.array.find"],"core-js/es/array/virtual/find-index":["es.array.find-index"],"core-js/es/array/virtual/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/es/array/virtual/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/es/array/virtual/for-each":["es.array.for-each"],"core-js/es/array/virtual/includes":["es.array.includes"],"core-js/es/array/virtual/index-of":["es.array.index-of"],"core-js/es/array/virtual/iterator":["es.array.iterator"],"core-js/es/array/virtual/join":["es.array.join"],"core-js/es/array/virtual/keys":["es.array.iterator"],"core-js/es/array/virtual/last-index-of":["es.array.last-index-of"],"core-js/es/array/virtual/map":["es.array.map"],"core-js/es/array/virtual/reduce":["es.array.reduce"],"core-js/es/array/virtual/reduce-right":["es.array.reduce-right"],"core-js/es/array/virtual/reverse":["es.array.reverse"],"core-js/es/array/virtual/slice":["es.array.slice"],"core-js/es/array/virtual/some":["es.array.some"],"core-js/es/array/virtual/sort":["es.array.sort"],"core-js/es/array/virtual/splice":["es.array.splice"],"core-js/es/array/virtual/values":["es.array.iterator"],"core-js/es/data-view":["es.data-view","es.object.to-string"],"core-js/es/date":["es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string"],"core-js/es/date/now":["es.date.now"],"core-js/es/date/to-iso-string":["es.date.to-iso-string","es.date.to-json"],"core-js/es/date/to-json":["es.date.to-json"],"core-js/es/date/to-primitive":["es.date.to-primitive"],"core-js/es/date/to-string":["es.date.to-string"],"core-js/es/function":["es.function.bind","es.function.has-instance","es.function.name"],"core-js/es/function/bind":["es.function.bind"],"core-js/es/function/has-instance":["es.function.has-instance"],"core-js/es/function/name":["es.function.name"],"core-js/es/function/virtual":["es.function.bind"],"core-js/es/function/virtual/bind":["es.function.bind"],"core-js/es/global-this":["es.global-this"],"core-js/es/instance/bind":["es.function.bind"],"core-js/es/instance/code-point-at":["es.string.code-point-at"],"core-js/es/instance/concat":["es.array.concat"],"core-js/es/instance/copy-within":["es.array.copy-within"],"core-js/es/instance/ends-with":["es.string.ends-with"],"core-js/es/instance/entries":["es.array.iterator"],"core-js/es/instance/every":["es.array.every"],"core-js/es/instance/fill":["es.array.fill"],"core-js/es/instance/filter":["es.array.filter"],"core-js/es/instance/find":["es.array.find"],"core-js/es/instance/find-index":["es.array.find-index"],"core-js/es/instance/flags":["es.regexp.flags"],"core-js/es/instance/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/es/instance/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/es/instance/for-each":["es.array.for-each"],"core-js/es/instance/includes":["es.array.includes","es.string.includes"],"core-js/es/instance/index-of":["es.array.index-of"],"core-js/es/instance/keys":["es.array.iterator"],"core-js/es/instance/last-index-of":["es.array.last-index-of"],"core-js/es/instance/map":["es.array.map"],"core-js/es/instance/match-all":["es.string.match-all"],"core-js/es/instance/pad-end":["es.string.pad-end"],"core-js/es/instance/pad-start":["es.string.pad-start"],"core-js/es/instance/reduce":["es.array.reduce"],"core-js/es/instance/reduce-right":["es.array.reduce-right"],"core-js/es/instance/repeat":["es.string.repeat"],"core-js/es/instance/replace-all":["es.string.replace-all"],"core-js/es/instance/reverse":["es.array.reverse"],"core-js/es/instance/slice":["es.array.slice"],"core-js/es/instance/some":["es.array.some"],"core-js/es/instance/sort":["es.array.sort"],"core-js/es/instance/splice":["es.array.splice"],"core-js/es/instance/starts-with":["es.string.starts-with"],"core-js/es/instance/trim":["es.string.trim"],"core-js/es/instance/trim-end":["es.string.trim-end"],"core-js/es/instance/trim-left":["es.string.trim-start"],"core-js/es/instance/trim-right":["es.string.trim-end"],"core-js/es/instance/trim-start":["es.string.trim-start"],"core-js/es/instance/values":["es.array.iterator"],"core-js/es/json":["es.json.stringify","es.json.to-string-tag"],"core-js/es/json/stringify":["es.json.stringify"],"core-js/es/json/to-string-tag":["es.json.to-string-tag"],"core-js/es/map":["es.map","es.object.to-string","es.string.iterator","web.dom-collections.iterator"],"core-js/es/math":["es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc"],"core-js/es/math/acosh":["es.math.acosh"],"core-js/es/math/asinh":["es.math.asinh"],"core-js/es/math/atanh":["es.math.atanh"],"core-js/es/math/cbrt":["es.math.cbrt"],"core-js/es/math/clz32":["es.math.clz32"],"core-js/es/math/cosh":["es.math.cosh"],"core-js/es/math/expm1":["es.math.expm1"],"core-js/es/math/fround":["es.math.fround"],"core-js/es/math/hypot":["es.math.hypot"],"core-js/es/math/imul":["es.math.imul"],"core-js/es/math/log10":["es.math.log10"],"core-js/es/math/log1p":["es.math.log1p"],"core-js/es/math/log2":["es.math.log2"],"core-js/es/math/sign":["es.math.sign"],"core-js/es/math/sinh":["es.math.sinh"],"core-js/es/math/tanh":["es.math.tanh"],"core-js/es/math/to-string-tag":["es.math.to-string-tag"],"core-js/es/math/trunc":["es.math.trunc"],"core-js/es/number":["es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision"],"core-js/es/number/constructor":["es.number.constructor"],"core-js/es/number/epsilon":["es.number.epsilon"],"core-js/es/number/is-finite":["es.number.is-finite"],"core-js/es/number/is-integer":["es.number.is-integer"],"core-js/es/number/is-nan":["es.number.is-nan"],"core-js/es/number/is-safe-integer":["es.number.is-safe-integer"],"core-js/es/number/max-safe-integer":["es.number.max-safe-integer"],"core-js/es/number/min-safe-integer":["es.number.min-safe-integer"],"core-js/es/number/parse-float":["es.number.parse-float"],"core-js/es/number/parse-int":["es.number.parse-int"],"core-js/es/number/to-fixed":["es.number.to-fixed"],"core-js/es/number/to-precision":["es.number.to-precision"],"core-js/es/number/virtual":["es.number.to-fixed","es.number.to-precision"],"core-js/es/number/virtual/to-fixed":["es.number.to-fixed"],"core-js/es/number/virtual/to-precision":["es.number.to-precision"],"core-js/es/object":["es.symbol","es.json.to-string-tag","es.math.to-string-tag","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.reflect.to-string-tag"],"core-js/es/object/assign":["es.object.assign"],"core-js/es/object/create":["es.object.create"],"core-js/es/object/define-getter":["es.object.define-getter"],"core-js/es/object/define-properties":["es.object.define-properties"],"core-js/es/object/define-property":["es.object.define-property"],"core-js/es/object/define-setter":["es.object.define-setter"],"core-js/es/object/entries":["es.object.entries"],"core-js/es/object/freeze":["es.object.freeze"],"core-js/es/object/from-entries":["es.array.iterator","es.object.from-entries"],"core-js/es/object/get-own-property-descriptor":["es.object.get-own-property-descriptor"],"core-js/es/object/get-own-property-descriptors":["es.object.get-own-property-descriptors"],"core-js/es/object/get-own-property-names":["es.object.get-own-property-names"],"core-js/es/object/get-own-property-symbols":["es.symbol"],"core-js/es/object/get-prototype-of":["es.object.get-prototype-of"],"core-js/es/object/is":["es.object.is"],"core-js/es/object/is-extensible":["es.object.is-extensible"],"core-js/es/object/is-frozen":["es.object.is-frozen"],"core-js/es/object/is-sealed":["es.object.is-sealed"],"core-js/es/object/keys":["es.object.keys"],"core-js/es/object/lookup-getter":["es.object.lookup-setter"],"core-js/es/object/lookup-setter":["es.object.lookup-setter"],"core-js/es/object/prevent-extensions":["es.object.prevent-extensions"],"core-js/es/object/seal":["es.object.seal"],"core-js/es/object/set-prototype-of":["es.object.set-prototype-of"],"core-js/es/object/to-string":["es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/es/object/values":["es.object.values"],"core-js/es/parse-float":["es.parse-float"],"core-js/es/parse-int":["es.parse-int"],"core-js/es/promise":["es.aggregate-error","es.object.to-string","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.string.iterator","web.dom-collections.iterator"],"core-js/es/promise/all-settled":["es.promise","es.promise.all-settled","es.string.iterator","web.dom-collections.iterator"],"core-js/es/promise/any":["es.aggregate-error","es.promise","es.promise.any","es.string.iterator","web.dom-collections.iterator"],"core-js/es/promise/finally":["es.promise","es.promise.finally"],"core-js/es/reflect":["es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag"],"core-js/es/reflect/apply":["es.reflect.apply"],"core-js/es/reflect/construct":["es.reflect.construct"],"core-js/es/reflect/define-property":["es.reflect.define-property"],"core-js/es/reflect/delete-property":["es.reflect.delete-property"],"core-js/es/reflect/get":["es.reflect.get"],"core-js/es/reflect/get-own-property-descriptor":["es.reflect.get-own-property-descriptor"],"core-js/es/reflect/get-prototype-of":["es.reflect.get-prototype-of"],"core-js/es/reflect/has":["es.reflect.has"],"core-js/es/reflect/is-extensible":["es.reflect.is-extensible"],"core-js/es/reflect/own-keys":["es.reflect.own-keys"],"core-js/es/reflect/prevent-extensions":["es.reflect.prevent-extensions"],"core-js/es/reflect/set":["es.reflect.set"],"core-js/es/reflect/set-prototype-of":["es.reflect.set-prototype-of"],"core-js/es/reflect/to-string-tag":["es.reflect.to-string-tag"],"core-js/es/regexp":["es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.string.match","es.string.replace","es.string.search","es.string.split"],"core-js/es/regexp/constructor":["es.regexp.constructor"],"core-js/es/regexp/flags":["es.regexp.flags"],"core-js/es/regexp/match":["es.string.match"],"core-js/es/regexp/replace":["es.string.replace"],"core-js/es/regexp/search":["es.string.search"],"core-js/es/regexp/split":["es.string.split"],"core-js/es/regexp/sticky":["es.regexp.sticky"],"core-js/es/regexp/test":["es.regexp.exec","es.regexp.test"],"core-js/es/regexp/to-string":["es.regexp.to-string"],"core-js/es/set":["es.object.to-string","es.set","es.string.iterator","web.dom-collections.iterator"],"core-js/es/string":["es.regexp.exec","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup"],"core-js/es/string/anchor":["es.string.anchor"],"core-js/es/string/big":["es.string.big"],"core-js/es/string/blink":["es.string.blink"],"core-js/es/string/bold":["es.string.bold"],"core-js/es/string/code-point-at":["es.string.code-point-at"],"core-js/es/string/ends-with":["es.string.ends-with"],"core-js/es/string/fixed":["es.string.fixed"],"core-js/es/string/fontcolor":["es.string.fontcolor"],"core-js/es/string/fontsize":["es.string.fontsize"],"core-js/es/string/from-code-point":["es.string.from-code-point"],"core-js/es/string/includes":["es.string.includes"],"core-js/es/string/italics":["es.string.italics"],"core-js/es/string/iterator":["es.string.iterator"],"core-js/es/string/link":["es.string.link"],"core-js/es/string/match":["es.regexp.exec","es.string.match"],"core-js/es/string/match-all":["es.string.match-all"],"core-js/es/string/pad-end":["es.string.pad-end"],"core-js/es/string/pad-start":["es.string.pad-start"],"core-js/es/string/raw":["es.string.raw"],"core-js/es/string/repeat":["es.string.repeat"],"core-js/es/string/replace":["es.regexp.exec","es.string.replace"],"core-js/es/string/replace-all":["es.string.replace-all"],"core-js/es/string/search":["es.regexp.exec","es.string.search"],"core-js/es/string/small":["es.string.small"],"core-js/es/string/split":["es.regexp.exec","es.string.split"],"core-js/es/string/starts-with":["es.string.starts-with"],"core-js/es/string/strike":["es.string.strike"],"core-js/es/string/sub":["es.string.sub"],"core-js/es/string/sup":["es.string.sup"],"core-js/es/string/trim":["es.string.trim"],"core-js/es/string/trim-end":["es.string.trim-end"],"core-js/es/string/trim-left":["es.string.trim-start"],"core-js/es/string/trim-right":["es.string.trim-end"],"core-js/es/string/trim-start":["es.string.trim-start"],"core-js/es/string/virtual":["es.string.code-point-at","es.string.ends-with","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup"],"core-js/es/string/virtual/anchor":["es.string.anchor"],"core-js/es/string/virtual/big":["es.string.big"],"core-js/es/string/virtual/blink":["es.string.blink"],"core-js/es/string/virtual/bold":["es.string.bold"],"core-js/es/string/virtual/code-point-at":["es.string.code-point-at"],"core-js/es/string/virtual/ends-with":["es.string.ends-with"],"core-js/es/string/virtual/fixed":["es.string.fixed"],"core-js/es/string/virtual/fontcolor":["es.string.fontcolor"],"core-js/es/string/virtual/fontsize":["es.string.fontsize"],"core-js/es/string/virtual/includes":["es.string.includes"],"core-js/es/string/virtual/italics":["es.string.italics"],"core-js/es/string/virtual/iterator":["es.string.iterator"],"core-js/es/string/virtual/link":["es.string.link"],"core-js/es/string/virtual/match-all":["es.string.match-all"],"core-js/es/string/virtual/pad-end":["es.string.pad-end"],"core-js/es/string/virtual/pad-start":["es.string.pad-start"],"core-js/es/string/virtual/repeat":["es.string.repeat"],"core-js/es/string/virtual/replace-all":["es.string.replace-all"],"core-js/es/string/virtual/small":["es.string.small"],"core-js/es/string/virtual/starts-with":["es.string.starts-with"],"core-js/es/string/virtual/strike":["es.string.strike"],"core-js/es/string/virtual/sub":["es.string.sub"],"core-js/es/string/virtual/sup":["es.string.sup"],"core-js/es/string/virtual/trim":["es.string.trim"],"core-js/es/string/virtual/trim-end":["es.string.trim-end"],"core-js/es/string/virtual/trim-left":["es.string.trim-start"],"core-js/es/string/virtual/trim-right":["es.string.trim-end"],"core-js/es/string/virtual/trim-start":["es.string.trim-start"],"core-js/es/symbol":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.array.concat","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/es/symbol/async-iterator":["es.symbol.async-iterator"],"core-js/es/symbol/description":["es.symbol.description"],"core-js/es/symbol/for":["es.symbol"],"core-js/es/symbol/has-instance":["es.symbol.has-instance","es.function.has-instance"],"core-js/es/symbol/is-concat-spreadable":["es.symbol.is-concat-spreadable","es.array.concat"],"core-js/es/symbol/iterator":["es.symbol.iterator","es.string.iterator","web.dom-collections.iterator"],"core-js/es/symbol/key-for":["es.symbol"],"core-js/es/symbol/match":["es.symbol.match","es.string.match"],"core-js/es/symbol/match-all":["es.symbol.match-all","es.string.match-all"],"core-js/es/symbol/replace":["es.symbol.replace","es.string.replace"],"core-js/es/symbol/search":["es.symbol.search","es.string.search"],"core-js/es/symbol/species":["es.symbol.species"],"core-js/es/symbol/split":["es.symbol.split","es.string.split"],"core-js/es/symbol/to-primitive":["es.symbol.to-primitive"],"core-js/es/symbol/to-string-tag":["es.symbol.to-string-tag","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/es/symbol/unscopables":["es.symbol.unscopables"],"core-js/es/typed-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/copy-within":["es.typed-array.copy-within"],"core-js/es/typed-array/entries":["es.typed-array.iterator"],"core-js/es/typed-array/every":["es.typed-array.every"],"core-js/es/typed-array/fill":["es.typed-array.fill"],"core-js/es/typed-array/filter":["es.typed-array.filter"],"core-js/es/typed-array/find":["es.typed-array.find"],"core-js/es/typed-array/find-index":["es.typed-array.find-index"],"core-js/es/typed-array/float32-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/float64-array":["es.object.to-string","es.typed-array.float64-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/for-each":["es.typed-array.for-each"],"core-js/es/typed-array/from":["es.typed-array.from"],"core-js/es/typed-array/includes":["es.typed-array.includes"],"core-js/es/typed-array/index-of":["es.typed-array.index-of"],"core-js/es/typed-array/int16-array":["es.object.to-string","es.typed-array.int16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/int32-array":["es.object.to-string","es.typed-array.int32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/int8-array":["es.object.to-string","es.typed-array.int8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/iterator":["es.typed-array.iterator"],"core-js/es/typed-array/join":["es.typed-array.join"],"core-js/es/typed-array/keys":["es.typed-array.iterator"],"core-js/es/typed-array/last-index-of":["es.typed-array.last-index-of"],"core-js/es/typed-array/map":["es.typed-array.map"],"core-js/es/typed-array/methods":["es.object.to-string","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/of":["es.typed-array.of"],"core-js/es/typed-array/reduce":["es.typed-array.reduce"],"core-js/es/typed-array/reduce-right":["es.typed-array.reduce-right"],"core-js/es/typed-array/reverse":["es.typed-array.reverse"],"core-js/es/typed-array/set":["es.typed-array.set"],"core-js/es/typed-array/slice":["es.typed-array.slice"],"core-js/es/typed-array/some":["es.typed-array.some"],"core-js/es/typed-array/sort":["es.typed-array.sort"],"core-js/es/typed-array/subarray":["es.typed-array.subarray"],"core-js/es/typed-array/to-locale-string":["es.typed-array.to-locale-string"],"core-js/es/typed-array/to-string":["es.typed-array.to-string"],"core-js/es/typed-array/uint16-array":["es.object.to-string","es.typed-array.uint16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/uint32-array":["es.object.to-string","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/uint8-array":["es.object.to-string","es.typed-array.uint8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/uint8-clamped-array":["es.object.to-string","es.typed-array.uint8-clamped-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/es/typed-array/values":["es.typed-array.iterator"],"core-js/es/weak-map":["es.object.to-string","es.weak-map","web.dom-collections.iterator"],"core-js/es/weak-set":["es.object.to-string","es.weak-set","web.dom-collections.iterator"],"core-js/features":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"core-js/features/aggregate-error":["es.aggregate-error","es.string.iterator","esnext.aggregate-error","web.dom-collections.iterator"],"core-js/features/array":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.map","es.string.iterator","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by"],"core-js/features/array-buffer":["es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.object.to-string"],"core-js/features/array-buffer/constructor":["es.array-buffer.constructor","es.object.to-string"],"core-js/features/array-buffer/is-view":["es.array-buffer.is-view"],"core-js/features/array-buffer/slice":["es.array-buffer.slice"],"core-js/features/array/at":["esnext.array.at"],"core-js/features/array/concat":["es.array.concat"],"core-js/features/array/copy-within":["es.array.copy-within"],"core-js/features/array/entries":["es.array.iterator"],"core-js/features/array/every":["es.array.every"],"core-js/features/array/fill":["es.array.fill"],"core-js/features/array/filter":["es.array.filter"],"core-js/features/array/filter-out":["esnext.array.filter-out"],"core-js/features/array/find":["es.array.find"],"core-js/features/array/find-index":["es.array.find-index"],"core-js/features/array/find-last":["esnext.array.find-last"],"core-js/features/array/find-last-index":["esnext.array.find-last-index"],"core-js/features/array/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/features/array/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/features/array/for-each":["es.array.for-each"],"core-js/features/array/from":["es.array.from","es.string.iterator"],"core-js/features/array/includes":["es.array.includes"],"core-js/features/array/index-of":["es.array.index-of"],"core-js/features/array/is-array":["es.array.is-array"],"core-js/features/array/is-template-object":["esnext.array.is-template-object"],"core-js/features/array/iterator":["es.array.iterator"],"core-js/features/array/join":["es.array.join"],"core-js/features/array/keys":["es.array.iterator"],"core-js/features/array/last-index":["esnext.array.last-index"],"core-js/features/array/last-index-of":["es.array.last-index-of"],"core-js/features/array/last-item":["esnext.array.last-item"],"core-js/features/array/map":["es.array.map"],"core-js/features/array/of":["es.array.of"],"core-js/features/array/reduce":["es.array.reduce"],"core-js/features/array/reduce-right":["es.array.reduce-right"],"core-js/features/array/reverse":["es.array.reverse"],"core-js/features/array/slice":["es.array.slice"],"core-js/features/array/some":["es.array.some"],"core-js/features/array/sort":["es.array.sort"],"core-js/features/array/splice":["es.array.splice"],"core-js/features/array/unique-by":["es.map","esnext.array.unique-by"],"core-js/features/array/values":["es.array.iterator"],"core-js/features/array/virtual":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.includes","es.array.index-of","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.map","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.unique-by"],"core-js/features/array/virtual/at":["esnext.array.at"],"core-js/features/array/virtual/concat":["es.array.concat"],"core-js/features/array/virtual/copy-within":["es.array.copy-within"],"core-js/features/array/virtual/entries":["es.array.iterator"],"core-js/features/array/virtual/every":["es.array.every"],"core-js/features/array/virtual/fill":["es.array.fill"],"core-js/features/array/virtual/filter":["es.array.filter"],"core-js/features/array/virtual/filter-out":["esnext.array.filter-out"],"core-js/features/array/virtual/find":["es.array.find"],"core-js/features/array/virtual/find-index":["es.array.find-index"],"core-js/features/array/virtual/find-last":["esnext.array.find-last"],"core-js/features/array/virtual/find-last-index":["esnext.array.find-last-index"],"core-js/features/array/virtual/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/features/array/virtual/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/features/array/virtual/for-each":["es.array.for-each"],"core-js/features/array/virtual/includes":["es.array.includes"],"core-js/features/array/virtual/index-of":["es.array.index-of"],"core-js/features/array/virtual/iterator":["es.array.iterator"],"core-js/features/array/virtual/join":["es.array.join"],"core-js/features/array/virtual/keys":["es.array.iterator"],"core-js/features/array/virtual/last-index-of":["es.array.last-index-of"],"core-js/features/array/virtual/map":["es.array.map"],"core-js/features/array/virtual/reduce":["es.array.reduce"],"core-js/features/array/virtual/reduce-right":["es.array.reduce-right"],"core-js/features/array/virtual/reverse":["es.array.reverse"],"core-js/features/array/virtual/slice":["es.array.slice"],"core-js/features/array/virtual/some":["es.array.some"],"core-js/features/array/virtual/sort":["es.array.sort"],"core-js/features/array/virtual/splice":["es.array.splice"],"core-js/features/array/virtual/unique-by":["es.map","esnext.array.unique-by"],"core-js/features/array/virtual/values":["es.array.iterator"],"core-js/features/async-iterator":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","web.dom-collections.iterator"],"core-js/features/async-iterator/as-indexed-pairs":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","web.dom-collections.iterator"],"core-js/features/async-iterator/drop":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.drop","web.dom-collections.iterator"],"core-js/features/async-iterator/every":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.every","web.dom-collections.iterator"],"core-js/features/async-iterator/filter":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.filter","web.dom-collections.iterator"],"core-js/features/async-iterator/find":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.find","web.dom-collections.iterator"],"core-js/features/async-iterator/flat-map":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.flat-map","web.dom-collections.iterator"],"core-js/features/async-iterator/for-each":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.for-each","web.dom-collections.iterator"],"core-js/features/async-iterator/from":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.from","web.dom-collections.iterator"],"core-js/features/async-iterator/map":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.map","web.dom-collections.iterator"],"core-js/features/async-iterator/reduce":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.reduce","web.dom-collections.iterator"],"core-js/features/async-iterator/some":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.some","web.dom-collections.iterator"],"core-js/features/async-iterator/take":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.take","web.dom-collections.iterator"],"core-js/features/async-iterator/to-array":["es.object.to-string","es.promise","es.string.iterator","esnext.async-iterator.constructor","esnext.async-iterator.to-array","web.dom-collections.iterator"],"core-js/features/bigint":["esnext.bigint.range"],"core-js/features/bigint/range":["esnext.bigint.range"],"core-js/features/clear-immediate":["web.immediate"],"core-js/features/composite-key":["esnext.composite-key"],"core-js/features/composite-symbol":["es.symbol","esnext.composite-symbol"],"core-js/features/data-view":["es.data-view","es.object.to-string"],"core-js/features/date":["es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string"],"core-js/features/date/now":["es.date.now"],"core-js/features/date/to-iso-string":["es.date.to-iso-string","es.date.to-json"],"core-js/features/date/to-json":["es.date.to-json"],"core-js/features/date/to-primitive":["es.date.to-primitive"],"core-js/features/date/to-string":["es.date.to-string"],"core-js/features/dom-collections":["es.array.iterator","web.dom-collections.for-each","web.dom-collections.iterator"],"core-js/features/dom-collections/for-each":["web.dom-collections.for-each"],"core-js/features/dom-collections/iterator":["web.dom-collections.iterator"],"core-js/features/function":["es.function.bind","es.function.has-instance","es.function.name"],"core-js/features/function/bind":["es.function.bind"],"core-js/features/function/has-instance":["es.function.has-instance"],"core-js/features/function/name":["es.function.name"],"core-js/features/function/virtual":["es.function.bind"],"core-js/features/function/virtual/bind":["es.function.bind"],"core-js/features/get-iterator":["es.string.iterator","web.dom-collections.iterator"],"core-js/features/get-iterator-method":["es.string.iterator","web.dom-collections.iterator"],"core-js/features/global-this":["es.global-this","esnext.global-this"],"core-js/features/instance/at":["esnext.array.at","esnext.string.at"],"core-js/features/instance/bind":["es.function.bind"],"core-js/features/instance/code-point-at":["es.string.code-point-at"],"core-js/features/instance/code-points":["esnext.string.code-points"],"core-js/features/instance/concat":["es.array.concat"],"core-js/features/instance/copy-within":["es.array.copy-within"],"core-js/features/instance/ends-with":["es.string.ends-with"],"core-js/features/instance/entries":["es.array.iterator","web.dom-collections.iterator"],"core-js/features/instance/every":["es.array.every"],"core-js/features/instance/fill":["es.array.fill"],"core-js/features/instance/filter":["es.array.filter"],"core-js/features/instance/filter-out":["esnext.array.filter-out"],"core-js/features/instance/find":["es.array.find"],"core-js/features/instance/find-index":["es.array.find-index"],"core-js/features/instance/find-last":["esnext.array.find-last"],"core-js/features/instance/find-last-index":["esnext.array.find-last-index"],"core-js/features/instance/flags":["es.regexp.flags"],"core-js/features/instance/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/features/instance/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/features/instance/for-each":["es.array.for-each","web.dom-collections.iterator"],"core-js/features/instance/includes":["es.array.includes","es.string.includes"],"core-js/features/instance/index-of":["es.array.index-of"],"core-js/features/instance/keys":["es.array.iterator","web.dom-collections.iterator"],"core-js/features/instance/last-index-of":["es.array.last-index-of"],"core-js/features/instance/map":["es.array.map"],"core-js/features/instance/match-all":["es.string.match-all","esnext.string.match-all"],"core-js/features/instance/pad-end":["es.string.pad-end"],"core-js/features/instance/pad-start":["es.string.pad-start"],"core-js/features/instance/reduce":["es.array.reduce"],"core-js/features/instance/reduce-right":["es.array.reduce-right"],"core-js/features/instance/repeat":["es.string.repeat"],"core-js/features/instance/replace-all":["es.string.replace-all"],"core-js/features/instance/reverse":["es.array.reverse"],"core-js/features/instance/slice":["es.array.slice"],"core-js/features/instance/some":["es.array.some"],"core-js/features/instance/sort":["es.array.sort"],"core-js/features/instance/splice":["es.array.splice"],"core-js/features/instance/starts-with":["es.string.starts-with"],"core-js/features/instance/trim":["es.string.trim"],"core-js/features/instance/trim-end":["es.string.trim-end"],"core-js/features/instance/trim-left":["es.string.trim-start"],"core-js/features/instance/trim-right":["es.string.trim-end"],"core-js/features/instance/trim-start":["es.string.trim-start"],"core-js/features/instance/unique-by":["es.map","esnext.array.unique-by"],"core-js/features/instance/values":["es.array.iterator","web.dom-collections.iterator"],"core-js/features/is-iterable":["es.string.iterator","web.dom-collections.iterator"],"core-js/features/iterator":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","web.dom-collections.iterator"],"core-js/features/iterator/as-indexed-pairs":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","web.dom-collections.iterator"],"core-js/features/iterator/drop":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.drop","web.dom-collections.iterator"],"core-js/features/iterator/every":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.every","web.dom-collections.iterator"],"core-js/features/iterator/filter":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.filter","web.dom-collections.iterator"],"core-js/features/iterator/find":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.find","web.dom-collections.iterator"],"core-js/features/iterator/flat-map":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.flat-map","web.dom-collections.iterator"],"core-js/features/iterator/for-each":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.for-each","web.dom-collections.iterator"],"core-js/features/iterator/from":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.from","web.dom-collections.iterator"],"core-js/features/iterator/map":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.map","web.dom-collections.iterator"],"core-js/features/iterator/reduce":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.reduce","web.dom-collections.iterator"],"core-js/features/iterator/some":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.some","web.dom-collections.iterator"],"core-js/features/iterator/take":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.take","web.dom-collections.iterator"],"core-js/features/iterator/to-array":["es.object.to-string","es.string.iterator","esnext.iterator.constructor","esnext.iterator.to-array","web.dom-collections.iterator"],"core-js/features/json":["es.json.stringify","es.json.to-string-tag"],"core-js/features/json/stringify":["es.json.stringify"],"core-js/features/json/to-string-tag":["es.json.to-string-tag"],"core-js/features/map":["es.map","es.object.to-string","es.string.iterator","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","web.dom-collections.iterator"],"core-js/features/map/delete-all":["es.map","esnext.map.delete-all"],"core-js/features/map/emplace":["es.map","esnext.map.emplace"],"core-js/features/map/every":["es.map","esnext.map.every"],"core-js/features/map/filter":["es.map","esnext.map.filter"],"core-js/features/map/find":["es.map","esnext.map.find"],"core-js/features/map/find-key":["es.map","esnext.map.find-key"],"core-js/features/map/from":["es.map","es.string.iterator","esnext.map.from","web.dom-collections.iterator"],"core-js/features/map/group-by":["es.map","esnext.map.group-by"],"core-js/features/map/includes":["es.map","esnext.map.includes"],"core-js/features/map/key-by":["es.map","esnext.map.key-by"],"core-js/features/map/key-of":["es.map","esnext.map.key-of"],"core-js/features/map/map-keys":["es.map","esnext.map.map-keys"],"core-js/features/map/map-values":["es.map","esnext.map.map-values"],"core-js/features/map/merge":["es.map","esnext.map.merge"],"core-js/features/map/of":["es.map","es.string.iterator","esnext.map.of","web.dom-collections.iterator"],"core-js/features/map/reduce":["es.map","esnext.map.reduce"],"core-js/features/map/some":["es.map","esnext.map.some"],"core-js/features/map/update":["es.map","esnext.map.update"],"core-js/features/map/update-or-insert":["es.map","esnext.map.update-or-insert"],"core-js/features/map/upsert":["es.map","esnext.map.upsert"],"core-js/features/math":["es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh"],"core-js/features/math/acosh":["es.math.acosh"],"core-js/features/math/asinh":["es.math.asinh"],"core-js/features/math/atanh":["es.math.atanh"],"core-js/features/math/cbrt":["es.math.cbrt"],"core-js/features/math/clamp":["esnext.math.clamp"],"core-js/features/math/clz32":["es.math.clz32"],"core-js/features/math/cosh":["es.math.cosh"],"core-js/features/math/deg-per-rad":["esnext.math.deg-per-rad"],"core-js/features/math/degrees":["esnext.math.degrees"],"core-js/features/math/expm1":["es.math.expm1"],"core-js/features/math/fround":["es.math.fround"],"core-js/features/math/fscale":["esnext.math.fscale"],"core-js/features/math/hypot":["es.math.hypot"],"core-js/features/math/iaddh":["esnext.math.iaddh"],"core-js/features/math/imul":["es.math.imul"],"core-js/features/math/imulh":["esnext.math.imulh"],"core-js/features/math/isubh":["esnext.math.isubh"],"core-js/features/math/log10":["es.math.log10"],"core-js/features/math/log1p":["es.math.log1p"],"core-js/features/math/log2":["es.math.log2"],"core-js/features/math/rad-per-deg":["esnext.math.rad-per-deg"],"core-js/features/math/radians":["esnext.math.radians"],"core-js/features/math/scale":["esnext.math.scale"],"core-js/features/math/seeded-prng":["esnext.math.seeded-prng"],"core-js/features/math/sign":["es.math.sign"],"core-js/features/math/signbit":["esnext.math.signbit"],"core-js/features/math/sinh":["es.math.sinh"],"core-js/features/math/tanh":["es.math.tanh"],"core-js/features/math/to-string-tag":["es.math.to-string-tag"],"core-js/features/math/trunc":["es.math.trunc"],"core-js/features/math/umulh":["esnext.math.umulh"],"core-js/features/number":["es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","esnext.number.from-string","esnext.number.range"],"core-js/features/number/constructor":["es.number.constructor"],"core-js/features/number/epsilon":["es.number.epsilon"],"core-js/features/number/from-string":["esnext.number.from-string"],"core-js/features/number/is-finite":["es.number.is-finite"],"core-js/features/number/is-integer":["es.number.is-integer"],"core-js/features/number/is-nan":["es.number.is-nan"],"core-js/features/number/is-safe-integer":["es.number.is-safe-integer"],"core-js/features/number/max-safe-integer":["es.number.max-safe-integer"],"core-js/features/number/min-safe-integer":["es.number.min-safe-integer"],"core-js/features/number/parse-float":["es.number.parse-float"],"core-js/features/number/parse-int":["es.number.parse-int"],"core-js/features/number/range":["esnext.number.range"],"core-js/features/number/to-fixed":["es.number.to-fixed"],"core-js/features/number/to-precision":["es.number.to-precision"],"core-js/features/number/virtual":["es.number.to-fixed","es.number.to-precision"],"core-js/features/number/virtual/to-fixed":["es.number.to-fixed"],"core-js/features/number/virtual/to-precision":["es.number.to-precision"],"core-js/features/object":["es.symbol","es.json.to-string-tag","es.math.to-string-tag","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.reflect.to-string-tag","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values"],"core-js/features/object/assign":["es.object.assign"],"core-js/features/object/create":["es.object.create"],"core-js/features/object/define-getter":["es.object.define-getter"],"core-js/features/object/define-properties":["es.object.define-properties"],"core-js/features/object/define-property":["es.object.define-property"],"core-js/features/object/define-setter":["es.object.define-setter"],"core-js/features/object/entries":["es.object.entries"],"core-js/features/object/freeze":["es.object.freeze"],"core-js/features/object/from-entries":["es.array.iterator","es.object.from-entries"],"core-js/features/object/get-own-property-descriptor":["es.object.get-own-property-descriptor"],"core-js/features/object/get-own-property-descriptors":["es.object.get-own-property-descriptors"],"core-js/features/object/get-own-property-names":["es.object.get-own-property-names"],"core-js/features/object/get-own-property-symbols":["es.symbol"],"core-js/features/object/get-prototype-of":["es.object.get-prototype-of"],"core-js/features/object/has-own":["esnext.object.has-own"],"core-js/features/object/is":["es.object.is"],"core-js/features/object/is-extensible":["es.object.is-extensible"],"core-js/features/object/is-frozen":["es.object.is-frozen"],"core-js/features/object/is-sealed":["es.object.is-sealed"],"core-js/features/object/iterate-entries":["esnext.object.iterate-entries"],"core-js/features/object/iterate-keys":["esnext.object.iterate-keys"],"core-js/features/object/iterate-values":["esnext.object.iterate-values"],"core-js/features/object/keys":["es.object.keys"],"core-js/features/object/lookup-getter":["es.object.lookup-setter"],"core-js/features/object/lookup-setter":["es.object.lookup-setter"],"core-js/features/object/prevent-extensions":["es.object.prevent-extensions"],"core-js/features/object/seal":["es.object.seal"],"core-js/features/object/set-prototype-of":["es.object.set-prototype-of"],"core-js/features/object/to-string":["es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/features/object/values":["es.object.values"],"core-js/features/observable":["es.object.to-string","es.string.iterator","esnext.observable","esnext.symbol.observable","web.dom-collections.iterator"],"core-js/features/parse-float":["es.parse-float"],"core-js/features/parse-int":["es.parse-int"],"core-js/features/promise":["es.aggregate-error","es.object.to-string","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.string.iterator","esnext.aggregate-error","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","web.dom-collections.iterator"],"core-js/features/promise/all-settled":["es.promise","es.promise.all-settled","es.string.iterator","esnext.promise.all-settled","web.dom-collections.iterator"],"core-js/features/promise/any":["es.aggregate-error","es.promise","es.promise.any","es.string.iterator","esnext.aggregate-error","esnext.promise.any","web.dom-collections.iterator"],"core-js/features/promise/finally":["es.promise","es.promise.finally"],"core-js/features/promise/try":["es.promise","esnext.promise.try"],"core-js/features/queue-microtask":["web.queue-microtask"],"core-js/features/reflect":["es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata"],"core-js/features/reflect/apply":["es.reflect.apply"],"core-js/features/reflect/construct":["es.reflect.construct"],"core-js/features/reflect/define-metadata":["esnext.reflect.define-metadata"],"core-js/features/reflect/define-property":["es.reflect.define-property"],"core-js/features/reflect/delete-metadata":["esnext.reflect.delete-metadata"],"core-js/features/reflect/delete-property":["es.reflect.delete-property"],"core-js/features/reflect/get":["es.reflect.get"],"core-js/features/reflect/get-metadata":["esnext.reflect.get-metadata"],"core-js/features/reflect/get-metadata-keys":["esnext.reflect.get-metadata-keys"],"core-js/features/reflect/get-own-metadata":["esnext.reflect.get-own-metadata"],"core-js/features/reflect/get-own-metadata-keys":["esnext.reflect.get-own-metadata-keys"],"core-js/features/reflect/get-own-property-descriptor":["es.reflect.get-own-property-descriptor"],"core-js/features/reflect/get-prototype-of":["es.reflect.get-prototype-of"],"core-js/features/reflect/has":["es.reflect.has"],"core-js/features/reflect/has-metadata":["esnext.reflect.has-metadata"],"core-js/features/reflect/has-own-metadata":["esnext.reflect.has-own-metadata"],"core-js/features/reflect/is-extensible":["es.reflect.is-extensible"],"core-js/features/reflect/metadata":["esnext.reflect.metadata"],"core-js/features/reflect/own-keys":["es.reflect.own-keys"],"core-js/features/reflect/prevent-extensions":["es.reflect.prevent-extensions"],"core-js/features/reflect/set":["es.reflect.set"],"core-js/features/reflect/set-prototype-of":["es.reflect.set-prototype-of"],"core-js/features/reflect/to-string-tag":["es.reflect.to-string-tag"],"core-js/features/regexp":["es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.string.match","es.string.replace","es.string.search","es.string.split"],"core-js/features/regexp/constructor":["es.regexp.constructor"],"core-js/features/regexp/flags":["es.regexp.flags"],"core-js/features/regexp/match":["es.string.match"],"core-js/features/regexp/replace":["es.string.replace"],"core-js/features/regexp/search":["es.string.search"],"core-js/features/regexp/split":["es.string.split"],"core-js/features/regexp/sticky":["es.regexp.sticky"],"core-js/features/regexp/test":["es.regexp.exec","es.regexp.test"],"core-js/features/regexp/to-string":["es.regexp.to-string"],"core-js/features/set":["es.object.to-string","es.set","es.string.iterator","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","web.dom-collections.iterator"],"core-js/features/set-immediate":["web.immediate"],"core-js/features/set-interval":["web.timers"],"core-js/features/set-timeout":["web.timers"],"core-js/features/set/add-all":["es.set","esnext.set.add-all"],"core-js/features/set/delete-all":["es.set","esnext.set.delete-all"],"core-js/features/set/difference":["es.set","es.string.iterator","esnext.set.difference","web.dom-collections.iterator"],"core-js/features/set/every":["es.set","esnext.set.every"],"core-js/features/set/filter":["es.set","esnext.set.filter"],"core-js/features/set/find":["es.set","esnext.set.find"],"core-js/features/set/from":["es.set","es.string.iterator","esnext.set.from","web.dom-collections.iterator"],"core-js/features/set/intersection":["es.set","esnext.set.intersection"],"core-js/features/set/is-disjoint-from":["es.set","esnext.set.is-disjoint-from"],"core-js/features/set/is-subset-of":["es.set","es.string.iterator","esnext.set.is-subset-of","web.dom-collections.iterator"],"core-js/features/set/is-superset-of":["es.set","esnext.set.is-superset-of"],"core-js/features/set/join":["es.set","esnext.set.join"],"core-js/features/set/map":["es.set","esnext.set.map"],"core-js/features/set/of":["es.set","es.string.iterator","esnext.set.of","web.dom-collections.iterator"],"core-js/features/set/reduce":["es.set","esnext.set.reduce"],"core-js/features/set/some":["es.set","esnext.set.some"],"core-js/features/set/symmetric-difference":["es.set","es.string.iterator","esnext.set.symmetric-difference","web.dom-collections.iterator"],"core-js/features/set/union":["es.set","es.string.iterator","esnext.set.union","web.dom-collections.iterator"],"core-js/features/string":["es.regexp.exec","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all"],"core-js/features/string/anchor":["es.string.anchor"],"core-js/features/string/at":["esnext.string.at"],"core-js/features/string/big":["es.string.big"],"core-js/features/string/blink":["es.string.blink"],"core-js/features/string/bold":["es.string.bold"],"core-js/features/string/code-point-at":["es.string.code-point-at"],"core-js/features/string/code-points":["esnext.string.code-points"],"core-js/features/string/ends-with":["es.string.ends-with"],"core-js/features/string/fixed":["es.string.fixed"],"core-js/features/string/fontcolor":["es.string.fontcolor"],"core-js/features/string/fontsize":["es.string.fontsize"],"core-js/features/string/from-code-point":["es.string.from-code-point"],"core-js/features/string/includes":["es.string.includes"],"core-js/features/string/italics":["es.string.italics"],"core-js/features/string/iterator":["es.string.iterator"],"core-js/features/string/link":["es.string.link"],"core-js/features/string/match":["es.regexp.exec","es.string.match"],"core-js/features/string/match-all":["es.string.match-all","esnext.string.match-all"],"core-js/features/string/pad-end":["es.string.pad-end"],"core-js/features/string/pad-start":["es.string.pad-start"],"core-js/features/string/raw":["es.string.raw"],"core-js/features/string/repeat":["es.string.repeat"],"core-js/features/string/replace":["es.regexp.exec","es.string.replace"],"core-js/features/string/replace-all":["es.string.replace-all","esnext.string.replace-all"],"core-js/features/string/search":["es.regexp.exec","es.string.search"],"core-js/features/string/small":["es.string.small"],"core-js/features/string/split":["es.regexp.exec","es.string.split"],"core-js/features/string/starts-with":["es.string.starts-with"],"core-js/features/string/strike":["es.string.strike"],"core-js/features/string/sub":["es.string.sub"],"core-js/features/string/sup":["es.string.sup"],"core-js/features/string/trim":["es.string.trim"],"core-js/features/string/trim-end":["es.string.trim-end"],"core-js/features/string/trim-left":["es.string.trim-start"],"core-js/features/string/trim-right":["es.string.trim-end"],"core-js/features/string/trim-start":["es.string.trim-start"],"core-js/features/string/virtual":["es.string.code-point-at","es.string.ends-with","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all"],"core-js/features/string/virtual/anchor":["es.string.anchor"],"core-js/features/string/virtual/at":["esnext.string.at"],"core-js/features/string/virtual/big":["es.string.big"],"core-js/features/string/virtual/blink":["es.string.blink"],"core-js/features/string/virtual/bold":["es.string.bold"],"core-js/features/string/virtual/code-point-at":["es.string.code-point-at"],"core-js/features/string/virtual/code-points":["esnext.string.code-points"],"core-js/features/string/virtual/ends-with":["es.string.ends-with"],"core-js/features/string/virtual/fixed":["es.string.fixed"],"core-js/features/string/virtual/fontcolor":["es.string.fontcolor"],"core-js/features/string/virtual/fontsize":["es.string.fontsize"],"core-js/features/string/virtual/includes":["es.string.includes"],"core-js/features/string/virtual/italics":["es.string.italics"],"core-js/features/string/virtual/iterator":["es.string.iterator"],"core-js/features/string/virtual/link":["es.string.link"],"core-js/features/string/virtual/match-all":["es.string.match-all","esnext.string.match-all"],"core-js/features/string/virtual/pad-end":["es.string.pad-end"],"core-js/features/string/virtual/pad-start":["es.string.pad-start"],"core-js/features/string/virtual/repeat":["es.string.repeat"],"core-js/features/string/virtual/replace-all":["es.string.replace-all","esnext.string.replace-all"],"core-js/features/string/virtual/small":["es.string.small"],"core-js/features/string/virtual/starts-with":["es.string.starts-with"],"core-js/features/string/virtual/strike":["es.string.strike"],"core-js/features/string/virtual/sub":["es.string.sub"],"core-js/features/string/virtual/sup":["es.string.sup"],"core-js/features/string/virtual/trim":["es.string.trim"],"core-js/features/string/virtual/trim-end":["es.string.trim-end"],"core-js/features/string/virtual/trim-left":["es.string.trim-start"],"core-js/features/string/virtual/trim-right":["es.string.trim-end"],"core-js/features/string/virtual/trim-start":["es.string.trim-start"],"core-js/features/symbol":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.array.concat","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all"],"core-js/features/symbol/async-dispose":["esnext.symbol.async-dispose"],"core-js/features/symbol/async-iterator":["es.symbol.async-iterator"],"core-js/features/symbol/description":["es.symbol.description"],"core-js/features/symbol/dispose":["esnext.symbol.dispose"],"core-js/features/symbol/for":["es.symbol"],"core-js/features/symbol/has-instance":["es.symbol.has-instance","es.function.has-instance"],"core-js/features/symbol/is-concat-spreadable":["es.symbol.is-concat-spreadable","es.array.concat"],"core-js/features/symbol/iterator":["es.symbol.iterator","es.string.iterator","web.dom-collections.iterator"],"core-js/features/symbol/key-for":["es.symbol"],"core-js/features/symbol/match":["es.symbol.match","es.string.match"],"core-js/features/symbol/match-all":["es.symbol.match-all","es.string.match-all"],"core-js/features/symbol/matcher":["esnext.symbol.matcher"],"core-js/features/symbol/metadata":["esnext.symbol.metadata"],"core-js/features/symbol/observable":["esnext.symbol.observable"],"core-js/features/symbol/pattern-match":["esnext.symbol.pattern-match"],"core-js/features/symbol/replace":["es.symbol.replace","es.string.replace"],"core-js/features/symbol/replace-all":["esnext.symbol.replace-all"],"core-js/features/symbol/search":["es.symbol.search","es.string.search"],"core-js/features/symbol/species":["es.symbol.species"],"core-js/features/symbol/split":["es.symbol.split","es.string.split"],"core-js/features/symbol/to-primitive":["es.symbol.to-primitive"],"core-js/features/symbol/to-string-tag":["es.symbol.to-string-tag","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/features/symbol/unscopables":["es.symbol.unscopables"],"core-js/features/typed-array":["es.map","es.object.to-string","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by"],"core-js/features/typed-array/at":["esnext.typed-array.at"],"core-js/features/typed-array/copy-within":["es.typed-array.copy-within"],"core-js/features/typed-array/entries":["es.typed-array.iterator"],"core-js/features/typed-array/every":["es.typed-array.every"],"core-js/features/typed-array/fill":["es.typed-array.fill"],"core-js/features/typed-array/filter":["es.typed-array.filter"],"core-js/features/typed-array/filter-out":["esnext.typed-array.filter-out"],"core-js/features/typed-array/find":["es.typed-array.find"],"core-js/features/typed-array/find-index":["es.typed-array.find-index"],"core-js/features/typed-array/find-last":["esnext.typed-array.find-last"],"core-js/features/typed-array/find-last-index":["esnext.typed-array.find-last-index"],"core-js/features/typed-array/float32-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/float64-array":["es.object.to-string","es.typed-array.float64-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/for-each":["es.typed-array.for-each"],"core-js/features/typed-array/from":["es.typed-array.from"],"core-js/features/typed-array/includes":["es.typed-array.includes"],"core-js/features/typed-array/index-of":["es.typed-array.index-of"],"core-js/features/typed-array/int16-array":["es.object.to-string","es.typed-array.int16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/int32-array":["es.object.to-string","es.typed-array.int32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/int8-array":["es.object.to-string","es.typed-array.int8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/iterator":["es.typed-array.iterator"],"core-js/features/typed-array/join":["es.typed-array.join"],"core-js/features/typed-array/keys":["es.typed-array.iterator"],"core-js/features/typed-array/last-index-of":["es.typed-array.last-index-of"],"core-js/features/typed-array/map":["es.typed-array.map"],"core-js/features/typed-array/of":["es.typed-array.of"],"core-js/features/typed-array/reduce":["es.typed-array.reduce"],"core-js/features/typed-array/reduce-right":["es.typed-array.reduce-right"],"core-js/features/typed-array/reverse":["es.typed-array.reverse"],"core-js/features/typed-array/set":["es.typed-array.set"],"core-js/features/typed-array/slice":["es.typed-array.slice"],"core-js/features/typed-array/some":["es.typed-array.some"],"core-js/features/typed-array/sort":["es.typed-array.sort"],"core-js/features/typed-array/subarray":["es.typed-array.subarray"],"core-js/features/typed-array/to-locale-string":["es.typed-array.to-locale-string"],"core-js/features/typed-array/to-string":["es.typed-array.to-string"],"core-js/features/typed-array/uint16-array":["es.object.to-string","es.typed-array.uint16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/uint32-array":["es.object.to-string","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/uint8-array":["es.object.to-string","es.typed-array.uint8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/uint8-clamped-array":["es.object.to-string","es.typed-array.uint8-clamped-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/features/typed-array/unique-by":["es.map","esnext.typed-array.unique-by"],"core-js/features/typed-array/values":["es.typed-array.iterator"],"core-js/features/url":["web.url","web.url.to-json","web.url-search-params"],"core-js/features/url-search-params":["web.url-search-params"],"core-js/features/url/to-json":["web.url.to-json"],"core-js/features/weak-map":["es.object.to-string","es.weak-map","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","web.dom-collections.iterator"],"core-js/features/weak-map/delete-all":["es.weak-map","esnext.weak-map.delete-all"],"core-js/features/weak-map/emplace":["es.weak-map","esnext.weak-map.emplace"],"core-js/features/weak-map/from":["es.string.iterator","es.weak-map","esnext.weak-map.from","web.dom-collections.iterator"],"core-js/features/weak-map/of":["es.string.iterator","es.weak-map","esnext.weak-map.of","web.dom-collections.iterator"],"core-js/features/weak-map/upsert":["es.weak-map","esnext.weak-map.upsert"],"core-js/features/weak-set":["es.object.to-string","es.weak-set","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.iterator"],"core-js/features/weak-set/add-all":["es.weak-set","esnext.weak-set.add-all"],"core-js/features/weak-set/delete-all":["es.weak-set","esnext.weak-set.delete-all"],"core-js/features/weak-set/from":["es.string.iterator","es.weak-set","esnext.weak-set.from","web.dom-collections.iterator"],"core-js/features/weak-set/of":["es.string.iterator","es.weak-set","esnext.weak-set.of","web.dom-collections.iterator"],"core-js/modules/es.aggregate-error":["es.aggregate-error"],"core-js/modules/es.array-buffer.constructor":["es.array-buffer.constructor"],"core-js/modules/es.array-buffer.is-view":["es.array-buffer.is-view"],"core-js/modules/es.array-buffer.slice":["es.array-buffer.slice"],"core-js/modules/es.array.concat":["es.array.concat"],"core-js/modules/es.array.copy-within":["es.array.copy-within"],"core-js/modules/es.array.every":["es.array.every"],"core-js/modules/es.array.fill":["es.array.fill"],"core-js/modules/es.array.filter":["es.array.filter"],"core-js/modules/es.array.find":["es.array.find"],"core-js/modules/es.array.find-index":["es.array.find-index"],"core-js/modules/es.array.flat":["es.array.flat"],"core-js/modules/es.array.flat-map":["es.array.flat-map"],"core-js/modules/es.array.for-each":["es.array.for-each"],"core-js/modules/es.array.from":["es.array.from"],"core-js/modules/es.array.includes":["es.array.includes"],"core-js/modules/es.array.index-of":["es.array.index-of"],"core-js/modules/es.array.is-array":["es.array.is-array"],"core-js/modules/es.array.iterator":["es.array.iterator"],"core-js/modules/es.array.join":["es.array.join"],"core-js/modules/es.array.last-index-of":["es.array.last-index-of"],"core-js/modules/es.array.map":["es.array.map"],"core-js/modules/es.array.of":["es.array.of"],"core-js/modules/es.array.reduce":["es.array.reduce"],"core-js/modules/es.array.reduce-right":["es.array.reduce-right"],"core-js/modules/es.array.reverse":["es.array.reverse"],"core-js/modules/es.array.slice":["es.array.slice"],"core-js/modules/es.array.some":["es.array.some"],"core-js/modules/es.array.sort":["es.array.sort"],"core-js/modules/es.array.species":["es.array.species"],"core-js/modules/es.array.splice":["es.array.splice"],"core-js/modules/es.array.unscopables.flat":["es.array.unscopables.flat"],"core-js/modules/es.array.unscopables.flat-map":["es.array.unscopables.flat-map"],"core-js/modules/es.data-view":["es.data-view"],"core-js/modules/es.date.now":["es.date.now"],"core-js/modules/es.date.to-iso-string":["es.date.to-iso-string"],"core-js/modules/es.date.to-json":["es.date.to-json"],"core-js/modules/es.date.to-primitive":["es.date.to-primitive"],"core-js/modules/es.date.to-string":["es.date.to-string"],"core-js/modules/es.function.bind":["es.function.bind"],"core-js/modules/es.function.has-instance":["es.function.has-instance"],"core-js/modules/es.function.name":["es.function.name"],"core-js/modules/es.global-this":["es.global-this"],"core-js/modules/es.json.stringify":["es.json.stringify"],"core-js/modules/es.json.to-string-tag":["es.json.to-string-tag"],"core-js/modules/es.map":["es.map"],"core-js/modules/es.math.acosh":["es.math.acosh"],"core-js/modules/es.math.asinh":["es.math.asinh"],"core-js/modules/es.math.atanh":["es.math.atanh"],"core-js/modules/es.math.cbrt":["es.math.cbrt"],"core-js/modules/es.math.clz32":["es.math.clz32"],"core-js/modules/es.math.cosh":["es.math.cosh"],"core-js/modules/es.math.expm1":["es.math.expm1"],"core-js/modules/es.math.fround":["es.math.fround"],"core-js/modules/es.math.hypot":["es.math.hypot"],"core-js/modules/es.math.imul":["es.math.imul"],"core-js/modules/es.math.log10":["es.math.log10"],"core-js/modules/es.math.log1p":["es.math.log1p"],"core-js/modules/es.math.log2":["es.math.log2"],"core-js/modules/es.math.sign":["es.math.sign"],"core-js/modules/es.math.sinh":["es.math.sinh"],"core-js/modules/es.math.tanh":["es.math.tanh"],"core-js/modules/es.math.to-string-tag":["es.math.to-string-tag"],"core-js/modules/es.math.trunc":["es.math.trunc"],"core-js/modules/es.number.constructor":["es.number.constructor"],"core-js/modules/es.number.epsilon":["es.number.epsilon"],"core-js/modules/es.number.is-finite":["es.number.is-finite"],"core-js/modules/es.number.is-integer":["es.number.is-integer"],"core-js/modules/es.number.is-nan":["es.number.is-nan"],"core-js/modules/es.number.is-safe-integer":["es.number.is-safe-integer"],"core-js/modules/es.number.max-safe-integer":["es.number.max-safe-integer"],"core-js/modules/es.number.min-safe-integer":["es.number.min-safe-integer"],"core-js/modules/es.number.parse-float":["es.number.parse-float"],"core-js/modules/es.number.parse-int":["es.number.parse-int"],"core-js/modules/es.number.to-fixed":["es.number.to-fixed"],"core-js/modules/es.number.to-precision":["es.number.to-precision"],"core-js/modules/es.object.assign":["es.object.assign"],"core-js/modules/es.object.create":["es.object.create"],"core-js/modules/es.object.define-getter":["es.object.define-getter"],"core-js/modules/es.object.define-properties":["es.object.define-properties"],"core-js/modules/es.object.define-property":["es.object.define-property"],"core-js/modules/es.object.define-setter":["es.object.define-setter"],"core-js/modules/es.object.entries":["es.object.entries"],"core-js/modules/es.object.freeze":["es.object.freeze"],"core-js/modules/es.object.from-entries":["es.object.from-entries"],"core-js/modules/es.object.get-own-property-descriptor":["es.object.get-own-property-descriptor"],"core-js/modules/es.object.get-own-property-descriptors":["es.object.get-own-property-descriptors"],"core-js/modules/es.object.get-own-property-names":["es.object.get-own-property-names"],"core-js/modules/es.object.get-prototype-of":["es.object.get-prototype-of"],"core-js/modules/es.object.is":["es.object.is"],"core-js/modules/es.object.is-extensible":["es.object.is-extensible"],"core-js/modules/es.object.is-frozen":["es.object.is-frozen"],"core-js/modules/es.object.is-sealed":["es.object.is-sealed"],"core-js/modules/es.object.keys":["es.object.keys"],"core-js/modules/es.object.lookup-getter":["es.object.lookup-getter"],"core-js/modules/es.object.lookup-setter":["es.object.lookup-setter"],"core-js/modules/es.object.prevent-extensions":["es.object.prevent-extensions"],"core-js/modules/es.object.seal":["es.object.seal"],"core-js/modules/es.object.set-prototype-of":["es.object.set-prototype-of"],"core-js/modules/es.object.to-string":["es.object.to-string"],"core-js/modules/es.object.values":["es.object.values"],"core-js/modules/es.parse-float":["es.parse-float"],"core-js/modules/es.parse-int":["es.parse-int"],"core-js/modules/es.promise":["es.promise"],"core-js/modules/es.promise.all-settled":["es.promise.all-settled"],"core-js/modules/es.promise.any":["es.promise.any"],"core-js/modules/es.promise.finally":["es.promise.finally"],"core-js/modules/es.reflect.apply":["es.reflect.apply"],"core-js/modules/es.reflect.construct":["es.reflect.construct"],"core-js/modules/es.reflect.define-property":["es.reflect.define-property"],"core-js/modules/es.reflect.delete-property":["es.reflect.delete-property"],"core-js/modules/es.reflect.get":["es.reflect.get"],"core-js/modules/es.reflect.get-own-property-descriptor":["es.reflect.get-own-property-descriptor"],"core-js/modules/es.reflect.get-prototype-of":["es.reflect.get-prototype-of"],"core-js/modules/es.reflect.has":["es.reflect.has"],"core-js/modules/es.reflect.is-extensible":["es.reflect.is-extensible"],"core-js/modules/es.reflect.own-keys":["es.reflect.own-keys"],"core-js/modules/es.reflect.prevent-extensions":["es.reflect.prevent-extensions"],"core-js/modules/es.reflect.set":["es.reflect.set"],"core-js/modules/es.reflect.set-prototype-of":["es.reflect.set-prototype-of"],"core-js/modules/es.reflect.to-string-tag":["es.reflect.to-string-tag"],"core-js/modules/es.regexp.constructor":["es.regexp.constructor"],"core-js/modules/es.regexp.exec":["es.regexp.exec"],"core-js/modules/es.regexp.flags":["es.regexp.flags"],"core-js/modules/es.regexp.sticky":["es.regexp.sticky"],"core-js/modules/es.regexp.test":["es.regexp.test"],"core-js/modules/es.regexp.to-string":["es.regexp.to-string"],"core-js/modules/es.set":["es.set"],"core-js/modules/es.string.anchor":["es.string.anchor"],"core-js/modules/es.string.big":["es.string.big"],"core-js/modules/es.string.blink":["es.string.blink"],"core-js/modules/es.string.bold":["es.string.bold"],"core-js/modules/es.string.code-point-at":["es.string.code-point-at"],"core-js/modules/es.string.ends-with":["es.string.ends-with"],"core-js/modules/es.string.fixed":["es.string.fixed"],"core-js/modules/es.string.fontcolor":["es.string.fontcolor"],"core-js/modules/es.string.fontsize":["es.string.fontsize"],"core-js/modules/es.string.from-code-point":["es.string.from-code-point"],"core-js/modules/es.string.includes":["es.string.includes"],"core-js/modules/es.string.italics":["es.string.italics"],"core-js/modules/es.string.iterator":["es.string.iterator"],"core-js/modules/es.string.link":["es.string.link"],"core-js/modules/es.string.match":["es.string.match"],"core-js/modules/es.string.match-all":["es.string.match-all"],"core-js/modules/es.string.pad-end":["es.string.pad-end"],"core-js/modules/es.string.pad-start":["es.string.pad-start"],"core-js/modules/es.string.raw":["es.string.raw"],"core-js/modules/es.string.repeat":["es.string.repeat"],"core-js/modules/es.string.replace":["es.string.replace"],"core-js/modules/es.string.replace-all":["es.string.replace-all"],"core-js/modules/es.string.search":["es.string.search"],"core-js/modules/es.string.small":["es.string.small"],"core-js/modules/es.string.split":["es.string.split"],"core-js/modules/es.string.starts-with":["es.string.starts-with"],"core-js/modules/es.string.strike":["es.string.strike"],"core-js/modules/es.string.sub":["es.string.sub"],"core-js/modules/es.string.sup":["es.string.sup"],"core-js/modules/es.string.trim":["es.string.trim"],"core-js/modules/es.string.trim-end":["es.string.trim-end"],"core-js/modules/es.string.trim-start":["es.string.trim-start"],"core-js/modules/es.symbol":["es.symbol"],"core-js/modules/es.symbol.async-iterator":["es.symbol.async-iterator"],"core-js/modules/es.symbol.description":["es.symbol.description"],"core-js/modules/es.symbol.has-instance":["es.symbol.has-instance"],"core-js/modules/es.symbol.is-concat-spreadable":["es.symbol.is-concat-spreadable"],"core-js/modules/es.symbol.iterator":["es.symbol.iterator"],"core-js/modules/es.symbol.match":["es.symbol.match"],"core-js/modules/es.symbol.match-all":["es.symbol.match-all"],"core-js/modules/es.symbol.replace":["es.symbol.replace"],"core-js/modules/es.symbol.search":["es.symbol.search"],"core-js/modules/es.symbol.species":["es.symbol.species"],"core-js/modules/es.symbol.split":["es.symbol.split"],"core-js/modules/es.symbol.to-primitive":["es.symbol.to-primitive"],"core-js/modules/es.symbol.to-string-tag":["es.symbol.to-string-tag"],"core-js/modules/es.symbol.unscopables":["es.symbol.unscopables"],"core-js/modules/es.typed-array.copy-within":["es.typed-array.copy-within"],"core-js/modules/es.typed-array.every":["es.typed-array.every"],"core-js/modules/es.typed-array.fill":["es.typed-array.fill"],"core-js/modules/es.typed-array.filter":["es.typed-array.filter"],"core-js/modules/es.typed-array.find":["es.typed-array.find"],"core-js/modules/es.typed-array.find-index":["es.typed-array.find-index"],"core-js/modules/es.typed-array.float32-array":["es.typed-array.float32-array"],"core-js/modules/es.typed-array.float64-array":["es.typed-array.float64-array"],"core-js/modules/es.typed-array.for-each":["es.typed-array.for-each"],"core-js/modules/es.typed-array.from":["es.typed-array.from"],"core-js/modules/es.typed-array.includes":["es.typed-array.includes"],"core-js/modules/es.typed-array.index-of":["es.typed-array.index-of"],"core-js/modules/es.typed-array.int16-array":["es.typed-array.int16-array"],"core-js/modules/es.typed-array.int32-array":["es.typed-array.int32-array"],"core-js/modules/es.typed-array.int8-array":["es.typed-array.int8-array"],"core-js/modules/es.typed-array.iterator":["es.typed-array.iterator"],"core-js/modules/es.typed-array.join":["es.typed-array.join"],"core-js/modules/es.typed-array.last-index-of":["es.typed-array.last-index-of"],"core-js/modules/es.typed-array.map":["es.typed-array.map"],"core-js/modules/es.typed-array.of":["es.typed-array.of"],"core-js/modules/es.typed-array.reduce":["es.typed-array.reduce"],"core-js/modules/es.typed-array.reduce-right":["es.typed-array.reduce-right"],"core-js/modules/es.typed-array.reverse":["es.typed-array.reverse"],"core-js/modules/es.typed-array.set":["es.typed-array.set"],"core-js/modules/es.typed-array.slice":["es.typed-array.slice"],"core-js/modules/es.typed-array.some":["es.typed-array.some"],"core-js/modules/es.typed-array.sort":["es.typed-array.sort"],"core-js/modules/es.typed-array.subarray":["es.typed-array.subarray"],"core-js/modules/es.typed-array.to-locale-string":["es.typed-array.to-locale-string"],"core-js/modules/es.typed-array.to-string":["es.typed-array.to-string"],"core-js/modules/es.typed-array.uint16-array":["es.typed-array.uint16-array"],"core-js/modules/es.typed-array.uint32-array":["es.typed-array.uint32-array"],"core-js/modules/es.typed-array.uint8-array":["es.typed-array.uint8-array"],"core-js/modules/es.typed-array.uint8-clamped-array":["es.typed-array.uint8-clamped-array"],"core-js/modules/es.weak-map":["es.weak-map"],"core-js/modules/es.weak-set":["es.weak-set"],"core-js/modules/esnext.aggregate-error":["esnext.aggregate-error"],"core-js/modules/esnext.array.at":["esnext.array.at"],"core-js/modules/esnext.array.filter-out":["esnext.array.filter-out"],"core-js/modules/esnext.array.find-last":["esnext.array.find-last"],"core-js/modules/esnext.array.find-last-index":["esnext.array.find-last-index"],"core-js/modules/esnext.array.is-template-object":["esnext.array.is-template-object"],"core-js/modules/esnext.array.last-index":["esnext.array.last-index"],"core-js/modules/esnext.array.last-item":["esnext.array.last-item"],"core-js/modules/esnext.array.unique-by":["esnext.array.unique-by"],"core-js/modules/esnext.async-iterator.as-indexed-pairs":["esnext.async-iterator.as-indexed-pairs"],"core-js/modules/esnext.async-iterator.constructor":["esnext.async-iterator.constructor"],"core-js/modules/esnext.async-iterator.drop":["esnext.async-iterator.drop"],"core-js/modules/esnext.async-iterator.every":["esnext.async-iterator.every"],"core-js/modules/esnext.async-iterator.filter":["esnext.async-iterator.filter"],"core-js/modules/esnext.async-iterator.find":["esnext.async-iterator.find"],"core-js/modules/esnext.async-iterator.flat-map":["esnext.async-iterator.flat-map"],"core-js/modules/esnext.async-iterator.for-each":["esnext.async-iterator.for-each"],"core-js/modules/esnext.async-iterator.from":["esnext.async-iterator.from"],"core-js/modules/esnext.async-iterator.map":["esnext.async-iterator.map"],"core-js/modules/esnext.async-iterator.reduce":["esnext.async-iterator.reduce"],"core-js/modules/esnext.async-iterator.some":["esnext.async-iterator.some"],"core-js/modules/esnext.async-iterator.take":["esnext.async-iterator.take"],"core-js/modules/esnext.async-iterator.to-array":["esnext.async-iterator.to-array"],"core-js/modules/esnext.bigint.range":["esnext.bigint.range"],"core-js/modules/esnext.composite-key":["esnext.composite-key"],"core-js/modules/esnext.composite-symbol":["esnext.composite-symbol"],"core-js/modules/esnext.global-this":["esnext.global-this"],"core-js/modules/esnext.iterator.as-indexed-pairs":["esnext.iterator.as-indexed-pairs"],"core-js/modules/esnext.iterator.constructor":["esnext.iterator.constructor"],"core-js/modules/esnext.iterator.drop":["esnext.iterator.drop"],"core-js/modules/esnext.iterator.every":["esnext.iterator.every"],"core-js/modules/esnext.iterator.filter":["esnext.iterator.filter"],"core-js/modules/esnext.iterator.find":["esnext.iterator.find"],"core-js/modules/esnext.iterator.flat-map":["esnext.iterator.flat-map"],"core-js/modules/esnext.iterator.for-each":["esnext.iterator.for-each"],"core-js/modules/esnext.iterator.from":["esnext.iterator.from"],"core-js/modules/esnext.iterator.map":["esnext.iterator.map"],"core-js/modules/esnext.iterator.reduce":["esnext.iterator.reduce"],"core-js/modules/esnext.iterator.some":["esnext.iterator.some"],"core-js/modules/esnext.iterator.take":["esnext.iterator.take"],"core-js/modules/esnext.iterator.to-array":["esnext.iterator.to-array"],"core-js/modules/esnext.map.delete-all":["esnext.map.delete-all"],"core-js/modules/esnext.map.emplace":["esnext.map.emplace"],"core-js/modules/esnext.map.every":["esnext.map.every"],"core-js/modules/esnext.map.filter":["esnext.map.filter"],"core-js/modules/esnext.map.find":["esnext.map.find"],"core-js/modules/esnext.map.find-key":["esnext.map.find-key"],"core-js/modules/esnext.map.from":["esnext.map.from"],"core-js/modules/esnext.map.group-by":["esnext.map.group-by"],"core-js/modules/esnext.map.includes":["esnext.map.includes"],"core-js/modules/esnext.map.key-by":["esnext.map.key-by"],"core-js/modules/esnext.map.key-of":["esnext.map.key-of"],"core-js/modules/esnext.map.map-keys":["esnext.map.map-keys"],"core-js/modules/esnext.map.map-values":["esnext.map.map-values"],"core-js/modules/esnext.map.merge":["esnext.map.merge"],"core-js/modules/esnext.map.of":["esnext.map.of"],"core-js/modules/esnext.map.reduce":["esnext.map.reduce"],"core-js/modules/esnext.map.some":["esnext.map.some"],"core-js/modules/esnext.map.update":["esnext.map.update"],"core-js/modules/esnext.map.update-or-insert":["esnext.map.update-or-insert"],"core-js/modules/esnext.map.upsert":["esnext.map.upsert"],"core-js/modules/esnext.math.clamp":["esnext.math.clamp"],"core-js/modules/esnext.math.deg-per-rad":["esnext.math.deg-per-rad"],"core-js/modules/esnext.math.degrees":["esnext.math.degrees"],"core-js/modules/esnext.math.fscale":["esnext.math.fscale"],"core-js/modules/esnext.math.iaddh":["esnext.math.iaddh"],"core-js/modules/esnext.math.imulh":["esnext.math.imulh"],"core-js/modules/esnext.math.isubh":["esnext.math.isubh"],"core-js/modules/esnext.math.rad-per-deg":["esnext.math.rad-per-deg"],"core-js/modules/esnext.math.radians":["esnext.math.radians"],"core-js/modules/esnext.math.scale":["esnext.math.scale"],"core-js/modules/esnext.math.seeded-prng":["esnext.math.seeded-prng"],"core-js/modules/esnext.math.signbit":["esnext.math.signbit"],"core-js/modules/esnext.math.umulh":["esnext.math.umulh"],"core-js/modules/esnext.number.from-string":["esnext.number.from-string"],"core-js/modules/esnext.number.range":["esnext.number.range"],"core-js/modules/esnext.object.has-own":["esnext.object.has-own"],"core-js/modules/esnext.object.iterate-entries":["esnext.object.iterate-entries"],"core-js/modules/esnext.object.iterate-keys":["esnext.object.iterate-keys"],"core-js/modules/esnext.object.iterate-values":["esnext.object.iterate-values"],"core-js/modules/esnext.observable":["esnext.observable"],"core-js/modules/esnext.promise.all-settled":["esnext.promise.all-settled"],"core-js/modules/esnext.promise.any":["esnext.promise.any"],"core-js/modules/esnext.promise.try":["esnext.promise.try"],"core-js/modules/esnext.reflect.define-metadata":["esnext.reflect.define-metadata"],"core-js/modules/esnext.reflect.delete-metadata":["esnext.reflect.delete-metadata"],"core-js/modules/esnext.reflect.get-metadata":["esnext.reflect.get-metadata"],"core-js/modules/esnext.reflect.get-metadata-keys":["esnext.reflect.get-metadata-keys"],"core-js/modules/esnext.reflect.get-own-metadata":["esnext.reflect.get-own-metadata"],"core-js/modules/esnext.reflect.get-own-metadata-keys":["esnext.reflect.get-own-metadata-keys"],"core-js/modules/esnext.reflect.has-metadata":["esnext.reflect.has-metadata"],"core-js/modules/esnext.reflect.has-own-metadata":["esnext.reflect.has-own-metadata"],"core-js/modules/esnext.reflect.metadata":["esnext.reflect.metadata"],"core-js/modules/esnext.set.add-all":["esnext.set.add-all"],"core-js/modules/esnext.set.delete-all":["esnext.set.delete-all"],"core-js/modules/esnext.set.difference":["esnext.set.difference"],"core-js/modules/esnext.set.every":["esnext.set.every"],"core-js/modules/esnext.set.filter":["esnext.set.filter"],"core-js/modules/esnext.set.find":["esnext.set.find"],"core-js/modules/esnext.set.from":["esnext.set.from"],"core-js/modules/esnext.set.intersection":["esnext.set.intersection"],"core-js/modules/esnext.set.is-disjoint-from":["esnext.set.is-disjoint-from"],"core-js/modules/esnext.set.is-subset-of":["esnext.set.is-subset-of"],"core-js/modules/esnext.set.is-superset-of":["esnext.set.is-superset-of"],"core-js/modules/esnext.set.join":["esnext.set.join"],"core-js/modules/esnext.set.map":["esnext.set.map"],"core-js/modules/esnext.set.of":["esnext.set.of"],"core-js/modules/esnext.set.reduce":["esnext.set.reduce"],"core-js/modules/esnext.set.some":["esnext.set.some"],"core-js/modules/esnext.set.symmetric-difference":["esnext.set.symmetric-difference"],"core-js/modules/esnext.set.union":["esnext.set.union"],"core-js/modules/esnext.string.at":["esnext.string.at"],"core-js/modules/esnext.string.at-alternative":["esnext.string.at-alternative"],"core-js/modules/esnext.string.code-points":["esnext.string.code-points"],"core-js/modules/esnext.string.match-all":["esnext.string.match-all"],"core-js/modules/esnext.string.replace-all":["esnext.string.replace-all"],"core-js/modules/esnext.symbol.async-dispose":["esnext.symbol.async-dispose"],"core-js/modules/esnext.symbol.dispose":["esnext.symbol.dispose"],"core-js/modules/esnext.symbol.matcher":["esnext.symbol.matcher"],"core-js/modules/esnext.symbol.metadata":["esnext.symbol.metadata"],"core-js/modules/esnext.symbol.observable":["esnext.symbol.observable"],"core-js/modules/esnext.symbol.pattern-match":["esnext.symbol.pattern-match"],"core-js/modules/esnext.symbol.replace-all":["esnext.symbol.replace-all"],"core-js/modules/esnext.typed-array.at":["esnext.typed-array.at"],"core-js/modules/esnext.typed-array.filter-out":["esnext.typed-array.filter-out"],"core-js/modules/esnext.typed-array.find-last":["esnext.typed-array.find-last"],"core-js/modules/esnext.typed-array.find-last-index":["esnext.typed-array.find-last-index"],"core-js/modules/esnext.typed-array.unique-by":["esnext.typed-array.unique-by"],"core-js/modules/esnext.weak-map.delete-all":["esnext.weak-map.delete-all"],"core-js/modules/esnext.weak-map.emplace":["esnext.weak-map.emplace"],"core-js/modules/esnext.weak-map.from":["esnext.weak-map.from"],"core-js/modules/esnext.weak-map.of":["esnext.weak-map.of"],"core-js/modules/esnext.weak-map.upsert":["esnext.weak-map.upsert"],"core-js/modules/esnext.weak-set.add-all":["esnext.weak-set.add-all"],"core-js/modules/esnext.weak-set.delete-all":["esnext.weak-set.delete-all"],"core-js/modules/esnext.weak-set.from":["esnext.weak-set.from"],"core-js/modules/esnext.weak-set.of":["esnext.weak-set.of"],"core-js/modules/web.dom-collections.for-each":["web.dom-collections.for-each"],"core-js/modules/web.dom-collections.iterator":["web.dom-collections.iterator"],"core-js/modules/web.immediate":["web.immediate"],"core-js/modules/web.queue-microtask":["web.queue-microtask"],"core-js/modules/web.timers":["web.timers"],"core-js/modules/web.url":["web.url"],"core-js/modules/web.url-search-params":["web.url-search-params"],"core-js/modules/web.url.to-json":["web.url.to-json"],"core-js/proposals":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.url","web.url.to-json","web.url-search-params"],"core-js/proposals/accessible-object-hasownproperty":["esnext.object.has-own"],"core-js/proposals/array-filtering":["esnext.array.filter-out","esnext.typed-array.filter-out"],"core-js/proposals/array-find-from-last":["esnext.array.find-last","esnext.array.find-last-index","esnext.typed-array.find-last","esnext.typed-array.find-last-index"],"core-js/proposals/array-is-template-object":["esnext.array.is-template-object"],"core-js/proposals/array-last":["esnext.array.last-index","esnext.array.last-item"],"core-js/proposals/array-unique":["es.map","esnext.array.unique-by","esnext.typed-array.unique-by"],"core-js/proposals/collection-methods":["esnext.map.delete-all","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.set.add-all","esnext.set.delete-all","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.join","esnext.set.map","esnext.set.reduce","esnext.set.some","esnext.weak-map.delete-all","esnext.weak-set.add-all","esnext.weak-set.delete-all"],"core-js/proposals/collection-of-from":["esnext.map.from","esnext.map.of","esnext.set.from","esnext.set.of","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-set.from","esnext.weak-set.of"],"core-js/proposals/decorators":["esnext.symbol.metadata"],"core-js/proposals/efficient-64-bit-arithmetic":["esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.umulh"],"core-js/proposals/global-this":["esnext.global-this"],"core-js/proposals/iterator-helpers":["esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array"],"core-js/proposals/keys-composition":["esnext.composite-key","esnext.composite-symbol"],"core-js/proposals/map-update-or-insert":["esnext.map.emplace","esnext.map.update-or-insert","esnext.map.upsert","esnext.weak-map.emplace","esnext.weak-map.upsert"],"core-js/proposals/map-upsert":["esnext.map.emplace","esnext.map.update-or-insert","esnext.map.upsert","esnext.weak-map.emplace","esnext.weak-map.upsert"],"core-js/proposals/math-extensions":["esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale"],"core-js/proposals/math-signbit":["esnext.math.signbit"],"core-js/proposals/number-from-string":["esnext.number.from-string"],"core-js/proposals/number-range":["esnext.bigint.range","esnext.number.range"],"core-js/proposals/object-iteration":["esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values"],"core-js/proposals/observable":["esnext.observable","esnext.symbol.observable"],"core-js/proposals/pattern-matching":["esnext.symbol.matcher","esnext.symbol.pattern-match"],"core-js/proposals/promise-all-settled":["esnext.promise.all-settled"],"core-js/proposals/promise-any":["esnext.aggregate-error","esnext.promise.any"],"core-js/proposals/promise-try":["esnext.promise.try"],"core-js/proposals/reflect-metadata":["esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata"],"core-js/proposals/relative-indexing-method":["esnext.array.at","esnext.typed-array.at"],"core-js/proposals/seeded-random":["esnext.math.seeded-prng"],"core-js/proposals/set-methods":["esnext.set.difference","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.symmetric-difference","esnext.set.union"],"core-js/proposals/string-at":["esnext.string.at"],"core-js/proposals/string-code-points":["esnext.string.code-points"],"core-js/proposals/string-match-all":["esnext.string.match-all"],"core-js/proposals/string-replace-all":["esnext.string.replace-all","esnext.symbol.replace-all"],"core-js/proposals/url":["web.url","web.url.to-json","web.url-search-params"],"core-js/proposals/using-statement":["esnext.symbol.async-dispose","esnext.symbol.dispose"],"core-js/stable":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"core-js/stable/aggregate-error":["es.aggregate-error","es.string.iterator","esnext.aggregate-error","web.dom-collections.iterator"],"core-js/stable/array":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.string.iterator"],"core-js/stable/array-buffer":["es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.object.to-string"],"core-js/stable/array-buffer/constructor":["es.array-buffer.constructor","es.object.to-string"],"core-js/stable/array-buffer/is-view":["es.array-buffer.is-view"],"core-js/stable/array-buffer/slice":["es.array-buffer.slice"],"core-js/stable/array/concat":["es.array.concat"],"core-js/stable/array/copy-within":["es.array.copy-within"],"core-js/stable/array/entries":["es.array.iterator"],"core-js/stable/array/every":["es.array.every"],"core-js/stable/array/fill":["es.array.fill"],"core-js/stable/array/filter":["es.array.filter"],"core-js/stable/array/find":["es.array.find"],"core-js/stable/array/find-index":["es.array.find-index"],"core-js/stable/array/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/stable/array/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/stable/array/for-each":["es.array.for-each"],"core-js/stable/array/from":["es.array.from","es.string.iterator"],"core-js/stable/array/includes":["es.array.includes"],"core-js/stable/array/index-of":["es.array.index-of"],"core-js/stable/array/is-array":["es.array.is-array"],"core-js/stable/array/iterator":["es.array.iterator"],"core-js/stable/array/join":["es.array.join"],"core-js/stable/array/keys":["es.array.iterator"],"core-js/stable/array/last-index-of":["es.array.last-index-of"],"core-js/stable/array/map":["es.array.map"],"core-js/stable/array/of":["es.array.of"],"core-js/stable/array/reduce":["es.array.reduce"],"core-js/stable/array/reduce-right":["es.array.reduce-right"],"core-js/stable/array/reverse":["es.array.reverse"],"core-js/stable/array/slice":["es.array.slice"],"core-js/stable/array/some":["es.array.some"],"core-js/stable/array/sort":["es.array.sort"],"core-js/stable/array/splice":["es.array.splice"],"core-js/stable/array/values":["es.array.iterator"],"core-js/stable/array/virtual":["es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.includes","es.array.index-of","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map"],"core-js/stable/array/virtual/concat":["es.array.concat"],"core-js/stable/array/virtual/copy-within":["es.array.copy-within"],"core-js/stable/array/virtual/entries":["es.array.iterator"],"core-js/stable/array/virtual/every":["es.array.every"],"core-js/stable/array/virtual/fill":["es.array.fill"],"core-js/stable/array/virtual/filter":["es.array.filter"],"core-js/stable/array/virtual/find":["es.array.find"],"core-js/stable/array/virtual/find-index":["es.array.find-index"],"core-js/stable/array/virtual/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/stable/array/virtual/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/stable/array/virtual/for-each":["es.array.for-each"],"core-js/stable/array/virtual/includes":["es.array.includes"],"core-js/stable/array/virtual/index-of":["es.array.index-of"],"core-js/stable/array/virtual/iterator":["es.array.iterator"],"core-js/stable/array/virtual/join":["es.array.join"],"core-js/stable/array/virtual/keys":["es.array.iterator"],"core-js/stable/array/virtual/last-index-of":["es.array.last-index-of"],"core-js/stable/array/virtual/map":["es.array.map"],"core-js/stable/array/virtual/reduce":["es.array.reduce"],"core-js/stable/array/virtual/reduce-right":["es.array.reduce-right"],"core-js/stable/array/virtual/reverse":["es.array.reverse"],"core-js/stable/array/virtual/slice":["es.array.slice"],"core-js/stable/array/virtual/some":["es.array.some"],"core-js/stable/array/virtual/sort":["es.array.sort"],"core-js/stable/array/virtual/splice":["es.array.splice"],"core-js/stable/array/virtual/values":["es.array.iterator"],"core-js/stable/clear-immediate":["web.immediate"],"core-js/stable/data-view":["es.data-view","es.object.to-string"],"core-js/stable/date":["es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string"],"core-js/stable/date/now":["es.date.now"],"core-js/stable/date/to-iso-string":["es.date.to-iso-string","es.date.to-json"],"core-js/stable/date/to-json":["es.date.to-json"],"core-js/stable/date/to-primitive":["es.date.to-primitive"],"core-js/stable/date/to-string":["es.date.to-string"],"core-js/stable/dom-collections":["es.array.iterator","web.dom-collections.for-each","web.dom-collections.iterator"],"core-js/stable/dom-collections/for-each":["web.dom-collections.for-each"],"core-js/stable/dom-collections/iterator":["web.dom-collections.iterator"],"core-js/stable/function":["es.function.bind","es.function.has-instance","es.function.name"],"core-js/stable/function/bind":["es.function.bind"],"core-js/stable/function/has-instance":["es.function.has-instance"],"core-js/stable/function/name":["es.function.name"],"core-js/stable/function/virtual":["es.function.bind"],"core-js/stable/function/virtual/bind":["es.function.bind"],"core-js/stable/global-this":["es.global-this"],"core-js/stable/instance/bind":["es.function.bind"],"core-js/stable/instance/code-point-at":["es.string.code-point-at"],"core-js/stable/instance/concat":["es.array.concat"],"core-js/stable/instance/copy-within":["es.array.copy-within"],"core-js/stable/instance/ends-with":["es.string.ends-with"],"core-js/stable/instance/entries":["es.array.iterator","web.dom-collections.iterator"],"core-js/stable/instance/every":["es.array.every"],"core-js/stable/instance/fill":["es.array.fill"],"core-js/stable/instance/filter":["es.array.filter"],"core-js/stable/instance/find":["es.array.find"],"core-js/stable/instance/find-index":["es.array.find-index"],"core-js/stable/instance/flags":["es.regexp.flags"],"core-js/stable/instance/flat":["es.array.flat","es.array.unscopables.flat"],"core-js/stable/instance/flat-map":["es.array.flat-map","es.array.unscopables.flat-map"],"core-js/stable/instance/for-each":["es.array.for-each","web.dom-collections.iterator"],"core-js/stable/instance/includes":["es.array.includes","es.string.includes"],"core-js/stable/instance/index-of":["es.array.index-of"],"core-js/stable/instance/keys":["es.array.iterator","web.dom-collections.iterator"],"core-js/stable/instance/last-index-of":["es.array.last-index-of"],"core-js/stable/instance/map":["es.array.map"],"core-js/stable/instance/match-all":["es.string.match-all"],"core-js/stable/instance/pad-end":["es.string.pad-end"],"core-js/stable/instance/pad-start":["es.string.pad-start"],"core-js/stable/instance/reduce":["es.array.reduce"],"core-js/stable/instance/reduce-right":["es.array.reduce-right"],"core-js/stable/instance/repeat":["es.string.repeat"],"core-js/stable/instance/replace-all":["es.string.replace-all"],"core-js/stable/instance/reverse":["es.array.reverse"],"core-js/stable/instance/slice":["es.array.slice"],"core-js/stable/instance/some":["es.array.some"],"core-js/stable/instance/sort":["es.array.sort"],"core-js/stable/instance/splice":["es.array.splice"],"core-js/stable/instance/starts-with":["es.string.starts-with"],"core-js/stable/instance/trim":["es.string.trim"],"core-js/stable/instance/trim-end":["es.string.trim-end"],"core-js/stable/instance/trim-left":["es.string.trim-start"],"core-js/stable/instance/trim-right":["es.string.trim-end"],"core-js/stable/instance/trim-start":["es.string.trim-start"],"core-js/stable/instance/values":["es.array.iterator","web.dom-collections.iterator"],"core-js/stable/json":["es.json.stringify","es.json.to-string-tag"],"core-js/stable/json/stringify":["es.json.stringify"],"core-js/stable/json/to-string-tag":["es.json.to-string-tag"],"core-js/stable/map":["es.map","es.object.to-string","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/math":["es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc"],"core-js/stable/math/acosh":["es.math.acosh"],"core-js/stable/math/asinh":["es.math.asinh"],"core-js/stable/math/atanh":["es.math.atanh"],"core-js/stable/math/cbrt":["es.math.cbrt"],"core-js/stable/math/clz32":["es.math.clz32"],"core-js/stable/math/cosh":["es.math.cosh"],"core-js/stable/math/expm1":["es.math.expm1"],"core-js/stable/math/fround":["es.math.fround"],"core-js/stable/math/hypot":["es.math.hypot"],"core-js/stable/math/imul":["es.math.imul"],"core-js/stable/math/log10":["es.math.log10"],"core-js/stable/math/log1p":["es.math.log1p"],"core-js/stable/math/log2":["es.math.log2"],"core-js/stable/math/sign":["es.math.sign"],"core-js/stable/math/sinh":["es.math.sinh"],"core-js/stable/math/tanh":["es.math.tanh"],"core-js/stable/math/to-string-tag":["es.math.to-string-tag"],"core-js/stable/math/trunc":["es.math.trunc"],"core-js/stable/number":["es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision"],"core-js/stable/number/constructor":["es.number.constructor"],"core-js/stable/number/epsilon":["es.number.epsilon"],"core-js/stable/number/is-finite":["es.number.is-finite"],"core-js/stable/number/is-integer":["es.number.is-integer"],"core-js/stable/number/is-nan":["es.number.is-nan"],"core-js/stable/number/is-safe-integer":["es.number.is-safe-integer"],"core-js/stable/number/max-safe-integer":["es.number.max-safe-integer"],"core-js/stable/number/min-safe-integer":["es.number.min-safe-integer"],"core-js/stable/number/parse-float":["es.number.parse-float"],"core-js/stable/number/parse-int":["es.number.parse-int"],"core-js/stable/number/to-fixed":["es.number.to-fixed"],"core-js/stable/number/to-precision":["es.number.to-precision"],"core-js/stable/number/virtual":["es.number.to-fixed","es.number.to-precision"],"core-js/stable/number/virtual/to-fixed":["es.number.to-fixed"],"core-js/stable/number/virtual/to-precision":["es.number.to-precision"],"core-js/stable/object":["es.symbol","es.json.to-string-tag","es.math.to-string-tag","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.reflect.to-string-tag"],"core-js/stable/object/assign":["es.object.assign"],"core-js/stable/object/create":["es.object.create"],"core-js/stable/object/define-getter":["es.object.define-getter"],"core-js/stable/object/define-properties":["es.object.define-properties"],"core-js/stable/object/define-property":["es.object.define-property"],"core-js/stable/object/define-setter":["es.object.define-setter"],"core-js/stable/object/entries":["es.object.entries"],"core-js/stable/object/freeze":["es.object.freeze"],"core-js/stable/object/from-entries":["es.array.iterator","es.object.from-entries"],"core-js/stable/object/get-own-property-descriptor":["es.object.get-own-property-descriptor"],"core-js/stable/object/get-own-property-descriptors":["es.object.get-own-property-descriptors"],"core-js/stable/object/get-own-property-names":["es.object.get-own-property-names"],"core-js/stable/object/get-own-property-symbols":["es.symbol"],"core-js/stable/object/get-prototype-of":["es.object.get-prototype-of"],"core-js/stable/object/is":["es.object.is"],"core-js/stable/object/is-extensible":["es.object.is-extensible"],"core-js/stable/object/is-frozen":["es.object.is-frozen"],"core-js/stable/object/is-sealed":["es.object.is-sealed"],"core-js/stable/object/keys":["es.object.keys"],"core-js/stable/object/lookup-getter":["es.object.lookup-setter"],"core-js/stable/object/lookup-setter":["es.object.lookup-setter"],"core-js/stable/object/prevent-extensions":["es.object.prevent-extensions"],"core-js/stable/object/seal":["es.object.seal"],"core-js/stable/object/set-prototype-of":["es.object.set-prototype-of"],"core-js/stable/object/to-string":["es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/stable/object/values":["es.object.values"],"core-js/stable/parse-float":["es.parse-float"],"core-js/stable/parse-int":["es.parse-int"],"core-js/stable/promise":["es.aggregate-error","es.object.to-string","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/promise/all-settled":["es.promise","es.promise.all-settled","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/promise/any":["es.aggregate-error","es.promise","es.promise.any","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/promise/finally":["es.promise","es.promise.finally"],"core-js/stable/queue-microtask":["web.queue-microtask"],"core-js/stable/reflect":["es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag"],"core-js/stable/reflect/apply":["es.reflect.apply"],"core-js/stable/reflect/construct":["es.reflect.construct"],"core-js/stable/reflect/define-property":["es.reflect.define-property"],"core-js/stable/reflect/delete-property":["es.reflect.delete-property"],"core-js/stable/reflect/get":["es.reflect.get"],"core-js/stable/reflect/get-own-property-descriptor":["es.reflect.get-own-property-descriptor"],"core-js/stable/reflect/get-prototype-of":["es.reflect.get-prototype-of"],"core-js/stable/reflect/has":["es.reflect.has"],"core-js/stable/reflect/is-extensible":["es.reflect.is-extensible"],"core-js/stable/reflect/own-keys":["es.reflect.own-keys"],"core-js/stable/reflect/prevent-extensions":["es.reflect.prevent-extensions"],"core-js/stable/reflect/set":["es.reflect.set"],"core-js/stable/reflect/set-prototype-of":["es.reflect.set-prototype-of"],"core-js/stable/reflect/to-string-tag":["es.reflect.to-string-tag"],"core-js/stable/regexp":["es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.string.match","es.string.replace","es.string.search","es.string.split"],"core-js/stable/regexp/constructor":["es.regexp.constructor"],"core-js/stable/regexp/flags":["es.regexp.flags"],"core-js/stable/regexp/match":["es.string.match"],"core-js/stable/regexp/replace":["es.string.replace"],"core-js/stable/regexp/search":["es.string.search"],"core-js/stable/regexp/split":["es.string.split"],"core-js/stable/regexp/sticky":["es.regexp.sticky"],"core-js/stable/regexp/test":["es.regexp.exec","es.regexp.test"],"core-js/stable/regexp/to-string":["es.regexp.to-string"],"core-js/stable/set":["es.object.to-string","es.set","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/set-immediate":["web.immediate"],"core-js/stable/set-interval":["web.timers"],"core-js/stable/set-timeout":["web.timers"],"core-js/stable/string":["es.regexp.exec","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup"],"core-js/stable/string/anchor":["es.string.anchor"],"core-js/stable/string/big":["es.string.big"],"core-js/stable/string/blink":["es.string.blink"],"core-js/stable/string/bold":["es.string.bold"],"core-js/stable/string/code-point-at":["es.string.code-point-at"],"core-js/stable/string/ends-with":["es.string.ends-with"],"core-js/stable/string/fixed":["es.string.fixed"],"core-js/stable/string/fontcolor":["es.string.fontcolor"],"core-js/stable/string/fontsize":["es.string.fontsize"],"core-js/stable/string/from-code-point":["es.string.from-code-point"],"core-js/stable/string/includes":["es.string.includes"],"core-js/stable/string/italics":["es.string.italics"],"core-js/stable/string/iterator":["es.string.iterator"],"core-js/stable/string/link":["es.string.link"],"core-js/stable/string/match":["es.regexp.exec","es.string.match"],"core-js/stable/string/match-all":["es.string.match-all"],"core-js/stable/string/pad-end":["es.string.pad-end"],"core-js/stable/string/pad-start":["es.string.pad-start"],"core-js/stable/string/raw":["es.string.raw"],"core-js/stable/string/repeat":["es.string.repeat"],"core-js/stable/string/replace":["es.regexp.exec","es.string.replace"],"core-js/stable/string/replace-all":["es.string.replace-all"],"core-js/stable/string/search":["es.regexp.exec","es.string.search"],"core-js/stable/string/small":["es.string.small"],"core-js/stable/string/split":["es.regexp.exec","es.string.split"],"core-js/stable/string/starts-with":["es.string.starts-with"],"core-js/stable/string/strike":["es.string.strike"],"core-js/stable/string/sub":["es.string.sub"],"core-js/stable/string/sup":["es.string.sup"],"core-js/stable/string/trim":["es.string.trim"],"core-js/stable/string/trim-end":["es.string.trim-end"],"core-js/stable/string/trim-left":["es.string.trim-start"],"core-js/stable/string/trim-right":["es.string.trim-end"],"core-js/stable/string/trim-start":["es.string.trim-start"],"core-js/stable/string/virtual":["es.string.code-point-at","es.string.ends-with","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup"],"core-js/stable/string/virtual/anchor":["es.string.anchor"],"core-js/stable/string/virtual/big":["es.string.big"],"core-js/stable/string/virtual/blink":["es.string.blink"],"core-js/stable/string/virtual/bold":["es.string.bold"],"core-js/stable/string/virtual/code-point-at":["es.string.code-point-at"],"core-js/stable/string/virtual/ends-with":["es.string.ends-with"],"core-js/stable/string/virtual/fixed":["es.string.fixed"],"core-js/stable/string/virtual/fontcolor":["es.string.fontcolor"],"core-js/stable/string/virtual/fontsize":["es.string.fontsize"],"core-js/stable/string/virtual/includes":["es.string.includes"],"core-js/stable/string/virtual/italics":["es.string.italics"],"core-js/stable/string/virtual/iterator":["es.string.iterator"],"core-js/stable/string/virtual/link":["es.string.link"],"core-js/stable/string/virtual/match-all":["es.string.match-all"],"core-js/stable/string/virtual/pad-end":["es.string.pad-end"],"core-js/stable/string/virtual/pad-start":["es.string.pad-start"],"core-js/stable/string/virtual/repeat":["es.string.repeat"],"core-js/stable/string/virtual/replace-all":["es.string.replace-all"],"core-js/stable/string/virtual/small":["es.string.small"],"core-js/stable/string/virtual/starts-with":["es.string.starts-with"],"core-js/stable/string/virtual/strike":["es.string.strike"],"core-js/stable/string/virtual/sub":["es.string.sub"],"core-js/stable/string/virtual/sup":["es.string.sup"],"core-js/stable/string/virtual/trim":["es.string.trim"],"core-js/stable/string/virtual/trim-end":["es.string.trim-end"],"core-js/stable/string/virtual/trim-left":["es.string.trim-start"],"core-js/stable/string/virtual/trim-right":["es.string.trim-end"],"core-js/stable/string/virtual/trim-start":["es.string.trim-start"],"core-js/stable/symbol":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.array.concat","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/stable/symbol/async-iterator":["es.symbol.async-iterator"],"core-js/stable/symbol/description":["es.symbol.description"],"core-js/stable/symbol/for":["es.symbol"],"core-js/stable/symbol/has-instance":["es.symbol.has-instance","es.function.has-instance"],"core-js/stable/symbol/is-concat-spreadable":["es.symbol.is-concat-spreadable","es.array.concat"],"core-js/stable/symbol/iterator":["es.symbol.iterator","es.string.iterator","web.dom-collections.iterator"],"core-js/stable/symbol/key-for":["es.symbol"],"core-js/stable/symbol/match":["es.symbol.match","es.string.match"],"core-js/stable/symbol/match-all":["es.symbol.match-all","es.string.match-all"],"core-js/stable/symbol/replace":["es.symbol.replace","es.string.replace"],"core-js/stable/symbol/search":["es.symbol.search","es.string.search"],"core-js/stable/symbol/species":["es.symbol.species"],"core-js/stable/symbol/split":["es.symbol.split","es.string.split"],"core-js/stable/symbol/to-primitive":["es.symbol.to-primitive"],"core-js/stable/symbol/to-string-tag":["es.symbol.to-string-tag","es.json.to-string-tag","es.math.to-string-tag","es.object.to-string","es.reflect.to-string-tag"],"core-js/stable/symbol/unscopables":["es.symbol.unscopables"],"core-js/stable/typed-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/copy-within":["es.typed-array.copy-within"],"core-js/stable/typed-array/entries":["es.typed-array.iterator"],"core-js/stable/typed-array/every":["es.typed-array.every"],"core-js/stable/typed-array/fill":["es.typed-array.fill"],"core-js/stable/typed-array/filter":["es.typed-array.filter"],"core-js/stable/typed-array/find":["es.typed-array.find"],"core-js/stable/typed-array/find-index":["es.typed-array.find-index"],"core-js/stable/typed-array/float32-array":["es.object.to-string","es.typed-array.float32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/float64-array":["es.object.to-string","es.typed-array.float64-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/for-each":["es.typed-array.for-each"],"core-js/stable/typed-array/from":["es.typed-array.from"],"core-js/stable/typed-array/includes":["es.typed-array.includes"],"core-js/stable/typed-array/index-of":["es.typed-array.index-of"],"core-js/stable/typed-array/int16-array":["es.object.to-string","es.typed-array.int16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/int32-array":["es.object.to-string","es.typed-array.int32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/int8-array":["es.object.to-string","es.typed-array.int8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/iterator":["es.typed-array.iterator"],"core-js/stable/typed-array/join":["es.typed-array.join"],"core-js/stable/typed-array/keys":["es.typed-array.iterator"],"core-js/stable/typed-array/last-index-of":["es.typed-array.last-index-of"],"core-js/stable/typed-array/map":["es.typed-array.map"],"core-js/stable/typed-array/of":["es.typed-array.of"],"core-js/stable/typed-array/reduce":["es.typed-array.reduce"],"core-js/stable/typed-array/reduce-right":["es.typed-array.reduce-right"],"core-js/stable/typed-array/reverse":["es.typed-array.reverse"],"core-js/stable/typed-array/set":["es.typed-array.set"],"core-js/stable/typed-array/slice":["es.typed-array.slice"],"core-js/stable/typed-array/some":["es.typed-array.some"],"core-js/stable/typed-array/sort":["es.typed-array.sort"],"core-js/stable/typed-array/subarray":["es.typed-array.subarray"],"core-js/stable/typed-array/to-locale-string":["es.typed-array.to-locale-string"],"core-js/stable/typed-array/to-string":["es.typed-array.to-string"],"core-js/stable/typed-array/uint16-array":["es.object.to-string","es.typed-array.uint16-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/uint32-array":["es.object.to-string","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/uint8-array":["es.object.to-string","es.typed-array.uint8-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/uint8-clamped-array":["es.object.to-string","es.typed-array.uint8-clamped-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string"],"core-js/stable/typed-array/values":["es.typed-array.iterator"],"core-js/stable/url":["web.url","web.url.to-json","web.url-search-params"],"core-js/stable/url-search-params":["web.url-search-params"],"core-js/stable/url/to-json":["web.url.to-json"],"core-js/stable/weak-map":["es.object.to-string","es.weak-map","web.dom-collections.iterator"],"core-js/stable/weak-set":["es.object.to-string","es.weak-set","web.dom-collections.iterator"],"core-js/stage":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.url","web.url.to-json","web.url-search-params"],"core-js/stage/0":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.url","web.url.to-json","web.url-search-params"],"core-js/stage/1":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of"],"core-js/stage/2":["esnext.aggregate-error","esnext.array.at","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.emplace","esnext.map.update-or-insert","esnext.map.upsert","esnext.object.has-own","esnext.promise.all-settled","esnext.promise.any","esnext.set.difference","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.symmetric-difference","esnext.set.union","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.metadata","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.weak-map.emplace","esnext.weak-map.upsert"],"core-js/stage/3":["esnext.aggregate-error","esnext.array.at","esnext.global-this","esnext.object.has-own","esnext.promise.all-settled","esnext.promise.any","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.replace-all","esnext.typed-array.at"],"core-js/stage/4":["esnext.aggregate-error","esnext.global-this","esnext.promise.all-settled","esnext.promise.any","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.replace-all"],"core-js/stage/pre":["es.map","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.url","web.url.to-json","web.url-search-params"],"core-js/web":["web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"core-js/web/dom-collections":["web.dom-collections.for-each","web.dom-collections.iterator"],"core-js/web/immediate":["web.immediate"],"core-js/web/queue-microtask":["web.queue-microtask"],"core-js/web/timers":["web.timers"],"core-js/web/url":["web.url","web.url.to-json","web.url-search-params"],"core-js/web/url-search-params":["web.url-search-params"]}')},4970:e=>{"use strict";e.exports=JSON.parse('{"3.0":["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","esnext.aggregate-error","esnext.array.last-index","esnext.array.last-item","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.map.delete-all","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.dispose","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"],"3.1":["es.string.match-all","es.symbol.match-all","esnext.symbol.replace-all"],"3.2":["es.promise.all-settled","esnext.array.is-template-object","esnext.map.update-or-insert","esnext.symbol.async-dispose"],"3.3":["es.global-this","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.upsert","esnext.weak-map.upsert"],"3.4":["es.json.stringify"],"3.5":["esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values"],"3.6":["es.regexp.sticky","es.regexp.test"],"3.7":["es.aggregate-error","es.promise.any","es.reflect.to-string-tag","es.string.replace-all","esnext.map.emplace","esnext.weak-map.emplace"],"3.8":["esnext.array.at","esnext.array.filter-out","esnext.array.unique-by","esnext.bigint.range","esnext.number.range","esnext.typed-array.at","esnext.typed-array.filter-out"],"3.9":["esnext.array.find-last","esnext.array.find-last-index","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by"],"3.11":["esnext.object.has-own"],"3.12":["esnext.symbol.matcher","esnext.symbol.metadata"]}')},2885:e=>{"use strict";e.exports=JSON.parse('["es.symbol","es.symbol.description","es.symbol.async-iterator","es.symbol.has-instance","es.symbol.is-concat-spreadable","es.symbol.iterator","es.symbol.match","es.symbol.match-all","es.symbol.replace","es.symbol.search","es.symbol.species","es.symbol.split","es.symbol.to-primitive","es.symbol.to-string-tag","es.symbol.unscopables","es.aggregate-error","es.array.concat","es.array.copy-within","es.array.every","es.array.fill","es.array.filter","es.array.find","es.array.find-index","es.array.flat","es.array.flat-map","es.array.for-each","es.array.from","es.array.includes","es.array.index-of","es.array.is-array","es.array.iterator","es.array.join","es.array.last-index-of","es.array.map","es.array.of","es.array.reduce","es.array.reduce-right","es.array.reverse","es.array.slice","es.array.some","es.array.sort","es.array.species","es.array.splice","es.array.unscopables.flat","es.array.unscopables.flat-map","es.array-buffer.constructor","es.array-buffer.is-view","es.array-buffer.slice","es.data-view","es.date.now","es.date.to-iso-string","es.date.to-json","es.date.to-primitive","es.date.to-string","es.function.bind","es.function.has-instance","es.function.name","es.global-this","es.json.stringify","es.json.to-string-tag","es.map","es.math.acosh","es.math.asinh","es.math.atanh","es.math.cbrt","es.math.clz32","es.math.cosh","es.math.expm1","es.math.fround","es.math.hypot","es.math.imul","es.math.log10","es.math.log1p","es.math.log2","es.math.sign","es.math.sinh","es.math.tanh","es.math.to-string-tag","es.math.trunc","es.number.constructor","es.number.epsilon","es.number.is-finite","es.number.is-integer","es.number.is-nan","es.number.is-safe-integer","es.number.max-safe-integer","es.number.min-safe-integer","es.number.parse-float","es.number.parse-int","es.number.to-fixed","es.number.to-precision","es.object.assign","es.object.create","es.object.define-getter","es.object.define-properties","es.object.define-property","es.object.define-setter","es.object.entries","es.object.freeze","es.object.from-entries","es.object.get-own-property-descriptor","es.object.get-own-property-descriptors","es.object.get-own-property-names","es.object.get-prototype-of","es.object.is","es.object.is-extensible","es.object.is-frozen","es.object.is-sealed","es.object.keys","es.object.lookup-getter","es.object.lookup-setter","es.object.prevent-extensions","es.object.seal","es.object.set-prototype-of","es.object.to-string","es.object.values","es.parse-float","es.parse-int","es.promise","es.promise.all-settled","es.promise.any","es.promise.finally","es.reflect.apply","es.reflect.construct","es.reflect.define-property","es.reflect.delete-property","es.reflect.get","es.reflect.get-own-property-descriptor","es.reflect.get-prototype-of","es.reflect.has","es.reflect.is-extensible","es.reflect.own-keys","es.reflect.prevent-extensions","es.reflect.set","es.reflect.set-prototype-of","es.reflect.to-string-tag","es.regexp.constructor","es.regexp.exec","es.regexp.flags","es.regexp.sticky","es.regexp.test","es.regexp.to-string","es.set","es.string.code-point-at","es.string.ends-with","es.string.from-code-point","es.string.includes","es.string.iterator","es.string.match","es.string.match-all","es.string.pad-end","es.string.pad-start","es.string.raw","es.string.repeat","es.string.replace","es.string.replace-all","es.string.search","es.string.split","es.string.starts-with","es.string.trim","es.string.trim-end","es.string.trim-start","es.string.anchor","es.string.big","es.string.blink","es.string.bold","es.string.fixed","es.string.fontcolor","es.string.fontsize","es.string.italics","es.string.link","es.string.small","es.string.strike","es.string.sub","es.string.sup","es.typed-array.float32-array","es.typed-array.float64-array","es.typed-array.int8-array","es.typed-array.int16-array","es.typed-array.int32-array","es.typed-array.uint8-array","es.typed-array.uint8-clamped-array","es.typed-array.uint16-array","es.typed-array.uint32-array","es.typed-array.copy-within","es.typed-array.every","es.typed-array.fill","es.typed-array.filter","es.typed-array.find","es.typed-array.find-index","es.typed-array.for-each","es.typed-array.from","es.typed-array.includes","es.typed-array.index-of","es.typed-array.iterator","es.typed-array.join","es.typed-array.last-index-of","es.typed-array.map","es.typed-array.of","es.typed-array.reduce","es.typed-array.reduce-right","es.typed-array.reverse","es.typed-array.set","es.typed-array.slice","es.typed-array.some","es.typed-array.sort","es.typed-array.subarray","es.typed-array.to-locale-string","es.typed-array.to-string","es.weak-map","es.weak-set","esnext.aggregate-error","esnext.array.at","esnext.array.filter-out","esnext.array.find-last","esnext.array.find-last-index","esnext.array.is-template-object","esnext.array.last-index","esnext.array.last-item","esnext.array.unique-by","esnext.async-iterator.constructor","esnext.async-iterator.as-indexed-pairs","esnext.async-iterator.drop","esnext.async-iterator.every","esnext.async-iterator.filter","esnext.async-iterator.find","esnext.async-iterator.flat-map","esnext.async-iterator.for-each","esnext.async-iterator.from","esnext.async-iterator.map","esnext.async-iterator.reduce","esnext.async-iterator.some","esnext.async-iterator.take","esnext.async-iterator.to-array","esnext.bigint.range","esnext.composite-key","esnext.composite-symbol","esnext.global-this","esnext.iterator.constructor","esnext.iterator.as-indexed-pairs","esnext.iterator.drop","esnext.iterator.every","esnext.iterator.filter","esnext.iterator.find","esnext.iterator.flat-map","esnext.iterator.for-each","esnext.iterator.from","esnext.iterator.map","esnext.iterator.reduce","esnext.iterator.some","esnext.iterator.take","esnext.iterator.to-array","esnext.map.delete-all","esnext.map.emplace","esnext.map.every","esnext.map.filter","esnext.map.find","esnext.map.find-key","esnext.map.from","esnext.map.group-by","esnext.map.includes","esnext.map.key-by","esnext.map.key-of","esnext.map.map-keys","esnext.map.map-values","esnext.map.merge","esnext.map.of","esnext.map.reduce","esnext.map.some","esnext.map.update","esnext.map.update-or-insert","esnext.map.upsert","esnext.math.clamp","esnext.math.deg-per-rad","esnext.math.degrees","esnext.math.fscale","esnext.math.iaddh","esnext.math.imulh","esnext.math.isubh","esnext.math.rad-per-deg","esnext.math.radians","esnext.math.scale","esnext.math.seeded-prng","esnext.math.signbit","esnext.math.umulh","esnext.number.from-string","esnext.number.range","esnext.object.has-own","esnext.object.iterate-entries","esnext.object.iterate-keys","esnext.object.iterate-values","esnext.observable","esnext.promise.all-settled","esnext.promise.any","esnext.promise.try","esnext.reflect.define-metadata","esnext.reflect.delete-metadata","esnext.reflect.get-metadata","esnext.reflect.get-metadata-keys","esnext.reflect.get-own-metadata","esnext.reflect.get-own-metadata-keys","esnext.reflect.has-metadata","esnext.reflect.has-own-metadata","esnext.reflect.metadata","esnext.set.add-all","esnext.set.delete-all","esnext.set.difference","esnext.set.every","esnext.set.filter","esnext.set.find","esnext.set.from","esnext.set.intersection","esnext.set.is-disjoint-from","esnext.set.is-subset-of","esnext.set.is-superset-of","esnext.set.join","esnext.set.map","esnext.set.of","esnext.set.reduce","esnext.set.some","esnext.set.symmetric-difference","esnext.set.union","esnext.string.at","esnext.string.code-points","esnext.string.match-all","esnext.string.replace-all","esnext.symbol.async-dispose","esnext.symbol.dispose","esnext.symbol.matcher","esnext.symbol.metadata","esnext.symbol.observable","esnext.symbol.pattern-match","esnext.symbol.replace-all","esnext.typed-array.at","esnext.typed-array.filter-out","esnext.typed-array.find-last","esnext.typed-array.find-last-index","esnext.typed-array.unique-by","esnext.weak-map.delete-all","esnext.weak-map.from","esnext.weak-map.of","esnext.weak-map.emplace","esnext.weak-map.upsert","esnext.weak-set.add-all","esnext.weak-set.delete-all","esnext.weak-set.from","esnext.weak-set.of","web.dom-collections.for-each","web.dom-collections.iterator","web.immediate","web.queue-microtask","web.timers","web.url","web.url.to-json","web.url-search-params"]')},6578:e=>{"use strict";e.exports=JSON.parse('{"es.symbol":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.symbol.description":{"android":"70","chrome":"70","deno":"1.0","edge":"74","electron":"5.0","firefox":"63","ios":"12.2","node":"11.0","opera":"57","opera_mobile":"49","safari":"12.1","samsung":"10.0"},"es.symbol.async-iterator":{"android":"63","chrome":"63","deno":"1.0","edge":"74","electron":"3.0","firefox":"55","ios":"12.0","node":"10.0","opera":"50","opera_mobile":"46","safari":"12.0","samsung":"8.0"},"es.symbol.has-instance":{"android":"50","chrome":"50","deno":"1.0","edge":"15","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.is-concat-spreadable":{"android":"48","chrome":"48","deno":"1.0","edge":"15","electron":"0.37","firefox":"48","ios":"10.0","node":"6.0","opera":"35","opera_mobile":"35","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.iterator":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"36","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.symbol.match":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"40","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.match-all":{"android":"73","chrome":"73","deno":"1.0","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.symbol.replace":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.search":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.species":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"41","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.split":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"49","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.to-primitive":{"android":"47","chrome":"47","deno":"1.0","edge":"15","electron":"0.36","firefox":"44","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.to-string-tag":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.symbol.unscopables":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"48","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.aggregate-error":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"es.array.concat":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.copy-within":{"android":"45","chrome":"45","deno":"1.0","edge":"12","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.every":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.array.fill":{"android":"45","chrome":"45","deno":"1.0","edge":"12","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.filter":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.find":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.find-index":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"48","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"9.0","samsung":"5.0"},"es.array.flat":{"android":"69","chrome":"69","deno":"1.0","edge":"74","electron":"4.0","firefox":"62","ios":"12.0","node":"11.0","opera":"56","opera_mobile":"48","safari":"12.0","samsung":"10.0"},"es.array.flat-map":{"android":"69","chrome":"69","deno":"1.0","edge":"74","electron":"4.0","firefox":"62","ios":"12.0","node":"11.0","opera":"56","opera_mobile":"48","safari":"12.0","samsung":"10.0"},"es.array.for-each":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.array.from":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"9.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"9.0","samsung":"5.0"},"es.array.includes":{"android":"53","chrome":"53","deno":"1.0","edge":"14","electron":"1.4","firefox":"48","ios":"10.0","node":"7.0","opera":"40","opera_mobile":"40","safari":"10.0","samsung":"6.0"},"es.array.index-of":{"android":"51","chrome":"51","deno":"1.0","edge":"12","electron":"1.2","firefox":"4","ie":"9","ios":"8.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"7.1","samsung":"5.0"},"es.array.is-array":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"4.0","samsung":"1.0"},"es.array.iterator":{"android":"66","chrome":"66","deno":"1.0","edge":"15","electron":"3.0","firefox":"60","ios":"10.0","node":"10.0","opera":"53","opera_mobile":"47","safari":"10.0","samsung":"9.0"},"es.array.join":{"android":"4.4","chrome":"26","deno":"1.0","edge":"13","electron":"0.20","firefox":"4","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.array.last-index-of":{"android":"51","chrome":"51","deno":"1.0","edge":"12","electron":"1.2","firefox":"4","ie":"9","ios":"8.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"7.1","samsung":"5.0"},"es.array.map":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"50","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.of":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"25","ios":"9.0","node":"4.0","opera":"32","opera_mobile":"32","rhino":"1.7.13","safari":"9.0","samsung":"5.0"},"es.array.reduce":{"android":"83","chrome":"83","deno":"1.0","edge":"12","electron":"9.0","firefox":"4","ie":"9","ios":"8.0","node":"6.0","opera":"69","opera_mobile":"59","rhino":"1.7.13","safari":"7.1","samsung":"13.0"},"es.array.reduce-right":{"android":"83","chrome":"83","deno":"1.0","edge":"12","electron":"9.0","firefox":"4","ie":"9","ios":"8.0","node":"6.0","opera":"69","opera_mobile":"59","rhino":"1.7.13","safari":"7.1","samsung":"13.0"},"es.array.reverse":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"5.5","ios":"12.2","node":"0.0.3","opera":"10.50","opera_mobile":"10.50","rhino":"1.7.13","safari":"12.0.2","samsung":"1.0"},"es.array.slice":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.some":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.array.sort":{"android":"70","chrome":"70","deno":"1.0","edge":"74","electron":"5.0","firefox":"4","ios":"12.0","node":"11.0","opera":"57","opera_mobile":"49","safari":"12.0","samsung":"10.0"},"es.array.species":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"48","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.splice":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.array.unscopables.flat":{"android":"73","chrome":"73","deno":"1.0","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.array.unscopables.flat-map":{"android":"73","chrome":"73","deno":"1.0","edge":"74","electron":"5.0","firefox":"67","ios":"13.0","node":"12.0","opera":"60","opera_mobile":"52","safari":"13","samsung":"11.0"},"es.array-buffer.constructor":{"android":"4.4","chrome":"26","deno":"1.0","edge":"14","electron":"0.20","firefox":"44","ios":"12.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"12.0","samsung":"1.5"},"es.array-buffer.is-view":{"android":"4.4.3","chrome":"32","deno":"1.0","edge":"12","electron":"0.20","firefox":"29","ie":"11","ios":"8.0","node":"0.11.9","opera":"19","opera_mobile":"19","safari":"7.1","samsung":"2.0"},"es.array-buffer.slice":{"android":"4.4.3","chrome":"31","deno":"1.0","edge":"12","electron":"0.20","firefox":"46","ie":"11","ios":"12.2","node":"0.11.8","opera":"18","opera_mobile":"18","rhino":"1.7.13","safari":"12.1","samsung":"2.0"},"es.data-view":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"15","ie":"10","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.date.get-year":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"9","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.date.now":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ie":"9","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"4.0","samsung":"1.0"},"es.date.set-year":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"3","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.date.to-gmt-string":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"3","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.date.to-iso-string":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"7","ie":"9","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.date.to-json":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"10.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"10.0","samsung":"1.5"},"es.date.to-primitive":{"android":"47","chrome":"47","deno":"1.0","edge":"15","electron":"0.36","firefox":"44","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.date.to-string":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ie":"9","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.escape":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"3","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.function.bind":{"android":"3.0","chrome":"7","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.101","opera":"12","opera_mobile":"12","phantom":"2.0","rhino":"1.7.13","safari":"5.1","samsung":"1.0"},"es.function.has-instance":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"50","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.function.name":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"3.2","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"4.0","samsung":"1.0"},"es.global-this":{"android":"71","chrome":"71","deno":"1.0","edge":"74","electron":"5.0","firefox":"65","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"es.json.stringify":{"android":"72","chrome":"72","deno":"1.0","edge":"74","electron":"5.0","firefox":"64","ios":"12.2","node":"12.0","opera":"59","opera_mobile":"51","safari":"12.1","samsung":"11.0"},"es.json.to-string-tag":{"android":"50","chrome":"50","deno":"1.0","edge":"15","electron":"1.1","firefox":"51","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.map":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.math.acosh":{"android":"54","chrome":"54","deno":"1.0","edge":"13","electron":"1.4","firefox":"25","ios":"8.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"7.1","samsung":"6.0"},"es.math.asinh":{"android":"38","chrome":"38","deno":"1.0","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.atanh":{"android":"38","chrome":"38","deno":"1.0","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.cbrt":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.clz32":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"9.0","samsung":"3.0"},"es.math.cosh":{"android":"39","chrome":"39","deno":"1.0","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","rhino":"1.7.13","safari":"7.1","samsung":"3.4"},"es.math.expm1":{"android":"39","chrome":"39","deno":"1.0","edge":"13","electron":"0.20","firefox":"46","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","rhino":"1.7.13","safari":"7.1","samsung":"3.4"},"es.math.fround":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"26","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.hypot":{"android":"78","chrome":"78","deno":"1.0","edge":"12","electron":"7.0","firefox":"27","ios":"8.0","node":"13.0","opera":"65","opera_mobile":"56","rhino":"1.7.13","safari":"7.1","samsung":"12.0"},"es.math.imul":{"android":"4.4","chrome":"28","deno":"1.0","edge":"13","electron":"0.20","firefox":"20","ios":"9.0","node":"0.11.1","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"9.0","samsung":"1.5"},"es.math.log10":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.log1p":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.log2":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.sign":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"9.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"9.0","samsung":"3.0"},"es.math.sinh":{"android":"39","chrome":"39","deno":"1.0","edge":"13","electron":"0.20","firefox":"25","ios":"8.0","node":"1.0","opera":"26","opera_mobile":"26","rhino":"1.7.13","safari":"7.1","samsung":"3.4"},"es.math.tanh":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.math.to-string-tag":{"android":"50","chrome":"50","deno":"1.0","edge":"15","electron":"1.1","firefox":"51","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.math.trunc":{"android":"38","chrome":"38","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"8.0","node":"0.11.15","opera":"25","opera_mobile":"25","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.number.constructor":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"46","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.number.epsilon":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"25","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","safari":"9.0","samsung":"2.0"},"es.number.is-finite":{"android":"4.1","chrome":"19","deno":"1.0","edge":"12","electron":"0.20","firefox":"16","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","rhino":"1.7.13","safari":"9.0","samsung":"1.5"},"es.number.is-integer":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"16","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.number.is-nan":{"android":"4.1","chrome":"19","deno":"1.0","edge":"12","electron":"0.20","firefox":"15","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","rhino":"1.7.13","safari":"9.0","samsung":"1.5"},"es.number.is-safe-integer":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"32","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.number.max-safe-integer":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.number.min-safe-integer":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"31","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.number.parse-float":{"android":"37","chrome":"35","deno":"1.0","edge":"13","electron":"0.20","firefox":"39","ios":"11.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"11.0","samsung":"3.0"},"es.number.parse-int":{"android":"37","chrome":"35","deno":"1.0","edge":"13","electron":"0.20","firefox":"39","ios":"9.0","node":"0.11.13","opera":"22","opera_mobile":"22","safari":"9.0","samsung":"3.0"},"es.number.to-fixed":{"android":"4.4","chrome":"26","deno":"1.0","edge":"74","electron":"0.20","firefox":"4","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.number.to-precision":{"android":"4.4","chrome":"26","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"8","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","rhino":"1.7.13","safari":"7.1","samsung":"1.5"},"es.object.assign":{"android":"49","chrome":"49","deno":"1.0","edge":"74","electron":"0.37","firefox":"36","ios":"9.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"9.0","samsung":"5.0"},"es.object.create":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"3.2","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"1.9","rhino":"1.7.13","safari":"4.0","samsung":"1.0"},"es.object.define-getter":{"android":"62","chrome":"62","deno":"1.0","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","rhino":"1.7.13","safari":"7.1","samsung":"8.0"},"es.object.define-properties":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"2.0","rhino":"1.7.13","safari":"5.1","samsung":"1.0"},"es.object.define-property":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"4","ie":"9","ios":"5.1","node":"0.1.27","opera":"12","opera_mobile":"12","phantom":"2.0","rhino":"1.7.13","safari":"5.1","samsung":"1.0"},"es.object.define-setter":{"android":"62","chrome":"62","deno":"1.0","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","rhino":"1.7.13","safari":"7.1","samsung":"8.0"},"es.object.entries":{"android":"54","chrome":"54","deno":"1.0","edge":"14","electron":"1.4","firefox":"47","ios":"10.3","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.1","samsung":"6.0"},"es.object.freeze":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.from-entries":{"android":"73","chrome":"73","deno":"1.0","edge":"74","electron":"5.0","firefox":"63","ios":"12.2","node":"12.0","opera":"60","opera_mobile":"52","safari":"12.1","samsung":"11.0"},"es.object.get-own-property-descriptor":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.get-own-property-descriptors":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"50","ios":"10.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.0","samsung":"6.0"},"es.object.get-own-property-names":{"android":"40","chrome":"40","deno":"1.0","edge":"13","electron":"0.21","firefox":"34","ios":"9.0","node":"1.0","opera":"27","opera_mobile":"27","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.object.get-prototype-of":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.is":{"android":"4.1","chrome":"19","deno":"1.0","edge":"12","electron":"0.20","firefox":"22","ios":"9.0","node":"0.7.3","opera":"15","opera_mobile":"15","rhino":"1.7.13","safari":"9.0","samsung":"1.5"},"es.object.is-extensible":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.is-frozen":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.is-sealed":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.keys":{"android":"40","chrome":"40","deno":"1.0","edge":"13","electron":"0.21","firefox":"35","ios":"9.0","node":"1.0","opera":"27","opera_mobile":"27","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.object.lookup-getter":{"android":"62","chrome":"62","deno":"1.0","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","rhino":"1.7.13","safari":"7.1","samsung":"8.0"},"es.object.lookup-setter":{"android":"62","chrome":"62","deno":"1.0","edge":"16","electron":"3.0","firefox":"48","ios":"8.0","node":"8.10","opera":"49","opera_mobile":"46","rhino":"1.7.13","safari":"7.1","samsung":"8.0"},"es.object.prevent-extensions":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.seal":{"android":"44","chrome":"44","deno":"1.0","edge":"13","electron":"0.30","firefox":"35","ios":"9.0","node":"3.0","opera":"31","opera_mobile":"31","rhino":"1.7.13","safari":"9.0","samsung":"4.0"},"es.object.set-prototype-of":{"android":"37","chrome":"34","deno":"1.0","edge":"12","electron":"0.20","firefox":"31","ie":"11","ios":"9.0","node":"0.11.13","opera":"21","opera_mobile":"21","rhino":"1.7.13","safari":"9.0","samsung":"2.0"},"es.object.to-string":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"51","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.object.values":{"android":"54","chrome":"54","deno":"1.0","edge":"14","electron":"1.4","firefox":"47","ios":"10.3","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.1","samsung":"6.0"},"es.parse-float":{"android":"37","chrome":"35","deno":"1.0","edge":"12","electron":"0.20","firefox":"8","ie":"8","ios":"8.0","node":"0.11.13","opera":"22","opera_mobile":"22","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.parse-int":{"android":"37","chrome":"35","deno":"1.0","edge":"12","electron":"0.20","firefox":"21","ie":"9","ios":"8.0","node":"0.11.13","opera":"22","opera_mobile":"22","rhino":"1.7.13","safari":"7.1","samsung":"3.0"},"es.promise":{"android":"67","chrome":"67","deno":"1.0","edge":"74","electron":"4.0","firefox":"69","ios":"11.0","node":"10.4","opera":"54","opera_mobile":"48","safari":"11.0","samsung":"9.0"},"es.promise.all-settled":{"android":"76","chrome":"76","deno":"1.0","edge":"76","electron":"6.0","firefox":"71","ios":"13.0","node":"12.9","opera":"63","opera_mobile":"54","safari":"13","samsung":"12.0"},"es.promise.any":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"es.promise.finally":{"android":"67","chrome":"67","deno":"1.0","edge":"74","electron":"4.0","firefox":"69","ios":"13.2.3","node":"10.4","opera":"54","opera_mobile":"48","safari":"13.0.3","samsung":"9.0"},"es.reflect.apply":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.construct":{"android":"49","chrome":"49","deno":"1.0","edge":"15","electron":"0.37","firefox":"44","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.define-property":{"android":"49","chrome":"49","deno":"1.0","edge":"13","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.delete-property":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get-own-property-descriptor":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.get-prototype-of":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.has":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.is-extensible":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.own-keys":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.prevent-extensions":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.set":{"android":"49","chrome":"49","deno":"1.0","edge":"74","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.set-prototype-of":{"android":"49","chrome":"49","deno":"1.0","edge":"12","electron":"0.37","firefox":"42","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.reflect.to-string-tag":{"android":"86","chrome":"86","deno":"1.3","edge":"86","electron":"11.0","firefox":"82","ios":"14.0","node":"15.0","opera":"72","opera_mobile":"61","safari":"14.0","samsung":"14.0"},"es.regexp.constructor":{"android":"64","chrome":"64","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"11.3","node":"10.0","opera":"51","opera_mobile":"47","safari":"11.1","samsung":"9.0"},"es.regexp.dot-all":{"android":"62","chrome":"62","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"11.3","node":"8.10","opera":"49","opera_mobile":"46","safari":"11.1","samsung":"8.0"},"es.regexp.exec":{"android":"64","chrome":"64","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"11.3","node":"10.0","opera":"51","opera_mobile":"47","safari":"11.1","samsung":"9.0"},"es.regexp.flags":{"android":"62","chrome":"62","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"11.3","node":"8.10","opera":"49","opera_mobile":"46","safari":"11.1","samsung":"8.0"},"es.regexp.sticky":{"android":"49","chrome":"49","deno":"1.0","edge":"13","electron":"0.37","firefox":"3","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.regexp.test":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"46","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.regexp.to-string":{"android":"50","chrome":"50","deno":"1.0","edge":"74","electron":"1.1","firefox":"46","ios":"10.0","node":"6.0","opera":"37","opera_mobile":"37","safari":"10.0","samsung":"5.0"},"es.set":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.string.code-point-at":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"29","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.string.ends-with":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.from-code-point":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"29","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.string.includes":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.iterator":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"36","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.string.match":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.match-all":{"android":"80","chrome":"80","deno":"1.0","edge":"80","electron":"8.0","firefox":"73","ios":"13.4","node":"14.0","opera":"67","opera_mobile":"57","safari":"13.1","samsung":"13.0"},"es.string.pad-end":{"android":"57","chrome":"57","deno":"1.0","edge":"15","electron":"1.7","firefox":"48","ios":"11.0","node":"8.0","opera":"44","opera_mobile":"43","rhino":"1.7.13","safari":"11.0","samsung":"7.0"},"es.string.pad-start":{"android":"57","chrome":"57","deno":"1.0","edge":"15","electron":"1.7","firefox":"48","ios":"11.0","node":"8.0","opera":"44","opera_mobile":"43","rhino":"1.7.13","safari":"11.0","samsung":"7.0"},"es.string.raw":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"34","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","safari":"9.0","samsung":"3.4"},"es.string.repeat":{"android":"41","chrome":"41","deno":"1.0","edge":"13","electron":"0.21","firefox":"24","ios":"9.0","node":"1.0","opera":"28","opera_mobile":"28","rhino":"1.7.13","safari":"9.0","samsung":"3.4"},"es.string.replace":{"android":"64","chrome":"64","deno":"1.0","edge":"74","electron":"3.0","firefox":"78","ios":"14.0","node":"10.0","opera":"51","opera_mobile":"47","safari":"14.0","samsung":"9.0"},"es.string.replace-all":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"77","ios":"13.4","node":"15.0","opera":"71","opera_mobile":"60","safari":"13.1","samsung":"14.0"},"es.string.search":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"49","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.split":{"android":"54","chrome":"54","deno":"1.0","edge":"74","electron":"1.4","firefox":"49","ios":"10.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"10.0","samsung":"6.0"},"es.string.starts-with":{"android":"51","chrome":"51","deno":"1.0","edge":"74","electron":"1.2","firefox":"40","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.string.substr":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"4","ios":"1.0","node":"0.0.3","opera":"4","opera_mobile":"4","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.string.trim":{"android":"59","chrome":"59","deno":"1.0","edge":"15","electron":"1.8","firefox":"52","ios":"12.2","node":"8.3","opera":"46","opera_mobile":"43","rhino":"1.7.13","safari":"12.1","samsung":"7.0"},"es.string.trim-end":{"android":"66","chrome":"66","deno":"1.0","edge":"74","electron":"3.0","firefox":"61","ios":"12.2","node":"10.0","opera":"53","opera_mobile":"47","safari":"12.1","samsung":"9.0"},"es.string.trim-start":{"android":"66","chrome":"66","deno":"1.0","edge":"74","electron":"3.0","firefox":"61","ios":"12.0","node":"10.0","opera":"53","opera_mobile":"47","safari":"12.0","samsung":"9.0"},"es.string.anchor":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.big":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.blink":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.bold":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.fixed":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.fontcolor":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.fontsize":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.italics":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.link":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"17","ios":"6.0","node":"0.1.27","opera":"15","opera_mobile":"15","phantom":"2.0","safari":"6.0","samsung":"1.0"},"es.string.small":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.strike":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.sub":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.string.sup":{"android":"3.0","chrome":"5","deno":"1.0","edge":"12","electron":"0.20","firefox":"2","ios":"2.0","node":"0.1.27","opera":"10.50","opera_mobile":"10.50","phantom":"1.9","rhino":"1.7.13","safari":"3.1","samsung":"1.0"},"es.typed-array.float32-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.float64-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int8-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int16-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.int32-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint8-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint8-clamped-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint16-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.uint32-array":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.copy-within":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"34","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.every":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.fill":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.filter":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.find":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.find-index":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.for-each":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.from":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.includes":{"android":"49","chrome":"49","deno":"1.0","edge":"14","electron":"0.37","firefox":"43","ios":"10.0","node":"6.0","opera":"36","opera_mobile":"36","safari":"10.0","samsung":"5.0"},"es.typed-array.index-of":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.iterator":{"android":"47","chrome":"47","deno":"1.0","edge":"13","electron":"0.36","firefox":"37","ios":"10.0","node":"6.0","opera":"34","opera_mobile":"34","safari":"10.0","samsung":"5.0"},"es.typed-array.join":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.last-index-of":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.map":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.of":{"android":"54","chrome":"54","deno":"1.0","edge":"15","electron":"1.4","firefox":"55","ios":"14.0","node":"7.0","opera":"41","opera_mobile":"41","safari":"14.0","samsung":"6.0"},"es.typed-array.reduce":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.reduce-right":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.reverse":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.set":{"android":"4.4","chrome":"26","deno":"1.0","edge":"13","electron":"0.20","firefox":"15","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.typed-array.slice":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"38","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.some":{"android":"45","chrome":"45","deno":"1.0","edge":"13","electron":"0.31","firefox":"37","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.sort":{"android":"74","chrome":"74","deno":"1.0","edge":"74","electron":"6.0","firefox":"67","ios":"14.5","node":"12.0","opera":"61","opera_mobile":"53","safari":"14.1","samsung":"11.0"},"es.typed-array.subarray":{"android":"4.4","chrome":"26","deno":"1.0","edge":"13","electron":"0.20","firefox":"15","ios":"8.0","node":"0.11.0","opera":"16","opera_mobile":"16","safari":"7.1","samsung":"1.5"},"es.typed-array.to-locale-string":{"android":"45","chrome":"45","deno":"1.0","edge":"74","electron":"0.31","firefox":"51","ios":"10.0","node":"4.0","opera":"32","opera_mobile":"32","safari":"10.0","samsung":"5.0"},"es.typed-array.to-string":{"android":"51","chrome":"51","deno":"1.0","edge":"13","electron":"1.2","firefox":"51","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","safari":"10.0","samsung":"5.0"},"es.unescape":{"android":"3.0","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"3","ios":"1.0","node":"0.0.3","opera":"3","opera_mobile":"3","phantom":"1.9","rhino":"1.7.13","safari":"1","samsung":"1.0"},"es.weak-map":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"es.weak-set":{"android":"51","chrome":"51","deno":"1.0","edge":"15","electron":"1.2","firefox":"53","ios":"10.0","node":"6.5","opera":"38","opera_mobile":"38","rhino":"1.7.13","safari":"10.0","samsung":"5.0"},"esnext.aggregate-error":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"esnext.array.at":{"android":"92","chrome":"92","deno":"1.12","edge":"92","electron":"14.0","firefox":"90","node":"16.6","opera":"78"},"esnext.array.filter-out":{},"esnext.array.filter-reject":{},"esnext.array.find-last":{},"esnext.array.find-last-index":{},"esnext.array.group-by":{},"esnext.array.is-template-object":{},"esnext.array.last-index":{},"esnext.array.last-item":{},"esnext.array.unique-by":{},"esnext.async-iterator.constructor":{},"esnext.async-iterator.as-indexed-pairs":{},"esnext.async-iterator.drop":{},"esnext.async-iterator.every":{},"esnext.async-iterator.filter":{},"esnext.async-iterator.find":{},"esnext.async-iterator.flat-map":{},"esnext.async-iterator.for-each":{},"esnext.async-iterator.from":{},"esnext.async-iterator.map":{},"esnext.async-iterator.reduce":{},"esnext.async-iterator.some":{},"esnext.async-iterator.take":{},"esnext.async-iterator.to-array":{},"esnext.bigint.range":{},"esnext.composite-key":{},"esnext.composite-symbol":{},"esnext.global-this":{"android":"71","chrome":"71","deno":"1.0","edge":"74","electron":"5.0","firefox":"65","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"esnext.iterator.constructor":{},"esnext.iterator.as-indexed-pairs":{},"esnext.iterator.drop":{},"esnext.iterator.every":{},"esnext.iterator.filter":{},"esnext.iterator.find":{},"esnext.iterator.flat-map":{},"esnext.iterator.for-each":{},"esnext.iterator.from":{},"esnext.iterator.map":{},"esnext.iterator.reduce":{},"esnext.iterator.some":{},"esnext.iterator.take":{},"esnext.iterator.to-array":{},"esnext.map.delete-all":{},"esnext.map.emplace":{},"esnext.map.every":{},"esnext.map.filter":{},"esnext.map.find":{},"esnext.map.find-key":{},"esnext.map.from":{},"esnext.map.group-by":{},"esnext.map.includes":{},"esnext.map.key-by":{},"esnext.map.key-of":{},"esnext.map.map-keys":{},"esnext.map.map-values":{},"esnext.map.merge":{},"esnext.map.of":{},"esnext.map.reduce":{},"esnext.map.some":{},"esnext.map.update":{},"esnext.map.update-or-insert":{},"esnext.map.upsert":{},"esnext.math.clamp":{},"esnext.math.deg-per-rad":{},"esnext.math.degrees":{},"esnext.math.fscale":{},"esnext.math.iaddh":{},"esnext.math.imulh":{},"esnext.math.isubh":{},"esnext.math.rad-per-deg":{},"esnext.math.radians":{},"esnext.math.scale":{},"esnext.math.seeded-prng":{},"esnext.math.signbit":{},"esnext.math.umulh":{},"esnext.number.from-string":{},"esnext.number.range":{},"esnext.object.has-own":{"android":"93","chrome":"93","deno":"1.13","edge":"93","electron":"14.0","firefox":"92","opera":"79"},"esnext.object.iterate-entries":{},"esnext.object.iterate-keys":{},"esnext.object.iterate-values":{},"esnext.observable":{},"esnext.promise.all-settled":{"android":"76","chrome":"76","deno":"1.0","edge":"76","electron":"6.0","firefox":"71","ios":"13.0","node":"12.9","opera":"63","opera_mobile":"54","safari":"13","samsung":"12.0"},"esnext.promise.any":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"79","ios":"14.0","node":"15.0","opera":"71","opera_mobile":"60","safari":"14.0","samsung":"14.0"},"esnext.promise.try":{},"esnext.reflect.define-metadata":{},"esnext.reflect.delete-metadata":{},"esnext.reflect.get-metadata":{},"esnext.reflect.get-metadata-keys":{},"esnext.reflect.get-own-metadata":{},"esnext.reflect.get-own-metadata-keys":{},"esnext.reflect.has-metadata":{},"esnext.reflect.has-own-metadata":{},"esnext.reflect.metadata":{},"esnext.set.add-all":{},"esnext.set.delete-all":{},"esnext.set.difference":{},"esnext.set.every":{},"esnext.set.filter":{},"esnext.set.find":{},"esnext.set.from":{},"esnext.set.intersection":{},"esnext.set.is-disjoint-from":{},"esnext.set.is-subset-of":{},"esnext.set.is-superset-of":{},"esnext.set.join":{},"esnext.set.map":{},"esnext.set.of":{},"esnext.set.reduce":{},"esnext.set.some":{},"esnext.set.symmetric-difference":{},"esnext.set.union":{},"esnext.string.at":{},"esnext.string.code-points":{},"esnext.string.match-all":{"android":"80","chrome":"80","deno":"1.0","edge":"80","electron":"8.0","firefox":"73","ios":"13.4","node":"14.0","opera":"67","opera_mobile":"57","safari":"13.1","samsung":"13.0"},"esnext.string.replace-all":{"android":"85","chrome":"85","deno":"1.2","edge":"85","electron":"10.0","firefox":"77","ios":"13.4","node":"15.0","opera":"71","opera_mobile":"60","safari":"13.1","samsung":"14.0"},"esnext.symbol.async-dispose":{},"esnext.symbol.dispose":{},"esnext.symbol.matcher":{},"esnext.symbol.metadata":{},"esnext.symbol.observable":{},"esnext.symbol.pattern-match":{},"esnext.symbol.replace-all":{},"esnext.typed-array.at":{"android":"92","chrome":"92","deno":"1.12","edge":"92","electron":"14.0","firefox":"90","node":"16.6","opera":"78"},"esnext.typed-array.filter-out":{},"esnext.typed-array.filter-reject":{},"esnext.typed-array.find-last":{},"esnext.typed-array.find-last-index":{},"esnext.typed-array.group-by":{},"esnext.typed-array.unique-by":{},"esnext.weak-map.delete-all":{},"esnext.weak-map.from":{},"esnext.weak-map.of":{},"esnext.weak-map.emplace":{},"esnext.weak-map.upsert":{},"esnext.weak-set.add-all":{},"esnext.weak-set.delete-all":{},"esnext.weak-set.from":{},"esnext.weak-set.of":{},"web.dom-collections.for-each":{"android":"58","chrome":"58","deno":"1.0","edge":"16","electron":"1.7","firefox":"50","ios":"10.0","node":"0.0.1","opera":"45","opera_mobile":"43","rhino":"1.7.13","safari":"10.0","samsung":"7.0"},"web.dom-collections.iterator":{"android":"66","chrome":"66","deno":"1.0","edge":"74","electron":"3.0","firefox":"60","ios":"13.4","node":"0.0.1","opera":"53","opera_mobile":"47","rhino":"1.7.13","safari":"13.1","samsung":"9.0"},"web.immediate":{"ie":"10","node":"0.9.1"},"web.queue-microtask":{"android":"71","chrome":"71","deno":"1.0","edge":"74","electron":"5.0","firefox":"69","ios":"12.2","node":"12.0","opera":"58","opera_mobile":"50","safari":"12.1","samsung":"10.0"},"web.timers":{"android":"1.5","chrome":"1","deno":"1.0","edge":"12","electron":"0.20","firefox":"1","ie":"10","ios":"1.0","node":"0.0.1","opera":"7","opera_mobile":"7","phantom":"1.9","rhino":"1.7.13","safari":"1.0","samsung":"1.0"},"web.url":{"android":"67","chrome":"67","deno":"1.0","edge":"74","electron":"4.0","firefox":"57","ios":"14.0","node":"10.0","opera":"54","opera_mobile":"48","safari":"14.0","samsung":"9.0"},"web.url.to-json":{"android":"71","chrome":"71","deno":"1.0","edge":"74","electron":"5.0","firefox":"57","ios":"14.0","node":"10.0","opera":"58","opera_mobile":"50","safari":"14.0","samsung":"10.0"},"web.url-search-params":{"android":"67","chrome":"67","deno":"1.0","edge":"74","electron":"4.0","firefox":"57","ios":"14.0","node":"10.0","opera":"54","opera_mobile":"48","safari":"14.0","samsung":"9.0"}}')},4503:e=>{"use strict";e.exports=JSON.parse('{"assert":true,"assert/strict":">= 15","async_hooks":">= 8","buffer_ieee754":"< 0.9.7","buffer":true,"child_process":true,"cluster":true,"console":true,"constants":true,"crypto":true,"_debug_agent":">= 1 && < 8","_debugger":"< 8","dgram":true,"diagnostics_channel":">= 15.1","dns":true,"dns/promises":">= 15","domain":">= 0.7.12","events":true,"freelist":"< 6","fs":true,"fs/promises":[">= 10 && < 10.1",">= 14"],"_http_agent":">= 0.11.1","_http_client":">= 0.11.1","_http_common":">= 0.11.1","_http_incoming":">= 0.11.1","_http_outgoing":">= 0.11.1","_http_server":">= 0.11.1","http":true,"http2":">= 8.8","https":true,"inspector":">= 8.0.0","_linklist":"< 8","module":true,"net":true,"node-inspect/lib/_inspect":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6.0 && < 12","os":true,"path":true,"path/posix":">= 15.3","path/win32":">= 15.3","perf_hooks":">= 8.5","process":">= 1","punycode":true,"querystring":true,"readline":true,"repl":true,"smalloc":">= 0.11.5 && < 3","_stream_duplex":">= 0.9.4","_stream_transform":">= 0.9.4","_stream_wrap":">= 1.4.1","_stream_passthrough":">= 0.9.4","_stream_readable":">= 0.9.4","_stream_writable":">= 0.9.4","stream":true,"stream/promises":">= 15","string_decoder":true,"sys":[">= 0.6 && < 0.7",">= 0.8"],"timers":true,"timers/promises":">= 15","_tls_common":">= 0.11.13","_tls_legacy":">= 0.11.3 && < 10","_tls_wrap":">= 0.11.3","tls":true,"trace_events":">= 10","tty":true,"url":true,"util":true,"util/types":">= 15.3","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/consarray":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/csvparser":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/logreader":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/profile_view":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/splaytree":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8":">= 1","vm":true,"wasi":">= 13.4 && < 13.5","worker_threads":">= 11.7","zlib":true}')}};var t={};function __nccwpck_require__(r){var s=t[r];if(s!==undefined){return s.exports}var a=t[r]={id:r,loaded:false,exports:{}};var n=true;try{e[r].call(a.exports,a,a.exports,__nccwpck_require__);n=false}finally{if(n)delete t[r]}a.loaded=true;return a.exports}(()=>{__nccwpck_require__.nmd=e=>{e.paths=[];if(!e.children)e.children=[];return e}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(3812);module.exports=r})(); \ No newline at end of file diff --git a/packages/next/compiled/webpack/bundle5.js b/packages/next/compiled/webpack/bundle5.js index 1480da205100d7b..fd1d6d65a405ddf 100644 --- a/packages/next/compiled/webpack/bundle5.js +++ b/packages/next/compiled/webpack/bundle5.js @@ -10139,15264 +10139,17434 @@ var __classPrivateFieldSet; /***/ }), -/***/ 42752: +/***/ 70665: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +const Variable = __webpack_require__(82971); -const DescriptionFileUtils = __webpack_require__(702); -const getInnerRequest = __webpack_require__(50290); +/** + * @class Definition + */ +class Definition { + constructor(type, name, node, parent, index, kind) { -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + /** + * @member {String} Definition#type - type of the occurrence (e.g. "Parameter", "Variable", ...). + */ + this.type = type; -module.exports = class AliasFieldPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string | Array} field field - * @param {string | ResolveStepHook} target target - */ - constructor(source, field, target) { - this.source = source; - this.field = field; - this.target = target; - } + /** + * @member {espree.Identifier} Definition#name - the identifier AST node of the occurrence. + */ + this.name = name; - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("AliasFieldPlugin", (request, resolveContext, callback) => { - if (!request.descriptionFileData) return callback(); - const innerRequest = getInnerRequest(resolver, request); - if (!innerRequest) return callback(); - const fieldData = DescriptionFileUtils.getField( - request.descriptionFileData, - this.field - ); - if (fieldData === null || typeof fieldData !== "object") { - if (resolveContext.log) - resolveContext.log( - "Field '" + - this.field + - "' doesn't contain a valid alias configuration" - ); - return callback(); - } - const data1 = fieldData[innerRequest]; - const data2 = fieldData[innerRequest.replace(/^\.\//, "")]; - const data = typeof data1 !== "undefined" ? data1 : data2; - if (data === innerRequest) return callback(); - if (data === undefined) return callback(); - if (data === false) { - /** @type {ResolveRequest} */ - const ignoreObj = { - ...request, - path: false - }; - return callback(null, ignoreObj); - } - const obj = { - ...request, - path: request.descriptionFileRoot, - request: data, - fullySpecified: false - }; - resolver.doResolve( - target, - obj, - "aliased from description file " + - request.descriptionFilePath + - " with mapping '" + - innerRequest + - "' to '" + - data + - "'", - resolveContext, - (err, result) => { - if (err) return callback(err); + /** + * @member {espree.Node} Definition#node - the enclosing node of the identifier. + */ + this.node = node; - // Don't allow other aliasing or raw request - if (result === undefined) return callback(null, null); - callback(null, result); - } - ); - }); - } + /** + * @member {espree.Node?} Definition#parent - the enclosing statement node of the identifier. + */ + this.parent = parent; + + /** + * @member {Number?} Definition#index - the index in the declaration statement. + */ + this.index = index; + + /** + * @member {String?} Definition#kind - the kind of the declaration statement. + */ + this.kind = kind; + } +} + +/** + * @class ParameterDefinition + */ +class ParameterDefinition extends Definition { + constructor(name, node, index, rest) { + super(Variable.Parameter, name, node, null, index, null); + + /** + * Whether the parameter definition is a part of a rest parameter. + * @member {boolean} ParameterDefinition#rest + */ + this.rest = rest; + } +} + +module.exports = { + ParameterDefinition, + Definition }; +/* vim: set sw=4 ts=4 et tw=80 : */ + /***/ }), -/***/ 51547: +/***/ 36007: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Copyright (C) 2012-2014 Yusuke Suzuki + Copyright (C) 2013 Alex Seville + Copyright (C) 2014 Thiago de Arruda + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/** + * Escope (escope) is an ECMAScript + * scope analyzer extracted from the esmangle project. + *

+ * escope finds lexical scopes in a source program, i.e. areas of that + * program where different occurrences of the same identifier refer to the same + * variable. With each scope the contained variables are collected, and each + * identifier reference in code is linked to its corresponding variable (if + * possible). + *

+ * escope works on a syntax tree of the parsed source code which has + * to adhere to the + * Mozilla Parser API. E.g. espree is a parser + * that produces such syntax trees. + *

+ * The main interface is the {@link analyze} function. + * @module escope + */ -const forEachBail = __webpack_require__(8266); +/* eslint no-underscore-dangle: ["error", { "allow": ["__currentScope"] }] */ -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -/** @typedef {{alias: string|Array|false, name: string, onlyModule?: boolean}} AliasOption */ +const assert = __webpack_require__(39491); -module.exports = class AliasPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {AliasOption | Array} options options - * @param {string | ResolveStepHook} target target - */ - constructor(source, options, target) { - this.source = source; - this.options = Array.isArray(options) ? options : [options]; - this.target = target; - } +const ScopeManager = __webpack_require__(96988); +const Referencer = __webpack_require__(44585); +const Reference = __webpack_require__(64945); +const Variable = __webpack_require__(82971); +const Scope = (__webpack_require__(16313).Scope); +const version = (__webpack_require__(30290)/* .version */ .i8); - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("AliasPlugin", (request, resolveContext, callback) => { - const innerRequest = request.request || request.path; - if (!innerRequest) return callback(); - forEachBail( - this.options, - (item, callback) => { - let shouldStop = false; - if ( - innerRequest === item.name || - (!item.onlyModule && innerRequest.startsWith(item.name + "/")) - ) { - const remainingRequest = innerRequest.substr(item.name.length); - const resolveWithAlias = (alias, callback) => { - if (alias === false) { - const ignoreObj = { - ...request, - path: false - }; - return callback(null, ignoreObj); - } - if ( - innerRequest !== alias && - !innerRequest.startsWith(alias + "/") - ) { - shouldStop = true; - const newRequestStr = alias + remainingRequest; - const obj = { - ...request, - request: newRequestStr, - fullySpecified: false - }; - return resolver.doResolve( - target, - obj, - "aliased with mapping '" + - item.name + - "': '" + - alias + - "' to '" + - newRequestStr + - "'", - resolveContext, - (err, result) => { - if (err) return callback(err); - if (result) return callback(null, result); - return callback(); - } - ); - } - return callback(); - }; - const stoppingCallback = (err, result) => { - if (err) return callback(err); +/** + * Set the default options + * @returns {Object} options + */ +function defaultOptions() { + return { + optimistic: false, + directive: false, + nodejsScope: false, + impliedStrict: false, + sourceType: "script", // one of ['script', 'module'] + ecmaVersion: 5, + childVisitorKeys: null, + fallback: "iteration" + }; +} - if (result) return callback(null, result); - // Don't allow other aliasing or raw request - if (shouldStop) return callback(null, null); - return callback(); - }; - if (Array.isArray(item.alias)) { - return forEachBail( - item.alias, - resolveWithAlias, - stoppingCallback - ); - } else { - return resolveWithAlias(item.alias, stoppingCallback); - } - } - return callback(); - }, - callback - ); - }); - } -}; +/** + * Preform deep update on option object + * @param {Object} target - Options + * @param {Object} override - Updates + * @returns {Object} Updated options + */ +function updateDeeply(target, override) { + /** + * Is hash object + * @param {Object} value - Test value + * @returns {boolean} Result + */ + function isHashObject(value) { + return typeof value === "object" && value instanceof Object && !(value instanceof Array) && !(value instanceof RegExp); + } -/***/ }), + for (const key in override) { + if (Object.prototype.hasOwnProperty.call(override, key)) { + const val = override[key]; -/***/ 66477: -/***/ (function(module) { + if (isHashObject(val)) { + if (isHashObject(target[key])) { + updateDeeply(target[key], val); + } else { + target[key] = updateDeeply({}, val); + } + } else { + target[key] = val; + } + } + } + return target; +} -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** + * Main interface function. Takes an Espree syntax tree and returns the + * analyzed scopes. + * @function analyze + * @param {espree.Tree} tree - Abstract Syntax Tree + * @param {Object} providedOptions - Options that tailor the scope analysis + * @param {boolean} [providedOptions.optimistic=false] - the optimistic flag + * @param {boolean} [providedOptions.directive=false]- the directive flag + * @param {boolean} [providedOptions.ignoreEval=false]- whether to check 'eval()' calls + * @param {boolean} [providedOptions.nodejsScope=false]- whether the whole + * script is executed under node.js environment. When enabled, escope adds + * a function scope immediately following the global scope. + * @param {boolean} [providedOptions.impliedStrict=false]- implied strict mode + * (if ecmaVersion >= 5). + * @param {string} [providedOptions.sourceType='script']- the source type of the script. one of 'script' and 'module' + * @param {number} [providedOptions.ecmaVersion=5]- which ECMAScript version is considered + * @param {Object} [providedOptions.childVisitorKeys=null] - Additional known visitor keys. See [esrecurse](https://github.com/estools/esrecurse)'s the `childVisitorKeys` option. + * @param {string} [providedOptions.fallback='iteration'] - A kind of the fallback in order to encounter with unknown node. See [esrecurse](https://github.com/estools/esrecurse)'s the `fallback` option. + * @returns {ScopeManager} ScopeManager + */ +function analyze(tree, providedOptions) { + const options = updateDeeply(defaultOptions(), providedOptions); + const scopeManager = new ScopeManager(options); + const referencer = new Referencer(options, scopeManager); + referencer.visit(tree); + assert(scopeManager.__currentScope === null, "currentScope should be null."); -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + return scopeManager; +} -module.exports = class AppendPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string} appending appending - * @param {string | ResolveStepHook} target target - */ - constructor(source, appending, target) { - this.source = source; - this.appending = appending; - this.target = target; - } +module.exports = { - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("AppendPlugin", (request, resolveContext, callback) => { - const obj = { - ...request, - path: request.path + this.appending, - relativePath: - request.relativePath && request.relativePath + this.appending - }; - resolver.doResolve( - target, - obj, - this.appending, - resolveContext, - callback - ); - }); - } + /** @name module:escope.version */ + version, + + /** @name module:escope.Reference */ + Reference, + + /** @name module:escope.Variable */ + Variable, + + /** @name module:escope.Scope */ + Scope, + + /** @name module:escope.ScopeManager */ + ScopeManager, + analyze }; +/* vim: set sw=4 ts=4 et tw=80 : */ + + /***/ }), -/***/ 89429: +/***/ 54162: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + Copyright (C) 2015 Yusuke Suzuki + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. -const nextTick = (__webpack_require__(77282).nextTick); + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ -/** @typedef {import("./Resolver").FileSystem} FileSystem */ -/** @typedef {import("./Resolver").SyncFileSystem} SyncFileSystem */ -const dirname = path => { - let idx = path.length - 1; - while (idx >= 0) { - const c = path.charCodeAt(idx); - // slash or backslash - if (c === 47 || c === 92) break; - idx--; - } - if (idx < 0) return ""; - return path.slice(0, idx); -}; +/* eslint-disable no-undefined */ -const runCallbacks = (callbacks, err, result) => { - if (callbacks.length === 1) { - callbacks[0](err, result); - callbacks.length = 0; - return; - } - let error; - for (const callback of callbacks) { - try { - callback(err, result); - } catch (e) { - if (!error) error = e; - } - } - callbacks.length = 0; - if (error) throw error; -}; +const Syntax = (__webpack_require__(18350).Syntax); +const esrecurse = __webpack_require__(81217); -class OperationMergerBackend { - /** - * @param {any} provider async method - * @param {any} syncProvider sync method - * @param {any} providerContext call context for the provider methods - */ - constructor(provider, syncProvider, providerContext) { - this._provider = provider; - this._syncProvider = syncProvider; - this._providerContext = providerContext; - this._activeAsyncOperations = new Map(); +/** + * Get last array element + * @param {array} xs - array + * @returns {any} Last elment + */ +function getLast(xs) { + return xs[xs.length - 1] || null; +} - this.provide = this._provider - ? (path, options, callback) => { - if (typeof options === "function") { - callback = options; - options = undefined; - } - if (options) { - return this._provider.call( - this._providerContext, - path, - options, - callback - ); - } - if (typeof path !== "string") { - callback(new TypeError("path must be a string")); - return; - } - let callbacks = this._activeAsyncOperations.get(path); - if (callbacks) { - callbacks.push(callback); - return; - } - this._activeAsyncOperations.set(path, (callbacks = [callback])); - provider(path, (err, result) => { - this._activeAsyncOperations.delete(path); - runCallbacks(callbacks, err, result); - }); - } - : null; - this.provideSync = this._syncProvider - ? (path, options) => { - return this._syncProvider.call(this._providerContext, path, options); - } - : null; - } +class PatternVisitor extends esrecurse.Visitor { + static isPattern(node) { + const nodeType = node.type; - purge() {} - purgeParent() {} -} + return ( + nodeType === Syntax.Identifier || + nodeType === Syntax.ObjectPattern || + nodeType === Syntax.ArrayPattern || + nodeType === Syntax.SpreadElement || + nodeType === Syntax.RestElement || + nodeType === Syntax.AssignmentPattern + ); + } -/* + constructor(options, rootPattern, callback) { + super(null, options); + this.rootPattern = rootPattern; + this.callback = callback; + this.assignments = []; + this.rightHandNodes = []; + this.restElements = []; + } -IDLE: - insert data: goto SYNC + Identifier(pattern) { + const lastRestElement = getLast(this.restElements); -SYNC: - before provide: run ticks - event loop tick: goto ASYNC_ACTIVE + this.callback(pattern, { + topLevel: pattern === this.rootPattern, + rest: lastRestElement !== null && lastRestElement !== undefined && lastRestElement.argument === pattern, + assignments: this.assignments + }); + } -ASYNC: - timeout: run tick, goto ASYNC_PASSIVE + Property(property) { -ASYNC_PASSIVE: - before provide: run ticks + // Computed property's key is a right hand node. + if (property.computed) { + this.rightHandNodes.push(property.key); + } -IDLE --[insert data]--> SYNC --[event loop tick]--> ASYNC_ACTIVE --[interval tick]-> ASYNC_PASSIVE - ^ | - +---------[insert data]-------+ -*/ + // If it's shorthand, its key is same as its value. + // If it's shorthand and has its default value, its key is same as its value.left (the value is AssignmentPattern). + // If it's not shorthand, the name of new variable is its value's. + this.visit(property.value); + } -const STORAGE_MODE_IDLE = 0; -const STORAGE_MODE_SYNC = 1; -const STORAGE_MODE_ASYNC = 2; + ArrayPattern(pattern) { + for (let i = 0, iz = pattern.elements.length; i < iz; ++i) { + const element = pattern.elements[i]; -class CacheBackend { - /** - * @param {number} duration max cache duration of items - * @param {any} provider async method - * @param {any} syncProvider sync method - * @param {any} providerContext call context for the provider methods - */ - constructor(duration, provider, syncProvider, providerContext) { - this._duration = duration; - this._provider = provider; - this._syncProvider = syncProvider; - this._providerContext = providerContext; - /** @type {Map} */ - this._activeAsyncOperations = new Map(); - /** @type {Map }>} */ - this._data = new Map(); - /** @type {Set[]} */ - this._levels = []; - for (let i = 0; i < 10; i++) this._levels.push(new Set()); - for (let i = 5000; i < duration; i += 500) this._levels.push(new Set()); - this._currentLevel = 0; - this._tickInterval = Math.floor(duration / this._levels.length); - /** @type {STORAGE_MODE_IDLE | STORAGE_MODE_SYNC | STORAGE_MODE_ASYNC} */ - this._mode = STORAGE_MODE_IDLE; + this.visit(element); + } + } - /** @type {NodeJS.Timeout | undefined} */ - this._timeout = undefined; - /** @type {number | undefined} */ - this._nextDecay = undefined; + AssignmentPattern(pattern) { + this.assignments.push(pattern); + this.visit(pattern.left); + this.rightHandNodes.push(pattern.right); + this.assignments.pop(); + } - this.provide = provider ? this.provide.bind(this) : null; - this.provideSync = syncProvider ? this.provideSync.bind(this) : null; - } + RestElement(pattern) { + this.restElements.push(pattern); + this.visit(pattern.argument); + this.restElements.pop(); + } - provide(path, options, callback) { - if (typeof options === "function") { - callback = options; - options = undefined; - } - if (typeof path !== "string") { - callback(new TypeError("path must be a string")); - return; - } - if (options) { - return this._provider.call( - this._providerContext, - path, - options, - callback - ); - } + MemberExpression(node) { - // When in sync mode we can move to async mode - if (this._mode === STORAGE_MODE_SYNC) { - this._enterAsyncMode(); - } + // Computed property's key is a right hand node. + if (node.computed) { + this.rightHandNodes.push(node.property); + } - // Check in cache - let cacheEntry = this._data.get(path); - if (cacheEntry !== undefined) { - if (cacheEntry.err) return nextTick(callback, cacheEntry.err); - return nextTick(callback, null, cacheEntry.result); - } + // the object is only read, write to its property. + this.rightHandNodes.push(node.object); + } - // Check if there is already the same operation running - let callbacks = this._activeAsyncOperations.get(path); - if (callbacks !== undefined) { - callbacks.push(callback); - return; - } - this._activeAsyncOperations.set(path, (callbacks = [callback])); + // + // ForInStatement.left and AssignmentExpression.left are LeftHandSideExpression. + // By spec, LeftHandSideExpression is Pattern or MemberExpression. + // (see also: https://github.com/estree/estree/pull/20#issuecomment-74584758) + // But espree 2.0 parses to ArrayExpression, ObjectExpression, etc... + // - // Run the operation - this._provider.call(this._providerContext, path, (err, result) => { - this._activeAsyncOperations.delete(path); - this._storeResult(path, err, result); + SpreadElement(node) { + this.visit(node.argument); + } - // Enter async mode if not yet done - this._enterAsyncMode(); + ArrayExpression(node) { + node.elements.forEach(this.visit, this); + } - runCallbacks(callbacks, err, result); - }); - } + AssignmentExpression(node) { + this.assignments.push(node); + this.visit(node.left); + this.rightHandNodes.push(node.right); + this.assignments.pop(); + } - provideSync(path, options) { - if (typeof path !== "string") { - throw new TypeError("path must be a string"); - } - if (options) { - return this._syncProvider.call(this._providerContext, path, options); - } + CallExpression(node) { - // In sync mode we may have to decay some cache items - if (this._mode === STORAGE_MODE_SYNC) { - this._runDecays(); - } + // arguments are right hand nodes. + node.arguments.forEach(a => { + this.rightHandNodes.push(a); + }); + this.visit(node.callee); + } +} - // Check in cache - let cacheEntry = this._data.get(path); - if (cacheEntry !== undefined) { - if (cacheEntry.err) throw cacheEntry.err; - return cacheEntry.result; - } +module.exports = PatternVisitor; - // Get all active async operations - // This sync operation will also complete them - const callbacks = this._activeAsyncOperations.get(path); - this._activeAsyncOperations.delete(path); +/* vim: set sw=4 ts=4 et tw=80 : */ - // Run the operation - // When in idle mode, we will enter sync mode - let result; - try { - result = this._syncProvider.call(this._providerContext, path); - } catch (err) { - this._storeResult(path, err, undefined); - this._enterSyncModeWhenIdle(); - if (callbacks) runCallbacks(callbacks, err, undefined); - throw err; - } - this._storeResult(path, undefined, result); - this._enterSyncModeWhenIdle(); - if (callbacks) runCallbacks(callbacks, undefined, result); - return result; - } - purge(what) { - if (!what) { - if (this._mode !== STORAGE_MODE_IDLE) { - this._data.clear(); - for (const level of this._levels) { - level.clear(); - } - this._enterIdleMode(); - } - } else if (typeof what === "string") { - for (let [key, data] of this._data) { - if (key.startsWith(what)) { - this._data.delete(key); - data.level.delete(key); - } - } - if (this._data.size === 0) { - this._enterIdleMode(); - } - } else { - for (let [key, data] of this._data) { - for (const item of what) { - if (key.startsWith(item)) { - this._data.delete(key); - data.level.delete(key); - break; - } - } - } - if (this._data.size === 0) { - this._enterIdleMode(); - } - } - } +/***/ }), - purgeParent(what) { - if (!what) { - this.purge(); - } else if (typeof what === "string") { - this.purge(dirname(what)); - } else { - const set = new Set(); - for (const item of what) { - set.add(dirname(item)); - } - this.purge(set); - } - } +/***/ 64945: +/***/ (function(module) { - _storeResult(path, err, result) { - if (this._data.has(path)) return; - const level = this._levels[this._currentLevel]; - this._data.set(path, { err, result, level }); - level.add(path); - } +"use strict"; +/* + Copyright (C) 2015 Yusuke Suzuki - _decayLevel() { - const nextLevel = (this._currentLevel + 1) % this._levels.length; - const decay = this._levels[nextLevel]; - this._currentLevel = nextLevel; - for (let item of decay) { - this._data.delete(item); - } - decay.clear(); - if (this._data.size === 0) { - this._enterIdleMode(); - } else { - // @ts-ignore _nextDecay is always a number in sync mode - this._nextDecay += this._tickInterval; - } - } + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: - _runDecays() { - while ( - /** @type {number} */ (this._nextDecay) <= Date.now() && - this._mode !== STORAGE_MODE_IDLE - ) { - this._decayLevel(); - } - } + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - _enterAsyncMode() { - let timeout = 0; - switch (this._mode) { - case STORAGE_MODE_ASYNC: - return; - case STORAGE_MODE_IDLE: - this._nextDecay = Date.now() + this._tickInterval; - timeout = this._tickInterval; - break; - case STORAGE_MODE_SYNC: - this._runDecays(); - // @ts-ignore _runDecays may change the mode - if (this._mode === STORAGE_MODE_IDLE) return; - timeout = Math.max( - 0, - /** @type {number} */ (this._nextDecay) - Date.now() - ); - break; - } - this._mode = STORAGE_MODE_ASYNC; - const ref = setTimeout(() => { - this._mode = STORAGE_MODE_SYNC; - this._runDecays(); - }, timeout); - if (ref.unref) ref.unref(); - this._timeout = ref; - } + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ - _enterSyncModeWhenIdle() { - if (this._mode === STORAGE_MODE_IDLE) { - this._mode = STORAGE_MODE_SYNC; - this._nextDecay = Date.now() + this._tickInterval; - } - } - _enterIdleMode() { - this._mode = STORAGE_MODE_IDLE; - this._nextDecay = undefined; - if (this._timeout) clearTimeout(this._timeout); - } -} +const READ = 0x1; +const WRITE = 0x2; +const RW = READ | WRITE; -const createBackend = (duration, provider, syncProvider, providerContext) => { - if (duration > 0) { - return new CacheBackend(duration, provider, syncProvider, providerContext); - } - return new OperationMergerBackend(provider, syncProvider, providerContext); -}; +/** + * A Reference represents a single occurrence of an identifier in code. + * @class Reference + */ +class Reference { + constructor(ident, scope, flag, writeExpr, maybeImplicitGlobal, partial, init) { -module.exports = class CachedInputFileSystem { - constructor(fileSystem, duration) { - this.fileSystem = fileSystem; + /** + * Identifier syntax node. + * @member {espreeIdentifier} Reference#identifier + */ + this.identifier = ident; - this._lstatBackend = createBackend( - duration, - this.fileSystem.lstat, - this.fileSystem.lstatSync, - this.fileSystem - ); - const lstat = this._lstatBackend.provide; - this.lstat = /** @type {FileSystem["lstat"]} */ (lstat); - const lstatSync = this._lstatBackend.provideSync; - this.lstatSync = /** @type {SyncFileSystem["lstatSync"]} */ (lstatSync); + /** + * Reference to the enclosing Scope. + * @member {Scope} Reference#from + */ + this.from = scope; - this._statBackend = createBackend( - duration, - this.fileSystem.stat, - this.fileSystem.statSync, - this.fileSystem - ); - const stat = this._statBackend.provide; - this.stat = /** @type {FileSystem["stat"]} */ (stat); - const statSync = this._statBackend.provideSync; - this.statSync = /** @type {SyncFileSystem["statSync"]} */ (statSync); + /** + * Whether the reference comes from a dynamic scope (such as 'eval', + * 'with', etc.), and may be trapped by dynamic scopes. + * @member {boolean} Reference#tainted + */ + this.tainted = false; - this._readdirBackend = createBackend( - duration, - this.fileSystem.readdir, - this.fileSystem.readdirSync, - this.fileSystem - ); - const readdir = this._readdirBackend.provide; - this.readdir = /** @type {FileSystem["readdir"]} */ (readdir); - const readdirSync = this._readdirBackend.provideSync; - this.readdirSync = /** @type {SyncFileSystem["readdirSync"]} */ (readdirSync); + /** + * The variable this reference is resolved with. + * @member {Variable} Reference#resolved + */ + this.resolved = null; - this._readFileBackend = createBackend( - duration, - this.fileSystem.readFile, - this.fileSystem.readFileSync, - this.fileSystem - ); - const readFile = this._readFileBackend.provide; - this.readFile = /** @type {FileSystem["readFile"]} */ (readFile); - const readFileSync = this._readFileBackend.provideSync; - this.readFileSync = /** @type {SyncFileSystem["readFileSync"]} */ (readFileSync); + /** + * The read-write mode of the reference. (Value is one of {@link + * Reference.READ}, {@link Reference.RW}, {@link Reference.WRITE}). + * @member {number} Reference#flag + * @private + */ + this.flag = flag; + if (this.isWrite()) { - this._readJsonBackend = createBackend( - duration, - this.fileSystem.readJson || - (this.readFile && - ((path, callback) => { - // @ts-ignore - this.readFile(path, (err, buffer) => { - if (err) return callback(err); - if (!buffer || buffer.length === 0) - return callback(new Error("No file content")); - let data; - try { - data = JSON.parse(buffer.toString("utf-8")); - } catch (e) { - return callback(e); - } - callback(null, data); - }); - })), - this.fileSystem.readJsonSync || - (this.readFileSync && - (path => { - const buffer = this.readFileSync(path); - const data = JSON.parse(buffer.toString("utf-8")); - return data; - })), - this.fileSystem - ); - const readJson = this._readJsonBackend.provide; - this.readJson = /** @type {FileSystem["readJson"]} */ (readJson); - const readJsonSync = this._readJsonBackend.provideSync; - this.readJsonSync = /** @type {SyncFileSystem["readJsonSync"]} */ (readJsonSync); + /** + * If reference is writeable, this is the tree being written to it. + * @member {espreeNode} Reference#writeExpr + */ + this.writeExpr = writeExpr; - this._readlinkBackend = createBackend( - duration, - this.fileSystem.readlink, - this.fileSystem.readlinkSync, - this.fileSystem - ); - const readlink = this._readlinkBackend.provide; - this.readlink = /** @type {FileSystem["readlink"]} */ (readlink); - const readlinkSync = this._readlinkBackend.provideSync; - this.readlinkSync = /** @type {SyncFileSystem["readlinkSync"]} */ (readlinkSync); - } + /** + * Whether the Reference might refer to a partial value of writeExpr. + * @member {boolean} Reference#partial + */ + this.partial = partial; - purge(what) { - this._statBackend.purge(what); - this._lstatBackend.purge(what); - this._readdirBackend.purgeParent(what); - this._readFileBackend.purge(what); - this._readlinkBackend.purge(what); - this._readJsonBackend.purge(what); - } -}; + /** + * Whether the Reference is to write of initialization. + * @member {boolean} Reference#init + */ + this.init = init; + } + this.__maybeImplicitGlobal = maybeImplicitGlobal; + } + /** + * Whether the reference is static. + * @method Reference#isStatic + * @returns {boolean} static + */ + isStatic() { + return !this.tainted && this.resolved && this.resolved.scope.isStatic(); + } -/***/ }), + /** + * Whether the reference is writeable. + * @method Reference#isWrite + * @returns {boolean} write + */ + isWrite() { + return !!(this.flag & Reference.WRITE); + } -/***/ 2020: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * Whether the reference is readable. + * @method Reference#isRead + * @returns {boolean} read + */ + isRead() { + return !!(this.flag & Reference.READ); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * Whether the reference is read-only. + * @method Reference#isReadOnly + * @returns {boolean} read only + */ + isReadOnly() { + return this.flag === Reference.READ; + } + /** + * Whether the reference is write-only. + * @method Reference#isWriteOnly + * @returns {boolean} write only + */ + isWriteOnly() { + return this.flag === Reference.WRITE; + } + /** + * Whether the reference is read-write. + * @method Reference#isReadWrite + * @returns {boolean} read write + */ + isReadWrite() { + return this.flag === Reference.RW; + } +} -const basename = (__webpack_require__(48608).basename); +/** + * @constant Reference.READ + * @private + */ +Reference.READ = READ; -/** @typedef {import("./Resolver")} Resolver */ +/** + * @constant Reference.WRITE + * @private + */ +Reference.WRITE = WRITE; -module.exports = class CloneBasenamePlugin { - constructor(source, target) { - this.source = source; - this.target = target; - } +/** + * @constant Reference.RW + * @private + */ +Reference.RW = RW; - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("CloneBasenamePlugin", (request, resolveContext, callback) => { - const filename = basename(request.path); - const filePath = resolver.join(request.path, filename); - const obj = { - ...request, - path: filePath, - relativePath: - request.relativePath && - resolver.join(request.relativePath, filename) - }; - resolver.doResolve( - target, - obj, - "using path: " + filePath, - resolveContext, - callback - ); - }); - } -}; +module.exports = Reference; + +/* vim: set sw=4 ts=4 et tw=80 : */ /***/ }), -/***/ 44193: -/***/ (function(module) { +/***/ 44585: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + Copyright (C) 2015 Yusuke Suzuki + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ -module.exports = class ConditionalPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {Partial} test compare object - * @param {string | null} message log message - * @param {boolean} allowAlternatives when false, do not continue with the current step when "test" matches - * @param {string | ResolveStepHook} target target - */ - constructor(source, test, message, allowAlternatives, target) { - this.source = source; - this.test = test; - this.message = message; - this.allowAlternatives = allowAlternatives; - this.target = target; - } - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - const { test, message, allowAlternatives } = this; - const keys = Object.keys(test); - resolver - .getHook(this.source) - .tapAsync("ConditionalPlugin", (request, resolveContext, callback) => { - for (const prop of keys) { - if (request[prop] !== test[prop]) return callback(); - } - resolver.doResolve( - target, - request, - message, - resolveContext, - allowAlternatives - ? callback - : (err, result) => { - if (err) return callback(err); +/* eslint-disable no-underscore-dangle */ +/* eslint-disable no-undefined */ - // Don't allow other alternatives - if (result === undefined) return callback(null, null); - callback(null, result); - } - ); - }); - } -}; +const Syntax = (__webpack_require__(18350).Syntax); +const esrecurse = __webpack_require__(81217); +const Reference = __webpack_require__(64945); +const Variable = __webpack_require__(82971); +const PatternVisitor = __webpack_require__(54162); +const definition = __webpack_require__(70665); +const assert = __webpack_require__(39491); +const ParameterDefinition = definition.ParameterDefinition; +const Definition = definition.Definition; -/***/ }), +/** + * Traverse identifier in pattern + * @param {Object} options - options + * @param {pattern} rootPattern - root pattern + * @param {Refencer} referencer - referencer + * @param {callback} callback - callback + * @returns {void} + */ +function traverseIdentifierInPattern(options, rootPattern, referencer, callback) { -/***/ 66826: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Call the callback at left hand identifier nodes, and Collect right hand nodes. + const visitor = new PatternVisitor(options, rootPattern, callback); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + visitor.visit(rootPattern); + // Process the right hand nodes recursively. + if (referencer !== null && referencer !== undefined) { + visitor.rightHandNodes.forEach(referencer.visit, referencer); + } +} +// Importing ImportDeclaration. +// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-moduledeclarationinstantiation +// https://github.com/estree/estree/blob/master/es6.md#importdeclaration +// FIXME: Now, we don't create module environment, because the context is +// implementation dependent. -const DescriptionFileUtils = __webpack_require__(702); +class Importer extends esrecurse.Visitor { + constructor(declaration, referencer) { + super(null, referencer.options); + this.declaration = declaration; + this.referencer = referencer; + } -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + visitImport(id, specifier) { + this.referencer.visitPattern(id, pattern => { + this.referencer.currentScope().__define(pattern, + new Definition( + Variable.ImportBinding, + pattern, + specifier, + this.declaration, + null, + null + )); + }); + } -module.exports = class DescriptionFilePlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string[]} filenames filenames - * @param {boolean} pathIsFile pathIsFile - * @param {string | ResolveStepHook} target target - */ - constructor(source, filenames, pathIsFile, target) { - this.source = source; - this.filenames = filenames; - this.pathIsFile = pathIsFile; - this.target = target; - } + ImportNamespaceSpecifier(node) { + const local = (node.local || node.id); - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync( - "DescriptionFilePlugin", - (request, resolveContext, callback) => { - const path = request.path; - if (!path) return callback(); - const directory = this.pathIsFile - ? DescriptionFileUtils.cdUp(path) - : path; - if (!directory) return callback(); - DescriptionFileUtils.loadDescriptionFile( - resolver, - directory, - this.filenames, - request.descriptionFilePath - ? { - path: request.descriptionFilePath, - content: request.descriptionFileData, - directory: /** @type {string} */ (request.descriptionFileRoot) - } - : undefined, - resolveContext, - (err, result) => { - if (err) return callback(err); - if (!result) { - if (resolveContext.log) - resolveContext.log( - `No description file found in ${directory} or above` - ); - return callback(); - } - const relativePath = - "." + path.substr(result.directory.length).replace(/\\/g, "/"); - const obj = { - ...request, - descriptionFilePath: result.path, - descriptionFileData: result.content, - descriptionFileRoot: result.directory, - relativePath: relativePath - }; - resolver.doResolve( - target, - obj, - "using description file: " + - result.path + - " (relative path: " + - relativePath + - ")", - resolveContext, - (err, result) => { - if (err) return callback(err); + if (local) { + this.visitImport(local, node); + } + } - // Don't allow other processing - if (result === undefined) return callback(null, null); - callback(null, result); - } - ); - } - ); - } - ); - } -}; + ImportDefaultSpecifier(node) { + const local = (node.local || node.id); + this.visitImport(local, node); + } -/***/ }), + ImportSpecifier(node) { + const local = (node.local || node.id); -/***/ 702: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + if (node.name) { + this.visitImport(node.name, node); + } else { + this.visitImport(local, node); + } + } +} -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +// Referencing variables and creating bindings. +class Referencer extends esrecurse.Visitor { + constructor(options, scopeManager) { + super(null, options); + this.options = options; + this.scopeManager = scopeManager; + this.parent = null; + this.isInnerMethodDefinition = false; + } + currentScope() { + return this.scopeManager.__currentScope; + } + close(node) { + while (this.currentScope() && node === this.currentScope().block) { + this.scopeManager.__currentScope = this.currentScope().__close(this.scopeManager); + } + } -const forEachBail = __webpack_require__(8266); + pushInnerMethodDefinition(isInnerMethodDefinition) { + const previous = this.isInnerMethodDefinition; -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveContext} ResolveContext */ + this.isInnerMethodDefinition = isInnerMethodDefinition; + return previous; + } -/** - * @typedef {Object} DescriptionFileInfo - * @property {any=} content - * @property {string} path - * @property {string} directory - */ + popInnerMethodDefinition(isInnerMethodDefinition) { + this.isInnerMethodDefinition = isInnerMethodDefinition; + } -/** - * @callback ErrorFirstCallback - * @param {Error|null=} error - * @param {DescriptionFileInfo=} result - */ + referencingDefaultValue(pattern, assignments, maybeImplicitGlobal, init) { + const scope = this.currentScope(); -/** - * @param {Resolver} resolver resolver - * @param {string} directory directory - * @param {string[]} filenames filenames - * @param {DescriptionFileInfo|undefined} oldInfo oldInfo - * @param {ResolveContext} resolveContext resolveContext - * @param {ErrorFirstCallback} callback callback - */ -function loadDescriptionFile( - resolver, - directory, - filenames, - oldInfo, - resolveContext, - callback -) { - (function findDescriptionFile() { - if (oldInfo && oldInfo.directory === directory) { - // We already have info for this directory and can reuse it - return callback(null, oldInfo); - } - forEachBail( - filenames, - (filename, callback) => { - const descriptionFilePath = resolver.join(directory, filename); - if (resolver.fileSystem.readJson) { - resolver.fileSystem.readJson(descriptionFilePath, (err, content) => { - if (err) { - if (typeof err.code !== "undefined") { - if (resolveContext.missingDependencies) { - resolveContext.missingDependencies.add(descriptionFilePath); - } - return callback(); - } - if (resolveContext.fileDependencies) { - resolveContext.fileDependencies.add(descriptionFilePath); - } - return onJson(err); - } - if (resolveContext.fileDependencies) { - resolveContext.fileDependencies.add(descriptionFilePath); - } - onJson(null, content); - }); - } else { - resolver.fileSystem.readFile(descriptionFilePath, (err, content) => { - if (err) { - if (resolveContext.missingDependencies) { - resolveContext.missingDependencies.add(descriptionFilePath); - } - return callback(); - } - if (resolveContext.fileDependencies) { - resolveContext.fileDependencies.add(descriptionFilePath); - } - let json; + assignments.forEach(assignment => { + scope.__referencing( + pattern, + Reference.WRITE, + assignment.right, + maybeImplicitGlobal, + pattern !== assignment.left, + init + ); + }); + } - if (content) { - try { - json = JSON.parse(content.toString()); - } catch (e) { - return onJson(e); - } - } else { - return onJson(new Error("No content in file")); - } + visitPattern(node, options, callback) { + let visitPatternOptions = options; + let visitPatternCallback = callback; - onJson(null, json); - }); - } + if (typeof options === "function") { + visitPatternCallback = options; + visitPatternOptions = { processRightHandNodes: false }; + } - function onJson(err, content) { - if (err) { - if (resolveContext.log) - resolveContext.log( - descriptionFilePath + " (directory description file): " + err - ); - else - err.message = - descriptionFilePath + " (directory description file): " + err; - return callback(err); - } - callback(null, { - content, - directory, - path: descriptionFilePath - }); - } - }, - (err, result) => { - if (err) return callback(err); - if (result) { - return callback(null, result); - } else { - const dir = cdUp(directory); - if (!dir) { - return callback(); - } else { - directory = dir; - return findDescriptionFile(); - } - } - } - ); - })(); -} + traverseIdentifierInPattern( + this.options, + node, + visitPatternOptions.processRightHandNodes ? this : null, + visitPatternCallback + ); + } -/** - * @param {any} content content - * @param {string|string[]} field field - * @returns {object|string|number|boolean|undefined} field data - */ -function getField(content, field) { - if (!content) return undefined; - if (Array.isArray(field)) { - let current = content; - for (let j = 0; j < field.length; j++) { - if (current === null || typeof current !== "object") { - current = null; - break; - } - current = current[field[j]]; - } - return current; - } else { - return content[field]; - } -} + visitFunction(node) { + let i, iz; -/** - * @param {string} directory directory - * @returns {string|null} parent directory or null - */ -function cdUp(directory) { - if (directory === "/") return null; - const i = directory.lastIndexOf("/"), - j = directory.lastIndexOf("\\"); - const p = i < 0 ? j : j < 0 ? i : i < j ? j : i; - if (p < 0) return null; - return directory.substr(0, p || 1); -} + // FunctionDeclaration name is defined in upper scope + // NOTE: Not referring variableScope. It is intended. + // Since + // in ES5, FunctionDeclaration should be in FunctionBody. + // in ES6, FunctionDeclaration should be block scoped. -exports.loadDescriptionFile = loadDescriptionFile; -exports.getField = getField; -exports.cdUp = cdUp; + if (node.type === Syntax.FunctionDeclaration) { + // id is defined in upper scope + this.currentScope().__define(node.id, + new Definition( + Variable.FunctionName, + node.id, + node, + null, + null, + null + )); + } -/***/ }), + // FunctionExpression with name creates its special scope; + // FunctionExpressionNameScope. + if (node.type === Syntax.FunctionExpression && node.id) { + this.scopeManager.__nestFunctionExpressionNameScope(node); + } -/***/ 73688: -/***/ (function(module) { + // Consider this function is in the MethodDefinition. + this.scopeManager.__nestFunctionScope(node, this.isInnerMethodDefinition); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const that = this; + /** + * Visit pattern callback + * @param {pattern} pattern - pattern + * @param {Object} info - info + * @returns {void} + */ + function visitPatternCallback(pattern, info) { + that.currentScope().__define(pattern, + new ParameterDefinition( + pattern, + node, + i, + info.rest + )); + that.referencingDefaultValue(pattern, info.assignments, null, true); + } -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + // Process parameter declarations. + for (i = 0, iz = node.params.length; i < iz; ++i) { + this.visitPattern(node.params[i], { processRightHandNodes: true }, visitPatternCallback); + } -module.exports = class DirectoryExistsPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string | ResolveStepHook} target target - */ - constructor(source, target) { - this.source = source; - this.target = target; - } + // if there's a rest argument, add that + if (node.rest) { + this.visitPattern({ + type: "RestElement", + argument: node.rest + }, pattern => { + this.currentScope().__define(pattern, + new ParameterDefinition( + pattern, + node, + node.params.length, + true + )); + }); + } - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync( - "DirectoryExistsPlugin", - (request, resolveContext, callback) => { - const fs = resolver.fileSystem; - const directory = request.path; - if (!directory) return callback(); - fs.stat(directory, (err, stat) => { - if (err || !stat) { - if (resolveContext.missingDependencies) - resolveContext.missingDependencies.add(directory); - if (resolveContext.log) - resolveContext.log(directory + " doesn't exist"); - return callback(); - } - if (!stat.isDirectory()) { - if (resolveContext.missingDependencies) - resolveContext.missingDependencies.add(directory); - if (resolveContext.log) - resolveContext.log(directory + " is not a directory"); - return callback(); - } - if (resolveContext.fileDependencies) - resolveContext.fileDependencies.add(directory); - resolver.doResolve( - target, - request, - `existing directory ${directory}`, - resolveContext, - callback - ); - }); - } - ); - } -}; + // In TypeScript there are a number of function-like constructs which have no body, + // so check it exists before traversing + if (node.body) { + // Skip BlockStatement to prevent creating BlockStatement scope. + if (node.body.type === Syntax.BlockStatement) { + this.visitChildren(node.body); + } else { + this.visit(node.body); + } + } -/***/ }), + this.close(node); + } -/***/ 80163: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + visitClass(node) { + if (node.type === Syntax.ClassDeclaration) { + this.currentScope().__define(node.id, + new Definition( + Variable.ClassName, + node.id, + node, + null, + null, + null + )); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ + this.visit(node.superClass); + this.scopeManager.__nestClassScope(node); + if (node.id) { + this.currentScope().__define(node.id, + new Definition( + Variable.ClassName, + node.id, + node + )); + } + this.visit(node.body); -const path = __webpack_require__(71017); -const DescriptionFileUtils = __webpack_require__(702); -const forEachBail = __webpack_require__(8266); -const { processExportsField } = __webpack_require__(28348); -const { parseIdentifier } = __webpack_require__(7780); -const { checkExportsFieldTarget } = __webpack_require__(3011); + this.close(node); + } -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -/** @typedef {import("./util/entrypoints").ExportsField} ExportsField */ -/** @typedef {import("./util/entrypoints").FieldProcessor} FieldProcessor */ + visitProperty(node) { + let previous; -module.exports = class ExportsFieldPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {Set} conditionNames condition names - * @param {string | string[]} fieldNamePath name path - * @param {string | ResolveStepHook} target target - */ - constructor(source, conditionNames, fieldNamePath, target) { - this.source = source; - this.target = target; - this.conditionNames = conditionNames; - this.fieldName = fieldNamePath; - /** @type {WeakMap} */ - this.fieldProcessorCache = new WeakMap(); - } + if (node.computed) { + this.visit(node.key); + } - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("ExportsFieldPlugin", (request, resolveContext, callback) => { - // When there is no description file, abort - if (!request.descriptionFilePath) return callback(); - if ( - // When the description file is inherited from parent, abort - // (There is no description file inside of this package) - request.relativePath !== "." || - request.request === undefined - ) - return callback(); + const isMethodDefinition = node.type === Syntax.MethodDefinition; - const remainingRequest = - request.query || request.fragment - ? (request.request === "." ? "./" : request.request) + - request.query + - request.fragment - : request.request; - /** @type {ExportsField|null} */ - const exportsField = DescriptionFileUtils.getField( - request.descriptionFileData, - this.fieldName - ); - if (!exportsField) return callback(); + if (isMethodDefinition) { + previous = this.pushInnerMethodDefinition(true); + } + this.visit(node.value); + if (isMethodDefinition) { + this.popInnerMethodDefinition(previous); + } + } - if (request.directory) { - return callback( - new Error( - `Resolving to directories is not possible with the exports field (request was ${remainingRequest}/)` - ) - ); - } + visitForIn(node) { + if (node.left.type === Syntax.VariableDeclaration && node.left.kind !== "var") { + this.scopeManager.__nestForScope(node); + } - let paths; + if (node.left.type === Syntax.VariableDeclaration) { + this.visit(node.left); + this.visitPattern(node.left.declarations[0].id, pattern => { + this.currentScope().__referencing(pattern, Reference.WRITE, node.right, null, true, true); + }); + } else { + this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => { + let maybeImplicitGlobal = null; - try { - // We attach the cache to the description file instead of the exportsField value - // because we use a WeakMap and the exportsField could be a string too. - // Description file is always an object when exports field can be accessed. - let fieldProcessor = this.fieldProcessorCache.get( - request.descriptionFileData - ); - if (fieldProcessor === undefined) { - fieldProcessor = processExportsField(exportsField); - this.fieldProcessorCache.set( - request.descriptionFileData, - fieldProcessor - ); - } - paths = fieldProcessor(remainingRequest, this.conditionNames); - } catch (err) { - if (resolveContext.log) { - resolveContext.log( - `Exports field in ${request.descriptionFilePath} can't be processed: ${err}` - ); - } - return callback(err); - } + if (!this.currentScope().isStrict) { + maybeImplicitGlobal = { + pattern, + node + }; + } + this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false); + this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, true, false); + }); + } + this.visit(node.right); + this.visit(node.body); - if (paths.length === 0) { - return callback( - new Error( - `Package path ${remainingRequest} is not exported from package ${request.descriptionFileRoot} (see exports field in ${request.descriptionFilePath})` - ) - ); - } + this.close(node); + } - forEachBail( - paths, - (p, callback) => { - const parsedIdentifier = parseIdentifier(p); + visitVariableDeclaration(variableTargetScope, type, node, index) { - if (!parsedIdentifier) return callback(); + const decl = node.declarations[index]; + const init = decl.init; - const [relativePath, query, fragment] = parsedIdentifier; + this.visitPattern(decl.id, { processRightHandNodes: true }, (pattern, info) => { + variableTargetScope.__define( + pattern, + new Definition( + type, + pattern, + decl, + node, + index, + node.kind + ) + ); - const error = checkExportsFieldTarget(relativePath); + this.referencingDefaultValue(pattern, info.assignments, null, true); + if (init) { + this.currentScope().__referencing(pattern, Reference.WRITE, init, null, !info.topLevel, true); + } + }); + } - if (error) { - return callback(error); - } + AssignmentExpression(node) { + if (PatternVisitor.isPattern(node.left)) { + if (node.operator === "=") { + this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => { + let maybeImplicitGlobal = null; - const obj = { - ...request, - request: undefined, - path: path.join( - /** @type {string} */ (request.descriptionFileRoot), - relativePath - ), - relativePath, - query, - fragment - }; + if (!this.currentScope().isStrict) { + maybeImplicitGlobal = { + pattern, + node + }; + } + this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false); + this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, !info.topLevel, false); + }); + } else { + this.currentScope().__referencing(node.left, Reference.RW, node.right); + } + } else { + this.visit(node.left); + } + this.visit(node.right); + } - resolver.doResolve( - target, - obj, - "using exports field: " + p, - resolveContext, - callback - ); - }, - (err, result) => callback(err, result || null) - ); - }); - } -}; + CatchClause(node) { + this.scopeManager.__nestCatchScope(node); + this.visitPattern(node.param, { processRightHandNodes: true }, (pattern, info) => { + this.currentScope().__define(pattern, + new Definition( + Variable.CatchClause, + node.param, + node, + null, + null, + null + )); + this.referencingDefaultValue(pattern, info.assignments, null, true); + }); + this.visit(node.body); -/***/ }), + this.close(node); + } -/***/ 98699: -/***/ (function(module) { + Program(node) { + this.scopeManager.__nestGlobalScope(node); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (this.scopeManager.__isNodejsScope()) { + // Force strictness of GlobalScope to false when using node.js scope. + this.currentScope().isStrict = false; + this.scopeManager.__nestFunctionScope(node, false); + } + if (this.scopeManager.__isES6() && this.scopeManager.isModule()) { + this.scopeManager.__nestModuleScope(node); + } -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - -module.exports = class FileExistsPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string | ResolveStepHook} target target - */ - constructor(source, target) { - this.source = source; - this.target = target; - } - - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - const fs = resolver.fileSystem; - resolver - .getHook(this.source) - .tapAsync("FileExistsPlugin", (request, resolveContext, callback) => { - const file = request.path; - if (!file) return callback(); - fs.stat(file, (err, stat) => { - if (err || !stat) { - if (resolveContext.missingDependencies) - resolveContext.missingDependencies.add(file); - if (resolveContext.log) resolveContext.log(file + " doesn't exist"); - return callback(); - } - if (!stat.isFile()) { - if (resolveContext.missingDependencies) - resolveContext.missingDependencies.add(file); - if (resolveContext.log) resolveContext.log(file + " is not a file"); - return callback(); - } - if (resolveContext.fileDependencies) - resolveContext.fileDependencies.add(file); - resolver.doResolve( - target, - request, - "existing file: " + file, - resolveContext, - callback - ); - }); - }); - } -}; + if (this.scopeManager.isStrictModeSupported() && this.scopeManager.isImpliedStrict()) { + this.currentScope().isStrict = true; + } + this.visitChildren(node); + this.close(node); + } -/***/ }), + Identifier(node) { + this.currentScope().__referencing(node); + } -/***/ 86058: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + UpdateExpression(node) { + if (PatternVisitor.isPattern(node.argument)) { + this.currentScope().__referencing(node.argument, Reference.RW, null); + } else { + this.visitChildren(node); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ + MemberExpression(node) { + this.visit(node.object); + if (node.computed) { + this.visit(node.property); + } + } + Property(node) { + this.visitProperty(node); + } + MethodDefinition(node) { + this.visitProperty(node); + } -const path = __webpack_require__(71017); -const DescriptionFileUtils = __webpack_require__(702); -const forEachBail = __webpack_require__(8266); -const { processImportsField } = __webpack_require__(28348); -const { parseIdentifier } = __webpack_require__(7780); + BreakStatement() {} // eslint-disable-line class-methods-use-this -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -/** @typedef {import("./util/entrypoints").FieldProcessor} FieldProcessor */ -/** @typedef {import("./util/entrypoints").ImportsField} ImportsField */ + ContinueStatement() {} // eslint-disable-line class-methods-use-this -const dotCode = ".".charCodeAt(0); + LabeledStatement(node) { + this.visit(node.body); + } -module.exports = class ImportsFieldPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {Set} conditionNames condition names - * @param {string | string[]} fieldNamePath name path - * @param {string | ResolveStepHook} targetFile target file - * @param {string | ResolveStepHook} targetPackage target package - */ - constructor( - source, - conditionNames, - fieldNamePath, - targetFile, - targetPackage - ) { - this.source = source; - this.targetFile = targetFile; - this.targetPackage = targetPackage; - this.conditionNames = conditionNames; - this.fieldName = fieldNamePath; - /** @type {WeakMap} */ - this.fieldProcessorCache = new WeakMap(); - } + ForStatement(node) { - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const targetFile = resolver.ensureHook(this.targetFile); - const targetPackage = resolver.ensureHook(this.targetPackage); + // Create ForStatement declaration. + // NOTE: In ES6, ForStatement dynamically generates + // per iteration environment. However, escope is + // a static analyzer, we only generate one scope for ForStatement. + if (node.init && node.init.type === Syntax.VariableDeclaration && node.init.kind !== "var") { + this.scopeManager.__nestForScope(node); + } - resolver - .getHook(this.source) - .tapAsync("ImportsFieldPlugin", (request, resolveContext, callback) => { - // When there is no description file, abort - if (!request.descriptionFilePath || request.request === undefined) { - return callback(); - } + this.visitChildren(node); - const remainingRequest = - request.request + request.query + request.fragment; - /** @type {ImportsField|null} */ - const importsField = DescriptionFileUtils.getField( - request.descriptionFileData, - this.fieldName - ); - if (!importsField) return callback(); + this.close(node); + } - if (request.directory) { - return callback( - new Error( - `Resolving to directories is not possible with the imports field (request was ${remainingRequest}/)` - ) - ); - } + ClassExpression(node) { + this.visitClass(node); + } - let paths; + ClassDeclaration(node) { + this.visitClass(node); + } - try { - // We attach the cache to the description file instead of the importsField value - // because we use a WeakMap and the importsField could be a string too. - // Description file is always an object when exports field can be accessed. - let fieldProcessor = this.fieldProcessorCache.get( - request.descriptionFileData - ); - if (fieldProcessor === undefined) { - fieldProcessor = processImportsField(importsField); - this.fieldProcessorCache.set( - request.descriptionFileData, - fieldProcessor - ); - } - paths = fieldProcessor(remainingRequest, this.conditionNames); - } catch (err) { - if (resolveContext.log) { - resolveContext.log( - `Imports field in ${request.descriptionFilePath} can't be processed: ${err}` - ); - } - return callback(err); - } + CallExpression(node) { - if (paths.length === 0) { - return callback( - new Error( - `Package import ${remainingRequest} is not imported from package ${request.descriptionFileRoot} (see imports field in ${request.descriptionFilePath})` - ) - ); - } + // Check this is direct call to eval + if (!this.scopeManager.__ignoreEval() && node.callee.type === Syntax.Identifier && node.callee.name === "eval") { - forEachBail( - paths, - (p, callback) => { - const parsedIdentifier = parseIdentifier(p); + // NOTE: This should be `variableScope`. Since direct eval call always creates Lexical environment and + // let / const should be enclosed into it. Only VariableDeclaration affects on the caller's environment. + this.currentScope().variableScope.__detectEval(); + } + this.visitChildren(node); + } - if (!parsedIdentifier) return callback(); + BlockStatement(node) { + if (this.scopeManager.__isES6()) { + this.scopeManager.__nestBlockScope(node); + } - const [path_, query, fragment] = parsedIdentifier; + this.visitChildren(node); - switch (path_.charCodeAt(0)) { - // should be relative - case dotCode: { - const obj = { - ...request, - request: undefined, - path: path.join( - /** @type {string} */ (request.descriptionFileRoot), - path_ - ), - relativePath: path_, - query, - fragment - }; + this.close(node); + } - resolver.doResolve( - targetFile, - obj, - "using imports field: " + p, - resolveContext, - callback - ); - break; - } + ThisExpression() { + this.currentScope().variableScope.__detectThis(); + } - // package resolving - default: { - const obj = { - ...request, - request: path_, - relativePath: path_, - fullySpecified: true, - query, - fragment - }; + WithStatement(node) { + this.visit(node.object); - resolver.doResolve( - targetPackage, - obj, - "using imports field: " + p, - resolveContext, - callback - ); - } - } - }, - (err, result) => callback(err, result || null) - ); - }); - } -}; + // Then nest scope for WithStatement. + this.scopeManager.__nestWithScope(node); + this.visit(node.body); -/***/ }), + this.close(node); + } -/***/ 20879: -/***/ (function(module) { + VariableDeclaration(node) { + const variableTargetScope = (node.kind === "var") ? this.currentScope().variableScope : this.currentScope(); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + for (let i = 0, iz = node.declarations.length; i < iz; ++i) { + const decl = node.declarations[i]; + this.visitVariableDeclaration(variableTargetScope, Variable.Variable, node, i); + if (decl.init) { + this.visit(decl.init); + } + } + } + // sec 13.11.8 + SwitchStatement(node) { + this.visit(node.discriminant); -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + if (this.scopeManager.__isES6()) { + this.scopeManager.__nestSwitchScope(node); + } -const namespaceStartCharCode = "@".charCodeAt(0); + for (let i = 0, iz = node.cases.length; i < iz; ++i) { + this.visit(node.cases[i]); + } -module.exports = class JoinRequestPartPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string | ResolveStepHook} target target - */ - constructor(source, target) { - this.source = source; - this.target = target; - } + this.close(node); + } - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync( - "JoinRequestPartPlugin", - (request, resolveContext, callback) => { - const req = request.request || ""; - let i = req.indexOf("/", 3); + FunctionDeclaration(node) { + this.visitFunction(node); + } - if (i >= 0 && req.charCodeAt(2) === namespaceStartCharCode) { - i = req.indexOf("/", i + 1); - } + FunctionExpression(node) { + this.visitFunction(node); + } - let moduleName, remainingRequest, fullySpecified; - if (i < 0) { - moduleName = req; - remainingRequest = "."; - fullySpecified = false; - } else { - moduleName = req.slice(0, i); - remainingRequest = "." + req.slice(i); - fullySpecified = request.fullySpecified; - } - const obj = { - ...request, - path: resolver.join(request.path, moduleName), - relativePath: - request.relativePath && - resolver.join(request.relativePath, moduleName), - request: remainingRequest, - fullySpecified - }; - resolver.doResolve(target, obj, null, resolveContext, callback); - } - ); - } -}; + ForOfStatement(node) { + this.visitForIn(node); + } + ForInStatement(node) { + this.visitForIn(node); + } -/***/ }), + ArrowFunctionExpression(node) { + this.visitFunction(node); + } -/***/ 71474: -/***/ (function(module) { + ImportDeclaration(node) { + assert(this.scopeManager.__isES6() && this.scopeManager.isModule(), "ImportDeclaration should appear when the mode is ES6 and in the module context."); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const importer = new Importer(node, this); + importer.visit(node); + } + visitExportDeclaration(node) { + if (node.source) { + return; + } + if (node.declaration) { + this.visit(node.declaration); + return; + } -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + this.visitChildren(node); + } -module.exports = class JoinRequestPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string | ResolveStepHook} target target - */ - constructor(source, target) { - this.source = source; - this.target = target; - } + // TODO: ExportDeclaration doesn't exist. for bc? + ExportDeclaration(node) { + this.visitExportDeclaration(node); + } - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("JoinRequestPlugin", (request, resolveContext, callback) => { - const obj = { - ...request, - path: resolver.join(request.path, request.request), - relativePath: - request.relativePath && - resolver.join(request.relativePath, request.request), - request: undefined - }; - resolver.doResolve(target, obj, null, resolveContext, callback); - }); - } -}; + ExportAllDeclaration(node) { + this.visitExportDeclaration(node); + } + ExportDefaultDeclaration(node) { + this.visitExportDeclaration(node); + } -/***/ }), + ExportNamedDeclaration(node) { + this.visitExportDeclaration(node); + } -/***/ 47032: -/***/ (function(module) { + ExportSpecifier(node) { -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // TODO: `node.id` doesn't exist. for bc? + const local = (node.id || node.local); + this.visit(local); + } + MetaProperty() { // eslint-disable-line class-methods-use-this -/** @typedef {import("./Resolver")} Resolver */ + // do nothing. + } +} -module.exports = class LogInfoPlugin { - constructor(source) { - this.source = source; - } +module.exports = Referencer; - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const source = this.source; - resolver - .getHook(this.source) - .tapAsync("LogInfoPlugin", (request, resolveContext, callback) => { - if (!resolveContext.log) return callback(); - const log = resolveContext.log; - const prefix = "[" + source + "] "; - if (request.path) - log(prefix + "Resolving in directory: " + request.path); - if (request.request) - log(prefix + "Resolving request: " + request.request); - if (request.module) log(prefix + "Request is an module request."); - if (request.directory) log(prefix + "Request is a directory request."); - if (request.query) - log(prefix + "Resolving request query: " + request.query); - if (request.fragment) - log(prefix + "Resolving request fragment: " + request.fragment); - if (request.descriptionFilePath) - log( - prefix + "Has description data from " + request.descriptionFilePath - ); - if (request.relativePath) - log( - prefix + - "Relative path from description file is: " + - request.relativePath - ); - callback(); - }); - } -}; +/* vim: set sw=4 ts=4 et tw=80 : */ /***/ }), -/***/ 73507: +/***/ 96988: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + Copyright (C) 2015 Yusuke Suzuki + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. -const path = __webpack_require__(71017); -const DescriptionFileUtils = __webpack_require__(702); + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -/** @typedef {{name: string|Array, forceRelative: boolean}} MainFieldOptions */ -const alreadyTriedMainField = Symbol("alreadyTriedMainField"); +/* eslint-disable no-underscore-dangle */ -module.exports = class MainFieldPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {MainFieldOptions} options options - * @param {string | ResolveStepHook} target target - */ - constructor(source, options, target) { - this.source = source; - this.options = options; - this.target = target; - } +const Scope = __webpack_require__(16313); +const assert = __webpack_require__(39491); - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("MainFieldPlugin", (request, resolveContext, callback) => { - if ( - request.path !== request.descriptionFileRoot || - request[alreadyTriedMainField] === request.descriptionFilePath || - !request.descriptionFilePath - ) - return callback(); - const filename = path.basename(request.descriptionFilePath); - let mainModule = DescriptionFileUtils.getField( - request.descriptionFileData, - this.options.name - ); +const GlobalScope = Scope.GlobalScope; +const CatchScope = Scope.CatchScope; +const WithScope = Scope.WithScope; +const ModuleScope = Scope.ModuleScope; +const ClassScope = Scope.ClassScope; +const SwitchScope = Scope.SwitchScope; +const FunctionScope = Scope.FunctionScope; +const ForScope = Scope.ForScope; +const FunctionExpressionNameScope = Scope.FunctionExpressionNameScope; +const BlockScope = Scope.BlockScope; - if ( - !mainModule || - typeof mainModule !== "string" || - mainModule === "." || - mainModule === "./" - ) { - return callback(); - } - if (this.options.forceRelative && !/^\.\.?\//.test(mainModule)) - mainModule = "./" + mainModule; - const obj = { - ...request, - request: mainModule, - module: false, - directory: mainModule.endsWith("/"), - [alreadyTriedMainField]: request.descriptionFilePath - }; - return resolver.doResolve( - target, - obj, - "use " + - mainModule + - " from " + - this.options.name + - " in " + - filename, - resolveContext, - callback - ); - }); - } -}; +/** + * @class ScopeManager + */ +class ScopeManager { + constructor(options) { + this.scopes = []; + this.globalScope = null; + this.__nodeToScope = new WeakMap(); + this.__currentScope = null; + this.__options = options; + this.__declaredVariables = new WeakMap(); + } + __useDirective() { + return this.__options.directive; + } -/***/ }), + __isOptimistic() { + return this.__options.optimistic; + } -/***/ 32942: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + __ignoreEval() { + return this.__options.ignoreEval; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + __isNodejsScope() { + return this.__options.nodejsScope; + } + isModule() { + return this.__options.sourceType === "module"; + } + isImpliedStrict() { + return this.__options.impliedStrict; + } -const forEachBail = __webpack_require__(8266); -const getPaths = __webpack_require__(48608); + isStrictModeSupported() { + return this.__options.ecmaVersion >= 5; + } -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + // Returns appropriate scope for this node. + __get(node) { + return this.__nodeToScope.get(node); + } -module.exports = class ModulesInHierarchicalDirectoriesPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string | Array} directories directories - * @param {string | ResolveStepHook} target target - */ - constructor(source, directories, target) { - this.source = source; - this.directories = /** @type {Array} */ ([]).concat(directories); - this.target = target; - } + /** + * Get variables that are declared by the node. + * + * "are declared by the node" means the node is same as `Variable.defs[].node` or `Variable.defs[].parent`. + * If the node declares nothing, this method returns an empty array. + * CAUTION: This API is experimental. See https://github.com/estools/escope/pull/69 for more details. + * + * @param {Espree.Node} node - a node to get. + * @returns {Variable[]} variables that declared by the node. + */ + getDeclaredVariables(node) { + return this.__declaredVariables.get(node) || []; + } - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync( - "ModulesInHierarchicalDirectoriesPlugin", - (request, resolveContext, callback) => { - const fs = resolver.fileSystem; - const addrs = getPaths(request.path) - .paths.map(p => { - return this.directories.map(d => resolver.join(p, d)); - }) - .reduce((array, p) => { - array.push.apply(array, p); - return array; - }, []); - forEachBail( - addrs, - (addr, callback) => { - fs.stat(addr, (err, stat) => { - if (!err && stat && stat.isDirectory()) { - const obj = { - ...request, - path: addr, - request: "./" + request.request, - module: false - }; - const message = "looking for modules in " + addr; - return resolver.doResolve( - target, - obj, - message, - resolveContext, - callback - ); - } - if (resolveContext.log) - resolveContext.log( - addr + " doesn't exist or is not a directory" - ); - if (resolveContext.missingDependencies) - resolveContext.missingDependencies.add(addr); - return callback(); - }); - }, - callback - ); - } - ); - } -}; + /** + * acquire scope from node. + * @method ScopeManager#acquire + * @param {Espree.Node} node - node for the acquired scope. + * @param {boolean=} inner - look up the most inner scope, default value is false. + * @returns {Scope?} Scope from node + */ + acquire(node, inner) { + /** + * predicate + * @param {Scope} testScope - scope to test + * @returns {boolean} predicate + */ + function predicate(testScope) { + if (testScope.type === "function" && testScope.functionExpressionScope) { + return false; + } + return true; + } -/***/ }), + const scopes = this.__get(node); -/***/ 48952: -/***/ (function(module) { + if (!scopes || scopes.length === 0) { + return null; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // Heuristic selection from all scopes. + // If you would like to get all scopes, please use ScopeManager#acquireAll. + if (scopes.length === 1) { + return scopes[0]; + } + if (inner) { + for (let i = scopes.length - 1; i >= 0; --i) { + const scope = scopes[i]; + if (predicate(scope)) { + return scope; + } + } + } else { + for (let i = 0, iz = scopes.length; i < iz; ++i) { + const scope = scopes[i]; -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + if (predicate(scope)) { + return scope; + } + } + } -module.exports = class ModulesInRootPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string} path path - * @param {string | ResolveStepHook} target target - */ - constructor(source, path, target) { - this.source = source; - this.path = path; - this.target = target; - } + return null; + } - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("ModulesInRootPlugin", (request, resolveContext, callback) => { - const obj = { - ...request, - path: this.path, - request: "./" + request.request, - module: false - }; - resolver.doResolve( - target, - obj, - "looking for modules in " + this.path, - resolveContext, - callback - ); - }); - } -}; + /** + * acquire all scopes from node. + * @method ScopeManager#acquireAll + * @param {Espree.Node} node - node for the acquired scope. + * @returns {Scopes?} Scope array + */ + acquireAll(node) { + return this.__get(node); + } + /** + * release the node. + * @method ScopeManager#release + * @param {Espree.Node} node - releasing node. + * @param {boolean=} inner - look up the most inner scope, default value is false. + * @returns {Scope?} upper scope for the node. + */ + release(node, inner) { + const scopes = this.__get(node); -/***/ }), + if (scopes && scopes.length) { + const scope = scopes[0].upper; -/***/ 79135: -/***/ (function(module) { + if (!scope) { + return null; + } + return this.acquire(scope.block, inner); + } + return null; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + attach() { } // eslint-disable-line class-methods-use-this + detach() { } // eslint-disable-line class-methods-use-this + __nestScope(scope) { + if (scope instanceof GlobalScope) { + assert(this.__currentScope === null); + this.globalScope = scope; + } + this.__currentScope = scope; + return scope; + } -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + __nestGlobalScope(node) { + return this.__nestScope(new GlobalScope(this, node)); + } -module.exports = class NextPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string | ResolveStepHook} target target - */ - constructor(source, target) { - this.source = source; - this.target = target; - } + __nestBlockScope(node) { + return this.__nestScope(new BlockScope(this, this.__currentScope, node)); + } - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("NextPlugin", (request, resolveContext, callback) => { - resolver.doResolve(target, request, null, resolveContext, callback); - }); - } -}; + __nestFunctionScope(node, isMethodDefinition) { + return this.__nestScope(new FunctionScope(this, this.__currentScope, node, isMethodDefinition)); + } + __nestForScope(node) { + return this.__nestScope(new ForScope(this, this.__currentScope, node)); + } -/***/ }), + __nestCatchScope(node) { + return this.__nestScope(new CatchScope(this, this.__currentScope, node)); + } -/***/ 15234: -/***/ (function(module) { + __nestWithScope(node) { + return this.__nestScope(new WithScope(this, this.__currentScope, node)); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + __nestClassScope(node) { + return this.__nestScope(new ClassScope(this, this.__currentScope, node)); + } + __nestSwitchScope(node) { + return this.__nestScope(new SwitchScope(this, this.__currentScope, node)); + } + __nestModuleScope(node) { + return this.__nestScope(new ModuleScope(this, this.__currentScope, node)); + } -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + __nestFunctionExpressionNameScope(node) { + return this.__nestScope(new FunctionExpressionNameScope(this, this.__currentScope, node)); + } -module.exports = class ParsePlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {Partial} requestOptions request options - * @param {string | ResolveStepHook} target target - */ - constructor(source, requestOptions, target) { - this.source = source; - this.requestOptions = requestOptions; - this.target = target; - } + __isES6() { + return this.__options.ecmaVersion >= 6; + } +} - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("ParsePlugin", (request, resolveContext, callback) => { - const parsed = resolver.parse(/** @type {string} */ (request.request)); - const obj = { ...request, ...parsed, ...this.requestOptions }; - if (request.query && !parsed.query) { - obj.query = request.query; - } - if (request.fragment && !parsed.fragment) { - obj.fragment = request.fragment; - } - if (parsed && resolveContext.log) { - if (parsed.module) resolveContext.log("Parsed request is a module"); - if (parsed.directory) - resolveContext.log("Parsed request is a directory"); - } - // There is an edge-case where a request with # can be a path or a fragment -> try both - if (obj.request && !obj.query && obj.fragment) { - const directory = obj.fragment.endsWith("/"); - const alternative = { - ...obj, - directory, - request: - obj.request + - (obj.directory ? "/" : "") + - (directory ? obj.fragment.slice(0, -1) : obj.fragment), - fragment: "" - }; - resolver.doResolve( - target, - alternative, - null, - resolveContext, - (err, result) => { - if (err) return callback(err); - if (result) return callback(null, result); - resolver.doResolve(target, obj, null, resolveContext, callback); - } - ); - return; - } - resolver.doResolve(target, obj, null, resolveContext, callback); - }); - } -}; +module.exports = ScopeManager; + +/* vim: set sw=4 ts=4 et tw=80 : */ /***/ }), -/***/ 71488: -/***/ (function(module) { +/***/ 16313: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Maël Nison @arcanis + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable no-undefined */ -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -/** - * @typedef {Object} PnpApiImpl - * @property {function(string, string, object): string} resolveToUnqualified - */ +const Syntax = (__webpack_require__(18350).Syntax); -module.exports = class PnpPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {PnpApiImpl} pnpApi pnpApi - * @param {string | ResolveStepHook} target target - */ - constructor(source, pnpApi, target) { - this.source = source; - this.pnpApi = pnpApi; - this.target = target; - } - - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("PnpPlugin", (request, resolveContext, callback) => { - const req = request.request; - if (!req) return callback(); - - // The trailing slash indicates to PnP that this value is a folder rather than a file - const issuer = `${request.path}/`; - - const packageMatch = /^(@[^/]+\/)?[^/]+/.exec(req); - if (!packageMatch) return callback(); - - const packageName = packageMatch[0]; - const innerRequest = `.${req.slice(packageName.length)}`; +const Reference = __webpack_require__(64945); +const Variable = __webpack_require__(82971); +const Definition = (__webpack_require__(70665).Definition); +const assert = __webpack_require__(39491); - let resolution; - let apiResolution; - try { - resolution = this.pnpApi.resolveToUnqualified(packageName, issuer, { - considerBuiltins: false - }); - if (resolveContext.fileDependencies) { - apiResolution = this.pnpApi.resolveToUnqualified("pnpapi", issuer, { - considerBuiltins: false - }); - } - } catch (error) { - if ( - error.code === "MODULE_NOT_FOUND" && - error.pnpCode === "UNDECLARED_DEPENDENCY" - ) { - // This is not a PnP managed dependency. - // Try to continue resolving with our alternatives - if (resolveContext.log) { - resolveContext.log(`request is not managed by the pnpapi`); - for (const line of error.message.split("\n").filter(Boolean)) - resolveContext.log(` ${line}`); - } - return callback(); - } - return callback(error); - } +/** + * Test if scope is struct + * @param {Scope} scope - scope + * @param {Block} block - block + * @param {boolean} isMethodDefinition - is method definition + * @param {boolean} useDirective - use directive + * @returns {boolean} is strict scope + */ +function isStrictScope(scope, block, isMethodDefinition, useDirective) { + let body; - if (resolution === packageName) return callback(); + // When upper scope is exists and strict, inner scope is also strict. + if (scope.upper && scope.upper.isStrict) { + return true; + } - if (apiResolution && resolveContext.fileDependencies) { - resolveContext.fileDependencies.add(apiResolution); - } + if (isMethodDefinition) { + return true; + } - const obj = { - ...request, - path: resolution, - request: innerRequest, - ignoreSymlinks: true, - fullySpecified: request.fullySpecified && innerRequest !== "." - }; - resolver.doResolve( - target, - obj, - `resolved by pnp to ${resolution}`, - resolveContext, - (err, result) => { - if (err) return callback(err); - if (result) return callback(null, result); - // Skip alternatives - return callback(null, null); - } - ); - }); - } -}; + if (scope.type === "class" || scope.type === "module") { + return true; + } + if (scope.type === "block" || scope.type === "switch") { + return false; + } -/***/ }), + if (scope.type === "function") { + if (block.type === Syntax.ArrowFunctionExpression && block.body.type !== Syntax.BlockStatement) { + return false; + } -/***/ 37432: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (block.type === Syntax.Program) { + body = block; + } else { + body = block.body; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (!body) { + return false; + } + } else if (scope.type === "global") { + body = block; + } else { + return false; + } + // Search 'use strict' directive. + if (useDirective) { + for (let i = 0, iz = body.body.length; i < iz; ++i) { + const stmt = body.body[i]; + if (stmt.type !== Syntax.DirectiveStatement) { + break; + } + if (stmt.raw === "\"use strict\"" || stmt.raw === "'use strict'") { + return true; + } + } + } else { + for (let i = 0, iz = body.body.length; i < iz; ++i) { + const stmt = body.body[i]; -const { AsyncSeriesBailHook, AsyncSeriesHook, SyncHook } = __webpack_require__(41242); -const createInnerContext = __webpack_require__(95478); -const { parseIdentifier } = __webpack_require__(7780); -const { - normalize, - cachedJoin: join, - getType, - PathType -} = __webpack_require__(3011); + if (stmt.type !== Syntax.ExpressionStatement) { + break; + } + const expr = stmt.expression; -/** @typedef {import("./ResolverFactory").ResolveOptions} ResolveOptions */ + if (expr.type !== Syntax.Literal || typeof expr.value !== "string") { + break; + } + if (expr.raw !== null && expr.raw !== undefined) { + if (expr.raw === "\"use strict\"" || expr.raw === "'use strict'") { + return true; + } + } else { + if (expr.value === "use strict") { + return true; + } + } + } + } + return false; +} /** - * @typedef {Object} FileSystemStats - * @property {function(): boolean} isDirectory - * @property {function(): boolean} isFile + * Register scope + * @param {ScopeManager} scopeManager - scope manager + * @param {Scope} scope - scope + * @returns {void} */ +function registerScope(scopeManager, scope) { + scopeManager.scopes.push(scope); -/** - * @typedef {Object} FileSystemDirent - * @property {Buffer | string} name - * @property {function(): boolean} isDirectory - * @property {function(): boolean} isFile - */ + const scopes = scopeManager.__nodeToScope.get(scope.block); -/** - * @typedef {Object} PossibleFileSystemError - * @property {string=} code - * @property {number=} errno - * @property {string=} path - * @property {string=} syscall - */ + if (scopes) { + scopes.push(scope); + } else { + scopeManager.__nodeToScope.set(scope.block, [scope]); + } +} /** - * @template T - * @callback FileSystemCallback - * @param {PossibleFileSystemError & Error | null | undefined} err - * @param {T=} result + * Should be statically + * @param {Object} def - def + * @returns {boolean} should be statically */ +function shouldBeStatically(def) { + return ( + (def.type === Variable.ClassName) || + (def.type === Variable.Variable && def.parent.kind !== "var") + ); +} /** - * @typedef {Object} FileSystem - * @property {(function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void} readFile - * @property {(function(string, FileSystemCallback<(Buffer | string)[] | FileSystemDirent[]>): void) & function(string, object, FileSystemCallback<(Buffer | string)[] | FileSystemDirent[]>): void} readdir - * @property {((function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void)=} readJson - * @property {(function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void} readlink - * @property {(function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void=} lstat - * @property {(function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void} stat + * @class Scope */ +class Scope { + constructor(scopeManager, type, upperScope, block, isMethodDefinition) { -/** - * @typedef {Object} SyncFileSystem - * @property {function(string, object=): Buffer | string} readFileSync - * @property {function(string, object=): (Buffer | string)[] | FileSystemDirent[]} readdirSync - * @property {(function(string, object=): object)=} readJsonSync - * @property {function(string, object=): Buffer | string} readlinkSync - * @property {function(string, object=): FileSystemStats=} lstatSync - * @property {function(string, object=): FileSystemStats} statSync - */ + /** + * One of 'module', 'block', 'switch', 'function', 'catch', 'with', 'function', 'class', 'global'. + * @member {String} Scope#type + */ + this.type = type; -/** - * @typedef {Object} ParsedIdentifier - * @property {string} request - * @property {string} query - * @property {string} fragment - * @property {boolean} directory - * @property {boolean} module - * @property {boolean} file - * @property {boolean} internal - */ + /** + * The scoped {@link Variable}s of this scope, as { Variable.name + * : Variable }. + * @member {Map} Scope#set + */ + this.set = new Map(); -/** - * @typedef {Object} BaseResolveRequest - * @property {string | false} path - * @property {string=} descriptionFilePath - * @property {string=} descriptionFileRoot - * @property {object=} descriptionFileData - * @property {string=} relativePath - * @property {boolean=} ignoreSymlinks - * @property {boolean=} fullySpecified - */ + /** + * The tainted variables of this scope, as { Variable.name : + * boolean }. + * @member {Map} Scope#taints */ + this.taints = new Map(); -/** @typedef {BaseResolveRequest & Partial} ResolveRequest */ + /** + * Generally, through the lexical scoping of JS you can always know + * which variable an identifier in the source code refers to. There are + * a few exceptions to this rule. With 'global' and 'with' scopes you + * can only decide at runtime which variable a reference refers to. + * Moreover, if 'eval()' is used in a scope, it might introduce new + * bindings in this or its parent scopes. + * All those scopes are considered 'dynamic'. + * @member {boolean} Scope#dynamic + */ + this.dynamic = this.type === "global" || this.type === "with"; -/** - * String with special formatting - * @typedef {string} StackEntry - */ + /** + * A reference to the scope-defining syntax node. + * @member {espree.Node} Scope#block + */ + this.block = block; -/** @template T @typedef {{ add: (T) => void }} WriteOnlySet */ + /** + * The {@link Reference|references} that are not resolved with this scope. + * @member {Reference[]} Scope#through + */ + this.through = []; -/** - * Resolve context - * @typedef {Object} ResolveContext - * @property {WriteOnlySet=} contextDependencies - * @property {WriteOnlySet=} fileDependencies files that was found on file system - * @property {WriteOnlySet=} missingDependencies dependencies that was not found on file system - * @property {Set=} stack set of hooks' calls. For instance, `resolve → parsedResolve → describedResolve`, - * @property {(function(string): void)=} log log function - * @property {(function (ResolveRequest): void)=} yield yield result, if provided plugins can return several results - */ + /** + * The scoped {@link Variable}s of this scope. In the case of a + * 'function' scope this includes the automatic argument arguments as + * its first element, as well as all further formal arguments. + * @member {Variable[]} Scope#variables + */ + this.variables = []; -/** @typedef {AsyncSeriesBailHook<[ResolveRequest, ResolveContext], ResolveRequest | null>} ResolveStepHook */ + /** + * Any variable {@link Reference|reference} found in this scope. This + * includes occurrences of local variables as well as variables from + * parent scopes (including the global scope). For local variables + * this also includes defining occurrences (like in a 'var' statement). + * In a 'function' scope this does not include the occurrences of the + * formal parameter in the parameter list. + * @member {Reference[]} Scope#references + */ + this.references = []; -/** - * @param {string} str input string - * @returns {string} in camel case - */ -function toCamelCase(str) { - return str.replace(/-([a-z])/g, str => str.substr(1).toUpperCase()); -} + /** + * For 'global' and 'function' scopes, this is a self-reference. For + * other scope types this is the variableScope value of the + * parent scope. + * @member {Scope} Scope#variableScope + */ + this.variableScope = + (this.type === "global" || this.type === "function" || this.type === "module") ? this : upperScope.variableScope; -class Resolver { - /** - * @param {ResolveStepHook} hook hook - * @param {ResolveRequest} request request - * @returns {StackEntry} stack entry - */ - static createStackEntry(hook, request) { - return ( - hook.name + - ": (" + - request.path + - ") " + - (request.request || "") + - (request.query || "") + - (request.fragment || "") + - (request.directory ? " directory" : "") + - (request.module ? " module" : "") - ); - } + /** + * Whether this scope is created by a FunctionExpression. + * @member {boolean} Scope#functionExpressionScope + */ + this.functionExpressionScope = false; - /** - * @param {FileSystem} fileSystem a filesystem - * @param {ResolveOptions} options options - */ - constructor(fileSystem, options) { - this.fileSystem = fileSystem; - this.options = options; - this.hooks = { - /** @type {SyncHook<[ResolveStepHook, ResolveRequest], void>} */ - resolveStep: new SyncHook(["hook", "request"], "resolveStep"), - /** @type {SyncHook<[ResolveRequest, Error]>} */ - noResolve: new SyncHook(["request", "error"], "noResolve"), - /** @type {ResolveStepHook} */ - resolve: new AsyncSeriesBailHook( - ["request", "resolveContext"], - "resolve" - ), - /** @type {AsyncSeriesHook<[ResolveRequest, ResolveContext]>} */ - result: new AsyncSeriesHook(["result", "resolveContext"], "result") - }; - } + /** + * Whether this is a scope that contains an 'eval()' invocation. + * @member {boolean} Scope#directCallToEvalScope + */ + this.directCallToEvalScope = false; - /** - * @param {string | ResolveStepHook} name hook name or hook itself - * @returns {ResolveStepHook} the hook - */ - ensureHook(name) { - if (typeof name !== "string") { - return name; - } - name = toCamelCase(name); - if (/^before/.test(name)) { - return /** @type {ResolveStepHook} */ (this.ensureHook( - name[6].toLowerCase() + name.substr(7) - ).withOptions({ - stage: -10 - })); - } - if (/^after/.test(name)) { - return /** @type {ResolveStepHook} */ (this.ensureHook( - name[5].toLowerCase() + name.substr(6) - ).withOptions({ - stage: 10 - })); - } - const hook = this.hooks[name]; - if (!hook) { - return (this.hooks[name] = new AsyncSeriesBailHook( - ["request", "resolveContext"], - name - )); - } - return hook; - } + /** + * @member {boolean} Scope#thisFound + */ + this.thisFound = false; - /** - * @param {string | ResolveStepHook} name hook name or hook itself - * @returns {ResolveStepHook} the hook - */ - getHook(name) { - if (typeof name !== "string") { - return name; - } - name = toCamelCase(name); - if (/^before/.test(name)) { - return /** @type {ResolveStepHook} */ (this.getHook( - name[6].toLowerCase() + name.substr(7) - ).withOptions({ - stage: -10 - })); - } - if (/^after/.test(name)) { - return /** @type {ResolveStepHook} */ (this.getHook( - name[5].toLowerCase() + name.substr(6) - ).withOptions({ - stage: 10 - })); - } - const hook = this.hooks[name]; - if (!hook) { - throw new Error(`Hook ${name} doesn't exist`); - } - return hook; - } + this.__left = []; - /** - * @param {object} context context information object - * @param {string} path context path - * @param {string} request request string - * @returns {string | false} result - */ - resolveSync(context, path, request) { - /** @type {Error | null | undefined} */ - let err = undefined; - /** @type {string | false | undefined} */ - let result = undefined; - let sync = false; - this.resolve(context, path, request, {}, (e, r) => { - err = e; - result = r; - sync = true; - }); - if (!sync) { - throw new Error( - "Cannot 'resolveSync' because the fileSystem is not sync. Use 'resolve'!" - ); - } - if (err) throw err; - if (result === undefined) throw new Error("No result"); - return result; - } + /** + * Reference to the parent {@link Scope|scope}. + * @member {Scope} Scope#upper + */ + this.upper = upperScope; - /** - * @param {object} context context information object - * @param {string} path context path - * @param {string} request request string - * @param {ResolveContext} resolveContext resolve context - * @param {function(Error | null, (string|false)=, ResolveRequest=): void} callback callback function - * @returns {void} - */ - resolve(context, path, request, resolveContext, callback) { - if (!context || typeof context !== "object") - return callback(new Error("context argument is not an object")); - if (typeof path !== "string") - return callback(new Error("path argument is not a string")); - if (typeof request !== "string") - return callback(new Error("path argument is not a string")); - if (!resolveContext) - return callback(new Error("resolveContext argument is not set")); + /** + * Whether 'use strict' is in effect in this scope. + * @member {boolean} Scope#isStrict + */ + this.isStrict = isStrictScope(this, block, isMethodDefinition, scopeManager.__useDirective()); - const obj = { - context: context, - path: path, - request: request - }; + /** + * List of nested {@link Scope}s. + * @member {Scope[]} Scope#childScopes + */ + this.childScopes = []; + if (this.upper) { + this.upper.childScopes.push(this); + } - let yield_; - let yieldCalled = false; - if (typeof resolveContext.yield === "function") { - const old = resolveContext.yield; - yield_ = obj => { - yieldCalled = true; - old(obj); - }; - } + this.__declaredVariables = scopeManager.__declaredVariables; - const message = `resolve '${request}' in '${path}'`; + registerScope(scopeManager, this); + } - const finishResolved = result => { - return callback( - null, - result.path === false - ? false - : `${result.path.replace(/#/g, "\0#")}${ - result.query ? result.query.replace(/#/g, "\0#") : "" - }${result.fragment || ""}`, - result - ); - }; + __shouldStaticallyClose(scopeManager) { + return (!this.dynamic || scopeManager.__isOptimistic()); + } - const finishWithoutResolve = log => { - /** - * @type {Error & {details?: string}} - */ - const error = new Error("Can't " + message); - error.details = log.join("\n"); - this.hooks.noResolve.call(obj, error); - return callback(error); - }; + __shouldStaticallyCloseForGlobal(ref) { - if (resolveContext.log) { - // We need log anyway to capture it in case of an error - const parentLog = resolveContext.log; - const log = []; - return this.doResolve( - this.hooks.resolve, - obj, - message, - { - log: msg => { - parentLog(msg); - log.push(msg); - }, - yield: yield_, - fileDependencies: resolveContext.fileDependencies, - contextDependencies: resolveContext.contextDependencies, - missingDependencies: resolveContext.missingDependencies, - stack: resolveContext.stack - }, - (err, result) => { - if (err) return callback(err); + // On global scope, let/const/class declarations should be resolved statically. + const name = ref.identifier.name; - if (result) return finishResolved(result); - if (yieldCalled) return callback(null); + if (!this.set.has(name)) { + return false; + } - return finishWithoutResolve(log); - } - ); - } else { - // Try to resolve assuming there is no error - // We don't log stuff in this case - return this.doResolve( - this.hooks.resolve, - obj, - message, - { - log: undefined, - yield: yield_, - fileDependencies: resolveContext.fileDependencies, - contextDependencies: resolveContext.contextDependencies, - missingDependencies: resolveContext.missingDependencies, - stack: resolveContext.stack - }, - (err, result) => { - if (err) return callback(err); + const variable = this.set.get(name); + const defs = variable.defs; - if (result) return finishResolved(result); - if (yieldCalled) return callback(null); + return defs.length > 0 && defs.every(shouldBeStatically); + } - // log is missing for the error details - // so we redo the resolving for the log info - // this is more expensive to the success case - // is assumed by default + __staticCloseRef(ref) { + if (!this.__resolve(ref)) { + this.__delegateToUpperScope(ref); + } + } - const log = []; + __dynamicCloseRef(ref) { - return this.doResolve( - this.hooks.resolve, - obj, - message, - { - log: msg => log.push(msg), - yield: yield_, - stack: resolveContext.stack - }, - err => { - if (err) return callback(err); + // notify all names are through to global + let current = this; - // In a case that there is a race condition and yield will be called - if (yieldCalled) return callback(null); + do { + current.through.push(ref); + current = current.upper; + } while (current); + } - return finishWithoutResolve(log); - } - ); - } - ); - } - } + __globalCloseRef(ref) { - doResolve(hook, request, message, resolveContext, callback) { - const stackEntry = Resolver.createStackEntry(hook, request); + // let/const/class declarations should be resolved statically. + // others should be resolved dynamically. + if (this.__shouldStaticallyCloseForGlobal(ref)) { + this.__staticCloseRef(ref); + } else { + this.__dynamicCloseRef(ref); + } + } - let newStack; - if (resolveContext.stack) { - newStack = new Set(resolveContext.stack); - if (resolveContext.stack.has(stackEntry)) { - /** - * Prevent recursion - * @type {Error & {recursion?: boolean}} - */ - const recursionError = new Error( - "Recursion in resolving\nStack:\n " + - Array.from(newStack).join("\n ") - ); - recursionError.recursion = true; - if (resolveContext.log) - resolveContext.log("abort resolving because of recursion"); - return callback(recursionError); - } - newStack.add(stackEntry); - } else { - newStack = new Set([stackEntry]); - } - this.hooks.resolveStep.call(hook, request); + __close(scopeManager) { + let closeRef; - if (hook.isUsed()) { - const innerContext = createInnerContext( - { - log: resolveContext.log, - yield: resolveContext.yield, - fileDependencies: resolveContext.fileDependencies, - contextDependencies: resolveContext.contextDependencies, - missingDependencies: resolveContext.missingDependencies, - stack: newStack - }, - message - ); - return hook.callAsync(request, innerContext, (err, result) => { - if (err) return callback(err); - if (result) return callback(null, result); - callback(); - }); - } else { - callback(); - } - } + if (this.__shouldStaticallyClose(scopeManager)) { + closeRef = this.__staticCloseRef; + } else if (this.type !== "global") { + closeRef = this.__dynamicCloseRef; + } else { + closeRef = this.__globalCloseRef; + } - /** - * @param {string} identifier identifier - * @returns {ParsedIdentifier} parsed identifier - */ - parse(identifier) { - const part = { - request: "", - query: "", - fragment: "", - module: false, - directory: false, - file: false, - internal: false - }; + // Try Resolving all references in this scope. + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref = this.__left[i]; - const parsedIdentifier = parseIdentifier(identifier); + closeRef.call(this, ref); + } + this.__left = null; - if (!parsedIdentifier) return part; + return this.upper; + } - [part.request, part.query, part.fragment] = parsedIdentifier; + // To override by function scopes. + // References in default parameters isn't resolved to variables which are in their function body. + __isValidResolution(ref, variable) { // eslint-disable-line class-methods-use-this, no-unused-vars + return true; + } - if (part.request.length > 0) { - part.internal = this.isPrivate(identifier); - part.module = this.isModule(part.request); - part.directory = this.isDirectory(part.request); - if (part.directory) { - part.request = part.request.substr(0, part.request.length - 1); - } - } + __resolve(ref) { + const name = ref.identifier.name; - return part; - } + if (!this.set.has(name)) { + return false; + } + const variable = this.set.get(name); - isModule(path) { - return getType(path) === PathType.Normal; - } + if (!this.__isValidResolution(ref, variable)) { + return false; + } + variable.references.push(ref); + variable.stack = variable.stack && ref.from.variableScope === this.variableScope; + if (ref.tainted) { + variable.tainted = true; + this.taints.set(variable.name, true); + } + ref.resolved = variable; - isPrivate(path) { - return getType(path) === PathType.Internal; - } + return true; + } - /** - * @param {string} path a path - * @returns {boolean} true, if the path is a directory path - */ - isDirectory(path) { - return path.endsWith("/"); - } + __delegateToUpperScope(ref) { + if (this.upper) { + this.upper.__left.push(ref); + } + this.through.push(ref); + } - join(path, request) { - return join(path, request); - } + __addDeclaredVariablesOfNode(variable, node) { + if (node === null || node === undefined) { + return; + } - normalize(path) { - return normalize(path); - } -} + let variables = this.__declaredVariables.get(node); -module.exports = Resolver; + if (variables === null || variables === undefined) { + variables = []; + this.__declaredVariables.set(node, variables); + } + if (variables.indexOf(variable) === -1) { + variables.push(variable); + } + } + __defineGeneric(name, set, variables, node, def) { + let variable; -/***/ }), + variable = set.get(name); + if (!variable) { + variable = new Variable(name, this); + set.set(name, variable); + variables.push(variable); + } -/***/ 53990: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + if (def) { + variable.defs.push(def); + this.__addDeclaredVariablesOfNode(variable, def.node); + this.__addDeclaredVariablesOfNode(variable, def.parent); + } + if (node) { + variable.identifiers.push(node); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + __define(node, def) { + if (node && node.type === Syntax.Identifier) { + this.__defineGeneric( + node.name, + this.set, + this.variables, + node, + def + ); + } + } + __referencing(node, assign, writeExpr, maybeImplicitGlobal, partial, init) { + // because Array element may be null + if (!node || node.type !== Syntax.Identifier) { + return; + } -const versions = (__webpack_require__(77282).versions); -const Resolver = __webpack_require__(37432); -const { getType, PathType } = __webpack_require__(3011); - -const SyncAsyncFileSystemDecorator = __webpack_require__(57746); - -const AliasFieldPlugin = __webpack_require__(42752); -const AliasPlugin = __webpack_require__(51547); -const AppendPlugin = __webpack_require__(66477); -const ConditionalPlugin = __webpack_require__(44193); -const DescriptionFilePlugin = __webpack_require__(66826); -const DirectoryExistsPlugin = __webpack_require__(73688); -const ExportsFieldPlugin = __webpack_require__(80163); -const FileExistsPlugin = __webpack_require__(98699); -const ImportsFieldPlugin = __webpack_require__(86058); -const JoinRequestPartPlugin = __webpack_require__(20879); -const JoinRequestPlugin = __webpack_require__(71474); -const MainFieldPlugin = __webpack_require__(73507); -const ModulesInHierarchicalDirectoriesPlugin = __webpack_require__(32942); -const ModulesInRootPlugin = __webpack_require__(48952); -const NextPlugin = __webpack_require__(79135); -const ParsePlugin = __webpack_require__(15234); -const PnpPlugin = __webpack_require__(71488); -const RestrictionsPlugin = __webpack_require__(39222); -const ResultPlugin = __webpack_require__(10615); -const RootsPlugin = __webpack_require__(34403); -const SelfReferencePlugin = __webpack_require__(32317); -const SymlinkPlugin = __webpack_require__(21300); -const TryNextPlugin = __webpack_require__(16442); -const UnsafeCachePlugin = __webpack_require__(3501); -const UseFilePlugin = __webpack_require__(50318); + // Specially handle like `this`. + if (node.name === "super") { + return; + } -/** @typedef {import("./AliasPlugin").AliasOption} AliasOptionEntry */ -/** @typedef {import("./PnpPlugin").PnpApiImpl} PnpApi */ -/** @typedef {import("./Resolver").FileSystem} FileSystem */ -/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ -/** @typedef {import("./Resolver").SyncFileSystem} SyncFileSystem */ + const ref = new Reference(node, this, assign || Reference.READ, writeExpr, maybeImplicitGlobal, !!partial, !!init); -/** @typedef {string|string[]|false} AliasOptionNewRequest */ -/** @typedef {{[k: string]: AliasOptionNewRequest}} AliasOptions */ -/** @typedef {{apply: function(Resolver): void} | function(this: Resolver, Resolver): void} Plugin */ + this.references.push(ref); + this.__left.push(ref); + } -/** - * @typedef {Object} UserResolveOptions - * @property {(AliasOptions | AliasOptionEntry[])=} alias A list of module alias configurations or an object which maps key to value - * @property {(AliasOptions | AliasOptionEntry[])=} fallback A list of module alias configurations or an object which maps key to value, applied only after modules option - * @property {(string | string[])[]=} aliasFields A list of alias fields in description files - * @property {(function(ResolveRequest): boolean)=} cachePredicate A function which decides whether a request should be cached or not. An object is passed with at least `path` and `request` properties. - * @property {boolean=} cacheWithContext Whether or not the unsafeCache should include request context as part of the cache key. - * @property {string[]=} descriptionFiles A list of description files to read from - * @property {string[]=} conditionNames A list of exports field condition names. - * @property {boolean=} enforceExtension Enforce that a extension from extensions must be used - * @property {(string | string[])[]=} exportsFields A list of exports fields in description files - * @property {(string | string[])[]=} importsFields A list of imports fields in description files - * @property {string[]=} extensions A list of extensions which should be tried for files - * @property {FileSystem} fileSystem The file system which should be used - * @property {(object | boolean)=} unsafeCache Use this cache object to unsafely cache the successful requests - * @property {boolean=} symlinks Resolve symlinks to their symlinked location - * @property {Resolver=} resolver A prepared Resolver to which the plugins are attached - * @property {string[] | string=} modules A list of directories to resolve modules from, can be absolute path or folder name - * @property {(string | string[] | {name: string | string[], forceRelative: boolean})[]=} mainFields A list of main fields in description files - * @property {string[]=} mainFiles A list of main files in directories - * @property {Plugin[]=} plugins A list of additional resolve plugins which should be applied - * @property {PnpApi | null=} pnpApi A PnP API that should be used - null is "never", undefined is "auto" - * @property {string[]=} roots A list of root paths - * @property {boolean=} fullySpecified The request is already fully specified and no extensions or directories are resolved for it - * @property {boolean=} resolveToContext Resolve to a context instead of a file - * @property {(string|RegExp)[]=} restrictions A list of resolve restrictions - * @property {boolean=} useSyncFileSystemCalls Use only the sync constraints of the file system calls - * @property {boolean=} preferRelative Prefer to resolve module requests as relative requests before falling back to modules - * @property {boolean=} preferAbsolute Prefer to resolve server-relative urls as absolute paths before falling back to resolve in roots - */ + __detectEval() { + let current = this; -/** - * @typedef {Object} ResolveOptions - * @property {AliasOptionEntry[]} alias - * @property {AliasOptionEntry[]} fallback - * @property {Set} aliasFields - * @property {(function(ResolveRequest): boolean)} cachePredicate - * @property {boolean} cacheWithContext - * @property {Set} conditionNames A list of exports field condition names. - * @property {string[]} descriptionFiles - * @property {boolean} enforceExtension - * @property {Set} exportsFields - * @property {Set} importsFields - * @property {Set} extensions - * @property {FileSystem} fileSystem - * @property {object | false} unsafeCache - * @property {boolean} symlinks - * @property {Resolver=} resolver - * @property {Array} modules - * @property {{name: string[], forceRelative: boolean}[]} mainFields - * @property {Set} mainFiles - * @property {Plugin[]} plugins - * @property {PnpApi | null} pnpApi - * @property {Set} roots - * @property {boolean} fullySpecified - * @property {boolean} resolveToContext - * @property {Set} restrictions - * @property {boolean} preferRelative - * @property {boolean} preferAbsolute - */ + this.directCallToEvalScope = true; + do { + current.dynamic = true; + current = current.upper; + } while (current); + } -/** - * @param {PnpApi | null=} option option - * @returns {PnpApi | null} processed option - */ -function processPnpApiOption(option) { - if ( - option === undefined && - /** @type {NodeJS.ProcessVersions & {pnp: string}} */ versions.pnp - ) { - // @ts-ignore - return __webpack_require__(35125); // eslint-disable-line node/no-missing-require - } + __detectThis() { + this.thisFound = true; + } - return option || null; -} + __isClosed() { + return this.__left === null; + } -/** - * @param {AliasOptions | AliasOptionEntry[] | undefined} alias alias - * @returns {AliasOptionEntry[]} normalized aliases - */ -function normalizeAlias(alias) { - return typeof alias === "object" && !Array.isArray(alias) && alias !== null - ? Object.keys(alias).map(key => { - /** @type {AliasOptionEntry} */ - const obj = { name: key, onlyModule: false, alias: alias[key] }; + /** + * returns resolved {Reference} + * @method Scope#resolve + * @param {Espree.Identifier} ident - identifier to be resolved. + * @returns {Reference} reference + */ + resolve(ident) { + let ref, i, iz; - if (/\$$/.test(key)) { - obj.onlyModule = true; - obj.name = key.substr(0, key.length - 1); - } + assert(this.__isClosed(), "Scope should be closed."); + assert(ident.type === Syntax.Identifier, "Target should be identifier."); + for (i = 0, iz = this.references.length; i < iz; ++i) { + ref = this.references[i]; + if (ref.identifier === ident) { + return ref; + } + } + return null; + } - return obj; - }) - : /** @type {Array} */ (alias) || []; -} + /** + * returns this scope is static + * @method Scope#isStatic + * @returns {boolean} static + */ + isStatic() { + return !this.dynamic; + } -/** - * @param {UserResolveOptions} options input options - * @returns {ResolveOptions} output options - */ -function createOptions(options) { - const mainFieldsSet = new Set(options.mainFields || ["main"]); - const mainFields = []; + /** + * returns this scope has materialized arguments + * @method Scope#isArgumentsMaterialized + * @returns {boolean} arguemnts materialized + */ + isArgumentsMaterialized() { // eslint-disable-line class-methods-use-this + return true; + } - for (const item of mainFieldsSet) { - if (typeof item === "string") { - mainFields.push({ - name: [item], - forceRelative: true - }); - } else if (Array.isArray(item)) { - mainFields.push({ - name: item, - forceRelative: true - }); - } else { - mainFields.push({ - name: Array.isArray(item.name) ? item.name : [item.name], - forceRelative: item.forceRelative - }); - } - } + /** + * returns this scope has materialized `this` reference + * @method Scope#isThisMaterialized + * @returns {boolean} this materialized + */ + isThisMaterialized() { // eslint-disable-line class-methods-use-this + return true; + } - return { - alias: normalizeAlias(options.alias), - fallback: normalizeAlias(options.fallback), - aliasFields: new Set(options.aliasFields), - cachePredicate: - options.cachePredicate || - function () { - return true; - }, - cacheWithContext: - typeof options.cacheWithContext !== "undefined" - ? options.cacheWithContext - : true, - exportsFields: new Set(options.exportsFields || ["exports"]), - importsFields: new Set(options.importsFields || ["imports"]), - conditionNames: new Set(options.conditionNames), - descriptionFiles: Array.from( - new Set(options.descriptionFiles || ["package.json"]) - ), - enforceExtension: - options.enforceExtension === undefined - ? options.extensions && options.extensions.includes("") - ? true - : false - : options.enforceExtension, - extensions: new Set(options.extensions || [".js", ".json", ".node"]), - fileSystem: options.useSyncFileSystemCalls - ? new SyncAsyncFileSystemDecorator( - /** @type {SyncFileSystem} */ ( - /** @type {unknown} */ (options.fileSystem) - ) - ) - : options.fileSystem, - unsafeCache: - options.unsafeCache && typeof options.unsafeCache !== "object" - ? {} - : options.unsafeCache || false, - symlinks: typeof options.symlinks !== "undefined" ? options.symlinks : true, - resolver: options.resolver, - modules: mergeFilteredToArray( - Array.isArray(options.modules) - ? options.modules - : options.modules - ? [options.modules] - : ["node_modules"], - item => { - const type = getType(item); - return type === PathType.Normal || type === PathType.Relative; - } - ), - mainFields, - mainFiles: new Set(options.mainFiles || ["index"]), - plugins: options.plugins || [], - pnpApi: processPnpApiOption(options.pnpApi), - roots: new Set(options.roots || undefined), - fullySpecified: options.fullySpecified || false, - resolveToContext: options.resolveToContext || false, - preferRelative: options.preferRelative || false, - preferAbsolute: options.preferAbsolute || false, - restrictions: new Set(options.restrictions) - }; + isUsedName(name) { + if (this.set.has(name)) { + return true; + } + for (let i = 0, iz = this.through.length; i < iz; ++i) { + if (this.through[i].identifier.name === name) { + return true; + } + } + return false; + } } -/** - * @param {UserResolveOptions} options resolve options - * @returns {Resolver} created resolver - */ -exports.createResolver = function (options) { - const normalizedOptions = createOptions(options); +class GlobalScope extends Scope { + constructor(scopeManager, block) { + super(scopeManager, "global", null, block, false); + this.implicit = { + set: new Map(), + variables: [], - const { - alias, - fallback, - aliasFields, - cachePredicate, - cacheWithContext, - conditionNames, - descriptionFiles, - enforceExtension, - exportsFields, - importsFields, - extensions, - fileSystem, - fullySpecified, - mainFields, - mainFiles, - modules, - plugins: userPlugins, - pnpApi, - resolveToContext, - preferRelative, - preferAbsolute, - symlinks, - unsafeCache, - resolver: customResolver, - restrictions, - roots - } = normalizedOptions; + /** + * List of {@link Reference}s that are left to be resolved (i.e. which + * need to be linked to the variable they refer to). + * @member {Reference[]} Scope#implicit#left + */ + left: [] + }; + } - const plugins = userPlugins.slice(); + __close(scopeManager) { + const implicit = []; - const resolver = customResolver - ? customResolver - : new Resolver(fileSystem, normalizedOptions); + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref = this.__left[i]; - //// pipeline //// + if (ref.__maybeImplicitGlobal && !this.set.has(ref.identifier.name)) { + implicit.push(ref.__maybeImplicitGlobal); + } + } - resolver.ensureHook("resolve"); - resolver.ensureHook("internalResolve"); - resolver.ensureHook("newInternalResolve"); - resolver.ensureHook("parsedResolve"); - resolver.ensureHook("describedResolve"); - resolver.ensureHook("internal"); - resolver.ensureHook("rawModule"); - resolver.ensureHook("module"); - resolver.ensureHook("resolveAsModule"); - resolver.ensureHook("undescribedResolveInPackage"); - resolver.ensureHook("resolveInPackage"); - resolver.ensureHook("resolveInExistingDirectory"); - resolver.ensureHook("relative"); - resolver.ensureHook("describedRelative"); - resolver.ensureHook("directory"); - resolver.ensureHook("undescribedExistingDirectory"); - resolver.ensureHook("existingDirectory"); - resolver.ensureHook("undescribedRawFile"); - resolver.ensureHook("rawFile"); - resolver.ensureHook("file"); - resolver.ensureHook("finalFile"); - resolver.ensureHook("existingFile"); - resolver.ensureHook("resolved"); + // create an implicit global variable from assignment expression + for (let i = 0, iz = implicit.length; i < iz; ++i) { + const info = implicit[i]; - // TODO remove in next major - // cspell:word Interal - // Backward-compat - resolver.hooks.newInteralResolve = resolver.hooks.newInternalResolve; + this.__defineImplicit(info.pattern, + new Definition( + Variable.ImplicitGlobalVariable, + info.pattern, + info.node, + null, + null, + null + )); - // resolve - for (const { source, resolveOptions } of [ - { source: "resolve", resolveOptions: { fullySpecified } }, - { source: "internal-resolve", resolveOptions: { fullySpecified: false } } - ]) { - if (unsafeCache) { - plugins.push( - new UnsafeCachePlugin( - source, - cachePredicate, - unsafeCache, - cacheWithContext, - `new-${source}` - ) - ); - plugins.push( - new ParsePlugin(`new-${source}`, resolveOptions, "parsed-resolve") - ); - } else { - plugins.push(new ParsePlugin(source, resolveOptions, "parsed-resolve")); - } - } + } - // parsed-resolve - plugins.push( - new DescriptionFilePlugin( - "parsed-resolve", - descriptionFiles, - false, - "described-resolve" - ) - ); - plugins.push(new NextPlugin("after-parsed-resolve", "described-resolve")); + this.implicit.left = this.__left; - // described-resolve - plugins.push(new NextPlugin("described-resolve", "normal-resolve")); - if (fallback.length > 0) { - plugins.push( - new AliasPlugin("described-resolve", fallback, "internal-resolve") - ); - } + return super.__close(scopeManager); + } - // normal-resolve - if (alias.length > 0) - plugins.push(new AliasPlugin("normal-resolve", alias, "internal-resolve")); - aliasFields.forEach(item => { - plugins.push( - new AliasFieldPlugin("normal-resolve", item, "internal-resolve") - ); - }); - if (preferRelative) { - plugins.push(new JoinRequestPlugin("after-normal-resolve", "relative")); - } - plugins.push( - new ConditionalPlugin( - "after-normal-resolve", - { module: true }, - "resolve as module", - false, - "raw-module" - ) - ); - plugins.push( - new ConditionalPlugin( - "after-normal-resolve", - { internal: true }, - "resolve as internal import", - false, - "internal" - ) - ); - if (preferAbsolute) { - plugins.push(new JoinRequestPlugin("after-normal-resolve", "relative")); - } - if (roots.size > 0) { - plugins.push(new RootsPlugin("after-normal-resolve", roots, "relative")); - } - if (!preferRelative && !preferAbsolute) { - plugins.push(new JoinRequestPlugin("after-normal-resolve", "relative")); - } + __defineImplicit(node, def) { + if (node && node.type === Syntax.Identifier) { + this.__defineGeneric( + node.name, + this.implicit.set, + this.implicit.variables, + node, + def + ); + } + } +} - // internal - importsFields.forEach(importsField => { - plugins.push( - new ImportsFieldPlugin( - "internal", - conditionNames, - importsField, - "relative", - "internal-resolve" - ) - ); - }); +class ModuleScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "module", upperScope, block, false); + } +} - // raw-module - exportsFields.forEach(exportsField => { - plugins.push( - new SelfReferencePlugin("raw-module", exportsField, "resolve-as-module") - ); - }); - modules.forEach(item => { - if (Array.isArray(item)) { - if (item.includes("node_modules") && pnpApi) { - plugins.push( - new ModulesInHierarchicalDirectoriesPlugin( - "raw-module", - item.filter(i => i !== "node_modules"), - "module" - ) - ); - plugins.push( - new PnpPlugin("raw-module", pnpApi, "undescribed-resolve-in-package") - ); - } else { - plugins.push( - new ModulesInHierarchicalDirectoriesPlugin( - "raw-module", - item, - "module" - ) - ); - } - } else { - plugins.push(new ModulesInRootPlugin("raw-module", item, "module")); - } - }); +class FunctionExpressionNameScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "function-expression-name", upperScope, block, false); + this.__define(block.id, + new Definition( + Variable.FunctionName, + block.id, + block, + null, + null, + null + )); + this.functionExpressionScope = true; + } +} - // module - plugins.push(new JoinRequestPartPlugin("module", "resolve-as-module")); +class CatchScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "catch", upperScope, block, false); + } +} - // resolve-as-module - if (!resolveToContext) { - plugins.push( - new ConditionalPlugin( - "resolve-as-module", - { directory: false, request: "." }, - "single file module", - true, - "undescribed-raw-file" - ) - ); - } - plugins.push( - new DirectoryExistsPlugin( - "resolve-as-module", - "undescribed-resolve-in-package" - ) - ); +class WithScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "with", upperScope, block, false); + } - // undescribed-resolve-in-package - plugins.push( - new DescriptionFilePlugin( - "undescribed-resolve-in-package", - descriptionFiles, - false, - "resolve-in-package" - ) - ); - plugins.push( - new NextPlugin("after-undescribed-resolve-in-package", "resolve-in-package") - ); + __close(scopeManager) { + if (this.__shouldStaticallyClose(scopeManager)) { + return super.__close(scopeManager); + } - // resolve-in-package - exportsFields.forEach(exportsField => { - plugins.push( - new ExportsFieldPlugin( - "resolve-in-package", - conditionNames, - exportsField, - "relative" - ) - ); - }); - plugins.push( - new NextPlugin("resolve-in-package", "resolve-in-existing-directory") - ); + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref = this.__left[i]; - // resolve-in-existing-directory - plugins.push( - new JoinRequestPlugin("resolve-in-existing-directory", "relative") - ); + ref.tainted = true; + this.__delegateToUpperScope(ref); + } + this.__left = null; - // relative - plugins.push( - new DescriptionFilePlugin( - "relative", - descriptionFiles, - true, - "described-relative" - ) - ); - plugins.push(new NextPlugin("after-relative", "described-relative")); + return this.upper; + } +} - // described-relative - if (resolveToContext) { - plugins.push(new NextPlugin("described-relative", "directory")); - } else { - plugins.push( - new ConditionalPlugin( - "described-relative", - { directory: false }, - null, - true, - "raw-file" - ) - ); - plugins.push( - new ConditionalPlugin( - "described-relative", - { fullySpecified: false }, - "as directory", - true, - "directory" - ) - ); - } +class BlockScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "block", upperScope, block, false); + } +} - // directory - plugins.push( - new DirectoryExistsPlugin("directory", "undescribed-existing-directory") - ); +class SwitchScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "switch", upperScope, block, false); + } +} - if (resolveToContext) { - // undescribed-existing-directory - plugins.push(new NextPlugin("undescribed-existing-directory", "resolved")); - } else { - // undescribed-existing-directory - plugins.push( - new DescriptionFilePlugin( - "undescribed-existing-directory", - descriptionFiles, - false, - "existing-directory" - ) - ); - mainFiles.forEach(item => { - plugins.push( - new UseFilePlugin( - "undescribed-existing-directory", - item, - "undescribed-raw-file" - ) - ); - }); +class FunctionScope extends Scope { + constructor(scopeManager, upperScope, block, isMethodDefinition) { + super(scopeManager, "function", upperScope, block, isMethodDefinition); - // described-existing-directory - mainFields.forEach(item => { - plugins.push( - new MainFieldPlugin( - "existing-directory", - item, - "resolve-in-existing-directory" - ) - ); - }); - mainFiles.forEach(item => { - plugins.push( - new UseFilePlugin("existing-directory", item, "undescribed-raw-file") - ); - }); + // section 9.2.13, FunctionDeclarationInstantiation. + // NOTE Arrow functions never have an arguments objects. + if (this.block.type !== Syntax.ArrowFunctionExpression) { + this.__defineArguments(); + } + } - // undescribed-raw-file - plugins.push( - new DescriptionFilePlugin( - "undescribed-raw-file", - descriptionFiles, - true, - "raw-file" - ) - ); - plugins.push(new NextPlugin("after-undescribed-raw-file", "raw-file")); + isArgumentsMaterialized() { - // raw-file - plugins.push( - new ConditionalPlugin( - "raw-file", - { fullySpecified: true }, - null, - false, - "file" - ) - ); - if (!enforceExtension) { - plugins.push(new TryNextPlugin("raw-file", "no extension", "file")); - } - extensions.forEach(item => { - plugins.push(new AppendPlugin("raw-file", item, "file")); - }); + // TODO(Constellation) + // We can more aggressive on this condition like this. + // + // function t() { + // // arguments of t is always hidden. + // function arguments() { + // } + // } + if (this.block.type === Syntax.ArrowFunctionExpression) { + return false; + } - // file - if (alias.length > 0) - plugins.push(new AliasPlugin("file", alias, "internal-resolve")); - aliasFields.forEach(item => { - plugins.push(new AliasFieldPlugin("file", item, "internal-resolve")); - }); - plugins.push(new NextPlugin("file", "final-file")); + if (!this.isStatic()) { + return true; + } - // final-file - plugins.push(new FileExistsPlugin("final-file", "existing-file")); + const variable = this.set.get("arguments"); - // existing-file - if (symlinks) - plugins.push(new SymlinkPlugin("existing-file", "existing-file")); - plugins.push(new NextPlugin("existing-file", "resolved")); - } + assert(variable, "Always have arguments variable."); + return variable.tainted || variable.references.length !== 0; + } - // resolved - if (restrictions.size > 0) { - plugins.push(new RestrictionsPlugin(resolver.hooks.resolved, restrictions)); - } - plugins.push(new ResultPlugin(resolver.hooks.resolved)); + isThisMaterialized() { + if (!this.isStatic()) { + return true; + } + return this.thisFound; + } - //// RESOLVER //// + __defineArguments() { + this.__defineGeneric( + "arguments", + this.set, + this.variables, + null, + null + ); + this.taints.set("arguments", true); + } - for (const plugin of plugins) { - if (typeof plugin === "function") { - plugin.call(resolver, resolver); - } else { - plugin.apply(resolver); - } - } + // References in default parameters isn't resolved to variables which are in their function body. + // const x = 1 + // function f(a = x) { // This `x` is resolved to the `x` in the outer scope. + // const x = 2 + // console.log(a) + // } + __isValidResolution(ref, variable) { - return resolver; -}; + // If `options.nodejsScope` is true, `this.block` becomes a Program node. + if (this.block.type === "Program") { + return true; + } -/** - * Merging filtered elements - * @param {string[]} array source array - * @param {function(string): boolean} filter predicate - * @returns {Array} merge result - */ -function mergeFilteredToArray(array, filter) { - /** @type {Array} */ - const result = []; - const set = new Set(array); + const bodyStart = this.block.body.range[0]; - for (const item of set) { - if (filter(item)) { - const lastElement = - result.length > 0 ? result[result.length - 1] : undefined; - if (Array.isArray(lastElement)) { - lastElement.push(item); - } else { - result.push([item]); - } - } else { - result.push(item); - } - } + // It's invalid resolution in the following case: + return !( + variable.scope === this && + ref.identifier.range[0] < bodyStart && // the reference is in the parameter part. + variable.defs.every(d => d.name.range[0] >= bodyStart) // the variable is in the body. + ); + } +} - return result; +class ForScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "for", upperScope, block, false); + } +} + +class ClassScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "class", upperScope, block, false); + } } +module.exports = { + Scope, + GlobalScope, + ModuleScope, + FunctionExpressionNameScope, + CatchScope, + WithScope, + BlockScope, + SwitchScope, + FunctionScope, + ForScope, + ClassScope +}; + +/* vim: set sw=4 ts=4 et tw=80 : */ + /***/ }), -/***/ 39222: +/***/ 82971: /***/ (function(module) { "use strict"; /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ - - + Copyright (C) 2015 Yusuke Suzuki -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: -const slashCode = "/".charCodeAt(0); -const backslashCode = "\\".charCodeAt(0); + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. -const isInside = (path, parent) => { - if (!path.startsWith(parent)) return false; - if (path.length === parent.length) return true; - const charCode = path.charCodeAt(parent.length); - return charCode === slashCode || charCode === backslashCode; -}; + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ -module.exports = class RestrictionsPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {Set} restrictions restrictions - */ - constructor(source, restrictions) { - this.source = source; - this.restrictions = restrictions; - } - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - resolver - .getHook(this.source) - .tapAsync("RestrictionsPlugin", (request, resolveContext, callback) => { - if (typeof request.path === "string") { - const path = request.path; - for (const rule of this.restrictions) { - if (typeof rule === "string") { - if (!isInside(path, rule)) { - if (resolveContext.log) { - resolveContext.log( - `${path} is not inside of the restriction ${rule}` - ); - } - return callback(null, null); - } - } else if (!rule.test(path)) { - if (resolveContext.log) { - resolveContext.log( - `${path} doesn't match the restriction ${rule}` - ); - } - return callback(null, null); - } - } - } +/** + * A Variable represents a locally scoped identifier. These include arguments to + * functions. + * @class Variable + */ +class Variable { + constructor(name, scope) { - callback(); - }); - } -}; + /** + * The variable name, as given in the source code. + * @member {String} Variable#name + */ + this.name = name; + /** + * List of defining occurrences of this variable (like in 'var ...' + * statements or as parameter), as AST nodes. + * @member {espree.Identifier[]} Variable#identifiers + */ + this.identifiers = []; -/***/ }), + /** + * List of {@link Reference|references} of this variable (excluding parameter entries) + * in its defining scope and all nested scopes. For defining + * occurrences only see {@link Variable#defs}. + * @member {Reference[]} Variable#references + */ + this.references = []; -/***/ 10615: -/***/ (function(module) { + /** + * List of defining occurrences of this variable (like in 'var ...' + * statements or as parameter), as custom objects. + * @member {Definition[]} Variable#defs + */ + this.defs = []; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + this.tainted = false; + /** + * Whether this is a stack variable. + * @member {boolean} Variable#stack + */ + this.stack = true; + /** + * Reference to the enclosing Scope. + * @member {Scope} Variable#scope + */ + this.scope = scope; + } +} -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +Variable.CatchClause = "CatchClause"; +Variable.Parameter = "Parameter"; +Variable.FunctionName = "FunctionName"; +Variable.ClassName = "ClassName"; +Variable.Variable = "Variable"; +Variable.ImportBinding = "ImportBinding"; +Variable.ImplicitGlobalVariable = "ImplicitGlobalVariable"; -module.exports = class ResultPlugin { - /** - * @param {ResolveStepHook} source source - */ - constructor(source) { - this.source = source; - } +module.exports = Variable; - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - this.source.tapAsync( - "ResultPlugin", - (request, resolverContext, callback) => { - const obj = { ...request }; - if (resolverContext.log) - resolverContext.log("reporting result " + obj.path); - resolver.hooks.result.callAsync(obj, resolverContext, err => { - if (err) return callback(err); - if (typeof resolverContext.yield === "function") { - resolverContext.yield(obj); - callback(null, null); - } else { - callback(null, obj); - } - }); - } - ); - } -}; +/* vim: set sw=4 ts=4 et tw=80 : */ /***/ }), -/***/ 34403: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 81217: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -"use strict"; /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Copyright (C) 2014 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +(function () { + 'use strict'; + var estraverse = __webpack_require__(50165); + function isNode(node) { + if (node == null) { + return false; + } + return typeof node === 'object' && typeof node.type === 'string'; + } -const forEachBail = __webpack_require__(8266); + function isProperty(nodeType, key) { + return (nodeType === estraverse.Syntax.ObjectExpression || nodeType === estraverse.Syntax.ObjectPattern) && key === 'properties'; + } -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + function Visitor(visitor, options) { + options = options || {}; -class RootsPlugin { - /** - * @param {string | ResolveStepHook} source source hook - * @param {Set} roots roots - * @param {string | ResolveStepHook} target target hook - */ - constructor(source, roots, target) { - this.roots = Array.from(roots); - this.source = source; - this.target = target; - } + this.__visitor = visitor || this; + this.__childVisitorKeys = options.childVisitorKeys + ? Object.assign({}, estraverse.VisitorKeys, options.childVisitorKeys) + : estraverse.VisitorKeys; + if (options.fallback === 'iteration') { + this.__fallback = Object.keys; + } else if (typeof options.fallback === 'function') { + this.__fallback = options.fallback; + } + } - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); + /* Default method for visiting children. + * When you need to call default visiting operation inside custom visiting + * operation, you can use it with `this.visitChildren(node)`. + */ + Visitor.prototype.visitChildren = function (node) { + var type, children, i, iz, j, jz, child; - resolver - .getHook(this.source) - .tapAsync("RootsPlugin", (request, resolveContext, callback) => { - const req = request.request; - if (!req) return callback(); - if (!req.startsWith("/")) return callback(); + if (node == null) { + return; + } - forEachBail( - this.roots, - (root, callback) => { - const path = resolver.join(root, req.slice(1)); - const obj = { - ...request, - path, - relativePath: request.relativePath && path - }; - resolver.doResolve( - target, - obj, - `root path ${root}`, - resolveContext, - callback - ); - }, - callback - ); - }); - } -} + type = node.type || estraverse.Syntax.Property; -module.exports = RootsPlugin; + children = this.__childVisitorKeys[type]; + if (!children) { + if (this.__fallback) { + children = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + type + '.'); + } + } + for (i = 0, iz = children.length; i < iz; ++i) { + child = node[children[i]]; + if (child) { + if (Array.isArray(child)) { + for (j = 0, jz = child.length; j < jz; ++j) { + if (child[j]) { + if (isNode(child[j]) || isProperty(type, children[i])) { + this.visit(child[j]); + } + } + } + } else if (isNode(child)) { + this.visit(child); + } + } + } + }; -/***/ }), + /* Dispatching node. */ + Visitor.prototype.visit = function (node) { + var type; -/***/ 32317: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (node == null) { + return; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + type = node.type || estraverse.Syntax.Property; + if (this.__visitor[type]) { + this.__visitor[type].call(this, node); + return; + } + this.visitChildren(node); + }; + exports.version = __webpack_require__(12166).version; + exports.Visitor = Visitor; + exports.visit = function (node, visitor, options) { + var v = new Visitor(visitor, options); + v.visit(node); + }; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ -const DescriptionFileUtils = __webpack_require__(702); +/***/ }), -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +/***/ 50165: +/***/ (function(__unused_webpack_module, exports) { -const slashCode = "/".charCodeAt(0); +/* + Copyright (C) 2012-2013 Yusuke Suzuki + Copyright (C) 2012 Ariya Hidayat -module.exports = class SelfReferencePlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string | string[]} fieldNamePath name path - * @param {string | ResolveStepHook} target target - */ - constructor(source, fieldNamePath, target) { - this.source = source; - this.target = target; - this.fieldName = fieldNamePath; - } + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("SelfReferencePlugin", (request, resolveContext, callback) => { - if (!request.descriptionFilePath) return callback(); + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - const req = request.request; - if (!req) return callback(); + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/*jslint vars:false, bitwise:true*/ +/*jshint indent:4*/ +/*global exports:true*/ +(function clone(exports) { + 'use strict'; - // Feature is only enabled when an exports field is present - const exportsField = DescriptionFileUtils.getField( - request.descriptionFileData, - this.fieldName - ); - if (!exportsField) return callback(); + var Syntax, + VisitorOption, + VisitorKeys, + BREAK, + SKIP, + REMOVE; - const name = DescriptionFileUtils.getField( - request.descriptionFileData, - "name" - ); - if (typeof name !== "string") return callback(); + function deepCopy(obj) { + var ret = {}, key, val; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + val = obj[key]; + if (typeof val === 'object' && val !== null) { + ret[key] = deepCopy(val); + } else { + ret[key] = val; + } + } + } + return ret; + } - if ( - req.startsWith(name) && - (req.length === name.length || - req.charCodeAt(name.length) === slashCode) - ) { - const remainingRequest = `.${req.slice(name.length)}`; + // based on LLVM libc++ upper_bound / lower_bound + // MIT License - const obj = { - ...request, - request: remainingRequest, - path: /** @type {string} */ (request.descriptionFileRoot), - relativePath: "." - }; + function upperBound(array, func) { + var diff, len, i, current; - resolver.doResolve( - target, - obj, - "self reference", - resolveContext, - callback - ); - } else { - return callback(); - } - }); - } -}; + len = array.length; + i = 0; + while (len) { + diff = len >>> 1; + current = i + diff; + if (func(array[current])) { + len = diff; + } else { + i = current + 1; + len -= diff + 1; + } + } + return i; + } -/***/ }), + Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7. + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ChainExpression: 'ChainExpression', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7. + ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7. + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DebuggerStatement: 'DebuggerStatement', + DirectiveStatement: 'DirectiveStatement', + DoWhileStatement: 'DoWhileStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + ForOfStatement: 'ForOfStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7. + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportExpression: 'ImportExpression', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + ModuleSpecifier: 'ModuleSpecifier', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' + }; -/***/ 21300: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + VisitorKeys = { + AssignmentExpression: ['left', 'right'], + AssignmentPattern: ['left', 'right'], + ArrayExpression: ['elements'], + ArrayPattern: ['elements'], + ArrowFunctionExpression: ['params', 'body'], + AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7. + BlockStatement: ['body'], + BinaryExpression: ['left', 'right'], + BreakStatement: ['label'], + CallExpression: ['callee', 'arguments'], + CatchClause: ['param', 'body'], + ChainExpression: ['expression'], + ClassBody: ['body'], + ClassDeclaration: ['id', 'superClass', 'body'], + ClassExpression: ['id', 'superClass', 'body'], + ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7. + ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + ConditionalExpression: ['test', 'consequent', 'alternate'], + ContinueStatement: ['label'], + DebuggerStatement: [], + DirectiveStatement: [], + DoWhileStatement: ['body', 'test'], + EmptyStatement: [], + ExportAllDeclaration: ['source'], + ExportDefaultDeclaration: ['declaration'], + ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], + ExportSpecifier: ['exported', 'local'], + ExpressionStatement: ['expression'], + ForStatement: ['init', 'test', 'update', 'body'], + ForInStatement: ['left', 'right', 'body'], + ForOfStatement: ['left', 'right', 'body'], + FunctionDeclaration: ['id', 'params', 'body'], + FunctionExpression: ['id', 'params', 'body'], + GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + Identifier: [], + IfStatement: ['test', 'consequent', 'alternate'], + ImportExpression: ['source'], + ImportDeclaration: ['specifiers', 'source'], + ImportDefaultSpecifier: ['local'], + ImportNamespaceSpecifier: ['local'], + ImportSpecifier: ['imported', 'local'], + Literal: [], + LabeledStatement: ['label', 'body'], + LogicalExpression: ['left', 'right'], + MemberExpression: ['object', 'property'], + MetaProperty: ['meta', 'property'], + MethodDefinition: ['key', 'value'], + ModuleSpecifier: [], + NewExpression: ['callee', 'arguments'], + ObjectExpression: ['properties'], + ObjectPattern: ['properties'], + Program: ['body'], + Property: ['key', 'value'], + RestElement: [ 'argument' ], + ReturnStatement: ['argument'], + SequenceExpression: ['expressions'], + SpreadElement: ['argument'], + Super: [], + SwitchStatement: ['discriminant', 'cases'], + SwitchCase: ['test', 'consequent'], + TaggedTemplateExpression: ['tag', 'quasi'], + TemplateElement: [], + TemplateLiteral: ['quasis', 'expressions'], + ThisExpression: [], + ThrowStatement: ['argument'], + TryStatement: ['block', 'handler', 'finalizer'], + UnaryExpression: ['argument'], + UpdateExpression: ['argument'], + VariableDeclaration: ['declarations'], + VariableDeclarator: ['id', 'init'], + WhileStatement: ['test', 'body'], + WithStatement: ['object', 'body'], + YieldExpression: ['argument'] + }; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // unique id + BREAK = {}; + SKIP = {}; + REMOVE = {}; + VisitorOption = { + Break: BREAK, + Skip: SKIP, + Remove: REMOVE + }; + function Reference(parent, key) { + this.parent = parent; + this.key = key; + } -const forEachBail = __webpack_require__(8266); -const getPaths = __webpack_require__(48608); -const { getType, PathType } = __webpack_require__(3011); + Reference.prototype.replace = function replace(node) { + this.parent[this.key] = node; + }; -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + Reference.prototype.remove = function remove() { + if (Array.isArray(this.parent)) { + this.parent.splice(this.key, 1); + return true; + } else { + this.replace(null); + return false; + } + }; -module.exports = class SymlinkPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string | ResolveStepHook} target target - */ - constructor(source, target) { - this.source = source; - this.target = target; - } + function Element(node, path, wrap, ref) { + this.node = node; + this.path = path; + this.wrap = wrap; + this.ref = ref; + } - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - const fs = resolver.fileSystem; - resolver - .getHook(this.source) - .tapAsync("SymlinkPlugin", (request, resolveContext, callback) => { - if (request.ignoreSymlinks) return callback(); - const pathsResult = getPaths(request.path); - const pathSegments = pathsResult.segments; - const paths = pathsResult.paths; + function Controller() { } - let containsSymlink = false; - let idx = -1; - forEachBail( - paths, - (path, callback) => { - idx++; - if (resolveContext.fileDependencies) - resolveContext.fileDependencies.add(path); - fs.readlink(path, (err, result) => { - if (!err && result) { - pathSegments[idx] = result; - containsSymlink = true; - // Shortcut when absolute symlink found - const resultType = getType(result.toString()); - if ( - resultType === PathType.AbsoluteWin || - resultType === PathType.AbsolutePosix - ) { - return callback(null, idx); - } - } - callback(); - }); - }, - (err, idx) => { - if (!containsSymlink) return callback(); - const resultSegments = - typeof idx === "number" - ? pathSegments.slice(0, idx + 1) - : pathSegments.slice(); - const result = resultSegments.reduceRight((a, b) => { - return resolver.join(a, b); - }); - const obj = { - ...request, - path: result - }; - resolver.doResolve( - target, - obj, - "resolved symlink to " + result, - resolveContext, - callback - ); - } - ); - }); - } -}; + // API: + // return property path array from root to current node + Controller.prototype.path = function path() { + var i, iz, j, jz, result, element; + function addToPath(result, path) { + if (Array.isArray(path)) { + for (j = 0, jz = path.length; j < jz; ++j) { + result.push(path[j]); + } + } else { + result.push(path); + } + } -/***/ }), + // root node + if (!this.__current.path) { + return null; + } -/***/ 57746: -/***/ (function(module) { + // first node is sentinel, second node is root element + result = []; + for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { + element = this.__leavelist[i]; + addToPath(result, element.path); + } + addToPath(result, this.__current.path); + return result; + }; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // API: + // return type of current node + Controller.prototype.type = function () { + var node = this.current(); + return node.type || this.__current.wrap; + }; + // API: + // return array of parent elements + Controller.prototype.parents = function parents() { + var i, iz, result; + // first node is sentinel + result = []; + for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { + result.push(this.__leavelist[i].node); + } -/** @typedef {import("./Resolver").FileSystem} FileSystem */ -/** @typedef {import("./Resolver").SyncFileSystem} SyncFileSystem */ + return result; + }; -/** - * @param {SyncFileSystem} fs file system implementation - * @constructor - */ -function SyncAsyncFileSystemDecorator(fs) { - this.fs = fs; + // API: + // return current node + Controller.prototype.current = function current() { + return this.__current.node; + }; - this.lstat = undefined; - this.lstatSync = undefined; - const lstatSync = fs.lstatSync; - if (lstatSync) { - this.lstat = (arg, options, callback) => { - let result; - try { - result = lstatSync.call(fs, arg); - } catch (e) { - return (callback || options)(e); - } - (callback || options)(null, result); - }; - this.lstatSync = (arg, options) => lstatSync.call(fs, arg, options); - } + Controller.prototype.__execute = function __execute(callback, element) { + var previous, result; - this.stat = (arg, options, callback) => { - let result; - try { - result = callback ? fs.statSync(arg, options) : fs.statSync(arg); - } catch (e) { - return (callback || options)(e); - } - (callback || options)(null, result); - }; - this.statSync = (arg, options) => fs.statSync(arg, options); + result = undefined; - this.readdir = (arg, options, callback) => { - let result; - try { - result = fs.readdirSync(arg); - } catch (e) { - return (callback || options)(e); - } - (callback || options)(null, result); - }; - this.readdirSync = (arg, options) => fs.readdirSync(arg, options); + previous = this.__current; + this.__current = element; + this.__state = null; + if (callback) { + result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); + } + this.__current = previous; - this.readFile = (arg, options, callback) => { - let result; - try { - result = fs.readFileSync(arg); - } catch (e) { - return (callback || options)(e); - } - (callback || options)(null, result); - }; - this.readFileSync = (arg, options) => fs.readFileSync(arg, options); + return result; + }; - this.readlink = (arg, options, callback) => { - let result; - try { - result = fs.readlinkSync(arg); - } catch (e) { - return (callback || options)(e); - } - (callback || options)(null, result); - }; - this.readlinkSync = (arg, options) => fs.readlinkSync(arg, options); + // API: + // notify control skip / break + Controller.prototype.notify = function notify(flag) { + this.__state = flag; + }; - this.readJson = undefined; - this.readJsonSync = undefined; - const readJsonSync = fs.readJsonSync; - if (readJsonSync) { - this.readJson = (arg, options, callback) => { - let result; - try { - result = readJsonSync.call(fs, arg); - } catch (e) { - return (callback || options)(e); - } - (callback || options)(null, result); - }; + // API: + // skip child nodes of current node + Controller.prototype.skip = function () { + this.notify(SKIP); + }; - this.readJsonSync = (arg, options) => readJsonSync.call(fs, arg, options); - } -} -module.exports = SyncAsyncFileSystemDecorator; + // API: + // break traversals + Controller.prototype['break'] = function () { + this.notify(BREAK); + }; + // API: + // remove node + Controller.prototype.remove = function () { + this.notify(REMOVE); + }; -/***/ }), + Controller.prototype.__initialize = function(root, visitor) { + this.visitor = visitor; + this.root = root; + this.__worklist = []; + this.__leavelist = []; + this.__current = null; + this.__state = null; + this.__fallback = null; + if (visitor.fallback === 'iteration') { + this.__fallback = Object.keys; + } else if (typeof visitor.fallback === 'function') { + this.__fallback = visitor.fallback; + } -/***/ 16442: -/***/ (function(module) { + this.__keys = VisitorKeys; + if (visitor.keys) { + this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); + } + }; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + function isNode(node) { + if (node == null) { + return false; + } + return typeof node === 'object' && typeof node.type === 'string'; + } + function isProperty(nodeType, key) { + return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; + } + + function candidateExistsInLeaveList(leavelist, candidate) { + for (var i = leavelist.length - 1; i >= 0; --i) { + if (leavelist[i].node === candidate) { + return true; + } + } + return false; + } + Controller.prototype.traverse = function traverse(root, visitor) { + var worklist, + leavelist, + element, + node, + nodeType, + ret, + key, + current, + current2, + candidates, + candidate, + sentinel; -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + this.__initialize(root, visitor); -module.exports = class TryNextPlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string} message message - * @param {string | ResolveStepHook} target target - */ - constructor(source, message, target) { - this.source = source; - this.message = message; - this.target = target; - } + sentinel = {}; - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("TryNextPlugin", (request, resolveContext, callback) => { - resolver.doResolve( - target, - request, - this.message, - resolveContext, - callback - ); - }); - } -}; + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; + // initialize + worklist.push(new Element(root, null, null, null)); + leavelist.push(new Element(null, null, null, null)); -/***/ }), + while (worklist.length) { + element = worklist.pop(); -/***/ 3501: -/***/ (function(module) { + if (element === sentinel) { + element = leavelist.pop(); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + ret = this.__execute(visitor.leave, element); + if (this.__state === BREAK || ret === BREAK) { + return; + } + continue; + } + if (element.node) { -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -/** @typedef {{[k: string]: any}} Cache */ + ret = this.__execute(visitor.enter, element); -function getCacheId(request, withContext) { - return JSON.stringify({ - context: withContext ? request.context : "", - path: request.path, - query: request.query, - fragment: request.fragment, - request: request.request - }); -} + if (this.__state === BREAK || ret === BREAK) { + return; + } -module.exports = class UnsafeCachePlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {function(ResolveRequest): boolean} filterPredicate filterPredicate - * @param {Cache} cache cache - * @param {boolean} withContext withContext - * @param {string | ResolveStepHook} target target - */ - constructor(source, filterPredicate, cache, withContext, target) { - this.source = source; - this.filterPredicate = filterPredicate; - this.withContext = withContext; - this.cache = cache; - this.target = target; - } + worklist.push(sentinel); + leavelist.push(element); - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("UnsafeCachePlugin", (request, resolveContext, callback) => { - if (!this.filterPredicate(request)) return callback(); - const cacheId = getCacheId(request, this.withContext); - const cacheEntry = this.cache[cacheId]; - if (cacheEntry) { - return callback(null, cacheEntry); - } - resolver.doResolve( - target, - request, - null, - resolveContext, - (err, result) => { - if (err) return callback(err); - if (result) return callback(null, (this.cache[cacheId] = result)); - callback(); - } - ); - }); - } -}; + if (this.__state === SKIP || ret === SKIP) { + continue; + } + node = element.node; + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } -/***/ }), + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } -/***/ 50318: -/***/ (function(module) { + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (candidateExistsInLeaveList(leavelist, candidate[current2])) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', null); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, null); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + if (candidateExistsInLeaveList(leavelist, candidate)) { + continue; + } + worklist.push(new Element(candidate, key, null, null)); + } + } + } + } + }; -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + Controller.prototype.replace = function replace(root, visitor) { + var worklist, + leavelist, + node, + nodeType, + target, + element, + current, + current2, + candidates, + candidate, + sentinel, + outer, + key; -module.exports = class UseFilePlugin { - /** - * @param {string | ResolveStepHook} source source - * @param {string} filename filename - * @param {string | ResolveStepHook} target target - */ - constructor(source, filename, target) { - this.source = source; - this.filename = filename; - this.target = target; - } + function removeElem(element) { + var i, + key, + nextElem, + parent; - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("UseFilePlugin", (request, resolveContext, callback) => { - const filePath = resolver.join(request.path, this.filename); - const obj = { - ...request, - path: filePath, - relativePath: - request.relativePath && - resolver.join(request.relativePath, this.filename) - }; - resolver.doResolve( - target, - obj, - "using path: " + filePath, - resolveContext, - callback - ); - }); - } -}; + if (element.ref.remove()) { + // When the reference is an element of an array. + key = element.ref.key; + parent = element.ref.parent; + // If removed from array, then decrease following items' keys. + i = worklist.length; + while (i--) { + nextElem = worklist[i]; + if (nextElem.ref && nextElem.ref.parent === parent) { + if (nextElem.ref.key < key) { + break; + } + --nextElem.ref.key; + } + } + } + } -/***/ }), + this.__initialize(root, visitor); -/***/ 95478: -/***/ (function(module) { + sentinel = {}; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; + // initialize + outer = { + root: root + }; + element = new Element(root, null, null, new Reference(outer, 'root')); + worklist.push(element); + leavelist.push(element); + while (worklist.length) { + element = worklist.pop(); -module.exports = function createInnerContext( - options, - message, - messageOptional -) { - let messageReported = false; - let innerLog = undefined; - if (options.log) { - if (message) { - innerLog = msg => { - if (!messageReported) { - options.log(message); - messageReported = true; - } - options.log(" " + msg); - }; - } else { - innerLog = options.log; - } - } - const childContext = { - log: innerLog, - yield: options.yield, - fileDependencies: options.fileDependencies, - contextDependencies: options.contextDependencies, - missingDependencies: options.missingDependencies, - stack: options.stack - }; - return childContext; -}; + if (element === sentinel) { + element = leavelist.pop(); + target = this.__execute(visitor.leave, element); -/***/ }), + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + } -/***/ 8266: -/***/ (function(module) { + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + continue; + } + target = this.__execute(visitor.enter, element); + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + element.node = target; + } -module.exports = function forEachBail(array, iterator, callback) { - if (array.length === 0) return callback(); + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + element.node = null; + } - let i = 0; - const next = () => { - let loop = undefined; - iterator(array[i++], (err, result) => { - if (err || result !== undefined || i >= array.length) { - return callback(err, result); - } - if (loop === false) while (next()); - loop = true; - }); - if (!loop) loop = false; - return loop; - }; - while (next()); -}; + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + // node may be null + node = element.node; + if (!node) { + continue; + } -/***/ }), + worklist.push(sentinel); + leavelist.push(element); -/***/ 50290: -/***/ (function(module) { + if (this.__state === SKIP || target === SKIP) { + continue; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, new Reference(node, key))); + } + } + } -module.exports = function getInnerRequest(resolver, request) { - if ( - typeof request.__innerRequest === "string" && - request.__innerRequest_request === request.request && - request.__innerRequest_relativePath === request.relativePath - ) - return request.__innerRequest; - let innerRequest; - if (request.request) { - innerRequest = request.request; - if (/^\.\.?(?:\/|$)/.test(innerRequest) && request.relativePath) { - innerRequest = resolver.join(request.relativePath, innerRequest); - } - } else { - innerRequest = request.relativePath; - } - request.__innerRequest_request = request.request; - request.__innerRequest_relativePath = request.relativePath; - return (request.__innerRequest = innerRequest); -}; - - -/***/ }), - -/***/ 48608: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - + return outer.root; + }; + function traverse(root, visitor) { + var controller = new Controller(); + return controller.traverse(root, visitor); + } -module.exports = function getPaths(path) { - if (path === "/") return { paths: ["/"], segments: [""] }; - const parts = path.split(/(.*?[\\/]+)/); - const paths = [path]; - const segments = [parts[parts.length - 1]]; - let part = parts[parts.length - 1]; - path = path.substr(0, path.length - part.length - 1); - for (let i = parts.length - 2; i > 2; i -= 2) { - paths.push(path); - part = parts[i]; - path = path.substr(0, path.length - part.length) || "/"; - segments.push(part.substr(0, part.length - 1)); - } - part = parts[1]; - segments.push(part); - paths.push(part); - return { - paths: paths, - segments: segments - }; -}; + function replace(root, visitor) { + var controller = new Controller(); + return controller.replace(root, visitor); + } -module.exports.basename = function basename(path) { - const i = path.lastIndexOf("/"), - j = path.lastIndexOf("\\"); - const p = i < 0 ? j : j < 0 ? i : i < j ? j : i; - if (p < 0) return null; - const s = path.substr(p + 1); - return s; -}; + function extendCommentRange(comment, tokens) { + var target; + target = upperBound(tokens, function search(token) { + return token.range[0] > comment.range[0]; + }); -/***/ }), + comment.extendedRange = [comment.range[0], comment.range[1]]; -/***/ 30662: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (target !== tokens.length) { + comment.extendedRange[1] = tokens[target].range[0]; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + target -= 1; + if (target >= 0) { + comment.extendedRange[0] = tokens[target].range[1]; + } + return comment; + } + function attachComments(tree, providedComments, tokens) { + // At first, we should calculate extended comment ranges. + var comments = [], comment, len, i, cursor; -const fs = __webpack_require__(90552); -const CachedInputFileSystem = __webpack_require__(89429); -const ResolverFactory = __webpack_require__(53990); + if (!tree.range) { + throw new Error('attachComments needs range information'); + } -/** @typedef {import("./PnpPlugin").PnpApiImpl} PnpApi */ -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").FileSystem} FileSystem */ -/** @typedef {import("./Resolver").ResolveContext} ResolveContext */ -/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ -/** @typedef {import("./ResolverFactory").Plugin} Plugin */ -/** @typedef {import("./ResolverFactory").UserResolveOptions} ResolveOptions */ + // tokens array is empty, we attach comments to tree as 'leadingComments' + if (!tokens.length) { + if (providedComments.length) { + for (i = 0, len = providedComments.length; i < len; i += 1) { + comment = deepCopy(providedComments[i]); + comment.extendedRange = [0, tree.range[0]]; + comments.push(comment); + } + tree.leadingComments = comments; + } + return tree; + } -const nodeFileSystem = new CachedInputFileSystem(fs, 4000); + for (i = 0, len = providedComments.length; i < len; i += 1) { + comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); + } -const nodeContext = { - environments: ["node+es3+es5+process+native"] -}; + // This is based on John Freeman's implementation. + cursor = 0; + traverse(tree, { + enter: function (node) { + var comment; -const asyncResolver = ResolverFactory.createResolver({ - conditionNames: ["node"], - extensions: [".js", ".json", ".node"], - fileSystem: nodeFileSystem -}); -function resolve(context, path, request, resolveContext, callback) { - if (typeof context === "string") { - callback = resolveContext; - resolveContext = request; - request = path; - path = context; - context = nodeContext; - } - if (typeof callback !== "function") { - callback = resolveContext; - } - asyncResolver.resolve(context, path, request, resolveContext, callback); -} + while (cursor < comments.length) { + comment = comments[cursor]; + if (comment.extendedRange[1] > node.range[0]) { + break; + } -const syncResolver = ResolverFactory.createResolver({ - conditionNames: ["node"], - extensions: [".js", ".json", ".node"], - useSyncFileSystemCalls: true, - fileSystem: nodeFileSystem -}); -function resolveSync(context, path, request) { - if (typeof context === "string") { - request = path; - path = context; - context = nodeContext; - } - return syncResolver.resolveSync(context, path, request); -} + if (comment.extendedRange[1] === node.range[0]) { + if (!node.leadingComments) { + node.leadingComments = []; + } + node.leadingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } -function create(options) { - options = { - fileSystem: nodeFileSystem, - ...options - }; - const resolver = ResolverFactory.createResolver(options); - return function (context, path, request, resolveContext, callback) { - if (typeof context === "string") { - callback = resolveContext; - resolveContext = request; - request = path; - path = context; - context = nodeContext; - } - if (typeof callback !== "function") { - callback = resolveContext; - } - resolver.resolve(context, path, request, resolveContext, callback); - }; -} + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } -function createSync(options) { - options = { - useSyncFileSystemCalls: true, - fileSystem: nodeFileSystem, - ...options - }; - const resolver = ResolverFactory.createResolver(options); - return function (context, path, request) { - if (typeof context === "string") { - request = path; - path = context; - context = nodeContext; - } - return resolver.resolveSync(context, path, request); - }; -} + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); -/** - * @template A - * @template B - * @param {A} obj input a - * @param {B} exports input b - * @returns {A & B} merged - */ -const mergeExports = (obj, exports) => { - const descriptors = Object.getOwnPropertyDescriptors(exports); - Object.defineProperties(obj, descriptors); - return /** @type {A & B} */ (Object.freeze(obj)); -}; + cursor = 0; + traverse(tree, { + leave: function (node) { + var comment; -module.exports = mergeExports(resolve, { - get sync() { - return resolveSync; - }, - create: mergeExports(create, { - get sync() { - return createSync; - } - }), - ResolverFactory, - CachedInputFileSystem, - get CloneBasenamePlugin() { - return __webpack_require__(2020); - }, - get LogInfoPlugin() { - return __webpack_require__(47032); - }, - get forEachBail() { - return __webpack_require__(8266); - } -}); + while (cursor < comments.length) { + comment = comments[cursor]; + if (node.range[1] < comment.extendedRange[0]) { + break; + } + if (node.range[1] === comment.extendedRange[0]) { + if (!node.trailingComments) { + node.trailingComments = []; + } + node.trailingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } -/***/ }), + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } -/***/ 28348: -/***/ (function(module) { + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ + return tree; + } + exports.Syntax = Syntax; + exports.traverse = traverse; + exports.replace = replace; + exports.attachComments = attachComments; + exports.VisitorKeys = VisitorKeys; + exports.VisitorOption = VisitorOption; + exports.Controller = Controller; + exports.cloneEnvironment = function () { return clone({}); }; + return exports; +}(exports)); +/* vim: set sw=4 ts=4 et tw=80 : */ -/** @typedef {string|(string|ConditionalMapping)[]} DirectMapping */ -/** @typedef {{[k: string]: MappingValue}} ConditionalMapping */ -/** @typedef {ConditionalMapping|DirectMapping|null} MappingValue */ -/** @typedef {Record|ConditionalMapping|DirectMapping} ExportsField */ -/** @typedef {Record} ImportsField */ -/** - * @typedef {Object} PathTreeNode - * @property {Map|null} children - * @property {MappingValue} folder - * @property {Map|null} wildcards - * @property {Map} files - */ +/***/ }), -/** - * Processing exports/imports field - * @callback FieldProcessor - * @param {string} request request - * @param {Set} conditionNames condition names - * @returns {string[]} resolved paths - */ +/***/ 18350: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { /* -Example exports field: -{ - ".": "./main.js", - "./feature": { - "browser": "./feature-browser.js", - "default": "./feature.js" - } -} -Terminology: - -Enhanced-resolve name keys ("." and "./feature") as exports field keys. - -If value is string or string[], mapping is called as a direct mapping -and value called as a direct export. - -If value is key-value object, mapping is called as a conditional mapping -and value called as a conditional export. - -Key in conditional mapping is called condition name. - -Conditional mapping nested in another conditional mapping is called nested mapping. - ----------- - -Example imports field: -{ - "#a": "./main.js", - "#moment": { - "browser": "./moment/index.js", - "default": "moment" - }, - "#moment/": { - "browser": "./moment/", - "default": "moment/" - } -} -Terminology: - -Enhanced-resolve name keys ("#a" and "#moment/", "#moment") as imports field keys. - -If value is string or string[], mapping is called as a direct mapping -and value called as a direct export. - -If value is key-value object, mapping is called as a conditional mapping -and value called as a conditional export. + Copyright (C) 2012-2013 Yusuke Suzuki + Copyright (C) 2012 Ariya Hidayat -Key in conditional mapping is called condition name. + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: -Conditional mapping nested in another conditional mapping is called nested mapping. + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/*jslint vars:false, bitwise:true*/ +/*jshint indent:4*/ +/*global exports:true*/ +(function clone(exports) { + 'use strict'; -const slashCode = "/".charCodeAt(0); -const dotCode = ".".charCodeAt(0); -const hashCode = "#".charCodeAt(0); - -/** - * @param {ExportsField} exportsField the exports field - * @returns {FieldProcessor} process callback - */ -module.exports.processExportsField = function processExportsField( - exportsField -) { - return createFieldProcessor( - buildExportsFieldPathTree(exportsField), - assertExportsFieldRequest, - assertExportTarget - ); -}; - -/** - * @param {ImportsField} importsField the exports field - * @returns {FieldProcessor} process callback - */ -module.exports.processImportsField = function processImportsField( - importsField -) { - return createFieldProcessor( - buildImportsFieldPathTree(importsField), - assertImportsFieldRequest, - assertImportTarget - ); -}; - -/** - * @param {PathTreeNode} treeRoot root - * @param {(s: string) => string} assertRequest assertRequest - * @param {(s: string, f: boolean) => void} assertTarget assertTarget - * @returns {FieldProcessor} field processor - */ -function createFieldProcessor(treeRoot, assertRequest, assertTarget) { - return function fieldProcessor(request, conditionNames) { - request = assertRequest(request); - - const match = findMatch(request, treeRoot); - - if (match === null) return []; - - const [mapping, remainRequestIndex] = match; - - /** @type {DirectMapping|null} */ - let direct = null; - - if (isConditionalMapping(mapping)) { - direct = conditionalMapping( - /** @type {ConditionalMapping} */ (mapping), - conditionNames - ); + var Syntax, + VisitorOption, + VisitorKeys, + BREAK, + SKIP, + REMOVE; - // matching not found - if (direct === null) return []; - } else { - direct = /** @type {DirectMapping} */ (mapping); - } + function deepCopy(obj) { + var ret = {}, key, val; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + val = obj[key]; + if (typeof val === 'object' && val !== null) { + ret[key] = deepCopy(val); + } else { + ret[key] = val; + } + } + } + return ret; + } - const remainingRequest = - remainRequestIndex === request.length + 1 - ? undefined - : remainRequestIndex < 0 - ? request.slice(-remainRequestIndex - 1) - : request.slice(remainRequestIndex); + // based on LLVM libc++ upper_bound / lower_bound + // MIT License - return directMapping( - remainingRequest, - remainRequestIndex < 0, - direct, - conditionNames, - assertTarget - ); - }; -} + function upperBound(array, func) { + var diff, len, i, current; -/** - * @param {string} request request - * @returns {string} updated request - */ -function assertExportsFieldRequest(request) { - if (request.charCodeAt(0) !== dotCode) { - throw new Error('Request should be relative path and start with "."'); - } - if (request.length === 1) return ""; - if (request.charCodeAt(1) !== slashCode) { - throw new Error('Request should be relative path and start with "./"'); - } - if (request.charCodeAt(request.length - 1) === slashCode) { - throw new Error("Only requesting file allowed"); - } + len = array.length; + i = 0; - return request.slice(2); -} + while (len) { + diff = len >>> 1; + current = i + diff; + if (func(array[current])) { + len = diff; + } else { + i = current + 1; + len -= diff + 1; + } + } + return i; + } -/** - * @param {string} request request - * @returns {string} updated request - */ -function assertImportsFieldRequest(request) { - if (request.charCodeAt(0) !== hashCode) { - throw new Error('Request should start with "#"'); - } - if (request.length === 1) { - throw new Error("Request should have at least 2 characters"); - } - if (request.charCodeAt(1) === slashCode) { - throw new Error('Request should not start with "#/"'); - } - if (request.charCodeAt(request.length - 1) === slashCode) { - throw new Error("Only requesting file allowed"); - } + Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7. + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7. + ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7. + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DebuggerStatement: 'DebuggerStatement', + DirectiveStatement: 'DirectiveStatement', + DoWhileStatement: 'DoWhileStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + ForOfStatement: 'ForOfStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7. + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportExpression: 'ImportExpression', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + ModuleSpecifier: 'ModuleSpecifier', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' + }; - return request.slice(1); -} + VisitorKeys = { + AssignmentExpression: ['left', 'right'], + AssignmentPattern: ['left', 'right'], + ArrayExpression: ['elements'], + ArrayPattern: ['elements'], + ArrowFunctionExpression: ['params', 'body'], + AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7. + BlockStatement: ['body'], + BinaryExpression: ['left', 'right'], + BreakStatement: ['label'], + CallExpression: ['callee', 'arguments'], + CatchClause: ['param', 'body'], + ClassBody: ['body'], + ClassDeclaration: ['id', 'superClass', 'body'], + ClassExpression: ['id', 'superClass', 'body'], + ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7. + ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + ConditionalExpression: ['test', 'consequent', 'alternate'], + ContinueStatement: ['label'], + DebuggerStatement: [], + DirectiveStatement: [], + DoWhileStatement: ['body', 'test'], + EmptyStatement: [], + ExportAllDeclaration: ['source'], + ExportDefaultDeclaration: ['declaration'], + ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], + ExportSpecifier: ['exported', 'local'], + ExpressionStatement: ['expression'], + ForStatement: ['init', 'test', 'update', 'body'], + ForInStatement: ['left', 'right', 'body'], + ForOfStatement: ['left', 'right', 'body'], + FunctionDeclaration: ['id', 'params', 'body'], + FunctionExpression: ['id', 'params', 'body'], + GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + Identifier: [], + IfStatement: ['test', 'consequent', 'alternate'], + ImportExpression: ['source'], + ImportDeclaration: ['specifiers', 'source'], + ImportDefaultSpecifier: ['local'], + ImportNamespaceSpecifier: ['local'], + ImportSpecifier: ['imported', 'local'], + Literal: [], + LabeledStatement: ['label', 'body'], + LogicalExpression: ['left', 'right'], + MemberExpression: ['object', 'property'], + MetaProperty: ['meta', 'property'], + MethodDefinition: ['key', 'value'], + ModuleSpecifier: [], + NewExpression: ['callee', 'arguments'], + ObjectExpression: ['properties'], + ObjectPattern: ['properties'], + Program: ['body'], + Property: ['key', 'value'], + RestElement: [ 'argument' ], + ReturnStatement: ['argument'], + SequenceExpression: ['expressions'], + SpreadElement: ['argument'], + Super: [], + SwitchStatement: ['discriminant', 'cases'], + SwitchCase: ['test', 'consequent'], + TaggedTemplateExpression: ['tag', 'quasi'], + TemplateElement: [], + TemplateLiteral: ['quasis', 'expressions'], + ThisExpression: [], + ThrowStatement: ['argument'], + TryStatement: ['block', 'handler', 'finalizer'], + UnaryExpression: ['argument'], + UpdateExpression: ['argument'], + VariableDeclaration: ['declarations'], + VariableDeclarator: ['id', 'init'], + WhileStatement: ['test', 'body'], + WithStatement: ['object', 'body'], + YieldExpression: ['argument'] + }; -/** - * @param {string} exp export target - * @param {boolean} expectFolder is folder expected - */ -function assertExportTarget(exp, expectFolder) { - if ( - exp.charCodeAt(0) === slashCode || - (exp.charCodeAt(0) === dotCode && exp.charCodeAt(1) !== slashCode) - ) { - throw new Error( - `Export should be relative path and start with "./", got ${JSON.stringify( - exp - )}.` - ); - } + // unique id + BREAK = {}; + SKIP = {}; + REMOVE = {}; - const isFolder = exp.charCodeAt(exp.length - 1) === slashCode; + VisitorOption = { + Break: BREAK, + Skip: SKIP, + Remove: REMOVE + }; - if (isFolder !== expectFolder) { - throw new Error( - expectFolder - ? `Expecting folder to folder mapping. ${JSON.stringify( - exp - )} should end with "/"` - : `Expecting file to file mapping. ${JSON.stringify( - exp - )} should not end with "/"` - ); - } -} + function Reference(parent, key) { + this.parent = parent; + this.key = key; + } -/** - * @param {string} imp import target - * @param {boolean} expectFolder is folder expected - */ -function assertImportTarget(imp, expectFolder) { - const isFolder = imp.charCodeAt(imp.length - 1) === slashCode; + Reference.prototype.replace = function replace(node) { + this.parent[this.key] = node; + }; - if (isFolder !== expectFolder) { - throw new Error( - expectFolder - ? `Expecting folder to folder mapping. ${JSON.stringify( - imp - )} should end with "/"` - : `Expecting file to file mapping. ${JSON.stringify( - imp - )} should not end with "/"` - ); - } -} + Reference.prototype.remove = function remove() { + if (Array.isArray(this.parent)) { + this.parent.splice(this.key, 1); + return true; + } else { + this.replace(null); + return false; + } + }; -/** - * Trying to match request to field - * @param {string} request request - * @param {PathTreeNode} treeRoot path tree root - * @returns {[MappingValue, number]|null} match or null, number is negative and one less when it's a folder mapping, number is request.length + 1 for direct mappings - */ -function findMatch(request, treeRoot) { - if (request.length === 0) { - const value = treeRoot.files.get(""); + function Element(node, path, wrap, ref) { + this.node = node; + this.path = path; + this.wrap = wrap; + this.ref = ref; + } - return value ? [value, 1] : null; - } + function Controller() { } - if ( - treeRoot.children === null && - treeRoot.folder === null && - treeRoot.wildcards === null - ) { - const value = treeRoot.files.get(request); + // API: + // return property path array from root to current node + Controller.prototype.path = function path() { + var i, iz, j, jz, result, element; - return value ? [value, request.length + 1] : null; - } + function addToPath(result, path) { + if (Array.isArray(path)) { + for (j = 0, jz = path.length; j < jz; ++j) { + result.push(path[j]); + } + } else { + result.push(path); + } + } - let node = treeRoot; - let lastNonSlashIndex = 0; - let slashIndex = request.indexOf("/", 0); + // root node + if (!this.__current.path) { + return null; + } - /** @type {[MappingValue, number]|null} */ - let lastFolderMatch = null; + // first node is sentinel, second node is root element + result = []; + for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { + element = this.__leavelist[i]; + addToPath(result, element.path); + } + addToPath(result, this.__current.path); + return result; + }; - const applyFolderMapping = () => { - const folderMapping = node.folder; - if (folderMapping) { - if (lastFolderMatch) { - lastFolderMatch[0] = folderMapping; - lastFolderMatch[1] = -lastNonSlashIndex - 1; - } else { - lastFolderMatch = [folderMapping, -lastNonSlashIndex - 1]; - } - } - }; + // API: + // return type of current node + Controller.prototype.type = function () { + var node = this.current(); + return node.type || this.__current.wrap; + }; - const applyWildcardMappings = (wildcardMappings, remainingRequest) => { - if (wildcardMappings) { - for (const [key, target] of wildcardMappings) { - if (remainingRequest.startsWith(key)) { - if (!lastFolderMatch) { - lastFolderMatch = [target, lastNonSlashIndex + key.length]; - } else if (lastFolderMatch[1] < lastNonSlashIndex + key.length) { - lastFolderMatch[0] = target; - lastFolderMatch[1] = lastNonSlashIndex + key.length; - } - } - } - } - }; + // API: + // return array of parent elements + Controller.prototype.parents = function parents() { + var i, iz, result; - while (slashIndex !== -1) { - applyFolderMapping(); + // first node is sentinel + result = []; + for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { + result.push(this.__leavelist[i].node); + } - const wildcardMappings = node.wildcards; + return result; + }; - if (!wildcardMappings && node.children === null) return lastFolderMatch; + // API: + // return current node + Controller.prototype.current = function current() { + return this.__current.node; + }; - const folder = request.slice(lastNonSlashIndex, slashIndex); + Controller.prototype.__execute = function __execute(callback, element) { + var previous, result; - applyWildcardMappings(wildcardMappings, folder); + result = undefined; - if (node.children === null) return lastFolderMatch; + previous = this.__current; + this.__current = element; + this.__state = null; + if (callback) { + result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); + } + this.__current = previous; - const newNode = node.children.get(folder); + return result; + }; - if (!newNode) { - return lastFolderMatch; - } + // API: + // notify control skip / break + Controller.prototype.notify = function notify(flag) { + this.__state = flag; + }; - node = newNode; - lastNonSlashIndex = slashIndex + 1; - slashIndex = request.indexOf("/", lastNonSlashIndex); - } + // API: + // skip child nodes of current node + Controller.prototype.skip = function () { + this.notify(SKIP); + }; - const remainingRequest = - lastNonSlashIndex > 0 ? request.slice(lastNonSlashIndex) : request; + // API: + // break traversals + Controller.prototype['break'] = function () { + this.notify(BREAK); + }; - const value = node.files.get(remainingRequest); + // API: + // remove node + Controller.prototype.remove = function () { + this.notify(REMOVE); + }; - if (value) { - return [value, request.length + 1]; - } + Controller.prototype.__initialize = function(root, visitor) { + this.visitor = visitor; + this.root = root; + this.__worklist = []; + this.__leavelist = []; + this.__current = null; + this.__state = null; + this.__fallback = null; + if (visitor.fallback === 'iteration') { + this.__fallback = Object.keys; + } else if (typeof visitor.fallback === 'function') { + this.__fallback = visitor.fallback; + } - applyFolderMapping(); + this.__keys = VisitorKeys; + if (visitor.keys) { + this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); + } + }; - applyWildcardMappings(node.wildcards, remainingRequest); + function isNode(node) { + if (node == null) { + return false; + } + return typeof node === 'object' && typeof node.type === 'string'; + } - return lastFolderMatch; -} + function isProperty(nodeType, key) { + return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; + } -/** - * @param {ConditionalMapping|DirectMapping|null} mapping mapping - * @returns {boolean} is conditional mapping - */ -function isConditionalMapping(mapping) { - return ( - mapping !== null && typeof mapping === "object" && !Array.isArray(mapping) - ); -} + Controller.prototype.traverse = function traverse(root, visitor) { + var worklist, + leavelist, + element, + node, + nodeType, + ret, + key, + current, + current2, + candidates, + candidate, + sentinel; -/** - * @param {string|undefined} remainingRequest remaining request when folder mapping, undefined for file mappings - * @param {boolean} subpathMapping true, for subpath mappings - * @param {DirectMapping|null} mappingTarget direct export - * @param {Set} conditionNames condition names - * @param {(d: string, f: boolean) => void} assert asserting direct value - * @returns {string[]} mapping result - */ -function directMapping( - remainingRequest, - subpathMapping, - mappingTarget, - conditionNames, - assert -) { - if (mappingTarget === null) return []; + this.__initialize(root, visitor); - if (typeof mappingTarget === "string") { - return [ - targetMapping(remainingRequest, subpathMapping, mappingTarget, assert) - ]; - } + sentinel = {}; - const targets = []; + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; - for (const exp of mappingTarget) { - if (typeof exp === "string") { - targets.push( - targetMapping(remainingRequest, subpathMapping, exp, assert) - ); - continue; - } + // initialize + worklist.push(new Element(root, null, null, null)); + leavelist.push(new Element(null, null, null, null)); - const mapping = conditionalMapping(exp, conditionNames); - if (!mapping) continue; - const innerExports = directMapping( - remainingRequest, - subpathMapping, - mapping, - conditionNames, - assert - ); - for (const innerExport of innerExports) { - targets.push(innerExport); - } - } + while (worklist.length) { + element = worklist.pop(); - return targets; -} + if (element === sentinel) { + element = leavelist.pop(); -/** - * @param {string|undefined} remainingRequest remaining request when folder mapping, undefined for file mappings - * @param {boolean} subpathMapping true, for subpath mappings - * @param {string} mappingTarget direct export - * @param {(d: string, f: boolean) => void} assert asserting direct value - * @returns {string} mapping result - */ -function targetMapping( - remainingRequest, - subpathMapping, - mappingTarget, - assert -) { - if (remainingRequest === undefined) { - assert(mappingTarget, false); - return mappingTarget; - } - if (subpathMapping) { - assert(mappingTarget, true); - return mappingTarget + remainingRequest; - } - assert(mappingTarget, false); - return mappingTarget.replace(/\*/g, remainingRequest.replace(/\$/g, "$$")); -} - -/** - * @param {ConditionalMapping} conditionalMapping_ conditional mapping - * @param {Set} conditionNames condition names - * @returns {DirectMapping|null} direct mapping if found - */ -function conditionalMapping(conditionalMapping_, conditionNames) { - /** @type {[ConditionalMapping, string[], number][]} */ - let lookup = [[conditionalMapping_, Object.keys(conditionalMapping_), 0]]; + ret = this.__execute(visitor.leave, element); - loop: while (lookup.length > 0) { - const [mapping, conditions, j] = lookup[lookup.length - 1]; - const last = conditions.length - 1; + if (this.__state === BREAK || ret === BREAK) { + return; + } + continue; + } - for (let i = j; i < conditions.length; i++) { - const condition = conditions[i]; + if (element.node) { - // assert default. Could be last only - if (i !== last) { - if (condition === "default") { - throw new Error("Default condition should be last one"); - } - } else if (condition === "default") { - const innerMapping = mapping[condition]; - // is nested - if (isConditionalMapping(innerMapping)) { - const conditionalMapping = /** @type {ConditionalMapping} */ (innerMapping); - lookup[lookup.length - 1][2] = i + 1; - lookup.push([conditionalMapping, Object.keys(conditionalMapping), 0]); - continue loop; - } + ret = this.__execute(visitor.enter, element); - return /** @type {DirectMapping} */ (innerMapping); - } + if (this.__state === BREAK || ret === BREAK) { + return; + } - if (conditionNames.has(condition)) { - const innerMapping = mapping[condition]; - // is nested - if (isConditionalMapping(innerMapping)) { - const conditionalMapping = /** @type {ConditionalMapping} */ (innerMapping); - lookup[lookup.length - 1][2] = i + 1; - lookup.push([conditionalMapping, Object.keys(conditionalMapping), 0]); - continue loop; - } + worklist.push(sentinel); + leavelist.push(element); - return /** @type {DirectMapping} */ (innerMapping); - } - } + if (this.__state === SKIP || ret === SKIP) { + continue; + } - lookup.pop(); - } + node = element.node; + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } - return null; -} + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } -/** - * Internal helper to create path tree node - * to ensure that each node gets the same hidden class - * @returns {PathTreeNode} node - */ -function createNode() { - return { - children: null, - folder: null, - wildcards: null, - files: new Map() - }; -} + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', null); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, null); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, null)); + } + } + } + } + }; -/** - * Internal helper for building path tree - * @param {PathTreeNode} root root - * @param {string} path path - * @param {MappingValue} target target - */ -function walkPath(root, path, target) { - if (path.length === 0) { - root.folder = target; - return; - } + Controller.prototype.replace = function replace(root, visitor) { + var worklist, + leavelist, + node, + nodeType, + target, + element, + current, + current2, + candidates, + candidate, + sentinel, + outer, + key; - let node = root; - // Typical path tree can looks like - // root - // - files: ["a.js", "b.js"] - // - children: - // node1: - // - files: ["a.js", "b.js"] - let lastNonSlashIndex = 0; - let slashIndex = path.indexOf("/", 0); + function removeElem(element) { + var i, + key, + nextElem, + parent; - while (slashIndex !== -1) { - const folder = path.slice(lastNonSlashIndex, slashIndex); - let newNode; + if (element.ref.remove()) { + // When the reference is an element of an array. + key = element.ref.key; + parent = element.ref.parent; - if (node.children === null) { - newNode = createNode(); - node.children = new Map(); - node.children.set(folder, newNode); - } else { - newNode = node.children.get(folder); + // If removed from array, then decrease following items' keys. + i = worklist.length; + while (i--) { + nextElem = worklist[i]; + if (nextElem.ref && nextElem.ref.parent === parent) { + if (nextElem.ref.key < key) { + break; + } + --nextElem.ref.key; + } + } + } + } - if (!newNode) { - newNode = createNode(); - node.children.set(folder, newNode); - } - } + this.__initialize(root, visitor); - node = newNode; - lastNonSlashIndex = slashIndex + 1; - slashIndex = path.indexOf("/", lastNonSlashIndex); - } + sentinel = {}; - if (lastNonSlashIndex >= path.length) { - node.folder = target; - } else { - const file = lastNonSlashIndex > 0 ? path.slice(lastNonSlashIndex) : path; - if (file.endsWith("*")) { - if (node.wildcards === null) node.wildcards = new Map(); - node.wildcards.set(file.slice(0, -1), target); - } else { - node.files.set(file, target); - } - } -} + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; -/** - * @param {ExportsField} field exports field - * @returns {PathTreeNode} tree root - */ -function buildExportsFieldPathTree(field) { - const root = createNode(); + // initialize + outer = { + root: root + }; + element = new Element(root, null, null, new Reference(outer, 'root')); + worklist.push(element); + leavelist.push(element); - // handle syntax sugar, if exports field is direct mapping for "." - if (typeof field === "string") { - root.files.set("", field); + while (worklist.length) { + element = worklist.pop(); - return root; - } else if (Array.isArray(field)) { - root.files.set("", field.slice()); + if (element === sentinel) { + element = leavelist.pop(); - return root; - } + target = this.__execute(visitor.leave, element); - const keys = Object.keys(field); + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + } - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + } - if (key.charCodeAt(0) !== dotCode) { - // handle syntax sugar, if exports field is conditional mapping for "." - if (i === 0) { - while (i < keys.length) { - const charCode = keys[i].charCodeAt(0); - if (charCode === dotCode || charCode === slashCode) { - throw new Error( - `Exports field key should be relative path and start with "." (key: ${JSON.stringify( - key - )})` - ); - } - i++; - } + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + continue; + } - root.files.set("", field); - return root; - } + target = this.__execute(visitor.enter, element); - throw new Error( - `Exports field key should be relative path and start with "." (key: ${JSON.stringify( - key - )})` - ); - } + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + element.node = target; + } - if (key.length === 1) { - root.files.set("", field[key]); - continue; - } + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + element.node = null; + } - if (key.charCodeAt(1) !== slashCode) { - throw new Error( - `Exports field key should be relative path and start with "./" (key: ${JSON.stringify( - key - )})` - ); - } + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } - walkPath(root, key.slice(2), field[key]); - } + // node may be null + node = element.node; + if (!node) { + continue; + } - return root; -} + worklist.push(sentinel); + leavelist.push(element); -/** - * @param {ImportsField} field imports field - * @returns {PathTreeNode} root - */ -function buildImportsFieldPathTree(field) { - const root = createNode(); + if (this.__state === SKIP || target === SKIP) { + continue; + } - const keys = Object.keys(field); + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } - if (key.charCodeAt(0) !== hashCode) { - throw new Error( - `Imports field key should start with "#" (key: ${JSON.stringify(key)})` - ); - } + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, new Reference(node, key))); + } + } + } - if (key.length === 1) { - throw new Error( - `Imports field key should have at least 2 characters (key: ${JSON.stringify( - key - )})` - ); - } + return outer.root; + }; - if (key.charCodeAt(1) === slashCode) { - throw new Error( - `Imports field key should not start with "#/" (key: ${JSON.stringify( - key - )})` - ); - } + function traverse(root, visitor) { + var controller = new Controller(); + return controller.traverse(root, visitor); + } - walkPath(root, key.slice(1), field[key]); - } + function replace(root, visitor) { + var controller = new Controller(); + return controller.replace(root, visitor); + } - return root; -} + function extendCommentRange(comment, tokens) { + var target; + target = upperBound(tokens, function search(token) { + return token.range[0] > comment.range[0]; + }); -/***/ }), + comment.extendedRange = [comment.range[0], comment.range[1]]; -/***/ 7780: -/***/ (function(module) { + if (target !== tokens.length) { + comment.extendedRange[1] = tokens[target].range[0]; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ + target -= 1; + if (target >= 0) { + comment.extendedRange[0] = tokens[target].range[1]; + } + return comment; + } + function attachComments(tree, providedComments, tokens) { + // At first, we should calculate extended comment ranges. + var comments = [], comment, len, i, cursor; -const PATH_QUERY_FRAGMENT_REGEXP = /^(#?(?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/; + if (!tree.range) { + throw new Error('attachComments needs range information'); + } -/** - * @param {string} identifier identifier - * @returns {[string, string, string]|null} parsed identifier - */ -function parseIdentifier(identifier) { - const match = PATH_QUERY_FRAGMENT_REGEXP.exec(identifier); + // tokens array is empty, we attach comments to tree as 'leadingComments' + if (!tokens.length) { + if (providedComments.length) { + for (i = 0, len = providedComments.length; i < len; i += 1) { + comment = deepCopy(providedComments[i]); + comment.extendedRange = [0, tree.range[0]]; + comments.push(comment); + } + tree.leadingComments = comments; + } + return tree; + } - if (!match) return null; + for (i = 0, len = providedComments.length; i < len; i += 1) { + comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); + } - return [ - match[1].replace(/\0(.)/g, "$1"), - match[2] ? match[2].replace(/\0(.)/g, "$1") : "", - match[3] || "" - ]; -} + // This is based on John Freeman's implementation. + cursor = 0; + traverse(tree, { + enter: function (node) { + var comment; -module.exports.parseIdentifier = parseIdentifier; + while (cursor < comments.length) { + comment = comments[cursor]; + if (comment.extendedRange[1] > node.range[0]) { + break; + } + if (comment.extendedRange[1] === node.range[0]) { + if (!node.leadingComments) { + node.leadingComments = []; + } + node.leadingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } -/***/ }), + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } -/***/ 3011: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + cursor = 0; + traverse(tree, { + leave: function (node) { + var comment; + while (cursor < comments.length) { + comment = comments[cursor]; + if (node.range[1] < comment.extendedRange[0]) { + break; + } + if (node.range[1] === comment.extendedRange[0]) { + if (!node.trailingComments) { + node.trailingComments = []; + } + node.trailingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } -const path = __webpack_require__(71017); - -const CHAR_HASH = "#".charCodeAt(0); -const CHAR_SLASH = "/".charCodeAt(0); -const CHAR_BACKSLASH = "\\".charCodeAt(0); -const CHAR_A = "A".charCodeAt(0); -const CHAR_Z = "Z".charCodeAt(0); -const CHAR_LOWER_A = "a".charCodeAt(0); -const CHAR_LOWER_Z = "z".charCodeAt(0); -const CHAR_DOT = ".".charCodeAt(0); -const CHAR_COLON = ":".charCodeAt(0); - -const posixNormalize = path.posix.normalize; -const winNormalize = path.win32.normalize; - -/** - * @enum {number} - */ -const PathType = Object.freeze({ - Empty: 0, - Normal: 1, - Relative: 2, - AbsoluteWin: 3, - AbsolutePosix: 4, - Internal: 5 -}); -exports.PathType = PathType; + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } -/** - * @param {string} p a path - * @returns {PathType} type of path - */ -const getType = p => { - switch (p.length) { - case 0: - return PathType.Empty; - case 1: { - const c0 = p.charCodeAt(0); - switch (c0) { - case CHAR_DOT: - return PathType.Relative; - case CHAR_SLASH: - return PathType.AbsolutePosix; - case CHAR_HASH: - return PathType.Internal; - } - return PathType.Normal; - } - case 2: { - const c0 = p.charCodeAt(0); - switch (c0) { - case CHAR_DOT: { - const c1 = p.charCodeAt(1); - switch (c1) { - case CHAR_DOT: - case CHAR_SLASH: - return PathType.Relative; - } - return PathType.Normal; - } - case CHAR_SLASH: - return PathType.AbsolutePosix; - case CHAR_HASH: - return PathType.Internal; - } - const c1 = p.charCodeAt(1); - if (c1 === CHAR_COLON) { - if ( - (c0 >= CHAR_A && c0 <= CHAR_Z) || - (c0 >= CHAR_LOWER_A && c0 <= CHAR_LOWER_Z) - ) { - return PathType.AbsoluteWin; - } - } - return PathType.Normal; - } - } - const c0 = p.charCodeAt(0); - switch (c0) { - case CHAR_DOT: { - const c1 = p.charCodeAt(1); - switch (c1) { - case CHAR_SLASH: - return PathType.Relative; - case CHAR_DOT: { - const c2 = p.charCodeAt(2); - if (c2 === CHAR_SLASH) return PathType.Relative; - return PathType.Normal; - } - } - return PathType.Normal; - } - case CHAR_SLASH: - return PathType.AbsolutePosix; - case CHAR_HASH: - return PathType.Internal; - } - const c1 = p.charCodeAt(1); - if (c1 === CHAR_COLON) { - const c2 = p.charCodeAt(2); - if ( - (c2 === CHAR_BACKSLASH || c2 === CHAR_SLASH) && - ((c0 >= CHAR_A && c0 <= CHAR_Z) || - (c0 >= CHAR_LOWER_A && c0 <= CHAR_LOWER_Z)) - ) { - return PathType.AbsoluteWin; - } - } - return PathType.Normal; -}; -exports.getType = getType; + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); -/** - * @param {string} p a path - * @returns {string} the normalized path - */ -const normalize = p => { - switch (getType(p)) { - case PathType.Empty: - return p; - case PathType.AbsoluteWin: - return winNormalize(p); - case PathType.Relative: { - const r = posixNormalize(p); - return getType(r) === PathType.Relative ? r : `./${r}`; - } - } - return posixNormalize(p); -}; -exports.normalize = normalize; + return tree; + } -/** - * @param {string} rootPath the root path - * @param {string | undefined} request the request path - * @returns {string} the joined path - */ -const join = (rootPath, request) => { - if (!request) return normalize(rootPath); - const requestType = getType(request); - switch (requestType) { - case PathType.AbsolutePosix: - return posixNormalize(request); - case PathType.AbsoluteWin: - return winNormalize(request); - } - switch (getType(rootPath)) { - case PathType.Normal: - case PathType.Relative: - case PathType.AbsolutePosix: - return posixNormalize(`${rootPath}/${request}`); - case PathType.AbsoluteWin: - return winNormalize(`${rootPath}\\${request}`); - } - switch (requestType) { - case PathType.Empty: - return rootPath; - case PathType.Relative: { - const r = posixNormalize(rootPath); - return getType(r) === PathType.Relative ? r : `./${r}`; - } - } - return posixNormalize(rootPath); -}; -exports.join = join; + exports.version = (__webpack_require__(15535)/* .version */ .i8); + exports.Syntax = Syntax; + exports.traverse = traverse; + exports.replace = replace; + exports.attachComments = attachComments; + exports.VisitorKeys = VisitorKeys; + exports.VisitorOption = VisitorOption; + exports.Controller = Controller; + exports.cloneEnvironment = function () { return clone({}); }; -const joinCache = new Map(); + return exports; +}(exports)); +/* vim: set sw=4 ts=4 et tw=80 : */ -/** - * @param {string} rootPath the root path - * @param {string | undefined} request the request path - * @returns {string} the joined path - */ -const cachedJoin = (rootPath, request) => { - let cacheEntry; - let cache = joinCache.get(rootPath); - if (cache === undefined) { - joinCache.set(rootPath, (cache = new Map())); - } else { - cacheEntry = cache.get(request); - if (cacheEntry !== undefined) return cacheEntry; - } - cacheEntry = join(rootPath, request); - cache.set(request, cacheEntry); - return cacheEntry; -}; -exports.cachedJoin = cachedJoin; -const checkExportsFieldTarget = relativePath => { - let lastNonSlashIndex = 2; - let slashIndex = relativePath.indexOf("/", 2); - let cd = 0; +/***/ }), - while (slashIndex !== -1) { - const folder = relativePath.slice(lastNonSlashIndex, slashIndex); +/***/ 86140: +/***/ (function(module) { - switch (folder) { - case "..": { - cd--; - if (cd < 0) - return new Error( - `Trying to access out of package scope. Requesting ${relativePath}` - ); - break; - } - default: - cd++; - break; - } +module.exports = function (glob, opts) { + if (typeof glob !== 'string') { + throw new TypeError('Expected a string'); + } - lastNonSlashIndex = slashIndex + 1; - slashIndex = relativePath.indexOf("/", lastNonSlashIndex); - } -}; -exports.checkExportsFieldTarget = checkExportsFieldTarget; + var str = String(glob); + // The regexp we are building, as a string. + var reStr = ""; -/***/ }), + // Whether we are matching so called "extended" globs (like bash) and should + // support single character matching, matching ranges of characters, group + // matching, etc. + var extended = opts ? !!opts.extended : false; -/***/ 70665: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // When globstar is _false_ (default), '/foo/*' is translated a regexp like + // '^\/foo\/.*$' which will match any string beginning with '/foo/' + // When globstar is _true_, '/foo/*' is translated to regexp like + // '^\/foo\/[^/]*$' which will match any string beginning with '/foo/' BUT + // which does not have a '/' to the right of it. + // E.g. with '/foo/*' these will match: '/foo/bar', '/foo/bar.txt' but + // these will not '/foo/bar/baz', '/foo/bar/baz.txt' + // Lastely, when globstar is _true_, '/foo/**' is equivelant to '/foo/*' when + // globstar is _false_ + var globstar = opts ? !!opts.globstar : false; -"use strict"; -/* - Copyright (C) 2015 Yusuke Suzuki + // If we are doing extended matching, this boolean is true when we are inside + // a group (eg {*.html,*.js}), and false otherwise. + var inGroup = false; - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + // RegExp flags (eg "i" ) to pass in to RegExp constructor. + var flags = opts && typeof( opts.flags ) === "string" ? opts.flags : ""; - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + var c; + for (var i = 0, len = str.length; i < len; i++) { + c = str[i]; - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ + switch (c) { + case "/": + case "$": + case "^": + case "+": + case ".": + case "(": + case ")": + case "=": + case "!": + case "|": + reStr += "\\" + c; + break; + case "?": + if (extended) { + reStr += "."; + break; + } -const Variable = __webpack_require__(82971); + case "[": + case "]": + if (extended) { + reStr += c; + break; + } -/** - * @class Definition - */ -class Definition { - constructor(type, name, node, parent, index, kind) { + case "{": + if (extended) { + inGroup = true; + reStr += "("; + break; + } - /** - * @member {String} Definition#type - type of the occurrence (e.g. "Parameter", "Variable", ...). - */ - this.type = type; + case "}": + if (extended) { + inGroup = false; + reStr += ")"; + break; + } - /** - * @member {espree.Identifier} Definition#name - the identifier AST node of the occurrence. - */ - this.name = name; + case ",": + if (inGroup) { + reStr += "|"; + break; + } + reStr += "\\" + c; + break; - /** - * @member {espree.Node} Definition#node - the enclosing node of the identifier. - */ - this.node = node; + case "*": + // Move over all consecutive "*"'s. + // Also store the previous and next characters + var prevChar = str[i - 1]; + var starCount = 1; + while(str[i + 1] === "*") { + starCount++; + i++; + } + var nextChar = str[i + 1]; - /** - * @member {espree.Node?} Definition#parent - the enclosing statement node of the identifier. - */ - this.parent = parent; + if (!globstar) { + // globstar is disabled, so treat any number of "*" as one + reStr += ".*"; + } else { + // globstar is enabled, so determine if this is a globstar segment + var isGlobstar = starCount > 1 // multiple "*"'s + && (prevChar === "/" || prevChar === undefined) // from the start of the segment + && (nextChar === "/" || nextChar === undefined) // to the end of the segment - /** - * @member {Number?} Definition#index - the index in the declaration statement. - */ - this.index = index; + if (isGlobstar) { + // it's a globstar, so match zero or more path segments + reStr += "((?:[^/]*(?:\/|$))*)"; + i++; // move over the "/" + } else { + // it's not a globstar, so only match one path segment + reStr += "([^/]*)"; + } + } + break; - /** - * @member {String?} Definition#kind - the kind of the declaration statement. - */ - this.kind = kind; + default: + reStr += c; } -} - -/** - * @class ParameterDefinition - */ -class ParameterDefinition extends Definition { - constructor(name, node, index, rest) { - super(Variable.Parameter, name, node, null, index, null); + } - /** - * Whether the parameter definition is a part of a rest parameter. - * @member {boolean} ParameterDefinition#rest - */ - this.rest = rest; - } -} + // When regexp 'g' flag is specified don't + // constrain the regular expression with ^ & $ + if (!flags || !~flags.indexOf('g')) { + reStr = "^" + reStr + "$"; + } -module.exports = { - ParameterDefinition, - Definition + return new RegExp(reStr, flags); }; -/* vim: set sw=4 ts=4 et tw=80 : */ - /***/ }), -/***/ 36007: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 89132: +/***/ (function(module) { "use strict"; -/* - Copyright (C) 2012-2014 Yusuke Suzuki - Copyright (C) 2013 Alex Seville - Copyright (C) 2014 Thiago de Arruda - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. +module.exports = clone - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ +var getPrototypeOf = Object.getPrototypeOf || function (obj) { + return obj.__proto__ +} -/** - * Escope (escope) is an ECMAScript - * scope analyzer extracted from the esmangle project. - *

- * escope finds lexical scopes in a source program, i.e. areas of that - * program where different occurrences of the same identifier refer to the same - * variable. With each scope the contained variables are collected, and each - * identifier reference in code is linked to its corresponding variable (if - * possible). - *

- * escope works on a syntax tree of the parsed source code which has - * to adhere to the - * Mozilla Parser API. E.g. espree is a parser - * that produces such syntax trees. - *

- * The main interface is the {@link analyze} function. - * @module escope - */ +function clone (obj) { + if (obj === null || typeof obj !== 'object') + return obj + if (obj instanceof Object) + var copy = { __proto__: getPrototypeOf(obj) } + else + var copy = Object.create(null) -/* eslint no-underscore-dangle: ["error", { "allow": ["__currentScope"] }] */ + Object.getOwnPropertyNames(obj).forEach(function (key) { + Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) + }) -const assert = __webpack_require__(39491); + return copy +} -const ScopeManager = __webpack_require__(96988); -const Referencer = __webpack_require__(44585); -const Reference = __webpack_require__(64945); -const Variable = __webpack_require__(82971); -const Scope = (__webpack_require__(16313).Scope); -const version = (__webpack_require__(30290)/* .version */ .i8); -/** - * Set the default options - * @returns {Object} options - */ -function defaultOptions() { - return { - optimistic: false, - directive: false, - nodejsScope: false, - impliedStrict: false, - sourceType: "script", // one of ['script', 'module'] - ecmaVersion: 5, - childVisitorKeys: null, - fallback: "iteration" - }; -} +/***/ }), -/** - * Preform deep update on option object - * @param {Object} target - Options - * @param {Object} override - Updates - * @returns {Object} Updated options - */ -function updateDeeply(target, override) { +/***/ 90552: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * Is hash object - * @param {Object} value - Test value - * @returns {boolean} Result - */ - function isHashObject(value) { - return typeof value === "object" && value instanceof Object && !(value instanceof Array) && !(value instanceof RegExp); - } - - for (const key in override) { - if (Object.prototype.hasOwnProperty.call(override, key)) { - const val = override[key]; - - if (isHashObject(val)) { - if (isHashObject(target[key])) { - updateDeeply(target[key], val); - } else { - target[key] = updateDeeply({}, val); - } - } else { - target[key] = val; - } - } - } - return target; -} - -/** - * Main interface function. Takes an Espree syntax tree and returns the - * analyzed scopes. - * @function analyze - * @param {espree.Tree} tree - Abstract Syntax Tree - * @param {Object} providedOptions - Options that tailor the scope analysis - * @param {boolean} [providedOptions.optimistic=false] - the optimistic flag - * @param {boolean} [providedOptions.directive=false]- the directive flag - * @param {boolean} [providedOptions.ignoreEval=false]- whether to check 'eval()' calls - * @param {boolean} [providedOptions.nodejsScope=false]- whether the whole - * script is executed under node.js environment. When enabled, escope adds - * a function scope immediately following the global scope. - * @param {boolean} [providedOptions.impliedStrict=false]- implied strict mode - * (if ecmaVersion >= 5). - * @param {string} [providedOptions.sourceType='script']- the source type of the script. one of 'script' and 'module' - * @param {number} [providedOptions.ecmaVersion=5]- which ECMAScript version is considered - * @param {Object} [providedOptions.childVisitorKeys=null] - Additional known visitor keys. See [esrecurse](https://github.com/estools/esrecurse)'s the `childVisitorKeys` option. - * @param {string} [providedOptions.fallback='iteration'] - A kind of the fallback in order to encounter with unknown node. See [esrecurse](https://github.com/estools/esrecurse)'s the `fallback` option. - * @returns {ScopeManager} ScopeManager - */ -function analyze(tree, providedOptions) { - const options = updateDeeply(defaultOptions(), providedOptions); - const scopeManager = new ScopeManager(options); - const referencer = new Referencer(options, scopeManager); +var fs = __webpack_require__(57147) +var polyfills = __webpack_require__(11290) +var legacy = __webpack_require__(54410) +var clone = __webpack_require__(89132) - referencer.visit(tree); +var util = __webpack_require__(73837) - assert(scopeManager.__currentScope === null, "currentScope should be null."); +/* istanbul ignore next - node 0.x polyfill */ +var gracefulQueue +var previousSymbol - return scopeManager; +/* istanbul ignore else - node 0.x polyfill */ +if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { + gracefulQueue = Symbol.for('graceful-fs.queue') + // This is used in testing by future versions + previousSymbol = Symbol.for('graceful-fs.previous') +} else { + gracefulQueue = '___graceful-fs.queue' + previousSymbol = '___graceful-fs.previous' } -module.exports = { - - /** @name module:escope.version */ - version, - - /** @name module:escope.Reference */ - Reference, - - /** @name module:escope.Variable */ - Variable, - - /** @name module:escope.Scope */ - Scope, - - /** @name module:escope.ScopeManager */ - ScopeManager, - analyze -}; +function noop () {} +function publishQueue(context, queue) { + Object.defineProperty(context, gracefulQueue, { + get: function() { + return queue + } + }) +} -/* vim: set sw=4 ts=4 et tw=80 : */ +var debug = noop +if (util.debuglog) + debug = util.debuglog('gfs4') +else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) + debug = function() { + var m = util.format.apply(util, arguments) + m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') + console.error(m) + } +// Once time initialization +if (!fs[gracefulQueue]) { + // This queue can be shared by multiple loaded instances + var queue = global[gracefulQueue] || [] + publishQueue(fs, queue) -/***/ }), + // Patch fs.close/closeSync to shared queue version, because we need + // to retry() whenever a close happens *anywhere* in the program. + // This is essential when multiple graceful-fs instances are + // in play at the same time. + fs.close = (function (fs$close) { + function close (fd, cb) { + return fs$close.call(fs, fd, function (err) { + // This function uses the graceful-fs shared queue + if (!err) { + resetQueue() + } -/***/ 54162: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (typeof cb === 'function') + cb.apply(this, arguments) + }) + } -"use strict"; -/* - Copyright (C) 2015 Yusuke Suzuki + Object.defineProperty(close, previousSymbol, { + value: fs$close + }) + return close + })(fs.close) - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + fs.closeSync = (function (fs$closeSync) { + function closeSync (fd) { + // This function uses the graceful-fs shared queue + fs$closeSync.apply(fs, arguments) + resetQueue() + } - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + Object.defineProperty(closeSync, previousSymbol, { + value: fs$closeSync + }) + return closeSync + })(fs.closeSync) - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ + if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { + process.on('exit', function() { + debug(fs[gracefulQueue]) + __webpack_require__(39491).equal(fs[gracefulQueue].length, 0) + }) + } +} +if (!global[gracefulQueue]) { + publishQueue(global, fs[gracefulQueue]); +} -/* eslint-disable no-undefined */ +module.exports = patch(clone(fs)) +if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { + module.exports = patch(fs) + fs.__patched = true; +} -const Syntax = (__webpack_require__(18350).Syntax); -const esrecurse = __webpack_require__(81217); +function patch (fs) { + // Everything that references the open() function needs to be in here + polyfills(fs) + fs.gracefulify = patch -/** - * Get last array element - * @param {array} xs - array - * @returns {any} Last elment - */ -function getLast(xs) { - return xs[xs.length - 1] || null; -} + fs.createReadStream = createReadStream + fs.createWriteStream = createWriteStream + var fs$readFile = fs.readFile + fs.readFile = readFile + function readFile (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null -class PatternVisitor extends esrecurse.Visitor { - static isPattern(node) { - const nodeType = node.type; + return go$readFile(path, options, cb) - return ( - nodeType === Syntax.Identifier || - nodeType === Syntax.ObjectPattern || - nodeType === Syntax.ArrayPattern || - nodeType === Syntax.SpreadElement || - nodeType === Syntax.RestElement || - nodeType === Syntax.AssignmentPattern - ); + function go$readFile (path, options, cb, startTime) { + return fs$readFile(path, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) } + } - constructor(options, rootPattern, callback) { - super(null, options); - this.rootPattern = rootPattern; - this.callback = callback; - this.assignments = []; - this.rightHandNodes = []; - this.restElements = []; - } + var fs$writeFile = fs.writeFile + fs.writeFile = writeFile + function writeFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null - Identifier(pattern) { - const lastRestElement = getLast(this.restElements); + return go$writeFile(path, data, options, cb) - this.callback(pattern, { - topLevel: pattern === this.rootPattern, - rest: lastRestElement !== null && lastRestElement !== undefined && lastRestElement.argument === pattern, - assignments: this.assignments - }); + function go$writeFile (path, data, options, cb, startTime) { + return fs$writeFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) } + } - Property(property) { + var fs$appendFile = fs.appendFile + if (fs$appendFile) + fs.appendFile = appendFile + function appendFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null - // Computed property's key is a right hand node. - if (property.computed) { - this.rightHandNodes.push(property.key); - } + return go$appendFile(path, data, options, cb) - // If it's shorthand, its key is same as its value. - // If it's shorthand and has its default value, its key is same as its value.left (the value is AssignmentPattern). - // If it's not shorthand, the name of new variable is its value's. - this.visit(property.value); + function go$appendFile (path, data, options, cb, startTime) { + return fs$appendFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) } + } - ArrayPattern(pattern) { - for (let i = 0, iz = pattern.elements.length; i < iz; ++i) { - const element = pattern.elements[i]; + var fs$copyFile = fs.copyFile + if (fs$copyFile) + fs.copyFile = copyFile + function copyFile (src, dest, flags, cb) { + if (typeof flags === 'function') { + cb = flags + flags = 0 + } + return go$copyFile(src, dest, flags, cb) - this.visit(element); + function go$copyFile (src, dest, flags, cb, startTime) { + return fs$copyFile(src, dest, flags, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) } + }) } + } - AssignmentPattern(pattern) { - this.assignments.push(pattern); - this.visit(pattern.left); - this.rightHandNodes.push(pattern.right); - this.assignments.pop(); - } + var fs$readdir = fs.readdir + fs.readdir = readdir + function readdir (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null - RestElement(pattern) { - this.restElements.push(pattern); - this.visit(pattern.argument); - this.restElements.pop(); - } + return go$readdir(path, options, cb) - MemberExpression(node) { + function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, options, function (err, files) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readdir, [path, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (files && files.sort) + files.sort() - // Computed property's key is a right hand node. - if (node.computed) { - this.rightHandNodes.push(node.property); + if (typeof cb === 'function') + cb.call(this, err, files) } - - // the object is only read, write to its property. - this.rightHandNodes.push(node.object); + }) } + } - // - // ForInStatement.left and AssignmentExpression.left are LeftHandSideExpression. - // By spec, LeftHandSideExpression is Pattern or MemberExpression. - // (see also: https://github.com/estree/estree/pull/20#issuecomment-74584758) - // But espree 2.0 parses to ArrayExpression, ObjectExpression, etc... - // + if (process.version.substr(0, 4) === 'v0.8') { + var legStreams = legacy(fs) + ReadStream = legStreams.ReadStream + WriteStream = legStreams.WriteStream + } - SpreadElement(node) { - this.visit(node.argument); - } + var fs$ReadStream = fs.ReadStream + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype) + ReadStream.prototype.open = ReadStream$open + } - ArrayExpression(node) { - node.elements.forEach(this.visit, this); - } + var fs$WriteStream = fs.WriteStream + if (fs$WriteStream) { + WriteStream.prototype = Object.create(fs$WriteStream.prototype) + WriteStream.prototype.open = WriteStream$open + } - AssignmentExpression(node) { - this.assignments.push(node); - this.visit(node.left); - this.rightHandNodes.push(node.right); - this.assignments.pop(); - } + Object.defineProperty(fs, 'ReadStream', { + get: function () { + return ReadStream + }, + set: function (val) { + ReadStream = val + }, + enumerable: true, + configurable: true + }) + Object.defineProperty(fs, 'WriteStream', { + get: function () { + return WriteStream + }, + set: function (val) { + WriteStream = val + }, + enumerable: true, + configurable: true + }) - CallExpression(node) { + // legacy names + var FileReadStream = ReadStream + Object.defineProperty(fs, 'FileReadStream', { + get: function () { + return FileReadStream + }, + set: function (val) { + FileReadStream = val + }, + enumerable: true, + configurable: true + }) + var FileWriteStream = WriteStream + Object.defineProperty(fs, 'FileWriteStream', { + get: function () { + return FileWriteStream + }, + set: function (val) { + FileWriteStream = val + }, + enumerable: true, + configurable: true + }) - // arguments are right hand nodes. - node.arguments.forEach(a => { - this.rightHandNodes.push(a); - }); - this.visit(node.callee); - } -} + function ReadStream (path, options) { + if (this instanceof ReadStream) + return fs$ReadStream.apply(this, arguments), this + else + return ReadStream.apply(Object.create(ReadStream.prototype), arguments) + } -module.exports = PatternVisitor; + function ReadStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + if (that.autoClose) + that.destroy() -/* vim: set sw=4 ts=4 et tw=80 : */ + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + that.read() + } + }) + } + function WriteStream (path, options) { + if (this instanceof WriteStream) + return fs$WriteStream.apply(this, arguments), this + else + return WriteStream.apply(Object.create(WriteStream.prototype), arguments) + } -/***/ }), + function WriteStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + that.destroy() + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + } + }) + } -/***/ 64945: -/***/ (function(module) { + function createReadStream (path, options) { + return new fs.ReadStream(path, options) + } -"use strict"; -/* - Copyright (C) 2015 Yusuke Suzuki + function createWriteStream (path, options) { + return new fs.WriteStream(path, options) + } - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + var fs$open = fs.open + fs.open = open + function open (path, flags, mode, cb) { + if (typeof mode === 'function') + cb = mode, mode = null - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + return go$open(path, flags, mode, cb) - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ + function go$open (path, flags, mode, cb, startTime) { + return fs$open(path, flags, mode, function (err, fd) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + return fs +} -const READ = 0x1; -const WRITE = 0x2; -const RW = READ | WRITE; - -/** - * A Reference represents a single occurrence of an identifier in code. - * @class Reference - */ -class Reference { - constructor(ident, scope, flag, writeExpr, maybeImplicitGlobal, partial, init) { - - /** - * Identifier syntax node. - * @member {espreeIdentifier} Reference#identifier - */ - this.identifier = ident; - - /** - * Reference to the enclosing Scope. - * @member {Scope} Reference#from - */ - this.from = scope; - - /** - * Whether the reference comes from a dynamic scope (such as 'eval', - * 'with', etc.), and may be trapped by dynamic scopes. - * @member {boolean} Reference#tainted - */ - this.tainted = false; - - /** - * The variable this reference is resolved with. - * @member {Variable} Reference#resolved - */ - this.resolved = null; - - /** - * The read-write mode of the reference. (Value is one of {@link - * Reference.READ}, {@link Reference.RW}, {@link Reference.WRITE}). - * @member {number} Reference#flag - * @private - */ - this.flag = flag; - if (this.isWrite()) { - - /** - * If reference is writeable, this is the tree being written to it. - * @member {espreeNode} Reference#writeExpr - */ - this.writeExpr = writeExpr; - - /** - * Whether the Reference might refer to a partial value of writeExpr. - * @member {boolean} Reference#partial - */ - this.partial = partial; +function enqueue (elem) { + debug('ENQUEUE', elem[0].name, elem[1]) + fs[gracefulQueue].push(elem) + retry() +} - /** - * Whether the Reference is to write of initialization. - * @member {boolean} Reference#init - */ - this.init = init; - } - this.__maybeImplicitGlobal = maybeImplicitGlobal; - } +// keep track of the timeout between retry() calls +var retryTimer - /** - * Whether the reference is static. - * @method Reference#isStatic - * @returns {boolean} static - */ - isStatic() { - return !this.tainted && this.resolved && this.resolved.scope.isStatic(); +// reset the startTime and lastTime to now +// this resets the start of the 60 second overall timeout as well as the +// delay between attempts so that we'll retry these jobs sooner +function resetQueue () { + var now = Date.now() + for (var i = 0; i < fs[gracefulQueue].length; ++i) { + // entries that are only a length of 2 are from an older version, don't + // bother modifying those since they'll be retried anyway. + if (fs[gracefulQueue][i].length > 2) { + fs[gracefulQueue][i][3] = now // startTime + fs[gracefulQueue][i][4] = now // lastTime } + } + // call retry to make sure we're actively processing the queue + retry() +} - /** - * Whether the reference is writeable. - * @method Reference#isWrite - * @returns {boolean} write - */ - isWrite() { - return !!(this.flag & Reference.WRITE); - } +function retry () { + // clear the timer and remove it to help prevent unintended concurrency + clearTimeout(retryTimer) + retryTimer = undefined - /** - * Whether the reference is readable. - * @method Reference#isRead - * @returns {boolean} read - */ - isRead() { - return !!(this.flag & Reference.READ); - } + if (fs[gracefulQueue].length === 0) + return - /** - * Whether the reference is read-only. - * @method Reference#isReadOnly - * @returns {boolean} read only - */ - isReadOnly() { - return this.flag === Reference.READ; - } + var elem = fs[gracefulQueue].shift() + var fn = elem[0] + var args = elem[1] + // these items may be unset if they were added by an older graceful-fs + var err = elem[2] + var startTime = elem[3] + var lastTime = elem[4] - /** - * Whether the reference is write-only. - * @method Reference#isWriteOnly - * @returns {boolean} write only - */ - isWriteOnly() { - return this.flag === Reference.WRITE; + // if we don't have a startTime we have no way of knowing if we've waited + // long enough, so go ahead and retry this item now + if (startTime === undefined) { + debug('RETRY', fn.name, args) + fn.apply(null, args) + } else if (Date.now() - startTime >= 60000) { + // it's been more than 60 seconds total, bail now + debug('TIMEOUT', fn.name, args) + var cb = args.pop() + if (typeof cb === 'function') + cb.call(null, err) + } else { + // the amount of time between the last attempt and right now + var sinceAttempt = Date.now() - lastTime + // the amount of time between when we first tried, and when we last tried + // rounded up to at least 1 + var sinceStart = Math.max(lastTime - startTime, 1) + // backoff. wait longer than the total time we've been retrying, but only + // up to a maximum of 100ms + var desiredDelay = Math.min(sinceStart * 1.2, 100) + // it's been long enough since the last retry, do it again + if (sinceAttempt >= desiredDelay) { + debug('RETRY', fn.name, args) + fn.apply(null, args.concat([startTime])) + } else { + // if we can't do this job yet, push it to the end of the queue + // and let the next iteration check again + fs[gracefulQueue].push(elem) } + } - /** - * Whether the reference is read-write. - * @method Reference#isReadWrite - * @returns {boolean} read write - */ - isReadWrite() { - return this.flag === Reference.RW; - } + // schedule our next run if one isn't already scheduled + if (retryTimer === undefined) { + retryTimer = setTimeout(retry, 0) + } } -/** - * @constant Reference.READ - * @private - */ -Reference.READ = READ; -/** - * @constant Reference.WRITE - * @private - */ -Reference.WRITE = WRITE; +/***/ }), -/** - * @constant Reference.RW - * @private - */ -Reference.RW = RW; +/***/ 54410: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = Reference; +var Stream = (__webpack_require__(12781).Stream) -/* vim: set sw=4 ts=4 et tw=80 : */ +module.exports = legacy +function legacy (fs) { + return { + ReadStream: ReadStream, + WriteStream: WriteStream + } -/***/ }), + function ReadStream (path, options) { + if (!(this instanceof ReadStream)) return new ReadStream(path, options); -/***/ 44585: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + Stream.call(this); -"use strict"; -/* - Copyright (C) 2015 Yusuke Suzuki + var self = this; - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + this.path = path; + this.fd = null; + this.readable = true; + this.paused = false; - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + this.flags = 'r'; + this.mode = 438; /*=0666*/ + this.bufferSize = 64 * 1024; - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ + options = options || {}; + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } -/* eslint-disable no-underscore-dangle */ -/* eslint-disable no-undefined */ + if (this.encoding) this.setEncoding(this.encoding); -const Syntax = (__webpack_require__(18350).Syntax); -const esrecurse = __webpack_require__(81217); -const Reference = __webpack_require__(64945); -const Variable = __webpack_require__(82971); -const PatternVisitor = __webpack_require__(54162); -const definition = __webpack_require__(70665); -const assert = __webpack_require__(39491); + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.end === undefined) { + this.end = Infinity; + } else if ('number' !== typeof this.end) { + throw TypeError('end must be a Number'); + } -const ParameterDefinition = definition.ParameterDefinition; -const Definition = definition.Definition; + if (this.start > this.end) { + throw new Error('start must be <= end'); + } -/** - * Traverse identifier in pattern - * @param {Object} options - options - * @param {pattern} rootPattern - root pattern - * @param {Refencer} referencer - referencer - * @param {callback} callback - callback - * @returns {void} - */ -function traverseIdentifierInPattern(options, rootPattern, referencer, callback) { + this.pos = this.start; + } - // Call the callback at left hand identifier nodes, and Collect right hand nodes. - const visitor = new PatternVisitor(options, rootPattern, callback); + if (this.fd !== null) { + process.nextTick(function() { + self._read(); + }); + return; + } - visitor.visit(rootPattern); + fs.open(this.path, this.flags, this.mode, function (err, fd) { + if (err) { + self.emit('error', err); + self.readable = false; + return; + } - // Process the right hand nodes recursively. - if (referencer !== null && referencer !== undefined) { - visitor.rightHandNodes.forEach(referencer.visit, referencer); - } -} + self.fd = fd; + self.emit('open', fd); + self._read(); + }) + } -// Importing ImportDeclaration. -// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-moduledeclarationinstantiation -// https://github.com/estree/estree/blob/master/es6.md#importdeclaration -// FIXME: Now, we don't create module environment, because the context is -// implementation dependent. + function WriteStream (path, options) { + if (!(this instanceof WriteStream)) return new WriteStream(path, options); -class Importer extends esrecurse.Visitor { - constructor(declaration, referencer) { - super(null, referencer.options); - this.declaration = declaration; - this.referencer = referencer; - } + Stream.call(this); - visitImport(id, specifier) { - this.referencer.visitPattern(id, pattern => { - this.referencer.currentScope().__define(pattern, - new Definition( - Variable.ImportBinding, - pattern, - specifier, - this.declaration, - null, - null - )); - }); - } + this.path = path; + this.fd = null; + this.writable = true; - ImportNamespaceSpecifier(node) { - const local = (node.local || node.id); + this.flags = 'w'; + this.encoding = 'binary'; + this.mode = 438; /*=0666*/ + this.bytesWritten = 0; - if (local) { - this.visitImport(local, node); - } + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; } - ImportDefaultSpecifier(node) { - const local = (node.local || node.id); + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.start < 0) { + throw new Error('start must be >= zero'); + } - this.visitImport(local, node); + this.pos = this.start; } - ImportSpecifier(node) { - const local = (node.local || node.id); + this.busy = false; + this._queue = []; - if (node.name) { - this.visitImport(node.name, node); - } else { - this.visitImport(local, node); - } + if (this.fd === null) { + this._open = fs.open; + this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); + this.flush(); } + } } -// Referencing variables and creating bindings. -class Referencer extends esrecurse.Visitor { - constructor(options, scopeManager) { - super(null, options); - this.options = options; - this.scopeManager = scopeManager; - this.parent = null; - this.isInnerMethodDefinition = false; - } - currentScope() { - return this.scopeManager.__currentScope; - } +/***/ }), - close(node) { - while (this.currentScope() && node === this.currentScope().block) { - this.scopeManager.__currentScope = this.currentScope().__close(this.scopeManager); - } - } +/***/ 11290: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - pushInnerMethodDefinition(isInnerMethodDefinition) { - const previous = this.isInnerMethodDefinition; +var constants = __webpack_require__(22057) - this.isInnerMethodDefinition = isInnerMethodDefinition; - return previous; - } +var origCwd = process.cwd +var cwd = null - popInnerMethodDefinition(isInnerMethodDefinition) { - this.isInnerMethodDefinition = isInnerMethodDefinition; - } +var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform - referencingDefaultValue(pattern, assignments, maybeImplicitGlobal, init) { - const scope = this.currentScope(); +process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process) + return cwd +} +try { + process.cwd() +} catch (er) {} - assignments.forEach(assignment => { - scope.__referencing( - pattern, - Reference.WRITE, - assignment.right, - maybeImplicitGlobal, - pattern !== assignment.left, - init - ); - }); - } +// This check is needed until node.js 12 is required +if (typeof process.chdir === 'function') { + var chdir = process.chdir + process.chdir = function (d) { + cwd = null + chdir.call(process, d) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) +} - visitPattern(node, options, callback) { - let visitPatternOptions = options; - let visitPatternCallback = callback; +module.exports = patch - if (typeof options === "function") { - visitPatternCallback = options; - visitPatternOptions = { processRightHandNodes: false }; - } +function patch (fs) { + // (re-)implement some things that are known busted or missing. - traverseIdentifierInPattern( - this.options, - node, - visitPatternOptions.processRightHandNodes ? this : null, - visitPatternCallback - ); - } + // lchmod, broken prior to 0.6.2 + // back-port the fix here. + if (constants.hasOwnProperty('O_SYMLINK') && + process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs) + } - visitFunction(node) { - let i, iz; + // lutimes implementation, or no-op + if (!fs.lutimes) { + patchLutimes(fs) + } - // FunctionDeclaration name is defined in upper scope - // NOTE: Not referring variableScope. It is intended. - // Since - // in ES5, FunctionDeclaration should be in FunctionBody. - // in ES6, FunctionDeclaration should be block scoped. + // https://github.com/isaacs/node-graceful-fs/issues/4 + // Chown should not fail on einval or eperm if non-root. + // It should not fail on enosys ever, as this just indicates + // that a fs doesn't support the intended operation. - if (node.type === Syntax.FunctionDeclaration) { + fs.chown = chownFix(fs.chown) + fs.fchown = chownFix(fs.fchown) + fs.lchown = chownFix(fs.lchown) - // id is defined in upper scope - this.currentScope().__define(node.id, - new Definition( - Variable.FunctionName, - node.id, - node, - null, - null, - null - )); - } + fs.chmod = chmodFix(fs.chmod) + fs.fchmod = chmodFix(fs.fchmod) + fs.lchmod = chmodFix(fs.lchmod) - // FunctionExpression with name creates its special scope; - // FunctionExpressionNameScope. - if (node.type === Syntax.FunctionExpression && node.id) { - this.scopeManager.__nestFunctionExpressionNameScope(node); - } + fs.chownSync = chownFixSync(fs.chownSync) + fs.fchownSync = chownFixSync(fs.fchownSync) + fs.lchownSync = chownFixSync(fs.lchownSync) - // Consider this function is in the MethodDefinition. - this.scopeManager.__nestFunctionScope(node, this.isInnerMethodDefinition); + fs.chmodSync = chmodFixSync(fs.chmodSync) + fs.fchmodSync = chmodFixSync(fs.fchmodSync) + fs.lchmodSync = chmodFixSync(fs.lchmodSync) - const that = this; + fs.stat = statFix(fs.stat) + fs.fstat = statFix(fs.fstat) + fs.lstat = statFix(fs.lstat) - /** - * Visit pattern callback - * @param {pattern} pattern - pattern - * @param {Object} info - info - * @returns {void} - */ - function visitPatternCallback(pattern, info) { - that.currentScope().__define(pattern, - new ParameterDefinition( - pattern, - node, - i, - info.rest - )); + fs.statSync = statFixSync(fs.statSync) + fs.fstatSync = statFixSync(fs.fstatSync) + fs.lstatSync = statFixSync(fs.lstatSync) - that.referencingDefaultValue(pattern, info.assignments, null, true); - } + // if lchmod/lchown do not exist, then make them no-ops + if (!fs.lchmod) { + fs.lchmod = function (path, mode, cb) { + if (cb) process.nextTick(cb) + } + fs.lchmodSync = function () {} + } + if (!fs.lchown) { + fs.lchown = function (path, uid, gid, cb) { + if (cb) process.nextTick(cb) + } + fs.lchownSync = function () {} + } - // Process parameter declarations. - for (i = 0, iz = node.params.length; i < iz; ++i) { - this.visitPattern(node.params[i], { processRightHandNodes: true }, visitPatternCallback); - } + // on Windows, A/V software can lock the directory, causing this + // to fail with an EACCES or EPERM if the directory contains newly + // created files. Try again on failure, for up to 60 seconds. - // if there's a rest argument, add that - if (node.rest) { - this.visitPattern({ - type: "RestElement", - argument: node.rest - }, pattern => { - this.currentScope().__define(pattern, - new ParameterDefinition( - pattern, - node, - node.params.length, - true - )); - }); + // Set the timeout this long because some Windows Anti-Virus, such as Parity + // bit9, may lock files for up to a minute, causing npm package install + // failures. Also, take care to yield the scheduler. Windows scheduling gives + // CPU to a busy looping process, which can cause the program causing the lock + // contention to be starved of CPU by node, so the contention doesn't resolve. + if (platform === "win32") { + fs.rename = (function (fs$rename) { return function (from, to, cb) { + var start = Date.now() + var backoff = 0; + fs$rename(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM") + && Date.now() - start < 60000) { + setTimeout(function() { + fs.stat(to, function (stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er) + }) + }, backoff) + if (backoff < 100) + backoff += 10; + return; } + if (cb) cb(er) + }) + }})(fs.rename) + } - // In TypeScript there are a number of function-like constructs which have no body, - // so check it exists before traversing - if (node.body) { - - // Skip BlockStatement to prevent creating BlockStatement scope. - if (node.body.type === Syntax.BlockStatement) { - this.visitChildren(node.body); - } else { - this.visit(node.body); - } + // if read() returns EAGAIN, then just try it again. + fs.read = (function (fs$read) { + function read (fd, buffer, offset, length, position, callback_) { + var callback + if (callback_ && typeof callback_ === 'function') { + var eagCounter = 0 + callback = function (er, _, __) { + if (er && er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + callback_.apply(this, arguments) } - - this.close(node); + } + return fs$read.call(fs, fd, buffer, offset, length, position, callback) } - visitClass(node) { - if (node.type === Syntax.ClassDeclaration) { - this.currentScope().__define(node.id, - new Definition( - Variable.ClassName, - node.id, - node, - null, - null, - null - )); - } - - this.visit(node.superClass); - - this.scopeManager.__nestClassScope(node); + // This ensures `util.promisify` works as it does for native `fs.read`. + if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) + return read + })(fs.read) - if (node.id) { - this.currentScope().__define(node.id, - new Definition( - Variable.ClassName, - node.id, - node - )); + fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { + var eagCounter = 0 + while (true) { + try { + return fs$readSync.call(fs, fd, buffer, offset, length, position) + } catch (er) { + if (er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + continue } - this.visit(node.body); - - this.close(node); + throw er + } } + }})(fs.readSync) - visitProperty(node) { - let previous; - - if (node.computed) { - this.visit(node.key); - } - - const isMethodDefinition = node.type === Syntax.MethodDefinition; - - if (isMethodDefinition) { - previous = this.pushInnerMethodDefinition(true); - } - this.visit(node.value); - if (isMethodDefinition) { - this.popInnerMethodDefinition(previous); + function patchLchmod (fs) { + fs.lchmod = function (path, mode, callback) { + fs.open( path + , constants.O_WRONLY | constants.O_SYMLINK + , mode + , function (err, fd) { + if (err) { + if (callback) callback(err) + return } + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + fs.fchmod(fd, mode, function (err) { + fs.close(fd, function(err2) { + if (callback) callback(err || err2) + }) + }) + }) } - visitForIn(node) { - if (node.left.type === Syntax.VariableDeclaration && node.left.kind !== "var") { - this.scopeManager.__nestForScope(node); - } + fs.lchmodSync = function (path, mode) { + var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) - if (node.left.type === Syntax.VariableDeclaration) { - this.visit(node.left); - this.visitPattern(node.left.declarations[0].id, pattern => { - this.currentScope().__referencing(pattern, Reference.WRITE, node.right, null, true, true); - }); + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + var threw = true + var ret + try { + ret = fs.fchmodSync(fd, mode) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} } else { - this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => { - let maybeImplicitGlobal = null; - - if (!this.currentScope().isStrict) { - maybeImplicitGlobal = { - pattern, - node - }; - } - this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false); - this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, true, false); - }); + fs.closeSync(fd) } - this.visit(node.right); - this.visit(node.body); - - this.close(node); + } + return ret } + } - visitVariableDeclaration(variableTargetScope, type, node, index) { - - const decl = node.declarations[index]; - const init = decl.init; + function patchLutimes (fs) { + if (constants.hasOwnProperty("O_SYMLINK")) { + fs.lutimes = function (path, at, mt, cb) { + fs.open(path, constants.O_SYMLINK, function (er, fd) { + if (er) { + if (cb) cb(er) + return + } + fs.futimes(fd, at, mt, function (er) { + fs.close(fd, function (er2) { + if (cb) cb(er || er2) + }) + }) + }) + } - this.visitPattern(decl.id, { processRightHandNodes: true }, (pattern, info) => { - variableTargetScope.__define( - pattern, - new Definition( - type, - pattern, - decl, - node, - index, - node.kind - ) - ); + fs.lutimesSync = function (path, at, mt) { + var fd = fs.openSync(path, constants.O_SYMLINK) + var ret + var threw = true + try { + ret = fs.futimesSync(fd, at, mt) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } - this.referencingDefaultValue(pattern, info.assignments, null, true); - if (init) { - this.currentScope().__referencing(pattern, Reference.WRITE, init, null, !info.topLevel, true); - } - }); + } else { + fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } + fs.lutimesSync = function () {} } + } - AssignmentExpression(node) { - if (PatternVisitor.isPattern(node.left)) { - if (node.operator === "=") { - this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => { - let maybeImplicitGlobal = null; - - if (!this.currentScope().isStrict) { - maybeImplicitGlobal = { - pattern, - node - }; - } - this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false); - this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, !info.topLevel, false); - }); - } else { - this.currentScope().__referencing(node.left, Reference.RW, node.right); - } - } else { - this.visit(node.left); - } - this.visit(node.right); + function chmodFix (orig) { + if (!orig) return orig + return function (target, mode, cb) { + return orig.call(fs, target, mode, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) } + } - CatchClause(node) { - this.scopeManager.__nestCatchScope(node); - - this.visitPattern(node.param, { processRightHandNodes: true }, (pattern, info) => { - this.currentScope().__define(pattern, - new Definition( - Variable.CatchClause, - node.param, - node, - null, - null, - null - )); - this.referencingDefaultValue(pattern, info.assignments, null, true); - }); - this.visit(node.body); - - this.close(node); + function chmodFixSync (orig) { + if (!orig) return orig + return function (target, mode) { + try { + return orig.call(fs, target, mode) + } catch (er) { + if (!chownErOk(er)) throw er + } } + } - Program(node) { - this.scopeManager.__nestGlobalScope(node); - - if (this.scopeManager.__isNodejsScope()) { - - // Force strictness of GlobalScope to false when using node.js scope. - this.currentScope().isStrict = false; - this.scopeManager.__nestFunctionScope(node, false); - } - - if (this.scopeManager.__isES6() && this.scopeManager.isModule()) { - this.scopeManager.__nestModuleScope(node); - } - - if (this.scopeManager.isStrictModeSupported() && this.scopeManager.isImpliedStrict()) { - this.currentScope().isStrict = true; - } - this.visitChildren(node); - this.close(node); + function chownFix (orig) { + if (!orig) return orig + return function (target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) } + } - Identifier(node) { - this.currentScope().__referencing(node); + function chownFixSync (orig) { + if (!orig) return orig + return function (target, uid, gid) { + try { + return orig.call(fs, target, uid, gid) + } catch (er) { + if (!chownErOk(er)) throw er + } } + } - UpdateExpression(node) { - if (PatternVisitor.isPattern(node.argument)) { - this.currentScope().__referencing(node.argument, Reference.RW, null); - } else { - this.visitChildren(node); + function statFix (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + function callback (er, stats) { + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 } + if (cb) cb.apply(this, arguments) + } + return options ? orig.call(fs, target, options, callback) + : orig.call(fs, target, callback) } + } - MemberExpression(node) { - this.visit(node.object); - if (node.computed) { - this.visit(node.property); - } + function statFixSync (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options) { + var stats = options ? orig.call(fs, target, options) + : orig.call(fs, target) + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + return stats; } + } - Property(node) { - this.visitProperty(node); - } + // ENOSYS means that the fs doesn't support the op. Just ignore + // that, because it doesn't matter. + // + // if there's no getuid, or if getuid() is something other + // than 0, and the error is EINVAL or EPERM, then just ignore + // it. + // + // This specific case is a silent failure in cp, install, tar, + // and most other unix tools that manage permissions. + // + // When running as root, or if other types of errors are + // encountered, then it's strict. + function chownErOk (er) { + if (!er) + return true - MethodDefinition(node) { - this.visitProperty(node); + if (er.code === "ENOSYS") + return true + + var nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true } - BreakStatement() {} // eslint-disable-line class-methods-use-this + return false + } +} - ContinueStatement() {} // eslint-disable-line class-methods-use-this - LabeledStatement(node) { - this.visit(node.body); - } +/***/ }), - ForStatement(node) { +/***/ 15235: +/***/ (function(module) { - // Create ForStatement declaration. - // NOTE: In ES6, ForStatement dynamically generates - // per iteration environment. However, escope is - // a static analyzer, we only generate one scope for ForStatement. - if (node.init && node.init.type === Syntax.VariableDeclaration && node.init.kind !== "var") { - this.scopeManager.__nestForScope(node); - } +"use strict"; - this.visitChildren(node); - this.close(node); +module.exports = parseJson +function parseJson (txt, reviver, context) { + context = context || 20 + try { + return JSON.parse(txt, reviver) + } catch (e) { + if (typeof txt !== 'string') { + const isEmptyArray = Array.isArray(txt) && txt.length === 0 + const errorMessage = 'Cannot parse ' + + (isEmptyArray ? 'an empty array' : String(txt)) + throw new TypeError(errorMessage) } - - ClassExpression(node) { - this.visitClass(node); + const syntaxErr = e.message.match(/^Unexpected token.*position\s+(\d+)/i) + const errIdx = syntaxErr + ? +syntaxErr[1] + : e.message.match(/^Unexpected end of JSON.*/i) + ? txt.length - 1 + : null + if (errIdx != null) { + const start = errIdx <= context + ? 0 + : errIdx - context + const end = errIdx + context >= txt.length + ? txt.length + : errIdx + context + e.message += ` while parsing near '${ + start === 0 ? '' : '...' + }${txt.slice(start, end)}${ + end === txt.length ? '' : '...' + }'` + } else { + e.message += ` while parsing '${txt.slice(0, context * 2)}'` } + throw e + } +} - ClassDeclaration(node) { - this.visitClass(node); - } - CallExpression(node) { +/***/ }), - // Check this is direct call to eval - if (!this.scopeManager.__ignoreEval() && node.callee.type === Syntax.Identifier && node.callee.name === "eval") { +/***/ 54983: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - // NOTE: This should be `variableScope`. Since direct eval call always creates Lexical environment and - // let / const should be enclosed into it. Only VariableDeclaration affects on the caller's environment. - this.currentScope().variableScope.__detectEval(); - } - this.visitChildren(node); - } - - BlockStatement(node) { - if (this.scopeManager.__isES6()) { - this.scopeManager.__nestBlockScope(node); - } +"use strict"; +var __webpack_unused_export__; - this.visitChildren(node); - this.close(node); - } +__webpack_unused_export__ = ({ + value: true +}); +exports.Z = void 0; - ThisExpression() { - this.currentScope().variableScope.__detectThis(); - } +const { + stringHints, + numberHints +} = __webpack_require__(79926); +/** @typedef {import("json-schema").JSONSchema6} JSONSchema6 */ - WithStatement(node) { - this.visit(node.object); +/** @typedef {import("json-schema").JSONSchema7} JSONSchema7 */ - // Then nest scope for WithStatement. - this.scopeManager.__nestWithScope(node); +/** @typedef {import("./validate").Schema} Schema */ - this.visit(node.body); +/** @typedef {import("./validate").ValidationErrorConfiguration} ValidationErrorConfiguration */ - this.close(node); - } +/** @typedef {import("./validate").PostFormatter} PostFormatter */ - VariableDeclaration(node) { - const variableTargetScope = (node.kind === "var") ? this.currentScope().variableScope : this.currentScope(); +/** @typedef {import("./validate").SchemaUtilErrorObject} SchemaUtilErrorObject */ - for (let i = 0, iz = node.declarations.length; i < iz; ++i) { - const decl = node.declarations[i]; +/** @enum {number} */ - this.visitVariableDeclaration(variableTargetScope, Variable.Variable, node, i); - if (decl.init) { - this.visit(decl.init); - } - } - } - // sec 13.11.8 - SwitchStatement(node) { - this.visit(node.discriminant); +const SPECIFICITY = { + type: 1, + not: 1, + oneOf: 1, + anyOf: 1, + if: 1, + enum: 1, + const: 1, + instanceof: 1, + required: 2, + pattern: 2, + patternRequired: 2, + format: 2, + formatMinimum: 2, + formatMaximum: 2, + minimum: 2, + exclusiveMinimum: 2, + maximum: 2, + exclusiveMaximum: 2, + multipleOf: 2, + uniqueItems: 2, + contains: 2, + minLength: 2, + maxLength: 2, + minItems: 2, + maxItems: 2, + minProperties: 2, + maxProperties: 2, + dependencies: 2, + propertyNames: 2, + additionalItems: 2, + additionalProperties: 2, + absolutePath: 2 +}; +/** + * + * @param {Array} array + * @param {(item: SchemaUtilErrorObject) => number} fn + * @returns {Array} + */ - if (this.scopeManager.__isES6()) { - this.scopeManager.__nestSwitchScope(node); - } +function filterMax(array, fn) { + const evaluatedMax = array.reduce((max, item) => Math.max(max, fn(item)), 0); + return array.filter(item => fn(item) === evaluatedMax); +} +/** + * + * @param {Array} children + * @returns {Array} + */ - for (let i = 0, iz = node.cases.length; i < iz; ++i) { - this.visit(node.cases[i]); - } - this.close(node); - } +function filterChildren(children) { + let newChildren = children; + newChildren = filterMax(newChildren, + /** + * + * @param {SchemaUtilErrorObject} error + * @returns {number} + */ + error => error.dataPath ? error.dataPath.length : 0); + newChildren = filterMax(newChildren, + /** + * @param {SchemaUtilErrorObject} error + * @returns {number} + */ + error => SPECIFICITY[ + /** @type {keyof typeof SPECIFICITY} */ + error.keyword] || 2); + return newChildren; +} +/** + * Find all children errors + * @param {Array} children + * @param {Array} schemaPaths + * @return {number} returns index of first child + */ - FunctionDeclaration(node) { - this.visitFunction(node); - } - FunctionExpression(node) { - this.visitFunction(node); - } +function findAllChildren(children, schemaPaths) { + let i = children.length - 1; - ForOfStatement(node) { - this.visitForIn(node); - } + const predicate = + /** + * @param {string} schemaPath + * @returns {boolean} + */ + schemaPath => children[i].schemaPath.indexOf(schemaPath) !== 0; - ForInStatement(node) { - this.visitForIn(node); + while (i > -1 && !schemaPaths.every(predicate)) { + if (children[i].keyword === "anyOf" || children[i].keyword === "oneOf") { + const refs = extractRefs(children[i]); + const childrenStart = findAllChildren(children.slice(0, i), refs.concat(children[i].schemaPath)); + i = childrenStart - 1; + } else { + i -= 1; } + } - ArrowFunctionExpression(node) { - this.visitFunction(node); - } + return i + 1; +} +/** + * Extracts all refs from schema + * @param {SchemaUtilErrorObject} error + * @return {Array} + */ - ImportDeclaration(node) { - assert(this.scopeManager.__isES6() && this.scopeManager.isModule(), "ImportDeclaration should appear when the mode is ES6 and in the module context."); - const importer = new Importer(node, this); +function extractRefs(error) { + const { + schema + } = error; - importer.visit(node); - } + if (!Array.isArray(schema)) { + return []; + } - visitExportDeclaration(node) { - if (node.source) { - return; - } - if (node.declaration) { - this.visit(node.declaration); - return; - } + return schema.map(({ + $ref + }) => $ref).filter(s => s); +} +/** + * Groups children by their first level parent (assuming that error is root) + * @param {Array} children + * @return {Array} + */ - this.visitChildren(node); - } - // TODO: ExportDeclaration doesn't exist. for bc? - ExportDeclaration(node) { - this.visitExportDeclaration(node); - } +function groupChildrenByFirstChild(children) { + const result = []; + let i = children.length - 1; - ExportAllDeclaration(node) { - this.visitExportDeclaration(node); - } + while (i > 0) { + const child = children[i]; - ExportDefaultDeclaration(node) { - this.visitExportDeclaration(node); - } + if (child.keyword === "anyOf" || child.keyword === "oneOf") { + const refs = extractRefs(child); + const childrenStart = findAllChildren(children.slice(0, i), refs.concat(child.schemaPath)); - ExportNamedDeclaration(node) { - this.visitExportDeclaration(node); + if (childrenStart !== i) { + result.push(Object.assign({}, child, { + children: children.slice(childrenStart, i) + })); + i = childrenStart; + } else { + result.push(child); + } + } else { + result.push(child); } - ExportSpecifier(node) { + i -= 1; + } - // TODO: `node.id` doesn't exist. for bc? - const local = (node.id || node.local); + if (i === 0) { + result.push(children[i]); + } - this.visit(local); - } + return result.reverse(); +} +/** + * @param {string} str + * @param {string} prefix + * @returns {string} + */ - MetaProperty() { // eslint-disable-line class-methods-use-this - // do nothing. - } +function indent(str, prefix) { + return str.replace(/\n(?!$)/g, `\n${prefix}`); } +/** + * @param {Schema} schema + * @returns {schema is (Schema & {not: Schema})} + */ -module.exports = Referencer; - -/* vim: set sw=4 ts=4 et tw=80 : */ +function hasNotInSchema(schema) { + return !!schema.not; +} +/** + * @param {Schema} schema + * @return {Schema} + */ -/***/ }), -/***/ 96988: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +function findFirstTypedSchema(schema) { + if (hasNotInSchema(schema)) { + return findFirstTypedSchema(schema.not); + } -"use strict"; -/* - Copyright (C) 2015 Yusuke Suzuki + return schema; +} +/** + * @param {Schema} schema + * @return {boolean} + */ - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. +function canApplyNot(schema) { + const typedSchema = findFirstTypedSchema(schema); + return likeNumber(typedSchema) || likeInteger(typedSchema) || likeString(typedSchema) || likeNull(typedSchema) || likeBoolean(typedSchema); +} +/** + * @param {any} maybeObj + * @returns {boolean} + */ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ +function isObject(maybeObj) { + return typeof maybeObj === "object" && maybeObj !== null; +} +/** + * @param {Schema} schema + * @returns {boolean} + */ -/* eslint-disable no-underscore-dangle */ -const Scope = __webpack_require__(16313); -const assert = __webpack_require__(39491); +function likeNumber(schema) { + return schema.type === "number" || typeof schema.minimum !== "undefined" || typeof schema.exclusiveMinimum !== "undefined" || typeof schema.maximum !== "undefined" || typeof schema.exclusiveMaximum !== "undefined" || typeof schema.multipleOf !== "undefined"; +} +/** + * @param {Schema} schema + * @returns {boolean} + */ -const GlobalScope = Scope.GlobalScope; -const CatchScope = Scope.CatchScope; -const WithScope = Scope.WithScope; -const ModuleScope = Scope.ModuleScope; -const ClassScope = Scope.ClassScope; -const SwitchScope = Scope.SwitchScope; -const FunctionScope = Scope.FunctionScope; -const ForScope = Scope.ForScope; -const FunctionExpressionNameScope = Scope.FunctionExpressionNameScope; -const BlockScope = Scope.BlockScope; +function likeInteger(schema) { + return schema.type === "integer" || typeof schema.minimum !== "undefined" || typeof schema.exclusiveMinimum !== "undefined" || typeof schema.maximum !== "undefined" || typeof schema.exclusiveMaximum !== "undefined" || typeof schema.multipleOf !== "undefined"; +} /** - * @class ScopeManager + * @param {Schema} schema + * @returns {boolean} */ -class ScopeManager { - constructor(options) { - this.scopes = []; - this.globalScope = null; - this.__nodeToScope = new WeakMap(); - this.__currentScope = null; - this.__options = options; - this.__declaredVariables = new WeakMap(); - } - __useDirective() { - return this.__options.directive; - } - __isOptimistic() { - return this.__options.optimistic; - } +function likeString(schema) { + return schema.type === "string" || typeof schema.minLength !== "undefined" || typeof schema.maxLength !== "undefined" || typeof schema.pattern !== "undefined" || typeof schema.format !== "undefined" || typeof schema.formatMinimum !== "undefined" || typeof schema.formatMaximum !== "undefined"; +} +/** + * @param {Schema} schema + * @returns {boolean} + */ - __ignoreEval() { - return this.__options.ignoreEval; - } - __isNodejsScope() { - return this.__options.nodejsScope; - } +function likeBoolean(schema) { + return schema.type === "boolean"; +} +/** + * @param {Schema} schema + * @returns {boolean} + */ - isModule() { - return this.__options.sourceType === "module"; - } - isImpliedStrict() { - return this.__options.impliedStrict; - } +function likeArray(schema) { + return schema.type === "array" || typeof schema.minItems === "number" || typeof schema.maxItems === "number" || typeof schema.uniqueItems !== "undefined" || typeof schema.items !== "undefined" || typeof schema.additionalItems !== "undefined" || typeof schema.contains !== "undefined"; +} +/** + * @param {Schema & {patternRequired?: Array}} schema + * @returns {boolean} + */ - isStrictModeSupported() { - return this.__options.ecmaVersion >= 5; - } - // Returns appropriate scope for this node. - __get(node) { - return this.__nodeToScope.get(node); - } +function likeObject(schema) { + return schema.type === "object" || typeof schema.minProperties !== "undefined" || typeof schema.maxProperties !== "undefined" || typeof schema.required !== "undefined" || typeof schema.properties !== "undefined" || typeof schema.patternProperties !== "undefined" || typeof schema.additionalProperties !== "undefined" || typeof schema.dependencies !== "undefined" || typeof schema.propertyNames !== "undefined" || typeof schema.patternRequired !== "undefined"; +} +/** + * @param {Schema} schema + * @returns {boolean} + */ - /** - * Get variables that are declared by the node. - * - * "are declared by the node" means the node is same as `Variable.defs[].node` or `Variable.defs[].parent`. - * If the node declares nothing, this method returns an empty array. - * CAUTION: This API is experimental. See https://github.com/estools/escope/pull/69 for more details. - * - * @param {Espree.Node} node - a node to get. - * @returns {Variable[]} variables that declared by the node. - */ - getDeclaredVariables(node) { - return this.__declaredVariables.get(node) || []; - } - /** - * acquire scope from node. - * @method ScopeManager#acquire - * @param {Espree.Node} node - node for the acquired scope. - * @param {boolean=} inner - look up the most inner scope, default value is false. - * @returns {Scope?} Scope from node - */ - acquire(node, inner) { +function likeNull(schema) { + return schema.type === "null"; +} +/** + * @param {string} type + * @returns {string} + */ - /** - * predicate - * @param {Scope} testScope - scope to test - * @returns {boolean} predicate - */ - function predicate(testScope) { - if (testScope.type === "function" && testScope.functionExpressionScope) { - return false; - } - return true; - } - const scopes = this.__get(node); +function getArticle(type) { + if (/^[aeiou]/i.test(type)) { + return "an"; + } - if (!scopes || scopes.length === 0) { - return null; - } + return "a"; +} +/** + * @param {Schema=} schema + * @returns {string} + */ - // Heuristic selection from all scopes. - // If you would like to get all scopes, please use ScopeManager#acquireAll. - if (scopes.length === 1) { - return scopes[0]; - } - if (inner) { - for (let i = scopes.length - 1; i >= 0; --i) { - const scope = scopes[i]; +function getSchemaNonTypes(schema) { + if (!schema) { + return ""; + } - if (predicate(scope)) { - return scope; - } - } - } else { - for (let i = 0, iz = scopes.length; i < iz; ++i) { - const scope = scopes[i]; + if (!schema.type) { + if (likeNumber(schema) || likeInteger(schema)) { + return " | should be any non-number"; + } - if (predicate(scope)) { - return scope; - } - } - } + if (likeString(schema)) { + return " | should be any non-string"; + } - return null; + if (likeArray(schema)) { + return " | should be any non-array"; } - /** - * acquire all scopes from node. - * @method ScopeManager#acquireAll - * @param {Espree.Node} node - node for the acquired scope. - * @returns {Scopes?} Scope array - */ - acquireAll(node) { - return this.__get(node); + if (likeObject(schema)) { + return " | should be any non-object"; } + } - /** - * release the node. - * @method ScopeManager#release - * @param {Espree.Node} node - releasing node. - * @param {boolean=} inner - look up the most inner scope, default value is false. - * @returns {Scope?} upper scope for the node. - */ - release(node, inner) { - const scopes = this.__get(node); + return ""; +} +/** + * @param {Array} hints + * @returns {string} + */ - if (scopes && scopes.length) { - const scope = scopes[0].upper; - if (!scope) { - return null; - } - return this.acquire(scope.block, inner); +function formatHints(hints) { + return hints.length > 0 ? `(${hints.join(", ")})` : ""; +} +/** + * @param {Schema} schema + * @param {boolean} logic + * @returns {string[]} + */ + + +function getHints(schema, logic) { + if (likeNumber(schema) || likeInteger(schema)) { + return numberHints(schema, logic); + } else if (likeString(schema)) { + return stringHints(schema, logic); + } + + return []; +} + +class ValidationError extends Error { + /** + * @param {Array} errors + * @param {Schema} schema + * @param {ValidationErrorConfiguration} configuration + */ + constructor(errors, schema, configuration = {}) { + super(); + /** @type {string} */ + + this.name = "ValidationError"; + /** @type {Array} */ + + this.errors = errors; + /** @type {Schema} */ + + this.schema = schema; + let headerNameFromSchema; + let baseDataPathFromSchema; + + if (schema.title && (!configuration.name || !configuration.baseDataPath)) { + const splittedTitleFromSchema = schema.title.match(/^(.+) (.+)$/); + + if (splittedTitleFromSchema) { + if (!configuration.name) { + [, headerNameFromSchema] = splittedTitleFromSchema; } - return null; + + if (!configuration.baseDataPath) { + [,, baseDataPathFromSchema] = splittedTitleFromSchema; + } + } } + /** @type {string} */ - attach() { } // eslint-disable-line class-methods-use-this - detach() { } // eslint-disable-line class-methods-use-this + this.headerName = configuration.name || headerNameFromSchema || "Object"; + /** @type {string} */ - __nestScope(scope) { - if (scope instanceof GlobalScope) { - assert(this.__currentScope === null); - this.globalScope = scope; - } - this.__currentScope = scope; - return scope; + this.baseDataPath = configuration.baseDataPath || baseDataPathFromSchema || "configuration"; + /** @type {PostFormatter | null} */ + + this.postFormatter = configuration.postFormatter || null; + const header = `Invalid ${this.baseDataPath} object. ${this.headerName} has been initialized using ${getArticle(this.baseDataPath)} ${this.baseDataPath} object that does not match the API schema.\n`; + /** @type {string} */ + + this.message = `${header}${this.formatValidationErrors(errors)}`; + Error.captureStackTrace(this, this.constructor); + } + /** + * @param {string} path + * @returns {Schema} + */ + + + getSchemaPart(path) { + const newPath = path.split("/"); + let schemaPart = this.schema; + + for (let i = 1; i < newPath.length; i++) { + const inner = schemaPart[ + /** @type {keyof Schema} */ + newPath[i]]; + + if (!inner) { + break; + } + + schemaPart = inner; } - __nestGlobalScope(node) { - return this.__nestScope(new GlobalScope(this, node)); + return schemaPart; + } + /** + * @param {Schema} schema + * @param {boolean} logic + * @param {Array} prevSchemas + * @returns {string} + */ + + + formatSchema(schema, logic = true, prevSchemas = []) { + let newLogic = logic; + + const formatInnerSchema = + /** + * + * @param {Object} innerSchema + * @param {boolean=} addSelf + * @returns {string} + */ + (innerSchema, addSelf) => { + if (!addSelf) { + return this.formatSchema(innerSchema, newLogic, prevSchemas); + } + + if (prevSchemas.includes(innerSchema)) { + return "(recursive)"; + } + + return this.formatSchema(innerSchema, newLogic, prevSchemas.concat(schema)); + }; + + if (hasNotInSchema(schema) && !likeObject(schema)) { + if (canApplyNot(schema.not)) { + newLogic = !logic; + return formatInnerSchema(schema.not); + } + + const needApplyLogicHere = !schema.not.not; + const prefix = logic ? "" : "non "; + newLogic = !logic; + return needApplyLogicHere ? prefix + formatInnerSchema(schema.not) : formatInnerSchema(schema.not); } - __nestBlockScope(node) { - return this.__nestScope(new BlockScope(this, this.__currentScope, node)); + if ( + /** @type {Schema & {instanceof: string | Array}} */ + schema.instanceof) { + const { + instanceof: value + } = + /** @type {Schema & {instanceof: string | Array}} */ + schema; + const values = !Array.isArray(value) ? [value] : value; + return values.map( + /** + * @param {string} item + * @returns {string} + */ + item => item === "Function" ? "function" : item).join(" | "); } - __nestFunctionScope(node, isMethodDefinition) { - return this.__nestScope(new FunctionScope(this, this.__currentScope, node, isMethodDefinition)); + if (schema.enum) { + return ( + /** @type {Array} */ + schema.enum.map(item => JSON.stringify(item)).join(" | ") + ); } - __nestForScope(node) { - return this.__nestScope(new ForScope(this, this.__currentScope, node)); + if (typeof schema.const !== "undefined") { + return JSON.stringify(schema.const); } - __nestCatchScope(node) { - return this.__nestScope(new CatchScope(this, this.__currentScope, node)); + if (schema.oneOf) { + return ( + /** @type {Array} */ + schema.oneOf.map(item => formatInnerSchema(item, true)).join(" | ") + ); } - __nestWithScope(node) { - return this.__nestScope(new WithScope(this, this.__currentScope, node)); + if (schema.anyOf) { + return ( + /** @type {Array} */ + schema.anyOf.map(item => formatInnerSchema(item, true)).join(" | ") + ); } - __nestClassScope(node) { - return this.__nestScope(new ClassScope(this, this.__currentScope, node)); + if (schema.allOf) { + return ( + /** @type {Array} */ + schema.allOf.map(item => formatInnerSchema(item, true)).join(" & ") + ); } - __nestSwitchScope(node) { - return this.__nestScope(new SwitchScope(this, this.__currentScope, node)); + if ( + /** @type {JSONSchema7} */ + schema.if) { + const { + if: ifValue, + then: thenValue, + else: elseValue + } = + /** @type {JSONSchema7} */ + schema; + return `${ifValue ? `if ${formatInnerSchema(ifValue)}` : ""}${thenValue ? ` then ${formatInnerSchema(thenValue)}` : ""}${elseValue ? ` else ${formatInnerSchema(elseValue)}` : ""}`; } - __nestModuleScope(node) { - return this.__nestScope(new ModuleScope(this, this.__currentScope, node)); + if (schema.$ref) { + return formatInnerSchema(this.getSchemaPart(schema.$ref), true); } - __nestFunctionExpressionNameScope(node) { - return this.__nestScope(new FunctionExpressionNameScope(this, this.__currentScope, node)); + if (likeNumber(schema) || likeInteger(schema)) { + const [type, ...hints] = getHints(schema, logic); + const str = `${type}${hints.length > 0 ? ` ${formatHints(hints)}` : ""}`; + return logic ? str : hints.length > 0 ? `non-${type} | ${str}` : `non-${type}`; } - __isES6() { - return this.__options.ecmaVersion >= 6; + if (likeString(schema)) { + const [type, ...hints] = getHints(schema, logic); + const str = `${type}${hints.length > 0 ? ` ${formatHints(hints)}` : ""}`; + return logic ? str : str === "string" ? "non-string" : `non-string | ${str}`; } -} -module.exports = ScopeManager; + if (likeBoolean(schema)) { + return `${logic ? "" : "non-"}boolean`; + } -/* vim: set sw=4 ts=4 et tw=80 : */ + if (likeArray(schema)) { + // not logic already applied in formatValidationError + newLogic = true; + const hints = []; + if (typeof schema.minItems === "number") { + hints.push(`should not have fewer than ${schema.minItems} item${schema.minItems > 1 ? "s" : ""}`); + } -/***/ }), + if (typeof schema.maxItems === "number") { + hints.push(`should not have more than ${schema.maxItems} item${schema.maxItems > 1 ? "s" : ""}`); + } -/***/ 16313: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (schema.uniqueItems) { + hints.push("should not have duplicate items"); + } -"use strict"; -/* - Copyright (C) 2015 Yusuke Suzuki + const hasAdditionalItems = typeof schema.additionalItems === "undefined" || Boolean(schema.additionalItems); + let items = ""; - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + if (schema.items) { + if (Array.isArray(schema.items) && schema.items.length > 0) { + items = `${ + /** @type {Array} */ + schema.items.map(item => formatInnerSchema(item)).join(", ")}`; - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + if (hasAdditionalItems) { + if (schema.additionalItems && isObject(schema.additionalItems) && Object.keys(schema.additionalItems).length > 0) { + hints.push(`additional items should be ${formatInnerSchema(schema.additionalItems)}`); + } + } + } else if (schema.items && Object.keys(schema.items).length > 0) { + // "additionalItems" is ignored + items = `${formatInnerSchema(schema.items)}`; + } else { + // Fallback for empty `items` value + items = "any"; + } + } else { + // "additionalItems" is ignored + items = "any"; + } - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ + if (schema.contains && Object.keys(schema.contains).length > 0) { + hints.push(`should contains at least one ${this.formatSchema(schema.contains)} item`); + } + return `[${items}${hasAdditionalItems ? ", ..." : ""}]${hints.length > 0 ? ` (${hints.join(", ")})` : ""}`; + } -/* eslint-disable no-underscore-dangle */ -/* eslint-disable no-undefined */ + if (likeObject(schema)) { + // not logic already applied in formatValidationError + newLogic = true; + const hints = []; -const Syntax = (__webpack_require__(18350).Syntax); + if (typeof schema.minProperties === "number") { + hints.push(`should not have fewer than ${schema.minProperties} ${schema.minProperties > 1 ? "properties" : "property"}`); + } -const Reference = __webpack_require__(64945); -const Variable = __webpack_require__(82971); -const Definition = (__webpack_require__(70665).Definition); -const assert = __webpack_require__(39491); + if (typeof schema.maxProperties === "number") { + hints.push(`should not have more than ${schema.maxProperties} ${schema.minProperties && schema.minProperties > 1 ? "properties" : "property"}`); + } -/** - * Test if scope is struct - * @param {Scope} scope - scope - * @param {Block} block - block - * @param {boolean} isMethodDefinition - is method definition - * @param {boolean} useDirective - use directive - * @returns {boolean} is strict scope - */ -function isStrictScope(scope, block, isMethodDefinition, useDirective) { - let body; + if (schema.patternProperties && Object.keys(schema.patternProperties).length > 0) { + const patternProperties = Object.keys(schema.patternProperties); + hints.push(`additional property names should match pattern${patternProperties.length > 1 ? "s" : ""} ${patternProperties.map(pattern => JSON.stringify(pattern)).join(" | ")}`); + } - // When upper scope is exists and strict, inner scope is also strict. - if (scope.upper && scope.upper.isStrict) { - return true; - } + const properties = schema.properties ? Object.keys(schema.properties) : []; + const required = schema.required ? schema.required : []; + const allProperties = [...new Set( + /** @type {Array} */ + [].concat(required).concat(properties))]; + const objectStructure = allProperties.map(property => { + const isRequired = required.includes(property); // Some properties need quotes, maybe we should add check + // Maybe we should output type of property (`foo: string`), but it is looks very unreadable - if (isMethodDefinition) { - return true; + return `${property}${isRequired ? "" : "?"}`; + }).concat(typeof schema.additionalProperties === "undefined" || Boolean(schema.additionalProperties) ? schema.additionalProperties && isObject(schema.additionalProperties) ? [`: ${formatInnerSchema(schema.additionalProperties)}`] : ["…"] : []).join(", "); + const { + dependencies, + propertyNames, + patternRequired + } = + /** @type {Schema & {patternRequired?: Array;}} */ + schema; + + if (dependencies) { + Object.keys(dependencies).forEach(dependencyName => { + const dependency = dependencies[dependencyName]; + + if (Array.isArray(dependency)) { + hints.push(`should have ${dependency.length > 1 ? "properties" : "property"} ${dependency.map(dep => `'${dep}'`).join(", ")} when property '${dependencyName}' is present`); + } else { + hints.push(`should be valid according to the schema ${formatInnerSchema(dependency)} when property '${dependencyName}' is present`); + } + }); + } + + if (propertyNames && Object.keys(propertyNames).length > 0) { + hints.push(`each property name should match format ${JSON.stringify(schema.propertyNames.format)}`); + } + + if (patternRequired && patternRequired.length > 0) { + hints.push(`should have property matching pattern ${patternRequired.map( + /** + * @param {string} item + * @returns {string} + */ + item => JSON.stringify(item))}`); + } + + return `object {${objectStructure ? ` ${objectStructure} ` : ""}}${hints.length > 0 ? ` (${hints.join(", ")})` : ""}`; } - if (scope.type === "class" || scope.type === "module") { - return true; + if (likeNull(schema)) { + return `${logic ? "" : "non-"}null`; } - if (scope.type === "block" || scope.type === "switch") { - return false; + if (Array.isArray(schema.type)) { + // not logic already applied in formatValidationError + return `${schema.type.join(" | ")}`; + } // Fallback for unknown keywords + // not logic already applied in formatValidationError + + /* istanbul ignore next */ + + + return JSON.stringify(schema, null, 2); + } + /** + * @param {Schema=} schemaPart + * @param {(boolean | Array)=} additionalPath + * @param {boolean=} needDot + * @param {boolean=} logic + * @returns {string} + */ + + + getSchemaPartText(schemaPart, additionalPath, needDot = false, logic = true) { + if (!schemaPart) { + return ""; } - if (scope.type === "function") { - if (block.type === Syntax.ArrowFunctionExpression && block.body.type !== Syntax.BlockStatement) { - return false; - } + if (Array.isArray(additionalPath)) { + for (let i = 0; i < additionalPath.length; i++) { + /** @type {Schema | undefined} */ + const inner = schemaPart[ + /** @type {keyof Schema} */ + additionalPath[i]]; - if (block.type === Syntax.Program) { - body = block; + if (inner) { + // eslint-disable-next-line no-param-reassign + schemaPart = inner; } else { - body = block.body; + break; } + } + } - if (!body) { - return false; - } - } else if (scope.type === "global") { - body = block; - } else { - return false; + while (schemaPart.$ref) { + // eslint-disable-next-line no-param-reassign + schemaPart = this.getSchemaPart(schemaPart.$ref); } - // Search 'use strict' directive. - if (useDirective) { - for (let i = 0, iz = body.body.length; i < iz; ++i) { - const stmt = body.body[i]; + let schemaText = `${this.formatSchema(schemaPart, logic)}${needDot ? "." : ""}`; - if (stmt.type !== Syntax.DirectiveStatement) { - break; - } - if (stmt.raw === "\"use strict\"" || stmt.raw === "'use strict'") { - return true; - } - } - } else { - for (let i = 0, iz = body.body.length; i < iz; ++i) { - const stmt = body.body[i]; + if (schemaPart.description) { + schemaText += `\n-> ${schemaPart.description}`; + } - if (stmt.type !== Syntax.ExpressionStatement) { - break; - } - const expr = stmt.expression; + if (schemaPart.link) { + schemaText += `\n-> Read more at ${schemaPart.link}`; + } - if (expr.type !== Syntax.Literal || typeof expr.value !== "string") { - break; - } - if (expr.raw !== null && expr.raw !== undefined) { - if (expr.raw === "\"use strict\"" || expr.raw === "'use strict'") { - return true; - } - } else { - if (expr.value === "use strict") { - return true; - } - } - } + return schemaText; + } + /** + * @param {Schema=} schemaPart + * @returns {string} + */ + + + getSchemaPartDescription(schemaPart) { + if (!schemaPart) { + return ""; } - return false; -} -/** - * Register scope - * @param {ScopeManager} scopeManager - scope manager - * @param {Scope} scope - scope - * @returns {void} - */ -function registerScope(scopeManager, scope) { - scopeManager.scopes.push(scope); + while (schemaPart.$ref) { + // eslint-disable-next-line no-param-reassign + schemaPart = this.getSchemaPart(schemaPart.$ref); + } - const scopes = scopeManager.__nodeToScope.get(scope.block); + let schemaText = ""; - if (scopes) { - scopes.push(scope); - } else { - scopeManager.__nodeToScope.set(scope.block, [scope]); + if (schemaPart.description) { + schemaText += `\n-> ${schemaPart.description}`; } -} -/** - * Should be statically - * @param {Object} def - def - * @returns {boolean} should be statically - */ -function shouldBeStatically(def) { - return ( - (def.type === Variable.ClassName) || - (def.type === Variable.Variable && def.parent.kind !== "var") - ); -} - -/** - * @class Scope - */ -class Scope { - constructor(scopeManager, type, upperScope, block, isMethodDefinition) { - - /** - * One of 'module', 'block', 'switch', 'function', 'catch', 'with', 'function', 'class', 'global'. - * @member {String} Scope#type - */ - this.type = type; - - /** - * The scoped {@link Variable}s of this scope, as { Variable.name - * : Variable }. - * @member {Map} Scope#set - */ - this.set = new Map(); - - /** - * The tainted variables of this scope, as { Variable.name : - * boolean }. - * @member {Map} Scope#taints */ - this.taints = new Map(); - - /** - * Generally, through the lexical scoping of JS you can always know - * which variable an identifier in the source code refers to. There are - * a few exceptions to this rule. With 'global' and 'with' scopes you - * can only decide at runtime which variable a reference refers to. - * Moreover, if 'eval()' is used in a scope, it might introduce new - * bindings in this or its parent scopes. - * All those scopes are considered 'dynamic'. - * @member {boolean} Scope#dynamic - */ - this.dynamic = this.type === "global" || this.type === "with"; + if (schemaPart.link) { + schemaText += `\n-> Read more at ${schemaPart.link}`; + } - /** - * A reference to the scope-defining syntax node. - * @member {espree.Node} Scope#block - */ - this.block = block; + return schemaText; + } + /** + * @param {SchemaUtilErrorObject} error + * @returns {string} + */ - /** - * The {@link Reference|references} that are not resolved with this scope. - * @member {Reference[]} Scope#through - */ - this.through = []; - /** - * The scoped {@link Variable}s of this scope. In the case of a - * 'function' scope this includes the automatic argument arguments as - * its first element, as well as all further formal arguments. - * @member {Variable[]} Scope#variables - */ - this.variables = []; + formatValidationError(error) { + const { + keyword, + dataPath: errorDataPath + } = error; + const dataPath = `${this.baseDataPath}${errorDataPath}`; - /** - * Any variable {@link Reference|reference} found in this scope. This - * includes occurrences of local variables as well as variables from - * parent scopes (including the global scope). For local variables - * this also includes defining occurrences (like in a 'var' statement). - * In a 'function' scope this does not include the occurrences of the - * formal parameter in the parameter list. - * @member {Reference[]} Scope#references - */ - this.references = []; + switch (keyword) { + case "type": + { + const { + parentSchema, + params + } = error; // eslint-disable-next-line default-case - /** - * For 'global' and 'function' scopes, this is a self-reference. For - * other scope types this is the variableScope value of the - * parent scope. - * @member {Scope} Scope#variableScope - */ - this.variableScope = - (this.type === "global" || this.type === "function" || this.type === "module") ? this : upperScope.variableScope; + switch ( + /** @type {import("ajv").TypeParams} */ + params.type) { + case "number": + return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - /** - * Whether this scope is created by a FunctionExpression. - * @member {boolean} Scope#functionExpressionScope - */ - this.functionExpressionScope = false; + case "integer": + return `${dataPath} should be an ${this.getSchemaPartText(parentSchema, false, true)}`; - /** - * Whether this is a scope that contains an 'eval()' invocation. - * @member {boolean} Scope#directCallToEvalScope - */ - this.directCallToEvalScope = false; + case "string": + return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - /** - * @member {boolean} Scope#thisFound - */ - this.thisFound = false; + case "boolean": + return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - this.__left = []; + case "array": + return `${dataPath} should be an array:\n${this.getSchemaPartText(parentSchema)}`; - /** - * Reference to the parent {@link Scope|scope}. - * @member {Scope} Scope#upper - */ - this.upper = upperScope; + case "object": + return `${dataPath} should be an object:\n${this.getSchemaPartText(parentSchema)}`; - /** - * Whether 'use strict' is in effect in this scope. - * @member {boolean} Scope#isStrict - */ - this.isStrict = isStrictScope(this, block, isMethodDefinition, scopeManager.__useDirective()); + case "null": + return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - /** - * List of nested {@link Scope}s. - * @member {Scope[]} Scope#childScopes - */ - this.childScopes = []; - if (this.upper) { - this.upper.childScopes.push(this); + default: + return `${dataPath} should be:\n${this.getSchemaPartText(parentSchema)}`; + } } - this.__declaredVariables = scopeManager.__declaredVariables; - - registerScope(scopeManager, this); - } - - __shouldStaticallyClose(scopeManager) { - return (!this.dynamic || scopeManager.__isOptimistic()); - } - - __shouldStaticallyCloseForGlobal(ref) { - - // On global scope, let/const/class declarations should be resolved statically. - const name = ref.identifier.name; - - if (!this.set.has(name)) { - return false; + case "instanceof": + { + const { + parentSchema + } = error; + return `${dataPath} should be an instance of ${this.getSchemaPartText(parentSchema, false, true)}`; } - const variable = this.set.get(name); - const defs = variable.defs; - - return defs.length > 0 && defs.every(shouldBeStatically); - } - - __staticCloseRef(ref) { - if (!this.__resolve(ref)) { - this.__delegateToUpperScope(ref); + case "pattern": + { + const { + params, + parentSchema + } = error; + const { + pattern + } = + /** @type {import("ajv").PatternParams} */ + params; + return `${dataPath} should match pattern ${JSON.stringify(pattern)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; } - } - __dynamicCloseRef(ref) { + case "format": + { + const { + params, + parentSchema + } = error; + const { + format + } = + /** @type {import("ajv").FormatParams} */ + params; + return `${dataPath} should match format ${JSON.stringify(format)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - // notify all names are through to global - let current = this; + case "formatMinimum": + case "formatMaximum": + { + const { + params, + parentSchema + } = error; + const { + comparison, + limit + } = + /** @type {import("ajv").ComparisonParams} */ + params; + return `${dataPath} should be ${comparison} ${JSON.stringify(limit)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - do { - current.through.push(ref); - current = current.upper; - } while (current); - } + case "minimum": + case "maximum": + case "exclusiveMinimum": + case "exclusiveMaximum": + { + const { + parentSchema, + params + } = error; + const { + comparison, + limit + } = + /** @type {import("ajv").ComparisonParams} */ + params; + const [, ...hints] = getHints( + /** @type {Schema} */ + parentSchema, true); - __globalCloseRef(ref) { + if (hints.length === 0) { + hints.push(`should be ${comparison} ${limit}`); + } - // let/const/class declarations should be resolved statically. - // others should be resolved dynamically. - if (this.__shouldStaticallyCloseForGlobal(ref)) { - this.__staticCloseRef(ref); - } else { - this.__dynamicCloseRef(ref); + return `${dataPath} ${hints.join(" ")}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; } - } - - __close(scopeManager) { - let closeRef; - if (this.__shouldStaticallyClose(scopeManager)) { - closeRef = this.__staticCloseRef; - } else if (this.type !== "global") { - closeRef = this.__dynamicCloseRef; - } else { - closeRef = this.__globalCloseRef; + case "multipleOf": + { + const { + params, + parentSchema + } = error; + const { + multipleOf + } = + /** @type {import("ajv").MultipleOfParams} */ + params; + return `${dataPath} should be multiple of ${multipleOf}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; } - // Try Resolving all references in this scope. - for (let i = 0, iz = this.__left.length; i < iz; ++i) { - const ref = this.__left[i]; - - closeRef.call(this, ref); + case "patternRequired": + { + const { + params, + parentSchema + } = error; + const { + missingPattern + } = + /** @type {import("ajv").PatternRequiredParams} */ + params; + return `${dataPath} should have property matching pattern ${JSON.stringify(missingPattern)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; } - this.__left = null; - - return this.upper; - } - // To override by function scopes. - // References in default parameters isn't resolved to variables which are in their function body. - __isValidResolution(ref, variable) { // eslint-disable-line class-methods-use-this, no-unused-vars - return true; - } + case "minLength": + { + const { + params, + parentSchema + } = error; + const { + limit + } = + /** @type {import("ajv").LimitParams} */ + params; - __resolve(ref) { - const name = ref.identifier.name; + if (limit === 1) { + return `${dataPath} should be a non-empty string${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - if (!this.set.has(name)) { - return false; + const length = limit - 1; + return `${dataPath} should be longer than ${length} character${length > 1 ? "s" : ""}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; } - const variable = this.set.get(name); - if (!this.__isValidResolution(ref, variable)) { - return false; - } - variable.references.push(ref); - variable.stack = variable.stack && ref.from.variableScope === this.variableScope; - if (ref.tainted) { - variable.tainted = true; - this.taints.set(variable.name, true); - } - ref.resolved = variable; + case "minItems": + { + const { + params, + parentSchema + } = error; + const { + limit + } = + /** @type {import("ajv").LimitParams} */ + params; - return true; - } + if (limit === 1) { + return `${dataPath} should be a non-empty array${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - __delegateToUpperScope(ref) { - if (this.upper) { - this.upper.__left.push(ref); + return `${dataPath} should not have fewer than ${limit} items${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; } - this.through.push(ref); - } - __addDeclaredVariablesOfNode(variable, node) { - if (node === null || node === undefined) { - return; - } + case "minProperties": + { + const { + params, + parentSchema + } = error; + const { + limit + } = + /** @type {import("ajv").LimitParams} */ + params; - let variables = this.__declaredVariables.get(node); + if (limit === 1) { + return `${dataPath} should be a non-empty object${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - if (variables === null || variables === undefined) { - variables = []; - this.__declaredVariables.set(node, variables); - } - if (variables.indexOf(variable) === -1) { - variables.push(variable); + return `${dataPath} should not have fewer than ${limit} properties${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; } - } - - __defineGeneric(name, set, variables, node, def) { - let variable; - variable = set.get(name); - if (!variable) { - variable = new Variable(name, this); - set.set(name, variable); - variables.push(variable); + case "maxLength": + { + const { + params, + parentSchema + } = error; + const { + limit + } = + /** @type {import("ajv").LimitParams} */ + params; + const max = limit + 1; + return `${dataPath} should be shorter than ${max} character${max > 1 ? "s" : ""}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; } - if (def) { - variable.defs.push(def); - this.__addDeclaredVariablesOfNode(variable, def.node); - this.__addDeclaredVariablesOfNode(variable, def.parent); - } - if (node) { - variable.identifiers.push(node); + case "maxItems": + { + const { + params, + parentSchema + } = error; + const { + limit + } = + /** @type {import("ajv").LimitParams} */ + params; + return `${dataPath} should not have more than ${limit} items${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; } - } - __define(node, def) { - if (node && node.type === Syntax.Identifier) { - this.__defineGeneric( - node.name, - this.set, - this.variables, - node, - def - ); + case "maxProperties": + { + const { + params, + parentSchema + } = error; + const { + limit + } = + /** @type {import("ajv").LimitParams} */ + params; + return `${dataPath} should not have more than ${limit} properties${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; } - } - __referencing(node, assign, writeExpr, maybeImplicitGlobal, partial, init) { + case "uniqueItems": + { + const { + params, + parentSchema + } = error; + const { + i + } = + /** @type {import("ajv").UniqueItemsParams} */ + params; + return `${dataPath} should not contain the item '${error.data[i]}' twice${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - // because Array element may be null - if (!node || node.type !== Syntax.Identifier) { - return; + case "additionalItems": + { + const { + params, + parentSchema + } = error; + const { + limit + } = + /** @type {import("ajv").LimitParams} */ + params; + return `${dataPath} should not have more than ${limit} items${getSchemaNonTypes(parentSchema)}. These items are valid:\n${this.getSchemaPartText(parentSchema)}`; } - // Specially handle like `this`. - if (node.name === "super") { - return; + case "contains": + { + const { + parentSchema + } = error; + return `${dataPath} should contains at least one ${this.getSchemaPartText(parentSchema, ["contains"])} item${getSchemaNonTypes(parentSchema)}.`; } - const ref = new Reference(node, this, assign || Reference.READ, writeExpr, maybeImplicitGlobal, !!partial, !!init); + case "required": + { + const { + parentSchema, + params + } = error; + const missingProperty = + /** @type {import("ajv").DependenciesParams} */ + params.missingProperty.replace(/^\./, ""); + const hasProperty = parentSchema && Boolean( + /** @type {Schema} */ + parentSchema.properties && + /** @type {Schema} */ + parentSchema.properties[missingProperty]); + return `${dataPath} misses the property '${missingProperty}'${getSchemaNonTypes(parentSchema)}.${hasProperty ? ` Should be:\n${this.getSchemaPartText(parentSchema, ["properties", missingProperty])}` : this.getSchemaPartDescription(parentSchema)}`; + } - this.references.push(ref); - this.__left.push(ref); - } - - __detectEval() { - let current = this; + case "additionalProperties": + { + const { + params, + parentSchema + } = error; + const { + additionalProperty + } = + /** @type {import("ajv").AdditionalPropertiesParams} */ + params; + return `${dataPath} has an unknown property '${additionalProperty}'${getSchemaNonTypes(parentSchema)}. These properties are valid:\n${this.getSchemaPartText(parentSchema)}`; + } - this.directCallToEvalScope = true; - do { - current.dynamic = true; - current = current.upper; - } while (current); - } + case "dependencies": + { + const { + params, + parentSchema + } = error; + const { + property, + deps + } = + /** @type {import("ajv").DependenciesParams} */ + params; + const dependencies = deps.split(",").map( + /** + * @param {string} dep + * @returns {string} + */ + dep => `'${dep.trim()}'`).join(", "); + return `${dataPath} should have properties ${dependencies} when property '${property}' is present${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } - __detectThis() { - this.thisFound = true; - } + case "propertyNames": + { + const { + params, + parentSchema, + schema + } = error; + const { + propertyName + } = + /** @type {import("ajv").PropertyNamesParams} */ + params; + return `${dataPath} property name '${propertyName}' is invalid${getSchemaNonTypes(parentSchema)}. Property names should be match format ${JSON.stringify(schema.format)}.${this.getSchemaPartDescription(parentSchema)}`; + } - __isClosed() { - return this.__left === null; - } + case "enum": + { + const { + parentSchema + } = error; - /** - * returns resolved {Reference} - * @method Scope#resolve - * @param {Espree.Identifier} ident - identifier to be resolved. - * @returns {Reference} reference - */ - resolve(ident) { - let ref, i, iz; + if (parentSchema && + /** @type {Schema} */ + parentSchema.enum && + /** @type {Schema} */ + parentSchema.enum.length === 1) { + return `${dataPath} should be ${this.getSchemaPartText(parentSchema, false, true)}`; + } - assert(this.__isClosed(), "Scope should be closed."); - assert(ident.type === Syntax.Identifier, "Target should be identifier."); - for (i = 0, iz = this.references.length; i < iz; ++i) { - ref = this.references[i]; - if (ref.identifier === ident) { - return ref; - } + return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}`; } - return null; - } - /** - * returns this scope is static - * @method Scope#isStatic - * @returns {boolean} static - */ - isStatic() { - return !this.dynamic; - } + case "const": + { + const { + parentSchema + } = error; + return `${dataPath} should be equal to constant ${this.getSchemaPartText(parentSchema, false, true)}`; + } - /** - * returns this scope has materialized arguments - * @method Scope#isArgumentsMaterialized - * @returns {boolean} arguemnts materialized - */ - isArgumentsMaterialized() { // eslint-disable-line class-methods-use-this - return true; - } + case "not": + { + const postfix = likeObject( + /** @type {Schema} */ + error.parentSchema) ? `\n${this.getSchemaPartText(error.parentSchema)}` : ""; + const schemaOutput = this.getSchemaPartText(error.schema, false, false, false); - /** - * returns this scope has materialized `this` reference - * @method Scope#isThisMaterialized - * @returns {boolean} this materialized - */ - isThisMaterialized() { // eslint-disable-line class-methods-use-this - return true; - } + if (canApplyNot(error.schema)) { + return `${dataPath} should be any ${schemaOutput}${postfix}.`; + } - isUsedName(name) { - if (this.set.has(name)) { - return true; + const { + schema, + parentSchema + } = error; + return `${dataPath} should not be ${this.getSchemaPartText(schema, false, true)}${parentSchema && likeObject(parentSchema) ? `\n${this.getSchemaPartText(parentSchema)}` : ""}`; } - for (let i = 0, iz = this.through.length; i < iz; ++i) { - if (this.through[i].identifier.name === name) { - return true; + + case "oneOf": + case "anyOf": + { + const { + parentSchema, + children + } = error; + + if (children && children.length > 0) { + if (error.schema.length === 1) { + const lastChild = children[children.length - 1]; + const remainingChildren = children.slice(0, children.length - 1); + return this.formatValidationError(Object.assign({}, lastChild, { + children: remainingChildren, + parentSchema: Object.assign({}, parentSchema, lastChild.parentSchema) + })); } - } - return false; - } -} -class GlobalScope extends Scope { - constructor(scopeManager, block) { - super(scopeManager, "global", null, block, false); - this.implicit = { - set: new Map(), - variables: [], + let filteredChildren = filterChildren(children); + + if (filteredChildren.length === 1) { + return this.formatValidationError(filteredChildren[0]); + } + filteredChildren = groupChildrenByFirstChild(filteredChildren); + return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}\nDetails:\n${filteredChildren.map( /** - * List of {@link Reference}s that are left to be resolved (i.e. which - * need to be linked to the variable they refer to). - * @member {Reference[]} Scope#implicit#left - */ - left: [] - }; - } + * @param {SchemaUtilErrorObject} nestedError + * @returns {string} + */ + nestedError => ` * ${indent(this.formatValidationError(nestedError), " ")}`).join("\n")}`; + } - __close(scopeManager) { - const implicit = []; + return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}`; + } - for (let i = 0, iz = this.__left.length; i < iz; ++i) { - const ref = this.__left[i]; + case "if": + { + const { + params, + parentSchema + } = error; + const { + failingKeyword + } = + /** @type {import("ajv").IfParams} */ + params; + return `${dataPath} should match "${failingKeyword}" schema:\n${this.getSchemaPartText(parentSchema, [failingKeyword])}`; + } - if (ref.__maybeImplicitGlobal && !this.set.has(ref.identifier.name)) { - implicit.push(ref.__maybeImplicitGlobal); - } + case "absolutePath": + { + const { + message, + parentSchema + } = error; + return `${dataPath}: ${message}${this.getSchemaPartDescription(parentSchema)}`; } - // create an implicit global variable from assignment expression - for (let i = 0, iz = implicit.length; i < iz; ++i) { - const info = implicit[i]; + /* istanbul ignore next */ - this.__defineImplicit(info.pattern, - new Definition( - Variable.ImplicitGlobalVariable, - info.pattern, - info.node, - null, - null, - null - )); + default: + { + const { + message, + parentSchema + } = error; + const ErrorInJSON = JSON.stringify(error, null, 2); // For `custom`, `false schema`, `$ref` keywords + // Fallback for unknown keywords + return `${dataPath} ${message} (${ErrorInJSON}).\n${this.getSchemaPartText(parentSchema, false)}`; } + } + } + /** + * @param {Array} errors + * @returns {string} + */ - this.implicit.left = this.__left; - return super.__close(scopeManager); - } + formatValidationErrors(errors) { + return errors.map(error => { + let formattedError = this.formatValidationError(error); - __defineImplicit(node, def) { - if (node && node.type === Syntax.Identifier) { - this.__defineGeneric( - node.name, - this.implicit.set, - this.implicit.variables, - node, - def - ); - } - } -} + if (this.postFormatter) { + formattedError = this.postFormatter(formattedError, error); + } -class ModuleScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "module", upperScope, block, false); - } -} + return ` - ${indent(formattedError, " ")}`; + }).join("\n"); + } -class FunctionExpressionNameScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "function-expression-name", upperScope, block, false); - this.__define(block.id, - new Definition( - Variable.FunctionName, - block.id, - block, - null, - null, - null - )); - this.functionExpressionScope = true; - } } -class CatchScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "catch", upperScope, block, false); - } -} +var _default = ValidationError; +exports.Z = _default; -class WithScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "with", upperScope, block, false); - } +/***/ }), - __close(scopeManager) { - if (this.__shouldStaticallyClose(scopeManager)) { - return super.__close(scopeManager); - } +/***/ 81184: +/***/ (function(module) { - for (let i = 0, iz = this.__left.length; i < iz; ++i) { - const ref = this.__left[i]; +"use strict"; - ref.tainted = true; - this.__delegateToUpperScope(ref); - } - this.__left = null; - return this.upper; - } -} +/** + * @typedef {[number, boolean]} RangeValue + */ -class BlockScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "block", upperScope, block, false); +/** + * @callback RangeValueCallback + * @param {RangeValue} rangeValue + * @returns {boolean} + */ +class Range { + /** + * @param {"left" | "right"} side + * @param {boolean} exclusive + * @returns {">" | ">=" | "<" | "<="} + */ + static getOperator(side, exclusive) { + if (side === "left") { + return exclusive ? ">" : ">="; } -} -class SwitchScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "switch", upperScope, block, false); - } -} + return exclusive ? "<" : "<="; + } + /** + * @param {number} value + * @param {boolean} logic is not logic applied + * @param {boolean} exclusive is range exclusive + * @returns {string} + */ -class FunctionScope extends Scope { - constructor(scopeManager, upperScope, block, isMethodDefinition) { - super(scopeManager, "function", upperScope, block, isMethodDefinition); - // section 9.2.13, FunctionDeclarationInstantiation. - // NOTE Arrow functions never have an arguments objects. - if (this.block.type !== Syntax.ArrowFunctionExpression) { - this.__defineArguments(); - } + static formatRight(value, logic, exclusive) { + if (logic === false) { + return Range.formatLeft(value, !logic, !exclusive); } - isArgumentsMaterialized() { - - // TODO(Constellation) - // We can more aggressive on this condition like this. - // - // function t() { - // // arguments of t is always hidden. - // function arguments() { - // } - // } - if (this.block.type === Syntax.ArrowFunctionExpression) { - return false; - } - - if (!this.isStatic()) { - return true; - } + return `should be ${Range.getOperator("right", exclusive)} ${value}`; + } + /** + * @param {number} value + * @param {boolean} logic is not logic applied + * @param {boolean} exclusive is range exclusive + * @returns {string} + */ - const variable = this.set.get("arguments"); - assert(variable, "Always have arguments variable."); - return variable.tainted || variable.references.length !== 0; + static formatLeft(value, logic, exclusive) { + if (logic === false) { + return Range.formatRight(value, !logic, !exclusive); } - isThisMaterialized() { - if (!this.isStatic()) { - return true; - } - return this.thisFound; - } + return `should be ${Range.getOperator("left", exclusive)} ${value}`; + } + /** + * @param {number} start left side value + * @param {number} end right side value + * @param {boolean} startExclusive is range exclusive from left side + * @param {boolean} endExclusive is range exclusive from right side + * @param {boolean} logic is not logic applied + * @returns {string} + */ - __defineArguments() { - this.__defineGeneric( - "arguments", - this.set, - this.variables, - null, - null - ); - this.taints.set("arguments", true); - } - // References in default parameters isn't resolved to variables which are in their function body. - // const x = 1 - // function f(a = x) { // This `x` is resolved to the `x` in the outer scope. - // const x = 2 - // console.log(a) - // } - __isValidResolution(ref, variable) { + static formatRange(start, end, startExclusive, endExclusive, logic) { + let result = "should be"; + result += ` ${Range.getOperator(logic ? "left" : "right", logic ? startExclusive : !startExclusive)} ${start} `; + result += logic ? "and" : "or"; + result += ` ${Range.getOperator(logic ? "right" : "left", logic ? endExclusive : !endExclusive)} ${end}`; + return result; + } + /** + * @param {Array} values + * @param {boolean} logic is not logic applied + * @return {RangeValue} computed value and it's exclusive flag + */ - // If `options.nodejsScope` is true, `this.block` becomes a Program node. - if (this.block.type === "Program") { - return true; - } - const bodyStart = this.block.body.range[0]; + static getRangeValue(values, logic) { + let minMax = logic ? Infinity : -Infinity; + let j = -1; + const predicate = logic ? + /** @type {RangeValueCallback} */ + ([value]) => value <= minMax : + /** @type {RangeValueCallback} */ + ([value]) => value >= minMax; - // It's invalid resolution in the following case: - return !( - variable.scope === this && - ref.identifier.range[0] < bodyStart && // the reference is in the parameter part. - variable.defs.every(d => d.name.range[0] >= bodyStart) // the variable is in the body. - ); + for (let i = 0; i < values.length; i++) { + if (predicate(values[i])) { + [minMax] = values[i]; + j = i; + } } -} -class ForScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "for", upperScope, block, false); + if (j > -1) { + return values[j]; } -} -class ClassScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "class", upperScope, block, false); - } -} + return [Infinity, true]; + } -module.exports = { - Scope, - GlobalScope, - ModuleScope, - FunctionExpressionNameScope, - CatchScope, - WithScope, - BlockScope, - SwitchScope, - FunctionScope, - ForScope, - ClassScope -}; + constructor() { + /** @type {Array} */ + this._left = []; + /** @type {Array} */ -/* vim: set sw=4 ts=4 et tw=80 : */ + this._right = []; + } + /** + * @param {number} value + * @param {boolean=} exclusive + */ -/***/ }), + left(value, exclusive = false) { + this._left.push([value, exclusive]); + } + /** + * @param {number} value + * @param {boolean=} exclusive + */ -/***/ 82971: -/***/ (function(module) { - -"use strict"; -/* - Copyright (C) 2015 Yusuke Suzuki - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + right(value, exclusive = false) { + this._right.push([value, exclusive]); + } + /** + * @param {boolean} logic is not logic applied + * @return {string} "smart" range string representation + */ - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ + format(logic = true) { + const [start, leftExclusive] = Range.getRangeValue(this._left, logic); + const [end, rightExclusive] = Range.getRangeValue(this._right, !logic); + if (!Number.isFinite(start) && !Number.isFinite(end)) { + return ""; + } -/** - * A Variable represents a locally scoped identifier. These include arguments to - * functions. - * @class Variable - */ -class Variable { - constructor(name, scope) { + const realStart = leftExclusive ? start + 1 : start; + const realEnd = rightExclusive ? end - 1 : end; // e.g. 5 < x < 7, 5 < x <= 6, 6 <= x <= 6 - /** - * The variable name, as given in the source code. - * @member {String} Variable#name - */ - this.name = name; + if (realStart === realEnd) { + return `should be ${logic ? "" : "!"}= ${realStart}`; + } // e.g. 4 < x < ∞ - /** - * List of defining occurrences of this variable (like in 'var ...' - * statements or as parameter), as AST nodes. - * @member {espree.Identifier[]} Variable#identifiers - */ - this.identifiers = []; - /** - * List of {@link Reference|references} of this variable (excluding parameter entries) - * in its defining scope and all nested scopes. For defining - * occurrences only see {@link Variable#defs}. - * @member {Reference[]} Variable#references - */ - this.references = []; + if (Number.isFinite(start) && !Number.isFinite(end)) { + return Range.formatLeft(start, logic, leftExclusive); + } // e.g. ∞ < x < 4 - /** - * List of defining occurrences of this variable (like in 'var ...' - * statements or as parameter), as custom objects. - * @member {Definition[]} Variable#defs - */ - this.defs = []; - this.tainted = false; + if (!Number.isFinite(start) && Number.isFinite(end)) { + return Range.formatRight(end, logic, rightExclusive); + } - /** - * Whether this is a stack variable. - * @member {boolean} Variable#stack - */ - this.stack = true; + return Range.formatRange(start, end, leftExclusive, rightExclusive, logic); + } - /** - * Reference to the enclosing Scope. - * @member {Scope} Variable#scope - */ - this.scope = scope; - } } -Variable.CatchClause = "CatchClause"; -Variable.Parameter = "Parameter"; -Variable.FunctionName = "FunctionName"; -Variable.ClassName = "ClassName"; -Variable.Variable = "Variable"; -Variable.ImportBinding = "ImportBinding"; -Variable.ImplicitGlobalVariable = "ImplicitGlobalVariable"; - -module.exports = Variable; +module.exports = Range; -/* vim: set sw=4 ts=4 et tw=80 : */ +/***/ }), +/***/ 79926: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/***/ }), +"use strict"; -/***/ 81217: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -/* - Copyright (C) 2014 Yusuke Suzuki +const Range = __webpack_require__(81184); +/** @typedef {import("../validate").Schema} Schema */ - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: +/** + * @param {Schema} schema + * @param {boolean} logic + * @return {string[]} + */ - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -(function () { - 'use strict'; +module.exports.stringHints = function stringHints(schema, logic) { + const hints = []; + let type = "string"; + const currentSchema = { ...schema + }; - var estraverse = __webpack_require__(50165); + if (!logic) { + const tmpLength = currentSchema.minLength; + const tmpFormat = currentSchema.formatMinimum; + const tmpExclusive = currentSchema.formatExclusiveMaximum; + currentSchema.minLength = currentSchema.maxLength; + currentSchema.maxLength = tmpLength; + currentSchema.formatMinimum = currentSchema.formatMaximum; + currentSchema.formatMaximum = tmpFormat; + currentSchema.formatExclusiveMaximum = !currentSchema.formatExclusiveMinimum; + currentSchema.formatExclusiveMinimum = !tmpExclusive; + } - function isNode(node) { - if (node == null) { - return false; - } - return typeof node === 'object' && typeof node.type === 'string'; + if (typeof currentSchema.minLength === "number") { + if (currentSchema.minLength === 1) { + type = "non-empty string"; + } else { + const length = Math.max(currentSchema.minLength - 1, 0); + hints.push(`should be longer than ${length} character${length > 1 ? "s" : ""}`); } + } - function isProperty(nodeType, key) { - return (nodeType === estraverse.Syntax.ObjectExpression || nodeType === estraverse.Syntax.ObjectPattern) && key === 'properties'; + if (typeof currentSchema.maxLength === "number") { + if (currentSchema.maxLength === 0) { + type = "empty string"; + } else { + const length = currentSchema.maxLength + 1; + hints.push(`should be shorter than ${length} character${length > 1 ? "s" : ""}`); } + } - function Visitor(visitor, options) { - options = options || {}; + if (currentSchema.pattern) { + hints.push(`should${logic ? "" : " not"} match pattern ${JSON.stringify(currentSchema.pattern)}`); + } - this.__visitor = visitor || this; - this.__childVisitorKeys = options.childVisitorKeys - ? Object.assign({}, estraverse.VisitorKeys, options.childVisitorKeys) - : estraverse.VisitorKeys; - if (options.fallback === 'iteration') { - this.__fallback = Object.keys; - } else if (typeof options.fallback === 'function') { - this.__fallback = options.fallback; - } - } + if (currentSchema.format) { + hints.push(`should${logic ? "" : " not"} match format ${JSON.stringify(currentSchema.format)}`); + } - /* Default method for visiting children. - * When you need to call default visiting operation inside custom visiting - * operation, you can use it with `this.visitChildren(node)`. - */ - Visitor.prototype.visitChildren = function (node) { - var type, children, i, iz, j, jz, child; + if (currentSchema.formatMinimum) { + hints.push(`should be ${currentSchema.formatExclusiveMinimum ? ">" : ">="} ${JSON.stringify(currentSchema.formatMinimum)}`); + } - if (node == null) { - return; - } + if (currentSchema.formatMaximum) { + hints.push(`should be ${currentSchema.formatExclusiveMaximum ? "<" : "<="} ${JSON.stringify(currentSchema.formatMaximum)}`); + } - type = node.type || estraverse.Syntax.Property; + return [type].concat(hints); +}; +/** + * @param {Schema} schema + * @param {boolean} logic + * @return {string[]} + */ - children = this.__childVisitorKeys[type]; - if (!children) { - if (this.__fallback) { - children = this.__fallback(node); - } else { - throw new Error('Unknown node type ' + type + '.'); - } - } - for (i = 0, iz = children.length; i < iz; ++i) { - child = node[children[i]]; - if (child) { - if (Array.isArray(child)) { - for (j = 0, jz = child.length; j < jz; ++j) { - if (child[j]) { - if (isNode(child[j]) || isProperty(type, children[i])) { - this.visit(child[j]); - } - } - } - } else if (isNode(child)) { - this.visit(child); - } - } - } - }; +module.exports.numberHints = function numberHints(schema, logic) { + const hints = [schema.type === "integer" ? "integer" : "number"]; + const range = new Range(); - /* Dispatching node. */ - Visitor.prototype.visit = function (node) { - var type; + if (typeof schema.minimum === "number") { + range.left(schema.minimum); + } - if (node == null) { - return; - } + if (typeof schema.exclusiveMinimum === "number") { + range.left(schema.exclusiveMinimum, true); + } - type = node.type || estraverse.Syntax.Property; - if (this.__visitor[type]) { - this.__visitor[type].call(this, node); - return; - } - this.visitChildren(node); - }; + if (typeof schema.maximum === "number") { + range.right(schema.maximum); + } - exports.version = __webpack_require__(12166).version; - exports.Visitor = Visitor; - exports.visit = function (node, visitor, options) { - var v = new Visitor(visitor, options); - v.visit(node); - }; -}()); -/* vim: set sw=4 ts=4 et tw=80 : */ + if (typeof schema.exclusiveMaximum === "number") { + range.right(schema.exclusiveMaximum, true); + } + const rangeFormat = range.format(logic); -/***/ }), + if (rangeFormat) { + hints.push(rangeFormat); + } -/***/ 50165: -/***/ (function(__unused_webpack_module, exports) { + if (typeof schema.multipleOf === "number") { + hints.push(`should${logic ? "" : " not"} be multiple of ${schema.multipleOf}`); + } -/* - Copyright (C) 2012-2013 Yusuke Suzuki - Copyright (C) 2012 Ariya Hidayat + return hints; +}; - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: +/***/ }), - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. +/***/ 74315: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -/*jslint vars:false, bitwise:true*/ -/*jshint indent:4*/ -/*global exports:true*/ -(function clone(exports) { - 'use strict'; - var Syntax, - VisitorOption, - VisitorKeys, - BREAK, - SKIP, - REMOVE; - function deepCopy(obj) { - var ret = {}, key, val; - for (key in obj) { - if (obj.hasOwnProperty(key)) { - val = obj[key]; - if (typeof val === 'object' && val !== null) { - ret[key] = deepCopy(val); - } else { - ret[key] = val; - } - } - } - return ret; - } - // based on LLVM libc++ upper_bound / lower_bound - // MIT License +const RuntimeGlobals = __webpack_require__(16475); +const WebpackError = __webpack_require__(53799); +const ConstDependency = __webpack_require__(76911); +const BasicEvaluatedExpression = __webpack_require__(950); +const { + toConstantDependency, + evaluateToString +} = __webpack_require__(93998); +const ChunkNameRuntimeModule = __webpack_require__(84519); +const GetFullHashRuntimeModule = __webpack_require__(88732); - function upperBound(array, func) { - var diff, len, i, current; +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ - len = array.length; - i = 0; +/* eslint-disable camelcase */ +const REPLACEMENTS = { + __webpack_require__: { + expr: RuntimeGlobals.require, + req: [RuntimeGlobals.require], + type: "function", + assign: false + }, + __webpack_public_path__: { + expr: RuntimeGlobals.publicPath, + req: [RuntimeGlobals.publicPath], + type: "string", + assign: true + }, + __webpack_base_uri__: { + expr: RuntimeGlobals.baseURI, + req: [RuntimeGlobals.baseURI], + type: "string", + assign: true + }, + __webpack_modules__: { + expr: RuntimeGlobals.moduleFactories, + req: [RuntimeGlobals.moduleFactories], + type: "object", + assign: false + }, + __webpack_chunk_load__: { + expr: RuntimeGlobals.ensureChunk, + req: [RuntimeGlobals.ensureChunk], + type: "function", + assign: true + }, + __non_webpack_require__: { + expr: "require", + req: null, + type: undefined, // type is not known, depends on environment + assign: true + }, + __webpack_nonce__: { + expr: RuntimeGlobals.scriptNonce, + req: [RuntimeGlobals.scriptNonce], + type: "string", + assign: true + }, + __webpack_hash__: { + expr: `${RuntimeGlobals.getFullHash}()`, + req: [RuntimeGlobals.getFullHash], + type: "string", + assign: false + }, + __webpack_chunkname__: { + expr: RuntimeGlobals.chunkName, + req: [RuntimeGlobals.chunkName], + type: "string", + assign: false + }, + __webpack_get_script_filename__: { + expr: RuntimeGlobals.getChunkScriptFilename, + req: [RuntimeGlobals.getChunkScriptFilename], + type: "function", + assign: true + }, + __webpack_runtime_id__: { + expr: RuntimeGlobals.runtimeId, + req: [RuntimeGlobals.runtimeId], + assign: false + }, + "require.onError": { + expr: RuntimeGlobals.uncaughtErrorHandler, + req: [RuntimeGlobals.uncaughtErrorHandler], + type: undefined, // type is not known, could be function or undefined + assign: true // is never a pattern + }, + __system_context__: { + expr: RuntimeGlobals.systemContext, + req: [RuntimeGlobals.systemContext], + type: "object", + assign: false + }, + __webpack_share_scopes__: { + expr: RuntimeGlobals.shareScopeMap, + req: [RuntimeGlobals.shareScopeMap], + type: "object", + assign: false + }, + __webpack_init_sharing__: { + expr: RuntimeGlobals.initializeSharing, + req: [RuntimeGlobals.initializeSharing], + type: "function", + assign: true + } +}; +/* eslint-enable camelcase */ - while (len) { - diff = len >>> 1; - current = i + diff; - if (func(array[current])) { - len = diff; - } else { - i = current + 1; - len -= diff + 1; - } - } - return i; - } +class APIPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "APIPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyTemplates.set( + ConstDependency, + new ConstDependency.Template() + ); - Syntax = { - AssignmentExpression: 'AssignmentExpression', - AssignmentPattern: 'AssignmentPattern', - ArrayExpression: 'ArrayExpression', - ArrayPattern: 'ArrayPattern', - ArrowFunctionExpression: 'ArrowFunctionExpression', - AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7. - BlockStatement: 'BlockStatement', - BinaryExpression: 'BinaryExpression', - BreakStatement: 'BreakStatement', - CallExpression: 'CallExpression', - CatchClause: 'CatchClause', - ChainExpression: 'ChainExpression', - ClassBody: 'ClassBody', - ClassDeclaration: 'ClassDeclaration', - ClassExpression: 'ClassExpression', - ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7. - ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7. - ConditionalExpression: 'ConditionalExpression', - ContinueStatement: 'ContinueStatement', - DebuggerStatement: 'DebuggerStatement', - DirectiveStatement: 'DirectiveStatement', - DoWhileStatement: 'DoWhileStatement', - EmptyStatement: 'EmptyStatement', - ExportAllDeclaration: 'ExportAllDeclaration', - ExportDefaultDeclaration: 'ExportDefaultDeclaration', - ExportNamedDeclaration: 'ExportNamedDeclaration', - ExportSpecifier: 'ExportSpecifier', - ExpressionStatement: 'ExpressionStatement', - ForStatement: 'ForStatement', - ForInStatement: 'ForInStatement', - ForOfStatement: 'ForOfStatement', - FunctionDeclaration: 'FunctionDeclaration', - FunctionExpression: 'FunctionExpression', - GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7. - Identifier: 'Identifier', - IfStatement: 'IfStatement', - ImportExpression: 'ImportExpression', - ImportDeclaration: 'ImportDeclaration', - ImportDefaultSpecifier: 'ImportDefaultSpecifier', - ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', - ImportSpecifier: 'ImportSpecifier', - Literal: 'Literal', - LabeledStatement: 'LabeledStatement', - LogicalExpression: 'LogicalExpression', - MemberExpression: 'MemberExpression', - MetaProperty: 'MetaProperty', - MethodDefinition: 'MethodDefinition', - ModuleSpecifier: 'ModuleSpecifier', - NewExpression: 'NewExpression', - ObjectExpression: 'ObjectExpression', - ObjectPattern: 'ObjectPattern', - Program: 'Program', - Property: 'Property', - RestElement: 'RestElement', - ReturnStatement: 'ReturnStatement', - SequenceExpression: 'SequenceExpression', - SpreadElement: 'SpreadElement', - Super: 'Super', - SwitchStatement: 'SwitchStatement', - SwitchCase: 'SwitchCase', - TaggedTemplateExpression: 'TaggedTemplateExpression', - TemplateElement: 'TemplateElement', - TemplateLiteral: 'TemplateLiteral', - ThisExpression: 'ThisExpression', - ThrowStatement: 'ThrowStatement', - TryStatement: 'TryStatement', - UnaryExpression: 'UnaryExpression', - UpdateExpression: 'UpdateExpression', - VariableDeclaration: 'VariableDeclaration', - VariableDeclarator: 'VariableDeclarator', - WhileStatement: 'WhileStatement', - WithStatement: 'WithStatement', - YieldExpression: 'YieldExpression' - }; - - VisitorKeys = { - AssignmentExpression: ['left', 'right'], - AssignmentPattern: ['left', 'right'], - ArrayExpression: ['elements'], - ArrayPattern: ['elements'], - ArrowFunctionExpression: ['params', 'body'], - AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7. - BlockStatement: ['body'], - BinaryExpression: ['left', 'right'], - BreakStatement: ['label'], - CallExpression: ['callee', 'arguments'], - CatchClause: ['param', 'body'], - ChainExpression: ['expression'], - ClassBody: ['body'], - ClassDeclaration: ['id', 'superClass', 'body'], - ClassExpression: ['id', 'superClass', 'body'], - ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7. - ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. - ConditionalExpression: ['test', 'consequent', 'alternate'], - ContinueStatement: ['label'], - DebuggerStatement: [], - DirectiveStatement: [], - DoWhileStatement: ['body', 'test'], - EmptyStatement: [], - ExportAllDeclaration: ['source'], - ExportDefaultDeclaration: ['declaration'], - ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], - ExportSpecifier: ['exported', 'local'], - ExpressionStatement: ['expression'], - ForStatement: ['init', 'test', 'update', 'body'], - ForInStatement: ['left', 'right', 'body'], - ForOfStatement: ['left', 'right', 'body'], - FunctionDeclaration: ['id', 'params', 'body'], - FunctionExpression: ['id', 'params', 'body'], - GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. - Identifier: [], - IfStatement: ['test', 'consequent', 'alternate'], - ImportExpression: ['source'], - ImportDeclaration: ['specifiers', 'source'], - ImportDefaultSpecifier: ['local'], - ImportNamespaceSpecifier: ['local'], - ImportSpecifier: ['imported', 'local'], - Literal: [], - LabeledStatement: ['label', 'body'], - LogicalExpression: ['left', 'right'], - MemberExpression: ['object', 'property'], - MetaProperty: ['meta', 'property'], - MethodDefinition: ['key', 'value'], - ModuleSpecifier: [], - NewExpression: ['callee', 'arguments'], - ObjectExpression: ['properties'], - ObjectPattern: ['properties'], - Program: ['body'], - Property: ['key', 'value'], - RestElement: [ 'argument' ], - ReturnStatement: ['argument'], - SequenceExpression: ['expressions'], - SpreadElement: ['argument'], - Super: [], - SwitchStatement: ['discriminant', 'cases'], - SwitchCase: ['test', 'consequent'], - TaggedTemplateExpression: ['tag', 'quasi'], - TemplateElement: [], - TemplateLiteral: ['quasis', 'expressions'], - ThisExpression: [], - ThrowStatement: ['argument'], - TryStatement: ['block', 'handler', 'finalizer'], - UnaryExpression: ['argument'], - UpdateExpression: ['argument'], - VariableDeclaration: ['declarations'], - VariableDeclarator: ['id', 'init'], - WhileStatement: ['test', 'body'], - WithStatement: ['object', 'body'], - YieldExpression: ['argument'] - }; + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.chunkName) + .tap("APIPlugin", chunk => { + compilation.addRuntimeModule( + chunk, + new ChunkNameRuntimeModule(chunk.name) + ); + return true; + }); - // unique id - BREAK = {}; - SKIP = {}; - REMOVE = {}; + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.getFullHash) + .tap("APIPlugin", (chunk, set) => { + compilation.addRuntimeModule(chunk, new GetFullHashRuntimeModule()); + return true; + }); - VisitorOption = { - Break: BREAK, - Skip: SKIP, - Remove: REMOVE - }; + /** + * @param {JavascriptParser} parser the parser + */ + const handler = parser => { + Object.keys(REPLACEMENTS).forEach(key => { + const info = REPLACEMENTS[key]; + parser.hooks.expression + .for(key) + .tap( + "APIPlugin", + toConstantDependency(parser, info.expr, info.req) + ); + if (info.assign === false) { + parser.hooks.assign.for(key).tap("APIPlugin", expr => { + const err = new WebpackError(`${key} must not be assigned`); + err.loc = expr.loc; + throw err; + }); + } + if (info.type) { + parser.hooks.evaluateTypeof + .for(key) + .tap("APIPlugin", evaluateToString(info.type)); + } + }); - function Reference(parent, key) { - this.parent = parent; - this.key = key; - } + parser.hooks.expression + .for("__webpack_layer__") + .tap("APIPlugin", expr => { + const dep = new ConstDependency( + JSON.stringify(parser.state.module.layer), + expr.range + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + parser.hooks.evaluateIdentifier + .for("__webpack_layer__") + .tap("APIPlugin", expr => + (parser.state.module.layer === null + ? new BasicEvaluatedExpression().setNull() + : new BasicEvaluatedExpression().setString( + parser.state.module.layer + ) + ).setRange(expr.range) + ); + parser.hooks.evaluateTypeof + .for("__webpack_layer__") + .tap("APIPlugin", expr => + new BasicEvaluatedExpression() + .setString( + parser.state.module.layer === null ? "object" : "string" + ) + .setRange(expr.range) + ); - Reference.prototype.replace = function replace(node) { - this.parent[this.key] = node; - }; + parser.hooks.expression + .for("__webpack_module__.id") + .tap("APIPlugin", expr => { + parser.state.module.buildInfo.moduleConcatenationBailout = + "__webpack_module__.id"; + const dep = new ConstDependency( + parser.state.module.moduleArgument + ".id", + expr.range, + [RuntimeGlobals.moduleId] + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); - Reference.prototype.remove = function remove() { - if (Array.isArray(this.parent)) { - this.parent.splice(this.key, 1); - return true; - } else { - this.replace(null); - return false; - } - }; + parser.hooks.expression + .for("__webpack_module__") + .tap("APIPlugin", expr => { + parser.state.module.buildInfo.moduleConcatenationBailout = + "__webpack_module__"; + const dep = new ConstDependency( + parser.state.module.moduleArgument, + expr.range, + [RuntimeGlobals.module] + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + parser.hooks.evaluateTypeof + .for("__webpack_module__") + .tap("APIPlugin", evaluateToString("object")); + }; - function Element(node, path, wrap, ref) { - this.node = node; - this.path = path; - this.wrap = wrap; - this.ref = ref; - } + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("APIPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("APIPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("APIPlugin", handler); + } + ); + } +} - function Controller() { } +module.exports = APIPlugin; - // API: - // return property path array from root to current node - Controller.prototype.path = function path() { - var i, iz, j, jz, result, element; - function addToPath(result, path) { - if (Array.isArray(path)) { - for (j = 0, jz = path.length; j < jz; ++j) { - result.push(path[j]); - } - } else { - result.push(path); - } - } +/***/ }), - // root node - if (!this.__current.path) { - return null; - } +/***/ 77198: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // first node is sentinel, second node is root element - result = []; - for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { - element = this.__leavelist[i]; - addToPath(result, element.path); - } - addToPath(result, this.__current.path); - return result; - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ - // API: - // return type of current node - Controller.prototype.type = function () { - var node = this.current(); - return node.type || this.__current.wrap; - }; - // API: - // return array of parent elements - Controller.prototype.parents = function parents() { - var i, iz, result; - // first node is sentinel - result = []; - for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { - result.push(this.__leavelist[i].node); - } +const WebpackError = __webpack_require__(53799); +const CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/; - return result; - }; +/** + * @param {string=} method method name + * @returns {string} message + */ +function createMessage(method) { + return `Abstract method${method ? " " + method : ""}. Must be overridden.`; +} - // API: - // return current node - Controller.prototype.current = function current() { - return this.__current.node; - }; +/** + * @constructor + */ +function Message() { + /** @type {string} */ + this.stack = undefined; + Error.captureStackTrace(this); + /** @type {RegExpMatchArray} */ + const match = this.stack.split("\n")[3].match(CURRENT_METHOD_REGEXP); - Controller.prototype.__execute = function __execute(callback, element) { - var previous, result; + this.message = match && match[1] ? createMessage(match[1]) : createMessage(); +} - result = undefined; +/** + * Error for abstract method + * @example + * class FooClass { + * abstractMethod() { + * throw new AbstractMethodError(); // error message: Abstract method FooClass.abstractMethod. Must be overridden. + * } + * } + * + */ +class AbstractMethodError extends WebpackError { + constructor() { + super(new Message().message); + this.name = "AbstractMethodError"; + } +} - previous = this.__current; - this.__current = element; - this.__state = null; - if (callback) { - result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); - } - this.__current = previous; +module.exports = AbstractMethodError; - return result; - }; - // API: - // notify control skip / break - Controller.prototype.notify = function notify(flag) { - this.__state = flag; - }; +/***/ }), - // API: - // skip child nodes of current node - Controller.prototype.skip = function () { - this.notify(SKIP); - }; +/***/ 47736: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // API: - // break traversals - Controller.prototype['break'] = function () { - this.notify(BREAK); - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // API: - // remove node - Controller.prototype.remove = function () { - this.notify(REMOVE); - }; - Controller.prototype.__initialize = function(root, visitor) { - this.visitor = visitor; - this.root = root; - this.__worklist = []; - this.__leavelist = []; - this.__current = null; - this.__state = null; - this.__fallback = null; - if (visitor.fallback === 'iteration') { - this.__fallback = Object.keys; - } else if (typeof visitor.fallback === 'function') { - this.__fallback = visitor.fallback; - } - this.__keys = VisitorKeys; - if (visitor.keys) { - this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); - } - }; +const DependenciesBlock = __webpack_require__(71040); +const makeSerializable = __webpack_require__(33032); - function isNode(node) { - if (node == null) { - return false; - } - return typeof node === 'object' && typeof node.type === 'string'; - } +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./ChunkGroup")} ChunkGroup */ +/** @typedef {import("./ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */ +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./util/Hash")} Hash */ - function isProperty(nodeType, key) { - return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; - } - - function candidateExistsInLeaveList(leavelist, candidate) { - for (var i = leavelist.length - 1; i >= 0; --i) { - if (leavelist[i].node === candidate) { - return true; - } - } - return false; - } +class AsyncDependenciesBlock extends DependenciesBlock { + /** + * @param {ChunkGroupOptions & { entryOptions?: EntryOptions }} groupOptions options for the group + * @param {DependencyLocation=} loc the line of code + * @param {string=} request the request + */ + constructor(groupOptions, loc, request) { + super(); + if (typeof groupOptions === "string") { + groupOptions = { name: groupOptions }; + } else if (!groupOptions) { + groupOptions = { name: undefined }; + } + this.groupOptions = groupOptions; + this.loc = loc; + this.request = request; + this._stringifiedGroupOptions = undefined; + } - Controller.prototype.traverse = function traverse(root, visitor) { - var worklist, - leavelist, - element, - node, - nodeType, - ret, - key, - current, - current2, - candidates, - candidate, - sentinel; + /** + * @returns {string} The name of the chunk + */ + get chunkName() { + return this.groupOptions.name; + } - this.__initialize(root, visitor); + /** + * @param {string} value The new chunk name + * @returns {void} + */ + set chunkName(value) { + if (this.groupOptions.name !== value) { + this.groupOptions.name = value; + this._stringifiedGroupOptions = undefined; + } + } - sentinel = {}; + /** + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + const { chunkGraph } = context; + if (this._stringifiedGroupOptions === undefined) { + this._stringifiedGroupOptions = JSON.stringify(this.groupOptions); + } + const chunkGroup = chunkGraph.getBlockChunkGroup(this); + hash.update( + `${this._stringifiedGroupOptions}${chunkGroup ? chunkGroup.id : ""}` + ); + super.updateHash(hash, context); + } - // reference - worklist = this.__worklist; - leavelist = this.__leavelist; + serialize(context) { + const { write } = context; + write(this.groupOptions); + write(this.loc); + write(this.request); + super.serialize(context); + } - // initialize - worklist.push(new Element(root, null, null, null)); - leavelist.push(new Element(null, null, null, null)); + deserialize(context) { + const { read } = context; + this.groupOptions = read(); + this.loc = read(); + this.request = read(); + super.deserialize(context); + } +} - while (worklist.length) { - element = worklist.pop(); +makeSerializable(AsyncDependenciesBlock, "webpack/lib/AsyncDependenciesBlock"); - if (element === sentinel) { - element = leavelist.pop(); +Object.defineProperty(AsyncDependenciesBlock.prototype, "module", { + get() { + throw new Error( + "module property was removed from AsyncDependenciesBlock (it's not needed)" + ); + }, + set() { + throw new Error( + "module property was removed from AsyncDependenciesBlock (it's not needed)" + ); + } +}); - ret = this.__execute(visitor.leave, element); +module.exports = AsyncDependenciesBlock; - if (this.__state === BREAK || ret === BREAK) { - return; - } - continue; - } - if (element.node) { +/***/ }), - ret = this.__execute(visitor.enter, element); +/***/ 30111: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (this.__state === BREAK || ret === BREAK) { - return; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Sean Larkin @thelarkinn +*/ - worklist.push(sentinel); - leavelist.push(element); - if (this.__state === SKIP || ret === SKIP) { - continue; - } - node = element.node; - nodeType = node.type || element.wrap; - candidates = this.__keys[nodeType]; - if (!candidates) { - if (this.__fallback) { - candidates = this.__fallback(node); - } else { - throw new Error('Unknown node type ' + nodeType + '.'); - } - } +const WebpackError = __webpack_require__(53799); - current = candidates.length; - while ((current -= 1) >= 0) { - key = candidates[current]; - candidate = node[key]; - if (!candidate) { - continue; - } +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Module")} Module */ - if (Array.isArray(candidate)) { - current2 = candidate.length; - while ((current2 -= 1) >= 0) { - if (!candidate[current2]) { - continue; - } +class AsyncDependencyToInitialChunkError extends WebpackError { + /** + * Creates an instance of AsyncDependencyToInitialChunkError. + * @param {string} chunkName Name of Chunk + * @param {Module} module module tied to dependency + * @param {DependencyLocation} loc location of dependency + */ + constructor(chunkName, module, loc) { + super( + `It's not allowed to load an initial chunk on demand. The chunk name "${chunkName}" is already used by an entrypoint.` + ); - if (candidateExistsInLeaveList(leavelist, candidate[current2])) { - continue; - } + this.name = "AsyncDependencyToInitialChunkError"; + this.module = module; + this.loc = loc; + } +} - if (isProperty(nodeType, candidates[current])) { - element = new Element(candidate[current2], [key, current2], 'Property', null); - } else if (isNode(candidate[current2])) { - element = new Element(candidate[current2], [key, current2], null, null); - } else { - continue; - } - worklist.push(element); - } - } else if (isNode(candidate)) { - if (candidateExistsInLeaveList(leavelist, candidate)) { - continue; - } +module.exports = AsyncDependencyToInitialChunkError; - worklist.push(new Element(candidate, key, null, null)); - } - } - } - } - }; - Controller.prototype.replace = function replace(root, visitor) { - var worklist, - leavelist, - node, - nodeType, - target, - element, - current, - current2, - candidates, - candidate, - sentinel, - outer, - key; +/***/ }), - function removeElem(element) { - var i, - key, - nextElem, - parent; +/***/ 17714: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (element.ref.remove()) { - // When the reference is an element of an array. - key = element.ref.key; - parent = element.ref.parent; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // If removed from array, then decrease following items' keys. - i = worklist.length; - while (i--) { - nextElem = worklist[i]; - if (nextElem.ref && nextElem.ref.parent === parent) { - if (nextElem.ref.key < key) { - break; - } - --nextElem.ref.key; - } - } - } - } - this.__initialize(root, visitor); - sentinel = {}; +const asyncLib = __webpack_require__(78175); +const NormalModule = __webpack_require__(39); +const PrefetchDependency = __webpack_require__(31618); - // reference - worklist = this.__worklist; - leavelist = this.__leavelist; +/** @typedef {import("./Compiler")} Compiler */ - // initialize - outer = { - root: root - }; - element = new Element(root, null, null, new Reference(outer, 'root')); - worklist.push(element); - leavelist.push(element); +class AutomaticPrefetchPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "AutomaticPrefetchPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + PrefetchDependency, + normalModuleFactory + ); + } + ); + let lastModules = null; + compiler.hooks.afterCompile.tap("AutomaticPrefetchPlugin", compilation => { + lastModules = []; - while (worklist.length) { - element = worklist.pop(); + for (const m of compilation.modules) { + if (m instanceof NormalModule) { + lastModules.push({ + context: m.context, + request: m.request + }); + } + } + }); + compiler.hooks.make.tapAsync( + "AutomaticPrefetchPlugin", + (compilation, callback) => { + if (!lastModules) return callback(); + asyncLib.forEach( + lastModules, + (m, callback) => { + compilation.addModuleChain( + m.context || compiler.context, + new PrefetchDependency(`!!${m.request}`), + callback + ); + }, + err => { + lastModules = null; + callback(err); + } + ); + } + ); + } +} +module.exports = AutomaticPrefetchPlugin; - if (element === sentinel) { - element = leavelist.pop(); - target = this.__execute(visitor.leave, element); +/***/ }), - // node may be replaced with null, - // so distinguish between undefined and null in this place - if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { - // replace - element.ref.replace(target); - } +/***/ 21242: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (this.__state === REMOVE || target === REMOVE) { - removeElem(element); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (this.__state === BREAK || target === BREAK) { - return outer.root; - } - continue; - } - target = this.__execute(visitor.enter, element); - // node may be replaced with null, - // so distinguish between undefined and null in this place - if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { - // replace - element.ref.replace(target); - element.node = target; - } +const { ConcatSource } = __webpack_require__(51255); +const Compilation = __webpack_require__(85720); +const ModuleFilenameHelpers = __webpack_require__(88821); +const Template = __webpack_require__(1626); +const createSchemaValidation = __webpack_require__(32540); - if (this.__state === REMOVE || target === REMOVE) { - removeElem(element); - element.node = null; - } +/** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginArgument} BannerPluginArgument */ +/** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginOptions} BannerPluginOptions */ +/** @typedef {import("./Compiler")} Compiler */ - if (this.__state === BREAK || target === BREAK) { - return outer.root; - } +const validate = createSchemaValidation( + __webpack_require__(42173), + () => __webpack_require__(49052), + { + name: "Banner Plugin", + baseDataPath: "options" + } +); - // node may be null - node = element.node; - if (!node) { - continue; - } +const wrapComment = str => { + if (!str.includes("\n")) { + return Template.toComment(str); + } + return `/*!\n * ${str + .replace(/\*\//g, "* /") + .split("\n") + .join("\n * ") + .replace(/\s+\n/g, "\n") + .trimRight()}\n */`; +}; - worklist.push(sentinel); - leavelist.push(element); +class BannerPlugin { + /** + * @param {BannerPluginArgument} options options object + */ + constructor(options) { + if (typeof options === "string" || typeof options === "function") { + options = { + banner: options + }; + } - if (this.__state === SKIP || target === SKIP) { - continue; - } + validate(options); - nodeType = node.type || element.wrap; - candidates = this.__keys[nodeType]; - if (!candidates) { - if (this.__fallback) { - candidates = this.__fallback(node); - } else { - throw new Error('Unknown node type ' + nodeType + '.'); - } - } + this.options = options; - current = candidates.length; - while ((current -= 1) >= 0) { - key = candidates[current]; - candidate = node[key]; - if (!candidate) { - continue; - } + const bannerOption = options.banner; + if (typeof bannerOption === "function") { + const getBanner = bannerOption; + this.banner = this.options.raw + ? getBanner + : data => wrapComment(getBanner(data)); + } else { + const banner = this.options.raw + ? bannerOption + : wrapComment(bannerOption); + this.banner = () => banner; + } + } - if (Array.isArray(candidate)) { - current2 = candidate.length; - while ((current2 -= 1) >= 0) { - if (!candidate[current2]) { - continue; - } - if (isProperty(nodeType, candidates[current])) { - element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); - } else if (isNode(candidate[current2])) { - element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); - } else { - continue; - } - worklist.push(element); - } - } else if (isNode(candidate)) { - worklist.push(new Element(candidate, key, null, new Reference(node, key))); - } - } - } + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const options = this.options; + const banner = this.banner; + const matchObject = ModuleFilenameHelpers.matchObject.bind( + undefined, + options + ); - return outer.root; - }; + compiler.hooks.compilation.tap("BannerPlugin", compilation => { + compilation.hooks.processAssets.tap( + { + name: "BannerPlugin", + stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS + }, + () => { + for (const chunk of compilation.chunks) { + if (options.entryOnly && !chunk.canBeInitial()) { + continue; + } - function traverse(root, visitor) { - var controller = new Controller(); - return controller.traverse(root, visitor); - } + for (const file of chunk.files) { + if (!matchObject(file)) { + continue; + } - function replace(root, visitor) { - var controller = new Controller(); - return controller.replace(root, visitor); - } + const data = { + chunk, + filename: file + }; - function extendCommentRange(comment, tokens) { - var target; + const comment = compilation.getPath(banner, data); - target = upperBound(tokens, function search(token) { - return token.range[0] > comment.range[0]; - }); + compilation.updateAsset( + file, + old => new ConcatSource(comment, "\n", old) + ); + } + } + } + ); + }); + } +} - comment.extendedRange = [comment.range[0], comment.range[1]]; +module.exports = BannerPlugin; - if (target !== tokens.length) { - comment.extendedRange[1] = tokens[target].range[0]; - } - target -= 1; - if (target >= 0) { - comment.extendedRange[0] = tokens[target].range[1]; - } +/***/ }), - return comment; - } +/***/ 7592: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - function attachComments(tree, providedComments, tokens) { - // At first, we should calculate extended comment ranges. - var comments = [], comment, len, i, cursor; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (!tree.range) { - throw new Error('attachComments needs range information'); - } - // tokens array is empty, we attach comments to tree as 'leadingComments' - if (!tokens.length) { - if (providedComments.length) { - for (i = 0, len = providedComments.length; i < len; i += 1) { - comment = deepCopy(providedComments[i]); - comment.extendedRange = [0, tree.range[0]]; - comments.push(comment); - } - tree.leadingComments = comments; - } - return tree; - } - for (i = 0, len = providedComments.length; i < len; i += 1) { - comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); - } +const { AsyncParallelHook, AsyncSeriesBailHook, SyncHook } = __webpack_require__(6967); +const { + makeWebpackError, + makeWebpackErrorCallback +} = __webpack_require__(11351); - // This is based on John Freeman's implementation. - cursor = 0; - traverse(tree, { - enter: function (node) { - var comment; +/** @typedef {import("./WebpackError")} WebpackError */ - while (cursor < comments.length) { - comment = comments[cursor]; - if (comment.extendedRange[1] > node.range[0]) { - break; - } +/** + * @typedef {Object} Etag + * @property {function(): string} toString + */ - if (comment.extendedRange[1] === node.range[0]) { - if (!node.leadingComments) { - node.leadingComments = []; - } - node.leadingComments.push(comment); - comments.splice(cursor, 1); - } else { - cursor += 1; - } - } +/** + * @template T + * @callback CallbackCache + * @param {(WebpackError | null)=} err + * @param {T=} result + * @returns {void} + */ - // already out of owned node - if (cursor === comments.length) { - return VisitorOption.Break; - } +/** + * @callback GotHandler + * @param {any} result + * @param {function(Error=): void} callback + * @returns {void} + */ - if (comments[cursor].extendedRange[0] > node.range[1]) { - return VisitorOption.Skip; - } - } - }); +const needCalls = (times, callback) => { + return err => { + if (--times === 0) { + return callback(err); + } + if (err && times > 0) { + times = 0; + return callback(err); + } + }; +}; - cursor = 0; - traverse(tree, { - leave: function (node) { - var comment; +class Cache { + constructor() { + this.hooks = { + /** @type {AsyncSeriesBailHook<[string, Etag | null, GotHandler[]], any>} */ + get: new AsyncSeriesBailHook(["identifier", "etag", "gotHandlers"]), + /** @type {AsyncParallelHook<[string, Etag | null, any]>} */ + store: new AsyncParallelHook(["identifier", "etag", "data"]), + /** @type {AsyncParallelHook<[Iterable]>} */ + storeBuildDependencies: new AsyncParallelHook(["dependencies"]), + /** @type {SyncHook<[]>} */ + beginIdle: new SyncHook([]), + /** @type {AsyncParallelHook<[]>} */ + endIdle: new AsyncParallelHook([]), + /** @type {AsyncParallelHook<[]>} */ + shutdown: new AsyncParallelHook([]) + }; + } - while (cursor < comments.length) { - comment = comments[cursor]; - if (node.range[1] < comment.extendedRange[0]) { - break; - } + /** + * @template T + * @param {string} identifier the cache identifier + * @param {Etag | null} etag the etag + * @param {CallbackCache} callback signals when the value is retrieved + * @returns {void} + */ + get(identifier, etag, callback) { + const gotHandlers = []; + this.hooks.get.callAsync(identifier, etag, gotHandlers, (err, result) => { + if (err) { + callback(makeWebpackError(err, "Cache.hooks.get")); + return; + } + if (result === null) { + result = undefined; + } + if (gotHandlers.length > 1) { + const innerCallback = needCalls(gotHandlers.length, () => + callback(null, result) + ); + for (const gotHandler of gotHandlers) { + gotHandler(result, innerCallback); + } + } else if (gotHandlers.length === 1) { + gotHandlers[0](result, () => callback(null, result)); + } else { + callback(null, result); + } + }); + } - if (node.range[1] === comment.extendedRange[0]) { - if (!node.trailingComments) { - node.trailingComments = []; - } - node.trailingComments.push(comment); - comments.splice(cursor, 1); - } else { - cursor += 1; - } - } + /** + * @template T + * @param {string} identifier the cache identifier + * @param {Etag | null} etag the etag + * @param {T} data the value to store + * @param {CallbackCache} callback signals when the value is stored + * @returns {void} + */ + store(identifier, etag, data, callback) { + this.hooks.store.callAsync( + identifier, + etag, + data, + makeWebpackErrorCallback(callback, "Cache.hooks.store") + ); + } - // already out of owned node - if (cursor === comments.length) { - return VisitorOption.Break; - } + /** + * After this method has succeeded the cache can only be restored when build dependencies are + * @param {Iterable} dependencies list of all build dependencies + * @param {CallbackCache} callback signals when the dependencies are stored + * @returns {void} + */ + storeBuildDependencies(dependencies, callback) { + this.hooks.storeBuildDependencies.callAsync( + dependencies, + makeWebpackErrorCallback(callback, "Cache.hooks.storeBuildDependencies") + ); + } - if (comments[cursor].extendedRange[0] > node.range[1]) { - return VisitorOption.Skip; - } - } - }); + /** + * @returns {void} + */ + beginIdle() { + this.hooks.beginIdle.call(); + } - return tree; - } + /** + * @param {CallbackCache} callback signals when the call finishes + * @returns {void} + */ + endIdle(callback) { + this.hooks.endIdle.callAsync( + makeWebpackErrorCallback(callback, "Cache.hooks.endIdle") + ); + } - exports.Syntax = Syntax; - exports.traverse = traverse; - exports.replace = replace; - exports.attachComments = attachComments; - exports.VisitorKeys = VisitorKeys; - exports.VisitorOption = VisitorOption; - exports.Controller = Controller; - exports.cloneEnvironment = function () { return clone({}); }; + /** + * @param {CallbackCache} callback signals when the call finishes + * @returns {void} + */ + shutdown(callback) { + this.hooks.shutdown.callAsync( + makeWebpackErrorCallback(callback, "Cache.hooks.shutdown") + ); + } +} - return exports; -}(exports)); -/* vim: set sw=4 ts=4 et tw=80 : */ +Cache.STAGE_MEMORY = -10; +Cache.STAGE_DEFAULT = 0; +Cache.STAGE_DISK = 10; +Cache.STAGE_NETWORK = 20; + +module.exports = Cache; /***/ }), -/***/ 18350: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 55392: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +"use strict"; /* - Copyright (C) 2012-2013 Yusuke Suzuki - Copyright (C) 2012 Ariya Hidayat - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -/*jslint vars:false, bitwise:true*/ -/*jshint indent:4*/ -/*global exports:true*/ -(function clone(exports) { - 'use strict'; - var Syntax, - VisitorOption, - VisitorKeys, - BREAK, - SKIP, - REMOVE; - function deepCopy(obj) { - var ret = {}, key, val; - for (key in obj) { - if (obj.hasOwnProperty(key)) { - val = obj[key]; - if (typeof val === 'object' && val !== null) { - ret[key] = deepCopy(val); - } else { - ret[key] = val; - } - } - } - return ret; - } - // based on LLVM libc++ upper_bound / lower_bound - // MIT License +const { forEachBail } = __webpack_require__(9256); +const asyncLib = __webpack_require__(78175); +const getLazyHashedEtag = __webpack_require__(94075); +const mergeEtags = __webpack_require__(54980); - function upperBound(array, func) { - var diff, len, i, current; +/** @typedef {import("./Cache")} Cache */ +/** @typedef {import("./Cache").Etag} Etag */ +/** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./cache/getLazyHashedEtag").HashableObject} HashableObject */ +/** @typedef {typeof import("./util/Hash")} HashConstructor */ - len = array.length; - i = 0; +/** + * @template T + * @callback CallbackCache + * @param {(WebpackError | null)=} err + * @param {T=} result + * @returns {void} + */ - while (len) { - diff = len >>> 1; - current = i + diff; - if (func(array[current])) { - len = diff; - } else { - i = current + 1; - len -= diff + 1; - } - } - return i; - } +/** + * @template T + * @callback CallbackNormalErrorCache + * @param {(Error | null)=} err + * @param {T=} result + * @returns {void} + */ - Syntax = { - AssignmentExpression: 'AssignmentExpression', - AssignmentPattern: 'AssignmentPattern', - ArrayExpression: 'ArrayExpression', - ArrayPattern: 'ArrayPattern', - ArrowFunctionExpression: 'ArrowFunctionExpression', - AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7. - BlockStatement: 'BlockStatement', - BinaryExpression: 'BinaryExpression', - BreakStatement: 'BreakStatement', - CallExpression: 'CallExpression', - CatchClause: 'CatchClause', - ClassBody: 'ClassBody', - ClassDeclaration: 'ClassDeclaration', - ClassExpression: 'ClassExpression', - ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7. - ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7. - ConditionalExpression: 'ConditionalExpression', - ContinueStatement: 'ContinueStatement', - DebuggerStatement: 'DebuggerStatement', - DirectiveStatement: 'DirectiveStatement', - DoWhileStatement: 'DoWhileStatement', - EmptyStatement: 'EmptyStatement', - ExportAllDeclaration: 'ExportAllDeclaration', - ExportDefaultDeclaration: 'ExportDefaultDeclaration', - ExportNamedDeclaration: 'ExportNamedDeclaration', - ExportSpecifier: 'ExportSpecifier', - ExpressionStatement: 'ExpressionStatement', - ForStatement: 'ForStatement', - ForInStatement: 'ForInStatement', - ForOfStatement: 'ForOfStatement', - FunctionDeclaration: 'FunctionDeclaration', - FunctionExpression: 'FunctionExpression', - GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7. - Identifier: 'Identifier', - IfStatement: 'IfStatement', - ImportExpression: 'ImportExpression', - ImportDeclaration: 'ImportDeclaration', - ImportDefaultSpecifier: 'ImportDefaultSpecifier', - ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', - ImportSpecifier: 'ImportSpecifier', - Literal: 'Literal', - LabeledStatement: 'LabeledStatement', - LogicalExpression: 'LogicalExpression', - MemberExpression: 'MemberExpression', - MetaProperty: 'MetaProperty', - MethodDefinition: 'MethodDefinition', - ModuleSpecifier: 'ModuleSpecifier', - NewExpression: 'NewExpression', - ObjectExpression: 'ObjectExpression', - ObjectPattern: 'ObjectPattern', - Program: 'Program', - Property: 'Property', - RestElement: 'RestElement', - ReturnStatement: 'ReturnStatement', - SequenceExpression: 'SequenceExpression', - SpreadElement: 'SpreadElement', - Super: 'Super', - SwitchStatement: 'SwitchStatement', - SwitchCase: 'SwitchCase', - TaggedTemplateExpression: 'TaggedTemplateExpression', - TemplateElement: 'TemplateElement', - TemplateLiteral: 'TemplateLiteral', - ThisExpression: 'ThisExpression', - ThrowStatement: 'ThrowStatement', - TryStatement: 'TryStatement', - UnaryExpression: 'UnaryExpression', - UpdateExpression: 'UpdateExpression', - VariableDeclaration: 'VariableDeclaration', - VariableDeclarator: 'VariableDeclarator', - WhileStatement: 'WhileStatement', - WithStatement: 'WithStatement', - YieldExpression: 'YieldExpression' - }; +class MultiItemCache { + /** + * @param {ItemCacheFacade[]} items item caches + */ + constructor(items) { + this._items = items; + if (items.length === 1) return /** @type {any} */ (items[0]); + } - VisitorKeys = { - AssignmentExpression: ['left', 'right'], - AssignmentPattern: ['left', 'right'], - ArrayExpression: ['elements'], - ArrayPattern: ['elements'], - ArrowFunctionExpression: ['params', 'body'], - AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7. - BlockStatement: ['body'], - BinaryExpression: ['left', 'right'], - BreakStatement: ['label'], - CallExpression: ['callee', 'arguments'], - CatchClause: ['param', 'body'], - ClassBody: ['body'], - ClassDeclaration: ['id', 'superClass', 'body'], - ClassExpression: ['id', 'superClass', 'body'], - ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7. - ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. - ConditionalExpression: ['test', 'consequent', 'alternate'], - ContinueStatement: ['label'], - DebuggerStatement: [], - DirectiveStatement: [], - DoWhileStatement: ['body', 'test'], - EmptyStatement: [], - ExportAllDeclaration: ['source'], - ExportDefaultDeclaration: ['declaration'], - ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], - ExportSpecifier: ['exported', 'local'], - ExpressionStatement: ['expression'], - ForStatement: ['init', 'test', 'update', 'body'], - ForInStatement: ['left', 'right', 'body'], - ForOfStatement: ['left', 'right', 'body'], - FunctionDeclaration: ['id', 'params', 'body'], - FunctionExpression: ['id', 'params', 'body'], - GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. - Identifier: [], - IfStatement: ['test', 'consequent', 'alternate'], - ImportExpression: ['source'], - ImportDeclaration: ['specifiers', 'source'], - ImportDefaultSpecifier: ['local'], - ImportNamespaceSpecifier: ['local'], - ImportSpecifier: ['imported', 'local'], - Literal: [], - LabeledStatement: ['label', 'body'], - LogicalExpression: ['left', 'right'], - MemberExpression: ['object', 'property'], - MetaProperty: ['meta', 'property'], - MethodDefinition: ['key', 'value'], - ModuleSpecifier: [], - NewExpression: ['callee', 'arguments'], - ObjectExpression: ['properties'], - ObjectPattern: ['properties'], - Program: ['body'], - Property: ['key', 'value'], - RestElement: [ 'argument' ], - ReturnStatement: ['argument'], - SequenceExpression: ['expressions'], - SpreadElement: ['argument'], - Super: [], - SwitchStatement: ['discriminant', 'cases'], - SwitchCase: ['test', 'consequent'], - TaggedTemplateExpression: ['tag', 'quasi'], - TemplateElement: [], - TemplateLiteral: ['quasis', 'expressions'], - ThisExpression: [], - ThrowStatement: ['argument'], - TryStatement: ['block', 'handler', 'finalizer'], - UnaryExpression: ['argument'], - UpdateExpression: ['argument'], - VariableDeclaration: ['declarations'], - VariableDeclarator: ['id', 'init'], - WhileStatement: ['test', 'body'], - WithStatement: ['object', 'body'], - YieldExpression: ['argument'] - }; + /** + * @template T + * @param {CallbackCache} callback signals when the value is retrieved + * @returns {void} + */ + get(callback) { + forEachBail(this._items, (item, callback) => item.get(callback), callback); + } - // unique id - BREAK = {}; - SKIP = {}; - REMOVE = {}; + /** + * @template T + * @returns {Promise} promise with the data + */ + getPromise() { + const next = i => { + return this._items[i].getPromise().then(result => { + if (result !== undefined) return result; + if (++i < this._items.length) return next(i); + }); + }; + return next(0); + } - VisitorOption = { - Break: BREAK, - Skip: SKIP, - Remove: REMOVE - }; + /** + * @template T + * @param {T} data the value to store + * @param {CallbackCache} callback signals when the value is stored + * @returns {void} + */ + store(data, callback) { + asyncLib.each( + this._items, + (item, callback) => item.store(data, callback), + callback + ); + } - function Reference(parent, key) { - this.parent = parent; - this.key = key; - } + /** + * @template T + * @param {T} data the value to store + * @returns {Promise} promise signals when the value is stored + */ + storePromise(data) { + return Promise.all(this._items.map(item => item.storePromise(data))).then( + () => {} + ); + } +} - Reference.prototype.replace = function replace(node) { - this.parent[this.key] = node; - }; +class ItemCacheFacade { + /** + * @param {Cache} cache the root cache + * @param {string} name the child cache item name + * @param {Etag | null} etag the etag + */ + constructor(cache, name, etag) { + this._cache = cache; + this._name = name; + this._etag = etag; + } - Reference.prototype.remove = function remove() { - if (Array.isArray(this.parent)) { - this.parent.splice(this.key, 1); - return true; - } else { - this.replace(null); - return false; - } - }; + /** + * @template T + * @param {CallbackCache} callback signals when the value is retrieved + * @returns {void} + */ + get(callback) { + this._cache.get(this._name, this._etag, callback); + } - function Element(node, path, wrap, ref) { - this.node = node; - this.path = path; - this.wrap = wrap; - this.ref = ref; - } + /** + * @template T + * @returns {Promise} promise with the data + */ + getPromise() { + return new Promise((resolve, reject) => { + this._cache.get(this._name, this._etag, (err, data) => { + if (err) { + reject(err); + } else { + resolve(data); + } + }); + }); + } - function Controller() { } + /** + * @template T + * @param {T} data the value to store + * @param {CallbackCache} callback signals when the value is stored + * @returns {void} + */ + store(data, callback) { + this._cache.store(this._name, this._etag, data, callback); + } - // API: - // return property path array from root to current node - Controller.prototype.path = function path() { - var i, iz, j, jz, result, element; + /** + * @template T + * @param {T} data the value to store + * @returns {Promise} promise signals when the value is stored + */ + storePromise(data) { + return new Promise((resolve, reject) => { + this._cache.store(this._name, this._etag, data, err => { + if (err) { + reject(err); + } else { + resolve(); + } + }); + }); + } - function addToPath(result, path) { - if (Array.isArray(path)) { - for (j = 0, jz = path.length; j < jz; ++j) { - result.push(path[j]); - } - } else { - result.push(path); - } - } + /** + * @template T + * @param {function(CallbackNormalErrorCache): void} computer function to compute the value if not cached + * @param {CallbackNormalErrorCache} callback signals when the value is retrieved + * @returns {void} + */ + provide(computer, callback) { + this.get((err, cacheEntry) => { + if (err) return callback(err); + if (cacheEntry !== undefined) return cacheEntry; + computer((err, result) => { + if (err) return callback(err); + this.store(result, err => { + if (err) return callback(err); + callback(null, result); + }); + }); + }); + } - // root node - if (!this.__current.path) { - return null; - } + /** + * @template T + * @param {function(): Promise | T} computer function to compute the value if not cached + * @returns {Promise} promise with the data + */ + async providePromise(computer) { + const cacheEntry = await this.getPromise(); + if (cacheEntry !== undefined) return cacheEntry; + const result = await computer(); + await this.storePromise(result); + return result; + } +} - // first node is sentinel, second node is root element - result = []; - for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { - element = this.__leavelist[i]; - addToPath(result, element.path); - } - addToPath(result, this.__current.path); - return result; - }; +class CacheFacade { + /** + * @param {Cache} cache the root cache + * @param {string} name the child cache name + * @param {string | HashConstructor} hashFunction the hash function to use + */ + constructor(cache, name, hashFunction) { + this._cache = cache; + this._name = name; + this._hashFunction = hashFunction; + } - // API: - // return type of current node - Controller.prototype.type = function () { - var node = this.current(); - return node.type || this.__current.wrap; - }; + /** + * @param {string} name the child cache name# + * @returns {CacheFacade} child cache + */ + getChildCache(name) { + return new CacheFacade( + this._cache, + `${this._name}|${name}`, + this._hashFunction + ); + } - // API: - // return array of parent elements - Controller.prototype.parents = function parents() { - var i, iz, result; + /** + * @param {string} identifier the cache identifier + * @param {Etag | null} etag the etag + * @returns {ItemCacheFacade} item cache + */ + getItemCache(identifier, etag) { + return new ItemCacheFacade( + this._cache, + `${this._name}|${identifier}`, + etag + ); + } - // first node is sentinel - result = []; - for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { - result.push(this.__leavelist[i].node); - } + /** + * @param {HashableObject} obj an hashable object + * @returns {Etag} an etag that is lazy hashed + */ + getLazyHashedEtag(obj) { + return getLazyHashedEtag(obj, this._hashFunction); + } - return result; - }; + /** + * @param {Etag} a an etag + * @param {Etag} b another etag + * @returns {Etag} an etag that represents both + */ + mergeEtags(a, b) { + return mergeEtags(a, b); + } - // API: - // return current node - Controller.prototype.current = function current() { - return this.__current.node; - }; + /** + * @template T + * @param {string} identifier the cache identifier + * @param {Etag | null} etag the etag + * @param {CallbackCache} callback signals when the value is retrieved + * @returns {void} + */ + get(identifier, etag, callback) { + this._cache.get(`${this._name}|${identifier}`, etag, callback); + } - Controller.prototype.__execute = function __execute(callback, element) { - var previous, result; + /** + * @template T + * @param {string} identifier the cache identifier + * @param {Etag | null} etag the etag + * @returns {Promise} promise with the data + */ + getPromise(identifier, etag) { + return new Promise((resolve, reject) => { + this._cache.get(`${this._name}|${identifier}`, etag, (err, data) => { + if (err) { + reject(err); + } else { + resolve(data); + } + }); + }); + } - result = undefined; + /** + * @template T + * @param {string} identifier the cache identifier + * @param {Etag | null} etag the etag + * @param {T} data the value to store + * @param {CallbackCache} callback signals when the value is stored + * @returns {void} + */ + store(identifier, etag, data, callback) { + this._cache.store(`${this._name}|${identifier}`, etag, data, callback); + } - previous = this.__current; - this.__current = element; - this.__state = null; - if (callback) { - result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); - } - this.__current = previous; + /** + * @template T + * @param {string} identifier the cache identifier + * @param {Etag | null} etag the etag + * @param {T} data the value to store + * @returns {Promise} promise signals when the value is stored + */ + storePromise(identifier, etag, data) { + return new Promise((resolve, reject) => { + this._cache.store(`${this._name}|${identifier}`, etag, data, err => { + if (err) { + reject(err); + } else { + resolve(); + } + }); + }); + } - return result; - }; + /** + * @template T + * @param {string} identifier the cache identifier + * @param {Etag | null} etag the etag + * @param {function(CallbackNormalErrorCache): void} computer function to compute the value if not cached + * @param {CallbackNormalErrorCache} callback signals when the value is retrieved + * @returns {void} + */ + provide(identifier, etag, computer, callback) { + this.get(identifier, etag, (err, cacheEntry) => { + if (err) return callback(err); + if (cacheEntry !== undefined) return cacheEntry; + computer((err, result) => { + if (err) return callback(err); + this.store(identifier, etag, result, err => { + if (err) return callback(err); + callback(null, result); + }); + }); + }); + } - // API: - // notify control skip / break - Controller.prototype.notify = function notify(flag) { - this.__state = flag; - }; + /** + * @template T + * @param {string} identifier the cache identifier + * @param {Etag | null} etag the etag + * @param {function(): Promise | T} computer function to compute the value if not cached + * @returns {Promise} promise with the data + */ + async providePromise(identifier, etag, computer) { + const cacheEntry = await this.getPromise(identifier, etag); + if (cacheEntry !== undefined) return cacheEntry; + const result = await computer(); + await this.storePromise(identifier, etag, result); + return result; + } +} - // API: - // skip child nodes of current node - Controller.prototype.skip = function () { - this.notify(SKIP); - }; +module.exports = CacheFacade; +module.exports.ItemCacheFacade = ItemCacheFacade; +module.exports.MultiItemCache = MultiItemCache; - // API: - // break traversals - Controller.prototype['break'] = function () { - this.notify(BREAK); - }; - // API: - // remove node - Controller.prototype.remove = function () { - this.notify(REMOVE); - }; +/***/ }), - Controller.prototype.__initialize = function(root, visitor) { - this.visitor = visitor; - this.root = root; - this.__worklist = []; - this.__leavelist = []; - this.__current = null; - this.__state = null; - this.__fallback = null; - if (visitor.fallback === 'iteration') { - this.__fallback = Object.keys; - } else if (typeof visitor.fallback === 'function') { - this.__fallback = visitor.fallback; - } +/***/ 77975: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - this.__keys = VisitorKeys; - if (visitor.keys) { - this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); - } - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - function isNode(node) { - if (node == null) { - return false; - } - return typeof node === 'object' && typeof node.type === 'string'; - } - function isProperty(nodeType, key) { - return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; - } - Controller.prototype.traverse = function traverse(root, visitor) { - var worklist, - leavelist, - element, - node, - nodeType, - ret, - key, - current, - current2, - candidates, - candidate, - sentinel; +const WebpackError = __webpack_require__(53799); - this.__initialize(root, visitor); +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ - sentinel = {}; +/** + * @param {Module[]} modules the modules to be sorted + * @returns {Module[]} sorted version of original modules + */ +const sortModules = modules => { + return modules.sort((a, b) => { + const aIdent = a.identifier(); + const bIdent = b.identifier(); + /* istanbul ignore next */ + if (aIdent < bIdent) return -1; + /* istanbul ignore next */ + if (aIdent > bIdent) return 1; + /* istanbul ignore next */ + return 0; + }); +}; - // reference - worklist = this.__worklist; - leavelist = this.__leavelist; +/** + * @param {Module[]} modules each module from throw + * @param {ModuleGraph} moduleGraph the module graph + * @returns {string} each message from provided modules + */ +const createModulesListMessage = (modules, moduleGraph) => { + return modules + .map(m => { + let message = `* ${m.identifier()}`; + const validReasons = Array.from( + moduleGraph.getIncomingConnectionsByOriginModule(m).keys() + ).filter(x => x); - // initialize - worklist.push(new Element(root, null, null, null)); - leavelist.push(new Element(null, null, null, null)); + if (validReasons.length > 0) { + message += `\n Used by ${validReasons.length} module(s), i. e.`; + message += `\n ${validReasons[0].identifier()}`; + } + return message; + }) + .join("\n"); +}; - while (worklist.length) { - element = worklist.pop(); +class CaseSensitiveModulesWarning extends WebpackError { + /** + * Creates an instance of CaseSensitiveModulesWarning. + * @param {Iterable} modules modules that were detected + * @param {ModuleGraph} moduleGraph the module graph + */ + constructor(modules, moduleGraph) { + const sortedModules = sortModules(Array.from(modules)); + const modulesList = createModulesListMessage(sortedModules, moduleGraph); + super(`There are multiple modules with names that only differ in casing. +This can lead to unexpected behavior when compiling on a filesystem with other case-semantic. +Use equal casing. Compare these module identifiers: +${modulesList}`); - if (element === sentinel) { - element = leavelist.pop(); + this.name = "CaseSensitiveModulesWarning"; + this.module = sortedModules[0]; + } +} - ret = this.__execute(visitor.leave, element); +module.exports = CaseSensitiveModulesWarning; - if (this.__state === BREAK || ret === BREAK) { - return; - } - continue; - } - if (element.node) { +/***/ }), - ret = this.__execute(visitor.enter, element); +/***/ 39385: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (this.__state === BREAK || ret === BREAK) { - return; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - worklist.push(sentinel); - leavelist.push(element); - if (this.__state === SKIP || ret === SKIP) { - continue; - } - node = element.node; - nodeType = node.type || element.wrap; - candidates = this.__keys[nodeType]; - if (!candidates) { - if (this.__fallback) { - candidates = this.__fallback(node); - } else { - throw new Error('Unknown node type ' + nodeType + '.'); - } - } +const ChunkGraph = __webpack_require__(64971); +const Entrypoint = __webpack_require__(13795); +const { intersect } = __webpack_require__(93347); +const SortableSet = __webpack_require__(13098); +const StringXor = __webpack_require__(40293); +const { + compareModulesByIdentifier, + compareChunkGroupsByIndex, + compareModulesById +} = __webpack_require__(29579); +const { createArrayToSetDeprecationSet } = __webpack_require__(64518); +const { mergeRuntime } = __webpack_require__(17156); - current = candidates.length; - while ((current -= 1) >= 0) { - key = candidates[current]; - candidate = node[key]; - if (!candidate) { - continue; - } +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("./ChunkGraph").ChunkFilterPredicate} ChunkFilterPredicate */ +/** @typedef {import("./ChunkGraph").ChunkSizeOptions} ChunkSizeOptions */ +/** @typedef {import("./ChunkGraph").ModuleFilterPredicate} ModuleFilterPredicate */ +/** @typedef {import("./ChunkGroup")} ChunkGroup */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("./Compilation").PathData} PathData */ +/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./util/Hash")} Hash */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - if (Array.isArray(candidate)) { - current2 = candidate.length; - while ((current2 -= 1) >= 0) { - if (!candidate[current2]) { - continue; - } - if (isProperty(nodeType, candidates[current])) { - element = new Element(candidate[current2], [key, current2], 'Property', null); - } else if (isNode(candidate[current2])) { - element = new Element(candidate[current2], [key, current2], null, null); - } else { - continue; - } - worklist.push(element); - } - } else if (isNode(candidate)) { - worklist.push(new Element(candidate, key, null, null)); - } - } - } - } - }; +const ChunkFilesSet = createArrayToSetDeprecationSet("chunk.files"); - Controller.prototype.replace = function replace(root, visitor) { - var worklist, - leavelist, - node, - nodeType, - target, - element, - current, - current2, - candidates, - candidate, - sentinel, - outer, - key; - - function removeElem(element) { - var i, - key, - nextElem, - parent; - - if (element.ref.remove()) { - // When the reference is an element of an array. - key = element.ref.key; - parent = element.ref.parent; +/** + * @typedef {Object} WithId an object who has an id property * + * @property {string | number} id the id of the object + */ - // If removed from array, then decrease following items' keys. - i = worklist.length; - while (i--) { - nextElem = worklist[i]; - if (nextElem.ref && nextElem.ref.parent === parent) { - if (nextElem.ref.key < key) { - break; - } - --nextElem.ref.key; - } - } - } - } +/** + * @deprecated + * @typedef {Object} ChunkMaps + * @property {Record} hash + * @property {Record>} contentHash + * @property {Record} name + */ - this.__initialize(root, visitor); +/** + * @deprecated + * @typedef {Object} ChunkModuleMaps + * @property {Record} id + * @property {Record} hash + */ - sentinel = {}; +let debugId = 1000; - // reference - worklist = this.__worklist; - leavelist = this.__leavelist; +/** + * A Chunk is a unit of encapsulation for Modules. + * Chunks are "rendered" into bundles that get emitted when the build completes. + */ +class Chunk { + /** + * @param {string=} name of chunk being created, is optional (for subclasses) + * @param {boolean} backCompat enable backward-compatibility + */ + constructor(name, backCompat = true) { + /** @type {number | string | null} */ + this.id = null; + /** @type {(number|string)[] | null} */ + this.ids = null; + /** @type {number} */ + this.debugId = debugId++; + /** @type {string} */ + this.name = name; + /** @type {SortableSet} */ + this.idNameHints = new SortableSet(); + /** @type {boolean} */ + this.preventIntegration = false; + /** @type {(string | function(PathData, AssetInfo=): string)?} */ + this.filenameTemplate = undefined; + /** @type {(string | function(PathData, AssetInfo=): string)?} */ + this.cssFilenameTemplate = undefined; + /** @private @type {SortableSet} */ + this._groups = new SortableSet(undefined, compareChunkGroupsByIndex); + /** @type {RuntimeSpec} */ + this.runtime = undefined; + /** @type {Set} */ + this.files = backCompat ? new ChunkFilesSet() : new Set(); + /** @type {Set} */ + this.auxiliaryFiles = new Set(); + /** @type {boolean} */ + this.rendered = false; + /** @type {string=} */ + this.hash = undefined; + /** @type {Record} */ + this.contentHash = Object.create(null); + /** @type {string=} */ + this.renderedHash = undefined; + /** @type {string=} */ + this.chunkReason = undefined; + /** @type {boolean} */ + this.extraAsync = false; + } - // initialize - outer = { - root: root - }; - element = new Element(root, null, null, new Reference(outer, 'root')); - worklist.push(element); - leavelist.push(element); + // TODO remove in webpack 6 + // BACKWARD-COMPAT START + get entryModule() { + const entryModules = Array.from( + ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.entryModule", + "DEP_WEBPACK_CHUNK_ENTRY_MODULE" + ).getChunkEntryModulesIterable(this) + ); + if (entryModules.length === 0) { + return undefined; + } else if (entryModules.length === 1) { + return entryModules[0]; + } else { + throw new Error( + "Module.entryModule: Multiple entry modules are not supported by the deprecated API (Use the new ChunkGroup API)" + ); + } + } - while (worklist.length) { - element = worklist.pop(); + /** + * @returns {boolean} true, if the chunk contains an entry module + */ + hasEntryModule() { + return ( + ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.hasEntryModule", + "DEP_WEBPACK_CHUNK_HAS_ENTRY_MODULE" + ).getNumberOfEntryModules(this) > 0 + ); + } - if (element === sentinel) { - element = leavelist.pop(); + /** + * @param {Module} module the module + * @returns {boolean} true, if the chunk could be added + */ + addModule(module) { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.addModule", + "DEP_WEBPACK_CHUNK_ADD_MODULE" + ); + if (chunkGraph.isModuleInChunk(module, this)) return false; + chunkGraph.connectChunkAndModule(this, module); + return true; + } - target = this.__execute(visitor.leave, element); + /** + * @param {Module} module the module + * @returns {void} + */ + removeModule(module) { + ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.removeModule", + "DEP_WEBPACK_CHUNK_REMOVE_MODULE" + ).disconnectChunkAndModule(this, module); + } - // node may be replaced with null, - // so distinguish between undefined and null in this place - if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { - // replace - element.ref.replace(target); - } + /** + * @returns {number} the number of module which are contained in this chunk + */ + getNumberOfModules() { + return ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.getNumberOfModules", + "DEP_WEBPACK_CHUNK_GET_NUMBER_OF_MODULES" + ).getNumberOfChunkModules(this); + } - if (this.__state === REMOVE || target === REMOVE) { - removeElem(element); - } + get modulesIterable() { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.modulesIterable", + "DEP_WEBPACK_CHUNK_MODULES_ITERABLE" + ); + return chunkGraph.getOrderedChunkModulesIterable( + this, + compareModulesByIdentifier + ); + } - if (this.__state === BREAK || target === BREAK) { - return outer.root; - } - continue; - } + /** + * @param {Chunk} otherChunk the chunk to compare with + * @returns {-1|0|1} the comparison result + */ + compareTo(otherChunk) { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.compareTo", + "DEP_WEBPACK_CHUNK_COMPARE_TO" + ); + return chunkGraph.compareChunks(this, otherChunk); + } - target = this.__execute(visitor.enter, element); + /** + * @param {Module} module the module + * @returns {boolean} true, if the chunk contains the module + */ + containsModule(module) { + return ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.containsModule", + "DEP_WEBPACK_CHUNK_CONTAINS_MODULE" + ).isModuleInChunk(module, this); + } - // node may be replaced with null, - // so distinguish between undefined and null in this place - if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { - // replace - element.ref.replace(target); - element.node = target; - } + /** + * @returns {Module[]} the modules for this chunk + */ + getModules() { + return ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.getModules", + "DEP_WEBPACK_CHUNK_GET_MODULES" + ).getChunkModules(this); + } - if (this.__state === REMOVE || target === REMOVE) { - removeElem(element); - element.node = null; - } + /** + * @returns {void} + */ + remove() { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.remove", + "DEP_WEBPACK_CHUNK_REMOVE" + ); + chunkGraph.disconnectChunk(this); + this.disconnectFromGroups(); + } - if (this.__state === BREAK || target === BREAK) { - return outer.root; - } + /** + * @param {Module} module the module + * @param {Chunk} otherChunk the target chunk + * @returns {void} + */ + moveModule(module, otherChunk) { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.moveModule", + "DEP_WEBPACK_CHUNK_MOVE_MODULE" + ); + chunkGraph.disconnectChunkAndModule(this, module); + chunkGraph.connectChunkAndModule(otherChunk, module); + } - // node may be null - node = element.node; - if (!node) { - continue; - } + /** + * @param {Chunk} otherChunk the other chunk + * @returns {boolean} true, if the specified chunk has been integrated + */ + integrate(otherChunk) { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.integrate", + "DEP_WEBPACK_CHUNK_INTEGRATE" + ); + if (chunkGraph.canChunksBeIntegrated(this, otherChunk)) { + chunkGraph.integrateChunks(this, otherChunk); + return true; + } else { + return false; + } + } - worklist.push(sentinel); - leavelist.push(element); + /** + * @param {Chunk} otherChunk the other chunk + * @returns {boolean} true, if chunks could be integrated + */ + canBeIntegrated(otherChunk) { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.canBeIntegrated", + "DEP_WEBPACK_CHUNK_CAN_BE_INTEGRATED" + ); + return chunkGraph.canChunksBeIntegrated(this, otherChunk); + } - if (this.__state === SKIP || target === SKIP) { - continue; - } + /** + * @returns {boolean} true, if this chunk contains no module + */ + isEmpty() { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.isEmpty", + "DEP_WEBPACK_CHUNK_IS_EMPTY" + ); + return chunkGraph.getNumberOfChunkModules(this) === 0; + } - nodeType = node.type || element.wrap; - candidates = this.__keys[nodeType]; - if (!candidates) { - if (this.__fallback) { - candidates = this.__fallback(node); - } else { - throw new Error('Unknown node type ' + nodeType + '.'); - } - } + /** + * @returns {number} total size of all modules in this chunk + */ + modulesSize() { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.modulesSize", + "DEP_WEBPACK_CHUNK_MODULES_SIZE" + ); + return chunkGraph.getChunkModulesSize(this); + } - current = candidates.length; - while ((current -= 1) >= 0) { - key = candidates[current]; - candidate = node[key]; - if (!candidate) { - continue; - } + /** + * @param {ChunkSizeOptions} options options object + * @returns {number} total size of this chunk + */ + size(options = {}) { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.size", + "DEP_WEBPACK_CHUNK_SIZE" + ); + return chunkGraph.getChunkSize(this, options); + } - if (Array.isArray(candidate)) { - current2 = candidate.length; - while ((current2 -= 1) >= 0) { - if (!candidate[current2]) { - continue; - } - if (isProperty(nodeType, candidates[current])) { - element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); - } else if (isNode(candidate[current2])) { - element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); - } else { - continue; - } - worklist.push(element); - } - } else if (isNode(candidate)) { - worklist.push(new Element(candidate, key, null, new Reference(node, key))); - } - } - } + /** + * @param {Chunk} otherChunk the other chunk + * @param {ChunkSizeOptions} options options object + * @returns {number} total size of the chunk or false if the chunk can't be integrated + */ + integratedSize(otherChunk, options) { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.integratedSize", + "DEP_WEBPACK_CHUNK_INTEGRATED_SIZE" + ); + return chunkGraph.getIntegratedChunksSize(this, otherChunk, options); + } - return outer.root; - }; + /** + * @param {ModuleFilterPredicate} filterFn function used to filter modules + * @returns {ChunkModuleMaps} module map information + */ + getChunkModuleMaps(filterFn) { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.getChunkModuleMaps", + "DEP_WEBPACK_CHUNK_GET_CHUNK_MODULE_MAPS" + ); + /** @type {Record} */ + const chunkModuleIdMap = Object.create(null); + /** @type {Record} */ + const chunkModuleHashMap = Object.create(null); - function traverse(root, visitor) { - var controller = new Controller(); - return controller.traverse(root, visitor); - } + for (const asyncChunk of this.getAllAsyncChunks()) { + /** @type {(string|number)[]} */ + let array; + for (const module of chunkGraph.getOrderedChunkModulesIterable( + asyncChunk, + compareModulesById(chunkGraph) + )) { + if (filterFn(module)) { + if (array === undefined) { + array = []; + chunkModuleIdMap[asyncChunk.id] = array; + } + const moduleId = chunkGraph.getModuleId(module); + array.push(moduleId); + chunkModuleHashMap[moduleId] = chunkGraph.getRenderedModuleHash( + module, + undefined + ); + } + } + } - function replace(root, visitor) { - var controller = new Controller(); - return controller.replace(root, visitor); - } + return { + id: chunkModuleIdMap, + hash: chunkModuleHashMap + }; + } - function extendCommentRange(comment, tokens) { - var target; + /** + * @param {ModuleFilterPredicate} filterFn predicate function used to filter modules + * @param {ChunkFilterPredicate=} filterChunkFn predicate function used to filter chunks + * @returns {boolean} return true if module exists in graph + */ + hasModuleInGraph(filterFn, filterChunkFn) { + const chunkGraph = ChunkGraph.getChunkGraphForChunk( + this, + "Chunk.hasModuleInGraph", + "DEP_WEBPACK_CHUNK_HAS_MODULE_IN_GRAPH" + ); + return chunkGraph.hasModuleInGraph(this, filterFn, filterChunkFn); + } - target = upperBound(tokens, function search(token) { - return token.range[0] > comment.range[0]; - }); + /** + * @deprecated + * @param {boolean} realHash whether the full hash or the rendered hash is to be used + * @returns {ChunkMaps} the chunk map information + */ + getChunkMaps(realHash) { + /** @type {Record} */ + const chunkHashMap = Object.create(null); + /** @type {Record>} */ + const chunkContentHashMap = Object.create(null); + /** @type {Record} */ + const chunkNameMap = Object.create(null); - comment.extendedRange = [comment.range[0], comment.range[1]]; + for (const chunk of this.getAllAsyncChunks()) { + chunkHashMap[chunk.id] = realHash ? chunk.hash : chunk.renderedHash; + for (const key of Object.keys(chunk.contentHash)) { + if (!chunkContentHashMap[key]) { + chunkContentHashMap[key] = Object.create(null); + } + chunkContentHashMap[key][chunk.id] = chunk.contentHash[key]; + } + if (chunk.name) { + chunkNameMap[chunk.id] = chunk.name; + } + } - if (target !== tokens.length) { - comment.extendedRange[1] = tokens[target].range[0]; - } + return { + hash: chunkHashMap, + contentHash: chunkContentHashMap, + name: chunkNameMap + }; + } + // BACKWARD-COMPAT END - target -= 1; - if (target >= 0) { - comment.extendedRange[0] = tokens[target].range[1]; - } + /** + * @returns {boolean} whether or not the Chunk will have a runtime + */ + hasRuntime() { + for (const chunkGroup of this._groups) { + if ( + chunkGroup instanceof Entrypoint && + chunkGroup.getRuntimeChunk() === this + ) { + return true; + } + } + return false; + } - return comment; - } + /** + * @returns {boolean} whether or not this chunk can be an initial chunk + */ + canBeInitial() { + for (const chunkGroup of this._groups) { + if (chunkGroup.isInitial()) return true; + } + return false; + } - function attachComments(tree, providedComments, tokens) { - // At first, we should calculate extended comment ranges. - var comments = [], comment, len, i, cursor; + /** + * @returns {boolean} whether this chunk can only be an initial chunk + */ + isOnlyInitial() { + if (this._groups.size <= 0) return false; + for (const chunkGroup of this._groups) { + if (!chunkGroup.isInitial()) return false; + } + return true; + } - if (!tree.range) { - throw new Error('attachComments needs range information'); - } + /** + * @returns {EntryOptions | undefined} the entry options for this chunk + */ + getEntryOptions() { + for (const chunkGroup of this._groups) { + if (chunkGroup instanceof Entrypoint) { + return chunkGroup.options; + } + } + return undefined; + } - // tokens array is empty, we attach comments to tree as 'leadingComments' - if (!tokens.length) { - if (providedComments.length) { - for (i = 0, len = providedComments.length; i < len; i += 1) { - comment = deepCopy(providedComments[i]); - comment.extendedRange = [0, tree.range[0]]; - comments.push(comment); - } - tree.leadingComments = comments; - } - return tree; - } + /** + * @param {ChunkGroup} chunkGroup the chunkGroup the chunk is being added + * @returns {void} + */ + addGroup(chunkGroup) { + this._groups.add(chunkGroup); + } - for (i = 0, len = providedComments.length; i < len; i += 1) { - comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); - } + /** + * @param {ChunkGroup} chunkGroup the chunkGroup the chunk is being removed from + * @returns {void} + */ + removeGroup(chunkGroup) { + this._groups.delete(chunkGroup); + } - // This is based on John Freeman's implementation. - cursor = 0; - traverse(tree, { - enter: function (node) { - var comment; + /** + * @param {ChunkGroup} chunkGroup the chunkGroup to check + * @returns {boolean} returns true if chunk has chunkGroup reference and exists in chunkGroup + */ + isInGroup(chunkGroup) { + return this._groups.has(chunkGroup); + } - while (cursor < comments.length) { - comment = comments[cursor]; - if (comment.extendedRange[1] > node.range[0]) { - break; - } + /** + * @returns {number} the amount of groups that the said chunk is in + */ + getNumberOfGroups() { + return this._groups.size; + } - if (comment.extendedRange[1] === node.range[0]) { - if (!node.leadingComments) { - node.leadingComments = []; - } - node.leadingComments.push(comment); - comments.splice(cursor, 1); - } else { - cursor += 1; - } - } + /** + * @returns {Iterable} the chunkGroups that the said chunk is referenced in + */ + get groupsIterable() { + this._groups.sort(); + return this._groups; + } - // already out of owned node - if (cursor === comments.length) { - return VisitorOption.Break; - } + /** + * @returns {void} + */ + disconnectFromGroups() { + for (const chunkGroup of this._groups) { + chunkGroup.removeChunk(this); + } + } - if (comments[cursor].extendedRange[0] > node.range[1]) { - return VisitorOption.Skip; - } - } - }); + /** + * @param {Chunk} newChunk the new chunk that will be split out of + * @returns {void} + */ + split(newChunk) { + for (const chunkGroup of this._groups) { + chunkGroup.insertChunk(newChunk, this); + newChunk.addGroup(chunkGroup); + } + for (const idHint of this.idNameHints) { + newChunk.idNameHints.add(idHint); + } + newChunk.runtime = mergeRuntime(newChunk.runtime, this.runtime); + } - cursor = 0; - traverse(tree, { - leave: function (node) { - var comment; + /** + * @param {Hash} hash hash (will be modified) + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {void} + */ + updateHash(hash, chunkGraph) { + hash.update( + `${this.id} ${this.ids ? this.ids.join() : ""} ${this.name || ""} ` + ); + const xor = new StringXor(); + for (const m of chunkGraph.getChunkModulesIterable(this)) { + xor.add(chunkGraph.getModuleHash(m, this.runtime)); + } + xor.updateHash(hash); + const entryModules = + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(this); + for (const [m, chunkGroup] of entryModules) { + hash.update(`entry${chunkGraph.getModuleId(m)}${chunkGroup.id}`); + } + } - while (cursor < comments.length) { - comment = comments[cursor]; - if (node.range[1] < comment.extendedRange[0]) { - break; - } + /** + * @returns {Set} a set of all the async chunks + */ + getAllAsyncChunks() { + const queue = new Set(); + const chunks = new Set(); - if (node.range[1] === comment.extendedRange[0]) { - if (!node.trailingComments) { - node.trailingComments = []; - } - node.trailingComments.push(comment); - comments.splice(cursor, 1); - } else { - cursor += 1; - } - } + const initialChunks = intersect( + Array.from(this.groupsIterable, g => new Set(g.chunks)) + ); - // already out of owned node - if (cursor === comments.length) { - return VisitorOption.Break; - } + const initialQueue = new Set(this.groupsIterable); - if (comments[cursor].extendedRange[0] > node.range[1]) { - return VisitorOption.Skip; - } - } - }); + for (const chunkGroup of initialQueue) { + for (const child of chunkGroup.childrenIterable) { + if (child instanceof Entrypoint) { + initialQueue.add(child); + } else { + queue.add(child); + } + } + } - return tree; - } + for (const chunkGroup of queue) { + for (const chunk of chunkGroup.chunks) { + if (!initialChunks.has(chunk)) { + chunks.add(chunk); + } + } + for (const child of chunkGroup.childrenIterable) { + queue.add(child); + } + } - exports.version = (__webpack_require__(15535)/* .version */ .i8); - exports.Syntax = Syntax; - exports.traverse = traverse; - exports.replace = replace; - exports.attachComments = attachComments; - exports.VisitorKeys = VisitorKeys; - exports.VisitorOption = VisitorOption; - exports.Controller = Controller; - exports.cloneEnvironment = function () { return clone({}); }; + return chunks; + } - return exports; -}(exports)); -/* vim: set sw=4 ts=4 et tw=80 : */ + /** + * @returns {Set} a set of all the initial chunks (including itself) + */ + getAllInitialChunks() { + const chunks = new Set(); + const queue = new Set(this.groupsIterable); + for (const group of queue) { + if (group.isInitial()) { + for (const c of group.chunks) chunks.add(c); + for (const g of group.childrenIterable) queue.add(g); + } + } + return chunks; + } + /** + * @returns {Set} a set of all the referenced chunks (including itself) + */ + getAllReferencedChunks() { + const queue = new Set(this.groupsIterable); + const chunks = new Set(); -/***/ }), + for (const chunkGroup of queue) { + for (const chunk of chunkGroup.chunks) { + chunks.add(chunk); + } + for (const child of chunkGroup.childrenIterable) { + queue.add(child); + } + } -/***/ 86140: -/***/ (function(module) { + return chunks; + } -module.exports = function (glob, opts) { - if (typeof glob !== 'string') { - throw new TypeError('Expected a string'); - } + /** + * @returns {Set} a set of all the referenced entrypoints + */ + getAllReferencedAsyncEntrypoints() { + const queue = new Set(this.groupsIterable); + const entrypoints = new Set(); - var str = String(glob); + for (const chunkGroup of queue) { + for (const entrypoint of chunkGroup.asyncEntrypointsIterable) { + entrypoints.add(entrypoint); + } + for (const child of chunkGroup.childrenIterable) { + queue.add(child); + } + } - // The regexp we are building, as a string. - var reStr = ""; + return entrypoints; + } - // Whether we are matching so called "extended" globs (like bash) and should - // support single character matching, matching ranges of characters, group - // matching, etc. - var extended = opts ? !!opts.extended : false; + /** + * @returns {boolean} true, if the chunk references async chunks + */ + hasAsyncChunks() { + const queue = new Set(); - // When globstar is _false_ (default), '/foo/*' is translated a regexp like - // '^\/foo\/.*$' which will match any string beginning with '/foo/' - // When globstar is _true_, '/foo/*' is translated to regexp like - // '^\/foo\/[^/]*$' which will match any string beginning with '/foo/' BUT - // which does not have a '/' to the right of it. - // E.g. with '/foo/*' these will match: '/foo/bar', '/foo/bar.txt' but - // these will not '/foo/bar/baz', '/foo/bar/baz.txt' - // Lastely, when globstar is _true_, '/foo/**' is equivelant to '/foo/*' when - // globstar is _false_ - var globstar = opts ? !!opts.globstar : false; + const initialChunks = intersect( + Array.from(this.groupsIterable, g => new Set(g.chunks)) + ); - // If we are doing extended matching, this boolean is true when we are inside - // a group (eg {*.html,*.js}), and false otherwise. - var inGroup = false; + for (const chunkGroup of this.groupsIterable) { + for (const child of chunkGroup.childrenIterable) { + queue.add(child); + } + } - // RegExp flags (eg "i" ) to pass in to RegExp constructor. - var flags = opts && typeof( opts.flags ) === "string" ? opts.flags : ""; + for (const chunkGroup of queue) { + for (const chunk of chunkGroup.chunks) { + if (!initialChunks.has(chunk)) { + return true; + } + } + for (const child of chunkGroup.childrenIterable) { + queue.add(child); + } + } - var c; - for (var i = 0, len = str.length; i < len; i++) { - c = str[i]; + return false; + } - switch (c) { - case "/": - case "$": - case "^": - case "+": - case ".": - case "(": - case ")": - case "=": - case "!": - case "|": - reStr += "\\" + c; - break; + /** + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {ChunkFilterPredicate=} filterFn function used to filter chunks + * @returns {Record} a record object of names to lists of child ids(?) + */ + getChildIdsByOrders(chunkGraph, filterFn) { + /** @type {Map} */ + const lists = new Map(); + for (const group of this.groupsIterable) { + if (group.chunks[group.chunks.length - 1] === this) { + for (const childGroup of group.childrenIterable) { + for (const key of Object.keys(childGroup.options)) { + if (key.endsWith("Order")) { + const name = key.substr(0, key.length - "Order".length); + let list = lists.get(name); + if (list === undefined) { + list = []; + lists.set(name, list); + } + list.push({ + order: childGroup.options[key], + group: childGroup + }); + } + } + } + } + } + /** @type {Record} */ + const result = Object.create(null); + for (const [name, list] of lists) { + list.sort((a, b) => { + const cmp = b.order - a.order; + if (cmp !== 0) return cmp; + return a.group.compareTo(chunkGraph, b.group); + }); + /** @type {Set} */ + const chunkIdSet = new Set(); + for (const item of list) { + for (const chunk of item.group.chunks) { + if (filterFn && !filterFn(chunk, chunkGraph)) continue; + chunkIdSet.add(chunk.id); + } + } + if (chunkIdSet.size > 0) { + result[name] = Array.from(chunkIdSet); + } + } + return result; + } - case "?": - if (extended) { - reStr += "."; - break; - } + /** + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {string} type option name + * @returns {{ onChunks: Chunk[], chunks: Set }[]} referenced chunks for a specific type + */ + getChildrenOfTypeInOrder(chunkGraph, type) { + const list = []; + for (const group of this.groupsIterable) { + for (const childGroup of group.childrenIterable) { + const order = childGroup.options[type]; + if (order === undefined) continue; + list.push({ + order, + group, + childGroup + }); + } + } + if (list.length === 0) return undefined; + list.sort((a, b) => { + const cmp = b.order - a.order; + if (cmp !== 0) return cmp; + return a.group.compareTo(chunkGraph, b.group); + }); + const result = []; + let lastEntry; + for (const { group, childGroup } of list) { + if (lastEntry && lastEntry.onChunks === group.chunks) { + for (const chunk of childGroup.chunks) { + lastEntry.chunks.add(chunk); + } + } else { + result.push( + (lastEntry = { + onChunks: group.chunks, + chunks: new Set(childGroup.chunks) + }) + ); + } + } + return result; + } - case "[": - case "]": - if (extended) { - reStr += c; - break; - } + /** + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {boolean=} includeDirectChildren include direct children (by default only children of async children are included) + * @param {ChunkFilterPredicate=} filterFn function used to filter chunks + * @returns {Record>} a record object of names to lists of child ids(?) by chunk id + */ + getChildIdsByOrdersMap(chunkGraph, includeDirectChildren, filterFn) { + /** @type {Record>} */ + const chunkMaps = Object.create(null); - case "{": - if (extended) { - inGroup = true; - reStr += "("; - break; - } + /** + * @param {Chunk} chunk a chunk + * @returns {void} + */ + const addChildIdsByOrdersToMap = chunk => { + const data = chunk.getChildIdsByOrders(chunkGraph, filterFn); + for (const key of Object.keys(data)) { + let chunkMap = chunkMaps[key]; + if (chunkMap === undefined) { + chunkMaps[key] = chunkMap = Object.create(null); + } + chunkMap[chunk.id] = data[key]; + } + }; - case "}": - if (extended) { - inGroup = false; - reStr += ")"; - break; - } + if (includeDirectChildren) { + /** @type {Set} */ + const chunks = new Set(); + for (const chunkGroup of this.groupsIterable) { + for (const chunk of chunkGroup.chunks) { + chunks.add(chunk); + } + } + for (const chunk of chunks) { + addChildIdsByOrdersToMap(chunk); + } + } - case ",": - if (inGroup) { - reStr += "|"; - break; - } - reStr += "\\" + c; - break; - - case "*": - // Move over all consecutive "*"'s. - // Also store the previous and next characters - var prevChar = str[i - 1]; - var starCount = 1; - while(str[i + 1] === "*") { - starCount++; - i++; - } - var nextChar = str[i + 1]; - - if (!globstar) { - // globstar is disabled, so treat any number of "*" as one - reStr += ".*"; - } else { - // globstar is enabled, so determine if this is a globstar segment - var isGlobstar = starCount > 1 // multiple "*"'s - && (prevChar === "/" || prevChar === undefined) // from the start of the segment - && (nextChar === "/" || nextChar === undefined) // to the end of the segment - - if (isGlobstar) { - // it's a globstar, so match zero or more path segments - reStr += "((?:[^/]*(?:\/|$))*)"; - i++; // move over the "/" - } else { - // it's not a globstar, so only match one path segment - reStr += "([^/]*)"; - } - } - break; - - default: - reStr += c; - } - } + for (const chunk of this.getAllAsyncChunks()) { + addChildIdsByOrdersToMap(chunk); + } - // When regexp 'g' flag is specified don't - // constrain the regular expression with ^ & $ - if (!flags || !~flags.indexOf('g')) { - reStr = "^" + reStr + "$"; - } + return chunkMaps; + } +} - return new RegExp(reStr, flags); -}; +module.exports = Chunk; /***/ }), -/***/ 89132: -/***/ (function(module) { +/***/ 64971: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -module.exports = clone - -var getPrototypeOf = Object.getPrototypeOf || function (obj) { - return obj.__proto__ -} - -function clone (obj) { - if (obj === null || typeof obj !== 'object') - return obj - - if (obj instanceof Object) - var copy = { __proto__: getPrototypeOf(obj) } - else - var copy = Object.create(null) - - Object.getOwnPropertyNames(obj).forEach(function (key) { - Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) - }) - return copy -} +const util = __webpack_require__(73837); +const Entrypoint = __webpack_require__(13795); +const ModuleGraphConnection = __webpack_require__(40639); +const { first } = __webpack_require__(93347); +const SortableSet = __webpack_require__(13098); +const { + compareModulesById, + compareIterables, + compareModulesByIdentifier, + concatComparators, + compareSelect, + compareIds +} = __webpack_require__(29579); +const createHash = __webpack_require__(49835); +const findGraphRoots = __webpack_require__(6261); +const { + RuntimeSpecMap, + RuntimeSpecSet, + runtimeToString, + mergeRuntime, + forEachRuntime +} = __webpack_require__(17156); +/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./ChunkGroup")} ChunkGroup */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./RuntimeModule")} RuntimeModule */ +/** @typedef {typeof import("./util/Hash")} Hash */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ -/***/ }), +/** @type {ReadonlySet} */ +const EMPTY_SET = new Set(); -/***/ 90552: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +const ZERO_BIG_INT = BigInt(0); -var fs = __webpack_require__(57147) -var polyfills = __webpack_require__(11290) -var legacy = __webpack_require__(54410) -var clone = __webpack_require__(89132) +const compareModuleIterables = compareIterables(compareModulesByIdentifier); -var util = __webpack_require__(73837) +/** @typedef {(c: Chunk, chunkGraph: ChunkGraph) => boolean} ChunkFilterPredicate */ +/** @typedef {(m: Module) => boolean} ModuleFilterPredicate */ +/** @typedef {[Module, Entrypoint | undefined]} EntryModuleWithChunkGroup */ -/* istanbul ignore next - node 0.x polyfill */ -var gracefulQueue -var previousSymbol +/** + * @typedef {Object} ChunkSizeOptions + * @property {number=} chunkOverhead constant overhead for a chunk + * @property {number=} entryChunkMultiplicator multiplicator for initial chunks + */ -/* istanbul ignore else - node 0.x polyfill */ -if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { - gracefulQueue = Symbol.for('graceful-fs.queue') - // This is used in testing by future versions - previousSymbol = Symbol.for('graceful-fs.previous') -} else { - gracefulQueue = '___graceful-fs.queue' - previousSymbol = '___graceful-fs.previous' +class ModuleHashInfo { + constructor(hash, renderedHash) { + this.hash = hash; + this.renderedHash = renderedHash; + } } -function noop () {} +/** @template T @typedef {(set: SortableSet) => T[]} SetToArrayFunction */ -function publishQueue(context, queue) { - Object.defineProperty(context, gracefulQueue, { - get: function() { - return queue - } - }) -} +/** + * @template T + * @param {SortableSet} set the set + * @returns {T[]} set as array + */ +const getArray = set => { + return Array.from(set); +}; -var debug = noop -if (util.debuglog) - debug = util.debuglog('gfs4') -else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) - debug = function() { - var m = util.format.apply(util, arguments) - m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') - console.error(m) - } +/** + * @param {SortableSet} chunks the chunks + * @returns {RuntimeSpecSet} runtimes + */ +const getModuleRuntimes = chunks => { + const runtimes = new RuntimeSpecSet(); + for (const chunk of chunks) { + runtimes.add(chunk.runtime); + } + return runtimes; +}; -// Once time initialization -if (!fs[gracefulQueue]) { - // This queue can be shared by multiple loaded instances - var queue = global[gracefulQueue] || [] - publishQueue(fs, queue) +/** + * @param {SortableSet} set the set + * @returns {Map>} modules by source type + */ +const modulesBySourceType = set => { + /** @type {Map>} */ + const map = new Map(); + for (const module of set) { + for (const sourceType of module.getSourceTypes()) { + let innerSet = map.get(sourceType); + if (innerSet === undefined) { + innerSet = new SortableSet(); + map.set(sourceType, innerSet); + } + innerSet.add(module); + } + } + for (const [key, innerSet] of map) { + // When all modules have the source type, we reuse the original SortableSet + // to benefit from the shared cache (especially for sorting) + if (innerSet.size === set.size) { + map.set(key, set); + } + } + return map; +}; - // Patch fs.close/closeSync to shared queue version, because we need - // to retry() whenever a close happens *anywhere* in the program. - // This is essential when multiple graceful-fs instances are - // in play at the same time. - fs.close = (function (fs$close) { - function close (fd, cb) { - return fs$close.call(fs, fd, function (err) { - // This function uses the graceful-fs shared queue - if (!err) { - resetQueue() - } +/** @type {WeakMap} */ +const createOrderedArrayFunctionMap = new WeakMap(); - if (typeof cb === 'function') - cb.apply(this, arguments) - }) - } +/** + * @template T + * @param {function(T, T): -1|0|1} comparator comparator function + * @returns {SetToArrayFunction} set as ordered array + */ +const createOrderedArrayFunction = comparator => { + /** @type {SetToArrayFunction} */ + let fn = createOrderedArrayFunctionMap.get(comparator); + if (fn !== undefined) return fn; + fn = set => { + set.sortWith(comparator); + return Array.from(set); + }; + createOrderedArrayFunctionMap.set(comparator, fn); + return fn; +}; - Object.defineProperty(close, previousSymbol, { - value: fs$close - }) - return close - })(fs.close) +/** + * @param {Iterable} modules the modules to get the count/size of + * @returns {number} the size of the modules + */ +const getModulesSize = modules => { + let size = 0; + for (const module of modules) { + for (const type of module.getSourceTypes()) { + size += module.size(type); + } + } + return size; +}; - fs.closeSync = (function (fs$closeSync) { - function closeSync (fd) { - // This function uses the graceful-fs shared queue - fs$closeSync.apply(fs, arguments) - resetQueue() - } +/** + * @param {Iterable} modules the sortable Set to get the size of + * @returns {Record} the sizes of the modules + */ +const getModulesSizes = modules => { + let sizes = Object.create(null); + for (const module of modules) { + for (const type of module.getSourceTypes()) { + sizes[type] = (sizes[type] || 0) + module.size(type); + } + } + return sizes; +}; - Object.defineProperty(closeSync, previousSymbol, { - value: fs$closeSync - }) - return closeSync - })(fs.closeSync) +/** + * @param {Chunk} a chunk + * @param {Chunk} b chunk + * @returns {boolean} true, if a is always a parent of b + */ +const isAvailableChunk = (a, b) => { + const queue = new Set(b.groupsIterable); + for (const chunkGroup of queue) { + if (a.isInGroup(chunkGroup)) continue; + if (chunkGroup.isInitial()) return false; + for (const parent of chunkGroup.parentsIterable) { + queue.add(parent); + } + } + return true; +}; - if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { - process.on('exit', function() { - debug(fs[gracefulQueue]) - __webpack_require__(39491).equal(fs[gracefulQueue].length, 0) - }) - } +class ChunkGraphModule { + constructor() { + /** @type {SortableSet} */ + this.chunks = new SortableSet(); + /** @type {Set | undefined} */ + this.entryInChunks = undefined; + /** @type {Set | undefined} */ + this.runtimeInChunks = undefined; + /** @type {RuntimeSpecMap} */ + this.hashes = undefined; + /** @type {string | number} */ + this.id = null; + /** @type {RuntimeSpecMap> | undefined} */ + this.runtimeRequirements = undefined; + /** @type {RuntimeSpecMap} */ + this.graphHashes = undefined; + /** @type {RuntimeSpecMap} */ + this.graphHashesWithConnections = undefined; + } } -if (!global[gracefulQueue]) { - publishQueue(global, fs[gracefulQueue]); +class ChunkGraphChunk { + constructor() { + /** @type {SortableSet} */ + this.modules = new SortableSet(); + /** @type {Map} */ + this.entryModules = new Map(); + /** @type {SortableSet} */ + this.runtimeModules = new SortableSet(); + /** @type {Set | undefined} */ + this.fullHashModules = undefined; + /** @type {Set | undefined} */ + this.dependentHashModules = undefined; + /** @type {Set | undefined} */ + this.runtimeRequirements = undefined; + /** @type {Set} */ + this.runtimeRequirementsInTree = new Set(); + } } -module.exports = patch(clone(fs)) -if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { - module.exports = patch(fs) - fs.__patched = true; -} +class ChunkGraph { + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {string | Hash} hashFunction the hash function to use + */ + constructor(moduleGraph, hashFunction = "md4") { + /** @private @type {WeakMap} */ + this._modules = new WeakMap(); + /** @private @type {WeakMap} */ + this._chunks = new WeakMap(); + /** @private @type {WeakMap} */ + this._blockChunkGroups = new WeakMap(); + /** @private @type {Map} */ + this._runtimeIds = new Map(); + /** @type {ModuleGraph} */ + this.moduleGraph = moduleGraph; -function patch (fs) { - // Everything that references the open() function needs to be in here - polyfills(fs) - fs.gracefulify = patch + this._hashFunction = hashFunction; - fs.createReadStream = createReadStream - fs.createWriteStream = createWriteStream - var fs$readFile = fs.readFile - fs.readFile = readFile - function readFile (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null + this._getGraphRoots = this._getGraphRoots.bind(this); + } - return go$readFile(path, options, cb) + /** + * @private + * @param {Module} module the module + * @returns {ChunkGraphModule} internal module + */ + _getChunkGraphModule(module) { + let cgm = this._modules.get(module); + if (cgm === undefined) { + cgm = new ChunkGraphModule(); + this._modules.set(module, cgm); + } + return cgm; + } - function go$readFile (path, options, cb, startTime) { - return fs$readFile(path, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } + /** + * @private + * @param {Chunk} chunk the chunk + * @returns {ChunkGraphChunk} internal chunk + */ + _getChunkGraphChunk(chunk) { + let cgc = this._chunks.get(chunk); + if (cgc === undefined) { + cgc = new ChunkGraphChunk(); + this._chunks.set(chunk, cgc); + } + return cgc; + } - var fs$writeFile = fs.writeFile - fs.writeFile = writeFile - function writeFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null + /** + * @param {SortableSet} set the sortable Set to get the roots of + * @returns {Module[]} the graph roots + */ + _getGraphRoots(set) { + const { moduleGraph } = this; + return Array.from( + findGraphRoots(set, module => { + /** @type {Set} */ + const set = new Set(); + const addDependencies = module => { + for (const connection of moduleGraph.getOutgoingConnections(module)) { + if (!connection.module) continue; + const activeState = connection.getActiveState(undefined); + if (activeState === false) continue; + if (activeState === ModuleGraphConnection.TRANSITIVE_ONLY) { + addDependencies(connection.module); + continue; + } + set.add(connection.module); + } + }; + addDependencies(module); + return set; + }) + ).sort(compareModulesByIdentifier); + } - return go$writeFile(path, data, options, cb) + /** + * @param {Chunk} chunk the new chunk + * @param {Module} module the module + * @returns {void} + */ + connectChunkAndModule(chunk, module) { + const cgm = this._getChunkGraphModule(module); + const cgc = this._getChunkGraphChunk(chunk); + cgm.chunks.add(chunk); + cgc.modules.add(module); + } - function go$writeFile (path, data, options, cb, startTime) { - return fs$writeFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } + /** + * @param {Chunk} chunk the chunk + * @param {Module} module the module + * @returns {void} + */ + disconnectChunkAndModule(chunk, module) { + const cgm = this._getChunkGraphModule(module); + const cgc = this._getChunkGraphChunk(chunk); + cgc.modules.delete(module); + cgm.chunks.delete(chunk); + } - var fs$appendFile = fs.appendFile - if (fs$appendFile) - fs.appendFile = appendFile - function appendFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null + /** + * @param {Chunk} chunk the chunk which will be disconnected + * @returns {void} + */ + disconnectChunk(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + for (const module of cgc.modules) { + const cgm = this._getChunkGraphModule(module); + cgm.chunks.delete(chunk); + } + cgc.modules.clear(); + chunk.disconnectFromGroups(); + ChunkGraph.clearChunkGraphForChunk(chunk); + } - return go$appendFile(path, data, options, cb) - - function go$appendFile (path, data, options, cb, startTime) { - return fs$appendFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } + /** + * @param {Chunk} chunk the chunk + * @param {Iterable} modules the modules + * @returns {void} + */ + attachModules(chunk, modules) { + const cgc = this._getChunkGraphChunk(chunk); + for (const module of modules) { + cgc.modules.add(module); + } + } - var fs$copyFile = fs.copyFile - if (fs$copyFile) - fs.copyFile = copyFile - function copyFile (src, dest, flags, cb) { - if (typeof flags === 'function') { - cb = flags - flags = 0 - } - return go$copyFile(src, dest, flags, cb) + /** + * @param {Chunk} chunk the chunk + * @param {Iterable} modules the runtime modules + * @returns {void} + */ + attachRuntimeModules(chunk, modules) { + const cgc = this._getChunkGraphChunk(chunk); + for (const module of modules) { + cgc.runtimeModules.add(module); + } + } - function go$copyFile (src, dest, flags, cb, startTime) { - return fs$copyFile(src, dest, flags, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } + /** + * @param {Chunk} chunk the chunk + * @param {Iterable} modules the modules that require a full hash + * @returns {void} + */ + attachFullHashModules(chunk, modules) { + const cgc = this._getChunkGraphChunk(chunk); + if (cgc.fullHashModules === undefined) cgc.fullHashModules = new Set(); + for (const module of modules) { + cgc.fullHashModules.add(module); + } + } - var fs$readdir = fs.readdir - fs.readdir = readdir - function readdir (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null + /** + * @param {Chunk} chunk the chunk + * @param {Iterable} modules the modules that require a full hash + * @returns {void} + */ + attachDependentHashModules(chunk, modules) { + const cgc = this._getChunkGraphChunk(chunk); + if (cgc.dependentHashModules === undefined) + cgc.dependentHashModules = new Set(); + for (const module of modules) { + cgc.dependentHashModules.add(module); + } + } - return go$readdir(path, options, cb) + /** + * @param {Module} oldModule the replaced module + * @param {Module} newModule the replacing module + * @returns {void} + */ + replaceModule(oldModule, newModule) { + const oldCgm = this._getChunkGraphModule(oldModule); + const newCgm = this._getChunkGraphModule(newModule); - function go$readdir (path, options, cb, startTime) { - return fs$readdir(path, options, function (err, files) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readdir, [path, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (files && files.sort) - files.sort() + for (const chunk of oldCgm.chunks) { + const cgc = this._getChunkGraphChunk(chunk); + cgc.modules.delete(oldModule); + cgc.modules.add(newModule); + newCgm.chunks.add(chunk); + } + oldCgm.chunks.clear(); - if (typeof cb === 'function') - cb.call(this, err, files) - } - }) - } - } + if (oldCgm.entryInChunks !== undefined) { + if (newCgm.entryInChunks === undefined) { + newCgm.entryInChunks = new Set(); + } + for (const chunk of oldCgm.entryInChunks) { + const cgc = this._getChunkGraphChunk(chunk); + const old = cgc.entryModules.get(oldModule); + /** @type {Map} */ + const newEntryModules = new Map(); + for (const [m, cg] of cgc.entryModules) { + if (m === oldModule) { + newEntryModules.set(newModule, old); + } else { + newEntryModules.set(m, cg); + } + } + cgc.entryModules = newEntryModules; + newCgm.entryInChunks.add(chunk); + } + oldCgm.entryInChunks = undefined; + } - if (process.version.substr(0, 4) === 'v0.8') { - var legStreams = legacy(fs) - ReadStream = legStreams.ReadStream - WriteStream = legStreams.WriteStream - } + if (oldCgm.runtimeInChunks !== undefined) { + if (newCgm.runtimeInChunks === undefined) { + newCgm.runtimeInChunks = new Set(); + } + for (const chunk of oldCgm.runtimeInChunks) { + const cgc = this._getChunkGraphChunk(chunk); + cgc.runtimeModules.delete(/** @type {RuntimeModule} */ (oldModule)); + cgc.runtimeModules.add(/** @type {RuntimeModule} */ (newModule)); + newCgm.runtimeInChunks.add(chunk); + if ( + cgc.fullHashModules !== undefined && + cgc.fullHashModules.has(/** @type {RuntimeModule} */ (oldModule)) + ) { + cgc.fullHashModules.delete(/** @type {RuntimeModule} */ (oldModule)); + cgc.fullHashModules.add(/** @type {RuntimeModule} */ (newModule)); + } + if ( + cgc.dependentHashModules !== undefined && + cgc.dependentHashModules.has(/** @type {RuntimeModule} */ (oldModule)) + ) { + cgc.dependentHashModules.delete( + /** @type {RuntimeModule} */ (oldModule) + ); + cgc.dependentHashModules.add( + /** @type {RuntimeModule} */ (newModule) + ); + } + } + oldCgm.runtimeInChunks = undefined; + } + } - var fs$ReadStream = fs.ReadStream - if (fs$ReadStream) { - ReadStream.prototype = Object.create(fs$ReadStream.prototype) - ReadStream.prototype.open = ReadStream$open - } + /** + * @param {Module} module the checked module + * @param {Chunk} chunk the checked chunk + * @returns {boolean} true, if the chunk contains the module + */ + isModuleInChunk(module, chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.modules.has(module); + } - var fs$WriteStream = fs.WriteStream - if (fs$WriteStream) { - WriteStream.prototype = Object.create(fs$WriteStream.prototype) - WriteStream.prototype.open = WriteStream$open - } + /** + * @param {Module} module the checked module + * @param {ChunkGroup} chunkGroup the checked chunk group + * @returns {boolean} true, if the chunk contains the module + */ + isModuleInChunkGroup(module, chunkGroup) { + for (const chunk of chunkGroup.chunks) { + if (this.isModuleInChunk(module, chunk)) return true; + } + return false; + } - Object.defineProperty(fs, 'ReadStream', { - get: function () { - return ReadStream - }, - set: function (val) { - ReadStream = val - }, - enumerable: true, - configurable: true - }) - Object.defineProperty(fs, 'WriteStream', { - get: function () { - return WriteStream - }, - set: function (val) { - WriteStream = val - }, - enumerable: true, - configurable: true - }) + /** + * @param {Module} module the checked module + * @returns {boolean} true, if the module is entry of any chunk + */ + isEntryModule(module) { + const cgm = this._getChunkGraphModule(module); + return cgm.entryInChunks !== undefined; + } - // legacy names - var FileReadStream = ReadStream - Object.defineProperty(fs, 'FileReadStream', { - get: function () { - return FileReadStream - }, - set: function (val) { - FileReadStream = val - }, - enumerable: true, - configurable: true - }) - var FileWriteStream = WriteStream - Object.defineProperty(fs, 'FileWriteStream', { - get: function () { - return FileWriteStream - }, - set: function (val) { - FileWriteStream = val - }, - enumerable: true, - configurable: true - }) + /** + * @param {Module} module the module + * @returns {Iterable} iterable of chunks (do not modify) + */ + getModuleChunksIterable(module) { + const cgm = this._getChunkGraphModule(module); + return cgm.chunks; + } - function ReadStream (path, options) { - if (this instanceof ReadStream) - return fs$ReadStream.apply(this, arguments), this - else - return ReadStream.apply(Object.create(ReadStream.prototype), arguments) - } + /** + * @param {Module} module the module + * @param {function(Chunk, Chunk): -1|0|1} sortFn sort function + * @returns {Iterable} iterable of chunks (do not modify) + */ + getOrderedModuleChunksIterable(module, sortFn) { + const cgm = this._getChunkGraphModule(module); + cgm.chunks.sortWith(sortFn); + return cgm.chunks; + } - function ReadStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - if (that.autoClose) - that.destroy() + /** + * @param {Module} module the module + * @returns {Chunk[]} array of chunks (cached, do not modify) + */ + getModuleChunks(module) { + const cgm = this._getChunkGraphModule(module); + return cgm.chunks.getFromCache(getArray); + } - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - that.read() - } - }) - } + /** + * @param {Module} module the module + * @returns {number} the number of chunk which contain the module + */ + getNumberOfModuleChunks(module) { + const cgm = this._getChunkGraphModule(module); + return cgm.chunks.size; + } - function WriteStream (path, options) { - if (this instanceof WriteStream) - return fs$WriteStream.apply(this, arguments), this - else - return WriteStream.apply(Object.create(WriteStream.prototype), arguments) - } + /** + * @param {Module} module the module + * @returns {RuntimeSpecSet} runtimes + */ + getModuleRuntimes(module) { + const cgm = this._getChunkGraphModule(module); + return cgm.chunks.getFromUnorderedCache(getModuleRuntimes); + } - function WriteStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - that.destroy() - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - } - }) - } + /** + * @param {Chunk} chunk the chunk + * @returns {number} the number of modules which are contained in this chunk + */ + getNumberOfChunkModules(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.modules.size; + } - function createReadStream (path, options) { - return new fs.ReadStream(path, options) - } + /** + * @param {Chunk} chunk the chunk + * @returns {number} the number of full hash modules which are contained in this chunk + */ + getNumberOfChunkFullHashModules(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.fullHashModules === undefined ? 0 : cgc.fullHashModules.size; + } - function createWriteStream (path, options) { - return new fs.WriteStream(path, options) - } + /** + * @param {Chunk} chunk the chunk + * @returns {Iterable} return the modules for this chunk + */ + getChunkModulesIterable(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.modules; + } - var fs$open = fs.open - fs.open = open - function open (path, flags, mode, cb) { - if (typeof mode === 'function') - cb = mode, mode = null + /** + * @param {Chunk} chunk the chunk + * @param {string} sourceType source type + * @returns {Iterable | undefined} return the modules for this chunk + */ + getChunkModulesIterableBySourceType(chunk, sourceType) { + const cgc = this._getChunkGraphChunk(chunk); + const modulesWithSourceType = cgc.modules + .getFromUnorderedCache(modulesBySourceType) + .get(sourceType); + return modulesWithSourceType; + } - return go$open(path, flags, mode, cb) + /** + * @param {Chunk} chunk the chunk + * @param {function(Module, Module): -1|0|1} comparator comparator function + * @returns {Iterable} return the modules for this chunk + */ + getOrderedChunkModulesIterable(chunk, comparator) { + const cgc = this._getChunkGraphChunk(chunk); + cgc.modules.sortWith(comparator); + return cgc.modules; + } - function go$open (path, flags, mode, cb, startTime) { - return fs$open(path, flags, mode, function (err, fd) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } + /** + * @param {Chunk} chunk the chunk + * @param {string} sourceType source type + * @param {function(Module, Module): -1|0|1} comparator comparator function + * @returns {Iterable | undefined} return the modules for this chunk + */ + getOrderedChunkModulesIterableBySourceType(chunk, sourceType, comparator) { + const cgc = this._getChunkGraphChunk(chunk); + const modulesWithSourceType = cgc.modules + .getFromUnorderedCache(modulesBySourceType) + .get(sourceType); + if (modulesWithSourceType === undefined) return undefined; + modulesWithSourceType.sortWith(comparator); + return modulesWithSourceType; + } - return fs -} + /** + * @param {Chunk} chunk the chunk + * @returns {Module[]} return the modules for this chunk (cached, do not modify) + */ + getChunkModules(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.modules.getFromUnorderedCache(getArray); + } -function enqueue (elem) { - debug('ENQUEUE', elem[0].name, elem[1]) - fs[gracefulQueue].push(elem) - retry() -} + /** + * @param {Chunk} chunk the chunk + * @param {function(Module, Module): -1|0|1} comparator comparator function + * @returns {Module[]} return the modules for this chunk (cached, do not modify) + */ + getOrderedChunkModules(chunk, comparator) { + const cgc = this._getChunkGraphChunk(chunk); + const arrayFunction = createOrderedArrayFunction(comparator); + return cgc.modules.getFromUnorderedCache(arrayFunction); + } -// keep track of the timeout between retry() calls -var retryTimer + /** + * @param {Chunk} chunk the chunk + * @param {ModuleFilterPredicate} filterFn function used to filter modules + * @param {boolean} includeAllChunks all chunks or only async chunks + * @returns {Record} chunk to module ids object + */ + getChunkModuleIdMap(chunk, filterFn, includeAllChunks = false) { + /** @type {Record} */ + const chunkModuleIdMap = Object.create(null); -// reset the startTime and lastTime to now -// this resets the start of the 60 second overall timeout as well as the -// delay between attempts so that we'll retry these jobs sooner -function resetQueue () { - var now = Date.now() - for (var i = 0; i < fs[gracefulQueue].length; ++i) { - // entries that are only a length of 2 are from an older version, don't - // bother modifying those since they'll be retried anyway. - if (fs[gracefulQueue][i].length > 2) { - fs[gracefulQueue][i][3] = now // startTime - fs[gracefulQueue][i][4] = now // lastTime - } - } - // call retry to make sure we're actively processing the queue - retry() -} + for (const asyncChunk of includeAllChunks + ? chunk.getAllReferencedChunks() + : chunk.getAllAsyncChunks()) { + /** @type {(string|number)[]} */ + let array; + for (const module of this.getOrderedChunkModulesIterable( + asyncChunk, + compareModulesById(this) + )) { + if (filterFn(module)) { + if (array === undefined) { + array = []; + chunkModuleIdMap[asyncChunk.id] = array; + } + const moduleId = this.getModuleId(module); + array.push(moduleId); + } + } + } -function retry () { - // clear the timer and remove it to help prevent unintended concurrency - clearTimeout(retryTimer) - retryTimer = undefined + return chunkModuleIdMap; + } - if (fs[gracefulQueue].length === 0) - return - - var elem = fs[gracefulQueue].shift() - var fn = elem[0] - var args = elem[1] - // these items may be unset if they were added by an older graceful-fs - var err = elem[2] - var startTime = elem[3] - var lastTime = elem[4] - - // if we don't have a startTime we have no way of knowing if we've waited - // long enough, so go ahead and retry this item now - if (startTime === undefined) { - debug('RETRY', fn.name, args) - fn.apply(null, args) - } else if (Date.now() - startTime >= 60000) { - // it's been more than 60 seconds total, bail now - debug('TIMEOUT', fn.name, args) - var cb = args.pop() - if (typeof cb === 'function') - cb.call(null, err) - } else { - // the amount of time between the last attempt and right now - var sinceAttempt = Date.now() - lastTime - // the amount of time between when we first tried, and when we last tried - // rounded up to at least 1 - var sinceStart = Math.max(lastTime - startTime, 1) - // backoff. wait longer than the total time we've been retrying, but only - // up to a maximum of 100ms - var desiredDelay = Math.min(sinceStart * 1.2, 100) - // it's been long enough since the last retry, do it again - if (sinceAttempt >= desiredDelay) { - debug('RETRY', fn.name, args) - fn.apply(null, args.concat([startTime])) - } else { - // if we can't do this job yet, push it to the end of the queue - // and let the next iteration check again - fs[gracefulQueue].push(elem) - } - } - - // schedule our next run if one isn't already scheduled - if (retryTimer === undefined) { - retryTimer = setTimeout(retry, 0) - } -} + /** + * @param {Chunk} chunk the chunk + * @param {ModuleFilterPredicate} filterFn function used to filter modules + * @param {number} hashLength length of the hash + * @param {boolean} includeAllChunks all chunks or only async chunks + * @returns {Record>} chunk to module id to module hash object + */ + getChunkModuleRenderedHashMap( + chunk, + filterFn, + hashLength = 0, + includeAllChunks = false + ) { + /** @type {Record>} */ + const chunkModuleHashMap = Object.create(null); + for (const asyncChunk of includeAllChunks + ? chunk.getAllReferencedChunks() + : chunk.getAllAsyncChunks()) { + /** @type {Record} */ + let idToHashMap; + for (const module of this.getOrderedChunkModulesIterable( + asyncChunk, + compareModulesById(this) + )) { + if (filterFn(module)) { + if (idToHashMap === undefined) { + idToHashMap = Object.create(null); + chunkModuleHashMap[asyncChunk.id] = idToHashMap; + } + const moduleId = this.getModuleId(module); + const hash = this.getRenderedModuleHash(module, asyncChunk.runtime); + idToHashMap[moduleId] = hashLength ? hash.slice(0, hashLength) : hash; + } + } + } -/***/ }), + return chunkModuleHashMap; + } -/***/ 54410: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * @param {Chunk} chunk the chunk + * @param {ChunkFilterPredicate} filterFn function used to filter chunks + * @returns {Record} chunk map + */ + getChunkConditionMap(chunk, filterFn) { + const map = Object.create(null); + for (const c of chunk.getAllReferencedChunks()) { + map[c.id] = filterFn(c, this); + } + return map; + } -var Stream = (__webpack_require__(12781).Stream) + /** + * @param {Chunk} chunk the chunk + * @param {ModuleFilterPredicate} filterFn predicate function used to filter modules + * @param {ChunkFilterPredicate=} filterChunkFn predicate function used to filter chunks + * @returns {boolean} return true if module exists in graph + */ + hasModuleInGraph(chunk, filterFn, filterChunkFn) { + const queue = new Set(chunk.groupsIterable); + const chunksProcessed = new Set(); -module.exports = legacy + for (const chunkGroup of queue) { + for (const innerChunk of chunkGroup.chunks) { + if (!chunksProcessed.has(innerChunk)) { + chunksProcessed.add(innerChunk); + if (!filterChunkFn || filterChunkFn(innerChunk, this)) { + for (const module of this.getChunkModulesIterable(innerChunk)) { + if (filterFn(module)) { + return true; + } + } + } + } + } + for (const child of chunkGroup.childrenIterable) { + queue.add(child); + } + } + return false; + } -function legacy (fs) { - return { - ReadStream: ReadStream, - WriteStream: WriteStream - } + /** + * @param {Chunk} chunkA first chunk + * @param {Chunk} chunkB second chunk + * @returns {-1|0|1} this is a comparator function like sort and returns -1, 0, or 1 based on sort order + */ + compareChunks(chunkA, chunkB) { + const cgcA = this._getChunkGraphChunk(chunkA); + const cgcB = this._getChunkGraphChunk(chunkB); + if (cgcA.modules.size > cgcB.modules.size) return -1; + if (cgcA.modules.size < cgcB.modules.size) return 1; + cgcA.modules.sortWith(compareModulesByIdentifier); + cgcB.modules.sortWith(compareModulesByIdentifier); + return compareModuleIterables(cgcA.modules, cgcB.modules); + } - function ReadStream (path, options) { - if (!(this instanceof ReadStream)) return new ReadStream(path, options); + /** + * @param {Chunk} chunk the chunk + * @returns {number} total size of all modules in the chunk + */ + getChunkModulesSize(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.modules.getFromUnorderedCache(getModulesSize); + } - Stream.call(this); + /** + * @param {Chunk} chunk the chunk + * @returns {Record} total sizes of all modules in the chunk by source type + */ + getChunkModulesSizes(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.modules.getFromUnorderedCache(getModulesSizes); + } - var self = this; + /** + * @param {Chunk} chunk the chunk + * @returns {Module[]} root modules of the chunks (ordered by identifier) + */ + getChunkRootModules(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.modules.getFromUnorderedCache(this._getGraphRoots); + } - this.path = path; - this.fd = null; - this.readable = true; - this.paused = false; + /** + * @param {Chunk} chunk the chunk + * @param {ChunkSizeOptions} options options object + * @returns {number} total size of the chunk + */ + getChunkSize(chunk, options = {}) { + const cgc = this._getChunkGraphChunk(chunk); + const modulesSize = cgc.modules.getFromUnorderedCache(getModulesSize); + const chunkOverhead = + typeof options.chunkOverhead === "number" ? options.chunkOverhead : 10000; + const entryChunkMultiplicator = + typeof options.entryChunkMultiplicator === "number" + ? options.entryChunkMultiplicator + : 10; + return ( + chunkOverhead + + modulesSize * (chunk.canBeInitial() ? entryChunkMultiplicator : 1) + ); + } - this.flags = 'r'; - this.mode = 438; /*=0666*/ - this.bufferSize = 64 * 1024; + /** + * @param {Chunk} chunkA chunk + * @param {Chunk} chunkB chunk + * @param {ChunkSizeOptions} options options object + * @returns {number} total size of the chunk or false if chunks can't be integrated + */ + getIntegratedChunksSize(chunkA, chunkB, options = {}) { + const cgcA = this._getChunkGraphChunk(chunkA); + const cgcB = this._getChunkGraphChunk(chunkB); + const allModules = new Set(cgcA.modules); + for (const m of cgcB.modules) allModules.add(m); + let modulesSize = getModulesSize(allModules); + const chunkOverhead = + typeof options.chunkOverhead === "number" ? options.chunkOverhead : 10000; + const entryChunkMultiplicator = + typeof options.entryChunkMultiplicator === "number" + ? options.entryChunkMultiplicator + : 10; + return ( + chunkOverhead + + modulesSize * + (chunkA.canBeInitial() || chunkB.canBeInitial() + ? entryChunkMultiplicator + : 1) + ); + } - options = options || {}; + /** + * @param {Chunk} chunkA chunk + * @param {Chunk} chunkB chunk + * @returns {boolean} true, if chunks could be integrated + */ + canChunksBeIntegrated(chunkA, chunkB) { + if (chunkA.preventIntegration || chunkB.preventIntegration) { + return false; + } - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } + const hasRuntimeA = chunkA.hasRuntime(); + const hasRuntimeB = chunkB.hasRuntime(); - if (this.encoding) this.setEncoding(this.encoding); + if (hasRuntimeA !== hasRuntimeB) { + if (hasRuntimeA) { + return isAvailableChunk(chunkA, chunkB); + } else if (hasRuntimeB) { + return isAvailableChunk(chunkB, chunkA); + } else { + return false; + } + } - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.end === undefined) { - this.end = Infinity; - } else if ('number' !== typeof this.end) { - throw TypeError('end must be a Number'); - } + if ( + this.getNumberOfEntryModules(chunkA) > 0 || + this.getNumberOfEntryModules(chunkB) > 0 + ) { + return false; + } - if (this.start > this.end) { - throw new Error('start must be <= end'); - } + return true; + } - this.pos = this.start; - } + /** + * @param {Chunk} chunkA the target chunk + * @param {Chunk} chunkB the chunk to integrate + * @returns {void} + */ + integrateChunks(chunkA, chunkB) { + // Decide for one name (deterministic) + if (chunkA.name && chunkB.name) { + if ( + this.getNumberOfEntryModules(chunkA) > 0 === + this.getNumberOfEntryModules(chunkB) > 0 + ) { + // When both chunks have entry modules or none have one, use + // shortest name + if (chunkA.name.length !== chunkB.name.length) { + chunkA.name = + chunkA.name.length < chunkB.name.length ? chunkA.name : chunkB.name; + } else { + chunkA.name = chunkA.name < chunkB.name ? chunkA.name : chunkB.name; + } + } else if (this.getNumberOfEntryModules(chunkB) > 0) { + // Pick the name of the chunk with the entry module + chunkA.name = chunkB.name; + } + } else if (chunkB.name) { + chunkA.name = chunkB.name; + } - if (this.fd !== null) { - process.nextTick(function() { - self._read(); - }); - return; - } + // Merge id name hints + for (const hint of chunkB.idNameHints) { + chunkA.idNameHints.add(hint); + } - fs.open(this.path, this.flags, this.mode, function (err, fd) { - if (err) { - self.emit('error', err); - self.readable = false; - return; - } + // Merge runtime + chunkA.runtime = mergeRuntime(chunkA.runtime, chunkB.runtime); - self.fd = fd; - self.emit('open', fd); - self._read(); - }) - } + // getChunkModules is used here to create a clone, because disconnectChunkAndModule modifies + for (const module of this.getChunkModules(chunkB)) { + this.disconnectChunkAndModule(chunkB, module); + this.connectChunkAndModule(chunkA, module); + } - function WriteStream (path, options) { - if (!(this instanceof WriteStream)) return new WriteStream(path, options); + for (const [module, chunkGroup] of Array.from( + this.getChunkEntryModulesWithChunkGroupIterable(chunkB) + )) { + this.disconnectChunkAndEntryModule(chunkB, module); + this.connectChunkAndEntryModule(chunkA, module, chunkGroup); + } - Stream.call(this); + for (const chunkGroup of chunkB.groupsIterable) { + chunkGroup.replaceChunk(chunkB, chunkA); + chunkA.addGroup(chunkGroup); + chunkB.removeGroup(chunkGroup); + } + ChunkGraph.clearChunkGraphForChunk(chunkB); + } - this.path = path; - this.fd = null; - this.writable = true; + /** + * @param {Chunk} chunk the chunk to upgrade + * @returns {void} + */ + upgradeDependentToFullHashModules(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + if (cgc.dependentHashModules === undefined) return; + if (cgc.fullHashModules === undefined) { + cgc.fullHashModules = cgc.dependentHashModules; + } else { + for (const m of cgc.dependentHashModules) { + cgc.fullHashModules.add(m); + } + cgc.dependentHashModules = undefined; + } + } - this.flags = 'w'; - this.encoding = 'binary'; - this.mode = 438; /*=0666*/ - this.bytesWritten = 0; + /** + * @param {Module} module the checked module + * @param {Chunk} chunk the checked chunk + * @returns {boolean} true, if the chunk contains the module as entry + */ + isEntryModuleInChunk(module, chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.entryModules.has(module); + } - options = options || {}; + /** + * @param {Chunk} chunk the new chunk + * @param {Module} module the entry module + * @param {Entrypoint=} entrypoint the chunk group which must be loaded before the module is executed + * @returns {void} + */ + connectChunkAndEntryModule(chunk, module, entrypoint) { + const cgm = this._getChunkGraphModule(module); + const cgc = this._getChunkGraphChunk(chunk); + if (cgm.entryInChunks === undefined) { + cgm.entryInChunks = new Set(); + } + cgm.entryInChunks.add(chunk); + cgc.entryModules.set(module, entrypoint); + } - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } + /** + * @param {Chunk} chunk the new chunk + * @param {RuntimeModule} module the runtime module + * @returns {void} + */ + connectChunkAndRuntimeModule(chunk, module) { + const cgm = this._getChunkGraphModule(module); + const cgc = this._getChunkGraphChunk(chunk); + if (cgm.runtimeInChunks === undefined) { + cgm.runtimeInChunks = new Set(); + } + cgm.runtimeInChunks.add(chunk); + cgc.runtimeModules.add(module); + } - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.start < 0) { - throw new Error('start must be >= zero'); - } + /** + * @param {Chunk} chunk the new chunk + * @param {RuntimeModule} module the module that require a full hash + * @returns {void} + */ + addFullHashModuleToChunk(chunk, module) { + const cgc = this._getChunkGraphChunk(chunk); + if (cgc.fullHashModules === undefined) cgc.fullHashModules = new Set(); + cgc.fullHashModules.add(module); + } - this.pos = this.start; - } + /** + * @param {Chunk} chunk the new chunk + * @param {RuntimeModule} module the module that require a full hash + * @returns {void} + */ + addDependentHashModuleToChunk(chunk, module) { + const cgc = this._getChunkGraphChunk(chunk); + if (cgc.dependentHashModules === undefined) + cgc.dependentHashModules = new Set(); + cgc.dependentHashModules.add(module); + } - this.busy = false; - this._queue = []; + /** + * @param {Chunk} chunk the new chunk + * @param {Module} module the entry module + * @returns {void} + */ + disconnectChunkAndEntryModule(chunk, module) { + const cgm = this._getChunkGraphModule(module); + const cgc = this._getChunkGraphChunk(chunk); + cgm.entryInChunks.delete(chunk); + if (cgm.entryInChunks.size === 0) { + cgm.entryInChunks = undefined; + } + cgc.entryModules.delete(module); + } - if (this.fd === null) { - this._open = fs.open; - this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); - this.flush(); - } - } -} + /** + * @param {Chunk} chunk the new chunk + * @param {RuntimeModule} module the runtime module + * @returns {void} + */ + disconnectChunkAndRuntimeModule(chunk, module) { + const cgm = this._getChunkGraphModule(module); + const cgc = this._getChunkGraphChunk(chunk); + cgm.runtimeInChunks.delete(chunk); + if (cgm.runtimeInChunks.size === 0) { + cgm.runtimeInChunks = undefined; + } + cgc.runtimeModules.delete(module); + } + /** + * @param {Module} module the entry module, it will no longer be entry + * @returns {void} + */ + disconnectEntryModule(module) { + const cgm = this._getChunkGraphModule(module); + for (const chunk of cgm.entryInChunks) { + const cgc = this._getChunkGraphChunk(chunk); + cgc.entryModules.delete(module); + } + cgm.entryInChunks = undefined; + } -/***/ }), + /** + * @param {Chunk} chunk the chunk, for which all entries will be removed + * @returns {void} + */ + disconnectEntries(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + for (const module of cgc.entryModules.keys()) { + const cgm = this._getChunkGraphModule(module); + cgm.entryInChunks.delete(chunk); + if (cgm.entryInChunks.size === 0) { + cgm.entryInChunks = undefined; + } + } + cgc.entryModules.clear(); + } -/***/ 11290: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * @param {Chunk} chunk the chunk + * @returns {number} the amount of entry modules in chunk + */ + getNumberOfEntryModules(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.entryModules.size; + } -var constants = __webpack_require__(22057) + /** + * @param {Chunk} chunk the chunk + * @returns {number} the amount of entry modules in chunk + */ + getNumberOfRuntimeModules(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.runtimeModules.size; + } -var origCwd = process.cwd -var cwd = null + /** + * @param {Chunk} chunk the chunk + * @returns {Iterable} iterable of modules (do not modify) + */ + getChunkEntryModulesIterable(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.entryModules.keys(); + } -var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform + /** + * @param {Chunk} chunk the chunk + * @returns {Iterable} iterable of chunks + */ + getChunkEntryDependentChunksIterable(chunk) { + /** @type {Set} */ + const set = new Set(); + for (const chunkGroup of chunk.groupsIterable) { + if (chunkGroup instanceof Entrypoint) { + const entrypointChunk = chunkGroup.getEntrypointChunk(); + const cgc = this._getChunkGraphChunk(entrypointChunk); + for (const chunkGroup of cgc.entryModules.values()) { + for (const c of chunkGroup.chunks) { + if (c !== chunk && c !== entrypointChunk && !c.hasRuntime()) { + set.add(c); + } + } + } + } + } -process.cwd = function() { - if (!cwd) - cwd = origCwd.call(process) - return cwd -} -try { - process.cwd() -} catch (er) {} + return set; + } -// This check is needed until node.js 12 is required -if (typeof process.chdir === 'function') { - var chdir = process.chdir - process.chdir = function (d) { - cwd = null - chdir.call(process, d) - } - if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) -} + /** + * @param {Chunk} chunk the chunk + * @returns {boolean} true, when it has dependent chunks + */ + hasChunkEntryDependentChunks(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + for (const chunkGroup of cgc.entryModules.values()) { + for (const c of chunkGroup.chunks) { + if (c !== chunk) { + return true; + } + } + } + return false; + } -module.exports = patch + /** + * @param {Chunk} chunk the chunk + * @returns {Iterable} iterable of modules (do not modify) + */ + getChunkRuntimeModulesIterable(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.runtimeModules; + } -function patch (fs) { - // (re-)implement some things that are known busted or missing. + /** + * @param {Chunk} chunk the chunk + * @returns {RuntimeModule[]} array of modules in order of execution + */ + getChunkRuntimeModulesInOrder(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + const array = Array.from(cgc.runtimeModules); + array.sort( + concatComparators( + compareSelect( + /** + * @param {RuntimeModule} r runtime module + * @returns {number=} stage + */ + r => r.stage, + compareIds + ), + compareModulesByIdentifier + ) + ); + return array; + } - // lchmod, broken prior to 0.6.2 - // back-port the fix here. - if (constants.hasOwnProperty('O_SYMLINK') && - process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs) - } + /** + * @param {Chunk} chunk the chunk + * @returns {Iterable | undefined} iterable of modules (do not modify) + */ + getChunkFullHashModulesIterable(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.fullHashModules; + } - // lutimes implementation, or no-op - if (!fs.lutimes) { - patchLutimes(fs) - } + /** + * @param {Chunk} chunk the chunk + * @returns {ReadonlySet | undefined} set of modules (do not modify) + */ + getChunkFullHashModulesSet(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.fullHashModules; + } - // https://github.com/isaacs/node-graceful-fs/issues/4 - // Chown should not fail on einval or eperm if non-root. - // It should not fail on enosys ever, as this just indicates - // that a fs doesn't support the intended operation. + /** + * @param {Chunk} chunk the chunk + * @returns {Iterable | undefined} iterable of modules (do not modify) + */ + getChunkDependentHashModulesIterable(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.dependentHashModules; + } - fs.chown = chownFix(fs.chown) - fs.fchown = chownFix(fs.fchown) - fs.lchown = chownFix(fs.lchown) + /** + * @param {Chunk} chunk the chunk + * @returns {Iterable} iterable of modules (do not modify) + */ + getChunkEntryModulesWithChunkGroupIterable(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.entryModules; + } - fs.chmod = chmodFix(fs.chmod) - fs.fchmod = chmodFix(fs.fchmod) - fs.lchmod = chmodFix(fs.lchmod) + /** + * @param {AsyncDependenciesBlock} depBlock the async block + * @returns {ChunkGroup} the chunk group + */ + getBlockChunkGroup(depBlock) { + return this._blockChunkGroups.get(depBlock); + } - fs.chownSync = chownFixSync(fs.chownSync) - fs.fchownSync = chownFixSync(fs.fchownSync) - fs.lchownSync = chownFixSync(fs.lchownSync) + /** + * @param {AsyncDependenciesBlock} depBlock the async block + * @param {ChunkGroup} chunkGroup the chunk group + * @returns {void} + */ + connectBlockAndChunkGroup(depBlock, chunkGroup) { + this._blockChunkGroups.set(depBlock, chunkGroup); + chunkGroup.addBlock(depBlock); + } - fs.chmodSync = chmodFixSync(fs.chmodSync) - fs.fchmodSync = chmodFixSync(fs.fchmodSync) - fs.lchmodSync = chmodFixSync(fs.lchmodSync) + /** + * @param {ChunkGroup} chunkGroup the chunk group + * @returns {void} + */ + disconnectChunkGroup(chunkGroup) { + for (const block of chunkGroup.blocksIterable) { + this._blockChunkGroups.delete(block); + } + // TODO refactor by moving blocks list into ChunkGraph + chunkGroup._blocks.clear(); + } - fs.stat = statFix(fs.stat) - fs.fstat = statFix(fs.fstat) - fs.lstat = statFix(fs.lstat) + /** + * @param {Module} module the module + * @returns {string | number} the id of the module + */ + getModuleId(module) { + const cgm = this._getChunkGraphModule(module); + return cgm.id; + } - fs.statSync = statFixSync(fs.statSync) - fs.fstatSync = statFixSync(fs.fstatSync) - fs.lstatSync = statFixSync(fs.lstatSync) + /** + * @param {Module} module the module + * @param {string | number} id the id of the module + * @returns {void} + */ + setModuleId(module, id) { + const cgm = this._getChunkGraphModule(module); + cgm.id = id; + } - // if lchmod/lchown do not exist, then make them no-ops - if (!fs.lchmod) { - fs.lchmod = function (path, mode, cb) { - if (cb) process.nextTick(cb) - } - fs.lchmodSync = function () {} - } - if (!fs.lchown) { - fs.lchown = function (path, uid, gid, cb) { - if (cb) process.nextTick(cb) - } - fs.lchownSync = function () {} - } + /** + * @param {string} runtime runtime + * @returns {string | number} the id of the runtime + */ + getRuntimeId(runtime) { + return this._runtimeIds.get(runtime); + } - // on Windows, A/V software can lock the directory, causing this - // to fail with an EACCES or EPERM if the directory contains newly - // created files. Try again on failure, for up to 60 seconds. + /** + * @param {string} runtime runtime + * @param {string | number} id the id of the runtime + * @returns {void} + */ + setRuntimeId(runtime, id) { + this._runtimeIds.set(runtime, id); + } - // Set the timeout this long because some Windows Anti-Virus, such as Parity - // bit9, may lock files for up to a minute, causing npm package install - // failures. Also, take care to yield the scheduler. Windows scheduling gives - // CPU to a busy looping process, which can cause the program causing the lock - // contention to be starved of CPU by node, so the contention doesn't resolve. - if (platform === "win32") { - fs.rename = (function (fs$rename) { return function (from, to, cb) { - var start = Date.now() - var backoff = 0; - fs$rename(from, to, function CB (er) { - if (er - && (er.code === "EACCES" || er.code === "EPERM") - && Date.now() - start < 60000) { - setTimeout(function() { - fs.stat(to, function (stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er) - }) - }, backoff) - if (backoff < 100) - backoff += 10; - return; - } - if (cb) cb(er) - }) - }})(fs.rename) - } + /** + * @template T + * @param {Module} module the module + * @param {RuntimeSpecMap} hashes hashes data + * @param {RuntimeSpec} runtime the runtime + * @returns {T} hash + */ + _getModuleHashInfo(module, hashes, runtime) { + if (!hashes) { + throw new Error( + `Module ${module.identifier()} has no hash info for runtime ${runtimeToString( + runtime + )} (hashes not set at all)` + ); + } else if (runtime === undefined) { + const hashInfoItems = new Set(hashes.values()); + if (hashInfoItems.size !== 1) { + throw new Error( + `No unique hash info entry for unspecified runtime for ${module.identifier()} (existing runtimes: ${Array.from( + hashes.keys(), + r => runtimeToString(r) + ).join(", ")}). +Caller might not support runtime-dependent code generation (opt-out via optimization.usedExports: "global").` + ); + } + return first(hashInfoItems); + } else { + const hashInfo = hashes.get(runtime); + if (!hashInfo) { + throw new Error( + `Module ${module.identifier()} has no hash info for runtime ${runtimeToString( + runtime + )} (available runtimes ${Array.from( + hashes.keys(), + runtimeToString + ).join(", ")})` + ); + } + return hashInfo; + } + } - // if read() returns EAGAIN, then just try it again. - fs.read = (function (fs$read) { - function read (fd, buffer, offset, length, position, callback_) { - var callback - if (callback_ && typeof callback_ === 'function') { - var eagCounter = 0 - callback = function (er, _, __) { - if (er && er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - callback_.apply(this, arguments) - } - } - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true, if the module has hashes for this runtime + */ + hasModuleHashes(module, runtime) { + const cgm = this._getChunkGraphModule(module); + const hashes = cgm.hashes; + return hashes && hashes.has(runtime); + } - // This ensures `util.promisify` works as it does for native `fs.read`. - if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) - return read - })(fs.read) + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @returns {string} hash + */ + getModuleHash(module, runtime) { + const cgm = this._getChunkGraphModule(module); + const hashes = cgm.hashes; + return this._getModuleHashInfo(module, hashes, runtime).hash; + } - fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { - var eagCounter = 0 - while (true) { - try { - return fs$readSync.call(fs, fd, buffer, offset, length, position) - } catch (er) { - if (er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - continue - } - throw er - } - } - }})(fs.readSync) + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @returns {string} hash + */ + getRenderedModuleHash(module, runtime) { + const cgm = this._getChunkGraphModule(module); + const hashes = cgm.hashes; + return this._getModuleHashInfo(module, hashes, runtime).renderedHash; + } - function patchLchmod (fs) { - fs.lchmod = function (path, mode, callback) { - fs.open( path - , constants.O_WRONLY | constants.O_SYMLINK - , mode - , function (err, fd) { - if (err) { - if (callback) callback(err) - return - } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - fs.fchmod(fd, mode, function (err) { - fs.close(fd, function(err2) { - if (callback) callback(err || err2) - }) - }) - }) - } + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @param {string} hash the full hash + * @param {string} renderedHash the shortened hash for rendering + * @returns {void} + */ + setModuleHashes(module, runtime, hash, renderedHash) { + const cgm = this._getChunkGraphModule(module); + if (cgm.hashes === undefined) { + cgm.hashes = new RuntimeSpecMap(); + } + cgm.hashes.set(runtime, new ModuleHashInfo(hash, renderedHash)); + } - fs.lchmodSync = function (path, mode) { - var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @param {Set} items runtime requirements to be added (ownership of this Set is given to ChunkGraph when transferOwnership not false) + * @param {boolean} transferOwnership true: transfer ownership of the items object, false: items is immutable and shared and won't be modified + * @returns {void} + */ + addModuleRuntimeRequirements( + module, + runtime, + items, + transferOwnership = true + ) { + const cgm = this._getChunkGraphModule(module); + const runtimeRequirementsMap = cgm.runtimeRequirements; + if (runtimeRequirementsMap === undefined) { + const map = new RuntimeSpecMap(); + // TODO avoid cloning item and track ownership instead + map.set(runtime, transferOwnership ? items : new Set(items)); + cgm.runtimeRequirements = map; + return; + } + runtimeRequirementsMap.update(runtime, runtimeRequirements => { + if (runtimeRequirements === undefined) { + return transferOwnership ? items : new Set(items); + } else if (!transferOwnership || runtimeRequirements.size >= items.size) { + for (const item of items) runtimeRequirements.add(item); + return runtimeRequirements; + } else { + for (const item of runtimeRequirements) items.add(item); + return items; + } + }); + } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - var threw = true - var ret - try { - ret = fs.fchmodSync(fd, mode) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } - } + /** + * @param {Chunk} chunk the chunk + * @param {Set} items runtime requirements to be added (ownership of this Set is given to ChunkGraph) + * @returns {void} + */ + addChunkRuntimeRequirements(chunk, items) { + const cgc = this._getChunkGraphChunk(chunk); + const runtimeRequirements = cgc.runtimeRequirements; + if (runtimeRequirements === undefined) { + cgc.runtimeRequirements = items; + } else if (runtimeRequirements.size >= items.size) { + for (const item of items) runtimeRequirements.add(item); + } else { + for (const item of runtimeRequirements) items.add(item); + cgc.runtimeRequirements = items; + } + } - function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK")) { - fs.lutimes = function (path, at, mt, cb) { - fs.open(path, constants.O_SYMLINK, function (er, fd) { - if (er) { - if (cb) cb(er) - return - } - fs.futimes(fd, at, mt, function (er) { - fs.close(fd, function (er2) { - if (cb) cb(er || er2) - }) - }) - }) - } + /** + * @param {Chunk} chunk the chunk + * @param {Iterable} items runtime requirements to be added + * @returns {void} + */ + addTreeRuntimeRequirements(chunk, items) { + const cgc = this._getChunkGraphChunk(chunk); + const runtimeRequirements = cgc.runtimeRequirementsInTree; + for (const item of items) runtimeRequirements.add(item); + } - fs.lutimesSync = function (path, at, mt) { - var fd = fs.openSync(path, constants.O_SYMLINK) - var ret - var threw = true - try { - ret = fs.futimesSync(fd, at, mt) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @returns {ReadonlySet} runtime requirements + */ + getModuleRuntimeRequirements(module, runtime) { + const cgm = this._getChunkGraphModule(module); + const runtimeRequirements = + cgm.runtimeRequirements && cgm.runtimeRequirements.get(runtime); + return runtimeRequirements === undefined ? EMPTY_SET : runtimeRequirements; + } - } else { - fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } - fs.lutimesSync = function () {} - } - } + /** + * @param {Chunk} chunk the chunk + * @returns {ReadonlySet} runtime requirements + */ + getChunkRuntimeRequirements(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + const runtimeRequirements = cgc.runtimeRequirements; + return runtimeRequirements === undefined ? EMPTY_SET : runtimeRequirements; + } - function chmodFix (orig) { - if (!orig) return orig - return function (target, mode, cb) { - return orig.call(fs, target, mode, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @param {boolean} withConnections include connections + * @returns {string} hash + */ + getModuleGraphHash(module, runtime, withConnections = true) { + const cgm = this._getChunkGraphModule(module); + return withConnections + ? this._getModuleGraphHashWithConnections(cgm, module, runtime) + : this._getModuleGraphHashBigInt(cgm, module, runtime).toString(16); + } - function chmodFixSync (orig) { - if (!orig) return orig - return function (target, mode) { - try { - return orig.call(fs, target, mode) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @param {boolean} withConnections include connections + * @returns {bigint} hash + */ + getModuleGraphHashBigInt(module, runtime, withConnections = true) { + const cgm = this._getChunkGraphModule(module); + return withConnections + ? BigInt( + `0x${this._getModuleGraphHashWithConnections(cgm, module, runtime)}` + ) + : this._getModuleGraphHashBigInt(cgm, module, runtime); + } + /** + * @param {ChunkGraphModule} cgm the ChunkGraphModule + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @returns {bigint} hash as big int + */ + _getModuleGraphHashBigInt(cgm, module, runtime) { + if (cgm.graphHashes === undefined) { + cgm.graphHashes = new RuntimeSpecMap(); + } + const graphHash = cgm.graphHashes.provide(runtime, () => { + const hash = createHash(this._hashFunction); + hash.update(`${cgm.id}${this.moduleGraph.isAsync(module)}`); + this.moduleGraph.getExportsInfo(module).updateHash(hash, runtime); + return BigInt(`0x${/** @type {string} */ (hash.digest("hex"))}`); + }); + return graphHash; + } - function chownFix (orig) { - if (!orig) return orig - return function (target, uid, gid, cb) { - return orig.call(fs, target, uid, gid, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } + /** + * @param {ChunkGraphModule} cgm the ChunkGraphModule + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @returns {string} hash + */ + _getModuleGraphHashWithConnections(cgm, module, runtime) { + if (cgm.graphHashesWithConnections === undefined) { + cgm.graphHashesWithConnections = new RuntimeSpecMap(); + } + const activeStateToString = state => { + if (state === false) return "F"; + if (state === true) return "T"; + if (state === ModuleGraphConnection.TRANSITIVE_ONLY) return "O"; + throw new Error("Not implemented active state"); + }; + const strict = module.buildMeta && module.buildMeta.strictHarmonyModule; + return cgm.graphHashesWithConnections.provide(runtime, () => { + const graphHash = this._getModuleGraphHashBigInt( + cgm, + module, + runtime + ).toString(16); + const connections = this.moduleGraph.getOutgoingConnections(module); + /** @type {Set} */ + const activeNamespaceModules = new Set(); + /** @type {Map>} */ + const connectedModules = new Map(); + const processConnection = (connection, stateInfo) => { + const module = connection.module; + stateInfo += module.getExportsType(this.moduleGraph, strict); + // cspell:word Tnamespace + if (stateInfo === "Tnamespace") activeNamespaceModules.add(module); + else { + const oldModule = connectedModules.get(stateInfo); + if (oldModule === undefined) { + connectedModules.set(stateInfo, module); + } else if (oldModule instanceof Set) { + oldModule.add(module); + } else if (oldModule !== module) { + connectedModules.set(stateInfo, new Set([oldModule, module])); + } + } + }; + if (runtime === undefined || typeof runtime === "string") { + for (const connection of connections) { + const state = connection.getActiveState(runtime); + if (state === false) continue; + processConnection(connection, state === true ? "T" : "O"); + } + } else { + // cspell:word Tnamespace + for (const connection of connections) { + const states = new Set(); + let stateInfo = ""; + forEachRuntime( + runtime, + runtime => { + const state = connection.getActiveState(runtime); + states.add(state); + stateInfo += activeStateToString(state) + runtime; + }, + true + ); + if (states.size === 1) { + const state = first(states); + if (state === false) continue; + stateInfo = activeStateToString(state); + } + processConnection(connection, stateInfo); + } + } + // cspell:word Tnamespace + if (activeNamespaceModules.size === 0 && connectedModules.size === 0) + return graphHash; + const connectedModulesInOrder = + connectedModules.size > 1 + ? Array.from(connectedModules).sort(([a], [b]) => (a < b ? -1 : 1)) + : connectedModules; + const hash = createHash(this._hashFunction); + const addModuleToHash = module => { + hash.update( + this._getModuleGraphHashBigInt( + this._getChunkGraphModule(module), + module, + runtime + ).toString(16) + ); + }; + const addModulesToHash = modules => { + let xor = ZERO_BIG_INT; + for (const m of modules) { + xor = + xor ^ + this._getModuleGraphHashBigInt( + this._getChunkGraphModule(m), + m, + runtime + ); + } + hash.update(xor.toString(16)); + }; + if (activeNamespaceModules.size === 1) + addModuleToHash(activeNamespaceModules.values().next().value); + else if (activeNamespaceModules.size > 1) + addModulesToHash(activeNamespaceModules); + for (const [stateInfo, modules] of connectedModulesInOrder) { + hash.update(stateInfo); + if (modules instanceof Set) { + addModulesToHash(modules); + } else { + addModuleToHash(modules); + } + } + hash.update(graphHash); + return /** @type {string} */ (hash.digest("hex")); + }); + } - function chownFixSync (orig) { - if (!orig) return orig - return function (target, uid, gid) { - try { - return orig.call(fs, target, uid, gid) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } + /** + * @param {Chunk} chunk the chunk + * @returns {ReadonlySet} runtime requirements + */ + getTreeRuntimeRequirements(chunk) { + const cgc = this._getChunkGraphChunk(chunk); + return cgc.runtimeRequirementsInTree; + } - function statFix (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options, cb) { - if (typeof options === 'function') { - cb = options - options = null - } - function callback (er, stats) { - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - if (cb) cb.apply(this, arguments) - } - return options ? orig.call(fs, target, options, callback) - : orig.call(fs, target, callback) - } - } + // TODO remove in webpack 6 + /** + * @param {Module} module the module + * @param {string} deprecateMessage message for the deprecation message + * @param {string} deprecationCode code for the deprecation + * @returns {ChunkGraph} the chunk graph + */ + static getChunkGraphForModule(module, deprecateMessage, deprecationCode) { + const fn = deprecateGetChunkGraphForModuleMap.get(deprecateMessage); + if (fn) return fn(module); + const newFn = util.deprecate( + /** + * @param {Module} module the module + * @returns {ChunkGraph} the chunk graph + */ + module => { + const chunkGraph = chunkGraphForModuleMap.get(module); + if (!chunkGraph) + throw new Error( + deprecateMessage + + ": There was no ChunkGraph assigned to the Module for backward-compat (Use the new API)" + ); + return chunkGraph; + }, + deprecateMessage + ": Use new ChunkGraph API", + deprecationCode + ); + deprecateGetChunkGraphForModuleMap.set(deprecateMessage, newFn); + return newFn(module); + } - function statFixSync (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options) { - var stats = options ? orig.call(fs, target, options) - : orig.call(fs, target) - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - return stats; - } - } + // TODO remove in webpack 6 + /** + * @param {Module} module the module + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {void} + */ + static setChunkGraphForModule(module, chunkGraph) { + chunkGraphForModuleMap.set(module, chunkGraph); + } - // ENOSYS means that the fs doesn't support the op. Just ignore - // that, because it doesn't matter. - // - // if there's no getuid, or if getuid() is something other - // than 0, and the error is EINVAL or EPERM, then just ignore - // it. - // - // This specific case is a silent failure in cp, install, tar, - // and most other unix tools that manage permissions. - // - // When running as root, or if other types of errors are - // encountered, then it's strict. - function chownErOk (er) { - if (!er) - return true + // TODO remove in webpack 6 + /** + * @param {Module} module the module + * @returns {void} + */ + static clearChunkGraphForModule(module) { + chunkGraphForModuleMap.delete(module); + } - if (er.code === "ENOSYS") - return true + // TODO remove in webpack 6 + /** + * @param {Chunk} chunk the chunk + * @param {string} deprecateMessage message for the deprecation message + * @param {string} deprecationCode code for the deprecation + * @returns {ChunkGraph} the chunk graph + */ + static getChunkGraphForChunk(chunk, deprecateMessage, deprecationCode) { + const fn = deprecateGetChunkGraphForChunkMap.get(deprecateMessage); + if (fn) return fn(chunk); + const newFn = util.deprecate( + /** + * @param {Chunk} chunk the chunk + * @returns {ChunkGraph} the chunk graph + */ + chunk => { + const chunkGraph = chunkGraphForChunkMap.get(chunk); + if (!chunkGraph) + throw new Error( + deprecateMessage + + "There was no ChunkGraph assigned to the Chunk for backward-compat (Use the new API)" + ); + return chunkGraph; + }, + deprecateMessage + ": Use new ChunkGraph API", + deprecationCode + ); + deprecateGetChunkGraphForChunkMap.set(deprecateMessage, newFn); + return newFn(chunk); + } - var nonroot = !process.getuid || process.getuid() !== 0 - if (nonroot) { - if (er.code === "EINVAL" || er.code === "EPERM") - return true - } + // TODO remove in webpack 6 + /** + * @param {Chunk} chunk the chunk + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {void} + */ + static setChunkGraphForChunk(chunk, chunkGraph) { + chunkGraphForChunkMap.set(chunk, chunkGraph); + } - return false - } + // TODO remove in webpack 6 + /** + * @param {Chunk} chunk the chunk + * @returns {void} + */ + static clearChunkGraphForChunk(chunk) { + chunkGraphForChunkMap.delete(chunk); + } } +// TODO remove in webpack 6 +/** @type {WeakMap} */ +const chunkGraphForModuleMap = new WeakMap(); -/***/ }), - -/***/ 15235: -/***/ (function(module) { +// TODO remove in webpack 6 +/** @type {WeakMap} */ +const chunkGraphForChunkMap = new WeakMap(); -"use strict"; +// TODO remove in webpack 6 +/** @type {Map ChunkGraph>} */ +const deprecateGetChunkGraphForModuleMap = new Map(); +// TODO remove in webpack 6 +/** @type {Map ChunkGraph>} */ +const deprecateGetChunkGraphForChunkMap = new Map(); -module.exports = parseJson -function parseJson (txt, reviver, context) { - context = context || 20 - try { - return JSON.parse(txt, reviver) - } catch (e) { - if (typeof txt !== 'string') { - const isEmptyArray = Array.isArray(txt) && txt.length === 0 - const errorMessage = 'Cannot parse ' + - (isEmptyArray ? 'an empty array' : String(txt)) - throw new TypeError(errorMessage) - } - const syntaxErr = e.message.match(/^Unexpected token.*position\s+(\d+)/i) - const errIdx = syntaxErr - ? +syntaxErr[1] - : e.message.match(/^Unexpected end of JSON.*/i) - ? txt.length - 1 - : null - if (errIdx != null) { - const start = errIdx <= context - ? 0 - : errIdx - context - const end = errIdx + context >= txt.length - ? txt.length - : errIdx + context - e.message += ` while parsing near '${ - start === 0 ? '' : '...' - }${txt.slice(start, end)}${ - end === txt.length ? '' : '...' - }'` - } else { - e.message += ` while parsing '${txt.slice(0, context * 2)}'` - } - throw e - } -} +module.exports = ChunkGraph; /***/ }), -/***/ 49448: -/***/ (function(module) { +/***/ 15626: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -class LoadingLoaderError extends Error { - constructor(message) { - super(message); - this.name = "LoaderRunnerError"; - Error.captureStackTrace(this, this.constructor); - } -} - -module.exports = LoadingLoaderError; +const util = __webpack_require__(73837); +const SortableSet = __webpack_require__(13098); +const { + compareLocations, + compareChunks, + compareIterables +} = __webpack_require__(29579); -/***/ }), +/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Entrypoint")} Entrypoint */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/***/ 68318: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/** @typedef {{id: number}} HasId */ +/** @typedef {{module: Module, loc: DependencyLocation, request: string}} OriginRecord */ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -var fs = __webpack_require__(57147); -var readFile = fs.readFile.bind(fs); -var loadLoader = __webpack_require__(55102); +/** + * @typedef {Object} RawChunkGroupOptions + * @property {number=} preloadOrder + * @property {number=} prefetchOrder + */ -function utf8BufferToString(buf) { - var str = buf.toString("utf-8"); - if(str.charCodeAt(0) === 0xFEFF) { - return str.substr(1); - } else { - return str; - } -} +/** @typedef {RawChunkGroupOptions & { name?: string }} ChunkGroupOptions */ -const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/; +let debugId = 5000; /** - * @param {string} str the path with query and fragment - * @returns {{ path: string, query: string, fragment: string }} parsed parts + * @template T + * @param {SortableSet} set set to convert to array. + * @returns {T[]} the array format of existing set */ -function parsePathQueryFragment(str) { - var match = PATH_QUERY_FRAGMENT_REGEXP.exec(str); - return { - path: match[1].replace(/\0(.)/g, "$1"), - query: match[2] ? match[2].replace(/\0(.)/g, "$1") : "", - fragment: match[3] || "" - }; -} +const getArray = set => Array.from(set); -function dirname(path) { - if(path === "/") return "/"; - var i = path.lastIndexOf("/"); - var j = path.lastIndexOf("\\"); - var i2 = path.indexOf("/"); - var j2 = path.indexOf("\\"); - var idx = i > j ? i : j; - var idx2 = i > j ? i2 : j2; - if(idx < 0) return path; - if(idx === idx2) return path.substr(0, idx + 1); - return path.substr(0, idx); -} +/** + * A convenience method used to sort chunks based on their id's + * @param {ChunkGroup} a first sorting comparator + * @param {ChunkGroup} b second sorting comparator + * @returns {1|0|-1} a sorting index to determine order + */ +const sortById = (a, b) => { + if (a.id < b.id) return -1; + if (b.id < a.id) return 1; + return 0; +}; -function createLoaderObject(loader) { - var obj = { - path: null, - query: null, - fragment: null, - options: null, - ident: null, - normal: null, - pitch: null, - raw: null, - data: null, - pitchExecuted: false, - normalExecuted: false - }; - Object.defineProperty(obj, "request", { - enumerable: true, - get: function() { - return obj.path.replace(/#/g, "\0#") + obj.query.replace(/#/g, "\0#") + obj.fragment; - }, - set: function(value) { - if(typeof value === "string") { - var splittedRequest = parsePathQueryFragment(value); - obj.path = splittedRequest.path; - obj.query = splittedRequest.query; - obj.fragment = splittedRequest.fragment; - obj.options = undefined; - obj.ident = undefined; - } else { - if(!value.loader) - throw new Error("request should be a string or object with loader and options (" + JSON.stringify(value) + ")"); - obj.path = value.loader; - obj.fragment = value.fragment || ""; - obj.type = value.type; - obj.options = value.options; - obj.ident = value.ident; - if(obj.options === null) - obj.query = ""; - else if(obj.options === undefined) - obj.query = ""; - else if(typeof obj.options === "string") - obj.query = "?" + obj.options; - else if(obj.ident) - obj.query = "??" + obj.ident; - else if(typeof obj.options === "object" && obj.options.ident) - obj.query = "??" + obj.options.ident; - else - obj.query = "?" + JSON.stringify(obj.options); +/** + * @param {OriginRecord} a the first comparator in sort + * @param {OriginRecord} b the second comparator in sort + * @returns {1|-1|0} returns sorting order as index + */ +const sortOrigin = (a, b) => { + const aIdent = a.module ? a.module.identifier() : ""; + const bIdent = b.module ? b.module.identifier() : ""; + if (aIdent < bIdent) return -1; + if (aIdent > bIdent) return 1; + return compareLocations(a.loc, b.loc); +}; + +class ChunkGroup { + /** + * Creates an instance of ChunkGroup. + * @param {string|ChunkGroupOptions=} options chunk group options passed to chunkGroup + */ + constructor(options) { + if (typeof options === "string") { + options = { name: options }; + } else if (!options) { + options = { name: undefined }; + } + /** @type {number} */ + this.groupDebugId = debugId++; + this.options = options; + /** @type {SortableSet} */ + this._children = new SortableSet(undefined, sortById); + /** @type {SortableSet} */ + this._parents = new SortableSet(undefined, sortById); + /** @type {SortableSet} */ + this._asyncEntrypoints = new SortableSet(undefined, sortById); + this._blocks = new SortableSet(); + /** @type {Chunk[]} */ + this.chunks = []; + /** @type {OriginRecord[]} */ + this.origins = []; + /** Indices in top-down order */ + /** @private @type {Map} */ + this._modulePreOrderIndices = new Map(); + /** Indices in bottom-up order */ + /** @private @type {Map} */ + this._modulePostOrderIndices = new Map(); + /** @type {number} */ + this.index = undefined; + } + + /** + * when a new chunk is added to a chunkGroup, addingOptions will occur. + * @param {ChunkGroupOptions} options the chunkGroup options passed to addOptions + * @returns {void} + */ + addOptions(options) { + for (const key of Object.keys(options)) { + if (this.options[key] === undefined) { + this.options[key] = options[key]; + } else if (this.options[key] !== options[key]) { + if (key.endsWith("Order")) { + this.options[key] = Math.max(this.options[key], options[key]); + } else { + throw new Error( + `ChunkGroup.addOptions: No option merge strategy for ${key}` + ); + } } } - }); - obj.request = loader; - if(Object.preventExtensions) { - Object.preventExtensions(obj); } - return obj; -} -function runSyncOrAsync(fn, context, args, callback) { - var isSync = true; - var isDone = false; - var isError = false; // internal error - var reportedError = false; - context.async = function async() { - if(isDone) { - if(reportedError) return; // ignore - throw new Error("async(): The callback was already called."); + /** + * returns the name of current ChunkGroup + * @returns {string|undefined} returns the ChunkGroup name + */ + get name() { + return this.options.name; + } + + /** + * sets a new name for current ChunkGroup + * @param {string} value the new name for ChunkGroup + * @returns {void} + */ + set name(value) { + this.options.name = value; + } + + /* istanbul ignore next */ + /** + * get a uniqueId for ChunkGroup, made up of its member Chunk debugId's + * @returns {string} a unique concatenation of chunk debugId's + */ + get debugId() { + return Array.from(this.chunks, x => x.debugId).join("+"); + } + + /** + * get a unique id for ChunkGroup, made up of its member Chunk id's + * @returns {string} a unique concatenation of chunk ids + */ + get id() { + return Array.from(this.chunks, x => x.id).join("+"); + } + + /** + * Performs an unshift of a specific chunk + * @param {Chunk} chunk chunk being unshifted + * @returns {boolean} returns true if attempted chunk shift is accepted + */ + unshiftChunk(chunk) { + const oldIdx = this.chunks.indexOf(chunk); + if (oldIdx > 0) { + this.chunks.splice(oldIdx, 1); + this.chunks.unshift(chunk); + } else if (oldIdx < 0) { + this.chunks.unshift(chunk); + return true; } - isSync = false; - return innerCallback; - }; - var innerCallback = context.callback = function() { - if(isDone) { - if(reportedError) return; // ignore - throw new Error("callback(): The callback was already called."); + return false; + } + + /** + * inserts a chunk before another existing chunk in group + * @param {Chunk} chunk Chunk being inserted + * @param {Chunk} before Placeholder/target chunk marking new chunk insertion point + * @returns {boolean} return true if insertion was successful + */ + insertChunk(chunk, before) { + const oldIdx = this.chunks.indexOf(chunk); + const idx = this.chunks.indexOf(before); + if (idx < 0) { + throw new Error("before chunk not found"); } - isDone = true; - isSync = false; - try { - callback.apply(null, arguments); - } catch(e) { - isError = true; - throw e; + if (oldIdx >= 0 && oldIdx > idx) { + this.chunks.splice(oldIdx, 1); + this.chunks.splice(idx, 0, chunk); + } else if (oldIdx < 0) { + this.chunks.splice(idx, 0, chunk); + return true; } - }; - try { - var result = (function LOADER_EXECUTION() { - return fn.apply(context, args); - }()); - if(isSync) { - isDone = true; - if(result === undefined) - return callback(); - if(result && typeof result === "object" && typeof result.then === "function") { - return result.then(function(r) { - callback(null, r); - }, callback); - } - return callback(null, result); + return false; + } + + /** + * add a chunk into ChunkGroup. Is pushed on or prepended + * @param {Chunk} chunk chunk being pushed into ChunkGroupS + * @returns {boolean} returns true if chunk addition was successful. + */ + pushChunk(chunk) { + const oldIdx = this.chunks.indexOf(chunk); + if (oldIdx >= 0) { + return false; } - } catch(e) { - if(isError) throw e; - if(isDone) { - // loader is already "done", so we cannot use the callback function - // for better debugging we print the error on the console - if(typeof e === "object" && e.stack) console.error(e.stack); - else console.error(e); - return; + this.chunks.push(chunk); + return true; + } + + /** + * @param {Chunk} oldChunk chunk to be replaced + * @param {Chunk} newChunk New chunk that will be replaced with + * @returns {boolean} returns true if the replacement was successful + */ + replaceChunk(oldChunk, newChunk) { + const oldIdx = this.chunks.indexOf(oldChunk); + if (oldIdx < 0) return false; + const newIdx = this.chunks.indexOf(newChunk); + if (newIdx < 0) { + this.chunks[oldIdx] = newChunk; + return true; + } + if (newIdx < oldIdx) { + this.chunks.splice(oldIdx, 1); + return true; + } else if (newIdx !== oldIdx) { + this.chunks[oldIdx] = newChunk; + this.chunks.splice(newIdx, 1); + return true; } - isDone = true; - reportedError = true; - callback(e); } -} + /** + * @param {Chunk} chunk chunk to remove + * @returns {boolean} returns true if chunk was removed + */ + removeChunk(chunk) { + const idx = this.chunks.indexOf(chunk); + if (idx >= 0) { + this.chunks.splice(idx, 1); + return true; + } + return false; + } -function convertArgs(args, raw) { - if(!raw && Buffer.isBuffer(args[0])) - args[0] = utf8BufferToString(args[0]); - else if(raw && typeof args[0] === "string") - args[0] = Buffer.from(args[0], "utf-8"); -} + /** + * @returns {boolean} true, when this chunk group will be loaded on initial page load + */ + isInitial() { + return false; + } -function iteratePitchingLoaders(options, loaderContext, callback) { - // abort after last loader - if(loaderContext.loaderIndex >= loaderContext.loaders.length) - return processResource(options, loaderContext, callback); + /** + * @param {ChunkGroup} group chunk group to add + * @returns {boolean} returns true if chunk group was added + */ + addChild(group) { + const size = this._children.size; + this._children.add(group); + return size !== this._children.size; + } - var currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex]; + /** + * @returns {ChunkGroup[]} returns the children of this group + */ + getChildren() { + return this._children.getFromCache(getArray); + } - // iterate - if(currentLoaderObject.pitchExecuted) { - loaderContext.loaderIndex++; - return iteratePitchingLoaders(options, loaderContext, callback); + getNumberOfChildren() { + return this._children.size; } - // load loader module - loadLoader(currentLoaderObject, function(err) { - if(err) { - loaderContext.cacheable(false); - return callback(err); + get childrenIterable() { + return this._children; + } + + /** + * @param {ChunkGroup} group the chunk group to remove + * @returns {boolean} returns true if the chunk group was removed + */ + removeChild(group) { + if (!this._children.has(group)) { + return false; } - var fn = currentLoaderObject.pitch; - currentLoaderObject.pitchExecuted = true; - if(!fn) return iteratePitchingLoaders(options, loaderContext, callback); - runSyncOrAsync( - fn, - loaderContext, [loaderContext.remainingRequest, loaderContext.previousRequest, currentLoaderObject.data = {}], - function(err) { - if(err) return callback(err); - var args = Array.prototype.slice.call(arguments, 1); - // Determine whether to continue the pitching process based on - // argument values (as opposed to argument presence) in order - // to support synchronous and asynchronous usages. - var hasArg = args.some(function(value) { - return value !== undefined; - }); - if(hasArg) { - loaderContext.loaderIndex--; - iterateNormalLoaders(options, loaderContext, args, callback); - } else { - iteratePitchingLoaders(options, loaderContext, callback); - } - } - ); - }); -} + this._children.delete(group); + group.removeParent(this); + return true; + } -function processResource(options, loaderContext, callback) { - // set loader index to last loader - loaderContext.loaderIndex = loaderContext.loaders.length - 1; + /** + * @param {ChunkGroup} parentChunk the parent group to be added into + * @returns {boolean} returns true if this chunk group was added to the parent group + */ + addParent(parentChunk) { + if (!this._parents.has(parentChunk)) { + this._parents.add(parentChunk); + return true; + } + return false; + } - var resourcePath = loaderContext.resourcePath; - if(resourcePath) { - options.processResource(loaderContext, resourcePath, function(err, buffer) { - if(err) return callback(err); - options.resourceBuffer = buffer; - iterateNormalLoaders(options, loaderContext, [buffer], callback); - }); - } else { - iterateNormalLoaders(options, loaderContext, [null], callback); + /** + * @returns {ChunkGroup[]} returns the parents of this group + */ + getParents() { + return this._parents.getFromCache(getArray); } -} -function iterateNormalLoaders(options, loaderContext, args, callback) { - if(loaderContext.loaderIndex < 0) - return callback(null, args); + getNumberOfParents() { + return this._parents.size; + } - var currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex]; + /** + * @param {ChunkGroup} parent the parent group + * @returns {boolean} returns true if the parent group contains this group + */ + hasParent(parent) { + return this._parents.has(parent); + } - // iterate - if(currentLoaderObject.normalExecuted) { - loaderContext.loaderIndex--; - return iterateNormalLoaders(options, loaderContext, args, callback); + get parentsIterable() { + return this._parents; } - var fn = currentLoaderObject.normal; - currentLoaderObject.normalExecuted = true; - if(!fn) { - return iterateNormalLoaders(options, loaderContext, args, callback); + /** + * @param {ChunkGroup} chunkGroup the parent group + * @returns {boolean} returns true if this group has been removed from the parent + */ + removeParent(chunkGroup) { + if (this._parents.delete(chunkGroup)) { + chunkGroup.removeChild(this); + return true; + } + return false; } - convertArgs(args, currentLoaderObject.raw); + /** + * @param {Entrypoint} entrypoint entrypoint to add + * @returns {boolean} returns true if entrypoint was added + */ + addAsyncEntrypoint(entrypoint) { + const size = this._asyncEntrypoints.size; + this._asyncEntrypoints.add(entrypoint); + return size !== this._asyncEntrypoints.size; + } - runSyncOrAsync(fn, loaderContext, args, function(err) { - if(err) return callback(err); + get asyncEntrypointsIterable() { + return this._asyncEntrypoints; + } - var args = Array.prototype.slice.call(arguments, 1); - iterateNormalLoaders(options, loaderContext, args, callback); - }); -} + /** + * @returns {Array} an array containing the blocks + */ + getBlocks() { + return this._blocks.getFromCache(getArray); + } -exports.getContext = function getContext(resource) { - var path = parsePathQueryFragment(resource).path; - return dirname(path); -}; + getNumberOfBlocks() { + return this._blocks.size; + } -exports.runLoaders = function runLoaders(options, callback) { - // read options - var resource = options.resource || ""; - var loaders = options.loaders || []; - var loaderContext = options.context || {}; - var processResource = options.processResource || ((readResource, context, resource, callback) => { - context.addDependency(resource); - readResource(resource, callback); - }).bind(null, options.readResource || readFile); + hasBlock(block) { + return this._blocks.has(block); + } - // - var splittedResource = resource && parsePathQueryFragment(resource); - var resourcePath = splittedResource ? splittedResource.path : undefined; - var resourceQuery = splittedResource ? splittedResource.query : undefined; - var resourceFragment = splittedResource ? splittedResource.fragment : undefined; - var contextDirectory = resourcePath ? dirname(resourcePath) : null; + /** + * @returns {Iterable} blocks + */ + get blocksIterable() { + return this._blocks; + } - // execution state - var requestCacheable = true; - var fileDependencies = []; - var contextDependencies = []; - var missingDependencies = []; + /** + * @param {AsyncDependenciesBlock} block a block + * @returns {boolean} false, if block was already added + */ + addBlock(block) { + if (!this._blocks.has(block)) { + this._blocks.add(block); + return true; + } + return false; + } - // prepare loader objects - loaders = loaders.map(createLoaderObject); + /** + * @param {Module} module origin module + * @param {DependencyLocation} loc location of the reference in the origin module + * @param {string} request request name of the reference + * @returns {void} + */ + addOrigin(module, loc, request) { + this.origins.push({ + module, + loc, + request + }); + } - loaderContext.context = contextDirectory; - loaderContext.loaderIndex = 0; - loaderContext.loaders = loaders; - loaderContext.resourcePath = resourcePath; - loaderContext.resourceQuery = resourceQuery; - loaderContext.resourceFragment = resourceFragment; - loaderContext.async = null; - loaderContext.callback = null; - loaderContext.cacheable = function cacheable(flag) { - if(flag === false) { - requestCacheable = false; - } - }; - loaderContext.dependency = loaderContext.addDependency = function addDependency(file) { - fileDependencies.push(file); - }; - loaderContext.addContextDependency = function addContextDependency(context) { - contextDependencies.push(context); - }; - loaderContext.addMissingDependency = function addMissingDependency(context) { - missingDependencies.push(context); - }; - loaderContext.getDependencies = function getDependencies() { - return fileDependencies.slice(); - }; - loaderContext.getContextDependencies = function getContextDependencies() { - return contextDependencies.slice(); - }; - loaderContext.getMissingDependencies = function getMissingDependencies() { - return missingDependencies.slice(); - }; - loaderContext.clearDependencies = function clearDependencies() { - fileDependencies.length = 0; - contextDependencies.length = 0; - missingDependencies.length = 0; - requestCacheable = true; - }; - Object.defineProperty(loaderContext, "resource", { - enumerable: true, - get: function() { - if(loaderContext.resourcePath === undefined) - return undefined; - return loaderContext.resourcePath.replace(/#/g, "\0#") + loaderContext.resourceQuery.replace(/#/g, "\0#") + loaderContext.resourceFragment; - }, - set: function(value) { - var splittedResource = value && parsePathQueryFragment(value); - loaderContext.resourcePath = splittedResource ? splittedResource.path : undefined; - loaderContext.resourceQuery = splittedResource ? splittedResource.query : undefined; - loaderContext.resourceFragment = splittedResource ? splittedResource.fragment : undefined; - } - }); - Object.defineProperty(loaderContext, "request", { - enumerable: true, - get: function() { - return loaderContext.loaders.map(function(o) { - return o.request; - }).concat(loaderContext.resource || "").join("!"); - } - }); - Object.defineProperty(loaderContext, "remainingRequest", { - enumerable: true, - get: function() { - if(loaderContext.loaderIndex >= loaderContext.loaders.length - 1 && !loaderContext.resource) - return ""; - return loaderContext.loaders.slice(loaderContext.loaderIndex + 1).map(function(o) { - return o.request; - }).concat(loaderContext.resource || "").join("!"); - } - }); - Object.defineProperty(loaderContext, "currentRequest", { - enumerable: true, - get: function() { - return loaderContext.loaders.slice(loaderContext.loaderIndex).map(function(o) { - return o.request; - }).concat(loaderContext.resource || "").join("!"); - } - }); - Object.defineProperty(loaderContext, "previousRequest", { - enumerable: true, - get: function() { - return loaderContext.loaders.slice(0, loaderContext.loaderIndex).map(function(o) { - return o.request; - }).join("!"); - } - }); - Object.defineProperty(loaderContext, "query", { - enumerable: true, - get: function() { - var entry = loaderContext.loaders[loaderContext.loaderIndex]; - return entry.options && typeof entry.options === "object" ? entry.options : entry.query; - } - }); - Object.defineProperty(loaderContext, "data", { - enumerable: true, - get: function() { - return loaderContext.loaders[loaderContext.loaderIndex].data; + /** + * @returns {string[]} the files contained this chunk group + */ + getFiles() { + const files = new Set(); + + for (const chunk of this.chunks) { + for (const file of chunk.files) { + files.add(file); + } } - }); - // finish loader context - if(Object.preventExtensions) { - Object.preventExtensions(loaderContext); + return Array.from(files); } - var processOptions = { - resourceBuffer: null, - processResource: processResource - }; - iteratePitchingLoaders(processOptions, loaderContext, function(err, result) { - if(err) { - return callback(err, { - cacheable: requestCacheable, - fileDependencies: fileDependencies, - contextDependencies: contextDependencies, - missingDependencies: missingDependencies - }); + /** + * @returns {void} + */ + remove() { + // cleanup parents + for (const parentChunkGroup of this._parents) { + // remove this chunk from its parents + parentChunkGroup._children.delete(this); + + // cleanup "sub chunks" + for (const chunkGroup of this._children) { + /** + * remove this chunk as "intermediary" and connect + * it "sub chunks" and parents directly + */ + // add parent to each "sub chunk" + chunkGroup.addParent(parentChunkGroup); + // add "sub chunk" to parent + parentChunkGroup.addChild(chunkGroup); + } } - callback(null, { - result: result, - resourceBuffer: processOptions.resourceBuffer, - cacheable: requestCacheable, - fileDependencies: fileDependencies, - contextDependencies: contextDependencies, - missingDependencies: missingDependencies - }); - }); -}; + /** + * we need to iterate again over the children + * to remove this from the child's parents. + * This can not be done in the above loop + * as it is not guaranteed that `this._parents` contains anything. + */ + for (const chunkGroup of this._children) { + // remove this as parent of every "sub chunk" + chunkGroup._parents.delete(this); + } -/***/ }), + // remove chunks + for (const chunk of this.chunks) { + chunk.removeGroup(this); + } + } -/***/ 55102: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + sortItems() { + this.origins.sort(sortOrigin); + } -var LoaderLoadingError = __webpack_require__(49448); -var url; + /** + * Sorting predicate which allows current ChunkGroup to be compared against another. + * Sorting values are based off of number of chunks in ChunkGroup. + * + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {ChunkGroup} otherGroup the chunkGroup to compare this against + * @returns {-1|0|1} sort position for comparison + */ + compareTo(chunkGraph, otherGroup) { + if (this.chunks.length > otherGroup.chunks.length) return -1; + if (this.chunks.length < otherGroup.chunks.length) return 1; + return compareIterables(compareChunks(chunkGraph))( + this.chunks, + otherGroup.chunks + ); + } -module.exports = function loadLoader(loader, callback) { - if(loader.type === "module") { - try { - if(url === undefined) url = __webpack_require__(57310); - var loaderUrl = url.pathToFileURL(loader.path); - var modulePromise = eval("import(" + JSON.stringify(loaderUrl.toString()) + ")"); - modulePromise.then(function(module) { - handleResult(loader, module, callback); - }, callback); - return; - } catch(e) { - callback(e); - } - } else { - try { - var module = require(loader.path); - } catch(e) { - // it is possible for node to choke on a require if the FD descriptor - // limit has been reached. give it a chance to recover. - if(e instanceof Error && e.code === "EMFILE") { - var retry = loadLoader.bind(null, loader, callback); - if(typeof setImmediate === "function") { - // node >= 0.9.0 - return setImmediate(retry); - } else { - // node < 0.9.0 - return process.nextTick(retry); + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {Record} mapping from children type to ordered list of ChunkGroups + */ + getChildrenByOrders(moduleGraph, chunkGraph) { + /** @type {Map} */ + const lists = new Map(); + for (const childGroup of this._children) { + for (const key of Object.keys(childGroup.options)) { + if (key.endsWith("Order")) { + const name = key.substr(0, key.length - "Order".length); + let list = lists.get(name); + if (list === undefined) { + lists.set(name, (list = [])); + } + list.push({ + order: childGroup.options[key], + group: childGroup + }); } } - return callback(e); } - return handleResult(loader, module, callback); + /** @type {Record} */ + const result = Object.create(null); + for (const [name, list] of lists) { + list.sort((a, b) => { + const cmp = b.order - a.order; + if (cmp !== 0) return cmp; + return a.group.compareTo(chunkGraph, b.group); + }); + result[name] = list.map(i => i.group); + } + return result; } -}; -function handleResult(loader, module, callback) { - if(typeof module !== "function" && typeof module !== "object") { - return callback(new LoaderLoadingError( - "Module '" + loader.path + "' is not a loader (export function or es6 module)" - )); + /** + * Sets the top-down index of a module in this ChunkGroup + * @param {Module} module module for which the index should be set + * @param {number} index the index of the module + * @returns {void} + */ + setModulePreOrderIndex(module, index) { + this._modulePreOrderIndices.set(module, index); } - loader.normal = typeof module === "function" ? module : module.default; - loader.pitch = module.pitch; - loader.raw = module.raw; - if(typeof loader.normal !== "function" && typeof loader.pitch !== "function") { - return callback(new LoaderLoadingError( - "Module '" + loader.path + "' is not a loader (must have normal or pitch function)" - )); + + /** + * Gets the top-down index of a module in this ChunkGroup + * @param {Module} module the module + * @returns {number} index + */ + getModulePreOrderIndex(module) { + return this._modulePreOrderIndices.get(module); } - callback(); -} + /** + * Sets the bottom-up index of a module in this ChunkGroup + * @param {Module} module module for which the index should be set + * @param {number} index the index of the module + * @returns {void} + */ + setModulePostOrderIndex(module, index) { + this._modulePostOrderIndices.set(module, index); + } -/***/ }), + /** + * Gets the bottom-up index of a module in this ChunkGroup + * @param {Module} module the module + * @returns {number} index + */ + getModulePostOrderIndex(module) { + return this._modulePostOrderIndices.get(module); + } -/***/ 54983: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + /* istanbul ignore next */ + checkConstraints() { + const chunk = this; + for (const child of chunk._children) { + if (!child._parents.has(chunk)) { + throw new Error( + `checkConstraints: child missing parent ${chunk.debugId} -> ${child.debugId}` + ); + } + } + for (const parentChunk of chunk._parents) { + if (!parentChunk._children.has(chunk)) { + throw new Error( + `checkConstraints: parent missing child ${parentChunk.debugId} <- ${chunk.debugId}` + ); + } + } + } +} -"use strict"; -var __webpack_unused_export__; +ChunkGroup.prototype.getModuleIndex = util.deprecate( + ChunkGroup.prototype.getModulePreOrderIndex, + "ChunkGroup.getModuleIndex was renamed to getModulePreOrderIndex", + "DEP_WEBPACK_CHUNK_GROUP_GET_MODULE_INDEX" +); +ChunkGroup.prototype.getModuleIndex2 = util.deprecate( + ChunkGroup.prototype.getModulePostOrderIndex, + "ChunkGroup.getModuleIndex2 was renamed to getModulePostOrderIndex", + "DEP_WEBPACK_CHUNK_GROUP_GET_MODULE_INDEX_2" +); -__webpack_unused_export__ = ({ - value: true -}); -exports.Z = void 0; +module.exports = ChunkGroup; -const { - stringHints, - numberHints -} = __webpack_require__(79926); -/** @typedef {import("json-schema").JSONSchema6} JSONSchema6 */ -/** @typedef {import("json-schema").JSONSchema7} JSONSchema7 */ +/***/ }), -/** @typedef {import("./validate").Schema} Schema */ +/***/ 918: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** @typedef {import("./validate").ValidationErrorConfiguration} ValidationErrorConfiguration */ +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/** @typedef {import("./validate").PostFormatter} PostFormatter */ -/** @typedef {import("./validate").SchemaUtilErrorObject} SchemaUtilErrorObject */ -/** @enum {number} */ +const WebpackError = __webpack_require__(53799); +/** @typedef {import("./Chunk")} Chunk */ -const SPECIFICITY = { - type: 1, - not: 1, - oneOf: 1, - anyOf: 1, - if: 1, - enum: 1, - const: 1, - instanceof: 1, - required: 2, - pattern: 2, - patternRequired: 2, - format: 2, - formatMinimum: 2, - formatMaximum: 2, - minimum: 2, - exclusiveMinimum: 2, - maximum: 2, - exclusiveMaximum: 2, - multipleOf: 2, - uniqueItems: 2, - contains: 2, - minLength: 2, - maxLength: 2, - minItems: 2, - maxItems: 2, - minProperties: 2, - maxProperties: 2, - dependencies: 2, - propertyNames: 2, - additionalItems: 2, - additionalProperties: 2, - absolutePath: 2 -}; -/** - * - * @param {Array} array - * @param {(item: SchemaUtilErrorObject) => number} fn - * @returns {Array} - */ +class ChunkRenderError extends WebpackError { + /** + * Create a new ChunkRenderError + * @param {Chunk} chunk A chunk + * @param {string} file Related file + * @param {Error} error Original error + */ + constructor(chunk, file, error) { + super(); -function filterMax(array, fn) { - const evaluatedMax = array.reduce((max, item) => Math.max(max, fn(item)), 0); - return array.filter(item => fn(item) === evaluatedMax); + this.name = "ChunkRenderError"; + this.error = error; + this.message = error.message; + this.details = error.stack; + this.file = file; + this.chunk = chunk; + } } -/** - * - * @param {Array} children - * @returns {Array} - */ - -function filterChildren(children) { - let newChildren = children; - newChildren = filterMax(newChildren, - /** - * - * @param {SchemaUtilErrorObject} error - * @returns {number} - */ - error => error.dataPath ? error.dataPath.length : 0); - newChildren = filterMax(newChildren, - /** - * @param {SchemaUtilErrorObject} error - * @returns {number} - */ - error => SPECIFICITY[ - /** @type {keyof typeof SPECIFICITY} */ - error.keyword] || 2); - return newChildren; -} -/** - * Find all children errors - * @param {Array} children - * @param {Array} schemaPaths - * @return {number} returns index of first child - */ +module.exports = ChunkRenderError; -function findAllChildren(children, schemaPaths) { - let i = children.length - 1; +/***/ }), - const predicate = - /** - * @param {string} schemaPath - * @returns {boolean} - */ - schemaPath => children[i].schemaPath.indexOf(schemaPath) !== 0; +/***/ 46341: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - while (i > -1 && !schemaPaths.every(predicate)) { - if (children[i].keyword === "anyOf" || children[i].keyword === "oneOf") { - const refs = extractRefs(children[i]); - const childrenStart = findAllChildren(children.slice(0, i), refs.concat(children[i].schemaPath)); - i = childrenStart - 1; - } else { - i -= 1; - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - return i + 1; -} -/** - * Extracts all refs from schema - * @param {SchemaUtilErrorObject} error - * @return {Array} - */ -function extractRefs(error) { - const { - schema - } = error; +const util = __webpack_require__(73837); +const memoize = __webpack_require__(78676); - if (!Array.isArray(schema)) { - return []; - } +/** @typedef {import("../declarations/WebpackOptions").Output} OutputOptions */ +/** @typedef {import("./Compilation")} Compilation */ - return schema.map(({ - $ref - }) => $ref).filter(s => s); +const getJavascriptModulesPlugin = memoize(() => + __webpack_require__(89464) +); + +// TODO webpack 6 remove this class +class ChunkTemplate { + /** + * @param {OutputOptions} outputOptions output options + * @param {Compilation} compilation the compilation + */ + constructor(outputOptions, compilation) { + this._outputOptions = outputOptions || {}; + this.hooks = Object.freeze({ + renderManifest: { + tap: util.deprecate( + (options, fn) => { + compilation.hooks.renderManifest.tap( + options, + (entries, options) => { + if (options.chunk.hasRuntime()) return entries; + return fn(entries, options); + } + ); + }, + "ChunkTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)", + "DEP_WEBPACK_CHUNK_TEMPLATE_RENDER_MANIFEST" + ) + }, + modules: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .renderChunk.tap(options, (source, renderContext) => + fn( + source, + compilation.moduleTemplates.javascript, + renderContext + ) + ); + }, + "ChunkTemplate.hooks.modules is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderChunk instead)", + "DEP_WEBPACK_CHUNK_TEMPLATE_MODULES" + ) + }, + render: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .renderChunk.tap(options, (source, renderContext) => + fn( + source, + compilation.moduleTemplates.javascript, + renderContext + ) + ); + }, + "ChunkTemplate.hooks.render is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderChunk instead)", + "DEP_WEBPACK_CHUNK_TEMPLATE_RENDER" + ) + }, + renderWithEntry: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .render.tap(options, (source, renderContext) => { + if ( + renderContext.chunkGraph.getNumberOfEntryModules( + renderContext.chunk + ) === 0 || + renderContext.chunk.hasRuntime() + ) { + return source; + } + return fn(source, renderContext.chunk); + }); + }, + "ChunkTemplate.hooks.renderWithEntry is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)", + "DEP_WEBPACK_CHUNK_TEMPLATE_RENDER_WITH_ENTRY" + ) + }, + hash: { + tap: util.deprecate( + (options, fn) => { + compilation.hooks.fullHash.tap(options, fn); + }, + "ChunkTemplate.hooks.hash is deprecated (use Compilation.hooks.fullHash instead)", + "DEP_WEBPACK_CHUNK_TEMPLATE_HASH" + ) + }, + hashForChunk: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .chunkHash.tap(options, (chunk, hash, context) => { + if (chunk.hasRuntime()) return; + fn(hash, chunk, context); + }); + }, + "ChunkTemplate.hooks.hashForChunk is deprecated (use JavascriptModulesPlugin.getCompilationHooks().chunkHash instead)", + "DEP_WEBPACK_CHUNK_TEMPLATE_HASH_FOR_CHUNK" + ) + } + }); + } } -/** - * Groups children by their first level parent (assuming that error is root) - * @param {Array} children - * @return {Array} - */ +Object.defineProperty(ChunkTemplate.prototype, "outputOptions", { + get: util.deprecate( + /** + * @this {ChunkTemplate} + * @returns {OutputOptions} output options + */ + function () { + return this._outputOptions; + }, + "ChunkTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)", + "DEP_WEBPACK_CHUNK_TEMPLATE_OUTPUT_OPTIONS" + ) +}); -function groupChildrenByFirstChild(children) { - const result = []; - let i = children.length - 1; +module.exports = ChunkTemplate; - while (i > 0) { - const child = children[i]; - if (child.keyword === "anyOf" || child.keyword === "oneOf") { - const refs = extractRefs(child); - const childrenStart = findAllChildren(children.slice(0, i), refs.concat(child.schemaPath)); +/***/ }), - if (childrenStart !== i) { - result.push(Object.assign({}, child, { - children: children.slice(childrenStart, i) - })); - i = childrenStart; - } else { - result.push(child); - } - } else { - result.push(child); - } +/***/ 31085: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - i -= 1; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Sergey Melyukov @smelukov +*/ - if (i === 0) { - result.push(children[i]); - } - return result.reverse(); -} -/** - * @param {string} str - * @param {string} prefix - * @returns {string} - */ +const asyncLib = __webpack_require__(78175); +const { SyncBailHook } = __webpack_require__(6967); +const Compilation = __webpack_require__(85720); +const createSchemaValidation = __webpack_require__(32540); +const { join } = __webpack_require__(17139); +const processAsyncTree = __webpack_require__(42791); -function indent(str, prefix) { - return str.replace(/\n(?!$)/g, `\n${prefix}`); -} -/** - * @param {Schema} schema - * @returns {schema is (Schema & {not: Schema})} - */ +/** @typedef {import("../declarations/WebpackOptions").CleanOptions} CleanOptions */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./logging/Logger").Logger} Logger */ +/** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */ +/** @typedef {import("./util/fs").StatsCallback} StatsCallback */ +/** @typedef {(function(string):boolean)|RegExp} IgnoreItem */ +/** @typedef {function(IgnoreItem): void} AddToIgnoreCallback */ -function hasNotInSchema(schema) { - return !!schema.not; -} /** - * @param {Schema} schema - * @return {Schema} + * @typedef {Object} CleanPluginCompilationHooks + * @property {SyncBailHook<[string], boolean>} keep when returning true the file/directory will be kept during cleaning, returning false will clean it and ignore the following plugins and config */ +const validate = createSchemaValidation( + undefined, + () => { + const { definitions } = __webpack_require__(73342); + return { + definitions, + oneOf: [{ $ref: "#/definitions/CleanOptions" }] + }; + }, + { + name: "Clean Plugin", + baseDataPath: "options" + } +); -function findFirstTypedSchema(schema) { - if (hasNotInSchema(schema)) { - return findFirstTypedSchema(schema.not); - } - - return schema; -} /** - * @param {Schema} schema - * @return {boolean} + * @param {OutputFileSystem} fs filesystem + * @param {string} outputPath output path + * @param {Set} currentAssets filename of the current assets (must not start with .. or ., must only use / as path separator) + * @param {function((Error | null)=, Set=): void} callback returns the filenames of the assets that shouldn't be there + * @returns {void} */ +const getDiffToFs = (fs, outputPath, currentAssets, callback) => { + const directories = new Set(); + // get directories of assets + for (const asset of currentAssets) { + directories.add(asset.replace(/(^|\/)[^/]*$/, "")); + } + // and all parent directories + for (const directory of directories) { + directories.add(directory.replace(/(^|\/)[^/]*$/, "")); + } + const diff = new Set(); + asyncLib.forEachLimit( + directories, + 10, + (directory, callback) => { + fs.readdir(join(fs, outputPath, directory), (err, entries) => { + if (err) { + if (err.code === "ENOENT") return callback(); + if (err.code === "ENOTDIR") { + diff.add(directory); + return callback(); + } + return callback(err); + } + for (const entry of entries) { + const file = /** @type {string} */ (entry); + const filename = directory ? `${directory}/${file}` : file; + if (!directories.has(filename) && !currentAssets.has(filename)) { + diff.add(filename); + } + } + callback(); + }); + }, + err => { + if (err) return callback(err); + callback(null, diff); + } + ); +}; -function canApplyNot(schema) { - const typedSchema = findFirstTypedSchema(schema); - return likeNumber(typedSchema) || likeInteger(typedSchema) || likeString(typedSchema) || likeNull(typedSchema) || likeBoolean(typedSchema); -} /** - * @param {any} maybeObj - * @returns {boolean} + * @param {Set} currentAssets assets list + * @param {Set} oldAssets old assets list + * @returns {Set} diff */ +const getDiffToOldAssets = (currentAssets, oldAssets) => { + const diff = new Set(); + for (const asset of oldAssets) { + if (!currentAssets.has(asset)) diff.add(asset); + } + return diff; +}; - -function isObject(maybeObj) { - return typeof maybeObj === "object" && maybeObj !== null; -} /** - * @param {Schema} schema - * @returns {boolean} + * @param {OutputFileSystem} fs filesystem + * @param {string} filename path to file + * @param {StatsCallback} callback callback for provided filename + * @returns {void} */ +const doStat = (fs, filename, callback) => { + if ("lstat" in fs) { + fs.lstat(filename, callback); + } else { + fs.stat(filename, callback); + } +}; - -function likeNumber(schema) { - return schema.type === "number" || typeof schema.minimum !== "undefined" || typeof schema.exclusiveMinimum !== "undefined" || typeof schema.maximum !== "undefined" || typeof schema.exclusiveMaximum !== "undefined" || typeof schema.multipleOf !== "undefined"; -} /** - * @param {Schema} schema - * @returns {boolean} + * @param {OutputFileSystem} fs filesystem + * @param {string} outputPath output path + * @param {boolean} dry only log instead of fs modification + * @param {Logger} logger logger + * @param {Set} diff filenames of the assets that shouldn't be there + * @param {function(string): boolean} isKept check if the entry is ignored + * @param {function(Error=): void} callback callback + * @returns {void} */ +const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => { + const log = msg => { + if (dry) { + logger.info(msg); + } else { + logger.log(msg); + } + }; + /** @typedef {{ type: "check" | "unlink" | "rmdir", filename: string, parent: { remaining: number, job: Job } | undefined }} Job */ + /** @type {Job[]} */ + const jobs = Array.from(diff, filename => ({ + type: "check", + filename, + parent: undefined + })); + processAsyncTree( + jobs, + 10, + ({ type, filename, parent }, push, callback) => { + const handleError = err => { + if (err.code === "ENOENT") { + log(`${filename} was removed during cleaning by something else`); + handleParent(); + return callback(); + } + return callback(err); + }; + const handleParent = () => { + if (parent && --parent.remaining === 0) push(parent.job); + }; + const path = join(fs, outputPath, filename); + switch (type) { + case "check": + if (isKept(filename)) { + // do not decrement parent entry as we don't want to delete the parent + log(`${filename} will be kept`); + return process.nextTick(callback); + } + doStat(fs, path, (err, stats) => { + if (err) return handleError(err); + if (!stats.isDirectory()) { + push({ + type: "unlink", + filename, + parent + }); + return callback(); + } + fs.readdir(path, (err, entries) => { + if (err) return handleError(err); + /** @type {Job} */ + const deleteJob = { + type: "rmdir", + filename, + parent + }; + if (entries.length === 0) { + push(deleteJob); + } else { + const parentToken = { + remaining: entries.length, + job: deleteJob + }; + for (const entry of entries) { + const file = /** @type {string} */ (entry); + if (file.startsWith(".")) { + log( + `${filename} will be kept (dot-files will never be removed)` + ); + continue; + } + push({ + type: "check", + filename: `${filename}/${file}`, + parent: parentToken + }); + } + } + return callback(); + }); + }); + break; + case "rmdir": + log(`${filename} will be removed`); + if (dry) { + handleParent(); + return process.nextTick(callback); + } + if (!fs.rmdir) { + logger.warn( + `${filename} can't be removed because output file system doesn't support removing directories (rmdir)` + ); + return process.nextTick(callback); + } + fs.rmdir(path, err => { + if (err) return handleError(err); + handleParent(); + callback(); + }); + break; + case "unlink": + log(`${filename} will be removed`); + if (dry) { + handleParent(); + return process.nextTick(callback); + } + if (!fs.unlink) { + logger.warn( + `${filename} can't be removed because output file system doesn't support removing files (rmdir)` + ); + return process.nextTick(callback); + } + fs.unlink(path, err => { + if (err) return handleError(err); + handleParent(); + callback(); + }); + break; + } + }, + callback + ); +}; +/** @type {WeakMap} */ +const compilationHooksMap = new WeakMap(); -function likeInteger(schema) { - return schema.type === "integer" || typeof schema.minimum !== "undefined" || typeof schema.exclusiveMinimum !== "undefined" || typeof schema.maximum !== "undefined" || typeof schema.exclusiveMaximum !== "undefined" || typeof schema.multipleOf !== "undefined"; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ +class CleanPlugin { + /** + * @param {Compilation} compilation the compilation + * @returns {CleanPluginCompilationHooks} the attached hooks + */ + static getCompilationHooks(compilation) { + if (!(compilation instanceof Compilation)) { + throw new TypeError( + "The 'compilation' argument must be an instance of Compilation" + ); + } + let hooks = compilationHooksMap.get(compilation); + if (hooks === undefined) { + hooks = { + /** @type {SyncBailHook<[string], boolean>} */ + keep: new SyncBailHook(["ignore"]) + }; + compilationHooksMap.set(compilation, hooks); + } + return hooks; + } + /** @param {CleanOptions} options options */ + constructor(options = {}) { + validate(options); + this.options = { dry: false, ...options }; + } -function likeString(schema) { - return schema.type === "string" || typeof schema.minLength !== "undefined" || typeof schema.maxLength !== "undefined" || typeof schema.pattern !== "undefined" || typeof schema.format !== "undefined" || typeof schema.formatMinimum !== "undefined" || typeof schema.formatMaximum !== "undefined"; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const { dry, keep } = this.options; + const keepFn = + typeof keep === "function" + ? keep + : typeof keep === "string" + ? path => path.startsWith(keep) + : typeof keep === "object" && keep.test + ? path => keep.test(path) + : () => false; -function likeBoolean(schema) { - return schema.type === "boolean"; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ + // We assume that no external modification happens while the compiler is active + // So we can store the old assets and only diff to them to avoid fs access on + // incremental builds + let oldAssets; + compiler.hooks.emit.tapAsync( + { + name: "CleanPlugin", + stage: 100 + }, + (compilation, callback) => { + const hooks = CleanPlugin.getCompilationHooks(compilation); + const logger = compilation.getLogger("webpack.CleanPlugin"); + const fs = compiler.outputFileSystem; -function likeArray(schema) { - return schema.type === "array" || typeof schema.minItems === "number" || typeof schema.maxItems === "number" || typeof schema.uniqueItems !== "undefined" || typeof schema.items !== "undefined" || typeof schema.additionalItems !== "undefined" || typeof schema.contains !== "undefined"; -} -/** - * @param {Schema & {patternRequired?: Array}} schema - * @returns {boolean} - */ + if (!fs.readdir) { + return callback( + new Error( + "CleanPlugin: Output filesystem doesn't support listing directories (readdir)" + ) + ); + } + const currentAssets = new Set(); + for (const asset of Object.keys(compilation.assets)) { + if (/^[A-Za-z]:\\|^\/|^\\\\/.test(asset)) continue; + let normalizedAsset; + let newNormalizedAsset = asset.replace(/\\/g, "/"); + do { + normalizedAsset = newNormalizedAsset; + newNormalizedAsset = normalizedAsset.replace( + /(^|\/)(?!\.\.)[^/]+\/\.\.\//g, + "$1" + ); + } while (newNormalizedAsset !== normalizedAsset); + if (normalizedAsset.startsWith("../")) continue; + currentAssets.add(normalizedAsset); + } -function likeObject(schema) { - return schema.type === "object" || typeof schema.minProperties !== "undefined" || typeof schema.maxProperties !== "undefined" || typeof schema.required !== "undefined" || typeof schema.properties !== "undefined" || typeof schema.patternProperties !== "undefined" || typeof schema.additionalProperties !== "undefined" || typeof schema.dependencies !== "undefined" || typeof schema.propertyNames !== "undefined" || typeof schema.patternRequired !== "undefined"; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ + const outputPath = compilation.getPath(compiler.outputPath, {}); + const isKept = path => { + const result = hooks.keep.call(path); + if (result !== undefined) return result; + return keepFn(path); + }; -function likeNull(schema) { - return schema.type === "null"; -} -/** - * @param {string} type - * @returns {string} - */ + const diffCallback = (err, diff) => { + if (err) { + oldAssets = undefined; + return callback(err); + } + applyDiff(fs, outputPath, dry, logger, diff, isKept, err => { + if (err) { + oldAssets = undefined; + } else { + oldAssets = currentAssets; + } + callback(err); + }); + }; + if (oldAssets) { + diffCallback(null, getDiffToOldAssets(currentAssets, oldAssets)); + } else { + getDiffToFs(fs, outputPath, currentAssets, diffCallback); + } + } + ); + } +} -function getArticle(type) { - if (/^[aeiou]/i.test(type)) { - return "an"; - } +module.exports = CleanPlugin; - return "a"; -} -/** - * @param {Schema=} schema - * @returns {string} - */ +/***/ }), -function getSchemaNonTypes(schema) { - if (!schema) { - return ""; - } +/***/ 2102: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (!schema.type) { - if (likeNumber(schema) || likeInteger(schema)) { - return " | should be any non-number"; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (likeString(schema)) { - return " | should be any non-string"; - } - if (likeArray(schema)) { - return " | should be any non-array"; - } - if (likeObject(schema)) { - return " | should be any non-object"; - } - } +const WebpackError = __webpack_require__(53799); - return ""; -} -/** - * @param {Array} hints - * @returns {string} - */ +/** @typedef {import("./Module")} Module */ +class CodeGenerationError extends WebpackError { + /** + * Create a new CodeGenerationError + * @param {Module} module related module + * @param {Error} error Original error + */ + constructor(module, error) { + super(); -function formatHints(hints) { - return hints.length > 0 ? `(${hints.join(", ")})` : ""; + this.name = "CodeGenerationError"; + this.error = error; + this.message = error.message; + this.details = error.stack; + this.module = module; + } } -/** - * @param {Schema} schema - * @param {boolean} logic - * @returns {string[]} - */ - -function getHints(schema, logic) { - if (likeNumber(schema) || likeInteger(schema)) { - return numberHints(schema, logic); - } else if (likeString(schema)) { - return stringHints(schema, logic); - } +module.exports = CodeGenerationError; - return []; -} -class ValidationError extends Error { - /** - * @param {Array} errors - * @param {Schema} schema - * @param {ValidationErrorConfiguration} configuration - */ - constructor(errors, schema, configuration = {}) { - super(); - /** @type {string} */ +/***/ }), - this.name = "ValidationError"; - /** @type {Array} */ +/***/ 71426: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - this.errors = errors; - /** @type {Schema} */ +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - this.schema = schema; - let headerNameFromSchema; - let baseDataPathFromSchema; - if (schema.title && (!configuration.name || !configuration.baseDataPath)) { - const splittedTitleFromSchema = schema.title.match(/^(.+) (.+)$/); - if (splittedTitleFromSchema) { - if (!configuration.name) { - [, headerNameFromSchema] = splittedTitleFromSchema; - } +const { provide } = __webpack_require__(82482); +const { first } = __webpack_require__(93347); +const createHash = __webpack_require__(49835); +const { runtimeToString, RuntimeSpecMap } = __webpack_require__(17156); - if (!configuration.baseDataPath) { - [,, baseDataPathFromSchema] = splittedTitleFromSchema; - } - } - } - /** @type {string} */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {typeof import("./util/Hash")} Hash */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ +class CodeGenerationResults { + /** + * @param {string | Hash} hashFunction the hash function to use + */ + constructor(hashFunction = "md4") { + /** @type {Map>} */ + this.map = new Map(); + this._hashFunction = hashFunction; + } - this.headerName = configuration.name || headerNameFromSchema || "Object"; - /** @type {string} */ + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime runtime(s) + * @returns {CodeGenerationResult} the CodeGenerationResult + */ + get(module, runtime) { + const entry = this.map.get(module); + if (entry === undefined) { + throw new Error( + `No code generation entry for ${module.identifier()} (existing entries: ${Array.from( + this.map.keys(), + m => m.identifier() + ).join(", ")})` + ); + } + if (runtime === undefined) { + if (entry.size > 1) { + const results = new Set(entry.values()); + if (results.size !== 1) { + throw new Error( + `No unique code generation entry for unspecified runtime for ${module.identifier()} (existing runtimes: ${Array.from( + entry.keys(), + r => runtimeToString(r) + ).join(", ")}). +Caller might not support runtime-dependent code generation (opt-out via optimization.usedExports: "global").` + ); + } + return first(results); + } + return entry.values().next().value; + } + const result = entry.get(runtime); + if (result === undefined) { + throw new Error( + `No code generation entry for runtime ${runtimeToString( + runtime + )} for ${module.identifier()} (existing runtimes: ${Array.from( + entry.keys(), + r => runtimeToString(r) + ).join(", ")})` + ); + } + return result; + } - this.baseDataPath = configuration.baseDataPath || baseDataPathFromSchema || "configuration"; - /** @type {PostFormatter | null} */ + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime runtime(s) + * @returns {boolean} true, when we have data for this + */ + has(module, runtime) { + const entry = this.map.get(module); + if (entry === undefined) { + return false; + } + if (runtime !== undefined) { + return entry.has(runtime); + } else if (entry.size > 1) { + const results = new Set(entry.values()); + return results.size === 1; + } else { + return entry.size === 1; + } + } - this.postFormatter = configuration.postFormatter || null; - const header = `Invalid ${this.baseDataPath} object. ${this.headerName} has been initialized using ${getArticle(this.baseDataPath)} ${this.baseDataPath} object that does not match the API schema.\n`; - /** @type {string} */ + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime runtime(s) + * @param {string} sourceType the source type + * @returns {Source} a source + */ + getSource(module, runtime, sourceType) { + return this.get(module, runtime).sources.get(sourceType); + } - this.message = `${header}${this.formatValidationErrors(errors)}`; - Error.captureStackTrace(this, this.constructor); - } - /** - * @param {string} path - * @returns {Schema} - */ + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime runtime(s) + * @returns {ReadonlySet} runtime requirements + */ + getRuntimeRequirements(module, runtime) { + return this.get(module, runtime).runtimeRequirements; + } + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime runtime(s) + * @param {string} key data key + * @returns {any} data generated by code generation + */ + getData(module, runtime, key) { + const data = this.get(module, runtime).data; + return data === undefined ? undefined : data.get(key); + } - getSchemaPart(path) { - const newPath = path.split("/"); - let schemaPart = this.schema; + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime runtime(s) + * @returns {any} hash of the code generation + */ + getHash(module, runtime) { + const info = this.get(module, runtime); + if (info.hash !== undefined) return info.hash; + const hash = createHash(this._hashFunction); + for (const [type, source] of info.sources) { + hash.update(type); + source.updateHash(hash); + } + if (info.runtimeRequirements) { + for (const rr of info.runtimeRequirements) hash.update(rr); + } + return (info.hash = /** @type {string} */ (hash.digest("hex"))); + } - for (let i = 1; i < newPath.length; i++) { - const inner = schemaPart[ - /** @type {keyof Schema} */ - newPath[i]]; + /** + * @param {Module} module the module + * @param {RuntimeSpec} runtime runtime(s) + * @param {CodeGenerationResult} result result from module + * @returns {void} + */ + add(module, runtime, result) { + const map = provide(this.map, module, () => new RuntimeSpecMap()); + map.set(runtime, result); + } +} - if (!inner) { - break; - } +module.exports = CodeGenerationResults; - schemaPart = inner; - } - return schemaPart; - } - /** - * @param {Schema} schema - * @param {boolean} logic - * @param {Array} prevSchemas - * @returns {string} - */ +/***/ }), +/***/ 98427: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - formatSchema(schema, logic = true, prevSchemas = []) { - let newLogic = logic; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - const formatInnerSchema = - /** - * - * @param {Object} innerSchema - * @param {boolean=} addSelf - * @returns {string} - */ - (innerSchema, addSelf) => { - if (!addSelf) { - return this.formatSchema(innerSchema, newLogic, prevSchemas); - } - if (prevSchemas.includes(innerSchema)) { - return "(recursive)"; - } - return this.formatSchema(innerSchema, newLogic, prevSchemas.concat(schema)); - }; +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); - if (hasNotInSchema(schema) && !likeObject(schema)) { - if (canApplyNot(schema.not)) { - newLogic = !logic; - return formatInnerSchema(schema.not); - } +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ - const needApplyLogicHere = !schema.not.not; - const prefix = logic ? "" : "non "; - newLogic = !logic; - return needApplyLogicHere ? prefix + formatInnerSchema(schema.not) : formatInnerSchema(schema.not); - } +class CommentCompilationWarning extends WebpackError { + /** + * + * @param {string} message warning message + * @param {DependencyLocation} loc affected lines of code + */ + constructor(message, loc) { + super(message); - if ( - /** @type {Schema & {instanceof: string | Array}} */ - schema.instanceof) { - const { - instanceof: value - } = - /** @type {Schema & {instanceof: string | Array}} */ - schema; - const values = !Array.isArray(value) ? [value] : value; - return values.map( - /** - * @param {string} item - * @returns {string} - */ - item => item === "Function" ? "function" : item).join(" | "); - } + this.name = "CommentCompilationWarning"; - if (schema.enum) { - return ( - /** @type {Array} */ - schema.enum.map(item => JSON.stringify(item)).join(" | ") - ); - } + this.loc = loc; + } +} - if (typeof schema.const !== "undefined") { - return JSON.stringify(schema.const); - } +makeSerializable( + CommentCompilationWarning, + "webpack/lib/CommentCompilationWarning" +); - if (schema.oneOf) { - return ( - /** @type {Array} */ - schema.oneOf.map(item => formatInnerSchema(item, true)).join(" | ") - ); - } +module.exports = CommentCompilationWarning; - if (schema.anyOf) { - return ( - /** @type {Array} */ - schema.anyOf.map(item => formatInnerSchema(item, true)).join(" | ") - ); - } - if (schema.allOf) { - return ( - /** @type {Array} */ - schema.allOf.map(item => formatInnerSchema(item, true)).join(" & ") - ); - } +/***/ }), - if ( - /** @type {JSONSchema7} */ - schema.if) { - const { - if: ifValue, - then: thenValue, - else: elseValue - } = - /** @type {JSONSchema7} */ - schema; - return `${ifValue ? `if ${formatInnerSchema(ifValue)}` : ""}${thenValue ? ` then ${formatInnerSchema(thenValue)}` : ""}${elseValue ? ` else ${formatInnerSchema(elseValue)}` : ""}`; - } +/***/ 94258: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (schema.$ref) { - return formatInnerSchema(this.getSchemaPart(schema.$ref), true); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (likeNumber(schema) || likeInteger(schema)) { - const [type, ...hints] = getHints(schema, logic); - const str = `${type}${hints.length > 0 ? ` ${formatHints(hints)}` : ""}`; - return logic ? str : hints.length > 0 ? `non-${type} | ${str}` : `non-${type}`; - } - if (likeString(schema)) { - const [type, ...hints] = getHints(schema, logic); - const str = `${type}${hints.length > 0 ? ` ${formatHints(hints)}` : ""}`; - return logic ? str : str === "string" ? "non-string" : `non-string | ${str}`; - } - if (likeBoolean(schema)) { - return `${logic ? "" : "non-"}boolean`; - } +const ConstDependency = __webpack_require__(76911); - if (likeArray(schema)) { - // not logic already applied in formatValidationError - newLogic = true; - const hints = []; +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ - if (typeof schema.minItems === "number") { - hints.push(`should not have fewer than ${schema.minItems} item${schema.minItems > 1 ? "s" : ""}`); - } +const nestedWebpackRequireTag = Symbol("nested __webpack_require__"); - if (typeof schema.maxItems === "number") { - hints.push(`should not have more than ${schema.maxItems} item${schema.maxItems > 1 ? "s" : ""}`); - } +class CompatibilityPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "CompatibilityPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyTemplates.set( + ConstDependency, + new ConstDependency.Template() + ); - if (schema.uniqueItems) { - hints.push("should not have duplicate items"); - } + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("CompatibilityPlugin", (parser, parserOptions) => { + if ( + parserOptions.browserify !== undefined && + !parserOptions.browserify + ) + return; - const hasAdditionalItems = typeof schema.additionalItems === "undefined" || Boolean(schema.additionalItems); - let items = ""; + parser.hooks.call + .for("require") + .tap("CompatibilityPlugin", expr => { + // support for browserify style require delegator: "require(o, !0)" + if (expr.arguments.length !== 2) return; + const second = parser.evaluateExpression(expr.arguments[1]); + if (!second.isBoolean()) return; + if (second.asBool() !== true) return; + const dep = new ConstDependency("require", expr.callee.range); + dep.loc = expr.loc; + if (parser.state.current.dependencies.length > 0) { + const last = + parser.state.current.dependencies[ + parser.state.current.dependencies.length - 1 + ]; + if ( + last.critical && + last.options && + last.options.request === "." && + last.userRequest === "." && + last.options.recursive + ) + parser.state.current.dependencies.pop(); + } + parser.state.module.addPresentationalDependency(dep); + return true; + }); + }); - if (schema.items) { - if (Array.isArray(schema.items) && schema.items.length > 0) { - items = `${ - /** @type {Array} */ - schema.items.map(item => formatInnerSchema(item)).join(", ")}`; + /** + * @param {JavascriptParser} parser the parser + * @returns {void} + */ + const handler = parser => { + // Handle nested requires + parser.hooks.preStatement.tap("CompatibilityPlugin", statement => { + if ( + statement.type === "FunctionDeclaration" && + statement.id && + statement.id.name === "__webpack_require__" + ) { + const newName = `__nested_webpack_require_${statement.range[0]}__`; + parser.tagVariable(statement.id.name, nestedWebpackRequireTag, { + name: newName, + declaration: { + updated: false, + loc: statement.id.loc, + range: statement.id.range + } + }); + return true; + } + }); + parser.hooks.pattern + .for("__webpack_require__") + .tap("CompatibilityPlugin", pattern => { + const newName = `__nested_webpack_require_${pattern.range[0]}__`; + parser.tagVariable(pattern.name, nestedWebpackRequireTag, { + name: newName, + declaration: { + updated: false, + loc: pattern.loc, + range: pattern.range + } + }); + return true; + }); + parser.hooks.expression + .for(nestedWebpackRequireTag) + .tap("CompatibilityPlugin", expr => { + const { name, declaration } = parser.currentTagData; + if (!declaration.updated) { + const dep = new ConstDependency(name, declaration.range); + dep.loc = declaration.loc; + parser.state.module.addPresentationalDependency(dep); + declaration.updated = true; + } + const dep = new ConstDependency(name, expr.range); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); - if (hasAdditionalItems) { - if (schema.additionalItems && isObject(schema.additionalItems) && Object.keys(schema.additionalItems).length > 0) { - hints.push(`additional items should be ${formatInnerSchema(schema.additionalItems)}`); - } - } - } else if (schema.items && Object.keys(schema.items).length > 0) { - // "additionalItems" is ignored - items = `${formatInnerSchema(schema.items)}`; - } else { - // Fallback for empty `items` value - items = "any"; - } - } else { - // "additionalItems" is ignored - items = "any"; - } + // Handle hashbang + parser.hooks.program.tap( + "CompatibilityPlugin", + (program, comments) => { + if (comments.length === 0) return; + const c = comments[0]; + if (c.type === "Line" && c.range[0] === 0) { + if (parser.state.source.slice(0, 2).toString() !== "#!") return; + // this is a hashbang comment + const dep = new ConstDependency("//", 0); + dep.loc = c.loc; + parser.state.module.addPresentationalDependency(dep); + } + } + ); + }; - if (schema.contains && Object.keys(schema.contains).length > 0) { - hints.push(`should contains at least one ${this.formatSchema(schema.contains)} item`); - } + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("CompatibilityPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("CompatibilityPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("CompatibilityPlugin", handler); + } + ); + } +} +module.exports = CompatibilityPlugin; - return `[${items}${hasAdditionalItems ? ", ..." : ""}]${hints.length > 0 ? ` (${hints.join(", ")})` : ""}`; - } - if (likeObject(schema)) { - // not logic already applied in formatValidationError - newLogic = true; - const hints = []; +/***/ }), - if (typeof schema.minProperties === "number") { - hints.push(`should not have fewer than ${schema.minProperties} ${schema.minProperties > 1 ? "properties" : "property"}`); - } +/***/ 85720: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (typeof schema.maxProperties === "number") { - hints.push(`should not have more than ${schema.maxProperties} ${schema.minProperties && schema.minProperties > 1 ? "properties" : "property"}`); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (schema.patternProperties && Object.keys(schema.patternProperties).length > 0) { - const patternProperties = Object.keys(schema.patternProperties); - hints.push(`additional property names should match pattern${patternProperties.length > 1 ? "s" : ""} ${patternProperties.map(pattern => JSON.stringify(pattern)).join(" | ")}`); - } - const properties = schema.properties ? Object.keys(schema.properties) : []; - const required = schema.required ? schema.required : []; - const allProperties = [...new Set( - /** @type {Array} */ - [].concat(required).concat(properties))]; - const objectStructure = allProperties.map(property => { - const isRequired = required.includes(property); // Some properties need quotes, maybe we should add check - // Maybe we should output type of property (`foo: string`), but it is looks very unreadable - return `${property}${isRequired ? "" : "?"}`; - }).concat(typeof schema.additionalProperties === "undefined" || Boolean(schema.additionalProperties) ? schema.additionalProperties && isObject(schema.additionalProperties) ? [`: ${formatInnerSchema(schema.additionalProperties)}`] : ["…"] : []).join(", "); - const { - dependencies, - propertyNames, - patternRequired - } = - /** @type {Schema & {patternRequired?: Array;}} */ - schema; +const asyncLib = __webpack_require__(78175); +const { + HookMap, + SyncHook, + SyncBailHook, + SyncWaterfallHook, + AsyncSeriesHook, + AsyncSeriesBailHook, + AsyncParallelHook +} = __webpack_require__(6967); +const util = __webpack_require__(73837); +const { CachedSource } = __webpack_require__(51255); +const { MultiItemCache } = __webpack_require__(55392); +const Chunk = __webpack_require__(39385); +const ChunkGraph = __webpack_require__(64971); +const ChunkGroup = __webpack_require__(15626); +const ChunkRenderError = __webpack_require__(918); +const ChunkTemplate = __webpack_require__(46341); +const CodeGenerationError = __webpack_require__(2102); +const CodeGenerationResults = __webpack_require__(71426); +const Dependency = __webpack_require__(54912); +const DependencyTemplates = __webpack_require__(9163); +const Entrypoint = __webpack_require__(13795); +const ErrorHelpers = __webpack_require__(59985); +const FileSystemInfo = __webpack_require__(79453); +const { + connectChunkGroupAndChunk, + connectChunkGroupParentAndChild +} = __webpack_require__(37234); +const { + makeWebpackError, + tryRunOrWebpackError +} = __webpack_require__(11351); +const MainTemplate = __webpack_require__(12856); +const Module = __webpack_require__(73208); +const ModuleDependencyError = __webpack_require__(67409); +const ModuleDependencyWarning = __webpack_require__(29656); +const ModuleGraph = __webpack_require__(99988); +const ModuleNotFoundError = __webpack_require__(32882); +const ModuleProfile = __webpack_require__(36418); +const ModuleRestoreError = __webpack_require__(94560); +const ModuleStoreError = __webpack_require__(59001); +const ModuleTemplate = __webpack_require__(62677); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeTemplate = __webpack_require__(18777); +const Stats = __webpack_require__(31743); +const WebpackError = __webpack_require__(53799); +const buildChunkGraph = __webpack_require__(79233); +const BuildCycleError = __webpack_require__(22273); +const { Logger, LogType } = __webpack_require__(32597); +const StatsFactory = __webpack_require__(92629); +const StatsPrinter = __webpack_require__(30198); +const { equals: arrayEquals } = __webpack_require__(84953); +const AsyncQueue = __webpack_require__(12260); +const LazySet = __webpack_require__(38938); +const { provide } = __webpack_require__(82482); +const WeakTupleMap = __webpack_require__(28745); +const { cachedCleverMerge } = __webpack_require__(60839); +const { + compareLocations, + concatComparators, + compareSelect, + compareIds, + compareStringsNumeric, + compareModulesByIdentifier +} = __webpack_require__(29579); +const createHash = __webpack_require__(49835); +const { + arrayToSetDeprecation, + soonFrozenObjectDeprecation, + createFakeHook +} = __webpack_require__(64518); +const processAsyncTree = __webpack_require__(42791); +const { getRuntimeKey } = __webpack_require__(17156); +const { isSourceEqual } = __webpack_require__(41245); - if (dependencies) { - Object.keys(dependencies).forEach(dependencyName => { - const dependency = dependencies[dependencyName]; +/** @template T @typedef {import("tapable").AsArray} AsArray */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescription */ +/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */ +/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */ +/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */ +/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */ +/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("./Cache")} Cache */ +/** @typedef {import("./CacheFacade")} CacheFacade */ +/** @typedef {import("./ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Compiler").CompilationParams} CompilationParams */ +/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("./DependencyTemplate")} DependencyTemplate */ +/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("./ModuleFactory")} ModuleFactory */ +/** @typedef {import("./ModuleFactory").ModuleFactoryCreateDataContextInfo} ModuleFactoryCreateDataContextInfo */ +/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./RuntimeModule")} RuntimeModule */ +/** @typedef {import("./Template").RenderManifestEntry} RenderManifestEntry */ +/** @typedef {import("./Template").RenderManifestOptions} RenderManifestOptions */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsError} StatsError */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModule} StatsModule */ +/** @typedef {import("./util/Hash")} Hash */ +/** @template T @typedef {import("./util/deprecation").FakeHook} FakeHook */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - if (Array.isArray(dependency)) { - hints.push(`should have ${dependency.length > 1 ? "properties" : "property"} ${dependency.map(dep => `'${dep}'`).join(", ")} when property '${dependencyName}' is present`); - } else { - hints.push(`should be valid according to the schema ${formatInnerSchema(dependency)} when property '${dependencyName}' is present`); - } - }); - } +/** + * @callback Callback + * @param {(WebpackError | null)=} err + * @returns {void} + */ - if (propertyNames && Object.keys(propertyNames).length > 0) { - hints.push(`each property name should match format ${JSON.stringify(schema.propertyNames.format)}`); - } +/** + * @callback ModuleCallback + * @param {(WebpackError | null)=} err + * @param {Module=} result + * @returns {void} + */ - if (patternRequired && patternRequired.length > 0) { - hints.push(`should have property matching pattern ${patternRequired.map( - /** - * @param {string} item - * @returns {string} - */ - item => JSON.stringify(item))}`); - } +/** + * @callback ModuleFactoryResultCallback + * @param {(WebpackError | null)=} err + * @param {ModuleFactoryResult=} result + * @returns {void} + */ - return `object {${objectStructure ? ` ${objectStructure} ` : ""}}${hints.length > 0 ? ` (${hints.join(", ")})` : ""}`; - } +/** + * @callback ModuleOrFactoryResultCallback + * @param {(WebpackError | null)=} err + * @param {Module | ModuleFactoryResult=} result + * @returns {void} + */ - if (likeNull(schema)) { - return `${logic ? "" : "non-"}null`; - } +/** + * @callback ExecuteModuleCallback + * @param {(WebpackError | null)=} err + * @param {ExecuteModuleResult=} result + * @returns {void} + */ - if (Array.isArray(schema.type)) { - // not logic already applied in formatValidationError - return `${schema.type.join(" | ")}`; - } // Fallback for unknown keywords - // not logic already applied in formatValidationError +/** + * @callback DepBlockVarDependenciesCallback + * @param {Dependency} dependency + * @returns {any} + */ - /* istanbul ignore next */ +/** @typedef {new (...args: any[]) => Dependency} DepConstructor */ +/** @typedef {Record} CompilationAssets */ +/** + * @typedef {Object} AvailableModulesChunkGroupMapping + * @property {ChunkGroup} chunkGroup + * @property {Set} availableModules + * @property {boolean} needCopy + */ - return JSON.stringify(schema, null, 2); - } - /** - * @param {Schema=} schemaPart - * @param {(boolean | Array)=} additionalPath - * @param {boolean=} needDot - * @param {boolean=} logic - * @returns {string} - */ +/** + * @typedef {Object} DependenciesBlockLike + * @property {Dependency[]} dependencies + * @property {AsyncDependenciesBlock[]} blocks + */ +/** + * @typedef {Object} ChunkPathData + * @property {string|number} id + * @property {string=} name + * @property {string} hash + * @property {function(number): string=} hashWithLength + * @property {(Record)=} contentHash + * @property {(Record string>)=} contentHashWithLength + */ - getSchemaPartText(schemaPart, additionalPath, needDot = false, logic = true) { - if (!schemaPart) { - return ""; - } +/** + * @typedef {Object} ChunkHashContext + * @property {CodeGenerationResults} codeGenerationResults results of code generation + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + */ - if (Array.isArray(additionalPath)) { - for (let i = 0; i < additionalPath.length; i++) { - /** @type {Schema | undefined} */ - const inner = schemaPart[ - /** @type {keyof Schema} */ - additionalPath[i]]; +/** + * @typedef {Object} RuntimeRequirementsContext + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {CodeGenerationResults} codeGenerationResults the code generation results + */ - if (inner) { - // eslint-disable-next-line no-param-reassign - schemaPart = inner; - } else { - break; - } - } - } +/** + * @typedef {Object} ExecuteModuleOptions + * @property {EntryOptions=} entryOptions + */ - while (schemaPart.$ref) { - // eslint-disable-next-line no-param-reassign - schemaPart = this.getSchemaPart(schemaPart.$ref); - } +/** + * @typedef {Object} ExecuteModuleResult + * @property {any} exports + * @property {boolean} cacheable + * @property {Map} assets + * @property {LazySet} fileDependencies + * @property {LazySet} contextDependencies + * @property {LazySet} missingDependencies + * @property {LazySet} buildDependencies + */ - let schemaText = `${this.formatSchema(schemaPart, logic)}${needDot ? "." : ""}`; +/** + * @typedef {Object} ExecuteModuleArgument + * @property {Module} module + * @property {{ id: string, exports: any, loaded: boolean }=} moduleObject + * @property {any} preparedInfo + * @property {CodeGenerationResult} codeGenerationResult + */ - if (schemaPart.description) { - schemaText += `\n-> ${schemaPart.description}`; - } +/** + * @typedef {Object} ExecuteModuleContext + * @property {Map} assets + * @property {Chunk} chunk + * @property {ChunkGraph} chunkGraph + * @property {function(string): any=} __webpack_require__ + */ - if (schemaPart.link) { - schemaText += `\n-> Read more at ${schemaPart.link}`; - } +/** + * @typedef {Object} EntryData + * @property {Dependency[]} dependencies dependencies of the entrypoint that should be evaluated at startup + * @property {Dependency[]} includeDependencies dependencies of the entrypoint that should be included but not evaluated + * @property {EntryOptions} options options of the entrypoint + */ - return schemaText; - } - /** - * @param {Schema=} schemaPart - * @returns {string} - */ +/** + * @typedef {Object} LogEntry + * @property {string} type + * @property {any[]} args + * @property {number} time + * @property {string[]=} trace + */ +/** + * @typedef {Object} KnownAssetInfo + * @property {boolean=} immutable true, if the asset can be long term cached forever (contains a hash) + * @property {boolean=} minimized whether the asset is minimized + * @property {string | string[]=} fullhash the value(s) of the full hash used for this asset + * @property {string | string[]=} chunkhash the value(s) of the chunk hash used for this asset + * @property {string | string[]=} modulehash the value(s) of the module hash used for this asset + * @property {string | string[]=} contenthash the value(s) of the content hash used for this asset + * @property {string=} sourceFilename when asset was created from a source file (potentially transformed), the original filename relative to compilation context + * @property {number=} size size in bytes, only set after asset has been emitted + * @property {boolean=} development true, when asset is only used for development and doesn't count towards user-facing assets + * @property {boolean=} hotModuleReplacement true, when asset ships data for updating an existing application (HMR) + * @property {boolean=} javascriptModule true, when asset is javascript and an ESM + * @property {Record=} related object of pointers to other assets, keyed by type of relation (only points from parent to child) + */ - getSchemaPartDescription(schemaPart) { - if (!schemaPart) { - return ""; - } +/** @typedef {KnownAssetInfo & Record} AssetInfo */ - while (schemaPart.$ref) { - // eslint-disable-next-line no-param-reassign - schemaPart = this.getSchemaPart(schemaPart.$ref); - } +/** + * @typedef {Object} Asset + * @property {string} name the filename of the asset + * @property {Source} source source of the asset + * @property {AssetInfo} info info about the asset + */ - let schemaText = ""; +/** + * @typedef {Object} ModulePathData + * @property {string|number} id + * @property {string} hash + * @property {function(number): string=} hashWithLength + */ - if (schemaPart.description) { - schemaText += `\n-> ${schemaPart.description}`; - } +/** + * @typedef {Object} PathData + * @property {ChunkGraph=} chunkGraph + * @property {string=} hash + * @property {function(number): string=} hashWithLength + * @property {(Chunk|ChunkPathData)=} chunk + * @property {(Module|ModulePathData)=} module + * @property {RuntimeSpec=} runtime + * @property {string=} filename + * @property {string=} basename + * @property {string=} query + * @property {string=} contentHashType + * @property {string=} contentHash + * @property {function(number): string=} contentHashWithLength + * @property {boolean=} noChunkHash + * @property {string=} url + */ - if (schemaPart.link) { - schemaText += `\n-> Read more at ${schemaPart.link}`; - } +/** + * @typedef {Object} KnownNormalizedStatsOptions + * @property {string} context + * @property {RequestShortener} requestShortener + * @property {string} chunksSort + * @property {string} modulesSort + * @property {string} chunkModulesSort + * @property {string} nestedModulesSort + * @property {string} assetsSort + * @property {boolean} ids + * @property {boolean} cachedAssets + * @property {boolean} groupAssetsByEmitStatus + * @property {boolean} groupAssetsByPath + * @property {boolean} groupAssetsByExtension + * @property {number} assetsSpace + * @property {((value: string, asset: StatsAsset) => boolean)[]} excludeAssets + * @property {((name: string, module: StatsModule, type: "module" | "chunk" | "root-of-chunk" | "nested") => boolean)[]} excludeModules + * @property {((warning: StatsError, textValue: string) => boolean)[]} warningsFilter + * @property {boolean} cachedModules + * @property {boolean} orphanModules + * @property {boolean} dependentModules + * @property {boolean} runtimeModules + * @property {boolean} groupModulesByCacheStatus + * @property {boolean} groupModulesByLayer + * @property {boolean} groupModulesByAttributes + * @property {boolean} groupModulesByPath + * @property {boolean} groupModulesByExtension + * @property {boolean} groupModulesByType + * @property {boolean | "auto"} entrypoints + * @property {boolean} chunkGroups + * @property {boolean} chunkGroupAuxiliary + * @property {boolean} chunkGroupChildren + * @property {number} chunkGroupMaxAssets + * @property {number} modulesSpace + * @property {number} chunkModulesSpace + * @property {number} nestedModulesSpace + * @property {false|"none"|"error"|"warn"|"info"|"log"|"verbose"} logging + * @property {((value: string) => boolean)[]} loggingDebug + * @property {boolean} loggingTrace + * @property {any} _env + */ - return schemaText; - } - /** - * @param {SchemaUtilErrorObject} error - * @returns {string} - */ +/** @typedef {KnownNormalizedStatsOptions & Omit & Record} NormalizedStatsOptions */ +/** + * @typedef {Object} KnownCreateStatsOptionsContext + * @property {boolean=} forToString + */ - formatValidationError(error) { - const { - keyword, - dataPath: errorDataPath - } = error; - const dataPath = `${this.baseDataPath}${errorDataPath}`; +/** @typedef {KnownCreateStatsOptionsContext & Record} CreateStatsOptionsContext */ - switch (keyword) { - case "type": - { - const { - parentSchema, - params - } = error; // eslint-disable-next-line default-case +/** @type {AssetInfo} */ +const EMPTY_ASSET_INFO = Object.freeze({}); - switch ( - /** @type {import("ajv").TypeParams} */ - params.type) { - case "number": - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; +const esmDependencyCategory = "esm"; +// TODO webpack 6: remove +const deprecatedNormalModuleLoaderHook = util.deprecate( + compilation => { + return (__webpack_require__(39).getCompilationHooks)(compilation).loader; + }, + "Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader", + "DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK" +); - case "integer": - return `${dataPath} should be an ${this.getSchemaPartText(parentSchema, false, true)}`; +// TODO webpack 6: remove +const defineRemovedModuleTemplates = moduleTemplates => { + Object.defineProperties(moduleTemplates, { + asset: { + enumerable: false, + configurable: false, + get: () => { + throw new WebpackError( + "Compilation.moduleTemplates.asset has been removed" + ); + } + }, + webassembly: { + enumerable: false, + configurable: false, + get: () => { + throw new WebpackError( + "Compilation.moduleTemplates.webassembly has been removed" + ); + } + } + }); + moduleTemplates = undefined; +}; - case "string": - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; +const byId = compareSelect( + /** + * @param {Chunk} c chunk + * @returns {number | string} id + */ c => c.id, + compareIds +); - case "boolean": - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; +const byNameOrHash = concatComparators( + compareSelect( + /** + * @param {Compilation} c compilation + * @returns {string} name + */ + c => c.name, + compareIds + ), + compareSelect( + /** + * @param {Compilation} c compilation + * @returns {string} hash + */ c => c.fullHash, + compareIds + ) +); - case "array": - return `${dataPath} should be an array:\n${this.getSchemaPartText(parentSchema)}`; +const byMessage = compareSelect(err => `${err.message}`, compareStringsNumeric); - case "object": - return `${dataPath} should be an object:\n${this.getSchemaPartText(parentSchema)}`; +const byModule = compareSelect( + err => (err.module && err.module.identifier()) || "", + compareStringsNumeric +); - case "null": - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; +const byLocation = compareSelect(err => err.loc, compareLocations); - default: - return `${dataPath} should be:\n${this.getSchemaPartText(parentSchema)}`; - } - } +const compareErrors = concatComparators(byModule, byLocation, byMessage); - case "instanceof": - { - const { - parentSchema - } = error; - return `${dataPath} should be an instance of ${this.getSchemaPartText(parentSchema, false, true)}`; - } +/** @type {WeakMap} */ +const unsafeCacheDependencies = new WeakMap(); - case "pattern": - { - const { - params, - parentSchema - } = error; - const { - pattern - } = - /** @type {import("ajv").PatternParams} */ - params; - return `${dataPath} should match pattern ${JSON.stringify(pattern)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } +/** @type {WeakMap} */ +const unsafeCacheData = new WeakMap(); - case "format": - { - const { - params, - parentSchema - } = error; - const { - format - } = - /** @type {import("ajv").FormatParams} */ - params; - return `${dataPath} should match format ${JSON.stringify(format)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } +class Compilation { + /** + * Creates an instance of Compilation. + * @param {Compiler} compiler the compiler which created the compilation + * @param {CompilationParams} params the compilation parameters + */ + constructor(compiler, params) { + this._backCompat = compiler._backCompat; - case "formatMinimum": - case "formatMaximum": - { - const { - params, - parentSchema - } = error; - const { - comparison, - limit - } = - /** @type {import("ajv").ComparisonParams} */ - params; - return `${dataPath} should be ${comparison} ${JSON.stringify(limit)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + const getNormalModuleLoader = () => deprecatedNormalModuleLoaderHook(this); + /** @typedef {{ additionalAssets?: true | Function }} ProcessAssetsAdditionalOptions */ + /** @type {AsyncSeriesHook<[CompilationAssets], ProcessAssetsAdditionalOptions>} */ + const processAssetsHook = new AsyncSeriesHook(["assets"]); - case "minimum": - case "maximum": - case "exclusiveMinimum": - case "exclusiveMaximum": - { - const { - parentSchema, - params - } = error; - const { - comparison, - limit - } = - /** @type {import("ajv").ComparisonParams} */ - params; - const [, ...hints] = getHints( - /** @type {Schema} */ - parentSchema, true); + let savedAssets = new Set(); + const popNewAssets = assets => { + let newAssets = undefined; + for (const file of Object.keys(assets)) { + if (savedAssets.has(file)) continue; + if (newAssets === undefined) { + newAssets = Object.create(null); + } + newAssets[file] = assets[file]; + savedAssets.add(file); + } + return newAssets; + }; + processAssetsHook.intercept({ + name: "Compilation", + call: () => { + savedAssets = new Set(Object.keys(this.assets)); + }, + register: tap => { + const { type, name } = tap; + const { fn, additionalAssets, ...remainingTap } = tap; + const additionalAssetsFn = + additionalAssets === true ? fn : additionalAssets; + const processedAssets = additionalAssetsFn ? new WeakSet() : undefined; + switch (type) { + case "sync": + if (additionalAssetsFn) { + this.hooks.processAdditionalAssets.tap(name, assets => { + if (processedAssets.has(this.assets)) + additionalAssetsFn(assets); + }); + } + return { + ...remainingTap, + type: "async", + fn: (assets, callback) => { + try { + fn(assets); + } catch (e) { + return callback(e); + } + if (processedAssets !== undefined) + processedAssets.add(this.assets); + const newAssets = popNewAssets(assets); + if (newAssets !== undefined) { + this.hooks.processAdditionalAssets.callAsync( + newAssets, + callback + ); + return; + } + callback(); + } + }; + case "async": + if (additionalAssetsFn) { + this.hooks.processAdditionalAssets.tapAsync( + name, + (assets, callback) => { + if (processedAssets.has(this.assets)) + return additionalAssetsFn(assets, callback); + callback(); + } + ); + } + return { + ...remainingTap, + fn: (assets, callback) => { + fn(assets, err => { + if (err) return callback(err); + if (processedAssets !== undefined) + processedAssets.add(this.assets); + const newAssets = popNewAssets(assets); + if (newAssets !== undefined) { + this.hooks.processAdditionalAssets.callAsync( + newAssets, + callback + ); + return; + } + callback(); + }); + } + }; + case "promise": + if (additionalAssetsFn) { + this.hooks.processAdditionalAssets.tapPromise(name, assets => { + if (processedAssets.has(this.assets)) + return additionalAssetsFn(assets); + return Promise.resolve(); + }); + } + return { + ...remainingTap, + fn: assets => { + const p = fn(assets); + if (!p || !p.then) return p; + return p.then(() => { + if (processedAssets !== undefined) + processedAssets.add(this.assets); + const newAssets = popNewAssets(assets); + if (newAssets !== undefined) { + return this.hooks.processAdditionalAssets.promise( + newAssets + ); + } + }); + } + }; + } + } + }); - if (hints.length === 0) { - hints.push(`should be ${comparison} ${limit}`); - } + /** @type {SyncHook<[CompilationAssets]>} */ + const afterProcessAssetsHook = new SyncHook(["assets"]); - return `${dataPath} ${hints.join(" ")}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + /** + * @template T + * @param {string} name name of the hook + * @param {number} stage new stage + * @param {function(): AsArray} getArgs get old hook function args + * @param {string=} code deprecation code (not deprecated when unset) + * @returns {FakeHook, "tap" | "tapAsync" | "tapPromise" | "name">>} fake hook which redirects + */ + const createProcessAssetsHook = (name, stage, getArgs, code) => { + if (!this._backCompat && code) return undefined; + const errorMessage = + reason => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}. +BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`; + const getOptions = options => { + if (typeof options === "string") options = { name: options }; + if (options.stage) { + throw new Error(errorMessage("it's using the 'stage' option")); + } + return { ...options, stage: stage }; + }; + return createFakeHook( + { + name, + /** @type {AsyncSeriesHook["intercept"]} */ + intercept(interceptor) { + throw new Error(errorMessage("it's using 'intercept'")); + }, + /** @type {AsyncSeriesHook["tap"]} */ + tap: (options, fn) => { + processAssetsHook.tap(getOptions(options), () => fn(...getArgs())); + }, + /** @type {AsyncSeriesHook["tapAsync"]} */ + tapAsync: (options, fn) => { + processAssetsHook.tapAsync( + getOptions(options), + (assets, callback) => + /** @type {any} */ (fn)(...getArgs(), callback) + ); + }, + /** @type {AsyncSeriesHook["tapPromise"]} */ + tapPromise: (options, fn) => { + processAssetsHook.tapPromise(getOptions(options), () => + fn(...getArgs()) + ); + } + }, + `${name} is deprecated (use Compilation.hooks.processAssets instead and use one of Compilation.PROCESS_ASSETS_STAGE_* as stage option)`, + code + ); + }; + this.hooks = Object.freeze({ + /** @type {SyncHook<[Module]>} */ + buildModule: new SyncHook(["module"]), + /** @type {SyncHook<[Module]>} */ + rebuildModule: new SyncHook(["module"]), + /** @type {SyncHook<[Module, WebpackError]>} */ + failedModule: new SyncHook(["module", "error"]), + /** @type {SyncHook<[Module]>} */ + succeedModule: new SyncHook(["module"]), + /** @type {SyncHook<[Module]>} */ + stillValidModule: new SyncHook(["module"]), - case "multipleOf": - { - const { - params, - parentSchema - } = error; - const { - multipleOf - } = - /** @type {import("ajv").MultipleOfParams} */ - params; - return `${dataPath} should be multiple of ${multipleOf}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + /** @type {SyncHook<[Dependency, EntryOptions]>} */ + addEntry: new SyncHook(["entry", "options"]), + /** @type {SyncHook<[Dependency, EntryOptions, Error]>} */ + failedEntry: new SyncHook(["entry", "options", "error"]), + /** @type {SyncHook<[Dependency, EntryOptions, Module]>} */ + succeedEntry: new SyncHook(["entry", "options", "module"]), - case "patternRequired": - { - const { - params, - parentSchema - } = error; - const { - missingPattern - } = - /** @type {import("ajv").PatternRequiredParams} */ - params; - return `${dataPath} should have property matching pattern ${JSON.stringify(missingPattern)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + /** @type {SyncWaterfallHook<[(string[] | ReferencedExport)[], Dependency, RuntimeSpec]>} */ + dependencyReferencedExports: new SyncWaterfallHook([ + "referencedExports", + "dependency", + "runtime" + ]), - case "minLength": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; + /** @type {SyncHook<[ExecuteModuleArgument, ExecuteModuleContext]>} */ + executeModule: new SyncHook(["options", "context"]), + /** @type {AsyncParallelHook<[ExecuteModuleArgument, ExecuteModuleContext]>} */ + prepareModuleExecution: new AsyncParallelHook(["options", "context"]), - if (limit === 1) { - return `${dataPath} should be a non-empty string${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - const length = limit - 1; - return `${dataPath} should be longer than ${length} character${length > 1 ? "s" : ""}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "minItems": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; + /** @type {AsyncSeriesHook<[Iterable]>} */ + finishModules: new AsyncSeriesHook(["modules"]), + /** @type {AsyncSeriesHook<[Module]>} */ + finishRebuildingModule: new AsyncSeriesHook(["module"]), + /** @type {SyncHook<[]>} */ + unseal: new SyncHook([]), + /** @type {SyncHook<[]>} */ + seal: new SyncHook([]), - if (limit === 1) { - return `${dataPath} should be a non-empty array${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + /** @type {SyncHook<[]>} */ + beforeChunks: new SyncHook([]), + /** @type {SyncHook<[Iterable]>} */ + afterChunks: new SyncHook(["chunks"]), - return `${dataPath} should not have fewer than ${limit} items${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + /** @type {SyncBailHook<[Iterable]>} */ + optimizeDependencies: new SyncBailHook(["modules"]), + /** @type {SyncHook<[Iterable]>} */ + afterOptimizeDependencies: new SyncHook(["modules"]), - case "minProperties": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; + /** @type {SyncHook<[]>} */ + optimize: new SyncHook([]), + /** @type {SyncBailHook<[Iterable]>} */ + optimizeModules: new SyncBailHook(["modules"]), + /** @type {SyncHook<[Iterable]>} */ + afterOptimizeModules: new SyncHook(["modules"]), - if (limit === 1) { - return `${dataPath} should be a non-empty object${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + /** @type {SyncBailHook<[Iterable, ChunkGroup[]]>} */ + optimizeChunks: new SyncBailHook(["chunks", "chunkGroups"]), + /** @type {SyncHook<[Iterable, ChunkGroup[]]>} */ + afterOptimizeChunks: new SyncHook(["chunks", "chunkGroups"]), - return `${dataPath} should not have fewer than ${limit} properties${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + /** @type {AsyncSeriesHook<[Iterable, Iterable]>} */ + optimizeTree: new AsyncSeriesHook(["chunks", "modules"]), + /** @type {SyncHook<[Iterable, Iterable]>} */ + afterOptimizeTree: new SyncHook(["chunks", "modules"]), - case "maxLength": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - const max = limit + 1; - return `${dataPath} should be shorter than ${max} character${max > 1 ? "s" : ""}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + /** @type {AsyncSeriesBailHook<[Iterable, Iterable]>} */ + optimizeChunkModules: new AsyncSeriesBailHook(["chunks", "modules"]), + /** @type {SyncHook<[Iterable, Iterable]>} */ + afterOptimizeChunkModules: new SyncHook(["chunks", "modules"]), + /** @type {SyncBailHook<[], boolean>} */ + shouldRecord: new SyncBailHook([]), - case "maxItems": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - return `${dataPath} should not have more than ${limit} items${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + /** @type {SyncHook<[Chunk, Set, RuntimeRequirementsContext]>} */ + additionalChunkRuntimeRequirements: new SyncHook([ + "chunk", + "runtimeRequirements", + "context" + ]), + /** @type {HookMap, RuntimeRequirementsContext]>>} */ + runtimeRequirementInChunk: new HookMap( + () => new SyncBailHook(["chunk", "runtimeRequirements", "context"]) + ), + /** @type {SyncHook<[Module, Set, RuntimeRequirementsContext]>} */ + additionalModuleRuntimeRequirements: new SyncHook([ + "module", + "runtimeRequirements", + "context" + ]), + /** @type {HookMap, RuntimeRequirementsContext]>>} */ + runtimeRequirementInModule: new HookMap( + () => new SyncBailHook(["module", "runtimeRequirements", "context"]) + ), + /** @type {SyncHook<[Chunk, Set, RuntimeRequirementsContext]>} */ + additionalTreeRuntimeRequirements: new SyncHook([ + "chunk", + "runtimeRequirements", + "context" + ]), + /** @type {HookMap, RuntimeRequirementsContext]>>} */ + runtimeRequirementInTree: new HookMap( + () => new SyncBailHook(["chunk", "runtimeRequirements", "context"]) + ), - case "maxProperties": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - return `${dataPath} should not have more than ${limit} properties${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + /** @type {SyncHook<[RuntimeModule, Chunk]>} */ + runtimeModule: new SyncHook(["module", "chunk"]), - case "uniqueItems": - { - const { - params, - parentSchema - } = error; - const { - i - } = - /** @type {import("ajv").UniqueItemsParams} */ - params; - return `${dataPath} should not contain the item '${error.data[i]}' twice${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + /** @type {SyncHook<[Iterable, any]>} */ + reviveModules: new SyncHook(["modules", "records"]), + /** @type {SyncHook<[Iterable]>} */ + beforeModuleIds: new SyncHook(["modules"]), + /** @type {SyncHook<[Iterable]>} */ + moduleIds: new SyncHook(["modules"]), + /** @type {SyncHook<[Iterable]>} */ + optimizeModuleIds: new SyncHook(["modules"]), + /** @type {SyncHook<[Iterable]>} */ + afterOptimizeModuleIds: new SyncHook(["modules"]), - case "additionalItems": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - return `${dataPath} should not have more than ${limit} items${getSchemaNonTypes(parentSchema)}. These items are valid:\n${this.getSchemaPartText(parentSchema)}`; - } + /** @type {SyncHook<[Iterable, any]>} */ + reviveChunks: new SyncHook(["chunks", "records"]), + /** @type {SyncHook<[Iterable]>} */ + beforeChunkIds: new SyncHook(["chunks"]), + /** @type {SyncHook<[Iterable]>} */ + chunkIds: new SyncHook(["chunks"]), + /** @type {SyncHook<[Iterable]>} */ + optimizeChunkIds: new SyncHook(["chunks"]), + /** @type {SyncHook<[Iterable]>} */ + afterOptimizeChunkIds: new SyncHook(["chunks"]), - case "contains": - { - const { - parentSchema - } = error; - return `${dataPath} should contains at least one ${this.getSchemaPartText(parentSchema, ["contains"])} item${getSchemaNonTypes(parentSchema)}.`; - } + /** @type {SyncHook<[Iterable, any]>} */ + recordModules: new SyncHook(["modules", "records"]), + /** @type {SyncHook<[Iterable, any]>} */ + recordChunks: new SyncHook(["chunks", "records"]), - case "required": - { - const { - parentSchema, - params - } = error; - const missingProperty = - /** @type {import("ajv").DependenciesParams} */ - params.missingProperty.replace(/^\./, ""); - const hasProperty = parentSchema && Boolean( - /** @type {Schema} */ - parentSchema.properties && - /** @type {Schema} */ - parentSchema.properties[missingProperty]); - return `${dataPath} misses the property '${missingProperty}'${getSchemaNonTypes(parentSchema)}.${hasProperty ? ` Should be:\n${this.getSchemaPartText(parentSchema, ["properties", missingProperty])}` : this.getSchemaPartDescription(parentSchema)}`; - } + /** @type {SyncHook<[Iterable]>} */ + optimizeCodeGeneration: new SyncHook(["modules"]), - case "additionalProperties": - { - const { - params, - parentSchema - } = error; - const { - additionalProperty - } = - /** @type {import("ajv").AdditionalPropertiesParams} */ - params; - return `${dataPath} has an unknown property '${additionalProperty}'${getSchemaNonTypes(parentSchema)}. These properties are valid:\n${this.getSchemaPartText(parentSchema)}`; - } + /** @type {SyncHook<[]>} */ + beforeModuleHash: new SyncHook([]), + /** @type {SyncHook<[]>} */ + afterModuleHash: new SyncHook([]), - case "dependencies": - { - const { - params, - parentSchema - } = error; - const { - property, - deps - } = - /** @type {import("ajv").DependenciesParams} */ - params; - const dependencies = deps.split(",").map( - /** - * @param {string} dep - * @returns {string} - */ - dep => `'${dep.trim()}'`).join(", "); - return `${dataPath} should have properties ${dependencies} when property '${property}' is present${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } + /** @type {SyncHook<[]>} */ + beforeCodeGeneration: new SyncHook([]), + /** @type {SyncHook<[]>} */ + afterCodeGeneration: new SyncHook([]), - case "propertyNames": - { - const { - params, - parentSchema, - schema - } = error; - const { - propertyName - } = - /** @type {import("ajv").PropertyNamesParams} */ - params; - return `${dataPath} property name '${propertyName}' is invalid${getSchemaNonTypes(parentSchema)}. Property names should be match format ${JSON.stringify(schema.format)}.${this.getSchemaPartDescription(parentSchema)}`; - } + /** @type {SyncHook<[]>} */ + beforeRuntimeRequirements: new SyncHook([]), + /** @type {SyncHook<[]>} */ + afterRuntimeRequirements: new SyncHook([]), - case "enum": - { - const { - parentSchema - } = error; + /** @type {SyncHook<[]>} */ + beforeHash: new SyncHook([]), + /** @type {SyncHook<[Chunk]>} */ + contentHash: new SyncHook(["chunk"]), + /** @type {SyncHook<[]>} */ + afterHash: new SyncHook([]), + /** @type {SyncHook<[any]>} */ + recordHash: new SyncHook(["records"]), + /** @type {SyncHook<[Compilation, any]>} */ + record: new SyncHook(["compilation", "records"]), - if (parentSchema && - /** @type {Schema} */ - parentSchema.enum && - /** @type {Schema} */ - parentSchema.enum.length === 1) { - return `${dataPath} should be ${this.getSchemaPartText(parentSchema, false, true)}`; - } + /** @type {SyncHook<[]>} */ + beforeModuleAssets: new SyncHook([]), + /** @type {SyncBailHook<[], boolean>} */ + shouldGenerateChunkAssets: new SyncBailHook([]), + /** @type {SyncHook<[]>} */ + beforeChunkAssets: new SyncHook([]), + // TODO webpack 6 remove + /** @deprecated */ + additionalChunkAssets: createProcessAssetsHook( + "additionalChunkAssets", + Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL, + () => [this.chunks], + "DEP_WEBPACK_COMPILATION_ADDITIONAL_CHUNK_ASSETS" + ), - return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}`; - } + // TODO webpack 6 deprecate + /** @deprecated */ + additionalAssets: createProcessAssetsHook( + "additionalAssets", + Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL, + () => [] + ), + // TODO webpack 6 remove + /** @deprecated */ + optimizeChunkAssets: createProcessAssetsHook( + "optimizeChunkAssets", + Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE, + () => [this.chunks], + "DEP_WEBPACK_COMPILATION_OPTIMIZE_CHUNK_ASSETS" + ), + // TODO webpack 6 remove + /** @deprecated */ + afterOptimizeChunkAssets: createProcessAssetsHook( + "afterOptimizeChunkAssets", + Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE + 1, + () => [this.chunks], + "DEP_WEBPACK_COMPILATION_AFTER_OPTIMIZE_CHUNK_ASSETS" + ), + // TODO webpack 6 deprecate + /** @deprecated */ + optimizeAssets: processAssetsHook, + // TODO webpack 6 deprecate + /** @deprecated */ + afterOptimizeAssets: afterProcessAssetsHook, - case "const": - { - const { - parentSchema - } = error; - return `${dataPath} should be equal to constant ${this.getSchemaPartText(parentSchema, false, true)}`; - } + processAssets: processAssetsHook, + afterProcessAssets: afterProcessAssetsHook, + /** @type {AsyncSeriesHook<[CompilationAssets]>} */ + processAdditionalAssets: new AsyncSeriesHook(["assets"]), - case "not": - { - const postfix = likeObject( - /** @type {Schema} */ - error.parentSchema) ? `\n${this.getSchemaPartText(error.parentSchema)}` : ""; - const schemaOutput = this.getSchemaPartText(error.schema, false, false, false); + /** @type {SyncBailHook<[], boolean>} */ + needAdditionalSeal: new SyncBailHook([]), + /** @type {AsyncSeriesHook<[]>} */ + afterSeal: new AsyncSeriesHook([]), - if (canApplyNot(error.schema)) { - return `${dataPath} should be any ${schemaOutput}${postfix}.`; - } + /** @type {SyncWaterfallHook<[RenderManifestEntry[], RenderManifestOptions]>} */ + renderManifest: new SyncWaterfallHook(["result", "options"]), - const { - schema, - parentSchema - } = error; - return `${dataPath} should not be ${this.getSchemaPartText(schema, false, true)}${parentSchema && likeObject(parentSchema) ? `\n${this.getSchemaPartText(parentSchema)}` : ""}`; - } + /** @type {SyncHook<[Hash]>} */ + fullHash: new SyncHook(["hash"]), + /** @type {SyncHook<[Chunk, Hash, ChunkHashContext]>} */ + chunkHash: new SyncHook(["chunk", "chunkHash", "ChunkHashContext"]), - case "oneOf": - case "anyOf": - { - const { - parentSchema, - children - } = error; + /** @type {SyncHook<[Module, string]>} */ + moduleAsset: new SyncHook(["module", "filename"]), + /** @type {SyncHook<[Chunk, string]>} */ + chunkAsset: new SyncHook(["chunk", "filename"]), - if (children && children.length > 0) { - if (error.schema.length === 1) { - const lastChild = children[children.length - 1]; - const remainingChildren = children.slice(0, children.length - 1); - return this.formatValidationError(Object.assign({}, lastChild, { - children: remainingChildren, - parentSchema: Object.assign({}, parentSchema, lastChild.parentSchema) - })); - } + /** @type {SyncWaterfallHook<[string, object, AssetInfo]>} */ + assetPath: new SyncWaterfallHook(["path", "options", "assetInfo"]), - let filteredChildren = filterChildren(children); + /** @type {SyncBailHook<[], boolean>} */ + needAdditionalPass: new SyncBailHook([]), - if (filteredChildren.length === 1) { - return this.formatValidationError(filteredChildren[0]); - } + /** @type {SyncHook<[Compiler, string, number]>} */ + childCompiler: new SyncHook([ + "childCompiler", + "compilerName", + "compilerIndex" + ]), - filteredChildren = groupChildrenByFirstChild(filteredChildren); - return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}\nDetails:\n${filteredChildren.map( - /** - * @param {SchemaUtilErrorObject} nestedError - * @returns {string} - */ - nestedError => ` * ${indent(this.formatValidationError(nestedError), " ")}`).join("\n")}`; - } + /** @type {SyncBailHook<[string, LogEntry], true>} */ + log: new SyncBailHook(["origin", "logEntry"]), - return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}`; - } + /** @type {SyncWaterfallHook<[WebpackError[]]>} */ + processWarnings: new SyncWaterfallHook(["warnings"]), + /** @type {SyncWaterfallHook<[WebpackError[]]>} */ + processErrors: new SyncWaterfallHook(["errors"]), - case "if": - { - const { - params, - parentSchema - } = error; - const { - failingKeyword - } = - /** @type {import("ajv").IfParams} */ - params; - return `${dataPath} should match "${failingKeyword}" schema:\n${this.getSchemaPartText(parentSchema, [failingKeyword])}`; - } + /** @type {HookMap, CreateStatsOptionsContext]>>} */ + statsPreset: new HookMap(() => new SyncHook(["options", "context"])), + /** @type {SyncHook<[Partial, CreateStatsOptionsContext]>} */ + statsNormalize: new SyncHook(["options", "context"]), + /** @type {SyncHook<[StatsFactory, NormalizedStatsOptions]>} */ + statsFactory: new SyncHook(["statsFactory", "options"]), + /** @type {SyncHook<[StatsPrinter, NormalizedStatsOptions]>} */ + statsPrinter: new SyncHook(["statsPrinter", "options"]), - case "absolutePath": - { - const { - message, - parentSchema - } = error; - return `${dataPath}: ${message}${this.getSchemaPartDescription(parentSchema)}`; - } + get normalModuleLoader() { + return getNormalModuleLoader(); + } + }); + /** @type {string=} */ + this.name = undefined; + this.startTime = undefined; + this.endTime = undefined; + /** @type {Compiler} */ + this.compiler = compiler; + this.resolverFactory = compiler.resolverFactory; + this.inputFileSystem = compiler.inputFileSystem; + this.fileSystemInfo = new FileSystemInfo(this.inputFileSystem, { + managedPaths: compiler.managedPaths, + immutablePaths: compiler.immutablePaths, + logger: this.getLogger("webpack.FileSystemInfo"), + hashFunction: compiler.options.output.hashFunction + }); + if (compiler.fileTimestamps) { + this.fileSystemInfo.addFileTimestamps(compiler.fileTimestamps, true); + } + if (compiler.contextTimestamps) { + this.fileSystemInfo.addContextTimestamps( + compiler.contextTimestamps, + true + ); + } + /** @type {Map>} */ + this.valueCacheVersions = new Map(); + this.requestShortener = compiler.requestShortener; + this.compilerPath = compiler.compilerPath; - /* istanbul ignore next */ + this.logger = this.getLogger("webpack.Compilation"); - default: - { - const { - message, - parentSchema - } = error; - const ErrorInJSON = JSON.stringify(error, null, 2); // For `custom`, `false schema`, `$ref` keywords - // Fallback for unknown keywords + const options = compiler.options; + this.options = options; + this.outputOptions = options && options.output; + /** @type {boolean} */ + this.bail = (options && options.bail) || false; + /** @type {boolean} */ + this.profile = (options && options.profile) || false; - return `${dataPath} ${message} (${ErrorInJSON}).\n${this.getSchemaPartText(parentSchema, false)}`; - } - } - } - /** - * @param {Array} errors - * @returns {string} - */ - - - formatValidationErrors(errors) { - return errors.map(error => { - let formattedError = this.formatValidationError(error); - - if (this.postFormatter) { - formattedError = this.postFormatter(formattedError, error); - } + this.params = params; + this.mainTemplate = new MainTemplate(this.outputOptions, this); + this.chunkTemplate = new ChunkTemplate(this.outputOptions, this); + this.runtimeTemplate = new RuntimeTemplate( + this, + this.outputOptions, + this.requestShortener + ); + /** @type {{javascript: ModuleTemplate}} */ + this.moduleTemplates = { + javascript: new ModuleTemplate(this.runtimeTemplate, this) + }; + defineRemovedModuleTemplates(this.moduleTemplates); - return ` - ${indent(formattedError, " ")}`; - }).join("\n"); - } + /** @type {Map> | undefined} */ + this.moduleMemCaches = undefined; + /** @type {Map> | undefined} */ + this.moduleMemCaches2 = undefined; + this.moduleGraph = new ModuleGraph(); + /** @type {ChunkGraph} */ + this.chunkGraph = undefined; + /** @type {CodeGenerationResults} */ + this.codeGenerationResults = undefined; -} + /** @type {AsyncQueue} */ + this.processDependenciesQueue = new AsyncQueue({ + name: "processDependencies", + parallelism: options.parallelism || 100, + processor: this._processModuleDependencies.bind(this) + }); + /** @type {AsyncQueue} */ + this.addModuleQueue = new AsyncQueue({ + name: "addModule", + parent: this.processDependenciesQueue, + getKey: module => module.identifier(), + processor: this._addModule.bind(this) + }); + /** @type {AsyncQueue} */ + this.factorizeQueue = new AsyncQueue({ + name: "factorize", + parent: this.addModuleQueue, + processor: this._factorizeModule.bind(this) + }); + /** @type {AsyncQueue} */ + this.buildQueue = new AsyncQueue({ + name: "build", + parent: this.factorizeQueue, + processor: this._buildModule.bind(this) + }); + /** @type {AsyncQueue} */ + this.rebuildQueue = new AsyncQueue({ + name: "rebuild", + parallelism: options.parallelism || 100, + processor: this._rebuildModule.bind(this) + }); -var _default = ValidationError; -exports.Z = _default; + /** + * Modules in value are building during the build of Module in key. + * Means value blocking key from finishing. + * Needed to detect build cycles. + * @type {WeakMap>} + */ + this.creatingModuleDuringBuild = new WeakMap(); -/***/ }), + /** @type {Map} */ + this.entries = new Map(); + /** @type {EntryData} */ + this.globalEntry = { + dependencies: [], + includeDependencies: [], + options: { + name: undefined + } + }; + /** @type {Map} */ + this.entrypoints = new Map(); + /** @type {Entrypoint[]} */ + this.asyncEntrypoints = []; + /** @type {Set} */ + this.chunks = new Set(); + /** @type {ChunkGroup[]} */ + this.chunkGroups = []; + /** @type {Map} */ + this.namedChunkGroups = new Map(); + /** @type {Map} */ + this.namedChunks = new Map(); + /** @type {Set} */ + this.modules = new Set(); + if (this._backCompat) { + arrayToSetDeprecation(this.chunks, "Compilation.chunks"); + arrayToSetDeprecation(this.modules, "Compilation.modules"); + } + /** @private @type {Map} */ + this._modules = new Map(); + this.records = null; + /** @type {string[]} */ + this.additionalChunkAssets = []; + /** @type {CompilationAssets} */ + this.assets = {}; + /** @type {Map} */ + this.assetsInfo = new Map(); + /** @type {Map>>} */ + this._assetsRelatedIn = new Map(); + /** @type {WebpackError[]} */ + this.errors = []; + /** @type {WebpackError[]} */ + this.warnings = []; + /** @type {Compilation[]} */ + this.children = []; + /** @type {Map} */ + this.logging = new Map(); + /** @type {Map} */ + this.dependencyFactories = new Map(); + /** @type {DependencyTemplates} */ + this.dependencyTemplates = new DependencyTemplates( + this.outputOptions.hashFunction + ); + this.childrenCounters = {}; + /** @type {Set} */ + this.usedChunkIds = null; + /** @type {Set} */ + this.usedModuleIds = null; + /** @type {boolean} */ + this.needAdditionalPass = false; + /** @type {Set} */ + this._restoredUnsafeCacheModuleEntries = new Set(); + /** @type {Map} */ + this._restoredUnsafeCacheEntries = new Map(); + /** @type {WeakSet} */ + this.builtModules = new WeakSet(); + /** @type {WeakSet} */ + this.codeGeneratedModules = new WeakSet(); + /** @type {WeakSet} */ + this.buildTimeExecutedModules = new WeakSet(); + /** @private @type {Map} */ + this._rebuildingModules = new Map(); + /** @type {Set} */ + this.emittedAssets = new Set(); + /** @type {Set} */ + this.comparedForEmitAssets = new Set(); + /** @type {LazySet} */ + this.fileDependencies = new LazySet(); + /** @type {LazySet} */ + this.contextDependencies = new LazySet(); + /** @type {LazySet} */ + this.missingDependencies = new LazySet(); + /** @type {LazySet} */ + this.buildDependencies = new LazySet(); + // TODO webpack 6 remove + this.compilationDependencies = { + add: util.deprecate( + item => this.fileDependencies.add(item), + "Compilation.compilationDependencies is deprecated (used Compilation.fileDependencies instead)", + "DEP_WEBPACK_COMPILATION_COMPILATION_DEPENDENCIES" + ) + }; -/***/ 81184: -/***/ (function(module) { + this._modulesCache = this.getCache("Compilation/modules"); + this._assetsCache = this.getCache("Compilation/assets"); + this._codeGenerationCache = this.getCache("Compilation/codeGeneration"); -"use strict"; + const unsafeCache = options.module.unsafeCache; + this._unsafeCache = !!unsafeCache; + this._unsafeCachePredicate = + typeof unsafeCache === "function" ? unsafeCache : () => true; + } + getStats() { + return new Stats(this); + } -/** - * @typedef {[number, boolean]} RangeValue - */ + /** + * @param {StatsOptions | string} optionsOrPreset stats option value + * @param {CreateStatsOptionsContext} context context + * @returns {NormalizedStatsOptions} normalized options + */ + createStatsOptions(optionsOrPreset, context = {}) { + if ( + typeof optionsOrPreset === "boolean" || + typeof optionsOrPreset === "string" + ) { + optionsOrPreset = { preset: optionsOrPreset }; + } + if (typeof optionsOrPreset === "object" && optionsOrPreset !== null) { + // We use this method of shallow cloning this object to include + // properties in the prototype chain + /** @type {Partial} */ + const options = {}; + for (const key in optionsOrPreset) { + options[key] = optionsOrPreset[key]; + } + if (options.preset !== undefined) { + this.hooks.statsPreset.for(options.preset).call(options, context); + } + this.hooks.statsNormalize.call(options, context); + return /** @type {NormalizedStatsOptions} */ (options); + } else { + /** @type {Partial} */ + const options = {}; + this.hooks.statsNormalize.call(options, context); + return /** @type {NormalizedStatsOptions} */ (options); + } + } -/** - * @callback RangeValueCallback - * @param {RangeValue} rangeValue - * @returns {boolean} - */ -class Range { - /** - * @param {"left" | "right"} side - * @param {boolean} exclusive - * @returns {">" | ">=" | "<" | "<="} - */ - static getOperator(side, exclusive) { - if (side === "left") { - return exclusive ? ">" : ">="; - } + createStatsFactory(options) { + const statsFactory = new StatsFactory(); + this.hooks.statsFactory.call(statsFactory, options); + return statsFactory; + } - return exclusive ? "<" : "<="; - } - /** - * @param {number} value - * @param {boolean} logic is not logic applied - * @param {boolean} exclusive is range exclusive - * @returns {string} - */ + createStatsPrinter(options) { + const statsPrinter = new StatsPrinter(); + this.hooks.statsPrinter.call(statsPrinter, options); + return statsPrinter; + } + /** + * @param {string} name cache name + * @returns {CacheFacade} the cache facade instance + */ + getCache(name) { + return this.compiler.getCache(name); + } - static formatRight(value, logic, exclusive) { - if (logic === false) { - return Range.formatLeft(value, !logic, !exclusive); - } + /** + * @param {string | (function(): string)} name name of the logger, or function called once to get the logger name + * @returns {Logger} a logger with that name + */ + getLogger(name) { + if (!name) { + throw new TypeError("Compilation.getLogger(name) called without a name"); + } + /** @type {LogEntry[] | undefined} */ + let logEntries; + return new Logger( + (type, args) => { + if (typeof name === "function") { + name = name(); + if (!name) { + throw new TypeError( + "Compilation.getLogger(name) called with a function not returning a name" + ); + } + } + let trace; + switch (type) { + case LogType.warn: + case LogType.error: + case LogType.trace: + trace = ErrorHelpers.cutOffLoaderExecution(new Error("Trace").stack) + .split("\n") + .slice(3); + break; + } + /** @type {LogEntry} */ + const logEntry = { + time: Date.now(), + type, + args, + trace + }; + if (this.hooks.log.call(name, logEntry) === undefined) { + if (logEntry.type === LogType.profileEnd) { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + if (typeof console.profileEnd === "function") { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.profileEnd(`[${name}] ${logEntry.args[0]}`); + } + } + if (logEntries === undefined) { + logEntries = this.logging.get(name); + if (logEntries === undefined) { + logEntries = []; + this.logging.set(name, logEntries); + } + } + logEntries.push(logEntry); + if (logEntry.type === LogType.profile) { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + if (typeof console.profile === "function") { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.profile(`[${name}] ${logEntry.args[0]}`); + } + } + } + }, + childName => { + if (typeof name === "function") { + if (typeof childName === "function") { + return this.getLogger(() => { + if (typeof name === "function") { + name = name(); + if (!name) { + throw new TypeError( + "Compilation.getLogger(name) called with a function not returning a name" + ); + } + } + if (typeof childName === "function") { + childName = childName(); + if (!childName) { + throw new TypeError( + "Logger.getChildLogger(name) called with a function not returning a name" + ); + } + } + return `${name}/${childName}`; + }); + } else { + return this.getLogger(() => { + if (typeof name === "function") { + name = name(); + if (!name) { + throw new TypeError( + "Compilation.getLogger(name) called with a function not returning a name" + ); + } + } + return `${name}/${childName}`; + }); + } + } else { + if (typeof childName === "function") { + return this.getLogger(() => { + if (typeof childName === "function") { + childName = childName(); + if (!childName) { + throw new TypeError( + "Logger.getChildLogger(name) called with a function not returning a name" + ); + } + } + return `${name}/${childName}`; + }); + } else { + return this.getLogger(`${name}/${childName}`); + } + } + } + ); + } - return `should be ${Range.getOperator("right", exclusive)} ${value}`; - } - /** - * @param {number} value - * @param {boolean} logic is not logic applied - * @param {boolean} exclusive is range exclusive - * @returns {string} - */ + /** + * @param {Module} module module to be added that was created + * @param {ModuleCallback} callback returns the module in the compilation, + * it could be the passed one (if new), or an already existing in the compilation + * @returns {void} + */ + addModule(module, callback) { + this.addModuleQueue.add(module, callback); + } + /** + * @param {Module} module module to be added that was created + * @param {ModuleCallback} callback returns the module in the compilation, + * it could be the passed one (if new), or an already existing in the compilation + * @returns {void} + */ + _addModule(module, callback) { + const identifier = module.identifier(); + const alreadyAddedModule = this._modules.get(identifier); + if (alreadyAddedModule) { + return callback(null, alreadyAddedModule); + } - static formatLeft(value, logic, exclusive) { - if (logic === false) { - return Range.formatRight(value, !logic, !exclusive); - } + const currentProfile = this.profile + ? this.moduleGraph.getProfile(module) + : undefined; + if (currentProfile !== undefined) { + currentProfile.markRestoringStart(); + } - return `should be ${Range.getOperator("left", exclusive)} ${value}`; - } - /** - * @param {number} start left side value - * @param {number} end right side value - * @param {boolean} startExclusive is range exclusive from left side - * @param {boolean} endExclusive is range exclusive from right side - * @param {boolean} logic is not logic applied - * @returns {string} - */ + this._modulesCache.get(identifier, null, (err, cacheModule) => { + if (err) return callback(new ModuleRestoreError(module, err)); + if (currentProfile !== undefined) { + currentProfile.markRestoringEnd(); + currentProfile.markIntegrationStart(); + } - static formatRange(start, end, startExclusive, endExclusive, logic) { - let result = "should be"; - result += ` ${Range.getOperator(logic ? "left" : "right", logic ? startExclusive : !startExclusive)} ${start} `; - result += logic ? "and" : "or"; - result += ` ${Range.getOperator(logic ? "right" : "left", logic ? endExclusive : !endExclusive)} ${end}`; - return result; - } - /** - * @param {Array} values - * @param {boolean} logic is not logic applied - * @return {RangeValue} computed value and it's exclusive flag - */ + if (cacheModule) { + cacheModule.updateCacheModule(module); + module = cacheModule; + } + this._modules.set(identifier, module); + this.modules.add(module); + if (this._backCompat) + ModuleGraph.setModuleGraphForModule(module, this.moduleGraph); + if (currentProfile !== undefined) { + currentProfile.markIntegrationEnd(); + } + callback(null, module); + }); + } - static getRangeValue(values, logic) { - let minMax = logic ? Infinity : -Infinity; - let j = -1; - const predicate = logic ? - /** @type {RangeValueCallback} */ - ([value]) => value <= minMax : - /** @type {RangeValueCallback} */ - ([value]) => value >= minMax; + /** + * Fetches a module from a compilation by its identifier + * @param {Module} module the module provided + * @returns {Module} the module requested + */ + getModule(module) { + const identifier = module.identifier(); + return this._modules.get(identifier); + } - for (let i = 0; i < values.length; i++) { - if (predicate(values[i])) { - [minMax] = values[i]; - j = i; - } - } + /** + * Attempts to search for a module by its identifier + * @param {string} identifier identifier (usually path) for module + * @returns {Module|undefined} attempt to search for module and return it, else undefined + */ + findModule(identifier) { + return this._modules.get(identifier); + } - if (j > -1) { - return values[j]; - } + /** + * Schedules a build of the module object + * + * @param {Module} module module to be built + * @param {ModuleCallback} callback the callback + * @returns {void} + */ + buildModule(module, callback) { + this.buildQueue.add(module, callback); + } - return [Infinity, true]; - } - - constructor() { - /** @type {Array} */ - this._left = []; - /** @type {Array} */ - - this._right = []; - } - /** - * @param {number} value - * @param {boolean=} exclusive - */ - - - left(value, exclusive = false) { - this._left.push([value, exclusive]); - } - /** - * @param {number} value - * @param {boolean=} exclusive - */ - - - right(value, exclusive = false) { - this._right.push([value, exclusive]); - } - /** - * @param {boolean} logic is not logic applied - * @return {string} "smart" range string representation - */ + /** + * Builds the module object + * + * @param {Module} module module to be built + * @param {ModuleCallback} callback the callback + * @returns {void} + */ + _buildModule(module, callback) { + const currentProfile = this.profile + ? this.moduleGraph.getProfile(module) + : undefined; + if (currentProfile !== undefined) { + currentProfile.markBuildingStart(); + } + module.needBuild( + { + compilation: this, + fileSystemInfo: this.fileSystemInfo, + valueCacheVersions: this.valueCacheVersions + }, + (err, needBuild) => { + if (err) return callback(err); - format(logic = true) { - const [start, leftExclusive] = Range.getRangeValue(this._left, logic); - const [end, rightExclusive] = Range.getRangeValue(this._right, !logic); + if (!needBuild) { + if (currentProfile !== undefined) { + currentProfile.markBuildingEnd(); + } + this.hooks.stillValidModule.call(module); + return callback(); + } - if (!Number.isFinite(start) && !Number.isFinite(end)) { - return ""; - } + this.hooks.buildModule.call(module); + this.builtModules.add(module); + module.build( + this.options, + this, + this.resolverFactory.get("normal", module.resolveOptions), + this.inputFileSystem, + err => { + if (currentProfile !== undefined) { + currentProfile.markBuildingEnd(); + } + if (err) { + this.hooks.failedModule.call(module, err); + return callback(err); + } + if (currentProfile !== undefined) { + currentProfile.markStoringStart(); + } + this._modulesCache.store(module.identifier(), null, module, err => { + if (currentProfile !== undefined) { + currentProfile.markStoringEnd(); + } + if (err) { + this.hooks.failedModule.call(module, err); + return callback(new ModuleStoreError(module, err)); + } + this.hooks.succeedModule.call(module); + return callback(); + }); + } + ); + } + ); + } - const realStart = leftExclusive ? start + 1 : start; - const realEnd = rightExclusive ? end - 1 : end; // e.g. 5 < x < 7, 5 < x <= 6, 6 <= x <= 6 + /** + * @param {Module} module to be processed for deps + * @param {ModuleCallback} callback callback to be triggered + * @returns {void} + */ + processModuleDependencies(module, callback) { + this.processDependenciesQueue.add(module, callback); + } - if (realStart === realEnd) { - return `should be ${logic ? "" : "!"}= ${realStart}`; - } // e.g. 4 < x < ∞ + /** + * @param {Module} module to be processed for deps + * @returns {void} + */ + processModuleDependenciesNonRecursive(module) { + const processDependenciesBlock = block => { + if (block.dependencies) { + let i = 0; + for (const dep of block.dependencies) { + this.moduleGraph.setParents(dep, block, module, i++); + } + } + if (block.blocks) { + for (const b of block.blocks) processDependenciesBlock(b); + } + }; + processDependenciesBlock(module); + } - if (Number.isFinite(start) && !Number.isFinite(end)) { - return Range.formatLeft(start, logic, leftExclusive); - } // e.g. ∞ < x < 4 + /** + * @param {Module} module to be processed for deps + * @param {ModuleCallback} callback callback to be triggered + * @returns {void} + */ + _processModuleDependencies(module, callback) { + /** @type {Array<{factory: ModuleFactory, dependencies: Dependency[], originModule: Module|null}>} */ + const sortedDependencies = []; + /** @type {DependenciesBlock} */ + let currentBlock; - if (!Number.isFinite(start) && Number.isFinite(end)) { - return Range.formatRight(end, logic, rightExclusive); - } + /** @type {Map>} */ + let dependencies; + /** @type {DepConstructor} */ + let factoryCacheKey; + /** @type {ModuleFactory} */ + let factoryCacheKey2; + /** @type {Map} */ + let factoryCacheValue; + /** @type {string} */ + let listCacheKey1; + /** @type {string} */ + let listCacheKey2; + /** @type {Dependency[]} */ + let listCacheValue; - return Range.formatRange(start, end, leftExclusive, rightExclusive, logic); - } + let inProgressSorting = 1; + let inProgressTransitive = 1; -} + const onDependenciesSorted = err => { + if (err) return callback(err); -module.exports = Range; + // early exit without changing parallelism back and forth + if (sortedDependencies.length === 0 && inProgressTransitive === 1) { + return callback(); + } -/***/ }), + // This is nested so we need to allow one additional task + this.processDependenciesQueue.increaseParallelism(); -/***/ 79926: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + for (const item of sortedDependencies) { + inProgressTransitive++; + this.handleModuleCreation(item, err => { + // In V8, the Error objects keep a reference to the functions on the stack. These warnings & + // errors are created inside closures that keep a reference to the Compilation, so errors are + // leaking the Compilation object. + if (err && this.bail) { + if (inProgressTransitive <= 0) return; + inProgressTransitive = -1; + // eslint-disable-next-line no-self-assign + err.stack = err.stack; + onTransitiveTasksFinished(err); + return; + } + if (--inProgressTransitive === 0) onTransitiveTasksFinished(); + }); + } + if (--inProgressTransitive === 0) onTransitiveTasksFinished(); + }; -"use strict"; + const onTransitiveTasksFinished = err => { + if (err) return callback(err); + this.processDependenciesQueue.decreaseParallelism(); + return callback(); + }; -const Range = __webpack_require__(81184); -/** @typedef {import("../validate").Schema} Schema */ + /** + * @param {Dependency} dep dependency + * @param {number} index index in block + * @returns {void} + */ + const processDependency = (dep, index) => { + this.moduleGraph.setParents(dep, currentBlock, module, index); + if (this._unsafeCache) { + try { + const unsafeCachedModule = unsafeCacheDependencies.get(dep); + if (unsafeCachedModule === null) return; + if (unsafeCachedModule !== undefined) { + if ( + this._restoredUnsafeCacheModuleEntries.has(unsafeCachedModule) + ) { + this._handleExistingModuleFromUnsafeCache( + module, + dep, + unsafeCachedModule + ); + return; + } + const identifier = unsafeCachedModule.identifier(); + const cachedModule = + this._restoredUnsafeCacheEntries.get(identifier); + if (cachedModule !== undefined) { + // update unsafe cache to new module + unsafeCacheDependencies.set(dep, cachedModule); + this._handleExistingModuleFromUnsafeCache( + module, + dep, + cachedModule + ); + return; + } + inProgressSorting++; + this._modulesCache.get(identifier, null, (err, cachedModule) => { + if (err) { + if (inProgressSorting <= 0) return; + inProgressSorting = -1; + onDependenciesSorted(err); + return; + } + try { + if (!this._restoredUnsafeCacheEntries.has(identifier)) { + const data = unsafeCacheData.get(cachedModule); + if (data === undefined) { + processDependencyForResolving(dep); + if (--inProgressSorting === 0) onDependenciesSorted(); + return; + } + if (cachedModule !== unsafeCachedModule) { + unsafeCacheDependencies.set(dep, cachedModule); + } + cachedModule.restoreFromUnsafeCache( + data, + this.params.normalModuleFactory, + this.params + ); + this._restoredUnsafeCacheEntries.set( + identifier, + cachedModule + ); + this._restoredUnsafeCacheModuleEntries.add(cachedModule); + if (!this.modules.has(cachedModule)) { + inProgressTransitive++; + this._handleNewModuleFromUnsafeCache( + module, + dep, + cachedModule, + err => { + if (err) { + if (inProgressTransitive <= 0) return; + inProgressTransitive = -1; + onTransitiveTasksFinished(err); + } + if (--inProgressTransitive === 0) + return onTransitiveTasksFinished(); + } + ); + if (--inProgressSorting === 0) onDependenciesSorted(); + return; + } + } + if (unsafeCachedModule !== cachedModule) { + unsafeCacheDependencies.set(dep, cachedModule); + } + this._handleExistingModuleFromUnsafeCache( + module, + dep, + cachedModule + ); // a3 + } catch (err) { + if (inProgressSorting <= 0) return; + inProgressSorting = -1; + onDependenciesSorted(err); + return; + } + if (--inProgressSorting === 0) onDependenciesSorted(); + }); + return; + } + } catch (e) { + console.error(e); + } + } + processDependencyForResolving(dep); + }; -/** - * @param {Schema} schema - * @param {boolean} logic - * @return {string[]} - */ + /** + * @param {Dependency} dep dependency + * @returns {void} + */ + const processDependencyForResolving = dep => { + const resourceIdent = dep.getResourceIdentifier(); + if (resourceIdent !== undefined && resourceIdent !== null) { + const category = dep.category; + const constructor = /** @type {DepConstructor} */ (dep.constructor); + if (factoryCacheKey === constructor) { + // Fast path 1: same constructor as prev item + if (listCacheKey1 === category && listCacheKey2 === resourceIdent) { + // Super fast path 1: also same resource + listCacheValue.push(dep); + return; + } + } else { + const factory = this.dependencyFactories.get(constructor); + if (factory === undefined) { + throw new Error( + `No module factory available for dependency type: ${constructor.name}` + ); + } + if (factoryCacheKey2 === factory) { + // Fast path 2: same factory as prev item + factoryCacheKey = constructor; + if (listCacheKey1 === category && listCacheKey2 === resourceIdent) { + // Super fast path 2: also same resource + listCacheValue.push(dep); + return; + } + } else { + // Slow path + if (factoryCacheKey2 !== undefined) { + // Archive last cache entry + if (dependencies === undefined) dependencies = new Map(); + dependencies.set(factoryCacheKey2, factoryCacheValue); + factoryCacheValue = dependencies.get(factory); + if (factoryCacheValue === undefined) { + factoryCacheValue = new Map(); + } + } else { + factoryCacheValue = new Map(); + } + factoryCacheKey = constructor; + factoryCacheKey2 = factory; + } + } + // Here webpack is using heuristic that assumes + // mostly esm dependencies would be used + // so we don't allocate extra string for them + const cacheKey = + category === esmDependencyCategory + ? resourceIdent + : `${category}${resourceIdent}`; + let list = factoryCacheValue.get(cacheKey); + if (list === undefined) { + factoryCacheValue.set(cacheKey, (list = [])); + sortedDependencies.push({ + factory: factoryCacheKey2, + dependencies: list, + originModule: module + }); + } + list.push(dep); + listCacheKey1 = category; + listCacheKey2 = resourceIdent; + listCacheValue = list; + } + }; + try { + /** @type {DependenciesBlock[]} */ + const queue = [module]; + do { + const block = queue.pop(); + if (block.dependencies) { + currentBlock = block; + let i = 0; + for (const dep of block.dependencies) processDependency(dep, i++); + } + if (block.blocks) { + for (const b of block.blocks) queue.push(b); + } + } while (queue.length !== 0); + } catch (e) { + return callback(e); + } -module.exports.stringHints = function stringHints(schema, logic) { - const hints = []; - let type = "string"; - const currentSchema = { ...schema - }; + if (--inProgressSorting === 0) onDependenciesSorted(); + } - if (!logic) { - const tmpLength = currentSchema.minLength; - const tmpFormat = currentSchema.formatMinimum; - const tmpExclusive = currentSchema.formatExclusiveMaximum; - currentSchema.minLength = currentSchema.maxLength; - currentSchema.maxLength = tmpLength; - currentSchema.formatMinimum = currentSchema.formatMaximum; - currentSchema.formatMaximum = tmpFormat; - currentSchema.formatExclusiveMaximum = !currentSchema.formatExclusiveMinimum; - currentSchema.formatExclusiveMinimum = !tmpExclusive; - } + _handleNewModuleFromUnsafeCache(originModule, dependency, module, callback) { + const moduleGraph = this.moduleGraph; - if (typeof currentSchema.minLength === "number") { - if (currentSchema.minLength === 1) { - type = "non-empty string"; - } else { - const length = Math.max(currentSchema.minLength - 1, 0); - hints.push(`should be longer than ${length} character${length > 1 ? "s" : ""}`); - } - } + moduleGraph.setResolvedModule(originModule, dependency, module); - if (typeof currentSchema.maxLength === "number") { - if (currentSchema.maxLength === 0) { - type = "empty string"; - } else { - const length = currentSchema.maxLength + 1; - hints.push(`should be shorter than ${length} character${length > 1 ? "s" : ""}`); - } - } + moduleGraph.setIssuerIfUnset( + module, + originModule !== undefined ? originModule : null + ); - if (currentSchema.pattern) { - hints.push(`should${logic ? "" : " not"} match pattern ${JSON.stringify(currentSchema.pattern)}`); - } + this._modules.set(module.identifier(), module); + this.modules.add(module); + if (this._backCompat) + ModuleGraph.setModuleGraphForModule(module, this.moduleGraph); - if (currentSchema.format) { - hints.push(`should${logic ? "" : " not"} match format ${JSON.stringify(currentSchema.format)}`); - } + this._handleModuleBuildAndDependencies( + originModule, + module, + true, + callback + ); + } - if (currentSchema.formatMinimum) { - hints.push(`should be ${currentSchema.formatExclusiveMinimum ? ">" : ">="} ${JSON.stringify(currentSchema.formatMinimum)}`); - } + _handleExistingModuleFromUnsafeCache(originModule, dependency, module) { + const moduleGraph = this.moduleGraph; - if (currentSchema.formatMaximum) { - hints.push(`should be ${currentSchema.formatExclusiveMaximum ? "<" : "<="} ${JSON.stringify(currentSchema.formatMaximum)}`); - } + moduleGraph.setResolvedModule(originModule, dependency, module); + } - return [type].concat(hints); -}; -/** - * @param {Schema} schema - * @param {boolean} logic - * @return {string[]} - */ + /** + * @typedef {Object} HandleModuleCreationOptions + * @property {ModuleFactory} factory + * @property {Dependency[]} dependencies + * @property {Module | null} originModule + * @property {Partial=} contextInfo + * @property {string=} context + * @property {boolean=} recursive recurse into dependencies of the created module + * @property {boolean=} connectOrigin connect the resolved module with the origin module + */ + /** + * @param {HandleModuleCreationOptions} options options object + * @param {ModuleCallback} callback callback + * @returns {void} + */ + handleModuleCreation( + { + factory, + dependencies, + originModule, + contextInfo, + context, + recursive = true, + connectOrigin = recursive + }, + callback + ) { + const moduleGraph = this.moduleGraph; -module.exports.numberHints = function numberHints(schema, logic) { - const hints = [schema.type === "integer" ? "integer" : "number"]; - const range = new Range(); + const currentProfile = this.profile ? new ModuleProfile() : undefined; - if (typeof schema.minimum === "number") { - range.left(schema.minimum); - } - - if (typeof schema.exclusiveMinimum === "number") { - range.left(schema.exclusiveMinimum, true); - } - - if (typeof schema.maximum === "number") { - range.right(schema.maximum); - } - - if (typeof schema.exclusiveMaximum === "number") { - range.right(schema.exclusiveMaximum, true); - } - - const rangeFormat = range.format(logic); - - if (rangeFormat) { - hints.push(rangeFormat); - } - - if (typeof schema.multipleOf === "number") { - hints.push(`should${logic ? "" : " not"} be multiple of ${schema.multipleOf}`); - } - - return hints; -}; - -/***/ }), - -/***/ 18151: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const Hook = __webpack_require__(21468); -const HookCodeFactory = __webpack_require__(66443); - -class AsyncParallelBailHookCodeFactory extends HookCodeFactory { - content({ onError, onResult, onDone }) { - let code = ""; - code += `var _results = new Array(${this.options.taps.length});\n`; - code += "var _checkDone = function() {\n"; - code += "for(var i = 0; i < _results.length; i++) {\n"; - code += "var item = _results[i];\n"; - code += "if(item === undefined) return false;\n"; - code += "if(item.result !== undefined) {\n"; - code += onResult("item.result"); - code += "return true;\n"; - code += "}\n"; - code += "if(item.error) {\n"; - code += onError("item.error"); - code += "return true;\n"; - code += "}\n"; - code += "}\n"; - code += "return false;\n"; - code += "}\n"; - code += this.callTapsParallel({ - onError: (i, err, done, doneBreak) => { - let code = ""; - code += `if(${i} < _results.length && ((_results.length = ${i + - 1}), (_results[${i}] = { error: ${err} }), _checkDone())) {\n`; - code += doneBreak(true); - code += "} else {\n"; - code += done(); - code += "}\n"; - return code; - }, - onResult: (i, result, done, doneBreak) => { - let code = ""; - code += `if(${i} < _results.length && (${result} !== undefined && (_results.length = ${i + - 1}), (_results[${i}] = { result: ${result} }), _checkDone())) {\n`; - code += doneBreak(true); - code += "} else {\n"; - code += done(); - code += "}\n"; - return code; + this.factorizeModule( + { + currentProfile, + factory, + dependencies, + factoryResult: true, + originModule, + contextInfo, + context }, - onTap: (i, run, done, doneBreak) => { - let code = ""; - if (i > 0) { - code += `if(${i} >= _results.length) {\n`; - code += done(); - code += "} else {\n"; + (err, factoryResult) => { + const applyFactoryResultDependencies = () => { + const { fileDependencies, contextDependencies, missingDependencies } = + factoryResult; + if (fileDependencies) { + this.fileDependencies.addAll(fileDependencies); + } + if (contextDependencies) { + this.contextDependencies.addAll(contextDependencies); + } + if (missingDependencies) { + this.missingDependencies.addAll(missingDependencies); + } + }; + if (err) { + if (factoryResult) applyFactoryResultDependencies(); + if (dependencies.every(d => d.optional)) { + this.warnings.push(err); + return callback(); + } else { + this.errors.push(err); + return callback(err); + } } - code += run(); - if (i > 0) code += "}\n"; - return code; - }, - onDone - }); - return code; - } -} - -const factory = new AsyncParallelBailHookCodeFactory(); - -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; - -function AsyncParallelBailHook(args = [], name = undefined) { - const hook = new Hook(args, name); - hook.constructor = AsyncParallelBailHook; - hook.compile = COMPILE; - hook._call = undefined; - hook.call = undefined; - return hook; -} - -AsyncParallelBailHook.prototype = null; -module.exports = AsyncParallelBailHook; + const newModule = factoryResult.module; + if (!newModule) { + applyFactoryResultDependencies(); + return callback(); + } -/***/ }), + if (currentProfile !== undefined) { + moduleGraph.setProfile(newModule, currentProfile); + } -/***/ 31684: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + this.addModule(newModule, (err, module) => { + if (err) { + applyFactoryResultDependencies(); + if (!err.module) { + err.module = module; + } + this.errors.push(err); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + return callback(err); + } + if ( + this._unsafeCache && + factoryResult.cacheable !== false && + /** @type {any} */ (module).restoreFromUnsafeCache && + this._unsafeCachePredicate(module) + ) { + const unsafeCacheableModule = + /** @type {Module & { restoreFromUnsafeCache: Function }} */ ( + module + ); + for (let i = 0; i < dependencies.length; i++) { + const dependency = dependencies[i]; + moduleGraph.setResolvedModule( + connectOrigin ? originModule : null, + dependency, + unsafeCacheableModule + ); + unsafeCacheDependencies.set(dependency, unsafeCacheableModule); + } + if (!unsafeCacheData.has(unsafeCacheableModule)) { + unsafeCacheData.set( + unsafeCacheableModule, + unsafeCacheableModule.getUnsafeCacheData() + ); + } + } else { + applyFactoryResultDependencies(); + for (let i = 0; i < dependencies.length; i++) { + const dependency = dependencies[i]; + moduleGraph.setResolvedModule( + connectOrigin ? originModule : null, + dependency, + module + ); + } + } -const Hook = __webpack_require__(21468); -const HookCodeFactory = __webpack_require__(66443); + moduleGraph.setIssuerIfUnset( + module, + originModule !== undefined ? originModule : null + ); + if (module !== newModule) { + if (currentProfile !== undefined) { + const otherProfile = moduleGraph.getProfile(module); + if (otherProfile !== undefined) { + currentProfile.mergeInto(otherProfile); + } else { + moduleGraph.setProfile(module, currentProfile); + } + } + } -class AsyncParallelHookCodeFactory extends HookCodeFactory { - content({ onError, onDone }) { - return this.callTapsParallel({ - onError: (i, err, done, doneBreak) => onError(err) + doneBreak(true), - onDone - }); + this._handleModuleBuildAndDependencies( + originModule, + module, + recursive, + callback + ); + }); + } + ); } -} - -const factory = new AsyncParallelHookCodeFactory(); - -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; - -function AsyncParallelHook(args = [], name = undefined) { - const hook = new Hook(args, name); - hook.constructor = AsyncParallelHook; - hook.compile = COMPILE; - hook._call = undefined; - hook.call = undefined; - return hook; -} - -AsyncParallelHook.prototype = null; - -module.exports = AsyncParallelHook; + _handleModuleBuildAndDependencies(originModule, module, recursive, callback) { + // Check for cycles when build is trigger inside another build + let creatingModuleDuringBuildSet = undefined; + if (!recursive && this.buildQueue.isProcessing(originModule)) { + // Track build dependency + creatingModuleDuringBuildSet = + this.creatingModuleDuringBuild.get(originModule); + if (creatingModuleDuringBuildSet === undefined) { + creatingModuleDuringBuildSet = new Set(); + this.creatingModuleDuringBuild.set( + originModule, + creatingModuleDuringBuildSet + ); + } + creatingModuleDuringBuildSet.add(module); -/***/ }), + // When building is blocked by another module + // search for a cycle, cancel the cycle by throwing + // an error (otherwise this would deadlock) + const blockReasons = this.creatingModuleDuringBuild.get(module); + if (blockReasons !== undefined) { + const set = new Set(blockReasons); + for (const item of set) { + const blockReasons = this.creatingModuleDuringBuild.get(item); + if (blockReasons !== undefined) { + for (const m of blockReasons) { + if (m === module) { + return callback(new BuildCycleError(module)); + } + set.add(m); + } + } + } + } + } -/***/ 95734: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + this.buildModule(module, err => { + if (creatingModuleDuringBuildSet !== undefined) { + creatingModuleDuringBuildSet.delete(module); + } + if (err) { + if (!err.module) { + err.module = module; + } + this.errors.push(err); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + return callback(err); + } + if (!recursive) { + this.processModuleDependenciesNonRecursive(module); + callback(null, module); + return; + } -const Hook = __webpack_require__(21468); -const HookCodeFactory = __webpack_require__(66443); + // This avoids deadlocks for circular dependencies + if (this.processDependenciesQueue.isProcessing(module)) { + return callback(); + } -class AsyncSeriesBailHookCodeFactory extends HookCodeFactory { - content({ onError, onResult, resultReturns, onDone }) { - return this.callTapsSeries({ - onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), - onResult: (i, result, next) => - `if(${result} !== undefined) {\n${onResult( - result - )}\n} else {\n${next()}}\n`, - resultReturns, - onDone + this.processModuleDependencies(module, err => { + if (err) { + return callback(err); + } + callback(null, module); + }); }); } -} - -const factory = new AsyncSeriesBailHookCodeFactory(); -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; - -function AsyncSeriesBailHook(args = [], name = undefined) { - const hook = new Hook(args, name); - hook.constructor = AsyncSeriesBailHook; - hook.compile = COMPILE; - hook._call = undefined; - hook.call = undefined; - return hook; -} + /** + * @param {FactorizeModuleOptions} options options object + * @param {ModuleOrFactoryResultCallback} callback callback + * @returns {void} + */ + _factorizeModule( + { + currentProfile, + factory, + dependencies, + originModule, + factoryResult, + contextInfo, + context + }, + callback + ) { + if (currentProfile !== undefined) { + currentProfile.markFactoryStart(); + } + factory.create( + { + contextInfo: { + issuer: originModule ? originModule.nameForCondition() : "", + issuerLayer: originModule ? originModule.layer : null, + compiler: this.compiler.name, + ...contextInfo + }, + resolveOptions: originModule ? originModule.resolveOptions : undefined, + context: context + ? context + : originModule + ? originModule.context + : this.compiler.context, + dependencies: dependencies + }, + (err, result) => { + if (result) { + // TODO webpack 6: remove + // For backward-compat + if (result.module === undefined && result instanceof Module) { + result = { + module: result + }; + } + if (!factoryResult) { + const { + fileDependencies, + contextDependencies, + missingDependencies + } = result; + if (fileDependencies) { + this.fileDependencies.addAll(fileDependencies); + } + if (contextDependencies) { + this.contextDependencies.addAll(contextDependencies); + } + if (missingDependencies) { + this.missingDependencies.addAll(missingDependencies); + } + } + } + if (err) { + const notFoundError = new ModuleNotFoundError( + originModule, + err, + dependencies.map(d => d.loc).filter(Boolean)[0] + ); + return callback(notFoundError, factoryResult ? result : undefined); + } + if (!result) { + return callback(); + } -AsyncSeriesBailHook.prototype = null; + if (currentProfile !== undefined) { + currentProfile.markFactoryEnd(); + } -module.exports = AsyncSeriesBailHook; + callback(null, factoryResult ? result : result.module); + } + ); + } + /** + * @param {string} context context string path + * @param {Dependency} dependency dependency used to create Module chain + * @param {ModuleCallback} callback callback for when module chain is complete + * @returns {void} will throw if dependency instance is not a valid Dependency + */ + addModuleChain(context, dependency, callback) { + return this.addModuleTree({ context, dependency }, callback); + } -/***/ }), + /** + * @param {Object} options options + * @param {string} options.context context string path + * @param {Dependency} options.dependency dependency used to create Module chain + * @param {Partial=} options.contextInfo additional context info for the root module + * @param {ModuleCallback} callback callback for when module chain is complete + * @returns {void} will throw if dependency instance is not a valid Dependency + */ + addModuleTree({ context, dependency, contextInfo }, callback) { + if ( + typeof dependency !== "object" || + dependency === null || + !dependency.constructor + ) { + return callback( + new WebpackError("Parameter 'dependency' must be a Dependency") + ); + } + const Dep = /** @type {DepConstructor} */ (dependency.constructor); + const moduleFactory = this.dependencyFactories.get(Dep); + if (!moduleFactory) { + return callback( + new WebpackError( + `No dependency factory available for this dependency type: ${dependency.constructor.name}` + ) + ); + } -/***/ 96496: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + this.handleModuleCreation( + { + factory: moduleFactory, + dependencies: [dependency], + originModule: null, + contextInfo, + context + }, + (err, result) => { + if (err && this.bail) { + callback(err); + this.buildQueue.stop(); + this.rebuildQueue.stop(); + this.processDependenciesQueue.stop(); + this.factorizeQueue.stop(); + } else if (!err && result) { + callback(null, result); + } else { + callback(); + } + } + ); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {string} context context path for entry + * @param {Dependency} entry entry dependency that should be followed + * @param {string | EntryOptions} optionsOrName options or deprecated name of entry + * @param {ModuleCallback} callback callback function + * @returns {void} returns + */ + addEntry(context, entry, optionsOrName, callback) { + // TODO webpack 6 remove + const options = + typeof optionsOrName === "object" + ? optionsOrName + : { name: optionsOrName }; + this._addEntryItem(context, entry, "dependencies", options, callback); + } -const Hook = __webpack_require__(21468); -const HookCodeFactory = __webpack_require__(66443); - -class AsyncSeriesHookCodeFactory extends HookCodeFactory { - content({ onError, onDone }) { - return this.callTapsSeries({ - onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), - onDone - }); - } -} - -const factory = new AsyncSeriesHookCodeFactory(); - -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; - -function AsyncSeriesHook(args = [], name = undefined) { - const hook = new Hook(args, name); - hook.constructor = AsyncSeriesHook; - hook.compile = COMPILE; - hook._call = undefined; - hook.call = undefined; - return hook; -} - -AsyncSeriesHook.prototype = null; - -module.exports = AsyncSeriesHook; - - -/***/ }), - -/***/ 95999: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const Hook = __webpack_require__(21468); -const HookCodeFactory = __webpack_require__(66443); - -class AsyncSeriesLoopHookCodeFactory extends HookCodeFactory { - content({ onError, onDone }) { - return this.callTapsLooping({ - onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), - onDone - }); + /** + * @param {string} context context path for entry + * @param {Dependency} dependency dependency that should be followed + * @param {EntryOptions} options options + * @param {ModuleCallback} callback callback function + * @returns {void} returns + */ + addInclude(context, dependency, options, callback) { + this._addEntryItem( + context, + dependency, + "includeDependencies", + options, + callback + ); } -} - -const factory = new AsyncSeriesLoopHookCodeFactory(); - -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; - -function AsyncSeriesLoopHook(args = [], name = undefined) { - const hook = new Hook(args, name); - hook.constructor = AsyncSeriesLoopHook; - hook.compile = COMPILE; - hook._call = undefined; - hook.call = undefined; - return hook; -} - -AsyncSeriesLoopHook.prototype = null; - -module.exports = AsyncSeriesLoopHook; - - -/***/ }), - -/***/ 58118: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {string} context context path for entry + * @param {Dependency} entry entry dependency that should be followed + * @param {"dependencies" | "includeDependencies"} target type of entry + * @param {EntryOptions} options options + * @param {ModuleCallback} callback callback function + * @returns {void} returns + */ + _addEntryItem(context, entry, target, options, callback) { + const { name } = options; + let entryData = + name !== undefined ? this.entries.get(name) : this.globalEntry; + if (entryData === undefined) { + entryData = { + dependencies: [], + includeDependencies: [], + options: { + name: undefined, + ...options + } + }; + entryData[target].push(entry); + this.entries.set(name, entryData); + } else { + entryData[target].push(entry); + for (const key of Object.keys(options)) { + if (options[key] === undefined) continue; + if (entryData.options[key] === options[key]) continue; + if ( + Array.isArray(entryData.options[key]) && + Array.isArray(options[key]) && + arrayEquals(entryData.options[key], options[key]) + ) { + continue; + } + if (entryData.options[key] === undefined) { + entryData.options[key] = options[key]; + } else { + return callback( + new WebpackError( + `Conflicting entry option ${key} = ${entryData.options[key]} vs ${options[key]}` + ) + ); + } + } + } -const Hook = __webpack_require__(21468); -const HookCodeFactory = __webpack_require__(66443); + this.hooks.addEntry.call(entry, options); -class AsyncSeriesWaterfallHookCodeFactory extends HookCodeFactory { - content({ onError, onResult, onDone }) { - return this.callTapsSeries({ - onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), - onResult: (i, result, next) => { - let code = ""; - code += `if(${result} !== undefined) {\n`; - code += `${this._args[0]} = ${result};\n`; - code += `}\n`; - code += next(); - return code; + this.addModuleTree( + { + context, + dependency: entry, + contextInfo: entryData.options.layer + ? { issuerLayer: entryData.options.layer } + : undefined }, - onDone: () => onResult(this._args[0]) - }); + (err, module) => { + if (err) { + this.hooks.failedEntry.call(entry, options, err); + return callback(err); + } + this.hooks.succeedEntry.call(entry, options, module); + return callback(null, module); + } + ); } -} - -const factory = new AsyncSeriesWaterfallHookCodeFactory(); - -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; - -function AsyncSeriesWaterfallHook(args = [], name = undefined) { - if (args.length < 1) - throw new Error("Waterfall hooks must have at least one argument"); - const hook = new Hook(args, name); - hook.constructor = AsyncSeriesWaterfallHook; - hook.compile = COMPILE; - hook._call = undefined; - hook.call = undefined; - return hook; -} - -AsyncSeriesWaterfallHook.prototype = null; - -module.exports = AsyncSeriesWaterfallHook; - - -/***/ }), - -/***/ 21468: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const util = __webpack_require__(73837); - -const deprecateContext = util.deprecate(() => {}, -"Hook.context is deprecated and will be removed"); - -const CALL_DELEGATE = function(...args) { - this.call = this._createCall("sync"); - return this.call(...args); -}; -const CALL_ASYNC_DELEGATE = function(...args) { - this.callAsync = this._createCall("async"); - return this.callAsync(...args); -}; -const PROMISE_DELEGATE = function(...args) { - this.promise = this._createCall("promise"); - return this.promise(...args); -}; - -class Hook { - constructor(args = [], name = undefined) { - this._args = args; - this.name = name; - this.taps = []; - this.interceptors = []; - this._call = CALL_DELEGATE; - this.call = CALL_DELEGATE; - this._callAsync = CALL_ASYNC_DELEGATE; - this.callAsync = CALL_ASYNC_DELEGATE; - this._promise = PROMISE_DELEGATE; - this.promise = PROMISE_DELEGATE; - this._x = undefined; - this.compile = this.compile; - this.tap = this.tap; - this.tapAsync = this.tapAsync; - this.tapPromise = this.tapPromise; + /** + * @param {Module} module module to be rebuilt + * @param {ModuleCallback} callback callback when module finishes rebuilding + * @returns {void} + */ + rebuildModule(module, callback) { + this.rebuildQueue.add(module, callback); } - compile(options) { - throw new Error("Abstract: should be overridden"); - } + /** + * @param {Module} module module to be rebuilt + * @param {ModuleCallback} callback callback when module finishes rebuilding + * @returns {void} + */ + _rebuildModule(module, callback) { + this.hooks.rebuildModule.call(module); + const oldDependencies = module.dependencies.slice(); + const oldBlocks = module.blocks.slice(); + module.invalidateBuild(); + this.buildQueue.invalidate(module); + this.buildModule(module, err => { + if (err) { + return this.hooks.finishRebuildingModule.callAsync(module, err2 => { + if (err2) { + callback( + makeWebpackError(err2, "Compilation.hooks.finishRebuildingModule") + ); + return; + } + callback(err); + }); + } - _createCall(type) { - return this.compile({ - taps: this.taps, - interceptors: this.interceptors, - args: this._args, - type: type + this.processDependenciesQueue.invalidate(module); + this.moduleGraph.unfreeze(); + this.processModuleDependencies(module, err => { + if (err) return callback(err); + this.removeReasonsOfDependencyBlock(module, { + dependencies: oldDependencies, + blocks: oldBlocks + }); + this.hooks.finishRebuildingModule.callAsync(module, err2 => { + if (err2) { + callback( + makeWebpackError(err2, "Compilation.hooks.finishRebuildingModule") + ); + return; + } + callback(null, module); + }); + }); }); } - _tap(type, options, fn) { - if (typeof options === "string") { - options = { - name: options.trim() - }; - } else if (typeof options !== "object" || options === null) { - throw new Error("Invalid tap options"); - } - if (typeof options.name !== "string" || options.name === "") { - throw new Error("Missing name for tap"); - } - if (typeof options.context !== "undefined") { - deprecateContext(); + _computeAffectedModules(modules) { + const moduleMemCacheCache = this.compiler.moduleMemCaches; + if (!moduleMemCacheCache) return; + if (!this.moduleMemCaches) { + this.moduleMemCaches = new Map(); + this.moduleGraph.setModuleMemCaches(this.moduleMemCaches); } - options = Object.assign({ type, fn }, options); - options = this._runRegisterInterceptors(options); - this._insert(options); - } - - tap(options, fn) { - this._tap("sync", options, fn); - } + const { moduleGraph, moduleMemCaches } = this; + const affectedModules = new Set(); + const infectedModules = new Set(); + let statNew = 0; + let statChanged = 0; + let statUnchanged = 0; + let statReferencesChanged = 0; + let statWithoutBuild = 0; - tapAsync(options, fn) { - this._tap("async", options, fn); - } + const computeReferences = module => { + /** @type {WeakMap} */ + let references = undefined; + for (const connection of moduleGraph.getOutgoingConnections(module)) { + const d = connection.dependency; + const m = connection.module; + if (!d || !m || unsafeCacheDependencies.has(d)) continue; + if (references === undefined) references = new WeakMap(); + references.set(d, m); + } + return references; + }; - tapPromise(options, fn) { - this._tap("promise", options, fn); - } + /** + * @param {Module} module the module + * @param {WeakMap} references references + * @returns {boolean} true, when the references differ + */ + const compareReferences = (module, references) => { + if (references === undefined) return true; + for (const connection of moduleGraph.getOutgoingConnections(module)) { + const d = connection.dependency; + if (!d) continue; + const entry = references.get(d); + if (entry === undefined) continue; + if (entry !== connection.module) return false; + } + return true; + }; - _runRegisterInterceptors(options) { - for (const interceptor of this.interceptors) { - if (interceptor.register) { - const newOptions = interceptor.register(options); - if (newOptions !== undefined) { - options = newOptions; + const modulesWithoutCache = new Set(modules); + for (const [module, cachedMemCache] of moduleMemCacheCache) { + if (modulesWithoutCache.has(module)) { + const buildInfo = module.buildInfo; + if (buildInfo) { + if (cachedMemCache.buildInfo !== buildInfo) { + // use a new one + const memCache = new WeakTupleMap(); + moduleMemCaches.set(module, memCache); + affectedModules.add(module); + cachedMemCache.buildInfo = buildInfo; + cachedMemCache.references = computeReferences(module); + cachedMemCache.memCache = memCache; + statChanged++; + } else if (!compareReferences(module, cachedMemCache.references)) { + // use a new one + const memCache = new WeakTupleMap(); + moduleMemCaches.set(module, memCache); + affectedModules.add(module); + cachedMemCache.references = computeReferences(module); + cachedMemCache.memCache = memCache; + statReferencesChanged++; + } else { + // keep the old mem cache + moduleMemCaches.set(module, cachedMemCache.memCache); + statUnchanged++; + } + } else { + infectedModules.add(module); + moduleMemCacheCache.delete(module); + statWithoutBuild++; } + modulesWithoutCache.delete(module); + } else { + moduleMemCacheCache.delete(module); } } - return options; - } - withOptions(options) { - const mergeOptions = opt => - Object.assign({}, options, typeof opt === "string" ? { name: opt } : opt); + for (const module of modulesWithoutCache) { + const buildInfo = module.buildInfo; + if (buildInfo) { + // create a new entry + const memCache = new WeakTupleMap(); + moduleMemCacheCache.set(module, { + buildInfo, + references: computeReferences(module), + memCache + }); + moduleMemCaches.set(module, memCache); + affectedModules.add(module); + statNew++; + } else { + infectedModules.add(module); + statWithoutBuild++; + } + } - return { - name: this.name, - tap: (opt, fn) => this.tap(mergeOptions(opt), fn), - tapAsync: (opt, fn) => this.tapAsync(mergeOptions(opt), fn), - tapPromise: (opt, fn) => this.tapPromise(mergeOptions(opt), fn), - intercept: interceptor => this.intercept(interceptor), - isUsed: () => this.isUsed(), - withOptions: opt => this.withOptions(mergeOptions(opt)) + const reduceAffectType = connections => { + let affected = false; + for (const { dependency } of connections) { + if (!dependency) continue; + const type = dependency.couldAffectReferencingModule(); + if (type === Dependency.TRANSITIVE) return Dependency.TRANSITIVE; + if (type === false) continue; + affected = true; + } + return affected; }; - } - - isUsed() { - return this.taps.length > 0 || this.interceptors.length > 0; - } - - intercept(interceptor) { - this._resetCompilation(); - this.interceptors.push(Object.assign({}, interceptor)); - if (interceptor.register) { - for (let i = 0; i < this.taps.length; i++) { - this.taps[i] = interceptor.register(this.taps[i]); + const directOnlyInfectedModules = new Set(); + for (const module of infectedModules) { + for (const [ + referencingModule, + connections + ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { + if (!referencingModule) continue; + if (infectedModules.has(referencingModule)) continue; + const type = reduceAffectType(connections); + if (!type) continue; + if (type === true) { + directOnlyInfectedModules.add(referencingModule); + } else { + infectedModules.add(referencingModule); + } + } + } + for (const module of directOnlyInfectedModules) infectedModules.add(module); + const directOnlyAffectModules = new Set(); + for (const module of affectedModules) { + for (const [ + referencingModule, + connections + ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { + if (!referencingModule) continue; + if (infectedModules.has(referencingModule)) continue; + if (affectedModules.has(referencingModule)) continue; + const type = reduceAffectType(connections); + if (!type) continue; + if (type === true) { + directOnlyAffectModules.add(referencingModule); + } else { + affectedModules.add(referencingModule); + } + const memCache = new WeakTupleMap(); + const cache = moduleMemCacheCache.get(referencingModule); + cache.memCache = memCache; + moduleMemCaches.set(referencingModule, memCache); } } + for (const module of directOnlyAffectModules) affectedModules.add(module); + this.logger.log( + `${Math.round( + (100 * (affectedModules.size + infectedModules.size)) / + this.modules.size + )}% (${affectedModules.size} affected + ${ + infectedModules.size + } infected of ${ + this.modules.size + }) modules flagged as affected (${statNew} new modules, ${statChanged} changed, ${statReferencesChanged} references changed, ${statUnchanged} unchanged, ${statWithoutBuild} were not built)` + ); } - _resetCompilation() { - this.call = this._call; - this.callAsync = this._callAsync; - this.promise = this._promise; - } - - _insert(item) { - this._resetCompilation(); - let before; - if (typeof item.before === "string") { - before = new Set([item.before]); - } else if (Array.isArray(item.before)) { - before = new Set(item.before); - } - let stage = 0; - if (typeof item.stage === "number") { - stage = item.stage; - } - let i = this.taps.length; - while (i > 0) { - i--; - const x = this.taps[i]; - this.taps[i + 1] = x; - const xStage = x.stage || 0; - if (before) { - if (before.has(x.name)) { - before.delete(x.name); - continue; + _computeAffectedModulesWithChunkGraph() { + const { moduleMemCaches } = this; + if (!moduleMemCaches) return; + const moduleMemCaches2 = (this.moduleMemCaches2 = new Map()); + const { moduleGraph, chunkGraph } = this; + const key = "memCache2"; + let statUnchanged = 0; + let statChanged = 0; + let statNew = 0; + /** + * @param {Module} module module + * @returns {{ id: string | number, modules?: Map, blocks?: (string | number)[] }} references + */ + const computeReferences = module => { + const id = chunkGraph.getModuleId(module); + /** @type {Map} */ + let modules = undefined; + /** @type {(string | number)[] | undefined} */ + let blocks = undefined; + const outgoing = moduleGraph.getOutgoingConnectionsByModule(module); + if (outgoing !== undefined) { + for (const m of outgoing.keys()) { + if (!m) continue; + if (modules === undefined) modules = new Map(); + modules.set(m, chunkGraph.getModuleId(m)); } - if (before.size > 0) { - continue; + } + if (module.blocks.length > 0) { + blocks = []; + const queue = Array.from(module.blocks); + for (const block of queue) { + const chunkGroup = chunkGraph.getBlockChunkGroup(block); + if (chunkGroup) { + for (const chunk of chunkGroup.chunks) { + blocks.push(chunk.id); + } + } else { + blocks.push(null); + } + queue.push.apply(queue, block.blocks); } } - if (xStage > stage) { - continue; + return { id, modules, blocks }; + }; + /** + * @param {Module} module module + * @param {Object} references references + * @param {string | number} references.id id + * @param {Map=} references.modules modules + * @param {(string | number)[]=} references.blocks blocks + * @returns {boolean} ok? + */ + const compareReferences = (module, { id, modules, blocks }) => { + if (id !== chunkGraph.getModuleId(module)) return false; + if (modules !== undefined) { + for (const [module, id] of modules) { + if (chunkGraph.getModuleId(module) !== id) return false; + } } - i++; - break; - } - this.taps[i] = item; - } -} - -Object.setPrototypeOf(Hook.prototype, null); - -module.exports = Hook; - - -/***/ }), - -/***/ 66443: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (blocks !== undefined) { + const queue = Array.from(module.blocks); + let i = 0; + for (const block of queue) { + const chunkGroup = chunkGraph.getBlockChunkGroup(block); + if (chunkGroup) { + for (const chunk of chunkGroup.chunks) { + if (i >= blocks.length || blocks[i++] !== chunk.id) return false; + } + } else { + if (i >= blocks.length || blocks[i++] !== null) return false; + } + queue.push.apply(queue, block.blocks); + } + if (i !== blocks.length) return false; + } + return true; + }; + for (const [module, memCache] of moduleMemCaches) { + /** @type {{ references: { id: string | number, modules?: Map, blocks?: (string | number)[]}, memCache: WeakTupleMap }} */ + const cache = memCache.get(key); + if (cache === undefined) { + const memCache2 = new WeakTupleMap(); + memCache.set(key, { + references: computeReferences(module), + memCache: memCache2 + }); + moduleMemCaches2.set(module, memCache2); + statNew++; + } else if (!compareReferences(module, cache.references)) { + const memCache = new WeakTupleMap(); + cache.references = computeReferences(module); + cache.memCache = memCache; + moduleMemCaches2.set(module, memCache); + statChanged++; + } else { + moduleMemCaches2.set(module, cache.memCache); + statUnchanged++; + } + } -class HookCodeFactory { - constructor(config) { - this.config = config; - this.options = undefined; - this._args = undefined; + this.logger.log( + `${Math.round( + (100 * statChanged) / (statNew + statChanged + statUnchanged) + )}% modules flagged as affected by chunk graph (${statNew} new modules, ${statChanged} changed, ${statUnchanged} unchanged)` + ); } - create(options) { - this.init(options); - let fn; - switch (this.options.type) { - case "sync": - fn = new Function( - this.args(), - '"use strict";\n' + - this.header() + - this.contentWithInterceptors({ - onError: err => `throw ${err};\n`, - onResult: result => `return ${result};\n`, - resultReturns: true, - onDone: () => "", - rethrowIfPossible: true - }) + finish(callback) { + this.factorizeQueue.clear(); + if (this.profile) { + this.logger.time("finish module profiles"); + const ParallelismFactorCalculator = __webpack_require__(50780); + const p = new ParallelismFactorCalculator(); + const moduleGraph = this.moduleGraph; + const modulesWithProfiles = new Map(); + for (const module of this.modules) { + const profile = moduleGraph.getProfile(module); + if (!profile) continue; + modulesWithProfiles.set(module, profile); + p.range( + profile.buildingStartTime, + profile.buildingEndTime, + f => (profile.buildingParallelismFactor = f) ); - break; - case "async": - fn = new Function( - this.args({ - after: "_callback" - }), - '"use strict";\n' + - this.header() + - this.contentWithInterceptors({ - onError: err => `_callback(${err});\n`, - onResult: result => `_callback(null, ${result});\n`, - onDone: () => "_callback();\n" - }) + p.range( + profile.factoryStartTime, + profile.factoryEndTime, + f => (profile.factoryParallelismFactor = f) ); - break; - case "promise": - let errorHelperUsed = false; - const content = this.contentWithInterceptors({ - onError: err => { - errorHelperUsed = true; - return `_error(${err});\n`; - }, - onResult: result => `_resolve(${result});\n`, - onDone: () => "_resolve();\n" - }); - let code = ""; - code += '"use strict";\n'; - code += this.header(); - code += "return new Promise((function(_resolve, _reject) {\n"; - if (errorHelperUsed) { - code += "var _sync = true;\n"; - code += "function _error(_err) {\n"; - code += "if(_sync)\n"; - code += - "_resolve(Promise.resolve().then((function() { throw _err; })));\n"; - code += "else\n"; - code += "_reject(_err);\n"; - code += "};\n"; + p.range( + profile.integrationStartTime, + profile.integrationEndTime, + f => (profile.integrationParallelismFactor = f) + ); + p.range( + profile.storingStartTime, + profile.storingEndTime, + f => (profile.storingParallelismFactor = f) + ); + p.range( + profile.restoringStartTime, + profile.restoringEndTime, + f => (profile.restoringParallelismFactor = f) + ); + if (profile.additionalFactoryTimes) { + for (const { start, end } of profile.additionalFactoryTimes) { + const influence = (end - start) / profile.additionalFactories; + p.range( + start, + end, + f => + (profile.additionalFactoriesParallelismFactor += f * influence) + ); + } } - code += content; - if (errorHelperUsed) { - code += "_sync = false;\n"; + } + p.calculate(); + + const logger = this.getLogger("webpack.Compilation.ModuleProfile"); + const logByValue = (value, msg) => { + if (value > 1000) { + logger.error(msg); + } else if (value > 500) { + logger.warn(msg); + } else if (value > 200) { + logger.info(msg); + } else if (value > 30) { + logger.log(msg); + } else { + logger.debug(msg); } - code += "}));\n"; - fn = new Function(this.args(), code); - break; + }; + const logNormalSummary = (category, getDuration, getParallelism) => { + let sum = 0; + let max = 0; + for (const [module, profile] of modulesWithProfiles) { + const p = getParallelism(profile); + const d = getDuration(profile); + if (d === 0 || p === 0) continue; + const t = d / p; + sum += t; + if (t <= 10) continue; + logByValue( + t, + ` | ${Math.round(t)} ms${ + p >= 1.1 ? ` (parallelism ${Math.round(p * 10) / 10})` : "" + } ${category} > ${module.readableIdentifier(this.requestShortener)}` + ); + max = Math.max(max, t); + } + if (sum <= 10) return; + logByValue( + Math.max(sum / 10, max), + `${Math.round(sum)} ms ${category}` + ); + }; + const logByLoadersSummary = (category, getDuration, getParallelism) => { + const map = new Map(); + for (const [module, profile] of modulesWithProfiles) { + const list = provide( + map, + module.type + "!" + module.identifier().replace(/(!|^)[^!]*$/, ""), + () => [] + ); + list.push({ module, profile }); + } + + let sum = 0; + let max = 0; + for (const [key, modules] of map) { + let innerSum = 0; + let innerMax = 0; + for (const { module, profile } of modules) { + const p = getParallelism(profile); + const d = getDuration(profile); + if (d === 0 || p === 0) continue; + const t = d / p; + innerSum += t; + if (t <= 10) continue; + logByValue( + t, + ` | | ${Math.round(t)} ms${ + p >= 1.1 ? ` (parallelism ${Math.round(p * 10) / 10})` : "" + } ${category} > ${module.readableIdentifier( + this.requestShortener + )}` + ); + innerMax = Math.max(innerMax, t); + } + sum += innerSum; + if (innerSum <= 10) continue; + const idx = key.indexOf("!"); + const loaders = key.slice(idx + 1); + const moduleType = key.slice(0, idx); + const t = Math.max(innerSum / 10, innerMax); + logByValue( + t, + ` | ${Math.round(innerSum)} ms ${category} > ${ + loaders + ? `${ + modules.length + } x ${moduleType} with ${this.requestShortener.shorten( + loaders + )}` + : `${modules.length} x ${moduleType}` + }` + ); + max = Math.max(max, t); + } + if (sum <= 10) return; + logByValue( + Math.max(sum / 10, max), + `${Math.round(sum)} ms ${category}` + ); + }; + logNormalSummary( + "resolve to new modules", + p => p.factory, + p => p.factoryParallelismFactor + ); + logNormalSummary( + "resolve to existing modules", + p => p.additionalFactories, + p => p.additionalFactoriesParallelismFactor + ); + logNormalSummary( + "integrate modules", + p => p.restoring, + p => p.restoringParallelismFactor + ); + logByLoadersSummary( + "build modules", + p => p.building, + p => p.buildingParallelismFactor + ); + logNormalSummary( + "store modules", + p => p.storing, + p => p.storingParallelismFactor + ); + logNormalSummary( + "restore modules", + p => p.restoring, + p => p.restoringParallelismFactor + ); + this.logger.timeEnd("finish module profiles"); } - this.deinit(); - return fn; + this.logger.time("compute affected modules"); + this._computeAffectedModules(this.modules); + this.logger.timeEnd("compute affected modules"); + this.logger.time("finish modules"); + const { modules, moduleMemCaches } = this; + this.hooks.finishModules.callAsync(modules, err => { + this.logger.timeEnd("finish modules"); + if (err) return callback(err); + + // extract warnings and errors from modules + this.moduleGraph.freeze("dependency errors"); + // TODO keep a cacheToken (= {}) for each module in the graph + // create a new one per compilation and flag all updated files + // and parents with it + this.logger.time("report dependency errors and warnings"); + for (const module of modules) { + // TODO only run for modules with changed cacheToken + // global WeakMap> to keep modules without errors/warnings + const memCache = moduleMemCaches && moduleMemCaches.get(module); + if (memCache && memCache.get("noWarningsOrErrors")) continue; + let hasProblems = this.reportDependencyErrorsAndWarnings(module, [ + module + ]); + const errors = module.getErrors(); + if (errors !== undefined) { + for (const error of errors) { + if (!error.module) { + error.module = module; + } + this.errors.push(error); + hasProblems = true; + } + } + const warnings = module.getWarnings(); + if (warnings !== undefined) { + for (const warning of warnings) { + if (!warning.module) { + warning.module = module; + } + this.warnings.push(warning); + hasProblems = true; + } + } + if (!hasProblems && memCache) memCache.set("noWarningsOrErrors", true); + } + this.moduleGraph.unfreeze(); + this.logger.timeEnd("report dependency errors and warnings"); + + callback(); + }); } - setup(instance, options) { - instance._x = options.taps.map(t => t.fn); + unseal() { + this.hooks.unseal.call(); + this.chunks.clear(); + this.chunkGroups.length = 0; + this.namedChunks.clear(); + this.namedChunkGroups.clear(); + this.entrypoints.clear(); + this.additionalChunkAssets.length = 0; + this.assets = {}; + this.assetsInfo.clear(); + this.moduleGraph.removeAllModuleAttributes(); + this.moduleGraph.unfreeze(); + this.moduleMemCaches2 = undefined; } /** - * @param {{ type: "sync" | "promise" | "async", taps: Array, interceptors: Array }} options + * @param {Callback} callback signals when the call finishes + * @returns {void} */ - init(options) { - this.options = options; - this._args = options.args.slice(); - } - - deinit() { - this.options = undefined; - this._args = undefined; - } + seal(callback) { + const finalCallback = err => { + this.factorizeQueue.clear(); + this.buildQueue.clear(); + this.rebuildQueue.clear(); + this.processDependenciesQueue.clear(); + this.addModuleQueue.clear(); + return callback(err); + }; + const chunkGraph = new ChunkGraph( + this.moduleGraph, + this.outputOptions.hashFunction + ); + this.chunkGraph = chunkGraph; - contentWithInterceptors(options) { - if (this.options.interceptors.length > 0) { - const onError = options.onError; - const onResult = options.onResult; - const onDone = options.onDone; - let code = ""; - for (let i = 0; i < this.options.interceptors.length; i++) { - const interceptor = this.options.interceptors[i]; - if (interceptor.call) { - code += `${this.getInterceptor(i)}.call(${this.args({ - before: interceptor.context ? "_context" : undefined - })});\n`; - } + if (this._backCompat) { + for (const module of this.modules) { + ChunkGraph.setChunkGraphForModule(module, chunkGraph); } - code += this.content( - Object.assign(options, { - onError: - onError && - (err => { - let code = ""; - for (let i = 0; i < this.options.interceptors.length; i++) { - const interceptor = this.options.interceptors[i]; - if (interceptor.error) { - code += `${this.getInterceptor(i)}.error(${err});\n`; - } - } - code += onError(err); - return code; - }), - onResult: - onResult && - (result => { - let code = ""; - for (let i = 0; i < this.options.interceptors.length; i++) { - const interceptor = this.options.interceptors[i]; - if (interceptor.result) { - code += `${this.getInterceptor(i)}.result(${result});\n`; - } - } - code += onResult(result); - return code; - }), - onDone: - onDone && - (() => { - let code = ""; - for (let i = 0; i < this.options.interceptors.length; i++) { - const interceptor = this.options.interceptors[i]; - if (interceptor.done) { - code += `${this.getInterceptor(i)}.done();\n`; - } - } - code += onDone(); - return code; - }) - }) - ); - return code; - } else { - return this.content(options); } - } - header() { - let code = ""; - if (this.needContext()) { - code += "var _context = {};\n"; - } else { - code += "var _context;\n"; - } - code += "var _x = this._x;\n"; - if (this.options.interceptors.length > 0) { - code += "var _taps = this.taps;\n"; - code += "var _interceptors = this.interceptors;\n"; + this.hooks.seal.call(); + + this.logger.time("optimize dependencies"); + while (this.hooks.optimizeDependencies.call(this.modules)) { + /* empty */ } - return code; - } + this.hooks.afterOptimizeDependencies.call(this.modules); + this.logger.timeEnd("optimize dependencies"); - needContext() { - for (const tap of this.options.taps) if (tap.context) return true; - return false; - } + this.logger.time("create chunks"); + this.hooks.beforeChunks.call(); + this.moduleGraph.freeze("seal"); + /** @type {Map} */ + const chunkGraphInit = new Map(); + for (const [name, { dependencies, includeDependencies, options }] of this + .entries) { + const chunk = this.addChunk(name); + if (options.filename) { + chunk.filenameTemplate = options.filename; + } + const entrypoint = new Entrypoint(options); + if (!options.dependOn && !options.runtime) { + entrypoint.setRuntimeChunk(chunk); + } + entrypoint.setEntrypointChunk(chunk); + this.namedChunkGroups.set(name, entrypoint); + this.entrypoints.set(name, entrypoint); + this.chunkGroups.push(entrypoint); + connectChunkGroupAndChunk(entrypoint, chunk); - callTap(tapIndex, { onError, onResult, onDone, rethrowIfPossible }) { - let code = ""; - let hasTapCached = false; - for (let i = 0; i < this.options.interceptors.length; i++) { - const interceptor = this.options.interceptors[i]; - if (interceptor.tap) { - if (!hasTapCached) { - code += `var _tap${tapIndex} = ${this.getTap(tapIndex)};\n`; - hasTapCached = true; + const entryModules = new Set(); + for (const dep of [...this.globalEntry.dependencies, ...dependencies]) { + entrypoint.addOrigin(null, { name }, /** @type {any} */ (dep).request); + + const module = this.moduleGraph.getModule(dep); + if (module) { + chunkGraph.connectChunkAndEntryModule(chunk, module, entrypoint); + entryModules.add(module); + const modulesList = chunkGraphInit.get(entrypoint); + if (modulesList === undefined) { + chunkGraphInit.set(entrypoint, [module]); + } else { + modulesList.push(module); + } } - code += `${this.getInterceptor(i)}.tap(${ - interceptor.context ? "_context, " : "" - }_tap${tapIndex});\n`; + } + + this.assignDepths(entryModules); + + const mapAndSort = deps => + deps + .map(dep => this.moduleGraph.getModule(dep)) + .filter(Boolean) + .sort(compareModulesByIdentifier); + const includedModules = [ + ...mapAndSort(this.globalEntry.includeDependencies), + ...mapAndSort(includeDependencies) + ]; + + let modulesList = chunkGraphInit.get(entrypoint); + if (modulesList === undefined) { + chunkGraphInit.set(entrypoint, (modulesList = [])); + } + for (const module of includedModules) { + this.assignDepth(module); + modulesList.push(module); } } - code += `var _fn${tapIndex} = ${this.getTapFn(tapIndex)};\n`; - const tap = this.options.taps[tapIndex]; - switch (tap.type) { - case "sync": - if (!rethrowIfPossible) { - code += `var _hasError${tapIndex} = false;\n`; - code += "try {\n"; - } - if (onResult) { - code += `var _result${tapIndex} = _fn${tapIndex}(${this.args({ - before: tap.context ? "_context" : undefined - })});\n`; - } else { - code += `_fn${tapIndex}(${this.args({ - before: tap.context ? "_context" : undefined - })});\n`; - } - if (!rethrowIfPossible) { - code += "} catch(_err) {\n"; - code += `_hasError${tapIndex} = true;\n`; - code += onError("_err"); - code += "}\n"; - code += `if(!_hasError${tapIndex}) {\n`; - } - if (onResult) { - code += onResult(`_result${tapIndex}`); - } - if (onDone) { - code += onDone(); - } - if (!rethrowIfPossible) { - code += "}\n"; - } - break; - case "async": - let cbCode = ""; - if (onResult) - cbCode += `(function(_err${tapIndex}, _result${tapIndex}) {\n`; - else cbCode += `(function(_err${tapIndex}) {\n`; - cbCode += `if(_err${tapIndex}) {\n`; - cbCode += onError(`_err${tapIndex}`); - cbCode += "} else {\n"; - if (onResult) { - cbCode += onResult(`_result${tapIndex}`); - } - if (onDone) { - cbCode += onDone(); + const runtimeChunks = new Set(); + outer: for (const [ + name, + { + options: { dependOn, runtime } + } + ] of this.entries) { + if (dependOn && runtime) { + const err = + new WebpackError(`Entrypoint '${name}' has 'dependOn' and 'runtime' specified. This is not valid. +Entrypoints that depend on other entrypoints do not have their own runtime. +They will use the runtime(s) from referenced entrypoints instead. +Remove the 'runtime' option from the entrypoint.`); + const entry = this.entrypoints.get(name); + err.chunk = entry.getEntrypointChunk(); + this.errors.push(err); + } + if (dependOn) { + const entry = this.entrypoints.get(name); + const referencedChunks = entry + .getEntrypointChunk() + .getAllReferencedChunks(); + const dependOnEntries = []; + for (const dep of dependOn) { + const dependency = this.entrypoints.get(dep); + if (!dependency) { + throw new Error( + `Entry ${name} depends on ${dep}, but this entry was not found` + ); + } + if (referencedChunks.has(dependency.getEntrypointChunk())) { + const err = new WebpackError( + `Entrypoints '${name}' and '${dep}' use 'dependOn' to depend on each other in a circular way.` + ); + const entryChunk = entry.getEntrypointChunk(); + err.chunk = entryChunk; + this.errors.push(err); + entry.setRuntimeChunk(entryChunk); + continue outer; + } + dependOnEntries.push(dependency); } - cbCode += "}\n"; - cbCode += "})"; - code += `_fn${tapIndex}(${this.args({ - before: tap.context ? "_context" : undefined, - after: cbCode - })});\n`; - break; - case "promise": - code += `var _hasResult${tapIndex} = false;\n`; - code += `var _promise${tapIndex} = _fn${tapIndex}(${this.args({ - before: tap.context ? "_context" : undefined - })});\n`; - code += `if (!_promise${tapIndex} || !_promise${tapIndex}.then)\n`; - code += ` throw new Error('Tap function (tapPromise) did not return promise (returned ' + _promise${tapIndex} + ')');\n`; - code += `_promise${tapIndex}.then((function(_result${tapIndex}) {\n`; - code += `_hasResult${tapIndex} = true;\n`; - if (onResult) { - code += onResult(`_result${tapIndex}`); + for (const dependency of dependOnEntries) { + connectChunkGroupParentAndChild(dependency, entry); } - if (onDone) { - code += onDone(); + } else if (runtime) { + const entry = this.entrypoints.get(name); + let chunk = this.namedChunks.get(runtime); + if (chunk) { + if (!runtimeChunks.has(chunk)) { + const err = + new WebpackError(`Entrypoint '${name}' has a 'runtime' option which points to another entrypoint named '${runtime}'. +It's not valid to use other entrypoints as runtime chunk. +Did you mean to use 'dependOn: ${JSON.stringify( + runtime + )}' instead to allow using entrypoint '${name}' within the runtime of entrypoint '${runtime}'? For this '${runtime}' must always be loaded when '${name}' is used. +Or do you want to use the entrypoints '${name}' and '${runtime}' independently on the same page with a shared runtime? In this case give them both the same value for the 'runtime' option. It must be a name not already used by an entrypoint.`); + const entryChunk = entry.getEntrypointChunk(); + err.chunk = entryChunk; + this.errors.push(err); + entry.setRuntimeChunk(entryChunk); + continue; + } + } else { + chunk = this.addChunk(runtime); + chunk.preventIntegration = true; + runtimeChunks.add(chunk); } - code += `}), function(_err${tapIndex}) {\n`; - code += `if(_hasResult${tapIndex}) throw _err${tapIndex};\n`; - code += onError(`_err${tapIndex}`); - code += "});\n"; - break; - } - return code; - } - - callTapsSeries({ - onError, - onResult, - resultReturns, - onDone, - doneReturns, - rethrowIfPossible - }) { - if (this.options.taps.length === 0) return onDone(); - const firstAsync = this.options.taps.findIndex(t => t.type !== "sync"); - const somethingReturns = resultReturns || doneReturns; - let code = ""; - let current = onDone; - let unrollCounter = 0; - for (let j = this.options.taps.length - 1; j >= 0; j--) { - const i = j; - const unroll = - current !== onDone && - (this.options.taps[i].type !== "sync" || unrollCounter++ > 20); - if (unroll) { - unrollCounter = 0; - code += `function _next${i}() {\n`; - code += current(); - code += `}\n`; - current = () => `${somethingReturns ? "return " : ""}_next${i}();\n`; + entry.unshiftChunk(chunk); + chunk.addGroup(entry); + entry.setRuntimeChunk(chunk); } - const done = current; - const doneBreak = skipDone => { - if (skipDone) return ""; - return onDone(); - }; - const content = this.callTap(i, { - onError: error => onError(i, error, done, doneBreak), - onResult: - onResult && - (result => { - return onResult(i, result, done, doneBreak); - }), - onDone: !onResult && done, - rethrowIfPossible: - rethrowIfPossible && (firstAsync < 0 || i < firstAsync) - }); - current = () => content; } - code += current(); - return code; - } + buildChunkGraph(this, chunkGraphInit); + this.hooks.afterChunks.call(this.chunks); + this.logger.timeEnd("create chunks"); - callTapsLooping({ onError, onDone, rethrowIfPossible }) { - if (this.options.taps.length === 0) return onDone(); - const syncOnly = this.options.taps.every(t => t.type === "sync"); - let code = ""; - if (!syncOnly) { - code += "var _looper = (function() {\n"; - code += "var _loopAsync = false;\n"; - } - code += "var _loop;\n"; - code += "do {\n"; - code += "_loop = false;\n"; - for (let i = 0; i < this.options.interceptors.length; i++) { - const interceptor = this.options.interceptors[i]; - if (interceptor.loop) { - code += `${this.getInterceptor(i)}.loop(${this.args({ - before: interceptor.context ? "_context" : undefined - })});\n`; - } - } - code += this.callTapsSeries({ - onError, - onResult: (i, result, next, doneBreak) => { - let code = ""; - code += `if(${result} !== undefined) {\n`; - code += "_loop = true;\n"; - if (!syncOnly) code += "if(_loopAsync) _looper();\n"; - code += doneBreak(true); - code += `} else {\n`; - code += next(); - code += `}\n`; - return code; - }, - onDone: - onDone && - (() => { - let code = ""; - code += "if(!_loop) {\n"; - code += onDone(); - code += "}\n"; - return code; - }), - rethrowIfPossible: rethrowIfPossible && syncOnly - }); - code += "} while(_loop);\n"; - if (!syncOnly) { - code += "_loopAsync = true;\n"; - code += "});\n"; - code += "_looper();\n"; - } - return code; - } + this.logger.time("optimize"); + this.hooks.optimize.call(); - callTapsParallel({ - onError, - onResult, - onDone, - rethrowIfPossible, - onTap = (i, run) => run() - }) { - if (this.options.taps.length <= 1) { - return this.callTapsSeries({ - onError, - onResult, - onDone, - rethrowIfPossible - }); - } - let code = ""; - code += "do {\n"; - code += `var _counter = ${this.options.taps.length};\n`; - if (onDone) { - code += "var _done = (function() {\n"; - code += onDone(); - code += "});\n"; - } - for (let i = 0; i < this.options.taps.length; i++) { - const done = () => { - if (onDone) return "if(--_counter === 0) _done();\n"; - else return "--_counter;"; - }; - const doneBreak = skipDone => { - if (skipDone || !onDone) return "_counter = 0;\n"; - else return "_counter = 0;\n_done();\n"; - }; - code += "if(_counter <= 0) break;\n"; - code += onTap( - i, - () => - this.callTap(i, { - onError: error => { - let code = ""; - code += "if(_counter > 0) {\n"; - code += onError(i, error, done, doneBreak); - code += "}\n"; - return code; - }, - onResult: - onResult && - (result => { - let code = ""; - code += "if(_counter > 0) {\n"; - code += onResult(i, result, done, doneBreak); - code += "}\n"; - return code; - }), - onDone: - !onResult && - (() => { - return done(); - }), - rethrowIfPossible - }), - done, - doneBreak - ); + while (this.hooks.optimizeModules.call(this.modules)) { + /* empty */ } - code += "} while(false);\n"; - return code; - } + this.hooks.afterOptimizeModules.call(this.modules); - args({ before, after } = {}) { - let allArgs = this._args; - if (before) allArgs = [before].concat(allArgs); - if (after) allArgs = allArgs.concat(after); - if (allArgs.length === 0) { - return ""; - } else { - return allArgs.join(", "); + while (this.hooks.optimizeChunks.call(this.chunks, this.chunkGroups)) { + /* empty */ } - } + this.hooks.afterOptimizeChunks.call(this.chunks, this.chunkGroups); - getTapFn(idx) { - return `_x[${idx}]`; - } + this.hooks.optimizeTree.callAsync(this.chunks, this.modules, err => { + if (err) { + return finalCallback( + makeWebpackError(err, "Compilation.hooks.optimizeTree") + ); + } - getTap(idx) { - return `_taps[${idx}]`; - } + this.hooks.afterOptimizeTree.call(this.chunks, this.modules); - getInterceptor(idx) { - return `_interceptors[${idx}]`; - } -} + this.hooks.optimizeChunkModules.callAsync( + this.chunks, + this.modules, + err => { + if (err) { + return finalCallback( + makeWebpackError(err, "Compilation.hooks.optimizeChunkModules") + ); + } -module.exports = HookCodeFactory; + this.hooks.afterOptimizeChunkModules.call(this.chunks, this.modules); + const shouldRecord = this.hooks.shouldRecord.call() !== false; -/***/ }), + this.hooks.reviveModules.call(this.modules, this.records); + this.hooks.beforeModuleIds.call(this.modules); + this.hooks.moduleIds.call(this.modules); + this.hooks.optimizeModuleIds.call(this.modules); + this.hooks.afterOptimizeModuleIds.call(this.modules); -/***/ 77079: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + this.hooks.reviveChunks.call(this.chunks, this.records); + this.hooks.beforeChunkIds.call(this.chunks); + this.hooks.chunkIds.call(this.chunks); + this.hooks.optimizeChunkIds.call(this.chunks); + this.hooks.afterOptimizeChunkIds.call(this.chunks); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + this.assignRuntimeIds(); + this.logger.time("compute affected modules with chunk graph"); + this._computeAffectedModulesWithChunkGraph(); + this.logger.timeEnd("compute affected modules with chunk graph"); -const util = __webpack_require__(73837); + this.sortItemsWithChunkIds(); -const defaultFactory = (key, hook) => hook; + if (shouldRecord) { + this.hooks.recordModules.call(this.modules, this.records); + this.hooks.recordChunks.call(this.chunks, this.records); + } -class HookMap { - constructor(factory, name = undefined) { - this._map = new Map(); - this.name = name; - this._factory = factory; - this._interceptors = []; - } + this.hooks.optimizeCodeGeneration.call(this.modules); + this.logger.timeEnd("optimize"); - get(key) { - return this._map.get(key); - } + this.logger.time("module hashing"); + this.hooks.beforeModuleHash.call(); + this.createModuleHashes(); + this.hooks.afterModuleHash.call(); + this.logger.timeEnd("module hashing"); - for(key) { - const hook = this.get(key); - if (hook !== undefined) { - return hook; - } - let newHook = this._factory(key); - const interceptors = this._interceptors; - for (let i = 0; i < interceptors.length; i++) { - newHook = interceptors[i].factory(key, newHook); - } - this._map.set(key, newHook); - return newHook; - } + this.logger.time("code generation"); + this.hooks.beforeCodeGeneration.call(); + this.codeGeneration(err => { + if (err) { + return finalCallback(err); + } + this.hooks.afterCodeGeneration.call(); + this.logger.timeEnd("code generation"); - intercept(interceptor) { - this._interceptors.push( - Object.assign( - { - factory: defaultFactory - }, - interceptor - ) - ); - } -} + this.logger.time("runtime requirements"); + this.hooks.beforeRuntimeRequirements.call(); + this.processRuntimeRequirements(); + this.hooks.afterRuntimeRequirements.call(); + this.logger.timeEnd("runtime requirements"); -HookMap.prototype.tap = util.deprecate(function(key, options, fn) { - return this.for(key).tap(options, fn); -}, "HookMap#tap(key,…) is deprecated. Use HookMap#for(key).tap(…) instead."); + this.logger.time("hashing"); + this.hooks.beforeHash.call(); + const codeGenerationJobs = this.createHash(); + this.hooks.afterHash.call(); + this.logger.timeEnd("hashing"); -HookMap.prototype.tapAsync = util.deprecate(function(key, options, fn) { - return this.for(key).tapAsync(options, fn); -}, "HookMap#tapAsync(key,…) is deprecated. Use HookMap#for(key).tapAsync(…) instead."); + this._runCodeGenerationJobs(codeGenerationJobs, err => { + if (err) { + return finalCallback(err); + } -HookMap.prototype.tapPromise = util.deprecate(function(key, options, fn) { - return this.for(key).tapPromise(options, fn); -}, "HookMap#tapPromise(key,…) is deprecated. Use HookMap#for(key).tapPromise(…) instead."); + if (shouldRecord) { + this.logger.time("record hash"); + this.hooks.recordHash.call(this.records); + this.logger.timeEnd("record hash"); + } -module.exports = HookMap; + this.logger.time("module assets"); + this.clearAssets(); + this.hooks.beforeModuleAssets.call(); + this.createModuleAssets(); + this.logger.timeEnd("module assets"); -/***/ }), + const cont = () => { + this.logger.time("process assets"); + this.hooks.processAssets.callAsync(this.assets, err => { + if (err) { + return finalCallback( + makeWebpackError(err, "Compilation.hooks.processAssets") + ); + } + this.hooks.afterProcessAssets.call(this.assets); + this.logger.timeEnd("process assets"); + this.assets = this._backCompat + ? soonFrozenObjectDeprecation( + this.assets, + "Compilation.assets", + "DEP_WEBPACK_COMPILATION_ASSETS", + `BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation. + Do changes to assets earlier, e. g. in Compilation.hooks.processAssets. + Make sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_*.` + ) + : Object.freeze(this.assets); -/***/ 13103: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + this.summarizeDependencies(); + if (shouldRecord) { + this.hooks.record.call(this, this.records); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (this.hooks.needAdditionalSeal.call()) { + this.unseal(); + return this.seal(callback); + } + return this.hooks.afterSeal.callAsync(err => { + if (err) { + return finalCallback( + makeWebpackError(err, "Compilation.hooks.afterSeal") + ); + } + this.fileSystemInfo.logStatistics(); + finalCallback(); + }); + }); + }; + this.logger.time("create chunk assets"); + if (this.hooks.shouldGenerateChunkAssets.call() !== false) { + this.hooks.beforeChunkAssets.call(); + this.createChunkAssets(err => { + this.logger.timeEnd("create chunk assets"); + if (err) { + return finalCallback(err); + } + cont(); + }); + } else { + this.logger.timeEnd("create chunk assets"); + cont(); + } + }); + }); + } + ); + }); + } -const Hook = __webpack_require__(21468); + /** + * @param {Module} module module to report from + * @param {DependenciesBlock[]} blocks blocks to report from + * @returns {boolean} true, when it has warnings or errors + */ + reportDependencyErrorsAndWarnings(module, blocks) { + let hasProblems = false; + for (let indexBlock = 0; indexBlock < blocks.length; indexBlock++) { + const block = blocks[indexBlock]; + const dependencies = block.dependencies; -class MultiHook { - constructor(hooks, name = undefined) { - this.hooks = hooks; - this.name = name; - } + for (let indexDep = 0; indexDep < dependencies.length; indexDep++) { + const d = dependencies[indexDep]; - tap(options, fn) { - for (const hook of this.hooks) { - hook.tap(options, fn); - } - } + const warnings = d.getWarnings(this.moduleGraph); + if (warnings) { + for (let indexWar = 0; indexWar < warnings.length; indexWar++) { + const w = warnings[indexWar]; - tapAsync(options, fn) { - for (const hook of this.hooks) { - hook.tapAsync(options, fn); - } - } + const warning = new ModuleDependencyWarning(module, w, d.loc); + this.warnings.push(warning); + hasProblems = true; + } + } + const errors = d.getErrors(this.moduleGraph); + if (errors) { + for (let indexErr = 0; indexErr < errors.length; indexErr++) { + const e = errors[indexErr]; - tapPromise(options, fn) { - for (const hook of this.hooks) { - hook.tapPromise(options, fn); - } - } + const error = new ModuleDependencyError(module, e, d.loc); + this.errors.push(error); + hasProblems = true; + } + } + } - isUsed() { - for (const hook of this.hooks) { - if (hook.isUsed()) return true; + if (this.reportDependencyErrorsAndWarnings(module, block.blocks)) + hasProblems = true; } - return false; + return hasProblems; } - intercept(interceptor) { - for (const hook of this.hooks) { - hook.intercept(interceptor); + codeGeneration(callback) { + const { chunkGraph } = this; + this.codeGenerationResults = new CodeGenerationResults( + this.outputOptions.hashFunction + ); + /** @type {{module: Module, hash: string, runtime: RuntimeSpec, runtimes: RuntimeSpec[]}[]} */ + const jobs = []; + for (const module of this.modules) { + const runtimes = chunkGraph.getModuleRuntimes(module); + if (runtimes.size === 1) { + for (const runtime of runtimes) { + const hash = chunkGraph.getModuleHash(module, runtime); + jobs.push({ module, hash, runtime, runtimes: [runtime] }); + } + } else if (runtimes.size > 1) { + /** @type {Map} */ + const map = new Map(); + for (const runtime of runtimes) { + const hash = chunkGraph.getModuleHash(module, runtime); + const job = map.get(hash); + if (job === undefined) { + const newJob = { module, hash, runtime, runtimes: [runtime] }; + jobs.push(newJob); + map.set(hash, newJob); + } else { + job.runtimes.push(runtime); + } + } + } } - } - withOptions(options) { - return new MultiHook( - this.hooks.map(h => h.withOptions(options)), - this.name - ); + this._runCodeGenerationJobs(jobs, callback); } -} - -module.exports = MultiHook; - - -/***/ }), - -/***/ 1626: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const Hook = __webpack_require__(21468); -const HookCodeFactory = __webpack_require__(66443); -class SyncBailHookCodeFactory extends HookCodeFactory { - content({ onError, onResult, resultReturns, onDone, rethrowIfPossible }) { - return this.callTapsSeries({ - onError: (i, err) => onError(err), - onResult: (i, result, next) => - `if(${result} !== undefined) {\n${onResult( - result - )};\n} else {\n${next()}}\n`, - resultReturns, - onDone, - rethrowIfPossible - }); + _runCodeGenerationJobs(jobs, callback) { + let statModulesFromCache = 0; + let statModulesGenerated = 0; + const { chunkGraph, moduleGraph, dependencyTemplates, runtimeTemplate } = + this; + const results = this.codeGenerationResults; + const errors = []; + /** @type {Set | undefined} */ + let notCodeGeneratedModules = undefined; + const runIteration = () => { + let delayedJobs = []; + let delayedModules = new Set(); + asyncLib.eachLimit( + jobs, + this.options.parallelism, + (job, callback) => { + const { module } = job; + const { codeGenerationDependencies } = module; + if (codeGenerationDependencies !== undefined) { + if ( + notCodeGeneratedModules === undefined || + codeGenerationDependencies.some(dep => { + const referencedModule = moduleGraph.getModule(dep); + return notCodeGeneratedModules.has(referencedModule); + }) + ) { + delayedJobs.push(job); + delayedModules.add(module); + return callback(); + } + } + const { hash, runtime, runtimes } = job; + this._codeGenerationModule( + module, + runtime, + runtimes, + hash, + dependencyTemplates, + chunkGraph, + moduleGraph, + runtimeTemplate, + errors, + results, + (err, codeGenerated) => { + if (codeGenerated) statModulesGenerated++; + else statModulesFromCache++; + callback(err); + } + ); + }, + err => { + if (err) return callback(err); + if (delayedJobs.length > 0) { + if (delayedJobs.length === jobs.length) { + return callback( + new Error( + `Unable to make progress during code generation because of circular code generation dependency: ${Array.from( + delayedModules, + m => m.identifier() + ).join(", ")}` + ) + ); + } + jobs = delayedJobs; + delayedJobs = []; + notCodeGeneratedModules = delayedModules; + delayedModules = new Set(); + return runIteration(); + } + if (errors.length > 0) { + errors.sort( + compareSelect(err => err.module, compareModulesByIdentifier) + ); + for (const error of errors) { + this.errors.push(error); + } + } + this.logger.log( + `${Math.round( + (100 * statModulesGenerated) / + (statModulesGenerated + statModulesFromCache) + )}% code generated (${statModulesGenerated} generated, ${statModulesFromCache} from cache)` + ); + callback(); + } + ); + }; + runIteration(); } -} - -const factory = new SyncBailHookCodeFactory(); - -const TAP_ASYNC = () => { - throw new Error("tapAsync is not supported on a SyncBailHook"); -}; - -const TAP_PROMISE = () => { - throw new Error("tapPromise is not supported on a SyncBailHook"); -}; - -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; - -function SyncBailHook(args = [], name = undefined) { - const hook = new Hook(args, name); - hook.constructor = SyncBailHook; - hook.tapAsync = TAP_ASYNC; - hook.tapPromise = TAP_PROMISE; - hook.compile = COMPILE; - return hook; -} - -SyncBailHook.prototype = null; - -module.exports = SyncBailHook; - - -/***/ }), - -/***/ 69689: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - -const Hook = __webpack_require__(21468); -const HookCodeFactory = __webpack_require__(66443); - -class SyncHookCodeFactory extends HookCodeFactory { - content({ onError, onDone, rethrowIfPossible }) { - return this.callTapsSeries({ - onError: (i, err) => onError(err), - onDone, - rethrowIfPossible + /** + * @param {Module} module module + * @param {RuntimeSpec} runtime runtime + * @param {RuntimeSpec[]} runtimes runtimes + * @param {string} hash hash + * @param {DependencyTemplates} dependencyTemplates dependencyTemplates + * @param {ChunkGraph} chunkGraph chunkGraph + * @param {ModuleGraph} moduleGraph moduleGraph + * @param {RuntimeTemplate} runtimeTemplate runtimeTemplate + * @param {WebpackError[]} errors errors + * @param {CodeGenerationResults} results results + * @param {function(WebpackError=, boolean=): void} callback callback + */ + _codeGenerationModule( + module, + runtime, + runtimes, + hash, + dependencyTemplates, + chunkGraph, + moduleGraph, + runtimeTemplate, + errors, + results, + callback + ) { + let codeGenerated = false; + const cache = new MultiItemCache( + runtimes.map(runtime => + this._codeGenerationCache.getItemCache( + `${module.identifier()}|${getRuntimeKey(runtime)}`, + `${hash}|${dependencyTemplates.getHash()}` + ) + ) + ); + cache.get((err, cachedResult) => { + if (err) return callback(err); + let result; + if (!cachedResult) { + try { + codeGenerated = true; + this.codeGeneratedModules.add(module); + result = module.codeGeneration({ + chunkGraph, + moduleGraph, + dependencyTemplates, + runtimeTemplate, + runtime, + codeGenerationResults: results + }); + } catch (err) { + errors.push(new CodeGenerationError(module, err)); + result = cachedResult = { + sources: new Map(), + runtimeRequirements: null + }; + } + } else { + result = cachedResult; + } + for (const runtime of runtimes) { + results.add(module, runtime, result); + } + if (!cachedResult) { + cache.store(result, err => callback(err, codeGenerated)); + } else { + callback(null, codeGenerated); + } }); } -} - -const factory = new SyncHookCodeFactory(); - -const TAP_ASYNC = () => { - throw new Error("tapAsync is not supported on a SyncHook"); -}; - -const TAP_PROMISE = () => { - throw new Error("tapPromise is not supported on a SyncHook"); -}; -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; + _getChunkGraphEntries() { + /** @type {Set} */ + const treeEntries = new Set(); + for (const ep of this.entrypoints.values()) { + const chunk = ep.getRuntimeChunk(); + if (chunk) treeEntries.add(chunk); + } + for (const ep of this.asyncEntrypoints) { + const chunk = ep.getRuntimeChunk(); + if (chunk) treeEntries.add(chunk); + } + return treeEntries; + } -function SyncHook(args = [], name = undefined) { - const hook = new Hook(args, name); - hook.constructor = SyncHook; - hook.tapAsync = TAP_ASYNC; - hook.tapPromise = TAP_PROMISE; - hook.compile = COMPILE; - return hook; -} - -SyncHook.prototype = null; + /** + * @param {Object} options options + * @param {ChunkGraph=} options.chunkGraph the chunk graph + * @param {Iterable=} options.modules modules + * @param {Iterable=} options.chunks chunks + * @param {CodeGenerationResults=} options.codeGenerationResults codeGenerationResults + * @param {Iterable=} options.chunkGraphEntries chunkGraphEntries + * @returns {void} + */ + processRuntimeRequirements({ + chunkGraph = this.chunkGraph, + modules = this.modules, + chunks = this.chunks, + codeGenerationResults = this.codeGenerationResults, + chunkGraphEntries = this._getChunkGraphEntries() + } = {}) { + const context = { chunkGraph, codeGenerationResults }; + const { moduleMemCaches2 } = this; + this.logger.time("runtime requirements.modules"); + const additionalModuleRuntimeRequirements = + this.hooks.additionalModuleRuntimeRequirements; + const runtimeRequirementInModule = this.hooks.runtimeRequirementInModule; + for (const module of modules) { + if (chunkGraph.getNumberOfModuleChunks(module) > 0) { + const memCache = moduleMemCaches2 && moduleMemCaches2.get(module); + for (const runtime of chunkGraph.getModuleRuntimes(module)) { + if (memCache) { + const cached = memCache.get( + `moduleRuntimeRequirements-${getRuntimeKey(runtime)}` + ); + if (cached !== undefined) { + if (cached !== null) { + chunkGraph.addModuleRuntimeRequirements( + module, + runtime, + cached, + false + ); + } + continue; + } + } + let set; + const runtimeRequirements = + codeGenerationResults.getRuntimeRequirements(module, runtime); + if (runtimeRequirements && runtimeRequirements.size > 0) { + set = new Set(runtimeRequirements); + } else if (additionalModuleRuntimeRequirements.isUsed()) { + set = new Set(); + } else { + if (memCache) { + memCache.set( + `moduleRuntimeRequirements-${getRuntimeKey(runtime)}`, + null + ); + } + continue; + } + additionalModuleRuntimeRequirements.call(module, set, context); -module.exports = SyncHook; + for (const r of set) { + const hook = runtimeRequirementInModule.get(r); + if (hook !== undefined) hook.call(module, set, context); + } + if (set.size === 0) { + if (memCache) { + memCache.set( + `moduleRuntimeRequirements-${getRuntimeKey(runtime)}`, + null + ); + } + } else { + if (memCache) { + memCache.set( + `moduleRuntimeRequirements-${getRuntimeKey(runtime)}`, + set + ); + chunkGraph.addModuleRuntimeRequirements( + module, + runtime, + set, + false + ); + } else { + chunkGraph.addModuleRuntimeRequirements(module, runtime, set); + } + } + } + } + } + this.logger.timeEnd("runtime requirements.modules"); + this.logger.time("runtime requirements.chunks"); + for (const chunk of chunks) { + const set = new Set(); + for (const module of chunkGraph.getChunkModulesIterable(chunk)) { + const runtimeRequirements = chunkGraph.getModuleRuntimeRequirements( + module, + chunk.runtime + ); + for (const r of runtimeRequirements) set.add(r); + } + this.hooks.additionalChunkRuntimeRequirements.call(chunk, set, context); -/***/ }), + for (const r of set) { + this.hooks.runtimeRequirementInChunk.for(r).call(chunk, set, context); + } -/***/ 50179: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + chunkGraph.addChunkRuntimeRequirements(chunk, set); + } + this.logger.timeEnd("runtime requirements.chunks"); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + this.logger.time("runtime requirements.entries"); + for (const treeEntry of chunkGraphEntries) { + const set = new Set(); + for (const chunk of treeEntry.getAllReferencedChunks()) { + const runtimeRequirements = + chunkGraph.getChunkRuntimeRequirements(chunk); + for (const r of runtimeRequirements) set.add(r); + } + this.hooks.additionalTreeRuntimeRequirements.call( + treeEntry, + set, + context + ); -const Hook = __webpack_require__(21468); -const HookCodeFactory = __webpack_require__(66443); + for (const r of set) { + this.hooks.runtimeRequirementInTree + .for(r) + .call(treeEntry, set, context); + } -class SyncLoopHookCodeFactory extends HookCodeFactory { - content({ onError, onDone, rethrowIfPossible }) { - return this.callTapsLooping({ - onError: (i, err) => onError(err), - onDone, - rethrowIfPossible - }); + chunkGraph.addTreeRuntimeRequirements(treeEntry, set); + } + this.logger.timeEnd("runtime requirements.entries"); } -} - -const factory = new SyncLoopHookCodeFactory(); - -const TAP_ASYNC = () => { - throw new Error("tapAsync is not supported on a SyncLoopHook"); -}; -const TAP_PROMISE = () => { - throw new Error("tapPromise is not supported on a SyncLoopHook"); -}; - -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; + // TODO webpack 6 make chunkGraph argument non-optional + /** + * @param {Chunk} chunk target chunk + * @param {RuntimeModule} module runtime module + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {void} + */ + addRuntimeModule(chunk, module, chunkGraph = this.chunkGraph) { + // Deprecated ModuleGraph association + if (this._backCompat) + ModuleGraph.setModuleGraphForModule(module, this.moduleGraph); -function SyncLoopHook(args = [], name = undefined) { - const hook = new Hook(args, name); - hook.constructor = SyncLoopHook; - hook.tapAsync = TAP_ASYNC; - hook.tapPromise = TAP_PROMISE; - hook.compile = COMPILE; - return hook; -} + // add it to the list + this.modules.add(module); + this._modules.set(module.identifier(), module); -SyncLoopHook.prototype = null; + // connect to the chunk graph + chunkGraph.connectChunkAndModule(chunk, module); + chunkGraph.connectChunkAndRuntimeModule(chunk, module); + if (module.fullHash) { + chunkGraph.addFullHashModuleToChunk(chunk, module); + } else if (module.dependentHash) { + chunkGraph.addDependentHashModuleToChunk(chunk, module); + } -module.exports = SyncLoopHook; + // attach runtime module + module.attach(this, chunk, chunkGraph); + // Setup internals + const exportsInfo = this.moduleGraph.getExportsInfo(module); + exportsInfo.setHasProvideInfo(); + if (typeof chunk.runtime === "string") { + exportsInfo.setUsedForSideEffectsOnly(chunk.runtime); + } else if (chunk.runtime === undefined) { + exportsInfo.setUsedForSideEffectsOnly(undefined); + } else { + for (const runtime of chunk.runtime) { + exportsInfo.setUsedForSideEffectsOnly(runtime); + } + } + chunkGraph.addModuleRuntimeRequirements( + module, + chunk.runtime, + new Set([RuntimeGlobals.requireScope]) + ); -/***/ }), + // runtime modules don't need ids + chunkGraph.setModuleId(module, ""); -/***/ 36093: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Call hook + this.hooks.runtimeModule.call(module, chunk); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * If `module` is passed, `loc` and `request` must also be passed. + * @param {string | ChunkGroupOptions} groupOptions options for the chunk group + * @param {Module=} module the module the references the chunk group + * @param {DependencyLocation=} loc the location from with the chunk group is referenced (inside of module) + * @param {string=} request the request from which the the chunk group is referenced + * @returns {ChunkGroup} the new or existing chunk group + */ + addChunkInGroup(groupOptions, module, loc, request) { + if (typeof groupOptions === "string") { + groupOptions = { name: groupOptions }; + } + const name = groupOptions.name; + if (name) { + const chunkGroup = this.namedChunkGroups.get(name); + if (chunkGroup !== undefined) { + chunkGroup.addOptions(groupOptions); + if (module) { + chunkGroup.addOrigin(module, loc, request); + } + return chunkGroup; + } + } + const chunkGroup = new ChunkGroup(groupOptions); + if (module) chunkGroup.addOrigin(module, loc, request); + const chunk = this.addChunk(name); -const Hook = __webpack_require__(21468); -const HookCodeFactory = __webpack_require__(66443); + connectChunkGroupAndChunk(chunkGroup, chunk); -class SyncWaterfallHookCodeFactory extends HookCodeFactory { - content({ onError, onResult, resultReturns, rethrowIfPossible }) { - return this.callTapsSeries({ - onError: (i, err) => onError(err), - onResult: (i, result, next) => { - let code = ""; - code += `if(${result} !== undefined) {\n`; - code += `${this._args[0]} = ${result};\n`; - code += `}\n`; - code += next(); - return code; - }, - onDone: () => onResult(this._args[0]), - doneReturns: resultReturns, - rethrowIfPossible - }); + this.chunkGroups.push(chunkGroup); + if (name) { + this.namedChunkGroups.set(name, chunkGroup); + } + return chunkGroup; } -} -const factory = new SyncWaterfallHookCodeFactory(); - -const TAP_ASYNC = () => { - throw new Error("tapAsync is not supported on a SyncWaterfallHook"); -}; + /** + * @param {EntryOptions} options options for the entrypoint + * @param {Module} module the module the references the chunk group + * @param {DependencyLocation} loc the location from with the chunk group is referenced (inside of module) + * @param {string} request the request from which the the chunk group is referenced + * @returns {Entrypoint} the new or existing entrypoint + */ + addAsyncEntrypoint(options, module, loc, request) { + const name = options.name; + if (name) { + const entrypoint = this.namedChunkGroups.get(name); + if (entrypoint instanceof Entrypoint) { + if (entrypoint !== undefined) { + if (module) { + entrypoint.addOrigin(module, loc, request); + } + return entrypoint; + } + } else if (entrypoint) { + throw new Error( + `Cannot add an async entrypoint with the name '${name}', because there is already an chunk group with this name` + ); + } + } + const chunk = this.addChunk(name); + if (options.filename) { + chunk.filenameTemplate = options.filename; + } + const entrypoint = new Entrypoint(options, false); + entrypoint.setRuntimeChunk(chunk); + entrypoint.setEntrypointChunk(chunk); + if (name) { + this.namedChunkGroups.set(name, entrypoint); + } + this.chunkGroups.push(entrypoint); + this.asyncEntrypoints.push(entrypoint); + connectChunkGroupAndChunk(entrypoint, chunk); + if (module) { + entrypoint.addOrigin(module, loc, request); + } + return entrypoint; + } -const TAP_PROMISE = () => { - throw new Error("tapPromise is not supported on a SyncWaterfallHook"); -}; + /** + * This method first looks to see if a name is provided for a new chunk, + * and first looks to see if any named chunks already exist and reuse that chunk instead. + * + * @param {string=} name optional chunk name to be provided + * @returns {Chunk} create a chunk (invoked during seal event) + */ + addChunk(name) { + if (name) { + const chunk = this.namedChunks.get(name); + if (chunk !== undefined) { + return chunk; + } + } + const chunk = new Chunk(name, this._backCompat); + this.chunks.add(chunk); + if (this._backCompat) + ChunkGraph.setChunkGraphForChunk(chunk, this.chunkGraph); + if (name) { + this.namedChunks.set(name, chunk); + } + return chunk; + } -const COMPILE = function(options) { - factory.setup(this, options); - return factory.create(options); -}; + /** + * @deprecated + * @param {Module} module module to assign depth + * @returns {void} + */ + assignDepth(module) { + const moduleGraph = this.moduleGraph; -function SyncWaterfallHook(args = [], name = undefined) { - if (args.length < 1) - throw new Error("Waterfall hooks must have at least one argument"); - const hook = new Hook(args, name); - hook.constructor = SyncWaterfallHook; - hook.tapAsync = TAP_ASYNC; - hook.tapPromise = TAP_PROMISE; - hook.compile = COMPILE; - return hook; -} + const queue = new Set([module]); + let depth; -SyncWaterfallHook.prototype = null; + moduleGraph.setDepth(module, 0); -module.exports = SyncWaterfallHook; + /** + * @param {Module} module module for processing + * @returns {void} + */ + const processModule = module => { + if (!moduleGraph.setDepthIfLower(module, depth)) return; + queue.add(module); + }; + for (module of queue) { + queue.delete(module); + depth = moduleGraph.getDepth(module) + 1; -/***/ }), + for (const connection of moduleGraph.getOutgoingConnections(module)) { + const refModule = connection.module; + if (refModule) { + processModule(refModule); + } + } + } + } -/***/ 41242: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + /** + * @param {Set} modules module to assign depth + * @returns {void} + */ + assignDepths(modules) { + const moduleGraph = this.moduleGraph; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** @type {Set} */ + const queue = new Set(modules); + queue.add(1); + let depth = 0; + let i = 0; + for (const module of queue) { + i++; + if (typeof module === "number") { + depth = module; + if (queue.size === i) return; + queue.add(depth + 1); + } else { + moduleGraph.setDepth(module, depth); + for (const { module: refModule } of moduleGraph.getOutgoingConnections( + module + )) { + if (refModule) { + queue.add(refModule); + } + } + } + } + } -exports.__esModule = true; -exports.SyncHook = __webpack_require__(69689); -exports.SyncBailHook = __webpack_require__(1626); -exports.SyncWaterfallHook = __webpack_require__(36093); -exports.SyncLoopHook = __webpack_require__(50179); -exports.AsyncParallelHook = __webpack_require__(31684); -exports.AsyncParallelBailHook = __webpack_require__(18151); -exports.AsyncSeriesHook = __webpack_require__(96496); -exports.AsyncSeriesBailHook = __webpack_require__(95734); -exports.AsyncSeriesLoopHook = __webpack_require__(95999); -exports.AsyncSeriesWaterfallHook = __webpack_require__(58118); -exports.HookMap = __webpack_require__(77079); -exports.MultiHook = __webpack_require__(13103); + /** + * @param {Dependency} dependency the dependency + * @param {RuntimeSpec} runtime the runtime + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getDependencyReferencedExports(dependency, runtime) { + const referencedExports = dependency.getReferencedExports( + this.moduleGraph, + runtime + ); + return this.hooks.dependencyReferencedExports.call( + referencedExports, + dependency, + runtime + ); + } + /** + * + * @param {Module} module module relationship for removal + * @param {DependenciesBlockLike} block //TODO: good description + * @returns {void} + */ + removeReasonsOfDependencyBlock(module, block) { + if (block.blocks) { + for (const b of block.blocks) { + this.removeReasonsOfDependencyBlock(module, b); + } + } -/***/ }), + if (block.dependencies) { + for (const dep of block.dependencies) { + const originalModule = this.moduleGraph.getModule(dep); + if (originalModule) { + this.moduleGraph.removeConnection(dep); -/***/ 74315: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (this.chunkGraph) { + for (const chunk of this.chunkGraph.getModuleChunks( + originalModule + )) { + this.patchChunksAfterReasonRemoval(originalModule, chunk); + } + } + } + } + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {Module} module module to patch tie + * @param {Chunk} chunk chunk to patch tie + * @returns {void} + */ + patchChunksAfterReasonRemoval(module, chunk) { + if (!module.hasReasons(this.moduleGraph, chunk.runtime)) { + this.removeReasonsOfDependencyBlock(module, module); + } + if (!module.hasReasonForChunk(chunk, this.moduleGraph, this.chunkGraph)) { + if (this.chunkGraph.isModuleInChunk(module, chunk)) { + this.chunkGraph.disconnectChunkAndModule(chunk, module); + this.removeChunkFromDependencies(module, chunk); + } + } + } + /** + * + * @param {DependenciesBlock} block block tie for Chunk + * @param {Chunk} chunk chunk to remove from dep + * @returns {void} + */ + removeChunkFromDependencies(block, chunk) { + /** + * @param {Dependency} d dependency to (maybe) patch up + */ + const iteratorDependency = d => { + const depModule = this.moduleGraph.getModule(d); + if (!depModule) { + return; + } + this.patchChunksAfterReasonRemoval(depModule, chunk); + }; + const blocks = block.blocks; + for (let indexBlock = 0; indexBlock < blocks.length; indexBlock++) { + const asyncBlock = blocks[indexBlock]; + const chunkGroup = this.chunkGraph.getBlockChunkGroup(asyncBlock); + // Grab all chunks from the first Block's AsyncDepBlock + const chunks = chunkGroup.chunks; + // For each chunk in chunkGroup + for (let indexChunk = 0; indexChunk < chunks.length; indexChunk++) { + const iteratedChunk = chunks[indexChunk]; + chunkGroup.removeChunk(iteratedChunk); + // Recurse + this.removeChunkFromDependencies(block, iteratedChunk); + } + } -const RuntimeGlobals = __webpack_require__(16475); -const WebpackError = __webpack_require__(53799); -const ConstDependency = __webpack_require__(76911); -const BasicEvaluatedExpression = __webpack_require__(950); -const { - toConstantDependency, - evaluateToString -} = __webpack_require__(93998); -const ChunkNameRuntimeModule = __webpack_require__(84519); -const GetFullHashRuntimeModule = __webpack_require__(88732); - -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ - -/* eslint-disable camelcase */ -const REPLACEMENTS = { - __webpack_require__: { - expr: RuntimeGlobals.require, - req: [RuntimeGlobals.require], - type: "function", - assign: false - }, - __webpack_public_path__: { - expr: RuntimeGlobals.publicPath, - req: [RuntimeGlobals.publicPath], - type: "string", - assign: true - }, - __webpack_base_uri__: { - expr: RuntimeGlobals.baseURI, - req: [RuntimeGlobals.baseURI], - type: "string", - assign: true - }, - __webpack_modules__: { - expr: RuntimeGlobals.moduleFactories, - req: [RuntimeGlobals.moduleFactories], - type: "object", - assign: false - }, - __webpack_chunk_load__: { - expr: RuntimeGlobals.ensureChunk, - req: [RuntimeGlobals.ensureChunk], - type: "function", - assign: true - }, - __non_webpack_require__: { - expr: "require", - req: null, - type: undefined, // type is not known, depends on environment - assign: true - }, - __webpack_nonce__: { - expr: RuntimeGlobals.scriptNonce, - req: [RuntimeGlobals.scriptNonce], - type: "string", - assign: true - }, - __webpack_hash__: { - expr: `${RuntimeGlobals.getFullHash}()`, - req: [RuntimeGlobals.getFullHash], - type: "string", - assign: false - }, - __webpack_chunkname__: { - expr: RuntimeGlobals.chunkName, - req: [RuntimeGlobals.chunkName], - type: "string", - assign: false - }, - __webpack_get_script_filename__: { - expr: RuntimeGlobals.getChunkScriptFilename, - req: [RuntimeGlobals.getChunkScriptFilename], - type: "function", - assign: true - }, - __webpack_runtime_id__: { - expr: RuntimeGlobals.runtimeId, - req: [RuntimeGlobals.runtimeId], - assign: false - }, - "require.onError": { - expr: RuntimeGlobals.uncaughtErrorHandler, - req: [RuntimeGlobals.uncaughtErrorHandler], - type: undefined, // type is not known, could be function or undefined - assign: true // is never a pattern - }, - __system_context__: { - expr: RuntimeGlobals.systemContext, - req: [RuntimeGlobals.systemContext], - type: "object", - assign: false - }, - __webpack_share_scopes__: { - expr: RuntimeGlobals.shareScopeMap, - req: [RuntimeGlobals.shareScopeMap], - type: "object", - assign: false - }, - __webpack_init_sharing__: { - expr: RuntimeGlobals.initializeSharing, - req: [RuntimeGlobals.initializeSharing], - type: "function", - assign: true + if (block.dependencies) { + for (const dep of block.dependencies) iteratorDependency(dep); + } } -}; -/* eslint-enable camelcase */ - -class APIPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "APIPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyTemplates.set( - ConstDependency, - new ConstDependency.Template() - ); - - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.chunkName) - .tap("APIPlugin", chunk => { - compilation.addRuntimeModule( - chunk, - new ChunkNameRuntimeModule(chunk.name) - ); - return true; - }); - - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.getFullHash) - .tap("APIPlugin", (chunk, set) => { - compilation.addRuntimeModule(chunk, new GetFullHashRuntimeModule()); - return true; - }); - - /** - * @param {JavascriptParser} parser the parser - */ - const handler = parser => { - Object.keys(REPLACEMENTS).forEach(key => { - const info = REPLACEMENTS[key]; - parser.hooks.expression - .for(key) - .tap( - "APIPlugin", - toConstantDependency(parser, info.expr, info.req) - ); - if (info.assign === false) { - parser.hooks.assign.for(key).tap("APIPlugin", expr => { - const err = new WebpackError(`${key} must not be assigned`); - err.loc = expr.loc; - throw err; - }); - } - if (info.type) { - parser.hooks.evaluateTypeof - .for(key) - .tap("APIPlugin", evaluateToString(info.type)); - } - }); - - parser.hooks.expression - .for("__webpack_layer__") - .tap("APIPlugin", expr => { - const dep = new ConstDependency( - JSON.stringify(parser.state.module.layer), - expr.range - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - parser.hooks.evaluateIdentifier - .for("__webpack_layer__") - .tap("APIPlugin", expr => - (parser.state.module.layer === null - ? new BasicEvaluatedExpression().setNull() - : new BasicEvaluatedExpression().setString( - parser.state.module.layer - ) - ).setRange(expr.range) - ); - parser.hooks.evaluateTypeof - .for("__webpack_layer__") - .tap("APIPlugin", expr => - new BasicEvaluatedExpression() - .setString( - parser.state.module.layer === null ? "object" : "string" - ) - .setRange(expr.range) - ); - - parser.hooks.expression - .for("__webpack_module__.id") - .tap("APIPlugin", expr => { - parser.state.module.buildInfo.moduleConcatenationBailout = - "__webpack_module__.id"; - const dep = new ConstDependency( - parser.state.module.moduleArgument + ".id", - expr.range, - [RuntimeGlobals.moduleId] - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - - parser.hooks.expression - .for("__webpack_module__") - .tap("APIPlugin", expr => { - parser.state.module.buildInfo.moduleConcatenationBailout = - "__webpack_module__"; - const dep = new ConstDependency( - parser.state.module.moduleArgument, - expr.range, - [RuntimeGlobals.module] - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - parser.hooks.evaluateTypeof - .for("__webpack_module__") - .tap("APIPlugin", evaluateToString("object")); - }; - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("APIPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("APIPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("APIPlugin", handler); - } - ); + assignRuntimeIds() { + const { chunkGraph } = this; + const processEntrypoint = ep => { + const runtime = ep.options.runtime || ep.name; + const chunk = ep.getRuntimeChunk(); + chunkGraph.setRuntimeId(runtime, chunk.id); + }; + for (const ep of this.entrypoints.values()) { + processEntrypoint(ep); + } + for (const ep of this.asyncEntrypoints) { + processEntrypoint(ep); + } } -} - -module.exports = APIPlugin; - - -/***/ }), - -/***/ 77198: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ - - - -const WebpackError = __webpack_require__(53799); -const CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/; - -/** - * @param {string=} method method name - * @returns {string} message - */ -function createMessage(method) { - return `Abstract method${method ? " " + method : ""}. Must be overridden.`; -} - -/** - * @constructor - */ -function Message() { - /** @type {string} */ - this.stack = undefined; - Error.captureStackTrace(this); - /** @type {RegExpMatchArray} */ - const match = this.stack.split("\n")[3].match(CURRENT_METHOD_REGEXP); - this.message = match && match[1] ? createMessage(match[1]) : createMessage(); -} + sortItemsWithChunkIds() { + for (const chunkGroup of this.chunkGroups) { + chunkGroup.sortItems(); + } -/** - * Error for abstract method - * @example - * class FooClass { - * abstractMethod() { - * throw new AbstractMethodError(); // error message: Abstract method FooClass.abstractMethod. Must be overridden. - * } - * } - * - */ -class AbstractMethodError extends WebpackError { - constructor() { - super(new Message().message); - this.name = "AbstractMethodError"; + this.errors.sort(compareErrors); + this.warnings.sort(compareErrors); + this.children.sort(byNameOrHash); } -} - -module.exports = AbstractMethodError; - - -/***/ }), - -/***/ 47736: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const DependenciesBlock = __webpack_require__(71040); -const makeSerializable = __webpack_require__(33032); - -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./ChunkGroup")} ChunkGroup */ -/** @typedef {import("./ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */ -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./util/Hash")} Hash */ + summarizeDependencies() { + for ( + let indexChildren = 0; + indexChildren < this.children.length; + indexChildren++ + ) { + const child = this.children[indexChildren]; -class AsyncDependenciesBlock extends DependenciesBlock { - /** - * @param {ChunkGroupOptions & { entryOptions?: EntryOptions }} groupOptions options for the group - * @param {DependencyLocation=} loc the line of code - * @param {string=} request the request - */ - constructor(groupOptions, loc, request) { - super(); - if (typeof groupOptions === "string") { - groupOptions = { name: groupOptions }; - } else if (!groupOptions) { - groupOptions = { name: undefined }; + this.fileDependencies.addAll(child.fileDependencies); + this.contextDependencies.addAll(child.contextDependencies); + this.missingDependencies.addAll(child.missingDependencies); + this.buildDependencies.addAll(child.buildDependencies); } - this.groupOptions = groupOptions; - this.loc = loc; - this.request = request; - this._stringifiedGroupOptions = undefined; - } - - /** - * @returns {string} The name of the chunk - */ - get chunkName() { - return this.groupOptions.name; - } - /** - * @param {string} value The new chunk name - * @returns {void} - */ - set chunkName(value) { - if (this.groupOptions.name !== value) { - this.groupOptions.name = value; - this._stringifiedGroupOptions = undefined; + for (const module of this.modules) { + module.addCacheDependencies( + this.fileDependencies, + this.contextDependencies, + this.missingDependencies, + this.buildDependencies + ); } } - /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - const { chunkGraph } = context; - if (this._stringifiedGroupOptions === undefined) { - this._stringifiedGroupOptions = JSON.stringify(this.groupOptions); + createModuleHashes() { + let statModulesHashed = 0; + let statModulesFromCache = 0; + const { chunkGraph, runtimeTemplate, moduleMemCaches2 } = this; + const { hashFunction, hashDigest, hashDigestLength } = this.outputOptions; + for (const module of this.modules) { + const memCache = moduleMemCaches2 && moduleMemCaches2.get(module); + for (const runtime of chunkGraph.getModuleRuntimes(module)) { + if (memCache) { + const digest = memCache.get(`moduleHash-${getRuntimeKey(runtime)}`); + if (digest !== undefined) { + chunkGraph.setModuleHashes( + module, + runtime, + digest, + digest.substr(0, hashDigestLength) + ); + statModulesFromCache++; + continue; + } + } + statModulesHashed++; + const digest = this._createModuleHash( + module, + chunkGraph, + runtime, + hashFunction, + runtimeTemplate, + hashDigest, + hashDigestLength + ); + if (memCache) { + memCache.set(`moduleHash-${getRuntimeKey(runtime)}`, digest); + } + } } - const chunkGroup = chunkGraph.getBlockChunkGroup(this); - hash.update( - `${this._stringifiedGroupOptions}${chunkGroup ? chunkGroup.id : ""}` + this.logger.log( + `${statModulesHashed} modules hashed, ${statModulesFromCache} from cache (${ + Math.round( + (100 * (statModulesHashed + statModulesFromCache)) / this.modules.size + ) / 100 + } variants per module in average)` ); - super.updateHash(hash, context); - } - - serialize(context) { - const { write } = context; - write(this.groupOptions); - write(this.loc); - write(this.request); - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - this.groupOptions = read(); - this.loc = read(); - this.request = read(); - super.deserialize(context); } -} -makeSerializable(AsyncDependenciesBlock, "webpack/lib/AsyncDependenciesBlock"); - -Object.defineProperty(AsyncDependenciesBlock.prototype, "module", { - get() { - throw new Error( - "module property was removed from AsyncDependenciesBlock (it's not needed)" + _createModuleHash( + module, + chunkGraph, + runtime, + hashFunction, + runtimeTemplate, + hashDigest, + hashDigestLength + ) { + const moduleHash = createHash(hashFunction); + module.updateHash(moduleHash, { + chunkGraph, + runtime, + runtimeTemplate + }); + const moduleHashDigest = /** @type {string} */ ( + moduleHash.digest(hashDigest) ); - }, - set() { - throw new Error( - "module property was removed from AsyncDependenciesBlock (it's not needed)" + chunkGraph.setModuleHashes( + module, + runtime, + moduleHashDigest, + moduleHashDigest.substr(0, hashDigestLength) ); + return moduleHashDigest; } -}); - -module.exports = AsyncDependenciesBlock; - - -/***/ }), - -/***/ 30111: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sean Larkin @thelarkinn -*/ + createHash() { + this.logger.time("hashing: initialize hash"); + const chunkGraph = this.chunkGraph; + const runtimeTemplate = this.runtimeTemplate; + const outputOptions = this.outputOptions; + const hashFunction = outputOptions.hashFunction; + const hashDigest = outputOptions.hashDigest; + const hashDigestLength = outputOptions.hashDigestLength; + const hash = createHash(hashFunction); + if (outputOptions.hashSalt) { + hash.update(outputOptions.hashSalt); + } + this.logger.timeEnd("hashing: initialize hash"); + if (this.children.length > 0) { + this.logger.time("hashing: hash child compilations"); + for (const child of this.children) { + hash.update(child.hash); + } + this.logger.timeEnd("hashing: hash child compilations"); + } + if (this.warnings.length > 0) { + this.logger.time("hashing: hash warnings"); + for (const warning of this.warnings) { + hash.update(`${warning.message}`); + } + this.logger.timeEnd("hashing: hash warnings"); + } + if (this.errors.length > 0) { + this.logger.time("hashing: hash errors"); + for (const error of this.errors) { + hash.update(`${error.message}`); + } + this.logger.timeEnd("hashing: hash errors"); + } + this.logger.time("hashing: sort chunks"); + /* + * all non-runtime chunks need to be hashes first, + * since runtime chunk might use their hashes. + * runtime chunks need to be hashed in the correct order + * since they may depend on each other (for async entrypoints). + * So we put all non-runtime chunks first and hash them in any order. + * And order runtime chunks according to referenced between each other. + * Chunks need to be in deterministic order since we add hashes to full chunk + * during these hashing. + */ + /** @type {Chunk[]} */ + const unorderedRuntimeChunks = []; + /** @type {Chunk[]} */ + const otherChunks = []; + for (const c of this.chunks) { + if (c.hasRuntime()) { + unorderedRuntimeChunks.push(c); + } else { + otherChunks.push(c); + } + } + unorderedRuntimeChunks.sort(byId); + otherChunks.sort(byId); + /** @typedef {{ chunk: Chunk, referencedBy: RuntimeChunkInfo[], remaining: number }} RuntimeChunkInfo */ + /** @type {Map} */ + const runtimeChunksMap = new Map(); + for (const chunk of unorderedRuntimeChunks) { + runtimeChunksMap.set(chunk, { + chunk, + referencedBy: [], + remaining: 0 + }); + } + let remaining = 0; + for (const info of runtimeChunksMap.values()) { + for (const other of new Set( + Array.from(info.chunk.getAllReferencedAsyncEntrypoints()).map( + e => e.chunks[e.chunks.length - 1] + ) + )) { + const otherInfo = runtimeChunksMap.get(other); + otherInfo.referencedBy.push(info); + info.remaining++; + remaining++; + } + } + /** @type {Chunk[]} */ + const runtimeChunks = []; + for (const info of runtimeChunksMap.values()) { + if (info.remaining === 0) { + runtimeChunks.push(info.chunk); + } + } + // If there are any references between chunks + // make sure to follow these chains + if (remaining > 0) { + const readyChunks = []; + for (const chunk of runtimeChunks) { + const hasFullHashModules = + chunkGraph.getNumberOfChunkFullHashModules(chunk) !== 0; + const info = runtimeChunksMap.get(chunk); + for (const otherInfo of info.referencedBy) { + if (hasFullHashModules) { + chunkGraph.upgradeDependentToFullHashModules(otherInfo.chunk); + } + remaining--; + if (--otherInfo.remaining === 0) { + readyChunks.push(otherInfo.chunk); + } + } + if (readyChunks.length > 0) { + // This ensures deterministic ordering, since referencedBy is non-deterministic + readyChunks.sort(byId); + for (const c of readyChunks) runtimeChunks.push(c); + readyChunks.length = 0; + } + } + } + // If there are still remaining references we have cycles and want to create a warning + if (remaining > 0) { + let circularRuntimeChunkInfo = []; + for (const info of runtimeChunksMap.values()) { + if (info.remaining !== 0) { + circularRuntimeChunkInfo.push(info); + } + } + circularRuntimeChunkInfo.sort(compareSelect(i => i.chunk, byId)); + const err = + new WebpackError(`Circular dependency between chunks with runtime (${Array.from( + circularRuntimeChunkInfo, + c => c.chunk.name || c.chunk.id + ).join(", ")}) +This prevents using hashes of each other and should be avoided.`); + err.chunk = circularRuntimeChunkInfo[0].chunk; + this.warnings.push(err); + for (const i of circularRuntimeChunkInfo) runtimeChunks.push(i.chunk); + } + this.logger.timeEnd("hashing: sort chunks"); -const WebpackError = __webpack_require__(53799); + const fullHashChunks = new Set(); + /** @type {{module: Module, hash: string, runtime: RuntimeSpec, runtimes: RuntimeSpec[]}[]} */ + const codeGenerationJobs = []; + /** @type {Map>} */ + const codeGenerationJobsMap = new Map(); -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("./Module")} Module */ + const processChunk = chunk => { + // Last minute module hash generation for modules that depend on chunk hashes + this.logger.time("hashing: hash runtime modules"); + const runtime = chunk.runtime; + for (const module of chunkGraph.getChunkModulesIterable(chunk)) { + if (!chunkGraph.hasModuleHashes(module, runtime)) { + const hash = this._createModuleHash( + module, + chunkGraph, + runtime, + hashFunction, + runtimeTemplate, + hashDigest, + hashDigestLength + ); + let hashMap = codeGenerationJobsMap.get(hash); + if (hashMap) { + const moduleJob = hashMap.get(module); + if (moduleJob) { + moduleJob.runtimes.push(runtime); + continue; + } + } else { + hashMap = new Map(); + codeGenerationJobsMap.set(hash, hashMap); + } + const job = { + module, + hash, + runtime, + runtimes: [runtime] + }; + hashMap.set(module, job); + codeGenerationJobs.push(job); + } + } + this.logger.timeAggregate("hashing: hash runtime modules"); + this.logger.time("hashing: hash chunks"); + const chunkHash = createHash(hashFunction); + try { + if (outputOptions.hashSalt) { + chunkHash.update(outputOptions.hashSalt); + } + chunk.updateHash(chunkHash, chunkGraph); + this.hooks.chunkHash.call(chunk, chunkHash, { + chunkGraph, + codeGenerationResults: this.codeGenerationResults, + moduleGraph: this.moduleGraph, + runtimeTemplate: this.runtimeTemplate + }); + const chunkHashDigest = /** @type {string} */ ( + chunkHash.digest(hashDigest) + ); + hash.update(chunkHashDigest); + chunk.hash = chunkHashDigest; + chunk.renderedHash = chunk.hash.substr(0, hashDigestLength); + const fullHashModules = + chunkGraph.getChunkFullHashModulesIterable(chunk); + if (fullHashModules) { + fullHashChunks.add(chunk); + } else { + this.hooks.contentHash.call(chunk); + } + } catch (err) { + this.errors.push(new ChunkRenderError(chunk, "", err)); + } + this.logger.timeAggregate("hashing: hash chunks"); + }; + otherChunks.forEach(processChunk); + for (const chunk of runtimeChunks) processChunk(chunk); -class AsyncDependencyToInitialChunkError extends WebpackError { - /** - * Creates an instance of AsyncDependencyToInitialChunkError. - * @param {string} chunkName Name of Chunk - * @param {Module} module module tied to dependency - * @param {DependencyLocation} loc location of dependency - */ - constructor(chunkName, module, loc) { - super( - `It's not allowed to load an initial chunk on demand. The chunk name "${chunkName}" is already used by an entrypoint.` - ); + this.logger.timeAggregateEnd("hashing: hash runtime modules"); + this.logger.timeAggregateEnd("hashing: hash chunks"); + this.logger.time("hashing: hash digest"); + this.hooks.fullHash.call(hash); + this.fullHash = /** @type {string} */ (hash.digest(hashDigest)); + this.hash = this.fullHash.substr(0, hashDigestLength); + this.logger.timeEnd("hashing: hash digest"); - this.name = "AsyncDependencyToInitialChunkError"; - this.module = module; - this.loc = loc; + this.logger.time("hashing: process full hash modules"); + for (const chunk of fullHashChunks) { + for (const module of chunkGraph.getChunkFullHashModulesIterable(chunk)) { + const moduleHash = createHash(hashFunction); + module.updateHash(moduleHash, { + chunkGraph, + runtime: chunk.runtime, + runtimeTemplate + }); + const moduleHashDigest = /** @type {string} */ ( + moduleHash.digest(hashDigest) + ); + const oldHash = chunkGraph.getModuleHash(module, chunk.runtime); + chunkGraph.setModuleHashes( + module, + chunk.runtime, + moduleHashDigest, + moduleHashDigest.substr(0, hashDigestLength) + ); + codeGenerationJobsMap.get(oldHash).get(module).hash = moduleHashDigest; + } + const chunkHash = createHash(hashFunction); + chunkHash.update(chunk.hash); + chunkHash.update(this.hash); + const chunkHashDigest = /** @type {string} */ ( + chunkHash.digest(hashDigest) + ); + chunk.hash = chunkHashDigest; + chunk.renderedHash = chunk.hash.substr(0, hashDigestLength); + this.hooks.contentHash.call(chunk); + } + this.logger.timeEnd("hashing: process full hash modules"); + return codeGenerationJobs; } -} - -module.exports = AsyncDependencyToInitialChunkError; - - -/***/ }), - -/***/ 17714: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const asyncLib = __webpack_require__(78175); -const NormalModule = __webpack_require__(39); -const PrefetchDependency = __webpack_require__(31618); - -/** @typedef {import("./Compiler")} Compiler */ - -class AutomaticPrefetchPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {string} file file name + * @param {Source} source asset source + * @param {AssetInfo} assetInfo extra asset information * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap( - "AutomaticPrefetchPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - PrefetchDependency, - normalModuleFactory + emitAsset(file, source, assetInfo = {}) { + if (this.assets[file]) { + if (!isSourceEqual(this.assets[file], source)) { + this.errors.push( + new WebpackError( + `Conflict: Multiple assets emit different content to the same filename ${file}` + ) ); + this.assets[file] = source; + this._setAssetInfo(file, assetInfo); + return; } - ); - let lastModules = null; - compiler.hooks.afterCompile.tap("AutomaticPrefetchPlugin", compilation => { - lastModules = []; + const oldInfo = this.assetsInfo.get(file); + const newInfo = Object.assign({}, oldInfo, assetInfo); + this._setAssetInfo(file, newInfo, oldInfo); + return; + } + this.assets[file] = source; + this._setAssetInfo(file, assetInfo, undefined); + } - for (const m of compilation.modules) { - if (m instanceof NormalModule) { - lastModules.push({ - context: m.context, - request: m.request - }); + _setAssetInfo(file, newInfo, oldInfo = this.assetsInfo.get(file)) { + if (newInfo === undefined) { + this.assetsInfo.delete(file); + } else { + this.assetsInfo.set(file, newInfo); + } + const oldRelated = oldInfo && oldInfo.related; + const newRelated = newInfo && newInfo.related; + if (oldRelated) { + for (const key of Object.keys(oldRelated)) { + const remove = name => { + const relatedIn = this._assetsRelatedIn.get(name); + if (relatedIn === undefined) return; + const entry = relatedIn.get(key); + if (entry === undefined) return; + entry.delete(file); + if (entry.size !== 0) return; + relatedIn.delete(key); + if (relatedIn.size === 0) this._assetsRelatedIn.delete(name); + }; + const entry = oldRelated[key]; + if (Array.isArray(entry)) { + entry.forEach(remove); + } else if (entry) { + remove(entry); } } - }); - compiler.hooks.make.tapAsync( - "AutomaticPrefetchPlugin", - (compilation, callback) => { - if (!lastModules) return callback(); - asyncLib.forEach( - lastModules, - (m, callback) => { - compilation.addModuleChain( - m.context || compiler.context, - new PrefetchDependency(`!!${m.request}`), - callback - ); - }, - err => { - lastModules = null; - callback(err); + } + if (newRelated) { + for (const key of Object.keys(newRelated)) { + const add = name => { + let relatedIn = this._assetsRelatedIn.get(name); + if (relatedIn === undefined) { + this._assetsRelatedIn.set(name, (relatedIn = new Map())); } - ); + let entry = relatedIn.get(key); + if (entry === undefined) { + relatedIn.set(key, (entry = new Set())); + } + entry.add(file); + }; + const entry = newRelated[key]; + if (Array.isArray(entry)) { + entry.forEach(add); + } else if (entry) { + add(entry); + } } - ); - } -} -module.exports = AutomaticPrefetchPlugin; - - -/***/ }), - -/***/ 21242: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { ConcatSource } = __webpack_require__(51255); -const Compilation = __webpack_require__(85720); -const ModuleFilenameHelpers = __webpack_require__(88821); -const Template = __webpack_require__(39722); -const createSchemaValidation = __webpack_require__(32540); - -/** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginArgument} BannerPluginArgument */ -/** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginOptions} BannerPluginOptions */ -/** @typedef {import("./Compiler")} Compiler */ - -const validate = createSchemaValidation( - __webpack_require__(42173), - () => __webpack_require__(49052), - { - name: "Banner Plugin", - baseDataPath: "options" - } -); - -const wrapComment = str => { - if (!str.includes("\n")) { - return Template.toComment(str); + } } - return `/*!\n * ${str - .replace(/\*\//g, "* /") - .split("\n") - .join("\n * ") - .replace(/\s+\n/g, "\n") - .trimRight()}\n */`; -}; -class BannerPlugin { /** - * @param {BannerPluginArgument} options options object + * @param {string} file file name + * @param {Source | function(Source): Source} newSourceOrFunction new asset source or function converting old to new + * @param {AssetInfo | function(AssetInfo | undefined): AssetInfo} assetInfoUpdateOrFunction new asset info or function converting old to new */ - constructor(options) { - if (typeof options === "string" || typeof options === "function") { - options = { - banner: options - }; + updateAsset( + file, + newSourceOrFunction, + assetInfoUpdateOrFunction = undefined + ) { + if (!this.assets[file]) { + throw new Error( + `Called Compilation.updateAsset for not existing filename ${file}` + ); } - - validate(options); - - this.options = options; - - const bannerOption = options.banner; - if (typeof bannerOption === "function") { - const getBanner = bannerOption; - this.banner = this.options.raw - ? getBanner - : data => wrapComment(getBanner(data)); + if (typeof newSourceOrFunction === "function") { + this.assets[file] = newSourceOrFunction(this.assets[file]); } else { - const banner = this.options.raw - ? bannerOption - : wrapComment(bannerOption); - this.banner = () => banner; + this.assets[file] = newSourceOrFunction; + } + if (assetInfoUpdateOrFunction !== undefined) { + const oldInfo = this.assetsInfo.get(file) || EMPTY_ASSET_INFO; + if (typeof assetInfoUpdateOrFunction === "function") { + this._setAssetInfo(file, assetInfoUpdateOrFunction(oldInfo), oldInfo); + } else { + this._setAssetInfo( + file, + cachedCleverMerge(oldInfo, assetInfoUpdateOrFunction), + oldInfo + ); + } } } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const options = this.options; - const banner = this.banner; - const matchObject = ModuleFilenameHelpers.matchObject.bind( - undefined, - options - ); - - compiler.hooks.compilation.tap("BannerPlugin", compilation => { - compilation.hooks.processAssets.tap( - { - name: "BannerPlugin", - stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS - }, - () => { - for (const chunk of compilation.chunks) { - if (options.entryOnly && !chunk.canBeInitial()) { - continue; + renameAsset(file, newFile) { + const source = this.assets[file]; + if (!source) { + throw new Error( + `Called Compilation.renameAsset for not existing filename ${file}` + ); + } + if (this.assets[newFile]) { + if (!isSourceEqual(this.assets[file], source)) { + this.errors.push( + new WebpackError( + `Conflict: Called Compilation.renameAsset for already existing filename ${newFile} with different content` + ) + ); + } + } + const assetInfo = this.assetsInfo.get(file); + // Update related in all other assets + const relatedInInfo = this._assetsRelatedIn.get(file); + if (relatedInInfo) { + for (const [key, assets] of relatedInInfo) { + for (const name of assets) { + const info = this.assetsInfo.get(name); + if (!info) continue; + const related = info.related; + if (!related) continue; + const entry = related[key]; + let newEntry; + if (Array.isArray(entry)) { + newEntry = entry.map(x => (x === file ? newFile : x)); + } else if (entry === file) { + newEntry = newFile; + } else continue; + this.assetsInfo.set(name, { + ...info, + related: { + ...related, + [key]: newEntry } + }); + } + } + } + this._setAssetInfo(file, undefined, assetInfo); + this._setAssetInfo(newFile, assetInfo); + delete this.assets[file]; + this.assets[newFile] = source; + for (const chunk of this.chunks) { + { + const size = chunk.files.size; + chunk.files.delete(file); + if (size !== chunk.files.size) { + chunk.files.add(newFile); + } + } + { + const size = chunk.auxiliaryFiles.size; + chunk.auxiliaryFiles.delete(file); + if (size !== chunk.auxiliaryFiles.size) { + chunk.auxiliaryFiles.add(newFile); + } + } + } + } - for (const file of chunk.files) { - if (!matchObject(file)) { - continue; - } + /** + * @param {string} file file name + */ + deleteAsset(file) { + if (!this.assets[file]) { + return; + } + delete this.assets[file]; + const assetInfo = this.assetsInfo.get(file); + this._setAssetInfo(file, undefined, assetInfo); + const related = assetInfo && assetInfo.related; + if (related) { + for (const key of Object.keys(related)) { + const checkUsedAndDelete = file => { + if (!this._assetsRelatedIn.has(file)) { + this.deleteAsset(file); + } + }; + const items = related[key]; + if (Array.isArray(items)) { + items.forEach(checkUsedAndDelete); + } else if (items) { + checkUsedAndDelete(items); + } + } + } + // TODO If this becomes a performance problem + // store a reverse mapping from asset to chunk + for (const chunk of this.chunks) { + chunk.files.delete(file); + chunk.auxiliaryFiles.delete(file); + } + } - const data = { - chunk, - filename: file - }; + getAssets() { + /** @type {Readonly[]} */ + const array = []; + for (const assetName of Object.keys(this.assets)) { + if (Object.prototype.hasOwnProperty.call(this.assets, assetName)) { + array.push({ + name: assetName, + source: this.assets[assetName], + info: this.assetsInfo.get(assetName) || EMPTY_ASSET_INFO + }); + } + } + return array; + } - const comment = compilation.getPath(banner, data); + /** + * @param {string} name the name of the asset + * @returns {Readonly | undefined} the asset or undefined when not found + */ + getAsset(name) { + if (!Object.prototype.hasOwnProperty.call(this.assets, name)) + return undefined; + return { + name, + source: this.assets[name], + info: this.assetsInfo.get(name) || EMPTY_ASSET_INFO + }; + } - compilation.updateAsset( - file, - old => new ConcatSource(comment, "\n", old) - ); - } + clearAssets() { + for (const chunk of this.chunks) { + chunk.files.clear(); + chunk.auxiliaryFiles.clear(); + } + } + + createModuleAssets() { + const { chunkGraph } = this; + for (const module of this.modules) { + if (module.buildInfo.assets) { + const assetsInfo = module.buildInfo.assetsInfo; + for (const assetName of Object.keys(module.buildInfo.assets)) { + const fileName = this.getPath(assetName, { + chunkGraph: this.chunkGraph, + module + }); + for (const chunk of chunkGraph.getModuleChunksIterable(module)) { + chunk.auxiliaryFiles.add(fileName); } + this.emitAsset( + fileName, + module.buildInfo.assets[assetName], + assetsInfo ? assetsInfo.get(assetName) : undefined + ); + this.hooks.moduleAsset.call(module, fileName); } - ); - }); + } + } } -} -module.exports = BannerPlugin; + /** + * @param {RenderManifestOptions} options options object + * @returns {RenderManifestEntry[]} manifest entries + */ + getRenderManifest(options) { + return this.hooks.renderManifest.call([], options); + } + /** + * @param {Callback} callback signals when the call finishes + * @returns {void} + */ + createChunkAssets(callback) { + const outputOptions = this.outputOptions; + const cachedSourceMap = new WeakMap(); + /** @type {Map} */ + const alreadyWrittenFiles = new Map(); -/***/ }), + asyncLib.forEachLimit( + this.chunks, + 15, + (chunk, callback) => { + /** @type {RenderManifestEntry[]} */ + let manifest; + try { + manifest = this.getRenderManifest({ + chunk, + hash: this.hash, + fullHash: this.fullHash, + outputOptions, + codeGenerationResults: this.codeGenerationResults, + moduleTemplates: this.moduleTemplates, + dependencyTemplates: this.dependencyTemplates, + chunkGraph: this.chunkGraph, + moduleGraph: this.moduleGraph, + runtimeTemplate: this.runtimeTemplate + }); + } catch (err) { + this.errors.push(new ChunkRenderError(chunk, "", err)); + return callback(); + } + asyncLib.forEach( + manifest, + (fileManifest, callback) => { + const ident = fileManifest.identifier; + const usedHash = fileManifest.hash; -/***/ 7592: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + const assetCacheItem = this._assetsCache.getItemCache( + ident, + usedHash + ); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + assetCacheItem.get((err, sourceFromCache) => { + /** @type {string | function(PathData, AssetInfo=): string} */ + let filenameTemplate; + /** @type {string} */ + let file; + /** @type {AssetInfo} */ + let assetInfo; + let inTry = true; + const errorAndCallback = err => { + const filename = + file || + (typeof file === "string" + ? file + : typeof filenameTemplate === "string" + ? filenameTemplate + : ""); + this.errors.push(new ChunkRenderError(chunk, filename, err)); + inTry = false; + return callback(); + }; -const { AsyncParallelHook, AsyncSeriesBailHook, SyncHook } = __webpack_require__(41242); -const { - makeWebpackError, - makeWebpackErrorCallback -} = __webpack_require__(11351); + try { + if ("filename" in fileManifest) { + file = fileManifest.filename; + assetInfo = fileManifest.info; + } else { + filenameTemplate = fileManifest.filenameTemplate; + const pathAndInfo = this.getPathWithInfo( + filenameTemplate, + fileManifest.pathOptions + ); + file = pathAndInfo.path; + assetInfo = fileManifest.info + ? { + ...pathAndInfo.info, + ...fileManifest.info + } + : pathAndInfo.info; + } -/** @typedef {import("./WebpackError")} WebpackError */ + if (err) { + return errorAndCallback(err); + } -/** - * @typedef {Object} Etag - * @property {function(): string} toString - */ + let source = sourceFromCache; -/** - * @template T - * @callback CallbackCache - * @param {(WebpackError | null)=} err - * @param {T=} result - * @returns {void} - */ + // check if the same filename was already written by another chunk + const alreadyWritten = alreadyWrittenFiles.get(file); + if (alreadyWritten !== undefined) { + if (alreadyWritten.hash !== usedHash) { + inTry = false; + return callback( + new WebpackError( + `Conflict: Multiple chunks emit assets to the same filename ${file}` + + ` (chunks ${alreadyWritten.chunk.id} and ${chunk.id})` + ) + ); + } else { + source = alreadyWritten.source; + } + } else if (!source) { + // render the asset + source = fileManifest.render(); -/** - * @callback GotHandler - * @param {any} result - * @param {function(Error=): void} callback - * @returns {void} - */ + // Ensure that source is a cached source to avoid additional cost because of repeated access + if (!(source instanceof CachedSource)) { + const cacheEntry = cachedSourceMap.get(source); + if (cacheEntry) { + source = cacheEntry; + } else { + const cachedSource = new CachedSource(source); + cachedSourceMap.set(source, cachedSource); + source = cachedSource; + } + } + } + this.emitAsset(file, source, assetInfo); + if (fileManifest.auxiliary) { + chunk.auxiliaryFiles.add(file); + } else { + chunk.files.add(file); + } + this.hooks.chunkAsset.call(chunk, file); + alreadyWrittenFiles.set(file, { + hash: usedHash, + source, + chunk + }); + if (source !== sourceFromCache) { + assetCacheItem.store(source, err => { + if (err) return errorAndCallback(err); + inTry = false; + return callback(); + }); + } else { + inTry = false; + callback(); + } + } catch (err) { + if (!inTry) throw err; + errorAndCallback(err); + } + }); + }, + callback + ); + }, + callback + ); + } -const needCalls = (times, callback) => { - return err => { - if (--times === 0) { - return callback(err); - } - if (err && times > 0) { - times = 0; - return callback(err); + /** + * @param {string | function(PathData, AssetInfo=): string} filename used to get asset path with hash + * @param {PathData} data context data + * @returns {string} interpolated path + */ + getPath(filename, data = {}) { + if (!data.hash) { + data = { + hash: this.hash, + ...data + }; } - }; -}; - -class Cache { - constructor() { - this.hooks = { - /** @type {AsyncSeriesBailHook<[string, Etag | null, GotHandler[]], any>} */ - get: new AsyncSeriesBailHook(["identifier", "etag", "gotHandlers"]), - /** @type {AsyncParallelHook<[string, Etag | null, any]>} */ - store: new AsyncParallelHook(["identifier", "etag", "data"]), - /** @type {AsyncParallelHook<[Iterable]>} */ - storeBuildDependencies: new AsyncParallelHook(["dependencies"]), - /** @type {SyncHook<[]>} */ - beginIdle: new SyncHook([]), - /** @type {AsyncParallelHook<[]>} */ - endIdle: new AsyncParallelHook([]), - /** @type {AsyncParallelHook<[]>} */ - shutdown: new AsyncParallelHook([]) - }; + return this.getAssetPath(filename, data); } /** - * @template T - * @param {string} identifier the cache identifier - * @param {Etag | null} etag the etag - * @param {CallbackCache} callback signals when the value is retrieved - * @returns {void} + * @param {string | function(PathData, AssetInfo=): string} filename used to get asset path with hash + * @param {PathData} data context data + * @returns {{ path: string, info: AssetInfo }} interpolated path and asset info */ - get(identifier, etag, callback) { - const gotHandlers = []; - this.hooks.get.callAsync(identifier, etag, gotHandlers, (err, result) => { - if (err) { - callback(makeWebpackError(err, "Cache.hooks.get")); - return; - } - if (result === null) { - result = undefined; - } - if (gotHandlers.length > 1) { - const innerCallback = needCalls(gotHandlers.length, () => - callback(null, result) - ); - for (const gotHandler of gotHandlers) { - gotHandler(result, innerCallback); - } - } else if (gotHandlers.length === 1) { - gotHandlers[0](result, () => callback(null, result)); - } else { - callback(null, result); - } - }); + getPathWithInfo(filename, data = {}) { + if (!data.hash) { + data = { + hash: this.hash, + ...data + }; + } + return this.getAssetPathWithInfo(filename, data); } /** - * @template T - * @param {string} identifier the cache identifier - * @param {Etag | null} etag the etag - * @param {T} data the value to store - * @param {CallbackCache} callback signals when the value is stored - * @returns {void} + * @param {string | function(PathData, AssetInfo=): string} filename used to get asset path with hash + * @param {PathData} data context data + * @returns {string} interpolated path */ - store(identifier, etag, data, callback) { - this.hooks.store.callAsync( - identifier, - etag, + getAssetPath(filename, data) { + return this.hooks.assetPath.call( + typeof filename === "function" ? filename(data) : filename, data, - makeWebpackErrorCallback(callback, "Cache.hooks.store") + undefined ); } /** - * After this method has succeeded the cache can only be restored when build dependencies are - * @param {Iterable} dependencies list of all build dependencies - * @param {CallbackCache} callback signals when the dependencies are stored - * @returns {void} + * @param {string | function(PathData, AssetInfo=): string} filename used to get asset path with hash + * @param {PathData} data context data + * @returns {{ path: string, info: AssetInfo }} interpolated path and asset info */ - storeBuildDependencies(dependencies, callback) { - this.hooks.storeBuildDependencies.callAsync( - dependencies, - makeWebpackErrorCallback(callback, "Cache.hooks.storeBuildDependencies") + getAssetPathWithInfo(filename, data) { + const assetInfo = {}; + // TODO webpack 5: refactor assetPath hook to receive { path, info } object + const newPath = this.hooks.assetPath.call( + typeof filename === "function" ? filename(data, assetInfo) : filename, + data, + assetInfo ); + return { path: newPath, info: assetInfo }; } - /** - * @returns {void} - */ - beginIdle() { - this.hooks.beginIdle.call(); + getWarnings() { + return this.hooks.processWarnings.call(this.warnings); } - /** - * @param {CallbackCache} callback signals when the call finishes - * @returns {void} - */ - endIdle(callback) { - this.hooks.endIdle.callAsync( - makeWebpackErrorCallback(callback, "Cache.hooks.endIdle") - ); + getErrors() { + return this.hooks.processErrors.call(this.errors); } /** - * @param {CallbackCache} callback signals when the call finishes - * @returns {void} + * This function allows you to run another instance of webpack inside of webpack however as + * a child with different settings and configurations (if desired) applied. It copies all hooks, plugins + * from parent (or top level compiler) and creates a child Compilation + * + * @param {string} name name of the child compiler + * @param {OutputOptions=} outputOptions // Need to convert config schema to types for this + * @param {Array=} plugins webpack plugins that will be applied + * @returns {Compiler} creates a child Compiler instance */ - shutdown(callback) { - this.hooks.shutdown.callAsync( - makeWebpackErrorCallback(callback, "Cache.hooks.shutdown") - ); - } -} + createChildCompiler(name, outputOptions, plugins) { + const idx = this.childrenCounters[name] || 0; + this.childrenCounters[name] = idx + 1; + return this.compiler.createChildCompiler( + this, + name, + idx, + outputOptions, + plugins + ); + } -Cache.STAGE_MEMORY = -10; -Cache.STAGE_DEFAULT = 0; -Cache.STAGE_DISK = 10; -Cache.STAGE_NETWORK = 20; + /** + * @param {Module} module the module + * @param {ExecuteModuleOptions} options options + * @param {ExecuteModuleCallback} callback callback + */ + executeModule(module, options, callback) { + // Aggregate all referenced modules and ensure they are ready + const modules = new Set([module]); + processAsyncTree( + modules, + 10, + /** + * @param {Module} module the module + * @param {function(Module): void} push push more jobs + * @param {Callback} callback callback + * @returns {void} + */ + (module, push, callback) => { + this.buildQueue.waitFor(module, err => { + if (err) return callback(err); + this.processDependenciesQueue.waitFor(module, err => { + if (err) return callback(err); + for (const { module: m } of this.moduleGraph.getOutgoingConnections( + module + )) { + const size = modules.size; + modules.add(m); + if (modules.size !== size) push(m); + } + callback(); + }); + }); + }, + err => { + if (err) return callback(err); -module.exports = Cache; + // Create new chunk graph, chunk and entrypoint for the build time execution + const chunkGraph = new ChunkGraph( + this.moduleGraph, + this.outputOptions.hashFunction + ); + const runtime = "build time"; + const { hashFunction, hashDigest, hashDigestLength } = + this.outputOptions; + const runtimeTemplate = this.runtimeTemplate; + const chunk = new Chunk("build time chunk", this._backCompat); + chunk.id = chunk.name; + chunk.ids = [chunk.id]; + chunk.runtime = runtime; -/***/ }), + const entrypoint = new Entrypoint({ + runtime, + chunkLoading: false, + ...options.entryOptions + }); + chunkGraph.connectChunkAndEntryModule(chunk, module, entrypoint); + connectChunkGroupAndChunk(entrypoint, chunk); + entrypoint.setRuntimeChunk(chunk); + entrypoint.setEntrypointChunk(chunk); -/***/ 55392: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + const chunks = new Set([chunk]); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // Assign ids to modules and modules to the chunk + for (const module of modules) { + const id = module.identifier(); + chunkGraph.setModuleId(module, id); + chunkGraph.connectChunkAndModule(chunk, module); + } + // Hash modules + for (const module of modules) { + this._createModuleHash( + module, + chunkGraph, + runtime, + hashFunction, + runtimeTemplate, + hashDigest, + hashDigestLength + ); + } + const codeGenerationResults = new CodeGenerationResults( + this.outputOptions.hashFunction + ); + /** @type {WebpackError[]} */ + const errors = []; + /** + * @param {Module} module the module + * @param {Callback} callback callback + * @returns {void} + */ + const codeGen = (module, callback) => { + this._codeGenerationModule( + module, + runtime, + [runtime], + chunkGraph.getModuleHash(module, runtime), + this.dependencyTemplates, + chunkGraph, + this.moduleGraph, + runtimeTemplate, + errors, + codeGenerationResults, + (err, codeGenerated) => { + callback(err); + } + ); + }; -const { forEachBail } = __webpack_require__(30662); -const asyncLib = __webpack_require__(78175); -const getLazyHashedEtag = __webpack_require__(94075); -const mergeEtags = __webpack_require__(54980); + const reportErrors = () => { + if (errors.length > 0) { + errors.sort( + compareSelect(err => err.module, compareModulesByIdentifier) + ); + for (const error of errors) { + this.errors.push(error); + } + errors.length = 0; + } + }; -/** @typedef {import("./Cache")} Cache */ -/** @typedef {import("./Cache").Etag} Etag */ -/** @typedef {import("./WebpackError")} WebpackError */ -/** @typedef {import("./cache/getLazyHashedEtag").HashableObject} HashableObject */ -/** @typedef {typeof import("./util/Hash")} HashConstructor */ + // Generate code for all aggregated modules + asyncLib.eachLimit(modules, 10, codeGen, err => { + if (err) return callback(err); + reportErrors(); -/** - * @template T - * @callback CallbackCache - * @param {(WebpackError | null)=} err - * @param {T=} result - * @returns {void} - */ + // for backward-compat temporary set the chunk graph + // TODO webpack 6 + const old = this.chunkGraph; + this.chunkGraph = chunkGraph; + this.processRuntimeRequirements({ + chunkGraph, + modules, + chunks, + codeGenerationResults, + chunkGraphEntries: chunks + }); + this.chunkGraph = old; -/** - * @template T - * @callback CallbackNormalErrorCache - * @param {(Error | null)=} err - * @param {T=} result - * @returns {void} - */ + const runtimeModules = + chunkGraph.getChunkRuntimeModulesIterable(chunk); -class MultiItemCache { - /** - * @param {ItemCacheFacade[]} items item caches - */ - constructor(items) { - this._items = items; - if (items.length === 1) return /** @type {any} */ (items[0]); - } + // Hash runtime modules + for (const module of runtimeModules) { + modules.add(module); + this._createModuleHash( + module, + chunkGraph, + runtime, + hashFunction, + runtimeTemplate, + hashDigest, + hashDigestLength + ); + } - /** - * @template T - * @param {CallbackCache} callback signals when the value is retrieved - * @returns {void} - */ - get(callback) { - forEachBail(this._items, (item, callback) => item.get(callback), callback); - } + // Generate code for all runtime modules + asyncLib.eachLimit(runtimeModules, 10, codeGen, err => { + if (err) return callback(err); + reportErrors(); - /** - * @template T - * @returns {Promise} promise with the data - */ - getPromise() { - const next = i => { - return this._items[i].getPromise().then(result => { - if (result !== undefined) return result; - if (++i < this._items.length) return next(i); - }); - }; - return next(0); - } + /** @type {Map} */ + const moduleArgumentsMap = new Map(); + /** @type {Map} */ + const moduleArgumentsById = new Map(); - /** - * @template T - * @param {T} data the value to store - * @param {CallbackCache} callback signals when the value is stored - * @returns {void} - */ - store(data, callback) { - asyncLib.each( - this._items, - (item, callback) => item.store(data, callback), - callback - ); - } + /** @type {ExecuteModuleResult["fileDependencies"]} */ + const fileDependencies = new LazySet(); + /** @type {ExecuteModuleResult["contextDependencies"]} */ + const contextDependencies = new LazySet(); + /** @type {ExecuteModuleResult["missingDependencies"]} */ + const missingDependencies = new LazySet(); + /** @type {ExecuteModuleResult["buildDependencies"]} */ + const buildDependencies = new LazySet(); - /** - * @template T - * @param {T} data the value to store - * @returns {Promise} promise signals when the value is stored - */ - storePromise(data) { - return Promise.all(this._items.map(item => item.storePromise(data))).then( - () => {} - ); - } -} + /** @type {ExecuteModuleResult["assets"]} */ + const assets = new Map(); -class ItemCacheFacade { - /** - * @param {Cache} cache the root cache - * @param {string} name the child cache item name - * @param {Etag | null} etag the etag - */ - constructor(cache, name, etag) { - this._cache = cache; - this._name = name; - this._etag = etag; - } + let cacheable = true; - /** - * @template T - * @param {CallbackCache} callback signals when the value is retrieved - * @returns {void} - */ - get(callback) { - this._cache.get(this._name, this._etag, callback); - } + /** @type {ExecuteModuleContext} */ + const context = { + assets, + __webpack_require__: undefined, + chunk, + chunkGraph + }; - /** - * @template T - * @returns {Promise} promise with the data - */ - getPromise() { - return new Promise((resolve, reject) => { - this._cache.get(this._name, this._etag, (err, data) => { - if (err) { - reject(err); - } else { - resolve(data); - } - }); - }); - } + // Prepare execution + asyncLib.eachLimit( + modules, + 10, + (module, callback) => { + const codeGenerationResult = codeGenerationResults.get( + module, + runtime + ); + /** @type {ExecuteModuleArgument} */ + const moduleArgument = { + module, + codeGenerationResult, + preparedInfo: undefined, + moduleObject: undefined + }; + moduleArgumentsMap.set(module, moduleArgument); + moduleArgumentsById.set(module.identifier(), moduleArgument); + module.addCacheDependencies( + fileDependencies, + contextDependencies, + missingDependencies, + buildDependencies + ); + if (module.buildInfo.cacheable === false) { + cacheable = false; + } + if (module.buildInfo && module.buildInfo.assets) { + const { assets: moduleAssets, assetsInfo } = module.buildInfo; + for (const assetName of Object.keys(moduleAssets)) { + assets.set(assetName, { + source: moduleAssets[assetName], + info: assetsInfo ? assetsInfo.get(assetName) : undefined + }); + } + } + this.hooks.prepareModuleExecution.callAsync( + moduleArgument, + context, + callback + ); + }, + err => { + if (err) return callback(err); - /** - * @template T - * @param {T} data the value to store - * @param {CallbackCache} callback signals when the value is stored - * @returns {void} - */ - store(data, callback) { - this._cache.store(this._name, this._etag, data, callback); - } + let exports; + try { + const { + strictModuleErrorHandling, + strictModuleExceptionHandling + } = this.outputOptions; + const __nested_webpack_require_152432__ = id => { + const cached = moduleCache[id]; + if (cached !== undefined) { + if (cached.error) throw cached.error; + return cached.exports; + } + const moduleArgument = moduleArgumentsById.get(id); + return __webpack_require_module__(moduleArgument, id); + }; + const interceptModuleExecution = (__nested_webpack_require_152432__[ + RuntimeGlobals.interceptModuleExecution.replace( + "__webpack_require__.", + "" + ) + ] = []); + const moduleCache = (__nested_webpack_require_152432__[ + RuntimeGlobals.moduleCache.replace( + "__webpack_require__.", + "" + ) + ] = {}); - /** - * @template T - * @param {T} data the value to store - * @returns {Promise} promise signals when the value is stored - */ - storePromise(data) { - return new Promise((resolve, reject) => { - this._cache.store(this._name, this._etag, data, err => { - if (err) { - reject(err); - } else { - resolve(); - } - }); - }); - } + context.__webpack_require__ = __nested_webpack_require_152432__; - /** - * @template T - * @param {function(CallbackNormalErrorCache): void} computer function to compute the value if not cached - * @param {CallbackNormalErrorCache} callback signals when the value is retrieved - * @returns {void} - */ - provide(computer, callback) { - this.get((err, cacheEntry) => { - if (err) return callback(err); - if (cacheEntry !== undefined) return cacheEntry; - computer((err, result) => { - if (err) return callback(err); - this.store(result, err => { - if (err) return callback(err); - callback(null, result); - }); - }); - }); - } + /** + * @param {ExecuteModuleArgument} moduleArgument the module argument + * @param {string=} id id + * @returns {any} exports + */ + const __webpack_require_module__ = (moduleArgument, id) => { + var execOptions = { + id, + module: { + id, + exports: {}, + loaded: false, + error: undefined + }, + require: __nested_webpack_require_152432__ + }; + interceptModuleExecution.forEach(handler => + handler(execOptions) + ); + const module = moduleArgument.module; + this.buildTimeExecutedModules.add(module); + const moduleObject = execOptions.module; + moduleArgument.moduleObject = moduleObject; + try { + if (id) moduleCache[id] = moduleObject; - /** - * @template T - * @param {function(): Promise | T} computer function to compute the value if not cached - * @returns {Promise} promise with the data - */ - async providePromise(computer) { - const cacheEntry = await this.getPromise(); - if (cacheEntry !== undefined) return cacheEntry; - const result = await computer(); - await this.storePromise(result); - return result; - } -} + tryRunOrWebpackError( + () => + this.hooks.executeModule.call( + moduleArgument, + context + ), + "Compilation.hooks.executeModule" + ); + moduleObject.loaded = true; + return moduleObject.exports; + } catch (e) { + if (strictModuleExceptionHandling) { + if (id) delete moduleCache[id]; + } else if (strictModuleErrorHandling) { + moduleObject.error = e; + } + if (!e.module) e.module = module; + throw e; + } + }; -class CacheFacade { - /** - * @param {Cache} cache the root cache - * @param {string} name the child cache name - * @param {string | HashConstructor} hashFunction the hash function to use - */ - constructor(cache, name, hashFunction) { - this._cache = cache; - this._name = name; - this._hashFunction = hashFunction; - } + for (const runtimeModule of chunkGraph.getChunkRuntimeModulesInOrder( + chunk + )) { + __webpack_require_module__( + moduleArgumentsMap.get(runtimeModule) + ); + } + exports = __nested_webpack_require_152432__(module.identifier()); + } catch (e) { + const err = new WebpackError( + `Execution of module code from module graph (${module.readableIdentifier( + this.requestShortener + )}) failed: ${e.message}` + ); + err.stack = e.stack; + err.module = e.module; + return callback(err); + } - /** - * @param {string} name the child cache name# - * @returns {CacheFacade} child cache - */ - getChildCache(name) { - return new CacheFacade( - this._cache, - `${this._name}|${name}`, - this._hashFunction - ); - } - - /** - * @param {string} identifier the cache identifier - * @param {Etag | null} etag the etag - * @returns {ItemCacheFacade} item cache - */ - getItemCache(identifier, etag) { - return new ItemCacheFacade( - this._cache, - `${this._name}|${identifier}`, - etag + callback(null, { + exports, + assets, + cacheable, + fileDependencies, + contextDependencies, + missingDependencies, + buildDependencies + }); + } + ); + }); + }); + } ); } - /** - * @param {HashableObject} obj an hashable object - * @returns {Etag} an etag that is lazy hashed - */ - getLazyHashedEtag(obj) { - return getLazyHashedEtag(obj, this._hashFunction); - } + checkConstraints() { + const chunkGraph = this.chunkGraph; - /** - * @param {Etag} a an etag - * @param {Etag} b another etag - * @returns {Etag} an etag that represents both - */ - mergeEtags(a, b) { - return mergeEtags(a, b); - } + /** @type {Set} */ + const usedIds = new Set(); - /** - * @template T - * @param {string} identifier the cache identifier - * @param {Etag | null} etag the etag - * @param {CallbackCache} callback signals when the value is retrieved - * @returns {void} - */ - get(identifier, etag, callback) { - this._cache.get(`${this._name}|${identifier}`, etag, callback); - } + for (const module of this.modules) { + if (module.type === "runtime") continue; + const moduleId = chunkGraph.getModuleId(module); + if (moduleId === null) continue; + if (usedIds.has(moduleId)) { + throw new Error(`checkConstraints: duplicate module id ${moduleId}`); + } + usedIds.add(moduleId); + } - /** - * @template T - * @param {string} identifier the cache identifier - * @param {Etag | null} etag the etag - * @returns {Promise} promise with the data - */ - getPromise(identifier, etag) { - return new Promise((resolve, reject) => { - this._cache.get(`${this._name}|${identifier}`, etag, (err, data) => { - if (err) { - reject(err); - } else { - resolve(data); + for (const chunk of this.chunks) { + for (const module of chunkGraph.getChunkModulesIterable(chunk)) { + if (!this.modules.has(module)) { + throw new Error( + "checkConstraints: module in chunk but not in compilation " + + ` ${chunk.debugId} ${module.debugId}` + ); } - }); - }); - } + } + for (const module of chunkGraph.getChunkEntryModulesIterable(chunk)) { + if (!this.modules.has(module)) { + throw new Error( + "checkConstraints: entry module in chunk but not in compilation " + + ` ${chunk.debugId} ${module.debugId}` + ); + } + } + } - /** - * @template T - * @param {string} identifier the cache identifier - * @param {Etag | null} etag the etag - * @param {T} data the value to store - * @param {CallbackCache} callback signals when the value is stored - * @returns {void} - */ - store(identifier, etag, data, callback) { - this._cache.store(`${this._name}|${identifier}`, etag, data, callback); + for (const chunkGroup of this.chunkGroups) { + chunkGroup.checkConstraints(); + } } +} - /** - * @template T - * @param {string} identifier the cache identifier - * @param {Etag | null} etag the etag - * @param {T} data the value to store - * @returns {Promise} promise signals when the value is stored - */ - storePromise(identifier, etag, data) { - return new Promise((resolve, reject) => { - this._cache.store(`${this._name}|${identifier}`, etag, data, err => { - if (err) { - reject(err); - } else { - resolve(); - } - }); - }); - } +/** + * @typedef {Object} FactorizeModuleOptions + * @property {ModuleProfile} currentProfile + * @property {ModuleFactory} factory + * @property {Dependency[]} dependencies + * @property {boolean=} factoryResult return full ModuleFactoryResult instead of only module + * @property {Module | null} originModule + * @property {Partial=} contextInfo + * @property {string=} context + */ - /** - * @template T - * @param {string} identifier the cache identifier - * @param {Etag | null} etag the etag - * @param {function(CallbackNormalErrorCache): void} computer function to compute the value if not cached - * @param {CallbackNormalErrorCache} callback signals when the value is retrieved - * @returns {void} - */ - provide(identifier, etag, computer, callback) { - this.get(identifier, etag, (err, cacheEntry) => { - if (err) return callback(err); - if (cacheEntry !== undefined) return cacheEntry; - computer((err, result) => { - if (err) return callback(err); - this.store(identifier, etag, result, err => { - if (err) return callback(err); - callback(null, result); - }); - }); - }); +/** + * @param {FactorizeModuleOptions} options options object + * @param {ModuleCallback | ModuleFactoryResultCallback} callback callback + * @returns {void} + */ + +// Workaround for typescript as it doesn't support function overloading in jsdoc within a class +Compilation.prototype.factorizeModule = /** @type {{ + (options: FactorizeModuleOptions & { factoryResult?: false }, callback: ModuleCallback): void; + (options: FactorizeModuleOptions & { factoryResult: true }, callback: ModuleFactoryResultCallback): void; +}} */ ( + function (options, callback) { + this.factorizeQueue.add(options, callback); } +); - /** - * @template T - * @param {string} identifier the cache identifier - * @param {Etag | null} etag the etag - * @param {function(): Promise | T} computer function to compute the value if not cached - * @returns {Promise} promise with the data - */ - async providePromise(identifier, etag, computer) { - const cacheEntry = await this.getPromise(identifier, etag); - if (cacheEntry !== undefined) return cacheEntry; - const result = await computer(); - await this.storePromise(identifier, etag, result); - return result; +// Hide from typescript +const compilationPrototype = Compilation.prototype; + +// TODO webpack 6 remove +Object.defineProperty(compilationPrototype, "modifyHash", { + writable: false, + enumerable: false, + configurable: false, + value: () => { + throw new Error( + "Compilation.modifyHash was removed in favor of Compilation.hooks.fullHash" + ); } -} +}); -module.exports = CacheFacade; -module.exports.ItemCacheFacade = ItemCacheFacade; -module.exports.MultiItemCache = MultiItemCache; +// TODO webpack 6 remove +Object.defineProperty(compilationPrototype, "cache", { + enumerable: false, + configurable: false, + get: util.deprecate( + /** + * @this {Compilation} the compilation + * @returns {Cache} the cache + */ + function () { + return this.compiler.cache; + }, + "Compilation.cache was removed in favor of Compilation.getCache()", + "DEP_WEBPACK_COMPILATION_CACHE" + ), + set: util.deprecate( + v => {}, + "Compilation.cache was removed in favor of Compilation.getCache()", + "DEP_WEBPACK_COMPILATION_CACHE" + ) +}); +/** + * Add additional assets to the compilation. + */ +Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL = -2000; -/***/ }), +/** + * Basic preprocessing of assets. + */ +Compilation.PROCESS_ASSETS_STAGE_PRE_PROCESS = -1000; -/***/ 77975: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * Derive new assets from existing assets. + * Existing assets should not be treated as complete. + */ +Compilation.PROCESS_ASSETS_STAGE_DERIVED = -200; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** + * Add additional sections to existing assets, like a banner or initialization code. + */ +Compilation.PROCESS_ASSETS_STAGE_ADDITIONS = -100; + +/** + * Optimize existing assets in a general way. + */ +Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE = 100; +/** + * Optimize the count of existing assets, e. g. by merging them. + * Only assets of the same type should be merged. + * For assets of different types see PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE. + */ +Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT = 200; +/** + * Optimize the compatibility of existing assets, e. g. add polyfills or vendor-prefixes. + */ +Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY = 300; -const WebpackError = __webpack_require__(53799); +/** + * Optimize the size of existing assets, e. g. by minimizing or omitting whitespace. + */ +Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE = 400; -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** + * Add development tooling to assets, e. g. by extracting a SourceMap. + */ +Compilation.PROCESS_ASSETS_STAGE_DEV_TOOLING = 500; /** - * @param {Module[]} modules the modules to be sorted - * @returns {Module[]} sorted version of original modules + * Optimize the count of existing assets, e. g. by inlining assets of into other assets. + * Only assets of different types should be inlined. + * For assets of the same type see PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT. */ -const sortModules = modules => { - return modules.sort((a, b) => { - const aIdent = a.identifier(); - const bIdent = b.identifier(); - /* istanbul ignore next */ - if (aIdent < bIdent) return -1; - /* istanbul ignore next */ - if (aIdent > bIdent) return 1; - /* istanbul ignore next */ - return 0; - }); -}; +Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE = 700; /** - * @param {Module[]} modules each module from throw - * @param {ModuleGraph} moduleGraph the module graph - * @returns {string} each message from provided modules + * Summarize the list of existing assets + * e. g. creating an assets manifest of Service Workers. */ -const createModulesListMessage = (modules, moduleGraph) => { - return modules - .map(m => { - let message = `* ${m.identifier()}`; - const validReasons = Array.from( - moduleGraph.getIncomingConnectionsByOriginModule(m).keys() - ).filter(x => x); +Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE = 1000; - if (validReasons.length > 0) { - message += `\n Used by ${validReasons.length} module(s), i. e.`; - message += `\n ${validReasons[0].identifier()}`; - } - return message; - }) - .join("\n"); -}; +/** + * Optimize the hashes of the assets, e. g. by generating real hashes of the asset content. + */ +Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH = 2500; -class CaseSensitiveModulesWarning extends WebpackError { - /** - * Creates an instance of CaseSensitiveModulesWarning. - * @param {Iterable} modules modules that were detected - * @param {ModuleGraph} moduleGraph the module graph - */ - constructor(modules, moduleGraph) { - const sortedModules = sortModules(Array.from(modules)); - const modulesList = createModulesListMessage(sortedModules, moduleGraph); - super(`There are multiple modules with names that only differ in casing. -This can lead to unexpected behavior when compiling on a filesystem with other case-semantic. -Use equal casing. Compare these module identifiers: -${modulesList}`); +/** + * Optimize the transfer of existing assets, e. g. by preparing a compressed (gzip) file as separate asset. + */ +Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER = 3000; - this.name = "CaseSensitiveModulesWarning"; - this.module = sortedModules[0]; - } -} +/** + * Analyse existing assets. + */ +Compilation.PROCESS_ASSETS_STAGE_ANALYSE = 4000; -module.exports = CaseSensitiveModulesWarning; +/** + * Creating assets for reporting purposes. + */ +Compilation.PROCESS_ASSETS_STAGE_REPORT = 5000; + +module.exports = Compilation; /***/ }), -/***/ 39385: +/***/ 70845: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -25407,2559 +27577,3571 @@ module.exports = CaseSensitiveModulesWarning; -const ChunkGraph = __webpack_require__(64971); -const Entrypoint = __webpack_require__(13795); -const { intersect } = __webpack_require__(93347); -const SortableSet = __webpack_require__(13098); -const StringXor = __webpack_require__(40293); +const parseJson = __webpack_require__(15235); +const asyncLib = __webpack_require__(78175); const { - compareModulesByIdentifier, - compareChunkGroupsByIndex, - compareModulesById -} = __webpack_require__(29579); -const { createArrayToSetDeprecationSet } = __webpack_require__(64518); -const { mergeRuntime } = __webpack_require__(17156); + SyncHook, + SyncBailHook, + AsyncParallelHook, + AsyncSeriesHook +} = __webpack_require__(6967); +const { SizeOnlySource } = __webpack_require__(51255); +const webpack = __webpack_require__(91919); +const Cache = __webpack_require__(7592); +const CacheFacade = __webpack_require__(55392); +const ChunkGraph = __webpack_require__(64971); +const Compilation = __webpack_require__(85720); +const ConcurrentCompilationError = __webpack_require__(95735); +const ContextModuleFactory = __webpack_require__(62471); +const ModuleGraph = __webpack_require__(99988); +const NormalModuleFactory = __webpack_require__(68860); +const RequestShortener = __webpack_require__(73406); +const ResolverFactory = __webpack_require__(30217); +const Stats = __webpack_require__(31743); +const Watching = __webpack_require__(84275); +const WebpackError = __webpack_require__(53799); +const { Logger } = __webpack_require__(32597); +const { join, dirname, mkdirp } = __webpack_require__(17139); +const { makePathsRelative } = __webpack_require__(82186); +const { isSourceEqual } = __webpack_require__(41245); /** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("./ChunkGraph").ChunkFilterPredicate} ChunkFilterPredicate */ -/** @typedef {import("./ChunkGraph").ChunkSizeOptions} ChunkSizeOptions */ -/** @typedef {import("./ChunkGraph").ModuleFilterPredicate} ModuleFilterPredicate */ -/** @typedef {import("./ChunkGroup")} ChunkGroup */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("./Compilation").PathData} PathData */ -/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ +/** @typedef {import("../declarations/WebpackOptions").EntryNormalized} Entry */ +/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */ +/** @typedef {import("../declarations/WebpackOptions").WatchOptions} WatchOptions */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */ /** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./util/Hash")} Hash */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ +/** @typedef {import("./util/WeakTupleMap")} WeakTupleMap */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("./util/fs").IntermediateFileSystem} IntermediateFileSystem */ +/** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */ +/** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */ -const ChunkFilesSet = createArrayToSetDeprecationSet("chunk.files"); +/** + * @typedef {Object} CompilationParams + * @property {NormalModuleFactory} normalModuleFactory + * @property {ContextModuleFactory} contextModuleFactory + */ /** - * @typedef {Object} WithId an object who has an id property * - * @property {string | number} id the id of the object + * @template T + * @callback Callback + * @param {(Error | null)=} err + * @param {T=} result */ /** - * @deprecated - * @typedef {Object} ChunkMaps - * @property {Record} hash - * @property {Record>} contentHash - * @property {Record} name + * @callback RunAsChildCallback + * @param {(Error | null)=} err + * @param {Chunk[]=} entries + * @param {Compilation=} compilation */ /** - * @deprecated - * @typedef {Object} ChunkModuleMaps - * @property {Record} id - * @property {Record} hash + * @typedef {Object} AssetEmittedInfo + * @property {Buffer} content + * @property {Source} source + * @property {Compilation} compilation + * @property {string} outputPath + * @property {string} targetPath */ -let debugId = 1000; +/** + * @param {string[]} array an array + * @returns {boolean} true, if the array is sorted + */ +const isSorted = array => { + for (let i = 1; i < array.length; i++) { + if (array[i - 1] > array[i]) return false; + } + return true; +}; /** - * A Chunk is a unit of encapsulation for Modules. - * Chunks are "rendered" into bundles that get emitted when the build completes. + * @param {Object} obj an object + * @param {string[]} keys the keys of the object + * @returns {Object} the object with properties sorted by property name */ -class Chunk { +const sortObject = (obj, keys) => { + const o = {}; + for (const k of keys.sort()) { + o[k] = obj[k]; + } + return o; +}; + +/** + * @param {string} filename filename + * @param {string | string[] | undefined} hashes list of hashes + * @returns {boolean} true, if the filename contains any hash + */ +const includesHash = (filename, hashes) => { + if (!hashes) return false; + if (Array.isArray(hashes)) { + return hashes.some(hash => filename.includes(hash)); + } else { + return filename.includes(hashes); + } +}; + +class Compiler { /** - * @param {string=} name of chunk being created, is optional (for subclasses) - * @param {boolean} backCompat enable backward-compatibility + * @param {string} context the compilation path + * @param {WebpackOptions} options options */ - constructor(name, backCompat = true) { - /** @type {number | string | null} */ - this.id = null; - /** @type {(number|string)[] | null} */ - this.ids = null; - /** @type {number} */ - this.debugId = debugId++; - /** @type {string} */ - this.name = name; - /** @type {SortableSet} */ - this.idNameHints = new SortableSet(); - /** @type {boolean} */ - this.preventIntegration = false; - /** @type {(string | function(PathData, AssetInfo=): string)?} */ - this.filenameTemplate = undefined; - /** @type {(string | function(PathData, AssetInfo=): string)?} */ - this.cssFilenameTemplate = undefined; - /** @private @type {SortableSet} */ - this._groups = new SortableSet(undefined, compareChunkGroupsByIndex); - /** @type {RuntimeSpec} */ - this.runtime = undefined; - /** @type {Set} */ - this.files = backCompat ? new ChunkFilesSet() : new Set(); - /** @type {Set} */ - this.auxiliaryFiles = new Set(); - /** @type {boolean} */ - this.rendered = false; - /** @type {string=} */ - this.hash = undefined; - /** @type {Record} */ - this.contentHash = Object.create(null); - /** @type {string=} */ - this.renderedHash = undefined; + constructor(context, options = /** @type {WebpackOptions} */ ({})) { + this.hooks = Object.freeze({ + /** @type {SyncHook<[]>} */ + initialize: new SyncHook([]), + + /** @type {SyncBailHook<[Compilation], boolean>} */ + shouldEmit: new SyncBailHook(["compilation"]), + /** @type {AsyncSeriesHook<[Stats]>} */ + done: new AsyncSeriesHook(["stats"]), + /** @type {SyncHook<[Stats]>} */ + afterDone: new SyncHook(["stats"]), + /** @type {AsyncSeriesHook<[]>} */ + additionalPass: new AsyncSeriesHook([]), + /** @type {AsyncSeriesHook<[Compiler]>} */ + beforeRun: new AsyncSeriesHook(["compiler"]), + /** @type {AsyncSeriesHook<[Compiler]>} */ + run: new AsyncSeriesHook(["compiler"]), + /** @type {AsyncSeriesHook<[Compilation]>} */ + emit: new AsyncSeriesHook(["compilation"]), + /** @type {AsyncSeriesHook<[string, AssetEmittedInfo]>} */ + assetEmitted: new AsyncSeriesHook(["file", "info"]), + /** @type {AsyncSeriesHook<[Compilation]>} */ + afterEmit: new AsyncSeriesHook(["compilation"]), + + /** @type {SyncHook<[Compilation, CompilationParams]>} */ + thisCompilation: new SyncHook(["compilation", "params"]), + /** @type {SyncHook<[Compilation, CompilationParams]>} */ + compilation: new SyncHook(["compilation", "params"]), + /** @type {SyncHook<[NormalModuleFactory]>} */ + normalModuleFactory: new SyncHook(["normalModuleFactory"]), + /** @type {SyncHook<[ContextModuleFactory]>} */ + contextModuleFactory: new SyncHook(["contextModuleFactory"]), + + /** @type {AsyncSeriesHook<[CompilationParams]>} */ + beforeCompile: new AsyncSeriesHook(["params"]), + /** @type {SyncHook<[CompilationParams]>} */ + compile: new SyncHook(["params"]), + /** @type {AsyncParallelHook<[Compilation]>} */ + make: new AsyncParallelHook(["compilation"]), + /** @type {AsyncParallelHook<[Compilation]>} */ + finishMake: new AsyncSeriesHook(["compilation"]), + /** @type {AsyncSeriesHook<[Compilation]>} */ + afterCompile: new AsyncSeriesHook(["compilation"]), + + /** @type {AsyncSeriesHook<[]>} */ + readRecords: new AsyncSeriesHook([]), + /** @type {AsyncSeriesHook<[]>} */ + emitRecords: new AsyncSeriesHook([]), + + /** @type {AsyncSeriesHook<[Compiler]>} */ + watchRun: new AsyncSeriesHook(["compiler"]), + /** @type {SyncHook<[Error]>} */ + failed: new SyncHook(["error"]), + /** @type {SyncHook<[string | null, number]>} */ + invalid: new SyncHook(["filename", "changeTime"]), + /** @type {SyncHook<[]>} */ + watchClose: new SyncHook([]), + /** @type {AsyncSeriesHook<[]>} */ + shutdown: new AsyncSeriesHook([]), + + /** @type {SyncBailHook<[string, string, any[]], true>} */ + infrastructureLog: new SyncBailHook(["origin", "type", "args"]), + + // TODO the following hooks are weirdly located here + // TODO move them for webpack 5 + /** @type {SyncHook<[]>} */ + environment: new SyncHook([]), + /** @type {SyncHook<[]>} */ + afterEnvironment: new SyncHook([]), + /** @type {SyncHook<[Compiler]>} */ + afterPlugins: new SyncHook(["compiler"]), + /** @type {SyncHook<[Compiler]>} */ + afterResolvers: new SyncHook(["compiler"]), + /** @type {SyncBailHook<[string, Entry], boolean>} */ + entryOption: new SyncBailHook(["context", "entry"]) + }); + + this.webpack = webpack; + /** @type {string=} */ - this.chunkReason = undefined; - /** @type {boolean} */ - this.extraAsync = false; - } + this.name = undefined; + /** @type {Compilation=} */ + this.parentCompilation = undefined; + /** @type {Compiler} */ + this.root = this; + /** @type {string} */ + this.outputPath = ""; + /** @type {Watching} */ + this.watching = undefined; - // TODO remove in webpack 6 - // BACKWARD-COMPAT START - get entryModule() { - const entryModules = Array.from( - ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.entryModule", - "DEP_WEBPACK_CHUNK_ENTRY_MODULE" - ).getChunkEntryModulesIterable(this) - ); - if (entryModules.length === 0) { - return undefined; - } else if (entryModules.length === 1) { - return entryModules[0]; - } else { - throw new Error( - "Module.entryModule: Multiple entry modules are not supported by the deprecated API (Use the new ChunkGroup API)" - ); - } - } + /** @type {OutputFileSystem} */ + this.outputFileSystem = null; + /** @type {IntermediateFileSystem} */ + this.intermediateFileSystem = null; + /** @type {InputFileSystem} */ + this.inputFileSystem = null; + /** @type {WatchFileSystem} */ + this.watchFileSystem = null; - /** - * @returns {boolean} true, if the chunk contains an entry module - */ - hasEntryModule() { - return ( - ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.hasEntryModule", - "DEP_WEBPACK_CHUNK_HAS_ENTRY_MODULE" - ).getNumberOfEntryModules(this) > 0 - ); - } + /** @type {string|null} */ + this.recordsInputPath = null; + /** @type {string|null} */ + this.recordsOutputPath = null; + this.records = {}; + /** @type {Set} */ + this.managedPaths = new Set(); + /** @type {Set} */ + this.immutablePaths = new Set(); - /** - * @param {Module} module the module - * @returns {boolean} true, if the chunk could be added - */ - addModule(module) { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.addModule", - "DEP_WEBPACK_CHUNK_ADD_MODULE" - ); - if (chunkGraph.isModuleInChunk(module, this)) return false; - chunkGraph.connectChunkAndModule(this, module); - return true; - } + /** @type {ReadonlySet} */ + this.modifiedFiles = undefined; + /** @type {ReadonlySet} */ + this.removedFiles = undefined; + /** @type {ReadonlyMap} */ + this.fileTimestamps = undefined; + /** @type {ReadonlyMap} */ + this.contextTimestamps = undefined; + /** @type {number} */ + this.fsStartTime = undefined; - /** - * @param {Module} module the module - * @returns {void} - */ - removeModule(module) { - ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.removeModule", - "DEP_WEBPACK_CHUNK_REMOVE_MODULE" - ).disconnectChunkAndModule(this, module); - } + /** @type {ResolverFactory} */ + this.resolverFactory = new ResolverFactory(); - /** - * @returns {number} the number of module which are contained in this chunk - */ - getNumberOfModules() { - return ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.getNumberOfModules", - "DEP_WEBPACK_CHUNK_GET_NUMBER_OF_MODULES" - ).getNumberOfChunkModules(this); - } + this.infrastructureLogger = undefined; - get modulesIterable() { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.modulesIterable", - "DEP_WEBPACK_CHUNK_MODULES_ITERABLE" - ); - return chunkGraph.getOrderedChunkModulesIterable( - this, - compareModulesByIdentifier - ); - } + this.options = options; - /** - * @param {Chunk} otherChunk the chunk to compare with - * @returns {-1|0|1} the comparison result - */ - compareTo(otherChunk) { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.compareTo", - "DEP_WEBPACK_CHUNK_COMPARE_TO" - ); - return chunkGraph.compareChunks(this, otherChunk); - } + this.context = context; - /** - * @param {Module} module the module - * @returns {boolean} true, if the chunk contains the module - */ - containsModule(module) { - return ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.containsModule", - "DEP_WEBPACK_CHUNK_CONTAINS_MODULE" - ).isModuleInChunk(module, this); - } + this.requestShortener = new RequestShortener(context, this.root); - /** - * @returns {Module[]} the modules for this chunk - */ - getModules() { - return ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.getModules", - "DEP_WEBPACK_CHUNK_GET_MODULES" - ).getChunkModules(this); + this.cache = new Cache(); + + /** @type {Map, memCache: WeakTupleMap }> | undefined} */ + this.moduleMemCaches = undefined; + + this.compilerPath = ""; + + /** @type {boolean} */ + this.running = false; + + /** @type {boolean} */ + this.idle = false; + + /** @type {boolean} */ + this.watchMode = false; + + this._backCompat = this.options.experiments.backCompat !== false; + + /** @type {Compilation} */ + this._lastCompilation = undefined; + /** @type {NormalModuleFactory} */ + this._lastNormalModuleFactory = undefined; + + /** @private @type {WeakMap }>} */ + this._assetEmittingSourceCache = new WeakMap(); + /** @private @type {Map} */ + this._assetEmittingWrittenFiles = new Map(); + /** @private @type {Set} */ + this._assetEmittingPreviousFiles = new Set(); } /** - * @returns {void} + * @param {string} name cache name + * @returns {CacheFacade} the cache facade instance */ - remove() { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.remove", - "DEP_WEBPACK_CHUNK_REMOVE" + getCache(name) { + return new CacheFacade( + this.cache, + `${this.compilerPath}${name}`, + this.options.output.hashFunction ); - chunkGraph.disconnectChunk(this); - this.disconnectFromGroups(); } /** - * @param {Module} module the module - * @param {Chunk} otherChunk the target chunk - * @returns {void} + * @param {string | (function(): string)} name name of the logger, or function called once to get the logger name + * @returns {Logger} a logger with that name */ - moveModule(module, otherChunk) { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.moveModule", - "DEP_WEBPACK_CHUNK_MOVE_MODULE" + getInfrastructureLogger(name) { + if (!name) { + throw new TypeError( + "Compiler.getInfrastructureLogger(name) called without a name" + ); + } + return new Logger( + (type, args) => { + if (typeof name === "function") { + name = name(); + if (!name) { + throw new TypeError( + "Compiler.getInfrastructureLogger(name) called with a function not returning a name" + ); + } + } + if (this.hooks.infrastructureLog.call(name, type, args) === undefined) { + if (this.infrastructureLogger !== undefined) { + this.infrastructureLogger(name, type, args); + } + } + }, + childName => { + if (typeof name === "function") { + if (typeof childName === "function") { + return this.getInfrastructureLogger(() => { + if (typeof name === "function") { + name = name(); + if (!name) { + throw new TypeError( + "Compiler.getInfrastructureLogger(name) called with a function not returning a name" + ); + } + } + if (typeof childName === "function") { + childName = childName(); + if (!childName) { + throw new TypeError( + "Logger.getChildLogger(name) called with a function not returning a name" + ); + } + } + return `${name}/${childName}`; + }); + } else { + return this.getInfrastructureLogger(() => { + if (typeof name === "function") { + name = name(); + if (!name) { + throw new TypeError( + "Compiler.getInfrastructureLogger(name) called with a function not returning a name" + ); + } + } + return `${name}/${childName}`; + }); + } + } else { + if (typeof childName === "function") { + return this.getInfrastructureLogger(() => { + if (typeof childName === "function") { + childName = childName(); + if (!childName) { + throw new TypeError( + "Logger.getChildLogger(name) called with a function not returning a name" + ); + } + } + return `${name}/${childName}`; + }); + } else { + return this.getInfrastructureLogger(`${name}/${childName}`); + } + } + } ); - chunkGraph.disconnectChunkAndModule(this, module); - chunkGraph.connectChunkAndModule(otherChunk, module); } - /** - * @param {Chunk} otherChunk the other chunk - * @returns {boolean} true, if the specified chunk has been integrated - */ - integrate(otherChunk) { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.integrate", - "DEP_WEBPACK_CHUNK_INTEGRATE" - ); - if (chunkGraph.canChunksBeIntegrated(this, otherChunk)) { - chunkGraph.integrateChunks(this, otherChunk); - return true; - } else { - return false; + // TODO webpack 6: solve this in a better way + // e.g. move compilation specific info from Modules into ModuleGraph + _cleanupLastCompilation() { + if (this._lastCompilation !== undefined) { + for (const module of this._lastCompilation.modules) { + ChunkGraph.clearChunkGraphForModule(module); + ModuleGraph.clearModuleGraphForModule(module); + module.cleanupForCache(); + } + for (const chunk of this._lastCompilation.chunks) { + ChunkGraph.clearChunkGraphForChunk(chunk); + } + this._lastCompilation = undefined; } } - /** - * @param {Chunk} otherChunk the other chunk - * @returns {boolean} true, if chunks could be integrated - */ - canBeIntegrated(otherChunk) { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.canBeIntegrated", - "DEP_WEBPACK_CHUNK_CAN_BE_INTEGRATED" - ); - return chunkGraph.canChunksBeIntegrated(this, otherChunk); + // TODO webpack 6: solve this in a better way + _cleanupLastNormalModuleFactory() { + if (this._lastNormalModuleFactory !== undefined) { + this._lastNormalModuleFactory.cleanupForCache(); + this._lastNormalModuleFactory = undefined; + } } /** - * @returns {boolean} true, if this chunk contains no module + * @param {WatchOptions} watchOptions the watcher's options + * @param {Callback} handler signals when the call finishes + * @returns {Watching} a compiler watcher */ - isEmpty() { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.isEmpty", - "DEP_WEBPACK_CHUNK_IS_EMPTY" - ); - return chunkGraph.getNumberOfChunkModules(this) === 0; - } + watch(watchOptions, handler) { + if (this.running) { + return handler(new ConcurrentCompilationError()); + } - /** - * @returns {number} total size of all modules in this chunk - */ - modulesSize() { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.modulesSize", - "DEP_WEBPACK_CHUNK_MODULES_SIZE" - ); - return chunkGraph.getChunkModulesSize(this); + this.running = true; + this.watchMode = true; + this.watching = new Watching(this, watchOptions, handler); + return this.watching; } /** - * @param {ChunkSizeOptions} options options object - * @returns {number} total size of this chunk + * @param {Callback} callback signals when the call finishes + * @returns {void} */ - size(options = {}) { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.size", - "DEP_WEBPACK_CHUNK_SIZE" - ); - return chunkGraph.getChunkSize(this, options); - } + run(callback) { + if (this.running) { + return callback(new ConcurrentCompilationError()); + } - /** - * @param {Chunk} otherChunk the other chunk - * @param {ChunkSizeOptions} options options object - * @returns {number} total size of the chunk or false if the chunk can't be integrated - */ - integratedSize(otherChunk, options) { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.integratedSize", - "DEP_WEBPACK_CHUNK_INTEGRATED_SIZE" - ); - return chunkGraph.getIntegratedChunksSize(this, otherChunk, options); - } + let logger; - /** - * @param {ModuleFilterPredicate} filterFn function used to filter modules - * @returns {ChunkModuleMaps} module map information - */ - getChunkModuleMaps(filterFn) { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.getChunkModuleMaps", - "DEP_WEBPACK_CHUNK_GET_CHUNK_MODULE_MAPS" - ); - /** @type {Record} */ - const chunkModuleIdMap = Object.create(null); - /** @type {Record} */ - const chunkModuleHashMap = Object.create(null); + const finalCallback = (err, stats) => { + if (logger) logger.time("beginIdle"); + this.idle = true; + this.cache.beginIdle(); + this.idle = true; + if (logger) logger.timeEnd("beginIdle"); + this.running = false; + if (err) { + this.hooks.failed.call(err); + } + if (callback !== undefined) callback(err, stats); + this.hooks.afterDone.call(stats); + }; - for (const asyncChunk of this.getAllAsyncChunks()) { - /** @type {(string|number)[]} */ - let array; - for (const module of chunkGraph.getOrderedChunkModulesIterable( - asyncChunk, - compareModulesById(chunkGraph) - )) { - if (filterFn(module)) { - if (array === undefined) { - array = []; - chunkModuleIdMap[asyncChunk.id] = array; - } - const moduleId = chunkGraph.getModuleId(module); - array.push(moduleId); - chunkModuleHashMap[moduleId] = chunkGraph.getRenderedModuleHash( - module, - undefined - ); - } - } - } - - return { - id: chunkModuleIdMap, - hash: chunkModuleHashMap - }; - } + const startTime = Date.now(); - /** - * @param {ModuleFilterPredicate} filterFn predicate function used to filter modules - * @param {ChunkFilterPredicate=} filterChunkFn predicate function used to filter chunks - * @returns {boolean} return true if module exists in graph - */ - hasModuleInGraph(filterFn, filterChunkFn) { - const chunkGraph = ChunkGraph.getChunkGraphForChunk( - this, - "Chunk.hasModuleInGraph", - "DEP_WEBPACK_CHUNK_HAS_MODULE_IN_GRAPH" - ); - return chunkGraph.hasModuleInGraph(this, filterFn, filterChunkFn); - } + this.running = true; - /** - * @deprecated - * @param {boolean} realHash whether the full hash or the rendered hash is to be used - * @returns {ChunkMaps} the chunk map information - */ - getChunkMaps(realHash) { - /** @type {Record} */ - const chunkHashMap = Object.create(null); - /** @type {Record>} */ - const chunkContentHashMap = Object.create(null); - /** @type {Record} */ - const chunkNameMap = Object.create(null); + const onCompiled = (err, compilation) => { + if (err) return finalCallback(err); - for (const chunk of this.getAllAsyncChunks()) { - chunkHashMap[chunk.id] = realHash ? chunk.hash : chunk.renderedHash; - for (const key of Object.keys(chunk.contentHash)) { - if (!chunkContentHashMap[key]) { - chunkContentHashMap[key] = Object.create(null); - } - chunkContentHashMap[key][chunk.id] = chunk.contentHash[key]; - } - if (chunk.name) { - chunkNameMap[chunk.id] = chunk.name; + if (this.hooks.shouldEmit.call(compilation) === false) { + compilation.startTime = startTime; + compilation.endTime = Date.now(); + const stats = new Stats(compilation); + this.hooks.done.callAsync(stats, err => { + if (err) return finalCallback(err); + return finalCallback(null, stats); + }); + return; } - } - return { - hash: chunkHashMap, - contentHash: chunkContentHashMap, - name: chunkNameMap - }; - } - // BACKWARD-COMPAT END + process.nextTick(() => { + logger = compilation.getLogger("webpack.Compiler"); + logger.time("emitAssets"); + this.emitAssets(compilation, err => { + logger.timeEnd("emitAssets"); + if (err) return finalCallback(err); - /** - * @returns {boolean} whether or not the Chunk will have a runtime - */ - hasRuntime() { - for (const chunkGroup of this._groups) { - if ( - chunkGroup instanceof Entrypoint && - chunkGroup.getRuntimeChunk() === this - ) { - return true; - } - } - return false; - } + if (compilation.hooks.needAdditionalPass.call()) { + compilation.needAdditionalPass = true; - /** - * @returns {boolean} whether or not this chunk can be an initial chunk - */ - canBeInitial() { - for (const chunkGroup of this._groups) { - if (chunkGroup.isInitial()) return true; - } - return false; - } + compilation.startTime = startTime; + compilation.endTime = Date.now(); + logger.time("done hook"); + const stats = new Stats(compilation); + this.hooks.done.callAsync(stats, err => { + logger.timeEnd("done hook"); + if (err) return finalCallback(err); - /** - * @returns {boolean} whether this chunk can only be an initial chunk - */ - isOnlyInitial() { - if (this._groups.size <= 0) return false; - for (const chunkGroup of this._groups) { - if (!chunkGroup.isInitial()) return false; - } - return true; - } + this.hooks.additionalPass.callAsync(err => { + if (err) return finalCallback(err); + this.compile(onCompiled); + }); + }); + return; + } - /** - * @returns {EntryOptions | undefined} the entry options for this chunk - */ - getEntryOptions() { - for (const chunkGroup of this._groups) { - if (chunkGroup instanceof Entrypoint) { - return chunkGroup.options; - } - } - return undefined; - } + logger.time("emitRecords"); + this.emitRecords(err => { + logger.timeEnd("emitRecords"); + if (err) return finalCallback(err); - /** - * @param {ChunkGroup} chunkGroup the chunkGroup the chunk is being added - * @returns {void} - */ - addGroup(chunkGroup) { - this._groups.add(chunkGroup); - } + compilation.startTime = startTime; + compilation.endTime = Date.now(); + logger.time("done hook"); + const stats = new Stats(compilation); + this.hooks.done.callAsync(stats, err => { + logger.timeEnd("done hook"); + if (err) return finalCallback(err); + this.cache.storeBuildDependencies( + compilation.buildDependencies, + err => { + if (err) return finalCallback(err); + return finalCallback(null, stats); + } + ); + }); + }); + }); + }); + }; - /** - * @param {ChunkGroup} chunkGroup the chunkGroup the chunk is being removed from - * @returns {void} - */ - removeGroup(chunkGroup) { - this._groups.delete(chunkGroup); - } + const run = () => { + this.hooks.beforeRun.callAsync(this, err => { + if (err) return finalCallback(err); - /** - * @param {ChunkGroup} chunkGroup the chunkGroup to check - * @returns {boolean} returns true if chunk has chunkGroup reference and exists in chunkGroup - */ - isInGroup(chunkGroup) { - return this._groups.has(chunkGroup); - } + this.hooks.run.callAsync(this, err => { + if (err) return finalCallback(err); - /** - * @returns {number} the amount of groups that the said chunk is in - */ - getNumberOfGroups() { - return this._groups.size; - } + this.readRecords(err => { + if (err) return finalCallback(err); - /** - * @returns {Iterable} the chunkGroups that the said chunk is referenced in - */ - get groupsIterable() { - this._groups.sort(); - return this._groups; - } + this.compile(onCompiled); + }); + }); + }); + }; - /** - * @returns {void} - */ - disconnectFromGroups() { - for (const chunkGroup of this._groups) { - chunkGroup.removeChunk(this); - } - } + if (this.idle) { + this.cache.endIdle(err => { + if (err) return finalCallback(err); - /** - * @param {Chunk} newChunk the new chunk that will be split out of - * @returns {void} - */ - split(newChunk) { - for (const chunkGroup of this._groups) { - chunkGroup.insertChunk(newChunk, this); - newChunk.addGroup(chunkGroup); - } - for (const idHint of this.idNameHints) { - newChunk.idNameHints.add(idHint); + this.idle = false; + run(); + }); + } else { + run(); } - newChunk.runtime = mergeRuntime(newChunk.runtime, this.runtime); } /** - * @param {Hash} hash hash (will be modified) - * @param {ChunkGraph} chunkGraph the chunk graph + * @param {RunAsChildCallback} callback signals when the call finishes * @returns {void} */ - updateHash(hash, chunkGraph) { - hash.update( - `${this.id} ${this.ids ? this.ids.join() : ""} ${this.name || ""} ` - ); - const xor = new StringXor(); - for (const m of chunkGraph.getChunkModulesIterable(this)) { - xor.add(chunkGraph.getModuleHash(m, this.runtime)); - } - xor.updateHash(hash); - const entryModules = - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(this); - for (const [m, chunkGroup] of entryModules) { - hash.update(`entry${chunkGraph.getModuleId(m)}${chunkGroup.id}`); - } - } - - /** - * @returns {Set} a set of all the async chunks - */ - getAllAsyncChunks() { - const queue = new Set(); - const chunks = new Set(); - - const initialChunks = intersect( - Array.from(this.groupsIterable, g => new Set(g.chunks)) - ); - - const initialQueue = new Set(this.groupsIterable); + runAsChild(callback) { + const startTime = Date.now(); + this.compile((err, compilation) => { + if (err) return callback(err); - for (const chunkGroup of initialQueue) { - for (const child of chunkGroup.childrenIterable) { - if (child instanceof Entrypoint) { - initialQueue.add(child); - } else { - queue.add(child); - } + this.parentCompilation.children.push(compilation); + for (const { name, source, info } of compilation.getAssets()) { + this.parentCompilation.emitAsset(name, source, info); } - } - for (const chunkGroup of queue) { - for (const chunk of chunkGroup.chunks) { - if (!initialChunks.has(chunk)) { - chunks.add(chunk); - } - } - for (const child of chunkGroup.childrenIterable) { - queue.add(child); + const entries = []; + for (const ep of compilation.entrypoints.values()) { + entries.push(...ep.chunks); } - } - return chunks; + compilation.startTime = startTime; + compilation.endTime = Date.now(); + + return callback(null, entries, compilation); + }); } - /** - * @returns {Set} a set of all the initial chunks (including itself) - */ - getAllInitialChunks() { - const chunks = new Set(); - const queue = new Set(this.groupsIterable); - for (const group of queue) { - if (group.isInitial()) { - for (const c of group.chunks) chunks.add(c); - for (const g of group.childrenIterable) queue.add(g); - } + purgeInputFileSystem() { + if (this.inputFileSystem && this.inputFileSystem.purge) { + this.inputFileSystem.purge(); } - return chunks; } /** - * @returns {Set} a set of all the referenced chunks (including itself) + * @param {Compilation} compilation the compilation + * @param {Callback} callback signals when the assets are emitted + * @returns {void} */ - getAllReferencedChunks() { - const queue = new Set(this.groupsIterable); - const chunks = new Set(); + emitAssets(compilation, callback) { + let outputPath; - for (const chunkGroup of queue) { - for (const chunk of chunkGroup.chunks) { - chunks.add(chunk); - } - for (const child of chunkGroup.childrenIterable) { - queue.add(child); - } - } + const emitFiles = err => { + if (err) return callback(err); - return chunks; - } + const assets = compilation.getAssets(); + compilation.assets = { ...compilation.assets }; + /** @type {Map} */ + const caseInsensitiveMap = new Map(); + /** @type {Set} */ + const allTargetPaths = new Set(); + asyncLib.forEachLimit( + assets, + 15, + ({ name: file, source, info }, callback) => { + let targetFile = file; + let immutable = info.immutable; + const queryStringIdx = targetFile.indexOf("?"); + if (queryStringIdx >= 0) { + targetFile = targetFile.substr(0, queryStringIdx); + // We may remove the hash, which is in the query string + // So we recheck if the file is immutable + // This doesn't cover all cases, but immutable is only a performance optimization anyway + immutable = + immutable && + (includesHash(targetFile, info.contenthash) || + includesHash(targetFile, info.chunkhash) || + includesHash(targetFile, info.modulehash) || + includesHash(targetFile, info.fullhash)); + } - /** - * @returns {Set} a set of all the referenced entrypoints - */ - getAllReferencedAsyncEntrypoints() { - const queue = new Set(this.groupsIterable); - const entrypoints = new Set(); + const writeOut = err => { + if (err) return callback(err); + const targetPath = join( + this.outputFileSystem, + outputPath, + targetFile + ); + allTargetPaths.add(targetPath); - for (const chunkGroup of queue) { - for (const entrypoint of chunkGroup.asyncEntrypointsIterable) { - entrypoints.add(entrypoint); - } - for (const child of chunkGroup.childrenIterable) { - queue.add(child); - } - } + // check if the target file has already been written by this Compiler + const targetFileGeneration = + this._assetEmittingWrittenFiles.get(targetPath); - return entrypoints; - } + // create an cache entry for this Source if not already existing + let cacheEntry = this._assetEmittingSourceCache.get(source); + if (cacheEntry === undefined) { + cacheEntry = { + sizeOnlySource: undefined, + writtenTo: new Map() + }; + this._assetEmittingSourceCache.set(source, cacheEntry); + } - /** - * @returns {boolean} true, if the chunk references async chunks - */ - hasAsyncChunks() { - const queue = new Set(); + let similarEntry; - const initialChunks = intersect( - Array.from(this.groupsIterable, g => new Set(g.chunks)) - ); + const checkSimilarFile = () => { + const caseInsensitiveTargetPath = targetPath.toLowerCase(); + similarEntry = caseInsensitiveMap.get(caseInsensitiveTargetPath); + if (similarEntry !== undefined) { + const { path: other, source: otherSource } = similarEntry; + if (isSourceEqual(otherSource, source)) { + // Size may or may not be available at this point. + // If it's not available add to "waiting" list and it will be updated once available + if (similarEntry.size !== undefined) { + updateWithReplacementSource(similarEntry.size); + } else { + if (!similarEntry.waiting) similarEntry.waiting = []; + similarEntry.waiting.push({ file, cacheEntry }); + } + alreadyWritten(); + } else { + const err = + new WebpackError(`Prevent writing to file that only differs in casing or query string from already written file. +This will lead to a race-condition and corrupted files on case-insensitive file systems. +${targetPath} +${other}`); + err.file = file; + callback(err); + } + return true; + } else { + caseInsensitiveMap.set( + caseInsensitiveTargetPath, + (similarEntry = { + path: targetPath, + source, + size: undefined, + waiting: undefined + }) + ); + return false; + } + }; - for (const chunkGroup of this.groupsIterable) { - for (const child of chunkGroup.childrenIterable) { - queue.add(child); - } - } + /** + * get the binary (Buffer) content from the Source + * @returns {Buffer} content for the source + */ + const getContent = () => { + if (typeof source.buffer === "function") { + return source.buffer(); + } else { + const bufferOrString = source.source(); + if (Buffer.isBuffer(bufferOrString)) { + return bufferOrString; + } else { + return Buffer.from(bufferOrString, "utf8"); + } + } + }; - for (const chunkGroup of queue) { - for (const chunk of chunkGroup.chunks) { - if (!initialChunks.has(chunk)) { - return true; - } - } - for (const child of chunkGroup.childrenIterable) { - queue.add(child); - } - } + const alreadyWritten = () => { + // cache the information that the Source has been already been written to that location + if (targetFileGeneration === undefined) { + const newGeneration = 1; + this._assetEmittingWrittenFiles.set(targetPath, newGeneration); + cacheEntry.writtenTo.set(targetPath, newGeneration); + } else { + cacheEntry.writtenTo.set(targetPath, targetFileGeneration); + } + callback(); + }; - return false; - } + /** + * Write the file to output file system + * @param {Buffer} content content to be written + * @returns {void} + */ + const doWrite = content => { + this.outputFileSystem.writeFile(targetPath, content, err => { + if (err) return callback(err); - /** - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {ChunkFilterPredicate=} filterFn function used to filter chunks - * @returns {Record} a record object of names to lists of child ids(?) - */ - getChildIdsByOrders(chunkGraph, filterFn) { - /** @type {Map} */ - const lists = new Map(); - for (const group of this.groupsIterable) { - if (group.chunks[group.chunks.length - 1] === this) { - for (const childGroup of group.childrenIterable) { - for (const key of Object.keys(childGroup.options)) { - if (key.endsWith("Order")) { - const name = key.substr(0, key.length - "Order".length); - let list = lists.get(name); - if (list === undefined) { - list = []; - lists.set(name, list); + // information marker that the asset has been emitted + compilation.emittedAssets.add(file); + + // cache the information that the Source has been written to that location + const newGeneration = + targetFileGeneration === undefined + ? 1 + : targetFileGeneration + 1; + cacheEntry.writtenTo.set(targetPath, newGeneration); + this._assetEmittingWrittenFiles.set(targetPath, newGeneration); + this.hooks.assetEmitted.callAsync( + file, + { + content, + source, + outputPath, + compilation, + targetPath + }, + callback + ); + }); + }; + + const updateWithReplacementSource = size => { + updateFileWithReplacementSource(file, cacheEntry, size); + similarEntry.size = size; + if (similarEntry.waiting !== undefined) { + for (const { file, cacheEntry } of similarEntry.waiting) { + updateFileWithReplacementSource(file, cacheEntry, size); + } } - list.push({ - order: childGroup.options[key], - group: childGroup + }; + + const updateFileWithReplacementSource = ( + file, + cacheEntry, + size + ) => { + // Create a replacement resource which only allows to ask for size + // This allows to GC all memory allocated by the Source + // (expect when the Source is stored in any other cache) + if (!cacheEntry.sizeOnlySource) { + cacheEntry.sizeOnlySource = new SizeOnlySource(size); + } + compilation.updateAsset(file, cacheEntry.sizeOnlySource, { + size + }); + }; + + const processExistingFile = stats => { + // skip emitting if it's already there and an immutable file + if (immutable) { + updateWithReplacementSource(stats.size); + return alreadyWritten(); + } + + const content = getContent(); + + updateWithReplacementSource(content.length); + + // if it exists and content on disk matches content + // skip writing the same content again + // (to keep mtime and don't trigger watchers) + // for a fast negative match file size is compared first + if (content.length === stats.size) { + compilation.comparedForEmitAssets.add(file); + return this.outputFileSystem.readFile( + targetPath, + (err, existingContent) => { + if ( + err || + !content.equals(/** @type {Buffer} */ (existingContent)) + ) { + return doWrite(content); + } else { + return alreadyWritten(); + } + } + ); + } + + return doWrite(content); + }; + + const processMissingFile = () => { + const content = getContent(); + + updateWithReplacementSource(content.length); + + return doWrite(content); + }; + + // if the target file has already been written + if (targetFileGeneration !== undefined) { + // check if the Source has been written to this target file + const writtenGeneration = cacheEntry.writtenTo.get(targetPath); + if (writtenGeneration === targetFileGeneration) { + // if yes, we may skip writing the file + // if it's already there + // (we assume one doesn't modify files while the Compiler is running, other then removing them) + + if (this._assetEmittingPreviousFiles.has(targetPath)) { + // We assume that assets from the last compilation say intact on disk (they are not removed) + compilation.updateAsset(file, cacheEntry.sizeOnlySource, { + size: cacheEntry.sizeOnlySource.size() + }); + + return callback(); + } else { + // Settings immutable will make it accept file content without comparing when file exist + immutable = true; + } + } else if (!immutable) { + if (checkSimilarFile()) return; + // We wrote to this file before which has very likely a different content + // skip comparing and assume content is different for performance + // This case happens often during watch mode. + return processMissingFile(); + } + } + + if (checkSimilarFile()) return; + if (this.options.output.compareBeforeEmit) { + this.outputFileSystem.stat(targetPath, (err, stats) => { + const exists = !err && stats.isFile(); + + if (exists) { + processExistingFile(stats); + } else { + processMissingFile(); + } }); + } else { + processMissingFile(); } + }; + + if (targetFile.match(/\/|\\/)) { + const fs = this.outputFileSystem; + const dir = dirname(fs, join(fs, outputPath, targetFile)); + mkdirp(fs, dir, writeOut); + } else { + writeOut(); } + }, + err => { + // Clear map to free up memory + caseInsensitiveMap.clear(); + if (err) { + this._assetEmittingPreviousFiles.clear(); + return callback(err); + } + + this._assetEmittingPreviousFiles = allTargetPaths; + + this.hooks.afterEmit.callAsync(compilation, err => { + if (err) return callback(err); + + return callback(); + }); } + ); + }; + + this.hooks.emit.callAsync(compilation, err => { + if (err) return callback(err); + outputPath = compilation.getPath(this.outputPath, {}); + mkdirp(this.outputFileSystem, outputPath, emitFiles); + }); + } + + /** + * @param {Callback} callback signals when the call finishes + * @returns {void} + */ + emitRecords(callback) { + if (this.hooks.emitRecords.isUsed()) { + if (this.recordsOutputPath) { + asyncLib.parallel( + [ + cb => this.hooks.emitRecords.callAsync(cb), + this._emitRecords.bind(this) + ], + err => callback(err) + ); + } else { + this.hooks.emitRecords.callAsync(callback); } - } - /** @type {Record} */ - const result = Object.create(null); - for (const [name, list] of lists) { - list.sort((a, b) => { - const cmp = b.order - a.order; - if (cmp !== 0) return cmp; - return a.group.compareTo(chunkGraph, b.group); - }); - /** @type {Set} */ - const chunkIdSet = new Set(); - for (const item of list) { - for (const chunk of item.group.chunks) { - if (filterFn && !filterFn(chunk, chunkGraph)) continue; - chunkIdSet.add(chunk.id); - } - } - if (chunkIdSet.size > 0) { - result[name] = Array.from(chunkIdSet); + } else { + if (this.recordsOutputPath) { + this._emitRecords(callback); + } else { + callback(); } } - return result; } /** - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {string} type option name - * @returns {{ onChunks: Chunk[], chunks: Set }[]} referenced chunks for a specific type + * @param {Callback} callback signals when the call finishes + * @returns {void} */ - getChildrenOfTypeInOrder(chunkGraph, type) { - const list = []; - for (const group of this.groupsIterable) { - for (const childGroup of group.childrenIterable) { - const order = childGroup.options[type]; - if (order === undefined) continue; - list.push({ - order, - group, - childGroup - }); - } + _emitRecords(callback) { + const writeFile = () => { + this.outputFileSystem.writeFile( + this.recordsOutputPath, + JSON.stringify( + this.records, + (n, value) => { + if ( + typeof value === "object" && + value !== null && + !Array.isArray(value) + ) { + const keys = Object.keys(value); + if (!isSorted(keys)) { + return sortObject(value, keys); + } + } + return value; + }, + 2 + ), + callback + ); + }; + + const recordsOutputPathDirectory = dirname( + this.outputFileSystem, + this.recordsOutputPath + ); + if (!recordsOutputPathDirectory) { + return writeFile(); } - if (list.length === 0) return undefined; - list.sort((a, b) => { - const cmp = b.order - a.order; - if (cmp !== 0) return cmp; - return a.group.compareTo(chunkGraph, b.group); + mkdirp(this.outputFileSystem, recordsOutputPathDirectory, err => { + if (err) return callback(err); + writeFile(); }); - const result = []; - let lastEntry; - for (const { group, childGroup } of list) { - if (lastEntry && lastEntry.onChunks === group.chunks) { - for (const chunk of childGroup.chunks) { - lastEntry.chunks.add(chunk); - } + } + + /** + * @param {Callback} callback signals when the call finishes + * @returns {void} + */ + readRecords(callback) { + if (this.hooks.readRecords.isUsed()) { + if (this.recordsInputPath) { + asyncLib.parallel([ + cb => this.hooks.readRecords.callAsync(cb), + this._readRecords.bind(this) + ]); } else { - result.push( - (lastEntry = { - onChunks: group.chunks, - chunks: new Set(childGroup.chunks) - }) - ); + this.records = {}; + this.hooks.readRecords.callAsync(callback); + } + } else { + if (this.recordsInputPath) { + this._readRecords(callback); + } else { + this.records = {}; + callback(); } } - return result; } /** - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {boolean=} includeDirectChildren include direct children (by default only children of async children are included) - * @param {ChunkFilterPredicate=} filterFn function used to filter chunks - * @returns {Record>} a record object of names to lists of child ids(?) by chunk id + * @param {Callback} callback signals when the call finishes + * @returns {void} */ - getChildIdsByOrdersMap(chunkGraph, includeDirectChildren, filterFn) { - /** @type {Record>} */ - const chunkMaps = Object.create(null); + _readRecords(callback) { + if (!this.recordsInputPath) { + this.records = {}; + return callback(); + } + this.inputFileSystem.stat(this.recordsInputPath, err => { + // It doesn't exist + // We can ignore this. + if (err) return callback(); - /** - * @param {Chunk} chunk a chunk - * @returns {void} - */ - const addChildIdsByOrdersToMap = chunk => { - const data = chunk.getChildIdsByOrders(chunkGraph, filterFn); - for (const key of Object.keys(data)) { - let chunkMap = chunkMaps[key]; - if (chunkMap === undefined) { - chunkMaps[key] = chunkMap = Object.create(null); + this.inputFileSystem.readFile(this.recordsInputPath, (err, content) => { + if (err) return callback(err); + + try { + this.records = parseJson(content.toString("utf-8")); + } catch (e) { + e.message = "Cannot parse records: " + e.message; + return callback(e); } - chunkMap[chunk.id] = data[key]; + + return callback(); + }); + }); + } + + /** + * @param {Compilation} compilation the compilation + * @param {string} compilerName the compiler's name + * @param {number} compilerIndex the compiler's index + * @param {OutputOptions=} outputOptions the output options + * @param {WebpackPluginInstance[]=} plugins the plugins to apply + * @returns {Compiler} a child compiler + */ + createChildCompiler( + compilation, + compilerName, + compilerIndex, + outputOptions, + plugins + ) { + const childCompiler = new Compiler(this.context, { + ...this.options, + output: { + ...this.options.output, + ...outputOptions } - }; + }); + childCompiler.name = compilerName; + childCompiler.outputPath = this.outputPath; + childCompiler.inputFileSystem = this.inputFileSystem; + childCompiler.outputFileSystem = null; + childCompiler.resolverFactory = this.resolverFactory; + childCompiler.modifiedFiles = this.modifiedFiles; + childCompiler.removedFiles = this.removedFiles; + childCompiler.fileTimestamps = this.fileTimestamps; + childCompiler.contextTimestamps = this.contextTimestamps; + childCompiler.fsStartTime = this.fsStartTime; + childCompiler.cache = this.cache; + childCompiler.compilerPath = `${this.compilerPath}${compilerName}|${compilerIndex}|`; + childCompiler._backCompat = this._backCompat; - if (includeDirectChildren) { - /** @type {Set} */ - const chunks = new Set(); - for (const chunkGroup of this.groupsIterable) { - for (const chunk of chunkGroup.chunks) { - chunks.add(chunk); - } + const relativeCompilerName = makePathsRelative( + this.context, + compilerName, + this.root + ); + if (!this.records[relativeCompilerName]) { + this.records[relativeCompilerName] = []; + } + if (this.records[relativeCompilerName][compilerIndex]) { + childCompiler.records = this.records[relativeCompilerName][compilerIndex]; + } else { + this.records[relativeCompilerName].push((childCompiler.records = {})); + } + + childCompiler.parentCompilation = compilation; + childCompiler.root = this.root; + if (Array.isArray(plugins)) { + for (const plugin of plugins) { + plugin.apply(childCompiler); } - for (const chunk of chunks) { - addChildIdsByOrdersToMap(chunk); + } + for (const name in this.hooks) { + if ( + ![ + "make", + "compile", + "emit", + "afterEmit", + "invalid", + "done", + "thisCompilation" + ].includes(name) + ) { + if (childCompiler.hooks[name]) { + childCompiler.hooks[name].taps = this.hooks[name].taps.slice(); + } } } - for (const chunk of this.getAllAsyncChunks()) { - addChildIdsByOrdersToMap(chunk); - } + compilation.hooks.childCompiler.call( + childCompiler, + compilerName, + compilerIndex + ); - return chunkMaps; + return childCompiler; } -} -module.exports = Chunk; + isChild() { + return !!this.parentCompilation; + } + createCompilation(params) { + this._cleanupLastCompilation(); + return (this._lastCompilation = new Compilation(this, params)); + } -/***/ }), + /** + * @param {CompilationParams} params the compilation parameters + * @returns {Compilation} the created compilation + */ + newCompilation(params) { + const compilation = this.createCompilation(params); + compilation.name = this.name; + compilation.records = this.records; + this.hooks.thisCompilation.call(compilation, params); + this.hooks.compilation.call(compilation, params); + return compilation; + } -/***/ 64971: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + createNormalModuleFactory() { + this._cleanupLastNormalModuleFactory(); + const normalModuleFactory = new NormalModuleFactory({ + context: this.options.context, + fs: this.inputFileSystem, + resolverFactory: this.resolverFactory, + options: this.options.module, + associatedObjectForCache: this.root, + layers: this.options.experiments.layers + }); + this._lastNormalModuleFactory = normalModuleFactory; + this.hooks.normalModuleFactory.call(normalModuleFactory); + return normalModuleFactory; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + createContextModuleFactory() { + const contextModuleFactory = new ContextModuleFactory(this.resolverFactory); + this.hooks.contextModuleFactory.call(contextModuleFactory); + return contextModuleFactory; + } + newCompilationParams() { + const params = { + normalModuleFactory: this.createNormalModuleFactory(), + contextModuleFactory: this.createContextModuleFactory() + }; + return params; + } + /** + * @param {Callback} callback signals when the compilation finishes + * @returns {void} + */ + compile(callback) { + const params = this.newCompilationParams(); + this.hooks.beforeCompile.callAsync(params, err => { + if (err) return callback(err); -const util = __webpack_require__(73837); -const Entrypoint = __webpack_require__(13795); -const ModuleGraphConnection = __webpack_require__(40639); -const { first } = __webpack_require__(93347); -const SortableSet = __webpack_require__(13098); -const { - compareModulesById, - compareIterables, - compareModulesByIdentifier, - concatComparators, - compareSelect, - compareIds -} = __webpack_require__(29579); -const createHash = __webpack_require__(49835); -const findGraphRoots = __webpack_require__(6261); -const { - RuntimeSpecMap, - RuntimeSpecSet, - runtimeToString, - mergeRuntime, - forEachRuntime -} = __webpack_require__(17156); + this.hooks.compile.call(params); -/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGroup")} ChunkGroup */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./RuntimeModule")} RuntimeModule */ -/** @typedef {typeof import("./util/Hash")} Hash */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ + const compilation = this.newCompilation(params); -/** @type {ReadonlySet} */ -const EMPTY_SET = new Set(); + const logger = compilation.getLogger("webpack.Compiler"); -const ZERO_BIG_INT = BigInt(0); + logger.time("make hook"); + this.hooks.make.callAsync(compilation, err => { + logger.timeEnd("make hook"); + if (err) return callback(err); -const compareModuleIterables = compareIterables(compareModulesByIdentifier); + logger.time("finish make hook"); + this.hooks.finishMake.callAsync(compilation, err => { + logger.timeEnd("finish make hook"); + if (err) return callback(err); -/** @typedef {(c: Chunk, chunkGraph: ChunkGraph) => boolean} ChunkFilterPredicate */ -/** @typedef {(m: Module) => boolean} ModuleFilterPredicate */ -/** @typedef {[Module, Entrypoint | undefined]} EntryModuleWithChunkGroup */ + process.nextTick(() => { + logger.time("finish compilation"); + compilation.finish(err => { + logger.timeEnd("finish compilation"); + if (err) return callback(err); -/** - * @typedef {Object} ChunkSizeOptions - * @property {number=} chunkOverhead constant overhead for a chunk - * @property {number=} entryChunkMultiplicator multiplicator for initial chunks - */ + logger.time("seal compilation"); + compilation.seal(err => { + logger.timeEnd("seal compilation"); + if (err) return callback(err); -class ModuleHashInfo { - constructor(hash, renderedHash) { - this.hash = hash; - this.renderedHash = renderedHash; + logger.time("afterCompile hook"); + this.hooks.afterCompile.callAsync(compilation, err => { + logger.timeEnd("afterCompile hook"); + if (err) return callback(err); + + return callback(null, compilation); + }); + }); + }); + }); + }); + }); + }); + } + + /** + * @param {Callback} callback signals when the compiler closes + * @returns {void} + */ + close(callback) { + if (this.watching) { + // When there is still an active watching, close this first + this.watching.close(err => { + this.close(callback); + }); + return; + } + this.hooks.shutdown.callAsync(err => { + if (err) return callback(err); + // Get rid of reference to last compilation to avoid leaking memory + // We can't run this._cleanupLastCompilation() as the Stats to this compilation + // might be still in use. We try to get rid of the reference to the cache instead. + this._lastCompilation = undefined; + this._lastNormalModuleFactory = undefined; + this.cache.shutdown(callback); + }); } } -/** @template T @typedef {(set: SortableSet) => T[]} SetToArrayFunction */ +module.exports = Compiler; -/** - * @template T - * @param {SortableSet} set the set - * @returns {T[]} set as array - */ -const getArray = set => { - return Array.from(set); -}; -/** - * @param {SortableSet} chunks the chunks - * @returns {RuntimeSpecSet} runtimes - */ -const getModuleRuntimes = chunks => { - const runtimes = new RuntimeSpecSet(); - for (const chunk of chunks) { - runtimes.add(chunk.runtime); - } - return runtimes; -}; +/***/ }), -/** - * @param {SortableSet} set the set - * @returns {Map>} modules by source type - */ -const modulesBySourceType = set => { - /** @type {Map>} */ - const map = new Map(); - for (const module of set) { - for (const sourceType of module.getSourceTypes()) { - let innerSet = map.get(sourceType); - if (innerSet === undefined) { - innerSet = new SortableSet(); - map.set(sourceType, innerSet); - } - innerSet.add(module); - } - } - for (const [key, innerSet] of map) { - // When all modules have the source type, we reuse the original SortableSet - // to benefit from the shared cache (especially for sorting) - if (innerSet.size === set.size) { - map.set(key, set); - } - } - return map; -}; +/***/ 98229: +/***/ (function(module) { -/** @type {WeakMap} */ -const createOrderedArrayFunctionMap = new WeakMap(); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/** - * @template T - * @param {function(T, T): -1|0|1} comparator comparator function - * @returns {SetToArrayFunction} set as ordered array - */ -const createOrderedArrayFunction = comparator => { - /** @type {SetToArrayFunction} */ - let fn = createOrderedArrayFunctionMap.get(comparator); - if (fn !== undefined) return fn; - fn = set => { - set.sortWith(comparator); - return Array.from(set); - }; - createOrderedArrayFunctionMap.set(comparator, fn); - return fn; -}; -/** - * @param {Iterable} modules the modules to get the count/size of - * @returns {number} the size of the modules - */ -const getModulesSize = modules => { - let size = 0; - for (const module of modules) { - for (const type of module.getSourceTypes()) { - size += module.size(type); - } - } - return size; -}; + +/** @typedef {import("./Module")} Module */ + +const MODULE_REFERENCE_REGEXP = + /^__WEBPACK_MODULE_REFERENCE__(\d+)_([\da-f]+|ns)(_call)?(_directImport)?(?:_asiSafe(\d))?__$/; + +const DEFAULT_EXPORT = "__WEBPACK_DEFAULT_EXPORT__"; +const NAMESPACE_OBJECT_EXPORT = "__WEBPACK_NAMESPACE_OBJECT__"; /** - * @param {Iterable} modules the sortable Set to get the size of - * @returns {Record} the sizes of the modules + * @typedef {Object} ExternalModuleInfo + * @property {number} index + * @property {Module} module */ -const getModulesSizes = modules => { - let sizes = Object.create(null); - for (const module of modules) { - for (const type of module.getSourceTypes()) { - sizes[type] = (sizes[type] || 0) + module.size(type); - } - } - return sizes; -}; /** - * @param {Chunk} a chunk - * @param {Chunk} b chunk - * @returns {boolean} true, if a is always a parent of b + * @typedef {Object} ConcatenatedModuleInfo + * @property {number} index + * @property {Module} module + * @property {Map} exportMap mapping from export name to symbol + * @property {Map} rawExportMap mapping from export name to symbol + * @property {string=} namespaceExportSymbol */ -const isAvailableChunk = (a, b) => { - const queue = new Set(b.groupsIterable); - for (const chunkGroup of queue) { - if (a.isInGroup(chunkGroup)) continue; - if (chunkGroup.isInitial()) return false; - for (const parent of chunkGroup.parentsIterable) { - queue.add(parent); - } - } - return true; -}; -class ChunkGraphModule { - constructor() { - /** @type {SortableSet} */ - this.chunks = new SortableSet(); - /** @type {Set | undefined} */ - this.entryInChunks = undefined; - /** @type {Set | undefined} */ - this.runtimeInChunks = undefined; - /** @type {RuntimeSpecMap} */ - this.hashes = undefined; - /** @type {string | number} */ - this.id = null; - /** @type {RuntimeSpecMap> | undefined} */ - this.runtimeRequirements = undefined; - /** @type {RuntimeSpecMap} */ - this.graphHashes = undefined; - /** @type {RuntimeSpecMap} */ - this.graphHashesWithConnections = undefined; - } -} +/** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo} ModuleInfo */ -class ChunkGraphChunk { - constructor() { - /** @type {SortableSet} */ - this.modules = new SortableSet(); - /** @type {Map} */ - this.entryModules = new Map(); - /** @type {SortableSet} */ - this.runtimeModules = new SortableSet(); - /** @type {Set | undefined} */ - this.fullHashModules = undefined; - /** @type {Set | undefined} */ - this.dependentHashModules = undefined; - /** @type {Set | undefined} */ - this.runtimeRequirements = undefined; - /** @type {Set} */ - this.runtimeRequirementsInTree = new Set(); - } -} +/** + * @typedef {Object} ModuleReferenceOptions + * @property {string[]} ids the properties/exports of the module + * @property {boolean} call true, when this referenced export is called + * @property {boolean} directImport true, when this referenced export is directly imported (not via property access) + * @property {boolean | undefined} asiSafe if the position is ASI safe or unknown + */ -class ChunkGraph { +class ConcatenationScope { /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {string | Hash} hashFunction the hash function to use + * @param {ModuleInfo[] | Map} modulesMap all module info by module + * @param {ConcatenatedModuleInfo} currentModule the current module info */ - constructor(moduleGraph, hashFunction = "md4") { - /** @private @type {WeakMap} */ - this._modules = new WeakMap(); - /** @private @type {WeakMap} */ - this._chunks = new WeakMap(); - /** @private @type {WeakMap} */ - this._blockChunkGroups = new WeakMap(); - /** @private @type {Map} */ - this._runtimeIds = new Map(); - /** @type {ModuleGraph} */ - this.moduleGraph = moduleGraph; - - this._hashFunction = hashFunction; - - this._getGraphRoots = this._getGraphRoots.bind(this); + constructor(modulesMap, currentModule) { + this._currentModule = currentModule; + if (Array.isArray(modulesMap)) { + const map = new Map(); + for (const info of modulesMap) { + map.set(info.module, info); + } + modulesMap = map; + } + this._modulesMap = modulesMap; } /** - * @private - * @param {Module} module the module - * @returns {ChunkGraphModule} internal module + * @param {Module} module the referenced module + * @returns {boolean} true, when it's in the scope */ - _getChunkGraphModule(module) { - let cgm = this._modules.get(module); - if (cgm === undefined) { - cgm = new ChunkGraphModule(); - this._modules.set(module, cgm); - } - return cgm; + isModuleInScope(module) { + return this._modulesMap.has(module); } /** - * @private - * @param {Chunk} chunk the chunk - * @returns {ChunkGraphChunk} internal chunk + * + * @param {string} exportName name of the export + * @param {string} symbol identifier of the export in source code */ - _getChunkGraphChunk(chunk) { - let cgc = this._chunks.get(chunk); - if (cgc === undefined) { - cgc = new ChunkGraphChunk(); - this._chunks.set(chunk, cgc); + registerExport(exportName, symbol) { + if (!this._currentModule.exportMap) { + this._currentModule.exportMap = new Map(); + } + if (!this._currentModule.exportMap.has(exportName)) { + this._currentModule.exportMap.set(exportName, symbol); } - return cgc; } /** - * @param {SortableSet} set the sortable Set to get the roots of - * @returns {Module[]} the graph roots + * + * @param {string} exportName name of the export + * @param {string} expression expression to be used */ - _getGraphRoots(set) { - const { moduleGraph } = this; - return Array.from( - findGraphRoots(set, module => { - /** @type {Set} */ - const set = new Set(); - const addDependencies = module => { - for (const connection of moduleGraph.getOutgoingConnections(module)) { - if (!connection.module) continue; - const activeState = connection.getActiveState(undefined); - if (activeState === false) continue; - if (activeState === ModuleGraphConnection.TRANSITIVE_ONLY) { - addDependencies(connection.module); - continue; - } - set.add(connection.module); - } - }; - addDependencies(module); - return set; - }) - ).sort(compareModulesByIdentifier); + registerRawExport(exportName, expression) { + if (!this._currentModule.rawExportMap) { + this._currentModule.rawExportMap = new Map(); + } + if (!this._currentModule.rawExportMap.has(exportName)) { + this._currentModule.rawExportMap.set(exportName, expression); + } } /** - * @param {Chunk} chunk the new chunk - * @param {Module} module the module - * @returns {void} + * @param {string} symbol identifier of the export in source code */ - connectChunkAndModule(chunk, module) { - const cgm = this._getChunkGraphModule(module); - const cgc = this._getChunkGraphChunk(chunk); - cgm.chunks.add(chunk); - cgc.modules.add(module); + registerNamespaceExport(symbol) { + this._currentModule.namespaceExportSymbol = symbol; } /** - * @param {Chunk} chunk the chunk - * @param {Module} module the module - * @returns {void} + * + * @param {Module} module the referenced module + * @param {Partial} options options + * @returns {string} the reference as identifier */ - disconnectChunkAndModule(chunk, module) { - const cgm = this._getChunkGraphModule(module); - const cgc = this._getChunkGraphChunk(chunk); - cgc.modules.delete(module); - cgm.chunks.delete(chunk); + createModuleReference( + module, + { ids = undefined, call = false, directImport = false, asiSafe = false } + ) { + const info = this._modulesMap.get(module); + const callFlag = call ? "_call" : ""; + const directImportFlag = directImport ? "_directImport" : ""; + const asiSafeFlag = asiSafe + ? "_asiSafe1" + : asiSafe === false + ? "_asiSafe0" + : ""; + const exportData = ids + ? Buffer.from(JSON.stringify(ids), "utf-8").toString("hex") + : "ns"; + // a "._" is appended to allow "delete ...", which would cause a SyntaxError in strict mode + return `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportData}${callFlag}${directImportFlag}${asiSafeFlag}__._`; } /** - * @param {Chunk} chunk the chunk which will be disconnected - * @returns {void} + * @param {string} name the identifier + * @returns {boolean} true, when it's an module reference */ - disconnectChunk(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - for (const module of cgc.modules) { - const cgm = this._getChunkGraphModule(module); - cgm.chunks.delete(chunk); - } - cgc.modules.clear(); - chunk.disconnectFromGroups(); - ChunkGraph.clearChunkGraphForChunk(chunk); + static isModuleReference(name) { + return MODULE_REFERENCE_REGEXP.test(name); } /** - * @param {Chunk} chunk the chunk - * @param {Iterable} modules the modules - * @returns {void} + * @param {string} name the identifier + * @returns {ModuleReferenceOptions & { index: number }} parsed options and index */ - attachModules(chunk, modules) { - const cgc = this._getChunkGraphChunk(chunk); - for (const module of modules) { - cgc.modules.add(module); - } + static matchModuleReference(name) { + const match = MODULE_REFERENCE_REGEXP.exec(name); + if (!match) return null; + const index = +match[1]; + const asiSafe = match[5]; + return { + index, + ids: + match[2] === "ns" + ? [] + : JSON.parse(Buffer.from(match[2], "hex").toString("utf-8")), + call: !!match[3], + directImport: !!match[4], + asiSafe: asiSafe ? asiSafe === "1" : undefined + }; } +} - /** - * @param {Chunk} chunk the chunk - * @param {Iterable} modules the runtime modules - * @returns {void} - */ - attachRuntimeModules(chunk, modules) { - const cgc = this._getChunkGraphChunk(chunk); - for (const module of modules) { - cgc.runtimeModules.add(module); - } - } +ConcatenationScope.DEFAULT_EXPORT = DEFAULT_EXPORT; +ConcatenationScope.NAMESPACE_OBJECT_EXPORT = NAMESPACE_OBJECT_EXPORT; - /** - * @param {Chunk} chunk the chunk - * @param {Iterable} modules the modules that require a full hash - * @returns {void} - */ - attachFullHashModules(chunk, modules) { - const cgc = this._getChunkGraphChunk(chunk); - if (cgc.fullHashModules === undefined) cgc.fullHashModules = new Set(); - for (const module of modules) { - cgc.fullHashModules.add(module); - } - } +module.exports = ConcatenationScope; - /** - * @param {Chunk} chunk the chunk - * @param {Iterable} modules the modules that require a full hash - * @returns {void} - */ - attachDependentHashModules(chunk, modules) { - const cgc = this._getChunkGraphChunk(chunk); - if (cgc.dependentHashModules === undefined) - cgc.dependentHashModules = new Set(); - for (const module of modules) { - cgc.dependentHashModules.add(module); - } - } - /** - * @param {Module} oldModule the replaced module - * @param {Module} newModule the replacing module - * @returns {void} - */ - replaceModule(oldModule, newModule) { - const oldCgm = this._getChunkGraphModule(oldModule); - const newCgm = this._getChunkGraphModule(newModule); +/***/ }), - for (const chunk of oldCgm.chunks) { - const cgc = this._getChunkGraphChunk(chunk); - cgc.modules.delete(oldModule); - cgc.modules.add(newModule); - newCgm.chunks.add(chunk); - } - oldCgm.chunks.clear(); +/***/ 95735: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (oldCgm.entryInChunks !== undefined) { - if (newCgm.entryInChunks === undefined) { - newCgm.entryInChunks = new Set(); - } - for (const chunk of oldCgm.entryInChunks) { - const cgc = this._getChunkGraphChunk(chunk); - const old = cgc.entryModules.get(oldModule); - /** @type {Map} */ - const newEntryModules = new Map(); - for (const [m, cg] of cgc.entryModules) { - if (m === oldModule) { - newEntryModules.set(newModule, old); - } else { - newEntryModules.set(m, cg); - } - } - cgc.entryModules = newEntryModules; - newCgm.entryInChunks.add(chunk); - } - oldCgm.entryInChunks = undefined; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Maksim Nazarjev @acupofspirt +*/ - if (oldCgm.runtimeInChunks !== undefined) { - if (newCgm.runtimeInChunks === undefined) { - newCgm.runtimeInChunks = new Set(); - } - for (const chunk of oldCgm.runtimeInChunks) { - const cgc = this._getChunkGraphChunk(chunk); - cgc.runtimeModules.delete(/** @type {RuntimeModule} */ (oldModule)); - cgc.runtimeModules.add(/** @type {RuntimeModule} */ (newModule)); - newCgm.runtimeInChunks.add(chunk); - if ( - cgc.fullHashModules !== undefined && - cgc.fullHashModules.has(/** @type {RuntimeModule} */ (oldModule)) - ) { - cgc.fullHashModules.delete(/** @type {RuntimeModule} */ (oldModule)); - cgc.fullHashModules.add(/** @type {RuntimeModule} */ (newModule)); - } - if ( - cgc.dependentHashModules !== undefined && - cgc.dependentHashModules.has(/** @type {RuntimeModule} */ (oldModule)) - ) { - cgc.dependentHashModules.delete( - /** @type {RuntimeModule} */ (oldModule) - ); - cgc.dependentHashModules.add( - /** @type {RuntimeModule} */ (newModule) - ); - } - } - oldCgm.runtimeInChunks = undefined; - } - } - /** - * @param {Module} module the checked module - * @param {Chunk} chunk the checked chunk - * @returns {boolean} true, if the chunk contains the module - */ - isModuleInChunk(module, chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.modules.has(module); - } - /** - * @param {Module} module the checked module - * @param {ChunkGroup} chunkGroup the checked chunk group - * @returns {boolean} true, if the chunk contains the module - */ - isModuleInChunkGroup(module, chunkGroup) { - for (const chunk of chunkGroup.chunks) { - if (this.isModuleInChunk(module, chunk)) return true; - } - return false; - } +const WebpackError = __webpack_require__(53799); - /** - * @param {Module} module the checked module - * @returns {boolean} true, if the module is entry of any chunk - */ - isEntryModule(module) { - const cgm = this._getChunkGraphModule(module); - return cgm.entryInChunks !== undefined; - } +module.exports = class ConcurrentCompilationError extends WebpackError { + constructor() { + super(); - /** - * @param {Module} module the module - * @returns {Iterable} iterable of chunks (do not modify) - */ - getModuleChunksIterable(module) { - const cgm = this._getChunkGraphModule(module); - return cgm.chunks; + this.name = "ConcurrentCompilationError"; + this.message = + "You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."; } +}; - /** - * @param {Module} module the module - * @param {function(Chunk, Chunk): -1|0|1} sortFn sort function - * @returns {Iterable} iterable of chunks (do not modify) - */ - getOrderedModuleChunksIterable(module, sortFn) { - const cgm = this._getChunkGraphModule(module); - cgm.chunks.sortWith(sortFn); - return cgm.chunks; - } - /** - * @param {Module} module the module - * @returns {Chunk[]} array of chunks (cached, do not modify) - */ - getModuleChunks(module) { - const cgm = this._getChunkGraphModule(module); - return cgm.chunks.getFromCache(getArray); - } +/***/ }), - /** - * @param {Module} module the module - * @returns {number} the number of chunk which contain the module - */ - getNumberOfModuleChunks(module) { - const cgm = this._getChunkGraphModule(module); - return cgm.chunks.size; - } +/***/ 61333: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {Module} module the module - * @returns {RuntimeSpecSet} runtimes - */ - getModuleRuntimes(module) { - const cgm = this._getChunkGraphModule(module); - return cgm.chunks.getFromUnorderedCache(getModuleRuntimes); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {Chunk} chunk the chunk - * @returns {number} the number of modules which are contained in this chunk - */ - getNumberOfChunkModules(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.modules.size; - } - /** - * @param {Chunk} chunk the chunk - * @returns {number} the number of full hash modules which are contained in this chunk - */ - getNumberOfChunkFullHashModules(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.fullHashModules === undefined ? 0 : cgc.fullHashModules.size; - } - /** - * @param {Chunk} chunk the chunk - * @returns {Iterable} return the modules for this chunk - */ - getChunkModulesIterable(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.modules; - } +const { ConcatSource, PrefixSource } = __webpack_require__(51255); +const InitFragment = __webpack_require__(55870); +const Template = __webpack_require__(1626); +const { mergeRuntime } = __webpack_require__(17156); - /** - * @param {Chunk} chunk the chunk - * @param {string} sourceType source type - * @returns {Iterable | undefined} return the modules for this chunk - */ - getChunkModulesIterableBySourceType(chunk, sourceType) { - const cgc = this._getChunkGraphChunk(chunk); - const modulesWithSourceType = cgc.modules - .getFromUnorderedCache(modulesBySourceType) - .get(sourceType); - return modulesWithSourceType; +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("./Generator").GenerateContext} GenerateContext */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ + +const wrapInCondition = (condition, source) => { + if (typeof source === "string") { + return Template.asString([ + `if (${condition}) {`, + Template.indent(source), + "}", + "" + ]); + } else { + return new ConcatSource( + `if (${condition}) {\n`, + new PrefixSource("\t", source), + "}\n" + ); } +}; +/** + * @typedef {GenerateContext} Context + */ +class ConditionalInitFragment extends InitFragment { /** - * @param {Chunk} chunk the chunk - * @param {function(Module, Module): -1|0|1} comparator comparator function - * @returns {Iterable} return the modules for this chunk + * @param {string|Source} content the source code that will be included as initialization code + * @param {number} stage category of initialization code (contribute to order) + * @param {number} position position in the category (contribute to order) + * @param {string} key unique key to avoid emitting the same initialization code twice + * @param {RuntimeSpec | boolean} runtimeCondition in which runtime this fragment should be executed + * @param {string|Source=} endContent the source code that will be included at the end of the module */ - getOrderedChunkModulesIterable(chunk, comparator) { - const cgc = this._getChunkGraphChunk(chunk); - cgc.modules.sortWith(comparator); - return cgc.modules; + constructor( + content, + stage, + position, + key, + runtimeCondition = true, + endContent + ) { + super(content, stage, position, key, endContent); + this.runtimeCondition = runtimeCondition; } /** - * @param {Chunk} chunk the chunk - * @param {string} sourceType source type - * @param {function(Module, Module): -1|0|1} comparator comparator function - * @returns {Iterable | undefined} return the modules for this chunk + * @param {Context} context context + * @returns {string|Source} the source code that will be included as initialization code */ - getOrderedChunkModulesIterableBySourceType(chunk, sourceType, comparator) { - const cgc = this._getChunkGraphChunk(chunk); - const modulesWithSourceType = cgc.modules - .getFromUnorderedCache(modulesBySourceType) - .get(sourceType); - if (modulesWithSourceType === undefined) return undefined; - modulesWithSourceType.sortWith(comparator); - return modulesWithSourceType; + getContent(context) { + if (this.runtimeCondition === false || !this.content) return ""; + if (this.runtimeCondition === true) return this.content; + const expr = context.runtimeTemplate.runtimeConditionExpression({ + chunkGraph: context.chunkGraph, + runtimeRequirements: context.runtimeRequirements, + runtime: context.runtime, + runtimeCondition: this.runtimeCondition + }); + if (expr === "true") return this.content; + return wrapInCondition(expr, this.content); } /** - * @param {Chunk} chunk the chunk - * @returns {Module[]} return the modules for this chunk (cached, do not modify) + * @param {Context} context context + * @returns {string|Source=} the source code that will be included at the end of the module */ - getChunkModules(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.modules.getFromUnorderedCache(getArray); + getEndContent(context) { + if (this.runtimeCondition === false || !this.endContent) return ""; + if (this.runtimeCondition === true) return this.endContent; + const expr = context.runtimeTemplate.runtimeConditionExpression({ + chunkGraph: context.chunkGraph, + runtimeRequirements: context.runtimeRequirements, + runtime: context.runtime, + runtimeCondition: this.runtimeCondition + }); + if (expr === "true") return this.endContent; + return wrapInCondition(expr, this.endContent); } - /** - * @param {Chunk} chunk the chunk - * @param {function(Module, Module): -1|0|1} comparator comparator function - * @returns {Module[]} return the modules for this chunk (cached, do not modify) - */ - getOrderedChunkModules(chunk, comparator) { - const cgc = this._getChunkGraphChunk(chunk); - const arrayFunction = createOrderedArrayFunction(comparator); - return cgc.modules.getFromUnorderedCache(arrayFunction); + merge(other) { + if (this.runtimeCondition === true) return this; + if (other.runtimeCondition === true) return other; + if (this.runtimeCondition === false) return other; + if (other.runtimeCondition === false) return this; + const runtimeCondition = mergeRuntime( + this.runtimeCondition, + other.runtimeCondition + ); + return new ConditionalInitFragment( + this.content, + this.stage, + this.position, + this.key, + runtimeCondition, + this.endContent + ); } +} - /** - * @param {Chunk} chunk the chunk - * @param {ModuleFilterPredicate} filterFn function used to filter modules - * @param {boolean} includeAllChunks all chunks or only async chunks - * @returns {Record} chunk to module ids object - */ - getChunkModuleIdMap(chunk, filterFn, includeAllChunks = false) { - /** @type {Record} */ - const chunkModuleIdMap = Object.create(null); +module.exports = ConditionalInitFragment; - for (const asyncChunk of includeAllChunks - ? chunk.getAllReferencedChunks() - : chunk.getAllAsyncChunks()) { - /** @type {(string|number)[]} */ - let array; - for (const module of this.getOrderedChunkModulesIterable( - asyncChunk, - compareModulesById(this) - )) { - if (filterFn(module)) { - if (array === undefined) { - array = []; - chunkModuleIdMap[asyncChunk.id] = array; - } - const moduleId = this.getModuleId(module); - array.push(moduleId); - } - } - } - return chunkModuleIdMap; - } +/***/ }), - /** - * @param {Chunk} chunk the chunk - * @param {ModuleFilterPredicate} filterFn function used to filter modules - * @param {number} hashLength length of the hash - * @param {boolean} includeAllChunks all chunks or only async chunks - * @returns {Record>} chunk to module id to module hash object - */ - getChunkModuleRenderedHashMap( - chunk, - filterFn, - hashLength = 0, - includeAllChunks = false - ) { - /** @type {Record>} */ - const chunkModuleHashMap = Object.create(null); +/***/ 11146: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - for (const asyncChunk of includeAllChunks - ? chunk.getAllReferencedChunks() - : chunk.getAllAsyncChunks()) { - /** @type {Record} */ - let idToHashMap; - for (const module of this.getOrderedChunkModulesIterable( - asyncChunk, - compareModulesById(this) - )) { - if (filterFn(module)) { - if (idToHashMap === undefined) { - idToHashMap = Object.create(null); - chunkModuleHashMap[asyncChunk.id] = idToHashMap; - } - const moduleId = this.getModuleId(module); - const hash = this.getRenderedModuleHash(module, asyncChunk.runtime); - idToHashMap[moduleId] = hashLength ? hash.slice(0, hashLength) : hash; - } - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - return chunkModuleHashMap; - } - /** - * @param {Chunk} chunk the chunk - * @param {ChunkFilterPredicate} filterFn function used to filter chunks - * @returns {Record} chunk map - */ - getChunkConditionMap(chunk, filterFn) { - const map = Object.create(null); - for (const c of chunk.getAllReferencedChunks()) { - map[c.id] = filterFn(c, this); + +const CachedConstDependency = __webpack_require__(57403); +const ConstDependency = __webpack_require__(76911); +const { evaluateToString } = __webpack_require__(93998); +const { parseResource } = __webpack_require__(82186); + +/** @typedef {import("estree").Expression} ExpressionNode */ +/** @typedef {import("estree").Super} SuperNode */ +/** @typedef {import("./Compiler")} Compiler */ + +const collectDeclaration = (declarations, pattern) => { + const stack = [pattern]; + while (stack.length > 0) { + const node = stack.pop(); + switch (node.type) { + case "Identifier": + declarations.add(node.name); + break; + case "ArrayPattern": + for (const element of node.elements) { + if (element) { + stack.push(element); + } + } + break; + case "AssignmentPattern": + stack.push(node.left); + break; + case "ObjectPattern": + for (const property of node.properties) { + stack.push(property.value); + } + break; + case "RestElement": + stack.push(node.argument); + break; } - return map; } +}; - /** - * @param {Chunk} chunk the chunk - * @param {ModuleFilterPredicate} filterFn predicate function used to filter modules - * @param {ChunkFilterPredicate=} filterChunkFn predicate function used to filter chunks - * @returns {boolean} return true if module exists in graph - */ - hasModuleInGraph(chunk, filterFn, filterChunkFn) { - const queue = new Set(chunk.groupsIterable); - const chunksProcessed = new Set(); - - for (const chunkGroup of queue) { - for (const innerChunk of chunkGroup.chunks) { - if (!chunksProcessed.has(innerChunk)) { - chunksProcessed.add(innerChunk); - if (!filterChunkFn || filterChunkFn(innerChunk, this)) { - for (const module of this.getChunkModulesIterable(innerChunk)) { - if (filterFn(module)) { - return true; - } - } +const getHoistedDeclarations = (branch, includeFunctionDeclarations) => { + const declarations = new Set(); + const stack = [branch]; + while (stack.length > 0) { + const node = stack.pop(); + // Some node could be `null` or `undefined`. + if (!node) continue; + switch (node.type) { + // Walk through control statements to look for hoisted declarations. + // Some branches are skipped since they do not allow declarations. + case "BlockStatement": + for (const stmt of node.body) { + stack.push(stmt); + } + break; + case "IfStatement": + stack.push(node.consequent); + stack.push(node.alternate); + break; + case "ForStatement": + stack.push(node.init); + stack.push(node.body); + break; + case "ForInStatement": + case "ForOfStatement": + stack.push(node.left); + stack.push(node.body); + break; + case "DoWhileStatement": + case "WhileStatement": + case "LabeledStatement": + stack.push(node.body); + break; + case "SwitchStatement": + for (const cs of node.cases) { + for (const consequent of cs.consequent) { + stack.push(consequent); } } - } - for (const child of chunkGroup.childrenIterable) { - queue.add(child); - } + break; + case "TryStatement": + stack.push(node.block); + if (node.handler) { + stack.push(node.handler.body); + } + stack.push(node.finalizer); + break; + case "FunctionDeclaration": + if (includeFunctionDeclarations) { + collectDeclaration(declarations, node.id); + } + break; + case "VariableDeclaration": + if (node.kind === "var") { + for (const decl of node.declarations) { + collectDeclaration(declarations, decl.id); + } + } + break; } - return false; } + return Array.from(declarations); +}; +class ConstPlugin { /** - * @param {Chunk} chunkA first chunk - * @param {Chunk} chunkB second chunk - * @returns {-1|0|1} this is a comparator function like sort and returns -1, 0, or 1 based on sort order + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - compareChunks(chunkA, chunkB) { - const cgcA = this._getChunkGraphChunk(chunkA); - const cgcB = this._getChunkGraphChunk(chunkB); - if (cgcA.modules.size > cgcB.modules.size) return -1; - if (cgcA.modules.size < cgcB.modules.size) return 1; - cgcA.modules.sortWith(compareModulesByIdentifier); - cgcB.modules.sortWith(compareModulesByIdentifier); - return compareModuleIterables(cgcA.modules, cgcB.modules); - } + apply(compiler) { + const cachedParseResource = parseResource.bindCache(compiler.root); + compiler.hooks.compilation.tap( + "ConstPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyTemplates.set( + ConstDependency, + new ConstDependency.Template() + ); - /** - * @param {Chunk} chunk the chunk - * @returns {number} total size of all modules in the chunk - */ - getChunkModulesSize(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.modules.getFromUnorderedCache(getModulesSize); - } + compilation.dependencyTemplates.set( + CachedConstDependency, + new CachedConstDependency.Template() + ); - /** - * @param {Chunk} chunk the chunk - * @returns {Record} total sizes of all modules in the chunk by source type - */ - getChunkModulesSizes(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.modules.getFromUnorderedCache(getModulesSizes); - } + const handler = parser => { + parser.hooks.statementIf.tap("ConstPlugin", statement => { + if (parser.scope.isAsmJs) return; + const param = parser.evaluateExpression(statement.test); + const bool = param.asBool(); + if (typeof bool === "boolean") { + if (!param.couldHaveSideEffects()) { + const dep = new ConstDependency(`${bool}`, param.range); + dep.loc = statement.loc; + parser.state.module.addPresentationalDependency(dep); + } else { + parser.walkExpression(statement.test); + } + const branchToRemove = bool + ? statement.alternate + : statement.consequent; + if (branchToRemove) { + // Before removing the dead branch, the hoisted declarations + // must be collected. + // + // Given the following code: + // + // if (true) f() else g() + // if (false) { + // function f() {} + // const g = function g() {} + // if (someTest) { + // let a = 1 + // var x, {y, z} = obj + // } + // } else { + // … + // } + // + // the generated code is: + // + // if (true) f() else {} + // if (false) { + // var f, x, y, z; (in loose mode) + // var x, y, z; (in strict mode) + // } else { + // … + // } + // + // NOTE: When code runs in strict mode, `var` declarations + // are hoisted but `function` declarations don't. + // + let declarations; + if (parser.scope.isStrict) { + // If the code runs in strict mode, variable declarations + // using `var` must be hoisted. + declarations = getHoistedDeclarations(branchToRemove, false); + } else { + // Otherwise, collect all hoisted declaration. + declarations = getHoistedDeclarations(branchToRemove, true); + } + let replacement; + if (declarations.length > 0) { + replacement = `{ var ${declarations.join(", ")}; }`; + } else { + replacement = "{}"; + } + const dep = new ConstDependency( + replacement, + branchToRemove.range + ); + dep.loc = branchToRemove.loc; + parser.state.module.addPresentationalDependency(dep); + } + return bool; + } + }); + parser.hooks.expressionConditionalOperator.tap( + "ConstPlugin", + expression => { + if (parser.scope.isAsmJs) return; + const param = parser.evaluateExpression(expression.test); + const bool = param.asBool(); + if (typeof bool === "boolean") { + if (!param.couldHaveSideEffects()) { + const dep = new ConstDependency(` ${bool}`, param.range); + dep.loc = expression.loc; + parser.state.module.addPresentationalDependency(dep); + } else { + parser.walkExpression(expression.test); + } + // Expressions do not hoist. + // It is safe to remove the dead branch. + // + // Given the following code: + // + // false ? someExpression() : otherExpression(); + // + // the generated code is: + // + // false ? 0 : otherExpression(); + // + const branchToRemove = bool + ? expression.alternate + : expression.consequent; + const dep = new ConstDependency("0", branchToRemove.range); + dep.loc = branchToRemove.loc; + parser.state.module.addPresentationalDependency(dep); + return bool; + } + } + ); + parser.hooks.expressionLogicalOperator.tap( + "ConstPlugin", + expression => { + if (parser.scope.isAsmJs) return; + if ( + expression.operator === "&&" || + expression.operator === "||" + ) { + const param = parser.evaluateExpression(expression.left); + const bool = param.asBool(); + if (typeof bool === "boolean") { + // Expressions do not hoist. + // It is safe to remove the dead branch. + // + // ------------------------------------------ + // + // Given the following code: + // + // falsyExpression() && someExpression(); + // + // the generated code is: + // + // falsyExpression() && false; + // + // ------------------------------------------ + // + // Given the following code: + // + // truthyExpression() && someExpression(); + // + // the generated code is: + // + // true && someExpression(); + // + // ------------------------------------------ + // + // Given the following code: + // + // truthyExpression() || someExpression(); + // + // the generated code is: + // + // truthyExpression() || false; + // + // ------------------------------------------ + // + // Given the following code: + // + // falsyExpression() || someExpression(); + // + // the generated code is: + // + // false && someExpression(); + // + const keepRight = + (expression.operator === "&&" && bool) || + (expression.operator === "||" && !bool); - /** - * @param {Chunk} chunk the chunk - * @returns {Module[]} root modules of the chunks (ordered by identifier) - */ - getChunkRootModules(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.modules.getFromUnorderedCache(this._getGraphRoots); - } + if ( + !param.couldHaveSideEffects() && + (param.isBoolean() || keepRight) + ) { + // for case like + // + // return'development'===process.env.NODE_ENV&&'foo' + // + // we need a space before the bool to prevent result like + // + // returnfalse&&'foo' + // + const dep = new ConstDependency(` ${bool}`, param.range); + dep.loc = expression.loc; + parser.state.module.addPresentationalDependency(dep); + } else { + parser.walkExpression(expression.left); + } + if (!keepRight) { + const dep = new ConstDependency( + "0", + expression.right.range + ); + dep.loc = expression.loc; + parser.state.module.addPresentationalDependency(dep); + } + return keepRight; + } + } else if (expression.operator === "??") { + const param = parser.evaluateExpression(expression.left); + const keepRight = param && param.asNullish(); + if (typeof keepRight === "boolean") { + // ------------------------------------------ + // + // Given the following code: + // + // nonNullish ?? someExpression(); + // + // the generated code is: + // + // nonNullish ?? 0; + // + // ------------------------------------------ + // + // Given the following code: + // + // nullish ?? someExpression(); + // + // the generated code is: + // + // null ?? someExpression(); + // + if (!param.couldHaveSideEffects() && keepRight) { + // cspell:word returnnull + // for case like + // + // return('development'===process.env.NODE_ENV&&null)??'foo' + // + // we need a space before the bool to prevent result like + // + // returnnull??'foo' + // + const dep = new ConstDependency(" null", param.range); + dep.loc = expression.loc; + parser.state.module.addPresentationalDependency(dep); + } else { + const dep = new ConstDependency( + "0", + expression.right.range + ); + dep.loc = expression.loc; + parser.state.module.addPresentationalDependency(dep); + parser.walkExpression(expression.left); + } - /** - * @param {Chunk} chunk the chunk - * @param {ChunkSizeOptions} options options object - * @returns {number} total size of the chunk - */ - getChunkSize(chunk, options = {}) { - const cgc = this._getChunkGraphChunk(chunk); - const modulesSize = cgc.modules.getFromUnorderedCache(getModulesSize); - const chunkOverhead = - typeof options.chunkOverhead === "number" ? options.chunkOverhead : 10000; - const entryChunkMultiplicator = - typeof options.entryChunkMultiplicator === "number" - ? options.entryChunkMultiplicator - : 10; - return ( - chunkOverhead + - modulesSize * (chunk.canBeInitial() ? entryChunkMultiplicator : 1) + return keepRight; + } + } + } + ); + parser.hooks.optionalChaining.tap("ConstPlugin", expr => { + /** @type {ExpressionNode[]} */ + const optionalExpressionsStack = []; + /** @type {ExpressionNode|SuperNode} */ + let next = expr.expression; + + while ( + next.type === "MemberExpression" || + next.type === "CallExpression" + ) { + if (next.type === "MemberExpression") { + if (next.optional) { + // SuperNode can not be optional + optionalExpressionsStack.push( + /** @type {ExpressionNode} */ (next.object) + ); + } + next = next.object; + } else { + if (next.optional) { + // SuperNode can not be optional + optionalExpressionsStack.push( + /** @type {ExpressionNode} */ (next.callee) + ); + } + next = next.callee; + } + } + + while (optionalExpressionsStack.length) { + const expression = optionalExpressionsStack.pop(); + const evaluated = parser.evaluateExpression(expression); + + if (evaluated && evaluated.asNullish()) { + // ------------------------------------------ + // + // Given the following code: + // + // nullishMemberChain?.a.b(); + // + // the generated code is: + // + // undefined; + // + // ------------------------------------------ + // + const dep = new ConstDependency(" undefined", expr.range); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + } + } + }); + parser.hooks.evaluateIdentifier + .for("__resourceQuery") + .tap("ConstPlugin", expr => { + if (parser.scope.isAsmJs) return; + if (!parser.state.module) return; + return evaluateToString( + cachedParseResource(parser.state.module.resource).query + )(expr); + }); + parser.hooks.expression + .for("__resourceQuery") + .tap("ConstPlugin", expr => { + if (parser.scope.isAsmJs) return; + if (!parser.state.module) return; + const dep = new CachedConstDependency( + JSON.stringify( + cachedParseResource(parser.state.module.resource).query + ), + expr.range, + "__resourceQuery" + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + + parser.hooks.evaluateIdentifier + .for("__resourceFragment") + .tap("ConstPlugin", expr => { + if (parser.scope.isAsmJs) return; + if (!parser.state.module) return; + return evaluateToString( + cachedParseResource(parser.state.module.resource).fragment + )(expr); + }); + parser.hooks.expression + .for("__resourceFragment") + .tap("ConstPlugin", expr => { + if (parser.scope.isAsmJs) return; + if (!parser.state.module) return; + const dep = new CachedConstDependency( + JSON.stringify( + cachedParseResource(parser.state.module.resource).fragment + ), + expr.range, + "__resourceFragment" + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + }; + + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("ConstPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("ConstPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("ConstPlugin", handler); + } ); } +} + +module.exports = ConstPlugin; + + +/***/ }), + +/***/ 21411: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./ContextModuleFactory")} ContextModuleFactory */ + +class ContextExclusionPlugin { /** - * @param {Chunk} chunkA chunk - * @param {Chunk} chunkB chunk - * @param {ChunkSizeOptions} options options object - * @returns {number} total size of the chunk or false if chunks can't be integrated + * @param {RegExp} negativeMatcher Matcher regular expression */ - getIntegratedChunksSize(chunkA, chunkB, options = {}) { - const cgcA = this._getChunkGraphChunk(chunkA); - const cgcB = this._getChunkGraphChunk(chunkB); - const allModules = new Set(cgcA.modules); - for (const m of cgcB.modules) allModules.add(m); - let modulesSize = getModulesSize(allModules); - const chunkOverhead = - typeof options.chunkOverhead === "number" ? options.chunkOverhead : 10000; - const entryChunkMultiplicator = - typeof options.entryChunkMultiplicator === "number" - ? options.entryChunkMultiplicator - : 10; - return ( - chunkOverhead + - modulesSize * - (chunkA.canBeInitial() || chunkB.canBeInitial() - ? entryChunkMultiplicator - : 1) - ); + constructor(negativeMatcher) { + this.negativeMatcher = negativeMatcher; } /** - * @param {Chunk} chunkA chunk - * @param {Chunk} chunkB chunk - * @returns {boolean} true, if chunks could be integrated + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - canChunksBeIntegrated(chunkA, chunkB) { - if (chunkA.preventIntegration || chunkB.preventIntegration) { - return false; - } + apply(compiler) { + compiler.hooks.contextModuleFactory.tap("ContextExclusionPlugin", cmf => { + cmf.hooks.contextModuleFiles.tap("ContextExclusionPlugin", files => { + return files.filter(filePath => !this.negativeMatcher.test(filePath)); + }); + }); + } +} - const hasRuntimeA = chunkA.hasRuntime(); - const hasRuntimeB = chunkB.hasRuntime(); +module.exports = ContextExclusionPlugin; - if (hasRuntimeA !== hasRuntimeB) { - if (hasRuntimeA) { - return isAvailableChunk(chunkA, chunkB); - } else if (hasRuntimeB) { - return isAvailableChunk(chunkB, chunkA); - } else { - return false; - } - } - if ( - this.getNumberOfEntryModules(chunkA) > 0 || - this.getNumberOfEntryModules(chunkB) > 0 - ) { - return false; - } +/***/ }), - return true; - } +/***/ 76729: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {Chunk} chunkA the target chunk - * @param {Chunk} chunkB the chunk to integrate - * @returns {void} - */ - integrateChunks(chunkA, chunkB) { - // Decide for one name (deterministic) - if (chunkA.name && chunkB.name) { - if ( - this.getNumberOfEntryModules(chunkA) > 0 === - this.getNumberOfEntryModules(chunkB) > 0 - ) { - // When both chunks have entry modules or none have one, use - // shortest name - if (chunkA.name.length !== chunkB.name.length) { - chunkA.name = - chunkA.name.length < chunkB.name.length ? chunkA.name : chunkB.name; - } else { - chunkA.name = chunkA.name < chunkB.name ? chunkA.name : chunkB.name; - } - } else if (this.getNumberOfEntryModules(chunkB) > 0) { - // Pick the name of the chunk with the entry module - chunkA.name = chunkB.name; - } - } else if (chunkB.name) { - chunkA.name = chunkB.name; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // Merge id name hints - for (const hint of chunkB.idNameHints) { - chunkA.idNameHints.add(hint); - } - // Merge runtime - chunkA.runtime = mergeRuntime(chunkA.runtime, chunkB.runtime); - // getChunkModules is used here to create a clone, because disconnectChunkAndModule modifies - for (const module of this.getChunkModules(chunkB)) { - this.disconnectChunkAndModule(chunkB, module); - this.connectChunkAndModule(chunkA, module); - } +const { OriginalSource, RawSource } = __webpack_require__(51255); +const AsyncDependenciesBlock = __webpack_require__(47736); +const { makeWebpackError } = __webpack_require__(11351); +const Module = __webpack_require__(73208); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const WebpackError = __webpack_require__(53799); +const { + compareLocations, + concatComparators, + compareSelect, + keepOriginalOrder, + compareModulesById +} = __webpack_require__(29579); +const { contextify, parseResource } = __webpack_require__(82186); +const makeSerializable = __webpack_require__(33032); - for (const [module, chunkGroup] of Array.from( - this.getChunkEntryModulesWithChunkGroupIterable(chunkB) - )) { - this.disconnectChunkAndEntryModule(chunkB, module); - this.connectChunkAndEntryModule(chunkA, module, chunkGroup); - } +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./ChunkGroup").RawChunkGroupOptions} RawChunkGroupOptions */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Module").BuildMeta} BuildMeta */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./dependencies/ContextElementDependency")} ContextElementDependency */ +/** @template T @typedef {import("./util/LazySet")} LazySet */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ - for (const chunkGroup of chunkB.groupsIterable) { - chunkGroup.replaceChunk(chunkB, chunkA); - chunkA.addGroup(chunkGroup); - chunkB.removeGroup(chunkGroup); - } - ChunkGraph.clearChunkGraphForChunk(chunkB); - } +/** @typedef {"sync" | "eager" | "weak" | "async-weak" | "lazy" | "lazy-once"} ContextMode Context mode */ - /** - * @param {Chunk} chunk the chunk to upgrade - * @returns {void} - */ - upgradeDependentToFullHashModules(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - if (cgc.dependentHashModules === undefined) return; - if (cgc.fullHashModules === undefined) { - cgc.fullHashModules = cgc.dependentHashModules; - } else { - for (const m of cgc.dependentHashModules) { - cgc.fullHashModules.add(m); - } - cgc.dependentHashModules = undefined; - } - } +/** + * @typedef {Object} ContextOptions + * @property {ContextMode} mode + * @property {boolean} recursive + * @property {RegExp} regExp + * @property {"strict"|boolean=} namespaceObject + * @property {string=} addon + * @property {string=} chunkName + * @property {RegExp=} include + * @property {RegExp=} exclude + * @property {RawChunkGroupOptions=} groupOptions + * @property {string=} typePrefix + * @property {string=} category + * @property {string[][]=} referencedExports exports referenced from modules (won't be mangled) + */ - /** - * @param {Module} module the checked module - * @param {Chunk} chunk the checked chunk - * @returns {boolean} true, if the chunk contains the module as entry - */ - isEntryModuleInChunk(module, chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.entryModules.has(module); - } +/** + * @typedef {Object} ContextModuleOptionsExtras + * @property {string} resource + * @property {string=} resourceQuery + * @property {string=} resourceFragment + * @property {TODO} resolveOptions + */ + +/** @typedef {ContextOptions & ContextModuleOptionsExtras} ContextModuleOptions */ + +/** + * @callback ResolveDependenciesCallback + * @param {(Error | null)=} err + * @param {ContextElementDependency[]=} dependencies + */ + +/** + * @callback ResolveDependencies + * @param {InputFileSystem} fs + * @param {ContextModuleOptions} options + * @param {ResolveDependenciesCallback} callback + */ +const SNAPSHOT_OPTIONS = { timestamp: true }; + +const TYPES = new Set(["javascript"]); + +class ContextModule extends Module { /** - * @param {Chunk} chunk the new chunk - * @param {Module} module the entry module - * @param {Entrypoint=} entrypoint the chunk group which must be loaded before the module is executed - * @returns {void} + * @param {ResolveDependencies} resolveDependencies function to get dependencies in this context + * @param {ContextModuleOptions} options options object */ - connectChunkAndEntryModule(chunk, module, entrypoint) { - const cgm = this._getChunkGraphModule(module); - const cgc = this._getChunkGraphChunk(chunk); - if (cgm.entryInChunks === undefined) { - cgm.entryInChunks = new Set(); + constructor(resolveDependencies, options) { + const parsed = parseResource(options ? options.resource : ""); + const resource = parsed.path; + const resourceQuery = (options && options.resourceQuery) || parsed.query; + const resourceFragment = + (options && options.resourceFragment) || parsed.fragment; + + super("javascript/dynamic", resource); + + // Info from Factory + this.resolveDependencies = resolveDependencies; + /** @type {ContextModuleOptions} */ + this.options = { + ...options, + resource, + resourceQuery, + resourceFragment + }; + if (options && options.resolveOptions !== undefined) { + this.resolveOptions = options.resolveOptions; } - cgm.entryInChunks.add(chunk); - cgc.entryModules.set(module, entrypoint); - } - /** - * @param {Chunk} chunk the new chunk - * @param {RuntimeModule} module the runtime module - * @returns {void} - */ - connectChunkAndRuntimeModule(chunk, module) { - const cgm = this._getChunkGraphModule(module); - const cgc = this._getChunkGraphChunk(chunk); - if (cgm.runtimeInChunks === undefined) { - cgm.runtimeInChunks = new Set(); + if (options && typeof options.mode !== "string") { + throw new Error("options.mode is a required option"); } - cgm.runtimeInChunks.add(chunk); - cgc.runtimeModules.add(module); - } - /** - * @param {Chunk} chunk the new chunk - * @param {RuntimeModule} module the module that require a full hash - * @returns {void} - */ - addFullHashModuleToChunk(chunk, module) { - const cgc = this._getChunkGraphChunk(chunk); - if (cgc.fullHashModules === undefined) cgc.fullHashModules = new Set(); - cgc.fullHashModules.add(module); + this._identifier = this._createIdentifier(); + this._forceBuild = true; } /** - * @param {Chunk} chunk the new chunk - * @param {RuntimeModule} module the module that require a full hash - * @returns {void} + * @returns {Set} types available (do not mutate) */ - addDependentHashModuleToChunk(chunk, module) { - const cgc = this._getChunkGraphChunk(chunk); - if (cgc.dependentHashModules === undefined) - cgc.dependentHashModules = new Set(); - cgc.dependentHashModules.add(module); + getSourceTypes() { + return TYPES; } /** - * @param {Chunk} chunk the new chunk - * @param {Module} module the entry module + * Assuming this module is in the cache. Update the (cached) module with + * the fresh module from the factory. Usually updates internal references + * and properties. + * @param {Module} module fresh module * @returns {void} */ - disconnectChunkAndEntryModule(chunk, module) { - const cgm = this._getChunkGraphModule(module); - const cgc = this._getChunkGraphChunk(chunk); - cgm.entryInChunks.delete(chunk); - if (cgm.entryInChunks.size === 0) { - cgm.entryInChunks = undefined; - } - cgc.entryModules.delete(module); + updateCacheModule(module) { + const m = /** @type {ContextModule} */ (module); + this.resolveDependencies = m.resolveDependencies; + this.options = m.options; } /** - * @param {Chunk} chunk the new chunk - * @param {RuntimeModule} module the runtime module - * @returns {void} + * Assuming this module is in the cache. Remove internal references to allow freeing some memory. */ - disconnectChunkAndRuntimeModule(chunk, module) { - const cgm = this._getChunkGraphModule(module); - const cgc = this._getChunkGraphChunk(chunk); - cgm.runtimeInChunks.delete(chunk); - if (cgm.runtimeInChunks.size === 0) { - cgm.runtimeInChunks = undefined; - } - cgc.runtimeModules.delete(module); + cleanupForCache() { + super.cleanupForCache(); + this.resolveDependencies = undefined; } - /** - * @param {Module} module the entry module, it will no longer be entry - * @returns {void} - */ - disconnectEntryModule(module) { - const cgm = this._getChunkGraphModule(module); - for (const chunk of cgm.entryInChunks) { - const cgc = this._getChunkGraphChunk(chunk); - cgc.entryModules.delete(module); - } - cgm.entryInChunks = undefined; + _prettyRegExp(regexString, stripSlash = true) { + const str = (regexString + "").replace(/!/g, "%21").replace(/\|/g, "%7C"); + return stripSlash ? str.substring(1, str.length - 1) : str; } - /** - * @param {Chunk} chunk the chunk, for which all entries will be removed - * @returns {void} - */ - disconnectEntries(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - for (const module of cgc.entryModules.keys()) { - const cgm = this._getChunkGraphModule(module); - cgm.entryInChunks.delete(chunk); - if (cgm.entryInChunks.size === 0) { - cgm.entryInChunks = undefined; - } + _createIdentifier() { + let identifier = this.context; + if (this.options.resourceQuery) { + identifier += `|${this.options.resourceQuery}`; + } + if (this.options.resourceFragment) { + identifier += `|${this.options.resourceFragment}`; + } + if (this.options.mode) { + identifier += `|${this.options.mode}`; + } + if (!this.options.recursive) { + identifier += "|nonrecursive"; + } + if (this.options.addon) { + identifier += `|${this.options.addon}`; + } + if (this.options.regExp) { + identifier += `|${this._prettyRegExp(this.options.regExp, false)}`; + } + if (this.options.include) { + identifier += `|include: ${this._prettyRegExp( + this.options.include, + false + )}`; + } + if (this.options.exclude) { + identifier += `|exclude: ${this._prettyRegExp( + this.options.exclude, + false + )}`; + } + if (this.options.referencedExports) { + identifier += `|referencedExports: ${JSON.stringify( + this.options.referencedExports + )}`; + } + if (this.options.chunkName) { + identifier += `|chunkName: ${this.options.chunkName}`; + } + if (this.options.groupOptions) { + identifier += `|groupOptions: ${JSON.stringify( + this.options.groupOptions + )}`; + } + if (this.options.namespaceObject === "strict") { + identifier += "|strict namespace object"; + } else if (this.options.namespaceObject) { + identifier += "|namespace object"; } - cgc.entryModules.clear(); - } - - /** - * @param {Chunk} chunk the chunk - * @returns {number} the amount of entry modules in chunk - */ - getNumberOfEntryModules(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.entryModules.size; - } - /** - * @param {Chunk} chunk the chunk - * @returns {number} the amount of entry modules in chunk - */ - getNumberOfRuntimeModules(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.runtimeModules.size; + return identifier; } /** - * @param {Chunk} chunk the chunk - * @returns {Iterable} iterable of modules (do not modify) + * @returns {string} a unique identifier of the module */ - getChunkEntryModulesIterable(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.entryModules.keys(); + identifier() { + return this._identifier; } /** - * @param {Chunk} chunk the chunk - * @returns {Iterable} iterable of chunks + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module */ - getChunkEntryDependentChunksIterable(chunk) { - /** @type {Set} */ - const set = new Set(); - for (const chunkGroup of chunk.groupsIterable) { - if (chunkGroup instanceof Entrypoint) { - const entrypointChunk = chunkGroup.getEntrypointChunk(); - const cgc = this._getChunkGraphChunk(entrypointChunk); - for (const chunkGroup of cgc.entryModules.values()) { - for (const c of chunkGroup.chunks) { - if (c !== chunk && c !== entrypointChunk && !c.hasRuntime()) { - set.add(c); - } - } - } + readableIdentifier(requestShortener) { + let identifier = requestShortener.shorten(this.context) + "/"; + if (this.options.resourceQuery) { + identifier += ` ${this.options.resourceQuery}`; + } + if (this.options.mode) { + identifier += ` ${this.options.mode}`; + } + if (!this.options.recursive) { + identifier += " nonrecursive"; + } + if (this.options.addon) { + identifier += ` ${requestShortener.shorten(this.options.addon)}`; + } + if (this.options.regExp) { + identifier += ` ${this._prettyRegExp(this.options.regExp)}`; + } + if (this.options.include) { + identifier += ` include: ${this._prettyRegExp(this.options.include)}`; + } + if (this.options.exclude) { + identifier += ` exclude: ${this._prettyRegExp(this.options.exclude)}`; + } + if (this.options.referencedExports) { + identifier += ` referencedExports: ${this.options.referencedExports + .map(e => e.join(".")) + .join(", ")}`; + } + if (this.options.chunkName) { + identifier += ` chunkName: ${this.options.chunkName}`; + } + if (this.options.groupOptions) { + const groupOptions = this.options.groupOptions; + for (const key of Object.keys(groupOptions)) { + identifier += ` ${key}: ${groupOptions[key]}`; } } + if (this.options.namespaceObject === "strict") { + identifier += " strict namespace object"; + } else if (this.options.namespaceObject) { + identifier += " namespace object"; + } - return set; + return identifier; } /** - * @param {Chunk} chunk the chunk - * @returns {boolean} true, when it has dependent chunks + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion */ - hasChunkEntryDependentChunks(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - for (const chunkGroup of cgc.entryModules.values()) { - for (const c of chunkGroup.chunks) { - if (c !== chunk) { - return true; - } - } + libIdent(options) { + let identifier = contextify( + options.context, + this.context, + options.associatedObjectForCache + ); + if (this.layer) identifier = `(${this.layer})/${identifier}`; + if (this.options.mode) { + identifier += ` ${this.options.mode}`; + } + if (this.options.recursive) { + identifier += " recursive"; + } + if (this.options.addon) { + identifier += ` ${contextify( + options.context, + this.options.addon, + options.associatedObjectForCache + )}`; + } + if (this.options.regExp) { + identifier += ` ${this._prettyRegExp(this.options.regExp)}`; + } + if (this.options.include) { + identifier += ` include: ${this._prettyRegExp(this.options.include)}`; + } + if (this.options.exclude) { + identifier += ` exclude: ${this._prettyRegExp(this.options.exclude)}`; + } + if (this.options.referencedExports) { + identifier += ` referencedExports: ${this.options.referencedExports + .map(e => e.join(".")) + .join(", ")}`; } - return false; - } - /** - * @param {Chunk} chunk the chunk - * @returns {Iterable} iterable of modules (do not modify) - */ - getChunkRuntimeModulesIterable(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.runtimeModules; + return identifier; } /** - * @param {Chunk} chunk the chunk - * @returns {RuntimeModule[]} array of modules in order of execution + * @returns {void} */ - getChunkRuntimeModulesInOrder(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - const array = Array.from(cgc.runtimeModules); - array.sort( - concatComparators( - compareSelect( - /** - * @param {RuntimeModule} r runtime module - * @returns {number=} stage - */ - r => r.stage, - compareIds - ), - compareModulesByIdentifier - ) - ); - return array; + invalidateBuild() { + this._forceBuild = true; } /** - * @param {Chunk} chunk the chunk - * @returns {Iterable | undefined} iterable of modules (do not modify) + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} */ - getChunkFullHashModulesIterable(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.fullHashModules; + needBuild({ fileSystemInfo }, callback) { + // build if enforced + if (this._forceBuild) return callback(null, true); + + // always build when we have no snapshot + if (!this.buildInfo.snapshot) return callback(null, true); + + fileSystemInfo.checkSnapshotValid(this.buildInfo.snapshot, (err, valid) => { + callback(err, !valid); + }); } /** - * @param {Chunk} chunk the chunk - * @returns {ReadonlySet | undefined} set of modules (do not modify) + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} */ - getChunkFullHashModulesSet(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.fullHashModules; + build(options, compilation, resolver, fs, callback) { + this._forceBuild = false; + /** @type {BuildMeta} */ + this.buildMeta = { + exportsType: "default", + defaultObject: "redirect-warn" + }; + this.buildInfo = { + snapshot: undefined + }; + this.dependencies.length = 0; + this.blocks.length = 0; + const startTime = Date.now(); + this.resolveDependencies(fs, this.options, (err, dependencies) => { + if (err) { + return callback( + makeWebpackError(err, "ContextModule.resolveDependencies") + ); + } + + // abort if something failed + // this will create an empty context + if (!dependencies) { + callback(); + return; + } + + // enhance dependencies with meta info + for (const dep of dependencies) { + dep.loc = { + name: dep.userRequest + }; + dep.request = this.options.addon + dep.request; + } + dependencies.sort( + concatComparators( + compareSelect(a => a.loc, compareLocations), + keepOriginalOrder(this.dependencies) + ) + ); + + if (this.options.mode === "sync" || this.options.mode === "eager") { + // if we have an sync or eager context + // just add all dependencies and continue + this.dependencies = dependencies; + } else if (this.options.mode === "lazy-once") { + // for the lazy-once mode create a new async dependency block + // and add that block to this context + if (dependencies.length > 0) { + const block = new AsyncDependenciesBlock({ + ...this.options.groupOptions, + name: this.options.chunkName + }); + for (const dep of dependencies) { + block.addDependency(dep); + } + this.addBlock(block); + } + } else if ( + this.options.mode === "weak" || + this.options.mode === "async-weak" + ) { + // we mark all dependencies as weak + for (const dep of dependencies) { + dep.weak = true; + } + this.dependencies = dependencies; + } else if (this.options.mode === "lazy") { + // if we are lazy create a new async dependency block per dependency + // and add all blocks to this context + let index = 0; + for (const dep of dependencies) { + let chunkName = this.options.chunkName; + if (chunkName) { + if (!/\[(index|request)\]/.test(chunkName)) { + chunkName += "[index]"; + } + chunkName = chunkName.replace(/\[index\]/g, `${index++}`); + chunkName = chunkName.replace( + /\[request\]/g, + Template.toPath(dep.userRequest) + ); + } + const block = new AsyncDependenciesBlock( + { + ...this.options.groupOptions, + name: chunkName + }, + dep.loc, + dep.userRequest + ); + block.addDependency(dep); + this.addBlock(block); + } + } else { + callback( + new WebpackError(`Unsupported mode "${this.options.mode}" in context`) + ); + return; + } + compilation.fileSystemInfo.createSnapshot( + startTime, + null, + [this.context], + null, + SNAPSHOT_OPTIONS, + (err, snapshot) => { + if (err) return callback(err); + this.buildInfo.snapshot = snapshot; + callback(); + } + ); + }); } /** - * @param {Chunk} chunk the chunk - * @returns {Iterable | undefined} iterable of modules (do not modify) + * @param {LazySet} fileDependencies set where file dependencies are added to + * @param {LazySet} contextDependencies set where context dependencies are added to + * @param {LazySet} missingDependencies set where missing dependencies are added to + * @param {LazySet} buildDependencies set where build dependencies are added to */ - getChunkDependentHashModulesIterable(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.dependentHashModules; + addCacheDependencies( + fileDependencies, + contextDependencies, + missingDependencies, + buildDependencies + ) { + contextDependencies.add(this.context); } /** - * @param {Chunk} chunk the chunk - * @returns {Iterable} iterable of modules (do not modify) + * @param {ContextElementDependency[]} dependencies all dependencies + * @param {ChunkGraph} chunkGraph chunk graph + * @returns {TODO} TODO */ - getChunkEntryModulesWithChunkGroupIterable(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.entryModules; + getUserRequestMap(dependencies, chunkGraph) { + const moduleGraph = chunkGraph.moduleGraph; + // if we filter first we get a new array + // therefore we don't need to create a clone of dependencies explicitly + // therefore the order of this is !important! + const sortedDependencies = dependencies + .filter(dependency => moduleGraph.getModule(dependency)) + .sort((a, b) => { + if (a.userRequest === b.userRequest) { + return 0; + } + return a.userRequest < b.userRequest ? -1 : 1; + }); + const map = Object.create(null); + for (const dep of sortedDependencies) { + const module = moduleGraph.getModule(dep); + map[dep.userRequest] = chunkGraph.getModuleId(module); + } + return map; } /** - * @param {AsyncDependenciesBlock} depBlock the async block - * @returns {ChunkGroup} the chunk group + * @param {ContextElementDependency[]} dependencies all dependencies + * @param {ChunkGraph} chunkGraph chunk graph + * @returns {TODO} TODO */ - getBlockChunkGroup(depBlock) { - return this._blockChunkGroups.get(depBlock); + getFakeMap(dependencies, chunkGraph) { + if (!this.options.namespaceObject) { + return 9; + } + const moduleGraph = chunkGraph.moduleGraph; + // bitfield + let hasType = 0; + const comparator = compareModulesById(chunkGraph); + // if we filter first we get a new array + // therefore we don't need to create a clone of dependencies explicitly + // therefore the order of this is !important! + const sortedModules = dependencies + .map(dependency => moduleGraph.getModule(dependency)) + .filter(Boolean) + .sort(comparator); + const fakeMap = Object.create(null); + for (const module of sortedModules) { + const exportsType = module.getExportsType( + moduleGraph, + this.options.namespaceObject === "strict" + ); + const id = chunkGraph.getModuleId(module); + switch (exportsType) { + case "namespace": + fakeMap[id] = 9; + hasType |= 1; + break; + case "dynamic": + fakeMap[id] = 7; + hasType |= 2; + break; + case "default-only": + fakeMap[id] = 1; + hasType |= 4; + break; + case "default-with-named": + fakeMap[id] = 3; + hasType |= 8; + break; + default: + throw new Error(`Unexpected exports type ${exportsType}`); + } + } + if (hasType === 1) { + return 9; + } + if (hasType === 2) { + return 7; + } + if (hasType === 4) { + return 1; + } + if (hasType === 8) { + return 3; + } + if (hasType === 0) { + return 9; + } + return fakeMap; } - /** - * @param {AsyncDependenciesBlock} depBlock the async block - * @param {ChunkGroup} chunkGroup the chunk group - * @returns {void} - */ - connectBlockAndChunkGroup(depBlock, chunkGroup) { - this._blockChunkGroups.set(depBlock, chunkGroup); - chunkGroup.addBlock(depBlock); + getFakeMapInitStatement(fakeMap) { + return typeof fakeMap === "object" + ? `var fakeMap = ${JSON.stringify(fakeMap, null, "\t")};` + : ""; } - /** - * @param {ChunkGroup} chunkGroup the chunk group - * @returns {void} - */ - disconnectChunkGroup(chunkGroup) { - for (const block of chunkGroup.blocksIterable) { - this._blockChunkGroups.delete(block); + getReturn(type, asyncModule) { + if (type === 9) { + return "__webpack_require__(id)"; } - // TODO refactor by moving blocks list into ChunkGraph - chunkGroup._blocks.clear(); + return `${RuntimeGlobals.createFakeNamespaceObject}(id, ${type}${ + asyncModule ? " | 16" : "" + })`; } - /** - * @param {Module} module the module - * @returns {string | number} the id of the module - */ - getModuleId(module) { - const cgm = this._getChunkGraphModule(module); - return cgm.id; + getReturnModuleObjectSource( + fakeMap, + asyncModule, + fakeMapDataExpression = "fakeMap[id]" + ) { + if (typeof fakeMap === "number") { + return `return ${this.getReturn(fakeMap, asyncModule)};`; + } + return `return ${ + RuntimeGlobals.createFakeNamespaceObject + }(id, ${fakeMapDataExpression}${asyncModule ? " | 16" : ""})`; } /** - * @param {Module} module the module - * @param {string | number} id the id of the module - * @returns {void} + * @param {TODO} dependencies TODO + * @param {TODO} id TODO + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {string} source code */ - setModuleId(module, id) { - const cgm = this._getChunkGraphModule(module); - cgm.id = id; - } + getSyncSource(dependencies, id, chunkGraph) { + const map = this.getUserRequestMap(dependencies, chunkGraph); + const fakeMap = this.getFakeMap(dependencies, chunkGraph); + const returnModuleObject = this.getReturnModuleObjectSource(fakeMap); - /** - * @param {string} runtime runtime - * @returns {string | number} the id of the runtime - */ - getRuntimeId(runtime) { - return this._runtimeIds.get(runtime); + return `var map = ${JSON.stringify(map, null, "\t")}; +${this.getFakeMapInitStatement(fakeMap)} + +function webpackContext(req) { + var id = webpackContextResolve(req); + ${returnModuleObject} +} +function webpackContextResolve(req) { + if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + } + return map[req]; +} +webpackContext.keys = function webpackContextKeys() { + return Object.keys(map); +}; +webpackContext.resolve = webpackContextResolve; +module.exports = webpackContext; +webpackContext.id = ${JSON.stringify(id)};`; } /** - * @param {string} runtime runtime - * @param {string | number} id the id of the runtime - * @returns {void} + * @param {TODO} dependencies TODO + * @param {TODO} id TODO + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {string} source code */ - setRuntimeId(runtime, id) { - this._runtimeIds.set(runtime, id); + getWeakSyncSource(dependencies, id, chunkGraph) { + const map = this.getUserRequestMap(dependencies, chunkGraph); + const fakeMap = this.getFakeMap(dependencies, chunkGraph); + const returnModuleObject = this.getReturnModuleObjectSource(fakeMap); + + return `var map = ${JSON.stringify(map, null, "\t")}; +${this.getFakeMapInitStatement(fakeMap)} + +function webpackContext(req) { + var id = webpackContextResolve(req); + if(!${RuntimeGlobals.moduleFactories}[id]) { + var e = new Error("Module '" + req + "' ('" + id + "') is not available (weak dependency)"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + } + ${returnModuleObject} +} +function webpackContextResolve(req) { + if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + } + return map[req]; +} +webpackContext.keys = function webpackContextKeys() { + return Object.keys(map); +}; +webpackContext.resolve = webpackContextResolve; +webpackContext.id = ${JSON.stringify(id)}; +module.exports = webpackContext;`; } /** - * @template T - * @param {Module} module the module - * @param {RuntimeSpecMap} hashes hashes data - * @param {RuntimeSpec} runtime the runtime - * @returns {T} hash + * @param {TODO} dependencies TODO + * @param {TODO} id TODO + * @param {Object} context context + * @param {ChunkGraph} context.chunkGraph the chunk graph + * @param {RuntimeTemplate} context.runtimeTemplate the chunk graph + * @returns {string} source code */ - _getModuleHashInfo(module, hashes, runtime) { - if (!hashes) { - throw new Error( - `Module ${module.identifier()} has no hash info for runtime ${runtimeToString( - runtime - )} (hashes not set at all)` - ); - } else if (runtime === undefined) { - const hashInfoItems = new Set(hashes.values()); - if (hashInfoItems.size !== 1) { - throw new Error( - `No unique hash info entry for unspecified runtime for ${module.identifier()} (existing runtimes: ${Array.from( - hashes.keys(), - r => runtimeToString(r) - ).join(", ")}). -Caller might not support runtime-dependent code generation (opt-out via optimization.usedExports: "global").` - ); - } - return first(hashInfoItems); - } else { - const hashInfo = hashes.get(runtime); - if (!hashInfo) { - throw new Error( - `Module ${module.identifier()} has no hash info for runtime ${runtimeToString( - runtime - )} (available runtimes ${Array.from( - hashes.keys(), - runtimeToString - ).join(", ")})` - ); - } - return hashInfo; + getAsyncWeakSource(dependencies, id, { chunkGraph, runtimeTemplate }) { + const arrow = runtimeTemplate.supportsArrowFunction(); + const map = this.getUserRequestMap(dependencies, chunkGraph); + const fakeMap = this.getFakeMap(dependencies, chunkGraph); + const returnModuleObject = this.getReturnModuleObjectSource(fakeMap, true); + + return `var map = ${JSON.stringify(map, null, "\t")}; +${this.getFakeMapInitStatement(fakeMap)} + +function webpackAsyncContext(req) { + return webpackAsyncContextResolve(req).then(${ + arrow ? "id =>" : "function(id)" + } { + if(!${RuntimeGlobals.moduleFactories}[id]) { + var e = new Error("Module '" + req + "' ('" + id + "') is not available (weak dependency)"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + } + ${returnModuleObject} + }); +} +function webpackAsyncContextResolve(req) { + // Here Promise.resolve().then() is used instead of new Promise() to prevent + // uncaught exception popping up in devtools + return Promise.resolve().then(${arrow ? "() =>" : "function()"} { + if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; } + return map[req]; + }); +} +webpackAsyncContext.keys = ${runtimeTemplate.returningFunction( + "Object.keys(map)" + )}; +webpackAsyncContext.resolve = webpackAsyncContextResolve; +webpackAsyncContext.id = ${JSON.stringify(id)}; +module.exports = webpackAsyncContext;`; } /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true, if the module has hashes for this runtime + * @param {TODO} dependencies TODO + * @param {TODO} id TODO + * @param {Object} context context + * @param {ChunkGraph} context.chunkGraph the chunk graph + * @param {RuntimeTemplate} context.runtimeTemplate the chunk graph + * @returns {string} source code */ - hasModuleHashes(module, runtime) { - const cgm = this._getChunkGraphModule(module); - const hashes = cgm.hashes; - return hashes && hashes.has(runtime); - } + getEagerSource(dependencies, id, { chunkGraph, runtimeTemplate }) { + const arrow = runtimeTemplate.supportsArrowFunction(); + const map = this.getUserRequestMap(dependencies, chunkGraph); + const fakeMap = this.getFakeMap(dependencies, chunkGraph); + const thenFunction = + fakeMap !== 9 + ? `${arrow ? "id =>" : "function(id)"} { + ${this.getReturnModuleObjectSource(fakeMap)} + }` + : "__webpack_require__"; + return `var map = ${JSON.stringify(map, null, "\t")}; +${this.getFakeMapInitStatement(fakeMap)} - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @returns {string} hash - */ - getModuleHash(module, runtime) { - const cgm = this._getChunkGraphModule(module); - const hashes = cgm.hashes; - return this._getModuleHashInfo(module, hashes, runtime).hash; +function webpackAsyncContext(req) { + return webpackAsyncContextResolve(req).then(${thenFunction}); +} +function webpackAsyncContextResolve(req) { + // Here Promise.resolve().then() is used instead of new Promise() to prevent + // uncaught exception popping up in devtools + return Promise.resolve().then(${arrow ? "() =>" : "function()"} { + if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + } + return map[req]; + }); +} +webpackAsyncContext.keys = ${runtimeTemplate.returningFunction( + "Object.keys(map)" + )}; +webpackAsyncContext.resolve = webpackAsyncContextResolve; +webpackAsyncContext.id = ${JSON.stringify(id)}; +module.exports = webpackAsyncContext;`; } /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @returns {string} hash + * @param {TODO} block TODO + * @param {TODO} dependencies TODO + * @param {TODO} id TODO + * @param {Object} options options object + * @param {RuntimeTemplate} options.runtimeTemplate the runtime template + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @returns {string} source code */ - getRenderedModuleHash(module, runtime) { - const cgm = this._getChunkGraphModule(module); - const hashes = cgm.hashes; - return this._getModuleHashInfo(module, hashes, runtime).renderedHash; - } - - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @param {string} hash the full hash - * @param {string} renderedHash the shortened hash for rendering - * @returns {void} - */ - setModuleHashes(module, runtime, hash, renderedHash) { - const cgm = this._getChunkGraphModule(module); - if (cgm.hashes === undefined) { - cgm.hashes = new RuntimeSpecMap(); + getLazyOnceSource(block, dependencies, id, { runtimeTemplate, chunkGraph }) { + const promise = runtimeTemplate.blockPromise({ + chunkGraph, + block, + message: "lazy-once context", + runtimeRequirements: new Set() + }); + const arrow = runtimeTemplate.supportsArrowFunction(); + const map = this.getUserRequestMap(dependencies, chunkGraph); + const fakeMap = this.getFakeMap(dependencies, chunkGraph); + const thenFunction = + fakeMap !== 9 + ? `${arrow ? "id =>" : "function(id)"} { + ${this.getReturnModuleObjectSource(fakeMap, true)}; + }` + : "__webpack_require__"; + + return `var map = ${JSON.stringify(map, null, "\t")}; +${this.getFakeMapInitStatement(fakeMap)} + +function webpackAsyncContext(req) { + return webpackAsyncContextResolve(req).then(${thenFunction}); +} +function webpackAsyncContextResolve(req) { + return ${promise}.then(${arrow ? "() =>" : "function()"} { + if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; } - cgm.hashes.set(runtime, new ModuleHashInfo(hash, renderedHash)); + return map[req]; + }); +} +webpackAsyncContext.keys = ${runtimeTemplate.returningFunction( + "Object.keys(map)" + )}; +webpackAsyncContext.resolve = webpackAsyncContextResolve; +webpackAsyncContext.id = ${JSON.stringify(id)}; +module.exports = webpackAsyncContext;`; } /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @param {Set} items runtime requirements to be added (ownership of this Set is given to ChunkGraph when transferOwnership not false) - * @param {boolean} transferOwnership true: transfer ownership of the items object, false: items is immutable and shared and won't be modified - * @returns {void} + * @param {TODO} blocks TODO + * @param {TODO} id TODO + * @param {Object} context context + * @param {ChunkGraph} context.chunkGraph the chunk graph + * @param {RuntimeTemplate} context.runtimeTemplate the chunk graph + * @returns {string} source code */ - addModuleRuntimeRequirements( - module, - runtime, - items, - transferOwnership = true - ) { - const cgm = this._getChunkGraphModule(module); - const runtimeRequirementsMap = cgm.runtimeRequirements; - if (runtimeRequirementsMap === undefined) { - const map = new RuntimeSpecMap(); - // TODO avoid cloning item and track ownership instead - map.set(runtime, transferOwnership ? items : new Set(items)); - cgm.runtimeRequirements = map; - return; + getLazySource(blocks, id, { chunkGraph, runtimeTemplate }) { + const moduleGraph = chunkGraph.moduleGraph; + const arrow = runtimeTemplate.supportsArrowFunction(); + let hasMultipleOrNoChunks = false; + let hasNoChunk = true; + const fakeMap = this.getFakeMap( + blocks.map(b => b.dependencies[0]), + chunkGraph + ); + const hasFakeMap = typeof fakeMap === "object"; + const items = blocks + .map(block => { + const dependency = block.dependencies[0]; + return { + dependency: dependency, + module: moduleGraph.getModule(dependency), + block: block, + userRequest: dependency.userRequest, + chunks: undefined + }; + }) + .filter(item => item.module); + for (const item of items) { + const chunkGroup = chunkGraph.getBlockChunkGroup(item.block); + const chunks = (chunkGroup && chunkGroup.chunks) || []; + item.chunks = chunks; + if (chunks.length > 0) { + hasNoChunk = false; + } + if (chunks.length !== 1) { + hasMultipleOrNoChunks = true; + } } - runtimeRequirementsMap.update(runtime, runtimeRequirements => { - if (runtimeRequirements === undefined) { - return transferOwnership ? items : new Set(items); - } else if (!transferOwnership || runtimeRequirements.size >= items.size) { - for (const item of items) runtimeRequirements.add(item); - return runtimeRequirements; + const shortMode = hasNoChunk && !hasFakeMap; + const sortedItems = items.sort((a, b) => { + if (a.userRequest === b.userRequest) return 0; + return a.userRequest < b.userRequest ? -1 : 1; + }); + const map = Object.create(null); + for (const item of sortedItems) { + const moduleId = chunkGraph.getModuleId(item.module); + if (shortMode) { + map[item.userRequest] = moduleId; } else { - for (const item of runtimeRequirements) items.add(item); - return items; + const arrayStart = [moduleId]; + if (hasFakeMap) { + arrayStart.push(fakeMap[moduleId]); + } + map[item.userRequest] = arrayStart.concat( + item.chunks.map(chunk => chunk.id) + ); } + } + + const chunksStartPosition = hasFakeMap ? 2 : 1; + const requestPrefix = hasNoChunk + ? "Promise.resolve()" + : hasMultipleOrNoChunks + ? `Promise.all(ids.slice(${chunksStartPosition}).map(${RuntimeGlobals.ensureChunk}))` + : `${RuntimeGlobals.ensureChunk}(ids[${chunksStartPosition}])`; + const returnModuleObject = this.getReturnModuleObjectSource( + fakeMap, + true, + shortMode ? "invalid" : "ids[1]" + ); + + const webpackAsyncContext = + requestPrefix === "Promise.resolve()" + ? ` +function webpackAsyncContext(req) { + return Promise.resolve().then(${arrow ? "() =>" : "function()"} { + if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + } + + ${shortMode ? "var id = map[req];" : "var ids = map[req], id = ids[0];"} + ${returnModuleObject} + }); +}` + : `function webpackAsyncContext(req) { + if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { + return Promise.resolve().then(${arrow ? "() =>" : "function()"} { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; }); } + var ids = map[req], id = ids[0]; + return ${requestPrefix}.then(${arrow ? "() =>" : "function()"} { + ${returnModuleObject} + }); +}`; + + return `var map = ${JSON.stringify(map, null, "\t")}; +${webpackAsyncContext} +webpackAsyncContext.keys = ${runtimeTemplate.returningFunction( + "Object.keys(map)" + )}; +webpackAsyncContext.id = ${JSON.stringify(id)}; +module.exports = webpackAsyncContext;`; + } + + getSourceForEmptyContext(id, runtimeTemplate) { + return `function webpackEmptyContext(req) { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; +} +webpackEmptyContext.keys = ${runtimeTemplate.returningFunction("[]")}; +webpackEmptyContext.resolve = webpackEmptyContext; +webpackEmptyContext.id = ${JSON.stringify(id)}; +module.exports = webpackEmptyContext;`; + } + + getSourceForEmptyAsyncContext(id, runtimeTemplate) { + const arrow = runtimeTemplate.supportsArrowFunction(); + return `function webpackEmptyAsyncContext(req) { + // Here Promise.resolve().then() is used instead of new Promise() to prevent + // uncaught exception popping up in devtools + return Promise.resolve().then(${arrow ? "() =>" : "function()"} { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + }); +} +webpackEmptyAsyncContext.keys = ${runtimeTemplate.returningFunction("[]")}; +webpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext; +webpackEmptyAsyncContext.id = ${JSON.stringify(id)}; +module.exports = webpackEmptyAsyncContext;`; + } + /** - * @param {Chunk} chunk the chunk - * @param {Set} items runtime requirements to be added (ownership of this Set is given to ChunkGraph) - * @returns {void} + * @param {string} asyncMode module mode + * @param {CodeGenerationContext} context context info + * @returns {string} the source code */ - addChunkRuntimeRequirements(chunk, items) { - const cgc = this._getChunkGraphChunk(chunk); - const runtimeRequirements = cgc.runtimeRequirements; - if (runtimeRequirements === undefined) { - cgc.runtimeRequirements = items; - } else if (runtimeRequirements.size >= items.size) { - for (const item of items) runtimeRequirements.add(item); - } else { - for (const item of runtimeRequirements) items.add(item); - cgc.runtimeRequirements = items; + getSourceString(asyncMode, { runtimeTemplate, chunkGraph }) { + const id = chunkGraph.getModuleId(this); + if (asyncMode === "lazy") { + if (this.blocks && this.blocks.length > 0) { + return this.getLazySource(this.blocks, id, { + runtimeTemplate, + chunkGraph + }); + } + return this.getSourceForEmptyAsyncContext(id, runtimeTemplate); + } + if (asyncMode === "eager") { + if (this.dependencies && this.dependencies.length > 0) { + return this.getEagerSource(this.dependencies, id, { + chunkGraph, + runtimeTemplate + }); + } + return this.getSourceForEmptyAsyncContext(id, runtimeTemplate); + } + if (asyncMode === "lazy-once") { + const block = this.blocks[0]; + if (block) { + return this.getLazyOnceSource(block, block.dependencies, id, { + runtimeTemplate, + chunkGraph + }); + } + return this.getSourceForEmptyAsyncContext(id, runtimeTemplate); + } + if (asyncMode === "async-weak") { + if (this.dependencies && this.dependencies.length > 0) { + return this.getAsyncWeakSource(this.dependencies, id, { + chunkGraph, + runtimeTemplate + }); + } + return this.getSourceForEmptyAsyncContext(id, runtimeTemplate); + } + if (asyncMode === "weak") { + if (this.dependencies && this.dependencies.length > 0) { + return this.getWeakSyncSource(this.dependencies, id, chunkGraph); + } + } + if (this.dependencies && this.dependencies.length > 0) { + return this.getSyncSource(this.dependencies, id, chunkGraph); } + return this.getSourceForEmptyContext(id, runtimeTemplate); } - /** - * @param {Chunk} chunk the chunk - * @param {Iterable} items runtime requirements to be added - * @returns {void} - */ - addTreeRuntimeRequirements(chunk, items) { - const cgc = this._getChunkGraphChunk(chunk); - const runtimeRequirements = cgc.runtimeRequirementsInTree; - for (const item of items) runtimeRequirements.add(item); + getSource(sourceString) { + if (this.useSourceMap || this.useSimpleSourceMap) { + return new OriginalSource(sourceString, this.identifier()); + } + return new RawSource(sourceString); } /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @returns {ReadonlySet} runtime requirements + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result */ - getModuleRuntimeRequirements(module, runtime) { - const cgm = this._getChunkGraphModule(module); - const runtimeRequirements = - cgm.runtimeRequirements && cgm.runtimeRequirements.get(runtime); - return runtimeRequirements === undefined ? EMPTY_SET : runtimeRequirements; + codeGeneration(context) { + const { chunkGraph } = context; + const sources = new Map(); + sources.set( + "javascript", + this.getSource(this.getSourceString(this.options.mode, context)) + ); + const set = new Set(); + const allDeps = /** @type {ContextElementDependency[]} */ ( + this.dependencies.concat(this.blocks.map(b => b.dependencies[0])) + ); + set.add(RuntimeGlobals.module); + set.add(RuntimeGlobals.hasOwnProperty); + if (allDeps.length > 0) { + const asyncMode = this.options.mode; + set.add(RuntimeGlobals.require); + if (asyncMode === "weak") { + set.add(RuntimeGlobals.moduleFactories); + } else if (asyncMode === "async-weak") { + set.add(RuntimeGlobals.moduleFactories); + set.add(RuntimeGlobals.ensureChunk); + } else if (asyncMode === "lazy" || asyncMode === "lazy-once") { + set.add(RuntimeGlobals.ensureChunk); + } + if (this.getFakeMap(allDeps, chunkGraph) !== 9) { + set.add(RuntimeGlobals.createFakeNamespaceObject); + } + } + return { + sources, + runtimeRequirements: set + }; } /** - * @param {Chunk} chunk the chunk - * @returns {ReadonlySet} runtime requirements + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) */ - getChunkRuntimeRequirements(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - const runtimeRequirements = cgc.runtimeRequirements; - return runtimeRequirements === undefined ? EMPTY_SET : runtimeRequirements; + size(type) { + // base penalty + let size = 160; + + // if we don't have dependencies we stop here. + for (const dependency of this.dependencies) { + const element = /** @type {ContextElementDependency} */ (dependency); + size += 5 + element.userRequest.length; + } + return size; } - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @param {boolean} withConnections include connections - * @returns {string} hash - */ - getModuleGraphHash(module, runtime, withConnections = true) { - const cgm = this._getChunkGraphModule(module); - return withConnections - ? this._getModuleGraphHashWithConnections(cgm, module, runtime) - : this._getModuleGraphHashBigInt(cgm, module, runtime).toString(16); + serialize(context) { + const { write } = context; + write(this._identifier); + write(this._forceBuild); + super.serialize(context); } - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @param {boolean} withConnections include connections - * @returns {bigint} hash - */ - getModuleGraphHashBigInt(module, runtime, withConnections = true) { - const cgm = this._getChunkGraphModule(module); - return withConnections - ? BigInt( - `0x${this._getModuleGraphHashWithConnections(cgm, module, runtime)}` - ) - : this._getModuleGraphHashBigInt(cgm, module, runtime); + deserialize(context) { + const { read } = context; + this._identifier = read(); + this._forceBuild = read(); + super.deserialize(context); } +} + +makeSerializable(ContextModule, "webpack/lib/ContextModule"); +module.exports = ContextModule; + + +/***/ }), + +/***/ 62471: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const asyncLib = __webpack_require__(78175); +const { AsyncSeriesWaterfallHook, SyncWaterfallHook } = __webpack_require__(6967); +const ContextModule = __webpack_require__(76729); +const ModuleFactory = __webpack_require__(51010); +const ContextElementDependency = __webpack_require__(58477); +const LazySet = __webpack_require__(38938); +const { cachedSetProperty } = __webpack_require__(60839); +const { createFakeHook } = __webpack_require__(64518); +const { join } = __webpack_require__(17139); + +/** @typedef {import("./ContextModule").ContextModuleOptions} ContextModuleOptions */ +/** @typedef {import("./ContextModule").ResolveDependenciesCallback} ResolveDependenciesCallback */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ +/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ +/** @typedef {import("./ResolverFactory")} ResolverFactory */ +/** @typedef {import("./dependencies/ContextDependency")} ContextDependency */ +/** @template T @typedef {import("./util/deprecation").FakeHook} FakeHook */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ + +const EMPTY_RESOLVE_OPTIONS = {}; + +module.exports = class ContextModuleFactory extends ModuleFactory { /** - * @param {ChunkGraphModule} cgm the ChunkGraphModule - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @returns {bigint} hash as big int + * @param {ResolverFactory} resolverFactory resolverFactory */ - _getModuleGraphHashBigInt(cgm, module, runtime) { - if (cgm.graphHashes === undefined) { - cgm.graphHashes = new RuntimeSpecMap(); - } - const graphHash = cgm.graphHashes.provide(runtime, () => { - const hash = createHash(this._hashFunction); - hash.update(`${cgm.id}${this.moduleGraph.isAsync(module)}`); - this.moduleGraph.getExportsInfo(module).updateHash(hash, runtime); - return BigInt(`0x${/** @type {string} */ (hash.digest("hex"))}`); + constructor(resolverFactory) { + super(); + /** @type {AsyncSeriesWaterfallHook<[TODO[], ContextModuleOptions]>} */ + const alternativeRequests = new AsyncSeriesWaterfallHook([ + "modules", + "options" + ]); + this.hooks = Object.freeze({ + /** @type {AsyncSeriesWaterfallHook<[TODO]>} */ + beforeResolve: new AsyncSeriesWaterfallHook(["data"]), + /** @type {AsyncSeriesWaterfallHook<[TODO]>} */ + afterResolve: new AsyncSeriesWaterfallHook(["data"]), + /** @type {SyncWaterfallHook<[string[]]>} */ + contextModuleFiles: new SyncWaterfallHook(["files"]), + /** @type {FakeHook, "tap" | "tapAsync" | "tapPromise" | "name">>} */ + alternatives: createFakeHook( + { + name: "alternatives", + /** @type {AsyncSeriesWaterfallHook<[TODO[]]>["intercept"]} */ + intercept: interceptor => { + throw new Error( + "Intercepting fake hook ContextModuleFactory.hooks.alternatives is not possible, use ContextModuleFactory.hooks.alternativeRequests instead" + ); + }, + /** @type {AsyncSeriesWaterfallHook<[TODO[]]>["tap"]} */ + tap: (options, fn) => { + alternativeRequests.tap(options, fn); + }, + /** @type {AsyncSeriesWaterfallHook<[TODO[]]>["tapAsync"]} */ + tapAsync: (options, fn) => { + alternativeRequests.tapAsync(options, (items, _options, callback) => + fn(items, callback) + ); + }, + /** @type {AsyncSeriesWaterfallHook<[TODO[]]>["tapPromise"]} */ + tapPromise: (options, fn) => { + alternativeRequests.tapPromise(options, fn); + } + }, + "ContextModuleFactory.hooks.alternatives has deprecated in favor of ContextModuleFactory.hooks.alternativeRequests with an additional options argument.", + "DEP_WEBPACK_CONTEXT_MODULE_FACTORY_ALTERNATIVES" + ), + alternativeRequests }); - return graphHash; + this.resolverFactory = resolverFactory; } /** - * @param {ChunkGraphModule} cgm the ChunkGraphModule - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @returns {string} hash + * @param {ModuleFactoryCreateData} data data object + * @param {function(Error=, ModuleFactoryResult=): void} callback callback + * @returns {void} */ - _getModuleGraphHashWithConnections(cgm, module, runtime) { - if (cgm.graphHashesWithConnections === undefined) { - cgm.graphHashesWithConnections = new RuntimeSpecMap(); - } - const activeStateToString = state => { - if (state === false) return "F"; - if (state === true) return "T"; - if (state === ModuleGraphConnection.TRANSITIVE_ONLY) return "O"; - throw new Error("Not implemented active state"); - }; - const strict = module.buildMeta && module.buildMeta.strictHarmonyModule; - return cgm.graphHashesWithConnections.provide(runtime, () => { - const graphHash = this._getModuleGraphHashBigInt( - cgm, - module, - runtime - ).toString(16); - const connections = this.moduleGraph.getOutgoingConnections(module); - /** @type {Set} */ - const activeNamespaceModules = new Set(); - /** @type {Map>} */ - const connectedModules = new Map(); - const processConnection = (connection, stateInfo) => { - const module = connection.module; - stateInfo += module.getExportsType(this.moduleGraph, strict); - // cspell:word Tnamespace - if (stateInfo === "Tnamespace") activeNamespaceModules.add(module); - else { - const oldModule = connectedModules.get(stateInfo); - if (oldModule === undefined) { - connectedModules.set(stateInfo, module); - } else if (oldModule instanceof Set) { - oldModule.add(module); - } else if (oldModule !== module) { - connectedModules.set(stateInfo, new Set([oldModule, module])); - } + create(data, callback) { + const context = data.context; + const dependencies = data.dependencies; + const resolveOptions = data.resolveOptions; + const dependency = /** @type {ContextDependency} */ (dependencies[0]); + const fileDependencies = new LazySet(); + const missingDependencies = new LazySet(); + const contextDependencies = new LazySet(); + this.hooks.beforeResolve.callAsync( + { + context: context, + dependencies: dependencies, + resolveOptions, + fileDependencies, + missingDependencies, + contextDependencies, + ...dependency.options + }, + (err, beforeResolveResult) => { + if (err) { + return callback(err, { + fileDependencies, + missingDependencies, + contextDependencies + }); } - }; - if (runtime === undefined || typeof runtime === "string") { - for (const connection of connections) { - const state = connection.getActiveState(runtime); - if (state === false) continue; - processConnection(connection, state === true ? "T" : "O"); + + // Ignored + if (!beforeResolveResult) { + return callback(null, { + fileDependencies, + missingDependencies, + contextDependencies + }); } - } else { - // cspell:word Tnamespace - for (const connection of connections) { - const states = new Set(); - let stateInfo = ""; - forEachRuntime( - runtime, - runtime => { - const state = connection.getActiveState(runtime); - states.add(state); - stateInfo += activeStateToString(state) + runtime; - }, - true - ); - if (states.size === 1) { - const state = first(states); - if (state === false) continue; - stateInfo = activeStateToString(state); + + const context = beforeResolveResult.context; + const request = beforeResolveResult.request; + const resolveOptions = beforeResolveResult.resolveOptions; + + let loaders, + resource, + loadersPrefix = ""; + const idx = request.lastIndexOf("!"); + if (idx >= 0) { + let loadersRequest = request.substr(0, idx + 1); + let i; + for ( + i = 0; + i < loadersRequest.length && loadersRequest[i] === "!"; + i++ + ) { + loadersPrefix += "!"; } - processConnection(connection, stateInfo); - } - } - // cspell:word Tnamespace - if (activeNamespaceModules.size === 0 && connectedModules.size === 0) - return graphHash; - const connectedModulesInOrder = - connectedModules.size > 1 - ? Array.from(connectedModules).sort(([a], [b]) => (a < b ? -1 : 1)) - : connectedModules; - const hash = createHash(this._hashFunction); - const addModuleToHash = module => { - hash.update( - this._getModuleGraphHashBigInt( - this._getChunkGraphModule(module), - module, - runtime - ).toString(16) - ); - }; - const addModulesToHash = modules => { - let xor = ZERO_BIG_INT; - for (const m of modules) { - xor = - xor ^ - this._getModuleGraphHashBigInt( - this._getChunkGraphModule(m), - m, - runtime - ); - } - hash.update(xor.toString(16)); - }; - if (activeNamespaceModules.size === 1) - addModuleToHash(activeNamespaceModules.values().next().value); - else if (activeNamespaceModules.size > 1) - addModulesToHash(activeNamespaceModules); - for (const [stateInfo, modules] of connectedModulesInOrder) { - hash.update(stateInfo); - if (modules instanceof Set) { - addModulesToHash(modules); + loadersRequest = loadersRequest + .substr(i) + .replace(/!+$/, "") + .replace(/!!+/g, "!"); + if (loadersRequest === "") { + loaders = []; + } else { + loaders = loadersRequest.split("!"); + } + resource = request.substr(idx + 1); } else { - addModuleToHash(modules); + loaders = []; + resource = request; } - } - hash.update(graphHash); - return /** @type {string} */ (hash.digest("hex")); - }); - } - /** - * @param {Chunk} chunk the chunk - * @returns {ReadonlySet} runtime requirements - */ - getTreeRuntimeRequirements(chunk) { - const cgc = this._getChunkGraphChunk(chunk); - return cgc.runtimeRequirementsInTree; - } + const contextResolver = this.resolverFactory.get( + "context", + dependencies.length > 0 + ? cachedSetProperty( + resolveOptions || EMPTY_RESOLVE_OPTIONS, + "dependencyType", + dependencies[0].category + ) + : resolveOptions + ); + const loaderResolver = this.resolverFactory.get("loader"); - // TODO remove in webpack 6 - /** - * @param {Module} module the module - * @param {string} deprecateMessage message for the deprecation message - * @param {string} deprecationCode code for the deprecation - * @returns {ChunkGraph} the chunk graph - */ - static getChunkGraphForModule(module, deprecateMessage, deprecationCode) { - const fn = deprecateGetChunkGraphForModuleMap.get(deprecateMessage); - if (fn) return fn(module); - const newFn = util.deprecate( - /** - * @param {Module} module the module - * @returns {ChunkGraph} the chunk graph - */ - module => { - const chunkGraph = chunkGraphForModuleMap.get(module); - if (!chunkGraph) - throw new Error( - deprecateMessage + - ": There was no ChunkGraph assigned to the Module for backward-compat (Use the new API)" - ); - return chunkGraph; - }, - deprecateMessage + ": Use new ChunkGraph API", - deprecationCode - ); - deprecateGetChunkGraphForModuleMap.set(deprecateMessage, newFn); - return newFn(module); - } + asyncLib.parallel( + [ + callback => { + contextResolver.resolve( + {}, + context, + resource, + { + fileDependencies, + missingDependencies, + contextDependencies + }, + (err, result) => { + if (err) return callback(err); + callback(null, result); + } + ); + }, + callback => { + asyncLib.map( + loaders, + (loader, callback) => { + loaderResolver.resolve( + {}, + context, + loader, + { + fileDependencies, + missingDependencies, + contextDependencies + }, + (err, result) => { + if (err) return callback(err); + callback(null, result); + } + ); + }, + callback + ); + } + ], + (err, result) => { + if (err) { + return callback(err, { + fileDependencies, + missingDependencies, + contextDependencies + }); + } - // TODO remove in webpack 6 - /** - * @param {Module} module the module - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {void} - */ - static setChunkGraphForModule(module, chunkGraph) { - chunkGraphForModuleMap.set(module, chunkGraph); - } + this.hooks.afterResolve.callAsync( + { + addon: + loadersPrefix + + result[1].join("!") + + (result[1].length > 0 ? "!" : ""), + resource: result[0], + resolveDependencies: this.resolveDependencies.bind(this), + ...beforeResolveResult + }, + (err, result) => { + if (err) { + return callback(err, { + fileDependencies, + missingDependencies, + contextDependencies + }); + } - // TODO remove in webpack 6 - /** - * @param {Module} module the module - * @returns {void} - */ - static clearChunkGraphForModule(module) { - chunkGraphForModuleMap.delete(module); - } + // Ignored + if (!result) { + return callback(null, { + fileDependencies, + missingDependencies, + contextDependencies + }); + } - // TODO remove in webpack 6 - /** - * @param {Chunk} chunk the chunk - * @param {string} deprecateMessage message for the deprecation message - * @param {string} deprecationCode code for the deprecation - * @returns {ChunkGraph} the chunk graph - */ - static getChunkGraphForChunk(chunk, deprecateMessage, deprecationCode) { - const fn = deprecateGetChunkGraphForChunkMap.get(deprecateMessage); - if (fn) return fn(chunk); - const newFn = util.deprecate( - /** - * @param {Chunk} chunk the chunk - * @returns {ChunkGraph} the chunk graph - */ - chunk => { - const chunkGraph = chunkGraphForChunkMap.get(chunk); - if (!chunkGraph) - throw new Error( - deprecateMessage + - "There was no ChunkGraph assigned to the Chunk for backward-compat (Use the new API)" - ); - return chunkGraph; - }, - deprecateMessage + ": Use new ChunkGraph API", - deprecationCode + return callback(null, { + module: new ContextModule(result.resolveDependencies, result), + fileDependencies, + missingDependencies, + contextDependencies + }); + } + ); + } + ); + } ); - deprecateGetChunkGraphForChunkMap.set(deprecateMessage, newFn); - return newFn(chunk); } - // TODO remove in webpack 6 /** - * @param {Chunk} chunk the chunk - * @param {ChunkGraph} chunkGraph the chunk graph + * @param {InputFileSystem} fs file system + * @param {ContextModuleOptions} options options + * @param {ResolveDependenciesCallback} callback callback function * @returns {void} */ - static setChunkGraphForChunk(chunk, chunkGraph) { - chunkGraphForChunkMap.set(chunk, chunkGraph); - } + resolveDependencies(fs, options, callback) { + const cmf = this; + const { + resource, + resourceQuery, + resourceFragment, + recursive, + regExp, + include, + exclude, + referencedExports, + category, + typePrefix + } = options; + if (!regExp || !resource) return callback(null, []); - // TODO remove in webpack 6 - /** - * @param {Chunk} chunk the chunk - * @returns {void} - */ - static clearChunkGraphForChunk(chunk) { - chunkGraphForChunkMap.delete(chunk); - } -} + const addDirectoryChecked = (directory, visited, callback) => { + fs.realpath(directory, (err, realPath) => { + if (err) return callback(err); + if (visited.has(realPath)) return callback(null, []); + let recursionStack; + addDirectory( + directory, + (dir, callback) => { + if (recursionStack === undefined) { + recursionStack = new Set(visited); + recursionStack.add(realPath); + } + addDirectoryChecked(dir, recursionStack, callback); + }, + callback + ); + }); + }; -// TODO remove in webpack 6 -/** @type {WeakMap} */ -const chunkGraphForModuleMap = new WeakMap(); + const addDirectory = (directory, addSubDirectory, callback) => { + fs.readdir(directory, (err, files) => { + if (err) return callback(err); + const processedFiles = cmf.hooks.contextModuleFiles.call( + /** @type {string[]} */ (files).map(file => file.normalize("NFC")) + ); + if (!processedFiles || processedFiles.length === 0) + return callback(null, []); + asyncLib.map( + processedFiles.filter(p => p.indexOf(".") !== 0), + (segment, callback) => { + const subResource = join(fs, directory, segment); -// TODO remove in webpack 6 -/** @type {WeakMap} */ -const chunkGraphForChunkMap = new WeakMap(); + if (!exclude || !subResource.match(exclude)) { + fs.stat(subResource, (err, stat) => { + if (err) { + if (err.code === "ENOENT") { + // ENOENT is ok here because the file may have been deleted between + // the readdir and stat calls. + return callback(); + } else { + return callback(err); + } + } -// TODO remove in webpack 6 -/** @type {Map ChunkGraph>} */ -const deprecateGetChunkGraphForModuleMap = new Map(); + if (stat.isDirectory()) { + if (!recursive) return callback(); + addSubDirectory(subResource, callback); + } else if ( + stat.isFile() && + (!include || subResource.match(include)) + ) { + const obj = { + context: resource, + request: + "." + + subResource.substr(resource.length).replace(/\\/g, "/") + }; -// TODO remove in webpack 6 -/** @type {Map ChunkGraph>} */ -const deprecateGetChunkGraphForChunkMap = new Map(); + this.hooks.alternativeRequests.callAsync( + [obj], + options, + (err, alternatives) => { + if (err) return callback(err); + alternatives = alternatives + .filter(obj => regExp.test(obj.request)) + .map(obj => { + const dep = new ContextElementDependency( + obj.request + resourceQuery + resourceFragment, + obj.request, + typePrefix, + category, + referencedExports + ); + dep.optional = true; + return dep; + }); + callback(null, alternatives); + } + ); + } else { + callback(); + } + }); + } else { + callback(); + } + }, + (err, result) => { + if (err) return callback(err); -module.exports = ChunkGraph; + if (!result) return callback(null, []); + + const flattenedResult = []; + + for (const item of result) { + if (item) flattenedResult.push(...item); + } + + callback(null, flattenedResult); + } + ); + }); + }; + + if (typeof fs.realpath === "function") { + addDirectoryChecked(resource, new Set(), callback); + } else { + const addSubDirectory = (dir, callback) => + addDirectory(dir, addSubDirectory, callback); + addDirectory(resource, addSubDirectory, callback); + } + } +}; /***/ }), -/***/ 15626: +/***/ 12206: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -27970,588 +31152,1116 @@ module.exports = ChunkGraph; -const util = __webpack_require__(73837); -const SortableSet = __webpack_require__(13098); -const { - compareLocations, - compareChunks, - compareIterables -} = __webpack_require__(29579); - -/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("./Entrypoint")} Entrypoint */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ +const ContextElementDependency = __webpack_require__(58477); +const { join } = __webpack_require__(17139); -/** @typedef {{id: number}} HasId */ -/** @typedef {{module: Module, loc: DependencyLocation, request: string}} OriginRecord */ +class ContextReplacementPlugin { + constructor( + resourceRegExp, + newContentResource, + newContentRecursive, + newContentRegExp + ) { + this.resourceRegExp = resourceRegExp; -/** - * @typedef {Object} RawChunkGroupOptions - * @property {number=} preloadOrder - * @property {number=} prefetchOrder - */ - -/** @typedef {RawChunkGroupOptions & { name?: string }} ChunkGroupOptions */ + if (typeof newContentResource === "function") { + this.newContentCallback = newContentResource; + } else if ( + typeof newContentResource === "string" && + typeof newContentRecursive === "object" + ) { + this.newContentResource = newContentResource; + this.newContentCreateContextMap = (fs, callback) => { + callback(null, newContentRecursive); + }; + } else if ( + typeof newContentResource === "string" && + typeof newContentRecursive === "function" + ) { + this.newContentResource = newContentResource; + this.newContentCreateContextMap = newContentRecursive; + } else { + if (typeof newContentResource !== "string") { + newContentRegExp = newContentRecursive; + newContentRecursive = newContentResource; + newContentResource = undefined; + } + if (typeof newContentRecursive !== "boolean") { + newContentRegExp = newContentRecursive; + newContentRecursive = undefined; + } + this.newContentResource = newContentResource; + this.newContentRecursive = newContentRecursive; + this.newContentRegExp = newContentRegExp; + } + } -let debugId = 5000; + apply(compiler) { + const resourceRegExp = this.resourceRegExp; + const newContentCallback = this.newContentCallback; + const newContentResource = this.newContentResource; + const newContentRecursive = this.newContentRecursive; + const newContentRegExp = this.newContentRegExp; + const newContentCreateContextMap = this.newContentCreateContextMap; -/** - * @template T - * @param {SortableSet} set set to convert to array. - * @returns {T[]} the array format of existing set - */ -const getArray = set => Array.from(set); + compiler.hooks.contextModuleFactory.tap("ContextReplacementPlugin", cmf => { + cmf.hooks.beforeResolve.tap("ContextReplacementPlugin", result => { + if (!result) return; + if (resourceRegExp.test(result.request)) { + if (newContentResource !== undefined) { + result.request = newContentResource; + } + if (newContentRecursive !== undefined) { + result.recursive = newContentRecursive; + } + if (newContentRegExp !== undefined) { + result.regExp = newContentRegExp; + } + if (typeof newContentCallback === "function") { + newContentCallback(result); + } else { + for (const d of result.dependencies) { + if (d.critical) d.critical = false; + } + } + } + return result; + }); + cmf.hooks.afterResolve.tap("ContextReplacementPlugin", result => { + if (!result) return; + if (resourceRegExp.test(result.resource)) { + if (newContentResource !== undefined) { + if ( + newContentResource.startsWith("/") || + (newContentResource.length > 1 && newContentResource[1] === ":") + ) { + result.resource = newContentResource; + } else { + result.resource = join( + compiler.inputFileSystem, + result.resource, + newContentResource + ); + } + } + if (newContentRecursive !== undefined) { + result.recursive = newContentRecursive; + } + if (newContentRegExp !== undefined) { + result.regExp = newContentRegExp; + } + if (typeof newContentCreateContextMap === "function") { + result.resolveDependencies = + createResolveDependenciesFromContextMap( + newContentCreateContextMap + ); + } + if (typeof newContentCallback === "function") { + const origResource = result.resource; + newContentCallback(result); + if ( + result.resource !== origResource && + !result.resource.startsWith("/") && + (result.resource.length <= 1 || result.resource[1] !== ":") + ) { + // When the function changed it to an relative path + result.resource = join( + compiler.inputFileSystem, + origResource, + result.resource + ); + } + } else { + for (const d of result.dependencies) { + if (d.critical) d.critical = false; + } + } + } + return result; + }); + }); + } +} -/** - * A convenience method used to sort chunks based on their id's - * @param {ChunkGroup} a first sorting comparator - * @param {ChunkGroup} b second sorting comparator - * @returns {1|0|-1} a sorting index to determine order - */ -const sortById = (a, b) => { - if (a.id < b.id) return -1; - if (b.id < a.id) return 1; - return 0; +const createResolveDependenciesFromContextMap = createContextMap => { + const resolveDependenciesFromContextMap = (fs, options, callback) => { + createContextMap(fs, (err, map) => { + if (err) return callback(err); + const dependencies = Object.keys(map).map(key => { + return new ContextElementDependency( + map[key] + options.resourceQuery + options.resourceFragment, + key, + options.category, + options.referencedExports + ); + }); + callback(null, dependencies); + }); + }; + return resolveDependenciesFromContextMap; }; +module.exports = ContextReplacementPlugin; + + +/***/ }), + +/***/ 79065: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const WebpackError = __webpack_require__(53799); +const ConstDependency = __webpack_require__(76911); +const BasicEvaluatedExpression = __webpack_require__(950); +const { + evaluateToString, + toConstantDependency +} = __webpack_require__(93998); +const createHash = __webpack_require__(49835); + +/** @typedef {import("estree").Expression} Expression */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./NormalModule")} NormalModule */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ + +/** @typedef {null|undefined|RegExp|Function|string|number|boolean|bigint|undefined} CodeValuePrimitive */ +/** @typedef {RecursiveArrayOrRecord} CodeValue */ + /** - * @param {OriginRecord} a the first comparator in sort - * @param {OriginRecord} b the second comparator in sort - * @returns {1|-1|0} returns sorting order as index + * @typedef {Object} RuntimeValueOptions + * @property {string[]=} fileDependencies + * @property {string[]=} contextDependencies + * @property {string[]=} missingDependencies + * @property {string[]=} buildDependencies + * @property {string|function(): string=} version */ -const sortOrigin = (a, b) => { - const aIdent = a.module ? a.module.identifier() : ""; - const bIdent = b.module ? b.module.identifier() : ""; - if (aIdent < bIdent) return -1; - if (aIdent > bIdent) return 1; - return compareLocations(a.loc, b.loc); -}; -class ChunkGroup { +class RuntimeValue { /** - * Creates an instance of ChunkGroup. - * @param {string|ChunkGroupOptions=} options chunk group options passed to chunkGroup + * @param {function({ module: NormalModule, key: string, readonly version: string | undefined }): CodeValuePrimitive} fn generator function + * @param {true | string[] | RuntimeValueOptions=} options options */ - constructor(options) { - if (typeof options === "string") { - options = { name: options }; - } else if (!options) { - options = { name: undefined }; + constructor(fn, options) { + this.fn = fn; + if (Array.isArray(options)) { + options = { + fileDependencies: options + }; } - /** @type {number} */ - this.groupDebugId = debugId++; - this.options = options; - /** @type {SortableSet} */ - this._children = new SortableSet(undefined, sortById); - /** @type {SortableSet} */ - this._parents = new SortableSet(undefined, sortById); - /** @type {SortableSet} */ - this._asyncEntrypoints = new SortableSet(undefined, sortById); - this._blocks = new SortableSet(); - /** @type {Chunk[]} */ - this.chunks = []; - /** @type {OriginRecord[]} */ - this.origins = []; - /** Indices in top-down order */ - /** @private @type {Map} */ - this._modulePreOrderIndices = new Map(); - /** Indices in bottom-up order */ - /** @private @type {Map} */ - this._modulePostOrderIndices = new Map(); - /** @type {number} */ - this.index = undefined; + this.options = options || {}; + } + + get fileDependencies() { + return this.options === true ? true : this.options.fileDependencies; } /** - * when a new chunk is added to a chunkGroup, addingOptions will occur. - * @param {ChunkGroupOptions} options the chunkGroup options passed to addOptions - * @returns {void} + * @param {JavascriptParser} parser the parser + * @param {Map>} valueCacheVersions valueCacheVersions + * @param {string} key the defined key + * @returns {CodeValuePrimitive} code */ - addOptions(options) { - for (const key of Object.keys(options)) { - if (this.options[key] === undefined) { - this.options[key] = options[key]; - } else if (this.options[key] !== options[key]) { - if (key.endsWith("Order")) { - this.options[key] = Math.max(this.options[key], options[key]); - } else { - throw new Error( - `ChunkGroup.addOptions: No option merge strategy for ${key}` - ); + exec(parser, valueCacheVersions, key) { + const buildInfo = parser.state.module.buildInfo; + if (this.options === true) { + buildInfo.cacheable = false; + } else { + if (this.options.fileDependencies) { + for (const dep of this.options.fileDependencies) { + buildInfo.fileDependencies.add(dep); + } + } + if (this.options.contextDependencies) { + for (const dep of this.options.contextDependencies) { + buildInfo.contextDependencies.add(dep); + } + } + if (this.options.missingDependencies) { + for (const dep of this.options.missingDependencies) { + buildInfo.missingDependencies.add(dep); + } + } + if (this.options.buildDependencies) { + for (const dep of this.options.buildDependencies) { + buildInfo.buildDependencies.add(dep); } } } + + return this.fn({ + module: parser.state.module, + key, + get version() { + return /** @type {string} */ ( + valueCacheVersions.get(VALUE_DEP_PREFIX + key) + ); + } + }); } - /** - * returns the name of current ChunkGroup - * @returns {string|undefined} returns the ChunkGroup name - */ - get name() { - return this.options.name; + getCacheVersion() { + return this.options === true + ? undefined + : (typeof this.options.version === "function" + ? this.options.version() + : this.options.version) || "unset"; } +} - /** - * sets a new name for current ChunkGroup - * @param {string} value the new name for ChunkGroup - * @returns {void} - */ - set name(value) { - this.options.name = value; +/** + * @param {any[]|{[k: string]: any}} obj obj + * @param {JavascriptParser} parser Parser + * @param {Map>} valueCacheVersions valueCacheVersions + * @param {string} key the defined key + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @param {boolean|undefined|null=} asiSafe asi safe (undefined: unknown, null: unneeded) + * @returns {string} code converted to string that evaluates + */ +const stringifyObj = ( + obj, + parser, + valueCacheVersions, + key, + runtimeTemplate, + asiSafe +) => { + let code; + let arr = Array.isArray(obj); + if (arr) { + code = `[${obj + .map(code => + toCode(code, parser, valueCacheVersions, key, runtimeTemplate, null) + ) + .join(",")}]`; + } else { + code = `{${Object.keys(obj) + .map(key => { + const code = obj[key]; + return ( + JSON.stringify(key) + + ":" + + toCode(code, parser, valueCacheVersions, key, runtimeTemplate, null) + ); + }) + .join(",")}}`; } - /* istanbul ignore next */ - /** - * get a uniqueId for ChunkGroup, made up of its member Chunk debugId's - * @returns {string} a unique concatenation of chunk debugId's - */ - get debugId() { - return Array.from(this.chunks, x => x.debugId).join("+"); + switch (asiSafe) { + case null: + return code; + case true: + return arr ? code : `(${code})`; + case false: + return arr ? `;${code}` : `;(${code})`; + default: + return `/*#__PURE__*/Object(${code})`; + } +}; + +/** + * Convert code to a string that evaluates + * @param {CodeValue} code Code to evaluate + * @param {JavascriptParser} parser Parser + * @param {Map>} valueCacheVersions valueCacheVersions + * @param {string} key the defined key + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @param {boolean|undefined|null=} asiSafe asi safe (undefined: unknown, null: unneeded) + * @returns {string} code converted to string that evaluates + */ +const toCode = ( + code, + parser, + valueCacheVersions, + key, + runtimeTemplate, + asiSafe +) => { + if (code === null) { + return "null"; + } + if (code === undefined) { + return "undefined"; + } + if (Object.is(code, -0)) { + return "-0"; + } + if (code instanceof RuntimeValue) { + return toCode( + code.exec(parser, valueCacheVersions, key), + parser, + valueCacheVersions, + key, + runtimeTemplate, + asiSafe + ); + } + if (code instanceof RegExp && code.toString) { + return code.toString(); + } + if (typeof code === "function" && code.toString) { + return "(" + code.toString() + ")"; + } + if (typeof code === "object") { + return stringifyObj( + code, + parser, + valueCacheVersions, + key, + runtimeTemplate, + asiSafe + ); + } + if (typeof code === "bigint") { + return runtimeTemplate.supportsBigIntLiteral() + ? `${code}n` + : `BigInt("${code}")`; + } + return code + ""; +}; + +const toCacheVersion = code => { + if (code === null) { + return "null"; + } + if (code === undefined) { + return "undefined"; + } + if (Object.is(code, -0)) { + return "-0"; + } + if (code instanceof RuntimeValue) { + return code.getCacheVersion(); + } + if (code instanceof RegExp && code.toString) { + return code.toString(); + } + if (typeof code === "function" && code.toString) { + return "(" + code.toString() + ")"; + } + if (typeof code === "object") { + const items = Object.keys(code).map(key => ({ + key, + value: toCacheVersion(code[key]) + })); + if (items.some(({ value }) => value === undefined)) return undefined; + return `{${items.map(({ key, value }) => `${key}: ${value}`).join(", ")}}`; + } + if (typeof code === "bigint") { + return `${code}n`; } + return code + ""; +}; + +const VALUE_DEP_PREFIX = "webpack/DefinePlugin "; +const VALUE_DEP_MAIN = "webpack/DefinePlugin_hash"; +class DefinePlugin { /** - * get a unique id for ChunkGroup, made up of its member Chunk id's - * @returns {string} a unique concatenation of chunk ids + * Create a new define plugin + * @param {Record} definitions A map of global object definitions */ - get id() { - return Array.from(this.chunks, x => x.id).join("+"); + constructor(definitions) { + this.definitions = definitions; } /** - * Performs an unshift of a specific chunk - * @param {Chunk} chunk chunk being unshifted - * @returns {boolean} returns true if attempted chunk shift is accepted + * @param {function({ module: NormalModule, key: string, readonly version: string | undefined }): CodeValuePrimitive} fn generator function + * @param {true | string[] | RuntimeValueOptions=} options options + * @returns {RuntimeValue} runtime value */ - unshiftChunk(chunk) { - const oldIdx = this.chunks.indexOf(chunk); - if (oldIdx > 0) { - this.chunks.splice(oldIdx, 1); - this.chunks.unshift(chunk); - } else if (oldIdx < 0) { - this.chunks.unshift(chunk); - return true; - } - return false; + static runtimeValue(fn, options) { + return new RuntimeValue(fn, options); } /** - * inserts a chunk before another existing chunk in group - * @param {Chunk} chunk Chunk being inserted - * @param {Chunk} before Placeholder/target chunk marking new chunk insertion point - * @returns {boolean} return true if insertion was successful + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - insertChunk(chunk, before) { - const oldIdx = this.chunks.indexOf(chunk); - const idx = this.chunks.indexOf(before); - if (idx < 0) { - throw new Error("before chunk not found"); - } - if (oldIdx >= 0 && oldIdx > idx) { - this.chunks.splice(oldIdx, 1); - this.chunks.splice(idx, 0, chunk); - } else if (oldIdx < 0) { - this.chunks.splice(idx, 0, chunk); - return true; - } - return false; - } + apply(compiler) { + const definitions = this.definitions; + compiler.hooks.compilation.tap( + "DefinePlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyTemplates.set( + ConstDependency, + new ConstDependency.Template() + ); + const { runtimeTemplate } = compilation; - /** - * add a chunk into ChunkGroup. Is pushed on or prepended - * @param {Chunk} chunk chunk being pushed into ChunkGroupS - * @returns {boolean} returns true if chunk addition was successful. - */ - pushChunk(chunk) { - const oldIdx = this.chunks.indexOf(chunk); - if (oldIdx >= 0) { - return false; - } - this.chunks.push(chunk); - return true; - } + const mainHash = createHash(compilation.outputOptions.hashFunction); + mainHash.update( + /** @type {string} */ ( + compilation.valueCacheVersions.get(VALUE_DEP_MAIN) + ) || "" + ); - /** - * @param {Chunk} oldChunk chunk to be replaced - * @param {Chunk} newChunk New chunk that will be replaced with - * @returns {boolean} returns true if the replacement was successful - */ - replaceChunk(oldChunk, newChunk) { - const oldIdx = this.chunks.indexOf(oldChunk); - if (oldIdx < 0) return false; - const newIdx = this.chunks.indexOf(newChunk); - if (newIdx < 0) { - this.chunks[oldIdx] = newChunk; - return true; - } - if (newIdx < oldIdx) { - this.chunks.splice(oldIdx, 1); - return true; - } else if (newIdx !== oldIdx) { - this.chunks[oldIdx] = newChunk; - this.chunks.splice(newIdx, 1); - return true; - } - } + /** + * Handler + * @param {JavascriptParser} parser Parser + * @returns {void} + */ + const handler = parser => { + const mainValue = compilation.valueCacheVersions.get(VALUE_DEP_MAIN); + parser.hooks.program.tap("DefinePlugin", () => { + const { buildInfo } = parser.state.module; + if (!buildInfo.valueDependencies) + buildInfo.valueDependencies = new Map(); + buildInfo.valueDependencies.set(VALUE_DEP_MAIN, mainValue); + }); - /** - * @param {Chunk} chunk chunk to remove - * @returns {boolean} returns true if chunk was removed - */ - removeChunk(chunk) { - const idx = this.chunks.indexOf(chunk); - if (idx >= 0) { - this.chunks.splice(idx, 1); - return true; - } - return false; - } + const addValueDependency = key => { + const { buildInfo } = parser.state.module; + buildInfo.valueDependencies.set( + VALUE_DEP_PREFIX + key, + compilation.valueCacheVersions.get(VALUE_DEP_PREFIX + key) + ); + }; - /** - * @returns {boolean} true, when this chunk group will be loaded on initial page load - */ - isInitial() { - return false; - } + const withValueDependency = + (key, fn) => + (...args) => { + addValueDependency(key); + return fn(...args); + }; - /** - * @param {ChunkGroup} group chunk group to add - * @returns {boolean} returns true if chunk group was added - */ - addChild(group) { - const size = this._children.size; - this._children.add(group); - return size !== this._children.size; - } + /** + * Walk definitions + * @param {Object} definitions Definitions map + * @param {string} prefix Prefix string + * @returns {void} + */ + const walkDefinitions = (definitions, prefix) => { + Object.keys(definitions).forEach(key => { + const code = definitions[key]; + if ( + code && + typeof code === "object" && + !(code instanceof RuntimeValue) && + !(code instanceof RegExp) + ) { + walkDefinitions(code, prefix + key + "."); + applyObjectDefine(prefix + key, code); + return; + } + applyDefineKey(prefix, key); + applyDefine(prefix + key, code); + }); + }; - /** - * @returns {ChunkGroup[]} returns the children of this group - */ - getChildren() { - return this._children.getFromCache(getArray); - } + /** + * Apply define key + * @param {string} prefix Prefix + * @param {string} key Key + * @returns {void} + */ + const applyDefineKey = (prefix, key) => { + const splittedKey = key.split("."); + splittedKey.slice(1).forEach((_, i) => { + const fullKey = prefix + splittedKey.slice(0, i + 1).join("."); + parser.hooks.canRename.for(fullKey).tap("DefinePlugin", () => { + addValueDependency(key); + return true; + }); + }); + }; - getNumberOfChildren() { - return this._children.size; - } + /** + * Apply Code + * @param {string} key Key + * @param {CodeValue} code Code + * @returns {void} + */ + const applyDefine = (key, code) => { + const originalKey = key; + const isTypeof = /^typeof\s+/.test(key); + if (isTypeof) key = key.replace(/^typeof\s+/, ""); + let recurse = false; + let recurseTypeof = false; + if (!isTypeof) { + parser.hooks.canRename.for(key).tap("DefinePlugin", () => { + addValueDependency(originalKey); + return true; + }); + parser.hooks.evaluateIdentifier + .for(key) + .tap("DefinePlugin", expr => { + /** + * this is needed in case there is a recursion in the DefinePlugin + * to prevent an endless recursion + * e.g.: new DefinePlugin({ + * "a": "b", + * "b": "a" + * }); + */ + if (recurse) return; + addValueDependency(originalKey); + recurse = true; + const res = parser.evaluate( + toCode( + code, + parser, + compilation.valueCacheVersions, + key, + runtimeTemplate, + null + ) + ); + recurse = false; + res.setRange(expr.range); + return res; + }); + parser.hooks.expression.for(key).tap("DefinePlugin", expr => { + addValueDependency(originalKey); + const strCode = toCode( + code, + parser, + compilation.valueCacheVersions, + originalKey, + runtimeTemplate, + !parser.isAsiPosition(expr.range[0]) + ); + if (/__webpack_require__\s*(!?\.)/.test(strCode)) { + return toConstantDependency(parser, strCode, [ + RuntimeGlobals.require + ])(expr); + } else if (/__webpack_require__/.test(strCode)) { + return toConstantDependency(parser, strCode, [ + RuntimeGlobals.requireScope + ])(expr); + } else { + return toConstantDependency(parser, strCode)(expr); + } + }); + } + parser.hooks.evaluateTypeof.for(key).tap("DefinePlugin", expr => { + /** + * this is needed in case there is a recursion in the DefinePlugin + * to prevent an endless recursion + * e.g.: new DefinePlugin({ + * "typeof a": "typeof b", + * "typeof b": "typeof a" + * }); + */ + if (recurseTypeof) return; + recurseTypeof = true; + addValueDependency(originalKey); + const codeCode = toCode( + code, + parser, + compilation.valueCacheVersions, + originalKey, + runtimeTemplate, + null + ); + const typeofCode = isTypeof + ? codeCode + : "typeof (" + codeCode + ")"; + const res = parser.evaluate(typeofCode); + recurseTypeof = false; + res.setRange(expr.range); + return res; + }); + parser.hooks.typeof.for(key).tap("DefinePlugin", expr => { + addValueDependency(originalKey); + const codeCode = toCode( + code, + parser, + compilation.valueCacheVersions, + originalKey, + runtimeTemplate, + null + ); + const typeofCode = isTypeof + ? codeCode + : "typeof (" + codeCode + ")"; + const res = parser.evaluate(typeofCode); + if (!res.isString()) return; + return toConstantDependency( + parser, + JSON.stringify(res.string) + ).bind(parser)(expr); + }); + }; - get childrenIterable() { - return this._children; + /** + * Apply Object + * @param {string} key Key + * @param {Object} obj Object + * @returns {void} + */ + const applyObjectDefine = (key, obj) => { + parser.hooks.canRename.for(key).tap("DefinePlugin", () => { + addValueDependency(key); + return true; + }); + parser.hooks.evaluateIdentifier + .for(key) + .tap("DefinePlugin", expr => { + addValueDependency(key); + return new BasicEvaluatedExpression() + .setTruthy() + .setSideEffects(false) + .setRange(expr.range); + }); + parser.hooks.evaluateTypeof + .for(key) + .tap( + "DefinePlugin", + withValueDependency(key, evaluateToString("object")) + ); + parser.hooks.expression.for(key).tap("DefinePlugin", expr => { + addValueDependency(key); + const strCode = stringifyObj( + obj, + parser, + compilation.valueCacheVersions, + key, + runtimeTemplate, + !parser.isAsiPosition(expr.range[0]) + ); + + if (/__webpack_require__\s*(!?\.)/.test(strCode)) { + return toConstantDependency(parser, strCode, [ + RuntimeGlobals.require + ])(expr); + } else if (/__webpack_require__/.test(strCode)) { + return toConstantDependency(parser, strCode, [ + RuntimeGlobals.requireScope + ])(expr); + } else { + return toConstantDependency(parser, strCode)(expr); + } + }); + parser.hooks.typeof + .for(key) + .tap( + "DefinePlugin", + withValueDependency( + key, + toConstantDependency(parser, JSON.stringify("object")) + ) + ); + }; + + walkDefinitions(definitions, ""); + }; + + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("DefinePlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("DefinePlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("DefinePlugin", handler); + + /** + * Walk definitions + * @param {Object} definitions Definitions map + * @param {string} prefix Prefix string + * @returns {void} + */ + const walkDefinitionsForValues = (definitions, prefix) => { + Object.keys(definitions).forEach(key => { + const code = definitions[key]; + const version = toCacheVersion(code); + const name = VALUE_DEP_PREFIX + prefix + key; + mainHash.update("|" + prefix + key); + const oldVersion = compilation.valueCacheVersions.get(name); + if (oldVersion === undefined) { + compilation.valueCacheVersions.set(name, version); + } else if (oldVersion !== version) { + const warning = new WebpackError( + `DefinePlugin\nConflicting values for '${prefix + key}'` + ); + warning.details = `'${oldVersion}' !== '${version}'`; + warning.hideStack = true; + compilation.warnings.push(warning); + } + if ( + code && + typeof code === "object" && + !(code instanceof RuntimeValue) && + !(code instanceof RegExp) + ) { + walkDefinitionsForValues(code, prefix + key + "."); + } + }); + }; + + walkDefinitionsForValues(definitions, ""); + + compilation.valueCacheVersions.set( + VALUE_DEP_MAIN, + /** @type {string} */ (mainHash.digest("hex").slice(0, 8)) + ); + } + ); } +} +module.exports = DefinePlugin; - /** - * @param {ChunkGroup} group the chunk group to remove - * @returns {boolean} returns true if the chunk group was removed - */ - removeChild(group) { - if (!this._children.has(group)) { - return false; - } - this._children.delete(group); - group.removeParent(this); - return true; +/***/ }), + +/***/ 28623: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { OriginalSource, RawSource } = __webpack_require__(51255); +const Module = __webpack_require__(73208); +const RuntimeGlobals = __webpack_require__(16475); +const DelegatedSourceDependency = __webpack_require__(22914); +const StaticExportsDependency = __webpack_require__(91418); +const makeSerializable = __webpack_require__(33032); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./LibManifestPlugin").ManifestModuleData} ManifestModuleData */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("./Module").SourceContext} SourceContext */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./dependencies/ModuleDependency")} ModuleDependency */ +/** @typedef {import("./util/Hash")} Hash */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ + +const TYPES = new Set(["javascript"]); +const RUNTIME_REQUIREMENTS = new Set([ + RuntimeGlobals.module, + RuntimeGlobals.require +]); + +class DelegatedModule extends Module { + constructor(sourceRequest, data, type, userRequest, originalRequest) { + super("javascript/dynamic", null); + + // Info from Factory + this.sourceRequest = sourceRequest; + this.request = data.id; + this.delegationType = type; + this.userRequest = userRequest; + this.originalRequest = originalRequest; + /** @type {ManifestModuleData} */ + this.delegateData = data; + + // Build info + this.delegatedSourceDependency = undefined; } /** - * @param {ChunkGroup} parentChunk the parent group to be added into - * @returns {boolean} returns true if this chunk group was added to the parent group + * @returns {Set} types available (do not mutate) */ - addParent(parentChunk) { - if (!this._parents.has(parentChunk)) { - this._parents.add(parentChunk); - return true; - } - return false; + getSourceTypes() { + return TYPES; } /** - * @returns {ChunkGroup[]} returns the parents of this group + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion */ - getParents() { - return this._parents.getFromCache(getArray); + libIdent(options) { + return typeof this.originalRequest === "string" + ? this.originalRequest + : this.originalRequest.libIdent(options); } - getNumberOfParents() { - return this._parents.size; + /** + * @returns {string} a unique identifier of the module + */ + identifier() { + return `delegated ${JSON.stringify(this.request)} from ${ + this.sourceRequest + }`; } /** - * @param {ChunkGroup} parent the parent group - * @returns {boolean} returns true if the parent group contains this group + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module */ - hasParent(parent) { - return this._parents.has(parent); + readableIdentifier(requestShortener) { + return `delegated ${this.userRequest} from ${this.sourceRequest}`; } - get parentsIterable() { - return this._parents; + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + return callback(null, !this.buildMeta); } /** - * @param {ChunkGroup} chunkGroup the parent group - * @returns {boolean} returns true if this group has been removed from the parent - */ - removeParent(chunkGroup) { - if (this._parents.delete(chunkGroup)) { - chunkGroup.removeChild(this); - return true; - } - return false; - } - - /** - * @param {Entrypoint} entrypoint entrypoint to add - * @returns {boolean} returns true if entrypoint was added + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} */ - addAsyncEntrypoint(entrypoint) { - const size = this._asyncEntrypoints.size; - this._asyncEntrypoints.add(entrypoint); - return size !== this._asyncEntrypoints.size; - } - - get asyncEntrypointsIterable() { - return this._asyncEntrypoints; + build(options, compilation, resolver, fs, callback) { + this.buildMeta = { ...this.delegateData.buildMeta }; + this.buildInfo = {}; + this.dependencies.length = 0; + this.delegatedSourceDependency = new DelegatedSourceDependency( + this.sourceRequest + ); + this.addDependency(this.delegatedSourceDependency); + this.addDependency( + new StaticExportsDependency(this.delegateData.exports || true, false) + ); + callback(); } /** - * @returns {Array} an array containing the blocks + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result */ - getBlocks() { - return this._blocks.getFromCache(getArray); - } + codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { + const dep = /** @type {DelegatedSourceDependency} */ (this.dependencies[0]); + const sourceModule = moduleGraph.getModule(dep); + let str; - getNumberOfBlocks() { - return this._blocks.size; - } + if (!sourceModule) { + str = runtimeTemplate.throwMissingModuleErrorBlock({ + request: this.sourceRequest + }); + } else { + str = `module.exports = (${runtimeTemplate.moduleExports({ + module: sourceModule, + chunkGraph, + request: dep.request, + runtimeRequirements: new Set() + })})`; - hasBlock(block) { - return this._blocks.has(block); - } + switch (this.delegationType) { + case "require": + str += `(${JSON.stringify(this.request)})`; + break; + case "object": + str += `[${JSON.stringify(this.request)}]`; + break; + } - /** - * @returns {Iterable} blocks - */ - get blocksIterable() { - return this._blocks; - } + str += ";"; + } - /** - * @param {AsyncDependenciesBlock} block a block - * @returns {boolean} false, if block was already added - */ - addBlock(block) { - if (!this._blocks.has(block)) { - this._blocks.add(block); - return true; + const sources = new Map(); + if (this.useSourceMap || this.useSimpleSourceMap) { + sources.set("javascript", new OriginalSource(str, this.identifier())); + } else { + sources.set("javascript", new RawSource(str)); } - return false; - } - /** - * @param {Module} module origin module - * @param {DependencyLocation} loc location of the reference in the origin module - * @param {string} request request name of the reference - * @returns {void} - */ - addOrigin(module, loc, request) { - this.origins.push({ - module, - loc, - request - }); + return { + sources, + runtimeRequirements: RUNTIME_REQUIREMENTS + }; } /** - * @returns {string[]} the files contained this chunk group + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) */ - getFiles() { - const files = new Set(); - - for (const chunk of this.chunks) { - for (const file of chunk.files) { - files.add(file); - } - } - - return Array.from(files); + size(type) { + return 42; } /** + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context * @returns {void} */ - remove() { - // cleanup parents - for (const parentChunkGroup of this._parents) { - // remove this chunk from its parents - parentChunkGroup._children.delete(this); - - // cleanup "sub chunks" - for (const chunkGroup of this._children) { - /** - * remove this chunk as "intermediary" and connect - * it "sub chunks" and parents directly - */ - // add parent to each "sub chunk" - chunkGroup.addParent(parentChunkGroup); - // add "sub chunk" to parent - parentChunkGroup.addChild(chunkGroup); - } - } - - /** - * we need to iterate again over the children - * to remove this from the child's parents. - * This can not be done in the above loop - * as it is not guaranteed that `this._parents` contains anything. - */ - for (const chunkGroup of this._children) { - // remove this as parent of every "sub chunk" - chunkGroup._parents.delete(this); - } - - // remove chunks - for (const chunk of this.chunks) { - chunk.removeGroup(this); - } + updateHash(hash, context) { + hash.update(this.delegationType); + hash.update(JSON.stringify(this.request)); + super.updateHash(hash, context); } - sortItems() { - this.origins.sort(sortOrigin); + serialize(context) { + const { write } = context; + // constructor + write(this.sourceRequest); + write(this.delegateData); + write(this.delegationType); + write(this.userRequest); + write(this.originalRequest); + super.serialize(context); } - /** - * Sorting predicate which allows current ChunkGroup to be compared against another. - * Sorting values are based off of number of chunks in ChunkGroup. - * - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {ChunkGroup} otherGroup the chunkGroup to compare this against - * @returns {-1|0|1} sort position for comparison - */ - compareTo(chunkGraph, otherGroup) { - if (this.chunks.length > otherGroup.chunks.length) return -1; - if (this.chunks.length < otherGroup.chunks.length) return 1; - return compareIterables(compareChunks(chunkGraph))( - this.chunks, - otherGroup.chunks + static deserialize(context) { + const { read } = context; + const obj = new DelegatedModule( + read(), // sourceRequest + read(), // delegateData + read(), // delegationType + read(), // userRequest + read() // originalRequest ); + obj.deserialize(context); + return obj; } /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {Record} mapping from children type to ordered list of ChunkGroups - */ - getChildrenByOrders(moduleGraph, chunkGraph) { - /** @type {Map} */ - const lists = new Map(); - for (const childGroup of this._children) { - for (const key of Object.keys(childGroup.options)) { - if (key.endsWith("Order")) { - const name = key.substr(0, key.length - "Order".length); - let list = lists.get(name); - if (list === undefined) { - lists.set(name, (list = [])); - } - list.push({ - order: childGroup.options[key], - group: childGroup - }); - } - } - } - /** @type {Record} */ - const result = Object.create(null); - for (const [name, list] of lists) { - list.sort((a, b) => { - const cmp = b.order - a.order; - if (cmp !== 0) return cmp; - return a.group.compareTo(chunkGraph, b.group); - }); - result[name] = list.map(i => i.group); - } - return result; - } - - /** - * Sets the top-down index of a module in this ChunkGroup - * @param {Module} module module for which the index should be set - * @param {number} index the index of the module + * Assuming this module is in the cache. Update the (cached) module with + * the fresh module from the factory. Usually updates internal references + * and properties. + * @param {Module} module fresh module * @returns {void} */ - setModulePreOrderIndex(module, index) { - this._modulePreOrderIndices.set(module, index); + updateCacheModule(module) { + super.updateCacheModule(module); + const m = /** @type {DelegatedModule} */ (module); + this.delegationType = m.delegationType; + this.userRequest = m.userRequest; + this.originalRequest = m.originalRequest; + this.delegateData = m.delegateData; } /** - * Gets the top-down index of a module in this ChunkGroup - * @param {Module} module the module - * @returns {number} index + * Assuming this module is in the cache. Remove internal references to allow freeing some memory. */ - getModulePreOrderIndex(module) { - return this._modulePreOrderIndices.get(module); + cleanupForCache() { + super.cleanupForCache(); + this.delegateData = undefined; } +} - /** - * Sets the bottom-up index of a module in this ChunkGroup - * @param {Module} module module for which the index should be set - * @param {number} index the index of the module - * @returns {void} - */ - setModulePostOrderIndex(module, index) { - this._modulePostOrderIndices.set(module, index); - } +makeSerializable(DelegatedModule, "webpack/lib/DelegatedModule"); - /** - * Gets the bottom-up index of a module in this ChunkGroup - * @param {Module} module the module - * @returns {number} index - */ - getModulePostOrderIndex(module) { - return this._modulePostOrderIndices.get(module); +module.exports = DelegatedModule; + + +/***/ }), + +/***/ 51387: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const DelegatedModule = __webpack_require__(28623); + +// options.source +// options.type +// options.context +// options.scope +// options.content +// options.associatedObjectForCache +class DelegatedModuleFactoryPlugin { + constructor(options) { + this.options = options; + options.type = options.type || "require"; + options.extensions = options.extensions || ["", ".js", ".json", ".wasm"]; } - /* istanbul ignore next */ - checkConstraints() { - const chunk = this; - for (const child of chunk._children) { - if (!child._parents.has(chunk)) { - throw new Error( - `checkConstraints: child missing parent ${chunk.debugId} -> ${child.debugId}` - ); - } - } - for (const parentChunk of chunk._parents) { - if (!parentChunk._children.has(chunk)) { - throw new Error( - `checkConstraints: parent missing child ${parentChunk.debugId} <- ${chunk.debugId}` - ); - } + apply(normalModuleFactory) { + const scope = this.options.scope; + if (scope) { + normalModuleFactory.hooks.factorize.tapAsync( + "DelegatedModuleFactoryPlugin", + (data, callback) => { + const [dependency] = data.dependencies; + const { request } = dependency; + if (request && request.startsWith(`${scope}/`)) { + const innerRequest = "." + request.substr(scope.length); + let resolved; + if (innerRequest in this.options.content) { + resolved = this.options.content[innerRequest]; + return callback( + null, + new DelegatedModule( + this.options.source, + resolved, + this.options.type, + innerRequest, + request + ) + ); + } + for (let i = 0; i < this.options.extensions.length; i++) { + const extension = this.options.extensions[i]; + const requestPlusExt = innerRequest + extension; + if (requestPlusExt in this.options.content) { + resolved = this.options.content[requestPlusExt]; + return callback( + null, + new DelegatedModule( + this.options.source, + resolved, + this.options.type, + requestPlusExt, + request + extension + ) + ); + } + } + } + return callback(); + } + ); + } else { + normalModuleFactory.hooks.module.tap( + "DelegatedModuleFactoryPlugin", + module => { + const request = module.libIdent(this.options); + if (request) { + if (request in this.options.content) { + const resolved = this.options.content[request]; + return new DelegatedModule( + this.options.source, + resolved, + this.options.type, + request, + module + ); + } + } + return module; + } + ); } } } - -ChunkGroup.prototype.getModuleIndex = util.deprecate( - ChunkGroup.prototype.getModulePreOrderIndex, - "ChunkGroup.getModuleIndex was renamed to getModulePreOrderIndex", - "DEP_WEBPACK_CHUNK_GROUP_GET_MODULE_INDEX" -); - -ChunkGroup.prototype.getModuleIndex2 = util.deprecate( - ChunkGroup.prototype.getModulePostOrderIndex, - "ChunkGroup.getModuleIndex2 was renamed to getModulePostOrderIndex", - "DEP_WEBPACK_CHUNK_GROUP_GET_MODULE_INDEX_2" -); - -module.exports = ChunkGroup; +module.exports = DelegatedModuleFactoryPlugin; /***/ }), -/***/ 918: +/***/ 80632: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -28562,35 +32272,47 @@ module.exports = ChunkGroup; -const WebpackError = __webpack_require__(53799); +const DelegatedModuleFactoryPlugin = __webpack_require__(51387); +const DelegatedSourceDependency = __webpack_require__(22914); -/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./Compiler")} Compiler */ + +class DelegatedPlugin { + constructor(options) { + this.options = options; + } -class ChunkRenderError extends WebpackError { /** - * Create a new ChunkRenderError - * @param {Chunk} chunk A chunk - * @param {string} file Related file - * @param {Error} error Original error + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - constructor(chunk, file, error) { - super(); + apply(compiler) { + compiler.hooks.compilation.tap( + "DelegatedPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + DelegatedSourceDependency, + normalModuleFactory + ); + } + ); - this.name = "ChunkRenderError"; - this.error = error; - this.message = error.message; - this.details = error.stack; - this.file = file; - this.chunk = chunk; + compiler.hooks.compile.tap("DelegatedPlugin", ({ normalModuleFactory }) => { + new DelegatedModuleFactoryPlugin({ + associatedObjectForCache: compiler.root, + ...this.options + }).apply(normalModuleFactory); + }); } } -module.exports = ChunkRenderError; +module.exports = DelegatedPlugin; /***/ }), -/***/ 46341: +/***/ 71040: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -28601,524 +32323,467 @@ module.exports = ChunkRenderError; -const util = __webpack_require__(73837); -const memoize = __webpack_require__(78676); +const makeSerializable = __webpack_require__(33032); -/** @typedef {import("../declarations/WebpackOptions").Output} OutputOptions */ -/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./ChunkGroup")} ChunkGroup */ +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("./util/Hash")} Hash */ -const getJavascriptModulesPlugin = memoize(() => - __webpack_require__(89464) -); +/** @typedef {(d: Dependency) => boolean} DependencyFilterFunction */ + +class DependenciesBlock { + constructor() { + /** @type {Dependency[]} */ + this.dependencies = []; + /** @type {AsyncDependenciesBlock[]} */ + this.blocks = []; + /** @type {DependenciesBlock} */ + this.parent = undefined; + } + + getRootBlock() { + /** @type {DependenciesBlock} */ + let current = this; + while (current.parent) current = current.parent; + return current; + } -// TODO webpack 6 remove this class -class ChunkTemplate { /** - * @param {OutputOptions} outputOptions output options - * @param {Compilation} compilation the compilation + * Adds a DependencyBlock to DependencyBlock relationship. + * This is used for when a Module has a AsyncDependencyBlock tie (for code-splitting) + * + * @param {AsyncDependenciesBlock} block block being added + * @returns {void} */ - constructor(outputOptions, compilation) { - this._outputOptions = outputOptions || {}; - this.hooks = Object.freeze({ - renderManifest: { - tap: util.deprecate( - (options, fn) => { - compilation.hooks.renderManifest.tap( - options, - (entries, options) => { - if (options.chunk.hasRuntime()) return entries; - return fn(entries, options); - } - ); - }, - "ChunkTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)", - "DEP_WEBPACK_CHUNK_TEMPLATE_RENDER_MANIFEST" - ) - }, - modules: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .renderChunk.tap(options, (source, renderContext) => - fn( - source, - compilation.moduleTemplates.javascript, - renderContext - ) - ); - }, - "ChunkTemplate.hooks.modules is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderChunk instead)", - "DEP_WEBPACK_CHUNK_TEMPLATE_MODULES" - ) - }, - render: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .renderChunk.tap(options, (source, renderContext) => - fn( - source, - compilation.moduleTemplates.javascript, - renderContext - ) - ); - }, - "ChunkTemplate.hooks.render is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderChunk instead)", - "DEP_WEBPACK_CHUNK_TEMPLATE_RENDER" - ) - }, - renderWithEntry: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .render.tap(options, (source, renderContext) => { - if ( - renderContext.chunkGraph.getNumberOfEntryModules( - renderContext.chunk - ) === 0 || - renderContext.chunk.hasRuntime() - ) { - return source; - } - return fn(source, renderContext.chunk); - }); - }, - "ChunkTemplate.hooks.renderWithEntry is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)", - "DEP_WEBPACK_CHUNK_TEMPLATE_RENDER_WITH_ENTRY" - ) - }, - hash: { - tap: util.deprecate( - (options, fn) => { - compilation.hooks.fullHash.tap(options, fn); - }, - "ChunkTemplate.hooks.hash is deprecated (use Compilation.hooks.fullHash instead)", - "DEP_WEBPACK_CHUNK_TEMPLATE_HASH" - ) - }, - hashForChunk: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .chunkHash.tap(options, (chunk, hash, context) => { - if (chunk.hasRuntime()) return; - fn(hash, chunk, context); - }); - }, - "ChunkTemplate.hooks.hashForChunk is deprecated (use JavascriptModulesPlugin.getCompilationHooks().chunkHash instead)", - "DEP_WEBPACK_CHUNK_TEMPLATE_HASH_FOR_CHUNK" - ) - } - }); + addBlock(block) { + this.blocks.push(block); + block.parent = this; + } + + /** + * @param {Dependency} dependency dependency being tied to block. + * This is an "edge" pointing to another "node" on module graph. + * @returns {void} + */ + addDependency(dependency) { + this.dependencies.push(dependency); + } + + /** + * @param {Dependency} dependency dependency being removed + * @returns {void} + */ + removeDependency(dependency) { + const idx = this.dependencies.indexOf(dependency); + if (idx >= 0) { + this.dependencies.splice(idx, 1); + } + } + + /** + * Removes all dependencies and blocks + * @returns {void} + */ + clearDependenciesAndBlocks() { + this.dependencies.length = 0; + this.blocks.length = 0; + } + + /** + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + for (const dep of this.dependencies) { + dep.updateHash(hash, context); + } + for (const block of this.blocks) { + block.updateHash(hash, context); + } + } + + serialize({ write }) { + write(this.dependencies); + write(this.blocks); + } + + deserialize({ read }) { + this.dependencies = read(); + this.blocks = read(); + for (const block of this.blocks) { + block.parent = this; + } } } -Object.defineProperty(ChunkTemplate.prototype, "outputOptions", { - get: util.deprecate( - /** - * @this {ChunkTemplate} - * @returns {OutputOptions} output options - */ - function () { - return this._outputOptions; - }, - "ChunkTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)", - "DEP_WEBPACK_CHUNK_TEMPLATE_OUTPUT_OPTIONS" - ) -}); +makeSerializable(DependenciesBlock, "webpack/lib/DependenciesBlock"); -module.exports = ChunkTemplate; +module.exports = DependenciesBlock; /***/ }), -/***/ 31085: +/***/ 54912: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Sergey Melyukov @smelukov + Author Tobias Koppers @sokra */ -const asyncLib = __webpack_require__(78175); -const { SyncBailHook } = __webpack_require__(41242); -const Compilation = __webpack_require__(85720); -const createSchemaValidation = __webpack_require__(32540); -const { join } = __webpack_require__(17139); -const processAsyncTree = __webpack_require__(42791); +const memoize = __webpack_require__(78676); -/** @typedef {import("../declarations/WebpackOptions").CleanOptions} CleanOptions */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./logging/Logger").Logger} Logger */ -/** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */ -/** @typedef {import("./util/fs").StatsCallback} StatsCallback */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./util/Hash")} Hash */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ -/** @typedef {(function(string):boolean)|RegExp} IgnoreItem */ -/** @typedef {function(IgnoreItem): void} AddToIgnoreCallback */ +/** + * @typedef {Object} UpdateHashContext + * @property {ChunkGraph} chunkGraph + * @property {RuntimeSpec} runtime + * @property {RuntimeTemplate=} runtimeTemplate + */ /** - * @typedef {Object} CleanPluginCompilationHooks - * @property {SyncBailHook<[string], boolean>} keep when returning true the file/directory will be kept during cleaning, returning false will clean it and ignore the following plugins and config + * @typedef {Object} SourcePosition + * @property {number} line + * @property {number=} column */ -const validate = createSchemaValidation( - undefined, - () => { - const { definitions } = __webpack_require__(73342); - return { - definitions, - oneOf: [{ $ref: "#/definitions/CleanOptions" }] - }; - }, - { - name: "Clean Plugin", - baseDataPath: "options" - } -); +/** + * @typedef {Object} RealDependencyLocation + * @property {SourcePosition} start + * @property {SourcePosition=} end + * @property {number=} index + */ /** - * @param {OutputFileSystem} fs filesystem - * @param {string} outputPath output path - * @param {Set} currentAssets filename of the current assets (must not start with .. or ., must only use / as path separator) - * @param {function((Error | null)=, Set=): void} callback returns the filenames of the assets that shouldn't be there - * @returns {void} + * @typedef {Object} SyntheticDependencyLocation + * @property {string} name + * @property {number=} index */ -const getDiffToFs = (fs, outputPath, currentAssets, callback) => { - const directories = new Set(); - // get directories of assets - for (const asset of currentAssets) { - directories.add(asset.replace(/(^|\/)[^/]*$/, "")); - } - // and all parent directories - for (const directory of directories) { - directories.add(directory.replace(/(^|\/)[^/]*$/, "")); - } - const diff = new Set(); - asyncLib.forEachLimit( - directories, - 10, - (directory, callback) => { - fs.readdir(join(fs, outputPath, directory), (err, entries) => { - if (err) { - if (err.code === "ENOENT") return callback(); - if (err.code === "ENOTDIR") { - diff.add(directory); - return callback(); - } - return callback(err); - } - for (const entry of entries) { - const file = /** @type {string} */ (entry); - const filename = directory ? `${directory}/${file}` : file; - if (!directories.has(filename) && !currentAssets.has(filename)) { - diff.add(filename); - } - } - callback(); - }); - }, - err => { - if (err) return callback(err); - callback(null, diff); - } - ); -}; +/** @typedef {SyntheticDependencyLocation|RealDependencyLocation} DependencyLocation */ /** - * @param {Set} currentAssets assets list - * @param {Set} oldAssets old assets list - * @returns {Set} diff + * @typedef {Object} ExportSpec + * @property {string} name the name of the export + * @property {boolean=} canMangle can the export be renamed (defaults to true) + * @property {boolean=} terminalBinding is the export a terminal binding that should be checked for export star conflicts + * @property {(string | ExportSpec)[]=} exports nested exports + * @property {ModuleGraphConnection=} from when reexported: from which module + * @property {string[] | null=} export when reexported: from which export + * @property {number=} priority when reexported: with which priority + * @property {boolean=} hidden export is not visible, because another export blends over it */ -const getDiffToOldAssets = (currentAssets, oldAssets) => { - const diff = new Set(); - for (const asset of oldAssets) { - if (!currentAssets.has(asset)) diff.add(asset); - } - return diff; -}; /** - * @param {OutputFileSystem} fs filesystem - * @param {string} filename path to file - * @param {StatsCallback} callback callback for provided filename - * @returns {void} + * @typedef {Object} ExportsSpec + * @property {(string | ExportSpec)[] | true | null} exports exported names, true for unknown exports or null for no exports + * @property {Set=} excludeExports when exports = true, list of unaffected exports + * @property {Set=} hideExports list of maybe prior exposed, but now hidden exports + * @property {ModuleGraphConnection=} from when reexported: from which module + * @property {number=} priority when reexported: with which priority + * @property {boolean=} canMangle can the export be renamed (defaults to true) + * @property {boolean=} terminalBinding are the exports terminal bindings that should be checked for export star conflicts + * @property {Module[]=} dependencies module on which the result depends on */ -const doStat = (fs, filename, callback) => { - if ("lstat" in fs) { - fs.lstat(filename, callback); - } else { - fs.stat(filename, callback); - } -}; /** - * @param {OutputFileSystem} fs filesystem - * @param {string} outputPath output path - * @param {boolean} dry only log instead of fs modification - * @param {Logger} logger logger - * @param {Set} diff filenames of the assets that shouldn't be there - * @param {function(string): boolean} isKept check if the entry is ignored - * @param {function(Error=): void} callback callback - * @returns {void} + * @typedef {Object} ReferencedExport + * @property {string[]} name name of the referenced export + * @property {boolean=} canMangle when false, referenced export can not be mangled, defaults to true */ -const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => { - const log = msg => { - if (dry) { - logger.info(msg); - } else { - logger.log(msg); - } - }; - /** @typedef {{ type: "check" | "unlink" | "rmdir", filename: string, parent: { remaining: number, job: Job } | undefined }} Job */ - /** @type {Job[]} */ - const jobs = Array.from(diff, filename => ({ - type: "check", - filename, - parent: undefined - })); - processAsyncTree( - jobs, - 10, - ({ type, filename, parent }, push, callback) => { - const handleError = err => { - if (err.code === "ENOENT") { - log(`${filename} was removed during cleaning by something else`); - handleParent(); - return callback(); - } - return callback(err); - }; - const handleParent = () => { - if (parent && --parent.remaining === 0) push(parent.job); - }; - const path = join(fs, outputPath, filename); - switch (type) { - case "check": - if (isKept(filename)) { - // do not decrement parent entry as we don't want to delete the parent - log(`${filename} will be kept`); - return process.nextTick(callback); - } - doStat(fs, path, (err, stats) => { - if (err) return handleError(err); - if (!stats.isDirectory()) { - push({ - type: "unlink", - filename, - parent - }); - return callback(); - } - fs.readdir(path, (err, entries) => { - if (err) return handleError(err); - /** @type {Job} */ - const deleteJob = { - type: "rmdir", - filename, - parent - }; - if (entries.length === 0) { - push(deleteJob); - } else { - const parentToken = { - remaining: entries.length, - job: deleteJob - }; - for (const entry of entries) { - const file = /** @type {string} */ (entry); - if (file.startsWith(".")) { - log( - `${filename} will be kept (dot-files will never be removed)` - ); - continue; - } - push({ - type: "check", - filename: `${filename}/${file}`, - parent: parentToken - }); - } - } - return callback(); - }); - }); - break; - case "rmdir": - log(`${filename} will be removed`); - if (dry) { - handleParent(); - return process.nextTick(callback); - } - if (!fs.rmdir) { - logger.warn( - `${filename} can't be removed because output file system doesn't support removing directories (rmdir)` - ); - return process.nextTick(callback); - } - fs.rmdir(path, err => { - if (err) return handleError(err); - handleParent(); - callback(); - }); - break; - case "unlink": - log(`${filename} will be removed`); - if (dry) { - handleParent(); - return process.nextTick(callback); - } - if (!fs.unlink) { - logger.warn( - `${filename} can't be removed because output file system doesn't support removing files (rmdir)` - ); - return process.nextTick(callback); - } - fs.unlink(path, err => { - if (err) return handleError(err); - handleParent(); - callback(); - }); - break; - } - }, - callback - ); -}; -/** @type {WeakMap} */ -const compilationHooksMap = new WeakMap(); +const TRANSITIVE = Symbol("transitive"); + +const getIgnoredModule = memoize(() => { + const RawModule = __webpack_require__(84929); + return new RawModule("/* (ignored) */", `ignored`, `(ignored)`); +}); + +class Dependency { + constructor() { + /** @type {Module} */ + this._parentModule = undefined; + /** @type {DependenciesBlock} */ + this._parentDependenciesBlock = undefined; + /** @type {number} */ + this._parentDependenciesBlockIndex = -1; + // TODO check if this can be moved into ModuleDependency + /** @type {boolean} */ + this.weak = false; + // TODO check if this can be moved into ModuleDependency + /** @type {boolean} */ + this.optional = false; + this._locSL = 0; + this._locSC = 0; + this._locEL = 0; + this._locEC = 0; + this._locI = undefined; + this._locN = undefined; + this._loc = undefined; + } -class CleanPlugin { /** - * @param {Compilation} compilation the compilation - * @returns {CleanPluginCompilationHooks} the attached hooks + * @returns {string} a display name for the type of dependency */ - static getCompilationHooks(compilation) { - if (!(compilation instanceof Compilation)) { - throw new TypeError( - "The 'compilation' argument must be an instance of Compilation" - ); - } - let hooks = compilationHooksMap.get(compilation); - if (hooks === undefined) { - hooks = { - /** @type {SyncBailHook<[string], boolean>} */ - keep: new SyncBailHook(["ignore"]) - }; - compilationHooksMap.set(compilation, hooks); - } - return hooks; + get type() { + return "unknown"; } - /** @param {CleanOptions} options options */ - constructor(options = {}) { - validate(options); - this.options = { dry: false, ...options }; + /** + * @returns {string} a dependency category, typical categories are "commonjs", "amd", "esm" + */ + get category() { + return "unknown"; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @returns {DependencyLocation} location */ - apply(compiler) { - const { dry, keep } = this.options; - - const keepFn = - typeof keep === "function" - ? keep - : typeof keep === "string" - ? path => path.startsWith(keep) - : typeof keep === "object" && keep.test - ? path => keep.test(path) - : () => false; + get loc() { + if (this._loc !== undefined) return this._loc; + /** @type {SyntheticDependencyLocation & RealDependencyLocation} */ + const loc = {}; + if (this._locSL > 0) { + loc.start = { line: this._locSL, column: this._locSC }; + } + if (this._locEL > 0) { + loc.end = { line: this._locEL, column: this._locEC }; + } + if (this._locN !== undefined) { + loc.name = this._locN; + } + if (this._locI !== undefined) { + loc.index = this._locI; + } + return (this._loc = loc); + } - // We assume that no external modification happens while the compiler is active - // So we can store the old assets and only diff to them to avoid fs access on - // incremental builds - let oldAssets; + set loc(loc) { + if ("start" in loc && typeof loc.start === "object") { + this._locSL = loc.start.line || 0; + this._locSC = loc.start.column || 0; + } else { + this._locSL = 0; + this._locSC = 0; + } + if ("end" in loc && typeof loc.end === "object") { + this._locEL = loc.end.line || 0; + this._locEC = loc.end.column || 0; + } else { + this._locEL = 0; + this._locEC = 0; + } + if ("index" in loc) { + this._locI = loc.index; + } else { + this._locI = undefined; + } + if ("name" in loc) { + this._locN = loc.name; + } else { + this._locN = undefined; + } + this._loc = loc; + } - compiler.hooks.emit.tapAsync( - { - name: "CleanPlugin", - stage: 100 - }, - (compilation, callback) => { - const hooks = CleanPlugin.getCompilationHooks(compilation); - const logger = compilation.getLogger("webpack.CleanPlugin"); - const fs = compiler.outputFileSystem; + setLoc(startLine, startColumn, endLine, endColumn) { + this._locSL = startLine; + this._locSC = startColumn; + this._locEL = endLine; + this._locEC = endColumn; + this._locI = undefined; + this._locN = undefined; + this._loc = undefined; + } - if (!fs.readdir) { - return callback( - new Error( - "CleanPlugin: Output filesystem doesn't support listing directories (readdir)" - ) - ); - } + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + return null; + } - const currentAssets = new Set(); - for (const asset of Object.keys(compilation.assets)) { - if (/^[A-Za-z]:\\|^\/|^\\\\/.test(asset)) continue; - let normalizedAsset; - let newNormalizedAsset = asset.replace(/\\/g, "/"); - do { - normalizedAsset = newNormalizedAsset; - newNormalizedAsset = normalizedAsset.replace( - /(^|\/)(?!\.\.)[^/]+\/\.\.\//g, - "$1" - ); - } while (newNormalizedAsset !== normalizedAsset); - if (normalizedAsset.startsWith("../")) continue; - currentAssets.add(normalizedAsset); - } + /** + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + */ + couldAffectReferencingModule() { + return TRANSITIVE; + } - const outputPath = compilation.getPath(compiler.outputPath, {}); + /** + * Returns the referenced module and export + * @deprecated + * @param {ModuleGraph} moduleGraph module graph + * @returns {never} throws error + */ + getReference(moduleGraph) { + throw new Error( + "Dependency.getReference was removed in favor of Dependency.getReferencedExports, ModuleGraph.getModule and ModuleGraph.getConnection().active" + ); + } - const isKept = path => { - const result = hooks.keep.call(path); - if (result !== undefined) return result; - return keepFn(path); - }; + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + return Dependency.EXPORTS_OBJECT_REFERENCED; + } - const diffCallback = (err, diff) => { - if (err) { - oldAssets = undefined; - return callback(err); - } - applyDiff(fs, outputPath, dry, logger, diff, isKept, err => { - if (err) { - oldAssets = undefined; - } else { - oldAssets = currentAssets; - } - callback(err); - }); - }; + /** + * @param {ModuleGraph} moduleGraph module graph + * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active + */ + getCondition(moduleGraph) { + return null; + } - if (oldAssets) { - diffCallback(null, getDiffToOldAssets(currentAssets, oldAssets)); - } else { - getDiffToFs(fs, outputPath, currentAssets, diffCallback); - } - } - ); + /** + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names + */ + getExports(moduleGraph) { + return undefined; + } + + /** + * Returns warnings + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[]} warnings + */ + getWarnings(moduleGraph) { + return null; + } + + /** + * Returns errors + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[]} errors + */ + getErrors(moduleGraph) { + return null; + } + + /** + * Update the hash + * @param {Hash} hash hash to be updated + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) {} + + /** + * implement this method to allow the occurrence order plugin to count correctly + * @returns {number} count how often the id is used in this dependency + */ + getNumberOfIdOccurrences() { + return 1; + } + + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this dependency connects the module to referencing modules + */ + getModuleEvaluationSideEffectsState(moduleGraph) { + return true; + } + + /** + * @param {string} context context directory + * @returns {Module} a module + */ + createIgnoredModule(context) { + return getIgnoredModule(); + } + + serialize({ write }) { + write(this.weak); + write(this.optional); + write(this._locSL); + write(this._locSC); + write(this._locEL); + write(this._locEC); + write(this._locI); + write(this._locN); + } + + deserialize({ read }) { + this.weak = read(); + this.optional = read(); + this._locSL = read(); + this._locSC = read(); + this._locEL = read(); + this._locEC = read(); + this._locI = read(); + this._locN = read(); } } -module.exports = CleanPlugin; +/** @type {string[][]} */ +Dependency.NO_EXPORTS_REFERENCED = []; +/** @type {string[][]} */ +Dependency.EXPORTS_OBJECT_REFERENCED = [[]]; + +Object.defineProperty(Dependency.prototype, "module", { + /** + * @deprecated + * @returns {never} throws + */ + get() { + throw new Error( + "module property was removed from Dependency (use compilation.moduleGraph.getModule(dependency) instead)" + ); + }, + + /** + * @deprecated + * @returns {never} throws + */ + set() { + throw new Error( + "module property was removed from Dependency (use compilation.moduleGraph.updateModule(dependency, module) instead)" + ); + } +}); + +Object.defineProperty(Dependency.prototype, "disconnect", { + get() { + throw new Error( + "disconnect was removed from Dependency (Dependency no longer carries graph specific information)" + ); + } +}); + +Dependency.TRANSITIVE = TRANSITIVE; + +module.exports = Dependency; /***/ }), -/***/ 2102: +/***/ 5160: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -29129,33 +32794,61 @@ module.exports = CleanPlugin; -const WebpackError = __webpack_require__(53799); - +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ +/** @typedef {import("./ConcatenationScope")} ConcatenationScope */ +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./Dependency").RuntimeSpec} RuntimeSpec */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Generator").GenerateContext} GenerateContext */ +/** @template T @typedef {import("./InitFragment")} InitFragment */ /** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -class CodeGenerationError extends WebpackError { +/** + * @typedef {Object} DependencyTemplateContext + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {DependencyTemplates} dependencyTemplates the dependency templates + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {Set} runtimeRequirements the requirements for runtime + * @property {Module} module current module + * @property {RuntimeSpec} runtime current runtimes, for which code is generated + * @property {InitFragment[]} initFragments mutable array of init fragments for the current module + * @property {ConcatenationScope=} concatenationScope when in a concatenated module, information about other concatenated modules + * @property {CodeGenerationResults} codeGenerationResults the code generation results + */ + +/** + * @typedef {Object} CssDependencyTemplateContextExtras + * @property {Map} cssExports the css exports + */ + +/** @typedef {DependencyTemplateContext & CssDependencyTemplateContextExtras} CssDependencyTemplateContext */ + +class DependencyTemplate { + /* istanbul ignore next */ /** - * Create a new CodeGenerationError - * @param {Module} module related module - * @param {Error} error Original error + * @abstract + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - constructor(module, error) { - super(); - - this.name = "CodeGenerationError"; - this.error = error; - this.message = error.message; - this.details = error.stack; - this.module = module; + apply(dependency, source, templateContext) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } } -module.exports = CodeGenerationError; +module.exports = DependencyTemplate; /***/ }), -/***/ 71426: +/***/ 9163: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -29166,159 +32859,71 @@ module.exports = CodeGenerationError; -const { provide } = __webpack_require__(82482); -const { first } = __webpack_require__(93347); const createHash = __webpack_require__(49835); -const { runtimeToString, RuntimeSpecMap } = __webpack_require__(17156); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./DependencyTemplate")} DependencyTemplate */ /** @typedef {typeof import("./util/Hash")} Hash */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ -class CodeGenerationResults { +/** @typedef {new (...args: any[]) => Dependency} DependencyConstructor */ + +class DependencyTemplates { /** * @param {string | Hash} hashFunction the hash function to use */ constructor(hashFunction = "md4") { - /** @type {Map>} */ - this.map = new Map(); + /** @type {Map} */ + this._map = new Map(); + /** @type {string} */ + this._hash = "31d6cfe0d16ae931b73c59d7e0c089c0"; this._hashFunction = hashFunction; } /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime runtime(s) - * @returns {CodeGenerationResult} the CodeGenerationResult - */ - get(module, runtime) { - const entry = this.map.get(module); - if (entry === undefined) { - throw new Error( - `No code generation entry for ${module.identifier()} (existing entries: ${Array.from( - this.map.keys(), - m => m.identifier() - ).join(", ")})` - ); - } - if (runtime === undefined) { - if (entry.size > 1) { - const results = new Set(entry.values()); - if (results.size !== 1) { - throw new Error( - `No unique code generation entry for unspecified runtime for ${module.identifier()} (existing runtimes: ${Array.from( - entry.keys(), - r => runtimeToString(r) - ).join(", ")}). -Caller might not support runtime-dependent code generation (opt-out via optimization.usedExports: "global").` - ); - } - return first(results); - } - return entry.values().next().value; - } - const result = entry.get(runtime); - if (result === undefined) { - throw new Error( - `No code generation entry for runtime ${runtimeToString( - runtime - )} for ${module.identifier()} (existing runtimes: ${Array.from( - entry.keys(), - r => runtimeToString(r) - ).join(", ")})` - ); - } - return result; - } - - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime runtime(s) - * @returns {boolean} true, when we have data for this - */ - has(module, runtime) { - const entry = this.map.get(module); - if (entry === undefined) { - return false; - } - if (runtime !== undefined) { - return entry.has(runtime); - } else if (entry.size > 1) { - const results = new Set(entry.values()); - return results.size === 1; - } else { - return entry.size === 1; - } - } - - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime runtime(s) - * @param {string} sourceType the source type - * @returns {Source} a source + * @param {DependencyConstructor} dependency Constructor of Dependency + * @returns {DependencyTemplate} template for this dependency */ - getSource(module, runtime, sourceType) { - return this.get(module, runtime).sources.get(sourceType); + get(dependency) { + return this._map.get(dependency); } /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime runtime(s) - * @returns {ReadonlySet} runtime requirements + * @param {DependencyConstructor} dependency Constructor of Dependency + * @param {DependencyTemplate} dependencyTemplate template for this dependency + * @returns {void} */ - getRuntimeRequirements(module, runtime) { - return this.get(module, runtime).runtimeRequirements; + set(dependency, dependencyTemplate) { + this._map.set(dependency, dependencyTemplate); } /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime runtime(s) - * @param {string} key data key - * @returns {any} data generated by code generation + * @param {string} part additional hash contributor + * @returns {void} */ - getData(module, runtime, key) { - const data = this.get(module, runtime).data; - return data === undefined ? undefined : data.get(key); + updateHash(part) { + const hash = createHash(this._hashFunction); + hash.update(`${this._hash}${part}`); + this._hash = /** @type {string} */ (hash.digest("hex")); } - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime runtime(s) - * @returns {any} hash of the code generation - */ - getHash(module, runtime) { - const info = this.get(module, runtime); - if (info.hash !== undefined) return info.hash; - const hash = createHash(this._hashFunction); - for (const [type, source] of info.sources) { - hash.update(type); - source.updateHash(hash); - } - if (info.runtimeRequirements) { - for (const rr of info.runtimeRequirements) hash.update(rr); - } - return (info.hash = /** @type {string} */ (hash.digest("hex"))); + getHash() { + return this._hash; } - /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime runtime(s) - * @param {CodeGenerationResult} result result from module - * @returns {void} - */ - add(module, runtime, result) { - const map = provide(this.map, module, () => new RuntimeSpecMap()); - map.set(runtime, result); + clone() { + const newInstance = new DependencyTemplates(this._hashFunction); + newInstance._map = new Map(this._map); + newInstance._hash = this._hash; + return newInstance; } } -module.exports = CodeGenerationResults; +module.exports = DependencyTemplates; /***/ }), -/***/ 98427: +/***/ 62790: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -29329,37 +32934,59 @@ module.exports = CodeGenerationResults; -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); +const DllModuleFactory = __webpack_require__(68703); +const DllEntryDependency = __webpack_require__(95666); +const EntryDependency = __webpack_require__(3979); -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +class DllEntryPlugin { + constructor(context, entries, options) { + this.context = context; + this.entries = entries; + this.options = options; + } -class CommentCompilationWarning extends WebpackError { - /** - * - * @param {string} message warning message - * @param {DependencyLocation} loc affected lines of code - */ - constructor(message, loc) { - super(message); - - this.name = "CommentCompilationWarning"; - - this.loc = loc; + apply(compiler) { + compiler.hooks.compilation.tap( + "DllEntryPlugin", + (compilation, { normalModuleFactory }) => { + const dllModuleFactory = new DllModuleFactory(); + compilation.dependencyFactories.set( + DllEntryDependency, + dllModuleFactory + ); + compilation.dependencyFactories.set( + EntryDependency, + normalModuleFactory + ); + } + ); + compiler.hooks.make.tapAsync("DllEntryPlugin", (compilation, callback) => { + compilation.addEntry( + this.context, + new DllEntryDependency( + this.entries.map((e, idx) => { + const dep = new EntryDependency(e); + dep.loc = { + name: this.options.name, + index: idx + }; + return dep; + }), + this.options.name + ), + this.options, + callback + ); + }); } } -makeSerializable( - CommentCompilationWarning, - "webpack/lib/CommentCompilationWarning" -); - -module.exports = CommentCompilationWarning; +module.exports = DllEntryPlugin; /***/ }), -/***/ 94258: +/***/ 28280: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -29370,156 +32997,161 @@ module.exports = CommentCompilationWarning; -const ConstDependency = __webpack_require__(76911); +const { RawSource } = __webpack_require__(51255); +const Module = __webpack_require__(73208); +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("./Module").SourceContext} SourceContext */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./util/Hash")} Hash */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ -const nestedWebpackRequireTag = Symbol("nested __webpack_require__"); +const TYPES = new Set(["javascript"]); +const RUNTIME_REQUIREMENTS = new Set([ + RuntimeGlobals.require, + RuntimeGlobals.module +]); + +class DllModule extends Module { + constructor(context, dependencies, name) { + super("javascript/dynamic", context); + + // Info from Factory + this.dependencies = dependencies; + this.name = name; + } -class CompatibilityPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + return TYPES; + } + + /** + * @returns {string} a unique identifier of the module + */ + identifier() { + return `dll ${this.name}`; + } + + /** + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + return `dll ${this.name}`; + } + + /** + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap( - "CompatibilityPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyTemplates.set( - ConstDependency, - new ConstDependency.Template() - ); + build(options, compilation, resolver, fs, callback) { + this.buildMeta = {}; + this.buildInfo = {}; + return callback(); + } - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("CompatibilityPlugin", (parser, parserOptions) => { - if ( - parserOptions.browserify !== undefined && - !parserOptions.browserify - ) - return; + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration(context) { + const sources = new Map(); + sources.set( + "javascript", + new RawSource("module.exports = __webpack_require__;") + ); + return { + sources, + runtimeRequirements: RUNTIME_REQUIREMENTS + }; + } - parser.hooks.call - .for("require") - .tap("CompatibilityPlugin", expr => { - // support for browserify style require delegator: "require(o, !0)" - if (expr.arguments.length !== 2) return; - const second = parser.evaluateExpression(expr.arguments[1]); - if (!second.isBoolean()) return; - if (second.asBool() !== true) return; - const dep = new ConstDependency("require", expr.callee.range); - dep.loc = expr.loc; - if (parser.state.current.dependencies.length > 0) { - const last = - parser.state.current.dependencies[ - parser.state.current.dependencies.length - 1 - ]; - if ( - last.critical && - last.options && - last.options.request === "." && - last.userRequest === "." && - last.options.recursive - ) - parser.state.current.dependencies.pop(); - } - parser.state.module.addPresentationalDependency(dep); - return true; - }); - }); + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + return callback(null, !this.buildMeta); + } - /** - * @param {JavascriptParser} parser the parser - * @returns {void} - */ - const handler = parser => { - // Handle nested requires - parser.hooks.preStatement.tap("CompatibilityPlugin", statement => { - if ( - statement.type === "FunctionDeclaration" && - statement.id && - statement.id.name === "__webpack_require__" - ) { - const newName = `__nested_webpack_require_${statement.range[0]}__`; - parser.tagVariable(statement.id.name, nestedWebpackRequireTag, { - name: newName, - declaration: { - updated: false, - loc: statement.id.loc, - range: statement.id.range - } - }); - return true; - } - }); - parser.hooks.pattern - .for("__webpack_require__") - .tap("CompatibilityPlugin", pattern => { - const newName = `__nested_webpack_require_${pattern.range[0]}__`; - parser.tagVariable(pattern.name, nestedWebpackRequireTag, { - name: newName, - declaration: { - updated: false, - loc: pattern.loc, - range: pattern.range - } - }); - return true; - }); - parser.hooks.expression - .for(nestedWebpackRequireTag) - .tap("CompatibilityPlugin", expr => { - const { name, declaration } = parser.currentTagData; - if (!declaration.updated) { - const dep = new ConstDependency(name, declaration.range); - dep.loc = declaration.loc; - parser.state.module.addPresentationalDependency(dep); - declaration.updated = true; - } - const dep = new ConstDependency(name, expr.range); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); + /** + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + return 12; + } - // Handle hashbang - parser.hooks.program.tap( - "CompatibilityPlugin", - (program, comments) => { - if (comments.length === 0) return; - const c = comments[0]; - if (c.type === "Line" && c.range[0] === 0) { - if (parser.state.source.slice(0, 2).toString() !== "#!") return; - // this is a hashbang comment - const dep = new ConstDependency("//", 0); - dep.loc = c.loc; - parser.state.module.addPresentationalDependency(dep); - } - } - ); - }; + /** + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + hash.update(`dll module${this.name || ""}`); + super.updateHash(hash, context); + } - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("CompatibilityPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("CompatibilityPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("CompatibilityPlugin", handler); - } - ); + serialize(context) { + context.write(this.name); + super.serialize(context); + } + + deserialize(context) { + this.name = context.read(); + super.deserialize(context); + } + + /** + * Assuming this module is in the cache. Update the (cached) module with + * the fresh module from the factory. Usually updates internal references + * and properties. + * @param {Module} module fresh module + * @returns {void} + */ + updateCacheModule(module) { + super.updateCacheModule(module); + this.dependencies = module.dependencies; + } + + /** + * Assuming this module is in the cache. Remove internal references to allow freeing some memory. + */ + cleanupForCache() { + super.cleanupForCache(); + this.dependencies = undefined; } } -module.exports = CompatibilityPlugin; + +makeSerializable(DllModule, "webpack/lib/DllModule"); + +module.exports = DllModule; /***/ }), -/***/ 85720: +/***/ 68703: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -29530,5272 +33162,3513 @@ module.exports = CompatibilityPlugin; -const asyncLib = __webpack_require__(78175); -const { - HookMap, - SyncHook, - SyncBailHook, - SyncWaterfallHook, - AsyncSeriesHook, - AsyncSeriesBailHook, - AsyncParallelHook -} = __webpack_require__(41242); -const util = __webpack_require__(73837); -const { CachedSource } = __webpack_require__(51255); -const { MultiItemCache } = __webpack_require__(55392); -const Chunk = __webpack_require__(39385); -const ChunkGraph = __webpack_require__(64971); -const ChunkGroup = __webpack_require__(15626); -const ChunkRenderError = __webpack_require__(918); -const ChunkTemplate = __webpack_require__(46341); -const CodeGenerationError = __webpack_require__(2102); -const CodeGenerationResults = __webpack_require__(71426); -const Dependency = __webpack_require__(54912); -const DependencyTemplates = __webpack_require__(9163); -const Entrypoint = __webpack_require__(13795); -const ErrorHelpers = __webpack_require__(59985); -const FileSystemInfo = __webpack_require__(79453); -const { - connectChunkGroupAndChunk, - connectChunkGroupParentAndChild -} = __webpack_require__(37234); -const { - makeWebpackError, - tryRunOrWebpackError -} = __webpack_require__(11351); -const MainTemplate = __webpack_require__(12856); -const Module = __webpack_require__(73208); -const ModuleDependencyError = __webpack_require__(67409); -const ModuleDependencyWarning = __webpack_require__(29656); -const ModuleGraph = __webpack_require__(99988); -const ModuleNotFoundError = __webpack_require__(32882); -const ModuleProfile = __webpack_require__(36418); -const ModuleRestoreError = __webpack_require__(94560); -const ModuleStoreError = __webpack_require__(59001); -const ModuleTemplate = __webpack_require__(62677); -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeTemplate = __webpack_require__(18777); -const Stats = __webpack_require__(31743); -const WebpackError = __webpack_require__(53799); -const buildChunkGraph = __webpack_require__(79233); -const BuildCycleError = __webpack_require__(22273); -const { Logger, LogType } = __webpack_require__(32597); -const StatsFactory = __webpack_require__(92629); -const StatsPrinter = __webpack_require__(30198); -const { equals: arrayEquals } = __webpack_require__(84953); -const AsyncQueue = __webpack_require__(12260); -const LazySet = __webpack_require__(38938); -const { provide } = __webpack_require__(82482); -const WeakTupleMap = __webpack_require__(28745); -const { cachedCleverMerge } = __webpack_require__(60839); -const { - compareLocations, - concatComparators, - compareSelect, - compareIds, - compareStringsNumeric, - compareModulesByIdentifier -} = __webpack_require__(29579); -const createHash = __webpack_require__(49835); -const { - arrayToSetDeprecation, - soonFrozenObjectDeprecation, - createFakeHook -} = __webpack_require__(64518); -const processAsyncTree = __webpack_require__(42791); -const { getRuntimeKey } = __webpack_require__(17156); -const { isSourceEqual } = __webpack_require__(41245); +const DllModule = __webpack_require__(28280); +const ModuleFactory = __webpack_require__(51010); -/** @template T @typedef {import("tapable").AsArray} AsArray */ -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescription */ -/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */ -/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */ -/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */ -/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */ -/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ -/** @typedef {import("./Cache")} Cache */ -/** @typedef {import("./CacheFacade")} CacheFacade */ -/** @typedef {import("./ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Compiler").CompilationParams} CompilationParams */ -/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("./Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("./DependencyTemplate")} DependencyTemplate */ -/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ -/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("./ModuleFactory")} ModuleFactory */ -/** @typedef {import("./ModuleFactory").ModuleFactoryCreateDataContextInfo} ModuleFactoryCreateDataContextInfo */ +/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ /** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./RuntimeModule")} RuntimeModule */ -/** @typedef {import("./Template").RenderManifestEntry} RenderManifestEntry */ -/** @typedef {import("./Template").RenderManifestOptions} RenderManifestOptions */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsError} StatsError */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModule} StatsModule */ -/** @typedef {import("./util/Hash")} Hash */ -/** @template T @typedef {import("./util/deprecation").FakeHook} FakeHook */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ +/** @typedef {import("./dependencies/DllEntryDependency")} DllEntryDependency */ -/** - * @callback Callback - * @param {(WebpackError | null)=} err - * @returns {void} - */ +class DllModuleFactory extends ModuleFactory { + constructor() { + super(); + this.hooks = Object.freeze({}); + } + /** + * @param {ModuleFactoryCreateData} data data object + * @param {function(Error=, ModuleFactoryResult=): void} callback callback + * @returns {void} + */ + create(data, callback) { + const dependency = /** @type {DllEntryDependency} */ (data.dependencies[0]); + callback(null, { + module: new DllModule( + data.context, + dependency.dependencies, + dependency.name + ) + }); + } +} -/** - * @callback ModuleCallback - * @param {(WebpackError | null)=} err - * @param {Module=} result - * @returns {void} - */ +module.exports = DllModuleFactory; -/** - * @callback ModuleFactoryResultCallback - * @param {(WebpackError | null)=} err - * @param {ModuleFactoryResult=} result - * @returns {void} - */ -/** - * @callback ModuleOrFactoryResultCallback - * @param {(WebpackError | null)=} err - * @param {Module | ModuleFactoryResult=} result - * @returns {void} - */ +/***/ }), -/** - * @callback ExecuteModuleCallback - * @param {(WebpackError | null)=} err - * @param {ExecuteModuleResult=} result - * @returns {void} - */ +/***/ 40038: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** - * @callback DepBlockVarDependenciesCallback - * @param {Dependency} dependency - * @returns {any} - */ +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/** @typedef {new (...args: any[]) => Dependency} DepConstructor */ -/** @typedef {Record} CompilationAssets */ -/** - * @typedef {Object} AvailableModulesChunkGroupMapping - * @property {ChunkGroup} chunkGroup - * @property {Set} availableModules - * @property {boolean} needCopy - */ -/** - * @typedef {Object} DependenciesBlockLike - * @property {Dependency[]} dependencies - * @property {AsyncDependenciesBlock[]} blocks - */ +const DllEntryPlugin = __webpack_require__(62790); +const FlagAllModulesAsUsedPlugin = __webpack_require__(58727); +const LibManifestPlugin = __webpack_require__(93837); +const createSchemaValidation = __webpack_require__(32540); -/** - * @typedef {Object} ChunkPathData - * @property {string|number} id - * @property {string=} name - * @property {string} hash - * @property {function(number): string=} hashWithLength - * @property {(Record)=} contentHash - * @property {(Record string>)=} contentHashWithLength - */ +/** @typedef {import("../declarations/plugins/DllPlugin").DllPluginOptions} DllPluginOptions */ +/** @typedef {import("./Compiler")} Compiler */ -/** - * @typedef {Object} ChunkHashContext - * @property {CodeGenerationResults} codeGenerationResults results of code generation - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - */ +const validate = createSchemaValidation( + __webpack_require__(9667), + () => __webpack_require__(99926), + { + name: "Dll Plugin", + baseDataPath: "options" + } +); -/** - * @typedef {Object} RuntimeRequirementsContext - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {CodeGenerationResults} codeGenerationResults the code generation results - */ +class DllPlugin { + /** + * @param {DllPluginOptions} options options object + */ + constructor(options) { + validate(options); + this.options = { + ...options, + entryOnly: options.entryOnly !== false + }; + } -/** - * @typedef {Object} ExecuteModuleOptions - * @property {EntryOptions=} entryOptions - */ + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.entryOption.tap("DllPlugin", (context, entry) => { + if (typeof entry !== "function") { + for (const name of Object.keys(entry)) { + const options = { + name, + filename: entry.filename + }; + new DllEntryPlugin(context, entry[name].import, options).apply( + compiler + ); + } + } else { + throw new Error( + "DllPlugin doesn't support dynamic entry (function) yet" + ); + } + return true; + }); + new LibManifestPlugin(this.options).apply(compiler); + if (!this.options.entryOnly) { + new FlagAllModulesAsUsedPlugin("DllPlugin").apply(compiler); + } + } +} -/** - * @typedef {Object} ExecuteModuleResult - * @property {any} exports - * @property {boolean} cacheable - * @property {Map} assets - * @property {LazySet} fileDependencies - * @property {LazySet} contextDependencies - * @property {LazySet} missingDependencies - * @property {LazySet} buildDependencies - */ +module.exports = DllPlugin; -/** - * @typedef {Object} ExecuteModuleArgument - * @property {Module} module - * @property {{ id: string, exports: any, loaded: boolean }=} moduleObject - * @property {any} preparedInfo - * @property {CodeGenerationResult} codeGenerationResult - */ -/** - * @typedef {Object} ExecuteModuleContext - * @property {Map} assets - * @property {Chunk} chunk - * @property {ChunkGraph} chunkGraph - * @property {function(string): any=} __webpack_require__ - */ +/***/ }), -/** - * @typedef {Object} EntryData - * @property {Dependency[]} dependencies dependencies of the entrypoint that should be evaluated at startup - * @property {Dependency[]} includeDependencies dependencies of the entrypoint that should be included but not evaluated - * @property {EntryOptions} options options of the entrypoint - */ +/***/ 90999: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** - * @typedef {Object} LogEntry - * @property {string} type - * @property {any[]} args - * @property {number} time - * @property {string[]=} trace - */ +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/** - * @typedef {Object} KnownAssetInfo - * @property {boolean=} immutable true, if the asset can be long term cached forever (contains a hash) - * @property {boolean=} minimized whether the asset is minimized - * @property {string | string[]=} fullhash the value(s) of the full hash used for this asset - * @property {string | string[]=} chunkhash the value(s) of the chunk hash used for this asset - * @property {string | string[]=} modulehash the value(s) of the module hash used for this asset - * @property {string | string[]=} contenthash the value(s) of the content hash used for this asset - * @property {string=} sourceFilename when asset was created from a source file (potentially transformed), the original filename relative to compilation context - * @property {number=} size size in bytes, only set after asset has been emitted - * @property {boolean=} development true, when asset is only used for development and doesn't count towards user-facing assets - * @property {boolean=} hotModuleReplacement true, when asset ships data for updating an existing application (HMR) - * @property {boolean=} javascriptModule true, when asset is javascript and an ESM - * @property {Record=} related object of pointers to other assets, keyed by type of relation (only points from parent to child) - */ -/** @typedef {KnownAssetInfo & Record} AssetInfo */ -/** - * @typedef {Object} Asset - * @property {string} name the filename of the asset - * @property {Source} source source of the asset - * @property {AssetInfo} info info about the asset - */ +const parseJson = __webpack_require__(15235); +const DelegatedModuleFactoryPlugin = __webpack_require__(51387); +const ExternalModuleFactoryPlugin = __webpack_require__(62153); +const WebpackError = __webpack_require__(53799); +const DelegatedSourceDependency = __webpack_require__(22914); +const createSchemaValidation = __webpack_require__(32540); +const makePathsRelative = (__webpack_require__(82186).makePathsRelative); -/** - * @typedef {Object} ModulePathData - * @property {string|number} id - * @property {string} hash - * @property {function(number): string=} hashWithLength - */ +/** @typedef {import("../declarations/WebpackOptions").Externals} Externals */ +/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptions} DllReferencePluginOptions */ +/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptionsManifest} DllReferencePluginOptionsManifest */ -/** - * @typedef {Object} PathData - * @property {ChunkGraph=} chunkGraph - * @property {string=} hash - * @property {function(number): string=} hashWithLength - * @property {(Chunk|ChunkPathData)=} chunk - * @property {(Module|ModulePathData)=} module - * @property {RuntimeSpec=} runtime - * @property {string=} filename - * @property {string=} basename - * @property {string=} query - * @property {string=} contentHashType - * @property {string=} contentHash - * @property {function(number): string=} contentHashWithLength - * @property {boolean=} noChunkHash - * @property {string=} url - */ +const validate = createSchemaValidation( + __webpack_require__(28534), + () => __webpack_require__(46552), + { + name: "Dll Reference Plugin", + baseDataPath: "options" + } +); -/** - * @typedef {Object} KnownNormalizedStatsOptions - * @property {string} context - * @property {RequestShortener} requestShortener - * @property {string} chunksSort - * @property {string} modulesSort - * @property {string} chunkModulesSort - * @property {string} nestedModulesSort - * @property {string} assetsSort - * @property {boolean} ids - * @property {boolean} cachedAssets - * @property {boolean} groupAssetsByEmitStatus - * @property {boolean} groupAssetsByPath - * @property {boolean} groupAssetsByExtension - * @property {number} assetsSpace - * @property {((value: string, asset: StatsAsset) => boolean)[]} excludeAssets - * @property {((name: string, module: StatsModule, type: "module" | "chunk" | "root-of-chunk" | "nested") => boolean)[]} excludeModules - * @property {((warning: StatsError, textValue: string) => boolean)[]} warningsFilter - * @property {boolean} cachedModules - * @property {boolean} orphanModules - * @property {boolean} dependentModules - * @property {boolean} runtimeModules - * @property {boolean} groupModulesByCacheStatus - * @property {boolean} groupModulesByLayer - * @property {boolean} groupModulesByAttributes - * @property {boolean} groupModulesByPath - * @property {boolean} groupModulesByExtension - * @property {boolean} groupModulesByType - * @property {boolean | "auto"} entrypoints - * @property {boolean} chunkGroups - * @property {boolean} chunkGroupAuxiliary - * @property {boolean} chunkGroupChildren - * @property {number} chunkGroupMaxAssets - * @property {number} modulesSpace - * @property {number} chunkModulesSpace - * @property {number} nestedModulesSpace - * @property {false|"none"|"error"|"warn"|"info"|"log"|"verbose"} logging - * @property {((value: string) => boolean)[]} loggingDebug - * @property {boolean} loggingTrace - * @property {any} _env - */ +class DllReferencePlugin { + /** + * @param {DllReferencePluginOptions} options options object + */ + constructor(options) { + validate(options); + this.options = options; + /** @type {WeakMap} */ + this._compilationData = new WeakMap(); + } -/** @typedef {KnownNormalizedStatsOptions & Omit & Record} NormalizedStatsOptions */ + apply(compiler) { + compiler.hooks.compilation.tap( + "DllReferencePlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + DelegatedSourceDependency, + normalModuleFactory + ); + } + ); -/** - * @typedef {Object} KnownCreateStatsOptionsContext - * @property {boolean=} forToString - */ + compiler.hooks.beforeCompile.tapAsync( + "DllReferencePlugin", + (params, callback) => { + if ("manifest" in this.options) { + const manifest = this.options.manifest; + if (typeof manifest === "string") { + compiler.inputFileSystem.readFile(manifest, (err, result) => { + if (err) return callback(err); + const data = { + path: manifest, + data: undefined, + error: undefined + }; + // Catch errors parsing the manifest so that blank + // or malformed manifest files don't kill the process. + try { + data.data = parseJson(result.toString("utf-8")); + } catch (e) { + // Store the error in the params so that it can + // be added as a compilation error later on. + const manifestPath = makePathsRelative( + compiler.options.context, + manifest, + compiler.root + ); + data.error = new DllManifestError(manifestPath, e.message); + } + this._compilationData.set(params, data); + return callback(); + }); + return; + } + } + return callback(); + } + ); -/** @typedef {KnownCreateStatsOptionsContext & Record} CreateStatsOptionsContext */ + compiler.hooks.compile.tap("DllReferencePlugin", params => { + let name = this.options.name; + let sourceType = this.options.sourceType; + let content = + "content" in this.options ? this.options.content : undefined; + if ("manifest" in this.options) { + let manifestParameter = this.options.manifest; + let manifest; + if (typeof manifestParameter === "string") { + const data = this._compilationData.get(params); + // If there was an error parsing the manifest + // file, exit now because the error will be added + // as a compilation error in the "compilation" hook. + if (data.error) { + return; + } + manifest = data.data; + } else { + manifest = manifestParameter; + } + if (manifest) { + if (!name) name = manifest.name; + if (!sourceType) sourceType = manifest.type; + if (!content) content = manifest.content; + } + } + /** @type {Externals} */ + const externals = {}; + const source = "dll-reference " + name; + externals[source] = name; + const normalModuleFactory = params.normalModuleFactory; + new ExternalModuleFactoryPlugin(sourceType || "var", externals).apply( + normalModuleFactory + ); + new DelegatedModuleFactoryPlugin({ + source: source, + type: this.options.type, + scope: this.options.scope, + context: this.options.context || compiler.options.context, + content, + extensions: this.options.extensions, + associatedObjectForCache: compiler.root + }).apply(normalModuleFactory); + }); -/** @type {AssetInfo} */ -const EMPTY_ASSET_INFO = Object.freeze({}); + compiler.hooks.compilation.tap( + "DllReferencePlugin", + (compilation, params) => { + if ("manifest" in this.options) { + let manifest = this.options.manifest; + if (typeof manifest === "string") { + const data = this._compilationData.get(params); + // If there was an error parsing the manifest file, add the + // error as a compilation error to make the compilation fail. + if (data.error) { + compilation.errors.push(data.error); + } + compilation.fileDependencies.add(manifest); + } + } + } + ); + } +} -const esmDependencyCategory = "esm"; -// TODO webpack 6: remove -const deprecatedNormalModuleLoaderHook = util.deprecate( - compilation => { - return (__webpack_require__(39).getCompilationHooks)(compilation).loader; - }, - "Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader", - "DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK" -); +class DllManifestError extends WebpackError { + constructor(filename, message) { + super(); -// TODO webpack 6: remove -const defineRemovedModuleTemplates = moduleTemplates => { - Object.defineProperties(moduleTemplates, { - asset: { - enumerable: false, - configurable: false, - get: () => { - throw new WebpackError( - "Compilation.moduleTemplates.asset has been removed" - ); - } - }, - webassembly: { - enumerable: false, - configurable: false, - get: () => { - throw new WebpackError( - "Compilation.moduleTemplates.webassembly has been removed" - ); - } - } - }); - moduleTemplates = undefined; -}; + this.name = "DllManifestError"; + this.message = `Dll manifest ${filename}\n${message}`; + } +} -const byId = compareSelect( - /** - * @param {Chunk} c chunk - * @returns {number | string} id - */ c => c.id, - compareIds -); +module.exports = DllReferencePlugin; -const byNameOrHash = concatComparators( - compareSelect( - /** - * @param {Compilation} c compilation - * @returns {string} name - */ - c => c.name, - compareIds - ), - compareSelect( - /** - * @param {Compilation} c compilation - * @returns {string} hash - */ c => c.fullHash, - compareIds - ) -); -const byMessage = compareSelect(err => `${err.message}`, compareStringsNumeric); +/***/ }), -const byModule = compareSelect( - err => (err.module && err.module.identifier()) || "", - compareStringsNumeric -); +/***/ 96475: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -const byLocation = compareSelect(err => err.loc, compareLocations); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Naoyuki Kanezawa @nkzawa +*/ -const compareErrors = concatComparators(byModule, byLocation, byMessage); -/** @type {WeakMap} */ -const unsafeCacheDependencies = new WeakMap(); -/** @type {WeakMap} */ -const unsafeCacheData = new WeakMap(); +const EntryOptionPlugin = __webpack_require__(9909); +const EntryPlugin = __webpack_require__(96953); +const EntryDependency = __webpack_require__(3979); -class Compilation { +/** @typedef {import("../declarations/WebpackOptions").EntryDynamicNormalized} EntryDynamic */ +/** @typedef {import("../declarations/WebpackOptions").EntryItem} EntryItem */ +/** @typedef {import("../declarations/WebpackOptions").EntryStaticNormalized} EntryStatic */ +/** @typedef {import("./Compiler")} Compiler */ + +class DynamicEntryPlugin { /** - * Creates an instance of Compilation. - * @param {Compiler} compiler the compiler which created the compilation - * @param {CompilationParams} params the compilation parameters + * @param {string} context the context path + * @param {EntryDynamic} entry the entry value */ - constructor(compiler, params) { - this._backCompat = compiler._backCompat; - - const getNormalModuleLoader = () => deprecatedNormalModuleLoaderHook(this); - /** @typedef {{ additionalAssets?: true | Function }} ProcessAssetsAdditionalOptions */ - /** @type {AsyncSeriesHook<[CompilationAssets], ProcessAssetsAdditionalOptions>} */ - const processAssetsHook = new AsyncSeriesHook(["assets"]); + constructor(context, entry) { + this.context = context; + this.entry = entry; + } - let savedAssets = new Set(); - const popNewAssets = assets => { - let newAssets = undefined; - for (const file of Object.keys(assets)) { - if (savedAssets.has(file)) continue; - if (newAssets === undefined) { - newAssets = Object.create(null); - } - newAssets[file] = assets[file]; - savedAssets.add(file); + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "DynamicEntryPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + EntryDependency, + normalModuleFactory + ); } - return newAssets; - }; - processAssetsHook.intercept({ - name: "Compilation", - call: () => { - savedAssets = new Set(Object.keys(this.assets)); - }, - register: tap => { - const { type, name } = tap; - const { fn, additionalAssets, ...remainingTap } = tap; - const additionalAssetsFn = - additionalAssets === true ? fn : additionalAssets; - const processedAssets = additionalAssetsFn ? new WeakSet() : undefined; - switch (type) { - case "sync": - if (additionalAssetsFn) { - this.hooks.processAdditionalAssets.tap(name, assets => { - if (processedAssets.has(this.assets)) - additionalAssetsFn(assets); - }); - } - return { - ...remainingTap, - type: "async", - fn: (assets, callback) => { - try { - fn(assets); - } catch (e) { - return callback(e); - } - if (processedAssets !== undefined) - processedAssets.add(this.assets); - const newAssets = popNewAssets(assets); - if (newAssets !== undefined) { - this.hooks.processAdditionalAssets.callAsync( - newAssets, - callback - ); - return; - } - callback(); - } - }; - case "async": - if (additionalAssetsFn) { - this.hooks.processAdditionalAssets.tapAsync( + ); + + compiler.hooks.make.tapPromise( + "DynamicEntryPlugin", + (compilation, callback) => + Promise.resolve(this.entry()) + .then(entry => { + const promises = []; + for (const name of Object.keys(entry)) { + const desc = entry[name]; + const options = EntryOptionPlugin.entryDescriptionToOptions( + compiler, name, - (assets, callback) => { - if (processedAssets.has(this.assets)) - return additionalAssetsFn(assets, callback); - callback(); - } + desc ); - } - return { - ...remainingTap, - fn: (assets, callback) => { - fn(assets, err => { - if (err) return callback(err); - if (processedAssets !== undefined) - processedAssets.add(this.assets); - const newAssets = popNewAssets(assets); - if (newAssets !== undefined) { - this.hooks.processAdditionalAssets.callAsync( - newAssets, - callback + for (const entry of desc.import) { + promises.push( + new Promise((resolve, reject) => { + compilation.addEntry( + this.context, + EntryPlugin.createDependency(entry, options), + options, + err => { + if (err) return reject(err); + resolve(); + } ); - return; - } - callback(); - }); + }) + ); } - }; - case "promise": - if (additionalAssetsFn) { - this.hooks.processAdditionalAssets.tapPromise(name, assets => { - if (processedAssets.has(this.assets)) - return additionalAssetsFn(assets); - return Promise.resolve(); - }); } - return { - ...remainingTap, - fn: assets => { - const p = fn(assets); - if (!p || !p.then) return p; - return p.then(() => { - if (processedAssets !== undefined) - processedAssets.add(this.assets); - const newAssets = popNewAssets(assets); - if (newAssets !== undefined) { - return this.hooks.processAdditionalAssets.promise( - newAssets - ); - } - }); - } - }; - } - } - }); - - /** @type {SyncHook<[CompilationAssets]>} */ - const afterProcessAssetsHook = new SyncHook(["assets"]); + return Promise.all(promises); + }) + .then(x => {}) + ); + } +} - /** - * @template T - * @param {string} name name of the hook - * @param {number} stage new stage - * @param {function(): AsArray} getArgs get old hook function args - * @param {string=} code deprecation code (not deprecated when unset) - * @returns {FakeHook, "tap" | "tapAsync" | "tapPromise" | "name">>} fake hook which redirects - */ - const createProcessAssetsHook = (name, stage, getArgs, code) => { - if (!this._backCompat && code) return undefined; - const errorMessage = - reason => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}. -BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`; - const getOptions = options => { - if (typeof options === "string") options = { name: options }; - if (options.stage) { - throw new Error(errorMessage("it's using the 'stage' option")); - } - return { ...options, stage: stage }; - }; - return createFakeHook( - { - name, - /** @type {AsyncSeriesHook["intercept"]} */ - intercept(interceptor) { - throw new Error(errorMessage("it's using 'intercept'")); - }, - /** @type {AsyncSeriesHook["tap"]} */ - tap: (options, fn) => { - processAssetsHook.tap(getOptions(options), () => fn(...getArgs())); - }, - /** @type {AsyncSeriesHook["tapAsync"]} */ - tapAsync: (options, fn) => { - processAssetsHook.tapAsync( - getOptions(options), - (assets, callback) => - /** @type {any} */ (fn)(...getArgs(), callback) - ); - }, - /** @type {AsyncSeriesHook["tapPromise"]} */ - tapPromise: (options, fn) => { - processAssetsHook.tapPromise(getOptions(options), () => - fn(...getArgs()) - ); - } - }, - `${name} is deprecated (use Compilation.hooks.processAssets instead and use one of Compilation.PROCESS_ASSETS_STAGE_* as stage option)`, - code - ); - }; - this.hooks = Object.freeze({ - /** @type {SyncHook<[Module]>} */ - buildModule: new SyncHook(["module"]), - /** @type {SyncHook<[Module]>} */ - rebuildModule: new SyncHook(["module"]), - /** @type {SyncHook<[Module, WebpackError]>} */ - failedModule: new SyncHook(["module", "error"]), - /** @type {SyncHook<[Module]>} */ - succeedModule: new SyncHook(["module"]), - /** @type {SyncHook<[Module]>} */ - stillValidModule: new SyncHook(["module"]), +module.exports = DynamicEntryPlugin; - /** @type {SyncHook<[Dependency, EntryOptions]>} */ - addEntry: new SyncHook(["entry", "options"]), - /** @type {SyncHook<[Dependency, EntryOptions, Error]>} */ - failedEntry: new SyncHook(["entry", "options", "error"]), - /** @type {SyncHook<[Dependency, EntryOptions, Module]>} */ - succeedEntry: new SyncHook(["entry", "options", "module"]), - /** @type {SyncWaterfallHook<[(string[] | ReferencedExport)[], Dependency, RuntimeSpec]>} */ - dependencyReferencedExports: new SyncWaterfallHook([ - "referencedExports", - "dependency", - "runtime" - ]), +/***/ }), - /** @type {SyncHook<[ExecuteModuleArgument, ExecuteModuleContext]>} */ - executeModule: new SyncHook(["options", "context"]), - /** @type {AsyncParallelHook<[ExecuteModuleArgument, ExecuteModuleContext]>} */ - prepareModuleExecution: new AsyncParallelHook(["options", "context"]), +/***/ 9909: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** @type {AsyncSeriesHook<[Iterable]>} */ - finishModules: new AsyncSeriesHook(["modules"]), - /** @type {AsyncSeriesHook<[Module]>} */ - finishRebuildingModule: new AsyncSeriesHook(["module"]), - /** @type {SyncHook<[]>} */ - unseal: new SyncHook([]), - /** @type {SyncHook<[]>} */ - seal: new SyncHook([]), +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** @type {SyncHook<[]>} */ - beforeChunks: new SyncHook([]), - /** @type {SyncHook<[Iterable]>} */ - afterChunks: new SyncHook(["chunks"]), - /** @type {SyncBailHook<[Iterable]>} */ - optimizeDependencies: new SyncBailHook(["modules"]), - /** @type {SyncHook<[Iterable]>} */ - afterOptimizeDependencies: new SyncHook(["modules"]), - /** @type {SyncHook<[]>} */ - optimize: new SyncHook([]), - /** @type {SyncBailHook<[Iterable]>} */ - optimizeModules: new SyncBailHook(["modules"]), - /** @type {SyncHook<[Iterable]>} */ - afterOptimizeModules: new SyncHook(["modules"]), +/** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescription */ +/** @typedef {import("../declarations/WebpackOptions").EntryNormalized} Entry */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ - /** @type {SyncBailHook<[Iterable, ChunkGroup[]]>} */ - optimizeChunks: new SyncBailHook(["chunks", "chunkGroups"]), - /** @type {SyncHook<[Iterable, ChunkGroup[]]>} */ - afterOptimizeChunks: new SyncHook(["chunks", "chunkGroups"]), +class EntryOptionPlugin { + /** + * @param {Compiler} compiler the compiler instance one is tapping into + * @returns {void} + */ + apply(compiler) { + compiler.hooks.entryOption.tap("EntryOptionPlugin", (context, entry) => { + EntryOptionPlugin.applyEntryOption(compiler, context, entry); + return true; + }); + } - /** @type {AsyncSeriesHook<[Iterable, Iterable]>} */ - optimizeTree: new AsyncSeriesHook(["chunks", "modules"]), - /** @type {SyncHook<[Iterable, Iterable]>} */ - afterOptimizeTree: new SyncHook(["chunks", "modules"]), + /** + * @param {Compiler} compiler the compiler + * @param {string} context context directory + * @param {Entry} entry request + * @returns {void} + */ + static applyEntryOption(compiler, context, entry) { + if (typeof entry === "function") { + const DynamicEntryPlugin = __webpack_require__(96475); + new DynamicEntryPlugin(context, entry).apply(compiler); + } else { + const EntryPlugin = __webpack_require__(96953); + for (const name of Object.keys(entry)) { + const desc = entry[name]; + const options = EntryOptionPlugin.entryDescriptionToOptions( + compiler, + name, + desc + ); + for (const entry of desc.import) { + new EntryPlugin(context, entry, options).apply(compiler); + } + } + } + } - /** @type {AsyncSeriesBailHook<[Iterable, Iterable]>} */ - optimizeChunkModules: new AsyncSeriesBailHook(["chunks", "modules"]), - /** @type {SyncHook<[Iterable, Iterable]>} */ - afterOptimizeChunkModules: new SyncHook(["chunks", "modules"]), - /** @type {SyncBailHook<[], boolean>} */ - shouldRecord: new SyncBailHook([]), + /** + * @param {Compiler} compiler the compiler + * @param {string} name entry name + * @param {EntryDescription} desc entry description + * @returns {EntryOptions} options for the entry + */ + static entryDescriptionToOptions(compiler, name, desc) { + /** @type {EntryOptions} */ + const options = { + name, + filename: desc.filename, + runtime: desc.runtime, + layer: desc.layer, + dependOn: desc.dependOn, + publicPath: desc.publicPath, + chunkLoading: desc.chunkLoading, + asyncChunks: desc.asyncChunks, + wasmLoading: desc.wasmLoading, + library: desc.library + }; + if (desc.layer !== undefined && !compiler.options.experiments.layers) { + throw new Error( + "'entryOptions.layer' is only allowed when 'experiments.layers' is enabled" + ); + } + if (desc.chunkLoading) { + const EnableChunkLoadingPlugin = __webpack_require__(61291); + EnableChunkLoadingPlugin.checkEnabled(compiler, desc.chunkLoading); + } + if (desc.wasmLoading) { + const EnableWasmLoadingPlugin = __webpack_require__(78613); + EnableWasmLoadingPlugin.checkEnabled(compiler, desc.wasmLoading); + } + if (desc.library) { + const EnableLibraryPlugin = __webpack_require__(91452); + EnableLibraryPlugin.checkEnabled(compiler, desc.library.type); + } + return options; + } +} - /** @type {SyncHook<[Chunk, Set, RuntimeRequirementsContext]>} */ - additionalChunkRuntimeRequirements: new SyncHook([ - "chunk", - "runtimeRequirements", - "context" - ]), - /** @type {HookMap, RuntimeRequirementsContext]>>} */ - runtimeRequirementInChunk: new HookMap( - () => new SyncBailHook(["chunk", "runtimeRequirements", "context"]) - ), - /** @type {SyncHook<[Module, Set, RuntimeRequirementsContext]>} */ - additionalModuleRuntimeRequirements: new SyncHook([ - "module", - "runtimeRequirements", - "context" - ]), - /** @type {HookMap, RuntimeRequirementsContext]>>} */ - runtimeRequirementInModule: new HookMap( - () => new SyncBailHook(["module", "runtimeRequirements", "context"]) - ), - /** @type {SyncHook<[Chunk, Set, RuntimeRequirementsContext]>} */ - additionalTreeRuntimeRequirements: new SyncHook([ - "chunk", - "runtimeRequirements", - "context" - ]), - /** @type {HookMap, RuntimeRequirementsContext]>>} */ - runtimeRequirementInTree: new HookMap( - () => new SyncBailHook(["chunk", "runtimeRequirements", "context"]) - ), +module.exports = EntryOptionPlugin; - /** @type {SyncHook<[RuntimeModule, Chunk]>} */ - runtimeModule: new SyncHook(["module", "chunk"]), - /** @type {SyncHook<[Iterable, any]>} */ - reviveModules: new SyncHook(["modules", "records"]), - /** @type {SyncHook<[Iterable]>} */ - beforeModuleIds: new SyncHook(["modules"]), - /** @type {SyncHook<[Iterable]>} */ - moduleIds: new SyncHook(["modules"]), - /** @type {SyncHook<[Iterable]>} */ - optimizeModuleIds: new SyncHook(["modules"]), - /** @type {SyncHook<[Iterable]>} */ - afterOptimizeModuleIds: new SyncHook(["modules"]), +/***/ }), - /** @type {SyncHook<[Iterable, any]>} */ - reviveChunks: new SyncHook(["chunks", "records"]), - /** @type {SyncHook<[Iterable]>} */ - beforeChunkIds: new SyncHook(["chunks"]), - /** @type {SyncHook<[Iterable]>} */ - chunkIds: new SyncHook(["chunks"]), - /** @type {SyncHook<[Iterable]>} */ - optimizeChunkIds: new SyncHook(["chunks"]), - /** @type {SyncHook<[Iterable]>} */ - afterOptimizeChunkIds: new SyncHook(["chunks"]), +/***/ 96953: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** @type {SyncHook<[Iterable, any]>} */ - recordModules: new SyncHook(["modules", "records"]), - /** @type {SyncHook<[Iterable, any]>} */ - recordChunks: new SyncHook(["chunks", "records"]), +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** @type {SyncHook<[Iterable]>} */ - optimizeCodeGeneration: new SyncHook(["modules"]), - /** @type {SyncHook<[]>} */ - beforeModuleHash: new SyncHook([]), - /** @type {SyncHook<[]>} */ - afterModuleHash: new SyncHook([]), - /** @type {SyncHook<[]>} */ - beforeCodeGeneration: new SyncHook([]), - /** @type {SyncHook<[]>} */ - afterCodeGeneration: new SyncHook([]), +const EntryDependency = __webpack_require__(3979); - /** @type {SyncHook<[]>} */ - beforeRuntimeRequirements: new SyncHook([]), - /** @type {SyncHook<[]>} */ - afterRuntimeRequirements: new SyncHook([]), +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ - /** @type {SyncHook<[]>} */ - beforeHash: new SyncHook([]), - /** @type {SyncHook<[Chunk]>} */ - contentHash: new SyncHook(["chunk"]), - /** @type {SyncHook<[]>} */ - afterHash: new SyncHook([]), - /** @type {SyncHook<[any]>} */ - recordHash: new SyncHook(["records"]), - /** @type {SyncHook<[Compilation, any]>} */ - record: new SyncHook(["compilation", "records"]), +class EntryPlugin { + /** + * An entry plugin which will handle + * creation of the EntryDependency + * + * @param {string} context context path + * @param {string} entry entry path + * @param {EntryOptions | string=} options entry options (passing a string is deprecated) + */ + constructor(context, entry, options) { + this.context = context; + this.entry = entry; + this.options = options || ""; + } - /** @type {SyncHook<[]>} */ - beforeModuleAssets: new SyncHook([]), - /** @type {SyncBailHook<[], boolean>} */ - shouldGenerateChunkAssets: new SyncBailHook([]), - /** @type {SyncHook<[]>} */ - beforeChunkAssets: new SyncHook([]), - // TODO webpack 6 remove - /** @deprecated */ - additionalChunkAssets: createProcessAssetsHook( - "additionalChunkAssets", - Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL, - () => [this.chunks], - "DEP_WEBPACK_COMPILATION_ADDITIONAL_CHUNK_ASSETS" - ), + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "EntryPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + EntryDependency, + normalModuleFactory + ); + } + ); - // TODO webpack 6 deprecate - /** @deprecated */ - additionalAssets: createProcessAssetsHook( - "additionalAssets", - Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL, - () => [] - ), - // TODO webpack 6 remove - /** @deprecated */ - optimizeChunkAssets: createProcessAssetsHook( - "optimizeChunkAssets", - Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE, - () => [this.chunks], - "DEP_WEBPACK_COMPILATION_OPTIMIZE_CHUNK_ASSETS" - ), - // TODO webpack 6 remove - /** @deprecated */ - afterOptimizeChunkAssets: createProcessAssetsHook( - "afterOptimizeChunkAssets", - Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE + 1, - () => [this.chunks], - "DEP_WEBPACK_COMPILATION_AFTER_OPTIMIZE_CHUNK_ASSETS" - ), - // TODO webpack 6 deprecate - /** @deprecated */ - optimizeAssets: processAssetsHook, - // TODO webpack 6 deprecate - /** @deprecated */ - afterOptimizeAssets: afterProcessAssetsHook, + const { entry, options, context } = this; + const dep = EntryPlugin.createDependency(entry, options); - processAssets: processAssetsHook, - afterProcessAssets: afterProcessAssetsHook, - /** @type {AsyncSeriesHook<[CompilationAssets]>} */ - processAdditionalAssets: new AsyncSeriesHook(["assets"]), + compiler.hooks.make.tapAsync("EntryPlugin", (compilation, callback) => { + compilation.addEntry(context, dep, options, err => { + callback(err); + }); + }); + } - /** @type {SyncBailHook<[], boolean>} */ - needAdditionalSeal: new SyncBailHook([]), - /** @type {AsyncSeriesHook<[]>} */ - afterSeal: new AsyncSeriesHook([]), + /** + * @param {string} entry entry request + * @param {EntryOptions | string} options entry options (passing string is deprecated) + * @returns {EntryDependency} the dependency + */ + static createDependency(entry, options) { + const dep = new EntryDependency(entry); + // TODO webpack 6 remove string option + dep.loc = { name: typeof options === "object" ? options.name : options }; + return dep; + } +} - /** @type {SyncWaterfallHook<[RenderManifestEntry[], RenderManifestOptions]>} */ - renderManifest: new SyncWaterfallHook(["result", "options"]), +module.exports = EntryPlugin; - /** @type {SyncHook<[Hash]>} */ - fullHash: new SyncHook(["hash"]), - /** @type {SyncHook<[Chunk, Hash, ChunkHashContext]>} */ - chunkHash: new SyncHook(["chunk", "chunkHash", "ChunkHashContext"]), - /** @type {SyncHook<[Module, string]>} */ - moduleAsset: new SyncHook(["module", "filename"]), - /** @type {SyncHook<[Chunk, string]>} */ - chunkAsset: new SyncHook(["chunk", "filename"]), +/***/ }), - /** @type {SyncWaterfallHook<[string, object, AssetInfo]>} */ - assetPath: new SyncWaterfallHook(["path", "options", "assetInfo"]), +/***/ 13795: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** @type {SyncBailHook<[], boolean>} */ - needAdditionalPass: new SyncBailHook([]), - - /** @type {SyncHook<[Compiler, string, number]>} */ - childCompiler: new SyncHook([ - "childCompiler", - "compilerName", - "compilerIndex" - ]), - - /** @type {SyncBailHook<[string, LogEntry], true>} */ - log: new SyncBailHook(["origin", "logEntry"]), - - /** @type {SyncWaterfallHook<[WebpackError[]]>} */ - processWarnings: new SyncWaterfallHook(["warnings"]), - /** @type {SyncWaterfallHook<[WebpackError[]]>} */ - processErrors: new SyncWaterfallHook(["errors"]), - - /** @type {HookMap, CreateStatsOptionsContext]>>} */ - statsPreset: new HookMap(() => new SyncHook(["options", "context"])), - /** @type {SyncHook<[Partial, CreateStatsOptionsContext]>} */ - statsNormalize: new SyncHook(["options", "context"]), - /** @type {SyncHook<[StatsFactory, NormalizedStatsOptions]>} */ - statsFactory: new SyncHook(["statsFactory", "options"]), - /** @type {SyncHook<[StatsPrinter, NormalizedStatsOptions]>} */ - statsPrinter: new SyncHook(["statsPrinter", "options"]), - - get normalModuleLoader() { - return getNormalModuleLoader(); - } - }); - /** @type {string=} */ - this.name = undefined; - this.startTime = undefined; - this.endTime = undefined; - /** @type {Compiler} */ - this.compiler = compiler; - this.resolverFactory = compiler.resolverFactory; - this.inputFileSystem = compiler.inputFileSystem; - this.fileSystemInfo = new FileSystemInfo(this.inputFileSystem, { - managedPaths: compiler.managedPaths, - immutablePaths: compiler.immutablePaths, - logger: this.getLogger("webpack.FileSystemInfo"), - hashFunction: compiler.options.output.hashFunction - }); - if (compiler.fileTimestamps) { - this.fileSystemInfo.addFileTimestamps(compiler.fileTimestamps, true); - } - if (compiler.contextTimestamps) { - this.fileSystemInfo.addContextTimestamps( - compiler.contextTimestamps, - true - ); - } - /** @type {Map>} */ - this.valueCacheVersions = new Map(); - this.requestShortener = compiler.requestShortener; - this.compilerPath = compiler.compilerPath; - - this.logger = this.getLogger("webpack.Compilation"); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - const options = compiler.options; - this.options = options; - this.outputOptions = options && options.output; - /** @type {boolean} */ - this.bail = (options && options.bail) || false; - /** @type {boolean} */ - this.profile = (options && options.profile) || false; - this.params = params; - this.mainTemplate = new MainTemplate(this.outputOptions, this); - this.chunkTemplate = new ChunkTemplate(this.outputOptions, this); - this.runtimeTemplate = new RuntimeTemplate( - this, - this.outputOptions, - this.requestShortener - ); - /** @type {{javascript: ModuleTemplate}} */ - this.moduleTemplates = { - javascript: new ModuleTemplate(this.runtimeTemplate, this) - }; - defineRemovedModuleTemplates(this.moduleTemplates); - /** @type {Map> | undefined} */ - this.moduleMemCaches = undefined; - /** @type {Map> | undefined} */ - this.moduleMemCaches2 = undefined; - this.moduleGraph = new ModuleGraph(); - /** @type {ChunkGraph} */ - this.chunkGraph = undefined; - /** @type {CodeGenerationResults} */ - this.codeGenerationResults = undefined; +const ChunkGroup = __webpack_require__(15626); - /** @type {AsyncQueue} */ - this.processDependenciesQueue = new AsyncQueue({ - name: "processDependencies", - parallelism: options.parallelism || 100, - processor: this._processModuleDependencies.bind(this) - }); - /** @type {AsyncQueue} */ - this.addModuleQueue = new AsyncQueue({ - name: "addModule", - parent: this.processDependenciesQueue, - getKey: module => module.identifier(), - processor: this._addModule.bind(this) - }); - /** @type {AsyncQueue} */ - this.factorizeQueue = new AsyncQueue({ - name: "factorize", - parent: this.addModuleQueue, - processor: this._factorizeModule.bind(this) - }); - /** @type {AsyncQueue} */ - this.buildQueue = new AsyncQueue({ - name: "build", - parent: this.factorizeQueue, - processor: this._buildModule.bind(this) - }); - /** @type {AsyncQueue} */ - this.rebuildQueue = new AsyncQueue({ - name: "rebuild", - parallelism: options.parallelism || 100, - processor: this._rebuildModule.bind(this) - }); +/** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescription */ +/** @typedef {import("./Chunk")} Chunk */ - /** - * Modules in value are building during the build of Module in key. - * Means value blocking key from finishing. - * Needed to detect build cycles. - * @type {WeakMap>} - */ - this.creatingModuleDuringBuild = new WeakMap(); +/** @typedef {{ name?: string } & Omit} EntryOptions */ - /** @type {Map} */ - this.entries = new Map(); - /** @type {EntryData} */ - this.globalEntry = { - dependencies: [], - includeDependencies: [], - options: { - name: undefined - } - }; - /** @type {Map} */ - this.entrypoints = new Map(); - /** @type {Entrypoint[]} */ - this.asyncEntrypoints = []; - /** @type {Set} */ - this.chunks = new Set(); - /** @type {ChunkGroup[]} */ - this.chunkGroups = []; - /** @type {Map} */ - this.namedChunkGroups = new Map(); - /** @type {Map} */ - this.namedChunks = new Map(); - /** @type {Set} */ - this.modules = new Set(); - if (this._backCompat) { - arrayToSetDeprecation(this.chunks, "Compilation.chunks"); - arrayToSetDeprecation(this.modules, "Compilation.modules"); +/** + * Entrypoint serves as an encapsulation primitive for chunks that are + * a part of a single ChunkGroup. They represent all bundles that need to be loaded for a + * single instance of a page. Multi-page application architectures will typically yield multiple Entrypoint objects + * inside of the compilation, whereas a Single Page App may only contain one with many lazy-loaded chunks. + */ +class Entrypoint extends ChunkGroup { + /** + * Creates an instance of Entrypoint. + * @param {EntryOptions | string} entryOptions the options for the entrypoint (or name) + * @param {boolean=} initial false, when the entrypoint is not initial loaded + */ + constructor(entryOptions, initial = true) { + if (typeof entryOptions === "string") { + entryOptions = { name: entryOptions }; } - /** @private @type {Map} */ - this._modules = new Map(); - this.records = null; - /** @type {string[]} */ - this.additionalChunkAssets = []; - /** @type {CompilationAssets} */ - this.assets = {}; - /** @type {Map} */ - this.assetsInfo = new Map(); - /** @type {Map>>} */ - this._assetsRelatedIn = new Map(); - /** @type {WebpackError[]} */ - this.errors = []; - /** @type {WebpackError[]} */ - this.warnings = []; - /** @type {Compilation[]} */ - this.children = []; - /** @type {Map} */ - this.logging = new Map(); - /** @type {Map} */ - this.dependencyFactories = new Map(); - /** @type {DependencyTemplates} */ - this.dependencyTemplates = new DependencyTemplates( - this.outputOptions.hashFunction - ); - this.childrenCounters = {}; - /** @type {Set} */ - this.usedChunkIds = null; - /** @type {Set} */ - this.usedModuleIds = null; + super({ + name: entryOptions.name + }); + this.options = entryOptions; + /** @type {Chunk=} */ + this._runtimeChunk = undefined; + /** @type {Chunk=} */ + this._entrypointChunk = undefined; /** @type {boolean} */ - this.needAdditionalPass = false; - /** @type {Set} */ - this._restoredUnsafeCacheModuleEntries = new Set(); - /** @type {Map} */ - this._restoredUnsafeCacheEntries = new Map(); - /** @type {WeakSet} */ - this.builtModules = new WeakSet(); - /** @type {WeakSet} */ - this.codeGeneratedModules = new WeakSet(); - /** @type {WeakSet} */ - this.buildTimeExecutedModules = new WeakSet(); - /** @private @type {Map} */ - this._rebuildingModules = new Map(); - /** @type {Set} */ - this.emittedAssets = new Set(); - /** @type {Set} */ - this.comparedForEmitAssets = new Set(); - /** @type {LazySet} */ - this.fileDependencies = new LazySet(); - /** @type {LazySet} */ - this.contextDependencies = new LazySet(); - /** @type {LazySet} */ - this.missingDependencies = new LazySet(); - /** @type {LazySet} */ - this.buildDependencies = new LazySet(); - // TODO webpack 6 remove - this.compilationDependencies = { - add: util.deprecate( - item => this.fileDependencies.add(item), - "Compilation.compilationDependencies is deprecated (used Compilation.fileDependencies instead)", - "DEP_WEBPACK_COMPILATION_COMPILATION_DEPENDENCIES" - ) - }; - - this._modulesCache = this.getCache("Compilation/modules"); - this._assetsCache = this.getCache("Compilation/assets"); - this._codeGenerationCache = this.getCache("Compilation/codeGeneration"); - - const unsafeCache = options.module.unsafeCache; - this._unsafeCache = !!unsafeCache; - this._unsafeCachePredicate = - typeof unsafeCache === "function" ? unsafeCache : () => true; - } - - getStats() { - return new Stats(this); + this._initial = initial; } /** - * @param {StatsOptions | string} optionsOrPreset stats option value - * @param {CreateStatsOptionsContext} context context - * @returns {NormalizedStatsOptions} normalized options + * @returns {boolean} true, when this chunk group will be loaded on initial page load */ - createStatsOptions(optionsOrPreset, context = {}) { - if ( - typeof optionsOrPreset === "boolean" || - typeof optionsOrPreset === "string" - ) { - optionsOrPreset = { preset: optionsOrPreset }; - } - if (typeof optionsOrPreset === "object" && optionsOrPreset !== null) { - // We use this method of shallow cloning this object to include - // properties in the prototype chain - /** @type {Partial} */ - const options = {}; - for (const key in optionsOrPreset) { - options[key] = optionsOrPreset[key]; - } - if (options.preset !== undefined) { - this.hooks.statsPreset.for(options.preset).call(options, context); - } - this.hooks.statsNormalize.call(options, context); - return /** @type {NormalizedStatsOptions} */ (options); - } else { - /** @type {Partial} */ - const options = {}; - this.hooks.statsNormalize.call(options, context); - return /** @type {NormalizedStatsOptions} */ (options); - } - } - - createStatsFactory(options) { - const statsFactory = new StatsFactory(); - this.hooks.statsFactory.call(statsFactory, options); - return statsFactory; - } - - createStatsPrinter(options) { - const statsPrinter = new StatsPrinter(); - this.hooks.statsPrinter.call(statsPrinter, options); - return statsPrinter; + isInitial() { + return this._initial; } /** - * @param {string} name cache name - * @returns {CacheFacade} the cache facade instance + * Sets the runtimeChunk for an entrypoint. + * @param {Chunk} chunk the chunk being set as the runtime chunk. + * @returns {void} */ - getCache(name) { - return this.compiler.getCache(name); + setRuntimeChunk(chunk) { + this._runtimeChunk = chunk; } /** - * @param {string | (function(): string)} name name of the logger, or function called once to get the logger name - * @returns {Logger} a logger with that name + * Fetches the chunk reference containing the webpack bootstrap code + * @returns {Chunk | null} returns the runtime chunk or null if there is none */ - getLogger(name) { - if (!name) { - throw new TypeError("Compilation.getLogger(name) called without a name"); + getRuntimeChunk() { + if (this._runtimeChunk) return this._runtimeChunk; + for (const parent of this.parentsIterable) { + if (parent instanceof Entrypoint) return parent.getRuntimeChunk(); } - /** @type {LogEntry[] | undefined} */ - let logEntries; - return new Logger( - (type, args) => { - if (typeof name === "function") { - name = name(); - if (!name) { - throw new TypeError( - "Compilation.getLogger(name) called with a function not returning a name" - ); - } - } - let trace; - switch (type) { - case LogType.warn: - case LogType.error: - case LogType.trace: - trace = ErrorHelpers.cutOffLoaderExecution(new Error("Trace").stack) - .split("\n") - .slice(3); - break; - } - /** @type {LogEntry} */ - const logEntry = { - time: Date.now(), - type, - args, - trace - }; - if (this.hooks.log.call(name, logEntry) === undefined) { - if (logEntry.type === LogType.profileEnd) { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - if (typeof console.profileEnd === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.profileEnd(`[${name}] ${logEntry.args[0]}`); - } - } - if (logEntries === undefined) { - logEntries = this.logging.get(name); - if (logEntries === undefined) { - logEntries = []; - this.logging.set(name, logEntries); - } - } - logEntries.push(logEntry); - if (logEntry.type === LogType.profile) { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - if (typeof console.profile === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.profile(`[${name}] ${logEntry.args[0]}`); - } - } - } - }, - childName => { - if (typeof name === "function") { - if (typeof childName === "function") { - return this.getLogger(() => { - if (typeof name === "function") { - name = name(); - if (!name) { - throw new TypeError( - "Compilation.getLogger(name) called with a function not returning a name" - ); - } - } - if (typeof childName === "function") { - childName = childName(); - if (!childName) { - throw new TypeError( - "Logger.getChildLogger(name) called with a function not returning a name" - ); - } - } - return `${name}/${childName}`; - }); - } else { - return this.getLogger(() => { - if (typeof name === "function") { - name = name(); - if (!name) { - throw new TypeError( - "Compilation.getLogger(name) called with a function not returning a name" - ); - } - } - return `${name}/${childName}`; - }); - } - } else { - if (typeof childName === "function") { - return this.getLogger(() => { - if (typeof childName === "function") { - childName = childName(); - if (!childName) { - throw new TypeError( - "Logger.getChildLogger(name) called with a function not returning a name" - ); - } - } - return `${name}/${childName}`; - }); - } else { - return this.getLogger(`${name}/${childName}`); - } - } - } - ); + return null; } /** - * @param {Module} module module to be added that was created - * @param {ModuleCallback} callback returns the module in the compilation, - * it could be the passed one (if new), or an already existing in the compilation + * Sets the chunk with the entrypoint modules for an entrypoint. + * @param {Chunk} chunk the chunk being set as the entrypoint chunk. * @returns {void} */ - addModule(module, callback) { - this.addModuleQueue.add(module, callback); + setEntrypointChunk(chunk) { + this._entrypointChunk = chunk; } /** - * @param {Module} module module to be added that was created - * @param {ModuleCallback} callback returns the module in the compilation, - * it could be the passed one (if new), or an already existing in the compilation - * @returns {void} + * Returns the chunk which contains the entrypoint modules + * (or at least the execution of them) + * @returns {Chunk} chunk */ - _addModule(module, callback) { - const identifier = module.identifier(); - const alreadyAddedModule = this._modules.get(identifier); - if (alreadyAddedModule) { - return callback(null, alreadyAddedModule); - } - - const currentProfile = this.profile - ? this.moduleGraph.getProfile(module) - : undefined; - if (currentProfile !== undefined) { - currentProfile.markRestoringStart(); - } - - this._modulesCache.get(identifier, null, (err, cacheModule) => { - if (err) return callback(new ModuleRestoreError(module, err)); - - if (currentProfile !== undefined) { - currentProfile.markRestoringEnd(); - currentProfile.markIntegrationStart(); - } - - if (cacheModule) { - cacheModule.updateCacheModule(module); - - module = cacheModule; - } - this._modules.set(identifier, module); - this.modules.add(module); - if (this._backCompat) - ModuleGraph.setModuleGraphForModule(module, this.moduleGraph); - if (currentProfile !== undefined) { - currentProfile.markIntegrationEnd(); - } - callback(null, module); - }); + getEntrypointChunk() { + return this._entrypointChunk; } /** - * Fetches a module from a compilation by its identifier - * @param {Module} module the module provided - * @returns {Module} the module requested + * @param {Chunk} oldChunk chunk to be replaced + * @param {Chunk} newChunk New chunk that will be replaced with + * @returns {boolean} returns true if the replacement was successful */ - getModule(module) { - const identifier = module.identifier(); - return this._modules.get(identifier); + replaceChunk(oldChunk, newChunk) { + if (this._runtimeChunk === oldChunk) this._runtimeChunk = newChunk; + if (this._entrypointChunk === oldChunk) this._entrypointChunk = newChunk; + return super.replaceChunk(oldChunk, newChunk); } +} - /** - * Attempts to search for a module by its identifier - * @param {string} identifier identifier (usually path) for module - * @returns {Module|undefined} attempt to search for module and return it, else undefined - */ - findModule(identifier) { - return this._modules.get(identifier); - } +module.exports = Entrypoint; - /** - * Schedules a build of the module object - * - * @param {Module} module module to be built - * @param {ModuleCallback} callback the callback - * @returns {void} - */ - buildModule(module, callback) { - this.buildQueue.add(module, callback); - } - /** - * Builds the module object - * - * @param {Module} module module to be built - * @param {ModuleCallback} callback the callback - * @returns {void} - */ - _buildModule(module, callback) { - const currentProfile = this.profile - ? this.moduleGraph.getProfile(module) - : undefined; - if (currentProfile !== undefined) { - currentProfile.markBuildingStart(); - } +/***/ }), - module.needBuild( - { - compilation: this, - fileSystemInfo: this.fileSystemInfo, - valueCacheVersions: this.valueCacheVersions - }, - (err, needBuild) => { - if (err) return callback(err); +/***/ 22070: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (!needBuild) { - if (currentProfile !== undefined) { - currentProfile.markBuildingEnd(); - } - this.hooks.stillValidModule.call(module); - return callback(); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Authors Simen Brekken @simenbrekken, Einar Löve @einarlove +*/ - this.hooks.buildModule.call(module); - this.builtModules.add(module); - module.build( - this.options, - this, - this.resolverFactory.get("normal", module.resolveOptions), - this.inputFileSystem, - err => { - if (currentProfile !== undefined) { - currentProfile.markBuildingEnd(); - } - if (err) { - this.hooks.failedModule.call(module, err); - return callback(err); - } - if (currentProfile !== undefined) { - currentProfile.markStoringStart(); - } - this._modulesCache.store(module.identifier(), null, module, err => { - if (currentProfile !== undefined) { - currentProfile.markStoringEnd(); - } - if (err) { - this.hooks.failedModule.call(module, err); - return callback(new ModuleStoreError(module, err)); - } - this.hooks.succeedModule.call(module); - return callback(); - }); - } - ); - } - ); - } - /** - * @param {Module} module to be processed for deps - * @param {ModuleCallback} callback callback to be triggered - * @returns {void} - */ - processModuleDependencies(module, callback) { - this.processDependenciesQueue.add(module, callback); - } - /** - * @param {Module} module to be processed for deps - * @returns {void} - */ - processModuleDependenciesNonRecursive(module) { - const processDependenciesBlock = block => { - if (block.dependencies) { - let i = 0; - for (const dep of block.dependencies) { - this.moduleGraph.setParents(dep, block, module, i++); - } - } - if (block.blocks) { - for (const b of block.blocks) processDependenciesBlock(b); - } - }; +const DefinePlugin = __webpack_require__(79065); +const WebpackError = __webpack_require__(53799); - processDependenciesBlock(module); +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./DefinePlugin").CodeValue} CodeValue */ + +class EnvironmentPlugin { + constructor(...keys) { + if (keys.length === 1 && Array.isArray(keys[0])) { + this.keys = keys[0]; + this.defaultValues = {}; + } else if (keys.length === 1 && keys[0] && typeof keys[0] === "object") { + this.keys = Object.keys(keys[0]); + this.defaultValues = keys[0]; + } else { + this.keys = keys; + this.defaultValues = {}; + } } /** - * @param {Module} module to be processed for deps - * @param {ModuleCallback} callback callback to be triggered + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - _processModuleDependencies(module, callback) { - /** @type {Array<{factory: ModuleFactory, dependencies: Dependency[], originModule: Module|null}>} */ - const sortedDependencies = []; + apply(compiler) { + /** @type {Record} */ + const definitions = {}; + for (const key of this.keys) { + const value = + process.env[key] !== undefined + ? process.env[key] + : this.defaultValues[key]; - /** @type {DependenciesBlock} */ - let currentBlock; + if (value === undefined) { + compiler.hooks.thisCompilation.tap("EnvironmentPlugin", compilation => { + const error = new WebpackError( + `EnvironmentPlugin - ${key} environment variable is undefined.\n\n` + + "You can pass an object with default values to suppress this warning.\n" + + "See https://webpack.js.org/plugins/environment-plugin for example." + ); - /** @type {Map>} */ - let dependencies; - /** @type {DepConstructor} */ - let factoryCacheKey; - /** @type {ModuleFactory} */ - let factoryCacheKey2; - /** @type {Map} */ - let factoryCacheValue; - /** @type {string} */ - let listCacheKey1; - /** @type {string} */ - let listCacheKey2; - /** @type {Dependency[]} */ - let listCacheValue; + error.name = "EnvVariableNotDefinedError"; + compilation.errors.push(error); + }); + } - let inProgressSorting = 1; - let inProgressTransitive = 1; + definitions[`process.env.${key}`] = + value === undefined ? "undefined" : JSON.stringify(value); + } - const onDependenciesSorted = err => { - if (err) return callback(err); + new DefinePlugin(definitions).apply(compiler); + } +} - // early exit without changing parallelism back and forth - if (sortedDependencies.length === 0 && inProgressTransitive === 1) { - return callback(); - } +module.exports = EnvironmentPlugin; - // This is nested so we need to allow one additional task - this.processDependenciesQueue.increaseParallelism(); - for (const item of sortedDependencies) { - inProgressTransitive++; - this.handleModuleCreation(item, err => { - // In V8, the Error objects keep a reference to the functions on the stack. These warnings & - // errors are created inside closures that keep a reference to the Compilation, so errors are - // leaking the Compilation object. - if (err && this.bail) { - if (inProgressTransitive <= 0) return; - inProgressTransitive = -1; - // eslint-disable-next-line no-self-assign - err.stack = err.stack; - onTransitiveTasksFinished(err); - return; - } - if (--inProgressTransitive === 0) onTransitiveTasksFinished(); - }); - } - if (--inProgressTransitive === 0) onTransitiveTasksFinished(); - }; +/***/ }), - const onTransitiveTasksFinished = err => { - if (err) return callback(err); - this.processDependenciesQueue.decreaseParallelism(); +/***/ 59985: +/***/ (function(__unused_webpack_module, exports) { - return callback(); - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {Dependency} dep dependency - * @param {number} index index in block - * @returns {void} - */ - const processDependency = (dep, index) => { - this.moduleGraph.setParents(dep, currentBlock, module, index); - if (this._unsafeCache) { - try { - const unsafeCachedModule = unsafeCacheDependencies.get(dep); - if (unsafeCachedModule === null) return; - if (unsafeCachedModule !== undefined) { - if ( - this._restoredUnsafeCacheModuleEntries.has(unsafeCachedModule) - ) { - this._handleExistingModuleFromUnsafeCache( - module, - dep, - unsafeCachedModule - ); - return; - } - const identifier = unsafeCachedModule.identifier(); - const cachedModule = - this._restoredUnsafeCacheEntries.get(identifier); - if (cachedModule !== undefined) { - // update unsafe cache to new module - unsafeCacheDependencies.set(dep, cachedModule); - this._handleExistingModuleFromUnsafeCache( - module, - dep, - cachedModule - ); - return; - } - inProgressSorting++; - this._modulesCache.get(identifier, null, (err, cachedModule) => { - if (err) { - if (inProgressSorting <= 0) return; - inProgressSorting = -1; - onDependenciesSorted(err); - return; - } - try { - if (!this._restoredUnsafeCacheEntries.has(identifier)) { - const data = unsafeCacheData.get(cachedModule); - if (data === undefined) { - processDependencyForResolving(dep); - if (--inProgressSorting === 0) onDependenciesSorted(); - return; - } - if (cachedModule !== unsafeCachedModule) { - unsafeCacheDependencies.set(dep, cachedModule); - } - cachedModule.restoreFromUnsafeCache( - data, - this.params.normalModuleFactory, - this.params - ); - this._restoredUnsafeCacheEntries.set( - identifier, - cachedModule - ); - this._restoredUnsafeCacheModuleEntries.add(cachedModule); - if (!this.modules.has(cachedModule)) { - inProgressTransitive++; - this._handleNewModuleFromUnsafeCache( - module, - dep, - cachedModule, - err => { - if (err) { - if (inProgressTransitive <= 0) return; - inProgressTransitive = -1; - onTransitiveTasksFinished(err); - } - if (--inProgressTransitive === 0) - return onTransitiveTasksFinished(); - } - ); - if (--inProgressSorting === 0) onDependenciesSorted(); - return; - } - } - if (unsafeCachedModule !== cachedModule) { - unsafeCacheDependencies.set(dep, cachedModule); - } - this._handleExistingModuleFromUnsafeCache( - module, - dep, - cachedModule - ); // a3 - } catch (err) { - if (inProgressSorting <= 0) return; - inProgressSorting = -1; - onDependenciesSorted(err); - return; - } - if (--inProgressSorting === 0) onDependenciesSorted(); - }); - return; - } - } catch (e) { - console.error(e); - } - } - processDependencyForResolving(dep); - }; - /** - * @param {Dependency} dep dependency - * @returns {void} - */ - const processDependencyForResolving = dep => { - const resourceIdent = dep.getResourceIdentifier(); - if (resourceIdent !== undefined && resourceIdent !== null) { - const category = dep.category; - const constructor = /** @type {DepConstructor} */ (dep.constructor); - if (factoryCacheKey === constructor) { - // Fast path 1: same constructor as prev item - if (listCacheKey1 === category && listCacheKey2 === resourceIdent) { - // Super fast path 1: also same resource - listCacheValue.push(dep); - return; - } - } else { - const factory = this.dependencyFactories.get(constructor); - if (factory === undefined) { - throw new Error( - `No module factory available for dependency type: ${constructor.name}` - ); - } - if (factoryCacheKey2 === factory) { - // Fast path 2: same factory as prev item - factoryCacheKey = constructor; - if (listCacheKey1 === category && listCacheKey2 === resourceIdent) { - // Super fast path 2: also same resource - listCacheValue.push(dep); - return; - } - } else { - // Slow path - if (factoryCacheKey2 !== undefined) { - // Archive last cache entry - if (dependencies === undefined) dependencies = new Map(); - dependencies.set(factoryCacheKey2, factoryCacheValue); - factoryCacheValue = dependencies.get(factory); - if (factoryCacheValue === undefined) { - factoryCacheValue = new Map(); - } - } else { - factoryCacheValue = new Map(); - } - factoryCacheKey = constructor; - factoryCacheKey2 = factory; - } - } - // Here webpack is using heuristic that assumes - // mostly esm dependencies would be used - // so we don't allocate extra string for them - const cacheKey = - category === esmDependencyCategory - ? resourceIdent - : `${category}${resourceIdent}`; - let list = factoryCacheValue.get(cacheKey); - if (list === undefined) { - factoryCacheValue.set(cacheKey, (list = [])); - sortedDependencies.push({ - factory: factoryCacheKey2, - dependencies: list, - originModule: module - }); - } - list.push(dep); - listCacheKey1 = category; - listCacheKey2 = resourceIdent; - listCacheValue = list; - } - }; - try { - /** @type {DependenciesBlock[]} */ - const queue = [module]; - do { - const block = queue.pop(); - if (block.dependencies) { - currentBlock = block; - let i = 0; - for (const dep of block.dependencies) processDependency(dep, i++); - } - if (block.blocks) { - for (const b of block.blocks) queue.push(b); - } - } while (queue.length !== 0); - } catch (e) { - return callback(e); - } +const loaderFlag = "LOADER_EXECUTION"; - if (--inProgressSorting === 0) onDependenciesSorted(); +const webpackOptionsFlag = "WEBPACK_OPTIONS"; + +exports.cutOffByFlag = (stack, flag) => { + stack = stack.split("\n"); + for (let i = 0; i < stack.length; i++) { + if (stack[i].includes(flag)) { + stack.length = i; + } } + return stack.join("\n"); +}; - _handleNewModuleFromUnsafeCache(originModule, dependency, module, callback) { - const moduleGraph = this.moduleGraph; +exports.cutOffLoaderExecution = stack => + exports.cutOffByFlag(stack, loaderFlag); - moduleGraph.setResolvedModule(originModule, dependency, module); +exports.cutOffWebpackOptions = stack => + exports.cutOffByFlag(stack, webpackOptionsFlag); - moduleGraph.setIssuerIfUnset( - module, - originModule !== undefined ? originModule : null - ); +exports.cutOffMultilineMessage = (stack, message) => { + stack = stack.split("\n"); + message = message.split("\n"); - this._modules.set(module.identifier(), module); - this.modules.add(module); - if (this._backCompat) - ModuleGraph.setModuleGraphForModule(module, this.moduleGraph); + const result = []; - this._handleModuleBuildAndDependencies( - originModule, - module, - true, - callback - ); - } + stack.forEach((line, idx) => { + if (!line.includes(message[idx])) result.push(line); + }); - _handleExistingModuleFromUnsafeCache(originModule, dependency, module) { - const moduleGraph = this.moduleGraph; + return result.join("\n"); +}; - moduleGraph.setResolvedModule(originModule, dependency, module); +exports.cutOffMessage = (stack, message) => { + const nextLine = stack.indexOf("\n"); + if (nextLine === -1) { + return stack === message ? "" : stack; + } else { + const firstLine = stack.substr(0, nextLine); + return firstLine === message ? stack.substr(nextLine + 1) : stack; } +}; - /** - * @typedef {Object} HandleModuleCreationOptions - * @property {ModuleFactory} factory - * @property {Dependency[]} dependencies - * @property {Module | null} originModule - * @property {Partial=} contextInfo - * @property {string=} context - * @property {boolean=} recursive recurse into dependencies of the created module - * @property {boolean=} connectOrigin connect the resolved module with the origin module - */ +exports.cleanUp = (stack, message) => { + stack = exports.cutOffLoaderExecution(stack); + stack = exports.cutOffMessage(stack, message); + return stack; +}; - /** - * @param {HandleModuleCreationOptions} options options object - * @param {ModuleCallback} callback callback - * @returns {void} - */ - handleModuleCreation( - { - factory, - dependencies, - originModule, - contextInfo, - context, - recursive = true, - connectOrigin = recursive - }, - callback - ) { - const moduleGraph = this.moduleGraph; +exports.cleanUpWebpackOptions = (stack, message) => { + stack = exports.cutOffWebpackOptions(stack); + stack = exports.cutOffMultilineMessage(stack, message); + return stack; +}; - const currentProfile = this.profile ? new ModuleProfile() : undefined; - this.factorizeModule( - { - currentProfile, - factory, - dependencies, - factoryResult: true, - originModule, - contextInfo, - context - }, - (err, factoryResult) => { - const applyFactoryResultDependencies = () => { - const { fileDependencies, contextDependencies, missingDependencies } = - factoryResult; - if (fileDependencies) { - this.fileDependencies.addAll(fileDependencies); - } - if (contextDependencies) { - this.contextDependencies.addAll(contextDependencies); - } - if (missingDependencies) { - this.missingDependencies.addAll(missingDependencies); - } - }; - if (err) { - if (factoryResult) applyFactoryResultDependencies(); - if (dependencies.every(d => d.optional)) { - this.warnings.push(err); - return callback(); - } else { - this.errors.push(err); - return callback(err); - } - } +/***/ }), - const newModule = factoryResult.module; +/***/ 65218: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (!newModule) { - applyFactoryResultDependencies(); - return callback(); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (currentProfile !== undefined) { - moduleGraph.setProfile(newModule, currentProfile); - } - this.addModule(newModule, (err, module) => { - if (err) { - applyFactoryResultDependencies(); - if (!err.module) { - err.module = module; - } - this.errors.push(err); - return callback(err); - } +const { ConcatSource, RawSource } = __webpack_require__(51255); +const ExternalModule = __webpack_require__(73071); +const ModuleFilenameHelpers = __webpack_require__(88821); +const RuntimeGlobals = __webpack_require__(16475); +const JavascriptModulesPlugin = __webpack_require__(89464); - if ( - this._unsafeCache && - factoryResult.cacheable !== false && - /** @type {any} */ (module).restoreFromUnsafeCache && - this._unsafeCachePredicate(module) - ) { - const unsafeCacheableModule = - /** @type {Module & { restoreFromUnsafeCache: Function }} */ ( - module - ); - for (let i = 0; i < dependencies.length; i++) { - const dependency = dependencies[i]; - moduleGraph.setResolvedModule( - connectOrigin ? originModule : null, - dependency, - unsafeCacheableModule - ); - unsafeCacheDependencies.set(dependency, unsafeCacheableModule); - } - if (!unsafeCacheData.has(unsafeCacheableModule)) { - unsafeCacheData.set( - unsafeCacheableModule, - unsafeCacheableModule.getUnsafeCacheData() - ); - } - } else { - applyFactoryResultDependencies(); - for (let i = 0; i < dependencies.length; i++) { - const dependency = dependencies[i]; - moduleGraph.setResolvedModule( - connectOrigin ? originModule : null, - dependency, - module - ); - } - } +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("./Compiler")} Compiler */ - moduleGraph.setIssuerIfUnset( - module, - originModule !== undefined ? originModule : null - ); - if (module !== newModule) { - if (currentProfile !== undefined) { - const otherProfile = moduleGraph.getProfile(module); - if (otherProfile !== undefined) { - currentProfile.mergeInto(otherProfile); - } else { - moduleGraph.setProfile(module, currentProfile); - } - } - } +/** @type {WeakMap} */ +const cache = new WeakMap(); - this._handleModuleBuildAndDependencies( - originModule, +const devtoolWarning = new RawSource(`/* + * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +`); + +class EvalDevToolModulePlugin { + constructor(options) { + this.namespace = options.namespace || ""; + this.sourceUrlComment = options.sourceUrlComment || "\n//# sourceURL=[url]"; + this.moduleFilenameTemplate = + options.moduleFilenameTemplate || + "webpack://[namespace]/[resourcePath]?[loaders]"; + } + + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap("EvalDevToolModulePlugin", compilation => { + const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); + hooks.renderModuleContent.tap( + "EvalDevToolModulePlugin", + (source, module, { runtimeTemplate, chunkGraph }) => { + const cacheEntry = cache.get(source); + if (cacheEntry !== undefined) return cacheEntry; + if (module instanceof ExternalModule) { + cache.set(source, source); + return source; + } + const content = source.source(); + const str = ModuleFilenameHelpers.createFilename( module, - recursive, - callback + { + moduleFilenameTemplate: this.moduleFilenameTemplate, + namespace: this.namespace + }, + { + requestShortener: runtimeTemplate.requestShortener, + chunkGraph, + hashFunction: compilation.outputOptions.hashFunction + } ); - }); + const footer = + "\n" + + this.sourceUrlComment.replace( + /\[url\]/g, + encodeURI(str) + .replace(/%2F/g, "/") + .replace(/%20/g, "_") + .replace(/%5E/g, "^") + .replace(/%5C/g, "\\") + .replace(/^\//, "") + ); + const result = new RawSource( + `eval(${ + compilation.outputOptions.trustedTypes + ? `${RuntimeGlobals.createScript}(${JSON.stringify( + content + footer + )})` + : JSON.stringify(content + footer) + });` + ); + cache.set(source, result); + return result; + } + ); + hooks.inlineInRuntimeBailout.tap( + "EvalDevToolModulePlugin", + () => "the eval devtool is used." + ); + hooks.render.tap( + "EvalDevToolModulePlugin", + source => new ConcatSource(devtoolWarning, source) + ); + hooks.chunkHash.tap("EvalDevToolModulePlugin", (chunk, hash) => { + hash.update("EvalDevToolModulePlugin"); + hash.update("2"); + }); + if (compilation.outputOptions.trustedTypes) { + compilation.hooks.additionalModuleRuntimeRequirements.tap( + "EvalDevToolModulePlugin", + (module, set, context) => { + set.add(RuntimeGlobals.createScript); + } + ); } - ); + }); } +} - _handleModuleBuildAndDependencies(originModule, module, recursive, callback) { - // Check for cycles when build is trigger inside another build - let creatingModuleDuringBuildSet = undefined; - if (!recursive && this.buildQueue.isProcessing(originModule)) { - // Track build dependency - creatingModuleDuringBuildSet = - this.creatingModuleDuringBuild.get(originModule); - if (creatingModuleDuringBuildSet === undefined) { - creatingModuleDuringBuildSet = new Set(); - this.creatingModuleDuringBuild.set( - originModule, - creatingModuleDuringBuildSet - ); - } - creatingModuleDuringBuildSet.add(module); +module.exports = EvalDevToolModulePlugin; - // When building is blocked by another module - // search for a cycle, cancel the cycle by throwing - // an error (otherwise this would deadlock) - const blockReasons = this.creatingModuleDuringBuild.get(module); - if (blockReasons !== undefined) { - const set = new Set(blockReasons); - for (const item of set) { - const blockReasons = this.creatingModuleDuringBuild.get(item); - if (blockReasons !== undefined) { - for (const m of blockReasons) { - if (m === module) { - return callback(new BuildCycleError(module)); - } - set.add(m); - } - } - } - } - } - this.buildModule(module, err => { - if (creatingModuleDuringBuildSet !== undefined) { - creatingModuleDuringBuildSet.delete(module); - } - if (err) { - if (!err.module) { - err.module = module; - } - this.errors.push(err); +/***/ }), - return callback(err); - } +/***/ 14790: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (!recursive) { - this.processModuleDependenciesNonRecursive(module); - callback(null, module); - return; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // This avoids deadlocks for circular dependencies - if (this.processDependenciesQueue.isProcessing(module)) { - return callback(); - } - this.processModuleDependencies(module, err => { - if (err) { - return callback(err); - } - callback(null, module); - }); - }); - } - /** - * @param {FactorizeModuleOptions} options options object - * @param {ModuleOrFactoryResultCallback} callback callback - * @returns {void} - */ - _factorizeModule( - { - currentProfile, - factory, - dependencies, - originModule, - factoryResult, - contextInfo, - context - }, - callback - ) { - if (currentProfile !== undefined) { - currentProfile.markFactoryStart(); - } - factory.create( - { - contextInfo: { - issuer: originModule ? originModule.nameForCondition() : "", - issuerLayer: originModule ? originModule.layer : null, - compiler: this.compiler.name, - ...contextInfo - }, - resolveOptions: originModule ? originModule.resolveOptions : undefined, - context: context - ? context - : originModule - ? originModule.context - : this.compiler.context, - dependencies: dependencies - }, - (err, result) => { - if (result) { - // TODO webpack 6: remove - // For backward-compat - if (result.module === undefined && result instanceof Module) { - result = { - module: result - }; - } - if (!factoryResult) { - const { - fileDependencies, - contextDependencies, - missingDependencies - } = result; - if (fileDependencies) { - this.fileDependencies.addAll(fileDependencies); - } - if (contextDependencies) { - this.contextDependencies.addAll(contextDependencies); - } - if (missingDependencies) { - this.missingDependencies.addAll(missingDependencies); - } - } - } - if (err) { - const notFoundError = new ModuleNotFoundError( - originModule, - err, - dependencies.map(d => d.loc).filter(Boolean)[0] - ); - return callback(notFoundError, factoryResult ? result : undefined); - } - if (!result) { - return callback(); - } +const { ConcatSource, RawSource } = __webpack_require__(51255); +const ModuleFilenameHelpers = __webpack_require__(88821); +const NormalModule = __webpack_require__(39); +const RuntimeGlobals = __webpack_require__(16475); +const SourceMapDevToolModuleOptionsPlugin = __webpack_require__(97513); +const JavascriptModulesPlugin = __webpack_require__(89464); +const ConcatenatedModule = __webpack_require__(97198); +const { makePathsAbsolute } = __webpack_require__(82186); - if (currentProfile !== undefined) { - currentProfile.markFactoryEnd(); - } +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").DevTool} DevToolOptions */ +/** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */ +/** @typedef {import("./Compiler")} Compiler */ - callback(null, factoryResult ? result : result.module); - } - ); - } +/** @type {WeakMap} */ +const cache = new WeakMap(); - /** - * @param {string} context context string path - * @param {Dependency} dependency dependency used to create Module chain - * @param {ModuleCallback} callback callback for when module chain is complete - * @returns {void} will throw if dependency instance is not a valid Dependency - */ - addModuleChain(context, dependency, callback) { - return this.addModuleTree({ context, dependency }, callback); - } +const devtoolWarning = new RawSource(`/* + * ATTENTION: An "eval-source-map" devtool has been used. + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +`); +class EvalSourceMapDevToolPlugin { /** - * @param {Object} options options - * @param {string} options.context context string path - * @param {Dependency} options.dependency dependency used to create Module chain - * @param {Partial=} options.contextInfo additional context info for the root module - * @param {ModuleCallback} callback callback for when module chain is complete - * @returns {void} will throw if dependency instance is not a valid Dependency + * @param {SourceMapDevToolPluginOptions|string} inputOptions Options object */ - addModuleTree({ context, dependency, contextInfo }, callback) { - if ( - typeof dependency !== "object" || - dependency === null || - !dependency.constructor - ) { - return callback( - new WebpackError("Parameter 'dependency' must be a Dependency") - ); - } - const Dep = /** @type {DepConstructor} */ (dependency.constructor); - const moduleFactory = this.dependencyFactories.get(Dep); - if (!moduleFactory) { - return callback( - new WebpackError( - `No dependency factory available for this dependency type: ${dependency.constructor.name}` - ) - ); + constructor(inputOptions) { + /** @type {SourceMapDevToolPluginOptions} */ + let options; + if (typeof inputOptions === "string") { + options = { + append: inputOptions + }; + } else { + options = inputOptions; } - - this.handleModuleCreation( - { - factory: moduleFactory, - dependencies: [dependency], - originModule: null, - contextInfo, - context - }, - (err, result) => { - if (err && this.bail) { - callback(err); - this.buildQueue.stop(); - this.rebuildQueue.stop(); - this.processDependenciesQueue.stop(); - this.factorizeQueue.stop(); - } else if (!err && result) { - callback(null, result); - } else { - callback(); - } - } - ); + this.sourceMapComment = + options.append || "//# sourceURL=[module]\n//# sourceMappingURL=[url]"; + this.moduleFilenameTemplate = + options.moduleFilenameTemplate || + "webpack://[namespace]/[resource-path]?[hash]"; + this.namespace = options.namespace || ""; + this.options = options; } /** - * @param {string} context context path for entry - * @param {Dependency} entry entry dependency that should be followed - * @param {string | EntryOptions} optionsOrName options or deprecated name of entry - * @param {ModuleCallback} callback callback function - * @returns {void} returns + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - addEntry(context, entry, optionsOrName, callback) { - // TODO webpack 6 remove - const options = - typeof optionsOrName === "object" - ? optionsOrName - : { name: optionsOrName }; - - this._addEntryItem(context, entry, "dependencies", options, callback); - } + apply(compiler) { + const options = this.options; + compiler.hooks.compilation.tap( + "EvalSourceMapDevToolPlugin", + compilation => { + const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); + new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation); + const matchModule = ModuleFilenameHelpers.matchObject.bind( + ModuleFilenameHelpers, + options + ); + hooks.renderModuleContent.tap( + "EvalSourceMapDevToolPlugin", + (source, m, { runtimeTemplate, chunkGraph }) => { + const cachedSource = cache.get(source); + if (cachedSource !== undefined) { + return cachedSource; + } - /** - * @param {string} context context path for entry - * @param {Dependency} dependency dependency that should be followed - * @param {EntryOptions} options options - * @param {ModuleCallback} callback callback function - * @returns {void} returns - */ - addInclude(context, dependency, options, callback) { - this._addEntryItem( - context, - dependency, - "includeDependencies", - options, - callback - ); - } + const result = r => { + cache.set(source, r); + return r; + }; - /** - * @param {string} context context path for entry - * @param {Dependency} entry entry dependency that should be followed - * @param {"dependencies" | "includeDependencies"} target type of entry - * @param {EntryOptions} options options - * @param {ModuleCallback} callback callback function - * @returns {void} returns - */ - _addEntryItem(context, entry, target, options, callback) { - const { name } = options; - let entryData = - name !== undefined ? this.entries.get(name) : this.globalEntry; - if (entryData === undefined) { - entryData = { - dependencies: [], - includeDependencies: [], - options: { - name: undefined, - ...options - } - }; - entryData[target].push(entry); - this.entries.set(name, entryData); - } else { - entryData[target].push(entry); - for (const key of Object.keys(options)) { - if (options[key] === undefined) continue; - if (entryData.options[key] === options[key]) continue; - if ( - Array.isArray(entryData.options[key]) && - Array.isArray(options[key]) && - arrayEquals(entryData.options[key], options[key]) - ) { - continue; - } - if (entryData.options[key] === undefined) { - entryData.options[key] = options[key]; - } else { - return callback( - new WebpackError( - `Conflicting entry option ${key} = ${entryData.options[key]} vs ${options[key]}` - ) - ); - } - } - } + if (m instanceof NormalModule) { + const module = /** @type {NormalModule} */ (m); + if (!matchModule(module.resource)) { + return result(source); + } + } else if (m instanceof ConcatenatedModule) { + const concatModule = /** @type {ConcatenatedModule} */ (m); + if (concatModule.rootModule instanceof NormalModule) { + const module = /** @type {NormalModule} */ ( + concatModule.rootModule + ); + if (!matchModule(module.resource)) { + return result(source); + } + } else { + return result(source); + } + } else { + return result(source); + } - this.hooks.addEntry.call(entry, options); + /** @type {{ [key: string]: TODO; }} */ + let sourceMap; + let content; + if (source.sourceAndMap) { + const sourceAndMap = source.sourceAndMap(options); + sourceMap = sourceAndMap.map; + content = sourceAndMap.source; + } else { + sourceMap = source.map(options); + content = source.source(); + } + if (!sourceMap) { + return result(source); + } - this.addModuleTree( - { - context, - dependency: entry, - contextInfo: entryData.options.layer - ? { issuerLayer: entryData.options.layer } - : undefined - }, - (err, module) => { - if (err) { - this.hooks.failedEntry.call(entry, options, err); - return callback(err); + // Clone (flat) the sourcemap to ensure that the mutations below do not persist. + sourceMap = { ...sourceMap }; + const context = compiler.options.context; + const root = compiler.root; + const modules = sourceMap.sources.map(source => { + if (!source.startsWith("webpack://")) return source; + source = makePathsAbsolute(context, source.slice(10), root); + const module = compilation.findModule(source); + return module || source; + }); + let moduleFilenames = modules.map(module => { + return ModuleFilenameHelpers.createFilename( + module, + { + moduleFilenameTemplate: this.moduleFilenameTemplate, + namespace: this.namespace + }, + { + requestShortener: runtimeTemplate.requestShortener, + chunkGraph, + hashFunction: compilation.outputOptions.hashFunction + } + ); + }); + moduleFilenames = ModuleFilenameHelpers.replaceDuplicates( + moduleFilenames, + (filename, i, n) => { + for (let j = 0; j < n; j++) filename += "*"; + return filename; + } + ); + sourceMap.sources = moduleFilenames; + sourceMap.sourceRoot = options.sourceRoot || ""; + const moduleId = chunkGraph.getModuleId(m); + sourceMap.file = `${moduleId}.js`; + + const footer = + this.sourceMapComment.replace( + /\[url\]/g, + `data:application/json;charset=utf-8;base64,${Buffer.from( + JSON.stringify(sourceMap), + "utf8" + ).toString("base64")}` + ) + `\n//# sourceURL=webpack-internal:///${moduleId}\n`; // workaround for chrome bug + + return result( + new RawSource( + `eval(${ + compilation.outputOptions.trustedTypes + ? `${RuntimeGlobals.createScript}(${JSON.stringify( + content + footer + )})` + : JSON.stringify(content + footer) + });` + ) + ); + } + ); + hooks.inlineInRuntimeBailout.tap( + "EvalDevToolModulePlugin", + () => "the eval-source-map devtool is used." + ); + hooks.render.tap( + "EvalSourceMapDevToolPlugin", + source => new ConcatSource(devtoolWarning, source) + ); + hooks.chunkHash.tap("EvalSourceMapDevToolPlugin", (chunk, hash) => { + hash.update("EvalSourceMapDevToolPlugin"); + hash.update("2"); + }); + if (compilation.outputOptions.trustedTypes) { + compilation.hooks.additionalModuleRuntimeRequirements.tap( + "EvalSourceMapDevToolPlugin", + (module, set, context) => { + set.add(RuntimeGlobals.createScript); + } + ); } - this.hooks.succeedEntry.call(entry, options, module); - return callback(null, module); } ); } +} + +module.exports = EvalSourceMapDevToolPlugin; + + +/***/ }), + +/***/ 63686: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { equals } = __webpack_require__(84953); +const SortableSet = __webpack_require__(13098); +const makeSerializable = __webpack_require__(33032); +const { forEachRuntime } = __webpack_require__(17156); + +/** @typedef {import("./Dependency").RuntimeSpec} RuntimeSpec */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("./util/Hash")} Hash */ + +/** @typedef {typeof UsageState.OnlyPropertiesUsed | typeof UsageState.NoInfo | typeof UsageState.Unknown | typeof UsageState.Used} RuntimeUsageStateType */ +/** @typedef {typeof UsageState.Unused | RuntimeUsageStateType} UsageStateType */ + +const UsageState = Object.freeze({ + Unused: /** @type {0} */ (0), + OnlyPropertiesUsed: /** @type {1} */ (1), + NoInfo: /** @type {2} */ (2), + Unknown: /** @type {3} */ (3), + Used: /** @type {4} */ (4) +}); + +const RETURNS_TRUE = () => true; + +const CIRCULAR = Symbol("circular target"); + +class RestoreProvidedData { + constructor( + exports, + otherProvided, + otherCanMangleProvide, + otherTerminalBinding + ) { + this.exports = exports; + this.otherProvided = otherProvided; + this.otherCanMangleProvide = otherCanMangleProvide; + this.otherTerminalBinding = otherTerminalBinding; + } + + serialize({ write }) { + write(this.exports); + write(this.otherProvided); + write(this.otherCanMangleProvide); + write(this.otherTerminalBinding); + } + + static deserialize({ read }) { + return new RestoreProvidedData(read(), read(), read(), read()); + } +} + +makeSerializable( + RestoreProvidedData, + "webpack/lib/ModuleGraph", + "RestoreProvidedData" +); + +class ExportsInfo { + constructor() { + /** @type {Map} */ + this._exports = new Map(); + this._otherExportsInfo = new ExportInfo(null); + this._sideEffectsOnlyInfo = new ExportInfo("*side effects only*"); + this._exportsAreOrdered = false; + /** @type {ExportsInfo=} */ + this._redirectTo = undefined; + } /** - * @param {Module} module module to be rebuilt - * @param {ModuleCallback} callback callback when module finishes rebuilding - * @returns {void} + * @returns {Iterable} all owned exports in any order */ - rebuildModule(module, callback) { - this.rebuildQueue.add(module, callback); + get ownedExports() { + return this._exports.values(); } /** - * @param {Module} module module to be rebuilt - * @param {ModuleCallback} callback callback when module finishes rebuilding - * @returns {void} + * @returns {Iterable} all owned exports in order */ - _rebuildModule(module, callback) { - this.hooks.rebuildModule.call(module); - const oldDependencies = module.dependencies.slice(); - const oldBlocks = module.blocks.slice(); - module.invalidateBuild(); - this.buildQueue.invalidate(module); - this.buildModule(module, err => { - if (err) { - return this.hooks.finishRebuildingModule.callAsync(module, err2 => { - if (err2) { - callback( - makeWebpackError(err2, "Compilation.hooks.finishRebuildingModule") - ); - return; - } - callback(err); - }); - } - - this.processDependenciesQueue.invalidate(module); - this.moduleGraph.unfreeze(); - this.processModuleDependencies(module, err => { - if (err) return callback(err); - this.removeReasonsOfDependencyBlock(module, { - dependencies: oldDependencies, - blocks: oldBlocks - }); - this.hooks.finishRebuildingModule.callAsync(module, err2 => { - if (err2) { - callback( - makeWebpackError(err2, "Compilation.hooks.finishRebuildingModule") - ); - return; - } - callback(null, module); - }); - }); - }); + get orderedOwnedExports() { + if (!this._exportsAreOrdered) { + this._sortExports(); + } + return this._exports.values(); } - _computeAffectedModules(modules) { - const moduleMemCacheCache = this.compiler.moduleMemCaches; - if (!moduleMemCacheCache) return; - if (!this.moduleMemCaches) { - this.moduleMemCaches = new Map(); - this.moduleGraph.setModuleMemCaches(this.moduleMemCaches); + /** + * @returns {Iterable} all exports in any order + */ + get exports() { + if (this._redirectTo !== undefined) { + const map = new Map(this._redirectTo._exports); + for (const [key, value] of this._exports) { + map.set(key, value); + } + return map.values(); } - const { moduleGraph, moduleMemCaches } = this; - const affectedModules = new Set(); - const infectedModules = new Set(); - let statNew = 0; - let statChanged = 0; - let statUnchanged = 0; - let statReferencesChanged = 0; - let statWithoutBuild = 0; + return this._exports.values(); + } - const computeReferences = module => { - /** @type {WeakMap} */ - let references = undefined; - for (const connection of moduleGraph.getOutgoingConnections(module)) { - const d = connection.dependency; - const m = connection.module; - if (!d || !m || unsafeCacheDependencies.has(d)) continue; - if (references === undefined) references = new WeakMap(); - references.set(d, m); + /** + * @returns {Iterable} all exports in order + */ + get orderedExports() { + if (!this._exportsAreOrdered) { + this._sortExports(); + } + if (this._redirectTo !== undefined) { + const map = new Map( + Array.from(this._redirectTo.orderedExports, item => [item.name, item]) + ); + for (const [key, value] of this._exports) { + map.set(key, value); } - return references; - }; + // sorting should be pretty fast as map contains + // a lot of presorted items + this._sortExportsMap(map); + return map.values(); + } + return this._exports.values(); + } - /** - * @param {Module} module the module - * @param {WeakMap} references references - * @returns {boolean} true, when the references differ - */ - const compareReferences = (module, references) => { - if (references === undefined) return true; - for (const connection of moduleGraph.getOutgoingConnections(module)) { - const d = connection.dependency; - if (!d) continue; - const entry = references.get(d); - if (entry === undefined) continue; - if (entry !== connection.module) return false; - } - return true; - }; + /** + * @returns {ExportInfo} the export info of unlisted exports + */ + get otherExportsInfo() { + if (this._redirectTo !== undefined) + return this._redirectTo.otherExportsInfo; + return this._otherExportsInfo; + } - const modulesWithoutCache = new Set(modules); - for (const [module, cachedMemCache] of moduleMemCacheCache) { - if (modulesWithoutCache.has(module)) { - const buildInfo = module.buildInfo; - if (buildInfo) { - if (cachedMemCache.buildInfo !== buildInfo) { - // use a new one - const memCache = new WeakTupleMap(); - moduleMemCaches.set(module, memCache); - affectedModules.add(module); - cachedMemCache.buildInfo = buildInfo; - cachedMemCache.references = computeReferences(module); - cachedMemCache.memCache = memCache; - statChanged++; - } else if (!compareReferences(module, cachedMemCache.references)) { - // use a new one - const memCache = new WeakTupleMap(); - moduleMemCaches.set(module, memCache); - affectedModules.add(module); - cachedMemCache.references = computeReferences(module); - cachedMemCache.memCache = memCache; - statReferencesChanged++; - } else { - // keep the old mem cache - moduleMemCaches.set(module, cachedMemCache.memCache); - statUnchanged++; - } - } else { - infectedModules.add(module); - moduleMemCacheCache.delete(module); - statWithoutBuild++; - } - modulesWithoutCache.delete(module); - } else { - moduleMemCacheCache.delete(module); + _sortExportsMap(exports) { + if (exports.size > 1) { + const namesInOrder = []; + for (const entry of exports.values()) { + namesInOrder.push(entry.name); + } + namesInOrder.sort(); + let i = 0; + for (const entry of exports.values()) { + const name = namesInOrder[i]; + if (entry.name !== name) break; + i++; + } + for (; i < namesInOrder.length; i++) { + const name = namesInOrder[i]; + const correctEntry = exports.get(name); + exports.delete(name); + exports.set(name, correctEntry); } } + } - for (const module of modulesWithoutCache) { - const buildInfo = module.buildInfo; - if (buildInfo) { - // create a new entry - const memCache = new WeakTupleMap(); - moduleMemCacheCache.set(module, { - buildInfo, - references: computeReferences(module), - memCache - }); - moduleMemCaches.set(module, memCache); - affectedModules.add(module); - statNew++; - } else { - infectedModules.add(module); - statWithoutBuild++; + _sortExports() { + this._sortExportsMap(this._exports); + this._exportsAreOrdered = true; + } + + setRedirectNamedTo(exportsInfo) { + if (this._redirectTo === exportsInfo) return false; + this._redirectTo = exportsInfo; + return true; + } + + setHasProvideInfo() { + for (const exportInfo of this._exports.values()) { + if (exportInfo.provided === undefined) { + exportInfo.provided = false; + } + if (exportInfo.canMangleProvide === undefined) { + exportInfo.canMangleProvide = true; } } - - const reduceAffectType = connections => { - let affected = false; - for (const { dependency } of connections) { - if (!dependency) continue; - const type = dependency.couldAffectReferencingModule(); - if (type === Dependency.TRANSITIVE) return Dependency.TRANSITIVE; - if (type === false) continue; - affected = true; + if (this._redirectTo !== undefined) { + this._redirectTo.setHasProvideInfo(); + } else { + if (this._otherExportsInfo.provided === undefined) { + this._otherExportsInfo.provided = false; } - return affected; - }; - const directOnlyInfectedModules = new Set(); - for (const module of infectedModules) { - for (const [ - referencingModule, - connections - ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { - if (!referencingModule) continue; - if (infectedModules.has(referencingModule)) continue; - const type = reduceAffectType(connections); - if (!type) continue; - if (type === true) { - directOnlyInfectedModules.add(referencingModule); - } else { - infectedModules.add(referencingModule); - } + if (this._otherExportsInfo.canMangleProvide === undefined) { + this._otherExportsInfo.canMangleProvide = true; } } - for (const module of directOnlyInfectedModules) infectedModules.add(module); - const directOnlyAffectModules = new Set(); - for (const module of affectedModules) { - for (const [ - referencingModule, - connections - ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { - if (!referencingModule) continue; - if (infectedModules.has(referencingModule)) continue; - if (affectedModules.has(referencingModule)) continue; - const type = reduceAffectType(connections); - if (!type) continue; - if (type === true) { - directOnlyAffectModules.add(referencingModule); - } else { - affectedModules.add(referencingModule); - } - const memCache = new WeakTupleMap(); - const cache = moduleMemCacheCache.get(referencingModule); - cache.memCache = memCache; - moduleMemCaches.set(referencingModule, memCache); - } - } - for (const module of directOnlyAffectModules) affectedModules.add(module); - this.logger.log( - `${Math.round( - (100 * (affectedModules.size + infectedModules.size)) / - this.modules.size - )}% (${affectedModules.size} affected + ${ - infectedModules.size - } infected of ${ - this.modules.size - }) modules flagged as affected (${statNew} new modules, ${statChanged} changed, ${statReferencesChanged} references changed, ${statUnchanged} unchanged, ${statWithoutBuild} were not built)` - ); } - _computeAffectedModulesWithChunkGraph() { - const { moduleMemCaches } = this; - if (!moduleMemCaches) return; - const moduleMemCaches2 = (this.moduleMemCaches2 = new Map()); - const { moduleGraph, chunkGraph } = this; - const key = "memCache2"; - let statUnchanged = 0; - let statChanged = 0; - let statNew = 0; - /** - * @param {Module} module module - * @returns {{ id: string | number, modules?: Map, blocks?: (string | number)[] }} references - */ - const computeReferences = module => { - const id = chunkGraph.getModuleId(module); - /** @type {Map} */ - let modules = undefined; - /** @type {(string | number)[] | undefined} */ - let blocks = undefined; - const outgoing = moduleGraph.getOutgoingConnectionsByModule(module); - if (outgoing !== undefined) { - for (const m of outgoing.keys()) { - if (!m) continue; - if (modules === undefined) modules = new Map(); - modules.set(m, chunkGraph.getModuleId(m)); - } - } - if (module.blocks.length > 0) { - blocks = []; - const queue = Array.from(module.blocks); - for (const block of queue) { - const chunkGroup = chunkGraph.getBlockChunkGroup(block); - if (chunkGroup) { - for (const chunk of chunkGroup.chunks) { - blocks.push(chunk.id); - } - } else { - blocks.push(null); - } - queue.push.apply(queue, block.blocks); - } - } - return { id, modules, blocks }; - }; - /** - * @param {Module} module module - * @param {Object} references references - * @param {string | number} references.id id - * @param {Map=} references.modules modules - * @param {(string | number)[]=} references.blocks blocks - * @returns {boolean} ok? - */ - const compareReferences = (module, { id, modules, blocks }) => { - if (id !== chunkGraph.getModuleId(module)) return false; - if (modules !== undefined) { - for (const [module, id] of modules) { - if (chunkGraph.getModuleId(module) !== id) return false; - } - } - if (blocks !== undefined) { - const queue = Array.from(module.blocks); - let i = 0; - for (const block of queue) { - const chunkGroup = chunkGraph.getBlockChunkGroup(block); - if (chunkGroup) { - for (const chunk of chunkGroup.chunks) { - if (i >= blocks.length || blocks[i++] !== chunk.id) return false; - } - } else { - if (i >= blocks.length || blocks[i++] !== null) return false; - } - queue.push.apply(queue, block.blocks); - } - if (i !== blocks.length) return false; - } - return true; - }; - - for (const [module, memCache] of moduleMemCaches) { - /** @type {{ references: { id: string | number, modules?: Map, blocks?: (string | number)[]}, memCache: WeakTupleMap }} */ - const cache = memCache.get(key); - if (cache === undefined) { - const memCache2 = new WeakTupleMap(); - memCache.set(key, { - references: computeReferences(module), - memCache: memCache2 - }); - moduleMemCaches2.set(module, memCache2); - statNew++; - } else if (!compareReferences(module, cache.references)) { - const memCache = new WeakTupleMap(); - cache.references = computeReferences(module); - cache.memCache = memCache; - moduleMemCaches2.set(module, memCache); - statChanged++; - } else { - moduleMemCaches2.set(module, cache.memCache); - statUnchanged++; - } + setHasUseInfo() { + for (const exportInfo of this._exports.values()) { + exportInfo.setHasUseInfo(); } - - this.logger.log( - `${Math.round( - (100 * statChanged) / (statNew + statChanged + statUnchanged) - )}% modules flagged as affected by chunk graph (${statNew} new modules, ${statChanged} changed, ${statUnchanged} unchanged)` - ); - } - - finish(callback) { - this.factorizeQueue.clear(); - if (this.profile) { - this.logger.time("finish module profiles"); - const ParallelismFactorCalculator = __webpack_require__(50780); - const p = new ParallelismFactorCalculator(); - const moduleGraph = this.moduleGraph; - const modulesWithProfiles = new Map(); - for (const module of this.modules) { - const profile = moduleGraph.getProfile(module); - if (!profile) continue; - modulesWithProfiles.set(module, profile); - p.range( - profile.buildingStartTime, - profile.buildingEndTime, - f => (profile.buildingParallelismFactor = f) - ); - p.range( - profile.factoryStartTime, - profile.factoryEndTime, - f => (profile.factoryParallelismFactor = f) - ); - p.range( - profile.integrationStartTime, - profile.integrationEndTime, - f => (profile.integrationParallelismFactor = f) - ); - p.range( - profile.storingStartTime, - profile.storingEndTime, - f => (profile.storingParallelismFactor = f) - ); - p.range( - profile.restoringStartTime, - profile.restoringEndTime, - f => (profile.restoringParallelismFactor = f) - ); - if (profile.additionalFactoryTimes) { - for (const { start, end } of profile.additionalFactoryTimes) { - const influence = (end - start) / profile.additionalFactories; - p.range( - start, - end, - f => - (profile.additionalFactoriesParallelismFactor += f * influence) - ); - } - } + this._sideEffectsOnlyInfo.setHasUseInfo(); + if (this._redirectTo !== undefined) { + this._redirectTo.setHasUseInfo(); + } else { + this._otherExportsInfo.setHasUseInfo(); + if (this._otherExportsInfo.canMangleUse === undefined) { + this._otherExportsInfo.canMangleUse = true; } - p.calculate(); - - const logger = this.getLogger("webpack.Compilation.ModuleProfile"); - const logByValue = (value, msg) => { - if (value > 1000) { - logger.error(msg); - } else if (value > 500) { - logger.warn(msg); - } else if (value > 200) { - logger.info(msg); - } else if (value > 30) { - logger.log(msg); - } else { - logger.debug(msg); - } - }; - const logNormalSummary = (category, getDuration, getParallelism) => { - let sum = 0; - let max = 0; - for (const [module, profile] of modulesWithProfiles) { - const p = getParallelism(profile); - const d = getDuration(profile); - if (d === 0 || p === 0) continue; - const t = d / p; - sum += t; - if (t <= 10) continue; - logByValue( - t, - ` | ${Math.round(t)} ms${ - p >= 1.1 ? ` (parallelism ${Math.round(p * 10) / 10})` : "" - } ${category} > ${module.readableIdentifier(this.requestShortener)}` - ); - max = Math.max(max, t); - } - if (sum <= 10) return; - logByValue( - Math.max(sum / 10, max), - `${Math.round(sum)} ms ${category}` - ); - }; - const logByLoadersSummary = (category, getDuration, getParallelism) => { - const map = new Map(); - for (const [module, profile] of modulesWithProfiles) { - const list = provide( - map, - module.type + "!" + module.identifier().replace(/(!|^)[^!]*$/, ""), - () => [] - ); - list.push({ module, profile }); - } - - let sum = 0; - let max = 0; - for (const [key, modules] of map) { - let innerSum = 0; - let innerMax = 0; - for (const { module, profile } of modules) { - const p = getParallelism(profile); - const d = getDuration(profile); - if (d === 0 || p === 0) continue; - const t = d / p; - innerSum += t; - if (t <= 10) continue; - logByValue( - t, - ` | | ${Math.round(t)} ms${ - p >= 1.1 ? ` (parallelism ${Math.round(p * 10) / 10})` : "" - } ${category} > ${module.readableIdentifier( - this.requestShortener - )}` - ); - innerMax = Math.max(innerMax, t); - } - sum += innerSum; - if (innerSum <= 10) continue; - const idx = key.indexOf("!"); - const loaders = key.slice(idx + 1); - const moduleType = key.slice(0, idx); - const t = Math.max(innerSum / 10, innerMax); - logByValue( - t, - ` | ${Math.round(innerSum)} ms ${category} > ${ - loaders - ? `${ - modules.length - } x ${moduleType} with ${this.requestShortener.shorten( - loaders - )}` - : `${modules.length} x ${moduleType}` - }` - ); - max = Math.max(max, t); - } - if (sum <= 10) return; - logByValue( - Math.max(sum / 10, max), - `${Math.round(sum)} ms ${category}` - ); - }; - logNormalSummary( - "resolve to new modules", - p => p.factory, - p => p.factoryParallelismFactor - ); - logNormalSummary( - "resolve to existing modules", - p => p.additionalFactories, - p => p.additionalFactoriesParallelismFactor - ); - logNormalSummary( - "integrate modules", - p => p.restoring, - p => p.restoringParallelismFactor - ); - logByLoadersSummary( - "build modules", - p => p.building, - p => p.buildingParallelismFactor - ); - logNormalSummary( - "store modules", - p => p.storing, - p => p.storingParallelismFactor - ); - logNormalSummary( - "restore modules", - p => p.restoring, - p => p.restoringParallelismFactor - ); - this.logger.timeEnd("finish module profiles"); } - this.logger.time("compute affected modules"); - this._computeAffectedModules(this.modules); - this.logger.timeEnd("compute affected modules"); - this.logger.time("finish modules"); - const { modules, moduleMemCaches } = this; - this.hooks.finishModules.callAsync(modules, err => { - this.logger.timeEnd("finish modules"); - if (err) return callback(err); - - // extract warnings and errors from modules - this.moduleGraph.freeze("dependency errors"); - // TODO keep a cacheToken (= {}) for each module in the graph - // create a new one per compilation and flag all updated files - // and parents with it - this.logger.time("report dependency errors and warnings"); - for (const module of modules) { - // TODO only run for modules with changed cacheToken - // global WeakMap> to keep modules without errors/warnings - const memCache = moduleMemCaches && moduleMemCaches.get(module); - if (memCache && memCache.get("noWarningsOrErrors")) continue; - let hasProblems = this.reportDependencyErrorsAndWarnings(module, [ - module - ]); - const errors = module.getErrors(); - if (errors !== undefined) { - for (const error of errors) { - if (!error.module) { - error.module = module; - } - this.errors.push(error); - hasProblems = true; - } - } - const warnings = module.getWarnings(); - if (warnings !== undefined) { - for (const warning of warnings) { - if (!warning.module) { - warning.module = module; - } - this.warnings.push(warning); - hasProblems = true; - } - } - if (!hasProblems && memCache) memCache.set("noWarningsOrErrors", true); - } - this.moduleGraph.unfreeze(); - this.logger.timeEnd("report dependency errors and warnings"); - - callback(); - }); } - unseal() { - this.hooks.unseal.call(); - this.chunks.clear(); - this.chunkGroups.length = 0; - this.namedChunks.clear(); - this.namedChunkGroups.clear(); - this.entrypoints.clear(); - this.additionalChunkAssets.length = 0; - this.assets = {}; - this.assetsInfo.clear(); - this.moduleGraph.removeAllModuleAttributes(); - this.moduleGraph.unfreeze(); - this.moduleMemCaches2 = undefined; + /** + * @param {string} name export name + * @returns {ExportInfo} export info for this name + */ + getOwnExportInfo(name) { + const info = this._exports.get(name); + if (info !== undefined) return info; + const newInfo = new ExportInfo(name, this._otherExportsInfo); + this._exports.set(name, newInfo); + this._exportsAreOrdered = false; + return newInfo; } /** - * @param {Callback} callback signals when the call finishes - * @returns {void} + * @param {string} name export name + * @returns {ExportInfo} export info for this name */ - seal(callback) { - const finalCallback = err => { - this.factorizeQueue.clear(); - this.buildQueue.clear(); - this.rebuildQueue.clear(); - this.processDependenciesQueue.clear(); - this.addModuleQueue.clear(); - return callback(err); - }; - const chunkGraph = new ChunkGraph( - this.moduleGraph, - this.outputOptions.hashFunction - ); - this.chunkGraph = chunkGraph; + getExportInfo(name) { + const info = this._exports.get(name); + if (info !== undefined) return info; + if (this._redirectTo !== undefined) + return this._redirectTo.getExportInfo(name); + const newInfo = new ExportInfo(name, this._otherExportsInfo); + this._exports.set(name, newInfo); + this._exportsAreOrdered = false; + return newInfo; + } - if (this._backCompat) { - for (const module of this.modules) { - ChunkGraph.setChunkGraphForModule(module, chunkGraph); - } - } + /** + * @param {string} name export name + * @returns {ExportInfo} export info for this name + */ + getReadOnlyExportInfo(name) { + const info = this._exports.get(name); + if (info !== undefined) return info; + if (this._redirectTo !== undefined) + return this._redirectTo.getReadOnlyExportInfo(name); + return this._otherExportsInfo; + } - this.hooks.seal.call(); + /** + * @param {string[]} name export name + * @returns {ExportInfo | undefined} export info for this name + */ + getReadOnlyExportInfoRecursive(name) { + const exportInfo = this.getReadOnlyExportInfo(name[0]); + if (name.length === 1) return exportInfo; + if (!exportInfo.exportsInfo) return undefined; + return exportInfo.exportsInfo.getReadOnlyExportInfoRecursive(name.slice(1)); + } - this.logger.time("optimize dependencies"); - while (this.hooks.optimizeDependencies.call(this.modules)) { - /* empty */ + /** + * @param {string[]=} name the export name + * @returns {ExportsInfo | undefined} the nested exports info + */ + getNestedExportsInfo(name) { + if (Array.isArray(name) && name.length > 0) { + const info = this.getReadOnlyExportInfo(name[0]); + if (!info.exportsInfo) return undefined; + return info.exportsInfo.getNestedExportsInfo(name.slice(1)); } - this.hooks.afterOptimizeDependencies.call(this.modules); - this.logger.timeEnd("optimize dependencies"); + return this; + } - this.logger.time("create chunks"); - this.hooks.beforeChunks.call(); - this.moduleGraph.freeze("seal"); - /** @type {Map} */ - const chunkGraphInit = new Map(); - for (const [name, { dependencies, includeDependencies, options }] of this - .entries) { - const chunk = this.addChunk(name); - if (options.filename) { - chunk.filenameTemplate = options.filename; + /** + * @param {boolean=} canMangle true, if exports can still be mangled (defaults to false) + * @param {Set=} excludeExports list of unaffected exports + * @param {any=} targetKey use this as key for the target + * @param {ModuleGraphConnection=} targetModule set this module as target + * @param {number=} priority priority + * @returns {boolean} true, if this call changed something + */ + setUnknownExportsProvided( + canMangle, + excludeExports, + targetKey, + targetModule, + priority + ) { + let changed = false; + if (excludeExports) { + for (const name of excludeExports) { + // Make sure these entries exist, so they can get different info + this.getExportInfo(name); } - const entrypoint = new Entrypoint(options); - if (!options.dependOn && !options.runtime) { - entrypoint.setRuntimeChunk(chunk); + } + for (const exportInfo of this._exports.values()) { + if (!canMangle && exportInfo.canMangleProvide !== false) { + exportInfo.canMangleProvide = false; + changed = true; } - entrypoint.setEntrypointChunk(chunk); - this.namedChunkGroups.set(name, entrypoint); - this.entrypoints.set(name, entrypoint); - this.chunkGroups.push(entrypoint); - connectChunkGroupAndChunk(entrypoint, chunk); - - const entryModules = new Set(); - for (const dep of [...this.globalEntry.dependencies, ...dependencies]) { - entrypoint.addOrigin(null, { name }, /** @type {any} */ (dep).request); - - const module = this.moduleGraph.getModule(dep); - if (module) { - chunkGraph.connectChunkAndEntryModule(chunk, module, entrypoint); - entryModules.add(module); - const modulesList = chunkGraphInit.get(entrypoint); - if (modulesList === undefined) { - chunkGraphInit.set(entrypoint, [module]); - } else { - modulesList.push(module); - } - } - } - - this.assignDepths(entryModules); - - const mapAndSort = deps => - deps - .map(dep => this.moduleGraph.getModule(dep)) - .filter(Boolean) - .sort(compareModulesByIdentifier); - const includedModules = [ - ...mapAndSort(this.globalEntry.includeDependencies), - ...mapAndSort(includeDependencies) - ]; - - let modulesList = chunkGraphInit.get(entrypoint); - if (modulesList === undefined) { - chunkGraphInit.set(entrypoint, (modulesList = [])); + if (excludeExports && excludeExports.has(exportInfo.name)) continue; + if (exportInfo.provided !== true && exportInfo.provided !== null) { + exportInfo.provided = null; + changed = true; } - for (const module of includedModules) { - this.assignDepth(module); - modulesList.push(module); + if (targetKey) { + exportInfo.setTarget(targetKey, targetModule, [exportInfo.name], -1); } } - const runtimeChunks = new Set(); - outer: for (const [ - name, - { - options: { dependOn, runtime } + if (this._redirectTo !== undefined) { + if ( + this._redirectTo.setUnknownExportsProvided( + canMangle, + excludeExports, + targetKey, + targetModule, + priority + ) + ) { + changed = true; } - ] of this.entries) { - if (dependOn && runtime) { - const err = - new WebpackError(`Entrypoint '${name}' has 'dependOn' and 'runtime' specified. This is not valid. -Entrypoints that depend on other entrypoints do not have their own runtime. -They will use the runtime(s) from referenced entrypoints instead. -Remove the 'runtime' option from the entrypoint.`); - const entry = this.entrypoints.get(name); - err.chunk = entry.getEntrypointChunk(); - this.errors.push(err); + } else { + if ( + this._otherExportsInfo.provided !== true && + this._otherExportsInfo.provided !== null + ) { + this._otherExportsInfo.provided = null; + changed = true; } - if (dependOn) { - const entry = this.entrypoints.get(name); - const referencedChunks = entry - .getEntrypointChunk() - .getAllReferencedChunks(); - const dependOnEntries = []; - for (const dep of dependOn) { - const dependency = this.entrypoints.get(dep); - if (!dependency) { - throw new Error( - `Entry ${name} depends on ${dep}, but this entry was not found` - ); - } - if (referencedChunks.has(dependency.getEntrypointChunk())) { - const err = new WebpackError( - `Entrypoints '${name}' and '${dep}' use 'dependOn' to depend on each other in a circular way.` - ); - const entryChunk = entry.getEntrypointChunk(); - err.chunk = entryChunk; - this.errors.push(err); - entry.setRuntimeChunk(entryChunk); - continue outer; - } - dependOnEntries.push(dependency); - } - for (const dependency of dependOnEntries) { - connectChunkGroupParentAndChild(dependency, entry); - } - } else if (runtime) { - const entry = this.entrypoints.get(name); - let chunk = this.namedChunks.get(runtime); - if (chunk) { - if (!runtimeChunks.has(chunk)) { - const err = - new WebpackError(`Entrypoint '${name}' has a 'runtime' option which points to another entrypoint named '${runtime}'. -It's not valid to use other entrypoints as runtime chunk. -Did you mean to use 'dependOn: ${JSON.stringify( - runtime - )}' instead to allow using entrypoint '${name}' within the runtime of entrypoint '${runtime}'? For this '${runtime}' must always be loaded when '${name}' is used. -Or do you want to use the entrypoints '${name}' and '${runtime}' independently on the same page with a shared runtime? In this case give them both the same value for the 'runtime' option. It must be a name not already used by an entrypoint.`); - const entryChunk = entry.getEntrypointChunk(); - err.chunk = entryChunk; - this.errors.push(err); - entry.setRuntimeChunk(entryChunk); - continue; - } - } else { - chunk = this.addChunk(runtime); - chunk.preventIntegration = true; - runtimeChunks.add(chunk); - } - entry.unshiftChunk(chunk); - chunk.addGroup(entry); - entry.setRuntimeChunk(chunk); + if (!canMangle && this._otherExportsInfo.canMangleProvide !== false) { + this._otherExportsInfo.canMangleProvide = false; + changed = true; + } + if (targetKey) { + this._otherExportsInfo.setTarget( + targetKey, + targetModule, + undefined, + priority + ); } } - buildChunkGraph(this, chunkGraphInit); - this.hooks.afterChunks.call(this.chunks); - this.logger.timeEnd("create chunks"); - - this.logger.time("optimize"); - this.hooks.optimize.call(); + return changed; + } - while (this.hooks.optimizeModules.call(this.modules)) { - /* empty */ + /** + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true, when something changed + */ + setUsedInUnknownWay(runtime) { + let changed = false; + for (const exportInfo of this._exports.values()) { + if (exportInfo.setUsedInUnknownWay(runtime)) { + changed = true; + } } - this.hooks.afterOptimizeModules.call(this.modules); - - while (this.hooks.optimizeChunks.call(this.chunks, this.chunkGroups)) { - /* empty */ + if (this._redirectTo !== undefined) { + if (this._redirectTo.setUsedInUnknownWay(runtime)) { + changed = true; + } + } else { + if ( + this._otherExportsInfo.setUsedConditionally( + used => used < UsageState.Unknown, + UsageState.Unknown, + runtime + ) + ) { + changed = true; + } + if (this._otherExportsInfo.canMangleUse !== false) { + this._otherExportsInfo.canMangleUse = false; + changed = true; + } } - this.hooks.afterOptimizeChunks.call(this.chunks, this.chunkGroups); + return changed; + } - this.hooks.optimizeTree.callAsync(this.chunks, this.modules, err => { - if (err) { - return finalCallback( - makeWebpackError(err, "Compilation.hooks.optimizeTree") - ); + /** + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true, when something changed + */ + setUsedWithoutInfo(runtime) { + let changed = false; + for (const exportInfo of this._exports.values()) { + if (exportInfo.setUsedWithoutInfo(runtime)) { + changed = true; } - - this.hooks.afterOptimizeTree.call(this.chunks, this.modules); - - this.hooks.optimizeChunkModules.callAsync( - this.chunks, - this.modules, - err => { - if (err) { - return finalCallback( - makeWebpackError(err, "Compilation.hooks.optimizeChunkModules") - ); - } - - this.hooks.afterOptimizeChunkModules.call(this.chunks, this.modules); - - const shouldRecord = this.hooks.shouldRecord.call() !== false; - - this.hooks.reviveModules.call(this.modules, this.records); - this.hooks.beforeModuleIds.call(this.modules); - this.hooks.moduleIds.call(this.modules); - this.hooks.optimizeModuleIds.call(this.modules); - this.hooks.afterOptimizeModuleIds.call(this.modules); - - this.hooks.reviveChunks.call(this.chunks, this.records); - this.hooks.beforeChunkIds.call(this.chunks); - this.hooks.chunkIds.call(this.chunks); - this.hooks.optimizeChunkIds.call(this.chunks); - this.hooks.afterOptimizeChunkIds.call(this.chunks); - - this.assignRuntimeIds(); - - this.logger.time("compute affected modules with chunk graph"); - this._computeAffectedModulesWithChunkGraph(); - this.logger.timeEnd("compute affected modules with chunk graph"); - - this.sortItemsWithChunkIds(); - - if (shouldRecord) { - this.hooks.recordModules.call(this.modules, this.records); - this.hooks.recordChunks.call(this.chunks, this.records); - } - - this.hooks.optimizeCodeGeneration.call(this.modules); - this.logger.timeEnd("optimize"); - - this.logger.time("module hashing"); - this.hooks.beforeModuleHash.call(); - this.createModuleHashes(); - this.hooks.afterModuleHash.call(); - this.logger.timeEnd("module hashing"); - - this.logger.time("code generation"); - this.hooks.beforeCodeGeneration.call(); - this.codeGeneration(err => { - if (err) { - return finalCallback(err); - } - this.hooks.afterCodeGeneration.call(); - this.logger.timeEnd("code generation"); - - this.logger.time("runtime requirements"); - this.hooks.beforeRuntimeRequirements.call(); - this.processRuntimeRequirements(); - this.hooks.afterRuntimeRequirements.call(); - this.logger.timeEnd("runtime requirements"); - - this.logger.time("hashing"); - this.hooks.beforeHash.call(); - const codeGenerationJobs = this.createHash(); - this.hooks.afterHash.call(); - this.logger.timeEnd("hashing"); - - this._runCodeGenerationJobs(codeGenerationJobs, err => { - if (err) { - return finalCallback(err); - } - - if (shouldRecord) { - this.logger.time("record hash"); - this.hooks.recordHash.call(this.records); - this.logger.timeEnd("record hash"); - } - - this.logger.time("module assets"); - this.clearAssets(); - - this.hooks.beforeModuleAssets.call(); - this.createModuleAssets(); - this.logger.timeEnd("module assets"); - - const cont = () => { - this.logger.time("process assets"); - this.hooks.processAssets.callAsync(this.assets, err => { - if (err) { - return finalCallback( - makeWebpackError(err, "Compilation.hooks.processAssets") - ); - } - this.hooks.afterProcessAssets.call(this.assets); - this.logger.timeEnd("process assets"); - this.assets = this._backCompat - ? soonFrozenObjectDeprecation( - this.assets, - "Compilation.assets", - "DEP_WEBPACK_COMPILATION_ASSETS", - `BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation. - Do changes to assets earlier, e. g. in Compilation.hooks.processAssets. - Make sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_*.` - ) - : Object.freeze(this.assets); - - this.summarizeDependencies(); - if (shouldRecord) { - this.hooks.record.call(this, this.records); - } - - if (this.hooks.needAdditionalSeal.call()) { - this.unseal(); - return this.seal(callback); - } - return this.hooks.afterSeal.callAsync(err => { - if (err) { - return finalCallback( - makeWebpackError(err, "Compilation.hooks.afterSeal") - ); - } - this.fileSystemInfo.logStatistics(); - finalCallback(); - }); - }); - }; - - this.logger.time("create chunk assets"); - if (this.hooks.shouldGenerateChunkAssets.call() !== false) { - this.hooks.beforeChunkAssets.call(); - this.createChunkAssets(err => { - this.logger.timeEnd("create chunk assets"); - if (err) { - return finalCallback(err); - } - cont(); - }); - } else { - this.logger.timeEnd("create chunk assets"); - cont(); - } - }); - }); - } - ); - }); + } + if (this._redirectTo !== undefined) { + if (this._redirectTo.setUsedWithoutInfo(runtime)) { + changed = true; + } + } else { + if (this._otherExportsInfo.setUsed(UsageState.NoInfo, runtime)) { + changed = true; + } + if (this._otherExportsInfo.canMangleUse !== false) { + this._otherExportsInfo.canMangleUse = false; + changed = true; + } + } + return changed; } /** - * @param {Module} module module to report from - * @param {DependenciesBlock[]} blocks blocks to report from - * @returns {boolean} true, when it has warnings or errors + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true, when something changed */ - reportDependencyErrorsAndWarnings(module, blocks) { - let hasProblems = false; - for (let indexBlock = 0; indexBlock < blocks.length; indexBlock++) { - const block = blocks[indexBlock]; - const dependencies = block.dependencies; - - for (let indexDep = 0; indexDep < dependencies.length; indexDep++) { - const d = dependencies[indexDep]; - - const warnings = d.getWarnings(this.moduleGraph); - if (warnings) { - for (let indexWar = 0; indexWar < warnings.length; indexWar++) { - const w = warnings[indexWar]; - - const warning = new ModuleDependencyWarning(module, w, d.loc); - this.warnings.push(warning); - hasProblems = true; - } - } - const errors = d.getErrors(this.moduleGraph); - if (errors) { - for (let indexErr = 0; indexErr < errors.length; indexErr++) { - const e = errors[indexErr]; - - const error = new ModuleDependencyError(module, e, d.loc); - this.errors.push(error); - hasProblems = true; - } - } + setAllKnownExportsUsed(runtime) { + let changed = false; + for (const exportInfo of this._exports.values()) { + if (!exportInfo.provided) continue; + if (exportInfo.setUsed(UsageState.Used, runtime)) { + changed = true; } - - if (this.reportDependencyErrorsAndWarnings(module, block.blocks)) - hasProblems = true; } - return hasProblems; + return changed; } - codeGeneration(callback) { - const { chunkGraph } = this; - this.codeGenerationResults = new CodeGenerationResults( - this.outputOptions.hashFunction + /** + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true, when something changed + */ + setUsedForSideEffectsOnly(runtime) { + return this._sideEffectsOnlyInfo.setUsedConditionally( + used => used === UsageState.Unused, + UsageState.Used, + runtime ); - /** @type {{module: Module, hash: string, runtime: RuntimeSpec, runtimes: RuntimeSpec[]}[]} */ - const jobs = []; - for (const module of this.modules) { - const runtimes = chunkGraph.getModuleRuntimes(module); - if (runtimes.size === 1) { - for (const runtime of runtimes) { - const hash = chunkGraph.getModuleHash(module, runtime); - jobs.push({ module, hash, runtime, runtimes: [runtime] }); - } - } else if (runtimes.size > 1) { - /** @type {Map} */ - const map = new Map(); - for (const runtime of runtimes) { - const hash = chunkGraph.getModuleHash(module, runtime); - const job = map.get(hash); - if (job === undefined) { - const newJob = { module, hash, runtime, runtimes: [runtime] }; - jobs.push(newJob); - map.set(hash, newJob); - } else { - job.runtimes.push(runtime); - } - } + } + + /** + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true, when the module exports are used in any way + */ + isUsed(runtime) { + if (this._redirectTo !== undefined) { + if (this._redirectTo.isUsed(runtime)) { + return true; + } + } else { + if (this._otherExportsInfo.getUsed(runtime) !== UsageState.Unused) { + return true; + } + } + for (const exportInfo of this._exports.values()) { + if (exportInfo.getUsed(runtime) !== UsageState.Unused) { + return true; } } + return false; + } - this._runCodeGenerationJobs(jobs, callback); - } - - _runCodeGenerationJobs(jobs, callback) { - let statModulesFromCache = 0; - let statModulesGenerated = 0; - const { chunkGraph, moduleGraph, dependencyTemplates, runtimeTemplate } = - this; - const results = this.codeGenerationResults; - const errors = []; - /** @type {Set | undefined} */ - let notCodeGeneratedModules = undefined; - const runIteration = () => { - let delayedJobs = []; - let delayedModules = new Set(); - asyncLib.eachLimit( - jobs, - this.options.parallelism, - (job, callback) => { - const { module } = job; - const { codeGenerationDependencies } = module; - if (codeGenerationDependencies !== undefined) { - if ( - notCodeGeneratedModules === undefined || - codeGenerationDependencies.some(dep => { - const referencedModule = moduleGraph.getModule(dep); - return notCodeGeneratedModules.has(referencedModule); - }) - ) { - delayedJobs.push(job); - delayedModules.add(module); - return callback(); - } - } - const { hash, runtime, runtimes } = job; - this._codeGenerationModule( - module, - runtime, - runtimes, - hash, - dependencyTemplates, - chunkGraph, - moduleGraph, - runtimeTemplate, - errors, - results, - (err, codeGenerated) => { - if (codeGenerated) statModulesGenerated++; - else statModulesFromCache++; - callback(err); - } - ); - }, - err => { - if (err) return callback(err); - if (delayedJobs.length > 0) { - if (delayedJobs.length === jobs.length) { - return callback( - new Error( - `Unable to make progress during code generation because of circular code generation dependency: ${Array.from( - delayedModules, - m => m.identifier() - ).join(", ")}` - ) - ); - } - jobs = delayedJobs; - delayedJobs = []; - notCodeGeneratedModules = delayedModules; - delayedModules = new Set(); - return runIteration(); - } - if (errors.length > 0) { - errors.sort( - compareSelect(err => err.module, compareModulesByIdentifier) - ); - for (const error of errors) { - this.errors.push(error); - } - } - this.logger.log( - `${Math.round( - (100 * statModulesGenerated) / - (statModulesGenerated + statModulesFromCache) - )}% code generated (${statModulesGenerated} generated, ${statModulesFromCache} from cache)` - ); - callback(); - } - ); - }; - runIteration(); + /** + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true, when the module is used in any way + */ + isModuleUsed(runtime) { + if (this.isUsed(runtime)) return true; + if (this._sideEffectsOnlyInfo.getUsed(runtime) !== UsageState.Unused) + return true; + return false; } /** - * @param {Module} module module - * @param {RuntimeSpec} runtime runtime - * @param {RuntimeSpec[]} runtimes runtimes - * @param {string} hash hash - * @param {DependencyTemplates} dependencyTemplates dependencyTemplates - * @param {ChunkGraph} chunkGraph chunkGraph - * @param {ModuleGraph} moduleGraph moduleGraph - * @param {RuntimeTemplate} runtimeTemplate runtimeTemplate - * @param {WebpackError[]} errors errors - * @param {CodeGenerationResults} results results - * @param {function(WebpackError=, boolean=): void} callback callback + * @param {RuntimeSpec} runtime the runtime + * @returns {SortableSet | boolean | null} set of used exports, or true (when namespace object is used), or false (when unused), or null (when unknown) */ - _codeGenerationModule( - module, - runtime, - runtimes, - hash, - dependencyTemplates, - chunkGraph, - moduleGraph, - runtimeTemplate, - errors, - results, - callback - ) { - let codeGenerated = false; - const cache = new MultiItemCache( - runtimes.map(runtime => - this._codeGenerationCache.getItemCache( - `${module.identifier()}|${getRuntimeKey(runtime)}`, - `${hash}|${dependencyTemplates.getHash()}` - ) - ) - ); - cache.get((err, cachedResult) => { - if (err) return callback(err); - let result; - if (!cachedResult) { - try { - codeGenerated = true; - this.codeGeneratedModules.add(module); - result = module.codeGeneration({ - chunkGraph, - moduleGraph, - dependencyTemplates, - runtimeTemplate, - runtime, - codeGenerationResults: results - }); - } catch (err) { - errors.push(new CodeGenerationError(module, err)); - result = cachedResult = { - sources: new Map(), - runtimeRequirements: null - }; - } - } else { - result = cachedResult; + getUsedExports(runtime) { + if (!this._redirectTo !== undefined) { + switch (this._otherExportsInfo.getUsed(runtime)) { + case UsageState.NoInfo: + return null; + case UsageState.Unknown: + case UsageState.OnlyPropertiesUsed: + case UsageState.Used: + return true; } - for (const runtime of runtimes) { - results.add(module, runtime, result); + } + const array = []; + if (!this._exportsAreOrdered) this._sortExports(); + for (const exportInfo of this._exports.values()) { + switch (exportInfo.getUsed(runtime)) { + case UsageState.NoInfo: + return null; + case UsageState.Unknown: + return true; + case UsageState.OnlyPropertiesUsed: + case UsageState.Used: + array.push(exportInfo.name); } - if (!cachedResult) { - cache.store(result, err => callback(err, codeGenerated)); - } else { - callback(null, codeGenerated); + } + if (this._redirectTo !== undefined) { + const inner = this._redirectTo.getUsedExports(runtime); + if (inner === null) return null; + if (inner === true) return true; + if (inner !== false) { + for (const item of inner) { + array.push(item); + } } - }); - } - - _getChunkGraphEntries() { - /** @type {Set} */ - const treeEntries = new Set(); - for (const ep of this.entrypoints.values()) { - const chunk = ep.getRuntimeChunk(); - if (chunk) treeEntries.add(chunk); } - for (const ep of this.asyncEntrypoints) { - const chunk = ep.getRuntimeChunk(); - if (chunk) treeEntries.add(chunk); + if (array.length === 0) { + switch (this._sideEffectsOnlyInfo.getUsed(runtime)) { + case UsageState.NoInfo: + return null; + case UsageState.Unused: + return false; + } } - return treeEntries; + return new SortableSet(array); } /** - * @param {Object} options options - * @param {ChunkGraph=} options.chunkGraph the chunk graph - * @param {Iterable=} options.modules modules - * @param {Iterable=} options.chunks chunks - * @param {CodeGenerationResults=} options.codeGenerationResults codeGenerationResults - * @param {Iterable=} options.chunkGraphEntries chunkGraphEntries - * @returns {void} + * @returns {null | true | string[]} list of exports when known */ - processRuntimeRequirements({ - chunkGraph = this.chunkGraph, - modules = this.modules, - chunks = this.chunks, - codeGenerationResults = this.codeGenerationResults, - chunkGraphEntries = this._getChunkGraphEntries() - } = {}) { - const context = { chunkGraph, codeGenerationResults }; - const { moduleMemCaches2 } = this; - this.logger.time("runtime requirements.modules"); - const additionalModuleRuntimeRequirements = - this.hooks.additionalModuleRuntimeRequirements; - const runtimeRequirementInModule = this.hooks.runtimeRequirementInModule; - for (const module of modules) { - if (chunkGraph.getNumberOfModuleChunks(module) > 0) { - const memCache = moduleMemCaches2 && moduleMemCaches2.get(module); - for (const runtime of chunkGraph.getModuleRuntimes(module)) { - if (memCache) { - const cached = memCache.get( - `moduleRuntimeRequirements-${getRuntimeKey(runtime)}` - ); - if (cached !== undefined) { - if (cached !== null) { - chunkGraph.addModuleRuntimeRequirements( - module, - runtime, - cached, - false - ); - } - continue; - } - } - let set; - const runtimeRequirements = - codeGenerationResults.getRuntimeRequirements(module, runtime); - if (runtimeRequirements && runtimeRequirements.size > 0) { - set = new Set(runtimeRequirements); - } else if (additionalModuleRuntimeRequirements.isUsed()) { - set = new Set(); - } else { - if (memCache) { - memCache.set( - `moduleRuntimeRequirements-${getRuntimeKey(runtime)}`, - null - ); - } - continue; - } - additionalModuleRuntimeRequirements.call(module, set, context); - - for (const r of set) { - const hook = runtimeRequirementInModule.get(r); - if (hook !== undefined) hook.call(module, set, context); - } - if (set.size === 0) { - if (memCache) { - memCache.set( - `moduleRuntimeRequirements-${getRuntimeKey(runtime)}`, - null - ); - } - } else { - if (memCache) { - memCache.set( - `moduleRuntimeRequirements-${getRuntimeKey(runtime)}`, - set - ); - chunkGraph.addModuleRuntimeRequirements( - module, - runtime, - set, - false - ); - } else { - chunkGraph.addModuleRuntimeRequirements(module, runtime, set); - } - } - } + getProvidedExports() { + if (!this._redirectTo !== undefined) { + switch (this._otherExportsInfo.provided) { + case undefined: + return null; + case null: + return true; + case true: + return true; } } - this.logger.timeEnd("runtime requirements.modules"); - - this.logger.time("runtime requirements.chunks"); - for (const chunk of chunks) { - const set = new Set(); - for (const module of chunkGraph.getChunkModulesIterable(chunk)) { - const runtimeRequirements = chunkGraph.getModuleRuntimeRequirements( - module, - chunk.runtime - ); - for (const r of runtimeRequirements) set.add(r); - } - this.hooks.additionalChunkRuntimeRequirements.call(chunk, set, context); - - for (const r of set) { - this.hooks.runtimeRequirementInChunk.for(r).call(chunk, set, context); + const array = []; + if (!this._exportsAreOrdered) this._sortExports(); + for (const exportInfo of this._exports.values()) { + switch (exportInfo.provided) { + case undefined: + return null; + case null: + return true; + case true: + array.push(exportInfo.name); } - - chunkGraph.addChunkRuntimeRequirements(chunk, set); } - this.logger.timeEnd("runtime requirements.chunks"); - - this.logger.time("runtime requirements.entries"); - for (const treeEntry of chunkGraphEntries) { - const set = new Set(); - for (const chunk of treeEntry.getAllReferencedChunks()) { - const runtimeRequirements = - chunkGraph.getChunkRuntimeRequirements(chunk); - for (const r of runtimeRequirements) set.add(r); - } - - this.hooks.additionalTreeRuntimeRequirements.call( - treeEntry, - set, - context - ); - - for (const r of set) { - this.hooks.runtimeRequirementInTree - .for(r) - .call(treeEntry, set, context); + if (this._redirectTo !== undefined) { + const inner = this._redirectTo.getProvidedExports(); + if (inner === null) return null; + if (inner === true) return true; + for (const item of inner) { + if (!array.includes(item)) { + array.push(item); + } } - - chunkGraph.addTreeRuntimeRequirements(treeEntry, set); } - this.logger.timeEnd("runtime requirements.entries"); + return array; } - // TODO webpack 6 make chunkGraph argument non-optional /** - * @param {Chunk} chunk target chunk - * @param {RuntimeModule} module runtime module - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {void} + * @param {RuntimeSpec} runtime the runtime + * @returns {ExportInfo[]} exports that are relevant (not unused and potential provided) */ - addRuntimeModule(chunk, module, chunkGraph = this.chunkGraph) { - // Deprecated ModuleGraph association - if (this._backCompat) - ModuleGraph.setModuleGraphForModule(module, this.moduleGraph); - - // add it to the list - this.modules.add(module); - this._modules.set(module.identifier(), module); - - // connect to the chunk graph - chunkGraph.connectChunkAndModule(chunk, module); - chunkGraph.connectChunkAndRuntimeModule(chunk, module); - if (module.fullHash) { - chunkGraph.addFullHashModuleToChunk(chunk, module); - } else if (module.dependentHash) { - chunkGraph.addDependentHashModuleToChunk(chunk, module); + getRelevantExports(runtime) { + const list = []; + for (const exportInfo of this._exports.values()) { + const used = exportInfo.getUsed(runtime); + if (used === UsageState.Unused) continue; + if (exportInfo.provided === false) continue; + list.push(exportInfo); } - - // attach runtime module - module.attach(this, chunk, chunkGraph); - - // Setup internals - const exportsInfo = this.moduleGraph.getExportsInfo(module); - exportsInfo.setHasProvideInfo(); - if (typeof chunk.runtime === "string") { - exportsInfo.setUsedForSideEffectsOnly(chunk.runtime); - } else if (chunk.runtime === undefined) { - exportsInfo.setUsedForSideEffectsOnly(undefined); - } else { - for (const runtime of chunk.runtime) { - exportsInfo.setUsedForSideEffectsOnly(runtime); + if (this._redirectTo !== undefined) { + for (const exportInfo of this._redirectTo.getRelevantExports(runtime)) { + if (!this._exports.has(exportInfo.name)) list.push(exportInfo); } } - chunkGraph.addModuleRuntimeRequirements( - module, - chunk.runtime, - new Set([RuntimeGlobals.requireScope]) - ); - - // runtime modules don't need ids - chunkGraph.setModuleId(module, ""); - - // Call hook - this.hooks.runtimeModule.call(module, chunk); + if ( + this._otherExportsInfo.provided !== false && + this._otherExportsInfo.getUsed(runtime) !== UsageState.Unused + ) { + list.push(this._otherExportsInfo); + } + return list; } /** - * If `module` is passed, `loc` and `request` must also be passed. - * @param {string | ChunkGroupOptions} groupOptions options for the chunk group - * @param {Module=} module the module the references the chunk group - * @param {DependencyLocation=} loc the location from with the chunk group is referenced (inside of module) - * @param {string=} request the request from which the the chunk group is referenced - * @returns {ChunkGroup} the new or existing chunk group + * @param {string | string[]} name the name of the export + * @returns {boolean | undefined | null} if the export is provided */ - addChunkInGroup(groupOptions, module, loc, request) { - if (typeof groupOptions === "string") { - groupOptions = { name: groupOptions }; - } - const name = groupOptions.name; - - if (name) { - const chunkGroup = this.namedChunkGroups.get(name); - if (chunkGroup !== undefined) { - chunkGroup.addOptions(groupOptions); - if (module) { - chunkGroup.addOrigin(module, loc, request); - } - return chunkGroup; + isExportProvided(name) { + if (Array.isArray(name)) { + const info = this.getReadOnlyExportInfo(name[0]); + if (info.exportsInfo && name.length > 1) { + return info.exportsInfo.isExportProvided(name.slice(1)); } + return info.provided; } - const chunkGroup = new ChunkGroup(groupOptions); - if (module) chunkGroup.addOrigin(module, loc, request); - const chunk = this.addChunk(name); - - connectChunkGroupAndChunk(chunkGroup, chunk); + const info = this.getReadOnlyExportInfo(name); + return info.provided; + } - this.chunkGroups.push(chunkGroup); - if (name) { - this.namedChunkGroups.set(name, chunkGroup); + /** + * @param {RuntimeSpec} runtime runtime + * @returns {string} key representing the usage + */ + getUsageKey(runtime) { + const key = []; + if (this._redirectTo !== undefined) { + key.push(this._redirectTo.getUsageKey(runtime)); + } else { + key.push(this._otherExportsInfo.getUsed(runtime)); } - return chunkGroup; + key.push(this._sideEffectsOnlyInfo.getUsed(runtime)); + for (const exportInfo of this.orderedOwnedExports) { + key.push(exportInfo.getUsed(runtime)); + } + return key.join("|"); } /** - * @param {EntryOptions} options options for the entrypoint - * @param {Module} module the module the references the chunk group - * @param {DependencyLocation} loc the location from with the chunk group is referenced (inside of module) - * @param {string} request the request from which the the chunk group is referenced - * @returns {Entrypoint} the new or existing entrypoint + * @param {RuntimeSpec} runtimeA first runtime + * @param {RuntimeSpec} runtimeB second runtime + * @returns {boolean} true, when equally used */ - addAsyncEntrypoint(options, module, loc, request) { - const name = options.name; - if (name) { - const entrypoint = this.namedChunkGroups.get(name); - if (entrypoint instanceof Entrypoint) { - if (entrypoint !== undefined) { - if (module) { - entrypoint.addOrigin(module, loc, request); - } - return entrypoint; - } - } else if (entrypoint) { - throw new Error( - `Cannot add an async entrypoint with the name '${name}', because there is already an chunk group with this name` - ); + isEquallyUsed(runtimeA, runtimeB) { + if (this._redirectTo !== undefined) { + if (!this._redirectTo.isEquallyUsed(runtimeA, runtimeB)) return false; + } else { + if ( + this._otherExportsInfo.getUsed(runtimeA) !== + this._otherExportsInfo.getUsed(runtimeB) + ) { + return false; } } - const chunk = this.addChunk(name); - if (options.filename) { - chunk.filenameTemplate = options.filename; - } - const entrypoint = new Entrypoint(options, false); - entrypoint.setRuntimeChunk(chunk); - entrypoint.setEntrypointChunk(chunk); - if (name) { - this.namedChunkGroups.set(name, entrypoint); + if ( + this._sideEffectsOnlyInfo.getUsed(runtimeA) !== + this._sideEffectsOnlyInfo.getUsed(runtimeB) + ) { + return false; } - this.chunkGroups.push(entrypoint); - this.asyncEntrypoints.push(entrypoint); - connectChunkGroupAndChunk(entrypoint, chunk); - if (module) { - entrypoint.addOrigin(module, loc, request); + for (const exportInfo of this.ownedExports) { + if (exportInfo.getUsed(runtimeA) !== exportInfo.getUsed(runtimeB)) + return false; } - return entrypoint; + return true; } /** - * This method first looks to see if a name is provided for a new chunk, - * and first looks to see if any named chunks already exist and reuse that chunk instead. - * - * @param {string=} name optional chunk name to be provided - * @returns {Chunk} create a chunk (invoked during seal event) + * @param {string | string[]} name export name + * @param {RuntimeSpec} runtime check usage for this runtime only + * @returns {UsageStateType} usage status */ - addChunk(name) { - if (name) { - const chunk = this.namedChunks.get(name); - if (chunk !== undefined) { - return chunk; + getUsed(name, runtime) { + if (Array.isArray(name)) { + if (name.length === 0) return this.otherExportsInfo.getUsed(runtime); + let info = this.getReadOnlyExportInfo(name[0]); + if (info.exportsInfo && name.length > 1) { + return info.exportsInfo.getUsed(name.slice(1), runtime); } + return info.getUsed(runtime); } - const chunk = new Chunk(name, this._backCompat); - this.chunks.add(chunk); - if (this._backCompat) - ChunkGraph.setChunkGraphForChunk(chunk, this.chunkGraph); - if (name) { - this.namedChunks.set(name, chunk); - } - return chunk; + let info = this.getReadOnlyExportInfo(name); + return info.getUsed(runtime); } /** - * @deprecated - * @param {Module} module module to assign depth - * @returns {void} + * @param {string | string[]} name the export name + * @param {RuntimeSpec} runtime check usage for this runtime only + * @returns {string | string[] | false} the used name */ - assignDepth(module) { - const moduleGraph = this.moduleGraph; - - const queue = new Set([module]); - let depth; - - moduleGraph.setDepth(module, 0); - - /** - * @param {Module} module module for processing - * @returns {void} - */ - const processModule = module => { - if (!moduleGraph.setDepthIfLower(module, depth)) return; - queue.add(module); - }; - - for (module of queue) { - queue.delete(module); - depth = moduleGraph.getDepth(module) + 1; - - for (const connection of moduleGraph.getOutgoingConnections(module)) { - const refModule = connection.module; - if (refModule) { - processModule(refModule); - } + getUsedName(name, runtime) { + if (Array.isArray(name)) { + // TODO improve this + if (name.length === 0) { + if (!this.isUsed(runtime)) return false; + return name; } - } - } - - /** - * @param {Set} modules module to assign depth - * @returns {void} - */ - assignDepths(modules) { - const moduleGraph = this.moduleGraph; - - /** @type {Set} */ - const queue = new Set(modules); - queue.add(1); - let depth = 0; - - let i = 0; - for (const module of queue) { - i++; - if (typeof module === "number") { - depth = module; - if (queue.size === i) return; - queue.add(depth + 1); + let info = this.getReadOnlyExportInfo(name[0]); + const x = info.getUsedName(name[0], runtime); + if (x === false) return false; + const arr = x === name[0] && name.length === 1 ? name : [x]; + if (name.length === 1) { + return arr; + } + if ( + info.exportsInfo && + info.getUsed(runtime) === UsageState.OnlyPropertiesUsed + ) { + const nested = info.exportsInfo.getUsedName(name.slice(1), runtime); + if (!nested) return false; + return arr.concat(nested); } else { - moduleGraph.setDepth(module, depth); - for (const { module: refModule } of moduleGraph.getOutgoingConnections( - module - )) { - if (refModule) { - queue.add(refModule); - } - } + return arr.concat(name.slice(1)); } + } else { + let info = this.getReadOnlyExportInfo(name); + const usedName = info.getUsedName(name, runtime); + return usedName; } } /** - * @param {Dependency} dependency the dependency + * @param {Hash} hash the hash * @param {RuntimeSpec} runtime the runtime - * @returns {(string[] | ReferencedExport)[]} referenced exports + * @returns {void} */ - getDependencyReferencedExports(dependency, runtime) { - const referencedExports = dependency.getReferencedExports( - this.moduleGraph, - runtime - ); - return this.hooks.dependencyReferencedExports.call( - referencedExports, - dependency, - runtime - ); + updateHash(hash, runtime) { + this._updateHash(hash, runtime, new Set()); } /** - * - * @param {Module} module module relationship for removal - * @param {DependenciesBlockLike} block //TODO: good description + * @param {Hash} hash the hash + * @param {RuntimeSpec} runtime the runtime + * @param {Set} alreadyVisitedExportsInfo for circular references * @returns {void} */ - removeReasonsOfDependencyBlock(module, block) { - if (block.blocks) { - for (const b of block.blocks) { - this.removeReasonsOfDependencyBlock(module, b); + _updateHash(hash, runtime, alreadyVisitedExportsInfo) { + const set = new Set(alreadyVisitedExportsInfo); + set.add(this); + for (const exportInfo of this.orderedExports) { + if (exportInfo.hasInfo(this._otherExportsInfo, runtime)) { + exportInfo._updateHash(hash, runtime, set); } } + this._sideEffectsOnlyInfo._updateHash(hash, runtime, set); + this._otherExportsInfo._updateHash(hash, runtime, set); + if (this._redirectTo !== undefined) { + this._redirectTo._updateHash(hash, runtime, set); + } + } - if (block.dependencies) { - for (const dep of block.dependencies) { - const originalModule = this.moduleGraph.getModule(dep); - if (originalModule) { - this.moduleGraph.removeConnection(dep); - - if (this.chunkGraph) { - for (const chunk of this.chunkGraph.getModuleChunks( - originalModule - )) { - this.patchChunksAfterReasonRemoval(originalModule, chunk); - } - } - } + getRestoreProvidedData() { + const otherProvided = this._otherExportsInfo.provided; + const otherCanMangleProvide = this._otherExportsInfo.canMangleProvide; + const otherTerminalBinding = this._otherExportsInfo.terminalBinding; + const exports = []; + for (const exportInfo of this.orderedExports) { + if ( + exportInfo.provided !== otherProvided || + exportInfo.canMangleProvide !== otherCanMangleProvide || + exportInfo.terminalBinding !== otherTerminalBinding || + exportInfo.exportsInfoOwned + ) { + exports.push({ + name: exportInfo.name, + provided: exportInfo.provided, + canMangleProvide: exportInfo.canMangleProvide, + terminalBinding: exportInfo.terminalBinding, + exportsInfo: exportInfo.exportsInfoOwned + ? exportInfo.exportsInfo.getRestoreProvidedData() + : undefined + }); } } + return new RestoreProvidedData( + exports, + otherProvided, + otherCanMangleProvide, + otherTerminalBinding + ); } - /** - * @param {Module} module module to patch tie - * @param {Chunk} chunk chunk to patch tie - * @returns {void} - */ - patchChunksAfterReasonRemoval(module, chunk) { - if (!module.hasReasons(this.moduleGraph, chunk.runtime)) { - this.removeReasonsOfDependencyBlock(module, module); + restoreProvided({ + otherProvided, + otherCanMangleProvide, + otherTerminalBinding, + exports + }) { + let wasEmpty = true; + for (const exportInfo of this._exports.values()) { + wasEmpty = false; + exportInfo.provided = otherProvided; + exportInfo.canMangleProvide = otherCanMangleProvide; + exportInfo.terminalBinding = otherTerminalBinding; } - if (!module.hasReasonForChunk(chunk, this.moduleGraph, this.chunkGraph)) { - if (this.chunkGraph.isModuleInChunk(module, chunk)) { - this.chunkGraph.disconnectChunkAndModule(chunk, module); - this.removeChunkFromDependencies(module, chunk); + this._otherExportsInfo.provided = otherProvided; + this._otherExportsInfo.canMangleProvide = otherCanMangleProvide; + this._otherExportsInfo.terminalBinding = otherTerminalBinding; + for (const exp of exports) { + const exportInfo = this.getExportInfo(exp.name); + exportInfo.provided = exp.provided; + exportInfo.canMangleProvide = exp.canMangleProvide; + exportInfo.terminalBinding = exp.terminalBinding; + if (exp.exportsInfo) { + const exportsInfo = exportInfo.createNestedExportsInfo(); + exportsInfo.restoreProvided(exp.exportsInfo); } } + if (wasEmpty) this._exportsAreOrdered = true; } +} +class ExportInfo { /** - * - * @param {DependenciesBlock} block block tie for Chunk - * @param {Chunk} chunk chunk to remove from dep - * @returns {void} + * @param {string} name the original name of the export + * @param {ExportInfo=} initFrom init values from this ExportInfo */ - removeChunkFromDependencies(block, chunk) { + constructor(name, initFrom) { + /** @type {string} */ + this.name = name; + /** @private @type {string | null} */ + this._usedName = initFrom ? initFrom._usedName : null; + /** @private @type {UsageStateType} */ + this._globalUsed = initFrom ? initFrom._globalUsed : undefined; + /** @private @type {Map} */ + this._usedInRuntime = + initFrom && initFrom._usedInRuntime + ? new Map(initFrom._usedInRuntime) + : undefined; + /** @private @type {boolean} */ + this._hasUseInRuntimeInfo = initFrom + ? initFrom._hasUseInRuntimeInfo + : false; /** - * @param {Dependency} d dependency to (maybe) patch up + * true: it is provided + * false: it is not provided + * null: only the runtime knows if it is provided + * undefined: it was not determined if it is provided + * @type {boolean | null | undefined} */ - const iteratorDependency = d => { - const depModule = this.moduleGraph.getModule(d); - if (!depModule) { - return; - } - this.patchChunksAfterReasonRemoval(depModule, chunk); - }; - - const blocks = block.blocks; - for (let indexBlock = 0; indexBlock < blocks.length; indexBlock++) { - const asyncBlock = blocks[indexBlock]; - const chunkGroup = this.chunkGraph.getBlockChunkGroup(asyncBlock); - // Grab all chunks from the first Block's AsyncDepBlock - const chunks = chunkGroup.chunks; - // For each chunk in chunkGroup - for (let indexChunk = 0; indexChunk < chunks.length; indexChunk++) { - const iteratedChunk = chunks[indexChunk]; - chunkGroup.removeChunk(iteratedChunk); - // Recurse - this.removeChunkFromDependencies(block, iteratedChunk); + this.provided = initFrom ? initFrom.provided : undefined; + /** + * is the export a terminal binding that should be checked for export star conflicts + * @type {boolean} + */ + this.terminalBinding = initFrom ? initFrom.terminalBinding : false; + /** + * true: it can be mangled + * false: is can not be mangled + * undefined: it was not determined if it can be mangled + * @type {boolean | undefined} + */ + this.canMangleProvide = initFrom ? initFrom.canMangleProvide : undefined; + /** + * true: it can be mangled + * false: is can not be mangled + * undefined: it was not determined if it can be mangled + * @type {boolean | undefined} + */ + this.canMangleUse = initFrom ? initFrom.canMangleUse : undefined; + /** @type {boolean} */ + this.exportsInfoOwned = false; + /** @type {ExportsInfo=} */ + this.exportsInfo = undefined; + /** @type {Map=} */ + this._target = undefined; + if (initFrom && initFrom._target) { + this._target = new Map(); + for (const [key, value] of initFrom._target) { + this._target.set(key, { + connection: value.connection, + export: value.export || [name], + priority: value.priority + }); } } + /** @type {Map=} */ + this._maxTarget = undefined; + } - if (block.dependencies) { - for (const dep of block.dependencies) iteratorDependency(dep); + // TODO webpack 5 remove + /** @private */ + get used() { + throw new Error("REMOVED"); + } + /** @private */ + get usedName() { + throw new Error("REMOVED"); + } + /** + * @private + * @param {*} v v + */ + set used(v) { + throw new Error("REMOVED"); + } + /** + * @private + * @param {*} v v + */ + set usedName(v) { + throw new Error("REMOVED"); + } + + get canMangle() { + switch (this.canMangleProvide) { + case undefined: + return this.canMangleUse === false ? false : undefined; + case false: + return false; + case true: + switch (this.canMangleUse) { + case undefined: + return undefined; + case false: + return false; + case true: + return true; + } } + throw new Error( + `Unexpected flags for canMangle ${this.canMangleProvide} ${this.canMangleUse}` + ); } - assignRuntimeIds() { - const { chunkGraph } = this; - const processEntrypoint = ep => { - const runtime = ep.options.runtime || ep.name; - const chunk = ep.getRuntimeChunk(); - chunkGraph.setRuntimeId(runtime, chunk.id); - }; - for (const ep of this.entrypoints.values()) { - processEntrypoint(ep); + /** + * @param {RuntimeSpec} runtime only apply to this runtime + * @returns {boolean} true, when something changed + */ + setUsedInUnknownWay(runtime) { + let changed = false; + if ( + this.setUsedConditionally( + used => used < UsageState.Unknown, + UsageState.Unknown, + runtime + ) + ) { + changed = true; } - for (const ep of this.asyncEntrypoints) { - processEntrypoint(ep); + if (this.canMangleUse !== false) { + this.canMangleUse = false; + changed = true; } + return changed; } - sortItemsWithChunkIds() { - for (const chunkGroup of this.chunkGroups) { - chunkGroup.sortItems(); + /** + * @param {RuntimeSpec} runtime only apply to this runtime + * @returns {boolean} true, when something changed + */ + setUsedWithoutInfo(runtime) { + let changed = false; + if (this.setUsed(UsageState.NoInfo, runtime)) { + changed = true; } - - this.errors.sort(compareErrors); - this.warnings.sort(compareErrors); - this.children.sort(byNameOrHash); + if (this.canMangleUse !== false) { + this.canMangleUse = false; + changed = true; + } + return changed; } - summarizeDependencies() { - for ( - let indexChildren = 0; - indexChildren < this.children.length; - indexChildren++ - ) { - const child = this.children[indexChildren]; - - this.fileDependencies.addAll(child.fileDependencies); - this.contextDependencies.addAll(child.contextDependencies); - this.missingDependencies.addAll(child.missingDependencies); - this.buildDependencies.addAll(child.buildDependencies); + setHasUseInfo() { + if (!this._hasUseInRuntimeInfo) { + this._hasUseInRuntimeInfo = true; } - - for (const module of this.modules) { - module.addCacheDependencies( - this.fileDependencies, - this.contextDependencies, - this.missingDependencies, - this.buildDependencies - ); + if (this.canMangleUse === undefined) { + this.canMangleUse = true; + } + if (this.exportsInfoOwned) { + this.exportsInfo.setHasUseInfo(); } } - createModuleHashes() { - let statModulesHashed = 0; - let statModulesFromCache = 0; - const { chunkGraph, runtimeTemplate, moduleMemCaches2 } = this; - const { hashFunction, hashDigest, hashDigestLength } = this.outputOptions; - for (const module of this.modules) { - const memCache = moduleMemCaches2 && moduleMemCaches2.get(module); - for (const runtime of chunkGraph.getModuleRuntimes(module)) { - if (memCache) { - const digest = memCache.get(`moduleHash-${getRuntimeKey(runtime)}`); - if (digest !== undefined) { - chunkGraph.setModuleHashes( - module, - runtime, - digest, - digest.substr(0, hashDigestLength) - ); - statModulesFromCache++; - continue; - } + /** + * @param {function(UsageStateType): boolean} condition compare with old value + * @param {UsageStateType} newValue set when condition is true + * @param {RuntimeSpec} runtime only apply to this runtime + * @returns {boolean} true when something has changed + */ + setUsedConditionally(condition, newValue, runtime) { + if (runtime === undefined) { + if (this._globalUsed === undefined) { + this._globalUsed = newValue; + return true; + } else { + if (this._globalUsed !== newValue && condition(this._globalUsed)) { + this._globalUsed = newValue; + return true; } - statModulesHashed++; - const digest = this._createModuleHash( - module, - chunkGraph, - runtime, - hashFunction, - runtimeTemplate, - hashDigest, - hashDigestLength + } + } else if (this._usedInRuntime === undefined) { + if (newValue !== UsageState.Unused && condition(UsageState.Unused)) { + this._usedInRuntime = new Map(); + forEachRuntime(runtime, runtime => + this._usedInRuntime.set(runtime, newValue) ); - if (memCache) { - memCache.set(`moduleHash-${getRuntimeKey(runtime)}`, digest); + return true; + } + } else { + let changed = false; + forEachRuntime(runtime, runtime => { + /** @type {UsageStateType} */ + let oldValue = this._usedInRuntime.get(runtime); + if (oldValue === undefined) oldValue = UsageState.Unused; + if (newValue !== oldValue && condition(oldValue)) { + if (newValue === UsageState.Unused) { + this._usedInRuntime.delete(runtime); + } else { + this._usedInRuntime.set(runtime, newValue); + } + changed = true; } + }); + if (changed) { + if (this._usedInRuntime.size === 0) this._usedInRuntime = undefined; + return true; } } - this.logger.log( - `${statModulesHashed} modules hashed, ${statModulesFromCache} from cache (${ - Math.round( - (100 * (statModulesHashed + statModulesFromCache)) / this.modules.size - ) / 100 - } variants per module in average)` - ); - } - - _createModuleHash( - module, - chunkGraph, - runtime, - hashFunction, - runtimeTemplate, - hashDigest, - hashDigestLength - ) { - const moduleHash = createHash(hashFunction); - module.updateHash(moduleHash, { - chunkGraph, - runtime, - runtimeTemplate - }); - const moduleHashDigest = /** @type {string} */ ( - moduleHash.digest(hashDigest) - ); - chunkGraph.setModuleHashes( - module, - runtime, - moduleHashDigest, - moduleHashDigest.substr(0, hashDigestLength) - ); - return moduleHashDigest; + return false; } - createHash() { - this.logger.time("hashing: initialize hash"); - const chunkGraph = this.chunkGraph; - const runtimeTemplate = this.runtimeTemplate; - const outputOptions = this.outputOptions; - const hashFunction = outputOptions.hashFunction; - const hashDigest = outputOptions.hashDigest; - const hashDigestLength = outputOptions.hashDigestLength; - const hash = createHash(hashFunction); - if (outputOptions.hashSalt) { - hash.update(outputOptions.hashSalt); - } - this.logger.timeEnd("hashing: initialize hash"); - if (this.children.length > 0) { - this.logger.time("hashing: hash child compilations"); - for (const child of this.children) { - hash.update(child.hash); + /** + * @param {UsageStateType} newValue new value of the used state + * @param {RuntimeSpec} runtime only apply to this runtime + * @returns {boolean} true when something has changed + */ + setUsed(newValue, runtime) { + if (runtime === undefined) { + if (this._globalUsed !== newValue) { + this._globalUsed = newValue; + return true; } - this.logger.timeEnd("hashing: hash child compilations"); - } - if (this.warnings.length > 0) { - this.logger.time("hashing: hash warnings"); - for (const warning of this.warnings) { - hash.update(`${warning.message}`); + } else if (this._usedInRuntime === undefined) { + if (newValue !== UsageState.Unused) { + this._usedInRuntime = new Map(); + forEachRuntime(runtime, runtime => + this._usedInRuntime.set(runtime, newValue) + ); + return true; } - this.logger.timeEnd("hashing: hash warnings"); - } - if (this.errors.length > 0) { - this.logger.time("hashing: hash errors"); - for (const error of this.errors) { - hash.update(`${error.message}`); + } else { + let changed = false; + forEachRuntime(runtime, runtime => { + /** @type {UsageStateType} */ + let oldValue = this._usedInRuntime.get(runtime); + if (oldValue === undefined) oldValue = UsageState.Unused; + if (newValue !== oldValue) { + if (newValue === UsageState.Unused) { + this._usedInRuntime.delete(runtime); + } else { + this._usedInRuntime.set(runtime, newValue); + } + changed = true; + } + }); + if (changed) { + if (this._usedInRuntime.size === 0) this._usedInRuntime = undefined; + return true; } - this.logger.timeEnd("hashing: hash errors"); } + return false; + } - this.logger.time("hashing: sort chunks"); - /* - * all non-runtime chunks need to be hashes first, - * since runtime chunk might use their hashes. - * runtime chunks need to be hashed in the correct order - * since they may depend on each other (for async entrypoints). - * So we put all non-runtime chunks first and hash them in any order. - * And order runtime chunks according to referenced between each other. - * Chunks need to be in deterministic order since we add hashes to full chunk - * during these hashing. - */ - /** @type {Chunk[]} */ - const unorderedRuntimeChunks = []; - /** @type {Chunk[]} */ - const otherChunks = []; - for (const c of this.chunks) { - if (c.hasRuntime()) { - unorderedRuntimeChunks.push(c); - } else { - otherChunks.push(c); - } + /** + * @param {any} key the key + * @returns {boolean} true, if something has changed + */ + unsetTarget(key) { + if (!this._target) return false; + if (this._target.delete(key)) { + this._maxTarget = undefined; + return true; } - unorderedRuntimeChunks.sort(byId); - otherChunks.sort(byId); + return false; + } - /** @typedef {{ chunk: Chunk, referencedBy: RuntimeChunkInfo[], remaining: number }} RuntimeChunkInfo */ - /** @type {Map} */ - const runtimeChunksMap = new Map(); - for (const chunk of unorderedRuntimeChunks) { - runtimeChunksMap.set(chunk, { - chunk, - referencedBy: [], - remaining: 0 - }); - } - let remaining = 0; - for (const info of runtimeChunksMap.values()) { - for (const other of new Set( - Array.from(info.chunk.getAllReferencedAsyncEntrypoints()).map( - e => e.chunks[e.chunks.length - 1] - ) - )) { - const otherInfo = runtimeChunksMap.get(other); - otherInfo.referencedBy.push(info); - info.remaining++; - remaining++; - } - } - /** @type {Chunk[]} */ - const runtimeChunks = []; - for (const info of runtimeChunksMap.values()) { - if (info.remaining === 0) { - runtimeChunks.push(info.chunk); - } + /** + * @param {any} key the key + * @param {ModuleGraphConnection} connection the target module if a single one + * @param {string[]=} exportName the exported name + * @param {number=} priority priority + * @returns {boolean} true, if something has changed + */ + setTarget(key, connection, exportName, priority = 0) { + if (exportName) exportName = [...exportName]; + if (!this._target) { + this._target = new Map(); + this._target.set(key, { connection, export: exportName, priority }); + return true; } - // If there are any references between chunks - // make sure to follow these chains - if (remaining > 0) { - const readyChunks = []; - for (const chunk of runtimeChunks) { - const hasFullHashModules = - chunkGraph.getNumberOfChunkFullHashModules(chunk) !== 0; - const info = runtimeChunksMap.get(chunk); - for (const otherInfo of info.referencedBy) { - if (hasFullHashModules) { - chunkGraph.upgradeDependentToFullHashModules(otherInfo.chunk); - } - remaining--; - if (--otherInfo.remaining === 0) { - readyChunks.push(otherInfo.chunk); - } - } - if (readyChunks.length > 0) { - // This ensures deterministic ordering, since referencedBy is non-deterministic - readyChunks.sort(byId); - for (const c of readyChunks) runtimeChunks.push(c); - readyChunks.length = 0; - } - } + const oldTarget = this._target.get(key); + if (!oldTarget) { + if (oldTarget === null && !connection) return false; + this._target.set(key, { connection, export: exportName, priority }); + this._maxTarget = undefined; + return true; } - // If there are still remaining references we have cycles and want to create a warning - if (remaining > 0) { - let circularRuntimeChunkInfo = []; - for (const info of runtimeChunksMap.values()) { - if (info.remaining !== 0) { - circularRuntimeChunkInfo.push(info); - } - } - circularRuntimeChunkInfo.sort(compareSelect(i => i.chunk, byId)); - const err = - new WebpackError(`Circular dependency between chunks with runtime (${Array.from( - circularRuntimeChunkInfo, - c => c.chunk.name || c.chunk.id - ).join(", ")}) -This prevents using hashes of each other and should be avoided.`); - err.chunk = circularRuntimeChunkInfo[0].chunk; - this.warnings.push(err); - for (const i of circularRuntimeChunkInfo) runtimeChunks.push(i.chunk); + if ( + oldTarget.connection !== connection || + oldTarget.priority !== priority || + (exportName + ? !oldTarget.export || !equals(oldTarget.export, exportName) + : oldTarget.export) + ) { + oldTarget.connection = connection; + oldTarget.export = exportName; + oldTarget.priority = priority; + this._maxTarget = undefined; + return true; } - this.logger.timeEnd("hashing: sort chunks"); - - const fullHashChunks = new Set(); - /** @type {{module: Module, hash: string, runtime: RuntimeSpec, runtimes: RuntimeSpec[]}[]} */ - const codeGenerationJobs = []; - /** @type {Map>} */ - const codeGenerationJobsMap = new Map(); + return false; + } - const processChunk = chunk => { - // Last minute module hash generation for modules that depend on chunk hashes - this.logger.time("hashing: hash runtime modules"); - const runtime = chunk.runtime; - for (const module of chunkGraph.getChunkModulesIterable(chunk)) { - if (!chunkGraph.hasModuleHashes(module, runtime)) { - const hash = this._createModuleHash( - module, - chunkGraph, - runtime, - hashFunction, - runtimeTemplate, - hashDigest, - hashDigestLength - ); - let hashMap = codeGenerationJobsMap.get(hash); - if (hashMap) { - const moduleJob = hashMap.get(module); - if (moduleJob) { - moduleJob.runtimes.push(runtime); - continue; - } - } else { - hashMap = new Map(); - codeGenerationJobsMap.set(hash, hashMap); - } - const job = { - module, - hash, - runtime, - runtimes: [runtime] - }; - hashMap.set(module, job); - codeGenerationJobs.push(job); + /** + * @param {RuntimeSpec} runtime for this runtime + * @returns {UsageStateType} usage state + */ + getUsed(runtime) { + if (!this._hasUseInRuntimeInfo) return UsageState.NoInfo; + if (this._globalUsed !== undefined) return this._globalUsed; + if (this._usedInRuntime === undefined) { + return UsageState.Unused; + } else if (typeof runtime === "string") { + const value = this._usedInRuntime.get(runtime); + return value === undefined ? UsageState.Unused : value; + } else if (runtime === undefined) { + /** @type {UsageStateType} */ + let max = UsageState.Unused; + for (const value of this._usedInRuntime.values()) { + if (value === UsageState.Used) { + return UsageState.Used; } + if (max < value) max = value; } - this.logger.timeAggregate("hashing: hash runtime modules"); - this.logger.time("hashing: hash chunks"); - const chunkHash = createHash(hashFunction); - try { - if (outputOptions.hashSalt) { - chunkHash.update(outputOptions.hashSalt); - } - chunk.updateHash(chunkHash, chunkGraph); - this.hooks.chunkHash.call(chunk, chunkHash, { - chunkGraph, - codeGenerationResults: this.codeGenerationResults, - moduleGraph: this.moduleGraph, - runtimeTemplate: this.runtimeTemplate - }); - const chunkHashDigest = /** @type {string} */ ( - chunkHash.digest(hashDigest) - ); - hash.update(chunkHashDigest); - chunk.hash = chunkHashDigest; - chunk.renderedHash = chunk.hash.substr(0, hashDigestLength); - const fullHashModules = - chunkGraph.getChunkFullHashModulesIterable(chunk); - if (fullHashModules) { - fullHashChunks.add(chunk); - } else { - this.hooks.contentHash.call(chunk); + return max; + } else { + /** @type {UsageStateType} */ + let max = UsageState.Unused; + for (const item of runtime) { + const value = this._usedInRuntime.get(item); + if (value !== undefined) { + if (value === UsageState.Used) { + return UsageState.Used; + } + if (max < value) max = value; } - } catch (err) { - this.errors.push(new ChunkRenderError(chunk, "", err)); - } - this.logger.timeAggregate("hashing: hash chunks"); - }; - otherChunks.forEach(processChunk); - for (const chunk of runtimeChunks) processChunk(chunk); - - this.logger.timeAggregateEnd("hashing: hash runtime modules"); - this.logger.timeAggregateEnd("hashing: hash chunks"); - this.logger.time("hashing: hash digest"); - this.hooks.fullHash.call(hash); - this.fullHash = /** @type {string} */ (hash.digest(hashDigest)); - this.hash = this.fullHash.substr(0, hashDigestLength); - this.logger.timeEnd("hashing: hash digest"); - - this.logger.time("hashing: process full hash modules"); - for (const chunk of fullHashChunks) { - for (const module of chunkGraph.getChunkFullHashModulesIterable(chunk)) { - const moduleHash = createHash(hashFunction); - module.updateHash(moduleHash, { - chunkGraph, - runtime: chunk.runtime, - runtimeTemplate - }); - const moduleHashDigest = /** @type {string} */ ( - moduleHash.digest(hashDigest) - ); - const oldHash = chunkGraph.getModuleHash(module, chunk.runtime); - chunkGraph.setModuleHashes( - module, - chunk.runtime, - moduleHashDigest, - moduleHashDigest.substr(0, hashDigestLength) - ); - codeGenerationJobsMap.get(oldHash).get(module).hash = moduleHashDigest; } - const chunkHash = createHash(hashFunction); - chunkHash.update(chunk.hash); - chunkHash.update(this.hash); - const chunkHashDigest = /** @type {string} */ ( - chunkHash.digest(hashDigest) - ); - chunk.hash = chunkHashDigest; - chunk.renderedHash = chunk.hash.substr(0, hashDigestLength); - this.hooks.contentHash.call(chunk); + return max; } - this.logger.timeEnd("hashing: process full hash modules"); - return codeGenerationJobs; } /** - * @param {string} file file name - * @param {Source} source asset source - * @param {AssetInfo} assetInfo extra asset information - * @returns {void} + * get used name + * @param {string | undefined} fallbackName fallback name for used exports with no name + * @param {RuntimeSpec} runtime check usage for this runtime only + * @returns {string | false} used name */ - emitAsset(file, source, assetInfo = {}) { - if (this.assets[file]) { - if (!isSourceEqual(this.assets[file], source)) { - this.errors.push( - new WebpackError( - `Conflict: Multiple assets emit different content to the same filename ${file}` - ) - ); - this.assets[file] = source; - this._setAssetInfo(file, assetInfo); - return; - } - const oldInfo = this.assetsInfo.get(file); - const newInfo = Object.assign({}, oldInfo, assetInfo); - this._setAssetInfo(file, newInfo, oldInfo); - return; - } - this.assets[file] = source; - this._setAssetInfo(file, assetInfo, undefined); - } - - _setAssetInfo(file, newInfo, oldInfo = this.assetsInfo.get(file)) { - if (newInfo === undefined) { - this.assetsInfo.delete(file); - } else { - this.assetsInfo.set(file, newInfo); - } - const oldRelated = oldInfo && oldInfo.related; - const newRelated = newInfo && newInfo.related; - if (oldRelated) { - for (const key of Object.keys(oldRelated)) { - const remove = name => { - const relatedIn = this._assetsRelatedIn.get(name); - if (relatedIn === undefined) return; - const entry = relatedIn.get(key); - if (entry === undefined) return; - entry.delete(file); - if (entry.size !== 0) return; - relatedIn.delete(key); - if (relatedIn.size === 0) this._assetsRelatedIn.delete(name); - }; - const entry = oldRelated[key]; - if (Array.isArray(entry)) { - entry.forEach(remove); - } else if (entry) { - remove(entry); - } - } - } - if (newRelated) { - for (const key of Object.keys(newRelated)) { - const add = name => { - let relatedIn = this._assetsRelatedIn.get(name); - if (relatedIn === undefined) { - this._assetsRelatedIn.set(name, (relatedIn = new Map())); + getUsedName(fallbackName, runtime) { + if (this._hasUseInRuntimeInfo) { + if (this._globalUsed !== undefined) { + if (this._globalUsed === UsageState.Unused) return false; + } else { + if (this._usedInRuntime === undefined) return false; + if (typeof runtime === "string") { + if (!this._usedInRuntime.has(runtime)) { + return false; } - let entry = relatedIn.get(key); - if (entry === undefined) { - relatedIn.set(key, (entry = new Set())); + } else if (runtime !== undefined) { + if ( + Array.from(runtime).every( + runtime => !this._usedInRuntime.has(runtime) + ) + ) { + return false; } - entry.add(file); - }; - const entry = newRelated[key]; - if (Array.isArray(entry)) { - entry.forEach(add); - } else if (entry) { - add(entry); } } } + if (this._usedName !== null) return this._usedName; + return this.name || fallbackName; } /** - * @param {string} file file name - * @param {Source | function(Source): Source} newSourceOrFunction new asset source or function converting old to new - * @param {AssetInfo | function(AssetInfo | undefined): AssetInfo} assetInfoUpdateOrFunction new asset info or function converting old to new + * @returns {boolean} true, when a mangled name of this export is set */ - updateAsset( - file, - newSourceOrFunction, - assetInfoUpdateOrFunction = undefined - ) { - if (!this.assets[file]) { - throw new Error( - `Called Compilation.updateAsset for not existing filename ${file}` - ); - } - if (typeof newSourceOrFunction === "function") { - this.assets[file] = newSourceOrFunction(this.assets[file]); - } else { - this.assets[file] = newSourceOrFunction; - } - if (assetInfoUpdateOrFunction !== undefined) { - const oldInfo = this.assetsInfo.get(file) || EMPTY_ASSET_INFO; - if (typeof assetInfoUpdateOrFunction === "function") { - this._setAssetInfo(file, assetInfoUpdateOrFunction(oldInfo), oldInfo); - } else { - this._setAssetInfo( - file, - cachedCleverMerge(oldInfo, assetInfoUpdateOrFunction), - oldInfo - ); - } - } - } - - renameAsset(file, newFile) { - const source = this.assets[file]; - if (!source) { - throw new Error( - `Called Compilation.renameAsset for not existing filename ${file}` - ); - } - if (this.assets[newFile]) { - if (!isSourceEqual(this.assets[file], source)) { - this.errors.push( - new WebpackError( - `Conflict: Called Compilation.renameAsset for already existing filename ${newFile} with different content` - ) - ); - } - } - const assetInfo = this.assetsInfo.get(file); - // Update related in all other assets - const relatedInInfo = this._assetsRelatedIn.get(file); - if (relatedInInfo) { - for (const [key, assets] of relatedInInfo) { - for (const name of assets) { - const info = this.assetsInfo.get(name); - if (!info) continue; - const related = info.related; - if (!related) continue; - const entry = related[key]; - let newEntry; - if (Array.isArray(entry)) { - newEntry = entry.map(x => (x === file ? newFile : x)); - } else if (entry === file) { - newEntry = newFile; - } else continue; - this.assetsInfo.set(name, { - ...info, - related: { - ...related, - [key]: newEntry - } - }); - } - } - } - this._setAssetInfo(file, undefined, assetInfo); - this._setAssetInfo(newFile, assetInfo); - delete this.assets[file]; - this.assets[newFile] = source; - for (const chunk of this.chunks) { - { - const size = chunk.files.size; - chunk.files.delete(file); - if (size !== chunk.files.size) { - chunk.files.add(newFile); - } - } - { - const size = chunk.auxiliaryFiles.size; - chunk.auxiliaryFiles.delete(file); - if (size !== chunk.auxiliaryFiles.size) { - chunk.auxiliaryFiles.add(newFile); - } - } - } + hasUsedName() { + return this._usedName !== null; } /** - * @param {string} file file name + * Sets the mangled name of this export + * @param {string} name the new name + * @returns {void} */ - deleteAsset(file) { - if (!this.assets[file]) { - return; - } - delete this.assets[file]; - const assetInfo = this.assetsInfo.get(file); - this._setAssetInfo(file, undefined, assetInfo); - const related = assetInfo && assetInfo.related; - if (related) { - for (const key of Object.keys(related)) { - const checkUsedAndDelete = file => { - if (!this._assetsRelatedIn.has(file)) { - this.deleteAsset(file); - } - }; - const items = related[key]; - if (Array.isArray(items)) { - items.forEach(checkUsedAndDelete); - } else if (items) { - checkUsedAndDelete(items); - } - } - } - // TODO If this becomes a performance problem - // store a reverse mapping from asset to chunk - for (const chunk of this.chunks) { - chunk.files.delete(file); - chunk.auxiliaryFiles.delete(file); - } - } - - getAssets() { - /** @type {Readonly[]} */ - const array = []; - for (const assetName of Object.keys(this.assets)) { - if (Object.prototype.hasOwnProperty.call(this.assets, assetName)) { - array.push({ - name: assetName, - source: this.assets[assetName], - info: this.assetsInfo.get(assetName) || EMPTY_ASSET_INFO - }); - } - } - return array; + setUsedName(name) { + this._usedName = name; } /** - * @param {string} name the name of the asset - * @returns {Readonly | undefined} the asset or undefined when not found + * @param {ModuleGraph} moduleGraph the module graph + * @param {function({ module: Module, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target + * @returns {ExportInfo | ExportsInfo | undefined} the terminal binding export(s) info if known */ - getAsset(name) { - if (!Object.prototype.hasOwnProperty.call(this.assets, name)) - return undefined; - return { - name, - source: this.assets[name], - info: this.assetsInfo.get(name) || EMPTY_ASSET_INFO - }; + getTerminalBinding(moduleGraph, resolveTargetFilter = RETURNS_TRUE) { + if (this.terminalBinding) return this; + const target = this.getTarget(moduleGraph, resolveTargetFilter); + if (!target) return undefined; + const exportsInfo = moduleGraph.getExportsInfo(target.module); + if (!target.export) return exportsInfo; + return exportsInfo.getReadOnlyExportInfoRecursive(target.export); } - clearAssets() { - for (const chunk of this.chunks) { - chunk.files.clear(); - chunk.auxiliaryFiles.clear(); - } + isReexport() { + return !this.terminalBinding && this._target && this._target.size > 0; } - createModuleAssets() { - const { chunkGraph } = this; - for (const module of this.modules) { - if (module.buildInfo.assets) { - const assetsInfo = module.buildInfo.assetsInfo; - for (const assetName of Object.keys(module.buildInfo.assets)) { - const fileName = this.getPath(assetName, { - chunkGraph: this.chunkGraph, - module - }); - for (const chunk of chunkGraph.getModuleChunksIterable(module)) { - chunk.auxiliaryFiles.add(fileName); - } - this.emitAsset( - fileName, - module.buildInfo.assets[assetName], - assetsInfo ? assetsInfo.get(assetName) : undefined - ); - this.hooks.moduleAsset.call(module, fileName); - } + _getMaxTarget() { + if (this._maxTarget !== undefined) return this._maxTarget; + if (this._target.size <= 1) return (this._maxTarget = this._target); + let maxPriority = -Infinity; + let minPriority = Infinity; + for (const { priority } of this._target.values()) { + if (maxPriority < priority) maxPriority = priority; + if (minPriority > priority) minPriority = priority; + } + // This should be very common + if (maxPriority === minPriority) return (this._maxTarget = this._target); + + // This is an edge case + const map = new Map(); + for (const [key, value] of this._target) { + if (maxPriority === value.priority) { + map.set(key, value); } } + this._maxTarget = map; + return map; } /** - * @param {RenderManifestOptions} options options object - * @returns {RenderManifestEntry[]} manifest entries + * @param {ModuleGraph} moduleGraph the module graph + * @param {function(Module): boolean} validTargetModuleFilter a valid target module + * @returns {{ module: Module, export: string[] | undefined } | undefined | false} the target, undefined when there is no target, false when no target is valid */ - getRenderManifest(options) { - return this.hooks.renderManifest.call([], options); + findTarget(moduleGraph, validTargetModuleFilter) { + return this._findTarget(moduleGraph, validTargetModuleFilter, new Set()); } /** - * @param {Callback} callback signals when the call finishes - * @returns {void} + * @param {ModuleGraph} moduleGraph the module graph + * @param {function(Module): boolean} validTargetModuleFilter a valid target module + * @param {Set | undefined} alreadyVisited set of already visited export info to avoid circular references + * @returns {{ module: Module, export: string[] | undefined } | undefined | false} the target, undefined when there is no target, false when no target is valid */ - createChunkAssets(callback) { - const outputOptions = this.outputOptions; - const cachedSourceMap = new WeakMap(); - /** @type {Map} */ - const alreadyWrittenFiles = new Map(); - - asyncLib.forEachLimit( - this.chunks, - 15, - (chunk, callback) => { - /** @type {RenderManifestEntry[]} */ - let manifest; - try { - manifest = this.getRenderManifest({ - chunk, - hash: this.hash, - fullHash: this.fullHash, - outputOptions, - codeGenerationResults: this.codeGenerationResults, - moduleTemplates: this.moduleTemplates, - dependencyTemplates: this.dependencyTemplates, - chunkGraph: this.chunkGraph, - moduleGraph: this.moduleGraph, - runtimeTemplate: this.runtimeTemplate - }); - } catch (err) { - this.errors.push(new ChunkRenderError(chunk, "", err)); - return callback(); - } - asyncLib.forEach( - manifest, - (fileManifest, callback) => { - const ident = fileManifest.identifier; - const usedHash = fileManifest.hash; - - const assetCacheItem = this._assetsCache.getItemCache( - ident, - usedHash - ); - - assetCacheItem.get((err, sourceFromCache) => { - /** @type {string | function(PathData, AssetInfo=): string} */ - let filenameTemplate; - /** @type {string} */ - let file; - /** @type {AssetInfo} */ - let assetInfo; - - let inTry = true; - const errorAndCallback = err => { - const filename = - file || - (typeof file === "string" - ? file - : typeof filenameTemplate === "string" - ? filenameTemplate - : ""); - - this.errors.push(new ChunkRenderError(chunk, filename, err)); - inTry = false; - return callback(); - }; - - try { - if ("filename" in fileManifest) { - file = fileManifest.filename; - assetInfo = fileManifest.info; - } else { - filenameTemplate = fileManifest.filenameTemplate; - const pathAndInfo = this.getPathWithInfo( - filenameTemplate, - fileManifest.pathOptions - ); - file = pathAndInfo.path; - assetInfo = fileManifest.info - ? { - ...pathAndInfo.info, - ...fileManifest.info - } - : pathAndInfo.info; - } - - if (err) { - return errorAndCallback(err); - } - - let source = sourceFromCache; - - // check if the same filename was already written by another chunk - const alreadyWritten = alreadyWrittenFiles.get(file); - if (alreadyWritten !== undefined) { - if (alreadyWritten.hash !== usedHash) { - inTry = false; - return callback( - new WebpackError( - `Conflict: Multiple chunks emit assets to the same filename ${file}` + - ` (chunks ${alreadyWritten.chunk.id} and ${chunk.id})` - ) - ); - } else { - source = alreadyWritten.source; - } - } else if (!source) { - // render the asset - source = fileManifest.render(); - - // Ensure that source is a cached source to avoid additional cost because of repeated access - if (!(source instanceof CachedSource)) { - const cacheEntry = cachedSourceMap.get(source); - if (cacheEntry) { - source = cacheEntry; - } else { - const cachedSource = new CachedSource(source); - cachedSourceMap.set(source, cachedSource); - source = cachedSource; - } - } - } - this.emitAsset(file, source, assetInfo); - if (fileManifest.auxiliary) { - chunk.auxiliaryFiles.add(file); - } else { - chunk.files.add(file); - } - this.hooks.chunkAsset.call(chunk, file); - alreadyWrittenFiles.set(file, { - hash: usedHash, - source, - chunk - }); - if (source !== sourceFromCache) { - assetCacheItem.store(source, err => { - if (err) return errorAndCallback(err); - inTry = false; - return callback(); - }); - } else { - inTry = false; - callback(); - } - } catch (err) { - if (!inTry) throw err; - errorAndCallback(err); - } - }); - }, - callback - ); - }, - callback - ); + _findTarget(moduleGraph, validTargetModuleFilter, alreadyVisited) { + if (!this._target || this._target.size === 0) return undefined; + let rawTarget = this._getMaxTarget().values().next().value; + if (!rawTarget) return undefined; + /** @type {{ module: Module, export: string[] | undefined }} */ + let target = { + module: rawTarget.connection.module, + export: rawTarget.export + }; + for (;;) { + if (validTargetModuleFilter(target.module)) return target; + const exportsInfo = moduleGraph.getExportsInfo(target.module); + const exportInfo = exportsInfo.getExportInfo(target.export[0]); + if (alreadyVisited.has(exportInfo)) return null; + const newTarget = exportInfo._findTarget( + moduleGraph, + validTargetModuleFilter, + alreadyVisited + ); + if (!newTarget) return false; + if (target.export.length === 1) { + target = newTarget; + } else { + target = { + module: newTarget.module, + export: newTarget.export + ? newTarget.export.concat(target.export.slice(1)) + : target.export.slice(1) + }; + } + } } /** - * @param {string | function(PathData, AssetInfo=): string} filename used to get asset path with hash - * @param {PathData} data context data - * @returns {string} interpolated path + * @param {ModuleGraph} moduleGraph the module graph + * @param {function({ module: Module, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target + * @returns {{ module: Module, export: string[] | undefined } | undefined} the target */ - getPath(filename, data = {}) { - if (!data.hash) { - data = { - hash: this.hash, - ...data - }; - } - return this.getAssetPath(filename, data); + getTarget(moduleGraph, resolveTargetFilter = RETURNS_TRUE) { + const result = this._getTarget(moduleGraph, resolveTargetFilter, undefined); + if (result === CIRCULAR) return undefined; + return result; } /** - * @param {string | function(PathData, AssetInfo=): string} filename used to get asset path with hash - * @param {PathData} data context data - * @returns {{ path: string, info: AssetInfo }} interpolated path and asset info + * @param {ModuleGraph} moduleGraph the module graph + * @param {function({ module: Module, connection: ModuleGraphConnection, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target + * @param {Set | undefined} alreadyVisited set of already visited export info to avoid circular references + * @returns {{ module: Module, connection: ModuleGraphConnection, export: string[] | undefined } | CIRCULAR | undefined} the target */ - getPathWithInfo(filename, data = {}) { - if (!data.hash) { - data = { - hash: this.hash, - ...data + _getTarget(moduleGraph, resolveTargetFilter, alreadyVisited) { + /** + * @param {{ connection: ModuleGraphConnection, export: string[] | undefined } | null} inputTarget unresolved target + * @param {Set} alreadyVisited set of already visited export info to avoid circular references + * @returns {{ module: Module, connection: ModuleGraphConnection, export: string[] | undefined } | CIRCULAR | null} resolved target + */ + const resolveTarget = (inputTarget, alreadyVisited) => { + if (!inputTarget) return null; + if (!inputTarget.export) { + return { + module: inputTarget.connection.module, + connection: inputTarget.connection, + export: undefined + }; + } + /** @type {{ module: Module, connection: ModuleGraphConnection, export: string[] | undefined }} */ + let target = { + module: inputTarget.connection.module, + connection: inputTarget.connection, + export: inputTarget.export }; + if (!resolveTargetFilter(target)) return target; + let alreadyVisitedOwned = false; + for (;;) { + const exportsInfo = moduleGraph.getExportsInfo(target.module); + const exportInfo = exportsInfo.getExportInfo(target.export[0]); + if (!exportInfo) return target; + if (alreadyVisited.has(exportInfo)) return CIRCULAR; + const newTarget = exportInfo._getTarget( + moduleGraph, + resolveTargetFilter, + alreadyVisited + ); + if (newTarget === CIRCULAR) return CIRCULAR; + if (!newTarget) return target; + if (target.export.length === 1) { + target = newTarget; + if (!target.export) return target; + } else { + target = { + module: newTarget.module, + connection: newTarget.connection, + export: newTarget.export + ? newTarget.export.concat(target.export.slice(1)) + : target.export.slice(1) + }; + } + if (!resolveTargetFilter(target)) return target; + if (!alreadyVisitedOwned) { + alreadyVisited = new Set(alreadyVisited); + alreadyVisitedOwned = true; + } + alreadyVisited.add(exportInfo); + } + }; + + if (!this._target || this._target.size === 0) return undefined; + if (alreadyVisited && alreadyVisited.has(this)) return CIRCULAR; + const newAlreadyVisited = new Set(alreadyVisited); + newAlreadyVisited.add(this); + const values = this._getMaxTarget().values(); + const target = resolveTarget(values.next().value, newAlreadyVisited); + if (target === CIRCULAR) return CIRCULAR; + if (target === null) return undefined; + let result = values.next(); + while (!result.done) { + const t = resolveTarget(result.value, newAlreadyVisited); + if (t === CIRCULAR) return CIRCULAR; + if (t === null) return undefined; + if (t.module !== target.module) return undefined; + if (!t.export !== !target.export) return undefined; + if (target.export && !equals(t.export, target.export)) return undefined; + result = values.next(); } - return this.getAssetPathWithInfo(filename, data); + return target; } /** - * @param {string | function(PathData, AssetInfo=): string} filename used to get asset path with hash - * @param {PathData} data context data - * @returns {string} interpolated path + * Move the target forward as long resolveTargetFilter is fulfilled + * @param {ModuleGraph} moduleGraph the module graph + * @param {function({ module: Module, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target + * @param {function({ module: Module, export: string[] | undefined }): ModuleGraphConnection=} updateOriginalConnection updates the original connection instead of using the target connection + * @returns {{ module: Module, export: string[] | undefined } | undefined} the resolved target when moved */ - getAssetPath(filename, data) { - return this.hooks.assetPath.call( - typeof filename === "function" ? filename(data) : filename, - data, - undefined - ); + moveTarget(moduleGraph, resolveTargetFilter, updateOriginalConnection) { + const target = this._getTarget(moduleGraph, resolveTargetFilter, undefined); + if (target === CIRCULAR) return undefined; + if (!target) return undefined; + const originalTarget = this._getMaxTarget().values().next().value; + if ( + originalTarget.connection === target.connection && + originalTarget.export === target.export + ) { + return undefined; + } + this._target.clear(); + this._target.set(undefined, { + connection: updateOriginalConnection + ? updateOriginalConnection(target) + : target.connection, + export: target.export, + priority: 0 + }); + return target; } - /** - * @param {string | function(PathData, AssetInfo=): string} filename used to get asset path with hash - * @param {PathData} data context data - * @returns {{ path: string, info: AssetInfo }} interpolated path and asset info - */ - getAssetPathWithInfo(filename, data) { - const assetInfo = {}; - // TODO webpack 5: refactor assetPath hook to receive { path, info } object - const newPath = this.hooks.assetPath.call( - typeof filename === "function" ? filename(data, assetInfo) : filename, - data, - assetInfo + createNestedExportsInfo() { + if (this.exportsInfoOwned) return this.exportsInfo; + this.exportsInfoOwned = true; + const oldExportsInfo = this.exportsInfo; + this.exportsInfo = new ExportsInfo(); + this.exportsInfo.setHasProvideInfo(); + if (oldExportsInfo) { + this.exportsInfo.setRedirectNamedTo(oldExportsInfo); + } + return this.exportsInfo; + } + + getNestedExportsInfo() { + return this.exportsInfo; + } + + hasInfo(baseInfo, runtime) { + return ( + (this._usedName && this._usedName !== this.name) || + this.provided || + this.terminalBinding || + this.getUsed(runtime) !== baseInfo.getUsed(runtime) ); - return { path: newPath, info: assetInfo }; } - getWarnings() { - return this.hooks.processWarnings.call(this.warnings); + updateHash(hash, runtime) { + this._updateHash(hash, runtime, new Set()); } - getErrors() { - return this.hooks.processErrors.call(this.errors); + _updateHash(hash, runtime, alreadyVisitedExportsInfo) { + hash.update( + `${this._usedName || this.name}${this.getUsed(runtime)}${this.provided}${ + this.terminalBinding + }` + ); + if (this.exportsInfo && !alreadyVisitedExportsInfo.has(this.exportsInfo)) { + this.exportsInfo._updateHash(hash, runtime, alreadyVisitedExportsInfo); + } } - /** - * This function allows you to run another instance of webpack inside of webpack however as - * a child with different settings and configurations (if desired) applied. It copies all hooks, plugins - * from parent (or top level compiler) and creates a child Compilation - * - * @param {string} name name of the child compiler - * @param {OutputOptions=} outputOptions // Need to convert config schema to types for this - * @param {Array=} plugins webpack plugins that will be applied - * @returns {Compiler} creates a child Compiler instance - */ - createChildCompiler(name, outputOptions, plugins) { - const idx = this.childrenCounters[name] || 0; - this.childrenCounters[name] = idx + 1; - return this.compiler.createChildCompiler( - this, - name, - idx, - outputOptions, - plugins + getUsedInfo() { + if (this._globalUsed !== undefined) { + switch (this._globalUsed) { + case UsageState.Unused: + return "unused"; + case UsageState.NoInfo: + return "no usage info"; + case UsageState.Unknown: + return "maybe used (runtime-defined)"; + case UsageState.Used: + return "used"; + case UsageState.OnlyPropertiesUsed: + return "only properties used"; + } + } else if (this._usedInRuntime !== undefined) { + /** @type {Map} */ + const map = new Map(); + for (const [runtime, used] of this._usedInRuntime) { + const list = map.get(used); + if (list !== undefined) list.push(runtime); + else map.set(used, [runtime]); + } + const specificInfo = Array.from(map, ([used, runtimes]) => { + switch (used) { + case UsageState.NoInfo: + return `no usage info in ${runtimes.join(", ")}`; + case UsageState.Unknown: + return `maybe used in ${runtimes.join(", ")} (runtime-defined)`; + case UsageState.Used: + return `used in ${runtimes.join(", ")}`; + case UsageState.OnlyPropertiesUsed: + return `only properties used in ${runtimes.join(", ")}`; + } + }); + if (specificInfo.length > 0) { + return specificInfo.join("; "); + } + } + return this._hasUseInRuntimeInfo ? "unused" : "no usage info"; + } + + getProvidedInfo() { + switch (this.provided) { + case undefined: + return "no provided info"; + case null: + return "maybe provided (runtime-defined)"; + case true: + return "provided"; + case false: + return "not provided"; + } + } + + getRenameInfo() { + if (this._usedName !== null && this._usedName !== this.name) { + return `renamed to ${JSON.stringify(this._usedName).slice(1, -1)}`; + } + switch (this.canMangleProvide) { + case undefined: + switch (this.canMangleUse) { + case undefined: + return "missing provision and use info prevents renaming"; + case false: + return "usage prevents renaming (no provision info)"; + case true: + return "missing provision info prevents renaming"; + } + break; + case true: + switch (this.canMangleUse) { + case undefined: + return "missing usage info prevents renaming"; + case false: + return "usage prevents renaming"; + case true: + return "could be renamed"; + } + break; + case false: + switch (this.canMangleUse) { + case undefined: + return "provision prevents renaming (no use info)"; + case false: + return "usage and provision prevents renaming"; + case true: + return "provision prevents renaming"; + } + break; + } + throw new Error( + `Unexpected flags for getRenameInfo ${this.canMangleProvide} ${this.canMangleUse}` ); } +} - /** - * @param {Module} module the module - * @param {ExecuteModuleOptions} options options - * @param {ExecuteModuleCallback} callback callback - */ - executeModule(module, options, callback) { - // Aggregate all referenced modules and ensure they are ready - const modules = new Set([module]); - processAsyncTree( - modules, - 10, - /** - * @param {Module} module the module - * @param {function(Module): void} push push more jobs - * @param {Callback} callback callback - * @returns {void} - */ - (module, push, callback) => { - this.buildQueue.waitFor(module, err => { - if (err) return callback(err); - this.processDependenciesQueue.waitFor(module, err => { - if (err) return callback(err); - for (const { module: m } of this.moduleGraph.getOutgoingConnections( - module - )) { - const size = modules.size; - modules.add(m); - if (modules.size !== size) push(m); - } - callback(); - }); - }); - }, - err => { - if (err) return callback(err); +module.exports = ExportsInfo; +module.exports.ExportInfo = ExportInfo; +module.exports.UsageState = UsageState; - // Create new chunk graph, chunk and entrypoint for the build time execution - const chunkGraph = new ChunkGraph( - this.moduleGraph, - this.outputOptions.hashFunction - ); - const runtime = "build time"; - const { hashFunction, hashDigest, hashDigestLength } = - this.outputOptions; - const runtimeTemplate = this.runtimeTemplate; - const chunk = new Chunk("build time chunk", this._backCompat); - chunk.id = chunk.name; - chunk.ids = [chunk.id]; - chunk.runtime = runtime; +/***/ }), - const entrypoint = new Entrypoint({ - runtime, - chunkLoading: false, - ...options.entryOptions - }); - chunkGraph.connectChunkAndEntryModule(chunk, module, entrypoint); - connectChunkGroupAndChunk(entrypoint, chunk); - entrypoint.setRuntimeChunk(chunk); - entrypoint.setEntrypointChunk(chunk); +/***/ 7145: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const chunks = new Set([chunk]); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // Assign ids to modules and modules to the chunk - for (const module of modules) { - const id = module.identifier(); - chunkGraph.setModuleId(module, id); - chunkGraph.connectChunkAndModule(chunk, module); - } - // Hash modules - for (const module of modules) { - this._createModuleHash( - module, - chunkGraph, - runtime, - hashFunction, - runtimeTemplate, - hashDigest, - hashDigestLength - ); - } - const codeGenerationResults = new CodeGenerationResults( - this.outputOptions.hashFunction +const ConstDependency = __webpack_require__(76911); +const ExportsInfoDependency = __webpack_require__(78988); + +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ + +class ExportsInfoApiPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "ExportsInfoApiPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyTemplates.set( + ExportsInfoDependency, + new ExportsInfoDependency.Template() ); - /** @type {WebpackError[]} */ - const errors = []; /** - * @param {Module} module the module - * @param {Callback} callback callback + * @param {JavascriptParser} parser the parser * @returns {void} */ - const codeGen = (module, callback) => { - this._codeGenerationModule( - module, - runtime, - [runtime], - chunkGraph.getModuleHash(module, runtime), - this.dependencyTemplates, - chunkGraph, - this.moduleGraph, - runtimeTemplate, - errors, - codeGenerationResults, - (err, codeGenerated) => { - callback(err); - } - ); + const handler = parser => { + parser.hooks.expressionMemberChain + .for("__webpack_exports_info__") + .tap("ExportsInfoApiPlugin", (expr, members) => { + const dep = + members.length >= 2 + ? new ExportsInfoDependency( + expr.range, + members.slice(0, -1), + members[members.length - 1] + ) + : new ExportsInfoDependency(expr.range, null, members[0]); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + return true; + }); + parser.hooks.expression + .for("__webpack_exports_info__") + .tap("ExportsInfoApiPlugin", expr => { + const dep = new ConstDependency("true", expr.range); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); }; + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("ExportsInfoApiPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("ExportsInfoApiPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("ExportsInfoApiPlugin", handler); + } + ); + } +} - const reportErrors = () => { - if (errors.length > 0) { - errors.sort( - compareSelect(err => err.module, compareModulesByIdentifier) - ); - for (const error of errors) { - this.errors.push(error); - } - errors.length = 0; - } - }; +module.exports = ExportsInfoApiPlugin; - // Generate code for all aggregated modules - asyncLib.eachLimit(modules, 10, codeGen, err => { - if (err) return callback(err); - reportErrors(); - // for backward-compat temporary set the chunk graph - // TODO webpack 6 - const old = this.chunkGraph; - this.chunkGraph = chunkGraph; - this.processRuntimeRequirements({ - chunkGraph, - modules, - chunks, - codeGenerationResults, - chunkGraphEntries: chunks - }); - this.chunkGraph = old; +/***/ }), - const runtimeModules = - chunkGraph.getChunkRuntimeModulesIterable(chunk); +/***/ 73071: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // Hash runtime modules - for (const module of runtimeModules) { - modules.add(module); - this._createModuleHash( - module, - chunkGraph, - runtime, - hashFunction, - runtimeTemplate, - hashDigest, - hashDigestLength - ); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // Generate code for all runtime modules - asyncLib.eachLimit(runtimeModules, 10, codeGen, err => { - if (err) return callback(err); - reportErrors(); - /** @type {Map} */ - const moduleArgumentsMap = new Map(); - /** @type {Map} */ - const moduleArgumentsById = new Map(); - /** @type {ExecuteModuleResult["fileDependencies"]} */ - const fileDependencies = new LazySet(); - /** @type {ExecuteModuleResult["contextDependencies"]} */ - const contextDependencies = new LazySet(); - /** @type {ExecuteModuleResult["missingDependencies"]} */ - const missingDependencies = new LazySet(); - /** @type {ExecuteModuleResult["buildDependencies"]} */ - const buildDependencies = new LazySet(); +const { OriginalSource, RawSource } = __webpack_require__(51255); +const ConcatenationScope = __webpack_require__(98229); +const { UsageState } = __webpack_require__(63686); +const InitFragment = __webpack_require__(55870); +const Module = __webpack_require__(73208); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const StaticExportsDependency = __webpack_require__(91418); +const createHash = __webpack_require__(49835); +const extractUrlAndGlobal = __webpack_require__(11850); +const makeSerializable = __webpack_require__(33032); +const propertyAccess = __webpack_require__(54190); +const { register } = __webpack_require__(8282); - /** @type {ExecuteModuleResult["assets"]} */ - const assets = new Map(); +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./ExportsInfo")} ExportsInfo */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("./Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ +/** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */ +/** @typedef {import("./util/Hash")} Hash */ +/** @typedef {typeof import("./util/Hash")} HashConstructor */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - let cacheable = true; +/** + * @typedef {Object} SourceData + * @property {boolean=} iife + * @property {string=} init + * @property {string} expression + * @property {InitFragment[]=} chunkInitFragments + * @property {ReadonlySet=} runtimeRequirements + */ - /** @type {ExecuteModuleContext} */ - const context = { - assets, - __webpack_require__: undefined, - chunk, - chunkGraph - }; +const TYPES = new Set(["javascript"]); +const CSS_TYPES = new Set(["css-import"]); +const RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]); +const RUNTIME_REQUIREMENTS_FOR_SCRIPT = new Set([RuntimeGlobals.loadScript]); +const RUNTIME_REQUIREMENTS_FOR_MODULE = new Set([ + RuntimeGlobals.definePropertyGetters +]); +const EMPTY_RUNTIME_REQUIREMENTS = new Set([]); - // Prepare execution - asyncLib.eachLimit( - modules, - 10, - (module, callback) => { - const codeGenerationResult = codeGenerationResults.get( - module, - runtime - ); - /** @type {ExecuteModuleArgument} */ - const moduleArgument = { - module, - codeGenerationResult, - preparedInfo: undefined, - moduleObject: undefined - }; - moduleArgumentsMap.set(module, moduleArgument); - moduleArgumentsById.set(module.identifier(), moduleArgument); - module.addCacheDependencies( - fileDependencies, - contextDependencies, - missingDependencies, - buildDependencies - ); - if (module.buildInfo.cacheable === false) { - cacheable = false; - } - if (module.buildInfo && module.buildInfo.assets) { - const { assets: moduleAssets, assetsInfo } = module.buildInfo; - for (const assetName of Object.keys(moduleAssets)) { - assets.set(assetName, { - source: moduleAssets[assetName], - info: assetsInfo ? assetsInfo.get(assetName) : undefined - }); - } - } - this.hooks.prepareModuleExecution.callAsync( - moduleArgument, - context, - callback - ); - }, - err => { - if (err) return callback(err); +/** + * @param {string|string[]} variableName the variable name or path + * @param {string} type the module system + * @returns {SourceData} the generated source + */ +const getSourceForGlobalVariableExternal = (variableName, type) => { + if (!Array.isArray(variableName)) { + // make it an array as the look up works the same basically + variableName = [variableName]; + } - let exports; - try { - const { - strictModuleErrorHandling, - strictModuleExceptionHandling - } = this.outputOptions; - const __nested_webpack_require_152432__ = id => { - const cached = moduleCache[id]; - if (cached !== undefined) { - if (cached.error) throw cached.error; - return cached.exports; - } - const moduleArgument = moduleArgumentsById.get(id); - return __webpack_require_module__(moduleArgument, id); - }; - const interceptModuleExecution = (__nested_webpack_require_152432__[ - RuntimeGlobals.interceptModuleExecution.replace( - "__webpack_require__.", - "" - ) - ] = []); - const moduleCache = (__nested_webpack_require_152432__[ - RuntimeGlobals.moduleCache.replace( - "__webpack_require__.", - "" - ) - ] = {}); - - context.__webpack_require__ = __nested_webpack_require_152432__; - - /** - * @param {ExecuteModuleArgument} moduleArgument the module argument - * @param {string=} id id - * @returns {any} exports - */ - const __webpack_require_module__ = (moduleArgument, id) => { - var execOptions = { - id, - module: { - id, - exports: {}, - loaded: false, - error: undefined - }, - require: __nested_webpack_require_152432__ - }; - interceptModuleExecution.forEach(handler => - handler(execOptions) - ); - const module = moduleArgument.module; - this.buildTimeExecutedModules.add(module); - const moduleObject = execOptions.module; - moduleArgument.moduleObject = moduleObject; - try { - if (id) moduleCache[id] = moduleObject; + // needed for e.g. window["some"]["thing"] + const objectLookup = variableName.map(r => `[${JSON.stringify(r)}]`).join(""); + return { + iife: type === "this", + expression: `${type}${objectLookup}` + }; +}; - tryRunOrWebpackError( - () => - this.hooks.executeModule.call( - moduleArgument, - context - ), - "Compilation.hooks.executeModule" - ); - moduleObject.loaded = true; - return moduleObject.exports; - } catch (e) { - if (strictModuleExceptionHandling) { - if (id) delete moduleCache[id]; - } else if (strictModuleErrorHandling) { - moduleObject.error = e; - } - if (!e.module) e.module = module; - throw e; - } - }; +/** + * @param {string|string[]} moduleAndSpecifiers the module request + * @returns {SourceData} the generated source + */ +const getSourceForCommonJsExternal = moduleAndSpecifiers => { + if (!Array.isArray(moduleAndSpecifiers)) { + return { + expression: `require(${JSON.stringify(moduleAndSpecifiers)})` + }; + } + const moduleName = moduleAndSpecifiers[0]; + return { + expression: `require(${JSON.stringify(moduleName)})${propertyAccess( + moduleAndSpecifiers, + 1 + )}` + }; +}; - for (const runtimeModule of chunkGraph.getChunkRuntimeModulesInOrder( - chunk - )) { - __webpack_require_module__( - moduleArgumentsMap.get(runtimeModule) - ); - } - exports = __nested_webpack_require_152432__(module.identifier()); - } catch (e) { - const err = new WebpackError( - `Execution of module code from module graph (${module.readableIdentifier( - this.requestShortener - )}) failed: ${e.message}` - ); - err.stack = e.stack; - err.module = e.module; - return callback(err); - } +/** + * @param {string|string[]} moduleAndSpecifiers the module request + * @returns {SourceData} the generated source + */ +const getSourceForCommonJsExternalInNodeModule = moduleAndSpecifiers => { + const chunkInitFragments = [ + new InitFragment( + 'import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";\n', + InitFragment.STAGE_HARMONY_IMPORTS, + 0, + "external module node-commonjs" + ) + ]; + if (!Array.isArray(moduleAndSpecifiers)) { + return { + expression: `__WEBPACK_EXTERNAL_createRequire(import.meta.url)(${JSON.stringify( + moduleAndSpecifiers + )})`, + chunkInitFragments + }; + } + const moduleName = moduleAndSpecifiers[0]; + return { + expression: `__WEBPACK_EXTERNAL_createRequire(import.meta.url)(${JSON.stringify( + moduleName + )})${propertyAccess(moduleAndSpecifiers, 1)}`, + chunkInitFragments + }; +}; - callback(null, { - exports, - assets, - cacheable, - fileDependencies, - contextDependencies, - missingDependencies, - buildDependencies - }); - } - ); - }); - }); - } +/** + * @param {string|string[]} moduleAndSpecifiers the module request + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @returns {SourceData} the generated source + */ +const getSourceForImportExternal = (moduleAndSpecifiers, runtimeTemplate) => { + const importName = runtimeTemplate.outputOptions.importFunctionName; + if (!runtimeTemplate.supportsDynamicImport() && importName === "import") { + throw new Error( + "The target environment doesn't support 'import()' so it's not possible to use external type 'import'" ); } + if (!Array.isArray(moduleAndSpecifiers)) { + return { + expression: `${importName}(${JSON.stringify(moduleAndSpecifiers)});` + }; + } + if (moduleAndSpecifiers.length === 1) { + return { + expression: `${importName}(${JSON.stringify(moduleAndSpecifiers[0])});` + }; + } + const moduleName = moduleAndSpecifiers[0]; + return { + expression: `${importName}(${JSON.stringify( + moduleName + )}).then(${runtimeTemplate.returningFunction( + `module${propertyAccess(moduleAndSpecifiers, 1)}`, + "module" + )});` + }; +}; - checkConstraints() { - const chunkGraph = this.chunkGraph; - - /** @type {Set} */ - const usedIds = new Set(); - - for (const module of this.modules) { - if (module.type === "runtime") continue; - const moduleId = chunkGraph.getModuleId(module); - if (moduleId === null) continue; - if (usedIds.has(moduleId)) { - throw new Error(`checkConstraints: duplicate module id ${moduleId}`); - } - usedIds.add(moduleId); - } - - for (const chunk of this.chunks) { - for (const module of chunkGraph.getChunkModulesIterable(chunk)) { - if (!this.modules.has(module)) { - throw new Error( - "checkConstraints: module in chunk but not in compilation " + - ` ${chunk.debugId} ${module.debugId}` - ); - } - } - for (const module of chunkGraph.getChunkEntryModulesIterable(chunk)) { - if (!this.modules.has(module)) { - throw new Error( - "checkConstraints: entry module in chunk but not in compilation " + - ` ${chunk.debugId} ${module.debugId}` - ); - } +class ModuleExternalInitFragment extends InitFragment { + /** + * @param {string} request import source + * @param {string=} ident recomputed ident + * @param {string | HashConstructor=} hashFunction the hash function to use + */ + constructor(request, ident, hashFunction = "md4") { + if (ident === undefined) { + ident = Template.toIdentifier(request); + if (ident !== request) { + ident += `_${createHash(hashFunction) + .update(request) + .digest("hex") + .slice(0, 8)}`; } } + const identifier = `__WEBPACK_EXTERNAL_MODULE_${ident}__`; + super( + `import * as ${identifier} from ${JSON.stringify(request)};\n`, + InitFragment.STAGE_HARMONY_IMPORTS, + 0, + `external module import ${ident}` + ); + this._ident = ident; + this._identifier = identifier; + this._request = request; + } - for (const chunkGroup of this.chunkGroups) { - chunkGroup.checkConstraints(); - } + getNamespaceIdentifier() { + return this._identifier; } } -/** - * @typedef {Object} FactorizeModuleOptions - * @property {ModuleProfile} currentProfile - * @property {ModuleFactory} factory - * @property {Dependency[]} dependencies - * @property {boolean=} factoryResult return full ModuleFactoryResult instead of only module - * @property {Module | null} originModule - * @property {Partial=} contextInfo - * @property {string=} context - */ - -/** - * @param {FactorizeModuleOptions} options options object - * @param {ModuleCallback | ModuleFactoryResultCallback} callback callback - * @returns {void} - */ - -// Workaround for typescript as it doesn't support function overloading in jsdoc within a class -Compilation.prototype.factorizeModule = /** @type {{ - (options: FactorizeModuleOptions & { factoryResult?: false }, callback: ModuleCallback): void; - (options: FactorizeModuleOptions & { factoryResult: true }, callback: ModuleFactoryResultCallback): void; -}} */ ( - function (options, callback) { - this.factorizeQueue.add(options, callback); +register( + ModuleExternalInitFragment, + "webpack/lib/ExternalModule", + "ModuleExternalInitFragment", + { + serialize(obj, { write }) { + write(obj._request); + write(obj._ident); + }, + deserialize({ read }) { + return new ModuleExternalInitFragment(read(), read()); + } } ); -// Hide from typescript -const compilationPrototype = Compilation.prototype; - -// TODO webpack 6 remove -Object.defineProperty(compilationPrototype, "modifyHash", { - writable: false, - enumerable: false, - configurable: false, - value: () => { - throw new Error( - "Compilation.modifyHash was removed in favor of Compilation.hooks.fullHash" - ); +const generateModuleRemapping = (input, exportsInfo, runtime) => { + if (exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused) { + const properties = []; + for (const exportInfo of exportsInfo.orderedExports) { + const used = exportInfo.getUsedName(exportInfo.name, runtime); + if (!used) continue; + const nestedInfo = exportInfo.getNestedExportsInfo(); + if (nestedInfo) { + const nestedExpr = generateModuleRemapping( + `${input}${propertyAccess([exportInfo.name])}`, + nestedInfo + ); + if (nestedExpr) { + properties.push(`[${JSON.stringify(used)}]: y(${nestedExpr})`); + continue; + } + } + properties.push( + `[${JSON.stringify(used)}]: () => ${input}${propertyAccess([ + exportInfo.name + ])}` + ); + } + return `x({ ${properties.join(", ")} })`; } -}); - -// TODO webpack 6 remove -Object.defineProperty(compilationPrototype, "cache", { - enumerable: false, - configurable: false, - get: util.deprecate( - /** - * @this {Compilation} the compilation - * @returns {Cache} the cache - */ - function () { - return this.compiler.cache; - }, - "Compilation.cache was removed in favor of Compilation.getCache()", - "DEP_WEBPACK_COMPILATION_CACHE" - ), - set: util.deprecate( - v => {}, - "Compilation.cache was removed in favor of Compilation.getCache()", - "DEP_WEBPACK_COMPILATION_CACHE" - ) -}); +}; /** - * Add additional assets to the compilation. + * @param {string|string[]} moduleAndSpecifiers the module request + * @param {ExportsInfo} exportsInfo exports info of this module + * @param {RuntimeSpec} runtime the runtime + * @param {string | HashConstructor=} hashFunction the hash function to use + * @returns {SourceData} the generated source */ -Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL = -2000; +const getSourceForModuleExternal = ( + moduleAndSpecifiers, + exportsInfo, + runtime, + hashFunction +) => { + if (!Array.isArray(moduleAndSpecifiers)) + moduleAndSpecifiers = [moduleAndSpecifiers]; + const initFragment = new ModuleExternalInitFragment( + moduleAndSpecifiers[0], + undefined, + hashFunction + ); + const baseAccess = `${initFragment.getNamespaceIdentifier()}${propertyAccess( + moduleAndSpecifiers, + 1 + )}`; + const moduleRemapping = generateModuleRemapping( + baseAccess, + exportsInfo, + runtime + ); + let expression = moduleRemapping || baseAccess; + return { + expression, + init: `var x = y => { var x = {}; ${RuntimeGlobals.definePropertyGetters}(x, y); return x; }\nvar y = x => () => x`, + runtimeRequirements: moduleRemapping + ? RUNTIME_REQUIREMENTS_FOR_MODULE + : undefined, + chunkInitFragments: [initFragment] + }; +}; /** - * Basic preprocessing of assets. + * @param {string|string[]} urlAndGlobal the script request + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @returns {SourceData} the generated source */ -Compilation.PROCESS_ASSETS_STAGE_PRE_PROCESS = -1000; +const getSourceForScriptExternal = (urlAndGlobal, runtimeTemplate) => { + if (typeof urlAndGlobal === "string") { + urlAndGlobal = extractUrlAndGlobal(urlAndGlobal); + } + const url = urlAndGlobal[0]; + const globalName = urlAndGlobal[1]; + return { + init: "var __webpack_error__ = new Error();", + expression: `new Promise(${runtimeTemplate.basicFunction( + "resolve, reject", + [ + `if(typeof ${globalName} !== "undefined") return resolve();`, + `${RuntimeGlobals.loadScript}(${JSON.stringify( + url + )}, ${runtimeTemplate.basicFunction("event", [ + `if(typeof ${globalName} !== "undefined") return resolve();`, + "var errorType = event && (event.type === 'load' ? 'missing' : event.type);", + "var realSrc = event && event.target && event.target.src;", + "__webpack_error__.message = 'Loading script failed.\\n(' + errorType + ': ' + realSrc + ')';", + "__webpack_error__.name = 'ScriptExternalLoadError';", + "__webpack_error__.type = errorType;", + "__webpack_error__.request = realSrc;", + "reject(__webpack_error__);" + ])}, ${JSON.stringify(globalName)});` + ] + )}).then(${runtimeTemplate.returningFunction( + `${globalName}${propertyAccess(urlAndGlobal, 2)}` + )})`, + runtimeRequirements: RUNTIME_REQUIREMENTS_FOR_SCRIPT + }; +}; /** - * Derive new assets from existing assets. - * Existing assets should not be treated as complete. + * @param {string} variableName the variable name to check + * @param {string} request the request path + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @returns {string} the generated source */ -Compilation.PROCESS_ASSETS_STAGE_DERIVED = -200; +const checkExternalVariable = (variableName, request, runtimeTemplate) => { + return `if(typeof ${variableName} === 'undefined') { ${runtimeTemplate.throwMissingModuleErrorBlock( + { request } + )} }\n`; +}; /** - * Add additional sections to existing assets, like a banner or initialization code. + * @param {string|number} id the module id + * @param {boolean} optional true, if the module is optional + * @param {string|string[]} request the request path + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @returns {SourceData} the generated source */ -Compilation.PROCESS_ASSETS_STAGE_ADDITIONS = -100; +const getSourceForAmdOrUmdExternal = ( + id, + optional, + request, + runtimeTemplate +) => { + const externalVariable = `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( + `${id}` + )}__`; + return { + init: optional + ? checkExternalVariable( + externalVariable, + Array.isArray(request) ? request.join(".") : request, + runtimeTemplate + ) + : undefined, + expression: externalVariable + }; +}; /** - * Optimize existing assets in a general way. + * @param {boolean} optional true, if the module is optional + * @param {string|string[]} request the request path + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @returns {SourceData} the generated source */ -Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE = 100; +const getSourceForDefaultCase = (optional, request, runtimeTemplate) => { + if (!Array.isArray(request)) { + // make it an array as the look up works the same basically + request = [request]; + } -/** - * Optimize the count of existing assets, e. g. by merging them. - * Only assets of the same type should be merged. - * For assets of different types see PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE. - */ -Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT = 200; + const variableName = request[0]; + const objectLookup = propertyAccess(request, 1); + return { + init: optional + ? checkExternalVariable(variableName, request.join("."), runtimeTemplate) + : undefined, + expression: `${variableName}${objectLookup}` + }; +}; -/** - * Optimize the compatibility of existing assets, e. g. add polyfills or vendor-prefixes. - */ -Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY = 300; +class ExternalModule extends Module { + constructor(request, type, userRequest) { + super("javascript/dynamic", null); -/** - * Optimize the size of existing assets, e. g. by minimizing or omitting whitespace. - */ -Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE = 400; + // Info from Factory + /** @type {string | string[] | Record} */ + this.request = request; + /** @type {string} */ + this.externalType = type; + /** @type {string} */ + this.userRequest = userRequest; + } -/** - * Add development tooling to assets, e. g. by extracting a SourceMap. - */ -Compilation.PROCESS_ASSETS_STAGE_DEV_TOOLING = 500; + /** + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + return this.externalType === "css-import" ? CSS_TYPES : TYPES; + } -/** - * Optimize the count of existing assets, e. g. by inlining assets of into other assets. - * Only assets of different types should be inlined. - * For assets of the same type see PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT. - */ -Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE = 700; + /** + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion + */ + libIdent(options) { + return this.userRequest; + } -/** - * Summarize the list of existing assets - * e. g. creating an assets manifest of Service Workers. - */ -Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE = 1000; + /** + * @param {Chunk} chunk the chunk which condition should be checked + * @param {Compilation} compilation the compilation + * @returns {boolean} true, if the chunk is ok for the module + */ + chunkCondition(chunk, { chunkGraph }) { + return this.externalType === "css-import" + ? true + : chunkGraph.getNumberOfEntryModules(chunk) > 0; + } -/** - * Optimize the hashes of the assets, e. g. by generating real hashes of the asset content. - */ -Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH = 2500; + /** + * @returns {string} a unique identifier of the module + */ + identifier() { + return `external ${this.externalType} ${JSON.stringify(this.request)}`; + } -/** - * Optimize the transfer of existing assets, e. g. by preparing a compressed (gzip) file as separate asset. - */ -Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER = 3000; + /** + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + return "external " + JSON.stringify(this.request); + } -/** - * Analyse existing assets. - */ -Compilation.PROCESS_ASSETS_STAGE_ANALYSE = 4000; + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + return callback(null, !this.buildMeta); + } -/** - * Creating assets for reporting purposes. - */ -Compilation.PROCESS_ASSETS_STAGE_REPORT = 5000; + /** + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + this.buildMeta = { + async: false, + exportsType: undefined + }; + this.buildInfo = { + strict: true, + topLevelDeclarations: new Set(), + module: compilation.outputOptions.module + }; + const { request, externalType } = this._getRequestAndExternalType(); + this.buildMeta.exportsType = "dynamic"; + let canMangle = false; + this.clearDependenciesAndBlocks(); + switch (externalType) { + case "this": + this.buildInfo.strict = false; + break; + case "system": + if (!Array.isArray(request) || request.length === 1) { + this.buildMeta.exportsType = "namespace"; + canMangle = true; + } + break; + case "module": + if (this.buildInfo.module) { + if (!Array.isArray(request) || request.length === 1) { + this.buildMeta.exportsType = "namespace"; + canMangle = true; + } + } else { + this.buildMeta.async = true; + if (!Array.isArray(request) || request.length === 1) { + this.buildMeta.exportsType = "namespace"; + canMangle = false; + } + } + break; + case "script": + case "promise": + this.buildMeta.async = true; + break; + case "import": + this.buildMeta.async = true; + if (!Array.isArray(request) || request.length === 1) { + this.buildMeta.exportsType = "namespace"; + canMangle = false; + } + break; + } + this.addDependency(new StaticExportsDependency(true, canMangle)); + callback(); + } -module.exports = Compilation; + restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory) { + this._restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory); + } + + /** + * @param {ConcatenationBailoutReasonContext} context context + * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated + */ + getConcatenationBailoutReason({ moduleGraph }) { + switch (this.externalType) { + case "amd": + case "amd-require": + case "umd": + case "umd2": + case "system": + case "jsonp": + return `${this.externalType} externals can't be concatenated`; + } + return undefined; + } + + _getRequestAndExternalType() { + let { request, externalType } = this; + if (typeof request === "object" && !Array.isArray(request)) + request = request[externalType]; + return { request, externalType }; + } + + _getSourceData( + request, + externalType, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtime + ) { + switch (externalType) { + case "this": + case "window": + case "self": + return getSourceForGlobalVariableExternal(request, this.externalType); + case "global": + return getSourceForGlobalVariableExternal( + request, + runtimeTemplate.globalObject + ); + case "commonjs": + case "commonjs2": + case "commonjs-module": + case "commonjs-static": + return getSourceForCommonJsExternal(request); + case "node-commonjs": + return this.buildInfo.module + ? getSourceForCommonJsExternalInNodeModule(request) + : getSourceForCommonJsExternal(request); + case "amd": + case "amd-require": + case "umd": + case "umd2": + case "system": + case "jsonp": { + const id = chunkGraph.getModuleId(this); + return getSourceForAmdOrUmdExternal( + id !== null ? id : this.identifier(), + this.isOptional(moduleGraph), + request, + runtimeTemplate + ); + } + case "import": + return getSourceForImportExternal(request, runtimeTemplate); + case "script": + return getSourceForScriptExternal(request, runtimeTemplate); + case "module": { + if (!this.buildInfo.module) { + if (!runtimeTemplate.supportsDynamicImport()) { + throw new Error( + "The target environment doesn't support dynamic import() syntax so it's not possible to use external type 'module' within a script" + + (runtimeTemplate.supportsEcmaScriptModuleSyntax() + ? "\nDid you mean to build a EcmaScript Module ('output.module: true')?" + : "") + ); + } + return getSourceForImportExternal(request, runtimeTemplate); + } + if (!runtimeTemplate.supportsEcmaScriptModuleSyntax()) { + throw new Error( + "The target environment doesn't support EcmaScriptModule syntax so it's not possible to use external type 'module'" + ); + } + return getSourceForModuleExternal( + request, + moduleGraph.getExportsInfo(this), + runtime, + runtimeTemplate.outputOptions.hashFunction + ); + } + case "var": + case "promise": + case "const": + case "let": + case "assign": + default: + return getSourceForDefaultCase( + this.isOptional(moduleGraph), + request, + runtimeTemplate + ); + } + } + + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration({ + runtimeTemplate, + moduleGraph, + chunkGraph, + runtime, + concatenationScope + }) { + const { request, externalType } = this._getRequestAndExternalType(); + switch (externalType) { + case "asset": { + const sources = new Map(); + sources.set( + "javascript", + new RawSource(`module.exports = ${JSON.stringify(request)};`) + ); + const data = new Map(); + data.set("url", request); + return { sources, runtimeRequirements: RUNTIME_REQUIREMENTS, data }; + } + case "css-import": { + const sources = new Map(); + sources.set( + "css-import", + new RawSource(`@import url(${JSON.stringify(request)});`) + ); + return { + sources, + runtimeRequirements: EMPTY_RUNTIME_REQUIREMENTS + }; + } + default: { + const sourceData = this._getSourceData( + request, + externalType, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtime + ); + + let sourceString = sourceData.expression; + if (sourceData.iife) + sourceString = `(function() { return ${sourceString}; }())`; + if (concatenationScope) { + sourceString = `${ + runtimeTemplate.supportsConst() ? "const" : "var" + } ${ConcatenationScope.NAMESPACE_OBJECT_EXPORT} = ${sourceString};`; + concatenationScope.registerNamespaceExport( + ConcatenationScope.NAMESPACE_OBJECT_EXPORT + ); + } else { + sourceString = `module.exports = ${sourceString};`; + } + if (sourceData.init) + sourceString = `${sourceData.init}\n${sourceString}`; + + let data = undefined; + if (sourceData.chunkInitFragments) { + data = new Map(); + data.set("chunkInitFragments", sourceData.chunkInitFragments); + } + + const sources = new Map(); + if (this.useSourceMap || this.useSimpleSourceMap) { + sources.set( + "javascript", + new OriginalSource(sourceString, this.identifier()) + ); + } else { + sources.set("javascript", new RawSource(sourceString)); + } + + let runtimeRequirements = sourceData.runtimeRequirements; + if (!concatenationScope) { + if (!runtimeRequirements) { + runtimeRequirements = RUNTIME_REQUIREMENTS; + } else { + const set = new Set(runtimeRequirements); + set.add(RuntimeGlobals.module); + runtimeRequirements = set; + } + } + + return { + sources, + runtimeRequirements: + runtimeRequirements || EMPTY_RUNTIME_REQUIREMENTS, + data + }; + } + } + } + + /** + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + return 42; + } + + /** + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + const { chunkGraph } = context; + hash.update( + `${this.externalType}${JSON.stringify(this.request)}${this.isOptional( + chunkGraph.moduleGraph + )}` + ); + super.updateHash(hash, context); + } + + serialize(context) { + const { write } = context; + + write(this.request); + write(this.externalType); + write(this.userRequest); + + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + + this.request = read(); + this.externalType = read(); + this.userRequest = read(); + + super.deserialize(context); + } +} + +makeSerializable(ExternalModule, "webpack/lib/ExternalModule"); + +module.exports = ExternalModule; /***/ }), -/***/ 70845: +/***/ 62153: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -34806,3571 +36679,3870 @@ module.exports = Compilation; -const parseJson = __webpack_require__(15235); -const asyncLib = __webpack_require__(78175); -const { - SyncHook, - SyncBailHook, - AsyncParallelHook, - AsyncSeriesHook -} = __webpack_require__(41242); -const { SizeOnlySource } = __webpack_require__(51255); -const webpack = __webpack_require__(91919); -const Cache = __webpack_require__(7592); -const CacheFacade = __webpack_require__(55392); -const ChunkGraph = __webpack_require__(64971); -const Compilation = __webpack_require__(85720); -const ConcurrentCompilationError = __webpack_require__(95735); -const ContextModuleFactory = __webpack_require__(62471); -const ModuleGraph = __webpack_require__(99988); -const NormalModuleFactory = __webpack_require__(68860); -const RequestShortener = __webpack_require__(73406); -const ResolverFactory = __webpack_require__(30217); -const Stats = __webpack_require__(31743); -const Watching = __webpack_require__(84275); -const WebpackError = __webpack_require__(53799); -const { Logger } = __webpack_require__(32597); -const { join, dirname, mkdirp } = __webpack_require__(17139); -const { makePathsRelative } = __webpack_require__(82186); -const { isSourceEqual } = __webpack_require__(41245); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").EntryNormalized} Entry */ -/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */ -/** @typedef {import("../declarations/WebpackOptions").WatchOptions} WatchOptions */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./util/WeakTupleMap")} WeakTupleMap */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ -/** @typedef {import("./util/fs").IntermediateFileSystem} IntermediateFileSystem */ -/** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */ -/** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */ +const util = __webpack_require__(73837); +const ExternalModule = __webpack_require__(73071); +const { resolveByProperty, cachedSetProperty } = __webpack_require__(60839); -/** - * @typedef {Object} CompilationParams - * @property {NormalModuleFactory} normalModuleFactory - * @property {ContextModuleFactory} contextModuleFactory - */ +/** @typedef {import("../declarations/WebpackOptions").Externals} Externals */ +/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ -/** - * @template T - * @callback Callback - * @param {(Error | null)=} err - * @param {T=} result - */ +const UNSPECIFIED_EXTERNAL_TYPE_REGEXP = /^[a-z0-9-]+ /; +const EMPTY_RESOLVE_OPTIONS = {}; -/** - * @callback RunAsChildCallback - * @param {(Error | null)=} err - * @param {Chunk[]=} entries - * @param {Compilation=} compilation - */ +// TODO webpack 6 remove this +const callDeprecatedExternals = util.deprecate( + (externalsFunction, context, request, cb) => { + externalsFunction.call(null, context, request, cb); + }, + "The externals-function should be defined like ({context, request}, cb) => { ... }", + "DEP_WEBPACK_EXTERNALS_FUNCTION_PARAMETERS" +); -/** - * @typedef {Object} AssetEmittedInfo - * @property {Buffer} content - * @property {Source} source - * @property {Compilation} compilation - * @property {string} outputPath - * @property {string} targetPath - */ +const cache = new WeakMap(); -/** - * @param {string[]} array an array - * @returns {boolean} true, if the array is sorted - */ -const isSorted = array => { - for (let i = 1; i < array.length; i++) { - if (array[i - 1] > array[i]) return false; +const resolveLayer = (obj, layer) => { + let map = cache.get(obj); + if (map === undefined) { + map = new Map(); + cache.set(obj, map); + } else { + const cacheEntry = map.get(layer); + if (cacheEntry !== undefined) return cacheEntry; } - return true; + const result = resolveByProperty(obj, "byLayer", layer); + map.set(layer, result); + return result; }; -/** - * @param {Object} obj an object - * @param {string[]} keys the keys of the object - * @returns {Object} the object with properties sorted by property name - */ -const sortObject = (obj, keys) => { - const o = {}; - for (const k of keys.sort()) { - o[k] = obj[k]; +class ExternalModuleFactoryPlugin { + /** + * @param {string | undefined} type default external type + * @param {Externals} externals externals config + */ + constructor(type, externals) { + this.type = type; + this.externals = externals; } - return o; -}; -/** - * @param {string} filename filename - * @param {string | string[] | undefined} hashes list of hashes - * @returns {boolean} true, if the filename contains any hash - */ -const includesHash = (filename, hashes) => { - if (!hashes) return false; - if (Array.isArray(hashes)) { - return hashes.some(hash => filename.includes(hash)); - } else { - return filename.includes(hashes); + /** + * @param {NormalModuleFactory} normalModuleFactory the normal module factory + * @returns {void} + */ + apply(normalModuleFactory) { + const globalType = this.type; + normalModuleFactory.hooks.factorize.tapAsync( + "ExternalModuleFactoryPlugin", + (data, callback) => { + const context = data.context; + const contextInfo = data.contextInfo; + const dependency = data.dependencies[0]; + const dependencyType = data.dependencyType; + + /** + * @param {string|string[]|boolean|Record} value the external config + * @param {string|undefined} type type of external + * @param {function(Error=, ExternalModule=): void} callback callback + * @returns {void} + */ + const handleExternal = (value, type, callback) => { + if (value === false) { + // Not externals, fallback to original factory + return callback(); + } + /** @type {string | string[] | Record} */ + let externalConfig; + if (value === true) { + externalConfig = dependency.request; + } else { + externalConfig = value; + } + // When no explicit type is specified, extract it from the externalConfig + if (type === undefined) { + if ( + typeof externalConfig === "string" && + UNSPECIFIED_EXTERNAL_TYPE_REGEXP.test(externalConfig) + ) { + const idx = externalConfig.indexOf(" "); + type = externalConfig.substr(0, idx); + externalConfig = externalConfig.substr(idx + 1); + } else if ( + Array.isArray(externalConfig) && + externalConfig.length > 0 && + UNSPECIFIED_EXTERNAL_TYPE_REGEXP.test(externalConfig[0]) + ) { + const firstItem = externalConfig[0]; + const idx = firstItem.indexOf(" "); + type = firstItem.substr(0, idx); + externalConfig = [ + firstItem.substr(idx + 1), + ...externalConfig.slice(1) + ]; + } + } + callback( + null, + new ExternalModule( + externalConfig, + type || globalType, + dependency.request + ) + ); + }; + + /** + * @param {Externals} externals externals config + * @param {function((Error | null)=, ExternalModule=): void} callback callback + * @returns {void} + */ + const handleExternals = (externals, callback) => { + if (typeof externals === "string") { + if (externals === dependency.request) { + return handleExternal(dependency.request, undefined, callback); + } + } else if (Array.isArray(externals)) { + let i = 0; + const next = () => { + let asyncFlag; + const handleExternalsAndCallback = (err, module) => { + if (err) return callback(err); + if (!module) { + if (asyncFlag) { + asyncFlag = false; + return; + } + return next(); + } + callback(null, module); + }; + + do { + asyncFlag = true; + if (i >= externals.length) return callback(); + handleExternals(externals[i++], handleExternalsAndCallback); + } while (!asyncFlag); + asyncFlag = false; + }; + + next(); + return; + } else if (externals instanceof RegExp) { + if (externals.test(dependency.request)) { + return handleExternal(dependency.request, undefined, callback); + } + } else if (typeof externals === "function") { + const cb = (err, value, type) => { + if (err) return callback(err); + if (value !== undefined) { + handleExternal(value, type, callback); + } else { + callback(); + } + }; + if (externals.length === 3) { + // TODO webpack 6 remove this + callDeprecatedExternals( + externals, + context, + dependency.request, + cb + ); + } else { + const promise = externals( + { + context, + request: dependency.request, + dependencyType, + contextInfo, + getResolve: options => (context, request, callback) => { + const resolveContext = { + fileDependencies: data.fileDependencies, + missingDependencies: data.missingDependencies, + contextDependencies: data.contextDependencies + }; + let resolver = normalModuleFactory.getResolver( + "normal", + dependencyType + ? cachedSetProperty( + data.resolveOptions || EMPTY_RESOLVE_OPTIONS, + "dependencyType", + dependencyType + ) + : data.resolveOptions + ); + if (options) resolver = resolver.withOptions(options); + if (callback) { + resolver.resolve( + {}, + context, + request, + resolveContext, + callback + ); + } else { + return new Promise((resolve, reject) => { + resolver.resolve( + {}, + context, + request, + resolveContext, + (err, result) => { + if (err) reject(err); + else resolve(result); + } + ); + }); + } + } + }, + cb + ); + if (promise && promise.then) promise.then(r => cb(null, r), cb); + } + return; + } else if (typeof externals === "object") { + const resolvedExternals = resolveLayer( + externals, + contextInfo.issuerLayer + ); + if ( + Object.prototype.hasOwnProperty.call( + resolvedExternals, + dependency.request + ) + ) { + return handleExternal( + resolvedExternals[dependency.request], + undefined, + callback + ); + } + } + callback(); + }; + + handleExternals(this.externals, callback); + } + ); } -}; +} +module.exports = ExternalModuleFactoryPlugin; -class Compiler { + +/***/ }), + +/***/ 6652: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ExternalModuleFactoryPlugin = __webpack_require__(62153); + +/** @typedef {import("../declarations/WebpackOptions").Externals} Externals */ +/** @typedef {import("./Compiler")} Compiler */ + +class ExternalsPlugin { /** - * @param {string} context the compilation path - * @param {WebpackOptions} options options + * @param {string | undefined} type default external type + * @param {Externals} externals externals config */ - constructor(context, options = /** @type {WebpackOptions} */ ({})) { - this.hooks = Object.freeze({ - /** @type {SyncHook<[]>} */ - initialize: new SyncHook([]), + constructor(type, externals) { + this.type = type; + this.externals = externals; + } - /** @type {SyncBailHook<[Compilation], boolean>} */ - shouldEmit: new SyncBailHook(["compilation"]), - /** @type {AsyncSeriesHook<[Stats]>} */ - done: new AsyncSeriesHook(["stats"]), - /** @type {SyncHook<[Stats]>} */ - afterDone: new SyncHook(["stats"]), - /** @type {AsyncSeriesHook<[]>} */ - additionalPass: new AsyncSeriesHook([]), - /** @type {AsyncSeriesHook<[Compiler]>} */ - beforeRun: new AsyncSeriesHook(["compiler"]), - /** @type {AsyncSeriesHook<[Compiler]>} */ - run: new AsyncSeriesHook(["compiler"]), - /** @type {AsyncSeriesHook<[Compilation]>} */ - emit: new AsyncSeriesHook(["compilation"]), - /** @type {AsyncSeriesHook<[string, AssetEmittedInfo]>} */ - assetEmitted: new AsyncSeriesHook(["file", "info"]), - /** @type {AsyncSeriesHook<[Compilation]>} */ - afterEmit: new AsyncSeriesHook(["compilation"]), + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compile.tap("ExternalsPlugin", ({ normalModuleFactory }) => { + new ExternalModuleFactoryPlugin(this.type, this.externals).apply( + normalModuleFactory + ); + }); + } +} - /** @type {SyncHook<[Compilation, CompilationParams]>} */ - thisCompilation: new SyncHook(["compilation", "params"]), - /** @type {SyncHook<[Compilation, CompilationParams]>} */ - compilation: new SyncHook(["compilation", "params"]), - /** @type {SyncHook<[NormalModuleFactory]>} */ - normalModuleFactory: new SyncHook(["normalModuleFactory"]), - /** @type {SyncHook<[ContextModuleFactory]>} */ - contextModuleFactory: new SyncHook(["contextModuleFactory"]), +module.exports = ExternalsPlugin; - /** @type {AsyncSeriesHook<[CompilationParams]>} */ - beforeCompile: new AsyncSeriesHook(["params"]), - /** @type {SyncHook<[CompilationParams]>} */ - compile: new SyncHook(["params"]), - /** @type {AsyncParallelHook<[Compilation]>} */ - make: new AsyncParallelHook(["compilation"]), - /** @type {AsyncParallelHook<[Compilation]>} */ - finishMake: new AsyncSeriesHook(["compilation"]), - /** @type {AsyncSeriesHook<[Compilation]>} */ - afterCompile: new AsyncSeriesHook(["compilation"]), - /** @type {AsyncSeriesHook<[]>} */ - readRecords: new AsyncSeriesHook([]), - /** @type {AsyncSeriesHook<[]>} */ - emitRecords: new AsyncSeriesHook([]), +/***/ }), - /** @type {AsyncSeriesHook<[Compiler]>} */ - watchRun: new AsyncSeriesHook(["compiler"]), - /** @type {SyncHook<[Error]>} */ - failed: new SyncHook(["error"]), - /** @type {SyncHook<[string | null, number]>} */ - invalid: new SyncHook(["filename", "changeTime"]), - /** @type {SyncHook<[]>} */ - watchClose: new SyncHook([]), - /** @type {AsyncSeriesHook<[]>} */ - shutdown: new AsyncSeriesHook([]), +/***/ 79453: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** @type {SyncBailHook<[string, string, any[]], true>} */ - infrastructureLog: new SyncBailHook(["origin", "type", "args"]), +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // TODO the following hooks are weirdly located here - // TODO move them for webpack 5 - /** @type {SyncHook<[]>} */ - environment: new SyncHook([]), - /** @type {SyncHook<[]>} */ - afterEnvironment: new SyncHook([]), - /** @type {SyncHook<[Compiler]>} */ - afterPlugins: new SyncHook(["compiler"]), - /** @type {SyncHook<[Compiler]>} */ - afterResolvers: new SyncHook(["compiler"]), - /** @type {SyncBailHook<[string, Entry], boolean>} */ - entryOption: new SyncBailHook(["context", "entry"]) - }); - this.webpack = webpack; - /** @type {string=} */ - this.name = undefined; - /** @type {Compilation=} */ - this.parentCompilation = undefined; - /** @type {Compiler} */ - this.root = this; - /** @type {string} */ - this.outputPath = ""; - /** @type {Watching} */ - this.watching = undefined; +const { create: createResolver } = __webpack_require__(9256); +const asyncLib = __webpack_require__(78175); +const AsyncQueue = __webpack_require__(12260); +const StackedCacheMap = __webpack_require__(64985); +const createHash = __webpack_require__(49835); +const { join, dirname, relative, lstatReadlinkAbsolute } = __webpack_require__(17139); +const makeSerializable = __webpack_require__(33032); +const processAsyncTree = __webpack_require__(42791); - /** @type {OutputFileSystem} */ - this.outputFileSystem = null; - /** @type {IntermediateFileSystem} */ - this.intermediateFileSystem = null; - /** @type {InputFileSystem} */ - this.inputFileSystem = null; - /** @type {WatchFileSystem} */ - this.watchFileSystem = null; +/** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./logging/Logger").Logger} Logger */ +/** @typedef {typeof import("./util/Hash")} Hash */ +/** @typedef {import("./util/fs").IStats} IStats */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ - /** @type {string|null} */ - this.recordsInputPath = null; - /** @type {string|null} */ - this.recordsOutputPath = null; - this.records = {}; - /** @type {Set} */ - this.managedPaths = new Set(); - /** @type {Set} */ - this.immutablePaths = new Set(); +const supportsEsm = +process.versions.modules >= 83; - /** @type {ReadonlySet} */ - this.modifiedFiles = undefined; - /** @type {ReadonlySet} */ - this.removedFiles = undefined; - /** @type {ReadonlyMap} */ - this.fileTimestamps = undefined; - /** @type {ReadonlyMap} */ - this.contextTimestamps = undefined; - /** @type {number} */ - this.fsStartTime = undefined; +let FS_ACCURACY = 2000; - /** @type {ResolverFactory} */ - this.resolverFactory = new ResolverFactory(); +const EMPTY_SET = new Set(); - this.infrastructureLogger = undefined; +const RBDT_RESOLVE_CJS = 0; +const RBDT_RESOLVE_ESM = 1; +const RBDT_RESOLVE_DIRECTORY = 2; +const RBDT_RESOLVE_CJS_FILE = 3; +const RBDT_RESOLVE_CJS_FILE_AS_CHILD = 4; +const RBDT_RESOLVE_ESM_FILE = 5; +const RBDT_DIRECTORY = 6; +const RBDT_FILE = 7; +const RBDT_DIRECTORY_DEPENDENCIES = 8; +const RBDT_FILE_DEPENDENCIES = 9; - this.options = options; +const INVALID = Symbol("invalid"); - this.context = context; +/** + * @typedef {Object} FileSystemInfoEntry + * @property {number} safeTime + * @property {number=} timestamp + */ - this.requestShortener = new RequestShortener(context, this.root); +/** + * @typedef {Object} ResolvedContextFileSystemInfoEntry + * @property {number} safeTime + * @property {string=} timestampHash + */ - this.cache = new Cache(); +/** + * @typedef {Object} ContextFileSystemInfoEntry + * @property {number} safeTime + * @property {string=} timestampHash + * @property {ResolvedContextFileSystemInfoEntry=} resolved + * @property {Set=} symlinks + */ - /** @type {Map, memCache: WeakTupleMap }> | undefined} */ - this.moduleMemCaches = undefined; +/** + * @typedef {Object} TimestampAndHash + * @property {number} safeTime + * @property {number=} timestamp + * @property {string} hash + */ - this.compilerPath = ""; +/** + * @typedef {Object} ResolvedContextTimestampAndHash + * @property {number} safeTime + * @property {string=} timestampHash + * @property {string} hash + */ - /** @type {boolean} */ - this.running = false; +/** + * @typedef {Object} ContextTimestampAndHash + * @property {number} safeTime + * @property {string=} timestampHash + * @property {string} hash + * @property {ResolvedContextTimestampAndHash=} resolved + * @property {Set=} symlinks + */ - /** @type {boolean} */ - this.idle = false; +/** + * @typedef {Object} ContextHash + * @property {string} hash + * @property {string=} resolved + * @property {Set=} symlinks + */ - /** @type {boolean} */ - this.watchMode = false; +/** + * @typedef {Object} SnapshotOptimizationEntry + * @property {Snapshot} snapshot + * @property {number} shared + * @property {Set} snapshotContent + * @property {Set} children + */ - this._backCompat = this.options.experiments.backCompat !== false; +/** + * @typedef {Object} ResolveBuildDependenciesResult + * @property {Set} files list of files + * @property {Set} directories list of directories + * @property {Set} missing list of missing entries + * @property {Map} resolveResults stored resolve results + * @property {Object} resolveDependencies dependencies of the resolving + * @property {Set} resolveDependencies.files list of files + * @property {Set} resolveDependencies.directories list of directories + * @property {Set} resolveDependencies.missing list of missing entries + */ - /** @type {Compilation} */ - this._lastCompilation = undefined; - /** @type {NormalModuleFactory} */ - this._lastNormalModuleFactory = undefined; +const DONE_ITERATOR_RESULT = new Set().keys().next(); - /** @private @type {WeakMap }>} */ - this._assetEmittingSourceCache = new WeakMap(); - /** @private @type {Map} */ - this._assetEmittingWrittenFiles = new Map(); - /** @private @type {Set} */ - this._assetEmittingPreviousFiles = new Set(); +// cspell:word tshs +// Tsh = Timestamp + Hash +// Tshs = Timestamp + Hash combinations + +class SnapshotIterator { + constructor(next) { + this.next = next; } +} - /** - * @param {string} name cache name - * @returns {CacheFacade} the cache facade instance - */ - getCache(name) { - return new CacheFacade( - this.cache, - `${this.compilerPath}${name}`, - this.options.output.hashFunction - ); +class SnapshotIterable { + constructor(snapshot, getMaps) { + this.snapshot = snapshot; + this.getMaps = getMaps; } - /** - * @param {string | (function(): string)} name name of the logger, or function called once to get the logger name - * @returns {Logger} a logger with that name - */ - getInfrastructureLogger(name) { - if (!name) { - throw new TypeError( - "Compiler.getInfrastructureLogger(name) called without a name" - ); - } - return new Logger( - (type, args) => { - if (typeof name === "function") { - name = name(); - if (!name) { - throw new TypeError( - "Compiler.getInfrastructureLogger(name) called with a function not returning a name" - ); - } - } - if (this.hooks.infrastructureLog.call(name, type, args) === undefined) { - if (this.infrastructureLogger !== undefined) { - this.infrastructureLogger(name, type, args); - } - } - }, - childName => { - if (typeof name === "function") { - if (typeof childName === "function") { - return this.getInfrastructureLogger(() => { - if (typeof name === "function") { - name = name(); - if (!name) { - throw new TypeError( - "Compiler.getInfrastructureLogger(name) called with a function not returning a name" - ); - } - } - if (typeof childName === "function") { - childName = childName(); - if (!childName) { - throw new TypeError( - "Logger.getChildLogger(name) called with a function not returning a name" - ); - } - } - return `${name}/${childName}`; - }); - } else { - return this.getInfrastructureLogger(() => { - if (typeof name === "function") { - name = name(); - if (!name) { - throw new TypeError( - "Compiler.getInfrastructureLogger(name) called with a function not returning a name" - ); - } + [Symbol.iterator]() { + let state = 0; + /** @type {IterableIterator} */ + let it; + /** @type {(Snapshot) => (Map | Set)[]} */ + let getMaps; + /** @type {(Map | Set)[]} */ + let maps; + /** @type {Snapshot} */ + let snapshot; + let queue; + return new SnapshotIterator(() => { + for (;;) { + switch (state) { + case 0: + snapshot = this.snapshot; + getMaps = this.getMaps; + maps = getMaps(snapshot); + state = 1; + /* falls through */ + case 1: + if (maps.length > 0) { + const map = maps.pop(); + if (map !== undefined) { + it = map.keys(); + state = 2; + } else { + break; } - return `${name}/${childName}`; - }); + } else { + state = 3; + break; + } + /* falls through */ + case 2: { + const result = it.next(); + if (!result.done) return result; + state = 1; + break; } - } else { - if (typeof childName === "function") { - return this.getInfrastructureLogger(() => { - if (typeof childName === "function") { - childName = childName(); - if (!childName) { - throw new TypeError( - "Logger.getChildLogger(name) called with a function not returning a name" - ); - } + case 3: { + const children = snapshot.children; + if (children !== undefined) { + if (children.size === 1) { + // shortcut for a single child + // avoids allocation of queue + for (const child of children) snapshot = child; + maps = getMaps(snapshot); + state = 1; + break; } - return `${name}/${childName}`; - }); - } else { - return this.getInfrastructureLogger(`${name}/${childName}`); + if (queue === undefined) queue = []; + for (const child of children) { + queue.push(child); + } + } + if (queue !== undefined && queue.length > 0) { + snapshot = queue.pop(); + maps = getMaps(snapshot); + state = 1; + break; + } else { + state = 4; + } } + /* falls through */ + case 4: + return DONE_ITERATOR_RESULT; } } - ); + }); } +} - // TODO webpack 6: solve this in a better way - // e.g. move compilation specific info from Modules into ModuleGraph - _cleanupLastCompilation() { - if (this._lastCompilation !== undefined) { - for (const module of this._lastCompilation.modules) { - ChunkGraph.clearChunkGraphForModule(module); - ModuleGraph.clearModuleGraphForModule(module); - module.cleanupForCache(); - } - for (const chunk of this._lastCompilation.chunks) { - ChunkGraph.clearChunkGraphForChunk(chunk); - } - this._lastCompilation = undefined; - } +class Snapshot { + constructor() { + this._flags = 0; + /** @type {number | undefined} */ + this.startTime = undefined; + /** @type {Map | undefined} */ + this.fileTimestamps = undefined; + /** @type {Map | undefined} */ + this.fileHashes = undefined; + /** @type {Map | undefined} */ + this.fileTshs = undefined; + /** @type {Map | undefined} */ + this.contextTimestamps = undefined; + /** @type {Map | undefined} */ + this.contextHashes = undefined; + /** @type {Map | undefined} */ + this.contextTshs = undefined; + /** @type {Map | undefined} */ + this.missingExistence = undefined; + /** @type {Map | undefined} */ + this.managedItemInfo = undefined; + /** @type {Set | undefined} */ + this.managedFiles = undefined; + /** @type {Set | undefined} */ + this.managedContexts = undefined; + /** @type {Set | undefined} */ + this.managedMissing = undefined; + /** @type {Set | undefined} */ + this.children = undefined; } - // TODO webpack 6: solve this in a better way - _cleanupLastNormalModuleFactory() { - if (this._lastNormalModuleFactory !== undefined) { - this._lastNormalModuleFactory.cleanupForCache(); - this._lastNormalModuleFactory = undefined; - } + hasStartTime() { + return (this._flags & 1) !== 0; } - /** - * @param {WatchOptions} watchOptions the watcher's options - * @param {Callback} handler signals when the call finishes - * @returns {Watching} a compiler watcher - */ - watch(watchOptions, handler) { - if (this.running) { - return handler(new ConcurrentCompilationError()); - } - - this.running = true; - this.watchMode = true; - this.watching = new Watching(this, watchOptions, handler); - return this.watching; + setStartTime(value) { + this._flags = this._flags | 1; + this.startTime = value; } - /** - * @param {Callback} callback signals when the call finishes - * @returns {void} - */ - run(callback) { - if (this.running) { - return callback(new ConcurrentCompilationError()); + setMergedStartTime(value, snapshot) { + if (value) { + if (snapshot.hasStartTime()) { + this.setStartTime(Math.min(value, snapshot.startTime)); + } else { + this.setStartTime(value); + } + } else { + if (snapshot.hasStartTime()) this.setStartTime(snapshot.startTime); } + } - let logger; + hasFileTimestamps() { + return (this._flags & 2) !== 0; + } - const finalCallback = (err, stats) => { - if (logger) logger.time("beginIdle"); - this.idle = true; - this.cache.beginIdle(); - this.idle = true; - if (logger) logger.timeEnd("beginIdle"); - this.running = false; - if (err) { - this.hooks.failed.call(err); - } - if (callback !== undefined) callback(err, stats); - this.hooks.afterDone.call(stats); - }; + setFileTimestamps(value) { + this._flags = this._flags | 2; + this.fileTimestamps = value; + } - const startTime = Date.now(); + hasFileHashes() { + return (this._flags & 4) !== 0; + } - this.running = true; + setFileHashes(value) { + this._flags = this._flags | 4; + this.fileHashes = value; + } - const onCompiled = (err, compilation) => { - if (err) return finalCallback(err); + hasFileTshs() { + return (this._flags & 8) !== 0; + } - if (this.hooks.shouldEmit.call(compilation) === false) { - compilation.startTime = startTime; - compilation.endTime = Date.now(); - const stats = new Stats(compilation); - this.hooks.done.callAsync(stats, err => { - if (err) return finalCallback(err); - return finalCallback(null, stats); - }); - return; - } + setFileTshs(value) { + this._flags = this._flags | 8; + this.fileTshs = value; + } - process.nextTick(() => { - logger = compilation.getLogger("webpack.Compiler"); - logger.time("emitAssets"); - this.emitAssets(compilation, err => { - logger.timeEnd("emitAssets"); - if (err) return finalCallback(err); + hasContextTimestamps() { + return (this._flags & 0x10) !== 0; + } - if (compilation.hooks.needAdditionalPass.call()) { - compilation.needAdditionalPass = true; + setContextTimestamps(value) { + this._flags = this._flags | 0x10; + this.contextTimestamps = value; + } - compilation.startTime = startTime; - compilation.endTime = Date.now(); - logger.time("done hook"); - const stats = new Stats(compilation); - this.hooks.done.callAsync(stats, err => { - logger.timeEnd("done hook"); - if (err) return finalCallback(err); + hasContextHashes() { + return (this._flags & 0x20) !== 0; + } - this.hooks.additionalPass.callAsync(err => { - if (err) return finalCallback(err); - this.compile(onCompiled); - }); - }); - return; - } + setContextHashes(value) { + this._flags = this._flags | 0x20; + this.contextHashes = value; + } - logger.time("emitRecords"); - this.emitRecords(err => { - logger.timeEnd("emitRecords"); - if (err) return finalCallback(err); + hasContextTshs() { + return (this._flags & 0x40) !== 0; + } - compilation.startTime = startTime; - compilation.endTime = Date.now(); - logger.time("done hook"); - const stats = new Stats(compilation); - this.hooks.done.callAsync(stats, err => { - logger.timeEnd("done hook"); - if (err) return finalCallback(err); - this.cache.storeBuildDependencies( - compilation.buildDependencies, - err => { - if (err) return finalCallback(err); - return finalCallback(null, stats); - } - ); - }); - }); - }); - }); - }; + setContextTshs(value) { + this._flags = this._flags | 0x40; + this.contextTshs = value; + } - const run = () => { - this.hooks.beforeRun.callAsync(this, err => { - if (err) return finalCallback(err); + hasMissingExistence() { + return (this._flags & 0x80) !== 0; + } - this.hooks.run.callAsync(this, err => { - if (err) return finalCallback(err); + setMissingExistence(value) { + this._flags = this._flags | 0x80; + this.missingExistence = value; + } - this.readRecords(err => { - if (err) return finalCallback(err); + hasManagedItemInfo() { + return (this._flags & 0x100) !== 0; + } - this.compile(onCompiled); - }); - }); - }); - }; + setManagedItemInfo(value) { + this._flags = this._flags | 0x100; + this.managedItemInfo = value; + } - if (this.idle) { - this.cache.endIdle(err => { - if (err) return finalCallback(err); + hasManagedFiles() { + return (this._flags & 0x200) !== 0; + } - this.idle = false; - run(); - }); - } else { - run(); - } + setManagedFiles(value) { + this._flags = this._flags | 0x200; + this.managedFiles = value; } - /** - * @param {RunAsChildCallback} callback signals when the call finishes - * @returns {void} - */ - runAsChild(callback) { - const startTime = Date.now(); - this.compile((err, compilation) => { - if (err) return callback(err); + hasManagedContexts() { + return (this._flags & 0x400) !== 0; + } - this.parentCompilation.children.push(compilation); - for (const { name, source, info } of compilation.getAssets()) { - this.parentCompilation.emitAsset(name, source, info); - } + setManagedContexts(value) { + this._flags = this._flags | 0x400; + this.managedContexts = value; + } - const entries = []; - for (const ep of compilation.entrypoints.values()) { - entries.push(...ep.chunks); - } + hasManagedMissing() { + return (this._flags & 0x800) !== 0; + } - compilation.startTime = startTime; - compilation.endTime = Date.now(); + setManagedMissing(value) { + this._flags = this._flags | 0x800; + this.managedMissing = value; + } - return callback(null, entries, compilation); - }); + hasChildren() { + return (this._flags & 0x1000) !== 0; } - purgeInputFileSystem() { - if (this.inputFileSystem && this.inputFileSystem.purge) { - this.inputFileSystem.purge(); + setChildren(value) { + this._flags = this._flags | 0x1000; + this.children = value; + } + + addChild(child) { + if (!this.hasChildren()) { + this.setChildren(new Set()); } + this.children.add(child); + } + + serialize({ write }) { + write(this._flags); + if (this.hasStartTime()) write(this.startTime); + if (this.hasFileTimestamps()) write(this.fileTimestamps); + if (this.hasFileHashes()) write(this.fileHashes); + if (this.hasFileTshs()) write(this.fileTshs); + if (this.hasContextTimestamps()) write(this.contextTimestamps); + if (this.hasContextHashes()) write(this.contextHashes); + if (this.hasContextTshs()) write(this.contextTshs); + if (this.hasMissingExistence()) write(this.missingExistence); + if (this.hasManagedItemInfo()) write(this.managedItemInfo); + if (this.hasManagedFiles()) write(this.managedFiles); + if (this.hasManagedContexts()) write(this.managedContexts); + if (this.hasManagedMissing()) write(this.managedMissing); + if (this.hasChildren()) write(this.children); + } + + deserialize({ read }) { + this._flags = read(); + if (this.hasStartTime()) this.startTime = read(); + if (this.hasFileTimestamps()) this.fileTimestamps = read(); + if (this.hasFileHashes()) this.fileHashes = read(); + if (this.hasFileTshs()) this.fileTshs = read(); + if (this.hasContextTimestamps()) this.contextTimestamps = read(); + if (this.hasContextHashes()) this.contextHashes = read(); + if (this.hasContextTshs()) this.contextTshs = read(); + if (this.hasMissingExistence()) this.missingExistence = read(); + if (this.hasManagedItemInfo()) this.managedItemInfo = read(); + if (this.hasManagedFiles()) this.managedFiles = read(); + if (this.hasManagedContexts()) this.managedContexts = read(); + if (this.hasManagedMissing()) this.managedMissing = read(); + if (this.hasChildren()) this.children = read(); } /** - * @param {Compilation} compilation the compilation - * @param {Callback} callback signals when the assets are emitted - * @returns {void} + * @param {function(Snapshot): (ReadonlyMap | ReadonlySet)[]} getMaps first + * @returns {Iterable} iterable */ - emitAssets(compilation, callback) { - let outputPath; + _createIterable(getMaps) { + return new SnapshotIterable(this, getMaps); + } - const emitFiles = err => { - if (err) return callback(err); + /** + * @returns {Iterable} iterable + */ + getFileIterable() { + return this._createIterable(s => [ + s.fileTimestamps, + s.fileHashes, + s.fileTshs, + s.managedFiles + ]); + } - const assets = compilation.getAssets(); - compilation.assets = { ...compilation.assets }; - /** @type {Map} */ - const caseInsensitiveMap = new Map(); - /** @type {Set} */ - const allTargetPaths = new Set(); - asyncLib.forEachLimit( - assets, - 15, - ({ name: file, source, info }, callback) => { - let targetFile = file; - let immutable = info.immutable; - const queryStringIdx = targetFile.indexOf("?"); - if (queryStringIdx >= 0) { - targetFile = targetFile.substr(0, queryStringIdx); - // We may remove the hash, which is in the query string - // So we recheck if the file is immutable - // This doesn't cover all cases, but immutable is only a performance optimization anyway - immutable = - immutable && - (includesHash(targetFile, info.contenthash) || - includesHash(targetFile, info.chunkhash) || - includesHash(targetFile, info.modulehash) || - includesHash(targetFile, info.fullhash)); - } + /** + * @returns {Iterable} iterable + */ + getContextIterable() { + return this._createIterable(s => [ + s.contextTimestamps, + s.contextHashes, + s.contextTshs, + s.managedContexts + ]); + } - const writeOut = err => { - if (err) return callback(err); - const targetPath = join( - this.outputFileSystem, - outputPath, - targetFile - ); - allTargetPaths.add(targetPath); - - // check if the target file has already been written by this Compiler - const targetFileGeneration = - this._assetEmittingWrittenFiles.get(targetPath); - - // create an cache entry for this Source if not already existing - let cacheEntry = this._assetEmittingSourceCache.get(source); - if (cacheEntry === undefined) { - cacheEntry = { - sizeOnlySource: undefined, - writtenTo: new Map() - }; - this._assetEmittingSourceCache.set(source, cacheEntry); - } - - let similarEntry; - - const checkSimilarFile = () => { - const caseInsensitiveTargetPath = targetPath.toLowerCase(); - similarEntry = caseInsensitiveMap.get(caseInsensitiveTargetPath); - if (similarEntry !== undefined) { - const { path: other, source: otherSource } = similarEntry; - if (isSourceEqual(otherSource, source)) { - // Size may or may not be available at this point. - // If it's not available add to "waiting" list and it will be updated once available - if (similarEntry.size !== undefined) { - updateWithReplacementSource(similarEntry.size); - } else { - if (!similarEntry.waiting) similarEntry.waiting = []; - similarEntry.waiting.push({ file, cacheEntry }); - } - alreadyWritten(); - } else { - const err = - new WebpackError(`Prevent writing to file that only differs in casing or query string from already written file. -This will lead to a race-condition and corrupted files on case-insensitive file systems. -${targetPath} -${other}`); - err.file = file; - callback(err); - } - return true; - } else { - caseInsensitiveMap.set( - caseInsensitiveTargetPath, - (similarEntry = { - path: targetPath, - source, - size: undefined, - waiting: undefined - }) - ); - return false; - } - }; - - /** - * get the binary (Buffer) content from the Source - * @returns {Buffer} content for the source - */ - const getContent = () => { - if (typeof source.buffer === "function") { - return source.buffer(); - } else { - const bufferOrString = source.source(); - if (Buffer.isBuffer(bufferOrString)) { - return bufferOrString; - } else { - return Buffer.from(bufferOrString, "utf8"); - } - } - }; - - const alreadyWritten = () => { - // cache the information that the Source has been already been written to that location - if (targetFileGeneration === undefined) { - const newGeneration = 1; - this._assetEmittingWrittenFiles.set(targetPath, newGeneration); - cacheEntry.writtenTo.set(targetPath, newGeneration); - } else { - cacheEntry.writtenTo.set(targetPath, targetFileGeneration); - } - callback(); - }; - - /** - * Write the file to output file system - * @param {Buffer} content content to be written - * @returns {void} - */ - const doWrite = content => { - this.outputFileSystem.writeFile(targetPath, content, err => { - if (err) return callback(err); - - // information marker that the asset has been emitted - compilation.emittedAssets.add(file); - - // cache the information that the Source has been written to that location - const newGeneration = - targetFileGeneration === undefined - ? 1 - : targetFileGeneration + 1; - cacheEntry.writtenTo.set(targetPath, newGeneration); - this._assetEmittingWrittenFiles.set(targetPath, newGeneration); - this.hooks.assetEmitted.callAsync( - file, - { - content, - source, - outputPath, - compilation, - targetPath - }, - callback - ); - }); - }; - - const updateWithReplacementSource = size => { - updateFileWithReplacementSource(file, cacheEntry, size); - similarEntry.size = size; - if (similarEntry.waiting !== undefined) { - for (const { file, cacheEntry } of similarEntry.waiting) { - updateFileWithReplacementSource(file, cacheEntry, size); - } - } - }; - - const updateFileWithReplacementSource = ( - file, - cacheEntry, - size - ) => { - // Create a replacement resource which only allows to ask for size - // This allows to GC all memory allocated by the Source - // (expect when the Source is stored in any other cache) - if (!cacheEntry.sizeOnlySource) { - cacheEntry.sizeOnlySource = new SizeOnlySource(size); - } - compilation.updateAsset(file, cacheEntry.sizeOnlySource, { - size - }); - }; + /** + * @returns {Iterable} iterable + */ + getMissingIterable() { + return this._createIterable(s => [s.missingExistence, s.managedMissing]); + } +} - const processExistingFile = stats => { - // skip emitting if it's already there and an immutable file - if (immutable) { - updateWithReplacementSource(stats.size); - return alreadyWritten(); - } +makeSerializable(Snapshot, "webpack/lib/FileSystemInfo", "Snapshot"); - const content = getContent(); +const MIN_COMMON_SNAPSHOT_SIZE = 3; - updateWithReplacementSource(content.length); +/** + * @template T + */ +class SnapshotOptimization { + /** + * @param {function(Snapshot): boolean} has has value + * @param {function(Snapshot): Map | Set} get get value + * @param {function(Snapshot, Map | Set): void} set set value + * @param {boolean=} useStartTime use the start time of snapshots + * @param {boolean=} isSet value is an Set instead of a Map + */ + constructor(has, get, set, useStartTime = true, isSet = false) { + this._has = has; + this._get = get; + this._set = set; + this._useStartTime = useStartTime; + this._isSet = isSet; + /** @type {Map} */ + this._map = new Map(); + this._statItemsShared = 0; + this._statItemsUnshared = 0; + this._statSharedSnapshots = 0; + this._statReusedSharedSnapshots = 0; + } - // if it exists and content on disk matches content - // skip writing the same content again - // (to keep mtime and don't trigger watchers) - // for a fast negative match file size is compared first - if (content.length === stats.size) { - compilation.comparedForEmitAssets.add(file); - return this.outputFileSystem.readFile( - targetPath, - (err, existingContent) => { - if ( - err || - !content.equals(/** @type {Buffer} */ (existingContent)) - ) { - return doWrite(content); - } else { - return alreadyWritten(); - } - } - ); - } + getStatisticMessage() { + const total = this._statItemsShared + this._statItemsUnshared; + if (total === 0) return undefined; + return `${ + this._statItemsShared && Math.round((this._statItemsShared * 100) / total) + }% (${this._statItemsShared}/${total}) entries shared via ${ + this._statSharedSnapshots + } shared snapshots (${ + this._statReusedSharedSnapshots + this._statSharedSnapshots + } times referenced)`; + } - return doWrite(content); - }; + clear() { + this._map.clear(); + this._statItemsShared = 0; + this._statItemsUnshared = 0; + this._statSharedSnapshots = 0; + this._statReusedSharedSnapshots = 0; + } - const processMissingFile = () => { - const content = getContent(); + /** + * @param {Snapshot} newSnapshot snapshot + * @param {Set} capturedFiles files to snapshot/share + * @returns {void} + */ + optimize(newSnapshot, capturedFiles) { + /** + * @param {SnapshotOptimizationEntry} entry optimization entry + * @returns {void} + */ + const increaseSharedAndStoreOptimizationEntry = entry => { + if (entry.children !== undefined) { + entry.children.forEach(increaseSharedAndStoreOptimizationEntry); + } + entry.shared++; + storeOptimizationEntry(entry); + }; + /** + * @param {SnapshotOptimizationEntry} entry optimization entry + * @returns {void} + */ + const storeOptimizationEntry = entry => { + for (const path of entry.snapshotContent) { + const old = this._map.get(path); + if (old.shared < entry.shared) { + this._map.set(path, entry); + } + capturedFiles.delete(path); + } + }; - updateWithReplacementSource(content.length); + /** @type {SnapshotOptimizationEntry} */ + let newOptimizationEntry = undefined; - return doWrite(content); - }; + const capturedFilesSize = capturedFiles.size; - // if the target file has already been written - if (targetFileGeneration !== undefined) { - // check if the Source has been written to this target file - const writtenGeneration = cacheEntry.writtenTo.get(targetPath); - if (writtenGeneration === targetFileGeneration) { - // if yes, we may skip writing the file - // if it's already there - // (we assume one doesn't modify files while the Compiler is running, other then removing them) + /** @type {Set | undefined} */ + const optimizationEntries = new Set(); - if (this._assetEmittingPreviousFiles.has(targetPath)) { - // We assume that assets from the last compilation say intact on disk (they are not removed) - compilation.updateAsset(file, cacheEntry.sizeOnlySource, { - size: cacheEntry.sizeOnlySource.size() - }); + for (const path of capturedFiles) { + const optimizationEntry = this._map.get(path); + if (optimizationEntry === undefined) { + if (newOptimizationEntry === undefined) { + newOptimizationEntry = { + snapshot: newSnapshot, + shared: 0, + snapshotContent: undefined, + children: undefined + }; + } + this._map.set(path, newOptimizationEntry); + continue; + } else { + optimizationEntries.add(optimizationEntry); + } + } - return callback(); - } else { - // Settings immutable will make it accept file content without comparing when file exist - immutable = true; - } - } else if (!immutable) { - if (checkSimilarFile()) return; - // We wrote to this file before which has very likely a different content - // skip comparing and assume content is different for performance - // This case happens often during watch mode. - return processMissingFile(); - } + optimizationEntries: for (const optimizationEntry of optimizationEntries) { + const snapshot = optimizationEntry.snapshot; + if (optimizationEntry.shared > 0) { + // It's a shared snapshot + // We can't change it, so we can only use it when all files match + // and startTime is compatible + if ( + this._useStartTime && + newSnapshot.startTime && + (!snapshot.startTime || snapshot.startTime > newSnapshot.startTime) + ) { + continue; + } + const nonSharedFiles = new Set(); + const snapshotContent = optimizationEntry.snapshotContent; + const snapshotEntries = this._get(snapshot); + for (const path of snapshotContent) { + if (!capturedFiles.has(path)) { + if (!snapshotEntries.has(path)) { + // File is not shared and can't be removed from the snapshot + // because it's in a child of the snapshot + continue optimizationEntries; } - - if (checkSimilarFile()) return; - if (this.options.output.compareBeforeEmit) { - this.outputFileSystem.stat(targetPath, (err, stats) => { - const exists = !err && stats.isFile(); - - if (exists) { - processExistingFile(stats); - } else { - processMissingFile(); - } - }); - } else { - processMissingFile(); + nonSharedFiles.add(path); + continue; + } + } + if (nonSharedFiles.size === 0) { + // The complete snapshot is shared + // add it as child + newSnapshot.addChild(snapshot); + increaseSharedAndStoreOptimizationEntry(optimizationEntry); + this._statReusedSharedSnapshots++; + } else { + // Only a part of the snapshot is shared + const sharedCount = snapshotContent.size - nonSharedFiles.size; + if (sharedCount < MIN_COMMON_SNAPSHOT_SIZE) { + // Common part it too small + continue optimizationEntries; + } + // Extract common timestamps from both snapshots + let commonMap; + if (this._isSet) { + commonMap = new Set(); + for (const path of /** @type {Set} */ (snapshotEntries)) { + if (nonSharedFiles.has(path)) continue; + commonMap.add(path); + snapshotEntries.delete(path); + } + } else { + commonMap = new Map(); + const map = /** @type {Map} */ (snapshotEntries); + for (const [path, value] of map) { + if (nonSharedFiles.has(path)) continue; + commonMap.set(path, value); + snapshotEntries.delete(path); } + } + // Create and attach snapshot + const commonSnapshot = new Snapshot(); + if (this._useStartTime) { + commonSnapshot.setMergedStartTime(newSnapshot.startTime, snapshot); + } + this._set(commonSnapshot, commonMap); + newSnapshot.addChild(commonSnapshot); + snapshot.addChild(commonSnapshot); + // Create optimization entry + const newEntry = { + snapshot: commonSnapshot, + shared: optimizationEntry.shared + 1, + snapshotContent: new Set(commonMap.keys()), + children: undefined }; - - if (targetFile.match(/\/|\\/)) { - const fs = this.outputFileSystem; - const dir = dirname(fs, join(fs, outputPath, targetFile)); - mkdirp(fs, dir, writeOut); + if (optimizationEntry.children === undefined) + optimizationEntry.children = new Set(); + optimizationEntry.children.add(newEntry); + storeOptimizationEntry(newEntry); + this._statSharedSnapshots++; + } + } else { + // It's a unshared snapshot + // We can extract a common shared snapshot + // with all common files + const snapshotEntries = this._get(snapshot); + if (snapshotEntries === undefined) { + // Incomplete snapshot, that can't be used + continue optimizationEntries; + } + let commonMap; + if (this._isSet) { + commonMap = new Set(); + const set = /** @type {Set} */ (snapshotEntries); + if (capturedFiles.size < set.size) { + for (const path of capturedFiles) { + if (set.has(path)) commonMap.add(path); + } } else { - writeOut(); + for (const path of set) { + if (capturedFiles.has(path)) commonMap.add(path); + } } - }, - err => { - // Clear map to free up memory - caseInsensitiveMap.clear(); - if (err) { - this._assetEmittingPreviousFiles.clear(); - return callback(err); + } else { + commonMap = new Map(); + const map = /** @type {Map} */ (snapshotEntries); + for (const path of capturedFiles) { + const ts = map.get(path); + if (ts === undefined) continue; + commonMap.set(path, ts); } - - this._assetEmittingPreviousFiles = allTargetPaths; - - this.hooks.afterEmit.callAsync(compilation, err => { - if (err) return callback(err); - - return callback(); - }); } - ); - }; - - this.hooks.emit.callAsync(compilation, err => { - if (err) return callback(err); - outputPath = compilation.getPath(this.outputPath, {}); - mkdirp(this.outputFileSystem, outputPath, emitFiles); - }); - } - /** - * @param {Callback} callback signals when the call finishes - * @returns {void} - */ - emitRecords(callback) { - if (this.hooks.emitRecords.isUsed()) { - if (this.recordsOutputPath) { - asyncLib.parallel( - [ - cb => this.hooks.emitRecords.callAsync(cb), - this._emitRecords.bind(this) - ], - err => callback(err) - ); - } else { - this.hooks.emitRecords.callAsync(callback); - } - } else { - if (this.recordsOutputPath) { - this._emitRecords(callback); - } else { - callback(); + if (commonMap.size < MIN_COMMON_SNAPSHOT_SIZE) { + // Common part it too small + continue optimizationEntries; + } + // Create and attach snapshot + const commonSnapshot = new Snapshot(); + if (this._useStartTime) { + commonSnapshot.setMergedStartTime(newSnapshot.startTime, snapshot); + } + this._set(commonSnapshot, commonMap); + newSnapshot.addChild(commonSnapshot); + snapshot.addChild(commonSnapshot); + // Remove files from snapshot + for (const path of commonMap.keys()) snapshotEntries.delete(path); + const sharedCount = commonMap.size; + this._statItemsUnshared -= sharedCount; + this._statItemsShared += sharedCount; + // Create optimization entry + storeOptimizationEntry({ + snapshot: commonSnapshot, + shared: 2, + snapshotContent: new Set(commonMap.keys()), + children: undefined + }); + this._statSharedSnapshots++; } } + const unshared = capturedFiles.size; + this._statItemsUnshared += unshared; + this._statItemsShared += capturedFilesSize - unshared; } +} - /** - * @param {Callback} callback signals when the call finishes - * @returns {void} - */ - _emitRecords(callback) { - const writeFile = () => { - this.outputFileSystem.writeFile( - this.recordsOutputPath, - JSON.stringify( - this.records, - (n, value) => { - if ( - typeof value === "object" && - value !== null && - !Array.isArray(value) - ) { - const keys = Object.keys(value); - if (!isSorted(keys)) { - return sortObject(value, keys); - } - } - return value; - }, - 2 - ), - callback - ); - }; +const parseString = str => { + if (str[0] === "'") str = `"${str.slice(1, -1).replace(/"/g, '\\"')}"`; + return JSON.parse(str); +}; - const recordsOutputPathDirectory = dirname( - this.outputFileSystem, - this.recordsOutputPath - ); - if (!recordsOutputPathDirectory) { - return writeFile(); - } - mkdirp(this.outputFileSystem, recordsOutputPathDirectory, err => { - if (err) return callback(err); - writeFile(); - }); +/* istanbul ignore next */ +/** + * @param {number} mtime mtime + */ +const applyMtime = mtime => { + if (FS_ACCURACY > 1 && mtime % 2 !== 0) FS_ACCURACY = 1; + else if (FS_ACCURACY > 10 && mtime % 20 !== 0) FS_ACCURACY = 10; + else if (FS_ACCURACY > 100 && mtime % 200 !== 0) FS_ACCURACY = 100; + else if (FS_ACCURACY > 1000 && mtime % 2000 !== 0) FS_ACCURACY = 1000; +}; + +/** + * @template T + * @template K + * @param {Map} a source map + * @param {Map} b joining map + * @returns {Map} joined map + */ +const mergeMaps = (a, b) => { + if (!b || b.size === 0) return a; + if (!a || a.size === 0) return b; + const map = new Map(a); + for (const [key, value] of b) { + map.set(key, value); } + return map; +}; - /** - * @param {Callback} callback signals when the call finishes - * @returns {void} - */ - readRecords(callback) { - if (this.hooks.readRecords.isUsed()) { - if (this.recordsInputPath) { - asyncLib.parallel([ - cb => this.hooks.readRecords.callAsync(cb), - this._readRecords.bind(this) - ]); - } else { - this.records = {}; - this.hooks.readRecords.callAsync(callback); - } - } else { - if (this.recordsInputPath) { - this._readRecords(callback); - } else { - this.records = {}; - callback(); - } - } +/** + * @template T + * @template K + * @param {Set} a source map + * @param {Set} b joining map + * @returns {Set} joined map + */ +const mergeSets = (a, b) => { + if (!b || b.size === 0) return a; + if (!a || a.size === 0) return b; + const map = new Set(a); + for (const item of b) { + map.add(item); } + return map; +}; - /** - * @param {Callback} callback signals when the call finishes - * @returns {void} - */ - _readRecords(callback) { - if (!this.recordsInputPath) { - this.records = {}; - return callback(); +/** + * Finding file or directory to manage + * @param {string} managedPath path that is managing by {@link FileSystemInfo} + * @param {string} path path to file or directory + * @returns {string|null} managed item + * @example + * getManagedItem( + * '/Users/user/my-project/node_modules/', + * '/Users/user/my-project/node_modules/package/index.js' + * ) === '/Users/user/my-project/node_modules/package' + * getManagedItem( + * '/Users/user/my-project/node_modules/', + * '/Users/user/my-project/node_modules/package1/node_modules/package2' + * ) === '/Users/user/my-project/node_modules/package1/node_modules/package2' + * getManagedItem( + * '/Users/user/my-project/node_modules/', + * '/Users/user/my-project/node_modules/.bin/script.js' + * ) === null // hidden files are disallowed as managed items + * getManagedItem( + * '/Users/user/my-project/node_modules/', + * '/Users/user/my-project/node_modules/package' + * ) === '/Users/user/my-project/node_modules/package' + */ +const getManagedItem = (managedPath, path) => { + let i = managedPath.length; + let slashes = 1; + let startingPosition = true; + loop: while (i < path.length) { + switch (path.charCodeAt(i)) { + case 47: // slash + case 92: // backslash + if (--slashes === 0) break loop; + startingPosition = true; + break; + case 46: // . + // hidden files are disallowed as managed items + // it's probably .yarn-integrity or .cache + if (startingPosition) return null; + break; + case 64: // @ + if (!startingPosition) return null; + slashes++; + break; + default: + startingPosition = false; + break; } - this.inputFileSystem.stat(this.recordsInputPath, err => { - // It doesn't exist - // We can ignore this. - if (err) return callback(); - - this.inputFileSystem.readFile(this.recordsInputPath, (err, content) => { - if (err) return callback(err); - - try { - this.records = parseJson(content.toString("utf-8")); - } catch (e) { - e.message = "Cannot parse records: " + e.message; - return callback(e); - } - - return callback(); - }); - }); + i++; } - - /** - * @param {Compilation} compilation the compilation - * @param {string} compilerName the compiler's name - * @param {number} compilerIndex the compiler's index - * @param {OutputOptions=} outputOptions the output options - * @param {WebpackPluginInstance[]=} plugins the plugins to apply - * @returns {Compiler} a child compiler - */ - createChildCompiler( - compilation, - compilerName, - compilerIndex, - outputOptions, - plugins + if (i === path.length) slashes--; + // return null when path is incomplete + if (slashes !== 0) return null; + // if (path.slice(i + 1, i + 13) === "node_modules") + if ( + path.length >= i + 13 && + path.charCodeAt(i + 1) === 110 && + path.charCodeAt(i + 2) === 111 && + path.charCodeAt(i + 3) === 100 && + path.charCodeAt(i + 4) === 101 && + path.charCodeAt(i + 5) === 95 && + path.charCodeAt(i + 6) === 109 && + path.charCodeAt(i + 7) === 111 && + path.charCodeAt(i + 8) === 100 && + path.charCodeAt(i + 9) === 117 && + path.charCodeAt(i + 10) === 108 && + path.charCodeAt(i + 11) === 101 && + path.charCodeAt(i + 12) === 115 ) { - const childCompiler = new Compiler(this.context, { - ...this.options, - output: { - ...this.options.output, - ...outputOptions - } - }); - childCompiler.name = compilerName; - childCompiler.outputPath = this.outputPath; - childCompiler.inputFileSystem = this.inputFileSystem; - childCompiler.outputFileSystem = null; - childCompiler.resolverFactory = this.resolverFactory; - childCompiler.modifiedFiles = this.modifiedFiles; - childCompiler.removedFiles = this.removedFiles; - childCompiler.fileTimestamps = this.fileTimestamps; - childCompiler.contextTimestamps = this.contextTimestamps; - childCompiler.fsStartTime = this.fsStartTime; - childCompiler.cache = this.cache; - childCompiler.compilerPath = `${this.compilerPath}${compilerName}|${compilerIndex}|`; - childCompiler._backCompat = this._backCompat; - - const relativeCompilerName = makePathsRelative( - this.context, - compilerName, - this.root - ); - if (!this.records[relativeCompilerName]) { - this.records[relativeCompilerName] = []; - } - if (this.records[relativeCompilerName][compilerIndex]) { - childCompiler.records = this.records[relativeCompilerName][compilerIndex]; - } else { - this.records[relativeCompilerName].push((childCompiler.records = {})); - } - - childCompiler.parentCompilation = compilation; - childCompiler.root = this.root; - if (Array.isArray(plugins)) { - for (const plugin of plugins) { - plugin.apply(childCompiler); - } - } - for (const name in this.hooks) { - if ( - ![ - "make", - "compile", - "emit", - "afterEmit", - "invalid", - "done", - "thisCompilation" - ].includes(name) - ) { - if (childCompiler.hooks[name]) { - childCompiler.hooks[name].taps = this.hooks[name].taps.slice(); - } - } + // if this is the end of the path + if (path.length === i + 13) { + // return the node_modules directory + // it's special + return path; } - - compilation.hooks.childCompiler.call( - childCompiler, - compilerName, - compilerIndex - ); - - return childCompiler; - } - - isChild() { - return !!this.parentCompilation; - } - - createCompilation(params) { - this._cleanupLastCompilation(); - return (this._lastCompilation = new Compilation(this, params)); - } - - /** - * @param {CompilationParams} params the compilation parameters - * @returns {Compilation} the created compilation - */ - newCompilation(params) { - const compilation = this.createCompilation(params); - compilation.name = this.name; - compilation.records = this.records; - this.hooks.thisCompilation.call(compilation, params); - this.hooks.compilation.call(compilation, params); - return compilation; - } - - createNormalModuleFactory() { - this._cleanupLastNormalModuleFactory(); - const normalModuleFactory = new NormalModuleFactory({ - context: this.options.context, - fs: this.inputFileSystem, - resolverFactory: this.resolverFactory, - options: this.options.module, - associatedObjectForCache: this.root, - layers: this.options.experiments.layers - }); - this._lastNormalModuleFactory = normalModuleFactory; - this.hooks.normalModuleFactory.call(normalModuleFactory); - return normalModuleFactory; - } - - createContextModuleFactory() { - const contextModuleFactory = new ContextModuleFactory(this.resolverFactory); - this.hooks.contextModuleFactory.call(contextModuleFactory); - return contextModuleFactory; - } - - newCompilationParams() { - const params = { - normalModuleFactory: this.createNormalModuleFactory(), - contextModuleFactory: this.createContextModuleFactory() - }; - return params; - } - - /** - * @param {Callback} callback signals when the compilation finishes - * @returns {void} - */ - compile(callback) { - const params = this.newCompilationParams(); - this.hooks.beforeCompile.callAsync(params, err => { - if (err) return callback(err); - - this.hooks.compile.call(params); - - const compilation = this.newCompilation(params); - - const logger = compilation.getLogger("webpack.Compiler"); - - logger.time("make hook"); - this.hooks.make.callAsync(compilation, err => { - logger.timeEnd("make hook"); - if (err) return callback(err); - - logger.time("finish make hook"); - this.hooks.finishMake.callAsync(compilation, err => { - logger.timeEnd("finish make hook"); - if (err) return callback(err); - - process.nextTick(() => { - logger.time("finish compilation"); - compilation.finish(err => { - logger.timeEnd("finish compilation"); - if (err) return callback(err); - - logger.time("seal compilation"); - compilation.seal(err => { - logger.timeEnd("seal compilation"); - if (err) return callback(err); - - logger.time("afterCompile hook"); - this.hooks.afterCompile.callAsync(compilation, err => { - logger.timeEnd("afterCompile hook"); - if (err) return callback(err); - - return callback(null, compilation); - }); - }); - }); - }); - }); - }); - }); - } - - /** - * @param {Callback} callback signals when the compiler closes - * @returns {void} - */ - close(callback) { - if (this.watching) { - // When there is still an active watching, close this first - this.watching.close(err => { - this.close(callback); - }); - return; + const c = path.charCodeAt(i + 13); + // if next symbol is slash or backslash + if (c === 47 || c === 92) { + // Managed subpath + return getManagedItem(path.slice(0, i + 14), path); } - this.hooks.shutdown.callAsync(err => { - if (err) return callback(err); - // Get rid of reference to last compilation to avoid leaking memory - // We can't run this._cleanupLastCompilation() as the Stats to this compilation - // might be still in use. We try to get rid of the reference to the cache instead. - this._lastCompilation = undefined; - this._lastNormalModuleFactory = undefined; - this.cache.shutdown(callback); - }); } -} - -module.exports = Compiler; - - -/***/ }), - -/***/ 98229: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** @typedef {import("./Module")} Module */ - -const MODULE_REFERENCE_REGEXP = - /^__WEBPACK_MODULE_REFERENCE__(\d+)_([\da-f]+|ns)(_call)?(_directImport)?(?:_asiSafe(\d))?__$/; - -const DEFAULT_EXPORT = "__WEBPACK_DEFAULT_EXPORT__"; -const NAMESPACE_OBJECT_EXPORT = "__WEBPACK_NAMESPACE_OBJECT__"; + return path.slice(0, i); +}; /** - * @typedef {Object} ExternalModuleInfo - * @property {number} index - * @property {Module} module + * @template {ContextFileSystemInfoEntry | ContextTimestampAndHash} T + * @param {T} entry entry + * @returns {T["resolved"] | undefined} the resolved entry */ +const getResolvedTimestamp = entry => { + if (entry === null) return null; + if (entry.resolved !== undefined) return entry.resolved; + return entry.symlinks === undefined ? entry : undefined; +}; /** - * @typedef {Object} ConcatenatedModuleInfo - * @property {number} index - * @property {Module} module - * @property {Map} exportMap mapping from export name to symbol - * @property {Map} rawExportMap mapping from export name to symbol - * @property {string=} namespaceExportSymbol + * @param {ContextHash} entry entry + * @returns {string | undefined} the resolved entry */ +const getResolvedHash = entry => { + if (entry === null) return null; + if (entry.resolved !== undefined) return entry.resolved; + return entry.symlinks === undefined ? entry.hash : undefined; +}; -/** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo} ModuleInfo */ +const addAll = (source, target) => { + for (const key of source) target.add(key); +}; /** - * @typedef {Object} ModuleReferenceOptions - * @property {string[]} ids the properties/exports of the module - * @property {boolean} call true, when this referenced export is called - * @property {boolean} directImport true, when this referenced export is directly imported (not via property access) - * @property {boolean | undefined} asiSafe if the position is ASI safe or unknown + * Used to access information about the filesystem in a cached way */ - -class ConcatenationScope { - /** - * @param {ModuleInfo[] | Map} modulesMap all module info by module - * @param {ConcatenatedModuleInfo} currentModule the current module info - */ - constructor(modulesMap, currentModule) { - this._currentModule = currentModule; - if (Array.isArray(modulesMap)) { - const map = new Map(); - for (const info of modulesMap) { - map.set(info.module, info); - } - modulesMap = map; - } - this._modulesMap = modulesMap; - } - - /** - * @param {Module} module the referenced module - * @returns {boolean} true, when it's in the scope - */ - isModuleInScope(module) { - return this._modulesMap.has(module); - } - +class FileSystemInfo { /** - * - * @param {string} exportName name of the export - * @param {string} symbol identifier of the export in source code + * @param {InputFileSystem} fs file system + * @param {Object} options options + * @param {Iterable=} options.managedPaths paths that are only managed by a package manager + * @param {Iterable=} options.immutablePaths paths that are immutable + * @param {Logger=} options.logger logger used to log invalid snapshots + * @param {string | Hash=} options.hashFunction the hash function to use */ - registerExport(exportName, symbol) { - if (!this._currentModule.exportMap) { - this._currentModule.exportMap = new Map(); - } - if (!this._currentModule.exportMap.has(exportName)) { - this._currentModule.exportMap.set(exportName, symbol); - } - } + constructor( + fs, + { + managedPaths = [], + immutablePaths = [], + logger, + hashFunction = "md4" + } = {} + ) { + this.fs = fs; + this.logger = logger; + this._remainingLogs = logger ? 40 : 0; + this._loggedPaths = logger ? new Set() : undefined; + this._hashFunction = hashFunction; + /** @type {WeakMap} */ + this._snapshotCache = new WeakMap(); + this._fileTimestampsOptimization = new SnapshotOptimization( + s => s.hasFileTimestamps(), + s => s.fileTimestamps, + (s, v) => s.setFileTimestamps(v) + ); + this._fileHashesOptimization = new SnapshotOptimization( + s => s.hasFileHashes(), + s => s.fileHashes, + (s, v) => s.setFileHashes(v), + false + ); + this._fileTshsOptimization = new SnapshotOptimization( + s => s.hasFileTshs(), + s => s.fileTshs, + (s, v) => s.setFileTshs(v) + ); + this._contextTimestampsOptimization = new SnapshotOptimization( + s => s.hasContextTimestamps(), + s => s.contextTimestamps, + (s, v) => s.setContextTimestamps(v) + ); + this._contextHashesOptimization = new SnapshotOptimization( + s => s.hasContextHashes(), + s => s.contextHashes, + (s, v) => s.setContextHashes(v), + false + ); + this._contextTshsOptimization = new SnapshotOptimization( + s => s.hasContextTshs(), + s => s.contextTshs, + (s, v) => s.setContextTshs(v) + ); + this._missingExistenceOptimization = new SnapshotOptimization( + s => s.hasMissingExistence(), + s => s.missingExistence, + (s, v) => s.setMissingExistence(v), + false + ); + this._managedItemInfoOptimization = new SnapshotOptimization( + s => s.hasManagedItemInfo(), + s => s.managedItemInfo, + (s, v) => s.setManagedItemInfo(v), + false + ); + this._managedFilesOptimization = new SnapshotOptimization( + s => s.hasManagedFiles(), + s => s.managedFiles, + (s, v) => s.setManagedFiles(v), + false, + true + ); + this._managedContextsOptimization = new SnapshotOptimization( + s => s.hasManagedContexts(), + s => s.managedContexts, + (s, v) => s.setManagedContexts(v), + false, + true + ); + this._managedMissingOptimization = new SnapshotOptimization( + s => s.hasManagedMissing(), + s => s.managedMissing, + (s, v) => s.setManagedMissing(v), + false, + true + ); + /** @type {StackedCacheMap} */ + this._fileTimestamps = new StackedCacheMap(); + /** @type {Map} */ + this._fileHashes = new Map(); + /** @type {Map} */ + this._fileTshs = new Map(); + /** @type {StackedCacheMap} */ + this._contextTimestamps = new StackedCacheMap(); + /** @type {Map} */ + this._contextHashes = new Map(); + /** @type {Map} */ + this._contextTshs = new Map(); + /** @type {Map} */ + this._managedItems = new Map(); + /** @type {AsyncQueue} */ + this.fileTimestampQueue = new AsyncQueue({ + name: "file timestamp", + parallelism: 30, + processor: this._readFileTimestamp.bind(this) + }); + /** @type {AsyncQueue} */ + this.fileHashQueue = new AsyncQueue({ + name: "file hash", + parallelism: 10, + processor: this._readFileHash.bind(this) + }); + /** @type {AsyncQueue} */ + this.contextTimestampQueue = new AsyncQueue({ + name: "context timestamp", + parallelism: 2, + processor: this._readContextTimestamp.bind(this) + }); + /** @type {AsyncQueue} */ + this.contextHashQueue = new AsyncQueue({ + name: "context hash", + parallelism: 2, + processor: this._readContextHash.bind(this) + }); + /** @type {AsyncQueue} */ + this.contextTshQueue = new AsyncQueue({ + name: "context hash and timestamp", + parallelism: 2, + processor: this._readContextTimestampAndHash.bind(this) + }); + /** @type {AsyncQueue} */ + this.managedItemQueue = new AsyncQueue({ + name: "managed item info", + parallelism: 10, + processor: this._getManagedItemInfo.bind(this) + }); + /** @type {AsyncQueue>} */ + this.managedItemDirectoryQueue = new AsyncQueue({ + name: "managed item directory info", + parallelism: 10, + processor: this._getManagedItemDirectoryInfo.bind(this) + }); + this.managedPaths = Array.from(managedPaths); + this.managedPathsWithSlash = /** @type {string[]} */ ( + this.managedPaths.filter(p => typeof p === "string") + ).map(p => join(fs, p, "_").slice(0, -1)); - /** - * - * @param {string} exportName name of the export - * @param {string} expression expression to be used - */ - registerRawExport(exportName, expression) { - if (!this._currentModule.rawExportMap) { - this._currentModule.rawExportMap = new Map(); - } - if (!this._currentModule.rawExportMap.has(exportName)) { - this._currentModule.rawExportMap.set(exportName, expression); - } - } + this.managedPathsRegExps = /** @type {RegExp[]} */ ( + this.managedPaths.filter(p => typeof p !== "string") + ); + this.immutablePaths = Array.from(immutablePaths); + this.immutablePathsWithSlash = /** @type {string[]} */ ( + this.immutablePaths.filter(p => typeof p === "string") + ).map(p => join(fs, p, "_").slice(0, -1)); + this.immutablePathsRegExps = /** @type {RegExp[]} */ ( + this.immutablePaths.filter(p => typeof p !== "string") + ); - /** - * @param {string} symbol identifier of the export in source code - */ - registerNamespaceExport(symbol) { - this._currentModule.namespaceExportSymbol = symbol; - } + this._cachedDeprecatedFileTimestamps = undefined; + this._cachedDeprecatedContextTimestamps = undefined; - /** - * - * @param {Module} module the referenced module - * @param {Partial} options options - * @returns {string} the reference as identifier - */ - createModuleReference( - module, - { ids = undefined, call = false, directImport = false, asiSafe = false } - ) { - const info = this._modulesMap.get(module); - const callFlag = call ? "_call" : ""; - const directImportFlag = directImport ? "_directImport" : ""; - const asiSafeFlag = asiSafe - ? "_asiSafe1" - : asiSafe === false - ? "_asiSafe0" - : ""; - const exportData = ids - ? Buffer.from(JSON.stringify(ids), "utf-8").toString("hex") - : "ns"; - // a "._" is appended to allow "delete ...", which would cause a SyntaxError in strict mode - return `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportData}${callFlag}${directImportFlag}${asiSafeFlag}__._`; - } + this._warnAboutExperimentalEsmTracking = false; - /** - * @param {string} name the identifier - * @returns {boolean} true, when it's an module reference - */ - static isModuleReference(name) { - return MODULE_REFERENCE_REGEXP.test(name); + this._statCreatedSnapshots = 0; + this._statTestedSnapshotsCached = 0; + this._statTestedSnapshotsNotCached = 0; + this._statTestedChildrenCached = 0; + this._statTestedChildrenNotCached = 0; + this._statTestedEntries = 0; } - /** - * @param {string} name the identifier - * @returns {ModuleReferenceOptions & { index: number }} parsed options and index - */ - static matchModuleReference(name) { - const match = MODULE_REFERENCE_REGEXP.exec(name); - if (!match) return null; - const index = +match[1]; - const asiSafe = match[5]; - return { - index, - ids: - match[2] === "ns" - ? [] - : JSON.parse(Buffer.from(match[2], "hex").toString("utf-8")), - call: !!match[3], - directImport: !!match[4], - asiSafe: asiSafe ? asiSafe === "1" : undefined + logStatistics() { + const logWhenMessage = (header, message) => { + if (message) { + this.logger.log(`${header}: ${message}`); + } }; + this.logger.log(`${this._statCreatedSnapshots} new snapshots created`); + this.logger.log( + `${ + this._statTestedSnapshotsNotCached && + Math.round( + (this._statTestedSnapshotsNotCached * 100) / + (this._statTestedSnapshotsCached + + this._statTestedSnapshotsNotCached) + ) + }% root snapshot uncached (${this._statTestedSnapshotsNotCached} / ${ + this._statTestedSnapshotsCached + this._statTestedSnapshotsNotCached + })` + ); + this.logger.log( + `${ + this._statTestedChildrenNotCached && + Math.round( + (this._statTestedChildrenNotCached * 100) / + (this._statTestedChildrenCached + this._statTestedChildrenNotCached) + ) + }% children snapshot uncached (${this._statTestedChildrenNotCached} / ${ + this._statTestedChildrenCached + this._statTestedChildrenNotCached + })` + ); + this.logger.log(`${this._statTestedEntries} entries tested`); + this.logger.log( + `File info in cache: ${this._fileTimestamps.size} timestamps ${this._fileHashes.size} hashes ${this._fileTshs.size} timestamp hash combinations` + ); + logWhenMessage( + `File timestamp snapshot optimization`, + this._fileTimestampsOptimization.getStatisticMessage() + ); + logWhenMessage( + `File hash snapshot optimization`, + this._fileHashesOptimization.getStatisticMessage() + ); + logWhenMessage( + `File timestamp hash combination snapshot optimization`, + this._fileTshsOptimization.getStatisticMessage() + ); + this.logger.log( + `Directory info in cache: ${this._contextTimestamps.size} timestamps ${this._contextHashes.size} hashes ${this._contextTshs.size} timestamp hash combinations` + ); + logWhenMessage( + `Directory timestamp snapshot optimization`, + this._contextTimestampsOptimization.getStatisticMessage() + ); + logWhenMessage( + `Directory hash snapshot optimization`, + this._contextHashesOptimization.getStatisticMessage() + ); + logWhenMessage( + `Directory timestamp hash combination snapshot optimization`, + this._contextTshsOptimization.getStatisticMessage() + ); + logWhenMessage( + `Missing items snapshot optimization`, + this._missingExistenceOptimization.getStatisticMessage() + ); + this.logger.log( + `Managed items info in cache: ${this._managedItems.size} items` + ); + logWhenMessage( + `Managed items snapshot optimization`, + this._managedItemInfoOptimization.getStatisticMessage() + ); + logWhenMessage( + `Managed files snapshot optimization`, + this._managedFilesOptimization.getStatisticMessage() + ); + logWhenMessage( + `Managed contexts snapshot optimization`, + this._managedContextsOptimization.getStatisticMessage() + ); + logWhenMessage( + `Managed missing snapshot optimization`, + this._managedMissingOptimization.getStatisticMessage() + ); } -} - -ConcatenationScope.DEFAULT_EXPORT = DEFAULT_EXPORT; -ConcatenationScope.NAMESPACE_OBJECT_EXPORT = NAMESPACE_OBJECT_EXPORT; - -module.exports = ConcatenationScope; - - -/***/ }), - -/***/ 95735: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Maksim Nazarjev @acupofspirt -*/ - - - -const WebpackError = __webpack_require__(53799); - -module.exports = class ConcurrentCompilationError extends WebpackError { - constructor() { - super(); - this.name = "ConcurrentCompilationError"; - this.message = - "You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."; + _log(path, reason, ...args) { + const key = path + reason; + if (this._loggedPaths.has(key)) return; + this._loggedPaths.add(key); + this.logger.debug(`${path} invalidated because ${reason}`, ...args); + if (--this._remainingLogs === 0) { + this.logger.debug( + "Logging limit has been reached and no further logging will be emitted by FileSystemInfo" + ); + } } -}; - - -/***/ }), - -/***/ 61333: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + clear() { + this._remainingLogs = this.logger ? 40 : 0; + if (this._loggedPaths !== undefined) this._loggedPaths.clear(); + this._snapshotCache = new WeakMap(); + this._fileTimestampsOptimization.clear(); + this._fileHashesOptimization.clear(); + this._fileTshsOptimization.clear(); + this._contextTimestampsOptimization.clear(); + this._contextHashesOptimization.clear(); + this._contextTshsOptimization.clear(); + this._missingExistenceOptimization.clear(); + this._managedItemInfoOptimization.clear(); + this._managedFilesOptimization.clear(); + this._managedContextsOptimization.clear(); + this._managedMissingOptimization.clear(); + this._fileTimestamps.clear(); + this._fileHashes.clear(); + this._fileTshs.clear(); + this._contextTimestamps.clear(); + this._contextHashes.clear(); + this._contextTshs.clear(); + this._managedItems.clear(); + this._managedItems.clear(); + this._cachedDeprecatedFileTimestamps = undefined; + this._cachedDeprecatedContextTimestamps = undefined; -const { ConcatSource, PrefixSource } = __webpack_require__(51255); -const InitFragment = __webpack_require__(55870); -const Template = __webpack_require__(39722); -const { mergeRuntime } = __webpack_require__(17156); + this._statCreatedSnapshots = 0; + this._statTestedSnapshotsCached = 0; + this._statTestedSnapshotsNotCached = 0; + this._statTestedChildrenCached = 0; + this._statTestedChildrenNotCached = 0; + this._statTestedEntries = 0; + } -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("./Generator").GenerateContext} GenerateContext */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ + /** + * @param {ReadonlyMap} map timestamps + * @param {boolean=} immutable if 'map' is immutable and FileSystemInfo can keep referencing it + * @returns {void} + */ + addFileTimestamps(map, immutable) { + this._fileTimestamps.addAll(map, immutable); + this._cachedDeprecatedFileTimestamps = undefined; + } -const wrapInCondition = (condition, source) => { - if (typeof source === "string") { - return Template.asString([ - `if (${condition}) {`, - Template.indent(source), - "}", - "" - ]); - } else { - return new ConcatSource( - `if (${condition}) {\n`, - new PrefixSource("\t", source), - "}\n" - ); + /** + * @param {ReadonlyMap} map timestamps + * @param {boolean=} immutable if 'map' is immutable and FileSystemInfo can keep referencing it + * @returns {void} + */ + addContextTimestamps(map, immutable) { + this._contextTimestamps.addAll(map, immutable); + this._cachedDeprecatedContextTimestamps = undefined; } -}; -/** - * @typedef {GenerateContext} Context - */ -class ConditionalInitFragment extends InitFragment { /** - * @param {string|Source} content the source code that will be included as initialization code - * @param {number} stage category of initialization code (contribute to order) - * @param {number} position position in the category (contribute to order) - * @param {string} key unique key to avoid emitting the same initialization code twice - * @param {RuntimeSpec | boolean} runtimeCondition in which runtime this fragment should be executed - * @param {string|Source=} endContent the source code that will be included at the end of the module + * @param {string} path file path + * @param {function((WebpackError | null)=, (FileSystemInfoEntry | "ignore" | null)=): void} callback callback function + * @returns {void} */ - constructor( - content, - stage, - position, - key, - runtimeCondition = true, - endContent - ) { - super(content, stage, position, key, endContent); - this.runtimeCondition = runtimeCondition; + getFileTimestamp(path, callback) { + const cache = this._fileTimestamps.get(path); + if (cache !== undefined) return callback(null, cache); + this.fileTimestampQueue.add(path, callback); } /** - * @param {Context} context context - * @returns {string|Source} the source code that will be included as initialization code + * @param {string} path context path + * @param {function((WebpackError | null)=, (ResolvedContextFileSystemInfoEntry | "ignore" | null)=): void} callback callback function + * @returns {void} */ - getContent(context) { - if (this.runtimeCondition === false || !this.content) return ""; - if (this.runtimeCondition === true) return this.content; - const expr = context.runtimeTemplate.runtimeConditionExpression({ - chunkGraph: context.chunkGraph, - runtimeRequirements: context.runtimeRequirements, - runtime: context.runtime, - runtimeCondition: this.runtimeCondition + getContextTimestamp(path, callback) { + const cache = this._contextTimestamps.get(path); + if (cache !== undefined) { + if (cache === "ignore") return callback(null, "ignore"); + const resolved = getResolvedTimestamp(cache); + if (resolved !== undefined) return callback(null, resolved); + return this._resolveContextTimestamp(cache, callback); + } + this.contextTimestampQueue.add(path, (err, entry) => { + if (err) return callback(err); + const resolved = getResolvedTimestamp(entry); + if (resolved !== undefined) return callback(null, resolved); + this._resolveContextTimestamp(entry, callback); }); - if (expr === "true") return this.content; - return wrapInCondition(expr, this.content); } /** - * @param {Context} context context - * @returns {string|Source=} the source code that will be included at the end of the module + * @param {string} path context path + * @param {function((WebpackError | null)=, (ContextFileSystemInfoEntry | "ignore" | null)=): void} callback callback function + * @returns {void} */ - getEndContent(context) { - if (this.runtimeCondition === false || !this.endContent) return ""; - if (this.runtimeCondition === true) return this.endContent; - const expr = context.runtimeTemplate.runtimeConditionExpression({ - chunkGraph: context.chunkGraph, - runtimeRequirements: context.runtimeRequirements, - runtime: context.runtime, - runtimeCondition: this.runtimeCondition - }); - if (expr === "true") return this.endContent; - return wrapInCondition(expr, this.endContent); + _getUnresolvedContextTimestamp(path, callback) { + const cache = this._contextTimestamps.get(path); + if (cache !== undefined) return callback(null, cache); + this.contextTimestampQueue.add(path, callback); } - merge(other) { - if (this.runtimeCondition === true) return this; - if (other.runtimeCondition === true) return other; - if (this.runtimeCondition === false) return other; - if (other.runtimeCondition === false) return this; - const runtimeCondition = mergeRuntime( - this.runtimeCondition, - other.runtimeCondition - ); - return new ConditionalInitFragment( - this.content, - this.stage, - this.position, - this.key, - runtimeCondition, - this.endContent - ); + /** + * @param {string} path file path + * @param {function((WebpackError | null)=, string=): void} callback callback function + * @returns {void} + */ + getFileHash(path, callback) { + const cache = this._fileHashes.get(path); + if (cache !== undefined) return callback(null, cache); + this.fileHashQueue.add(path, callback); } -} - -module.exports = ConditionalInitFragment; - - -/***/ }), - -/***/ 11146: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const CachedConstDependency = __webpack_require__(57403); -const ConstDependency = __webpack_require__(76911); -const { evaluateToString } = __webpack_require__(93998); -const { parseResource } = __webpack_require__(82186); - -/** @typedef {import("estree").Expression} ExpressionNode */ -/** @typedef {import("estree").Super} SuperNode */ -/** @typedef {import("./Compiler")} Compiler */ -const collectDeclaration = (declarations, pattern) => { - const stack = [pattern]; - while (stack.length > 0) { - const node = stack.pop(); - switch (node.type) { - case "Identifier": - declarations.add(node.name); - break; - case "ArrayPattern": - for (const element of node.elements) { - if (element) { - stack.push(element); - } - } - break; - case "AssignmentPattern": - stack.push(node.left); - break; - case "ObjectPattern": - for (const property of node.properties) { - stack.push(property.value); - } - break; - case "RestElement": - stack.push(node.argument); - break; + /** + * @param {string} path context path + * @param {function((WebpackError | null)=, string=): void} callback callback function + * @returns {void} + */ + getContextHash(path, callback) { + const cache = this._contextHashes.get(path); + if (cache !== undefined) { + const resolved = getResolvedHash(cache); + if (resolved !== undefined) return callback(null, resolved); + return this._resolveContextHash(cache, callback); } + this.contextHashQueue.add(path, (err, entry) => { + if (err) return callback(err); + const resolved = getResolvedHash(entry); + if (resolved !== undefined) return callback(null, resolved); + this._resolveContextHash(entry, callback); + }); } -}; -const getHoistedDeclarations = (branch, includeFunctionDeclarations) => { - const declarations = new Set(); - const stack = [branch]; - while (stack.length > 0) { - const node = stack.pop(); - // Some node could be `null` or `undefined`. - if (!node) continue; - switch (node.type) { - // Walk through control statements to look for hoisted declarations. - // Some branches are skipped since they do not allow declarations. - case "BlockStatement": - for (const stmt of node.body) { - stack.push(stmt); - } - break; - case "IfStatement": - stack.push(node.consequent); - stack.push(node.alternate); - break; - case "ForStatement": - stack.push(node.init); - stack.push(node.body); - break; - case "ForInStatement": - case "ForOfStatement": - stack.push(node.left); - stack.push(node.body); - break; - case "DoWhileStatement": - case "WhileStatement": - case "LabeledStatement": - stack.push(node.body); - break; - case "SwitchStatement": - for (const cs of node.cases) { - for (const consequent of cs.consequent) { - stack.push(consequent); - } - } - break; - case "TryStatement": - stack.push(node.block); - if (node.handler) { - stack.push(node.handler.body); - } - stack.push(node.finalizer); - break; - case "FunctionDeclaration": - if (includeFunctionDeclarations) { - collectDeclaration(declarations, node.id); - } - break; - case "VariableDeclaration": - if (node.kind === "var") { - for (const decl of node.declarations) { - collectDeclaration(declarations, decl.id); - } - } - break; + /** + * @param {string} path context path + * @param {function((WebpackError | null)=, ContextHash=): void} callback callback function + * @returns {void} + */ + _getUnresolvedContextHash(path, callback) { + const cache = this._contextHashes.get(path); + if (cache !== undefined) return callback(null, cache); + this.contextHashQueue.add(path, callback); + } + + /** + * @param {string} path context path + * @param {function((WebpackError | null)=, ResolvedContextTimestampAndHash=): void} callback callback function + * @returns {void} + */ + getContextTsh(path, callback) { + const cache = this._contextTshs.get(path); + if (cache !== undefined) { + const resolved = getResolvedTimestamp(cache); + if (resolved !== undefined) return callback(null, resolved); + return this._resolveContextTsh(cache, callback); } + this.contextTshQueue.add(path, (err, entry) => { + if (err) return callback(err); + const resolved = getResolvedTimestamp(entry); + if (resolved !== undefined) return callback(null, resolved); + this._resolveContextTsh(entry, callback); + }); } - return Array.from(declarations); -}; -class ConstPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {string} path context path + * @param {function((WebpackError | null)=, ContextTimestampAndHash=): void} callback callback function * @returns {void} */ - apply(compiler) { - const cachedParseResource = parseResource.bindCache(compiler.root); - compiler.hooks.compilation.tap( - "ConstPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyTemplates.set( - ConstDependency, - new ConstDependency.Template() - ); + _getUnresolvedContextTsh(path, callback) { + const cache = this._contextTshs.get(path); + if (cache !== undefined) return callback(null, cache); + this.contextTshQueue.add(path, callback); + } - compilation.dependencyTemplates.set( - CachedConstDependency, - new CachedConstDependency.Template() - ); + _createBuildDependenciesResolvers() { + const resolveContext = createResolver({ + resolveToContext: true, + exportsFields: [], + fileSystem: this.fs + }); + const resolveCjs = createResolver({ + extensions: [".js", ".json", ".node"], + conditionNames: ["require", "node"], + exportsFields: ["exports"], + fileSystem: this.fs + }); + const resolveCjsAsChild = createResolver({ + extensions: [".js", ".json", ".node"], + conditionNames: ["require", "node"], + exportsFields: [], + fileSystem: this.fs + }); + const resolveEsm = createResolver({ + extensions: [".js", ".json", ".node"], + fullySpecified: true, + conditionNames: ["import", "node"], + exportsFields: ["exports"], + fileSystem: this.fs + }); + return { resolveContext, resolveEsm, resolveCjs, resolveCjsAsChild }; + } - const handler = parser => { - parser.hooks.statementIf.tap("ConstPlugin", statement => { - if (parser.scope.isAsmJs) return; - const param = parser.evaluateExpression(statement.test); - const bool = param.asBool(); - if (typeof bool === "boolean") { - if (!param.couldHaveSideEffects()) { - const dep = new ConstDependency(`${bool}`, param.range); - dep.loc = statement.loc; - parser.state.module.addPresentationalDependency(dep); + /** + * @param {string} context context directory + * @param {Iterable} deps dependencies + * @param {function((Error | null)=, ResolveBuildDependenciesResult=): void} callback callback function + * @returns {void} + */ + resolveBuildDependencies(context, deps, callback) { + const { resolveContext, resolveEsm, resolveCjs, resolveCjsAsChild } = + this._createBuildDependenciesResolvers(); + + /** @type {Set} */ + const files = new Set(); + /** @type {Set} */ + const fileSymlinks = new Set(); + /** @type {Set} */ + const directories = new Set(); + /** @type {Set} */ + const directorySymlinks = new Set(); + /** @type {Set} */ + const missing = new Set(); + /** @type {Set} */ + const resolveFiles = new Set(); + /** @type {Set} */ + const resolveDirectories = new Set(); + /** @type {Set} */ + const resolveMissing = new Set(); + /** @type {Map} */ + const resolveResults = new Map(); + const invalidResolveResults = new Set(); + const resolverContext = { + fileDependencies: resolveFiles, + contextDependencies: resolveDirectories, + missingDependencies: resolveMissing + }; + const expectedToString = expected => { + return expected ? ` (expected ${expected})` : ""; + }; + const jobToString = job => { + switch (job.type) { + case RBDT_RESOLVE_CJS: + return `resolve commonjs ${job.path}${expectedToString( + job.expected + )}`; + case RBDT_RESOLVE_ESM: + return `resolve esm ${job.path}${expectedToString(job.expected)}`; + case RBDT_RESOLVE_DIRECTORY: + return `resolve directory ${job.path}`; + case RBDT_RESOLVE_CJS_FILE: + return `resolve commonjs file ${job.path}${expectedToString( + job.expected + )}`; + case RBDT_RESOLVE_ESM_FILE: + return `resolve esm file ${job.path}${expectedToString( + job.expected + )}`; + case RBDT_DIRECTORY: + return `directory ${job.path}`; + case RBDT_FILE: + return `file ${job.path}`; + case RBDT_DIRECTORY_DEPENDENCIES: + return `directory dependencies ${job.path}`; + case RBDT_FILE_DEPENDENCIES: + return `file dependencies ${job.path}`; + } + return `unknown ${job.type} ${job.path}`; + }; + const pathToString = job => { + let result = ` at ${jobToString(job)}`; + job = job.issuer; + while (job !== undefined) { + result += `\n at ${jobToString(job)}`; + job = job.issuer; + } + return result; + }; + processAsyncTree( + Array.from(deps, dep => ({ + type: RBDT_RESOLVE_CJS, + context, + path: dep, + expected: undefined, + issuer: undefined + })), + 20, + (job, push, callback) => { + const { type, context, path, expected } = job; + const resolveDirectory = path => { + const key = `d\n${context}\n${path}`; + if (resolveResults.has(key)) { + return callback(); + } + resolveResults.set(key, undefined); + resolveContext(context, path, resolverContext, (err, _, result) => { + if (err) { + if (expected === false) { + resolveResults.set(key, false); + return callback(); + } + invalidResolveResults.add(key); + err.message += `\nwhile resolving '${path}' in ${context} to a directory`; + return callback(err); + } + const resultPath = result.path; + resolveResults.set(key, resultPath); + push({ + type: RBDT_DIRECTORY, + context: undefined, + path: resultPath, + expected: undefined, + issuer: job + }); + callback(); + }); + }; + const resolveFile = (path, symbol, resolve) => { + const key = `${symbol}\n${context}\n${path}`; + if (resolveResults.has(key)) { + return callback(); + } + resolveResults.set(key, undefined); + resolve(context, path, resolverContext, (err, _, result) => { + if (typeof expected === "string") { + if (!err && result && result.path === expected) { + resolveResults.set(key, result.path); } else { - parser.walkExpression(statement.test); + invalidResolveResults.add(key); + this.logger.warn( + `Resolving '${path}' in ${context} for build dependencies doesn't lead to expected result '${expected}', but to '${ + err || (result && result.path) + }' instead. Resolving dependencies are ignored for this path.\n${pathToString( + job + )}` + ); } - const branchToRemove = bool - ? statement.alternate - : statement.consequent; - if (branchToRemove) { - // Before removing the dead branch, the hoisted declarations - // must be collected. - // - // Given the following code: - // - // if (true) f() else g() - // if (false) { - // function f() {} - // const g = function g() {} - // if (someTest) { - // let a = 1 - // var x, {y, z} = obj - // } - // } else { - // … - // } - // - // the generated code is: - // - // if (true) f() else {} - // if (false) { - // var f, x, y, z; (in loose mode) - // var x, y, z; (in strict mode) - // } else { - // … - // } - // - // NOTE: When code runs in strict mode, `var` declarations - // are hoisted but `function` declarations don't. - // - let declarations; - if (parser.scope.isStrict) { - // If the code runs in strict mode, variable declarations - // using `var` must be hoisted. - declarations = getHoistedDeclarations(branchToRemove, false); - } else { - // Otherwise, collect all hoisted declaration. - declarations = getHoistedDeclarations(branchToRemove, true); - } - let replacement; - if (declarations.length > 0) { - replacement = `{ var ${declarations.join(", ")}; }`; - } else { - replacement = "{}"; + } else { + if (err) { + if (expected === false) { + resolveResults.set(key, false); + return callback(); } - const dep = new ConstDependency( - replacement, - branchToRemove.range - ); - dep.loc = branchToRemove.loc; - parser.state.module.addPresentationalDependency(dep); + invalidResolveResults.add(key); + err.message += `\nwhile resolving '${path}' in ${context} as file\n${pathToString( + job + )}`; + return callback(err); } - return bool; + const resultPath = result.path; + resolveResults.set(key, resultPath); + push({ + type: RBDT_FILE, + context: undefined, + path: resultPath, + expected: undefined, + issuer: job + }); } + callback(); }); - parser.hooks.expressionConditionalOperator.tap( - "ConstPlugin", - expression => { - if (parser.scope.isAsmJs) return; - const param = parser.evaluateExpression(expression.test); - const bool = param.asBool(); - if (typeof bool === "boolean") { - if (!param.couldHaveSideEffects()) { - const dep = new ConstDependency(` ${bool}`, param.range); - dep.loc = expression.loc; - parser.state.module.addPresentationalDependency(dep); - } else { - parser.walkExpression(expression.test); - } - // Expressions do not hoist. - // It is safe to remove the dead branch. - // - // Given the following code: - // - // false ? someExpression() : otherExpression(); - // - // the generated code is: - // - // false ? 0 : otherExpression(); - // - const branchToRemove = bool - ? expression.alternate - : expression.consequent; - const dep = new ConstDependency("0", branchToRemove.range); - dep.loc = branchToRemove.loc; - parser.state.module.addPresentationalDependency(dep); - return bool; - } + }; + switch (type) { + case RBDT_RESOLVE_CJS: { + const isDirectory = /[\\/]$/.test(path); + if (isDirectory) { + resolveDirectory(path.slice(0, path.length - 1)); + } else { + resolveFile(path, "f", resolveCjs); } - ); - parser.hooks.expressionLogicalOperator.tap( - "ConstPlugin", - expression => { - if (parser.scope.isAsmJs) return; - if ( - expression.operator === "&&" || - expression.operator === "||" - ) { - const param = parser.evaluateExpression(expression.left); - const bool = param.asBool(); - if (typeof bool === "boolean") { - // Expressions do not hoist. - // It is safe to remove the dead branch. - // - // ------------------------------------------ - // - // Given the following code: - // - // falsyExpression() && someExpression(); - // - // the generated code is: - // - // falsyExpression() && false; - // - // ------------------------------------------ - // - // Given the following code: - // - // truthyExpression() && someExpression(); - // - // the generated code is: - // - // true && someExpression(); - // - // ------------------------------------------ - // - // Given the following code: - // - // truthyExpression() || someExpression(); - // - // the generated code is: - // - // truthyExpression() || false; - // - // ------------------------------------------ - // - // Given the following code: - // - // falsyExpression() || someExpression(); - // - // the generated code is: - // - // false && someExpression(); - // - const keepRight = - (expression.operator === "&&" && bool) || - (expression.operator === "||" && !bool); - - if ( - !param.couldHaveSideEffects() && - (param.isBoolean() || keepRight) - ) { - // for case like - // - // return'development'===process.env.NODE_ENV&&'foo' - // - // we need a space before the bool to prevent result like - // - // returnfalse&&'foo' - // - const dep = new ConstDependency(` ${bool}`, param.range); - dep.loc = expression.loc; - parser.state.module.addPresentationalDependency(dep); - } else { - parser.walkExpression(expression.left); - } - if (!keepRight) { - const dep = new ConstDependency( - "0", - expression.right.range - ); - dep.loc = expression.loc; - parser.state.module.addPresentationalDependency(dep); + break; + } + case RBDT_RESOLVE_ESM: { + const isDirectory = /[\\/]$/.test(path); + if (isDirectory) { + resolveDirectory(path.slice(0, path.length - 1)); + } else { + resolveFile(path); + } + break; + } + case RBDT_RESOLVE_DIRECTORY: { + resolveDirectory(path); + break; + } + case RBDT_RESOLVE_CJS_FILE: { + resolveFile(path, "f", resolveCjs); + break; + } + case RBDT_RESOLVE_CJS_FILE_AS_CHILD: { + resolveFile(path, "c", resolveCjsAsChild); + break; + } + case RBDT_RESOLVE_ESM_FILE: { + resolveFile(path, "e", resolveEsm); + break; + } + case RBDT_FILE: { + if (files.has(path)) { + callback(); + break; + } + files.add(path); + this.fs.realpath(path, (err, _realPath) => { + if (err) return callback(err); + const realPath = /** @type {string} */ (_realPath); + if (realPath !== path) { + fileSymlinks.add(path); + resolveFiles.add(path); + if (files.has(realPath)) return callback(); + files.add(realPath); + } + push({ + type: RBDT_FILE_DEPENDENCIES, + context: undefined, + path: realPath, + expected: undefined, + issuer: job + }); + callback(); + }); + break; + } + case RBDT_DIRECTORY: { + if (directories.has(path)) { + callback(); + break; + } + directories.add(path); + this.fs.realpath(path, (err, _realPath) => { + if (err) return callback(err); + const realPath = /** @type {string} */ (_realPath); + if (realPath !== path) { + directorySymlinks.add(path); + resolveFiles.add(path); + if (directories.has(realPath)) return callback(); + directories.add(realPath); + } + push({ + type: RBDT_DIRECTORY_DEPENDENCIES, + context: undefined, + path: realPath, + expected: undefined, + issuer: job + }); + callback(); + }); + break; + } + case RBDT_FILE_DEPENDENCIES: { + // Check for known files without dependencies + if (/\.json5?$|\.yarn-integrity$|yarn\.lock$|\.ya?ml/.test(path)) { + process.nextTick(callback); + break; + } + // Check commonjs cache for the module + /** @type {NodeModule} */ + const module = require.cache[path]; + if (module && Array.isArray(module.children)) { + children: for (const child of module.children) { + let childPath = child.filename; + if (childPath) { + push({ + type: RBDT_FILE, + context: undefined, + path: childPath, + expected: undefined, + issuer: job + }); + const context = dirname(this.fs, path); + for (const modulePath of module.paths) { + if (childPath.startsWith(modulePath)) { + let subPath = childPath.slice(modulePath.length + 1); + const packageMatch = /^(@[^\\/]+[\\/])[^\\/]+/.exec( + subPath + ); + if (packageMatch) { + push({ + type: RBDT_FILE, + context: undefined, + path: + modulePath + + childPath[modulePath.length] + + packageMatch[0] + + childPath[modulePath.length] + + "package.json", + expected: false, + issuer: job + }); + } + let request = subPath.replace(/\\/g, "/"); + if (request.endsWith(".js")) + request = request.slice(0, -3); + push({ + type: RBDT_RESOLVE_CJS_FILE_AS_CHILD, + context, + path: request, + expected: child.filename, + issuer: job + }); + continue children; + } } - return keepRight; + let request = relative(this.fs, context, childPath); + if (request.endsWith(".js")) request = request.slice(0, -3); + request = request.replace(/\\/g, "/"); + if (!request.startsWith("../")) request = `./${request}`; + push({ + type: RBDT_RESOLVE_CJS_FILE, + context, + path: request, + expected: child.filename, + issuer: job + }); } - } else if (expression.operator === "??") { - const param = parser.evaluateExpression(expression.left); - const keepRight = param && param.asNullish(); - if (typeof keepRight === "boolean") { - // ------------------------------------------ - // - // Given the following code: - // - // nonNullish ?? someExpression(); - // - // the generated code is: - // - // nonNullish ?? 0; - // - // ------------------------------------------ - // - // Given the following code: - // - // nullish ?? someExpression(); - // - // the generated code is: - // - // null ?? someExpression(); - // - if (!param.couldHaveSideEffects() && keepRight) { - // cspell:word returnnull - // for case like - // - // return('development'===process.env.NODE_ENV&&null)??'foo' - // - // we need a space before the bool to prevent result like - // - // returnnull??'foo' - // - const dep = new ConstDependency(" null", param.range); - dep.loc = expression.loc; - parser.state.module.addPresentationalDependency(dep); - } else { - const dep = new ConstDependency( - "0", - expression.right.range + } + } else if (supportsEsm && /\.m?js$/.test(path)) { + if (!this._warnAboutExperimentalEsmTracking) { + this.logger.log( + "Node.js doesn't offer a (nice) way to introspect the ESM dependency graph yet.\n" + + "Until a full solution is available webpack uses an experimental ESM tracking based on parsing.\n" + + "As best effort webpack parses the ESM files to guess dependencies. But this can lead to expensive and incorrect tracking." + ); + this._warnAboutExperimentalEsmTracking = true; + } + const lexer = __webpack_require__(54392); + lexer.init.then(() => { + this.fs.readFile(path, (err, content) => { + if (err) return callback(err); + try { + const context = dirname(this.fs, path); + const source = content.toString(); + const [imports] = lexer.parse(source); + for (const imp of imports) { + try { + let dependency; + if (imp.d === -1) { + // import ... from "..." + dependency = parseString( + source.substring(imp.s - 1, imp.e + 1) + ); + } else if (imp.d > -1) { + // import() + let expr = source.substring(imp.s, imp.e).trim(); + dependency = parseString(expr); + } else { + // e.g. import.meta + continue; + } + push({ + type: RBDT_RESOLVE_ESM_FILE, + context, + path: dependency, + expected: undefined, + issuer: job + }); + } catch (e) { + this.logger.warn( + `Parsing of ${path} for build dependencies failed at 'import(${source.substring( + imp.s, + imp.e + )})'.\n` + + "Build dependencies behind this expression are ignored and might cause incorrect cache invalidation." + ); + this.logger.debug(pathToString(job)); + this.logger.debug(e.stack); + } + } + } catch (e) { + this.logger.warn( + `Parsing of ${path} for build dependencies failed and all dependencies of this file are ignored, which might cause incorrect cache invalidation..` ); - dep.loc = expression.loc; - parser.state.module.addPresentationalDependency(dep); - parser.walkExpression(expression.left); + this.logger.debug(pathToString(job)); + this.logger.debug(e.stack); } - - return keepRight; + process.nextTick(callback); + }); + }, callback); + break; + } else { + this.logger.log( + `Assuming ${path} has no dependencies as we were unable to assign it to any module system.` + ); + this.logger.debug(pathToString(job)); + } + process.nextTick(callback); + break; + } + case RBDT_DIRECTORY_DEPENDENCIES: { + const match = + /(^.+[\\/]node_modules[\\/](?:@[^\\/]+[\\/])?[^\\/]+)/.exec(path); + const packagePath = match ? match[1] : path; + const packageJson = join(this.fs, packagePath, "package.json"); + this.fs.readFile(packageJson, (err, content) => { + if (err) { + if (err.code === "ENOENT") { + resolveMissing.add(packageJson); + const parent = dirname(this.fs, packagePath); + if (parent !== packagePath) { + push({ + type: RBDT_DIRECTORY_DEPENDENCIES, + context: undefined, + path: parent, + expected: undefined, + issuer: job + }); + } + callback(); + return; } + return callback(err); } - } - ); - parser.hooks.optionalChaining.tap("ConstPlugin", expr => { - /** @type {ExpressionNode[]} */ - const optionalExpressionsStack = []; - /** @type {ExpressionNode|SuperNode} */ - let next = expr.expression; - - while ( - next.type === "MemberExpression" || - next.type === "CallExpression" - ) { - if (next.type === "MemberExpression") { - if (next.optional) { - // SuperNode can not be optional - optionalExpressionsStack.push( - /** @type {ExpressionNode} */ (next.object) - ); + resolveFiles.add(packageJson); + let packageData; + try { + packageData = JSON.parse(content.toString("utf-8")); + } catch (e) { + return callback(e); + } + const depsObject = packageData.dependencies; + const optionalDepsObject = packageData.optionalDependencies; + const allDeps = new Set(); + const optionalDeps = new Set(); + if (typeof depsObject === "object" && depsObject) { + for (const dep of Object.keys(depsObject)) { + allDeps.add(dep); } - next = next.object; - } else { - if (next.optional) { - // SuperNode can not be optional - optionalExpressionsStack.push( - /** @type {ExpressionNode} */ (next.callee) - ); + } + if ( + typeof optionalDepsObject === "object" && + optionalDepsObject + ) { + for (const dep of Object.keys(optionalDepsObject)) { + allDeps.add(dep); + optionalDeps.add(dep); } - next = next.callee; } - } - - while (optionalExpressionsStack.length) { - const expression = optionalExpressionsStack.pop(); - const evaluated = parser.evaluateExpression(expression); - - if (evaluated && evaluated.asNullish()) { - // ------------------------------------------ - // - // Given the following code: - // - // nullishMemberChain?.a.b(); - // - // the generated code is: - // - // undefined; - // - // ------------------------------------------ - // - const dep = new ConstDependency(" undefined", expr.range); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; + for (const dep of allDeps) { + push({ + type: RBDT_RESOLVE_DIRECTORY, + context: packagePath, + path: dep, + expected: !optionalDeps.has(dep), + issuer: job + }); } - } - }); - parser.hooks.evaluateIdentifier - .for("__resourceQuery") - .tap("ConstPlugin", expr => { - if (parser.scope.isAsmJs) return; - if (!parser.state.module) return; - return evaluateToString( - cachedParseResource(parser.state.module.resource).query - )(expr); - }); - parser.hooks.expression - .for("__resourceQuery") - .tap("ConstPlugin", expr => { - if (parser.scope.isAsmJs) return; - if (!parser.state.module) return; - const dep = new CachedConstDependency( - JSON.stringify( - cachedParseResource(parser.state.module.resource).query - ), - expr.range, - "__resourceQuery" - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - - parser.hooks.evaluateIdentifier - .for("__resourceFragment") - .tap("ConstPlugin", expr => { - if (parser.scope.isAsmJs) return; - if (!parser.state.module) return; - return evaluateToString( - cachedParseResource(parser.state.module.resource).fragment - )(expr); - }); - parser.hooks.expression - .for("__resourceFragment") - .tap("ConstPlugin", expr => { - if (parser.scope.isAsmJs) return; - if (!parser.state.module) return; - const dep = new CachedConstDependency( - JSON.stringify( - cachedParseResource(parser.state.module.resource).fragment - ), - expr.range, - "__resourceFragment" - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; + callback(); }); - }; - - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("ConstPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("ConstPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("ConstPlugin", handler); + break; + } + } + }, + err => { + if (err) return callback(err); + for (const l of fileSymlinks) files.delete(l); + for (const l of directorySymlinks) directories.delete(l); + for (const k of invalidResolveResults) resolveResults.delete(k); + callback(null, { + files, + directories, + missing, + resolveResults, + resolveDependencies: { + files: resolveFiles, + directories: resolveDirectories, + missing: resolveMissing + } + }); } ); } -} - -module.exports = ConstPlugin; - - -/***/ }), - -/***/ 21411: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - - -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./ContextModuleFactory")} ContextModuleFactory */ - -class ContextExclusionPlugin { - /** - * @param {RegExp} negativeMatcher Matcher regular expression - */ - constructor(negativeMatcher) { - this.negativeMatcher = negativeMatcher; - } - - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.contextModuleFactory.tap("ContextExclusionPlugin", cmf => { - cmf.hooks.contextModuleFiles.tap("ContextExclusionPlugin", files => { - return files.filter(filePath => !this.negativeMatcher.test(filePath)); - }); - }); - } -} - -module.exports = ContextExclusionPlugin; - - -/***/ }), - -/***/ 76729: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { OriginalSource, RawSource } = __webpack_require__(51255); -const AsyncDependenciesBlock = __webpack_require__(47736); -const { makeWebpackError } = __webpack_require__(11351); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const WebpackError = __webpack_require__(53799); -const { - compareLocations, - concatComparators, - compareSelect, - keepOriginalOrder, - compareModulesById -} = __webpack_require__(29579); -const { contextify, parseResource } = __webpack_require__(82186); -const makeSerializable = __webpack_require__(33032); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./ChunkGroup").RawChunkGroupOptions} RawChunkGroupOptions */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./Module").BuildMeta} BuildMeta */ -/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./dependencies/ContextElementDependency")} ContextElementDependency */ -/** @template T @typedef {import("./util/LazySet")} LazySet */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ - -/** @typedef {"sync" | "eager" | "weak" | "async-weak" | "lazy" | "lazy-once"} ContextMode Context mode */ - -/** - * @typedef {Object} ContextOptions - * @property {ContextMode} mode - * @property {boolean} recursive - * @property {RegExp} regExp - * @property {"strict"|boolean=} namespaceObject - * @property {string=} addon - * @property {string=} chunkName - * @property {RegExp=} include - * @property {RegExp=} exclude - * @property {RawChunkGroupOptions=} groupOptions - * @property {string=} typePrefix - * @property {string=} category - * @property {string[][]=} referencedExports exports referenced from modules (won't be mangled) - */ - -/** - * @typedef {Object} ContextModuleOptionsExtras - * @property {string} resource - * @property {string=} resourceQuery - * @property {string=} resourceFragment - * @property {TODO} resolveOptions - */ - -/** @typedef {ContextOptions & ContextModuleOptionsExtras} ContextModuleOptions */ - -/** - * @callback ResolveDependenciesCallback - * @param {(Error | null)=} err - * @param {ContextElementDependency[]=} dependencies - */ - -/** - * @callback ResolveDependencies - * @param {InputFileSystem} fs - * @param {ContextModuleOptions} options - * @param {ResolveDependenciesCallback} callback - */ - -const SNAPSHOT_OPTIONS = { timestamp: true }; - -const TYPES = new Set(["javascript"]); - -class ContextModule extends Module { - /** - * @param {ResolveDependencies} resolveDependencies function to get dependencies in this context - * @param {ContextModuleOptions} options options object - */ - constructor(resolveDependencies, options) { - const parsed = parseResource(options ? options.resource : ""); - const resource = parsed.path; - const resourceQuery = (options && options.resourceQuery) || parsed.query; - const resourceFragment = - (options && options.resourceFragment) || parsed.fragment; - - super("javascript/dynamic", resource); - - // Info from Factory - this.resolveDependencies = resolveDependencies; - /** @type {ContextModuleOptions} */ - this.options = { - ...options, - resource, - resourceQuery, - resourceFragment - }; - if (options && options.resolveOptions !== undefined) { - this.resolveOptions = options.resolveOptions; - } - - if (options && typeof options.mode !== "string") { - throw new Error("options.mode is a required option"); - } - - this._identifier = this._createIdentifier(); - this._forceBuild = true; - } - - /** - * @returns {Set} types available (do not mutate) - */ - getSourceTypes() { - return TYPES; - } /** - * Assuming this module is in the cache. Update the (cached) module with - * the fresh module from the factory. Usually updates internal references - * and properties. - * @param {Module} module fresh module + * @param {Map} resolveResults results from resolving + * @param {function((Error | null)=, boolean=): void} callback callback with true when resolveResults resolve the same way * @returns {void} */ - updateCacheModule(module) { - const m = /** @type {ContextModule} */ (module); - this.resolveDependencies = m.resolveDependencies; - this.options = m.options; - } - - /** - * Assuming this module is in the cache. Remove internal references to allow freeing some memory. - */ - cleanupForCache() { - super.cleanupForCache(); - this.resolveDependencies = undefined; - } - - _prettyRegExp(regexString, stripSlash = true) { - const str = (regexString + "").replace(/!/g, "%21").replace(/\|/g, "%7C"); - return stripSlash ? str.substring(1, str.length - 1) : str; - } - - _createIdentifier() { - let identifier = this.context; - if (this.options.resourceQuery) { - identifier += `|${this.options.resourceQuery}`; - } - if (this.options.resourceFragment) { - identifier += `|${this.options.resourceFragment}`; - } - if (this.options.mode) { - identifier += `|${this.options.mode}`; - } - if (!this.options.recursive) { - identifier += "|nonrecursive"; - } - if (this.options.addon) { - identifier += `|${this.options.addon}`; - } - if (this.options.regExp) { - identifier += `|${this._prettyRegExp(this.options.regExp, false)}`; - } - if (this.options.include) { - identifier += `|include: ${this._prettyRegExp( - this.options.include, - false - )}`; - } - if (this.options.exclude) { - identifier += `|exclude: ${this._prettyRegExp( - this.options.exclude, - false - )}`; - } - if (this.options.referencedExports) { - identifier += `|referencedExports: ${JSON.stringify( - this.options.referencedExports - )}`; - } - if (this.options.chunkName) { - identifier += `|chunkName: ${this.options.chunkName}`; - } - if (this.options.groupOptions) { - identifier += `|groupOptions: ${JSON.stringify( - this.options.groupOptions - )}`; - } - if (this.options.namespaceObject === "strict") { - identifier += "|strict namespace object"; - } else if (this.options.namespaceObject) { - identifier += "|namespace object"; - } - - return identifier; - } - - /** - * @returns {string} a unique identifier of the module - */ - identifier() { - return this._identifier; - } - - /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module - */ - readableIdentifier(requestShortener) { - let identifier = requestShortener.shorten(this.context) + "/"; - if (this.options.resourceQuery) { - identifier += ` ${this.options.resourceQuery}`; - } - if (this.options.mode) { - identifier += ` ${this.options.mode}`; - } - if (!this.options.recursive) { - identifier += " nonrecursive"; - } - if (this.options.addon) { - identifier += ` ${requestShortener.shorten(this.options.addon)}`; - } - if (this.options.regExp) { - identifier += ` ${this._prettyRegExp(this.options.regExp)}`; - } - if (this.options.include) { - identifier += ` include: ${this._prettyRegExp(this.options.include)}`; - } - if (this.options.exclude) { - identifier += ` exclude: ${this._prettyRegExp(this.options.exclude)}`; - } - if (this.options.referencedExports) { - identifier += ` referencedExports: ${this.options.referencedExports - .map(e => e.join(".")) - .join(", ")}`; - } - if (this.options.chunkName) { - identifier += ` chunkName: ${this.options.chunkName}`; - } - if (this.options.groupOptions) { - const groupOptions = this.options.groupOptions; - for (const key of Object.keys(groupOptions)) { - identifier += ` ${key}: ${groupOptions[key]}`; + checkResolveResultsValid(resolveResults, callback) { + const { resolveCjs, resolveCjsAsChild, resolveEsm, resolveContext } = + this._createBuildDependenciesResolvers(); + asyncLib.eachLimit( + resolveResults, + 20, + ([key, expectedResult], callback) => { + const [type, context, path] = key.split("\n"); + switch (type) { + case "d": + resolveContext(context, path, {}, (err, _, result) => { + if (expectedResult === false) + return callback(err ? undefined : INVALID); + if (err) return callback(err); + const resultPath = result.path; + if (resultPath !== expectedResult) return callback(INVALID); + callback(); + }); + break; + case "f": + resolveCjs(context, path, {}, (err, _, result) => { + if (expectedResult === false) + return callback(err ? undefined : INVALID); + if (err) return callback(err); + const resultPath = result.path; + if (resultPath !== expectedResult) return callback(INVALID); + callback(); + }); + break; + case "c": + resolveCjsAsChild(context, path, {}, (err, _, result) => { + if (expectedResult === false) + return callback(err ? undefined : INVALID); + if (err) return callback(err); + const resultPath = result.path; + if (resultPath !== expectedResult) return callback(INVALID); + callback(); + }); + break; + case "e": + resolveEsm(context, path, {}, (err, _, result) => { + if (expectedResult === false) + return callback(err ? undefined : INVALID); + if (err) return callback(err); + const resultPath = result.path; + if (resultPath !== expectedResult) return callback(INVALID); + callback(); + }); + break; + default: + callback(new Error("Unexpected type in resolve result key")); + break; + } + }, + /** + * @param {Error | typeof INVALID=} err error or invalid flag + * @returns {void} + */ + err => { + if (err === INVALID) { + return callback(null, false); + } + if (err) { + return callback(err); + } + return callback(null, true); } - } - if (this.options.namespaceObject === "strict") { - identifier += " strict namespace object"; - } else if (this.options.namespaceObject) { - identifier += " namespace object"; - } - - return identifier; - } - - /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion - */ - libIdent(options) { - let identifier = contextify( - options.context, - this.context, - options.associatedObjectForCache ); - if (this.layer) identifier = `(${this.layer})/${identifier}`; - if (this.options.mode) { - identifier += ` ${this.options.mode}`; - } - if (this.options.recursive) { - identifier += " recursive"; - } - if (this.options.addon) { - identifier += ` ${contextify( - options.context, - this.options.addon, - options.associatedObjectForCache - )}`; - } - if (this.options.regExp) { - identifier += ` ${this._prettyRegExp(this.options.regExp)}`; - } - if (this.options.include) { - identifier += ` include: ${this._prettyRegExp(this.options.include)}`; - } - if (this.options.exclude) { - identifier += ` exclude: ${this._prettyRegExp(this.options.exclude)}`; - } - if (this.options.referencedExports) { - identifier += ` referencedExports: ${this.options.referencedExports - .map(e => e.join(".")) - .join(", ")}`; - } - - return identifier; - } - - /** - * @returns {void} - */ - invalidateBuild() { - this._forceBuild = true; } /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * + * @param {number} startTime when processing the files has started + * @param {Iterable} files all files + * @param {Iterable} directories all directories + * @param {Iterable} missing all missing files or directories + * @param {Object} options options object (for future extensions) + * @param {boolean=} options.hash should use hash to snapshot + * @param {boolean=} options.timestamp should use timestamp to snapshot + * @param {function((WebpackError | null)=, (Snapshot | null)=): void} callback callback function * @returns {void} */ - needBuild({ fileSystemInfo }, callback) { - // build if enforced - if (this._forceBuild) return callback(null, true); - - // always build when we have no snapshot - if (!this.buildInfo.snapshot) return callback(null, true); + createSnapshot(startTime, files, directories, missing, options, callback) { + /** @type {Map} */ + const fileTimestamps = new Map(); + /** @type {Map} */ + const fileHashes = new Map(); + /** @type {Map} */ + const fileTshs = new Map(); + /** @type {Map} */ + const contextTimestamps = new Map(); + /** @type {Map} */ + const contextHashes = new Map(); + /** @type {Map} */ + const contextTshs = new Map(); + /** @type {Map} */ + const missingExistence = new Map(); + /** @type {Map} */ + const managedItemInfo = new Map(); + /** @type {Set} */ + const managedFiles = new Set(); + /** @type {Set} */ + const managedContexts = new Set(); + /** @type {Set} */ + const managedMissing = new Set(); + /** @type {Set} */ + const children = new Set(); - fileSystemInfo.checkSnapshotValid(this.buildInfo.snapshot, (err, valid) => { - callback(err, !valid); - }); - } + const snapshot = new Snapshot(); + if (startTime) snapshot.setStartTime(startTime); - /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} - */ - build(options, compilation, resolver, fs, callback) { - this._forceBuild = false; - /** @type {BuildMeta} */ - this.buildMeta = { - exportsType: "default", - defaultObject: "redirect-warn" - }; - this.buildInfo = { - snapshot: undefined - }; - this.dependencies.length = 0; - this.blocks.length = 0; - const startTime = Date.now(); - this.resolveDependencies(fs, this.options, (err, dependencies) => { - if (err) { - return callback( - makeWebpackError(err, "ContextModule.resolveDependencies") - ); - } + /** @type {Set} */ + const managedItems = new Set(); - // abort if something failed - // this will create an empty context - if (!dependencies) { - callback(); - return; - } + /** 1 = timestamp, 2 = hash, 3 = timestamp + hash */ + const mode = options && options.hash ? (options.timestamp ? 3 : 2) : 1; - // enhance dependencies with meta info - for (const dep of dependencies) { - dep.loc = { - name: dep.userRequest - }; - dep.request = this.options.addon + dep.request; - } - dependencies.sort( - concatComparators( - compareSelect(a => a.loc, compareLocations), - keepOriginalOrder(this.dependencies) - ) - ); + let jobs = 1; + const jobDone = () => { + if (--jobs === 0) { + if (fileTimestamps.size !== 0) { + snapshot.setFileTimestamps(fileTimestamps); + } + if (fileHashes.size !== 0) { + snapshot.setFileHashes(fileHashes); + } + if (fileTshs.size !== 0) { + snapshot.setFileTshs(fileTshs); + } + if (contextTimestamps.size !== 0) { + snapshot.setContextTimestamps(contextTimestamps); + } + if (contextHashes.size !== 0) { + snapshot.setContextHashes(contextHashes); + } + if (contextTshs.size !== 0) { + snapshot.setContextTshs(contextTshs); + } + if (missingExistence.size !== 0) { + snapshot.setMissingExistence(missingExistence); + } + if (managedItemInfo.size !== 0) { + snapshot.setManagedItemInfo(managedItemInfo); + } + this._managedFilesOptimization.optimize(snapshot, managedFiles); + if (managedFiles.size !== 0) { + snapshot.setManagedFiles(managedFiles); + } + this._managedContextsOptimization.optimize(snapshot, managedContexts); + if (managedContexts.size !== 0) { + snapshot.setManagedContexts(managedContexts); + } + this._managedMissingOptimization.optimize(snapshot, managedMissing); + if (managedMissing.size !== 0) { + snapshot.setManagedMissing(managedMissing); + } + if (children.size !== 0) { + snapshot.setChildren(children); + } + this._snapshotCache.set(snapshot, true); + this._statCreatedSnapshots++; - if (this.options.mode === "sync" || this.options.mode === "eager") { - // if we have an sync or eager context - // just add all dependencies and continue - this.dependencies = dependencies; - } else if (this.options.mode === "lazy-once") { - // for the lazy-once mode create a new async dependency block - // and add that block to this context - if (dependencies.length > 0) { - const block = new AsyncDependenciesBlock({ - ...this.options.groupOptions, - name: this.options.chunkName - }); - for (const dep of dependencies) { - block.addDependency(dep); + callback(null, snapshot); + } + }; + const jobError = () => { + if (jobs > 0) { + // large negative number instead of NaN or something else to keep jobs to stay a SMI (v8) + jobs = -100000000; + callback(null, null); + } + }; + const checkManaged = (path, managedSet) => { + for (const immutablePath of this.immutablePathsRegExps) { + if (immutablePath.test(path)) { + managedSet.add(path); + return true; + } + } + for (const immutablePath of this.immutablePathsWithSlash) { + if (path.startsWith(immutablePath)) { + managedSet.add(path); + return true; + } + } + for (const managedPath of this.managedPathsRegExps) { + const match = managedPath.exec(path); + if (match) { + const managedItem = getManagedItem(match[1], path); + if (managedItem) { + managedItems.add(managedItem); + managedSet.add(path); + return true; } - this.addBlock(block); } - } else if ( - this.options.mode === "weak" || - this.options.mode === "async-weak" - ) { - // we mark all dependencies as weak - for (const dep of dependencies) { - dep.weak = true; + } + for (const managedPath of this.managedPathsWithSlash) { + if (path.startsWith(managedPath)) { + const managedItem = getManagedItem(managedPath, path); + if (managedItem) { + managedItems.add(managedItem); + managedSet.add(path); + return true; + } } - this.dependencies = dependencies; - } else if (this.options.mode === "lazy") { - // if we are lazy create a new async dependency block per dependency - // and add all blocks to this context - let index = 0; - for (const dep of dependencies) { - let chunkName = this.options.chunkName; - if (chunkName) { - if (!/\[(index|request)\]/.test(chunkName)) { - chunkName += "[index]"; + } + return false; + }; + const captureNonManaged = (items, managedSet) => { + const capturedItems = new Set(); + for (const path of items) { + if (!checkManaged(path, managedSet)) capturedItems.add(path); + } + return capturedItems; + }; + const processCapturedFiles = capturedFiles => { + switch (mode) { + case 3: + this._fileTshsOptimization.optimize(snapshot, capturedFiles); + for (const path of capturedFiles) { + const cache = this._fileTshs.get(path); + if (cache !== undefined) { + fileTshs.set(path, cache); + } else { + jobs++; + this._getFileTimestampAndHash(path, (err, entry) => { + if (err) { + if (this.logger) { + this.logger.debug( + `Error snapshotting file timestamp hash combination of ${path}: ${err.stack}` + ); + } + jobError(); + } else { + fileTshs.set(path, entry); + jobDone(); + } + }); } - chunkName = chunkName.replace(/\[index\]/g, `${index++}`); - chunkName = chunkName.replace( - /\[request\]/g, - Template.toPath(dep.userRequest) - ); } - const block = new AsyncDependenciesBlock( - { - ...this.options.groupOptions, - name: chunkName - }, - dep.loc, - dep.userRequest + break; + case 2: + this._fileHashesOptimization.optimize(snapshot, capturedFiles); + for (const path of capturedFiles) { + const cache = this._fileHashes.get(path); + if (cache !== undefined) { + fileHashes.set(path, cache); + } else { + jobs++; + this.fileHashQueue.add(path, (err, entry) => { + if (err) { + if (this.logger) { + this.logger.debug( + `Error snapshotting file hash of ${path}: ${err.stack}` + ); + } + jobError(); + } else { + fileHashes.set(path, entry); + jobDone(); + } + }); + } + } + break; + case 1: + this._fileTimestampsOptimization.optimize(snapshot, capturedFiles); + for (const path of capturedFiles) { + const cache = this._fileTimestamps.get(path); + if (cache !== undefined) { + if (cache !== "ignore") { + fileTimestamps.set(path, cache); + } + } else { + jobs++; + this.fileTimestampQueue.add(path, (err, entry) => { + if (err) { + if (this.logger) { + this.logger.debug( + `Error snapshotting file timestamp of ${path}: ${err.stack}` + ); + } + jobError(); + } else { + fileTimestamps.set(path, entry); + jobDone(); + } + }); + } + } + break; + } + }; + if (files) { + processCapturedFiles(captureNonManaged(files, managedFiles)); + } + const processCapturedDirectories = capturedDirectories => { + switch (mode) { + case 3: + this._contextTshsOptimization.optimize(snapshot, capturedDirectories); + for (const path of capturedDirectories) { + const cache = this._contextTshs.get(path); + /** @type {ResolvedContextTimestampAndHash} */ + let resolved; + if ( + cache !== undefined && + (resolved = getResolvedTimestamp(cache)) !== undefined + ) { + contextTshs.set(path, resolved); + } else { + jobs++; + /** + * @param {Error=} err error + * @param {ResolvedContextTimestampAndHash=} entry entry + * @returns {void} + */ + const callback = (err, entry) => { + if (err) { + if (this.logger) { + this.logger.debug( + `Error snapshotting context timestamp hash combination of ${path}: ${err.stack}` + ); + } + jobError(); + } else { + contextTshs.set(path, entry); + jobDone(); + } + }; + if (cache !== undefined) { + this._resolveContextTsh(cache, callback); + } else { + this.getContextTsh(path, callback); + } + } + } + break; + case 2: + this._contextHashesOptimization.optimize( + snapshot, + capturedDirectories ); - block.addDependency(dep); - this.addBlock(block); - } - } else { - callback( - new WebpackError(`Unsupported mode "${this.options.mode}" in context`) - ); - return; + for (const path of capturedDirectories) { + const cache = this._contextHashes.get(path); + let resolved; + if ( + cache !== undefined && + (resolved = getResolvedHash(cache)) !== undefined + ) { + contextHashes.set(path, resolved); + } else { + jobs++; + const callback = (err, entry) => { + if (err) { + if (this.logger) { + this.logger.debug( + `Error snapshotting context hash of ${path}: ${err.stack}` + ); + } + jobError(); + } else { + contextHashes.set(path, entry); + jobDone(); + } + }; + if (cache !== undefined) { + this._resolveContextHash(cache, callback); + } else { + this.getContextHash(path, callback); + } + } + } + break; + case 1: + this._contextTimestampsOptimization.optimize( + snapshot, + capturedDirectories + ); + for (const path of capturedDirectories) { + const cache = this._contextTimestamps.get(path); + if (cache === "ignore") continue; + let resolved; + if ( + cache !== undefined && + (resolved = getResolvedTimestamp(cache)) !== undefined + ) { + contextTimestamps.set(path, resolved); + } else { + jobs++; + /** + * @param {Error=} err error + * @param {ResolvedContextFileSystemInfoEntry=} entry entry + * @returns {void} + */ + const callback = (err, entry) => { + if (err) { + if (this.logger) { + this.logger.debug( + `Error snapshotting context timestamp of ${path}: ${err.stack}` + ); + } + jobError(); + } else { + contextTimestamps.set(path, entry); + jobDone(); + } + }; + if (cache !== undefined) { + this._resolveContextTimestamp(cache, callback); + } else { + this.getContextTimestamp(path, callback); + } + } + } + break; } - compilation.fileSystemInfo.createSnapshot( - startTime, - null, - [this.context], - null, - SNAPSHOT_OPTIONS, - (err, snapshot) => { - if (err) return callback(err); - this.buildInfo.snapshot = snapshot; - callback(); - } + }; + if (directories) { + processCapturedDirectories( + captureNonManaged(directories, managedContexts) ); - }); - } - - /** - * @param {LazySet} fileDependencies set where file dependencies are added to - * @param {LazySet} contextDependencies set where context dependencies are added to - * @param {LazySet} missingDependencies set where missing dependencies are added to - * @param {LazySet} buildDependencies set where build dependencies are added to - */ - addCacheDependencies( - fileDependencies, - contextDependencies, - missingDependencies, - buildDependencies - ) { - contextDependencies.add(this.context); - } - - /** - * @param {ContextElementDependency[]} dependencies all dependencies - * @param {ChunkGraph} chunkGraph chunk graph - * @returns {TODO} TODO - */ - getUserRequestMap(dependencies, chunkGraph) { - const moduleGraph = chunkGraph.moduleGraph; - // if we filter first we get a new array - // therefore we don't need to create a clone of dependencies explicitly - // therefore the order of this is !important! - const sortedDependencies = dependencies - .filter(dependency => moduleGraph.getModule(dependency)) - .sort((a, b) => { - if (a.userRequest === b.userRequest) { - return 0; + } + const processCapturedMissing = capturedMissing => { + this._missingExistenceOptimization.optimize(snapshot, capturedMissing); + for (const path of capturedMissing) { + const cache = this._fileTimestamps.get(path); + if (cache !== undefined) { + if (cache !== "ignore") { + missingExistence.set(path, Boolean(cache)); + } + } else { + jobs++; + this.fileTimestampQueue.add(path, (err, entry) => { + if (err) { + if (this.logger) { + this.logger.debug( + `Error snapshotting missing timestamp of ${path}: ${err.stack}` + ); + } + jobError(); + } else { + missingExistence.set(path, Boolean(entry)); + jobDone(); + } + }); } - return a.userRequest < b.userRequest ? -1 : 1; - }); - const map = Object.create(null); - for (const dep of sortedDependencies) { - const module = moduleGraph.getModule(dep); - map[dep.userRequest] = chunkGraph.getModuleId(module); + } + }; + if (missing) { + processCapturedMissing(captureNonManaged(missing, managedMissing)); } - return map; + this._managedItemInfoOptimization.optimize(snapshot, managedItems); + for (const path of managedItems) { + const cache = this._managedItems.get(path); + if (cache !== undefined) { + if (!cache.startsWith("*")) { + managedFiles.add(join(this.fs, path, "package.json")); + } else if (cache === "*nested") { + managedMissing.add(join(this.fs, path, "package.json")); + } + managedItemInfo.set(path, cache); + } else { + jobs++; + this.managedItemQueue.add(path, (err, entry) => { + if (err) { + if (this.logger) { + this.logger.debug( + `Error snapshotting managed item ${path}: ${err.stack}` + ); + } + jobError(); + } else if (entry) { + if (!entry.startsWith("*")) { + managedFiles.add(join(this.fs, path, "package.json")); + } else if (cache === "*nested") { + managedMissing.add(join(this.fs, path, "package.json")); + } + managedItemInfo.set(path, entry); + jobDone(); + } else { + // Fallback to normal snapshotting + const process = (set, fn) => { + if (set.size === 0) return; + const captured = new Set(); + for (const file of set) { + if (file.startsWith(path)) captured.add(file); + } + if (captured.size > 0) fn(captured); + }; + process(managedFiles, processCapturedFiles); + process(managedContexts, processCapturedDirectories); + process(managedMissing, processCapturedMissing); + jobDone(); + } + }); + } + } + jobDone(); } /** - * @param {ContextElementDependency[]} dependencies all dependencies - * @param {ChunkGraph} chunkGraph chunk graph - * @returns {TODO} TODO + * @param {Snapshot} snapshot1 a snapshot + * @param {Snapshot} snapshot2 a snapshot + * @returns {Snapshot} merged snapshot */ - getFakeMap(dependencies, chunkGraph) { - if (!this.options.namespaceObject) { - return 9; + mergeSnapshots(snapshot1, snapshot2) { + const snapshot = new Snapshot(); + if (snapshot1.hasStartTime() && snapshot2.hasStartTime()) + snapshot.setStartTime(Math.min(snapshot1.startTime, snapshot2.startTime)); + else if (snapshot2.hasStartTime()) snapshot.startTime = snapshot2.startTime; + else if (snapshot1.hasStartTime()) snapshot.startTime = snapshot1.startTime; + if (snapshot1.hasFileTimestamps() || snapshot2.hasFileTimestamps()) { + snapshot.setFileTimestamps( + mergeMaps(snapshot1.fileTimestamps, snapshot2.fileTimestamps) + ); } - const moduleGraph = chunkGraph.moduleGraph; - // bitfield - let hasType = 0; - const comparator = compareModulesById(chunkGraph); - // if we filter first we get a new array - // therefore we don't need to create a clone of dependencies explicitly - // therefore the order of this is !important! - const sortedModules = dependencies - .map(dependency => moduleGraph.getModule(dependency)) - .filter(Boolean) - .sort(comparator); - const fakeMap = Object.create(null); - for (const module of sortedModules) { - const exportsType = module.getExportsType( - moduleGraph, - this.options.namespaceObject === "strict" + if (snapshot1.hasFileHashes() || snapshot2.hasFileHashes()) { + snapshot.setFileHashes( + mergeMaps(snapshot1.fileHashes, snapshot2.fileHashes) ); - const id = chunkGraph.getModuleId(module); - switch (exportsType) { - case "namespace": - fakeMap[id] = 9; - hasType |= 1; - break; - case "dynamic": - fakeMap[id] = 7; - hasType |= 2; - break; - case "default-only": - fakeMap[id] = 1; - hasType |= 4; - break; - case "default-with-named": - fakeMap[id] = 3; - hasType |= 8; - break; - default: - throw new Error(`Unexpected exports type ${exportsType}`); - } } - if (hasType === 1) { - return 9; + if (snapshot1.hasFileTshs() || snapshot2.hasFileTshs()) { + snapshot.setFileTshs(mergeMaps(snapshot1.fileTshs, snapshot2.fileTshs)); } - if (hasType === 2) { - return 7; + if (snapshot1.hasContextTimestamps() || snapshot2.hasContextTimestamps()) { + snapshot.setContextTimestamps( + mergeMaps(snapshot1.contextTimestamps, snapshot2.contextTimestamps) + ); } - if (hasType === 4) { - return 1; + if (snapshot1.hasContextHashes() || snapshot2.hasContextHashes()) { + snapshot.setContextHashes( + mergeMaps(snapshot1.contextHashes, snapshot2.contextHashes) + ); } - if (hasType === 8) { - return 3; + if (snapshot1.hasContextTshs() || snapshot2.hasContextTshs()) { + snapshot.setContextTshs( + mergeMaps(snapshot1.contextTshs, snapshot2.contextTshs) + ); } - if (hasType === 0) { - return 9; + if (snapshot1.hasMissingExistence() || snapshot2.hasMissingExistence()) { + snapshot.setMissingExistence( + mergeMaps(snapshot1.missingExistence, snapshot2.missingExistence) + ); } - return fakeMap; - } - - getFakeMapInitStatement(fakeMap) { - return typeof fakeMap === "object" - ? `var fakeMap = ${JSON.stringify(fakeMap, null, "\t")};` - : ""; - } - - getReturn(type, asyncModule) { - if (type === 9) { - return "__webpack_require__(id)"; + if (snapshot1.hasManagedItemInfo() || snapshot2.hasManagedItemInfo()) { + snapshot.setManagedItemInfo( + mergeMaps(snapshot1.managedItemInfo, snapshot2.managedItemInfo) + ); } - return `${RuntimeGlobals.createFakeNamespaceObject}(id, ${type}${ - asyncModule ? " | 16" : "" - })`; - } - - getReturnModuleObjectSource( - fakeMap, - asyncModule, - fakeMapDataExpression = "fakeMap[id]" - ) { - if (typeof fakeMap === "number") { - return `return ${this.getReturn(fakeMap, asyncModule)};`; + if (snapshot1.hasManagedFiles() || snapshot2.hasManagedFiles()) { + snapshot.setManagedFiles( + mergeSets(snapshot1.managedFiles, snapshot2.managedFiles) + ); } - return `return ${ - RuntimeGlobals.createFakeNamespaceObject - }(id, ${fakeMapDataExpression}${asyncModule ? " | 16" : ""})`; - } - - /** - * @param {TODO} dependencies TODO - * @param {TODO} id TODO - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {string} source code - */ - getSyncSource(dependencies, id, chunkGraph) { - const map = this.getUserRequestMap(dependencies, chunkGraph); - const fakeMap = this.getFakeMap(dependencies, chunkGraph); - const returnModuleObject = this.getReturnModuleObjectSource(fakeMap); - - return `var map = ${JSON.stringify(map, null, "\t")}; -${this.getFakeMapInitStatement(fakeMap)} - -function webpackContext(req) { - var id = webpackContextResolve(req); - ${returnModuleObject} -} -function webpackContextResolve(req) { - if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; - } - return map[req]; -} -webpackContext.keys = function webpackContextKeys() { - return Object.keys(map); -}; -webpackContext.resolve = webpackContextResolve; -module.exports = webpackContext; -webpackContext.id = ${JSON.stringify(id)};`; - } - - /** - * @param {TODO} dependencies TODO - * @param {TODO} id TODO - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {string} source code - */ - getWeakSyncSource(dependencies, id, chunkGraph) { - const map = this.getUserRequestMap(dependencies, chunkGraph); - const fakeMap = this.getFakeMap(dependencies, chunkGraph); - const returnModuleObject = this.getReturnModuleObjectSource(fakeMap); - - return `var map = ${JSON.stringify(map, null, "\t")}; -${this.getFakeMapInitStatement(fakeMap)} - -function webpackContext(req) { - var id = webpackContextResolve(req); - if(!${RuntimeGlobals.moduleFactories}[id]) { - var e = new Error("Module '" + req + "' ('" + id + "') is not available (weak dependency)"); - e.code = 'MODULE_NOT_FOUND'; - throw e; - } - ${returnModuleObject} -} -function webpackContextResolve(req) { - if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; - } - return map[req]; -} -webpackContext.keys = function webpackContextKeys() { - return Object.keys(map); -}; -webpackContext.resolve = webpackContextResolve; -webpackContext.id = ${JSON.stringify(id)}; -module.exports = webpackContext;`; - } - - /** - * @param {TODO} dependencies TODO - * @param {TODO} id TODO - * @param {Object} context context - * @param {ChunkGraph} context.chunkGraph the chunk graph - * @param {RuntimeTemplate} context.runtimeTemplate the chunk graph - * @returns {string} source code - */ - getAsyncWeakSource(dependencies, id, { chunkGraph, runtimeTemplate }) { - const arrow = runtimeTemplate.supportsArrowFunction(); - const map = this.getUserRequestMap(dependencies, chunkGraph); - const fakeMap = this.getFakeMap(dependencies, chunkGraph); - const returnModuleObject = this.getReturnModuleObjectSource(fakeMap, true); - - return `var map = ${JSON.stringify(map, null, "\t")}; -${this.getFakeMapInitStatement(fakeMap)} - -function webpackAsyncContext(req) { - return webpackAsyncContextResolve(req).then(${ - arrow ? "id =>" : "function(id)" - } { - if(!${RuntimeGlobals.moduleFactories}[id]) { - var e = new Error("Module '" + req + "' ('" + id + "') is not available (weak dependency)"); - e.code = 'MODULE_NOT_FOUND'; - throw e; + if (snapshot1.hasManagedContexts() || snapshot2.hasManagedContexts()) { + snapshot.setManagedContexts( + mergeSets(snapshot1.managedContexts, snapshot2.managedContexts) + ); } - ${returnModuleObject} - }); -} -function webpackAsyncContextResolve(req) { - // Here Promise.resolve().then() is used instead of new Promise() to prevent - // uncaught exception popping up in devtools - return Promise.resolve().then(${arrow ? "() =>" : "function()"} { - if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; + if (snapshot1.hasManagedMissing() || snapshot2.hasManagedMissing()) { + snapshot.setManagedMissing( + mergeSets(snapshot1.managedMissing, snapshot2.managedMissing) + ); } - return map[req]; - }); -} -webpackAsyncContext.keys = ${runtimeTemplate.returningFunction( - "Object.keys(map)" - )}; -webpackAsyncContext.resolve = webpackAsyncContextResolve; -webpackAsyncContext.id = ${JSON.stringify(id)}; -module.exports = webpackAsyncContext;`; - } - - /** - * @param {TODO} dependencies TODO - * @param {TODO} id TODO - * @param {Object} context context - * @param {ChunkGraph} context.chunkGraph the chunk graph - * @param {RuntimeTemplate} context.runtimeTemplate the chunk graph - * @returns {string} source code - */ - getEagerSource(dependencies, id, { chunkGraph, runtimeTemplate }) { - const arrow = runtimeTemplate.supportsArrowFunction(); - const map = this.getUserRequestMap(dependencies, chunkGraph); - const fakeMap = this.getFakeMap(dependencies, chunkGraph); - const thenFunction = - fakeMap !== 9 - ? `${arrow ? "id =>" : "function(id)"} { - ${this.getReturnModuleObjectSource(fakeMap)} - }` - : "__webpack_require__"; - return `var map = ${JSON.stringify(map, null, "\t")}; -${this.getFakeMapInitStatement(fakeMap)} - -function webpackAsyncContext(req) { - return webpackAsyncContextResolve(req).then(${thenFunction}); -} -function webpackAsyncContextResolve(req) { - // Here Promise.resolve().then() is used instead of new Promise() to prevent - // uncaught exception popping up in devtools - return Promise.resolve().then(${arrow ? "() =>" : "function()"} { - if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; + if (snapshot1.hasChildren() || snapshot2.hasChildren()) { + snapshot.setChildren(mergeSets(snapshot1.children, snapshot2.children)); } - return map[req]; - }); -} -webpackAsyncContext.keys = ${runtimeTemplate.returningFunction( - "Object.keys(map)" - )}; -webpackAsyncContext.resolve = webpackAsyncContextResolve; -webpackAsyncContext.id = ${JSON.stringify(id)}; -module.exports = webpackAsyncContext;`; - } - - /** - * @param {TODO} block TODO - * @param {TODO} dependencies TODO - * @param {TODO} id TODO - * @param {Object} options options object - * @param {RuntimeTemplate} options.runtimeTemplate the runtime template - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @returns {string} source code - */ - getLazyOnceSource(block, dependencies, id, { runtimeTemplate, chunkGraph }) { - const promise = runtimeTemplate.blockPromise({ - chunkGraph, - block, - message: "lazy-once context", - runtimeRequirements: new Set() - }); - const arrow = runtimeTemplate.supportsArrowFunction(); - const map = this.getUserRequestMap(dependencies, chunkGraph); - const fakeMap = this.getFakeMap(dependencies, chunkGraph); - const thenFunction = - fakeMap !== 9 - ? `${arrow ? "id =>" : "function(id)"} { - ${this.getReturnModuleObjectSource(fakeMap, true)}; - }` - : "__webpack_require__"; - - return `var map = ${JSON.stringify(map, null, "\t")}; -${this.getFakeMapInitStatement(fakeMap)} - -function webpackAsyncContext(req) { - return webpackAsyncContextResolve(req).then(${thenFunction}); -} -function webpackAsyncContextResolve(req) { - return ${promise}.then(${arrow ? "() =>" : "function()"} { - if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; + if ( + this._snapshotCache.get(snapshot1) === true && + this._snapshotCache.get(snapshot2) === true + ) { + this._snapshotCache.set(snapshot, true); } - return map[req]; - }); -} -webpackAsyncContext.keys = ${runtimeTemplate.returningFunction( - "Object.keys(map)" - )}; -webpackAsyncContext.resolve = webpackAsyncContextResolve; -webpackAsyncContext.id = ${JSON.stringify(id)}; -module.exports = webpackAsyncContext;`; + return snapshot; } /** - * @param {TODO} blocks TODO - * @param {TODO} id TODO - * @param {Object} context context - * @param {ChunkGraph} context.chunkGraph the chunk graph - * @param {RuntimeTemplate} context.runtimeTemplate the chunk graph - * @returns {string} source code + * @param {Snapshot} snapshot the snapshot made + * @param {function((WebpackError | null)=, boolean=): void} callback callback function + * @returns {void} */ - getLazySource(blocks, id, { chunkGraph, runtimeTemplate }) { - const moduleGraph = chunkGraph.moduleGraph; - const arrow = runtimeTemplate.supportsArrowFunction(); - let hasMultipleOrNoChunks = false; - let hasNoChunk = true; - const fakeMap = this.getFakeMap( - blocks.map(b => b.dependencies[0]), - chunkGraph - ); - const hasFakeMap = typeof fakeMap === "object"; - const items = blocks - .map(block => { - const dependency = block.dependencies[0]; - return { - dependency: dependency, - module: moduleGraph.getModule(dependency), - block: block, - userRequest: dependency.userRequest, - chunks: undefined - }; - }) - .filter(item => item.module); - for (const item of items) { - const chunkGroup = chunkGraph.getBlockChunkGroup(item.block); - const chunks = (chunkGroup && chunkGroup.chunks) || []; - item.chunks = chunks; - if (chunks.length > 0) { - hasNoChunk = false; - } - if (chunks.length !== 1) { - hasMultipleOrNoChunks = true; - } - } - const shortMode = hasNoChunk && !hasFakeMap; - const sortedItems = items.sort((a, b) => { - if (a.userRequest === b.userRequest) return 0; - return a.userRequest < b.userRequest ? -1 : 1; - }); - const map = Object.create(null); - for (const item of sortedItems) { - const moduleId = chunkGraph.getModuleId(item.module); - if (shortMode) { - map[item.userRequest] = moduleId; + checkSnapshotValid(snapshot, callback) { + const cachedResult = this._snapshotCache.get(snapshot); + if (cachedResult !== undefined) { + this._statTestedSnapshotsCached++; + if (typeof cachedResult === "boolean") { + callback(null, cachedResult); } else { - const arrayStart = [moduleId]; - if (hasFakeMap) { - arrayStart.push(fakeMap[moduleId]); - } - map[item.userRequest] = arrayStart.concat( - item.chunks.map(chunk => chunk.id) - ); + cachedResult.push(callback); } + return; } - - const chunksStartPosition = hasFakeMap ? 2 : 1; - const requestPrefix = hasNoChunk - ? "Promise.resolve()" - : hasMultipleOrNoChunks - ? `Promise.all(ids.slice(${chunksStartPosition}).map(${RuntimeGlobals.ensureChunk}))` - : `${RuntimeGlobals.ensureChunk}(ids[${chunksStartPosition}])`; - const returnModuleObject = this.getReturnModuleObjectSource( - fakeMap, - true, - shortMode ? "invalid" : "ids[1]" - ); - - const webpackAsyncContext = - requestPrefix === "Promise.resolve()" - ? ` -function webpackAsyncContext(req) { - return Promise.resolve().then(${arrow ? "() =>" : "function()"} { - if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; - } - - ${shortMode ? "var id = map[req];" : "var ids = map[req], id = ids[0];"} - ${returnModuleObject} - }); -}` - : `function webpackAsyncContext(req) { - if(!${RuntimeGlobals.hasOwnProperty}(map, req)) { - return Promise.resolve().then(${arrow ? "() =>" : "function()"} { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; - }); - } - - var ids = map[req], id = ids[0]; - return ${requestPrefix}.then(${arrow ? "() =>" : "function()"} { - ${returnModuleObject} - }); -}`; - - return `var map = ${JSON.stringify(map, null, "\t")}; -${webpackAsyncContext} -webpackAsyncContext.keys = ${runtimeTemplate.returningFunction( - "Object.keys(map)" - )}; -webpackAsyncContext.id = ${JSON.stringify(id)}; -module.exports = webpackAsyncContext;`; - } - - getSourceForEmptyContext(id, runtimeTemplate) { - return `function webpackEmptyContext(req) { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; -} -webpackEmptyContext.keys = ${runtimeTemplate.returningFunction("[]")}; -webpackEmptyContext.resolve = webpackEmptyContext; -webpackEmptyContext.id = ${JSON.stringify(id)}; -module.exports = webpackEmptyContext;`; - } - - getSourceForEmptyAsyncContext(id, runtimeTemplate) { - const arrow = runtimeTemplate.supportsArrowFunction(); - return `function webpackEmptyAsyncContext(req) { - // Here Promise.resolve().then() is used instead of new Promise() to prevent - // uncaught exception popping up in devtools - return Promise.resolve().then(${arrow ? "() =>" : "function()"} { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; - }); -} -webpackEmptyAsyncContext.keys = ${runtimeTemplate.returningFunction("[]")}; -webpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext; -webpackEmptyAsyncContext.id = ${JSON.stringify(id)}; -module.exports = webpackEmptyAsyncContext;`; + this._statTestedSnapshotsNotCached++; + this._checkSnapshotValidNoCache(snapshot, callback); } /** - * @param {string} asyncMode module mode - * @param {CodeGenerationContext} context context info - * @returns {string} the source code + * @param {Snapshot} snapshot the snapshot made + * @param {function((WebpackError | null)=, boolean=): void} callback callback function + * @returns {void} */ - getSourceString(asyncMode, { runtimeTemplate, chunkGraph }) { - const id = chunkGraph.getModuleId(this); - if (asyncMode === "lazy") { - if (this.blocks && this.blocks.length > 0) { - return this.getLazySource(this.blocks, id, { - runtimeTemplate, - chunkGraph - }); - } - return this.getSourceForEmptyAsyncContext(id, runtimeTemplate); - } - if (asyncMode === "eager") { - if (this.dependencies && this.dependencies.length > 0) { - return this.getEagerSource(this.dependencies, id, { - chunkGraph, - runtimeTemplate - }); - } - return this.getSourceForEmptyAsyncContext(id, runtimeTemplate); + _checkSnapshotValidNoCache(snapshot, callback) { + /** @type {number | undefined} */ + let startTime = undefined; + if (snapshot.hasStartTime()) { + startTime = snapshot.startTime; } - if (asyncMode === "lazy-once") { - const block = this.blocks[0]; - if (block) { - return this.getLazyOnceSource(block, block.dependencies, id, { - runtimeTemplate, - chunkGraph - }); + let jobs = 1; + const jobDone = () => { + if (--jobs === 0) { + this._snapshotCache.set(snapshot, true); + callback(null, true); + } + }; + const invalid = () => { + if (jobs > 0) { + // large negative number instead of NaN or something else to keep jobs to stay a SMI (v8) + jobs = -100000000; + this._snapshotCache.set(snapshot, false); + callback(null, false); + } + }; + const invalidWithError = (path, err) => { + if (this._remainingLogs > 0) { + this._log(path, `error occurred: %s`, err); + } + invalid(); + }; + /** + * @param {string} path file path + * @param {string} current current hash + * @param {string} snap snapshot hash + * @returns {boolean} true, if ok + */ + const checkHash = (path, current, snap) => { + if (current !== snap) { + // If hash differ it's invalid + if (this._remainingLogs > 0) { + this._log(path, `hashes differ (%s != %s)`, current, snap); + } + return false; + } + return true; + }; + /** + * @param {string} path file path + * @param {boolean} current current entry + * @param {boolean} snap entry from snapshot + * @returns {boolean} true, if ok + */ + const checkExistence = (path, current, snap) => { + if (!current !== !snap) { + // If existence of item differs + // it's invalid + if (this._remainingLogs > 0) { + this._log( + path, + current ? "it didn't exist before" : "it does no longer exist" + ); + } + return false; + } + return true; + }; + /** + * @param {string} path file path + * @param {FileSystemInfoEntry} current current entry + * @param {FileSystemInfoEntry} snap entry from snapshot + * @param {boolean} log log reason + * @returns {boolean} true, if ok + */ + const checkFile = (path, current, snap, log = true) => { + if (current === snap) return true; + if (!checkExistence(path, Boolean(current), Boolean(snap))) return false; + if (current) { + // For existing items only + if (typeof startTime === "number" && current.safeTime > startTime) { + // If a change happened after starting reading the item + // this may no longer be valid + if (log && this._remainingLogs > 0) { + this._log( + path, + `it may have changed (%d) after the start time of the snapshot (%d)`, + current.safeTime, + startTime + ); + } + return false; + } + if ( + snap.timestamp !== undefined && + current.timestamp !== snap.timestamp + ) { + // If we have a timestamp (it was a file or symlink) and it differs from current timestamp + // it's invalid + if (log && this._remainingLogs > 0) { + this._log( + path, + `timestamps differ (%d != %d)`, + current.timestamp, + snap.timestamp + ); + } + return false; + } + } + return true; + }; + /** + * @param {string} path file path + * @param {ResolvedContextFileSystemInfoEntry} current current entry + * @param {ResolvedContextFileSystemInfoEntry} snap entry from snapshot + * @param {boolean} log log reason + * @returns {boolean} true, if ok + */ + const checkContext = (path, current, snap, log = true) => { + if (current === snap) return true; + if (!checkExistence(path, Boolean(current), Boolean(snap))) return false; + if (current) { + // For existing items only + if (typeof startTime === "number" && current.safeTime > startTime) { + // If a change happened after starting reading the item + // this may no longer be valid + if (log && this._remainingLogs > 0) { + this._log( + path, + `it may have changed (%d) after the start time of the snapshot (%d)`, + current.safeTime, + startTime + ); + } + return false; + } + if ( + snap.timestampHash !== undefined && + current.timestampHash !== snap.timestampHash + ) { + // If we have a timestampHash (it was a directory) and it differs from current timestampHash + // it's invalid + if (log && this._remainingLogs > 0) { + this._log( + path, + `timestamps hashes differ (%s != %s)`, + current.timestampHash, + snap.timestampHash + ); + } + return false; + } + } + return true; + }; + if (snapshot.hasChildren()) { + const childCallback = (err, result) => { + if (err || !result) return invalid(); + else jobDone(); + }; + for (const child of snapshot.children) { + const cache = this._snapshotCache.get(child); + if (cache !== undefined) { + this._statTestedChildrenCached++; + /* istanbul ignore else */ + if (typeof cache === "boolean") { + if (cache === false) { + invalid(); + return; + } + } else { + jobs++; + cache.push(childCallback); + } + } else { + this._statTestedChildrenNotCached++; + jobs++; + this._checkSnapshotValidNoCache(child, childCallback); + } } - return this.getSourceForEmptyAsyncContext(id, runtimeTemplate); } - if (asyncMode === "async-weak") { - if (this.dependencies && this.dependencies.length > 0) { - return this.getAsyncWeakSource(this.dependencies, id, { - chunkGraph, - runtimeTemplate + if (snapshot.hasFileTimestamps()) { + const { fileTimestamps } = snapshot; + this._statTestedEntries += fileTimestamps.size; + for (const [path, ts] of fileTimestamps) { + const cache = this._fileTimestamps.get(path); + if (cache !== undefined) { + if (cache !== "ignore" && !checkFile(path, cache, ts)) { + invalid(); + return; + } + } else { + jobs++; + this.fileTimestampQueue.add(path, (err, entry) => { + if (err) return invalidWithError(path, err); + if (!checkFile(path, entry, ts)) { + invalid(); + } else { + jobDone(); + } + }); + } + } + } + const processFileHashSnapshot = (path, hash) => { + const cache = this._fileHashes.get(path); + if (cache !== undefined) { + if (cache !== "ignore" && !checkHash(path, cache, hash)) { + invalid(); + return; + } + } else { + jobs++; + this.fileHashQueue.add(path, (err, entry) => { + if (err) return invalidWithError(path, err); + if (!checkHash(path, entry, hash)) { + invalid(); + } else { + jobDone(); + } }); } - return this.getSourceForEmptyAsyncContext(id, runtimeTemplate); + }; + if (snapshot.hasFileHashes()) { + const { fileHashes } = snapshot; + this._statTestedEntries += fileHashes.size; + for (const [path, hash] of fileHashes) { + processFileHashSnapshot(path, hash); + } } - if (asyncMode === "weak") { - if (this.dependencies && this.dependencies.length > 0) { - return this.getWeakSyncSource(this.dependencies, id, chunkGraph); + if (snapshot.hasFileTshs()) { + const { fileTshs } = snapshot; + this._statTestedEntries += fileTshs.size; + for (const [path, tsh] of fileTshs) { + if (typeof tsh === "string") { + processFileHashSnapshot(path, tsh); + } else { + const cache = this._fileTimestamps.get(path); + if (cache !== undefined) { + if (cache === "ignore" || !checkFile(path, cache, tsh, false)) { + processFileHashSnapshot(path, tsh && tsh.hash); + } + } else { + jobs++; + this.fileTimestampQueue.add(path, (err, entry) => { + if (err) return invalidWithError(path, err); + if (!checkFile(path, entry, tsh, false)) { + processFileHashSnapshot(path, tsh && tsh.hash); + } + jobDone(); + }); + } + } } } - if (this.dependencies && this.dependencies.length > 0) { - return this.getSyncSource(this.dependencies, id, chunkGraph); + if (snapshot.hasContextTimestamps()) { + const { contextTimestamps } = snapshot; + this._statTestedEntries += contextTimestamps.size; + for (const [path, ts] of contextTimestamps) { + const cache = this._contextTimestamps.get(path); + if (cache === "ignore") continue; + let resolved; + if ( + cache !== undefined && + (resolved = getResolvedTimestamp(cache)) !== undefined + ) { + if (!checkContext(path, resolved, ts)) { + invalid(); + return; + } + } else { + jobs++; + /** + * @param {Error=} err error + * @param {ResolvedContextFileSystemInfoEntry=} entry entry + * @returns {void} + */ + const callback = (err, entry) => { + if (err) return invalidWithError(path, err); + if (!checkContext(path, entry, ts)) { + invalid(); + } else { + jobDone(); + } + }; + if (cache !== undefined) { + this._resolveContextTimestamp(cache, callback); + } else { + this.getContextTimestamp(path, callback); + } + } + } } - return this.getSourceForEmptyContext(id, runtimeTemplate); - } - - getSource(sourceString) { - if (this.useSourceMap || this.useSimpleSourceMap) { - return new OriginalSource(sourceString, this.identifier()); + const processContextHashSnapshot = (path, hash) => { + const cache = this._contextHashes.get(path); + let resolved; + if ( + cache !== undefined && + (resolved = getResolvedHash(cache)) !== undefined + ) { + if (!checkHash(path, resolved, hash)) { + invalid(); + return; + } + } else { + jobs++; + const callback = (err, entry) => { + if (err) return invalidWithError(path, err); + if (!checkHash(path, entry, hash)) { + invalid(); + } else { + jobDone(); + } + }; + if (cache !== undefined) { + this._resolveContextHash(cache, callback); + } else { + this.getContextHash(path, callback); + } + } + }; + if (snapshot.hasContextHashes()) { + const { contextHashes } = snapshot; + this._statTestedEntries += contextHashes.size; + for (const [path, hash] of contextHashes) { + processContextHashSnapshot(path, hash); + } } - return new RawSource(sourceString); - } - - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration(context) { - const { chunkGraph } = context; - const sources = new Map(); - sources.set( - "javascript", - this.getSource(this.getSourceString(this.options.mode, context)) - ); - const set = new Set(); - const allDeps = /** @type {ContextElementDependency[]} */ ( - this.dependencies.concat(this.blocks.map(b => b.dependencies[0])) - ); - set.add(RuntimeGlobals.module); - set.add(RuntimeGlobals.hasOwnProperty); - if (allDeps.length > 0) { - const asyncMode = this.options.mode; - set.add(RuntimeGlobals.require); - if (asyncMode === "weak") { - set.add(RuntimeGlobals.moduleFactories); - } else if (asyncMode === "async-weak") { - set.add(RuntimeGlobals.moduleFactories); - set.add(RuntimeGlobals.ensureChunk); - } else if (asyncMode === "lazy" || asyncMode === "lazy-once") { - set.add(RuntimeGlobals.ensureChunk); + if (snapshot.hasContextTshs()) { + const { contextTshs } = snapshot; + this._statTestedEntries += contextTshs.size; + for (const [path, tsh] of contextTshs) { + if (typeof tsh === "string") { + processContextHashSnapshot(path, tsh); + } else { + const cache = this._contextTimestamps.get(path); + if (cache === "ignore") continue; + let resolved; + if ( + cache !== undefined && + (resolved = getResolvedTimestamp(cache)) !== undefined + ) { + if (!checkContext(path, resolved, tsh, false)) { + processContextHashSnapshot(path, tsh && tsh.hash); + } + } else { + jobs++; + /** + * @param {Error=} err error + * @param {ResolvedContextFileSystemInfoEntry=} entry entry + * @returns {void} + */ + const callback = (err, entry) => { + if (err) return invalidWithError(path, err); + if (!checkContext(path, entry, tsh, false)) { + processContextHashSnapshot(path, tsh && tsh.hash); + } + jobDone(); + }; + if (cache !== undefined) { + this._resolveContextTimestamp(cache, callback); + } else { + this.getContextTimestamp(path, callback); + } + } + } } - if (this.getFakeMap(allDeps, chunkGraph) !== 9) { - set.add(RuntimeGlobals.createFakeNamespaceObject); + } + if (snapshot.hasMissingExistence()) { + const { missingExistence } = snapshot; + this._statTestedEntries += missingExistence.size; + for (const [path, existence] of missingExistence) { + const cache = this._fileTimestamps.get(path); + if (cache !== undefined) { + if ( + cache !== "ignore" && + !checkExistence(path, Boolean(cache), Boolean(existence)) + ) { + invalid(); + return; + } + } else { + jobs++; + this.fileTimestampQueue.add(path, (err, entry) => { + if (err) return invalidWithError(path, err); + if (!checkExistence(path, Boolean(entry), Boolean(existence))) { + invalid(); + } else { + jobDone(); + } + }); + } } } - return { - sources, - runtimeRequirements: set - }; - } - - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - // base penalty - let size = 160; + if (snapshot.hasManagedItemInfo()) { + const { managedItemInfo } = snapshot; + this._statTestedEntries += managedItemInfo.size; + for (const [path, info] of managedItemInfo) { + const cache = this._managedItems.get(path); + if (cache !== undefined) { + if (!checkHash(path, cache, info)) { + invalid(); + return; + } + } else { + jobs++; + this.managedItemQueue.add(path, (err, entry) => { + if (err) return invalidWithError(path, err); + if (!checkHash(path, entry, info)) { + invalid(); + } else { + jobDone(); + } + }); + } + } + } + jobDone(); - // if we don't have dependencies we stop here. - for (const dependency of this.dependencies) { - const element = /** @type {ContextElementDependency} */ (dependency); - size += 5 + element.userRequest.length; + // if there was an async action + // try to join multiple concurrent request for this snapshot + if (jobs > 0) { + const callbacks = [callback]; + callback = (err, result) => { + for (const callback of callbacks) callback(err, result); + }; + this._snapshotCache.set(snapshot, callbacks); } - return size; } - serialize(context) { - const { write } = context; - write(this._identifier); - write(this._forceBuild); - super.serialize(context); - } + _readFileTimestamp(path, callback) { + this.fs.stat(path, (err, stat) => { + if (err) { + if (err.code === "ENOENT") { + this._fileTimestamps.set(path, null); + this._cachedDeprecatedFileTimestamps = undefined; + return callback(null, null); + } + return callback(err); + } - deserialize(context) { - const { read } = context; - this._identifier = read(); - this._forceBuild = read(); - super.deserialize(context); - } -} + let ts; + if (stat.isDirectory()) { + ts = { + safeTime: 0, + timestamp: undefined + }; + } else { + const mtime = +stat.mtime; -makeSerializable(ContextModule, "webpack/lib/ContextModule"); + if (mtime) applyMtime(mtime); -module.exports = ContextModule; + ts = { + safeTime: mtime ? mtime + FS_ACCURACY : Infinity, + timestamp: mtime + }; + } + this._fileTimestamps.set(path, ts); + this._cachedDeprecatedFileTimestamps = undefined; -/***/ }), + callback(null, ts); + }); + } -/***/ 62471: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + _readFileHash(path, callback) { + this.fs.readFile(path, (err, content) => { + if (err) { + if (err.code === "EISDIR") { + this._fileHashes.set(path, "directory"); + return callback(null, "directory"); + } + if (err.code === "ENOENT") { + this._fileHashes.set(path, null); + return callback(null, null); + } + if (err.code === "ERR_FS_FILE_TOO_LARGE") { + this.logger.warn(`Ignoring ${path} for hashing as it's very large`); + this._fileHashes.set(path, "too large"); + return callback(null, "too large"); + } + return callback(err); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const hash = createHash(this._hashFunction); + hash.update(content); + const digest = /** @type {string} */ (hash.digest("hex")); -const asyncLib = __webpack_require__(78175); -const { AsyncSeriesWaterfallHook, SyncWaterfallHook } = __webpack_require__(41242); -const ContextModule = __webpack_require__(76729); -const ModuleFactory = __webpack_require__(51010); -const ContextElementDependency = __webpack_require__(58477); -const LazySet = __webpack_require__(38938); -const { cachedSetProperty } = __webpack_require__(60839); -const { createFakeHook } = __webpack_require__(64518); -const { join } = __webpack_require__(17139); + this._fileHashes.set(path, digest); -/** @typedef {import("./ContextModule").ContextModuleOptions} ContextModuleOptions */ -/** @typedef {import("./ContextModule").ResolveDependenciesCallback} ResolveDependenciesCallback */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ -/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ -/** @typedef {import("./ResolverFactory")} ResolverFactory */ -/** @typedef {import("./dependencies/ContextDependency")} ContextDependency */ -/** @template T @typedef {import("./util/deprecation").FakeHook} FakeHook */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ + callback(null, digest); + }); + } -const EMPTY_RESOLVE_OPTIONS = {}; + _getFileTimestampAndHash(path, callback) { + const continueWithHash = hash => { + const cache = this._fileTimestamps.get(path); + if (cache !== undefined) { + if (cache !== "ignore") { + const result = { + ...cache, + hash + }; + this._fileTshs.set(path, result); + return callback(null, result); + } else { + this._fileTshs.set(path, hash); + return callback(null, hash); + } + } else { + this.fileTimestampQueue.add(path, (err, entry) => { + if (err) { + return callback(err); + } + const result = { + ...entry, + hash + }; + this._fileTshs.set(path, result); + return callback(null, result); + }); + } + }; + + const cache = this._fileHashes.get(path); + if (cache !== undefined) { + continueWithHash(cache); + } else { + this.fileHashQueue.add(path, (err, entry) => { + if (err) { + return callback(err); + } + continueWithHash(entry); + }); + } + } -module.exports = class ContextModuleFactory extends ModuleFactory { /** - * @param {ResolverFactory} resolverFactory resolverFactory + * @template T + * @template ItemType + * @param {Object} options options + * @param {string} options.path path + * @param {function(string): ItemType} options.fromImmutablePath called when context item is an immutable path + * @param {function(string): ItemType} options.fromManagedItem called when context item is a managed path + * @param {function(string, string, function(Error=, ItemType=): void): void} options.fromSymlink called when context item is a symlink + * @param {function(string, IStats, function(Error=, ItemType=): void): void} options.fromFile called when context item is a file + * @param {function(string, IStats, function(Error=, ItemType=): void): void} options.fromDirectory called when context item is a directory + * @param {function(string[], ItemType[]): T} options.reduce called from all context items + * @param {function((Error | null)=, (T)=): void} callback callback */ - constructor(resolverFactory) { - super(); - /** @type {AsyncSeriesWaterfallHook<[TODO[], ContextModuleOptions]>} */ - const alternativeRequests = new AsyncSeriesWaterfallHook([ - "modules", - "options" - ]); - this.hooks = Object.freeze({ - /** @type {AsyncSeriesWaterfallHook<[TODO]>} */ - beforeResolve: new AsyncSeriesWaterfallHook(["data"]), - /** @type {AsyncSeriesWaterfallHook<[TODO]>} */ - afterResolve: new AsyncSeriesWaterfallHook(["data"]), - /** @type {SyncWaterfallHook<[string[]]>} */ - contextModuleFiles: new SyncWaterfallHook(["files"]), - /** @type {FakeHook, "tap" | "tapAsync" | "tapPromise" | "name">>} */ - alternatives: createFakeHook( - { - name: "alternatives", - /** @type {AsyncSeriesWaterfallHook<[TODO[]]>["intercept"]} */ - intercept: interceptor => { - throw new Error( - "Intercepting fake hook ContextModuleFactory.hooks.alternatives is not possible, use ContextModuleFactory.hooks.alternativeRequests instead" - ); - }, - /** @type {AsyncSeriesWaterfallHook<[TODO[]]>["tap"]} */ - tap: (options, fn) => { - alternativeRequests.tap(options, fn); - }, - /** @type {AsyncSeriesWaterfallHook<[TODO[]]>["tapAsync"]} */ - tapAsync: (options, fn) => { - alternativeRequests.tapAsync(options, (items, _options, callback) => - fn(items, callback) - ); - }, - /** @type {AsyncSeriesWaterfallHook<[TODO[]]>["tapPromise"]} */ - tapPromise: (options, fn) => { - alternativeRequests.tapPromise(options, fn); + _readContext( + { + path, + fromImmutablePath, + fromManagedItem, + fromSymlink, + fromFile, + fromDirectory, + reduce + }, + callback + ) { + this.fs.readdir(path, (err, _files) => { + if (err) { + if (err.code === "ENOENT") { + return callback(null, null); + } + return callback(err); + } + const files = /** @type {string[]} */ (_files) + .map(file => file.normalize("NFC")) + .filter(file => !/^\./.test(file)) + .sort(); + asyncLib.map( + files, + (file, callback) => { + const child = join(this.fs, path, file); + for (const immutablePath of this.immutablePathsRegExps) { + if (immutablePath.test(path)) { + // ignore any immutable path for timestamping + return callback(null, fromImmutablePath(path)); + } + } + for (const immutablePath of this.immutablePathsWithSlash) { + if (path.startsWith(immutablePath)) { + // ignore any immutable path for timestamping + return callback(null, fromImmutablePath(path)); + } + } + for (const managedPath of this.managedPathsRegExps) { + const match = managedPath.exec(path); + if (match) { + const managedItem = getManagedItem(match[1], path); + if (managedItem) { + // construct timestampHash from managed info + return this.managedItemQueue.add(managedItem, (err, info) => { + if (err) return callback(err); + return callback(null, fromManagedItem(info)); + }); + } + } + } + for (const managedPath of this.managedPathsWithSlash) { + if (path.startsWith(managedPath)) { + const managedItem = getManagedItem(managedPath, child); + if (managedItem) { + // construct timestampHash from managed info + return this.managedItemQueue.add(managedItem, (err, info) => { + if (err) return callback(err); + return callback(null, fromManagedItem(info)); + }); + } + } } + + lstatReadlinkAbsolute(this.fs, child, (err, stat) => { + if (err) return callback(err); + + if (typeof stat === "string") { + return fromSymlink(child, stat, callback); + } + + if (stat.isFile()) { + return fromFile(child, stat, callback); + } + if (stat.isDirectory()) { + return fromDirectory(child, stat, callback); + } + callback(null, null); + }); }, - "ContextModuleFactory.hooks.alternatives has deprecated in favor of ContextModuleFactory.hooks.alternativeRequests with an additional options argument.", - "DEP_WEBPACK_CONTEXT_MODULE_FACTORY_ALTERNATIVES" - ), - alternativeRequests + (err, results) => { + if (err) return callback(err); + const result = reduce(files, results); + callback(null, result); + } + ); }); - this.resolverFactory = resolverFactory; } - /** - * @param {ModuleFactoryCreateData} data data object - * @param {function(Error=, ModuleFactoryResult=): void} callback callback - * @returns {void} - */ - create(data, callback) { - const context = data.context; - const dependencies = data.dependencies; - const resolveOptions = data.resolveOptions; - const dependency = /** @type {ContextDependency} */ (dependencies[0]); - const fileDependencies = new LazySet(); - const missingDependencies = new LazySet(); - const contextDependencies = new LazySet(); - this.hooks.beforeResolve.callAsync( + _readContextTimestamp(path, callback) { + this._readContext( { - context: context, - dependencies: dependencies, - resolveOptions, - fileDependencies, - missingDependencies, - contextDependencies, - ...dependency.options - }, - (err, beforeResolveResult) => { - if (err) { - return callback(err, { - fileDependencies, - missingDependencies, - contextDependencies + path, + fromImmutablePath: () => null, + fromManagedItem: info => ({ + safeTime: 0, + timestampHash: info + }), + fromSymlink: (file, target, callback) => { + callback(null, { + timestampHash: target, + symlinks: new Set([target]) }); - } + }, + fromFile: (file, stat, callback) => { + // Prefer the cached value over our new stat to report consistent results + const cache = this._fileTimestamps.get(file); + if (cache !== undefined) + return callback(null, cache === "ignore" ? null : cache); - // Ignored - if (!beforeResolveResult) { - return callback(null, { - fileDependencies, - missingDependencies, - contextDependencies - }); - } + const mtime = +stat.mtime; - const context = beforeResolveResult.context; - const request = beforeResolveResult.request; - const resolveOptions = beforeResolveResult.resolveOptions; + if (mtime) applyMtime(mtime); - let loaders, - resource, - loadersPrefix = ""; - const idx = request.lastIndexOf("!"); - if (idx >= 0) { - let loadersRequest = request.substr(0, idx + 1); - let i; - for ( - i = 0; - i < loadersRequest.length && loadersRequest[i] === "!"; - i++ - ) { - loadersPrefix += "!"; - } - loadersRequest = loadersRequest - .substr(i) - .replace(/!+$/, "") - .replace(/!!+/g, "!"); - if (loadersRequest === "") { - loaders = []; - } else { - loaders = loadersRequest.split("!"); - } - resource = request.substr(idx + 1); - } else { - loaders = []; - resource = request; - } + const ts = { + safeTime: mtime ? mtime + FS_ACCURACY : Infinity, + timestamp: mtime + }; - const contextResolver = this.resolverFactory.get( - "context", - dependencies.length > 0 - ? cachedSetProperty( - resolveOptions || EMPTY_RESOLVE_OPTIONS, - "dependencyType", - dependencies[0].category - ) - : resolveOptions - ); - const loaderResolver = this.resolverFactory.get("loader"); + this._fileTimestamps.set(file, ts); + this._cachedDeprecatedFileTimestamps = undefined; + callback(null, ts); + }, + fromDirectory: (directory, stat, callback) => { + this.contextTimestampQueue.increaseParallelism(); + this._getUnresolvedContextTimestamp(directory, (err, tsEntry) => { + this.contextTimestampQueue.decreaseParallelism(); + callback(err, tsEntry); + }); + }, + reduce: (files, tsEntries) => { + let symlinks = undefined; - asyncLib.parallel( - [ - callback => { - contextResolver.resolve( - {}, - context, - resource, - { - fileDependencies, - missingDependencies, - contextDependencies - }, - (err, result) => { - if (err) return callback(err); - callback(null, result); - } - ); - }, - callback => { - asyncLib.map( - loaders, - (loader, callback) => { - loaderResolver.resolve( - {}, - context, - loader, - { - fileDependencies, - missingDependencies, - contextDependencies - }, - (err, result) => { - if (err) return callback(err); - callback(null, result); - } - ); - }, - callback - ); + const hash = createHash(this._hashFunction); + + for (const file of files) hash.update(file); + let safeTime = 0; + for (const entry of tsEntries) { + if (!entry) { + hash.update("n"); + continue; } - ], - (err, result) => { - if (err) { - return callback(err, { - fileDependencies, - missingDependencies, - contextDependencies - }); + if (entry.timestamp) { + hash.update("f"); + hash.update(`${entry.timestamp}`); + } else if (entry.timestampHash) { + hash.update("d"); + hash.update(`${entry.timestampHash}`); + } + if (entry.symlinks !== undefined) { + if (symlinks === undefined) symlinks = new Set(); + addAll(entry.symlinks, symlinks); + } + if (entry.safeTime) { + safeTime = Math.max(safeTime, entry.safeTime); } + } - this.hooks.afterResolve.callAsync( - { - addon: - loadersPrefix + - result[1].join("!") + - (result[1].length > 0 ? "!" : ""), - resource: result[0], - resolveDependencies: this.resolveDependencies.bind(this), - ...beforeResolveResult - }, - (err, result) => { - if (err) { - return callback(err, { - fileDependencies, - missingDependencies, - contextDependencies - }); - } + const digest = /** @type {string} */ (hash.digest("hex")); - // Ignored - if (!result) { - return callback(null, { - fileDependencies, - missingDependencies, - contextDependencies - }); - } + const result = { + safeTime, + timestampHash: digest + }; + if (symlinks) result.symlinks = symlinks; + return result; + } + }, + (err, result) => { + if (err) return callback(err); + this._contextTimestamps.set(path, result); + this._cachedDeprecatedContextTimestamps = undefined; - return callback(null, { - module: new ContextModule(result.resolveDependencies, result), - fileDependencies, - missingDependencies, - contextDependencies - }); - } - ); - } - ); + callback(null, result); } ); } /** - * @param {InputFileSystem} fs file system - * @param {ContextModuleOptions} options options - * @param {ResolveDependenciesCallback} callback callback function + * @param {ContextFileSystemInfoEntry} entry entry + * @param {function((Error | null)=, ResolvedContextFileSystemInfoEntry=): void} callback callback * @returns {void} */ - resolveDependencies(fs, options, callback) { - const cmf = this; - const { - resource, - resourceQuery, - resourceFragment, - recursive, - regExp, - include, - exclude, - referencedExports, - category, - typePrefix - } = options; - if (!regExp || !resource) return callback(null, []); - - const addDirectoryChecked = (directory, visited, callback) => { - fs.realpath(directory, (err, realPath) => { - if (err) return callback(err); - if (visited.has(realPath)) return callback(null, []); - let recursionStack; - addDirectory( - directory, - (dir, callback) => { - if (recursionStack === undefined) { - recursionStack = new Set(visited); - recursionStack.add(realPath); + _resolveContextTimestamp(entry, callback) { + const hashes = []; + let safeTime = 0; + processAsyncTree( + entry.symlinks, + 10, + (target, push, callback) => { + this._getUnresolvedContextTimestamp(target, (err, entry) => { + if (err) return callback(err); + if (entry && entry !== "ignore") { + hashes.push(entry.timestampHash); + if (entry.safeTime) { + safeTime = Math.max(safeTime, entry.safeTime); } - addDirectoryChecked(dir, recursionStack, callback); - }, - callback + if (entry.symlinks !== undefined) { + for (const target of entry.symlinks) push(target); + } + } + callback(); + }); + }, + err => { + if (err) return callback(err); + const hash = createHash(this._hashFunction); + hash.update(entry.timestampHash); + if (entry.safeTime) { + safeTime = Math.max(safeTime, entry.safeTime); + } + hashes.sort(); + for (const h of hashes) { + hash.update(h); + } + callback( + null, + (entry.resolved = { + safeTime, + timestampHash: /** @type {string} */ (hash.digest("hex")) + }) ); - }); - }; + } + ); + } - const addDirectory = (directory, addSubDirectory, callback) => { - fs.readdir(directory, (err, files) => { + _readContextHash(path, callback) { + this._readContext( + { + path, + fromImmutablePath: () => "", + fromManagedItem: info => info || "", + fromSymlink: (file, target, callback) => { + callback(null, { + hash: target, + symlinks: new Set([target]) + }); + }, + fromFile: (file, stat, callback) => + this.getFileHash(file, (err, hash) => { + callback(err, hash || ""); + }), + fromDirectory: (directory, stat, callback) => { + this.contextHashQueue.increaseParallelism(); + this._getUnresolvedContextHash(directory, (err, hash) => { + this.contextHashQueue.decreaseParallelism(); + callback(err, hash || ""); + }); + }, + /** + * @param {string[]} files files + * @param {(string | ContextHash)[]} fileHashes hashes + * @returns {ContextHash} reduced hash + */ + reduce: (files, fileHashes) => { + let symlinks = undefined; + const hash = createHash(this._hashFunction); + + for (const file of files) hash.update(file); + for (const entry of fileHashes) { + if (typeof entry === "string") { + hash.update(entry); + } else { + hash.update(entry.hash); + if (entry.symlinks) { + if (symlinks === undefined) symlinks = new Set(); + addAll(entry.symlinks, symlinks); + } + } + } + + const result = { + hash: /** @type {string} */ (hash.digest("hex")) + }; + if (symlinks) result.symlinks = symlinks; + return result; + } + }, + (err, result) => { if (err) return callback(err); - const processedFiles = cmf.hooks.contextModuleFiles.call( - /** @type {string[]} */ (files).map(file => file.normalize("NFC")) + this._contextHashes.set(path, result); + return callback(null, result); + } + ); + } + + /** + * @param {ContextHash} entry context hash + * @param {function((Error | null)=, string=): void} callback callback + * @returns {void} + */ + _resolveContextHash(entry, callback) { + const hashes = []; + processAsyncTree( + entry.symlinks, + 10, + (target, push, callback) => { + this._getUnresolvedContextHash(target, (err, hash) => { + if (err) return callback(err); + if (hash) { + hashes.push(hash.hash); + if (hash.symlinks !== undefined) { + for (const target of hash.symlinks) push(target); + } + } + callback(); + }); + }, + err => { + if (err) return callback(err); + const hash = createHash(this._hashFunction); + hash.update(entry.hash); + hashes.sort(); + for (const h of hashes) { + hash.update(h); + } + callback( + null, + (entry.resolved = /** @type {string} */ (hash.digest("hex"))) ); - if (!processedFiles || processedFiles.length === 0) - return callback(null, []); - asyncLib.map( - processedFiles.filter(p => p.indexOf(".") !== 0), - (segment, callback) => { - const subResource = join(fs, directory, segment); + } + ); + } - if (!exclude || !subResource.match(exclude)) { - fs.stat(subResource, (err, stat) => { - if (err) { - if (err.code === "ENOENT") { - // ENOENT is ok here because the file may have been deleted between - // the readdir and stat calls. - return callback(); - } else { - return callback(err); - } - } + _readContextTimestampAndHash(path, callback) { + const finalize = (timestamp, hash) => { + const result = + timestamp === "ignore" + ? hash + : { + ...timestamp, + ...hash + }; + this._contextTshs.set(path, result); + callback(null, result); + }; + const cachedHash = this._contextHashes.get(path); + const cachedTimestamp = this._contextTimestamps.get(path); + if (cachedHash !== undefined) { + if (cachedTimestamp !== undefined) { + finalize(cachedTimestamp, cachedHash); + } else { + this.contextTimestampQueue.add(path, (err, entry) => { + if (err) return callback(err); + finalize(entry, cachedHash); + }); + } + } else { + if (cachedTimestamp !== undefined) { + this.contextHashQueue.add(path, (err, entry) => { + if (err) return callback(err); + finalize(cachedTimestamp, entry); + }); + } else { + this._readContext( + { + path, + fromImmutablePath: () => null, + fromManagedItem: info => ({ + safeTime: 0, + timestampHash: info, + hash: info || "" + }), + fromSymlink: (fle, target, callback) => { + callback(null, { + timestampHash: target, + hash: target, + symlinks: new Set([target]) + }); + }, + fromFile: (file, stat, callback) => { + this._getFileTimestampAndHash(file, callback); + }, + fromDirectory: (directory, stat, callback) => { + this.contextTshQueue.increaseParallelism(); + this.contextTshQueue.add(directory, (err, result) => { + this.contextTshQueue.decreaseParallelism(); + callback(err, result); + }); + }, + /** + * @param {string[]} files files + * @param {(Partial & Partial | string | null)[]} results results + * @returns {ContextTimestampAndHash} tsh + */ + reduce: (files, results) => { + let symlinks = undefined; - if (stat.isDirectory()) { - if (!recursive) return callback(); - addSubDirectory(subResource, callback); - } else if ( - stat.isFile() && - (!include || subResource.match(include)) - ) { - const obj = { - context: resource, - request: - "." + - subResource.substr(resource.length).replace(/\\/g, "/") - }; + const tsHash = createHash(this._hashFunction); + const hash = createHash(this._hashFunction); - this.hooks.alternativeRequests.callAsync( - [obj], - options, - (err, alternatives) => { - if (err) return callback(err); - alternatives = alternatives - .filter(obj => regExp.test(obj.request)) - .map(obj => { - const dep = new ContextElementDependency( - obj.request + resourceQuery + resourceFragment, - obj.request, - typePrefix, - category, - referencedExports - ); - dep.optional = true; - return dep; - }); - callback(null, alternatives); - } - ); - } else { - callback(); + for (const file of files) { + tsHash.update(file); + hash.update(file); + } + let safeTime = 0; + for (const entry of results) { + if (!entry) { + tsHash.update("n"); + continue; } - }); - } else { - callback(); + if (typeof entry === "string") { + tsHash.update("n"); + hash.update(entry); + continue; + } + if (entry.timestamp) { + tsHash.update("f"); + tsHash.update(`${entry.timestamp}`); + } else if (entry.timestampHash) { + tsHash.update("d"); + tsHash.update(`${entry.timestampHash}`); + } + if (entry.symlinks !== undefined) { + if (symlinks === undefined) symlinks = new Set(); + addAll(entry.symlinks, symlinks); + } + if (entry.safeTime) { + safeTime = Math.max(safeTime, entry.safeTime); + } + hash.update(entry.hash); + } + + const result = { + safeTime, + timestampHash: /** @type {string} */ (tsHash.digest("hex")), + hash: /** @type {string} */ (hash.digest("hex")) + }; + if (symlinks) result.symlinks = symlinks; + return result; } }, (err, result) => { if (err) return callback(err); + this._contextTshs.set(path, result); + return callback(null, result); + } + ); + } + } + } - if (!result) return callback(null, []); + /** + * @param {ContextTimestampAndHash} entry entry + * @param {function((Error | null)=, ResolvedContextTimestampAndHash=): void} callback callback + * @returns {void} + */ + _resolveContextTsh(entry, callback) { + const hashes = []; + const tsHashes = []; + let safeTime = 0; + processAsyncTree( + entry.symlinks, + 10, + (target, push, callback) => { + this._getUnresolvedContextTsh(target, (err, entry) => { + if (err) return callback(err); + if (entry) { + hashes.push(entry.hash); + if (entry.timestampHash) tsHashes.push(entry.timestampHash); + if (entry.safeTime) { + safeTime = Math.max(safeTime, entry.safeTime); + } + if (entry.symlinks !== undefined) { + for (const target of entry.symlinks) push(target); + } + } + callback(); + }); + }, + err => { + if (err) return callback(err); + const hash = createHash(this._hashFunction); + const tsHash = createHash(this._hashFunction); + hash.update(entry.hash); + if (entry.timestampHash) tsHash.update(entry.timestampHash); + if (entry.safeTime) { + safeTime = Math.max(safeTime, entry.safeTime); + } + hashes.sort(); + for (const h of hashes) { + hash.update(h); + } + tsHashes.sort(); + for (const h of tsHashes) { + tsHash.update(h); + } + callback( + null, + (entry.resolved = { + safeTime, + timestampHash: /** @type {string} */ (tsHash.digest("hex")), + hash: /** @type {string} */ (hash.digest("hex")) + }) + ); + } + ); + } - const flattenedResult = []; + _getManagedItemDirectoryInfo(path, callback) { + this.fs.readdir(path, (err, elements) => { + if (err) { + if (err.code === "ENOENT" || err.code === "ENOTDIR") { + return callback(null, EMPTY_SET); + } + return callback(err); + } + const set = new Set( + /** @type {string[]} */ (elements).map(element => + join(this.fs, path, element) + ) + ); + callback(null, set); + }); + } - for (const item of result) { - if (item) flattenedResult.push(...item); - } + _getManagedItemInfo(path, callback) { + const dir = dirname(this.fs, path); + this.managedItemDirectoryQueue.add(dir, (err, elements) => { + if (err) { + return callback(err); + } + if (!elements.has(path)) { + // file or directory doesn't exist + this._managedItems.set(path, "*missing"); + return callback(null, "*missing"); + } + // something exists + // it may be a file or directory + if ( + path.endsWith("node_modules") && + (path.endsWith("/node_modules") || path.endsWith("\\node_modules")) + ) { + // we are only interested in existence of this special directory + this._managedItems.set(path, "*node_modules"); + return callback(null, "*node_modules"); + } - callback(null, flattenedResult); + // we assume it's a directory, as files shouldn't occur in managed paths + const packageJsonPath = join(this.fs, path, "package.json"); + this.fs.readFile(packageJsonPath, (err, content) => { + if (err) { + if (err.code === "ENOENT" || err.code === "ENOTDIR") { + // no package.json or path is not a directory + this.fs.readdir(path, (err, elements) => { + if ( + !err && + elements.length === 1 && + elements[0] === "node_modules" + ) { + // This is only a grouping folder e. g. used by yarn + // we are only interested in existence of this special directory + this._managedItems.set(path, "*nested"); + return callback(null, "*nested"); + } + this.logger.warn( + `Managed item ${path} isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)` + ); + return callback(); + }); + return; } - ); + return callback(err); + } + let data; + try { + data = JSON.parse(content.toString("utf-8")); + } catch (e) { + return callback(e); + } + if (!data.name) { + this.logger.warn( + `${packageJsonPath} doesn't contain a "name" property (see snapshot.managedPaths option)` + ); + return callback(); + } + const info = `${data.name || ""}@${data.version || ""}`; + this._managedItems.set(path, info); + callback(null, info); }); - }; + }); + } - if (typeof fs.realpath === "function") { - addDirectoryChecked(resource, new Set(), callback); - } else { - const addSubDirectory = (dir, callback) => - addDirectory(dir, addSubDirectory, callback); - addDirectory(resource, addSubDirectory, callback); + getDeprecatedFileTimestamps() { + if (this._cachedDeprecatedFileTimestamps !== undefined) + return this._cachedDeprecatedFileTimestamps; + const map = new Map(); + for (const [path, info] of this._fileTimestamps) { + if (info) map.set(path, typeof info === "object" ? info.safeTime : null); } + return (this._cachedDeprecatedFileTimestamps = map); } -}; + + getDeprecatedContextTimestamps() { + if (this._cachedDeprecatedContextTimestamps !== undefined) + return this._cachedDeprecatedContextTimestamps; + const map = new Map(); + for (const [path, info] of this._contextTimestamps) { + if (info) map.set(path, typeof info === "object" ? info.safeTime : null); + } + return (this._cachedDeprecatedContextTimestamps = map); + } +} + +module.exports = FileSystemInfo; +module.exports.Snapshot = Snapshot; /***/ }), -/***/ 12206: +/***/ 58727: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -38381,161 +40553,59 @@ module.exports = class ContextModuleFactory extends ModuleFactory { -const ContextElementDependency = __webpack_require__(58477); -const { join } = __webpack_require__(17139); +const { getEntryRuntime, mergeRuntimeOwned } = __webpack_require__(17156); -class ContextReplacementPlugin { - constructor( - resourceRegExp, - newContentResource, - newContentRecursive, - newContentRegExp - ) { - this.resourceRegExp = resourceRegExp; +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - if (typeof newContentResource === "function") { - this.newContentCallback = newContentResource; - } else if ( - typeof newContentResource === "string" && - typeof newContentRecursive === "object" - ) { - this.newContentResource = newContentResource; - this.newContentCreateContextMap = (fs, callback) => { - callback(null, newContentRecursive); - }; - } else if ( - typeof newContentResource === "string" && - typeof newContentRecursive === "function" - ) { - this.newContentResource = newContentResource; - this.newContentCreateContextMap = newContentRecursive; - } else { - if (typeof newContentResource !== "string") { - newContentRegExp = newContentRecursive; - newContentRecursive = newContentResource; - newContentResource = undefined; - } - if (typeof newContentRecursive !== "boolean") { - newContentRegExp = newContentRecursive; - newContentRecursive = undefined; - } - this.newContentResource = newContentResource; - this.newContentRecursive = newContentRecursive; - this.newContentRegExp = newContentRegExp; - } +class FlagAllModulesAsUsedPlugin { + constructor(explanation) { + this.explanation = explanation; } + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ apply(compiler) { - const resourceRegExp = this.resourceRegExp; - const newContentCallback = this.newContentCallback; - const newContentResource = this.newContentResource; - const newContentRecursive = this.newContentRecursive; - const newContentRegExp = this.newContentRegExp; - const newContentCreateContextMap = this.newContentCreateContextMap; - - compiler.hooks.contextModuleFactory.tap("ContextReplacementPlugin", cmf => { - cmf.hooks.beforeResolve.tap("ContextReplacementPlugin", result => { - if (!result) return; - if (resourceRegExp.test(result.request)) { - if (newContentResource !== undefined) { - result.request = newContentResource; - } - if (newContentRecursive !== undefined) { - result.recursive = newContentRecursive; - } - if (newContentRegExp !== undefined) { - result.regExp = newContentRegExp; - } - if (typeof newContentCallback === "function") { - newContentCallback(result); - } else { - for (const d of result.dependencies) { - if (d.critical) d.critical = false; - } - } - } - return result; - }); - cmf.hooks.afterResolve.tap("ContextReplacementPlugin", result => { - if (!result) return; - if (resourceRegExp.test(result.resource)) { - if (newContentResource !== undefined) { - if ( - newContentResource.startsWith("/") || - (newContentResource.length > 1 && newContentResource[1] === ":") - ) { - result.resource = newContentResource; - } else { - result.resource = join( - compiler.inputFileSystem, - result.resource, - newContentResource - ); - } - } - if (newContentRecursive !== undefined) { - result.recursive = newContentRecursive; - } - if (newContentRegExp !== undefined) { - result.regExp = newContentRegExp; - } - if (typeof newContentCreateContextMap === "function") { - result.resolveDependencies = - createResolveDependenciesFromContextMap( - newContentCreateContextMap - ); - } - if (typeof newContentCallback === "function") { - const origResource = result.resource; - newContentCallback(result); - if ( - result.resource !== origResource && - !result.resource.startsWith("/") && - (result.resource.length <= 1 || result.resource[1] !== ":") - ) { - // When the function changed it to an relative path - result.resource = join( - compiler.inputFileSystem, - origResource, - result.resource + compiler.hooks.compilation.tap( + "FlagAllModulesAsUsedPlugin", + compilation => { + const moduleGraph = compilation.moduleGraph; + compilation.hooks.optimizeDependencies.tap( + "FlagAllModulesAsUsedPlugin", + modules => { + /** @type {RuntimeSpec} */ + let runtime = undefined; + for (const [name, { options }] of compilation.entries) { + runtime = mergeRuntimeOwned( + runtime, + getEntryRuntime(compilation, name, options) ); } - } else { - for (const d of result.dependencies) { - if (d.critical) d.critical = false; + for (const module of modules) { + const exportsInfo = moduleGraph.getExportsInfo(module); + exportsInfo.setUsedInUnknownWay(runtime); + moduleGraph.addExtraReason(module, this.explanation); + if (module.factoryMeta === undefined) { + module.factoryMeta = {}; + } + module.factoryMeta.sideEffectFree = false; } } - } - return result; - }); - }); + ); + } + ); } } -const createResolveDependenciesFromContextMap = createContextMap => { - const resolveDependenciesFromContextMap = (fs, options, callback) => { - createContextMap(fs, (err, map) => { - if (err) return callback(err); - const dependencies = Object.keys(map).map(key => { - return new ContextElementDependency( - map[key] + options.resourceQuery + options.resourceFragment, - key, - options.category, - options.referencedExports - ); - }); - callback(null, dependencies); - }); - }; - return resolveDependenciesFromContextMap; -}; - -module.exports = ContextReplacementPlugin; +module.exports = FlagAllModulesAsUsedPlugin; /***/ }), -/***/ 79065: +/***/ 84506: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -38546,1002 +40616,421 @@ module.exports = ContextReplacementPlugin; -const RuntimeGlobals = __webpack_require__(16475); -const WebpackError = __webpack_require__(53799); -const ConstDependency = __webpack_require__(76911); -const BasicEvaluatedExpression = __webpack_require__(950); -const { - evaluateToString, - toConstantDependency -} = __webpack_require__(93998); -const createHash = __webpack_require__(49835); +const asyncLib = __webpack_require__(78175); +const Queue = __webpack_require__(65930); -/** @typedef {import("estree").Expression} Expression */ /** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./NormalModule")} NormalModule */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ - -/** @typedef {null|undefined|RegExp|Function|string|number|boolean|bigint|undefined} CodeValuePrimitive */ -/** @typedef {RecursiveArrayOrRecord} CodeValue */ - -/** - * @typedef {Object} RuntimeValueOptions - * @property {string[]=} fileDependencies - * @property {string[]=} contextDependencies - * @property {string[]=} missingDependencies - * @property {string[]=} buildDependencies - * @property {string|function(): string=} version - */ - -class RuntimeValue { - /** - * @param {function({ module: NormalModule, key: string, readonly version: string | undefined }): CodeValuePrimitive} fn generator function - * @param {true | string[] | RuntimeValueOptions=} options options - */ - constructor(fn, options) { - this.fn = fn; - if (Array.isArray(options)) { - options = { - fileDependencies: options - }; - } - this.options = options || {}; - } - - get fileDependencies() { - return this.options === true ? true : this.options.fileDependencies; - } +/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./Dependency").ExportSpec} ExportSpec */ +/** @typedef {import("./Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("./ExportsInfo")} ExportsInfo */ +/** @typedef {import("./Module")} Module */ +class FlagDependencyExportsPlugin { /** - * @param {JavascriptParser} parser the parser - * @param {Map>} valueCacheVersions valueCacheVersions - * @param {string} key the defined key - * @returns {CodeValuePrimitive} code + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - exec(parser, valueCacheVersions, key) { - const buildInfo = parser.state.module.buildInfo; - if (this.options === true) { - buildInfo.cacheable = false; - } else { - if (this.options.fileDependencies) { - for (const dep of this.options.fileDependencies) { - buildInfo.fileDependencies.add(dep); - } - } - if (this.options.contextDependencies) { - for (const dep of this.options.contextDependencies) { - buildInfo.contextDependencies.add(dep); - } - } - if (this.options.missingDependencies) { - for (const dep of this.options.missingDependencies) { - buildInfo.missingDependencies.add(dep); - } - } - if (this.options.buildDependencies) { - for (const dep of this.options.buildDependencies) { - buildInfo.buildDependencies.add(dep); - } - } - } + apply(compiler) { + compiler.hooks.compilation.tap( + "FlagDependencyExportsPlugin", + compilation => { + const moduleGraph = compilation.moduleGraph; + const cache = compilation.getCache("FlagDependencyExportsPlugin"); + compilation.hooks.finishModules.tapAsync( + "FlagDependencyExportsPlugin", + (modules, callback) => { + const logger = compilation.getLogger( + "webpack.FlagDependencyExportsPlugin" + ); + let statRestoredFromMemCache = 0; + let statRestoredFromCache = 0; + let statNoExports = 0; + let statFlaggedUncached = 0; + let statNotCached = 0; + let statQueueItemsProcessed = 0; - return this.fn({ - module: parser.state.module, - key, - get version() { - return /** @type {string} */ ( - valueCacheVersions.get(VALUE_DEP_PREFIX + key) - ); - } - }); - } + const { moduleMemCaches } = compilation; - getCacheVersion() { - return this.options === true - ? undefined - : (typeof this.options.version === "function" - ? this.options.version() - : this.options.version) || "unset"; - } -} + /** @type {Queue} */ + const queue = new Queue(); -/** - * @param {any[]|{[k: string]: any}} obj obj - * @param {JavascriptParser} parser Parser - * @param {Map>} valueCacheVersions valueCacheVersions - * @param {string} key the defined key - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @param {boolean|undefined|null=} asiSafe asi safe (undefined: unknown, null: unneeded) - * @returns {string} code converted to string that evaluates - */ -const stringifyObj = ( - obj, - parser, - valueCacheVersions, - key, - runtimeTemplate, - asiSafe -) => { - let code; - let arr = Array.isArray(obj); - if (arr) { - code = `[${obj - .map(code => - toCode(code, parser, valueCacheVersions, key, runtimeTemplate, null) - ) - .join(",")}]`; - } else { - code = `{${Object.keys(obj) - .map(key => { - const code = obj[key]; - return ( - JSON.stringify(key) + - ":" + - toCode(code, parser, valueCacheVersions, key, runtimeTemplate, null) - ); - }) - .join(",")}}`; - } + // Step 1: Try to restore cached provided export info from cache + logger.time("restore cached provided exports"); + asyncLib.each( + modules, + (module, callback) => { + const exportsInfo = moduleGraph.getExportsInfo(module); + if (!module.buildMeta || !module.buildMeta.exportsType) { + if (exportsInfo.otherExportsInfo.provided !== null) { + // It's a module without declared exports + statNoExports++; + exportsInfo.setHasProvideInfo(); + exportsInfo.setUnknownExportsProvided(); + return callback(); + } + } + if (typeof module.buildInfo.hash !== "string") { + statFlaggedUncached++; + // Enqueue uncacheable module for determining the exports + queue.enqueue(module); + exportsInfo.setHasProvideInfo(); + return callback(); + } + const memCache = moduleMemCaches && moduleMemCaches.get(module); + const memCacheValue = memCache && memCache.get(this); + if (memCacheValue !== undefined) { + statRestoredFromMemCache++; + exportsInfo.restoreProvided(memCacheValue); + return callback(); + } + cache.get( + module.identifier(), + module.buildInfo.hash, + (err, result) => { + if (err) return callback(err); - switch (asiSafe) { - case null: - return code; - case true: - return arr ? code : `(${code})`; - case false: - return arr ? `;${code}` : `;(${code})`; - default: - return `/*#__PURE__*/Object(${code})`; - } -}; + if (result !== undefined) { + statRestoredFromCache++; + exportsInfo.restoreProvided(result); + } else { + statNotCached++; + // Without cached info enqueue module for determining the exports + queue.enqueue(module); + exportsInfo.setHasProvideInfo(); + } + callback(); + } + ); + }, + err => { + logger.timeEnd("restore cached provided exports"); + if (err) return callback(err); -/** - * Convert code to a string that evaluates - * @param {CodeValue} code Code to evaluate - * @param {JavascriptParser} parser Parser - * @param {Map>} valueCacheVersions valueCacheVersions - * @param {string} key the defined key - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @param {boolean|undefined|null=} asiSafe asi safe (undefined: unknown, null: unneeded) - * @returns {string} code converted to string that evaluates - */ -const toCode = ( - code, - parser, - valueCacheVersions, - key, - runtimeTemplate, - asiSafe -) => { - if (code === null) { - return "null"; - } - if (code === undefined) { - return "undefined"; - } - if (Object.is(code, -0)) { - return "-0"; - } - if (code instanceof RuntimeValue) { - return toCode( - code.exec(parser, valueCacheVersions, key), - parser, - valueCacheVersions, - key, - runtimeTemplate, - asiSafe - ); - } - if (code instanceof RegExp && code.toString) { - return code.toString(); - } - if (typeof code === "function" && code.toString) { - return "(" + code.toString() + ")"; - } - if (typeof code === "object") { - return stringifyObj( - code, - parser, - valueCacheVersions, - key, - runtimeTemplate, - asiSafe - ); - } - if (typeof code === "bigint") { - return runtimeTemplate.supportsBigIntLiteral() - ? `${code}n` - : `BigInt("${code}")`; - } - return code + ""; -}; + /** @type {Set} */ + const modulesToStore = new Set(); -const toCacheVersion = code => { - if (code === null) { - return "null"; - } - if (code === undefined) { - return "undefined"; - } - if (Object.is(code, -0)) { - return "-0"; - } - if (code instanceof RuntimeValue) { - return code.getCacheVersion(); - } - if (code instanceof RegExp && code.toString) { - return code.toString(); - } - if (typeof code === "function" && code.toString) { - return "(" + code.toString() + ")"; - } - if (typeof code === "object") { - const items = Object.keys(code).map(key => ({ - key, - value: toCacheVersion(code[key]) - })); - if (items.some(({ value }) => value === undefined)) return undefined; - return `{${items.map(({ key, value }) => `${key}: ${value}`).join(", ")}}`; - } - if (typeof code === "bigint") { - return `${code}n`; - } - return code + ""; -}; + /** @type {Map>} */ + const dependencies = new Map(); -const VALUE_DEP_PREFIX = "webpack/DefinePlugin "; -const VALUE_DEP_MAIN = "webpack/DefinePlugin_hash"; + /** @type {Module} */ + let module; -class DefinePlugin { - /** - * Create a new define plugin - * @param {Record} definitions A map of global object definitions - */ - constructor(definitions) { - this.definitions = definitions; - } + /** @type {ExportsInfo} */ + let exportsInfo; - /** - * @param {function({ module: NormalModule, key: string, readonly version: string | undefined }): CodeValuePrimitive} fn generator function - * @param {true | string[] | RuntimeValueOptions=} options options - * @returns {RuntimeValue} runtime value - */ - static runtimeValue(fn, options) { - return new RuntimeValue(fn, options); - } + /** @type {Map} */ + const exportsSpecsFromDependencies = new Map(); - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const definitions = this.definitions; - compiler.hooks.compilation.tap( - "DefinePlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyTemplates.set( - ConstDependency, - new ConstDependency.Template() - ); - const { runtimeTemplate } = compilation; + let cacheable = true; + let changed = false; - const mainHash = createHash(compilation.outputOptions.hashFunction); - mainHash.update( - /** @type {string} */ ( - compilation.valueCacheVersions.get(VALUE_DEP_MAIN) - ) || "" - ); + /** + * @param {DependenciesBlock} depBlock the dependencies block + * @returns {void} + */ + const processDependenciesBlock = depBlock => { + for (const dep of depBlock.dependencies) { + processDependency(dep); + } + for (const block of depBlock.blocks) { + processDependenciesBlock(block); + } + }; - /** - * Handler - * @param {JavascriptParser} parser Parser - * @returns {void} - */ - const handler = parser => { - const mainValue = compilation.valueCacheVersions.get(VALUE_DEP_MAIN); - parser.hooks.program.tap("DefinePlugin", () => { - const { buildInfo } = parser.state.module; - if (!buildInfo.valueDependencies) - buildInfo.valueDependencies = new Map(); - buildInfo.valueDependencies.set(VALUE_DEP_MAIN, mainValue); - }); + /** + * @param {Dependency} dep the dependency + * @returns {void} + */ + const processDependency = dep => { + const exportDesc = dep.getExports(moduleGraph); + if (!exportDesc) return; + exportsSpecsFromDependencies.set(dep, exportDesc); + }; - const addValueDependency = key => { - const { buildInfo } = parser.state.module; - buildInfo.valueDependencies.set( - VALUE_DEP_PREFIX + key, - compilation.valueCacheVersions.get(VALUE_DEP_PREFIX + key) - ); - }; + /** + * @param {Dependency} dep dependency + * @param {ExportsSpec} exportDesc info + * @returns {void} + */ + const processExportsSpec = (dep, exportDesc) => { + const exports = exportDesc.exports; + const globalCanMangle = exportDesc.canMangle; + const globalFrom = exportDesc.from; + const globalPriority = exportDesc.priority; + const globalTerminalBinding = + exportDesc.terminalBinding || false; + const exportDeps = exportDesc.dependencies; + if (exportDesc.hideExports) { + for (const name of exportDesc.hideExports) { + const exportInfo = exportsInfo.getExportInfo(name); + exportInfo.unsetTarget(dep); + } + } + if (exports === true) { + // unknown exports + if ( + exportsInfo.setUnknownExportsProvided( + globalCanMangle, + exportDesc.excludeExports, + globalFrom && dep, + globalFrom, + globalPriority + ) + ) { + changed = true; + } + } else if (Array.isArray(exports)) { + /** + * merge in new exports + * @param {ExportsInfo} exportsInfo own exports info + * @param {(ExportSpec | string)[]} exports list of exports + */ + const mergeExports = (exportsInfo, exports) => { + for (const exportNameOrSpec of exports) { + let name; + let canMangle = globalCanMangle; + let terminalBinding = globalTerminalBinding; + let exports = undefined; + let from = globalFrom; + let fromExport = undefined; + let priority = globalPriority; + let hidden = false; + if (typeof exportNameOrSpec === "string") { + name = exportNameOrSpec; + } else { + name = exportNameOrSpec.name; + if (exportNameOrSpec.canMangle !== undefined) + canMangle = exportNameOrSpec.canMangle; + if (exportNameOrSpec.export !== undefined) + fromExport = exportNameOrSpec.export; + if (exportNameOrSpec.exports !== undefined) + exports = exportNameOrSpec.exports; + if (exportNameOrSpec.from !== undefined) + from = exportNameOrSpec.from; + if (exportNameOrSpec.priority !== undefined) + priority = exportNameOrSpec.priority; + if (exportNameOrSpec.terminalBinding !== undefined) + terminalBinding = exportNameOrSpec.terminalBinding; + if (exportNameOrSpec.hidden !== undefined) + hidden = exportNameOrSpec.hidden; + } + const exportInfo = exportsInfo.getExportInfo(name); - const withValueDependency = - (key, fn) => - (...args) => { - addValueDependency(key); - return fn(...args); - }; + if ( + exportInfo.provided === false || + exportInfo.provided === null + ) { + exportInfo.provided = true; + changed = true; + } - /** - * Walk definitions - * @param {Object} definitions Definitions map - * @param {string} prefix Prefix string - * @returns {void} - */ - const walkDefinitions = (definitions, prefix) => { - Object.keys(definitions).forEach(key => { - const code = definitions[key]; - if ( - code && - typeof code === "object" && - !(code instanceof RuntimeValue) && - !(code instanceof RegExp) - ) { - walkDefinitions(code, prefix + key + "."); - applyObjectDefine(prefix + key, code); - return; - } - applyDefineKey(prefix, key); - applyDefine(prefix + key, code); - }); - }; + if ( + exportInfo.canMangleProvide !== false && + canMangle === false + ) { + exportInfo.canMangleProvide = false; + changed = true; + } - /** - * Apply define key - * @param {string} prefix Prefix - * @param {string} key Key - * @returns {void} - */ - const applyDefineKey = (prefix, key) => { - const splittedKey = key.split("."); - splittedKey.slice(1).forEach((_, i) => { - const fullKey = prefix + splittedKey.slice(0, i + 1).join("."); - parser.hooks.canRename.for(fullKey).tap("DefinePlugin", () => { - addValueDependency(key); - return true; - }); - }); - }; + if (terminalBinding && !exportInfo.terminalBinding) { + exportInfo.terminalBinding = true; + changed = true; + } - /** - * Apply Code - * @param {string} key Key - * @param {CodeValue} code Code - * @returns {void} - */ - const applyDefine = (key, code) => { - const originalKey = key; - const isTypeof = /^typeof\s+/.test(key); - if (isTypeof) key = key.replace(/^typeof\s+/, ""); - let recurse = false; - let recurseTypeof = false; - if (!isTypeof) { - parser.hooks.canRename.for(key).tap("DefinePlugin", () => { - addValueDependency(originalKey); - return true; - }); - parser.hooks.evaluateIdentifier - .for(key) - .tap("DefinePlugin", expr => { - /** - * this is needed in case there is a recursion in the DefinePlugin - * to prevent an endless recursion - * e.g.: new DefinePlugin({ - * "a": "b", - * "b": "a" - * }); - */ - if (recurse) return; - addValueDependency(originalKey); - recurse = true; - const res = parser.evaluate( - toCode( - code, - parser, - compilation.valueCacheVersions, - key, - runtimeTemplate, - null - ) - ); - recurse = false; - res.setRange(expr.range); - return res; - }); - parser.hooks.expression.for(key).tap("DefinePlugin", expr => { - addValueDependency(originalKey); - const strCode = toCode( - code, - parser, - compilation.valueCacheVersions, - originalKey, - runtimeTemplate, - !parser.isAsiPosition(expr.range[0]) - ); - if (/__webpack_require__\s*(!?\.)/.test(strCode)) { - return toConstantDependency(parser, strCode, [ - RuntimeGlobals.require - ])(expr); - } else if (/__webpack_require__/.test(strCode)) { - return toConstantDependency(parser, strCode, [ - RuntimeGlobals.requireScope - ])(expr); - } else { - return toConstantDependency(parser, strCode)(expr); - } - }); - } - parser.hooks.evaluateTypeof.for(key).tap("DefinePlugin", expr => { - /** - * this is needed in case there is a recursion in the DefinePlugin - * to prevent an endless recursion - * e.g.: new DefinePlugin({ - * "typeof a": "typeof b", - * "typeof b": "typeof a" - * }); - */ - if (recurseTypeof) return; - recurseTypeof = true; - addValueDependency(originalKey); - const codeCode = toCode( - code, - parser, - compilation.valueCacheVersions, - originalKey, - runtimeTemplate, - null - ); - const typeofCode = isTypeof - ? codeCode - : "typeof (" + codeCode + ")"; - const res = parser.evaluate(typeofCode); - recurseTypeof = false; - res.setRange(expr.range); - return res; - }); - parser.hooks.typeof.for(key).tap("DefinePlugin", expr => { - addValueDependency(originalKey); - const codeCode = toCode( - code, - parser, - compilation.valueCacheVersions, - originalKey, - runtimeTemplate, - null - ); - const typeofCode = isTypeof - ? codeCode - : "typeof (" + codeCode + ")"; - const res = parser.evaluate(typeofCode); - if (!res.isString()) return; - return toConstantDependency( - parser, - JSON.stringify(res.string) - ).bind(parser)(expr); - }); - }; + if (exports) { + const nestedExportsInfo = + exportInfo.createNestedExportsInfo(); + mergeExports(nestedExportsInfo, exports); + } - /** - * Apply Object - * @param {string} key Key - * @param {Object} obj Object - * @returns {void} - */ - const applyObjectDefine = (key, obj) => { - parser.hooks.canRename.for(key).tap("DefinePlugin", () => { - addValueDependency(key); - return true; - }); - parser.hooks.evaluateIdentifier - .for(key) - .tap("DefinePlugin", expr => { - addValueDependency(key); - return new BasicEvaluatedExpression() - .setTruthy() - .setSideEffects(false) - .setRange(expr.range); - }); - parser.hooks.evaluateTypeof - .for(key) - .tap( - "DefinePlugin", - withValueDependency(key, evaluateToString("object")) - ); - parser.hooks.expression.for(key).tap("DefinePlugin", expr => { - addValueDependency(key); - const strCode = stringifyObj( - obj, - parser, - compilation.valueCacheVersions, - key, - runtimeTemplate, - !parser.isAsiPosition(expr.range[0]) - ); + if ( + from && + (hidden + ? exportInfo.unsetTarget(dep) + : exportInfo.setTarget( + dep, + from, + fromExport === undefined ? [name] : fromExport, + priority + )) + ) { + changed = true; + } - if (/__webpack_require__\s*(!?\.)/.test(strCode)) { - return toConstantDependency(parser, strCode, [ - RuntimeGlobals.require - ])(expr); - } else if (/__webpack_require__/.test(strCode)) { - return toConstantDependency(parser, strCode, [ - RuntimeGlobals.requireScope - ])(expr); - } else { - return toConstantDependency(parser, strCode)(expr); - } - }); - parser.hooks.typeof - .for(key) - .tap( - "DefinePlugin", - withValueDependency( - key, - toConstantDependency(parser, JSON.stringify("object")) - ) - ); - }; + // Recalculate target exportsInfo + const target = exportInfo.getTarget(moduleGraph); + let targetExportsInfo = undefined; + if (target) { + const targetModuleExportsInfo = + moduleGraph.getExportsInfo(target.module); + targetExportsInfo = + targetModuleExportsInfo.getNestedExportsInfo( + target.export + ); + // add dependency for this module + const set = dependencies.get(target.module); + if (set === undefined) { + dependencies.set(target.module, new Set([module])); + } else { + set.add(module); + } + } - walkDefinitions(definitions, ""); - }; + if (exportInfo.exportsInfoOwned) { + if ( + exportInfo.exportsInfo.setRedirectNamedTo( + targetExportsInfo + ) + ) { + changed = true; + } + } else if ( + exportInfo.exportsInfo !== targetExportsInfo + ) { + exportInfo.exportsInfo = targetExportsInfo; + changed = true; + } + } + }; + mergeExports(exportsInfo, exports); + } + // store dependencies + if (exportDeps) { + cacheable = false; + for (const exportDependency of exportDeps) { + // add dependency for this module + const set = dependencies.get(exportDependency); + if (set === undefined) { + dependencies.set(exportDependency, new Set([module])); + } else { + set.add(module); + } + } + } + }; - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("DefinePlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("DefinePlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("DefinePlugin", handler); + const notifyDependencies = () => { + const deps = dependencies.get(module); + if (deps !== undefined) { + for (const dep of deps) { + queue.enqueue(dep); + } + } + }; - /** - * Walk definitions - * @param {Object} definitions Definitions map - * @param {string} prefix Prefix string - * @returns {void} - */ - const walkDefinitionsForValues = (definitions, prefix) => { - Object.keys(definitions).forEach(key => { - const code = definitions[key]; - const version = toCacheVersion(code); - const name = VALUE_DEP_PREFIX + prefix + key; - mainHash.update("|" + prefix + key); - const oldVersion = compilation.valueCacheVersions.get(name); - if (oldVersion === undefined) { - compilation.valueCacheVersions.set(name, version); - } else if (oldVersion !== version) { - const warning = new WebpackError( - `DefinePlugin\nConflicting values for '${prefix + key}'` - ); - warning.details = `'${oldVersion}' !== '${version}'`; - warning.hideStack = true; - compilation.warnings.push(warning); - } - if ( - code && - typeof code === "object" && - !(code instanceof RuntimeValue) && - !(code instanceof RegExp) - ) { - walkDefinitionsForValues(code, prefix + key + "."); - } - }); - }; + logger.time("figure out provided exports"); + while (queue.length > 0) { + module = queue.dequeue(); - walkDefinitionsForValues(definitions, ""); + statQueueItemsProcessed++; - compilation.valueCacheVersions.set( - VALUE_DEP_MAIN, - /** @type {string} */ (mainHash.digest("hex").slice(0, 8)) - ); - } - ); - } -} -module.exports = DefinePlugin; + exportsInfo = moduleGraph.getExportsInfo(module); + cacheable = true; + changed = false; -/***/ }), + exportsSpecsFromDependencies.clear(); + moduleGraph.freeze(); + processDependenciesBlock(module); + moduleGraph.unfreeze(); + for (const [ + dep, + exportsSpec + ] of exportsSpecsFromDependencies) { + processExportsSpec(dep, exportsSpec); + } -/***/ 28623: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (cacheable) { + modulesToStore.add(module); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (changed) { + notifyDependencies(); + } + } + logger.timeEnd("figure out provided exports"); + logger.log( + `${Math.round( + (100 * (statFlaggedUncached + statNotCached)) / + (statRestoredFromMemCache + + statRestoredFromCache + + statNotCached + + statFlaggedUncached + + statNoExports) + )}% of exports of modules have been determined (${statNoExports} no declared exports, ${statNotCached} not cached, ${statFlaggedUncached} flagged uncacheable, ${statRestoredFromCache} from cache, ${statRestoredFromMemCache} from mem cache, ${ + statQueueItemsProcessed - + statNotCached - + statFlaggedUncached + } additional calculations due to dependencies)` + ); - -const { OriginalSource, RawSource } = __webpack_require__(51255); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const DelegatedSourceDependency = __webpack_require__(22914); -const StaticExportsDependency = __webpack_require__(91418); -const makeSerializable = __webpack_require__(33032); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./LibManifestPlugin").ManifestModuleData} ManifestModuleData */ -/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("./Module").SourceContext} SourceContext */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./WebpackError")} WebpackError */ -/** @typedef {import("./dependencies/ModuleDependency")} ModuleDependency */ -/** @typedef {import("./util/Hash")} Hash */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ - -const TYPES = new Set(["javascript"]); -const RUNTIME_REQUIREMENTS = new Set([ - RuntimeGlobals.module, - RuntimeGlobals.require -]); - -class DelegatedModule extends Module { - constructor(sourceRequest, data, type, userRequest, originalRequest) { - super("javascript/dynamic", null); - - // Info from Factory - this.sourceRequest = sourceRequest; - this.request = data.id; - this.delegationType = type; - this.userRequest = userRequest; - this.originalRequest = originalRequest; - /** @type {ManifestModuleData} */ - this.delegateData = data; - - // Build info - this.delegatedSourceDependency = undefined; - } - - /** - * @returns {Set} types available (do not mutate) - */ - getSourceTypes() { - return TYPES; - } - - /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion - */ - libIdent(options) { - return typeof this.originalRequest === "string" - ? this.originalRequest - : this.originalRequest.libIdent(options); - } - - /** - * @returns {string} a unique identifier of the module - */ - identifier() { - return `delegated ${JSON.stringify(this.request)} from ${ - this.sourceRequest - }`; - } - - /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module - */ - readableIdentifier(requestShortener) { - return `delegated ${this.userRequest} from ${this.sourceRequest}`; - } - - /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} - */ - needBuild(context, callback) { - return callback(null, !this.buildMeta); - } - - /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} - */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = { ...this.delegateData.buildMeta }; - this.buildInfo = {}; - this.dependencies.length = 0; - this.delegatedSourceDependency = new DelegatedSourceDependency( - this.sourceRequest - ); - this.addDependency(this.delegatedSourceDependency); - this.addDependency( - new StaticExportsDependency(this.delegateData.exports || true, false) - ); - callback(); - } - - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { - const dep = /** @type {DelegatedSourceDependency} */ (this.dependencies[0]); - const sourceModule = moduleGraph.getModule(dep); - let str; - - if (!sourceModule) { - str = runtimeTemplate.throwMissingModuleErrorBlock({ - request: this.sourceRequest - }); - } else { - str = `module.exports = (${runtimeTemplate.moduleExports({ - module: sourceModule, - chunkGraph, - request: dep.request, - runtimeRequirements: new Set() - })})`; - - switch (this.delegationType) { - case "require": - str += `(${JSON.stringify(this.request)})`; - break; - case "object": - str += `[${JSON.stringify(this.request)}]`; - break; - } - - str += ";"; - } - - const sources = new Map(); - if (this.useSourceMap || this.useSimpleSourceMap) { - sources.set("javascript", new OriginalSource(str, this.identifier())); - } else { - sources.set("javascript", new RawSource(str)); - } - - return { - sources, - runtimeRequirements: RUNTIME_REQUIREMENTS - }; - } - - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - return 42; - } - - /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - hash.update(this.delegationType); - hash.update(JSON.stringify(this.request)); - super.updateHash(hash, context); - } - - serialize(context) { - const { write } = context; - // constructor - write(this.sourceRequest); - write(this.delegateData); - write(this.delegationType); - write(this.userRequest); - write(this.originalRequest); - super.serialize(context); - } - - static deserialize(context) { - const { read } = context; - const obj = new DelegatedModule( - read(), // sourceRequest - read(), // delegateData - read(), // delegationType - read(), // userRequest - read() // originalRequest - ); - obj.deserialize(context); - return obj; - } - - /** - * Assuming this module is in the cache. Update the (cached) module with - * the fresh module from the factory. Usually updates internal references - * and properties. - * @param {Module} module fresh module - * @returns {void} - */ - updateCacheModule(module) { - super.updateCacheModule(module); - const m = /** @type {DelegatedModule} */ (module); - this.delegationType = m.delegationType; - this.userRequest = m.userRequest; - this.originalRequest = m.originalRequest; - this.delegateData = m.delegateData; - } - - /** - * Assuming this module is in the cache. Remove internal references to allow freeing some memory. - */ - cleanupForCache() { - super.cleanupForCache(); - this.delegateData = undefined; - } -} - -makeSerializable(DelegatedModule, "webpack/lib/DelegatedModule"); - -module.exports = DelegatedModule; - - -/***/ }), - -/***/ 51387: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const DelegatedModule = __webpack_require__(28623); - -// options.source -// options.type -// options.context -// options.scope -// options.content -// options.associatedObjectForCache -class DelegatedModuleFactoryPlugin { - constructor(options) { - this.options = options; - options.type = options.type || "require"; - options.extensions = options.extensions || ["", ".js", ".json", ".wasm"]; - } - - apply(normalModuleFactory) { - const scope = this.options.scope; - if (scope) { - normalModuleFactory.hooks.factorize.tapAsync( - "DelegatedModuleFactoryPlugin", - (data, callback) => { - const [dependency] = data.dependencies; - const { request } = dependency; - if (request && request.startsWith(`${scope}/`)) { - const innerRequest = "." + request.substr(scope.length); - let resolved; - if (innerRequest in this.options.content) { - resolved = this.options.content[innerRequest]; - return callback( - null, - new DelegatedModule( - this.options.source, - resolved, - this.options.type, - innerRequest, - request - ) - ); - } - for (let i = 0; i < this.options.extensions.length; i++) { - const extension = this.options.extensions[i]; - const requestPlusExt = innerRequest + extension; - if (requestPlusExt in this.options.content) { - resolved = this.options.content[requestPlusExt]; - return callback( - null, - new DelegatedModule( - this.options.source, - resolved, - this.options.type, - requestPlusExt, - request + extension - ) + logger.time("store provided exports into cache"); + asyncLib.each( + modulesToStore, + (module, callback) => { + if (typeof module.buildInfo.hash !== "string") { + // not cacheable + return callback(); + } + const cachedData = moduleGraph + .getExportsInfo(module) + .getRestoreProvidedData(); + const memCache = + moduleMemCaches && moduleMemCaches.get(module); + if (memCache) { + memCache.set(this, cachedData); + } + cache.store( + module.identifier(), + module.buildInfo.hash, + cachedData, + callback + ); + }, + err => { + logger.timeEnd("store provided exports into cache"); + callback(err); + } ); } - } - } - return callback(); - } - ); - } else { - normalModuleFactory.hooks.module.tap( - "DelegatedModuleFactoryPlugin", - module => { - const request = module.libIdent(this.options); - if (request) { - if (request in this.options.content) { - const resolved = this.options.content[request]; - return new DelegatedModule( - this.options.source, - resolved, - this.options.type, - request, - module - ); - } + ); } - return module; - } - ); - } - } -} -module.exports = DelegatedModuleFactoryPlugin; - - -/***/ }), - -/***/ 80632: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const DelegatedModuleFactoryPlugin = __webpack_require__(51387); -const DelegatedSourceDependency = __webpack_require__(22914); - -/** @typedef {import("./Compiler")} Compiler */ - -class DelegatedPlugin { - constructor(options) { - this.options = options; - } + ); - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "DelegatedPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - DelegatedSourceDependency, - normalModuleFactory + /** @type {WeakMap} */ + const providedExportsCache = new WeakMap(); + compilation.hooks.rebuildModule.tap( + "FlagDependencyExportsPlugin", + module => { + providedExportsCache.set( + module, + moduleGraph.getExportsInfo(module).getRestoreProvidedData() + ); + } + ); + compilation.hooks.finishRebuildingModule.tap( + "FlagDependencyExportsPlugin", + module => { + moduleGraph + .getExportsInfo(module) + .restoreProvided(providedExportsCache.get(module)); + } ); } ); - - compiler.hooks.compile.tap("DelegatedPlugin", ({ normalModuleFactory }) => { - new DelegatedModuleFactoryPlugin({ - associatedObjectForCache: compiler.root, - ...this.options - }).apply(normalModuleFactory); - }); } } -module.exports = DelegatedPlugin; +module.exports = FlagDependencyExportsPlugin; /***/ }), -/***/ 71040: +/***/ 58812: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -39552,111 +41041,351 @@ module.exports = DelegatedPlugin; -const makeSerializable = __webpack_require__(33032); +const Dependency = __webpack_require__(54912); +const { UsageState } = __webpack_require__(63686); +const ModuleGraphConnection = __webpack_require__(40639); +const { STAGE_DEFAULT } = __webpack_require__(80057); +const ArrayQueue = __webpack_require__(41792); +const TupleQueue = __webpack_require__(38415); +const { getEntryRuntime, mergeRuntimeOwned } = __webpack_require__(17156); -/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./Chunk")} Chunk */ /** @typedef {import("./ChunkGroup")} ChunkGroup */ -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("./util/Hash")} Hash */ - -/** @typedef {(d: Dependency) => boolean} DependencyFilterFunction */ - -class DependenciesBlock { - constructor() { - /** @type {Dependency[]} */ - this.dependencies = []; - /** @type {AsyncDependenciesBlock[]} */ - this.blocks = []; - /** @type {DependenciesBlock} */ - this.parent = undefined; - } +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ +/** @typedef {import("./Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("./ExportsInfo")} ExportsInfo */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - getRootBlock() { - /** @type {DependenciesBlock} */ - let current = this; - while (current.parent) current = current.parent; - return current; - } +const { NO_EXPORTS_REFERENCED, EXPORTS_OBJECT_REFERENCED } = Dependency; +class FlagDependencyUsagePlugin { /** - * Adds a DependencyBlock to DependencyBlock relationship. - * This is used for when a Module has a AsyncDependencyBlock tie (for code-splitting) - * - * @param {AsyncDependenciesBlock} block block being added - * @returns {void} + * @param {boolean} global do a global analysis instead of per runtime */ - addBlock(block) { - this.blocks.push(block); - block.parent = this; + constructor(global) { + this.global = global; } /** - * @param {Dependency} dependency dependency being tied to block. - * This is an "edge" pointing to another "node" on module graph. + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - addDependency(dependency) { - this.dependencies.push(dependency); - } + apply(compiler) { + compiler.hooks.compilation.tap("FlagDependencyUsagePlugin", compilation => { + const moduleGraph = compilation.moduleGraph; + compilation.hooks.optimizeDependencies.tap( + { + name: "FlagDependencyUsagePlugin", + stage: STAGE_DEFAULT + }, + modules => { + if (compilation.moduleMemCaches) { + throw new Error( + "optimization.usedExports can't be used with cacheUnaffected as export usage is a global effect" + ); + } - /** - * @param {Dependency} dependency dependency being removed - * @returns {void} - */ - removeDependency(dependency) { - const idx = this.dependencies.indexOf(dependency); - if (idx >= 0) { - this.dependencies.splice(idx, 1); - } - } + const logger = compilation.getLogger( + "webpack.FlagDependencyUsagePlugin" + ); + /** @type {Map} */ + const exportInfoToModuleMap = new Map(); - /** - * Removes all dependencies and blocks - * @returns {void} - */ - clearDependenciesAndBlocks() { - this.dependencies.length = 0; - this.blocks.length = 0; - } + /** @type {TupleQueue<[Module, RuntimeSpec]>} */ + const queue = new TupleQueue(); - /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - for (const dep of this.dependencies) { - dep.updateHash(hash, context); - } - for (const block of this.blocks) { - block.updateHash(hash, context); - } - } + /** + * @param {Module} module module to process + * @param {(string[] | ReferencedExport)[]} usedExports list of used exports + * @param {RuntimeSpec} runtime part of which runtime + * @param {boolean} forceSideEffects always apply side effects + * @returns {void} + */ + const processReferencedModule = ( + module, + usedExports, + runtime, + forceSideEffects + ) => { + const exportsInfo = moduleGraph.getExportsInfo(module); + if (usedExports.length > 0) { + if (!module.buildMeta || !module.buildMeta.exportsType) { + if (exportsInfo.setUsedWithoutInfo(runtime)) { + queue.enqueue(module, runtime); + } + return; + } + for (const usedExportInfo of usedExports) { + let usedExport; + let canMangle = true; + if (Array.isArray(usedExportInfo)) { + usedExport = usedExportInfo; + } else { + usedExport = usedExportInfo.name; + canMangle = usedExportInfo.canMangle !== false; + } + if (usedExport.length === 0) { + if (exportsInfo.setUsedInUnknownWay(runtime)) { + queue.enqueue(module, runtime); + } + } else { + let currentExportsInfo = exportsInfo; + for (let i = 0; i < usedExport.length; i++) { + const exportInfo = currentExportsInfo.getExportInfo( + usedExport[i] + ); + if (canMangle === false) { + exportInfo.canMangleUse = false; + } + const lastOne = i === usedExport.length - 1; + if (!lastOne) { + const nestedInfo = exportInfo.getNestedExportsInfo(); + if (nestedInfo) { + if ( + exportInfo.setUsedConditionally( + used => used === UsageState.Unused, + UsageState.OnlyPropertiesUsed, + runtime + ) + ) { + const currentModule = + currentExportsInfo === exportsInfo + ? module + : exportInfoToModuleMap.get(currentExportsInfo); + if (currentModule) { + queue.enqueue(currentModule, runtime); + } + } + currentExportsInfo = nestedInfo; + continue; + } + } + if ( + exportInfo.setUsedConditionally( + v => v !== UsageState.Used, + UsageState.Used, + runtime + ) + ) { + const currentModule = + currentExportsInfo === exportsInfo + ? module + : exportInfoToModuleMap.get(currentExportsInfo); + if (currentModule) { + queue.enqueue(currentModule, runtime); + } + } + break; + } + } + } + } else { + // for a module without side effects we stop tracking usage here when no export is used + // This module won't be evaluated in this case + // TODO webpack 6 remove this check + if ( + !forceSideEffects && + module.factoryMeta !== undefined && + module.factoryMeta.sideEffectFree + ) { + return; + } + if (exportsInfo.setUsedForSideEffectsOnly(runtime)) { + queue.enqueue(module, runtime); + } + } + }; - serialize({ write }) { - write(this.dependencies); - write(this.blocks); - } + /** + * @param {DependenciesBlock} module the module + * @param {RuntimeSpec} runtime part of which runtime + * @param {boolean} forceSideEffects always apply side effects + * @returns {void} + */ + const processModule = (module, runtime, forceSideEffects) => { + /** @type {Map>} */ + const map = new Map(); - deserialize({ read }) { - this.dependencies = read(); - this.blocks = read(); - for (const block of this.blocks) { - block.parent = this; - } + /** @type {ArrayQueue} */ + const queue = new ArrayQueue(); + queue.enqueue(module); + for (;;) { + const block = queue.dequeue(); + if (block === undefined) break; + for (const b of block.blocks) { + if ( + !this.global && + b.groupOptions && + b.groupOptions.entryOptions + ) { + processModule( + b, + b.groupOptions.entryOptions.runtime || undefined, + true + ); + } else { + queue.enqueue(b); + } + } + for (const dep of block.dependencies) { + const connection = moduleGraph.getConnection(dep); + if (!connection || !connection.module) { + continue; + } + const activeState = connection.getActiveState(runtime); + if (activeState === false) continue; + const { module } = connection; + if (activeState === ModuleGraphConnection.TRANSITIVE_ONLY) { + processModule(module, runtime, false); + continue; + } + const oldReferencedExports = map.get(module); + if (oldReferencedExports === EXPORTS_OBJECT_REFERENCED) { + continue; + } + const referencedExports = + compilation.getDependencyReferencedExports(dep, runtime); + if ( + oldReferencedExports === undefined || + oldReferencedExports === NO_EXPORTS_REFERENCED || + referencedExports === EXPORTS_OBJECT_REFERENCED + ) { + map.set(module, referencedExports); + } else if ( + oldReferencedExports !== undefined && + referencedExports === NO_EXPORTS_REFERENCED + ) { + continue; + } else { + let exportsMap; + if (Array.isArray(oldReferencedExports)) { + exportsMap = new Map(); + for (const item of oldReferencedExports) { + if (Array.isArray(item)) { + exportsMap.set(item.join("\n"), item); + } else { + exportsMap.set(item.name.join("\n"), item); + } + } + map.set(module, exportsMap); + } else { + exportsMap = oldReferencedExports; + } + for (const item of referencedExports) { + if (Array.isArray(item)) { + const key = item.join("\n"); + const oldItem = exportsMap.get(key); + if (oldItem === undefined) { + exportsMap.set(key, item); + } + // if oldItem is already an array we have to do nothing + // if oldItem is an ReferencedExport object, we don't have to do anything + // as canMangle defaults to true for arrays + } else { + const key = item.name.join("\n"); + const oldItem = exportsMap.get(key); + if (oldItem === undefined || Array.isArray(oldItem)) { + exportsMap.set(key, item); + } else { + exportsMap.set(key, { + name: item.name, + canMangle: item.canMangle && oldItem.canMangle + }); + } + } + } + } + } + } + + for (const [module, referencedExports] of map) { + if (Array.isArray(referencedExports)) { + processReferencedModule( + module, + referencedExports, + runtime, + forceSideEffects + ); + } else { + processReferencedModule( + module, + Array.from(referencedExports.values()), + runtime, + forceSideEffects + ); + } + } + }; + + logger.time("initialize exports usage"); + for (const module of modules) { + const exportsInfo = moduleGraph.getExportsInfo(module); + exportInfoToModuleMap.set(exportsInfo, module); + exportsInfo.setHasUseInfo(); + } + logger.timeEnd("initialize exports usage"); + + logger.time("trace exports usage in graph"); + + /** + * @param {Dependency} dep dependency + * @param {RuntimeSpec} runtime runtime + */ + const processEntryDependency = (dep, runtime) => { + const module = moduleGraph.getModule(dep); + if (module) { + processReferencedModule( + module, + NO_EXPORTS_REFERENCED, + runtime, + true + ); + } + }; + /** @type {RuntimeSpec} */ + let globalRuntime = undefined; + for (const [ + entryName, + { dependencies: deps, includeDependencies: includeDeps, options } + ] of compilation.entries) { + const runtime = this.global + ? undefined + : getEntryRuntime(compilation, entryName, options); + for (const dep of deps) { + processEntryDependency(dep, runtime); + } + for (const dep of includeDeps) { + processEntryDependency(dep, runtime); + } + globalRuntime = mergeRuntimeOwned(globalRuntime, runtime); + } + for (const dep of compilation.globalEntry.dependencies) { + processEntryDependency(dep, globalRuntime); + } + for (const dep of compilation.globalEntry.includeDependencies) { + processEntryDependency(dep, globalRuntime); + } + + while (queue.length) { + const [module, runtime] = queue.dequeue(); + processModule(module, runtime, false); + } + logger.timeEnd("trace exports usage in graph"); + } + ); + }); } } -makeSerializable(DependenciesBlock, "webpack/lib/DependenciesBlock"); - -module.exports = DependenciesBlock; +module.exports = FlagDependencyUsagePlugin; /***/ }), -/***/ 54912: +/***/ 93401: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -39667,353 +41396,153 @@ module.exports = DependenciesBlock; -const memoize = __webpack_require__(78676); - /** @typedef {import("webpack-sources").Source} Source */ /** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ +/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./ConcatenationScope")} ConcatenationScope */ +/** @typedef {import("./DependencyTemplate")} DependencyTemplate */ /** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./Module")} Module */ +/** @typedef {import("./Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ /** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("./NormalModule")} NormalModule */ /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./WebpackError")} WebpackError */ /** @typedef {import("./util/Hash")} Hash */ /** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ /** - * @typedef {Object} UpdateHashContext - * @property {ChunkGraph} chunkGraph - * @property {RuntimeSpec} runtime - * @property {RuntimeTemplate=} runtimeTemplate - */ - -/** - * @typedef {Object} SourcePosition - * @property {number} line - * @property {number=} column + * @typedef {Object} GenerateContext + * @property {DependencyTemplates} dependencyTemplates mapping from dependencies to templates + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {Set} runtimeRequirements the requirements for runtime + * @property {RuntimeSpec} runtime the runtime + * @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules + * @property {CodeGenerationResults=} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that) + * @property {string} type which kind of code should be generated + * @property {function(): Map=} getData get access to the code generation data */ /** - * @typedef {Object} RealDependencyLocation - * @property {SourcePosition} start - * @property {SourcePosition=} end - * @property {number=} index + * @typedef {Object} UpdateHashContext + * @property {NormalModule} module the module + * @property {ChunkGraph} chunkGraph + * @property {RuntimeSpec} runtime */ /** - * @typedef {Object} SyntheticDependencyLocation - * @property {string} name - * @property {number=} index + * */ +class Generator { + static byType(map) { + return new ByTypeGenerator(map); + } -/** @typedef {SyntheticDependencyLocation|RealDependencyLocation} DependencyLocation */ - -/** - * @typedef {Object} ExportSpec - * @property {string} name the name of the export - * @property {boolean=} canMangle can the export be renamed (defaults to true) - * @property {boolean=} terminalBinding is the export a terminal binding that should be checked for export star conflicts - * @property {(string | ExportSpec)[]=} exports nested exports - * @property {ModuleGraphConnection=} from when reexported: from which module - * @property {string[] | null=} export when reexported: from which export - * @property {number=} priority when reexported: with which priority - * @property {boolean=} hidden export is not visible, because another export blends over it - */ + /* istanbul ignore next */ + /** + * @abstract + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) + */ + getTypes(module) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); + } -/** - * @typedef {Object} ExportsSpec - * @property {(string | ExportSpec)[] | true | null} exports exported names, true for unknown exports or null for no exports - * @property {Set=} excludeExports when exports = true, list of unaffected exports - * @property {Set=} hideExports list of maybe prior exposed, but now hidden exports - * @property {ModuleGraphConnection=} from when reexported: from which module - * @property {number=} priority when reexported: with which priority - * @property {boolean=} canMangle can the export be renamed (defaults to true) - * @property {boolean=} terminalBinding are the exports terminal bindings that should be checked for export star conflicts - * @property {Module[]=} dependencies module on which the result depends on - */ + /* istanbul ignore next */ + /** + * @abstract + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module + */ + getSize(module, type) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); + } -/** - * @typedef {Object} ReferencedExport - * @property {string[]} name name of the referenced export - * @property {boolean=} canMangle when false, referenced export can not be mangled, defaults to true - */ + /* istanbul ignore next */ + /** + * @abstract + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code + */ + generate( + module, + { dependencyTemplates, runtimeTemplate, moduleGraph, type } + ) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); + } -const TRANSITIVE = Symbol("transitive"); + /** + * @param {NormalModule} module module for which the bailout reason should be determined + * @param {ConcatenationBailoutReasonContext} context context + * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated + */ + getConcatenationBailoutReason(module, context) { + return `Module Concatenation is not implemented for ${this.constructor.name}`; + } -const getIgnoredModule = memoize(() => { - const RawModule = __webpack_require__(84929); - return new RawModule("/* (ignored) */", `ignored`, `(ignored)`); -}); + /** + * @param {Hash} hash hash that will be modified + * @param {UpdateHashContext} updateHashContext context for updating hash + */ + updateHash(hash, { module, runtime }) { + // no nothing + } +} -class Dependency { - constructor() { - /** @type {Module} */ - this._parentModule = undefined; - /** @type {DependenciesBlock} */ - this._parentDependenciesBlock = undefined; - /** @type {number} */ - this._parentDependenciesBlockIndex = -1; - // TODO check if this can be moved into ModuleDependency - /** @type {boolean} */ - this.weak = false; - // TODO check if this can be moved into ModuleDependency - /** @type {boolean} */ - this.optional = false; - this._locSL = 0; - this._locSC = 0; - this._locEL = 0; - this._locEC = 0; - this._locI = undefined; - this._locN = undefined; - this._loc = undefined; +class ByTypeGenerator extends Generator { + constructor(map) { + super(); + this.map = map; + this._types = new Set(Object.keys(map)); } /** - * @returns {string} a display name for the type of dependency + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) */ - get type() { - return "unknown"; + getTypes(module) { + return this._types; } /** - * @returns {string} a dependency category, typical categories are "commonjs", "amd", "esm" + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module */ - get category() { - return "unknown"; + getSize(module, type) { + const t = type || "javascript"; + const generator = this.map[t]; + return generator ? generator.getSize(module, t) : 0; } /** - * @returns {DependencyLocation} location + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code */ - get loc() { - if (this._loc !== undefined) return this._loc; - /** @type {SyntheticDependencyLocation & RealDependencyLocation} */ - const loc = {}; - if (this._locSL > 0) { - loc.start = { line: this._locSL, column: this._locSC }; - } - if (this._locEL > 0) { - loc.end = { line: this._locEL, column: this._locEC }; + generate(module, generateContext) { + const type = generateContext.type; + const generator = this.map[type]; + if (!generator) { + throw new Error(`Generator.byType: no generator specified for ${type}`); } - if (this._locN !== undefined) { - loc.name = this._locN; - } - if (this._locI !== undefined) { - loc.index = this._locI; - } - return (this._loc = loc); - } - - set loc(loc) { - if ("start" in loc && typeof loc.start === "object") { - this._locSL = loc.start.line || 0; - this._locSC = loc.start.column || 0; - } else { - this._locSL = 0; - this._locSC = 0; - } - if ("end" in loc && typeof loc.end === "object") { - this._locEL = loc.end.line || 0; - this._locEC = loc.end.column || 0; - } else { - this._locEL = 0; - this._locEC = 0; - } - if ("index" in loc) { - this._locI = loc.index; - } else { - this._locI = undefined; - } - if ("name" in loc) { - this._locN = loc.name; - } else { - this._locN = undefined; - } - this._loc = loc; - } - - setLoc(startLine, startColumn, endLine, endColumn) { - this._locSL = startLine; - this._locSC = startColumn; - this._locEL = endLine; - this._locEC = endColumn; - this._locI = undefined; - this._locN = undefined; - this._loc = undefined; - } - - /** - * @returns {string | null} an identifier to merge equal requests - */ - getResourceIdentifier() { - return null; - } - - /** - * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module - */ - couldAffectReferencingModule() { - return TRANSITIVE; - } - - /** - * Returns the referenced module and export - * @deprecated - * @param {ModuleGraph} moduleGraph module graph - * @returns {never} throws error - */ - getReference(moduleGraph) { - throw new Error( - "Dependency.getReference was removed in favor of Dependency.getReferencedExports, ModuleGraph.getModule and ModuleGraph.getConnection().active" - ); - } - - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - return Dependency.EXPORTS_OBJECT_REFERENCED; - } - - /** - * @param {ModuleGraph} moduleGraph module graph - * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active - */ - getCondition(moduleGraph) { - return null; - } - - /** - * Returns the exported names - * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names - */ - getExports(moduleGraph) { - return undefined; - } - - /** - * Returns warnings - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[]} warnings - */ - getWarnings(moduleGraph) { - return null; - } - - /** - * Returns errors - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[]} errors - */ - getErrors(moduleGraph) { - return null; - } - - /** - * Update the hash - * @param {Hash} hash hash to be updated - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) {} - - /** - * implement this method to allow the occurrence order plugin to count correctly - * @returns {number} count how often the id is used in this dependency - */ - getNumberOfIdOccurrences() { - return 1; - } - - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this dependency connects the module to referencing modules - */ - getModuleEvaluationSideEffectsState(moduleGraph) { - return true; - } - - /** - * @param {string} context context directory - * @returns {Module} a module - */ - createIgnoredModule(context) { - return getIgnoredModule(); - } - - serialize({ write }) { - write(this.weak); - write(this.optional); - write(this._locSL); - write(this._locSC); - write(this._locEL); - write(this._locEC); - write(this._locI); - write(this._locN); - } - - deserialize({ read }) { - this.weak = read(); - this.optional = read(); - this._locSL = read(); - this._locSC = read(); - this._locEL = read(); - this._locEC = read(); - this._locI = read(); - this._locN = read(); + return generator.generate(module, generateContext); } } -/** @type {string[][]} */ -Dependency.NO_EXPORTS_REFERENCED = []; -/** @type {string[][]} */ -Dependency.EXPORTS_OBJECT_REFERENCED = [[]]; - -Object.defineProperty(Dependency.prototype, "module", { - /** - * @deprecated - * @returns {never} throws - */ - get() { - throw new Error( - "module property was removed from Dependency (use compilation.moduleGraph.getModule(dependency) instead)" - ); - }, - - /** - * @deprecated - * @returns {never} throws - */ - set() { - throw new Error( - "module property was removed from Dependency (use compilation.moduleGraph.updateModule(dependency, module) instead)" - ); - } -}); - -Object.defineProperty(Dependency.prototype, "disconnect", { - get() { - throw new Error( - "disconnect was removed from Dependency (Dependency no longer carries graph specific information)" - ); - } -}); - -Dependency.TRANSITIVE = TRANSITIVE; - -module.exports = Dependency; +module.exports = Generator; /***/ }), -/***/ 5160: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 37234: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* @@ -40023,199 +41552,166 @@ module.exports = Dependency; -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ -/** @typedef {import("./ConcatenationScope")} ConcatenationScope */ -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./Dependency").RuntimeSpec} RuntimeSpec */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./Generator").GenerateContext} GenerateContext */ -/** @template T @typedef {import("./InitFragment")} InitFragment */ +/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./ChunkGroup")} ChunkGroup */ +/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ /** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ /** - * @typedef {Object} DependencyTemplateContext - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {DependencyTemplates} dependencyTemplates the dependency templates - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {Set} runtimeRequirements the requirements for runtime - * @property {Module} module current module - * @property {RuntimeSpec} runtime current runtimes, for which code is generated - * @property {InitFragment[]} initFragments mutable array of init fragments for the current module - * @property {ConcatenationScope=} concatenationScope when in a concatenated module, information about other concatenated modules - * @property {CodeGenerationResults} codeGenerationResults the code generation results + * @param {ChunkGroup} chunkGroup the ChunkGroup to connect + * @param {Chunk} chunk chunk to tie to ChunkGroup + * @returns {void} */ +const connectChunkGroupAndChunk = (chunkGroup, chunk) => { + if (chunkGroup.pushChunk(chunk)) { + chunk.addGroup(chunkGroup); + } +}; /** - * @typedef {Object} CssDependencyTemplateContextExtras - * @property {Map} cssExports the css exports + * @param {ChunkGroup} parent parent ChunkGroup to connect + * @param {ChunkGroup} child child ChunkGroup to connect + * @returns {void} */ - -/** @typedef {DependencyTemplateContext & CssDependencyTemplateContextExtras} CssDependencyTemplateContext */ - -class DependencyTemplate { - /* istanbul ignore next */ - /** - * @abstract - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, templateContext) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); +const connectChunkGroupParentAndChild = (parent, child) => { + if (parent.addChild(child)) { + child.addParent(parent); } -} +}; -module.exports = DependencyTemplate; +exports.connectChunkGroupAndChunk = connectChunkGroupAndChunk; +exports.connectChunkGroupParentAndChild = connectChunkGroupParentAndChild; /***/ }), -/***/ 9163: +/***/ 97511: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const createHash = __webpack_require__(49835); - -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./DependencyTemplate")} DependencyTemplate */ -/** @typedef {typeof import("./util/Hash")} Hash */ - -/** @typedef {new (...args: any[]) => Dependency} DependencyConstructor */ - -class DependencyTemplates { - /** - * @param {string | Hash} hashFunction the hash function to use - */ - constructor(hashFunction = "md4") { - /** @type {Map} */ - this._map = new Map(); - /** @type {string} */ - this._hash = "31d6cfe0d16ae931b73c59d7e0c089c0"; - this._hashFunction = hashFunction; - } - - /** - * @param {DependencyConstructor} dependency Constructor of Dependency - * @returns {DependencyTemplate} template for this dependency - */ - get(dependency) { - return this._map.get(dependency); - } - - /** - * @param {DependencyConstructor} dependency Constructor of Dependency - * @param {DependencyTemplate} dependencyTemplate template for this dependency - * @returns {void} - */ - set(dependency, dependencyTemplate) { - this._map.set(dependency, dependencyTemplate); - } - - /** - * @param {string} part additional hash contributor - * @returns {void} - */ - updateHash(part) { - const hash = createHash(this._hashFunction); - hash.update(`${this._hash}${part}`); - this._hash = /** @type {string} */ (hash.digest("hex")); - } - - getHash() { - return this._hash; - } +const WebpackError = __webpack_require__(53799); - clone() { - const newInstance = new DependencyTemplates(this._hashFunction); - newInstance._map = new Map(this._map); - newInstance._hash = this._hash; - return newInstance; +module.exports = class HarmonyLinkingError extends WebpackError { + /** @param {string} message Error message */ + constructor(message) { + super(message); + this.name = "HarmonyLinkingError"; + this.hideStack = true; } -} - -module.exports = DependencyTemplates; +}; /***/ }), -/***/ 62790: +/***/ 11351: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Sean Larkin @thelarkinn */ -const DllModuleFactory = __webpack_require__(68703); -const DllEntryDependency = __webpack_require__(95666); -const EntryDependency = __webpack_require__(3979); +const WebpackError = __webpack_require__(53799); -class DllEntryPlugin { - constructor(context, entries, options) { - this.context = context; - this.entries = entries; - this.options = options; +/** @typedef {import("./Module")} Module */ + +/** + * @template T + * @callback Callback + * @param {Error=} err + * @param {T=} stats + * @returns {void} + */ + +class HookWebpackError extends WebpackError { + /** + * Creates an instance of HookWebpackError. + * @param {Error} error inner error + * @param {string} hook name of hook + */ + constructor(error, hook) { + super(error.message); + + this.name = "HookWebpackError"; + this.hook = hook; + this.error = error; + this.hideStack = true; + this.details = `caused by plugins in ${hook}\n${error.stack}`; + + this.stack += `\n-- inner error --\n${error.stack}`; } +} - apply(compiler) { - compiler.hooks.compilation.tap( - "DllEntryPlugin", - (compilation, { normalModuleFactory }) => { - const dllModuleFactory = new DllModuleFactory(); - compilation.dependencyFactories.set( - DllEntryDependency, - dllModuleFactory - ); - compilation.dependencyFactories.set( - EntryDependency, - normalModuleFactory - ); +module.exports = HookWebpackError; + +/** + * @param {Error} error an error + * @param {string} hook name of the hook + * @returns {WebpackError} a webpack error + */ +const makeWebpackError = (error, hook) => { + if (error instanceof WebpackError) return error; + return new HookWebpackError(error, hook); +}; +module.exports.makeWebpackError = makeWebpackError; + +/** + * @template T + * @param {function((WebpackError | null)=, T=): void} callback webpack error callback + * @param {string} hook name of hook + * @returns {Callback} generic callback + */ +const makeWebpackErrorCallback = (callback, hook) => { + return (err, result) => { + if (err) { + if (err instanceof WebpackError) { + callback(err); + return; } - ); - compiler.hooks.make.tapAsync("DllEntryPlugin", (compilation, callback) => { - compilation.addEntry( - this.context, - new DllEntryDependency( - this.entries.map((e, idx) => { - const dep = new EntryDependency(e); - dep.loc = { - name: this.options.name, - index: idx - }; - return dep; - }), - this.options.name - ), - this.options, - callback - ); - }); + callback(new HookWebpackError(err, hook)); + return; + } + callback(null, result); + }; +}; + +module.exports.makeWebpackErrorCallback = makeWebpackErrorCallback; + +/** + * @template T + * @param {function(): T} fn function which will be wrapping in try catch + * @param {string} hook name of hook + * @returns {T} the result + */ +const tryRunOrWebpackError = (fn, hook) => { + let r; + try { + r = fn(); + } catch (err) { + if (err instanceof WebpackError) { + throw err; + } + throw new HookWebpackError(err, hook); } -} + return r; +}; -module.exports = DllEntryPlugin; +module.exports.tryRunOrWebpackError = tryRunOrWebpackError; /***/ }), -/***/ 28280: +/***/ 6404: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -40226,243 +41722,76 @@ module.exports = DllEntryPlugin; +const { SyncBailHook } = __webpack_require__(6967); const { RawSource } = __webpack_require__(51255); -const Module = __webpack_require__(73208); +const ChunkGraph = __webpack_require__(64971); +const Compilation = __webpack_require__(85720); +const HotUpdateChunk = __webpack_require__(9597); +const NormalModule = __webpack_require__(39); const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("./Module").SourceContext} SourceContext */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./WebpackError")} WebpackError */ -/** @typedef {import("./util/Hash")} Hash */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ - -const TYPES = new Set(["javascript"]); -const RUNTIME_REQUIREMENTS = new Set([ - RuntimeGlobals.require, - RuntimeGlobals.module -]); - -class DllModule extends Module { - constructor(context, dependencies, name) { - super("javascript/dynamic", context); - - // Info from Factory - this.dependencies = dependencies; - this.name = name; - } - - /** - * @returns {Set} types available (do not mutate) - */ - getSourceTypes() { - return TYPES; - } - - /** - * @returns {string} a unique identifier of the module - */ - identifier() { - return `dll ${this.name}`; - } - - /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module - */ - readableIdentifier(requestShortener) { - return `dll ${this.name}`; - } - - /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} - */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = {}; - this.buildInfo = {}; - return callback(); - } - - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration(context) { - const sources = new Map(); - sources.set( - "javascript", - new RawSource("module.exports = __webpack_require__;") - ); - return { - sources, - runtimeRequirements: RUNTIME_REQUIREMENTS - }; - } - - /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} - */ - needBuild(context, callback) { - return callback(null, !this.buildMeta); - } - - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - return 12; - } - - /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - hash.update(`dll module${this.name || ""}`); - super.updateHash(hash, context); - } - - serialize(context) { - context.write(this.name); - super.serialize(context); - } - - deserialize(context) { - this.name = context.read(); - super.deserialize(context); - } - - /** - * Assuming this module is in the cache. Update the (cached) module with - * the fresh module from the factory. Usually updates internal references - * and properties. - * @param {Module} module fresh module - * @returns {void} - */ - updateCacheModule(module) { - super.updateCacheModule(module); - this.dependencies = module.dependencies; - } - - /** - * Assuming this module is in the cache. Remove internal references to allow freeing some memory. - */ - cleanupForCache() { - super.cleanupForCache(); - this.dependencies = undefined; - } -} - -makeSerializable(DllModule, "webpack/lib/DllModule"); - -module.exports = DllModule; - - -/***/ }), - -/***/ 68703: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - +const WebpackError = __webpack_require__(53799); +const ConstDependency = __webpack_require__(76911); +const ImportMetaHotAcceptDependency = __webpack_require__(51274); +const ImportMetaHotDeclineDependency = __webpack_require__(53141); +const ModuleHotAcceptDependency = __webpack_require__(47511); +const ModuleHotDeclineDependency = __webpack_require__(86301); +const HotModuleReplacementRuntimeModule = __webpack_require__(27899); +const JavascriptParser = __webpack_require__(29050); +const { + evaluateToIdentifier +} = __webpack_require__(93998); +const { find, isSubset } = __webpack_require__(93347); +const TupleSet = __webpack_require__(76455); +const { compareModulesById } = __webpack_require__(29579); +const { + getRuntimeKey, + keyToRuntime, + forEachRuntime, + mergeRuntimeOwned, + subtractRuntime, + intersectRuntime +} = __webpack_require__(17156); +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./RuntimeModule")} RuntimeModule */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ -const DllModule = __webpack_require__(28280); -const ModuleFactory = __webpack_require__(51010); +/** + * @typedef {Object} HMRJavascriptParserHooks + * @property {SyncBailHook<[TODO, string[]], void>} hotAcceptCallback + * @property {SyncBailHook<[TODO, string[]], void>} hotAcceptWithoutCallback + */ -/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ -/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ -/** @typedef {import("./dependencies/DllEntryDependency")} DllEntryDependency */ +/** @type {WeakMap} */ +const parserHooksMap = new WeakMap(); -class DllModuleFactory extends ModuleFactory { - constructor() { - super(); - this.hooks = Object.freeze({}); - } +class HotModuleReplacementPlugin { /** - * @param {ModuleFactoryCreateData} data data object - * @param {function(Error=, ModuleFactoryResult=): void} callback callback - * @returns {void} + * @param {JavascriptParser} parser the parser + * @returns {HMRJavascriptParserHooks} the attached hooks */ - create(data, callback) { - const dependency = /** @type {DllEntryDependency} */ (data.dependencies[0]); - callback(null, { - module: new DllModule( - data.context, - dependency.dependencies, - dependency.name - ) - }); - } -} - -module.exports = DllModuleFactory; - - -/***/ }), - -/***/ 40038: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const DllEntryPlugin = __webpack_require__(62790); -const FlagAllModulesAsUsedPlugin = __webpack_require__(58727); -const LibManifestPlugin = __webpack_require__(93837); -const createSchemaValidation = __webpack_require__(32540); - -/** @typedef {import("../declarations/plugins/DllPlugin").DllPluginOptions} DllPluginOptions */ -/** @typedef {import("./Compiler")} Compiler */ - -const validate = createSchemaValidation( - __webpack_require__(9667), - () => __webpack_require__(99926), - { - name: "Dll Plugin", - baseDataPath: "options" + static getParserHooks(parser) { + if (!(parser instanceof JavascriptParser)) { + throw new TypeError( + "The 'parser' argument must be an instance of JavascriptParser" + ); + } + let hooks = parserHooksMap.get(parser); + if (hooks === undefined) { + hooks = { + hotAcceptCallback: new SyncBailHook(["expression", "requests"]), + hotAcceptWithoutCallback: new SyncBailHook(["expression", "requests"]) + }; + parserHooksMap.set(parser, hooks); + } + return hooks; } -); -class DllPlugin { - /** - * @param {DllPluginOptions} options options object - */ constructor(options) { - validate(options); - this.options = { - ...options, - entryOnly: options.entryOnly !== false - }; + this.options = options || {}; } /** @@ -40471,469 +41800,704 @@ class DllPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.entryOption.tap("DllPlugin", (context, entry) => { - if (typeof entry !== "function") { - for (const name of Object.keys(entry)) { - const options = { - name, - filename: entry.filename - }; - new DllEntryPlugin(context, entry[name].import, options).apply( - compiler - ); - } - } else { - throw new Error( - "DllPlugin doesn't support dynamic entry (function) yet" - ); - } - return true; - }); - new LibManifestPlugin(this.options).apply(compiler); - if (!this.options.entryOnly) { - new FlagAllModulesAsUsedPlugin("DllPlugin").apply(compiler); - } - } -} - -module.exports = DllPlugin; - - -/***/ }), - -/***/ 90999: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const { _backCompat: backCompat } = compiler; + if (compiler.options.output.strictModuleErrorHandling === undefined) + compiler.options.output.strictModuleErrorHandling = true; + const runtimeRequirements = [RuntimeGlobals.module]; + const createAcceptHandler = (parser, ParamDependency) => { + const { hotAcceptCallback, hotAcceptWithoutCallback } = + HotModuleReplacementPlugin.getParserHooks(parser); + return expr => { + const module = parser.state.module; + const dep = new ConstDependency( + `${module.moduleArgument}.hot.accept`, + expr.callee.range, + runtimeRequirements + ); + dep.loc = expr.loc; + module.addPresentationalDependency(dep); + module.buildInfo.moduleConcatenationBailout = "Hot Module Replacement"; + if (expr.arguments.length >= 1) { + const arg = parser.evaluateExpression(expr.arguments[0]); + let params = []; + let requests = []; + if (arg.isString()) { + params = [arg]; + } else if (arg.isArray()) { + params = arg.items.filter(param => param.isString()); + } + if (params.length > 0) { + params.forEach((param, idx) => { + const request = param.string; + const dep = new ParamDependency(request, param.range); + dep.optional = true; + dep.loc = Object.create(expr.loc); + dep.loc.index = idx; + module.addDependency(dep); + requests.push(request); + }); + if (expr.arguments.length > 1) { + hotAcceptCallback.call(expr.arguments[1], requests); + for (let i = 1; i < expr.arguments.length; i++) { + parser.walkExpression(expr.arguments[i]); + } + return true; + } else { + hotAcceptWithoutCallback.call(expr, requests); + return true; + } + } + } + parser.walkExpressions(expr.arguments); + return true; + }; + }; -const parseJson = __webpack_require__(15235); -const DelegatedModuleFactoryPlugin = __webpack_require__(51387); -const ExternalModuleFactoryPlugin = __webpack_require__(62153); -const WebpackError = __webpack_require__(53799); -const DelegatedSourceDependency = __webpack_require__(22914); -const createSchemaValidation = __webpack_require__(32540); -const makePathsRelative = (__webpack_require__(82186).makePathsRelative); + const createDeclineHandler = (parser, ParamDependency) => expr => { + const module = parser.state.module; + const dep = new ConstDependency( + `${module.moduleArgument}.hot.decline`, + expr.callee.range, + runtimeRequirements + ); + dep.loc = expr.loc; + module.addPresentationalDependency(dep); + module.buildInfo.moduleConcatenationBailout = "Hot Module Replacement"; + if (expr.arguments.length === 1) { + const arg = parser.evaluateExpression(expr.arguments[0]); + let params = []; + if (arg.isString()) { + params = [arg]; + } else if (arg.isArray()) { + params = arg.items.filter(param => param.isString()); + } + params.forEach((param, idx) => { + const dep = new ParamDependency(param.string, param.range); + dep.optional = true; + dep.loc = Object.create(expr.loc); + dep.loc.index = idx; + module.addDependency(dep); + }); + } + return true; + }; -/** @typedef {import("../declarations/WebpackOptions").Externals} Externals */ -/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptions} DllReferencePluginOptions */ -/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptionsManifest} DllReferencePluginOptionsManifest */ + const createHMRExpressionHandler = parser => expr => { + const module = parser.state.module; + const dep = new ConstDependency( + `${module.moduleArgument}.hot`, + expr.range, + runtimeRequirements + ); + dep.loc = expr.loc; + module.addPresentationalDependency(dep); + module.buildInfo.moduleConcatenationBailout = "Hot Module Replacement"; + return true; + }; -const validate = createSchemaValidation( - __webpack_require__(28534), - () => __webpack_require__(46552), - { - name: "Dll Reference Plugin", - baseDataPath: "options" - } -); + const applyModuleHot = parser => { + parser.hooks.evaluateIdentifier.for("module.hot").tap( + { + name: "HotModuleReplacementPlugin", + before: "NodeStuffPlugin" + }, + expr => { + return evaluateToIdentifier( + "module.hot", + "module", + () => ["hot"], + true + )(expr); + } + ); + parser.hooks.call + .for("module.hot.accept") + .tap( + "HotModuleReplacementPlugin", + createAcceptHandler(parser, ModuleHotAcceptDependency) + ); + parser.hooks.call + .for("module.hot.decline") + .tap( + "HotModuleReplacementPlugin", + createDeclineHandler(parser, ModuleHotDeclineDependency) + ); + parser.hooks.expression + .for("module.hot") + .tap("HotModuleReplacementPlugin", createHMRExpressionHandler(parser)); + }; -class DllReferencePlugin { - /** - * @param {DllReferencePluginOptions} options options object - */ - constructor(options) { - validate(options); - this.options = options; - /** @type {WeakMap} */ - this._compilationData = new WeakMap(); - } + const applyImportMetaHot = parser => { + parser.hooks.evaluateIdentifier + .for("import.meta.webpackHot") + .tap("HotModuleReplacementPlugin", expr => { + return evaluateToIdentifier( + "import.meta.webpackHot", + "import.meta", + () => ["webpackHot"], + true + )(expr); + }); + parser.hooks.call + .for("import.meta.webpackHot.accept") + .tap( + "HotModuleReplacementPlugin", + createAcceptHandler(parser, ImportMetaHotAcceptDependency) + ); + parser.hooks.call + .for("import.meta.webpackHot.decline") + .tap( + "HotModuleReplacementPlugin", + createDeclineHandler(parser, ImportMetaHotDeclineDependency) + ); + parser.hooks.expression + .for("import.meta.webpackHot") + .tap("HotModuleReplacementPlugin", createHMRExpressionHandler(parser)); + }; - apply(compiler) { compiler.hooks.compilation.tap( - "DllReferencePlugin", + "HotModuleReplacementPlugin", (compilation, { normalModuleFactory }) => { + // This applies the HMR plugin only to the targeted compiler + // It should not affect child compilations + if (compilation.compiler !== compiler) return; + + //#region module.hot.* API compilation.dependencyFactories.set( - DelegatedSourceDependency, + ModuleHotAcceptDependency, normalModuleFactory ); - } - ); + compilation.dependencyTemplates.set( + ModuleHotAcceptDependency, + new ModuleHotAcceptDependency.Template() + ); + compilation.dependencyFactories.set( + ModuleHotDeclineDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + ModuleHotDeclineDependency, + new ModuleHotDeclineDependency.Template() + ); + //#endregion - compiler.hooks.beforeCompile.tapAsync( - "DllReferencePlugin", - (params, callback) => { - if ("manifest" in this.options) { - const manifest = this.options.manifest; - if (typeof manifest === "string") { - compiler.inputFileSystem.readFile(manifest, (err, result) => { - if (err) return callback(err); - const data = { - path: manifest, - data: undefined, - error: undefined - }; - // Catch errors parsing the manifest so that blank - // or malformed manifest files don't kill the process. - try { - data.data = parseJson(result.toString("utf-8")); - } catch (e) { - // Store the error in the params so that it can - // be added as a compilation error later on. - const manifestPath = makePathsRelative( - compiler.options.context, - manifest, - compiler.root - ); - data.error = new DllManifestError(manifestPath, e.message); - } - this._compilationData.set(params, data); - return callback(); - }); - return; - } - } - return callback(); - } - ); - - compiler.hooks.compile.tap("DllReferencePlugin", params => { - let name = this.options.name; - let sourceType = this.options.sourceType; - let content = - "content" in this.options ? this.options.content : undefined; - if ("manifest" in this.options) { - let manifestParameter = this.options.manifest; - let manifest; - if (typeof manifestParameter === "string") { - const data = this._compilationData.get(params); - // If there was an error parsing the manifest - // file, exit now because the error will be added - // as a compilation error in the "compilation" hook. - if (data.error) { - return; - } - manifest = data.data; - } else { - manifest = manifestParameter; - } - if (manifest) { - if (!name) name = manifest.name; - if (!sourceType) sourceType = manifest.type; - if (!content) content = manifest.content; - } - } - /** @type {Externals} */ - const externals = {}; - const source = "dll-reference " + name; - externals[source] = name; - const normalModuleFactory = params.normalModuleFactory; - new ExternalModuleFactoryPlugin(sourceType || "var", externals).apply( - normalModuleFactory - ); - new DelegatedModuleFactoryPlugin({ - source: source, - type: this.options.type, - scope: this.options.scope, - context: this.options.context || compiler.options.context, - content, - extensions: this.options.extensions, - associatedObjectForCache: compiler.root - }).apply(normalModuleFactory); - }); - - compiler.hooks.compilation.tap( - "DllReferencePlugin", - (compilation, params) => { - if ("manifest" in this.options) { - let manifest = this.options.manifest; - if (typeof manifest === "string") { - const data = this._compilationData.get(params); - // If there was an error parsing the manifest file, add the - // error as a compilation error to make the compilation fail. - if (data.error) { - compilation.errors.push(data.error); - } - compilation.fileDependencies.add(manifest); - } - } - } - ); - } -} - -class DllManifestError extends WebpackError { - constructor(filename, message) { - super(); - - this.name = "DllManifestError"; - this.message = `Dll manifest ${filename}\n${message}`; - } -} - -module.exports = DllReferencePlugin; - - -/***/ }), - -/***/ 96475: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Naoyuki Kanezawa @nkzawa -*/ - - - -const EntryOptionPlugin = __webpack_require__(9909); -const EntryPlugin = __webpack_require__(96953); -const EntryDependency = __webpack_require__(3979); - -/** @typedef {import("../declarations/WebpackOptions").EntryDynamicNormalized} EntryDynamic */ -/** @typedef {import("../declarations/WebpackOptions").EntryItem} EntryItem */ -/** @typedef {import("../declarations/WebpackOptions").EntryStaticNormalized} EntryStatic */ -/** @typedef {import("./Compiler")} Compiler */ - -class DynamicEntryPlugin { - /** - * @param {string} context the context path - * @param {EntryDynamic} entry the entry value - */ - constructor(context, entry) { - this.context = context; - this.entry = entry; - } - - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "DynamicEntryPlugin", - (compilation, { normalModuleFactory }) => { + //#region import.meta.webpackHot.* API compilation.dependencyFactories.set( - EntryDependency, + ImportMetaHotAcceptDependency, normalModuleFactory ); - } - ); + compilation.dependencyTemplates.set( + ImportMetaHotAcceptDependency, + new ImportMetaHotAcceptDependency.Template() + ); + compilation.dependencyFactories.set( + ImportMetaHotDeclineDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + ImportMetaHotDeclineDependency, + new ImportMetaHotDeclineDependency.Template() + ); + //#endregion - compiler.hooks.make.tapPromise( - "DynamicEntryPlugin", - (compilation, callback) => - Promise.resolve(this.entry()) - .then(entry => { - const promises = []; - for (const name of Object.keys(entry)) { - const desc = entry[name]; - const options = EntryOptionPlugin.entryDescriptionToOptions( - compiler, - name, - desc + let hotIndex = 0; + const fullHashChunkModuleHashes = {}; + const chunkModuleHashes = {}; + + compilation.hooks.record.tap( + "HotModuleReplacementPlugin", + (compilation, records) => { + if (records.hash === compilation.hash) return; + const chunkGraph = compilation.chunkGraph; + records.hash = compilation.hash; + records.hotIndex = hotIndex; + records.fullHashChunkModuleHashes = fullHashChunkModuleHashes; + records.chunkModuleHashes = chunkModuleHashes; + records.chunkHashes = {}; + records.chunkRuntime = {}; + for (const chunk of compilation.chunks) { + records.chunkHashes[chunk.id] = chunk.hash; + records.chunkRuntime[chunk.id] = getRuntimeKey(chunk.runtime); + } + records.chunkModuleIds = {}; + for (const chunk of compilation.chunks) { + records.chunkModuleIds[chunk.id] = Array.from( + chunkGraph.getOrderedChunkModulesIterable( + chunk, + compareModulesById(chunkGraph) + ), + m => chunkGraph.getModuleId(m) ); - for (const entry of desc.import) { - promises.push( - new Promise((resolve, reject) => { - compilation.addEntry( - this.context, - EntryPlugin.createDependency(entry, options), - options, - err => { - if (err) return reject(err); - resolve(); - } - ); - }) + } + } + ); + /** @type {TupleSet<[Module, Chunk]>} */ + const updatedModules = new TupleSet(); + /** @type {TupleSet<[Module, Chunk]>} */ + const fullHashModules = new TupleSet(); + /** @type {TupleSet<[Module, RuntimeSpec]>} */ + const nonCodeGeneratedModules = new TupleSet(); + compilation.hooks.fullHash.tap("HotModuleReplacementPlugin", hash => { + const chunkGraph = compilation.chunkGraph; + const records = compilation.records; + for (const chunk of compilation.chunks) { + const getModuleHash = module => { + if ( + compilation.codeGenerationResults.has(module, chunk.runtime) + ) { + return compilation.codeGenerationResults.getHash( + module, + chunk.runtime ); + } else { + nonCodeGeneratedModules.add(module, chunk.runtime); + return chunkGraph.getModuleHash(module, chunk.runtime); + } + }; + const fullHashModulesInThisChunk = + chunkGraph.getChunkFullHashModulesSet(chunk); + if (fullHashModulesInThisChunk !== undefined) { + for (const module of fullHashModulesInThisChunk) { + fullHashModules.add(module, chunk); } } - return Promise.all(promises); - }) - .then(x => {}) - ); - } -} - -module.exports = DynamicEntryPlugin; - - -/***/ }), - -/***/ 9909: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescription */ -/** @typedef {import("../declarations/WebpackOptions").EntryNormalized} Entry */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ - -class EntryOptionPlugin { - /** - * @param {Compiler} compiler the compiler instance one is tapping into - * @returns {void} - */ - apply(compiler) { - compiler.hooks.entryOption.tap("EntryOptionPlugin", (context, entry) => { - EntryOptionPlugin.applyEntryOption(compiler, context, entry); - return true; - }); - } - - /** - * @param {Compiler} compiler the compiler - * @param {string} context context directory - * @param {Entry} entry request - * @returns {void} - */ - static applyEntryOption(compiler, context, entry) { - if (typeof entry === "function") { - const DynamicEntryPlugin = __webpack_require__(96475); - new DynamicEntryPlugin(context, entry).apply(compiler); - } else { - const EntryPlugin = __webpack_require__(96953); - for (const name of Object.keys(entry)) { - const desc = entry[name]; - const options = EntryOptionPlugin.entryDescriptionToOptions( - compiler, - name, - desc - ); - for (const entry of desc.import) { - new EntryPlugin(context, entry, options).apply(compiler); - } - } - } - } - - /** - * @param {Compiler} compiler the compiler - * @param {string} name entry name - * @param {EntryDescription} desc entry description - * @returns {EntryOptions} options for the entry - */ - static entryDescriptionToOptions(compiler, name, desc) { - /** @type {EntryOptions} */ - const options = { - name, - filename: desc.filename, - runtime: desc.runtime, - layer: desc.layer, - dependOn: desc.dependOn, - publicPath: desc.publicPath, - chunkLoading: desc.chunkLoading, - asyncChunks: desc.asyncChunks, - wasmLoading: desc.wasmLoading, - library: desc.library - }; - if (desc.layer !== undefined && !compiler.options.experiments.layers) { - throw new Error( - "'entryOptions.layer' is only allowed when 'experiments.layers' is enabled" - ); - } - if (desc.chunkLoading) { - const EnableChunkLoadingPlugin = __webpack_require__(61291); - EnableChunkLoadingPlugin.checkEnabled(compiler, desc.chunkLoading); - } - if (desc.wasmLoading) { - const EnableWasmLoadingPlugin = __webpack_require__(78613); - EnableWasmLoadingPlugin.checkEnabled(compiler, desc.wasmLoading); - } - if (desc.library) { - const EnableLibraryPlugin = __webpack_require__(91452); - EnableLibraryPlugin.checkEnabled(compiler, desc.library.type); - } - return options; - } -} - -module.exports = EntryOptionPlugin; - - -/***/ }), - -/***/ 96953: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + const modules = chunkGraph.getChunkModulesIterable(chunk); + if (modules !== undefined) { + if (records.chunkModuleHashes) { + if (fullHashModulesInThisChunk !== undefined) { + for (const module of modules) { + const key = `${chunk.id}|${module.identifier()}`; + const hash = getModuleHash(module); + if ( + fullHashModulesInThisChunk.has( + /** @type {RuntimeModule} */ (module) + ) + ) { + if (records.fullHashChunkModuleHashes[key] !== hash) { + updatedModules.add(module, chunk); + } + fullHashChunkModuleHashes[key] = hash; + } else { + if (records.chunkModuleHashes[key] !== hash) { + updatedModules.add(module, chunk); + } + chunkModuleHashes[key] = hash; + } + } + } else { + for (const module of modules) { + const key = `${chunk.id}|${module.identifier()}`; + const hash = getModuleHash(module); + if (records.chunkModuleHashes[key] !== hash) { + updatedModules.add(module, chunk); + } + chunkModuleHashes[key] = hash; + } + } + } else { + if (fullHashModulesInThisChunk !== undefined) { + for (const module of modules) { + const key = `${chunk.id}|${module.identifier()}`; + const hash = getModuleHash(module); + if ( + fullHashModulesInThisChunk.has( + /** @type {RuntimeModule} */ (module) + ) + ) { + fullHashChunkModuleHashes[key] = hash; + } else { + chunkModuleHashes[key] = hash; + } + } + } else { + for (const module of modules) { + const key = `${chunk.id}|${module.identifier()}`; + const hash = getModuleHash(module); + chunkModuleHashes[key] = hash; + } + } + } + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + hotIndex = records.hotIndex || 0; + if (updatedModules.size > 0) hotIndex++; + hash.update(`${hotIndex}`); + }); + compilation.hooks.processAssets.tap( + { + name: "HotModuleReplacementPlugin", + stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL + }, + () => { + const chunkGraph = compilation.chunkGraph; + const records = compilation.records; + if (records.hash === compilation.hash) return; + if ( + !records.chunkModuleHashes || + !records.chunkHashes || + !records.chunkModuleIds + ) { + return; + } + for (const [module, chunk] of fullHashModules) { + const key = `${chunk.id}|${module.identifier()}`; + const hash = nonCodeGeneratedModules.has(module, chunk.runtime) + ? chunkGraph.getModuleHash(module, chunk.runtime) + : compilation.codeGenerationResults.getHash( + module, + chunk.runtime + ); + if (records.chunkModuleHashes[key] !== hash) { + updatedModules.add(module, chunk); + } + chunkModuleHashes[key] = hash; + } + /** @type {Map, removedChunkIds: Set, removedModules: Set, filename: string, assetInfo: AssetInfo }>} */ + const hotUpdateMainContentByRuntime = new Map(); + let allOldRuntime; + for (const key of Object.keys(records.chunkRuntime)) { + const runtime = keyToRuntime(records.chunkRuntime[key]); + allOldRuntime = mergeRuntimeOwned(allOldRuntime, runtime); + } + forEachRuntime(allOldRuntime, runtime => { + const { path: filename, info: assetInfo } = + compilation.getPathWithInfo( + compilation.outputOptions.hotUpdateMainFilename, + { + hash: records.hash, + runtime + } + ); + hotUpdateMainContentByRuntime.set(runtime, { + updatedChunkIds: new Set(), + removedChunkIds: new Set(), + removedModules: new Set(), + filename, + assetInfo + }); + }); + if (hotUpdateMainContentByRuntime.size === 0) return; -const EntryDependency = __webpack_require__(3979); + // Create a list of all active modules to verify which modules are removed completely + /** @type {Map} */ + const allModules = new Map(); + for (const module of compilation.modules) { + const id = chunkGraph.getModuleId(module); + allModules.set(id, module); + } -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ + // List of completely removed modules + /** @type {Set} */ + const completelyRemovedModules = new Set(); -class EntryPlugin { - /** - * An entry plugin which will handle - * creation of the EntryDependency - * - * @param {string} context context path - * @param {string} entry entry path - * @param {EntryOptions | string=} options entry options (passing a string is deprecated) - */ - constructor(context, entry, options) { - this.context = context; - this.entry = entry; - this.options = options || ""; - } + for (const key of Object.keys(records.chunkHashes)) { + const oldRuntime = keyToRuntime(records.chunkRuntime[key]); + /** @type {Module[]} */ + const remainingModules = []; + // Check which modules are removed + for (const id of records.chunkModuleIds[key]) { + const module = allModules.get(id); + if (module === undefined) { + completelyRemovedModules.add(id); + } else { + remainingModules.push(module); + } + } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "EntryPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - EntryDependency, - normalModuleFactory + let chunkId; + let newModules; + let newRuntimeModules; + let newFullHashModules; + let newDependentHashModules; + let newRuntime; + let removedFromRuntime; + const currentChunk = find( + compilation.chunks, + chunk => `${chunk.id}` === key + ); + if (currentChunk) { + chunkId = currentChunk.id; + newRuntime = intersectRuntime( + currentChunk.runtime, + allOldRuntime + ); + if (newRuntime === undefined) continue; + newModules = chunkGraph + .getChunkModules(currentChunk) + .filter(module => updatedModules.has(module, currentChunk)); + newRuntimeModules = Array.from( + chunkGraph.getChunkRuntimeModulesIterable(currentChunk) + ).filter(module => updatedModules.has(module, currentChunk)); + const fullHashModules = + chunkGraph.getChunkFullHashModulesIterable(currentChunk); + newFullHashModules = + fullHashModules && + Array.from(fullHashModules).filter(module => + updatedModules.has(module, currentChunk) + ); + const dependentHashModules = + chunkGraph.getChunkDependentHashModulesIterable(currentChunk); + newDependentHashModules = + dependentHashModules && + Array.from(dependentHashModules).filter(module => + updatedModules.has(module, currentChunk) + ); + removedFromRuntime = subtractRuntime(oldRuntime, newRuntime); + } else { + // chunk has completely removed + chunkId = `${+key}` === key ? +key : key; + removedFromRuntime = oldRuntime; + newRuntime = oldRuntime; + } + if (removedFromRuntime) { + // chunk was removed from some runtimes + forEachRuntime(removedFromRuntime, runtime => { + hotUpdateMainContentByRuntime + .get(runtime) + .removedChunkIds.add(chunkId); + }); + // dispose modules from the chunk in these runtimes + // where they are no longer in this runtime + for (const module of remainingModules) { + const moduleKey = `${key}|${module.identifier()}`; + const oldHash = records.chunkModuleHashes[moduleKey]; + const runtimes = chunkGraph.getModuleRuntimes(module); + if (oldRuntime === newRuntime && runtimes.has(newRuntime)) { + // Module is still in the same runtime combination + const hash = nonCodeGeneratedModules.has(module, newRuntime) + ? chunkGraph.getModuleHash(module, newRuntime) + : compilation.codeGenerationResults.getHash( + module, + newRuntime + ); + if (hash !== oldHash) { + if (module.type === "runtime") { + newRuntimeModules = newRuntimeModules || []; + newRuntimeModules.push( + /** @type {RuntimeModule} */ (module) + ); + } else { + newModules = newModules || []; + newModules.push(module); + } + } + } else { + // module is no longer in this runtime combination + // We (incorrectly) assume that it's not in an overlapping runtime combination + // and dispose it from the main runtimes the chunk was removed from + forEachRuntime(removedFromRuntime, runtime => { + // If the module is still used in this runtime, do not dispose it + // This could create a bad runtime state where the module is still loaded, + // but no chunk which contains it. This means we don't receive further HMR updates + // to this module and that's bad. + // TODO force load one of the chunks which contains the module + for (const moduleRuntime of runtimes) { + if (typeof moduleRuntime === "string") { + if (moduleRuntime === runtime) return; + } else if (moduleRuntime !== undefined) { + if (moduleRuntime.has(runtime)) return; + } + } + hotUpdateMainContentByRuntime + .get(runtime) + .removedModules.add(module); + }); + } + } + } + if ( + (newModules && newModules.length > 0) || + (newRuntimeModules && newRuntimeModules.length > 0) + ) { + const hotUpdateChunk = new HotUpdateChunk(); + if (backCompat) + ChunkGraph.setChunkGraphForChunk(hotUpdateChunk, chunkGraph); + hotUpdateChunk.id = chunkId; + hotUpdateChunk.runtime = newRuntime; + if (currentChunk) { + for (const group of currentChunk.groupsIterable) + hotUpdateChunk.addGroup(group); + } + chunkGraph.attachModules(hotUpdateChunk, newModules || []); + chunkGraph.attachRuntimeModules( + hotUpdateChunk, + newRuntimeModules || [] + ); + if (newFullHashModules) { + chunkGraph.attachFullHashModules( + hotUpdateChunk, + newFullHashModules + ); + } + if (newDependentHashModules) { + chunkGraph.attachDependentHashModules( + hotUpdateChunk, + newDependentHashModules + ); + } + const renderManifest = compilation.getRenderManifest({ + chunk: hotUpdateChunk, + hash: records.hash, + fullHash: records.hash, + outputOptions: compilation.outputOptions, + moduleTemplates: compilation.moduleTemplates, + dependencyTemplates: compilation.dependencyTemplates, + codeGenerationResults: compilation.codeGenerationResults, + runtimeTemplate: compilation.runtimeTemplate, + moduleGraph: compilation.moduleGraph, + chunkGraph + }); + for (const entry of renderManifest) { + /** @type {string} */ + let filename; + /** @type {AssetInfo} */ + let assetInfo; + if ("filename" in entry) { + filename = entry.filename; + assetInfo = entry.info; + } else { + ({ path: filename, info: assetInfo } = + compilation.getPathWithInfo( + entry.filenameTemplate, + entry.pathOptions + )); + } + const source = entry.render(); + compilation.additionalChunkAssets.push(filename); + compilation.emitAsset(filename, source, { + hotModuleReplacement: true, + ...assetInfo + }); + if (currentChunk) { + currentChunk.files.add(filename); + compilation.hooks.chunkAsset.call(currentChunk, filename); + } + } + forEachRuntime(newRuntime, runtime => { + hotUpdateMainContentByRuntime + .get(runtime) + .updatedChunkIds.add(chunkId); + }); + } + } + const completelyRemovedModulesArray = Array.from( + completelyRemovedModules + ); + const hotUpdateMainContentByFilename = new Map(); + for (const { + removedChunkIds, + removedModules, + updatedChunkIds, + filename, + assetInfo + } of hotUpdateMainContentByRuntime.values()) { + const old = hotUpdateMainContentByFilename.get(filename); + if ( + old && + (!isSubset(old.removedChunkIds, removedChunkIds) || + !isSubset(old.removedModules, removedModules) || + !isSubset(old.updatedChunkIds, updatedChunkIds)) + ) { + compilation.warnings.push( + new WebpackError(`HotModuleReplacementPlugin +The configured output.hotUpdateMainFilename doesn't lead to unique filenames per runtime and HMR update differs between runtimes. +This might lead to incorrect runtime behavior of the applied update. +To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename option, or use the default config.`) + ); + for (const chunkId of removedChunkIds) + old.removedChunkIds.add(chunkId); + for (const chunkId of removedModules) + old.removedModules.add(chunkId); + for (const chunkId of updatedChunkIds) + old.updatedChunkIds.add(chunkId); + continue; + } + hotUpdateMainContentByFilename.set(filename, { + removedChunkIds, + removedModules, + updatedChunkIds, + assetInfo + }); + } + for (const [ + filename, + { removedChunkIds, removedModules, updatedChunkIds, assetInfo } + ] of hotUpdateMainContentByFilename) { + const hotUpdateMainJson = { + c: Array.from(updatedChunkIds), + r: Array.from(removedChunkIds), + m: + removedModules.size === 0 + ? completelyRemovedModulesArray + : completelyRemovedModulesArray.concat( + Array.from(removedModules, m => + chunkGraph.getModuleId(m) + ) + ) + }; + + const source = new RawSource(JSON.stringify(hotUpdateMainJson)); + compilation.emitAsset(filename, source, { + hotModuleReplacement: true, + ...assetInfo + }); + } + } ); - } - ); - const { entry, options, context } = this; - const dep = EntryPlugin.createDependency(entry, options); + compilation.hooks.additionalTreeRuntimeRequirements.tap( + "HotModuleReplacementPlugin", + (chunk, runtimeRequirements) => { + runtimeRequirements.add(RuntimeGlobals.hmrDownloadManifest); + runtimeRequirements.add(RuntimeGlobals.hmrDownloadUpdateHandlers); + runtimeRequirements.add(RuntimeGlobals.interceptModuleExecution); + runtimeRequirements.add(RuntimeGlobals.moduleCache); + compilation.addRuntimeModule( + chunk, + new HotModuleReplacementRuntimeModule() + ); + } + ); - compiler.hooks.make.tapAsync("EntryPlugin", (compilation, callback) => { - compilation.addEntry(context, dep, options, err => { - callback(err); - }); - }); - } + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("HotModuleReplacementPlugin", parser => { + applyModuleHot(parser); + applyImportMetaHot(parser); + }); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("HotModuleReplacementPlugin", parser => { + applyModuleHot(parser); + }); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("HotModuleReplacementPlugin", parser => { + applyImportMetaHot(parser); + }); - /** - * @param {string} entry entry request - * @param {EntryOptions | string} options entry options (passing string is deprecated) - * @returns {EntryDependency} the dependency - */ - static createDependency(entry, options) { - const dep = new EntryDependency(entry); - // TODO webpack 6 remove string option - dep.loc = { name: typeof options === "object" ? options.name : options }; - return dep; + NormalModule.getCompilationHooks(compilation).loader.tap( + "HotModuleReplacementPlugin", + context => { + context.hot = true; + } + ); + } + ); } } -module.exports = EntryPlugin; +module.exports = HotModuleReplacementPlugin; /***/ }), -/***/ 13795: +/***/ 9597: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -40944,177 +42508,71 @@ module.exports = EntryPlugin; -const ChunkGroup = __webpack_require__(15626); - -/** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescription */ -/** @typedef {import("./Chunk")} Chunk */ - -/** @typedef {{ name?: string } & Omit} EntryOptions */ - -/** - * Entrypoint serves as an encapsulation primitive for chunks that are - * a part of a single ChunkGroup. They represent all bundles that need to be loaded for a - * single instance of a page. Multi-page application architectures will typically yield multiple Entrypoint objects - * inside of the compilation, whereas a Single Page App may only contain one with many lazy-loaded chunks. - */ -class Entrypoint extends ChunkGroup { - /** - * Creates an instance of Entrypoint. - * @param {EntryOptions | string} entryOptions the options for the entrypoint (or name) - * @param {boolean=} initial false, when the entrypoint is not initial loaded - */ - constructor(entryOptions, initial = true) { - if (typeof entryOptions === "string") { - entryOptions = { name: entryOptions }; - } - super({ - name: entryOptions.name - }); - this.options = entryOptions; - /** @type {Chunk=} */ - this._runtimeChunk = undefined; - /** @type {Chunk=} */ - this._entrypointChunk = undefined; - /** @type {boolean} */ - this._initial = initial; - } - - /** - * @returns {boolean} true, when this chunk group will be loaded on initial page load - */ - isInitial() { - return this._initial; - } - - /** - * Sets the runtimeChunk for an entrypoint. - * @param {Chunk} chunk the chunk being set as the runtime chunk. - * @returns {void} - */ - setRuntimeChunk(chunk) { - this._runtimeChunk = chunk; - } - - /** - * Fetches the chunk reference containing the webpack bootstrap code - * @returns {Chunk | null} returns the runtime chunk or null if there is none - */ - getRuntimeChunk() { - if (this._runtimeChunk) return this._runtimeChunk; - for (const parent of this.parentsIterable) { - if (parent instanceof Entrypoint) return parent.getRuntimeChunk(); - } - return null; - } - - /** - * Sets the chunk with the entrypoint modules for an entrypoint. - * @param {Chunk} chunk the chunk being set as the entrypoint chunk. - * @returns {void} - */ - setEntrypointChunk(chunk) { - this._entrypointChunk = chunk; - } +const Chunk = __webpack_require__(39385); - /** - * Returns the chunk which contains the entrypoint modules - * (or at least the execution of them) - * @returns {Chunk} chunk - */ - getEntrypointChunk() { - return this._entrypointChunk; - } +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./util/Hash")} Hash */ - /** - * @param {Chunk} oldChunk chunk to be replaced - * @param {Chunk} newChunk New chunk that will be replaced with - * @returns {boolean} returns true if the replacement was successful - */ - replaceChunk(oldChunk, newChunk) { - if (this._runtimeChunk === oldChunk) this._runtimeChunk = newChunk; - if (this._entrypointChunk === oldChunk) this._entrypointChunk = newChunk; - return super.replaceChunk(oldChunk, newChunk); +class HotUpdateChunk extends Chunk { + constructor() { + super(); } } -module.exports = Entrypoint; +module.exports = HotUpdateChunk; /***/ }), -/***/ 22070: +/***/ 3: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Authors Simen Brekken @simenbrekken, Einar Löve @einarlove + Author Ivan Kopeykin @vankop */ -const DefinePlugin = __webpack_require__(79065); -const WebpackError = __webpack_require__(53799); +const ModuleFactory = __webpack_require__(51010); -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./DefinePlugin").CodeValue} CodeValue */ +/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ +/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ +/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ -class EnvironmentPlugin { - constructor(...keys) { - if (keys.length === 1 && Array.isArray(keys[0])) { - this.keys = keys[0]; - this.defaultValues = {}; - } else if (keys.length === 1 && keys[0] && typeof keys[0] === "object") { - this.keys = Object.keys(keys[0]); - this.defaultValues = keys[0]; - } else { - this.keys = keys; - this.defaultValues = {}; - } +/** + * Ignores error when module is unresolved + */ +class IgnoreErrorModuleFactory extends ModuleFactory { + /** + * @param {NormalModuleFactory} normalModuleFactory normalModuleFactory instance + */ + constructor(normalModuleFactory) { + super(); + + this.normalModuleFactory = normalModuleFactory; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {ModuleFactoryCreateData} data data object + * @param {function(Error=, ModuleFactoryResult=): void} callback callback * @returns {void} */ - apply(compiler) { - /** @type {Record} */ - const definitions = {}; - for (const key of this.keys) { - const value = - process.env[key] !== undefined - ? process.env[key] - : this.defaultValues[key]; - - if (value === undefined) { - compiler.hooks.thisCompilation.tap("EnvironmentPlugin", compilation => { - const error = new WebpackError( - `EnvironmentPlugin - ${key} environment variable is undefined.\n\n` + - "You can pass an object with default values to suppress this warning.\n" + - "See https://webpack.js.org/plugins/environment-plugin for example." - ); - - error.name = "EnvVariableNotDefinedError"; - compilation.errors.push(error); - }); - } - - definitions[`process.env.${key}`] = - value === undefined ? "undefined" : JSON.stringify(value); - } - - new DefinePlugin(definitions).apply(compiler); + create(data, callback) { + this.normalModuleFactory.create(data, (err, result) => { + return callback(null, result); + }); } } -module.exports = EnvironmentPlugin; +module.exports = IgnoreErrorModuleFactory; /***/ }), -/***/ 59985: -/***/ (function(__unused_webpack_module, exports) { +/***/ 84808: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -41124,66 +42582,88 @@ module.exports = EnvironmentPlugin; -const loaderFlag = "LOADER_EXECUTION"; +const createSchemaValidation = __webpack_require__(32540); -const webpackOptionsFlag = "WEBPACK_OPTIONS"; +/** @typedef {import("../declarations/plugins/IgnorePlugin").IgnorePluginOptions} IgnorePluginOptions */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./NormalModuleFactory").ResolveData} ResolveData */ -exports.cutOffByFlag = (stack, flag) => { - stack = stack.split("\n"); - for (let i = 0; i < stack.length; i++) { - if (stack[i].includes(flag)) { - stack.length = i; - } +const validate = createSchemaValidation( + __webpack_require__(20858), + () => __webpack_require__(3098), + { + name: "Ignore Plugin", + baseDataPath: "options" } - return stack.join("\n"); -}; +); -exports.cutOffLoaderExecution = stack => - exports.cutOffByFlag(stack, loaderFlag); +class IgnorePlugin { + /** + * @param {IgnorePluginOptions} options IgnorePlugin options + */ + constructor(options) { + validate(options); + this.options = options; -exports.cutOffWebpackOptions = stack => - exports.cutOffByFlag(stack, webpackOptionsFlag); + /** @private @type {Function} */ + this.checkIgnore = this.checkIgnore.bind(this); + } -exports.cutOffMultilineMessage = (stack, message) => { - stack = stack.split("\n"); - message = message.split("\n"); - - const result = []; - - stack.forEach((line, idx) => { - if (!line.includes(message[idx])) result.push(line); - }); - - return result.join("\n"); -}; + /** + * Note that if "contextRegExp" is given, both the "resourceRegExp" + * and "contextRegExp" have to match. + * + * @param {ResolveData} resolveData resolve data + * @returns {false|undefined} returns false when the request should be ignored, otherwise undefined + */ + checkIgnore(resolveData) { + if ( + "checkResource" in this.options && + this.options.checkResource && + this.options.checkResource(resolveData.request, resolveData.context) + ) { + return false; + } -exports.cutOffMessage = (stack, message) => { - const nextLine = stack.indexOf("\n"); - if (nextLine === -1) { - return stack === message ? "" : stack; - } else { - const firstLine = stack.substr(0, nextLine); - return firstLine === message ? stack.substr(nextLine + 1) : stack; + if ( + "resourceRegExp" in this.options && + this.options.resourceRegExp && + this.options.resourceRegExp.test(resolveData.request) + ) { + if ("contextRegExp" in this.options && this.options.contextRegExp) { + // if "contextRegExp" is given, + // both the "resourceRegExp" and "contextRegExp" have to match. + if (this.options.contextRegExp.test(resolveData.context)) { + return false; + } + } else { + return false; + } + } } -}; -exports.cleanUp = (stack, message) => { - stack = exports.cutOffLoaderExecution(stack); - stack = exports.cutOffMessage(stack, message); - return stack; -}; + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.normalModuleFactory.tap("IgnorePlugin", nmf => { + nmf.hooks.beforeResolve.tap("IgnorePlugin", this.checkIgnore); + }); + compiler.hooks.contextModuleFactory.tap("IgnorePlugin", cmf => { + cmf.hooks.beforeResolve.tap("IgnorePlugin", this.checkIgnore); + }); + } +} -exports.cleanUpWebpackOptions = (stack, message) => { - stack = exports.cutOffWebpackOptions(stack); - stack = exports.cutOffMultilineMessage(stack, message); - return stack; -}; +module.exports = IgnorePlugin; /***/ }), -/***/ 65218: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 7373: +/***/ (function(module) { "use strict"; /* @@ -41193,335 +42673,212 @@ exports.cleanUpWebpackOptions = (stack, message) => { -const { ConcatSource, RawSource } = __webpack_require__(51255); -const ExternalModule = __webpack_require__(73071); -const ModuleFilenameHelpers = __webpack_require__(88821); -const RuntimeGlobals = __webpack_require__(16475); -const JavascriptModulesPlugin = __webpack_require__(89464); - -/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").IgnoreWarningsNormalized} IgnoreWarningsNormalized */ /** @typedef {import("./Compiler")} Compiler */ -/** @type {WeakMap} */ -const cache = new WeakMap(); - -const devtoolWarning = new RawSource(`/* - * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). - * This devtool is neither made for production nor for readable output files. - * It uses "eval()" calls to create a separate source file in the browser devtools. - * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) - * or disable the default devtool with "devtool: false". - * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). - */ -`); - -class EvalDevToolModulePlugin { - constructor(options) { - this.namespace = options.namespace || ""; - this.sourceUrlComment = options.sourceUrlComment || "\n//# sourceURL=[url]"; - this.moduleFilenameTemplate = - options.moduleFilenameTemplate || - "webpack://[namespace]/[resourcePath]?[loaders]"; +class IgnoreWarningsPlugin { + /** + * @param {IgnoreWarningsNormalized} ignoreWarnings conditions to ignore warnings + */ + constructor(ignoreWarnings) { + this._ignoreWarnings = ignoreWarnings; } - /** * Apply the plugin * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap("EvalDevToolModulePlugin", compilation => { - const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); - hooks.renderModuleContent.tap( - "EvalDevToolModulePlugin", - (source, module, { runtimeTemplate, chunkGraph }) => { - const cacheEntry = cache.get(source); - if (cacheEntry !== undefined) return cacheEntry; - if (module instanceof ExternalModule) { - cache.set(source, source); - return source; - } - const content = source.source(); - const str = ModuleFilenameHelpers.createFilename( - module, - { - moduleFilenameTemplate: this.moduleFilenameTemplate, - namespace: this.namespace - }, - { - requestShortener: runtimeTemplate.requestShortener, - chunkGraph, - hashFunction: compilation.outputOptions.hashFunction - } - ); - const footer = - "\n" + - this.sourceUrlComment.replace( - /\[url\]/g, - encodeURI(str) - .replace(/%2F/g, "/") - .replace(/%20/g, "_") - .replace(/%5E/g, "^") - .replace(/%5C/g, "\\") - .replace(/^\//, "") + compiler.hooks.compilation.tap("IgnoreWarningsPlugin", compilation => { + compilation.hooks.processWarnings.tap( + "IgnoreWarningsPlugin", + warnings => { + return warnings.filter(warning => { + return !this._ignoreWarnings.some(ignore => + ignore(warning, compilation) ); - const result = new RawSource( - `eval(${ - compilation.outputOptions.trustedTypes - ? `${RuntimeGlobals.createScript}(${JSON.stringify( - content + footer - )})` - : JSON.stringify(content + footer) - });` - ); - cache.set(source, result); - return result; + }); } ); - hooks.inlineInRuntimeBailout.tap( - "EvalDevToolModulePlugin", - () => "the eval devtool is used." - ); - hooks.render.tap( - "EvalDevToolModulePlugin", - source => new ConcatSource(devtoolWarning, source) - ); - hooks.chunkHash.tap("EvalDevToolModulePlugin", (chunk, hash) => { - hash.update("EvalDevToolModulePlugin"); - hash.update("2"); - }); - if (compilation.outputOptions.trustedTypes) { - compilation.hooks.additionalModuleRuntimeRequirements.tap( - "EvalDevToolModulePlugin", - (module, set, context) => { - set.add(RuntimeGlobals.createScript); - } - ); - } }); } } -module.exports = EvalDevToolModulePlugin; +module.exports = IgnoreWarningsPlugin; /***/ }), -/***/ 14790: +/***/ 55870: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Florent Cailhol @ooflorent */ -const { ConcatSource, RawSource } = __webpack_require__(51255); -const ModuleFilenameHelpers = __webpack_require__(88821); -const NormalModule = __webpack_require__(39); -const RuntimeGlobals = __webpack_require__(16475); -const SourceMapDevToolModuleOptionsPlugin = __webpack_require__(97513); -const JavascriptModulesPlugin = __webpack_require__(89464); -const ConcatenatedModule = __webpack_require__(97198); -const { makePathsAbsolute } = __webpack_require__(82186); +const { ConcatSource } = __webpack_require__(51255); +const makeSerializable = __webpack_require__(33032); /** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").DevTool} DevToolOptions */ -/** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */ -/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Generator").GenerateContext} GenerateContext */ -/** @type {WeakMap} */ -const cache = new WeakMap(); +/** + * @param {InitFragment} fragment the init fragment + * @param {number} index index + * @returns {[InitFragment, number]} tuple with both + */ +const extractFragmentIndex = (fragment, index) => [fragment, index]; -const devtoolWarning = new RawSource(`/* - * ATTENTION: An "eval-source-map" devtool has been used. - * This devtool is neither made for production nor for readable output files. - * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools. - * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) - * or disable the default devtool with "devtool: false". - * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). +/** + * @param {[InitFragment, number]} a first pair + * @param {[InitFragment, number]} b second pair + * @returns {number} sort value */ -`); +const sortFragmentWithIndex = ([a, i], [b, j]) => { + const stageCmp = a.stage - b.stage; + if (stageCmp !== 0) return stageCmp; + const positionCmp = a.position - b.position; + if (positionCmp !== 0) return positionCmp; + return i - j; +}; -class EvalSourceMapDevToolPlugin { +/** + * @template Context + */ +class InitFragment { /** - * @param {SourceMapDevToolPluginOptions|string} inputOptions Options object + * @param {string|Source} content the source code that will be included as initialization code + * @param {number} stage category of initialization code (contribute to order) + * @param {number} position position in the category (contribute to order) + * @param {string=} key unique key to avoid emitting the same initialization code twice + * @param {string|Source=} endContent the source code that will be included at the end of the module */ - constructor(inputOptions) { - /** @type {SourceMapDevToolPluginOptions} */ - let options; - if (typeof inputOptions === "string") { - options = { - append: inputOptions - }; - } else { - options = inputOptions; - } - this.sourceMapComment = - options.append || "//# sourceURL=[module]\n//# sourceMappingURL=[url]"; - this.moduleFilenameTemplate = - options.moduleFilenameTemplate || - "webpack://[namespace]/[resource-path]?[hash]"; - this.namespace = options.namespace || ""; - this.options = options; + constructor(content, stage, position, key, endContent) { + this.content = content; + this.stage = stage; + this.position = position; + this.key = key; + this.endContent = endContent; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {Context} context context + * @returns {string|Source} the source code that will be included as initialization code */ - apply(compiler) { - const options = this.options; - compiler.hooks.compilation.tap( - "EvalSourceMapDevToolPlugin", - compilation => { - const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); - new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation); - const matchModule = ModuleFilenameHelpers.matchObject.bind( - ModuleFilenameHelpers, - options - ); - hooks.renderModuleContent.tap( - "EvalSourceMapDevToolPlugin", - (source, m, { runtimeTemplate, chunkGraph }) => { - const cachedSource = cache.get(source); - if (cachedSource !== undefined) { - return cachedSource; - } - - const result = r => { - cache.set(source, r); - return r; - }; - - if (m instanceof NormalModule) { - const module = /** @type {NormalModule} */ (m); - if (!matchModule(module.resource)) { - return result(source); - } - } else if (m instanceof ConcatenatedModule) { - const concatModule = /** @type {ConcatenatedModule} */ (m); - if (concatModule.rootModule instanceof NormalModule) { - const module = /** @type {NormalModule} */ ( - concatModule.rootModule - ); - if (!matchModule(module.resource)) { - return result(source); - } - } else { - return result(source); - } - } else { - return result(source); - } - - /** @type {{ [key: string]: TODO; }} */ - let sourceMap; - let content; - if (source.sourceAndMap) { - const sourceAndMap = source.sourceAndMap(options); - sourceMap = sourceAndMap.map; - content = sourceAndMap.source; - } else { - sourceMap = source.map(options); - content = source.source(); - } - if (!sourceMap) { - return result(source); - } + getContent(context) { + return this.content; + } - // Clone (flat) the sourcemap to ensure that the mutations below do not persist. - sourceMap = { ...sourceMap }; - const context = compiler.options.context; - const root = compiler.root; - const modules = sourceMap.sources.map(source => { - if (!source.startsWith("webpack://")) return source; - source = makePathsAbsolute(context, source.slice(10), root); - const module = compilation.findModule(source); - return module || source; - }); - let moduleFilenames = modules.map(module => { - return ModuleFilenameHelpers.createFilename( - module, - { - moduleFilenameTemplate: this.moduleFilenameTemplate, - namespace: this.namespace - }, - { - requestShortener: runtimeTemplate.requestShortener, - chunkGraph, - hashFunction: compilation.outputOptions.hashFunction - } - ); - }); - moduleFilenames = ModuleFilenameHelpers.replaceDuplicates( - moduleFilenames, - (filename, i, n) => { - for (let j = 0; j < n; j++) filename += "*"; - return filename; - } - ); - sourceMap.sources = moduleFilenames; - sourceMap.sourceRoot = options.sourceRoot || ""; - const moduleId = chunkGraph.getModuleId(m); - sourceMap.file = `${moduleId}.js`; + /** + * @param {Context} context context + * @returns {string|Source=} the source code that will be included at the end of the module + */ + getEndContent(context) { + return this.endContent; + } - const footer = - this.sourceMapComment.replace( - /\[url\]/g, - `data:application/json;charset=utf-8;base64,${Buffer.from( - JSON.stringify(sourceMap), - "utf8" - ).toString("base64")}` - ) + `\n//# sourceURL=webpack-internal:///${moduleId}\n`; // workaround for chrome bug + static addToSource(source, initFragments, context) { + if (initFragments.length > 0) { + // Sort fragments by position. If 2 fragments have the same position, + // use their index. + const sortedFragments = initFragments + .map(extractFragmentIndex) + .sort(sortFragmentWithIndex); - return result( - new RawSource( - `eval(${ - compilation.outputOptions.trustedTypes - ? `${RuntimeGlobals.createScript}(${JSON.stringify( - content + footer - )})` - : JSON.stringify(content + footer) - });` - ) + // Deduplicate fragments. If a fragment has no key, it is always included. + const keyedFragments = new Map(); + for (const [fragment] of sortedFragments) { + if (typeof fragment.mergeAll === "function") { + if (!fragment.key) { + throw new Error( + `InitFragment with mergeAll function must have a valid key: ${fragment.constructor.name}` ); } - ); - hooks.inlineInRuntimeBailout.tap( - "EvalDevToolModulePlugin", - () => "the eval-source-map devtool is used." - ); - hooks.render.tap( - "EvalSourceMapDevToolPlugin", - source => new ConcatSource(devtoolWarning, source) - ); - hooks.chunkHash.tap("EvalSourceMapDevToolPlugin", (chunk, hash) => { - hash.update("EvalSourceMapDevToolPlugin"); - hash.update("2"); - }); - if (compilation.outputOptions.trustedTypes) { - compilation.hooks.additionalModuleRuntimeRequirements.tap( - "EvalSourceMapDevToolPlugin", - (module, set, context) => { - set.add(RuntimeGlobals.createScript); - } - ); + const oldValue = keyedFragments.get(fragment.key); + if (oldValue === undefined) { + keyedFragments.set(fragment.key, fragment); + } else if (Array.isArray(oldValue)) { + oldValue.push(fragment); + } else { + keyedFragments.set(fragment.key, [oldValue, fragment]); + } + continue; + } else if (typeof fragment.merge === "function") { + const oldValue = keyedFragments.get(fragment.key); + if (oldValue !== undefined) { + keyedFragments.set(fragment.key, fragment.merge(oldValue)); + continue; + } } + keyedFragments.set(fragment.key || Symbol(), fragment); } - ); + + const concatSource = new ConcatSource(); + const endContents = []; + for (let fragment of keyedFragments.values()) { + if (Array.isArray(fragment)) { + fragment = fragment[0].mergeAll(fragment); + } + concatSource.add(fragment.getContent(context)); + const endContent = fragment.getEndContent(context); + if (endContent) { + endContents.push(endContent); + } + } + + concatSource.add(source); + for (const content of endContents.reverse()) { + concatSource.add(content); + } + return concatSource; + } else { + return source; + } + } + + serialize(context) { + const { write } = context; + + write(this.content); + write(this.stage); + write(this.position); + write(this.key); + write(this.endContent); + } + + deserialize(context) { + const { read } = context; + + this.content = read(); + this.stage = read(); + this.position = read(); + this.key = read(); + this.endContent = read(); } } -module.exports = EvalSourceMapDevToolPlugin; +makeSerializable(InitFragment, "webpack/lib/InitFragment"); + +InitFragment.prototype.merge = undefined; + +InitFragment.STAGE_CONSTANTS = 10; +InitFragment.STAGE_ASYNC_BOUNDARY = 20; +InitFragment.STAGE_HARMONY_EXPORTS = 30; +InitFragment.STAGE_HARMONY_IMPORTS = 40; +InitFragment.STAGE_PROVIDES = 50; +InitFragment.STAGE_ASYNC_DEPENDENCIES = 60; +InitFragment.STAGE_ASYNC_HARMONY_IMPORTS = 70; + +module.exports = InitFragment; /***/ }), -/***/ 63686: +/***/ 68257: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -41532,2349 +42889,2097 @@ module.exports = EvalSourceMapDevToolPlugin; -const { equals } = __webpack_require__(84953); -const SortableSet = __webpack_require__(13098); +const WebpackError = __webpack_require__(53799); const makeSerializable = __webpack_require__(33032); -const { forEachRuntime } = __webpack_require__(17156); -/** @typedef {import("./Dependency").RuntimeSpec} RuntimeSpec */ +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ /** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("./util/Hash")} Hash */ -/** @typedef {typeof UsageState.OnlyPropertiesUsed | typeof UsageState.NoInfo | typeof UsageState.Unknown | typeof UsageState.Used} RuntimeUsageStateType */ -/** @typedef {typeof UsageState.Unused | RuntimeUsageStateType} UsageStateType */ +class InvalidDependenciesModuleWarning extends WebpackError { + /** + * @param {Module} module module tied to dependency + * @param {Iterable} deps invalid dependencies + */ + constructor(module, deps) { + const orderedDeps = deps ? Array.from(deps).sort() : []; + const depsList = orderedDeps.map(dep => ` * ${JSON.stringify(dep)}`); + super(`Invalid dependencies have been reported by plugins or loaders for this module. All reported dependencies need to be absolute paths. +Invalid dependencies may lead to broken watching and caching. +As best effort we try to convert all invalid values to absolute paths and converting globs into context dependencies, but this is deprecated behavior. +Loaders: Pass absolute paths to this.addDependency (existing files), this.addMissingDependency (not existing files), and this.addContextDependency (directories). +Plugins: Pass absolute paths to fileDependencies (existing files), missingDependencies (not existing files), and contextDependencies (directories). +Globs: They are not supported. Pass absolute path to the directory as context dependencies. +The following invalid values have been reported: +${depsList.slice(0, 3).join("\n")}${ + depsList.length > 3 ? "\n * and more ..." : "" + }`); -const UsageState = Object.freeze({ - Unused: /** @type {0} */ (0), - OnlyPropertiesUsed: /** @type {1} */ (1), - NoInfo: /** @type {2} */ (2), - Unknown: /** @type {3} */ (3), - Used: /** @type {4} */ (4) -}); + this.name = "InvalidDependenciesModuleWarning"; + this.details = depsList.slice(3).join("\n"); + this.module = module; + } +} -const RETURNS_TRUE = () => true; +makeSerializable( + InvalidDependenciesModuleWarning, + "webpack/lib/InvalidDependenciesModuleWarning" +); -const CIRCULAR = Symbol("circular target"); +module.exports = InvalidDependenciesModuleWarning; -class RestoreProvidedData { - constructor( - exports, - otherProvided, - otherCanMangleProvide, - otherTerminalBinding - ) { - this.exports = exports; - this.otherProvided = otherProvided; - this.otherCanMangleProvide = otherCanMangleProvide; - this.otherTerminalBinding = otherTerminalBinding; - } - serialize({ write }) { - write(this.exports); - write(this.otherProvided); - write(this.otherCanMangleProvide); - write(this.otherTerminalBinding); - } +/***/ }), - static deserialize({ read }) { - return new RestoreProvidedData(read(), read(), read(), read()); - } -} +/***/ 52329: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -makeSerializable( - RestoreProvidedData, - "webpack/lib/ModuleGraph", - "RestoreProvidedData" -); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Sergey Melyukov @smelukov +*/ -class ExportsInfo { - constructor() { - /** @type {Map} */ - this._exports = new Map(); - this._otherExportsInfo = new ExportInfo(null); - this._sideEffectsOnlyInfo = new ExportInfo("*side effects only*"); - this._exportsAreOrdered = false; - /** @type {ExportsInfo=} */ - this._redirectTo = undefined; - } - /** - * @returns {Iterable} all owned exports in any order - */ - get ownedExports() { - return this._exports.values(); - } - /** - * @returns {Iterable} all owned exports in order - */ - get orderedOwnedExports() { - if (!this._exportsAreOrdered) { - this._sortExports(); - } - return this._exports.values(); - } +const InnerGraph = __webpack_require__(38988); - /** - * @returns {Iterable} all exports in any order - */ - get exports() { - if (this._redirectTo !== undefined) { - const map = new Map(this._redirectTo._exports); - for (const [key, value] of this._exports) { - map.set(key, value); - } - return map.values(); - } - return this._exports.values(); - } +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ +class JavascriptMetaInfoPlugin { /** - * @returns {Iterable} all exports in order + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - get orderedExports() { - if (!this._exportsAreOrdered) { - this._sortExports(); - } - if (this._redirectTo !== undefined) { - const map = new Map( - Array.from(this._redirectTo.orderedExports, item => [item.name, item]) - ); - for (const [key, value] of this._exports) { - map.set(key, value); + apply(compiler) { + compiler.hooks.compilation.tap( + "JavascriptMetaInfoPlugin", + (compilation, { normalModuleFactory }) => { + /** + * @param {JavascriptParser} parser the parser + * @returns {void} + */ + const handler = parser => { + parser.hooks.call.for("eval").tap("JavascriptMetaInfoPlugin", () => { + parser.state.module.buildInfo.moduleConcatenationBailout = "eval()"; + parser.state.module.buildInfo.usingEval = true; + const currentSymbol = InnerGraph.getTopLevelSymbol(parser.state); + if (currentSymbol) { + InnerGraph.addUsage(parser.state, null, currentSymbol); + } else { + InnerGraph.bailout(parser.state); + } + }); + parser.hooks.finish.tap("JavascriptMetaInfoPlugin", () => { + let topLevelDeclarations = + parser.state.module.buildInfo.topLevelDeclarations; + if (topLevelDeclarations === undefined) { + topLevelDeclarations = + parser.state.module.buildInfo.topLevelDeclarations = new Set(); + } + for (const name of parser.scope.definitions.asSet()) { + const freeInfo = parser.getFreeInfoFromVariable(name); + if (freeInfo === undefined) { + topLevelDeclarations.add(name); + } + } + }); + }; + + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("JavascriptMetaInfoPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("JavascriptMetaInfoPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("JavascriptMetaInfoPlugin", handler); } - // sorting should be pretty fast as map contains - // a lot of presorted items - this._sortExportsMap(map); - return map.values(); - } - return this._exports.values(); + ); } +} - /** - * @returns {ExportInfo} the export info of unlisted exports - */ - get otherExportsInfo() { - if (this._redirectTo !== undefined) - return this._redirectTo.otherExportsInfo; - return this._otherExportsInfo; - } +module.exports = JavascriptMetaInfoPlugin; - _sortExportsMap(exports) { - if (exports.size > 1) { - const namesInOrder = []; - for (const entry of exports.values()) { - namesInOrder.push(entry.name); - } - namesInOrder.sort(); - let i = 0; - for (const entry of exports.values()) { - const name = namesInOrder[i]; - if (entry.name !== name) break; - i++; - } - for (; i < namesInOrder.length; i++) { - const name = namesInOrder[i]; - const correctEntry = exports.get(name); - exports.delete(name); - exports.set(name, correctEntry); - } - } - } - _sortExports() { - this._sortExportsMap(this._exports); - this._exportsAreOrdered = true; - } +/***/ }), - setRedirectNamedTo(exportsInfo) { - if (this._redirectTo === exportsInfo) return false; - this._redirectTo = exportsInfo; - return true; - } +/***/ 93837: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - setHasProvideInfo() { - for (const exportInfo of this._exports.values()) { - if (exportInfo.provided === undefined) { - exportInfo.provided = false; - } - if (exportInfo.canMangleProvide === undefined) { - exportInfo.canMangleProvide = true; - } - } - if (this._redirectTo !== undefined) { - this._redirectTo.setHasProvideInfo(); - } else { - if (this._otherExportsInfo.provided === undefined) { - this._otherExportsInfo.provided = false; - } - if (this._otherExportsInfo.canMangleProvide === undefined) { - this._otherExportsInfo.canMangleProvide = true; - } - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - setHasUseInfo() { - for (const exportInfo of this._exports.values()) { - exportInfo.setHasUseInfo(); - } - this._sideEffectsOnlyInfo.setHasUseInfo(); - if (this._redirectTo !== undefined) { - this._redirectTo.setHasUseInfo(); - } else { - this._otherExportsInfo.setHasUseInfo(); - if (this._otherExportsInfo.canMangleUse === undefined) { - this._otherExportsInfo.canMangleUse = true; - } - } - } - /** - * @param {string} name export name - * @returns {ExportInfo} export info for this name - */ - getOwnExportInfo(name) { - const info = this._exports.get(name); - if (info !== undefined) return info; - const newInfo = new ExportInfo(name, this._otherExportsInfo); - this._exports.set(name, newInfo); - this._exportsAreOrdered = false; - return newInfo; + +const asyncLib = __webpack_require__(78175); +const EntryDependency = __webpack_require__(3979); +const { someInIterable } = __webpack_require__(39104); +const { compareModulesById } = __webpack_require__(29579); +const { dirname, mkdirp } = __webpack_require__(17139); + +/** @typedef {import("./Compiler")} Compiler */ + +/** + * @typedef {Object} ManifestModuleData + * @property {string | number} id + * @property {Object} buildMeta + * @property {boolean | string[]} exports + */ + +class LibManifestPlugin { + constructor(options) { + this.options = options; } /** - * @param {string} name export name - * @returns {ExportInfo} export info for this name + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - getExportInfo(name) { - const info = this._exports.get(name); - if (info !== undefined) return info; - if (this._redirectTo !== undefined) - return this._redirectTo.getExportInfo(name); - const newInfo = new ExportInfo(name, this._otherExportsInfo); - this._exports.set(name, newInfo); - this._exportsAreOrdered = false; - return newInfo; + apply(compiler) { + compiler.hooks.emit.tapAsync( + "LibManifestPlugin", + (compilation, callback) => { + const moduleGraph = compilation.moduleGraph; + asyncLib.forEach( + Array.from(compilation.chunks), + (chunk, callback) => { + if (!chunk.canBeInitial()) { + callback(); + return; + } + const chunkGraph = compilation.chunkGraph; + const targetPath = compilation.getPath(this.options.path, { + chunk + }); + const name = + this.options.name && + compilation.getPath(this.options.name, { + chunk + }); + const content = Object.create(null); + for (const module of chunkGraph.getOrderedChunkModulesIterable( + chunk, + compareModulesById(chunkGraph) + )) { + if ( + this.options.entryOnly && + !someInIterable( + moduleGraph.getIncomingConnections(module), + c => c.dependency instanceof EntryDependency + ) + ) { + continue; + } + const ident = module.libIdent({ + context: this.options.context || compiler.options.context, + associatedObjectForCache: compiler.root + }); + if (ident) { + const exportsInfo = moduleGraph.getExportsInfo(module); + const providedExports = exportsInfo.getProvidedExports(); + /** @type {ManifestModuleData} */ + const data = { + id: chunkGraph.getModuleId(module), + buildMeta: module.buildMeta, + exports: Array.isArray(providedExports) + ? providedExports + : undefined + }; + content[ident] = data; + } + } + const manifest = { + name, + type: this.options.type, + content + }; + // Apply formatting to content if format flag is true; + const manifestContent = this.options.format + ? JSON.stringify(manifest, null, 2) + : JSON.stringify(manifest); + const buffer = Buffer.from(manifestContent, "utf8"); + mkdirp( + compiler.intermediateFileSystem, + dirname(compiler.intermediateFileSystem, targetPath), + err => { + if (err) return callback(err); + compiler.intermediateFileSystem.writeFile( + targetPath, + buffer, + callback + ); + } + ); + }, + callback + ); + } + ); } +} +module.exports = LibManifestPlugin; + + +/***/ }), + +/***/ 14157: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + +const EnableLibraryPlugin = __webpack_require__(91452); + +/** @typedef {import("../declarations/WebpackOptions").AuxiliaryComment} AuxiliaryComment */ +/** @typedef {import("../declarations/WebpackOptions").LibraryExport} LibraryExport */ +/** @typedef {import("../declarations/WebpackOptions").LibraryName} LibraryName */ +/** @typedef {import("../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../declarations/WebpackOptions").UmdNamedDefine} UmdNamedDefine */ +/** @typedef {import("./Compiler")} Compiler */ + +// TODO webpack 6 remove +class LibraryTemplatePlugin { /** - * @param {string} name export name - * @returns {ExportInfo} export info for this name + * @param {LibraryName} name name of library + * @param {LibraryType} target type of library + * @param {UmdNamedDefine} umdNamedDefine setting this to true will name the UMD module + * @param {AuxiliaryComment} auxiliaryComment comment in the UMD wrapper + * @param {LibraryExport} exportProperty which export should be exposed as library */ - getReadOnlyExportInfo(name) { - const info = this._exports.get(name); - if (info !== undefined) return info; - if (this._redirectTo !== undefined) - return this._redirectTo.getReadOnlyExportInfo(name); - return this._otherExportsInfo; + constructor(name, target, umdNamedDefine, auxiliaryComment, exportProperty) { + this.library = { + type: target || "var", + name, + umdNamedDefine, + auxiliaryComment, + export: exportProperty + }; } /** - * @param {string[]} name export name - * @returns {ExportInfo | undefined} export info for this name + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - getReadOnlyExportInfoRecursive(name) { - const exportInfo = this.getReadOnlyExportInfo(name[0]); - if (name.length === 1) return exportInfo; - if (!exportInfo.exportsInfo) return undefined; - return exportInfo.exportsInfo.getReadOnlyExportInfoRecursive(name.slice(1)); + apply(compiler) { + const { output } = compiler.options; + output.library = this.library; + new EnableLibraryPlugin(this.library.type).apply(compiler); } +} +module.exports = LibraryTemplatePlugin; + + +/***/ }), + +/***/ 22078: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ModuleFilenameHelpers = __webpack_require__(88821); +const NormalModule = __webpack_require__(39); +const createSchemaValidation = __webpack_require__(32540); + +/** @typedef {import("../declarations/plugins/LoaderOptionsPlugin").LoaderOptionsPluginOptions} LoaderOptionsPluginOptions */ +/** @typedef {import("./Compiler")} Compiler */ + +const validate = createSchemaValidation( + __webpack_require__(24160), + () => __webpack_require__(15965), + { + name: "Loader Options Plugin", + baseDataPath: "options" + } +); +class LoaderOptionsPlugin { /** - * @param {string[]=} name the export name - * @returns {ExportsInfo | undefined} the nested exports info + * @param {LoaderOptionsPluginOptions} options options object */ - getNestedExportsInfo(name) { - if (Array.isArray(name) && name.length > 0) { - const info = this.getReadOnlyExportInfo(name[0]); - if (!info.exportsInfo) return undefined; - return info.exportsInfo.getNestedExportsInfo(name.slice(1)); + constructor(options = {}) { + validate(options); + if (typeof options !== "object") options = {}; + if (!options.test) { + options.test = { + test: () => true + }; } - return this; + this.options = options; } /** - * @param {boolean=} canMangle true, if exports can still be mangled (defaults to false) - * @param {Set=} excludeExports list of unaffected exports - * @param {any=} targetKey use this as key for the target - * @param {ModuleGraphConnection=} targetModule set this module as target - * @param {number=} priority priority - * @returns {boolean} true, if this call changed something + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - setUnknownExportsProvided( - canMangle, - excludeExports, - targetKey, - targetModule, - priority - ) { - let changed = false; - if (excludeExports) { - for (const name of excludeExports) { - // Make sure these entries exist, so they can get different info - this.getExportInfo(name); - } - } - for (const exportInfo of this._exports.values()) { - if (!canMangle && exportInfo.canMangleProvide !== false) { - exportInfo.canMangleProvide = false; - changed = true; - } - if (excludeExports && excludeExports.has(exportInfo.name)) continue; - if (exportInfo.provided !== true && exportInfo.provided !== null) { - exportInfo.provided = null; - changed = true; - } - if (targetKey) { - exportInfo.setTarget(targetKey, targetModule, [exportInfo.name], -1); - } - } - if (this._redirectTo !== undefined) { - if ( - this._redirectTo.setUnknownExportsProvided( - canMangle, - excludeExports, - targetKey, - targetModule, - priority - ) - ) { - changed = true; - } - } else { - if ( - this._otherExportsInfo.provided !== true && - this._otherExportsInfo.provided !== null - ) { - this._otherExportsInfo.provided = null; - changed = true; - } - if (!canMangle && this._otherExportsInfo.canMangleProvide !== false) { - this._otherExportsInfo.canMangleProvide = false; - changed = true; - } - if (targetKey) { - this._otherExportsInfo.setTarget( - targetKey, - targetModule, - undefined, - priority - ); - } - } - return changed; + apply(compiler) { + const options = this.options; + compiler.hooks.compilation.tap("LoaderOptionsPlugin", compilation => { + NormalModule.getCompilationHooks(compilation).loader.tap( + "LoaderOptionsPlugin", + (context, module) => { + const resource = module.resource; + if (!resource) return; + const i = resource.indexOf("?"); + if ( + ModuleFilenameHelpers.matchObject( + options, + i < 0 ? resource : resource.substr(0, i) + ) + ) { + for (const key of Object.keys(options)) { + if (key === "include" || key === "exclude" || key === "test") { + continue; + } + context[key] = options[key]; + } + } + } + ); + }); } +} - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true, when something changed - */ - setUsedInUnknownWay(runtime) { - let changed = false; - for (const exportInfo of this._exports.values()) { - if (exportInfo.setUsedInUnknownWay(runtime)) { - changed = true; - } - } - if (this._redirectTo !== undefined) { - if (this._redirectTo.setUsedInUnknownWay(runtime)) { - changed = true; - } - } else { - if ( - this._otherExportsInfo.setUsedConditionally( - used => used < UsageState.Unknown, - UsageState.Unknown, - runtime - ) - ) { - changed = true; - } - if (this._otherExportsInfo.canMangleUse !== false) { - this._otherExportsInfo.canMangleUse = false; - changed = true; - } - } - return changed; - } +module.exports = LoaderOptionsPlugin; - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true, when something changed - */ - setUsedWithoutInfo(runtime) { - let changed = false; - for (const exportInfo of this._exports.values()) { - if (exportInfo.setUsedWithoutInfo(runtime)) { - changed = true; - } - } - if (this._redirectTo !== undefined) { - if (this._redirectTo.setUsedWithoutInfo(runtime)) { - changed = true; - } - } else { - if (this._otherExportsInfo.setUsed(UsageState.NoInfo, runtime)) { - changed = true; - } - if (this._otherExportsInfo.canMangleUse !== false) { - this._otherExportsInfo.canMangleUse = false; - changed = true; - } - } - return changed; - } - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true, when something changed - */ - setAllKnownExportsUsed(runtime) { - let changed = false; - for (const exportInfo of this._exports.values()) { - if (!exportInfo.provided) continue; - if (exportInfo.setUsed(UsageState.Used, runtime)) { - changed = true; - } - } - return changed; - } +/***/ }), - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true, when something changed - */ - setUsedForSideEffectsOnly(runtime) { - return this._sideEffectsOnlyInfo.setUsedConditionally( - used => used === UsageState.Unused, - UsageState.Used, - runtime - ); - } +/***/ 86738: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true, when the module exports are used in any way - */ - isUsed(runtime) { - if (this._redirectTo !== undefined) { - if (this._redirectTo.isUsed(runtime)) { - return true; - } - } else { - if (this._otherExportsInfo.getUsed(runtime) !== UsageState.Unused) { - return true; - } - } - for (const exportInfo of this._exports.values()) { - if (exportInfo.getUsed(runtime) !== UsageState.Unused) { - return true; - } - } - return false; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true, when the module is used in any way - */ - isModuleUsed(runtime) { - if (this.isUsed(runtime)) return true; - if (this._sideEffectsOnlyInfo.getUsed(runtime) !== UsageState.Unused) - return true; - return false; - } + +const NormalModule = __webpack_require__(39); + +/** @typedef {import("./Compiler")} Compiler */ + +class LoaderTargetPlugin { /** - * @param {RuntimeSpec} runtime the runtime - * @returns {SortableSet | boolean | null} set of used exports, or true (when namespace object is used), or false (when unused), or null (when unknown) + * @param {string} target the target */ - getUsedExports(runtime) { - if (!this._redirectTo !== undefined) { - switch (this._otherExportsInfo.getUsed(runtime)) { - case UsageState.NoInfo: - return null; - case UsageState.Unknown: - case UsageState.OnlyPropertiesUsed: - case UsageState.Used: - return true; - } - } - const array = []; - if (!this._exportsAreOrdered) this._sortExports(); - for (const exportInfo of this._exports.values()) { - switch (exportInfo.getUsed(runtime)) { - case UsageState.NoInfo: - return null; - case UsageState.Unknown: - return true; - case UsageState.OnlyPropertiesUsed: - case UsageState.Used: - array.push(exportInfo.name); - } - } - if (this._redirectTo !== undefined) { - const inner = this._redirectTo.getUsedExports(runtime); - if (inner === null) return null; - if (inner === true) return true; - if (inner !== false) { - for (const item of inner) { - array.push(item); - } - } - } - if (array.length === 0) { - switch (this._sideEffectsOnlyInfo.getUsed(runtime)) { - case UsageState.NoInfo: - return null; - case UsageState.Unused: - return false; - } - } - return new SortableSet(array); + constructor(target) { + this.target = target; } /** - * @returns {null | true | string[]} list of exports when known + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - getProvidedExports() { - if (!this._redirectTo !== undefined) { - switch (this._otherExportsInfo.provided) { - case undefined: - return null; - case null: - return true; - case true: - return true; - } - } - const array = []; - if (!this._exportsAreOrdered) this._sortExports(); - for (const exportInfo of this._exports.values()) { - switch (exportInfo.provided) { - case undefined: - return null; - case null: - return true; - case true: - array.push(exportInfo.name); - } - } - if (this._redirectTo !== undefined) { - const inner = this._redirectTo.getProvidedExports(); - if (inner === null) return null; - if (inner === true) return true; - for (const item of inner) { - if (!array.includes(item)) { - array.push(item); + apply(compiler) { + compiler.hooks.compilation.tap("LoaderTargetPlugin", compilation => { + NormalModule.getCompilationHooks(compilation).loader.tap( + "LoaderTargetPlugin", + loaderContext => { + loaderContext.target = this.target; } - } - } - return array; + ); + }); } +} - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {ExportInfo[]} exports that are relevant (not unused and potential provided) - */ - getRelevantExports(runtime) { - const list = []; - for (const exportInfo of this._exports.values()) { - const used = exportInfo.getUsed(runtime); - if (used === UsageState.Unused) continue; - if (exportInfo.provided === false) continue; - list.push(exportInfo); - } - if (this._redirectTo !== undefined) { - for (const exportInfo of this._redirectTo.getRelevantExports(runtime)) { - if (!this._exports.has(exportInfo.name)) list.push(exportInfo); - } - } - if ( - this._otherExportsInfo.provided !== false && - this._otherExportsInfo.getUsed(runtime) !== UsageState.Unused - ) { - list.push(this._otherExportsInfo); - } - return list; - } +module.exports = LoaderTargetPlugin; - /** - * @param {string | string[]} name the name of the export - * @returns {boolean | undefined | null} if the export is provided - */ - isExportProvided(name) { - if (Array.isArray(name)) { - const info = this.getReadOnlyExportInfo(name[0]); - if (info.exportsInfo && name.length > 1) { - return info.exportsInfo.isExportProvided(name.slice(1)); - } - return info.provided; - } - const info = this.getReadOnlyExportInfo(name); - return info.provided; - } - /** - * @param {RuntimeSpec} runtime runtime - * @returns {string} key representing the usage - */ - getUsageKey(runtime) { - const key = []; - if (this._redirectTo !== undefined) { - key.push(this._redirectTo.getUsageKey(runtime)); - } else { - key.push(this._otherExportsInfo.getUsed(runtime)); - } - key.push(this._sideEffectsOnlyInfo.getUsed(runtime)); - for (const exportInfo of this.orderedOwnedExports) { - key.push(exportInfo.getUsed(runtime)); - } - return key.join("|"); - } +/***/ }), - /** - * @param {RuntimeSpec} runtimeA first runtime - * @param {RuntimeSpec} runtimeB second runtime - * @returns {boolean} true, when equally used - */ - isEquallyUsed(runtimeA, runtimeB) { - if (this._redirectTo !== undefined) { - if (!this._redirectTo.isEquallyUsed(runtimeA, runtimeB)) return false; - } else { - if ( - this._otherExportsInfo.getUsed(runtimeA) !== - this._otherExportsInfo.getUsed(runtimeB) - ) { - return false; - } - } - if ( - this._sideEffectsOnlyInfo.getUsed(runtimeA) !== - this._sideEffectsOnlyInfo.getUsed(runtimeB) - ) { - return false; - } - for (const exportInfo of this.ownedExports) { - if (exportInfo.getUsed(runtimeA) !== exportInfo.getUsed(runtimeB)) - return false; - } - return true; - } +/***/ 12856: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {string | string[]} name export name - * @param {RuntimeSpec} runtime check usage for this runtime only - * @returns {UsageStateType} usage status - */ - getUsed(name, runtime) { - if (Array.isArray(name)) { - if (name.length === 0) return this.otherExportsInfo.getUsed(runtime); - let info = this.getReadOnlyExportInfo(name[0]); - if (info.exportsInfo && name.length > 1) { - return info.exportsInfo.getUsed(name.slice(1), runtime); - } - return info.getUsed(runtime); - } - let info = this.getReadOnlyExportInfo(name); - return info.getUsed(runtime); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {string | string[]} name the export name - * @param {RuntimeSpec} runtime check usage for this runtime only - * @returns {string | string[] | false} the used name - */ - getUsedName(name, runtime) { - if (Array.isArray(name)) { - // TODO improve this - if (name.length === 0) { - if (!this.isUsed(runtime)) return false; - return name; - } - let info = this.getReadOnlyExportInfo(name[0]); - const x = info.getUsedName(name[0], runtime); - if (x === false) return false; - const arr = x === name[0] && name.length === 1 ? name : [x]; - if (name.length === 1) { - return arr; - } - if ( - info.exportsInfo && - info.getUsed(runtime) === UsageState.OnlyPropertiesUsed - ) { - const nested = info.exportsInfo.getUsedName(name.slice(1), runtime); - if (!nested) return false; - return arr.concat(nested); - } else { - return arr.concat(name.slice(1)); - } - } else { - let info = this.getReadOnlyExportInfo(name); - const usedName = info.getUsedName(name, runtime); - return usedName; - } - } - /** - * @param {Hash} hash the hash - * @param {RuntimeSpec} runtime the runtime - * @returns {void} - */ - updateHash(hash, runtime) { - this._updateHash(hash, runtime, new Set()); - } +const { SyncWaterfallHook } = __webpack_require__(6967); +const util = __webpack_require__(73837); +const RuntimeGlobals = __webpack_require__(16475); +const memoize = __webpack_require__(78676); + +/** @typedef {import("webpack-sources").ConcatSource} ConcatSource */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").Output} OutputOptions */ +/** @typedef {import("./ModuleTemplate")} ModuleTemplate */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("./Module")} Module} */ +/** @typedef {import("./util/Hash")} Hash} */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates} */ +/** @typedef {import("./javascript/JavascriptModulesPlugin").RenderContext} RenderContext} */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate} */ +/** @typedef {import("./ModuleGraph")} ModuleGraph} */ +/** @typedef {import("./ChunkGraph")} ChunkGraph} */ +/** @typedef {import("./Template").RenderManifestOptions} RenderManifestOptions} */ +/** @typedef {import("./Template").RenderManifestEntry} RenderManifestEntry} */ + +const getJavascriptModulesPlugin = memoize(() => + __webpack_require__(89464) +); +const getJsonpTemplatePlugin = memoize(() => + __webpack_require__(4607) +); +const getLoadScriptRuntimeModule = memoize(() => + __webpack_require__(19942) +); + +// TODO webpack 6 remove this class +class MainTemplate { /** - * @param {Hash} hash the hash - * @param {RuntimeSpec} runtime the runtime - * @param {Set} alreadyVisitedExportsInfo for circular references - * @returns {void} + * + * @param {OutputOptions} outputOptions output options for the MainTemplate + * @param {Compilation} compilation the compilation */ - _updateHash(hash, runtime, alreadyVisitedExportsInfo) { - const set = new Set(alreadyVisitedExportsInfo); - set.add(this); - for (const exportInfo of this.orderedExports) { - if (exportInfo.hasInfo(this._otherExportsInfo, runtime)) { - exportInfo._updateHash(hash, runtime, set); - } - } - this._sideEffectsOnlyInfo._updateHash(hash, runtime, set); - this._otherExportsInfo._updateHash(hash, runtime, set); - if (this._redirectTo !== undefined) { - this._redirectTo._updateHash(hash, runtime, set); - } - } + constructor(outputOptions, compilation) { + /** @type {OutputOptions} */ + this._outputOptions = outputOptions || {}; + this.hooks = Object.freeze({ + renderManifest: { + tap: util.deprecate( + (options, fn) => { + compilation.hooks.renderManifest.tap( + options, + (entries, options) => { + if (!options.chunk.hasRuntime()) return entries; + return fn(entries, options); + } + ); + }, + "MainTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_RENDER_MANIFEST" + ) + }, + modules: { + tap: () => { + throw new Error( + "MainTemplate.hooks.modules has been removed (there is no replacement, please create an issue to request that)" + ); + } + }, + moduleObj: { + tap: () => { + throw new Error( + "MainTemplate.hooks.moduleObj has been removed (there is no replacement, please create an issue to request that)" + ); + } + }, + require: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .renderRequire.tap(options, fn); + }, + "MainTemplate.hooks.require is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderRequire instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_REQUIRE" + ) + }, + beforeStartup: { + tap: () => { + throw new Error( + "MainTemplate.hooks.beforeStartup has been removed (use RuntimeGlobals.startupOnlyBefore instead)" + ); + } + }, + startup: { + tap: () => { + throw new Error( + "MainTemplate.hooks.startup has been removed (use RuntimeGlobals.startup instead)" + ); + } + }, + afterStartup: { + tap: () => { + throw new Error( + "MainTemplate.hooks.afterStartup has been removed (use RuntimeGlobals.startupOnlyAfter instead)" + ); + } + }, + render: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .render.tap(options, (source, renderContext) => { + if ( + renderContext.chunkGraph.getNumberOfEntryModules( + renderContext.chunk + ) === 0 || + !renderContext.chunk.hasRuntime() + ) { + return source; + } + return fn( + source, + renderContext.chunk, + compilation.hash, + compilation.moduleTemplates.javascript, + compilation.dependencyTemplates + ); + }); + }, + "MainTemplate.hooks.render is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_RENDER" + ) + }, + renderWithEntry: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .render.tap(options, (source, renderContext) => { + if ( + renderContext.chunkGraph.getNumberOfEntryModules( + renderContext.chunk + ) === 0 || + !renderContext.chunk.hasRuntime() + ) { + return source; + } + return fn(source, renderContext.chunk, compilation.hash); + }); + }, + "MainTemplate.hooks.renderWithEntry is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_RENDER_WITH_ENTRY" + ) + }, + assetPath: { + tap: util.deprecate( + (options, fn) => { + compilation.hooks.assetPath.tap(options, fn); + }, + "MainTemplate.hooks.assetPath is deprecated (use Compilation.hooks.assetPath instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_ASSET_PATH" + ), + call: util.deprecate( + (filename, options) => { + return compilation.getAssetPath(filename, options); + }, + "MainTemplate.hooks.assetPath is deprecated (use Compilation.hooks.assetPath instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_ASSET_PATH" + ) + }, + hash: { + tap: util.deprecate( + (options, fn) => { + compilation.hooks.fullHash.tap(options, fn); + }, + "MainTemplate.hooks.hash is deprecated (use Compilation.hooks.fullHash instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_HASH" + ) + }, + hashForChunk: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .chunkHash.tap(options, (chunk, hash) => { + if (!chunk.hasRuntime()) return; + return fn(hash, chunk); + }); + }, + "MainTemplate.hooks.hashForChunk is deprecated (use JavascriptModulesPlugin.getCompilationHooks().chunkHash instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK" + ) + }, + globalHashPaths: { + tap: util.deprecate( + () => {}, + "MainTemplate.hooks.globalHashPaths has been removed (it's no longer needed)", + "DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK" + ) + }, + globalHash: { + tap: util.deprecate( + () => {}, + "MainTemplate.hooks.globalHash has been removed (it's no longer needed)", + "DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK" + ) + }, + hotBootstrap: { + tap: () => { + throw new Error( + "MainTemplate.hooks.hotBootstrap has been removed (use your own RuntimeModule instead)" + ); + } + }, - getRestoreProvidedData() { - const otherProvided = this._otherExportsInfo.provided; - const otherCanMangleProvide = this._otherExportsInfo.canMangleProvide; - const otherTerminalBinding = this._otherExportsInfo.terminalBinding; - const exports = []; - for (const exportInfo of this.orderedExports) { - if ( - exportInfo.provided !== otherProvided || - exportInfo.canMangleProvide !== otherCanMangleProvide || - exportInfo.terminalBinding !== otherTerminalBinding || - exportInfo.exportsInfoOwned - ) { - exports.push({ - name: exportInfo.name, - provided: exportInfo.provided, - canMangleProvide: exportInfo.canMangleProvide, - terminalBinding: exportInfo.terminalBinding, - exportsInfo: exportInfo.exportsInfoOwned - ? exportInfo.exportsInfo.getRestoreProvidedData() - : undefined - }); + // for compatibility: + /** @type {SyncWaterfallHook<[string, Chunk, string, ModuleTemplate, DependencyTemplates]>} */ + bootstrap: new SyncWaterfallHook([ + "source", + "chunk", + "hash", + "moduleTemplate", + "dependencyTemplates" + ]), + /** @type {SyncWaterfallHook<[string, Chunk, string]>} */ + localVars: new SyncWaterfallHook(["source", "chunk", "hash"]), + /** @type {SyncWaterfallHook<[string, Chunk, string]>} */ + requireExtensions: new SyncWaterfallHook(["source", "chunk", "hash"]), + /** @type {SyncWaterfallHook<[string, Chunk, string, string]>} */ + requireEnsure: new SyncWaterfallHook([ + "source", + "chunk", + "hash", + "chunkIdExpression" + ]), + get jsonpScript() { + const hooks = + getLoadScriptRuntimeModule().getCompilationHooks(compilation); + return hooks.createScript; + }, + get linkPrefetch() { + const hooks = getJsonpTemplatePlugin().getCompilationHooks(compilation); + return hooks.linkPrefetch; + }, + get linkPreload() { + const hooks = getJsonpTemplatePlugin().getCompilationHooks(compilation); + return hooks.linkPreload; } - } - return new RestoreProvidedData( - exports, - otherProvided, - otherCanMangleProvide, - otherTerminalBinding + }); + + this.renderCurrentHashCode = util.deprecate( + /** + * @deprecated + * @param {string} hash the hash + * @param {number=} length length of the hash + * @returns {string} generated code + */ (hash, length) => { + if (length) { + return `${RuntimeGlobals.getFullHash} ? ${ + RuntimeGlobals.getFullHash + }().slice(0, ${length}) : ${hash.slice(0, length)}`; + } + return `${RuntimeGlobals.getFullHash} ? ${RuntimeGlobals.getFullHash}() : ${hash}`; + }, + "MainTemplate.renderCurrentHashCode is deprecated (use RuntimeGlobals.getFullHash runtime function instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_RENDER_CURRENT_HASH_CODE" ); - } - restoreProvided({ - otherProvided, - otherCanMangleProvide, - otherTerminalBinding, - exports - }) { - let wasEmpty = true; - for (const exportInfo of this._exports.values()) { - wasEmpty = false; - exportInfo.provided = otherProvided; - exportInfo.canMangleProvide = otherCanMangleProvide; - exportInfo.terminalBinding = otherTerminalBinding; - } - this._otherExportsInfo.provided = otherProvided; - this._otherExportsInfo.canMangleProvide = otherCanMangleProvide; - this._otherExportsInfo.terminalBinding = otherTerminalBinding; - for (const exp of exports) { - const exportInfo = this.getExportInfo(exp.name); - exportInfo.provided = exp.provided; - exportInfo.canMangleProvide = exp.canMangleProvide; - exportInfo.terminalBinding = exp.terminalBinding; - if (exp.exportsInfo) { - const exportsInfo = exportInfo.createNestedExportsInfo(); - exportsInfo.restoreProvided(exp.exportsInfo); - } - } - if (wasEmpty) this._exportsAreOrdered = true; + this.getPublicPath = util.deprecate( + /** + * + * @param {object} options get public path options + * @returns {string} hook call + */ options => { + return compilation.getAssetPath( + compilation.outputOptions.publicPath, + options + ); + }, + "MainTemplate.getPublicPath is deprecated (use Compilation.getAssetPath(compilation.outputOptions.publicPath, options) instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_GET_PUBLIC_PATH" + ); + + this.getAssetPath = util.deprecate( + (path, options) => { + return compilation.getAssetPath(path, options); + }, + "MainTemplate.getAssetPath is deprecated (use Compilation.getAssetPath instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_GET_ASSET_PATH" + ); + + this.getAssetPathWithInfo = util.deprecate( + (path, options) => { + return compilation.getAssetPathWithInfo(path, options); + }, + "MainTemplate.getAssetPathWithInfo is deprecated (use Compilation.getAssetPath instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_GET_ASSET_PATH_WITH_INFO" + ); } } -class ExportInfo { - /** - * @param {string} name the original name of the export - * @param {ExportInfo=} initFrom init values from this ExportInfo - */ - constructor(name, initFrom) { - /** @type {string} */ - this.name = name; - /** @private @type {string | null} */ - this._usedName = initFrom ? initFrom._usedName : null; - /** @private @type {UsageStateType} */ - this._globalUsed = initFrom ? initFrom._globalUsed : undefined; - /** @private @type {Map} */ - this._usedInRuntime = - initFrom && initFrom._usedInRuntime - ? new Map(initFrom._usedInRuntime) - : undefined; - /** @private @type {boolean} */ - this._hasUseInRuntimeInfo = initFrom - ? initFrom._hasUseInRuntimeInfo - : false; - /** - * true: it is provided - * false: it is not provided - * null: only the runtime knows if it is provided - * undefined: it was not determined if it is provided - * @type {boolean | null | undefined} - */ - this.provided = initFrom ? initFrom.provided : undefined; - /** - * is the export a terminal binding that should be checked for export star conflicts - * @type {boolean} - */ - this.terminalBinding = initFrom ? initFrom.terminalBinding : false; - /** - * true: it can be mangled - * false: is can not be mangled - * undefined: it was not determined if it can be mangled - * @type {boolean | undefined} - */ - this.canMangleProvide = initFrom ? initFrom.canMangleProvide : undefined; +Object.defineProperty(MainTemplate.prototype, "requireFn", { + get: util.deprecate( + () => "__webpack_require__", + 'MainTemplate.requireFn is deprecated (use "__webpack_require__")', + "DEP_WEBPACK_MAIN_TEMPLATE_REQUIRE_FN" + ) +}); + +Object.defineProperty(MainTemplate.prototype, "outputOptions", { + get: util.deprecate( /** - * true: it can be mangled - * false: is can not be mangled - * undefined: it was not determined if it can be mangled - * @type {boolean | undefined} + * @this {MainTemplate} + * @returns {OutputOptions} output options */ - this.canMangleUse = initFrom ? initFrom.canMangleUse : undefined; - /** @type {boolean} */ - this.exportsInfoOwned = false; - /** @type {ExportsInfo=} */ - this.exportsInfo = undefined; - /** @type {Map=} */ - this._target = undefined; - if (initFrom && initFrom._target) { - this._target = new Map(); - for (const [key, value] of initFrom._target) { - this._target.set(key, { - connection: value.connection, - export: value.export || [name], - priority: value.priority - }); - } - } - /** @type {Map=} */ - this._maxTarget = undefined; - } + function () { + return this._outputOptions; + }, + "MainTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)", + "DEP_WEBPACK_MAIN_TEMPLATE_OUTPUT_OPTIONS" + ) +}); - // TODO webpack 5 remove - /** @private */ - get used() { - throw new Error("REMOVED"); - } - /** @private */ - get usedName() { - throw new Error("REMOVED"); - } - /** - * @private - * @param {*} v v - */ - set used(v) { - throw new Error("REMOVED"); - } - /** - * @private - * @param {*} v v - */ - set usedName(v) { - throw new Error("REMOVED"); - } +module.exports = MainTemplate; - get canMangle() { - switch (this.canMangleProvide) { - case undefined: - return this.canMangleUse === false ? false : undefined; - case false: - return false; - case true: - switch (this.canMangleUse) { - case undefined: - return undefined; - case false: - return false; - case true: - return true; - } - } - throw new Error( - `Unexpected flags for canMangle ${this.canMangleProvide} ${this.canMangleUse}` - ); - } - /** - * @param {RuntimeSpec} runtime only apply to this runtime - * @returns {boolean} true, when something changed - */ - setUsedInUnknownWay(runtime) { - let changed = false; - if ( - this.setUsedConditionally( - used => used < UsageState.Unknown, - UsageState.Unknown, - runtime - ) - ) { - changed = true; - } - if (this.canMangleUse !== false) { - this.canMangleUse = false; - changed = true; - } - return changed; - } +/***/ }), - /** - * @param {RuntimeSpec} runtime only apply to this runtime - * @returns {boolean} true, when something changed - */ - setUsedWithoutInfo(runtime) { - let changed = false; - if (this.setUsed(UsageState.NoInfo, runtime)) { - changed = true; - } - if (this.canMangleUse !== false) { - this.canMangleUse = false; - changed = true; - } - return changed; - } +/***/ 73208: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - setHasUseInfo() { - if (!this._hasUseInRuntimeInfo) { - this._hasUseInRuntimeInfo = true; - } - if (this.canMangleUse === undefined) { - this.canMangleUse = true; - } - if (this.exportsInfoOwned) { - this.exportsInfo.setHasUseInfo(); - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {function(UsageStateType): boolean} condition compare with old value - * @param {UsageStateType} newValue set when condition is true - * @param {RuntimeSpec} runtime only apply to this runtime - * @returns {boolean} true when something has changed - */ - setUsedConditionally(condition, newValue, runtime) { - if (runtime === undefined) { - if (this._globalUsed === undefined) { - this._globalUsed = newValue; - return true; - } else { - if (this._globalUsed !== newValue && condition(this._globalUsed)) { - this._globalUsed = newValue; - return true; - } - } - } else if (this._usedInRuntime === undefined) { - if (newValue !== UsageState.Unused && condition(UsageState.Unused)) { - this._usedInRuntime = new Map(); - forEachRuntime(runtime, runtime => - this._usedInRuntime.set(runtime, newValue) - ); - return true; - } - } else { - let changed = false; - forEachRuntime(runtime, runtime => { - /** @type {UsageStateType} */ - let oldValue = this._usedInRuntime.get(runtime); - if (oldValue === undefined) oldValue = UsageState.Unused; - if (newValue !== oldValue && condition(oldValue)) { - if (newValue === UsageState.Unused) { - this._usedInRuntime.delete(runtime); - } else { - this._usedInRuntime.set(runtime, newValue); - } - changed = true; - } - }); - if (changed) { - if (this._usedInRuntime.size === 0) this._usedInRuntime = undefined; - return true; - } - } - return false; - } - /** - * @param {UsageStateType} newValue new value of the used state - * @param {RuntimeSpec} runtime only apply to this runtime - * @returns {boolean} true when something has changed - */ - setUsed(newValue, runtime) { - if (runtime === undefined) { - if (this._globalUsed !== newValue) { - this._globalUsed = newValue; - return true; - } - } else if (this._usedInRuntime === undefined) { - if (newValue !== UsageState.Unused) { - this._usedInRuntime = new Map(); - forEachRuntime(runtime, runtime => - this._usedInRuntime.set(runtime, newValue) - ); - return true; - } - } else { - let changed = false; - forEachRuntime(runtime, runtime => { - /** @type {UsageStateType} */ - let oldValue = this._usedInRuntime.get(runtime); - if (oldValue === undefined) oldValue = UsageState.Unused; - if (newValue !== oldValue) { - if (newValue === UsageState.Unused) { - this._usedInRuntime.delete(runtime); - } else { - this._usedInRuntime.set(runtime, newValue); - } - changed = true; - } - }); - if (changed) { - if (this._usedInRuntime.size === 0) this._usedInRuntime = undefined; - return true; - } - } - return false; - } - /** - * @param {any} key the key - * @returns {boolean} true, if something has changed - */ - unsetTarget(key) { - if (!this._target) return false; - if (this._target.delete(key)) { - this._maxTarget = undefined; - return true; - } - return false; - } +const util = __webpack_require__(73837); +const ChunkGraph = __webpack_require__(64971); +const DependenciesBlock = __webpack_require__(71040); +const ModuleGraph = __webpack_require__(99988); +const RuntimeGlobals = __webpack_require__(16475); +const { first } = __webpack_require__(93347); +const { compareChunksById } = __webpack_require__(29579); +const makeSerializable = __webpack_require__(33032); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./ChunkGroup")} ChunkGroup */ +/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./ConcatenationScope")} ConcatenationScope */ +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./ExportsInfo").UsageStateType} UsageStateType */ +/** @typedef {import("./FileSystemInfo")} FileSystemInfo */ +/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./util/Hash")} Hash */ +/** @template T @typedef {import("./util/LazySet")} LazySet */ +/** @template T @typedef {import("./util/SortableSet")} SortableSet */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ + +/** + * @typedef {Object} SourceContext + * @property {DependencyTemplates} dependencyTemplates the dependency templates + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {RuntimeSpec} runtime the runtimes code should be generated for + * @property {string=} type the type of source that should be generated + */ + +/** + * @typedef {Object} CodeGenerationContext + * @property {DependencyTemplates} dependencyTemplates the dependency templates + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {RuntimeSpec} runtime the runtimes code should be generated for + * @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules + * @property {CodeGenerationResults} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that) + */ + +/** + * @typedef {Object} ConcatenationBailoutReasonContext + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + */ + +/** + * @typedef {Object} CodeGenerationResult + * @property {Map} sources the resulting sources for all source types + * @property {Map=} data the resulting data for all source types + * @property {ReadonlySet} runtimeRequirements the runtime requirements + * @property {string=} hash a hash of the code generation result (will be automatically calculated from sources and runtimeRequirements if not provided) + */ + +/** + * @typedef {Object} LibIdentOptions + * @property {string} context absolute context path to which lib ident is relative to + * @property {Object=} associatedObjectForCache object for caching + */ + +/** + * @typedef {Object} KnownBuildMeta + * @property {string=} moduleArgument + * @property {string=} exportsArgument + * @property {boolean=} strict + * @property {string=} moduleConcatenationBailout + * @property {("default" | "namespace" | "flagged" | "dynamic")=} exportsType + * @property {(false | "redirect" | "redirect-warn")=} defaultObject + * @property {boolean=} strictHarmonyModule + * @property {boolean=} async + * @property {boolean=} sideEffectFree + */ + +/** + * @typedef {Object} NeedBuildContext + * @property {Compilation} compilation + * @property {FileSystemInfo} fileSystemInfo + * @property {Map>} valueCacheVersions + */ + +/** @typedef {KnownBuildMeta & Record} BuildMeta */ + +const EMPTY_RESOLVE_OPTIONS = {}; + +let debugId = 1000; + +const DEFAULT_TYPES_UNKNOWN = new Set(["unknown"]); +const DEFAULT_TYPES_JS = new Set(["javascript"]); + +const deprecatedNeedRebuild = util.deprecate( + (module, context) => { + return module.needRebuild( + context.fileSystemInfo.getDeprecatedFileTimestamps(), + context.fileSystemInfo.getDeprecatedContextTimestamps() + ); + }, + "Module.needRebuild is deprecated in favor of Module.needBuild", + "DEP_WEBPACK_MODULE_NEED_REBUILD" +); + +/** @typedef {(requestShortener: RequestShortener) => string} OptimizationBailoutFunction */ +class Module extends DependenciesBlock { /** - * @param {any} key the key - * @param {ModuleGraphConnection} connection the target module if a single one - * @param {string[]=} exportName the exported name - * @param {number=} priority priority - * @returns {boolean} true, if something has changed + * @param {string} type the module type + * @param {string=} context an optional context + * @param {string=} layer an optional layer in which the module is */ - setTarget(key, connection, exportName, priority = 0) { - if (exportName) exportName = [...exportName]; - if (!this._target) { - this._target = new Map(); - this._target.set(key, { connection, export: exportName, priority }); - return true; - } - const oldTarget = this._target.get(key); - if (!oldTarget) { - if (oldTarget === null && !connection) return false; - this._target.set(key, { connection, export: exportName, priority }); - this._maxTarget = undefined; - return true; - } - if ( - oldTarget.connection !== connection || - oldTarget.priority !== priority || - (exportName - ? !oldTarget.export || !equals(oldTarget.export, exportName) - : oldTarget.export) - ) { - oldTarget.connection = connection; - oldTarget.export = exportName; - oldTarget.priority = priority; - this._maxTarget = undefined; - return true; - } - return false; + constructor(type, context = null, layer = null) { + super(); + + /** @type {string} */ + this.type = type; + /** @type {string | null} */ + this.context = context; + /** @type {string | null} */ + this.layer = layer; + /** @type {boolean} */ + this.needId = true; + + // Unique Id + /** @type {number} */ + this.debugId = debugId++; + + // Info from Factory + /** @type {ResolveOptions} */ + this.resolveOptions = EMPTY_RESOLVE_OPTIONS; + /** @type {object | undefined} */ + this.factoryMeta = undefined; + // TODO refactor this -> options object filled from Factory + // TODO webpack 6: use an enum + /** @type {boolean} */ + this.useSourceMap = false; + /** @type {boolean} */ + this.useSimpleSourceMap = false; + + // Info from Build + /** @type {WebpackError[] | undefined} */ + this._warnings = undefined; + /** @type {WebpackError[] | undefined} */ + this._errors = undefined; + /** @type {BuildMeta} */ + this.buildMeta = undefined; + /** @type {Record} */ + this.buildInfo = undefined; + /** @type {Dependency[] | undefined} */ + this.presentationalDependencies = undefined; + /** @type {Dependency[] | undefined} */ + this.codeGenerationDependencies = undefined; } - /** - * @param {RuntimeSpec} runtime for this runtime - * @returns {UsageStateType} usage state - */ - getUsed(runtime) { - if (!this._hasUseInRuntimeInfo) return UsageState.NoInfo; - if (this._globalUsed !== undefined) return this._globalUsed; - if (this._usedInRuntime === undefined) { - return UsageState.Unused; - } else if (typeof runtime === "string") { - const value = this._usedInRuntime.get(runtime); - return value === undefined ? UsageState.Unused : value; - } else if (runtime === undefined) { - /** @type {UsageStateType} */ - let max = UsageState.Unused; - for (const value of this._usedInRuntime.values()) { - if (value === UsageState.Used) { - return UsageState.Used; - } - if (max < value) max = value; - } - return max; - } else { - /** @type {UsageStateType} */ - let max = UsageState.Unused; - for (const item of runtime) { - const value = this._usedInRuntime.get(item); - if (value !== undefined) { - if (value === UsageState.Used) { - return UsageState.Used; - } - if (max < value) max = value; - } - } - return max; - } + // TODO remove in webpack 6 + // BACKWARD-COMPAT START + get id() { + return ChunkGraph.getChunkGraphForModule( + this, + "Module.id", + "DEP_WEBPACK_MODULE_ID" + ).getModuleId(this); } - /** - * get used name - * @param {string | undefined} fallbackName fallback name for used exports with no name - * @param {RuntimeSpec} runtime check usage for this runtime only - * @returns {string | false} used name - */ - getUsedName(fallbackName, runtime) { - if (this._hasUseInRuntimeInfo) { - if (this._globalUsed !== undefined) { - if (this._globalUsed === UsageState.Unused) return false; - } else { - if (this._usedInRuntime === undefined) return false; - if (typeof runtime === "string") { - if (!this._usedInRuntime.has(runtime)) { - return false; - } - } else if (runtime !== undefined) { - if ( - Array.from(runtime).every( - runtime => !this._usedInRuntime.has(runtime) - ) - ) { - return false; - } - } - } + set id(value) { + if (value === "") { + this.needId = false; + return; } - if (this._usedName !== null) return this._usedName; - return this.name || fallbackName; + ChunkGraph.getChunkGraphForModule( + this, + "Module.id", + "DEP_WEBPACK_MODULE_ID" + ).setModuleId(this, value); } /** - * @returns {boolean} true, when a mangled name of this export is set + * @returns {string} the hash of the module */ - hasUsedName() { - return this._usedName !== null; + get hash() { + return ChunkGraph.getChunkGraphForModule( + this, + "Module.hash", + "DEP_WEBPACK_MODULE_HASH" + ).getModuleHash(this, undefined); } /** - * Sets the mangled name of this export - * @param {string} name the new name - * @returns {void} + * @returns {string} the shortened hash of the module */ - setUsedName(name) { - this._usedName = name; + get renderedHash() { + return ChunkGraph.getChunkGraphForModule( + this, + "Module.renderedHash", + "DEP_WEBPACK_MODULE_RENDERED_HASH" + ).getRenderedModuleHash(this, undefined); } - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {function({ module: Module, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target - * @returns {ExportInfo | ExportsInfo | undefined} the terminal binding export(s) info if known - */ - getTerminalBinding(moduleGraph, resolveTargetFilter = RETURNS_TRUE) { - if (this.terminalBinding) return this; - const target = this.getTarget(moduleGraph, resolveTargetFilter); - if (!target) return undefined; - const exportsInfo = moduleGraph.getExportsInfo(target.module); - if (!target.export) return exportsInfo; - return exportsInfo.getReadOnlyExportInfoRecursive(target.export); + get profile() { + return ModuleGraph.getModuleGraphForModule( + this, + "Module.profile", + "DEP_WEBPACK_MODULE_PROFILE" + ).getProfile(this); } - isReexport() { - return !this.terminalBinding && this._target && this._target.size > 0; + set profile(value) { + ModuleGraph.getModuleGraphForModule( + this, + "Module.profile", + "DEP_WEBPACK_MODULE_PROFILE" + ).setProfile(this, value); } - _getMaxTarget() { - if (this._maxTarget !== undefined) return this._maxTarget; - if (this._target.size <= 1) return (this._maxTarget = this._target); - let maxPriority = -Infinity; - let minPriority = Infinity; - for (const { priority } of this._target.values()) { - if (maxPriority < priority) maxPriority = priority; - if (minPriority > priority) minPriority = priority; - } - // This should be very common - if (maxPriority === minPriority) return (this._maxTarget = this._target); + get index() { + return ModuleGraph.getModuleGraphForModule( + this, + "Module.index", + "DEP_WEBPACK_MODULE_INDEX" + ).getPreOrderIndex(this); + } - // This is an edge case - const map = new Map(); - for (const [key, value] of this._target) { - if (maxPriority === value.priority) { - map.set(key, value); - } - } - this._maxTarget = map; - return map; + set index(value) { + ModuleGraph.getModuleGraphForModule( + this, + "Module.index", + "DEP_WEBPACK_MODULE_INDEX" + ).setPreOrderIndex(this, value); } - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {function(Module): boolean} validTargetModuleFilter a valid target module - * @returns {{ module: Module, export: string[] | undefined } | undefined | false} the target, undefined when there is no target, false when no target is valid - */ - findTarget(moduleGraph, validTargetModuleFilter) { - return this._findTarget(moduleGraph, validTargetModuleFilter, new Set()); + get index2() { + return ModuleGraph.getModuleGraphForModule( + this, + "Module.index2", + "DEP_WEBPACK_MODULE_INDEX2" + ).getPostOrderIndex(this); } - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {function(Module): boolean} validTargetModuleFilter a valid target module - * @param {Set | undefined} alreadyVisited set of already visited export info to avoid circular references - * @returns {{ module: Module, export: string[] | undefined } | undefined | false} the target, undefined when there is no target, false when no target is valid - */ - _findTarget(moduleGraph, validTargetModuleFilter, alreadyVisited) { - if (!this._target || this._target.size === 0) return undefined; - let rawTarget = this._getMaxTarget().values().next().value; - if (!rawTarget) return undefined; - /** @type {{ module: Module, export: string[] | undefined }} */ - let target = { - module: rawTarget.connection.module, - export: rawTarget.export - }; - for (;;) { - if (validTargetModuleFilter(target.module)) return target; - const exportsInfo = moduleGraph.getExportsInfo(target.module); - const exportInfo = exportsInfo.getExportInfo(target.export[0]); - if (alreadyVisited.has(exportInfo)) return null; - const newTarget = exportInfo._findTarget( - moduleGraph, - validTargetModuleFilter, - alreadyVisited - ); - if (!newTarget) return false; - if (target.export.length === 1) { - target = newTarget; - } else { - target = { - module: newTarget.module, - export: newTarget.export - ? newTarget.export.concat(target.export.slice(1)) - : target.export.slice(1) - }; - } - } + set index2(value) { + ModuleGraph.getModuleGraphForModule( + this, + "Module.index2", + "DEP_WEBPACK_MODULE_INDEX2" + ).setPostOrderIndex(this, value); } - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {function({ module: Module, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target - * @returns {{ module: Module, export: string[] | undefined } | undefined} the target - */ - getTarget(moduleGraph, resolveTargetFilter = RETURNS_TRUE) { - const result = this._getTarget(moduleGraph, resolveTargetFilter, undefined); - if (result === CIRCULAR) return undefined; - return result; + get depth() { + return ModuleGraph.getModuleGraphForModule( + this, + "Module.depth", + "DEP_WEBPACK_MODULE_DEPTH" + ).getDepth(this); } - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {function({ module: Module, connection: ModuleGraphConnection, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target - * @param {Set | undefined} alreadyVisited set of already visited export info to avoid circular references - * @returns {{ module: Module, connection: ModuleGraphConnection, export: string[] | undefined } | CIRCULAR | undefined} the target - */ - _getTarget(moduleGraph, resolveTargetFilter, alreadyVisited) { - /** - * @param {{ connection: ModuleGraphConnection, export: string[] | undefined } | null} inputTarget unresolved target - * @param {Set} alreadyVisited set of already visited export info to avoid circular references - * @returns {{ module: Module, connection: ModuleGraphConnection, export: string[] | undefined } | CIRCULAR | null} resolved target - */ - const resolveTarget = (inputTarget, alreadyVisited) => { - if (!inputTarget) return null; - if (!inputTarget.export) { - return { - module: inputTarget.connection.module, - connection: inputTarget.connection, - export: undefined - }; - } - /** @type {{ module: Module, connection: ModuleGraphConnection, export: string[] | undefined }} */ - let target = { - module: inputTarget.connection.module, - connection: inputTarget.connection, - export: inputTarget.export - }; - if (!resolveTargetFilter(target)) return target; - let alreadyVisitedOwned = false; - for (;;) { - const exportsInfo = moduleGraph.getExportsInfo(target.module); - const exportInfo = exportsInfo.getExportInfo(target.export[0]); - if (!exportInfo) return target; - if (alreadyVisited.has(exportInfo)) return CIRCULAR; - const newTarget = exportInfo._getTarget( - moduleGraph, - resolveTargetFilter, - alreadyVisited - ); - if (newTarget === CIRCULAR) return CIRCULAR; - if (!newTarget) return target; - if (target.export.length === 1) { - target = newTarget; - if (!target.export) return target; - } else { - target = { - module: newTarget.module, - connection: newTarget.connection, - export: newTarget.export - ? newTarget.export.concat(target.export.slice(1)) - : target.export.slice(1) - }; - } - if (!resolveTargetFilter(target)) return target; - if (!alreadyVisitedOwned) { - alreadyVisited = new Set(alreadyVisited); - alreadyVisitedOwned = true; - } - alreadyVisited.add(exportInfo); - } - }; + set depth(value) { + ModuleGraph.getModuleGraphForModule( + this, + "Module.depth", + "DEP_WEBPACK_MODULE_DEPTH" + ).setDepth(this, value); + } - if (!this._target || this._target.size === 0) return undefined; - if (alreadyVisited && alreadyVisited.has(this)) return CIRCULAR; - const newAlreadyVisited = new Set(alreadyVisited); - newAlreadyVisited.add(this); - const values = this._getMaxTarget().values(); - const target = resolveTarget(values.next().value, newAlreadyVisited); - if (target === CIRCULAR) return CIRCULAR; - if (target === null) return undefined; - let result = values.next(); - while (!result.done) { - const t = resolveTarget(result.value, newAlreadyVisited); - if (t === CIRCULAR) return CIRCULAR; - if (t === null) return undefined; - if (t.module !== target.module) return undefined; - if (!t.export !== !target.export) return undefined; - if (target.export && !equals(t.export, target.export)) return undefined; - result = values.next(); - } - return target; + get issuer() { + return ModuleGraph.getModuleGraphForModule( + this, + "Module.issuer", + "DEP_WEBPACK_MODULE_ISSUER" + ).getIssuer(this); + } + + set issuer(value) { + ModuleGraph.getModuleGraphForModule( + this, + "Module.issuer", + "DEP_WEBPACK_MODULE_ISSUER" + ).setIssuer(this, value); + } + + get usedExports() { + return ModuleGraph.getModuleGraphForModule( + this, + "Module.usedExports", + "DEP_WEBPACK_MODULE_USED_EXPORTS" + ).getUsedExports(this, undefined); } /** - * Move the target forward as long resolveTargetFilter is fulfilled - * @param {ModuleGraph} moduleGraph the module graph - * @param {function({ module: Module, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target - * @param {function({ module: Module, export: string[] | undefined }): ModuleGraphConnection=} updateOriginalConnection updates the original connection instead of using the target connection - * @returns {{ module: Module, export: string[] | undefined } | undefined} the resolved target when moved + * @deprecated + * @returns {(string | OptimizationBailoutFunction)[]} list */ - moveTarget(moduleGraph, resolveTargetFilter, updateOriginalConnection) { - const target = this._getTarget(moduleGraph, resolveTargetFilter, undefined); - if (target === CIRCULAR) return undefined; - if (!target) return undefined; - const originalTarget = this._getMaxTarget().values().next().value; - if ( - originalTarget.connection === target.connection && - originalTarget.export === target.export - ) { - return undefined; - } - this._target.clear(); - this._target.set(undefined, { - connection: updateOriginalConnection - ? updateOriginalConnection(target) - : target.connection, - export: target.export, - priority: 0 - }); - return target; + get optimizationBailout() { + return ModuleGraph.getModuleGraphForModule( + this, + "Module.optimizationBailout", + "DEP_WEBPACK_MODULE_OPTIMIZATION_BAILOUT" + ).getOptimizationBailout(this); } - createNestedExportsInfo() { - if (this.exportsInfoOwned) return this.exportsInfo; - this.exportsInfoOwned = true; - const oldExportsInfo = this.exportsInfo; - this.exportsInfo = new ExportsInfo(); - this.exportsInfo.setHasProvideInfo(); - if (oldExportsInfo) { - this.exportsInfo.setRedirectNamedTo(oldExportsInfo); - } - return this.exportsInfo; + get optional() { + return this.isOptional( + ModuleGraph.getModuleGraphForModule( + this, + "Module.optional", + "DEP_WEBPACK_MODULE_OPTIONAL" + ) + ); } - getNestedExportsInfo() { - return this.exportsInfo; + addChunk(chunk) { + const chunkGraph = ChunkGraph.getChunkGraphForModule( + this, + "Module.addChunk", + "DEP_WEBPACK_MODULE_ADD_CHUNK" + ); + if (chunkGraph.isModuleInChunk(this, chunk)) return false; + chunkGraph.connectChunkAndModule(chunk, this); + return true; } - hasInfo(baseInfo, runtime) { - return ( - (this._usedName && this._usedName !== this.name) || - this.provided || - this.terminalBinding || - this.getUsed(runtime) !== baseInfo.getUsed(runtime) - ); + removeChunk(chunk) { + return ChunkGraph.getChunkGraphForModule( + this, + "Module.removeChunk", + "DEP_WEBPACK_MODULE_REMOVE_CHUNK" + ).disconnectChunkAndModule(chunk, this); } - updateHash(hash, runtime) { - this._updateHash(hash, runtime, new Set()); + isInChunk(chunk) { + return ChunkGraph.getChunkGraphForModule( + this, + "Module.isInChunk", + "DEP_WEBPACK_MODULE_IS_IN_CHUNK" + ).isModuleInChunk(this, chunk); } - _updateHash(hash, runtime, alreadyVisitedExportsInfo) { - hash.update( - `${this._usedName || this.name}${this.getUsed(runtime)}${this.provided}${ - this.terminalBinding - }` - ); - if (this.exportsInfo && !alreadyVisitedExportsInfo.has(this.exportsInfo)) { - this.exportsInfo._updateHash(hash, runtime, alreadyVisitedExportsInfo); - } + isEntryModule() { + return ChunkGraph.getChunkGraphForModule( + this, + "Module.isEntryModule", + "DEP_WEBPACK_MODULE_IS_ENTRY_MODULE" + ).isEntryModule(this); } - getUsedInfo() { - if (this._globalUsed !== undefined) { - switch (this._globalUsed) { - case UsageState.Unused: - return "unused"; - case UsageState.NoInfo: - return "no usage info"; - case UsageState.Unknown: - return "maybe used (runtime-defined)"; - case UsageState.Used: - return "used"; - case UsageState.OnlyPropertiesUsed: - return "only properties used"; - } - } else if (this._usedInRuntime !== undefined) { - /** @type {Map} */ - const map = new Map(); - for (const [runtime, used] of this._usedInRuntime) { - const list = map.get(used); - if (list !== undefined) list.push(runtime); - else map.set(used, [runtime]); - } - const specificInfo = Array.from(map, ([used, runtimes]) => { - switch (used) { - case UsageState.NoInfo: - return `no usage info in ${runtimes.join(", ")}`; - case UsageState.Unknown: - return `maybe used in ${runtimes.join(", ")} (runtime-defined)`; - case UsageState.Used: - return `used in ${runtimes.join(", ")}`; - case UsageState.OnlyPropertiesUsed: - return `only properties used in ${runtimes.join(", ")}`; - } - }); - if (specificInfo.length > 0) { - return specificInfo.join("; "); - } - } - return this._hasUseInRuntimeInfo ? "unused" : "no usage info"; + getChunks() { + return ChunkGraph.getChunkGraphForModule( + this, + "Module.getChunks", + "DEP_WEBPACK_MODULE_GET_CHUNKS" + ).getModuleChunks(this); } - getProvidedInfo() { - switch (this.provided) { - case undefined: - return "no provided info"; - case null: - return "maybe provided (runtime-defined)"; - case true: - return "provided"; - case false: - return "not provided"; - } + getNumberOfChunks() { + return ChunkGraph.getChunkGraphForModule( + this, + "Module.getNumberOfChunks", + "DEP_WEBPACK_MODULE_GET_NUMBER_OF_CHUNKS" + ).getNumberOfModuleChunks(this); } - getRenameInfo() { - if (this._usedName !== null && this._usedName !== this.name) { - return `renamed to ${JSON.stringify(this._usedName).slice(1, -1)}`; - } - switch (this.canMangleProvide) { - case undefined: - switch (this.canMangleUse) { - case undefined: - return "missing provision and use info prevents renaming"; - case false: - return "usage prevents renaming (no provision info)"; - case true: - return "missing provision info prevents renaming"; + get chunksIterable() { + return ChunkGraph.getChunkGraphForModule( + this, + "Module.chunksIterable", + "DEP_WEBPACK_MODULE_CHUNKS_ITERABLE" + ).getOrderedModuleChunksIterable(this, compareChunksById); + } + + /** + * @param {string} exportName a name of an export + * @returns {boolean | null} true, if the export is provided why the module. + * null, if it's unknown. + * false, if it's not provided. + */ + isProvided(exportName) { + return ModuleGraph.getModuleGraphForModule( + this, + "Module.usedExports", + "DEP_WEBPACK_MODULE_USED_EXPORTS" + ).isExportProvided(this, exportName); + } + // BACKWARD-COMPAT END + + /** + * @returns {string} name of the exports argument + */ + get exportsArgument() { + return (this.buildInfo && this.buildInfo.exportsArgument) || "exports"; + } + + /** + * @returns {string} name of the module argument + */ + get moduleArgument() { + return (this.buildInfo && this.buildInfo.moduleArgument) || "module"; + } + + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {boolean} strict the importing module is strict + * @returns {"namespace" | "default-only" | "default-with-named" | "dynamic"} export type + * "namespace": Exports is already a namespace object. namespace = exports. + * "dynamic": Check at runtime if __esModule is set. When set: namespace = { ...exports, default: exports }. When not set: namespace = { default: exports }. + * "default-only": Provide a namespace object with only default export. namespace = { default: exports } + * "default-with-named": Provide a namespace object with named and default export. namespace = { ...exports, default: exports } + */ + getExportsType(moduleGraph, strict) { + switch (this.buildMeta && this.buildMeta.exportsType) { + case "flagged": + return strict ? "default-with-named" : "namespace"; + case "namespace": + return "namespace"; + case "default": + switch (this.buildMeta.defaultObject) { + case "redirect": + return "default-with-named"; + case "redirect-warn": + return strict ? "default-only" : "default-with-named"; + default: + return "default-only"; } - break; - case true: - switch (this.canMangleUse) { - case undefined: - return "missing usage info prevents renaming"; - case false: - return "usage prevents renaming"; - case true: - return "could be renamed"; + case "dynamic": { + if (strict) return "default-with-named"; + // Try to figure out value of __esModule by following reexports + const handleDefault = () => { + switch (this.buildMeta.defaultObject) { + case "redirect": + case "redirect-warn": + return "default-with-named"; + default: + return "default-only"; + } + }; + const exportInfo = moduleGraph.getReadOnlyExportInfo( + this, + "__esModule" + ); + if (exportInfo.provided === false) { + return handleDefault(); } - break; - case false: - switch (this.canMangleUse) { - case undefined: - return "provision prevents renaming (no use info)"; - case false: - return "usage and provision prevents renaming"; - case true: - return "provision prevents renaming"; + const target = exportInfo.getTarget(moduleGraph); + if ( + !target || + !target.export || + target.export.length !== 1 || + target.export[0] !== "__esModule" + ) { + return "dynamic"; } - break; + switch ( + target.module.buildMeta && + target.module.buildMeta.exportsType + ) { + case "flagged": + case "namespace": + return "namespace"; + case "default": + return handleDefault(); + default: + return "dynamic"; + } + } + default: + return strict ? "default-with-named" : "dynamic"; } - throw new Error( - `Unexpected flags for getRenameInfo ${this.canMangleProvide} ${this.canMangleUse}` - ); } -} -module.exports = ExportsInfo; -module.exports.ExportInfo = ExportInfo; -module.exports.UsageState = UsageState; + /** + * @param {Dependency} presentationalDependency dependency being tied to module. + * This is a Dependency without edge in the module graph. It's only for presentation. + * @returns {void} + */ + addPresentationalDependency(presentationalDependency) { + if (this.presentationalDependencies === undefined) { + this.presentationalDependencies = []; + } + this.presentationalDependencies.push(presentationalDependency); + } + /** + * @param {Dependency} codeGenerationDependency dependency being tied to module. + * This is a Dependency where the code generation result of the referenced module is needed during code generation. + * The Dependency should also be added to normal dependencies via addDependency. + * @returns {void} + */ + addCodeGenerationDependency(codeGenerationDependency) { + if (this.codeGenerationDependencies === undefined) { + this.codeGenerationDependencies = []; + } + this.codeGenerationDependencies.push(codeGenerationDependency); + } -/***/ }), + /** + * Removes all dependencies and blocks + * @returns {void} + */ + clearDependenciesAndBlocks() { + if (this.presentationalDependencies !== undefined) { + this.presentationalDependencies.length = 0; + } + if (this.codeGenerationDependencies !== undefined) { + this.codeGenerationDependencies.length = 0; + } + super.clearDependenciesAndBlocks(); + } -/***/ 7145: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * @param {WebpackError} warning the warning + * @returns {void} + */ + addWarning(warning) { + if (this._warnings === undefined) { + this._warnings = []; + } + this._warnings.push(warning); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @returns {Iterable | undefined} list of warnings if any + */ + getWarnings() { + return this._warnings; + } + /** + * @returns {number} number of warnings + */ + getNumberOfWarnings() { + return this._warnings !== undefined ? this._warnings.length : 0; + } + /** + * @param {WebpackError} error the error + * @returns {void} + */ + addError(error) { + if (this._errors === undefined) { + this._errors = []; + } + this._errors.push(error); + } -const ConstDependency = __webpack_require__(76911); -const ExportsInfoDependency = __webpack_require__(78988); + /** + * @returns {Iterable | undefined} list of errors if any + */ + getErrors() { + return this._errors; + } -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ + /** + * @returns {number} number of errors + */ + getNumberOfErrors() { + return this._errors !== undefined ? this._errors.length : 0; + } -class ExportsInfoApiPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * removes all warnings and errors * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap( - "ExportsInfoApiPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyTemplates.set( - ExportsInfoDependency, - new ExportsInfoDependency.Template() - ); - /** - * @param {JavascriptParser} parser the parser - * @returns {void} - */ - const handler = parser => { - parser.hooks.expressionMemberChain - .for("__webpack_exports_info__") - .tap("ExportsInfoApiPlugin", (expr, members) => { - const dep = - members.length >= 2 - ? new ExportsInfoDependency( - expr.range, - members.slice(0, -1), - members[members.length - 1] - ) - : new ExportsInfoDependency(expr.range, null, members[0]); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - return true; - }); - parser.hooks.expression - .for("__webpack_exports_info__") - .tap("ExportsInfoApiPlugin", expr => { - const dep = new ConstDependency("true", expr.range); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - }; - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("ExportsInfoApiPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("ExportsInfoApiPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("ExportsInfoApiPlugin", handler); - } - ); + clearWarningsAndErrors() { + if (this._warnings !== undefined) { + this._warnings.length = 0; + } + if (this._errors !== undefined) { + this._errors.length = 0; + } } -} -module.exports = ExportsInfoApiPlugin; + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {boolean} true, if the module is optional + */ + isOptional(moduleGraph) { + let hasConnections = false; + for (const r of moduleGraph.getIncomingConnections(this)) { + if ( + !r.dependency || + !r.dependency.optional || + !r.isTargetActive(undefined) + ) { + return false; + } + hasConnections = true; + } + return hasConnections; + } + /** + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {Chunk} chunk a chunk + * @param {Chunk=} ignoreChunk chunk to be ignored + * @returns {boolean} true, if the module is accessible from "chunk" when ignoring "ignoreChunk" + */ + isAccessibleInChunk(chunkGraph, chunk, ignoreChunk) { + // Check if module is accessible in ALL chunk groups + for (const chunkGroup of chunk.groupsIterable) { + if (!this.isAccessibleInChunkGroup(chunkGraph, chunkGroup)) return false; + } + return true; + } -/***/ }), + /** + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {ChunkGroup} chunkGroup a chunk group + * @param {Chunk=} ignoreChunk chunk to be ignored + * @returns {boolean} true, if the module is accessible from "chunkGroup" when ignoring "ignoreChunk" + */ + isAccessibleInChunkGroup(chunkGraph, chunkGroup, ignoreChunk) { + const queue = new Set([chunkGroup]); -/***/ 73071: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Check if module is accessible from all items of the queue + queueFor: for (const cg of queue) { + // 1. If module is in one of the chunks of the group we can continue checking the next items + // because it's accessible. + for (const chunk of cg.chunks) { + if (chunk !== ignoreChunk && chunkGraph.isModuleInChunk(this, chunk)) + continue queueFor; + } + // 2. If the chunk group is initial, we can break here because it's not accessible. + if (chunkGroup.isInitial()) return false; + // 3. Enqueue all parents because it must be accessible from ALL parents + for (const parent of chunkGroup.parentsIterable) queue.add(parent); + } + // When we processed through the whole list and we didn't bailout, the module is accessible + return true; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {Chunk} chunk a chunk + * @param {ModuleGraph} moduleGraph the module graph + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {boolean} true, if the module has any reason why "chunk" should be included + */ + hasReasonForChunk(chunk, moduleGraph, chunkGraph) { + // check for each reason if we need the chunk + for (const [ + fromModule, + connections + ] of moduleGraph.getIncomingConnectionsByOriginModule(this)) { + if (!connections.some(c => c.isTargetActive(chunk.runtime))) continue; + for (const originChunk of chunkGraph.getModuleChunksIterable( + fromModule + )) { + // return true if module this is not reachable from originChunk when ignoring chunk + if (!this.isAccessibleInChunk(chunkGraph, originChunk, chunk)) + return true; + } + } + return false; + } + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true if at least one other module depends on this module + */ + hasReasons(moduleGraph, runtime) { + for (const c of moduleGraph.getIncomingConnections(this)) { + if (c.isTargetActive(runtime)) return true; + } + return false; + } + /** + * @returns {string} for debugging + */ + toString() { + return `Module[${this.debugId}: ${this.identifier()}]`; + } -const { OriginalSource, RawSource } = __webpack_require__(51255); -const ConcatenationScope = __webpack_require__(98229); -const { UsageState } = __webpack_require__(63686); -const InitFragment = __webpack_require__(55870); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const StaticExportsDependency = __webpack_require__(91418); -const createHash = __webpack_require__(49835); -const extractUrlAndGlobal = __webpack_require__(11850); -const makeSerializable = __webpack_require__(33032); -const propertyAccess = __webpack_require__(54190); -const { register } = __webpack_require__(8282); + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + callback( + null, + !this.buildMeta || + this.needRebuild === Module.prototype.needRebuild || + deprecatedNeedRebuild(this, context) + ); + } -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./ExportsInfo")} ExportsInfo */ -/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("./Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ -/** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./WebpackError")} WebpackError */ -/** @typedef {import("./javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */ -/** @typedef {import("./util/Hash")} Hash */ -/** @typedef {typeof import("./util/Hash")} HashConstructor */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ + /** + * @deprecated Use needBuild instead + * @param {Map} fileTimestamps timestamps of files + * @param {Map} contextTimestamps timestamps of directories + * @returns {boolean} true, if the module needs a rebuild + */ + needRebuild(fileTimestamps, contextTimestamps) { + return true; + } -/** - * @typedef {Object} SourceData - * @property {boolean=} iife - * @property {string=} init - * @property {string} expression - * @property {InitFragment[]=} chunkInitFragments - * @property {ReadonlySet=} runtimeRequirements - */ + /** + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash( + hash, + context = { + chunkGraph: ChunkGraph.getChunkGraphForModule( + this, + "Module.updateHash", + "DEP_WEBPACK_MODULE_UPDATE_HASH" + ), + runtime: undefined + } + ) { + const { chunkGraph, runtime } = context; + hash.update(chunkGraph.getModuleGraphHash(this, runtime)); + if (this.presentationalDependencies !== undefined) { + for (const dep of this.presentationalDependencies) { + dep.updateHash(hash, context); + } + } + super.updateHash(hash, context); + } -const TYPES = new Set(["javascript"]); -const CSS_TYPES = new Set(["css-import"]); -const RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]); -const RUNTIME_REQUIREMENTS_FOR_SCRIPT = new Set([RuntimeGlobals.loadScript]); -const RUNTIME_REQUIREMENTS_FOR_MODULE = new Set([ - RuntimeGlobals.definePropertyGetters -]); -const EMPTY_RUNTIME_REQUIREMENTS = new Set([]); + /** + * @returns {void} + */ + invalidateBuild() { + // should be overridden to support this feature + } -/** - * @param {string|string[]} variableName the variable name or path - * @param {string} type the module system - * @returns {SourceData} the generated source - */ -const getSourceForGlobalVariableExternal = (variableName, type) => { - if (!Array.isArray(variableName)) { - // make it an array as the look up works the same basically - variableName = [variableName]; + /* istanbul ignore next */ + /** + * @abstract + * @returns {string} a unique identifier of the module + */ + identifier() { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } - // needed for e.g. window["some"]["thing"] - const objectLookup = variableName.map(r => `[${JSON.stringify(r)}]`).join(""); - return { - iife: type === "this", - expression: `${type}${objectLookup}` - }; -}; + /* istanbul ignore next */ + /** + * @abstract + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); + } -/** - * @param {string|string[]} moduleAndSpecifiers the module request - * @returns {SourceData} the generated source - */ -const getSourceForCommonJsExternal = moduleAndSpecifiers => { - if (!Array.isArray(moduleAndSpecifiers)) { - return { - expression: `require(${JSON.stringify(moduleAndSpecifiers)})` - }; + /* istanbul ignore next */ + /** + * @abstract + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } - const moduleName = moduleAndSpecifiers[0]; - return { - expression: `require(${JSON.stringify(moduleName)})${propertyAccess( - moduleAndSpecifiers, - 1 - )}` - }; -}; -/** - * @param {string|string[]} moduleAndSpecifiers the module request - * @returns {SourceData} the generated source - */ -const getSourceForCommonJsExternalInNodeModule = moduleAndSpecifiers => { - const chunkInitFragments = [ - new InitFragment( - 'import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";\n', - InitFragment.STAGE_HARMONY_IMPORTS, - 0, - "external module node-commonjs" - ) - ]; - if (!Array.isArray(moduleAndSpecifiers)) { - return { - expression: `__WEBPACK_EXTERNAL_createRequire(import.meta.url)(${JSON.stringify( - moduleAndSpecifiers - )})`, - chunkInitFragments - }; + /** + * @abstract + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + // Better override this method to return the correct types + if (this.source === Module.prototype.source) { + return DEFAULT_TYPES_UNKNOWN; + } else { + return DEFAULT_TYPES_JS; + } } - const moduleName = moduleAndSpecifiers[0]; - return { - expression: `__WEBPACK_EXTERNAL_createRequire(import.meta.url)(${JSON.stringify( - moduleName - )})${propertyAccess(moduleAndSpecifiers, 1)}`, - chunkInitFragments - }; -}; -/** - * @param {string|string[]} moduleAndSpecifiers the module request - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @returns {SourceData} the generated source - */ -const getSourceForImportExternal = (moduleAndSpecifiers, runtimeTemplate) => { - const importName = runtimeTemplate.outputOptions.importFunctionName; - if (!runtimeTemplate.supportsDynamicImport() && importName === "import") { - throw new Error( - "The target environment doesn't support 'import()' so it's not possible to use external type 'import'" + /** + * @abstract + * @deprecated Use codeGeneration() instead + * @param {DependencyTemplates} dependencyTemplates the dependency templates + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @param {string=} type the type of source that should be generated + * @returns {Source} generated source + */ + source(dependencyTemplates, runtimeTemplate, type = "javascript") { + if (this.codeGeneration === Module.prototype.codeGeneration) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); + } + const chunkGraph = ChunkGraph.getChunkGraphForModule( + this, + "Module.source() is deprecated. Use Compilation.codeGenerationResults.getSource(module, runtime, type) instead", + "DEP_WEBPACK_MODULE_SOURCE" ); - } - if (!Array.isArray(moduleAndSpecifiers)) { - return { - expression: `${importName}(${JSON.stringify(moduleAndSpecifiers)});` + /** @type {CodeGenerationContext} */ + const codeGenContext = { + dependencyTemplates, + runtimeTemplate, + moduleGraph: chunkGraph.moduleGraph, + chunkGraph, + runtime: undefined, + codeGenerationResults: undefined }; + const sources = this.codeGeneration(codeGenContext).sources; + return type ? sources.get(type) : sources.get(first(this.getSourceTypes())); } - if (moduleAndSpecifiers.length === 1) { - return { - expression: `${importName}(${JSON.stringify(moduleAndSpecifiers[0])});` - }; + + /* istanbul ignore next */ + /** + * @abstract + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } - const moduleName = moduleAndSpecifiers[0]; - return { - expression: `${importName}(${JSON.stringify( - moduleName - )}).then(${runtimeTemplate.returningFunction( - `module${propertyAccess(moduleAndSpecifiers, 1)}`, - "module" - )});` - }; -}; -class ModuleExternalInitFragment extends InitFragment { /** - * @param {string} request import source - * @param {string=} ident recomputed ident - * @param {string | HashConstructor=} hashFunction the hash function to use + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion */ - constructor(request, ident, hashFunction = "md4") { - if (ident === undefined) { - ident = Template.toIdentifier(request); - if (ident !== request) { - ident += `_${createHash(hashFunction) - .update(request) - .digest("hex") - .slice(0, 8)}`; - } - } - const identifier = `__WEBPACK_EXTERNAL_MODULE_${ident}__`; - super( - `import * as ${identifier} from ${JSON.stringify(request)};\n`, - InitFragment.STAGE_HARMONY_IMPORTS, - 0, - `external module import ${ident}` - ); - this._ident = ident; - this._identifier = identifier; - this._request = request; + libIdent(options) { + return null; } - getNamespaceIdentifier() { - return this._identifier; + /** + * @returns {string | null} absolute path which should be used for condition matching (usually the resource path) + */ + nameForCondition() { + return null; } -} -register( - ModuleExternalInitFragment, - "webpack/lib/ExternalModule", - "ModuleExternalInitFragment", - { - serialize(obj, { write }) { - write(obj._request); - write(obj._ident); - }, - deserialize({ read }) { - return new ModuleExternalInitFragment(read(), read()); - } + /** + * @param {ConcatenationBailoutReasonContext} context context + * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated + */ + getConcatenationBailoutReason(context) { + return `Module Concatenation is not implemented for ${this.constructor.name}`; } -); -const generateModuleRemapping = (input, exportsInfo, runtime) => { - if (exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused) { - const properties = []; - for (const exportInfo of exportsInfo.orderedExports) { - const used = exportInfo.getUsedName(exportInfo.name, runtime); - if (!used) continue; - const nestedInfo = exportInfo.getNestedExportsInfo(); - if (nestedInfo) { - const nestedExpr = generateModuleRemapping( - `${input}${propertyAccess([exportInfo.name])}`, - nestedInfo - ); - if (nestedExpr) { - properties.push(`[${JSON.stringify(used)}]: y(${nestedExpr})`); - continue; - } - } - properties.push( - `[${JSON.stringify(used)}]: () => ${input}${propertyAccess([ - exportInfo.name - ])}` - ); - } - return `x({ ${properties.join(", ")} })`; + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this module should be connected to referencing modules when consumed for side-effects only + */ + getSideEffectsConnectionState(moduleGraph) { + return true; } -}; -/** - * @param {string|string[]} moduleAndSpecifiers the module request - * @param {ExportsInfo} exportsInfo exports info of this module - * @param {RuntimeSpec} runtime the runtime - * @param {string | HashConstructor=} hashFunction the hash function to use - * @returns {SourceData} the generated source - */ -const getSourceForModuleExternal = ( - moduleAndSpecifiers, - exportsInfo, - runtime, - hashFunction -) => { - if (!Array.isArray(moduleAndSpecifiers)) - moduleAndSpecifiers = [moduleAndSpecifiers]; - const initFragment = new ModuleExternalInitFragment( - moduleAndSpecifiers[0], - undefined, - hashFunction - ); - const baseAccess = `${initFragment.getNamespaceIdentifier()}${propertyAccess( - moduleAndSpecifiers, - 1 - )}`; - const moduleRemapping = generateModuleRemapping( - baseAccess, - exportsInfo, - runtime - ); - let expression = moduleRemapping || baseAccess; - return { - expression, - init: `var x = y => { var x = {}; ${RuntimeGlobals.definePropertyGetters}(x, y); return x; }\nvar y = x => () => x`, - runtimeRequirements: moduleRemapping - ? RUNTIME_REQUIREMENTS_FOR_MODULE - : undefined, - chunkInitFragments: [initFragment] - }; -}; - -/** - * @param {string|string[]} urlAndGlobal the script request - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @returns {SourceData} the generated source - */ -const getSourceForScriptExternal = (urlAndGlobal, runtimeTemplate) => { - if (typeof urlAndGlobal === "string") { - urlAndGlobal = extractUrlAndGlobal(urlAndGlobal); + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration(context) { + // Best override this method + const sources = new Map(); + for (const type of this.getSourceTypes()) { + if (type !== "unknown") { + sources.set( + type, + this.source( + context.dependencyTemplates, + context.runtimeTemplate, + type + ) + ); + } + } + return { + sources, + runtimeRequirements: new Set([ + RuntimeGlobals.module, + RuntimeGlobals.exports, + RuntimeGlobals.require + ]) + }; } - const url = urlAndGlobal[0]; - const globalName = urlAndGlobal[1]; - return { - init: "var __webpack_error__ = new Error();", - expression: `new Promise(${runtimeTemplate.basicFunction( - "resolve, reject", - [ - `if(typeof ${globalName} !== "undefined") return resolve();`, - `${RuntimeGlobals.loadScript}(${JSON.stringify( - url - )}, ${runtimeTemplate.basicFunction("event", [ - `if(typeof ${globalName} !== "undefined") return resolve();`, - "var errorType = event && (event.type === 'load' ? 'missing' : event.type);", - "var realSrc = event && event.target && event.target.src;", - "__webpack_error__.message = 'Loading script failed.\\n(' + errorType + ': ' + realSrc + ')';", - "__webpack_error__.name = 'ScriptExternalLoadError';", - "__webpack_error__.type = errorType;", - "__webpack_error__.request = realSrc;", - "reject(__webpack_error__);" - ])}, ${JSON.stringify(globalName)});` - ] - )}).then(${runtimeTemplate.returningFunction( - `${globalName}${propertyAccess(urlAndGlobal, 2)}` - )})`, - runtimeRequirements: RUNTIME_REQUIREMENTS_FOR_SCRIPT - }; -}; - -/** - * @param {string} variableName the variable name to check - * @param {string} request the request path - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @returns {string} the generated source - */ -const checkExternalVariable = (variableName, request, runtimeTemplate) => { - return `if(typeof ${variableName} === 'undefined') { ${runtimeTemplate.throwMissingModuleErrorBlock( - { request } - )} }\n`; -}; - -/** - * @param {string|number} id the module id - * @param {boolean} optional true, if the module is optional - * @param {string|string[]} request the request path - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @returns {SourceData} the generated source - */ -const getSourceForAmdOrUmdExternal = ( - id, - optional, - request, - runtimeTemplate -) => { - const externalVariable = `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( - `${id}` - )}__`; - return { - init: optional - ? checkExternalVariable( - externalVariable, - Array.isArray(request) ? request.join(".") : request, - runtimeTemplate - ) - : undefined, - expression: externalVariable - }; -}; -/** - * @param {boolean} optional true, if the module is optional - * @param {string|string[]} request the request path - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @returns {SourceData} the generated source - */ -const getSourceForDefaultCase = (optional, request, runtimeTemplate) => { - if (!Array.isArray(request)) { - // make it an array as the look up works the same basically - request = [request]; + /** + * @param {Chunk} chunk the chunk which condition should be checked + * @param {Compilation} compilation the compilation + * @returns {boolean} true, if the chunk is ok for the module + */ + chunkCondition(chunk, compilation) { + return true; } - const variableName = request[0]; - const objectLookup = propertyAccess(request, 1); - return { - init: optional - ? checkExternalVariable(variableName, request.join("."), runtimeTemplate) - : undefined, - expression: `${variableName}${objectLookup}` - }; -}; - -class ExternalModule extends Module { - constructor(request, type, userRequest) { - super("javascript/dynamic", null); - - // Info from Factory - /** @type {string | string[] | Record} */ - this.request = request; - /** @type {string} */ - this.externalType = type; - /** @type {string} */ - this.userRequest = userRequest; + hasChunkCondition() { + return this.chunkCondition !== Module.prototype.chunkCondition; } /** - * @returns {Set} types available (do not mutate) + * Assuming this module is in the cache. Update the (cached) module with + * the fresh module from the factory. Usually updates internal references + * and properties. + * @param {Module} module fresh module + * @returns {void} */ - getSourceTypes() { - return this.externalType === "css-import" ? CSS_TYPES : TYPES; + updateCacheModule(module) { + this.type = module.type; + this.layer = module.layer; + this.context = module.context; + this.factoryMeta = module.factoryMeta; + this.resolveOptions = module.resolveOptions; } /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion + * Module should be unsafe cached. Get data that's needed for that. + * This data will be passed to restoreFromUnsafeCache later. + * @returns {object} cached data */ - libIdent(options) { - return this.userRequest; + getUnsafeCacheData() { + return { + factoryMeta: this.factoryMeta, + resolveOptions: this.resolveOptions + }; } /** - * @param {Chunk} chunk the chunk which condition should be checked - * @param {Compilation} compilation the compilation - * @returns {boolean} true, if the chunk is ok for the module + * restore unsafe cache data + * @param {object} unsafeCacheData data from getUnsafeCacheData + * @param {NormalModuleFactory} normalModuleFactory the normal module factory handling the unsafe caching */ - chunkCondition(chunk, { chunkGraph }) { - return this.externalType === "css-import" - ? true - : chunkGraph.getNumberOfEntryModules(chunk) > 0; + _restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory) { + this.factoryMeta = unsafeCacheData.factoryMeta; + this.resolveOptions = unsafeCacheData.resolveOptions; } /** - * @returns {string} a unique identifier of the module + * Assuming this module is in the cache. Remove internal references to allow freeing some memory. */ - identifier() { - return `external ${this.externalType} ${JSON.stringify(this.request)}`; + cleanupForCache() { + this.factoryMeta = undefined; + this.resolveOptions = undefined; } /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module + * @returns {Source | null} the original source for the module before webpack transformation */ - readableIdentifier(requestShortener) { - return "external " + JSON.stringify(this.request); + originalSource() { + return null; } /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} + * @param {LazySet} fileDependencies set where file dependencies are added to + * @param {LazySet} contextDependencies set where context dependencies are added to + * @param {LazySet} missingDependencies set where missing dependencies are added to + * @param {LazySet} buildDependencies set where build dependencies are added to */ - needBuild(context, callback) { - return callback(null, !this.buildMeta); + addCacheDependencies( + fileDependencies, + contextDependencies, + missingDependencies, + buildDependencies + ) {} + + serialize(context) { + const { write } = context; + write(this.type); + write(this.layer); + write(this.context); + write(this.resolveOptions); + write(this.factoryMeta); + write(this.useSourceMap); + write(this.useSimpleSourceMap); + write( + this._warnings !== undefined && this._warnings.length === 0 + ? undefined + : this._warnings + ); + write( + this._errors !== undefined && this._errors.length === 0 + ? undefined + : this._errors + ); + write(this.buildMeta); + write(this.buildInfo); + write(this.presentationalDependencies); + write(this.codeGenerationDependencies); + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + this.type = read(); + this.layer = read(); + this.context = read(); + this.resolveOptions = read(); + this.factoryMeta = read(); + this.useSourceMap = read(); + this.useSimpleSourceMap = read(); + this._warnings = read(); + this._errors = read(); + this.buildMeta = read(); + this.buildInfo = read(); + this.presentationalDependencies = read(); + this.codeGenerationDependencies = read(); + super.deserialize(context); + } +} + +makeSerializable(Module, "webpack/lib/Module"); + +// TODO remove in webpack 6 +Object.defineProperty(Module.prototype, "hasEqualsChunks", { + get() { + throw new Error( + "Module.hasEqualsChunks was renamed (use hasEqualChunks instead)" + ); + } +}); + +// TODO remove in webpack 6 +Object.defineProperty(Module.prototype, "isUsed", { + get() { + throw new Error( + "Module.isUsed was renamed (use getUsedName, isExportUsed or isModuleUsed instead)" + ); + } +}); + +// TODO remove in webpack 6 +Object.defineProperty(Module.prototype, "errors", { + get: util.deprecate( + /** + * @this {Module} + * @returns {WebpackError[]} array + */ + function () { + if (this._errors === undefined) { + this._errors = []; + } + return this._errors; + }, + "Module.errors was removed (use getErrors instead)", + "DEP_WEBPACK_MODULE_ERRORS" + ) +}); + +// TODO remove in webpack 6 +Object.defineProperty(Module.prototype, "warnings", { + get: util.deprecate( + /** + * @this {Module} + * @returns {WebpackError[]} array + */ + function () { + if (this._warnings === undefined) { + this._warnings = []; + } + return this._warnings; + }, + "Module.warnings was removed (use getWarnings instead)", + "DEP_WEBPACK_MODULE_WARNINGS" + ) +}); + +// TODO remove in webpack 6 +Object.defineProperty(Module.prototype, "used", { + get() { + throw new Error( + "Module.used was refactored (use ModuleGraph.getUsedExports instead)" + ); + }, + set(value) { + throw new Error( + "Module.used was refactored (use ModuleGraph.setUsedExports instead)" + ); } +}); + +module.exports = Module; + + +/***/ }), + +/***/ 21305: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { cutOffLoaderExecution } = __webpack_require__(59985); +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); +class ModuleBuildError extends WebpackError { /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} + * @param {string | Error&any} err error thrown + * @param {{from?: string|null}} info additional info */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = { - async: false, - exportsType: undefined - }; - this.buildInfo = { - strict: true, - topLevelDeclarations: new Set(), - module: compilation.outputOptions.module - }; - const { request, externalType } = this._getRequestAndExternalType(); - this.buildMeta.exportsType = "dynamic"; - let canMangle = false; - this.clearDependenciesAndBlocks(); - switch (externalType) { - case "this": - this.buildInfo.strict = false; - break; - case "system": - if (!Array.isArray(request) || request.length === 1) { - this.buildMeta.exportsType = "namespace"; - canMangle = true; - } - break; - case "module": - if (this.buildInfo.module) { - if (!Array.isArray(request) || request.length === 1) { - this.buildMeta.exportsType = "namespace"; - canMangle = true; - } + constructor(err, { from = null } = {}) { + let message = "Module build failed"; + let details = undefined; + + if (from) { + message += ` (from ${from}):\n`; + } else { + message += ": "; + } + + if (err !== null && typeof err === "object") { + if (typeof err.stack === "string" && err.stack) { + const stack = cutOffLoaderExecution(err.stack); + + if (!err.hideStack) { + message += stack; } else { - this.buildMeta.async = true; - if (!Array.isArray(request) || request.length === 1) { - this.buildMeta.exportsType = "namespace"; - canMangle = false; + details = stack; + + if (typeof err.message === "string" && err.message) { + message += err.message; + } else { + message += err; } } - break; - case "script": - case "promise": - this.buildMeta.async = true; - break; - case "import": - this.buildMeta.async = true; - if (!Array.isArray(request) || request.length === 1) { - this.buildMeta.exportsType = "namespace"; - canMangle = false; - } - break; + } else if (typeof err.message === "string" && err.message) { + message += err.message; + } else { + message += String(err); + } + } else { + message += String(err); } - this.addDependency(new StaticExportsDependency(true, canMangle)); - callback(); - } - restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory) { - this._restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory); + super(message); + + this.name = "ModuleBuildError"; + this.details = details; + this.error = err; } - /** - * @param {ConcatenationBailoutReasonContext} context context - * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated - */ - getConcatenationBailoutReason({ moduleGraph }) { - switch (this.externalType) { - case "amd": - case "amd-require": - case "umd": - case "umd2": - case "system": - case "jsonp": - return `${this.externalType} externals can't be concatenated`; - } - return undefined; + serialize(context) { + const { write } = context; + + write(this.error); + + super.serialize(context); } - _getRequestAndExternalType() { - let { request, externalType } = this; - if (typeof request === "object" && !Array.isArray(request)) - request = request[externalType]; - return { request, externalType }; + deserialize(context) { + const { read } = context; + + this.error = read(); + + super.deserialize(context); } +} - _getSourceData( - request, - externalType, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtime - ) { - switch (externalType) { - case "this": - case "window": - case "self": - return getSourceForGlobalVariableExternal(request, this.externalType); - case "global": - return getSourceForGlobalVariableExternal( - request, - runtimeTemplate.globalObject - ); - case "commonjs": - case "commonjs2": - case "commonjs-module": - case "commonjs-static": - return getSourceForCommonJsExternal(request); - case "node-commonjs": - return this.buildInfo.module - ? getSourceForCommonJsExternalInNodeModule(request) - : getSourceForCommonJsExternal(request); - case "amd": - case "amd-require": - case "umd": - case "umd2": - case "system": - case "jsonp": { - const id = chunkGraph.getModuleId(this); - return getSourceForAmdOrUmdExternal( - id !== null ? id : this.identifier(), - this.isOptional(moduleGraph), - request, - runtimeTemplate - ); - } - case "import": - return getSourceForImportExternal(request, runtimeTemplate); - case "script": - return getSourceForScriptExternal(request, runtimeTemplate); - case "module": { - if (!this.buildInfo.module) { - if (!runtimeTemplate.supportsDynamicImport()) { - throw new Error( - "The target environment doesn't support dynamic import() syntax so it's not possible to use external type 'module' within a script" + - (runtimeTemplate.supportsEcmaScriptModuleSyntax() - ? "\nDid you mean to build a EcmaScript Module ('output.module: true')?" - : "") - ); - } - return getSourceForImportExternal(request, runtimeTemplate); - } - if (!runtimeTemplate.supportsEcmaScriptModuleSyntax()) { - throw new Error( - "The target environment doesn't support EcmaScriptModule syntax so it's not possible to use external type 'module'" - ); - } - return getSourceForModuleExternal( - request, - moduleGraph.getExportsInfo(this), - runtime, - runtimeTemplate.outputOptions.hashFunction - ); - } - case "var": - case "promise": - case "const": - case "let": - case "assign": - default: - return getSourceForDefaultCase( - this.isOptional(moduleGraph), - request, - runtimeTemplate - ); - } - } +makeSerializable(ModuleBuildError, "webpack/lib/ModuleBuildError"); - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration({ - runtimeTemplate, - moduleGraph, - chunkGraph, - runtime, - concatenationScope - }) { - const { request, externalType } = this._getRequestAndExternalType(); - switch (externalType) { - case "asset": { - const sources = new Map(); - sources.set( - "javascript", - new RawSource(`module.exports = ${JSON.stringify(request)};`) - ); - const data = new Map(); - data.set("url", request); - return { sources, runtimeRequirements: RUNTIME_REQUIREMENTS, data }; - } - case "css-import": { - const sources = new Map(); - sources.set( - "css-import", - new RawSource(`@import url(${JSON.stringify(request)});`) - ); - return { - sources, - runtimeRequirements: EMPTY_RUNTIME_REQUIREMENTS - }; - } - default: { - const sourceData = this._getSourceData( - request, - externalType, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtime - ); +module.exports = ModuleBuildError; - let sourceString = sourceData.expression; - if (sourceData.iife) - sourceString = `(function() { return ${sourceString}; }())`; - if (concatenationScope) { - sourceString = `${ - runtimeTemplate.supportsConst() ? "const" : "var" - } ${ConcatenationScope.NAMESPACE_OBJECT_EXPORT} = ${sourceString};`; - concatenationScope.registerNamespaceExport( - ConcatenationScope.NAMESPACE_OBJECT_EXPORT - ); - } else { - sourceString = `module.exports = ${sourceString};`; - } - if (sourceData.init) - sourceString = `${sourceData.init}\n${sourceString}`; - let data = undefined; - if (sourceData.chunkInitFragments) { - data = new Map(); - data.set("chunkInitFragments", sourceData.chunkInitFragments); - } +/***/ }), - const sources = new Map(); - if (this.useSourceMap || this.useSimpleSourceMap) { - sources.set( - "javascript", - new OriginalSource(sourceString, this.identifier()) - ); - } else { - sources.set("javascript", new RawSource(sourceString)); - } +/***/ 67409: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - let runtimeRequirements = sourceData.runtimeRequirements; - if (!concatenationScope) { - if (!runtimeRequirements) { - runtimeRequirements = RUNTIME_REQUIREMENTS; - } else { - const set = new Set(runtimeRequirements); - set.add(RuntimeGlobals.module); - runtimeRequirements = set; - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - return { - sources, - runtimeRequirements: - runtimeRequirements || EMPTY_RUNTIME_REQUIREMENTS, - data - }; - } + + +const WebpackError = __webpack_require__(53799); + +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Module")} Module */ + +class ModuleDependencyError extends WebpackError { + /** + * Creates an instance of ModuleDependencyError. + * @param {Module} module module tied to dependency + * @param {Error} err error thrown + * @param {DependencyLocation} loc location of dependency + */ + constructor(module, err, loc) { + super(err.message); + + this.name = "ModuleDependencyError"; + this.details = + err && !(/** @type {any} */ (err).hideStack) + ? err.stack.split("\n").slice(1).join("\n") + : undefined; + this.module = module; + this.loc = loc; + /** error is not (de)serialized, so it might be undefined after deserialization */ + this.error = err; + + if (err && /** @type {any} */ (err).hideStack) { + this.stack = + err.stack.split("\n").slice(1).join("\n") + "\n\n" + this.stack; } } +} + +module.exports = ModuleDependencyError; + + +/***/ }), + +/***/ 29656: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Module")} Module */ + +class ModuleDependencyWarning extends WebpackError { /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) + * @param {Module} module module tied to dependency + * @param {Error} err error thrown + * @param {DependencyLocation} loc location of dependency */ - size(type) { - return 42; + constructor(module, err, loc) { + super(err ? err.message : ""); + + this.name = "ModuleDependencyWarning"; + this.details = + err && !(/** @type {any} */ (err).hideStack) + ? err.stack.split("\n").slice(1).join("\n") + : undefined; + this.module = module; + this.loc = loc; + /** error is not (de)serialized, so it might be undefined after deserialization */ + this.error = err; + + if (err && /** @type {any} */ (err).hideStack) { + this.stack = + err.stack.split("\n").slice(1).join("\n") + "\n\n" + this.stack; + } } +} + +makeSerializable( + ModuleDependencyWarning, + "webpack/lib/ModuleDependencyWarning" +); + +module.exports = ModuleDependencyWarning; + + +/***/ }), + +/***/ 23744: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + +const { cleanUp } = __webpack_require__(59985); +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); + +class ModuleError extends WebpackError { /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} + * @param {Error} err error thrown + * @param {{from?: string|null}} info additional info */ - updateHash(hash, context) { - const { chunkGraph } = context; - hash.update( - `${this.externalType}${JSON.stringify(this.request)}${this.isOptional( - chunkGraph.moduleGraph - )}` - ); - super.updateHash(hash, context); + constructor(err, { from = null } = {}) { + let message = "Module Error"; + + if (from) { + message += ` (from ${from}):\n`; + } else { + message += ": "; + } + + if (err && typeof err === "object" && err.message) { + message += err.message; + } else if (err) { + message += err; + } + + super(message); + + this.name = "ModuleError"; + this.error = err; + this.details = + err && typeof err === "object" && err.stack + ? cleanUp(err.stack, this.message) + : undefined; } serialize(context) { const { write } = context; - write(this.request); - write(this.externalType); - write(this.userRequest); + write(this.error); super.serialize(context); } @@ -43882,22 +44987,20 @@ class ExternalModule extends Module { deserialize(context) { const { read } = context; - this.request = read(); - this.externalType = read(); - this.userRequest = read(); + this.error = read(); super.deserialize(context); } } -makeSerializable(ExternalModule, "webpack/lib/ExternalModule"); +makeSerializable(ModuleError, "webpack/lib/ModuleError"); -module.exports = ExternalModule; +module.exports = ModuleError; /***/ }), -/***/ 62153: +/***/ 51010: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -43908,259 +45011,55 @@ module.exports = ExternalModule; -const util = __webpack_require__(73837); -const ExternalModule = __webpack_require__(73071); -const { resolveByProperty, cachedSetProperty } = __webpack_require__(60839); - -/** @typedef {import("../declarations/WebpackOptions").Externals} Externals */ -/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ - -const UNSPECIFIED_EXTERNAL_TYPE_REGEXP = /^[a-z0-9-]+ /; -const EMPTY_RESOLVE_OPTIONS = {}; +/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./Module")} Module */ -// TODO webpack 6 remove this -const callDeprecatedExternals = util.deprecate( - (externalsFunction, context, request, cb) => { - externalsFunction.call(null, context, request, cb); - }, - "The externals-function should be defined like ({context, request}, cb) => { ... }", - "DEP_WEBPACK_EXTERNALS_FUNCTION_PARAMETERS" -); +/** + * @typedef {Object} ModuleFactoryResult + * @property {Module=} module the created module or unset if no module was created + * @property {Set=} fileDependencies + * @property {Set=} contextDependencies + * @property {Set=} missingDependencies + * @property {boolean=} cacheable allow to use the unsafe cache + */ -const cache = new WeakMap(); +/** + * @typedef {Object} ModuleFactoryCreateDataContextInfo + * @property {string} issuer + * @property {string | null=} issuerLayer + * @property {string} compiler + */ -const resolveLayer = (obj, layer) => { - let map = cache.get(obj); - if (map === undefined) { - map = new Map(); - cache.set(obj, map); - } else { - const cacheEntry = map.get(layer); - if (cacheEntry !== undefined) return cacheEntry; - } - const result = resolveByProperty(obj, "byLayer", layer); - map.set(layer, result); - return result; -}; +/** + * @typedef {Object} ModuleFactoryCreateData + * @property {ModuleFactoryCreateDataContextInfo} contextInfo + * @property {ResolveOptions=} resolveOptions + * @property {string} context + * @property {Dependency[]} dependencies + */ -class ExternalModuleFactoryPlugin { +class ModuleFactory { + /* istanbul ignore next */ /** - * @param {string | undefined} type default external type - * @param {Externals} externals externals config + * @abstract + * @param {ModuleFactoryCreateData} data data object + * @param {function(Error=, ModuleFactoryResult=): void} callback callback + * @returns {void} */ - constructor(type, externals) { - this.type = type; - this.externals = externals; + create(data, callback) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } +} - /** - * @param {NormalModuleFactory} normalModuleFactory the normal module factory - * @returns {void} - */ - apply(normalModuleFactory) { - const globalType = this.type; - normalModuleFactory.hooks.factorize.tapAsync( - "ExternalModuleFactoryPlugin", - (data, callback) => { - const context = data.context; - const contextInfo = data.contextInfo; - const dependency = data.dependencies[0]; - const dependencyType = data.dependencyType; +module.exports = ModuleFactory; - /** - * @param {string|string[]|boolean|Record} value the external config - * @param {string|undefined} type type of external - * @param {function(Error=, ExternalModule=): void} callback callback - * @returns {void} - */ - const handleExternal = (value, type, callback) => { - if (value === false) { - // Not externals, fallback to original factory - return callback(); - } - /** @type {string | string[] | Record} */ - let externalConfig; - if (value === true) { - externalConfig = dependency.request; - } else { - externalConfig = value; - } - // When no explicit type is specified, extract it from the externalConfig - if (type === undefined) { - if ( - typeof externalConfig === "string" && - UNSPECIFIED_EXTERNAL_TYPE_REGEXP.test(externalConfig) - ) { - const idx = externalConfig.indexOf(" "); - type = externalConfig.substr(0, idx); - externalConfig = externalConfig.substr(idx + 1); - } else if ( - Array.isArray(externalConfig) && - externalConfig.length > 0 && - UNSPECIFIED_EXTERNAL_TYPE_REGEXP.test(externalConfig[0]) - ) { - const firstItem = externalConfig[0]; - const idx = firstItem.indexOf(" "); - type = firstItem.substr(0, idx); - externalConfig = [ - firstItem.substr(idx + 1), - ...externalConfig.slice(1) - ]; - } - } - callback( - null, - new ExternalModule( - externalConfig, - type || globalType, - dependency.request - ) - ); - }; - /** - * @param {Externals} externals externals config - * @param {function((Error | null)=, ExternalModule=): void} callback callback - * @returns {void} - */ - const handleExternals = (externals, callback) => { - if (typeof externals === "string") { - if (externals === dependency.request) { - return handleExternal(dependency.request, undefined, callback); - } - } else if (Array.isArray(externals)) { - let i = 0; - const next = () => { - let asyncFlag; - const handleExternalsAndCallback = (err, module) => { - if (err) return callback(err); - if (!module) { - if (asyncFlag) { - asyncFlag = false; - return; - } - return next(); - } - callback(null, module); - }; +/***/ }), - do { - asyncFlag = true; - if (i >= externals.length) return callback(); - handleExternals(externals[i++], handleExternalsAndCallback); - } while (!asyncFlag); - asyncFlag = false; - }; - - next(); - return; - } else if (externals instanceof RegExp) { - if (externals.test(dependency.request)) { - return handleExternal(dependency.request, undefined, callback); - } - } else if (typeof externals === "function") { - const cb = (err, value, type) => { - if (err) return callback(err); - if (value !== undefined) { - handleExternal(value, type, callback); - } else { - callback(); - } - }; - if (externals.length === 3) { - // TODO webpack 6 remove this - callDeprecatedExternals( - externals, - context, - dependency.request, - cb - ); - } else { - const promise = externals( - { - context, - request: dependency.request, - dependencyType, - contextInfo, - getResolve: options => (context, request, callback) => { - const resolveContext = { - fileDependencies: data.fileDependencies, - missingDependencies: data.missingDependencies, - contextDependencies: data.contextDependencies - }; - let resolver = normalModuleFactory.getResolver( - "normal", - dependencyType - ? cachedSetProperty( - data.resolveOptions || EMPTY_RESOLVE_OPTIONS, - "dependencyType", - dependencyType - ) - : data.resolveOptions - ); - if (options) resolver = resolver.withOptions(options); - if (callback) { - resolver.resolve( - {}, - context, - request, - resolveContext, - callback - ); - } else { - return new Promise((resolve, reject) => { - resolver.resolve( - {}, - context, - request, - resolveContext, - (err, result) => { - if (err) reject(err); - else resolve(result); - } - ); - }); - } - } - }, - cb - ); - if (promise && promise.then) promise.then(r => cb(null, r), cb); - } - return; - } else if (typeof externals === "object") { - const resolvedExternals = resolveLayer( - externals, - contextInfo.issuerLayer - ); - if ( - Object.prototype.hasOwnProperty.call( - resolvedExternals, - dependency.request - ) - ) { - return handleExternal( - resolvedExternals[dependency.request], - undefined, - callback - ); - } - } - callback(); - }; - - handleExternals(this.externals, callback); - } - ); - } -} -module.exports = ExternalModuleFactoryPlugin; - - -/***/ }), - -/***/ 6652: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 88821: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -44170,3608 +45069,1933 @@ module.exports = ExternalModuleFactoryPlugin; -const ExternalModuleFactoryPlugin = __webpack_require__(62153); +const NormalModule = __webpack_require__(39); +const createHash = __webpack_require__(49835); +const memoize = __webpack_require__(78676); -/** @typedef {import("../declarations/WebpackOptions").Externals} Externals */ -/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {typeof import("./util/Hash")} Hash */ -class ExternalsPlugin { - /** - * @param {string | undefined} type default external type - * @param {Externals} externals externals config - */ - constructor(type, externals) { - this.type = type; - this.externals = externals; +const ModuleFilenameHelpers = exports; + +// TODO webpack 6: consider removing these +ModuleFilenameHelpers.ALL_LOADERS_RESOURCE = "[all-loaders][resource]"; +ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE = + /\[all-?loaders\]\[resource\]/gi; +ModuleFilenameHelpers.LOADERS_RESOURCE = "[loaders][resource]"; +ModuleFilenameHelpers.REGEXP_LOADERS_RESOURCE = /\[loaders\]\[resource\]/gi; +ModuleFilenameHelpers.RESOURCE = "[resource]"; +ModuleFilenameHelpers.REGEXP_RESOURCE = /\[resource\]/gi; +ModuleFilenameHelpers.ABSOLUTE_RESOURCE_PATH = "[absolute-resource-path]"; +// cSpell:words olute +ModuleFilenameHelpers.REGEXP_ABSOLUTE_RESOURCE_PATH = + /\[abs(olute)?-?resource-?path\]/gi; +ModuleFilenameHelpers.RESOURCE_PATH = "[resource-path]"; +ModuleFilenameHelpers.REGEXP_RESOURCE_PATH = /\[resource-?path\]/gi; +ModuleFilenameHelpers.ALL_LOADERS = "[all-loaders]"; +ModuleFilenameHelpers.REGEXP_ALL_LOADERS = /\[all-?loaders\]/gi; +ModuleFilenameHelpers.LOADERS = "[loaders]"; +ModuleFilenameHelpers.REGEXP_LOADERS = /\[loaders\]/gi; +ModuleFilenameHelpers.QUERY = "[query]"; +ModuleFilenameHelpers.REGEXP_QUERY = /\[query\]/gi; +ModuleFilenameHelpers.ID = "[id]"; +ModuleFilenameHelpers.REGEXP_ID = /\[id\]/gi; +ModuleFilenameHelpers.HASH = "[hash]"; +ModuleFilenameHelpers.REGEXP_HASH = /\[hash\]/gi; +ModuleFilenameHelpers.NAMESPACE = "[namespace]"; +ModuleFilenameHelpers.REGEXP_NAMESPACE = /\[namespace\]/gi; + +const getAfter = (strFn, token) => { + return () => { + const str = strFn(); + const idx = str.indexOf(token); + return idx < 0 ? "" : str.substr(idx); + }; +}; + +const getBefore = (strFn, token) => { + return () => { + const str = strFn(); + const idx = str.lastIndexOf(token); + return idx < 0 ? "" : str.substr(0, idx); + }; +}; + +const getHash = (strFn, hashFunction) => { + return () => { + const hash = createHash(hashFunction); + hash.update(strFn()); + const digest = /** @type {string} */ (hash.digest("hex")); + return digest.substr(0, 4); + }; +}; + +const asRegExp = test => { + if (typeof test === "string") { + test = new RegExp("^" + test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")); } + return test; +}; - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compile.tap("ExternalsPlugin", ({ normalModuleFactory }) => { - new ExternalModuleFactoryPlugin(this.type, this.externals).apply( - normalModuleFactory - ); +const lazyObject = obj => { + const newObj = {}; + for (const key of Object.keys(obj)) { + const fn = obj[key]; + Object.defineProperty(newObj, key, { + get: () => fn(), + set: v => { + Object.defineProperty(newObj, key, { + value: v, + enumerable: true, + writable: true + }); + }, + enumerable: true, + configurable: true }); } -} - -module.exports = ExternalsPlugin; + return newObj; +}; +const REGEXP = /\[\\*([\w-]+)\\*\]/gi; -/***/ }), +/** + * + * @param {Module | string} module the module + * @param {TODO} options options + * @param {Object} contextInfo context info + * @param {RequestShortener} contextInfo.requestShortener requestShortener + * @param {ChunkGraph} contextInfo.chunkGraph chunk graph + * @param {string | Hash} contextInfo.hashFunction the hash function to use + * @returns {string} the filename + */ +ModuleFilenameHelpers.createFilename = ( + module = "", + options, + { requestShortener, chunkGraph, hashFunction = "md4" } +) => { + const opts = { + namespace: "", + moduleFilenameTemplate: "", + ...(typeof options === "object" + ? options + : { + moduleFilenameTemplate: options + }) + }; -/***/ 79453: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + let absoluteResourcePath; + let hash; + let identifier; + let moduleId; + let shortIdentifier; + if (typeof module === "string") { + shortIdentifier = memoize(() => requestShortener.shorten(module)); + identifier = shortIdentifier; + moduleId = () => ""; + absoluteResourcePath = () => module.split("!").pop(); + hash = getHash(identifier, hashFunction); + } else { + shortIdentifier = memoize(() => + module.readableIdentifier(requestShortener) + ); + identifier = memoize(() => requestShortener.shorten(module.identifier())); + moduleId = () => chunkGraph.getModuleId(module); + absoluteResourcePath = () => + module instanceof NormalModule + ? module.resource + : module.identifier().split("!").pop(); + hash = getHash(identifier, hashFunction); + } + const resource = memoize(() => shortIdentifier().split("!").pop()); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const loaders = getBefore(shortIdentifier, "!"); + const allLoaders = getBefore(identifier, "!"); + const query = getAfter(resource, "?"); + const resourcePath = () => { + const q = query().length; + return q === 0 ? resource() : resource().slice(0, -q); + }; + if (typeof opts.moduleFilenameTemplate === "function") { + return opts.moduleFilenameTemplate( + lazyObject({ + identifier: identifier, + shortIdentifier: shortIdentifier, + resource: resource, + resourcePath: memoize(resourcePath), + absoluteResourcePath: memoize(absoluteResourcePath), + allLoaders: memoize(allLoaders), + query: memoize(query), + moduleId: memoize(moduleId), + hash: memoize(hash), + namespace: () => opts.namespace + }) + ); + } + // TODO webpack 6: consider removing alternatives without dashes + /** @type {Map} */ + const replacements = new Map([ + ["identifier", identifier], + ["short-identifier", shortIdentifier], + ["resource", resource], + ["resource-path", resourcePath], + // cSpell:words resourcepath + ["resourcepath", resourcePath], + ["absolute-resource-path", absoluteResourcePath], + ["abs-resource-path", absoluteResourcePath], + // cSpell:words absoluteresource + ["absoluteresource-path", absoluteResourcePath], + // cSpell:words absresource + ["absresource-path", absoluteResourcePath], + // cSpell:words resourcepath + ["absolute-resourcepath", absoluteResourcePath], + // cSpell:words resourcepath + ["abs-resourcepath", absoluteResourcePath], + // cSpell:words absoluteresourcepath + ["absoluteresourcepath", absoluteResourcePath], + // cSpell:words absresourcepath + ["absresourcepath", absoluteResourcePath], + ["all-loaders", allLoaders], + // cSpell:words allloaders + ["allloaders", allLoaders], + ["loaders", loaders], + ["query", query], + ["id", moduleId], + ["hash", hash], + ["namespace", () => opts.namespace] + ]); + // TODO webpack 6: consider removing weird double placeholders + return opts.moduleFilenameTemplate + .replace(ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE, "[identifier]") + .replace( + ModuleFilenameHelpers.REGEXP_LOADERS_RESOURCE, + "[short-identifier]" + ) + .replace(REGEXP, (match, content) => { + if (content.length + 2 === match.length) { + const replacement = replacements.get(content.toLowerCase()); + if (replacement !== undefined) { + return replacement(); + } + } else if (match.startsWith("[\\") && match.endsWith("\\]")) { + return `[${match.slice(2, -2)}]`; + } + return match; + }); +}; -const { create: createResolver } = __webpack_require__(30662); -const asyncLib = __webpack_require__(78175); -const AsyncQueue = __webpack_require__(12260); -const StackedCacheMap = __webpack_require__(64985); -const createHash = __webpack_require__(49835); -const { join, dirname, relative, lstatReadlinkAbsolute } = __webpack_require__(17139); -const makeSerializable = __webpack_require__(33032); -const processAsyncTree = __webpack_require__(42791); +ModuleFilenameHelpers.replaceDuplicates = (array, fn, comparator) => { + const countMap = Object.create(null); + const posMap = Object.create(null); + array.forEach((item, idx) => { + countMap[item] = countMap[item] || []; + countMap[item].push(idx); + posMap[item] = 0; + }); + if (comparator) { + Object.keys(countMap).forEach(item => { + countMap[item].sort(comparator); + }); + } + return array.map((item, i) => { + if (countMap[item].length > 1) { + if (comparator && countMap[item][0] === i) return item; + return fn(item, i, posMap[item]++); + } else { + return item; + } + }); +}; -/** @typedef {import("./WebpackError")} WebpackError */ -/** @typedef {import("./logging/Logger").Logger} Logger */ -/** @typedef {typeof import("./util/Hash")} Hash */ -/** @typedef {import("./util/fs").IStats} IStats */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ +ModuleFilenameHelpers.matchPart = (str, test) => { + if (!test) return true; + test = asRegExp(test); + if (Array.isArray(test)) { + return test.map(asRegExp).some(regExp => regExp.test(str)); + } else { + return test.test(str); + } +}; -const supportsEsm = +process.versions.modules >= 83; +ModuleFilenameHelpers.matchObject = (obj, str) => { + if (obj.test) { + if (!ModuleFilenameHelpers.matchPart(str, obj.test)) { + return false; + } + } + if (obj.include) { + if (!ModuleFilenameHelpers.matchPart(str, obj.include)) { + return false; + } + } + if (obj.exclude) { + if (ModuleFilenameHelpers.matchPart(str, obj.exclude)) { + return false; + } + } + return true; +}; -let FS_ACCURACY = 2000; -const EMPTY_SET = new Set(); +/***/ }), -const RBDT_RESOLVE_CJS = 0; -const RBDT_RESOLVE_ESM = 1; -const RBDT_RESOLVE_DIRECTORY = 2; -const RBDT_RESOLVE_CJS_FILE = 3; -const RBDT_RESOLVE_CJS_FILE_AS_CHILD = 4; -const RBDT_RESOLVE_ESM_FILE = 5; -const RBDT_DIRECTORY = 6; -const RBDT_FILE = 7; -const RBDT_DIRECTORY_DEPENDENCIES = 8; -const RBDT_FILE_DEPENDENCIES = 9; +/***/ 99988: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -const INVALID = Symbol("invalid"); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/** - * @typedef {Object} FileSystemInfoEntry - * @property {number} safeTime - * @property {number=} timestamp - */ -/** - * @typedef {Object} ResolvedContextFileSystemInfoEntry - * @property {number} safeTime - * @property {string=} timestampHash - */ -/** - * @typedef {Object} ContextFileSystemInfoEntry - * @property {number} safeTime - * @property {string=} timestampHash - * @property {ResolvedContextFileSystemInfoEntry=} resolved - * @property {Set=} symlinks - */ +const util = __webpack_require__(73837); +const ExportsInfo = __webpack_require__(63686); +const ModuleGraphConnection = __webpack_require__(40639); +const SortableSet = __webpack_require__(13098); +const WeakTupleMap = __webpack_require__(28745); -/** - * @typedef {Object} TimestampAndHash - * @property {number} safeTime - * @property {number=} timestamp - * @property {string} hash - */ +/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./ExportsInfo").ExportInfo} ExportInfo */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleProfile")} ModuleProfile */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ /** - * @typedef {Object} ResolvedContextTimestampAndHash - * @property {number} safeTime - * @property {string=} timestampHash - * @property {string} hash + * @callback OptimizationBailoutFunction + * @param {RequestShortener} requestShortener + * @returns {string} */ -/** - * @typedef {Object} ContextTimestampAndHash - * @property {number} safeTime - * @property {string=} timestampHash - * @property {string} hash - * @property {ResolvedContextTimestampAndHash=} resolved - * @property {Set=} symlinks - */ +const EMPTY_SET = new Set(); /** - * @typedef {Object} ContextHash - * @property {string} hash - * @property {string=} resolved - * @property {Set=} symlinks + * @param {SortableSet} set input + * @returns {readonly Map} mapped by origin module */ +const getConnectionsByOriginModule = set => { + const map = new Map(); + /** @type {Module | 0} */ + let lastModule = 0; + /** @type {ModuleGraphConnection[]} */ + let lastList = undefined; + for (const connection of set) { + const { originModule } = connection; + if (lastModule === originModule) { + lastList.push(connection); + } else { + lastModule = originModule; + const list = map.get(originModule); + if (list !== undefined) { + lastList = list; + list.push(connection); + } else { + const list = [connection]; + lastList = list; + map.set(originModule, list); + } + } + } + return map; +}; /** - * @typedef {Object} SnapshotOptimizationEntry - * @property {Snapshot} snapshot - * @property {number} shared - * @property {Set} snapshotContent - * @property {Set} children + * @param {SortableSet} set input + * @returns {readonly Map} mapped by module */ - -/** - * @typedef {Object} ResolveBuildDependenciesResult - * @property {Set} files list of files - * @property {Set} directories list of directories - * @property {Set} missing list of missing entries - * @property {Map} resolveResults stored resolve results - * @property {Object} resolveDependencies dependencies of the resolving - * @property {Set} resolveDependencies.files list of files - * @property {Set} resolveDependencies.directories list of directories - * @property {Set} resolveDependencies.missing list of missing entries - */ - -const DONE_ITERATOR_RESULT = new Set().keys().next(); - -// cspell:word tshs -// Tsh = Timestamp + Hash -// Tshs = Timestamp + Hash combinations - -class SnapshotIterator { - constructor(next) { - this.next = next; - } -} - -class SnapshotIterable { - constructor(snapshot, getMaps) { - this.snapshot = snapshot; - this.getMaps = getMaps; +const getConnectionsByModule = set => { + const map = new Map(); + /** @type {Module | 0} */ + let lastModule = 0; + /** @type {ModuleGraphConnection[]} */ + let lastList = undefined; + for (const connection of set) { + const { module } = connection; + if (lastModule === module) { + lastList.push(connection); + } else { + lastModule = module; + const list = map.get(module); + if (list !== undefined) { + lastList = list; + list.push(connection); + } else { + const list = [connection]; + lastList = list; + map.set(module, list); + } + } } + return map; +}; - [Symbol.iterator]() { - let state = 0; - /** @type {IterableIterator} */ - let it; - /** @type {(Snapshot) => (Map | Set)[]} */ - let getMaps; - /** @type {(Map | Set)[]} */ - let maps; - /** @type {Snapshot} */ - let snapshot; - let queue; - return new SnapshotIterator(() => { - for (;;) { - switch (state) { - case 0: - snapshot = this.snapshot; - getMaps = this.getMaps; - maps = getMaps(snapshot); - state = 1; - /* falls through */ - case 1: - if (maps.length > 0) { - const map = maps.pop(); - if (map !== undefined) { - it = map.keys(); - state = 2; - } else { - break; - } - } else { - state = 3; - break; - } - /* falls through */ - case 2: { - const result = it.next(); - if (!result.done) return result; - state = 1; - break; - } - case 3: { - const children = snapshot.children; - if (children !== undefined) { - if (children.size === 1) { - // shortcut for a single child - // avoids allocation of queue - for (const child of children) snapshot = child; - maps = getMaps(snapshot); - state = 1; - break; - } - if (queue === undefined) queue = []; - for (const child of children) { - queue.push(child); - } - } - if (queue !== undefined && queue.length > 0) { - snapshot = queue.pop(); - maps = getMaps(snapshot); - state = 1; - break; - } else { - state = 4; - } - } - /* falls through */ - case 4: - return DONE_ITERATOR_RESULT; - } - } - }); +class ModuleGraphModule { + constructor() { + /** @type {SortableSet} */ + this.incomingConnections = new SortableSet(); + /** @type {SortableSet | undefined} */ + this.outgoingConnections = undefined; + /** @type {Module | null} */ + this.issuer = undefined; + /** @type {(string | OptimizationBailoutFunction)[]} */ + this.optimizationBailout = []; + /** @type {ExportsInfo} */ + this.exports = new ExportsInfo(); + /** @type {number} */ + this.preOrderIndex = null; + /** @type {number} */ + this.postOrderIndex = null; + /** @type {number} */ + this.depth = null; + /** @type {ModuleProfile} */ + this.profile = undefined; + /** @type {boolean} */ + this.async = false; + /** @type {ModuleGraphConnection[]} */ + this._unassignedConnections = undefined; } } -class Snapshot { +class ModuleGraph { constructor() { - this._flags = 0; - /** @type {number | undefined} */ - this.startTime = undefined; - /** @type {Map | undefined} */ - this.fileTimestamps = undefined; - /** @type {Map | undefined} */ - this.fileHashes = undefined; - /** @type {Map | undefined} */ - this.fileTshs = undefined; - /** @type {Map | undefined} */ - this.contextTimestamps = undefined; - /** @type {Map | undefined} */ - this.contextHashes = undefined; - /** @type {Map | undefined} */ - this.contextTshs = undefined; - /** @type {Map | undefined} */ - this.missingExistence = undefined; - /** @type {Map | undefined} */ - this.managedItemInfo = undefined; - /** @type {Set | undefined} */ - this.managedFiles = undefined; - /** @type {Set | undefined} */ - this.managedContexts = undefined; - /** @type {Set | undefined} */ - this.managedMissing = undefined; - /** @type {Set | undefined} */ - this.children = undefined; - } + /** @type {WeakMap} */ + this._dependencyMap = new WeakMap(); + /** @type {Map} */ + this._moduleMap = new Map(); + /** @type {WeakMap} */ + this._metaMap = new WeakMap(); - hasStartTime() { - return (this._flags & 1) !== 0; - } + /** @type {WeakTupleMap} */ + this._cache = undefined; - setStartTime(value) { - this._flags = this._flags | 1; - this.startTime = value; + /** @type {Map>} */ + this._moduleMemCaches = undefined; } - setMergedStartTime(value, snapshot) { - if (value) { - if (snapshot.hasStartTime()) { - this.setStartTime(Math.min(value, snapshot.startTime)); - } else { - this.setStartTime(value); - } - } else { - if (snapshot.hasStartTime()) this.setStartTime(snapshot.startTime); + /** + * @param {Module} module the module + * @returns {ModuleGraphModule} the internal module + */ + _getModuleGraphModule(module) { + let mgm = this._moduleMap.get(module); + if (mgm === undefined) { + mgm = new ModuleGraphModule(); + this._moduleMap.set(module, mgm); } + return mgm; } - hasFileTimestamps() { - return (this._flags & 2) !== 0; + /** + * @param {Dependency} dependency the dependency + * @param {DependenciesBlock} block parent block + * @param {Module} module parent module + * @param {number=} indexInBlock position in block + * @returns {void} + */ + setParents(dependency, block, module, indexInBlock = -1) { + dependency._parentDependenciesBlockIndex = indexInBlock; + dependency._parentDependenciesBlock = block; + dependency._parentModule = module; } - setFileTimestamps(value) { - this._flags = this._flags | 2; - this.fileTimestamps = value; + /** + * @param {Dependency} dependency the dependency + * @returns {Module} parent module + */ + getParentModule(dependency) { + return dependency._parentModule; } - hasFileHashes() { - return (this._flags & 4) !== 0; + /** + * @param {Dependency} dependency the dependency + * @returns {DependenciesBlock} parent block + */ + getParentBlock(dependency) { + return dependency._parentDependenciesBlock; } - setFileHashes(value) { - this._flags = this._flags | 4; - this.fileHashes = value; + /** + * @param {Dependency} dependency the dependency + * @returns {number} index + */ + getParentBlockIndex(dependency) { + return dependency._parentDependenciesBlockIndex; } - hasFileTshs() { - return (this._flags & 8) !== 0; + /** + * @param {Module} originModule the referencing module + * @param {Dependency} dependency the referencing dependency + * @param {Module} module the referenced module + * @returns {void} + */ + setResolvedModule(originModule, dependency, module) { + const connection = new ModuleGraphConnection( + originModule, + dependency, + module, + undefined, + dependency.weak, + dependency.getCondition(this) + ); + const connections = this._getModuleGraphModule(module).incomingConnections; + connections.add(connection); + if (originModule) { + const mgm = this._getModuleGraphModule(originModule); + if (mgm._unassignedConnections === undefined) { + mgm._unassignedConnections = []; + } + mgm._unassignedConnections.push(connection); + if (mgm.outgoingConnections === undefined) { + mgm.outgoingConnections = new SortableSet(); + } + mgm.outgoingConnections.add(connection); + } else { + this._dependencyMap.set(dependency, connection); + } } - setFileTshs(value) { - this._flags = this._flags | 8; - this.fileTshs = value; + /** + * @param {Dependency} dependency the referencing dependency + * @param {Module} module the referenced module + * @returns {void} + */ + updateModule(dependency, module) { + const connection = this.getConnection(dependency); + if (connection.module === module) return; + const newConnection = connection.clone(); + newConnection.module = module; + this._dependencyMap.set(dependency, newConnection); + connection.setActive(false); + const originMgm = this._getModuleGraphModule(connection.originModule); + originMgm.outgoingConnections.add(newConnection); + const targetMgm = this._getModuleGraphModule(module); + targetMgm.incomingConnections.add(newConnection); } - hasContextTimestamps() { - return (this._flags & 0x10) !== 0; + /** + * @param {Dependency} dependency the referencing dependency + * @returns {void} + */ + removeConnection(dependency) { + const connection = this.getConnection(dependency); + const targetMgm = this._getModuleGraphModule(connection.module); + targetMgm.incomingConnections.delete(connection); + const originMgm = this._getModuleGraphModule(connection.originModule); + originMgm.outgoingConnections.delete(connection); + this._dependencyMap.set(dependency, null); } - setContextTimestamps(value) { - this._flags = this._flags | 0x10; - this.contextTimestamps = value; + /** + * @param {Dependency} dependency the referencing dependency + * @param {string} explanation an explanation + * @returns {void} + */ + addExplanation(dependency, explanation) { + const connection = this.getConnection(dependency); + connection.addExplanation(explanation); } - hasContextHashes() { - return (this._flags & 0x20) !== 0; + /** + * @param {Module} sourceModule the source module + * @param {Module} targetModule the target module + * @returns {void} + */ + cloneModuleAttributes(sourceModule, targetModule) { + const oldMgm = this._getModuleGraphModule(sourceModule); + const newMgm = this._getModuleGraphModule(targetModule); + newMgm.postOrderIndex = oldMgm.postOrderIndex; + newMgm.preOrderIndex = oldMgm.preOrderIndex; + newMgm.depth = oldMgm.depth; + newMgm.exports = oldMgm.exports; + newMgm.async = oldMgm.async; } - setContextHashes(value) { - this._flags = this._flags | 0x20; - this.contextHashes = value; + /** + * @param {Module} module the module + * @returns {void} + */ + removeModuleAttributes(module) { + const mgm = this._getModuleGraphModule(module); + mgm.postOrderIndex = null; + mgm.preOrderIndex = null; + mgm.depth = null; + mgm.async = false; } - hasContextTshs() { - return (this._flags & 0x40) !== 0; + /** + * @returns {void} + */ + removeAllModuleAttributes() { + for (const mgm of this._moduleMap.values()) { + mgm.postOrderIndex = null; + mgm.preOrderIndex = null; + mgm.depth = null; + mgm.async = false; + } } - setContextTshs(value) { - this._flags = this._flags | 0x40; - this.contextTshs = value; + /** + * @param {Module} oldModule the old referencing module + * @param {Module} newModule the new referencing module + * @param {function(ModuleGraphConnection): boolean} filterConnection filter predicate for replacement + * @returns {void} + */ + moveModuleConnections(oldModule, newModule, filterConnection) { + if (oldModule === newModule) return; + const oldMgm = this._getModuleGraphModule(oldModule); + const newMgm = this._getModuleGraphModule(newModule); + // Outgoing connections + const oldConnections = oldMgm.outgoingConnections; + if (oldConnections !== undefined) { + if (newMgm.outgoingConnections === undefined) { + newMgm.outgoingConnections = new SortableSet(); + } + const newConnections = newMgm.outgoingConnections; + for (const connection of oldConnections) { + if (filterConnection(connection)) { + connection.originModule = newModule; + newConnections.add(connection); + oldConnections.delete(connection); + } + } + } + // Incoming connections + const oldConnections2 = oldMgm.incomingConnections; + const newConnections2 = newMgm.incomingConnections; + for (const connection of oldConnections2) { + if (filterConnection(connection)) { + connection.module = newModule; + newConnections2.add(connection); + oldConnections2.delete(connection); + } + } } - hasMissingExistence() { - return (this._flags & 0x80) !== 0; + /** + * @param {Module} oldModule the old referencing module + * @param {Module} newModule the new referencing module + * @param {function(ModuleGraphConnection): boolean} filterConnection filter predicate for replacement + * @returns {void} + */ + copyOutgoingModuleConnections(oldModule, newModule, filterConnection) { + if (oldModule === newModule) return; + const oldMgm = this._getModuleGraphModule(oldModule); + const newMgm = this._getModuleGraphModule(newModule); + // Outgoing connections + const oldConnections = oldMgm.outgoingConnections; + if (oldConnections !== undefined) { + if (newMgm.outgoingConnections === undefined) { + newMgm.outgoingConnections = new SortableSet(); + } + const newConnections = newMgm.outgoingConnections; + for (const connection of oldConnections) { + if (filterConnection(connection)) { + const newConnection = connection.clone(); + newConnection.originModule = newModule; + newConnections.add(newConnection); + if (newConnection.module !== undefined) { + const otherMgm = this._getModuleGraphModule(newConnection.module); + otherMgm.incomingConnections.add(newConnection); + } + } + } + } } - setMissingExistence(value) { - this._flags = this._flags | 0x80; - this.missingExistence = value; + /** + * @param {Module} module the referenced module + * @param {string} explanation an explanation why it's referenced + * @returns {void} + */ + addExtraReason(module, explanation) { + const connections = this._getModuleGraphModule(module).incomingConnections; + connections.add(new ModuleGraphConnection(null, null, module, explanation)); } - hasManagedItemInfo() { - return (this._flags & 0x100) !== 0; + /** + * @param {Dependency} dependency the dependency to look for a referenced module + * @returns {Module} the referenced module + */ + getResolvedModule(dependency) { + const connection = this.getConnection(dependency); + return connection !== undefined ? connection.resolvedModule : null; } - setManagedItemInfo(value) { - this._flags = this._flags | 0x100; - this.managedItemInfo = value; + /** + * @param {Dependency} dependency the dependency to look for a referenced module + * @returns {ModuleGraphConnection | undefined} the connection + */ + getConnection(dependency) { + const connection = this._dependencyMap.get(dependency); + if (connection === undefined) { + const module = this.getParentModule(dependency); + if (module !== undefined) { + const mgm = this._getModuleGraphModule(module); + if ( + mgm._unassignedConnections && + mgm._unassignedConnections.length !== 0 + ) { + let foundConnection; + for (const connection of mgm._unassignedConnections) { + this._dependencyMap.set(connection.dependency, connection); + if (connection.dependency === dependency) + foundConnection = connection; + } + mgm._unassignedConnections.length = 0; + if (foundConnection !== undefined) { + return foundConnection; + } + } + } + this._dependencyMap.set(dependency, null); + return undefined; + } + return connection === null ? undefined : connection; } - hasManagedFiles() { - return (this._flags & 0x200) !== 0; + /** + * @param {Dependency} dependency the dependency to look for a referenced module + * @returns {Module} the referenced module + */ + getModule(dependency) { + const connection = this.getConnection(dependency); + return connection !== undefined ? connection.module : null; } - setManagedFiles(value) { - this._flags = this._flags | 0x200; - this.managedFiles = value; + /** + * @param {Dependency} dependency the dependency to look for a referencing module + * @returns {Module} the referencing module + */ + getOrigin(dependency) { + const connection = this.getConnection(dependency); + return connection !== undefined ? connection.originModule : null; } - hasManagedContexts() { - return (this._flags & 0x400) !== 0; + /** + * @param {Dependency} dependency the dependency to look for a referencing module + * @returns {Module} the original referencing module + */ + getResolvedOrigin(dependency) { + const connection = this.getConnection(dependency); + return connection !== undefined ? connection.resolvedOriginModule : null; } - setManagedContexts(value) { - this._flags = this._flags | 0x400; - this.managedContexts = value; + /** + * @param {Module} module the module + * @returns {Iterable} reasons why a module is included + */ + getIncomingConnections(module) { + const connections = this._getModuleGraphModule(module).incomingConnections; + return connections; } - hasManagedMissing() { - return (this._flags & 0x800) !== 0; + /** + * @param {Module} module the module + * @returns {Iterable} list of outgoing connections + */ + getOutgoingConnections(module) { + const connections = this._getModuleGraphModule(module).outgoingConnections; + return connections === undefined ? EMPTY_SET : connections; } - setManagedMissing(value) { - this._flags = this._flags | 0x800; - this.managedMissing = value; + /** + * @param {Module} module the module + * @returns {readonly Map} reasons why a module is included, in a map by source module + */ + getIncomingConnectionsByOriginModule(module) { + const connections = this._getModuleGraphModule(module).incomingConnections; + return connections.getFromUnorderedCache(getConnectionsByOriginModule); } - hasChildren() { - return (this._flags & 0x1000) !== 0; + /** + * @param {Module} module the module + * @returns {readonly Map | undefined} connections to modules, in a map by module + */ + getOutgoingConnectionsByModule(module) { + const connections = this._getModuleGraphModule(module).outgoingConnections; + return connections === undefined + ? undefined + : connections.getFromUnorderedCache(getConnectionsByModule); } - setChildren(value) { - this._flags = this._flags | 0x1000; - this.children = value; + /** + * @param {Module} module the module + * @returns {ModuleProfile | null} the module profile + */ + getProfile(module) { + const mgm = this._getModuleGraphModule(module); + return mgm.profile; } - addChild(child) { - if (!this.hasChildren()) { - this.setChildren(new Set()); - } - this.children.add(child); + /** + * @param {Module} module the module + * @param {ModuleProfile | null} profile the module profile + * @returns {void} + */ + setProfile(module, profile) { + const mgm = this._getModuleGraphModule(module); + mgm.profile = profile; } - serialize({ write }) { - write(this._flags); - if (this.hasStartTime()) write(this.startTime); - if (this.hasFileTimestamps()) write(this.fileTimestamps); - if (this.hasFileHashes()) write(this.fileHashes); - if (this.hasFileTshs()) write(this.fileTshs); - if (this.hasContextTimestamps()) write(this.contextTimestamps); - if (this.hasContextHashes()) write(this.contextHashes); - if (this.hasContextTshs()) write(this.contextTshs); - if (this.hasMissingExistence()) write(this.missingExistence); - if (this.hasManagedItemInfo()) write(this.managedItemInfo); - if (this.hasManagedFiles()) write(this.managedFiles); - if (this.hasManagedContexts()) write(this.managedContexts); - if (this.hasManagedMissing()) write(this.managedMissing); - if (this.hasChildren()) write(this.children); + /** + * @param {Module} module the module + * @returns {Module | null} the issuer module + */ + getIssuer(module) { + const mgm = this._getModuleGraphModule(module); + return mgm.issuer; } - deserialize({ read }) { - this._flags = read(); - if (this.hasStartTime()) this.startTime = read(); - if (this.hasFileTimestamps()) this.fileTimestamps = read(); - if (this.hasFileHashes()) this.fileHashes = read(); - if (this.hasFileTshs()) this.fileTshs = read(); - if (this.hasContextTimestamps()) this.contextTimestamps = read(); - if (this.hasContextHashes()) this.contextHashes = read(); - if (this.hasContextTshs()) this.contextTshs = read(); - if (this.hasMissingExistence()) this.missingExistence = read(); - if (this.hasManagedItemInfo()) this.managedItemInfo = read(); - if (this.hasManagedFiles()) this.managedFiles = read(); - if (this.hasManagedContexts()) this.managedContexts = read(); - if (this.hasManagedMissing()) this.managedMissing = read(); - if (this.hasChildren()) this.children = read(); + /** + * @param {Module} module the module + * @param {Module | null} issuer the issuer module + * @returns {void} + */ + setIssuer(module, issuer) { + const mgm = this._getModuleGraphModule(module); + mgm.issuer = issuer; } /** - * @param {function(Snapshot): (ReadonlyMap | ReadonlySet)[]} getMaps first - * @returns {Iterable} iterable + * @param {Module} module the module + * @param {Module | null} issuer the issuer module + * @returns {void} */ - _createIterable(getMaps) { - return new SnapshotIterable(this, getMaps); + setIssuerIfUnset(module, issuer) { + const mgm = this._getModuleGraphModule(module); + if (mgm.issuer === undefined) mgm.issuer = issuer; } /** - * @returns {Iterable} iterable + * @param {Module} module the module + * @returns {(string | OptimizationBailoutFunction)[]} optimization bailouts */ - getFileIterable() { - return this._createIterable(s => [ - s.fileTimestamps, - s.fileHashes, - s.fileTshs, - s.managedFiles - ]); + getOptimizationBailout(module) { + const mgm = this._getModuleGraphModule(module); + return mgm.optimizationBailout; } /** - * @returns {Iterable} iterable + * @param {Module} module the module + * @returns {true | string[] | null} the provided exports */ - getContextIterable() { - return this._createIterable(s => [ - s.contextTimestamps, - s.contextHashes, - s.contextTshs, - s.managedContexts - ]); + getProvidedExports(module) { + const mgm = this._getModuleGraphModule(module); + return mgm.exports.getProvidedExports(); } /** - * @returns {Iterable} iterable + * @param {Module} module the module + * @param {string | string[]} exportName a name of an export + * @returns {boolean | null} true, if the export is provided by the module. + * null, if it's unknown. + * false, if it's not provided. */ - getMissingIterable() { - return this._createIterable(s => [s.missingExistence, s.managedMissing]); + isExportProvided(module, exportName) { + const mgm = this._getModuleGraphModule(module); + const result = mgm.exports.isExportProvided(exportName); + return result === undefined ? null : result; } -} - -makeSerializable(Snapshot, "webpack/lib/FileSystemInfo", "Snapshot"); - -const MIN_COMMON_SNAPSHOT_SIZE = 3; -/** - * @template T - */ -class SnapshotOptimization { /** - * @param {function(Snapshot): boolean} has has value - * @param {function(Snapshot): Map | Set} get get value - * @param {function(Snapshot, Map | Set): void} set set value - * @param {boolean=} useStartTime use the start time of snapshots - * @param {boolean=} isSet value is an Set instead of a Map + * @param {Module} module the module + * @returns {ExportsInfo} info about the exports */ - constructor(has, get, set, useStartTime = true, isSet = false) { - this._has = has; - this._get = get; - this._set = set; - this._useStartTime = useStartTime; - this._isSet = isSet; - /** @type {Map} */ - this._map = new Map(); - this._statItemsShared = 0; - this._statItemsUnshared = 0; - this._statSharedSnapshots = 0; - this._statReusedSharedSnapshots = 0; + getExportsInfo(module) { + const mgm = this._getModuleGraphModule(module); + return mgm.exports; } - getStatisticMessage() { - const total = this._statItemsShared + this._statItemsUnshared; - if (total === 0) return undefined; - return `${ - this._statItemsShared && Math.round((this._statItemsShared * 100) / total) - }% (${this._statItemsShared}/${total}) entries shared via ${ - this._statSharedSnapshots - } shared snapshots (${ - this._statReusedSharedSnapshots + this._statSharedSnapshots - } times referenced)`; + /** + * @param {Module} module the module + * @param {string} exportName the export + * @returns {ExportInfo} info about the export + */ + getExportInfo(module, exportName) { + const mgm = this._getModuleGraphModule(module); + return mgm.exports.getExportInfo(exportName); } - clear() { - this._map.clear(); - this._statItemsShared = 0; - this._statItemsUnshared = 0; - this._statSharedSnapshots = 0; - this._statReusedSharedSnapshots = 0; + /** + * @param {Module} module the module + * @param {string} exportName the export + * @returns {ExportInfo} info about the export (do not modify) + */ + getReadOnlyExportInfo(module, exportName) { + const mgm = this._getModuleGraphModule(module); + return mgm.exports.getReadOnlyExportInfo(exportName); } /** - * @param {Snapshot} newSnapshot snapshot - * @param {Set} capturedFiles files to snapshot/share - * @returns {void} + * @param {Module} module the module + * @param {RuntimeSpec} runtime the runtime + * @returns {false | true | SortableSet | null} the used exports + * false: module is not used at all. + * true: the module namespace/object export is used. + * SortableSet: these export names are used. + * empty SortableSet: module is used but no export. + * null: unknown, worst case should be assumed. */ - optimize(newSnapshot, capturedFiles) { - /** - * @param {SnapshotOptimizationEntry} entry optimization entry - * @returns {void} - */ - const increaseSharedAndStoreOptimizationEntry = entry => { - if (entry.children !== undefined) { - entry.children.forEach(increaseSharedAndStoreOptimizationEntry); - } - entry.shared++; - storeOptimizationEntry(entry); - }; - /** - * @param {SnapshotOptimizationEntry} entry optimization entry - * @returns {void} - */ - const storeOptimizationEntry = entry => { - for (const path of entry.snapshotContent) { - const old = this._map.get(path); - if (old.shared < entry.shared) { - this._map.set(path, entry); - } - capturedFiles.delete(path); - } - }; + getUsedExports(module, runtime) { + const mgm = this._getModuleGraphModule(module); + return mgm.exports.getUsedExports(runtime); + } - /** @type {SnapshotOptimizationEntry} */ - let newOptimizationEntry = undefined; + /** + * @param {Module} module the module + * @returns {number} the index of the module + */ + getPreOrderIndex(module) { + const mgm = this._getModuleGraphModule(module); + return mgm.preOrderIndex; + } - const capturedFilesSize = capturedFiles.size; + /** + * @param {Module} module the module + * @returns {number} the index of the module + */ + getPostOrderIndex(module) { + const mgm = this._getModuleGraphModule(module); + return mgm.postOrderIndex; + } - /** @type {Set | undefined} */ - const optimizationEntries = new Set(); + /** + * @param {Module} module the module + * @param {number} index the index of the module + * @returns {void} + */ + setPreOrderIndex(module, index) { + const mgm = this._getModuleGraphModule(module); + mgm.preOrderIndex = index; + } - for (const path of capturedFiles) { - const optimizationEntry = this._map.get(path); - if (optimizationEntry === undefined) { - if (newOptimizationEntry === undefined) { - newOptimizationEntry = { - snapshot: newSnapshot, - shared: 0, - snapshotContent: undefined, - children: undefined - }; - } - this._map.set(path, newOptimizationEntry); - continue; - } else { - optimizationEntries.add(optimizationEntry); - } + /** + * @param {Module} module the module + * @param {number} index the index of the module + * @returns {boolean} true, if the index was set + */ + setPreOrderIndexIfUnset(module, index) { + const mgm = this._getModuleGraphModule(module); + if (mgm.preOrderIndex === null) { + mgm.preOrderIndex = index; + return true; } + return false; + } - optimizationEntries: for (const optimizationEntry of optimizationEntries) { - const snapshot = optimizationEntry.snapshot; - if (optimizationEntry.shared > 0) { - // It's a shared snapshot - // We can't change it, so we can only use it when all files match - // and startTime is compatible - if ( - this._useStartTime && - newSnapshot.startTime && - (!snapshot.startTime || snapshot.startTime > newSnapshot.startTime) - ) { - continue; - } - const nonSharedFiles = new Set(); - const snapshotContent = optimizationEntry.snapshotContent; - const snapshotEntries = this._get(snapshot); - for (const path of snapshotContent) { - if (!capturedFiles.has(path)) { - if (!snapshotEntries.has(path)) { - // File is not shared and can't be removed from the snapshot - // because it's in a child of the snapshot - continue optimizationEntries; - } - nonSharedFiles.add(path); - continue; - } - } - if (nonSharedFiles.size === 0) { - // The complete snapshot is shared - // add it as child - newSnapshot.addChild(snapshot); - increaseSharedAndStoreOptimizationEntry(optimizationEntry); - this._statReusedSharedSnapshots++; - } else { - // Only a part of the snapshot is shared - const sharedCount = snapshotContent.size - nonSharedFiles.size; - if (sharedCount < MIN_COMMON_SNAPSHOT_SIZE) { - // Common part it too small - continue optimizationEntries; - } - // Extract common timestamps from both snapshots - let commonMap; - if (this._isSet) { - commonMap = new Set(); - for (const path of /** @type {Set} */ (snapshotEntries)) { - if (nonSharedFiles.has(path)) continue; - commonMap.add(path); - snapshotEntries.delete(path); - } - } else { - commonMap = new Map(); - const map = /** @type {Map} */ (snapshotEntries); - for (const [path, value] of map) { - if (nonSharedFiles.has(path)) continue; - commonMap.set(path, value); - snapshotEntries.delete(path); - } - } - // Create and attach snapshot - const commonSnapshot = new Snapshot(); - if (this._useStartTime) { - commonSnapshot.setMergedStartTime(newSnapshot.startTime, snapshot); - } - this._set(commonSnapshot, commonMap); - newSnapshot.addChild(commonSnapshot); - snapshot.addChild(commonSnapshot); - // Create optimization entry - const newEntry = { - snapshot: commonSnapshot, - shared: optimizationEntry.shared + 1, - snapshotContent: new Set(commonMap.keys()), - children: undefined - }; - if (optimizationEntry.children === undefined) - optimizationEntry.children = new Set(); - optimizationEntry.children.add(newEntry); - storeOptimizationEntry(newEntry); - this._statSharedSnapshots++; - } - } else { - // It's a unshared snapshot - // We can extract a common shared snapshot - // with all common files - const snapshotEntries = this._get(snapshot); - if (snapshotEntries === undefined) { - // Incomplete snapshot, that can't be used - continue optimizationEntries; - } - let commonMap; - if (this._isSet) { - commonMap = new Set(); - const set = /** @type {Set} */ (snapshotEntries); - if (capturedFiles.size < set.size) { - for (const path of capturedFiles) { - if (set.has(path)) commonMap.add(path); - } - } else { - for (const path of set) { - if (capturedFiles.has(path)) commonMap.add(path); - } - } - } else { - commonMap = new Map(); - const map = /** @type {Map} */ (snapshotEntries); - for (const path of capturedFiles) { - const ts = map.get(path); - if (ts === undefined) continue; - commonMap.set(path, ts); - } - } + /** + * @param {Module} module the module + * @param {number} index the index of the module + * @returns {void} + */ + setPostOrderIndex(module, index) { + const mgm = this._getModuleGraphModule(module); + mgm.postOrderIndex = index; + } - if (commonMap.size < MIN_COMMON_SNAPSHOT_SIZE) { - // Common part it too small - continue optimizationEntries; - } - // Create and attach snapshot - const commonSnapshot = new Snapshot(); - if (this._useStartTime) { - commonSnapshot.setMergedStartTime(newSnapshot.startTime, snapshot); - } - this._set(commonSnapshot, commonMap); - newSnapshot.addChild(commonSnapshot); - snapshot.addChild(commonSnapshot); - // Remove files from snapshot - for (const path of commonMap.keys()) snapshotEntries.delete(path); - const sharedCount = commonMap.size; - this._statItemsUnshared -= sharedCount; - this._statItemsShared += sharedCount; - // Create optimization entry - storeOptimizationEntry({ - snapshot: commonSnapshot, - shared: 2, - snapshotContent: new Set(commonMap.keys()), - children: undefined - }); - this._statSharedSnapshots++; - } + /** + * @param {Module} module the module + * @param {number} index the index of the module + * @returns {boolean} true, if the index was set + */ + setPostOrderIndexIfUnset(module, index) { + const mgm = this._getModuleGraphModule(module); + if (mgm.postOrderIndex === null) { + mgm.postOrderIndex = index; + return true; } - const unshared = capturedFiles.size; - this._statItemsUnshared += unshared; - this._statItemsShared += capturedFilesSize - unshared; + return false; } -} -const parseString = str => { - if (str[0] === "'") str = `"${str.slice(1, -1).replace(/"/g, '\\"')}"`; - return JSON.parse(str); -}; + /** + * @param {Module} module the module + * @returns {number} the depth of the module + */ + getDepth(module) { + const mgm = this._getModuleGraphModule(module); + return mgm.depth; + } -/* istanbul ignore next */ -/** - * @param {number} mtime mtime - */ -const applyMtime = mtime => { - if (FS_ACCURACY > 1 && mtime % 2 !== 0) FS_ACCURACY = 1; - else if (FS_ACCURACY > 10 && mtime % 20 !== 0) FS_ACCURACY = 10; - else if (FS_ACCURACY > 100 && mtime % 200 !== 0) FS_ACCURACY = 100; - else if (FS_ACCURACY > 1000 && mtime % 2000 !== 0) FS_ACCURACY = 1000; -}; + /** + * @param {Module} module the module + * @param {number} depth the depth of the module + * @returns {void} + */ + setDepth(module, depth) { + const mgm = this._getModuleGraphModule(module); + mgm.depth = depth; + } -/** - * @template T - * @template K - * @param {Map} a source map - * @param {Map} b joining map - * @returns {Map} joined map - */ -const mergeMaps = (a, b) => { - if (!b || b.size === 0) return a; - if (!a || a.size === 0) return b; - const map = new Map(a); - for (const [key, value] of b) { - map.set(key, value); - } - return map; -}; - -/** - * @template T - * @template K - * @param {Set} a source map - * @param {Set} b joining map - * @returns {Set} joined map - */ -const mergeSets = (a, b) => { - if (!b || b.size === 0) return a; - if (!a || a.size === 0) return b; - const map = new Set(a); - for (const item of b) { - map.add(item); - } - return map; -}; - -/** - * Finding file or directory to manage - * @param {string} managedPath path that is managing by {@link FileSystemInfo} - * @param {string} path path to file or directory - * @returns {string|null} managed item - * @example - * getManagedItem( - * '/Users/user/my-project/node_modules/', - * '/Users/user/my-project/node_modules/package/index.js' - * ) === '/Users/user/my-project/node_modules/package' - * getManagedItem( - * '/Users/user/my-project/node_modules/', - * '/Users/user/my-project/node_modules/package1/node_modules/package2' - * ) === '/Users/user/my-project/node_modules/package1/node_modules/package2' - * getManagedItem( - * '/Users/user/my-project/node_modules/', - * '/Users/user/my-project/node_modules/.bin/script.js' - * ) === null // hidden files are disallowed as managed items - * getManagedItem( - * '/Users/user/my-project/node_modules/', - * '/Users/user/my-project/node_modules/package' - * ) === '/Users/user/my-project/node_modules/package' - */ -const getManagedItem = (managedPath, path) => { - let i = managedPath.length; - let slashes = 1; - let startingPosition = true; - loop: while (i < path.length) { - switch (path.charCodeAt(i)) { - case 47: // slash - case 92: // backslash - if (--slashes === 0) break loop; - startingPosition = true; - break; - case 46: // . - // hidden files are disallowed as managed items - // it's probably .yarn-integrity or .cache - if (startingPosition) return null; - break; - case 64: // @ - if (!startingPosition) return null; - slashes++; - break; - default: - startingPosition = false; - break; - } - i++; - } - if (i === path.length) slashes--; - // return null when path is incomplete - if (slashes !== 0) return null; - // if (path.slice(i + 1, i + 13) === "node_modules") - if ( - path.length >= i + 13 && - path.charCodeAt(i + 1) === 110 && - path.charCodeAt(i + 2) === 111 && - path.charCodeAt(i + 3) === 100 && - path.charCodeAt(i + 4) === 101 && - path.charCodeAt(i + 5) === 95 && - path.charCodeAt(i + 6) === 109 && - path.charCodeAt(i + 7) === 111 && - path.charCodeAt(i + 8) === 100 && - path.charCodeAt(i + 9) === 117 && - path.charCodeAt(i + 10) === 108 && - path.charCodeAt(i + 11) === 101 && - path.charCodeAt(i + 12) === 115 - ) { - // if this is the end of the path - if (path.length === i + 13) { - // return the node_modules directory - // it's special - return path; - } - const c = path.charCodeAt(i + 13); - // if next symbol is slash or backslash - if (c === 47 || c === 92) { - // Managed subpath - return getManagedItem(path.slice(0, i + 14), path); + /** + * @param {Module} module the module + * @param {number} depth the depth of the module + * @returns {boolean} true, if the depth was set + */ + setDepthIfLower(module, depth) { + const mgm = this._getModuleGraphModule(module); + if (mgm.depth === null || mgm.depth > depth) { + mgm.depth = depth; + return true; } + return false; } - return path.slice(0, i); -}; - -/** - * @template {ContextFileSystemInfoEntry | ContextTimestampAndHash} T - * @param {T} entry entry - * @returns {T["resolved"] | undefined} the resolved entry - */ -const getResolvedTimestamp = entry => { - if (entry === null) return null; - if (entry.resolved !== undefined) return entry.resolved; - return entry.symlinks === undefined ? entry : undefined; -}; - -/** - * @param {ContextHash} entry entry - * @returns {string | undefined} the resolved entry - */ -const getResolvedHash = entry => { - if (entry === null) return null; - if (entry.resolved !== undefined) return entry.resolved; - return entry.symlinks === undefined ? entry.hash : undefined; -}; - -const addAll = (source, target) => { - for (const key of source) target.add(key); -}; -/** - * Used to access information about the filesystem in a cached way - */ -class FileSystemInfo { /** - * @param {InputFileSystem} fs file system - * @param {Object} options options - * @param {Iterable=} options.managedPaths paths that are only managed by a package manager - * @param {Iterable=} options.immutablePaths paths that are immutable - * @param {Logger=} options.logger logger used to log invalid snapshots - * @param {string | Hash=} options.hashFunction the hash function to use + * @param {Module} module the module + * @returns {boolean} true, if the module is async */ - constructor( - fs, - { - managedPaths = [], - immutablePaths = [], - logger, - hashFunction = "md4" - } = {} - ) { - this.fs = fs; - this.logger = logger; - this._remainingLogs = logger ? 40 : 0; - this._loggedPaths = logger ? new Set() : undefined; - this._hashFunction = hashFunction; - /** @type {WeakMap} */ - this._snapshotCache = new WeakMap(); - this._fileTimestampsOptimization = new SnapshotOptimization( - s => s.hasFileTimestamps(), - s => s.fileTimestamps, - (s, v) => s.setFileTimestamps(v) - ); - this._fileHashesOptimization = new SnapshotOptimization( - s => s.hasFileHashes(), - s => s.fileHashes, - (s, v) => s.setFileHashes(v), - false - ); - this._fileTshsOptimization = new SnapshotOptimization( - s => s.hasFileTshs(), - s => s.fileTshs, - (s, v) => s.setFileTshs(v) - ); - this._contextTimestampsOptimization = new SnapshotOptimization( - s => s.hasContextTimestamps(), - s => s.contextTimestamps, - (s, v) => s.setContextTimestamps(v) - ); - this._contextHashesOptimization = new SnapshotOptimization( - s => s.hasContextHashes(), - s => s.contextHashes, - (s, v) => s.setContextHashes(v), - false - ); - this._contextTshsOptimization = new SnapshotOptimization( - s => s.hasContextTshs(), - s => s.contextTshs, - (s, v) => s.setContextTshs(v) - ); - this._missingExistenceOptimization = new SnapshotOptimization( - s => s.hasMissingExistence(), - s => s.missingExistence, - (s, v) => s.setMissingExistence(v), - false - ); - this._managedItemInfoOptimization = new SnapshotOptimization( - s => s.hasManagedItemInfo(), - s => s.managedItemInfo, - (s, v) => s.setManagedItemInfo(v), - false - ); - this._managedFilesOptimization = new SnapshotOptimization( - s => s.hasManagedFiles(), - s => s.managedFiles, - (s, v) => s.setManagedFiles(v), - false, - true - ); - this._managedContextsOptimization = new SnapshotOptimization( - s => s.hasManagedContexts(), - s => s.managedContexts, - (s, v) => s.setManagedContexts(v), - false, - true - ); - this._managedMissingOptimization = new SnapshotOptimization( - s => s.hasManagedMissing(), - s => s.managedMissing, - (s, v) => s.setManagedMissing(v), - false, - true - ); - /** @type {StackedCacheMap} */ - this._fileTimestamps = new StackedCacheMap(); - /** @type {Map} */ - this._fileHashes = new Map(); - /** @type {Map} */ - this._fileTshs = new Map(); - /** @type {StackedCacheMap} */ - this._contextTimestamps = new StackedCacheMap(); - /** @type {Map} */ - this._contextHashes = new Map(); - /** @type {Map} */ - this._contextTshs = new Map(); - /** @type {Map} */ - this._managedItems = new Map(); - /** @type {AsyncQueue} */ - this.fileTimestampQueue = new AsyncQueue({ - name: "file timestamp", - parallelism: 30, - processor: this._readFileTimestamp.bind(this) - }); - /** @type {AsyncQueue} */ - this.fileHashQueue = new AsyncQueue({ - name: "file hash", - parallelism: 10, - processor: this._readFileHash.bind(this) - }); - /** @type {AsyncQueue} */ - this.contextTimestampQueue = new AsyncQueue({ - name: "context timestamp", - parallelism: 2, - processor: this._readContextTimestamp.bind(this) - }); - /** @type {AsyncQueue} */ - this.contextHashQueue = new AsyncQueue({ - name: "context hash", - parallelism: 2, - processor: this._readContextHash.bind(this) - }); - /** @type {AsyncQueue} */ - this.contextTshQueue = new AsyncQueue({ - name: "context hash and timestamp", - parallelism: 2, - processor: this._readContextTimestampAndHash.bind(this) - }); - /** @type {AsyncQueue} */ - this.managedItemQueue = new AsyncQueue({ - name: "managed item info", - parallelism: 10, - processor: this._getManagedItemInfo.bind(this) - }); - /** @type {AsyncQueue>} */ - this.managedItemDirectoryQueue = new AsyncQueue({ - name: "managed item directory info", - parallelism: 10, - processor: this._getManagedItemDirectoryInfo.bind(this) - }); - this.managedPaths = Array.from(managedPaths); - this.managedPathsWithSlash = /** @type {string[]} */ ( - this.managedPaths.filter(p => typeof p === "string") - ).map(p => join(fs, p, "_").slice(0, -1)); - - this.managedPathsRegExps = /** @type {RegExp[]} */ ( - this.managedPaths.filter(p => typeof p !== "string") - ); - this.immutablePaths = Array.from(immutablePaths); - this.immutablePathsWithSlash = /** @type {string[]} */ ( - this.immutablePaths.filter(p => typeof p === "string") - ).map(p => join(fs, p, "_").slice(0, -1)); - this.immutablePathsRegExps = /** @type {RegExp[]} */ ( - this.immutablePaths.filter(p => typeof p !== "string") - ); - - this._cachedDeprecatedFileTimestamps = undefined; - this._cachedDeprecatedContextTimestamps = undefined; - - this._warnAboutExperimentalEsmTracking = false; - - this._statCreatedSnapshots = 0; - this._statTestedSnapshotsCached = 0; - this._statTestedSnapshotsNotCached = 0; - this._statTestedChildrenCached = 0; - this._statTestedChildrenNotCached = 0; - this._statTestedEntries = 0; + isAsync(module) { + const mgm = this._getModuleGraphModule(module); + return mgm.async; } - logStatistics() { - const logWhenMessage = (header, message) => { - if (message) { - this.logger.log(`${header}: ${message}`); - } - }; - this.logger.log(`${this._statCreatedSnapshots} new snapshots created`); - this.logger.log( - `${ - this._statTestedSnapshotsNotCached && - Math.round( - (this._statTestedSnapshotsNotCached * 100) / - (this._statTestedSnapshotsCached + - this._statTestedSnapshotsNotCached) - ) - }% root snapshot uncached (${this._statTestedSnapshotsNotCached} / ${ - this._statTestedSnapshotsCached + this._statTestedSnapshotsNotCached - })` - ); - this.logger.log( - `${ - this._statTestedChildrenNotCached && - Math.round( - (this._statTestedChildrenNotCached * 100) / - (this._statTestedChildrenCached + this._statTestedChildrenNotCached) - ) - }% children snapshot uncached (${this._statTestedChildrenNotCached} / ${ - this._statTestedChildrenCached + this._statTestedChildrenNotCached - })` - ); - this.logger.log(`${this._statTestedEntries} entries tested`); - this.logger.log( - `File info in cache: ${this._fileTimestamps.size} timestamps ${this._fileHashes.size} hashes ${this._fileTshs.size} timestamp hash combinations` - ); - logWhenMessage( - `File timestamp snapshot optimization`, - this._fileTimestampsOptimization.getStatisticMessage() - ); - logWhenMessage( - `File hash snapshot optimization`, - this._fileHashesOptimization.getStatisticMessage() - ); - logWhenMessage( - `File timestamp hash combination snapshot optimization`, - this._fileTshsOptimization.getStatisticMessage() - ); - this.logger.log( - `Directory info in cache: ${this._contextTimestamps.size} timestamps ${this._contextHashes.size} hashes ${this._contextTshs.size} timestamp hash combinations` - ); - logWhenMessage( - `Directory timestamp snapshot optimization`, - this._contextTimestampsOptimization.getStatisticMessage() - ); - logWhenMessage( - `Directory hash snapshot optimization`, - this._contextHashesOptimization.getStatisticMessage() - ); - logWhenMessage( - `Directory timestamp hash combination snapshot optimization`, - this._contextTshsOptimization.getStatisticMessage() - ); - logWhenMessage( - `Missing items snapshot optimization`, - this._missingExistenceOptimization.getStatisticMessage() - ); - this.logger.log( - `Managed items info in cache: ${this._managedItems.size} items` - ); - logWhenMessage( - `Managed items snapshot optimization`, - this._managedItemInfoOptimization.getStatisticMessage() - ); - logWhenMessage( - `Managed files snapshot optimization`, - this._managedFilesOptimization.getStatisticMessage() - ); - logWhenMessage( - `Managed contexts snapshot optimization`, - this._managedContextsOptimization.getStatisticMessage() - ); - logWhenMessage( - `Managed missing snapshot optimization`, - this._managedMissingOptimization.getStatisticMessage() - ); + /** + * @param {Module} module the module + * @returns {void} + */ + setAsync(module) { + const mgm = this._getModuleGraphModule(module); + mgm.async = true; } - _log(path, reason, ...args) { - const key = path + reason; - if (this._loggedPaths.has(key)) return; - this._loggedPaths.add(key); - this.logger.debug(`${path} invalidated because ${reason}`, ...args); - if (--this._remainingLogs === 0) { - this.logger.debug( - "Logging limit has been reached and no further logging will be emitted by FileSystemInfo" - ); + /** + * @param {any} thing any thing + * @returns {Object} metadata + */ + getMeta(thing) { + let meta = this._metaMap.get(thing); + if (meta === undefined) { + meta = Object.create(null); + this._metaMap.set(thing, meta); } - } - - clear() { - this._remainingLogs = this.logger ? 40 : 0; - if (this._loggedPaths !== undefined) this._loggedPaths.clear(); - - this._snapshotCache = new WeakMap(); - this._fileTimestampsOptimization.clear(); - this._fileHashesOptimization.clear(); - this._fileTshsOptimization.clear(); - this._contextTimestampsOptimization.clear(); - this._contextHashesOptimization.clear(); - this._contextTshsOptimization.clear(); - this._missingExistenceOptimization.clear(); - this._managedItemInfoOptimization.clear(); - this._managedFilesOptimization.clear(); - this._managedContextsOptimization.clear(); - this._managedMissingOptimization.clear(); - this._fileTimestamps.clear(); - this._fileHashes.clear(); - this._fileTshs.clear(); - this._contextTimestamps.clear(); - this._contextHashes.clear(); - this._contextTshs.clear(); - this._managedItems.clear(); - this._managedItems.clear(); - - this._cachedDeprecatedFileTimestamps = undefined; - this._cachedDeprecatedContextTimestamps = undefined; - - this._statCreatedSnapshots = 0; - this._statTestedSnapshotsCached = 0; - this._statTestedSnapshotsNotCached = 0; - this._statTestedChildrenCached = 0; - this._statTestedChildrenNotCached = 0; - this._statTestedEntries = 0; + return meta; } /** - * @param {ReadonlyMap} map timestamps - * @param {boolean=} immutable if 'map' is immutable and FileSystemInfo can keep referencing it - * @returns {void} + * @param {any} thing any thing + * @returns {Object} metadata */ - addFileTimestamps(map, immutable) { - this._fileTimestamps.addAll(map, immutable); - this._cachedDeprecatedFileTimestamps = undefined; + getMetaIfExisting(thing) { + return this._metaMap.get(thing); } /** - * @param {ReadonlyMap} map timestamps - * @param {boolean=} immutable if 'map' is immutable and FileSystemInfo can keep referencing it - * @returns {void} + * @param {string=} cacheStage a persistent stage name for caching */ - addContextTimestamps(map, immutable) { - this._contextTimestamps.addAll(map, immutable); - this._cachedDeprecatedContextTimestamps = undefined; + freeze(cacheStage) { + this._cache = new WeakTupleMap(); + this._cacheStage = cacheStage; + } + + unfreeze() { + this._cache = undefined; + this._cacheStage = undefined; } /** - * @param {string} path file path - * @param {function((WebpackError | null)=, (FileSystemInfoEntry | "ignore" | null)=): void} callback callback function - * @returns {void} + * @template {any[]} T + * @template V + * @param {(moduleGraph: ModuleGraph, ...args: T) => V} fn computer + * @param {T} args arguments + * @returns {V} computed value or cached */ - getFileTimestamp(path, callback) { - const cache = this._fileTimestamps.get(path); - if (cache !== undefined) return callback(null, cache); - this.fileTimestampQueue.add(path, callback); + cached(fn, ...args) { + if (this._cache === undefined) return fn(this, ...args); + return this._cache.provide(fn, ...args, () => fn(this, ...args)); } /** - * @param {string} path context path - * @param {function((WebpackError | null)=, (ResolvedContextFileSystemInfoEntry | "ignore" | null)=): void} callback callback function - * @returns {void} + * @param {Map>} moduleMemCaches mem caches for modules for better caching */ - getContextTimestamp(path, callback) { - const cache = this._contextTimestamps.get(path); - if (cache !== undefined) { - if (cache === "ignore") return callback(null, "ignore"); - const resolved = getResolvedTimestamp(cache); - if (resolved !== undefined) return callback(null, resolved); - return this._resolveContextTimestamp(cache, callback); + setModuleMemCaches(moduleMemCaches) { + this._moduleMemCaches = moduleMemCaches; + } + + /** + * @param {Dependency} dependency dependency + * @param {...any} args arguments, last argument is a function called with moduleGraph, dependency, ...args + * @returns {any} computed value or cached + */ + dependencyCacheProvide(dependency, ...args) { + /** @type {(moduleGraph: ModuleGraph, dependency: Dependency, ...args: any[]) => any} */ + const fn = args.pop(); + if (this._moduleMemCaches && this._cacheStage) { + const memCache = this._moduleMemCaches.get( + this.getParentModule(dependency) + ); + if (memCache !== undefined) { + return memCache.provide(dependency, this._cacheStage, ...args, () => + fn(this, dependency, ...args) + ); + } } - this.contextTimestampQueue.add(path, (err, entry) => { - if (err) return callback(err); - const resolved = getResolvedTimestamp(entry); - if (resolved !== undefined) return callback(null, resolved); - this._resolveContextTimestamp(entry, callback); - }); + if (this._cache === undefined) return fn(this, dependency, ...args); + return this._cache.provide(dependency, ...args, () => + fn(this, dependency, ...args) + ); } + // TODO remove in webpack 6 /** - * @param {string} path context path - * @param {function((WebpackError | null)=, (ContextFileSystemInfoEntry | "ignore" | null)=): void} callback callback function - * @returns {void} + * @param {Module} module the module + * @param {string} deprecateMessage message for the deprecation message + * @param {string} deprecationCode code for the deprecation + * @returns {ModuleGraph} the module graph */ - _getUnresolvedContextTimestamp(path, callback) { - const cache = this._contextTimestamps.get(path); - if (cache !== undefined) return callback(null, cache); - this.contextTimestampQueue.add(path, callback); + static getModuleGraphForModule(module, deprecateMessage, deprecationCode) { + const fn = deprecateMap.get(deprecateMessage); + if (fn) return fn(module); + const newFn = util.deprecate( + /** + * @param {Module} module the module + * @returns {ModuleGraph} the module graph + */ + module => { + const moduleGraph = moduleGraphForModuleMap.get(module); + if (!moduleGraph) + throw new Error( + deprecateMessage + + "There was no ModuleGraph assigned to the Module for backward-compat (Use the new API)" + ); + return moduleGraph; + }, + deprecateMessage + ": Use new ModuleGraph API", + deprecationCode + ); + deprecateMap.set(deprecateMessage, newFn); + return newFn(module); } + // TODO remove in webpack 6 /** - * @param {string} path file path - * @param {function((WebpackError | null)=, string=): void} callback callback function + * @param {Module} module the module + * @param {ModuleGraph} moduleGraph the module graph * @returns {void} */ - getFileHash(path, callback) { - const cache = this._fileHashes.get(path); - if (cache !== undefined) return callback(null, cache); - this.fileHashQueue.add(path, callback); + static setModuleGraphForModule(module, moduleGraph) { + moduleGraphForModuleMap.set(module, moduleGraph); } + // TODO remove in webpack 6 /** - * @param {string} path context path - * @param {function((WebpackError | null)=, string=): void} callback callback function + * @param {Module} module the module * @returns {void} */ - getContextHash(path, callback) { - const cache = this._contextHashes.get(path); - if (cache !== undefined) { - const resolved = getResolvedHash(cache); - if (resolved !== undefined) return callback(null, resolved); - return this._resolveContextHash(cache, callback); + static clearModuleGraphForModule(module) { + moduleGraphForModuleMap.delete(module); + } +} + +// TODO remove in webpack 6 +/** @type {WeakMap} */ +const moduleGraphForModuleMap = new WeakMap(); + +// TODO remove in webpack 6 +/** @type {Map ModuleGraph>} */ +const deprecateMap = new Map(); + +module.exports = ModuleGraph; +module.exports.ModuleGraphConnection = ModuleGraphConnection; + + +/***/ }), + +/***/ 40639: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ + +/** + * Module itself is not connected, but transitive modules are connected transitively. + */ +const TRANSITIVE_ONLY = Symbol("transitive only"); + +/** + * While determining the active state, this flag is used to signal a circular connection. + */ +const CIRCULAR_CONNECTION = Symbol("circular connection"); + +/** @typedef {boolean | typeof TRANSITIVE_ONLY | typeof CIRCULAR_CONNECTION} ConnectionState */ + +/** + * @param {ConnectionState} a first + * @param {ConnectionState} b second + * @returns {ConnectionState} merged + */ +const addConnectionStates = (a, b) => { + if (a === true || b === true) return true; + if (a === false) return b; + if (b === false) return a; + if (a === TRANSITIVE_ONLY) return b; + if (b === TRANSITIVE_ONLY) return a; + return a; +}; + +/** + * @param {ConnectionState} a first + * @param {ConnectionState} b second + * @returns {ConnectionState} intersected + */ +const intersectConnectionStates = (a, b) => { + if (a === false || b === false) return false; + if (a === true) return b; + if (b === true) return a; + if (a === CIRCULAR_CONNECTION) return b; + if (b === CIRCULAR_CONNECTION) return a; + return a; +}; + +class ModuleGraphConnection { + /** + * @param {Module|null} originModule the referencing module + * @param {Dependency|null} dependency the referencing dependency + * @param {Module} module the referenced module + * @param {string=} explanation some extra detail + * @param {boolean=} weak the reference is weak + * @param {false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState=} condition condition for the connection + */ + constructor( + originModule, + dependency, + module, + explanation, + weak = false, + condition = undefined + ) { + this.originModule = originModule; + this.resolvedOriginModule = originModule; + this.dependency = dependency; + this.resolvedModule = module; + this.module = module; + this.weak = weak; + this.conditional = !!condition; + this._active = condition !== false; + /** @type {function(ModuleGraphConnection, RuntimeSpec): ConnectionState} */ + this.condition = condition || undefined; + /** @type {Set} */ + this.explanations = undefined; + if (explanation) { + this.explanations = new Set(); + this.explanations.add(explanation); } - this.contextHashQueue.add(path, (err, entry) => { - if (err) return callback(err); - const resolved = getResolvedHash(entry); - if (resolved !== undefined) return callback(null, resolved); - this._resolveContextHash(entry, callback); - }); + } + + clone() { + const clone = new ModuleGraphConnection( + this.resolvedOriginModule, + this.dependency, + this.resolvedModule, + undefined, + this.weak, + this.condition + ); + clone.originModule = this.originModule; + clone.module = this.module; + clone.conditional = this.conditional; + clone._active = this._active; + if (this.explanations) clone.explanations = new Set(this.explanations); + return clone; } /** - * @param {string} path context path - * @param {function((WebpackError | null)=, ContextHash=): void} callback callback function + * @param {function(ModuleGraphConnection, RuntimeSpec): ConnectionState} condition condition for the connection * @returns {void} */ - _getUnresolvedContextHash(path, callback) { - const cache = this._contextHashes.get(path); - if (cache !== undefined) return callback(null, cache); - this.contextHashQueue.add(path, callback); + addCondition(condition) { + if (this.conditional) { + const old = this.condition; + this.condition = (c, r) => + intersectConnectionStates(old(c, r), condition(c, r)); + } else if (this._active) { + this.conditional = true; + this.condition = condition; + } } /** - * @param {string} path context path - * @param {function((WebpackError | null)=, ResolvedContextTimestampAndHash=): void} callback callback function + * @param {string} explanation the explanation to add * @returns {void} */ - getContextTsh(path, callback) { - const cache = this._contextTshs.get(path); - if (cache !== undefined) { - const resolved = getResolvedTimestamp(cache); - if (resolved !== undefined) return callback(null, resolved); - return this._resolveContextTsh(cache, callback); + addExplanation(explanation) { + if (this.explanations === undefined) { + this.explanations = new Set(); } - this.contextTshQueue.add(path, (err, entry) => { - if (err) return callback(err); - const resolved = getResolvedTimestamp(entry); - if (resolved !== undefined) return callback(null, resolved); - this._resolveContextTsh(entry, callback); - }); + this.explanations.add(explanation); + } + + get explanation() { + if (this.explanations === undefined) return ""; + return Array.from(this.explanations).join(" "); + } + + // TODO webpack 5 remove + get active() { + throw new Error("Use getActiveState instead"); } /** - * @param {string} path context path - * @param {function((WebpackError | null)=, ContextTimestampAndHash=): void} callback callback function - * @returns {void} + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true, if the connection is active */ - _getUnresolvedContextTsh(path, callback) { - const cache = this._contextTshs.get(path); - if (cache !== undefined) return callback(null, cache); - this.contextTshQueue.add(path, callback); + isActive(runtime) { + if (!this.conditional) return this._active; + return this.condition(this, runtime) !== false; } - _createBuildDependenciesResolvers() { - const resolveContext = createResolver({ - resolveToContext: true, - exportsFields: [], - fileSystem: this.fs - }); - const resolveCjs = createResolver({ - extensions: [".js", ".json", ".node"], - conditionNames: ["require", "node"], - exportsFields: ["exports"], - fileSystem: this.fs - }); - const resolveCjsAsChild = createResolver({ - extensions: [".js", ".json", ".node"], - conditionNames: ["require", "node"], - exportsFields: [], - fileSystem: this.fs - }); - const resolveEsm = createResolver({ - extensions: [".js", ".json", ".node"], - fullySpecified: true, - conditionNames: ["import", "node"], - exportsFields: ["exports"], - fileSystem: this.fs - }); - return { resolveContext, resolveEsm, resolveCjs, resolveCjsAsChild }; + /** + * @param {RuntimeSpec} runtime the runtime + * @returns {boolean} true, if the connection is active + */ + isTargetActive(runtime) { + if (!this.conditional) return this._active; + return this.condition(this, runtime) === true; } /** - * @param {string} context context directory - * @param {Iterable} deps dependencies - * @param {function((Error | null)=, ResolveBuildDependenciesResult=): void} callback callback function + * @param {RuntimeSpec} runtime the runtime + * @returns {ConnectionState} true: fully active, false: inactive, TRANSITIVE: direct module inactive, but transitive connection maybe active + */ + getActiveState(runtime) { + if (!this.conditional) return this._active; + return this.condition(this, runtime); + } + + /** + * @param {boolean} value active or not * @returns {void} */ - resolveBuildDependencies(context, deps, callback) { - const { resolveContext, resolveEsm, resolveCjs, resolveCjsAsChild } = - this._createBuildDependenciesResolvers(); + setActive(value) { + this.conditional = false; + this._active = value; + } - /** @type {Set} */ - const files = new Set(); - /** @type {Set} */ - const fileSymlinks = new Set(); - /** @type {Set} */ - const directories = new Set(); - /** @type {Set} */ - const directorySymlinks = new Set(); - /** @type {Set} */ - const missing = new Set(); - /** @type {Set} */ - const resolveFiles = new Set(); - /** @type {Set} */ - const resolveDirectories = new Set(); - /** @type {Set} */ - const resolveMissing = new Set(); - /** @type {Map} */ - const resolveResults = new Map(); - const invalidResolveResults = new Set(); - const resolverContext = { - fileDependencies: resolveFiles, - contextDependencies: resolveDirectories, - missingDependencies: resolveMissing - }; - const expectedToString = expected => { - return expected ? ` (expected ${expected})` : ""; - }; - const jobToString = job => { - switch (job.type) { - case RBDT_RESOLVE_CJS: - return `resolve commonjs ${job.path}${expectedToString( - job.expected - )}`; - case RBDT_RESOLVE_ESM: - return `resolve esm ${job.path}${expectedToString(job.expected)}`; - case RBDT_RESOLVE_DIRECTORY: - return `resolve directory ${job.path}`; - case RBDT_RESOLVE_CJS_FILE: - return `resolve commonjs file ${job.path}${expectedToString( - job.expected - )}`; - case RBDT_RESOLVE_ESM_FILE: - return `resolve esm file ${job.path}${expectedToString( - job.expected - )}`; - case RBDT_DIRECTORY: - return `directory ${job.path}`; - case RBDT_FILE: - return `file ${job.path}`; - case RBDT_DIRECTORY_DEPENDENCIES: - return `directory dependencies ${job.path}`; - case RBDT_FILE_DEPENDENCIES: - return `file dependencies ${job.path}`; - } - return `unknown ${job.type} ${job.path}`; - }; - const pathToString = job => { - let result = ` at ${jobToString(job)}`; - job = job.issuer; - while (job !== undefined) { - result += `\n at ${jobToString(job)}`; - job = job.issuer; - } - return result; - }; - processAsyncTree( - Array.from(deps, dep => ({ - type: RBDT_RESOLVE_CJS, - context, - path: dep, - expected: undefined, - issuer: undefined - })), - 20, - (job, push, callback) => { - const { type, context, path, expected } = job; - const resolveDirectory = path => { - const key = `d\n${context}\n${path}`; - if (resolveResults.has(key)) { - return callback(); - } - resolveResults.set(key, undefined); - resolveContext(context, path, resolverContext, (err, _, result) => { - if (err) { - if (expected === false) { - resolveResults.set(key, false); - return callback(); - } - invalidResolveResults.add(key); - err.message += `\nwhile resolving '${path}' in ${context} to a directory`; - return callback(err); - } - const resultPath = result.path; - resolveResults.set(key, resultPath); - push({ - type: RBDT_DIRECTORY, - context: undefined, - path: resultPath, - expected: undefined, - issuer: job - }); - callback(); - }); - }; - const resolveFile = (path, symbol, resolve) => { - const key = `${symbol}\n${context}\n${path}`; - if (resolveResults.has(key)) { - return callback(); - } - resolveResults.set(key, undefined); - resolve(context, path, resolverContext, (err, _, result) => { - if (typeof expected === "string") { - if (!err && result && result.path === expected) { - resolveResults.set(key, result.path); - } else { - invalidResolveResults.add(key); - this.logger.warn( - `Resolving '${path}' in ${context} for build dependencies doesn't lead to expected result '${expected}', but to '${ - err || (result && result.path) - }' instead. Resolving dependencies are ignored for this path.\n${pathToString( - job - )}` - ); - } - } else { - if (err) { - if (expected === false) { - resolveResults.set(key, false); - return callback(); - } - invalidResolveResults.add(key); - err.message += `\nwhile resolving '${path}' in ${context} as file\n${pathToString( - job - )}`; - return callback(err); - } - const resultPath = result.path; - resolveResults.set(key, resultPath); - push({ - type: RBDT_FILE, - context: undefined, - path: resultPath, - expected: undefined, - issuer: job - }); - } - callback(); - }); - }; - switch (type) { - case RBDT_RESOLVE_CJS: { - const isDirectory = /[\\/]$/.test(path); - if (isDirectory) { - resolveDirectory(path.slice(0, path.length - 1)); - } else { - resolveFile(path, "f", resolveCjs); - } - break; - } - case RBDT_RESOLVE_ESM: { - const isDirectory = /[\\/]$/.test(path); - if (isDirectory) { - resolveDirectory(path.slice(0, path.length - 1)); - } else { - resolveFile(path); - } - break; - } - case RBDT_RESOLVE_DIRECTORY: { - resolveDirectory(path); - break; - } - case RBDT_RESOLVE_CJS_FILE: { - resolveFile(path, "f", resolveCjs); - break; - } - case RBDT_RESOLVE_CJS_FILE_AS_CHILD: { - resolveFile(path, "c", resolveCjsAsChild); - break; - } - case RBDT_RESOLVE_ESM_FILE: { - resolveFile(path, "e", resolveEsm); - break; - } - case RBDT_FILE: { - if (files.has(path)) { - callback(); - break; - } - files.add(path); - this.fs.realpath(path, (err, _realPath) => { - if (err) return callback(err); - const realPath = /** @type {string} */ (_realPath); - if (realPath !== path) { - fileSymlinks.add(path); - resolveFiles.add(path); - if (files.has(realPath)) return callback(); - files.add(realPath); - } - push({ - type: RBDT_FILE_DEPENDENCIES, - context: undefined, - path: realPath, - expected: undefined, - issuer: job - }); - callback(); - }); - break; - } - case RBDT_DIRECTORY: { - if (directories.has(path)) { - callback(); - break; - } - directories.add(path); - this.fs.realpath(path, (err, _realPath) => { - if (err) return callback(err); - const realPath = /** @type {string} */ (_realPath); - if (realPath !== path) { - directorySymlinks.add(path); - resolveFiles.add(path); - if (directories.has(realPath)) return callback(); - directories.add(realPath); - } - push({ - type: RBDT_DIRECTORY_DEPENDENCIES, - context: undefined, - path: realPath, - expected: undefined, - issuer: job - }); - callback(); - }); - break; - } - case RBDT_FILE_DEPENDENCIES: { - // Check for known files without dependencies - if (/\.json5?$|\.yarn-integrity$|yarn\.lock$|\.ya?ml/.test(path)) { - process.nextTick(callback); - break; - } - // Check commonjs cache for the module - /** @type {NodeModule} */ - const module = require.cache[path]; - if (module && Array.isArray(module.children)) { - children: for (const child of module.children) { - let childPath = child.filename; - if (childPath) { - push({ - type: RBDT_FILE, - context: undefined, - path: childPath, - expected: undefined, - issuer: job - }); - const context = dirname(this.fs, path); - for (const modulePath of module.paths) { - if (childPath.startsWith(modulePath)) { - let subPath = childPath.slice(modulePath.length + 1); - const packageMatch = /^(@[^\\/]+[\\/])[^\\/]+/.exec( - subPath - ); - if (packageMatch) { - push({ - type: RBDT_FILE, - context: undefined, - path: - modulePath + - childPath[modulePath.length] + - packageMatch[0] + - childPath[modulePath.length] + - "package.json", - expected: false, - issuer: job - }); - } - let request = subPath.replace(/\\/g, "/"); - if (request.endsWith(".js")) - request = request.slice(0, -3); - push({ - type: RBDT_RESOLVE_CJS_FILE_AS_CHILD, - context, - path: request, - expected: child.filename, - issuer: job - }); - continue children; - } - } - let request = relative(this.fs, context, childPath); - if (request.endsWith(".js")) request = request.slice(0, -3); - request = request.replace(/\\/g, "/"); - if (!request.startsWith("../")) request = `./${request}`; - push({ - type: RBDT_RESOLVE_CJS_FILE, - context, - path: request, - expected: child.filename, - issuer: job - }); - } - } - } else if (supportsEsm && /\.m?js$/.test(path)) { - if (!this._warnAboutExperimentalEsmTracking) { - this.logger.log( - "Node.js doesn't offer a (nice) way to introspect the ESM dependency graph yet.\n" + - "Until a full solution is available webpack uses an experimental ESM tracking based on parsing.\n" + - "As best effort webpack parses the ESM files to guess dependencies. But this can lead to expensive and incorrect tracking." - ); - this._warnAboutExperimentalEsmTracking = true; - } - const lexer = __webpack_require__(54392); - lexer.init.then(() => { - this.fs.readFile(path, (err, content) => { - if (err) return callback(err); - try { - const context = dirname(this.fs, path); - const source = content.toString(); - const [imports] = lexer.parse(source); - for (const imp of imports) { - try { - let dependency; - if (imp.d === -1) { - // import ... from "..." - dependency = parseString( - source.substring(imp.s - 1, imp.e + 1) - ); - } else if (imp.d > -1) { - // import() - let expr = source.substring(imp.s, imp.e).trim(); - dependency = parseString(expr); - } else { - // e.g. import.meta - continue; - } - push({ - type: RBDT_RESOLVE_ESM_FILE, - context, - path: dependency, - expected: undefined, - issuer: job - }); - } catch (e) { - this.logger.warn( - `Parsing of ${path} for build dependencies failed at 'import(${source.substring( - imp.s, - imp.e - )})'.\n` + - "Build dependencies behind this expression are ignored and might cause incorrect cache invalidation." - ); - this.logger.debug(pathToString(job)); - this.logger.debug(e.stack); - } - } - } catch (e) { - this.logger.warn( - `Parsing of ${path} for build dependencies failed and all dependencies of this file are ignored, which might cause incorrect cache invalidation..` - ); - this.logger.debug(pathToString(job)); - this.logger.debug(e.stack); - } - process.nextTick(callback); - }); - }, callback); - break; - } else { - this.logger.log( - `Assuming ${path} has no dependencies as we were unable to assign it to any module system.` - ); - this.logger.debug(pathToString(job)); - } - process.nextTick(callback); - break; - } - case RBDT_DIRECTORY_DEPENDENCIES: { - const match = - /(^.+[\\/]node_modules[\\/](?:@[^\\/]+[\\/])?[^\\/]+)/.exec(path); - const packagePath = match ? match[1] : path; - const packageJson = join(this.fs, packagePath, "package.json"); - this.fs.readFile(packageJson, (err, content) => { - if (err) { - if (err.code === "ENOENT") { - resolveMissing.add(packageJson); - const parent = dirname(this.fs, packagePath); - if (parent !== packagePath) { - push({ - type: RBDT_DIRECTORY_DEPENDENCIES, - context: undefined, - path: parent, - expected: undefined, - issuer: job - }); - } - callback(); - return; - } - return callback(err); - } - resolveFiles.add(packageJson); - let packageData; - try { - packageData = JSON.parse(content.toString("utf-8")); - } catch (e) { - return callback(e); - } - const depsObject = packageData.dependencies; - const optionalDepsObject = packageData.optionalDependencies; - const allDeps = new Set(); - const optionalDeps = new Set(); - if (typeof depsObject === "object" && depsObject) { - for (const dep of Object.keys(depsObject)) { - allDeps.add(dep); - } - } - if ( - typeof optionalDepsObject === "object" && - optionalDepsObject - ) { - for (const dep of Object.keys(optionalDepsObject)) { - allDeps.add(dep); - optionalDeps.add(dep); - } - } - for (const dep of allDeps) { - push({ - type: RBDT_RESOLVE_DIRECTORY, - context: packagePath, - path: dep, - expected: !optionalDeps.has(dep), - issuer: job - }); - } - callback(); - }); - break; - } - } - }, - err => { - if (err) return callback(err); - for (const l of fileSymlinks) files.delete(l); - for (const l of directorySymlinks) directories.delete(l); - for (const k of invalidResolveResults) resolveResults.delete(k); - callback(null, { - files, - directories, - missing, - resolveResults, - resolveDependencies: { - files: resolveFiles, - directories: resolveDirectories, - missing: resolveMissing - } - }); - } - ); + set active(value) { + throw new Error("Use setActive instead"); } +} - /** - * @param {Map} resolveResults results from resolving - * @param {function((Error | null)=, boolean=): void} callback callback with true when resolveResults resolve the same way - * @returns {void} - */ - checkResolveResultsValid(resolveResults, callback) { - const { resolveCjs, resolveCjsAsChild, resolveEsm, resolveContext } = - this._createBuildDependenciesResolvers(); - asyncLib.eachLimit( - resolveResults, - 20, - ([key, expectedResult], callback) => { - const [type, context, path] = key.split("\n"); - switch (type) { - case "d": - resolveContext(context, path, {}, (err, _, result) => { - if (expectedResult === false) - return callback(err ? undefined : INVALID); - if (err) return callback(err); - const resultPath = result.path; - if (resultPath !== expectedResult) return callback(INVALID); - callback(); - }); - break; - case "f": - resolveCjs(context, path, {}, (err, _, result) => { - if (expectedResult === false) - return callback(err ? undefined : INVALID); - if (err) return callback(err); - const resultPath = result.path; - if (resultPath !== expectedResult) return callback(INVALID); - callback(); - }); - break; - case "c": - resolveCjsAsChild(context, path, {}, (err, _, result) => { - if (expectedResult === false) - return callback(err ? undefined : INVALID); - if (err) return callback(err); - const resultPath = result.path; - if (resultPath !== expectedResult) return callback(INVALID); - callback(); - }); - break; - case "e": - resolveEsm(context, path, {}, (err, _, result) => { - if (expectedResult === false) - return callback(err ? undefined : INVALID); - if (err) return callback(err); - const resultPath = result.path; - if (resultPath !== expectedResult) return callback(INVALID); - callback(); - }); - break; - default: - callback(new Error("Unexpected type in resolve result key")); - break; - } - }, - /** - * @param {Error | typeof INVALID=} err error or invalid flag - * @returns {void} - */ - err => { - if (err === INVALID) { - return callback(null, false); - } - if (err) { - return callback(err); - } - return callback(null, true); - } - ); - } +/** @typedef {typeof TRANSITIVE_ONLY} TRANSITIVE_ONLY */ +/** @typedef {typeof CIRCULAR_CONNECTION} CIRCULAR_CONNECTION */ - /** - * - * @param {number} startTime when processing the files has started - * @param {Iterable} files all files - * @param {Iterable} directories all directories - * @param {Iterable} missing all missing files or directories - * @param {Object} options options object (for future extensions) - * @param {boolean=} options.hash should use hash to snapshot - * @param {boolean=} options.timestamp should use timestamp to snapshot - * @param {function((WebpackError | null)=, (Snapshot | null)=): void} callback callback function - * @returns {void} - */ - createSnapshot(startTime, files, directories, missing, options, callback) { - /** @type {Map} */ - const fileTimestamps = new Map(); - /** @type {Map} */ - const fileHashes = new Map(); - /** @type {Map} */ - const fileTshs = new Map(); - /** @type {Map} */ - const contextTimestamps = new Map(); - /** @type {Map} */ - const contextHashes = new Map(); - /** @type {Map} */ - const contextTshs = new Map(); - /** @type {Map} */ - const missingExistence = new Map(); - /** @type {Map} */ - const managedItemInfo = new Map(); - /** @type {Set} */ - const managedFiles = new Set(); - /** @type {Set} */ - const managedContexts = new Set(); - /** @type {Set} */ - const managedMissing = new Set(); - /** @type {Set} */ - const children = new Set(); +module.exports = ModuleGraphConnection; +module.exports.addConnectionStates = addConnectionStates; +module.exports.TRANSITIVE_ONLY = /** @type {typeof TRANSITIVE_ONLY} */ ( + TRANSITIVE_ONLY +); +module.exports.CIRCULAR_CONNECTION = /** @type {typeof CIRCULAR_CONNECTION} */ ( + CIRCULAR_CONNECTION +); - const snapshot = new Snapshot(); - if (startTime) snapshot.setStartTime(startTime); - /** @type {Set} */ - const managedItems = new Set(); +/***/ }), - /** 1 = timestamp, 2 = hash, 3 = timestamp + hash */ - const mode = options && options.hash ? (options.timestamp ? 3 : 2) : 1; +/***/ 3454: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - let jobs = 1; - const jobDone = () => { - if (--jobs === 0) { - if (fileTimestamps.size !== 0) { - snapshot.setFileTimestamps(fileTimestamps); - } - if (fileHashes.size !== 0) { - snapshot.setFileHashes(fileHashes); - } - if (fileTshs.size !== 0) { - snapshot.setFileTshs(fileTshs); - } - if (contextTimestamps.size !== 0) { - snapshot.setContextTimestamps(contextTimestamps); - } - if (contextHashes.size !== 0) { - snapshot.setContextHashes(contextHashes); - } - if (contextTshs.size !== 0) { - snapshot.setContextTshs(contextTshs); - } - if (missingExistence.size !== 0) { - snapshot.setMissingExistence(missingExistence); - } - if (managedItemInfo.size !== 0) { - snapshot.setManagedItemInfo(managedItemInfo); - } - this._managedFilesOptimization.optimize(snapshot, managedFiles); - if (managedFiles.size !== 0) { - snapshot.setManagedFiles(managedFiles); - } - this._managedContextsOptimization.optimize(snapshot, managedContexts); - if (managedContexts.size !== 0) { - snapshot.setManagedContexts(managedContexts); - } - this._managedMissingOptimization.optimize(snapshot, managedMissing); - if (managedMissing.size !== 0) { - snapshot.setManagedMissing(managedMissing); - } - if (children.size !== 0) { - snapshot.setChildren(children); - } - this._snapshotCache.set(snapshot, true); - this._statCreatedSnapshots++; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - callback(null, snapshot); - } - }; - const jobError = () => { - if (jobs > 0) { - // large negative number instead of NaN or something else to keep jobs to stay a SMI (v8) - jobs = -100000000; - callback(null, null); - } - }; - const checkManaged = (path, managedSet) => { - for (const immutablePath of this.immutablePathsRegExps) { - if (immutablePath.test(path)) { - managedSet.add(path); - return true; - } - } - for (const immutablePath of this.immutablePathsWithSlash) { - if (path.startsWith(immutablePath)) { - managedSet.add(path); - return true; - } - } - for (const managedPath of this.managedPathsRegExps) { - const match = managedPath.exec(path); - if (match) { - const managedItem = getManagedItem(match[1], path); - if (managedItem) { - managedItems.add(managedItem); - managedSet.add(path); - return true; - } - } - } - for (const managedPath of this.managedPathsWithSlash) { - if (path.startsWith(managedPath)) { - const managedItem = getManagedItem(managedPath, path); - if (managedItem) { - managedItems.add(managedItem); - managedSet.add(path); - return true; - } - } - } - return false; - }; - const captureNonManaged = (items, managedSet) => { - const capturedItems = new Set(); - for (const path of items) { - if (!checkManaged(path, managedSet)) capturedItems.add(path); - } - return capturedItems; - }; - const processCapturedFiles = capturedFiles => { - switch (mode) { - case 3: - this._fileTshsOptimization.optimize(snapshot, capturedFiles); - for (const path of capturedFiles) { - const cache = this._fileTshs.get(path); - if (cache !== undefined) { - fileTshs.set(path, cache); - } else { - jobs++; - this._getFileTimestampAndHash(path, (err, entry) => { - if (err) { - if (this.logger) { - this.logger.debug( - `Error snapshotting file timestamp hash combination of ${path}: ${err.stack}` - ); - } - jobError(); - } else { - fileTshs.set(path, entry); - jobDone(); - } - }); - } - } - break; - case 2: - this._fileHashesOptimization.optimize(snapshot, capturedFiles); - for (const path of capturedFiles) { - const cache = this._fileHashes.get(path); - if (cache !== undefined) { - fileHashes.set(path, cache); - } else { - jobs++; - this.fileHashQueue.add(path, (err, entry) => { - if (err) { - if (this.logger) { - this.logger.debug( - `Error snapshotting file hash of ${path}: ${err.stack}` - ); - } - jobError(); - } else { - fileHashes.set(path, entry); - jobDone(); - } - }); - } - } - break; - case 1: - this._fileTimestampsOptimization.optimize(snapshot, capturedFiles); - for (const path of capturedFiles) { - const cache = this._fileTimestamps.get(path); - if (cache !== undefined) { - if (cache !== "ignore") { - fileTimestamps.set(path, cache); - } - } else { - jobs++; - this.fileTimestampQueue.add(path, (err, entry) => { - if (err) { - if (this.logger) { - this.logger.debug( - `Error snapshotting file timestamp of ${path}: ${err.stack}` - ); - } - jobError(); - } else { - fileTimestamps.set(path, entry); - jobDone(); - } - }); - } - } - break; - } - }; - if (files) { - processCapturedFiles(captureNonManaged(files, managedFiles)); - } - const processCapturedDirectories = capturedDirectories => { - switch (mode) { - case 3: - this._contextTshsOptimization.optimize(snapshot, capturedDirectories); - for (const path of capturedDirectories) { - const cache = this._contextTshs.get(path); - /** @type {ResolvedContextTimestampAndHash} */ - let resolved; - if ( - cache !== undefined && - (resolved = getResolvedTimestamp(cache)) !== undefined - ) { - contextTshs.set(path, resolved); - } else { - jobs++; - /** - * @param {Error=} err error - * @param {ResolvedContextTimestampAndHash=} entry entry - * @returns {void} - */ - const callback = (err, entry) => { - if (err) { - if (this.logger) { - this.logger.debug( - `Error snapshotting context timestamp hash combination of ${path}: ${err.stack}` - ); - } - jobError(); - } else { - contextTshs.set(path, entry); - jobDone(); - } - }; - if (cache !== undefined) { - this._resolveContextTsh(cache, callback); - } else { - this.getContextTsh(path, callback); - } - } - } - break; - case 2: - this._contextHashesOptimization.optimize( - snapshot, - capturedDirectories - ); - for (const path of capturedDirectories) { - const cache = this._contextHashes.get(path); - let resolved; - if ( - cache !== undefined && - (resolved = getResolvedHash(cache)) !== undefined - ) { - contextHashes.set(path, resolved); - } else { - jobs++; - const callback = (err, entry) => { - if (err) { - if (this.logger) { - this.logger.debug( - `Error snapshotting context hash of ${path}: ${err.stack}` - ); - } - jobError(); - } else { - contextHashes.set(path, entry); - jobDone(); - } - }; - if (cache !== undefined) { - this._resolveContextHash(cache, callback); - } else { - this.getContextHash(path, callback); - } - } - } - break; - case 1: - this._contextTimestampsOptimization.optimize( - snapshot, - capturedDirectories - ); - for (const path of capturedDirectories) { - const cache = this._contextTimestamps.get(path); - if (cache === "ignore") continue; - let resolved; - if ( - cache !== undefined && - (resolved = getResolvedTimestamp(cache)) !== undefined - ) { - contextTimestamps.set(path, resolved); - } else { - jobs++; - /** - * @param {Error=} err error - * @param {ResolvedContextFileSystemInfoEntry=} entry entry - * @returns {void} - */ - const callback = (err, entry) => { - if (err) { - if (this.logger) { - this.logger.debug( - `Error snapshotting context timestamp of ${path}: ${err.stack}` - ); - } - jobError(); - } else { - contextTimestamps.set(path, entry); - jobDone(); - } - }; - if (cache !== undefined) { - this._resolveContextTimestamp(cache, callback); - } else { - this.getContextTimestamp(path, callback); - } - } - } - break; - } - }; - if (directories) { - processCapturedDirectories( - captureNonManaged(directories, managedContexts) - ); - } - const processCapturedMissing = capturedMissing => { - this._missingExistenceOptimization.optimize(snapshot, capturedMissing); - for (const path of capturedMissing) { - const cache = this._fileTimestamps.get(path); - if (cache !== undefined) { - if (cache !== "ignore") { - missingExistence.set(path, Boolean(cache)); - } - } else { - jobs++; - this.fileTimestampQueue.add(path, (err, entry) => { - if (err) { - if (this.logger) { - this.logger.debug( - `Error snapshotting missing timestamp of ${path}: ${err.stack}` - ); - } - jobError(); - } else { - missingExistence.set(path, Boolean(entry)); - jobDone(); - } - }); - } - } - }; - if (missing) { - processCapturedMissing(captureNonManaged(missing, managedMissing)); - } - this._managedItemInfoOptimization.optimize(snapshot, managedItems); - for (const path of managedItems) { - const cache = this._managedItems.get(path); - if (cache !== undefined) { - if (!cache.startsWith("*")) { - managedFiles.add(join(this.fs, path, "package.json")); - } else if (cache === "*nested") { - managedMissing.add(join(this.fs, path, "package.json")); - } - managedItemInfo.set(path, cache); - } else { - jobs++; - this.managedItemQueue.add(path, (err, entry) => { - if (err) { - if (this.logger) { - this.logger.debug( - `Error snapshotting managed item ${path}: ${err.stack}` - ); - } - jobError(); - } else if (entry) { - if (!entry.startsWith("*")) { - managedFiles.add(join(this.fs, path, "package.json")); - } else if (cache === "*nested") { - managedMissing.add(join(this.fs, path, "package.json")); - } - managedItemInfo.set(path, entry); - jobDone(); - } else { - // Fallback to normal snapshotting - const process = (set, fn) => { - if (set.size === 0) return; - const captured = new Set(); - for (const file of set) { - if (file.startsWith(path)) captured.add(file); - } - if (captured.size > 0) fn(captured); - }; - process(managedFiles, processCapturedFiles); - process(managedContexts, processCapturedDirectories); - process(managedMissing, processCapturedMissing); - jobDone(); - } - }); - } + + +const { ConcatSource, RawSource, CachedSource } = __webpack_require__(51255); +const { UsageState } = __webpack_require__(63686); +const Template = __webpack_require__(1626); +const JavascriptModulesPlugin = __webpack_require__(89464); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./ExportsInfo")} ExportsInfo */ +/** @typedef {import("./ExportsInfo").ExportInfo} ExportInfo */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./ModuleTemplate")} ModuleTemplate */ +/** @typedef {import("./RequestShortener")} RequestShortener */ + +const joinIterableWithComma = iterable => { + // This is more performant than Array.from().join(", ") + // as it doesn't create an array + let str = ""; + let first = true; + for (const item of iterable) { + if (first) { + first = false; + } else { + str += ", "; } - jobDone(); + str += item; } + return str; +}; - /** - * @param {Snapshot} snapshot1 a snapshot - * @param {Snapshot} snapshot2 a snapshot - * @returns {Snapshot} merged snapshot - */ - mergeSnapshots(snapshot1, snapshot2) { - const snapshot = new Snapshot(); - if (snapshot1.hasStartTime() && snapshot2.hasStartTime()) - snapshot.setStartTime(Math.min(snapshot1.startTime, snapshot2.startTime)); - else if (snapshot2.hasStartTime()) snapshot.startTime = snapshot2.startTime; - else if (snapshot1.hasStartTime()) snapshot.startTime = snapshot1.startTime; - if (snapshot1.hasFileTimestamps() || snapshot2.hasFileTimestamps()) { - snapshot.setFileTimestamps( - mergeMaps(snapshot1.fileTimestamps, snapshot2.fileTimestamps) - ); - } - if (snapshot1.hasFileHashes() || snapshot2.hasFileHashes()) { - snapshot.setFileHashes( - mergeMaps(snapshot1.fileHashes, snapshot2.fileHashes) - ); - } - if (snapshot1.hasFileTshs() || snapshot2.hasFileTshs()) { - snapshot.setFileTshs(mergeMaps(snapshot1.fileTshs, snapshot2.fileTshs)); - } - if (snapshot1.hasContextTimestamps() || snapshot2.hasContextTimestamps()) { - snapshot.setContextTimestamps( - mergeMaps(snapshot1.contextTimestamps, snapshot2.contextTimestamps) - ); - } - if (snapshot1.hasContextHashes() || snapshot2.hasContextHashes()) { - snapshot.setContextHashes( - mergeMaps(snapshot1.contextHashes, snapshot2.contextHashes) - ); - } - if (snapshot1.hasContextTshs() || snapshot2.hasContextTshs()) { - snapshot.setContextTshs( - mergeMaps(snapshot1.contextTshs, snapshot2.contextTshs) - ); - } - if (snapshot1.hasMissingExistence() || snapshot2.hasMissingExistence()) { - snapshot.setMissingExistence( - mergeMaps(snapshot1.missingExistence, snapshot2.missingExistence) - ); - } - if (snapshot1.hasManagedItemInfo() || snapshot2.hasManagedItemInfo()) { - snapshot.setManagedItemInfo( - mergeMaps(snapshot1.managedItemInfo, snapshot2.managedItemInfo) - ); - } - if (snapshot1.hasManagedFiles() || snapshot2.hasManagedFiles()) { - snapshot.setManagedFiles( - mergeSets(snapshot1.managedFiles, snapshot2.managedFiles) - ); - } - if (snapshot1.hasManagedContexts() || snapshot2.hasManagedContexts()) { - snapshot.setManagedContexts( - mergeSets(snapshot1.managedContexts, snapshot2.managedContexts) - ); +/** + * @param {ConcatSource} source output + * @param {string} indent spacing + * @param {ExportsInfo} exportsInfo data + * @param {ModuleGraph} moduleGraph moduleGraph + * @param {RequestShortener} requestShortener requestShortener + * @param {Set} alreadyPrinted deduplication set + * @returns {void} + */ +const printExportsInfoToSource = ( + source, + indent, + exportsInfo, + moduleGraph, + requestShortener, + alreadyPrinted = new Set() +) => { + const otherExportsInfo = exportsInfo.otherExportsInfo; + + let alreadyPrintedExports = 0; + + // determine exports to print + const printedExports = []; + for (const exportInfo of exportsInfo.orderedExports) { + if (!alreadyPrinted.has(exportInfo)) { + alreadyPrinted.add(exportInfo); + printedExports.push(exportInfo); + } else { + alreadyPrintedExports++; } - if (snapshot1.hasManagedMissing() || snapshot2.hasManagedMissing()) { - snapshot.setManagedMissing( - mergeSets(snapshot1.managedMissing, snapshot2.managedMissing) + } + let showOtherExports = false; + if (!alreadyPrinted.has(otherExportsInfo)) { + alreadyPrinted.add(otherExportsInfo); + showOtherExports = true; + } else { + alreadyPrintedExports++; + } + + // print the exports + for (const exportInfo of printedExports) { + const target = exportInfo.getTarget(moduleGraph); + source.add( + Template.toComment( + `${indent}export ${JSON.stringify(exportInfo.name).slice( + 1, + -1 + )} [${exportInfo.getProvidedInfo()}] [${exportInfo.getUsedInfo()}] [${exportInfo.getRenameInfo()}]${ + target + ? ` -> ${target.module.readableIdentifier(requestShortener)}${ + target.export + ? ` .${target.export + .map(e => JSON.stringify(e).slice(1, -1)) + .join(".")}` + : "" + }` + : "" + }` + ) + "\n" + ); + if (exportInfo.exportsInfo) { + printExportsInfoToSource( + source, + indent + " ", + exportInfo.exportsInfo, + moduleGraph, + requestShortener, + alreadyPrinted ); } - if (snapshot1.hasChildren() || snapshot2.hasChildren()) { - snapshot.setChildren(mergeSets(snapshot1.children, snapshot2.children)); - } + } + + if (alreadyPrintedExports) { + source.add( + Template.toComment( + `${indent}... (${alreadyPrintedExports} already listed exports)` + ) + "\n" + ); + } + + if (showOtherExports) { + const target = otherExportsInfo.getTarget(moduleGraph); if ( - this._snapshotCache.get(snapshot1) === true && - this._snapshotCache.get(snapshot2) === true + target || + otherExportsInfo.provided !== false || + otherExportsInfo.getUsed(undefined) !== UsageState.Unused ) { - this._snapshotCache.set(snapshot, true); + const title = + printedExports.length > 0 || alreadyPrintedExports > 0 + ? "other exports" + : "exports"; + source.add( + Template.toComment( + `${indent}${title} [${otherExportsInfo.getProvidedInfo()}] [${otherExportsInfo.getUsedInfo()}]${ + target + ? ` -> ${target.module.readableIdentifier(requestShortener)}` + : "" + }` + ) + "\n" + ); } - return snapshot; } +}; + +/** @type {WeakMap }>>} */ +const caches = new WeakMap(); +class ModuleInfoHeaderPlugin { /** - * @param {Snapshot} snapshot the snapshot made - * @param {function((WebpackError | null)=, boolean=): void} callback callback function - * @returns {void} + * @param {boolean=} verbose add more information like exports, runtime requirements and bailouts */ - checkSnapshotValid(snapshot, callback) { - const cachedResult = this._snapshotCache.get(snapshot); - if (cachedResult !== undefined) { - this._statTestedSnapshotsCached++; - if (typeof cachedResult === "boolean") { - callback(null, cachedResult); - } else { - cachedResult.push(callback); - } - return; - } - this._statTestedSnapshotsNotCached++; - this._checkSnapshotValidNoCache(snapshot, callback); + constructor(verbose = true) { + this._verbose = verbose; } - /** - * @param {Snapshot} snapshot the snapshot made - * @param {function((WebpackError | null)=, boolean=): void} callback callback function + * @param {Compiler} compiler the compiler * @returns {void} */ - _checkSnapshotValidNoCache(snapshot, callback) { - /** @type {number | undefined} */ - let startTime = undefined; - if (snapshot.hasStartTime()) { - startTime = snapshot.startTime; - } - let jobs = 1; - const jobDone = () => { - if (--jobs === 0) { - this._snapshotCache.set(snapshot, true); - callback(null, true); - } - }; - const invalid = () => { - if (jobs > 0) { - // large negative number instead of NaN or something else to keep jobs to stay a SMI (v8) - jobs = -100000000; - this._snapshotCache.set(snapshot, false); - callback(null, false); - } - }; - const invalidWithError = (path, err) => { - if (this._remainingLogs > 0) { - this._log(path, `error occurred: %s`, err); - } - invalid(); - }; - /** - * @param {string} path file path - * @param {string} current current hash - * @param {string} snap snapshot hash - * @returns {boolean} true, if ok - */ - const checkHash = (path, current, snap) => { - if (current !== snap) { - // If hash differ it's invalid - if (this._remainingLogs > 0) { - this._log(path, `hashes differ (%s != %s)`, current, snap); - } - return false; - } - return true; - }; - /** - * @param {string} path file path - * @param {boolean} current current entry - * @param {boolean} snap entry from snapshot - * @returns {boolean} true, if ok - */ - const checkExistence = (path, current, snap) => { - if (!current !== !snap) { - // If existence of item differs - // it's invalid - if (this._remainingLogs > 0) { - this._log( - path, - current ? "it didn't exist before" : "it does no longer exist" - ); - } - return false; - } - return true; - }; - /** - * @param {string} path file path - * @param {FileSystemInfoEntry} current current entry - * @param {FileSystemInfoEntry} snap entry from snapshot - * @param {boolean} log log reason - * @returns {boolean} true, if ok - */ - const checkFile = (path, current, snap, log = true) => { - if (current === snap) return true; - if (!checkExistence(path, Boolean(current), Boolean(snap))) return false; - if (current) { - // For existing items only - if (typeof startTime === "number" && current.safeTime > startTime) { - // If a change happened after starting reading the item - // this may no longer be valid - if (log && this._remainingLogs > 0) { - this._log( - path, - `it may have changed (%d) after the start time of the snapshot (%d)`, - current.safeTime, - startTime + apply(compiler) { + const { _verbose: verbose } = this; + compiler.hooks.compilation.tap("ModuleInfoHeaderPlugin", compilation => { + const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); + hooks.renderModulePackage.tap( + "ModuleInfoHeaderPlugin", + ( + moduleSource, + module, + { chunk, chunkGraph, moduleGraph, runtimeTemplate } + ) => { + const { requestShortener } = runtimeTemplate; + let cacheEntry; + let cache = caches.get(requestShortener); + if (cache === undefined) { + caches.set(requestShortener, (cache = new WeakMap())); + cache.set( + module, + (cacheEntry = { header: undefined, full: new WeakMap() }) ); + } else { + cacheEntry = cache.get(module); + if (cacheEntry === undefined) { + cache.set( + module, + (cacheEntry = { header: undefined, full: new WeakMap() }) + ); + } else if (!verbose) { + const cachedSource = cacheEntry.full.get(moduleSource); + if (cachedSource !== undefined) return cachedSource; + } } - return false; - } - if ( - snap.timestamp !== undefined && - current.timestamp !== snap.timestamp - ) { - // If we have a timestamp (it was a file or symlink) and it differs from current timestamp - // it's invalid - if (log && this._remainingLogs > 0) { - this._log( - path, - `timestamps differ (%d != %d)`, - current.timestamp, - snap.timestamp - ); + const source = new ConcatSource(); + let header = cacheEntry.header; + if (header === undefined) { + const req = module.readableIdentifier(requestShortener); + const reqStr = req.replace(/\*\//g, "*_/"); + const reqStrStar = "*".repeat(reqStr.length); + const headerStr = `/*!****${reqStrStar}****!*\\\n !*** ${reqStr} ***!\n \\****${reqStrStar}****/\n`; + header = new RawSource(headerStr); + cacheEntry.header = header; } - return false; - } - } - return true; - }; - /** - * @param {string} path file path - * @param {ResolvedContextFileSystemInfoEntry} current current entry - * @param {ResolvedContextFileSystemInfoEntry} snap entry from snapshot - * @param {boolean} log log reason - * @returns {boolean} true, if ok - */ - const checkContext = (path, current, snap, log = true) => { - if (current === snap) return true; - if (!checkExistence(path, Boolean(current), Boolean(snap))) return false; - if (current) { - // For existing items only - if (typeof startTime === "number" && current.safeTime > startTime) { - // If a change happened after starting reading the item - // this may no longer be valid - if (log && this._remainingLogs > 0) { - this._log( - path, - `it may have changed (%d) after the start time of the snapshot (%d)`, - current.safeTime, - startTime + source.add(header); + if (verbose) { + const exportsType = module.buildMeta.exportsType; + source.add( + Template.toComment( + exportsType + ? `${exportsType} exports` + : "unknown exports (runtime-defined)" + ) + "\n" ); - } - return false; - } - if ( - snap.timestampHash !== undefined && - current.timestampHash !== snap.timestampHash - ) { - // If we have a timestampHash (it was a directory) and it differs from current timestampHash - // it's invalid - if (log && this._remainingLogs > 0) { - this._log( - path, - `timestamps hashes differ (%s != %s)`, - current.timestampHash, - snap.timestampHash + if (exportsType) { + const exportsInfo = moduleGraph.getExportsInfo(module); + printExportsInfoToSource( + source, + "", + exportsInfo, + moduleGraph, + requestShortener + ); + } + source.add( + Template.toComment( + `runtime requirements: ${joinIterableWithComma( + chunkGraph.getModuleRuntimeRequirements(module, chunk.runtime) + )}` + ) + "\n" ); - } - return false; - } - } - return true; - }; - if (snapshot.hasChildren()) { - const childCallback = (err, result) => { - if (err || !result) return invalid(); - else jobDone(); - }; - for (const child of snapshot.children) { - const cache = this._snapshotCache.get(child); - if (cache !== undefined) { - this._statTestedChildrenCached++; - /* istanbul ignore else */ - if (typeof cache === "boolean") { - if (cache === false) { - invalid(); - return; + const optimizationBailout = + moduleGraph.getOptimizationBailout(module); + if (optimizationBailout) { + for (const text of optimizationBailout) { + let code; + if (typeof text === "function") { + code = text(requestShortener); + } else { + code = text; + } + source.add(Template.toComment(`${code}`) + "\n"); + } } + source.add(moduleSource); + return source; } else { - jobs++; - cache.push(childCallback); + source.add(moduleSource); + const cachedSource = new CachedSource(source); + cacheEntry.full.set(moduleSource, cachedSource); + return cachedSource; } - } else { - this._statTestedChildrenNotCached++; - jobs++; - this._checkSnapshotValidNoCache(child, childCallback); } + ); + hooks.chunkHash.tap("ModuleInfoHeaderPlugin", (chunk, hash) => { + hash.update("ModuleInfoHeaderPlugin"); + hash.update("1"); + }); + }); + } +} +module.exports = ModuleInfoHeaderPlugin; + + +/***/ }), + +/***/ 32882: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const WebpackError = __webpack_require__(53799); + +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Module")} Module */ + +const previouslyPolyfilledBuiltinModules = { + assert: "assert/", + buffer: "buffer/", + console: "console-browserify", + constants: "constants-browserify", + crypto: "crypto-browserify", + domain: "domain-browser", + events: "events/", + http: "stream-http", + https: "https-browserify", + os: "os-browserify/browser", + path: "path-browserify", + punycode: "punycode/", + process: "process/browser", + querystring: "querystring-es3", + stream: "stream-browserify", + _stream_duplex: "readable-stream/duplex", + _stream_passthrough: "readable-stream/passthrough", + _stream_readable: "readable-stream/readable", + _stream_transform: "readable-stream/transform", + _stream_writable: "readable-stream/writable", + string_decoder: "string_decoder/", + sys: "util/", + timers: "timers-browserify", + tty: "tty-browserify", + url: "url/", + util: "util/", + vm: "vm-browserify", + zlib: "browserify-zlib" +}; + +class ModuleNotFoundError extends WebpackError { + /** + * @param {Module} module module tied to dependency + * @param {Error&any} err error thrown + * @param {DependencyLocation} loc location of dependency + */ + constructor(module, err, loc) { + let message = `Module not found: ${err.toString()}`; + + // TODO remove in webpack 6 + const match = err.message.match(/Can't resolve '([^']+)'/); + if (match) { + const request = match[1]; + const alias = previouslyPolyfilledBuiltinModules[request]; + if (alias) { + const pathIndex = alias.indexOf("/"); + const dependency = pathIndex > 0 ? alias.slice(0, pathIndex) : alias; + message += + "\n\n" + + "BREAKING CHANGE: " + + "webpack < 5 used to include polyfills for node.js core modules by default.\n" + + "This is no longer the case. Verify if you need this module and configure a polyfill for it.\n\n"; + message += + "If you want to include a polyfill, you need to:\n" + + `\t- add a fallback 'resolve.fallback: { "${request}": require.resolve("${alias}") }'\n` + + `\t- install '${dependency}'\n`; + message += + "If you don't want to include a polyfill, you can use an empty module like this:\n" + + `\tresolve.fallback: { "${request}": false }`; } } - if (snapshot.hasFileTimestamps()) { - const { fileTimestamps } = snapshot; - this._statTestedEntries += fileTimestamps.size; - for (const [path, ts] of fileTimestamps) { - const cache = this._fileTimestamps.get(path); - if (cache !== undefined) { - if (cache !== "ignore" && !checkFile(path, cache, ts)) { - invalid(); - return; - } - } else { - jobs++; - this.fileTimestampQueue.add(path, (err, entry) => { - if (err) return invalidWithError(path, err); - if (!checkFile(path, entry, ts)) { - invalid(); - } else { - jobDone(); - } - }); - } - } + + super(message); + + this.name = "ModuleNotFoundError"; + this.details = err.details; + this.module = module; + this.error = err; + this.loc = loc; + } +} + +module.exports = ModuleNotFoundError; + + +/***/ }), + +/***/ 58443: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); + +const WASM_HEADER = Buffer.from([0x00, 0x61, 0x73, 0x6d]); + +class ModuleParseError extends WebpackError { + /** + * @param {string | Buffer} source source code + * @param {Error&any} err the parse error + * @param {string[]} loaders the loaders used + * @param {string} type module type + */ + constructor(source, err, loaders, type) { + let message = "Module parse failed: " + (err && err.message); + let loc = undefined; + + if ( + ((Buffer.isBuffer(source) && source.slice(0, 4).equals(WASM_HEADER)) || + (typeof source === "string" && /^\0asm/.test(source))) && + !type.startsWith("webassembly") + ) { + message += + "\nThe module seem to be a WebAssembly module, but module is not flagged as WebAssembly module for webpack."; + message += + "\nBREAKING CHANGE: Since webpack 5 WebAssembly is not enabled by default and flagged as experimental feature."; + message += + "\nYou need to enable one of the WebAssembly experiments via 'experiments.asyncWebAssembly: true' (based on async modules) or 'experiments.syncWebAssembly: true' (like webpack 4, deprecated)."; + message += + "\nFor files that transpile to WebAssembly, make sure to set the module type in the 'module.rules' section of the config (e. g. 'type: \"webassembly/async\"')."; + } else if (!loaders) { + message += + "\nYou may need an appropriate loader to handle this file type."; + } else if (loaders.length >= 1) { + message += `\nFile was processed with these loaders:${loaders + .map(loader => `\n * ${loader}`) + .join("")}`; + message += + "\nYou may need an additional loader to handle the result of these loaders."; + } else { + message += + "\nYou may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders"; } - const processFileHashSnapshot = (path, hash) => { - const cache = this._fileHashes.get(path); - if (cache !== undefined) { - if (cache !== "ignore" && !checkHash(path, cache, hash)) { - invalid(); - return; - } + + if ( + err && + err.loc && + typeof err.loc === "object" && + typeof err.loc.line === "number" + ) { + var lineNumber = err.loc.line; + + if ( + Buffer.isBuffer(source) || + /[\0\u0001\u0002\u0003\u0004\u0005\u0006\u0007]/.test(source) + ) { + // binary file + message += "\n(Source code omitted for this binary file)"; } else { - jobs++; - this.fileHashQueue.add(path, (err, entry) => { - if (err) return invalidWithError(path, err); - if (!checkHash(path, entry, hash)) { - invalid(); - } else { - jobDone(); - } - }); - } - }; - if (snapshot.hasFileHashes()) { - const { fileHashes } = snapshot; - this._statTestedEntries += fileHashes.size; - for (const [path, hash] of fileHashes) { - processFileHashSnapshot(path, hash); - } - } - if (snapshot.hasFileTshs()) { - const { fileTshs } = snapshot; - this._statTestedEntries += fileTshs.size; - for (const [path, tsh] of fileTshs) { - if (typeof tsh === "string") { - processFileHashSnapshot(path, tsh); - } else { - const cache = this._fileTimestamps.get(path); - if (cache !== undefined) { - if (cache === "ignore" || !checkFile(path, cache, tsh, false)) { - processFileHashSnapshot(path, tsh && tsh.hash); - } - } else { - jobs++; - this.fileTimestampQueue.add(path, (err, entry) => { - if (err) return invalidWithError(path, err); - if (!checkFile(path, entry, tsh, false)) { - processFileHashSnapshot(path, tsh && tsh.hash); - } - jobDone(); - }); - } - } + const sourceLines = source.split(/\r?\n/); + const start = Math.max(0, lineNumber - 3); + const linesBefore = sourceLines.slice(start, lineNumber - 1); + const theLine = sourceLines[lineNumber - 1]; + const linesAfter = sourceLines.slice(lineNumber, lineNumber + 2); + + message += + linesBefore.map(l => `\n| ${l}`).join("") + + `\n> ${theLine}` + + linesAfter.map(l => `\n| ${l}`).join(""); } + + loc = { start: err.loc }; + } else if (err && err.stack) { + message += "\n" + err.stack; } - if (snapshot.hasContextTimestamps()) { - const { contextTimestamps } = snapshot; - this._statTestedEntries += contextTimestamps.size; - for (const [path, ts] of contextTimestamps) { - const cache = this._contextTimestamps.get(path); - if (cache === "ignore") continue; - let resolved; - if ( - cache !== undefined && - (resolved = getResolvedTimestamp(cache)) !== undefined - ) { - if (!checkContext(path, resolved, ts)) { - invalid(); - return; - } - } else { - jobs++; - /** - * @param {Error=} err error - * @param {ResolvedContextFileSystemInfoEntry=} entry entry - * @returns {void} - */ - const callback = (err, entry) => { - if (err) return invalidWithError(path, err); - if (!checkContext(path, entry, ts)) { - invalid(); - } else { - jobDone(); - } - }; - if (cache !== undefined) { - this._resolveContextTimestamp(cache, callback); - } else { - this.getContextTimestamp(path, callback); - } - } - } - } - const processContextHashSnapshot = (path, hash) => { - const cache = this._contextHashes.get(path); - let resolved; - if ( - cache !== undefined && - (resolved = getResolvedHash(cache)) !== undefined - ) { - if (!checkHash(path, resolved, hash)) { - invalid(); - return; - } - } else { - jobs++; - const callback = (err, entry) => { - if (err) return invalidWithError(path, err); - if (!checkHash(path, entry, hash)) { - invalid(); - } else { - jobDone(); - } - }; - if (cache !== undefined) { - this._resolveContextHash(cache, callback); - } else { - this.getContextHash(path, callback); - } - } - }; - if (snapshot.hasContextHashes()) { - const { contextHashes } = snapshot; - this._statTestedEntries += contextHashes.size; - for (const [path, hash] of contextHashes) { - processContextHashSnapshot(path, hash); - } - } - if (snapshot.hasContextTshs()) { - const { contextTshs } = snapshot; - this._statTestedEntries += contextTshs.size; - for (const [path, tsh] of contextTshs) { - if (typeof tsh === "string") { - processContextHashSnapshot(path, tsh); - } else { - const cache = this._contextTimestamps.get(path); - if (cache === "ignore") continue; - let resolved; - if ( - cache !== undefined && - (resolved = getResolvedTimestamp(cache)) !== undefined - ) { - if (!checkContext(path, resolved, tsh, false)) { - processContextHashSnapshot(path, tsh && tsh.hash); - } - } else { - jobs++; - /** - * @param {Error=} err error - * @param {ResolvedContextFileSystemInfoEntry=} entry entry - * @returns {void} - */ - const callback = (err, entry) => { - if (err) return invalidWithError(path, err); - if (!checkContext(path, entry, tsh, false)) { - processContextHashSnapshot(path, tsh && tsh.hash); - } - jobDone(); - }; - if (cache !== undefined) { - this._resolveContextTimestamp(cache, callback); - } else { - this.getContextTimestamp(path, callback); - } - } - } - } - } - if (snapshot.hasMissingExistence()) { - const { missingExistence } = snapshot; - this._statTestedEntries += missingExistence.size; - for (const [path, existence] of missingExistence) { - const cache = this._fileTimestamps.get(path); - if (cache !== undefined) { - if ( - cache !== "ignore" && - !checkExistence(path, Boolean(cache), Boolean(existence)) - ) { - invalid(); - return; - } - } else { - jobs++; - this.fileTimestampQueue.add(path, (err, entry) => { - if (err) return invalidWithError(path, err); - if (!checkExistence(path, Boolean(entry), Boolean(existence))) { - invalid(); - } else { - jobDone(); - } - }); - } - } - } - if (snapshot.hasManagedItemInfo()) { - const { managedItemInfo } = snapshot; - this._statTestedEntries += managedItemInfo.size; - for (const [path, info] of managedItemInfo) { - const cache = this._managedItems.get(path); - if (cache !== undefined) { - if (!checkHash(path, cache, info)) { - invalid(); - return; - } - } else { - jobs++; - this.managedItemQueue.add(path, (err, entry) => { - if (err) return invalidWithError(path, err); - if (!checkHash(path, entry, info)) { - invalid(); - } else { - jobDone(); - } - }); - } - } - } - jobDone(); - // if there was an async action - // try to join multiple concurrent request for this snapshot - if (jobs > 0) { - const callbacks = [callback]; - callback = (err, result) => { - for (const callback of callbacks) callback(err, result); - }; - this._snapshotCache.set(snapshot, callbacks); - } + super(message); + + this.name = "ModuleParseError"; + this.loc = loc; + this.error = err; } - _readFileTimestamp(path, callback) { - this.fs.stat(path, (err, stat) => { - if (err) { - if (err.code === "ENOENT") { - this._fileTimestamps.set(path, null); - this._cachedDeprecatedFileTimestamps = undefined; - return callback(null, null); - } - return callback(err); - } + serialize(context) { + const { write } = context; - let ts; - if (stat.isDirectory()) { - ts = { - safeTime: 0, - timestamp: undefined - }; - } else { - const mtime = +stat.mtime; + write(this.error); - if (mtime) applyMtime(mtime); + super.serialize(context); + } - ts = { - safeTime: mtime ? mtime + FS_ACCURACY : Infinity, - timestamp: mtime - }; - } + deserialize(context) { + const { read } = context; - this._fileTimestamps.set(path, ts); - this._cachedDeprecatedFileTimestamps = undefined; + this.error = read(); - callback(null, ts); - }); + super.deserialize(context); } +} - _readFileHash(path, callback) { - this.fs.readFile(path, (err, content) => { - if (err) { - if (err.code === "EISDIR") { - this._fileHashes.set(path, "directory"); - return callback(null, "directory"); - } - if (err.code === "ENOENT") { - this._fileHashes.set(path, null); - return callback(null, null); - } - if (err.code === "ERR_FS_FILE_TOO_LARGE") { - this.logger.warn(`Ignoring ${path} for hashing as it's very large`); - this._fileHashes.set(path, "too large"); - return callback(null, "too large"); - } - return callback(err); - } +makeSerializable(ModuleParseError, "webpack/lib/ModuleParseError"); - const hash = createHash(this._hashFunction); +module.exports = ModuleParseError; - hash.update(content); - const digest = /** @type {string} */ (hash.digest("hex")); +/***/ }), - this._fileHashes.set(path, digest); +/***/ 36418: +/***/ (function(module) { - callback(null, digest); - }); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - _getFileTimestampAndHash(path, callback) { - const continueWithHash = hash => { - const cache = this._fileTimestamps.get(path); - if (cache !== undefined) { - if (cache !== "ignore") { - const result = { - ...cache, - hash - }; - this._fileTshs.set(path, result); - return callback(null, result); - } else { - this._fileTshs.set(path, hash); - return callback(null, hash); - } - } else { - this.fileTimestampQueue.add(path, (err, entry) => { - if (err) { - return callback(err); - } - const result = { - ...entry, - hash - }; - this._fileTshs.set(path, result); - return callback(null, result); - }); - } - }; - const cache = this._fileHashes.get(path); - if (cache !== undefined) { - continueWithHash(cache); - } else { - this.fileHashQueue.add(path, (err, entry) => { - if (err) { - return callback(err); - } - continueWithHash(entry); - }); - } - } - /** - * @template T - * @template ItemType - * @param {Object} options options - * @param {string} options.path path - * @param {function(string): ItemType} options.fromImmutablePath called when context item is an immutable path - * @param {function(string): ItemType} options.fromManagedItem called when context item is a managed path - * @param {function(string, string, function(Error=, ItemType=): void): void} options.fromSymlink called when context item is a symlink - * @param {function(string, IStats, function(Error=, ItemType=): void): void} options.fromFile called when context item is a file - * @param {function(string, IStats, function(Error=, ItemType=): void): void} options.fromDirectory called when context item is a directory - * @param {function(string[], ItemType[]): T} options.reduce called from all context items - * @param {function((Error | null)=, (T)=): void} callback callback - */ - _readContext( - { - path, - fromImmutablePath, - fromManagedItem, - fromSymlink, - fromFile, - fromDirectory, - reduce - }, - callback - ) { - this.fs.readdir(path, (err, _files) => { - if (err) { - if (err.code === "ENOENT") { - return callback(null, null); - } - return callback(err); - } - const files = /** @type {string[]} */ (_files) - .map(file => file.normalize("NFC")) - .filter(file => !/^\./.test(file)) - .sort(); - asyncLib.map( - files, - (file, callback) => { - const child = join(this.fs, path, file); - for (const immutablePath of this.immutablePathsRegExps) { - if (immutablePath.test(path)) { - // ignore any immutable path for timestamping - return callback(null, fromImmutablePath(path)); - } - } - for (const immutablePath of this.immutablePathsWithSlash) { - if (path.startsWith(immutablePath)) { - // ignore any immutable path for timestamping - return callback(null, fromImmutablePath(path)); - } - } - for (const managedPath of this.managedPathsRegExps) { - const match = managedPath.exec(path); - if (match) { - const managedItem = getManagedItem(match[1], path); - if (managedItem) { - // construct timestampHash from managed info - return this.managedItemQueue.add(managedItem, (err, info) => { - if (err) return callback(err); - return callback(null, fromManagedItem(info)); - }); - } - } - } - for (const managedPath of this.managedPathsWithSlash) { - if (path.startsWith(managedPath)) { - const managedItem = getManagedItem(managedPath, child); - if (managedItem) { - // construct timestampHash from managed info - return this.managedItemQueue.add(managedItem, (err, info) => { - if (err) return callback(err); - return callback(null, fromManagedItem(info)); - }); - } - } - } +class ModuleProfile { + constructor() { + this.startTime = Date.now(); - lstatReadlinkAbsolute(this.fs, child, (err, stat) => { - if (err) return callback(err); + this.factoryStartTime = 0; + this.factoryEndTime = 0; + this.factory = 0; + this.factoryParallelismFactor = 0; - if (typeof stat === "string") { - return fromSymlink(child, stat, callback); - } + this.restoringStartTime = 0; + this.restoringEndTime = 0; + this.restoring = 0; + this.restoringParallelismFactor = 0; - if (stat.isFile()) { - return fromFile(child, stat, callback); - } - if (stat.isDirectory()) { - return fromDirectory(child, stat, callback); - } - callback(null, null); - }); - }, - (err, results) => { - if (err) return callback(err); - const result = reduce(files, results); - callback(null, result); - } - ); - }); - } + this.integrationStartTime = 0; + this.integrationEndTime = 0; + this.integration = 0; + this.integrationParallelismFactor = 0; - _readContextTimestamp(path, callback) { - this._readContext( - { - path, - fromImmutablePath: () => null, - fromManagedItem: info => ({ - safeTime: 0, - timestampHash: info - }), - fromSymlink: (file, target, callback) => { - callback(null, { - timestampHash: target, - symlinks: new Set([target]) - }); - }, - fromFile: (file, stat, callback) => { - // Prefer the cached value over our new stat to report consistent results - const cache = this._fileTimestamps.get(file); - if (cache !== undefined) - return callback(null, cache === "ignore" ? null : cache); + this.buildingStartTime = 0; + this.buildingEndTime = 0; + this.building = 0; + this.buildingParallelismFactor = 0; - const mtime = +stat.mtime; + this.storingStartTime = 0; + this.storingEndTime = 0; + this.storing = 0; + this.storingParallelismFactor = 0; - if (mtime) applyMtime(mtime); + this.additionalFactoryTimes = undefined; + this.additionalFactories = 0; + this.additionalFactoriesParallelismFactor = 0; - const ts = { - safeTime: mtime ? mtime + FS_ACCURACY : Infinity, - timestamp: mtime - }; + /** @deprecated */ + this.additionalIntegration = 0; + } - this._fileTimestamps.set(file, ts); - this._cachedDeprecatedFileTimestamps = undefined; - callback(null, ts); - }, - fromDirectory: (directory, stat, callback) => { - this.contextTimestampQueue.increaseParallelism(); - this._getUnresolvedContextTimestamp(directory, (err, tsEntry) => { - this.contextTimestampQueue.decreaseParallelism(); - callback(err, tsEntry); - }); - }, - reduce: (files, tsEntries) => { - let symlinks = undefined; + markFactoryStart() { + this.factoryStartTime = Date.now(); + } - const hash = createHash(this._hashFunction); + markFactoryEnd() { + this.factoryEndTime = Date.now(); + this.factory = this.factoryEndTime - this.factoryStartTime; + } - for (const file of files) hash.update(file); - let safeTime = 0; - for (const entry of tsEntries) { - if (!entry) { - hash.update("n"); - continue; - } - if (entry.timestamp) { - hash.update("f"); - hash.update(`${entry.timestamp}`); - } else if (entry.timestampHash) { - hash.update("d"); - hash.update(`${entry.timestampHash}`); - } - if (entry.symlinks !== undefined) { - if (symlinks === undefined) symlinks = new Set(); - addAll(entry.symlinks, symlinks); - } - if (entry.safeTime) { - safeTime = Math.max(safeTime, entry.safeTime); - } - } + markRestoringStart() { + this.restoringStartTime = Date.now(); + } - const digest = /** @type {string} */ (hash.digest("hex")); + markRestoringEnd() { + this.restoringEndTime = Date.now(); + this.restoring = this.restoringEndTime - this.restoringStartTime; + } - const result = { - safeTime, - timestampHash: digest - }; - if (symlinks) result.symlinks = symlinks; - return result; - } - }, - (err, result) => { - if (err) return callback(err); - this._contextTimestamps.set(path, result); - this._cachedDeprecatedContextTimestamps = undefined; + markIntegrationStart() { + this.integrationStartTime = Date.now(); + } - callback(null, result); - } - ); + markIntegrationEnd() { + this.integrationEndTime = Date.now(); + this.integration = this.integrationEndTime - this.integrationStartTime; } - /** - * @param {ContextFileSystemInfoEntry} entry entry - * @param {function((Error | null)=, ResolvedContextFileSystemInfoEntry=): void} callback callback - * @returns {void} - */ - _resolveContextTimestamp(entry, callback) { - const hashes = []; - let safeTime = 0; - processAsyncTree( - entry.symlinks, - 10, - (target, push, callback) => { - this._getUnresolvedContextTimestamp(target, (err, entry) => { - if (err) return callback(err); - if (entry && entry !== "ignore") { - hashes.push(entry.timestampHash); - if (entry.safeTime) { - safeTime = Math.max(safeTime, entry.safeTime); - } - if (entry.symlinks !== undefined) { - for (const target of entry.symlinks) push(target); - } - } - callback(); - }); - }, - err => { - if (err) return callback(err); - const hash = createHash(this._hashFunction); - hash.update(entry.timestampHash); - if (entry.safeTime) { - safeTime = Math.max(safeTime, entry.safeTime); - } - hashes.sort(); - for (const h of hashes) { - hash.update(h); - } - callback( - null, - (entry.resolved = { - safeTime, - timestampHash: /** @type {string} */ (hash.digest("hex")) - }) - ); - } - ); + markBuildingStart() { + this.buildingStartTime = Date.now(); } - _readContextHash(path, callback) { - this._readContext( - { - path, - fromImmutablePath: () => "", - fromManagedItem: info => info || "", - fromSymlink: (file, target, callback) => { - callback(null, { - hash: target, - symlinks: new Set([target]) - }); - }, - fromFile: (file, stat, callback) => - this.getFileHash(file, (err, hash) => { - callback(err, hash || ""); - }), - fromDirectory: (directory, stat, callback) => { - this.contextHashQueue.increaseParallelism(); - this._getUnresolvedContextHash(directory, (err, hash) => { - this.contextHashQueue.decreaseParallelism(); - callback(err, hash || ""); - }); - }, - /** - * @param {string[]} files files - * @param {(string | ContextHash)[]} fileHashes hashes - * @returns {ContextHash} reduced hash - */ - reduce: (files, fileHashes) => { - let symlinks = undefined; - const hash = createHash(this._hashFunction); - - for (const file of files) hash.update(file); - for (const entry of fileHashes) { - if (typeof entry === "string") { - hash.update(entry); - } else { - hash.update(entry.hash); - if (entry.symlinks) { - if (symlinks === undefined) symlinks = new Set(); - addAll(entry.symlinks, symlinks); - } - } - } - - const result = { - hash: /** @type {string} */ (hash.digest("hex")) - }; - if (symlinks) result.symlinks = symlinks; - return result; - } - }, - (err, result) => { - if (err) return callback(err); - this._contextHashes.set(path, result); - return callback(null, result); - } - ); + markBuildingEnd() { + this.buildingEndTime = Date.now(); + this.building = this.buildingEndTime - this.buildingStartTime; } - /** - * @param {ContextHash} entry context hash - * @param {function((Error | null)=, string=): void} callback callback - * @returns {void} - */ - _resolveContextHash(entry, callback) { - const hashes = []; - processAsyncTree( - entry.symlinks, - 10, - (target, push, callback) => { - this._getUnresolvedContextHash(target, (err, hash) => { - if (err) return callback(err); - if (hash) { - hashes.push(hash.hash); - if (hash.symlinks !== undefined) { - for (const target of hash.symlinks) push(target); - } - } - callback(); - }); - }, - err => { - if (err) return callback(err); - const hash = createHash(this._hashFunction); - hash.update(entry.hash); - hashes.sort(); - for (const h of hashes) { - hash.update(h); - } - callback( - null, - (entry.resolved = /** @type {string} */ (hash.digest("hex"))) - ); - } - ); + markStoringStart() { + this.storingStartTime = Date.now(); } - _readContextTimestampAndHash(path, callback) { - const finalize = (timestamp, hash) => { - const result = - timestamp === "ignore" - ? hash - : { - ...timestamp, - ...hash - }; - this._contextTshs.set(path, result); - callback(null, result); - }; - const cachedHash = this._contextHashes.get(path); - const cachedTimestamp = this._contextTimestamps.get(path); - if (cachedHash !== undefined) { - if (cachedTimestamp !== undefined) { - finalize(cachedTimestamp, cachedHash); - } else { - this.contextTimestampQueue.add(path, (err, entry) => { - if (err) return callback(err); - finalize(entry, cachedHash); - }); - } - } else { - if (cachedTimestamp !== undefined) { - this.contextHashQueue.add(path, (err, entry) => { - if (err) return callback(err); - finalize(cachedTimestamp, entry); - }); - } else { - this._readContext( - { - path, - fromImmutablePath: () => null, - fromManagedItem: info => ({ - safeTime: 0, - timestampHash: info, - hash: info || "" - }), - fromSymlink: (fle, target, callback) => { - callback(null, { - timestampHash: target, - hash: target, - symlinks: new Set([target]) - }); - }, - fromFile: (file, stat, callback) => { - this._getFileTimestampAndHash(file, callback); - }, - fromDirectory: (directory, stat, callback) => { - this.contextTshQueue.increaseParallelism(); - this.contextTshQueue.add(directory, (err, result) => { - this.contextTshQueue.decreaseParallelism(); - callback(err, result); - }); - }, - /** - * @param {string[]} files files - * @param {(Partial & Partial | string | null)[]} results results - * @returns {ContextTimestampAndHash} tsh - */ - reduce: (files, results) => { - let symlinks = undefined; - - const tsHash = createHash(this._hashFunction); - const hash = createHash(this._hashFunction); - - for (const file of files) { - tsHash.update(file); - hash.update(file); - } - let safeTime = 0; - for (const entry of results) { - if (!entry) { - tsHash.update("n"); - continue; - } - if (typeof entry === "string") { - tsHash.update("n"); - hash.update(entry); - continue; - } - if (entry.timestamp) { - tsHash.update("f"); - tsHash.update(`${entry.timestamp}`); - } else if (entry.timestampHash) { - tsHash.update("d"); - tsHash.update(`${entry.timestampHash}`); - } - if (entry.symlinks !== undefined) { - if (symlinks === undefined) symlinks = new Set(); - addAll(entry.symlinks, symlinks); - } - if (entry.safeTime) { - safeTime = Math.max(safeTime, entry.safeTime); - } - hash.update(entry.hash); - } - - const result = { - safeTime, - timestampHash: /** @type {string} */ (tsHash.digest("hex")), - hash: /** @type {string} */ (hash.digest("hex")) - }; - if (symlinks) result.symlinks = symlinks; - return result; - } - }, - (err, result) => { - if (err) return callback(err); - this._contextTshs.set(path, result); - return callback(null, result); - } - ); - } - } + markStoringEnd() { + this.storingEndTime = Date.now(); + this.storing = this.storingEndTime - this.storingStartTime; } + // This depends on timing so we ignore it for coverage + /* istanbul ignore next */ /** - * @param {ContextTimestampAndHash} entry entry - * @param {function((Error | null)=, ResolvedContextTimestampAndHash=): void} callback callback + * Merge this profile into another one + * @param {ModuleProfile} realProfile the profile to merge into * @returns {void} */ - _resolveContextTsh(entry, callback) { - const hashes = []; - const tsHashes = []; - let safeTime = 0; - processAsyncTree( - entry.symlinks, - 10, - (target, push, callback) => { - this._getUnresolvedContextTsh(target, (err, entry) => { - if (err) return callback(err); - if (entry) { - hashes.push(entry.hash); - if (entry.timestampHash) tsHashes.push(entry.timestampHash); - if (entry.safeTime) { - safeTime = Math.max(safeTime, entry.safeTime); - } - if (entry.symlinks !== undefined) { - for (const target of entry.symlinks) push(target); - } - } - callback(); - }); - }, - err => { - if (err) return callback(err); - const hash = createHash(this._hashFunction); - const tsHash = createHash(this._hashFunction); - hash.update(entry.hash); - if (entry.timestampHash) tsHash.update(entry.timestampHash); - if (entry.safeTime) { - safeTime = Math.max(safeTime, entry.safeTime); - } - hashes.sort(); - for (const h of hashes) { - hash.update(h); - } - tsHashes.sort(); - for (const h of tsHashes) { - tsHash.update(h); - } - callback( - null, - (entry.resolved = { - safeTime, - timestampHash: /** @type {string} */ (tsHash.digest("hex")), - hash: /** @type {string} */ (hash.digest("hex")) - }) - ); - } - ); - } - - _getManagedItemDirectoryInfo(path, callback) { - this.fs.readdir(path, (err, elements) => { - if (err) { - if (err.code === "ENOENT" || err.code === "ENOTDIR") { - return callback(null, EMPTY_SET); - } - return callback(err); - } - const set = new Set( - /** @type {string[]} */ (elements).map(element => - join(this.fs, path, element) - ) - ); - callback(null, set); - }); - } - - _getManagedItemInfo(path, callback) { - const dir = dirname(this.fs, path); - this.managedItemDirectoryQueue.add(dir, (err, elements) => { - if (err) { - return callback(err); - } - if (!elements.has(path)) { - // file or directory doesn't exist - this._managedItems.set(path, "*missing"); - return callback(null, "*missing"); - } - // something exists - // it may be a file or directory - if ( - path.endsWith("node_modules") && - (path.endsWith("/node_modules") || path.endsWith("\\node_modules")) - ) { - // we are only interested in existence of this special directory - this._managedItems.set(path, "*node_modules"); - return callback(null, "*node_modules"); - } - - // we assume it's a directory, as files shouldn't occur in managed paths - const packageJsonPath = join(this.fs, path, "package.json"); - this.fs.readFile(packageJsonPath, (err, content) => { - if (err) { - if (err.code === "ENOENT" || err.code === "ENOTDIR") { - // no package.json or path is not a directory - this.fs.readdir(path, (err, elements) => { - if ( - !err && - elements.length === 1 && - elements[0] === "node_modules" - ) { - // This is only a grouping folder e. g. used by yarn - // we are only interested in existence of this special directory - this._managedItems.set(path, "*nested"); - return callback(null, "*nested"); - } - this.logger.warn( - `Managed item ${path} isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)` - ); - return callback(); - }); - return; - } - return callback(err); - } - let data; - try { - data = JSON.parse(content.toString("utf-8")); - } catch (e) { - return callback(e); - } - if (!data.name) { - this.logger.warn( - `${packageJsonPath} doesn't contain a "name" property (see snapshot.managedPaths option)` - ); - return callback(); - } - const info = `${data.name || ""}@${data.version || ""}`; - this._managedItems.set(path, info); - callback(null, info); - }); + mergeInto(realProfile) { + realProfile.additionalFactories = this.factory; + (realProfile.additionalFactoryTimes = + realProfile.additionalFactoryTimes || []).push({ + start: this.factoryStartTime, + end: this.factoryEndTime }); } - - getDeprecatedFileTimestamps() { - if (this._cachedDeprecatedFileTimestamps !== undefined) - return this._cachedDeprecatedFileTimestamps; - const map = new Map(); - for (const [path, info] of this._fileTimestamps) { - if (info) map.set(path, typeof info === "object" ? info.safeTime : null); - } - return (this._cachedDeprecatedFileTimestamps = map); - } - - getDeprecatedContextTimestamps() { - if (this._cachedDeprecatedContextTimestamps !== undefined) - return this._cachedDeprecatedContextTimestamps; - const map = new Map(); - for (const [path, info] of this._contextTimestamps) { - if (info) map.set(path, typeof info === "object" ? info.safeTime : null); - } - return (this._cachedDeprecatedContextTimestamps = map); - } } -module.exports = FileSystemInfo; -module.exports.Snapshot = Snapshot; +module.exports = ModuleProfile; /***/ }), -/***/ 58727: +/***/ 94560: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -47782,59 +47006,46 @@ module.exports.Snapshot = Snapshot; -const { getEntryRuntime, mergeRuntimeOwned } = __webpack_require__(17156); - -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ +const WebpackError = __webpack_require__(53799); -class FlagAllModulesAsUsedPlugin { - constructor(explanation) { - this.explanation = explanation; - } +/** @typedef {import("./Module")} Module */ +class ModuleRestoreError extends WebpackError { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {Module} module module tied to dependency + * @param {string | Error} err error thrown */ - apply(compiler) { - compiler.hooks.compilation.tap( - "FlagAllModulesAsUsedPlugin", - compilation => { - const moduleGraph = compilation.moduleGraph; - compilation.hooks.optimizeDependencies.tap( - "FlagAllModulesAsUsedPlugin", - modules => { - /** @type {RuntimeSpec} */ - let runtime = undefined; - for (const [name, { options }] of compilation.entries) { - runtime = mergeRuntimeOwned( - runtime, - getEntryRuntime(compilation, name, options) - ); - } - for (const module of modules) { - const exportsInfo = moduleGraph.getExportsInfo(module); - exportsInfo.setUsedInUnknownWay(runtime); - moduleGraph.addExtraReason(module, this.explanation); - if (module.factoryMeta === undefined) { - module.factoryMeta = {}; - } - module.factoryMeta.sideEffectFree = false; - } - } - ); + constructor(module, err) { + let message = "Module restore failed: "; + let details = undefined; + if (err !== null && typeof err === "object") { + if (typeof err.stack === "string" && err.stack) { + const stack = err.stack; + message += stack; + } else if (typeof err.message === "string" && err.message) { + message += err.message; + } else { + message += err; } - ); + } else { + message += String(err); + } + + super(message); + + this.name = "ModuleRestoreError"; + this.details = details; + this.module = module; + this.error = err; } } -module.exports = FlagAllModulesAsUsedPlugin; +module.exports = ModuleRestoreError; /***/ }), -/***/ 84506: +/***/ 59001: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -47845,421 +47056,265 @@ module.exports = FlagAllModulesAsUsedPlugin; -const asyncLib = __webpack_require__(78175); -const Queue = __webpack_require__(65930); +const WebpackError = __webpack_require__(53799); -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./Dependency").ExportSpec} ExportSpec */ -/** @typedef {import("./Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("./ExportsInfo")} ExportsInfo */ /** @typedef {import("./Module")} Module */ -class FlagDependencyExportsPlugin { +class ModuleStoreError extends WebpackError { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {Module} module module tied to dependency + * @param {string | Error} err error thrown */ - apply(compiler) { - compiler.hooks.compilation.tap( - "FlagDependencyExportsPlugin", - compilation => { - const moduleGraph = compilation.moduleGraph; - const cache = compilation.getCache("FlagDependencyExportsPlugin"); - compilation.hooks.finishModules.tapAsync( - "FlagDependencyExportsPlugin", - (modules, callback) => { - const logger = compilation.getLogger( - "webpack.FlagDependencyExportsPlugin" - ); - let statRestoredFromMemCache = 0; - let statRestoredFromCache = 0; - let statNoExports = 0; - let statFlaggedUncached = 0; - let statNotCached = 0; - let statQueueItemsProcessed = 0; + constructor(module, err) { + let message = "Module storing failed: "; + let details = undefined; + if (err !== null && typeof err === "object") { + if (typeof err.stack === "string" && err.stack) { + const stack = err.stack; + message += stack; + } else if (typeof err.message === "string" && err.message) { + message += err.message; + } else { + message += err; + } + } else { + message += String(err); + } - const { moduleMemCaches } = compilation; + super(message); - /** @type {Queue} */ - const queue = new Queue(); + this.name = "ModuleStoreError"; + this.details = details; + this.module = module; + this.error = err; + } +} - // Step 1: Try to restore cached provided export info from cache - logger.time("restore cached provided exports"); - asyncLib.each( - modules, - (module, callback) => { - const exportsInfo = moduleGraph.getExportsInfo(module); - if (!module.buildMeta || !module.buildMeta.exportsType) { - if (exportsInfo.otherExportsInfo.provided !== null) { - // It's a module without declared exports - statNoExports++; - exportsInfo.setHasProvideInfo(); - exportsInfo.setUnknownExportsProvided(); - return callback(); - } - } - if (typeof module.buildInfo.hash !== "string") { - statFlaggedUncached++; - // Enqueue uncacheable module for determining the exports - queue.enqueue(module); - exportsInfo.setHasProvideInfo(); - return callback(); - } - const memCache = moduleMemCaches && moduleMemCaches.get(module); - const memCacheValue = memCache && memCache.get(this); - if (memCacheValue !== undefined) { - statRestoredFromMemCache++; - exportsInfo.restoreProvided(memCacheValue); - return callback(); - } - cache.get( - module.identifier(), - module.buildInfo.hash, - (err, result) => { - if (err) return callback(err); +module.exports = ModuleStoreError; - if (result !== undefined) { - statRestoredFromCache++; - exportsInfo.restoreProvided(result); - } else { - statNotCached++; - // Without cached info enqueue module for determining the exports - queue.enqueue(module); - exportsInfo.setHasProvideInfo(); - } - callback(); - } - ); - }, - err => { - logger.timeEnd("restore cached provided exports"); - if (err) return callback(err); - /** @type {Set} */ - const modulesToStore = new Set(); +/***/ }), - /** @type {Map>} */ - const dependencies = new Map(); +/***/ 62677: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** @type {Module} */ - let module; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** @type {ExportsInfo} */ - let exportsInfo; - /** @type {Map} */ - const exportsSpecsFromDependencies = new Map(); - let cacheable = true; - let changed = false; +const util = __webpack_require__(73837); +const memoize = __webpack_require__(78676); - /** - * @param {DependenciesBlock} depBlock the dependencies block - * @returns {void} - */ - const processDependenciesBlock = depBlock => { - for (const dep of depBlock.dependencies) { - processDependency(dep); - } - for (const block of depBlock.blocks) { - processDependenciesBlock(block); - } - }; +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./util/Hash")} Hash */ - /** - * @param {Dependency} dep the dependency - * @returns {void} - */ - const processDependency = dep => { - const exportDesc = dep.getExports(moduleGraph); - if (!exportDesc) return; - exportsSpecsFromDependencies.set(dep, exportDesc); - }; +const getJavascriptModulesPlugin = memoize(() => + __webpack_require__(89464) +); - /** - * @param {Dependency} dep dependency - * @param {ExportsSpec} exportDesc info - * @returns {void} - */ - const processExportsSpec = (dep, exportDesc) => { - const exports = exportDesc.exports; - const globalCanMangle = exportDesc.canMangle; - const globalFrom = exportDesc.from; - const globalPriority = exportDesc.priority; - const globalTerminalBinding = - exportDesc.terminalBinding || false; - const exportDeps = exportDesc.dependencies; - if (exportDesc.hideExports) { - for (const name of exportDesc.hideExports) { - const exportInfo = exportsInfo.getExportInfo(name); - exportInfo.unsetTarget(dep); - } - } - if (exports === true) { - // unknown exports - if ( - exportsInfo.setUnknownExportsProvided( - globalCanMangle, - exportDesc.excludeExports, - globalFrom && dep, - globalFrom, - globalPriority - ) - ) { - changed = true; - } - } else if (Array.isArray(exports)) { - /** - * merge in new exports - * @param {ExportsInfo} exportsInfo own exports info - * @param {(ExportSpec | string)[]} exports list of exports - */ - const mergeExports = (exportsInfo, exports) => { - for (const exportNameOrSpec of exports) { - let name; - let canMangle = globalCanMangle; - let terminalBinding = globalTerminalBinding; - let exports = undefined; - let from = globalFrom; - let fromExport = undefined; - let priority = globalPriority; - let hidden = false; - if (typeof exportNameOrSpec === "string") { - name = exportNameOrSpec; - } else { - name = exportNameOrSpec.name; - if (exportNameOrSpec.canMangle !== undefined) - canMangle = exportNameOrSpec.canMangle; - if (exportNameOrSpec.export !== undefined) - fromExport = exportNameOrSpec.export; - if (exportNameOrSpec.exports !== undefined) - exports = exportNameOrSpec.exports; - if (exportNameOrSpec.from !== undefined) - from = exportNameOrSpec.from; - if (exportNameOrSpec.priority !== undefined) - priority = exportNameOrSpec.priority; - if (exportNameOrSpec.terminalBinding !== undefined) - terminalBinding = exportNameOrSpec.terminalBinding; - if (exportNameOrSpec.hidden !== undefined) - hidden = exportNameOrSpec.hidden; - } - const exportInfo = exportsInfo.getExportInfo(name); +// TODO webpack 6: remove this class +class ModuleTemplate { + /** + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @param {Compilation} compilation the compilation + */ + constructor(runtimeTemplate, compilation) { + this._runtimeTemplate = runtimeTemplate; + this.type = "javascript"; + this.hooks = Object.freeze({ + content: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .renderModuleContent.tap( + options, + (source, module, renderContext) => + fn( + source, + module, + renderContext, + renderContext.dependencyTemplates + ) + ); + }, + "ModuleTemplate.hooks.content is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModuleContent instead)", + "DEP_MODULE_TEMPLATE_CONTENT" + ) + }, + module: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .renderModuleContent.tap( + options, + (source, module, renderContext) => + fn( + source, + module, + renderContext, + renderContext.dependencyTemplates + ) + ); + }, + "ModuleTemplate.hooks.module is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModuleContent instead)", + "DEP_MODULE_TEMPLATE_MODULE" + ) + }, + render: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .renderModuleContainer.tap( + options, + (source, module, renderContext) => + fn( + source, + module, + renderContext, + renderContext.dependencyTemplates + ) + ); + }, + "ModuleTemplate.hooks.render is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModuleContainer instead)", + "DEP_MODULE_TEMPLATE_RENDER" + ) + }, + package: { + tap: util.deprecate( + (options, fn) => { + getJavascriptModulesPlugin() + .getCompilationHooks(compilation) + .renderModulePackage.tap( + options, + (source, module, renderContext) => + fn( + source, + module, + renderContext, + renderContext.dependencyTemplates + ) + ); + }, + "ModuleTemplate.hooks.package is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModulePackage instead)", + "DEP_MODULE_TEMPLATE_PACKAGE" + ) + }, + hash: { + tap: util.deprecate( + (options, fn) => { + compilation.hooks.fullHash.tap(options, fn); + }, + "ModuleTemplate.hooks.hash is deprecated (use Compilation.hooks.fullHash instead)", + "DEP_MODULE_TEMPLATE_HASH" + ) + } + }); + } +} - if ( - exportInfo.provided === false || - exportInfo.provided === null - ) { - exportInfo.provided = true; - changed = true; - } +Object.defineProperty(ModuleTemplate.prototype, "runtimeTemplate", { + get: util.deprecate( + /** + * @this {ModuleTemplate} + * @returns {TODO} output options + */ + function () { + return this._runtimeTemplate; + }, + "ModuleTemplate.runtimeTemplate is deprecated (use Compilation.runtimeTemplate instead)", + "DEP_WEBPACK_CHUNK_TEMPLATE_OUTPUT_OPTIONS" + ) +}); - if ( - exportInfo.canMangleProvide !== false && - canMangle === false - ) { - exportInfo.canMangleProvide = false; - changed = true; - } +module.exports = ModuleTemplate; - if (terminalBinding && !exportInfo.terminalBinding) { - exportInfo.terminalBinding = true; - changed = true; - } - if (exports) { - const nestedExportsInfo = - exportInfo.createNestedExportsInfo(); - mergeExports(nestedExportsInfo, exports); - } +/***/ }), - if ( - from && - (hidden - ? exportInfo.unsetTarget(dep) - : exportInfo.setTarget( - dep, - from, - fromExport === undefined ? [name] : fromExport, - priority - )) - ) { - changed = true; - } +/***/ 11234: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // Recalculate target exportsInfo - const target = exportInfo.getTarget(moduleGraph); - let targetExportsInfo = undefined; - if (target) { - const targetModuleExportsInfo = - moduleGraph.getExportsInfo(target.module); - targetExportsInfo = - targetModuleExportsInfo.getNestedExportsInfo( - target.export - ); - // add dependency for this module - const set = dependencies.get(target.module); - if (set === undefined) { - dependencies.set(target.module, new Set([module])); - } else { - set.add(module); - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (exportInfo.exportsInfoOwned) { - if ( - exportInfo.exportsInfo.setRedirectNamedTo( - targetExportsInfo - ) - ) { - changed = true; - } - } else if ( - exportInfo.exportsInfo !== targetExportsInfo - ) { - exportInfo.exportsInfo = targetExportsInfo; - changed = true; - } - } - }; - mergeExports(exportsInfo, exports); - } - // store dependencies - if (exportDeps) { - cacheable = false; - for (const exportDependency of exportDeps) { - // add dependency for this module - const set = dependencies.get(exportDependency); - if (set === undefined) { - dependencies.set(exportDependency, new Set([module])); - } else { - set.add(module); - } - } - } - }; - const notifyDependencies = () => { - const deps = dependencies.get(module); - if (deps !== undefined) { - for (const dep of deps) { - queue.enqueue(dep); - } - } - }; - logger.time("figure out provided exports"); - while (queue.length > 0) { - module = queue.dequeue(); +const { cleanUp } = __webpack_require__(59985); +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); - statQueueItemsProcessed++; +class ModuleWarning extends WebpackError { + /** + * @param {Error} warning error thrown + * @param {{from?: string|null}} info additional info + */ + constructor(warning, { from = null } = {}) { + let message = "Module Warning"; - exportsInfo = moduleGraph.getExportsInfo(module); + if (from) { + message += ` (from ${from}):\n`; + } else { + message += ": "; + } - cacheable = true; - changed = false; + if (warning && typeof warning === "object" && warning.message) { + message += warning.message; + } else if (warning) { + message += String(warning); + } - exportsSpecsFromDependencies.clear(); - moduleGraph.freeze(); - processDependenciesBlock(module); - moduleGraph.unfreeze(); - for (const [ - dep, - exportsSpec - ] of exportsSpecsFromDependencies) { - processExportsSpec(dep, exportsSpec); - } + super(message); - if (cacheable) { - modulesToStore.add(module); - } + this.name = "ModuleWarning"; + this.warning = warning; + this.details = + warning && typeof warning === "object" && warning.stack + ? cleanUp(warning.stack, this.message) + : undefined; + } - if (changed) { - notifyDependencies(); - } - } - logger.timeEnd("figure out provided exports"); + serialize(context) { + const { write } = context; - logger.log( - `${Math.round( - (100 * (statFlaggedUncached + statNotCached)) / - (statRestoredFromMemCache + - statRestoredFromCache + - statNotCached + - statFlaggedUncached + - statNoExports) - )}% of exports of modules have been determined (${statNoExports} no declared exports, ${statNotCached} not cached, ${statFlaggedUncached} flagged uncacheable, ${statRestoredFromCache} from cache, ${statRestoredFromMemCache} from mem cache, ${ - statQueueItemsProcessed - - statNotCached - - statFlaggedUncached - } additional calculations due to dependencies)` - ); + write(this.warning); - logger.time("store provided exports into cache"); - asyncLib.each( - modulesToStore, - (module, callback) => { - if (typeof module.buildInfo.hash !== "string") { - // not cacheable - return callback(); - } - const cachedData = moduleGraph - .getExportsInfo(module) - .getRestoreProvidedData(); - const memCache = - moduleMemCaches && moduleMemCaches.get(module); - if (memCache) { - memCache.set(this, cachedData); - } - cache.store( - module.identifier(), - module.buildInfo.hash, - cachedData, - callback - ); - }, - err => { - logger.timeEnd("store provided exports into cache"); - callback(err); - } - ); - } - ); - } - ); + super.serialize(context); + } - /** @type {WeakMap} */ - const providedExportsCache = new WeakMap(); - compilation.hooks.rebuildModule.tap( - "FlagDependencyExportsPlugin", - module => { - providedExportsCache.set( - module, - moduleGraph.getExportsInfo(module).getRestoreProvidedData() - ); - } - ); - compilation.hooks.finishRebuildingModule.tap( - "FlagDependencyExportsPlugin", - module => { - moduleGraph - .getExportsInfo(module) - .restoreProvided(providedExportsCache.get(module)); - } - ); - } - ); + deserialize(context) { + const { read } = context; + + this.warning = read(); + + super.deserialize(context); } } -module.exports = FlagDependencyExportsPlugin; +makeSerializable(ModuleWarning, "webpack/lib/ModuleWarning"); + +module.exports = ModuleWarning; /***/ }), -/***/ 58812: +/***/ 33370: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -48270,508 +47325,587 @@ module.exports = FlagDependencyExportsPlugin; -const Dependency = __webpack_require__(54912); -const { UsageState } = __webpack_require__(63686); -const ModuleGraphConnection = __webpack_require__(40639); -const { STAGE_DEFAULT } = __webpack_require__(80057); +const asyncLib = __webpack_require__(78175); +const { SyncHook, MultiHook } = __webpack_require__(6967); + +const ConcurrentCompilationError = __webpack_require__(95735); +const MultiStats = __webpack_require__(24170); +const MultiWatching = __webpack_require__(81128); const ArrayQueue = __webpack_require__(41792); -const TupleQueue = __webpack_require__(38415); -const { getEntryRuntime, mergeRuntimeOwned } = __webpack_require__(17156); -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGroup")} ChunkGroup */ +/** @template T @typedef {import("tapable").AsyncSeriesHook} AsyncSeriesHook */ +/** @template T @template R @typedef {import("tapable").SyncBailHook} SyncBailHook */ +/** @typedef {import("../declarations/WebpackOptions").WatchOptions} WatchOptions */ /** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ -/** @typedef {import("./Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("./ExportsInfo")} ExportsInfo */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ +/** @typedef {import("./Stats")} Stats */ +/** @typedef {import("./Watching")} Watching */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("./util/fs").IntermediateFileSystem} IntermediateFileSystem */ +/** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */ +/** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */ -const { NO_EXPORTS_REFERENCED, EXPORTS_OBJECT_REFERENCED } = Dependency; +/** + * @template T + * @callback Callback + * @param {(Error | null)=} err + * @param {T=} result + */ -class FlagDependencyUsagePlugin { - /** - * @param {boolean} global do a global analysis instead of per runtime - */ - constructor(global) { - this.global = global; - } +/** + * @callback RunWithDependenciesHandler + * @param {Compiler} compiler + * @param {Callback} callback + */ + +/** + * @typedef {Object} MultiCompilerOptions + * @property {number=} parallelism how many Compilers are allows to run at the same time in parallel + */ +module.exports = class MultiCompiler { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {Compiler[] | Record} compilers child compilers + * @param {MultiCompilerOptions} options options */ - apply(compiler) { - compiler.hooks.compilation.tap("FlagDependencyUsagePlugin", compilation => { - const moduleGraph = compilation.moduleGraph; - compilation.hooks.optimizeDependencies.tap( - { - name: "FlagDependencyUsagePlugin", - stage: STAGE_DEFAULT - }, - modules => { - if (compilation.moduleMemCaches) { - throw new Error( - "optimization.usedExports can't be used with cacheUnaffected as export usage is a global effect" - ); - } - - const logger = compilation.getLogger( - "webpack.FlagDependencyUsagePlugin" - ); - /** @type {Map} */ - const exportInfoToModuleMap = new Map(); - - /** @type {TupleQueue<[Module, RuntimeSpec]>} */ - const queue = new TupleQueue(); - - /** - * @param {Module} module module to process - * @param {(string[] | ReferencedExport)[]} usedExports list of used exports - * @param {RuntimeSpec} runtime part of which runtime - * @param {boolean} forceSideEffects always apply side effects - * @returns {void} - */ - const processReferencedModule = ( - module, - usedExports, - runtime, - forceSideEffects - ) => { - const exportsInfo = moduleGraph.getExportsInfo(module); - if (usedExports.length > 0) { - if (!module.buildMeta || !module.buildMeta.exportsType) { - if (exportsInfo.setUsedWithoutInfo(runtime)) { - queue.enqueue(module, runtime); - } - return; - } - for (const usedExportInfo of usedExports) { - let usedExport; - let canMangle = true; - if (Array.isArray(usedExportInfo)) { - usedExport = usedExportInfo; - } else { - usedExport = usedExportInfo.name; - canMangle = usedExportInfo.canMangle !== false; - } - if (usedExport.length === 0) { - if (exportsInfo.setUsedInUnknownWay(runtime)) { - queue.enqueue(module, runtime); - } - } else { - let currentExportsInfo = exportsInfo; - for (let i = 0; i < usedExport.length; i++) { - const exportInfo = currentExportsInfo.getExportInfo( - usedExport[i] - ); - if (canMangle === false) { - exportInfo.canMangleUse = false; - } - const lastOne = i === usedExport.length - 1; - if (!lastOne) { - const nestedInfo = exportInfo.getNestedExportsInfo(); - if (nestedInfo) { - if ( - exportInfo.setUsedConditionally( - used => used === UsageState.Unused, - UsageState.OnlyPropertiesUsed, - runtime - ) - ) { - const currentModule = - currentExportsInfo === exportsInfo - ? module - : exportInfoToModuleMap.get(currentExportsInfo); - if (currentModule) { - queue.enqueue(currentModule, runtime); - } - } - currentExportsInfo = nestedInfo; - continue; - } - } - if ( - exportInfo.setUsedConditionally( - v => v !== UsageState.Used, - UsageState.Used, - runtime - ) - ) { - const currentModule = - currentExportsInfo === exportsInfo - ? module - : exportInfoToModuleMap.get(currentExportsInfo); - if (currentModule) { - queue.enqueue(currentModule, runtime); - } - } - break; - } - } - } - } else { - // for a module without side effects we stop tracking usage here when no export is used - // This module won't be evaluated in this case - // TODO webpack 6 remove this check - if ( - !forceSideEffects && - module.factoryMeta !== undefined && - module.factoryMeta.sideEffectFree - ) { - return; - } - if (exportsInfo.setUsedForSideEffectsOnly(runtime)) { - queue.enqueue(module, runtime); - } - } - }; - - /** - * @param {DependenciesBlock} module the module - * @param {RuntimeSpec} runtime part of which runtime - * @param {boolean} forceSideEffects always apply side effects - * @returns {void} - */ - const processModule = (module, runtime, forceSideEffects) => { - /** @type {Map>} */ - const map = new Map(); - - /** @type {ArrayQueue} */ - const queue = new ArrayQueue(); - queue.enqueue(module); - for (;;) { - const block = queue.dequeue(); - if (block === undefined) break; - for (const b of block.blocks) { - if ( - !this.global && - b.groupOptions && - b.groupOptions.entryOptions - ) { - processModule( - b, - b.groupOptions.entryOptions.runtime || undefined, - true - ); - } else { - queue.enqueue(b); - } - } - for (const dep of block.dependencies) { - const connection = moduleGraph.getConnection(dep); - if (!connection || !connection.module) { - continue; - } - const activeState = connection.getActiveState(runtime); - if (activeState === false) continue; - const { module } = connection; - if (activeState === ModuleGraphConnection.TRANSITIVE_ONLY) { - processModule(module, runtime, false); - continue; - } - const oldReferencedExports = map.get(module); - if (oldReferencedExports === EXPORTS_OBJECT_REFERENCED) { - continue; - } - const referencedExports = - compilation.getDependencyReferencedExports(dep, runtime); - if ( - oldReferencedExports === undefined || - oldReferencedExports === NO_EXPORTS_REFERENCED || - referencedExports === EXPORTS_OBJECT_REFERENCED - ) { - map.set(module, referencedExports); - } else if ( - oldReferencedExports !== undefined && - referencedExports === NO_EXPORTS_REFERENCED - ) { - continue; - } else { - let exportsMap; - if (Array.isArray(oldReferencedExports)) { - exportsMap = new Map(); - for (const item of oldReferencedExports) { - if (Array.isArray(item)) { - exportsMap.set(item.join("\n"), item); - } else { - exportsMap.set(item.name.join("\n"), item); - } - } - map.set(module, exportsMap); - } else { - exportsMap = oldReferencedExports; - } - for (const item of referencedExports) { - if (Array.isArray(item)) { - const key = item.join("\n"); - const oldItem = exportsMap.get(key); - if (oldItem === undefined) { - exportsMap.set(key, item); - } - // if oldItem is already an array we have to do nothing - // if oldItem is an ReferencedExport object, we don't have to do anything - // as canMangle defaults to true for arrays - } else { - const key = item.name.join("\n"); - const oldItem = exportsMap.get(key); - if (oldItem === undefined || Array.isArray(oldItem)) { - exportsMap.set(key, item); - } else { - exportsMap.set(key, { - name: item.name, - canMangle: item.canMangle && oldItem.canMangle - }); - } - } - } - } - } - } - - for (const [module, referencedExports] of map) { - if (Array.isArray(referencedExports)) { - processReferencedModule( - module, - referencedExports, - runtime, - forceSideEffects - ); - } else { - processReferencedModule( - module, - Array.from(referencedExports.values()), - runtime, - forceSideEffects - ); - } - } - }; - - logger.time("initialize exports usage"); - for (const module of modules) { - const exportsInfo = moduleGraph.getExportsInfo(module); - exportInfoToModuleMap.set(exportsInfo, module); - exportsInfo.setHasUseInfo(); - } - logger.timeEnd("initialize exports usage"); - - logger.time("trace exports usage in graph"); + constructor(compilers, options) { + if (!Array.isArray(compilers)) { + compilers = Object.keys(compilers).map(name => { + compilers[name].name = name; + return compilers[name]; + }); + } - /** - * @param {Dependency} dep dependency - * @param {RuntimeSpec} runtime runtime - */ - const processEntryDependency = (dep, runtime) => { - const module = moduleGraph.getModule(dep); - if (module) { - processReferencedModule( - module, - NO_EXPORTS_REFERENCED, - runtime, - true - ); - } - }; - /** @type {RuntimeSpec} */ - let globalRuntime = undefined; - for (const [ - entryName, - { dependencies: deps, includeDependencies: includeDeps, options } - ] of compilation.entries) { - const runtime = this.global - ? undefined - : getEntryRuntime(compilation, entryName, options); - for (const dep of deps) { - processEntryDependency(dep, runtime); - } - for (const dep of includeDeps) { - processEntryDependency(dep, runtime); - } - globalRuntime = mergeRuntimeOwned(globalRuntime, runtime); - } - for (const dep of compilation.globalEntry.dependencies) { - processEntryDependency(dep, globalRuntime); - } - for (const dep of compilation.globalEntry.includeDependencies) { - processEntryDependency(dep, globalRuntime); - } + this.hooks = Object.freeze({ + /** @type {SyncHook<[MultiStats]>} */ + done: new SyncHook(["stats"]), + /** @type {MultiHook>} */ + invalid: new MultiHook(compilers.map(c => c.hooks.invalid)), + /** @type {MultiHook>} */ + run: new MultiHook(compilers.map(c => c.hooks.run)), + /** @type {SyncHook<[]>} */ + watchClose: new SyncHook([]), + /** @type {MultiHook>} */ + watchRun: new MultiHook(compilers.map(c => c.hooks.watchRun)), + /** @type {MultiHook>} */ + infrastructureLog: new MultiHook( + compilers.map(c => c.hooks.infrastructureLog) + ) + }); + this.compilers = compilers; + /** @type {MultiCompilerOptions} */ + this._options = { + parallelism: options.parallelism || Infinity + }; + /** @type {WeakMap} */ + this.dependencies = new WeakMap(); + this.running = false; - while (queue.length) { - const [module, runtime] = queue.dequeue(); - processModule(module, runtime, false); - } - logger.timeEnd("trace exports usage in graph"); + /** @type {Stats[]} */ + const compilerStats = this.compilers.map(() => null); + let doneCompilers = 0; + for (let index = 0; index < this.compilers.length; index++) { + const compiler = this.compilers[index]; + const compilerIndex = index; + let compilerDone = false; + compiler.hooks.done.tap("MultiCompiler", stats => { + if (!compilerDone) { + compilerDone = true; + doneCompilers++; } - ); - }); + compilerStats[compilerIndex] = stats; + if (doneCompilers === this.compilers.length) { + this.hooks.done.call(new MultiStats(compilerStats)); + } + }); + compiler.hooks.invalid.tap("MultiCompiler", () => { + if (compilerDone) { + compilerDone = false; + doneCompilers--; + } + }); + } } -} -module.exports = FlagDependencyUsagePlugin; + get options() { + return Object.assign( + this.compilers.map(c => c.options), + this._options + ); + } + get outputPath() { + let commonPath = this.compilers[0].outputPath; + for (const compiler of this.compilers) { + while ( + compiler.outputPath.indexOf(commonPath) !== 0 && + /[/\\]/.test(commonPath) + ) { + commonPath = commonPath.replace(/[/\\][^/\\]*$/, ""); + } + } -/***/ }), + if (!commonPath && this.compilers[0].outputPath[0] === "/") return "/"; + return commonPath; + } -/***/ 93401: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + get inputFileSystem() { + throw new Error("Cannot read inputFileSystem of a MultiCompiler"); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + get outputFileSystem() { + throw new Error("Cannot read outputFileSystem of a MultiCompiler"); + } + get watchFileSystem() { + throw new Error("Cannot read watchFileSystem of a MultiCompiler"); + } + get intermediateFileSystem() { + throw new Error("Cannot read outputFileSystem of a MultiCompiler"); + } -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./ConcatenationScope")} ConcatenationScope */ -/** @typedef {import("./DependencyTemplate")} DependencyTemplate */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./NormalModule")} NormalModule */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./util/Hash")} Hash */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - -/** - * @typedef {Object} GenerateContext - * @property {DependencyTemplates} dependencyTemplates mapping from dependencies to templates - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {Set} runtimeRequirements the requirements for runtime - * @property {RuntimeSpec} runtime the runtime - * @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules - * @property {CodeGenerationResults=} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that) - * @property {string} type which kind of code should be generated - * @property {function(): Map=} getData get access to the code generation data - */ - -/** - * @typedef {Object} UpdateHashContext - * @property {NormalModule} module the module - * @property {ChunkGraph} chunkGraph - * @property {RuntimeSpec} runtime - */ - -/** - * - */ -class Generator { - static byType(map) { - return new ByTypeGenerator(map); + /** + * @param {InputFileSystem} value the new input file system + */ + set inputFileSystem(value) { + for (const compiler of this.compilers) { + compiler.inputFileSystem = value; + } } - /* istanbul ignore next */ /** - * @abstract - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) + * @param {OutputFileSystem} value the new output file system */ - getTypes(module) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + set outputFileSystem(value) { + for (const compiler of this.compilers) { + compiler.outputFileSystem = value; + } } - /* istanbul ignore next */ /** - * @abstract - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module + * @param {WatchFileSystem} value the new watch file system */ - getSize(module, type) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + set watchFileSystem(value) { + for (const compiler of this.compilers) { + compiler.watchFileSystem = value; + } } - /* istanbul ignore next */ /** - * @abstract - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code + * @param {IntermediateFileSystem} value the new intermediate file system */ - generate( - module, - { dependencyTemplates, runtimeTemplate, moduleGraph, type } - ) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + set intermediateFileSystem(value) { + for (const compiler of this.compilers) { + compiler.intermediateFileSystem = value; + } + } + + getInfrastructureLogger(name) { + return this.compilers[0].getInfrastructureLogger(name); } /** - * @param {NormalModule} module module for which the bailout reason should be determined - * @param {ConcatenationBailoutReasonContext} context context - * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated + * @param {Compiler} compiler the child compiler + * @param {string[]} dependencies its dependencies + * @returns {void} */ - getConcatenationBailoutReason(module, context) { - return `Module Concatenation is not implemented for ${this.constructor.name}`; + setDependencies(compiler, dependencies) { + this.dependencies.set(compiler, dependencies); } /** - * @param {Hash} hash hash that will be modified - * @param {UpdateHashContext} updateHashContext context for updating hash + * @param {Callback} callback signals when the validation is complete + * @returns {boolean} true if the dependencies are valid */ - updateHash(hash, { module, runtime }) { - // no nothing + validateDependencies(callback) { + /** @type {Set<{source: Compiler, target: Compiler}>} */ + const edges = new Set(); + /** @type {string[]} */ + const missing = []; + const targetFound = compiler => { + for (const edge of edges) { + if (edge.target === compiler) { + return true; + } + } + return false; + }; + const sortEdges = (e1, e2) => { + return ( + e1.source.name.localeCompare(e2.source.name) || + e1.target.name.localeCompare(e2.target.name) + ); + }; + for (const source of this.compilers) { + const dependencies = this.dependencies.get(source); + if (dependencies) { + for (const dep of dependencies) { + const target = this.compilers.find(c => c.name === dep); + if (!target) { + missing.push(dep); + } else { + edges.add({ + source, + target + }); + } + } + } + } + /** @type {string[]} */ + const errors = missing.map(m => `Compiler dependency \`${m}\` not found.`); + const stack = this.compilers.filter(c => !targetFound(c)); + while (stack.length > 0) { + const current = stack.pop(); + for (const edge of edges) { + if (edge.source === current) { + edges.delete(edge); + const target = edge.target; + if (!targetFound(target)) { + stack.push(target); + } + } + } + } + if (edges.size > 0) { + /** @type {string[]} */ + const lines = Array.from(edges) + .sort(sortEdges) + .map(edge => `${edge.source.name} -> ${edge.target.name}`); + lines.unshift("Circular dependency found in compiler dependencies."); + errors.unshift(lines.join("\n")); + } + if (errors.length > 0) { + const message = errors.join("\n"); + callback(new Error(message)); + return false; + } + return true; } -} -class ByTypeGenerator extends Generator { - constructor(map) { - super(); - this.map = map; - this._types = new Set(Object.keys(map)); + // TODO webpack 6 remove + /** + * @deprecated This method should have been private + * @param {Compiler[]} compilers the child compilers + * @param {RunWithDependenciesHandler} fn a handler to run for each compiler + * @param {Callback} callback the compiler's handler + * @returns {void} + */ + runWithDependencies(compilers, fn, callback) { + const fulfilledNames = new Set(); + let remainingCompilers = compilers; + const isDependencyFulfilled = d => fulfilledNames.has(d); + const getReadyCompilers = () => { + let readyCompilers = []; + let list = remainingCompilers; + remainingCompilers = []; + for (const c of list) { + const dependencies = this.dependencies.get(c); + const ready = + !dependencies || dependencies.every(isDependencyFulfilled); + if (ready) { + readyCompilers.push(c); + } else { + remainingCompilers.push(c); + } + } + return readyCompilers; + }; + const runCompilers = callback => { + if (remainingCompilers.length === 0) return callback(); + asyncLib.map( + getReadyCompilers(), + (compiler, callback) => { + fn(compiler, err => { + if (err) return callback(err); + fulfilledNames.add(compiler.name); + runCompilers(callback); + }); + }, + callback + ); + }; + runCompilers(callback); } /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) + * @template SetupResult + * @param {function(Compiler, number, Callback, function(): boolean, function(): void, function(): void): SetupResult} setup setup a single compiler + * @param {function(Compiler, SetupResult, Callback): void} run run/continue a single compiler + * @param {Callback} callback callback when all compilers are done, result includes Stats of all changed compilers + * @returns {SetupResult[]} result of setup */ - getTypes(module) { - return this._types; + _runGraph(setup, run, callback) { + /** @typedef {{ compiler: Compiler, setupResult: SetupResult, result: Stats, state: "pending" | "blocked" | "queued" | "starting" | "running" | "running-outdated" | "done", children: Node[], parents: Node[] }} Node */ + + // State transitions for nodes: + // -> blocked (initial) + // blocked -> starting [running++] (when all parents done) + // queued -> starting [running++] (when processing the queue) + // starting -> running (when run has been called) + // running -> done [running--] (when compilation is done) + // done -> pending (when invalidated from file change) + // pending -> blocked [add to queue] (when invalidated from aggregated changes) + // done -> blocked [add to queue] (when invalidated, from parent invalidation) + // running -> running-outdated (when invalidated, either from change or parent invalidation) + // running-outdated -> blocked [running--] (when compilation is done) + + /** @type {Node[]} */ + const nodes = this.compilers.map(compiler => ({ + compiler, + setupResult: undefined, + result: undefined, + state: "blocked", + children: [], + parents: [] + })); + /** @type {Map} */ + const compilerToNode = new Map(); + for (const node of nodes) compilerToNode.set(node.compiler.name, node); + for (const node of nodes) { + const dependencies = this.dependencies.get(node.compiler); + if (!dependencies) continue; + for (const dep of dependencies) { + const parent = compilerToNode.get(dep); + node.parents.push(parent); + parent.children.push(node); + } + } + /** @type {ArrayQueue} */ + const queue = new ArrayQueue(); + for (const node of nodes) { + if (node.parents.length === 0) { + node.state = "queued"; + queue.enqueue(node); + } + } + let errored = false; + let running = 0; + const parallelism = this._options.parallelism; + /** + * @param {Node} node node + * @param {Error=} err error + * @param {Stats=} stats result + * @returns {void} + */ + const nodeDone = (node, err, stats) => { + if (errored) return; + if (err) { + errored = true; + return asyncLib.each( + nodes, + (node, callback) => { + if (node.compiler.watching) { + node.compiler.watching.close(callback); + } else { + callback(); + } + }, + () => callback(err) + ); + } + node.result = stats; + running--; + if (node.state === "running") { + node.state = "done"; + for (const child of node.children) { + if (child.state === "blocked") queue.enqueue(child); + } + } else if (node.state === "running-outdated") { + node.state = "blocked"; + queue.enqueue(node); + } + processQueue(); + }; + /** + * @param {Node} node node + * @returns {void} + */ + const nodeInvalidFromParent = node => { + if (node.state === "done") { + node.state = "blocked"; + } else if (node.state === "running") { + node.state = "running-outdated"; + } + for (const child of node.children) { + nodeInvalidFromParent(child); + } + }; + /** + * @param {Node} node node + * @returns {void} + */ + const nodeInvalid = node => { + if (node.state === "done") { + node.state = "pending"; + } else if (node.state === "running") { + node.state = "running-outdated"; + } + for (const child of node.children) { + nodeInvalidFromParent(child); + } + }; + /** + * @param {Node} node node + * @returns {void} + */ + const nodeChange = node => { + nodeInvalid(node); + if (node.state === "pending") { + node.state = "blocked"; + } + if (node.state === "blocked") { + queue.enqueue(node); + processQueue(); + } + }; + + const setupResults = []; + nodes.forEach((node, i) => { + setupResults.push( + (node.setupResult = setup( + node.compiler, + i, + nodeDone.bind(null, node), + () => node.state !== "starting" && node.state !== "running", + () => nodeChange(node), + () => nodeInvalid(node) + )) + ); + }); + let processing = true; + const processQueue = () => { + if (processing) return; + processing = true; + process.nextTick(processQueueWorker); + }; + const processQueueWorker = () => { + while (running < parallelism && queue.length > 0 && !errored) { + const node = queue.dequeue(); + if ( + node.state === "queued" || + (node.state === "blocked" && + node.parents.every(p => p.state === "done")) + ) { + running++; + node.state = "starting"; + run(node.compiler, node.setupResult, nodeDone.bind(null, node)); + node.state = "running"; + } + } + processing = false; + if ( + !errored && + running === 0 && + nodes.every(node => node.state === "done") + ) { + const stats = []; + for (const node of nodes) { + const result = node.result; + if (result) { + node.result = undefined; + stats.push(result); + } + } + if (stats.length > 0) { + callback(null, new MultiStats(stats)); + } + } + }; + processQueueWorker(); + return setupResults; } /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module + * @param {WatchOptions|WatchOptions[]} watchOptions the watcher's options + * @param {Callback} handler signals when the call finishes + * @returns {MultiWatching} a compiler watcher */ - getSize(module, type) { - const t = type || "javascript"; - const generator = this.map[t]; - return generator ? generator.getSize(module, t) : 0; + watch(watchOptions, handler) { + if (this.running) { + return handler(new ConcurrentCompilationError()); + } + this.running = true; + + if (this.validateDependencies(handler)) { + const watchings = this._runGraph( + (compiler, idx, callback, isBlocked, setChanged, setInvalid) => { + const watching = compiler.watch( + Array.isArray(watchOptions) ? watchOptions[idx] : watchOptions, + callback + ); + if (watching) { + watching._onInvalid = setInvalid; + watching._onChange = setChanged; + watching._isBlocked = isBlocked; + } + return watching; + }, + (compiler, watching, callback) => { + if (compiler.watching !== watching) return; + if (!watching.running) watching.invalidate(); + }, + handler + ); + return new MultiWatching(watchings, this); + } + + return new MultiWatching([], this); } /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code + * @param {Callback} callback signals when the call finishes + * @returns {void} */ - generate(module, generateContext) { - const type = generateContext.type; - const generator = this.map[type]; - if (!generator) { - throw new Error(`Generator.byType: no generator specified for ${type}`); + run(callback) { + if (this.running) { + return callback(new ConcurrentCompilationError()); + } + this.running = true; + + if (this.validateDependencies(callback)) { + this._runGraph( + () => {}, + (compiler, setupResult, callback) => compiler.run(callback), + (err, stats) => { + this.running = false; + + if (callback !== undefined) { + return callback(err, stats); + } + } + ); } - return generator.generate(module, generateContext); } -} -module.exports = Generator; + purgeInputFileSystem() { + for (const compiler of this.compilers) { + if (compiler.inputFileSystem && compiler.inputFileSystem.purge) { + compiler.inputFileSystem.purge(); + } + } + } + + /** + * @param {Callback} callback signals when the compiler closes + * @returns {void} + */ + close(callback) { + asyncLib.each( + this.compilers, + (compiler, callback) => { + compiler.close(callback); + }, + callback + ); + } +}; /***/ }), -/***/ 37234: -/***/ (function(__unused_webpack_module, exports) { +/***/ 24170: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -48781,166 +47915,363 @@ module.exports = Generator; -/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGroup")} ChunkGroup */ -/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ -/** @typedef {import("./Module")} Module */ +const identifierUtils = __webpack_require__(82186); -/** - * @param {ChunkGroup} chunkGroup the ChunkGroup to connect - * @param {Chunk} chunk chunk to tie to ChunkGroup - * @returns {void} - */ -const connectChunkGroupAndChunk = (chunkGroup, chunk) => { - if (chunkGroup.pushChunk(chunk)) { - chunk.addGroup(chunkGroup); - } +/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */ +/** @typedef {import("./Stats")} Stats */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").KnownStatsCompilation} KnownStatsCompilation */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */ + +const indent = (str, prefix) => { + const rem = str.replace(/\n([^\n])/g, "\n" + prefix + "$1"); + return prefix + rem; }; +class MultiStats { + /** + * @param {Stats[]} stats the child stats + */ + constructor(stats) { + this.stats = stats; + } + + get hash() { + return this.stats.map(stat => stat.hash).join(""); + } + + /** + * @returns {boolean} true if a child compilation encountered an error + */ + hasErrors() { + return this.stats.some(stat => stat.hasErrors()); + } + + /** + * @returns {boolean} true if a child compilation had a warning + */ + hasWarnings() { + return this.stats.some(stat => stat.hasWarnings()); + } + + _createChildOptions(options, context) { + if (!options) { + options = {}; + } + const { children: childrenOptions = undefined, ...baseOptions } = + typeof options === "string" ? { preset: options } : options; + const children = this.stats.map((stat, idx) => { + const childOptions = Array.isArray(childrenOptions) + ? childrenOptions[idx] + : childrenOptions; + return stat.compilation.createStatsOptions( + { + ...baseOptions, + ...(typeof childOptions === "string" + ? { preset: childOptions } + : childOptions && typeof childOptions === "object" + ? childOptions + : undefined) + }, + context + ); + }); + return { + version: children.every(o => o.version), + hash: children.every(o => o.hash), + errorsCount: children.every(o => o.errorsCount), + warningsCount: children.every(o => o.warningsCount), + errors: children.every(o => o.errors), + warnings: children.every(o => o.warnings), + children + }; + } + + /** + * @param {any} options stats options + * @returns {StatsCompilation} json output + */ + toJson(options) { + options = this._createChildOptions(options, { forToString: false }); + /** @type {KnownStatsCompilation} */ + const obj = {}; + obj.children = this.stats.map((stat, idx) => { + const obj = stat.toJson(options.children[idx]); + const compilationName = stat.compilation.name; + const name = + compilationName && + identifierUtils.makePathsRelative( + options.context, + compilationName, + stat.compilation.compiler.root + ); + obj.name = name; + return obj; + }); + if (options.version) { + obj.version = obj.children[0].version; + } + if (options.hash) { + obj.hash = obj.children.map(j => j.hash).join(""); + } + const mapError = (j, obj) => { + return { + ...obj, + compilerPath: obj.compilerPath + ? `${j.name}.${obj.compilerPath}` + : j.name + }; + }; + if (options.errors) { + obj.errors = []; + for (const j of obj.children) { + for (const i of j.errors) { + obj.errors.push(mapError(j, i)); + } + } + } + if (options.warnings) { + obj.warnings = []; + for (const j of obj.children) { + for (const i of j.warnings) { + obj.warnings.push(mapError(j, i)); + } + } + } + if (options.errorsCount) { + obj.errorsCount = 0; + for (const j of obj.children) { + obj.errorsCount += j.errorsCount; + } + } + if (options.warningsCount) { + obj.warningsCount = 0; + for (const j of obj.children) { + obj.warningsCount += j.warningsCount; + } + } + return obj; + } + + toString(options) { + options = this._createChildOptions(options, { forToString: true }); + const results = this.stats.map((stat, idx) => { + const str = stat.toString(options.children[idx]); + const compilationName = stat.compilation.name; + const name = + compilationName && + identifierUtils + .makePathsRelative( + options.context, + compilationName, + stat.compilation.compiler.root + ) + .replace(/\|/g, " "); + if (!str) return str; + return name ? `${name}:\n${indent(str, " ")}` : str; + }); + return results.filter(Boolean).join("\n\n"); + } +} + +module.exports = MultiStats; + + +/***/ }), + +/***/ 81128: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const asyncLib = __webpack_require__(78175); + +/** @typedef {import("./MultiCompiler")} MultiCompiler */ +/** @typedef {import("./Watching")} Watching */ + /** - * @param {ChunkGroup} parent parent ChunkGroup to connect - * @param {ChunkGroup} child child ChunkGroup to connect - * @returns {void} + * @template T + * @callback Callback + * @param {(Error | null)=} err + * @param {T=} result */ -const connectChunkGroupParentAndChild = (parent, child) => { - if (parent.addChild(child)) { - child.addParent(parent); + +class MultiWatching { + /** + * @param {Watching[]} watchings child compilers' watchers + * @param {MultiCompiler} compiler the compiler + */ + constructor(watchings, compiler) { + this.watchings = watchings; + this.compiler = compiler; } -}; -exports.connectChunkGroupAndChunk = connectChunkGroupAndChunk; -exports.connectChunkGroupParentAndChild = connectChunkGroupParentAndChild; + invalidate(callback) { + if (callback) { + asyncLib.each( + this.watchings, + (watching, callback) => watching.invalidate(callback), + callback + ); + } else { + for (const watching of this.watchings) { + watching.invalidate(); + } + } + } + + suspend() { + for (const watching of this.watchings) { + watching.suspend(); + } + } + + resume() { + for (const watching of this.watchings) { + watching.resume(); + } + } + + /** + * @param {Callback} callback signals when the watcher is closed + * @returns {void} + */ + close(callback) { + asyncLib.forEach( + this.watchings, + (watching, finishedCallback) => { + watching.close(finishedCallback); + }, + err => { + this.compiler.hooks.watchClose.call(); + if (typeof callback === "function") { + this.compiler.running = false; + callback(err); + } + } + ); + } +} + +module.exports = MultiWatching; /***/ }), -/***/ 97511: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 50169: +/***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const WebpackError = __webpack_require__(53799); +/** @typedef {import("./Compiler")} Compiler */ -module.exports = class HarmonyLinkingError extends WebpackError { - /** @param {string} message Error message */ - constructor(message) { - super(message); - this.name = "HarmonyLinkingError"; - this.hideStack = true; +class NoEmitOnErrorsPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.shouldEmit.tap("NoEmitOnErrorsPlugin", compilation => { + if (compilation.getStats().hasErrors()) return false; + }); + compiler.hooks.compilation.tap("NoEmitOnErrorsPlugin", compilation => { + compilation.hooks.shouldRecord.tap("NoEmitOnErrorsPlugin", () => { + if (compilation.getStats().hasErrors()) return false; + }); + }); } -}; +} + +module.exports = NoEmitOnErrorsPlugin; /***/ }), -/***/ 11351: +/***/ 80832: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Sean Larkin @thelarkinn + Author Tobias Koppers @sokra */ const WebpackError = __webpack_require__(53799); -/** @typedef {import("./Module")} Module */ +module.exports = class NoModeWarning extends WebpackError { + constructor() { + super(); -/** - * @template T - * @callback Callback - * @param {Error=} err - * @param {T=} stats - * @returns {void} - */ + this.name = "NoModeWarning"; + this.message = + "configuration\n" + + "The 'mode' option has not been set, webpack will fallback to 'production' for this value.\n" + + "Set 'mode' option to 'development' or 'production' to enable defaults for each environment.\n" + + "You can also set it to 'none' to disable any default behavior. " + + "Learn more: https://webpack.js.org/configuration/mode/"; + } +}; -class HookWebpackError extends WebpackError { - /** - * Creates an instance of HookWebpackError. - * @param {Error} error inner error - * @param {string} hook name of hook - */ - constructor(error, hook) { - super(error.message); - this.name = "HookWebpackError"; - this.hook = hook; - this.error = error; - this.hideStack = true; - this.details = `caused by plugins in ${hook}\n${error.stack}`; +/***/ }), - this.stack += `\n-- inner error --\n${error.stack}`; - } -} +/***/ 6325: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = HookWebpackError; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ -/** - * @param {Error} error an error - * @param {string} hook name of the hook - * @returns {WebpackError} a webpack error - */ -const makeWebpackError = (error, hook) => { - if (error instanceof WebpackError) return error; - return new HookWebpackError(error, hook); -}; -module.exports.makeWebpackError = makeWebpackError; -/** - * @template T - * @param {function((WebpackError | null)=, T=): void} callback webpack error callback - * @param {string} hook name of hook - * @returns {Callback} generic callback - */ -const makeWebpackErrorCallback = (callback, hook) => { - return (err, result) => { - if (err) { - if (err instanceof WebpackError) { - callback(err); - return; - } - callback(new HookWebpackError(err, hook)); - return; - } - callback(null, result); - }; -}; -module.exports.makeWebpackErrorCallback = makeWebpackErrorCallback; +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); -/** - * @template T - * @param {function(): T} fn function which will be wrapping in try catch - * @param {string} hook name of hook - * @returns {T} the result - */ -const tryRunOrWebpackError = (fn, hook) => { - let r; - try { - r = fn(); - } catch (err) { - if (err instanceof WebpackError) { - throw err; - } - throw new HookWebpackError(err, hook); +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ + +class NodeStuffInWebError extends WebpackError { + /** + * @param {DependencyLocation} loc loc + * @param {string} expression expression + * @param {string} description description + */ + constructor(loc, expression, description) { + super( + `${JSON.stringify( + expression + )} has been used, it will be undefined in next major version. +${description}` + ); + + this.name = "NodeStuffInWebError"; + this.loc = loc; } - return r; -}; +} -module.exports.tryRunOrWebpackError = tryRunOrWebpackError; +makeSerializable(NodeStuffInWebError, "webpack/lib/NodeStuffInWebError"); + +module.exports = NodeStuffInWebError; /***/ }), -/***/ 6404: +/***/ 95287: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -48951,76 +48282,26 @@ module.exports.tryRunOrWebpackError = tryRunOrWebpackError; -const { SyncBailHook } = __webpack_require__(41242); -const { RawSource } = __webpack_require__(51255); -const ChunkGraph = __webpack_require__(64971); -const Compilation = __webpack_require__(85720); -const HotUpdateChunk = __webpack_require__(9597); -const NormalModule = __webpack_require__(39); +const NodeStuffInWebError = __webpack_require__(6325); const RuntimeGlobals = __webpack_require__(16475); -const WebpackError = __webpack_require__(53799); +const CachedConstDependency = __webpack_require__(57403); const ConstDependency = __webpack_require__(76911); -const ImportMetaHotAcceptDependency = __webpack_require__(51274); -const ImportMetaHotDeclineDependency = __webpack_require__(53141); -const ModuleHotAcceptDependency = __webpack_require__(47511); -const ModuleHotDeclineDependency = __webpack_require__(86301); -const HotModuleReplacementRuntimeModule = __webpack_require__(27899); -const JavascriptParser = __webpack_require__(29050); const { - evaluateToIdentifier + evaluateToString, + expressionIsUnsupported } = __webpack_require__(93998); -const { find, isSubset } = __webpack_require__(93347); -const TupleSet = __webpack_require__(76455); -const { compareModulesById } = __webpack_require__(29579); -const { - getRuntimeKey, - keyToRuntime, - forEachRuntime, - mergeRuntimeOwned, - subtractRuntime, - intersectRuntime -} = __webpack_require__(17156); +const { relative } = __webpack_require__(17139); +const { parseResource } = __webpack_require__(82186); -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ /** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./RuntimeModule")} RuntimeModule */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - -/** - * @typedef {Object} HMRJavascriptParserHooks - * @property {SyncBailHook<[TODO, string[]], void>} hotAcceptCallback - * @property {SyncBailHook<[TODO, string[]], void>} hotAcceptWithoutCallback - */ - -/** @type {WeakMap} */ -const parserHooksMap = new WeakMap(); - -class HotModuleReplacementPlugin { - /** - * @param {JavascriptParser} parser the parser - * @returns {HMRJavascriptParserHooks} the attached hooks - */ - static getParserHooks(parser) { - if (!(parser instanceof JavascriptParser)) { - throw new TypeError( - "The 'parser' argument must be an instance of JavascriptParser" - ); - } - let hooks = parserHooksMap.get(parser); - if (hooks === undefined) { - hooks = { - hotAcceptCallback: new SyncBailHook(["expression", "requests"]), - hotAcceptWithoutCallback: new SyncBailHook(["expression", "requests"]) - }; - parserHooksMap.set(parser, hooks); - } - return hooks; - } +/** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +class NodeStuffPlugin { constructor(options) { - this.options = options || {}; + this.options = options; } /** @@ -49029,1853 +48310,1566 @@ class HotModuleReplacementPlugin { * @returns {void} */ apply(compiler) { - const { _backCompat: backCompat } = compiler; - if (compiler.options.output.strictModuleErrorHandling === undefined) - compiler.options.output.strictModuleErrorHandling = true; - const runtimeRequirements = [RuntimeGlobals.module]; + const options = this.options; + compiler.hooks.compilation.tap( + "NodeStuffPlugin", + (compilation, { normalModuleFactory }) => { + const handler = (parser, parserOptions) => { + if (parserOptions.node === false) return; - const createAcceptHandler = (parser, ParamDependency) => { - const { hotAcceptCallback, hotAcceptWithoutCallback } = - HotModuleReplacementPlugin.getParserHooks(parser); + let localOptions = options; + if (parserOptions.node) { + localOptions = { ...localOptions, ...parserOptions.node }; + } - return expr => { - const module = parser.state.module; - const dep = new ConstDependency( - `${module.moduleArgument}.hot.accept`, - expr.callee.range, - runtimeRequirements - ); - dep.loc = expr.loc; - module.addPresentationalDependency(dep); - module.buildInfo.moduleConcatenationBailout = "Hot Module Replacement"; - if (expr.arguments.length >= 1) { - const arg = parser.evaluateExpression(expr.arguments[0]); - let params = []; - let requests = []; - if (arg.isString()) { - params = [arg]; - } else if (arg.isArray()) { - params = arg.items.filter(param => param.isString()); - } - if (params.length > 0) { - params.forEach((param, idx) => { - const request = param.string; - const dep = new ParamDependency(request, param.range); - dep.optional = true; - dep.loc = Object.create(expr.loc); - dep.loc.index = idx; - module.addDependency(dep); - requests.push(request); - }); - if (expr.arguments.length > 1) { - hotAcceptCallback.call(expr.arguments[1], requests); - for (let i = 1; i < expr.arguments.length; i++) { - parser.walkExpression(expr.arguments[i]); - } - return true; - } else { - hotAcceptWithoutCallback.call(expr, requests); - return true; - } - } - } - parser.walkExpressions(expr.arguments); - return true; - }; - }; - - const createDeclineHandler = (parser, ParamDependency) => expr => { - const module = parser.state.module; - const dep = new ConstDependency( - `${module.moduleArgument}.hot.decline`, - expr.callee.range, - runtimeRequirements - ); - dep.loc = expr.loc; - module.addPresentationalDependency(dep); - module.buildInfo.moduleConcatenationBailout = "Hot Module Replacement"; - if (expr.arguments.length === 1) { - const arg = parser.evaluateExpression(expr.arguments[0]); - let params = []; - if (arg.isString()) { - params = [arg]; - } else if (arg.isArray()) { - params = arg.items.filter(param => param.isString()); - } - params.forEach((param, idx) => { - const dep = new ParamDependency(param.string, param.range); - dep.optional = true; - dep.loc = Object.create(expr.loc); - dep.loc.index = idx; - module.addDependency(dep); - }); - } - return true; - }; - - const createHMRExpressionHandler = parser => expr => { - const module = parser.state.module; - const dep = new ConstDependency( - `${module.moduleArgument}.hot`, - expr.range, - runtimeRequirements - ); - dep.loc = expr.loc; - module.addPresentationalDependency(dep); - module.buildInfo.moduleConcatenationBailout = "Hot Module Replacement"; - return true; - }; - - const applyModuleHot = parser => { - parser.hooks.evaluateIdentifier.for("module.hot").tap( - { - name: "HotModuleReplacementPlugin", - before: "NodeStuffPlugin" - }, - expr => { - return evaluateToIdentifier( - "module.hot", - "module", - () => ["hot"], - true - )(expr); - } - ); - parser.hooks.call - .for("module.hot.accept") - .tap( - "HotModuleReplacementPlugin", - createAcceptHandler(parser, ModuleHotAcceptDependency) - ); - parser.hooks.call - .for("module.hot.decline") - .tap( - "HotModuleReplacementPlugin", - createDeclineHandler(parser, ModuleHotDeclineDependency) - ); - parser.hooks.expression - .for("module.hot") - .tap("HotModuleReplacementPlugin", createHMRExpressionHandler(parser)); - }; + if (localOptions.global !== false) { + const withWarning = localOptions.global === "warn"; + parser.hooks.expression + .for("global") + .tap("NodeStuffPlugin", expr => { + const dep = new ConstDependency( + RuntimeGlobals.global, + expr.range, + [RuntimeGlobals.global] + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); - const applyImportMetaHot = parser => { - parser.hooks.evaluateIdentifier - .for("import.meta.webpackHot") - .tap("HotModuleReplacementPlugin", expr => { - return evaluateToIdentifier( - "import.meta.webpackHot", - "import.meta", - () => ["webpackHot"], - true - )(expr); - }); - parser.hooks.call - .for("import.meta.webpackHot.accept") - .tap( - "HotModuleReplacementPlugin", - createAcceptHandler(parser, ImportMetaHotAcceptDependency) - ); - parser.hooks.call - .for("import.meta.webpackHot.decline") - .tap( - "HotModuleReplacementPlugin", - createDeclineHandler(parser, ImportMetaHotDeclineDependency) - ); - parser.hooks.expression - .for("import.meta.webpackHot") - .tap("HotModuleReplacementPlugin", createHMRExpressionHandler(parser)); - }; + // TODO webpack 6 remove + if (withWarning) { + parser.state.module.addWarning( + new NodeStuffInWebError( + dep.loc, + "global", + "The global namespace object is Node.js feature and doesn't present in browser." + ) + ); + } + }); + } - compiler.hooks.compilation.tap( - "HotModuleReplacementPlugin", - (compilation, { normalModuleFactory }) => { - // This applies the HMR plugin only to the targeted compiler - // It should not affect child compilations - if (compilation.compiler !== compiler) return; + const setModuleConstant = (expressionName, fn, warning) => { + parser.hooks.expression + .for(expressionName) + .tap("NodeStuffPlugin", expr => { + const dep = new CachedConstDependency( + JSON.stringify(fn(parser.state.module)), + expr.range, + expressionName + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); - //#region module.hot.* API - compilation.dependencyFactories.set( - ModuleHotAcceptDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - ModuleHotAcceptDependency, - new ModuleHotAcceptDependency.Template() - ); - compilation.dependencyFactories.set( - ModuleHotDeclineDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - ModuleHotDeclineDependency, - new ModuleHotDeclineDependency.Template() - ); - //#endregion + // TODO webpack 6 remove + if (warning) { + parser.state.module.addWarning( + new NodeStuffInWebError(dep.loc, expressionName, warning) + ); + } - //#region import.meta.webpackHot.* API - compilation.dependencyFactories.set( - ImportMetaHotAcceptDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - ImportMetaHotAcceptDependency, - new ImportMetaHotAcceptDependency.Template() - ); - compilation.dependencyFactories.set( - ImportMetaHotDeclineDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - ImportMetaHotDeclineDependency, - new ImportMetaHotDeclineDependency.Template() - ); - //#endregion + return true; + }); + }; - let hotIndex = 0; - const fullHashChunkModuleHashes = {}; - const chunkModuleHashes = {}; + const setConstant = (expressionName, value, warning) => + setModuleConstant(expressionName, () => value, warning); - compilation.hooks.record.tap( - "HotModuleReplacementPlugin", - (compilation, records) => { - if (records.hash === compilation.hash) return; - const chunkGraph = compilation.chunkGraph; - records.hash = compilation.hash; - records.hotIndex = hotIndex; - records.fullHashChunkModuleHashes = fullHashChunkModuleHashes; - records.chunkModuleHashes = chunkModuleHashes; - records.chunkHashes = {}; - records.chunkRuntime = {}; - for (const chunk of compilation.chunks) { - records.chunkHashes[chunk.id] = chunk.hash; - records.chunkRuntime[chunk.id] = getRuntimeKey(chunk.runtime); - } - records.chunkModuleIds = {}; - for (const chunk of compilation.chunks) { - records.chunkModuleIds[chunk.id] = Array.from( - chunkGraph.getOrderedChunkModulesIterable( - chunk, - compareModulesById(chunkGraph) - ), - m => chunkGraph.getModuleId(m) - ); + const context = compiler.context; + if (localOptions.__filename) { + switch (localOptions.__filename) { + case "mock": + setConstant("__filename", "/index.js"); + break; + case "warn-mock": + setConstant( + "__filename", + "/index.js", + "The __filename is Node.js feature and doesn't present in browser." + ); + break; + case true: + setModuleConstant("__filename", module => + relative(compiler.inputFileSystem, context, module.resource) + ); + break; } + + parser.hooks.evaluateIdentifier + .for("__filename") + .tap("NodeStuffPlugin", expr => { + if (!parser.state.module) return; + const resource = parseResource(parser.state.module.resource); + return evaluateToString(resource.path)(expr); + }); } - ); - /** @type {TupleSet<[Module, Chunk]>} */ - const updatedModules = new TupleSet(); - /** @type {TupleSet<[Module, Chunk]>} */ - const fullHashModules = new TupleSet(); - /** @type {TupleSet<[Module, RuntimeSpec]>} */ - const nonCodeGeneratedModules = new TupleSet(); - compilation.hooks.fullHash.tap("HotModuleReplacementPlugin", hash => { - const chunkGraph = compilation.chunkGraph; - const records = compilation.records; - for (const chunk of compilation.chunks) { - const getModuleHash = module => { - if ( - compilation.codeGenerationResults.has(module, chunk.runtime) - ) { - return compilation.codeGenerationResults.getHash( - module, - chunk.runtime + if (localOptions.__dirname) { + switch (localOptions.__dirname) { + case "mock": + setConstant("__dirname", "/"); + break; + case "warn-mock": + setConstant( + "__dirname", + "/", + "The __dirname is Node.js feature and doesn't present in browser." ); - } else { - nonCodeGeneratedModules.add(module, chunk.runtime); - return chunkGraph.getModuleHash(module, chunk.runtime); - } - }; - const fullHashModulesInThisChunk = - chunkGraph.getChunkFullHashModulesSet(chunk); - if (fullHashModulesInThisChunk !== undefined) { - for (const module of fullHashModulesInThisChunk) { - fullHashModules.add(module, chunk); - } - } - const modules = chunkGraph.getChunkModulesIterable(chunk); - if (modules !== undefined) { - if (records.chunkModuleHashes) { - if (fullHashModulesInThisChunk !== undefined) { - for (const module of modules) { - const key = `${chunk.id}|${module.identifier()}`; - const hash = getModuleHash(module); - if ( - fullHashModulesInThisChunk.has( - /** @type {RuntimeModule} */ (module) - ) - ) { - if (records.fullHashChunkModuleHashes[key] !== hash) { - updatedModules.add(module, chunk); - } - fullHashChunkModuleHashes[key] = hash; - } else { - if (records.chunkModuleHashes[key] !== hash) { - updatedModules.add(module, chunk); - } - chunkModuleHashes[key] = hash; - } - } - } else { - for (const module of modules) { - const key = `${chunk.id}|${module.identifier()}`; - const hash = getModuleHash(module); - if (records.chunkModuleHashes[key] !== hash) { - updatedModules.add(module, chunk); - } - chunkModuleHashes[key] = hash; - } - } - } else { - if (fullHashModulesInThisChunk !== undefined) { - for (const module of modules) { - const key = `${chunk.id}|${module.identifier()}`; - const hash = getModuleHash(module); - if ( - fullHashModulesInThisChunk.has( - /** @type {RuntimeModule} */ (module) - ) - ) { - fullHashChunkModuleHashes[key] = hash; - } else { - chunkModuleHashes[key] = hash; - } - } - } else { - for (const module of modules) { - const key = `${chunk.id}|${module.identifier()}`; - const hash = getModuleHash(module); - chunkModuleHashes[key] = hash; - } - } - } + break; + case true: + setModuleConstant("__dirname", module => + relative(compiler.inputFileSystem, context, module.context) + ); + break; } + + parser.hooks.evaluateIdentifier + .for("__dirname") + .tap("NodeStuffPlugin", expr => { + if (!parser.state.module) return; + return evaluateToString(parser.state.module.context)(expr); + }); } + parser.hooks.expression + .for("require.extensions") + .tap( + "NodeStuffPlugin", + expressionIsUnsupported( + parser, + "require.extensions is not supported by webpack. Use a loader instead." + ) + ); + }; - hotIndex = records.hotIndex || 0; - if (updatedModules.size > 0) hotIndex++; + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("NodeStuffPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("NodeStuffPlugin", handler); + } + ); + } +} - hash.update(`${hotIndex}`); - }); - compilation.hooks.processAssets.tap( - { - name: "HotModuleReplacementPlugin", - stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL - }, - () => { - const chunkGraph = compilation.chunkGraph; - const records = compilation.records; - if (records.hash === compilation.hash) return; - if ( - !records.chunkModuleHashes || - !records.chunkHashes || - !records.chunkModuleIds - ) { - return; - } - for (const [module, chunk] of fullHashModules) { - const key = `${chunk.id}|${module.identifier()}`; - const hash = nonCodeGeneratedModules.has(module, chunk.runtime) - ? chunkGraph.getModuleHash(module, chunk.runtime) - : compilation.codeGenerationResults.getHash( - module, - chunk.runtime - ); - if (records.chunkModuleHashes[key] !== hash) { - updatedModules.add(module, chunk); - } - chunkModuleHashes[key] = hash; - } +module.exports = NodeStuffPlugin; - /** @type {Map, removedChunkIds: Set, removedModules: Set, filename: string, assetInfo: AssetInfo }>} */ - const hotUpdateMainContentByRuntime = new Map(); - let allOldRuntime; - for (const key of Object.keys(records.chunkRuntime)) { - const runtime = keyToRuntime(records.chunkRuntime[key]); - allOldRuntime = mergeRuntimeOwned(allOldRuntime, runtime); - } - forEachRuntime(allOldRuntime, runtime => { - const { path: filename, info: assetInfo } = - compilation.getPathWithInfo( - compilation.outputOptions.hotUpdateMainFilename, - { - hash: records.hash, - runtime - } - ); - hotUpdateMainContentByRuntime.set(runtime, { - updatedChunkIds: new Set(), - removedChunkIds: new Set(), - removedModules: new Set(), - filename, - assetInfo - }); - }); - if (hotUpdateMainContentByRuntime.size === 0) return; - // Create a list of all active modules to verify which modules are removed completely - /** @type {Map} */ - const allModules = new Map(); - for (const module of compilation.modules) { - const id = chunkGraph.getModuleId(module); - allModules.set(id, module); - } +/***/ }), - // List of completely removed modules - /** @type {Set} */ - const completelyRemovedModules = new Set(); +/***/ 39: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - for (const key of Object.keys(records.chunkHashes)) { - const oldRuntime = keyToRuntime(records.chunkRuntime[key]); - /** @type {Module[]} */ - const remainingModules = []; - // Check which modules are removed - for (const id of records.chunkModuleIds[key]) { - const module = allModules.get(id); - if (module === undefined) { - completelyRemovedModules.add(id); - } else { - remainingModules.push(module); - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - let chunkId; - let newModules; - let newRuntimeModules; - let newFullHashModules; - let newDependentHashModules; - let newRuntime; - let removedFromRuntime; - const currentChunk = find( - compilation.chunks, - chunk => `${chunk.id}` === key - ); - if (currentChunk) { - chunkId = currentChunk.id; - newRuntime = intersectRuntime( - currentChunk.runtime, - allOldRuntime - ); - if (newRuntime === undefined) continue; - newModules = chunkGraph - .getChunkModules(currentChunk) - .filter(module => updatedModules.has(module, currentChunk)); - newRuntimeModules = Array.from( - chunkGraph.getChunkRuntimeModulesIterable(currentChunk) - ).filter(module => updatedModules.has(module, currentChunk)); - const fullHashModules = - chunkGraph.getChunkFullHashModulesIterable(currentChunk); - newFullHashModules = - fullHashModules && - Array.from(fullHashModules).filter(module => - updatedModules.has(module, currentChunk) - ); - const dependentHashModules = - chunkGraph.getChunkDependentHashModulesIterable(currentChunk); - newDependentHashModules = - dependentHashModules && - Array.from(dependentHashModules).filter(module => - updatedModules.has(module, currentChunk) - ); - removedFromRuntime = subtractRuntime(oldRuntime, newRuntime); - } else { - // chunk has completely removed - chunkId = `${+key}` === key ? +key : key; - removedFromRuntime = oldRuntime; - newRuntime = oldRuntime; - } - if (removedFromRuntime) { - // chunk was removed from some runtimes - forEachRuntime(removedFromRuntime, runtime => { - hotUpdateMainContentByRuntime - .get(runtime) - .removedChunkIds.add(chunkId); - }); - // dispose modules from the chunk in these runtimes - // where they are no longer in this runtime - for (const module of remainingModules) { - const moduleKey = `${key}|${module.identifier()}`; - const oldHash = records.chunkModuleHashes[moduleKey]; - const runtimes = chunkGraph.getModuleRuntimes(module); - if (oldRuntime === newRuntime && runtimes.has(newRuntime)) { - // Module is still in the same runtime combination - const hash = nonCodeGeneratedModules.has(module, newRuntime) - ? chunkGraph.getModuleHash(module, newRuntime) - : compilation.codeGenerationResults.getHash( - module, - newRuntime - ); - if (hash !== oldHash) { - if (module.type === "runtime") { - newRuntimeModules = newRuntimeModules || []; - newRuntimeModules.push( - /** @type {RuntimeModule} */ (module) - ); - } else { - newModules = newModules || []; - newModules.push(module); - } - } - } else { - // module is no longer in this runtime combination - // We (incorrectly) assume that it's not in an overlapping runtime combination - // and dispose it from the main runtimes the chunk was removed from - forEachRuntime(removedFromRuntime, runtime => { - // If the module is still used in this runtime, do not dispose it - // This could create a bad runtime state where the module is still loaded, - // but no chunk which contains it. This means we don't receive further HMR updates - // to this module and that's bad. - // TODO force load one of the chunks which contains the module - for (const moduleRuntime of runtimes) { - if (typeof moduleRuntime === "string") { - if (moduleRuntime === runtime) return; - } else if (moduleRuntime !== undefined) { - if (moduleRuntime.has(runtime)) return; - } - } - hotUpdateMainContentByRuntime - .get(runtime) - .removedModules.add(module); - }); - } - } - } - if ( - (newModules && newModules.length > 0) || - (newRuntimeModules && newRuntimeModules.length > 0) - ) { - const hotUpdateChunk = new HotUpdateChunk(); - if (backCompat) - ChunkGraph.setChunkGraphForChunk(hotUpdateChunk, chunkGraph); - hotUpdateChunk.id = chunkId; - hotUpdateChunk.runtime = newRuntime; - if (currentChunk) { - for (const group of currentChunk.groupsIterable) - hotUpdateChunk.addGroup(group); - } - chunkGraph.attachModules(hotUpdateChunk, newModules || []); - chunkGraph.attachRuntimeModules( - hotUpdateChunk, - newRuntimeModules || [] - ); - if (newFullHashModules) { - chunkGraph.attachFullHashModules( - hotUpdateChunk, - newFullHashModules - ); - } - if (newDependentHashModules) { - chunkGraph.attachDependentHashModules( - hotUpdateChunk, - newDependentHashModules - ); - } - const renderManifest = compilation.getRenderManifest({ - chunk: hotUpdateChunk, - hash: records.hash, - fullHash: records.hash, - outputOptions: compilation.outputOptions, - moduleTemplates: compilation.moduleTemplates, - dependencyTemplates: compilation.dependencyTemplates, - codeGenerationResults: compilation.codeGenerationResults, - runtimeTemplate: compilation.runtimeTemplate, - moduleGraph: compilation.moduleGraph, - chunkGraph - }); - for (const entry of renderManifest) { - /** @type {string} */ - let filename; - /** @type {AssetInfo} */ - let assetInfo; - if ("filename" in entry) { - filename = entry.filename; - assetInfo = entry.info; - } else { - ({ path: filename, info: assetInfo } = - compilation.getPathWithInfo( - entry.filenameTemplate, - entry.pathOptions - )); - } - const source = entry.render(); - compilation.additionalChunkAssets.push(filename); - compilation.emitAsset(filename, source, { - hotModuleReplacement: true, - ...assetInfo - }); - if (currentChunk) { - currentChunk.files.add(filename); - compilation.hooks.chunkAsset.call(currentChunk, filename); - } - } - forEachRuntime(newRuntime, runtime => { - hotUpdateMainContentByRuntime - .get(runtime) - .updatedChunkIds.add(chunkId); - }); - } - } - const completelyRemovedModulesArray = Array.from( - completelyRemovedModules - ); - const hotUpdateMainContentByFilename = new Map(); - for (const { - removedChunkIds, - removedModules, - updatedChunkIds, - filename, - assetInfo - } of hotUpdateMainContentByRuntime.values()) { - const old = hotUpdateMainContentByFilename.get(filename); - if ( - old && - (!isSubset(old.removedChunkIds, removedChunkIds) || - !isSubset(old.removedModules, removedModules) || - !isSubset(old.updatedChunkIds, updatedChunkIds)) - ) { - compilation.warnings.push( - new WebpackError(`HotModuleReplacementPlugin -The configured output.hotUpdateMainFilename doesn't lead to unique filenames per runtime and HMR update differs between runtimes. -This might lead to incorrect runtime behavior of the applied update. -To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename option, or use the default config.`) - ); - for (const chunkId of removedChunkIds) - old.removedChunkIds.add(chunkId); - for (const chunkId of removedModules) - old.removedModules.add(chunkId); - for (const chunkId of updatedChunkIds) - old.updatedChunkIds.add(chunkId); - continue; - } - hotUpdateMainContentByFilename.set(filename, { - removedChunkIds, - removedModules, - updatedChunkIds, - assetInfo - }); - } - for (const [ - filename, - { removedChunkIds, removedModules, updatedChunkIds, assetInfo } - ] of hotUpdateMainContentByFilename) { - const hotUpdateMainJson = { - c: Array.from(updatedChunkIds), - r: Array.from(removedChunkIds), - m: - removedModules.size === 0 - ? completelyRemovedModulesArray - : completelyRemovedModulesArray.concat( - Array.from(removedModules, m => - chunkGraph.getModuleId(m) - ) - ) - }; - - const source = new RawSource(JSON.stringify(hotUpdateMainJson)); - compilation.emitAsset(filename, source, { - hotModuleReplacement: true, - ...assetInfo - }); - } - } - ); - - compilation.hooks.additionalTreeRuntimeRequirements.tap( - "HotModuleReplacementPlugin", - (chunk, runtimeRequirements) => { - runtimeRequirements.add(RuntimeGlobals.hmrDownloadManifest); - runtimeRequirements.add(RuntimeGlobals.hmrDownloadUpdateHandlers); - runtimeRequirements.add(RuntimeGlobals.interceptModuleExecution); - runtimeRequirements.add(RuntimeGlobals.moduleCache); - compilation.addRuntimeModule( - chunk, - new HotModuleReplacementRuntimeModule() - ); - } - ); - - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("HotModuleReplacementPlugin", parser => { - applyModuleHot(parser); - applyImportMetaHot(parser); - }); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("HotModuleReplacementPlugin", parser => { - applyModuleHot(parser); - }); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("HotModuleReplacementPlugin", parser => { - applyImportMetaHot(parser); - }); - - NormalModule.getCompilationHooks(compilation).loader.tap( - "HotModuleReplacementPlugin", - context => { - context.hot = true; - } - ); - } - ); - } -} - -module.exports = HotModuleReplacementPlugin; - - -/***/ }), - -/***/ 9597: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +const parseJson = __webpack_require__(15235); +const { getContext, runLoaders } = __webpack_require__(8255); +const querystring = __webpack_require__(63477); +const { HookMap, SyncHook, AsyncSeriesBailHook } = __webpack_require__(6967); +const { + CachedSource, + OriginalSource, + RawSource, + SourceMapSource +} = __webpack_require__(51255); +const Compilation = __webpack_require__(85720); +const HookWebpackError = __webpack_require__(11351); +const Module = __webpack_require__(73208); +const ModuleBuildError = __webpack_require__(21305); +const ModuleError = __webpack_require__(23744); +const ModuleGraphConnection = __webpack_require__(40639); +const ModuleParseError = __webpack_require__(58443); +const ModuleWarning = __webpack_require__(11234); +const RuntimeGlobals = __webpack_require__(16475); +const UnhandledSchemeError = __webpack_require__(68099); +const WebpackError = __webpack_require__(53799); +const formatLocation = __webpack_require__(16734); +const LazySet = __webpack_require__(38938); +const { isSubset } = __webpack_require__(93347); +const { getScheme } = __webpack_require__(54500); +const { + compareLocations, + concatComparators, + compareSelect, + keepOriginalOrder +} = __webpack_require__(29579); +const createHash = __webpack_require__(49835); +const { createFakeHook } = __webpack_require__(64518); +const { join } = __webpack_require__(17139); +const { + contextify, + absolutify, + makePathsRelative +} = __webpack_require__(82186); +const makeSerializable = __webpack_require__(33032); +const memoize = __webpack_require__(78676); -const Chunk = __webpack_require__(39385); - +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/LoaderContext").NormalModuleLoaderContext} NormalModuleLoaderContext */ +/** @typedef {import("../declarations/WebpackOptions").Mode} Mode */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ /** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Generator")} Generator */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("./Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ +/** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ +/** @typedef {import("./Parser")} Parser */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./logging/Logger").Logger} WebpackLogger */ /** @typedef {import("./util/Hash")} Hash */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ -class HotUpdateChunk extends Chunk { - constructor() { - super(); - } -} - -module.exports = HotUpdateChunk; - - -/***/ }), - -/***/ 3: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ +/** + * @typedef {Object} SourceMap + * @property {number} version + * @property {string[]} sources + * @property {string} mappings + * @property {string=} file + * @property {string=} sourceRoot + * @property {string[]=} sourcesContent + * @property {string[]=} names + */ +const getInvalidDependenciesModuleWarning = memoize(() => + __webpack_require__(68257) +); +const getValidate = memoize(() => (__webpack_require__(38476).validate)); +const ABSOLUTE_PATH_REGEX = /^([a-zA-Z]:\\|\\\\|\/)/; -const ModuleFactory = __webpack_require__(51010); +/** + * @typedef {Object} LoaderItem + * @property {string} loader + * @property {any} options + * @property {string?} ident + * @property {string?} type + */ -/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ -/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ -/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ +/** + * @param {string} context absolute context path + * @param {string} source a source path + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {string} new source path + */ +const contextifySourceUrl = (context, source, associatedObjectForCache) => { + if (source.startsWith("webpack://")) return source; + return `webpack://${makePathsRelative( + context, + source, + associatedObjectForCache + )}`; +}; /** - * Ignores error when module is unresolved + * @param {string} context absolute context path + * @param {SourceMap} sourceMap a source map + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {SourceMap} new source map */ -class IgnoreErrorModuleFactory extends ModuleFactory { - /** - * @param {NormalModuleFactory} normalModuleFactory normalModuleFactory instance - */ - constructor(normalModuleFactory) { - super(); +const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => { + if (!Array.isArray(sourceMap.sources)) return sourceMap; + const { sourceRoot } = sourceMap; + /** @type {function(string): string} */ + const mapper = !sourceRoot + ? source => source + : sourceRoot.endsWith("/") + ? source => + source.startsWith("/") + ? `${sourceRoot.slice(0, -1)}${source}` + : `${sourceRoot}${source}` + : source => + source.startsWith("/") + ? `${sourceRoot}${source}` + : `${sourceRoot}/${source}`; + const newSources = sourceMap.sources.map(source => + contextifySourceUrl(context, mapper(source), associatedObjectForCache) + ); + return { + ...sourceMap, + file: "x", + sourceRoot: undefined, + sources: newSources + }; +}; - this.normalModuleFactory = normalModuleFactory; +/** + * @param {string | Buffer} input the input + * @returns {string} the converted string + */ +const asString = input => { + if (Buffer.isBuffer(input)) { + return input.toString("utf-8"); } + return input; +}; - /** - * @param {ModuleFactoryCreateData} data data object - * @param {function(Error=, ModuleFactoryResult=): void} callback callback - * @returns {void} - */ - create(data, callback) { - this.normalModuleFactory.create(data, (err, result) => { - return callback(null, result); - }); +/** + * @param {string | Buffer} input the input + * @returns {Buffer} the converted buffer + */ +const asBuffer = input => { + if (!Buffer.isBuffer(input)) { + return Buffer.from(input, "utf-8"); } -} - -module.exports = IgnoreErrorModuleFactory; - - -/***/ }), - -/***/ 84808: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + return input; +}; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +class NonErrorEmittedError extends WebpackError { + constructor(error) { + super(); + this.name = "NonErrorEmittedError"; + this.message = "(Emitted value instead of an instance of Error) " + error; + } +} +makeSerializable( + NonErrorEmittedError, + "webpack/lib/NormalModule", + "NonErrorEmittedError" +); -const createSchemaValidation = __webpack_require__(32540); +/** + * @typedef {Object} NormalModuleCompilationHooks + * @property {SyncHook<[object, NormalModule]>} loader + * @property {SyncHook<[LoaderItem[], NormalModule, object]>} beforeLoaders + * @property {SyncHook<[NormalModule]>} beforeParse + * @property {SyncHook<[NormalModule]>} beforeSnapshot + * @property {HookMap>} readResourceForScheme + * @property {HookMap>} readResource + * @property {AsyncSeriesBailHook<[NormalModule, NeedBuildContext], boolean>} needBuild + */ -/** @typedef {import("../declarations/plugins/IgnorePlugin").IgnorePluginOptions} IgnorePluginOptions */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./NormalModuleFactory").ResolveData} ResolveData */ +/** @type {WeakMap} */ +const compilationHooksMap = new WeakMap(); -const validate = createSchemaValidation( - __webpack_require__(20858), - () => __webpack_require__(3098), - { - name: "Ignore Plugin", - baseDataPath: "options" +class NormalModule extends Module { + /** + * @param {Compilation} compilation the compilation + * @returns {NormalModuleCompilationHooks} the attached hooks + */ + static getCompilationHooks(compilation) { + if (!(compilation instanceof Compilation)) { + throw new TypeError( + "The 'compilation' argument must be an instance of Compilation" + ); + } + let hooks = compilationHooksMap.get(compilation); + if (hooks === undefined) { + hooks = { + loader: new SyncHook(["loaderContext", "module"]), + beforeLoaders: new SyncHook(["loaders", "module", "loaderContext"]), + beforeParse: new SyncHook(["module"]), + beforeSnapshot: new SyncHook(["module"]), + // TODO webpack 6 deprecate + readResourceForScheme: new HookMap(scheme => { + const hook = hooks.readResource.for(scheme); + return createFakeHook( + /** @type {AsyncSeriesBailHook<[string, NormalModule], string | Buffer>} */ ({ + tap: (options, fn) => + hook.tap(options, loaderContext => + fn(loaderContext.resource, loaderContext._module) + ), + tapAsync: (options, fn) => + hook.tapAsync(options, (loaderContext, callback) => + fn(loaderContext.resource, loaderContext._module, callback) + ), + tapPromise: (options, fn) => + hook.tapPromise(options, loaderContext => + fn(loaderContext.resource, loaderContext._module) + ) + }) + ); + }), + readResource: new HookMap( + () => new AsyncSeriesBailHook(["loaderContext"]) + ), + needBuild: new AsyncSeriesBailHook(["module", "context"]) + }; + compilationHooksMap.set(compilation, hooks); + } + return hooks; } -); -class IgnorePlugin { /** - * @param {IgnorePluginOptions} options IgnorePlugin options + * @param {Object} options options object + * @param {string=} options.layer an optional layer in which the module is + * @param {string} options.type module type + * @param {string} options.request request string + * @param {string} options.userRequest request intended by user (without loaders from config) + * @param {string} options.rawRequest request without resolving + * @param {LoaderItem[]} options.loaders list of loaders + * @param {string} options.resource path + query of the real resource + * @param {Record=} options.resourceResolveData resource resolve data + * @param {string} options.context context directory for resolving + * @param {string | undefined} options.matchResource path + query of the matched resource (virtual) + * @param {Parser} options.parser the parser used + * @param {object} options.parserOptions the options of the parser used + * @param {Generator} options.generator the generator used + * @param {object} options.generatorOptions the options of the generator used + * @param {Object} options.resolveOptions options used for resolving requests from this module */ - constructor(options) { - validate(options); - this.options = options; + constructor({ + layer, + type, + request, + userRequest, + rawRequest, + loaders, + resource, + resourceResolveData, + context, + matchResource, + parser, + parserOptions, + generator, + generatorOptions, + resolveOptions + }) { + super(type, context || getContext(resource), layer); - /** @private @type {Function} */ - this.checkIgnore = this.checkIgnore.bind(this); + // Info from Factory + /** @type {string} */ + this.request = request; + /** @type {string} */ + this.userRequest = userRequest; + /** @type {string} */ + this.rawRequest = rawRequest; + /** @type {boolean} */ + this.binary = /^(asset|webassembly)\b/.test(type); + /** @type {Parser} */ + this.parser = parser; + this.parserOptions = parserOptions; + /** @type {Generator} */ + this.generator = generator; + this.generatorOptions = generatorOptions; + /** @type {string} */ + this.resource = resource; + this.resourceResolveData = resourceResolveData; + /** @type {string | undefined} */ + this.matchResource = matchResource; + /** @type {LoaderItem[]} */ + this.loaders = loaders; + if (resolveOptions !== undefined) { + // already declared in super class + this.resolveOptions = resolveOptions; + } + + // Info from Build + /** @type {(WebpackError | null)=} */ + this.error = null; + /** @private @type {Source=} */ + this._source = null; + /** @private @type {Map | undefined} **/ + this._sourceSizes = undefined; + /** @private @type {Set} */ + this._sourceTypes = undefined; + + // Cache + this._lastSuccessfulBuildMeta = {}; + this._forceBuild = true; + this._isEvaluatingSideEffects = false; + /** @type {WeakSet | undefined} */ + this._addedSideEffectsBailout = undefined; } /** - * Note that if "contextRegExp" is given, both the "resourceRegExp" - * and "contextRegExp" have to match. - * - * @param {ResolveData} resolveData resolve data - * @returns {false|undefined} returns false when the request should be ignored, otherwise undefined + * @returns {string} a unique identifier of the module */ - checkIgnore(resolveData) { - if ( - "checkResource" in this.options && - this.options.checkResource && - this.options.checkResource(resolveData.request, resolveData.context) - ) { - return false; - } - - if ( - "resourceRegExp" in this.options && - this.options.resourceRegExp && - this.options.resourceRegExp.test(resolveData.request) - ) { - if ("contextRegExp" in this.options && this.options.contextRegExp) { - // if "contextRegExp" is given, - // both the "resourceRegExp" and "contextRegExp" have to match. - if (this.options.contextRegExp.test(resolveData.context)) { - return false; - } + identifier() { + if (this.layer === null) { + if (this.type === "javascript/auto") { + return this.request; } else { - return false; + return `${this.type}|${this.request}`; } + } else { + return `${this.type}|${this.request}|${this.layer}`; } } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module */ - apply(compiler) { - compiler.hooks.normalModuleFactory.tap("IgnorePlugin", nmf => { - nmf.hooks.beforeResolve.tap("IgnorePlugin", this.checkIgnore); - }); - compiler.hooks.contextModuleFactory.tap("IgnorePlugin", cmf => { - cmf.hooks.beforeResolve.tap("IgnorePlugin", this.checkIgnore); - }); + readableIdentifier(requestShortener) { + return requestShortener.shorten(this.userRequest); } -} - -module.exports = IgnorePlugin; - - -/***/ }), - -/***/ 41606: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** @typedef {import("../declarations/WebpackOptions").IgnoreWarningsNormalized} IgnoreWarningsNormalized */ -/** @typedef {import("./Compiler")} Compiler */ -class IgnoreWarningsPlugin { /** - * @param {IgnoreWarningsNormalized} ignoreWarnings conditions to ignore warnings + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion */ - constructor(ignoreWarnings) { - this._ignoreWarnings = ignoreWarnings; + libIdent(options) { + let ident = contextify( + options.context, + this.userRequest, + options.associatedObjectForCache + ); + if (this.layer) ident = `(${this.layer})/${ident}`; + return ident; } + /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @returns {string | null} absolute path which should be used for condition matching (usually the resource path) */ - apply(compiler) { - compiler.hooks.compilation.tap("IgnoreWarningsPlugin", compilation => { - compilation.hooks.processWarnings.tap( - "IgnoreWarningsPlugin", - warnings => { - return warnings.filter(warning => { - return !this._ignoreWarnings.some(ignore => - ignore(warning, compilation) - ); - }); - } - ); - }); + nameForCondition() { + const resource = this.matchResource || this.resource; + const idx = resource.indexOf("?"); + if (idx >= 0) return resource.substr(0, idx); + return resource; } -} - -module.exports = IgnoreWarningsPlugin; - - -/***/ }), - -/***/ 55870: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent -*/ - - - -const { ConcatSource } = __webpack_require__(51255); -const makeSerializable = __webpack_require__(33032); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("./Generator").GenerateContext} GenerateContext */ - -/** - * @param {InitFragment} fragment the init fragment - * @param {number} index index - * @returns {[InitFragment, number]} tuple with both - */ -const extractFragmentIndex = (fragment, index) => [fragment, index]; - -/** - * @param {[InitFragment, number]} a first pair - * @param {[InitFragment, number]} b second pair - * @returns {number} sort value - */ -const sortFragmentWithIndex = ([a, i], [b, j]) => { - const stageCmp = a.stage - b.stage; - if (stageCmp !== 0) return stageCmp; - const positionCmp = a.position - b.position; - if (positionCmp !== 0) return positionCmp; - return i - j; -}; -/** - * @template Context - */ -class InitFragment { /** - * @param {string|Source} content the source code that will be included as initialization code - * @param {number} stage category of initialization code (contribute to order) - * @param {number} position position in the category (contribute to order) - * @param {string=} key unique key to avoid emitting the same initialization code twice - * @param {string|Source=} endContent the source code that will be included at the end of the module + * Assuming this module is in the cache. Update the (cached) module with + * the fresh module from the factory. Usually updates internal references + * and properties. + * @param {Module} module fresh module + * @returns {void} */ - constructor(content, stage, position, key, endContent) { - this.content = content; - this.stage = stage; - this.position = position; - this.key = key; - this.endContent = endContent; + updateCacheModule(module) { + super.updateCacheModule(module); + const m = /** @type {NormalModule} */ (module); + this.binary = m.binary; + this.request = m.request; + this.userRequest = m.userRequest; + this.rawRequest = m.rawRequest; + this.parser = m.parser; + this.parserOptions = m.parserOptions; + this.generator = m.generator; + this.generatorOptions = m.generatorOptions; + this.resource = m.resource; + this.resourceResolveData = m.resourceResolveData; + this.context = m.context; + this.matchResource = m.matchResource; + this.loaders = m.loaders; } /** - * @param {Context} context context - * @returns {string|Source} the source code that will be included as initialization code + * Assuming this module is in the cache. Remove internal references to allow freeing some memory. */ - getContent(context) { - return this.content; + cleanupForCache() { + // Make sure to cache types and sizes before cleanup when this module has been built + // They are accessed by the stats and we don't want them to crash after cleanup + // TODO reconsider this for webpack 6 + if (this.buildInfo) { + if (this._sourceTypes === undefined) this.getSourceTypes(); + for (const type of this._sourceTypes) { + this.size(type); + } + } + super.cleanupForCache(); + this.parser = undefined; + this.parserOptions = undefined; + this.generator = undefined; + this.generatorOptions = undefined; } /** - * @param {Context} context context - * @returns {string|Source=} the source code that will be included at the end of the module + * Module should be unsafe cached. Get data that's needed for that. + * This data will be passed to restoreFromUnsafeCache later. + * @returns {object} cached data */ - getEndContent(context) { - return this.endContent; + getUnsafeCacheData() { + const data = super.getUnsafeCacheData(); + data.parserOptions = this.parserOptions; + data.generatorOptions = this.generatorOptions; + return data; } - static addToSource(source, initFragments, context) { - if (initFragments.length > 0) { - // Sort fragments by position. If 2 fragments have the same position, - // use their index. - const sortedFragments = initFragments - .map(extractFragmentIndex) - .sort(sortFragmentWithIndex); + restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory) { + this._restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory); + } - // Deduplicate fragments. If a fragment has no key, it is always included. - const keyedFragments = new Map(); - for (const [fragment] of sortedFragments) { - if (typeof fragment.mergeAll === "function") { - if (!fragment.key) { - throw new Error( - `InitFragment with mergeAll function must have a valid key: ${fragment.constructor.name}` - ); - } - const oldValue = keyedFragments.get(fragment.key); - if (oldValue === undefined) { - keyedFragments.set(fragment.key, fragment); - } else if (Array.isArray(oldValue)) { - oldValue.push(fragment); - } else { - keyedFragments.set(fragment.key, [oldValue, fragment]); - } - continue; - } else if (typeof fragment.merge === "function") { - const oldValue = keyedFragments.get(fragment.key); - if (oldValue !== undefined) { - keyedFragments.set(fragment.key, fragment.merge(oldValue)); - continue; - } - } - keyedFragments.set(fragment.key || Symbol(), fragment); - } + /** + * restore unsafe cache data + * @param {object} unsafeCacheData data from getUnsafeCacheData + * @param {NormalModuleFactory} normalModuleFactory the normal module factory handling the unsafe caching + */ + _restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory) { + super._restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory); + this.parserOptions = unsafeCacheData.parserOptions; + this.parser = normalModuleFactory.getParser(this.type, this.parserOptions); + this.generatorOptions = unsafeCacheData.generatorOptions; + this.generator = normalModuleFactory.getGenerator( + this.type, + this.generatorOptions + ); + // we assume the generator behaves identically and keep cached sourceTypes/Sizes + } - const concatSource = new ConcatSource(); - const endContents = []; - for (let fragment of keyedFragments.values()) { - if (Array.isArray(fragment)) { - fragment = fragment[0].mergeAll(fragment); - } - concatSource.add(fragment.getContent(context)); - const endContent = fragment.getEndContent(context); - if (endContent) { - endContents.push(endContent); - } + /** + * @param {string} context the compilation context + * @param {string} name the asset name + * @param {string} content the content + * @param {string | TODO} sourceMap an optional source map + * @param {Object=} associatedObjectForCache object for caching + * @returns {Source} the created source + */ + createSourceForAsset( + context, + name, + content, + sourceMap, + associatedObjectForCache + ) { + if (sourceMap) { + if ( + typeof sourceMap === "string" && + (this.useSourceMap || this.useSimpleSourceMap) + ) { + return new OriginalSource( + content, + contextifySourceUrl(context, sourceMap, associatedObjectForCache) + ); } - concatSource.add(source); - for (const content of endContents.reverse()) { - concatSource.add(content); + if (this.useSourceMap) { + return new SourceMapSource( + content, + name, + contextifySourceMap(context, sourceMap, associatedObjectForCache) + ); } - return concatSource; - } else { - return source; } - } - - serialize(context) { - const { write } = context; - - write(this.content); - write(this.stage); - write(this.position); - write(this.key); - write(this.endContent); - } - - deserialize(context) { - const { read } = context; - this.content = read(); - this.stage = read(); - this.position = read(); - this.key = read(); - this.endContent = read(); + return new RawSource(content); } -} - -makeSerializable(InitFragment, "webpack/lib/InitFragment"); - -InitFragment.prototype.merge = undefined; - -InitFragment.STAGE_CONSTANTS = 10; -InitFragment.STAGE_ASYNC_BOUNDARY = 20; -InitFragment.STAGE_HARMONY_EXPORTS = 30; -InitFragment.STAGE_HARMONY_IMPORTS = 40; -InitFragment.STAGE_PROVIDES = 50; -InitFragment.STAGE_ASYNC_DEPENDENCIES = 60; -InitFragment.STAGE_ASYNC_HARMONY_IMPORTS = 70; - -module.exports = InitFragment; - - -/***/ }), - -/***/ 68257: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); - -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("./Module")} Module */ - -class InvalidDependenciesModuleWarning extends WebpackError { /** - * @param {Module} module module tied to dependency - * @param {Iterable} deps invalid dependencies + * @param {ResolverWithOptions} resolver a resolver + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {InputFileSystem} fs file system from reading + * @param {NormalModuleCompilationHooks} hooks the hooks + * @returns {NormalModuleLoaderContext} loader context */ - constructor(module, deps) { - const orderedDeps = deps ? Array.from(deps).sort() : []; - const depsList = orderedDeps.map(dep => ` * ${JSON.stringify(dep)}`); - super(`Invalid dependencies have been reported by plugins or loaders for this module. All reported dependencies need to be absolute paths. -Invalid dependencies may lead to broken watching and caching. -As best effort we try to convert all invalid values to absolute paths and converting globs into context dependencies, but this is deprecated behavior. -Loaders: Pass absolute paths to this.addDependency (existing files), this.addMissingDependency (not existing files), and this.addContextDependency (directories). -Plugins: Pass absolute paths to fileDependencies (existing files), missingDependencies (not existing files), and contextDependencies (directories). -Globs: They are not supported. Pass absolute path to the directory as context dependencies. -The following invalid values have been reported: -${depsList.slice(0, 3).join("\n")}${ - depsList.length > 3 ? "\n * and more ..." : "" - }`); + _createLoaderContext(resolver, options, compilation, fs, hooks) { + const { requestShortener } = compilation.runtimeTemplate; + const getCurrentLoaderName = () => { + const currentLoader = this.getCurrentLoader(loaderContext); + if (!currentLoader) return "(not in loader scope)"; + return requestShortener.shorten(currentLoader.loader); + }; + const getResolveContext = () => { + return { + fileDependencies: { + add: d => loaderContext.addDependency(d) + }, + contextDependencies: { + add: d => loaderContext.addContextDependency(d) + }, + missingDependencies: { + add: d => loaderContext.addMissingDependency(d) + } + }; + }; + const getAbsolutify = memoize(() => + absolutify.bindCache(compilation.compiler.root) + ); + const getAbsolutifyInContext = memoize(() => + absolutify.bindContextCache(this.context, compilation.compiler.root) + ); + const getContextify = memoize(() => + contextify.bindCache(compilation.compiler.root) + ); + const getContextifyInContext = memoize(() => + contextify.bindContextCache(this.context, compilation.compiler.root) + ); + const utils = { + absolutify: (context, request) => { + return context === this.context + ? getAbsolutifyInContext()(request) + : getAbsolutify()(context, request); + }, + contextify: (context, request) => { + return context === this.context + ? getContextifyInContext()(request) + : getContextify()(context, request); + }, + createHash: type => { + return createHash(type || compilation.outputOptions.hashFunction); + } + }; + const loaderContext = { + version: 2, + getOptions: schema => { + const loader = this.getCurrentLoader(loaderContext); - this.name = "InvalidDependenciesModuleWarning"; - this.details = depsList.slice(3).join("\n"); - this.module = module; - } -} + let { options } = loader; -makeSerializable( - InvalidDependenciesModuleWarning, - "webpack/lib/InvalidDependenciesModuleWarning" -); + if (typeof options === "string") { + if (options.substr(0, 1) === "{" && options.substr(-1) === "}") { + try { + options = parseJson(options); + } catch (e) { + throw new Error(`Cannot parse string options: ${e.message}`); + } + } else { + options = querystring.parse(options, "&", "=", { + maxKeys: 0 + }); + } + } -module.exports = InvalidDependenciesModuleWarning; + if (options === null || options === undefined) { + options = {}; + } + if (schema) { + let name = "Loader"; + let baseDataPath = "options"; + let match; + if (schema.title && (match = /^(.+) (.+)$/.exec(schema.title))) { + [, name, baseDataPath] = match; + } + getValidate()(schema, options, { + name, + baseDataPath + }); + } -/***/ }), + return options; + }, + emitWarning: warning => { + if (!(warning instanceof Error)) { + warning = new NonErrorEmittedError(warning); + } + this.addWarning( + new ModuleWarning(warning, { + from: getCurrentLoaderName() + }) + ); + }, + emitError: error => { + if (!(error instanceof Error)) { + error = new NonErrorEmittedError(error); + } + this.addError( + new ModuleError(error, { + from: getCurrentLoaderName() + }) + ); + }, + getLogger: name => { + const currentLoader = this.getCurrentLoader(loaderContext); + return compilation.getLogger(() => + [currentLoader && currentLoader.loader, name, this.identifier()] + .filter(Boolean) + .join("|") + ); + }, + resolve(context, request, callback) { + resolver.resolve({}, context, request, getResolveContext(), callback); + }, + getResolve(options) { + const child = options ? resolver.withOptions(options) : resolver; + return (context, request, callback) => { + if (callback) { + child.resolve({}, context, request, getResolveContext(), callback); + } else { + return new Promise((resolve, reject) => { + child.resolve( + {}, + context, + request, + getResolveContext(), + (err, result) => { + if (err) reject(err); + else resolve(result); + } + ); + }); + } + }; + }, + emitFile: (name, content, sourceMap, assetInfo) => { + if (!this.buildInfo.assets) { + this.buildInfo.assets = Object.create(null); + this.buildInfo.assetsInfo = new Map(); + } + this.buildInfo.assets[name] = this.createSourceForAsset( + options.context, + name, + content, + sourceMap, + compilation.compiler.root + ); + this.buildInfo.assetsInfo.set(name, assetInfo); + }, + addBuildDependency: dep => { + if (this.buildInfo.buildDependencies === undefined) { + this.buildInfo.buildDependencies = new LazySet(); + } + this.buildInfo.buildDependencies.add(dep); + }, + utils, + rootContext: options.context, + webpack: true, + sourceMap: !!this.useSourceMap, + mode: options.mode || "production", + _module: this, + _compilation: compilation, + _compiler: compilation.compiler, + fs: fs + }; -/***/ 52329: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + Object.assign(loaderContext, options.loader); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sergey Melyukov @smelukov -*/ + hooks.loader.call(loaderContext, this); + return loaderContext; + } + getCurrentLoader(loaderContext, index = loaderContext.loaderIndex) { + if ( + this.loaders && + this.loaders.length && + index < this.loaders.length && + index >= 0 && + this.loaders[index] + ) { + return this.loaders[index]; + } + return null; + } -const InnerGraph = __webpack_require__(38988); + /** + * @param {string} context the compilation context + * @param {string | Buffer} content the content + * @param {string | TODO} sourceMap an optional source map + * @param {Object=} associatedObjectForCache object for caching + * @returns {Source} the created source + */ + createSource(context, content, sourceMap, associatedObjectForCache) { + if (Buffer.isBuffer(content)) { + return new RawSource(content); + } -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ + // if there is no identifier return raw source + if (!this.identifier) { + return new RawSource(content); + } + + // from here on we assume we have an identifier + const identifier = this.identifier(); + + if (this.useSourceMap && sourceMap) { + return new SourceMapSource( + content, + contextifySourceUrl(context, identifier, associatedObjectForCache), + contextifySourceMap(context, sourceMap, associatedObjectForCache) + ); + } + + if (this.useSourceMap || this.useSimpleSourceMap) { + return new OriginalSource( + content, + contextifySourceUrl(context, identifier, associatedObjectForCache) + ); + } + + return new RawSource(content); + } -class JavascriptMetaInfoPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {NormalModuleCompilationHooks} hooks the hooks + * @param {function((WebpackError | null)=): void} callback callback function * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap( - "JavascriptMetaInfoPlugin", - (compilation, { normalModuleFactory }) => { - /** - * @param {JavascriptParser} parser the parser - * @returns {void} - */ - const handler = parser => { - parser.hooks.call.for("eval").tap("JavascriptMetaInfoPlugin", () => { - parser.state.module.buildInfo.moduleConcatenationBailout = "eval()"; - parser.state.module.buildInfo.usingEval = true; - const currentSymbol = InnerGraph.getTopLevelSymbol(parser.state); - if (currentSymbol) { - InnerGraph.addUsage(parser.state, null, currentSymbol); - } else { - InnerGraph.bailout(parser.state); - } - }); - parser.hooks.finish.tap("JavascriptMetaInfoPlugin", () => { - let topLevelDeclarations = - parser.state.module.buildInfo.topLevelDeclarations; - if (topLevelDeclarations === undefined) { - topLevelDeclarations = - parser.state.module.buildInfo.topLevelDeclarations = new Set(); - } - for (const name of parser.scope.definitions.asSet()) { - const freeInfo = parser.getFreeInfoFromVariable(name); - if (freeInfo === undefined) { - topLevelDeclarations.add(name); - } - } - }); - }; + _doBuild(options, compilation, resolver, fs, hooks, callback) { + const loaderContext = this._createLoaderContext( + resolver, + options, + compilation, + fs, + hooks + ); - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("JavascriptMetaInfoPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("JavascriptMetaInfoPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("JavascriptMetaInfoPlugin", handler); + const processResult = (err, result) => { + if (err) { + if (!(err instanceof Error)) { + err = new NonErrorEmittedError(err); + } + const currentLoader = this.getCurrentLoader(loaderContext); + const error = new ModuleBuildError(err, { + from: + currentLoader && + compilation.runtimeTemplate.requestShortener.shorten( + currentLoader.loader + ) + }); + return callback(error); } - ); - } -} -module.exports = JavascriptMetaInfoPlugin; + const source = result[0]; + const sourceMap = result.length >= 1 ? result[1] : null; + const extraInfo = result.length >= 2 ? result[2] : null; + if (!Buffer.isBuffer(source) && typeof source !== "string") { + const currentLoader = this.getCurrentLoader(loaderContext, 0); + const err = new Error( + `Final loader (${ + currentLoader + ? compilation.runtimeTemplate.requestShortener.shorten( + currentLoader.loader + ) + : "unknown" + }) didn't return a Buffer or String` + ); + const error = new ModuleBuildError(err); + return callback(error); + } -/***/ }), + this._source = this.createSource( + options.context, + this.binary ? asBuffer(source) : asString(source), + sourceMap, + compilation.compiler.root + ); + if (this._sourceSizes !== undefined) this._sourceSizes.clear(); + this._ast = + typeof extraInfo === "object" && + extraInfo !== null && + extraInfo.webpackAST !== undefined + ? extraInfo.webpackAST + : null; + return callback(); + }; -/***/ 93837: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + this.buildInfo.fileDependencies = new LazySet(); + this.buildInfo.contextDependencies = new LazySet(); + this.buildInfo.missingDependencies = new LazySet(); + this.buildInfo.cacheable = true; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + try { + hooks.beforeLoaders.call(this.loaders, this, loaderContext); + } catch (err) { + processResult(err); + return; + } + + if (this.loaders.length > 0) { + this.buildInfo.buildDependencies = new LazySet(); + } + + runLoaders( + { + resource: this.resource, + loaders: this.loaders, + context: loaderContext, + processResource: (loaderContext, resourcePath, callback) => { + const resource = loaderContext.resource; + const scheme = getScheme(resource); + hooks.readResource + .for(scheme) + .callAsync(loaderContext, (err, result) => { + if (err) return callback(err); + if (typeof result !== "string" && !result) { + return callback(new UnhandledSchemeError(scheme, resource)); + } + return callback(null, result); + }); + } + }, + (err, result) => { + // Cleanup loaderContext to avoid leaking memory in ICs + loaderContext._compilation = + loaderContext._compiler = + loaderContext._module = + loaderContext.fs = + undefined; + if (!result) { + this.buildInfo.cacheable = false; + return processResult( + err || new Error("No result from loader-runner processing"), + null + ); + } + this.buildInfo.fileDependencies.addAll(result.fileDependencies); + this.buildInfo.contextDependencies.addAll(result.contextDependencies); + this.buildInfo.missingDependencies.addAll(result.missingDependencies); + for (const loader of this.loaders) { + this.buildInfo.buildDependencies.add(loader.loader); + } + this.buildInfo.cacheable = this.buildInfo.cacheable && result.cacheable; + processResult(err, result.result); + } + ); + } + /** + * @param {WebpackError} error the error + * @returns {void} + */ + markModuleAsErrored(error) { + // Restore build meta from successful build to keep importing state + this.buildMeta = { ...this._lastSuccessfulBuildMeta }; + this.error = error; + this.addError(error); + } -const asyncLib = __webpack_require__(78175); -const EntryDependency = __webpack_require__(3979); -const { someInIterable } = __webpack_require__(39104); -const { compareModulesById } = __webpack_require__(29579); -const { dirname, mkdirp } = __webpack_require__(17139); + applyNoParseRule(rule, content) { + // must start with "rule" if rule is a string + if (typeof rule === "string") { + return content.startsWith(rule); + } -/** @typedef {import("./Compiler")} Compiler */ + if (typeof rule === "function") { + return rule(content); + } + // we assume rule is a regexp + return rule.test(content); + } -/** - * @typedef {Object} ManifestModuleData - * @property {string | number} id - * @property {Object} buildMeta - * @property {boolean | string[]} exports - */ + // check if module should not be parsed + // returns "true" if the module should !not! be parsed + // returns "false" if the module !must! be parsed + shouldPreventParsing(noParseRule, request) { + // if no noParseRule exists, return false + // the module !must! be parsed. + if (!noParseRule) { + return false; + } -class LibManifestPlugin { - constructor(options) { - this.options = options; + // we only have one rule to check + if (!Array.isArray(noParseRule)) { + // returns "true" if the module is !not! to be parsed + return this.applyNoParseRule(noParseRule, request); + } + + for (let i = 0; i < noParseRule.length; i++) { + const rule = noParseRule[i]; + // early exit on first truthy match + // this module is !not! to be parsed + if (this.applyNoParseRule(rule, request)) { + return true; + } + } + // no match found, so this module !should! be parsed + return false; + } + + _initBuildHash(compilation) { + const hash = createHash(compilation.outputOptions.hashFunction); + if (this._source) { + hash.update("source"); + this._source.updateHash(hash); + } + hash.update("meta"); + hash.update(JSON.stringify(this.buildMeta)); + this.buildInfo.hash = /** @type {string} */ (hash.digest("hex")); } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function * @returns {void} */ - apply(compiler) { - compiler.hooks.emit.tapAsync( - "LibManifestPlugin", - (compilation, callback) => { - const moduleGraph = compilation.moduleGraph; - asyncLib.forEach( - Array.from(compilation.chunks), - (chunk, callback) => { - if (!chunk.canBeInitial()) { - callback(); - return; - } - const chunkGraph = compilation.chunkGraph; - const targetPath = compilation.getPath(this.options.path, { - chunk - }); - const name = - this.options.name && - compilation.getPath(this.options.name, { - chunk - }); - const content = Object.create(null); - for (const module of chunkGraph.getOrderedChunkModulesIterable( - chunk, - compareModulesById(chunkGraph) - )) { - if ( - this.options.entryOnly && - !someInIterable( - moduleGraph.getIncomingConnections(module), - c => c.dependency instanceof EntryDependency - ) - ) { - continue; - } - const ident = module.libIdent({ - context: this.options.context || compiler.options.context, - associatedObjectForCache: compiler.root - }); - if (ident) { - const exportsInfo = moduleGraph.getExportsInfo(module); - const providedExports = exportsInfo.getProvidedExports(); - /** @type {ManifestModuleData} */ - const data = { - id: chunkGraph.getModuleId(module), - buildMeta: module.buildMeta, - exports: Array.isArray(providedExports) - ? providedExports - : undefined - }; - content[ident] = data; - } - } - const manifest = { - name, - type: this.options.type, - content - }; - // Apply formatting to content if format flag is true; - const manifestContent = this.options.format - ? JSON.stringify(manifest, null, 2) - : JSON.stringify(manifest); - const buffer = Buffer.from(manifestContent, "utf8"); - mkdirp( - compiler.intermediateFileSystem, - dirname(compiler.intermediateFileSystem, targetPath), - err => { - if (err) return callback(err); - compiler.intermediateFileSystem.writeFile( - targetPath, - buffer, - callback - ); - } - ); - }, - callback - ); - } - ); - } -} -module.exports = LibManifestPlugin; - - -/***/ }), - -/***/ 14157: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const EnableLibraryPlugin = __webpack_require__(91452); - -/** @typedef {import("../declarations/WebpackOptions").AuxiliaryComment} AuxiliaryComment */ -/** @typedef {import("../declarations/WebpackOptions").LibraryExport} LibraryExport */ -/** @typedef {import("../declarations/WebpackOptions").LibraryName} LibraryName */ -/** @typedef {import("../declarations/WebpackOptions").LibraryType} LibraryType */ -/** @typedef {import("../declarations/WebpackOptions").UmdNamedDefine} UmdNamedDefine */ -/** @typedef {import("./Compiler")} Compiler */ - -// TODO webpack 6 remove -class LibraryTemplatePlugin { - /** - * @param {LibraryName} name name of library - * @param {LibraryType} target type of library - * @param {UmdNamedDefine} umdNamedDefine setting this to true will name the UMD module - * @param {AuxiliaryComment} auxiliaryComment comment in the UMD wrapper - * @param {LibraryExport} exportProperty which export should be exposed as library - */ - constructor(name, target, umdNamedDefine, auxiliaryComment, exportProperty) { - this.library = { - type: target || "var", - name, - umdNamedDefine, - auxiliaryComment, - export: exportProperty + build(options, compilation, resolver, fs, callback) { + this._forceBuild = false; + this._source = null; + if (this._sourceSizes !== undefined) this._sourceSizes.clear(); + this._sourceTypes = undefined; + this._ast = null; + this.error = null; + this.clearWarningsAndErrors(); + this.clearDependenciesAndBlocks(); + this.buildMeta = {}; + this.buildInfo = { + cacheable: false, + parsed: true, + fileDependencies: undefined, + contextDependencies: undefined, + missingDependencies: undefined, + buildDependencies: undefined, + valueDependencies: undefined, + hash: undefined, + assets: undefined, + assetsInfo: undefined }; - } - - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const { output } = compiler.options; - output.library = this.library; - new EnableLibraryPlugin(this.library.type).apply(compiler); - } -} -module.exports = LibraryTemplatePlugin; + const startTime = compilation.compiler.fsStartTime || Date.now(); + const hooks = NormalModule.getCompilationHooks(compilation); -/***/ }), + return this._doBuild(options, compilation, resolver, fs, hooks, err => { + // if we have an error mark module as failed and exit + if (err) { + this.markModuleAsErrored(err); + this._initBuildHash(compilation); + return callback(); + } -/***/ 22078: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + const handleParseError = e => { + const source = this._source.source(); + const loaders = this.loaders.map(item => + contextify(options.context, item.loader, compilation.compiler.root) + ); + const error = new ModuleParseError(source, e, loaders, this.type); + this.markModuleAsErrored(error); + this._initBuildHash(compilation); + return callback(); + }; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const handleParseResult = result => { + this.dependencies.sort( + concatComparators( + compareSelect(a => a.loc, compareLocations), + keepOriginalOrder(this.dependencies) + ) + ); + this._initBuildHash(compilation); + this._lastSuccessfulBuildMeta = this.buildMeta; + return handleBuildDone(); + }; + const handleBuildDone = () => { + try { + hooks.beforeSnapshot.call(this); + } catch (err) { + this.markModuleAsErrored(err); + return callback(); + } + const snapshotOptions = compilation.options.snapshot.module; + if (!this.buildInfo.cacheable || !snapshotOptions) { + return callback(); + } + // add warning for all non-absolute paths in fileDependencies, etc + // This makes it easier to find problems with watching and/or caching + let nonAbsoluteDependencies = undefined; + const checkDependencies = deps => { + for (const dep of deps) { + if (!ABSOLUTE_PATH_REGEX.test(dep)) { + if (nonAbsoluteDependencies === undefined) + nonAbsoluteDependencies = new Set(); + nonAbsoluteDependencies.add(dep); + deps.delete(dep); + try { + const depWithoutGlob = dep.replace(/[\\/]?\*.*$/, ""); + const absolute = join( + compilation.fileSystemInfo.fs, + this.context, + depWithoutGlob + ); + if (absolute !== dep && ABSOLUTE_PATH_REGEX.test(absolute)) { + (depWithoutGlob !== dep + ? this.buildInfo.contextDependencies + : deps + ).add(absolute); + } + } catch (e) { + // ignore + } + } + } + }; + checkDependencies(this.buildInfo.fileDependencies); + checkDependencies(this.buildInfo.missingDependencies); + checkDependencies(this.buildInfo.contextDependencies); + if (nonAbsoluteDependencies !== undefined) { + const InvalidDependenciesModuleWarning = + getInvalidDependenciesModuleWarning(); + this.addWarning( + new InvalidDependenciesModuleWarning(this, nonAbsoluteDependencies) + ); + } + // convert file/context/missingDependencies into filesystem snapshot + compilation.fileSystemInfo.createSnapshot( + startTime, + this.buildInfo.fileDependencies, + this.buildInfo.contextDependencies, + this.buildInfo.missingDependencies, + snapshotOptions, + (err, snapshot) => { + if (err) { + this.markModuleAsErrored(err); + return; + } + this.buildInfo.fileDependencies = undefined; + this.buildInfo.contextDependencies = undefined; + this.buildInfo.missingDependencies = undefined; + this.buildInfo.snapshot = snapshot; + return callback(); + } + ); + }; -const ModuleFilenameHelpers = __webpack_require__(88821); -const NormalModule = __webpack_require__(39); -const createSchemaValidation = __webpack_require__(32540); + try { + hooks.beforeParse.call(this); + } catch (err) { + this.markModuleAsErrored(err); + this._initBuildHash(compilation); + return callback(); + } -/** @typedef {import("../declarations/plugins/LoaderOptionsPlugin").LoaderOptionsPluginOptions} LoaderOptionsPluginOptions */ -/** @typedef {import("./Compiler")} Compiler */ + // check if this module should !not! be parsed. + // if so, exit here; + const noParseRule = options.module && options.module.noParse; + if (this.shouldPreventParsing(noParseRule, this.request)) { + // We assume that we need module and exports + this.buildInfo.parsed = false; + this._initBuildHash(compilation); + return handleBuildDone(); + } -const validate = createSchemaValidation( - __webpack_require__(24160), - () => __webpack_require__(15965), - { - name: "Loader Options Plugin", - baseDataPath: "options" + let result; + try { + const source = this._source.source(); + result = this.parser.parse(this._ast || source, { + source, + current: this, + module: this, + compilation: compilation, + options: options + }); + } catch (e) { + handleParseError(e); + return; + } + handleParseResult(result); + }); } -); -class LoaderOptionsPlugin { + /** - * @param {LoaderOptionsPluginOptions} options options object + * @param {ConcatenationBailoutReasonContext} context context + * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated */ - constructor(options = {}) { - validate(options); - if (typeof options !== "object") options = {}; - if (!options.test) { - options.test = { - test: () => true - }; - } - this.options = options; + getConcatenationBailoutReason(context) { + return this.generator.getConcatenationBailoutReason(this, context); } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this module should be connected to referencing modules when consumed for side-effects only */ - apply(compiler) { - const options = this.options; - compiler.hooks.compilation.tap("LoaderOptionsPlugin", compilation => { - NormalModule.getCompilationHooks(compilation).loader.tap( - "LoaderOptionsPlugin", - (context, module) => { - const resource = module.resource; - if (!resource) return; - const i = resource.indexOf("?"); + getSideEffectsConnectionState(moduleGraph) { + if (this.factoryMeta !== undefined) { + if (this.factoryMeta.sideEffectFree) return false; + if (this.factoryMeta.sideEffectFree === false) return true; + } + if (this.buildMeta !== undefined && this.buildMeta.sideEffectFree) { + if (this._isEvaluatingSideEffects) + return ModuleGraphConnection.CIRCULAR_CONNECTION; + this._isEvaluatingSideEffects = true; + /** @type {ConnectionState} */ + let current = false; + for (const dep of this.dependencies) { + const state = dep.getModuleEvaluationSideEffectsState(moduleGraph); + if (state === true) { if ( - ModuleFilenameHelpers.matchObject( - options, - i < 0 ? resource : resource.substr(0, i) - ) + this._addedSideEffectsBailout === undefined + ? ((this._addedSideEffectsBailout = new WeakSet()), true) + : !this._addedSideEffectsBailout.has(moduleGraph) ) { - for (const key of Object.keys(options)) { - if (key === "include" || key === "exclude" || key === "test") { - continue; - } - context[key] = options[key]; - } + this._addedSideEffectsBailout.add(moduleGraph); + moduleGraph + .getOptimizationBailout(this) + .push( + () => + `Dependency (${ + dep.type + }) with side effects at ${formatLocation(dep.loc)}` + ); } + this._isEvaluatingSideEffects = false; + return true; + } else if (state !== ModuleGraphConnection.CIRCULAR_CONNECTION) { + current = ModuleGraphConnection.addConnectionStates(current, state); } - ); - }); + } + this._isEvaluatingSideEffects = false; + // When caching is implemented here, make sure to not cache when + // at least one circular connection was in the loop above + return current; + } else { + return true; + } } -} - -module.exports = LoaderOptionsPlugin; - -/***/ }), + /** + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + if (this._sourceTypes === undefined) { + this._sourceTypes = this.generator.getTypes(this); + } + return this._sourceTypes; + } -/***/ 86738: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration({ + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtime, + concatenationScope, + codeGenerationResults + }) { + /** @type {Set} */ + const runtimeRequirements = new Set(); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (!this.buildInfo.parsed) { + runtimeRequirements.add(RuntimeGlobals.module); + runtimeRequirements.add(RuntimeGlobals.exports); + runtimeRequirements.add(RuntimeGlobals.thisAsExports); + } + /** @type {Map} */ + let data; + const getData = () => { + if (data === undefined) data = new Map(); + return data; + }; + const sources = new Map(); + for (const type of this.generator.getTypes(this)) { + const source = this.error + ? new RawSource( + "throw new Error(" + JSON.stringify(this.error.message) + ");" + ) + : this.generator.generate(this, { + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtimeRequirements, + runtime, + concatenationScope, + codeGenerationResults, + getData, + type + }); -const NormalModule = __webpack_require__(39); + if (source) { + sources.set(type, new CachedSource(source)); + } + } -/** @typedef {import("./Compiler")} Compiler */ + /** @type {CodeGenerationResult} */ + const resultEntry = { + sources, + runtimeRequirements, + data + }; + return resultEntry; + } -class LoaderTargetPlugin { /** - * @param {string} target the target + * @returns {Source | null} the original source for the module before webpack transformation */ - constructor(target) { - this.target = target; + originalSource() { + return this._source; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap("LoaderTargetPlugin", compilation => { - NormalModule.getCompilationHooks(compilation).loader.tap( - "LoaderTargetPlugin", - loaderContext => { - loaderContext.target = this.target; - } - ); - }); + invalidateBuild() { + this._forceBuild = true; } -} - -module.exports = LoaderTargetPlugin; - - -/***/ }), -/***/ 12856: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + const { fileSystemInfo, compilation, valueCacheVersions } = context; + // build if enforced + if (this._forceBuild) return callback(null, true); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // always try to build in case of an error + if (this.error) return callback(null, true); + // always build when module is not cacheable + if (!this.buildInfo.cacheable) return callback(null, true); + // build when there is no snapshot to check + if (!this.buildInfo.snapshot) return callback(null, true); -const { SyncWaterfallHook } = __webpack_require__(41242); -const util = __webpack_require__(73837); -const RuntimeGlobals = __webpack_require__(16475); -const memoize = __webpack_require__(78676); + // build when valueDependencies have changed + /** @type {Map>} */ + const valueDependencies = this.buildInfo.valueDependencies; + if (valueDependencies) { + if (!valueCacheVersions) return callback(null, true); + for (const [key, value] of valueDependencies) { + if (value === undefined) return callback(null, true); + const current = valueCacheVersions.get(key); + if ( + value !== current && + (typeof value === "string" || + typeof current === "string" || + current === undefined || + !isSubset(value, current)) + ) { + return callback(null, true); + } + } + } -/** @typedef {import("webpack-sources").ConcatSource} ConcatSource */ -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").Output} OutputOptions */ -/** @typedef {import("./ModuleTemplate")} ModuleTemplate */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("./Module")} Module} */ -/** @typedef {import("./util/Hash")} Hash} */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates} */ -/** @typedef {import("./javascript/JavascriptModulesPlugin").RenderContext} RenderContext} */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate} */ -/** @typedef {import("./ModuleGraph")} ModuleGraph} */ -/** @typedef {import("./ChunkGraph")} ChunkGraph} */ -/** @typedef {import("./Template").RenderManifestOptions} RenderManifestOptions} */ -/** @typedef {import("./Template").RenderManifestEntry} RenderManifestEntry} */ + // check snapshot for validity + fileSystemInfo.checkSnapshotValid(this.buildInfo.snapshot, (err, valid) => { + if (err) return callback(err); + if (!valid) return callback(null, true); + const hooks = NormalModule.getCompilationHooks(compilation); + hooks.needBuild.callAsync(this, context, (err, needBuild) => { + if (err) { + return callback( + HookWebpackError.makeWebpackError( + err, + "NormalModule.getCompilationHooks().needBuild" + ) + ); + } + callback(null, !!needBuild); + }); + }); + } -const getJavascriptModulesPlugin = memoize(() => - __webpack_require__(89464) -); -const getJsonpTemplatePlugin = memoize(() => - __webpack_require__(4607) -); -const getLoadScriptRuntimeModule = memoize(() => - __webpack_require__(19942) -); + /** + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + const cachedSize = + this._sourceSizes === undefined ? undefined : this._sourceSizes.get(type); + if (cachedSize !== undefined) { + return cachedSize; + } + const size = Math.max(1, this.generator.getSize(this, type)); + if (this._sourceSizes === undefined) { + this._sourceSizes = new Map(); + } + this._sourceSizes.set(type, size); + return size; + } -// TODO webpack 6 remove this class -class MainTemplate { /** - * - * @param {OutputOptions} outputOptions output options for the MainTemplate - * @param {Compilation} compilation the compilation + * @param {LazySet} fileDependencies set where file dependencies are added to + * @param {LazySet} contextDependencies set where context dependencies are added to + * @param {LazySet} missingDependencies set where missing dependencies are added to + * @param {LazySet} buildDependencies set where build dependencies are added to */ - constructor(outputOptions, compilation) { - /** @type {OutputOptions} */ - this._outputOptions = outputOptions || {}; - this.hooks = Object.freeze({ - renderManifest: { - tap: util.deprecate( - (options, fn) => { - compilation.hooks.renderManifest.tap( - options, - (entries, options) => { - if (!options.chunk.hasRuntime()) return entries; - return fn(entries, options); - } - ); - }, - "MainTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_RENDER_MANIFEST" - ) - }, - modules: { - tap: () => { - throw new Error( - "MainTemplate.hooks.modules has been removed (there is no replacement, please create an issue to request that)" - ); - } - }, - moduleObj: { - tap: () => { - throw new Error( - "MainTemplate.hooks.moduleObj has been removed (there is no replacement, please create an issue to request that)" - ); - } - }, - require: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .renderRequire.tap(options, fn); - }, - "MainTemplate.hooks.require is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderRequire instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_REQUIRE" - ) - }, - beforeStartup: { - tap: () => { - throw new Error( - "MainTemplate.hooks.beforeStartup has been removed (use RuntimeGlobals.startupOnlyBefore instead)" - ); - } - }, - startup: { - tap: () => { - throw new Error( - "MainTemplate.hooks.startup has been removed (use RuntimeGlobals.startup instead)" - ); - } - }, - afterStartup: { - tap: () => { - throw new Error( - "MainTemplate.hooks.afterStartup has been removed (use RuntimeGlobals.startupOnlyAfter instead)" - ); - } - }, - render: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .render.tap(options, (source, renderContext) => { - if ( - renderContext.chunkGraph.getNumberOfEntryModules( - renderContext.chunk - ) === 0 || - !renderContext.chunk.hasRuntime() - ) { - return source; - } - return fn( - source, - renderContext.chunk, - compilation.hash, - compilation.moduleTemplates.javascript, - compilation.dependencyTemplates - ); - }); - }, - "MainTemplate.hooks.render is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_RENDER" - ) - }, - renderWithEntry: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .render.tap(options, (source, renderContext) => { - if ( - renderContext.chunkGraph.getNumberOfEntryModules( - renderContext.chunk - ) === 0 || - !renderContext.chunk.hasRuntime() - ) { - return source; - } - return fn(source, renderContext.chunk, compilation.hash); - }); - }, - "MainTemplate.hooks.renderWithEntry is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_RENDER_WITH_ENTRY" - ) - }, - assetPath: { - tap: util.deprecate( - (options, fn) => { - compilation.hooks.assetPath.tap(options, fn); - }, - "MainTemplate.hooks.assetPath is deprecated (use Compilation.hooks.assetPath instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_ASSET_PATH" - ), - call: util.deprecate( - (filename, options) => { - return compilation.getAssetPath(filename, options); - }, - "MainTemplate.hooks.assetPath is deprecated (use Compilation.hooks.assetPath instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_ASSET_PATH" - ) - }, - hash: { - tap: util.deprecate( - (options, fn) => { - compilation.hooks.fullHash.tap(options, fn); - }, - "MainTemplate.hooks.hash is deprecated (use Compilation.hooks.fullHash instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_HASH" - ) - }, - hashForChunk: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .chunkHash.tap(options, (chunk, hash) => { - if (!chunk.hasRuntime()) return; - return fn(hash, chunk); - }); - }, - "MainTemplate.hooks.hashForChunk is deprecated (use JavascriptModulesPlugin.getCompilationHooks().chunkHash instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK" - ) - }, - globalHashPaths: { - tap: util.deprecate( - () => {}, - "MainTemplate.hooks.globalHashPaths has been removed (it's no longer needed)", - "DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK" - ) - }, - globalHash: { - tap: util.deprecate( - () => {}, - "MainTemplate.hooks.globalHash has been removed (it's no longer needed)", - "DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK" - ) - }, - hotBootstrap: { - tap: () => { - throw new Error( - "MainTemplate.hooks.hotBootstrap has been removed (use your own RuntimeModule instead)" - ); - } - }, + addCacheDependencies( + fileDependencies, + contextDependencies, + missingDependencies, + buildDependencies + ) { + const { snapshot, buildDependencies: buildDeps } = this.buildInfo; + if (snapshot) { + fileDependencies.addAll(snapshot.getFileIterable()); + contextDependencies.addAll(snapshot.getContextIterable()); + missingDependencies.addAll(snapshot.getMissingIterable()); + } else { + const { + fileDependencies: fileDeps, + contextDependencies: contextDeps, + missingDependencies: missingDeps + } = this.buildInfo; + if (fileDeps !== undefined) fileDependencies.addAll(fileDeps); + if (contextDeps !== undefined) contextDependencies.addAll(contextDeps); + if (missingDeps !== undefined) missingDependencies.addAll(missingDeps); + } + if (buildDeps !== undefined) { + buildDependencies.addAll(buildDeps); + } + } - // for compatibility: - /** @type {SyncWaterfallHook<[string, Chunk, string, ModuleTemplate, DependencyTemplates]>} */ - bootstrap: new SyncWaterfallHook([ - "source", - "chunk", - "hash", - "moduleTemplate", - "dependencyTemplates" - ]), - /** @type {SyncWaterfallHook<[string, Chunk, string]>} */ - localVars: new SyncWaterfallHook(["source", "chunk", "hash"]), - /** @type {SyncWaterfallHook<[string, Chunk, string]>} */ - requireExtensions: new SyncWaterfallHook(["source", "chunk", "hash"]), - /** @type {SyncWaterfallHook<[string, Chunk, string, string]>} */ - requireEnsure: new SyncWaterfallHook([ - "source", - "chunk", - "hash", - "chunkIdExpression" - ]), - get jsonpScript() { - const hooks = - getLoadScriptRuntimeModule().getCompilationHooks(compilation); - return hooks.createScript; - }, - get linkPrefetch() { - const hooks = getJsonpTemplatePlugin().getCompilationHooks(compilation); - return hooks.linkPrefetch; - }, - get linkPreload() { - const hooks = getJsonpTemplatePlugin().getCompilationHooks(compilation); - return hooks.linkPreload; - } + /** + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + hash.update(this.buildInfo.hash); + this.generator.updateHash(hash, { + module: this, + ...context }); + super.updateHash(hash, context); + } - this.renderCurrentHashCode = util.deprecate( - /** - * @deprecated - * @param {string} hash the hash - * @param {number=} length length of the hash - * @returns {string} generated code - */ (hash, length) => { - if (length) { - return `${RuntimeGlobals.getFullHash} ? ${ - RuntimeGlobals.getFullHash - }().slice(0, ${length}) : ${hash.slice(0, length)}`; - } - return `${RuntimeGlobals.getFullHash} ? ${RuntimeGlobals.getFullHash}() : ${hash}`; - }, - "MainTemplate.renderCurrentHashCode is deprecated (use RuntimeGlobals.getFullHash runtime function instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_RENDER_CURRENT_HASH_CODE" - ); - - this.getPublicPath = util.deprecate( - /** - * - * @param {object} options get public path options - * @returns {string} hook call - */ options => { - return compilation.getAssetPath( - compilation.outputOptions.publicPath, - options - ); - }, - "MainTemplate.getPublicPath is deprecated (use Compilation.getAssetPath(compilation.outputOptions.publicPath, options) instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_GET_PUBLIC_PATH" - ); + serialize(context) { + const { write } = context; + // deserialize + write(this._source); + write(this.error); + write(this._lastSuccessfulBuildMeta); + write(this._forceBuild); + super.serialize(context); + } - this.getAssetPath = util.deprecate( - (path, options) => { - return compilation.getAssetPath(path, options); - }, - "MainTemplate.getAssetPath is deprecated (use Compilation.getAssetPath instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_GET_ASSET_PATH" - ); + static deserialize(context) { + const obj = new NormalModule({ + // will be deserialized by Module + layer: null, + type: "", + // will be filled by updateCacheModule + resource: "", + context: "", + request: null, + userRequest: null, + rawRequest: null, + loaders: null, + matchResource: null, + parser: null, + parserOptions: null, + generator: null, + generatorOptions: null, + resolveOptions: null + }); + obj.deserialize(context); + return obj; + } - this.getAssetPathWithInfo = util.deprecate( - (path, options) => { - return compilation.getAssetPathWithInfo(path, options); - }, - "MainTemplate.getAssetPathWithInfo is deprecated (use Compilation.getAssetPath instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_GET_ASSET_PATH_WITH_INFO" - ); + deserialize(context) { + const { read } = context; + this._source = read(); + this.error = read(); + this._lastSuccessfulBuildMeta = read(); + this._forceBuild = read(); + super.deserialize(context); } } -Object.defineProperty(MainTemplate.prototype, "requireFn", { - get: util.deprecate( - () => "__webpack_require__", - 'MainTemplate.requireFn is deprecated (use "__webpack_require__")', - "DEP_WEBPACK_MAIN_TEMPLATE_REQUIRE_FN" - ) -}); - -Object.defineProperty(MainTemplate.prototype, "outputOptions", { - get: util.deprecate( - /** - * @this {MainTemplate} - * @returns {OutputOptions} output options - */ - function () { - return this._outputOptions; - }, - "MainTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)", - "DEP_WEBPACK_MAIN_TEMPLATE_OUTPUT_OPTIONS" - ) -}); +makeSerializable(NormalModule, "webpack/lib/NormalModule"); -module.exports = MainTemplate; +module.exports = NormalModule; /***/ }), -/***/ 73208: +/***/ 68860: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -50886,1095 +49880,1115 @@ module.exports = MainTemplate; -const util = __webpack_require__(73837); +const { getContext } = __webpack_require__(8255); +const asyncLib = __webpack_require__(78175); +const { + AsyncSeriesBailHook, + SyncWaterfallHook, + SyncBailHook, + SyncHook, + HookMap +} = __webpack_require__(6967); const ChunkGraph = __webpack_require__(64971); -const DependenciesBlock = __webpack_require__(71040); +const Module = __webpack_require__(73208); +const ModuleFactory = __webpack_require__(51010); const ModuleGraph = __webpack_require__(99988); -const RuntimeGlobals = __webpack_require__(16475); -const { first } = __webpack_require__(93347); -const { compareChunksById } = __webpack_require__(29579); -const makeSerializable = __webpack_require__(33032); +const NormalModule = __webpack_require__(39); +const BasicEffectRulePlugin = __webpack_require__(30318); +const BasicMatcherRulePlugin = __webpack_require__(94215); +const ObjectMatcherRulePlugin = __webpack_require__(72021); +const RuleSetCompiler = __webpack_require__(83349); +const UseEffectRulePlugin = __webpack_require__(84977); +const LazySet = __webpack_require__(38938); +const { getScheme } = __webpack_require__(54500); +const { cachedCleverMerge, cachedSetProperty } = __webpack_require__(60839); +const { join } = __webpack_require__(17139); +const { + parseResource, + parseResourceWithoutFragment +} = __webpack_require__(82186); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGroup")} ChunkGroup */ -/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./ConcatenationScope")} ConcatenationScope */ -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./ExportsInfo").UsageStateType} UsageStateType */ -/** @typedef {import("./FileSystemInfo")} FileSystemInfo */ -/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./WebpackError")} WebpackError */ -/** @typedef {import("./util/Hash")} Hash */ -/** @template T @typedef {import("./util/LazySet")} LazySet */ -/** @template T @typedef {import("./util/SortableSet")} SortableSet */ +/** @typedef {import("../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */ +/** @typedef {import("./Generator")} Generator */ +/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ +/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ +/** @typedef {import("./Parser")} Parser */ +/** @typedef {import("./ResolverFactory")} ResolverFactory */ +/** @typedef {import("./dependencies/ModuleDependency")} ModuleDependency */ /** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - -/** - * @typedef {Object} SourceContext - * @property {DependencyTemplates} dependencyTemplates the dependency templates - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {RuntimeSpec} runtime the runtimes code should be generated for - * @property {string=} type the type of source that should be generated - */ /** - * @typedef {Object} CodeGenerationContext - * @property {DependencyTemplates} dependencyTemplates the dependency templates - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {RuntimeSpec} runtime the runtimes code should be generated for - * @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules - * @property {CodeGenerationResults} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that) - */ - -/** - * @typedef {Object} ConcatenationBailoutReasonContext - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - */ - -/** - * @typedef {Object} CodeGenerationResult - * @property {Map} sources the resulting sources for all source types - * @property {Map=} data the resulting data for all source types - * @property {ReadonlySet} runtimeRequirements the runtime requirements - * @property {string=} hash a hash of the code generation result (will be automatically calculated from sources and runtimeRequirements if not provided) + * @typedef {Object} ResolveData + * @property {ModuleFactoryCreateData["contextInfo"]} contextInfo + * @property {ModuleFactoryCreateData["resolveOptions"]} resolveOptions + * @property {string} context + * @property {string} request + * @property {Record | undefined} assertions + * @property {ModuleDependency[]} dependencies + * @property {string} dependencyType + * @property {Object} createData + * @property {LazySet} fileDependencies + * @property {LazySet} missingDependencies + * @property {LazySet} contextDependencies + * @property {boolean} cacheable allow to use the unsafe cache */ /** - * @typedef {Object} LibIdentOptions - * @property {string} context absolute context path to which lib ident is relative to - * @property {Object=} associatedObjectForCache object for caching + * @typedef {Object} ResourceData + * @property {string} resource + * @property {string} path + * @property {string} query + * @property {string} fragment + * @property {string=} context */ -/** - * @typedef {Object} KnownBuildMeta - * @property {string=} moduleArgument - * @property {string=} exportsArgument - * @property {boolean=} strict - * @property {string=} moduleConcatenationBailout - * @property {("default" | "namespace" | "flagged" | "dynamic")=} exportsType - * @property {(false | "redirect" | "redirect-warn")=} defaultObject - * @property {boolean=} strictHarmonyModule - * @property {boolean=} async - * @property {boolean=} sideEffectFree - */ +/** @typedef {ResourceData & { data: Record }} ResourceDataWithData */ -/** - * @typedef {Object} NeedBuildContext - * @property {Compilation} compilation - * @property {FileSystemInfo} fileSystemInfo - * @property {Map>} valueCacheVersions +/** @typedef {Object} ParsedLoaderRequest + * @property {string} loader loader + * @property {string|undefined} options options */ -/** @typedef {KnownBuildMeta & Record} BuildMeta */ - const EMPTY_RESOLVE_OPTIONS = {}; +const EMPTY_PARSER_OPTIONS = {}; +const EMPTY_GENERATOR_OPTIONS = {}; +const EMPTY_ELEMENTS = []; -let debugId = 1000; - -const DEFAULT_TYPES_UNKNOWN = new Set(["unknown"]); -const DEFAULT_TYPES_JS = new Set(["javascript"]); - -const deprecatedNeedRebuild = util.deprecate( - (module, context) => { - return module.needRebuild( - context.fileSystemInfo.getDeprecatedFileTimestamps(), - context.fileSystemInfo.getDeprecatedContextTimestamps() - ); - }, - "Module.needRebuild is deprecated in favor of Module.needBuild", - "DEP_WEBPACK_MODULE_NEED_REBUILD" -); - -/** @typedef {(requestShortener: RequestShortener) => string} OptimizationBailoutFunction */ - -class Module extends DependenciesBlock { - /** - * @param {string} type the module type - * @param {string=} context an optional context - * @param {string=} layer an optional layer in which the module is - */ - constructor(type, context = null, layer = null) { - super(); - - /** @type {string} */ - this.type = type; - /** @type {string | null} */ - this.context = context; - /** @type {string | null} */ - this.layer = layer; - /** @type {boolean} */ - this.needId = true; - - // Unique Id - /** @type {number} */ - this.debugId = debugId++; - - // Info from Factory - /** @type {ResolveOptions} */ - this.resolveOptions = EMPTY_RESOLVE_OPTIONS; - /** @type {object | undefined} */ - this.factoryMeta = undefined; - // TODO refactor this -> options object filled from Factory - // TODO webpack 6: use an enum - /** @type {boolean} */ - this.useSourceMap = false; - /** @type {boolean} */ - this.useSimpleSourceMap = false; - - // Info from Build - /** @type {WebpackError[] | undefined} */ - this._warnings = undefined; - /** @type {WebpackError[] | undefined} */ - this._errors = undefined; - /** @type {BuildMeta} */ - this.buildMeta = undefined; - /** @type {Record} */ - this.buildInfo = undefined; - /** @type {Dependency[] | undefined} */ - this.presentationalDependencies = undefined; - /** @type {Dependency[] | undefined} */ - this.codeGenerationDependencies = undefined; - } - - // TODO remove in webpack 6 - // BACKWARD-COMPAT START - get id() { - return ChunkGraph.getChunkGraphForModule( - this, - "Module.id", - "DEP_WEBPACK_MODULE_ID" - ).getModuleId(this); - } - - set id(value) { - if (value === "") { - this.needId = false; - return; - } - ChunkGraph.getChunkGraphForModule( - this, - "Module.id", - "DEP_WEBPACK_MODULE_ID" - ).setModuleId(this, value); - } - - /** - * @returns {string} the hash of the module - */ - get hash() { - return ChunkGraph.getChunkGraphForModule( - this, - "Module.hash", - "DEP_WEBPACK_MODULE_HASH" - ).getModuleHash(this, undefined); - } - - /** - * @returns {string} the shortened hash of the module - */ - get renderedHash() { - return ChunkGraph.getChunkGraphForModule( - this, - "Module.renderedHash", - "DEP_WEBPACK_MODULE_RENDERED_HASH" - ).getRenderedModuleHash(this, undefined); - } +const MATCH_RESOURCE_REGEX = /^([^!]+)!=!/; - get profile() { - return ModuleGraph.getModuleGraphForModule( - this, - "Module.profile", - "DEP_WEBPACK_MODULE_PROFILE" - ).getProfile(this); +const loaderToIdent = data => { + if (!data.options) { + return data.loader; } - - set profile(value) { - ModuleGraph.getModuleGraphForModule( - this, - "Module.profile", - "DEP_WEBPACK_MODULE_PROFILE" - ).setProfile(this, value); + if (typeof data.options === "string") { + return data.loader + "?" + data.options; } - - get index() { - return ModuleGraph.getModuleGraphForModule( - this, - "Module.index", - "DEP_WEBPACK_MODULE_INDEX" - ).getPreOrderIndex(this); + if (typeof data.options !== "object") { + throw new Error("loader options must be string or object"); } - - set index(value) { - ModuleGraph.getModuleGraphForModule( - this, - "Module.index", - "DEP_WEBPACK_MODULE_INDEX" - ).setPreOrderIndex(this, value); + if (data.ident) { + return data.loader + "??" + data.ident; } + return data.loader + "?" + JSON.stringify(data.options); +}; - get index2() { - return ModuleGraph.getModuleGraphForModule( - this, - "Module.index2", - "DEP_WEBPACK_MODULE_INDEX2" - ).getPostOrderIndex(this); +const stringifyLoadersAndResource = (loaders, resource) => { + let str = ""; + for (const loader of loaders) { + str += loaderToIdent(loader) + "!"; } + return str + resource; +}; - set index2(value) { - ModuleGraph.getModuleGraphForModule( - this, - "Module.index2", - "DEP_WEBPACK_MODULE_INDEX2" - ).setPostOrderIndex(this, value); - } +const needCalls = (times, callback) => { + return err => { + if (--times === 0) { + return callback(err); + } + if (err && times > 0) { + times = NaN; + return callback(err); + } + }; +}; - get depth() { - return ModuleGraph.getModuleGraphForModule( - this, - "Module.depth", - "DEP_WEBPACK_MODULE_DEPTH" - ).getDepth(this); +const mergeGlobalOptions = (globalOptions, type, localOptions) => { + const parts = type.split("/"); + let result; + let current = ""; + for (const part of parts) { + current = current ? `${current}/${part}` : part; + const options = globalOptions[current]; + if (typeof options === "object") { + if (result === undefined) { + result = options; + } else { + result = cachedCleverMerge(result, options); + } + } } - - set depth(value) { - ModuleGraph.getModuleGraphForModule( - this, - "Module.depth", - "DEP_WEBPACK_MODULE_DEPTH" - ).setDepth(this, value); + if (result === undefined) { + return localOptions; + } else { + return cachedCleverMerge(result, localOptions); } +}; - get issuer() { - return ModuleGraph.getModuleGraphForModule( - this, - "Module.issuer", - "DEP_WEBPACK_MODULE_ISSUER" - ).getIssuer(this); - } +// TODO webpack 6 remove +const deprecationChangedHookMessage = (name, hook) => { + const names = hook.taps + .map(tapped => { + return tapped.name; + }) + .join(", "); - set issuer(value) { - ModuleGraph.getModuleGraphForModule( - this, - "Module.issuer", - "DEP_WEBPACK_MODULE_ISSUER" - ).setIssuer(this, value); - } + return ( + `NormalModuleFactory.${name} (${names}) is no longer a waterfall hook, but a bailing hook instead. ` + + "Do not return the passed object, but modify it instead. " + + "Returning false will ignore the request and results in no module created." + ); +}; - get usedExports() { - return ModuleGraph.getModuleGraphForModule( - this, - "Module.usedExports", - "DEP_WEBPACK_MODULE_USED_EXPORTS" - ).getUsedExports(this, undefined); - } +const ruleSetCompiler = new RuleSetCompiler([ + new BasicMatcherRulePlugin("test", "resource"), + new BasicMatcherRulePlugin("scheme"), + new BasicMatcherRulePlugin("mimetype"), + new BasicMatcherRulePlugin("dependency"), + new BasicMatcherRulePlugin("include", "resource"), + new BasicMatcherRulePlugin("exclude", "resource", true), + new BasicMatcherRulePlugin("resource"), + new BasicMatcherRulePlugin("resourceQuery"), + new BasicMatcherRulePlugin("resourceFragment"), + new BasicMatcherRulePlugin("realResource"), + new BasicMatcherRulePlugin("issuer"), + new BasicMatcherRulePlugin("compiler"), + new BasicMatcherRulePlugin("issuerLayer"), + new ObjectMatcherRulePlugin("assert", "assertions"), + new ObjectMatcherRulePlugin("descriptionData"), + new BasicEffectRulePlugin("type"), + new BasicEffectRulePlugin("sideEffects"), + new BasicEffectRulePlugin("parser"), + new BasicEffectRulePlugin("resolve"), + new BasicEffectRulePlugin("generator"), + new BasicEffectRulePlugin("layer"), + new UseEffectRulePlugin() +]); +class NormalModuleFactory extends ModuleFactory { /** - * @deprecated - * @returns {(string | OptimizationBailoutFunction)[]} list + * @param {Object} param params + * @param {string=} param.context context + * @param {InputFileSystem} param.fs file system + * @param {ResolverFactory} param.resolverFactory resolverFactory + * @param {ModuleOptions} param.options options + * @param {Object=} param.associatedObjectForCache an object to which the cache will be attached + * @param {boolean=} param.layers enable layers */ - get optimizationBailout() { - return ModuleGraph.getModuleGraphForModule( - this, - "Module.optimizationBailout", - "DEP_WEBPACK_MODULE_OPTIMIZATION_BAILOUT" - ).getOptimizationBailout(this); - } - - get optional() { - return this.isOptional( - ModuleGraph.getModuleGraphForModule( - this, - "Module.optional", - "DEP_WEBPACK_MODULE_OPTIONAL" + constructor({ + context, + fs, + resolverFactory, + options, + associatedObjectForCache, + layers = false + }) { + super(); + this.hooks = Object.freeze({ + /** @type {AsyncSeriesBailHook<[ResolveData], TODO>} */ + resolve: new AsyncSeriesBailHook(["resolveData"]), + /** @type {HookMap>} */ + resolveForScheme: new HookMap( + () => new AsyncSeriesBailHook(["resourceData", "resolveData"]) + ), + /** @type {HookMap>} */ + resolveInScheme: new HookMap( + () => new AsyncSeriesBailHook(["resourceData", "resolveData"]) + ), + /** @type {AsyncSeriesBailHook<[ResolveData], TODO>} */ + factorize: new AsyncSeriesBailHook(["resolveData"]), + /** @type {AsyncSeriesBailHook<[ResolveData], TODO>} */ + beforeResolve: new AsyncSeriesBailHook(["resolveData"]), + /** @type {AsyncSeriesBailHook<[ResolveData], TODO>} */ + afterResolve: new AsyncSeriesBailHook(["resolveData"]), + /** @type {AsyncSeriesBailHook<[ResolveData["createData"], ResolveData], TODO>} */ + createModule: new AsyncSeriesBailHook(["createData", "resolveData"]), + /** @type {SyncWaterfallHook<[Module, ResolveData["createData"], ResolveData], TODO>} */ + module: new SyncWaterfallHook(["module", "createData", "resolveData"]), + createParser: new HookMap(() => new SyncBailHook(["parserOptions"])), + parser: new HookMap(() => new SyncHook(["parser", "parserOptions"])), + createGenerator: new HookMap( + () => new SyncBailHook(["generatorOptions"]) + ), + generator: new HookMap( + () => new SyncHook(["generator", "generatorOptions"]) ) - ); - } + }); + this.resolverFactory = resolverFactory; + this.ruleSet = ruleSetCompiler.compile([ + { + rules: options.defaultRules + }, + { + rules: options.rules + } + ]); + this.context = context || ""; + this.fs = fs; + this._globalParserOptions = options.parser; + this._globalGeneratorOptions = options.generator; + /** @type {Map>} */ + this.parserCache = new Map(); + /** @type {Map>} */ + this.generatorCache = new Map(); + /** @type {Set} */ + this._restoredUnsafeCacheEntries = new Set(); - addChunk(chunk) { - const chunkGraph = ChunkGraph.getChunkGraphForModule( - this, - "Module.addChunk", - "DEP_WEBPACK_MODULE_ADD_CHUNK" + const cacheParseResource = parseResource.bindCache( + associatedObjectForCache ); - if (chunkGraph.isModuleInChunk(this, chunk)) return false; - chunkGraph.connectChunkAndModule(chunk, this); - return true; - } + const cachedParseResourceWithoutFragment = + parseResourceWithoutFragment.bindCache(associatedObjectForCache); + this._parseResourceWithoutFragment = cachedParseResourceWithoutFragment; - removeChunk(chunk) { - return ChunkGraph.getChunkGraphForModule( - this, - "Module.removeChunk", - "DEP_WEBPACK_MODULE_REMOVE_CHUNK" - ).disconnectChunkAndModule(chunk, this); - } + this.hooks.factorize.tapAsync( + { + name: "NormalModuleFactory", + stage: 100 + }, + (resolveData, callback) => { + this.hooks.resolve.callAsync(resolveData, (err, result) => { + if (err) return callback(err); - isInChunk(chunk) { - return ChunkGraph.getChunkGraphForModule( - this, - "Module.isInChunk", - "DEP_WEBPACK_MODULE_IS_IN_CHUNK" - ).isModuleInChunk(this, chunk); - } + // Ignored + if (result === false) return callback(); - isEntryModule() { - return ChunkGraph.getChunkGraphForModule( - this, - "Module.isEntryModule", - "DEP_WEBPACK_MODULE_IS_ENTRY_MODULE" - ).isEntryModule(this); - } + // direct module + if (result instanceof Module) return callback(null, result); - getChunks() { - return ChunkGraph.getChunkGraphForModule( - this, - "Module.getChunks", - "DEP_WEBPACK_MODULE_GET_CHUNKS" - ).getModuleChunks(this); - } + if (typeof result === "object") + throw new Error( + deprecationChangedHookMessage("resolve", this.hooks.resolve) + + " Returning a Module object will result in this module used as result." + ); - getNumberOfChunks() { - return ChunkGraph.getChunkGraphForModule( - this, - "Module.getNumberOfChunks", - "DEP_WEBPACK_MODULE_GET_NUMBER_OF_CHUNKS" - ).getNumberOfModuleChunks(this); - } + this.hooks.afterResolve.callAsync(resolveData, (err, result) => { + if (err) return callback(err); - get chunksIterable() { - return ChunkGraph.getChunkGraphForModule( - this, - "Module.chunksIterable", - "DEP_WEBPACK_MODULE_CHUNKS_ITERABLE" - ).getOrderedModuleChunksIterable(this, compareChunksById); - } + if (typeof result === "object") + throw new Error( + deprecationChangedHookMessage( + "afterResolve", + this.hooks.afterResolve + ) + ); - /** - * @param {string} exportName a name of an export - * @returns {boolean | null} true, if the export is provided why the module. - * null, if it's unknown. - * false, if it's not provided. - */ - isProvided(exportName) { - return ModuleGraph.getModuleGraphForModule( - this, - "Module.usedExports", - "DEP_WEBPACK_MODULE_USED_EXPORTS" - ).isExportProvided(this, exportName); - } - // BACKWARD-COMPAT END - - /** - * @returns {string} name of the exports argument - */ - get exportsArgument() { - return (this.buildInfo && this.buildInfo.exportsArgument) || "exports"; - } + // Ignored + if (result === false) return callback(); - /** - * @returns {string} name of the module argument - */ - get moduleArgument() { - return (this.buildInfo && this.buildInfo.moduleArgument) || "module"; - } + const createData = resolveData.createData; - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {boolean} strict the importing module is strict - * @returns {"namespace" | "default-only" | "default-with-named" | "dynamic"} export type - * "namespace": Exports is already a namespace object. namespace = exports. - * "dynamic": Check at runtime if __esModule is set. When set: namespace = { ...exports, default: exports }. When not set: namespace = { default: exports }. - * "default-only": Provide a namespace object with only default export. namespace = { default: exports } - * "default-with-named": Provide a namespace object with named and default export. namespace = { ...exports, default: exports } - */ - getExportsType(moduleGraph, strict) { - switch (this.buildMeta && this.buildMeta.exportsType) { - case "flagged": - return strict ? "default-with-named" : "namespace"; - case "namespace": - return "namespace"; - case "default": - switch (this.buildMeta.defaultObject) { - case "redirect": - return "default-with-named"; - case "redirect-warn": - return strict ? "default-only" : "default-with-named"; - default: - return "default-only"; - } - case "dynamic": { - if (strict) return "default-with-named"; - // Try to figure out value of __esModule by following reexports - const handleDefault = () => { - switch (this.buildMeta.defaultObject) { - case "redirect": - case "redirect-warn": - return "default-with-named"; - default: - return "default-only"; - } - }; - const exportInfo = moduleGraph.getReadOnlyExportInfo( - this, - "__esModule" - ); - if (exportInfo.provided === false) { - return handleDefault(); - } - const target = exportInfo.getTarget(moduleGraph); - if ( - !target || - !target.export || - target.export.length !== 1 || - target.export[0] !== "__esModule" - ) { - return "dynamic"; - } - switch ( - target.module.buildMeta && - target.module.buildMeta.exportsType - ) { - case "flagged": - case "namespace": - return "namespace"; - case "default": - return handleDefault(); - default: - return "dynamic"; - } - } - default: - return strict ? "default-with-named" : "dynamic"; - } - } + this.hooks.createModule.callAsync( + createData, + resolveData, + (err, createdModule) => { + if (!createdModule) { + if (!resolveData.request) { + return callback(new Error("Empty dependency (no request)")); + } - /** - * @param {Dependency} presentationalDependency dependency being tied to module. - * This is a Dependency without edge in the module graph. It's only for presentation. - * @returns {void} - */ - addPresentationalDependency(presentationalDependency) { - if (this.presentationalDependencies === undefined) { - this.presentationalDependencies = []; - } - this.presentationalDependencies.push(presentationalDependency); - } + createdModule = new NormalModule(createData); + } - /** - * @param {Dependency} codeGenerationDependency dependency being tied to module. - * This is a Dependency where the code generation result of the referenced module is needed during code generation. - * The Dependency should also be added to normal dependencies via addDependency. - * @returns {void} - */ - addCodeGenerationDependency(codeGenerationDependency) { - if (this.codeGenerationDependencies === undefined) { - this.codeGenerationDependencies = []; - } - this.codeGenerationDependencies.push(codeGenerationDependency); - } + createdModule = this.hooks.module.call( + createdModule, + createData, + resolveData + ); - /** - * Removes all dependencies and blocks - * @returns {void} - */ - clearDependenciesAndBlocks() { - if (this.presentationalDependencies !== undefined) { - this.presentationalDependencies.length = 0; - } - if (this.codeGenerationDependencies !== undefined) { - this.codeGenerationDependencies.length = 0; - } - super.clearDependenciesAndBlocks(); - } + return callback(null, createdModule); + } + ); + }); + }); + } + ); + this.hooks.resolve.tapAsync( + { + name: "NormalModuleFactory", + stage: 100 + }, + (data, callback) => { + const { + contextInfo, + context, + dependencies, + dependencyType, + request, + assertions, + resolveOptions, + fileDependencies, + missingDependencies, + contextDependencies + } = data; + const loaderResolver = this.getResolver("loader"); - /** - * @param {WebpackError} warning the warning - * @returns {void} - */ - addWarning(warning) { - if (this._warnings === undefined) { - this._warnings = []; - } - this._warnings.push(warning); - } + /** @type {ResourceData | undefined} */ + let matchResourceData = undefined; + /** @type {string} */ + let unresolvedResource; + /** @type {ParsedLoaderRequest[]} */ + let elements; + let noPreAutoLoaders = false; + let noAutoLoaders = false; + let noPrePostAutoLoaders = false; - /** - * @returns {Iterable | undefined} list of warnings if any - */ - getWarnings() { - return this._warnings; - } + const contextScheme = getScheme(context); + /** @type {string | undefined} */ + let scheme = getScheme(request); - /** - * @returns {number} number of warnings - */ - getNumberOfWarnings() { - return this._warnings !== undefined ? this._warnings.length : 0; - } + if (!scheme) { + /** @type {string} */ + let requestWithoutMatchResource = request; + const matchResourceMatch = MATCH_RESOURCE_REGEX.exec(request); + if (matchResourceMatch) { + let matchResource = matchResourceMatch[1]; + if (matchResource.charCodeAt(0) === 46) { + // 46 === ".", 47 === "/" + const secondChar = matchResource.charCodeAt(1); + if ( + secondChar === 47 || + (secondChar === 46 && matchResource.charCodeAt(2) === 47) + ) { + // if matchResources startsWith ../ or ./ + matchResource = join(this.fs, context, matchResource); + } + } + matchResourceData = { + resource: matchResource, + ...cacheParseResource(matchResource) + }; + requestWithoutMatchResource = request.substr( + matchResourceMatch[0].length + ); + } - /** - * @param {WebpackError} error the error - * @returns {void} - */ - addError(error) { - if (this._errors === undefined) { - this._errors = []; - } - this._errors.push(error); - } + scheme = getScheme(requestWithoutMatchResource); - /** - * @returns {Iterable | undefined} list of errors if any - */ - getErrors() { - return this._errors; - } + if (!scheme && !contextScheme) { + const firstChar = requestWithoutMatchResource.charCodeAt(0); + const secondChar = requestWithoutMatchResource.charCodeAt(1); + noPreAutoLoaders = firstChar === 45 && secondChar === 33; // startsWith "-!" + noAutoLoaders = noPreAutoLoaders || firstChar === 33; // startsWith "!" + noPrePostAutoLoaders = firstChar === 33 && secondChar === 33; // startsWith "!!"; + const rawElements = requestWithoutMatchResource + .slice( + noPreAutoLoaders || noPrePostAutoLoaders + ? 2 + : noAutoLoaders + ? 1 + : 0 + ) + .split(/!+/); + unresolvedResource = rawElements.pop(); + elements = rawElements.map(el => { + const { path, query } = cachedParseResourceWithoutFragment(el); + return { + loader: path, + options: query ? query.slice(1) : undefined + }; + }); + scheme = getScheme(unresolvedResource); + } else { + unresolvedResource = requestWithoutMatchResource; + elements = EMPTY_ELEMENTS; + } + } else { + unresolvedResource = request; + elements = EMPTY_ELEMENTS; + } - /** - * @returns {number} number of errors - */ - getNumberOfErrors() { - return this._errors !== undefined ? this._errors.length : 0; - } + const resolveContext = { + fileDependencies, + missingDependencies, + contextDependencies + }; - /** - * removes all warnings and errors - * @returns {void} - */ - clearWarningsAndErrors() { - if (this._warnings !== undefined) { - this._warnings.length = 0; - } - if (this._errors !== undefined) { - this._errors.length = 0; - } - } + /** @type {ResourceDataWithData} */ + let resourceData; - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {boolean} true, if the module is optional - */ - isOptional(moduleGraph) { - let hasConnections = false; - for (const r of moduleGraph.getIncomingConnections(this)) { - if ( - !r.dependency || - !r.dependency.optional || - !r.isTargetActive(undefined) - ) { - return false; - } - hasConnections = true; - } - return hasConnections; - } + let loaders; - /** - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {Chunk} chunk a chunk - * @param {Chunk=} ignoreChunk chunk to be ignored - * @returns {boolean} true, if the module is accessible from "chunk" when ignoring "ignoreChunk" - */ - isAccessibleInChunk(chunkGraph, chunk, ignoreChunk) { - // Check if module is accessible in ALL chunk groups - for (const chunkGroup of chunk.groupsIterable) { - if (!this.isAccessibleInChunkGroup(chunkGraph, chunkGroup)) return false; - } - return true; - } + const continueCallback = needCalls(2, err => { + if (err) return callback(err); - /** - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {ChunkGroup} chunkGroup a chunk group - * @param {Chunk=} ignoreChunk chunk to be ignored - * @returns {boolean} true, if the module is accessible from "chunkGroup" when ignoring "ignoreChunk" - */ - isAccessibleInChunkGroup(chunkGraph, chunkGroup, ignoreChunk) { - const queue = new Set([chunkGroup]); + // translate option idents + try { + for (const item of loaders) { + if (typeof item.options === "string" && item.options[0] === "?") { + const ident = item.options.substr(1); + if (ident === "[[missing ident]]") { + throw new Error( + "No ident is provided by referenced loader. " + + "When using a function for Rule.use in config you need to " + + "provide an 'ident' property for referenced loader options." + ); + } + item.options = this.ruleSet.references.get(ident); + if (item.options === undefined) { + throw new Error( + "Invalid ident is provided by referenced loader" + ); + } + item.ident = ident; + } + } + } catch (e) { + return callback(e); + } - // Check if module is accessible from all items of the queue - queueFor: for (const cg of queue) { - // 1. If module is in one of the chunks of the group we can continue checking the next items - // because it's accessible. - for (const chunk of cg.chunks) { - if (chunk !== ignoreChunk && chunkGraph.isModuleInChunk(this, chunk)) - continue queueFor; - } - // 2. If the chunk group is initial, we can break here because it's not accessible. - if (chunkGroup.isInitial()) return false; - // 3. Enqueue all parents because it must be accessible from ALL parents - for (const parent of chunkGroup.parentsIterable) queue.add(parent); - } - // When we processed through the whole list and we didn't bailout, the module is accessible - return true; - } + if (!resourceData) { + // ignored + return callback(null, dependencies[0].createIgnoredModule(context)); + } - /** - * @param {Chunk} chunk a chunk - * @param {ModuleGraph} moduleGraph the module graph - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {boolean} true, if the module has any reason why "chunk" should be included - */ - hasReasonForChunk(chunk, moduleGraph, chunkGraph) { - // check for each reason if we need the chunk - for (const [ - fromModule, - connections - ] of moduleGraph.getIncomingConnectionsByOriginModule(this)) { - if (!connections.some(c => c.isTargetActive(chunk.runtime))) continue; - for (const originChunk of chunkGraph.getModuleChunksIterable( - fromModule - )) { - // return true if module this is not reachable from originChunk when ignoring chunk - if (!this.isAccessibleInChunk(chunkGraph, originChunk, chunk)) - return true; - } - } - return false; - } + const userRequest = + (matchResourceData !== undefined + ? `${matchResourceData.resource}!=!` + : "") + + stringifyLoadersAndResource(loaders, resourceData.resource); - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true if at least one other module depends on this module - */ - hasReasons(moduleGraph, runtime) { - for (const c of moduleGraph.getIncomingConnections(this)) { - if (c.isTargetActive(runtime)) return true; - } - return false; - } + const settings = {}; + const useLoadersPost = []; + const useLoaders = []; + const useLoadersPre = []; - /** - * @returns {string} for debugging - */ - toString() { - return `Module[${this.debugId}: ${this.identifier()}]`; - } + // handle .webpack[] suffix + let resource; + let match; + if ( + matchResourceData && + typeof (resource = matchResourceData.resource) === "string" && + (match = /\.webpack\[([^\]]+)\]$/.exec(resource)) + ) { + settings.type = match[1]; + matchResourceData.resource = matchResourceData.resource.slice( + 0, + -settings.type.length - 10 + ); + } else { + settings.type = "javascript/auto"; + const resourceDataForRules = matchResourceData || resourceData; + const result = this.ruleSet.exec({ + resource: resourceDataForRules.path, + realResource: resourceData.path, + resourceQuery: resourceDataForRules.query, + resourceFragment: resourceDataForRules.fragment, + scheme, + assertions, + mimetype: matchResourceData + ? "" + : resourceData.data.mimetype || "", + dependency: dependencyType, + descriptionData: matchResourceData + ? undefined + : resourceData.data.descriptionFileData, + issuer: contextInfo.issuer, + compiler: contextInfo.compiler, + issuerLayer: contextInfo.issuerLayer || "" + }); + for (const r of result) { + if (r.type === "use") { + if (!noAutoLoaders && !noPrePostAutoLoaders) { + useLoaders.push(r.value); + } + } else if (r.type === "use-post") { + if (!noPrePostAutoLoaders) { + useLoadersPost.push(r.value); + } + } else if (r.type === "use-pre") { + if (!noPreAutoLoaders && !noPrePostAutoLoaders) { + useLoadersPre.push(r.value); + } + } else if ( + typeof r.value === "object" && + r.value !== null && + typeof settings[r.type] === "object" && + settings[r.type] !== null + ) { + settings[r.type] = cachedCleverMerge(settings[r.type], r.value); + } else { + settings[r.type] = r.value; + } + } + } - /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} - */ - needBuild(context, callback) { - callback( - null, - !this.buildMeta || - this.needRebuild === Module.prototype.needRebuild || - deprecatedNeedRebuild(this, context) - ); - } + let postLoaders, normalLoaders, preLoaders; - /** - * @deprecated Use needBuild instead - * @param {Map} fileTimestamps timestamps of files - * @param {Map} contextTimestamps timestamps of directories - * @returns {boolean} true, if the module needs a rebuild - */ - needRebuild(fileTimestamps, contextTimestamps) { - return true; - } - - /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash( - hash, - context = { - chunkGraph: ChunkGraph.getChunkGraphForModule( - this, - "Module.updateHash", - "DEP_WEBPACK_MODULE_UPDATE_HASH" - ), - runtime: undefined - } - ) { - const { chunkGraph, runtime } = context; - hash.update(chunkGraph.getModuleGraphHash(this, runtime)); - if (this.presentationalDependencies !== undefined) { - for (const dep of this.presentationalDependencies) { - dep.updateHash(hash, context); - } - } - super.updateHash(hash, context); - } + const continueCallback = needCalls(3, err => { + if (err) { + return callback(err); + } + const allLoaders = postLoaders; + if (matchResourceData === undefined) { + for (const loader of loaders) allLoaders.push(loader); + for (const loader of normalLoaders) allLoaders.push(loader); + } else { + for (const loader of normalLoaders) allLoaders.push(loader); + for (const loader of loaders) allLoaders.push(loader); + } + for (const loader of preLoaders) allLoaders.push(loader); + let type = settings.type; + const resolveOptions = settings.resolve; + const layer = settings.layer; + if (layer !== undefined && !layers) { + return callback( + new Error( + "'Rule.layer' is only allowed when 'experiments.layers' is enabled" + ) + ); + } + try { + Object.assign(data.createData, { + layer: + layer === undefined ? contextInfo.issuerLayer || null : layer, + request: stringifyLoadersAndResource( + allLoaders, + resourceData.resource + ), + userRequest, + rawRequest: request, + loaders: allLoaders, + resource: resourceData.resource, + context: + resourceData.context || getContext(resourceData.resource), + matchResource: matchResourceData + ? matchResourceData.resource + : undefined, + resourceResolveData: resourceData.data, + settings, + type, + parser: this.getParser(type, settings.parser), + parserOptions: settings.parser, + generator: this.getGenerator(type, settings.generator), + generatorOptions: settings.generator, + resolveOptions + }); + } catch (e) { + return callback(e); + } + callback(); + }); + this.resolveRequestArray( + contextInfo, + this.context, + useLoadersPost, + loaderResolver, + resolveContext, + (err, result) => { + postLoaders = result; + continueCallback(err); + } + ); + this.resolveRequestArray( + contextInfo, + this.context, + useLoaders, + loaderResolver, + resolveContext, + (err, result) => { + normalLoaders = result; + continueCallback(err); + } + ); + this.resolveRequestArray( + contextInfo, + this.context, + useLoadersPre, + loaderResolver, + resolveContext, + (err, result) => { + preLoaders = result; + continueCallback(err); + } + ); + }); - /** - * @returns {void} - */ - invalidateBuild() { - // should be overridden to support this feature - } + this.resolveRequestArray( + contextInfo, + contextScheme ? this.context : context, + elements, + loaderResolver, + resolveContext, + (err, result) => { + if (err) return continueCallback(err); + loaders = result; + continueCallback(); + } + ); - /* istanbul ignore next */ - /** - * @abstract - * @returns {string} a unique identifier of the module - */ - identifier() { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); - } + const defaultResolve = context => { + if (/^($|\?)/.test(unresolvedResource)) { + resourceData = { + resource: unresolvedResource, + data: {}, + ...cacheParseResource(unresolvedResource) + }; + continueCallback(); + } - /* istanbul ignore next */ - /** - * @abstract - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module - */ - readableIdentifier(requestShortener) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); - } + // resource without scheme and with path + else { + const normalResolver = this.getResolver( + "normal", + dependencyType + ? cachedSetProperty( + resolveOptions || EMPTY_RESOLVE_OPTIONS, + "dependencyType", + dependencyType + ) + : resolveOptions + ); + this.resolveResource( + contextInfo, + context, + unresolvedResource, + normalResolver, + resolveContext, + (err, resolvedResource, resolvedResourceResolveData) => { + if (err) return continueCallback(err); + if (resolvedResource !== false) { + resourceData = { + resource: resolvedResource, + data: resolvedResourceResolveData, + ...cacheParseResource(resolvedResource) + }; + } + continueCallback(); + } + ); + } + }; - /* istanbul ignore next */ - /** - * @abstract - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} - */ - build(options, compilation, resolver, fs, callback) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); - } + // resource with scheme + if (scheme) { + resourceData = { + resource: unresolvedResource, + data: {}, + path: undefined, + query: undefined, + fragment: undefined, + context: undefined + }; + this.hooks.resolveForScheme + .for(scheme) + .callAsync(resourceData, data, err => { + if (err) return continueCallback(err); + continueCallback(); + }); + } - /** - * @abstract - * @returns {Set} types available (do not mutate) - */ - getSourceTypes() { - // Better override this method to return the correct types - if (this.source === Module.prototype.source) { - return DEFAULT_TYPES_UNKNOWN; - } else { - return DEFAULT_TYPES_JS; - } - } + // resource within scheme + else if (contextScheme) { + resourceData = { + resource: unresolvedResource, + data: {}, + path: undefined, + query: undefined, + fragment: undefined, + context: undefined + }; + this.hooks.resolveInScheme + .for(contextScheme) + .callAsync(resourceData, data, (err, handled) => { + if (err) return continueCallback(err); + if (!handled) return defaultResolve(this.context); + continueCallback(); + }); + } - /** - * @abstract - * @deprecated Use codeGeneration() instead - * @param {DependencyTemplates} dependencyTemplates the dependency templates - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @param {string=} type the type of source that should be generated - * @returns {Source} generated source - */ - source(dependencyTemplates, runtimeTemplate, type = "javascript") { - if (this.codeGeneration === Module.prototype.codeGeneration) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); - } - const chunkGraph = ChunkGraph.getChunkGraphForModule( - this, - "Module.source() is deprecated. Use Compilation.codeGenerationResults.getSource(module, runtime, type) instead", - "DEP_WEBPACK_MODULE_SOURCE" + // resource without scheme and without path + else defaultResolve(context); + } ); - /** @type {CodeGenerationContext} */ - const codeGenContext = { - dependencyTemplates, - runtimeTemplate, - moduleGraph: chunkGraph.moduleGraph, - chunkGraph, - runtime: undefined, - codeGenerationResults: undefined - }; - const sources = this.codeGeneration(codeGenContext).sources; - return type ? sources.get(type) : sources.get(first(this.getSourceTypes())); - } - - /* istanbul ignore next */ - /** - * @abstract - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); - } - - /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion - */ - libIdent(options) { - return null; } - /** - * @returns {string | null} absolute path which should be used for condition matching (usually the resource path) - */ - nameForCondition() { - return null; + cleanupForCache() { + for (const module of this._restoredUnsafeCacheEntries) { + ChunkGraph.clearChunkGraphForModule(module); + ModuleGraph.clearModuleGraphForModule(module); + module.cleanupForCache(); + } } /** - * @param {ConcatenationBailoutReasonContext} context context - * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated + * @param {ModuleFactoryCreateData} data data object + * @param {function(Error=, ModuleFactoryResult=): void} callback callback + * @returns {void} */ - getConcatenationBailoutReason(context) { - return `Module Concatenation is not implemented for ${this.constructor.name}`; - } + create(data, callback) { + const dependencies = /** @type {ModuleDependency[]} */ (data.dependencies); + const context = data.context || this.context; + const resolveOptions = data.resolveOptions || EMPTY_RESOLVE_OPTIONS; + const dependency = dependencies[0]; + const request = dependency.request; + const assertions = dependency.assertions; + const contextInfo = data.contextInfo; + const fileDependencies = new LazySet(); + const missingDependencies = new LazySet(); + const contextDependencies = new LazySet(); + const dependencyType = + (dependencies.length > 0 && dependencies[0].category) || ""; + /** @type {ResolveData} */ + const resolveData = { + contextInfo, + resolveOptions, + context, + request, + assertions, + dependencies, + dependencyType, + fileDependencies, + missingDependencies, + contextDependencies, + createData: {}, + cacheable: true + }; + this.hooks.beforeResolve.callAsync(resolveData, (err, result) => { + if (err) { + return callback(err, { + fileDependencies, + missingDependencies, + contextDependencies, + cacheable: false + }); + } - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this module should be connected to referencing modules when consumed for side-effects only - */ - getSideEffectsConnectionState(moduleGraph) { - return true; - } + // Ignored + if (result === false) { + return callback(null, { + fileDependencies, + missingDependencies, + contextDependencies, + cacheable: resolveData.cacheable + }); + } - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration(context) { - // Best override this method - const sources = new Map(); - for (const type of this.getSourceTypes()) { - if (type !== "unknown") { - sources.set( - type, - this.source( - context.dependencyTemplates, - context.runtimeTemplate, - type + if (typeof result === "object") + throw new Error( + deprecationChangedHookMessage( + "beforeResolve", + this.hooks.beforeResolve ) ); - } - } - return { - sources, - runtimeRequirements: new Set([ - RuntimeGlobals.module, - RuntimeGlobals.exports, - RuntimeGlobals.require - ]) - }; - } - /** - * @param {Chunk} chunk the chunk which condition should be checked - * @param {Compilation} compilation the compilation - * @returns {boolean} true, if the chunk is ok for the module - */ - chunkCondition(chunk, compilation) { - return true; - } + this.hooks.factorize.callAsync(resolveData, (err, module) => { + if (err) { + return callback(err, { + fileDependencies, + missingDependencies, + contextDependencies, + cacheable: false + }); + } - hasChunkCondition() { - return this.chunkCondition !== Module.prototype.chunkCondition; - } + const factoryResult = { + module, + fileDependencies, + missingDependencies, + contextDependencies, + cacheable: resolveData.cacheable + }; - /** - * Assuming this module is in the cache. Update the (cached) module with - * the fresh module from the factory. Usually updates internal references - * and properties. - * @param {Module} module fresh module - * @returns {void} - */ - updateCacheModule(module) { - this.type = module.type; - this.layer = module.layer; - this.context = module.context; - this.factoryMeta = module.factoryMeta; - this.resolveOptions = module.resolveOptions; + callback(null, factoryResult); + }); + }); } - /** - * Module should be unsafe cached. Get data that's needed for that. - * This data will be passed to restoreFromUnsafeCache later. - * @returns {object} cached data - */ - getUnsafeCacheData() { - return { - factoryMeta: this.factoryMeta, - resolveOptions: this.resolveOptions - }; + resolveResource( + contextInfo, + context, + unresolvedResource, + resolver, + resolveContext, + callback + ) { + resolver.resolve( + contextInfo, + context, + unresolvedResource, + resolveContext, + (err, resolvedResource, resolvedResourceResolveData) => { + if (err) { + return this._resolveResourceErrorHints( + err, + contextInfo, + context, + unresolvedResource, + resolver, + resolveContext, + (err2, hints) => { + if (err2) { + err.message += ` +An fatal error happened during resolving additional hints for this error: ${err2.message}`; + err.stack += ` + +An fatal error happened during resolving additional hints for this error: +${err2.stack}`; + return callback(err); + } + if (hints && hints.length > 0) { + err.message += ` +${hints.join("\n\n")}`; + } + callback(err); + } + ); + } + callback(err, resolvedResource, resolvedResourceResolveData); + } + ); } - /** - * restore unsafe cache data - * @param {object} unsafeCacheData data from getUnsafeCacheData - * @param {NormalModuleFactory} normalModuleFactory the normal module factory handling the unsafe caching - */ - _restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory) { - this.factoryMeta = unsafeCacheData.factoryMeta; - this.resolveOptions = unsafeCacheData.resolveOptions; + _resolveResourceErrorHints( + error, + contextInfo, + context, + unresolvedResource, + resolver, + resolveContext, + callback + ) { + asyncLib.parallel( + [ + callback => { + if (!resolver.options.fullySpecified) return callback(); + resolver + .withOptions({ + fullySpecified: false + }) + .resolve( + contextInfo, + context, + unresolvedResource, + resolveContext, + (err, resolvedResource) => { + if (!err && resolvedResource) { + const resource = parseResource(resolvedResource).path.replace( + /^.*[\\/]/, + "" + ); + return callback( + null, + `Did you mean '${resource}'? +BREAKING CHANGE: The request '${unresolvedResource}' failed to resolve only because it was resolved as fully specified +(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"'). +The extension in the request is mandatory for it to be fully specified. +Add the extension to the request.` + ); + } + callback(); + } + ); + }, + callback => { + if (!resolver.options.enforceExtension) return callback(); + resolver + .withOptions({ + enforceExtension: false, + extensions: [] + }) + .resolve( + contextInfo, + context, + unresolvedResource, + resolveContext, + (err, resolvedResource) => { + if (!err && resolvedResource) { + let hint = ""; + const match = /(\.[^.]+)(\?|$)/.exec(unresolvedResource); + if (match) { + const fixedRequest = unresolvedResource.replace( + /(\.[^.]+)(\?|$)/, + "$2" + ); + if (resolver.options.extensions.has(match[1])) { + hint = `Did you mean '${fixedRequest}'?`; + } else { + hint = `Did you mean '${fixedRequest}'? Also note that '${match[1]}' is not in 'resolve.extensions' yet and need to be added for this to work?`; + } + } else { + hint = `Did you mean to omit the extension or to remove 'resolve.enforceExtension'?`; + } + return callback( + null, + `The request '${unresolvedResource}' failed to resolve only because 'resolve.enforceExtension' was specified. +${hint} +Including the extension in the request is no longer possible. Did you mean to enforce including the extension in requests with 'resolve.extensions: []' instead?` + ); + } + callback(); + } + ); + }, + callback => { + if ( + /^\.\.?\//.test(unresolvedResource) || + resolver.options.preferRelative + ) { + return callback(); + } + resolver.resolve( + contextInfo, + context, + `./${unresolvedResource}`, + resolveContext, + (err, resolvedResource) => { + if (err || !resolvedResource) return callback(); + const moduleDirectories = resolver.options.modules + .map(m => (Array.isArray(m) ? m.join(", ") : m)) + .join(", "); + callback( + null, + `Did you mean './${unresolvedResource}'? +Requests that should resolve in the current directory need to start with './'. +Requests that start with a name are treated as module requests and resolve within module directories (${moduleDirectories}). +If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.` + ); + } + ); + } + ], + (err, hints) => { + if (err) return callback(err); + callback(null, hints.filter(Boolean)); + } + ); } - /** - * Assuming this module is in the cache. Remove internal references to allow freeing some memory. - */ - cleanupForCache() { - this.factoryMeta = undefined; - this.resolveOptions = undefined; + resolveRequestArray( + contextInfo, + context, + array, + resolver, + resolveContext, + callback + ) { + if (array.length === 0) return callback(null, array); + asyncLib.map( + array, + (item, callback) => { + resolver.resolve( + contextInfo, + context, + item.loader, + resolveContext, + (err, result) => { + if ( + err && + /^[^/]*$/.test(item.loader) && + !/-loader$/.test(item.loader) + ) { + return resolver.resolve( + contextInfo, + context, + item.loader + "-loader", + resolveContext, + err2 => { + if (!err2) { + err.message = + err.message + + "\n" + + "BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when using loaders.\n" + + ` You need to specify '${item.loader}-loader' instead of '${item.loader}',\n` + + " see https://webpack.js.org/migrate/3/#automatic-loader-module-name-extension-removed"; + } + callback(err); + } + ); + } + if (err) return callback(err); + + const parsedResult = this._parseResourceWithoutFragment(result); + const resolved = { + loader: parsedResult.path, + options: + item.options === undefined + ? parsedResult.query + ? parsedResult.query.slice(1) + : undefined + : item.options, + ident: item.options === undefined ? undefined : item.ident + }; + return callback(null, resolved); + } + ); + }, + callback + ); } - /** - * @returns {Source | null} the original source for the module before webpack transformation - */ - originalSource() { - return null; + getParser(type, parserOptions = EMPTY_PARSER_OPTIONS) { + let cache = this.parserCache.get(type); + + if (cache === undefined) { + cache = new WeakMap(); + this.parserCache.set(type, cache); + } + + let parser = cache.get(parserOptions); + + if (parser === undefined) { + parser = this.createParser(type, parserOptions); + cache.set(parserOptions, parser); + } + + return parser; } /** - * @param {LazySet} fileDependencies set where file dependencies are added to - * @param {LazySet} contextDependencies set where context dependencies are added to - * @param {LazySet} missingDependencies set where missing dependencies are added to - * @param {LazySet} buildDependencies set where build dependencies are added to + * @param {string} type type + * @param {{[k: string]: any}} parserOptions parser options + * @returns {Parser} parser */ - addCacheDependencies( - fileDependencies, - contextDependencies, - missingDependencies, - buildDependencies - ) {} - - serialize(context) { - const { write } = context; - write(this.type); - write(this.layer); - write(this.context); - write(this.resolveOptions); - write(this.factoryMeta); - write(this.useSourceMap); - write(this.useSimpleSourceMap); - write( - this._warnings !== undefined && this._warnings.length === 0 - ? undefined - : this._warnings - ); - write( - this._errors !== undefined && this._errors.length === 0 - ? undefined - : this._errors + createParser(type, parserOptions = {}) { + parserOptions = mergeGlobalOptions( + this._globalParserOptions, + type, + parserOptions ); - write(this.buildMeta); - write(this.buildInfo); - write(this.presentationalDependencies); - write(this.codeGenerationDependencies); - super.serialize(context); + const parser = this.hooks.createParser.for(type).call(parserOptions); + if (!parser) { + throw new Error(`No parser registered for ${type}`); + } + this.hooks.parser.for(type).call(parser, parserOptions); + return parser; } - deserialize(context) { - const { read } = context; - this.type = read(); - this.layer = read(); - this.context = read(); - this.resolveOptions = read(); - this.factoryMeta = read(); - this.useSourceMap = read(); - this.useSimpleSourceMap = read(); - this._warnings = read(); - this._errors = read(); - this.buildMeta = read(); - this.buildInfo = read(); - this.presentationalDependencies = read(); - this.codeGenerationDependencies = read(); - super.deserialize(context); - } -} + getGenerator(type, generatorOptions = EMPTY_GENERATOR_OPTIONS) { + let cache = this.generatorCache.get(type); -makeSerializable(Module, "webpack/lib/Module"); + if (cache === undefined) { + cache = new WeakMap(); + this.generatorCache.set(type, cache); + } -// TODO remove in webpack 6 -Object.defineProperty(Module.prototype, "hasEqualsChunks", { - get() { - throw new Error( - "Module.hasEqualsChunks was renamed (use hasEqualChunks instead)" - ); + let generator = cache.get(generatorOptions); + + if (generator === undefined) { + generator = this.createGenerator(type, generatorOptions); + cache.set(generatorOptions, generator); + } + + return generator; } -}); -// TODO remove in webpack 6 -Object.defineProperty(Module.prototype, "isUsed", { - get() { - throw new Error( - "Module.isUsed was renamed (use getUsedName, isExportUsed or isModuleUsed instead)" + createGenerator(type, generatorOptions = {}) { + generatorOptions = mergeGlobalOptions( + this._globalGeneratorOptions, + type, + generatorOptions ); + const generator = this.hooks.createGenerator + .for(type) + .call(generatorOptions); + if (!generator) { + throw new Error(`No generator registered for ${type}`); + } + this.hooks.generator.for(type).call(generator, generatorOptions); + return generator; } -}); - -// TODO remove in webpack 6 -Object.defineProperty(Module.prototype, "errors", { - get: util.deprecate( - /** - * @this {Module} - * @returns {WebpackError[]} array - */ - function () { - if (this._errors === undefined) { - this._errors = []; - } - return this._errors; - }, - "Module.errors was removed (use getErrors instead)", - "DEP_WEBPACK_MODULE_ERRORS" - ) -}); - -// TODO remove in webpack 6 -Object.defineProperty(Module.prototype, "warnings", { - get: util.deprecate( - /** - * @this {Module} - * @returns {WebpackError[]} array - */ - function () { - if (this._warnings === undefined) { - this._warnings = []; - } - return this._warnings; - }, - "Module.warnings was removed (use getWarnings instead)", - "DEP_WEBPACK_MODULE_WARNINGS" - ) -}); -// TODO remove in webpack 6 -Object.defineProperty(Module.prototype, "used", { - get() { - throw new Error( - "Module.used was refactored (use ModuleGraph.getUsedExports instead)" - ); - }, - set(value) { - throw new Error( - "Module.used was refactored (use ModuleGraph.setUsedExports instead)" - ); + getResolver(type, resolveOptions) { + return this.resolverFactory.get(type, resolveOptions); } -}); +} -module.exports = Module; +module.exports = NormalModuleFactory; /***/ }), -/***/ 21305: +/***/ 30633: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -51985,81 +50999,112 @@ module.exports = Module; -const { cutOffLoaderExecution } = __webpack_require__(59985); -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); +const { join, dirname } = __webpack_require__(17139); -class ModuleBuildError extends WebpackError { +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {function(TODO): void} ModuleReplacer */ + +class NormalModuleReplacementPlugin { /** - * @param {string | Error&any} err error thrown - * @param {{from?: string|null}} info additional info + * Create an instance of the plugin + * @param {RegExp} resourceRegExp the resource matcher + * @param {string|ModuleReplacer} newResource the resource replacement */ - constructor(err, { from = null } = {}) { - let message = "Module build failed"; - let details = undefined; + constructor(resourceRegExp, newResource) { + this.resourceRegExp = resourceRegExp; + this.newResource = newResource; + } - if (from) { - message += ` (from ${from}):\n`; - } else { - message += ": "; - } + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const resourceRegExp = this.resourceRegExp; + const newResource = this.newResource; + compiler.hooks.normalModuleFactory.tap( + "NormalModuleReplacementPlugin", + nmf => { + nmf.hooks.beforeResolve.tap("NormalModuleReplacementPlugin", result => { + if (resourceRegExp.test(result.request)) { + if (typeof newResource === "function") { + newResource(result); + } else { + result.request = newResource; + } + } + }); + nmf.hooks.afterResolve.tap("NormalModuleReplacementPlugin", result => { + const createData = result.createData; + if (resourceRegExp.test(createData.resource)) { + if (typeof newResource === "function") { + newResource(result); + } else { + const fs = compiler.inputFileSystem; + if ( + newResource.startsWith("/") || + (newResource.length > 1 && newResource[1] === ":") + ) { + createData.resource = newResource; + } else { + createData.resource = join( + fs, + dirname(fs, createData.resource), + newResource + ); + } + } + } + }); + } + ); + } +} - if (err !== null && typeof err === "object") { - if (typeof err.stack === "string" && err.stack) { - const stack = cutOffLoaderExecution(err.stack); +module.exports = NormalModuleReplacementPlugin; - if (!err.hideStack) { - message += stack; - } else { - details = stack; - if (typeof err.message === "string" && err.message) { - message += err.message; - } else { - message += err; - } - } - } else if (typeof err.message === "string" && err.message) { - message += err.message; - } else { - message += String(err); - } - } else { - message += String(err); - } +/***/ }), - super(message); +/***/ 80057: +/***/ (function(__unused_webpack_module, exports) { - this.name = "ModuleBuildError"; - this.details = details; - this.error = err; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Florent Cailhol @ooflorent +*/ - serialize(context) { - const { write } = context; - write(this.error); - super.serialize(context); - } +exports.STAGE_BASIC = -10; +exports.STAGE_DEFAULT = 0; +exports.STAGE_ADVANCED = 10; - deserialize(context) { - const { read } = context; - this.error = read(); +/***/ }), - super.deserialize(context); - } -} +/***/ 81426: +/***/ (function(module) { -makeSerializable(ModuleBuildError, "webpack/lib/ModuleBuildError"); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -module.exports = ModuleBuildError; + + +class OptionsApply { + process(options, compiler) {} +} +module.exports = OptionsApply; /***/ }), -/***/ 67409: +/***/ 11715: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -52070,44 +51115,42 @@ module.exports = ModuleBuildError; -const WebpackError = __webpack_require__(53799); +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./NormalModule")} NormalModule */ -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("./Module")} Module */ +/** @typedef {Record} PreparsedAst */ -class ModuleDependencyError extends WebpackError { - /** - * Creates an instance of ModuleDependencyError. - * @param {Module} module module tied to dependency - * @param {Error} err error thrown - * @param {DependencyLocation} loc location of dependency - */ - constructor(module, err, loc) { - super(err.message); +/** + * @typedef {Object} ParserStateBase + * @property {string | Buffer} source + * @property {NormalModule} current + * @property {NormalModule} module + * @property {Compilation} compilation + * @property {{[k: string]: any}} options + */ - this.name = "ModuleDependencyError"; - this.details = - err && !(/** @type {any} */ (err).hideStack) - ? err.stack.split("\n").slice(1).join("\n") - : undefined; - this.module = module; - this.loc = loc; - /** error is not (de)serialized, so it might be undefined after deserialization */ - this.error = err; +/** @typedef {Record & ParserStateBase} ParserState */ - if (err && /** @type {any} */ (err).hideStack) { - this.stack = - err.stack.split("\n").slice(1).join("\n") + "\n\n" + this.stack; - } +class Parser { + /* istanbul ignore next */ + /** + * @abstract + * @param {string | Buffer | PreparsedAst} source the source to parse + * @param {ParserState} state the parser state + * @returns {ParserState} the parser state + */ + parse(source, state) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } } -module.exports = ModuleDependencyError; +module.exports = Parser; /***/ }), -/***/ 29656: +/***/ 73850: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -52118,49 +51161,54 @@ module.exports = ModuleDependencyError; -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); +const PrefetchDependency = __webpack_require__(31618); -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("./Module")} Module */ +/** @typedef {import("./Compiler")} Compiler */ + +class PrefetchPlugin { + constructor(context, request) { + if (request) { + this.context = context; + this.request = request; + } else { + this.context = null; + this.request = context; + } + } -class ModuleDependencyWarning extends WebpackError { /** - * @param {Module} module module tied to dependency - * @param {Error} err error thrown - * @param {DependencyLocation} loc location of dependency + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - constructor(module, err, loc) { - super(err ? err.message : ""); - - this.name = "ModuleDependencyWarning"; - this.details = - err && !(/** @type {any} */ (err).hideStack) - ? err.stack.split("\n").slice(1).join("\n") - : undefined; - this.module = module; - this.loc = loc; - /** error is not (de)serialized, so it might be undefined after deserialization */ - this.error = err; - - if (err && /** @type {any} */ (err).hideStack) { - this.stack = - err.stack.split("\n").slice(1).join("\n") + "\n\n" + this.stack; - } + apply(compiler) { + compiler.hooks.compilation.tap( + "PrefetchPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + PrefetchDependency, + normalModuleFactory + ); + } + ); + compiler.hooks.make.tapAsync("PrefetchPlugin", (compilation, callback) => { + compilation.addModuleChain( + this.context || compiler.context, + new PrefetchDependency(this.request), + err => { + callback(err); + } + ); + }); } } -makeSerializable( - ModuleDependencyWarning, - "webpack/lib/ModuleDependencyWarning" -); - -module.exports = ModuleDependencyWarning; +module.exports = PrefetchPlugin; /***/ }), -/***/ 23744: +/***/ 13216: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -52171,408 +51219,596 @@ module.exports = ModuleDependencyWarning; -const { cleanUp } = __webpack_require__(59985); -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); - -class ModuleError extends WebpackError { - /** - * @param {Error} err error thrown - * @param {{from?: string|null}} info additional info - */ - constructor(err, { from = null } = {}) { - let message = "Module Error"; - - if (from) { - message += ` (from ${from}):\n`; - } else { - message += ": "; - } - - if (err && typeof err === "object" && err.message) { - message += err.message; - } else if (err) { - message += err; - } +const Compiler = __webpack_require__(70845); +const MultiCompiler = __webpack_require__(33370); +const NormalModule = __webpack_require__(39); +const createSchemaValidation = __webpack_require__(32540); +const { contextify } = __webpack_require__(82186); - super(message); +/** @typedef {import("../declarations/plugins/ProgressPlugin").HandlerFunction} HandlerFunction */ +/** @typedef {import("../declarations/plugins/ProgressPlugin").ProgressPluginArgument} ProgressPluginArgument */ +/** @typedef {import("../declarations/plugins/ProgressPlugin").ProgressPluginOptions} ProgressPluginOptions */ - this.name = "ModuleError"; - this.error = err; - this.details = - err && typeof err === "object" && err.stack - ? cleanUp(err.stack, this.message) - : undefined; +const validate = createSchemaValidation( + __webpack_require__(57647), + () => __webpack_require__(75202), + { + name: "Progress Plugin", + baseDataPath: "options" } +); +const median3 = (a, b, c) => { + return a + b + c - Math.max(a, b, c) - Math.min(a, b, c); +}; - serialize(context) { - const { write } = context; +const createDefaultHandler = (profile, logger) => { + /** @type {{ value: string, time: number }[]} */ + const lastStateInfo = []; - write(this.error); + const defaultHandler = (percentage, msg, ...args) => { + if (profile) { + if (percentage === 0) { + lastStateInfo.length = 0; + } + const fullState = [msg, ...args]; + const state = fullState.map(s => s.replace(/\d+\/\d+ /g, "")); + const now = Date.now(); + const len = Math.max(state.length, lastStateInfo.length); + for (let i = len; i >= 0; i--) { + const stateItem = i < state.length ? state[i] : undefined; + const lastStateItem = + i < lastStateInfo.length ? lastStateInfo[i] : undefined; + if (lastStateItem) { + if (stateItem !== lastStateItem.value) { + const diff = now - lastStateItem.time; + if (lastStateItem.value) { + let reportState = lastStateItem.value; + if (i > 0) { + reportState = lastStateInfo[i - 1].value + " > " + reportState; + } + const stateMsg = `${" | ".repeat(i)}${diff} ms ${reportState}`; + const d = diff; + // This depends on timing so we ignore it for coverage + /* istanbul ignore next */ + { + if (d > 10000) { + logger.error(stateMsg); + } else if (d > 1000) { + logger.warn(stateMsg); + } else if (d > 10) { + logger.info(stateMsg); + } else if (d > 5) { + logger.log(stateMsg); + } else { + logger.debug(stateMsg); + } + } + } + if (stateItem === undefined) { + lastStateInfo.length = i; + } else { + lastStateItem.value = stateItem; + lastStateItem.time = now; + lastStateInfo.length = i + 1; + } + } + } else { + lastStateInfo[i] = { + value: stateItem, + time: now + }; + } + } + } + logger.status(`${Math.floor(percentage * 100)}%`, msg, ...args); + if (percentage === 1 || (!msg && args.length === 0)) logger.status(); + }; - super.serialize(context); - } + return defaultHandler; +}; - deserialize(context) { - const { read } = context; +/** + * @callback ReportProgress + * @param {number} p + * @param {...string} [args] + * @returns {void} + */ - this.error = read(); +/** @type {WeakMap} */ +const progressReporters = new WeakMap(); - super.deserialize(context); +class ProgressPlugin { + /** + * @param {Compiler} compiler the current compiler + * @returns {ReportProgress} a progress reporter, if any + */ + static getReporter(compiler) { + return progressReporters.get(compiler); } -} - -makeSerializable(ModuleError, "webpack/lib/ModuleError"); -module.exports = ModuleError; + /** + * @param {ProgressPluginArgument} options options + */ + constructor(options = {}) { + if (typeof options === "function") { + options = { + handler: options + }; + } + validate(options); + options = { ...ProgressPlugin.defaultOptions, ...options }; -/***/ }), + this.profile = options.profile; + this.handler = options.handler; + this.modulesCount = options.modulesCount; + this.dependenciesCount = options.dependenciesCount; + this.showEntries = options.entries; + this.showModules = options.modules; + this.showDependencies = options.dependencies; + this.showActiveModules = options.activeModules; + this.percentBy = options.percentBy; + } -/***/ 51010: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * @param {Compiler | MultiCompiler} compiler webpack compiler + * @returns {void} + */ + apply(compiler) { + const handler = + this.handler || + createDefaultHandler( + this.profile, + compiler.getInfrastructureLogger("webpack.Progress") + ); + if (compiler instanceof MultiCompiler) { + this._applyOnMultiCompiler(compiler, handler); + } else if (compiler instanceof Compiler) { + this._applyOnCompiler(compiler, handler); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {MultiCompiler} compiler webpack multi-compiler + * @param {HandlerFunction} handler function that executes for every progress step + * @returns {void} + */ + _applyOnMultiCompiler(compiler, handler) { + const states = compiler.compilers.map( + () => /** @type {[number, ...string[]]} */ ([0]) + ); + compiler.compilers.forEach((compiler, idx) => { + new ProgressPlugin((p, msg, ...args) => { + states[idx] = [p, msg, ...args]; + let sum = 0; + for (const [p] of states) sum += p; + handler(sum / states.length, `[${idx}] ${msg}`, ...args); + }).apply(compiler); + }); + } + /** + * @param {Compiler} compiler webpack compiler + * @param {HandlerFunction} handler function that executes for every progress step + * @returns {void} + */ + _applyOnCompiler(compiler, handler) { + const showEntries = this.showEntries; + const showModules = this.showModules; + const showDependencies = this.showDependencies; + const showActiveModules = this.showActiveModules; + let lastActiveModule = ""; + let currentLoader = ""; + let lastModulesCount = 0; + let lastDependenciesCount = 0; + let lastEntriesCount = 0; + let modulesCount = 0; + let dependenciesCount = 0; + let entriesCount = 1; + let doneModules = 0; + let doneDependencies = 0; + let doneEntries = 0; + const activeModules = new Set(); + let lastUpdate = 0; + const updateThrottled = () => { + if (lastUpdate + 500 < Date.now()) update(); + }; -/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./Module")} Module */ + const update = () => { + /** @type {string[]} */ + const items = []; + const percentByModules = + doneModules / + Math.max(lastModulesCount || this.modulesCount || 1, modulesCount); + const percentByEntries = + doneEntries / + Math.max(lastEntriesCount || this.dependenciesCount || 1, entriesCount); + const percentByDependencies = + doneDependencies / + Math.max(lastDependenciesCount || 1, dependenciesCount); + let percentageFactor; -/** - * @typedef {Object} ModuleFactoryResult - * @property {Module=} module the created module or unset if no module was created - * @property {Set=} fileDependencies - * @property {Set=} contextDependencies - * @property {Set=} missingDependencies - * @property {boolean=} cacheable allow to use the unsafe cache - */ + switch (this.percentBy) { + case "entries": + percentageFactor = percentByEntries; + break; + case "dependencies": + percentageFactor = percentByDependencies; + break; + case "modules": + percentageFactor = percentByModules; + break; + default: + percentageFactor = median3( + percentByModules, + percentByEntries, + percentByDependencies + ); + } -/** - * @typedef {Object} ModuleFactoryCreateDataContextInfo - * @property {string} issuer - * @property {string | null=} issuerLayer - * @property {string} compiler - */ + const percentage = 0.1 + percentageFactor * 0.55; -/** - * @typedef {Object} ModuleFactoryCreateData - * @property {ModuleFactoryCreateDataContextInfo} contextInfo - * @property {ResolveOptions=} resolveOptions - * @property {string} context - * @property {Dependency[]} dependencies - */ + if (currentLoader) { + items.push( + `import loader ${contextify( + compiler.context, + currentLoader, + compiler.root + )}` + ); + } else { + const statItems = []; + if (showEntries) { + statItems.push(`${doneEntries}/${entriesCount} entries`); + } + if (showDependencies) { + statItems.push( + `${doneDependencies}/${dependenciesCount} dependencies` + ); + } + if (showModules) { + statItems.push(`${doneModules}/${modulesCount} modules`); + } + if (showActiveModules) { + statItems.push(`${activeModules.size} active`); + } + if (statItems.length > 0) { + items.push(statItems.join(" ")); + } + if (showActiveModules) { + items.push(lastActiveModule); + } + } + handler(percentage, "building", ...items); + lastUpdate = Date.now(); + }; -class ModuleFactory { - /* istanbul ignore next */ - /** - * @abstract - * @param {ModuleFactoryCreateData} data data object - * @param {function(Error=, ModuleFactoryResult=): void} callback callback - * @returns {void} - */ - create(data, callback) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); - } -} + const factorizeAdd = () => { + dependenciesCount++; + if (dependenciesCount < 50 || dependenciesCount % 100 === 0) + updateThrottled(); + }; -module.exports = ModuleFactory; + const factorizeDone = () => { + doneDependencies++; + if (doneDependencies < 50 || doneDependencies % 100 === 0) + updateThrottled(); + }; + const moduleAdd = () => { + modulesCount++; + if (modulesCount < 50 || modulesCount % 100 === 0) updateThrottled(); + }; -/***/ }), + // only used when showActiveModules is set + const moduleBuild = module => { + const ident = module.identifier(); + if (ident) { + activeModules.add(ident); + lastActiveModule = ident; + update(); + } + }; -/***/ 88821: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + const entryAdd = (entry, options) => { + entriesCount++; + if (entriesCount < 5 || entriesCount % 10 === 0) updateThrottled(); + }; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const moduleDone = module => { + doneModules++; + if (showActiveModules) { + const ident = module.identifier(); + if (ident) { + activeModules.delete(ident); + if (lastActiveModule === ident) { + lastActiveModule = ""; + for (const m of activeModules) { + lastActiveModule = m; + } + update(); + return; + } + } + } + if (doneModules < 50 || doneModules % 100 === 0) updateThrottled(); + }; + const entryDone = (entry, options) => { + doneEntries++; + update(); + }; + const cache = compiler + .getCache("ProgressPlugin") + .getItemCache("counts", null); -const NormalModule = __webpack_require__(39); -const createHash = __webpack_require__(49835); -const memoize = __webpack_require__(78676); + let cacheGetPromise; -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {typeof import("./util/Hash")} Hash */ + compiler.hooks.beforeCompile.tap("ProgressPlugin", () => { + if (!cacheGetPromise) { + cacheGetPromise = cache.getPromise().then( + data => { + if (data) { + lastModulesCount = lastModulesCount || data.modulesCount; + lastDependenciesCount = + lastDependenciesCount || data.dependenciesCount; + } + return data; + }, + err => { + // Ignore error + } + ); + } + }); -const ModuleFilenameHelpers = exports; + compiler.hooks.afterCompile.tapPromise("ProgressPlugin", compilation => { + if (compilation.compiler.isChild()) return Promise.resolve(); + return cacheGetPromise.then(async oldData => { + if ( + !oldData || + oldData.modulesCount !== modulesCount || + oldData.dependenciesCount !== dependenciesCount + ) { + await cache.storePromise({ modulesCount, dependenciesCount }); + } + }); + }); -// TODO webpack 6: consider removing these -ModuleFilenameHelpers.ALL_LOADERS_RESOURCE = "[all-loaders][resource]"; -ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE = - /\[all-?loaders\]\[resource\]/gi; -ModuleFilenameHelpers.LOADERS_RESOURCE = "[loaders][resource]"; -ModuleFilenameHelpers.REGEXP_LOADERS_RESOURCE = /\[loaders\]\[resource\]/gi; -ModuleFilenameHelpers.RESOURCE = "[resource]"; -ModuleFilenameHelpers.REGEXP_RESOURCE = /\[resource\]/gi; -ModuleFilenameHelpers.ABSOLUTE_RESOURCE_PATH = "[absolute-resource-path]"; -// cSpell:words olute -ModuleFilenameHelpers.REGEXP_ABSOLUTE_RESOURCE_PATH = - /\[abs(olute)?-?resource-?path\]/gi; -ModuleFilenameHelpers.RESOURCE_PATH = "[resource-path]"; -ModuleFilenameHelpers.REGEXP_RESOURCE_PATH = /\[resource-?path\]/gi; -ModuleFilenameHelpers.ALL_LOADERS = "[all-loaders]"; -ModuleFilenameHelpers.REGEXP_ALL_LOADERS = /\[all-?loaders\]/gi; -ModuleFilenameHelpers.LOADERS = "[loaders]"; -ModuleFilenameHelpers.REGEXP_LOADERS = /\[loaders\]/gi; -ModuleFilenameHelpers.QUERY = "[query]"; -ModuleFilenameHelpers.REGEXP_QUERY = /\[query\]/gi; -ModuleFilenameHelpers.ID = "[id]"; -ModuleFilenameHelpers.REGEXP_ID = /\[id\]/gi; -ModuleFilenameHelpers.HASH = "[hash]"; -ModuleFilenameHelpers.REGEXP_HASH = /\[hash\]/gi; -ModuleFilenameHelpers.NAMESPACE = "[namespace]"; -ModuleFilenameHelpers.REGEXP_NAMESPACE = /\[namespace\]/gi; + compiler.hooks.compilation.tap("ProgressPlugin", compilation => { + if (compilation.compiler.isChild()) return; + lastModulesCount = modulesCount; + lastEntriesCount = entriesCount; + lastDependenciesCount = dependenciesCount; + modulesCount = dependenciesCount = entriesCount = 0; + doneModules = doneDependencies = doneEntries = 0; -const getAfter = (strFn, token) => { - return () => { - const str = strFn(); - const idx = str.indexOf(token); - return idx < 0 ? "" : str.substr(idx); - }; -}; + compilation.factorizeQueue.hooks.added.tap( + "ProgressPlugin", + factorizeAdd + ); + compilation.factorizeQueue.hooks.result.tap( + "ProgressPlugin", + factorizeDone + ); -const getBefore = (strFn, token) => { - return () => { - const str = strFn(); - const idx = str.lastIndexOf(token); - return idx < 0 ? "" : str.substr(0, idx); - }; -}; + compilation.addModuleQueue.hooks.added.tap("ProgressPlugin", moduleAdd); + compilation.processDependenciesQueue.hooks.result.tap( + "ProgressPlugin", + moduleDone + ); -const getHash = (strFn, hashFunction) => { - return () => { - const hash = createHash(hashFunction); - hash.update(strFn()); - const digest = /** @type {string} */ (hash.digest("hex")); - return digest.substr(0, 4); - }; -}; + if (showActiveModules) { + compilation.hooks.buildModule.tap("ProgressPlugin", moduleBuild); + } -const asRegExp = test => { - if (typeof test === "string") { - test = new RegExp("^" + test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")); - } - return test; -}; + compilation.hooks.addEntry.tap("ProgressPlugin", entryAdd); + compilation.hooks.failedEntry.tap("ProgressPlugin", entryDone); + compilation.hooks.succeedEntry.tap("ProgressPlugin", entryDone); -const lazyObject = obj => { - const newObj = {}; - for (const key of Object.keys(obj)) { - const fn = obj[key]; - Object.defineProperty(newObj, key, { - get: () => fn(), - set: v => { - Object.defineProperty(newObj, key, { - value: v, - enumerable: true, - writable: true + // avoid dynamic require if bundled with webpack + // @ts-expect-error + if (false) {} + + const hooks = { + finishModules: "finish module graph", + seal: "plugins", + optimizeDependencies: "dependencies optimization", + afterOptimizeDependencies: "after dependencies optimization", + beforeChunks: "chunk graph", + afterChunks: "after chunk graph", + optimize: "optimizing", + optimizeModules: "module optimization", + afterOptimizeModules: "after module optimization", + optimizeChunks: "chunk optimization", + afterOptimizeChunks: "after chunk optimization", + optimizeTree: "module and chunk tree optimization", + afterOptimizeTree: "after module and chunk tree optimization", + optimizeChunkModules: "chunk modules optimization", + afterOptimizeChunkModules: "after chunk modules optimization", + reviveModules: "module reviving", + beforeModuleIds: "before module ids", + moduleIds: "module ids", + optimizeModuleIds: "module id optimization", + afterOptimizeModuleIds: "module id optimization", + reviveChunks: "chunk reviving", + beforeChunkIds: "before chunk ids", + chunkIds: "chunk ids", + optimizeChunkIds: "chunk id optimization", + afterOptimizeChunkIds: "after chunk id optimization", + recordModules: "record modules", + recordChunks: "record chunks", + beforeModuleHash: "module hashing", + beforeCodeGeneration: "code generation", + beforeRuntimeRequirements: "runtime requirements", + beforeHash: "hashing", + afterHash: "after hashing", + recordHash: "record hash", + beforeModuleAssets: "module assets processing", + beforeChunkAssets: "chunk assets processing", + processAssets: "asset processing", + afterProcessAssets: "after asset optimization", + record: "recording", + afterSeal: "after seal" + }; + const numberOfHooks = Object.keys(hooks).length; + Object.keys(hooks).forEach((name, idx) => { + const title = hooks[name]; + const percentage = (idx / numberOfHooks) * 0.25 + 0.7; + compilation.hooks[name].intercept({ + name: "ProgressPlugin", + call() { + handler(percentage, "sealing", title); + }, + done() { + progressReporters.set(compiler, undefined); + handler(percentage, "sealing", title); + }, + result() { + handler(percentage, "sealing", title); + }, + error() { + handler(percentage, "sealing", title); + }, + tap(tap) { + // p is percentage from 0 to 1 + // args is any number of messages in a hierarchical matter + progressReporters.set(compilation.compiler, (p, ...args) => { + handler(percentage, "sealing", title, tap.name, ...args); + }); + handler(percentage, "sealing", title, tap.name); + } }); + }); + }); + compiler.hooks.make.intercept({ + name: "ProgressPlugin", + call() { + handler(0.1, "building"); }, - enumerable: true, - configurable: true + done() { + handler(0.65, "building"); + } }); - } - return newObj; -}; - -const REGEXP = /\[\\*([\w-]+)\\*\]/gi; - -/** - * - * @param {Module | string} module the module - * @param {TODO} options options - * @param {Object} contextInfo context info - * @param {RequestShortener} contextInfo.requestShortener requestShortener - * @param {ChunkGraph} contextInfo.chunkGraph chunk graph - * @param {string | Hash} contextInfo.hashFunction the hash function to use - * @returns {string} the filename - */ -ModuleFilenameHelpers.createFilename = ( - module = "", - options, - { requestShortener, chunkGraph, hashFunction = "md4" } -) => { - const opts = { - namespace: "", - moduleFilenameTemplate: "", - ...(typeof options === "object" - ? options - : { - moduleFilenameTemplate: options - }) - }; - - let absoluteResourcePath; - let hash; - let identifier; - let moduleId; - let shortIdentifier; - if (typeof module === "string") { - shortIdentifier = memoize(() => requestShortener.shorten(module)); - identifier = shortIdentifier; - moduleId = () => ""; - absoluteResourcePath = () => module.split("!").pop(); - hash = getHash(identifier, hashFunction); - } else { - shortIdentifier = memoize(() => - module.readableIdentifier(requestShortener) + const interceptHook = (hook, progress, category, name) => { + hook.intercept({ + name: "ProgressPlugin", + call() { + handler(progress, category, name); + }, + done() { + progressReporters.set(compiler, undefined); + handler(progress, category, name); + }, + result() { + handler(progress, category, name); + }, + error() { + handler(progress, category, name); + }, + tap(tap) { + progressReporters.set(compiler, (p, ...args) => { + handler(progress, category, name, tap.name, ...args); + }); + handler(progress, category, name, tap.name); + } + }); + }; + compiler.cache.hooks.endIdle.intercept({ + name: "ProgressPlugin", + call() { + handler(0, ""); + } + }); + interceptHook(compiler.cache.hooks.endIdle, 0.01, "cache", "end idle"); + compiler.hooks.initialize.intercept({ + name: "ProgressPlugin", + call() { + handler(0, ""); + } + }); + interceptHook(compiler.hooks.initialize, 0.01, "setup", "initialize"); + interceptHook(compiler.hooks.beforeRun, 0.02, "setup", "before run"); + interceptHook(compiler.hooks.run, 0.03, "setup", "run"); + interceptHook(compiler.hooks.watchRun, 0.03, "setup", "watch run"); + interceptHook( + compiler.hooks.normalModuleFactory, + 0.04, + "setup", + "normal module factory" ); - identifier = memoize(() => requestShortener.shorten(module.identifier())); - moduleId = () => chunkGraph.getModuleId(module); - absoluteResourcePath = () => - module instanceof NormalModule - ? module.resource - : module.identifier().split("!").pop(); - hash = getHash(identifier, hashFunction); - } - const resource = memoize(() => shortIdentifier().split("!").pop()); - - const loaders = getBefore(shortIdentifier, "!"); - const allLoaders = getBefore(identifier, "!"); - const query = getAfter(resource, "?"); - const resourcePath = () => { - const q = query().length; - return q === 0 ? resource() : resource().slice(0, -q); - }; - if (typeof opts.moduleFilenameTemplate === "function") { - return opts.moduleFilenameTemplate( - lazyObject({ - identifier: identifier, - shortIdentifier: shortIdentifier, - resource: resource, - resourcePath: memoize(resourcePath), - absoluteResourcePath: memoize(absoluteResourcePath), - allLoaders: memoize(allLoaders), - query: memoize(query), - moduleId: memoize(moduleId), - hash: memoize(hash), - namespace: () => opts.namespace - }) + interceptHook( + compiler.hooks.contextModuleFactory, + 0.05, + "setup", + "context module factory" ); - } - - // TODO webpack 6: consider removing alternatives without dashes - /** @type {Map} */ - const replacements = new Map([ - ["identifier", identifier], - ["short-identifier", shortIdentifier], - ["resource", resource], - ["resource-path", resourcePath], - // cSpell:words resourcepath - ["resourcepath", resourcePath], - ["absolute-resource-path", absoluteResourcePath], - ["abs-resource-path", absoluteResourcePath], - // cSpell:words absoluteresource - ["absoluteresource-path", absoluteResourcePath], - // cSpell:words absresource - ["absresource-path", absoluteResourcePath], - // cSpell:words resourcepath - ["absolute-resourcepath", absoluteResourcePath], - // cSpell:words resourcepath - ["abs-resourcepath", absoluteResourcePath], - // cSpell:words absoluteresourcepath - ["absoluteresourcepath", absoluteResourcePath], - // cSpell:words absresourcepath - ["absresourcepath", absoluteResourcePath], - ["all-loaders", allLoaders], - // cSpell:words allloaders - ["allloaders", allLoaders], - ["loaders", loaders], - ["query", query], - ["id", moduleId], - ["hash", hash], - ["namespace", () => opts.namespace] - ]); - - // TODO webpack 6: consider removing weird double placeholders - return opts.moduleFilenameTemplate - .replace(ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE, "[identifier]") - .replace( - ModuleFilenameHelpers.REGEXP_LOADERS_RESOURCE, - "[short-identifier]" - ) - .replace(REGEXP, (match, content) => { - if (content.length + 2 === match.length) { - const replacement = replacements.get(content.toLowerCase()); - if (replacement !== undefined) { - return replacement(); - } - } else if (match.startsWith("[\\") && match.endsWith("\\]")) { - return `[${match.slice(2, -2)}]`; + interceptHook( + compiler.hooks.beforeCompile, + 0.06, + "setup", + "before compile" + ); + interceptHook(compiler.hooks.compile, 0.07, "setup", "compile"); + interceptHook(compiler.hooks.thisCompilation, 0.08, "setup", "compilation"); + interceptHook(compiler.hooks.compilation, 0.09, "setup", "compilation"); + interceptHook(compiler.hooks.finishMake, 0.69, "building", "finish"); + interceptHook(compiler.hooks.emit, 0.95, "emitting", "emit"); + interceptHook(compiler.hooks.afterEmit, 0.98, "emitting", "after emit"); + interceptHook(compiler.hooks.done, 0.99, "done", "plugins"); + compiler.hooks.done.intercept({ + name: "ProgressPlugin", + done() { + handler(0.99, ""); } - return match; }); -}; - -ModuleFilenameHelpers.replaceDuplicates = (array, fn, comparator) => { - const countMap = Object.create(null); - const posMap = Object.create(null); - array.forEach((item, idx) => { - countMap[item] = countMap[item] || []; - countMap[item].push(idx); - posMap[item] = 0; - }); - if (comparator) { - Object.keys(countMap).forEach(item => { - countMap[item].sort(comparator); + interceptHook( + compiler.cache.hooks.storeBuildDependencies, + 0.99, + "cache", + "store build dependencies" + ); + interceptHook(compiler.cache.hooks.shutdown, 0.99, "cache", "shutdown"); + interceptHook(compiler.cache.hooks.beginIdle, 0.99, "cache", "begin idle"); + interceptHook( + compiler.hooks.watchClose, + 0.99, + "end", + "closing watch compilation" + ); + compiler.cache.hooks.beginIdle.intercept({ + name: "ProgressPlugin", + done() { + handler(1, ""); + } + }); + compiler.cache.hooks.shutdown.intercept({ + name: "ProgressPlugin", + done() { + handler(1, ""); + } }); } - return array.map((item, i) => { - if (countMap[item].length > 1) { - if (comparator && countMap[item][0] === i) return item; - return fn(item, i, posMap[item]++); - } else { - return item; - } - }); -}; +} -ModuleFilenameHelpers.matchPart = (str, test) => { - if (!test) return true; - test = asRegExp(test); - if (Array.isArray(test)) { - return test.map(asRegExp).some(regExp => regExp.test(str)); - } else { - return test.test(str); - } +ProgressPlugin.defaultOptions = { + profile: false, + modulesCount: 5000, + dependenciesCount: 10000, + modules: true, + dependencies: true, + activeModules: false, + entries: true }; -ModuleFilenameHelpers.matchObject = (obj, str) => { - if (obj.test) { - if (!ModuleFilenameHelpers.matchPart(str, obj.test)) { - return false; - } - } - if (obj.include) { - if (!ModuleFilenameHelpers.matchPart(str, obj.include)) { - return false; - } - } - if (obj.exclude) { - if (ModuleFilenameHelpers.matchPart(str, obj.exclude)) { - return false; - } - } - return true; -}; +module.exports = ProgressPlugin; /***/ }), -/***/ 99988: +/***/ 38309: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -52583,861 +51819,798 @@ ModuleFilenameHelpers.matchObject = (obj, str) => { -const util = __webpack_require__(73837); -const ExportsInfo = __webpack_require__(63686); -const ModuleGraphConnection = __webpack_require__(40639); -const SortableSet = __webpack_require__(13098); -const WeakTupleMap = __webpack_require__(28745); - -/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./ExportsInfo").ExportInfo} ExportInfo */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleProfile")} ModuleProfile */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - -/** - * @callback OptimizationBailoutFunction - * @param {RequestShortener} requestShortener - * @returns {string} - */ +const ConstDependency = __webpack_require__(76911); +const ProvidedDependency = __webpack_require__(95770); +const { approve } = __webpack_require__(93998); -const EMPTY_SET = new Set(); +/** @typedef {import("./Compiler")} Compiler */ -/** - * @param {SortableSet} set input - * @returns {readonly Map} mapped by origin module - */ -const getConnectionsByOriginModule = set => { - const map = new Map(); - /** @type {Module | 0} */ - let lastModule = 0; - /** @type {ModuleGraphConnection[]} */ - let lastList = undefined; - for (const connection of set) { - const { originModule } = connection; - if (lastModule === originModule) { - lastList.push(connection); - } else { - lastModule = originModule; - const list = map.get(originModule); - if (list !== undefined) { - lastList = list; - list.push(connection); - } else { - const list = [connection]; - lastList = list; - map.set(originModule, list); - } - } +class ProvidePlugin { + /** + * @param {Record} definitions the provided identifiers + */ + constructor(definitions) { + this.definitions = definitions; } - return map; -}; -/** - * @param {SortableSet} set input - * @returns {readonly Map} mapped by module - */ -const getConnectionsByModule = set => { - const map = new Map(); - /** @type {Module | 0} */ - let lastModule = 0; - /** @type {ModuleGraphConnection[]} */ - let lastList = undefined; - for (const connection of set) { - const { module } = connection; - if (lastModule === module) { - lastList.push(connection); - } else { - lastModule = module; - const list = map.get(module); - if (list !== undefined) { - lastList = list; - list.push(connection); - } else { - const list = [connection]; - lastList = list; - map.set(module, list); - } - } - } - return map; -}; + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const definitions = this.definitions; + compiler.hooks.compilation.tap( + "ProvidePlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyTemplates.set( + ConstDependency, + new ConstDependency.Template() + ); + compilation.dependencyFactories.set( + ProvidedDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + ProvidedDependency, + new ProvidedDependency.Template() + ); + const handler = (parser, parserOptions) => { + Object.keys(definitions).forEach(name => { + const request = [].concat(definitions[name]); + const splittedName = name.split("."); + if (splittedName.length > 0) { + splittedName.slice(1).forEach((_, i) => { + const name = splittedName.slice(0, i + 1).join("."); + parser.hooks.canRename.for(name).tap("ProvidePlugin", approve); + }); + } -class ModuleGraphModule { - constructor() { - /** @type {SortableSet} */ - this.incomingConnections = new SortableSet(); - /** @type {SortableSet | undefined} */ - this.outgoingConnections = undefined; - /** @type {Module | null} */ - this.issuer = undefined; - /** @type {(string | OptimizationBailoutFunction)[]} */ - this.optimizationBailout = []; - /** @type {ExportsInfo} */ - this.exports = new ExportsInfo(); - /** @type {number} */ - this.preOrderIndex = null; - /** @type {number} */ - this.postOrderIndex = null; - /** @type {number} */ - this.depth = null; - /** @type {ModuleProfile} */ - this.profile = undefined; - /** @type {boolean} */ - this.async = false; - /** @type {ModuleGraphConnection[]} */ - this._unassignedConnections = undefined; + parser.hooks.expression.for(name).tap("ProvidePlugin", expr => { + const nameIdentifier = name.includes(".") + ? `__webpack_provided_${name.replace(/\./g, "_dot_")}` + : name; + const dep = new ProvidedDependency( + request[0], + nameIdentifier, + request.slice(1), + expr.range + ); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + return true; + }); + + parser.hooks.call.for(name).tap("ProvidePlugin", expr => { + const nameIdentifier = name.includes(".") + ? `__webpack_provided_${name.replace(/\./g, "_dot_")}` + : name; + const dep = new ProvidedDependency( + request[0], + nameIdentifier, + request.slice(1), + expr.callee.range + ); + dep.loc = expr.callee.loc; + parser.state.module.addDependency(dep); + parser.walkExpressions(expr.arguments); + return true; + }); + }); + }; + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("ProvidePlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("ProvidePlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("ProvidePlugin", handler); + } + ); } } -class ModuleGraph { - constructor() { - /** @type {WeakMap} */ - this._dependencyMap = new WeakMap(); - /** @type {Map} */ - this._moduleMap = new Map(); - /** @type {WeakMap} */ - this._metaMap = new WeakMap(); +module.exports = ProvidePlugin; - /** @type {WeakTupleMap} */ - this._cache = undefined; - /** @type {Map>} */ - this._moduleMemCaches = undefined; - } +/***/ }), + +/***/ 84929: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { OriginalSource, RawSource } = __webpack_require__(51255); +const Module = __webpack_require__(73208); +const makeSerializable = __webpack_require__(33032); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./util/Hash")} Hash */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ + +const TYPES = new Set(["javascript"]); +class RawModule extends Module { /** - * @param {Module} module the module - * @returns {ModuleGraphModule} the internal module + * @param {string} source source code + * @param {string} identifier unique identifier + * @param {string=} readableIdentifier readable identifier + * @param {ReadonlySet=} runtimeRequirements runtime requirements needed for the source code */ - _getModuleGraphModule(module) { - let mgm = this._moduleMap.get(module); - if (mgm === undefined) { - mgm = new ModuleGraphModule(); - this._moduleMap.set(module, mgm); - } - return mgm; + constructor(source, identifier, readableIdentifier, runtimeRequirements) { + super("javascript/dynamic", null); + this.sourceStr = source; + this.identifierStr = identifier || this.sourceStr; + this.readableIdentifierStr = readableIdentifier || this.identifierStr; + this.runtimeRequirements = runtimeRequirements || null; } /** - * @param {Dependency} dependency the dependency - * @param {DependenciesBlock} block parent block - * @param {Module} module parent module - * @param {number=} indexInBlock position in block - * @returns {void} + * @returns {Set} types available (do not mutate) */ - setParents(dependency, block, module, indexInBlock = -1) { - dependency._parentDependenciesBlockIndex = indexInBlock; - dependency._parentDependenciesBlock = block; - dependency._parentModule = module; + getSourceTypes() { + return TYPES; } /** - * @param {Dependency} dependency the dependency - * @returns {Module} parent module + * @returns {string} a unique identifier of the module */ - getParentModule(dependency) { - return dependency._parentModule; + identifier() { + return this.identifierStr; } /** - * @param {Dependency} dependency the dependency - * @returns {DependenciesBlock} parent block + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) */ - getParentBlock(dependency) { - return dependency._parentDependenciesBlock; + size(type) { + return Math.max(1, this.sourceStr.length); } /** - * @param {Dependency} dependency the dependency - * @returns {number} index + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module */ - getParentBlockIndex(dependency) { - return dependency._parentDependenciesBlockIndex; + readableIdentifier(requestShortener) { + return requestShortener.shorten(this.readableIdentifierStr); } /** - * @param {Module} originModule the referencing module - * @param {Dependency} dependency the referencing dependency - * @param {Module} module the referenced module + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild * @returns {void} */ - setResolvedModule(originModule, dependency, module) { - const connection = new ModuleGraphConnection( - originModule, - dependency, - module, - undefined, - dependency.weak, - dependency.getCondition(this) - ); - const connections = this._getModuleGraphModule(module).incomingConnections; - connections.add(connection); - if (originModule) { - const mgm = this._getModuleGraphModule(originModule); - if (mgm._unassignedConnections === undefined) { - mgm._unassignedConnections = []; - } - mgm._unassignedConnections.push(connection); - if (mgm.outgoingConnections === undefined) { - mgm.outgoingConnections = new SortableSet(); - } - mgm.outgoingConnections.add(connection); - } else { - this._dependencyMap.set(dependency, connection); - } + needBuild(context, callback) { + return callback(null, !this.buildMeta); } /** - * @param {Dependency} dependency the referencing dependency - * @param {Module} module the referenced module + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function * @returns {void} */ - updateModule(dependency, module) { - const connection = this.getConnection(dependency); - if (connection.module === module) return; - const newConnection = connection.clone(); - newConnection.module = module; - this._dependencyMap.set(dependency, newConnection); - connection.setActive(false); - const originMgm = this._getModuleGraphModule(connection.originModule); - originMgm.outgoingConnections.add(newConnection); - const targetMgm = this._getModuleGraphModule(module); - targetMgm.incomingConnections.add(newConnection); + build(options, compilation, resolver, fs, callback) { + this.buildMeta = {}; + this.buildInfo = { + cacheable: true + }; + callback(); } /** - * @param {Dependency} dependency the referencing dependency - * @returns {void} + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result */ - removeConnection(dependency) { - const connection = this.getConnection(dependency); - const targetMgm = this._getModuleGraphModule(connection.module); - targetMgm.incomingConnections.delete(connection); - const originMgm = this._getModuleGraphModule(connection.originModule); - originMgm.outgoingConnections.delete(connection); - this._dependencyMap.set(dependency, null); + codeGeneration(context) { + const sources = new Map(); + if (this.useSourceMap || this.useSimpleSourceMap) { + sources.set( + "javascript", + new OriginalSource(this.sourceStr, this.identifier()) + ); + } else { + sources.set("javascript", new RawSource(this.sourceStr)); + } + return { sources, runtimeRequirements: this.runtimeRequirements }; } /** - * @param {Dependency} dependency the referencing dependency - * @param {string} explanation an explanation + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context * @returns {void} */ - addExplanation(dependency, explanation) { - const connection = this.getConnection(dependency); - connection.addExplanation(explanation); + updateHash(hash, context) { + hash.update(this.sourceStr); + super.updateHash(hash, context); } - /** - * @param {Module} sourceModule the source module - * @param {Module} targetModule the target module - * @returns {void} - */ - cloneModuleAttributes(sourceModule, targetModule) { - const oldMgm = this._getModuleGraphModule(sourceModule); - const newMgm = this._getModuleGraphModule(targetModule); - newMgm.postOrderIndex = oldMgm.postOrderIndex; - newMgm.preOrderIndex = oldMgm.preOrderIndex; - newMgm.depth = oldMgm.depth; - newMgm.exports = oldMgm.exports; - newMgm.async = oldMgm.async; + serialize(context) { + const { write } = context; + + write(this.sourceStr); + write(this.identifierStr); + write(this.readableIdentifierStr); + write(this.runtimeRequirements); + + super.serialize(context); } - /** - * @param {Module} module the module - * @returns {void} - */ - removeModuleAttributes(module) { - const mgm = this._getModuleGraphModule(module); - mgm.postOrderIndex = null; - mgm.preOrderIndex = null; - mgm.depth = null; - mgm.async = false; + deserialize(context) { + const { read } = context; + + this.sourceStr = read(); + this.identifierStr = read(); + this.readableIdentifierStr = read(); + this.runtimeRequirements = read(); + + super.deserialize(context); } +} + +makeSerializable(RawModule, "webpack/lib/RawModule"); + +module.exports = RawModule; + + +/***/ }), + +/***/ 11094: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { compareNumbers } = __webpack_require__(29579); +const identifierUtils = __webpack_require__(82186); + +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Module")} Module */ + +/** + * @typedef {Object} RecordsChunks + * @property {Record=} byName + * @property {Record=} bySource + * @property {number[]=} usedIds + */ + +/** + * @typedef {Object} RecordsModules + * @property {Record=} byIdentifier + * @property {Record=} bySource + * @property {number[]=} usedIds + */ +/** + * @typedef {Object} Records + * @property {RecordsChunks=} chunks + * @property {RecordsModules=} modules + */ + +class RecordIdsPlugin { /** - * @returns {void} + * @param {Object} options Options object + * @param {boolean=} options.portableIds true, when ids need to be portable */ - removeAllModuleAttributes() { - for (const mgm of this._moduleMap.values()) { - mgm.postOrderIndex = null; - mgm.preOrderIndex = null; - mgm.depth = null; - mgm.async = false; - } + constructor(options) { + this.options = options || {}; } /** - * @param {Module} oldModule the old referencing module - * @param {Module} newModule the new referencing module - * @param {function(ModuleGraphConnection): boolean} filterConnection filter predicate for replacement + * @param {Compiler} compiler the Compiler * @returns {void} */ - moveModuleConnections(oldModule, newModule, filterConnection) { - if (oldModule === newModule) return; - const oldMgm = this._getModuleGraphModule(oldModule); - const newMgm = this._getModuleGraphModule(newModule); - // Outgoing connections - const oldConnections = oldMgm.outgoingConnections; - if (oldConnections !== undefined) { - if (newMgm.outgoingConnections === undefined) { - newMgm.outgoingConnections = new SortableSet(); - } - const newConnections = newMgm.outgoingConnections; - for (const connection of oldConnections) { - if (filterConnection(connection)) { - connection.originModule = newModule; - newConnections.add(connection); - oldConnections.delete(connection); - } - } - } - // Incoming connections - const oldConnections2 = oldMgm.incomingConnections; - const newConnections2 = newMgm.incomingConnections; - for (const connection of oldConnections2) { - if (filterConnection(connection)) { - connection.module = newModule; - newConnections2.add(connection); - oldConnections2.delete(connection); + apply(compiler) { + const portableIds = this.options.portableIds; + + const makePathsRelative = + identifierUtils.makePathsRelative.bindContextCache( + compiler.context, + compiler.root + ); + + /** + * @param {Module} module the module + * @returns {string} the (portable) identifier + */ + const getModuleIdentifier = module => { + if (portableIds) { + return makePathsRelative(module.identifier()); } - } - } + return module.identifier(); + }; - /** - * @param {Module} oldModule the old referencing module - * @param {Module} newModule the new referencing module - * @param {function(ModuleGraphConnection): boolean} filterConnection filter predicate for replacement - * @returns {void} - */ - copyOutgoingModuleConnections(oldModule, newModule, filterConnection) { - if (oldModule === newModule) return; - const oldMgm = this._getModuleGraphModule(oldModule); - const newMgm = this._getModuleGraphModule(newModule); - // Outgoing connections - const oldConnections = oldMgm.outgoingConnections; - if (oldConnections !== undefined) { - if (newMgm.outgoingConnections === undefined) { - newMgm.outgoingConnections = new SortableSet(); - } - const newConnections = newMgm.outgoingConnections; - for (const connection of oldConnections) { - if (filterConnection(connection)) { - const newConnection = connection.clone(); - newConnection.originModule = newModule; - newConnections.add(newConnection); - if (newConnection.module !== undefined) { - const otherMgm = this._getModuleGraphModule(newConnection.module); - otherMgm.incomingConnections.add(newConnection); + compiler.hooks.compilation.tap("RecordIdsPlugin", compilation => { + compilation.hooks.recordModules.tap( + "RecordIdsPlugin", + /** + * @param {Module[]} modules the modules array + * @param {Records} records the records object + * @returns {void} + */ + (modules, records) => { + const chunkGraph = compilation.chunkGraph; + if (!records.modules) records.modules = {}; + if (!records.modules.byIdentifier) records.modules.byIdentifier = {}; + /** @type {Set} */ + const usedIds = new Set(); + for (const module of modules) { + const moduleId = chunkGraph.getModuleId(module); + if (typeof moduleId !== "number") continue; + const identifier = getModuleIdentifier(module); + records.modules.byIdentifier[identifier] = moduleId; + usedIds.add(moduleId); } + records.modules.usedIds = Array.from(usedIds).sort(compareNumbers); } - } - } - } - - /** - * @param {Module} module the referenced module - * @param {string} explanation an explanation why it's referenced - * @returns {void} - */ - addExtraReason(module, explanation) { - const connections = this._getModuleGraphModule(module).incomingConnections; - connections.add(new ModuleGraphConnection(null, null, module, explanation)); - } + ); + compilation.hooks.reviveModules.tap( + "RecordIdsPlugin", + /** + * @param {Module[]} modules the modules array + * @param {Records} records the records object + * @returns {void} + */ + (modules, records) => { + if (!records.modules) return; + if (records.modules.byIdentifier) { + const chunkGraph = compilation.chunkGraph; + /** @type {Set} */ + const usedIds = new Set(); + for (const module of modules) { + const moduleId = chunkGraph.getModuleId(module); + if (moduleId !== null) continue; + const identifier = getModuleIdentifier(module); + const id = records.modules.byIdentifier[identifier]; + if (id === undefined) continue; + if (usedIds.has(id)) continue; + usedIds.add(id); + chunkGraph.setModuleId(module, id); + } + } + if (Array.isArray(records.modules.usedIds)) { + compilation.usedModuleIds = new Set(records.modules.usedIds); + } + } + ); - /** - * @param {Dependency} dependency the dependency to look for a referenced module - * @returns {Module} the referenced module - */ - getResolvedModule(dependency) { - const connection = this.getConnection(dependency); - return connection !== undefined ? connection.resolvedModule : null; - } + /** + * @param {Chunk} chunk the chunk + * @returns {string[]} sources of the chunk + */ + const getChunkSources = chunk => { + /** @type {string[]} */ + const sources = []; + for (const chunkGroup of chunk.groupsIterable) { + const index = chunkGroup.chunks.indexOf(chunk); + if (chunkGroup.name) { + sources.push(`${index} ${chunkGroup.name}`); + } else { + for (const origin of chunkGroup.origins) { + if (origin.module) { + if (origin.request) { + sources.push( + `${index} ${getModuleIdentifier(origin.module)} ${ + origin.request + }` + ); + } else if (typeof origin.loc === "string") { + sources.push( + `${index} ${getModuleIdentifier(origin.module)} ${ + origin.loc + }` + ); + } else if ( + origin.loc && + typeof origin.loc === "object" && + "start" in origin.loc + ) { + sources.push( + `${index} ${getModuleIdentifier( + origin.module + )} ${JSON.stringify(origin.loc.start)}` + ); + } + } + } + } + } + return sources; + }; - /** - * @param {Dependency} dependency the dependency to look for a referenced module - * @returns {ModuleGraphConnection | undefined} the connection - */ - getConnection(dependency) { - const connection = this._dependencyMap.get(dependency); - if (connection === undefined) { - const module = this.getParentModule(dependency); - if (module !== undefined) { - const mgm = this._getModuleGraphModule(module); - if ( - mgm._unassignedConnections && - mgm._unassignedConnections.length !== 0 - ) { - let foundConnection; - for (const connection of mgm._unassignedConnections) { - this._dependencyMap.set(connection.dependency, connection); - if (connection.dependency === dependency) - foundConnection = connection; + compilation.hooks.recordChunks.tap( + "RecordIdsPlugin", + /** + * @param {Chunk[]} chunks the chunks array + * @param {Records} records the records object + * @returns {void} + */ + (chunks, records) => { + if (!records.chunks) records.chunks = {}; + if (!records.chunks.byName) records.chunks.byName = {}; + if (!records.chunks.bySource) records.chunks.bySource = {}; + /** @type {Set} */ + const usedIds = new Set(); + for (const chunk of chunks) { + if (typeof chunk.id !== "number") continue; + const name = chunk.name; + if (name) records.chunks.byName[name] = chunk.id; + const sources = getChunkSources(chunk); + for (const source of sources) { + records.chunks.bySource[source] = chunk.id; + } + usedIds.add(chunk.id); } - mgm._unassignedConnections.length = 0; - if (foundConnection !== undefined) { - return foundConnection; + records.chunks.usedIds = Array.from(usedIds).sort(compareNumbers); + } + ); + compilation.hooks.reviveChunks.tap( + "RecordIdsPlugin", + /** + * @param {Chunk[]} chunks the chunks array + * @param {Records} records the records object + * @returns {void} + */ + (chunks, records) => { + if (!records.chunks) return; + /** @type {Set} */ + const usedIds = new Set(); + if (records.chunks.byName) { + for (const chunk of chunks) { + if (chunk.id !== null) continue; + if (!chunk.name) continue; + const id = records.chunks.byName[chunk.name]; + if (id === undefined) continue; + if (usedIds.has(id)) continue; + usedIds.add(id); + chunk.id = id; + chunk.ids = [id]; + } + } + if (records.chunks.bySource) { + for (const chunk of chunks) { + if (chunk.id !== null) continue; + const sources = getChunkSources(chunk); + for (const source of sources) { + const id = records.chunks.bySource[source]; + if (id === undefined) continue; + if (usedIds.has(id)) continue; + usedIds.add(id); + chunk.id = id; + chunk.ids = [id]; + break; + } + } + } + if (Array.isArray(records.chunks.usedIds)) { + compilation.usedChunkIds = new Set(records.chunks.usedIds); } } - } - this._dependencyMap.set(dependency, null); - return undefined; - } - return connection === null ? undefined : connection; + ); + }); } +} +module.exports = RecordIdsPlugin; - /** - * @param {Dependency} dependency the dependency to look for a referenced module - * @returns {Module} the referenced module - */ - getModule(dependency) { - const connection = this.getConnection(dependency); - return connection !== undefined ? connection.module : null; - } - /** - * @param {Dependency} dependency the dependency to look for a referencing module - * @returns {Module} the referencing module - */ - getOrigin(dependency) { - const connection = this.getConnection(dependency); - return connection !== undefined ? connection.originModule : null; - } +/***/ }), - /** - * @param {Dependency} dependency the dependency to look for a referencing module - * @returns {Module} the original referencing module - */ - getResolvedOrigin(dependency) { - const connection = this.getConnection(dependency); - return connection !== undefined ? connection.resolvedOriginModule : null; - } +/***/ 73406: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {Module} module the module - * @returns {Iterable} reasons why a module is included - */ - getIncomingConnections(module) { - const connections = this._getModuleGraphModule(module).incomingConnections; - return connections; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {Module} module the module - * @returns {Iterable} list of outgoing connections - */ - getOutgoingConnections(module) { - const connections = this._getModuleGraphModule(module).outgoingConnections; - return connections === undefined ? EMPTY_SET : connections; - } - /** - * @param {Module} module the module - * @returns {readonly Map} reasons why a module is included, in a map by source module - */ - getIncomingConnectionsByOriginModule(module) { - const connections = this._getModuleGraphModule(module).incomingConnections; - return connections.getFromUnorderedCache(getConnectionsByOriginModule); - } - /** - * @param {Module} module the module - * @returns {readonly Map | undefined} connections to modules, in a map by module - */ - getOutgoingConnectionsByModule(module) { - const connections = this._getModuleGraphModule(module).outgoingConnections; - return connections === undefined - ? undefined - : connections.getFromUnorderedCache(getConnectionsByModule); - } +const { contextify } = __webpack_require__(82186); +class RequestShortener { /** - * @param {Module} module the module - * @returns {ModuleProfile | null} the module profile + * @param {string} dir the directory + * @param {object=} associatedObjectForCache an object to which the cache will be attached */ - getProfile(module) { - const mgm = this._getModuleGraphModule(module); - return mgm.profile; + constructor(dir, associatedObjectForCache) { + this.contextify = contextify.bindContextCache( + dir, + associatedObjectForCache + ); } /** - * @param {Module} module the module - * @param {ModuleProfile | null} profile the module profile - * @returns {void} + * @param {string | undefined | null} request the request to shorten + * @returns {string | undefined | null} the shortened request */ - setProfile(module, profile) { - const mgm = this._getModuleGraphModule(module); - mgm.profile = profile; + shorten(request) { + if (!request) { + return request; + } + return this.contextify(request); } +} - /** - * @param {Module} module the module - * @returns {Module | null} the issuer module - */ - getIssuer(module) { - const mgm = this._getModuleGraphModule(module); - return mgm.issuer; - } +module.exports = RequestShortener; - /** - * @param {Module} module the module - * @param {Module | null} issuer the issuer module - * @returns {void} - */ - setIssuer(module, issuer) { - const mgm = this._getModuleGraphModule(module); - mgm.issuer = issuer; - } - /** - * @param {Module} module the module - * @param {Module | null} issuer the issuer module - * @returns {void} - */ - setIssuerIfUnset(module, issuer) { - const mgm = this._getModuleGraphModule(module); - if (mgm.issuer === undefined) mgm.issuer = issuer; - } +/***/ }), - /** - * @param {Module} module the module - * @returns {(string | OptimizationBailoutFunction)[]} optimization bailouts - */ - getOptimizationBailout(module) { - const mgm = this._getModuleGraphModule(module); - return mgm.optimizationBailout; - } +/***/ 88846: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {Module} module the module - * @returns {true | string[] | null} the provided exports - */ - getProvidedExports(module) { - const mgm = this._getModuleGraphModule(module); - return mgm.exports.getProvidedExports(); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {Module} module the module - * @param {string | string[]} exportName a name of an export - * @returns {boolean | null} true, if the export is provided by the module. - * null, if it's unknown. - * false, if it's not provided. - */ - isExportProvided(module, exportName) { - const mgm = this._getModuleGraphModule(module); - const result = mgm.exports.isExportProvided(exportName); - return result === undefined ? null : result; - } - /** - * @param {Module} module the module - * @returns {ExportsInfo} info about the exports - */ - getExportsInfo(module) { - const mgm = this._getModuleGraphModule(module); - return mgm.exports; - } - /** - * @param {Module} module the module - * @param {string} exportName the export - * @returns {ExportInfo} info about the export - */ - getExportInfo(module, exportName) { - const mgm = this._getModuleGraphModule(module); - return mgm.exports.getExportInfo(exportName); - } +const RuntimeGlobals = __webpack_require__(16475); +const ConstDependency = __webpack_require__(76911); +const { + toConstantDependency +} = __webpack_require__(93998); - /** - * @param {Module} module the module - * @param {string} exportName the export - * @returns {ExportInfo} info about the export (do not modify) - */ - getReadOnlyExportInfo(module, exportName) { - const mgm = this._getModuleGraphModule(module); - return mgm.exports.getReadOnlyExportInfo(exportName); - } +/** @typedef {import("./Compiler")} Compiler */ +module.exports = class RequireJsStuffPlugin { /** - * @param {Module} module the module - * @param {RuntimeSpec} runtime the runtime - * @returns {false | true | SortableSet | null} the used exports - * false: module is not used at all. - * true: the module namespace/object export is used. - * SortableSet: these export names are used. - * empty SortableSet: module is used but no export. - * null: unknown, worst case should be assumed. + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - getUsedExports(module, runtime) { - const mgm = this._getModuleGraphModule(module); - return mgm.exports.getUsedExports(runtime); - } + apply(compiler) { + compiler.hooks.compilation.tap( + "RequireJsStuffPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyTemplates.set( + ConstDependency, + new ConstDependency.Template() + ); + const handler = (parser, parserOptions) => { + if ( + parserOptions.requireJs === undefined || + !parserOptions.requireJs + ) { + return; + } - /** - * @param {Module} module the module - * @returns {number} the index of the module - */ - getPreOrderIndex(module) { - const mgm = this._getModuleGraphModule(module); - return mgm.preOrderIndex; - } + parser.hooks.call + .for("require.config") + .tap( + "RequireJsStuffPlugin", + toConstantDependency(parser, "undefined") + ); + parser.hooks.call + .for("requirejs.config") + .tap( + "RequireJsStuffPlugin", + toConstantDependency(parser, "undefined") + ); - /** - * @param {Module} module the module - * @returns {number} the index of the module - */ - getPostOrderIndex(module) { - const mgm = this._getModuleGraphModule(module); - return mgm.postOrderIndex; + parser.hooks.expression + .for("require.version") + .tap( + "RequireJsStuffPlugin", + toConstantDependency(parser, JSON.stringify("0.0.0")) + ); + parser.hooks.expression + .for("requirejs.onError") + .tap( + "RequireJsStuffPlugin", + toConstantDependency( + parser, + RuntimeGlobals.uncaughtErrorHandler, + [RuntimeGlobals.uncaughtErrorHandler] + ) + ); + }; + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("RequireJsStuffPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("RequireJsStuffPlugin", handler); + } + ); } +}; - /** - * @param {Module} module the module - * @param {number} index the index of the module - * @returns {void} - */ - setPreOrderIndex(module, index) { - const mgm = this._getModuleGraphModule(module); - mgm.preOrderIndex = index; - } - /** - * @param {Module} module the module - * @param {number} index the index of the module - * @returns {boolean} true, if the index was set - */ - setPreOrderIndexIfUnset(module, index) { - const mgm = this._getModuleGraphModule(module); - if (mgm.preOrderIndex === null) { - mgm.preOrderIndex = index; - return true; - } - return false; - } +/***/ }), - /** - * @param {Module} module the module - * @param {number} index the index of the module - * @returns {void} - */ - setPostOrderIndex(module, index) { - const mgm = this._getModuleGraphModule(module); - mgm.postOrderIndex = index; - } +/***/ 30217: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {Module} module the module - * @param {number} index the index of the module - * @returns {boolean} true, if the index was set - */ - setPostOrderIndexIfUnset(module, index) { - const mgm = this._getModuleGraphModule(module); - if (mgm.postOrderIndex === null) { - mgm.postOrderIndex = index; - return true; - } - return false; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {Module} module the module - * @returns {number} the depth of the module - */ - getDepth(module) { - const mgm = this._getModuleGraphModule(module); - return mgm.depth; - } - /** - * @param {Module} module the module - * @param {number} depth the depth of the module - * @returns {void} - */ - setDepth(module, depth) { - const mgm = this._getModuleGraphModule(module); - mgm.depth = depth; - } - /** - * @param {Module} module the module - * @param {number} depth the depth of the module - * @returns {boolean} true, if the depth was set - */ - setDepthIfLower(module, depth) { - const mgm = this._getModuleGraphModule(module); - if (mgm.depth === null || mgm.depth > depth) { - mgm.depth = depth; - return true; - } - return false; - } +const Factory = (__webpack_require__(9256).ResolverFactory); +const { HookMap, SyncHook, SyncWaterfallHook } = __webpack_require__(6967); +const { + cachedCleverMerge, + removeOperations, + resolveByProperty +} = __webpack_require__(60839); - /** - * @param {Module} module the module - * @returns {boolean} true, if the module is async - */ - isAsync(module) { - const mgm = this._getModuleGraphModule(module); - return mgm.async; - } +/** @typedef {import("enhanced-resolve").ResolveOptions} ResolveOptions */ +/** @typedef {import("enhanced-resolve").Resolver} Resolver */ +/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} WebpackResolveOptions */ +/** @typedef {import("../declarations/WebpackOptions").ResolvePluginInstance} ResolvePluginInstance */ - /** - * @param {Module} module the module - * @returns {void} - */ - setAsync(module) { - const mgm = this._getModuleGraphModule(module); - mgm.async = true; - } +/** @typedef {WebpackResolveOptions & {dependencyType?: string, resolveToContext?: boolean }} ResolveOptionsWithDependencyType */ +/** + * @typedef {Object} WithOptions + * @property {function(Partial): ResolverWithOptions} withOptions create a resolver with additional/different options + */ - /** - * @param {any} thing any thing - * @returns {Object} metadata - */ - getMeta(thing) { - let meta = this._metaMap.get(thing); - if (meta === undefined) { - meta = Object.create(null); - this._metaMap.set(thing, meta); - } - return meta; - } +/** @typedef {Resolver & WithOptions} ResolverWithOptions */ - /** - * @param {any} thing any thing - * @returns {Object} metadata - */ - getMetaIfExisting(thing) { - return this._metaMap.get(thing); - } +// need to be hoisted on module level for caching identity +const EMPTY_RESOLVE_OPTIONS = {}; - /** - * @param {string=} cacheStage a persistent stage name for caching - */ - freeze(cacheStage) { - this._cache = new WeakTupleMap(); - this._cacheStage = cacheStage; - } +/** + * @param {ResolveOptionsWithDependencyType} resolveOptionsWithDepType enhanced options + * @returns {ResolveOptions} merged options + */ +const convertToResolveOptions = resolveOptionsWithDepType => { + const { dependencyType, plugins, ...remaining } = resolveOptionsWithDepType; - unfreeze() { - this._cache = undefined; - this._cacheStage = undefined; - } + // check type compat + /** @type {Partial} */ + const partialOptions = { + ...remaining, + plugins: + plugins && + /** @type {ResolvePluginInstance[]} */ ( + plugins.filter(item => item !== "...") + ) + }; - /** - * @template {any[]} T - * @template V - * @param {(moduleGraph: ModuleGraph, ...args: T) => V} fn computer - * @param {T} args arguments - * @returns {V} computed value or cached - */ - cached(fn, ...args) { - if (this._cache === undefined) return fn(this, ...args); - return this._cache.provide(fn, ...args, () => fn(this, ...args)); + if (!partialOptions.fileSystem) { + throw new Error( + "fileSystem is missing in resolveOptions, but it's required for enhanced-resolve" + ); } + // These weird types validate that we checked all non-optional properties + const options = + /** @type {Partial & Pick} */ ( + partialOptions + ); - /** - * @param {Map>} moduleMemCaches mem caches for modules for better caching - */ - setModuleMemCaches(moduleMemCaches) { - this._moduleMemCaches = moduleMemCaches; - } + return removeOperations( + resolveByProperty(options, "byDependency", dependencyType) + ); +}; - /** - * @param {Dependency} dependency dependency - * @param {...any} args arguments, last argument is a function called with moduleGraph, dependency, ...args - * @returns {any} computed value or cached - */ - dependencyCacheProvide(dependency, ...args) { - /** @type {(moduleGraph: ModuleGraph, dependency: Dependency, ...args: any[]) => any} */ - const fn = args.pop(); - if (this._moduleMemCaches && this._cacheStage) { - const memCache = this._moduleMemCaches.get( - this.getParentModule(dependency) - ); - if (memCache !== undefined) { - return memCache.provide(dependency, this._cacheStage, ...args, () => - fn(this, dependency, ...args) - ); - } - } - if (this._cache === undefined) return fn(this, dependency, ...args); - return this._cache.provide(dependency, ...args, () => - fn(this, dependency, ...args) - ); - } +/** + * @typedef {Object} ResolverCache + * @property {WeakMap} direct + * @property {Map} stringified + */ - // TODO remove in webpack 6 - /** - * @param {Module} module the module - * @param {string} deprecateMessage message for the deprecation message - * @param {string} deprecationCode code for the deprecation - * @returns {ModuleGraph} the module graph - */ - static getModuleGraphForModule(module, deprecateMessage, deprecationCode) { - const fn = deprecateMap.get(deprecateMessage); - if (fn) return fn(module); - const newFn = util.deprecate( - /** - * @param {Module} module the module - * @returns {ModuleGraph} the module graph - */ - module => { - const moduleGraph = moduleGraphForModuleMap.get(module); - if (!moduleGraph) - throw new Error( - deprecateMessage + - "There was no ModuleGraph assigned to the Module for backward-compat (Use the new API)" - ); - return moduleGraph; - }, - deprecateMessage + ": Use new ModuleGraph API", - deprecationCode - ); - deprecateMap.set(deprecateMessage, newFn); - return newFn(module); +module.exports = class ResolverFactory { + constructor() { + this.hooks = Object.freeze({ + /** @type {HookMap>} */ + resolveOptions: new HookMap( + () => new SyncWaterfallHook(["resolveOptions"]) + ), + /** @type {HookMap>} */ + resolver: new HookMap( + () => new SyncHook(["resolver", "resolveOptions", "userResolveOptions"]) + ) + }); + /** @type {Map} */ + this.cache = new Map(); } - // TODO remove in webpack 6 /** - * @param {Module} module the module - * @param {ModuleGraph} moduleGraph the module graph - * @returns {void} + * @param {string} type type of resolver + * @param {ResolveOptionsWithDependencyType=} resolveOptions options + * @returns {ResolverWithOptions} the resolver */ - static setModuleGraphForModule(module, moduleGraph) { - moduleGraphForModuleMap.set(module, moduleGraph); + get(type, resolveOptions = EMPTY_RESOLVE_OPTIONS) { + let typedCaches = this.cache.get(type); + if (!typedCaches) { + typedCaches = { + direct: new WeakMap(), + stringified: new Map() + }; + this.cache.set(type, typedCaches); + } + const cachedResolver = typedCaches.direct.get(resolveOptions); + if (cachedResolver) { + return cachedResolver; + } + const ident = JSON.stringify(resolveOptions); + const resolver = typedCaches.stringified.get(ident); + if (resolver) { + typedCaches.direct.set(resolveOptions, resolver); + return resolver; + } + const newResolver = this._create(type, resolveOptions); + typedCaches.direct.set(resolveOptions, newResolver); + typedCaches.stringified.set(ident, newResolver); + return newResolver; } - // TODO remove in webpack 6 /** - * @param {Module} module the module - * @returns {void} + * @param {string} type type of resolver + * @param {ResolveOptionsWithDependencyType} resolveOptionsWithDepType options + * @returns {ResolverWithOptions} the resolver */ - static clearModuleGraphForModule(module) { - moduleGraphForModuleMap.delete(module); - } -} - -// TODO remove in webpack 6 -/** @type {WeakMap} */ -const moduleGraphForModuleMap = new WeakMap(); - -// TODO remove in webpack 6 -/** @type {Map ModuleGraph>} */ -const deprecateMap = new Map(); + _create(type, resolveOptionsWithDepType) { + /** @type {ResolveOptionsWithDependencyType} */ + const originalResolveOptions = { ...resolveOptionsWithDepType }; -module.exports = ModuleGraph; -module.exports.ModuleGraphConnection = ModuleGraphConnection; + const resolveOptions = convertToResolveOptions( + this.hooks.resolveOptions.for(type).call(resolveOptionsWithDepType) + ); + const resolver = /** @type {ResolverWithOptions} */ ( + Factory.createResolver(resolveOptions) + ); + if (!resolver) { + throw new Error("No resolver created"); + } + /** @type {WeakMap, ResolverWithOptions>} */ + const childCache = new WeakMap(); + resolver.withOptions = options => { + const cacheEntry = childCache.get(options); + if (cacheEntry !== undefined) return cacheEntry; + const mergedOptions = cachedCleverMerge(originalResolveOptions, options); + const resolver = this.get(type, mergedOptions); + childCache.set(options, resolver); + return resolver; + }; + this.hooks.resolver + .for(type) + .call(resolver, resolveOptions, originalResolveOptions); + return resolver; + } +}; /***/ }), -/***/ 40639: -/***/ (function(module) { +/***/ 16475: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* @@ -53447,670 +52620,386 @@ module.exports.ModuleGraphConnection = ModuleGraphConnection; -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ +/** + * the internal require function + */ +exports.require = "__webpack_require__"; /** - * Module itself is not connected, but transitive modules are connected transitively. + * access to properties of the internal require function/object */ -const TRANSITIVE_ONLY = Symbol("transitive only"); +exports.requireScope = "__webpack_require__.*"; /** - * While determining the active state, this flag is used to signal a circular connection. + * the internal exports object */ -const CIRCULAR_CONNECTION = Symbol("circular connection"); +exports.exports = "__webpack_exports__"; -/** @typedef {boolean | typeof TRANSITIVE_ONLY | typeof CIRCULAR_CONNECTION} ConnectionState */ +/** + * top-level this need to be the exports object + */ +exports.thisAsExports = "top-level-this-exports"; /** - * @param {ConnectionState} a first - * @param {ConnectionState} b second - * @returns {ConnectionState} merged + * runtime need to return the exports of the last entry module */ -const addConnectionStates = (a, b) => { - if (a === true || b === true) return true; - if (a === false) return b; - if (b === false) return a; - if (a === TRANSITIVE_ONLY) return b; - if (b === TRANSITIVE_ONLY) return a; - return a; -}; +exports.returnExportsFromRuntime = "return-exports-from-runtime"; /** - * @param {ConnectionState} a first - * @param {ConnectionState} b second - * @returns {ConnectionState} intersected + * the internal module object */ -const intersectConnectionStates = (a, b) => { - if (a === false || b === false) return false; - if (a === true) return b; - if (b === true) return a; - if (a === CIRCULAR_CONNECTION) return b; - if (b === CIRCULAR_CONNECTION) return a; - return a; -}; +exports.module = "module"; -class ModuleGraphConnection { - /** - * @param {Module|null} originModule the referencing module - * @param {Dependency|null} dependency the referencing dependency - * @param {Module} module the referenced module - * @param {string=} explanation some extra detail - * @param {boolean=} weak the reference is weak - * @param {false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState=} condition condition for the connection - */ - constructor( - originModule, - dependency, - module, - explanation, - weak = false, - condition = undefined - ) { - this.originModule = originModule; - this.resolvedOriginModule = originModule; - this.dependency = dependency; - this.resolvedModule = module; - this.module = module; - this.weak = weak; - this.conditional = !!condition; - this._active = condition !== false; - /** @type {function(ModuleGraphConnection, RuntimeSpec): ConnectionState} */ - this.condition = condition || undefined; - /** @type {Set} */ - this.explanations = undefined; - if (explanation) { - this.explanations = new Set(); - this.explanations.add(explanation); - } - } +/** + * the internal module object + */ +exports.moduleId = "module.id"; - clone() { - const clone = new ModuleGraphConnection( - this.resolvedOriginModule, - this.dependency, - this.resolvedModule, - undefined, - this.weak, - this.condition - ); - clone.originModule = this.originModule; - clone.module = this.module; - clone.conditional = this.conditional; - clone._active = this._active; - if (this.explanations) clone.explanations = new Set(this.explanations); - return clone; - } +/** + * the internal module object + */ +exports.moduleLoaded = "module.loaded"; - /** - * @param {function(ModuleGraphConnection, RuntimeSpec): ConnectionState} condition condition for the connection - * @returns {void} - */ - addCondition(condition) { - if (this.conditional) { - const old = this.condition; - this.condition = (c, r) => - intersectConnectionStates(old(c, r), condition(c, r)); - } else if (this._active) { - this.conditional = true; - this.condition = condition; - } - } +/** + * the bundle public path + */ +exports.publicPath = "__webpack_require__.p"; - /** - * @param {string} explanation the explanation to add - * @returns {void} - */ - addExplanation(explanation) { - if (this.explanations === undefined) { - this.explanations = new Set(); - } - this.explanations.add(explanation); - } +/** + * the module id of the entry point + */ +exports.entryModuleId = "__webpack_require__.s"; - get explanation() { - if (this.explanations === undefined) return ""; - return Array.from(this.explanations).join(" "); - } +/** + * the module cache + */ +exports.moduleCache = "__webpack_require__.c"; - // TODO webpack 5 remove - get active() { - throw new Error("Use getActiveState instead"); - } +/** + * the module functions + */ +exports.moduleFactories = "__webpack_require__.m"; - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true, if the connection is active - */ - isActive(runtime) { - if (!this.conditional) return this._active; - return this.condition(this, runtime) !== false; - } +/** + * the module functions, with only write access + */ +exports.moduleFactoriesAddOnly = "__webpack_require__.m (add only)"; - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {boolean} true, if the connection is active - */ - isTargetActive(runtime) { - if (!this.conditional) return this._active; - return this.condition(this, runtime) === true; - } +/** + * the chunk ensure function + */ +exports.ensureChunk = "__webpack_require__.e"; - /** - * @param {RuntimeSpec} runtime the runtime - * @returns {ConnectionState} true: fully active, false: inactive, TRANSITIVE: direct module inactive, but transitive connection maybe active - */ - getActiveState(runtime) { - if (!this.conditional) return this._active; - return this.condition(this, runtime); - } - - /** - * @param {boolean} value active or not - * @returns {void} - */ - setActive(value) { - this.conditional = false; - this._active = value; - } - - set active(value) { - throw new Error("Use setActive instead"); - } -} +/** + * an object with handlers to ensure a chunk + */ +exports.ensureChunkHandlers = "__webpack_require__.f"; -/** @typedef {typeof TRANSITIVE_ONLY} TRANSITIVE_ONLY */ -/** @typedef {typeof CIRCULAR_CONNECTION} CIRCULAR_CONNECTION */ +/** + * a runtime requirement if ensureChunkHandlers should include loading of chunk needed for entries + */ +exports.ensureChunkIncludeEntries = "__webpack_require__.f (include entries)"; -module.exports = ModuleGraphConnection; -module.exports.addConnectionStates = addConnectionStates; -module.exports.TRANSITIVE_ONLY = /** @type {typeof TRANSITIVE_ONLY} */ ( - TRANSITIVE_ONLY -); -module.exports.CIRCULAR_CONNECTION = /** @type {typeof CIRCULAR_CONNECTION} */ ( - CIRCULAR_CONNECTION -); +/** + * the chunk prefetch function + */ +exports.prefetchChunk = "__webpack_require__.E"; +/** + * an object with handlers to prefetch a chunk + */ +exports.prefetchChunkHandlers = "__webpack_require__.F"; -/***/ }), +/** + * the chunk preload function + */ +exports.preloadChunk = "__webpack_require__.G"; -/***/ 3454: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * an object with handlers to preload a chunk + */ +exports.preloadChunkHandlers = "__webpack_require__.H"; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** + * the exported property define getters function + */ +exports.definePropertyGetters = "__webpack_require__.d"; +/** + * define compatibility on export + */ +exports.makeNamespaceObject = "__webpack_require__.r"; +/** + * create a fake namespace object + */ +exports.createFakeNamespaceObject = "__webpack_require__.t"; -const { ConcatSource, RawSource, CachedSource } = __webpack_require__(51255); -const { UsageState } = __webpack_require__(63686); -const Template = __webpack_require__(39722); -const JavascriptModulesPlugin = __webpack_require__(89464); +/** + * compatibility get default export + */ +exports.compatGetDefaultExport = "__webpack_require__.n"; -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./ExportsInfo")} ExportsInfo */ -/** @typedef {import("./ExportsInfo").ExportInfo} ExportInfo */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./ModuleTemplate")} ModuleTemplate */ -/** @typedef {import("./RequestShortener")} RequestShortener */ +/** + * harmony module decorator + */ +exports.harmonyModuleDecorator = "__webpack_require__.hmd"; -const joinIterableWithComma = iterable => { - // This is more performant than Array.from().join(", ") - // as it doesn't create an array - let str = ""; - let first = true; - for (const item of iterable) { - if (first) { - first = false; - } else { - str += ", "; - } - str += item; - } - return str; -}; +/** + * node.js module decorator + */ +exports.nodeModuleDecorator = "__webpack_require__.nmd"; /** - * @param {ConcatSource} source output - * @param {string} indent spacing - * @param {ExportsInfo} exportsInfo data - * @param {ModuleGraph} moduleGraph moduleGraph - * @param {RequestShortener} requestShortener requestShortener - * @param {Set} alreadyPrinted deduplication set - * @returns {void} + * the webpack hash */ -const printExportsInfoToSource = ( - source, - indent, - exportsInfo, - moduleGraph, - requestShortener, - alreadyPrinted = new Set() -) => { - const otherExportsInfo = exportsInfo.otherExportsInfo; +exports.getFullHash = "__webpack_require__.h"; - let alreadyPrintedExports = 0; +/** + * an object containing all installed WebAssembly.Instance export objects keyed by module id + */ +exports.wasmInstances = "__webpack_require__.w"; - // determine exports to print - const printedExports = []; - for (const exportInfo of exportsInfo.orderedExports) { - if (!alreadyPrinted.has(exportInfo)) { - alreadyPrinted.add(exportInfo); - printedExports.push(exportInfo); - } else { - alreadyPrintedExports++; - } - } - let showOtherExports = false; - if (!alreadyPrinted.has(otherExportsInfo)) { - alreadyPrinted.add(otherExportsInfo); - showOtherExports = true; - } else { - alreadyPrintedExports++; - } +/** + * instantiate a wasm instance from module exports object, id, hash and importsObject + */ +exports.instantiateWasm = "__webpack_require__.v"; - // print the exports - for (const exportInfo of printedExports) { - const target = exportInfo.getTarget(moduleGraph); - source.add( - Template.toComment( - `${indent}export ${JSON.stringify(exportInfo.name).slice( - 1, - -1 - )} [${exportInfo.getProvidedInfo()}] [${exportInfo.getUsedInfo()}] [${exportInfo.getRenameInfo()}]${ - target - ? ` -> ${target.module.readableIdentifier(requestShortener)}${ - target.export - ? ` .${target.export - .map(e => JSON.stringify(e).slice(1, -1)) - .join(".")}` - : "" - }` - : "" - }` - ) + "\n" - ); - if (exportInfo.exportsInfo) { - printExportsInfoToSource( - source, - indent + " ", - exportInfo.exportsInfo, - moduleGraph, - requestShortener, - alreadyPrinted - ); - } - } +/** + * the uncaught error handler for the webpack runtime + */ +exports.uncaughtErrorHandler = "__webpack_require__.oe"; - if (alreadyPrintedExports) { - source.add( - Template.toComment( - `${indent}... (${alreadyPrintedExports} already listed exports)` - ) + "\n" - ); - } +/** + * the script nonce + */ +exports.scriptNonce = "__webpack_require__.nc"; - if (showOtherExports) { - const target = otherExportsInfo.getTarget(moduleGraph); - if ( - target || - otherExportsInfo.provided !== false || - otherExportsInfo.getUsed(undefined) !== UsageState.Unused - ) { - const title = - printedExports.length > 0 || alreadyPrintedExports > 0 - ? "other exports" - : "exports"; - source.add( - Template.toComment( - `${indent}${title} [${otherExportsInfo.getProvidedInfo()}] [${otherExportsInfo.getUsedInfo()}]${ - target - ? ` -> ${target.module.readableIdentifier(requestShortener)}` - : "" - }` - ) + "\n" - ); - } - } -}; +/** + * function to load a script tag. + * Arguments: (url: string, done: (event) => void), key?: string | number, chunkId?: string | number) => void + * done function is called when loading has finished or timeout occurred. + * It will attach to existing script tags with data-webpack == uniqueName + ":" + key or src == url. + */ +exports.loadScript = "__webpack_require__.l"; -/** @type {WeakMap }>>} */ -const caches = new WeakMap(); +/** + * function to promote a string to a TrustedScript using webpack's Trusted + * Types policy + * Arguments: (script: string) => TrustedScript + */ +exports.createScript = "__webpack_require__.ts"; -class ModuleInfoHeaderPlugin { - /** - * @param {boolean=} verbose add more information like exports, runtime requirements and bailouts - */ - constructor(verbose = true) { - this._verbose = verbose; - } - /** - * @param {Compiler} compiler the compiler - * @returns {void} - */ - apply(compiler) { - const { _verbose: verbose } = this; - compiler.hooks.compilation.tap("ModuleInfoHeaderPlugin", compilation => { - const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); - hooks.renderModulePackage.tap( - "ModuleInfoHeaderPlugin", - ( - moduleSource, - module, - { chunk, chunkGraph, moduleGraph, runtimeTemplate } - ) => { - const { requestShortener } = runtimeTemplate; - let cacheEntry; - let cache = caches.get(requestShortener); - if (cache === undefined) { - caches.set(requestShortener, (cache = new WeakMap())); - cache.set( - module, - (cacheEntry = { header: undefined, full: new WeakMap() }) - ); - } else { - cacheEntry = cache.get(module); - if (cacheEntry === undefined) { - cache.set( - module, - (cacheEntry = { header: undefined, full: new WeakMap() }) - ); - } else if (!verbose) { - const cachedSource = cacheEntry.full.get(moduleSource); - if (cachedSource !== undefined) return cachedSource; - } - } - const source = new ConcatSource(); - let header = cacheEntry.header; - if (header === undefined) { - const req = module.readableIdentifier(requestShortener); - const reqStr = req.replace(/\*\//g, "*_/"); - const reqStrStar = "*".repeat(reqStr.length); - const headerStr = `/*!****${reqStrStar}****!*\\\n !*** ${reqStr} ***!\n \\****${reqStrStar}****/\n`; - header = new RawSource(headerStr); - cacheEntry.header = header; - } - source.add(header); - if (verbose) { - const exportsType = module.buildMeta.exportsType; - source.add( - Template.toComment( - exportsType - ? `${exportsType} exports` - : "unknown exports (runtime-defined)" - ) + "\n" - ); - if (exportsType) { - const exportsInfo = moduleGraph.getExportsInfo(module); - printExportsInfoToSource( - source, - "", - exportsInfo, - moduleGraph, - requestShortener - ); - } - source.add( - Template.toComment( - `runtime requirements: ${joinIterableWithComma( - chunkGraph.getModuleRuntimeRequirements(module, chunk.runtime) - )}` - ) + "\n" - ); - const optimizationBailout = - moduleGraph.getOptimizationBailout(module); - if (optimizationBailout) { - for (const text of optimizationBailout) { - let code; - if (typeof text === "function") { - code = text(requestShortener); - } else { - code = text; - } - source.add(Template.toComment(`${code}`) + "\n"); - } - } - source.add(moduleSource); - return source; - } else { - source.add(moduleSource); - const cachedSource = new CachedSource(source); - cacheEntry.full.set(moduleSource, cachedSource); - return cachedSource; - } - } - ); - hooks.chunkHash.tap("ModuleInfoHeaderPlugin", (chunk, hash) => { - hash.update("ModuleInfoHeaderPlugin"); - hash.update("1"); - }); - }); - } -} -module.exports = ModuleInfoHeaderPlugin; +/** + * function to promote a string to a TrustedScriptURL using webpack's Trusted + * Types policy + * Arguments: (url: string) => TrustedScriptURL + */ +exports.createScriptUrl = "__webpack_require__.tu"; +/** + * function to return webpack's Trusted Types policy + * Arguments: () => TrustedTypePolicy + */ +exports.getTrustedTypesPolicy = "__webpack_require__.tt"; -/***/ }), +/** + * the chunk name of the chunk with the runtime + */ +exports.chunkName = "__webpack_require__.cn"; -/***/ 32882: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * the runtime id of the current runtime + */ +exports.runtimeId = "__webpack_require__.j"; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** + * the filename of the script part of the chunk + */ +exports.getChunkScriptFilename = "__webpack_require__.u"; +/** + * the filename of the css part of the chunk + */ +exports.getChunkCssFilename = "__webpack_require__.k"; +/** + * a flag when a module/chunk/tree has css modules + */ +exports.hasCssModules = "has css modules"; -const WebpackError = __webpack_require__(53799); +/** + * the filename of the script part of the hot update chunk + */ +exports.getChunkUpdateScriptFilename = "__webpack_require__.hu"; -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("./Module")} Module */ +/** + * the filename of the css part of the hot update chunk + */ +exports.getChunkUpdateCssFilename = "__webpack_require__.hk"; -const previouslyPolyfilledBuiltinModules = { - assert: "assert/", - buffer: "buffer/", - console: "console-browserify", - constants: "constants-browserify", - crypto: "crypto-browserify", - domain: "domain-browser", - events: "events/", - http: "stream-http", - https: "https-browserify", - os: "os-browserify/browser", - path: "path-browserify", - punycode: "punycode/", - process: "process/browser", - querystring: "querystring-es3", - stream: "stream-browserify", - _stream_duplex: "readable-stream/duplex", - _stream_passthrough: "readable-stream/passthrough", - _stream_readable: "readable-stream/readable", - _stream_transform: "readable-stream/transform", - _stream_writable: "readable-stream/writable", - string_decoder: "string_decoder/", - sys: "util/", - timers: "timers-browserify", - tty: "tty-browserify", - url: "url/", - util: "util/", - vm: "vm-browserify", - zlib: "browserify-zlib" -}; +/** + * startup signal from runtime + * This will be called when the runtime chunk has been loaded. + */ +exports.startup = "__webpack_require__.x"; -class ModuleNotFoundError extends WebpackError { - /** - * @param {Module} module module tied to dependency - * @param {Error&any} err error thrown - * @param {DependencyLocation} loc location of dependency - */ - constructor(module, err, loc) { - let message = `Module not found: ${err.toString()}`; +/** + * @deprecated + * creating a default startup function with the entry modules + */ +exports.startupNoDefault = "__webpack_require__.x (no default handler)"; - // TODO remove in webpack 6 - const match = err.message.match(/Can't resolve '([^']+)'/); - if (match) { - const request = match[1]; - const alias = previouslyPolyfilledBuiltinModules[request]; - if (alias) { - const pathIndex = alias.indexOf("/"); - const dependency = pathIndex > 0 ? alias.slice(0, pathIndex) : alias; - message += - "\n\n" + - "BREAKING CHANGE: " + - "webpack < 5 used to include polyfills for node.js core modules by default.\n" + - "This is no longer the case. Verify if you need this module and configure a polyfill for it.\n\n"; - message += - "If you want to include a polyfill, you need to:\n" + - `\t- add a fallback 'resolve.fallback: { "${request}": require.resolve("${alias}") }'\n` + - `\t- install '${dependency}'\n`; - message += - "If you don't want to include a polyfill, you can use an empty module like this:\n" + - `\tresolve.fallback: { "${request}": false }`; - } - } +/** + * startup signal from runtime but only used to add logic after the startup + */ +exports.startupOnlyAfter = "__webpack_require__.x (only after)"; - super(message); +/** + * startup signal from runtime but only used to add sync logic before the startup + */ +exports.startupOnlyBefore = "__webpack_require__.x (only before)"; - this.name = "ModuleNotFoundError"; - this.details = err.details; - this.module = module; - this.error = err; - this.loc = loc; - } -} +/** + * global callback functions for installing chunks + */ +exports.chunkCallback = "webpackChunk"; -module.exports = ModuleNotFoundError; +/** + * method to startup an entrypoint with needed chunks. + * Signature: (moduleId: Id, chunkIds: Id[]) => any. + * Returns the exports of the module or a Promise + */ +exports.startupEntrypoint = "__webpack_require__.X"; +/** + * register deferred code, which will run when certain + * chunks are loaded. + * Signature: (chunkIds: Id[], fn: () => any, priority: int >= 0 = 0) => any + * Returned value will be returned directly when all chunks are already loaded + * When (priority & 1) it will wait for all other handlers with lower priority to + * be executed before itself is executed + */ +exports.onChunksLoaded = "__webpack_require__.O"; -/***/ }), - -/***/ 58443: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - +/** + * method to install a chunk that was loaded somehow + * Signature: ({ id, ids, modules, runtime }) => void + */ +exports.externalInstallChunk = "__webpack_require__.C"; +/** + * interceptor for module executions + */ +exports.interceptModuleExecution = "__webpack_require__.i"; -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); +/** + * the global object + */ +exports.global = "__webpack_require__.g"; -const WASM_HEADER = Buffer.from([0x00, 0x61, 0x73, 0x6d]); +/** + * an object with all share scopes + */ +exports.shareScopeMap = "__webpack_require__.S"; -class ModuleParseError extends WebpackError { - /** - * @param {string | Buffer} source source code - * @param {Error&any} err the parse error - * @param {string[]} loaders the loaders used - * @param {string} type module type - */ - constructor(source, err, loaders, type) { - let message = "Module parse failed: " + (err && err.message); - let loc = undefined; +/** + * The sharing init sequence function (only runs once per share scope). + * Has one argument, the name of the share scope. + * Creates a share scope if not existing + */ +exports.initializeSharing = "__webpack_require__.I"; - if ( - ((Buffer.isBuffer(source) && source.slice(0, 4).equals(WASM_HEADER)) || - (typeof source === "string" && /^\0asm/.test(source))) && - !type.startsWith("webassembly") - ) { - message += - "\nThe module seem to be a WebAssembly module, but module is not flagged as WebAssembly module for webpack."; - message += - "\nBREAKING CHANGE: Since webpack 5 WebAssembly is not enabled by default and flagged as experimental feature."; - message += - "\nYou need to enable one of the WebAssembly experiments via 'experiments.asyncWebAssembly: true' (based on async modules) or 'experiments.syncWebAssembly: true' (like webpack 4, deprecated)."; - message += - "\nFor files that transpile to WebAssembly, make sure to set the module type in the 'module.rules' section of the config (e. g. 'type: \"webassembly/async\"')."; - } else if (!loaders) { - message += - "\nYou may need an appropriate loader to handle this file type."; - } else if (loaders.length >= 1) { - message += `\nFile was processed with these loaders:${loaders - .map(loader => `\n * ${loader}`) - .join("")}`; - message += - "\nYou may need an additional loader to handle the result of these loaders."; - } else { - message += - "\nYou may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders"; - } +/** + * The current scope when getting a module from a remote + */ +exports.currentRemoteGetScope = "__webpack_require__.R"; - if ( - err && - err.loc && - typeof err.loc === "object" && - typeof err.loc.line === "number" - ) { - var lineNumber = err.loc.line; +/** + * the filename of the HMR manifest + */ +exports.getUpdateManifestFilename = "__webpack_require__.hmrF"; - if ( - Buffer.isBuffer(source) || - /[\0\u0001\u0002\u0003\u0004\u0005\u0006\u0007]/.test(source) - ) { - // binary file - message += "\n(Source code omitted for this binary file)"; - } else { - const sourceLines = source.split(/\r?\n/); - const start = Math.max(0, lineNumber - 3); - const linesBefore = sourceLines.slice(start, lineNumber - 1); - const theLine = sourceLines[lineNumber - 1]; - const linesAfter = sourceLines.slice(lineNumber, lineNumber + 2); +/** + * function downloading the update manifest + */ +exports.hmrDownloadManifest = "__webpack_require__.hmrM"; - message += - linesBefore.map(l => `\n| ${l}`).join("") + - `\n> ${theLine}` + - linesAfter.map(l => `\n| ${l}`).join(""); - } +/** + * array with handler functions to download chunk updates + */ +exports.hmrDownloadUpdateHandlers = "__webpack_require__.hmrC"; - loc = { start: err.loc }; - } else if (err && err.stack) { - message += "\n" + err.stack; - } +/** + * object with all hmr module data for all modules + */ +exports.hmrModuleData = "__webpack_require__.hmrD"; - super(message); +/** + * array with handler functions when a module should be invalidated + */ +exports.hmrInvalidateModuleHandlers = "__webpack_require__.hmrI"; - this.name = "ModuleParseError"; - this.loc = loc; - this.error = err; - } +/** + * the prefix for storing state of runtime modules when hmr is enabled + */ +exports.hmrRuntimeStatePrefix = "__webpack_require__.hmrS"; - serialize(context) { - const { write } = context; +/** + * the AMD define function + */ +exports.amdDefine = "__webpack_require__.amdD"; - write(this.error); +/** + * the AMD options + */ +exports.amdOptions = "__webpack_require__.amdO"; - super.serialize(context); - } +/** + * the System polyfill object + */ +exports.system = "__webpack_require__.System"; - deserialize(context) { - const { read } = context; +/** + * the shorthand for Object.prototype.hasOwnProperty + * using of it decreases the compiled bundle size + */ +exports.hasOwnProperty = "__webpack_require__.o"; - this.error = read(); +/** + * the System.register context object + */ +exports.systemContext = "__webpack_require__.y"; - super.deserialize(context); - } -} +/** + * the baseURI of current document + */ +exports.baseURI = "__webpack_require__.b"; -makeSerializable(ModuleParseError, "webpack/lib/ModuleParseError"); +/** + * a RelativeURL class when relative URLs are used + */ +exports.relativeUrl = "__webpack_require__.U"; -module.exports = ModuleParseError; +/** + * Creates an async module. The body function must be a async function. + * "module.exports" will be decorated with an AsyncModulePromise. + * The body function will be called. + * To handle async dependencies correctly do this: "([a, b, c] = await handleDependencies([a, b, c]));". + * If "hasAwaitAfterDependencies" is truthy, "handleDependencies()" must be called at the end of the body function. + * Signature: function( + * module: Module, + * body: (handleDependencies: (deps: AsyncModulePromise[]) => Promise & () => void, + * hasAwaitAfterDependencies?: boolean + * ) => void + */ +exports.asyncModule = "__webpack_require__.a"; /***/ }), -/***/ 36418: -/***/ (function(module) { +/***/ 16963: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -54120,161 +53009,217 @@ module.exports = ModuleParseError; -class ModuleProfile { - constructor() { - this.startTime = Date.now(); - - this.factoryStartTime = 0; - this.factoryEndTime = 0; - this.factory = 0; - this.factoryParallelismFactor = 0; - - this.restoringStartTime = 0; - this.restoringEndTime = 0; - this.restoring = 0; - this.restoringParallelismFactor = 0; - - this.integrationStartTime = 0; - this.integrationEndTime = 0; - this.integration = 0; - this.integrationParallelismFactor = 0; - - this.buildingStartTime = 0; - this.buildingEndTime = 0; - this.building = 0; - this.buildingParallelismFactor = 0; - - this.storingStartTime = 0; - this.storingEndTime = 0; - this.storing = 0; - this.storingParallelismFactor = 0; +const { RawSource } = __webpack_require__(51255); +const OriginalSource = (__webpack_require__(51255).OriginalSource); +const Module = __webpack_require__(73208); - this.additionalFactoryTimes = undefined; - this.additionalFactories = 0; - this.additionalFactoriesParallelismFactor = 0; +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./util/Hash")} Hash */ +/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ - /** @deprecated */ - this.additionalIntegration = 0; - } +const TYPES = new Set(["runtime"]); - markFactoryStart() { - this.factoryStartTime = Date.now(); +class RuntimeModule extends Module { + /** + * @param {string} name a readable name + * @param {number=} stage an optional stage + */ + constructor(name, stage = 0) { + super("runtime"); + this.name = name; + this.stage = stage; + this.buildMeta = {}; + this.buildInfo = {}; + /** @type {Compilation} */ + this.compilation = undefined; + /** @type {Chunk} */ + this.chunk = undefined; + /** @type {ChunkGraph} */ + this.chunkGraph = undefined; + this.fullHash = false; + this.dependentHash = false; + /** @type {string} */ + this._cachedGeneratedCode = undefined; } - markFactoryEnd() { - this.factoryEndTime = Date.now(); - this.factory = this.factoryEndTime - this.factoryStartTime; + /** + * @param {Compilation} compilation the compilation + * @param {Chunk} chunk the chunk + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {void} + */ + attach(compilation, chunk, chunkGraph = compilation.chunkGraph) { + this.compilation = compilation; + this.chunk = chunk; + this.chunkGraph = chunkGraph; } - markRestoringStart() { - this.restoringStartTime = Date.now(); + /** + * @returns {string} a unique identifier of the module + */ + identifier() { + return `webpack/runtime/${this.name}`; } - markRestoringEnd() { - this.restoringEndTime = Date.now(); - this.restoring = this.restoringEndTime - this.restoringStartTime; + /** + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + return `webpack/runtime/${this.name}`; } - markIntegrationStart() { - this.integrationStartTime = Date.now(); + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + return callback(null, false); } - markIntegrationEnd() { - this.integrationEndTime = Date.now(); - this.integration = this.integrationEndTime - this.integrationStartTime; + /** + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + // do nothing + // should not be called as runtime modules are added later to the compilation + callback(); } - markBuildingStart() { - this.buildingStartTime = Date.now(); + /** + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + hash.update(this.name); + hash.update(`${this.stage}`); + try { + if (this.fullHash || this.dependentHash) { + // Do not use getGeneratedCode here, because i. e. compilation hash might be not + // ready at this point. We will cache it later instead. + hash.update(this.generate()); + } else { + hash.update(this.getGeneratedCode()); + } + } catch (err) { + hash.update(err.message); + } + super.updateHash(hash, context); } - markBuildingEnd() { - this.buildingEndTime = Date.now(); - this.building = this.buildingEndTime - this.buildingStartTime; + /** + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + return TYPES; } - markStoringStart() { - this.storingStartTime = Date.now(); + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration(context) { + const sources = new Map(); + const generatedCode = this.getGeneratedCode(); + if (generatedCode) { + sources.set( + "runtime", + this.useSourceMap || this.useSimpleSourceMap + ? new OriginalSource(generatedCode, this.identifier()) + : new RawSource(generatedCode) + ); + } + return { + sources, + runtimeRequirements: null + }; } - markStoringEnd() { - this.storingEndTime = Date.now(); - this.storing = this.storingEndTime - this.storingStartTime; + /** + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + try { + const source = this.getGeneratedCode(); + return source ? source.length : 0; + } catch (e) { + return 0; + } } - // This depends on timing so we ignore it for coverage /* istanbul ignore next */ /** - * Merge this profile into another one - * @param {ModuleProfile} realProfile the profile to merge into - * @returns {void} + * @abstract + * @returns {string} runtime code */ - mergeInto(realProfile) { - realProfile.additionalFactories = this.factory; - (realProfile.additionalFactoryTimes = - realProfile.additionalFactoryTimes || []).push({ - start: this.factoryStartTime, - end: this.factoryEndTime - }); + generate() { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } -} - -module.exports = ModuleProfile; - - -/***/ }), - -/***/ 94560: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const WebpackError = __webpack_require__(53799); - -/** @typedef {import("./Module")} Module */ -class ModuleRestoreError extends WebpackError { /** - * @param {Module} module module tied to dependency - * @param {string | Error} err error thrown + * @returns {string} runtime code */ - constructor(module, err) { - let message = "Module restore failed: "; - let details = undefined; - if (err !== null && typeof err === "object") { - if (typeof err.stack === "string" && err.stack) { - const stack = err.stack; - message += stack; - } else if (typeof err.message === "string" && err.message) { - message += err.message; - } else { - message += err; - } - } else { - message += String(err); + getGeneratedCode() { + if (this._cachedGeneratedCode) { + return this._cachedGeneratedCode; } + return (this._cachedGeneratedCode = this.generate()); + } - super(message); - - this.name = "ModuleRestoreError"; - this.details = details; - this.module = module; - this.error = err; + /** + * @returns {boolean} true, if the runtime module should get it's own scope + */ + shouldIsolate() { + return true; } } -module.exports = ModuleRestoreError; +/** + * Runtime modules without any dependencies to other runtime modules + */ +RuntimeModule.STAGE_NORMAL = 0; + +/** + * Runtime modules with simple dependencies on other runtime modules + */ +RuntimeModule.STAGE_BASIC = 5; + +/** + * Runtime modules which attach to handlers of other runtime modules + */ +RuntimeModule.STAGE_ATTACH = 10; + +/** + * Runtime modules which trigger actions on bootstrap + */ +RuntimeModule.STAGE_TRIGGER = 20; + +module.exports = RuntimeModule; /***/ }), -/***/ 59001: +/***/ 2307: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -54285,46 +53230,448 @@ module.exports = ModuleRestoreError; -const WebpackError = __webpack_require__(53799); +const RuntimeGlobals = __webpack_require__(16475); +const { getChunkFilenameTemplate } = __webpack_require__(47283); +const RuntimeRequirementsDependency = __webpack_require__(24187); +const JavascriptModulesPlugin = __webpack_require__(89464); +const AsyncModuleRuntimeModule = __webpack_require__(63672); +const AutoPublicPathRuntimeModule = __webpack_require__(66532); +const CompatGetDefaultExportRuntimeModule = __webpack_require__(44793); +const CompatRuntimeModule = __webpack_require__(88234); +const CreateFakeNamespaceObjectRuntimeModule = __webpack_require__(94669); +const CreateScriptRuntimeModule = __webpack_require__(2759); +const CreateScriptUrlRuntimeModule = __webpack_require__(21213); +const DefinePropertyGettersRuntimeModule = __webpack_require__(75481); +const EnsureChunkRuntimeModule = __webpack_require__(71519); +const GetChunkFilenameRuntimeModule = __webpack_require__(34277); +const GetMainFilenameRuntimeModule = __webpack_require__(10029); +const GetTrustedTypesPolicyRuntimeModule = __webpack_require__(38713); +const GlobalRuntimeModule = __webpack_require__(23255); +const HasOwnPropertyRuntimeModule = __webpack_require__(8011); +const LoadScriptRuntimeModule = __webpack_require__(19942); +const MakeNamespaceObjectRuntimeModule = __webpack_require__(65714); +const OnChunksLoadedRuntimeModule = __webpack_require__(44518); +const PublicPathRuntimeModule = __webpack_require__(56030); +const RelativeUrlRuntimeModule = __webpack_require__(4537); +const RuntimeIdRuntimeModule = __webpack_require__(97115); +const SystemContextRuntimeModule = __webpack_require__(80655); +const ShareRuntimeModule = __webpack_require__(96066); +const StringXor = __webpack_require__(40293); +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./Compiler")} Compiler */ /** @typedef {import("./Module")} Module */ -class ModuleStoreError extends WebpackError { - /** - * @param {Module} module module tied to dependency - * @param {string | Error} err error thrown - */ - constructor(module, err) { - let message = "Module storing failed: "; - let details = undefined; - if (err !== null && typeof err === "object") { - if (typeof err.stack === "string" && err.stack) { - const stack = err.stack; - message += stack; - } else if (typeof err.message === "string" && err.message) { - message += err.message; - } else { - message += err; +const GLOBALS_ON_REQUIRE = [ + RuntimeGlobals.chunkName, + RuntimeGlobals.runtimeId, + RuntimeGlobals.compatGetDefaultExport, + RuntimeGlobals.createFakeNamespaceObject, + RuntimeGlobals.createScript, + RuntimeGlobals.createScriptUrl, + RuntimeGlobals.getTrustedTypesPolicy, + RuntimeGlobals.definePropertyGetters, + RuntimeGlobals.ensureChunk, + RuntimeGlobals.entryModuleId, + RuntimeGlobals.getFullHash, + RuntimeGlobals.global, + RuntimeGlobals.makeNamespaceObject, + RuntimeGlobals.moduleCache, + RuntimeGlobals.moduleFactories, + RuntimeGlobals.moduleFactoriesAddOnly, + RuntimeGlobals.interceptModuleExecution, + RuntimeGlobals.publicPath, + RuntimeGlobals.baseURI, + RuntimeGlobals.relativeUrl, + RuntimeGlobals.scriptNonce, + RuntimeGlobals.uncaughtErrorHandler, + RuntimeGlobals.asyncModule, + RuntimeGlobals.wasmInstances, + RuntimeGlobals.instantiateWasm, + RuntimeGlobals.shareScopeMap, + RuntimeGlobals.initializeSharing, + RuntimeGlobals.loadScript, + RuntimeGlobals.systemContext, + RuntimeGlobals.onChunksLoaded +]; + +const MODULE_DEPENDENCIES = { + [RuntimeGlobals.moduleLoaded]: [RuntimeGlobals.module], + [RuntimeGlobals.moduleId]: [RuntimeGlobals.module] +}; + +const TREE_DEPENDENCIES = { + [RuntimeGlobals.definePropertyGetters]: [RuntimeGlobals.hasOwnProperty], + [RuntimeGlobals.compatGetDefaultExport]: [ + RuntimeGlobals.definePropertyGetters + ], + [RuntimeGlobals.createFakeNamespaceObject]: [ + RuntimeGlobals.definePropertyGetters, + RuntimeGlobals.makeNamespaceObject, + RuntimeGlobals.require + ], + [RuntimeGlobals.initializeSharing]: [RuntimeGlobals.shareScopeMap], + [RuntimeGlobals.shareScopeMap]: [RuntimeGlobals.hasOwnProperty] +}; + +class RuntimePlugin { + /** + * @param {Compiler} compiler the Compiler + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap("RuntimePlugin", compilation => { + compilation.dependencyTemplates.set( + RuntimeRequirementsDependency, + new RuntimeRequirementsDependency.Template() + ); + for (const req of GLOBALS_ON_REQUIRE) { + compilation.hooks.runtimeRequirementInModule + .for(req) + .tap("RuntimePlugin", (module, set) => { + set.add(RuntimeGlobals.requireScope); + }); + compilation.hooks.runtimeRequirementInTree + .for(req) + .tap("RuntimePlugin", (module, set) => { + set.add(RuntimeGlobals.requireScope); + }); } - } else { - message += String(err); - } + for (const req of Object.keys(TREE_DEPENDENCIES)) { + const deps = TREE_DEPENDENCIES[req]; + compilation.hooks.runtimeRequirementInTree + .for(req) + .tap("RuntimePlugin", (chunk, set) => { + for (const dep of deps) set.add(dep); + }); + } + for (const req of Object.keys(MODULE_DEPENDENCIES)) { + const deps = MODULE_DEPENDENCIES[req]; + compilation.hooks.runtimeRequirementInModule + .for(req) + .tap("RuntimePlugin", (chunk, set) => { + for (const dep of deps) set.add(dep); + }); + } + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.definePropertyGetters) + .tap("RuntimePlugin", chunk => { + compilation.addRuntimeModule( + chunk, + new DefinePropertyGettersRuntimeModule() + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.makeNamespaceObject) + .tap("RuntimePlugin", chunk => { + compilation.addRuntimeModule( + chunk, + new MakeNamespaceObjectRuntimeModule() + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.createFakeNamespaceObject) + .tap("RuntimePlugin", chunk => { + compilation.addRuntimeModule( + chunk, + new CreateFakeNamespaceObjectRuntimeModule() + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hasOwnProperty) + .tap("RuntimePlugin", chunk => { + compilation.addRuntimeModule( + chunk, + new HasOwnPropertyRuntimeModule() + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.compatGetDefaultExport) + .tap("RuntimePlugin", chunk => { + compilation.addRuntimeModule( + chunk, + new CompatGetDefaultExportRuntimeModule() + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.runtimeId) + .tap("RuntimePlugin", chunk => { + compilation.addRuntimeModule(chunk, new RuntimeIdRuntimeModule()); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.publicPath) + .tap("RuntimePlugin", (chunk, set) => { + const { outputOptions } = compilation; + const { publicPath: globalPublicPath, scriptType } = outputOptions; + const entryOptions = chunk.getEntryOptions(); + const publicPath = + entryOptions && entryOptions.publicPath !== undefined + ? entryOptions.publicPath + : globalPublicPath; - super(message); + if (publicPath === "auto") { + const module = new AutoPublicPathRuntimeModule(); + if (scriptType !== "module") set.add(RuntimeGlobals.global); + compilation.addRuntimeModule(chunk, module); + } else { + const module = new PublicPathRuntimeModule(publicPath); - this.name = "ModuleStoreError"; - this.details = details; - this.module = module; - this.error = err; + if ( + typeof publicPath !== "string" || + /\[(full)?hash\]/.test(publicPath) + ) { + module.fullHash = true; + } + + compilation.addRuntimeModule(chunk, module); + } + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.global) + .tap("RuntimePlugin", chunk => { + compilation.addRuntimeModule(chunk, new GlobalRuntimeModule()); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.asyncModule) + .tap("RuntimePlugin", chunk => { + compilation.addRuntimeModule(chunk, new AsyncModuleRuntimeModule()); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.systemContext) + .tap("RuntimePlugin", chunk => { + const { outputOptions } = compilation; + const { library: globalLibrary } = outputOptions; + const entryOptions = chunk.getEntryOptions(); + const libraryType = + entryOptions && entryOptions.library !== undefined + ? entryOptions.library.type + : globalLibrary.type; + + if (libraryType === "system") { + compilation.addRuntimeModule( + chunk, + new SystemContextRuntimeModule() + ); + } + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.getChunkScriptFilename) + .tap("RuntimePlugin", (chunk, set) => { + if ( + typeof compilation.outputOptions.chunkFilename === "string" && + /\[(full)?hash(:\d+)?\]/.test( + compilation.outputOptions.chunkFilename + ) + ) { + set.add(RuntimeGlobals.getFullHash); + } + compilation.addRuntimeModule( + chunk, + new GetChunkFilenameRuntimeModule( + "javascript", + "javascript", + RuntimeGlobals.getChunkScriptFilename, + chunk => + chunk.filenameTemplate || + (chunk.canBeInitial() + ? compilation.outputOptions.filename + : compilation.outputOptions.chunkFilename), + false + ) + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.getChunkCssFilename) + .tap("RuntimePlugin", (chunk, set) => { + if ( + typeof compilation.outputOptions.cssChunkFilename === "string" && + /\[(full)?hash(:\d+)?\]/.test( + compilation.outputOptions.cssChunkFilename + ) + ) { + set.add(RuntimeGlobals.getFullHash); + } + compilation.addRuntimeModule( + chunk, + new GetChunkFilenameRuntimeModule( + "css", + "css", + RuntimeGlobals.getChunkCssFilename, + chunk => + getChunkFilenameTemplate(chunk, compilation.outputOptions), + set.has(RuntimeGlobals.hmrDownloadUpdateHandlers) + ) + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.getChunkUpdateScriptFilename) + .tap("RuntimePlugin", (chunk, set) => { + if ( + /\[(full)?hash(:\d+)?\]/.test( + compilation.outputOptions.hotUpdateChunkFilename + ) + ) + set.add(RuntimeGlobals.getFullHash); + compilation.addRuntimeModule( + chunk, + new GetChunkFilenameRuntimeModule( + "javascript", + "javascript update", + RuntimeGlobals.getChunkUpdateScriptFilename, + c => compilation.outputOptions.hotUpdateChunkFilename, + true + ) + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.getUpdateManifestFilename) + .tap("RuntimePlugin", (chunk, set) => { + if ( + /\[(full)?hash(:\d+)?\]/.test( + compilation.outputOptions.hotUpdateMainFilename + ) + ) { + set.add(RuntimeGlobals.getFullHash); + } + compilation.addRuntimeModule( + chunk, + new GetMainFilenameRuntimeModule( + "update manifest", + RuntimeGlobals.getUpdateManifestFilename, + compilation.outputOptions.hotUpdateMainFilename + ) + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunk) + .tap("RuntimePlugin", (chunk, set) => { + const hasAsyncChunks = chunk.hasAsyncChunks(); + if (hasAsyncChunks) { + set.add(RuntimeGlobals.ensureChunkHandlers); + } + compilation.addRuntimeModule( + chunk, + new EnsureChunkRuntimeModule(set) + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkIncludeEntries) + .tap("RuntimePlugin", (chunk, set) => { + set.add(RuntimeGlobals.ensureChunkHandlers); + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.shareScopeMap) + .tap("RuntimePlugin", (chunk, set) => { + compilation.addRuntimeModule(chunk, new ShareRuntimeModule()); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.loadScript) + .tap("RuntimePlugin", (chunk, set) => { + const withCreateScriptUrl = !!compilation.outputOptions.trustedTypes; + if (withCreateScriptUrl) { + set.add(RuntimeGlobals.createScriptUrl); + } + compilation.addRuntimeModule( + chunk, + new LoadScriptRuntimeModule(withCreateScriptUrl) + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.createScript) + .tap("RuntimePlugin", (chunk, set) => { + if (compilation.outputOptions.trustedTypes) { + set.add(RuntimeGlobals.getTrustedTypesPolicy); + } + compilation.addRuntimeModule(chunk, new CreateScriptRuntimeModule()); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.createScriptUrl) + .tap("RuntimePlugin", (chunk, set) => { + if (compilation.outputOptions.trustedTypes) { + set.add(RuntimeGlobals.getTrustedTypesPolicy); + } + compilation.addRuntimeModule( + chunk, + new CreateScriptUrlRuntimeModule() + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.getTrustedTypesPolicy) + .tap("RuntimePlugin", (chunk, set) => { + compilation.addRuntimeModule( + chunk, + new GetTrustedTypesPolicyRuntimeModule(set) + ); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.relativeUrl) + .tap("RuntimePlugin", (chunk, set) => { + compilation.addRuntimeModule(chunk, new RelativeUrlRuntimeModule()); + return true; + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.onChunksLoaded) + .tap("RuntimePlugin", (chunk, set) => { + compilation.addRuntimeModule( + chunk, + new OnChunksLoadedRuntimeModule() + ); + return true; + }); + // TODO webpack 6: remove CompatRuntimeModule + compilation.hooks.additionalTreeRuntimeRequirements.tap( + "RuntimePlugin", + (chunk, set) => { + const { mainTemplate } = compilation; + if ( + mainTemplate.hooks.bootstrap.isUsed() || + mainTemplate.hooks.localVars.isUsed() || + mainTemplate.hooks.requireEnsure.isUsed() || + mainTemplate.hooks.requireExtensions.isUsed() + ) { + compilation.addRuntimeModule(chunk, new CompatRuntimeModule()); + } + } + ); + JavascriptModulesPlugin.getCompilationHooks(compilation).chunkHash.tap( + "RuntimePlugin", + (chunk, hash, { chunkGraph }) => { + const xor = new StringXor(); + for (const m of chunkGraph.getChunkRuntimeModulesIterable(chunk)) { + xor.add(chunkGraph.getModuleHash(m, chunk.runtime)); + } + xor.updateHash(hash); + } + ); + }); } } - -module.exports = ModuleStoreError; +module.exports = RuntimePlugin; /***/ }), -/***/ 62677: +/***/ 18777: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -54335,1064 +53682,1044 @@ module.exports = ModuleStoreError; -const util = __webpack_require__(73837); -const memoize = __webpack_require__(78676); +const InitFragment = __webpack_require__(55870); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const { equals } = __webpack_require__(84953); +const compileBooleanMatcher = __webpack_require__(29404); +const propertyAccess = __webpack_require__(54190); +const { forEachRuntime, subtractRuntime } = __webpack_require__(17156); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */ +/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ /** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ /** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Dependency")} Dependency */ /** @typedef {import("./Module")} Module */ /** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./util/Hash")} Hash */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ -const getJavascriptModulesPlugin = memoize(() => - __webpack_require__(89464) -); +/** + * @param {Module} module the module + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {string} error message + */ +const noModuleIdErrorMessage = (module, chunkGraph) => { + return `Module ${module.identifier()} has no id assigned. +This should not happen. +It's in these chunks: ${ + Array.from( + chunkGraph.getModuleChunksIterable(module), + c => c.name || c.id || c.debugId + ).join(", ") || "none" + } (If module is in no chunk this indicates a bug in some chunk/module optimization logic) +Module has these incoming connections: ${Array.from( + chunkGraph.moduleGraph.getIncomingConnections(module), + connection => + `\n - ${ + connection.originModule && connection.originModule.identifier() + } ${connection.dependency && connection.dependency.type} ${ + (connection.explanations && + Array.from(connection.explanations).join(", ")) || + "" + }` + ).join("")}`; +}; -// TODO webpack 6: remove this class -class ModuleTemplate { +/** + * @param {string|undefined} definition global object definition + * @returns {string} save to use global object + */ +function getGlobalObject(definition) { + if (!definition) return definition; + const trimmed = definition.trim(); + + if ( + // identifier, we do not need real identifier regarding ECMAScript/Unicode + trimmed.match(/^[_\p{L}][_0-9\p{L}]*$/iu) || + // iife + // call expression + // expression in parentheses + trimmed.match(/^([_\p{L}][_0-9\p{L}]*)?\(.*\)$/iu) + ) + return trimmed; + + return `Object(${trimmed})`; +} + +class RuntimeTemplate { /** - * @param {RuntimeTemplate} runtimeTemplate the runtime template * @param {Compilation} compilation the compilation + * @param {OutputOptions} outputOptions the compilation output options + * @param {RequestShortener} requestShortener the request shortener */ - constructor(runtimeTemplate, compilation) { - this._runtimeTemplate = runtimeTemplate; - this.type = "javascript"; - this.hooks = Object.freeze({ - content: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .renderModuleContent.tap( - options, - (source, module, renderContext) => - fn( - source, - module, - renderContext, - renderContext.dependencyTemplates - ) - ); - }, - "ModuleTemplate.hooks.content is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModuleContent instead)", - "DEP_MODULE_TEMPLATE_CONTENT" - ) - }, - module: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .renderModuleContent.tap( - options, - (source, module, renderContext) => - fn( - source, - module, - renderContext, - renderContext.dependencyTemplates - ) - ); - }, - "ModuleTemplate.hooks.module is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModuleContent instead)", - "DEP_MODULE_TEMPLATE_MODULE" - ) - }, - render: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .renderModuleContainer.tap( - options, - (source, module, renderContext) => - fn( - source, - module, - renderContext, - renderContext.dependencyTemplates - ) - ); - }, - "ModuleTemplate.hooks.render is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModuleContainer instead)", - "DEP_MODULE_TEMPLATE_RENDER" - ) - }, - package: { - tap: util.deprecate( - (options, fn) => { - getJavascriptModulesPlugin() - .getCompilationHooks(compilation) - .renderModulePackage.tap( - options, - (source, module, renderContext) => - fn( - source, - module, - renderContext, - renderContext.dependencyTemplates - ) - ); - }, - "ModuleTemplate.hooks.package is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModulePackage instead)", - "DEP_MODULE_TEMPLATE_PACKAGE" - ) - }, - hash: { - tap: util.deprecate( - (options, fn) => { - compilation.hooks.fullHash.tap(options, fn); - }, - "ModuleTemplate.hooks.hash is deprecated (use Compilation.hooks.fullHash instead)", - "DEP_MODULE_TEMPLATE_HASH" - ) - } - }); + constructor(compilation, outputOptions, requestShortener) { + this.compilation = compilation; + this.outputOptions = outputOptions || {}; + this.requestShortener = requestShortener; + this.globalObject = getGlobalObject(outputOptions.globalObject); } -} - -Object.defineProperty(ModuleTemplate.prototype, "runtimeTemplate", { - get: util.deprecate( - /** - * @this {ModuleTemplate} - * @returns {TODO} output options - */ - function () { - return this._runtimeTemplate; - }, - "ModuleTemplate.runtimeTemplate is deprecated (use Compilation.runtimeTemplate instead)", - "DEP_WEBPACK_CHUNK_TEMPLATE_OUTPUT_OPTIONS" - ) -}); - -module.exports = ModuleTemplate; - - -/***/ }), - -/***/ 11234: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { cleanUp } = __webpack_require__(59985); -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); - -class ModuleWarning extends WebpackError { - /** - * @param {Error} warning error thrown - * @param {{from?: string|null}} info additional info - */ - constructor(warning, { from = null } = {}) { - let message = "Module Warning"; - - if (from) { - message += ` (from ${from}):\n`; - } else { - message += ": "; - } - - if (warning && typeof warning === "object" && warning.message) { - message += warning.message; - } else if (warning) { - message += String(warning); - } - - super(message); - this.name = "ModuleWarning"; - this.warning = warning; - this.details = - warning && typeof warning === "object" && warning.stack - ? cleanUp(warning.stack, this.message) - : undefined; + isIIFE() { + return this.outputOptions.iife; } - serialize(context) { - const { write } = context; - - write(this.warning); + isModule() { + return this.outputOptions.module; + } - super.serialize(context); + supportsConst() { + return this.outputOptions.environment.const; } - deserialize(context) { - const { read } = context; + supportsArrowFunction() { + return this.outputOptions.environment.arrowFunction; + } - this.warning = read(); + supportsOptionalChaining() { + return this.outputOptions.environment.optionalChaining; + } - super.deserialize(context); + supportsForOf() { + return this.outputOptions.environment.forOf; } -} -makeSerializable(ModuleWarning, "webpack/lib/ModuleWarning"); + supportsDestructuring() { + return this.outputOptions.environment.destructuring; + } -module.exports = ModuleWarning; + supportsBigIntLiteral() { + return this.outputOptions.environment.bigIntLiteral; + } + supportsDynamicImport() { + return this.outputOptions.environment.dynamicImport; + } -/***/ }), + supportsEcmaScriptModuleSyntax() { + return this.outputOptions.environment.module; + } -/***/ 33370: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + supportTemplateLiteral() { + return this.outputOptions.environment.templateLiteral; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + returningFunction(returnValue, args = "") { + return this.supportsArrowFunction() + ? `(${args}) => (${returnValue})` + : `function(${args}) { return ${returnValue}; }`; + } + basicFunction(args, body) { + return this.supportsArrowFunction() + ? `(${args}) => {\n${Template.indent(body)}\n}` + : `function(${args}) {\n${Template.indent(body)}\n}`; + } + /** + * @param {Array} args args + * @returns {string} result expression + */ + concatenation(...args) { + const len = args.length; -const asyncLib = __webpack_require__(78175); -const { SyncHook, MultiHook } = __webpack_require__(41242); + if (len === 2) return this._es5Concatenation(args); + if (len === 0) return '""'; + if (len === 1) { + return typeof args[0] === "string" + ? JSON.stringify(args[0]) + : `"" + ${args[0].expr}`; + } + if (!this.supportTemplateLiteral()) return this._es5Concatenation(args); -const ConcurrentCompilationError = __webpack_require__(95735); -const MultiStats = __webpack_require__(24170); -const MultiWatching = __webpack_require__(81128); -const ArrayQueue = __webpack_require__(41792); + // cost comparison between template literal and concatenation: + // both need equal surroundings: `xxx` vs "xxx" + // template literal has constant cost of 3 chars for each expression + // es5 concatenation has cost of 3 + n chars for n expressions in row + // when a es5 concatenation ends with an expression it reduces cost by 3 + // when a es5 concatenation starts with an single expression it reduces cost by 3 + // e. g. `${a}${b}${c}` (3*3 = 9) is longer than ""+a+b+c ((3+3)-3 = 3) + // e. g. `x${a}x${b}x${c}x` (3*3 = 9) is shorter than "x"+a+"x"+b+"x"+c+"x" (4+4+4 = 12) -/** @template T @typedef {import("tapable").AsyncSeriesHook} AsyncSeriesHook */ -/** @template T @template R @typedef {import("tapable").SyncBailHook} SyncBailHook */ -/** @typedef {import("../declarations/WebpackOptions").WatchOptions} WatchOptions */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Stats")} Stats */ -/** @typedef {import("./Watching")} Watching */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ -/** @typedef {import("./util/fs").IntermediateFileSystem} IntermediateFileSystem */ -/** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */ -/** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */ + let templateCost = 0; + let concatenationCost = 0; -/** - * @template T - * @callback Callback - * @param {(Error | null)=} err - * @param {T=} result - */ + let lastWasExpr = false; + for (const arg of args) { + const isExpr = typeof arg !== "string"; + if (isExpr) { + templateCost += 3; + concatenationCost += lastWasExpr ? 1 : 4; + } + lastWasExpr = isExpr; + } + if (lastWasExpr) concatenationCost -= 3; + if (typeof args[0] !== "string" && typeof args[1] === "string") + concatenationCost -= 3; -/** - * @callback RunWithDependenciesHandler - * @param {Compiler} compiler - * @param {Callback} callback - */ + if (concatenationCost <= templateCost) return this._es5Concatenation(args); -/** - * @typedef {Object} MultiCompilerOptions - * @property {number=} parallelism how many Compilers are allows to run at the same time in parallel - */ + return `\`${args + .map(arg => (typeof arg === "string" ? arg : `\${${arg.expr}}`)) + .join("")}\``; + } -module.exports = class MultiCompiler { /** - * @param {Compiler[] | Record} compilers child compilers - * @param {MultiCompilerOptions} options options + * @param {Array} args args (len >= 2) + * @returns {string} result expression + * @private */ - constructor(compilers, options) { - if (!Array.isArray(compilers)) { - compilers = Object.keys(compilers).map(name => { - compilers[name].name = name; - return compilers[name]; - }); - } - - this.hooks = Object.freeze({ - /** @type {SyncHook<[MultiStats]>} */ - done: new SyncHook(["stats"]), - /** @type {MultiHook>} */ - invalid: new MultiHook(compilers.map(c => c.hooks.invalid)), - /** @type {MultiHook>} */ - run: new MultiHook(compilers.map(c => c.hooks.run)), - /** @type {SyncHook<[]>} */ - watchClose: new SyncHook([]), - /** @type {MultiHook>} */ - watchRun: new MultiHook(compilers.map(c => c.hooks.watchRun)), - /** @type {MultiHook>} */ - infrastructureLog: new MultiHook( - compilers.map(c => c.hooks.infrastructureLog) - ) - }); - this.compilers = compilers; - /** @type {MultiCompilerOptions} */ - this._options = { - parallelism: options.parallelism || Infinity - }; - /** @type {WeakMap} */ - this.dependencies = new WeakMap(); - this.running = false; + _es5Concatenation(args) { + const str = args + .map(arg => (typeof arg === "string" ? JSON.stringify(arg) : arg.expr)) + .join(" + "); - /** @type {Stats[]} */ - const compilerStats = this.compilers.map(() => null); - let doneCompilers = 0; - for (let index = 0; index < this.compilers.length; index++) { - const compiler = this.compilers[index]; - const compilerIndex = index; - let compilerDone = false; - compiler.hooks.done.tap("MultiCompiler", stats => { - if (!compilerDone) { - compilerDone = true; - doneCompilers++; - } - compilerStats[compilerIndex] = stats; - if (doneCompilers === this.compilers.length) { - this.hooks.done.call(new MultiStats(compilerStats)); - } - }); - compiler.hooks.invalid.tap("MultiCompiler", () => { - if (compilerDone) { - compilerDone = false; - doneCompilers--; - } - }); - } + // when the first two args are expression, we need to prepend "" + to force string + // concatenation instead of number addition. + return typeof args[0] !== "string" && typeof args[1] !== "string" + ? `"" + ${str}` + : str; } - get options() { - return Object.assign( - this.compilers.map(c => c.options), - this._options - ); + expressionFunction(expression, args = "") { + return this.supportsArrowFunction() + ? `(${args}) => (${expression})` + : `function(${args}) { ${expression}; }`; } - get outputPath() { - let commonPath = this.compilers[0].outputPath; - for (const compiler of this.compilers) { - while ( - compiler.outputPath.indexOf(commonPath) !== 0 && - /[/\\]/.test(commonPath) - ) { - commonPath = commonPath.replace(/[/\\][^/\\]*$/, ""); - } - } - - if (!commonPath && this.compilers[0].outputPath[0] === "/") return "/"; - return commonPath; + emptyFunction() { + return this.supportsArrowFunction() ? "x => {}" : "function() {}"; } - get inputFileSystem() { - throw new Error("Cannot read inputFileSystem of a MultiCompiler"); + destructureArray(items, value) { + return this.supportsDestructuring() + ? `var [${items.join(", ")}] = ${value};` + : Template.asString( + items.map((item, i) => `var ${item} = ${value}[${i}];`) + ); } - get outputFileSystem() { - throw new Error("Cannot read outputFileSystem of a MultiCompiler"); + destructureObject(items, value) { + return this.supportsDestructuring() + ? `var {${items.join(", ")}} = ${value};` + : Template.asString( + items.map(item => `var ${item} = ${value}${propertyAccess([item])};`) + ); } - get watchFileSystem() { - throw new Error("Cannot read watchFileSystem of a MultiCompiler"); + iife(args, body) { + return `(${this.basicFunction(args, body)})()`; } - get intermediateFileSystem() { - throw new Error("Cannot read outputFileSystem of a MultiCompiler"); + forEach(variable, array, body) { + return this.supportsForOf() + ? `for(const ${variable} of ${array}) {\n${Template.indent(body)}\n}` + : `${array}.forEach(function(${variable}) {\n${Template.indent( + body + )}\n});`; } /** - * @param {InputFileSystem} value the new input file system + * Add a comment + * @param {object} options Information content of the comment + * @param {string=} options.request request string used originally + * @param {string=} options.chunkName name of the chunk referenced + * @param {string=} options.chunkReason reason information of the chunk + * @param {string=} options.message additional message + * @param {string=} options.exportName name of the export + * @returns {string} comment */ - set inputFileSystem(value) { - for (const compiler of this.compilers) { - compiler.inputFileSystem = value; + comment({ request, chunkName, chunkReason, message, exportName }) { + let content; + if (this.outputOptions.pathinfo) { + content = [message, request, chunkName, chunkReason] + .filter(Boolean) + .map(item => this.requestShortener.shorten(item)) + .join(" | "); + } else { + content = [message, chunkName, chunkReason] + .filter(Boolean) + .map(item => this.requestShortener.shorten(item)) + .join(" | "); + } + if (!content) return ""; + if (this.outputOptions.pathinfo) { + return Template.toComment(content) + " "; + } else { + return Template.toNormalComment(content) + " "; } } /** - * @param {OutputFileSystem} value the new output file system + * @param {object} options generation options + * @param {string=} options.request request string used originally + * @returns {string} generated error block */ - set outputFileSystem(value) { - for (const compiler of this.compilers) { - compiler.outputFileSystem = value; - } + throwMissingModuleErrorBlock({ request }) { + const err = `Cannot find module '${request}'`; + return `var e = new Error(${JSON.stringify( + err + )}); e.code = 'MODULE_NOT_FOUND'; throw e;`; } /** - * @param {WatchFileSystem} value the new watch file system + * @param {object} options generation options + * @param {string=} options.request request string used originally + * @returns {string} generated error function */ - set watchFileSystem(value) { - for (const compiler of this.compilers) { - compiler.watchFileSystem = value; - } + throwMissingModuleErrorFunction({ request }) { + return `function webpackMissingModule() { ${this.throwMissingModuleErrorBlock( + { request } + )} }`; } /** - * @param {IntermediateFileSystem} value the new intermediate file system + * @param {object} options generation options + * @param {string=} options.request request string used originally + * @returns {string} generated error IIFE */ - set intermediateFileSystem(value) { - for (const compiler of this.compilers) { - compiler.intermediateFileSystem = value; - } + missingModule({ request }) { + return `Object(${this.throwMissingModuleErrorFunction({ request })}())`; } - getInfrastructureLogger(name) { - return this.compilers[0].getInfrastructureLogger(name); + /** + * @param {object} options generation options + * @param {string=} options.request request string used originally + * @returns {string} generated error statement + */ + missingModuleStatement({ request }) { + return `${this.missingModule({ request })};\n`; } /** - * @param {Compiler} compiler the child compiler - * @param {string[]} dependencies its dependencies - * @returns {void} + * @param {object} options generation options + * @param {string=} options.request request string used originally + * @returns {string} generated error code */ - setDependencies(compiler, dependencies) { - this.dependencies.set(compiler, dependencies); + missingModulePromise({ request }) { + return `Promise.resolve().then(${this.throwMissingModuleErrorFunction({ + request + })})`; } /** - * @param {Callback} callback signals when the validation is complete - * @returns {boolean} true if the dependencies are valid + * @param {Object} options options object + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {Module} options.module the module + * @param {string} options.request the request that should be printed as comment + * @param {string=} options.idExpr expression to use as id expression + * @param {"expression" | "promise" | "statements"} options.type which kind of code should be returned + * @returns {string} the code */ - validateDependencies(callback) { - /** @type {Set<{source: Compiler, target: Compiler}>} */ - const edges = new Set(); - /** @type {string[]} */ - const missing = []; - const targetFound = compiler => { - for (const edge of edges) { - if (edge.target === compiler) { - return true; - } - } - return false; - }; - const sortEdges = (e1, e2) => { - return ( - e1.source.name.localeCompare(e2.source.name) || - e1.target.name.localeCompare(e2.target.name) - ); - }; - for (const source of this.compilers) { - const dependencies = this.dependencies.get(source); - if (dependencies) { - for (const dep of dependencies) { - const target = this.compilers.find(c => c.name === dep); - if (!target) { - missing.push(dep); - } else { - edges.add({ - source, - target - }); - } - } - } - } - /** @type {string[]} */ - const errors = missing.map(m => `Compiler dependency \`${m}\` not found.`); - const stack = this.compilers.filter(c => !targetFound(c)); - while (stack.length > 0) { - const current = stack.pop(); - for (const edge of edges) { - if (edge.source === current) { - edges.delete(edge); - const target = edge.target; - if (!targetFound(target)) { - stack.push(target); - } - } - } - } - if (edges.size > 0) { - /** @type {string[]} */ - const lines = Array.from(edges) - .sort(sortEdges) - .map(edge => `${edge.source.name} -> ${edge.target.name}`); - lines.unshift("Circular dependency found in compiler dependencies."); - errors.unshift(lines.join("\n")); - } - if (errors.length > 0) { - const message = errors.join("\n"); - callback(new Error(message)); - return false; + weakError({ module, chunkGraph, request, idExpr, type }) { + const moduleId = chunkGraph.getModuleId(module); + const errorMessage = + moduleId === null + ? JSON.stringify("Module is not available (weak dependency)") + : idExpr + ? `"Module '" + ${idExpr} + "' is not available (weak dependency)"` + : JSON.stringify( + `Module '${moduleId}' is not available (weak dependency)` + ); + const comment = request ? Template.toNormalComment(request) + " " : ""; + const errorStatements = + `var e = new Error(${errorMessage}); ` + + comment + + "e.code = 'MODULE_NOT_FOUND'; throw e;"; + switch (type) { + case "statements": + return errorStatements; + case "promise": + return `Promise.resolve().then(${this.basicFunction( + "", + errorStatements + )})`; + case "expression": + return this.iife("", errorStatements); } - return true; } - // TODO webpack 6 remove /** - * @deprecated This method should have been private - * @param {Compiler[]} compilers the child compilers - * @param {RunWithDependenciesHandler} fn a handler to run for each compiler - * @param {Callback} callback the compiler's handler - * @returns {void} + * @param {Object} options options object + * @param {Module} options.module the module + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {string} options.request the request that should be printed as comment + * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) + * @returns {string} the expression */ - runWithDependencies(compilers, fn, callback) { - const fulfilledNames = new Set(); - let remainingCompilers = compilers; - const isDependencyFulfilled = d => fulfilledNames.has(d); - const getReadyCompilers = () => { - let readyCompilers = []; - let list = remainingCompilers; - remainingCompilers = []; - for (const c of list) { - const dependencies = this.dependencies.get(c); - const ready = - !dependencies || dependencies.every(isDependencyFulfilled); - if (ready) { - readyCompilers.push(c); - } else { - remainingCompilers.push(c); - } + moduleId({ module, chunkGraph, request, weak }) { + if (!module) { + return this.missingModule({ + request + }); + } + const moduleId = chunkGraph.getModuleId(module); + if (moduleId === null) { + if (weak) { + return "null /* weak dependency, without id */"; } - return readyCompilers; - }; - const runCompilers = callback => { - if (remainingCompilers.length === 0) return callback(); - asyncLib.map( - getReadyCompilers(), - (compiler, callback) => { - fn(compiler, err => { - if (err) return callback(err); - fulfilledNames.add(compiler.name); - runCompilers(callback); - }); - }, - callback + throw new Error( + `RuntimeTemplate.moduleId(): ${noModuleIdErrorMessage( + module, + chunkGraph + )}` ); - }; - runCompilers(callback); + } + return `${this.comment({ request })}${JSON.stringify(moduleId)}`; } /** - * @template SetupResult - * @param {function(Compiler, number, Callback, function(): boolean, function(): void, function(): void): SetupResult} setup setup a single compiler - * @param {function(Compiler, SetupResult, Callback): void} run run/continue a single compiler - * @param {Callback} callback callback when all compilers are done, result includes Stats of all changed compilers - * @returns {SetupResult[]} result of setup + * @param {Object} options options object + * @param {Module} options.module the module + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {string} options.request the request that should be printed as comment + * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @returns {string} the expression */ - _runGraph(setup, run, callback) { - /** @typedef {{ compiler: Compiler, setupResult: SetupResult, result: Stats, state: "pending" | "blocked" | "queued" | "starting" | "running" | "running-outdated" | "done", children: Node[], parents: Node[] }} Node */ - - // State transitions for nodes: - // -> blocked (initial) - // blocked -> starting [running++] (when all parents done) - // queued -> starting [running++] (when processing the queue) - // starting -> running (when run has been called) - // running -> done [running--] (when compilation is done) - // done -> pending (when invalidated from file change) - // pending -> blocked [add to queue] (when invalidated from aggregated changes) - // done -> blocked [add to queue] (when invalidated, from parent invalidation) - // running -> running-outdated (when invalidated, either from change or parent invalidation) - // running-outdated -> blocked [running--] (when compilation is done) - - /** @type {Node[]} */ - const nodes = this.compilers.map(compiler => ({ - compiler, - setupResult: undefined, - result: undefined, - state: "blocked", - children: [], - parents: [] - })); - /** @type {Map} */ - const compilerToNode = new Map(); - for (const node of nodes) compilerToNode.set(node.compiler.name, node); - for (const node of nodes) { - const dependencies = this.dependencies.get(node.compiler); - if (!dependencies) continue; - for (const dep of dependencies) { - const parent = compilerToNode.get(dep); - node.parents.push(parent); - parent.children.push(node); - } - } - /** @type {ArrayQueue} */ - const queue = new ArrayQueue(); - for (const node of nodes) { - if (node.parents.length === 0) { - node.state = "queued"; - queue.enqueue(node); - } + moduleRaw({ module, chunkGraph, request, weak, runtimeRequirements }) { + if (!module) { + return this.missingModule({ + request + }); } - let errored = false; - let running = 0; - const parallelism = this._options.parallelism; - /** - * @param {Node} node node - * @param {Error=} err error - * @param {Stats=} stats result - * @returns {void} - */ - const nodeDone = (node, err, stats) => { - if (errored) return; - if (err) { - errored = true; - return asyncLib.each( - nodes, - (node, callback) => { - if (node.compiler.watching) { - node.compiler.watching.close(callback); - } else { - callback(); - } - }, - () => callback(err) - ); - } - node.result = stats; - running--; - if (node.state === "running") { - node.state = "done"; - for (const child of node.children) { - if (child.state === "blocked") queue.enqueue(child); - } - } else if (node.state === "running-outdated") { - node.state = "blocked"; - queue.enqueue(node); - } - processQueue(); - }; - /** - * @param {Node} node node - * @returns {void} - */ - const nodeInvalidFromParent = node => { - if (node.state === "done") { - node.state = "blocked"; - } else if (node.state === "running") { - node.state = "running-outdated"; - } - for (const child of node.children) { - nodeInvalidFromParent(child); - } - }; - /** - * @param {Node} node node - * @returns {void} - */ - const nodeInvalid = node => { - if (node.state === "done") { - node.state = "pending"; - } else if (node.state === "running") { - node.state = "running-outdated"; - } - for (const child of node.children) { - nodeInvalidFromParent(child); - } - }; - /** - * @param {Node} node node - * @returns {void} - */ - const nodeChange = node => { - nodeInvalid(node); - if (node.state === "pending") { - node.state = "blocked"; - } - if (node.state === "blocked") { - queue.enqueue(node); - processQueue(); + const moduleId = chunkGraph.getModuleId(module); + if (moduleId === null) { + if (weak) { + // only weak referenced modules don't get an id + // we can always emit an error emitting code here + return this.weakError({ + module, + chunkGraph, + request, + type: "expression" + }); } - }; - - const setupResults = []; - nodes.forEach((node, i) => { - setupResults.push( - (node.setupResult = setup( - node.compiler, - i, - nodeDone.bind(null, node), - () => node.state !== "starting" && node.state !== "running", - () => nodeChange(node), - () => nodeInvalid(node) - )) + throw new Error( + `RuntimeTemplate.moduleId(): ${noModuleIdErrorMessage( + module, + chunkGraph + )}` ); - }); - let processing = true; - const processQueue = () => { - if (processing) return; - processing = true; - process.nextTick(processQueueWorker); - }; - const processQueueWorker = () => { - while (running < parallelism && queue.length > 0 && !errored) { - const node = queue.dequeue(); - if ( - node.state === "queued" || - (node.state === "blocked" && - node.parents.every(p => p.state === "done")) - ) { - running++; - node.state = "starting"; - run(node.compiler, node.setupResult, nodeDone.bind(null, node)); - node.state = "running"; - } - } - processing = false; - if ( - !errored && - running === 0 && - nodes.every(node => node.state === "done") - ) { - const stats = []; - for (const node of nodes) { - const result = node.result; - if (result) { - node.result = undefined; - stats.push(result); - } - } - if (stats.length > 0) { - callback(null, new MultiStats(stats)); - } - } - }; - processQueueWorker(); - return setupResults; + } + runtimeRequirements.add(RuntimeGlobals.require); + return `__webpack_require__(${this.moduleId({ + module, + chunkGraph, + request, + weak + })})`; } /** - * @param {WatchOptions|WatchOptions[]} watchOptions the watcher's options - * @param {Callback} handler signals when the call finishes - * @returns {MultiWatching} a compiler watcher + * @param {Object} options options object + * @param {Module} options.module the module + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {string} options.request the request that should be printed as comment + * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @returns {string} the expression */ - watch(watchOptions, handler) { - if (this.running) { - return handler(new ConcurrentCompilationError()); - } - this.running = true; - - if (this.validateDependencies(handler)) { - const watchings = this._runGraph( - (compiler, idx, callback, isBlocked, setChanged, setInvalid) => { - const watching = compiler.watch( - Array.isArray(watchOptions) ? watchOptions[idx] : watchOptions, - callback - ); - if (watching) { - watching._onInvalid = setInvalid; - watching._onChange = setChanged; - watching._isBlocked = isBlocked; - } - return watching; - }, - (compiler, watching, callback) => { - if (compiler.watching !== watching) return; - if (!watching.running) watching.invalidate(); - }, - handler - ); - return new MultiWatching(watchings, this); - } - - return new MultiWatching([], this); + moduleExports({ module, chunkGraph, request, weak, runtimeRequirements }) { + return this.moduleRaw({ + module, + chunkGraph, + request, + weak, + runtimeRequirements + }); } /** - * @param {Callback} callback signals when the call finishes - * @returns {void} + * @param {Object} options options object + * @param {Module} options.module the module + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {string} options.request the request that should be printed as comment + * @param {boolean=} options.strict if the current module is in strict esm mode + * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @returns {string} the expression */ - run(callback) { - if (this.running) { - return callback(new ConcurrentCompilationError()); + moduleNamespace({ + module, + chunkGraph, + request, + strict, + weak, + runtimeRequirements + }) { + if (!module) { + return this.missingModule({ + request + }); } - this.running = true; - - if (this.validateDependencies(callback)) { - this._runGraph( - () => {}, - (compiler, setupResult, callback) => compiler.run(callback), - (err, stats) => { - this.running = false; - - if (callback !== undefined) { - return callback(err, stats); - } - } + if (chunkGraph.getModuleId(module) === null) { + if (weak) { + // only weak referenced modules don't get an id + // we can always emit an error emitting code here + return this.weakError({ + module, + chunkGraph, + request, + type: "expression" + }); + } + throw new Error( + `RuntimeTemplate.moduleNamespace(): ${noModuleIdErrorMessage( + module, + chunkGraph + )}` ); } - } - - purgeInputFileSystem() { - for (const compiler of this.compilers) { - if (compiler.inputFileSystem && compiler.inputFileSystem.purge) { - compiler.inputFileSystem.purge(); - } + const moduleId = this.moduleId({ + module, + chunkGraph, + request, + weak + }); + const exportsType = module.getExportsType(chunkGraph.moduleGraph, strict); + switch (exportsType) { + case "namespace": + return this.moduleRaw({ + module, + chunkGraph, + request, + weak, + runtimeRequirements + }); + case "default-with-named": + runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); + return `${RuntimeGlobals.createFakeNamespaceObject}(${moduleId}, 3)`; + case "default-only": + runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); + return `${RuntimeGlobals.createFakeNamespaceObject}(${moduleId}, 1)`; + case "dynamic": + runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); + return `${RuntimeGlobals.createFakeNamespaceObject}(${moduleId}, 7)`; } } /** - * @param {Callback} callback signals when the compiler closes - * @returns {void} + * @param {Object} options options object + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {AsyncDependenciesBlock=} options.block the current dependencies block + * @param {Module} options.module the module + * @param {string} options.request the request that should be printed as comment + * @param {string} options.message a message for the comment + * @param {boolean=} options.strict if the current module is in strict esm mode + * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @returns {string} the promise expression */ - close(callback) { - asyncLib.each( - this.compilers, - (compiler, callback) => { - compiler.close(callback); - }, - callback - ); - } -}; - - -/***/ }), - -/***/ 24170: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const identifierUtils = __webpack_require__(82186); - -/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */ -/** @typedef {import("./Stats")} Stats */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").KnownStatsCompilation} KnownStatsCompilation */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */ - -const indent = (str, prefix) => { - const rem = str.replace(/\n([^\n])/g, "\n" + prefix + "$1"); - return prefix + rem; -}; + moduleNamespacePromise({ + chunkGraph, + block, + module, + request, + message, + strict, + weak, + runtimeRequirements + }) { + if (!module) { + return this.missingModulePromise({ + request + }); + } + const moduleId = chunkGraph.getModuleId(module); + if (moduleId === null) { + if (weak) { + // only weak referenced modules don't get an id + // we can always emit an error emitting code here + return this.weakError({ + module, + chunkGraph, + request, + type: "promise" + }); + } + throw new Error( + `RuntimeTemplate.moduleNamespacePromise(): ${noModuleIdErrorMessage( + module, + chunkGraph + )}` + ); + } + const promise = this.blockPromise({ + chunkGraph, + block, + message, + runtimeRequirements + }); -class MultiStats { - /** - * @param {Stats[]} stats the child stats - */ - constructor(stats) { - this.stats = stats; - } + let appending; + let idExpr = JSON.stringify(chunkGraph.getModuleId(module)); + const comment = this.comment({ + request + }); + let header = ""; + if (weak) { + if (idExpr.length > 8) { + // 'var x="nnnnnn";x,"+x+",x' vs '"nnnnnn",nnnnnn,"nnnnnn"' + header += `var id = ${idExpr}; `; + idExpr = "id"; + } + runtimeRequirements.add(RuntimeGlobals.moduleFactories); + header += `if(!${ + RuntimeGlobals.moduleFactories + }[${idExpr}]) { ${this.weakError({ + module, + chunkGraph, + request, + idExpr, + type: "statements" + })} } `; + } + const moduleIdExpr = this.moduleId({ + module, + chunkGraph, + request, + weak + }); + const exportsType = module.getExportsType(chunkGraph.moduleGraph, strict); + let fakeType = 16; + switch (exportsType) { + case "namespace": + if (header) { + const rawModule = this.moduleRaw({ + module, + chunkGraph, + request, + weak, + runtimeRequirements + }); + appending = `.then(${this.basicFunction( + "", + `${header}return ${rawModule};` + )})`; + } else { + runtimeRequirements.add(RuntimeGlobals.require); + appending = `.then(__webpack_require__.bind(__webpack_require__, ${comment}${idExpr}))`; + } + break; + case "dynamic": + fakeType |= 4; + /* fall through */ + case "default-with-named": + fakeType |= 2; + /* fall through */ + case "default-only": + runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); + if (chunkGraph.moduleGraph.isAsync(module)) { + if (header) { + const rawModule = this.moduleRaw({ + module, + chunkGraph, + request, + weak, + runtimeRequirements + }); + appending = `.then(${this.basicFunction( + "", + `${header}return ${rawModule};` + )})`; + } else { + runtimeRequirements.add(RuntimeGlobals.require); + appending = `.then(__webpack_require__.bind(__webpack_require__, ${comment}${idExpr}))`; + } + appending += `.then(${this.returningFunction( + `${RuntimeGlobals.createFakeNamespaceObject}(m, ${fakeType})`, + "m" + )})`; + } else { + fakeType |= 1; + if (header) { + const returnExpression = `${RuntimeGlobals.createFakeNamespaceObject}(${moduleIdExpr}, ${fakeType})`; + appending = `.then(${this.basicFunction( + "", + `${header}return ${returnExpression};` + )})`; + } else { + appending = `.then(${RuntimeGlobals.createFakeNamespaceObject}.bind(__webpack_require__, ${comment}${idExpr}, ${fakeType}))`; + } + } + break; + } - get hash() { - return this.stats.map(stat => stat.hash).join(""); + return `${promise || "Promise.resolve()"}${appending}`; } /** - * @returns {boolean} true if a child compilation encountered an error + * @param {Object} options options object + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {RuntimeSpec=} options.runtime runtime for which this code will be generated + * @param {RuntimeSpec | boolean=} options.runtimeCondition only execute the statement in some runtimes + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @returns {string} expression */ - hasErrors() { - return this.stats.some(stat => stat.hasErrors()); + runtimeConditionExpression({ + chunkGraph, + runtimeCondition, + runtime, + runtimeRequirements + }) { + if (runtimeCondition === undefined) return "true"; + if (typeof runtimeCondition === "boolean") return `${runtimeCondition}`; + /** @type {Set} */ + const positiveRuntimeIds = new Set(); + forEachRuntime(runtimeCondition, runtime => + positiveRuntimeIds.add(`${chunkGraph.getRuntimeId(runtime)}`) + ); + /** @type {Set} */ + const negativeRuntimeIds = new Set(); + forEachRuntime(subtractRuntime(runtime, runtimeCondition), runtime => + negativeRuntimeIds.add(`${chunkGraph.getRuntimeId(runtime)}`) + ); + runtimeRequirements.add(RuntimeGlobals.runtimeId); + return compileBooleanMatcher.fromLists( + Array.from(positiveRuntimeIds), + Array.from(negativeRuntimeIds) + )(RuntimeGlobals.runtimeId); } /** - * @returns {boolean} true if a child compilation had a warning + * + * @param {Object} options options object + * @param {boolean=} options.update whether a new variable should be created or the existing one updated + * @param {Module} options.module the module + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {string} options.request the request that should be printed as comment + * @param {string} options.importVar name of the import variable + * @param {Module} options.originModule module in which the statement is emitted + * @param {boolean=} options.weak true, if this is a weak dependency + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @returns {[string, string]} the import statement and the compat statement */ - hasWarnings() { - return this.stats.some(stat => stat.hasWarnings()); - } - - _createChildOptions(options, context) { - if (!options) { - options = {}; + importStatement({ + update, + module, + chunkGraph, + request, + importVar, + originModule, + weak, + runtimeRequirements + }) { + if (!module) { + return [ + this.missingModuleStatement({ + request + }), + "" + ]; } - const { children: childrenOptions = undefined, ...baseOptions } = - typeof options === "string" ? { preset: options } : options; - const children = this.stats.map((stat, idx) => { - const childOptions = Array.isArray(childrenOptions) - ? childrenOptions[idx] - : childrenOptions; - return stat.compilation.createStatsOptions( - { - ...baseOptions, - ...(typeof childOptions === "string" - ? { preset: childOptions } - : childOptions && typeof childOptions === "object" - ? childOptions - : undefined) - }, - context + if (chunkGraph.getModuleId(module) === null) { + if (weak) { + // only weak referenced modules don't get an id + // we can always emit an error emitting code here + return [ + this.weakError({ + module, + chunkGraph, + request, + type: "statements" + }), + "" + ]; + } + throw new Error( + `RuntimeTemplate.importStatement(): ${noModuleIdErrorMessage( + module, + chunkGraph + )}` ); + } + const moduleId = this.moduleId({ + module, + chunkGraph, + request, + weak }); - return { - version: children.every(o => o.version), - hash: children.every(o => o.hash), - errorsCount: children.every(o => o.errorsCount), - warningsCount: children.every(o => o.warningsCount), - errors: children.every(o => o.errors), - warnings: children.every(o => o.warnings), - children - }; + const optDeclaration = update ? "" : "var "; + + const exportsType = module.getExportsType( + chunkGraph.moduleGraph, + originModule.buildMeta.strictHarmonyModule + ); + runtimeRequirements.add(RuntimeGlobals.require); + const importContent = `/* harmony import */ ${optDeclaration}${importVar} = __webpack_require__(${moduleId});\n`; + + if (exportsType === "dynamic") { + runtimeRequirements.add(RuntimeGlobals.compatGetDefaultExport); + return [ + importContent, + `/* harmony import */ ${optDeclaration}${importVar}_default = /*#__PURE__*/${RuntimeGlobals.compatGetDefaultExport}(${importVar});\n` + ]; + } + return [importContent, ""]; } /** - * @param {any} options stats options - * @returns {StatsCompilation} json output + * @param {Object} options options + * @param {ModuleGraph} options.moduleGraph the module graph + * @param {Module} options.module the module + * @param {string} options.request the request + * @param {string | string[]} options.exportName the export name + * @param {Module} options.originModule the origin module + * @param {boolean|undefined} options.asiSafe true, if location is safe for ASI, a bracket can be emitted + * @param {boolean} options.isCall true, if expression will be called + * @param {boolean} options.callContext when false, call context will not be preserved + * @param {boolean} options.defaultInterop when true and accessing the default exports, interop code will be generated + * @param {string} options.importVar the identifier name of the import variable + * @param {InitFragment[]} options.initFragments init fragments will be added here + * @param {RuntimeSpec} options.runtime runtime for which this code will be generated + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @returns {string} expression */ - toJson(options) { - options = this._createChildOptions(options, { forToString: false }); - /** @type {KnownStatsCompilation} */ - const obj = {}; - obj.children = this.stats.map((stat, idx) => { - const obj = stat.toJson(options.children[idx]); - const compilationName = stat.compilation.name; - const name = - compilationName && - identifierUtils.makePathsRelative( - options.context, - compilationName, - stat.compilation.compiler.root - ); - obj.name = name; - return obj; - }); - if (options.version) { - obj.version = obj.children[0].version; + exportFromImport({ + moduleGraph, + module, + request, + exportName, + originModule, + asiSafe, + isCall, + callContext, + defaultInterop, + importVar, + initFragments, + runtime, + runtimeRequirements + }) { + if (!module) { + return this.missingModule({ + request + }); } - if (options.hash) { - obj.hash = obj.children.map(j => j.hash).join(""); + if (!Array.isArray(exportName)) { + exportName = exportName ? [exportName] : []; } - const mapError = (j, obj) => { - return { - ...obj, - compilerPath: obj.compilerPath - ? `${j.name}.${obj.compilerPath}` - : j.name - }; - }; - if (options.errors) { - obj.errors = []; - for (const j of obj.children) { - for (const i of j.errors) { - obj.errors.push(mapError(j, i)); + const exportsType = module.getExportsType( + moduleGraph, + originModule.buildMeta.strictHarmonyModule + ); + + if (defaultInterop) { + if (exportName.length > 0 && exportName[0] === "default") { + switch (exportsType) { + case "dynamic": + if (isCall) { + return `${importVar}_default()${propertyAccess(exportName, 1)}`; + } else { + return asiSafe + ? `(${importVar}_default()${propertyAccess(exportName, 1)})` + : asiSafe === false + ? `;(${importVar}_default()${propertyAccess(exportName, 1)})` + : `${importVar}_default.a${propertyAccess(exportName, 1)}`; + } + case "default-only": + case "default-with-named": + exportName = exportName.slice(1); + break; } - } - } - if (options.warnings) { - obj.warnings = []; - for (const j of obj.children) { - for (const i of j.warnings) { - obj.warnings.push(mapError(j, i)); + } else if (exportName.length > 0) { + if (exportsType === "default-only") { + return ( + "/* non-default import from non-esm module */undefined" + + propertyAccess(exportName, 1) + ); + } else if ( + exportsType !== "namespace" && + exportName[0] === "__esModule" + ) { + return "/* __esModule */true"; } + } else if ( + exportsType === "default-only" || + exportsType === "default-with-named" + ) { + runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); + initFragments.push( + new InitFragment( + `var ${importVar}_namespace_cache;\n`, + InitFragment.STAGE_CONSTANTS, + -1, + `${importVar}_namespace_cache` + ) + ); + return `/*#__PURE__*/ ${ + asiSafe ? "" : asiSafe === false ? ";" : "Object" + }(${importVar}_namespace_cache || (${importVar}_namespace_cache = ${ + RuntimeGlobals.createFakeNamespaceObject + }(${importVar}${exportsType === "default-only" ? "" : ", 2"})))`; } } - if (options.errorsCount) { - obj.errorsCount = 0; - for (const j of obj.children) { - obj.errorsCount += j.errorsCount; + + if (exportName.length > 0) { + const exportsInfo = moduleGraph.getExportsInfo(module); + const used = exportsInfo.getUsedName(exportName, runtime); + if (!used) { + const comment = Template.toNormalComment( + `unused export ${propertyAccess(exportName)}` + ); + return `${comment} undefined`; } - } - if (options.warningsCount) { - obj.warningsCount = 0; - for (const j of obj.children) { - obj.warningsCount += j.warningsCount; + const comment = equals(used, exportName) + ? "" + : Template.toNormalComment(propertyAccess(exportName)) + " "; + const access = `${importVar}${comment}${propertyAccess(used)}`; + if (isCall && callContext === false) { + return asiSafe + ? `(0,${access})` + : asiSafe === false + ? `;(0,${access})` + : `/*#__PURE__*/Object(${access})`; } + return access; + } else { + return importVar; } - return obj; - } - - toString(options) { - options = this._createChildOptions(options, { forToString: true }); - const results = this.stats.map((stat, idx) => { - const str = stat.toString(options.children[idx]); - const compilationName = stat.compilation.name; - const name = - compilationName && - identifierUtils - .makePathsRelative( - options.context, - compilationName, - stat.compilation.compiler.root - ) - .replace(/\|/g, " "); - if (!str) return str; - return name ? `${name}:\n${indent(str, " ")}` : str; - }); - return results.filter(Boolean).join("\n\n"); } -} - -module.exports = MultiStats; - - -/***/ }), - -/***/ 81128: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const asyncLib = __webpack_require__(78175); - -/** @typedef {import("./MultiCompiler")} MultiCompiler */ -/** @typedef {import("./Watching")} Watching */ - -/** - * @template T - * @callback Callback - * @param {(Error | null)=} err - * @param {T=} result - */ - -class MultiWatching { /** - * @param {Watching[]} watchings child compilers' watchers - * @param {MultiCompiler} compiler the compiler + * @param {Object} options options + * @param {AsyncDependenciesBlock} options.block the async block + * @param {string} options.message the message + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @returns {string} expression */ - constructor(watchings, compiler) { - this.watchings = watchings; - this.compiler = compiler; - } - - invalidate(callback) { - if (callback) { - asyncLib.each( - this.watchings, - (watching, callback) => watching.invalidate(callback), - callback - ); + blockPromise({ block, message, chunkGraph, runtimeRequirements }) { + if (!block) { + const comment = this.comment({ + message + }); + return `Promise.resolve(${comment.trim()})`; + } + const chunkGroup = chunkGraph.getBlockChunkGroup(block); + if (!chunkGroup || chunkGroup.chunks.length === 0) { + const comment = this.comment({ + message + }); + return `Promise.resolve(${comment.trim()})`; + } + const chunks = chunkGroup.chunks.filter( + chunk => !chunk.hasRuntime() && chunk.id !== null + ); + const comment = this.comment({ + message, + chunkName: block.chunkName + }); + if (chunks.length === 1) { + const chunkId = JSON.stringify(chunks[0].id); + runtimeRequirements.add(RuntimeGlobals.ensureChunk); + return `${RuntimeGlobals.ensureChunk}(${comment}${chunkId})`; + } else if (chunks.length > 0) { + runtimeRequirements.add(RuntimeGlobals.ensureChunk); + const requireChunkId = chunk => + `${RuntimeGlobals.ensureChunk}(${JSON.stringify(chunk.id)})`; + return `Promise.all(${comment.trim()}[${chunks + .map(requireChunkId) + .join(", ")}])`; } else { - for (const watching of this.watchings) { - watching.invalidate(); - } + return `Promise.resolve(${comment.trim()})`; } } - suspend() { - for (const watching of this.watchings) { - watching.suspend(); - } + /** + * @param {Object} options options + * @param {AsyncDependenciesBlock} options.block the async block + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @param {string=} options.request request string used originally + * @returns {string} expression + */ + asyncModuleFactory({ block, chunkGraph, runtimeRequirements, request }) { + const dep = block.dependencies[0]; + const module = chunkGraph.moduleGraph.getModule(dep); + const ensureChunk = this.blockPromise({ + block, + message: "", + chunkGraph, + runtimeRequirements + }); + const factory = this.returningFunction( + this.moduleRaw({ + module, + chunkGraph, + request, + runtimeRequirements + }) + ); + return this.returningFunction( + ensureChunk.startsWith("Promise.resolve(") + ? `${factory}` + : `${ensureChunk}.then(${this.returningFunction(factory)})` + ); } - resume() { - for (const watching of this.watchings) { - watching.resume(); - } + /** + * @param {Object} options options + * @param {Dependency} options.dependency the dependency + * @param {ChunkGraph} options.chunkGraph the chunk graph + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @param {string=} options.request request string used originally + * @returns {string} expression + */ + syncModuleFactory({ dependency, chunkGraph, runtimeRequirements, request }) { + const module = chunkGraph.moduleGraph.getModule(dependency); + const factory = this.returningFunction( + this.moduleRaw({ + module, + chunkGraph, + request, + runtimeRequirements + }) + ); + return this.returningFunction(factory); } /** - * @param {Callback} callback signals when the watcher is closed - * @returns {void} + * @param {Object} options options + * @param {string} options.exportsArgument the name of the exports object + * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements + * @returns {string} statement */ - close(callback) { - asyncLib.forEach( - this.watchings, - (watching, finishedCallback) => { - watching.close(finishedCallback); - }, - err => { - this.compiler.hooks.watchClose.call(); - if (typeof callback === "function") { - this.compiler.running = false; - callback(err); - } - } - ); + defineEsModuleFlagStatement({ exportsArgument, runtimeRequirements }) { + runtimeRequirements.add(RuntimeGlobals.makeNamespaceObject); + runtimeRequirements.add(RuntimeGlobals.exports); + return `${RuntimeGlobals.makeNamespaceObject}(${exportsArgument});\n`; + } + + /** + * @param {Object} options options object + * @param {Module} options.module the module + * @param {string} options.publicPath the public path + * @param {RuntimeSpec=} options.runtime runtime + * @param {CodeGenerationResults} options.codeGenerationResults the code generation results + * @returns {string} the url of the asset + */ + assetUrl({ publicPath, runtime, module, codeGenerationResults }) { + if (!module) { + return "data:,"; + } + const codeGen = codeGenerationResults.get(module, runtime); + const { data } = codeGen; + const url = data.get("url"); + if (url) return url.toString(); + const filename = data.get("filename"); + return publicPath + filename; } } -module.exports = MultiWatching; +module.exports = RuntimeTemplate; /***/ }), -/***/ 50169: +/***/ 63560: /***/ (function(module) { "use strict"; @@ -55403,104 +54730,76 @@ module.exports = MultiWatching; -/** @typedef {import("./Compiler")} Compiler */ +class SelfModuleFactory { + constructor(moduleGraph) { + this.moduleGraph = moduleGraph; + } -class NoEmitOnErrorsPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.shouldEmit.tap("NoEmitOnErrorsPlugin", compilation => { - if (compilation.getStats().hasErrors()) return false; - }); - compiler.hooks.compilation.tap("NoEmitOnErrorsPlugin", compilation => { - compilation.hooks.shouldRecord.tap("NoEmitOnErrorsPlugin", () => { - if (compilation.getStats().hasErrors()) return false; - }); + create(data, callback) { + const module = this.moduleGraph.getParentModule(data.dependencies[0]); + callback(null, { + module }); } } -module.exports = NoEmitOnErrorsPlugin; +module.exports = SelfModuleFactory; /***/ }), -/***/ 80832: +/***/ 48076: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Sean Larkin @thelarkinn */ -const WebpackError = __webpack_require__(53799); - -module.exports = class NoModeWarning extends WebpackError { - constructor() { - super(); - - this.name = "NoModeWarning"; - this.message = - "configuration\n" + - "The 'mode' option has not been set, webpack will fallback to 'production' for this value.\n" + - "Set 'mode' option to 'development' or 'production' to enable defaults for each environment.\n" + - "You can also set it to 'none' to disable any default behavior. " + - "Learn more: https://webpack.js.org/configuration/mode/"; - } -}; +module.exports = __webpack_require__(96953); /***/ }), -/***/ 6325: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 71070: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Sean Larkin @thelarkinn */ -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); - -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ - -class NodeStuffInWebError extends WebpackError { - /** - * @param {DependencyLocation} loc loc - * @param {string} expression expression - * @param {string} description description - */ - constructor(loc, expression, description) { - super( - `${JSON.stringify( - expression - )} has been used, it will be undefined in next major version. -${description}` - ); +/** + * @param {number} size the size in bytes + * @returns {string} the formatted size + */ +exports.formatSize = size => { + if (typeof size !== "number" || Number.isNaN(size) === true) { + return "unknown size"; + } - this.name = "NodeStuffInWebError"; - this.loc = loc; + if (size <= 0) { + return "0 bytes"; } -} -makeSerializable(NodeStuffInWebError, "webpack/lib/NodeStuffInWebError"); + const abbreviations = ["bytes", "KiB", "MiB", "GiB"]; + const index = Math.floor(Math.log(size) / Math.log(1024)); -module.exports = NodeStuffInWebError; + return `${+(size / Math.pow(1024, index)).toPrecision(3)} ${ + abbreviations[index] + }`; +}; /***/ }), -/***/ 95287: +/***/ 97513: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -55511,180 +54810,61 @@ module.exports = NodeStuffInWebError; -const NodeStuffInWebError = __webpack_require__(6325); -const RuntimeGlobals = __webpack_require__(16475); -const CachedConstDependency = __webpack_require__(57403); -const ConstDependency = __webpack_require__(76911); -const { - evaluateToString, - expressionIsUnsupported -} = __webpack_require__(93998); -const { relative } = __webpack_require__(17139); -const { parseResource } = __webpack_require__(82186); +const JavascriptModulesPlugin = __webpack_require__(89464); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./Compilation")} Compilation */ -class NodeStuffPlugin { +class SourceMapDevToolModuleOptionsPlugin { constructor(options) { this.options = options; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {Compilation} compilation the compiler instance * @returns {void} */ - apply(compiler) { + apply(compilation) { const options = this.options; - compiler.hooks.compilation.tap( - "NodeStuffPlugin", - (compilation, { normalModuleFactory }) => { - const handler = (parser, parserOptions) => { - if (parserOptions.node === false) return; - - let localOptions = options; - if (parserOptions.node) { - localOptions = { ...localOptions, ...parserOptions.node }; - } - - if (localOptions.global !== false) { - const withWarning = localOptions.global === "warn"; - parser.hooks.expression - .for("global") - .tap("NodeStuffPlugin", expr => { - const dep = new ConstDependency( - RuntimeGlobals.global, - expr.range, - [RuntimeGlobals.global] - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - - // TODO webpack 6 remove - if (withWarning) { - parser.state.module.addWarning( - new NodeStuffInWebError( - dep.loc, - "global", - "The global namespace object is Node.js feature and doesn't present in browser." - ) - ); - } - }); - } - - const setModuleConstant = (expressionName, fn, warning) => { - parser.hooks.expression - .for(expressionName) - .tap("NodeStuffPlugin", expr => { - const dep = new CachedConstDependency( - JSON.stringify(fn(parser.state.module)), - expr.range, - expressionName - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - - // TODO webpack 6 remove - if (warning) { - parser.state.module.addWarning( - new NodeStuffInWebError(dep.loc, expressionName, warning) - ); - } - - return true; - }); - }; - - const setConstant = (expressionName, value, warning) => - setModuleConstant(expressionName, () => value, warning); - - const context = compiler.context; - if (localOptions.__filename) { - switch (localOptions.__filename) { - case "mock": - setConstant("__filename", "/index.js"); - break; - case "warn-mock": - setConstant( - "__filename", - "/index.js", - "The __filename is Node.js feature and doesn't present in browser." - ); - break; - case true: - setModuleConstant("__filename", module => - relative(compiler.inputFileSystem, context, module.resource) - ); - break; - } - - parser.hooks.evaluateIdentifier - .for("__filename") - .tap("NodeStuffPlugin", expr => { - if (!parser.state.module) return; - const resource = parseResource(parser.state.module.resource); - return evaluateToString(resource.path)(expr); - }); - } - if (localOptions.__dirname) { - switch (localOptions.__dirname) { - case "mock": - setConstant("__dirname", "/"); - break; - case "warn-mock": - setConstant( - "__dirname", - "/", - "The __dirname is Node.js feature and doesn't present in browser." - ); - break; - case true: - setModuleConstant("__dirname", module => - relative(compiler.inputFileSystem, context, module.context) - ); - break; - } - - parser.hooks.evaluateIdentifier - .for("__dirname") - .tap("NodeStuffPlugin", expr => { - if (!parser.state.module) return; - return evaluateToString(parser.state.module.context)(expr); - }); - } - parser.hooks.expression - .for("require.extensions") - .tap( - "NodeStuffPlugin", - expressionIsUnsupported( - parser, - "require.extensions is not supported by webpack. Use a loader instead." - ) - ); - }; - - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("NodeStuffPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("NodeStuffPlugin", handler); - } + if (options.module !== false) { + compilation.hooks.buildModule.tap( + "SourceMapDevToolModuleOptionsPlugin", + module => { + module.useSourceMap = true; + } + ); + compilation.hooks.runtimeModule.tap( + "SourceMapDevToolModuleOptionsPlugin", + module => { + module.useSourceMap = true; + } + ); + } else { + compilation.hooks.buildModule.tap( + "SourceMapDevToolModuleOptionsPlugin", + module => { + module.useSimpleSourceMap = true; + } + ); + compilation.hooks.runtimeModule.tap( + "SourceMapDevToolModuleOptionsPlugin", + module => { + module.useSimpleSourceMap = true; + } + ); + } + JavascriptModulesPlugin.getCompilationHooks(compilation).useSourceMap.tap( + "SourceMapDevToolModuleOptionsPlugin", + () => true ); } } -module.exports = NodeStuffPlugin; +module.exports = SourceMapDevToolModuleOptionsPlugin; /***/ }), -/***/ 39: +/***/ 63872: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -55695,1410 +54875,1478 @@ module.exports = NodeStuffPlugin; -const parseJson = __webpack_require__(15235); -const { getContext, runLoaders } = __webpack_require__(68318); -const querystring = __webpack_require__(63477); -const { HookMap, SyncHook, AsyncSeriesBailHook } = __webpack_require__(41242); -const { - CachedSource, - OriginalSource, - RawSource, - SourceMapSource -} = __webpack_require__(51255); +const asyncLib = __webpack_require__(78175); +const { ConcatSource, RawSource } = __webpack_require__(51255); const Compilation = __webpack_require__(85720); -const HookWebpackError = __webpack_require__(11351); -const Module = __webpack_require__(73208); -const ModuleBuildError = __webpack_require__(21305); -const ModuleError = __webpack_require__(23744); -const ModuleGraphConnection = __webpack_require__(40639); -const ModuleParseError = __webpack_require__(58443); -const ModuleWarning = __webpack_require__(11234); -const RuntimeGlobals = __webpack_require__(16475); -const UnhandledSchemeError = __webpack_require__(68099); -const WebpackError = __webpack_require__(53799); -const formatLocation = __webpack_require__(16734); -const LazySet = __webpack_require__(38938); -const { isSubset } = __webpack_require__(93347); -const { getScheme } = __webpack_require__(54500); -const { - compareLocations, - concatComparators, - compareSelect, - keepOriginalOrder -} = __webpack_require__(29579); +const ModuleFilenameHelpers = __webpack_require__(88821); +const ProgressPlugin = __webpack_require__(13216); +const SourceMapDevToolModuleOptionsPlugin = __webpack_require__(97513); +const createSchemaValidation = __webpack_require__(32540); const createHash = __webpack_require__(49835); -const { createFakeHook } = __webpack_require__(64518); -const { join } = __webpack_require__(17139); -const { - contextify, - absolutify, - makePathsRelative -} = __webpack_require__(82186); -const makeSerializable = __webpack_require__(33032); -const memoize = __webpack_require__(78676); +const { relative, dirname } = __webpack_require__(17139); +const { makePathsAbsolute } = __webpack_require__(82186); +/** @typedef {import("webpack-sources").MapOptions} MapOptions */ /** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/LoaderContext").NormalModuleLoaderContext} NormalModuleLoaderContext */ -/** @typedef {import("../declarations/WebpackOptions").Mode} Mode */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */ +/** @typedef {import("./Cache").Etag} Etag */ +/** @typedef {import("./CacheFacade").ItemCacheFacade} ItemCacheFacade */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ /** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./Generator")} Generator */ -/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("./Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ -/** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ -/** @typedef {import("./Parser")} Parser */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./logging/Logger").Logger} WebpackLogger */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./NormalModule").SourceMap} SourceMap */ /** @typedef {import("./util/Hash")} Hash */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ - -/** - * @typedef {Object} SourceMap - * @property {number} version - * @property {string[]} sources - * @property {string} mappings - * @property {string=} file - * @property {string=} sourceRoot - * @property {string[]=} sourcesContent - * @property {string[]=} names - */ -const getInvalidDependenciesModuleWarning = memoize(() => - __webpack_require__(68257) +const validate = createSchemaValidation( + __webpack_require__(2885), + () => __webpack_require__(30501), + { + name: "SourceMap DevTool Plugin", + baseDataPath: "options" + } ); -const getValidate = memoize(() => (__webpack_require__(38476).validate)); - -const ABSOLUTE_PATH_REGEX = /^([a-zA-Z]:\\|\\\\|\/)/; - /** - * @typedef {Object} LoaderItem - * @property {string} loader - * @property {any} options - * @property {string?} ident - * @property {string?} type + * @typedef {object} SourceMapTask + * @property {Source} asset + * @property {AssetInfo} assetInfo + * @property {(string | Module)[]} modules + * @property {string} source + * @property {string} file + * @property {SourceMap} sourceMap + * @property {ItemCacheFacade} cacheItem cache item */ /** - * @param {string} context absolute context path - * @param {string} source a source path - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {string} new source path + * Escapes regular expression metacharacters + * @param {string} str String to quote + * @returns {string} Escaped string */ -const contextifySourceUrl = (context, source, associatedObjectForCache) => { - if (source.startsWith("webpack://")) return source; - return `webpack://${makePathsRelative( - context, - source, - associatedObjectForCache - )}`; +const quoteMeta = str => { + return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); }; /** - * @param {string} context absolute context path - * @param {SourceMap} sourceMap a source map - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {SourceMap} new source map + * Creating {@link SourceMapTask} for given file + * @param {string} file current compiled file + * @param {Source} asset the asset + * @param {AssetInfo} assetInfo the asset info + * @param {MapOptions} options source map options + * @param {Compilation} compilation compilation instance + * @param {ItemCacheFacade} cacheItem cache item + * @returns {SourceMapTask | undefined} created task instance or `undefined` */ -const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => { - if (!Array.isArray(sourceMap.sources)) return sourceMap; - const { sourceRoot } = sourceMap; - /** @type {function(string): string} */ - const mapper = !sourceRoot - ? source => source - : sourceRoot.endsWith("/") - ? source => - source.startsWith("/") - ? `${sourceRoot.slice(0, -1)}${source}` - : `${sourceRoot}${source}` - : source => - source.startsWith("/") - ? `${sourceRoot}${source}` - : `${sourceRoot}/${source}`; - const newSources = sourceMap.sources.map(source => - contextifySourceUrl(context, mapper(source), associatedObjectForCache) - ); +const getTaskForFile = ( + file, + asset, + assetInfo, + options, + compilation, + cacheItem +) => { + let source; + /** @type {SourceMap} */ + let sourceMap; + /** + * Check if asset can build source map + */ + if (asset.sourceAndMap) { + const sourceAndMap = asset.sourceAndMap(options); + sourceMap = /** @type {SourceMap} */ (sourceAndMap.map); + source = sourceAndMap.source; + } else { + sourceMap = /** @type {SourceMap} */ (asset.map(options)); + source = asset.source(); + } + if (!sourceMap || typeof source !== "string") return; + const context = compilation.options.context; + const root = compilation.compiler.root; + const cachedAbsolutify = makePathsAbsolute.bindContextCache(context, root); + const modules = sourceMap.sources.map(source => { + if (!source.startsWith("webpack://")) return source; + source = cachedAbsolutify(source.slice(10)); + const module = compilation.findModule(source); + return module || source; + }); + return { - ...sourceMap, - file: "x", - sourceRoot: undefined, - sources: newSources + file, + asset, + source, + assetInfo, + sourceMap, + modules, + cacheItem }; }; -/** - * @param {string | Buffer} input the input - * @returns {string} the converted string - */ -const asString = input => { - if (Buffer.isBuffer(input)) { - return input.toString("utf-8"); - } - return input; -}; +class SourceMapDevToolPlugin { + /** + * @param {SourceMapDevToolPluginOptions} [options] options object + * @throws {Error} throws error, if got more than 1 arguments + */ + constructor(options = {}) { + validate(options); -/** - * @param {string | Buffer} input the input - * @returns {Buffer} the converted buffer - */ -const asBuffer = input => { - if (!Buffer.isBuffer(input)) { - return Buffer.from(input, "utf-8"); + /** @type {string | false} */ + this.sourceMapFilename = options.filename; + /** @type {string | false} */ + this.sourceMappingURLComment = + options.append === false + ? false + : options.append || "\n//# source" + "MappingURL=[url]"; + /** @type {string | Function} */ + this.moduleFilenameTemplate = + options.moduleFilenameTemplate || "webpack://[namespace]/[resourcePath]"; + /** @type {string | Function} */ + this.fallbackModuleFilenameTemplate = + options.fallbackModuleFilenameTemplate || + "webpack://[namespace]/[resourcePath]?[hash]"; + /** @type {string} */ + this.namespace = options.namespace || ""; + /** @type {SourceMapDevToolPluginOptions} */ + this.options = options; } - return input; -}; -class NonErrorEmittedError extends WebpackError { - constructor(error) { - super(); + /** + * Apply the plugin + * @param {Compiler} compiler compiler instance + * @returns {void} + */ + apply(compiler) { + const outputFs = compiler.outputFileSystem; + const sourceMapFilename = this.sourceMapFilename; + const sourceMappingURLComment = this.sourceMappingURLComment; + const moduleFilenameTemplate = this.moduleFilenameTemplate; + const namespace = this.namespace; + const fallbackModuleFilenameTemplate = this.fallbackModuleFilenameTemplate; + const requestShortener = compiler.requestShortener; + const options = this.options; + options.test = options.test || /\.((c|m)?js|css)($|\?)/i; - this.name = "NonErrorEmittedError"; - this.message = "(Emitted value instead of an instance of Error) " + error; - } -} + const matchObject = ModuleFilenameHelpers.matchObject.bind( + undefined, + options + ); -makeSerializable( - NonErrorEmittedError, - "webpack/lib/NormalModule", - "NonErrorEmittedError" -); + compiler.hooks.compilation.tap("SourceMapDevToolPlugin", compilation => { + new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation); -/** - * @typedef {Object} NormalModuleCompilationHooks - * @property {SyncHook<[object, NormalModule]>} loader - * @property {SyncHook<[LoaderItem[], NormalModule, object]>} beforeLoaders - * @property {SyncHook<[NormalModule]>} beforeParse - * @property {SyncHook<[NormalModule]>} beforeSnapshot - * @property {HookMap>} readResourceForScheme - * @property {HookMap>} readResource - * @property {AsyncSeriesBailHook<[NormalModule, NeedBuildContext], boolean>} needBuild - */ + compilation.hooks.processAssets.tapAsync( + { + name: "SourceMapDevToolPlugin", + stage: Compilation.PROCESS_ASSETS_STAGE_DEV_TOOLING, + additionalAssets: true + }, + (assets, callback) => { + const chunkGraph = compilation.chunkGraph; + const cache = compilation.getCache("SourceMapDevToolPlugin"); + /** @type {Map} */ + const moduleToSourceNameMapping = new Map(); + /** + * @type {Function} + * @returns {void} + */ + const reportProgress = + ProgressPlugin.getReporter(compilation.compiler) || (() => {}); -/** @type {WeakMap} */ -const compilationHooksMap = new WeakMap(); + /** @type {Map} */ + const fileToChunk = new Map(); + for (const chunk of compilation.chunks) { + for (const file of chunk.files) { + fileToChunk.set(file, chunk); + } + for (const file of chunk.auxiliaryFiles) { + fileToChunk.set(file, chunk); + } + } -class NormalModule extends Module { - /** - * @param {Compilation} compilation the compilation - * @returns {NormalModuleCompilationHooks} the attached hooks - */ - static getCompilationHooks(compilation) { - if (!(compilation instanceof Compilation)) { - throw new TypeError( - "The 'compilation' argument must be an instance of Compilation" - ); - } - let hooks = compilationHooksMap.get(compilation); - if (hooks === undefined) { - hooks = { - loader: new SyncHook(["loaderContext", "module"]), - beforeLoaders: new SyncHook(["loaders", "module", "loaderContext"]), - beforeParse: new SyncHook(["module"]), - beforeSnapshot: new SyncHook(["module"]), - // TODO webpack 6 deprecate - readResourceForScheme: new HookMap(scheme => { - const hook = hooks.readResource.for(scheme); - return createFakeHook( - /** @type {AsyncSeriesBailHook<[string, NormalModule], string | Buffer>} */ ({ - tap: (options, fn) => - hook.tap(options, loaderContext => - fn(loaderContext.resource, loaderContext._module) - ), - tapAsync: (options, fn) => - hook.tapAsync(options, (loaderContext, callback) => - fn(loaderContext.resource, loaderContext._module, callback) - ), - tapPromise: (options, fn) => - hook.tapPromise(options, loaderContext => - fn(loaderContext.resource, loaderContext._module) - ) - }) - ); - }), - readResource: new HookMap( - () => new AsyncSeriesBailHook(["loaderContext"]) - ), - needBuild: new AsyncSeriesBailHook(["module", "context"]) - }; - compilationHooksMap.set(compilation, hooks); - } - return hooks; - } + /** @type {string[]} */ + const files = []; + for (const file of Object.keys(assets)) { + if (matchObject(file)) { + files.push(file); + } + } - /** - * @param {Object} options options object - * @param {string=} options.layer an optional layer in which the module is - * @param {string} options.type module type - * @param {string} options.request request string - * @param {string} options.userRequest request intended by user (without loaders from config) - * @param {string} options.rawRequest request without resolving - * @param {LoaderItem[]} options.loaders list of loaders - * @param {string} options.resource path + query of the real resource - * @param {Record=} options.resourceResolveData resource resolve data - * @param {string} options.context context directory for resolving - * @param {string | undefined} options.matchResource path + query of the matched resource (virtual) - * @param {Parser} options.parser the parser used - * @param {object} options.parserOptions the options of the parser used - * @param {Generator} options.generator the generator used - * @param {object} options.generatorOptions the options of the generator used - * @param {Object} options.resolveOptions options used for resolving requests from this module - */ - constructor({ - layer, - type, - request, - userRequest, - rawRequest, - loaders, - resource, - resourceResolveData, - context, - matchResource, - parser, - parserOptions, - generator, - generatorOptions, - resolveOptions - }) { - super(type, context || getContext(resource), layer); + reportProgress(0.0); + /** @type {SourceMapTask[]} */ + const tasks = []; + let fileIndex = 0; - // Info from Factory - /** @type {string} */ - this.request = request; - /** @type {string} */ - this.userRequest = userRequest; - /** @type {string} */ - this.rawRequest = rawRequest; - /** @type {boolean} */ - this.binary = /^(asset|webassembly)\b/.test(type); - /** @type {Parser} */ - this.parser = parser; - this.parserOptions = parserOptions; - /** @type {Generator} */ - this.generator = generator; - this.generatorOptions = generatorOptions; - /** @type {string} */ - this.resource = resource; - this.resourceResolveData = resourceResolveData; - /** @type {string | undefined} */ - this.matchResource = matchResource; - /** @type {LoaderItem[]} */ - this.loaders = loaders; - if (resolveOptions !== undefined) { - // already declared in super class - this.resolveOptions = resolveOptions; - } + asyncLib.each( + files, + (file, callback) => { + const asset = compilation.getAsset(file); + if (asset.info.related && asset.info.related.sourceMap) { + fileIndex++; + return callback(); + } + const cacheItem = cache.getItemCache( + file, + cache.mergeEtags( + cache.getLazyHashedEtag(asset.source), + namespace + ) + ); - // Info from Build - /** @type {(WebpackError | null)=} */ - this.error = null; - /** @private @type {Source=} */ - this._source = null; - /** @private @type {Map | undefined} **/ - this._sourceSizes = undefined; - /** @private @type {Set} */ - this._sourceTypes = undefined; + cacheItem.get((err, cacheEntry) => { + if (err) { + return callback(err); + } + /** + * If presented in cache, reassigns assets. Cache assets already have source maps. + */ + if (cacheEntry) { + const { assets, assetsInfo } = cacheEntry; + for (const cachedFile of Object.keys(assets)) { + if (cachedFile === file) { + compilation.updateAsset( + cachedFile, + assets[cachedFile], + assetsInfo[cachedFile] + ); + } else { + compilation.emitAsset( + cachedFile, + assets[cachedFile], + assetsInfo[cachedFile] + ); + } + /** + * Add file to chunk, if not presented there + */ + if (cachedFile !== file) { + const chunk = fileToChunk.get(file); + if (chunk !== undefined) + chunk.auxiliaryFiles.add(cachedFile); + } + } - // Cache - this._lastSuccessfulBuildMeta = {}; - this._forceBuild = true; - this._isEvaluatingSideEffects = false; - /** @type {WeakSet | undefined} */ - this._addedSideEffectsBailout = undefined; - } + reportProgress( + (0.5 * ++fileIndex) / files.length, + file, + "restored cached SourceMap" + ); - /** - * @returns {string} a unique identifier of the module - */ - identifier() { - if (this.layer === null) { - if (this.type === "javascript/auto") { - return this.request; - } else { - return `${this.type}|${this.request}`; - } - } else { - return `${this.type}|${this.request}|${this.layer}`; - } - } + return callback(); + } - /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module - */ - readableIdentifier(requestShortener) { - return requestShortener.shorten(this.userRequest); - } + reportProgress( + (0.5 * fileIndex) / files.length, + file, + "generate SourceMap" + ); - /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion - */ - libIdent(options) { - let ident = contextify( - options.context, - this.userRequest, - options.associatedObjectForCache - ); - if (this.layer) ident = `(${this.layer})/${ident}`; - return ident; - } + /** @type {SourceMapTask | undefined} */ + const task = getTaskForFile( + file, + asset.source, + asset.info, + { + module: options.module, + columns: options.columns + }, + compilation, + cacheItem + ); - /** - * @returns {string | null} absolute path which should be used for condition matching (usually the resource path) - */ - nameForCondition() { - const resource = this.matchResource || this.resource; - const idx = resource.indexOf("?"); - if (idx >= 0) return resource.substr(0, idx); - return resource; - } + if (task) { + const modules = task.modules; - /** - * Assuming this module is in the cache. Update the (cached) module with - * the fresh module from the factory. Usually updates internal references - * and properties. - * @param {Module} module fresh module - * @returns {void} - */ - updateCacheModule(module) { - super.updateCacheModule(module); - const m = /** @type {NormalModule} */ (module); - this.binary = m.binary; - this.request = m.request; - this.userRequest = m.userRequest; - this.rawRequest = m.rawRequest; - this.parser = m.parser; - this.parserOptions = m.parserOptions; - this.generator = m.generator; - this.generatorOptions = m.generatorOptions; - this.resource = m.resource; - this.resourceResolveData = m.resourceResolveData; - this.context = m.context; - this.matchResource = m.matchResource; - this.loaders = m.loaders; + for (let idx = 0; idx < modules.length; idx++) { + const module = modules[idx]; + if (!moduleToSourceNameMapping.get(module)) { + moduleToSourceNameMapping.set( + module, + ModuleFilenameHelpers.createFilename( + module, + { + moduleFilenameTemplate: moduleFilenameTemplate, + namespace: namespace + }, + { + requestShortener, + chunkGraph, + hashFunction: compilation.outputOptions.hashFunction + } + ) + ); + } + } + + tasks.push(task); + } + + reportProgress( + (0.5 * ++fileIndex) / files.length, + file, + "generated SourceMap" + ); + + callback(); + }); + }, + err => { + if (err) { + return callback(err); + } + + reportProgress(0.5, "resolve sources"); + /** @type {Set} */ + const usedNamesSet = new Set(moduleToSourceNameMapping.values()); + /** @type {Set} */ + const conflictDetectionSet = new Set(); + + /** + * all modules in defined order (longest identifier first) + * @type {Array} + */ + const allModules = Array.from( + moduleToSourceNameMapping.keys() + ).sort((a, b) => { + const ai = typeof a === "string" ? a : a.identifier(); + const bi = typeof b === "string" ? b : b.identifier(); + return ai.length - bi.length; + }); + + // find modules with conflicting source names + for (let idx = 0; idx < allModules.length; idx++) { + const module = allModules[idx]; + let sourceName = moduleToSourceNameMapping.get(module); + let hasName = conflictDetectionSet.has(sourceName); + if (!hasName) { + conflictDetectionSet.add(sourceName); + continue; + } + + // try the fallback name first + sourceName = ModuleFilenameHelpers.createFilename( + module, + { + moduleFilenameTemplate: fallbackModuleFilenameTemplate, + namespace: namespace + }, + { + requestShortener, + chunkGraph, + hashFunction: compilation.outputOptions.hashFunction + } + ); + hasName = usedNamesSet.has(sourceName); + if (!hasName) { + moduleToSourceNameMapping.set(module, sourceName); + usedNamesSet.add(sourceName); + continue; + } + + // otherwise just append stars until we have a valid name + while (hasName) { + sourceName += "*"; + hasName = usedNamesSet.has(sourceName); + } + moduleToSourceNameMapping.set(module, sourceName); + usedNamesSet.add(sourceName); + } + + let taskIndex = 0; + + asyncLib.each( + tasks, + (task, callback) => { + const assets = Object.create(null); + const assetsInfo = Object.create(null); + const file = task.file; + const chunk = fileToChunk.get(file); + const sourceMap = task.sourceMap; + const source = task.source; + const modules = task.modules; + + reportProgress( + 0.5 + (0.5 * taskIndex) / tasks.length, + file, + "attach SourceMap" + ); + + const moduleFilenames = modules.map(m => + moduleToSourceNameMapping.get(m) + ); + sourceMap.sources = moduleFilenames; + if (options.noSources) { + sourceMap.sourcesContent = undefined; + } + sourceMap.sourceRoot = options.sourceRoot || ""; + sourceMap.file = file; + const usesContentHash = + sourceMapFilename && + /\[contenthash(:\w+)?\]/.test(sourceMapFilename); + + // If SourceMap and asset uses contenthash, avoid a circular dependency by hiding hash in `file` + if (usesContentHash && task.assetInfo.contenthash) { + const contenthash = task.assetInfo.contenthash; + let pattern; + if (Array.isArray(contenthash)) { + pattern = contenthash.map(quoteMeta).join("|"); + } else { + pattern = quoteMeta(contenthash); + } + sourceMap.file = sourceMap.file.replace( + new RegExp(pattern, "g"), + m => "x".repeat(m.length) + ); + } + + /** @type {string | false} */ + let currentSourceMappingURLComment = sourceMappingURLComment; + if ( + currentSourceMappingURLComment !== false && + /\.css($|\?)/i.test(file) + ) { + currentSourceMappingURLComment = + currentSourceMappingURLComment.replace( + /^\n\/\/(.*)$/, + "\n/*$1*/" + ); + } + const sourceMapString = JSON.stringify(sourceMap); + if (sourceMapFilename) { + let filename = file; + const sourceMapContentHash = + usesContentHash && + /** @type {string} */ ( + createHash(compilation.outputOptions.hashFunction) + .update(sourceMapString) + .digest("hex") + ); + const pathParams = { + chunk, + filename: options.fileContext + ? relative( + outputFs, + `/${options.fileContext}`, + `/${filename}` + ) + : filename, + contentHash: sourceMapContentHash + }; + const { path: sourceMapFile, info: sourceMapInfo } = + compilation.getPathWithInfo( + sourceMapFilename, + pathParams + ); + const sourceMapUrl = options.publicPath + ? options.publicPath + sourceMapFile + : relative( + outputFs, + dirname(outputFs, `/${file}`), + `/${sourceMapFile}` + ); + /** @type {Source} */ + let asset = new RawSource(source); + if (currentSourceMappingURLComment !== false) { + // Add source map url to compilation asset, if currentSourceMappingURLComment is set + asset = new ConcatSource( + asset, + compilation.getPath( + currentSourceMappingURLComment, + Object.assign({ url: sourceMapUrl }, pathParams) + ) + ); + } + const assetInfo = { + related: { sourceMap: sourceMapFile } + }; + assets[file] = asset; + assetsInfo[file] = assetInfo; + compilation.updateAsset(file, asset, assetInfo); + // Add source map file to compilation assets and chunk files + const sourceMapAsset = new RawSource(sourceMapString); + const sourceMapAssetInfo = { + ...sourceMapInfo, + development: true + }; + assets[sourceMapFile] = sourceMapAsset; + assetsInfo[sourceMapFile] = sourceMapAssetInfo; + compilation.emitAsset( + sourceMapFile, + sourceMapAsset, + sourceMapAssetInfo + ); + if (chunk !== undefined) + chunk.auxiliaryFiles.add(sourceMapFile); + } else { + if (currentSourceMappingURLComment === false) { + throw new Error( + "SourceMapDevToolPlugin: append can't be false when no filename is provided" + ); + } + /** + * Add source map as data url to asset + */ + const asset = new ConcatSource( + new RawSource(source), + currentSourceMappingURLComment + .replace(/\[map\]/g, () => sourceMapString) + .replace( + /\[url\]/g, + () => + `data:application/json;charset=utf-8;base64,${Buffer.from( + sourceMapString, + "utf-8" + ).toString("base64")}` + ) + ); + assets[file] = asset; + assetsInfo[file] = undefined; + compilation.updateAsset(file, asset); + } + + task.cacheItem.store({ assets, assetsInfo }, err => { + reportProgress( + 0.5 + (0.5 * ++taskIndex) / tasks.length, + task.file, + "attached SourceMap" + ); + + if (err) { + return callback(err); + } + callback(); + }); + }, + err => { + reportProgress(1.0); + callback(err); + } + ); + } + ); + } + ); + }); } +} + +module.exports = SourceMapDevToolPlugin; + + +/***/ }), + +/***/ 31743: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */ +class Stats { /** - * Assuming this module is in the cache. Remove internal references to allow freeing some memory. + * @param {Compilation} compilation webpack compilation */ - cleanupForCache() { - // Make sure to cache types and sizes before cleanup when this module has been built - // They are accessed by the stats and we don't want them to crash after cleanup - // TODO reconsider this for webpack 6 - if (this.buildInfo) { - if (this._sourceTypes === undefined) this.getSourceTypes(); - for (const type of this._sourceTypes) { - this.size(type); - } - } - super.cleanupForCache(); - this.parser = undefined; - this.parserOptions = undefined; - this.generator = undefined; - this.generatorOptions = undefined; + constructor(compilation) { + this.compilation = compilation; } - /** - * Module should be unsafe cached. Get data that's needed for that. - * This data will be passed to restoreFromUnsafeCache later. - * @returns {object} cached data - */ - getUnsafeCacheData() { - const data = super.getUnsafeCacheData(); - data.parserOptions = this.parserOptions; - data.generatorOptions = this.generatorOptions; - return data; + get hash() { + return this.compilation.hash; } - restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory) { - this._restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory); + get startTime() { + return this.compilation.startTime; + } + + get endTime() { + return this.compilation.endTime; } /** - * restore unsafe cache data - * @param {object} unsafeCacheData data from getUnsafeCacheData - * @param {NormalModuleFactory} normalModuleFactory the normal module factory handling the unsafe caching + * @returns {boolean} true if the compilation had a warning */ - _restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory) { - super._restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory); - this.parserOptions = unsafeCacheData.parserOptions; - this.parser = normalModuleFactory.getParser(this.type, this.parserOptions); - this.generatorOptions = unsafeCacheData.generatorOptions; - this.generator = normalModuleFactory.getGenerator( - this.type, - this.generatorOptions + hasWarnings() { + return ( + this.compilation.warnings.length > 0 || + this.compilation.children.some(child => child.getStats().hasWarnings()) ); - // we assume the generator behaves identically and keep cached sourceTypes/Sizes } /** - * @param {string} context the compilation context - * @param {string} name the asset name - * @param {string} content the content - * @param {string | TODO} sourceMap an optional source map - * @param {Object=} associatedObjectForCache object for caching - * @returns {Source} the created source + * @returns {boolean} true if the compilation encountered an error */ - createSourceForAsset( - context, - name, - content, - sourceMap, - associatedObjectForCache - ) { - if (sourceMap) { - if ( - typeof sourceMap === "string" && - (this.useSourceMap || this.useSimpleSourceMap) - ) { - return new OriginalSource( - content, - contextifySourceUrl(context, sourceMap, associatedObjectForCache) - ); - } - - if (this.useSourceMap) { - return new SourceMapSource( - content, - name, - contextifySourceMap(context, sourceMap, associatedObjectForCache) - ); - } - } - - return new RawSource(content); + hasErrors() { + return ( + this.compilation.errors.length > 0 || + this.compilation.children.some(child => child.getStats().hasErrors()) + ); } /** - * @param {ResolverWithOptions} resolver a resolver - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {InputFileSystem} fs file system from reading - * @param {NormalModuleCompilationHooks} hooks the hooks - * @returns {NormalModuleLoaderContext} loader context + * @param {(string|StatsOptions)=} options stats options + * @returns {StatsCompilation} json output */ - _createLoaderContext(resolver, options, compilation, fs, hooks) { - const { requestShortener } = compilation.runtimeTemplate; - const getCurrentLoaderName = () => { - const currentLoader = this.getCurrentLoader(loaderContext); - if (!currentLoader) return "(not in loader scope)"; - return requestShortener.shorten(currentLoader.loader); - }; - const getResolveContext = () => { - return { - fileDependencies: { - add: d => loaderContext.addDependency(d) - }, - contextDependencies: { - add: d => loaderContext.addContextDependency(d) - }, - missingDependencies: { - add: d => loaderContext.addMissingDependency(d) - } - }; - }; - const getAbsolutify = memoize(() => - absolutify.bindCache(compilation.compiler.root) - ); - const getAbsolutifyInContext = memoize(() => - absolutify.bindContextCache(this.context, compilation.compiler.root) - ); - const getContextify = memoize(() => - contextify.bindCache(compilation.compiler.root) - ); - const getContextifyInContext = memoize(() => - contextify.bindContextCache(this.context, compilation.compiler.root) - ); - const utils = { - absolutify: (context, request) => { - return context === this.context - ? getAbsolutifyInContext()(request) - : getAbsolutify()(context, request); - }, - contextify: (context, request) => { - return context === this.context - ? getContextifyInContext()(request) - : getContextify()(context, request); - }, - createHash: type => { - return createHash(type || compilation.outputOptions.hashFunction); - } - }; - const loaderContext = { - version: 2, - getOptions: schema => { - const loader = this.getCurrentLoader(loaderContext); + toJson(options) { + options = this.compilation.createStatsOptions(options, { + forToString: false + }); - let { options } = loader; + const statsFactory = this.compilation.createStatsFactory(options); - if (typeof options === "string") { - if (options.substr(0, 1) === "{" && options.substr(-1) === "}") { - try { - options = parseJson(options); - } catch (e) { - throw new Error(`Cannot parse string options: ${e.message}`); - } - } else { - options = querystring.parse(options, "&", "=", { - maxKeys: 0 - }); - } - } + return statsFactory.create("compilation", this.compilation, { + compilation: this.compilation + }); + } - if (options === null || options === undefined) { - options = {}; - } + toString(options) { + options = this.compilation.createStatsOptions(options, { + forToString: true + }); - if (schema) { - let name = "Loader"; - let baseDataPath = "options"; - let match; - if (schema.title && (match = /^(.+) (.+)$/.exec(schema.title))) { - [, name, baseDataPath] = match; - } - getValidate()(schema, options, { - name, - baseDataPath - }); - } + const statsFactory = this.compilation.createStatsFactory(options); + const statsPrinter = this.compilation.createStatsPrinter(options); - return options; - }, - emitWarning: warning => { - if (!(warning instanceof Error)) { - warning = new NonErrorEmittedError(warning); - } - this.addWarning( - new ModuleWarning(warning, { - from: getCurrentLoaderName() - }) - ); - }, - emitError: error => { - if (!(error instanceof Error)) { - error = new NonErrorEmittedError(error); - } - this.addError( - new ModuleError(error, { - from: getCurrentLoaderName() - }) - ); - }, - getLogger: name => { - const currentLoader = this.getCurrentLoader(loaderContext); - return compilation.getLogger(() => - [currentLoader && currentLoader.loader, name, this.identifier()] - .filter(Boolean) - .join("|") - ); - }, - resolve(context, request, callback) { - resolver.resolve({}, context, request, getResolveContext(), callback); - }, - getResolve(options) { - const child = options ? resolver.withOptions(options) : resolver; - return (context, request, callback) => { - if (callback) { - child.resolve({}, context, request, getResolveContext(), callback); - } else { - return new Promise((resolve, reject) => { - child.resolve( - {}, - context, - request, - getResolveContext(), - (err, result) => { - if (err) reject(err); - else resolve(result); - } - ); - }); - } - }; - }, - emitFile: (name, content, sourceMap, assetInfo) => { - if (!this.buildInfo.assets) { - this.buildInfo.assets = Object.create(null); - this.buildInfo.assetsInfo = new Map(); - } - this.buildInfo.assets[name] = this.createSourceForAsset( - options.context, - name, - content, - sourceMap, - compilation.compiler.root - ); - this.buildInfo.assetsInfo.set(name, assetInfo); - }, - addBuildDependency: dep => { - if (this.buildInfo.buildDependencies === undefined) { - this.buildInfo.buildDependencies = new LazySet(); - } - this.buildInfo.buildDependencies.add(dep); - }, - utils, - rootContext: options.context, - webpack: true, - sourceMap: !!this.useSourceMap, - mode: options.mode || "production", - _module: this, - _compilation: compilation, - _compiler: compilation.compiler, - fs: fs - }; - - Object.assign(loaderContext, options.loader); + const data = statsFactory.create("compilation", this.compilation, { + compilation: this.compilation + }); + const result = statsPrinter.print("compilation", data); + return result === undefined ? "" : result; + } +} - hooks.loader.call(loaderContext, this); +module.exports = Stats; - return loaderContext; - } - getCurrentLoader(loaderContext, index = loaderContext.loaderIndex) { - if ( - this.loaders && - this.loaders.length && - index < this.loaders.length && - index >= 0 && - this.loaders[index] - ) { - return this.loaders[index]; - } - return null; - } +/***/ }), - /** - * @param {string} context the compilation context - * @param {string | Buffer} content the content - * @param {string | TODO} sourceMap an optional source map - * @param {Object=} associatedObjectForCache object for caching - * @returns {Source} the created source - */ - createSource(context, content, sourceMap, associatedObjectForCache) { - if (Buffer.isBuffer(content)) { - return new RawSource(content); - } +/***/ 1626: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // if there is no identifier return raw source - if (!this.identifier) { - return new RawSource(content); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // from here on we assume we have an identifier - const identifier = this.identifier(); - if (this.useSourceMap && sourceMap) { - return new SourceMapSource( - content, - contextifySourceUrl(context, identifier, associatedObjectForCache), - contextifySourceMap(context, sourceMap, associatedObjectForCache) - ); - } - if (this.useSourceMap || this.useSimpleSourceMap) { - return new OriginalSource( - content, - contextifySourceUrl(context, identifier, associatedObjectForCache) - ); - } +const { ConcatSource, PrefixSource } = __webpack_require__(51255); - return new RawSource(content); - } +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../declarations/WebpackOptions").Output} OutputOptions */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ +/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("./Compilation").PathData} PathData */ +/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./ModuleGraph")} ModuleGraph */ +/** @typedef {import("./ModuleTemplate")} ModuleTemplate */ +/** @typedef {import("./RuntimeModule")} RuntimeModule */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */ +/** @typedef {import("./javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ - /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {NormalModuleCompilationHooks} hooks the hooks - * @param {function((WebpackError | null)=): void} callback callback function - * @returns {void} - */ - _doBuild(options, compilation, resolver, fs, hooks, callback) { - const loaderContext = this._createLoaderContext( - resolver, - options, - compilation, - fs, - hooks - ); +const START_LOWERCASE_ALPHABET_CODE = "a".charCodeAt(0); +const START_UPPERCASE_ALPHABET_CODE = "A".charCodeAt(0); +const DELTA_A_TO_Z = "z".charCodeAt(0) - START_LOWERCASE_ALPHABET_CODE + 1; +const NUMBER_OF_IDENTIFIER_START_CHARS = DELTA_A_TO_Z * 2 + 2; // a-z A-Z _ $ +const NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS = + NUMBER_OF_IDENTIFIER_START_CHARS + 10; // a-z A-Z _ $ 0-9 +const FUNCTION_CONTENT_REGEX = /^function\s?\(\)\s?\{\r?\n?|\r?\n?\}$/g; +const INDENT_MULTILINE_REGEX = /^\t/gm; +const LINE_SEPARATOR_REGEX = /\r?\n/g; +const IDENTIFIER_NAME_REPLACE_REGEX = /^([^a-zA-Z$_])/; +const IDENTIFIER_ALPHA_NUMERIC_NAME_REPLACE_REGEX = /[^a-zA-Z0-9$]+/g; +const COMMENT_END_REGEX = /\*\//g; +const PATH_NAME_NORMALIZE_REPLACE_REGEX = /[^a-zA-Z0-9_!§$()=\-^°]+/g; +const MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g; - const processResult = (err, result) => { - if (err) { - if (!(err instanceof Error)) { - err = new NonErrorEmittedError(err); - } - const currentLoader = this.getCurrentLoader(loaderContext); - const error = new ModuleBuildError(err, { - from: - currentLoader && - compilation.runtimeTemplate.requestShortener.shorten( - currentLoader.loader - ) - }); - return callback(error); - } +/** + * @typedef {Object} RenderManifestOptions + * @property {Chunk} chunk the chunk used to render + * @property {string} hash + * @property {string} fullHash + * @property {OutputOptions} outputOptions + * @property {CodeGenerationResults} codeGenerationResults + * @property {{javascript: ModuleTemplate}} moduleTemplates + * @property {DependencyTemplates} dependencyTemplates + * @property {RuntimeTemplate} runtimeTemplate + * @property {ModuleGraph} moduleGraph + * @property {ChunkGraph} chunkGraph + */ - const source = result[0]; - const sourceMap = result.length >= 1 ? result[1] : null; - const extraInfo = result.length >= 2 ? result[2] : null; +/** @typedef {RenderManifestEntryTemplated | RenderManifestEntryStatic} RenderManifestEntry */ - if (!Buffer.isBuffer(source) && typeof source !== "string") { - const currentLoader = this.getCurrentLoader(loaderContext, 0); - const err = new Error( - `Final loader (${ - currentLoader - ? compilation.runtimeTemplate.requestShortener.shorten( - currentLoader.loader - ) - : "unknown" - }) didn't return a Buffer or String` - ); - const error = new ModuleBuildError(err); - return callback(error); - } +/** + * @typedef {Object} RenderManifestEntryTemplated + * @property {function(): Source} render + * @property {string | function(PathData, AssetInfo=): string} filenameTemplate + * @property {PathData=} pathOptions + * @property {AssetInfo=} info + * @property {string} identifier + * @property {string=} hash + * @property {boolean=} auxiliary + */ - this._source = this.createSource( - options.context, - this.binary ? asBuffer(source) : asString(source), - sourceMap, - compilation.compiler.root - ); - if (this._sourceSizes !== undefined) this._sourceSizes.clear(); - this._ast = - typeof extraInfo === "object" && - extraInfo !== null && - extraInfo.webpackAST !== undefined - ? extraInfo.webpackAST - : null; - return callback(); - }; +/** + * @typedef {Object} RenderManifestEntryStatic + * @property {function(): Source} render + * @property {string} filename + * @property {AssetInfo} info + * @property {string} identifier + * @property {string=} hash + * @property {boolean=} auxiliary + */ - this.buildInfo.fileDependencies = new LazySet(); - this.buildInfo.contextDependencies = new LazySet(); - this.buildInfo.missingDependencies = new LazySet(); - this.buildInfo.cacheable = true; +/** + * @typedef {Object} HasId + * @property {number | string} id + */ - try { - hooks.beforeLoaders.call(this.loaders, this, loaderContext); - } catch (err) { - processResult(err); - return; - } +/** + * @typedef {function(Module, number): boolean} ModuleFilterPredicate + */ - if (this.loaders.length > 0) { - this.buildInfo.buildDependencies = new LazySet(); - } +class Template { + /** + * + * @param {Function} fn a runtime function (.runtime.js) "template" + * @returns {string} the updated and normalized function string + */ + static getFunctionContent(fn) { + return fn + .toString() + .replace(FUNCTION_CONTENT_REGEX, "") + .replace(INDENT_MULTILINE_REGEX, "") + .replace(LINE_SEPARATOR_REGEX, "\n"); + } - runLoaders( - { - resource: this.resource, - loaders: this.loaders, - context: loaderContext, - processResource: (loaderContext, resourcePath, callback) => { - const resource = loaderContext.resource; - const scheme = getScheme(resource); - hooks.readResource - .for(scheme) - .callAsync(loaderContext, (err, result) => { - if (err) return callback(err); - if (typeof result !== "string" && !result) { - return callback(new UnhandledSchemeError(scheme, resource)); - } - return callback(null, result); - }); - } - }, - (err, result) => { - // Cleanup loaderContext to avoid leaking memory in ICs - loaderContext._compilation = - loaderContext._compiler = - loaderContext._module = - loaderContext.fs = - undefined; + /** + * @param {string} str the string converted to identifier + * @returns {string} created identifier + */ + static toIdentifier(str) { + if (typeof str !== "string") return ""; + return str + .replace(IDENTIFIER_NAME_REPLACE_REGEX, "_$1") + .replace(IDENTIFIER_ALPHA_NUMERIC_NAME_REPLACE_REGEX, "_"); + } + /** + * + * @param {string} str string to be converted to commented in bundle code + * @returns {string} returns a commented version of string + */ + static toComment(str) { + if (!str) return ""; + return `/*! ${str.replace(COMMENT_END_REGEX, "* /")} */`; + } - if (!result) { - this.buildInfo.cacheable = false; - return processResult( - err || new Error("No result from loader-runner processing"), - null - ); - } - this.buildInfo.fileDependencies.addAll(result.fileDependencies); - this.buildInfo.contextDependencies.addAll(result.contextDependencies); - this.buildInfo.missingDependencies.addAll(result.missingDependencies); - for (const loader of this.loaders) { - this.buildInfo.buildDependencies.add(loader.loader); - } - this.buildInfo.cacheable = this.buildInfo.cacheable && result.cacheable; - processResult(err, result.result); - } - ); + /** + * + * @param {string} str string to be converted to "normal comment" + * @returns {string} returns a commented version of string + */ + static toNormalComment(str) { + if (!str) return ""; + return `/* ${str.replace(COMMENT_END_REGEX, "* /")} */`; } /** - * @param {WebpackError} error the error - * @returns {void} + * @param {string} str string path to be normalized + * @returns {string} normalized bundle-safe path */ - markModuleAsErrored(error) { - // Restore build meta from successful build to keep importing state - this.buildMeta = { ...this._lastSuccessfulBuildMeta }; - this.error = error; - this.addError(error); + static toPath(str) { + if (typeof str !== "string") return ""; + return str + .replace(PATH_NAME_NORMALIZE_REPLACE_REGEX, "-") + .replace(MATCH_PADDED_HYPHENS_REPLACE_REGEX, ""); } - applyNoParseRule(rule, content) { - // must start with "rule" if rule is a string - if (typeof rule === "string") { - return content.startsWith(rule); + // map number to a single character a-z, A-Z or multiple characters if number is too big + /** + * @param {number} n number to convert to ident + * @returns {string} returns single character ident + */ + static numberToIdentifier(n) { + if (n >= NUMBER_OF_IDENTIFIER_START_CHARS) { + // use multiple letters + return ( + Template.numberToIdentifier(n % NUMBER_OF_IDENTIFIER_START_CHARS) + + Template.numberToIdentifierContinuation( + Math.floor(n / NUMBER_OF_IDENTIFIER_START_CHARS) + ) + ); } - if (typeof rule === "function") { - return rule(content); + // lower case + if (n < DELTA_A_TO_Z) { + return String.fromCharCode(START_LOWERCASE_ALPHABET_CODE + n); } - // we assume rule is a regexp - return rule.test(content); + n -= DELTA_A_TO_Z; + + // upper case + if (n < DELTA_A_TO_Z) { + return String.fromCharCode(START_UPPERCASE_ALPHABET_CODE + n); + } + + if (n === DELTA_A_TO_Z) return "_"; + return "$"; } - // check if module should not be parsed - // returns "true" if the module should !not! be parsed - // returns "false" if the module !must! be parsed - shouldPreventParsing(noParseRule, request) { - // if no noParseRule exists, return false - // the module !must! be parsed. - if (!noParseRule) { - return false; + /** + * @param {number} n number to convert to ident + * @returns {string} returns single character ident + */ + static numberToIdentifierContinuation(n) { + if (n >= NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS) { + // use multiple letters + return ( + Template.numberToIdentifierContinuation( + n % NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS + ) + + Template.numberToIdentifierContinuation( + Math.floor(n / NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS) + ) + ); } - // we only have one rule to check - if (!Array.isArray(noParseRule)) { - // returns "true" if the module is !not! to be parsed - return this.applyNoParseRule(noParseRule, request); + // lower case + if (n < DELTA_A_TO_Z) { + return String.fromCharCode(START_LOWERCASE_ALPHABET_CODE + n); } + n -= DELTA_A_TO_Z; - for (let i = 0; i < noParseRule.length; i++) { - const rule = noParseRule[i]; - // early exit on first truthy match - // this module is !not! to be parsed - if (this.applyNoParseRule(rule, request)) { - return true; - } + // upper case + if (n < DELTA_A_TO_Z) { + return String.fromCharCode(START_UPPERCASE_ALPHABET_CODE + n); } - // no match found, so this module !should! be parsed - return false; + n -= DELTA_A_TO_Z; + + // numbers + if (n < 10) { + return `${n}`; + } + + if (n === 10) return "_"; + return "$"; } - _initBuildHash(compilation) { - const hash = createHash(compilation.outputOptions.hashFunction); - if (this._source) { - hash.update("source"); - this._source.updateHash(hash); + /** + * + * @param {string | string[]} s string to convert to identity + * @returns {string} converted identity + */ + static indent(s) { + if (Array.isArray(s)) { + return s.map(Template.indent).join("\n"); + } else { + const str = s.trimRight(); + if (!str) return ""; + const ind = str[0] === "\n" ? "" : "\t"; + return ind + str.replace(/\n([^\n])/g, "\n\t$1"); } - hash.update("meta"); - hash.update(JSON.stringify(this.buildMeta)); - this.buildInfo.hash = /** @type {string} */ (hash.digest("hex")); } /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} + * + * @param {string|string[]} s string to create prefix for + * @param {string} prefix prefix to compose + * @returns {string} returns new prefix string */ - build(options, compilation, resolver, fs, callback) { - this._forceBuild = false; - this._source = null; - if (this._sourceSizes !== undefined) this._sourceSizes.clear(); - this._sourceTypes = undefined; - this._ast = null; - this.error = null; - this.clearWarningsAndErrors(); - this.clearDependenciesAndBlocks(); - this.buildMeta = {}; - this.buildInfo = { - cacheable: false, - parsed: true, - fileDependencies: undefined, - contextDependencies: undefined, - missingDependencies: undefined, - buildDependencies: undefined, - valueDependencies: undefined, - hash: undefined, - assets: undefined, - assetsInfo: undefined - }; - - const startTime = compilation.compiler.fsStartTime || Date.now(); - - const hooks = NormalModule.getCompilationHooks(compilation); - - return this._doBuild(options, compilation, resolver, fs, hooks, err => { - // if we have an error mark module as failed and exit - if (err) { - this.markModuleAsErrored(err); - this._initBuildHash(compilation); - return callback(); - } - - const handleParseError = e => { - const source = this._source.source(); - const loaders = this.loaders.map(item => - contextify(options.context, item.loader, compilation.compiler.root) - ); - const error = new ModuleParseError(source, e, loaders, this.type); - this.markModuleAsErrored(error); - this._initBuildHash(compilation); - return callback(); - }; - - const handleParseResult = result => { - this.dependencies.sort( - concatComparators( - compareSelect(a => a.loc, compareLocations), - keepOriginalOrder(this.dependencies) - ) - ); - this._initBuildHash(compilation); - this._lastSuccessfulBuildMeta = this.buildMeta; - return handleBuildDone(); - }; - - const handleBuildDone = () => { - try { - hooks.beforeSnapshot.call(this); - } catch (err) { - this.markModuleAsErrored(err); - return callback(); - } - - const snapshotOptions = compilation.options.snapshot.module; - if (!this.buildInfo.cacheable || !snapshotOptions) { - return callback(); - } - // add warning for all non-absolute paths in fileDependencies, etc - // This makes it easier to find problems with watching and/or caching - let nonAbsoluteDependencies = undefined; - const checkDependencies = deps => { - for (const dep of deps) { - if (!ABSOLUTE_PATH_REGEX.test(dep)) { - if (nonAbsoluteDependencies === undefined) - nonAbsoluteDependencies = new Set(); - nonAbsoluteDependencies.add(dep); - deps.delete(dep); - try { - const depWithoutGlob = dep.replace(/[\\/]?\*.*$/, ""); - const absolute = join( - compilation.fileSystemInfo.fs, - this.context, - depWithoutGlob - ); - if (absolute !== dep && ABSOLUTE_PATH_REGEX.test(absolute)) { - (depWithoutGlob !== dep - ? this.buildInfo.contextDependencies - : deps - ).add(absolute); - } - } catch (e) { - // ignore - } - } - } - }; - checkDependencies(this.buildInfo.fileDependencies); - checkDependencies(this.buildInfo.missingDependencies); - checkDependencies(this.buildInfo.contextDependencies); - if (nonAbsoluteDependencies !== undefined) { - const InvalidDependenciesModuleWarning = - getInvalidDependenciesModuleWarning(); - this.addWarning( - new InvalidDependenciesModuleWarning(this, nonAbsoluteDependencies) - ); - } - // convert file/context/missingDependencies into filesystem snapshot - compilation.fileSystemInfo.createSnapshot( - startTime, - this.buildInfo.fileDependencies, - this.buildInfo.contextDependencies, - this.buildInfo.missingDependencies, - snapshotOptions, - (err, snapshot) => { - if (err) { - this.markModuleAsErrored(err); - return; - } - this.buildInfo.fileDependencies = undefined; - this.buildInfo.contextDependencies = undefined; - this.buildInfo.missingDependencies = undefined; - this.buildInfo.snapshot = snapshot; - return callback(); - } - ); - }; - - try { - hooks.beforeParse.call(this); - } catch (err) { - this.markModuleAsErrored(err); - this._initBuildHash(compilation); - return callback(); - } - - // check if this module should !not! be parsed. - // if so, exit here; - const noParseRule = options.module && options.module.noParse; - if (this.shouldPreventParsing(noParseRule, this.request)) { - // We assume that we need module and exports - this.buildInfo.parsed = false; - this._initBuildHash(compilation); - return handleBuildDone(); - } + static prefix(s, prefix) { + const str = Template.asString(s).trim(); + if (!str) return ""; + const ind = str[0] === "\n" ? "" : prefix; + return ind + str.replace(/\n([^\n])/g, "\n" + prefix + "$1"); + } - let result; - try { - const source = this._source.source(); - result = this.parser.parse(this._ast || source, { - source, - current: this, - module: this, - compilation: compilation, - options: options - }); - } catch (e) { - handleParseError(e); - return; - } - handleParseResult(result); - }); + /** + * + * @param {string|string[]} str string or string collection + * @returns {string} returns a single string from array + */ + static asString(str) { + if (Array.isArray(str)) { + return str.join("\n"); + } + return str; } /** - * @param {ConcatenationBailoutReasonContext} context context - * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated + * @typedef {Object} WithId + * @property {string|number} id */ - getConcatenationBailoutReason(context) { - return this.generator.getConcatenationBailoutReason(this, context); + + /** + * @param {WithId[]} modules a collection of modules to get array bounds for + * @returns {[number, number] | false} returns the upper and lower array bounds + * or false if not every module has a number based id + */ + static getModulesArrayBounds(modules) { + let maxId = -Infinity; + let minId = Infinity; + for (const module of modules) { + const moduleId = module.id; + if (typeof moduleId !== "number") return false; + if (maxId < moduleId) maxId = moduleId; + if (minId > moduleId) minId = moduleId; + } + if (minId < 16 + ("" + minId).length) { + // add minId x ',' instead of 'Array(minId).concat(…)' + minId = 0; + } + // start with -1 because the first module needs no comma + let objectOverhead = -1; + for (const module of modules) { + // module id + colon + comma + objectOverhead += `${module.id}`.length + 2; + } + // number of commas, or when starting non-zero the length of Array(minId).concat() + const arrayOverhead = minId === 0 ? maxId : 16 + `${minId}`.length + maxId; + return arrayOverhead < objectOverhead ? [minId, maxId] : false; } /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this module should be connected to referencing modules when consumed for side-effects only + * @param {ChunkRenderContext} renderContext render context + * @param {Module[]} modules modules to render (should be ordered by identifier) + * @param {function(Module): Source} renderModule function to render a module + * @param {string=} prefix applying prefix strings + * @returns {Source} rendered chunk modules in a Source object */ - getSideEffectsConnectionState(moduleGraph) { - if (this.factoryMeta !== undefined) { - if (this.factoryMeta.sideEffectFree) return false; - if (this.factoryMeta.sideEffectFree === false) return true; + static renderChunkModules(renderContext, modules, renderModule, prefix = "") { + const { chunkGraph } = renderContext; + var source = new ConcatSource(); + if (modules.length === 0) { + return null; } - if (this.buildMeta !== undefined && this.buildMeta.sideEffectFree) { - if (this._isEvaluatingSideEffects) - return ModuleGraphConnection.CIRCULAR_CONNECTION; - this._isEvaluatingSideEffects = true; - /** @type {ConnectionState} */ - let current = false; - for (const dep of this.dependencies) { - const state = dep.getModuleEvaluationSideEffectsState(moduleGraph); - if (state === true) { - if ( - this._addedSideEffectsBailout === undefined - ? ((this._addedSideEffectsBailout = new WeakSet()), true) - : !this._addedSideEffectsBailout.has(moduleGraph) - ) { - this._addedSideEffectsBailout.add(moduleGraph); - moduleGraph - .getOptimizationBailout(this) - .push( - () => - `Dependency (${ - dep.type - }) with side effects at ${formatLocation(dep.loc)}` - ); - } - this._isEvaluatingSideEffects = false; - return true; - } else if (state !== ModuleGraphConnection.CIRCULAR_CONNECTION) { - current = ModuleGraphConnection.addConnectionStates(current, state); + /** @type {{id: string|number, source: Source|string}[]} */ + const allModules = modules.map(module => { + return { + id: chunkGraph.getModuleId(module), + source: renderModule(module) || "false" + }; + }); + const bounds = Template.getModulesArrayBounds(allModules); + if (bounds) { + // Render a spare array + const minId = bounds[0]; + const maxId = bounds[1]; + if (minId !== 0) { + source.add(`Array(${minId}).concat(`); + } + source.add("[\n"); + /** @type {Map} */ + const modules = new Map(); + for (const module of allModules) { + modules.set(module.id, module); + } + for (let idx = minId; idx <= maxId; idx++) { + const module = modules.get(idx); + if (idx !== minId) { + source.add(",\n"); + } + source.add(`/* ${idx} */`); + if (module) { + source.add("\n"); + source.add(module.source); } } - this._isEvaluatingSideEffects = false; - // When caching is implemented here, make sure to not cache when - // at least one circular connection was in the loop above - return current; + source.add("\n" + prefix + "]"); + if (minId !== 0) { + source.add(")"); + } } else { - return true; + // Render an object + source.add("{\n"); + for (let i = 0; i < allModules.length; i++) { + const module = allModules[i]; + if (i !== 0) { + source.add(",\n"); + } + source.add(`\n/***/ ${JSON.stringify(module.id)}:\n`); + source.add(module.source); + } + source.add(`\n\n${prefix}}`); } + return source; } /** - * @returns {Set} types available (do not mutate) + * @param {RuntimeModule[]} runtimeModules array of runtime modules in order + * @param {RenderContext & { codeGenerationResults?: CodeGenerationResults }} renderContext render context + * @returns {Source} rendered runtime modules in a Source object */ - getSourceTypes() { - if (this._sourceTypes === undefined) { - this._sourceTypes = this.generator.getTypes(this); + static renderRuntimeModules(runtimeModules, renderContext) { + const source = new ConcatSource(); + for (const module of runtimeModules) { + const codeGenerationResults = renderContext.codeGenerationResults; + let runtimeSource; + if (codeGenerationResults) { + runtimeSource = codeGenerationResults.getSource( + module, + renderContext.chunk.runtime, + "runtime" + ); + } else { + const codeGenResult = module.codeGeneration({ + chunkGraph: renderContext.chunkGraph, + dependencyTemplates: renderContext.dependencyTemplates, + moduleGraph: renderContext.moduleGraph, + runtimeTemplate: renderContext.runtimeTemplate, + runtime: renderContext.chunk.runtime, + codeGenerationResults + }); + if (!codeGenResult) continue; + runtimeSource = codeGenResult.sources.get("runtime"); + } + if (runtimeSource) { + source.add(Template.toNormalComment(module.identifier()) + "\n"); + if (!module.shouldIsolate()) { + source.add(runtimeSource); + source.add("\n\n"); + } else if (renderContext.runtimeTemplate.supportsArrowFunction()) { + source.add("(() => {\n"); + source.add(new PrefixSource("\t", runtimeSource)); + source.add("\n})();\n\n"); + } else { + source.add("!function() {\n"); + source.add(new PrefixSource("\t", runtimeSource)); + source.add("\n}();\n\n"); + } + } } - return this._sourceTypes; + return source; } /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result + * @param {RuntimeModule[]} runtimeModules array of runtime modules in order + * @param {RenderContext} renderContext render context + * @returns {Source} rendered chunk runtime modules in a Source object */ - codeGeneration({ - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtime, - concatenationScope, - codeGenerationResults - }) { - /** @type {Set} */ - const runtimeRequirements = new Set(); + static renderChunkRuntimeModules(runtimeModules, renderContext) { + return new PrefixSource( + "/******/ ", + new ConcatSource( + "function(__webpack_require__) { // webpackRuntimeModules\n", + this.renderRuntimeModules(runtimeModules, renderContext), + "}\n" + ) + ); + } +} - if (!this.buildInfo.parsed) { - runtimeRequirements.add(RuntimeGlobals.module); - runtimeRequirements.add(RuntimeGlobals.exports); - runtimeRequirements.add(RuntimeGlobals.thisAsExports); - } +module.exports = Template; +module.exports.NUMBER_OF_IDENTIFIER_START_CHARS = + NUMBER_OF_IDENTIFIER_START_CHARS; +module.exports.NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS = + NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS; - /** @type {Map} */ - let data; - const getData = () => { - if (data === undefined) data = new Map(); - return data; - }; - const sources = new Map(); - for (const type of this.generator.getTypes(this)) { - const source = this.error - ? new RawSource( - "throw new Error(" + JSON.stringify(this.error.message) + ");" - ) - : this.generator.generate(this, { - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtimeRequirements, - runtime, - concatenationScope, - codeGenerationResults, - getData, - type - }); +/***/ }), - if (source) { - sources.set(type, new CachedSource(source)); - } - } +/***/ 80734: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** @type {CodeGenerationResult} */ - const resultEntry = { - sources, - runtimeRequirements, - data - }; - return resultEntry; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Jason Anderson @diurnalist +*/ - /** - * @returns {Source | null} the original source for the module before webpack transformation - */ - originalSource() { - return this._source; - } - /** - * @returns {void} - */ - invalidateBuild() { - this._forceBuild = true; - } - /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} - */ - needBuild(context, callback) { - const { fileSystemInfo, compilation, valueCacheVersions } = context; - // build if enforced - if (this._forceBuild) return callback(null, true); +const mime = __webpack_require__(78585); +const { basename, extname } = __webpack_require__(71017); +const util = __webpack_require__(73837); +const Chunk = __webpack_require__(39385); +const Module = __webpack_require__(73208); +const { parseResource } = __webpack_require__(82186); - // always try to build in case of an error - if (this.error) return callback(null, true); +/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("./Compilation").PathData} PathData */ +/** @typedef {import("./Compiler")} Compiler */ - // always build when module is not cacheable - if (!this.buildInfo.cacheable) return callback(null, true); +const REGEXP = /\[\\*([\w:]+)\\*\]/gi; - // build when there is no snapshot to check - if (!this.buildInfo.snapshot) return callback(null, true); +const prepareId = id => { + if (typeof id !== "string") return id; - // build when valueDependencies have changed - /** @type {Map>} */ - const valueDependencies = this.buildInfo.valueDependencies; - if (valueDependencies) { - if (!valueCacheVersions) return callback(null, true); - for (const [key, value] of valueDependencies) { - if (value === undefined) return callback(null, true); - const current = valueCacheVersions.get(key); - if ( - value !== current && - (typeof value === "string" || - typeof current === "string" || - current === undefined || - !isSubset(value, current)) - ) { - return callback(null, true); - } - } - } + if (/^"\s\+*.*\+\s*"$/.test(id)) { + const match = /^"\s\+*\s*(.*)\s*\+\s*"$/.exec(id); - // check snapshot for validity - fileSystemInfo.checkSnapshotValid(this.buildInfo.snapshot, (err, valid) => { - if (err) return callback(err); - if (!valid) return callback(null, true); - const hooks = NormalModule.getCompilationHooks(compilation); - hooks.needBuild.callAsync(this, context, (err, needBuild) => { - if (err) { - return callback( - HookWebpackError.makeWebpackError( - err, - "NormalModule.getCompilationHooks().needBuild" - ) - ); - } - callback(null, !!needBuild); - }); - }); + return `" + (${match[1]} + "").replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_") + "`; } - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - const cachedSize = - this._sourceSizes === undefined ? undefined : this._sourceSizes.get(type); - if (cachedSize !== undefined) { - return cachedSize; + return id.replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_"); +}; + +const hashLength = (replacer, handler, assetInfo, hashName) => { + const fn = (match, arg, input) => { + let result; + const length = arg && parseInt(arg, 10); + + if (length && handler) { + result = handler(length); + } else { + const hash = replacer(match, arg, input); + + result = length ? hash.slice(0, length) : hash; } - const size = Math.max(1, this.generator.getSize(this, type)); - if (this._sourceSizes === undefined) { - this._sourceSizes = new Map(); + if (assetInfo) { + assetInfo.immutable = true; + if (Array.isArray(assetInfo[hashName])) { + assetInfo[hashName] = [...assetInfo[hashName], result]; + } else if (assetInfo[hashName]) { + assetInfo[hashName] = [assetInfo[hashName], result]; + } else { + assetInfo[hashName] = result; + } } - this._sourceSizes.set(type, size); - return size; - } + return result; + }; - /** - * @param {LazySet} fileDependencies set where file dependencies are added to - * @param {LazySet} contextDependencies set where context dependencies are added to - * @param {LazySet} missingDependencies set where missing dependencies are added to - * @param {LazySet} buildDependencies set where build dependencies are added to - */ - addCacheDependencies( - fileDependencies, - contextDependencies, - missingDependencies, - buildDependencies - ) { - const { snapshot, buildDependencies: buildDeps } = this.buildInfo; - if (snapshot) { - fileDependencies.addAll(snapshot.getFileIterable()); - contextDependencies.addAll(snapshot.getContextIterable()); - missingDependencies.addAll(snapshot.getMissingIterable()); + return fn; +}; + +const replacer = (value, allowEmpty) => { + const fn = (match, arg, input) => { + if (typeof value === "function") { + value = value(); + } + if (value === null || value === undefined) { + if (!allowEmpty) { + throw new Error( + `Path variable ${match} not implemented in this context: ${input}` + ); + } + + return ""; } else { - const { - fileDependencies: fileDeps, - contextDependencies: contextDeps, - missingDependencies: missingDeps - } = this.buildInfo; - if (fileDeps !== undefined) fileDependencies.addAll(fileDeps); - if (contextDeps !== undefined) contextDependencies.addAll(contextDeps); - if (missingDeps !== undefined) missingDependencies.addAll(missingDeps); + return `${value}`; } - if (buildDeps !== undefined) { - buildDependencies.addAll(buildDeps); + }; + + return fn; +}; + +const deprecationCache = new Map(); +const deprecatedFunction = (() => () => {})(); +const deprecated = (fn, message, code) => { + let d = deprecationCache.get(message); + if (d === undefined) { + d = util.deprecate(deprecatedFunction, message, code); + deprecationCache.set(message, d); + } + return (...args) => { + d(); + return fn(...args); + }; +}; + +/** + * @param {string | function(PathData, AssetInfo=): string} path the raw path + * @param {PathData} data context data + * @param {AssetInfo} assetInfo extra info about the asset (will be written to) + * @returns {string} the interpolated path + */ +const replacePathVariables = (path, data, assetInfo) => { + const chunkGraph = data.chunkGraph; + + /** @type {Map} */ + const replacements = new Map(); + + // Filename context + // + // Placeholders + // + // for /some/path/file.js?query#fragment: + // [file] - /some/path/file.js + // [query] - ?query + // [fragment] - #fragment + // [base] - file.js + // [path] - /some/path/ + // [name] - file + // [ext] - .js + if (typeof data.filename === "string") { + // check that filename is data uri + let match = data.filename.match(/^data:([^;,]+)/); + if (match) { + const ext = mime.extension(match[1]); + const emptyReplacer = replacer("", true); + + replacements.set("file", emptyReplacer); + replacements.set("query", emptyReplacer); + replacements.set("fragment", emptyReplacer); + replacements.set("path", emptyReplacer); + replacements.set("base", emptyReplacer); + replacements.set("name", emptyReplacer); + replacements.set("ext", replacer(ext ? `.${ext}` : "", true)); + // Legacy + replacements.set( + "filebase", + deprecated( + emptyReplacer, + "[filebase] is now [base]", + "DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_FILENAME" + ) + ); + } else { + const { path: file, query, fragment } = parseResource(data.filename); + + const ext = extname(file); + const base = basename(file); + const name = base.slice(0, base.length - ext.length); + const path = file.slice(0, file.length - base.length); + + replacements.set("file", replacer(file)); + replacements.set("query", replacer(query, true)); + replacements.set("fragment", replacer(fragment, true)); + replacements.set("path", replacer(path, true)); + replacements.set("base", replacer(base)); + replacements.set("name", replacer(name)); + replacements.set("ext", replacer(ext, true)); + // Legacy + replacements.set( + "filebase", + deprecated( + replacer(base), + "[filebase] is now [base]", + "DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_FILENAME" + ) + ); } } + // Compilation context + // + // Placeholders + // + // [fullhash] - data.hash (3a4b5c6e7f) + // + // Legacy Placeholders + // + // [hash] - data.hash (3a4b5c6e7f) + if (data.hash) { + const hashReplacer = hashLength( + replacer(data.hash), + data.hashWithLength, + assetInfo, + "fullhash" + ); + + replacements.set("fullhash", hashReplacer); + + // Legacy + replacements.set( + "hash", + deprecated( + hashReplacer, + "[hash] is now [fullhash] (also consider using [chunkhash] or [contenthash], see documentation for details)", + "DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_HASH" + ) + ); + } + + // Chunk Context + // + // Placeholders + // + // [id] - chunk.id (0.js) + // [name] - chunk.name (app.js) + // [chunkhash] - chunk.hash (7823t4t4.js) + // [contenthash] - chunk.contentHash[type] (3256u3zg.js) + if (data.chunk) { + const chunk = data.chunk; + + const contentHashType = data.contentHashType; + + const idReplacer = replacer(chunk.id); + const nameReplacer = replacer(chunk.name || chunk.id); + const chunkhashReplacer = hashLength( + replacer(chunk instanceof Chunk ? chunk.renderedHash : chunk.hash), + "hashWithLength" in chunk ? chunk.hashWithLength : undefined, + assetInfo, + "chunkhash" + ); + const contenthashReplacer = hashLength( + replacer( + data.contentHash || + (contentHashType && + chunk.contentHash && + chunk.contentHash[contentHashType]) + ), + data.contentHashWithLength || + ("contentHashWithLength" in chunk && chunk.contentHashWithLength + ? chunk.contentHashWithLength[contentHashType] + : undefined), + assetInfo, + "contenthash" + ); + + replacements.set("id", idReplacer); + replacements.set("name", nameReplacer); + replacements.set("chunkhash", chunkhashReplacer); + replacements.set("contenthash", contenthashReplacer); + } + + // Module Context + // + // Placeholders + // + // [id] - module.id (2.png) + // [hash] - module.hash (6237543873.png) + // + // Legacy Placeholders + // + // [moduleid] - module.id (2.png) + // [modulehash] - module.hash (6237543873.png) + if (data.module) { + const module = data.module; + + const idReplacer = replacer(() => + prepareId( + module instanceof Module ? chunkGraph.getModuleId(module) : module.id + ) + ); + const moduleHashReplacer = hashLength( + replacer(() => + module instanceof Module + ? chunkGraph.getRenderedModuleHash(module, data.runtime) + : module.hash + ), + "hashWithLength" in module ? module.hashWithLength : undefined, + assetInfo, + "modulehash" + ); + const contentHashReplacer = hashLength( + replacer(data.contentHash), + undefined, + assetInfo, + "contenthash" + ); + + replacements.set("id", idReplacer); + replacements.set("modulehash", moduleHashReplacer); + replacements.set("contenthash", contentHashReplacer); + replacements.set( + "hash", + data.contentHash ? contentHashReplacer : moduleHashReplacer + ); + // Legacy + replacements.set( + "moduleid", + deprecated( + idReplacer, + "[moduleid] is now [id]", + "DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_MODULE_ID" + ) + ); + } + + // Other things + if (data.url) { + replacements.set("url", replacer(data.url)); + } + if (typeof data.runtime === "string") { + replacements.set( + "runtime", + replacer(() => prepareId(data.runtime)) + ); + } else { + replacements.set("runtime", replacer("_")); + } + + if (typeof path === "function") { + path = path(data, assetInfo); + } + + path = path.replace(REGEXP, (match, content) => { + if (content.length + 2 === match.length) { + const contentMatch = /^(\w+)(?::(\w+))?$/.exec(content); + if (!contentMatch) return match; + const [, kind, arg] = contentMatch; + const replacer = replacements.get(kind); + if (replacer !== undefined) { + return replacer(match, arg, path); + } + } else if (match.startsWith("[\\") && match.endsWith("\\]")) { + return `[${match.slice(2, -2)}]`; + } + return match; + }); + + return path; +}; + +const plugin = "TemplatedPathPlugin"; + +class TemplatedPathPlugin { /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - updateHash(hash, context) { - hash.update(this.buildInfo.hash); - this.generator.updateHash(hash, { - module: this, - ...context + apply(compiler) { + compiler.hooks.compilation.tap(plugin, compilation => { + compilation.hooks.assetPath.tap(plugin, replacePathVariables); }); - super.updateHash(hash, context); } +} - serialize(context) { - const { write } = context; - // deserialize - write(this._source); - write(this.error); - write(this._lastSuccessfulBuildMeta); - write(this._forceBuild); - super.serialize(context); - } +module.exports = TemplatedPathPlugin; - static deserialize(context) { - const obj = new NormalModule({ - // will be deserialized by Module - layer: null, - type: "", - // will be filled by updateCacheModule - resource: "", - context: "", - request: null, - userRequest: null, - rawRequest: null, - loaders: null, - matchResource: null, - parser: null, - parserOptions: null, - generator: null, - generatorOptions: null, - resolveOptions: null - }); - obj.deserialize(context); - return obj; - } - deserialize(context) { - const { read } = context; - this._source = read(); - this.error = read(); - this._lastSuccessfulBuildMeta = read(); - this._forceBuild = read(); - super.deserialize(context); +/***/ }), + +/***/ 68099: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ + + + +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); + +class UnhandledSchemeError extends WebpackError { + /** + * @param {string} scheme scheme + * @param {string} resource resource + */ + constructor(scheme, resource) { + super( + `Reading from "${resource}" is not handled by plugins (Unhandled scheme).` + + '\nWebpack supports "data:" and "file:" URIs by default.' + + `\nYou may need an additional plugin to handle "${scheme}:" URIs.` + ); + this.file = resource; + this.name = "UnhandledSchemeError"; } } -makeSerializable(NormalModule, "webpack/lib/NormalModule"); +makeSerializable( + UnhandledSchemeError, + "webpack/lib/UnhandledSchemeError", + "UnhandledSchemeError" +); -module.exports = NormalModule; +module.exports = UnhandledSchemeError; /***/ }), -/***/ 68860: +/***/ 42495: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -57109,1335 +56357,1045 @@ module.exports = NormalModule; -const { getContext } = __webpack_require__(68318); -const asyncLib = __webpack_require__(78175); -const { - AsyncSeriesBailHook, - SyncWaterfallHook, - SyncBailHook, - SyncHook, - HookMap -} = __webpack_require__(41242); -const ChunkGraph = __webpack_require__(64971); -const Module = __webpack_require__(73208); -const ModuleFactory = __webpack_require__(51010); -const ModuleGraph = __webpack_require__(99988); -const NormalModule = __webpack_require__(39); -const BasicEffectRulePlugin = __webpack_require__(30318); -const BasicMatcherRulePlugin = __webpack_require__(94215); -const ObjectMatcherRulePlugin = __webpack_require__(72021); -const RuleSetCompiler = __webpack_require__(83349); -const UseEffectRulePlugin = __webpack_require__(84977); -const LazySet = __webpack_require__(38938); -const { getScheme } = __webpack_require__(54500); -const { cachedCleverMerge, cachedSetProperty } = __webpack_require__(60839); -const { join } = __webpack_require__(17139); -const { - parseResource, - parseResourceWithoutFragment -} = __webpack_require__(82186); +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); -/** @typedef {import("../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */ -/** @typedef {import("./Generator")} Generator */ -/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ -/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ -/** @typedef {import("./Parser")} Parser */ -/** @typedef {import("./ResolverFactory")} ResolverFactory */ -/** @typedef {import("./dependencies/ModuleDependency")} ModuleDependency */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** - * @typedef {Object} ResolveData - * @property {ModuleFactoryCreateData["contextInfo"]} contextInfo - * @property {ModuleFactoryCreateData["resolveOptions"]} resolveOptions - * @property {string} context - * @property {string} request - * @property {Record | undefined} assertions - * @property {ModuleDependency[]} dependencies - * @property {string} dependencyType - * @property {Object} createData - * @property {LazySet} fileDependencies - * @property {LazySet} missingDependencies - * @property {LazySet} contextDependencies - * @property {boolean} cacheable allow to use the unsafe cache - */ +class UnsupportedFeatureWarning extends WebpackError { + /** + * @param {string} message description of warning + * @param {DependencyLocation} loc location start and end positions of the module + */ + constructor(message, loc) { + super(message); -/** - * @typedef {Object} ResourceData - * @property {string} resource - * @property {string} path - * @property {string} query - * @property {string} fragment - * @property {string=} context - */ + this.name = "UnsupportedFeatureWarning"; + this.loc = loc; + this.hideStack = true; + } +} -/** @typedef {ResourceData & { data: Record }} ResourceDataWithData */ +makeSerializable( + UnsupportedFeatureWarning, + "webpack/lib/UnsupportedFeatureWarning" +); -/** @typedef {Object} ParsedLoaderRequest - * @property {string} loader loader - * @property {string|undefined} options options - */ +module.exports = UnsupportedFeatureWarning; -const EMPTY_RESOLVE_OPTIONS = {}; -const EMPTY_PARSER_OPTIONS = {}; -const EMPTY_GENERATOR_OPTIONS = {}; -const EMPTY_ELEMENTS = []; -const MATCH_RESOURCE_REGEX = /^([^!]+)!=!/; +/***/ }), -const loaderToIdent = data => { - if (!data.options) { - return data.loader; - } - if (typeof data.options === "string") { - return data.loader + "?" + data.options; - } - if (typeof data.options !== "object") { - throw new Error("loader options must be string or object"); - } - if (data.ident) { - return data.loader + "??" + data.ident; - } - return data.loader + "?" + JSON.stringify(data.options); -}; - -const stringifyLoadersAndResource = (loaders, resource) => { - let str = ""; - for (const loader of loaders) { - str += loaderToIdent(loader) + "!"; - } - return str + resource; -}; +/***/ 36803: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -const needCalls = (times, callback) => { - return err => { - if (--times === 0) { - return callback(err); - } - if (err && times > 0) { - times = NaN; - return callback(err); - } - }; -}; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -const mergeGlobalOptions = (globalOptions, type, localOptions) => { - const parts = type.split("/"); - let result; - let current = ""; - for (const part of parts) { - current = current ? `${current}/${part}` : part; - const options = globalOptions[current]; - if (typeof options === "object") { - if (result === undefined) { - result = options; - } else { - result = cachedCleverMerge(result, options); - } - } - } - if (result === undefined) { - return localOptions; - } else { - return cachedCleverMerge(result, localOptions); - } -}; -// TODO webpack 6 remove -const deprecationChangedHookMessage = (name, hook) => { - const names = hook.taps - .map(tapped => { - return tapped.name; - }) - .join(", "); - return ( - `NormalModuleFactory.${name} (${names}) is no longer a waterfall hook, but a bailing hook instead. ` + - "Do not return the passed object, but modify it instead. " + - "Returning false will ignore the request and results in no module created." - ); -}; +const ConstDependency = __webpack_require__(76911); -const ruleSetCompiler = new RuleSetCompiler([ - new BasicMatcherRulePlugin("test", "resource"), - new BasicMatcherRulePlugin("scheme"), - new BasicMatcherRulePlugin("mimetype"), - new BasicMatcherRulePlugin("dependency"), - new BasicMatcherRulePlugin("include", "resource"), - new BasicMatcherRulePlugin("exclude", "resource", true), - new BasicMatcherRulePlugin("resource"), - new BasicMatcherRulePlugin("resourceQuery"), - new BasicMatcherRulePlugin("resourceFragment"), - new BasicMatcherRulePlugin("realResource"), - new BasicMatcherRulePlugin("issuer"), - new BasicMatcherRulePlugin("compiler"), - new BasicMatcherRulePlugin("issuerLayer"), - new ObjectMatcherRulePlugin("assert", "assertions"), - new ObjectMatcherRulePlugin("descriptionData"), - new BasicEffectRulePlugin("type"), - new BasicEffectRulePlugin("sideEffects"), - new BasicEffectRulePlugin("parser"), - new BasicEffectRulePlugin("resolve"), - new BasicEffectRulePlugin("generator"), - new BasicEffectRulePlugin("layer"), - new UseEffectRulePlugin() -]); +/** @typedef {import("./Compiler")} Compiler */ -class NormalModuleFactory extends ModuleFactory { +class UseStrictPlugin { /** - * @param {Object} param params - * @param {string=} param.context context - * @param {InputFileSystem} param.fs file system - * @param {ResolverFactory} param.resolverFactory resolverFactory - * @param {ModuleOptions} param.options options - * @param {Object=} param.associatedObjectForCache an object to which the cache will be attached - * @param {boolean=} param.layers enable layers + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - constructor({ - context, - fs, - resolverFactory, - options, - associatedObjectForCache, - layers = false - }) { - super(); - this.hooks = Object.freeze({ - /** @type {AsyncSeriesBailHook<[ResolveData], TODO>} */ - resolve: new AsyncSeriesBailHook(["resolveData"]), - /** @type {HookMap>} */ - resolveForScheme: new HookMap( - () => new AsyncSeriesBailHook(["resourceData", "resolveData"]) - ), - /** @type {HookMap>} */ - resolveInScheme: new HookMap( - () => new AsyncSeriesBailHook(["resourceData", "resolveData"]) - ), - /** @type {AsyncSeriesBailHook<[ResolveData], TODO>} */ - factorize: new AsyncSeriesBailHook(["resolveData"]), - /** @type {AsyncSeriesBailHook<[ResolveData], TODO>} */ - beforeResolve: new AsyncSeriesBailHook(["resolveData"]), - /** @type {AsyncSeriesBailHook<[ResolveData], TODO>} */ - afterResolve: new AsyncSeriesBailHook(["resolveData"]), - /** @type {AsyncSeriesBailHook<[ResolveData["createData"], ResolveData], TODO>} */ - createModule: new AsyncSeriesBailHook(["createData", "resolveData"]), - /** @type {SyncWaterfallHook<[Module, ResolveData["createData"], ResolveData], TODO>} */ - module: new SyncWaterfallHook(["module", "createData", "resolveData"]), - createParser: new HookMap(() => new SyncBailHook(["parserOptions"])), - parser: new HookMap(() => new SyncHook(["parser", "parserOptions"])), - createGenerator: new HookMap( - () => new SyncBailHook(["generatorOptions"]) - ), - generator: new HookMap( - () => new SyncHook(["generator", "generatorOptions"]) - ) - }); - this.resolverFactory = resolverFactory; - this.ruleSet = ruleSetCompiler.compile([ - { - rules: options.defaultRules - }, - { - rules: options.rules - } - ]); - this.context = context || ""; - this.fs = fs; - this._globalParserOptions = options.parser; - this._globalGeneratorOptions = options.generator; - /** @type {Map>} */ - this.parserCache = new Map(); - /** @type {Map>} */ - this.generatorCache = new Map(); - /** @type {Set} */ - this._restoredUnsafeCacheEntries = new Set(); + apply(compiler) { + compiler.hooks.compilation.tap( + "UseStrictPlugin", + (compilation, { normalModuleFactory }) => { + const handler = parser => { + parser.hooks.program.tap("UseStrictPlugin", ast => { + const firstNode = ast.body[0]; + if ( + firstNode && + firstNode.type === "ExpressionStatement" && + firstNode.expression.type === "Literal" && + firstNode.expression.value === "use strict" + ) { + // Remove "use strict" expression. It will be added later by the renderer again. + // This is necessary in order to not break the strict mode when webpack prepends code. + // @see https://github.com/webpack/webpack/issues/1970 + const dep = new ConstDependency("", firstNode.range); + dep.loc = firstNode.loc; + parser.state.module.addPresentationalDependency(dep); + parser.state.module.buildInfo.strict = true; + } + }); + }; - const cacheParseResource = parseResource.bindCache( - associatedObjectForCache + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("UseStrictPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("UseStrictPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("UseStrictPlugin", handler); + } ); - const cachedParseResourceWithoutFragment = - parseResourceWithoutFragment.bindCache(associatedObjectForCache); - this._parseResourceWithoutFragment = cachedParseResourceWithoutFragment; + } +} - this.hooks.factorize.tapAsync( - { - name: "NormalModuleFactory", - stage: 100 - }, - (resolveData, callback) => { - this.hooks.resolve.callAsync(resolveData, (err, result) => { - if (err) return callback(err); +module.exports = UseStrictPlugin; - // Ignored - if (result === false) return callback(); - // direct module - if (result instanceof Module) return callback(null, result); +/***/ }), - if (typeof result === "object") - throw new Error( - deprecationChangedHookMessage("resolve", this.hooks.resolve) + - " Returning a Module object will result in this module used as result." - ); +/***/ 56504: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - this.hooks.afterResolve.callAsync(resolveData, (err, result) => { - if (err) return callback(err); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (typeof result === "object") - throw new Error( - deprecationChangedHookMessage( - "afterResolve", - this.hooks.afterResolve + + +const CaseSensitiveModulesWarning = __webpack_require__(77975); + +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Module")} Module */ + +class WarnCaseSensitiveModulesPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "WarnCaseSensitiveModulesPlugin", + compilation => { + compilation.hooks.seal.tap("WarnCaseSensitiveModulesPlugin", () => { + /** @type {Map>} */ + const moduleWithoutCase = new Map(); + for (const module of compilation.modules) { + const identifier = module.identifier(); + const lowerIdentifier = identifier.toLowerCase(); + let map = moduleWithoutCase.get(lowerIdentifier); + if (map === undefined) { + map = new Map(); + moduleWithoutCase.set(lowerIdentifier, map); + } + map.set(identifier, module); + } + for (const pair of moduleWithoutCase) { + const map = pair[1]; + if (map.size > 1) { + compilation.warnings.push( + new CaseSensitiveModulesWarning( + map.values(), + compilation.moduleGraph ) ); + } + } + }); + } + ); + } +} - // Ignored - if (result === false) return callback(); +module.exports = WarnCaseSensitiveModulesPlugin; - const createData = resolveData.createData; - this.hooks.createModule.callAsync( - createData, - resolveData, - (err, createdModule) => { - if (!createdModule) { - if (!resolveData.request) { - return callback(new Error("Empty dependency (no request)")); - } +/***/ }), - createdModule = new NormalModule(createData); - } +/***/ 76537: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - createdModule = this.hooks.module.call( - createdModule, - createData, - resolveData - ); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Florent Cailhol @ooflorent +*/ - return callback(null, createdModule); - } - ); - }); - }); - } - ); - this.hooks.resolve.tapAsync( - { - name: "NormalModuleFactory", - stage: 100 - }, - (data, callback) => { - const { - contextInfo, - context, - dependencies, - dependencyType, - request, - assertions, - resolveOptions, - fileDependencies, - missingDependencies, - contextDependencies - } = data; - const loaderResolver = this.getResolver("loader"); - /** @type {ResourceData | undefined} */ - let matchResourceData = undefined; - /** @type {string} */ - let unresolvedResource; - /** @type {ParsedLoaderRequest[]} */ - let elements; - let noPreAutoLoaders = false; - let noAutoLoaders = false; - let noPrePostAutoLoaders = false; - const contextScheme = getScheme(context); - /** @type {string | undefined} */ - let scheme = getScheme(request); +const WebpackError = __webpack_require__(53799); - if (!scheme) { - /** @type {string} */ - let requestWithoutMatchResource = request; - const matchResourceMatch = MATCH_RESOURCE_REGEX.exec(request); - if (matchResourceMatch) { - let matchResource = matchResourceMatch[1]; - if (matchResource.charCodeAt(0) === 46) { - // 46 === ".", 47 === "/" - const secondChar = matchResource.charCodeAt(1); - if ( - secondChar === 47 || - (secondChar === 46 && matchResource.charCodeAt(2) === 47) - ) { - // if matchResources startsWith ../ or ./ - matchResource = join(this.fs, context, matchResource); - } - } - matchResourceData = { - resource: matchResource, - ...cacheParseResource(matchResource) - }; - requestWithoutMatchResource = request.substr( - matchResourceMatch[0].length - ); - } +/** @typedef {import("./Compiler")} Compiler */ - scheme = getScheme(requestWithoutMatchResource); +class WarnDeprecatedOptionPlugin { + /** + * Create an instance of the plugin + * @param {string} option the target option + * @param {string | number} value the deprecated option value + * @param {string} suggestion the suggestion replacement + */ + constructor(option, value, suggestion) { + this.option = option; + this.value = value; + this.suggestion = suggestion; + } - if (!scheme && !contextScheme) { - const firstChar = requestWithoutMatchResource.charCodeAt(0); - const secondChar = requestWithoutMatchResource.charCodeAt(1); - noPreAutoLoaders = firstChar === 45 && secondChar === 33; // startsWith "-!" - noAutoLoaders = noPreAutoLoaders || firstChar === 33; // startsWith "!" - noPrePostAutoLoaders = firstChar === 33 && secondChar === 33; // startsWith "!!"; - const rawElements = requestWithoutMatchResource - .slice( - noPreAutoLoaders || noPrePostAutoLoaders - ? 2 - : noAutoLoaders - ? 1 - : 0 - ) - .split(/!+/); - unresolvedResource = rawElements.pop(); - elements = rawElements.map(el => { - const { path, query } = cachedParseResourceWithoutFragment(el); - return { - loader: path, - options: query ? query.slice(1) : undefined - }; - }); - scheme = getScheme(unresolvedResource); - } else { - unresolvedResource = requestWithoutMatchResource; - elements = EMPTY_ELEMENTS; - } - } else { - unresolvedResource = request; - elements = EMPTY_ELEMENTS; - } + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "WarnDeprecatedOptionPlugin", + compilation => { + compilation.warnings.push( + new DeprecatedOptionWarning(this.option, this.value, this.suggestion) + ); + } + ); + } +} - const resolveContext = { - fileDependencies, - missingDependencies, - contextDependencies - }; +class DeprecatedOptionWarning extends WebpackError { + constructor(option, value, suggestion) { + super(); - /** @type {ResourceDataWithData} */ - let resourceData; + this.name = "DeprecatedOptionWarning"; + this.message = + "configuration\n" + + `The value '${value}' for option '${option}' is deprecated. ` + + `Use '${suggestion}' instead.`; + } +} - let loaders; +module.exports = WarnDeprecatedOptionPlugin; - const continueCallback = needCalls(2, err => { - if (err) return callback(err); - // translate option idents - try { - for (const item of loaders) { - if (typeof item.options === "string" && item.options[0] === "?") { - const ident = item.options.substr(1); - if (ident === "[[missing ident]]") { - throw new Error( - "No ident is provided by referenced loader. " + - "When using a function for Rule.use in config you need to " + - "provide an 'ident' property for referenced loader options." - ); - } - item.options = this.ruleSet.references.get(ident); - if (item.options === undefined) { - throw new Error( - "Invalid ident is provided by referenced loader" - ); - } - item.ident = ident; - } - } - } catch (e) { - return callback(e); - } +/***/ }), - if (!resourceData) { - // ignored - return callback(null, dependencies[0].createIgnoredModule(context)); - } +/***/ 25295: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const userRequest = - (matchResourceData !== undefined - ? `${matchResourceData.resource}!=!` - : "") + - stringifyLoadersAndResource(loaders, resourceData.resource); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - const settings = {}; - const useLoadersPost = []; - const useLoaders = []; - const useLoadersPre = []; - // handle .webpack[] suffix - let resource; - let match; - if ( - matchResourceData && - typeof (resource = matchResourceData.resource) === "string" && - (match = /\.webpack\[([^\]]+)\]$/.exec(resource)) - ) { - settings.type = match[1]; - matchResourceData.resource = matchResourceData.resource.slice( - 0, - -settings.type.length - 10 - ); - } else { - settings.type = "javascript/auto"; - const resourceDataForRules = matchResourceData || resourceData; - const result = this.ruleSet.exec({ - resource: resourceDataForRules.path, - realResource: resourceData.path, - resourceQuery: resourceDataForRules.query, - resourceFragment: resourceDataForRules.fragment, - scheme, - assertions, - mimetype: matchResourceData - ? "" - : resourceData.data.mimetype || "", - dependency: dependencyType, - descriptionData: matchResourceData - ? undefined - : resourceData.data.descriptionFileData, - issuer: contextInfo.issuer, - compiler: contextInfo.compiler, - issuerLayer: contextInfo.issuerLayer || "" - }); - for (const r of result) { - if (r.type === "use") { - if (!noAutoLoaders && !noPrePostAutoLoaders) { - useLoaders.push(r.value); - } - } else if (r.type === "use-post") { - if (!noPrePostAutoLoaders) { - useLoadersPost.push(r.value); - } - } else if (r.type === "use-pre") { - if (!noPreAutoLoaders && !noPrePostAutoLoaders) { - useLoadersPre.push(r.value); - } - } else if ( - typeof r.value === "object" && - r.value !== null && - typeof settings[r.type] === "object" && - settings[r.type] !== null - ) { - settings[r.type] = cachedCleverMerge(settings[r.type], r.value); - } else { - settings[r.type] = r.value; - } - } - } - let postLoaders, normalLoaders, preLoaders; +const NoModeWarning = __webpack_require__(80832); - const continueCallback = needCalls(3, err => { - if (err) { - return callback(err); - } - const allLoaders = postLoaders; - if (matchResourceData === undefined) { - for (const loader of loaders) allLoaders.push(loader); - for (const loader of normalLoaders) allLoaders.push(loader); - } else { - for (const loader of normalLoaders) allLoaders.push(loader); - for (const loader of loaders) allLoaders.push(loader); - } - for (const loader of preLoaders) allLoaders.push(loader); - let type = settings.type; - const resolveOptions = settings.resolve; - const layer = settings.layer; - if (layer !== undefined && !layers) { - return callback( - new Error( - "'Rule.layer' is only allowed when 'experiments.layers' is enabled" - ) - ); - } - try { - Object.assign(data.createData, { - layer: - layer === undefined ? contextInfo.issuerLayer || null : layer, - request: stringifyLoadersAndResource( - allLoaders, - resourceData.resource - ), - userRequest, - rawRequest: request, - loaders: allLoaders, - resource: resourceData.resource, - context: - resourceData.context || getContext(resourceData.resource), - matchResource: matchResourceData - ? matchResourceData.resource - : undefined, - resourceResolveData: resourceData.data, - settings, - type, - parser: this.getParser(type, settings.parser), - parserOptions: settings.parser, - generator: this.getGenerator(type, settings.generator), - generatorOptions: settings.generator, - resolveOptions - }); - } catch (e) { - return callback(e); - } - callback(); - }); - this.resolveRequestArray( - contextInfo, - this.context, - useLoadersPost, - loaderResolver, - resolveContext, - (err, result) => { - postLoaders = result; - continueCallback(err); - } - ); - this.resolveRequestArray( - contextInfo, - this.context, - useLoaders, - loaderResolver, - resolveContext, - (err, result) => { - normalLoaders = result; - continueCallback(err); - } - ); - this.resolveRequestArray( - contextInfo, - this.context, - useLoadersPre, - loaderResolver, - resolveContext, - (err, result) => { - preLoaders = result; - continueCallback(err); - } - ); - }); +/** @typedef {import("./Compiler")} Compiler */ - this.resolveRequestArray( - contextInfo, - contextScheme ? this.context : context, - elements, - loaderResolver, - resolveContext, - (err, result) => { - if (err) return continueCallback(err); - loaders = result; - continueCallback(); - } - ); +class WarnNoModeSetPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.thisCompilation.tap("WarnNoModeSetPlugin", compilation => { + compilation.warnings.push(new NoModeWarning()); + }); + } +} - const defaultResolve = context => { - if (/^($|\?)/.test(unresolvedResource)) { - resourceData = { - resource: unresolvedResource, - data: {}, - ...cacheParseResource(unresolvedResource) - }; - continueCallback(); - } +module.exports = WarnNoModeSetPlugin; - // resource without scheme and with path - else { - const normalResolver = this.getResolver( - "normal", - dependencyType - ? cachedSetProperty( - resolveOptions || EMPTY_RESOLVE_OPTIONS, - "dependencyType", - dependencyType - ) - : resolveOptions - ); - this.resolveResource( - contextInfo, - context, - unresolvedResource, - normalResolver, - resolveContext, - (err, resolvedResource, resolvedResourceResolveData) => { - if (err) return continueCallback(err); - if (resolvedResource !== false) { - resourceData = { - resource: resolvedResource, - data: resolvedResourceResolveData, - ...cacheParseResource(resolvedResource) - }; - } - continueCallback(); - } - ); - } - }; - // resource with scheme - if (scheme) { - resourceData = { - resource: unresolvedResource, - data: {}, - path: undefined, - query: undefined, - fragment: undefined, - context: undefined - }; - this.hooks.resolveForScheme - .for(scheme) - .callAsync(resourceData, data, err => { - if (err) return continueCallback(err); - continueCallback(); - }); +/***/ }), + +/***/ 65193: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { groupBy } = __webpack_require__(84953); +const createSchemaValidation = __webpack_require__(32540); + +/** @typedef {import("../declarations/plugins/WatchIgnorePlugin").WatchIgnorePluginOptions} WatchIgnorePluginOptions */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */ + +const validate = createSchemaValidation( + __webpack_require__(16711), + () => __webpack_require__(44246), + { + name: "Watch Ignore Plugin", + baseDataPath: "options" + } +); + +const IGNORE_TIME_ENTRY = "ignore"; + +class IgnoringWatchFileSystem { + /** + * @param {WatchFileSystem} wfs original file system + * @param {(string|RegExp)[]} paths ignored paths + */ + constructor(wfs, paths) { + this.wfs = wfs; + this.paths = paths; + } + + watch(files, dirs, missing, startTime, options, callback, callbackUndelayed) { + files = Array.from(files); + dirs = Array.from(dirs); + const ignored = path => + this.paths.some(p => + p instanceof RegExp ? p.test(path) : path.indexOf(p) === 0 + ); + + const [ignoredFiles, notIgnoredFiles] = groupBy(files, ignored); + const [ignoredDirs, notIgnoredDirs] = groupBy(dirs, ignored); + + const watcher = this.wfs.watch( + notIgnoredFiles, + notIgnoredDirs, + missing, + startTime, + options, + (err, fileTimestamps, dirTimestamps, changedFiles, removedFiles) => { + if (err) return callback(err); + for (const path of ignoredFiles) { + fileTimestamps.set(path, IGNORE_TIME_ENTRY); } - // resource within scheme - else if (contextScheme) { - resourceData = { - resource: unresolvedResource, - data: {}, - path: undefined, - query: undefined, - fragment: undefined, - context: undefined - }; - this.hooks.resolveInScheme - .for(contextScheme) - .callAsync(resourceData, data, (err, handled) => { - if (err) return continueCallback(err); - if (!handled) return defaultResolve(this.context); - continueCallback(); - }); + for (const path of ignoredDirs) { + dirTimestamps.set(path, IGNORE_TIME_ENTRY); } - // resource without scheme and without path - else defaultResolve(context); - } + callback( + err, + fileTimestamps, + dirTimestamps, + changedFiles, + removedFiles + ); + }, + callbackUndelayed ); + + return { + close: () => watcher.close(), + pause: () => watcher.pause(), + getContextTimeInfoEntries: () => { + const dirTimestamps = watcher.getContextTimeInfoEntries(); + for (const path of ignoredDirs) { + dirTimestamps.set(path, IGNORE_TIME_ENTRY); + } + return dirTimestamps; + }, + getFileTimeInfoEntries: () => { + const fileTimestamps = watcher.getFileTimeInfoEntries(); + for (const path of ignoredFiles) { + fileTimestamps.set(path, IGNORE_TIME_ENTRY); + } + return fileTimestamps; + }, + getInfo: + watcher.getInfo && + (() => { + const info = watcher.getInfo(); + const { fileTimeInfoEntries, contextTimeInfoEntries } = info; + for (const path of ignoredFiles) { + fileTimeInfoEntries.set(path, IGNORE_TIME_ENTRY); + } + for (const path of ignoredDirs) { + contextTimeInfoEntries.set(path, IGNORE_TIME_ENTRY); + } + return info; + }) + }; } +} - cleanupForCache() { - for (const module of this._restoredUnsafeCacheEntries) { - ChunkGraph.clearChunkGraphForModule(module); - ModuleGraph.clearModuleGraphForModule(module); - module.cleanupForCache(); - } +class WatchIgnorePlugin { + /** + * @param {WatchIgnorePluginOptions} options options + */ + constructor(options) { + validate(options); + this.paths = options.paths; } /** - * @param {ModuleFactoryCreateData} data data object - * @param {function(Error=, ModuleFactoryResult=): void} callback callback + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - create(data, callback) { - const dependencies = /** @type {ModuleDependency[]} */ (data.dependencies); - const context = data.context || this.context; - const resolveOptions = data.resolveOptions || EMPTY_RESOLVE_OPTIONS; - const dependency = dependencies[0]; - const request = dependency.request; - const assertions = dependency.assertions; - const contextInfo = data.contextInfo; - const fileDependencies = new LazySet(); - const missingDependencies = new LazySet(); - const contextDependencies = new LazySet(); - const dependencyType = - (dependencies.length > 0 && dependencies[0].category) || ""; - /** @type {ResolveData} */ - const resolveData = { - contextInfo, - resolveOptions, - context, - request, - assertions, - dependencies, - dependencyType, - fileDependencies, - missingDependencies, - contextDependencies, - createData: {}, - cacheable: true - }; - this.hooks.beforeResolve.callAsync(resolveData, (err, result) => { - if (err) { - return callback(err, { - fileDependencies, - missingDependencies, - contextDependencies, - cacheable: false - }); - } + apply(compiler) { + compiler.hooks.afterEnvironment.tap("WatchIgnorePlugin", () => { + compiler.watchFileSystem = new IgnoringWatchFileSystem( + compiler.watchFileSystem, + this.paths + ); + }); + } +} - // Ignored - if (result === false) { - return callback(null, { - fileDependencies, - missingDependencies, - contextDependencies, - cacheable: resolveData.cacheable - }); - } +module.exports = WatchIgnorePlugin; - if (typeof result === "object") - throw new Error( - deprecationChangedHookMessage( - "beforeResolve", - this.hooks.beforeResolve - ) - ); - this.hooks.factorize.callAsync(resolveData, (err, module) => { - if (err) { - return callback(err, { - fileDependencies, - missingDependencies, - contextDependencies, - cacheable: false - }); - } +/***/ }), - const factoryResult = { - module, - fileDependencies, - missingDependencies, - contextDependencies, - cacheable: resolveData.cacheable - }; +/***/ 84275: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - callback(null, factoryResult); - }); - }); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - resolveResource( - contextInfo, - context, - unresolvedResource, - resolver, - resolveContext, - callback - ) { - resolver.resolve( - contextInfo, - context, - unresolvedResource, - resolveContext, - (err, resolvedResource, resolvedResourceResolveData) => { - if (err) { - return this._resolveResourceErrorHints( - err, - contextInfo, - context, - unresolvedResource, - resolver, - resolveContext, - (err2, hints) => { - if (err2) { - err.message += ` -An fatal error happened during resolving additional hints for this error: ${err2.message}`; - err.stack += ` -An fatal error happened during resolving additional hints for this error: -${err2.stack}`; - return callback(err); - } - if (hints && hints.length > 0) { - err.message += ` -${hints.join("\n\n")}`; - } - callback(err); - } - ); - } - callback(err, resolvedResource, resolvedResourceResolveData); - } - ); - } - _resolveResourceErrorHints( - error, - contextInfo, - context, - unresolvedResource, - resolver, - resolveContext, - callback - ) { - asyncLib.parallel( - [ - callback => { - if (!resolver.options.fullySpecified) return callback(); - resolver - .withOptions({ - fullySpecified: false - }) - .resolve( - contextInfo, - context, - unresolvedResource, - resolveContext, - (err, resolvedResource) => { - if (!err && resolvedResource) { - const resource = parseResource(resolvedResource).path.replace( - /^.*[\\/]/, - "" - ); - return callback( - null, - `Did you mean '${resource}'? -BREAKING CHANGE: The request '${unresolvedResource}' failed to resolve only because it was resolved as fully specified -(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"'). -The extension in the request is mandatory for it to be fully specified. -Add the extension to the request.` - ); - } - callback(); - } - ); - }, - callback => { - if (!resolver.options.enforceExtension) return callback(); - resolver - .withOptions({ - enforceExtension: false, - extensions: [] - }) - .resolve( - contextInfo, - context, - unresolvedResource, - resolveContext, - (err, resolvedResource) => { - if (!err && resolvedResource) { - let hint = ""; - const match = /(\.[^.]+)(\?|$)/.exec(unresolvedResource); - if (match) { - const fixedRequest = unresolvedResource.replace( - /(\.[^.]+)(\?|$)/, - "$2" - ); - if (resolver.options.extensions.has(match[1])) { - hint = `Did you mean '${fixedRequest}'?`; - } else { - hint = `Did you mean '${fixedRequest}'? Also note that '${match[1]}' is not in 'resolve.extensions' yet and need to be added for this to work?`; - } - } else { - hint = `Did you mean to omit the extension or to remove 'resolve.enforceExtension'?`; - } - return callback( - null, - `The request '${unresolvedResource}' failed to resolve only because 'resolve.enforceExtension' was specified. -${hint} -Including the extension in the request is no longer possible. Did you mean to enforce including the extension in requests with 'resolve.extensions: []' instead?` - ); - } - callback(); - } - ); - }, - callback => { - if ( - /^\.\.?\//.test(unresolvedResource) || - resolver.options.preferRelative - ) { - return callback(); - } - resolver.resolve( - contextInfo, - context, - `./${unresolvedResource}`, - resolveContext, - (err, resolvedResource) => { - if (err || !resolvedResource) return callback(); - const moduleDirectories = resolver.options.modules - .map(m => (Array.isArray(m) ? m.join(", ") : m)) - .join(", "); - callback( - null, - `Did you mean './${unresolvedResource}'? -Requests that should resolve in the current directory need to start with './'. -Requests that start with a name are treated as module requests and resolve within module directories (${moduleDirectories}). -If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.` - ); - } - ); - } - ], - (err, hints) => { - if (err) return callback(err); - callback(null, hints.filter(Boolean)); - } - ); - } - - resolveRequestArray( - contextInfo, - context, - array, - resolver, - resolveContext, - callback - ) { - if (array.length === 0) return callback(null, array); - asyncLib.map( - array, - (item, callback) => { - resolver.resolve( - contextInfo, - context, - item.loader, - resolveContext, - (err, result) => { - if ( - err && - /^[^/]*$/.test(item.loader) && - !/-loader$/.test(item.loader) - ) { - return resolver.resolve( - contextInfo, - context, - item.loader + "-loader", - resolveContext, - err2 => { - if (!err2) { - err.message = - err.message + - "\n" + - "BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when using loaders.\n" + - ` You need to specify '${item.loader}-loader' instead of '${item.loader}',\n` + - " see https://webpack.js.org/migrate/3/#automatic-loader-module-name-extension-removed"; - } - callback(err); - } - ); - } - if (err) return callback(err); +const Stats = __webpack_require__(31743); - const parsedResult = this._parseResourceWithoutFragment(result); - const resolved = { - loader: parsedResult.path, - options: - item.options === undefined - ? parsedResult.query - ? parsedResult.query.slice(1) - : undefined - : item.options, - ident: item.options === undefined ? undefined : item.ident - }; - return callback(null, resolved); - } - ); - }, - callback - ); - } +/** @typedef {import("../declarations/WebpackOptions").WatchOptions} WatchOptions */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */ - getParser(type, parserOptions = EMPTY_PARSER_OPTIONS) { - let cache = this.parserCache.get(type); +/** + * @template T + * @callback Callback + * @param {(Error | null)=} err + * @param {T=} result + */ - if (cache === undefined) { - cache = new WeakMap(); - this.parserCache.set(type, cache); +class Watching { + /** + * @param {Compiler} compiler the compiler + * @param {WatchOptions} watchOptions options + * @param {Callback} handler completion handler + */ + constructor(compiler, watchOptions, handler) { + this.startTime = null; + this.invalid = false; + this.handler = handler; + /** @type {Callback[]} */ + this.callbacks = []; + /** @type {Callback[] | undefined} */ + this._closeCallbacks = undefined; + this.closed = false; + this.suspended = false; + this.blocked = false; + this._isBlocked = () => false; + this._onChange = () => {}; + this._onInvalid = () => {}; + if (typeof watchOptions === "number") { + this.watchOptions = { + aggregateTimeout: watchOptions + }; + } else if (watchOptions && typeof watchOptions === "object") { + this.watchOptions = { ...watchOptions }; + } else { + this.watchOptions = {}; } - - let parser = cache.get(parserOptions); - - if (parser === undefined) { - parser = this.createParser(type, parserOptions); - cache.set(parserOptions, parser); + if (typeof this.watchOptions.aggregateTimeout !== "number") { + this.watchOptions.aggregateTimeout = 20; } - - return parser; + this.compiler = compiler; + this.running = false; + this._initial = true; + this._invalidReported = true; + this._needRecords = true; + this.watcher = undefined; + this.pausedWatcher = undefined; + /** @type {Set} */ + this._collectedChangedFiles = undefined; + /** @type {Set} */ + this._collectedRemovedFiles = undefined; + this._done = this._done.bind(this); + process.nextTick(() => { + if (this._initial) this._invalidate(); + }); } /** - * @param {string} type type - * @param {{[k: string]: any}} parserOptions parser options - * @returns {Parser} parser + * @param {ReadonlySet} changedFiles changed files + * @param {ReadonlySet} removedFiles removed files */ - createParser(type, parserOptions = {}) { - parserOptions = mergeGlobalOptions( - this._globalParserOptions, - type, - parserOptions - ); - const parser = this.hooks.createParser.for(type).call(parserOptions); - if (!parser) { - throw new Error(`No parser registered for ${type}`); + _mergeWithCollected(changedFiles, removedFiles) { + if (!changedFiles) return; + if (!this._collectedChangedFiles) { + this._collectedChangedFiles = new Set(changedFiles); + this._collectedRemovedFiles = new Set(removedFiles); + } else { + for (const file of changedFiles) { + this._collectedChangedFiles.add(file); + this._collectedRemovedFiles.delete(file); + } + for (const file of removedFiles) { + this._collectedChangedFiles.delete(file); + this._collectedRemovedFiles.add(file); + } } - this.hooks.parser.for(type).call(parser, parserOptions); - return parser; } - getGenerator(type, generatorOptions = EMPTY_GENERATOR_OPTIONS) { - let cache = this.generatorCache.get(type); - - if (cache === undefined) { - cache = new WeakMap(); - this.generatorCache.set(type, cache); - } - - let generator = cache.get(generatorOptions); - - if (generator === undefined) { - generator = this.createGenerator(type, generatorOptions); - cache.set(generatorOptions, generator); + /** + * @param {ReadonlyMap=} fileTimeInfoEntries info for files + * @param {ReadonlyMap=} contextTimeInfoEntries info for directories + * @param {ReadonlySet=} changedFiles changed files + * @param {ReadonlySet=} removedFiles removed files + * @returns {void} + */ + _go(fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles) { + this._initial = false; + if (this.startTime === null) this.startTime = Date.now(); + this.running = true; + if (this.watcher) { + this.pausedWatcher = this.watcher; + this.lastWatcherStartTime = Date.now(); + this.watcher.pause(); + this.watcher = null; + } else if (!this.lastWatcherStartTime) { + this.lastWatcherStartTime = Date.now(); } - - return generator; - } - - createGenerator(type, generatorOptions = {}) { - generatorOptions = mergeGlobalOptions( - this._globalGeneratorOptions, - type, - generatorOptions - ); - const generator = this.hooks.createGenerator - .for(type) - .call(generatorOptions); - if (!generator) { - throw new Error(`No generator registered for ${type}`); + this.compiler.fsStartTime = Date.now(); + if ( + changedFiles && + removedFiles && + fileTimeInfoEntries && + contextTimeInfoEntries + ) { + this._mergeWithCollected(changedFiles, removedFiles); + this.compiler.fileTimestamps = fileTimeInfoEntries; + this.compiler.contextTimestamps = contextTimeInfoEntries; + } else if (this.pausedWatcher) { + if (this.pausedWatcher.getInfo) { + const { + changes, + removals, + fileTimeInfoEntries, + contextTimeInfoEntries + } = this.pausedWatcher.getInfo(); + this._mergeWithCollected(changes, removals); + this.compiler.fileTimestamps = fileTimeInfoEntries; + this.compiler.contextTimestamps = contextTimeInfoEntries; + } else { + this._mergeWithCollected( + this.pausedWatcher.getAggregatedChanges && + this.pausedWatcher.getAggregatedChanges(), + this.pausedWatcher.getAggregatedRemovals && + this.pausedWatcher.getAggregatedRemovals() + ); + this.compiler.fileTimestamps = + this.pausedWatcher.getFileTimeInfoEntries(); + this.compiler.contextTimestamps = + this.pausedWatcher.getContextTimeInfoEntries(); + } } - this.hooks.generator.for(type).call(generator, generatorOptions); - return generator; - } - - getResolver(type, resolveOptions) { - return this.resolverFactory.get(type, resolveOptions); - } -} + this.compiler.modifiedFiles = this._collectedChangedFiles; + this._collectedChangedFiles = undefined; + this.compiler.removedFiles = this._collectedRemovedFiles; + this._collectedRemovedFiles = undefined; -module.exports = NormalModuleFactory; + const run = () => { + if (this.compiler.idle) { + return this.compiler.cache.endIdle(err => { + if (err) return this._done(err); + this.compiler.idle = false; + run(); + }); + } + if (this._needRecords) { + return this.compiler.readRecords(err => { + if (err) return this._done(err); + this._needRecords = false; + run(); + }); + } + this.invalid = false; + this._invalidReported = false; + this.compiler.hooks.watchRun.callAsync(this.compiler, err => { + if (err) return this._done(err); + const onCompiled = (err, compilation) => { + if (err) return this._done(err, compilation); + if (this.invalid) return this._done(null, compilation); -/***/ }), + if (this.compiler.hooks.shouldEmit.call(compilation) === false) { + return this._done(null, compilation); + } -/***/ 30633: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + process.nextTick(() => { + const logger = compilation.getLogger("webpack.Compiler"); + logger.time("emitAssets"); + this.compiler.emitAssets(compilation, err => { + logger.timeEnd("emitAssets"); + if (err) return this._done(err, compilation); + if (this.invalid) return this._done(null, compilation); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + logger.time("emitRecords"); + this.compiler.emitRecords(err => { + logger.timeEnd("emitRecords"); + if (err) return this._done(err, compilation); + if (compilation.hooks.needAdditionalPass.call()) { + compilation.needAdditionalPass = true; + compilation.startTime = this.startTime; + compilation.endTime = Date.now(); + logger.time("done hook"); + const stats = new Stats(compilation); + this.compiler.hooks.done.callAsync(stats, err => { + logger.timeEnd("done hook"); + if (err) return this._done(err, compilation); -const { join, dirname } = __webpack_require__(17139); + this.compiler.hooks.additionalPass.callAsync(err => { + if (err) return this._done(err, compilation); + this.compiler.compile(onCompiled); + }); + }); + return; + } + return this._done(null, compilation); + }); + }); + }); + }; + this.compiler.compile(onCompiled); + }); + }; -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {function(TODO): void} ModuleReplacer */ + run(); + } -class NormalModuleReplacementPlugin { /** - * Create an instance of the plugin - * @param {RegExp} resourceRegExp the resource matcher - * @param {string|ModuleReplacer} newResource the resource replacement + * @param {Compilation} compilation the compilation + * @returns {Stats} the compilation stats */ - constructor(resourceRegExp, newResource) { - this.resourceRegExp = resourceRegExp; - this.newResource = newResource; + _getStats(compilation) { + const stats = new Stats(compilation); + return stats; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {Error=} err an optional error + * @param {Compilation=} compilation the compilation * @returns {void} */ - apply(compiler) { - const resourceRegExp = this.resourceRegExp; - const newResource = this.newResource; - compiler.hooks.normalModuleFactory.tap( - "NormalModuleReplacementPlugin", - nmf => { - nmf.hooks.beforeResolve.tap("NormalModuleReplacementPlugin", result => { - if (resourceRegExp.test(result.request)) { - if (typeof newResource === "function") { - newResource(result); - } else { - result.request = newResource; - } - } - }); - nmf.hooks.afterResolve.tap("NormalModuleReplacementPlugin", result => { - const createData = result.createData; - if (resourceRegExp.test(createData.resource)) { - if (typeof newResource === "function") { - newResource(result); - } else { - const fs = compiler.inputFileSystem; - if ( - newResource.startsWith("/") || - (newResource.length > 1 && newResource[1] === ":") - ) { - createData.resource = newResource; - } else { - createData.resource = join( - fs, - dirname(fs, createData.resource), - newResource - ); - } - } - } - }); - } - ); - } -} - -module.exports = NormalModuleReplacementPlugin; - + _done(err, compilation) { + this.running = false; -/***/ }), + const logger = compilation && compilation.getLogger("webpack.Watching"); -/***/ 80057: -/***/ (function(__unused_webpack_module, exports) { + let stats = null; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent -*/ + const handleError = (err, cbs) => { + this.compiler.hooks.failed.call(err); + this.compiler.cache.beginIdle(); + this.compiler.idle = true; + this.handler(err, stats); + if (!cbs) { + cbs = this.callbacks; + this.callbacks = []; + } + for (const cb of cbs) cb(err); + }; + if ( + this.invalid && + !this.suspended && + !this.blocked && + !(this._isBlocked() && (this.blocked = true)) + ) { + if (compilation) { + logger.time("storeBuildDependencies"); + this.compiler.cache.storeBuildDependencies( + compilation.buildDependencies, + err => { + logger.timeEnd("storeBuildDependencies"); + if (err) return handleError(err); + this._go(); + } + ); + } else { + this._go(); + } + return; + } + if (compilation) { + compilation.startTime = this.startTime; + compilation.endTime = Date.now(); + stats = new Stats(compilation); + } + this.startTime = null; + if (err) return handleError(err); -exports.STAGE_BASIC = -10; -exports.STAGE_DEFAULT = 0; -exports.STAGE_ADVANCED = 10; + const cbs = this.callbacks; + this.callbacks = []; + logger.time("done hook"); + this.compiler.hooks.done.callAsync(stats, err => { + logger.timeEnd("done hook"); + if (err) return handleError(err, cbs); + this.handler(null, stats); + logger.time("storeBuildDependencies"); + this.compiler.cache.storeBuildDependencies( + compilation.buildDependencies, + err => { + logger.timeEnd("storeBuildDependencies"); + if (err) return handleError(err, cbs); + logger.time("beginIdle"); + this.compiler.cache.beginIdle(); + this.compiler.idle = true; + logger.timeEnd("beginIdle"); + process.nextTick(() => { + if (!this.closed) { + this.watch( + compilation.fileDependencies, + compilation.contextDependencies, + compilation.missingDependencies + ); + } + }); + for (const cb of cbs) cb(null); + this.compiler.hooks.afterDone.call(stats); + } + ); + }); + } + /** + * @param {Iterable} files watched files + * @param {Iterable} dirs watched directories + * @param {Iterable} missing watched existence entries + * @returns {void} + */ + watch(files, dirs, missing) { + this.pausedWatcher = null; + this.watcher = this.compiler.watchFileSystem.watch( + files, + dirs, + missing, + this.lastWatcherStartTime, + this.watchOptions, + ( + err, + fileTimeInfoEntries, + contextTimeInfoEntries, + changedFiles, + removedFiles + ) => { + if (err) { + this.compiler.modifiedFiles = undefined; + this.compiler.removedFiles = undefined; + this.compiler.fileTimestamps = undefined; + this.compiler.contextTimestamps = undefined; + this.compiler.fsStartTime = undefined; + return this.handler(err); + } + this._invalidate( + fileTimeInfoEntries, + contextTimeInfoEntries, + changedFiles, + removedFiles + ); + this._onChange(); + }, + (fileName, changeTime) => { + if (!this._invalidReported) { + this._invalidReported = true; + this.compiler.hooks.invalid.call(fileName, changeTime); + } + this._onInvalid(); + } + ); + } -/***/ }), + /** + * @param {Callback=} callback signals when the build has completed again + * @returns {void} + */ + invalidate(callback) { + if (callback) { + this.callbacks.push(callback); + } + if (!this._invalidReported) { + this._invalidReported = true; + this.compiler.hooks.invalid.call(null, Date.now()); + } + this._onChange(); + this._invalidate(); + } -/***/ 81426: -/***/ (function(module) { + _invalidate( + fileTimeInfoEntries, + contextTimeInfoEntries, + changedFiles, + removedFiles + ) { + if (this.suspended || (this._isBlocked() && (this.blocked = true))) { + this._mergeWithCollected(changedFiles, removedFiles); + return; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (this.running) { + this._mergeWithCollected(changedFiles, removedFiles); + this.invalid = true; + } else { + this._go( + fileTimeInfoEntries, + contextTimeInfoEntries, + changedFiles, + removedFiles + ); + } + } + suspend() { + this.suspended = true; + } + resume() { + if (this.suspended) { + this.suspended = false; + this._invalidate(); + } + } -class OptionsApply { - process(options, compiler) {} + /** + * @param {Callback} callback signals when the watcher is closed + * @returns {void} + */ + close(callback) { + if (this._closeCallbacks) { + if (callback) { + this._closeCallbacks.push(callback); + } + return; + } + const finalCallback = (err, compilation) => { + this.running = false; + this.compiler.running = false; + this.compiler.watching = undefined; + this.compiler.watchMode = false; + this.compiler.modifiedFiles = undefined; + this.compiler.removedFiles = undefined; + this.compiler.fileTimestamps = undefined; + this.compiler.contextTimestamps = undefined; + this.compiler.fsStartTime = undefined; + const shutdown = err => { + this.compiler.hooks.watchClose.call(); + const closeCallbacks = this._closeCallbacks; + this._closeCallbacks = undefined; + for (const cb of closeCallbacks) cb(err); + }; + if (compilation) { + const logger = compilation.getLogger("webpack.Watching"); + logger.time("storeBuildDependencies"); + this.compiler.cache.storeBuildDependencies( + compilation.buildDependencies, + err2 => { + logger.timeEnd("storeBuildDependencies"); + shutdown(err || err2); + } + ); + } else { + shutdown(err); + } + }; + + this.closed = true; + if (this.watcher) { + this.watcher.close(); + this.watcher = null; + } + if (this.pausedWatcher) { + this.pausedWatcher.close(); + this.pausedWatcher = null; + } + this._closeCallbacks = []; + if (callback) { + this._closeCallbacks.push(callback); + } + if (this.running) { + this.invalid = true; + this._done = finalCallback; + } else { + finalCallback(); + } + } } -module.exports = OptionsApply; + +module.exports = Watching; /***/ }), -/***/ 11715: +/***/ 53799: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Jarid Margolin @jaridmargolin */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./NormalModule")} NormalModule */ - -/** @typedef {Record} PreparsedAst */ - -/** - * @typedef {Object} ParserStateBase - * @property {string | Buffer} source - * @property {NormalModule} current - * @property {NormalModule} module - * @property {Compilation} compilation - * @property {{[k: string]: any}} options - */ +const inspect = (__webpack_require__(73837).inspect.custom); +const makeSerializable = __webpack_require__(33032); -/** @typedef {Record & ParserStateBase} ParserState */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Module")} Module */ -class Parser { - /* istanbul ignore next */ +class WebpackError extends Error { /** - * @abstract - * @param {string | Buffer | PreparsedAst} source the source to parse - * @param {ParserState} state the parser state - * @returns {ParserState} the parser state + * Creates an instance of WebpackError. + * @param {string=} message error message */ - parse(source, state) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + constructor(message) { + super(message); + + this.details = undefined; + /** @type {Module} */ + this.module = undefined; + /** @type {DependencyLocation} */ + this.loc = undefined; + /** @type {boolean} */ + this.hideStack = undefined; + /** @type {Chunk} */ + this.chunk = undefined; + /** @type {string} */ + this.file = undefined; + } + + [inspect]() { + return this.stack + (this.details ? `\n${this.details}` : ""); + } + + serialize({ write }) { + write(this.name); + write(this.message); + write(this.stack); + write(this.details); + write(this.loc); + write(this.hideStack); + } + + deserialize({ read }) { + this.name = read(); + this.message = read(); + this.stack = read(); + this.details = read(); + this.loc = read(); + this.hideStack = read(); } } -module.exports = Parser; +makeSerializable(WebpackError, "webpack/lib/WebpackError"); + +module.exports = WebpackError; /***/ }), -/***/ 73850: +/***/ 97017: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ -const PrefetchDependency = __webpack_require__(31618); +const IgnoreErrorModuleFactory = __webpack_require__(3); +const WebpackIsIncludedDependency = __webpack_require__(26505); +const { + toConstantDependency +} = __webpack_require__(93998); +/** @typedef {import("enhanced-resolve/lib/Resolver")} Resolver */ /** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ -class PrefetchPlugin { - constructor(context, request) { - if (request) { - this.context = context; - this.request = request; - } else { - this.context = null; - this.request = context; - } - } - +class WebpackIsIncludedPlugin { /** - * Apply the plugin * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { compiler.hooks.compilation.tap( - "PrefetchPlugin", + "WebpackIsIncludedPlugin", (compilation, { normalModuleFactory }) => { compilation.dependencyFactories.set( - PrefetchDependency, - normalModuleFactory + WebpackIsIncludedDependency, + new IgnoreErrorModuleFactory(normalModuleFactory) + ); + compilation.dependencyTemplates.set( + WebpackIsIncludedDependency, + new WebpackIsIncludedDependency.Template() ); + + /** + * @param {JavascriptParser} parser the parser + * @returns {void} + */ + const handler = parser => { + parser.hooks.call + .for("__webpack_is_included__") + .tap("WebpackIsIncludedPlugin", expr => { + if ( + expr.type !== "CallExpression" || + expr.arguments.length !== 1 || + expr.arguments[0].type === "SpreadElement" + ) + return; + + const request = parser.evaluateExpression(expr.arguments[0]); + + if (!request.isString()) return; + + const dep = new WebpackIsIncludedDependency( + request.string, + expr.range + ); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + return true; + }); + parser.hooks.typeof + .for("__webpack_is_included__") + .tap( + "WebpackIsIncludedPlugin", + toConstantDependency(parser, JSON.stringify("function")) + ); + }; + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("WebpackIsIncludedPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("WebpackIsIncludedPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("WebpackIsIncludedPlugin", handler); } ); - compiler.hooks.make.tapAsync("PrefetchPlugin", (compilation, callback) => { - compilation.addModuleChain( - this.context || compiler.context, - new PrefetchDependency(this.request), - err => { - callback(err); - } - ); - }); } } -module.exports = PrefetchPlugin; +module.exports = WebpackIsIncludedPlugin; /***/ }), -/***/ 13216: +/***/ 88422: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -58448,705 +57406,698 @@ module.exports = PrefetchPlugin; -const Compiler = __webpack_require__(70845); -const MultiCompiler = __webpack_require__(33370); -const NormalModule = __webpack_require__(39); -const createSchemaValidation = __webpack_require__(32540); -const { contextify } = __webpack_require__(82186); +const OptionsApply = __webpack_require__(81426); -/** @typedef {import("../declarations/plugins/ProgressPlugin").HandlerFunction} HandlerFunction */ -/** @typedef {import("../declarations/plugins/ProgressPlugin").ProgressPluginArgument} ProgressPluginArgument */ -/** @typedef {import("../declarations/plugins/ProgressPlugin").ProgressPluginOptions} ProgressPluginOptions */ +const AssetModulesPlugin = __webpack_require__(16109); +const JavascriptModulesPlugin = __webpack_require__(89464); +const JsonModulesPlugin = __webpack_require__(86770); -const validate = createSchemaValidation( - __webpack_require__(57647), - () => __webpack_require__(75202), - { - name: "Progress Plugin", - baseDataPath: "options" - } -); -const median3 = (a, b, c) => { - return a + b + c - Math.max(a, b, c) - Math.min(a, b, c); -}; +const ChunkPrefetchPreloadPlugin = __webpack_require__(33895); -const createDefaultHandler = (profile, logger) => { - /** @type {{ value: string, time: number }[]} */ - const lastStateInfo = []; +const EntryOptionPlugin = __webpack_require__(9909); +const RecordIdsPlugin = __webpack_require__(11094); - const defaultHandler = (percentage, msg, ...args) => { - if (profile) { - if (percentage === 0) { - lastStateInfo.length = 0; - } - const fullState = [msg, ...args]; - const state = fullState.map(s => s.replace(/\d+\/\d+ /g, "")); - const now = Date.now(); - const len = Math.max(state.length, lastStateInfo.length); - for (let i = len; i >= 0; i--) { - const stateItem = i < state.length ? state[i] : undefined; - const lastStateItem = - i < lastStateInfo.length ? lastStateInfo[i] : undefined; - if (lastStateItem) { - if (stateItem !== lastStateItem.value) { - const diff = now - lastStateItem.time; - if (lastStateItem.value) { - let reportState = lastStateItem.value; - if (i > 0) { - reportState = lastStateInfo[i - 1].value + " > " + reportState; - } - const stateMsg = `${" | ".repeat(i)}${diff} ms ${reportState}`; - const d = diff; - // This depends on timing so we ignore it for coverage - /* istanbul ignore next */ - { - if (d > 10000) { - logger.error(stateMsg); - } else if (d > 1000) { - logger.warn(stateMsg); - } else if (d > 10) { - logger.info(stateMsg); - } else if (d > 5) { - logger.log(stateMsg); - } else { - logger.debug(stateMsg); - } - } - } - if (stateItem === undefined) { - lastStateInfo.length = i; - } else { - lastStateItem.value = stateItem; - lastStateItem.time = now; - lastStateInfo.length = i + 1; - } - } - } else { - lastStateInfo[i] = { - value: stateItem, - time: now - }; - } - } - } - logger.status(`${Math.floor(percentage * 100)}%`, msg, ...args); - if (percentage === 1 || (!msg && args.length === 0)) logger.status(); - }; +const RuntimePlugin = __webpack_require__(2307); - return defaultHandler; -}; +const APIPlugin = __webpack_require__(74315); +const CompatibilityPlugin = __webpack_require__(94258); +const ConstPlugin = __webpack_require__(11146); +const ExportsInfoApiPlugin = __webpack_require__(7145); +const WebpackIsIncludedPlugin = __webpack_require__(97017); -/** - * @callback ReportProgress - * @param {number} p - * @param {...string} [args] - * @returns {void} - */ +const TemplatedPathPlugin = __webpack_require__(80734); +const UseStrictPlugin = __webpack_require__(36803); +const WarnCaseSensitiveModulesPlugin = __webpack_require__(56504); -/** @type {WeakMap} */ -const progressReporters = new WeakMap(); +const DataUriPlugin = __webpack_require__(64820); +const FileUriPlugin = __webpack_require__(57637); -class ProgressPlugin { - /** - * @param {Compiler} compiler the current compiler - * @returns {ReportProgress} a progress reporter, if any - */ - static getReporter(compiler) { - return progressReporters.get(compiler); - } +const ResolverCachePlugin = __webpack_require__(97347); - /** - * @param {ProgressPluginArgument} options options - */ - constructor(options = {}) { - if (typeof options === "function") { - options = { - handler: options - }; - } +const CommonJsPlugin = __webpack_require__(32406); +const HarmonyModulesPlugin = __webpack_require__(39029); +const ImportMetaPlugin = __webpack_require__(17228); +const ImportPlugin = __webpack_require__(41293); +const LoaderPlugin = __webpack_require__(24721); +const RequireContextPlugin = __webpack_require__(2928); +const RequireEnsurePlugin = __webpack_require__(8434); +const RequireIncludePlugin = __webpack_require__(37378); +const SystemPlugin = __webpack_require__(97981); +const URLPlugin = __webpack_require__(14412); +const WorkerPlugin = __webpack_require__(82509); - validate(options); - options = { ...ProgressPlugin.defaultOptions, ...options }; +const InferAsyncModulesPlugin = __webpack_require__(59498); - this.profile = options.profile; - this.handler = options.handler; - this.modulesCount = options.modulesCount; - this.dependenciesCount = options.dependenciesCount; - this.showEntries = options.entries; - this.showModules = options.modules; - this.showDependencies = options.dependencies; - this.showActiveModules = options.activeModules; - this.percentBy = options.percentBy; - } +const JavascriptMetaInfoPlugin = __webpack_require__(52329); +const DefaultStatsFactoryPlugin = __webpack_require__(71760); +const DefaultStatsPresetPlugin = __webpack_require__(55442); +const DefaultStatsPrinterPlugin = __webpack_require__(58692); - /** - * @param {Compiler | MultiCompiler} compiler webpack compiler - * @returns {void} - */ - apply(compiler) { - const handler = - this.handler || - createDefaultHandler( - this.profile, - compiler.getInfrastructureLogger("webpack.Progress") - ); - if (compiler instanceof MultiCompiler) { - this._applyOnMultiCompiler(compiler, handler); - } else if (compiler instanceof Compiler) { - this._applyOnCompiler(compiler, handler); - } - } +const { cleverMerge } = __webpack_require__(60839); - /** - * @param {MultiCompiler} compiler webpack multi-compiler - * @param {HandlerFunction} handler function that executes for every progress step - * @returns {void} - */ - _applyOnMultiCompiler(compiler, handler) { - const states = compiler.compilers.map( - () => /** @type {[number, ...string[]]} */ ([0]) - ); - compiler.compilers.forEach((compiler, idx) => { - new ProgressPlugin((p, msg, ...args) => { - states[idx] = [p, msg, ...args]; - let sum = 0; - for (const [p] of states) sum += p; - handler(sum / states.length, `[${idx}] ${msg}`, ...args); - }).apply(compiler); - }); +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./Compiler")} Compiler */ + +class WebpackOptionsApply extends OptionsApply { + constructor() { + super(); } /** - * @param {Compiler} compiler webpack compiler - * @param {HandlerFunction} handler function that executes for every progress step - * @returns {void} + * @param {WebpackOptions} options options object + * @param {Compiler} compiler compiler object + * @returns {WebpackOptions} options object */ - _applyOnCompiler(compiler, handler) { - const showEntries = this.showEntries; - const showModules = this.showModules; - const showDependencies = this.showDependencies; - const showActiveModules = this.showActiveModules; - let lastActiveModule = ""; - let currentLoader = ""; - let lastModulesCount = 0; - let lastDependenciesCount = 0; - let lastEntriesCount = 0; - let modulesCount = 0; - let dependenciesCount = 0; - let entriesCount = 1; - let doneModules = 0; - let doneDependencies = 0; - let doneEntries = 0; - const activeModules = new Set(); - let lastUpdate = 0; + process(options, compiler) { + compiler.outputPath = options.output.path; + compiler.recordsInputPath = options.recordsInputPath || null; + compiler.recordsOutputPath = options.recordsOutputPath || null; + compiler.name = options.name; - const updateThrottled = () => { - if (lastUpdate + 500 < Date.now()) update(); - }; + if (options.externals) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const ExternalsPlugin = __webpack_require__(6652); + new ExternalsPlugin(options.externalsType, options.externals).apply( + compiler + ); + } - const update = () => { - /** @type {string[]} */ - const items = []; - const percentByModules = - doneModules / - Math.max(lastModulesCount || this.modulesCount || 1, modulesCount); - const percentByEntries = - doneEntries / - Math.max(lastEntriesCount || this.dependenciesCount || 1, entriesCount); - const percentByDependencies = - doneDependencies / - Math.max(lastDependenciesCount || 1, dependenciesCount); - let percentageFactor; + if (options.externalsPresets.node) { + const NodeTargetPlugin = __webpack_require__(17916); + new NodeTargetPlugin().apply(compiler); + } + if (options.externalsPresets.electronMain) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const ElectronTargetPlugin = __webpack_require__(32277); + new ElectronTargetPlugin("main").apply(compiler); + } + if (options.externalsPresets.electronPreload) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const ElectronTargetPlugin = __webpack_require__(32277); + new ElectronTargetPlugin("preload").apply(compiler); + } + if (options.externalsPresets.electronRenderer) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const ElectronTargetPlugin = __webpack_require__(32277); + new ElectronTargetPlugin("renderer").apply(compiler); + } + if ( + options.externalsPresets.electron && + !options.externalsPresets.electronMain && + !options.externalsPresets.electronPreload && + !options.externalsPresets.electronRenderer + ) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const ElectronTargetPlugin = __webpack_require__(32277); + new ElectronTargetPlugin().apply(compiler); + } + if (options.externalsPresets.nwjs) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const ExternalsPlugin = __webpack_require__(6652); + new ExternalsPlugin("node-commonjs", "nw.gui").apply(compiler); + } + if (options.externalsPresets.webAsync) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const ExternalsPlugin = __webpack_require__(6652); + new ExternalsPlugin( + "import", + options.experiments.css + ? ({ request, dependencyType }, callback) => { + if (dependencyType === "url") { + if (/^(\/\/|https?:\/\/)/.test(request)) + return callback(null, `asset ${request}`); + } else if (dependencyType === "css-import") { + if (/^(\/\/|https?:\/\/)/.test(request)) + return callback(null, `css-import ${request}`); + } else if (/^(\/\/|https?:\/\/|std:)/.test(request)) { + if (/^\.css(\?|$)/.test(request)) + return callback(null, `css-import ${request}`); + return callback(null, `import ${request}`); + } + callback(); + } + : /^(\/\/|https?:\/\/|std:)/ + ).apply(compiler); + } else if (options.externalsPresets.web) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const ExternalsPlugin = __webpack_require__(6652); + new ExternalsPlugin( + "module", + options.experiments.css + ? ({ request, dependencyType }, callback) => { + if (dependencyType === "url") { + if (/^(\/\/|https?:\/\/)/.test(request)) + return callback(null, `asset ${request}`); + } else if (dependencyType === "css-import") { + if (/^(\/\/|https?:\/\/)/.test(request)) + return callback(null, `css-import ${request}`); + } else if (/^(\/\/|https?:\/\/|std:)/.test(request)) { + if (/^\.css(\?|$)/.test(request)) + return callback(null, `css-import ${request}`); + return callback(null, `module ${request}`); + } + callback(); + } + : /^(\/\/|https?:\/\/|std:)/ + ).apply(compiler); + } - switch (this.percentBy) { - case "entries": - percentageFactor = percentByEntries; + new ChunkPrefetchPreloadPlugin().apply(compiler); + + if (typeof options.output.chunkFormat === "string") { + switch (options.output.chunkFormat) { + case "array-push": { + const ArrayPushCallbackChunkFormatPlugin = __webpack_require__(18535); + new ArrayPushCallbackChunkFormatPlugin().apply(compiler); break; - case "dependencies": - percentageFactor = percentByDependencies; + } + case "commonjs": { + const CommonJsChunkFormatPlugin = __webpack_require__(84508); + new CommonJsChunkFormatPlugin().apply(compiler); break; - case "modules": - percentageFactor = percentByModules; + } + case "module": { + const ModuleChunkFormatPlugin = __webpack_require__(68927); + new ModuleChunkFormatPlugin().apply(compiler); break; + } default: - percentageFactor = median3( - percentByModules, - percentByEntries, - percentByDependencies + throw new Error( + "Unsupported chunk format '" + options.output.chunkFormat + "'." ); } + } - const percentage = 0.1 + percentageFactor * 0.55; + if (options.output.enabledChunkLoadingTypes.length > 0) { + for (const type of options.output.enabledChunkLoadingTypes) { + const EnableChunkLoadingPlugin = __webpack_require__(61291); + new EnableChunkLoadingPlugin(type).apply(compiler); + } + } - if (currentLoader) { - items.push( - `import loader ${contextify( - compiler.context, - currentLoader, - compiler.root - )}` - ); - } else { - const statItems = []; - if (showEntries) { - statItems.push(`${doneEntries}/${entriesCount} entries`); - } - if (showDependencies) { - statItems.push( - `${doneDependencies}/${dependenciesCount} dependencies` - ); - } - if (showModules) { - statItems.push(`${doneModules}/${modulesCount} modules`); - } - if (showActiveModules) { - statItems.push(`${activeModules.size} active`); - } - if (statItems.length > 0) { - items.push(statItems.join(" ")); - } - if (showActiveModules) { - items.push(lastActiveModule); - } + if (options.output.enabledWasmLoadingTypes.length > 0) { + for (const type of options.output.enabledWasmLoadingTypes) { + const EnableWasmLoadingPlugin = __webpack_require__(78613); + new EnableWasmLoadingPlugin(type).apply(compiler); } - handler(percentage, "building", ...items); - lastUpdate = Date.now(); - }; + } - const factorizeAdd = () => { - dependenciesCount++; - if (dependenciesCount < 50 || dependenciesCount % 100 === 0) - updateThrottled(); - }; + if (options.output.enabledLibraryTypes.length > 0) { + for (const type of options.output.enabledLibraryTypes) { + const EnableLibraryPlugin = __webpack_require__(91452); + new EnableLibraryPlugin(type).apply(compiler); + } + } - const factorizeDone = () => { - doneDependencies++; - if (doneDependencies < 50 || doneDependencies % 100 === 0) - updateThrottled(); - }; + if (options.output.pathinfo) { + const ModuleInfoHeaderPlugin = __webpack_require__(3454); + new ModuleInfoHeaderPlugin(options.output.pathinfo !== true).apply( + compiler + ); + } - const moduleAdd = () => { - modulesCount++; - if (modulesCount < 50 || modulesCount % 100 === 0) updateThrottled(); - }; + if (options.output.clean) { + const CleanPlugin = __webpack_require__(31085); + new CleanPlugin( + options.output.clean === true ? {} : options.output.clean + ).apply(compiler); + } - // only used when showActiveModules is set - const moduleBuild = module => { - const ident = module.identifier(); - if (ident) { - activeModules.add(ident); - lastActiveModule = ident; - update(); + if (options.devtool) { + if (options.devtool.includes("source-map")) { + const hidden = options.devtool.includes("hidden"); + const inline = options.devtool.includes("inline"); + const evalWrapped = options.devtool.includes("eval"); + const cheap = options.devtool.includes("cheap"); + const moduleMaps = options.devtool.includes("module"); + const noSources = options.devtool.includes("nosources"); + const Plugin = evalWrapped + ? __webpack_require__(14790) + : __webpack_require__(63872); + new Plugin({ + filename: inline ? null : options.output.sourceMapFilename, + moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate, + fallbackModuleFilenameTemplate: + options.output.devtoolFallbackModuleFilenameTemplate, + append: hidden ? false : undefined, + module: moduleMaps ? true : cheap ? false : true, + columns: cheap ? false : true, + noSources: noSources, + namespace: options.output.devtoolNamespace + }).apply(compiler); + } else if (options.devtool.includes("eval")) { + const EvalDevToolModulePlugin = __webpack_require__(65218); + new EvalDevToolModulePlugin({ + moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate, + namespace: options.output.devtoolNamespace + }).apply(compiler); } - }; + } - const entryAdd = (entry, options) => { - entriesCount++; - if (entriesCount < 5 || entriesCount % 10 === 0) updateThrottled(); - }; + new JavascriptModulesPlugin().apply(compiler); + new JsonModulesPlugin().apply(compiler); + new AssetModulesPlugin().apply(compiler); - const moduleDone = module => { - doneModules++; - if (showActiveModules) { - const ident = module.identifier(); - if (ident) { - activeModules.delete(ident); - if (lastActiveModule === ident) { - lastActiveModule = ""; - for (const m of activeModules) { - lastActiveModule = m; - } - update(); - return; - } - } + if (!options.experiments.outputModule) { + if (options.output.module) { + throw new Error( + "'output.module: true' is only allowed when 'experiments.outputModule' is enabled" + ); } - if (doneModules < 50 || doneModules % 100 === 0) updateThrottled(); - }; - - const entryDone = (entry, options) => { - doneEntries++; - update(); - }; - - const cache = compiler - .getCache("ProgressPlugin") - .getItemCache("counts", null); - - let cacheGetPromise; - - compiler.hooks.beforeCompile.tap("ProgressPlugin", () => { - if (!cacheGetPromise) { - cacheGetPromise = cache.getPromise().then( - data => { - if (data) { - lastModulesCount = lastModulesCount || data.modulesCount; - lastDependenciesCount = - lastDependenciesCount || data.dependenciesCount; - } - return data; - }, - err => { - // Ignore error - } + if (options.output.enabledLibraryTypes.includes("module")) { + throw new Error( + "library type \"module\" is only allowed when 'experiments.outputModule' is enabled" ); } - }); + if (options.externalsType === "module") { + throw new Error( + "'externalsType: \"module\"' is only allowed when 'experiments.outputModule' is enabled" + ); + } + } - compiler.hooks.afterCompile.tapPromise("ProgressPlugin", compilation => { - if (compilation.compiler.isChild()) return Promise.resolve(); - return cacheGetPromise.then(async oldData => { - if ( - !oldData || - oldData.modulesCount !== modulesCount || - oldData.dependenciesCount !== dependenciesCount - ) { - await cache.storePromise({ modulesCount, dependenciesCount }); - } - }); - }); + if (options.experiments.syncWebAssembly) { + const WebAssemblyModulesPlugin = __webpack_require__(53639); + new WebAssemblyModulesPlugin({ + mangleImports: options.optimization.mangleWasmImports + }).apply(compiler); + } - compiler.hooks.compilation.tap("ProgressPlugin", compilation => { - if (compilation.compiler.isChild()) return; - lastModulesCount = modulesCount; - lastEntriesCount = entriesCount; - lastDependenciesCount = dependenciesCount; - modulesCount = dependenciesCount = entriesCount = 0; - doneModules = doneDependencies = doneEntries = 0; + if (options.experiments.asyncWebAssembly) { + const AsyncWebAssemblyModulesPlugin = __webpack_require__(7538); + new AsyncWebAssemblyModulesPlugin({ + mangleImports: options.optimization.mangleWasmImports + }).apply(compiler); + } - compilation.factorizeQueue.hooks.added.tap( - "ProgressPlugin", - factorizeAdd - ); - compilation.factorizeQueue.hooks.result.tap( - "ProgressPlugin", - factorizeDone - ); + if (options.experiments.css) { + const CssModulesPlugin = __webpack_require__(47283); + new CssModulesPlugin(options.experiments.css).apply(compiler); + } - compilation.addModuleQueue.hooks.added.tap("ProgressPlugin", moduleAdd); - compilation.processDependenciesQueue.hooks.result.tap( - "ProgressPlugin", - moduleDone - ); + if (options.experiments.lazyCompilation) { + const LazyCompilationPlugin = __webpack_require__(79040); + const lazyOptions = + typeof options.experiments.lazyCompilation === "object" + ? options.experiments.lazyCompilation + : null; + new LazyCompilationPlugin({ + backend: + typeof lazyOptions.backend === "function" + ? lazyOptions.backend + : __webpack_require__(17781)({ + ...lazyOptions.backend, + client: + (lazyOptions.backend && lazyOptions.backend.client) || + options.externalsPresets.node ? __webpack_require__.ab + "lazy-compilation-node.js" : __webpack_require__.ab + "lazy-compilation-web.js" + }), + entries: !lazyOptions || lazyOptions.entries !== false, + imports: !lazyOptions || lazyOptions.imports !== false, + test: (lazyOptions && lazyOptions.test) || undefined + }).apply(compiler); + } - if (showActiveModules) { - compilation.hooks.buildModule.tap("ProgressPlugin", moduleBuild); - } + if (options.experiments.buildHttp) { + const HttpUriPlugin = __webpack_require__(42110); + const httpOptions = options.experiments.buildHttp; + new HttpUriPlugin(httpOptions).apply(compiler); + } - compilation.hooks.addEntry.tap("ProgressPlugin", entryAdd); - compilation.hooks.failedEntry.tap("ProgressPlugin", entryDone); - compilation.hooks.succeedEntry.tap("ProgressPlugin", entryDone); + new EntryOptionPlugin().apply(compiler); + compiler.hooks.entryOption.call(options.context, options.entry); - // avoid dynamic require if bundled with webpack - // @ts-expect-error - if (false) {} + new RuntimePlugin().apply(compiler); - const hooks = { - finishModules: "finish module graph", - seal: "plugins", - optimizeDependencies: "dependencies optimization", - afterOptimizeDependencies: "after dependencies optimization", - beforeChunks: "chunk graph", - afterChunks: "after chunk graph", - optimize: "optimizing", - optimizeModules: "module optimization", - afterOptimizeModules: "after module optimization", - optimizeChunks: "chunk optimization", - afterOptimizeChunks: "after chunk optimization", - optimizeTree: "module and chunk tree optimization", - afterOptimizeTree: "after module and chunk tree optimization", - optimizeChunkModules: "chunk modules optimization", - afterOptimizeChunkModules: "after chunk modules optimization", - reviveModules: "module reviving", - beforeModuleIds: "before module ids", - moduleIds: "module ids", - optimizeModuleIds: "module id optimization", - afterOptimizeModuleIds: "module id optimization", - reviveChunks: "chunk reviving", - beforeChunkIds: "before chunk ids", - chunkIds: "chunk ids", - optimizeChunkIds: "chunk id optimization", - afterOptimizeChunkIds: "after chunk id optimization", - recordModules: "record modules", - recordChunks: "record chunks", - beforeModuleHash: "module hashing", - beforeCodeGeneration: "code generation", - beforeRuntimeRequirements: "runtime requirements", - beforeHash: "hashing", - afterHash: "after hashing", - recordHash: "record hash", - beforeModuleAssets: "module assets processing", - beforeChunkAssets: "chunk assets processing", - processAssets: "asset processing", - afterProcessAssets: "after asset optimization", - record: "recording", - afterSeal: "after seal" - }; - const numberOfHooks = Object.keys(hooks).length; - Object.keys(hooks).forEach((name, idx) => { - const title = hooks[name]; - const percentage = (idx / numberOfHooks) * 0.25 + 0.7; - compilation.hooks[name].intercept({ - name: "ProgressPlugin", - call() { - handler(percentage, "sealing", title); - }, - done() { - progressReporters.set(compiler, undefined); - handler(percentage, "sealing", title); - }, - result() { - handler(percentage, "sealing", title); - }, - error() { - handler(percentage, "sealing", title); - }, - tap(tap) { - // p is percentage from 0 to 1 - // args is any number of messages in a hierarchical matter - progressReporters.set(compilation.compiler, (p, ...args) => { - handler(percentage, "sealing", title, tap.name, ...args); - }); - handler(percentage, "sealing", title, tap.name); - } - }); - }); - }); - compiler.hooks.make.intercept({ - name: "ProgressPlugin", - call() { - handler(0.1, "building"); - }, - done() { - handler(0.65, "building"); - } - }); - const interceptHook = (hook, progress, category, name) => { - hook.intercept({ - name: "ProgressPlugin", - call() { - handler(progress, category, name); - }, - done() { - progressReporters.set(compiler, undefined); - handler(progress, category, name); - }, - result() { - handler(progress, category, name); - }, - error() { - handler(progress, category, name); - }, - tap(tap) { - progressReporters.set(compiler, (p, ...args) => { - handler(progress, category, name, tap.name, ...args); - }); - handler(progress, category, name, tap.name); - } - }); - }; - compiler.cache.hooks.endIdle.intercept({ - name: "ProgressPlugin", - call() { - handler(0, ""); - } - }); - interceptHook(compiler.cache.hooks.endIdle, 0.01, "cache", "end idle"); - compiler.hooks.initialize.intercept({ - name: "ProgressPlugin", - call() { - handler(0, ""); - } - }); - interceptHook(compiler.hooks.initialize, 0.01, "setup", "initialize"); - interceptHook(compiler.hooks.beforeRun, 0.02, "setup", "before run"); - interceptHook(compiler.hooks.run, 0.03, "setup", "run"); - interceptHook(compiler.hooks.watchRun, 0.03, "setup", "watch run"); - interceptHook( - compiler.hooks.normalModuleFactory, - 0.04, - "setup", - "normal module factory" - ); - interceptHook( - compiler.hooks.contextModuleFactory, - 0.05, - "setup", - "context module factory" - ); - interceptHook( - compiler.hooks.beforeCompile, - 0.06, - "setup", - "before compile" - ); - interceptHook(compiler.hooks.compile, 0.07, "setup", "compile"); - interceptHook(compiler.hooks.thisCompilation, 0.08, "setup", "compilation"); - interceptHook(compiler.hooks.compilation, 0.09, "setup", "compilation"); - interceptHook(compiler.hooks.finishMake, 0.69, "building", "finish"); - interceptHook(compiler.hooks.emit, 0.95, "emitting", "emit"); - interceptHook(compiler.hooks.afterEmit, 0.98, "emitting", "after emit"); - interceptHook(compiler.hooks.done, 0.99, "done", "plugins"); - compiler.hooks.done.intercept({ - name: "ProgressPlugin", - done() { - handler(0.99, ""); - } - }); - interceptHook( - compiler.cache.hooks.storeBuildDependencies, - 0.99, - "cache", - "store build dependencies" - ); - interceptHook(compiler.cache.hooks.shutdown, 0.99, "cache", "shutdown"); - interceptHook(compiler.cache.hooks.beginIdle, 0.99, "cache", "begin idle"); - interceptHook( - compiler.hooks.watchClose, - 0.99, - "end", - "closing watch compilation" - ); - compiler.cache.hooks.beginIdle.intercept({ - name: "ProgressPlugin", - done() { - handler(1, ""); - } - }); - compiler.cache.hooks.shutdown.intercept({ - name: "ProgressPlugin", - done() { - handler(1, ""); - } - }); - } -} - -ProgressPlugin.defaultOptions = { - profile: false, - modulesCount: 5000, - dependenciesCount: 10000, - modules: true, - dependencies: true, - activeModules: false, - entries: true -}; - -module.exports = ProgressPlugin; + new InferAsyncModulesPlugin().apply(compiler); + new DataUriPlugin().apply(compiler); + new FileUriPlugin().apply(compiler); -/***/ }), + new CompatibilityPlugin().apply(compiler); + new HarmonyModulesPlugin({ + topLevelAwait: options.experiments.topLevelAwait + }).apply(compiler); + if (options.amd !== false) { + const AMDPlugin = __webpack_require__(50067); + const RequireJsStuffPlugin = __webpack_require__(88846); + new AMDPlugin(options.amd || {}).apply(compiler); + new RequireJsStuffPlugin().apply(compiler); + } + new CommonJsPlugin().apply(compiler); + new LoaderPlugin({}).apply(compiler); + if (options.node !== false) { + const NodeStuffPlugin = __webpack_require__(95287); + new NodeStuffPlugin(options.node).apply(compiler); + } + new APIPlugin().apply(compiler); + new ExportsInfoApiPlugin().apply(compiler); + new WebpackIsIncludedPlugin().apply(compiler); + new ConstPlugin().apply(compiler); + new UseStrictPlugin().apply(compiler); + new RequireIncludePlugin().apply(compiler); + new RequireEnsurePlugin().apply(compiler); + new RequireContextPlugin().apply(compiler); + new ImportPlugin().apply(compiler); + new SystemPlugin().apply(compiler); + new ImportMetaPlugin().apply(compiler); + new URLPlugin().apply(compiler); + new WorkerPlugin( + options.output.workerChunkLoading, + options.output.workerWasmLoading, + options.output.module + ).apply(compiler); -/***/ 38309: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + new DefaultStatsFactoryPlugin().apply(compiler); + new DefaultStatsPresetPlugin().apply(compiler); + new DefaultStatsPrinterPlugin().apply(compiler); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + new JavascriptMetaInfoPlugin().apply(compiler); + if (typeof options.mode !== "string") { + const WarnNoModeSetPlugin = __webpack_require__(25295); + new WarnNoModeSetPlugin().apply(compiler); + } + const EnsureChunkConditionsPlugin = __webpack_require__(96260); + new EnsureChunkConditionsPlugin().apply(compiler); + if (options.optimization.removeAvailableModules) { + const RemoveParentModulesPlugin = __webpack_require__(7081); + new RemoveParentModulesPlugin().apply(compiler); + } + if (options.optimization.removeEmptyChunks) { + const RemoveEmptyChunksPlugin = __webpack_require__(84760); + new RemoveEmptyChunksPlugin().apply(compiler); + } + if (options.optimization.mergeDuplicateChunks) { + const MergeDuplicateChunksPlugin = __webpack_require__(85067); + new MergeDuplicateChunksPlugin().apply(compiler); + } + if (options.optimization.flagIncludedChunks) { + const FlagIncludedChunksPlugin = __webpack_require__(50089); + new FlagIncludedChunksPlugin().apply(compiler); + } + if (options.optimization.sideEffects) { + const SideEffectsFlagPlugin = __webpack_require__(84800); + new SideEffectsFlagPlugin( + options.optimization.sideEffects === true + ).apply(compiler); + } + if (options.optimization.providedExports) { + const FlagDependencyExportsPlugin = __webpack_require__(84506); + new FlagDependencyExportsPlugin().apply(compiler); + } + if (options.optimization.usedExports) { + const FlagDependencyUsagePlugin = __webpack_require__(58812); + new FlagDependencyUsagePlugin( + options.optimization.usedExports === "global" + ).apply(compiler); + } + if (options.optimization.innerGraph) { + const InnerGraphPlugin = __webpack_require__(28758); + new InnerGraphPlugin().apply(compiler); + } + if (options.optimization.mangleExports) { + const MangleExportsPlugin = __webpack_require__(27868); + new MangleExportsPlugin( + options.optimization.mangleExports !== "size" + ).apply(compiler); + } + if (options.optimization.concatenateModules) { + const ModuleConcatenationPlugin = __webpack_require__(74844); + new ModuleConcatenationPlugin().apply(compiler); + } + if (options.optimization.splitChunks) { + const SplitChunksPlugin = __webpack_require__(21478); + new SplitChunksPlugin(options.optimization.splitChunks).apply(compiler); + } + if (options.optimization.runtimeChunk) { + const RuntimeChunkPlugin = __webpack_require__(2837); + new RuntimeChunkPlugin(options.optimization.runtimeChunk).apply(compiler); + } + if (!options.optimization.emitOnErrors) { + const NoEmitOnErrorsPlugin = __webpack_require__(50169); + new NoEmitOnErrorsPlugin().apply(compiler); + } + if (options.optimization.realContentHash) { + const RealContentHashPlugin = __webpack_require__(46043); + new RealContentHashPlugin({ + hashFunction: options.output.hashFunction, + hashDigest: options.output.hashDigest + }).apply(compiler); + } + if (options.optimization.checkWasmTypes) { + const WasmFinalizeExportsPlugin = __webpack_require__(19810); + new WasmFinalizeExportsPlugin().apply(compiler); + } + const moduleIds = options.optimization.moduleIds; + if (moduleIds) { + switch (moduleIds) { + case "natural": { + const NaturalModuleIdsPlugin = __webpack_require__(83366); + new NaturalModuleIdsPlugin().apply(compiler); + break; + } + case "named": { + const NamedModuleIdsPlugin = __webpack_require__(24339); + new NamedModuleIdsPlugin().apply(compiler); + break; + } + case "hashed": { + const WarnDeprecatedOptionPlugin = __webpack_require__(76537); + const HashedModuleIdsPlugin = __webpack_require__(21825); + new WarnDeprecatedOptionPlugin( + "optimization.moduleIds", + "hashed", + "deterministic" + ).apply(compiler); + new HashedModuleIdsPlugin({ + hashFunction: options.output.hashFunction + }).apply(compiler); + break; + } + case "deterministic": { + const DeterministicModuleIdsPlugin = __webpack_require__(76692); + new DeterministicModuleIdsPlugin().apply(compiler); + break; + } + case "size": { + const OccurrenceModuleIdsPlugin = __webpack_require__(35371); + new OccurrenceModuleIdsPlugin({ + prioritiseInitial: true + }).apply(compiler); + break; + } + default: + throw new Error( + `webpack bug: moduleIds: ${moduleIds} is not implemented` + ); + } + } + const chunkIds = options.optimization.chunkIds; + if (chunkIds) { + switch (chunkIds) { + case "natural": { + const NaturalChunkIdsPlugin = __webpack_require__(86221); + new NaturalChunkIdsPlugin().apply(compiler); + break; + } + case "named": { + const NamedChunkIdsPlugin = __webpack_require__(6454); + new NamedChunkIdsPlugin().apply(compiler); + break; + } + case "deterministic": { + const DeterministicChunkIdsPlugin = __webpack_require__(8747); + new DeterministicChunkIdsPlugin().apply(compiler); + break; + } + case "size": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const OccurrenceChunkIdsPlugin = __webpack_require__(51020); + new OccurrenceChunkIdsPlugin({ + prioritiseInitial: true + }).apply(compiler); + break; + } + case "total-size": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const OccurrenceChunkIdsPlugin = __webpack_require__(51020); + new OccurrenceChunkIdsPlugin({ + prioritiseInitial: false + }).apply(compiler); + break; + } + default: + throw new Error( + `webpack bug: chunkIds: ${chunkIds} is not implemented` + ); + } + } + if (options.optimization.nodeEnv) { + const DefinePlugin = __webpack_require__(79065); + new DefinePlugin({ + "process.env.NODE_ENV": JSON.stringify(options.optimization.nodeEnv) + }).apply(compiler); + } + if (options.optimization.minimize) { + for (const minimizer of options.optimization.minimizer) { + if (typeof minimizer === "function") { + minimizer.call(compiler, compiler); + } else if (minimizer !== "...") { + minimizer.apply(compiler); + } + } + } -const ConstDependency = __webpack_require__(76911); -const ProvidedDependency = __webpack_require__(95770); -const { approve } = __webpack_require__(93998); + if (options.performance) { + const SizeLimitsPlugin = __webpack_require__(32557); + new SizeLimitsPlugin(options.performance).apply(compiler); + } -/** @typedef {import("./Compiler")} Compiler */ + new TemplatedPathPlugin().apply(compiler); -class ProvidePlugin { - /** - * @param {Record} definitions the provided identifiers - */ - constructor(definitions) { - this.definitions = definitions; - } + new RecordIdsPlugin({ + portableIds: options.optimization.portableRecords + }).apply(compiler); - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const definitions = this.definitions; - compiler.hooks.compilation.tap( - "ProvidePlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyTemplates.set( - ConstDependency, - new ConstDependency.Template() - ); - compilation.dependencyFactories.set( - ProvidedDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - ProvidedDependency, - new ProvidedDependency.Template() - ); - const handler = (parser, parserOptions) => { - Object.keys(definitions).forEach(name => { - const request = [].concat(definitions[name]); - const splittedName = name.split("."); - if (splittedName.length > 0) { - splittedName.slice(1).forEach((_, i) => { - const name = splittedName.slice(0, i + 1).join("."); - parser.hooks.canRename.for(name).tap("ProvidePlugin", approve); - }); - } + new WarnCaseSensitiveModulesPlugin().apply(compiler); - parser.hooks.expression.for(name).tap("ProvidePlugin", expr => { - const nameIdentifier = name.includes(".") - ? `__webpack_provided_${name.replace(/\./g, "_dot_")}` - : name; - const dep = new ProvidedDependency( - request[0], - nameIdentifier, - request.slice(1), - expr.range - ); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - return true; - }); + const AddManagedPathsPlugin = __webpack_require__(47942); + new AddManagedPathsPlugin( + options.snapshot.managedPaths, + options.snapshot.immutablePaths + ).apply(compiler); - parser.hooks.call.for(name).tap("ProvidePlugin", expr => { - const nameIdentifier = name.includes(".") - ? `__webpack_provided_${name.replace(/\./g, "_dot_")}` - : name; - const dep = new ProvidedDependency( - request[0], - nameIdentifier, - request.slice(1), - expr.callee.range + if (options.cache && typeof options.cache === "object") { + const cacheOptions = options.cache; + switch (cacheOptions.type) { + case "memory": { + if (isFinite(cacheOptions.maxGenerations)) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const MemoryWithGcCachePlugin = __webpack_require__(99334); + new MemoryWithGcCachePlugin({ + maxGenerations: cacheOptions.maxGenerations + }).apply(compiler); + } else { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const MemoryCachePlugin = __webpack_require__(52539); + new MemoryCachePlugin().apply(compiler); + } + if (cacheOptions.cacheUnaffected) { + if (!options.experiments.cacheUnaffected) { + throw new Error( + "'cache.cacheUnaffected: true' is only allowed when 'experiments.cacheUnaffected' is enabled" ); - dep.loc = expr.callee.loc; - parser.state.module.addDependency(dep); - parser.walkExpressions(expr.arguments); - return true; - }); - }); - }; - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("ProvidePlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("ProvidePlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("ProvidePlugin", handler); + } + compiler.moduleMemCaches = new Map(); + } + break; + } + case "filesystem": { + const AddBuildDependenciesPlugin = __webpack_require__(28034); + for (const key in cacheOptions.buildDependencies) { + const list = cacheOptions.buildDependencies[key]; + new AddBuildDependenciesPlugin(list).apply(compiler); + } + if (!isFinite(cacheOptions.maxMemoryGenerations)) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const MemoryCachePlugin = __webpack_require__(52539); + new MemoryCachePlugin().apply(compiler); + } else if (cacheOptions.maxMemoryGenerations !== 0) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const MemoryWithGcCachePlugin = __webpack_require__(99334); + new MemoryWithGcCachePlugin({ + maxGenerations: cacheOptions.maxMemoryGenerations + }).apply(compiler); + } + if (cacheOptions.memoryCacheUnaffected) { + if (!options.experiments.cacheUnaffected) { + throw new Error( + "'cache.memoryCacheUnaffected: true' is only allowed when 'experiments.cacheUnaffected' is enabled" + ); + } + compiler.moduleMemCaches = new Map(); + } + switch (cacheOptions.store) { + case "pack": { + const IdleFileCachePlugin = __webpack_require__(71985); + const PackFileCacheStrategy = __webpack_require__(86180); + new IdleFileCachePlugin( + new PackFileCacheStrategy({ + compiler, + fs: compiler.intermediateFileSystem, + context: options.context, + cacheLocation: cacheOptions.cacheLocation, + version: cacheOptions.version, + logger: compiler.getInfrastructureLogger( + "webpack.cache.PackFileCacheStrategy" + ), + snapshot: options.snapshot, + maxAge: cacheOptions.maxAge, + profile: cacheOptions.profile, + allowCollectingMemory: cacheOptions.allowCollectingMemory, + compression: cacheOptions.compression + }), + cacheOptions.idleTimeout, + cacheOptions.idleTimeoutForInitialStore, + cacheOptions.idleTimeoutAfterLargeChanges + ).apply(compiler); + break; + } + default: + throw new Error("Unhandled value for cache.store"); + } + break; + } + default: + // @ts-expect-error Property 'type' does not exist on type 'never'. ts(2339) + throw new Error(`Unknown cache type ${cacheOptions.type}`); } - ); + } + new ResolverCachePlugin().apply(compiler); + + if (options.ignoreWarnings && options.ignoreWarnings.length > 0) { + const IgnoreWarningsPlugin = __webpack_require__(7373); + new IgnoreWarningsPlugin(options.ignoreWarnings).apply(compiler); + } + + compiler.hooks.afterPlugins.call(compiler); + if (!compiler.inputFileSystem) { + throw new Error("No input filesystem provided"); + } + compiler.resolverFactory.hooks.resolveOptions + .for("normal") + .tap("WebpackOptionsApply", resolveOptions => { + resolveOptions = cleverMerge(options.resolve, resolveOptions); + resolveOptions.fileSystem = compiler.inputFileSystem; + return resolveOptions; + }); + compiler.resolverFactory.hooks.resolveOptions + .for("context") + .tap("WebpackOptionsApply", resolveOptions => { + resolveOptions = cleverMerge(options.resolve, resolveOptions); + resolveOptions.fileSystem = compiler.inputFileSystem; + resolveOptions.resolveToContext = true; + return resolveOptions; + }); + compiler.resolverFactory.hooks.resolveOptions + .for("loader") + .tap("WebpackOptionsApply", resolveOptions => { + resolveOptions = cleverMerge(options.resolveLoader, resolveOptions); + resolveOptions.fileSystem = compiler.inputFileSystem; + return resolveOptions; + }); + compiler.hooks.afterResolvers.call(compiler); + return options; } } -module.exports = ProvidePlugin; +module.exports = WebpackOptionsApply; /***/ }), -/***/ 84929: +/***/ 14452: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -59157,463 +58108,477 @@ module.exports = ProvidePlugin; -const { OriginalSource, RawSource } = __webpack_require__(51255); -const Module = __webpack_require__(73208); -const makeSerializable = __webpack_require__(33032); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./WebpackError")} WebpackError */ -/** @typedef {import("./util/Hash")} Hash */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ - -const TYPES = new Set(["javascript"]); +const { applyWebpackOptionsDefaults } = __webpack_require__(92988); +const { getNormalizedWebpackOptions } = __webpack_require__(26693); -class RawModule extends Module { - /** - * @param {string} source source code - * @param {string} identifier unique identifier - * @param {string=} readableIdentifier readable identifier - * @param {ReadonlySet=} runtimeRequirements runtime requirements needed for the source code - */ - constructor(source, identifier, readableIdentifier, runtimeRequirements) { - super("javascript/dynamic", null); - this.sourceStr = source; - this.identifierStr = identifier || this.sourceStr; - this.readableIdentifierStr = readableIdentifier || this.identifierStr; - this.runtimeRequirements = runtimeRequirements || null; +class WebpackOptionsDefaulter { + process(options) { + options = getNormalizedWebpackOptions(options); + applyWebpackOptionsDefaults(options); + return options; } +} - /** - * @returns {Set} types available (do not mutate) - */ - getSourceTypes() { - return TYPES; - } +module.exports = WebpackOptionsDefaulter; - /** - * @returns {string} a unique identifier of the module - */ - identifier() { - return this.identifierStr; - } - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - return Math.max(1, this.sourceStr.length); - } +/***/ }), - /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module - */ - readableIdentifier(requestShortener) { - return requestShortener.shorten(this.readableIdentifierStr); - } +/***/ 98421: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} - */ - needBuild(context, callback) { - return callback(null, !this.buildMeta); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Sergey Melyukov @smelukov +*/ - /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} - */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = {}; - this.buildInfo = { - cacheable: true - }; - callback(); - } - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration(context) { - const sources = new Map(); - if (this.useSourceMap || this.useSimpleSourceMap) { - sources.set( - "javascript", - new OriginalSource(this.sourceStr, this.identifier()) - ); - } else { - sources.set("javascript", new RawSource(this.sourceStr)); - } - return { sources, runtimeRequirements: this.runtimeRequirements }; - } - /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - hash.update(this.sourceStr); - super.updateHash(hash, context); - } +const mimeTypes = __webpack_require__(78585); +const path = __webpack_require__(71017); +const { RawSource } = __webpack_require__(51255); +const Generator = __webpack_require__(93401); +const RuntimeGlobals = __webpack_require__(16475); +const createHash = __webpack_require__(49835); +const { makePathsRelative } = __webpack_require__(82186); +const nonNumericOnlyHash = __webpack_require__(55668); - serialize(context) { - const { write } = context; +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").AssetGeneratorOptions} AssetGeneratorOptions */ +/** @typedef {import("../../declarations/WebpackOptions").AssetModuleOutputPath} AssetModuleOutputPath */ +/** @typedef {import("../../declarations/WebpackOptions").RawPublicPath} RawPublicPath */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../Generator").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../util/Hash")} Hash */ - write(this.sourceStr); - write(this.identifierStr); - write(this.readableIdentifierStr); - write(this.runtimeRequirements); +const mergeMaybeArrays = (a, b) => { + const set = new Set(); + if (Array.isArray(a)) for (const item of a) set.add(item); + else set.add(a); + if (Array.isArray(b)) for (const item of b) set.add(item); + else set.add(b); + return Array.from(set); +}; - super.serialize(context); +const mergeAssetInfo = (a, b) => { + const result = { ...a, ...b }; + for (const key of Object.keys(a)) { + if (key in b) { + if (a[key] === b[key]) continue; + switch (key) { + case "fullhash": + case "chunkhash": + case "modulehash": + case "contenthash": + result[key] = mergeMaybeArrays(a[key], b[key]); + break; + case "immutable": + case "development": + case "hotModuleReplacement": + case "javascriptModule": + result[key] = a[key] || b[key]; + break; + case "related": + result[key] = mergeRelatedInfo(a[key], b[key]); + break; + default: + throw new Error(`Can't handle conflicting asset info for ${key}`); + } + } } + return result; +}; - deserialize(context) { - const { read } = context; - - this.sourceStr = read(); - this.identifierStr = read(); - this.readableIdentifierStr = read(); - this.runtimeRequirements = read(); - - super.deserialize(context); +const mergeRelatedInfo = (a, b) => { + const result = { ...a, ...b }; + for (const key of Object.keys(a)) { + if (key in b) { + if (a[key] === b[key]) continue; + result[key] = mergeMaybeArrays(a[key], b[key]); + } } -} - -makeSerializable(RawModule, "webpack/lib/RawModule"); - -module.exports = RawModule; - - -/***/ }), - -/***/ 11094: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + return result; +}; +const encodeDataUri = (encoding, source) => { + let encodedContent; + switch (encoding) { + case "base64": { + encodedContent = source.buffer().toString("base64"); + break; + } + case false: { + const content = source.source(); -const { compareNumbers } = __webpack_require__(29579); -const identifierUtils = __webpack_require__(82186); + if (typeof content !== "string") { + encodedContent = content.toString("utf-8"); + } -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Module")} Module */ + encodedContent = encodeURIComponent(encodedContent).replace( + /[!'()*]/g, + character => "%" + character.codePointAt(0).toString(16) + ); + break; + } + default: + throw new Error(`Unsupported encoding '${encoding}'`); + } -/** - * @typedef {Object} RecordsChunks - * @property {Record=} byName - * @property {Record=} bySource - * @property {number[]=} usedIds - */ + return encodedContent; +}; -/** - * @typedef {Object} RecordsModules - * @property {Record=} byIdentifier - * @property {Record=} bySource - * @property {number[]=} usedIds - */ +const decodeDataUriContent = (encoding, content) => { + const isBase64 = encoding === "base64"; + return isBase64 + ? Buffer.from(content, "base64") + : Buffer.from(decodeURIComponent(content), "ascii"); +}; -/** - * @typedef {Object} Records - * @property {RecordsChunks=} chunks - * @property {RecordsModules=} modules - */ +const JS_TYPES = new Set(["javascript"]); +const JS_AND_ASSET_TYPES = new Set(["javascript", "asset"]); -class RecordIdsPlugin { +class AssetGenerator extends Generator { /** - * @param {Object} options Options object - * @param {boolean=} options.portableIds true, when ids need to be portable + * @param {AssetGeneratorOptions["dataUrl"]=} dataUrlOptions the options for the data url + * @param {string=} filename override for output.assetModuleFilename + * @param {RawPublicPath=} publicPath override for output.assetModulePublicPath + * @param {AssetModuleOutputPath=} outputPath the output path for the emitted file which is not included in the runtime import + * @param {boolean=} emit generate output asset */ - constructor(options) { - this.options = options || {}; + constructor(dataUrlOptions, filename, publicPath, outputPath, emit) { + super(); + this.dataUrlOptions = dataUrlOptions; + this.filename = filename; + this.publicPath = publicPath; + this.outputPath = outputPath; + this.emit = emit; } /** - * @param {Compiler} compiler the Compiler - * @returns {void} + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code */ - apply(compiler) { - const portableIds = this.options.portableIds; + generate( + module, + { runtime, chunkGraph, runtimeTemplate, runtimeRequirements, type, getData } + ) { + switch (type) { + case "asset": + return module.originalSource(); + default: { + runtimeRequirements.add(RuntimeGlobals.module); - const makePathsRelative = - identifierUtils.makePathsRelative.bindContextCache( - compiler.context, - compiler.root - ); + const originalSource = module.originalSource(); + if (module.buildInfo.dataUrl) { + let encodedSource; + if (typeof this.dataUrlOptions === "function") { + encodedSource = this.dataUrlOptions.call( + null, + originalSource.source(), + { + filename: module.matchResource || module.resource, + module + } + ); + } else { + /** @type {string | false | undefined} */ + let encoding = this.dataUrlOptions.encoding; + if (encoding === undefined) { + if ( + module.resourceResolveData && + module.resourceResolveData.encoding !== undefined + ) { + encoding = module.resourceResolveData.encoding; + } + } + if (encoding === undefined) { + encoding = "base64"; + } + let ext; + let mimeType = this.dataUrlOptions.mimetype; + if (mimeType === undefined) { + ext = path.extname(module.nameForCondition()); + if ( + module.resourceResolveData && + module.resourceResolveData.mimetype !== undefined + ) { + mimeType = + module.resourceResolveData.mimetype + + module.resourceResolveData.parameters; + } else if (ext) { + mimeType = mimeTypes.lookup(ext); + } + } + if (typeof mimeType !== "string") { + throw new Error( + "DataUrl can't be generated automatically, " + + `because there is no mimetype for "${ext}" in mimetype database. ` + + 'Either pass a mimetype via "generator.mimetype" or ' + + 'use type: "asset/resource" to create a resource file instead of a DataUrl' + ); + } - /** - * @param {Module} module the module - * @returns {string} the (portable) identifier - */ - const getModuleIdentifier = module => { - if (portableIds) { - return makePathsRelative(module.identifier()); - } - return module.identifier(); - }; + let encodedContent; - compiler.hooks.compilation.tap("RecordIdsPlugin", compilation => { - compilation.hooks.recordModules.tap( - "RecordIdsPlugin", - /** - * @param {Module[]} modules the modules array - * @param {Records} records the records object - * @returns {void} - */ - (modules, records) => { - const chunkGraph = compilation.chunkGraph; - if (!records.modules) records.modules = {}; - if (!records.modules.byIdentifier) records.modules.byIdentifier = {}; - /** @type {Set} */ - const usedIds = new Set(); - for (const module of modules) { - const moduleId = chunkGraph.getModuleId(module); - if (typeof moduleId !== "number") continue; - const identifier = getModuleIdentifier(module); - records.modules.byIdentifier[identifier] = moduleId; - usedIds.add(moduleId); - } - records.modules.usedIds = Array.from(usedIds).sort(compareNumbers); - } - ); - compilation.hooks.reviveModules.tap( - "RecordIdsPlugin", - /** - * @param {Module[]} modules the modules array - * @param {Records} records the records object - * @returns {void} - */ - (modules, records) => { - if (!records.modules) return; - if (records.modules.byIdentifier) { - const chunkGraph = compilation.chunkGraph; - /** @type {Set} */ - const usedIds = new Set(); - for (const module of modules) { - const moduleId = chunkGraph.getModuleId(module); - if (moduleId !== null) continue; - const identifier = getModuleIdentifier(module); - const id = records.modules.byIdentifier[identifier]; - if (id === undefined) continue; - if (usedIds.has(id)) continue; - usedIds.add(id); - chunkGraph.setModuleId(module, id); - } - } - if (Array.isArray(records.modules.usedIds)) { - compilation.usedModuleIds = new Set(records.modules.usedIds); - } - } - ); - - /** - * @param {Chunk} chunk the chunk - * @returns {string[]} sources of the chunk - */ - const getChunkSources = chunk => { - /** @type {string[]} */ - const sources = []; - for (const chunkGroup of chunk.groupsIterable) { - const index = chunkGroup.chunks.indexOf(chunk); - if (chunkGroup.name) { - sources.push(`${index} ${chunkGroup.name}`); - } else { - for (const origin of chunkGroup.origins) { - if (origin.module) { - if (origin.request) { - sources.push( - `${index} ${getModuleIdentifier(origin.module)} ${ - origin.request - }` - ); - } else if (typeof origin.loc === "string") { - sources.push( - `${index} ${getModuleIdentifier(origin.module)} ${ - origin.loc - }` - ); - } else if ( - origin.loc && - typeof origin.loc === "object" && - "start" in origin.loc - ) { - sources.push( - `${index} ${getModuleIdentifier( - origin.module - )} ${JSON.stringify(origin.loc.start)}` - ); - } - } + if ( + module.resourceResolveData && + module.resourceResolveData.encoding === encoding && + decodeDataUriContent( + module.resourceResolveData.encoding, + module.resourceResolveData.encodedContent + ).equals(originalSource.buffer()) + ) { + encodedContent = module.resourceResolveData.encodedContent; + } else { + encodedContent = encodeDataUri(encoding, originalSource); } - } - } - return sources; - }; - compilation.hooks.recordChunks.tap( - "RecordIdsPlugin", - /** - * @param {Chunk[]} chunks the chunks array - * @param {Records} records the records object - * @returns {void} - */ - (chunks, records) => { - if (!records.chunks) records.chunks = {}; - if (!records.chunks.byName) records.chunks.byName = {}; - if (!records.chunks.bySource) records.chunks.bySource = {}; - /** @type {Set} */ - const usedIds = new Set(); - for (const chunk of chunks) { - if (typeof chunk.id !== "number") continue; - const name = chunk.name; - if (name) records.chunks.byName[name] = chunk.id; - const sources = getChunkSources(chunk); - for (const source of sources) { - records.chunks.bySource[source] = chunk.id; - } - usedIds.add(chunk.id); + encodedSource = `data:${mimeType}${ + encoding ? `;${encoding}` : "" + },${encodedContent}`; } - records.chunks.usedIds = Array.from(usedIds).sort(compareNumbers); - } - ); - compilation.hooks.reviveChunks.tap( - "RecordIdsPlugin", - /** - * @param {Chunk[]} chunks the chunks array - * @param {Records} records the records object - * @returns {void} - */ - (chunks, records) => { - if (!records.chunks) return; - /** @type {Set} */ - const usedIds = new Set(); - if (records.chunks.byName) { - for (const chunk of chunks) { - if (chunk.id !== null) continue; - if (!chunk.name) continue; - const id = records.chunks.byName[chunk.name]; - if (id === undefined) continue; - if (usedIds.has(id)) continue; - usedIds.add(id); - chunk.id = id; - chunk.ids = [id]; - } + const data = getData(); + data.set("url", Buffer.from(encodedSource)); + return new RawSource( + `${RuntimeGlobals.module}.exports = ${JSON.stringify( + encodedSource + )};` + ); + } else { + const assetModuleFilename = + this.filename || runtimeTemplate.outputOptions.assetModuleFilename; + const hash = createHash(runtimeTemplate.outputOptions.hashFunction); + if (runtimeTemplate.outputOptions.hashSalt) { + hash.update(runtimeTemplate.outputOptions.hashSalt); } - if (records.chunks.bySource) { - for (const chunk of chunks) { - if (chunk.id !== null) continue; - const sources = getChunkSources(chunk); - for (const source of sources) { - const id = records.chunks.bySource[source]; - if (id === undefined) continue; - if (usedIds.has(id)) continue; - usedIds.add(id); - chunk.id = id; - chunk.ids = [id]; - break; + hash.update(originalSource.buffer()); + const fullHash = /** @type {string} */ ( + hash.digest(runtimeTemplate.outputOptions.hashDigest) + ); + const contentHash = nonNumericOnlyHash( + fullHash, + runtimeTemplate.outputOptions.hashDigestLength + ); + module.buildInfo.fullContentHash = fullHash; + const sourceFilename = makePathsRelative( + runtimeTemplate.compilation.compiler.context, + module.matchResource || module.resource, + runtimeTemplate.compilation.compiler.root + ).replace(/^\.\//, ""); + let { path: filename, info: assetInfo } = + runtimeTemplate.compilation.getAssetPathWithInfo( + assetModuleFilename, + { + module, + runtime, + filename: sourceFilename, + chunkGraph, + contentHash } - } + ); + let assetPath; + if (this.publicPath !== undefined) { + const { path, info } = + runtimeTemplate.compilation.getAssetPathWithInfo( + this.publicPath, + { + module, + runtime, + filename: sourceFilename, + chunkGraph, + contentHash + } + ); + assetInfo = mergeAssetInfo(assetInfo, info); + assetPath = JSON.stringify(path + filename); + } else { + runtimeRequirements.add(RuntimeGlobals.publicPath); // add __webpack_require__.p + assetPath = runtimeTemplate.concatenation( + { expr: RuntimeGlobals.publicPath }, + filename + ); } - if (Array.isArray(records.chunks.usedIds)) { - compilation.usedChunkIds = new Set(records.chunks.usedIds); + assetInfo = { + sourceFilename, + ...assetInfo + }; + if (this.outputPath) { + const { path: outputPath, info } = + runtimeTemplate.compilation.getAssetPathWithInfo( + this.outputPath, + { + module, + runtime, + filename: sourceFilename, + chunkGraph, + contentHash + } + ); + assetInfo = mergeAssetInfo(assetInfo, info); + filename = path.posix.join(outputPath, filename); + } + module.buildInfo.filename = filename; + module.buildInfo.assetInfo = assetInfo; + if (getData) { + // Due to code generation caching module.buildInfo.XXX can't used to store such information + // It need to be stored in the code generation results instead, where it's cached too + // TODO webpack 6 For back-compat reasons we also store in on module.buildInfo + const data = getData(); + data.set("fullContentHash", fullHash); + data.set("filename", filename); + data.set("assetInfo", assetInfo); } + + return new RawSource( + `${RuntimeGlobals.module}.exports = ${assetPath};` + ); } - ); - }); + } + } } -} -module.exports = RecordIdsPlugin; - -/***/ }), - -/***/ 73406: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) + */ + getTypes(module) { + if ((module.buildInfo && module.buildInfo.dataUrl) || this.emit === false) { + return JS_TYPES; + } else { + return JS_AND_ASSET_TYPES; + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module + */ + getSize(module, type) { + switch (type) { + case "asset": { + const originalSource = module.originalSource(); + if (!originalSource) { + return 0; + } + return originalSource.size(); + } + default: + if (module.buildInfo && module.buildInfo.dataUrl) { + const originalSource = module.originalSource(); -const { contextify } = __webpack_require__(82186); + if (!originalSource) { + return 0; + } -class RequestShortener { - /** - * @param {string} dir the directory - * @param {object=} associatedObjectForCache an object to which the cache will be attached - */ - constructor(dir, associatedObjectForCache) { - this.contextify = contextify.bindContextCache( - dir, - associatedObjectForCache - ); + // roughly for data url + // Example: m.exports="data:image/png;base64,ag82/f+2==" + // 4/3 = base64 encoding + // 34 = ~ data url header + footer + rounding + return originalSource.size() * 1.34 + 36; + } else { + // it's only estimated so this number is probably fine + // Example: m.exports=r.p+"0123456789012345678901.ext" + return 42; + } + } } /** - * @param {string | undefined | null} request the request to shorten - * @returns {string | undefined | null} the shortened request + * @param {Hash} hash hash that will be modified + * @param {UpdateHashContext} updateHashContext context for updating hash */ - shorten(request) { - if (!request) { - return request; - } - return this.contextify(request); + updateHash(hash, { module }) { + hash.update(module.buildInfo.dataUrl ? "data-url" : "resource"); } } -module.exports = RequestShortener; +module.exports = AssetGenerator; /***/ }), -/***/ 88846: +/***/ 16109: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Yuta Hiroto @hiroppy */ -const RuntimeGlobals = __webpack_require__(16475); -const ConstDependency = __webpack_require__(76911); -const { - toConstantDependency -} = __webpack_require__(93998); +const { cleverMerge } = __webpack_require__(60839); +const { compareModulesByIdentifier } = __webpack_require__(29579); +const createSchemaValidation = __webpack_require__(32540); +const memoize = __webpack_require__(78676); -/** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ -module.exports = class RequireJsStuffPlugin { +const getSchema = name => { + const { definitions } = __webpack_require__(73342); + return { + definitions, + oneOf: [{ $ref: `#/definitions/${name}` }] + }; +}; + +const generatorValidationOptions = { + name: "Asset Modules Plugin", + baseDataPath: "generator" +}; +const validateGeneratorOptions = { + asset: createSchemaValidation( + __webpack_require__(55125), + () => getSchema("AssetGeneratorOptions"), + generatorValidationOptions + ), + "asset/resource": createSchemaValidation( + __webpack_require__(4405), + () => getSchema("AssetResourceGeneratorOptions"), + generatorValidationOptions + ), + "asset/inline": createSchemaValidation( + __webpack_require__(62368), + () => getSchema("AssetInlineGeneratorOptions"), + generatorValidationOptions + ) +}; + +const validateParserOptions = createSchemaValidation( + __webpack_require__(45020), + () => getSchema("AssetParserOptions"), + { + name: "Asset Modules Plugin", + baseDataPath: "parser" + } +); + +const getAssetGenerator = memoize(() => __webpack_require__(98421)); +const getAssetParser = memoize(() => __webpack_require__(91112)); +const getAssetSourceParser = memoize(() => __webpack_require__(30953)); +const getAssetSourceGenerator = memoize(() => + __webpack_require__(18749) +); + +const type = "asset"; +const plugin = "AssetModulesPlugin"; + +class AssetModulesPlugin { /** * Apply the plugin * @param {Compiler} compiler the compiler instance @@ -59621,684 +58586,406 @@ module.exports = class RequireJsStuffPlugin { */ apply(compiler) { compiler.hooks.compilation.tap( - "RequireJsStuffPlugin", + plugin, (compilation, { normalModuleFactory }) => { - compilation.dependencyTemplates.set( - ConstDependency, - new ConstDependency.Template() - ); - const handler = (parser, parserOptions) => { - if ( - parserOptions.requireJs === undefined || - !parserOptions.requireJs - ) { - return; - } - - parser.hooks.call - .for("require.config") - .tap( - "RequireJsStuffPlugin", - toConstantDependency(parser, "undefined") - ); - parser.hooks.call - .for("requirejs.config") - .tap( - "RequireJsStuffPlugin", - toConstantDependency(parser, "undefined") + normalModuleFactory.hooks.createParser + .for("asset") + .tap(plugin, parserOptions => { + validateParserOptions(parserOptions); + parserOptions = cleverMerge( + compiler.options.module.parser.asset, + parserOptions ); - parser.hooks.expression - .for("require.version") - .tap( - "RequireJsStuffPlugin", - toConstantDependency(parser, JSON.stringify("0.0.0")) - ); - parser.hooks.expression - .for("requirejs.onError") - .tap( - "RequireJsStuffPlugin", - toConstantDependency( - parser, - RuntimeGlobals.uncaughtErrorHandler, - [RuntimeGlobals.uncaughtErrorHandler] - ) - ); - }; - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("RequireJsStuffPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("RequireJsStuffPlugin", handler); - } - ); - } -}; + let dataUrlCondition = parserOptions.dataUrlCondition; + if (!dataUrlCondition || typeof dataUrlCondition === "object") { + dataUrlCondition = { + maxSize: 8096, + ...dataUrlCondition + }; + } + const AssetParser = getAssetParser(); -/***/ }), + return new AssetParser(dataUrlCondition); + }); + normalModuleFactory.hooks.createParser + .for("asset/inline") + .tap(plugin, parserOptions => { + const AssetParser = getAssetParser(); -/***/ 30217: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + return new AssetParser(true); + }); + normalModuleFactory.hooks.createParser + .for("asset/resource") + .tap(plugin, parserOptions => { + const AssetParser = getAssetParser(); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + return new AssetParser(false); + }); + normalModuleFactory.hooks.createParser + .for("asset/source") + .tap(plugin, parserOptions => { + const AssetSourceParser = getAssetSourceParser(); + return new AssetSourceParser(); + }); + for (const type of ["asset", "asset/inline", "asset/resource"]) { + normalModuleFactory.hooks.createGenerator + .for(type) + .tap(plugin, generatorOptions => { + validateGeneratorOptions[type](generatorOptions); -const Factory = (__webpack_require__(30662).ResolverFactory); -const { HookMap, SyncHook, SyncWaterfallHook } = __webpack_require__(41242); -const { - cachedCleverMerge, - removeOperations, - resolveByProperty -} = __webpack_require__(60839); + let dataUrl = undefined; + if (type !== "asset/resource") { + dataUrl = generatorOptions.dataUrl; + if (!dataUrl || typeof dataUrl === "object") { + dataUrl = { + encoding: undefined, + mimetype: undefined, + ...dataUrl + }; + } + } -/** @typedef {import("enhanced-resolve").ResolveOptions} ResolveOptions */ -/** @typedef {import("enhanced-resolve").Resolver} Resolver */ -/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} WebpackResolveOptions */ -/** @typedef {import("../declarations/WebpackOptions").ResolvePluginInstance} ResolvePluginInstance */ + let filename = undefined; + let publicPath = undefined; + let outputPath = undefined; + if (type !== "asset/inline") { + filename = generatorOptions.filename; + publicPath = generatorOptions.publicPath; + outputPath = generatorOptions.outputPath; + } -/** @typedef {WebpackResolveOptions & {dependencyType?: string, resolveToContext?: boolean }} ResolveOptionsWithDependencyType */ -/** - * @typedef {Object} WithOptions - * @property {function(Partial): ResolverWithOptions} withOptions create a resolver with additional/different options - */ + const AssetGenerator = getAssetGenerator(); -/** @typedef {Resolver & WithOptions} ResolverWithOptions */ + return new AssetGenerator( + dataUrl, + filename, + publicPath, + outputPath, + generatorOptions.emit !== false + ); + }); + } + normalModuleFactory.hooks.createGenerator + .for("asset/source") + .tap(plugin, () => { + const AssetSourceGenerator = getAssetSourceGenerator(); -// need to be hoisted on module level for caching identity -const EMPTY_RESOLVE_OPTIONS = {}; + return new AssetSourceGenerator(); + }); -/** - * @param {ResolveOptionsWithDependencyType} resolveOptionsWithDepType enhanced options - * @returns {ResolveOptions} merged options - */ -const convertToResolveOptions = resolveOptionsWithDepType => { - const { dependencyType, plugins, ...remaining } = resolveOptionsWithDepType; + compilation.hooks.renderManifest.tap(plugin, (result, options) => { + const { chunkGraph } = compilation; + const { chunk, codeGenerationResults } = options; - // check type compat - /** @type {Partial} */ - const partialOptions = { - ...remaining, - plugins: - plugins && - /** @type {ResolvePluginInstance[]} */ ( - plugins.filter(item => item !== "...") - ) - }; + const modules = chunkGraph.getOrderedChunkModulesIterableBySourceType( + chunk, + "asset", + compareModulesByIdentifier + ); + if (modules) { + for (const module of modules) { + try { + const codeGenResult = codeGenerationResults.get( + module, + chunk.runtime + ); + result.push({ + render: () => codeGenResult.sources.get(type), + filename: + module.buildInfo.filename || + codeGenResult.data.get("filename"), + info: + module.buildInfo.assetInfo || + codeGenResult.data.get("assetInfo"), + auxiliary: true, + identifier: `assetModule${chunkGraph.getModuleId(module)}`, + hash: + module.buildInfo.fullContentHash || + codeGenResult.data.get("fullContentHash") + }); + } catch (e) { + e.message += `\nduring rendering of asset ${module.identifier()}`; + throw e; + } + } + } - if (!partialOptions.fileSystem) { - throw new Error( - "fileSystem is missing in resolveOptions, but it's required for enhanced-resolve" + return result; + }); + + compilation.hooks.prepareModuleExecution.tap( + "AssetModulesPlugin", + (options, context) => { + const { codeGenerationResult } = options; + const source = codeGenerationResult.sources.get("asset"); + if (source === undefined) return; + context.assets.set(codeGenerationResult.data.get("filename"), { + source, + info: codeGenerationResult.data.get("assetInfo") + }); + } + ); + } ); } - // These weird types validate that we checked all non-optional properties - const options = - /** @type {Partial & Pick} */ ( - partialOptions - ); +} - return removeOperations( - resolveByProperty(options, "byDependency", dependencyType) - ); -}; +module.exports = AssetModulesPlugin; -/** - * @typedef {Object} ResolverCache - * @property {WeakMap} direct - * @property {Map} stringified - */ -module.exports = class ResolverFactory { - constructor() { - this.hooks = Object.freeze({ - /** @type {HookMap>} */ - resolveOptions: new HookMap( - () => new SyncWaterfallHook(["resolveOptions"]) - ), - /** @type {HookMap>} */ - resolver: new HookMap( - () => new SyncHook(["resolver", "resolveOptions", "userResolveOptions"]) - ) - }); - /** @type {Map} */ - this.cache = new Map(); - } +/***/ }), + +/***/ 91112: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Yuta Hiroto @hiroppy +*/ + + +const Parser = __webpack_require__(11715); + +/** @typedef {import("../../declarations/WebpackOptions").AssetParserOptions} AssetParserOptions */ +/** @typedef {import("../Parser").ParserState} ParserState */ +/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ + +class AssetParser extends Parser { /** - * @param {string} type type of resolver - * @param {ResolveOptionsWithDependencyType=} resolveOptions options - * @returns {ResolverWithOptions} the resolver + * @param {AssetParserOptions["dataUrlCondition"] | boolean} dataUrlCondition condition for inlining as DataUrl */ - get(type, resolveOptions = EMPTY_RESOLVE_OPTIONS) { - let typedCaches = this.cache.get(type); - if (!typedCaches) { - typedCaches = { - direct: new WeakMap(), - stringified: new Map() - }; - this.cache.set(type, typedCaches); - } - const cachedResolver = typedCaches.direct.get(resolveOptions); - if (cachedResolver) { - return cachedResolver; - } - const ident = JSON.stringify(resolveOptions); - const resolver = typedCaches.stringified.get(ident); - if (resolver) { - typedCaches.direct.set(resolveOptions, resolver); - return resolver; - } - const newResolver = this._create(type, resolveOptions); - typedCaches.direct.set(resolveOptions, newResolver); - typedCaches.stringified.set(ident, newResolver); - return newResolver; + constructor(dataUrlCondition) { + super(); + this.dataUrlCondition = dataUrlCondition; } /** - * @param {string} type type of resolver - * @param {ResolveOptionsWithDependencyType} resolveOptionsWithDepType options - * @returns {ResolverWithOptions} the resolver + * @param {string | Buffer | PreparsedAst} source the source to parse + * @param {ParserState} state the parser state + * @returns {ParserState} the parser state */ - _create(type, resolveOptionsWithDepType) { - /** @type {ResolveOptionsWithDependencyType} */ - const originalResolveOptions = { ...resolveOptionsWithDepType }; + parse(source, state) { + if (typeof source === "object" && !Buffer.isBuffer(source)) { + throw new Error("AssetParser doesn't accept preparsed AST"); + } + state.module.buildInfo.strict = true; + state.module.buildMeta.exportsType = "default"; - const resolveOptions = convertToResolveOptions( - this.hooks.resolveOptions.for(type).call(resolveOptionsWithDepType) - ); - const resolver = /** @type {ResolverWithOptions} */ ( - Factory.createResolver(resolveOptions) - ); - if (!resolver) { - throw new Error("No resolver created"); + if (typeof this.dataUrlCondition === "function") { + state.module.buildInfo.dataUrl = this.dataUrlCondition(source, { + filename: state.module.matchResource || state.module.resource, + module: state.module + }); + } else if (typeof this.dataUrlCondition === "boolean") { + state.module.buildInfo.dataUrl = this.dataUrlCondition; + } else if ( + this.dataUrlCondition && + typeof this.dataUrlCondition === "object" + ) { + state.module.buildInfo.dataUrl = + Buffer.byteLength(source) <= this.dataUrlCondition.maxSize; + } else { + throw new Error("Unexpected dataUrlCondition type"); } - /** @type {WeakMap, ResolverWithOptions>} */ - const childCache = new WeakMap(); - resolver.withOptions = options => { - const cacheEntry = childCache.get(options); - if (cacheEntry !== undefined) return cacheEntry; - const mergedOptions = cachedCleverMerge(originalResolveOptions, options); - const resolver = this.get(type, mergedOptions); - childCache.set(options, resolver); - return resolver; - }; - this.hooks.resolver - .for(type) - .call(resolver, resolveOptions, originalResolveOptions); - return resolver; + + return state; } -}; +} + +module.exports = AssetParser; /***/ }), -/***/ 16475: -/***/ (function(__unused_webpack_module, exports) { +/***/ 18749: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Sergey Melyukov @smelukov */ -/** - * the internal require function - */ -exports.require = "__webpack_require__"; - -/** - * access to properties of the internal require function/object - */ -exports.requireScope = "__webpack_require__.*"; +const { RawSource } = __webpack_require__(51255); +const Generator = __webpack_require__(93401); +const RuntimeGlobals = __webpack_require__(16475); -/** - * the internal exports object - */ -exports.exports = "__webpack_exports__"; +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../NormalModule")} NormalModule */ -/** - * top-level this need to be the exports object - */ -exports.thisAsExports = "top-level-this-exports"; +const TYPES = new Set(["javascript"]); -/** - * runtime need to return the exports of the last entry module - */ -exports.returnExportsFromRuntime = "return-exports-from-runtime"; +class AssetSourceGenerator extends Generator { + /** + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code + */ + generate(module, { chunkGraph, runtimeTemplate, runtimeRequirements }) { + runtimeRequirements.add(RuntimeGlobals.module); -/** - * the internal module object - */ -exports.module = "module"; + const originalSource = module.originalSource(); -/** - * the internal module object - */ -exports.moduleId = "module.id"; + if (!originalSource) { + return new RawSource(""); + } -/** - * the internal module object - */ -exports.moduleLoaded = "module.loaded"; + const content = originalSource.source(); -/** - * the bundle public path - */ -exports.publicPath = "__webpack_require__.p"; + let encodedSource; + if (typeof content === "string") { + encodedSource = content; + } else { + encodedSource = content.toString("utf-8"); + } + return new RawSource( + `${RuntimeGlobals.module}.exports = ${JSON.stringify(encodedSource)};` + ); + } -/** - * the module id of the entry point - */ -exports.entryModuleId = "__webpack_require__.s"; + /** + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) + */ + getTypes(module) { + return TYPES; + } -/** - * the module cache - */ -exports.moduleCache = "__webpack_require__.c"; + /** + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module + */ + getSize(module, type) { + const originalSource = module.originalSource(); -/** - * the module functions - */ -exports.moduleFactories = "__webpack_require__.m"; + if (!originalSource) { + return 0; + } -/** - * the module functions, with only write access - */ -exports.moduleFactoriesAddOnly = "__webpack_require__.m (add only)"; + // Example: m.exports="abcd" + return originalSource.size() + 12; + } +} -/** - * the chunk ensure function - */ -exports.ensureChunk = "__webpack_require__.e"; +module.exports = AssetSourceGenerator; -/** - * an object with handlers to ensure a chunk - */ -exports.ensureChunkHandlers = "__webpack_require__.f"; -/** - * a runtime requirement if ensureChunkHandlers should include loading of chunk needed for entries - */ -exports.ensureChunkIncludeEntries = "__webpack_require__.f (include entries)"; +/***/ }), -/** - * the chunk prefetch function - */ -exports.prefetchChunk = "__webpack_require__.E"; +/***/ 30953: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** - * an object with handlers to prefetch a chunk - */ -exports.prefetchChunkHandlers = "__webpack_require__.F"; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Yuta Hiroto @hiroppy +*/ -/** - * the chunk preload function - */ -exports.preloadChunk = "__webpack_require__.G"; -/** - * an object with handlers to preload a chunk - */ -exports.preloadChunkHandlers = "__webpack_require__.H"; -/** - * the exported property define getters function - */ -exports.definePropertyGetters = "__webpack_require__.d"; +const Parser = __webpack_require__(11715); -/** - * define compatibility on export - */ -exports.makeNamespaceObject = "__webpack_require__.r"; +/** @typedef {import("../Parser").ParserState} ParserState */ +/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ -/** - * create a fake namespace object - */ -exports.createFakeNamespaceObject = "__webpack_require__.t"; +class AssetSourceParser extends Parser { + /** + * @param {string | Buffer | PreparsedAst} source the source to parse + * @param {ParserState} state the parser state + * @returns {ParserState} the parser state + */ + parse(source, state) { + if (typeof source === "object" && !Buffer.isBuffer(source)) { + throw new Error("AssetSourceParser doesn't accept preparsed AST"); + } + const { module } = state; + module.buildInfo.strict = true; + module.buildMeta.exportsType = "default"; -/** - * compatibility get default export - */ -exports.compatGetDefaultExport = "__webpack_require__.n"; + return state; + } +} -/** - * harmony module decorator - */ -exports.harmonyModuleDecorator = "__webpack_require__.hmd"; +module.exports = AssetSourceParser; -/** - * node.js module decorator - */ -exports.nodeModuleDecorator = "__webpack_require__.nmd"; -/** - * the webpack hash - */ -exports.getFullHash = "__webpack_require__.h"; +/***/ }), -/** - * an object containing all installed WebAssembly.Instance export objects keyed by module id - */ -exports.wasmInstances = "__webpack_require__.w"; +/***/ 19684: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** - * instantiate a wasm instance from module exports object, id, hash and importsObject - */ -exports.instantiateWasm = "__webpack_require__.v"; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/** - * the uncaught error handler for the webpack runtime - */ -exports.uncaughtErrorHandler = "__webpack_require__.oe"; -/** - * the script nonce - */ -exports.scriptNonce = "__webpack_require__.nc"; -/** - * function to load a script tag. - * Arguments: (url: string, done: (event) => void), key?: string | number, chunkId?: string | number) => void - * done function is called when loading has finished or timeout occurred. - * It will attach to existing script tags with data-webpack == uniqueName + ":" + key or src == url. - */ -exports.loadScript = "__webpack_require__.l"; +const { RawSource } = __webpack_require__(51255); +const Module = __webpack_require__(73208); +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); -/** - * function to promote a string to a TrustedScript using webpack's Trusted - * Types policy - * Arguments: (script: string) => TrustedScript - */ -exports.createScript = "__webpack_require__.ts"; +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ -/** - * function to promote a string to a TrustedScriptURL using webpack's Trusted - * Types policy - * Arguments: (url: string) => TrustedScriptURL - */ -exports.createScriptUrl = "__webpack_require__.tu"; +const TYPES = new Set(["javascript"]); -/** - * function to return webpack's Trusted Types policy - * Arguments: () => TrustedTypePolicy - */ -exports.getTrustedTypesPolicy = "__webpack_require__.tt"; +class RawDataUrlModule extends Module { + /** + * @param {string} url raw url + * @param {string} identifier unique identifier + * @param {string=} readableIdentifier readable identifier + */ + constructor(url, identifier, readableIdentifier) { + super("asset/raw-data-url", null); + this.url = url; + this.urlBuffer = url ? Buffer.from(url) : undefined; + this.identifierStr = identifier || this.url; + this.readableIdentifierStr = readableIdentifier || this.identifierStr; + } -/** - * the chunk name of the chunk with the runtime - */ -exports.chunkName = "__webpack_require__.cn"; - -/** - * the runtime id of the current runtime - */ -exports.runtimeId = "__webpack_require__.j"; - -/** - * the filename of the script part of the chunk - */ -exports.getChunkScriptFilename = "__webpack_require__.u"; - -/** - * the filename of the css part of the chunk - */ -exports.getChunkCssFilename = "__webpack_require__.k"; - -/** - * a flag when a module/chunk/tree has css modules - */ -exports.hasCssModules = "has css modules"; - -/** - * the filename of the script part of the hot update chunk - */ -exports.getChunkUpdateScriptFilename = "__webpack_require__.hu"; - -/** - * the filename of the css part of the hot update chunk - */ -exports.getChunkUpdateCssFilename = "__webpack_require__.hk"; - -/** - * startup signal from runtime - * This will be called when the runtime chunk has been loaded. - */ -exports.startup = "__webpack_require__.x"; - -/** - * @deprecated - * creating a default startup function with the entry modules - */ -exports.startupNoDefault = "__webpack_require__.x (no default handler)"; - -/** - * startup signal from runtime but only used to add logic after the startup - */ -exports.startupOnlyAfter = "__webpack_require__.x (only after)"; - -/** - * startup signal from runtime but only used to add sync logic before the startup - */ -exports.startupOnlyBefore = "__webpack_require__.x (only before)"; - -/** - * global callback functions for installing chunks - */ -exports.chunkCallback = "webpackChunk"; - -/** - * method to startup an entrypoint with needed chunks. - * Signature: (moduleId: Id, chunkIds: Id[]) => any. - * Returns the exports of the module or a Promise - */ -exports.startupEntrypoint = "__webpack_require__.X"; - -/** - * register deferred code, which will run when certain - * chunks are loaded. - * Signature: (chunkIds: Id[], fn: () => any, priority: int >= 0 = 0) => any - * Returned value will be returned directly when all chunks are already loaded - * When (priority & 1) it will wait for all other handlers with lower priority to - * be executed before itself is executed - */ -exports.onChunksLoaded = "__webpack_require__.O"; - -/** - * method to install a chunk that was loaded somehow - * Signature: ({ id, ids, modules, runtime }) => void - */ -exports.externalInstallChunk = "__webpack_require__.C"; - -/** - * interceptor for module executions - */ -exports.interceptModuleExecution = "__webpack_require__.i"; - -/** - * the global object - */ -exports.global = "__webpack_require__.g"; - -/** - * an object with all share scopes - */ -exports.shareScopeMap = "__webpack_require__.S"; - -/** - * The sharing init sequence function (only runs once per share scope). - * Has one argument, the name of the share scope. - * Creates a share scope if not existing - */ -exports.initializeSharing = "__webpack_require__.I"; - -/** - * The current scope when getting a module from a remote - */ -exports.currentRemoteGetScope = "__webpack_require__.R"; - -/** - * the filename of the HMR manifest - */ -exports.getUpdateManifestFilename = "__webpack_require__.hmrF"; - -/** - * function downloading the update manifest - */ -exports.hmrDownloadManifest = "__webpack_require__.hmrM"; - -/** - * array with handler functions to download chunk updates - */ -exports.hmrDownloadUpdateHandlers = "__webpack_require__.hmrC"; - -/** - * object with all hmr module data for all modules - */ -exports.hmrModuleData = "__webpack_require__.hmrD"; - -/** - * array with handler functions when a module should be invalidated - */ -exports.hmrInvalidateModuleHandlers = "__webpack_require__.hmrI"; - -/** - * the prefix for storing state of runtime modules when hmr is enabled - */ -exports.hmrRuntimeStatePrefix = "__webpack_require__.hmrS"; - -/** - * the AMD define function - */ -exports.amdDefine = "__webpack_require__.amdD"; - -/** - * the AMD options - */ -exports.amdOptions = "__webpack_require__.amdO"; - -/** - * the System polyfill object - */ -exports.system = "__webpack_require__.System"; - -/** - * the shorthand for Object.prototype.hasOwnProperty - * using of it decreases the compiled bundle size - */ -exports.hasOwnProperty = "__webpack_require__.o"; - -/** - * the System.register context object - */ -exports.systemContext = "__webpack_require__.y"; - -/** - * the baseURI of current document - */ -exports.baseURI = "__webpack_require__.b"; - -/** - * a RelativeURL class when relative URLs are used - */ -exports.relativeUrl = "__webpack_require__.U"; - -/** - * Creates an async module. The body function must be a async function. - * "module.exports" will be decorated with an AsyncModulePromise. - * The body function will be called. - * To handle async dependencies correctly do this: "([a, b, c] = await handleDependencies([a, b, c]));". - * If "hasAwaitAfterDependencies" is truthy, "handleDependencies()" must be called at the end of the body function. - * Signature: function( - * module: Module, - * body: (handleDependencies: (deps: AsyncModulePromise[]) => Promise & () => void, - * hasAwaitAfterDependencies?: boolean - * ) => void - */ -exports.asyncModule = "__webpack_require__.a"; - - -/***/ }), - -/***/ 16963: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { RawSource } = __webpack_require__(51255); -const OriginalSource = (__webpack_require__(51255).OriginalSource); -const Module = __webpack_require__(73208); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("./RequestShortener")} RequestShortener */ -/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("./WebpackError")} WebpackError */ -/** @typedef {import("./util/Hash")} Hash */ -/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ - -const TYPES = new Set(["runtime"]); - -class RuntimeModule extends Module { /** - * @param {string} name a readable name - * @param {number=} stage an optional stage + * @returns {Set} types available (do not mutate) */ - constructor(name, stage = 0) { - super("runtime"); - this.name = name; - this.stage = stage; - this.buildMeta = {}; - this.buildInfo = {}; - /** @type {Compilation} */ - this.compilation = undefined; - /** @type {Chunk} */ - this.chunk = undefined; - /** @type {ChunkGraph} */ - this.chunkGraph = undefined; - this.fullHash = false; - this.dependentHash = false; - /** @type {string} */ - this._cachedGeneratedCode = undefined; + getSourceTypes() { + return TYPES; } /** - * @param {Compilation} compilation the compilation - * @param {Chunk} chunk the chunk - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {void} + * @returns {string} a unique identifier of the module */ - attach(compilation, chunk, chunkGraph = compilation.chunkGraph) { - this.compilation = compilation; - this.chunk = chunk; - this.chunkGraph = chunkGraph; + identifier() { + return this.identifierStr; } /** - * @returns {string} a unique identifier of the module + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) */ - identifier() { - return `webpack/runtime/${this.name}`; + size(type) { + if (this.url === undefined) this.url = this.urlBuffer.toString(); + return Math.max(1, this.url.length); } /** @@ -60306,7 +58993,7 @@ class RuntimeModule extends Module { * @returns {string} a user readable identifier of the module */ readableIdentifier(requestShortener) { - return `webpack/runtime/${this.name}`; + return requestShortener.shorten(this.readableIdentifierStr); } /** @@ -60315,7 +59002,7 @@ class RuntimeModule extends Module { * @returns {void} */ needBuild(context, callback) { - return callback(null, false); + return callback(null, !this.buildMeta); } /** @@ -60327,128 +59014,147 @@ class RuntimeModule extends Module { * @returns {void} */ build(options, compilation, resolver, fs, callback) { - // do nothing - // should not be called as runtime modules are added later to the compilation + this.buildMeta = {}; + this.buildInfo = { + cacheable: true + }; callback(); } + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration(context) { + if (this.url === undefined) this.url = this.urlBuffer.toString(); + const sources = new Map(); + sources.set( + "javascript", + new RawSource(`module.exports = ${JSON.stringify(this.url)};`) + ); + const data = new Map(); + data.set("url", this.urlBuffer); + const runtimeRequirements = new Set(); + runtimeRequirements.add(RuntimeGlobals.module); + return { sources, runtimeRequirements, data }; + } + /** * @param {Hash} hash the hash used to track dependencies * @param {UpdateHashContext} context context * @returns {void} */ updateHash(hash, context) { - hash.update(this.name); - hash.update(`${this.stage}`); - try { - if (this.fullHash || this.dependentHash) { - // Do not use getGeneratedCode here, because i. e. compilation hash might be not - // ready at this point. We will cache it later instead. - hash.update(this.generate()); - } else { - hash.update(this.getGeneratedCode()); - } - } catch (err) { - hash.update(err.message); - } + hash.update(this.urlBuffer); super.updateHash(hash, context); } - /** - * @returns {Set} types available (do not mutate) - */ - getSourceTypes() { - return TYPES; - } + serialize(context) { + const { write } = context; - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration(context) { - const sources = new Map(); - const generatedCode = this.getGeneratedCode(); - if (generatedCode) { - sources.set( - "runtime", - this.useSourceMap || this.useSimpleSourceMap - ? new OriginalSource(generatedCode, this.identifier()) - : new RawSource(generatedCode) - ); - } - return { - sources, - runtimeRequirements: null - }; + write(this.urlBuffer); + write(this.identifierStr); + write(this.readableIdentifierStr); + + super.serialize(context); } - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - try { - const source = this.getGeneratedCode(); - return source ? source.length : 0; - } catch (e) { - return 0; - } + deserialize(context) { + const { read } = context; + + this.urlBuffer = read(); + this.identifierStr = read(); + this.readableIdentifierStr = read(); + + super.deserialize(context); } +} - /* istanbul ignore next */ +makeSerializable(RawDataUrlModule, "webpack/lib/asset/RawDataUrlModule"); + +module.exports = RawDataUrlModule; + + +/***/ }), + +/***/ 41153: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const InitFragment = __webpack_require__(55870); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ + +/** + * @typedef {GenerateContext} Context + */ +class AwaitDependenciesInitFragment extends InitFragment { /** - * @abstract - * @returns {string} runtime code + * @param {Set} promises the promises that should be awaited */ - generate() { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + constructor(promises) { + super( + undefined, + InitFragment.STAGE_ASYNC_DEPENDENCIES, + 0, + "await-dependencies" + ); + this.promises = promises; } - /** - * @returns {string} runtime code - */ - getGeneratedCode() { - if (this._cachedGeneratedCode) { - return this._cachedGeneratedCode; + merge(other) { + const promises = new Set(other.promises); + for (const p of this.promises) { + promises.add(p); } - return (this._cachedGeneratedCode = this.generate()); + return new AwaitDependenciesInitFragment(promises); } /** - * @returns {boolean} true, if the runtime module should get it's own scope + * @param {Context} context context + * @returns {string|Source} the source code that will be included as initialization code */ - shouldIsolate() { - return true; + getContent({ runtimeRequirements }) { + runtimeRequirements.add(RuntimeGlobals.module); + const promises = this.promises; + if (promises.size === 0) { + return ""; + } + if (promises.size === 1) { + for (const p of promises) { + return Template.asString([ + `var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${p}]);`, + `${p} = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];`, + "" + ]); + } + } + const sepPromises = Array.from(promises).join(", "); + // TODO check if destructuring is supported + return Template.asString([ + `var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${sepPromises}]);`, + `([${sepPromises}] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);`, + "" + ]); } } -/** - * Runtime modules without any dependencies to other runtime modules - */ -RuntimeModule.STAGE_NORMAL = 0; - -/** - * Runtime modules with simple dependencies on other runtime modules - */ -RuntimeModule.STAGE_BASIC = 5; - -/** - * Runtime modules which attach to handlers of other runtime modules - */ -RuntimeModule.STAGE_ATTACH = 10; - -/** - * Runtime modules which trigger actions on bootstrap - */ -RuntimeModule.STAGE_TRIGGER = 20; - -module.exports = RuntimeModule; +module.exports = AwaitDependenciesInitFragment; /***/ }), -/***/ 2307: +/***/ 59498: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -60459,448 +59165,59 @@ module.exports = RuntimeModule; -const RuntimeGlobals = __webpack_require__(16475); -const { getChunkFilenameTemplate } = __webpack_require__(47283); -const RuntimeRequirementsDependency = __webpack_require__(24187); -const JavascriptModulesPlugin = __webpack_require__(89464); -const AsyncModuleRuntimeModule = __webpack_require__(63672); -const AutoPublicPathRuntimeModule = __webpack_require__(66532); -const CompatGetDefaultExportRuntimeModule = __webpack_require__(44793); -const CompatRuntimeModule = __webpack_require__(88234); -const CreateFakeNamespaceObjectRuntimeModule = __webpack_require__(94669); -const CreateScriptRuntimeModule = __webpack_require__(2759); -const CreateScriptUrlRuntimeModule = __webpack_require__(21213); -const DefinePropertyGettersRuntimeModule = __webpack_require__(75481); -const EnsureChunkRuntimeModule = __webpack_require__(71519); -const GetChunkFilenameRuntimeModule = __webpack_require__(34277); -const GetMainFilenameRuntimeModule = __webpack_require__(10029); -const GetTrustedTypesPolicyRuntimeModule = __webpack_require__(38713); -const GlobalRuntimeModule = __webpack_require__(23255); -const HasOwnPropertyRuntimeModule = __webpack_require__(8011); -const LoadScriptRuntimeModule = __webpack_require__(19942); -const MakeNamespaceObjectRuntimeModule = __webpack_require__(65714); -const OnChunksLoadedRuntimeModule = __webpack_require__(44518); -const PublicPathRuntimeModule = __webpack_require__(56030); -const RelativeUrlRuntimeModule = __webpack_require__(4537); -const RuntimeIdRuntimeModule = __webpack_require__(97115); -const SystemContextRuntimeModule = __webpack_require__(80655); -const ShareRuntimeModule = __webpack_require__(96066); -const StringXor = __webpack_require__(40293); +const HarmonyImportDependency = __webpack_require__(57154); -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Module")} Module */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ -const GLOBALS_ON_REQUIRE = [ - RuntimeGlobals.chunkName, - RuntimeGlobals.runtimeId, - RuntimeGlobals.compatGetDefaultExport, - RuntimeGlobals.createFakeNamespaceObject, - RuntimeGlobals.createScript, - RuntimeGlobals.createScriptUrl, - RuntimeGlobals.getTrustedTypesPolicy, - RuntimeGlobals.definePropertyGetters, - RuntimeGlobals.ensureChunk, - RuntimeGlobals.entryModuleId, - RuntimeGlobals.getFullHash, - RuntimeGlobals.global, - RuntimeGlobals.makeNamespaceObject, - RuntimeGlobals.moduleCache, - RuntimeGlobals.moduleFactories, - RuntimeGlobals.moduleFactoriesAddOnly, - RuntimeGlobals.interceptModuleExecution, - RuntimeGlobals.publicPath, - RuntimeGlobals.baseURI, - RuntimeGlobals.relativeUrl, - RuntimeGlobals.scriptNonce, - RuntimeGlobals.uncaughtErrorHandler, - RuntimeGlobals.asyncModule, - RuntimeGlobals.wasmInstances, - RuntimeGlobals.instantiateWasm, - RuntimeGlobals.shareScopeMap, - RuntimeGlobals.initializeSharing, - RuntimeGlobals.loadScript, - RuntimeGlobals.systemContext, - RuntimeGlobals.onChunksLoaded -]; - -const MODULE_DEPENDENCIES = { - [RuntimeGlobals.moduleLoaded]: [RuntimeGlobals.module], - [RuntimeGlobals.moduleId]: [RuntimeGlobals.module] -}; - -const TREE_DEPENDENCIES = { - [RuntimeGlobals.definePropertyGetters]: [RuntimeGlobals.hasOwnProperty], - [RuntimeGlobals.compatGetDefaultExport]: [ - RuntimeGlobals.definePropertyGetters - ], - [RuntimeGlobals.createFakeNamespaceObject]: [ - RuntimeGlobals.definePropertyGetters, - RuntimeGlobals.makeNamespaceObject, - RuntimeGlobals.require - ], - [RuntimeGlobals.initializeSharing]: [RuntimeGlobals.shareScopeMap], - [RuntimeGlobals.shareScopeMap]: [RuntimeGlobals.hasOwnProperty] -}; - -class RuntimePlugin { +class InferAsyncModulesPlugin { /** - * @param {Compiler} compiler the Compiler + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap("RuntimePlugin", compilation => { - compilation.dependencyTemplates.set( - RuntimeRequirementsDependency, - new RuntimeRequirementsDependency.Template() - ); - for (const req of GLOBALS_ON_REQUIRE) { - compilation.hooks.runtimeRequirementInModule - .for(req) - .tap("RuntimePlugin", (module, set) => { - set.add(RuntimeGlobals.requireScope); - }); - compilation.hooks.runtimeRequirementInTree - .for(req) - .tap("RuntimePlugin", (module, set) => { - set.add(RuntimeGlobals.requireScope); - }); - } - for (const req of Object.keys(TREE_DEPENDENCIES)) { - const deps = TREE_DEPENDENCIES[req]; - compilation.hooks.runtimeRequirementInTree - .for(req) - .tap("RuntimePlugin", (chunk, set) => { - for (const dep of deps) set.add(dep); - }); - } - for (const req of Object.keys(MODULE_DEPENDENCIES)) { - const deps = MODULE_DEPENDENCIES[req]; - compilation.hooks.runtimeRequirementInModule - .for(req) - .tap("RuntimePlugin", (chunk, set) => { - for (const dep of deps) set.add(dep); - }); - } - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.definePropertyGetters) - .tap("RuntimePlugin", chunk => { - compilation.addRuntimeModule( - chunk, - new DefinePropertyGettersRuntimeModule() - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.makeNamespaceObject) - .tap("RuntimePlugin", chunk => { - compilation.addRuntimeModule( - chunk, - new MakeNamespaceObjectRuntimeModule() - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.createFakeNamespaceObject) - .tap("RuntimePlugin", chunk => { - compilation.addRuntimeModule( - chunk, - new CreateFakeNamespaceObjectRuntimeModule() - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hasOwnProperty) - .tap("RuntimePlugin", chunk => { - compilation.addRuntimeModule( - chunk, - new HasOwnPropertyRuntimeModule() - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.compatGetDefaultExport) - .tap("RuntimePlugin", chunk => { - compilation.addRuntimeModule( - chunk, - new CompatGetDefaultExportRuntimeModule() - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.runtimeId) - .tap("RuntimePlugin", chunk => { - compilation.addRuntimeModule(chunk, new RuntimeIdRuntimeModule()); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.publicPath) - .tap("RuntimePlugin", (chunk, set) => { - const { outputOptions } = compilation; - const { publicPath: globalPublicPath, scriptType } = outputOptions; - const entryOptions = chunk.getEntryOptions(); - const publicPath = - entryOptions && entryOptions.publicPath !== undefined - ? entryOptions.publicPath - : globalPublicPath; - - if (publicPath === "auto") { - const module = new AutoPublicPathRuntimeModule(); - if (scriptType !== "module") set.add(RuntimeGlobals.global); - compilation.addRuntimeModule(chunk, module); - } else { - const module = new PublicPathRuntimeModule(publicPath); - - if ( - typeof publicPath !== "string" || - /\[(full)?hash\]/.test(publicPath) - ) { - module.fullHash = true; + compiler.hooks.compilation.tap("InferAsyncModulesPlugin", compilation => { + const { moduleGraph } = compilation; + compilation.hooks.finishModules.tap( + "InferAsyncModulesPlugin", + modules => { + /** @type {Set} */ + const queue = new Set(); + for (const module of modules) { + if (module.buildMeta && module.buildMeta.async) { + queue.add(module); } - - compilation.addRuntimeModule(chunk, module); - } - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.global) - .tap("RuntimePlugin", chunk => { - compilation.addRuntimeModule(chunk, new GlobalRuntimeModule()); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.asyncModule) - .tap("RuntimePlugin", chunk => { - compilation.addRuntimeModule(chunk, new AsyncModuleRuntimeModule()); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.systemContext) - .tap("RuntimePlugin", chunk => { - const { outputOptions } = compilation; - const { library: globalLibrary } = outputOptions; - const entryOptions = chunk.getEntryOptions(); - const libraryType = - entryOptions && entryOptions.library !== undefined - ? entryOptions.library.type - : globalLibrary.type; - - if (libraryType === "system") { - compilation.addRuntimeModule( - chunk, - new SystemContextRuntimeModule() - ); - } - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.getChunkScriptFilename) - .tap("RuntimePlugin", (chunk, set) => { - if ( - typeof compilation.outputOptions.chunkFilename === "string" && - /\[(full)?hash(:\d+)?\]/.test( - compilation.outputOptions.chunkFilename - ) - ) { - set.add(RuntimeGlobals.getFullHash); - } - compilation.addRuntimeModule( - chunk, - new GetChunkFilenameRuntimeModule( - "javascript", - "javascript", - RuntimeGlobals.getChunkScriptFilename, - chunk => - chunk.filenameTemplate || - (chunk.canBeInitial() - ? compilation.outputOptions.filename - : compilation.outputOptions.chunkFilename), - false - ) - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.getChunkCssFilename) - .tap("RuntimePlugin", (chunk, set) => { - if ( - typeof compilation.outputOptions.cssChunkFilename === "string" && - /\[(full)?hash(:\d+)?\]/.test( - compilation.outputOptions.cssChunkFilename - ) - ) { - set.add(RuntimeGlobals.getFullHash); - } - compilation.addRuntimeModule( - chunk, - new GetChunkFilenameRuntimeModule( - "css", - "css", - RuntimeGlobals.getChunkCssFilename, - chunk => - getChunkFilenameTemplate(chunk, compilation.outputOptions), - set.has(RuntimeGlobals.hmrDownloadUpdateHandlers) - ) - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.getChunkUpdateScriptFilename) - .tap("RuntimePlugin", (chunk, set) => { - if ( - /\[(full)?hash(:\d+)?\]/.test( - compilation.outputOptions.hotUpdateChunkFilename - ) - ) - set.add(RuntimeGlobals.getFullHash); - compilation.addRuntimeModule( - chunk, - new GetChunkFilenameRuntimeModule( - "javascript", - "javascript update", - RuntimeGlobals.getChunkUpdateScriptFilename, - c => compilation.outputOptions.hotUpdateChunkFilename, - true - ) - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.getUpdateManifestFilename) - .tap("RuntimePlugin", (chunk, set) => { - if ( - /\[(full)?hash(:\d+)?\]/.test( - compilation.outputOptions.hotUpdateMainFilename - ) - ) { - set.add(RuntimeGlobals.getFullHash); - } - compilation.addRuntimeModule( - chunk, - new GetMainFilenameRuntimeModule( - "update manifest", - RuntimeGlobals.getUpdateManifestFilename, - compilation.outputOptions.hotUpdateMainFilename - ) - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunk) - .tap("RuntimePlugin", (chunk, set) => { - const hasAsyncChunks = chunk.hasAsyncChunks(); - if (hasAsyncChunks) { - set.add(RuntimeGlobals.ensureChunkHandlers); - } - compilation.addRuntimeModule( - chunk, - new EnsureChunkRuntimeModule(set) - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkIncludeEntries) - .tap("RuntimePlugin", (chunk, set) => { - set.add(RuntimeGlobals.ensureChunkHandlers); - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.shareScopeMap) - .tap("RuntimePlugin", (chunk, set) => { - compilation.addRuntimeModule(chunk, new ShareRuntimeModule()); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.loadScript) - .tap("RuntimePlugin", (chunk, set) => { - const withCreateScriptUrl = !!compilation.outputOptions.trustedTypes; - if (withCreateScriptUrl) { - set.add(RuntimeGlobals.createScriptUrl); - } - compilation.addRuntimeModule( - chunk, - new LoadScriptRuntimeModule(withCreateScriptUrl) - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.createScript) - .tap("RuntimePlugin", (chunk, set) => { - if (compilation.outputOptions.trustedTypes) { - set.add(RuntimeGlobals.getTrustedTypesPolicy); - } - compilation.addRuntimeModule(chunk, new CreateScriptRuntimeModule()); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.createScriptUrl) - .tap("RuntimePlugin", (chunk, set) => { - if (compilation.outputOptions.trustedTypes) { - set.add(RuntimeGlobals.getTrustedTypesPolicy); - } - compilation.addRuntimeModule( - chunk, - new CreateScriptUrlRuntimeModule() - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.getTrustedTypesPolicy) - .tap("RuntimePlugin", (chunk, set) => { - compilation.addRuntimeModule( - chunk, - new GetTrustedTypesPolicyRuntimeModule(set) - ); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.relativeUrl) - .tap("RuntimePlugin", (chunk, set) => { - compilation.addRuntimeModule(chunk, new RelativeUrlRuntimeModule()); - return true; - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.onChunksLoaded) - .tap("RuntimePlugin", (chunk, set) => { - compilation.addRuntimeModule( - chunk, - new OnChunksLoadedRuntimeModule() - ); - return true; - }); - // TODO webpack 6: remove CompatRuntimeModule - compilation.hooks.additionalTreeRuntimeRequirements.tap( - "RuntimePlugin", - (chunk, set) => { - const { mainTemplate } = compilation; - if ( - mainTemplate.hooks.bootstrap.isUsed() || - mainTemplate.hooks.localVars.isUsed() || - mainTemplate.hooks.requireEnsure.isUsed() || - mainTemplate.hooks.requireExtensions.isUsed() - ) { - compilation.addRuntimeModule(chunk, new CompatRuntimeModule()); } - } - ); - JavascriptModulesPlugin.getCompilationHooks(compilation).chunkHash.tap( - "RuntimePlugin", - (chunk, hash, { chunkGraph }) => { - const xor = new StringXor(); - for (const m of chunkGraph.getChunkRuntimeModulesIterable(chunk)) { - xor.add(chunkGraph.getModuleHash(m, chunk.runtime)); + for (const module of queue) { + moduleGraph.setAsync(module); + for (const [ + originModule, + connections + ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { + if ( + connections.some( + c => + c.dependency instanceof HarmonyImportDependency && + c.isTargetActive(undefined) + ) + ) { + queue.add(originModule); + } + } } - xor.updateHash(hash); } ); }); } } -module.exports = RuntimePlugin; + +module.exports = InferAsyncModulesPlugin; /***/ }), -/***/ 18777: +/***/ 79233: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -60911,1125 +59228,1406 @@ module.exports = RuntimePlugin; -const InitFragment = __webpack_require__(55870); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const { equals } = __webpack_require__(84953); -const compileBooleanMatcher = __webpack_require__(29404); -const propertyAccess = __webpack_require__(54190); -const { forEachRuntime, subtractRuntime } = __webpack_require__(17156); +const AsyncDependencyToInitialChunkError = __webpack_require__(30111); +const { connectChunkGroupParentAndChild } = __webpack_require__(37234); +const ModuleGraphConnection = __webpack_require__(40639); +const { getEntryRuntime, mergeRuntime } = __webpack_require__(17156); -/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */ /** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ +/** @typedef {import("./Chunk")} Chunk */ +/** @typedef {import("./ChunkGroup")} ChunkGroup */ /** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ /** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./Entrypoint")} Entrypoint */ /** @typedef {import("./Module")} Module */ /** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("./logging/Logger").Logger} Logger */ /** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ /** - * @param {Module} module the module - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {string} error message + * @typedef {Object} QueueItem + * @property {number} action + * @property {DependenciesBlock} block + * @property {Module} module + * @property {Chunk} chunk + * @property {ChunkGroup} chunkGroup + * @property {ChunkGroupInfo} chunkGroupInfo */ -const noModuleIdErrorMessage = (module, chunkGraph) => { - return `Module ${module.identifier()} has no id assigned. -This should not happen. -It's in these chunks: ${ - Array.from( - chunkGraph.getModuleChunksIterable(module), - c => c.name || c.id || c.debugId - ).join(", ") || "none" - } (If module is in no chunk this indicates a bug in some chunk/module optimization logic) -Module has these incoming connections: ${Array.from( - chunkGraph.moduleGraph.getIncomingConnections(module), - connection => - `\n - ${ - connection.originModule && connection.originModule.identifier() - } ${connection.dependency && connection.dependency.type} ${ - (connection.explanations && - Array.from(connection.explanations).join(", ")) || - "" - }` - ).join("")}`; -}; + +/** @typedef {Set & { plus: Set }} ModuleSetPlus */ /** - * @param {string|undefined} definition global object definition - * @returns {string} save to use global object + * @typedef {Object} ChunkGroupInfo + * @property {ChunkGroup} chunkGroup the chunk group + * @property {RuntimeSpec} runtime the runtimes + * @property {ModuleSetPlus} minAvailableModules current minimal set of modules available at this point + * @property {boolean} minAvailableModulesOwned true, if minAvailableModules is owned and can be modified + * @property {ModuleSetPlus[]} availableModulesToBeMerged enqueued updates to the minimal set of available modules + * @property {Set=} skippedItems modules that were skipped because module is already available in parent chunks (need to reconsider when minAvailableModules is shrinking) + * @property {Set<[Module, ConnectionState]>=} skippedModuleConnections referenced modules that where skipped because they were not active in this runtime + * @property {ModuleSetPlus} resultingAvailableModules set of modules available including modules from this chunk group + * @property {Set} children set of children chunk groups, that will be revisited when availableModules shrink + * @property {Set} availableSources set of chunk groups that are the source for minAvailableModules + * @property {Set} availableChildren set of chunk groups which depend on the this chunk group as availableSource + * @property {number} preOrderIndex next pre order index + * @property {number} postOrderIndex next post order index + * @property {boolean} chunkLoading has a chunk loading mechanism + * @property {boolean} asyncChunks create async chunks */ -function getGlobalObject(definition) { - if (!definition) return definition; - const trimmed = definition.trim(); - if ( - // identifier, we do not need real identifier regarding ECMAScript/Unicode - trimmed.match(/^[_\p{L}][_0-9\p{L}]*$/iu) || - // iife - // call expression - // expression in parentheses - trimmed.match(/^([_\p{L}][_0-9\p{L}]*)?\(.*\)$/iu) - ) - return trimmed; +/** + * @typedef {Object} BlockChunkGroupConnection + * @property {ChunkGroupInfo} originChunkGroupInfo origin chunk group + * @property {ChunkGroup} chunkGroup referenced chunk group + */ - return `Object(${trimmed})`; -} +const EMPTY_SET = /** @type {ModuleSetPlus} */ (new Set()); +EMPTY_SET.plus = EMPTY_SET; -class RuntimeTemplate { - /** - * @param {Compilation} compilation the compilation - * @param {OutputOptions} outputOptions the compilation output options - * @param {RequestShortener} requestShortener the request shortener - */ - constructor(compilation, outputOptions, requestShortener) { - this.compilation = compilation; - this.outputOptions = outputOptions || {}; - this.requestShortener = requestShortener; - this.globalObject = getGlobalObject(outputOptions.globalObject); - } - - isIIFE() { - return this.outputOptions.iife; - } +/** + * @param {ModuleSetPlus} a first set + * @param {ModuleSetPlus} b second set + * @returns {number} cmp + */ +const bySetSize = (a, b) => { + return b.size + b.plus.size - a.size - a.plus.size; +}; - isModule() { - return this.outputOptions.module; - } +const extractBlockModules = (module, moduleGraph, runtime, blockModulesMap) => { + let blockCache; + let modules; - supportsConst() { - return this.outputOptions.environment.const; - } + const arrays = []; - supportsArrowFunction() { - return this.outputOptions.environment.arrowFunction; + const queue = [module]; + while (queue.length > 0) { + const block = queue.pop(); + const arr = []; + arrays.push(arr); + blockModulesMap.set(block, arr); + for (const b of block.blocks) { + queue.push(b); + } } - supportsOptionalChaining() { - return this.outputOptions.environment.optionalChaining; - } + for (const connection of moduleGraph.getOutgoingConnections(module)) { + const d = connection.dependency; + // We skip connections without dependency + if (!d) continue; + const m = connection.module; + // We skip connections without Module pointer + if (!m) continue; + // We skip weak connections + if (connection.weak) continue; + const state = connection.getActiveState(runtime); + // We skip inactive connections + if (state === false) continue; - supportsForOf() { - return this.outputOptions.environment.forOf; - } + const block = moduleGraph.getParentBlock(d); + let index = moduleGraph.getParentBlockIndex(d); - supportsDestructuring() { - return this.outputOptions.environment.destructuring; - } + // deprecated fallback + if (index < 0) { + index = block.dependencies.indexOf(d); + } - supportsBigIntLiteral() { - return this.outputOptions.environment.bigIntLiteral; - } + if (blockCache !== block) { + modules = blockModulesMap.get((blockCache = block)); + } - supportsDynamicImport() { - return this.outputOptions.environment.dynamicImport; + const i = index << 2; + modules[i] = m; + modules[i + 1] = state; } - supportsEcmaScriptModuleSyntax() { - return this.outputOptions.environment.module; + for (const modules of arrays) { + if (modules.length === 0) continue; + let indexMap; + let length = 0; + outer: for (let j = 0; j < modules.length; j += 2) { + const m = modules[j]; + if (m === undefined) continue; + const state = modules[j + 1]; + if (indexMap === undefined) { + let i = 0; + for (; i < length; i += 2) { + if (modules[i] === m) { + const merged = modules[i + 1]; + if (merged === true) continue outer; + modules[i + 1] = ModuleGraphConnection.addConnectionStates( + merged, + state + ); + } + } + modules[length] = m; + length++; + modules[length] = state; + length++; + if (length > 30) { + // To avoid worse case performance, we will use an index map for + // linear cost access, which allows to maintain O(n) complexity + // while keeping allocations down to a minimum + indexMap = new Map(); + for (let i = 0; i < length; i += 2) { + indexMap.set(modules[i], i + 1); + } + } + } else { + const idx = indexMap.get(m); + if (idx !== undefined) { + const merged = modules[idx]; + if (merged === true) continue outer; + modules[idx] = ModuleGraphConnection.addConnectionStates( + merged, + state + ); + } else { + modules[length] = m; + length++; + modules[length] = state; + indexMap.set(m, length); + length++; + } + } + } + modules.length = length; } +}; - supportTemplateLiteral() { - return this.outputOptions.environment.templateLiteral; - } +/** + * + * @param {Logger} logger a logger + * @param {Compilation} compilation the compilation + * @param {Map} inputEntrypointsAndModules chunk groups which are processed with the modules + * @param {Map} chunkGroupInfoMap mapping from chunk group to available modules + * @param {Map} blockConnections connection for blocks + * @param {Set} blocksWithNestedBlocks flag for blocks that have nested blocks + * @param {Set} allCreatedChunkGroups filled with all chunk groups that are created here + */ +const visitModules = ( + logger, + compilation, + inputEntrypointsAndModules, + chunkGroupInfoMap, + blockConnections, + blocksWithNestedBlocks, + allCreatedChunkGroups +) => { + const { moduleGraph, chunkGraph, moduleMemCaches } = compilation; - returningFunction(returnValue, args = "") { - return this.supportsArrowFunction() - ? `(${args}) => (${returnValue})` - : `function(${args}) { return ${returnValue}; }`; - } + const blockModulesRuntimeMap = new Map(); - basicFunction(args, body) { - return this.supportsArrowFunction() - ? `(${args}) => {\n${Template.indent(body)}\n}` - : `function(${args}) {\n${Template.indent(body)}\n}`; - } + /** @type {RuntimeSpec | false} */ + let blockModulesMapRuntime = false; + let blockModulesMap; /** - * @param {Array} args args - * @returns {string} result expression + * + * @param {DependenciesBlock} block block + * @param {RuntimeSpec} runtime runtime + * @returns {(Module | ConnectionState)[]} block modules in flatten tuples */ - concatenation(...args) { - const len = args.length; - - if (len === 2) return this._es5Concatenation(args); - if (len === 0) return '""'; - if (len === 1) { - return typeof args[0] === "string" - ? JSON.stringify(args[0]) - : `"" + ${args[0].expr}`; - } - if (!this.supportTemplateLiteral()) return this._es5Concatenation(args); - - // cost comparison between template literal and concatenation: - // both need equal surroundings: `xxx` vs "xxx" - // template literal has constant cost of 3 chars for each expression - // es5 concatenation has cost of 3 + n chars for n expressions in row - // when a es5 concatenation ends with an expression it reduces cost by 3 - // when a es5 concatenation starts with an single expression it reduces cost by 3 - // e. g. `${a}${b}${c}` (3*3 = 9) is longer than ""+a+b+c ((3+3)-3 = 3) - // e. g. `x${a}x${b}x${c}x` (3*3 = 9) is shorter than "x"+a+"x"+b+"x"+c+"x" (4+4+4 = 12) - - let templateCost = 0; - let concatenationCost = 0; - - let lastWasExpr = false; - for (const arg of args) { - const isExpr = typeof arg !== "string"; - if (isExpr) { - templateCost += 3; - concatenationCost += lastWasExpr ? 1 : 4; + const getBlockModules = (block, runtime) => { + if (blockModulesMapRuntime !== runtime) { + blockModulesMap = blockModulesRuntimeMap.get(runtime); + if (blockModulesMap === undefined) { + blockModulesMap = new Map(); + blockModulesRuntimeMap.set(runtime, blockModulesMap); } - lastWasExpr = isExpr; } - if (lastWasExpr) concatenationCost -= 3; - if (typeof args[0] !== "string" && typeof args[1] === "string") - concatenationCost -= 3; - - if (concatenationCost <= templateCost) return this._es5Concatenation(args); - - return `\`${args - .map(arg => (typeof arg === "string" ? arg : `\${${arg.expr}}`)) - .join("")}\``; - } + let blockModules = blockModulesMap.get(block); + if (blockModules !== undefined) return blockModules; + const module = /** @type {Module} */ (block.getRootBlock()); + const memCache = moduleMemCaches && moduleMemCaches.get(module); + if (memCache !== undefined) { + const map = memCache.provide( + "bundleChunkGraph.blockModules", + runtime, + () => { + logger.time("visitModules: prepare"); + const map = new Map(); + extractBlockModules(module, moduleGraph, runtime, map); + logger.timeAggregate("visitModules: prepare"); + return map; + } + ); + for (const [block, blockModules] of map) + blockModulesMap.set(block, blockModules); + return map.get(block); + } else { + logger.time("visitModules: prepare"); + extractBlockModules(module, moduleGraph, runtime, blockModulesMap); + blockModules = blockModulesMap.get(block); + logger.timeAggregate("visitModules: prepare"); + return blockModules; + } + }; - /** - * @param {Array} args args (len >= 2) - * @returns {string} result expression - * @private - */ - _es5Concatenation(args) { - const str = args - .map(arg => (typeof arg === "string" ? JSON.stringify(arg) : arg.expr)) - .join(" + "); + let statProcessedQueueItems = 0; + let statProcessedBlocks = 0; + let statConnectedChunkGroups = 0; + let statProcessedChunkGroupsForMerging = 0; + let statMergedAvailableModuleSets = 0; + let statForkedAvailableModules = 0; + let statForkedAvailableModulesCount = 0; + let statForkedAvailableModulesCountPlus = 0; + let statForkedMergedModulesCount = 0; + let statForkedMergedModulesCountPlus = 0; + let statForkedResultModulesCount = 0; + let statChunkGroupInfoUpdated = 0; + let statChildChunkGroupsReconnected = 0; - // when the first two args are expression, we need to prepend "" + to force string - // concatenation instead of number addition. - return typeof args[0] !== "string" && typeof args[1] !== "string" - ? `"" + ${str}` - : str; - } + let nextChunkGroupIndex = 0; + let nextFreeModulePreOrderIndex = 0; + let nextFreeModulePostOrderIndex = 0; - expressionFunction(expression, args = "") { - return this.supportsArrowFunction() - ? `(${args}) => (${expression})` - : `function(${args}) { ${expression}; }`; - } + /** @type {Map} */ + const blockChunkGroups = new Map(); - emptyFunction() { - return this.supportsArrowFunction() ? "x => {}" : "function() {}"; - } + /** @type {Map} */ + const namedChunkGroups = new Map(); - destructureArray(items, value) { - return this.supportsDestructuring() - ? `var [${items.join(", ")}] = ${value};` - : Template.asString( - items.map((item, i) => `var ${item} = ${value}[${i}];`) - ); - } + /** @type {Map} */ + const namedAsyncEntrypoints = new Map(); - destructureObject(items, value) { - return this.supportsDestructuring() - ? `var {${items.join(", ")}} = ${value};` - : Template.asString( - items.map(item => `var ${item} = ${value}${propertyAccess([item])};`) - ); - } + const ADD_AND_ENTER_ENTRY_MODULE = 0; + const ADD_AND_ENTER_MODULE = 1; + const ENTER_MODULE = 2; + const PROCESS_BLOCK = 3; + const PROCESS_ENTRY_BLOCK = 4; + const LEAVE_MODULE = 5; - iife(args, body) { - return `(${this.basicFunction(args, body)})()`; - } + /** @type {QueueItem[]} */ + let queue = []; - forEach(variable, array, body) { - return this.supportsForOf() - ? `for(const ${variable} of ${array}) {\n${Template.indent(body)}\n}` - : `${array}.forEach(function(${variable}) {\n${Template.indent( - body - )}\n});`; - } + /** @type {Map>} */ + const queueConnect = new Map(); + /** @type {Set} */ + const chunkGroupsForCombining = new Set(); - /** - * Add a comment - * @param {object} options Information content of the comment - * @param {string=} options.request request string used originally - * @param {string=} options.chunkName name of the chunk referenced - * @param {string=} options.chunkReason reason information of the chunk - * @param {string=} options.message additional message - * @param {string=} options.exportName name of the export - * @returns {string} comment - */ - comment({ request, chunkName, chunkReason, message, exportName }) { - let content; - if (this.outputOptions.pathinfo) { - content = [message, request, chunkName, chunkReason] - .filter(Boolean) - .map(item => this.requestShortener.shorten(item)) - .join(" | "); + // Fill queue with entrypoint modules + // Create ChunkGroupInfo for entrypoints + for (const [chunkGroup, modules] of inputEntrypointsAndModules) { + const runtime = getEntryRuntime( + compilation, + chunkGroup.name, + chunkGroup.options + ); + /** @type {ChunkGroupInfo} */ + const chunkGroupInfo = { + chunkGroup, + runtime, + minAvailableModules: undefined, + minAvailableModulesOwned: false, + availableModulesToBeMerged: [], + skippedItems: undefined, + resultingAvailableModules: undefined, + children: undefined, + availableSources: undefined, + availableChildren: undefined, + preOrderIndex: 0, + postOrderIndex: 0, + chunkLoading: + chunkGroup.options.chunkLoading !== undefined + ? chunkGroup.options.chunkLoading !== false + : compilation.outputOptions.chunkLoading !== false, + asyncChunks: + chunkGroup.options.asyncChunks !== undefined + ? chunkGroup.options.asyncChunks + : compilation.outputOptions.asyncChunks !== false + }; + chunkGroup.index = nextChunkGroupIndex++; + if (chunkGroup.getNumberOfParents() > 0) { + // minAvailableModules for child entrypoints are unknown yet, set to undefined. + // This means no module is added until other sets are merged into + // this minAvailableModules (by the parent entrypoints) + const skippedItems = new Set(); + for (const module of modules) { + skippedItems.add(module); + } + chunkGroupInfo.skippedItems = skippedItems; + chunkGroupsForCombining.add(chunkGroupInfo); } else { - content = [message, chunkName, chunkReason] - .filter(Boolean) - .map(item => this.requestShortener.shorten(item)) - .join(" | "); + // The application may start here: We start with an empty list of available modules + chunkGroupInfo.minAvailableModules = EMPTY_SET; + const chunk = chunkGroup.getEntrypointChunk(); + for (const module of modules) { + queue.push({ + action: ADD_AND_ENTER_MODULE, + block: module, + module, + chunk, + chunkGroup, + chunkGroupInfo + }); + } } - if (!content) return ""; - if (this.outputOptions.pathinfo) { - return Template.toComment(content) + " "; - } else { - return Template.toNormalComment(content) + " "; + chunkGroupInfoMap.set(chunkGroup, chunkGroupInfo); + if (chunkGroup.name) { + namedChunkGroups.set(chunkGroup.name, chunkGroupInfo); } } - - /** - * @param {object} options generation options - * @param {string=} options.request request string used originally - * @returns {string} generated error block - */ - throwMissingModuleErrorBlock({ request }) { - const err = `Cannot find module '${request}'`; - return `var e = new Error(${JSON.stringify( - err - )}); e.code = 'MODULE_NOT_FOUND'; throw e;`; - } - - /** - * @param {object} options generation options - * @param {string=} options.request request string used originally - * @returns {string} generated error function - */ - throwMissingModuleErrorFunction({ request }) { - return `function webpackMissingModule() { ${this.throwMissingModuleErrorBlock( - { request } - )} }`; + // Fill availableSources with parent-child dependencies between entrypoints + for (const chunkGroupInfo of chunkGroupsForCombining) { + const { chunkGroup } = chunkGroupInfo; + chunkGroupInfo.availableSources = new Set(); + for (const parent of chunkGroup.parentsIterable) { + const parentChunkGroupInfo = chunkGroupInfoMap.get(parent); + chunkGroupInfo.availableSources.add(parentChunkGroupInfo); + if (parentChunkGroupInfo.availableChildren === undefined) { + parentChunkGroupInfo.availableChildren = new Set(); + } + parentChunkGroupInfo.availableChildren.add(chunkGroupInfo); + } } + // pop() is used to read from the queue + // so it need to be reversed to be iterated in + // correct order + queue.reverse(); - /** - * @param {object} options generation options - * @param {string=} options.request request string used originally - * @returns {string} generated error IIFE - */ - missingModule({ request }) { - return `Object(${this.throwMissingModuleErrorFunction({ request })}())`; - } + /** @type {Set} */ + const outdatedChunkGroupInfo = new Set(); + /** @type {Set} */ + const chunkGroupsForMerging = new Set(); + /** @type {QueueItem[]} */ + let queueDelayed = []; - /** - * @param {object} options generation options - * @param {string=} options.request request string used originally - * @returns {string} generated error statement - */ - missingModuleStatement({ request }) { - return `${this.missingModule({ request })};\n`; - } + /** @type {[Module, ConnectionState][]} */ + const skipConnectionBuffer = []; + /** @type {Module[]} */ + const skipBuffer = []; + /** @type {QueueItem[]} */ + const queueBuffer = []; - /** - * @param {object} options generation options - * @param {string=} options.request request string used originally - * @returns {string} generated error code - */ - missingModulePromise({ request }) { - return `Promise.resolve().then(${this.throwMissingModuleErrorFunction({ - request - })})`; - } + /** @type {Module} */ + let module; + /** @type {Chunk} */ + let chunk; + /** @type {ChunkGroup} */ + let chunkGroup; + /** @type {DependenciesBlock} */ + let block; + /** @type {ChunkGroupInfo} */ + let chunkGroupInfo; + // For each async Block in graph /** - * @param {Object} options options object - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {Module} options.module the module - * @param {string} options.request the request that should be printed as comment - * @param {string=} options.idExpr expression to use as id expression - * @param {"expression" | "promise" | "statements"} options.type which kind of code should be returned - * @returns {string} the code + * @param {AsyncDependenciesBlock} b iterating over each Async DepBlock + * @returns {void} */ - weakError({ module, chunkGraph, request, idExpr, type }) { - const moduleId = chunkGraph.getModuleId(module); - const errorMessage = - moduleId === null - ? JSON.stringify("Module is not available (weak dependency)") - : idExpr - ? `"Module '" + ${idExpr} + "' is not available (weak dependency)"` - : JSON.stringify( - `Module '${moduleId}' is not available (weak dependency)` - ); - const comment = request ? Template.toNormalComment(request) + " " : ""; - const errorStatements = - `var e = new Error(${errorMessage}); ` + - comment + - "e.code = 'MODULE_NOT_FOUND'; throw e;"; - switch (type) { - case "statements": - return errorStatements; - case "promise": - return `Promise.resolve().then(${this.basicFunction( - "", - errorStatements - )})`; - case "expression": - return this.iife("", errorStatements); - } - } + const iteratorBlock = b => { + // 1. We create a chunk group with single chunk in it for this Block + // but only once (blockChunkGroups map) + let cgi = blockChunkGroups.get(b); + /** @type {ChunkGroup} */ + let c; + /** @type {Entrypoint} */ + let entrypoint; + const entryOptions = b.groupOptions && b.groupOptions.entryOptions; + if (cgi === undefined) { + const chunkName = (b.groupOptions && b.groupOptions.name) || b.chunkName; + if (entryOptions) { + cgi = namedAsyncEntrypoints.get(chunkName); + if (!cgi) { + entrypoint = compilation.addAsyncEntrypoint( + entryOptions, + module, + b.loc, + b.request + ); + entrypoint.index = nextChunkGroupIndex++; + cgi = { + chunkGroup: entrypoint, + runtime: entrypoint.options.runtime || entrypoint.name, + minAvailableModules: EMPTY_SET, + minAvailableModulesOwned: false, + availableModulesToBeMerged: [], + skippedItems: undefined, + resultingAvailableModules: undefined, + children: undefined, + availableSources: undefined, + availableChildren: undefined, + preOrderIndex: 0, + postOrderIndex: 0, + chunkLoading: + entryOptions.chunkLoading !== undefined + ? entryOptions.chunkLoading !== false + : chunkGroupInfo.chunkLoading, + asyncChunks: + entryOptions.asyncChunks !== undefined + ? entryOptions.asyncChunks + : chunkGroupInfo.asyncChunks + }; + chunkGroupInfoMap.set(entrypoint, cgi); - /** - * @param {Object} options options object - * @param {Module} options.module the module - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {string} options.request the request that should be printed as comment - * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) - * @returns {string} the expression - */ - moduleId({ module, chunkGraph, request, weak }) { - if (!module) { - return this.missingModule({ - request - }); - } - const moduleId = chunkGraph.getModuleId(module); - if (moduleId === null) { - if (weak) { - return "null /* weak dependency, without id */"; + chunkGraph.connectBlockAndChunkGroup(b, entrypoint); + if (chunkName) { + namedAsyncEntrypoints.set(chunkName, cgi); + } + } else { + entrypoint = /** @type {Entrypoint} */ (cgi.chunkGroup); + // TODO merge entryOptions + entrypoint.addOrigin(module, b.loc, b.request); + chunkGraph.connectBlockAndChunkGroup(b, entrypoint); + } + + // 2. We enqueue the DependenciesBlock for traversal + queueDelayed.push({ + action: PROCESS_ENTRY_BLOCK, + block: b, + module: module, + chunk: entrypoint.chunks[0], + chunkGroup: entrypoint, + chunkGroupInfo: cgi + }); + } else if (!chunkGroupInfo.asyncChunks || !chunkGroupInfo.chunkLoading) { + // Just queue the block into the current chunk group + queue.push({ + action: PROCESS_BLOCK, + block: b, + module: module, + chunk, + chunkGroup, + chunkGroupInfo + }); + } else { + cgi = chunkName && namedChunkGroups.get(chunkName); + if (!cgi) { + c = compilation.addChunkInGroup( + b.groupOptions || b.chunkName, + module, + b.loc, + b.request + ); + c.index = nextChunkGroupIndex++; + cgi = { + chunkGroup: c, + runtime: chunkGroupInfo.runtime, + minAvailableModules: undefined, + minAvailableModulesOwned: undefined, + availableModulesToBeMerged: [], + skippedItems: undefined, + resultingAvailableModules: undefined, + children: undefined, + availableSources: undefined, + availableChildren: undefined, + preOrderIndex: 0, + postOrderIndex: 0, + chunkLoading: chunkGroupInfo.chunkLoading, + asyncChunks: chunkGroupInfo.asyncChunks + }; + allCreatedChunkGroups.add(c); + chunkGroupInfoMap.set(c, cgi); + if (chunkName) { + namedChunkGroups.set(chunkName, cgi); + } + } else { + c = cgi.chunkGroup; + if (c.isInitial()) { + compilation.errors.push( + new AsyncDependencyToInitialChunkError(chunkName, module, b.loc) + ); + c = chunkGroup; + } + c.addOptions(b.groupOptions); + c.addOrigin(module, b.loc, b.request); + } + blockConnections.set(b, []); } - throw new Error( - `RuntimeTemplate.moduleId(): ${noModuleIdErrorMessage( - module, - chunkGraph - )}` - ); + blockChunkGroups.set(b, cgi); + } else if (entryOptions) { + entrypoint = /** @type {Entrypoint} */ (cgi.chunkGroup); + } else { + c = cgi.chunkGroup; } - return `${this.comment({ request })}${JSON.stringify(moduleId)}`; - } - /** - * @param {Object} options options object - * @param {Module} options.module the module - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {string} options.request the request that should be printed as comment - * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @returns {string} the expression - */ - moduleRaw({ module, chunkGraph, request, weak, runtimeRequirements }) { - if (!module) { - return this.missingModule({ - request + if (c !== undefined) { + // 2. We store the connection for the block + // to connect it later if needed + blockConnections.get(b).push({ + originChunkGroupInfo: chunkGroupInfo, + chunkGroup: c }); - } - const moduleId = chunkGraph.getModuleId(module); - if (moduleId === null) { - if (weak) { - // only weak referenced modules don't get an id - // we can always emit an error emitting code here - return this.weakError({ - module, - chunkGraph, - request, - type: "expression" - }); + + // 3. We enqueue the chunk group info creation/updating + let connectList = queueConnect.get(chunkGroupInfo); + if (connectList === undefined) { + connectList = new Set(); + queueConnect.set(chunkGroupInfo, connectList); } - throw new Error( - `RuntimeTemplate.moduleId(): ${noModuleIdErrorMessage( - module, - chunkGraph - )}` - ); + connectList.add(cgi); + + // TODO check if this really need to be done for each traversal + // or if it is enough when it's queued when created + // 4. We enqueue the DependenciesBlock for traversal + queueDelayed.push({ + action: PROCESS_BLOCK, + block: b, + module: module, + chunk: c.chunks[0], + chunkGroup: c, + chunkGroupInfo: cgi + }); + } else if (entrypoint !== undefined) { + chunkGroupInfo.chunkGroup.addAsyncEntrypoint(entrypoint); } - runtimeRequirements.add(RuntimeGlobals.require); - return `__webpack_require__(${this.moduleId({ - module, - chunkGraph, - request, - weak - })})`; - } + }; /** - * @param {Object} options options object - * @param {Module} options.module the module - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {string} options.request the request that should be printed as comment - * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @returns {string} the expression + * @param {DependenciesBlock} block the block + * @returns {void} */ - moduleExports({ module, chunkGraph, request, weak, runtimeRequirements }) { - return this.moduleRaw({ - module, - chunkGraph, - request, - weak, - runtimeRequirements - }); - } + const processBlock = block => { + statProcessedBlocks++; + // get prepared block info + const blockModules = getBlockModules(block, chunkGroupInfo.runtime); - /** - * @param {Object} options options object - * @param {Module} options.module the module - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {string} options.request the request that should be printed as comment - * @param {boolean=} options.strict if the current module is in strict esm mode - * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @returns {string} the expression - */ - moduleNamespace({ - module, - chunkGraph, - request, - strict, - weak, - runtimeRequirements - }) { - if (!module) { - return this.missingModule({ - request - }); - } - if (chunkGraph.getModuleId(module) === null) { - if (weak) { - // only weak referenced modules don't get an id - // we can always emit an error emitting code here - return this.weakError({ - module, - chunkGraph, - request, - type: "expression" + if (blockModules !== undefined) { + const { minAvailableModules } = chunkGroupInfo; + // Buffer items because order need to be reversed to get indices correct + // Traverse all referenced modules + for (let i = 0; i < blockModules.length; i += 2) { + const refModule = /** @type {Module} */ (blockModules[i]); + if (chunkGraph.isModuleInChunk(refModule, chunk)) { + // skip early if already connected + continue; + } + const activeState = /** @type {ConnectionState} */ ( + blockModules[i + 1] + ); + if (activeState !== true) { + skipConnectionBuffer.push([refModule, activeState]); + if (activeState === false) continue; + } + if ( + activeState === true && + (minAvailableModules.has(refModule) || + minAvailableModules.plus.has(refModule)) + ) { + // already in parent chunks, skip it for now + skipBuffer.push(refModule); + continue; + } + // enqueue, then add and enter to be in the correct order + // this is relevant with circular dependencies + queueBuffer.push({ + action: activeState === true ? ADD_AND_ENTER_MODULE : PROCESS_BLOCK, + block: refModule, + module: refModule, + chunk, + chunkGroup, + chunkGroupInfo }); } - throw new Error( - `RuntimeTemplate.moduleNamespace(): ${noModuleIdErrorMessage( - module, - chunkGraph - )}` - ); + // Add buffered items in reverse order + if (skipConnectionBuffer.length > 0) { + let { skippedModuleConnections } = chunkGroupInfo; + if (skippedModuleConnections === undefined) { + chunkGroupInfo.skippedModuleConnections = skippedModuleConnections = + new Set(); + } + for (let i = skipConnectionBuffer.length - 1; i >= 0; i--) { + skippedModuleConnections.add(skipConnectionBuffer[i]); + } + skipConnectionBuffer.length = 0; + } + if (skipBuffer.length > 0) { + let { skippedItems } = chunkGroupInfo; + if (skippedItems === undefined) { + chunkGroupInfo.skippedItems = skippedItems = new Set(); + } + for (let i = skipBuffer.length - 1; i >= 0; i--) { + skippedItems.add(skipBuffer[i]); + } + skipBuffer.length = 0; + } + if (queueBuffer.length > 0) { + for (let i = queueBuffer.length - 1; i >= 0; i--) { + queue.push(queueBuffer[i]); + } + queueBuffer.length = 0; + } } - const moduleId = this.moduleId({ - module, - chunkGraph, - request, - weak - }); - const exportsType = module.getExportsType(chunkGraph.moduleGraph, strict); - switch (exportsType) { - case "namespace": - return this.moduleRaw({ - module, - chunkGraph, - request, - weak, - runtimeRequirements - }); - case "default-with-named": - runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); - return `${RuntimeGlobals.createFakeNamespaceObject}(${moduleId}, 3)`; - case "default-only": - runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); - return `${RuntimeGlobals.createFakeNamespaceObject}(${moduleId}, 1)`; - case "dynamic": - runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); - return `${RuntimeGlobals.createFakeNamespaceObject}(${moduleId}, 7)`; + + // Traverse all Blocks + for (const b of block.blocks) { + iteratorBlock(b); } - } + + if (block.blocks.length > 0 && module !== block) { + blocksWithNestedBlocks.add(block); + } + }; /** - * @param {Object} options options object - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {AsyncDependenciesBlock=} options.block the current dependencies block - * @param {Module} options.module the module - * @param {string} options.request the request that should be printed as comment - * @param {string} options.message a message for the comment - * @param {boolean=} options.strict if the current module is in strict esm mode - * @param {boolean=} options.weak if the dependency is weak (will create a nice error message) - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @returns {string} the promise expression + * @param {DependenciesBlock} block the block + * @returns {void} */ - moduleNamespacePromise({ - chunkGraph, - block, - module, - request, - message, - strict, - weak, - runtimeRequirements - }) { - if (!module) { - return this.missingModulePromise({ - request - }); - } - const moduleId = chunkGraph.getModuleId(module); - if (moduleId === null) { - if (weak) { - // only weak referenced modules don't get an id - // we can always emit an error emitting code here - return this.weakError({ - module, - chunkGraph, - request, - type: "promise" + const processEntryBlock = block => { + statProcessedBlocks++; + // get prepared block info + const blockModules = getBlockModules(block, chunkGroupInfo.runtime); + + if (blockModules !== undefined) { + // Traverse all referenced modules + for (let i = 0; i < blockModules.length; i += 2) { + const refModule = /** @type {Module} */ (blockModules[i]); + const activeState = /** @type {ConnectionState} */ ( + blockModules[i + 1] + ); + // enqueue, then add and enter to be in the correct order + // this is relevant with circular dependencies + queueBuffer.push({ + action: + activeState === true ? ADD_AND_ENTER_ENTRY_MODULE : PROCESS_BLOCK, + block: refModule, + module: refModule, + chunk, + chunkGroup, + chunkGroupInfo }); } - throw new Error( - `RuntimeTemplate.moduleNamespacePromise(): ${noModuleIdErrorMessage( - module, - chunkGraph - )}` - ); + // Add buffered items in reverse order + if (queueBuffer.length > 0) { + for (let i = queueBuffer.length - 1; i >= 0; i--) { + queue.push(queueBuffer[i]); + } + queueBuffer.length = 0; + } } - const promise = this.blockPromise({ - chunkGraph, - block, - message, - runtimeRequirements - }); - let appending; - let idExpr = JSON.stringify(chunkGraph.getModuleId(module)); - const comment = this.comment({ - request - }); - let header = ""; - if (weak) { - if (idExpr.length > 8) { - // 'var x="nnnnnn";x,"+x+",x' vs '"nnnnnn",nnnnnn,"nnnnnn"' - header += `var id = ${idExpr}; `; - idExpr = "id"; - } - runtimeRequirements.add(RuntimeGlobals.moduleFactories); - header += `if(!${ - RuntimeGlobals.moduleFactories - }[${idExpr}]) { ${this.weakError({ - module, - chunkGraph, - request, - idExpr, - type: "statements" - })} } `; + // Traverse all Blocks + for (const b of block.blocks) { + iteratorBlock(b); } - const moduleIdExpr = this.moduleId({ - module, - chunkGraph, - request, - weak - }); - const exportsType = module.getExportsType(chunkGraph.moduleGraph, strict); - let fakeType = 16; - switch (exportsType) { - case "namespace": - if (header) { - const rawModule = this.moduleRaw({ + + if (block.blocks.length > 0 && module !== block) { + blocksWithNestedBlocks.add(block); + } + }; + + const processQueue = () => { + while (queue.length) { + statProcessedQueueItems++; + const queueItem = queue.pop(); + module = queueItem.module; + block = queueItem.block; + chunk = queueItem.chunk; + chunkGroup = queueItem.chunkGroup; + chunkGroupInfo = queueItem.chunkGroupInfo; + + switch (queueItem.action) { + case ADD_AND_ENTER_ENTRY_MODULE: + chunkGraph.connectChunkAndEntryModule( + chunk, module, - chunkGraph, - request, - weak, - runtimeRequirements - }); - appending = `.then(${this.basicFunction( - "", - `${header}return ${rawModule};` - )})`; - } else { - runtimeRequirements.add(RuntimeGlobals.require); - appending = `.then(__webpack_require__.bind(__webpack_require__, ${comment}${idExpr}))`; + /** @type {Entrypoint} */ (chunkGroup) + ); + // fallthrough + case ADD_AND_ENTER_MODULE: { + if (chunkGraph.isModuleInChunk(module, chunk)) { + // already connected, skip it + break; + } + // We connect Module and Chunk + chunkGraph.connectChunkAndModule(chunk, module); } - break; - case "dynamic": - fakeType |= 4; - /* fall through */ - case "default-with-named": - fakeType |= 2; - /* fall through */ - case "default-only": - runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); - if (chunkGraph.moduleGraph.isAsync(module)) { - if (header) { - const rawModule = this.moduleRaw({ + // fallthrough + case ENTER_MODULE: { + const index = chunkGroup.getModulePreOrderIndex(module); + if (index === undefined) { + chunkGroup.setModulePreOrderIndex( module, - chunkGraph, - request, - weak, - runtimeRequirements - }); - appending = `.then(${this.basicFunction( - "", - `${header}return ${rawModule};` - )})`; - } else { - runtimeRequirements.add(RuntimeGlobals.require); - appending = `.then(__webpack_require__.bind(__webpack_require__, ${comment}${idExpr}))`; + chunkGroupInfo.preOrderIndex++ + ); } - appending += `.then(${this.returningFunction( - `${RuntimeGlobals.createFakeNamespaceObject}(m, ${fakeType})`, - "m" - )})`; - } else { - fakeType |= 1; - if (header) { - const returnExpression = `${RuntimeGlobals.createFakeNamespaceObject}(${moduleIdExpr}, ${fakeType})`; - appending = `.then(${this.basicFunction( - "", - `${header}return ${returnExpression};` - )})`; - } else { - appending = `.then(${RuntimeGlobals.createFakeNamespaceObject}.bind(__webpack_require__, ${comment}${idExpr}, ${fakeType}))`; + + if ( + moduleGraph.setPreOrderIndexIfUnset( + module, + nextFreeModulePreOrderIndex + ) + ) { + nextFreeModulePreOrderIndex++; } + + // reuse queueItem + queueItem.action = LEAVE_MODULE; + queue.push(queueItem); } - break; + // fallthrough + case PROCESS_BLOCK: { + processBlock(block); + break; + } + case PROCESS_ENTRY_BLOCK: { + processEntryBlock(block); + break; + } + case LEAVE_MODULE: { + const index = chunkGroup.getModulePostOrderIndex(module); + if (index === undefined) { + chunkGroup.setModulePostOrderIndex( + module, + chunkGroupInfo.postOrderIndex++ + ); + } + + if ( + moduleGraph.setPostOrderIndexIfUnset( + module, + nextFreeModulePostOrderIndex + ) + ) { + nextFreeModulePostOrderIndex++; + } + break; + } + } } + }; - return `${promise || "Promise.resolve()"}${appending}`; - } + const calculateResultingAvailableModules = chunkGroupInfo => { + if (chunkGroupInfo.resultingAvailableModules) + return chunkGroupInfo.resultingAvailableModules; - /** - * @param {Object} options options object - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {RuntimeSpec=} options.runtime runtime for which this code will be generated - * @param {RuntimeSpec | boolean=} options.runtimeCondition only execute the statement in some runtimes - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @returns {string} expression - */ - runtimeConditionExpression({ - chunkGraph, - runtimeCondition, - runtime, - runtimeRequirements - }) { - if (runtimeCondition === undefined) return "true"; - if (typeof runtimeCondition === "boolean") return `${runtimeCondition}`; - /** @type {Set} */ - const positiveRuntimeIds = new Set(); - forEachRuntime(runtimeCondition, runtime => - positiveRuntimeIds.add(`${chunkGraph.getRuntimeId(runtime)}`) - ); - /** @type {Set} */ - const negativeRuntimeIds = new Set(); - forEachRuntime(subtractRuntime(runtime, runtimeCondition), runtime => - negativeRuntimeIds.add(`${chunkGraph.getRuntimeId(runtime)}`) - ); - runtimeRequirements.add(RuntimeGlobals.runtimeId); - return compileBooleanMatcher.fromLists( - Array.from(positiveRuntimeIds), - Array.from(negativeRuntimeIds) - )(RuntimeGlobals.runtimeId); - } + const minAvailableModules = chunkGroupInfo.minAvailableModules; - /** - * - * @param {Object} options options object - * @param {boolean=} options.update whether a new variable should be created or the existing one updated - * @param {Module} options.module the module - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {string} options.request the request that should be printed as comment - * @param {string} options.importVar name of the import variable - * @param {Module} options.originModule module in which the statement is emitted - * @param {boolean=} options.weak true, if this is a weak dependency - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @returns {[string, string]} the import statement and the compat statement - */ - importStatement({ - update, - module, - chunkGraph, - request, - importVar, - originModule, - weak, - runtimeRequirements - }) { - if (!module) { - return [ - this.missingModuleStatement({ - request - }), - "" - ]; + // Create a new Set of available modules at this point + // We want to be as lazy as possible. There are multiple ways doing this: + // Note that resultingAvailableModules is stored as "(a) + (b)" as it's a ModuleSetPlus + // - resultingAvailableModules = (modules of chunk) + (minAvailableModules + minAvailableModules.plus) + // - resultingAvailableModules = (minAvailableModules + modules of chunk) + (minAvailableModules.plus) + // We choose one depending on the size of minAvailableModules vs minAvailableModules.plus + + let resultingAvailableModules; + if (minAvailableModules.size > minAvailableModules.plus.size) { + // resultingAvailableModules = (modules of chunk) + (minAvailableModules + minAvailableModules.plus) + resultingAvailableModules = + /** @type {Set & {plus: Set}} */ (new Set()); + for (const module of minAvailableModules.plus) + minAvailableModules.add(module); + minAvailableModules.plus = EMPTY_SET; + resultingAvailableModules.plus = minAvailableModules; + chunkGroupInfo.minAvailableModulesOwned = false; + } else { + // resultingAvailableModules = (minAvailableModules + modules of chunk) + (minAvailableModules.plus) + resultingAvailableModules = + /** @type {Set & {plus: Set}} */ ( + new Set(minAvailableModules) + ); + resultingAvailableModules.plus = minAvailableModules.plus; } - if (chunkGraph.getModuleId(module) === null) { - if (weak) { - // only weak referenced modules don't get an id - // we can always emit an error emitting code here - return [ - this.weakError({ - module, - chunkGraph, - request, - type: "statements" - }), - "" - ]; + + // add the modules from the chunk group to the set + for (const chunk of chunkGroupInfo.chunkGroup.chunks) { + for (const m of chunkGraph.getChunkModulesIterable(chunk)) { + resultingAvailableModules.add(m); } - throw new Error( - `RuntimeTemplate.importStatement(): ${noModuleIdErrorMessage( - module, - chunkGraph - )}` - ); } - const moduleId = this.moduleId({ - module, - chunkGraph, - request, - weak - }); - const optDeclaration = update ? "" : "var "; + return (chunkGroupInfo.resultingAvailableModules = + resultingAvailableModules); + }; - const exportsType = module.getExportsType( - chunkGraph.moduleGraph, - originModule.buildMeta.strictHarmonyModule - ); - runtimeRequirements.add(RuntimeGlobals.require); - const importContent = `/* harmony import */ ${optDeclaration}${importVar} = __webpack_require__(${moduleId});\n`; + const processConnectQueue = () => { + // Figure out new parents for chunk groups + // to get new available modules for these children + for (const [chunkGroupInfo, targets] of queueConnect) { + // 1. Add new targets to the list of children + if (chunkGroupInfo.children === undefined) { + chunkGroupInfo.children = targets; + } else { + for (const target of targets) { + chunkGroupInfo.children.add(target); + } + } - if (exportsType === "dynamic") { - runtimeRequirements.add(RuntimeGlobals.compatGetDefaultExport); - return [ - importContent, - `/* harmony import */ ${optDeclaration}${importVar}_default = /*#__PURE__*/${RuntimeGlobals.compatGetDefaultExport}(${importVar});\n` - ]; - } - return [importContent, ""]; - } + // 2. Calculate resulting available modules + const resultingAvailableModules = + calculateResultingAvailableModules(chunkGroupInfo); - /** - * @param {Object} options options - * @param {ModuleGraph} options.moduleGraph the module graph - * @param {Module} options.module the module - * @param {string} options.request the request - * @param {string | string[]} options.exportName the export name - * @param {Module} options.originModule the origin module - * @param {boolean|undefined} options.asiSafe true, if location is safe for ASI, a bracket can be emitted - * @param {boolean} options.isCall true, if expression will be called - * @param {boolean} options.callContext when false, call context will not be preserved - * @param {boolean} options.defaultInterop when true and accessing the default exports, interop code will be generated - * @param {string} options.importVar the identifier name of the import variable - * @param {InitFragment[]} options.initFragments init fragments will be added here - * @param {RuntimeSpec} options.runtime runtime for which this code will be generated - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @returns {string} expression - */ - exportFromImport({ - moduleGraph, - module, - request, - exportName, - originModule, - asiSafe, - isCall, - callContext, - defaultInterop, - importVar, - initFragments, - runtime, - runtimeRequirements - }) { - if (!module) { - return this.missingModule({ - request - }); - } - if (!Array.isArray(exportName)) { - exportName = exportName ? [exportName] : []; - } - const exportsType = module.getExportsType( - moduleGraph, - originModule.buildMeta.strictHarmonyModule - ); + const runtime = chunkGroupInfo.runtime; - if (defaultInterop) { - if (exportName.length > 0 && exportName[0] === "default") { - switch (exportsType) { - case "dynamic": - if (isCall) { - return `${importVar}_default()${propertyAccess(exportName, 1)}`; - } else { - return asiSafe - ? `(${importVar}_default()${propertyAccess(exportName, 1)})` - : asiSafe === false - ? `;(${importVar}_default()${propertyAccess(exportName, 1)})` - : `${importVar}_default.a${propertyAccess(exportName, 1)}`; - } - case "default-only": - case "default-with-named": - exportName = exportName.slice(1); - break; - } - } else if (exportName.length > 0) { - if (exportsType === "default-only") { - return ( - "/* non-default import from non-esm module */undefined" + - propertyAccess(exportName, 1) - ); - } else if ( - exportsType !== "namespace" && - exportName[0] === "__esModule" - ) { - return "/* __esModule */true"; + // 3. Update chunk group info + for (const target of targets) { + target.availableModulesToBeMerged.push(resultingAvailableModules); + chunkGroupsForMerging.add(target); + const oldRuntime = target.runtime; + const newRuntime = mergeRuntime(oldRuntime, runtime); + if (oldRuntime !== newRuntime) { + target.runtime = newRuntime; + outdatedChunkGroupInfo.add(target); } - } else if ( - exportsType === "default-only" || - exportsType === "default-with-named" - ) { - runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); - initFragments.push( - new InitFragment( - `var ${importVar}_namespace_cache;\n`, - InitFragment.STAGE_CONSTANTS, - -1, - `${importVar}_namespace_cache` - ) - ); - return `/*#__PURE__*/ ${ - asiSafe ? "" : asiSafe === false ? ";" : "Object" - }(${importVar}_namespace_cache || (${importVar}_namespace_cache = ${ - RuntimeGlobals.createFakeNamespaceObject - }(${importVar}${exportsType === "default-only" ? "" : ", 2"})))`; } - } - if (exportName.length > 0) { - const exportsInfo = moduleGraph.getExportsInfo(module); - const used = exportsInfo.getUsedName(exportName, runtime); - if (!used) { - const comment = Template.toNormalComment( - `unused export ${propertyAccess(exportName)}` - ); - return `${comment} undefined`; - } - const comment = equals(used, exportName) - ? "" - : Template.toNormalComment(propertyAccess(exportName)) + " "; - const access = `${importVar}${comment}${propertyAccess(used)}`; - if (isCall && callContext === false) { - return asiSafe - ? `(0,${access})` - : asiSafe === false - ? `;(0,${access})` - : `/*#__PURE__*/Object(${access})`; - } - return access; - } else { - return importVar; + statConnectedChunkGroups += targets.size; } - } + queueConnect.clear(); + }; - /** - * @param {Object} options options - * @param {AsyncDependenciesBlock} options.block the async block - * @param {string} options.message the message - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @returns {string} expression - */ - blockPromise({ block, message, chunkGraph, runtimeRequirements }) { - if (!block) { - const comment = this.comment({ - message - }); - return `Promise.resolve(${comment.trim()})`; - } - const chunkGroup = chunkGraph.getBlockChunkGroup(block); - if (!chunkGroup || chunkGroup.chunks.length === 0) { - const comment = this.comment({ - message - }); - return `Promise.resolve(${comment.trim()})`; - } - const chunks = chunkGroup.chunks.filter( - chunk => !chunk.hasRuntime() && chunk.id !== null - ); - const comment = this.comment({ - message, - chunkName: block.chunkName - }); - if (chunks.length === 1) { - const chunkId = JSON.stringify(chunks[0].id); - runtimeRequirements.add(RuntimeGlobals.ensureChunk); - return `${RuntimeGlobals.ensureChunk}(${comment}${chunkId})`; - } else if (chunks.length > 0) { - runtimeRequirements.add(RuntimeGlobals.ensureChunk); - const requireChunkId = chunk => - `${RuntimeGlobals.ensureChunk}(${JSON.stringify(chunk.id)})`; - return `Promise.all(${comment.trim()}[${chunks - .map(requireChunkId) - .join(", ")}])`; - } else { - return `Promise.resolve(${comment.trim()})`; - } - } + const processChunkGroupsForMerging = () => { + statProcessedChunkGroupsForMerging += chunkGroupsForMerging.size; - /** - * @param {Object} options options - * @param {AsyncDependenciesBlock} options.block the async block - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @param {string=} options.request request string used originally - * @returns {string} expression - */ - asyncModuleFactory({ block, chunkGraph, runtimeRequirements, request }) { - const dep = block.dependencies[0]; - const module = chunkGraph.moduleGraph.getModule(dep); - const ensureChunk = this.blockPromise({ - block, - message: "", - chunkGraph, - runtimeRequirements - }); - const factory = this.returningFunction( - this.moduleRaw({ - module, - chunkGraph, - request, - runtimeRequirements - }) - ); - return this.returningFunction( - ensureChunk.startsWith("Promise.resolve(") - ? `${factory}` - : `${ensureChunk}.then(${this.returningFunction(factory)})` - ); - } + // Execute the merge + for (const info of chunkGroupsForMerging) { + const availableModulesToBeMerged = info.availableModulesToBeMerged; + let cachedMinAvailableModules = info.minAvailableModules; - /** - * @param {Object} options options - * @param {Dependency} options.dependency the dependency - * @param {ChunkGraph} options.chunkGraph the chunk graph - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @param {string=} options.request request string used originally - * @returns {string} expression - */ - syncModuleFactory({ dependency, chunkGraph, runtimeRequirements, request }) { - const module = chunkGraph.moduleGraph.getModule(dependency); - const factory = this.returningFunction( - this.moduleRaw({ - module, - chunkGraph, - request, - runtimeRequirements - }) - ); - return this.returningFunction(factory); - } - - /** - * @param {Object} options options - * @param {string} options.exportsArgument the name of the exports object - * @param {Set} options.runtimeRequirements if set, will be filled with runtime requirements - * @returns {string} statement - */ - defineEsModuleFlagStatement({ exportsArgument, runtimeRequirements }) { - runtimeRequirements.add(RuntimeGlobals.makeNamespaceObject); - runtimeRequirements.add(RuntimeGlobals.exports); - return `${RuntimeGlobals.makeNamespaceObject}(${exportsArgument});\n`; - } + statMergedAvailableModuleSets += availableModulesToBeMerged.length; - /** - * @param {Object} options options object - * @param {Module} options.module the module - * @param {string} options.publicPath the public path - * @param {RuntimeSpec=} options.runtime runtime - * @param {CodeGenerationResults} options.codeGenerationResults the code generation results - * @returns {string} the url of the asset - */ - assetUrl({ publicPath, runtime, module, codeGenerationResults }) { - if (!module) { - return "data:,"; + // 1. Get minimal available modules + // It doesn't make sense to traverse a chunk again with more available modules. + // This step calculates the minimal available modules and skips traversal when + // the list didn't shrink. + if (availableModulesToBeMerged.length > 1) { + availableModulesToBeMerged.sort(bySetSize); + } + let changed = false; + merge: for (const availableModules of availableModulesToBeMerged) { + if (cachedMinAvailableModules === undefined) { + cachedMinAvailableModules = availableModules; + info.minAvailableModules = cachedMinAvailableModules; + info.minAvailableModulesOwned = false; + changed = true; + } else { + if (info.minAvailableModulesOwned) { + // We own it and can modify it + if (cachedMinAvailableModules.plus === availableModules.plus) { + for (const m of cachedMinAvailableModules) { + if (!availableModules.has(m)) { + cachedMinAvailableModules.delete(m); + changed = true; + } + } + } else { + for (const m of cachedMinAvailableModules) { + if (!availableModules.has(m) && !availableModules.plus.has(m)) { + cachedMinAvailableModules.delete(m); + changed = true; + } + } + for (const m of cachedMinAvailableModules.plus) { + if (!availableModules.has(m) && !availableModules.plus.has(m)) { + // We can't remove modules from the plus part + // so we need to merge plus into the normal part to allow modifying it + const iterator = + cachedMinAvailableModules.plus[Symbol.iterator](); + // fast forward add all modules until m + /** @type {IteratorResult} */ + let it; + while (!(it = iterator.next()).done) { + const module = it.value; + if (module === m) break; + cachedMinAvailableModules.add(module); + } + // check the remaining modules before adding + while (!(it = iterator.next()).done) { + const module = it.value; + if ( + availableModules.has(module) || + availableModules.plus.has(module) + ) { + cachedMinAvailableModules.add(module); + } + } + cachedMinAvailableModules.plus = EMPTY_SET; + changed = true; + continue merge; + } + } + } + } else if (cachedMinAvailableModules.plus === availableModules.plus) { + // Common and fast case when the plus part is shared + // We only need to care about the normal part + if (availableModules.size < cachedMinAvailableModules.size) { + // the new availableModules is smaller so it's faster to + // fork from the new availableModules + statForkedAvailableModules++; + statForkedAvailableModulesCount += availableModules.size; + statForkedMergedModulesCount += cachedMinAvailableModules.size; + // construct a new Set as intersection of cachedMinAvailableModules and availableModules + const newSet = /** @type {ModuleSetPlus} */ (new Set()); + newSet.plus = availableModules.plus; + for (const m of availableModules) { + if (cachedMinAvailableModules.has(m)) { + newSet.add(m); + } + } + statForkedResultModulesCount += newSet.size; + cachedMinAvailableModules = newSet; + info.minAvailableModulesOwned = true; + info.minAvailableModules = newSet; + changed = true; + continue merge; + } + for (const m of cachedMinAvailableModules) { + if (!availableModules.has(m)) { + // cachedMinAvailableModules need to be modified + // but we don't own it + statForkedAvailableModules++; + statForkedAvailableModulesCount += + cachedMinAvailableModules.size; + statForkedMergedModulesCount += availableModules.size; + // construct a new Set as intersection of cachedMinAvailableModules and availableModules + // as the plus part is equal we can just take over this one + const newSet = /** @type {ModuleSetPlus} */ (new Set()); + newSet.plus = availableModules.plus; + const iterator = cachedMinAvailableModules[Symbol.iterator](); + // fast forward add all modules until m + /** @type {IteratorResult} */ + let it; + while (!(it = iterator.next()).done) { + const module = it.value; + if (module === m) break; + newSet.add(module); + } + // check the remaining modules before adding + while (!(it = iterator.next()).done) { + const module = it.value; + if (availableModules.has(module)) { + newSet.add(module); + } + } + statForkedResultModulesCount += newSet.size; + cachedMinAvailableModules = newSet; + info.minAvailableModulesOwned = true; + info.minAvailableModules = newSet; + changed = true; + continue merge; + } + } + } else { + for (const m of cachedMinAvailableModules) { + if (!availableModules.has(m) && !availableModules.plus.has(m)) { + // cachedMinAvailableModules need to be modified + // but we don't own it + statForkedAvailableModules++; + statForkedAvailableModulesCount += + cachedMinAvailableModules.size; + statForkedAvailableModulesCountPlus += + cachedMinAvailableModules.plus.size; + statForkedMergedModulesCount += availableModules.size; + statForkedMergedModulesCountPlus += availableModules.plus.size; + // construct a new Set as intersection of cachedMinAvailableModules and availableModules + const newSet = /** @type {ModuleSetPlus} */ (new Set()); + newSet.plus = EMPTY_SET; + const iterator = cachedMinAvailableModules[Symbol.iterator](); + // fast forward add all modules until m + /** @type {IteratorResult} */ + let it; + while (!(it = iterator.next()).done) { + const module = it.value; + if (module === m) break; + newSet.add(module); + } + // check the remaining modules before adding + while (!(it = iterator.next()).done) { + const module = it.value; + if ( + availableModules.has(module) || + availableModules.plus.has(module) + ) { + newSet.add(module); + } + } + // also check all modules in cachedMinAvailableModules.plus + for (const module of cachedMinAvailableModules.plus) { + if ( + availableModules.has(module) || + availableModules.plus.has(module) + ) { + newSet.add(module); + } + } + statForkedResultModulesCount += newSet.size; + cachedMinAvailableModules = newSet; + info.minAvailableModulesOwned = true; + info.minAvailableModules = newSet; + changed = true; + continue merge; + } + } + for (const m of cachedMinAvailableModules.plus) { + if (!availableModules.has(m) && !availableModules.plus.has(m)) { + // cachedMinAvailableModules need to be modified + // but we don't own it + statForkedAvailableModules++; + statForkedAvailableModulesCount += + cachedMinAvailableModules.size; + statForkedAvailableModulesCountPlus += + cachedMinAvailableModules.plus.size; + statForkedMergedModulesCount += availableModules.size; + statForkedMergedModulesCountPlus += availableModules.plus.size; + // construct a new Set as intersection of cachedMinAvailableModules and availableModules + // we already know that all modules directly from cachedMinAvailableModules are in availableModules too + const newSet = /** @type {ModuleSetPlus} */ ( + new Set(cachedMinAvailableModules) + ); + newSet.plus = EMPTY_SET; + const iterator = + cachedMinAvailableModules.plus[Symbol.iterator](); + // fast forward add all modules until m + /** @type {IteratorResult} */ + let it; + while (!(it = iterator.next()).done) { + const module = it.value; + if (module === m) break; + newSet.add(module); + } + // check the remaining modules before adding + while (!(it = iterator.next()).done) { + const module = it.value; + if ( + availableModules.has(module) || + availableModules.plus.has(module) + ) { + newSet.add(module); + } + } + statForkedResultModulesCount += newSet.size; + cachedMinAvailableModules = newSet; + info.minAvailableModulesOwned = true; + info.minAvailableModules = newSet; + changed = true; + continue merge; + } + } + } + } + } + availableModulesToBeMerged.length = 0; + if (changed) { + info.resultingAvailableModules = undefined; + outdatedChunkGroupInfo.add(info); + } } - const codeGen = codeGenerationResults.get(module, runtime); - const { data } = codeGen; - const url = data.get("url"); - if (url) return url.toString(); - const filename = data.get("filename"); - return publicPath + filename; - } -} + chunkGroupsForMerging.clear(); + }; -module.exports = RuntimeTemplate; + const processChunkGroupsForCombining = () => { + for (const info of chunkGroupsForCombining) { + for (const source of info.availableSources) { + if (!source.minAvailableModules) { + chunkGroupsForCombining.delete(info); + break; + } + } + } + for (const info of chunkGroupsForCombining) { + const availableModules = /** @type {ModuleSetPlus} */ (new Set()); + availableModules.plus = EMPTY_SET; + const mergeSet = set => { + if (set.size > availableModules.plus.size) { + for (const item of availableModules.plus) availableModules.add(item); + availableModules.plus = set; + } else { + for (const item of set) availableModules.add(item); + } + }; + // combine minAvailableModules from all resultingAvailableModules + for (const source of info.availableSources) { + const resultingAvailableModules = + calculateResultingAvailableModules(source); + mergeSet(resultingAvailableModules); + mergeSet(resultingAvailableModules.plus); + } + info.minAvailableModules = availableModules; + info.minAvailableModulesOwned = false; + info.resultingAvailableModules = undefined; + outdatedChunkGroupInfo.add(info); + } + chunkGroupsForCombining.clear(); + }; + const processOutdatedChunkGroupInfo = () => { + statChunkGroupInfoUpdated += outdatedChunkGroupInfo.size; + // Revisit skipped elements + for (const info of outdatedChunkGroupInfo) { + // 1. Reconsider skipped items + if (info.skippedItems !== undefined) { + const { minAvailableModules } = info; + for (const module of info.skippedItems) { + if ( + !minAvailableModules.has(module) && + !minAvailableModules.plus.has(module) + ) { + queue.push({ + action: ADD_AND_ENTER_MODULE, + block: module, + module, + chunk: info.chunkGroup.chunks[0], + chunkGroup: info.chunkGroup, + chunkGroupInfo: info + }); + info.skippedItems.delete(module); + } + } + } -/***/ }), + // 2. Reconsider skipped connections + if (info.skippedModuleConnections !== undefined) { + const { minAvailableModules } = info; + for (const entry of info.skippedModuleConnections) { + const [module, activeState] = entry; + if (activeState === false) continue; + if (activeState === true) { + info.skippedModuleConnections.delete(entry); + } + if ( + activeState === true && + (minAvailableModules.has(module) || + minAvailableModules.plus.has(module)) + ) { + info.skippedItems.add(module); + continue; + } + queue.push({ + action: activeState === true ? ADD_AND_ENTER_MODULE : PROCESS_BLOCK, + block: module, + module, + chunk: info.chunkGroup.chunks[0], + chunkGroup: info.chunkGroup, + chunkGroupInfo: info + }); + } + } -/***/ 63560: -/***/ (function(module) { + // 2. Reconsider children chunk groups + if (info.children !== undefined) { + statChildChunkGroupsReconnected += info.children.size; + for (const cgi of info.children) { + let connectList = queueConnect.get(info); + if (connectList === undefined) { + connectList = new Set(); + queueConnect.set(info, connectList); + } + connectList.add(cgi); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // 3. Reconsider chunk groups for combining + if (info.availableChildren !== undefined) { + for (const cgi of info.availableChildren) { + chunkGroupsForCombining.add(cgi); + } + } + } + outdatedChunkGroupInfo.clear(); + }; + // Iterative traversal of the Module graph + // Recursive would be simpler to write but could result in Stack Overflows + while (queue.length || queueConnect.size) { + logger.time("visitModules: visiting"); + processQueue(); + logger.timeAggregateEnd("visitModules: prepare"); + logger.timeEnd("visitModules: visiting"); + if (chunkGroupsForCombining.size > 0) { + logger.time("visitModules: combine available modules"); + processChunkGroupsForCombining(); + logger.timeEnd("visitModules: combine available modules"); + } -class SelfModuleFactory { - constructor(moduleGraph) { - this.moduleGraph = moduleGraph; - } + if (queueConnect.size > 0) { + logger.time("visitModules: calculating available modules"); + processConnectQueue(); + logger.timeEnd("visitModules: calculating available modules"); - create(data, callback) { - const module = this.moduleGraph.getParentModule(data.dependencies[0]); - callback(null, { - module - }); - } -} + if (chunkGroupsForMerging.size > 0) { + logger.time("visitModules: merging available modules"); + processChunkGroupsForMerging(); + logger.timeEnd("visitModules: merging available modules"); + } + } -module.exports = SelfModuleFactory; + if (outdatedChunkGroupInfo.size > 0) { + logger.time("visitModules: check modules for revisit"); + processOutdatedChunkGroupInfo(); + logger.timeEnd("visitModules: check modules for revisit"); + } + // Run queueDelayed when all items of the queue are processed + // This is important to get the global indexing correct + // Async blocks should be processed after all sync blocks are processed + if (queue.length === 0) { + const tempQueue = queue; + queue = queueDelayed.reverse(); + queueDelayed = tempQueue; + } + } -/***/ }), + logger.log( + `${statProcessedQueueItems} queue items processed (${statProcessedBlocks} blocks)` + ); + logger.log(`${statConnectedChunkGroups} chunk groups connected`); + logger.log( + `${statProcessedChunkGroupsForMerging} chunk groups processed for merging (${statMergedAvailableModuleSets} module sets, ${statForkedAvailableModules} forked, ${statForkedAvailableModulesCount} + ${statForkedAvailableModulesCountPlus} modules forked, ${statForkedMergedModulesCount} + ${statForkedMergedModulesCountPlus} modules merged into fork, ${statForkedResultModulesCount} resulting modules)` + ); + logger.log( + `${statChunkGroupInfoUpdated} chunk group info updated (${statChildChunkGroupsReconnected} already connected chunk groups reconnected)` + ); +}; -/***/ 48076: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * + * @param {Compilation} compilation the compilation + * @param {Set} blocksWithNestedBlocks flag for blocks that have nested blocks + * @param {Map} blockConnections connection for blocks + * @param {Map} chunkGroupInfoMap mapping from chunk group to available modules + */ +const connectChunkGroups = ( + compilation, + blocksWithNestedBlocks, + blockConnections, + chunkGroupInfoMap +) => { + const { chunkGraph } = compilation; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sean Larkin @thelarkinn -*/ + /** + * Helper function to check if all modules of a chunk are available + * + * @param {ChunkGroup} chunkGroup the chunkGroup to scan + * @param {ModuleSetPlus} availableModules the comparator set + * @returns {boolean} return true if all modules of a chunk are available + */ + const areModulesAvailable = (chunkGroup, availableModules) => { + for (const chunk of chunkGroup.chunks) { + for (const module of chunkGraph.getChunkModulesIterable(chunk)) { + if (!availableModules.has(module) && !availableModules.plus.has(module)) + return false; + } + } + return true; + }; + // For each edge in the basic chunk graph + for (const [block, connections] of blockConnections) { + // 1. Check if connection is needed + // When none of the dependencies need to be connected + // we can skip all of them + // It's not possible to filter each item so it doesn't create inconsistent + // connections and modules can only create one version + // TODO maybe decide this per runtime + if ( + // TODO is this needed? + !blocksWithNestedBlocks.has(block) && + connections.every(({ chunkGroup, originChunkGroupInfo }) => + areModulesAvailable( + chunkGroup, + originChunkGroupInfo.resultingAvailableModules + ) + ) + ) { + continue; + } + // 2. Foreach edge + for (let i = 0; i < connections.length; i++) { + const { chunkGroup, originChunkGroupInfo } = connections[i]; -module.exports = __webpack_require__(96953); + // 3. Connect block with chunk + chunkGraph.connectBlockAndChunkGroup(block, chunkGroup); + // 4. Connect chunk with parent + connectChunkGroupParentAndChild( + originChunkGroupInfo.chunkGroup, + chunkGroup + ); + } + } +}; -/***/ }), +/** + * Remove all unconnected chunk groups + * @param {Compilation} compilation the compilation + * @param {Iterable} allCreatedChunkGroups all chunk groups that where created before + */ +const cleanupUnconnectedGroups = (compilation, allCreatedChunkGroups) => { + const { chunkGraph } = compilation; -/***/ 71070: -/***/ (function(__unused_webpack_module, exports) { + for (const chunkGroup of allCreatedChunkGroups) { + if (chunkGroup.getNumberOfParents() === 0) { + for (const chunk of chunkGroup.chunks) { + compilation.chunks.delete(chunk); + chunkGraph.disconnectChunk(chunk); + } + chunkGraph.disconnectChunkGroup(chunkGroup); + chunkGroup.remove(); + } + } +}; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sean Larkin @thelarkinn -*/ +/** + * This method creates the Chunk graph from the Module graph + * @param {Compilation} compilation the compilation + * @param {Map} inputEntrypointsAndModules chunk groups which are processed with the modules + * @returns {void} + */ +const buildChunkGraph = (compilation, inputEntrypointsAndModules) => { + const logger = compilation.getLogger("webpack.buildChunkGraph"); + // SHARED STATE + /** @type {Map} */ + const blockConnections = new Map(); -/** - * @param {number} size the size in bytes - * @returns {string} the formatted size - */ -exports.formatSize = size => { - if (typeof size !== "number" || Number.isNaN(size) === true) { - return "unknown size"; - } + /** @type {Set} */ + const allCreatedChunkGroups = new Set(); - if (size <= 0) { - return "0 bytes"; + /** @type {Map} */ + const chunkGroupInfoMap = new Map(); + + /** @type {Set} */ + const blocksWithNestedBlocks = new Set(); + + // PART ONE + + logger.time("visitModules"); + visitModules( + logger, + compilation, + inputEntrypointsAndModules, + chunkGroupInfoMap, + blockConnections, + blocksWithNestedBlocks, + allCreatedChunkGroups + ); + logger.timeEnd("visitModules"); + + // PART TWO + + logger.time("connectChunkGroups"); + connectChunkGroups( + compilation, + blocksWithNestedBlocks, + blockConnections, + chunkGroupInfoMap + ); + logger.timeEnd("connectChunkGroups"); + + for (const [chunkGroup, chunkGroupInfo] of chunkGroupInfoMap) { + for (const chunk of chunkGroup.chunks) + chunk.runtime = mergeRuntime(chunk.runtime, chunkGroupInfo.runtime); } - const abbreviations = ["bytes", "KiB", "MiB", "GiB"]; - const index = Math.floor(Math.log(size) / Math.log(1024)); + // Cleanup work - return `${+(size / Math.pow(1024, index)).toPrecision(3)} ${ - abbreviations[index] - }`; + logger.time("cleanup"); + cleanupUnconnectedGroups(compilation, allCreatedChunkGroups); + logger.timeEnd("cleanup"); }; +module.exports = buildChunkGraph; + /***/ }), -/***/ 97513: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 28034: +/***/ (function(module) { "use strict"; /* @@ -62039,62 +60637,38 @@ exports.formatSize = size => { -const JavascriptModulesPlugin = __webpack_require__(89464); - -/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("../Compiler")} Compiler */ -class SourceMapDevToolModuleOptionsPlugin { - constructor(options) { - this.options = options; +class AddBuildDependenciesPlugin { + /** + * @param {Iterable} buildDependencies list of build dependencies + */ + constructor(buildDependencies) { + this.buildDependencies = new Set(buildDependencies); } /** - * @param {Compilation} compilation the compiler instance + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply(compilation) { - const options = this.options; - if (options.module !== false) { - compilation.hooks.buildModule.tap( - "SourceMapDevToolModuleOptionsPlugin", - module => { - module.useSourceMap = true; - } - ); - compilation.hooks.runtimeModule.tap( - "SourceMapDevToolModuleOptionsPlugin", - module => { - module.useSourceMap = true; - } - ); - } else { - compilation.hooks.buildModule.tap( - "SourceMapDevToolModuleOptionsPlugin", - module => { - module.useSimpleSourceMap = true; - } - ); - compilation.hooks.runtimeModule.tap( - "SourceMapDevToolModuleOptionsPlugin", - module => { - module.useSimpleSourceMap = true; - } - ); - } - JavascriptModulesPlugin.getCompilationHooks(compilation).useSourceMap.tap( - "SourceMapDevToolModuleOptionsPlugin", - () => true + apply(compiler) { + compiler.hooks.compilation.tap( + "AddBuildDependenciesPlugin", + compilation => { + compilation.buildDependencies.addAll(this.buildDependencies); + } ); } } -module.exports = SourceMapDevToolModuleOptionsPlugin; +module.exports = AddBuildDependenciesPlugin; /***/ }), -/***/ 63872: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 47942: +/***/ (function(module) { "use strict"; /* @@ -62104,565 +60678,275 @@ module.exports = SourceMapDevToolModuleOptionsPlugin; -const asyncLib = __webpack_require__(78175); -const { ConcatSource, RawSource } = __webpack_require__(51255); -const Compilation = __webpack_require__(85720); -const ModuleFilenameHelpers = __webpack_require__(88821); -const ProgressPlugin = __webpack_require__(13216); -const SourceMapDevToolModuleOptionsPlugin = __webpack_require__(97513); -const createSchemaValidation = __webpack_require__(32540); -const createHash = __webpack_require__(49835); -const { relative, dirname } = __webpack_require__(17139); -const { makePathsAbsolute } = __webpack_require__(82186); - -/** @typedef {import("webpack-sources").MapOptions} MapOptions */ -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */ -/** @typedef {import("./Cache").Etag} Etag */ -/** @typedef {import("./CacheFacade").ItemCacheFacade} ItemCacheFacade */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./NormalModule").SourceMap} SourceMap */ -/** @typedef {import("./util/Hash")} Hash */ - -const validate = createSchemaValidation( - __webpack_require__(2885), - () => __webpack_require__(30501), - { - name: "SourceMap DevTool Plugin", - baseDataPath: "options" - } -); -/** - * @typedef {object} SourceMapTask - * @property {Source} asset - * @property {AssetInfo} assetInfo - * @property {(string | Module)[]} modules - * @property {string} source - * @property {string} file - * @property {SourceMap} sourceMap - * @property {ItemCacheFacade} cacheItem cache item - */ - -/** - * Escapes regular expression metacharacters - * @param {string} str String to quote - * @returns {string} Escaped string - */ -const quoteMeta = str => { - return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); -}; - -/** - * Creating {@link SourceMapTask} for given file - * @param {string} file current compiled file - * @param {Source} asset the asset - * @param {AssetInfo} assetInfo the asset info - * @param {MapOptions} options source map options - * @param {Compilation} compilation compilation instance - * @param {ItemCacheFacade} cacheItem cache item - * @returns {SourceMapTask | undefined} created task instance or `undefined` - */ -const getTaskForFile = ( - file, - asset, - assetInfo, - options, - compilation, - cacheItem -) => { - let source; - /** @type {SourceMap} */ - let sourceMap; - /** - * Check if asset can build source map - */ - if (asset.sourceAndMap) { - const sourceAndMap = asset.sourceAndMap(options); - sourceMap = /** @type {SourceMap} */ (sourceAndMap.map); - source = sourceAndMap.source; - } else { - sourceMap = /** @type {SourceMap} */ (asset.map(options)); - source = asset.source(); - } - if (!sourceMap || typeof source !== "string") return; - const context = compilation.options.context; - const root = compilation.compiler.root; - const cachedAbsolutify = makePathsAbsolute.bindContextCache(context, root); - const modules = sourceMap.sources.map(source => { - if (!source.startsWith("webpack://")) return source; - source = cachedAbsolutify(source.slice(10)); - const module = compilation.findModule(source); - return module || source; - }); - - return { - file, - asset, - source, - assetInfo, - sourceMap, - modules, - cacheItem - }; -}; +/** @typedef {import("../Compiler")} Compiler */ -class SourceMapDevToolPlugin { +class AddManagedPathsPlugin { /** - * @param {SourceMapDevToolPluginOptions} [options] options object - * @throws {Error} throws error, if got more than 1 arguments + * @param {Iterable} managedPaths list of managed paths + * @param {Iterable} immutablePaths list of immutable paths */ - constructor(options = {}) { - validate(options); - - /** @type {string | false} */ - this.sourceMapFilename = options.filename; - /** @type {string | false} */ - this.sourceMappingURLComment = - options.append === false - ? false - : options.append || "\n//# source" + "MappingURL=[url]"; - /** @type {string | Function} */ - this.moduleFilenameTemplate = - options.moduleFilenameTemplate || "webpack://[namespace]/[resourcePath]"; - /** @type {string | Function} */ - this.fallbackModuleFilenameTemplate = - options.fallbackModuleFilenameTemplate || - "webpack://[namespace]/[resourcePath]?[hash]"; - /** @type {string} */ - this.namespace = options.namespace || ""; - /** @type {SourceMapDevToolPluginOptions} */ - this.options = options; + constructor(managedPaths, immutablePaths) { + this.managedPaths = new Set(managedPaths); + this.immutablePaths = new Set(immutablePaths); } /** * Apply the plugin - * @param {Compiler} compiler compiler instance + * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { - const outputFs = compiler.outputFileSystem; - const sourceMapFilename = this.sourceMapFilename; - const sourceMappingURLComment = this.sourceMappingURLComment; - const moduleFilenameTemplate = this.moduleFilenameTemplate; - const namespace = this.namespace; - const fallbackModuleFilenameTemplate = this.fallbackModuleFilenameTemplate; - const requestShortener = compiler.requestShortener; - const options = this.options; - options.test = options.test || /\.((c|m)?js|css)($|\?)/i; + for (const managedPath of this.managedPaths) { + compiler.managedPaths.add(managedPath); + } + for (const immutablePath of this.immutablePaths) { + compiler.immutablePaths.add(immutablePath); + } + } +} - const matchObject = ModuleFilenameHelpers.matchObject.bind( - undefined, - options - ); +module.exports = AddManagedPathsPlugin; - compiler.hooks.compilation.tap("SourceMapDevToolPlugin", compilation => { - new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation); - compilation.hooks.processAssets.tapAsync( - { - name: "SourceMapDevToolPlugin", - stage: Compilation.PROCESS_ASSETS_STAGE_DEV_TOOLING, - additionalAssets: true - }, - (assets, callback) => { - const chunkGraph = compilation.chunkGraph; - const cache = compilation.getCache("SourceMapDevToolPlugin"); - /** @type {Map} */ - const moduleToSourceNameMapping = new Map(); - /** - * @type {Function} - * @returns {void} - */ - const reportProgress = - ProgressPlugin.getReporter(compilation.compiler) || (() => {}); +/***/ }), - /** @type {Map} */ - const fileToChunk = new Map(); - for (const chunk of compilation.chunks) { - for (const file of chunk.files) { - fileToChunk.set(file, chunk); - } - for (const file of chunk.auxiliaryFiles) { - fileToChunk.set(file, chunk); - } - } +/***/ 71985: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** @type {string[]} */ - const files = []; - for (const file of Object.keys(assets)) { - if (matchObject(file)) { - files.push(file); - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - reportProgress(0.0); - /** @type {SourceMapTask[]} */ - const tasks = []; - let fileIndex = 0; - asyncLib.each( - files, - (file, callback) => { - const asset = compilation.getAsset(file); - if (asset.info.related && asset.info.related.sourceMap) { - fileIndex++; - return callback(); - } - const cacheItem = cache.getItemCache( - file, - cache.mergeEtags( - cache.getLazyHashedEtag(asset.source), - namespace - ) - ); - cacheItem.get((err, cacheEntry) => { - if (err) { - return callback(err); - } - /** - * If presented in cache, reassigns assets. Cache assets already have source maps. - */ - if (cacheEntry) { - const { assets, assetsInfo } = cacheEntry; - for (const cachedFile of Object.keys(assets)) { - if (cachedFile === file) { - compilation.updateAsset( - cachedFile, - assets[cachedFile], - assetsInfo[cachedFile] - ); - } else { - compilation.emitAsset( - cachedFile, - assets[cachedFile], - assetsInfo[cachedFile] - ); - } - /** - * Add file to chunk, if not presented there - */ - if (cachedFile !== file) { - const chunk = fileToChunk.get(file); - if (chunk !== undefined) - chunk.auxiliaryFiles.add(cachedFile); - } - } +const Cache = __webpack_require__(7592); +const ProgressPlugin = __webpack_require__(13216); - reportProgress( - (0.5 * ++fileIndex) / files.length, - file, - "restored cached SourceMap" - ); +/** @typedef {import("../Compiler")} Compiler */ - return callback(); - } +const BUILD_DEPENDENCIES_KEY = Symbol(); - reportProgress( - (0.5 * fileIndex) / files.length, - file, - "generate SourceMap" - ); +class IdleFileCachePlugin { + /** + * @param {TODO} strategy cache strategy + * @param {number} idleTimeout timeout + * @param {number} idleTimeoutForInitialStore initial timeout + * @param {number} idleTimeoutAfterLargeChanges timeout after changes + */ + constructor( + strategy, + idleTimeout, + idleTimeoutForInitialStore, + idleTimeoutAfterLargeChanges + ) { + this.strategy = strategy; + this.idleTimeout = idleTimeout; + this.idleTimeoutForInitialStore = idleTimeoutForInitialStore; + this.idleTimeoutAfterLargeChanges = idleTimeoutAfterLargeChanges; + } - /** @type {SourceMapTask | undefined} */ - const task = getTaskForFile( - file, - asset.source, - asset.info, - { - module: options.module, - columns: options.columns - }, - compilation, - cacheItem - ); + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + let strategy = this.strategy; + const idleTimeout = this.idleTimeout; + const idleTimeoutForInitialStore = Math.min( + idleTimeout, + this.idleTimeoutForInitialStore + ); + const idleTimeoutAfterLargeChanges = this.idleTimeoutAfterLargeChanges; + const resolvedPromise = Promise.resolve(); - if (task) { - const modules = task.modules; + let timeSpendInBuild = 0; + let timeSpendInStore = 0; + let avgTimeSpendInStore = 0; - for (let idx = 0; idx < modules.length; idx++) { - const module = modules[idx]; - if (!moduleToSourceNameMapping.get(module)) { - moduleToSourceNameMapping.set( - module, - ModuleFilenameHelpers.createFilename( - module, - { - moduleFilenameTemplate: moduleFilenameTemplate, - namespace: namespace - }, - { - requestShortener, - chunkGraph, - hashFunction: compilation.outputOptions.hashFunction - } - ) - ); - } - } + /** @type {Map Promise>} */ + const pendingIdleTasks = new Map(); - tasks.push(task); - } - - reportProgress( - (0.5 * ++fileIndex) / files.length, - file, - "generated SourceMap" - ); + compiler.cache.hooks.store.tap( + { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, + (identifier, etag, data) => { + pendingIdleTasks.set(identifier, () => + strategy.store(identifier, etag, data) + ); + } + ); + compiler.cache.hooks.get.tapPromise( + { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, + (identifier, etag, gotHandlers) => { + const restore = () => + strategy.restore(identifier, etag).then(cacheEntry => { + if (cacheEntry === undefined) { + gotHandlers.push((result, callback) => { + if (result !== undefined) { + pendingIdleTasks.set(identifier, () => + strategy.store(identifier, etag, result) + ); + } callback(); }); - }, - err => { - if (err) { - return callback(err); - } - - reportProgress(0.5, "resolve sources"); - /** @type {Set} */ - const usedNamesSet = new Set(moduleToSourceNameMapping.values()); - /** @type {Set} */ - const conflictDetectionSet = new Set(); - - /** - * all modules in defined order (longest identifier first) - * @type {Array} - */ - const allModules = Array.from( - moduleToSourceNameMapping.keys() - ).sort((a, b) => { - const ai = typeof a === "string" ? a : a.identifier(); - const bi = typeof b === "string" ? b : b.identifier(); - return ai.length - bi.length; - }); - - // find modules with conflicting source names - for (let idx = 0; idx < allModules.length; idx++) { - const module = allModules[idx]; - let sourceName = moduleToSourceNameMapping.get(module); - let hasName = conflictDetectionSet.has(sourceName); - if (!hasName) { - conflictDetectionSet.add(sourceName); - continue; - } - - // try the fallback name first - sourceName = ModuleFilenameHelpers.createFilename( - module, - { - moduleFilenameTemplate: fallbackModuleFilenameTemplate, - namespace: namespace - }, - { - requestShortener, - chunkGraph, - hashFunction: compilation.outputOptions.hashFunction - } - ); - hasName = usedNamesSet.has(sourceName); - if (!hasName) { - moduleToSourceNameMapping.set(module, sourceName); - usedNamesSet.add(sourceName); - continue; - } - - // otherwise just append stars until we have a valid name - while (hasName) { - sourceName += "*"; - hasName = usedNamesSet.has(sourceName); - } - moduleToSourceNameMapping.set(module, sourceName); - usedNamesSet.add(sourceName); - } - - let taskIndex = 0; - - asyncLib.each( - tasks, - (task, callback) => { - const assets = Object.create(null); - const assetsInfo = Object.create(null); - const file = task.file; - const chunk = fileToChunk.get(file); - const sourceMap = task.sourceMap; - const source = task.source; - const modules = task.modules; - - reportProgress( - 0.5 + (0.5 * taskIndex) / tasks.length, - file, - "attach SourceMap" - ); - - const moduleFilenames = modules.map(m => - moduleToSourceNameMapping.get(m) - ); - sourceMap.sources = moduleFilenames; - if (options.noSources) { - sourceMap.sourcesContent = undefined; - } - sourceMap.sourceRoot = options.sourceRoot || ""; - sourceMap.file = file; - const usesContentHash = - sourceMapFilename && - /\[contenthash(:\w+)?\]/.test(sourceMapFilename); - - // If SourceMap and asset uses contenthash, avoid a circular dependency by hiding hash in `file` - if (usesContentHash && task.assetInfo.contenthash) { - const contenthash = task.assetInfo.contenthash; - let pattern; - if (Array.isArray(contenthash)) { - pattern = contenthash.map(quoteMeta).join("|"); - } else { - pattern = quoteMeta(contenthash); - } - sourceMap.file = sourceMap.file.replace( - new RegExp(pattern, "g"), - m => "x".repeat(m.length) - ); - } + } else { + return cacheEntry; + } + }); + const pendingTask = pendingIdleTasks.get(identifier); + if (pendingTask !== undefined) { + pendingIdleTasks.delete(identifier); + return pendingTask().then(restore); + } + return restore(); + } + ); - /** @type {string | false} */ - let currentSourceMappingURLComment = sourceMappingURLComment; - if ( - currentSourceMappingURLComment !== false && - /\.css($|\?)/i.test(file) - ) { - currentSourceMappingURLComment = - currentSourceMappingURLComment.replace( - /^\n\/\/(.*)$/, - "\n/*$1*/" - ); - } - const sourceMapString = JSON.stringify(sourceMap); - if (sourceMapFilename) { - let filename = file; - const sourceMapContentHash = - usesContentHash && - /** @type {string} */ ( - createHash(compilation.outputOptions.hashFunction) - .update(sourceMapString) - .digest("hex") - ); - const pathParams = { - chunk, - filename: options.fileContext - ? relative( - outputFs, - `/${options.fileContext}`, - `/${filename}` - ) - : filename, - contentHash: sourceMapContentHash - }; - const { path: sourceMapFile, info: sourceMapInfo } = - compilation.getPathWithInfo( - sourceMapFilename, - pathParams - ); - const sourceMapUrl = options.publicPath - ? options.publicPath + sourceMapFile - : relative( - outputFs, - dirname(outputFs, `/${file}`), - `/${sourceMapFile}` - ); - /** @type {Source} */ - let asset = new RawSource(source); - if (currentSourceMappingURLComment !== false) { - // Add source map url to compilation asset, if currentSourceMappingURLComment is set - asset = new ConcatSource( - asset, - compilation.getPath( - currentSourceMappingURLComment, - Object.assign({ url: sourceMapUrl }, pathParams) - ) - ); - } - const assetInfo = { - related: { sourceMap: sourceMapFile } - }; - assets[file] = asset; - assetsInfo[file] = assetInfo; - compilation.updateAsset(file, asset, assetInfo); - // Add source map file to compilation assets and chunk files - const sourceMapAsset = new RawSource(sourceMapString); - const sourceMapAssetInfo = { - ...sourceMapInfo, - development: true - }; - assets[sourceMapFile] = sourceMapAsset; - assetsInfo[sourceMapFile] = sourceMapAssetInfo; - compilation.emitAsset( - sourceMapFile, - sourceMapAsset, - sourceMapAssetInfo - ); - if (chunk !== undefined) - chunk.auxiliaryFiles.add(sourceMapFile); - } else { - if (currentSourceMappingURLComment === false) { - throw new Error( - "SourceMapDevToolPlugin: append can't be false when no filename is provided" - ); - } - /** - * Add source map as data url to asset - */ - const asset = new ConcatSource( - new RawSource(source), - currentSourceMappingURLComment - .replace(/\[map\]/g, () => sourceMapString) - .replace( - /\[url\]/g, - () => - `data:application/json;charset=utf-8;base64,${Buffer.from( - sourceMapString, - "utf-8" - ).toString("base64")}` - ) - ); - assets[file] = asset; - assetsInfo[file] = undefined; - compilation.updateAsset(file, asset); - } + compiler.cache.hooks.storeBuildDependencies.tap( + { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, + dependencies => { + pendingIdleTasks.set(BUILD_DEPENDENCIES_KEY, () => + strategy.storeBuildDependencies(dependencies) + ); + } + ); - task.cacheItem.store({ assets, assetsInfo }, err => { - reportProgress( - 0.5 + (0.5 * ++taskIndex) / tasks.length, - task.file, - "attached SourceMap" - ); + compiler.cache.hooks.shutdown.tapPromise( + { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, + () => { + if (idleTimer) { + clearTimeout(idleTimer); + idleTimer = undefined; + } + isIdle = false; + const reportProgress = ProgressPlugin.getReporter(compiler); + const jobs = Array.from(pendingIdleTasks.values()); + if (reportProgress) reportProgress(0, "process pending cache items"); + const promises = jobs.map(fn => fn()); + pendingIdleTasks.clear(); + promises.push(currentIdlePromise); + const promise = Promise.all(promises); + currentIdlePromise = promise.then(() => strategy.afterAllStored()); + if (reportProgress) { + currentIdlePromise = currentIdlePromise.then(() => { + reportProgress(1, `stored`); + }); + } + return currentIdlePromise.then(() => { + // Reset strategy + if (strategy.clear) strategy.clear(); + }); + } + ); - if (err) { - return callback(err); - } - callback(); - }); - }, - err => { - reportProgress(1.0); - callback(err); - } - ); - } - ); + /** @type {Promise} */ + let currentIdlePromise = resolvedPromise; + let isIdle = false; + let isInitialStore = true; + const processIdleTasks = () => { + if (isIdle) { + const startTime = Date.now(); + if (pendingIdleTasks.size > 0) { + const promises = [currentIdlePromise]; + const maxTime = startTime + 100; + let maxCount = 100; + for (const [filename, factory] of pendingIdleTasks) { + pendingIdleTasks.delete(filename); + promises.push(factory()); + if (maxCount-- <= 0 || Date.now() > maxTime) break; + } + currentIdlePromise = Promise.all(promises); + currentIdlePromise.then(() => { + timeSpendInStore += Date.now() - startTime; + // Allow to exit the process between + idleTimer = setTimeout(processIdleTasks, 0); + idleTimer.unref(); + }); + return; } - ); + currentIdlePromise = currentIdlePromise + .then(async () => { + await strategy.afterAllStored(); + timeSpendInStore += Date.now() - startTime; + avgTimeSpendInStore = + Math.max(avgTimeSpendInStore, timeSpendInStore) * 0.9 + + timeSpendInStore * 0.1; + timeSpendInStore = 0; + timeSpendInBuild = 0; + }) + .catch(err => { + const logger = compiler.getInfrastructureLogger( + "IdleFileCachePlugin" + ); + logger.warn(`Background tasks during idle failed: ${err.message}`); + logger.debug(err.stack); + }); + isInitialStore = false; + } + }; + let idleTimer = undefined; + compiler.cache.hooks.beginIdle.tap( + { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, + () => { + const isLargeChange = timeSpendInBuild > avgTimeSpendInStore * 2; + if (isInitialStore && idleTimeoutForInitialStore < idleTimeout) { + compiler + .getInfrastructureLogger("IdleFileCachePlugin") + .log( + `Initial cache was generated and cache will be persisted in ${ + idleTimeoutForInitialStore / 1000 + }s.` + ); + } else if ( + isLargeChange && + idleTimeoutAfterLargeChanges < idleTimeout + ) { + compiler + .getInfrastructureLogger("IdleFileCachePlugin") + .log( + `Spend ${Math.round(timeSpendInBuild) / 1000}s in build and ${ + Math.round(avgTimeSpendInStore) / 1000 + }s in average in cache store. This is considered as large change and cache will be persisted in ${ + idleTimeoutAfterLargeChanges / 1000 + }s.` + ); + } + idleTimer = setTimeout(() => { + idleTimer = undefined; + isIdle = true; + resolvedPromise.then(processIdleTasks); + }, Math.min(isInitialStore ? idleTimeoutForInitialStore : Infinity, isLargeChange ? idleTimeoutAfterLargeChanges : Infinity, idleTimeout)); + idleTimer.unref(); + } + ); + compiler.cache.hooks.endIdle.tap( + { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, + () => { + if (idleTimer) { + clearTimeout(idleTimer); + idleTimer = undefined; + } + isIdle = false; + } + ); + compiler.hooks.done.tap("IdleFileCachePlugin", stats => { + // 10% build overhead is ignored, as it's not cacheable + timeSpendInBuild *= 0.9; + timeSpendInBuild += stats.endTime - stats.startTime; }); } } -module.exports = SourceMapDevToolPlugin; +module.exports = IdleFileCachePlugin; /***/ }), -/***/ 31743: -/***/ (function(module) { +/***/ 52539: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -62672,88 +60956,61 @@ module.exports = SourceMapDevToolPlugin; -/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */ - -class Stats { - /** - * @param {Compilation} compilation webpack compilation - */ - constructor(compilation) { - this.compilation = compilation; - } - - get hash() { - return this.compilation.hash; - } - - get startTime() { - return this.compilation.startTime; - } +const Cache = __webpack_require__(7592); - get endTime() { - return this.compilation.endTime; - } +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Cache").Etag} Etag */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ +class MemoryCachePlugin { /** - * @returns {boolean} true if the compilation had a warning + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - hasWarnings() { - return ( - this.compilation.warnings.length > 0 || - this.compilation.children.some(child => child.getStats().hasWarnings()) + apply(compiler) { + /** @type {Map} */ + const cache = new Map(); + compiler.cache.hooks.store.tap( + { name: "MemoryCachePlugin", stage: Cache.STAGE_MEMORY }, + (identifier, etag, data) => { + cache.set(identifier, { etag, data }); + } ); - } - - /** - * @returns {boolean} true if the compilation encountered an error - */ - hasErrors() { - return ( - this.compilation.errors.length > 0 || - this.compilation.children.some(child => child.getStats().hasErrors()) + compiler.cache.hooks.get.tap( + { name: "MemoryCachePlugin", stage: Cache.STAGE_MEMORY }, + (identifier, etag, gotHandlers) => { + const cacheEntry = cache.get(identifier); + if (cacheEntry === null) { + return null; + } else if (cacheEntry !== undefined) { + return cacheEntry.etag === etag ? cacheEntry.data : null; + } + gotHandlers.push((result, callback) => { + if (result === undefined) { + cache.set(identifier, null); + } else { + cache.set(identifier, { etag, data: result }); + } + return callback(); + }); + } + ); + compiler.cache.hooks.shutdown.tap( + { name: "MemoryCachePlugin", stage: Cache.STAGE_MEMORY }, + () => { + cache.clear(); + } ); - } - - /** - * @param {(string|StatsOptions)=} options stats options - * @returns {StatsCompilation} json output - */ - toJson(options) { - options = this.compilation.createStatsOptions(options, { - forToString: false - }); - - const statsFactory = this.compilation.createStatsFactory(options); - - return statsFactory.create("compilation", this.compilation, { - compilation: this.compilation - }); - } - - toString(options) { - options = this.compilation.createStatsOptions(options, { - forToString: true - }); - - const statsFactory = this.compilation.createStatsFactory(options); - const statsPrinter = this.compilation.createStatsPrinter(options); - - const data = statsFactory.create("compilation", this.compilation, { - compilation: this.compilation - }); - const result = statsPrinter.print("compilation", data); - return result === undefined ? "" : result; } } - -module.exports = Stats; +module.exports = MemoryCachePlugin; /***/ }), -/***/ 39722: +/***/ 99334: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -62764,1218 +61021,1567 @@ module.exports = Stats; -const { ConcatSource, PrefixSource } = __webpack_require__(51255); +const Cache = __webpack_require__(7592); /** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../declarations/WebpackOptions").Output} OutputOptions */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGraph")} ChunkGraph */ -/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ -/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("./Compilation").PathData} PathData */ -/** @typedef {import("./DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./ModuleTemplate")} ModuleTemplate */ -/** @typedef {import("./RuntimeModule")} RuntimeModule */ -/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("./javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */ -/** @typedef {import("./javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ +/** @typedef {import("../Cache").Etag} Etag */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ -const START_LOWERCASE_ALPHABET_CODE = "a".charCodeAt(0); -const START_UPPERCASE_ALPHABET_CODE = "A".charCodeAt(0); -const DELTA_A_TO_Z = "z".charCodeAt(0) - START_LOWERCASE_ALPHABET_CODE + 1; -const NUMBER_OF_IDENTIFIER_START_CHARS = DELTA_A_TO_Z * 2 + 2; // a-z A-Z _ $ -const NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS = - NUMBER_OF_IDENTIFIER_START_CHARS + 10; // a-z A-Z _ $ 0-9 -const FUNCTION_CONTENT_REGEX = /^function\s?\(\)\s?\{\r?\n?|\r?\n?\}$/g; -const INDENT_MULTILINE_REGEX = /^\t/gm; -const LINE_SEPARATOR_REGEX = /\r?\n/g; -const IDENTIFIER_NAME_REPLACE_REGEX = /^([^a-zA-Z$_])/; -const IDENTIFIER_ALPHA_NUMERIC_NAME_REPLACE_REGEX = /[^a-zA-Z0-9$]+/g; -const COMMENT_END_REGEX = /\*\//g; -const PATH_NAME_NORMALIZE_REPLACE_REGEX = /[^a-zA-Z0-9_!§$()=\-^°]+/g; -const MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g; +class MemoryWithGcCachePlugin { + constructor({ maxGenerations }) { + this._maxGenerations = maxGenerations; + } + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const maxGenerations = this._maxGenerations; + /** @type {Map} */ + const cache = new Map(); + /** @type {Map} */ + const oldCache = new Map(); + let generation = 0; + let cachePosition = 0; + const logger = compiler.getInfrastructureLogger("MemoryWithGcCachePlugin"); + compiler.hooks.afterDone.tap("MemoryWithGcCachePlugin", () => { + generation++; + let clearedEntries = 0; + let lastClearedIdentifier; + for (const [identifier, entry] of oldCache) { + if (entry.until > generation) break; -/** - * @typedef {Object} RenderManifestOptions - * @property {Chunk} chunk the chunk used to render - * @property {string} hash - * @property {string} fullHash - * @property {OutputOptions} outputOptions - * @property {CodeGenerationResults} codeGenerationResults - * @property {{javascript: ModuleTemplate}} moduleTemplates - * @property {DependencyTemplates} dependencyTemplates - * @property {RuntimeTemplate} runtimeTemplate - * @property {ModuleGraph} moduleGraph - * @property {ChunkGraph} chunkGraph - */ + oldCache.delete(identifier); + if (cache.get(identifier) === undefined) { + cache.delete(identifier); + clearedEntries++; + lastClearedIdentifier = identifier; + } + } + if (clearedEntries > 0 || oldCache.size > 0) { + logger.log( + `${cache.size - oldCache.size} active entries, ${ + oldCache.size + } recently unused cached entries${ + clearedEntries > 0 + ? `, ${clearedEntries} old unused cache entries removed e. g. ${lastClearedIdentifier}` + : "" + }` + ); + } + let i = (cache.size / maxGenerations) | 0; + let j = cachePosition >= cache.size ? 0 : cachePosition; + cachePosition = j + i; + for (const [identifier, entry] of cache) { + if (j !== 0) { + j--; + continue; + } + if (entry !== undefined) { + // We don't delete the cache entry, but set it to undefined instead + // This reserves the location in the data table and avoids rehashing + // when constantly adding and removing entries. + // It will be deleted when removed from oldCache. + cache.set(identifier, undefined); + oldCache.delete(identifier); + oldCache.set(identifier, { + entry, + until: generation + maxGenerations + }); + if (i-- === 0) break; + } + } + }); + compiler.cache.hooks.store.tap( + { name: "MemoryWithGcCachePlugin", stage: Cache.STAGE_MEMORY }, + (identifier, etag, data) => { + cache.set(identifier, { etag, data }); + } + ); + compiler.cache.hooks.get.tap( + { name: "MemoryWithGcCachePlugin", stage: Cache.STAGE_MEMORY }, + (identifier, etag, gotHandlers) => { + const cacheEntry = cache.get(identifier); + if (cacheEntry === null) { + return null; + } else if (cacheEntry !== undefined) { + return cacheEntry.etag === etag ? cacheEntry.data : null; + } + const oldCacheEntry = oldCache.get(identifier); + if (oldCacheEntry !== undefined) { + const cacheEntry = oldCacheEntry.entry; + if (cacheEntry === null) { + oldCache.delete(identifier); + cache.set(identifier, cacheEntry); + return null; + } else { + if (cacheEntry.etag !== etag) return null; + oldCache.delete(identifier); + cache.set(identifier, cacheEntry); + return cacheEntry.data; + } + } + gotHandlers.push((result, callback) => { + if (result === undefined) { + cache.set(identifier, null); + } else { + cache.set(identifier, { etag, data: result }); + } + return callback(); + }); + } + ); + compiler.cache.hooks.shutdown.tap( + { name: "MemoryWithGcCachePlugin", stage: Cache.STAGE_MEMORY }, + () => { + cache.clear(); + oldCache.clear(); + } + ); + } +} +module.exports = MemoryWithGcCachePlugin; -/** @typedef {RenderManifestEntryTemplated | RenderManifestEntryStatic} RenderManifestEntry */ -/** - * @typedef {Object} RenderManifestEntryTemplated - * @property {function(): Source} render - * @property {string | function(PathData, AssetInfo=): string} filenameTemplate - * @property {PathData=} pathOptions - * @property {AssetInfo=} info - * @property {string} identifier - * @property {string=} hash - * @property {boolean=} auxiliary - */ +/***/ }), -/** - * @typedef {Object} RenderManifestEntryStatic - * @property {function(): Source} render - * @property {string} filename - * @property {AssetInfo} info - * @property {string} identifier - * @property {string=} hash - * @property {boolean=} auxiliary - */ +/***/ 86180: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** - * @typedef {Object} HasId - * @property {number | string} id - */ +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/** - * @typedef {function(Module, number): boolean} ModuleFilterPredicate - */ -class Template { - /** - * - * @param {Function} fn a runtime function (.runtime.js) "template" - * @returns {string} the updated and normalized function string - */ - static getFunctionContent(fn) { - return fn - .toString() - .replace(FUNCTION_CONTENT_REGEX, "") - .replace(INDENT_MULTILINE_REGEX, "") - .replace(LINE_SEPARATOR_REGEX, "\n"); - } - /** - * @param {string} str the string converted to identifier - * @returns {string} created identifier - */ - static toIdentifier(str) { - if (typeof str !== "string") return ""; - return str - .replace(IDENTIFIER_NAME_REPLACE_REGEX, "_$1") - .replace(IDENTIFIER_ALPHA_NUMERIC_NAME_REPLACE_REGEX, "_"); - } - /** - * - * @param {string} str string to be converted to commented in bundle code - * @returns {string} returns a commented version of string - */ - static toComment(str) { - if (!str) return ""; - return `/*! ${str.replace(COMMENT_END_REGEX, "* /")} */`; - } +const FileSystemInfo = __webpack_require__(79453); +const ProgressPlugin = __webpack_require__(13216); +const { formatSize } = __webpack_require__(71070); +const SerializerMiddleware = __webpack_require__(83137); +const LazySet = __webpack_require__(38938); +const makeSerializable = __webpack_require__(33032); +const memoize = __webpack_require__(78676); +const { + createFileSerializer, + NOT_SERIALIZABLE +} = __webpack_require__(8282); - /** - * - * @param {string} str string to be converted to "normal comment" - * @returns {string} returns a commented version of string - */ - static toNormalComment(str) { - if (!str) return ""; - return `/* ${str.replace(COMMENT_END_REGEX, "* /")} */`; - } +/** @typedef {import("../../declarations/WebpackOptions").SnapshotOptions} SnapshotOptions */ +/** @typedef {import("../Cache").Etag} Etag */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../FileSystemInfo").Snapshot} Snapshot */ +/** @typedef {import("../logging/Logger").Logger} Logger */ +/** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */ +class PackContainer { /** - * @param {string} str string path to be normalized - * @returns {string} normalized bundle-safe path + * @param {Object} data stored data + * @param {string} version version identifier + * @param {Snapshot} buildSnapshot snapshot of all build dependencies + * @param {Set} buildDependencies list of all unresolved build dependencies captured + * @param {Map} resolveResults result of the resolved build dependencies + * @param {Snapshot} resolveBuildDependenciesSnapshot snapshot of the dependencies of the build dependencies resolving */ - static toPath(str) { - if (typeof str !== "string") return ""; - return str - .replace(PATH_NAME_NORMALIZE_REPLACE_REGEX, "-") - .replace(MATCH_PADDED_HYPHENS_REPLACE_REGEX, ""); + constructor( + data, + version, + buildSnapshot, + buildDependencies, + resolveResults, + resolveBuildDependenciesSnapshot + ) { + this.data = data; + this.version = version; + this.buildSnapshot = buildSnapshot; + this.buildDependencies = buildDependencies; + this.resolveResults = resolveResults; + this.resolveBuildDependenciesSnapshot = resolveBuildDependenciesSnapshot; } - // map number to a single character a-z, A-Z or multiple characters if number is too big - /** - * @param {number} n number to convert to ident - * @returns {string} returns single character ident - */ - static numberToIdentifier(n) { - if (n >= NUMBER_OF_IDENTIFIER_START_CHARS) { - // use multiple letters - return ( - Template.numberToIdentifier(n % NUMBER_OF_IDENTIFIER_START_CHARS) + - Template.numberToIdentifierContinuation( - Math.floor(n / NUMBER_OF_IDENTIFIER_START_CHARS) - ) - ); - } + serialize({ write, writeLazy }) { + write(this.version); + write(this.buildSnapshot); + write(this.buildDependencies); + write(this.resolveResults); + write(this.resolveBuildDependenciesSnapshot); + writeLazy(this.data); + } - // lower case - if (n < DELTA_A_TO_Z) { - return String.fromCharCode(START_LOWERCASE_ALPHABET_CODE + n); - } - n -= DELTA_A_TO_Z; + deserialize({ read }) { + this.version = read(); + this.buildSnapshot = read(); + this.buildDependencies = read(); + this.resolveResults = read(); + this.resolveBuildDependenciesSnapshot = read(); + this.data = read(); + } +} - // upper case - if (n < DELTA_A_TO_Z) { - return String.fromCharCode(START_UPPERCASE_ALPHABET_CODE + n); - } +makeSerializable( + PackContainer, + "webpack/lib/cache/PackFileCacheStrategy", + "PackContainer" +); - if (n === DELTA_A_TO_Z) return "_"; - return "$"; - } +const MIN_CONTENT_SIZE = 1024 * 1024; // 1 MB +const CONTENT_COUNT_TO_MERGE = 10; +const MIN_ITEMS_IN_FRESH_PACK = 100; +const MAX_ITEMS_IN_FRESH_PACK = 50000; +const MAX_TIME_IN_FRESH_PACK = 1 * 60 * 1000; // 1 min +class PackItemInfo { /** - * @param {number} n number to convert to ident - * @returns {string} returns single character ident + * @param {string} identifier identifier of item + * @param {string | null} etag etag of item + * @param {any} value fresh value of item */ - static numberToIdentifierContinuation(n) { - if (n >= NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS) { - // use multiple letters - return ( - Template.numberToIdentifierContinuation( - n % NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS - ) + - Template.numberToIdentifierContinuation( - Math.floor(n / NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS) - ) - ); - } + constructor(identifier, etag, value) { + this.identifier = identifier; + this.etag = etag; + this.location = -1; + this.lastAccess = Date.now(); + this.freshValue = value; + } +} - // lower case - if (n < DELTA_A_TO_Z) { - return String.fromCharCode(START_LOWERCASE_ALPHABET_CODE + n); - } - n -= DELTA_A_TO_Z; +class Pack { + constructor(logger, maxAge) { + /** @type {Map} */ + this.itemInfo = new Map(); + /** @type {string[]} */ + this.requests = []; + this.requestsTimeout = undefined; + /** @type {Map} */ + this.freshContent = new Map(); + /** @type {(undefined | PackContent)[]} */ + this.content = []; + this.invalid = false; + this.logger = logger; + this.maxAge = maxAge; + } - // upper case - if (n < DELTA_A_TO_Z) { - return String.fromCharCode(START_UPPERCASE_ALPHABET_CODE + n); + _addRequest(identifier) { + this.requests.push(identifier); + if (this.requestsTimeout === undefined) { + this.requestsTimeout = setTimeout(() => { + this.requests.push(undefined); + this.requestsTimeout = undefined; + }, MAX_TIME_IN_FRESH_PACK); + if (this.requestsTimeout.unref) this.requestsTimeout.unref(); } - n -= DELTA_A_TO_Z; + } - // numbers - if (n < 10) { - return `${n}`; + stopCapturingRequests() { + if (this.requestsTimeout !== undefined) { + clearTimeout(this.requestsTimeout); + this.requestsTimeout = undefined; } - - if (n === 10) return "_"; - return "$"; } /** - * - * @param {string | string[]} s string to convert to identity - * @returns {string} converted identity + * @param {string} identifier unique name for the resource + * @param {string | null} etag etag of the resource + * @returns {any} cached content */ - static indent(s) { - if (Array.isArray(s)) { - return s.map(Template.indent).join("\n"); + get(identifier, etag) { + const info = this.itemInfo.get(identifier); + this._addRequest(identifier); + if (info === undefined) { + return undefined; + } + if (info.etag !== etag) return null; + info.lastAccess = Date.now(); + const loc = info.location; + if (loc === -1) { + return info.freshValue; } else { - const str = s.trimRight(); - if (!str) return ""; - const ind = str[0] === "\n" ? "" : "\t"; - return ind + str.replace(/\n([^\n])/g, "\n\t$1"); + if (!this.content[loc]) { + return undefined; + } + return this.content[loc].get(identifier); } } /** - * - * @param {string|string[]} s string to create prefix for - * @param {string} prefix prefix to compose - * @returns {string} returns new prefix string + * @param {string} identifier unique name for the resource + * @param {string | null} etag etag of the resource + * @param {any} data cached content + * @returns {void} */ - static prefix(s, prefix) { - const str = Template.asString(s).trim(); - if (!str) return ""; - const ind = str[0] === "\n" ? "" : prefix; - return ind + str.replace(/\n([^\n])/g, "\n" + prefix + "$1"); + set(identifier, etag, data) { + if (!this.invalid) { + this.invalid = true; + this.logger.log(`Pack got invalid because of write to: ${identifier}`); + } + const info = this.itemInfo.get(identifier); + if (info === undefined) { + const newInfo = new PackItemInfo(identifier, etag, data); + this.itemInfo.set(identifier, newInfo); + this._addRequest(identifier); + this.freshContent.set(identifier, newInfo); + } else { + const loc = info.location; + if (loc >= 0) { + this._addRequest(identifier); + this.freshContent.set(identifier, info); + const content = this.content[loc]; + content.delete(identifier); + if (content.items.size === 0) { + this.content[loc] = undefined; + this.logger.debug("Pack %d got empty and is removed", loc); + } + } + info.freshValue = data; + info.lastAccess = Date.now(); + info.etag = etag; + info.location = -1; + } } - /** - * - * @param {string|string[]} str string or string collection - * @returns {string} returns a single string from array - */ - static asString(str) { - if (Array.isArray(str)) { - return str.join("\n"); + getContentStats() { + let count = 0; + let size = 0; + for (const content of this.content) { + if (content !== undefined) { + count++; + const s = content.getSize(); + if (s > 0) { + size += s; + } + } } - return str; + return { count, size }; } /** - * @typedef {Object} WithId - * @property {string|number} id + * @returns {number} new location of data entries */ + _findLocation() { + let i; + for (i = 0; i < this.content.length && this.content[i] !== undefined; i++); + return i; + } - /** - * @param {WithId[]} modules a collection of modules to get array bounds for - * @returns {[number, number] | false} returns the upper and lower array bounds - * or false if not every module has a number based id - */ - static getModulesArrayBounds(modules) { - let maxId = -Infinity; - let minId = Infinity; - for (const module of modules) { - const moduleId = module.id; - if (typeof moduleId !== "number") return false; - if (maxId < moduleId) maxId = moduleId; - if (minId > moduleId) minId = moduleId; - } - if (minId < 16 + ("" + minId).length) { - // add minId x ',' instead of 'Array(minId).concat(…)' - minId = 0; + _gcAndUpdateLocation(items, usedItems, newLoc) { + let count = 0; + let lastGC; + const now = Date.now(); + for (const identifier of items) { + const info = this.itemInfo.get(identifier); + if (now - info.lastAccess > this.maxAge) { + this.itemInfo.delete(identifier); + items.delete(identifier); + usedItems.delete(identifier); + count++; + lastGC = identifier; + } else { + info.location = newLoc; + } } - // start with -1 because the first module needs no comma - let objectOverhead = -1; - for (const module of modules) { - // module id + colon + comma - objectOverhead += `${module.id}`.length + 2; + if (count > 0) { + this.logger.log( + "Garbage Collected %d old items at pack %d (%d items remaining) e. g. %s", + count, + newLoc, + items.size, + lastGC + ); } - // number of commas, or when starting non-zero the length of Array(minId).concat() - const arrayOverhead = minId === 0 ? maxId : 16 + `${minId}`.length + maxId; - return arrayOverhead < objectOverhead ? [minId, maxId] : false; } - /** - * @param {ChunkRenderContext} renderContext render context - * @param {Module[]} modules modules to render (should be ordered by identifier) - * @param {function(Module): Source} renderModule function to render a module - * @param {string=} prefix applying prefix strings - * @returns {Source} rendered chunk modules in a Source object - */ - static renderChunkModules(renderContext, modules, renderModule, prefix = "") { - const { chunkGraph } = renderContext; - var source = new ConcatSource(); - if (modules.length === 0) { - return null; - } - /** @type {{id: string|number, source: Source|string}[]} */ - const allModules = modules.map(module => { - return { - id: chunkGraph.getModuleId(module), - source: renderModule(module) || "false" + _persistFreshContent() { + const itemsCount = this.freshContent.size; + if (itemsCount > 0) { + const packCount = Math.ceil(itemsCount / MAX_ITEMS_IN_FRESH_PACK); + const itemsPerPack = Math.ceil(itemsCount / packCount); + const packs = []; + let i = 0; + let ignoreNextTimeTick = false; + const createNextPack = () => { + const loc = this._findLocation(); + this.content[loc] = null; // reserve + const pack = { + /** @type {Set} */ + items: new Set(), + /** @type {Map} */ + map: new Map(), + loc + }; + packs.push(pack); + return pack; }; - }); - const bounds = Template.getModulesArrayBounds(allModules); - if (bounds) { - // Render a spare array - const minId = bounds[0]; - const maxId = bounds[1]; - if (minId !== 0) { - source.add(`Array(${minId}).concat(`); - } - source.add("[\n"); - /** @type {Map} */ - const modules = new Map(); - for (const module of allModules) { - modules.set(module.id, module); - } - for (let idx = minId; idx <= maxId; idx++) { - const module = modules.get(idx); - if (idx !== minId) { - source.add(",\n"); + let pack = createNextPack(); + if (this.requestsTimeout !== undefined) + clearTimeout(this.requestsTimeout); + for (const identifier of this.requests) { + if (identifier === undefined) { + if (ignoreNextTimeTick) { + ignoreNextTimeTick = false; + } else if (pack.items.size >= MIN_ITEMS_IN_FRESH_PACK) { + i = 0; + pack = createNextPack(); + } + continue; } - source.add(`/* ${idx} */`); - if (module) { - source.add("\n"); - source.add(module.source); + const info = this.freshContent.get(identifier); + if (info === undefined) continue; + pack.items.add(identifier); + pack.map.set(identifier, info.freshValue); + info.location = pack.loc; + info.freshValue = undefined; + this.freshContent.delete(identifier); + if (++i > itemsPerPack) { + i = 0; + pack = createNextPack(); + ignoreNextTimeTick = true; } } - source.add("\n" + prefix + "]"); - if (minId !== 0) { - source.add(")"); - } - } else { - // Render an object - source.add("{\n"); - for (let i = 0; i < allModules.length; i++) { - const module = allModules[i]; - if (i !== 0) { - source.add(",\n"); - } - source.add(`\n/***/ ${JSON.stringify(module.id)}:\n`); - source.add(module.source); + this.requests.length = 0; + for (const pack of packs) { + this.content[pack.loc] = new PackContent( + pack.items, + new Set(pack.items), + new PackContentItems(pack.map) + ); } - source.add(`\n\n${prefix}}`); + this.logger.log( + `${itemsCount} fresh items in cache put into pack ${ + packs.length > 1 + ? packs + .map(pack => `${pack.loc} (${pack.items.size} items)`) + .join(", ") + : packs[0].loc + }` + ); } - return source; } /** - * @param {RuntimeModule[]} runtimeModules array of runtime modules in order - * @param {RenderContext & { codeGenerationResults?: CodeGenerationResults }} renderContext render context - * @returns {Source} rendered runtime modules in a Source object + * Merges small content files to a single content file */ - static renderRuntimeModules(runtimeModules, renderContext) { - const source = new ConcatSource(); - for (const module of runtimeModules) { - const codeGenerationResults = renderContext.codeGenerationResults; - let runtimeSource; - if (codeGenerationResults) { - runtimeSource = codeGenerationResults.getSource( - module, - renderContext.chunk.runtime, - "runtime" - ); + _optimizeSmallContent() { + // 1. Find all small content files + // Treat unused content files separately to avoid + // a merge-split cycle + /** @type {number[]} */ + const smallUsedContents = []; + /** @type {number} */ + let smallUsedContentSize = 0; + /** @type {number[]} */ + const smallUnusedContents = []; + /** @type {number} */ + let smallUnusedContentSize = 0; + for (let i = 0; i < this.content.length; i++) { + const content = this.content[i]; + if (content === undefined) continue; + if (content.outdated) continue; + const size = content.getSize(); + if (size < 0 || size > MIN_CONTENT_SIZE) continue; + if (content.used.size > 0) { + smallUsedContents.push(i); + smallUsedContentSize += size; } else { - const codeGenResult = module.codeGeneration({ - chunkGraph: renderContext.chunkGraph, - dependencyTemplates: renderContext.dependencyTemplates, - moduleGraph: renderContext.moduleGraph, - runtimeTemplate: renderContext.runtimeTemplate, - runtime: renderContext.chunk.runtime, - codeGenerationResults - }); - if (!codeGenResult) continue; - runtimeSource = codeGenResult.sources.get("runtime"); - } - if (runtimeSource) { - source.add(Template.toNormalComment(module.identifier()) + "\n"); - if (!module.shouldIsolate()) { - source.add(runtimeSource); - source.add("\n\n"); - } else if (renderContext.runtimeTemplate.supportsArrowFunction()) { - source.add("(() => {\n"); - source.add(new PrefixSource("\t", runtimeSource)); - source.add("\n})();\n\n"); - } else { - source.add("!function() {\n"); - source.add(new PrefixSource("\t", runtimeSource)); - source.add("\n}();\n\n"); - } + smallUnusedContents.push(i); + smallUnusedContentSize += size; } } - return source; - } - - /** - * @param {RuntimeModule[]} runtimeModules array of runtime modules in order - * @param {RenderContext} renderContext render context - * @returns {Source} rendered chunk runtime modules in a Source object - */ - static renderChunkRuntimeModules(runtimeModules, renderContext) { - return new PrefixSource( - "/******/ ", - new ConcatSource( - "function(__webpack_require__) { // webpackRuntimeModules\n", - this.renderRuntimeModules(runtimeModules, renderContext), - "}\n" - ) - ); - } -} -module.exports = Template; -module.exports.NUMBER_OF_IDENTIFIER_START_CHARS = - NUMBER_OF_IDENTIFIER_START_CHARS; -module.exports.NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS = - NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS; + // 2. Check if minimum number is reached + let mergedIndices; + if ( + smallUsedContents.length >= CONTENT_COUNT_TO_MERGE || + smallUsedContentSize > MIN_CONTENT_SIZE + ) { + mergedIndices = smallUsedContents; + } else if ( + smallUnusedContents.length >= CONTENT_COUNT_TO_MERGE || + smallUnusedContentSize > MIN_CONTENT_SIZE + ) { + mergedIndices = smallUnusedContents; + } else return; + const mergedContent = []; -/***/ }), + // 3. Remove old content entries + for (const i of mergedIndices) { + mergedContent.push(this.content[i]); + this.content[i] = undefined; + } -/***/ 80734: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // 4. Determine merged items + /** @type {Set} */ + const mergedItems = new Set(); + /** @type {Set} */ + const mergedUsedItems = new Set(); + /** @type {(function(Map): Promise)[]} */ + const addToMergedMap = []; + for (const content of mergedContent) { + for (const identifier of content.items) { + mergedItems.add(identifier); + } + for (const identifier of content.used) { + mergedUsedItems.add(identifier); + } + addToMergedMap.push(async map => { + // unpack existing content + // after that values are accessible in .content + await content.unpack( + "it should be merged with other small pack contents" + ); + for (const [identifier, value] of content.content) { + map.set(identifier, value); + } + }); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Jason Anderson @diurnalist -*/ + // 5. GC and update location of merged items + const newLoc = this._findLocation(); + this._gcAndUpdateLocation(mergedItems, mergedUsedItems, newLoc); + // 6. If not empty, store content somewhere + if (mergedItems.size > 0) { + this.content[newLoc] = new PackContent( + mergedItems, + mergedUsedItems, + memoize(async () => { + /** @type {Map} */ + const map = new Map(); + await Promise.all(addToMergedMap.map(fn => fn(map))); + return new PackContentItems(map); + }) + ); + this.logger.log( + "Merged %d small files with %d cache items into pack %d", + mergedContent.length, + mergedItems.size, + newLoc + ); + } + } + /** + * Split large content files with used and unused items + * into two parts to separate used from unused items + */ + _optimizeUnusedContent() { + // 1. Find a large content file with used and unused items + for (let i = 0; i < this.content.length; i++) { + const content = this.content[i]; + if (content === undefined) continue; + const size = content.getSize(); + if (size < MIN_CONTENT_SIZE) continue; + const used = content.used.size; + const total = content.items.size; + if (used > 0 && used < total) { + // 2. Remove this content + this.content[i] = undefined; -const mime = __webpack_require__(78585); -const { basename, extname } = __webpack_require__(71017); -const util = __webpack_require__(73837); -const Chunk = __webpack_require__(39385); -const Module = __webpack_require__(73208); -const { parseResource } = __webpack_require__(82186); + // 3. Determine items for the used content file + const usedItems = new Set(content.used); + const newLoc = this._findLocation(); + this._gcAndUpdateLocation(usedItems, usedItems, newLoc); -/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("./Compilation").PathData} PathData */ -/** @typedef {import("./Compiler")} Compiler */ + // 4. Create content file for used items + if (usedItems.size > 0) { + this.content[newLoc] = new PackContent( + usedItems, + new Set(usedItems), + async () => { + await content.unpack( + "it should be splitted into used and unused items" + ); + const map = new Map(); + for (const identifier of usedItems) { + map.set(identifier, content.content.get(identifier)); + } + return new PackContentItems(map); + } + ); + } -const REGEXP = /\[\\*([\w:]+)\\*\]/gi; + // 5. Determine items for the unused content file + const unusedItems = new Set(content.items); + const usedOfUnusedItems = new Set(); + for (const identifier of usedItems) { + unusedItems.delete(identifier); + } + const newUnusedLoc = this._findLocation(); + this._gcAndUpdateLocation(unusedItems, usedOfUnusedItems, newUnusedLoc); -const prepareId = id => { - if (typeof id !== "string") return id; + // 6. Create content file for unused items + if (unusedItems.size > 0) { + this.content[newUnusedLoc] = new PackContent( + unusedItems, + usedOfUnusedItems, + async () => { + await content.unpack( + "it should be splitted into used and unused items" + ); + const map = new Map(); + for (const identifier of unusedItems) { + map.set(identifier, content.content.get(identifier)); + } + return new PackContentItems(map); + } + ); + } - if (/^"\s\+*.*\+\s*"$/.test(id)) { - const match = /^"\s\+*\s*(.*)\s*\+\s*"$/.exec(id); + this.logger.log( + "Split pack %d into pack %d with %d used items and pack %d with %d unused items", + i, + newLoc, + usedItems.size, + newUnusedLoc, + unusedItems.size + ); - return `" + (${match[1]} + "").replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_") + "`; + // optimizing only one of them is good enough and + // reduces the amount of serialization needed + return; + } + } } - return id.replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_"); -}; - -const hashLength = (replacer, handler, assetInfo, hashName) => { - const fn = (match, arg, input) => { - let result; - const length = arg && parseInt(arg, 10); - - if (length && handler) { - result = handler(length); - } else { - const hash = replacer(match, arg, input); - - result = length ? hash.slice(0, length) : hash; - } - if (assetInfo) { - assetInfo.immutable = true; - if (Array.isArray(assetInfo[hashName])) { - assetInfo[hashName] = [...assetInfo[hashName], result]; - } else if (assetInfo[hashName]) { - assetInfo[hashName] = [assetInfo[hashName], result]; - } else { - assetInfo[hashName] = result; + /** + * Find the content with the oldest item and run GC on that. + * Only runs for one content to avoid large invalidation. + */ + _gcOldestContent() { + /** @type {PackItemInfo} */ + let oldest = undefined; + for (const info of this.itemInfo.values()) { + if (oldest === undefined || info.lastAccess < oldest.lastAccess) { + oldest = info; } } - return result; - }; + if (Date.now() - oldest.lastAccess > this.maxAge) { + const loc = oldest.location; + if (loc < 0) return; + const content = this.content[loc]; + const items = new Set(content.items); + const usedItems = new Set(content.used); + this._gcAndUpdateLocation(items, usedItems, loc); - return fn; -}; + this.content[loc] = + items.size > 0 + ? new PackContent(items, usedItems, async () => { + await content.unpack( + "it contains old items that should be garbage collected" + ); + const map = new Map(); + for (const identifier of items) { + map.set(identifier, content.content.get(identifier)); + } + return new PackContentItems(map); + }) + : undefined; + } + } -const replacer = (value, allowEmpty) => { - const fn = (match, arg, input) => { - if (typeof value === "function") { - value = value(); + serialize({ write, writeSeparate }) { + this._persistFreshContent(); + this._optimizeSmallContent(); + this._optimizeUnusedContent(); + this._gcOldestContent(); + for (const identifier of this.itemInfo.keys()) { + write(identifier); } - if (value === null || value === undefined) { - if (!allowEmpty) { - throw new Error( - `Path variable ${match} not implemented in this context: ${input}` - ); + write(null); // null as marker of the end of keys + for (const info of this.itemInfo.values()) { + write(info.etag); + } + for (const info of this.itemInfo.values()) { + write(info.lastAccess); + } + for (let i = 0; i < this.content.length; i++) { + const content = this.content[i]; + if (content !== undefined) { + write(content.items); + content.writeLazy(lazy => writeSeparate(lazy, { name: `${i}` })); + } else { + write(undefined); // undefined marks an empty content slot } - - return ""; - } else { - return `${value}`; } - }; - - return fn; -}; - -const deprecationCache = new Map(); -const deprecatedFunction = (() => () => {})(); -const deprecated = (fn, message, code) => { - let d = deprecationCache.get(message); - if (d === undefined) { - d = util.deprecate(deprecatedFunction, message, code); - deprecationCache.set(message, d); + write(null); // null as marker of the end of items } - return (...args) => { - d(); - return fn(...args); - }; -}; -/** - * @param {string | function(PathData, AssetInfo=): string} path the raw path - * @param {PathData} data context data - * @param {AssetInfo} assetInfo extra info about the asset (will be written to) - * @returns {string} the interpolated path - */ -const replacePathVariables = (path, data, assetInfo) => { - const chunkGraph = data.chunkGraph; - - /** @type {Map} */ - const replacements = new Map(); - - // Filename context - // - // Placeholders - // - // for /some/path/file.js?query#fragment: - // [file] - /some/path/file.js - // [query] - ?query - // [fragment] - #fragment - // [base] - file.js - // [path] - /some/path/ - // [name] - file - // [ext] - .js - if (typeof data.filename === "string") { - // check that filename is data uri - let match = data.filename.match(/^data:([^;,]+)/); - if (match) { - const ext = mime.extension(match[1]); - const emptyReplacer = replacer("", true); - - replacements.set("file", emptyReplacer); - replacements.set("query", emptyReplacer); - replacements.set("fragment", emptyReplacer); - replacements.set("path", emptyReplacer); - replacements.set("base", emptyReplacer); - replacements.set("name", emptyReplacer); - replacements.set("ext", replacer(ext ? `.${ext}` : "", true)); - // Legacy - replacements.set( - "filebase", - deprecated( - emptyReplacer, - "[filebase] is now [base]", - "DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_FILENAME" - ) - ); - } else { - const { path: file, query, fragment } = parseResource(data.filename); - - const ext = extname(file); - const base = basename(file); - const name = base.slice(0, base.length - ext.length); - const path = file.slice(0, file.length - base.length); - - replacements.set("file", replacer(file)); - replacements.set("query", replacer(query, true)); - replacements.set("fragment", replacer(fragment, true)); - replacements.set("path", replacer(path, true)); - replacements.set("base", replacer(base)); - replacements.set("name", replacer(name)); - replacements.set("ext", replacer(ext, true)); - // Legacy - replacements.set( - "filebase", - deprecated( - replacer(base), - "[filebase] is now [base]", - "DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_FILENAME" - ) - ); + deserialize({ read, logger }) { + this.logger = logger; + { + const items = []; + let item = read(); + while (item !== null) { + items.push(item); + item = read(); + } + this.itemInfo.clear(); + const infoItems = items.map(identifier => { + const info = new PackItemInfo(identifier, undefined, undefined); + this.itemInfo.set(identifier, info); + return info; + }); + for (const info of infoItems) { + info.etag = read(); + } + for (const info of infoItems) { + info.lastAccess = read(); + } + } + this.content.length = 0; + let items = read(); + while (items !== null) { + if (items === undefined) { + this.content.push(items); + } else { + const idx = this.content.length; + const lazy = read(); + this.content.push( + new PackContent( + items, + new Set(), + lazy, + logger, + `${this.content.length}` + ) + ); + for (const identifier of items) { + this.itemInfo.get(identifier).location = idx; + } + } + items = read(); } } +} - // Compilation context - // - // Placeholders - // - // [fullhash] - data.hash (3a4b5c6e7f) - // - // Legacy Placeholders - // - // [hash] - data.hash (3a4b5c6e7f) - if (data.hash) { - const hashReplacer = hashLength( - replacer(data.hash), - data.hashWithLength, - assetInfo, - "fullhash" - ); - - replacements.set("fullhash", hashReplacer); +makeSerializable(Pack, "webpack/lib/cache/PackFileCacheStrategy", "Pack"); - // Legacy - replacements.set( - "hash", - deprecated( - hashReplacer, - "[hash] is now [fullhash] (also consider using [chunkhash] or [contenthash], see documentation for details)", - "DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_HASH" - ) - ); +class PackContentItems { + /** + * @param {Map} map items + */ + constructor(map) { + this.map = map; } - // Chunk Context - // - // Placeholders - // - // [id] - chunk.id (0.js) - // [name] - chunk.name (app.js) - // [chunkhash] - chunk.hash (7823t4t4.js) - // [contenthash] - chunk.contentHash[type] (3256u3zg.js) - if (data.chunk) { - const chunk = data.chunk; - - const contentHashType = data.contentHashType; + serialize({ write, snapshot, rollback, logger, profile }) { + if (profile) { + write(false); + for (const [key, value] of this.map) { + const s = snapshot(); + try { + write(key); + const start = process.hrtime(); + write(value); + const durationHr = process.hrtime(start); + const duration = durationHr[0] * 1000 + durationHr[1] / 1e6; + if (duration > 1) { + if (duration > 500) + logger.error(`Serialization of '${key}': ${duration} ms`); + else if (duration > 50) + logger.warn(`Serialization of '${key}': ${duration} ms`); + else if (duration > 10) + logger.info(`Serialization of '${key}': ${duration} ms`); + else if (duration > 5) + logger.log(`Serialization of '${key}': ${duration} ms`); + else logger.debug(`Serialization of '${key}': ${duration} ms`); + } + } catch (e) { + rollback(s); + if (e === NOT_SERIALIZABLE) continue; + logger.warn( + `Skipped not serializable cache item '${key}': ${e.message}` + ); + logger.debug(e.stack); + } + } + write(null); + return; + } + // Try to serialize all at once + const s = snapshot(); + try { + write(true); + write(this.map); + } catch (e) { + rollback(s); - const idReplacer = replacer(chunk.id); - const nameReplacer = replacer(chunk.name || chunk.id); - const chunkhashReplacer = hashLength( - replacer(chunk instanceof Chunk ? chunk.renderedHash : chunk.hash), - "hashWithLength" in chunk ? chunk.hashWithLength : undefined, - assetInfo, - "chunkhash" - ); - const contenthashReplacer = hashLength( - replacer( - data.contentHash || - (contentHashType && - chunk.contentHash && - chunk.contentHash[contentHashType]) - ), - data.contentHashWithLength || - ("contentHashWithLength" in chunk && chunk.contentHashWithLength - ? chunk.contentHashWithLength[contentHashType] - : undefined), - assetInfo, - "contenthash" - ); + // Try to serialize each item on it's own + write(false); + for (const [key, value] of this.map) { + const s = snapshot(); + try { + write(key); + write(value); + } catch (e) { + rollback(s); + if (e === NOT_SERIALIZABLE) continue; + logger.warn( + `Skipped not serializable cache item '${key}': ${e.message}` + ); + logger.debug(e.stack); + } + } + write(null); + } + } - replacements.set("id", idReplacer); - replacements.set("name", nameReplacer); - replacements.set("chunkhash", chunkhashReplacer); - replacements.set("contenthash", contenthashReplacer); + deserialize({ read, logger, profile }) { + if (read()) { + this.map = read(); + } else if (profile) { + const map = new Map(); + let key = read(); + while (key !== null) { + const start = process.hrtime(); + const value = read(); + const durationHr = process.hrtime(start); + const duration = durationHr[0] * 1000 + durationHr[1] / 1e6; + if (duration > 1) { + if (duration > 100) + logger.error(`Deserialization of '${key}': ${duration} ms`); + else if (duration > 20) + logger.warn(`Deserialization of '${key}': ${duration} ms`); + else if (duration > 5) + logger.info(`Deserialization of '${key}': ${duration} ms`); + else if (duration > 2) + logger.log(`Deserialization of '${key}': ${duration} ms`); + else logger.debug(`Deserialization of '${key}': ${duration} ms`); + } + map.set(key, value); + key = read(); + } + this.map = map; + } else { + const map = new Map(); + let key = read(); + while (key !== null) { + map.set(key, read()); + key = read(); + } + this.map = map; + } } +} - // Module Context - // - // Placeholders - // - // [id] - module.id (2.png) - // [hash] - module.hash (6237543873.png) - // - // Legacy Placeholders - // - // [moduleid] - module.id (2.png) - // [modulehash] - module.hash (6237543873.png) - if (data.module) { - const module = data.module; +makeSerializable( + PackContentItems, + "webpack/lib/cache/PackFileCacheStrategy", + "PackContentItems" +); - const idReplacer = replacer(() => - prepareId( - module instanceof Module ? chunkGraph.getModuleId(module) : module.id - ) - ); - const moduleHashReplacer = hashLength( - replacer(() => - module instanceof Module - ? chunkGraph.getRenderedModuleHash(module, data.runtime) - : module.hash - ), - "hashWithLength" in module ? module.hashWithLength : undefined, - assetInfo, - "modulehash" - ); - const contentHashReplacer = hashLength( - replacer(data.contentHash), - undefined, - assetInfo, - "contenthash" - ); +class PackContent { + /* + This class can be in these states: + | this.lazy | this.content | this.outdated | state + A1 | undefined | Map | false | fresh content + A2 | undefined | Map | true | (will not happen) + B1 | lazy () => {} | undefined | false | not deserialized + B2 | lazy () => {} | undefined | true | not deserialized, but some items has been removed + C1 | lazy* () => {} | Map | false | deserialized + C2 | lazy* () => {} | Map | true | deserialized, and some items has been removed - replacements.set("id", idReplacer); - replacements.set("modulehash", moduleHashReplacer); - replacements.set("contenthash", contentHashReplacer); - replacements.set( - "hash", - data.contentHash ? contentHashReplacer : moduleHashReplacer - ); - // Legacy - replacements.set( - "moduleid", - deprecated( - idReplacer, - "[moduleid] is now [id]", - "DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_MODULE_ID" - ) - ); - } + this.used is a subset of this.items. + this.items is a subset of this.content.keys() resp. this.lazy().map.keys() + When this.outdated === false, this.items === this.content.keys() resp. this.lazy().map.keys() + When this.outdated === true, this.items should be used to recreated this.lazy/this.content. + When this.lazy and this.content is set, they contain the same data. + this.get must only be called with a valid item from this.items. + In state C this.lazy is unMemoized + */ - // Other things - if (data.url) { - replacements.set("url", replacer(data.url)); - } - if (typeof data.runtime === "string") { - replacements.set( - "runtime", - replacer(() => prepareId(data.runtime)) - ); - } else { - replacements.set("runtime", replacer("_")); + /** + * @param {Set} items keys + * @param {Set} usedItems used keys + * @param {PackContentItems | function(): Promise} dataOrFn sync or async content + * @param {Logger=} logger logger for logging + * @param {string=} lazyName name of dataOrFn for logging + */ + constructor(items, usedItems, dataOrFn, logger, lazyName) { + this.items = items; + /** @type {function(): Promise | PackContentItems} */ + this.lazy = typeof dataOrFn === "function" ? dataOrFn : undefined; + /** @type {Map} */ + this.content = typeof dataOrFn === "function" ? undefined : dataOrFn.map; + this.outdated = false; + this.used = usedItems; + this.logger = logger; + this.lazyName = lazyName; } - if (typeof path === "function") { - path = path(data, assetInfo); - } + get(identifier) { + this.used.add(identifier); + if (this.content) { + return this.content.get(identifier); + } - path = path.replace(REGEXP, (match, content) => { - if (content.length + 2 === match.length) { - const contentMatch = /^(\w+)(?::(\w+))?$/.exec(content); - if (!contentMatch) return match; - const [, kind, arg] = contentMatch; - const replacer = replacements.get(kind); - if (replacer !== undefined) { - return replacer(match, arg, path); + // We are in state B + const { lazyName } = this; + let timeMessage; + if (lazyName) { + // only log once + this.lazyName = undefined; + timeMessage = `restore cache content ${lazyName} (${formatSize( + this.getSize() + )})`; + this.logger.log( + `starting to restore cache content ${lazyName} (${formatSize( + this.getSize() + )}) because of request to: ${identifier}` + ); + this.logger.time(timeMessage); + } + const value = this.lazy(); + if ("then" in value) { + return value.then(data => { + const map = data.map; + if (timeMessage) { + this.logger.timeEnd(timeMessage); + } + // Move to state C + this.content = map; + this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy); + return map.get(identifier); + }); + } else { + const map = value.map; + if (timeMessage) { + this.logger.timeEnd(timeMessage); } - } else if (match.startsWith("[\\") && match.endsWith("\\]")) { - return `[${match.slice(2, -2)}]`; + // Move to state C + this.content = map; + this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy); + return map.get(identifier); } - return match; - }); + } - return path; -}; + /** + * @param {string} reason explanation why unpack is necessary + * @returns {void | Promise} maybe a promise if lazy + */ + unpack(reason) { + if (this.content) return; -const plugin = "TemplatedPathPlugin"; + // Move from state B to C + if (this.lazy) { + const { lazyName } = this; + let timeMessage; + if (lazyName) { + // only log once + this.lazyName = undefined; + timeMessage = `unpack cache content ${lazyName} (${formatSize( + this.getSize() + )})`; + this.logger.log( + `starting to unpack cache content ${lazyName} (${formatSize( + this.getSize() + )}) because ${reason}` + ); + this.logger.time(timeMessage); + } + const value = this.lazy(); + if ("then" in value) { + return value.then(data => { + if (timeMessage) { + this.logger.timeEnd(timeMessage); + } + this.content = data.map; + }); + } else { + if (timeMessage) { + this.logger.timeEnd(timeMessage); + } + this.content = value.map; + } + } + } -class TemplatedPathPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @returns {number} size of the content or -1 if not known */ - apply(compiler) { - compiler.hooks.compilation.tap(plugin, compilation => { - compilation.hooks.assetPath.tap(plugin, replacePathVariables); - }); + getSize() { + if (!this.lazy) return -1; + const options = /** @type {any} */ (this.lazy).options; + if (!options) return -1; + const size = options.size; + if (typeof size !== "number") return -1; + return size; } -} - -module.exports = TemplatedPathPlugin; - - -/***/ }), -/***/ 68099: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + delete(identifier) { + this.items.delete(identifier); + this.used.delete(identifier); + this.outdated = true; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ - - - -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); - -class UnhandledSchemeError extends WebpackError { - /** - * @param {string} scheme scheme - * @param {string} resource resource - */ - constructor(scheme, resource) { - super( - `Reading from "${resource}" is not handled by plugins (Unhandled scheme).` + - '\nWebpack supports "data:" and "file:" URIs by default.' + - `\nYou may need an additional plugin to handle "${scheme}:" URIs.` - ); - this.file = resource; - this.name = "UnhandledSchemeError"; - } -} - -makeSerializable( - UnhandledSchemeError, - "webpack/lib/UnhandledSchemeError", - "UnhandledSchemeError" -); - -module.exports = UnhandledSchemeError; - - -/***/ }), - -/***/ 42495: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); - -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ - -class UnsupportedFeatureWarning extends WebpackError { - /** - * @param {string} message description of warning - * @param {DependencyLocation} loc location start and end positions of the module - */ - constructor(message, loc) { - super(message); - - this.name = "UnsupportedFeatureWarning"; - this.loc = loc; - this.hideStack = true; - } -} - -makeSerializable( - UnsupportedFeatureWarning, - "webpack/lib/UnsupportedFeatureWarning" -); - -module.exports = UnsupportedFeatureWarning; - - -/***/ }), - -/***/ 36803: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const ConstDependency = __webpack_require__(76911); - -/** @typedef {import("./Compiler")} Compiler */ - -class UseStrictPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @template T + * @param {function(any): function(): Promise | PackContentItems} write write function * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap( - "UseStrictPlugin", - (compilation, { normalModuleFactory }) => { - const handler = parser => { - parser.hooks.program.tap("UseStrictPlugin", ast => { - const firstNode = ast.body[0]; - if ( - firstNode && - firstNode.type === "ExpressionStatement" && - firstNode.expression.type === "Literal" && - firstNode.expression.value === "use strict" - ) { - // Remove "use strict" expression. It will be added later by the renderer again. - // This is necessary in order to not break the strict mode when webpack prepends code. - // @see https://github.com/webpack/webpack/issues/1970 - const dep = new ConstDependency("", firstNode.range); - dep.loc = firstNode.loc; - parser.state.module.addPresentationalDependency(dep); - parser.state.module.buildInfo.strict = true; - } - }); - }; - - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("UseStrictPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("UseStrictPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("UseStrictPlugin", handler); + writeLazy(write) { + if (!this.outdated && this.lazy) { + // State B1 or C1 + // this.lazy is still the valid deserialized version + write(this.lazy); + return; + } + if (!this.outdated && this.content) { + // State A1 + const map = new Map(this.content); + // Move to state C1 + this.lazy = SerializerMiddleware.unMemoizeLazy( + write(() => new PackContentItems(map)) + ); + return; + } + if (this.content) { + // State A2 or C2 + /** @type {Map} */ + const map = new Map(); + for (const item of this.items) { + map.set(item, this.content.get(item)); } - ); - } -} - -module.exports = UseStrictPlugin; - - -/***/ }), - -/***/ 56504: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const CaseSensitiveModulesWarning = __webpack_require__(77975); - -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Module")} Module */ - -class WarnCaseSensitiveModulesPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "WarnCaseSensitiveModulesPlugin", - compilation => { - compilation.hooks.seal.tap("WarnCaseSensitiveModulesPlugin", () => { - /** @type {Map>} */ - const moduleWithoutCase = new Map(); - for (const module of compilation.modules) { - const identifier = module.identifier(); - const lowerIdentifier = identifier.toLowerCase(); - let map = moduleWithoutCase.get(lowerIdentifier); - if (map === undefined) { - map = new Map(); - moduleWithoutCase.set(lowerIdentifier, map); - } - map.set(identifier, module); + // Move to state C1 + this.outdated = false; + this.content = map; + this.lazy = SerializerMiddleware.unMemoizeLazy( + write(() => new PackContentItems(map)) + ); + return; + } + // State B2 + const { lazyName } = this; + let timeMessage; + if (lazyName) { + // only log once + this.lazyName = undefined; + timeMessage = `unpack cache content ${lazyName} (${formatSize( + this.getSize() + )})`; + this.logger.log( + `starting to unpack cache content ${lazyName} (${formatSize( + this.getSize() + )}) because it's outdated and need to be serialized` + ); + this.logger.time(timeMessage); + } + const value = this.lazy(); + this.outdated = false; + if ("then" in value) { + // Move to state B1 + this.lazy = write(() => + value.then(data => { + if (timeMessage) { + this.logger.timeEnd(timeMessage); } - for (const pair of moduleWithoutCase) { - const map = pair[1]; - if (map.size > 1) { - compilation.warnings.push( - new CaseSensitiveModulesWarning( - map.values(), - compilation.moduleGraph - ) - ); - } + const oldMap = data.map; + /** @type {Map} */ + const map = new Map(); + for (const item of this.items) { + map.set(item, oldMap.get(item)); } - }); - } - ); - } -} - -module.exports = WarnCaseSensitiveModulesPlugin; - - -/***/ }), - -/***/ 76537: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent -*/ - - - -const WebpackError = __webpack_require__(53799); - -/** @typedef {import("./Compiler")} Compiler */ - -class WarnDeprecatedOptionPlugin { - /** - * Create an instance of the plugin - * @param {string} option the target option - * @param {string | number} value the deprecated option value - * @param {string} suggestion the suggestion replacement - */ - constructor(option, value, suggestion) { - this.option = option; - this.value = value; - this.suggestion = suggestion; - } + // Move to state C1 (or maybe C2) + this.content = map; + this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy); - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - "WarnDeprecatedOptionPlugin", - compilation => { - compilation.warnings.push( - new DeprecatedOptionWarning(this.option, this.value, this.suggestion) - ); + return new PackContentItems(map); + }) + ); + } else { + // Move to state C1 + if (timeMessage) { + this.logger.timeEnd(timeMessage); } - ); + const oldMap = value.map; + /** @type {Map} */ + const map = new Map(); + for (const item of this.items) { + map.set(item, oldMap.get(item)); + } + this.content = map; + this.lazy = write(() => new PackContentItems(map)); + } } } -class DeprecatedOptionWarning extends WebpackError { - constructor(option, value, suggestion) { - super(); - - this.name = "DeprecatedOptionWarning"; - this.message = - "configuration\n" + - `The value '${value}' for option '${option}' is deprecated. ` + - `Use '${suggestion}' instead.`; +const allowCollectingMemory = buf => { + const wasted = buf.buffer.byteLength - buf.byteLength; + if (wasted > 8192 && (wasted > 1048576 || wasted > buf.byteLength)) { + return Buffer.from(buf); } -} - -module.exports = WarnDeprecatedOptionPlugin; - - -/***/ }), - -/***/ 25295: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const NoModeWarning = __webpack_require__(80832); - -/** @typedef {import("./Compiler")} Compiler */ + return buf; +}; -class WarnNoModeSetPlugin { +class PackFileCacheStrategy { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {Object} options options + * @param {Compiler} options.compiler the compiler + * @param {IntermediateFileSystem} options.fs the filesystem + * @param {string} options.context the context directory + * @param {string} options.cacheLocation the location of the cache data + * @param {string} options.version version identifier + * @param {Logger} options.logger a logger + * @param {SnapshotOptions} options.snapshot options regarding snapshotting + * @param {number} options.maxAge max age of cache items + * @param {boolean} options.profile track and log detailed timing information for individual cache items + * @param {boolean} options.allowCollectingMemory allow to collect unused memory created during deserialization + * @param {false | "gzip" | "brotli"} options.compression compression used */ - apply(compiler) { - compiler.hooks.thisCompilation.tap("WarnNoModeSetPlugin", compilation => { - compilation.warnings.push(new NoModeWarning()); + constructor({ + compiler, + fs, + context, + cacheLocation, + version, + logger, + snapshot, + maxAge, + profile, + allowCollectingMemory, + compression + }) { + this.fileSerializer = createFileSerializer( + fs, + compiler.options.output.hashFunction + ); + this.fileSystemInfo = new FileSystemInfo(fs, { + managedPaths: snapshot.managedPaths, + immutablePaths: snapshot.immutablePaths, + logger: logger.getChildLogger("webpack.FileSystemInfo"), + hashFunction: compiler.options.output.hashFunction }); + this.compiler = compiler; + this.context = context; + this.cacheLocation = cacheLocation; + this.version = version; + this.logger = logger; + this.maxAge = maxAge; + this.profile = profile; + this.allowCollectingMemory = allowCollectingMemory; + this.compression = compression; + this._extension = + compression === "brotli" + ? ".pack.br" + : compression === "gzip" + ? ".pack.gz" + : ".pack"; + this.snapshot = snapshot; + /** @type {Set} */ + this.buildDependencies = new Set(); + /** @type {LazySet} */ + this.newBuildDependencies = new LazySet(); + /** @type {Snapshot} */ + this.resolveBuildDependenciesSnapshot = undefined; + /** @type {Map} */ + this.resolveResults = undefined; + /** @type {Snapshot} */ + this.buildSnapshot = undefined; + /** @type {Promise} */ + this.packPromise = this._openPack(); + this.storePromise = Promise.resolve(); } -} - -module.exports = WarnNoModeSetPlugin; - - -/***/ }), - -/***/ 65193: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { groupBy } = __webpack_require__(84953); -const createSchemaValidation = __webpack_require__(32540); - -/** @typedef {import("../declarations/plugins/WatchIgnorePlugin").WatchIgnorePluginOptions} WatchIgnorePluginOptions */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */ -const validate = createSchemaValidation( - __webpack_require__(16711), - () => __webpack_require__(44246), - { - name: "Watch Ignore Plugin", - baseDataPath: "options" + _getPack() { + if (this.packPromise === undefined) { + this.packPromise = this.storePromise.then(() => this._openPack()); + } + return this.packPromise; } -); -const IGNORE_TIME_ENTRY = "ignore"; - -class IgnoringWatchFileSystem { /** - * @param {WatchFileSystem} wfs original file system - * @param {(string|RegExp)[]} paths ignored paths + * @returns {Promise} the pack */ - constructor(wfs, paths) { - this.wfs = wfs; - this.paths = paths; - } - - watch(files, dirs, missing, startTime, options, callback, callbackUndelayed) { - files = Array.from(files); - dirs = Array.from(dirs); - const ignored = path => - this.paths.some(p => - p instanceof RegExp ? p.test(path) : path.indexOf(p) === 0 - ); - - const [ignoredFiles, notIgnoredFiles] = groupBy(files, ignored); - const [ignoredDirs, notIgnoredDirs] = groupBy(dirs, ignored); - - const watcher = this.wfs.watch( - notIgnoredFiles, - notIgnoredDirs, - missing, - startTime, - options, - (err, fileTimestamps, dirTimestamps, changedFiles, removedFiles) => { - if (err) return callback(err); - for (const path of ignoredFiles) { - fileTimestamps.set(path, IGNORE_TIME_ENTRY); - } - - for (const path of ignoredDirs) { - dirTimestamps.set(path, IGNORE_TIME_ENTRY); - } - - callback( - err, - fileTimestamps, - dirTimestamps, - changedFiles, - removedFiles - ); - }, - callbackUndelayed - ); - - return { - close: () => watcher.close(), - pause: () => watcher.pause(), - getContextTimeInfoEntries: () => { - const dirTimestamps = watcher.getContextTimeInfoEntries(); - for (const path of ignoredDirs) { - dirTimestamps.set(path, IGNORE_TIME_ENTRY); + _openPack() { + const { logger, profile, cacheLocation, version } = this; + /** @type {Snapshot} */ + let buildSnapshot; + /** @type {Set} */ + let buildDependencies; + /** @type {Set} */ + let newBuildDependencies; + /** @type {Snapshot} */ + let resolveBuildDependenciesSnapshot; + /** @type {Map} */ + let resolveResults; + logger.time("restore cache container"); + return this.fileSerializer + .deserialize(null, { + filename: `${cacheLocation}/index${this._extension}`, + extension: `${this._extension}`, + logger, + profile, + retainedBuffer: this.allowCollectingMemory + ? allowCollectingMemory + : undefined + }) + .catch(err => { + if (err.code !== "ENOENT") { + logger.warn( + `Restoring pack failed from ${cacheLocation}${this._extension}: ${err}` + ); + logger.debug(err.stack); + } else { + logger.debug( + `No pack exists at ${cacheLocation}${this._extension}: ${err}` + ); } - return dirTimestamps; - }, - getFileTimeInfoEntries: () => { - const fileTimestamps = watcher.getFileTimeInfoEntries(); - for (const path of ignoredFiles) { - fileTimestamps.set(path, IGNORE_TIME_ENTRY); + return undefined; + }) + .then(packContainer => { + logger.timeEnd("restore cache container"); + if (!packContainer) return undefined; + if (!(packContainer instanceof PackContainer)) { + logger.warn( + `Restored pack from ${cacheLocation}${this._extension}, but contained content is unexpected.`, + packContainer + ); + return undefined; } - return fileTimestamps; - }, - getInfo: - watcher.getInfo && - (() => { - const info = watcher.getInfo(); - const { fileTimeInfoEntries, contextTimeInfoEntries } = info; - for (const path of ignoredFiles) { - fileTimeInfoEntries.set(path, IGNORE_TIME_ENTRY); - } - for (const path of ignoredDirs) { - contextTimeInfoEntries.set(path, IGNORE_TIME_ENTRY); - } - return info; - }) - }; + if (packContainer.version !== version) { + logger.log( + `Restored pack from ${cacheLocation}${this._extension}, but version doesn't match.` + ); + return undefined; + } + logger.time("check build dependencies"); + return Promise.all([ + new Promise((resolve, reject) => { + this.fileSystemInfo.checkSnapshotValid( + packContainer.buildSnapshot, + (err, valid) => { + if (err) { + logger.log( + `Restored pack from ${cacheLocation}${this._extension}, but checking snapshot of build dependencies errored: ${err}.` + ); + logger.debug(err.stack); + return resolve(false); + } + if (!valid) { + logger.log( + `Restored pack from ${cacheLocation}${this._extension}, but build dependencies have changed.` + ); + return resolve(false); + } + buildSnapshot = packContainer.buildSnapshot; + return resolve(true); + } + ); + }), + new Promise((resolve, reject) => { + this.fileSystemInfo.checkSnapshotValid( + packContainer.resolveBuildDependenciesSnapshot, + (err, valid) => { + if (err) { + logger.log( + `Restored pack from ${cacheLocation}${this._extension}, but checking snapshot of resolving of build dependencies errored: ${err}.` + ); + logger.debug(err.stack); + return resolve(false); + } + if (valid) { + resolveBuildDependenciesSnapshot = + packContainer.resolveBuildDependenciesSnapshot; + buildDependencies = packContainer.buildDependencies; + resolveResults = packContainer.resolveResults; + return resolve(true); + } + logger.log( + "resolving of build dependencies is invalid, will re-resolve build dependencies" + ); + this.fileSystemInfo.checkResolveResultsValid( + packContainer.resolveResults, + (err, valid) => { + if (err) { + logger.log( + `Restored pack from ${cacheLocation}${this._extension}, but resolving of build dependencies errored: ${err}.` + ); + logger.debug(err.stack); + return resolve(false); + } + if (valid) { + newBuildDependencies = packContainer.buildDependencies; + resolveResults = packContainer.resolveResults; + return resolve(true); + } + logger.log( + `Restored pack from ${cacheLocation}${this._extension}, but build dependencies resolve to different locations.` + ); + return resolve(false); + } + ); + } + ); + }) + ]) + .catch(err => { + logger.timeEnd("check build dependencies"); + throw err; + }) + .then(([buildSnapshotValid, resolveValid]) => { + logger.timeEnd("check build dependencies"); + if (buildSnapshotValid && resolveValid) { + logger.time("restore cache content metadata"); + const d = packContainer.data(); + logger.timeEnd("restore cache content metadata"); + return d; + } + return undefined; + }); + }) + .then(pack => { + if (pack) { + pack.maxAge = this.maxAge; + this.buildSnapshot = buildSnapshot; + if (buildDependencies) this.buildDependencies = buildDependencies; + if (newBuildDependencies) + this.newBuildDependencies.addAll(newBuildDependencies); + this.resolveResults = resolveResults; + this.resolveBuildDependenciesSnapshot = + resolveBuildDependenciesSnapshot; + return pack; + } + return new Pack(logger, this.maxAge); + }) + .catch(err => { + this.logger.warn( + `Restoring pack from ${cacheLocation}${this._extension} failed: ${err}` + ); + this.logger.debug(err.stack); + return new Pack(logger, this.maxAge); + }); } -} -class WatchIgnorePlugin { /** - * @param {WatchIgnorePluginOptions} options options + * @param {string} identifier unique name for the resource + * @param {Etag | null} etag etag of the resource + * @param {any} data cached content + * @returns {Promise} promise */ - constructor(options) { - validate(options); - this.paths = options.paths; + store(identifier, etag, data) { + return this._getPack().then(pack => { + pack.set(identifier, etag === null ? null : etag.toString(), data); + }); } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {string} identifier unique name for the resource + * @param {Etag | null} etag etag of the resource + * @returns {Promise} promise to the cached content */ - apply(compiler) { - compiler.hooks.afterEnvironment.tap("WatchIgnorePlugin", () => { - compiler.watchFileSystem = new IgnoringWatchFileSystem( - compiler.watchFileSystem, - this.paths - ); - }); + restore(identifier, etag) { + return this._getPack() + .then(pack => + pack.get(identifier, etag === null ? null : etag.toString()) + ) + .catch(err => { + if (err && err.code !== "ENOENT") { + this.logger.warn( + `Restoring failed for ${identifier} from pack: ${err}` + ); + this.logger.debug(err.stack); + } + }); + } + + storeBuildDependencies(dependencies) { + this.newBuildDependencies.addAll(dependencies); + } + + afterAllStored() { + const packPromise = this.packPromise; + if (packPromise === undefined) return Promise.resolve(); + const reportProgress = ProgressPlugin.getReporter(this.compiler); + return (this.storePromise = packPromise + .then(pack => { + pack.stopCapturingRequests(); + if (!pack.invalid) return; + this.packPromise = undefined; + this.logger.log(`Storing pack...`); + let promise; + const newBuildDependencies = new Set(); + for (const dep of this.newBuildDependencies) { + if (!this.buildDependencies.has(dep)) { + newBuildDependencies.add(dep); + } + } + if (newBuildDependencies.size > 0 || !this.buildSnapshot) { + if (reportProgress) reportProgress(0.5, "resolve build dependencies"); + this.logger.debug( + `Capturing build dependencies... (${Array.from( + newBuildDependencies + ).join(", ")})` + ); + promise = new Promise((resolve, reject) => { + this.logger.time("resolve build dependencies"); + this.fileSystemInfo.resolveBuildDependencies( + this.context, + newBuildDependencies, + (err, result) => { + this.logger.timeEnd("resolve build dependencies"); + if (err) return reject(err); + + this.logger.time("snapshot build dependencies"); + const { + files, + directories, + missing, + resolveResults, + resolveDependencies + } = result; + if (this.resolveResults) { + for (const [key, value] of resolveResults) { + this.resolveResults.set(key, value); + } + } else { + this.resolveResults = resolveResults; + } + if (reportProgress) { + reportProgress( + 0.6, + "snapshot build dependencies", + "resolving" + ); + } + this.fileSystemInfo.createSnapshot( + undefined, + resolveDependencies.files, + resolveDependencies.directories, + resolveDependencies.missing, + this.snapshot.resolveBuildDependencies, + (err, snapshot) => { + if (err) { + this.logger.timeEnd("snapshot build dependencies"); + return reject(err); + } + if (!snapshot) { + this.logger.timeEnd("snapshot build dependencies"); + return reject( + new Error("Unable to snapshot resolve dependencies") + ); + } + if (this.resolveBuildDependenciesSnapshot) { + this.resolveBuildDependenciesSnapshot = + this.fileSystemInfo.mergeSnapshots( + this.resolveBuildDependenciesSnapshot, + snapshot + ); + } else { + this.resolveBuildDependenciesSnapshot = snapshot; + } + if (reportProgress) { + reportProgress( + 0.7, + "snapshot build dependencies", + "modules" + ); + } + this.fileSystemInfo.createSnapshot( + undefined, + files, + directories, + missing, + this.snapshot.buildDependencies, + (err, snapshot) => { + this.logger.timeEnd("snapshot build dependencies"); + if (err) return reject(err); + if (!snapshot) { + return reject( + new Error("Unable to snapshot build dependencies") + ); + } + this.logger.debug("Captured build dependencies"); + + if (this.buildSnapshot) { + this.buildSnapshot = + this.fileSystemInfo.mergeSnapshots( + this.buildSnapshot, + snapshot + ); + } else { + this.buildSnapshot = snapshot; + } + + resolve(); + } + ); + } + ); + } + ); + }); + } else { + promise = Promise.resolve(); + } + return promise.then(() => { + if (reportProgress) reportProgress(0.8, "serialize pack"); + this.logger.time(`store pack`); + const updatedBuildDependencies = new Set(this.buildDependencies); + for (const dep of newBuildDependencies) { + updatedBuildDependencies.add(dep); + } + const content = new PackContainer( + pack, + this.version, + this.buildSnapshot, + updatedBuildDependencies, + this.resolveResults, + this.resolveBuildDependenciesSnapshot + ); + return this.fileSerializer + .serialize(content, { + filename: `${this.cacheLocation}/index${this._extension}`, + extension: `${this._extension}`, + logger: this.logger, + profile: this.profile + }) + .then(() => { + for (const dep of newBuildDependencies) { + this.buildDependencies.add(dep); + } + this.newBuildDependencies.clear(); + this.logger.timeEnd(`store pack`); + const stats = pack.getContentStats(); + this.logger.log( + "Stored pack (%d items, %d files, %d MiB)", + pack.itemInfo.size, + stats.count, + Math.round(stats.size / 1024 / 1024) + ); + }) + .catch(err => { + this.logger.timeEnd(`store pack`); + this.logger.warn(`Caching failed for pack: ${err}`); + this.logger.debug(err.stack); + }); + }); + }) + .catch(err => { + this.logger.warn(`Caching failed for pack: ${err}`); + this.logger.debug(err.stack); + })); + } + + clear() { + this.fileSystemInfo.clear(); + this.buildDependencies.clear(); + this.newBuildDependencies.clear(); + this.resolveBuildDependenciesSnapshot = undefined; + this.resolveResults = undefined; + this.buildSnapshot = undefined; + this.packPromise = undefined; } } -module.exports = WatchIgnorePlugin; +module.exports = PackFileCacheStrategy; /***/ }), -/***/ 84275: +/***/ 97347: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -63986,646 +62592,469 @@ module.exports = WatchIgnorePlugin; -const Stats = __webpack_require__(31743); +const LazySet = __webpack_require__(38938); +const makeSerializable = __webpack_require__(33032); -/** @typedef {import("../declarations/WebpackOptions").WatchOptions} WatchOptions */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */ +/** @typedef {import("enhanced-resolve/lib/Resolver")} Resolver */ +/** @typedef {import("../CacheFacade").ItemCacheFacade} ItemCacheFacade */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../FileSystemInfo")} FileSystemInfo */ +/** @typedef {import("../FileSystemInfo").Snapshot} Snapshot */ + +class CacheEntry { + constructor(result, snapshot) { + this.result = result; + this.snapshot = snapshot; + } + + serialize({ write }) { + write(this.result); + write(this.snapshot); + } + + deserialize({ read }) { + this.result = read(); + this.snapshot = read(); + } +} + +makeSerializable(CacheEntry, "webpack/lib/cache/ResolverCachePlugin"); /** * @template T - * @callback Callback - * @param {(Error | null)=} err - * @param {T=} result + * @param {Set | LazySet} set set to add items to + * @param {Set | LazySet} otherSet set to add items from + * @returns {void} */ - -class Watching { - /** - * @param {Compiler} compiler the compiler - * @param {WatchOptions} watchOptions options - * @param {Callback} handler completion handler - */ - constructor(compiler, watchOptions, handler) { - this.startTime = null; - this.invalid = false; - this.handler = handler; - /** @type {Callback[]} */ - this.callbacks = []; - /** @type {Callback[] | undefined} */ - this._closeCallbacks = undefined; - this.closed = false; - this.suspended = false; - this.blocked = false; - this._isBlocked = () => false; - this._onChange = () => {}; - this._onInvalid = () => {}; - if (typeof watchOptions === "number") { - this.watchOptions = { - aggregateTimeout: watchOptions - }; - } else if (watchOptions && typeof watchOptions === "object") { - this.watchOptions = { ...watchOptions }; - } else { - this.watchOptions = {}; - } - if (typeof this.watchOptions.aggregateTimeout !== "number") { - this.watchOptions.aggregateTimeout = 20; +const addAllToSet = (set, otherSet) => { + if (set instanceof LazySet) { + set.addAll(otherSet); + } else { + for (const item of otherSet) { + set.add(item); } - this.compiler = compiler; - this.running = false; - this._initial = true; - this._invalidReported = true; - this._needRecords = true; - this.watcher = undefined; - this.pausedWatcher = undefined; - /** @type {Set} */ - this._collectedChangedFiles = undefined; - /** @type {Set} */ - this._collectedRemovedFiles = undefined; - this._done = this._done.bind(this); - process.nextTick(() => { - if (this._initial) this._invalidate(); - }); } +}; - /** - * @param {ReadonlySet} changedFiles changed files - * @param {ReadonlySet} removedFiles removed files - */ - _mergeWithCollected(changedFiles, removedFiles) { - if (!changedFiles) return; - if (!this._collectedChangedFiles) { - this._collectedChangedFiles = new Set(changedFiles); - this._collectedRemovedFiles = new Set(removedFiles); +/** + * @param {Object} object an object + * @param {boolean} excludeContext if true, context is not included in string + * @returns {string} stringified version + */ +const objectToString = (object, excludeContext) => { + let str = ""; + for (const key in object) { + if (excludeContext && key === "context") continue; + const value = object[key]; + if (typeof value === "object" && value !== null) { + str += `|${key}=[${objectToString(value, false)}|]`; } else { - for (const file of changedFiles) { - this._collectedChangedFiles.add(file); - this._collectedRemovedFiles.delete(file); - } - for (const file of removedFiles) { - this._collectedChangedFiles.delete(file); - this._collectedRemovedFiles.add(file); - } + str += `|${key}=|${value}`; } } + return str; +}; +class ResolverCachePlugin { /** - * @param {ReadonlyMap=} fileTimeInfoEntries info for files - * @param {ReadonlyMap=} contextTimeInfoEntries info for directories - * @param {ReadonlySet=} changedFiles changed files - * @param {ReadonlySet=} removedFiles removed files + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - _go(fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles) { - this._initial = false; - if (this.startTime === null) this.startTime = Date.now(); - this.running = true; - if (this.watcher) { - this.pausedWatcher = this.watcher; - this.lastWatcherStartTime = Date.now(); - this.watcher.pause(); - this.watcher = null; - } else if (!this.lastWatcherStartTime) { - this.lastWatcherStartTime = Date.now(); - } - this.compiler.fsStartTime = Date.now(); - if ( - changedFiles && - removedFiles && - fileTimeInfoEntries && - contextTimeInfoEntries - ) { - this._mergeWithCollected(changedFiles, removedFiles); - this.compiler.fileTimestamps = fileTimeInfoEntries; - this.compiler.contextTimestamps = contextTimeInfoEntries; - } else if (this.pausedWatcher) { - if (this.pausedWatcher.getInfo) { - const { - changes, - removals, - fileTimeInfoEntries, - contextTimeInfoEntries - } = this.pausedWatcher.getInfo(); - this._mergeWithCollected(changes, removals); - this.compiler.fileTimestamps = fileTimeInfoEntries; - this.compiler.contextTimestamps = contextTimeInfoEntries; - } else { - this._mergeWithCollected( - this.pausedWatcher.getAggregatedChanges && - this.pausedWatcher.getAggregatedChanges(), - this.pausedWatcher.getAggregatedRemovals && - this.pausedWatcher.getAggregatedRemovals() + apply(compiler) { + const cache = compiler.getCache("ResolverCachePlugin"); + /** @type {FileSystemInfo} */ + let fileSystemInfo; + let snapshotOptions; + let realResolves = 0; + let cachedResolves = 0; + let cacheInvalidResolves = 0; + let concurrentResolves = 0; + compiler.hooks.thisCompilation.tap("ResolverCachePlugin", compilation => { + snapshotOptions = compilation.options.snapshot.resolve; + fileSystemInfo = compilation.fileSystemInfo; + compilation.hooks.finishModules.tap("ResolverCachePlugin", () => { + if (realResolves + cachedResolves > 0) { + const logger = compilation.getLogger("webpack.ResolverCachePlugin"); + logger.log( + `${Math.round( + (100 * realResolves) / (realResolves + cachedResolves) + )}% really resolved (${realResolves} real resolves with ${cacheInvalidResolves} cached but invalid, ${cachedResolves} cached valid, ${concurrentResolves} concurrent)` + ); + realResolves = 0; + cachedResolves = 0; + cacheInvalidResolves = 0; + concurrentResolves = 0; + } + }); + }); + /** + * @param {ItemCacheFacade} itemCache cache + * @param {Resolver} resolver the resolver + * @param {Object} resolveContext context for resolving meta info + * @param {Object} request the request info object + * @param {function((Error | null)=, Object=): void} callback callback function + * @returns {void} + */ + const doRealResolve = ( + itemCache, + resolver, + resolveContext, + request, + callback + ) => { + realResolves++; + const newRequest = { + _ResolverCachePluginCacheMiss: true, + ...request + }; + const newResolveContext = { + ...resolveContext, + stack: new Set(), + missingDependencies: new LazySet(), + fileDependencies: new LazySet(), + contextDependencies: new LazySet() + }; + const propagate = key => { + if (resolveContext[key]) { + addAllToSet(resolveContext[key], newResolveContext[key]); + } + }; + const resolveTime = Date.now(); + resolver.doResolve( + resolver.hooks.resolve, + newRequest, + "Cache miss", + newResolveContext, + (err, result) => { + propagate("fileDependencies"); + propagate("contextDependencies"); + propagate("missingDependencies"); + if (err) return callback(err); + const fileDependencies = newResolveContext.fileDependencies; + const contextDependencies = newResolveContext.contextDependencies; + const missingDependencies = newResolveContext.missingDependencies; + fileSystemInfo.createSnapshot( + resolveTime, + fileDependencies, + contextDependencies, + missingDependencies, + snapshotOptions, + (err, snapshot) => { + if (err) return callback(err); + if (!snapshot) { + if (result) return callback(null, result); + return callback(); + } + itemCache.store(new CacheEntry(result, snapshot), storeErr => { + if (storeErr) return callback(storeErr); + if (result) return callback(null, result); + callback(); + }); + } + ); + } + ); + }; + compiler.resolverFactory.hooks.resolver.intercept({ + factory(type, hook) { + /** @type {Map} */ + const activeRequests = new Map(); + hook.tap( + "ResolverCachePlugin", + /** + * @param {Resolver} resolver the resolver + * @param {Object} options resolve options + * @param {Object} userOptions resolve options passed by the user + * @returns {void} + */ + (resolver, options, userOptions) => { + if (options.cache !== true) return; + const optionsIdent = objectToString(userOptions, false); + const cacheWithContext = + options.cacheWithContext !== undefined + ? options.cacheWithContext + : false; + resolver.hooks.resolve.tapAsync( + { + name: "ResolverCachePlugin", + stage: -100 + }, + (request, resolveContext, callback) => { + if (request._ResolverCachePluginCacheMiss || !fileSystemInfo) { + return callback(); + } + const identifier = `${type}${optionsIdent}${objectToString( + request, + !cacheWithContext + )}`; + const activeRequest = activeRequests.get(identifier); + if (activeRequest) { + activeRequest.push(callback); + return; + } + const itemCache = cache.getItemCache(identifier, null); + let callbacks; + const done = (err, result) => { + if (callbacks === undefined) { + callback(err, result); + callbacks = false; + } else { + for (const callback of callbacks) { + callback(err, result); + } + activeRequests.delete(identifier); + callbacks = false; + } + }; + /** + * @param {Error=} err error if any + * @param {CacheEntry=} cacheEntry cache entry + * @returns {void} + */ + const processCacheResult = (err, cacheEntry) => { + if (err) return done(err); + + if (cacheEntry) { + const { snapshot, result } = cacheEntry; + fileSystemInfo.checkSnapshotValid( + snapshot, + (err, valid) => { + if (err || !valid) { + cacheInvalidResolves++; + return doRealResolve( + itemCache, + resolver, + resolveContext, + request, + done + ); + } + cachedResolves++; + if (resolveContext.missingDependencies) { + addAllToSet( + resolveContext.missingDependencies, + snapshot.getMissingIterable() + ); + } + if (resolveContext.fileDependencies) { + addAllToSet( + resolveContext.fileDependencies, + snapshot.getFileIterable() + ); + } + if (resolveContext.contextDependencies) { + addAllToSet( + resolveContext.contextDependencies, + snapshot.getContextIterable() + ); + } + done(null, result); + } + ); + } else { + doRealResolve( + itemCache, + resolver, + resolveContext, + request, + done + ); + } + }; + itemCache.get(processCacheResult); + if (callbacks === undefined) { + callbacks = [callback]; + activeRequests.set(identifier, callbacks); + } + } + ); + } ); - this.compiler.fileTimestamps = - this.pausedWatcher.getFileTimeInfoEntries(); - this.compiler.contextTimestamps = - this.pausedWatcher.getContextTimeInfoEntries(); + return hook; } - } - this.compiler.modifiedFiles = this._collectedChangedFiles; - this._collectedChangedFiles = undefined; - this.compiler.removedFiles = this._collectedRemovedFiles; - this._collectedRemovedFiles = undefined; + }); + } +} - const run = () => { - if (this.compiler.idle) { - return this.compiler.cache.endIdle(err => { - if (err) return this._done(err); - this.compiler.idle = false; - run(); - }); - } - if (this._needRecords) { - return this.compiler.readRecords(err => { - if (err) return this._done(err); +module.exports = ResolverCachePlugin; - this._needRecords = false; - run(); - }); - } - this.invalid = false; - this._invalidReported = false; - this.compiler.hooks.watchRun.callAsync(this.compiler, err => { - if (err) return this._done(err); - const onCompiled = (err, compilation) => { - if (err) return this._done(err, compilation); - if (this.invalid) return this._done(null, compilation); - if (this.compiler.hooks.shouldEmit.call(compilation) === false) { - return this._done(null, compilation); - } +/***/ }), - process.nextTick(() => { - const logger = compilation.getLogger("webpack.Compiler"); - logger.time("emitAssets"); - this.compiler.emitAssets(compilation, err => { - logger.timeEnd("emitAssets"); - if (err) return this._done(err, compilation); - if (this.invalid) return this._done(null, compilation); +/***/ 94075: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - logger.time("emitRecords"); - this.compiler.emitRecords(err => { - logger.timeEnd("emitRecords"); - if (err) return this._done(err, compilation); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (compilation.hooks.needAdditionalPass.call()) { - compilation.needAdditionalPass = true; - compilation.startTime = this.startTime; - compilation.endTime = Date.now(); - logger.time("done hook"); - const stats = new Stats(compilation); - this.compiler.hooks.done.callAsync(stats, err => { - logger.timeEnd("done hook"); - if (err) return this._done(err, compilation); - this.compiler.hooks.additionalPass.callAsync(err => { - if (err) return this._done(err, compilation); - this.compiler.compile(onCompiled); - }); - }); - return; - } - return this._done(null, compilation); - }); - }); - }); - }; - this.compiler.compile(onCompiled); - }); - }; +const createHash = __webpack_require__(49835); - run(); - } +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {typeof import("../util/Hash")} HashConstructor */ + +/** + * @typedef {Object} HashableObject + * @property {function(Hash): void} updateHash + */ +class LazyHashedEtag { /** - * @param {Compilation} compilation the compilation - * @returns {Stats} the compilation stats + * @param {HashableObject} obj object with updateHash method + * @param {string | HashConstructor} hashFunction the hash function to use */ - _getStats(compilation) { - const stats = new Stats(compilation); - return stats; + constructor(obj, hashFunction = "md4") { + this._obj = obj; + this._hash = undefined; + this._hashFunction = hashFunction; } /** - * @param {Error=} err an optional error - * @param {Compilation=} compilation the compilation - * @returns {void} + * @returns {string} hash of object */ - _done(err, compilation) { - this.running = false; - - const logger = compilation && compilation.getLogger("webpack.Watching"); + toString() { + if (this._hash === undefined) { + const hash = createHash(this._hashFunction); + this._obj.updateHash(hash); + this._hash = /** @type {string} */ (hash.digest("base64")); + } + return this._hash; + } +} - let stats = null; +/** @type {Map>} */ +const mapStrings = new Map(); - const handleError = (err, cbs) => { - this.compiler.hooks.failed.call(err); - this.compiler.cache.beginIdle(); - this.compiler.idle = true; - this.handler(err, stats); - if (!cbs) { - cbs = this.callbacks; - this.callbacks = []; - } - for (const cb of cbs) cb(err); - }; +/** @type {WeakMap>} */ +const mapObjects = new WeakMap(); - if ( - this.invalid && - !this.suspended && - !this.blocked && - !(this._isBlocked() && (this.blocked = true)) - ) { - if (compilation) { - logger.time("storeBuildDependencies"); - this.compiler.cache.storeBuildDependencies( - compilation.buildDependencies, - err => { - logger.timeEnd("storeBuildDependencies"); - if (err) return handleError(err); - this._go(); - } - ); - } else { - this._go(); - } - return; +/** + * @param {HashableObject} obj object with updateHash method + * @param {string | HashConstructor} hashFunction the hash function to use + * @returns {LazyHashedEtag} etag + */ +const getter = (obj, hashFunction = "md4") => { + let innerMap; + if (typeof hashFunction === "string") { + innerMap = mapStrings.get(hashFunction); + if (innerMap === undefined) { + const newHash = new LazyHashedEtag(obj, hashFunction); + innerMap = new WeakMap(); + innerMap.set(obj, newHash); + mapStrings.set(hashFunction, innerMap); + return newHash; } - - if (compilation) { - compilation.startTime = this.startTime; - compilation.endTime = Date.now(); - stats = new Stats(compilation); + } else { + innerMap = mapObjects.get(hashFunction); + if (innerMap === undefined) { + const newHash = new LazyHashedEtag(obj, hashFunction); + innerMap = new WeakMap(); + innerMap.set(obj, newHash); + mapObjects.set(hashFunction, innerMap); + return newHash; } - this.startTime = null; - if (err) return handleError(err); - - const cbs = this.callbacks; - this.callbacks = []; - logger.time("done hook"); - this.compiler.hooks.done.callAsync(stats, err => { - logger.timeEnd("done hook"); - if (err) return handleError(err, cbs); - this.handler(null, stats); - logger.time("storeBuildDependencies"); - this.compiler.cache.storeBuildDependencies( - compilation.buildDependencies, - err => { - logger.timeEnd("storeBuildDependencies"); - if (err) return handleError(err, cbs); - logger.time("beginIdle"); - this.compiler.cache.beginIdle(); - this.compiler.idle = true; - logger.timeEnd("beginIdle"); - process.nextTick(() => { - if (!this.closed) { - this.watch( - compilation.fileDependencies, - compilation.contextDependencies, - compilation.missingDependencies - ); - } - }); - for (const cb of cbs) cb(null); - this.compiler.hooks.afterDone.call(stats); - } - ); - }); } + const hash = innerMap.get(obj); + if (hash !== undefined) return hash; + const newHash = new LazyHashedEtag(obj, hashFunction); + innerMap.set(obj, newHash); + return newHash; +}; - /** - * @param {Iterable} files watched files - * @param {Iterable} dirs watched directories - * @param {Iterable} missing watched existence entries - * @returns {void} - */ - watch(files, dirs, missing) { - this.pausedWatcher = null; - this.watcher = this.compiler.watchFileSystem.watch( - files, - dirs, - missing, - this.lastWatcherStartTime, - this.watchOptions, - ( - err, - fileTimeInfoEntries, - contextTimeInfoEntries, - changedFiles, - removedFiles - ) => { - if (err) { - this.compiler.modifiedFiles = undefined; - this.compiler.removedFiles = undefined; - this.compiler.fileTimestamps = undefined; - this.compiler.contextTimestamps = undefined; - this.compiler.fsStartTime = undefined; - return this.handler(err); - } - this._invalidate( - fileTimeInfoEntries, - contextTimeInfoEntries, - changedFiles, - removedFiles - ); - this._onChange(); - }, - (fileName, changeTime) => { - if (!this._invalidReported) { - this._invalidReported = true; - this.compiler.hooks.invalid.call(fileName, changeTime); - } - this._onInvalid(); - } - ); - } - - /** - * @param {Callback=} callback signals when the build has completed again - * @returns {void} - */ - invalidate(callback) { - if (callback) { - this.callbacks.push(callback); - } - if (!this._invalidReported) { - this._invalidReported = true; - this.compiler.hooks.invalid.call(null, Date.now()); - } - this._onChange(); - this._invalidate(); - } - - _invalidate( - fileTimeInfoEntries, - contextTimeInfoEntries, - changedFiles, - removedFiles - ) { - if (this.suspended || (this._isBlocked() && (this.blocked = true))) { - this._mergeWithCollected(changedFiles, removedFiles); - return; - } - - if (this.running) { - this._mergeWithCollected(changedFiles, removedFiles); - this.invalid = true; - } else { - this._go( - fileTimeInfoEntries, - contextTimeInfoEntries, - changedFiles, - removedFiles - ); - } - } - - suspend() { - this.suspended = true; - } - - resume() { - if (this.suspended) { - this.suspended = false; - this._invalidate(); - } - } - - /** - * @param {Callback} callback signals when the watcher is closed - * @returns {void} - */ - close(callback) { - if (this._closeCallbacks) { - if (callback) { - this._closeCallbacks.push(callback); - } - return; - } - const finalCallback = (err, compilation) => { - this.running = false; - this.compiler.running = false; - this.compiler.watching = undefined; - this.compiler.watchMode = false; - this.compiler.modifiedFiles = undefined; - this.compiler.removedFiles = undefined; - this.compiler.fileTimestamps = undefined; - this.compiler.contextTimestamps = undefined; - this.compiler.fsStartTime = undefined; - const shutdown = err => { - this.compiler.hooks.watchClose.call(); - const closeCallbacks = this._closeCallbacks; - this._closeCallbacks = undefined; - for (const cb of closeCallbacks) cb(err); - }; - if (compilation) { - const logger = compilation.getLogger("webpack.Watching"); - logger.time("storeBuildDependencies"); - this.compiler.cache.storeBuildDependencies( - compilation.buildDependencies, - err2 => { - logger.timeEnd("storeBuildDependencies"); - shutdown(err || err2); - } - ); - } else { - shutdown(err); - } - }; - - this.closed = true; - if (this.watcher) { - this.watcher.close(); - this.watcher = null; - } - if (this.pausedWatcher) { - this.pausedWatcher.close(); - this.pausedWatcher = null; - } - this._closeCallbacks = []; - if (callback) { - this._closeCallbacks.push(callback); - } - if (this.running) { - this.invalid = true; - this._done = finalCallback; - } else { - finalCallback(); - } - } -} - -module.exports = Watching; +module.exports = getter; /***/ }), -/***/ 53799: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 54980: +/***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Jarid Margolin @jaridmargolin + Author Tobias Koppers @sokra */ -const inspect = (__webpack_require__(73837).inspect.custom); -const makeSerializable = __webpack_require__(33032); - -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("./Module")} Module */ +/** @typedef {import("../Cache").Etag} Etag */ -class WebpackError extends Error { +class MergedEtag { /** - * Creates an instance of WebpackError. - * @param {string=} message error message + * @param {Etag} a first + * @param {Etag} b second */ - constructor(message) { - super(message); - - this.details = undefined; - /** @type {Module} */ - this.module = undefined; - /** @type {DependencyLocation} */ - this.loc = undefined; - /** @type {boolean} */ - this.hideStack = undefined; - /** @type {Chunk} */ - this.chunk = undefined; - /** @type {string} */ - this.file = undefined; - } - - [inspect]() { - return this.stack + (this.details ? `\n${this.details}` : ""); - } - - serialize({ write }) { - write(this.name); - write(this.message); - write(this.stack); - write(this.details); - write(this.loc); - write(this.hideStack); + constructor(a, b) { + this.a = a; + this.b = b; } - deserialize({ read }) { - this.name = read(); - this.message = read(); - this.stack = read(); - this.details = read(); - this.loc = read(); - this.hideStack = read(); + toString() { + return `${this.a.toString()}|${this.b.toString()}`; } } -makeSerializable(WebpackError, "webpack/lib/WebpackError"); - -module.exports = WebpackError; - - -/***/ }), - -/***/ 97017: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ - - - -const IgnoreErrorModuleFactory = __webpack_require__(3); -const WebpackIsIncludedDependency = __webpack_require__(26505); -const { - toConstantDependency -} = __webpack_require__(93998); - -/** @typedef {import("enhanced-resolve/lib/Resolver")} Resolver */ -/** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ - -class WebpackIsIncludedPlugin { - /** - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "WebpackIsIncludedPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - WebpackIsIncludedDependency, - new IgnoreErrorModuleFactory(normalModuleFactory) - ); - compilation.dependencyTemplates.set( - WebpackIsIncludedDependency, - new WebpackIsIncludedDependency.Template() - ); - - /** - * @param {JavascriptParser} parser the parser - * @returns {void} - */ - const handler = parser => { - parser.hooks.call - .for("__webpack_is_included__") - .tap("WebpackIsIncludedPlugin", expr => { - if ( - expr.type !== "CallExpression" || - expr.arguments.length !== 1 || - expr.arguments[0].type === "SpreadElement" - ) - return; - - const request = parser.evaluateExpression(expr.arguments[0]); - - if (!request.isString()) return; +const dualObjectMap = new WeakMap(); +const objectStringMap = new WeakMap(); - const dep = new WebpackIsIncludedDependency( - request.string, - expr.range - ); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - return true; - }); - parser.hooks.typeof - .for("__webpack_is_included__") - .tap( - "WebpackIsIncludedPlugin", - toConstantDependency(parser, JSON.stringify("function")) - ); - }; - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("WebpackIsIncludedPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("WebpackIsIncludedPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("WebpackIsIncludedPlugin", handler); +/** + * @param {Etag} a first + * @param {Etag} b second + * @returns {Etag} result + */ +const mergeEtags = (a, b) => { + if (typeof a === "string") { + if (typeof b === "string") { + return `${a}|${b}`; + } else { + const temp = b; + b = a; + a = temp; + } + } else { + if (typeof b !== "string") { + // both a and b are objects + let map = dualObjectMap.get(a); + if (map === undefined) { + dualObjectMap.set(a, (map = new WeakMap())); } - ); + const mergedEtag = map.get(b); + if (mergedEtag === undefined) { + const newMergedEtag = new MergedEtag(a, b); + map.set(b, newMergedEtag); + return newMergedEtag; + } else { + return mergedEtag; + } + } } -} + // a is object, b is string + let map = objectStringMap.get(a); + if (map === undefined) { + objectStringMap.set(a, (map = new Map())); + } + const mergedEtag = map.get(b); + if (mergedEtag === undefined) { + const newMergedEtag = new MergedEtag(a, b); + map.set(b, newMergedEtag); + return newMergedEtag; + } else { + return mergedEtag; + } +}; -module.exports = WebpackIsIncludedPlugin; +module.exports = mergeEtags; /***/ }), -/***/ 88422: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 13462: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -64635,1679 +63064,2319 @@ module.exports = WebpackIsIncludedPlugin; -const OptionsApply = __webpack_require__(81426); +const path = __webpack_require__(71017); +const webpackSchema = __webpack_require__(73342); -const AssetModulesPlugin = __webpack_require__(16109); -const JavascriptModulesPlugin = __webpack_require__(89464); -const JsonModulesPlugin = __webpack_require__(86770); +// TODO add originPath to PathItem for better errors +/** + * @typedef {Object} PathItem + * @property {any} schema the part of the schema + * @property {string} path the path in the config + */ -const ChunkPrefetchPreloadPlugin = __webpack_require__(33895); +/** @typedef {"unknown-argument" | "unexpected-non-array-in-path" | "unexpected-non-object-in-path" | "multiple-values-unexpected" | "invalid-value"} ProblemType */ -const EntryOptionPlugin = __webpack_require__(9909); -const RecordIdsPlugin = __webpack_require__(11094); +/** + * @typedef {Object} Problem + * @property {ProblemType} type + * @property {string} path + * @property {string} argument + * @property {any=} value + * @property {number=} index + * @property {string=} expected + */ -const RuntimePlugin = __webpack_require__(2307); +/** + * @typedef {Object} LocalProblem + * @property {ProblemType} type + * @property {string} path + * @property {string=} expected + */ -const APIPlugin = __webpack_require__(74315); -const CompatibilityPlugin = __webpack_require__(94258); -const ConstPlugin = __webpack_require__(11146); -const ExportsInfoApiPlugin = __webpack_require__(7145); -const WebpackIsIncludedPlugin = __webpack_require__(97017); +/** + * @typedef {Object} ArgumentConfig + * @property {string} description + * @property {string} [negatedDescription] + * @property {string} path + * @property {boolean} multiple + * @property {"enum"|"string"|"path"|"number"|"boolean"|"RegExp"|"reset"} type + * @property {any[]=} values + */ -const TemplatedPathPlugin = __webpack_require__(80734); -const UseStrictPlugin = __webpack_require__(36803); -const WarnCaseSensitiveModulesPlugin = __webpack_require__(56504); +/** + * @typedef {Object} Argument + * @property {string} description + * @property {"string"|"number"|"boolean"} simpleType + * @property {boolean} multiple + * @property {ArgumentConfig[]} configs + */ -const DataUriPlugin = __webpack_require__(64820); -const FileUriPlugin = __webpack_require__(57637); +/** + * @param {any=} schema a json schema to create arguments for (by default webpack schema is used) + * @returns {Record} object of arguments + */ +const getArguments = (schema = webpackSchema) => { + /** @type {Record} */ + const flags = {}; -const ResolverCachePlugin = __webpack_require__(97347); + const pathToArgumentName = input => { + return input + .replace(/\./g, "-") + .replace(/\[\]/g, "") + .replace( + /(\p{Uppercase_Letter}+|\p{Lowercase_Letter}|\d)(\p{Uppercase_Letter}+)/gu, + "$1-$2" + ) + .replace(/-?[^\p{Uppercase_Letter}\p{Lowercase_Letter}\d]+/gu, "-") + .toLowerCase(); + }; -const CommonJsPlugin = __webpack_require__(32406); -const HarmonyModulesPlugin = __webpack_require__(39029); -const ImportMetaPlugin = __webpack_require__(17228); -const ImportPlugin = __webpack_require__(41293); -const LoaderPlugin = __webpack_require__(24721); -const RequireContextPlugin = __webpack_require__(2928); -const RequireEnsurePlugin = __webpack_require__(8434); -const RequireIncludePlugin = __webpack_require__(37378); -const SystemPlugin = __webpack_require__(97981); -const URLPlugin = __webpack_require__(14412); -const WorkerPlugin = __webpack_require__(82509); + const getSchemaPart = path => { + const newPath = path.split("/"); -const InferAsyncModulesPlugin = __webpack_require__(59498); + let schemaPart = schema; -const JavascriptMetaInfoPlugin = __webpack_require__(52329); -const DefaultStatsFactoryPlugin = __webpack_require__(71760); -const DefaultStatsPresetPlugin = __webpack_require__(55442); -const DefaultStatsPrinterPlugin = __webpack_require__(58692); + for (let i = 1; i < newPath.length; i++) { + const inner = schemaPart[newPath[i]]; -const { cleverMerge } = __webpack_require__(60839); + if (!inner) { + break; + } -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("./Compiler")} Compiler */ + schemaPart = inner; + } -class WebpackOptionsApply extends OptionsApply { - constructor() { - super(); - } + return schemaPart; + }; /** - * @param {WebpackOptions} options options object - * @param {Compiler} compiler compiler object - * @returns {WebpackOptions} options object + * + * @param {PathItem[]} path path in the schema + * @returns {string | undefined} description */ - process(options, compiler) { - compiler.outputPath = options.output.path; - compiler.recordsInputPath = options.recordsInputPath || null; - compiler.recordsOutputPath = options.recordsOutputPath || null; - compiler.name = options.name; - - if (options.externals) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const ExternalsPlugin = __webpack_require__(6652); - new ExternalsPlugin(options.externalsType, options.externals).apply( - compiler - ); + const getDescription = path => { + for (const { schema } of path) { + if (schema.cli) { + if (schema.cli.helper) continue; + if (schema.cli.description) return schema.cli.description; + } + if (schema.description) return schema.description; } + }; - if (options.externalsPresets.node) { - const NodeTargetPlugin = __webpack_require__(17916); - new NodeTargetPlugin().apply(compiler); + /** + * + * @param {PathItem[]} path path in the schema + * @returns {string | undefined} negative description + */ + const getNegatedDescription = path => { + for (const { schema } of path) { + if (schema.cli) { + if (schema.cli.helper) continue; + if (schema.cli.negatedDescription) return schema.cli.negatedDescription; + } } - if (options.externalsPresets.electronMain) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const ElectronTargetPlugin = __webpack_require__(32277); - new ElectronTargetPlugin("main").apply(compiler); - } - if (options.externalsPresets.electronPreload) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const ElectronTargetPlugin = __webpack_require__(32277); - new ElectronTargetPlugin("preload").apply(compiler); - } - if (options.externalsPresets.electronRenderer) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const ElectronTargetPlugin = __webpack_require__(32277); - new ElectronTargetPlugin("renderer").apply(compiler); + }; + + /** + * + * @param {PathItem[]} path path in the schema + * @returns {string | undefined} reset description + */ + const getResetDescription = path => { + for (const { schema } of path) { + if (schema.cli) { + if (schema.cli.helper) continue; + if (schema.cli.resetDescription) return schema.cli.resetDescription; + } } - if ( - options.externalsPresets.electron && - !options.externalsPresets.electronMain && - !options.externalsPresets.electronPreload && - !options.externalsPresets.electronRenderer - ) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const ElectronTargetPlugin = __webpack_require__(32277); - new ElectronTargetPlugin().apply(compiler); + }; + + /** + * + * @param {any} schemaPart schema + * @returns {Pick} partial argument config + */ + const schemaToArgumentConfig = schemaPart => { + if (schemaPart.enum) { + return { + type: "enum", + values: schemaPart.enum + }; } - if (options.externalsPresets.nwjs) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const ExternalsPlugin = __webpack_require__(6652); - new ExternalsPlugin("node-commonjs", "nw.gui").apply(compiler); + switch (schemaPart.type) { + case "number": + return { + type: "number" + }; + case "string": + return { + type: schemaPart.absolutePath ? "path" : "string" + }; + case "boolean": + return { + type: "boolean" + }; } - if (options.externalsPresets.webAsync) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const ExternalsPlugin = __webpack_require__(6652); - new ExternalsPlugin( - "import", - options.experiments.css - ? ({ request, dependencyType }, callback) => { - if (dependencyType === "url") { - if (/^(\/\/|https?:\/\/)/.test(request)) - return callback(null, `asset ${request}`); - } else if (dependencyType === "css-import") { - if (/^(\/\/|https?:\/\/)/.test(request)) - return callback(null, `css-import ${request}`); - } else if (/^(\/\/|https?:\/\/|std:)/.test(request)) { - if (/^\.css(\?|$)/.test(request)) - return callback(null, `css-import ${request}`); - return callback(null, `import ${request}`); - } - callback(); - } - : /^(\/\/|https?:\/\/|std:)/ - ).apply(compiler); - } else if (options.externalsPresets.web) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const ExternalsPlugin = __webpack_require__(6652); - new ExternalsPlugin( - "module", - options.experiments.css - ? ({ request, dependencyType }, callback) => { - if (dependencyType === "url") { - if (/^(\/\/|https?:\/\/)/.test(request)) - return callback(null, `asset ${request}`); - } else if (dependencyType === "css-import") { - if (/^(\/\/|https?:\/\/)/.test(request)) - return callback(null, `css-import ${request}`); - } else if (/^(\/\/|https?:\/\/|std:)/.test(request)) { - if (/^\.css(\?|$)/.test(request)) - return callback(null, `css-import ${request}`); - return callback(null, `module ${request}`); - } - callback(); - } - : /^(\/\/|https?:\/\/|std:)/ - ).apply(compiler); + if (schemaPart.instanceof === "RegExp") { + return { + type: "RegExp" + }; } + return undefined; + }; - new ChunkPrefetchPreloadPlugin().apply(compiler); - - if (typeof options.output.chunkFormat === "string") { - switch (options.output.chunkFormat) { - case "array-push": { - const ArrayPushCallbackChunkFormatPlugin = __webpack_require__(18535); - new ArrayPushCallbackChunkFormatPlugin().apply(compiler); - break; - } - case "commonjs": { - const CommonJsChunkFormatPlugin = __webpack_require__(84508); - new CommonJsChunkFormatPlugin().apply(compiler); - break; - } - case "module": { - const ModuleChunkFormatPlugin = __webpack_require__(68927); - new ModuleChunkFormatPlugin().apply(compiler); - break; + /** + * @param {PathItem[]} path path in the schema + * @returns {void} + */ + const addResetFlag = path => { + const schemaPath = path[0].path; + const name = pathToArgumentName(`${schemaPath}.reset`); + const description = + getResetDescription(path) || + `Clear all items provided in '${schemaPath}' configuration. ${getDescription( + path + )}`; + flags[name] = { + configs: [ + { + type: "reset", + multiple: false, + description, + path: schemaPath } - default: - throw new Error( - "Unsupported chunk format '" + options.output.chunkFormat + "'." - ); - } - } - - if (options.output.enabledChunkLoadingTypes.length > 0) { - for (const type of options.output.enabledChunkLoadingTypes) { - const EnableChunkLoadingPlugin = __webpack_require__(61291); - new EnableChunkLoadingPlugin(type).apply(compiler); - } - } + ], + description: undefined, + simpleType: undefined, + multiple: undefined + }; + }; - if (options.output.enabledWasmLoadingTypes.length > 0) { - for (const type of options.output.enabledWasmLoadingTypes) { - const EnableWasmLoadingPlugin = __webpack_require__(78613); - new EnableWasmLoadingPlugin(type).apply(compiler); - } - } + /** + * @param {PathItem[]} path full path in schema + * @param {boolean} multiple inside of an array + * @returns {number} number of arguments added + */ + const addFlag = (path, multiple) => { + const argConfigBase = schemaToArgumentConfig(path[0].schema); + if (!argConfigBase) return 0; - if (options.output.enabledLibraryTypes.length > 0) { - for (const type of options.output.enabledLibraryTypes) { - const EnableLibraryPlugin = __webpack_require__(91452); - new EnableLibraryPlugin(type).apply(compiler); - } - } + const negatedDescription = getNegatedDescription(path); + const name = pathToArgumentName(path[0].path); + /** @type {ArgumentConfig} */ + const argConfig = { + ...argConfigBase, + multiple, + description: getDescription(path), + path: path[0].path + }; - if (options.output.pathinfo) { - const ModuleInfoHeaderPlugin = __webpack_require__(3454); - new ModuleInfoHeaderPlugin(options.output.pathinfo !== true).apply( - compiler - ); + if (negatedDescription) { + argConfig.negatedDescription = negatedDescription; } - if (options.output.clean) { - const CleanPlugin = __webpack_require__(31085); - new CleanPlugin( - options.output.clean === true ? {} : options.output.clean - ).apply(compiler); + if (!flags[name]) { + flags[name] = { + configs: [], + description: undefined, + simpleType: undefined, + multiple: undefined + }; } - if (options.devtool) { - if (options.devtool.includes("source-map")) { - const hidden = options.devtool.includes("hidden"); - const inline = options.devtool.includes("inline"); - const evalWrapped = options.devtool.includes("eval"); - const cheap = options.devtool.includes("cheap"); - const moduleMaps = options.devtool.includes("module"); - const noSources = options.devtool.includes("nosources"); - const Plugin = evalWrapped - ? __webpack_require__(14790) - : __webpack_require__(63872); - new Plugin({ - filename: inline ? null : options.output.sourceMapFilename, - moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate, - fallbackModuleFilenameTemplate: - options.output.devtoolFallbackModuleFilenameTemplate, - append: hidden ? false : undefined, - module: moduleMaps ? true : cheap ? false : true, - columns: cheap ? false : true, - noSources: noSources, - namespace: options.output.devtoolNamespace - }).apply(compiler); - } else if (options.devtool.includes("eval")) { - const EvalDevToolModulePlugin = __webpack_require__(65218); - new EvalDevToolModulePlugin({ - moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate, - namespace: options.output.devtoolNamespace - }).apply(compiler); - } + if ( + flags[name].configs.some( + item => JSON.stringify(item) === JSON.stringify(argConfig) + ) + ) { + return 0; } - new JavascriptModulesPlugin().apply(compiler); - new JsonModulesPlugin().apply(compiler); - new AssetModulesPlugin().apply(compiler); - - if (!options.experiments.outputModule) { - if (options.output.module) { - throw new Error( - "'output.module: true' is only allowed when 'experiments.outputModule' is enabled" - ); - } - if (options.output.enabledLibraryTypes.includes("module")) { - throw new Error( - "library type \"module\" is only allowed when 'experiments.outputModule' is enabled" - ); - } - if (options.externalsType === "module") { + if ( + flags[name].configs.some( + item => item.type === argConfig.type && item.multiple !== multiple + ) + ) { + if (multiple) { throw new Error( - "'externalsType: \"module\"' is only allowed when 'experiments.outputModule' is enabled" + `Conflicting schema for ${path[0].path} with ${argConfig.type} type (array type must be before single item type)` ); } + return 0; } - if (options.experiments.syncWebAssembly) { - const WebAssemblyModulesPlugin = __webpack_require__(53639); - new WebAssemblyModulesPlugin({ - mangleImports: options.optimization.mangleWasmImports - }).apply(compiler); - } + flags[name].configs.push(argConfig); - if (options.experiments.asyncWebAssembly) { - const AsyncWebAssemblyModulesPlugin = __webpack_require__(7538); - new AsyncWebAssemblyModulesPlugin({ - mangleImports: options.optimization.mangleWasmImports - }).apply(compiler); - } + return 1; + }; - if (options.experiments.css) { - const CssModulesPlugin = __webpack_require__(47283); - new CssModulesPlugin(options.experiments.css).apply(compiler); + // TODO support `not` and `if/then/else` + // TODO support `const`, but we don't use it on our schema + /** + * + * @param {object} schemaPart the current schema + * @param {string} schemaPath the current path in the schema + * @param {{schema: object, path: string}[]} path all previous visited schemaParts + * @param {string | null} inArray if inside of an array, the path to the array + * @returns {number} added arguments + */ + const traverse = (schemaPart, schemaPath = "", path = [], inArray = null) => { + while (schemaPart.$ref) { + schemaPart = getSchemaPart(schemaPart.$ref); } - if (options.experiments.lazyCompilation) { - const LazyCompilationPlugin = __webpack_require__(79040); - const lazyOptions = - typeof options.experiments.lazyCompilation === "object" - ? options.experiments.lazyCompilation - : null; - new LazyCompilationPlugin({ - backend: - typeof lazyOptions.backend === "function" - ? lazyOptions.backend - : __webpack_require__(17781)({ - ...lazyOptions.backend, - client: - (lazyOptions.backend && lazyOptions.backend.client) || - options.externalsPresets.node ? __webpack_require__.ab + "lazy-compilation-node.js" : __webpack_require__.ab + "lazy-compilation-web.js" - }), - entries: !lazyOptions || lazyOptions.entries !== false, - imports: !lazyOptions || lazyOptions.imports !== false, - test: (lazyOptions && lazyOptions.test) || undefined - }).apply(compiler); + const repetitions = path.filter(({ schema }) => schema === schemaPart); + if ( + repetitions.length >= 2 || + repetitions.some(({ path }) => path === schemaPath) + ) { + return 0; } - if (options.experiments.buildHttp) { - const HttpUriPlugin = __webpack_require__(42110); - const httpOptions = options.experiments.buildHttp; - new HttpUriPlugin(httpOptions).apply(compiler); - } + if (schemaPart.cli && schemaPart.cli.exclude) return 0; - new EntryOptionPlugin().apply(compiler); - compiler.hooks.entryOption.call(options.context, options.entry); + const fullPath = [{ schema: schemaPart, path: schemaPath }, ...path]; - new RuntimePlugin().apply(compiler); + let addedArguments = 0; - new InferAsyncModulesPlugin().apply(compiler); + addedArguments += addFlag(fullPath, !!inArray); - new DataUriPlugin().apply(compiler); - new FileUriPlugin().apply(compiler); + if (schemaPart.type === "object") { + if (schemaPart.properties) { + for (const property of Object.keys(schemaPart.properties)) { + addedArguments += traverse( + schemaPart.properties[property], + schemaPath ? `${schemaPath}.${property}` : property, + fullPath, + inArray + ); + } + } - new CompatibilityPlugin().apply(compiler); - new HarmonyModulesPlugin({ - topLevelAwait: options.experiments.topLevelAwait - }).apply(compiler); - if (options.amd !== false) { - const AMDPlugin = __webpack_require__(50067); - const RequireJsStuffPlugin = __webpack_require__(88846); - new AMDPlugin(options.amd || {}).apply(compiler); - new RequireJsStuffPlugin().apply(compiler); - } - new CommonJsPlugin().apply(compiler); - new LoaderPlugin({}).apply(compiler); - if (options.node !== false) { - const NodeStuffPlugin = __webpack_require__(95287); - new NodeStuffPlugin(options.node).apply(compiler); + return addedArguments; } - new APIPlugin().apply(compiler); - new ExportsInfoApiPlugin().apply(compiler); - new WebpackIsIncludedPlugin().apply(compiler); - new ConstPlugin().apply(compiler); - new UseStrictPlugin().apply(compiler); - new RequireIncludePlugin().apply(compiler); - new RequireEnsurePlugin().apply(compiler); - new RequireContextPlugin().apply(compiler); - new ImportPlugin().apply(compiler); - new SystemPlugin().apply(compiler); - new ImportMetaPlugin().apply(compiler); - new URLPlugin().apply(compiler); - new WorkerPlugin( - options.output.workerChunkLoading, - options.output.workerWasmLoading, - options.output.module - ).apply(compiler); - new DefaultStatsFactoryPlugin().apply(compiler); - new DefaultStatsPresetPlugin().apply(compiler); - new DefaultStatsPrinterPlugin().apply(compiler); + if (schemaPart.type === "array") { + if (inArray) { + return 0; + } + if (Array.isArray(schemaPart.items)) { + let i = 0; + for (const item of schemaPart.items) { + addedArguments += traverse( + item, + `${schemaPath}.${i}`, + fullPath, + schemaPath + ); + } - new JavascriptMetaInfoPlugin().apply(compiler); + return addedArguments; + } - if (typeof options.mode !== "string") { - const WarnNoModeSetPlugin = __webpack_require__(25295); - new WarnNoModeSetPlugin().apply(compiler); - } + addedArguments += traverse( + schemaPart.items, + `${schemaPath}[]`, + fullPath, + schemaPath + ); - const EnsureChunkConditionsPlugin = __webpack_require__(96260); - new EnsureChunkConditionsPlugin().apply(compiler); - if (options.optimization.removeAvailableModules) { - const RemoveParentModulesPlugin = __webpack_require__(7081); - new RemoveParentModulesPlugin().apply(compiler); - } - if (options.optimization.removeEmptyChunks) { - const RemoveEmptyChunksPlugin = __webpack_require__(84760); - new RemoveEmptyChunksPlugin().apply(compiler); - } - if (options.optimization.mergeDuplicateChunks) { - const MergeDuplicateChunksPlugin = __webpack_require__(85067); - new MergeDuplicateChunksPlugin().apply(compiler); - } - if (options.optimization.flagIncludedChunks) { - const FlagIncludedChunksPlugin = __webpack_require__(50089); - new FlagIncludedChunksPlugin().apply(compiler); - } - if (options.optimization.sideEffects) { - const SideEffectsFlagPlugin = __webpack_require__(84800); - new SideEffectsFlagPlugin( - options.optimization.sideEffects === true - ).apply(compiler); - } - if (options.optimization.providedExports) { - const FlagDependencyExportsPlugin = __webpack_require__(84506); - new FlagDependencyExportsPlugin().apply(compiler); - } - if (options.optimization.usedExports) { - const FlagDependencyUsagePlugin = __webpack_require__(58812); - new FlagDependencyUsagePlugin( - options.optimization.usedExports === "global" - ).apply(compiler); - } - if (options.optimization.innerGraph) { - const InnerGraphPlugin = __webpack_require__(28758); - new InnerGraphPlugin().apply(compiler); - } - if (options.optimization.mangleExports) { - const MangleExportsPlugin = __webpack_require__(27868); - new MangleExportsPlugin( - options.optimization.mangleExports !== "size" - ).apply(compiler); - } - if (options.optimization.concatenateModules) { - const ModuleConcatenationPlugin = __webpack_require__(74844); - new ModuleConcatenationPlugin().apply(compiler); - } - if (options.optimization.splitChunks) { - const SplitChunksPlugin = __webpack_require__(21478); - new SplitChunksPlugin(options.optimization.splitChunks).apply(compiler); - } - if (options.optimization.runtimeChunk) { - const RuntimeChunkPlugin = __webpack_require__(2837); - new RuntimeChunkPlugin(options.optimization.runtimeChunk).apply(compiler); - } - if (!options.optimization.emitOnErrors) { - const NoEmitOnErrorsPlugin = __webpack_require__(50169); - new NoEmitOnErrorsPlugin().apply(compiler); - } - if (options.optimization.realContentHash) { - const RealContentHashPlugin = __webpack_require__(46043); - new RealContentHashPlugin({ - hashFunction: options.output.hashFunction, - hashDigest: options.output.hashDigest - }).apply(compiler); + if (addedArguments > 0) { + addResetFlag(fullPath); + addedArguments++; + } + + return addedArguments; } - if (options.optimization.checkWasmTypes) { - const WasmFinalizeExportsPlugin = __webpack_require__(19810); - new WasmFinalizeExportsPlugin().apply(compiler); + + const maybeOf = schemaPart.oneOf || schemaPart.anyOf || schemaPart.allOf; + + if (maybeOf) { + const items = maybeOf; + + for (let i = 0; i < items.length; i++) { + addedArguments += traverse(items[i], schemaPath, fullPath, inArray); + } + + return addedArguments; } - const moduleIds = options.optimization.moduleIds; - if (moduleIds) { - switch (moduleIds) { - case "natural": { - const NaturalModuleIdsPlugin = __webpack_require__(83366); - new NaturalModuleIdsPlugin().apply(compiler); - break; - } - case "named": { - const NamedModuleIdsPlugin = __webpack_require__(24339); - new NamedModuleIdsPlugin().apply(compiler); - break; - } - case "hashed": { - const WarnDeprecatedOptionPlugin = __webpack_require__(76537); - const HashedModuleIdsPlugin = __webpack_require__(21825); - new WarnDeprecatedOptionPlugin( - "optimization.moduleIds", - "hashed", - "deterministic" - ).apply(compiler); - new HashedModuleIdsPlugin({ - hashFunction: options.output.hashFunction - }).apply(compiler); + + return addedArguments; + }; + + traverse(schema); + + // Summarize flags + for (const name of Object.keys(flags)) { + const argument = flags[name]; + argument.description = argument.configs.reduce((desc, { description }) => { + if (!desc) return description; + if (!description) return desc; + if (desc.includes(description)) return desc; + return `${desc} ${description}`; + }, /** @type {string | undefined} */ (undefined)); + argument.simpleType = argument.configs.reduce((t, argConfig) => { + /** @type {"string" | "number" | "boolean"} */ + let type = "string"; + switch (argConfig.type) { + case "number": + type = "number"; break; - } - case "deterministic": { - const DeterministicModuleIdsPlugin = __webpack_require__(76692); - new DeterministicModuleIdsPlugin().apply(compiler); + case "reset": + case "boolean": + type = "boolean"; break; - } - case "size": { - const OccurrenceModuleIdsPlugin = __webpack_require__(35371); - new OccurrenceModuleIdsPlugin({ - prioritiseInitial: true - }).apply(compiler); + case "enum": + if (argConfig.values.every(v => typeof v === "boolean")) + type = "boolean"; + if (argConfig.values.every(v => typeof v === "number")) + type = "number"; break; - } - default: - throw new Error( - `webpack bug: moduleIds: ${moduleIds} is not implemented` - ); } - } - const chunkIds = options.optimization.chunkIds; - if (chunkIds) { - switch (chunkIds) { - case "natural": { - const NaturalChunkIdsPlugin = __webpack_require__(86221); - new NaturalChunkIdsPlugin().apply(compiler); - break; - } - case "named": { - const NamedChunkIdsPlugin = __webpack_require__(6454); - new NamedChunkIdsPlugin().apply(compiler); - break; - } - case "deterministic": { - const DeterministicChunkIdsPlugin = __webpack_require__(8747); - new DeterministicChunkIdsPlugin().apply(compiler); - break; - } - case "size": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const OccurrenceChunkIdsPlugin = __webpack_require__(51020); - new OccurrenceChunkIdsPlugin({ - prioritiseInitial: true - }).apply(compiler); - break; + if (t === undefined) return type; + return t === type ? t : "string"; + }, /** @type {"string" | "number" | "boolean" | undefined} */ (undefined)); + argument.multiple = argument.configs.some(c => c.multiple); + } + + return flags; +}; + +const cliAddedItems = new WeakMap(); + +/** + * @param {any} config configuration + * @param {string} schemaPath path in the config + * @param {number | undefined} index index of value when multiple values are provided, otherwise undefined + * @returns {{ problem?: LocalProblem, object?: any, property?: string | number, value?: any }} problem or object with property and value + */ +const getObjectAndProperty = (config, schemaPath, index = 0) => { + if (!schemaPath) return { value: config }; + const parts = schemaPath.split("."); + let property = parts.pop(); + let current = config; + let i = 0; + for (const part of parts) { + const isArray = part.endsWith("[]"); + const name = isArray ? part.slice(0, -2) : part; + let value = current[name]; + if (isArray) { + if (value === undefined) { + value = {}; + current[name] = [...Array.from({ length: index }), value]; + cliAddedItems.set(current[name], index + 1); + } else if (!Array.isArray(value)) { + return { + problem: { + type: "unexpected-non-array-in-path", + path: parts.slice(0, i).join(".") + } + }; + } else { + let addedItems = cliAddedItems.get(value) || 0; + while (addedItems <= index) { + value.push(undefined); + addedItems++; } - case "total-size": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const OccurrenceChunkIdsPlugin = __webpack_require__(51020); - new OccurrenceChunkIdsPlugin({ - prioritiseInitial: false - }).apply(compiler); - break; + cliAddedItems.set(value, addedItems); + const x = value.length - addedItems + index; + if (value[x] === undefined) { + value[x] = {}; + } else if (value[x] === null || typeof value[x] !== "object") { + return { + problem: { + type: "unexpected-non-object-in-path", + path: parts.slice(0, i).join(".") + } + }; } - default: - throw new Error( - `webpack bug: chunkIds: ${chunkIds} is not implemented` - ); + value = value[x]; } - } - if (options.optimization.nodeEnv) { - const DefinePlugin = __webpack_require__(79065); - new DefinePlugin({ - "process.env.NODE_ENV": JSON.stringify(options.optimization.nodeEnv) - }).apply(compiler); - } - if (options.optimization.minimize) { - for (const minimizer of options.optimization.minimizer) { - if (typeof minimizer === "function") { - minimizer.call(compiler, compiler); - } else if (minimizer !== "...") { - minimizer.apply(compiler); - } + } else { + if (value === undefined) { + value = current[name] = {}; + } else if (value === null || typeof value !== "object") { + return { + problem: { + type: "unexpected-non-object-in-path", + path: parts.slice(0, i).join(".") + } + }; } } - - if (options.performance) { - const SizeLimitsPlugin = __webpack_require__(32557); - new SizeLimitsPlugin(options.performance).apply(compiler); + current = value; + i++; + } + let value = current[property]; + if (property.endsWith("[]")) { + const name = property.slice(0, -2); + const value = current[name]; + if (value === undefined) { + current[name] = [...Array.from({ length: index }), undefined]; + cliAddedItems.set(current[name], index + 1); + return { object: current[name], property: index, value: undefined }; + } else if (!Array.isArray(value)) { + current[name] = [value, ...Array.from({ length: index }), undefined]; + cliAddedItems.set(current[name], index + 1); + return { object: current[name], property: index + 1, value: undefined }; + } else { + let addedItems = cliAddedItems.get(value) || 0; + while (addedItems <= index) { + value.push(undefined); + addedItems++; + } + cliAddedItems.set(value, addedItems); + const x = value.length - addedItems + index; + if (value[x] === undefined) { + value[x] = {}; + } else if (value[x] === null || typeof value[x] !== "object") { + return { + problem: { + type: "unexpected-non-object-in-path", + path: schemaPath + } + }; + } + return { + object: value, + property: x, + value: value[x] + }; } + } + return { object: current, property, value }; +}; - new TemplatedPathPlugin().apply(compiler); - - new RecordIdsPlugin({ - portableIds: options.optimization.portableRecords - }).apply(compiler); +/** + * @param {any} config configuration + * @param {string} schemaPath path in the config + * @param {any} value parsed value + * @param {number | undefined} index index of value when multiple values are provided, otherwise undefined + * @returns {LocalProblem | null} problem or null for success + */ +const setValue = (config, schemaPath, value, index) => { + const { problem, object, property } = getObjectAndProperty( + config, + schemaPath, + index + ); + if (problem) return problem; + object[property] = value; + return null; +}; - new WarnCaseSensitiveModulesPlugin().apply(compiler); +/** + * @param {ArgumentConfig} argConfig processing instructions + * @param {any} config configuration + * @param {any} value the value + * @param {number | undefined} index the index if multiple values provided + * @returns {LocalProblem | null} a problem if any + */ +const processArgumentConfig = (argConfig, config, value, index) => { + if (index !== undefined && !argConfig.multiple) { + return { + type: "multiple-values-unexpected", + path: argConfig.path + }; + } + const parsed = parseValueForArgumentConfig(argConfig, value); + if (parsed === undefined) { + return { + type: "invalid-value", + path: argConfig.path, + expected: getExpectedValue(argConfig) + }; + } + const problem = setValue(config, argConfig.path, parsed, index); + if (problem) return problem; + return null; +}; - const AddManagedPathsPlugin = __webpack_require__(47942); - new AddManagedPathsPlugin( - options.snapshot.managedPaths, - options.snapshot.immutablePaths - ).apply(compiler); +/** + * @param {ArgumentConfig} argConfig processing instructions + * @returns {string | undefined} expected message + */ +const getExpectedValue = argConfig => { + switch (argConfig.type) { + default: + return argConfig.type; + case "boolean": + return "true | false"; + case "RegExp": + return "regular expression (example: /ab?c*/)"; + case "enum": + return argConfig.values.map(v => `${v}`).join(" | "); + case "reset": + return "true (will reset the previous value to an empty array)"; + } +}; - if (options.cache && typeof options.cache === "object") { - const cacheOptions = options.cache; - switch (cacheOptions.type) { - case "memory": { - if (isFinite(cacheOptions.maxGenerations)) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const MemoryWithGcCachePlugin = __webpack_require__(99334); - new MemoryWithGcCachePlugin({ - maxGenerations: cacheOptions.maxGenerations - }).apply(compiler); - } else { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const MemoryCachePlugin = __webpack_require__(52539); - new MemoryCachePlugin().apply(compiler); - } - if (cacheOptions.cacheUnaffected) { - if (!options.experiments.cacheUnaffected) { - throw new Error( - "'cache.cacheUnaffected: true' is only allowed when 'experiments.cacheUnaffected' is enabled" - ); - } - compiler.moduleMemCaches = new Map(); - } - break; - } - case "filesystem": { - const AddBuildDependenciesPlugin = __webpack_require__(28034); - for (const key in cacheOptions.buildDependencies) { - const list = cacheOptions.buildDependencies[key]; - new AddBuildDependenciesPlugin(list).apply(compiler); - } - if (!isFinite(cacheOptions.maxMemoryGenerations)) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const MemoryCachePlugin = __webpack_require__(52539); - new MemoryCachePlugin().apply(compiler); - } else if (cacheOptions.maxMemoryGenerations !== 0) { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const MemoryWithGcCachePlugin = __webpack_require__(99334); - new MemoryWithGcCachePlugin({ - maxGenerations: cacheOptions.maxMemoryGenerations - }).apply(compiler); - } - if (cacheOptions.memoryCacheUnaffected) { - if (!options.experiments.cacheUnaffected) { - throw new Error( - "'cache.memoryCacheUnaffected: true' is only allowed when 'experiments.cacheUnaffected' is enabled" - ); - } - compiler.moduleMemCaches = new Map(); - } - switch (cacheOptions.store) { - case "pack": { - const IdleFileCachePlugin = __webpack_require__(71985); - const PackFileCacheStrategy = __webpack_require__(86180); - new IdleFileCachePlugin( - new PackFileCacheStrategy({ - compiler, - fs: compiler.intermediateFileSystem, - context: options.context, - cacheLocation: cacheOptions.cacheLocation, - version: cacheOptions.version, - logger: compiler.getInfrastructureLogger( - "webpack.cache.PackFileCacheStrategy" - ), - snapshot: options.snapshot, - maxAge: cacheOptions.maxAge, - profile: cacheOptions.profile, - allowCollectingMemory: cacheOptions.allowCollectingMemory, - compression: cacheOptions.compression - }), - cacheOptions.idleTimeout, - cacheOptions.idleTimeoutForInitialStore, - cacheOptions.idleTimeoutAfterLargeChanges - ).apply(compiler); - break; - } - default: - throw new Error("Unhandled value for cache.store"); - } - break; - } - default: - // @ts-expect-error Property 'type' does not exist on type 'never'. ts(2339) - throw new Error(`Unknown cache type ${cacheOptions.type}`); +/** + * @param {ArgumentConfig} argConfig processing instructions + * @param {any} value the value + * @returns {any | undefined} parsed value + */ +const parseValueForArgumentConfig = (argConfig, value) => { + switch (argConfig.type) { + case "string": + if (typeof value === "string") { + return value; } - } - new ResolverCachePlugin().apply(compiler); + break; + case "path": + if (typeof value === "string") { + return path.resolve(value); + } + break; + case "number": + if (typeof value === "number") return value; + if (typeof value === "string" && /^[+-]?\d*(\.\d*)[eE]\d+$/) { + const n = +value; + if (!isNaN(n)) return n; + } + break; + case "boolean": + if (typeof value === "boolean") return value; + if (value === "true") return true; + if (value === "false") return false; + break; + case "RegExp": + if (value instanceof RegExp) return value; + if (typeof value === "string") { + // cspell:word yugi + const match = /^\/(.*)\/([yugi]*)$/.exec(value); + if (match && !/[^\\]\//.test(match[1])) + return new RegExp(match[1], match[2]); + } + break; + case "enum": + if (argConfig.values.includes(value)) return value; + for (const item of argConfig.values) { + if (`${item}` === value) return item; + } + break; + case "reset": + if (value === true) return []; + break; + } +}; - if (options.ignoreWarnings && options.ignoreWarnings.length > 0) { - const IgnoreWarningsPlugin = __webpack_require__(41606); - new IgnoreWarningsPlugin(options.ignoreWarnings).apply(compiler); +/** + * @param {Record} args object of arguments + * @param {any} config configuration + * @param {Record} values object with values + * @returns {Problem[] | null} problems or null for success + */ +const processArguments = (args, config, values) => { + /** @type {Problem[]} */ + const problems = []; + for (const key of Object.keys(values)) { + const arg = args[key]; + if (!arg) { + problems.push({ + type: "unknown-argument", + path: "", + argument: key + }); + continue; } - - compiler.hooks.afterPlugins.call(compiler); - if (!compiler.inputFileSystem) { - throw new Error("No input filesystem provided"); + const processValue = (value, i) => { + const currentProblems = []; + for (const argConfig of arg.configs) { + const problem = processArgumentConfig(argConfig, config, value, i); + if (!problem) { + return; + } + currentProblems.push({ + ...problem, + argument: key, + value: value, + index: i + }); + } + problems.push(...currentProblems); + }; + let value = values[key]; + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + processValue(value[i], i); + } + } else { + processValue(value, undefined); } - compiler.resolverFactory.hooks.resolveOptions - .for("normal") - .tap("WebpackOptionsApply", resolveOptions => { - resolveOptions = cleverMerge(options.resolve, resolveOptions); - resolveOptions.fileSystem = compiler.inputFileSystem; - return resolveOptions; - }); - compiler.resolverFactory.hooks.resolveOptions - .for("context") - .tap("WebpackOptionsApply", resolveOptions => { - resolveOptions = cleverMerge(options.resolve, resolveOptions); - resolveOptions.fileSystem = compiler.inputFileSystem; - resolveOptions.resolveToContext = true; - return resolveOptions; - }); - compiler.resolverFactory.hooks.resolveOptions - .for("loader") - .tap("WebpackOptionsApply", resolveOptions => { - resolveOptions = cleverMerge(options.resolveLoader, resolveOptions); - resolveOptions.fileSystem = compiler.inputFileSystem; - return resolveOptions; - }); - compiler.hooks.afterResolvers.call(compiler); - return options; } -} + if (problems.length === 0) return null; + return problems; +}; -module.exports = WebpackOptionsApply; +exports.getArguments = getArguments; +exports.processArguments = processArguments; /***/ }), -/***/ 14452: +/***/ 43950: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Sergey Melyukov @smelukov */ -const { applyWebpackOptionsDefaults } = __webpack_require__(92988); -const { getNormalizedWebpackOptions } = __webpack_require__(26693); +const browserslist = __webpack_require__(14907); +const path = __webpack_require__(71017); -class WebpackOptionsDefaulter { - process(options) { - options = getNormalizedWebpackOptions(options); - applyWebpackOptionsDefaults(options); - return options; +/** @typedef {import("./target").ApiTargetProperties} ApiTargetProperties */ +/** @typedef {import("./target").EcmaTargetProperties} EcmaTargetProperties */ +/** @typedef {import("./target").PlatformTargetProperties} PlatformTargetProperties */ + +// [[C:]/path/to/config][:env] +const inputRx = /^(?:((?:[A-Z]:)?[/\\].*?))?(?::(.+?))?$/i; + +/** + * @typedef {Object} BrowserslistHandlerConfig + * @property {string=} configPath + * @property {string=} env + * @property {string=} query + */ + +/** + * @param {string} input input string + * @param {string} context the context directory + * @returns {BrowserslistHandlerConfig} config + */ +const parse = (input, context) => { + if (!input) { + return {}; } -} -module.exports = WebpackOptionsDefaulter; + if (path.isAbsolute(input)) { + const [, configPath, env] = inputRx.exec(input) || []; + return { configPath, env }; + } + + const config = browserslist.findConfig(context); + + if (config && Object.keys(config).includes(input)) { + return { env: input }; + } + + return { query: input }; +}; + +/** + * @param {string} input input string + * @param {string} context the context directory + * @returns {string[] | undefined} selected browsers + */ +const load = (input, context) => { + const { configPath, env, query } = parse(input, context); + + // if a query is specified, then use it, else + // if a path to a config is specified then load it, else + // find a nearest config + const config = query + ? query + : configPath + ? browserslist.loadConfig({ + config: configPath, + env + }) + : browserslist.loadConfig({ path: context, env }); + + if (!config) return null; + return browserslist(config); +}; + +/** + * @param {string[]} browsers supported browsers list + * @returns {EcmaTargetProperties & PlatformTargetProperties & ApiTargetProperties} target properties + */ +const resolve = browsers => { + /** + * Checks all against a version number + * @param {Record} versions first supported version + * @returns {boolean} true if supports + */ + const rawChecker = versions => { + return browsers.every(v => { + const [name, parsedVersion] = v.split(" "); + if (!name) return false; + const requiredVersion = versions[name]; + if (!requiredVersion) return false; + const [parsedMajor, parserMinor] = + // safari TP supports all features for normal safari + parsedVersion === "TP" + ? [Infinity, Infinity] + : parsedVersion.split("."); + if (typeof requiredVersion === "number") { + return +parsedMajor >= requiredVersion; + } + return requiredVersion[0] === +parsedMajor + ? +parserMinor >= requiredVersion[1] + : +parsedMajor > requiredVersion[0]; + }); + }; + const anyNode = browsers.some(b => /^node /.test(b)); + const anyBrowser = browsers.some(b => /^(?!node)/.test(b)); + const browserProperty = !anyBrowser ? false : anyNode ? null : true; + const nodeProperty = !anyNode ? false : anyBrowser ? null : true; + // Internet Explorer Mobile, Blackberry browser and Opera Mini are very old browsers, they do not support new features + const es6DynamicImport = rawChecker({ + chrome: 63, + and_chr: 63, + edge: 79, + firefox: 67, + and_ff: 67, + // ie: Not supported + opera: 50, + op_mob: 46, + safari: [11, 1], + ios_saf: [11, 3], + samsung: [8, 2], + android: 63, + and_qq: [10, 4], + // baidu: Not supported + // and_uc: Not supported + // kaios: Not supported + // Since Node.js 13.14.0 no warning about usage, but it was added 8.5.0 with some limitations and it was improved in 12.0.0 and 13.2.0 + node: [13, 14] + }); + + return { + const: rawChecker({ + chrome: 49, + and_chr: 49, + edge: 12, + // Prior to Firefox 13, const is implemented, but re-assignment is not failing. + // Prior to Firefox 46, a TypeError was thrown on redeclaration instead of a SyntaxError. + firefox: 36, + and_ff: 36, + // Not supported in for-in and for-of loops + // ie: Not supported + opera: 36, + op_mob: 36, + safari: [10, 0], + ios_saf: [10, 0], + // Before 5.0 supported correctly in strict mode, otherwise supported without block scope + samsung: [5, 0], + android: 37, + and_qq: [10, 4], + // Supported correctly in strict mode, otherwise supported without block scope + // baidu: Not supported + and_uc: [12, 12], + kaios: [2, 5], + node: [6, 0] + }), + arrowFunction: rawChecker({ + chrome: 45, + and_chr: 45, + edge: 12, + // The initial implementation of arrow functions in Firefox made them automatically strict. This has been changed as of Firefox 24. The use of 'use strict'; is now required. + // Prior to Firefox 39, a line terminator (\\n) was incorrectly allowed after arrow function arguments. This has been fixed to conform to the ES2015 specification and code like () \\n => {} will now throw a SyntaxError in this and later versions. + firefox: 39, + and_ff: 39, + // ie: Not supported, + opera: 32, + op_mob: 32, + safari: 10, + ios_saf: 10, + samsung: [5, 0], + android: 45, + and_qq: [10, 4], + baidu: [7, 12], + and_uc: [12, 12], + kaios: [2, 5], + node: [6, 0] + }), + forOf: rawChecker({ + chrome: 38, + and_chr: 38, + edge: 12, + // Prior to Firefox 51, using the for...of loop construct with the const keyword threw a SyntaxError ("missing = in const declaration"). + firefox: 51, + and_ff: 51, + // ie: Not supported, + opera: 25, + op_mob: 25, + safari: 7, + ios_saf: 7, + samsung: [3, 0], + android: 38, + // and_qq: Unknown support + // baidu: Unknown support + // and_uc: Unknown support + // kaios: Unknown support + node: [0, 12] + }), + destructuring: rawChecker({ + chrome: 49, + and_chr: 49, + edge: 14, + firefox: 41, + and_ff: 41, + // ie: Not supported, + opera: 36, + op_mob: 36, + safari: 8, + ios_saf: 8, + samsung: [5, 0], + android: 49, + // and_qq: Unknown support + // baidu: Unknown support + // and_uc: Unknown support + // kaios: Unknown support + node: [6, 0] + }), + bigIntLiteral: rawChecker({ + chrome: 67, + and_chr: 67, + edge: 79, + firefox: 68, + and_ff: 68, + // ie: Not supported, + opera: 54, + op_mob: 48, + safari: 14, + ios_saf: 14, + samsung: [9, 2], + android: 67, + // and_qq: Not supported + // baidu: Not supported + // and_uc: Not supported + // kaios: Not supported + node: [10, 4] + }), + // Support syntax `import` and `export` and no limitations and bugs on Node.js + // Not include `export * as namespace` + module: rawChecker({ + chrome: 61, + and_chr: 61, + edge: 16, + firefox: 60, + and_ff: 60, + // ie: Not supported, + opera: 48, + op_mob: 45, + safari: [10, 1], + ios_saf: [10, 3], + samsung: [8, 0], + android: 61, + and_qq: [10, 4], + // baidu: Not supported + // and_uc: Not supported + // kaios: Not supported + // Since Node.js 13.14.0 no warning about usage, but it was added 8.5.0 with some limitations and it was improved in 12.0.0 and 13.2.0 + node: [13, 14] + }), + dynamicImport: es6DynamicImport, + dynamicImportInWorker: es6DynamicImport && !anyNode, + // browserslist does not have info about globalThis + // so this is based on mdn-browser-compat-data + globalThis: rawChecker({ + chrome: 71, + and_chr: 71, + edge: 79, + firefox: 65, + and_ff: 65, + // ie: Not supported, + opera: 58, + op_mob: 50, + safari: [12, 1], + ios_saf: [12, 2], + samsung: [10, 1], + android: 71, + // and_qq: Unknown support + // baidu: Unknown support + // and_uc: Unknown support + // kaios: Unknown support + node: [12, 0] + }), + optionalChaining: rawChecker({ + chrome: 80, + and_chr: 80, + edge: 80, + firefox: 74, + and_ff: 79, + // ie: Not supported, + opera: 67, + op_mob: 64, + safari: [13, 1], + ios_saf: [13, 4], + samsung: 13, + android: 80, + // and_qq: Not supported + // baidu: Not supported + // and_uc: Not supported + // kaios: Not supported + node: 14 + }), + templateLiteral: rawChecker({ + chrome: 41, + and_chr: 41, + edge: 13, + firefox: 34, + and_ff: 34, + // ie: Not supported, + opera: 29, + op_mob: 64, + safari: [9, 1], + ios_saf: 9, + samsung: 4, + android: 41, + and_qq: [10, 4], + baidu: [7, 12], + and_uc: [12, 12], + kaios: [2, 5], + node: 4 + }), + browser: browserProperty, + electron: false, + node: nodeProperty, + nwjs: false, + web: browserProperty, + webworker: false, + + document: browserProperty, + fetchWasm: browserProperty, + global: nodeProperty, + importScripts: false, + importScriptsInWorker: true, + nodeBuiltins: nodeProperty, + require: nodeProperty + }; +}; + +module.exports = { + resolve, + load +}; /***/ }), -/***/ 98421: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 92988: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Sergey Melyukov @smelukov + Author Tobias Koppers @sokra */ -const mimeTypes = __webpack_require__(78585); +const fs = __webpack_require__(57147); const path = __webpack_require__(71017); -const { RawSource } = __webpack_require__(51255); -const Generator = __webpack_require__(93401); -const RuntimeGlobals = __webpack_require__(16475); -const createHash = __webpack_require__(49835); -const { makePathsRelative } = __webpack_require__(82186); -const nonNumericOnlyHash = __webpack_require__(55668); +const Template = __webpack_require__(1626); +const { cleverMerge } = __webpack_require__(60839); +const { + getTargetsProperties, + getTargetProperties, + getDefaultTarget +} = __webpack_require__(52801); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").AssetGeneratorOptions} AssetGeneratorOptions */ -/** @typedef {import("../../declarations/WebpackOptions").AssetModuleOutputPath} AssetModuleOutputPath */ -/** @typedef {import("../../declarations/WebpackOptions").RawPublicPath} RawPublicPath */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../Generator").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../NormalModule")} NormalModule */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../../declarations/WebpackOptions").CacheOptionsNormalized} CacheOptions */ +/** @typedef {import("../../declarations/WebpackOptions").CssExperimentOptions} CssExperimentOptions */ +/** @typedef {import("../../declarations/WebpackOptions").EntryDescription} EntryDescription */ +/** @typedef {import("../../declarations/WebpackOptions").EntryNormalized} Entry */ +/** @typedef {import("../../declarations/WebpackOptions").Experiments} Experiments */ +/** @typedef {import("../../declarations/WebpackOptions").ExperimentsNormalized} ExperimentsNormalized */ +/** @typedef {import("../../declarations/WebpackOptions").ExternalsPresets} ExternalsPresets */ +/** @typedef {import("../../declarations/WebpackOptions").ExternalsType} ExternalsType */ +/** @typedef {import("../../declarations/WebpackOptions").InfrastructureLogging} InfrastructureLogging */ +/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ +/** @typedef {import("../../declarations/WebpackOptions").Library} Library */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryName} LibraryName */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").Loader} Loader */ +/** @typedef {import("../../declarations/WebpackOptions").Mode} Mode */ +/** @typedef {import("../../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */ +/** @typedef {import("../../declarations/WebpackOptions").Node} WebpackNode */ +/** @typedef {import("../../declarations/WebpackOptions").Optimization} Optimization */ +/** @typedef {import("../../declarations/WebpackOptions").OutputNormalized} Output */ +/** @typedef {import("../../declarations/WebpackOptions").Performance} Performance */ +/** @typedef {import("../../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ +/** @typedef {import("../../declarations/WebpackOptions").RuleSetRules} RuleSetRules */ +/** @typedef {import("../../declarations/WebpackOptions").SnapshotOptions} SnapshotOptions */ +/** @typedef {import("../../declarations/WebpackOptions").Target} Target */ +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("./target").TargetProperties} TargetProperties */ -const mergeMaybeArrays = (a, b) => { - const set = new Set(); - if (Array.isArray(a)) for (const item of a) set.add(item); - else set.add(a); - if (Array.isArray(b)) for (const item of b) set.add(item); - else set.add(b); - return Array.from(set); +const NODE_MODULES_REGEXP = /[\\/]node_modules[\\/]/i; + +/** + * Sets a constant default value when undefined + * @template T + * @template {keyof T} P + * @param {T} obj an object + * @param {P} prop a property of this object + * @param {T[P]} value a default value of the property + * @returns {void} + */ +const D = (obj, prop, value) => { + if (obj[prop] === undefined) { + obj[prop] = value; + } }; -const mergeAssetInfo = (a, b) => { - const result = { ...a, ...b }; - for (const key of Object.keys(a)) { - if (key in b) { - if (a[key] === b[key]) continue; - switch (key) { - case "fullhash": - case "chunkhash": - case "modulehash": - case "contenthash": - result[key] = mergeMaybeArrays(a[key], b[key]); - break; - case "immutable": - case "development": - case "hotModuleReplacement": - case "javascriptModule": - result[key] = a[key] || b[key]; - break; - case "related": - result[key] = mergeRelatedInfo(a[key], b[key]); - break; - default: - throw new Error(`Can't handle conflicting asset info for ${key}`); - } - } +/** + * Sets a dynamic default value when undefined, by calling the factory function + * @template T + * @template {keyof T} P + * @param {T} obj an object + * @param {P} prop a property of this object + * @param {function(): T[P]} factory a default value factory for the property + * @returns {void} + */ +const F = (obj, prop, factory) => { + if (obj[prop] === undefined) { + obj[prop] = factory(); } - return result; }; -const mergeRelatedInfo = (a, b) => { - const result = { ...a, ...b }; - for (const key of Object.keys(a)) { - if (key in b) { - if (a[key] === b[key]) continue; - result[key] = mergeMaybeArrays(a[key], b[key]); +/** + * Sets a dynamic default value when undefined, by calling the factory function. + * factory must return an array or undefined + * When the current value is already an array an contains "..." it's replaced with + * the result of the factory function + * @template T + * @template {keyof T} P + * @param {T} obj an object + * @param {P} prop a property of this object + * @param {function(): T[P]} factory a default value factory for the property + * @returns {void} + */ +const A = (obj, prop, factory) => { + const value = obj[prop]; + if (value === undefined) { + obj[prop] = factory(); + } else if (Array.isArray(value)) { + /** @type {any[]} */ + let newArray = undefined; + for (let i = 0; i < value.length; i++) { + const item = value[i]; + if (item === "...") { + if (newArray === undefined) { + newArray = value.slice(0, i); + obj[prop] = /** @type {T[P]} */ (/** @type {unknown} */ (newArray)); + } + const items = /** @type {any[]} */ (/** @type {unknown} */ (factory())); + if (items !== undefined) { + for (const item of items) { + newArray.push(item); + } + } + } else if (newArray !== undefined) { + newArray.push(item); + } } } - return result; }; -const encodeDataUri = (encoding, source) => { - let encodedContent; +/** + * @param {WebpackOptions} options options to be modified + * @returns {void} + */ +const applyWebpackOptionsBaseDefaults = options => { + F(options, "context", () => process.cwd()); + applyInfrastructureLoggingDefaults(options.infrastructureLogging); +}; - switch (encoding) { - case "base64": { - encodedContent = source.buffer().toString("base64"); - break; - } - case false: { - const content = source.source(); - - if (typeof content !== "string") { - encodedContent = content.toString("utf-8"); - } - - encodedContent = encodeURIComponent(encodedContent).replace( - /[!'()*]/g, - character => "%" + character.codePointAt(0).toString(16) - ); - break; - } - default: - throw new Error(`Unsupported encoding '${encoding}'`); - } - - return encodedContent; -}; - -const decodeDataUriContent = (encoding, content) => { - const isBase64 = encoding === "base64"; - return isBase64 - ? Buffer.from(content, "base64") - : Buffer.from(decodeURIComponent(content), "ascii"); -}; - -const JS_TYPES = new Set(["javascript"]); -const JS_AND_ASSET_TYPES = new Set(["javascript", "asset"]); - -class AssetGenerator extends Generator { - /** - * @param {AssetGeneratorOptions["dataUrl"]=} dataUrlOptions the options for the data url - * @param {string=} filename override for output.assetModuleFilename - * @param {RawPublicPath=} publicPath override for output.assetModulePublicPath - * @param {AssetModuleOutputPath=} outputPath the output path for the emitted file which is not included in the runtime import - * @param {boolean=} emit generate output asset - */ - constructor(dataUrlOptions, filename, publicPath, outputPath, emit) { - super(); - this.dataUrlOptions = dataUrlOptions; - this.filename = filename; - this.publicPath = publicPath; - this.outputPath = outputPath; - this.emit = emit; - } - - /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code - */ - generate( - module, - { runtime, chunkGraph, runtimeTemplate, runtimeRequirements, type, getData } - ) { - switch (type) { - case "asset": - return module.originalSource(); - default: { - runtimeRequirements.add(RuntimeGlobals.module); - - const originalSource = module.originalSource(); - if (module.buildInfo.dataUrl) { - let encodedSource; - if (typeof this.dataUrlOptions === "function") { - encodedSource = this.dataUrlOptions.call( - null, - originalSource.source(), - { - filename: module.matchResource || module.resource, - module - } - ); - } else { - /** @type {string | false | undefined} */ - let encoding = this.dataUrlOptions.encoding; - if (encoding === undefined) { - if ( - module.resourceResolveData && - module.resourceResolveData.encoding !== undefined - ) { - encoding = module.resourceResolveData.encoding; - } - } - if (encoding === undefined) { - encoding = "base64"; - } - let ext; - let mimeType = this.dataUrlOptions.mimetype; - if (mimeType === undefined) { - ext = path.extname(module.nameForCondition()); - if ( - module.resourceResolveData && - module.resourceResolveData.mimetype !== undefined - ) { - mimeType = - module.resourceResolveData.mimetype + - module.resourceResolveData.parameters; - } else if (ext) { - mimeType = mimeTypes.lookup(ext); - } - } - if (typeof mimeType !== "string") { - throw new Error( - "DataUrl can't be generated automatically, " + - `because there is no mimetype for "${ext}" in mimetype database. ` + - 'Either pass a mimetype via "generator.mimetype" or ' + - 'use type: "asset/resource" to create a resource file instead of a DataUrl' - ); - } - - let encodedContent; +/** + * @param {WebpackOptions} options options to be modified + * @returns {void} + */ +const applyWebpackOptionsDefaults = options => { + F(options, "context", () => process.cwd()); + F(options, "target", () => { + return getDefaultTarget(options.context); + }); - if ( - module.resourceResolveData && - module.resourceResolveData.encoding === encoding && - decodeDataUriContent( - module.resourceResolveData.encoding, - module.resourceResolveData.encodedContent - ).equals(originalSource.buffer()) - ) { - encodedContent = module.resourceResolveData.encodedContent; - } else { - encodedContent = encodeDataUri(encoding, originalSource); - } + const { mode, name, target } = options; - encodedSource = `data:${mimeType}${ - encoding ? `;${encoding}` : "" - },${encodedContent}`; - } - const data = getData(); - data.set("url", Buffer.from(encodedSource)); - return new RawSource( - `${RuntimeGlobals.module}.exports = ${JSON.stringify( - encodedSource - )};` - ); - } else { - const assetModuleFilename = - this.filename || runtimeTemplate.outputOptions.assetModuleFilename; - const hash = createHash(runtimeTemplate.outputOptions.hashFunction); - if (runtimeTemplate.outputOptions.hashSalt) { - hash.update(runtimeTemplate.outputOptions.hashSalt); - } - hash.update(originalSource.buffer()); - const fullHash = /** @type {string} */ ( - hash.digest(runtimeTemplate.outputOptions.hashDigest) - ); - const contentHash = nonNumericOnlyHash( - fullHash, - runtimeTemplate.outputOptions.hashDigestLength - ); - module.buildInfo.fullContentHash = fullHash; - const sourceFilename = makePathsRelative( - runtimeTemplate.compilation.compiler.context, - module.matchResource || module.resource, - runtimeTemplate.compilation.compiler.root - ).replace(/^\.\//, ""); - let { path: filename, info: assetInfo } = - runtimeTemplate.compilation.getAssetPathWithInfo( - assetModuleFilename, - { - module, - runtime, - filename: sourceFilename, - chunkGraph, - contentHash - } - ); - let assetPath; - if (this.publicPath !== undefined) { - const { path, info } = - runtimeTemplate.compilation.getAssetPathWithInfo( - this.publicPath, - { - module, - runtime, - filename: sourceFilename, - chunkGraph, - contentHash - } - ); - assetInfo = mergeAssetInfo(assetInfo, info); - assetPath = JSON.stringify(path + filename); - } else { - runtimeRequirements.add(RuntimeGlobals.publicPath); // add __webpack_require__.p - assetPath = runtimeTemplate.concatenation( - { expr: RuntimeGlobals.publicPath }, - filename - ); - } - assetInfo = { - sourceFilename, - ...assetInfo - }; - if (this.outputPath) { - const { path: outputPath, info } = - runtimeTemplate.compilation.getAssetPathWithInfo( - this.outputPath, - { - module, - runtime, - filename: sourceFilename, - chunkGraph, - contentHash - } - ); - assetInfo = mergeAssetInfo(assetInfo, info); - filename = path.posix.join(outputPath, filename); - } - module.buildInfo.filename = filename; - module.buildInfo.assetInfo = assetInfo; - if (getData) { - // Due to code generation caching module.buildInfo.XXX can't used to store such information - // It need to be stored in the code generation results instead, where it's cached too - // TODO webpack 6 For back-compat reasons we also store in on module.buildInfo - const data = getData(); - data.set("fullContentHash", fullHash); - data.set("filename", filename); - data.set("assetInfo", assetInfo); - } + let targetProperties = + target === false + ? /** @type {false} */ (false) + : typeof target === "string" + ? getTargetProperties(target, options.context) + : getTargetsProperties(target, options.context); - return new RawSource( - `${RuntimeGlobals.module}.exports = ${assetPath};` - ); - } - } - } - } + const development = mode === "development"; + const production = mode === "production" || !mode; - /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) - */ - getTypes(module) { - if ((module.buildInfo && module.buildInfo.dataUrl) || this.emit === false) { - return JS_TYPES; - } else { - return JS_AND_ASSET_TYPES; + if (typeof options.entry !== "function") { + for (const key of Object.keys(options.entry)) { + F( + options.entry[key], + "import", + () => /** @type {[string]} */ (["./src"]) + ); } } - /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module - */ - getSize(module, type) { - switch (type) { - case "asset": { - const originalSource = module.originalSource(); - - if (!originalSource) { - return 0; - } + F(options, "devtool", () => (development ? "eval" : false)); + D(options, "watch", false); + D(options, "profile", false); + D(options, "parallelism", 100); + D(options, "recordsInputPath", false); + D(options, "recordsOutputPath", false); - return originalSource.size(); - } - default: - if (module.buildInfo && module.buildInfo.dataUrl) { - const originalSource = module.originalSource(); + applyExperimentsDefaults(options.experiments, { + production, + development, + targetProperties + }); - if (!originalSource) { - return 0; - } + const futureDefaults = options.experiments.futureDefaults; - // roughly for data url - // Example: m.exports="data:image/png;base64,ag82/f+2==" - // 4/3 = base64 encoding - // 34 = ~ data url header + footer + rounding - return originalSource.size() * 1.34 + 36; - } else { - // it's only estimated so this number is probably fine - // Example: m.exports=r.p+"0123456789012345678901.ext" - return 42; - } - } - } + F(options, "cache", () => + development ? { type: /** @type {"memory"} */ ("memory") } : false + ); + applyCacheDefaults(options.cache, { + name: name || "default", + mode: mode || "production", + development, + cacheUnaffected: options.experiments.cacheUnaffected + }); + const cache = !!options.cache; - /** - * @param {Hash} hash hash that will be modified - * @param {UpdateHashContext} updateHashContext context for updating hash - */ - updateHash(hash, { module }) { - hash.update(module.buildInfo.dataUrl ? "data-url" : "resource"); - } -} + applySnapshotDefaults(options.snapshot, { + production, + futureDefaults + }); -module.exports = AssetGenerator; + applyModuleDefaults(options.module, { + cache, + syncWebAssembly: options.experiments.syncWebAssembly, + asyncWebAssembly: options.experiments.asyncWebAssembly, + css: options.experiments.css, + futureDefaults + }); + applyOutputDefaults(options.output, { + context: options.context, + targetProperties, + isAffectedByBrowserslist: + target === undefined || + (typeof target === "string" && target.startsWith("browserslist")) || + (Array.isArray(target) && + target.some(target => target.startsWith("browserslist"))), + outputModule: options.experiments.outputModule, + development, + entry: options.entry, + module: options.module, + futureDefaults + }); -/***/ }), + applyExternalsPresetsDefaults(options.externalsPresets, { + targetProperties, + buildHttp: !!options.experiments.buildHttp + }); -/***/ 16109: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + applyLoaderDefaults(options.loader, { targetProperties }); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Yuta Hiroto @hiroppy -*/ + F(options, "externalsType", () => { + const validExternalTypes = (__webpack_require__(73342).definitions.ExternalsType["enum"]); + return options.output.library && + validExternalTypes.includes(options.output.library.type) + ? /** @type {ExternalsType} */ (options.output.library.type) + : options.output.module + ? "module" + : "var"; + }); + applyNodeDefaults(options.node, { + futureDefaults: options.experiments.futureDefaults, + targetProperties + }); + F(options, "performance", () => + production && + targetProperties && + (targetProperties.browser || targetProperties.browser === null) + ? {} + : false + ); + applyPerformanceDefaults(options.performance, { + production + }); -const { cleverMerge } = __webpack_require__(60839); -const { compareModulesByIdentifier } = __webpack_require__(29579); -const createSchemaValidation = __webpack_require__(32540); -const memoize = __webpack_require__(78676); + applyOptimizationDefaults(options.optimization, { + development, + production, + css: options.experiments.css, + records: !!(options.recordsInputPath || options.recordsOutputPath) + }); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ + options.resolve = cleverMerge( + getResolveDefaults({ + cache, + context: options.context, + targetProperties, + mode: options.mode + }), + options.resolve + ); -const getSchema = name => { - const { definitions } = __webpack_require__(73342); - return { - definitions, - oneOf: [{ $ref: `#/definitions/${name}` }] - }; + options.resolveLoader = cleverMerge( + getResolveLoaderDefaults({ cache }), + options.resolveLoader + ); }; -const generatorValidationOptions = { - name: "Asset Modules Plugin", - baseDataPath: "generator" -}; -const validateGeneratorOptions = { - asset: createSchemaValidation( - __webpack_require__(55125), - () => getSchema("AssetGeneratorOptions"), - generatorValidationOptions - ), - "asset/resource": createSchemaValidation( - __webpack_require__(4405), - () => getSchema("AssetResourceGeneratorOptions"), - generatorValidationOptions - ), - "asset/inline": createSchemaValidation( - __webpack_require__(62368), - () => getSchema("AssetInlineGeneratorOptions"), - generatorValidationOptions - ) -}; +/** + * @param {ExperimentsNormalized} experiments options + * @param {Object} options options + * @param {boolean} options.production is production + * @param {boolean} options.development is development mode + * @param {TargetProperties | false} options.targetProperties target properties + * @returns {void} + */ +const applyExperimentsDefaults = ( + experiments, + { production, development, targetProperties } +) => { + D(experiments, "futureDefaults", false); + D(experiments, "backCompat", !experiments.futureDefaults); + D(experiments, "topLevelAwait", experiments.futureDefaults); + D(experiments, "syncWebAssembly", false); + D(experiments, "asyncWebAssembly", experiments.futureDefaults); + D(experiments, "outputModule", false); + D(experiments, "layers", false); + D(experiments, "lazyCompilation", undefined); + D(experiments, "buildHttp", undefined); + D(experiments, "cacheUnaffected", experiments.futureDefaults); + F(experiments, "css", () => (experiments.futureDefaults ? {} : undefined)); -const validateParserOptions = createSchemaValidation( - __webpack_require__(45020), - () => getSchema("AssetParserOptions"), - { - name: "Asset Modules Plugin", - baseDataPath: "parser" + if (typeof experiments.buildHttp === "object") { + D(experiments.buildHttp, "frozen", production); + D(experiments.buildHttp, "upgrade", false); } -); - -const getAssetGenerator = memoize(() => __webpack_require__(98421)); -const getAssetParser = memoize(() => __webpack_require__(91112)); -const getAssetSourceParser = memoize(() => __webpack_require__(30953)); -const getAssetSourceGenerator = memoize(() => - __webpack_require__(18749) -); -const type = "asset"; -const plugin = "AssetModulesPlugin"; - -class AssetModulesPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - plugin, - (compilation, { normalModuleFactory }) => { - normalModuleFactory.hooks.createParser - .for("asset") - .tap(plugin, parserOptions => { - validateParserOptions(parserOptions); - parserOptions = cleverMerge( - compiler.options.module.parser.asset, - parserOptions - ); + if (typeof experiments.css === "object") { + D( + experiments.css, + "exportsOnly", + !targetProperties || !targetProperties.document + ); + } +}; - let dataUrlCondition = parserOptions.dataUrlCondition; - if (!dataUrlCondition || typeof dataUrlCondition === "object") { - dataUrlCondition = { - maxSize: 8096, - ...dataUrlCondition - }; - } - - const AssetParser = getAssetParser(); - - return new AssetParser(dataUrlCondition); - }); - normalModuleFactory.hooks.createParser - .for("asset/inline") - .tap(plugin, parserOptions => { - const AssetParser = getAssetParser(); - - return new AssetParser(true); - }); - normalModuleFactory.hooks.createParser - .for("asset/resource") - .tap(plugin, parserOptions => { - const AssetParser = getAssetParser(); - - return new AssetParser(false); - }); - normalModuleFactory.hooks.createParser - .for("asset/source") - .tap(plugin, parserOptions => { - const AssetSourceParser = getAssetSourceParser(); - - return new AssetSourceParser(); - }); - - for (const type of ["asset", "asset/inline", "asset/resource"]) { - normalModuleFactory.hooks.createGenerator - .for(type) - .tap(plugin, generatorOptions => { - validateGeneratorOptions[type](generatorOptions); - - let dataUrl = undefined; - if (type !== "asset/resource") { - dataUrl = generatorOptions.dataUrl; - if (!dataUrl || typeof dataUrl === "object") { - dataUrl = { - encoding: undefined, - mimetype: undefined, - ...dataUrl - }; - } - } - - let filename = undefined; - let publicPath = undefined; - let outputPath = undefined; - if (type !== "asset/inline") { - filename = generatorOptions.filename; - publicPath = generatorOptions.publicPath; - outputPath = generatorOptions.outputPath; - } - - const AssetGenerator = getAssetGenerator(); - - return new AssetGenerator( - dataUrl, - filename, - publicPath, - outputPath, - generatorOptions.emit !== false - ); - }); +/** + * @param {CacheOptions} cache options + * @param {Object} options options + * @param {string} options.name name + * @param {string} options.mode mode + * @param {boolean} options.development is development mode + * @param {boolean} options.cacheUnaffected the cacheUnaffected experiment is enabled + * @returns {void} + */ +const applyCacheDefaults = ( + cache, + { name, mode, development, cacheUnaffected } +) => { + if (cache === false) return; + switch (cache.type) { + case "filesystem": + F(cache, "name", () => name + "-" + mode); + D(cache, "version", ""); + F(cache, "cacheDirectory", () => { + const cwd = process.cwd(); + let dir = cwd; + for (;;) { + try { + if (fs.statSync(path.join(dir, "package.json")).isFile()) break; + // eslint-disable-next-line no-empty + } catch (e) {} + const parent = path.dirname(dir); + if (dir === parent) { + dir = undefined; + break; + } + dir = parent; } - normalModuleFactory.hooks.createGenerator - .for("asset/source") - .tap(plugin, () => { - const AssetSourceGenerator = getAssetSourceGenerator(); - - return new AssetSourceGenerator(); - }); - - compilation.hooks.renderManifest.tap(plugin, (result, options) => { - const { chunkGraph } = compilation; - const { chunk, codeGenerationResults } = options; + if (!dir) { + return path.resolve(cwd, ".cache/webpack"); + } else if (process.versions.pnp === "1") { + return path.resolve(dir, ".pnp/.cache/webpack"); + } else if (process.versions.pnp === "3") { + return path.resolve(dir, ".yarn/.cache/webpack"); + } else { + return path.resolve(dir, "node_modules/.cache/webpack"); + } + }); + F(cache, "cacheLocation", () => + path.resolve(cache.cacheDirectory, cache.name) + ); + D(cache, "hashAlgorithm", "md4"); + D(cache, "store", "pack"); + D(cache, "compression", false); + D(cache, "profile", false); + D(cache, "idleTimeout", 60000); + D(cache, "idleTimeoutForInitialStore", 5000); + D(cache, "idleTimeoutAfterLargeChanges", 1000); + D(cache, "maxMemoryGenerations", development ? 5 : Infinity); + D(cache, "maxAge", 1000 * 60 * 60 * 24 * 60); // 1 month + D(cache, "allowCollectingMemory", development); + D(cache, "memoryCacheUnaffected", development && cacheUnaffected); + D(cache.buildDependencies, "defaultWebpack", [ + path.resolve(__dirname, "..") + path.sep + ]); + break; + case "memory": + D(cache, "maxGenerations", Infinity); + D(cache, "cacheUnaffected", development && cacheUnaffected); + break; + } +}; - const modules = chunkGraph.getOrderedChunkModulesIterableBySourceType( - chunk, - "asset", - compareModulesByIdentifier +/** + * @param {SnapshotOptions} snapshot options + * @param {Object} options options + * @param {boolean} options.production is production + * @param {boolean} options.futureDefaults is future defaults enabled + * @returns {void} + */ +const applySnapshotDefaults = (snapshot, { production, futureDefaults }) => { + if (futureDefaults) { + F(snapshot, "managedPaths", () => + process.versions.pnp === "3" + ? [ + /^(.+?(?:[\\/]\.yarn[\\/]unplugged[\\/][^\\/]+)?[\\/]node_modules[\\/])/ + ] + : [/^(.+?[\\/]node_modules[\\/])/] + ); + F(snapshot, "immutablePaths", () => + process.versions.pnp === "3" + ? [/^(.+?[\\/]cache[\\/][^\\/]+\.zip[\\/]node_modules[\\/])/] + : [] + ); + } else { + A(snapshot, "managedPaths", () => { + if (process.versions.pnp === "3") { + const match = + /^(.+?)[\\/]cache[\\/]watchpack-npm-[^\\/]+\.zip[\\/]node_modules[\\/]/.exec( + /*require.resolve*/(36871) ); - if (modules) { - for (const module of modules) { - try { - const codeGenResult = codeGenerationResults.get( - module, - chunk.runtime - ); - result.push({ - render: () => codeGenResult.sources.get(type), - filename: - module.buildInfo.filename || - codeGenResult.data.get("filename"), - info: - module.buildInfo.assetInfo || - codeGenResult.data.get("assetInfo"), - auxiliary: true, - identifier: `assetModule${chunkGraph.getModuleId(module)}`, - hash: - module.buildInfo.fullContentHash || - codeGenResult.data.get("fullContentHash") - }); - } catch (e) { - e.message += `\nduring rendering of asset ${module.identifier()}`; - throw e; - } - } - } - - return result; - }); - - compilation.hooks.prepareModuleExecution.tap( - "AssetModulesPlugin", - (options, context) => { - const { codeGenerationResult } = options; - const source = codeGenerationResult.sources.get("asset"); - if (source === undefined) return; - context.assets.set(codeGenerationResult.data.get("filename"), { - source, - info: codeGenerationResult.data.get("assetInfo") - }); - } + if (match) { + return [path.resolve(match[1], "unplugged")]; + } + } else { + const match = /^(.+?[\\/]node_modules[\\/])/.exec( + // eslint-disable-next-line node/no-extraneous-require + /*require.resolve*/(36871) ); + if (match) { + return [match[1]]; + } } - ); + return []; + }); + A(snapshot, "immutablePaths", () => { + if (process.versions.pnp === "1") { + const match = + /^(.+?[\\/]v4)[\\/]npm-watchpack-[^\\/]+-[\da-f]{40}[\\/]node_modules[\\/]/.exec( + /*require.resolve*/(36871) + ); + if (match) { + return [match[1]]; + } + } else if (process.versions.pnp === "3") { + const match = + /^(.+?)[\\/]watchpack-npm-[^\\/]+\.zip[\\/]node_modules[\\/]/.exec( + /*require.resolve*/(36871) + ); + if (match) { + return [match[1]]; + } + } + return []; + }); } -} - -module.exports = AssetModulesPlugin; - - -/***/ }), - -/***/ 91112: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Yuta Hiroto @hiroppy -*/ - - + F(snapshot, "resolveBuildDependencies", () => ({ + timestamp: true, + hash: true + })); + F(snapshot, "buildDependencies", () => ({ timestamp: true, hash: true })); + F(snapshot, "module", () => + production ? { timestamp: true, hash: true } : { timestamp: true } + ); + F(snapshot, "resolve", () => + production ? { timestamp: true, hash: true } : { timestamp: true } + ); +}; -const Parser = __webpack_require__(11715); +/** + * @param {JavascriptParserOptions} parserOptions parser options + * @param {Object} options options + * @param {boolean} options.futureDefaults is future defaults enabled + * @returns {void} + */ +const applyJavascriptParserOptionsDefaults = ( + parserOptions, + { futureDefaults } +) => { + D(parserOptions, "unknownContextRequest", "."); + D(parserOptions, "unknownContextRegExp", false); + D(parserOptions, "unknownContextRecursive", true); + D(parserOptions, "unknownContextCritical", true); + D(parserOptions, "exprContextRequest", "."); + D(parserOptions, "exprContextRegExp", false); + D(parserOptions, "exprContextRecursive", true); + D(parserOptions, "exprContextCritical", true); + D(parserOptions, "wrappedContextRegExp", /.*/); + D(parserOptions, "wrappedContextRecursive", true); + D(parserOptions, "wrappedContextCritical", false); + D(parserOptions, "strictThisContextOnImports", false); + D(parserOptions, "importMeta", true); + if (futureDefaults) D(parserOptions, "exportsPresence", "error"); +}; -/** @typedef {import("../../declarations/WebpackOptions").AssetParserOptions} AssetParserOptions */ -/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ +/** + * @param {ModuleOptions} module options + * @param {Object} options options + * @param {boolean} options.cache is caching enabled + * @param {boolean} options.syncWebAssembly is syncWebAssembly enabled + * @param {boolean} options.asyncWebAssembly is asyncWebAssembly enabled + * @param {CssExperimentOptions} options.css is css enabled + * @param {boolean} options.futureDefaults is future defaults enabled + * @returns {void} + */ +const applyModuleDefaults = ( + module, + { cache, syncWebAssembly, asyncWebAssembly, css, futureDefaults } +) => { + if (cache) { + D(module, "unsafeCache", module => { + const name = module.nameForCondition(); + return name && NODE_MODULES_REGEXP.test(name); + }); + } else { + D(module, "unsafeCache", false); + } -class AssetParser extends Parser { - /** - * @param {AssetParserOptions["dataUrlCondition"] | boolean} dataUrlCondition condition for inlining as DataUrl - */ - constructor(dataUrlCondition) { - super(); - this.dataUrlCondition = dataUrlCondition; + F(module.parser, "asset", () => ({})); + F(module.parser.asset, "dataUrlCondition", () => ({})); + if (typeof module.parser.asset.dataUrlCondition === "object") { + D(module.parser.asset.dataUrlCondition, "maxSize", 8096); } - /** - * @param {string | Buffer | PreparsedAst} source the source to parse - * @param {ParserState} state the parser state - * @returns {ParserState} the parser state - */ - parse(source, state) { - if (typeof source === "object" && !Buffer.isBuffer(source)) { - throw new Error("AssetParser doesn't accept preparsed AST"); - } - state.module.buildInfo.strict = true; - state.module.buildMeta.exportsType = "default"; + F(module.parser, "javascript", () => ({})); + applyJavascriptParserOptionsDefaults(module.parser.javascript, { + futureDefaults + }); - if (typeof this.dataUrlCondition === "function") { - state.module.buildInfo.dataUrl = this.dataUrlCondition(source, { - filename: state.module.matchResource || state.module.resource, - module: state.module + A(module, "defaultRules", () => { + const esm = { + type: "javascript/esm", + resolve: { + byDependency: { + esm: { + fullySpecified: true + } + } + } + }; + const commonjs = { + type: "javascript/dynamic" + }; + /** @type {RuleSetRules} */ + const rules = [ + { + mimetype: "application/node", + type: "javascript/auto" + }, + { + test: /\.json$/i, + type: "json" + }, + { + mimetype: "application/json", + type: "json" + }, + { + test: /\.mjs$/i, + ...esm + }, + { + test: /\.js$/i, + descriptionData: { + type: "module" + }, + ...esm + }, + { + test: /\.cjs$/i, + ...commonjs + }, + { + test: /\.js$/i, + descriptionData: { + type: "commonjs" + }, + ...commonjs + }, + { + mimetype: { + or: ["text/javascript", "application/javascript"] + }, + ...esm + } + ]; + if (asyncWebAssembly) { + const wasm = { + type: "webassembly/async", + rules: [ + { + descriptionData: { + type: "module" + }, + resolve: { + fullySpecified: true + } + } + ] + }; + rules.push({ + test: /\.wasm$/i, + ...wasm + }); + rules.push({ + mimetype: "application/wasm", + ...wasm + }); + } else if (syncWebAssembly) { + const wasm = { + type: "webassembly/sync", + rules: [ + { + descriptionData: { + type: "module" + }, + resolve: { + fullySpecified: true + } + } + ] + }; + rules.push({ + test: /\.wasm$/i, + ...wasm + }); + rules.push({ + mimetype: "application/wasm", + ...wasm }); - } else if (typeof this.dataUrlCondition === "boolean") { - state.module.buildInfo.dataUrl = this.dataUrlCondition; - } else if ( - this.dataUrlCondition && - typeof this.dataUrlCondition === "object" - ) { - state.module.buildInfo.dataUrl = - Buffer.byteLength(source) <= this.dataUrlCondition.maxSize; - } else { - throw new Error("Unexpected dataUrlCondition type"); } - - return state; - } -} - -module.exports = AssetParser; - - -/***/ }), - -/***/ 18749: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sergey Melyukov @smelukov -*/ - - - -const { RawSource } = __webpack_require__(51255); -const Generator = __webpack_require__(93401); -const RuntimeGlobals = __webpack_require__(16475); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../NormalModule")} NormalModule */ - -const TYPES = new Set(["javascript"]); - -class AssetSourceGenerator extends Generator { - /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code - */ - generate(module, { chunkGraph, runtimeTemplate, runtimeRequirements }) { - runtimeRequirements.add(RuntimeGlobals.module); - - const originalSource = module.originalSource(); - - if (!originalSource) { - return new RawSource(""); - } - - const content = originalSource.source(); - - let encodedSource; - if (typeof content === "string") { - encodedSource = content; - } else { - encodedSource = content.toString("utf-8"); + if (css) { + const cssRule = { + type: "css", + resolve: { + fullySpecified: true, + preferRelative: true + } + }; + const cssModulesRule = { + type: "css/module", + resolve: { + fullySpecified: true + } + }; + rules.push({ + test: /\.css$/i, + oneOf: [ + { + test: /\.module\.css$/i, + ...cssModulesRule + }, + { + ...cssRule + } + ] + }); + rules.push({ + mimetype: "text/css+module", + ...cssModulesRule + }); + rules.push({ + mimetype: "text/css", + ...cssRule + }); } - return new RawSource( - `${RuntimeGlobals.module}.exports = ${JSON.stringify(encodedSource)};` + rules.push( + { + dependency: "url", + oneOf: [ + { + scheme: /^data$/, + type: "asset/inline" + }, + { + type: "asset/resource" + } + ] + }, + { + assert: { type: "json" }, + type: "json" + } ); - } + return rules; + }); +}; - /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) - */ - getTypes(module) { - return TYPES; +/** + * @param {Output} output options + * @param {Object} options options + * @param {string} options.context context + * @param {TargetProperties | false} options.targetProperties target properties + * @param {boolean} options.isAffectedByBrowserslist is affected by browserslist + * @param {boolean} options.outputModule is outputModule experiment enabled + * @param {boolean} options.development is development mode + * @param {Entry} options.entry entry option + * @param {ModuleOptions} options.module module option + * @param {boolean} options.futureDefaults is future defaults enabled + * @returns {void} + */ +const applyOutputDefaults = ( + output, + { + context, + targetProperties: tp, + isAffectedByBrowserslist, + outputModule, + development, + entry, + module, + futureDefaults } - +) => { /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module + * @param {Library=} library the library option + * @returns {string} a readable library name */ - getSize(module, type) { - const originalSource = module.originalSource(); + const getLibraryName = library => { + const libraryName = + typeof library === "object" && + library && + !Array.isArray(library) && + "type" in library + ? library.name + : /** @type {LibraryName=} */ (library); + if (Array.isArray(libraryName)) { + return libraryName.join("."); + } else if (typeof libraryName === "object") { + return getLibraryName(libraryName.root); + } else if (typeof libraryName === "string") { + return libraryName; + } + return ""; + }; - if (!originalSource) { - return 0; + F(output, "uniqueName", () => { + const libraryName = getLibraryName(output.library); + if (libraryName) return libraryName; + const pkgPath = path.resolve(context, "package.json"); + try { + const packageInfo = JSON.parse(fs.readFileSync(pkgPath, "utf-8")); + return packageInfo.name || ""; + } catch (e) { + if (e.code !== "ENOENT") { + e.message += `\nwhile determining default 'output.uniqueName' from 'name' in ${pkgPath}`; + throw e; + } + return ""; } + }); - // Example: m.exports="abcd" - return originalSource.size() + 12; + F(output, "module", () => !!outputModule); + D(output, "filename", output.module ? "[name].mjs" : "[name].js"); + F(output, "iife", () => !output.module); + D(output, "importFunctionName", "import"); + D(output, "importMetaName", "import.meta"); + F(output, "chunkFilename", () => { + const filename = output.filename; + if (typeof filename !== "function") { + const hasName = filename.includes("[name]"); + const hasId = filename.includes("[id]"); + const hasChunkHash = filename.includes("[chunkhash]"); + const hasContentHash = filename.includes("[contenthash]"); + // Anything changing depending on chunk is fine + if (hasChunkHash || hasContentHash || hasName || hasId) return filename; + // Otherwise prefix "[id]." in front of the basename to make it changing + return filename.replace(/(^|\/)([^/]*(?:\?|$))/, "$1[id].$2"); + } + return output.module ? "[id].mjs" : "[id].js"; + }); + F(output, "cssFilename", () => { + const filename = output.filename; + if (typeof filename !== "function") { + return filename.replace(/\.[mc]?js(\?|$)/, ".css$1"); + } + return "[id].css"; + }); + F(output, "cssChunkFilename", () => { + const chunkFilename = output.chunkFilename; + if (typeof chunkFilename !== "function") { + return chunkFilename.replace(/\.[mc]?js(\?|$)/, ".css$1"); + } + return "[id].css"; + }); + D(output, "assetModuleFilename", "[hash][ext][query]"); + D(output, "webassemblyModuleFilename", "[hash].module.wasm"); + D(output, "compareBeforeEmit", true); + D(output, "charset", true); + F(output, "hotUpdateGlobal", () => + Template.toIdentifier( + "webpackHotUpdate" + Template.toIdentifier(output.uniqueName) + ) + ); + F(output, "chunkLoadingGlobal", () => + Template.toIdentifier( + "webpackChunk" + Template.toIdentifier(output.uniqueName) + ) + ); + F(output, "globalObject", () => { + if (tp) { + if (tp.global) return "global"; + if (tp.globalThis) return "globalThis"; + } + return "self"; + }); + F(output, "chunkFormat", () => { + if (tp) { + const helpMessage = isAffectedByBrowserslist + ? "Make sure that your 'browserslist' includes only platforms that support these features or select an appropriate 'target' to allow selecting a chunk format by default. Alternatively specify the 'output.chunkFormat' directly." + : "Select an appropriate 'target' to allow selecting one by default, or specify the 'output.chunkFormat' directly."; + if (output.module) { + if (tp.dynamicImport) return "module"; + if (tp.document) return "array-push"; + throw new Error( + "For the selected environment is no default ESM chunk format available:\n" + + "ESM exports can be chosen when 'import()' is available.\n" + + "JSONP Array push can be chosen when 'document' is available.\n" + + helpMessage + ); + } else { + if (tp.document) return "array-push"; + if (tp.require) return "commonjs"; + if (tp.nodeBuiltins) return "commonjs"; + if (tp.importScripts) return "array-push"; + throw new Error( + "For the selected environment is no default script chunk format available:\n" + + "JSONP Array push can be chosen when 'document' or 'importScripts' is available.\n" + + "CommonJs exports can be chosen when 'require' or node builtins are available.\n" + + helpMessage + ); + } + } + throw new Error( + "Chunk format can't be selected by default when no target is specified" + ); + }); + D(output, "asyncChunks", true); + F(output, "chunkLoading", () => { + if (tp) { + switch (output.chunkFormat) { + case "array-push": + if (tp.document) return "jsonp"; + if (tp.importScripts) return "import-scripts"; + break; + case "commonjs": + if (tp.require) return "require"; + if (tp.nodeBuiltins) return "async-node"; + break; + case "module": + if (tp.dynamicImport) return "import"; + break; + } + if ( + tp.require === null || + tp.nodeBuiltins === null || + tp.document === null || + tp.importScripts === null + ) { + return "universal"; + } + } + return false; + }); + F(output, "workerChunkLoading", () => { + if (tp) { + switch (output.chunkFormat) { + case "array-push": + if (tp.importScriptsInWorker) return "import-scripts"; + break; + case "commonjs": + if (tp.require) return "require"; + if (tp.nodeBuiltins) return "async-node"; + break; + case "module": + if (tp.dynamicImportInWorker) return "import"; + break; + } + if ( + tp.require === null || + tp.nodeBuiltins === null || + tp.importScriptsInWorker === null + ) { + return "universal"; + } + } + return false; + }); + F(output, "wasmLoading", () => { + if (tp) { + if (tp.fetchWasm) return "fetch"; + if (tp.nodeBuiltins) + return output.module ? "async-node-module" : "async-node"; + if (tp.nodeBuiltins === null || tp.fetchWasm === null) { + return "universal"; + } + } + return false; + }); + F(output, "workerWasmLoading", () => output.wasmLoading); + F(output, "devtoolNamespace", () => output.uniqueName); + if (output.library) { + F(output.library, "type", () => (output.module ? "module" : "var")); } -} - -module.exports = AssetSourceGenerator; - - -/***/ }), - -/***/ 30953: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Yuta Hiroto @hiroppy -*/ - - + F(output, "path", () => path.join(process.cwd(), "dist")); + F(output, "pathinfo", () => development); + D(output, "sourceMapFilename", "[file].map[query]"); + D( + output, + "hotUpdateChunkFilename", + `[id].[fullhash].hot-update.${output.module ? "mjs" : "js"}` + ); + D(output, "hotUpdateMainFilename", "[runtime].[fullhash].hot-update.json"); + D(output, "crossOriginLoading", false); + F(output, "scriptType", () => (output.module ? "module" : false)); + D( + output, + "publicPath", + (tp && (tp.document || tp.importScripts)) || output.scriptType === "module" + ? "auto" + : "" + ); + D(output, "chunkLoadTimeout", 120000); + D(output, "hashFunction", futureDefaults ? "xxhash64" : "md4"); + D(output, "hashDigest", "hex"); + D(output, "hashDigestLength", futureDefaults ? 16 : 20); + D(output, "strictModuleExceptionHandling", false); -const Parser = __webpack_require__(11715); + const optimistic = v => v || v === undefined; + const conditionallyOptimistic = (v, c) => (v === undefined && c) || v; + F( + output.environment, + "arrowFunction", + () => tp && optimistic(tp.arrowFunction) + ); + F(output.environment, "const", () => tp && optimistic(tp.const)); + F( + output.environment, + "destructuring", + () => tp && optimistic(tp.destructuring) + ); + F(output.environment, "forOf", () => tp && optimistic(tp.forOf)); + F(output.environment, "bigIntLiteral", () => tp && tp.bigIntLiteral); + F(output.environment, "dynamicImport", () => + conditionallyOptimistic(tp && tp.dynamicImport, output.module) + ); + F(output.environment, "module", () => + conditionallyOptimistic(tp && tp.module, output.module) + ); -/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ + const { trustedTypes } = output; + if (trustedTypes) { + F( + trustedTypes, + "policyName", + () => + output.uniqueName.replace(/[^a-zA-Z0-9\-#=_/@.%]+/g, "_") || "webpack" + ); + } -class AssetSourceParser extends Parser { /** - * @param {string | Buffer | PreparsedAst} source the source to parse - * @param {ParserState} state the parser state - * @returns {ParserState} the parser state + * @param {function(EntryDescription): void} fn iterator + * @returns {void} */ - parse(source, state) { - if (typeof source === "object" && !Buffer.isBuffer(source)) { - throw new Error("AssetSourceParser doesn't accept preparsed AST"); + const forEachEntry = fn => { + for (const name of Object.keys(entry)) { + fn(entry[name]); } - const { module } = state; - module.buildInfo.strict = true; - module.buildMeta.exportsType = "default"; + }; + A(output, "enabledLibraryTypes", () => { + const enabledLibraryTypes = []; + if (output.library) { + enabledLibraryTypes.push(output.library.type); + } + forEachEntry(desc => { + if (desc.library) { + enabledLibraryTypes.push(desc.library.type); + } + }); + return enabledLibraryTypes; + }); - return state; - } -} + A(output, "enabledChunkLoadingTypes", () => { + const enabledChunkLoadingTypes = new Set(); + if (output.chunkLoading) { + enabledChunkLoadingTypes.add(output.chunkLoading); + } + if (output.workerChunkLoading) { + enabledChunkLoadingTypes.add(output.workerChunkLoading); + } + forEachEntry(desc => { + if (desc.chunkLoading) { + enabledChunkLoadingTypes.add(desc.chunkLoading); + } + }); + return Array.from(enabledChunkLoadingTypes); + }); -module.exports = AssetSourceParser; + A(output, "enabledWasmLoadingTypes", () => { + const enabledWasmLoadingTypes = new Set(); + if (output.wasmLoading) { + enabledWasmLoadingTypes.add(output.wasmLoading); + } + if (output.workerWasmLoading) { + enabledWasmLoadingTypes.add(output.workerWasmLoading); + } + forEachEntry(desc => { + if (desc.wasmLoading) { + enabledWasmLoadingTypes.add(desc.wasmLoading); + } + }); + return Array.from(enabledWasmLoadingTypes); + }); +}; +/** + * @param {ExternalsPresets} externalsPresets options + * @param {Object} options options + * @param {TargetProperties | false} options.targetProperties target properties + * @param {boolean} options.buildHttp buildHttp experiment enabled + * @returns {void} + */ +const applyExternalsPresetsDefaults = ( + externalsPresets, + { targetProperties, buildHttp } +) => { + D( + externalsPresets, + "web", + !buildHttp && targetProperties && targetProperties.web + ); + D(externalsPresets, "node", targetProperties && targetProperties.node); + D(externalsPresets, "nwjs", targetProperties && targetProperties.nwjs); + D( + externalsPresets, + "electron", + targetProperties && targetProperties.electron + ); + D( + externalsPresets, + "electronMain", + targetProperties && + targetProperties.electron && + targetProperties.electronMain + ); + D( + externalsPresets, + "electronPreload", + targetProperties && + targetProperties.electron && + targetProperties.electronPreload + ); + D( + externalsPresets, + "electronRenderer", + targetProperties && + targetProperties.electron && + targetProperties.electronRenderer + ); +}; -/***/ }), +/** + * @param {Loader} loader options + * @param {Object} options options + * @param {TargetProperties | false} options.targetProperties target properties + * @returns {void} + */ +const applyLoaderDefaults = (loader, { targetProperties }) => { + F(loader, "target", () => { + if (targetProperties) { + if (targetProperties.electron) { + if (targetProperties.electronMain) return "electron-main"; + if (targetProperties.electronPreload) return "electron-preload"; + if (targetProperties.electronRenderer) return "electron-renderer"; + return "electron"; + } + if (targetProperties.nwjs) return "nwjs"; + if (targetProperties.node) return "node"; + if (targetProperties.web) return "web"; + } + }); +}; -/***/ 19684: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * @param {WebpackNode} node options + * @param {Object} options options + * @param {TargetProperties | false} options.targetProperties target properties + * @param {boolean} options.futureDefaults is future defaults enabled + * @returns {void} + */ +const applyNodeDefaults = (node, { futureDefaults, targetProperties }) => { + if (node === false) return; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { RawSource } = __webpack_require__(51255); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); - -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ - -const TYPES = new Set(["javascript"]); - -class RawDataUrlModule extends Module { - /** - * @param {string} url raw url - * @param {string} identifier unique identifier - * @param {string=} readableIdentifier readable identifier - */ - constructor(url, identifier, readableIdentifier) { - super("asset/raw-data-url", null); - this.url = url; - this.urlBuffer = url ? Buffer.from(url) : undefined; - this.identifierStr = identifier || this.url; - this.readableIdentifierStr = readableIdentifier || this.identifierStr; - } - - /** - * @returns {Set} types available (do not mutate) - */ - getSourceTypes() { - return TYPES; - } - - /** - * @returns {string} a unique identifier of the module - */ - identifier() { - return this.identifierStr; - } + F(node, "global", () => { + if (targetProperties && targetProperties.global) return false; + // TODO webpack 6 should always default to false + return futureDefaults ? "warn" : true; + }); + F(node, "__filename", () => { + if (targetProperties && targetProperties.node) return "eval-only"; + // TODO webpack 6 should always default to false + return futureDefaults ? "warn-mock" : "mock"; + }); + F(node, "__dirname", () => { + if (targetProperties && targetProperties.node) return "eval-only"; + // TODO webpack 6 should always default to false + return futureDefaults ? "warn-mock" : "mock"; + }); +}; - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - if (this.url === undefined) this.url = this.urlBuffer.toString(); - return Math.max(1, this.url.length); - } +/** + * @param {Performance} performance options + * @param {Object} options options + * @param {boolean} options.production is production + * @returns {void} + */ +const applyPerformanceDefaults = (performance, { production }) => { + if (performance === false) return; + D(performance, "maxAssetSize", 250000); + D(performance, "maxEntrypointSize", 250000); + F(performance, "hints", () => (production ? "warning" : false)); +}; - /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module - */ - readableIdentifier(requestShortener) { - return requestShortener.shorten(this.readableIdentifierStr); +/** + * @param {Optimization} optimization options + * @param {Object} options options + * @param {boolean} options.production is production + * @param {boolean} options.development is development + * @param {CssExperimentOptions} options.css is css enabled + * @param {boolean} options.records using records + * @returns {void} + */ +const applyOptimizationDefaults = ( + optimization, + { production, development, css, records } +) => { + D(optimization, "removeAvailableModules", false); + D(optimization, "removeEmptyChunks", true); + D(optimization, "mergeDuplicateChunks", true); + D(optimization, "flagIncludedChunks", production); + F(optimization, "moduleIds", () => { + if (production) return "deterministic"; + if (development) return "named"; + return "natural"; + }); + F(optimization, "chunkIds", () => { + if (production) return "deterministic"; + if (development) return "named"; + return "natural"; + }); + F(optimization, "sideEffects", () => (production ? true : "flag")); + D(optimization, "providedExports", true); + D(optimization, "usedExports", production); + D(optimization, "innerGraph", production); + D(optimization, "mangleExports", production); + D(optimization, "concatenateModules", production); + D(optimization, "runtimeChunk", false); + D(optimization, "emitOnErrors", !production); + D(optimization, "checkWasmTypes", production); + D(optimization, "mangleWasmImports", false); + D(optimization, "portableRecords", records); + D(optimization, "realContentHash", production); + D(optimization, "minimize", production); + A(optimization, "minimizer", () => [ + { + apply: compiler => { + // Lazy load the Terser plugin + const TerserPlugin = __webpack_require__(55302); + new TerserPlugin({ + terserOptions: { + compress: { + passes: 2 + } + } + }).apply(compiler); + } + } + ]); + F(optimization, "nodeEnv", () => { + if (production) return "production"; + if (development) return "development"; + return false; + }); + const { splitChunks } = optimization; + if (splitChunks) { + A(splitChunks, "defaultSizeTypes", () => + css ? ["javascript", "css", "unknown"] : ["javascript", "unknown"] + ); + D(splitChunks, "hidePathInfo", production); + D(splitChunks, "chunks", "async"); + D(splitChunks, "usedExports", optimization.usedExports === true); + D(splitChunks, "minChunks", 1); + F(splitChunks, "minSize", () => (production ? 20000 : 10000)); + F(splitChunks, "minRemainingSize", () => (development ? 0 : undefined)); + F(splitChunks, "enforceSizeThreshold", () => (production ? 50000 : 30000)); + F(splitChunks, "maxAsyncRequests", () => (production ? 30 : Infinity)); + F(splitChunks, "maxInitialRequests", () => (production ? 30 : Infinity)); + D(splitChunks, "automaticNameDelimiter", "-"); + const { cacheGroups } = splitChunks; + F(cacheGroups, "default", () => ({ + idHint: "", + reuseExistingChunk: true, + minChunks: 2, + priority: -20 + })); + F(cacheGroups, "defaultVendors", () => ({ + idHint: "vendors", + reuseExistingChunk: true, + test: NODE_MODULES_REGEXP, + priority: -10 + })); } +}; - /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} - */ - needBuild(context, callback) { - return callback(null, !this.buildMeta); - } +/** + * @param {Object} options options + * @param {boolean} options.cache is cache enable + * @param {string} options.context build context + * @param {TargetProperties | false} options.targetProperties target properties + * @param {Mode} options.mode mode + * @returns {ResolveOptions} resolve options + */ +const getResolveDefaults = ({ cache, context, targetProperties, mode }) => { + /** @type {string[]} */ + const conditions = ["webpack"]; - /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} - */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = {}; - this.buildInfo = { - cacheable: true - }; - callback(); - } + conditions.push(mode === "development" ? "development" : "production"); - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration(context) { - if (this.url === undefined) this.url = this.urlBuffer.toString(); - const sources = new Map(); - sources.set( - "javascript", - new RawSource(`module.exports = ${JSON.stringify(this.url)};`) - ); - const data = new Map(); - data.set("url", this.urlBuffer); - const runtimeRequirements = new Set(); - runtimeRequirements.add(RuntimeGlobals.module); - return { sources, runtimeRequirements, data }; + if (targetProperties) { + if (targetProperties.webworker) conditions.push("worker"); + if (targetProperties.node) conditions.push("node"); + if (targetProperties.web) conditions.push("browser"); + if (targetProperties.electron) conditions.push("electron"); + if (targetProperties.nwjs) conditions.push("nwjs"); } - /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - hash.update(this.urlBuffer); - super.updateHash(hash, context); - } + const jsExtensions = [".js", ".json", ".wasm"]; - serialize(context) { - const { write } = context; + const tp = targetProperties; + const browserField = + tp && tp.web && (!tp.node || (tp.electron && tp.electronRenderer)); - write(this.urlBuffer); - write(this.identifierStr); - write(this.readableIdentifierStr); + /** @type {function(): ResolveOptions} */ + const cjsDeps = () => ({ + aliasFields: browserField ? ["browser"] : [], + mainFields: browserField ? ["browser", "module", "..."] : ["module", "..."], + conditionNames: ["require", "module", "..."], + extensions: [...jsExtensions] + }); + /** @type {function(): ResolveOptions} */ + const esmDeps = () => ({ + aliasFields: browserField ? ["browser"] : [], + mainFields: browserField ? ["browser", "module", "..."] : ["module", "..."], + conditionNames: ["import", "module", "..."], + extensions: [...jsExtensions] + }); - super.serialize(context); - } + /** @type {ResolveOptions} */ + const resolveOptions = { + cache, + modules: ["node_modules"], + conditionNames: conditions, + mainFiles: ["index"], + extensions: [], + aliasFields: [], + exportsFields: ["exports"], + roots: [context], + mainFields: ["main"], + byDependency: { + wasm: esmDeps(), + esm: esmDeps(), + loaderImport: esmDeps(), + url: { + preferRelative: true + }, + worker: { + ...esmDeps(), + preferRelative: true + }, + commonjs: cjsDeps(), + amd: cjsDeps(), + // for backward-compat: loadModule + loader: cjsDeps(), + // for backward-compat: Custom Dependency + unknown: cjsDeps(), + // for backward-compat: getResolve without dependencyType + undefined: cjsDeps() + } + }; - deserialize(context) { - const { read } = context; + return resolveOptions; +}; - this.urlBuffer = read(); - this.identifierStr = read(); - this.readableIdentifierStr = read(); +/** + * @param {Object} options options + * @param {boolean} options.cache is cache enable + * @returns {ResolveOptions} resolve options + */ +const getResolveLoaderDefaults = ({ cache }) => { + /** @type {ResolveOptions} */ + const resolveOptions = { + cache, + conditionNames: ["loader", "require", "node"], + exportsFields: ["exports"], + mainFields: ["loader", "main"], + extensions: [".js"], + mainFiles: ["index"] + }; - super.deserialize(context); - } -} + return resolveOptions; +}; -makeSerializable(RawDataUrlModule, "webpack/lib/asset/RawDataUrlModule"); +/** + * @param {InfrastructureLogging} infrastructureLogging options + * @returns {void} + */ +const applyInfrastructureLoggingDefaults = infrastructureLogging => { + F(infrastructureLogging, "stream", () => process.stderr); + const tty = + /** @type {any} */ (infrastructureLogging.stream).isTTY && + process.env.TERM !== "dumb"; + D(infrastructureLogging, "level", "info"); + D(infrastructureLogging, "debug", false); + D(infrastructureLogging, "colors", tty); + D(infrastructureLogging, "appendOnly", !tty); +}; -module.exports = RawDataUrlModule; +exports.applyWebpackOptionsBaseDefaults = applyWebpackOptionsBaseDefaults; +exports.applyWebpackOptionsDefaults = applyWebpackOptionsDefaults; /***/ }), -/***/ 41153: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 26693: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -66317,137 +65386,533 @@ module.exports = RawDataUrlModule; -const InitFragment = __webpack_require__(55870); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ - -/** - * @typedef {GenerateContext} Context - */ -class AwaitDependenciesInitFragment extends InitFragment { - /** - * @param {Set} promises the promises that should be awaited - */ - constructor(promises) { - super( - undefined, - InitFragment.STAGE_ASYNC_DEPENDENCIES, - 0, - "await-dependencies" - ); - this.promises = promises; - } +const util = __webpack_require__(73837); - merge(other) { - const promises = new Set(other.promises); - for (const p of this.promises) { - promises.add(p); - } - return new AwaitDependenciesInitFragment(promises); - } +/** @typedef {import("../../declarations/WebpackOptions").EntryStatic} EntryStatic */ +/** @typedef {import("../../declarations/WebpackOptions").EntryStaticNormalized} EntryStaticNormalized */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryName} LibraryName */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").OptimizationRuntimeChunk} OptimizationRuntimeChunk */ +/** @typedef {import("../../declarations/WebpackOptions").OptimizationRuntimeChunkNormalized} OptimizationRuntimeChunkNormalized */ +/** @typedef {import("../../declarations/WebpackOptions").OutputNormalized} OutputNormalized */ +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptions} WebpackOptions */ +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptionsNormalized */ - /** - * @param {Context} context context - * @returns {string|Source} the source code that will be included as initialization code - */ - getContent({ runtimeRequirements }) { - runtimeRequirements.add(RuntimeGlobals.module); - const promises = this.promises; - if (promises.size === 0) { - return ""; - } - if (promises.size === 1) { - for (const p of promises) { - return Template.asString([ - `var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${p}]);`, - `${p} = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];`, - "" - ]); - } +const handledDeprecatedNoEmitOnErrors = util.deprecate( + (noEmitOnErrors, emitOnErrors) => { + if (emitOnErrors !== undefined && !noEmitOnErrors === !emitOnErrors) { + throw new Error( + "Conflicting use of 'optimization.noEmitOnErrors' and 'optimization.emitOnErrors'. Remove deprecated 'optimization.noEmitOnErrors' from config." + ); } - const sepPromises = Array.from(promises).join(", "); - // TODO check if destructuring is supported - return Template.asString([ - `var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${sepPromises}]);`, - `([${sepPromises}] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);`, - "" - ]); - } -} + return !noEmitOnErrors; + }, + "optimization.noEmitOnErrors is deprecated in favor of optimization.emitOnErrors", + "DEP_WEBPACK_CONFIGURATION_OPTIMIZATION_NO_EMIT_ON_ERRORS" +); -module.exports = AwaitDependenciesInitFragment; +/** + * @template T + * @template R + * @param {T|undefined} value value or not + * @param {function(T): R} fn nested handler + * @returns {R} result value + */ +const nestedConfig = (value, fn) => + value === undefined ? fn(/** @type {T} */ ({})) : fn(value); +/** + * @template T + * @param {T|undefined} value value or not + * @returns {T} result value + */ +const cloneObject = value => { + return /** @type {T} */ ({ ...value }); +}; -/***/ }), +/** + * @template T + * @template R + * @param {T|undefined} value value or not + * @param {function(T): R} fn nested handler + * @returns {R|undefined} result value + */ +const optionalNestedConfig = (value, fn) => + value === undefined ? undefined : fn(value); -/***/ 59498: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * @template T + * @template R + * @param {T[]|undefined} value array or not + * @param {function(T[]): R[]} fn nested handler + * @returns {R[]|undefined} cloned value + */ +const nestedArray = (value, fn) => (Array.isArray(value) ? fn(value) : fn([])); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** + * @template T + * @template R + * @param {T[]|undefined} value array or not + * @param {function(T[]): R[]} fn nested handler + * @returns {R[]|undefined} cloned value + */ +const optionalNestedArray = (value, fn) => + Array.isArray(value) ? fn(value) : undefined; +/** + * @template T + * @template R + * @param {Record|undefined} value value or not + * @param {function(T): R} fn nested handler + * @param {Record=} customKeys custom nested handler for some keys + * @returns {Record} result value + */ +const keyedNestedConfig = (value, fn, customKeys) => { + const result = + value === undefined + ? {} + : Object.keys(value).reduce( + (obj, key) => ( + (obj[key] = ( + customKeys && key in customKeys ? customKeys[key] : fn + )(value[key])), + obj + ), + /** @type {Record} */ ({}) + ); + if (customKeys) { + for (const key of Object.keys(customKeys)) { + if (!(key in result)) { + result[key] = customKeys[key](/** @type {T} */ ({})); + } + } + } + return result; +}; - -const HarmonyImportDependency = __webpack_require__(57154); - -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ - -class InferAsyncModulesPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap("InferAsyncModulesPlugin", compilation => { - const { moduleGraph } = compilation; - compilation.hooks.finishModules.tap( - "InferAsyncModulesPlugin", - modules => { - /** @type {Set} */ - const queue = new Set(); - for (const module of modules) { - if (module.buildMeta && module.buildMeta.async) { - queue.add(module); +/** + * @param {WebpackOptions} config input config + * @returns {WebpackOptionsNormalized} normalized options + */ +const getNormalizedWebpackOptions = config => { + return { + amd: config.amd, + bail: config.bail, + cache: optionalNestedConfig(config.cache, cache => { + if (cache === false) return false; + if (cache === true) { + return { + type: "memory", + maxGenerations: undefined + }; + } + switch (cache.type) { + case "filesystem": + return { + type: "filesystem", + allowCollectingMemory: cache.allowCollectingMemory, + maxMemoryGenerations: cache.maxMemoryGenerations, + maxAge: cache.maxAge, + profile: cache.profile, + buildDependencies: cloneObject(cache.buildDependencies), + cacheDirectory: cache.cacheDirectory, + cacheLocation: cache.cacheLocation, + hashAlgorithm: cache.hashAlgorithm, + compression: cache.compression, + idleTimeout: cache.idleTimeout, + idleTimeoutForInitialStore: cache.idleTimeoutForInitialStore, + idleTimeoutAfterLargeChanges: cache.idleTimeoutAfterLargeChanges, + name: cache.name, + store: cache.store, + version: cache.version + }; + case undefined: + case "memory": + return { + type: "memory", + maxGenerations: cache.maxGenerations + }; + default: + // @ts-expect-error Property 'type' does not exist on type 'never'. ts(2339) + throw new Error(`Not implemented cache.type ${cache.type}`); + } + }), + context: config.context, + dependencies: config.dependencies, + devServer: optionalNestedConfig(config.devServer, devServer => ({ + ...devServer + })), + devtool: config.devtool, + entry: + config.entry === undefined + ? { main: {} } + : typeof config.entry === "function" + ? ( + fn => () => + Promise.resolve().then(fn).then(getNormalizedEntryStatic) + )(config.entry) + : getNormalizedEntryStatic(config.entry), + experiments: nestedConfig(config.experiments, experiments => ({ + ...experiments, + buildHttp: optionalNestedConfig(experiments.buildHttp, options => + Array.isArray(options) ? { allowedUris: options } : options + ), + lazyCompilation: optionalNestedConfig( + experiments.lazyCompilation, + options => + options === true ? {} : options === false ? undefined : options + ), + css: optionalNestedConfig(experiments.css, options => + options === true ? {} : options === false ? undefined : options + ) + })), + externals: config.externals, + externalsPresets: cloneObject(config.externalsPresets), + externalsType: config.externalsType, + ignoreWarnings: config.ignoreWarnings + ? config.ignoreWarnings.map(ignore => { + if (typeof ignore === "function") return ignore; + const i = ignore instanceof RegExp ? { message: ignore } : ignore; + return (warning, { requestShortener }) => { + if (!i.message && !i.module && !i.file) return false; + if (i.message && !i.message.test(warning.message)) { + return false; } - } - for (const module of queue) { - moduleGraph.setAsync(module); - for (const [ - originModule, - connections - ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { - if ( - connections.some( - c => - c.dependency instanceof HarmonyImportDependency && - c.isTargetActive(undefined) - ) - ) { - queue.add(originModule); - } + if ( + i.module && + (!warning.module || + !i.module.test( + warning.module.readableIdentifier(requestShortener) + )) + ) { + return false; } - } + if (i.file && (!warning.file || !i.file.test(warning.file))) { + return false; + } + return true; + }; + }) + : undefined, + infrastructureLogging: cloneObject(config.infrastructureLogging), + loader: cloneObject(config.loader), + mode: config.mode, + module: nestedConfig(config.module, module => ({ + noParse: module.noParse, + unsafeCache: module.unsafeCache, + parser: keyedNestedConfig(module.parser, cloneObject, { + javascript: parserOptions => ({ + unknownContextRequest: module.unknownContextRequest, + unknownContextRegExp: module.unknownContextRegExp, + unknownContextRecursive: module.unknownContextRecursive, + unknownContextCritical: module.unknownContextCritical, + exprContextRequest: module.exprContextRequest, + exprContextRegExp: module.exprContextRegExp, + exprContextRecursive: module.exprContextRecursive, + exprContextCritical: module.exprContextCritical, + wrappedContextRegExp: module.wrappedContextRegExp, + wrappedContextRecursive: module.wrappedContextRecursive, + wrappedContextCritical: module.wrappedContextCritical, + // TODO webpack 6 remove + strictExportPresence: module.strictExportPresence, + strictThisContextOnImports: module.strictThisContextOnImports, + ...parserOptions + }) + }), + generator: cloneObject(module.generator), + defaultRules: optionalNestedArray(module.defaultRules, r => [...r]), + rules: nestedArray(module.rules, r => [...r]) + })), + name: config.name, + node: nestedConfig( + config.node, + node => + node && { + ...node } - ); - }); + ), + optimization: nestedConfig(config.optimization, optimization => { + return { + ...optimization, + runtimeChunk: getNormalizedOptimizationRuntimeChunk( + optimization.runtimeChunk + ), + splitChunks: nestedConfig( + optimization.splitChunks, + splitChunks => + splitChunks && { + ...splitChunks, + defaultSizeTypes: splitChunks.defaultSizeTypes + ? [...splitChunks.defaultSizeTypes] + : ["..."], + cacheGroups: cloneObject(splitChunks.cacheGroups) + } + ), + emitOnErrors: + optimization.noEmitOnErrors !== undefined + ? handledDeprecatedNoEmitOnErrors( + optimization.noEmitOnErrors, + optimization.emitOnErrors + ) + : optimization.emitOnErrors + }; + }), + output: nestedConfig(config.output, output => { + const { library } = output; + const libraryAsName = /** @type {LibraryName} */ (library); + const libraryBase = + typeof library === "object" && + library && + !Array.isArray(library) && + "type" in library + ? library + : libraryAsName || output.libraryTarget + ? /** @type {LibraryOptions} */ ({ + name: libraryAsName + }) + : undefined; + /** @type {OutputNormalized} */ + const result = { + assetModuleFilename: output.assetModuleFilename, + asyncChunks: output.asyncChunks, + charset: output.charset, + chunkFilename: output.chunkFilename, + chunkFormat: output.chunkFormat, + chunkLoading: output.chunkLoading, + chunkLoadingGlobal: output.chunkLoadingGlobal, + chunkLoadTimeout: output.chunkLoadTimeout, + cssFilename: output.cssFilename, + cssChunkFilename: output.cssChunkFilename, + clean: output.clean, + compareBeforeEmit: output.compareBeforeEmit, + crossOriginLoading: output.crossOriginLoading, + devtoolFallbackModuleFilenameTemplate: + output.devtoolFallbackModuleFilenameTemplate, + devtoolModuleFilenameTemplate: output.devtoolModuleFilenameTemplate, + devtoolNamespace: output.devtoolNamespace, + environment: cloneObject(output.environment), + enabledChunkLoadingTypes: output.enabledChunkLoadingTypes + ? [...output.enabledChunkLoadingTypes] + : ["..."], + enabledLibraryTypes: output.enabledLibraryTypes + ? [...output.enabledLibraryTypes] + : ["..."], + enabledWasmLoadingTypes: output.enabledWasmLoadingTypes + ? [...output.enabledWasmLoadingTypes] + : ["..."], + filename: output.filename, + globalObject: output.globalObject, + hashDigest: output.hashDigest, + hashDigestLength: output.hashDigestLength, + hashFunction: output.hashFunction, + hashSalt: output.hashSalt, + hotUpdateChunkFilename: output.hotUpdateChunkFilename, + hotUpdateGlobal: output.hotUpdateGlobal, + hotUpdateMainFilename: output.hotUpdateMainFilename, + iife: output.iife, + importFunctionName: output.importFunctionName, + importMetaName: output.importMetaName, + scriptType: output.scriptType, + library: libraryBase && { + type: + output.libraryTarget !== undefined + ? output.libraryTarget + : libraryBase.type, + auxiliaryComment: + output.auxiliaryComment !== undefined + ? output.auxiliaryComment + : libraryBase.auxiliaryComment, + export: + output.libraryExport !== undefined + ? output.libraryExport + : libraryBase.export, + name: libraryBase.name, + umdNamedDefine: + output.umdNamedDefine !== undefined + ? output.umdNamedDefine + : libraryBase.umdNamedDefine + }, + module: output.module, + path: output.path, + pathinfo: output.pathinfo, + publicPath: output.publicPath, + sourceMapFilename: output.sourceMapFilename, + sourcePrefix: output.sourcePrefix, + strictModuleExceptionHandling: output.strictModuleExceptionHandling, + trustedTypes: optionalNestedConfig( + output.trustedTypes, + trustedTypes => { + if (trustedTypes === true) return {}; + if (typeof trustedTypes === "string") + return { policyName: trustedTypes }; + return { ...trustedTypes }; + } + ), + uniqueName: output.uniqueName, + wasmLoading: output.wasmLoading, + webassemblyModuleFilename: output.webassemblyModuleFilename, + workerChunkLoading: output.workerChunkLoading, + workerWasmLoading: output.workerWasmLoading + }; + return result; + }), + parallelism: config.parallelism, + performance: optionalNestedConfig(config.performance, performance => { + if (performance === false) return false; + return { + ...performance + }; + }), + plugins: nestedArray(config.plugins, p => [...p]), + profile: config.profile, + recordsInputPath: + config.recordsInputPath !== undefined + ? config.recordsInputPath + : config.recordsPath, + recordsOutputPath: + config.recordsOutputPath !== undefined + ? config.recordsOutputPath + : config.recordsPath, + resolve: nestedConfig(config.resolve, resolve => ({ + ...resolve, + byDependency: keyedNestedConfig(resolve.byDependency, cloneObject) + })), + resolveLoader: cloneObject(config.resolveLoader), + snapshot: nestedConfig(config.snapshot, snapshot => ({ + resolveBuildDependencies: optionalNestedConfig( + snapshot.resolveBuildDependencies, + resolveBuildDependencies => ({ + timestamp: resolveBuildDependencies.timestamp, + hash: resolveBuildDependencies.hash + }) + ), + buildDependencies: optionalNestedConfig( + snapshot.buildDependencies, + buildDependencies => ({ + timestamp: buildDependencies.timestamp, + hash: buildDependencies.hash + }) + ), + resolve: optionalNestedConfig(snapshot.resolve, resolve => ({ + timestamp: resolve.timestamp, + hash: resolve.hash + })), + module: optionalNestedConfig(snapshot.module, module => ({ + timestamp: module.timestamp, + hash: module.hash + })), + immutablePaths: optionalNestedArray(snapshot.immutablePaths, p => [...p]), + managedPaths: optionalNestedArray(snapshot.managedPaths, p => [...p]) + })), + stats: nestedConfig(config.stats, stats => { + if (stats === false) { + return { + preset: "none" + }; + } + if (stats === true) { + return { + preset: "normal" + }; + } + if (typeof stats === "string") { + return { + preset: stats + }; + } + return { + ...stats + }; + }), + target: config.target, + watch: config.watch, + watchOptions: cloneObject(config.watchOptions) + }; +}; + +/** + * @param {EntryStatic} entry static entry options + * @returns {EntryStaticNormalized} normalized static entry options + */ +const getNormalizedEntryStatic = entry => { + if (typeof entry === "string") { + return { + main: { + import: [entry] + } + }; } -} + if (Array.isArray(entry)) { + return { + main: { + import: entry + } + }; + } + /** @type {EntryStaticNormalized} */ + const result = {}; + for (const key of Object.keys(entry)) { + const value = entry[key]; + if (typeof value === "string") { + result[key] = { + import: [value] + }; + } else if (Array.isArray(value)) { + result[key] = { + import: value + }; + } else { + result[key] = { + import: + value.import && + (Array.isArray(value.import) ? value.import : [value.import]), + filename: value.filename, + layer: value.layer, + runtime: value.runtime, + publicPath: value.publicPath, + chunkLoading: value.chunkLoading, + asyncChunks: value.asyncChunks, + wasmLoading: value.wasmLoading, + dependOn: + value.dependOn && + (Array.isArray(value.dependOn) ? value.dependOn : [value.dependOn]), + library: value.library + }; + } + } + return result; +}; -module.exports = InferAsyncModulesPlugin; +/** + * @param {OptimizationRuntimeChunk=} runtimeChunk runtimeChunk option + * @returns {OptimizationRuntimeChunkNormalized=} normalized runtimeChunk option + */ +const getNormalizedOptimizationRuntimeChunk = runtimeChunk => { + if (runtimeChunk === undefined) return undefined; + if (runtimeChunk === false) return false; + if (runtimeChunk === "single") { + return { + name: () => "runtime" + }; + } + if (runtimeChunk === true || runtimeChunk === "multiple") { + return { + name: entrypoint => `runtime~${entrypoint.name}` + }; + } + const { name } = runtimeChunk; + return { + name: typeof name === "function" ? name : () => name + }; +}; + +exports.getNormalizedWebpackOptions = getNormalizedWebpackOptions; /***/ }), -/***/ 79233: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 52801: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -66457,1406 +65922,1116 @@ module.exports = InferAsyncModulesPlugin; -const AsyncDependencyToInitialChunkError = __webpack_require__(30111); -const { connectChunkGroupParentAndChild } = __webpack_require__(37234); -const ModuleGraphConnection = __webpack_require__(40639); -const { getEntryRuntime, mergeRuntime } = __webpack_require__(17156); +const memoize = __webpack_require__(78676); -/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ -/** @typedef {import("./Chunk")} Chunk */ -/** @typedef {import("./ChunkGroup")} ChunkGroup */ -/** @typedef {import("./Compilation")} Compilation */ -/** @typedef {import("./DependenciesBlock")} DependenciesBlock */ -/** @typedef {import("./Dependency")} Dependency */ -/** @typedef {import("./Entrypoint")} Entrypoint */ -/** @typedef {import("./Module")} Module */ -/** @typedef {import("./ModuleGraph")} ModuleGraph */ -/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("./logging/Logger").Logger} Logger */ -/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ +const getBrowserslistTargetHandler = memoize(() => + __webpack_require__(43950) +); /** - * @typedef {Object} QueueItem - * @property {number} action - * @property {DependenciesBlock} block - * @property {Module} module - * @property {Chunk} chunk - * @property {ChunkGroup} chunkGroup - * @property {ChunkGroupInfo} chunkGroupInfo + * @param {string} context the context directory + * @returns {string} default target */ +const getDefaultTarget = context => { + const browsers = getBrowserslistTargetHandler().load(null, context); + return browsers ? "browserslist" : "web"; +}; -/** @typedef {Set & { plus: Set }} ModuleSetPlus */ +/** + * @typedef {Object} PlatformTargetProperties + * @property {boolean | null} web web platform, importing of http(s) and std: is available + * @property {boolean | null} browser browser platform, running in a normal web browser + * @property {boolean | null} webworker (Web)Worker platform, running in a web/shared/service worker + * @property {boolean | null} node node platform, require of node built-in modules is available + * @property {boolean | null} nwjs nwjs platform, require of legacy nw.gui is available + * @property {boolean | null} electron electron platform, require of some electron built-in modules is available + */ /** - * @typedef {Object} ChunkGroupInfo - * @property {ChunkGroup} chunkGroup the chunk group - * @property {RuntimeSpec} runtime the runtimes - * @property {ModuleSetPlus} minAvailableModules current minimal set of modules available at this point - * @property {boolean} minAvailableModulesOwned true, if minAvailableModules is owned and can be modified - * @property {ModuleSetPlus[]} availableModulesToBeMerged enqueued updates to the minimal set of available modules - * @property {Set=} skippedItems modules that were skipped because module is already available in parent chunks (need to reconsider when minAvailableModules is shrinking) - * @property {Set<[Module, ConnectionState]>=} skippedModuleConnections referenced modules that where skipped because they were not active in this runtime - * @property {ModuleSetPlus} resultingAvailableModules set of modules available including modules from this chunk group - * @property {Set} children set of children chunk groups, that will be revisited when availableModules shrink - * @property {Set} availableSources set of chunk groups that are the source for minAvailableModules - * @property {Set} availableChildren set of chunk groups which depend on the this chunk group as availableSource - * @property {number} preOrderIndex next pre order index - * @property {number} postOrderIndex next post order index - * @property {boolean} chunkLoading has a chunk loading mechanism - * @property {boolean} asyncChunks create async chunks + * @typedef {Object} ElectronContextTargetProperties + * @property {boolean | null} electronMain in main context + * @property {boolean | null} electronPreload in preload context + * @property {boolean | null} electronRenderer in renderer context with node integration */ /** - * @typedef {Object} BlockChunkGroupConnection - * @property {ChunkGroupInfo} originChunkGroupInfo origin chunk group - * @property {ChunkGroup} chunkGroup referenced chunk group + * @typedef {Object} ApiTargetProperties + * @property {boolean | null} require has require function available + * @property {boolean | null} nodeBuiltins has node.js built-in modules available + * @property {boolean | null} document has document available (allows script tags) + * @property {boolean | null} importScripts has importScripts available + * @property {boolean | null} importScriptsInWorker has importScripts available when creating a worker + * @property {boolean | null} fetchWasm has fetch function available for WebAssembly + * @property {boolean | null} global has global variable available */ -const EMPTY_SET = /** @type {ModuleSetPlus} */ (new Set()); -EMPTY_SET.plus = EMPTY_SET; - /** - * @param {ModuleSetPlus} a first set - * @param {ModuleSetPlus} b second set - * @returns {number} cmp + * @typedef {Object} EcmaTargetProperties + * @property {boolean | null} globalThis has globalThis variable available + * @property {boolean | null} bigIntLiteral big int literal syntax is available + * @property {boolean | null} const const and let variable declarations are available + * @property {boolean | null} arrowFunction arrow functions are available + * @property {boolean | null} forOf for of iteration is available + * @property {boolean | null} destructuring destructuring is available + * @property {boolean | null} dynamicImport async import() is available + * @property {boolean | null} dynamicImportInWorker async import() is available when creating a worker + * @property {boolean | null} module ESM syntax is available (when in module) + * @property {boolean | null} optionalChaining optional chaining is available + * @property {boolean | null} templateLiteral template literal is available */ -const bySetSize = (a, b) => { - return b.size + b.plus.size - a.size - a.plus.size; + +///** @typedef {PlatformTargetProperties | ApiTargetProperties | EcmaTargetProperties | PlatformTargetProperties & ApiTargetProperties | PlatformTargetProperties & EcmaTargetProperties | ApiTargetProperties & EcmaTargetProperties} TargetProperties */ +/** @template T @typedef {{ [P in keyof T]?: never }} Never */ +/** @template A @template B @typedef {(A & Never) | (Never & B) | (A & B)} Mix */ +/** @typedef {Mix, Mix>} TargetProperties */ + +const versionDependent = (major, minor) => { + if (!major) return () => /** @type {undefined} */ (undefined); + major = +major; + minor = minor ? +minor : 0; + return (vMajor, vMinor = 0) => { + return major > vMajor || (major === vMajor && minor >= vMinor); + }; }; -const extractBlockModules = (module, moduleGraph, runtime, blockModulesMap) => { - let blockCache; - let modules; +/** @type {[string, string, RegExp, (...args: string[]) => TargetProperties | false][]} */ +const TARGETS = [ + [ + "browserslist / browserslist:env / browserslist:query / browserslist:path-to-config / browserslist:path-to-config:env", + "Resolve features from browserslist. Will resolve browserslist config automatically. Only browser or node queries are supported (electron is not supported). Examples: 'browserslist:modern' to use 'modern' environment from browserslist config", + /^browserslist(?::(.+))?$/, + (rest, context) => { + const browserslistTargetHandler = getBrowserslistTargetHandler(); + const browsers = browserslistTargetHandler.load( + rest ? rest.trim() : null, + context + ); + if (!browsers) { + throw new Error(`No browserslist config found to handle the 'browserslist' target. +See https://github.com/browserslist/browserslist#queries for possible ways to provide a config. +The recommended way is to add a 'browserslist' key to your package.json and list supported browsers (resp. node.js versions). +You can also more options via the 'target' option: 'browserslist' / 'browserslist:env' / 'browserslist:query' / 'browserslist:path-to-config' / 'browserslist:path-to-config:env'`); + } + return browserslistTargetHandler.resolve(browsers); + } + ], + [ + "web", + "Web browser.", + /^web$/, + () => { + return { + web: true, + browser: true, + webworker: null, + node: false, + electron: false, + nwjs: false, - const arrays = []; + document: true, + importScriptsInWorker: true, + fetchWasm: true, + nodeBuiltins: false, + importScripts: false, + require: false, + global: false + }; + } + ], + [ + "webworker", + "Web Worker, SharedWorker or Service Worker.", + /^webworker$/, + () => { + return { + web: true, + browser: true, + webworker: true, + node: false, + electron: false, + nwjs: false, - const queue = [module]; - while (queue.length > 0) { - const block = queue.pop(); - const arr = []; - arrays.push(arr); - blockModulesMap.set(block, arr); - for (const b of block.blocks) { - queue.push(b); + importScripts: true, + importScriptsInWorker: true, + fetchWasm: true, + nodeBuiltins: false, + require: false, + document: false, + global: false + }; } - } + ], + [ + "[async-]node[X[.Y]]", + "Node.js in version X.Y. The 'async-' prefix will load chunks asynchronously via 'fs' and 'vm' instead of 'require()'. Examples: node14.5, async-node10.", + /^(async-)?node(\d+(?:\.(\d+))?)?$/, + (asyncFlag, major, minor) => { + const v = versionDependent(major, minor); + // see https://node.green/ + return { + node: true, + electron: false, + nwjs: false, + web: false, + webworker: false, + browser: false, - for (const connection of moduleGraph.getOutgoingConnections(module)) { - const d = connection.dependency; - // We skip connections without dependency - if (!d) continue; - const m = connection.module; - // We skip connections without Module pointer - if (!m) continue; - // We skip weak connections - if (connection.weak) continue; - const state = connection.getActiveState(runtime); - // We skip inactive connections - if (state === false) continue; + require: !asyncFlag, + nodeBuiltins: true, + global: true, + document: false, + fetchWasm: false, + importScripts: false, + importScriptsInWorker: false, - const block = moduleGraph.getParentBlock(d); - let index = moduleGraph.getParentBlockIndex(d); + globalThis: v(12), + const: v(6), + templateLiteral: v(4), + optionalChaining: v(14), + arrowFunction: v(6), + forOf: v(5), + destructuring: v(6), + bigIntLiteral: v(10, 4), + dynamicImport: v(12, 17), + dynamicImportInWorker: major ? false : undefined, + module: v(12, 17) + }; + } + ], + [ + "electron[X[.Y]]-main/preload/renderer", + "Electron in version X.Y. Script is running in main, preload resp. renderer context.", + /^electron(\d+(?:\.(\d+))?)?-(main|preload|renderer)$/, + (major, minor, context) => { + const v = versionDependent(major, minor); + // see https://node.green/ + https://github.com/electron/releases + return { + node: true, + electron: true, + web: context !== "main", + webworker: false, + browser: false, + nwjs: false, - // deprecated fallback - if (index < 0) { - index = block.dependencies.indexOf(d); + electronMain: context === "main", + electronPreload: context === "preload", + electronRenderer: context === "renderer", + + global: true, + nodeBuiltins: true, + require: true, + document: context === "renderer", + fetchWasm: context === "renderer", + importScripts: false, + importScriptsInWorker: true, + + globalThis: v(5), + const: v(1, 1), + templateLiteral: v(1, 1), + optionalChaining: v(8), + arrowFunction: v(1, 1), + forOf: v(0, 36), + destructuring: v(1, 1), + bigIntLiteral: v(4), + dynamicImport: v(11), + dynamicImportInWorker: major ? false : undefined, + module: v(11) + }; } + ], + [ + "nwjs[X[.Y]] / node-webkit[X[.Y]]", + "NW.js in version X.Y.", + /^(?:nwjs|node-webkit)(\d+(?:\.(\d+))?)?$/, + (major, minor) => { + const v = versionDependent(major, minor); + // see https://node.green/ + https://github.com/nwjs/nw.js/blob/nw48/CHANGELOG.md + return { + node: true, + web: true, + nwjs: true, + webworker: null, + browser: false, + electron: false, - if (blockCache !== block) { - modules = blockModulesMap.get((blockCache = block)); + global: true, + nodeBuiltins: true, + document: false, + importScriptsInWorker: false, + fetchWasm: false, + importScripts: false, + require: false, + + globalThis: v(0, 43), + const: v(0, 15), + templateLiteral: v(0, 13), + optionalChaining: v(0, 44), + arrowFunction: v(0, 15), + forOf: v(0, 13), + destructuring: v(0, 15), + bigIntLiteral: v(0, 32), + dynamicImport: v(0, 43), + dynamicImportInWorker: major ? false : undefined, + module: v(0, 43) + }; + } + ], + [ + "esX", + "EcmaScript in this version. Examples: es2020, es5.", + /^es(\d+)$/, + version => { + let v = +version; + if (v < 1000) v = v + 2009; + return { + const: v >= 2015, + templateLiteral: v >= 2015, + optionalChaining: v >= 2020, + arrowFunction: v >= 2015, + forOf: v >= 2015, + destructuring: v >= 2015, + module: v >= 2015, + globalThis: v >= 2020, + bigIntLiteral: v >= 2020, + dynamicImport: v >= 2020, + dynamicImportInWorker: v >= 2020 + }; } + ] +]; - const i = index << 2; - modules[i] = m; - modules[i + 1] = state; +/** + * @param {string} target the target + * @param {string} context the context directory + * @returns {TargetProperties} target properties + */ +const getTargetProperties = (target, context) => { + for (const [, , regExp, handler] of TARGETS) { + const match = regExp.exec(target); + if (match) { + const [, ...args] = match; + const result = handler(...args, context); + if (result) return result; + } } + throw new Error( + `Unknown target '${target}'. The following targets are supported:\n${TARGETS.map( + ([name, description]) => `* ${name}: ${description}` + ).join("\n")}` + ); +}; - for (const modules of arrays) { - if (modules.length === 0) continue; - let indexMap; - let length = 0; - outer: for (let j = 0; j < modules.length; j += 2) { - const m = modules[j]; - if (m === undefined) continue; - const state = modules[j + 1]; - if (indexMap === undefined) { - let i = 0; - for (; i < length; i += 2) { - if (modules[i] === m) { - const merged = modules[i + 1]; - if (merged === true) continue outer; - modules[i + 1] = ModuleGraphConnection.addConnectionStates( - merged, - state - ); - } - } - modules[length] = m; - length++; - modules[length] = state; - length++; - if (length > 30) { - // To avoid worse case performance, we will use an index map for - // linear cost access, which allows to maintain O(n) complexity - // while keeping allocations down to a minimum - indexMap = new Map(); - for (let i = 0; i < length; i += 2) { - indexMap.set(modules[i], i + 1); - } - } - } else { - const idx = indexMap.get(m); - if (idx !== undefined) { - const merged = modules[idx]; - if (merged === true) continue outer; - modules[idx] = ModuleGraphConnection.addConnectionStates( - merged, - state - ); - } else { - modules[length] = m; - length++; - modules[length] = state; - indexMap.set(m, length); - length++; - } +const mergeTargetProperties = targetProperties => { + const keys = new Set(); + for (const tp of targetProperties) { + for (const key of Object.keys(tp)) { + keys.add(key); + } + } + const result = {}; + for (const key of keys) { + let hasTrue = false; + let hasFalse = false; + for (const tp of targetProperties) { + const value = tp[key]; + switch (value) { + case true: + hasTrue = true; + break; + case false: + hasFalse = true; + break; } } - modules.length = length; + if (hasTrue || hasFalse) + result[key] = hasFalse && hasTrue ? null : hasTrue ? true : false; } + return /** @type {TargetProperties} */ (result); }; /** - * - * @param {Logger} logger a logger - * @param {Compilation} compilation the compilation - * @param {Map} inputEntrypointsAndModules chunk groups which are processed with the modules - * @param {Map} chunkGroupInfoMap mapping from chunk group to available modules - * @param {Map} blockConnections connection for blocks - * @param {Set} blocksWithNestedBlocks flag for blocks that have nested blocks - * @param {Set} allCreatedChunkGroups filled with all chunk groups that are created here + * @param {string[]} targets the targets + * @param {string} context the context directory + * @returns {TargetProperties} target properties */ -const visitModules = ( - logger, - compilation, - inputEntrypointsAndModules, - chunkGroupInfoMap, - blockConnections, - blocksWithNestedBlocks, - allCreatedChunkGroups -) => { - const { moduleGraph, chunkGraph, moduleMemCaches } = compilation; - - const blockModulesRuntimeMap = new Map(); +const getTargetsProperties = (targets, context) => { + return mergeTargetProperties( + targets.map(t => getTargetProperties(t, context)) + ); +}; - /** @type {RuntimeSpec | false} */ - let blockModulesMapRuntime = false; - let blockModulesMap; +exports.getDefaultTarget = getDefaultTarget; +exports.getTargetProperties = getTargetProperties; +exports.getTargetsProperties = getTargetsProperties; - /** - * - * @param {DependenciesBlock} block block - * @param {RuntimeSpec} runtime runtime - * @returns {(Module | ConnectionState)[]} block modules in flatten tuples - */ - const getBlockModules = (block, runtime) => { - if (blockModulesMapRuntime !== runtime) { - blockModulesMap = blockModulesRuntimeMap.get(runtime); - if (blockModulesMap === undefined) { - blockModulesMap = new Map(); - blockModulesRuntimeMap.set(runtime, blockModulesMap); - } - } - let blockModules = blockModulesMap.get(block); - if (blockModules !== undefined) return blockModules; - const module = /** @type {Module} */ (block.getRootBlock()); - const memCache = moduleMemCaches && moduleMemCaches.get(module); - if (memCache !== undefined) { - const map = memCache.provide( - "bundleChunkGraph.blockModules", - runtime, - () => { - logger.time("visitModules: prepare"); - const map = new Map(); - extractBlockModules(module, moduleGraph, runtime, map); - logger.timeAggregate("visitModules: prepare"); - return map; - } - ); - for (const [block, blockModules] of map) - blockModulesMap.set(block, blockModules); - return map.get(block); - } else { - logger.time("visitModules: prepare"); - extractBlockModules(module, moduleGraph, runtime, blockModulesMap); - blockModules = blockModulesMap.get(block); - logger.timeAggregate("visitModules: prepare"); - return blockModules; - } - }; - let statProcessedQueueItems = 0; - let statProcessedBlocks = 0; - let statConnectedChunkGroups = 0; - let statProcessedChunkGroupsForMerging = 0; - let statMergedAvailableModuleSets = 0; - let statForkedAvailableModules = 0; - let statForkedAvailableModulesCount = 0; - let statForkedAvailableModulesCountPlus = 0; - let statForkedMergedModulesCount = 0; - let statForkedMergedModulesCountPlus = 0; - let statForkedResultModulesCount = 0; - let statChunkGroupInfoUpdated = 0; - let statChildChunkGroupsReconnected = 0; +/***/ }), - let nextChunkGroupIndex = 0; - let nextFreeModulePreOrderIndex = 0; - let nextFreeModulePostOrderIndex = 0; +/***/ 64813: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** @type {Map} */ - const blockChunkGroups = new Map(); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr +*/ - /** @type {Map} */ - const namedChunkGroups = new Map(); - /** @type {Map} */ - const namedAsyncEntrypoints = new Map(); - const ADD_AND_ENTER_ENTRY_MODULE = 0; - const ADD_AND_ENTER_MODULE = 1; - const ENTER_MODULE = 2; - const PROCESS_BLOCK = 3; - const PROCESS_ENTRY_BLOCK = 4; - const LEAVE_MODULE = 5; +const Dependency = __webpack_require__(54912); +const makeSerializable = __webpack_require__(33032); - /** @type {QueueItem[]} */ - let queue = []; +/** @typedef {import("./ContainerEntryModule").ExposeOptions} ExposeOptions */ - /** @type {Map>} */ - const queueConnect = new Map(); - /** @type {Set} */ - const chunkGroupsForCombining = new Set(); +class ContainerEntryDependency extends Dependency { + /** + * @param {string} name entry name + * @param {[string, ExposeOptions][]} exposes list of exposed modules + * @param {string} shareScope name of the share scope + */ + constructor(name, exposes, shareScope) { + super(); + this.name = name; + this.exposes = exposes; + this.shareScope = shareScope; + } - // Fill queue with entrypoint modules - // Create ChunkGroupInfo for entrypoints - for (const [chunkGroup, modules] of inputEntrypointsAndModules) { - const runtime = getEntryRuntime( - compilation, - chunkGroup.name, - chunkGroup.options - ); - /** @type {ChunkGroupInfo} */ - const chunkGroupInfo = { - chunkGroup, - runtime, - minAvailableModules: undefined, - minAvailableModulesOwned: false, - availableModulesToBeMerged: [], - skippedItems: undefined, - resultingAvailableModules: undefined, - children: undefined, - availableSources: undefined, - availableChildren: undefined, - preOrderIndex: 0, - postOrderIndex: 0, - chunkLoading: - chunkGroup.options.chunkLoading !== undefined - ? chunkGroup.options.chunkLoading !== false - : compilation.outputOptions.chunkLoading !== false, - asyncChunks: - chunkGroup.options.asyncChunks !== undefined - ? chunkGroup.options.asyncChunks - : compilation.outputOptions.asyncChunks !== false - }; - chunkGroup.index = nextChunkGroupIndex++; - if (chunkGroup.getNumberOfParents() > 0) { - // minAvailableModules for child entrypoints are unknown yet, set to undefined. - // This means no module is added until other sets are merged into - // this minAvailableModules (by the parent entrypoints) - const skippedItems = new Set(); - for (const module of modules) { - skippedItems.add(module); - } - chunkGroupInfo.skippedItems = skippedItems; - chunkGroupsForCombining.add(chunkGroupInfo); - } else { - // The application may start here: We start with an empty list of available modules - chunkGroupInfo.minAvailableModules = EMPTY_SET; - const chunk = chunkGroup.getEntrypointChunk(); - for (const module of modules) { - queue.push({ - action: ADD_AND_ENTER_MODULE, - block: module, - module, - chunk, - chunkGroup, - chunkGroupInfo - }); - } - } - chunkGroupInfoMap.set(chunkGroup, chunkGroupInfo); - if (chunkGroup.name) { - namedChunkGroups.set(chunkGroup.name, chunkGroupInfo); - } + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + return `container-entry-${this.name}`; } - // Fill availableSources with parent-child dependencies between entrypoints - for (const chunkGroupInfo of chunkGroupsForCombining) { - const { chunkGroup } = chunkGroupInfo; - chunkGroupInfo.availableSources = new Set(); - for (const parent of chunkGroup.parentsIterable) { - const parentChunkGroupInfo = chunkGroupInfoMap.get(parent); - chunkGroupInfo.availableSources.add(parentChunkGroupInfo); - if (parentChunkGroupInfo.availableChildren === undefined) { - parentChunkGroupInfo.availableChildren = new Set(); - } - parentChunkGroupInfo.availableChildren.add(chunkGroupInfo); - } + + get type() { + return "container entry"; } - // pop() is used to read from the queue - // so it need to be reversed to be iterated in - // correct order - queue.reverse(); - /** @type {Set} */ - const outdatedChunkGroupInfo = new Set(); - /** @type {Set} */ - const chunkGroupsForMerging = new Set(); - /** @type {QueueItem[]} */ - let queueDelayed = []; + get category() { + return "esm"; + } +} - /** @type {[Module, ConnectionState][]} */ - const skipConnectionBuffer = []; - /** @type {Module[]} */ - const skipBuffer = []; - /** @type {QueueItem[]} */ - const queueBuffer = []; +makeSerializable( + ContainerEntryDependency, + "webpack/lib/container/ContainerEntryDependency" +); - /** @type {Module} */ - let module; - /** @type {Chunk} */ - let chunk; - /** @type {ChunkGroup} */ - let chunkGroup; - /** @type {DependenciesBlock} */ - let block; - /** @type {ChunkGroupInfo} */ - let chunkGroupInfo; +module.exports = ContainerEntryDependency; - // For each async Block in graph - /** - * @param {AsyncDependenciesBlock} b iterating over each Async DepBlock - * @returns {void} - */ - const iteratorBlock = b => { - // 1. We create a chunk group with single chunk in it for this Block - // but only once (blockChunkGroups map) - let cgi = blockChunkGroups.get(b); - /** @type {ChunkGroup} */ - let c; - /** @type {Entrypoint} */ - let entrypoint; - const entryOptions = b.groupOptions && b.groupOptions.entryOptions; - if (cgi === undefined) { - const chunkName = (b.groupOptions && b.groupOptions.name) || b.chunkName; - if (entryOptions) { - cgi = namedAsyncEntrypoints.get(chunkName); - if (!cgi) { - entrypoint = compilation.addAsyncEntrypoint( - entryOptions, - module, - b.loc, - b.request - ); - entrypoint.index = nextChunkGroupIndex++; - cgi = { - chunkGroup: entrypoint, - runtime: entrypoint.options.runtime || entrypoint.name, - minAvailableModules: EMPTY_SET, - minAvailableModulesOwned: false, - availableModulesToBeMerged: [], - skippedItems: undefined, - resultingAvailableModules: undefined, - children: undefined, - availableSources: undefined, - availableChildren: undefined, - preOrderIndex: 0, - postOrderIndex: 0, - chunkLoading: - entryOptions.chunkLoading !== undefined - ? entryOptions.chunkLoading !== false - : chunkGroupInfo.chunkLoading, - asyncChunks: - entryOptions.asyncChunks !== undefined - ? entryOptions.asyncChunks - : chunkGroupInfo.asyncChunks - }; - chunkGroupInfoMap.set(entrypoint, cgi); - chunkGraph.connectBlockAndChunkGroup(b, entrypoint); - if (chunkName) { - namedAsyncEntrypoints.set(chunkName, cgi); - } - } else { - entrypoint = /** @type {Entrypoint} */ (cgi.chunkGroup); - // TODO merge entryOptions - entrypoint.addOrigin(module, b.loc, b.request); - chunkGraph.connectBlockAndChunkGroup(b, entrypoint); - } +/***/ }), - // 2. We enqueue the DependenciesBlock for traversal - queueDelayed.push({ - action: PROCESS_ENTRY_BLOCK, - block: b, - module: module, - chunk: entrypoint.chunks[0], - chunkGroup: entrypoint, - chunkGroupInfo: cgi - }); - } else if (!chunkGroupInfo.asyncChunks || !chunkGroupInfo.chunkLoading) { - // Just queue the block into the current chunk group - queue.push({ - action: PROCESS_BLOCK, - block: b, - module: module, - chunk, - chunkGroup, - chunkGroupInfo - }); - } else { - cgi = chunkName && namedChunkGroups.get(chunkName); - if (!cgi) { - c = compilation.addChunkInGroup( - b.groupOptions || b.chunkName, - module, - b.loc, - b.request - ); - c.index = nextChunkGroupIndex++; - cgi = { - chunkGroup: c, - runtime: chunkGroupInfo.runtime, - minAvailableModules: undefined, - minAvailableModulesOwned: undefined, - availableModulesToBeMerged: [], - skippedItems: undefined, - resultingAvailableModules: undefined, - children: undefined, - availableSources: undefined, - availableChildren: undefined, - preOrderIndex: 0, - postOrderIndex: 0, - chunkLoading: chunkGroupInfo.chunkLoading, - asyncChunks: chunkGroupInfo.asyncChunks - }; - allCreatedChunkGroups.add(c); - chunkGroupInfoMap.set(c, cgi); - if (chunkName) { - namedChunkGroups.set(chunkName, cgi); - } - } else { - c = cgi.chunkGroup; - if (c.isInitial()) { - compilation.errors.push( - new AsyncDependencyToInitialChunkError(chunkName, module, b.loc) - ); - c = chunkGroup; - } - c.addOptions(b.groupOptions); - c.addOrigin(module, b.loc, b.request); - } - blockConnections.set(b, []); - } - blockChunkGroups.set(b, cgi); - } else if (entryOptions) { - entrypoint = /** @type {Entrypoint} */ (cgi.chunkGroup); - } else { - c = cgi.chunkGroup; - } +/***/ 80580: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (c !== undefined) { - // 2. We store the connection for the block - // to connect it later if needed - blockConnections.get(b).push({ - originChunkGroupInfo: chunkGroupInfo, - chunkGroup: c - }); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr +*/ - // 3. We enqueue the chunk group info creation/updating - let connectList = queueConnect.get(chunkGroupInfo); - if (connectList === undefined) { - connectList = new Set(); - queueConnect.set(chunkGroupInfo, connectList); - } - connectList.add(cgi); - // TODO check if this really need to be done for each traversal - // or if it is enough when it's queued when created - // 4. We enqueue the DependenciesBlock for traversal - queueDelayed.push({ - action: PROCESS_BLOCK, - block: b, - module: module, - chunk: c.chunks[0], - chunkGroup: c, - chunkGroupInfo: cgi - }); - } else if (entrypoint !== undefined) { - chunkGroupInfo.chunkGroup.addAsyncEntrypoint(entrypoint); - } - }; +const { OriginalSource, RawSource } = __webpack_require__(51255); +const AsyncDependenciesBlock = __webpack_require__(47736); +const Module = __webpack_require__(73208); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const StaticExportsDependency = __webpack_require__(91418); +const makeSerializable = __webpack_require__(33032); +const ContainerExposedDependency = __webpack_require__(72374); + +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("./ContainerEntryDependency")} ContainerEntryDependency */ + +/** + * @typedef {Object} ExposeOptions + * @property {string[]} import requests to exposed modules (last one is exported) + * @property {string} name custom chunk name for the exposed module + */ + +const SOURCE_TYPES = new Set(["javascript"]); + +class ContainerEntryModule extends Module { /** - * @param {DependenciesBlock} block the block - * @returns {void} + * @param {string} name container entry name + * @param {[string, ExposeOptions][]} exposes list of exposed modules + * @param {string} shareScope name of the share scope */ - const processBlock = block => { - statProcessedBlocks++; - // get prepared block info - const blockModules = getBlockModules(block, chunkGroupInfo.runtime); + constructor(name, exposes, shareScope) { + super("javascript/dynamic", null); + this._name = name; + this._exposes = exposes; + this._shareScope = shareScope; + } - if (blockModules !== undefined) { - const { minAvailableModules } = chunkGroupInfo; - // Buffer items because order need to be reversed to get indices correct - // Traverse all referenced modules - for (let i = 0; i < blockModules.length; i += 2) { - const refModule = /** @type {Module} */ (blockModules[i]); - if (chunkGraph.isModuleInChunk(refModule, chunk)) { - // skip early if already connected - continue; - } - const activeState = /** @type {ConnectionState} */ ( - blockModules[i + 1] - ); - if (activeState !== true) { - skipConnectionBuffer.push([refModule, activeState]); - if (activeState === false) continue; - } - if ( - activeState === true && - (minAvailableModules.has(refModule) || - minAvailableModules.plus.has(refModule)) - ) { - // already in parent chunks, skip it for now - skipBuffer.push(refModule); - continue; - } - // enqueue, then add and enter to be in the correct order - // this is relevant with circular dependencies - queueBuffer.push({ - action: activeState === true ? ADD_AND_ENTER_MODULE : PROCESS_BLOCK, - block: refModule, - module: refModule, - chunk, - chunkGroup, - chunkGroupInfo - }); - } - // Add buffered items in reverse order - if (skipConnectionBuffer.length > 0) { - let { skippedModuleConnections } = chunkGroupInfo; - if (skippedModuleConnections === undefined) { - chunkGroupInfo.skippedModuleConnections = skippedModuleConnections = - new Set(); - } - for (let i = skipConnectionBuffer.length - 1; i >= 0; i--) { - skippedModuleConnections.add(skipConnectionBuffer[i]); - } - skipConnectionBuffer.length = 0; - } - if (skipBuffer.length > 0) { - let { skippedItems } = chunkGroupInfo; - if (skippedItems === undefined) { - chunkGroupInfo.skippedItems = skippedItems = new Set(); - } - for (let i = skipBuffer.length - 1; i >= 0; i--) { - skippedItems.add(skipBuffer[i]); - } - skipBuffer.length = 0; - } - if (queueBuffer.length > 0) { - for (let i = queueBuffer.length - 1; i >= 0; i--) { - queue.push(queueBuffer[i]); - } - queueBuffer.length = 0; - } - } + /** + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + return SOURCE_TYPES; + } - // Traverse all Blocks - for (const b of block.blocks) { - iteratorBlock(b); - } + /** + * @returns {string} a unique identifier of the module + */ + identifier() { + return `container entry (${this._shareScope}) ${JSON.stringify( + this._exposes + )}`; + } - if (block.blocks.length > 0 && module !== block) { - blocksWithNestedBlocks.add(block); - } - }; + /** + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + return `container entry`; + } /** - * @param {DependenciesBlock} block the block + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion + */ + libIdent(options) { + return `${this.layer ? `(${this.layer})/` : ""}webpack/container/entry/${ + this._name + }`; + } + + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild * @returns {void} */ - const processEntryBlock = block => { - statProcessedBlocks++; - // get prepared block info - const blockModules = getBlockModules(block, chunkGroupInfo.runtime); + needBuild(context, callback) { + return callback(null, !this.buildMeta); + } - if (blockModules !== undefined) { - // Traverse all referenced modules - for (let i = 0; i < blockModules.length; i += 2) { - const refModule = /** @type {Module} */ (blockModules[i]); - const activeState = /** @type {ConnectionState} */ ( - blockModules[i + 1] - ); - // enqueue, then add and enter to be in the correct order - // this is relevant with circular dependencies - queueBuffer.push({ - action: - activeState === true ? ADD_AND_ENTER_ENTRY_MODULE : PROCESS_BLOCK, - block: refModule, - module: refModule, - chunk, - chunkGroup, - chunkGroupInfo - }); - } - // Add buffered items in reverse order - if (queueBuffer.length > 0) { - for (let i = queueBuffer.length - 1; i >= 0; i--) { - queue.push(queueBuffer[i]); - } - queueBuffer.length = 0; - } - } + /** + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + this.buildMeta = {}; + this.buildInfo = { + strict: true, + topLevelDeclarations: new Set(["moduleMap", "get", "init"]) + }; + this.buildMeta.exportsType = "namespace"; - // Traverse all Blocks - for (const b of block.blocks) { - iteratorBlock(b); - } + this.clearDependenciesAndBlocks(); - if (block.blocks.length > 0 && module !== block) { - blocksWithNestedBlocks.add(block); + for (const [name, options] of this._exposes) { + const block = new AsyncDependenciesBlock( + { + name: options.name + }, + { name }, + options.import[options.import.length - 1] + ); + let idx = 0; + for (const request of options.import) { + const dep = new ContainerExposedDependency(name, request); + dep.loc = { + name, + index: idx++ + }; + + block.addDependency(dep); + } + this.addBlock(block); } - }; + this.addDependency(new StaticExportsDependency(["get", "init"], false)); - const processQueue = () => { - while (queue.length) { - statProcessedQueueItems++; - const queueItem = queue.pop(); - module = queueItem.module; - block = queueItem.block; - chunk = queueItem.chunk; - chunkGroup = queueItem.chunkGroup; - chunkGroupInfo = queueItem.chunkGroupInfo; + callback(); + } - switch (queueItem.action) { - case ADD_AND_ENTER_ENTRY_MODULE: - chunkGraph.connectChunkAndEntryModule( - chunk, - module, - /** @type {Entrypoint} */ (chunkGroup) - ); - // fallthrough - case ADD_AND_ENTER_MODULE: { - if (chunkGraph.isModuleInChunk(module, chunk)) { - // already connected, skip it - break; - } - // We connect Module and Chunk - chunkGraph.connectChunkAndModule(chunk, module); - } - // fallthrough - case ENTER_MODULE: { - const index = chunkGroup.getModulePreOrderIndex(module); - if (index === undefined) { - chunkGroup.setModulePreOrderIndex( - module, - chunkGroupInfo.preOrderIndex++ - ); - } + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration({ moduleGraph, chunkGraph, runtimeTemplate }) { + const sources = new Map(); + const runtimeRequirements = new Set([ + RuntimeGlobals.definePropertyGetters, + RuntimeGlobals.hasOwnProperty, + RuntimeGlobals.exports + ]); + const getters = []; - if ( - moduleGraph.setPreOrderIndexIfUnset( - module, - nextFreeModulePreOrderIndex - ) - ) { - nextFreeModulePreOrderIndex++; - } + for (const block of this.blocks) { + const { dependencies } = block; - // reuse queueItem - queueItem.action = LEAVE_MODULE; - queue.push(queueItem); - } - // fallthrough - case PROCESS_BLOCK: { - processBlock(block); - break; - } - case PROCESS_ENTRY_BLOCK: { - processEntryBlock(block); - break; - } - case LEAVE_MODULE: { - const index = chunkGroup.getModulePostOrderIndex(module); - if (index === undefined) { - chunkGroup.setModulePostOrderIndex( - module, - chunkGroupInfo.postOrderIndex++ - ); - } + const modules = dependencies.map(dependency => { + const dep = /** @type {ContainerExposedDependency} */ (dependency); + return { + name: dep.exposedName, + module: moduleGraph.getModule(dep), + request: dep.userRequest + }; + }); - if ( - moduleGraph.setPostOrderIndexIfUnset( - module, - nextFreeModulePostOrderIndex - ) - ) { - nextFreeModulePostOrderIndex++; - } - break; - } + let str; + + if (modules.some(m => !m.module)) { + str = runtimeTemplate.throwMissingModuleErrorBlock({ + request: modules.map(m => m.request).join(", ") + }); + } else { + str = `return ${runtimeTemplate.blockPromise({ + block, + message: "", + chunkGraph, + runtimeRequirements + })}.then(${runtimeTemplate.returningFunction( + runtimeTemplate.returningFunction( + `(${modules + .map(({ module, request }) => + runtimeTemplate.moduleRaw({ + module, + chunkGraph, + request, + weak: false, + runtimeRequirements + }) + ) + .join(", ")})` + ) + )});`; } + + getters.push( + `${JSON.stringify(modules[0].name)}: ${runtimeTemplate.basicFunction( + "", + str + )}` + ); } - }; - const calculateResultingAvailableModules = chunkGroupInfo => { - if (chunkGroupInfo.resultingAvailableModules) - return chunkGroupInfo.resultingAvailableModules; + const source = Template.asString([ + `var moduleMap = {`, + Template.indent(getters.join(",\n")), + "};", + `var get = ${runtimeTemplate.basicFunction("module, getScope", [ + `${RuntimeGlobals.currentRemoteGetScope} = getScope;`, + // reusing the getScope variable to avoid creating a new var (and module is also used later) + "getScope = (", + Template.indent([ + `${RuntimeGlobals.hasOwnProperty}(moduleMap, module)`, + Template.indent([ + "? moduleMap[module]()", + `: Promise.resolve().then(${runtimeTemplate.basicFunction( + "", + "throw new Error('Module \"' + module + '\" does not exist in container.');" + )})` + ]) + ]), + ");", + `${RuntimeGlobals.currentRemoteGetScope} = undefined;`, + "return getScope;" + ])};`, + `var init = ${runtimeTemplate.basicFunction("shareScope, initScope", [ + `if (!${RuntimeGlobals.shareScopeMap}) return;`, + `var name = ${JSON.stringify(this._shareScope)}`, + `var oldScope = ${RuntimeGlobals.shareScopeMap}[name];`, + `if(oldScope && oldScope !== shareScope) throw new Error("Container initialization failed as it has already been initialized with a different share scope");`, + `${RuntimeGlobals.shareScopeMap}[name] = shareScope;`, + `return ${RuntimeGlobals.initializeSharing}(name, initScope);` + ])};`, + "", + "// This exports getters to disallow modifications", + `${RuntimeGlobals.definePropertyGetters}(exports, {`, + Template.indent([ + `get: ${runtimeTemplate.returningFunction("get")},`, + `init: ${runtimeTemplate.returningFunction("init")}` + ]), + "});" + ]); - const minAvailableModules = chunkGroupInfo.minAvailableModules; + sources.set( + "javascript", + this.useSourceMap || this.useSimpleSourceMap + ? new OriginalSource(source, "webpack/container-entry") + : new RawSource(source) + ); - // Create a new Set of available modules at this point - // We want to be as lazy as possible. There are multiple ways doing this: - // Note that resultingAvailableModules is stored as "(a) + (b)" as it's a ModuleSetPlus - // - resultingAvailableModules = (modules of chunk) + (minAvailableModules + minAvailableModules.plus) - // - resultingAvailableModules = (minAvailableModules + modules of chunk) + (minAvailableModules.plus) - // We choose one depending on the size of minAvailableModules vs minAvailableModules.plus + return { + sources, + runtimeRequirements + }; + } - let resultingAvailableModules; - if (minAvailableModules.size > minAvailableModules.plus.size) { - // resultingAvailableModules = (modules of chunk) + (minAvailableModules + minAvailableModules.plus) - resultingAvailableModules = - /** @type {Set & {plus: Set}} */ (new Set()); - for (const module of minAvailableModules.plus) - minAvailableModules.add(module); - minAvailableModules.plus = EMPTY_SET; - resultingAvailableModules.plus = minAvailableModules; - chunkGroupInfo.minAvailableModulesOwned = false; - } else { - // resultingAvailableModules = (minAvailableModules + modules of chunk) + (minAvailableModules.plus) - resultingAvailableModules = - /** @type {Set & {plus: Set}} */ ( - new Set(minAvailableModules) - ); - resultingAvailableModules.plus = minAvailableModules.plus; - } + /** + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + return 42; + } - // add the modules from the chunk group to the set - for (const chunk of chunkGroupInfo.chunkGroup.chunks) { - for (const m of chunkGraph.getChunkModulesIterable(chunk)) { - resultingAvailableModules.add(m); - } - } - return (chunkGroupInfo.resultingAvailableModules = - resultingAvailableModules); - }; + serialize(context) { + const { write } = context; + write(this._name); + write(this._exposes); + write(this._shareScope); + super.serialize(context); + } - const processConnectQueue = () => { - // Figure out new parents for chunk groups - // to get new available modules for these children - for (const [chunkGroupInfo, targets] of queueConnect) { - // 1. Add new targets to the list of children - if (chunkGroupInfo.children === undefined) { - chunkGroupInfo.children = targets; - } else { - for (const target of targets) { - chunkGroupInfo.children.add(target); - } - } + static deserialize(context) { + const { read } = context; + const obj = new ContainerEntryModule(read(), read(), read()); + obj.deserialize(context); + return obj; + } +} - // 2. Calculate resulting available modules - const resultingAvailableModules = - calculateResultingAvailableModules(chunkGroupInfo); +makeSerializable( + ContainerEntryModule, + "webpack/lib/container/ContainerEntryModule" +); - const runtime = chunkGroupInfo.runtime; +module.exports = ContainerEntryModule; - // 3. Update chunk group info - for (const target of targets) { - target.availableModulesToBeMerged.push(resultingAvailableModules); - chunkGroupsForMerging.add(target); - const oldRuntime = target.runtime; - const newRuntime = mergeRuntime(oldRuntime, runtime); - if (oldRuntime !== newRuntime) { - target.runtime = newRuntime; - outdatedChunkGroupInfo.add(target); + +/***/ }), + +/***/ 76398: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr +*/ + + + +const ModuleFactory = __webpack_require__(51010); +const ContainerEntryModule = __webpack_require__(80580); + +/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ +/** @typedef {import("../ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ +/** @typedef {import("./ContainerEntryDependency")} ContainerEntryDependency */ + +module.exports = class ContainerEntryModuleFactory extends ModuleFactory { + /** + * @param {ModuleFactoryCreateData} data data object + * @param {function(Error=, ModuleFactoryResult=): void} callback callback + * @returns {void} + */ + create({ dependencies: [dependency] }, callback) { + const dep = /** @type {ContainerEntryDependency} */ (dependency); + callback(null, { + module: new ContainerEntryModule(dep.name, dep.exposes, dep.shareScope) + }); + } +}; + + +/***/ }), + +/***/ 72374: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr +*/ + + + +const ModuleDependency = __webpack_require__(80321); +const makeSerializable = __webpack_require__(33032); + +class ContainerExposedDependency extends ModuleDependency { + /** + * @param {string} exposedName public name + * @param {string} request request to module + */ + constructor(exposedName, request) { + super(request); + this.exposedName = exposedName; + } + + get type() { + return "container exposed"; + } + + get category() { + return "esm"; + } + + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + return `exposed dependency ${this.exposedName}=${this.request}`; + } + + serialize(context) { + context.write(this.exposedName); + super.serialize(context); + } + + deserialize(context) { + this.exposedName = context.read(); + super.deserialize(context); + } +} + +makeSerializable( + ContainerExposedDependency, + "webpack/lib/container/ContainerExposedDependency" +); + +module.exports = ContainerExposedDependency; + + +/***/ }), + +/***/ 9244: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr +*/ + + + +const createSchemaValidation = __webpack_require__(32540); +const ContainerEntryDependency = __webpack_require__(64813); +const ContainerEntryModuleFactory = __webpack_require__(76398); +const ContainerExposedDependency = __webpack_require__(72374); +const { parseOptions } = __webpack_require__(3083); + +/** @typedef {import("../../declarations/plugins/container/ContainerPlugin").ContainerPluginOptions} ContainerPluginOptions */ +/** @typedef {import("../Compiler")} Compiler */ + +const validate = createSchemaValidation( + __webpack_require__(9504), + () => __webpack_require__(84899), + { + name: "Container Plugin", + baseDataPath: "options" + } +); + +const PLUGIN_NAME = "ContainerPlugin"; + +class ContainerPlugin { + /** + * @param {ContainerPluginOptions} options options + */ + constructor(options) { + validate(options); + + this._options = { + name: options.name, + shareScope: options.shareScope || "default", + library: options.library || { + type: "var", + name: options.name + }, + runtime: options.runtime, + filename: options.filename || undefined, + exposes: parseOptions( + options.exposes, + item => ({ + import: Array.isArray(item) ? item : [item], + name: undefined + }), + item => ({ + import: Array.isArray(item.import) ? item.import : [item.import], + name: item.name || undefined + }) + ) + }; + } + + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const { name, exposes, shareScope, filename, library, runtime } = + this._options; + + compiler.options.output.enabledLibraryTypes.push(library.type); + + compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => { + const dep = new ContainerEntryDependency(name, exposes, shareScope); + dep.loc = { name }; + compilation.addEntry( + compilation.options.context, + dep, + { + name, + filename, + runtime, + library + }, + error => { + if (error) return callback(error); + callback(); } + ); + }); + + compiler.hooks.thisCompilation.tap( + PLUGIN_NAME, + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + ContainerEntryDependency, + new ContainerEntryModuleFactory() + ); + + compilation.dependencyFactories.set( + ContainerExposedDependency, + normalModuleFactory + ); } + ); + } +} - statConnectedChunkGroups += targets.size; - } - queueConnect.clear(); - }; +module.exports = ContainerPlugin; - const processChunkGroupsForMerging = () => { - statProcessedChunkGroupsForMerging += chunkGroupsForMerging.size; - // Execute the merge - for (const info of chunkGroupsForMerging) { - const availableModulesToBeMerged = info.availableModulesToBeMerged; - let cachedMinAvailableModules = info.minAvailableModules; +/***/ }), - statMergedAvailableModuleSets += availableModulesToBeMerged.length; +/***/ 95757: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // 1. Get minimal available modules - // It doesn't make sense to traverse a chunk again with more available modules. - // This step calculates the minimal available modules and skips traversal when - // the list didn't shrink. - if (availableModulesToBeMerged.length > 1) { - availableModulesToBeMerged.sort(bySetSize); - } - let changed = false; - merge: for (const availableModules of availableModulesToBeMerged) { - if (cachedMinAvailableModules === undefined) { - cachedMinAvailableModules = availableModules; - info.minAvailableModules = cachedMinAvailableModules; - info.minAvailableModulesOwned = false; - changed = true; - } else { - if (info.minAvailableModulesOwned) { - // We own it and can modify it - if (cachedMinAvailableModules.plus === availableModules.plus) { - for (const m of cachedMinAvailableModules) { - if (!availableModules.has(m)) { - cachedMinAvailableModules.delete(m); - changed = true; - } - } - } else { - for (const m of cachedMinAvailableModules) { - if (!availableModules.has(m) && !availableModules.plus.has(m)) { - cachedMinAvailableModules.delete(m); - changed = true; - } - } - for (const m of cachedMinAvailableModules.plus) { - if (!availableModules.has(m) && !availableModules.plus.has(m)) { - // We can't remove modules from the plus part - // so we need to merge plus into the normal part to allow modifying it - const iterator = - cachedMinAvailableModules.plus[Symbol.iterator](); - // fast forward add all modules until m - /** @type {IteratorResult} */ - let it; - while (!(it = iterator.next()).done) { - const module = it.value; - if (module === m) break; - cachedMinAvailableModules.add(module); - } - // check the remaining modules before adding - while (!(it = iterator.next()).done) { - const module = it.value; - if ( - availableModules.has(module) || - availableModules.plus.has(module) - ) { - cachedMinAvailableModules.add(module); - } - } - cachedMinAvailableModules.plus = EMPTY_SET; - changed = true; - continue merge; - } - } - } - } else if (cachedMinAvailableModules.plus === availableModules.plus) { - // Common and fast case when the plus part is shared - // We only need to care about the normal part - if (availableModules.size < cachedMinAvailableModules.size) { - // the new availableModules is smaller so it's faster to - // fork from the new availableModules - statForkedAvailableModules++; - statForkedAvailableModulesCount += availableModules.size; - statForkedMergedModulesCount += cachedMinAvailableModules.size; - // construct a new Set as intersection of cachedMinAvailableModules and availableModules - const newSet = /** @type {ModuleSetPlus} */ (new Set()); - newSet.plus = availableModules.plus; - for (const m of availableModules) { - if (cachedMinAvailableModules.has(m)) { - newSet.add(m); - } - } - statForkedResultModulesCount += newSet.size; - cachedMinAvailableModules = newSet; - info.minAvailableModulesOwned = true; - info.minAvailableModules = newSet; - changed = true; - continue merge; - } - for (const m of cachedMinAvailableModules) { - if (!availableModules.has(m)) { - // cachedMinAvailableModules need to be modified - // but we don't own it - statForkedAvailableModules++; - statForkedAvailableModulesCount += - cachedMinAvailableModules.size; - statForkedMergedModulesCount += availableModules.size; - // construct a new Set as intersection of cachedMinAvailableModules and availableModules - // as the plus part is equal we can just take over this one - const newSet = /** @type {ModuleSetPlus} */ (new Set()); - newSet.plus = availableModules.plus; - const iterator = cachedMinAvailableModules[Symbol.iterator](); - // fast forward add all modules until m - /** @type {IteratorResult} */ - let it; - while (!(it = iterator.next()).done) { - const module = it.value; - if (module === m) break; - newSet.add(module); - } - // check the remaining modules before adding - while (!(it = iterator.next()).done) { - const module = it.value; - if (availableModules.has(module)) { - newSet.add(module); - } - } - statForkedResultModulesCount += newSet.size; - cachedMinAvailableModules = newSet; - info.minAvailableModulesOwned = true; - info.minAvailableModules = newSet; - changed = true; - continue merge; - } - } - } else { - for (const m of cachedMinAvailableModules) { - if (!availableModules.has(m) && !availableModules.plus.has(m)) { - // cachedMinAvailableModules need to be modified - // but we don't own it - statForkedAvailableModules++; - statForkedAvailableModulesCount += - cachedMinAvailableModules.size; - statForkedAvailableModulesCountPlus += - cachedMinAvailableModules.plus.size; - statForkedMergedModulesCount += availableModules.size; - statForkedMergedModulesCountPlus += availableModules.plus.size; - // construct a new Set as intersection of cachedMinAvailableModules and availableModules - const newSet = /** @type {ModuleSetPlus} */ (new Set()); - newSet.plus = EMPTY_SET; - const iterator = cachedMinAvailableModules[Symbol.iterator](); - // fast forward add all modules until m - /** @type {IteratorResult} */ - let it; - while (!(it = iterator.next()).done) { - const module = it.value; - if (module === m) break; - newSet.add(module); - } - // check the remaining modules before adding - while (!(it = iterator.next()).done) { - const module = it.value; - if ( - availableModules.has(module) || - availableModules.plus.has(module) - ) { - newSet.add(module); - } - } - // also check all modules in cachedMinAvailableModules.plus - for (const module of cachedMinAvailableModules.plus) { - if ( - availableModules.has(module) || - availableModules.plus.has(module) - ) { - newSet.add(module); - } - } - statForkedResultModulesCount += newSet.size; - cachedMinAvailableModules = newSet; - info.minAvailableModulesOwned = true; - info.minAvailableModules = newSet; - changed = true; - continue merge; - } - } - for (const m of cachedMinAvailableModules.plus) { - if (!availableModules.has(m) && !availableModules.plus.has(m)) { - // cachedMinAvailableModules need to be modified - // but we don't own it - statForkedAvailableModules++; - statForkedAvailableModulesCount += - cachedMinAvailableModules.size; - statForkedAvailableModulesCountPlus += - cachedMinAvailableModules.plus.size; - statForkedMergedModulesCount += availableModules.size; - statForkedMergedModulesCountPlus += availableModules.plus.size; - // construct a new Set as intersection of cachedMinAvailableModules and availableModules - // we already know that all modules directly from cachedMinAvailableModules are in availableModules too - const newSet = /** @type {ModuleSetPlus} */ ( - new Set(cachedMinAvailableModules) - ); - newSet.plus = EMPTY_SET; - const iterator = - cachedMinAvailableModules.plus[Symbol.iterator](); - // fast forward add all modules until m - /** @type {IteratorResult} */ - let it; - while (!(it = iterator.next()).done) { - const module = it.value; - if (module === m) break; - newSet.add(module); - } - // check the remaining modules before adding - while (!(it = iterator.next()).done) { - const module = it.value; - if ( - availableModules.has(module) || - availableModules.plus.has(module) - ) { - newSet.add(module); - } - } - statForkedResultModulesCount += newSet.size; - cachedMinAvailableModules = newSet; - info.minAvailableModulesOwned = true; - info.minAvailableModules = newSet; - changed = true; - continue merge; - } - } - } - } - } - availableModulesToBeMerged.length = 0; - if (changed) { - info.resultingAvailableModules = undefined; - outdatedChunkGroupInfo.add(info); - } - } - chunkGroupsForMerging.clear(); - }; - - const processChunkGroupsForCombining = () => { - for (const info of chunkGroupsForCombining) { - for (const source of info.availableSources) { - if (!source.minAvailableModules) { - chunkGroupsForCombining.delete(info); - break; - } - } - } - for (const info of chunkGroupsForCombining) { - const availableModules = /** @type {ModuleSetPlus} */ (new Set()); - availableModules.plus = EMPTY_SET; - const mergeSet = set => { - if (set.size > availableModules.plus.size) { - for (const item of availableModules.plus) availableModules.add(item); - availableModules.plus = set; - } else { - for (const item of set) availableModules.add(item); - } - }; - // combine minAvailableModules from all resultingAvailableModules - for (const source of info.availableSources) { - const resultingAvailableModules = - calculateResultingAvailableModules(source); - mergeSet(resultingAvailableModules); - mergeSet(resultingAvailableModules.plus); - } - info.minAvailableModules = availableModules; - info.minAvailableModulesOwned = false; - info.resultingAvailableModules = undefined; - outdatedChunkGroupInfo.add(info); - } - chunkGroupsForCombining.clear(); - }; - - const processOutdatedChunkGroupInfo = () => { - statChunkGroupInfoUpdated += outdatedChunkGroupInfo.size; - // Revisit skipped elements - for (const info of outdatedChunkGroupInfo) { - // 1. Reconsider skipped items - if (info.skippedItems !== undefined) { - const { minAvailableModules } = info; - for (const module of info.skippedItems) { - if ( - !minAvailableModules.has(module) && - !minAvailableModules.plus.has(module) - ) { - queue.push({ - action: ADD_AND_ENTER_MODULE, - block: module, - module, - chunk: info.chunkGroup.chunks[0], - chunkGroup: info.chunkGroup, - chunkGroupInfo: info - }); - info.skippedItems.delete(module); - } - } - } - - // 2. Reconsider skipped connections - if (info.skippedModuleConnections !== undefined) { - const { minAvailableModules } = info; - for (const entry of info.skippedModuleConnections) { - const [module, activeState] = entry; - if (activeState === false) continue; - if (activeState === true) { - info.skippedModuleConnections.delete(entry); - } - if ( - activeState === true && - (minAvailableModules.has(module) || - minAvailableModules.plus.has(module)) - ) { - info.skippedItems.add(module); - continue; - } - queue.push({ - action: activeState === true ? ADD_AND_ENTER_MODULE : PROCESS_BLOCK, - block: module, - module, - chunk: info.chunkGroup.chunks[0], - chunkGroup: info.chunkGroup, - chunkGroupInfo: info - }); - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy +*/ - // 2. Reconsider children chunk groups - if (info.children !== undefined) { - statChildChunkGroupsReconnected += info.children.size; - for (const cgi of info.children) { - let connectList = queueConnect.get(info); - if (connectList === undefined) { - connectList = new Set(); - queueConnect.set(info, connectList); - } - connectList.add(cgi); - } - } - // 3. Reconsider chunk groups for combining - if (info.availableChildren !== undefined) { - for (const cgi of info.availableChildren) { - chunkGroupsForCombining.add(cgi); - } - } - } - outdatedChunkGroupInfo.clear(); - }; - // Iterative traversal of the Module graph - // Recursive would be simpler to write but could result in Stack Overflows - while (queue.length || queueConnect.size) { - logger.time("visitModules: visiting"); - processQueue(); - logger.timeAggregateEnd("visitModules: prepare"); - logger.timeEnd("visitModules: visiting"); +const ExternalsPlugin = __webpack_require__(6652); +const RuntimeGlobals = __webpack_require__(16475); +const createSchemaValidation = __webpack_require__(32540); +const FallbackDependency = __webpack_require__(57764); +const FallbackItemDependency = __webpack_require__(29593); +const FallbackModuleFactory = __webpack_require__(4112); +const RemoteModule = __webpack_require__(62916); +const RemoteRuntimeModule = __webpack_require__(88288); +const RemoteToExternalDependency = __webpack_require__(14389); +const { parseOptions } = __webpack_require__(3083); - if (chunkGroupsForCombining.size > 0) { - logger.time("visitModules: combine available modules"); - processChunkGroupsForCombining(); - logger.timeEnd("visitModules: combine available modules"); - } +/** @typedef {import("../../declarations/plugins/container/ContainerReferencePlugin").ContainerReferencePluginOptions} ContainerReferencePluginOptions */ +/** @typedef {import("../../declarations/plugins/container/ContainerReferencePlugin").RemotesConfig} RemotesConfig */ +/** @typedef {import("../Compiler")} Compiler */ - if (queueConnect.size > 0) { - logger.time("visitModules: calculating available modules"); - processConnectQueue(); - logger.timeEnd("visitModules: calculating available modules"); +const validate = createSchemaValidation( + __webpack_require__(95122), + () => + __webpack_require__(66681), + { + name: "Container Reference Plugin", + baseDataPath: "options" + } +); - if (chunkGroupsForMerging.size > 0) { - logger.time("visitModules: merging available modules"); - processChunkGroupsForMerging(); - logger.timeEnd("visitModules: merging available modules"); - } - } +const slashCode = "/".charCodeAt(0); - if (outdatedChunkGroupInfo.size > 0) { - logger.time("visitModules: check modules for revisit"); - processOutdatedChunkGroupInfo(); - logger.timeEnd("visitModules: check modules for revisit"); - } +class ContainerReferencePlugin { + /** + * @param {ContainerReferencePluginOptions} options options + */ + constructor(options) { + validate(options); - // Run queueDelayed when all items of the queue are processed - // This is important to get the global indexing correct - // Async blocks should be processed after all sync blocks are processed - if (queue.length === 0) { - const tempQueue = queue; - queue = queueDelayed.reverse(); - queueDelayed = tempQueue; - } + this._remoteType = options.remoteType; + this._remotes = parseOptions( + options.remotes, + item => ({ + external: Array.isArray(item) ? item : [item], + shareScope: options.shareScope || "default" + }), + item => ({ + external: Array.isArray(item.external) + ? item.external + : [item.external], + shareScope: item.shareScope || options.shareScope || "default" + }) + ); } - logger.log( - `${statProcessedQueueItems} queue items processed (${statProcessedBlocks} blocks)` - ); - logger.log(`${statConnectedChunkGroups} chunk groups connected`); - logger.log( - `${statProcessedChunkGroupsForMerging} chunk groups processed for merging (${statMergedAvailableModuleSets} module sets, ${statForkedAvailableModules} forked, ${statForkedAvailableModulesCount} + ${statForkedAvailableModulesCountPlus} modules forked, ${statForkedMergedModulesCount} + ${statForkedMergedModulesCountPlus} modules merged into fork, ${statForkedResultModulesCount} resulting modules)` - ); - logger.log( - `${statChunkGroupInfoUpdated} chunk group info updated (${statChildChunkGroupsReconnected} already connected chunk groups reconnected)` - ); -}; - -/** - * - * @param {Compilation} compilation the compilation - * @param {Set} blocksWithNestedBlocks flag for blocks that have nested blocks - * @param {Map} blockConnections connection for blocks - * @param {Map} chunkGroupInfoMap mapping from chunk group to available modules - */ -const connectChunkGroups = ( - compilation, - blocksWithNestedBlocks, - blockConnections, - chunkGroupInfoMap -) => { - const { chunkGraph } = compilation; - /** - * Helper function to check if all modules of a chunk are available - * - * @param {ChunkGroup} chunkGroup the chunkGroup to scan - * @param {ModuleSetPlus} availableModules the comparator set - * @returns {boolean} return true if all modules of a chunk are available + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - const areModulesAvailable = (chunkGroup, availableModules) => { - for (const chunk of chunkGroup.chunks) { - for (const module of chunkGraph.getChunkModulesIterable(chunk)) { - if (!availableModules.has(module) && !availableModules.plus.has(module)) - return false; - } - } - return true; - }; + apply(compiler) { + const { _remotes: remotes, _remoteType: remoteType } = this; - // For each edge in the basic chunk graph - for (const [block, connections] of blockConnections) { - // 1. Check if connection is needed - // When none of the dependencies need to be connected - // we can skip all of them - // It's not possible to filter each item so it doesn't create inconsistent - // connections and modules can only create one version - // TODO maybe decide this per runtime - if ( - // TODO is this needed? - !blocksWithNestedBlocks.has(block) && - connections.every(({ chunkGroup, originChunkGroupInfo }) => - areModulesAvailable( - chunkGroup, - originChunkGroupInfo.resultingAvailableModules - ) - ) - ) { - continue; + /** @type {Record} */ + const remoteExternals = {}; + for (const [key, config] of remotes) { + let i = 0; + for (const external of config.external) { + if (external.startsWith("internal ")) continue; + remoteExternals[ + `webpack/container/reference/${key}${i ? `/fallback-${i}` : ""}` + ] = external; + i++; + } } - // 2. Foreach edge - for (let i = 0; i < connections.length; i++) { - const { chunkGroup, originChunkGroupInfo } = connections[i]; + new ExternalsPlugin(remoteType, remoteExternals).apply(compiler); - // 3. Connect block with chunk - chunkGraph.connectBlockAndChunkGroup(block, chunkGroup); + compiler.hooks.compilation.tap( + "ContainerReferencePlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + RemoteToExternalDependency, + normalModuleFactory + ); - // 4. Connect chunk with parent - connectChunkGroupParentAndChild( - originChunkGroupInfo.chunkGroup, - chunkGroup - ); - } - } -}; + compilation.dependencyFactories.set( + FallbackItemDependency, + normalModuleFactory + ); -/** - * Remove all unconnected chunk groups - * @param {Compilation} compilation the compilation - * @param {Iterable} allCreatedChunkGroups all chunk groups that where created before - */ -const cleanupUnconnectedGroups = (compilation, allCreatedChunkGroups) => { - const { chunkGraph } = compilation; + compilation.dependencyFactories.set( + FallbackDependency, + new FallbackModuleFactory() + ); - for (const chunkGroup of allCreatedChunkGroups) { - if (chunkGroup.getNumberOfParents() === 0) { - for (const chunk of chunkGroup.chunks) { - compilation.chunks.delete(chunk); - chunkGraph.disconnectChunk(chunk); + normalModuleFactory.hooks.factorize.tap( + "ContainerReferencePlugin", + data => { + if (!data.request.includes("!")) { + for (const [key, config] of remotes) { + if ( + data.request.startsWith(`${key}`) && + (data.request.length === key.length || + data.request.charCodeAt(key.length) === slashCode) + ) { + return new RemoteModule( + data.request, + config.external.map((external, i) => + external.startsWith("internal ") + ? external.slice(9) + : `webpack/container/reference/${key}${ + i ? `/fallback-${i}` : "" + }` + ), + `.${data.request.slice(key.length)}`, + config.shareScope + ); + } + } + } + } + ); + + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("ContainerReferencePlugin", (chunk, set) => { + set.add(RuntimeGlobals.module); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + set.add(RuntimeGlobals.hasOwnProperty); + set.add(RuntimeGlobals.initializeSharing); + set.add(RuntimeGlobals.shareScopeMap); + compilation.addRuntimeModule(chunk, new RemoteRuntimeModule()); + }); } - chunkGraph.disconnectChunkGroup(chunkGroup); - chunkGroup.remove(); - } + ); } -}; +} -/** - * This method creates the Chunk graph from the Module graph - * @param {Compilation} compilation the compilation - * @param {Map} inputEntrypointsAndModules chunk groups which are processed with the modules - * @returns {void} - */ -const buildChunkGraph = (compilation, inputEntrypointsAndModules) => { - const logger = compilation.getLogger("webpack.buildChunkGraph"); +module.exports = ContainerReferencePlugin; - // SHARED STATE - /** @type {Map} */ - const blockConnections = new Map(); +/***/ }), - /** @type {Set} */ - const allCreatedChunkGroups = new Set(); +/***/ 57764: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** @type {Map} */ - const chunkGroupInfoMap = new Map(); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** @type {Set} */ - const blocksWithNestedBlocks = new Set(); - // PART ONE - logger.time("visitModules"); - visitModules( - logger, - compilation, - inputEntrypointsAndModules, - chunkGroupInfoMap, - blockConnections, - blocksWithNestedBlocks, - allCreatedChunkGroups - ); - logger.timeEnd("visitModules"); +const Dependency = __webpack_require__(54912); +const makeSerializable = __webpack_require__(33032); - // PART TWO +class FallbackDependency extends Dependency { + constructor(requests) { + super(); + this.requests = requests; + } - logger.time("connectChunkGroups"); - connectChunkGroups( - compilation, - blocksWithNestedBlocks, - blockConnections, - chunkGroupInfoMap - ); - logger.timeEnd("connectChunkGroups"); + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + return `fallback ${this.requests.join(" ")}`; + } - for (const [chunkGroup, chunkGroupInfo] of chunkGroupInfoMap) { - for (const chunk of chunkGroup.chunks) - chunk.runtime = mergeRuntime(chunk.runtime, chunkGroupInfo.runtime); + get type() { + return "fallback"; } - // Cleanup work + get category() { + return "esm"; + } - logger.time("cleanup"); - cleanupUnconnectedGroups(compilation, allCreatedChunkGroups); - logger.timeEnd("cleanup"); -}; + serialize(context) { + const { write } = context; + write(this.requests); + super.serialize(context); + } -module.exports = buildChunkGraph; + static deserialize(context) { + const { read } = context; + const obj = new FallbackDependency(read()); + obj.deserialize(context); + return obj; + } +} + +makeSerializable( + FallbackDependency, + "webpack/lib/container/FallbackDependency" +); + +module.exports = FallbackDependency; /***/ }), -/***/ 28034: -/***/ (function(module) { +/***/ 29593: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -67866,114 +67041,287 @@ module.exports = buildChunkGraph; -/** @typedef {import("../Compiler")} Compiler */ +const ModuleDependency = __webpack_require__(80321); +const makeSerializable = __webpack_require__(33032); -class AddBuildDependenciesPlugin { +class FallbackItemDependency extends ModuleDependency { + constructor(request) { + super(request); + } + + get type() { + return "fallback item"; + } + + get category() { + return "esm"; + } +} + +makeSerializable( + FallbackItemDependency, + "webpack/lib/container/FallbackItemDependency" +); + +module.exports = FallbackItemDependency; + + +/***/ }), + +/***/ 82886: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy +*/ + + + +const { RawSource } = __webpack_require__(51255); +const Module = __webpack_require__(73208); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const makeSerializable = __webpack_require__(33032); +const FallbackItemDependency = __webpack_require__(29593); + +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ + +const TYPES = new Set(["javascript"]); +const RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]); + +class FallbackModule extends Module { /** - * @param {Iterable} buildDependencies list of build dependencies + * @param {string[]} requests list of requests to choose one */ - constructor(buildDependencies) { - this.buildDependencies = new Set(buildDependencies); + constructor(requests) { + super("fallback-module"); + this.requests = requests; + this._identifier = `fallback ${this.requests.join(" ")}`; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @returns {string} a unique identifier of the module + */ + identifier() { + return this._identifier; + } + + /** + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + return this._identifier; + } + + /** + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion + */ + libIdent(options) { + return `${this.layer ? `(${this.layer})/` : ""}webpack/container/fallback/${ + this.requests[0] + }/and ${this.requests.length - 1} more`; + } + + /** + * @param {Chunk} chunk the chunk which condition should be checked + * @param {Compilation} compilation the compilation + * @returns {boolean} true, if the chunk is ok for the module + */ + chunkCondition(chunk, { chunkGraph }) { + return chunkGraph.getNumberOfEntryModules(chunk) > 0; + } + + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap( - "AddBuildDependenciesPlugin", - compilation => { - compilation.buildDependencies.addAll(this.buildDependencies); - } + needBuild(context, callback) { + callback(null, !this.buildInfo); + } + + /** + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + this.buildMeta = {}; + this.buildInfo = { + strict: true + }; + + this.clearDependenciesAndBlocks(); + for (const request of this.requests) + this.addDependency(new FallbackItemDependency(request)); + + callback(); + } + + /** + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + return this.requests.length * 5 + 42; + } + + /** + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + return TYPES; + } + + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { + const ids = this.dependencies.map(dep => + chunkGraph.getModuleId(moduleGraph.getModule(dep)) ); + const code = Template.asString([ + `var ids = ${JSON.stringify(ids)};`, + "var error, result, i = 0;", + `var loop = ${runtimeTemplate.basicFunction("next", [ + "while(i < ids.length) {", + Template.indent([ + "try { next = __webpack_require__(ids[i++]); } catch(e) { return handleError(e); }", + "if(next) return next.then ? next.then(handleResult, handleError) : handleResult(next);" + ]), + "}", + "if(error) throw error;" + ])}`, + `var handleResult = ${runtimeTemplate.basicFunction("result", [ + "if(result) return result;", + "return loop();" + ])};`, + `var handleError = ${runtimeTemplate.basicFunction("e", [ + "error = e;", + "return loop();" + ])};`, + "module.exports = loop();" + ]); + const sources = new Map(); + sources.set("javascript", new RawSource(code)); + return { sources, runtimeRequirements: RUNTIME_REQUIREMENTS }; + } + + serialize(context) { + const { write } = context; + write(this.requests); + super.serialize(context); + } + + static deserialize(context) { + const { read } = context; + const obj = new FallbackModule(read()); + obj.deserialize(context); + return obj; } } -module.exports = AddBuildDependenciesPlugin; +makeSerializable(FallbackModule, "webpack/lib/container/FallbackModule"); + +module.exports = FallbackModule; /***/ }), -/***/ 47942: -/***/ (function(module) { +/***/ 4112: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr */ -/** @typedef {import("../Compiler")} Compiler */ +const ModuleFactory = __webpack_require__(51010); +const FallbackModule = __webpack_require__(82886); -class AddManagedPathsPlugin { - /** - * @param {Iterable} managedPaths list of managed paths - * @param {Iterable} immutablePaths list of immutable paths - */ - constructor(managedPaths, immutablePaths) { - this.managedPaths = new Set(managedPaths); - this.immutablePaths = new Set(immutablePaths); - } +/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ +/** @typedef {import("../ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ +/** @typedef {import("./FallbackDependency")} FallbackDependency */ +module.exports = class FallbackModuleFactory extends ModuleFactory { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {ModuleFactoryCreateData} data data object + * @param {function(Error=, ModuleFactoryResult=): void} callback callback * @returns {void} */ - apply(compiler) { - for (const managedPath of this.managedPaths) { - compiler.managedPaths.add(managedPath); - } - for (const immutablePath of this.immutablePaths) { - compiler.immutablePaths.add(immutablePath); - } + create({ dependencies: [dependency] }, callback) { + const dep = /** @type {FallbackDependency} */ (dependency); + callback(null, { + module: new FallbackModule(dep.requests) + }); } -} - -module.exports = AddManagedPathsPlugin; +}; /***/ }), -/***/ 71985: +/***/ 30569: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy */ -const Cache = __webpack_require__(7592); -const ProgressPlugin = __webpack_require__(13216); +const isValidExternalsType = __webpack_require__(62142); +const SharePlugin = __webpack_require__(26335); +const createSchemaValidation = __webpack_require__(32540); +const ContainerPlugin = __webpack_require__(9244); +const ContainerReferencePlugin = __webpack_require__(95757); +/** @typedef {import("../../declarations/plugins/container/ModuleFederationPlugin").ExternalsType} ExternalsType */ +/** @typedef {import("../../declarations/plugins/container/ModuleFederationPlugin").ModuleFederationPluginOptions} ModuleFederationPluginOptions */ +/** @typedef {import("../../declarations/plugins/container/ModuleFederationPlugin").Shared} Shared */ /** @typedef {import("../Compiler")} Compiler */ -const BUILD_DEPENDENCIES_KEY = Symbol(); - -class IdleFileCachePlugin { +const validate = createSchemaValidation( + __webpack_require__(7467), + () => __webpack_require__(82601), + { + name: "Module Federation Plugin", + baseDataPath: "options" + } +); +class ModuleFederationPlugin { /** - * @param {TODO} strategy cache strategy - * @param {number} idleTimeout timeout - * @param {number} idleTimeoutForInitialStore initial timeout - * @param {number} idleTimeoutAfterLargeChanges timeout after changes + * @param {ModuleFederationPluginOptions} options options */ - constructor( - strategy, - idleTimeout, - idleTimeoutForInitialStore, - idleTimeoutAfterLargeChanges - ) { - this.strategy = strategy; - this.idleTimeout = idleTimeout; - this.idleTimeoutForInitialStore = idleTimeoutForInitialStore; - this.idleTimeoutAfterLargeChanges = idleTimeoutAfterLargeChanges; + constructor(options) { + validate(options); + + this._options = options; } /** @@ -67982,401 +67330,240 @@ class IdleFileCachePlugin { * @returns {void} */ apply(compiler) { - let strategy = this.strategy; - const idleTimeout = this.idleTimeout; - const idleTimeoutForInitialStore = Math.min( - idleTimeout, - this.idleTimeoutForInitialStore - ); - const idleTimeoutAfterLargeChanges = this.idleTimeoutAfterLargeChanges; - const resolvedPromise = Promise.resolve(); + const { _options: options } = this; + const library = options.library || { type: "var", name: options.name }; + const remoteType = + options.remoteType || + (options.library && isValidExternalsType(options.library.type) + ? /** @type {ExternalsType} */ (options.library.type) + : "script"); + if ( + library && + !compiler.options.output.enabledLibraryTypes.includes(library.type) + ) { + compiler.options.output.enabledLibraryTypes.push(library.type); + } + compiler.hooks.afterPlugins.tap("ModuleFederationPlugin", () => { + if ( + options.exposes && + (Array.isArray(options.exposes) + ? options.exposes.length > 0 + : Object.keys(options.exposes).length > 0) + ) { + new ContainerPlugin({ + name: options.name, + library, + filename: options.filename, + runtime: options.runtime, + exposes: options.exposes + }).apply(compiler); + } + if ( + options.remotes && + (Array.isArray(options.remotes) + ? options.remotes.length > 0 + : Object.keys(options.remotes).length > 0) + ) { + new ContainerReferencePlugin({ + remoteType, + remotes: options.remotes + }).apply(compiler); + } + if (options.shared) { + new SharePlugin({ + shared: options.shared, + shareScope: options.shareScope + }).apply(compiler); + } + }); + } +} - let timeSpendInBuild = 0; - let timeSpendInStore = 0; - let avgTimeSpendInStore = 0; +module.exports = ModuleFederationPlugin; - /** @type {Map Promise>} */ - const pendingIdleTasks = new Map(); - compiler.cache.hooks.store.tap( - { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, - (identifier, etag, data) => { - pendingIdleTasks.set(identifier, () => - strategy.store(identifier, etag, data) - ); - } - ); +/***/ }), - compiler.cache.hooks.get.tapPromise( - { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, - (identifier, etag, gotHandlers) => { - const restore = () => - strategy.restore(identifier, etag).then(cacheEntry => { - if (cacheEntry === undefined) { - gotHandlers.push((result, callback) => { - if (result !== undefined) { - pendingIdleTasks.set(identifier, () => - strategy.store(identifier, etag, result) - ); - } - callback(); - }); - } else { - return cacheEntry; - } - }); - const pendingTask = pendingIdleTasks.get(identifier); - if (pendingTask !== undefined) { - pendingIdleTasks.delete(identifier); - return pendingTask().then(restore); - } - return restore(); - } - ); - - compiler.cache.hooks.storeBuildDependencies.tap( - { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, - dependencies => { - pendingIdleTasks.set(BUILD_DEPENDENCIES_KEY, () => - strategy.storeBuildDependencies(dependencies) - ); - } - ); - - compiler.cache.hooks.shutdown.tapPromise( - { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, - () => { - if (idleTimer) { - clearTimeout(idleTimer); - idleTimer = undefined; - } - isIdle = false; - const reportProgress = ProgressPlugin.getReporter(compiler); - const jobs = Array.from(pendingIdleTasks.values()); - if (reportProgress) reportProgress(0, "process pending cache items"); - const promises = jobs.map(fn => fn()); - pendingIdleTasks.clear(); - promises.push(currentIdlePromise); - const promise = Promise.all(promises); - currentIdlePromise = promise.then(() => strategy.afterAllStored()); - if (reportProgress) { - currentIdlePromise = currentIdlePromise.then(() => { - reportProgress(1, `stored`); - }); - } - return currentIdlePromise.then(() => { - // Reset strategy - if (strategy.clear) strategy.clear(); - }); - } - ); - - /** @type {Promise} */ - let currentIdlePromise = resolvedPromise; - let isIdle = false; - let isInitialStore = true; - const processIdleTasks = () => { - if (isIdle) { - const startTime = Date.now(); - if (pendingIdleTasks.size > 0) { - const promises = [currentIdlePromise]; - const maxTime = startTime + 100; - let maxCount = 100; - for (const [filename, factory] of pendingIdleTasks) { - pendingIdleTasks.delete(filename); - promises.push(factory()); - if (maxCount-- <= 0 || Date.now() > maxTime) break; - } - currentIdlePromise = Promise.all(promises); - currentIdlePromise.then(() => { - timeSpendInStore += Date.now() - startTime; - // Allow to exit the process between - idleTimer = setTimeout(processIdleTasks, 0); - idleTimer.unref(); - }); - return; - } - currentIdlePromise = currentIdlePromise - .then(async () => { - await strategy.afterAllStored(); - timeSpendInStore += Date.now() - startTime; - avgTimeSpendInStore = - Math.max(avgTimeSpendInStore, timeSpendInStore) * 0.9 + - timeSpendInStore * 0.1; - timeSpendInStore = 0; - timeSpendInBuild = 0; - }) - .catch(err => { - const logger = compiler.getInfrastructureLogger( - "IdleFileCachePlugin" - ); - logger.warn(`Background tasks during idle failed: ${err.message}`); - logger.debug(err.stack); - }); - isInitialStore = false; - } - }; - let idleTimer = undefined; - compiler.cache.hooks.beginIdle.tap( - { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, - () => { - const isLargeChange = timeSpendInBuild > avgTimeSpendInStore * 2; - if (isInitialStore && idleTimeoutForInitialStore < idleTimeout) { - compiler - .getInfrastructureLogger("IdleFileCachePlugin") - .log( - `Initial cache was generated and cache will be persisted in ${ - idleTimeoutForInitialStore / 1000 - }s.` - ); - } else if ( - isLargeChange && - idleTimeoutAfterLargeChanges < idleTimeout - ) { - compiler - .getInfrastructureLogger("IdleFileCachePlugin") - .log( - `Spend ${Math.round(timeSpendInBuild) / 1000}s in build and ${ - Math.round(avgTimeSpendInStore) / 1000 - }s in average in cache store. This is considered as large change and cache will be persisted in ${ - idleTimeoutAfterLargeChanges / 1000 - }s.` - ); - } - idleTimer = setTimeout(() => { - idleTimer = undefined; - isIdle = true; - resolvedPromise.then(processIdleTasks); - }, Math.min(isInitialStore ? idleTimeoutForInitialStore : Infinity, isLargeChange ? idleTimeoutAfterLargeChanges : Infinity, idleTimeout)); - idleTimer.unref(); - } - ); - compiler.cache.hooks.endIdle.tap( - { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK }, - () => { - if (idleTimer) { - clearTimeout(idleTimer); - idleTimer = undefined; - } - isIdle = false; - } - ); - compiler.hooks.done.tap("IdleFileCachePlugin", stats => { - // 10% build overhead is ignored, as it's not cacheable - timeSpendInBuild *= 0.9; - timeSpendInBuild += stats.endTime - stats.startTime; - }); - } -} - -module.exports = IdleFileCachePlugin; - - -/***/ }), - -/***/ 52539: +/***/ 62916: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy */ -const Cache = __webpack_require__(7592); +const { RawSource } = __webpack_require__(51255); +const Module = __webpack_require__(73208); +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); +const FallbackDependency = __webpack_require__(57764); +const RemoteToExternalDependency = __webpack_require__(14389); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Cache").Etag} Etag */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ -class MemoryCachePlugin { +const TYPES = new Set(["remote", "share-init"]); +const RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]); + +class RemoteModule extends Module { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {string} request request string + * @param {string[]} externalRequests list of external requests to containers + * @param {string} internalRequest name of exposed module in container + * @param {string} shareScope the used share scope name */ - apply(compiler) { - /** @type {Map} */ - const cache = new Map(); - compiler.cache.hooks.store.tap( - { name: "MemoryCachePlugin", stage: Cache.STAGE_MEMORY }, - (identifier, etag, data) => { - cache.set(identifier, { etag, data }); - } - ); - compiler.cache.hooks.get.tap( - { name: "MemoryCachePlugin", stage: Cache.STAGE_MEMORY }, - (identifier, etag, gotHandlers) => { - const cacheEntry = cache.get(identifier); - if (cacheEntry === null) { - return null; - } else if (cacheEntry !== undefined) { - return cacheEntry.etag === etag ? cacheEntry.data : null; - } - gotHandlers.push((result, callback) => { - if (result === undefined) { - cache.set(identifier, null); - } else { - cache.set(identifier, { etag, data: result }); - } - return callback(); - }); - } - ); - compiler.cache.hooks.shutdown.tap( - { name: "MemoryCachePlugin", stage: Cache.STAGE_MEMORY }, - () => { - cache.clear(); - } - ); + constructor(request, externalRequests, internalRequest, shareScope) { + super("remote-module"); + this.request = request; + this.externalRequests = externalRequests; + this.internalRequest = internalRequest; + this.shareScope = shareScope; + this._identifier = `remote (${shareScope}) ${this.externalRequests.join( + " " + )} ${this.internalRequest}`; } -} -module.exports = MemoryCachePlugin; + /** + * @returns {string} a unique identifier of the module + */ + identifier() { + return this._identifier; + } -/***/ }), + /** + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + return `remote ${this.request}`; + } -/***/ 99334: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion + */ + libIdent(options) { + return `${this.layer ? `(${this.layer})/` : ""}webpack/container/remote/${ + this.request + }`; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + callback(null, !this.buildInfo); + } + /** + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + this.buildMeta = {}; + this.buildInfo = { + strict: true + }; + this.clearDependenciesAndBlocks(); + if (this.externalRequests.length === 1) { + this.addDependency( + new RemoteToExternalDependency(this.externalRequests[0]) + ); + } else { + this.addDependency(new FallbackDependency(this.externalRequests)); + } -const Cache = __webpack_require__(7592); + callback(); + } -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Cache").Etag} Etag */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ + /** + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + return 6; + } -class MemoryWithGcCachePlugin { - constructor({ maxGenerations }) { - this._maxGenerations = maxGenerations; + /** + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + return TYPES; } + /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @returns {string | null} absolute path which should be used for condition matching (usually the resource path) */ - apply(compiler) { - const maxGenerations = this._maxGenerations; - /** @type {Map} */ - const cache = new Map(); - /** @type {Map} */ - const oldCache = new Map(); - let generation = 0; - let cachePosition = 0; - const logger = compiler.getInfrastructureLogger("MemoryWithGcCachePlugin"); - compiler.hooks.afterDone.tap("MemoryWithGcCachePlugin", () => { - generation++; - let clearedEntries = 0; - let lastClearedIdentifier; - for (const [identifier, entry] of oldCache) { - if (entry.until > generation) break; + nameForCondition() { + return this.request; + } - oldCache.delete(identifier); - if (cache.get(identifier) === undefined) { - cache.delete(identifier); - clearedEntries++; - lastClearedIdentifier = identifier; - } - } - if (clearedEntries > 0 || oldCache.size > 0) { - logger.log( - `${cache.size - oldCache.size} active entries, ${ - oldCache.size - } recently unused cached entries${ - clearedEntries > 0 - ? `, ${clearedEntries} old unused cache entries removed e. g. ${lastClearedIdentifier}` - : "" - }` - ); - } - let i = (cache.size / maxGenerations) | 0; - let j = cachePosition >= cache.size ? 0 : cachePosition; - cachePosition = j + i; - for (const [identifier, entry] of cache) { - if (j !== 0) { - j--; - continue; - } - if (entry !== undefined) { - // We don't delete the cache entry, but set it to undefined instead - // This reserves the location in the data table and avoids rehashing - // when constantly adding and removing entries. - // It will be deleted when removed from oldCache. - cache.set(identifier, undefined); - oldCache.delete(identifier); - oldCache.set(identifier, { - entry, - until: generation + maxGenerations - }); - if (i-- === 0) break; - } - } - }); - compiler.cache.hooks.store.tap( - { name: "MemoryWithGcCachePlugin", stage: Cache.STAGE_MEMORY }, - (identifier, etag, data) => { - cache.set(identifier, { etag, data }); - } - ); - compiler.cache.hooks.get.tap( - { name: "MemoryWithGcCachePlugin", stage: Cache.STAGE_MEMORY }, - (identifier, etag, gotHandlers) => { - const cacheEntry = cache.get(identifier); - if (cacheEntry === null) { - return null; - } else if (cacheEntry !== undefined) { - return cacheEntry.etag === etag ? cacheEntry.data : null; - } - const oldCacheEntry = oldCache.get(identifier); - if (oldCacheEntry !== undefined) { - const cacheEntry = oldCacheEntry.entry; - if (cacheEntry === null) { - oldCache.delete(identifier); - cache.set(identifier, cacheEntry); - return null; - } else { - if (cacheEntry.etag !== etag) return null; - oldCache.delete(identifier); - cache.set(identifier, cacheEntry); - return cacheEntry.data; - } - } - gotHandlers.push((result, callback) => { - if (result === undefined) { - cache.set(identifier, null); - } else { - cache.set(identifier, { etag, data: result }); - } - return callback(); - }); - } - ); - compiler.cache.hooks.shutdown.tap( - { name: "MemoryWithGcCachePlugin", stage: Cache.STAGE_MEMORY }, - () => { - cache.clear(); - oldCache.clear(); + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { + const module = moduleGraph.getModule(this.dependencies[0]); + const id = module && chunkGraph.getModuleId(module); + const sources = new Map(); + sources.set("remote", new RawSource("")); + const data = new Map(); + data.set("share-init", [ + { + shareScope: this.shareScope, + initStage: 20, + init: id === undefined ? "" : `initExternal(${JSON.stringify(id)});` } - ); + ]); + return { sources, data, runtimeRequirements: RUNTIME_REQUIREMENTS }; + } + + serialize(context) { + const { write } = context; + write(this.request); + write(this.externalRequests); + write(this.internalRequest); + write(this.shareScope); + super.serialize(context); + } + + static deserialize(context) { + const { read } = context; + const obj = new RemoteModule(read(), read(), read(), read()); + obj.deserialize(context); + return obj; } } -module.exports = MemoryWithGcCachePlugin; + +makeSerializable(RemoteModule, "webpack/lib/container/RemoteModule"); + +module.exports = RemoteModule; /***/ }), -/***/ 86180: +/***/ 88288: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -68387,1430 +67574,1451 @@ module.exports = MemoryWithGcCachePlugin; -const FileSystemInfo = __webpack_require__(79453); -const ProgressPlugin = __webpack_require__(13216); -const { formatSize } = __webpack_require__(71070); -const SerializerMiddleware = __webpack_require__(83137); -const LazySet = __webpack_require__(38938); -const makeSerializable = __webpack_require__(33032); -const memoize = __webpack_require__(78676); -const { - createFileSerializer, - NOT_SERIALIZABLE -} = __webpack_require__(8282); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); -/** @typedef {import("../../declarations/WebpackOptions").SnapshotOptions} SnapshotOptions */ -/** @typedef {import("../Cache").Etag} Etag */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../FileSystemInfo").Snapshot} Snapshot */ -/** @typedef {import("../logging/Logger").Logger} Logger */ -/** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */ +/** @typedef {import("./RemoteModule")} RemoteModule */ + +class RemoteRuntimeModule extends RuntimeModule { + constructor() { + super("remotes loading"); + } -class PackContainer { /** - * @param {Object} data stored data - * @param {string} version version identifier - * @param {Snapshot} buildSnapshot snapshot of all build dependencies - * @param {Set} buildDependencies list of all unresolved build dependencies captured - * @param {Map} resolveResults result of the resolved build dependencies - * @param {Snapshot} resolveBuildDependenciesSnapshot snapshot of the dependencies of the build dependencies resolving + * @returns {string} runtime code */ - constructor( - data, - version, - buildSnapshot, - buildDependencies, - resolveResults, - resolveBuildDependenciesSnapshot - ) { - this.data = data; - this.version = version; - this.buildSnapshot = buildSnapshot; - this.buildDependencies = buildDependencies; - this.resolveResults = resolveResults; - this.resolveBuildDependenciesSnapshot = resolveBuildDependenciesSnapshot; + generate() { + const { compilation, chunkGraph } = this; + const { runtimeTemplate, moduleGraph } = compilation; + const chunkToRemotesMapping = {}; + const idToExternalAndNameMapping = {}; + for (const chunk of this.chunk.getAllAsyncChunks()) { + const modules = chunkGraph.getChunkModulesIterableBySourceType( + chunk, + "remote" + ); + if (!modules) continue; + const remotes = (chunkToRemotesMapping[chunk.id] = []); + for (const m of modules) { + const module = /** @type {RemoteModule} */ (m); + const name = module.internalRequest; + const id = chunkGraph.getModuleId(module); + const shareScope = module.shareScope; + const dep = module.dependencies[0]; + const externalModule = moduleGraph.getModule(dep); + const externalModuleId = + externalModule && chunkGraph.getModuleId(externalModule); + remotes.push(id); + idToExternalAndNameMapping[id] = [shareScope, name, externalModuleId]; + } + } + return Template.asString([ + `var chunkMapping = ${JSON.stringify( + chunkToRemotesMapping, + null, + "\t" + )};`, + `var idToExternalAndNameMapping = ${JSON.stringify( + idToExternalAndNameMapping, + null, + "\t" + )};`, + `${ + RuntimeGlobals.ensureChunkHandlers + }.remotes = ${runtimeTemplate.basicFunction("chunkId, promises", [ + `if(${RuntimeGlobals.hasOwnProperty}(chunkMapping, chunkId)) {`, + Template.indent([ + `chunkMapping[chunkId].forEach(${runtimeTemplate.basicFunction("id", [ + `var getScope = ${RuntimeGlobals.currentRemoteGetScope};`, + "if(!getScope) getScope = [];", + "var data = idToExternalAndNameMapping[id];", + "if(getScope.indexOf(data) >= 0) return;", + "getScope.push(data);", + `if(data.p) return promises.push(data.p);`, + `var onError = ${runtimeTemplate.basicFunction("error", [ + 'if(!error) error = new Error("Container missing");', + 'if(typeof error.message === "string")', + Template.indent( + `error.message += '\\nwhile loading "' + data[1] + '" from ' + data[2];` + ), + `__webpack_modules__[id] = ${runtimeTemplate.basicFunction("", [ + "throw error;" + ])}`, + "data.p = 0;" + ])};`, + `var handleFunction = ${runtimeTemplate.basicFunction( + "fn, arg1, arg2, d, next, first", + [ + "try {", + Template.indent([ + "var promise = fn(arg1, arg2);", + "if(promise && promise.then) {", + Template.indent([ + `var p = promise.then(${runtimeTemplate.returningFunction( + "next(result, d)", + "result" + )}, onError);`, + `if(first) promises.push(data.p = p); else return p;` + ]), + "} else {", + Template.indent(["return next(promise, d, first);"]), + "}" + ]), + "} catch(error) {", + Template.indent(["onError(error);"]), + "}" + ] + )}`, + `var onExternal = ${runtimeTemplate.returningFunction( + `external ? handleFunction(${RuntimeGlobals.initializeSharing}, data[0], 0, external, onInitialized, first) : onError()`, + "external, _, first" + )};`, + `var onInitialized = ${runtimeTemplate.returningFunction( + `handleFunction(external.get, data[1], getScope, 0, onFactory, first)`, + "_, external, first" + )};`, + `var onFactory = ${runtimeTemplate.basicFunction("factory", [ + "data.p = 1;", + `__webpack_modules__[id] = ${runtimeTemplate.basicFunction( + "module", + ["module.exports = factory();"] + )}` + ])};`, + "handleFunction(__webpack_require__, data[2], 0, 0, onExternal, 1);" + ])});` + ]), + "}" + ])}` + ]); } +} - serialize({ write, writeLazy }) { - write(this.version); - write(this.buildSnapshot); - write(this.buildDependencies); - write(this.resolveResults); - write(this.resolveBuildDependenciesSnapshot); - writeLazy(this.data); +module.exports = RemoteRuntimeModule; + + +/***/ }), + +/***/ 14389: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ModuleDependency = __webpack_require__(80321); +const makeSerializable = __webpack_require__(33032); + +class RemoteToExternalDependency extends ModuleDependency { + constructor(request) { + super(request); } - deserialize({ read }) { - this.version = read(); - this.buildSnapshot = read(); - this.buildDependencies = read(); - this.resolveResults = read(); - this.resolveBuildDependenciesSnapshot = read(); - this.data = read(); + get type() { + return "remote to external"; + } + + get category() { + return "esm"; } } makeSerializable( - PackContainer, - "webpack/lib/cache/PackFileCacheStrategy", - "PackContainer" + RemoteToExternalDependency, + "webpack/lib/container/RemoteToExternalDependency" ); -const MIN_CONTENT_SIZE = 1024 * 1024; // 1 MB -const CONTENT_COUNT_TO_MERGE = 10; -const MIN_ITEMS_IN_FRESH_PACK = 100; -const MAX_ITEMS_IN_FRESH_PACK = 50000; -const MAX_TIME_IN_FRESH_PACK = 1 * 60 * 1000; // 1 min +module.exports = RemoteToExternalDependency; -class PackItemInfo { - /** - * @param {string} identifier identifier of item - * @param {string | null} etag etag of item - * @param {any} value fresh value of item - */ - constructor(identifier, etag, value) { - this.identifier = identifier; - this.etag = etag; - this.location = -1; - this.lastAccess = Date.now(); - this.freshValue = value; - } -} -class Pack { - constructor(logger, maxAge) { - /** @type {Map} */ - this.itemInfo = new Map(); - /** @type {string[]} */ - this.requests = []; - this.requestsTimeout = undefined; - /** @type {Map} */ - this.freshContent = new Map(); - /** @type {(undefined | PackContent)[]} */ - this.content = []; - this.invalid = false; - this.logger = logger; - this.maxAge = maxAge; - } +/***/ }), - _addRequest(identifier) { - this.requests.push(identifier); - if (this.requestsTimeout === undefined) { - this.requestsTimeout = setTimeout(() => { - this.requests.push(undefined); - this.requestsTimeout = undefined; - }, MAX_TIME_IN_FRESH_PACK); - if (this.requestsTimeout.unref) this.requestsTimeout.unref(); +/***/ 3083: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +/** @template T @typedef {(string | Record)[] | Record} ContainerOptionsFormat */ + +/** + * @template T + * @template N + * @param {ContainerOptionsFormat} options options passed by the user + * @param {function(string | string[], string) : N} normalizeSimple normalize a simple item + * @param {function(T, string) : N} normalizeOptions normalize a complex item + * @param {function(string, N): void} fn processing function + * @returns {void} + */ +const process = (options, normalizeSimple, normalizeOptions, fn) => { + const array = items => { + for (const item of items) { + if (typeof item === "string") { + fn(item, normalizeSimple(item, item)); + } else if (item && typeof item === "object") { + object(item); + } else { + throw new Error("Unexpected options format"); + } + } + }; + const object = obj => { + for (const [key, value] of Object.entries(obj)) { + if (typeof value === "string" || Array.isArray(value)) { + fn(key, normalizeSimple(value, key)); + } else { + fn(key, normalizeOptions(value, key)); + } } + }; + if (!options) { + return; + } else if (Array.isArray(options)) { + array(options); + } else if (typeof options === "object") { + object(options); + } else { + throw new Error("Unexpected options format"); } +}; - stopCapturingRequests() { - if (this.requestsTimeout !== undefined) { - clearTimeout(this.requestsTimeout); - this.requestsTimeout = undefined; +/** + * @template T + * @template R + * @param {ContainerOptionsFormat} options options passed by the user + * @param {function(string | string[], string) : R} normalizeSimple normalize a simple item + * @param {function(T, string) : R} normalizeOptions normalize a complex item + * @returns {[string, R][]} parsed options + */ +const parseOptions = (options, normalizeSimple, normalizeOptions) => { + /** @type {[string, R][]} */ + const items = []; + process(options, normalizeSimple, normalizeOptions, (key, value) => { + items.push([key, value]); + }); + return items; +}; + +/** + * @template T + * @param {string} scope scope name + * @param {ContainerOptionsFormat} options options passed by the user + * @returns {Record} options to spread or pass + */ +const scope = (scope, options) => { + /** @type {Record} */ + const obj = {}; + process( + options, + item => /** @type {string | string[] | T} */ (item), + item => /** @type {string | string[] | T} */ (item), + (key, value) => { + obj[ + key.startsWith("./") ? `${scope}${key.slice(1)}` : `${scope}/${key}` + ] = value; } + ); + return obj; +}; + +exports.parseOptions = parseOptions; +exports.scope = scope; + + +/***/ }), + +/***/ 91254: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Sergey Melyukov @smelukov +*/ + + + +const { ReplaceSource, RawSource, ConcatSource } = __webpack_require__(51255); +const { UsageState } = __webpack_require__(63686); +const Generator = __webpack_require__(93401); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../Generator").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../util/Hash")} Hash */ + +const TYPES = new Set(["javascript"]); + +class CssExportsGenerator extends Generator { + constructor() { + super(); } + // TODO add getConcatenationBailoutReason to allow concatenation + // but how to make it have a module id + /** - * @param {string} identifier unique name for the resource - * @param {string | null} etag etag of the resource - * @returns {any} cached content + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code */ - get(identifier, etag) { - const info = this.itemInfo.get(identifier); - this._addRequest(identifier); - if (info === undefined) { - return undefined; - } - if (info.etag !== etag) return null; - info.lastAccess = Date.now(); - const loc = info.location; - if (loc === -1) { - return info.freshValue; + generate(module, generateContext) { + const source = new ReplaceSource(new RawSource("")); + const initFragments = []; + const cssExports = new Map(); + + generateContext.runtimeRequirements.add(RuntimeGlobals.module); + + const runtimeRequirements = new Set(); + + const templateContext = { + runtimeTemplate: generateContext.runtimeTemplate, + dependencyTemplates: generateContext.dependencyTemplates, + moduleGraph: generateContext.moduleGraph, + chunkGraph: generateContext.chunkGraph, + module, + runtime: generateContext.runtime, + runtimeRequirements: runtimeRequirements, + concatenationScope: generateContext.concatenationScope, + codeGenerationResults: generateContext.codeGenerationResults, + initFragments, + cssExports + }; + + const handleDependency = dependency => { + const constructor = /** @type {new (...args: any[]) => Dependency} */ ( + dependency.constructor + ); + const template = generateContext.dependencyTemplates.get(constructor); + if (!template) { + throw new Error( + "No template for dependency: " + dependency.constructor.name + ); + } + + template.apply(dependency, source, templateContext); + }; + module.dependencies.forEach(handleDependency); + + if (generateContext.concatenationScope) { + const source = new ConcatSource(); + const usedIdentifiers = new Set(); + for (const [k, v] of cssExports) { + let identifier = Template.toIdentifier(k); + let i = 0; + while (usedIdentifiers.has(identifier)) { + identifier = Template.toIdentifier(k + i); + } + usedIdentifiers.add(identifier); + generateContext.concatenationScope.registerExport(k, identifier); + source.add( + `${ + generateContext.runtimeTemplate.supportsConst ? "const" : "var" + } ${identifier} = ${JSON.stringify(v)};\n` + ); + } + return source; } else { - if (!this.content[loc]) { - return undefined; + const otherUsed = + generateContext.moduleGraph + .getExportsInfo(module) + .otherExportsInfo.getUsed(generateContext.runtime) !== + UsageState.Unused; + if (otherUsed) { + generateContext.runtimeRequirements.add( + RuntimeGlobals.makeNamespaceObject + ); } - return this.content[loc].get(identifier); + return new RawSource( + `${otherUsed ? `${RuntimeGlobals.makeNamespaceObject}(` : ""}${ + module.moduleArgument + }.exports = {\n${Array.from( + cssExports, + ([k, v]) => `\t${JSON.stringify(k)}: ${JSON.stringify(v)}` + ).join(",\n")}\n}${otherUsed ? ")" : ""};` + ); } } /** - * @param {string} identifier unique name for the resource - * @param {string | null} etag etag of the resource - * @param {any} data cached content - * @returns {void} + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) */ - set(identifier, etag, data) { - if (!this.invalid) { - this.invalid = true; - this.logger.log(`Pack got invalid because of write to: ${identifier}`); - } - const info = this.itemInfo.get(identifier); - if (info === undefined) { - const newInfo = new PackItemInfo(identifier, etag, data); - this.itemInfo.set(identifier, newInfo); - this._addRequest(identifier); - this.freshContent.set(identifier, newInfo); - } else { - const loc = info.location; - if (loc >= 0) { - this._addRequest(identifier); - this.freshContent.set(identifier, info); - const content = this.content[loc]; - content.delete(identifier); - if (content.items.size === 0) { - this.content[loc] = undefined; - this.logger.debug("Pack %d got empty and is removed", loc); - } - } - info.freshValue = data; - info.lastAccess = Date.now(); - info.etag = etag; - info.location = -1; - } + getTypes(module) { + return TYPES; } - getContentStats() { - let count = 0; - let size = 0; - for (const content of this.content) { - if (content !== undefined) { - count++; - const s = content.getSize(); - if (s > 0) { - size += s; - } - } - } - return { count, size }; + /** + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module + */ + getSize(module, type) { + return 42; } /** - * @returns {number} new location of data entries + * @param {Hash} hash hash that will be modified + * @param {UpdateHashContext} updateHashContext context for updating hash */ - _findLocation() { - let i; - for (i = 0; i < this.content.length && this.content[i] !== undefined; i++); - return i; - } + updateHash(hash, { module }) {} +} - _gcAndUpdateLocation(items, usedItems, newLoc) { - let count = 0; - let lastGC; - const now = Date.now(); - for (const identifier of items) { - const info = this.itemInfo.get(identifier); - if (now - info.lastAccess > this.maxAge) { - this.itemInfo.delete(identifier); - items.delete(identifier); - usedItems.delete(identifier); - count++; - lastGC = identifier; - } else { - info.location = newLoc; - } - } - if (count > 0) { - this.logger.log( - "Garbage Collected %d old items at pack %d (%d items remaining) e. g. %s", - count, - newLoc, - items.size, - lastGC - ); - } - } +module.exports = CssExportsGenerator; - _persistFreshContent() { - const itemsCount = this.freshContent.size; - if (itemsCount > 0) { - const packCount = Math.ceil(itemsCount / MAX_ITEMS_IN_FRESH_PACK); - const itemsPerPack = Math.ceil(itemsCount / packCount); - const packs = []; - let i = 0; - let ignoreNextTimeTick = false; - const createNextPack = () => { - const loc = this._findLocation(); - this.content[loc] = null; // reserve - const pack = { - /** @type {Set} */ - items: new Set(), - /** @type {Map} */ - map: new Map(), - loc - }; - packs.push(pack); - return pack; - }; - let pack = createNextPack(); - if (this.requestsTimeout !== undefined) - clearTimeout(this.requestsTimeout); - for (const identifier of this.requests) { - if (identifier === undefined) { - if (ignoreNextTimeTick) { - ignoreNextTimeTick = false; - } else if (pack.items.size >= MIN_ITEMS_IN_FRESH_PACK) { - i = 0; - pack = createNextPack(); - } - continue; - } - const info = this.freshContent.get(identifier); - if (info === undefined) continue; - pack.items.add(identifier); - pack.map.set(identifier, info.freshValue); - info.location = pack.loc; - info.freshValue = undefined; - this.freshContent.delete(identifier); - if (++i > itemsPerPack) { - i = 0; - pack = createNextPack(); - ignoreNextTimeTick = true; - } - } - this.requests.length = 0; - for (const pack of packs) { - this.content[pack.loc] = new PackContent( - pack.items, - new Set(pack.items), - new PackContentItems(pack.map) - ); - } - this.logger.log( - `${itemsCount} fresh items in cache put into pack ${ - packs.length > 1 - ? packs - .map(pack => `${pack.loc} (${pack.items.size} items)`) - .join(", ") - : packs[0].loc - }` - ); - } + +/***/ }), + +/***/ 46061: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Sergey Melyukov @smelukov +*/ + + + +const { ReplaceSource } = __webpack_require__(51255); +const Generator = __webpack_require__(93401); +const InitFragment = __webpack_require__(55870); +const RuntimeGlobals = __webpack_require__(16475); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../Generator").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../util/Hash")} Hash */ + +const TYPES = new Set(["css"]); + +class CssGenerator extends Generator { + constructor() { + super(); } /** - * Merges small content files to a single content file + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code */ - _optimizeSmallContent() { - // 1. Find all small content files - // Treat unused content files separately to avoid - // a merge-split cycle - /** @type {number[]} */ - const smallUsedContents = []; - /** @type {number} */ - let smallUsedContentSize = 0; - /** @type {number[]} */ - const smallUnusedContents = []; - /** @type {number} */ - let smallUnusedContentSize = 0; - for (let i = 0; i < this.content.length; i++) { - const content = this.content[i]; - if (content === undefined) continue; - if (content.outdated) continue; - const size = content.getSize(); - if (size < 0 || size > MIN_CONTENT_SIZE) continue; - if (content.used.size > 0) { - smallUsedContents.push(i); - smallUsedContentSize += size; - } else { - smallUnusedContents.push(i); - smallUnusedContentSize += size; - } - } - - // 2. Check if minimum number is reached - let mergedIndices; - if ( - smallUsedContents.length >= CONTENT_COUNT_TO_MERGE || - smallUsedContentSize > MIN_CONTENT_SIZE - ) { - mergedIndices = smallUsedContents; - } else if ( - smallUnusedContents.length >= CONTENT_COUNT_TO_MERGE || - smallUnusedContentSize > MIN_CONTENT_SIZE - ) { - mergedIndices = smallUnusedContents; - } else return; + generate(module, generateContext) { + const originalSource = module.originalSource(); + const source = new ReplaceSource(originalSource); + const initFragments = []; + const cssExports = new Map(); - const mergedContent = []; + generateContext.runtimeRequirements.add(RuntimeGlobals.hasCssModules); - // 3. Remove old content entries - for (const i of mergedIndices) { - mergedContent.push(this.content[i]); - this.content[i] = undefined; - } + const templateContext = { + runtimeTemplate: generateContext.runtimeTemplate, + dependencyTemplates: generateContext.dependencyTemplates, + moduleGraph: generateContext.moduleGraph, + chunkGraph: generateContext.chunkGraph, + module, + runtime: generateContext.runtime, + runtimeRequirements: generateContext.runtimeRequirements, + concatenationScope: generateContext.concatenationScope, + codeGenerationResults: generateContext.codeGenerationResults, + initFragments, + cssExports + }; - // 4. Determine merged items - /** @type {Set} */ - const mergedItems = new Set(); - /** @type {Set} */ - const mergedUsedItems = new Set(); - /** @type {(function(Map): Promise)[]} */ - const addToMergedMap = []; - for (const content of mergedContent) { - for (const identifier of content.items) { - mergedItems.add(identifier); - } - for (const identifier of content.used) { - mergedUsedItems.add(identifier); - } - addToMergedMap.push(async map => { - // unpack existing content - // after that values are accessible in .content - await content.unpack( - "it should be merged with other small pack contents" + const handleDependency = dependency => { + const constructor = /** @type {new (...args: any[]) => Dependency} */ ( + dependency.constructor + ); + const template = generateContext.dependencyTemplates.get(constructor); + if (!template) { + throw new Error( + "No template for dependency: " + dependency.constructor.name ); - for (const [identifier, value] of content.content) { - map.set(identifier, value); - } - }); + } + + template.apply(dependency, source, templateContext); + }; + module.dependencies.forEach(handleDependency); + if (module.presentationalDependencies !== undefined) + module.presentationalDependencies.forEach(handleDependency); + + if (cssExports.size > 0) { + const data = generateContext.getData(); + data.set("css-exports", cssExports); } - // 5. GC and update location of merged items - const newLoc = this._findLocation(); - this._gcAndUpdateLocation(mergedItems, mergedUsedItems, newLoc); + return InitFragment.addToSource(source, initFragments, generateContext); + } - // 6. If not empty, store content somewhere - if (mergedItems.size > 0) { - this.content[newLoc] = new PackContent( - mergedItems, - mergedUsedItems, - memoize(async () => { - /** @type {Map} */ - const map = new Map(); - await Promise.all(addToMergedMap.map(fn => fn(map))); - return new PackContentItems(map); - }) - ); - this.logger.log( - "Merged %d small files with %d cache items into pack %d", - mergedContent.length, - mergedItems.size, - newLoc - ); + /** + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) + */ + getTypes(module) { + return TYPES; + } + + /** + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module + */ + getSize(module, type) { + const originalSource = module.originalSource(); + + if (!originalSource) { + return 0; } + + return originalSource.size(); } /** - * Split large content files with used and unused items - * into two parts to separate used from unused items + * @param {Hash} hash hash that will be modified + * @param {UpdateHashContext} updateHashContext context for updating hash */ - _optimizeUnusedContent() { - // 1. Find a large content file with used and unused items - for (let i = 0; i < this.content.length; i++) { - const content = this.content[i]; - if (content === undefined) continue; - const size = content.getSize(); - if (size < MIN_CONTENT_SIZE) continue; - const used = content.used.size; - const total = content.items.size; - if (used > 0 && used < total) { - // 2. Remove this content - this.content[i] = undefined; + updateHash(hash, { module }) {} +} - // 3. Determine items for the used content file - const usedItems = new Set(content.used); - const newLoc = this._findLocation(); - this._gcAndUpdateLocation(usedItems, usedItems, newLoc); +module.exports = CssGenerator; - // 4. Create content file for used items - if (usedItems.size > 0) { - this.content[newLoc] = new PackContent( - usedItems, - new Set(usedItems), - async () => { - await content.unpack( - "it should be splitted into used and unused items" - ); - const map = new Map(); - for (const identifier of usedItems) { - map.set(identifier, content.content.get(identifier)); - } - return new PackContentItems(map); - } - ); - } - // 5. Determine items for the unused content file - const unusedItems = new Set(content.items); - const usedOfUnusedItems = new Set(); - for (const identifier of usedItems) { - unusedItems.delete(identifier); - } - const newUnusedLoc = this._findLocation(); - this._gcAndUpdateLocation(unusedItems, usedOfUnusedItems, newUnusedLoc); +/***/ }), - // 6. Create content file for unused items - if (unusedItems.size > 0) { - this.content[newUnusedLoc] = new PackContent( - unusedItems, - usedOfUnusedItems, - async () => { - await content.unpack( - "it should be splitted into used and unused items" - ); - const map = new Map(); - for (const identifier of unusedItems) { - map.set(identifier, content.content.get(identifier)); - } - return new PackContentItems(map); - } - ); - } +/***/ 80806: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - this.logger.log( - "Split pack %d into pack %d with %d used items and pack %d with %d unused items", - i, - newLoc, - usedItems.size, - newUnusedLoc, - unusedItems.size - ); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // optimizing only one of them is good enough and - // reduces the amount of serialization needed - return; - } - } - } + +const { SyncWaterfallHook } = __webpack_require__(6967); +const Compilation = __webpack_require__(85720); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); +const compileBooleanMatcher = __webpack_require__(29404); +const { chunkHasCss } = __webpack_require__(47283); + +/** @typedef {import("../Chunk")} Chunk */ + +/** + * @typedef {Object} JsonpCompilationPluginHooks + * @property {SyncWaterfallHook<[string, Chunk]>} createStylesheet + */ + +/** @type {WeakMap} */ +const compilationHooksMap = new WeakMap(); + +class CssLoadingRuntimeModule extends RuntimeModule { /** - * Find the content with the oldest item and run GC on that. - * Only runs for one content to avoid large invalidation. + * @param {Compilation} compilation the compilation + * @returns {JsonpCompilationPluginHooks} hooks */ - _gcOldestContent() { - /** @type {PackItemInfo} */ - let oldest = undefined; - for (const info of this.itemInfo.values()) { - if (oldest === undefined || info.lastAccess < oldest.lastAccess) { - oldest = info; - } + static getCompilationHooks(compilation) { + if (!(compilation instanceof Compilation)) { + throw new TypeError( + "The 'compilation' argument must be an instance of Compilation" + ); } - if (Date.now() - oldest.lastAccess > this.maxAge) { - const loc = oldest.location; - if (loc < 0) return; - const content = this.content[loc]; - const items = new Set(content.items); - const usedItems = new Set(content.used); - this._gcAndUpdateLocation(items, usedItems, loc); - - this.content[loc] = - items.size > 0 - ? new PackContent(items, usedItems, async () => { - await content.unpack( - "it contains old items that should be garbage collected" - ); - const map = new Map(); - for (const identifier of items) { - map.set(identifier, content.content.get(identifier)); - } - return new PackContentItems(map); - }) - : undefined; + let hooks = compilationHooksMap.get(compilation); + if (hooks === undefined) { + hooks = { + createStylesheet: new SyncWaterfallHook(["source", "chunk"]) + }; + compilationHooksMap.set(compilation, hooks); } + return hooks; } - serialize({ write, writeSeparate }) { - this._persistFreshContent(); - this._optimizeSmallContent(); - this._optimizeUnusedContent(); - this._gcOldestContent(); - for (const identifier of this.itemInfo.keys()) { - write(identifier); - } - write(null); // null as marker of the end of keys - for (const info of this.itemInfo.values()) { - write(info.etag); - } - for (const info of this.itemInfo.values()) { - write(info.lastAccess); - } - for (let i = 0; i < this.content.length; i++) { - const content = this.content[i]; - if (content !== undefined) { - write(content.items); - content.writeLazy(lazy => writeSeparate(lazy, { name: `${i}` })); - } else { - write(undefined); // undefined marks an empty content slot - } - } - write(null); // null as marker of the end of items - } + constructor(runtimeRequirements, runtimeOptions) { + super("css loading", 10); - deserialize({ read, logger }) { - this.logger = logger; - { - const items = []; - let item = read(); - while (item !== null) { - items.push(item); - item = read(); - } - this.itemInfo.clear(); - const infoItems = items.map(identifier => { - const info = new PackItemInfo(identifier, undefined, undefined); - this.itemInfo.set(identifier, info); - return info; - }); - for (const info of infoItems) { - info.etag = read(); - } - for (const info of infoItems) { - info.lastAccess = read(); - } - } - this.content.length = 0; - let items = read(); - while (items !== null) { - if (items === undefined) { - this.content.push(items); - } else { - const idx = this.content.length; - const lazy = read(); - this.content.push( - new PackContent( - items, - new Set(), - lazy, - logger, - `${this.content.length}` - ) - ); - for (const identifier of items) { - this.itemInfo.get(identifier).location = idx; - } - } - items = read(); - } + this._runtimeRequirements = runtimeRequirements; + this.runtimeOptions = runtimeOptions; } -} -makeSerializable(Pack, "webpack/lib/cache/PackFileCacheStrategy", "Pack"); - -class PackContentItems { /** - * @param {Map} map items + * @returns {string} runtime code */ - constructor(map) { - this.map = map; - } + generate() { + const { compilation, chunk, _runtimeRequirements } = this; + const { + chunkGraph, + runtimeTemplate, + outputOptions: { + crossOriginLoading, + uniqueName, + chunkLoadTimeout: loadTimeout + } + } = compilation; + const fn = RuntimeGlobals.ensureChunkHandlers; + const conditionMap = chunkGraph.getChunkConditionMap( + chunk, + (chunk, chunkGraph) => + !!chunkGraph.getChunkModulesIterableBySourceType(chunk, "css") + ); + const hasCssMatcher = compileBooleanMatcher(conditionMap); - serialize({ write, snapshot, rollback, logger, profile }) { - if (profile) { - write(false); - for (const [key, value] of this.map) { - const s = snapshot(); - try { - write(key); - const start = process.hrtime(); - write(value); - const durationHr = process.hrtime(start); - const duration = durationHr[0] * 1000 + durationHr[1] / 1e6; - if (duration > 1) { - if (duration > 500) - logger.error(`Serialization of '${key}': ${duration} ms`); - else if (duration > 50) - logger.warn(`Serialization of '${key}': ${duration} ms`); - else if (duration > 10) - logger.info(`Serialization of '${key}': ${duration} ms`); - else if (duration > 5) - logger.log(`Serialization of '${key}': ${duration} ms`); - else logger.debug(`Serialization of '${key}': ${duration} ms`); - } - } catch (e) { - rollback(s); - if (e === NOT_SERIALIZABLE) continue; - logger.warn( - `Skipped not serializable cache item '${key}': ${e.message}` - ); - logger.debug(e.stack); - } - } - write(null); - return; + const withLoading = + _runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers) && + hasCssMatcher !== false; + const withHmr = _runtimeRequirements.has( + RuntimeGlobals.hmrDownloadUpdateHandlers + ); + const initialChunkIdsWithCss = new Set(); + const initialChunkIdsWithoutCss = new Set(); + for (const c of chunk.getAllInitialChunks()) { + (chunkHasCss(c, chunkGraph) + ? initialChunkIdsWithCss + : initialChunkIdsWithoutCss + ).add(c.id); } - // Try to serialize all at once - const s = snapshot(); - try { - write(true); - write(this.map); - } catch (e) { - rollback(s); - // Try to serialize each item on it's own - write(false); - for (const [key, value] of this.map) { - const s = snapshot(); - try { - write(key); - write(value); - } catch (e) { - rollback(s); - if (e === NOT_SERIALIZABLE) continue; - logger.warn( - `Skipped not serializable cache item '${key}': ${e.message}` - ); - logger.debug(e.stack); - } - } - write(null); + if (!withLoading && !withHmr && initialChunkIdsWithCss.size === 0) { + return null; } - } - deserialize({ read, logger, profile }) { - if (read()) { - this.map = read(); - } else if (profile) { - const map = new Map(); - let key = read(); - while (key !== null) { - const start = process.hrtime(); - const value = read(); - const durationHr = process.hrtime(start); - const duration = durationHr[0] * 1000 + durationHr[1] / 1e6; - if (duration > 1) { - if (duration > 100) - logger.error(`Deserialization of '${key}': ${duration} ms`); - else if (duration > 20) - logger.warn(`Deserialization of '${key}': ${duration} ms`); - else if (duration > 5) - logger.info(`Deserialization of '${key}': ${duration} ms`); - else if (duration > 2) - logger.log(`Deserialization of '${key}': ${duration} ms`); - else logger.debug(`Deserialization of '${key}': ${duration} ms`); - } - map.set(key, value); - key = read(); - } - this.map = map; - } else { - const map = new Map(); - let key = read(); - while (key !== null) { - map.set(key, read()); - key = read(); - } - this.map = map; - } + const { createStylesheet } = + CssLoadingRuntimeModule.getCompilationHooks(compilation); + + const stateExpression = withHmr + ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_css` + : undefined; + + const code = Template.asString([ + "link = document.createElement('link');", + uniqueName + ? 'link.setAttribute("data-webpack", uniqueName + ":" + key);' + : "", + "link.setAttribute(loadingAttribute, 1);", + 'link.rel = "stylesheet";', + "link.href = url;", + crossOriginLoading + ? Template.asString([ + "if (link.src.indexOf(window.location.origin + '/') !== 0) {", + Template.indent( + `link.crossOrigin = ${JSON.stringify(crossOriginLoading)};` + ), + "}" + ]) + : "" + ]); + + const cc = str => str.charCodeAt(0); + + return Template.asString([ + "// object to store loaded and loading chunks", + "// undefined = chunk not loaded, null = chunk preloaded/prefetched", + "// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded", + `var installedChunks = ${ + stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" + }{${Array.from( + initialChunkIdsWithoutCss, + id => `${JSON.stringify(id)}:0` + ).join(",")}};`, + "", + uniqueName + ? `var uniqueName = ${JSON.stringify( + runtimeTemplate.outputOptions.uniqueName + )};` + : "// data-webpack is not used as build has no uniqueName", + `var loadCssChunkData = ${runtimeTemplate.basicFunction( + "target, link, chunkId", + [ + `var data, token = "", token2, exports = {}, exportsWithId = [], exportsWithDashes = [], ${ + withHmr ? "moduleIds = [], " : "" + }i = 0, cc = 1;`, + "try { if(!link) link = loadStylesheet(chunkId); data = link.sheet.cssRules; data = data[data.length - 1].style; } catch(e) { data = getComputedStyle(document.head); }", + `data = data.getPropertyValue(${ + uniqueName + ? runtimeTemplate.concatenation( + "--webpack-", + { expr: "uniqueName" }, + "-", + { expr: "chunkId" } + ) + : runtimeTemplate.concatenation("--webpack-", { expr: "chunkId" }) + });`, + "if(!data) return [];", + "for(; cc; i++) {", + Template.indent([ + "cc = data.charCodeAt(i);", + `if(cc == ${cc("(")}) { token2 = token; token = ""; }`, + `else if(cc == ${cc( + ")" + )}) { exports[token2.replace(/^_/, "")] = token.replace(/^_/, ""); token = ""; }`, + `else if(cc == ${cc("/")} || cc == ${cc( + "%" + )}) { token = token.replace(/^_/, ""); exports[token] = token; exportsWithId.push(token); if(cc == ${cc( + "%" + )}) exportsWithDashes.push(token); token = ""; }`, + `else if(!cc || cc == ${cc( + "," + )}) { token = token.replace(/^_/, ""); exportsWithId.forEach(${runtimeTemplate.expressionFunction( + `exports[x] = ${ + uniqueName + ? runtimeTemplate.concatenation( + { expr: "uniqueName" }, + "-", + { expr: "token" }, + "-", + { expr: "exports[x]" } + ) + : runtimeTemplate.concatenation({ expr: "token" }, "-", { + expr: "exports[x]" + }) + }`, + "x" + )}); exportsWithDashes.forEach(${runtimeTemplate.expressionFunction( + `exports[x] = "--" + exports[x]`, + "x" + )}); ${ + RuntimeGlobals.makeNamespaceObject + }(exports); target[token] = (${runtimeTemplate.basicFunction( + "exports, module", + `module.exports = exports;` + )}).bind(null, exports); ${ + withHmr ? "moduleIds.push(token); " : "" + }token = ""; exports = {}; exportsWithId.length = 0; }`, + `else if(cc == ${cc("\\")}) { token += data[++i] }`, + `else { token += data[i]; }` + ]), + "}", + `${ + withHmr ? `if(target == ${RuntimeGlobals.moduleFactories}) ` : "" + }installedChunks[chunkId] = 0;`, + withHmr ? "return moduleIds;" : "" + ] + )}`, + 'var loadingAttribute = "data-webpack-loading";', + `var loadStylesheet = ${runtimeTemplate.basicFunction( + "chunkId, url, done" + (withHmr ? ", hmr" : ""), + [ + 'var link, needAttach, key = "chunk-" + chunkId;', + withHmr ? "if(!hmr) {" : "", + 'var links = document.getElementsByTagName("link");', + "for(var i = 0; i < links.length; i++) {", + Template.indent([ + "var l = links[i];", + `if(l.rel == "stylesheet" && (${ + withHmr + ? 'l.href.startsWith(url) || l.getAttribute("href").startsWith(url)' + : 'l.href == url || l.getAttribute("href") == url' + }${ + uniqueName + ? ' || l.getAttribute("data-webpack") == uniqueName + ":" + key' + : "" + })) { link = l; break; }` + ]), + "}", + "if(!done) return link;", + withHmr ? "}" : "", + "if(!link) {", + Template.indent([ + "needAttach = true;", + createStylesheet.call(code, this.chunk) + ]), + "}", + `var onLinkComplete = ${runtimeTemplate.basicFunction( + "prev, event", + Template.asString([ + "link.onerror = link.onload = null;", + "link.removeAttribute(loadingAttribute);", + "clearTimeout(timeout);", + 'if(event && event.type != "load") link.parentNode.removeChild(link)', + "done(event);", + "if(prev) return prev(event);" + ]) + )};`, + "if(link.getAttribute(loadingAttribute)) {", + Template.indent([ + `var timeout = setTimeout(onLinkComplete.bind(null, undefined, { type: 'timeout', target: link }), ${loadTimeout});`, + "link.onerror = onLinkComplete.bind(null, link.onerror);", + "link.onload = onLinkComplete.bind(null, link.onload);" + ]), + "} else onLinkComplete(undefined, { type: 'load', target: link });", // We assume any existing stylesheet is render blocking + withHmr ? "hmr ? document.head.insertBefore(link, hmr) :" : "", + "needAttach && document.head.appendChild(link);", + "return link;" + ] + )};`, + initialChunkIdsWithCss.size > 2 + ? `${JSON.stringify( + Array.from(initialChunkIdsWithCss) + )}.forEach(loadCssChunkData.bind(null, ${ + RuntimeGlobals.moduleFactories + }, 0));` + : initialChunkIdsWithCss.size > 0 + ? `${Array.from( + initialChunkIdsWithCss, + id => + `loadCssChunkData(${ + RuntimeGlobals.moduleFactories + }, 0, ${JSON.stringify(id)});` + ).join("")}` + : "// no initial css", + "", + withLoading + ? Template.asString([ + `${fn}.css = ${runtimeTemplate.basicFunction("chunkId, promises", [ + "// css chunk loading", + `var installedChunkData = ${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;`, + 'if(installedChunkData !== 0) { // 0 means "already installed".', + Template.indent([ + "", + '// a Promise means "currently loading".', + "if(installedChunkData) {", + Template.indent(["promises.push(installedChunkData[2]);"]), + "} else {", + Template.indent([ + hasCssMatcher === true + ? "if(true) { // all chunks have CSS" + : `if(${hasCssMatcher("chunkId")}) {`, + Template.indent([ + "// setup Promise in chunk cache", + `var promise = new Promise(${runtimeTemplate.expressionFunction( + `installedChunkData = installedChunks[chunkId] = [resolve, reject]`, + "resolve, reject" + )});`, + "promises.push(installedChunkData[2] = promise);", + "", + "// start chunk loading", + `var url = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkCssFilename}(chunkId);`, + "// create error before stack unwound to get useful stacktrace later", + "var error = new Error();", + `var loadingEnded = ${runtimeTemplate.basicFunction( + "event", + [ + `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId)) {`, + Template.indent([ + "installedChunkData = installedChunks[chunkId];", + "if(installedChunkData !== 0) installedChunks[chunkId] = undefined;", + "if(installedChunkData) {", + Template.indent([ + 'if(event.type !== "load") {', + Template.indent([ + "var errorType = event && event.type;", + "var realSrc = event && event.target && event.target.src;", + "error.message = 'Loading css chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", + "error.name = 'ChunkLoadError';", + "error.type = errorType;", + "error.request = realSrc;", + "installedChunkData[1](error);" + ]), + "} else {", + Template.indent([ + `loadCssChunkData(${RuntimeGlobals.moduleFactories}, link, chunkId);`, + "installedChunkData[0]();" + ]), + "}" + ]), + "}" + ]), + "}" + ] + )};`, + "var link = loadStylesheet(chunkId, url, loadingEnded);" + ]), + "} else installedChunks[chunkId] = 0;" + ]), + "}" + ]), + "}" + ])};` + ]) + : "// no chunk loading", + "", + withHmr + ? Template.asString([ + "var oldTags = [];", + "var newTags = [];", + `var applyHandler = ${runtimeTemplate.basicFunction("options", [ + `return { dispose: ${runtimeTemplate.basicFunction( + "", + [] + )}, apply: ${runtimeTemplate.basicFunction("", [ + "var moduleIds = [];", + `newTags.forEach(${runtimeTemplate.expressionFunction( + "info[1].sheet.disabled = false", + "info" + )});`, + "while(oldTags.length) {", + Template.indent([ + "var oldTag = oldTags.pop();", + "if(oldTag.parentNode) oldTag.parentNode.removeChild(oldTag);" + ]), + "}", + "while(newTags.length) {", + Template.indent([ + `var info = newTags.pop();`, + `var chunkModuleIds = loadCssChunkData(${RuntimeGlobals.moduleFactories}, info[1], info[0]);`, + `chunkModuleIds.forEach(${runtimeTemplate.expressionFunction( + "moduleIds.push(id)", + "id" + )});` + ]), + "}", + "return moduleIds;" + ])} };` + ])}`, + `var cssTextKey = ${runtimeTemplate.returningFunction( + `Array.from(link.sheet.cssRules, ${runtimeTemplate.returningFunction( + "r.cssText", + "r" + )}).join()`, + "link" + )}`, + `${ + RuntimeGlobals.hmrDownloadUpdateHandlers + }.css = ${runtimeTemplate.basicFunction( + "chunkIds, removedChunks, removedModules, promises, applyHandlers, updatedModulesList", + [ + "applyHandlers.push(applyHandler);", + `chunkIds.forEach(${runtimeTemplate.basicFunction("chunkId", [ + `var filename = ${RuntimeGlobals.getChunkCssFilename}(chunkId);`, + `var url = ${RuntimeGlobals.publicPath} + filename;`, + "var oldTag = loadStylesheet(chunkId, url);", + "if(!oldTag) return;", + `promises.push(new Promise(${runtimeTemplate.basicFunction( + "resolve, reject", + [ + `var link = loadStylesheet(chunkId, url + (url.indexOf("?") < 0 ? "?" : "&") + "hmr=" + Date.now(), ${runtimeTemplate.basicFunction( + "event", + [ + 'if(event.type !== "load") {', + Template.indent([ + "var errorType = event && event.type;", + "var realSrc = event && event.target && event.target.src;", + "error.message = 'Loading css hot update chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", + "error.name = 'ChunkLoadError';", + "error.type = errorType;", + "error.request = realSrc;", + "reject(error);" + ]), + "} else {", + Template.indent([ + "try { if(cssTextKey(oldTag) == cssTextKey(link)) { if(link.parentNode) link.parentNode.removeChild(link); return resolve(); } } catch(e) {}", + "var factories = {};", + "loadCssChunkData(factories, link, chunkId);", + `Object.keys(factories).forEach(${runtimeTemplate.expressionFunction( + "updatedModulesList.push(id)", + "id" + )})`, + "link.sheet.disabled = true;", + "oldTags.push(oldTag);", + "newTags.push([chunkId, link]);", + "resolve();" + ]), + "}" + ] + )}, oldTag);` + ] + )}));` + ])});` + ] + )}` + ]) + : "// no hmr" + ]); } } -makeSerializable( - PackContentItems, - "webpack/lib/cache/PackFileCacheStrategy", - "PackContentItems" -); +module.exports = CssLoadingRuntimeModule; -class PackContent { - /* - This class can be in these states: - | this.lazy | this.content | this.outdated | state - A1 | undefined | Map | false | fresh content - A2 | undefined | Map | true | (will not happen) - B1 | lazy () => {} | undefined | false | not deserialized - B2 | lazy () => {} | undefined | true | not deserialized, but some items has been removed - C1 | lazy* () => {} | Map | false | deserialized - C2 | lazy* () => {} | Map | true | deserialized, and some items has been removed - this.used is a subset of this.items. - this.items is a subset of this.content.keys() resp. this.lazy().map.keys() - When this.outdated === false, this.items === this.content.keys() resp. this.lazy().map.keys() - When this.outdated === true, this.items should be used to recreated this.lazy/this.content. - When this.lazy and this.content is set, they contain the same data. - this.get must only be called with a valid item from this.items. - In state C this.lazy is unMemoized - */ +/***/ }), - /** - * @param {Set} items keys - * @param {Set} usedItems used keys - * @param {PackContentItems | function(): Promise} dataOrFn sync or async content - * @param {Logger=} logger logger for logging - * @param {string=} lazyName name of dataOrFn for logging - */ - constructor(items, usedItems, dataOrFn, logger, lazyName) { - this.items = items; - /** @type {function(): Promise | PackContentItems} */ - this.lazy = typeof dataOrFn === "function" ? dataOrFn : undefined; - /** @type {Map} */ - this.content = typeof dataOrFn === "function" ? undefined : dataOrFn.map; - this.outdated = false; - this.used = usedItems; - this.logger = logger; - this.lazyName = lazyName; - } +/***/ 47283: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - get(identifier) { - this.used.add(identifier); - if (this.content) { - return this.content.get(identifier); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // We are in state B - const { lazyName } = this; - let timeMessage; - if (lazyName) { - // only log once - this.lazyName = undefined; - timeMessage = `restore cache content ${lazyName} (${formatSize( - this.getSize() - )})`; - this.logger.log( - `starting to restore cache content ${lazyName} (${formatSize( - this.getSize() - )}) because of request to: ${identifier}` - ); - this.logger.time(timeMessage); - } - const value = this.lazy(); - if ("then" in value) { - return value.then(data => { - const map = data.map; - if (timeMessage) { - this.logger.timeEnd(timeMessage); - } - // Move to state C - this.content = map; - this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy); - return map.get(identifier); - }); - } else { - const map = value.map; - if (timeMessage) { - this.logger.timeEnd(timeMessage); - } - // Move to state C - this.content = map; - this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy); - return map.get(identifier); - } - } - /** - * @param {string} reason explanation why unpack is necessary - * @returns {void | Promise} maybe a promise if lazy - */ - unpack(reason) { - if (this.content) return; - // Move from state B to C - if (this.lazy) { - const { lazyName } = this; - let timeMessage; - if (lazyName) { - // only log once - this.lazyName = undefined; - timeMessage = `unpack cache content ${lazyName} (${formatSize( - this.getSize() - )})`; - this.logger.log( - `starting to unpack cache content ${lazyName} (${formatSize( - this.getSize() - )}) because ${reason}` - ); - this.logger.time(timeMessage); - } - const value = this.lazy(); - if ("then" in value) { - return value.then(data => { - if (timeMessage) { - this.logger.timeEnd(timeMessage); - } - this.content = data.map; - }); - } else { - if (timeMessage) { - this.logger.timeEnd(timeMessage); - } - this.content = value.map; - } - } +const { ConcatSource } = __webpack_require__(51255); +const HotUpdateChunk = __webpack_require__(9597); +const RuntimeGlobals = __webpack_require__(16475); +const SelfModuleFactory = __webpack_require__(63560); +const CssExportDependency = __webpack_require__(76760); +const CssImportDependency = __webpack_require__(90542); +const CssLocalIdentifierDependency = __webpack_require__(92328); +const CssSelfLocalIdentifierDependency = __webpack_require__(29094); +const CssUrlDependency = __webpack_require__(70749); +const StaticExportsDependency = __webpack_require__(91418); +const { compareModulesByIdentifier } = __webpack_require__(29579); +const createSchemaValidation = __webpack_require__(32540); +const createHash = __webpack_require__(49835); +const memoize = __webpack_require__(78676); +const nonNumericOnlyHash = __webpack_require__(55668); +const CssExportsGenerator = __webpack_require__(91254); +const CssGenerator = __webpack_require__(46061); +const CssParser = __webpack_require__(98305); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").CssExperimentOptions} CssExperimentOptions */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ + +const getCssLoadingRuntimeModule = memoize(() => + __webpack_require__(80806) +); + +const getSchema = name => { + const { definitions } = __webpack_require__(73342); + return { + definitions, + oneOf: [{ $ref: `#/definitions/${name}` }] + }; +}; + +const validateGeneratorOptions = createSchemaValidation( + __webpack_require__(59170), + () => getSchema("CssGeneratorOptions"), + { + name: "Css Modules Plugin", + baseDataPath: "parser" + } +); +const validateParserOptions = createSchemaValidation( + __webpack_require__(38542), + () => getSchema("CssParserOptions"), + { + name: "Css Modules Plugin", + baseDataPath: "parser" } +); + +const escapeCss = (str, omitOptionalUnderscore) => { + const escaped = `${str}`.replace( + // cspell:word uffff + /[^a-zA-Z0-9_\u0081-\uffff-]/g, + s => `\\${s}` + ); + return !omitOptionalUnderscore && /^(?!--)[0-9_-]/.test(escaped) + ? `_${escaped}` + : escaped; +}; + +const plugin = "CssModulesPlugin"; +class CssModulesPlugin { /** - * @returns {number} size of the content or -1 if not known + * @param {CssExperimentOptions} options options */ - getSize() { - if (!this.lazy) return -1; - const options = /** @type {any} */ (this.lazy).options; - if (!options) return -1; - const size = options.size; - if (typeof size !== "number") return -1; - return size; - } - - delete(identifier) { - this.items.delete(identifier); - this.used.delete(identifier); - this.outdated = true; + constructor({ exportsOnly = false }) { + this._exportsOnly = exportsOnly; } - /** - * @template T - * @param {function(any): function(): Promise | PackContentItems} write write function + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - writeLazy(write) { - if (!this.outdated && this.lazy) { - // State B1 or C1 - // this.lazy is still the valid deserialized version - write(this.lazy); - return; - } - if (!this.outdated && this.content) { - // State A1 - const map = new Map(this.content); - // Move to state C1 - this.lazy = SerializerMiddleware.unMemoizeLazy( - write(() => new PackContentItems(map)) - ); - return; - } - if (this.content) { - // State A2 or C2 - /** @type {Map} */ - const map = new Map(); - for (const item of this.items) { - map.set(item, this.content.get(item)); - } - // Move to state C1 - this.outdated = false; - this.content = map; - this.lazy = SerializerMiddleware.unMemoizeLazy( - write(() => new PackContentItems(map)) - ); - return; - } - // State B2 - const { lazyName } = this; - let timeMessage; - if (lazyName) { - // only log once - this.lazyName = undefined; - timeMessage = `unpack cache content ${lazyName} (${formatSize( - this.getSize() - )})`; - this.logger.log( - `starting to unpack cache content ${lazyName} (${formatSize( - this.getSize() - )}) because it's outdated and need to be serialized` - ); - this.logger.time(timeMessage); - } - const value = this.lazy(); - this.outdated = false; - if ("then" in value) { - // Move to state B1 - this.lazy = write(() => - value.then(data => { - if (timeMessage) { - this.logger.timeEnd(timeMessage); + apply(compiler) { + compiler.hooks.compilation.tap( + plugin, + (compilation, { normalModuleFactory }) => { + const selfFactory = new SelfModuleFactory(compilation.moduleGraph); + compilation.dependencyFactories.set( + CssUrlDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + CssUrlDependency, + new CssUrlDependency.Template() + ); + compilation.dependencyTemplates.set( + CssLocalIdentifierDependency, + new CssLocalIdentifierDependency.Template() + ); + compilation.dependencyFactories.set( + CssSelfLocalIdentifierDependency, + selfFactory + ); + compilation.dependencyTemplates.set( + CssSelfLocalIdentifierDependency, + new CssSelfLocalIdentifierDependency.Template() + ); + compilation.dependencyTemplates.set( + CssExportDependency, + new CssExportDependency.Template() + ); + compilation.dependencyFactories.set( + CssImportDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + CssImportDependency, + new CssImportDependency.Template() + ); + compilation.dependencyTemplates.set( + StaticExportsDependency, + new StaticExportsDependency.Template() + ); + normalModuleFactory.hooks.createParser + .for("css") + .tap(plugin, parserOptions => { + validateParserOptions(parserOptions); + return new CssParser(); + }); + normalModuleFactory.hooks.createParser + .for("css/global") + .tap(plugin, parserOptions => { + validateParserOptions(parserOptions); + return new CssParser({ + allowPseudoBlocks: false, + allowModeSwitch: false + }); + }); + normalModuleFactory.hooks.createParser + .for("css/module") + .tap(plugin, parserOptions => { + validateParserOptions(parserOptions); + return new CssParser({ + defaultMode: "local" + }); + }); + normalModuleFactory.hooks.createGenerator + .for("css") + .tap(plugin, generatorOptions => { + validateGeneratorOptions(generatorOptions); + return this._exportsOnly + ? new CssExportsGenerator() + : new CssGenerator(); + }); + normalModuleFactory.hooks.createGenerator + .for("css/global") + .tap(plugin, generatorOptions => { + validateGeneratorOptions(generatorOptions); + return this._exportsOnly + ? new CssExportsGenerator() + : new CssGenerator(); + }); + normalModuleFactory.hooks.createGenerator + .for("css/module") + .tap(plugin, generatorOptions => { + validateGeneratorOptions(generatorOptions); + return this._exportsOnly + ? new CssExportsGenerator() + : new CssGenerator(); + }); + const orderedCssModulesPerChunk = new WeakMap(); + compilation.hooks.afterCodeGeneration.tap("CssModulesPlugin", () => { + const { chunkGraph } = compilation; + for (const chunk of compilation.chunks) { + if (CssModulesPlugin.chunkHasCss(chunk, chunkGraph)) { + orderedCssModulesPerChunk.set( + chunk, + this.getOrderedChunkCssModules(chunk, chunkGraph, compilation) + ); + } } - const oldMap = data.map; - /** @type {Map} */ - const map = new Map(); - for (const item of this.items) { - map.set(item, oldMap.get(item)); + }); + compilation.hooks.contentHash.tap("CssModulesPlugin", chunk => { + const { + chunkGraph, + outputOptions: { + hashSalt, + hashDigest, + hashDigestLength, + hashFunction + } + } = compilation; + const modules = orderedCssModulesPerChunk.get(chunk); + if (modules === undefined) return; + const hash = createHash(hashFunction); + if (hashSalt) hash.update(hashSalt); + for (const module of modules) { + hash.update(chunkGraph.getModuleHash(module, chunk.runtime)); } - // Move to state C1 (or maybe C2) - this.content = map; - this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy); + const digest = /** @type {string} */ (hash.digest(hashDigest)); + chunk.contentHash.css = nonNumericOnlyHash(digest, hashDigestLength); + }); + compilation.hooks.renderManifest.tap(plugin, (result, options) => { + const { chunkGraph } = compilation; + const { hash, chunk, codeGenerationResults } = options; - return new PackContentItems(map); - }) - ); - } else { - // Move to state C1 - if (timeMessage) { - this.logger.timeEnd(timeMessage); - } - const oldMap = value.map; - /** @type {Map} */ - const map = new Map(); - for (const item of this.items) { - map.set(item, oldMap.get(item)); - } - this.content = map; - this.lazy = write(() => new PackContentItems(map)); - } - } -} + if (chunk instanceof HotUpdateChunk) return result; -const allowCollectingMemory = buf => { - const wasted = buf.buffer.byteLength - buf.byteLength; - if (wasted > 8192 && (wasted > 1048576 || wasted > buf.byteLength)) { - return Buffer.from(buf); - } - return buf; -}; + const modules = orderedCssModulesPerChunk.get(chunk); + if (modules !== undefined) { + result.push({ + render: () => + this.renderChunk({ + chunk, + chunkGraph, + codeGenerationResults, + uniqueName: compilation.outputOptions.uniqueName, + modules + }), + filenameTemplate: CssModulesPlugin.getChunkFilenameTemplate( + chunk, + compilation.outputOptions + ), + pathOptions: { + hash, + runtime: chunk.runtime, + chunk, + contentHashType: "css" + }, + identifier: `css${chunk.id}`, + hash: chunk.contentHash.css + }); + } + return result; + }); + const enabledChunks = new WeakSet(); + const handler = (chunk, set) => { + if (enabledChunks.has(chunk)) { + return; + } + enabledChunks.add(chunk); -class PackFileCacheStrategy { - /** - * @param {Object} options options - * @param {Compiler} options.compiler the compiler - * @param {IntermediateFileSystem} options.fs the filesystem - * @param {string} options.context the context directory - * @param {string} options.cacheLocation the location of the cache data - * @param {string} options.version version identifier - * @param {Logger} options.logger a logger - * @param {SnapshotOptions} options.snapshot options regarding snapshotting - * @param {number} options.maxAge max age of cache items - * @param {boolean} options.profile track and log detailed timing information for individual cache items - * @param {boolean} options.allowCollectingMemory allow to collect unused memory created during deserialization - * @param {false | "gzip" | "brotli"} options.compression compression used - */ - constructor({ - compiler, - fs, - context, - cacheLocation, - version, - logger, - snapshot, - maxAge, - profile, - allowCollectingMemory, - compression - }) { - this.fileSerializer = createFileSerializer( - fs, - compiler.options.output.hashFunction + set.add(RuntimeGlobals.publicPath); + set.add(RuntimeGlobals.getChunkCssFilename); + set.add(RuntimeGlobals.hasOwnProperty); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + set.add(RuntimeGlobals.makeNamespaceObject); + + const CssLoadingRuntimeModule = getCssLoadingRuntimeModule(); + compilation.addRuntimeModule(chunk, new CssLoadingRuntimeModule(set)); + }; + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hasCssModules) + .tap(plugin, handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap(plugin, handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadUpdateHandlers) + .tap(plugin, handler); + } ); - this.fileSystemInfo = new FileSystemInfo(fs, { - managedPaths: snapshot.managedPaths, - immutablePaths: snapshot.immutablePaths, - logger: logger.getChildLogger("webpack.FileSystemInfo"), - hashFunction: compiler.options.output.hashFunction - }); - this.compiler = compiler; - this.context = context; - this.cacheLocation = cacheLocation; - this.version = version; - this.logger = logger; - this.maxAge = maxAge; - this.profile = profile; - this.allowCollectingMemory = allowCollectingMemory; - this.compression = compression; - this._extension = - compression === "brotli" - ? ".pack.br" - : compression === "gzip" - ? ".pack.gz" - : ".pack"; - this.snapshot = snapshot; - /** @type {Set} */ - this.buildDependencies = new Set(); - /** @type {LazySet} */ - this.newBuildDependencies = new LazySet(); - /** @type {Snapshot} */ - this.resolveBuildDependenciesSnapshot = undefined; - /** @type {Map} */ - this.resolveResults = undefined; - /** @type {Snapshot} */ - this.buildSnapshot = undefined; - /** @type {Promise} */ - this.packPromise = this._openPack(); - this.storePromise = Promise.resolve(); } - _getPack() { - if (this.packPromise === undefined) { - this.packPromise = this.storePromise.then(() => this._openPack()); - } - return this.packPromise; - } + getModulesInOrder(chunk, modules, compilation) { + if (!modules) return []; - /** - * @returns {Promise} the pack - */ - _openPack() { - const { logger, profile, cacheLocation, version } = this; - /** @type {Snapshot} */ - let buildSnapshot; - /** @type {Set} */ - let buildDependencies; - /** @type {Set} */ - let newBuildDependencies; - /** @type {Snapshot} */ - let resolveBuildDependenciesSnapshot; - /** @type {Map} */ - let resolveResults; - logger.time("restore cache container"); - return this.fileSerializer - .deserialize(null, { - filename: `${cacheLocation}/index${this._extension}`, - extension: `${this._extension}`, - logger, - profile, - retainedBuffer: this.allowCollectingMemory - ? allowCollectingMemory - : undefined - }) - .catch(err => { - if (err.code !== "ENOENT") { - logger.warn( - `Restoring pack failed from ${cacheLocation}${this._extension}: ${err}` - ); - logger.debug(err.stack); - } else { - logger.debug( - `No pack exists at ${cacheLocation}${this._extension}: ${err}` - ); - } - return undefined; - }) - .then(packContainer => { - logger.timeEnd("restore cache container"); - if (!packContainer) return undefined; - if (!(packContainer instanceof PackContainer)) { - logger.warn( - `Restored pack from ${cacheLocation}${this._extension}, but contained content is unexpected.`, - packContainer - ); - return undefined; + const modulesList = [...modules]; + + // Get ordered list of modules per chunk group + // Lists are in reverse order to allow to use Array.pop() + const modulesByChunkGroup = Array.from(chunk.groupsIterable, chunkGroup => { + const sortedModules = modulesList + .map(module => { + return { + module, + index: chunkGroup.getModulePostOrderIndex(module) + }; + }) + .filter(item => item.index !== undefined) + .sort((a, b) => b.index - a.index) + .map(item => item.module); + + return { list: sortedModules, set: new Set(sortedModules) }; + }); + + if (modulesByChunkGroup.length === 1) + return modulesByChunkGroup[0].list.reverse(); + + const compareModuleLists = ({ list: a }, { list: b }) => { + if (a.length === 0) { + return b.length === 0 ? 0 : 1; + } else { + if (b.length === 0) return -1; + return compareModulesByIdentifier(a[a.length - 1], b[b.length - 1]); + } + }; + + modulesByChunkGroup.sort(compareModuleLists); + + const finalModules = []; + + for (;;) { + const failedModules = new Set(); + const list = modulesByChunkGroup[0].list; + if (list.length === 0) { + // done, everything empty + break; + } + let selectedModule = list[list.length - 1]; + let hasFailed = undefined; + outer: for (;;) { + for (const { list, set } of modulesByChunkGroup) { + if (list.length === 0) continue; + const lastModule = list[list.length - 1]; + if (lastModule === selectedModule) continue; + if (!set.has(selectedModule)) continue; + failedModules.add(selectedModule); + if (failedModules.has(lastModule)) { + // There is a conflict, try other alternatives + hasFailed = lastModule; + continue; + } + selectedModule = lastModule; + hasFailed = false; + continue outer; // restart } - if (packContainer.version !== version) { - logger.log( - `Restored pack from ${cacheLocation}${this._extension}, but version doesn't match.` + break; + } + if (hasFailed) { + // There is a not resolve-able conflict with the selectedModule + if (compilation) { + // TODO print better warning + compilation.warnings.push( + new Error( + `chunk ${ + chunk.name || chunk.id + }\nConflicting order between ${hasFailed.readableIdentifier( + compilation.requestShortener + )} and ${selectedModule.readableIdentifier( + compilation.requestShortener + )}` + ) ); - return undefined; } - logger.time("check build dependencies"); - return Promise.all([ - new Promise((resolve, reject) => { - this.fileSystemInfo.checkSnapshotValid( - packContainer.buildSnapshot, - (err, valid) => { - if (err) { - logger.log( - `Restored pack from ${cacheLocation}${this._extension}, but checking snapshot of build dependencies errored: ${err}.` - ); - logger.debug(err.stack); - return resolve(false); - } - if (!valid) { - logger.log( - `Restored pack from ${cacheLocation}${this._extension}, but build dependencies have changed.` - ); - return resolve(false); - } - buildSnapshot = packContainer.buildSnapshot; - return resolve(true); - } - ); - }), - new Promise((resolve, reject) => { - this.fileSystemInfo.checkSnapshotValid( - packContainer.resolveBuildDependenciesSnapshot, - (err, valid) => { - if (err) { - logger.log( - `Restored pack from ${cacheLocation}${this._extension}, but checking snapshot of resolving of build dependencies errored: ${err}.` - ); - logger.debug(err.stack); - return resolve(false); - } - if (valid) { - resolveBuildDependenciesSnapshot = - packContainer.resolveBuildDependenciesSnapshot; - buildDependencies = packContainer.buildDependencies; - resolveResults = packContainer.resolveResults; - return resolve(true); - } - logger.log( - "resolving of build dependencies is invalid, will re-resolve build dependencies" - ); - this.fileSystemInfo.checkResolveResultsValid( - packContainer.resolveResults, - (err, valid) => { - if (err) { - logger.log( - `Restored pack from ${cacheLocation}${this._extension}, but resolving of build dependencies errored: ${err}.` - ); - logger.debug(err.stack); - return resolve(false); - } - if (valid) { - newBuildDependencies = packContainer.buildDependencies; - resolveResults = packContainer.resolveResults; - return resolve(true); - } - logger.log( - `Restored pack from ${cacheLocation}${this._extension}, but build dependencies resolve to different locations.` - ); - return resolve(false); - } - ); - } - ); - }) - ]) - .catch(err => { - logger.timeEnd("check build dependencies"); - throw err; - }) - .then(([buildSnapshotValid, resolveValid]) => { - logger.timeEnd("check build dependencies"); - if (buildSnapshotValid && resolveValid) { - logger.time("restore cache content metadata"); - const d = packContainer.data(); - logger.timeEnd("restore cache content metadata"); - return d; - } - return undefined; - }); - }) - .then(pack => { - if (pack) { - pack.maxAge = this.maxAge; - this.buildSnapshot = buildSnapshot; - if (buildDependencies) this.buildDependencies = buildDependencies; - if (newBuildDependencies) - this.newBuildDependencies.addAll(newBuildDependencies); - this.resolveResults = resolveResults; - this.resolveBuildDependenciesSnapshot = - resolveBuildDependenciesSnapshot; - return pack; + selectedModule = hasFailed; + } + // Insert the selected module into the final modules list + finalModules.push(selectedModule); + // Remove the selected module from all lists + for (const { list, set } of modulesByChunkGroup) { + const lastModule = list[list.length - 1]; + if (lastModule === selectedModule) list.pop(); + else if (hasFailed && set.has(selectedModule)) { + const idx = list.indexOf(selectedModule); + if (idx >= 0) list.splice(idx, 1); } - return new Pack(logger, this.maxAge); - }) - .catch(err => { - this.logger.warn( - `Restoring pack from ${cacheLocation}${this._extension} failed: ${err}` - ); - this.logger.debug(err.stack); - return new Pack(logger, this.maxAge); - }); + } + modulesByChunkGroup.sort(compareModuleLists); + } + return finalModules; } - /** - * @param {string} identifier unique name for the resource - * @param {Etag | null} etag etag of the resource - * @param {any} data cached content - * @returns {Promise} promise - */ - store(identifier, etag, data) { - return this._getPack().then(pack => { - pack.set(identifier, etag === null ? null : etag.toString(), data); - }); + getOrderedChunkCssModules(chunk, chunkGraph, compilation) { + return [ + ...this.getModulesInOrder( + chunk, + chunkGraph.getOrderedChunkModulesIterableBySourceType( + chunk, + "css-import", + compareModulesByIdentifier + ), + compilation + ), + ...this.getModulesInOrder( + chunk, + chunkGraph.getOrderedChunkModulesIterableBySourceType( + chunk, + "css", + compareModulesByIdentifier + ), + compilation + ) + ]; } - /** - * @param {string} identifier unique name for the resource - * @param {Etag | null} etag etag of the resource - * @returns {Promise} promise to the cached content - */ - restore(identifier, etag) { - return this._getPack() - .then(pack => - pack.get(identifier, etag === null ? null : etag.toString()) - ) - .catch(err => { - if (err && err.code !== "ENOENT") { - this.logger.warn( - `Restoring failed for ${identifier} from pack: ${err}` - ); - this.logger.debug(err.stack); + renderChunk({ + uniqueName, + chunk, + chunkGraph, + codeGenerationResults, + modules + }) { + const source = new ConcatSource(); + const metaData = []; + for (const module of modules) { + try { + const codeGenResult = codeGenerationResults.get(module, chunk.runtime); + + const s = + codeGenResult.sources.get("css") || + codeGenResult.sources.get("css-import"); + if (s) { + source.add(s); + source.add("\n"); } - }); + const exports = + codeGenResult.data && codeGenResult.data.get("css-exports"); + const moduleId = chunkGraph.getModuleId(module) + ""; + metaData.push( + `${ + exports + ? Array.from(exports, ([n, v]) => { + const shortcutValue = `${ + uniqueName ? uniqueName + "-" : "" + }${moduleId}-${n}`; + return v === shortcutValue + ? `${escapeCss(n)}/` + : v === "--" + shortcutValue + ? `${escapeCss(n)}%` + : `${escapeCss(n)}(${escapeCss(v)})`; + }).join("") + : "" + }${escapeCss(moduleId)}` + ); + } catch (e) { + e.message += `\nduring rendering of css ${module.identifier()}`; + throw e; + } + } + source.add( + `head{--webpack-${escapeCss( + (uniqueName ? uniqueName + "-" : "") + chunk.id, + true + )}:${metaData.join(",")};}` + ); + return source; } - storeBuildDependencies(dependencies) { - this.newBuildDependencies.addAll(dependencies); + static getChunkFilenameTemplate(chunk, outputOptions) { + if (chunk.cssFilenameTemplate) { + return chunk.cssFilenameTemplate; + } else if (chunk.canBeInitial()) { + return outputOptions.cssFilename; + } else { + return outputOptions.cssChunkFilename; + } } - afterAllStored() { - const packPromise = this.packPromise; - if (packPromise === undefined) return Promise.resolve(); - const reportProgress = ProgressPlugin.getReporter(this.compiler); - return (this.storePromise = packPromise - .then(pack => { - pack.stopCapturingRequests(); - if (!pack.invalid) return; - this.packPromise = undefined; - this.logger.log(`Storing pack...`); - let promise; - const newBuildDependencies = new Set(); - for (const dep of this.newBuildDependencies) { - if (!this.buildDependencies.has(dep)) { - newBuildDependencies.add(dep); - } - } - if (newBuildDependencies.size > 0 || !this.buildSnapshot) { - if (reportProgress) reportProgress(0.5, "resolve build dependencies"); - this.logger.debug( - `Capturing build dependencies... (${Array.from( - newBuildDependencies - ).join(", ")})` - ); - promise = new Promise((resolve, reject) => { - this.logger.time("resolve build dependencies"); - this.fileSystemInfo.resolveBuildDependencies( - this.context, - newBuildDependencies, - (err, result) => { - this.logger.timeEnd("resolve build dependencies"); - if (err) return reject(err); + static chunkHasCss(chunk, chunkGraph) { + return ( + !!chunkGraph.getChunkModulesIterableBySourceType(chunk, "css") || + !!chunkGraph.getChunkModulesIterableBySourceType(chunk, "css-import") + ); + } +} - this.logger.time("snapshot build dependencies"); - const { - files, - directories, - missing, - resolveResults, - resolveDependencies - } = result; - if (this.resolveResults) { - for (const [key, value] of resolveResults) { - this.resolveResults.set(key, value); - } - } else { - this.resolveResults = resolveResults; - } - if (reportProgress) { - reportProgress( - 0.6, - "snapshot build dependencies", - "resolving" - ); - } - this.fileSystemInfo.createSnapshot( - undefined, - resolveDependencies.files, - resolveDependencies.directories, - resolveDependencies.missing, - this.snapshot.resolveBuildDependencies, - (err, snapshot) => { - if (err) { - this.logger.timeEnd("snapshot build dependencies"); - return reject(err); - } - if (!snapshot) { - this.logger.timeEnd("snapshot build dependencies"); - return reject( - new Error("Unable to snapshot resolve dependencies") - ); - } - if (this.resolveBuildDependenciesSnapshot) { - this.resolveBuildDependenciesSnapshot = - this.fileSystemInfo.mergeSnapshots( - this.resolveBuildDependenciesSnapshot, - snapshot - ); - } else { - this.resolveBuildDependenciesSnapshot = snapshot; - } - if (reportProgress) { - reportProgress( - 0.7, - "snapshot build dependencies", - "modules" - ); - } - this.fileSystemInfo.createSnapshot( - undefined, - files, - directories, - missing, - this.snapshot.buildDependencies, - (err, snapshot) => { - this.logger.timeEnd("snapshot build dependencies"); - if (err) return reject(err); - if (!snapshot) { - return reject( - new Error("Unable to snapshot build dependencies") - ); - } - this.logger.debug("Captured build dependencies"); - - if (this.buildSnapshot) { - this.buildSnapshot = - this.fileSystemInfo.mergeSnapshots( - this.buildSnapshot, - snapshot - ); - } else { - this.buildSnapshot = snapshot; - } - - resolve(); - } - ); - } - ); - } - ); - }); - } else { - promise = Promise.resolve(); - } - return promise.then(() => { - if (reportProgress) reportProgress(0.8, "serialize pack"); - this.logger.time(`store pack`); - const updatedBuildDependencies = new Set(this.buildDependencies); - for (const dep of newBuildDependencies) { - updatedBuildDependencies.add(dep); - } - const content = new PackContainer( - pack, - this.version, - this.buildSnapshot, - updatedBuildDependencies, - this.resolveResults, - this.resolveBuildDependenciesSnapshot - ); - return this.fileSerializer - .serialize(content, { - filename: `${this.cacheLocation}/index${this._extension}`, - extension: `${this._extension}`, - logger: this.logger, - profile: this.profile - }) - .then(() => { - for (const dep of newBuildDependencies) { - this.buildDependencies.add(dep); - } - this.newBuildDependencies.clear(); - this.logger.timeEnd(`store pack`); - const stats = pack.getContentStats(); - this.logger.log( - "Stored pack (%d items, %d files, %d MiB)", - pack.itemInfo.size, - stats.count, - Math.round(stats.size / 1024 / 1024) - ); - }) - .catch(err => { - this.logger.timeEnd(`store pack`); - this.logger.warn(`Caching failed for pack: ${err}`); - this.logger.debug(err.stack); - }); - }); - }) - .catch(err => { - this.logger.warn(`Caching failed for pack: ${err}`); - this.logger.debug(err.stack); - })); - } - - clear() { - this.fileSystemInfo.clear(); - this.buildDependencies.clear(); - this.newBuildDependencies.clear(); - this.resolveBuildDependenciesSnapshot = undefined; - this.resolveResults = undefined; - this.buildSnapshot = undefined; - this.packPromise = undefined; - } -} - -module.exports = PackFileCacheStrategy; +module.exports = CssModulesPlugin; /***/ }), -/***/ 97347: +/***/ 98305: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -69821,2791 +69029,1981 @@ module.exports = PackFileCacheStrategy; -const LazySet = __webpack_require__(38938); -const makeSerializable = __webpack_require__(33032); - -/** @typedef {import("enhanced-resolve/lib/Resolver")} Resolver */ -/** @typedef {import("../CacheFacade").ItemCacheFacade} ItemCacheFacade */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../FileSystemInfo")} FileSystemInfo */ -/** @typedef {import("../FileSystemInfo").Snapshot} Snapshot */ - -class CacheEntry { - constructor(result, snapshot) { - this.result = result; - this.snapshot = snapshot; - } - - serialize({ write }) { - write(this.result); - write(this.snapshot); - } +const Parser = __webpack_require__(11715); +const ConstDependency = __webpack_require__(76911); +const CssExportDependency = __webpack_require__(76760); +const CssImportDependency = __webpack_require__(90542); +const CssLocalIdentifierDependency = __webpack_require__(92328); +const CssSelfLocalIdentifierDependency = __webpack_require__(29094); +const CssUrlDependency = __webpack_require__(70749); +const StaticExportsDependency = __webpack_require__(91418); +const walkCssTokens = __webpack_require__(44124); - deserialize({ read }) { - this.result = read(); - this.snapshot = read(); - } -} +/** @typedef {import("../Parser").ParserState} ParserState */ +/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ -makeSerializable(CacheEntry, "webpack/lib/cache/ResolverCachePlugin"); +const CC_LEFT_CURLY = "{".charCodeAt(0); +const CC_RIGHT_CURLY = "}".charCodeAt(0); +const CC_COLON = ":".charCodeAt(0); +const CC_SLASH = "/".charCodeAt(0); +const CC_SEMICOLON = ";".charCodeAt(0); -/** - * @template T - * @param {Set | LazySet} set set to add items to - * @param {Set | LazySet} otherSet set to add items from - * @returns {void} - */ -const addAllToSet = (set, otherSet) => { - if (set instanceof LazySet) { - set.addAll(otherSet); - } else { - for (const item of otherSet) { - set.add(item); +const cssUnescape = str => { + return str.replace(/\\([0-9a-fA-F]{1,6}[ \t\n\r\f]?|[\s\S])/g, match => { + if (match.length > 2) { + return String.fromCharCode(parseInt(match.slice(1).trim(), 16)); + } else { + return match[1]; } - } + }); }; -/** - * @param {Object} object an object - * @param {boolean} excludeContext if true, context is not included in string - * @returns {string} stringified version - */ -const objectToString = (object, excludeContext) => { - let str = ""; - for (const key in object) { - if (excludeContext && key === "context") continue; - const value = object[key]; - if (typeof value === "object" && value !== null) { - str += `|${key}=[${objectToString(value, false)}|]`; - } else { - str += `|${key}=|${value}`; - } +class LocConverter { + constructor(input) { + this._input = input; + this.line = 1; + this.column = 0; + this.pos = 0; } - return str; -}; -class ResolverCachePlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const cache = compiler.getCache("ResolverCachePlugin"); - /** @type {FileSystemInfo} */ - let fileSystemInfo; - let snapshotOptions; - let realResolves = 0; - let cachedResolves = 0; - let cacheInvalidResolves = 0; - let concurrentResolves = 0; - compiler.hooks.thisCompilation.tap("ResolverCachePlugin", compilation => { - snapshotOptions = compilation.options.snapshot.resolve; - fileSystemInfo = compilation.fileSystemInfo; - compilation.hooks.finishModules.tap("ResolverCachePlugin", () => { - if (realResolves + cachedResolves > 0) { - const logger = compilation.getLogger("webpack.ResolverCachePlugin"); - logger.log( - `${Math.round( - (100 * realResolves) / (realResolves + cachedResolves) - )}% really resolved (${realResolves} real resolves with ${cacheInvalidResolves} cached but invalid, ${cachedResolves} cached valid, ${concurrentResolves} concurrent)` - ); - realResolves = 0; - cachedResolves = 0; - cacheInvalidResolves = 0; - concurrentResolves = 0; - } - }); - }); - /** - * @param {ItemCacheFacade} itemCache cache - * @param {Resolver} resolver the resolver - * @param {Object} resolveContext context for resolving meta info - * @param {Object} request the request info object - * @param {function((Error | null)=, Object=): void} callback callback function - * @returns {void} - */ - const doRealResolve = ( - itemCache, - resolver, - resolveContext, - request, - callback - ) => { - realResolves++; - const newRequest = { - _ResolverCachePluginCacheMiss: true, - ...request - }; - const newResolveContext = { - ...resolveContext, - stack: new Set(), - missingDependencies: new LazySet(), - fileDependencies: new LazySet(), - contextDependencies: new LazySet() - }; - const propagate = key => { - if (resolveContext[key]) { - addAllToSet(resolveContext[key], newResolveContext[key]); + get(pos) { + if (this.pos !== pos) { + if (this.pos < pos) { + const str = this._input.slice(this.pos, pos); + let i = str.lastIndexOf("\n"); + if (i === -1) { + this.column += str.length; + } else { + this.column = str.length - i - 1; + this.line++; + while (i > 0 && (i = str.lastIndexOf("\n", i - 1)) !== -1) + this.line++; } - }; - const resolveTime = Date.now(); - resolver.doResolve( - resolver.hooks.resolve, - newRequest, - "Cache miss", - newResolveContext, - (err, result) => { - propagate("fileDependencies"); - propagate("contextDependencies"); - propagate("missingDependencies"); - if (err) return callback(err); - const fileDependencies = newResolveContext.fileDependencies; - const contextDependencies = newResolveContext.contextDependencies; - const missingDependencies = newResolveContext.missingDependencies; - fileSystemInfo.createSnapshot( - resolveTime, - fileDependencies, - contextDependencies, - missingDependencies, - snapshotOptions, - (err, snapshot) => { - if (err) return callback(err); - if (!snapshot) { - if (result) return callback(null, result); - return callback(); - } - itemCache.store(new CacheEntry(result, snapshot), storeErr => { - if (storeErr) return callback(storeErr); - if (result) return callback(null, result); - callback(); - }); - } - ); + } else { + let i = this._input.lastIndexOf("\n", this.pos); + while (i >= pos) { + this.line--; + i = i > 0 ? this._input.lastIndexOf("\n", i - 1) : -1; } - ); - }; - compiler.resolverFactory.hooks.resolver.intercept({ - factory(type, hook) { - /** @type {Map} */ - const activeRequests = new Map(); - hook.tap( - "ResolverCachePlugin", - /** - * @param {Resolver} resolver the resolver - * @param {Object} options resolve options - * @param {Object} userOptions resolve options passed by the user - * @returns {void} - */ - (resolver, options, userOptions) => { - if (options.cache !== true) return; - const optionsIdent = objectToString(userOptions, false); - const cacheWithContext = - options.cacheWithContext !== undefined - ? options.cacheWithContext - : false; - resolver.hooks.resolve.tapAsync( - { - name: "ResolverCachePlugin", - stage: -100 - }, - (request, resolveContext, callback) => { - if (request._ResolverCachePluginCacheMiss || !fileSystemInfo) { - return callback(); - } - const identifier = `${type}${optionsIdent}${objectToString( - request, - !cacheWithContext - )}`; - const activeRequest = activeRequests.get(identifier); - if (activeRequest) { - activeRequest.push(callback); - return; - } - const itemCache = cache.getItemCache(identifier, null); - let callbacks; - const done = (err, result) => { - if (callbacks === undefined) { - callback(err, result); - callbacks = false; - } else { - for (const callback of callbacks) { - callback(err, result); - } - activeRequests.delete(identifier); - callbacks = false; - } - }; - /** - * @param {Error=} err error if any - * @param {CacheEntry=} cacheEntry cache entry - * @returns {void} - */ - const processCacheResult = (err, cacheEntry) => { - if (err) return done(err); - - if (cacheEntry) { - const { snapshot, result } = cacheEntry; - fileSystemInfo.checkSnapshotValid( - snapshot, - (err, valid) => { - if (err || !valid) { - cacheInvalidResolves++; - return doRealResolve( - itemCache, - resolver, - resolveContext, - request, - done - ); - } - cachedResolves++; - if (resolveContext.missingDependencies) { - addAllToSet( - resolveContext.missingDependencies, - snapshot.getMissingIterable() - ); - } - if (resolveContext.fileDependencies) { - addAllToSet( - resolveContext.fileDependencies, - snapshot.getFileIterable() - ); - } - if (resolveContext.contextDependencies) { - addAllToSet( - resolveContext.contextDependencies, - snapshot.getContextIterable() - ); - } - done(null, result); - } - ); - } else { - doRealResolve( - itemCache, - resolver, - resolveContext, - request, - done - ); - } - }; - itemCache.get(processCacheResult); - if (callbacks === undefined) { - callbacks = [callback]; - activeRequests.set(identifier, callbacks); - } - } - ); - } - ); - return hook; + this.column = pos - i; } - }); - } -} - -module.exports = ResolverCachePlugin; - - -/***/ }), - -/***/ 94075: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const createHash = __webpack_require__(49835); - -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {typeof import("../util/Hash")} HashConstructor */ - -/** - * @typedef {Object} HashableObject - * @property {function(Hash): void} updateHash - */ - -class LazyHashedEtag { - /** - * @param {HashableObject} obj object with updateHash method - * @param {string | HashConstructor} hashFunction the hash function to use - */ - constructor(obj, hashFunction = "md4") { - this._obj = obj; - this._hash = undefined; - this._hashFunction = hashFunction; - } - - /** - * @returns {string} hash of object - */ - toString() { - if (this._hash === undefined) { - const hash = createHash(this._hashFunction); - this._obj.updateHash(hash); - this._hash = /** @type {string} */ (hash.digest("base64")); + this.pos = pos; } - return this._hash; + return this; } } -/** @type {Map>} */ -const mapStrings = new Map(); - -/** @type {WeakMap>} */ -const mapObjects = new WeakMap(); +const CSS_MODE_TOP_LEVEL = 0; +const CSS_MODE_IN_RULE = 1; +const CSS_MODE_IN_LOCAL_RULE = 2; +const CSS_MODE_AT_IMPORT_EXPECT_URL = 3; +// TODO implement layer and supports for @import +const CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS = 4; +const CSS_MODE_AT_IMPORT_EXPECT_MEDIA = 5; +const CSS_MODE_AT_OTHER = 6; -/** - * @param {HashableObject} obj object with updateHash method - * @param {string | HashConstructor} hashFunction the hash function to use - * @returns {LazyHashedEtag} etag - */ -const getter = (obj, hashFunction = "md4") => { - let innerMap; - if (typeof hashFunction === "string") { - innerMap = mapStrings.get(hashFunction); - if (innerMap === undefined) { - const newHash = new LazyHashedEtag(obj, hashFunction); - innerMap = new WeakMap(); - innerMap.set(obj, newHash); - mapStrings.set(hashFunction, innerMap); - return newHash; - } - } else { - innerMap = mapObjects.get(hashFunction); - if (innerMap === undefined) { - const newHash = new LazyHashedEtag(obj, hashFunction); - innerMap = new WeakMap(); - innerMap.set(obj, newHash); - mapObjects.set(hashFunction, innerMap); - return newHash; - } +const explainMode = mode => { + switch (mode) { + case CSS_MODE_TOP_LEVEL: + return "parsing top level css"; + case CSS_MODE_IN_RULE: + return "parsing css rule content (global)"; + case CSS_MODE_IN_LOCAL_RULE: + return "parsing css rule content (local)"; + case CSS_MODE_AT_IMPORT_EXPECT_URL: + return "parsing @import (expecting url)"; + case CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS: + return "parsing @import (expecting optionally supports or media query)"; + case CSS_MODE_AT_IMPORT_EXPECT_MEDIA: + return "parsing @import (expecting optionally media query)"; + case CSS_MODE_AT_OTHER: + return "parsing at-rule"; + default: + return mode; } - const hash = innerMap.get(obj); - if (hash !== undefined) return hash; - const newHash = new LazyHashedEtag(obj, hashFunction); - innerMap.set(obj, newHash); - return newHash; }; -module.exports = getter; - - -/***/ }), - -/***/ 54980: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** @typedef {import("../Cache").Etag} Etag */ +class CssParser extends Parser { + constructor({ + allowPseudoBlocks = true, + allowModeSwitch = true, + defaultMode = "global" + } = {}) { + super(); + this.allowPseudoBlocks = allowPseudoBlocks; + this.allowModeSwitch = allowModeSwitch; + this.defaultMode = defaultMode; + } -class MergedEtag { /** - * @param {Etag} a first - * @param {Etag} b second + * @param {string | Buffer | PreparsedAst} source the source to parse + * @param {ParserState} state the parser state + * @returns {ParserState} the parser state */ - constructor(a, b) { - this.a = a; - this.b = b; - } + parse(source, state) { + if (Buffer.isBuffer(source)) { + source = source.toString("utf-8"); + } else if (typeof source === "object") { + throw new Error("webpackAst is unexpected for the CssParser"); + } + if (source[0] === "\ufeff") { + source = source.slice(1); + } - toString() { - return `${this.a.toString()}|${this.b.toString()}`; - } -} + const module = state.module; -const dualObjectMap = new WeakMap(); -const objectStringMap = new WeakMap(); + const declaredCssVariables = new Set(); -/** - * @param {Etag} a first - * @param {Etag} b second - * @returns {Etag} result - */ -const mergeEtags = (a, b) => { - if (typeof a === "string") { - if (typeof b === "string") { - return `${a}|${b}`; - } else { - const temp = b; - b = a; - a = temp; - } - } else { - if (typeof b !== "string") { - // both a and b are objects - let map = dualObjectMap.get(a); - if (map === undefined) { - dualObjectMap.set(a, (map = new WeakMap())); - } - const mergedEtag = map.get(b); - if (mergedEtag === undefined) { - const newMergedEtag = new MergedEtag(a, b); - map.set(b, newMergedEtag); - return newMergedEtag; - } else { - return mergedEtag; - } - } - } - // a is object, b is string - let map = objectStringMap.get(a); - if (map === undefined) { - objectStringMap.set(a, (map = new Map())); - } - const mergedEtag = map.get(b); - if (mergedEtag === undefined) { - const newMergedEtag = new MergedEtag(a, b); - map.set(b, newMergedEtag); - return newMergedEtag; - } else { - return mergedEtag; - } -}; - -module.exports = mergeEtags; - - -/***/ }), - -/***/ 13462: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const path = __webpack_require__(71017); -const webpackSchema = __webpack_require__(73342); - -// TODO add originPath to PathItem for better errors -/** - * @typedef {Object} PathItem - * @property {any} schema the part of the schema - * @property {string} path the path in the config - */ - -/** @typedef {"unknown-argument" | "unexpected-non-array-in-path" | "unexpected-non-object-in-path" | "multiple-values-unexpected" | "invalid-value"} ProblemType */ - -/** - * @typedef {Object} Problem - * @property {ProblemType} type - * @property {string} path - * @property {string} argument - * @property {any=} value - * @property {number=} index - * @property {string=} expected - */ - -/** - * @typedef {Object} LocalProblem - * @property {ProblemType} type - * @property {string} path - * @property {string=} expected - */ - -/** - * @typedef {Object} ArgumentConfig - * @property {string} description - * @property {string} [negatedDescription] - * @property {string} path - * @property {boolean} multiple - * @property {"enum"|"string"|"path"|"number"|"boolean"|"RegExp"|"reset"} type - * @property {any[]=} values - */ - -/** - * @typedef {Object} Argument - * @property {string} description - * @property {"string"|"number"|"boolean"} simpleType - * @property {boolean} multiple - * @property {ArgumentConfig[]} configs - */ - -/** - * @param {any=} schema a json schema to create arguments for (by default webpack schema is used) - * @returns {Record} object of arguments - */ -const getArguments = (schema = webpackSchema) => { - /** @type {Record} */ - const flags = {}; - - const pathToArgumentName = input => { - return input - .replace(/\./g, "-") - .replace(/\[\]/g, "") - .replace( - /(\p{Uppercase_Letter}+|\p{Lowercase_Letter}|\d)(\p{Uppercase_Letter}+)/gu, - "$1-$2" - ) - .replace(/-?[^\p{Uppercase_Letter}\p{Lowercase_Letter}\d]+/gu, "-") - .toLowerCase(); - }; - - const getSchemaPart = path => { - const newPath = path.split("/"); - - let schemaPart = schema; - - for (let i = 1; i < newPath.length; i++) { - const inner = schemaPart[newPath[i]]; - - if (!inner) { + const locConverter = new LocConverter(source); + let mode = CSS_MODE_TOP_LEVEL; + let modePos = 0; + let modeNestingLevel = 0; + let modeData = undefined; + let singleClassSelector = undefined; + let lastIdentifier = undefined; + const modeStack = []; + const isTopLevelLocal = () => + modeData === "local" || + (this.defaultMode === "local" && modeData === undefined); + const eatWhiteLine = (input, pos) => { + for (;;) { + const cc = input.charCodeAt(pos); + if (cc === 32 || cc === 9) { + pos++; + continue; + } + if (cc === 10) pos++; break; } - - schemaPart = inner; - } - - return schemaPart; - }; - - /** - * - * @param {PathItem[]} path path in the schema - * @returns {string | undefined} description - */ - const getDescription = path => { - for (const { schema } of path) { - if (schema.cli) { - if (schema.cli.helper) continue; - if (schema.cli.description) return schema.cli.description; - } - if (schema.description) return schema.description; - } - }; - - /** - * - * @param {PathItem[]} path path in the schema - * @returns {string | undefined} negative description - */ - const getNegatedDescription = path => { - for (const { schema } of path) { - if (schema.cli) { - if (schema.cli.helper) continue; - if (schema.cli.negatedDescription) return schema.cli.negatedDescription; - } - } - }; - - /** - * - * @param {PathItem[]} path path in the schema - * @returns {string | undefined} reset description - */ - const getResetDescription = path => { - for (const { schema } of path) { - if (schema.cli) { - if (schema.cli.helper) continue; - if (schema.cli.resetDescription) return schema.cli.resetDescription; - } - } - }; - - /** - * - * @param {any} schemaPart schema - * @returns {Pick} partial argument config - */ - const schemaToArgumentConfig = schemaPart => { - if (schemaPart.enum) { - return { - type: "enum", - values: schemaPart.enum - }; - } - switch (schemaPart.type) { - case "number": - return { - type: "number" - }; - case "string": - return { - type: schemaPart.absolutePath ? "path" : "string" - }; - case "boolean": - return { - type: "boolean" - }; - } - if (schemaPart.instanceof === "RegExp") { - return { - type: "RegExp" - }; - } - return undefined; - }; - - /** - * @param {PathItem[]} path path in the schema - * @returns {void} - */ - const addResetFlag = path => { - const schemaPath = path[0].path; - const name = pathToArgumentName(`${schemaPath}.reset`); - const description = - getResetDescription(path) || - `Clear all items provided in '${schemaPath}' configuration. ${getDescription( - path - )}`; - flags[name] = { - configs: [ - { - type: "reset", - multiple: false, - description, - path: schemaPath + return pos; + }; + const eatUntil = chars => { + const charCodes = Array.from({ length: chars.length }, (_, i) => + chars.charCodeAt(i) + ); + const arr = Array.from( + { length: charCodes.reduce((a, b) => Math.max(a, b), 0) + 1 }, + () => false + ); + charCodes.forEach(cc => (arr[cc] = true)); + return (input, pos) => { + for (;;) { + const cc = input.charCodeAt(pos); + if (cc < arr.length && arr[cc]) { + return pos; + } + pos++; + if (pos === input.length) return pos; } - ], - description: undefined, - simpleType: undefined, - multiple: undefined + }; }; - }; - - /** - * @param {PathItem[]} path full path in schema - * @param {boolean} multiple inside of an array - * @returns {number} number of arguments added - */ - const addFlag = (path, multiple) => { - const argConfigBase = schemaToArgumentConfig(path[0].schema); - if (!argConfigBase) return 0; - - const negatedDescription = getNegatedDescription(path); - const name = pathToArgumentName(path[0].path); - /** @type {ArgumentConfig} */ - const argConfig = { - ...argConfigBase, - multiple, - description: getDescription(path), - path: path[0].path + const eatText = (input, pos, eater) => { + let text = ""; + for (;;) { + if (input.charCodeAt(pos) === CC_SLASH) { + const newPos = walkCssTokens.eatComments(input, pos); + if (pos !== newPos) { + pos = newPos; + if (pos === input.length) break; + } else { + text += "/"; + pos++; + if (pos === input.length) break; + } + } + const newPos = eater(input, pos); + if (pos !== newPos) { + text += input.slice(pos, newPos); + pos = newPos; + } else { + break; + } + if (pos === input.length) break; + } + return [pos, text.trimRight()]; }; - - if (negatedDescription) { - argConfig.negatedDescription = negatedDescription; - } - - if (!flags[name]) { - flags[name] = { - configs: [], - description: undefined, - simpleType: undefined, - multiple: undefined - }; - } - - if ( - flags[name].configs.some( - item => JSON.stringify(item) === JSON.stringify(argConfig) - ) - ) { - return 0; - } - - if ( - flags[name].configs.some( - item => item.type === argConfig.type && item.multiple !== multiple - ) - ) { - if (multiple) { + const eatExportName = eatUntil(":};/"); + const eatExportValue = eatUntil("};/"); + const parseExports = (input, pos) => { + pos = walkCssTokens.eatWhitespaceAndComments(input, pos); + const cc = input.charCodeAt(pos); + if (cc !== CC_LEFT_CURLY) throw new Error( - `Conflicting schema for ${path[0].path} with ${argConfig.type} type (array type must be before single item type)` + `Unexpected ${input[pos]} at ${pos} during parsing of ':export' (expected '{')` ); - } - return 0; - } - - flags[name].configs.push(argConfig); - - return 1; - }; - - // TODO support `not` and `if/then/else` - // TODO support `const`, but we don't use it on our schema - /** - * - * @param {object} schemaPart the current schema - * @param {string} schemaPath the current path in the schema - * @param {{schema: object, path: string}[]} path all previous visited schemaParts - * @param {string | null} inArray if inside of an array, the path to the array - * @returns {number} added arguments - */ - const traverse = (schemaPart, schemaPath = "", path = [], inArray = null) => { - while (schemaPart.$ref) { - schemaPart = getSchemaPart(schemaPart.$ref); - } - - const repetitions = path.filter(({ schema }) => schema === schemaPart); - if ( - repetitions.length >= 2 || - repetitions.some(({ path }) => path === schemaPath) - ) { - return 0; - } - - if (schemaPart.cli && schemaPart.cli.exclude) return 0; - - const fullPath = [{ schema: schemaPart, path: schemaPath }, ...path]; - - let addedArguments = 0; - - addedArguments += addFlag(fullPath, !!inArray); - - if (schemaPart.type === "object") { - if (schemaPart.properties) { - for (const property of Object.keys(schemaPart.properties)) { - addedArguments += traverse( - schemaPart.properties[property], - schemaPath ? `${schemaPath}.${property}` : property, - fullPath, - inArray + pos++; + pos = walkCssTokens.eatWhitespaceAndComments(input, pos); + for (;;) { + if (input.charCodeAt(pos) === CC_RIGHT_CURLY) break; + pos = walkCssTokens.eatWhitespaceAndComments(input, pos); + if (pos === input.length) return pos; + let start = pos; + let name; + [pos, name] = eatText(input, pos, eatExportName); + if (pos === input.length) return pos; + if (input.charCodeAt(pos) !== CC_COLON) { + throw new Error( + `Unexpected ${input[pos]} at ${pos} during parsing of export name in ':export' (expected ':')` ); } - } - - return addedArguments; - } - - if (schemaPart.type === "array") { - if (inArray) { - return 0; - } - if (Array.isArray(schemaPart.items)) { - let i = 0; - for (const item of schemaPart.items) { - addedArguments += traverse( - item, - `${schemaPath}.${i}`, - fullPath, - schemaPath + pos++; + if (pos === input.length) return pos; + pos = walkCssTokens.eatWhitespaceAndComments(input, pos); + if (pos === input.length) return pos; + let value; + [pos, value] = eatText(input, pos, eatExportValue); + if (pos === input.length) return pos; + const cc = input.charCodeAt(pos); + if (cc === CC_SEMICOLON) { + pos++; + if (pos === input.length) return pos; + pos = walkCssTokens.eatWhitespaceAndComments(input, pos); + if (pos === input.length) return pos; + } else if (cc !== CC_RIGHT_CURLY) { + throw new Error( + `Unexpected ${input[pos]} at ${pos} during parsing of export value in ':export' (expected ';' or '}')` ); } - - return addedArguments; + const dep = new CssExportDependency(name, value); + const { line: sl, column: sc } = locConverter.get(start); + const { line: el, column: ec } = locConverter.get(pos); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); } - - addedArguments += traverse( - schemaPart.items, - `${schemaPath}[]`, - fullPath, - schemaPath + pos++; + if (pos === input.length) return pos; + pos = eatWhiteLine(input, pos); + return pos; + }; + const eatPropertyName = eatUntil(":{};"); + const processLocalDeclaration = (input, pos) => { + modeData = undefined; + const start = pos; + pos = walkCssTokens.eatWhitespaceAndComments(input, pos); + const propertyNameStart = pos; + const [propertyNameEnd, propertyName] = eatText( + input, + pos, + eatPropertyName ); - - if (addedArguments > 0) { - addResetFlag(fullPath); - addedArguments++; + if (input.charCodeAt(propertyNameEnd) !== CC_COLON) return start; + pos = propertyNameEnd + 1; + if (propertyName.startsWith("--")) { + // CSS Variable + const { line: sl, column: sc } = locConverter.get(propertyNameStart); + const { line: el, column: ec } = locConverter.get(propertyNameEnd); + const name = propertyName.slice(2); + const dep = new CssLocalIdentifierDependency( + name, + [propertyNameStart, propertyNameEnd], + "--" + ); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); + declaredCssVariables.add(name); + } else if ( + propertyName === "animation-name" || + propertyName === "animation" + ) { + modeData = "animation"; + lastIdentifier = undefined; } - - return addedArguments; - } - - const maybeOf = schemaPart.oneOf || schemaPart.anyOf || schemaPart.allOf; - - if (maybeOf) { - const items = maybeOf; - - for (let i = 0; i < items.length; i++) { - addedArguments += traverse(items[i], schemaPath, fullPath, inArray); - } - - return addedArguments; - } - - return addedArguments; - }; - - traverse(schema); - - // Summarize flags - for (const name of Object.keys(flags)) { - const argument = flags[name]; - argument.description = argument.configs.reduce((desc, { description }) => { - if (!desc) return description; - if (!description) return desc; - if (desc.includes(description)) return desc; - return `${desc} ${description}`; - }, /** @type {string | undefined} */ (undefined)); - argument.simpleType = argument.configs.reduce((t, argConfig) => { - /** @type {"string" | "number" | "boolean"} */ - let type = "string"; - switch (argConfig.type) { - case "number": - type = "number"; - break; - case "reset": - case "boolean": - type = "boolean"; - break; - case "enum": - if (argConfig.values.every(v => typeof v === "boolean")) - type = "boolean"; - if (argConfig.values.every(v => typeof v === "number")) - type = "number"; - break; + return pos; + }; + const processDeclarationValueDone = (input, pos) => { + if (modeData === "animation" && lastIdentifier) { + const { line: sl, column: sc } = locConverter.get(lastIdentifier[0]); + const { line: el, column: ec } = locConverter.get(lastIdentifier[1]); + const name = input.slice(lastIdentifier[0], lastIdentifier[1]); + const dep = new CssSelfLocalIdentifierDependency(name, lastIdentifier); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); } - if (t === undefined) return type; - return t === type ? t : "string"; - }, /** @type {"string" | "number" | "boolean" | undefined} */ (undefined)); - argument.multiple = argument.configs.some(c => c.multiple); - } - - return flags; -}; - -const cliAddedItems = new WeakMap(); - -/** - * @param {any} config configuration - * @param {string} schemaPath path in the config - * @param {number | undefined} index index of value when multiple values are provided, otherwise undefined - * @returns {{ problem?: LocalProblem, object?: any, property?: string | number, value?: any }} problem or object with property and value - */ -const getObjectAndProperty = (config, schemaPath, index = 0) => { - if (!schemaPath) return { value: config }; - const parts = schemaPath.split("."); - let property = parts.pop(); - let current = config; - let i = 0; - for (const part of parts) { - const isArray = part.endsWith("[]"); - const name = isArray ? part.slice(0, -2) : part; - let value = current[name]; - if (isArray) { - if (value === undefined) { - value = {}; - current[name] = [...Array.from({ length: index }), value]; - cliAddedItems.set(current[name], index + 1); - } else if (!Array.isArray(value)) { - return { - problem: { - type: "unexpected-non-array-in-path", - path: parts.slice(0, i).join(".") + }; + const eatKeyframes = eatUntil("{};/"); + const eatNameInVar = eatUntil(",)};/"); + walkCssTokens(source, { + isSelector: () => { + return mode !== CSS_MODE_IN_RULE && mode !== CSS_MODE_IN_LOCAL_RULE; + }, + url: (input, start, end, contentStart, contentEnd) => { + const value = cssUnescape(input.slice(contentStart, contentEnd)); + switch (mode) { + case CSS_MODE_AT_IMPORT_EXPECT_URL: { + modeData.url = value; + mode = CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS; + break; + } + case CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS: + case CSS_MODE_AT_IMPORT_EXPECT_MEDIA: + throw new Error( + `Unexpected ${input.slice( + start, + end + )} at ${start} during ${explainMode(mode)}` + ); + default: { + const dep = new CssUrlDependency(value, [start, end], "url"); + const { line: sl, column: sc } = locConverter.get(start); + const { line: el, column: ec } = locConverter.get(end); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); + module.addCodeGenerationDependency(dep); + break; } - }; - } else { - let addedItems = cliAddedItems.get(value) || 0; - while (addedItems <= index) { - value.push(undefined); - addedItems++; } - cliAddedItems.set(value, addedItems); - const x = value.length - addedItems + index; - if (value[x] === undefined) { - value[x] = {}; - } else if (value[x] === null || typeof value[x] !== "object") { - return { - problem: { - type: "unexpected-non-object-in-path", - path: parts.slice(0, i).join(".") - } + return end; + }, + string: (input, start, end) => { + switch (mode) { + case CSS_MODE_AT_IMPORT_EXPECT_URL: { + modeData.url = cssUnescape(input.slice(start + 1, end - 1)); + mode = CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS; + break; + } + } + return end; + }, + atKeyword: (input, start, end) => { + const name = input.slice(start, end); + if (name === "@namespace") { + throw new Error("@namespace is not supported in bundled CSS"); + } + if (name === "@import") { + if (mode !== CSS_MODE_TOP_LEVEL) { + throw new Error( + `Unexpected @import at ${start} during ${explainMode(mode)}` + ); + } + mode = CSS_MODE_AT_IMPORT_EXPECT_URL; + modePos = end; + modeData = { + start: start, + url: undefined, + supports: undefined }; } - value = value[x]; - } - } else { - if (value === undefined) { - value = current[name] = {}; - } else if (value === null || typeof value !== "object") { - return { - problem: { - type: "unexpected-non-object-in-path", - path: parts.slice(0, i).join(".") + if (name === "@keyframes") { + let pos = end; + pos = walkCssTokens.eatWhitespaceAndComments(input, pos); + if (pos === input.length) return pos; + const [newPos, name] = eatText(input, pos, eatKeyframes); + const { line: sl, column: sc } = locConverter.get(pos); + const { line: el, column: ec } = locConverter.get(newPos); + const dep = new CssLocalIdentifierDependency(name, [pos, newPos]); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); + pos = newPos; + if (pos === input.length) return pos; + if (input.charCodeAt(pos) !== CC_LEFT_CURLY) { + throw new Error( + `Unexpected ${input[pos]} at ${pos} during parsing of @keyframes (expected '{')` + ); } - }; - } - } - current = value; - i++; - } - let value = current[property]; - if (property.endsWith("[]")) { - const name = property.slice(0, -2); - const value = current[name]; - if (value === undefined) { - current[name] = [...Array.from({ length: index }), undefined]; - cliAddedItems.set(current[name], index + 1); - return { object: current[name], property: index, value: undefined }; - } else if (!Array.isArray(value)) { - current[name] = [value, ...Array.from({ length: index }), undefined]; - cliAddedItems.set(current[name], index + 1); - return { object: current[name], property: index + 1, value: undefined }; - } else { - let addedItems = cliAddedItems.get(value) || 0; - while (addedItems <= index) { - value.push(undefined); - addedItems++; - } - cliAddedItems.set(value, addedItems); - const x = value.length - addedItems + index; - if (value[x] === undefined) { - value[x] = {}; - } else if (value[x] === null || typeof value[x] !== "object") { - return { - problem: { - type: "unexpected-non-object-in-path", - path: schemaPath + mode = CSS_MODE_IN_LOCAL_RULE; + modeNestingLevel = 1; + return pos + 1; + } + return end; + }, + semicolon: (input, start, end) => { + switch (mode) { + case CSS_MODE_AT_IMPORT_EXPECT_URL: + throw new Error(`Expected URL for @import at ${start}`); + case CSS_MODE_AT_IMPORT_EXPECT_MEDIA: + case CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS: { + const { line: sl, column: sc } = locConverter.get(modeData.start); + const { line: el, column: ec } = locConverter.get(end); + end = eatWhiteLine(input, end); + const media = input.slice(modePos, start).trim(); + const dep = new CssImportDependency( + modeData.url, + [modeData.start, end], + modeData.supports, + media + ); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); + break; } - }; + case CSS_MODE_IN_LOCAL_RULE: { + processDeclarationValueDone(input, start); + return processLocalDeclaration(input, end); + } + case CSS_MODE_IN_RULE: { + return end; + } + } + mode = CSS_MODE_TOP_LEVEL; + modeData = undefined; + singleClassSelector = undefined; + return end; + }, + leftCurlyBracket: (input, start, end) => { + switch (mode) { + case CSS_MODE_TOP_LEVEL: + mode = isTopLevelLocal() + ? CSS_MODE_IN_LOCAL_RULE + : CSS_MODE_IN_RULE; + modeNestingLevel = 1; + if (mode === CSS_MODE_IN_LOCAL_RULE) + return processLocalDeclaration(input, end); + break; + case CSS_MODE_IN_RULE: + case CSS_MODE_IN_LOCAL_RULE: + modeNestingLevel++; + break; + } + return end; + }, + rightCurlyBracket: (input, start, end) => { + switch (mode) { + case CSS_MODE_IN_LOCAL_RULE: + processDeclarationValueDone(input, start); + /* falls through */ + case CSS_MODE_IN_RULE: + if (--modeNestingLevel === 0) { + mode = CSS_MODE_TOP_LEVEL; + modeData = undefined; + singleClassSelector = undefined; + } + break; + } + return end; + }, + id: (input, start, end) => { + singleClassSelector = false; + switch (mode) { + case CSS_MODE_TOP_LEVEL: + if (isTopLevelLocal()) { + const name = input.slice(start + 1, end); + const dep = new CssLocalIdentifierDependency(name, [ + start + 1, + end + ]); + const { line: sl, column: sc } = locConverter.get(start); + const { line: el, column: ec } = locConverter.get(end); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); + } + break; + } + return end; + }, + identifier: (input, start, end) => { + singleClassSelector = false; + switch (mode) { + case CSS_MODE_IN_LOCAL_RULE: + if (modeData === "animation") { + lastIdentifier = [start, end]; + } + break; + } + return end; + }, + class: (input, start, end) => { + switch (mode) { + case CSS_MODE_TOP_LEVEL: { + if (isTopLevelLocal()) { + const name = input.slice(start + 1, end); + const dep = new CssLocalIdentifierDependency(name, [ + start + 1, + end + ]); + const { line: sl, column: sc } = locConverter.get(start); + const { line: el, column: ec } = locConverter.get(end); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); + if (singleClassSelector === undefined) singleClassSelector = name; + } else { + singleClassSelector = false; + } + break; + } + } + return end; + }, + leftParenthesis: (input, start, end) => { + switch (mode) { + case CSS_MODE_TOP_LEVEL: { + modeStack.push(false); + break; + } + } + return end; + }, + rightParenthesis: (input, start, end) => { + switch (mode) { + case CSS_MODE_TOP_LEVEL: { + const newModeData = modeStack.pop(); + if (newModeData !== false) { + modeData = newModeData; + const dep = new ConstDependency("", [start, end]); + module.addPresentationalDependency(dep); + } + break; + } + } + return end; + }, + pseudoClass: (input, start, end) => { + singleClassSelector = false; + switch (mode) { + case CSS_MODE_TOP_LEVEL: { + const name = input.slice(start, end); + if (this.allowModeSwitch && name === ":global") { + modeData = "global"; + const dep = new ConstDependency("", [start, end]); + module.addPresentationalDependency(dep); + } else if (this.allowModeSwitch && name === ":local") { + modeData = "local"; + const dep = new ConstDependency("", [start, end]); + module.addPresentationalDependency(dep); + } else if (this.allowPseudoBlocks && name === ":export") { + const pos = parseExports(input, end); + const dep = new ConstDependency("", [start, pos]); + module.addPresentationalDependency(dep); + return pos; + } + break; + } + } + return end; + }, + pseudoFunction: (input, start, end) => { + switch (mode) { + case CSS_MODE_TOP_LEVEL: { + const name = input.slice(start, end - 1); + if (this.allowModeSwitch && name === ":global") { + modeStack.push(modeData); + modeData = "global"; + const dep = new ConstDependency("", [start, end]); + module.addPresentationalDependency(dep); + } else if (this.allowModeSwitch && name === ":local") { + modeStack.push(modeData); + modeData = "local"; + const dep = new ConstDependency("", [start, end]); + module.addPresentationalDependency(dep); + } else { + modeStack.push(false); + } + break; + } + } + return end; + }, + function: (input, start, end) => { + switch (mode) { + case CSS_MODE_IN_LOCAL_RULE: { + const name = input.slice(start, end - 1); + if (name === "var") { + let pos = walkCssTokens.eatWhitespaceAndComments(input, end); + if (pos === input.length) return pos; + const [newPos, name] = eatText(input, pos, eatNameInVar); + if (!name.startsWith("--")) return end; + const { line: sl, column: sc } = locConverter.get(pos); + const { line: el, column: ec } = locConverter.get(newPos); + const dep = new CssSelfLocalIdentifierDependency( + name.slice(2), + [pos, newPos], + "--", + declaredCssVariables + ); + dep.setLoc(sl, sc, el, ec); + module.addDependency(dep); + return newPos; + } + break; + } + } + return end; + }, + comma: (input, start, end) => { + switch (mode) { + case CSS_MODE_TOP_LEVEL: + modeData = undefined; + modeStack.length = 0; + break; + case CSS_MODE_IN_LOCAL_RULE: + processDeclarationValueDone(input, start); + break; + } + return end; } - return { - object: value, - property: x, - value: value[x] - }; - } + }); + + module.buildInfo.strict = true; + module.buildMeta.exportsType = "namespace"; + module.addDependency(new StaticExportsDependency([], true)); + return state; } - return { object: current, property, value }; -}; +} + +module.exports = CssParser; + + +/***/ }), + +/***/ 44124: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + /** - * @param {any} config configuration - * @param {string} schemaPath path in the config - * @param {any} value parsed value - * @param {number | undefined} index index of value when multiple values are provided, otherwise undefined - * @returns {LocalProblem | null} problem or null for success + * @typedef {Object} CssTokenCallbacks + * @property {function(string, number): boolean} isSelector + * @property {function(string, number, number, number, number): number=} url + * @property {function(string, number, number): number=} string + * @property {function(string, number, number): number=} leftParenthesis + * @property {function(string, number, number): number=} rightParenthesis + * @property {function(string, number, number): number=} pseudoFunction + * @property {function(string, number, number): number=} function + * @property {function(string, number, number): number=} pseudoClass + * @property {function(string, number, number): number=} atKeyword + * @property {function(string, number, number): number=} class + * @property {function(string, number, number): number=} identifier + * @property {function(string, number, number): number=} id + * @property {function(string, number, number): number=} leftCurlyBracket + * @property {function(string, number, number): number=} rightCurlyBracket + * @property {function(string, number, number): number=} semicolon + * @property {function(string, number, number): number=} comma */ -const setValue = (config, schemaPath, value, index) => { - const { problem, object, property } = getObjectAndProperty( - config, - schemaPath, - index - ); - if (problem) return problem; - object[property] = value; - return null; -}; -/** - * @param {ArgumentConfig} argConfig processing instructions - * @param {any} config configuration - * @param {any} value the value - * @param {number | undefined} index the index if multiple values provided - * @returns {LocalProblem | null} a problem if any - */ -const processArgumentConfig = (argConfig, config, value, index) => { - if (index !== undefined && !argConfig.multiple) { - return { - type: "multiple-values-unexpected", - path: argConfig.path - }; - } - const parsed = parseValueForArgumentConfig(argConfig, value); - if (parsed === undefined) { - return { - type: "invalid-value", - path: argConfig.path, - expected: getExpectedValue(argConfig) - }; - } - const problem = setValue(config, argConfig.path, parsed, index); - if (problem) return problem; - return null; +/** @typedef {function(string, number, CssTokenCallbacks): number} CharHandler */ + +// spec: https://drafts.csswg.org/css-syntax/ + +const CC_LINE_FEED = "\n".charCodeAt(0); +const CC_CARRIAGE_RETURN = "\r".charCodeAt(0); +const CC_FORM_FEED = "\f".charCodeAt(0); + +const CC_TAB = "\t".charCodeAt(0); +const CC_SPACE = " ".charCodeAt(0); + +const CC_SLASH = "/".charCodeAt(0); +const CC_BACK_SLASH = "\\".charCodeAt(0); +const CC_ASTERISK = "*".charCodeAt(0); + +const CC_LEFT_PARENTHESIS = "(".charCodeAt(0); +const CC_RIGHT_PARENTHESIS = ")".charCodeAt(0); +const CC_LEFT_CURLY = "{".charCodeAt(0); +const CC_RIGHT_CURLY = "}".charCodeAt(0); + +const CC_QUOTATION_MARK = '"'.charCodeAt(0); +const CC_APOSTROPHE = "'".charCodeAt(0); + +const CC_FULL_STOP = ".".charCodeAt(0); +const CC_COLON = ":".charCodeAt(0); +const CC_SEMICOLON = ";".charCodeAt(0); +const CC_COMMA = ",".charCodeAt(0); +const CC_PERCENTAGE = "%".charCodeAt(0); +const CC_AT_SIGN = "@".charCodeAt(0); + +const CC_LOW_LINE = "_".charCodeAt(0); +const CC_LOWER_A = "a".charCodeAt(0); +const CC_LOWER_U = "u".charCodeAt(0); +const CC_LOWER_E = "e".charCodeAt(0); +const CC_LOWER_Z = "z".charCodeAt(0); +const CC_UPPER_A = "A".charCodeAt(0); +const CC_UPPER_E = "E".charCodeAt(0); +const CC_UPPER_Z = "Z".charCodeAt(0); +const CC_0 = "0".charCodeAt(0); +const CC_9 = "9".charCodeAt(0); + +const CC_NUMBER_SIGN = "#".charCodeAt(0); +const CC_PLUS_SIGN = "+".charCodeAt(0); +const CC_HYPHEN_MINUS = "-".charCodeAt(0); + +const CC_LESS_THAN_SIGN = "<".charCodeAt(0); +const CC_GREATER_THAN_SIGN = ">".charCodeAt(0); + +const _isNewLine = cc => { + return ( + cc === CC_LINE_FEED || cc === CC_CARRIAGE_RETURN || cc === CC_FORM_FEED + ); }; -/** - * @param {ArgumentConfig} argConfig processing instructions - * @returns {string | undefined} expected message - */ -const getExpectedValue = argConfig => { - switch (argConfig.type) { - default: - return argConfig.type; - case "boolean": - return "true | false"; - case "RegExp": - return "regular expression (example: /ab?c*/)"; - case "enum": - return argConfig.values.map(v => `${v}`).join(" | "); - case "reset": - return "true (will reset the previous value to an empty array)"; +/** @type {CharHandler} */ +const consumeSpace = (input, pos, callbacks) => { + let cc; + do { + pos++; + cc = input.charCodeAt(pos); + } while (_isWhiteSpace(cc)); + return pos; +}; + +const _isWhiteSpace = cc => { + return ( + cc === CC_LINE_FEED || + cc === CC_CARRIAGE_RETURN || + cc === CC_FORM_FEED || + cc === CC_TAB || + cc === CC_SPACE + ); +}; + +/** @type {CharHandler} */ +const consumeSingleCharToken = (input, pos, callbacks) => { + return pos + 1; +}; + +/** @type {CharHandler} */ +const consumePotentialComment = (input, pos, callbacks) => { + pos++; + if (pos === input.length) return pos; + let cc = input.charCodeAt(pos); + if (cc !== CC_ASTERISK) return pos; + for (;;) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + while (cc === CC_ASTERISK) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + if (cc === CC_SLASH) return pos + 1; + } } }; -/** - * @param {ArgumentConfig} argConfig processing instructions - * @param {any} value the value - * @returns {any | undefined} parsed value - */ -const parseValueForArgumentConfig = (argConfig, value) => { - switch (argConfig.type) { - case "string": - if (typeof value === "string") { - return value; - } - break; - case "path": - if (typeof value === "string") { - return path.resolve(value); - } - break; - case "number": - if (typeof value === "number") return value; - if (typeof value === "string" && /^[+-]?\d*(\.\d*)[eE]\d+$/) { - const n = +value; - if (!isNaN(n)) return n; - } - break; - case "boolean": - if (typeof value === "boolean") return value; - if (value === "true") return true; - if (value === "false") return false; - break; - case "RegExp": - if (value instanceof RegExp) return value; - if (typeof value === "string") { - // cspell:word yugi - const match = /^\/(.*)\/([yugi]*)$/.exec(value); - if (match && !/[^\\]\//.test(match[1])) - return new RegExp(match[1], match[2]); - } - break; - case "enum": - if (argConfig.values.includes(value)) return value; - for (const item of argConfig.values) { - if (`${item}` === value) return item; - } - break; - case "reset": - if (value === true) return []; - break; +/** @type {function(number): CharHandler} */ +const consumeString = end => (input, pos, callbacks) => { + const start = pos; + pos = _consumeString(input, pos, end); + if (callbacks.string !== undefined) { + pos = callbacks.string(input, start, pos); } + return pos; }; -/** - * @param {Record} args object of arguments - * @param {any} config configuration - * @param {Record} values object with values - * @returns {Problem[] | null} problems or null for success - */ -const processArguments = (args, config, values) => { - /** @type {Problem[]} */ - const problems = []; - for (const key of Object.keys(values)) { - const arg = args[key]; - if (!arg) { - problems.push({ - type: "unknown-argument", - path: "", - argument: key - }); - continue; +const _consumeString = (input, pos, end) => { + pos++; + for (;;) { + if (pos === input.length) return pos; + const cc = input.charCodeAt(pos); + if (cc === end) return pos + 1; + if (_isNewLine(cc)) { + // bad string + return pos; } - const processValue = (value, i) => { - const currentProblems = []; - for (const argConfig of arg.configs) { - const problem = processArgumentConfig(argConfig, config, value, i); - if (!problem) { - return; - } - currentProblems.push({ - ...problem, - argument: key, - value: value, - index: i - }); - } - problems.push(...currentProblems); - }; - let value = values[key]; - if (Array.isArray(value)) { - for (let i = 0; i < value.length; i++) { - processValue(value[i], i); - } + if (cc === CC_BACK_SLASH) { + // we don't need to fully parse the escaped code point + // just skip over a potential new line + pos++; + if (pos === input.length) return pos; + pos++; } else { - processValue(value, undefined); + pos++; } } - if (problems.length === 0) return null; - return problems; }; -exports.getArguments = getArguments; -exports.processArguments = processArguments; - - -/***/ }), - -/***/ 43950: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sergey Melyukov @smelukov -*/ +const _isIdentifierStartCode = cc => { + return ( + cc === CC_LOW_LINE || + (cc >= CC_LOWER_A && cc <= CC_LOWER_Z) || + (cc >= CC_UPPER_A && cc <= CC_UPPER_Z) || + cc > 0x80 + ); +}; +const _isDigit = cc => { + return cc >= CC_0 && cc <= CC_9; +}; +const _startsIdentifier = (input, pos) => { + const cc = input.charCodeAt(pos); + if (cc === CC_HYPHEN_MINUS) { + if (pos === input.length) return false; + const cc = input.charCodeAt(pos + 1); + if (cc === CC_HYPHEN_MINUS) return true; + if (cc === CC_BACK_SLASH) { + const cc = input.charCodeAt(pos + 2); + return !_isNewLine(cc); + } + return _isIdentifierStartCode(cc); + } + if (cc === CC_BACK_SLASH) { + const cc = input.charCodeAt(pos + 1); + return !_isNewLine(cc); + } + return _isIdentifierStartCode(cc); +}; -const browserslist = __webpack_require__(14907); -const path = __webpack_require__(71017); +/** @type {CharHandler} */ +const consumeNumberSign = (input, pos, callbacks) => { + const start = pos; + pos++; + if (pos === input.length) return pos; + if (callbacks.isSelector(input, pos) && _startsIdentifier(input, pos)) { + pos = _consumeIdentifier(input, pos); + if (callbacks.id !== undefined) { + return callbacks.id(input, start, pos); + } + } + return pos; +}; -/** @typedef {import("./target").ApiTargetProperties} ApiTargetProperties */ -/** @typedef {import("./target").EcmaTargetProperties} EcmaTargetProperties */ -/** @typedef {import("./target").PlatformTargetProperties} PlatformTargetProperties */ +/** @type {CharHandler} */ +const consumeMinus = (input, pos, callbacks) => { + const start = pos; + pos++; + if (pos === input.length) return pos; + const cc = input.charCodeAt(pos); + if (cc === CC_FULL_STOP || _isDigit(cc)) { + return consumeNumericToken(input, pos, callbacks); + } else if (cc === CC_HYPHEN_MINUS) { + pos++; + if (pos === input.length) return pos; + const cc = input.charCodeAt(pos); + if (cc === CC_GREATER_THAN_SIGN) { + return pos + 1; + } else { + pos = _consumeIdentifier(input, pos); + if (callbacks.identifier !== undefined) { + return callbacks.identifier(input, start, pos); + } + } + } else if (cc === CC_BACK_SLASH) { + if (pos + 1 === input.length) return pos; + const cc = input.charCodeAt(pos + 1); + if (_isNewLine(cc)) return pos; + pos = _consumeIdentifier(input, pos); + if (callbacks.identifier !== undefined) { + return callbacks.identifier(input, start, pos); + } + } else if (_isIdentifierStartCode(cc)) { + pos++; + pos = _consumeIdentifier(input, pos); + if (callbacks.identifier !== undefined) { + return callbacks.identifier(input, start, pos); + } + } + return pos; +}; -// [[C:]/path/to/config][:env] -const inputRx = /^(?:((?:[A-Z]:)?[/\\].*?))?(?::(.+?))?$/i; +/** @type {CharHandler} */ +const consumeDot = (input, pos, callbacks) => { + const start = pos; + pos++; + if (pos === input.length) return pos; + const cc = input.charCodeAt(pos); + if (_isDigit(cc)) return consumeNumericToken(input, pos - 2, callbacks); + if (!callbacks.isSelector(input, pos) || !_startsIdentifier(input, pos)) + return pos; + pos = _consumeIdentifier(input, pos); + if (callbacks.class !== undefined) return callbacks.class(input, start, pos); + return pos; +}; -/** - * @typedef {Object} BrowserslistHandlerConfig - * @property {string=} configPath - * @property {string=} env - * @property {string=} query - */ +/** @type {CharHandler} */ +const consumeNumericToken = (input, pos, callbacks) => { + pos = _consumeNumber(input, pos); + if (pos === input.length) return pos; + if (_startsIdentifier(input, pos)) return _consumeIdentifier(input, pos); + const cc = input.charCodeAt(pos); + if (cc === CC_PERCENTAGE) return pos + 1; + return pos; +}; -/** - * @param {string} input input string - * @param {string} context the context directory - * @returns {BrowserslistHandlerConfig} config - */ -const parse = (input, context) => { - if (!input) { - return {}; +/** @type {CharHandler} */ +const consumeOtherIdentifier = (input, pos, callbacks) => { + const start = pos; + pos = _consumeIdentifier(input, pos); + if ( + pos !== input.length && + !callbacks.isSelector(input, pos) && + input.charCodeAt(pos) === CC_LEFT_PARENTHESIS + ) { + pos++; + if (callbacks.function !== undefined) { + return callbacks.function(input, start, pos); + } + } else { + if (callbacks.identifier !== undefined) { + return callbacks.identifier(input, start, pos); + } } + return pos; +}; - if (path.isAbsolute(input)) { - const [, configPath, env] = inputRx.exec(input) || []; - return { configPath, env }; +/** @type {CharHandler} */ +const consumePotentialUrl = (input, pos, callbacks) => { + const start = pos; + pos = _consumeIdentifier(input, pos); + if (pos === start + 3 && input.slice(start, pos + 1) === "url(") { + pos++; + let cc = input.charCodeAt(pos); + while (_isWhiteSpace(cc)) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + } + if (cc === CC_QUOTATION_MARK || cc === CC_APOSTROPHE) { + pos++; + const contentStart = pos; + pos = _consumeString(input, pos, cc); + const contentEnd = pos - 1; + cc = input.charCodeAt(pos); + while (_isWhiteSpace(cc)) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + } + if (cc !== CC_RIGHT_PARENTHESIS) return pos; + pos++; + if (callbacks.url !== undefined) + return callbacks.url(input, start, pos, contentStart, contentEnd); + return pos; + } else { + const contentStart = pos; + let contentEnd; + for (;;) { + if (cc === CC_BACK_SLASH) { + pos++; + if (pos === input.length) return pos; + pos++; + } else if (_isWhiteSpace(cc)) { + contentEnd = pos; + do { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + } while (_isWhiteSpace(cc)); + if (cc !== CC_RIGHT_PARENTHESIS) return pos; + pos++; + if (callbacks.url !== undefined) { + return callbacks.url(input, start, pos, contentStart, contentEnd); + } + return pos; + } else if (cc === CC_RIGHT_PARENTHESIS) { + contentEnd = pos; + pos++; + if (callbacks.url !== undefined) { + return callbacks.url(input, start, pos, contentStart, contentEnd); + } + return pos; + } else if (cc === CC_LEFT_PARENTHESIS) { + return pos; + } else { + pos++; + } + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + } + } + } else { + if (callbacks.identifier !== undefined) { + return callbacks.identifier(input, start, pos); + } + return pos; } +}; - const config = browserslist.findConfig(context); +/** @type {CharHandler} */ +const consumePotentialPseudo = (input, pos, callbacks) => { + const start = pos; + pos++; + if (!callbacks.isSelector(input, pos) || !_startsIdentifier(input, pos)) + return pos; + pos = _consumeIdentifier(input, pos); + let cc = input.charCodeAt(pos); + if (cc === CC_LEFT_PARENTHESIS) { + pos++; + if (callbacks.pseudoFunction !== undefined) { + return callbacks.pseudoFunction(input, start, pos); + } + return pos; + } + if (callbacks.pseudoClass !== undefined) { + return callbacks.pseudoClass(input, start, pos); + } + return pos; +}; - if (config && Object.keys(config).includes(input)) { - return { env: input }; +/** @type {CharHandler} */ +const consumeLeftParenthesis = (input, pos, callbacks) => { + pos++; + if (callbacks.leftParenthesis !== undefined) { + return callbacks.leftParenthesis(input, pos - 1, pos); } + return pos; +}; - return { query: input }; +/** @type {CharHandler} */ +const consumeRightParenthesis = (input, pos, callbacks) => { + pos++; + if (callbacks.rightParenthesis !== undefined) { + return callbacks.rightParenthesis(input, pos - 1, pos); + } + return pos; }; -/** - * @param {string} input input string - * @param {string} context the context directory - * @returns {string[] | undefined} selected browsers - */ -const load = (input, context) => { - const { configPath, env, query } = parse(input, context); - - // if a query is specified, then use it, else - // if a path to a config is specified then load it, else - // find a nearest config - const config = query - ? query - : configPath - ? browserslist.loadConfig({ - config: configPath, - env - }) - : browserslist.loadConfig({ path: context, env }); - - if (!config) return null; - return browserslist(config); +/** @type {CharHandler} */ +const consumeLeftCurlyBracket = (input, pos, callbacks) => { + pos++; + if (callbacks.leftCurlyBracket !== undefined) { + return callbacks.leftCurlyBracket(input, pos - 1, pos); + } + return pos; }; -/** - * @param {string[]} browsers supported browsers list - * @returns {EcmaTargetProperties & PlatformTargetProperties & ApiTargetProperties} target properties - */ -const resolve = browsers => { - /** - * Checks all against a version number - * @param {Record} versions first supported version - * @returns {boolean} true if supports - */ - const rawChecker = versions => { - return browsers.every(v => { - const [name, parsedVersion] = v.split(" "); - if (!name) return false; - const requiredVersion = versions[name]; - if (!requiredVersion) return false; - const [parsedMajor, parserMinor] = - // safari TP supports all features for normal safari - parsedVersion === "TP" - ? [Infinity, Infinity] - : parsedVersion.split("."); - if (typeof requiredVersion === "number") { - return +parsedMajor >= requiredVersion; - } - return requiredVersion[0] === +parsedMajor - ? +parserMinor >= requiredVersion[1] - : +parsedMajor > requiredVersion[0]; - }); - }; - const anyNode = browsers.some(b => /^node /.test(b)); - const anyBrowser = browsers.some(b => /^(?!node)/.test(b)); - const browserProperty = !anyBrowser ? false : anyNode ? null : true; - const nodeProperty = !anyNode ? false : anyBrowser ? null : true; - // Internet Explorer Mobile, Blackberry browser and Opera Mini are very old browsers, they do not support new features - const es6DynamicImport = rawChecker({ - chrome: 63, - and_chr: 63, - edge: 79, - firefox: 67, - and_ff: 67, - // ie: Not supported - opera: 50, - op_mob: 46, - safari: [11, 1], - ios_saf: [11, 3], - samsung: [8, 2], - android: 63, - and_qq: [10, 4], - // baidu: Not supported - // and_uc: Not supported - // kaios: Not supported - // Since Node.js 13.14.0 no warning about usage, but it was added 8.5.0 with some limitations and it was improved in 12.0.0 and 13.2.0 - node: [13, 14] - }); - - return { - const: rawChecker({ - chrome: 49, - and_chr: 49, - edge: 12, - // Prior to Firefox 13, const is implemented, but re-assignment is not failing. - // Prior to Firefox 46, a TypeError was thrown on redeclaration instead of a SyntaxError. - firefox: 36, - and_ff: 36, - // Not supported in for-in and for-of loops - // ie: Not supported - opera: 36, - op_mob: 36, - safari: [10, 0], - ios_saf: [10, 0], - // Before 5.0 supported correctly in strict mode, otherwise supported without block scope - samsung: [5, 0], - android: 37, - and_qq: [10, 4], - // Supported correctly in strict mode, otherwise supported without block scope - // baidu: Not supported - and_uc: [12, 12], - kaios: [2, 5], - node: [6, 0] - }), - arrowFunction: rawChecker({ - chrome: 45, - and_chr: 45, - edge: 12, - // The initial implementation of arrow functions in Firefox made them automatically strict. This has been changed as of Firefox 24. The use of 'use strict'; is now required. - // Prior to Firefox 39, a line terminator (\\n) was incorrectly allowed after arrow function arguments. This has been fixed to conform to the ES2015 specification and code like () \\n => {} will now throw a SyntaxError in this and later versions. - firefox: 39, - and_ff: 39, - // ie: Not supported, - opera: 32, - op_mob: 32, - safari: 10, - ios_saf: 10, - samsung: [5, 0], - android: 45, - and_qq: [10, 4], - baidu: [7, 12], - and_uc: [12, 12], - kaios: [2, 5], - node: [6, 0] - }), - forOf: rawChecker({ - chrome: 38, - and_chr: 38, - edge: 12, - // Prior to Firefox 51, using the for...of loop construct with the const keyword threw a SyntaxError ("missing = in const declaration"). - firefox: 51, - and_ff: 51, - // ie: Not supported, - opera: 25, - op_mob: 25, - safari: 7, - ios_saf: 7, - samsung: [3, 0], - android: 38, - // and_qq: Unknown support - // baidu: Unknown support - // and_uc: Unknown support - // kaios: Unknown support - node: [0, 12] - }), - destructuring: rawChecker({ - chrome: 49, - and_chr: 49, - edge: 14, - firefox: 41, - and_ff: 41, - // ie: Not supported, - opera: 36, - op_mob: 36, - safari: 8, - ios_saf: 8, - samsung: [5, 0], - android: 49, - // and_qq: Unknown support - // baidu: Unknown support - // and_uc: Unknown support - // kaios: Unknown support - node: [6, 0] - }), - bigIntLiteral: rawChecker({ - chrome: 67, - and_chr: 67, - edge: 79, - firefox: 68, - and_ff: 68, - // ie: Not supported, - opera: 54, - op_mob: 48, - safari: 14, - ios_saf: 14, - samsung: [9, 2], - android: 67, - // and_qq: Not supported - // baidu: Not supported - // and_uc: Not supported - // kaios: Not supported - node: [10, 4] - }), - // Support syntax `import` and `export` and no limitations and bugs on Node.js - // Not include `export * as namespace` - module: rawChecker({ - chrome: 61, - and_chr: 61, - edge: 16, - firefox: 60, - and_ff: 60, - // ie: Not supported, - opera: 48, - op_mob: 45, - safari: [10, 1], - ios_saf: [10, 3], - samsung: [8, 0], - android: 61, - and_qq: [10, 4], - // baidu: Not supported - // and_uc: Not supported - // kaios: Not supported - // Since Node.js 13.14.0 no warning about usage, but it was added 8.5.0 with some limitations and it was improved in 12.0.0 and 13.2.0 - node: [13, 14] - }), - dynamicImport: es6DynamicImport, - dynamicImportInWorker: es6DynamicImport && !anyNode, - // browserslist does not have info about globalThis - // so this is based on mdn-browser-compat-data - globalThis: rawChecker({ - chrome: 71, - and_chr: 71, - edge: 79, - firefox: 65, - and_ff: 65, - // ie: Not supported, - opera: 58, - op_mob: 50, - safari: [12, 1], - ios_saf: [12, 2], - samsung: [10, 1], - android: 71, - // and_qq: Unknown support - // baidu: Unknown support - // and_uc: Unknown support - // kaios: Unknown support - node: [12, 0] - }), - optionalChaining: rawChecker({ - chrome: 80, - and_chr: 80, - edge: 80, - firefox: 74, - and_ff: 79, - // ie: Not supported, - opera: 67, - op_mob: 64, - safari: [13, 1], - ios_saf: [13, 4], - samsung: 13, - android: 80, - // and_qq: Not supported - // baidu: Not supported - // and_uc: Not supported - // kaios: Not supported - node: 14 - }), - templateLiteral: rawChecker({ - chrome: 41, - and_chr: 41, - edge: 13, - firefox: 34, - and_ff: 34, - // ie: Not supported, - opera: 29, - op_mob: 64, - safari: [9, 1], - ios_saf: 9, - samsung: 4, - android: 41, - and_qq: [10, 4], - baidu: [7, 12], - and_uc: [12, 12], - kaios: [2, 5], - node: 4 - }), - browser: browserProperty, - electron: false, - node: nodeProperty, - nwjs: false, - web: browserProperty, - webworker: false, - - document: browserProperty, - fetchWasm: browserProperty, - global: nodeProperty, - importScripts: false, - importScriptsInWorker: true, - nodeBuiltins: nodeProperty, - require: nodeProperty - }; +/** @type {CharHandler} */ +const consumeRightCurlyBracket = (input, pos, callbacks) => { + pos++; + if (callbacks.rightCurlyBracket !== undefined) { + return callbacks.rightCurlyBracket(input, pos - 1, pos); + } + return pos; }; -module.exports = { - resolve, - load +/** @type {CharHandler} */ +const consumeSemicolon = (input, pos, callbacks) => { + pos++; + if (callbacks.semicolon !== undefined) { + return callbacks.semicolon(input, pos - 1, pos); + } + return pos; }; - -/***/ }), - -/***/ 92988: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const fs = __webpack_require__(57147); -const path = __webpack_require__(71017); -const Template = __webpack_require__(39722); -const { cleverMerge } = __webpack_require__(60839); -const { - getTargetsProperties, - getTargetProperties, - getDefaultTarget -} = __webpack_require__(52801); - -/** @typedef {import("../../declarations/WebpackOptions").CacheOptionsNormalized} CacheOptions */ -/** @typedef {import("../../declarations/WebpackOptions").CssExperimentOptions} CssExperimentOptions */ -/** @typedef {import("../../declarations/WebpackOptions").EntryDescription} EntryDescription */ -/** @typedef {import("../../declarations/WebpackOptions").EntryNormalized} Entry */ -/** @typedef {import("../../declarations/WebpackOptions").Experiments} Experiments */ -/** @typedef {import("../../declarations/WebpackOptions").ExperimentsNormalized} ExperimentsNormalized */ -/** @typedef {import("../../declarations/WebpackOptions").ExternalsPresets} ExternalsPresets */ -/** @typedef {import("../../declarations/WebpackOptions").ExternalsType} ExternalsType */ -/** @typedef {import("../../declarations/WebpackOptions").InfrastructureLogging} InfrastructureLogging */ -/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ -/** @typedef {import("../../declarations/WebpackOptions").Library} Library */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryName} LibraryName */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").Loader} Loader */ -/** @typedef {import("../../declarations/WebpackOptions").Mode} Mode */ -/** @typedef {import("../../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */ -/** @typedef {import("../../declarations/WebpackOptions").Node} WebpackNode */ -/** @typedef {import("../../declarations/WebpackOptions").Optimization} Optimization */ -/** @typedef {import("../../declarations/WebpackOptions").OutputNormalized} Output */ -/** @typedef {import("../../declarations/WebpackOptions").Performance} Performance */ -/** @typedef {import("../../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ -/** @typedef {import("../../declarations/WebpackOptions").RuleSetRules} RuleSetRules */ -/** @typedef {import("../../declarations/WebpackOptions").SnapshotOptions} SnapshotOptions */ -/** @typedef {import("../../declarations/WebpackOptions").Target} Target */ -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("./target").TargetProperties} TargetProperties */ - -const NODE_MODULES_REGEXP = /[\\/]node_modules[\\/]/i; - -/** - * Sets a constant default value when undefined - * @template T - * @template {keyof T} P - * @param {T} obj an object - * @param {P} prop a property of this object - * @param {T[P]} value a default value of the property - * @returns {void} - */ -const D = (obj, prop, value) => { - if (obj[prop] === undefined) { - obj[prop] = value; +/** @type {CharHandler} */ +const consumeComma = (input, pos, callbacks) => { + pos++; + if (callbacks.comma !== undefined) { + return callbacks.comma(input, pos - 1, pos); } + return pos; }; -/** - * Sets a dynamic default value when undefined, by calling the factory function - * @template T - * @template {keyof T} P - * @param {T} obj an object - * @param {P} prop a property of this object - * @param {function(): T[P]} factory a default value factory for the property - * @returns {void} - */ -const F = (obj, prop, factory) => { - if (obj[prop] === undefined) { - obj[prop] = factory(); +const _consumeIdentifier = (input, pos) => { + for (;;) { + const cc = input.charCodeAt(pos); + if (cc === CC_BACK_SLASH) { + pos++; + if (pos === input.length) return pos; + pos++; + } else if ( + _isIdentifierStartCode(cc) || + _isDigit(cc) || + cc === CC_HYPHEN_MINUS + ) { + pos++; + } else { + return pos; + } } }; -/** - * Sets a dynamic default value when undefined, by calling the factory function. - * factory must return an array or undefined - * When the current value is already an array an contains "..." it's replaced with - * the result of the factory function - * @template T - * @template {keyof T} P - * @param {T} obj an object - * @param {P} prop a property of this object - * @param {function(): T[P]} factory a default value factory for the property - * @returns {void} - */ -const A = (obj, prop, factory) => { - const value = obj[prop]; - if (value === undefined) { - obj[prop] = factory(); - } else if (Array.isArray(value)) { - /** @type {any[]} */ - let newArray = undefined; - for (let i = 0; i < value.length; i++) { - const item = value[i]; - if (item === "...") { - if (newArray === undefined) { - newArray = value.slice(0, i); - obj[prop] = /** @type {T[P]} */ (/** @type {unknown} */ (newArray)); - } - const items = /** @type {any[]} */ (/** @type {unknown} */ (factory())); - if (items !== undefined) { - for (const item of items) { - newArray.push(item); - } +const _consumeNumber = (input, pos) => { + pos++; + if (pos === input.length) return pos; + let cc = input.charCodeAt(pos); + while (_isDigit(cc)) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + } + if (cc === CC_FULL_STOP && pos + 1 !== input.length) { + const next = input.charCodeAt(pos + 1); + if (_isDigit(next)) { + pos += 2; + cc = input.charCodeAt(pos); + while (_isDigit(cc)) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + } + } + } + if (cc === CC_LOWER_E || cc === CC_UPPER_E) { + if (pos + 1 !== input.length) { + const next = input.charCodeAt(pos + 2); + if (_isDigit(next)) { + pos += 2; + } else if ( + (next === CC_HYPHEN_MINUS || next === CC_PLUS_SIGN) && + pos + 2 !== input.length + ) { + const next = input.charCodeAt(pos + 2); + if (_isDigit(next)) { + pos += 3; + } else { + return pos; } - } else if (newArray !== undefined) { - newArray.push(item); + } else { + return pos; } } + } else { + return pos; + } + cc = input.charCodeAt(pos); + while (_isDigit(cc)) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); } + return pos; }; -/** - * @param {WebpackOptions} options options to be modified - * @returns {void} - */ -const applyWebpackOptionsBaseDefaults = options => { - F(options, "context", () => process.cwd()); - applyInfrastructureLoggingDefaults(options.infrastructureLogging); +/** @type {CharHandler} */ +const consumeLessThan = (input, pos, callbacks) => { + if (input.slice(pos + 1, pos + 4) === "!--") return pos + 4; + return pos + 1; }; -/** - * @param {WebpackOptions} options options to be modified - * @returns {void} - */ -const applyWebpackOptionsDefaults = options => { - F(options, "context", () => process.cwd()); - F(options, "target", () => { - return getDefaultTarget(options.context); - }); - - const { mode, name, target } = options; - - let targetProperties = - target === false - ? /** @type {false} */ (false) - : typeof target === "string" - ? getTargetProperties(target, options.context) - : getTargetsProperties(target, options.context); - - const development = mode === "development"; - const production = mode === "production" || !mode; +/** @type {CharHandler} */ +const consumeAt = (input, pos, callbacks) => { + const start = pos; + pos++; + if (pos === input.length) return pos; + if (_startsIdentifier(input, pos)) { + pos = _consumeIdentifier(input, pos); + if (callbacks.atKeyword !== undefined) { + pos = callbacks.atKeyword(input, start, pos); + } + } + return pos; +}; - if (typeof options.entry !== "function") { - for (const key of Object.keys(options.entry)) { - F( - options.entry[key], - "import", - () => /** @type {[string]} */ (["./src"]) - ); +const CHAR_MAP = Array.from({ length: 0x80 }, (_, cc) => { + // https://drafts.csswg.org/css-syntax/#consume-token + switch (cc) { + case CC_LINE_FEED: + case CC_CARRIAGE_RETURN: + case CC_FORM_FEED: + case CC_TAB: + case CC_SPACE: + return consumeSpace; + case CC_QUOTATION_MARK: + case CC_APOSTROPHE: + return consumeString(cc); + case CC_NUMBER_SIGN: + return consumeNumberSign; + case CC_SLASH: + return consumePotentialComment; + // case CC_LEFT_SQUARE: + // case CC_RIGHT_SQUARE: + // case CC_COMMA: + // case CC_COLON: + // return consumeSingleCharToken; + case CC_COMMA: + return consumeComma; + case CC_SEMICOLON: + return consumeSemicolon; + case CC_LEFT_PARENTHESIS: + return consumeLeftParenthesis; + case CC_RIGHT_PARENTHESIS: + return consumeRightParenthesis; + case CC_LEFT_CURLY: + return consumeLeftCurlyBracket; + case CC_RIGHT_CURLY: + return consumeRightCurlyBracket; + case CC_COLON: + return consumePotentialPseudo; + case CC_PLUS_SIGN: + return consumeNumericToken; + case CC_FULL_STOP: + return consumeDot; + case CC_HYPHEN_MINUS: + return consumeMinus; + case CC_LESS_THAN_SIGN: + return consumeLessThan; + case CC_AT_SIGN: + return consumeAt; + case CC_LOWER_U: + return consumePotentialUrl; + case CC_LOW_LINE: + return consumeOtherIdentifier; + default: + if (_isDigit(cc)) return consumeNumericToken; + if ( + (cc >= CC_LOWER_A && cc <= CC_LOWER_Z) || + (cc >= CC_UPPER_A && cc <= CC_UPPER_Z) + ) { + return consumeOtherIdentifier; + } + return consumeSingleCharToken; + } +}); + +/** + * @param {string} input input css + * @param {CssTokenCallbacks} callbacks callbacks + * @returns {void} + */ +module.exports = (input, callbacks) => { + let pos = 0; + while (pos < input.length) { + const cc = input.charCodeAt(pos); + if (cc < 0x80) { + pos = CHAR_MAP[cc](input, pos, callbacks); + } else { + pos++; } } +}; - F(options, "devtool", () => (development ? "eval" : false)); - D(options, "watch", false); - D(options, "profile", false); - D(options, "parallelism", 100); - D(options, "recordsInputPath", false); - D(options, "recordsOutputPath", false); +module.exports.eatComments = (input, pos) => { + loop: for (;;) { + const cc = input.charCodeAt(pos); + if (cc === CC_SLASH) { + if (pos === input.length) return pos; + let cc = input.charCodeAt(pos + 1); + if (cc !== CC_ASTERISK) return pos; + pos++; + for (;;) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + while (cc === CC_ASTERISK) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + if (cc === CC_SLASH) { + pos++; + continue loop; + } + } + } + } + return pos; + } +}; - applyExperimentsDefaults(options.experiments, { - production, - development, - targetProperties - }); +module.exports.eatWhitespaceAndComments = (input, pos) => { + loop: for (;;) { + const cc = input.charCodeAt(pos); + if (cc === CC_SLASH) { + if (pos === input.length) return pos; + let cc = input.charCodeAt(pos + 1); + if (cc !== CC_ASTERISK) return pos; + pos++; + for (;;) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + while (cc === CC_ASTERISK) { + pos++; + if (pos === input.length) return pos; + cc = input.charCodeAt(pos); + if (cc === CC_SLASH) { + pos++; + continue loop; + } + } + } + } else if (_isWhiteSpace(cc)) { + pos++; + continue; + } + return pos; + } +}; - const futureDefaults = options.experiments.futureDefaults; - F(options, "cache", () => - development ? { type: /** @type {"memory"} */ ("memory") } : false - ); - applyCacheDefaults(options.cache, { - name: name || "default", - mode: mode || "production", - development, - cacheUnaffected: options.experiments.cacheUnaffected - }); - const cache = !!options.cache; +/***/ }), - applySnapshotDefaults(options.snapshot, { - production, - futureDefaults - }); +/***/ 2757: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - applyModuleDefaults(options.module, { - cache, - syncWebAssembly: options.experiments.syncWebAssembly, - asyncWebAssembly: options.experiments.asyncWebAssembly, - css: options.experiments.css, - futureDefaults - }); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ - applyOutputDefaults(options.output, { - context: options.context, - targetProperties, - isAffectedByBrowserslist: - target === undefined || - (typeof target === "string" && target.startsWith("browserslist")) || - (Array.isArray(target) && - target.some(target => target.startsWith("browserslist"))), - outputModule: options.experiments.outputModule, - development, - entry: options.entry, - module: options.module, - futureDefaults - }); - applyExternalsPresetsDefaults(options.externalsPresets, { - targetProperties, - buildHttp: !!options.experiments.buildHttp - }); - applyLoaderDefaults(options.loader, { targetProperties }); +const { Tracer } = __webpack_require__(5787); +const createSchemaValidation = __webpack_require__(32540); +const { dirname, mkdirpSync } = __webpack_require__(17139); - F(options, "externalsType", () => { - const validExternalTypes = (__webpack_require__(73342).definitions.ExternalsType["enum"]); - return options.output.library && - validExternalTypes.includes(options.output.library.type) - ? /** @type {ExternalsType} */ (options.output.library.type) - : options.output.module - ? "module" - : "var"; - }); +/** @typedef {import("../../declarations/plugins/debug/ProfilingPlugin").ProfilingPluginOptions} ProfilingPluginOptions */ +/** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */ - applyNodeDefaults(options.node, { - futureDefaults: options.experiments.futureDefaults, - targetProperties - }); +const validate = createSchemaValidation( + __webpack_require__(37134), + () => __webpack_require__(50686), + { + name: "Profiling Plugin", + baseDataPath: "options" + } +); +let inspector = undefined; - F(options, "performance", () => - production && - targetProperties && - (targetProperties.browser || targetProperties.browser === null) - ? {} - : false - ); - applyPerformanceDefaults(options.performance, { - production - }); +try { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + inspector = __webpack_require__(31405); +} catch (e) { + console.log("Unable to CPU profile in < node 8.0"); +} - applyOptimizationDefaults(options.optimization, { - development, - production, - css: options.experiments.css, - records: !!(options.recordsInputPath || options.recordsOutputPath) - }); +class Profiler { + constructor(inspector) { + this.session = undefined; + this.inspector = inspector; + this._startTime = 0; + } - options.resolve = cleverMerge( - getResolveDefaults({ - cache, - context: options.context, - targetProperties, - mode: options.mode - }), - options.resolve - ); + hasSession() { + return this.session !== undefined; + } - options.resolveLoader = cleverMerge( - getResolveLoaderDefaults({ cache }), - options.resolveLoader - ); -}; + startProfiling() { + if (this.inspector === undefined) { + return Promise.resolve(); + } -/** - * @param {ExperimentsNormalized} experiments options - * @param {Object} options options - * @param {boolean} options.production is production - * @param {boolean} options.development is development mode - * @param {TargetProperties | false} options.targetProperties target properties - * @returns {void} - */ -const applyExperimentsDefaults = ( - experiments, - { production, development, targetProperties } -) => { - D(experiments, "futureDefaults", false); - D(experiments, "backCompat", !experiments.futureDefaults); - D(experiments, "topLevelAwait", experiments.futureDefaults); - D(experiments, "syncWebAssembly", false); - D(experiments, "asyncWebAssembly", experiments.futureDefaults); - D(experiments, "outputModule", false); - D(experiments, "layers", false); - D(experiments, "lazyCompilation", undefined); - D(experiments, "buildHttp", undefined); - D(experiments, "cacheUnaffected", experiments.futureDefaults); - F(experiments, "css", () => (experiments.futureDefaults ? {} : undefined)); + try { + this.session = new inspector.Session(); + this.session.connect(); + } catch (_) { + this.session = undefined; + return Promise.resolve(); + } - if (typeof experiments.buildHttp === "object") { - D(experiments.buildHttp, "frozen", production); - D(experiments.buildHttp, "upgrade", false); - } + const hrtime = process.hrtime(); + this._startTime = hrtime[0] * 1000000 + Math.round(hrtime[1] / 1000); - if (typeof experiments.css === "object") { - D( - experiments.css, - "exportsOnly", - !targetProperties || !targetProperties.document - ); + return Promise.all([ + this.sendCommand("Profiler.setSamplingInterval", { + interval: 100 + }), + this.sendCommand("Profiler.enable"), + this.sendCommand("Profiler.start") + ]); } -}; -/** - * @param {CacheOptions} cache options - * @param {Object} options options - * @param {string} options.name name - * @param {string} options.mode mode - * @param {boolean} options.development is development mode - * @param {boolean} options.cacheUnaffected the cacheUnaffected experiment is enabled - * @returns {void} - */ -const applyCacheDefaults = ( - cache, - { name, mode, development, cacheUnaffected } -) => { - if (cache === false) return; - switch (cache.type) { - case "filesystem": - F(cache, "name", () => name + "-" + mode); - D(cache, "version", ""); - F(cache, "cacheDirectory", () => { - const cwd = process.cwd(); - let dir = cwd; - for (;;) { - try { - if (fs.statSync(path.join(dir, "package.json")).isFile()) break; - // eslint-disable-next-line no-empty - } catch (e) {} - const parent = path.dirname(dir); - if (dir === parent) { - dir = undefined; - break; + sendCommand(method, params) { + if (this.hasSession()) { + return new Promise((res, rej) => { + return this.session.post(method, params, (err, params) => { + if (err !== null) { + rej(err); + } else { + res(params); } - dir = parent; - } - if (!dir) { - return path.resolve(cwd, ".cache/webpack"); - } else if (process.versions.pnp === "1") { - return path.resolve(dir, ".pnp/.cache/webpack"); - } else if (process.versions.pnp === "3") { - return path.resolve(dir, ".yarn/.cache/webpack"); - } else { - return path.resolve(dir, "node_modules/.cache/webpack"); - } + }); }); - F(cache, "cacheLocation", () => - path.resolve(cache.cacheDirectory, cache.name) - ); - D(cache, "hashAlgorithm", "md4"); - D(cache, "store", "pack"); - D(cache, "compression", false); - D(cache, "profile", false); - D(cache, "idleTimeout", 60000); - D(cache, "idleTimeoutForInitialStore", 5000); - D(cache, "idleTimeoutAfterLargeChanges", 1000); - D(cache, "maxMemoryGenerations", development ? 5 : Infinity); - D(cache, "maxAge", 1000 * 60 * 60 * 24 * 60); // 1 month - D(cache, "allowCollectingMemory", development); - D(cache, "memoryCacheUnaffected", development && cacheUnaffected); - D(cache.buildDependencies, "defaultWebpack", [ - path.resolve(__dirname, "..") + path.sep - ]); - break; - case "memory": - D(cache, "maxGenerations", Infinity); - D(cache, "cacheUnaffected", development && cacheUnaffected); - break; + } else { + return Promise.resolve(); + } } -}; -/** - * @param {SnapshotOptions} snapshot options - * @param {Object} options options - * @param {boolean} options.production is production - * @param {boolean} options.futureDefaults is future defaults enabled - * @returns {void} - */ -const applySnapshotDefaults = (snapshot, { production, futureDefaults }) => { - if (futureDefaults) { - F(snapshot, "managedPaths", () => - process.versions.pnp === "3" - ? [ - /^(.+?(?:[\\/]\.yarn[\\/]unplugged[\\/][^\\/]+)?[\\/]node_modules[\\/])/ - ] - : [/^(.+?[\\/]node_modules[\\/])/] - ); - F(snapshot, "immutablePaths", () => - process.versions.pnp === "3" - ? [/^(.+?[\\/]cache[\\/][^\\/]+\.zip[\\/]node_modules[\\/])/] - : [] - ); - } else { - A(snapshot, "managedPaths", () => { - if (process.versions.pnp === "3") { - const match = - /^(.+?)[\\/]cache[\\/]watchpack-npm-[^\\/]+\.zip[\\/]node_modules[\\/]/.exec( - /*require.resolve*/(36871) - ); - if (match) { - return [path.resolve(match[1], "unplugged")]; - } - } else { - const match = /^(.+?[\\/]node_modules[\\/])/.exec( - // eslint-disable-next-line node/no-extraneous-require - /*require.resolve*/(36871) - ); - if (match) { - return [match[1]]; - } - } - return []; - }); - A(snapshot, "immutablePaths", () => { - if (process.versions.pnp === "1") { - const match = - /^(.+?[\\/]v4)[\\/]npm-watchpack-[^\\/]+-[\da-f]{40}[\\/]node_modules[\\/]/.exec( - /*require.resolve*/(36871) - ); - if (match) { - return [match[1]]; - } - } else if (process.versions.pnp === "3") { - const match = - /^(.+?)[\\/]watchpack-npm-[^\\/]+\.zip[\\/]node_modules[\\/]/.exec( - /*require.resolve*/(36871) - ); - if (match) { - return [match[1]]; - } + destroy() { + if (this.hasSession()) { + this.session.disconnect(); + } + + return Promise.resolve(); + } + + stopProfiling() { + return this.sendCommand("Profiler.stop").then(({ profile }) => { + const hrtime = process.hrtime(); + const endTime = hrtime[0] * 1000000 + Math.round(hrtime[1] / 1000); + if (profile.startTime < this._startTime || profile.endTime > endTime) { + // In some cases timestamps mismatch and we need to adjust them + // Both process.hrtime and the inspector timestamps claim to be relative + // to a unknown point in time. But they do not guarantee that this is the + // same point in time. + const duration = profile.endTime - profile.startTime; + const ownDuration = endTime - this._startTime; + const untracked = Math.max(0, ownDuration - duration); + profile.startTime = this._startTime + untracked / 2; + profile.endTime = endTime - untracked / 2; } - return []; + return { profile }; }); } - F(snapshot, "resolveBuildDependencies", () => ({ - timestamp: true, - hash: true - })); - F(snapshot, "buildDependencies", () => ({ timestamp: true, hash: true })); - F(snapshot, "module", () => - production ? { timestamp: true, hash: true } : { timestamp: true } - ); - F(snapshot, "resolve", () => - production ? { timestamp: true, hash: true } : { timestamp: true } - ); -}; +} /** - * @param {JavascriptParserOptions} parserOptions parser options - * @param {Object} options options - * @param {boolean} options.futureDefaults is future defaults enabled - * @returns {void} - */ -const applyJavascriptParserOptionsDefaults = ( - parserOptions, - { futureDefaults } -) => { - D(parserOptions, "unknownContextRequest", "."); - D(parserOptions, "unknownContextRegExp", false); - D(parserOptions, "unknownContextRecursive", true); - D(parserOptions, "unknownContextCritical", true); - D(parserOptions, "exprContextRequest", "."); - D(parserOptions, "exprContextRegExp", false); - D(parserOptions, "exprContextRecursive", true); - D(parserOptions, "exprContextCritical", true); - D(parserOptions, "wrappedContextRegExp", /.*/); - D(parserOptions, "wrappedContextRecursive", true); - D(parserOptions, "wrappedContextCritical", false); - D(parserOptions, "strictThisContextOnImports", false); - D(parserOptions, "importMeta", true); - if (futureDefaults) D(parserOptions, "exportsPresence", "error"); -}; + * an object that wraps Tracer and Profiler with a counter + * @typedef {Object} Trace + * @property {Tracer} trace instance of Tracer + * @property {number} counter Counter + * @property {Profiler} profiler instance of Profiler + * @property {Function} end the end function + */ /** - * @param {ModuleOptions} module options - * @param {Object} options options - * @param {boolean} options.cache is caching enabled - * @param {boolean} options.syncWebAssembly is syncWebAssembly enabled - * @param {boolean} options.asyncWebAssembly is asyncWebAssembly enabled - * @param {CssExperimentOptions} options.css is css enabled - * @param {boolean} options.futureDefaults is future defaults enabled - * @returns {void} + * @param {IntermediateFileSystem} fs filesystem used for output + * @param {string} outputPath The location where to write the log. + * @returns {Trace} The trace object */ -const applyModuleDefaults = ( - module, - { cache, syncWebAssembly, asyncWebAssembly, css, futureDefaults } -) => { - if (cache) { - D(module, "unsafeCache", module => { - const name = module.nameForCondition(); - return name && NODE_MODULES_REGEXP.test(name); - }); - } else { - D(module, "unsafeCache", false); - } - - F(module.parser, "asset", () => ({})); - F(module.parser.asset, "dataUrlCondition", () => ({})); - if (typeof module.parser.asset.dataUrlCondition === "object") { - D(module.parser.asset.dataUrlCondition, "maxSize", 8096); +const createTrace = (fs, outputPath) => { + const trace = new Tracer(); + const profiler = new Profiler(inspector); + if (/\/|\\/.test(outputPath)) { + const dirPath = dirname(fs, outputPath); + mkdirpSync(fs, dirPath); } + const fsStream = fs.createWriteStream(outputPath); - F(module.parser, "javascript", () => ({})); - applyJavascriptParserOptionsDefaults(module.parser.javascript, { - futureDefaults - }); + let counter = 0; - A(module, "defaultRules", () => { - const esm = { - type: "javascript/esm", - resolve: { - byDependency: { - esm: { - fullySpecified: true - } - } - } - }; - const commonjs = { - type: "javascript/dynamic" - }; - /** @type {RuleSetRules} */ - const rules = [ - { - mimetype: "application/node", - type: "javascript/auto" - }, - { - test: /\.json$/i, - type: "json" - }, - { - mimetype: "application/json", - type: "json" - }, - { - test: /\.mjs$/i, - ...esm - }, - { - test: /\.js$/i, - descriptionData: { - type: "module" - }, - ...esm - }, - { - test: /\.cjs$/i, - ...commonjs - }, - { - test: /\.js$/i, - descriptionData: { - type: "commonjs" - }, - ...commonjs - }, - { - mimetype: { - or: ["text/javascript", "application/javascript"] - }, - ...esm - } - ]; - if (asyncWebAssembly) { - const wasm = { - type: "webassembly/async", - rules: [ - { - descriptionData: { - type: "module" - }, - resolve: { - fullySpecified: true - } - } - ] - }; - rules.push({ - test: /\.wasm$/i, - ...wasm - }); - rules.push({ - mimetype: "application/wasm", - ...wasm - }); - } else if (syncWebAssembly) { - const wasm = { - type: "webassembly/sync", - rules: [ - { - descriptionData: { - type: "module" - }, - resolve: { - fullySpecified: true - } - } - ] - }; - rules.push({ - test: /\.wasm$/i, - ...wasm - }); - rules.push({ - mimetype: "application/wasm", - ...wasm - }); - } - if (css) { - const cssRule = { - type: "css", - resolve: { - fullySpecified: true, - preferRelative: true - } - }; - const cssModulesRule = { - type: "css/module", - resolve: { - fullySpecified: true - } - }; - rules.push({ - test: /\.css$/i, - oneOf: [ - { - test: /\.module\.css$/i, - ...cssModulesRule - }, + trace.pipe(fsStream); + // These are critical events that need to be inserted so that tools like + // chrome dev tools can load the profile. + trace.instantEvent({ + name: "TracingStartedInPage", + id: ++counter, + cat: ["disabled-by-default-devtools.timeline"], + args: { + data: { + sessionId: "-1", + page: "0xfff", + frames: [ { - ...cssRule + frame: "0xfff", + url: "webpack", + name: "" } ] - }); - rules.push({ - mimetype: "text/css+module", - ...cssModulesRule - }); - rules.push({ - mimetype: "text/css", - ...cssRule - }); + } } - rules.push( - { - dependency: "url", - oneOf: [ - { - scheme: /^data$/, - type: "asset/inline" - }, - { - type: "asset/resource" - } - ] - }, - { - assert: { type: "json" }, - type: "json" + }); + + trace.instantEvent({ + name: "TracingStartedInBrowser", + id: ++counter, + cat: ["disabled-by-default-devtools.timeline"], + args: { + data: { + sessionId: "-1" } - ); - return rules; + } }); + + return { + trace, + counter, + profiler, + end: callback => { + trace.push("]"); + // Wait until the write stream finishes. + fsStream.on("close", () => { + callback(); + }); + // Tear down the readable trace stream. + trace.push(null); + } + }; }; -/** - * @param {Output} output options - * @param {Object} options options - * @param {string} options.context context - * @param {TargetProperties | false} options.targetProperties target properties - * @param {boolean} options.isAffectedByBrowserslist is affected by browserslist - * @param {boolean} options.outputModule is outputModule experiment enabled - * @param {boolean} options.development is development mode - * @param {Entry} options.entry entry option - * @param {ModuleOptions} options.module module option - * @param {boolean} options.futureDefaults is future defaults enabled - * @returns {void} - */ -const applyOutputDefaults = ( - output, - { - context, - targetProperties: tp, - isAffectedByBrowserslist, - outputModule, - development, - entry, - module, - futureDefaults - } -) => { +const pluginName = "ProfilingPlugin"; + +class ProfilingPlugin { /** - * @param {Library=} library the library option - * @returns {string} a readable library name + * @param {ProfilingPluginOptions=} options options object */ - const getLibraryName = library => { - const libraryName = - typeof library === "object" && - library && - !Array.isArray(library) && - "type" in library - ? library.name - : /** @type {LibraryName=} */ (library); - if (Array.isArray(libraryName)) { - return libraryName.join("."); - } else if (typeof libraryName === "object") { - return getLibraryName(libraryName.root); - } else if (typeof libraryName === "string") { - return libraryName; - } - return ""; - }; + constructor(options = {}) { + validate(options); + this.outputPath = options.outputPath || "events.json"; + } - F(output, "uniqueName", () => { - const libraryName = getLibraryName(output.library); - if (libraryName) return libraryName; - const pkgPath = path.resolve(context, "package.json"); - try { - const packageInfo = JSON.parse(fs.readFileSync(pkgPath, "utf-8")); - return packageInfo.name || ""; - } catch (e) { - if (e.code !== "ENOENT") { - e.message += `\nwhile determining default 'output.uniqueName' from 'name' in ${pkgPath}`; - throw e; + apply(compiler) { + const tracer = createTrace( + compiler.intermediateFileSystem, + this.outputPath + ); + tracer.profiler.startProfiling(); + + // Compiler Hooks + Object.keys(compiler.hooks).forEach(hookName => { + const hook = compiler.hooks[hookName]; + if (hook) { + hook.intercept(makeInterceptorFor("Compiler", tracer)(hookName)); } - return ""; - } - }); + }); - F(output, "module", () => !!outputModule); - D(output, "filename", output.module ? "[name].mjs" : "[name].js"); - F(output, "iife", () => !output.module); - D(output, "importFunctionName", "import"); - D(output, "importMetaName", "import.meta"); - F(output, "chunkFilename", () => { - const filename = output.filename; - if (typeof filename !== "function") { - const hasName = filename.includes("[name]"); - const hasId = filename.includes("[id]"); - const hasChunkHash = filename.includes("[chunkhash]"); - const hasContentHash = filename.includes("[contenthash]"); - // Anything changing depending on chunk is fine - if (hasChunkHash || hasContentHash || hasName || hasId) return filename; - // Otherwise prefix "[id]." in front of the basename to make it changing - return filename.replace(/(^|\/)([^/]*(?:\?|$))/, "$1[id].$2"); - } - return output.module ? "[id].mjs" : "[id].js"; - }); - F(output, "cssFilename", () => { - const filename = output.filename; - if (typeof filename !== "function") { - return filename.replace(/\.[mc]?js(\?|$)/, ".css$1"); - } - return "[id].css"; - }); - F(output, "cssChunkFilename", () => { - const chunkFilename = output.chunkFilename; - if (typeof chunkFilename !== "function") { - return chunkFilename.replace(/\.[mc]?js(\?|$)/, ".css$1"); - } - return "[id].css"; - }); - D(output, "assetModuleFilename", "[hash][ext][query]"); - D(output, "webassemblyModuleFilename", "[hash].module.wasm"); - D(output, "compareBeforeEmit", true); - D(output, "charset", true); - F(output, "hotUpdateGlobal", () => - Template.toIdentifier( - "webpackHotUpdate" + Template.toIdentifier(output.uniqueName) - ) - ); - F(output, "chunkLoadingGlobal", () => - Template.toIdentifier( - "webpackChunk" + Template.toIdentifier(output.uniqueName) - ) - ); - F(output, "globalObject", () => { - if (tp) { - if (tp.global) return "global"; - if (tp.globalThis) return "globalThis"; - } - return "self"; - }); - F(output, "chunkFormat", () => { - if (tp) { - const helpMessage = isAffectedByBrowserslist - ? "Make sure that your 'browserslist' includes only platforms that support these features or select an appropriate 'target' to allow selecting a chunk format by default. Alternatively specify the 'output.chunkFormat' directly." - : "Select an appropriate 'target' to allow selecting one by default, or specify the 'output.chunkFormat' directly."; - if (output.module) { - if (tp.dynamicImport) return "module"; - if (tp.document) return "array-push"; - throw new Error( - "For the selected environment is no default ESM chunk format available:\n" + - "ESM exports can be chosen when 'import()' is available.\n" + - "JSONP Array push can be chosen when 'document' is available.\n" + - helpMessage + Object.keys(compiler.resolverFactory.hooks).forEach(hookName => { + const hook = compiler.resolverFactory.hooks[hookName]; + if (hook) { + hook.intercept(makeInterceptorFor("Resolver", tracer)(hookName)); + } + }); + + compiler.hooks.compilation.tap( + pluginName, + (compilation, { normalModuleFactory, contextModuleFactory }) => { + interceptAllHooksFor(compilation, tracer, "Compilation"); + interceptAllHooksFor( + normalModuleFactory, + tracer, + "Normal Module Factory" ); - } else { - if (tp.document) return "array-push"; - if (tp.require) return "commonjs"; - if (tp.nodeBuiltins) return "commonjs"; - if (tp.importScripts) return "array-push"; - throw new Error( - "For the selected environment is no default script chunk format available:\n" + - "JSONP Array push can be chosen when 'document' or 'importScripts' is available.\n" + - "CommonJs exports can be chosen when 'require' or node builtins are available.\n" + - helpMessage + interceptAllHooksFor( + contextModuleFactory, + tracer, + "Context Module Factory" ); + interceptAllParserHooks(normalModuleFactory, tracer); + interceptAllJavascriptModulesPluginHooks(compilation, tracer); } - } - throw new Error( - "Chunk format can't be selected by default when no target is specified" ); - }); - D(output, "asyncChunks", true); - F(output, "chunkLoading", () => { - if (tp) { - switch (output.chunkFormat) { - case "array-push": - if (tp.document) return "jsonp"; - if (tp.importScripts) return "import-scripts"; - break; - case "commonjs": - if (tp.require) return "require"; - if (tp.nodeBuiltins) return "async-node"; - break; - case "module": - if (tp.dynamicImport) return "import"; - break; - } - if ( - tp.require === null || - tp.nodeBuiltins === null || - tp.document === null || - tp.importScripts === null - ) { - return "universal"; - } - } - return false; - }); - F(output, "workerChunkLoading", () => { - if (tp) { - switch (output.chunkFormat) { - case "array-push": - if (tp.importScriptsInWorker) return "import-scripts"; - break; - case "commonjs": - if (tp.require) return "require"; - if (tp.nodeBuiltins) return "async-node"; - break; - case "module": - if (tp.dynamicImportInWorker) return "import"; - break; - } - if ( - tp.require === null || - tp.nodeBuiltins === null || - tp.importScriptsInWorker === null - ) { - return "universal"; - } - } - return false; - }); - F(output, "wasmLoading", () => { - if (tp) { - if (tp.fetchWasm) return "fetch"; - if (tp.nodeBuiltins) - return output.module ? "async-node-module" : "async-node"; - if (tp.nodeBuiltins === null || tp.fetchWasm === null) { - return "universal"; - } - } - return false; - }); - F(output, "workerWasmLoading", () => output.wasmLoading); - F(output, "devtoolNamespace", () => output.uniqueName); - if (output.library) { - F(output.library, "type", () => (output.module ? "module" : "var")); - } - F(output, "path", () => path.join(process.cwd(), "dist")); - F(output, "pathinfo", () => development); - D(output, "sourceMapFilename", "[file].map[query]"); - D( - output, - "hotUpdateChunkFilename", - `[id].[fullhash].hot-update.${output.module ? "mjs" : "js"}` - ); - D(output, "hotUpdateMainFilename", "[runtime].[fullhash].hot-update.json"); - D(output, "crossOriginLoading", false); - F(output, "scriptType", () => (output.module ? "module" : false)); - D( - output, - "publicPath", - (tp && (tp.document || tp.importScripts)) || output.scriptType === "module" - ? "auto" - : "" - ); - D(output, "chunkLoadTimeout", 120000); - D(output, "hashFunction", futureDefaults ? "xxhash64" : "md4"); - D(output, "hashDigest", "hex"); - D(output, "hashDigestLength", futureDefaults ? 16 : 20); - D(output, "strictModuleExceptionHandling", false); - const optimistic = v => v || v === undefined; - const conditionallyOptimistic = (v, c) => (v === undefined && c) || v; - F( - output.environment, - "arrowFunction", - () => tp && optimistic(tp.arrowFunction) - ); - F(output.environment, "const", () => tp && optimistic(tp.const)); - F( - output.environment, - "destructuring", - () => tp && optimistic(tp.destructuring) - ); - F(output.environment, "forOf", () => tp && optimistic(tp.forOf)); - F(output.environment, "bigIntLiteral", () => tp && tp.bigIntLiteral); - F(output.environment, "dynamicImport", () => - conditionallyOptimistic(tp && tp.dynamicImport, output.module) - ); - F(output.environment, "module", () => - conditionallyOptimistic(tp && tp.module, output.module) - ); + // We need to write out the CPU profile when we are all done. + compiler.hooks.done.tapAsync( + { + name: pluginName, + stage: Infinity + }, + (stats, callback) => { + if (compiler.watchMode) return callback(); + tracer.profiler.stopProfiling().then(parsedResults => { + if (parsedResults === undefined) { + tracer.profiler.destroy(); + tracer.end(callback); + return; + } - const { trustedTypes } = output; - if (trustedTypes) { - F( - trustedTypes, - "policyName", - () => - output.uniqueName.replace(/[^a-zA-Z0-9\-#=_/@.%]+/g, "_") || "webpack" + const cpuStartTime = parsedResults.profile.startTime; + const cpuEndTime = parsedResults.profile.endTime; + + tracer.trace.completeEvent({ + name: "TaskQueueManager::ProcessTaskFromWorkQueue", + id: ++tracer.counter, + cat: ["toplevel"], + ts: cpuStartTime, + args: { + src_file: "../../ipc/ipc_moji_bootstrap.cc", + src_func: "Accept" + } + }); + + tracer.trace.completeEvent({ + name: "EvaluateScript", + id: ++tracer.counter, + cat: ["devtools.timeline"], + ts: cpuStartTime, + dur: cpuEndTime - cpuStartTime, + args: { + data: { + url: "webpack", + lineNumber: 1, + columnNumber: 1, + frame: "0xFFF" + } + } + }); + + tracer.trace.instantEvent({ + name: "CpuProfile", + id: ++tracer.counter, + cat: ["disabled-by-default-devtools.timeline"], + ts: cpuEndTime, + args: { + data: { + cpuProfile: parsedResults.profile + } + } + }); + + tracer.profiler.destroy(); + tracer.end(callback); + }); + } ); } +} - /** - * @param {function(EntryDescription): void} fn iterator - * @returns {void} - */ - const forEachEntry = fn => { - for (const name of Object.keys(entry)) { - fn(entry[name]); - } - }; - A(output, "enabledLibraryTypes", () => { - const enabledLibraryTypes = []; - if (output.library) { - enabledLibraryTypes.push(output.library.type); - } - forEachEntry(desc => { - if (desc.library) { - enabledLibraryTypes.push(desc.library.type); +const interceptAllHooksFor = (instance, tracer, logLabel) => { + if (Reflect.has(instance, "hooks")) { + Object.keys(instance.hooks).forEach(hookName => { + const hook = instance.hooks[hookName]; + if (hook && !hook._fakeHook) { + hook.intercept(makeInterceptorFor(logLabel, tracer)(hookName)); } }); - return enabledLibraryTypes; - }); + } +}; - A(output, "enabledChunkLoadingTypes", () => { - const enabledChunkLoadingTypes = new Set(); - if (output.chunkLoading) { - enabledChunkLoadingTypes.add(output.chunkLoading); - } - if (output.workerChunkLoading) { - enabledChunkLoadingTypes.add(output.workerChunkLoading); - } - forEachEntry(desc => { - if (desc.chunkLoading) { - enabledChunkLoadingTypes.add(desc.chunkLoading); - } - }); - return Array.from(enabledChunkLoadingTypes); - }); +const interceptAllParserHooks = (moduleFactory, tracer) => { + const moduleTypes = [ + "javascript/auto", + "javascript/dynamic", + "javascript/esm", + "json", + "webassembly/async", + "webassembly/sync" + ]; - A(output, "enabledWasmLoadingTypes", () => { - const enabledWasmLoadingTypes = new Set(); - if (output.wasmLoading) { - enabledWasmLoadingTypes.add(output.wasmLoading); - } - if (output.workerWasmLoading) { - enabledWasmLoadingTypes.add(output.workerWasmLoading); - } - forEachEntry(desc => { - if (desc.wasmLoading) { - enabledWasmLoadingTypes.add(desc.wasmLoading); - } - }); - return Array.from(enabledWasmLoadingTypes); + moduleTypes.forEach(moduleType => { + moduleFactory.hooks.parser + .for(moduleType) + .tap("ProfilingPlugin", (parser, parserOpts) => { + interceptAllHooksFor(parser, tracer, "Parser"); + }); }); }; -/** - * @param {ExternalsPresets} externalsPresets options - * @param {Object} options options - * @param {TargetProperties | false} options.targetProperties target properties - * @param {boolean} options.buildHttp buildHttp experiment enabled - * @returns {void} - */ -const applyExternalsPresetsDefaults = ( - externalsPresets, - { targetProperties, buildHttp } -) => { - D( - externalsPresets, - "web", - !buildHttp && targetProperties && targetProperties.web - ); - D(externalsPresets, "node", targetProperties && targetProperties.node); - D(externalsPresets, "nwjs", targetProperties && targetProperties.nwjs); - D( - externalsPresets, - "electron", - targetProperties && targetProperties.electron - ); - D( - externalsPresets, - "electronMain", - targetProperties && - targetProperties.electron && - targetProperties.electronMain - ); - D( - externalsPresets, - "electronPreload", - targetProperties && - targetProperties.electron && - targetProperties.electronPreload - ); - D( - externalsPresets, - "electronRenderer", - targetProperties && - targetProperties.electron && - targetProperties.electronRenderer +const interceptAllJavascriptModulesPluginHooks = (compilation, tracer) => { + interceptAllHooksFor( + { + hooks: + (__webpack_require__(89464).getCompilationHooks)( + compilation + ) + }, + tracer, + "JavascriptModulesPlugin" ); }; -/** - * @param {Loader} loader options - * @param {Object} options options - * @param {TargetProperties | false} options.targetProperties target properties - * @returns {void} - */ -const applyLoaderDefaults = (loader, { targetProperties }) => { - F(loader, "target", () => { - if (targetProperties) { - if (targetProperties.electron) { - if (targetProperties.electronMain) return "electron-main"; - if (targetProperties.electronPreload) return "electron-preload"; - if (targetProperties.electronRenderer) return "electron-renderer"; - return "electron"; - } - if (targetProperties.nwjs) return "nwjs"; - if (targetProperties.node) return "node"; - if (targetProperties.web) return "web"; - } - }); -}; - -/** - * @param {WebpackNode} node options - * @param {Object} options options - * @param {TargetProperties | false} options.targetProperties target properties - * @param {boolean} options.futureDefaults is future defaults enabled - * @returns {void} - */ -const applyNodeDefaults = (node, { futureDefaults, targetProperties }) => { - if (node === false) return; +const makeInterceptorFor = (instance, tracer) => hookName => ({ + register: tapInfo => { + const { name, type, fn } = tapInfo; + const newFn = + // Don't tap our own hooks to ensure stream can close cleanly + name === pluginName + ? fn + : makeNewProfiledTapFn(hookName, tracer, { + name, + type, + fn + }); + return { + ...tapInfo, + fn: newFn + }; + } +}); - F(node, "global", () => { - if (targetProperties && targetProperties.global) return false; - // TODO webpack 6 should always default to false - return futureDefaults ? "warn" : true; - }); - F(node, "__filename", () => { - if (targetProperties && targetProperties.node) return "eval-only"; - // TODO webpack 6 should always default to false - return futureDefaults ? "warn-mock" : "mock"; - }); - F(node, "__dirname", () => { - if (targetProperties && targetProperties.node) return "eval-only"; - // TODO webpack 6 should always default to false - return futureDefaults ? "warn-mock" : "mock"; - }); -}; +// TODO improve typing +/** @typedef {(...args: TODO[]) => void | Promise} PluginFunction */ /** - * @param {Performance} performance options - * @param {Object} options options - * @param {boolean} options.production is production - * @returns {void} + * @param {string} hookName Name of the hook to profile. + * @param {Trace} tracer The trace object. + * @param {object} options Options for the profiled fn. + * @param {string} options.name Plugin name + * @param {string} options.type Plugin type (sync | async | promise) + * @param {PluginFunction} options.fn Plugin function + * @returns {PluginFunction} Chainable hooked function. */ -const applyPerformanceDefaults = (performance, { production }) => { - if (performance === false) return; - D(performance, "maxAssetSize", 250000); - D(performance, "maxEntrypointSize", 250000); - F(performance, "hints", () => (production ? "warning" : false)); -}; +const makeNewProfiledTapFn = (hookName, tracer, { name, type, fn }) => { + const defaultCategory = ["blink.user_timing"]; -/** - * @param {Optimization} optimization options - * @param {Object} options options - * @param {boolean} options.production is production - * @param {boolean} options.development is development - * @param {CssExperimentOptions} options.css is css enabled - * @param {boolean} options.records using records - * @returns {void} - */ -const applyOptimizationDefaults = ( - optimization, - { production, development, css, records } -) => { - D(optimization, "removeAvailableModules", false); - D(optimization, "removeEmptyChunks", true); - D(optimization, "mergeDuplicateChunks", true); - D(optimization, "flagIncludedChunks", production); - F(optimization, "moduleIds", () => { - if (production) return "deterministic"; - if (development) return "named"; - return "natural"; - }); - F(optimization, "chunkIds", () => { - if (production) return "deterministic"; - if (development) return "named"; - return "natural"; - }); - F(optimization, "sideEffects", () => (production ? true : "flag")); - D(optimization, "providedExports", true); - D(optimization, "usedExports", production); - D(optimization, "innerGraph", production); - D(optimization, "mangleExports", production); - D(optimization, "concatenateModules", production); - D(optimization, "runtimeChunk", false); - D(optimization, "emitOnErrors", !production); - D(optimization, "checkWasmTypes", production); - D(optimization, "mangleWasmImports", false); - D(optimization, "portableRecords", records); - D(optimization, "realContentHash", production); - D(optimization, "minimize", production); - A(optimization, "minimizer", () => [ - { - apply: compiler => { - // Lazy load the Terser plugin - const TerserPlugin = __webpack_require__(55302); - new TerserPlugin({ - terserOptions: { - compress: { - passes: 2 - } - } - }).apply(compiler); - } - } - ]); - F(optimization, "nodeEnv", () => { - if (production) return "production"; - if (development) return "development"; - return false; - }); - const { splitChunks } = optimization; - if (splitChunks) { - A(splitChunks, "defaultSizeTypes", () => - css ? ["javascript", "css", "unknown"] : ["javascript", "unknown"] - ); - D(splitChunks, "hidePathInfo", production); - D(splitChunks, "chunks", "async"); - D(splitChunks, "usedExports", optimization.usedExports === true); - D(splitChunks, "minChunks", 1); - F(splitChunks, "minSize", () => (production ? 20000 : 10000)); - F(splitChunks, "minRemainingSize", () => (development ? 0 : undefined)); - F(splitChunks, "enforceSizeThreshold", () => (production ? 50000 : 30000)); - F(splitChunks, "maxAsyncRequests", () => (production ? 30 : Infinity)); - F(splitChunks, "maxInitialRequests", () => (production ? 30 : Infinity)); - D(splitChunks, "automaticNameDelimiter", "-"); - const { cacheGroups } = splitChunks; - F(cacheGroups, "default", () => ({ - idHint: "", - reuseExistingChunk: true, - minChunks: 2, - priority: -20 - })); - F(cacheGroups, "defaultVendors", () => ({ - idHint: "vendors", - reuseExistingChunk: true, - test: NODE_MODULES_REGEXP, - priority: -10 - })); + switch (type) { + case "promise": + return (...args) => { + const id = ++tracer.counter; + tracer.trace.begin({ + name, + id, + cat: defaultCategory + }); + const promise = /** @type {Promise<*>} */ (fn(...args)); + return promise.then(r => { + tracer.trace.end({ + name, + id, + cat: defaultCategory + }); + return r; + }); + }; + case "async": + return (...args) => { + const id = ++tracer.counter; + tracer.trace.begin({ + name, + id, + cat: defaultCategory + }); + const callback = args.pop(); + fn(...args, (...r) => { + tracer.trace.end({ + name, + id, + cat: defaultCategory + }); + callback(...r); + }); + }; + case "sync": + return (...args) => { + const id = ++tracer.counter; + // Do not instrument ourself due to the CPU + // profile needing to be the last event in the trace. + if (name === pluginName) { + return fn(...args); + } + + tracer.trace.begin({ + name, + id, + cat: defaultCategory + }); + let r; + try { + r = fn(...args); + } catch (error) { + tracer.trace.end({ + name, + id, + cat: defaultCategory + }); + throw error; + } + tracer.trace.end({ + name, + id, + cat: defaultCategory + }); + return r; + }; + default: + break; } }; -/** - * @param {Object} options options - * @param {boolean} options.cache is cache enable - * @param {string} options.context build context - * @param {TargetProperties | false} options.targetProperties target properties - * @param {Mode} options.mode mode - * @returns {ResolveOptions} resolve options - */ -const getResolveDefaults = ({ cache, context, targetProperties, mode }) => { - /** @type {string[]} */ - const conditions = ["webpack"]; +module.exports = ProfilingPlugin; +module.exports.Profiler = Profiler; - conditions.push(mode === "development" ? "development" : "production"); - if (targetProperties) { - if (targetProperties.webworker) conditions.push("worker"); - if (targetProperties.node) conditions.push("node"); - if (targetProperties.web) conditions.push("browser"); - if (targetProperties.electron) conditions.push("electron"); - if (targetProperties.nwjs) conditions.push("nwjs"); - } +/***/ }), - const jsExtensions = [".js", ".json", ".wasm"]; +/***/ 96816: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const tp = targetProperties; - const browserField = - tp && tp.web && (!tp.node || (tp.electron && tp.electronRenderer)); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** @type {function(): ResolveOptions} */ - const cjsDeps = () => ({ - aliasFields: browserField ? ["browser"] : [], - mainFields: browserField ? ["browser", "module", "..."] : ["module", "..."], - conditionNames: ["require", "module", "..."], - extensions: [...jsExtensions] - }); - /** @type {function(): ResolveOptions} */ - const esmDeps = () => ({ - aliasFields: browserField ? ["browser"] : [], - mainFields: browserField ? ["browser", "module", "..."] : ["module", "..."], - conditionNames: ["import", "module", "..."], - extensions: [...jsExtensions] - }); - /** @type {ResolveOptions} */ - const resolveOptions = { - cache, - modules: ["node_modules"], - conditionNames: conditions, - mainFiles: ["index"], - extensions: [], - aliasFields: [], - exportsFields: ["exports"], - roots: [context], - mainFields: ["main"], - byDependency: { - wasm: esmDeps(), - esm: esmDeps(), - loaderImport: esmDeps(), - url: { - preferRelative: true - }, - worker: { - ...esmDeps(), - preferRelative: true - }, - commonjs: cjsDeps(), - amd: cjsDeps(), - // for backward-compat: loadModule - loader: cjsDeps(), - // for backward-compat: Custom Dependency - unknown: cjsDeps(), - // for backward-compat: getResolve without dependencyType - undefined: cjsDeps() - } - }; - return resolveOptions; -}; +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); -/** - * @param {Object} options options - * @param {boolean} options.cache is cache enable - * @returns {ResolveOptions} resolve options - */ -const getResolveLoaderDefaults = ({ cache }) => { - /** @type {ResolveOptions} */ - const resolveOptions = { - cache, - conditionNames: ["loader", "require", "node"], - exportsFields: ["exports"], - mainFields: ["loader", "main"], - extensions: [".js"], - mainFiles: ["index"] - }; +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ - return resolveOptions; +/** @type {Record} */ +const DEFINITIONS = { + f: { + definition: "var __WEBPACK_AMD_DEFINE_RESULT__;", + content: `!(__WEBPACK_AMD_DEFINE_RESULT__ = (#).call(exports, __webpack_require__, exports, module), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`, + requests: [ + RuntimeGlobals.require, + RuntimeGlobals.exports, + RuntimeGlobals.module + ] + }, + o: { + definition: "", + content: "!(module.exports = #)", + requests: [RuntimeGlobals.module] + }, + of: { + definition: + "var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;", + content: `!(__WEBPACK_AMD_DEFINE_FACTORY__ = (#), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : + __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`, + requests: [ + RuntimeGlobals.require, + RuntimeGlobals.exports, + RuntimeGlobals.module + ] + }, + af: { + definition: + "var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;", + content: `!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, __WEBPACK_AMD_DEFINE_RESULT__ = (#).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`, + requests: [RuntimeGlobals.exports, RuntimeGlobals.module] + }, + ao: { + definition: "", + content: "!(#, module.exports = #)", + requests: [RuntimeGlobals.module] + }, + aof: { + definition: + "var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;", + content: `!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, __WEBPACK_AMD_DEFINE_FACTORY__ = (#), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`, + requests: [RuntimeGlobals.exports, RuntimeGlobals.module] + }, + lf: { + definition: "var XXX, XXXmodule;", + content: + "!(XXXmodule = { id: YYY, exports: {}, loaded: false }, XXX = (#).call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule), XXXmodule.loaded = true, XXX === undefined && (XXX = XXXmodule.exports))", + requests: [RuntimeGlobals.require, RuntimeGlobals.module] + }, + lo: { + definition: "var XXX;", + content: "!(XXX = #)", + requests: [] + }, + lof: { + definition: "var XXX, XXXfactory, XXXmodule;", + content: + "!(XXXfactory = (#), (typeof XXXfactory === 'function' ? ((XXXmodule = { id: YYY, exports: {}, loaded: false }), (XXX = XXXfactory.call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule)), (XXXmodule.loaded = true), XXX === undefined && (XXX = XXXmodule.exports)) : XXX = XXXfactory))", + requests: [RuntimeGlobals.require, RuntimeGlobals.module] + }, + laf: { + definition: "var __WEBPACK_AMD_DEFINE_ARRAY__, XXX, XXXexports;", + content: + "!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, XXX = (#).apply(XXXexports = {}, __WEBPACK_AMD_DEFINE_ARRAY__), XXX === undefined && (XXX = XXXexports))", + requests: [] + }, + lao: { + definition: "var XXX;", + content: "!(#, XXX = #)", + requests: [] + }, + laof: { + definition: "var XXXarray, XXXfactory, XXXexports, XXX;", + content: `!(XXXarray = #, XXXfactory = (#), + (typeof XXXfactory === 'function' ? + ((XXX = XXXfactory.apply(XXXexports = {}, XXXarray)), XXX === undefined && (XXX = XXXexports)) : + (XXX = XXXfactory) + ))`, + requests: [] + } }; -/** - * @param {InfrastructureLogging} infrastructureLogging options - * @returns {void} - */ -const applyInfrastructureLoggingDefaults = infrastructureLogging => { - F(infrastructureLogging, "stream", () => process.stderr); - const tty = - /** @type {any} */ (infrastructureLogging.stream).isTTY && - process.env.TERM !== "dumb"; - D(infrastructureLogging, "level", "info"); - D(infrastructureLogging, "debug", false); - D(infrastructureLogging, "colors", tty); - D(infrastructureLogging, "appendOnly", !tty); +class AMDDefineDependency extends NullDependency { + constructor(range, arrayRange, functionRange, objectRange, namedModule) { + super(); + this.range = range; + this.arrayRange = arrayRange; + this.functionRange = functionRange; + this.objectRange = objectRange; + this.namedModule = namedModule; + this.localModule = null; + } + + get type() { + return "amd define"; + } + + serialize(context) { + const { write } = context; + write(this.range); + write(this.arrayRange); + write(this.functionRange); + write(this.objectRange); + write(this.namedModule); + write(this.localModule); + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + this.range = read(); + this.arrayRange = read(); + this.functionRange = read(); + this.objectRange = read(); + this.namedModule = read(); + this.localModule = read(); + super.deserialize(context); + } +} + +makeSerializable( + AMDDefineDependency, + "webpack/lib/dependencies/AMDDefineDependency" +); + +AMDDefineDependency.Template = class AMDDefineDependencyTemplate extends ( + NullDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply(dependency, source, { runtimeRequirements }) { + const dep = /** @type {AMDDefineDependency} */ (dependency); + const branch = this.branch(dep); + const { definition, content, requests } = DEFINITIONS[branch]; + for (const req of requests) { + runtimeRequirements.add(req); + } + this.replace(dep, source, definition, content); + } + + localModuleVar(dependency) { + return ( + dependency.localModule && + dependency.localModule.used && + dependency.localModule.variableName() + ); + } + + branch(dependency) { + const localModuleVar = this.localModuleVar(dependency) ? "l" : ""; + const arrayRange = dependency.arrayRange ? "a" : ""; + const objectRange = dependency.objectRange ? "o" : ""; + const functionRange = dependency.functionRange ? "f" : ""; + return localModuleVar + arrayRange + objectRange + functionRange; + } + + replace(dependency, source, definition, text) { + const localModuleVar = this.localModuleVar(dependency); + if (localModuleVar) { + text = text.replace(/XXX/g, localModuleVar.replace(/\$/g, "$$$$")); + definition = definition.replace( + /XXX/g, + localModuleVar.replace(/\$/g, "$$$$") + ); + } + + if (dependency.namedModule) { + text = text.replace(/YYY/g, JSON.stringify(dependency.namedModule)); + } + + const texts = text.split("#"); + + if (definition) source.insert(0, definition); + + let current = dependency.range[0]; + if (dependency.arrayRange) { + source.replace(current, dependency.arrayRange[0] - 1, texts.shift()); + current = dependency.arrayRange[1]; + } + + if (dependency.objectRange) { + source.replace(current, dependency.objectRange[0] - 1, texts.shift()); + current = dependency.objectRange[1]; + } else if (dependency.functionRange) { + source.replace(current, dependency.functionRange[0] - 1, texts.shift()); + current = dependency.functionRange[1]; + } + source.replace(current, dependency.range[1] - 1, texts.shift()); + if (texts.length > 0) throw new Error("Implementation error"); + } }; -exports.applyWebpackOptionsBaseDefaults = applyWebpackOptionsBaseDefaults; -exports.applyWebpackOptionsDefaults = applyWebpackOptionsDefaults; +module.exports = AMDDefineDependency; /***/ }), -/***/ 26693: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 48519: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -72615,533 +71013,359 @@ exports.applyWebpackOptionsDefaults = applyWebpackOptionsDefaults; -const util = __webpack_require__(73837); - -/** @typedef {import("../../declarations/WebpackOptions").EntryStatic} EntryStatic */ -/** @typedef {import("../../declarations/WebpackOptions").EntryStaticNormalized} EntryStaticNormalized */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryName} LibraryName */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").OptimizationRuntimeChunk} OptimizationRuntimeChunk */ -/** @typedef {import("../../declarations/WebpackOptions").OptimizationRuntimeChunkNormalized} OptimizationRuntimeChunkNormalized */ -/** @typedef {import("../../declarations/WebpackOptions").OutputNormalized} OutputNormalized */ -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptions} WebpackOptions */ -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptionsNormalized */ - -const handledDeprecatedNoEmitOnErrors = util.deprecate( - (noEmitOnErrors, emitOnErrors) => { - if (emitOnErrors !== undefined && !noEmitOnErrors === !emitOnErrors) { - throw new Error( - "Conflicting use of 'optimization.noEmitOnErrors' and 'optimization.emitOnErrors'. Remove deprecated 'optimization.noEmitOnErrors' from config." - ); - } - return !noEmitOnErrors; - }, - "optimization.noEmitOnErrors is deprecated in favor of optimization.emitOnErrors", - "DEP_WEBPACK_CONFIGURATION_OPTIMIZATION_NO_EMIT_ON_ERRORS" -); +const RuntimeGlobals = __webpack_require__(16475); +const AMDDefineDependency = __webpack_require__(96816); +const AMDRequireArrayDependency = __webpack_require__(33516); +const AMDRequireContextDependency = __webpack_require__(96123); +const AMDRequireItemDependency = __webpack_require__(71806); +const ConstDependency = __webpack_require__(76911); +const ContextDependencyHelpers = __webpack_require__(99630); +const DynamicExports = __webpack_require__(32006); +const LocalModuleDependency = __webpack_require__(52805); +const { addLocalModule, getLocalModule } = __webpack_require__(75827); -/** - * @template T - * @template R - * @param {T|undefined} value value or not - * @param {function(T): R} fn nested handler - * @returns {R} result value - */ -const nestedConfig = (value, fn) => - value === undefined ? fn(/** @type {T} */ ({})) : fn(value); +const isBoundFunctionExpression = expr => { + if (expr.type !== "CallExpression") return false; + if (expr.callee.type !== "MemberExpression") return false; + if (expr.callee.computed) return false; + if (expr.callee.object.type !== "FunctionExpression") return false; + if (expr.callee.property.type !== "Identifier") return false; + if (expr.callee.property.name !== "bind") return false; + return true; +}; -/** - * @template T - * @param {T|undefined} value value or not - * @returns {T} result value - */ -const cloneObject = value => { - return /** @type {T} */ ({ ...value }); +const isUnboundFunctionExpression = expr => { + if (expr.type === "FunctionExpression") return true; + if (expr.type === "ArrowFunctionExpression") return true; + return false; }; -/** - * @template T - * @template R - * @param {T|undefined} value value or not - * @param {function(T): R} fn nested handler - * @returns {R|undefined} result value - */ -const optionalNestedConfig = (value, fn) => - value === undefined ? undefined : fn(value); +const isCallable = expr => { + if (isUnboundFunctionExpression(expr)) return true; + if (isBoundFunctionExpression(expr)) return true; + return false; +}; -/** - * @template T - * @template R - * @param {T[]|undefined} value array or not - * @param {function(T[]): R[]} fn nested handler - * @returns {R[]|undefined} cloned value - */ -const nestedArray = (value, fn) => (Array.isArray(value) ? fn(value) : fn([])); +class AMDDefineDependencyParserPlugin { + constructor(options) { + this.options = options; + } -/** - * @template T - * @template R - * @param {T[]|undefined} value array or not - * @param {function(T[]): R[]} fn nested handler - * @returns {R[]|undefined} cloned value - */ -const optionalNestedArray = (value, fn) => - Array.isArray(value) ? fn(value) : undefined; + apply(parser) { + parser.hooks.call + .for("define") + .tap( + "AMDDefineDependencyParserPlugin", + this.processCallDefine.bind(this, parser) + ); + } -/** - * @template T - * @template R - * @param {Record|undefined} value value or not - * @param {function(T): R} fn nested handler - * @param {Record=} customKeys custom nested handler for some keys - * @returns {Record} result value - */ -const keyedNestedConfig = (value, fn, customKeys) => { - const result = - value === undefined - ? {} - : Object.keys(value).reduce( - (obj, key) => ( - (obj[key] = ( - customKeys && key in customKeys ? customKeys[key] : fn - )(value[key])), - obj - ), - /** @type {Record} */ ({}) - ); - if (customKeys) { - for (const key of Object.keys(customKeys)) { - if (!(key in result)) { - result[key] = customKeys[key](/** @type {T} */ ({})); + processArray(parser, expr, param, identifiers, namedModule) { + if (param.isArray()) { + param.items.forEach((param, idx) => { + if ( + param.isString() && + ["require", "module", "exports"].includes(param.string) + ) + identifiers[idx] = param.string; + const result = this.processItem(parser, expr, param, namedModule); + if (result === undefined) { + this.processContext(parser, expr, param); + } + }); + return true; + } else if (param.isConstArray()) { + const deps = []; + param.array.forEach((request, idx) => { + let dep; + let localModule; + if (request === "require") { + identifiers[idx] = request; + dep = "__webpack_require__"; + } else if (["exports", "module"].includes(request)) { + identifiers[idx] = request; + dep = request; + } else if ((localModule = getLocalModule(parser.state, request))) { + localModule.flagUsed(); + dep = new LocalModuleDependency(localModule, undefined, false); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + } else { + dep = this.newRequireItemDependency(request); + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + } + deps.push(dep); + }); + const dep = this.newRequireArrayDependency(deps, param.range); + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.module.addPresentationalDependency(dep); + return true; + } + } + processItem(parser, expr, param, namedModule) { + if (param.isConditional()) { + param.options.forEach(param => { + const result = this.processItem(parser, expr, param); + if (result === undefined) { + this.processContext(parser, expr, param); + } + }); + return true; + } else if (param.isString()) { + let dep, localModule; + if (param.string === "require") { + dep = new ConstDependency("__webpack_require__", param.range, [ + RuntimeGlobals.require + ]); + } else if (param.string === "exports") { + dep = new ConstDependency("exports", param.range, [ + RuntimeGlobals.exports + ]); + } else if (param.string === "module") { + dep = new ConstDependency("module", param.range, [ + RuntimeGlobals.module + ]); + } else if ( + (localModule = getLocalModule(parser.state, param.string, namedModule)) + ) { + localModule.flagUsed(); + dep = new LocalModuleDependency(localModule, param.range, false); + } else { + dep = this.newRequireItemDependency(param.string, param.range); + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; } + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; } } - return result; -}; - -/** - * @param {WebpackOptions} config input config - * @returns {WebpackOptionsNormalized} normalized options - */ -const getNormalizedWebpackOptions = config => { - return { - amd: config.amd, - bail: config.bail, - cache: optionalNestedConfig(config.cache, cache => { - if (cache === false) return false; - if (cache === true) { - return { - type: "memory", - maxGenerations: undefined - }; + processContext(parser, expr, param) { + const dep = ContextDependencyHelpers.create( + AMDRequireContextDependency, + param.range, + param, + expr, + this.options, + { + category: "amd" + }, + parser + ); + if (!dep) return; + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; + } + + processCallDefine(parser, expr) { + let array, fn, obj, namedModule; + switch (expr.arguments.length) { + case 1: + if (isCallable(expr.arguments[0])) { + // define(f() {…}) + fn = expr.arguments[0]; + } else if (expr.arguments[0].type === "ObjectExpression") { + // define({…}) + obj = expr.arguments[0]; + } else { + // define(expr) + // unclear if function or object + obj = fn = expr.arguments[0]; + } + break; + case 2: + if (expr.arguments[0].type === "Literal") { + namedModule = expr.arguments[0].value; + // define("…", …) + if (isCallable(expr.arguments[1])) { + // define("…", f() {…}) + fn = expr.arguments[1]; + } else if (expr.arguments[1].type === "ObjectExpression") { + // define("…", {…}) + obj = expr.arguments[1]; + } else { + // define("…", expr) + // unclear if function or object + obj = fn = expr.arguments[1]; + } + } else { + array = expr.arguments[0]; + if (isCallable(expr.arguments[1])) { + // define([…], f() {}) + fn = expr.arguments[1]; + } else if (expr.arguments[1].type === "ObjectExpression") { + // define([…], {…}) + obj = expr.arguments[1]; + } else { + // define([…], expr) + // unclear if function or object + obj = fn = expr.arguments[1]; + } + } + break; + case 3: + // define("…", […], f() {…}) + namedModule = expr.arguments[0].value; + array = expr.arguments[1]; + if (isCallable(expr.arguments[2])) { + // define("…", […], f() {}) + fn = expr.arguments[2]; + } else if (expr.arguments[2].type === "ObjectExpression") { + // define("…", […], {…}) + obj = expr.arguments[2]; + } else { + // define("…", […], expr) + // unclear if function or object + obj = fn = expr.arguments[2]; + } + break; + default: + return; + } + DynamicExports.bailout(parser.state); + let fnParams = null; + let fnParamsOffset = 0; + if (fn) { + if (isUnboundFunctionExpression(fn)) { + fnParams = fn.params; + } else if (isBoundFunctionExpression(fn)) { + fnParams = fn.callee.object.params; + fnParamsOffset = fn.arguments.length - 1; + if (fnParamsOffset < 0) { + fnParamsOffset = 0; + } } - switch (cache.type) { - case "filesystem": - return { - type: "filesystem", - allowCollectingMemory: cache.allowCollectingMemory, - maxMemoryGenerations: cache.maxMemoryGenerations, - maxAge: cache.maxAge, - profile: cache.profile, - buildDependencies: cloneObject(cache.buildDependencies), - cacheDirectory: cache.cacheDirectory, - cacheLocation: cache.cacheLocation, - hashAlgorithm: cache.hashAlgorithm, - compression: cache.compression, - idleTimeout: cache.idleTimeout, - idleTimeoutForInitialStore: cache.idleTimeoutForInitialStore, - idleTimeoutAfterLargeChanges: cache.idleTimeoutAfterLargeChanges, - name: cache.name, - store: cache.store, - version: cache.version - }; - case undefined: - case "memory": - return { - type: "memory", - maxGenerations: cache.maxGenerations - }; - default: - // @ts-expect-error Property 'type' does not exist on type 'never'. ts(2339) - throw new Error(`Not implemented cache.type ${cache.type}`); + } + let fnRenames = new Map(); + if (array) { + const identifiers = {}; + const param = parser.evaluateExpression(array); + const result = this.processArray( + parser, + expr, + param, + identifiers, + namedModule + ); + if (!result) return; + if (fnParams) { + fnParams = fnParams.slice(fnParamsOffset).filter((param, idx) => { + if (identifiers[idx]) { + fnRenames.set(param.name, parser.getVariableInfo(identifiers[idx])); + return false; + } + return true; + }); } - }), - context: config.context, - dependencies: config.dependencies, - devServer: optionalNestedConfig(config.devServer, devServer => ({ - ...devServer - })), - devtool: config.devtool, - entry: - config.entry === undefined - ? { main: {} } - : typeof config.entry === "function" - ? ( - fn => () => - Promise.resolve().then(fn).then(getNormalizedEntryStatic) - )(config.entry) - : getNormalizedEntryStatic(config.entry), - experiments: nestedConfig(config.experiments, experiments => ({ - ...experiments, - buildHttp: optionalNestedConfig(experiments.buildHttp, options => - Array.isArray(options) ? { allowedUris: options } : options - ), - lazyCompilation: optionalNestedConfig( - experiments.lazyCompilation, - options => - options === true ? {} : options === false ? undefined : options - ), - css: optionalNestedConfig(experiments.css, options => - options === true ? {} : options === false ? undefined : options - ) - })), - externals: config.externals, - externalsPresets: cloneObject(config.externalsPresets), - externalsType: config.externalsType, - ignoreWarnings: config.ignoreWarnings - ? config.ignoreWarnings.map(ignore => { - if (typeof ignore === "function") return ignore; - const i = ignore instanceof RegExp ? { message: ignore } : ignore; - return (warning, { requestShortener }) => { - if (!i.message && !i.module && !i.file) return false; - if (i.message && !i.message.test(warning.message)) { - return false; - } - if ( - i.module && - (!warning.module || - !i.module.test( - warning.module.readableIdentifier(requestShortener) - )) - ) { - return false; - } - if (i.file && (!warning.file || !i.file.test(warning.file))) { - return false; - } - return true; - }; - }) - : undefined, - infrastructureLogging: cloneObject(config.infrastructureLogging), - loader: cloneObject(config.loader), - mode: config.mode, - module: nestedConfig(config.module, module => ({ - noParse: module.noParse, - unsafeCache: module.unsafeCache, - parser: keyedNestedConfig(module.parser, cloneObject, { - javascript: parserOptions => ({ - unknownContextRequest: module.unknownContextRequest, - unknownContextRegExp: module.unknownContextRegExp, - unknownContextRecursive: module.unknownContextRecursive, - unknownContextCritical: module.unknownContextCritical, - exprContextRequest: module.exprContextRequest, - exprContextRegExp: module.exprContextRegExp, - exprContextRecursive: module.exprContextRecursive, - exprContextCritical: module.exprContextCritical, - wrappedContextRegExp: module.wrappedContextRegExp, - wrappedContextRecursive: module.wrappedContextRecursive, - wrappedContextCritical: module.wrappedContextCritical, - // TODO webpack 6 remove - strictExportPresence: module.strictExportPresence, - strictThisContextOnImports: module.strictThisContextOnImports, - ...parserOptions - }) - }), - generator: cloneObject(module.generator), - defaultRules: optionalNestedArray(module.defaultRules, r => [...r]), - rules: nestedArray(module.rules, r => [...r]) - })), - name: config.name, - node: nestedConfig( - config.node, - node => - node && { - ...node + } else { + const identifiers = ["require", "exports", "module"]; + if (fnParams) { + fnParams = fnParams.slice(fnParamsOffset).filter((param, idx) => { + if (identifiers[idx]) { + fnRenames.set(param.name, parser.getVariableInfo(identifiers[idx])); + return false; + } + return true; + }); + } + } + let inTry; + if (fn && isUnboundFunctionExpression(fn)) { + inTry = parser.scope.inTry; + parser.inScope(fnParams, () => { + for (const [name, varInfo] of fnRenames) { + parser.setVariable(name, varInfo); } - ), - optimization: nestedConfig(config.optimization, optimization => { - return { - ...optimization, - runtimeChunk: getNormalizedOptimizationRuntimeChunk( - optimization.runtimeChunk - ), - splitChunks: nestedConfig( - optimization.splitChunks, - splitChunks => - splitChunks && { - ...splitChunks, - defaultSizeTypes: splitChunks.defaultSizeTypes - ? [...splitChunks.defaultSizeTypes] - : ["..."], - cacheGroups: cloneObject(splitChunks.cacheGroups) - } + parser.scope.inTry = inTry; + if (fn.body.type === "BlockStatement") { + parser.detectMode(fn.body.body); + const prev = parser.prevStatement; + parser.preWalkStatement(fn.body); + parser.prevStatement = prev; + parser.walkStatement(fn.body); + } else { + parser.walkExpression(fn.body); + } + }); + } else if (fn && isBoundFunctionExpression(fn)) { + inTry = parser.scope.inTry; + parser.inScope( + fn.callee.object.params.filter( + i => !["require", "module", "exports"].includes(i.name) ), - emitOnErrors: - optimization.noEmitOnErrors !== undefined - ? handledDeprecatedNoEmitOnErrors( - optimization.noEmitOnErrors, - optimization.emitOnErrors - ) - : optimization.emitOnErrors - }; - }), - output: nestedConfig(config.output, output => { - const { library } = output; - const libraryAsName = /** @type {LibraryName} */ (library); - const libraryBase = - typeof library === "object" && - library && - !Array.isArray(library) && - "type" in library - ? library - : libraryAsName || output.libraryTarget - ? /** @type {LibraryOptions} */ ({ - name: libraryAsName - }) - : undefined; - /** @type {OutputNormalized} */ - const result = { - assetModuleFilename: output.assetModuleFilename, - asyncChunks: output.asyncChunks, - charset: output.charset, - chunkFilename: output.chunkFilename, - chunkFormat: output.chunkFormat, - chunkLoading: output.chunkLoading, - chunkLoadingGlobal: output.chunkLoadingGlobal, - chunkLoadTimeout: output.chunkLoadTimeout, - cssFilename: output.cssFilename, - cssChunkFilename: output.cssChunkFilename, - clean: output.clean, - compareBeforeEmit: output.compareBeforeEmit, - crossOriginLoading: output.crossOriginLoading, - devtoolFallbackModuleFilenameTemplate: - output.devtoolFallbackModuleFilenameTemplate, - devtoolModuleFilenameTemplate: output.devtoolModuleFilenameTemplate, - devtoolNamespace: output.devtoolNamespace, - environment: cloneObject(output.environment), - enabledChunkLoadingTypes: output.enabledChunkLoadingTypes - ? [...output.enabledChunkLoadingTypes] - : ["..."], - enabledLibraryTypes: output.enabledLibraryTypes - ? [...output.enabledLibraryTypes] - : ["..."], - enabledWasmLoadingTypes: output.enabledWasmLoadingTypes - ? [...output.enabledWasmLoadingTypes] - : ["..."], - filename: output.filename, - globalObject: output.globalObject, - hashDigest: output.hashDigest, - hashDigestLength: output.hashDigestLength, - hashFunction: output.hashFunction, - hashSalt: output.hashSalt, - hotUpdateChunkFilename: output.hotUpdateChunkFilename, - hotUpdateGlobal: output.hotUpdateGlobal, - hotUpdateMainFilename: output.hotUpdateMainFilename, - iife: output.iife, - importFunctionName: output.importFunctionName, - importMetaName: output.importMetaName, - scriptType: output.scriptType, - library: libraryBase && { - type: - output.libraryTarget !== undefined - ? output.libraryTarget - : libraryBase.type, - auxiliaryComment: - output.auxiliaryComment !== undefined - ? output.auxiliaryComment - : libraryBase.auxiliaryComment, - export: - output.libraryExport !== undefined - ? output.libraryExport - : libraryBase.export, - name: libraryBase.name, - umdNamedDefine: - output.umdNamedDefine !== undefined - ? output.umdNamedDefine - : libraryBase.umdNamedDefine - }, - module: output.module, - path: output.path, - pathinfo: output.pathinfo, - publicPath: output.publicPath, - sourceMapFilename: output.sourceMapFilename, - sourcePrefix: output.sourcePrefix, - strictModuleExceptionHandling: output.strictModuleExceptionHandling, - trustedTypes: optionalNestedConfig( - output.trustedTypes, - trustedTypes => { - if (trustedTypes === true) return {}; - if (typeof trustedTypes === "string") - return { policyName: trustedTypes }; - return { ...trustedTypes }; + () => { + for (const [name, varInfo] of fnRenames) { + parser.setVariable(name, varInfo); } - ), - uniqueName: output.uniqueName, - wasmLoading: output.wasmLoading, - webassemblyModuleFilename: output.webassemblyModuleFilename, - workerChunkLoading: output.workerChunkLoading, - workerWasmLoading: output.workerWasmLoading - }; - return result; - }), - parallelism: config.parallelism, - performance: optionalNestedConfig(config.performance, performance => { - if (performance === false) return false; - return { - ...performance - }; - }), - plugins: nestedArray(config.plugins, p => [...p]), - profile: config.profile, - recordsInputPath: - config.recordsInputPath !== undefined - ? config.recordsInputPath - : config.recordsPath, - recordsOutputPath: - config.recordsOutputPath !== undefined - ? config.recordsOutputPath - : config.recordsPath, - resolve: nestedConfig(config.resolve, resolve => ({ - ...resolve, - byDependency: keyedNestedConfig(resolve.byDependency, cloneObject) - })), - resolveLoader: cloneObject(config.resolveLoader), - snapshot: nestedConfig(config.snapshot, snapshot => ({ - resolveBuildDependencies: optionalNestedConfig( - snapshot.resolveBuildDependencies, - resolveBuildDependencies => ({ - timestamp: resolveBuildDependencies.timestamp, - hash: resolveBuildDependencies.hash - }) - ), - buildDependencies: optionalNestedConfig( - snapshot.buildDependencies, - buildDependencies => ({ - timestamp: buildDependencies.timestamp, - hash: buildDependencies.hash - }) - ), - resolve: optionalNestedConfig(snapshot.resolve, resolve => ({ - timestamp: resolve.timestamp, - hash: resolve.hash - })), - module: optionalNestedConfig(snapshot.module, module => ({ - timestamp: module.timestamp, - hash: module.hash - })), - immutablePaths: optionalNestedArray(snapshot.immutablePaths, p => [...p]), - managedPaths: optionalNestedArray(snapshot.managedPaths, p => [...p]) - })), - stats: nestedConfig(config.stats, stats => { - if (stats === false) { - return { - preset: "none" - }; - } - if (stats === true) { - return { - preset: "normal" - }; - } - if (typeof stats === "string") { - return { - preset: stats - }; + parser.scope.inTry = inTry; + if (fn.callee.object.body.type === "BlockStatement") { + parser.detectMode(fn.callee.object.body.body); + const prev = parser.prevStatement; + parser.preWalkStatement(fn.callee.object.body); + parser.prevStatement = prev; + parser.walkStatement(fn.callee.object.body); + } else { + parser.walkExpression(fn.callee.object.body); + } + } + ); + if (fn.arguments) { + parser.walkExpressions(fn.arguments); } - return { - ...stats - }; - }), - target: config.target, - watch: config.watch, - watchOptions: cloneObject(config.watchOptions) - }; -}; + } else if (fn || obj) { + parser.walkExpression(fn || obj); + } -/** - * @param {EntryStatic} entry static entry options - * @returns {EntryStaticNormalized} normalized static entry options - */ -const getNormalizedEntryStatic = entry => { - if (typeof entry === "string") { - return { - main: { - import: [entry] - } - }; - } - if (Array.isArray(entry)) { - return { - main: { - import: entry - } - }; - } - /** @type {EntryStaticNormalized} */ - const result = {}; - for (const key of Object.keys(entry)) { - const value = entry[key]; - if (typeof value === "string") { - result[key] = { - import: [value] - }; - } else if (Array.isArray(value)) { - result[key] = { - import: value - }; - } else { - result[key] = { - import: - value.import && - (Array.isArray(value.import) ? value.import : [value.import]), - filename: value.filename, - layer: value.layer, - runtime: value.runtime, - publicPath: value.publicPath, - chunkLoading: value.chunkLoading, - asyncChunks: value.asyncChunks, - wasmLoading: value.wasmLoading, - dependOn: - value.dependOn && - (Array.isArray(value.dependOn) ? value.dependOn : [value.dependOn]), - library: value.library - }; + const dep = this.newDefineDependency( + expr.range, + array ? array.range : null, + fn ? fn.range : null, + obj ? obj.range : null, + namedModule ? namedModule : null + ); + dep.loc = expr.loc; + if (namedModule) { + dep.localModule = addLocalModule(parser.state, namedModule); } + parser.state.module.addPresentationalDependency(dep); + return true; } - return result; -}; -/** - * @param {OptimizationRuntimeChunk=} runtimeChunk runtimeChunk option - * @returns {OptimizationRuntimeChunkNormalized=} normalized runtimeChunk option - */ -const getNormalizedOptimizationRuntimeChunk = runtimeChunk => { - if (runtimeChunk === undefined) return undefined; - if (runtimeChunk === false) return false; - if (runtimeChunk === "single") { - return { - name: () => "runtime" - }; + newDefineDependency( + range, + arrayRange, + functionRange, + objectRange, + namedModule + ) { + return new AMDDefineDependency( + range, + arrayRange, + functionRange, + objectRange, + namedModule + ); } - if (runtimeChunk === true || runtimeChunk === "multiple") { - return { - name: entrypoint => `runtime~${entrypoint.name}` - }; + newRequireArrayDependency(depsArray, range) { + return new AMDRequireArrayDependency(depsArray, range); } - const { name } = runtimeChunk; - return { - name: typeof name === "function" ? name : () => name - }; -}; - -exports.getNormalizedWebpackOptions = getNormalizedWebpackOptions; + newRequireItemDependency(request, range) { + return new AMDRequireItemDependency(request, range); + } +} +module.exports = AMDDefineDependencyParserPlugin; /***/ }), -/***/ 52801: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 50067: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -73151,1115 +71375,887 @@ exports.getNormalizedWebpackOptions = getNormalizedWebpackOptions; -const memoize = __webpack_require__(78676); - -const getBrowserslistTargetHandler = memoize(() => - __webpack_require__(43950) -); +const RuntimeGlobals = __webpack_require__(16475); +const { + approve, + evaluateToIdentifier, + evaluateToString, + toConstantDependency +} = __webpack_require__(93998); -/** - * @param {string} context the context directory - * @returns {string} default target - */ -const getDefaultTarget = context => { - const browsers = getBrowserslistTargetHandler().load(null, context); - return browsers ? "browserslist" : "web"; -}; +const AMDDefineDependency = __webpack_require__(96816); +const AMDDefineDependencyParserPlugin = __webpack_require__(48519); +const AMDRequireArrayDependency = __webpack_require__(33516); +const AMDRequireContextDependency = __webpack_require__(96123); +const AMDRequireDependenciesBlockParserPlugin = __webpack_require__(66866); +const AMDRequireDependency = __webpack_require__(43911); +const AMDRequireItemDependency = __webpack_require__(71806); +const { + AMDDefineRuntimeModule, + AMDOptionsRuntimeModule +} = __webpack_require__(45242); +const ConstDependency = __webpack_require__(76911); +const LocalModuleDependency = __webpack_require__(52805); +const UnsupportedDependency = __webpack_require__(51669); -/** - * @typedef {Object} PlatformTargetProperties - * @property {boolean | null} web web platform, importing of http(s) and std: is available - * @property {boolean | null} browser browser platform, running in a normal web browser - * @property {boolean | null} webworker (Web)Worker platform, running in a web/shared/service worker - * @property {boolean | null} node node platform, require of node built-in modules is available - * @property {boolean | null} nwjs nwjs platform, require of legacy nw.gui is available - * @property {boolean | null} electron electron platform, require of some electron built-in modules is available - */ +/** @typedef {import("../../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */ +/** @typedef {import("../Compiler")} Compiler */ -/** - * @typedef {Object} ElectronContextTargetProperties - * @property {boolean | null} electronMain in main context - * @property {boolean | null} electronPreload in preload context - * @property {boolean | null} electronRenderer in renderer context with node integration - */ +class AMDPlugin { + /** + * @param {Record} amdOptions the AMD options + */ + constructor(amdOptions) { + this.amdOptions = amdOptions; + } -/** - * @typedef {Object} ApiTargetProperties - * @property {boolean | null} require has require function available - * @property {boolean | null} nodeBuiltins has node.js built-in modules available - * @property {boolean | null} document has document available (allows script tags) - * @property {boolean | null} importScripts has importScripts available - * @property {boolean | null} importScriptsInWorker has importScripts available when creating a worker - * @property {boolean | null} fetchWasm has fetch function available for WebAssembly - * @property {boolean | null} global has global variable available - */ + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const amdOptions = this.amdOptions; + compiler.hooks.compilation.tap( + "AMDPlugin", + (compilation, { contextModuleFactory, normalModuleFactory }) => { + compilation.dependencyTemplates.set( + AMDRequireDependency, + new AMDRequireDependency.Template() + ); -/** - * @typedef {Object} EcmaTargetProperties - * @property {boolean | null} globalThis has globalThis variable available - * @property {boolean | null} bigIntLiteral big int literal syntax is available - * @property {boolean | null} const const and let variable declarations are available - * @property {boolean | null} arrowFunction arrow functions are available - * @property {boolean | null} forOf for of iteration is available - * @property {boolean | null} destructuring destructuring is available - * @property {boolean | null} dynamicImport async import() is available - * @property {boolean | null} dynamicImportInWorker async import() is available when creating a worker - * @property {boolean | null} module ESM syntax is available (when in module) - * @property {boolean | null} optionalChaining optional chaining is available - * @property {boolean | null} templateLiteral template literal is available - */ + compilation.dependencyFactories.set( + AMDRequireItemDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + AMDRequireItemDependency, + new AMDRequireItemDependency.Template() + ); -///** @typedef {PlatformTargetProperties | ApiTargetProperties | EcmaTargetProperties | PlatformTargetProperties & ApiTargetProperties | PlatformTargetProperties & EcmaTargetProperties | ApiTargetProperties & EcmaTargetProperties} TargetProperties */ -/** @template T @typedef {{ [P in keyof T]?: never }} Never */ -/** @template A @template B @typedef {(A & Never) | (Never & B) | (A & B)} Mix */ -/** @typedef {Mix, Mix>} TargetProperties */ + compilation.dependencyTemplates.set( + AMDRequireArrayDependency, + new AMDRequireArrayDependency.Template() + ); -const versionDependent = (major, minor) => { - if (!major) return () => /** @type {undefined} */ (undefined); - major = +major; - minor = minor ? +minor : 0; - return (vMajor, vMinor = 0) => { - return major > vMajor || (major === vMajor && minor >= vMinor); - }; -}; + compilation.dependencyFactories.set( + AMDRequireContextDependency, + contextModuleFactory + ); + compilation.dependencyTemplates.set( + AMDRequireContextDependency, + new AMDRequireContextDependency.Template() + ); -/** @type {[string, string, RegExp, (...args: string[]) => TargetProperties | false][]} */ -const TARGETS = [ - [ - "browserslist / browserslist:env / browserslist:query / browserslist:path-to-config / browserslist:path-to-config:env", - "Resolve features from browserslist. Will resolve browserslist config automatically. Only browser or node queries are supported (electron is not supported). Examples: 'browserslist:modern' to use 'modern' environment from browserslist config", - /^browserslist(?::(.+))?$/, - (rest, context) => { - const browserslistTargetHandler = getBrowserslistTargetHandler(); - const browsers = browserslistTargetHandler.load( - rest ? rest.trim() : null, - context - ); - if (!browsers) { - throw new Error(`No browserslist config found to handle the 'browserslist' target. -See https://github.com/browserslist/browserslist#queries for possible ways to provide a config. -The recommended way is to add a 'browserslist' key to your package.json and list supported browsers (resp. node.js versions). -You can also more options via the 'target' option: 'browserslist' / 'browserslist:env' / 'browserslist:query' / 'browserslist:path-to-config' / 'browserslist:path-to-config:env'`); - } - return browserslistTargetHandler.resolve(browsers); - } - ], - [ - "web", - "Web browser.", - /^web$/, - () => { - return { - web: true, - browser: true, - webworker: null, - node: false, - electron: false, - nwjs: false, + compilation.dependencyTemplates.set( + AMDDefineDependency, + new AMDDefineDependency.Template() + ); - document: true, - importScriptsInWorker: true, - fetchWasm: true, - nodeBuiltins: false, - importScripts: false, - require: false, - global: false - }; - } - ], - [ - "webworker", - "Web Worker, SharedWorker or Service Worker.", - /^webworker$/, - () => { - return { - web: true, - browser: true, - webworker: true, - node: false, - electron: false, - nwjs: false, + compilation.dependencyTemplates.set( + UnsupportedDependency, + new UnsupportedDependency.Template() + ); - importScripts: true, - importScriptsInWorker: true, - fetchWasm: true, - nodeBuiltins: false, - require: false, - document: false, - global: false - }; - } - ], - [ - "[async-]node[X[.Y]]", - "Node.js in version X.Y. The 'async-' prefix will load chunks asynchronously via 'fs' and 'vm' instead of 'require()'. Examples: node14.5, async-node10.", - /^(async-)?node(\d+(?:\.(\d+))?)?$/, - (asyncFlag, major, minor) => { - const v = versionDependent(major, minor); - // see https://node.green/ - return { - node: true, - electron: false, - nwjs: false, - web: false, - webworker: false, - browser: false, + compilation.dependencyTemplates.set( + LocalModuleDependency, + new LocalModuleDependency.Template() + ); - require: !asyncFlag, - nodeBuiltins: true, - global: true, - document: false, - fetchWasm: false, - importScripts: false, - importScriptsInWorker: false, + compilation.hooks.runtimeRequirementInModule + .for(RuntimeGlobals.amdDefine) + .tap("AMDPlugin", (module, set) => { + set.add(RuntimeGlobals.require); + }); - globalThis: v(12), - const: v(6), - templateLiteral: v(4), - optionalChaining: v(14), - arrowFunction: v(6), - forOf: v(5), - destructuring: v(6), - bigIntLiteral: v(10, 4), - dynamicImport: v(12, 17), - dynamicImportInWorker: major ? false : undefined, - module: v(12, 17) - }; - } - ], - [ - "electron[X[.Y]]-main/preload/renderer", - "Electron in version X.Y. Script is running in main, preload resp. renderer context.", - /^electron(\d+(?:\.(\d+))?)?-(main|preload|renderer)$/, - (major, minor, context) => { - const v = versionDependent(major, minor); - // see https://node.green/ + https://github.com/electron/releases - return { - node: true, - electron: true, - web: context !== "main", - webworker: false, - browser: false, - nwjs: false, + compilation.hooks.runtimeRequirementInModule + .for(RuntimeGlobals.amdOptions) + .tap("AMDPlugin", (module, set) => { + set.add(RuntimeGlobals.requireScope); + }); - electronMain: context === "main", - electronPreload: context === "preload", - electronRenderer: context === "renderer", + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.amdDefine) + .tap("AMDPlugin", (chunk, set) => { + compilation.addRuntimeModule(chunk, new AMDDefineRuntimeModule()); + }); - global: true, - nodeBuiltins: true, - require: true, - document: context === "renderer", - fetchWasm: context === "renderer", - importScripts: false, - importScriptsInWorker: true, + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.amdOptions) + .tap("AMDPlugin", (chunk, set) => { + compilation.addRuntimeModule( + chunk, + new AMDOptionsRuntimeModule(amdOptions) + ); + }); - globalThis: v(5), - const: v(1, 1), - templateLiteral: v(1, 1), - optionalChaining: v(8), - arrowFunction: v(1, 1), - forOf: v(0, 36), - destructuring: v(1, 1), - bigIntLiteral: v(4), - dynamicImport: v(11), - dynamicImportInWorker: major ? false : undefined, - module: v(11) - }; - } - ], - [ - "nwjs[X[.Y]] / node-webkit[X[.Y]]", - "NW.js in version X.Y.", - /^(?:nwjs|node-webkit)(\d+(?:\.(\d+))?)?$/, - (major, minor) => { - const v = versionDependent(major, minor); - // see https://node.green/ + https://github.com/nwjs/nw.js/blob/nw48/CHANGELOG.md - return { - node: true, - web: true, - nwjs: true, - webworker: null, - browser: false, - electron: false, + const handler = (parser, parserOptions) => { + if (parserOptions.amd !== undefined && !parserOptions.amd) return; - global: true, - nodeBuiltins: true, - document: false, - importScriptsInWorker: false, - fetchWasm: false, - importScripts: false, - require: false, + const tapOptionsHooks = (optionExpr, rootName, getMembers) => { + parser.hooks.expression + .for(optionExpr) + .tap( + "AMDPlugin", + toConstantDependency(parser, RuntimeGlobals.amdOptions, [ + RuntimeGlobals.amdOptions + ]) + ); + parser.hooks.evaluateIdentifier + .for(optionExpr) + .tap( + "AMDPlugin", + evaluateToIdentifier(optionExpr, rootName, getMembers, true) + ); + parser.hooks.evaluateTypeof + .for(optionExpr) + .tap("AMDPlugin", evaluateToString("object")); + parser.hooks.typeof + .for(optionExpr) + .tap( + "AMDPlugin", + toConstantDependency(parser, JSON.stringify("object")) + ); + }; - globalThis: v(0, 43), - const: v(0, 15), - templateLiteral: v(0, 13), - optionalChaining: v(0, 44), - arrowFunction: v(0, 15), - forOf: v(0, 13), - destructuring: v(0, 15), - bigIntLiteral: v(0, 32), - dynamicImport: v(0, 43), - dynamicImportInWorker: major ? false : undefined, - module: v(0, 43) - }; - } - ], - [ - "esX", - "EcmaScript in this version. Examples: es2020, es5.", - /^es(\d+)$/, - version => { - let v = +version; - if (v < 1000) v = v + 2009; - return { - const: v >= 2015, - templateLiteral: v >= 2015, - optionalChaining: v >= 2020, - arrowFunction: v >= 2015, - forOf: v >= 2015, - destructuring: v >= 2015, - module: v >= 2015, - globalThis: v >= 2020, - bigIntLiteral: v >= 2020, - dynamicImport: v >= 2020, - dynamicImportInWorker: v >= 2020 - }; - } - ] -]; + new AMDRequireDependenciesBlockParserPlugin(parserOptions).apply( + parser + ); + new AMDDefineDependencyParserPlugin(parserOptions).apply(parser); -/** - * @param {string} target the target - * @param {string} context the context directory - * @returns {TargetProperties} target properties - */ -const getTargetProperties = (target, context) => { - for (const [, , regExp, handler] of TARGETS) { - const match = regExp.exec(target); - if (match) { - const [, ...args] = match; - const result = handler(...args, context); - if (result) return result; - } - } - throw new Error( - `Unknown target '${target}'. The following targets are supported:\n${TARGETS.map( - ([name, description]) => `* ${name}: ${description}` - ).join("\n")}` - ); -}; + tapOptionsHooks("define.amd", "define", () => "amd"); + tapOptionsHooks("require.amd", "require", () => ["amd"]); + tapOptionsHooks( + "__webpack_amd_options__", + "__webpack_amd_options__", + () => [] + ); -const mergeTargetProperties = targetProperties => { - const keys = new Set(); - for (const tp of targetProperties) { - for (const key of Object.keys(tp)) { - keys.add(key); - } - } - const result = {}; - for (const key of keys) { - let hasTrue = false; - let hasFalse = false; - for (const tp of targetProperties) { - const value = tp[key]; - switch (value) { - case true: - hasTrue = true; - break; - case false: - hasFalse = true; - break; + parser.hooks.expression.for("define").tap("AMDPlugin", expr => { + const dep = new ConstDependency( + RuntimeGlobals.amdDefine, + expr.range, + [RuntimeGlobals.amdDefine] + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + parser.hooks.typeof + .for("define") + .tap( + "AMDPlugin", + toConstantDependency(parser, JSON.stringify("function")) + ); + parser.hooks.evaluateTypeof + .for("define") + .tap("AMDPlugin", evaluateToString("function")); + parser.hooks.canRename.for("define").tap("AMDPlugin", approve); + parser.hooks.rename.for("define").tap("AMDPlugin", expr => { + const dep = new ConstDependency( + RuntimeGlobals.amdDefine, + expr.range, + [RuntimeGlobals.amdDefine] + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return false; + }); + parser.hooks.typeof + .for("require") + .tap( + "AMDPlugin", + toConstantDependency(parser, JSON.stringify("function")) + ); + parser.hooks.evaluateTypeof + .for("require") + .tap("AMDPlugin", evaluateToString("function")); + }; + + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("AMDPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("AMDPlugin", handler); } - } - if (hasTrue || hasFalse) - result[key] = hasFalse && hasTrue ? null : hasTrue ? true : false; + ); } - return /** @type {TargetProperties} */ (result); -}; - -/** - * @param {string[]} targets the targets - * @param {string} context the context directory - * @returns {TargetProperties} target properties - */ -const getTargetsProperties = (targets, context) => { - return mergeTargetProperties( - targets.map(t => getTargetProperties(t, context)) - ); -}; +} -exports.getDefaultTarget = getDefaultTarget; -exports.getTargetProperties = getTargetProperties; -exports.getTargetsProperties = getTargetsProperties; +module.exports = AMDPlugin; /***/ }), -/***/ 64813: +/***/ 33516: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr + Author Tobias Koppers @sokra */ -const Dependency = __webpack_require__(54912); +const DependencyTemplate = __webpack_require__(5160); const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); -/** @typedef {import("./ContainerEntryModule").ExposeOptions} ExposeOptions */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -class ContainerEntryDependency extends Dependency { - /** - * @param {string} name entry name - * @param {[string, ExposeOptions][]} exposes list of exposed modules - * @param {string} shareScope name of the share scope - */ - constructor(name, exposes, shareScope) { +class AMDRequireArrayDependency extends NullDependency { + constructor(depsArray, range) { super(); - this.name = name; - this.exposes = exposes; - this.shareScope = shareScope; - } - /** - * @returns {string | null} an identifier to merge equal requests - */ - getResourceIdentifier() { - return `container-entry-${this.name}`; + this.depsArray = depsArray; + this.range = range; } get type() { - return "container entry"; + return "amd require array"; } get category() { - return "esm"; + return "amd"; } -} - -makeSerializable( - ContainerEntryDependency, - "webpack/lib/container/ContainerEntryDependency" -); - -module.exports = ContainerEntryDependency; - - -/***/ }), - -/***/ 80580: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr -*/ - - - -const { OriginalSource, RawSource } = __webpack_require__(51255); -const AsyncDependenciesBlock = __webpack_require__(47736); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const StaticExportsDependency = __webpack_require__(91418); -const makeSerializable = __webpack_require__(33032); -const ContainerExposedDependency = __webpack_require__(72374); - -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ -/** @typedef {import("./ContainerEntryDependency")} ContainerEntryDependency */ -/** - * @typedef {Object} ExposeOptions - * @property {string[]} import requests to exposed modules (last one is exported) - * @property {string} name custom chunk name for the exposed module - */ + serialize(context) { + const { write } = context; -const SOURCE_TYPES = new Set(["javascript"]); + write(this.depsArray); + write(this.range); -class ContainerEntryModule extends Module { - /** - * @param {string} name container entry name - * @param {[string, ExposeOptions][]} exposes list of exposed modules - * @param {string} shareScope name of the share scope - */ - constructor(name, exposes, shareScope) { - super("javascript/dynamic", null); - this._name = name; - this._exposes = exposes; - this._shareScope = shareScope; + super.serialize(context); } - /** - * @returns {Set} types available (do not mutate) - */ - getSourceTypes() { - return SOURCE_TYPES; - } + deserialize(context) { + const { read } = context; - /** - * @returns {string} a unique identifier of the module - */ - identifier() { - return `container entry (${this._shareScope}) ${JSON.stringify( - this._exposes - )}`; - } + this.depsArray = read(); + this.range = read(); - /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module - */ - readableIdentifier(requestShortener) { - return `container entry`; + super.deserialize(context); } +} - /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion - */ - libIdent(options) { - return `${this.layer ? `(${this.layer})/` : ""}webpack/container/entry/${ - this._name - }`; - } +makeSerializable( + AMDRequireArrayDependency, + "webpack/lib/dependencies/AMDRequireArrayDependency" +); +AMDRequireArrayDependency.Template = class AMDRequireArrayDependencyTemplate extends ( + DependencyTemplate +) { /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - needBuild(context, callback) { - return callback(null, !this.buildMeta); + apply(dependency, source, templateContext) { + const dep = /** @type {AMDRequireArrayDependency} */ (dependency); + const content = this.getContent(dep, templateContext); + source.replace(dep.range[0], dep.range[1] - 1, content); } - /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} - */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = {}; - this.buildInfo = { - strict: true, - topLevelDeclarations: new Set(["moduleMap", "get", "init"]) - }; - this.buildMeta.exportsType = "namespace"; - - this.clearDependenciesAndBlocks(); - - for (const [name, options] of this._exposes) { - const block = new AsyncDependenciesBlock( - { - name: options.name - }, - { name }, - options.import[options.import.length - 1] - ); - let idx = 0; - for (const request of options.import) { - const dep = new ContainerExposedDependency(name, request); - dep.loc = { - name, - index: idx++ - }; + getContent(dep, templateContext) { + const requires = dep.depsArray.map(dependency => { + return this.contentForDependency(dependency, templateContext); + }); + return `[${requires.join(", ")}]`; + } - block.addDependency(dep); - } - this.addBlock(block); + contentForDependency( + dep, + { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } + ) { + if (typeof dep === "string") { + return dep; } - this.addDependency(new StaticExportsDependency(["get", "init"], false)); - callback(); + if (dep.localModule) { + return dep.localModule.variableName(); + } else { + return runtimeTemplate.moduleExports({ + module: moduleGraph.getModule(dep), + chunkGraph, + request: dep.request, + runtimeRequirements + }); + } } +}; - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration({ moduleGraph, chunkGraph, runtimeTemplate }) { - const sources = new Map(); - const runtimeRequirements = new Set([ - RuntimeGlobals.definePropertyGetters, - RuntimeGlobals.hasOwnProperty, - RuntimeGlobals.exports - ]); - const getters = []; +module.exports = AMDRequireArrayDependency; - for (const block of this.blocks) { - const { dependencies } = block; - const modules = dependencies.map(dependency => { - const dep = /** @type {ContainerExposedDependency} */ (dependency); - return { - name: dep.exposedName, - module: moduleGraph.getModule(dep), - request: dep.userRequest - }; - }); +/***/ }), - let str; +/***/ 96123: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (modules.some(m => !m.module)) { - str = runtimeTemplate.throwMissingModuleErrorBlock({ - request: modules.map(m => m.request).join(", ") - }); - } else { - str = `return ${runtimeTemplate.blockPromise({ - block, - message: "", - chunkGraph, - runtimeRequirements - })}.then(${runtimeTemplate.returningFunction( - runtimeTemplate.returningFunction( - `(${modules - .map(({ module, request }) => - runtimeTemplate.moduleRaw({ - module, - chunkGraph, - request, - weak: false, - runtimeRequirements - }) - ) - .join(", ")})` - ) - )});`; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - getters.push( - `${JSON.stringify(modules[0].name)}: ${runtimeTemplate.basicFunction( - "", - str - )}` - ); - } - const source = Template.asString([ - `var moduleMap = {`, - Template.indent(getters.join(",\n")), - "};", - `var get = ${runtimeTemplate.basicFunction("module, getScope", [ - `${RuntimeGlobals.currentRemoteGetScope} = getScope;`, - // reusing the getScope variable to avoid creating a new var (and module is also used later) - "getScope = (", - Template.indent([ - `${RuntimeGlobals.hasOwnProperty}(moduleMap, module)`, - Template.indent([ - "? moduleMap[module]()", - `: Promise.resolve().then(${runtimeTemplate.basicFunction( - "", - "throw new Error('Module \"' + module + '\" does not exist in container.');" - )})` - ]) - ]), - ");", - `${RuntimeGlobals.currentRemoteGetScope} = undefined;`, - "return getScope;" - ])};`, - `var init = ${runtimeTemplate.basicFunction("shareScope, initScope", [ - `if (!${RuntimeGlobals.shareScopeMap}) return;`, - `var name = ${JSON.stringify(this._shareScope)}`, - `var oldScope = ${RuntimeGlobals.shareScopeMap}[name];`, - `if(oldScope && oldScope !== shareScope) throw new Error("Container initialization failed as it has already been initialized with a different share scope");`, - `${RuntimeGlobals.shareScopeMap}[name] = shareScope;`, - `return ${RuntimeGlobals.initializeSharing}(name, initScope);` - ])};`, - "", - "// This exports getters to disallow modifications", - `${RuntimeGlobals.definePropertyGetters}(exports, {`, - Template.indent([ - `get: ${runtimeTemplate.returningFunction("get")},`, - `init: ${runtimeTemplate.returningFunction("init")}` - ]), - "});" - ]); - sources.set( - "javascript", - this.useSourceMap || this.useSimpleSourceMap - ? new OriginalSource(source, "webpack/container-entry") - : new RawSource(source) - ); +const makeSerializable = __webpack_require__(33032); +const ContextDependency = __webpack_require__(88101); - return { - sources, - runtimeRequirements - }; +class AMDRequireContextDependency extends ContextDependency { + constructor(options, range, valueRange) { + super(options); + + this.range = range; + this.valueRange = valueRange; } - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - return 42; + get type() { + return "amd require context"; + } + + get category() { + return "amd"; } serialize(context) { const { write } = context; - write(this._name); - write(this._exposes); - write(this._shareScope); + + write(this.range); + write(this.valueRange); + super.serialize(context); } - static deserialize(context) { + deserialize(context) { const { read } = context; - const obj = new ContainerEntryModule(read(), read(), read()); - obj.deserialize(context); - return obj; + + this.range = read(); + this.valueRange = read(); + + super.deserialize(context); } } makeSerializable( - ContainerEntryModule, - "webpack/lib/container/ContainerEntryModule" + AMDRequireContextDependency, + "webpack/lib/dependencies/AMDRequireContextDependency" ); -module.exports = ContainerEntryModule; +AMDRequireContextDependency.Template = __webpack_require__(75815); + +module.exports = AMDRequireContextDependency; /***/ }), -/***/ 76398: +/***/ 76932: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr + Author Tobias Koppers @sokra */ -const ModuleFactory = __webpack_require__(51010); -const ContainerEntryModule = __webpack_require__(80580); - -/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ -/** @typedef {import("../ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ -/** @typedef {import("./ContainerEntryDependency")} ContainerEntryDependency */ +const AsyncDependenciesBlock = __webpack_require__(47736); +const makeSerializable = __webpack_require__(33032); -module.exports = class ContainerEntryModuleFactory extends ModuleFactory { - /** - * @param {ModuleFactoryCreateData} data data object - * @param {function(Error=, ModuleFactoryResult=): void} callback callback - * @returns {void} - */ - create({ dependencies: [dependency] }, callback) { - const dep = /** @type {ContainerEntryDependency} */ (dependency); - callback(null, { - module: new ContainerEntryModule(dep.name, dep.exposes, dep.shareScope) - }); +class AMDRequireDependenciesBlock extends AsyncDependenciesBlock { + constructor(loc, request) { + super(null, loc, request); } -}; +} + +makeSerializable( + AMDRequireDependenciesBlock, + "webpack/lib/dependencies/AMDRequireDependenciesBlock" +); + +module.exports = AMDRequireDependenciesBlock; /***/ }), -/***/ 72374: +/***/ 66866: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr + Author Tobias Koppers @sokra */ -const ModuleDependency = __webpack_require__(80321); -const makeSerializable = __webpack_require__(33032); - -class ContainerExposedDependency extends ModuleDependency { - /** - * @param {string} exposedName public name - * @param {string} request request to module - */ - constructor(exposedName, request) { - super(request); - this.exposedName = exposedName; - } +const RuntimeGlobals = __webpack_require__(16475); +const UnsupportedFeatureWarning = __webpack_require__(42495); +const AMDRequireArrayDependency = __webpack_require__(33516); +const AMDRequireContextDependency = __webpack_require__(96123); +const AMDRequireDependenciesBlock = __webpack_require__(76932); +const AMDRequireDependency = __webpack_require__(43911); +const AMDRequireItemDependency = __webpack_require__(71806); +const ConstDependency = __webpack_require__(76911); +const ContextDependencyHelpers = __webpack_require__(99630); +const LocalModuleDependency = __webpack_require__(52805); +const { getLocalModule } = __webpack_require__(75827); +const UnsupportedDependency = __webpack_require__(51669); +const getFunctionExpression = __webpack_require__(50396); - get type() { - return "container exposed"; +class AMDRequireDependenciesBlockParserPlugin { + constructor(options) { + this.options = options; } - get category() { - return "esm"; + processFunctionArgument(parser, expression) { + let bindThis = true; + const fnData = getFunctionExpression(expression); + if (fnData) { + parser.inScope( + fnData.fn.params.filter(i => { + return !["require", "module", "exports"].includes(i.name); + }), + () => { + if (fnData.fn.body.type === "BlockStatement") { + parser.walkStatement(fnData.fn.body); + } else { + parser.walkExpression(fnData.fn.body); + } + } + ); + parser.walkExpressions(fnData.expressions); + if (fnData.needThis === false) { + bindThis = false; + } + } else { + parser.walkExpression(expression); + } + return bindThis; } - /** - * @returns {string | null} an identifier to merge equal requests - */ - getResourceIdentifier() { - return `exposed dependency ${this.exposedName}=${this.request}`; + apply(parser) { + parser.hooks.call + .for("require") + .tap( + "AMDRequireDependenciesBlockParserPlugin", + this.processCallRequire.bind(this, parser) + ); } - serialize(context) { - context.write(this.exposedName); - super.serialize(context); + processArray(parser, expr, param) { + if (param.isArray()) { + for (const p of param.items) { + const result = this.processItem(parser, expr, p); + if (result === undefined) { + this.processContext(parser, expr, p); + } + } + return true; + } else if (param.isConstArray()) { + const deps = []; + for (const request of param.array) { + let dep, localModule; + if (request === "require") { + dep = "__webpack_require__"; + } else if (["exports", "module"].includes(request)) { + dep = request; + } else if ((localModule = getLocalModule(parser.state, request))) { + localModule.flagUsed(); + dep = new LocalModuleDependency(localModule, undefined, false); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + } else { + dep = this.newRequireItemDependency(request); + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + } + deps.push(dep); + } + const dep = this.newRequireArrayDependency(deps, param.range); + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.module.addPresentationalDependency(dep); + return true; + } } - - deserialize(context) { - this.exposedName = context.read(); - super.deserialize(context); + processItem(parser, expr, param) { + if (param.isConditional()) { + for (const p of param.options) { + const result = this.processItem(parser, expr, p); + if (result === undefined) { + this.processContext(parser, expr, p); + } + } + return true; + } else if (param.isString()) { + let dep, localModule; + if (param.string === "require") { + dep = new ConstDependency("__webpack_require__", param.string, [ + RuntimeGlobals.require + ]); + } else if (param.string === "module") { + dep = new ConstDependency( + parser.state.module.buildInfo.moduleArgument, + param.range, + [RuntimeGlobals.module] + ); + } else if (param.string === "exports") { + dep = new ConstDependency( + parser.state.module.buildInfo.exportsArgument, + param.range, + [RuntimeGlobals.exports] + ); + } else if ((localModule = getLocalModule(parser.state, param.string))) { + localModule.flagUsed(); + dep = new LocalModuleDependency(localModule, param.range, false); + } else { + dep = this.newRequireItemDependency(param.string, param.range); + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; + } + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + } } -} - -makeSerializable( - ContainerExposedDependency, - "webpack/lib/container/ContainerExposedDependency" -); - -module.exports = ContainerExposedDependency; - - -/***/ }), - -/***/ 9244: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr -*/ - - - -const createSchemaValidation = __webpack_require__(32540); -const ContainerEntryDependency = __webpack_require__(64813); -const ContainerEntryModuleFactory = __webpack_require__(76398); -const ContainerExposedDependency = __webpack_require__(72374); -const { parseOptions } = __webpack_require__(3083); - -/** @typedef {import("../../declarations/plugins/container/ContainerPlugin").ContainerPluginOptions} ContainerPluginOptions */ -/** @typedef {import("../Compiler")} Compiler */ - -const validate = createSchemaValidation( - __webpack_require__(9504), - () => __webpack_require__(84899), - { - name: "Container Plugin", - baseDataPath: "options" + processContext(parser, expr, param) { + const dep = ContextDependencyHelpers.create( + AMDRequireContextDependency, + param.range, + param, + expr, + this.options, + { + category: "amd" + }, + parser + ); + if (!dep) return; + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; } -); -const PLUGIN_NAME = "ContainerPlugin"; - -class ContainerPlugin { - /** - * @param {ContainerPluginOptions} options options - */ - constructor(options) { - validate(options); + processArrayForRequestString(param) { + if (param.isArray()) { + const result = param.items.map(item => + this.processItemForRequestString(item) + ); + if (result.every(Boolean)) return result.join(" "); + } else if (param.isConstArray()) { + return param.array.join(" "); + } + } - this._options = { - name: options.name, - shareScope: options.shareScope || "default", - library: options.library || { - type: "var", - name: options.name - }, - runtime: options.runtime, - filename: options.filename || undefined, - exposes: parseOptions( - options.exposes, - item => ({ - import: Array.isArray(item) ? item : [item], - name: undefined - }), - item => ({ - import: Array.isArray(item.import) ? item.import : [item.import], - name: item.name || undefined - }) - ) - }; + processItemForRequestString(param) { + if (param.isConditional()) { + const result = param.options.map(item => + this.processItemForRequestString(item) + ); + if (result.every(Boolean)) return result.join("|"); + } else if (param.isString()) { + return param.string; + } } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const { name, exposes, shareScope, filename, library, runtime } = - this._options; + processCallRequire(parser, expr) { + let param; + let depBlock; + let dep; + let result; - compiler.options.output.enabledLibraryTypes.push(library.type); + const old = parser.state.current; - compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => { - const dep = new ContainerEntryDependency(name, exposes, shareScope); - dep.loc = { name }; - compilation.addEntry( - compilation.options.context, - dep, - { - name, - filename, - runtime, - library - }, - error => { - if (error) return callback(error); - callback(); - } + if (expr.arguments.length >= 1) { + param = parser.evaluateExpression(expr.arguments[0]); + depBlock = this.newRequireDependenciesBlock( + expr.loc, + this.processArrayForRequestString(param) ); - }); + dep = this.newRequireDependency( + expr.range, + param.range, + expr.arguments.length > 1 ? expr.arguments[1].range : null, + expr.arguments.length > 2 ? expr.arguments[2].range : null + ); + dep.loc = expr.loc; + depBlock.addDependency(dep); - compiler.hooks.thisCompilation.tap( - PLUGIN_NAME, - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - ContainerEntryDependency, - new ContainerEntryModuleFactory() - ); + parser.state.current = depBlock; + } - compilation.dependencyFactories.set( - ContainerExposedDependency, - normalModuleFactory + if (expr.arguments.length === 1) { + parser.inScope([], () => { + result = this.processArray(parser, expr, param); + }); + parser.state.current = old; + if (!result) return; + parser.state.current.addBlock(depBlock); + return true; + } + + if (expr.arguments.length === 2 || expr.arguments.length === 3) { + try { + parser.inScope([], () => { + result = this.processArray(parser, expr, param); + }); + if (!result) { + const dep = new UnsupportedDependency("unsupported", expr.range); + old.addPresentationalDependency(dep); + if (parser.state.module) { + parser.state.module.addError( + new UnsupportedFeatureWarning( + "Cannot statically analyse 'require(…, …)' in line " + + expr.loc.start.line, + expr.loc + ) + ); + } + depBlock = null; + return true; + } + dep.functionBindThis = this.processFunctionArgument( + parser, + expr.arguments[1] ); + if (expr.arguments.length === 3) { + dep.errorCallbackBindThis = this.processFunctionArgument( + parser, + expr.arguments[2] + ); + } + } finally { + parser.state.current = old; + if (depBlock) parser.state.current.addBlock(depBlock); } + return true; + } + } + + newRequireDependenciesBlock(loc, request) { + return new AMDRequireDependenciesBlock(loc, request); + } + newRequireDependency( + outerRange, + arrayRange, + functionRange, + errorCallbackRange + ) { + return new AMDRequireDependency( + outerRange, + arrayRange, + functionRange, + errorCallbackRange ); } + newRequireItemDependency(request, range) { + return new AMDRequireItemDependency(request, range); + } + newRequireArrayDependency(depsArray, range) { + return new AMDRequireArrayDependency(depsArray, range); + } } - -module.exports = ContainerPlugin; +module.exports = AMDRequireDependenciesBlockParserPlugin; /***/ }), -/***/ 95757: +/***/ 43911: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy + Author Tobias Koppers @sokra */ -const ExternalsPlugin = __webpack_require__(6652); const RuntimeGlobals = __webpack_require__(16475); -const createSchemaValidation = __webpack_require__(32540); -const FallbackDependency = __webpack_require__(57764); -const FallbackItemDependency = __webpack_require__(29593); -const FallbackModuleFactory = __webpack_require__(4112); -const RemoteModule = __webpack_require__(62916); -const RemoteRuntimeModule = __webpack_require__(88288); -const RemoteToExternalDependency = __webpack_require__(14389); -const { parseOptions } = __webpack_require__(3083); +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); -/** @typedef {import("../../declarations/plugins/container/ContainerReferencePlugin").ContainerReferencePluginOptions} ContainerReferencePluginOptions */ -/** @typedef {import("../../declarations/plugins/container/ContainerReferencePlugin").RemotesConfig} RemotesConfig */ -/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -const validate = createSchemaValidation( - __webpack_require__(95122), - () => - __webpack_require__(66681), - { - name: "Container Reference Plugin", - baseDataPath: "options" +class AMDRequireDependency extends NullDependency { + constructor(outerRange, arrayRange, functionRange, errorCallbackRange) { + super(); + + this.outerRange = outerRange; + this.arrayRange = arrayRange; + this.functionRange = functionRange; + this.errorCallbackRange = errorCallbackRange; + this.functionBindThis = false; + this.errorCallbackBindThis = false; } -); -const slashCode = "/".charCodeAt(0); + get category() { + return "amd"; + } -class ContainerReferencePlugin { - /** - * @param {ContainerReferencePluginOptions} options options - */ - constructor(options) { - validate(options); + serialize(context) { + const { write } = context; - this._remoteType = options.remoteType; - this._remotes = parseOptions( - options.remotes, - item => ({ - external: Array.isArray(item) ? item : [item], - shareScope: options.shareScope || "default" - }), - item => ({ - external: Array.isArray(item.external) - ? item.external - : [item.external], - shareScope: item.shareScope || options.shareScope || "default" - }) - ); + write(this.outerRange); + write(this.arrayRange); + write(this.functionRange); + write(this.errorCallbackRange); + write(this.functionBindThis); + write(this.errorCallbackBindThis); + + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + + this.outerRange = read(); + this.arrayRange = read(); + this.functionRange = read(); + this.errorCallbackRange = read(); + this.functionBindThis = read(); + this.errorCallbackBindThis = read(); + + super.deserialize(context); } +} + +makeSerializable( + AMDRequireDependency, + "webpack/lib/dependencies/AMDRequireDependency" +); +AMDRequireDependency.Template = class AMDRequireDependencyTemplate extends ( + NullDependency.Template +) { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply(compiler) { - const { _remotes: remotes, _remoteType: remoteType } = this; + apply( + dependency, + source, + { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } + ) { + const dep = /** @type {AMDRequireDependency} */ (dependency); + const depBlock = /** @type {AsyncDependenciesBlock} */ ( + moduleGraph.getParentBlock(dep) + ); + const promise = runtimeTemplate.blockPromise({ + chunkGraph, + block: depBlock, + message: "AMD require", + runtimeRequirements + }); - /** @type {Record} */ - const remoteExternals = {}; - for (const [key, config] of remotes) { - let i = 0; - for (const external of config.external) { - if (external.startsWith("internal ")) continue; - remoteExternals[ - `webpack/container/reference/${key}${i ? `/fallback-${i}` : ""}` - ] = external; - i++; - } - } + // has array range but no function range + if (dep.arrayRange && !dep.functionRange) { + const startBlock = `${promise}.then(function() {`; + const endBlock = `;})['catch'](${RuntimeGlobals.uncaughtErrorHandler})`; + runtimeRequirements.add(RuntimeGlobals.uncaughtErrorHandler); - new ExternalsPlugin(remoteType, remoteExternals).apply(compiler); + source.replace(dep.outerRange[0], dep.arrayRange[0] - 1, startBlock); - compiler.hooks.compilation.tap( - "ContainerReferencePlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - RemoteToExternalDependency, - normalModuleFactory - ); + source.replace(dep.arrayRange[1], dep.outerRange[1] - 1, endBlock); - compilation.dependencyFactories.set( - FallbackItemDependency, - normalModuleFactory - ); + return; + } - compilation.dependencyFactories.set( - FallbackDependency, - new FallbackModuleFactory() - ); + // has function range but no array range + if (dep.functionRange && !dep.arrayRange) { + const startBlock = `${promise}.then((`; + const endBlock = `).bind(exports, __webpack_require__, exports, module))['catch'](${RuntimeGlobals.uncaughtErrorHandler})`; + runtimeRequirements.add(RuntimeGlobals.uncaughtErrorHandler); - normalModuleFactory.hooks.factorize.tap( - "ContainerReferencePlugin", - data => { - if (!data.request.includes("!")) { - for (const [key, config] of remotes) { - if ( - data.request.startsWith(`${key}`) && - (data.request.length === key.length || - data.request.charCodeAt(key.length) === slashCode) - ) { - return new RemoteModule( - data.request, - config.external.map((external, i) => - external.startsWith("internal ") - ? external.slice(9) - : `webpack/container/reference/${key}${ - i ? `/fallback-${i}` : "" - }` - ), - `.${data.request.slice(key.length)}`, - config.shareScope - ); - } - } - } - } - ); + source.replace(dep.outerRange[0], dep.functionRange[0] - 1, startBlock); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("ContainerReferencePlugin", (chunk, set) => { - set.add(RuntimeGlobals.module); - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - set.add(RuntimeGlobals.hasOwnProperty); - set.add(RuntimeGlobals.initializeSharing); - set.add(RuntimeGlobals.shareScopeMap); - compilation.addRuntimeModule(chunk, new RemoteRuntimeModule()); - }); - } - ); - } -} + source.replace(dep.functionRange[1], dep.outerRange[1] - 1, endBlock); -module.exports = ContainerReferencePlugin; + return; + } + // has array range, function range, and errorCallbackRange + if (dep.arrayRange && dep.functionRange && dep.errorCallbackRange) { + const startBlock = `${promise}.then(function() { `; + const errorRangeBlock = `}${ + dep.functionBindThis ? ".bind(this)" : "" + })['catch'](`; + const endBlock = `${dep.errorCallbackBindThis ? ".bind(this)" : ""})`; -/***/ }), + source.replace(dep.outerRange[0], dep.arrayRange[0] - 1, startBlock); -/***/ 57764: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + source.insert(dep.arrayRange[0], "var __WEBPACK_AMD_REQUIRE_ARRAY__ = "); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + source.replace(dep.arrayRange[1], dep.functionRange[0] - 1, "; ("); + source.insert( + dep.functionRange[1], + ").apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__);" + ); + source.replace( + dep.functionRange[1], + dep.errorCallbackRange[0] - 1, + errorRangeBlock + ); -const Dependency = __webpack_require__(54912); -const makeSerializable = __webpack_require__(33032); + source.replace( + dep.errorCallbackRange[1], + dep.outerRange[1] - 1, + endBlock + ); -class FallbackDependency extends Dependency { - constructor(requests) { - super(); - this.requests = requests; - } + return; + } - /** - * @returns {string | null} an identifier to merge equal requests - */ - getResourceIdentifier() { - return `fallback ${this.requests.join(" ")}`; - } + // has array range, function range, but no errorCallbackRange + if (dep.arrayRange && dep.functionRange) { + const startBlock = `${promise}.then(function() { `; + const endBlock = `}${ + dep.functionBindThis ? ".bind(this)" : "" + })['catch'](${RuntimeGlobals.uncaughtErrorHandler})`; + runtimeRequirements.add(RuntimeGlobals.uncaughtErrorHandler); - get type() { - return "fallback"; - } + source.replace(dep.outerRange[0], dep.arrayRange[0] - 1, startBlock); - get category() { - return "esm"; - } + source.insert(dep.arrayRange[0], "var __WEBPACK_AMD_REQUIRE_ARRAY__ = "); - serialize(context) { - const { write } = context; - write(this.requests); - super.serialize(context); - } + source.replace(dep.arrayRange[1], dep.functionRange[0] - 1, "; ("); - static deserialize(context) { - const { read } = context; - const obj = new FallbackDependency(read()); - obj.deserialize(context); - return obj; - } -} + source.insert( + dep.functionRange[1], + ").apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__);" + ); -makeSerializable( - FallbackDependency, - "webpack/lib/container/FallbackDependency" -); + source.replace(dep.functionRange[1], dep.outerRange[1] - 1, endBlock); + } + } +}; -module.exports = FallbackDependency; +module.exports = AMDRequireDependency; /***/ }), -/***/ 29593: +/***/ 71806: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -74270,665 +72266,648 @@ module.exports = FallbackDependency; -const ModuleDependency = __webpack_require__(80321); const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); +const ModuleDependencyTemplateAsRequireId = __webpack_require__(36873); -class FallbackItemDependency extends ModuleDependency { - constructor(request) { +class AMDRequireItemDependency extends ModuleDependency { + constructor(request, range) { super(request); + + this.range = range; } get type() { - return "fallback item"; + return "amd require"; } get category() { - return "esm"; + return "amd"; } } makeSerializable( - FallbackItemDependency, - "webpack/lib/container/FallbackItemDependency" + AMDRequireItemDependency, + "webpack/lib/dependencies/AMDRequireItemDependency" ); -module.exports = FallbackItemDependency; +AMDRequireItemDependency.Template = ModuleDependencyTemplateAsRequireId; + +module.exports = AMDRequireItemDependency; /***/ }), -/***/ 82886: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 45242: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy */ -const { RawSource } = __webpack_require__(51255); -const Module = __webpack_require__(73208); const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const makeSerializable = __webpack_require__(33032); -const FallbackItemDependency = __webpack_require__(29593); - -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ - -const TYPES = new Set(["javascript"]); -const RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); -class FallbackModule extends Module { - /** - * @param {string[]} requests list of requests to choose one - */ - constructor(requests) { - super("fallback-module"); - this.requests = requests; - this._identifier = `fallback ${this.requests.join(" ")}`; +class AMDDefineRuntimeModule extends RuntimeModule { + constructor() { + super("amd define"); } /** - * @returns {string} a unique identifier of the module + * @returns {string} runtime code */ - identifier() { - return this._identifier; + generate() { + return Template.asString([ + `${RuntimeGlobals.amdDefine} = function () {`, + Template.indent("throw new Error('define cannot be used indirect');"), + "};" + ]); } +} +class AMDOptionsRuntimeModule extends RuntimeModule { /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module + * @param {Record} options the AMD options */ - readableIdentifier(requestShortener) { - return this._identifier; + constructor(options) { + super("amd options"); + this.options = options; } /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion + * @returns {string} runtime code */ - libIdent(options) { - return `${this.layer ? `(${this.layer})/` : ""}webpack/container/fallback/${ - this.requests[0] - }/and ${this.requests.length - 1} more`; + generate() { + return Template.asString([ + `${RuntimeGlobals.amdOptions} = ${JSON.stringify(this.options)};` + ]); } +} - /** - * @param {Chunk} chunk the chunk which condition should be checked - * @param {Compilation} compilation the compilation - * @returns {boolean} true, if the chunk is ok for the module - */ - chunkCondition(chunk, { chunkGraph }) { - return chunkGraph.getNumberOfEntryModules(chunk) > 0; - } +exports.AMDDefineRuntimeModule = AMDDefineRuntimeModule; +exports.AMDOptionsRuntimeModule = AMDOptionsRuntimeModule; - /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} - */ - needBuild(context, callback) { - callback(null, !this.buildInfo); - } - /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} - */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = {}; - this.buildInfo = { - strict: true - }; +/***/ }), - this.clearDependenciesAndBlocks(); - for (const request of this.requests) - this.addDependency(new FallbackItemDependency(request)); +/***/ 57403: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - callback(); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Florent Cailhol @ooflorent +*/ - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - return this.requests.length * 5 + 42; - } - /** - * @returns {Set} types available (do not mutate) - */ - getSourceTypes() { - return TYPES; + +const DependencyTemplate = __webpack_require__(5160); +const InitFragment = __webpack_require__(55870); +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../util/Hash")} Hash */ + +class CachedConstDependency extends NullDependency { + constructor(expression, range, identifier) { + super(); + + this.expression = expression; + this.range = range; + this.identifier = identifier; + this._hashUpdate = undefined; } /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result + * Update the hash + * @param {Hash} hash hash to be updated + * @param {UpdateHashContext} context context + * @returns {void} */ - codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { - const ids = this.dependencies.map(dep => - chunkGraph.getModuleId(moduleGraph.getModule(dep)) - ); - const code = Template.asString([ - `var ids = ${JSON.stringify(ids)};`, - "var error, result, i = 0;", - `var loop = ${runtimeTemplate.basicFunction("next", [ - "while(i < ids.length) {", - Template.indent([ - "try { next = __webpack_require__(ids[i++]); } catch(e) { return handleError(e); }", - "if(next) return next.then ? next.then(handleResult, handleError) : handleResult(next);" - ]), - "}", - "if(error) throw error;" - ])}`, - `var handleResult = ${runtimeTemplate.basicFunction("result", [ - "if(result) return result;", - "return loop();" - ])};`, - `var handleError = ${runtimeTemplate.basicFunction("e", [ - "error = e;", - "return loop();" - ])};`, - "module.exports = loop();" - ]); - const sources = new Map(); - sources.set("javascript", new RawSource(code)); - return { sources, runtimeRequirements: RUNTIME_REQUIREMENTS }; + updateHash(hash, context) { + if (this._hashUpdate === undefined) + this._hashUpdate = "" + this.identifier + this.range + this.expression; + hash.update(this._hashUpdate); } serialize(context) { const { write } = context; - write(this.requests); + + write(this.expression); + write(this.range); + write(this.identifier); + super.serialize(context); } - static deserialize(context) { + deserialize(context) { const { read } = context; - const obj = new FallbackModule(read()); - obj.deserialize(context); - return obj; + + this.expression = read(); + this.range = read(); + this.identifier = read(); + + super.deserialize(context); } } -makeSerializable(FallbackModule, "webpack/lib/container/FallbackModule"); +makeSerializable( + CachedConstDependency, + "webpack/lib/dependencies/CachedConstDependency" +); -module.exports = FallbackModule; +CachedConstDependency.Template = class CachedConstDependencyTemplate extends ( + DependencyTemplate +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { runtimeTemplate, dependencyTemplates, initFragments } + ) { + const dep = /** @type {CachedConstDependency} */ (dependency); + + initFragments.push( + new InitFragment( + `var ${dep.identifier} = ${dep.expression};\n`, + InitFragment.STAGE_CONSTANTS, + 0, + `const ${dep.identifier}` + ) + ); + + if (typeof dep.range === "number") { + source.insert(dep.range, dep.identifier); + + return; + } + + source.replace(dep.range[0], dep.range[1] - 1, dep.identifier); + } +}; + +module.exports = CachedConstDependency; /***/ }), -/***/ 4112: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 59643: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr + Author Tobias Koppers @sokra */ -const ModuleFactory = __webpack_require__(51010); -const FallbackModule = __webpack_require__(82886); - -/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ -/** @typedef {import("../ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ -/** @typedef {import("./FallbackDependency")} FallbackDependency */ +const RuntimeGlobals = __webpack_require__(16475); -module.exports = class FallbackModuleFactory extends ModuleFactory { - /** - * @param {ModuleFactoryCreateData} data data object - * @param {function(Error=, ModuleFactoryResult=): void} callback callback - * @returns {void} - */ - create({ dependencies: [dependency] }, callback) { - const dep = /** @type {FallbackDependency} */ (dependency); - callback(null, { - module: new FallbackModule(dep.requests) - }); +exports.handleDependencyBase = (depBase, module, runtimeRequirements) => { + let base = undefined; + let type; + switch (depBase) { + case "exports": + runtimeRequirements.add(RuntimeGlobals.exports); + base = module.exportsArgument; + type = "expression"; + break; + case "module.exports": + runtimeRequirements.add(RuntimeGlobals.module); + base = `${module.moduleArgument}.exports`; + type = "expression"; + break; + case "this": + runtimeRequirements.add(RuntimeGlobals.thisAsExports); + base = "this"; + type = "expression"; + break; + case "Object.defineProperty(exports)": + runtimeRequirements.add(RuntimeGlobals.exports); + base = module.exportsArgument; + type = "Object.defineProperty"; + break; + case "Object.defineProperty(module.exports)": + runtimeRequirements.add(RuntimeGlobals.module); + base = `${module.moduleArgument}.exports`; + type = "Object.defineProperty"; + break; + case "Object.defineProperty(this)": + runtimeRequirements.add(RuntimeGlobals.thisAsExports); + base = "this"; + type = "Object.defineProperty"; + break; + default: + throw new Error(`Unsupported base ${depBase}`); } + + return [type, base]; }; /***/ }), -/***/ 30569: +/***/ 62892: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy + Author Tobias Koppers @sokra */ -const isValidExternalsType = __webpack_require__(62142); -const SharePlugin = __webpack_require__(26335); -const createSchemaValidation = __webpack_require__(32540); -const ContainerPlugin = __webpack_require__(9244); -const ContainerReferencePlugin = __webpack_require__(95757); - -/** @typedef {import("../../declarations/plugins/container/ModuleFederationPlugin").ExternalsType} ExternalsType */ -/** @typedef {import("../../declarations/plugins/container/ModuleFederationPlugin").ModuleFederationPluginOptions} ModuleFederationPluginOptions */ -/** @typedef {import("../../declarations/plugins/container/ModuleFederationPlugin").Shared} Shared */ -/** @typedef {import("../Compiler")} Compiler */ +const Dependency = __webpack_require__(54912); +const { UsageState } = __webpack_require__(63686); +const Template = __webpack_require__(1626); +const { equals } = __webpack_require__(84953); +const makeSerializable = __webpack_require__(33032); +const propertyAccess = __webpack_require__(54190); +const { handleDependencyBase } = __webpack_require__(59643); +const ModuleDependency = __webpack_require__(80321); +const processExportInfo = __webpack_require__(55207); -const validate = createSchemaValidation( - __webpack_require__(7467), - () => __webpack_require__(82601), - { - name: "Module Federation Plugin", - baseDataPath: "options" - } -); -class ModuleFederationPlugin { - /** - * @param {ModuleFederationPluginOptions} options options - */ - constructor(options) { - validate(options); - - this._options = options; - } - - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const { _options: options } = this; - const library = options.library || { type: "var", name: options.name }; - const remoteType = - options.remoteType || - (options.library && isValidExternalsType(options.library.type) - ? /** @type {ExternalsType} */ (options.library.type) - : "script"); - if ( - library && - !compiler.options.output.enabledLibraryTypes.includes(library.type) - ) { - compiler.options.output.enabledLibraryTypes.push(library.type); - } - compiler.hooks.afterPlugins.tap("ModuleFederationPlugin", () => { - if ( - options.exposes && - (Array.isArray(options.exposes) - ? options.exposes.length > 0 - : Object.keys(options.exposes).length > 0) - ) { - new ContainerPlugin({ - name: options.name, - library, - filename: options.filename, - runtime: options.runtime, - exposes: options.exposes - }).apply(compiler); - } - if ( - options.remotes && - (Array.isArray(options.remotes) - ? options.remotes.length > 0 - : Object.keys(options.remotes).length > 0) - ) { - new ContainerReferencePlugin({ - remoteType, - remotes: options.remotes - }).apply(compiler); - } - if (options.shared) { - new SharePlugin({ - shared: options.shared, - shareScope: options.shareScope - }).apply(compiler); - } - }); - } -} - -module.exports = ModuleFederationPlugin; - - -/***/ }), - -/***/ 62916: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy -*/ - - - -const { RawSource } = __webpack_require__(51255); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); -const FallbackDependency = __webpack_require__(57764); -const RemoteToExternalDependency = __webpack_require__(14389); +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ +const idsSymbol = Symbol("CommonJsExportRequireDependency.ids"); -const TYPES = new Set(["remote", "share-init"]); -const RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]); +const EMPTY_OBJECT = {}; -class RemoteModule extends Module { - /** - * @param {string} request request string - * @param {string[]} externalRequests list of external requests to containers - * @param {string} internalRequest name of exposed module in container - * @param {string} shareScope the used share scope name - */ - constructor(request, externalRequests, internalRequest, shareScope) { - super("remote-module"); - this.request = request; - this.externalRequests = externalRequests; - this.internalRequest = internalRequest; - this.shareScope = shareScope; - this._identifier = `remote (${shareScope}) ${this.externalRequests.join( - " " - )} ${this.internalRequest}`; +class CommonJsExportRequireDependency extends ModuleDependency { + constructor(range, valueRange, base, names, request, ids, resultUsed) { + super(request); + this.range = range; + this.valueRange = valueRange; + this.base = base; + this.names = names; + this.ids = ids; + this.resultUsed = resultUsed; + this.asiSafe = undefined; } - /** - * @returns {string} a unique identifier of the module - */ - identifier() { - return this._identifier; + get type() { + return "cjs export require"; } /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module */ - readableIdentifier(requestShortener) { - return `remote ${this.request}`; + couldAffectReferencingModule() { + return Dependency.TRANSITIVE; } /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion + * @param {ModuleGraph} moduleGraph the module graph + * @returns {string[]} the imported id */ - libIdent(options) { - return `${this.layer ? `(${this.layer})/` : ""}webpack/container/remote/${ - this.request - }`; + getIds(moduleGraph) { + return moduleGraph.getMeta(this)[idsSymbol] || this.ids; } /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @param {ModuleGraph} moduleGraph the module graph + * @param {string[]} ids the imported ids * @returns {void} */ - needBuild(context, callback) { - callback(null, !this.buildInfo); + setIds(moduleGraph, ids) { + moduleGraph.getMeta(this)[idsSymbol] = ids; } /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = {}; - this.buildInfo = { - strict: true + getReferencedExports(moduleGraph, runtime) { + const ids = this.getIds(moduleGraph); + const getFullResult = () => { + if (ids.length === 0) { + return Dependency.EXPORTS_OBJECT_REFERENCED; + } else { + return [ + { + name: ids, + canMangle: false + } + ]; + } }; - - this.clearDependenciesAndBlocks(); - if (this.externalRequests.length === 1) { - this.addDependency( - new RemoteToExternalDependency(this.externalRequests[0]) + if (this.resultUsed) return getFullResult(); + let exportsInfo = moduleGraph.getExportsInfo( + moduleGraph.getParentModule(this) + ); + for (const name of this.names) { + const exportInfo = exportsInfo.getReadOnlyExportInfo(name); + const used = exportInfo.getUsed(runtime); + if (used === UsageState.Unused) return Dependency.NO_EXPORTS_REFERENCED; + if (used !== UsageState.OnlyPropertiesUsed) return getFullResult(); + exportsInfo = exportInfo.exportsInfo; + if (!exportsInfo) return getFullResult(); + } + if (exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused) { + return getFullResult(); + } + /** @type {string[][]} */ + const referencedExports = []; + for (const exportInfo of exportsInfo.orderedExports) { + processExportInfo( + runtime, + referencedExports, + ids.concat(exportInfo.name), + exportInfo, + false ); - } else { - this.addDependency(new FallbackDependency(this.externalRequests)); } - - callback(); + return referencedExports.map(name => ({ + name, + canMangle: false + })); } /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names */ - size(type) { - return 6; + getExports(moduleGraph) { + const ids = this.getIds(moduleGraph); + if (this.names.length === 1) { + const name = this.names[0]; + const from = moduleGraph.getConnection(this); + if (!from) return; + return { + exports: [ + { + name, + from, + export: ids.length === 0 ? null : ids, + // we can't mangle names that are in an empty object + // because one could access the prototype property + // when export isn't set yet + canMangle: !(name in EMPTY_OBJECT) && false + } + ], + dependencies: [from.module] + }; + } else if (this.names.length > 0) { + const name = this.names[0]; + return { + exports: [ + { + name, + // we can't mangle names that are in an empty object + // because one could access the prototype property + // when export isn't set yet + canMangle: !(name in EMPTY_OBJECT) && false + } + ], + dependencies: undefined + }; + } else { + const from = moduleGraph.getConnection(this); + if (!from) return; + const reexportInfo = this.getStarReexports( + moduleGraph, + undefined, + from.module + ); + if (reexportInfo) { + return { + exports: Array.from(reexportInfo.exports, name => { + return { + name, + from, + export: ids.concat(name), + canMangle: !(name in EMPTY_OBJECT) && false + }; + }), + // TODO handle deep reexports + dependencies: [from.module] + }; + } else { + return { + exports: true, + from: ids.length === 0 ? from : undefined, + canMangle: false, + dependencies: [from.module] + }; + } + } } /** - * @returns {Set} types available (do not mutate) + * @param {ModuleGraph} moduleGraph the module graph + * @param {RuntimeSpec} runtime the runtime + * @param {Module} importedModule the imported module (optional) + * @returns {{exports?: Set, checked?: Set}} information */ - getSourceTypes() { - return TYPES; - } + getStarReexports( + moduleGraph, + runtime, + importedModule = moduleGraph.getModule(this) + ) { + let importedExportsInfo = moduleGraph.getExportsInfo(importedModule); + const ids = this.getIds(moduleGraph); + if (ids.length > 0) + importedExportsInfo = importedExportsInfo.getNestedExportsInfo(ids); + let exportsInfo = moduleGraph.getExportsInfo( + moduleGraph.getParentModule(this) + ); + if (this.names.length > 0) + exportsInfo = exportsInfo.getNestedExportsInfo(this.names); - /** - * @returns {string | null} absolute path which should be used for condition matching (usually the resource path) - */ - nameForCondition() { - return this.request; - } + const noExtraExports = + importedExportsInfo && + importedExportsInfo.otherExportsInfo.provided === false; + const noExtraImports = + exportsInfo && + exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused; - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { - const module = moduleGraph.getModule(this.dependencies[0]); - const id = module && chunkGraph.getModuleId(module); - const sources = new Map(); - sources.set("remote", new RawSource("")); - const data = new Map(); - data.set("share-init", [ - { - shareScope: this.shareScope, - initStage: 20, - init: id === undefined ? "" : `initExternal(${JSON.stringify(id)});` + if (!noExtraExports && !noExtraImports) { + return; + } + + const isNamespaceImport = + importedModule.getExportsType(moduleGraph, false) === "namespace"; + + /** @type {Set} */ + const exports = new Set(); + /** @type {Set} */ + const checked = new Set(); + + if (noExtraImports) { + for (const exportInfo of exportsInfo.orderedExports) { + const name = exportInfo.name; + if (exportInfo.getUsed(runtime) === UsageState.Unused) continue; + if (name === "__esModule" && isNamespaceImport) { + exports.add(name); + } else if (importedExportsInfo) { + const importedExportInfo = + importedExportsInfo.getReadOnlyExportInfo(name); + if (importedExportInfo.provided === false) continue; + exports.add(name); + if (importedExportInfo.provided === true) continue; + checked.add(name); + } else { + exports.add(name); + checked.add(name); + } } - ]); - return { sources, data, runtimeRequirements: RUNTIME_REQUIREMENTS }; + } else if (noExtraExports) { + for (const importedExportInfo of importedExportsInfo.orderedExports) { + const name = importedExportInfo.name; + if (importedExportInfo.provided === false) continue; + if (exportsInfo) { + const exportInfo = exportsInfo.getReadOnlyExportInfo(name); + if (exportInfo.getUsed(runtime) === UsageState.Unused) continue; + } + exports.add(name); + if (importedExportInfo.provided === true) continue; + checked.add(name); + } + if (isNamespaceImport) { + exports.add("__esModule"); + checked.delete("__esModule"); + } + } + + return { exports, checked }; } serialize(context) { const { write } = context; - write(this.request); - write(this.externalRequests); - write(this.internalRequest); - write(this.shareScope); + write(this.asiSafe); + write(this.range); + write(this.valueRange); + write(this.base); + write(this.names); + write(this.ids); + write(this.resultUsed); super.serialize(context); } - static deserialize(context) { + deserialize(context) { const { read } = context; - const obj = new RemoteModule(read(), read(), read(), read()); - obj.deserialize(context); - return obj; + this.asiSafe = read(); + this.range = read(); + this.valueRange = read(); + this.base = read(); + this.names = read(); + this.ids = read(); + this.resultUsed = read(); + super.deserialize(context); } } -makeSerializable(RemoteModule, "webpack/lib/container/RemoteModule"); +makeSerializable( + CommonJsExportRequireDependency, + "webpack/lib/dependencies/CommonJsExportRequireDependency" +); -module.exports = RemoteModule; +CommonJsExportRequireDependency.Template = class CommonJsExportRequireDependencyTemplate extends ( + ModuleDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { + module, + runtimeTemplate, + chunkGraph, + moduleGraph, + runtimeRequirements, + runtime + } + ) { + const dep = /** @type {CommonJsExportRequireDependency} */ (dependency); + const used = moduleGraph + .getExportsInfo(module) + .getUsedName(dep.names, runtime); + const [type, base] = handleDependencyBase( + dep.base, + module, + runtimeRequirements + ); -/***/ }), + const importedModule = moduleGraph.getModule(dep); + let requireExpr = runtimeTemplate.moduleExports({ + module: importedModule, + chunkGraph, + request: dep.request, + weak: dep.weak, + runtimeRequirements + }); + if (importedModule) { + const ids = dep.getIds(moduleGraph); + const usedImported = moduleGraph + .getExportsInfo(importedModule) + .getUsedName(ids, runtime); + if (usedImported) { + const comment = equals(usedImported, ids) + ? "" + : Template.toNormalComment(propertyAccess(ids)) + " "; + requireExpr += `${comment}${propertyAccess(usedImported)}`; + } + } -/***/ 88288: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + switch (type) { + case "expression": + source.replace( + dep.range[0], + dep.range[1] - 1, + used + ? `${base}${propertyAccess(used)} = ${requireExpr}` + : `/* unused reexport */ ${requireExpr}` + ); + return; + case "Object.defineProperty": + throw new Error("TODO"); + default: + throw new Error("Unexpected type"); + } + } +}; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); - -/** @typedef {import("./RemoteModule")} RemoteModule */ - -class RemoteRuntimeModule extends RuntimeModule { - constructor() { - super("remotes loading"); - } - - /** - * @returns {string} runtime code - */ - generate() { - const { compilation, chunkGraph } = this; - const { runtimeTemplate, moduleGraph } = compilation; - const chunkToRemotesMapping = {}; - const idToExternalAndNameMapping = {}; - for (const chunk of this.chunk.getAllAsyncChunks()) { - const modules = chunkGraph.getChunkModulesIterableBySourceType( - chunk, - "remote" - ); - if (!modules) continue; - const remotes = (chunkToRemotesMapping[chunk.id] = []); - for (const m of modules) { - const module = /** @type {RemoteModule} */ (m); - const name = module.internalRequest; - const id = chunkGraph.getModuleId(module); - const shareScope = module.shareScope; - const dep = module.dependencies[0]; - const externalModule = moduleGraph.getModule(dep); - const externalModuleId = - externalModule && chunkGraph.getModuleId(externalModule); - remotes.push(id); - idToExternalAndNameMapping[id] = [shareScope, name, externalModuleId]; - } - } - return Template.asString([ - `var chunkMapping = ${JSON.stringify( - chunkToRemotesMapping, - null, - "\t" - )};`, - `var idToExternalAndNameMapping = ${JSON.stringify( - idToExternalAndNameMapping, - null, - "\t" - )};`, - `${ - RuntimeGlobals.ensureChunkHandlers - }.remotes = ${runtimeTemplate.basicFunction("chunkId, promises", [ - `if(${RuntimeGlobals.hasOwnProperty}(chunkMapping, chunkId)) {`, - Template.indent([ - `chunkMapping[chunkId].forEach(${runtimeTemplate.basicFunction("id", [ - `var getScope = ${RuntimeGlobals.currentRemoteGetScope};`, - "if(!getScope) getScope = [];", - "var data = idToExternalAndNameMapping[id];", - "if(getScope.indexOf(data) >= 0) return;", - "getScope.push(data);", - `if(data.p) return promises.push(data.p);`, - `var onError = ${runtimeTemplate.basicFunction("error", [ - 'if(!error) error = new Error("Container missing");', - 'if(typeof error.message === "string")', - Template.indent( - `error.message += '\\nwhile loading "' + data[1] + '" from ' + data[2];` - ), - `__webpack_modules__[id] = ${runtimeTemplate.basicFunction("", [ - "throw error;" - ])}`, - "data.p = 0;" - ])};`, - `var handleFunction = ${runtimeTemplate.basicFunction( - "fn, arg1, arg2, d, next, first", - [ - "try {", - Template.indent([ - "var promise = fn(arg1, arg2);", - "if(promise && promise.then) {", - Template.indent([ - `var p = promise.then(${runtimeTemplate.returningFunction( - "next(result, d)", - "result" - )}, onError);`, - `if(first) promises.push(data.p = p); else return p;` - ]), - "} else {", - Template.indent(["return next(promise, d, first);"]), - "}" - ]), - "} catch(error) {", - Template.indent(["onError(error);"]), - "}" - ] - )}`, - `var onExternal = ${runtimeTemplate.returningFunction( - `external ? handleFunction(${RuntimeGlobals.initializeSharing}, data[0], 0, external, onInitialized, first) : onError()`, - "external, _, first" - )};`, - `var onInitialized = ${runtimeTemplate.returningFunction( - `handleFunction(external.get, data[1], getScope, 0, onFactory, first)`, - "_, external, first" - )};`, - `var onFactory = ${runtimeTemplate.basicFunction("factory", [ - "data.p = 1;", - `__webpack_modules__[id] = ${runtimeTemplate.basicFunction( - "module", - ["module.exports = factory();"] - )}` - ])};`, - "handleFunction(__webpack_require__, data[2], 0, 0, onExternal, 1);" - ])});` - ]), - "}" - ])}` - ]); - } -} - -module.exports = RemoteRuntimeModule; +module.exports = CommonJsExportRequireDependency; /***/ }), -/***/ 14389: +/***/ 45598: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -74939,397 +72918,652 @@ module.exports = RemoteRuntimeModule; -const ModuleDependency = __webpack_require__(80321); +const InitFragment = __webpack_require__(55870); const makeSerializable = __webpack_require__(33032); +const propertyAccess = __webpack_require__(54190); +const { handleDependencyBase } = __webpack_require__(59643); +const NullDependency = __webpack_require__(31830); -class RemoteToExternalDependency extends ModuleDependency { - constructor(request) { - super(request); +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ + +const EMPTY_OBJECT = {}; + +class CommonJsExportsDependency extends NullDependency { + constructor(range, valueRange, base, names) { + super(); + this.range = range; + this.valueRange = valueRange; + this.base = base; + this.names = names; } get type() { - return "remote to external"; + return "cjs exports"; } - get category() { - return "esm"; + /** + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names + */ + getExports(moduleGraph) { + const name = this.names[0]; + return { + exports: [ + { + name, + // we can't mangle names that are in an empty object + // because one could access the prototype property + // when export isn't set yet + canMangle: !(name in EMPTY_OBJECT) + } + ], + dependencies: undefined + }; + } + + serialize(context) { + const { write } = context; + write(this.range); + write(this.valueRange); + write(this.base); + write(this.names); + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + this.range = read(); + this.valueRange = read(); + this.base = read(); + this.names = read(); + super.deserialize(context); } } makeSerializable( - RemoteToExternalDependency, - "webpack/lib/container/RemoteToExternalDependency" + CommonJsExportsDependency, + "webpack/lib/dependencies/CommonJsExportsDependency" ); -module.exports = RemoteToExternalDependency; - - -/***/ }), - -/***/ 3083: -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - +CommonJsExportsDependency.Template = class CommonJsExportsDependencyTemplate extends ( + NullDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { module, moduleGraph, initFragments, runtimeRequirements, runtime } + ) { + const dep = /** @type {CommonJsExportsDependency} */ (dependency); + const used = moduleGraph + .getExportsInfo(module) + .getUsedName(dep.names, runtime); -/** @template T @typedef {(string | Record)[] | Record} ContainerOptionsFormat */ + const [type, base] = handleDependencyBase( + dep.base, + module, + runtimeRequirements + ); -/** - * @template T - * @template N - * @param {ContainerOptionsFormat} options options passed by the user - * @param {function(string | string[], string) : N} normalizeSimple normalize a simple item - * @param {function(T, string) : N} normalizeOptions normalize a complex item - * @param {function(string, N): void} fn processing function - * @returns {void} - */ -const process = (options, normalizeSimple, normalizeOptions, fn) => { - const array = items => { - for (const item of items) { - if (typeof item === "string") { - fn(item, normalizeSimple(item, item)); - } else if (item && typeof item === "object") { - object(item); - } else { - throw new Error("Unexpected options format"); - } - } - }; - const object = obj => { - for (const [key, value] of Object.entries(obj)) { - if (typeof value === "string" || Array.isArray(value)) { - fn(key, normalizeSimple(value, key)); - } else { - fn(key, normalizeOptions(value, key)); - } + switch (type) { + case "expression": + if (!used) { + initFragments.push( + new InitFragment( + "var __webpack_unused_export__;\n", + InitFragment.STAGE_CONSTANTS, + 0, + "__webpack_unused_export__" + ) + ); + source.replace( + dep.range[0], + dep.range[1] - 1, + "__webpack_unused_export__" + ); + return; + } + source.replace( + dep.range[0], + dep.range[1] - 1, + `${base}${propertyAccess(used)}` + ); + return; + case "Object.defineProperty": + if (!used) { + initFragments.push( + new InitFragment( + "var __webpack_unused_export__;\n", + InitFragment.STAGE_CONSTANTS, + 0, + "__webpack_unused_export__" + ) + ); + source.replace( + dep.range[0], + dep.valueRange[0] - 1, + "__webpack_unused_export__ = (" + ); + source.replace(dep.valueRange[1], dep.range[1] - 1, ")"); + return; + } + source.replace( + dep.range[0], + dep.valueRange[0] - 1, + `Object.defineProperty(${base}${propertyAccess( + used.slice(0, -1) + )}, ${JSON.stringify(used[used.length - 1])}, (` + ); + source.replace(dep.valueRange[1], dep.range[1] - 1, "))"); + return; } - }; - if (!options) { - return; - } else if (Array.isArray(options)) { - array(options); - } else if (typeof options === "object") { - object(options); - } else { - throw new Error("Unexpected options format"); } }; -/** - * @template T - * @template R - * @param {ContainerOptionsFormat} options options passed by the user - * @param {function(string | string[], string) : R} normalizeSimple normalize a simple item - * @param {function(T, string) : R} normalizeOptions normalize a complex item - * @returns {[string, R][]} parsed options - */ -const parseOptions = (options, normalizeSimple, normalizeOptions) => { - /** @type {[string, R][]} */ - const items = []; - process(options, normalizeSimple, normalizeOptions, (key, value) => { - items.push([key, value]); - }); - return items; -}; - -/** - * @template T - * @param {string} scope scope name - * @param {ContainerOptionsFormat} options options passed by the user - * @returns {Record} options to spread or pass - */ -const scope = (scope, options) => { - /** @type {Record} */ - const obj = {}; - process( - options, - item => /** @type {string | string[] | T} */ (item), - item => /** @type {string | string[] | T} */ (item), - (key, value) => { - obj[ - key.startsWith("./") ? `${scope}${key.slice(1)}` : `${scope}/${key}` - ] = value; - } - ); - return obj; -}; - -exports.parseOptions = parseOptions; -exports.scope = scope; +module.exports = CommonJsExportsDependency; /***/ }), -/***/ 91254: +/***/ 97107: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Sergey Melyukov @smelukov + Author Tobias Koppers @sokra */ -const { ReplaceSource, RawSource, ConcatSource } = __webpack_require__(51255); -const { UsageState } = __webpack_require__(63686); -const Generator = __webpack_require__(93401); const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); +const formatLocation = __webpack_require__(16734); +const { evaluateToString } = __webpack_require__(93998); +const propertyAccess = __webpack_require__(54190); +const CommonJsExportRequireDependency = __webpack_require__(62892); +const CommonJsExportsDependency = __webpack_require__(45598); +const CommonJsSelfReferenceDependency = __webpack_require__(52225); +const DynamicExports = __webpack_require__(32006); +const HarmonyExports = __webpack_require__(39211); +const ModuleDecoratorDependency = __webpack_require__(88488); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../Generator").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ +/** @typedef {import("estree").Expression} ExpressionNode */ /** @typedef {import("../NormalModule")} NormalModule */ -/** @typedef {import("../util/Hash")} Hash */ - -const TYPES = new Set(["javascript"]); +/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */ +/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ -class CssExportsGenerator extends Generator { - constructor() { - super(); +const getValueOfPropertyDescription = expr => { + if (expr.type !== "ObjectExpression") return; + for (const property of expr.properties) { + if (property.computed) continue; + const key = property.key; + if (key.type !== "Identifier" || key.name !== "value") continue; + return property.value; } +}; - // TODO add getConcatenationBailoutReason to allow concatenation - // but how to make it have a module id +const isTruthyLiteral = expr => { + switch (expr.type) { + case "Literal": + return !!expr.value; + case "UnaryExpression": + if (expr.operator === "!") return isFalsyLiteral(expr.argument); + } + return false; +}; - /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code - */ - generate(module, generateContext) { - const source = new ReplaceSource(new RawSource("")); - const initFragments = []; - const cssExports = new Map(); +const isFalsyLiteral = expr => { + switch (expr.type) { + case "Literal": + return !expr.value; + case "UnaryExpression": + if (expr.operator === "!") return isTruthyLiteral(expr.argument); + } + return false; +}; - generateContext.runtimeRequirements.add(RuntimeGlobals.module); +/** + * @param {JavascriptParser} parser the parser + * @param {ExpressionNode} expr expression + * @returns {{ argument: BasicEvaluatedExpression, ids: string[] } | undefined} parsed call + */ +const parseRequireCall = (parser, expr) => { + const ids = []; + while (expr.type === "MemberExpression") { + if (expr.object.type === "Super") return; + if (!expr.property) return; + const prop = expr.property; + if (expr.computed) { + if (prop.type !== "Literal") return; + ids.push(`${prop.value}`); + } else { + if (prop.type !== "Identifier") return; + ids.push(prop.name); + } + expr = expr.object; + } + if (expr.type !== "CallExpression" || expr.arguments.length !== 1) return; + const callee = expr.callee; + if ( + callee.type !== "Identifier" || + parser.getVariableInfo(callee.name) !== "require" + ) { + return; + } + const arg = expr.arguments[0]; + if (arg.type === "SpreadElement") return; + const argValue = parser.evaluateExpression(arg); + return { argument: argValue, ids: ids.reverse() }; +}; - const runtimeRequirements = new Set(); +class CommonJsExportsParserPlugin { + constructor(moduleGraph) { + this.moduleGraph = moduleGraph; + } - const templateContext = { - runtimeTemplate: generateContext.runtimeTemplate, - dependencyTemplates: generateContext.dependencyTemplates, - moduleGraph: generateContext.moduleGraph, - chunkGraph: generateContext.chunkGraph, - module, - runtime: generateContext.runtime, - runtimeRequirements: runtimeRequirements, - concatenationScope: generateContext.concatenationScope, - codeGenerationResults: generateContext.codeGenerationResults, - initFragments, - cssExports + /** + * @param {JavascriptParser} parser the parser + */ + apply(parser) { + const enableStructuredExports = () => { + DynamicExports.enable(parser.state); }; - - const handleDependency = dependency => { - const constructor = /** @type {new (...args: any[]) => Dependency} */ ( - dependency.constructor - ); - const template = generateContext.dependencyTemplates.get(constructor); - if (!template) { - throw new Error( - "No template for dependency: " + dependency.constructor.name - ); + const checkNamespace = (topLevel, members, valueExpr) => { + if (!DynamicExports.isEnabled(parser.state)) return; + if (members.length > 0 && members[0] === "__esModule") { + if (valueExpr && isTruthyLiteral(valueExpr) && topLevel) { + DynamicExports.setFlagged(parser.state); + } else { + DynamicExports.setDynamic(parser.state); + } } - - template.apply(dependency, source, templateContext); }; - module.dependencies.forEach(handleDependency); - - if (generateContext.concatenationScope) { - const source = new ConcatSource(); - const usedIdentifiers = new Set(); - for (const [k, v] of cssExports) { - let identifier = Template.toIdentifier(k); - let i = 0; - while (usedIdentifiers.has(identifier)) { - identifier = Template.toIdentifier(k + i); + const bailout = reason => { + DynamicExports.bailout(parser.state); + if (reason) bailoutHint(reason); + }; + const bailoutHint = reason => { + this.moduleGraph + .getOptimizationBailout(parser.state.module) + .push(`CommonJS bailout: ${reason}`); + }; + + // metadata // + parser.hooks.evaluateTypeof + .for("module") + .tap("CommonJsExportsParserPlugin", evaluateToString("object")); + parser.hooks.evaluateTypeof + .for("exports") + .tap("CommonJsPlugin", evaluateToString("object")); + + // exporting // + const handleAssignExport = (expr, base, members) => { + if (HarmonyExports.isEnabled(parser.state)) return; + // Handle reexporting + const requireCall = parseRequireCall(parser, expr.right); + if ( + requireCall && + requireCall.argument.isString() && + (members.length === 0 || members[0] !== "__esModule") + ) { + enableStructuredExports(); + // It's possible to reexport __esModule, so we must convert to a dynamic module + if (members.length === 0) DynamicExports.setDynamic(parser.state); + const dep = new CommonJsExportRequireDependency( + expr.range, + null, + base, + members, + requireCall.argument.string, + requireCall.ids, + !parser.isStatementLevelExpression(expr) + ); + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.module.addDependency(dep); + return true; + } + if (members.length === 0) return; + enableStructuredExports(); + const remainingMembers = members; + checkNamespace( + parser.statementPath.length === 1 && + parser.isStatementLevelExpression(expr), + remainingMembers, + expr.right + ); + const dep = new CommonJsExportsDependency( + expr.left.range, + null, + base, + remainingMembers + ); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + parser.walkExpression(expr.right); + return true; + }; + parser.hooks.assignMemberChain + .for("exports") + .tap("CommonJsExportsParserPlugin", (expr, members) => { + return handleAssignExport(expr, "exports", members); + }); + parser.hooks.assignMemberChain + .for("this") + .tap("CommonJsExportsParserPlugin", (expr, members) => { + if (!parser.scope.topLevelScope) return; + return handleAssignExport(expr, "this", members); + }); + parser.hooks.assignMemberChain + .for("module") + .tap("CommonJsExportsParserPlugin", (expr, members) => { + if (members[0] !== "exports") return; + return handleAssignExport(expr, "module.exports", members.slice(1)); + }); + parser.hooks.call + .for("Object.defineProperty") + .tap("CommonJsExportsParserPlugin", expression => { + const expr = /** @type {import("estree").CallExpression} */ ( + expression + ); + if (!parser.isStatementLevelExpression(expr)) return; + if (expr.arguments.length !== 3) return; + if (expr.arguments[0].type === "SpreadElement") return; + if (expr.arguments[1].type === "SpreadElement") return; + if (expr.arguments[2].type === "SpreadElement") return; + const exportsArg = parser.evaluateExpression(expr.arguments[0]); + if (!exportsArg || !exportsArg.isIdentifier()) return; + if ( + exportsArg.identifier !== "exports" && + exportsArg.identifier !== "module.exports" && + (exportsArg.identifier !== "this" || !parser.scope.topLevelScope) + ) { + return; } - usedIdentifiers.add(identifier); - generateContext.concatenationScope.registerExport(k, identifier); - source.add( - `${ - generateContext.runtimeTemplate.supportsConst ? "const" : "var" - } ${identifier} = ${JSON.stringify(v)};\n` + const propertyArg = parser.evaluateExpression(expr.arguments[1]); + if (!propertyArg) return; + const property = propertyArg.asString(); + if (typeof property !== "string") return; + enableStructuredExports(); + const descArg = expr.arguments[2]; + checkNamespace( + parser.statementPath.length === 1, + [property], + getValueOfPropertyDescription(descArg) + ); + const dep = new CommonJsExportsDependency( + expr.range, + expr.arguments[2].range, + `Object.defineProperty(${exportsArg.identifier})`, + [property] ); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + + parser.walkExpression(expr.arguments[2]); + return true; + }); + + // Self reference // + const handleAccessExport = (expr, base, members, call = undefined) => { + if (HarmonyExports.isEnabled(parser.state)) return; + if (members.length === 0) { + bailout(`${base} is used directly at ${formatLocation(expr.loc)}`); } - return source; - } else { - const otherUsed = - generateContext.moduleGraph - .getExportsInfo(module) - .otherExportsInfo.getUsed(generateContext.runtime) !== - UsageState.Unused; - if (otherUsed) { - generateContext.runtimeRequirements.add( - RuntimeGlobals.makeNamespaceObject + if (call && members.length === 1) { + bailoutHint( + `${base}${propertyAccess( + members + )}(...) prevents optimization as ${base} is passed as call context at ${formatLocation( + expr.loc + )}` ); } - return new RawSource( - `${otherUsed ? `${RuntimeGlobals.makeNamespaceObject}(` : ""}${ - module.moduleArgument - }.exports = {\n${Array.from( - cssExports, - ([k, v]) => `\t${JSON.stringify(k)}: ${JSON.stringify(v)}` - ).join(",\n")}\n}${otherUsed ? ")" : ""};` + const dep = new CommonJsSelfReferenceDependency( + expr.range, + base, + members, + !!call ); - } - } - - /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) - */ - getTypes(module) { - return TYPES; - } + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + if (call) { + parser.walkExpressions(call.arguments); + } + return true; + }; + parser.hooks.callMemberChain + .for("exports") + .tap("CommonJsExportsParserPlugin", (expr, members) => { + return handleAccessExport(expr.callee, "exports", members, expr); + }); + parser.hooks.expressionMemberChain + .for("exports") + .tap("CommonJsExportsParserPlugin", (expr, members) => { + return handleAccessExport(expr, "exports", members); + }); + parser.hooks.expression + .for("exports") + .tap("CommonJsExportsParserPlugin", expr => { + return handleAccessExport(expr, "exports", []); + }); + parser.hooks.callMemberChain + .for("module") + .tap("CommonJsExportsParserPlugin", (expr, members) => { + if (members[0] !== "exports") return; + return handleAccessExport( + expr.callee, + "module.exports", + members.slice(1), + expr + ); + }); + parser.hooks.expressionMemberChain + .for("module") + .tap("CommonJsExportsParserPlugin", (expr, members) => { + if (members[0] !== "exports") return; + return handleAccessExport(expr, "module.exports", members.slice(1)); + }); + parser.hooks.expression + .for("module.exports") + .tap("CommonJsExportsParserPlugin", expr => { + return handleAccessExport(expr, "module.exports", []); + }); + parser.hooks.callMemberChain + .for("this") + .tap("CommonJsExportsParserPlugin", (expr, members) => { + if (!parser.scope.topLevelScope) return; + return handleAccessExport(expr.callee, "this", members, expr); + }); + parser.hooks.expressionMemberChain + .for("this") + .tap("CommonJsExportsParserPlugin", (expr, members) => { + if (!parser.scope.topLevelScope) return; + return handleAccessExport(expr, "this", members); + }); + parser.hooks.expression + .for("this") + .tap("CommonJsExportsParserPlugin", expr => { + if (!parser.scope.topLevelScope) return; + return handleAccessExport(expr, "this", []); + }); - /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module - */ - getSize(module, type) { - return 42; + // Bailouts // + parser.hooks.expression.for("module").tap("CommonJsPlugin", expr => { + bailout(); + const isHarmony = HarmonyExports.isEnabled(parser.state); + const dep = new ModuleDecoratorDependency( + isHarmony + ? RuntimeGlobals.harmonyModuleDecorator + : RuntimeGlobals.nodeModuleDecorator, + !isHarmony + ); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + return true; + }); } - - /** - * @param {Hash} hash hash that will be modified - * @param {UpdateHashContext} updateHashContext context for updating hash - */ - updateHash(hash, { module }) {} } - -module.exports = CssExportsGenerator; +module.exports = CommonJsExportsParserPlugin; /***/ }), -/***/ 46061: +/***/ 59440: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Sergey Melyukov @smelukov + Author Tobias Koppers @sokra */ -const { ReplaceSource } = __webpack_require__(51255); -const Generator = __webpack_require__(93401); -const InitFragment = __webpack_require__(55870); -const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const { equals } = __webpack_require__(84953); +const makeSerializable = __webpack_require__(33032); +const propertyAccess = __webpack_require__(54190); +const ModuleDependency = __webpack_require__(80321); -/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ /** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../Generator").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../NormalModule")} NormalModule */ -/** @typedef {import("../util/Hash")} Hash */ - -const TYPES = new Set(["css"]); +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -class CssGenerator extends Generator { - constructor() { - super(); +class CommonJsFullRequireDependency extends ModuleDependency { + /** + * @param {string} request the request string + * @param {[number, number]} range location in source code + * @param {string[]} names accessed properties on module + */ + constructor(request, range, names) { + super(request); + this.range = range; + this.names = names; + this.call = false; + this.asiSafe = undefined; } /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports */ - generate(module, generateContext) { - const originalSource = module.originalSource(); - const source = new ReplaceSource(originalSource); - const initFragments = []; - const cssExports = new Map(); - - generateContext.runtimeRequirements.add(RuntimeGlobals.hasCssModules); - - const templateContext = { - runtimeTemplate: generateContext.runtimeTemplate, - dependencyTemplates: generateContext.dependencyTemplates, - moduleGraph: generateContext.moduleGraph, - chunkGraph: generateContext.chunkGraph, - module, - runtime: generateContext.runtime, - runtimeRequirements: generateContext.runtimeRequirements, - concatenationScope: generateContext.concatenationScope, - codeGenerationResults: generateContext.codeGenerationResults, - initFragments, - cssExports - }; - - const handleDependency = dependency => { - const constructor = /** @type {new (...args: any[]) => Dependency} */ ( - dependency.constructor - ); - const template = generateContext.dependencyTemplates.get(constructor); - if (!template) { - throw new Error( - "No template for dependency: " + dependency.constructor.name - ); + getReferencedExports(moduleGraph, runtime) { + if (this.call) { + const importedModule = moduleGraph.getModule(this); + if ( + !importedModule || + importedModule.getExportsType(moduleGraph, false) !== "namespace" + ) { + return [this.names.slice(0, -1)]; } + } + return [this.names]; + } - template.apply(dependency, source, templateContext); - }; - module.dependencies.forEach(handleDependency); - if (module.presentationalDependencies !== undefined) - module.presentationalDependencies.forEach(handleDependency); + serialize(context) { + const { write } = context; + write(this.names); + write(this.call); + write(this.asiSafe); + super.serialize(context); + } - if (cssExports.size > 0) { - const data = generateContext.getData(); - data.set("css-exports", cssExports); - } + deserialize(context) { + const { read } = context; + this.names = read(); + this.call = read(); + this.asiSafe = read(); + super.deserialize(context); + } - return InitFragment.addToSource(source, initFragments, generateContext); + get type() { + return "cjs full require"; } - /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) - */ - getTypes(module) { - return TYPES; + get category() { + return "commonjs"; } +} +CommonJsFullRequireDependency.Template = class CommonJsFullRequireDependencyTemplate extends ( + ModuleDependency.Template +) { /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - getSize(module, type) { - const originalSource = module.originalSource(); - - if (!originalSource) { - return 0; + apply( + dependency, + source, + { + module, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtimeRequirements, + runtime, + initFragments } - - return originalSource.size(); + ) { + const dep = /** @type {CommonJsFullRequireDependency} */ (dependency); + if (!dep.range) return; + const importedModule = moduleGraph.getModule(dep); + let requireExpr = runtimeTemplate.moduleExports({ + module: importedModule, + chunkGraph, + request: dep.request, + weak: dep.weak, + runtimeRequirements + }); + if (importedModule) { + const ids = dep.names; + const usedImported = moduleGraph + .getExportsInfo(importedModule) + .getUsedName(ids, runtime); + if (usedImported) { + const comment = equals(usedImported, ids) + ? "" + : Template.toNormalComment(propertyAccess(ids)) + " "; + const access = `${comment}${propertyAccess(usedImported)}`; + requireExpr = + dep.asiSafe === true + ? `(${requireExpr}${access})` + : `${requireExpr}${access}`; + } + } + source.replace(dep.range[0], dep.range[1] - 1, requireExpr); } +}; - /** - * @param {Hash} hash hash that will be modified - * @param {UpdateHashContext} updateHashContext context for updating hash - */ - updateHash(hash, { module }) {} -} +makeSerializable( + CommonJsFullRequireDependency, + "webpack/lib/dependencies/CommonJsFullRequireDependency" +); -module.exports = CssGenerator; +module.exports = CommonJsFullRequireDependency; /***/ }), -/***/ 80806: +/***/ 36013: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -75340,444 +73574,392 @@ module.exports = CssGenerator; -const { SyncWaterfallHook } = __webpack_require__(41242); -const Compilation = __webpack_require__(85720); +const CommentCompilationWarning = __webpack_require__(98427); const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); -const compileBooleanMatcher = __webpack_require__(29404); -const { chunkHasCss } = __webpack_require__(47283); - -/** @typedef {import("../Chunk")} Chunk */ - -/** - * @typedef {Object} JsonpCompilationPluginHooks - * @property {SyncWaterfallHook<[string, Chunk]>} createStylesheet - */ +const UnsupportedFeatureWarning = __webpack_require__(42495); +const { + evaluateToIdentifier, + evaluateToString, + expressionIsUnsupported, + toConstantDependency +} = __webpack_require__(93998); +const CommonJsFullRequireDependency = __webpack_require__(59440); +const CommonJsRequireContextDependency = __webpack_require__(23962); +const CommonJsRequireDependency = __webpack_require__(21264); +const ConstDependency = __webpack_require__(76911); +const ContextDependencyHelpers = __webpack_require__(99630); +const LocalModuleDependency = __webpack_require__(52805); +const { getLocalModule } = __webpack_require__(75827); +const RequireHeaderDependency = __webpack_require__(89183); +const RequireResolveContextDependency = __webpack_require__(55627); +const RequireResolveDependency = __webpack_require__(68582); +const RequireResolveHeaderDependency = __webpack_require__(9880); -/** @type {WeakMap} */ -const compilationHooksMap = new WeakMap(); +/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ -class CssLoadingRuntimeModule extends RuntimeModule { +class CommonJsImportsParserPlugin { /** - * @param {Compilation} compilation the compilation - * @returns {JsonpCompilationPluginHooks} hooks + * @param {JavascriptParserOptions} options parser options */ - static getCompilationHooks(compilation) { - if (!(compilation instanceof Compilation)) { - throw new TypeError( - "The 'compilation' argument must be an instance of Compilation" - ); - } - let hooks = compilationHooksMap.get(compilation); - if (hooks === undefined) { - hooks = { - createStylesheet: new SyncWaterfallHook(["source", "chunk"]) - }; - compilationHooksMap.set(compilation, hooks); - } - return hooks; + constructor(options) { + this.options = options; } - constructor(runtimeRequirements, runtimeOptions) { - super("css loading", 10); + apply(parser) { + const options = this.options; - this._runtimeRequirements = runtimeRequirements; - this.runtimeOptions = runtimeOptions; - } + // metadata // + const tapRequireExpression = (expression, getMembers) => { + parser.hooks.typeof + .for(expression) + .tap( + "CommonJsPlugin", + toConstantDependency(parser, JSON.stringify("function")) + ); + parser.hooks.evaluateTypeof + .for(expression) + .tap("CommonJsPlugin", evaluateToString("function")); + parser.hooks.evaluateIdentifier + .for(expression) + .tap( + "CommonJsPlugin", + evaluateToIdentifier(expression, "require", getMembers, true) + ); + }; + tapRequireExpression("require", () => []); + tapRequireExpression("require.resolve", () => ["resolve"]); + tapRequireExpression("require.resolveWeak", () => ["resolveWeak"]); - /** - * @returns {string} runtime code - */ - generate() { - const { compilation, chunk, _runtimeRequirements } = this; - const { - chunkGraph, - runtimeTemplate, - outputOptions: { - crossOriginLoading, - uniqueName, - chunkLoadTimeout: loadTimeout + // Weird stuff // + parser.hooks.assign.for("require").tap("CommonJsPlugin", expr => { + // to not leak to global "require", we need to define a local require here. + const dep = new ConstDependency("var require;", 0); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + + // Unsupported // + parser.hooks.expression + .for("require.main.require") + .tap( + "CommonJsPlugin", + expressionIsUnsupported( + parser, + "require.main.require is not supported by webpack." + ) + ); + parser.hooks.call + .for("require.main.require") + .tap( + "CommonJsPlugin", + expressionIsUnsupported( + parser, + "require.main.require is not supported by webpack." + ) + ); + parser.hooks.expression + .for("module.parent.require") + .tap( + "CommonJsPlugin", + expressionIsUnsupported( + parser, + "module.parent.require is not supported by webpack." + ) + ); + parser.hooks.call + .for("module.parent.require") + .tap( + "CommonJsPlugin", + expressionIsUnsupported( + parser, + "module.parent.require is not supported by webpack." + ) + ); + + // renaming // + parser.hooks.canRename.for("require").tap("CommonJsPlugin", () => true); + parser.hooks.rename.for("require").tap("CommonJsPlugin", expr => { + // To avoid "not defined" error, replace the value with undefined + const dep = new ConstDependency("undefined", expr.range); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return false; + }); + + // inspection // + parser.hooks.expression + .for("require.cache") + .tap( + "CommonJsImportsParserPlugin", + toConstantDependency(parser, RuntimeGlobals.moduleCache, [ + RuntimeGlobals.moduleCache, + RuntimeGlobals.moduleId, + RuntimeGlobals.moduleLoaded + ]) + ); + + // require as expression // + parser.hooks.expression + .for("require") + .tap("CommonJsImportsParserPlugin", expr => { + const dep = new CommonJsRequireContextDependency( + { + request: options.unknownContextRequest, + recursive: options.unknownContextRecursive, + regExp: options.unknownContextRegExp, + mode: "sync" + }, + expr.range, + undefined, + parser.scope.inShorthand + ); + dep.critical = + options.unknownContextCritical && + "require function is used in a way in which dependencies cannot be statically extracted"; + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; + }); + + // require // + const processRequireItem = (expr, param) => { + if (param.isString()) { + const dep = new CommonJsRequireDependency(param.string, param.range); + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; } - } = compilation; - const fn = RuntimeGlobals.ensureChunkHandlers; - const conditionMap = chunkGraph.getChunkConditionMap( - chunk, - (chunk, chunkGraph) => - !!chunkGraph.getChunkModulesIterableBySourceType(chunk, "css") - ); - const hasCssMatcher = compileBooleanMatcher(conditionMap); + }; + const processRequireContext = (expr, param) => { + const dep = ContextDependencyHelpers.create( + CommonJsRequireContextDependency, + expr.range, + param, + expr, + options, + { + category: "commonjs" + }, + parser + ); + if (!dep) return; + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; + }; + const createRequireHandler = callNew => expr => { + if (options.commonjsMagicComments) { + const { options: requireOptions, errors: commentErrors } = + parser.parseCommentOptions(expr.range); - const withLoading = - _runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers) && - hasCssMatcher !== false; - const withHmr = _runtimeRequirements.has( - RuntimeGlobals.hmrDownloadUpdateHandlers - ); - const initialChunkIdsWithCss = new Set(); - const initialChunkIdsWithoutCss = new Set(); - for (const c of chunk.getAllInitialChunks()) { - (chunkHasCss(c, chunkGraph) - ? initialChunkIdsWithCss - : initialChunkIdsWithoutCss - ).add(c.id); - } + if (commentErrors) { + for (const e of commentErrors) { + const { comment } = e; + parser.state.module.addWarning( + new CommentCompilationWarning( + `Compilation error while processing magic comment(-s): /*${comment.value}*/: ${e.message}`, + comment.loc + ) + ); + } + } + if (requireOptions) { + if (requireOptions.webpackIgnore !== undefined) { + if (typeof requireOptions.webpackIgnore !== "boolean") { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackIgnore\` expected a boolean, but received: ${requireOptions.webpackIgnore}.`, + expr.loc + ) + ); + } else { + // Do not instrument `require()` if `webpackIgnore` is `true` + if (requireOptions.webpackIgnore) { + return true; + } + } + } + } + } - if (!withLoading && !withHmr && initialChunkIdsWithCss.size === 0) { - return null; - } + if (expr.arguments.length !== 1) return; + let localModule; + const param = parser.evaluateExpression(expr.arguments[0]); + if (param.isConditional()) { + let isExpression = false; + for (const p of param.options) { + const result = processRequireItem(expr, p); + if (result === undefined) { + isExpression = true; + } + } + if (!isExpression) { + const dep = new RequireHeaderDependency(expr.callee.range); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + } + } + if ( + param.isString() && + (localModule = getLocalModule(parser.state, param.string)) + ) { + localModule.flagUsed(); + const dep = new LocalModuleDependency(localModule, expr.range, callNew); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + } else { + const result = processRequireItem(expr, param); + if (result === undefined) { + processRequireContext(expr, param); + } else { + const dep = new RequireHeaderDependency(expr.callee.range); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + } + return true; + } + }; + parser.hooks.call + .for("require") + .tap("CommonJsImportsParserPlugin", createRequireHandler(false)); + parser.hooks.new + .for("require") + .tap("CommonJsImportsParserPlugin", createRequireHandler(true)); + parser.hooks.call + .for("module.require") + .tap("CommonJsImportsParserPlugin", createRequireHandler(false)); + parser.hooks.new + .for("module.require") + .tap("CommonJsImportsParserPlugin", createRequireHandler(true)); - const { createStylesheet } = - CssLoadingRuntimeModule.getCompilationHooks(compilation); + // require with property access // + const chainHandler = (expr, calleeMembers, callExpr, members) => { + if (callExpr.arguments.length !== 1) return; + const param = parser.evaluateExpression(callExpr.arguments[0]); + if (param.isString() && !getLocalModule(parser.state, param.string)) { + const dep = new CommonJsFullRequireDependency( + param.string, + expr.range, + members + ); + dep.asiSafe = !parser.isAsiPosition(expr.range[0]); + dep.optional = !!parser.scope.inTry; + dep.loc = expr.loc; + parser.state.current.addDependency(dep); + return true; + } + }; + const callChainHandler = (expr, calleeMembers, callExpr, members) => { + if (callExpr.arguments.length !== 1) return; + const param = parser.evaluateExpression(callExpr.arguments[0]); + if (param.isString() && !getLocalModule(parser.state, param.string)) { + const dep = new CommonJsFullRequireDependency( + param.string, + expr.callee.range, + members + ); + dep.call = true; + dep.asiSafe = !parser.isAsiPosition(expr.range[0]); + dep.optional = !!parser.scope.inTry; + dep.loc = expr.callee.loc; + parser.state.current.addDependency(dep); + parser.walkExpressions(expr.arguments); + return true; + } + }; + parser.hooks.memberChainOfCallMemberChain + .for("require") + .tap("CommonJsImportsParserPlugin", chainHandler); + parser.hooks.memberChainOfCallMemberChain + .for("module.require") + .tap("CommonJsImportsParserPlugin", chainHandler); + parser.hooks.callMemberChainOfCallMemberChain + .for("require") + .tap("CommonJsImportsParserPlugin", callChainHandler); + parser.hooks.callMemberChainOfCallMemberChain + .for("module.require") + .tap("CommonJsImportsParserPlugin", callChainHandler); - const stateExpression = withHmr - ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_css` - : undefined; + // require.resolve // + const processResolve = (expr, weak) => { + if (expr.arguments.length !== 1) return; + const param = parser.evaluateExpression(expr.arguments[0]); + if (param.isConditional()) { + for (const option of param.options) { + const result = processResolveItem(expr, option, weak); + if (result === undefined) { + processResolveContext(expr, option, weak); + } + } + const dep = new RequireResolveHeaderDependency(expr.callee.range); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + } else { + const result = processResolveItem(expr, param, weak); + if (result === undefined) { + processResolveContext(expr, param, weak); + } + const dep = new RequireResolveHeaderDependency(expr.callee.range); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + } + }; + const processResolveItem = (expr, param, weak) => { + if (param.isString()) { + const dep = new RequireResolveDependency(param.string, param.range); + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + dep.weak = weak; + parser.state.current.addDependency(dep); + return true; + } + }; + const processResolveContext = (expr, param, weak) => { + const dep = ContextDependencyHelpers.create( + RequireResolveContextDependency, + param.range, + param, + expr, + options, + { + category: "commonjs", + mode: weak ? "weak" : "sync" + }, + parser + ); + if (!dep) return; + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; + }; - const code = Template.asString([ - "link = document.createElement('link');", - uniqueName - ? 'link.setAttribute("data-webpack", uniqueName + ":" + key);' - : "", - "link.setAttribute(loadingAttribute, 1);", - 'link.rel = "stylesheet";', - "link.href = url;", - crossOriginLoading - ? Template.asString([ - "if (link.src.indexOf(window.location.origin + '/') !== 0) {", - Template.indent( - `link.crossOrigin = ${JSON.stringify(crossOriginLoading)};` - ), - "}" - ]) - : "" - ]); - - const cc = str => str.charCodeAt(0); - - return Template.asString([ - "// object to store loaded and loading chunks", - "// undefined = chunk not loaded, null = chunk preloaded/prefetched", - "// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded", - `var installedChunks = ${ - stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" - }{${Array.from( - initialChunkIdsWithoutCss, - id => `${JSON.stringify(id)}:0` - ).join(",")}};`, - "", - uniqueName - ? `var uniqueName = ${JSON.stringify( - runtimeTemplate.outputOptions.uniqueName - )};` - : "// data-webpack is not used as build has no uniqueName", - `var loadCssChunkData = ${runtimeTemplate.basicFunction( - "target, link, chunkId", - [ - `var data, token = "", token2, exports = {}, exportsWithId = [], exportsWithDashes = [], ${ - withHmr ? "moduleIds = [], " : "" - }i = 0, cc = 1;`, - "try { if(!link) link = loadStylesheet(chunkId); data = link.sheet.cssRules; data = data[data.length - 1].style; } catch(e) { data = getComputedStyle(document.head); }", - `data = data.getPropertyValue(${ - uniqueName - ? runtimeTemplate.concatenation( - "--webpack-", - { expr: "uniqueName" }, - "-", - { expr: "chunkId" } - ) - : runtimeTemplate.concatenation("--webpack-", { expr: "chunkId" }) - });`, - "if(!data) return [];", - "for(; cc; i++) {", - Template.indent([ - "cc = data.charCodeAt(i);", - `if(cc == ${cc("(")}) { token2 = token; token = ""; }`, - `else if(cc == ${cc( - ")" - )}) { exports[token2.replace(/^_/, "")] = token.replace(/^_/, ""); token = ""; }`, - `else if(cc == ${cc("/")} || cc == ${cc( - "%" - )}) { token = token.replace(/^_/, ""); exports[token] = token; exportsWithId.push(token); if(cc == ${cc( - "%" - )}) exportsWithDashes.push(token); token = ""; }`, - `else if(!cc || cc == ${cc( - "," - )}) { token = token.replace(/^_/, ""); exportsWithId.forEach(${runtimeTemplate.expressionFunction( - `exports[x] = ${ - uniqueName - ? runtimeTemplate.concatenation( - { expr: "uniqueName" }, - "-", - { expr: "token" }, - "-", - { expr: "exports[x]" } - ) - : runtimeTemplate.concatenation({ expr: "token" }, "-", { - expr: "exports[x]" - }) - }`, - "x" - )}); exportsWithDashes.forEach(${runtimeTemplate.expressionFunction( - `exports[x] = "--" + exports[x]`, - "x" - )}); ${ - RuntimeGlobals.makeNamespaceObject - }(exports); target[token] = (${runtimeTemplate.basicFunction( - "exports, module", - `module.exports = exports;` - )}).bind(null, exports); ${ - withHmr ? "moduleIds.push(token); " : "" - }token = ""; exports = {}; exportsWithId.length = 0; }`, - `else if(cc == ${cc("\\")}) { token += data[++i] }`, - `else { token += data[i]; }` - ]), - "}", - `${ - withHmr ? `if(target == ${RuntimeGlobals.moduleFactories}) ` : "" - }installedChunks[chunkId] = 0;`, - withHmr ? "return moduleIds;" : "" - ] - )}`, - 'var loadingAttribute = "data-webpack-loading";', - `var loadStylesheet = ${runtimeTemplate.basicFunction( - "chunkId, url, done" + (withHmr ? ", hmr" : ""), - [ - 'var link, needAttach, key = "chunk-" + chunkId;', - withHmr ? "if(!hmr) {" : "", - 'var links = document.getElementsByTagName("link");', - "for(var i = 0; i < links.length; i++) {", - Template.indent([ - "var l = links[i];", - `if(l.rel == "stylesheet" && (${ - withHmr - ? 'l.href.startsWith(url) || l.getAttribute("href").startsWith(url)' - : 'l.href == url || l.getAttribute("href") == url' - }${ - uniqueName - ? ' || l.getAttribute("data-webpack") == uniqueName + ":" + key' - : "" - })) { link = l; break; }` - ]), - "}", - "if(!done) return link;", - withHmr ? "}" : "", - "if(!link) {", - Template.indent([ - "needAttach = true;", - createStylesheet.call(code, this.chunk) - ]), - "}", - `var onLinkComplete = ${runtimeTemplate.basicFunction( - "prev, event", - Template.asString([ - "link.onerror = link.onload = null;", - "link.removeAttribute(loadingAttribute);", - "clearTimeout(timeout);", - 'if(event && event.type != "load") link.parentNode.removeChild(link)', - "done(event);", - "if(prev) return prev(event);" - ]) - )};`, - "if(link.getAttribute(loadingAttribute)) {", - Template.indent([ - `var timeout = setTimeout(onLinkComplete.bind(null, undefined, { type: 'timeout', target: link }), ${loadTimeout});`, - "link.onerror = onLinkComplete.bind(null, link.onerror);", - "link.onload = onLinkComplete.bind(null, link.onload);" - ]), - "} else onLinkComplete(undefined, { type: 'load', target: link });", // We assume any existing stylesheet is render blocking - withHmr ? "hmr ? document.head.insertBefore(link, hmr) :" : "", - "needAttach && document.head.appendChild(link);", - "return link;" - ] - )};`, - initialChunkIdsWithCss.size > 2 - ? `${JSON.stringify( - Array.from(initialChunkIdsWithCss) - )}.forEach(loadCssChunkData.bind(null, ${ - RuntimeGlobals.moduleFactories - }, 0));` - : initialChunkIdsWithCss.size > 0 - ? `${Array.from( - initialChunkIdsWithCss, - id => - `loadCssChunkData(${ - RuntimeGlobals.moduleFactories - }, 0, ${JSON.stringify(id)});` - ).join("")}` - : "// no initial css", - "", - withLoading - ? Template.asString([ - `${fn}.css = ${runtimeTemplate.basicFunction("chunkId, promises", [ - "// css chunk loading", - `var installedChunkData = ${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;`, - 'if(installedChunkData !== 0) { // 0 means "already installed".', - Template.indent([ - "", - '// a Promise means "currently loading".', - "if(installedChunkData) {", - Template.indent(["promises.push(installedChunkData[2]);"]), - "} else {", - Template.indent([ - hasCssMatcher === true - ? "if(true) { // all chunks have CSS" - : `if(${hasCssMatcher("chunkId")}) {`, - Template.indent([ - "// setup Promise in chunk cache", - `var promise = new Promise(${runtimeTemplate.expressionFunction( - `installedChunkData = installedChunks[chunkId] = [resolve, reject]`, - "resolve, reject" - )});`, - "promises.push(installedChunkData[2] = promise);", - "", - "// start chunk loading", - `var url = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkCssFilename}(chunkId);`, - "// create error before stack unwound to get useful stacktrace later", - "var error = new Error();", - `var loadingEnded = ${runtimeTemplate.basicFunction( - "event", - [ - `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId)) {`, - Template.indent([ - "installedChunkData = installedChunks[chunkId];", - "if(installedChunkData !== 0) installedChunks[chunkId] = undefined;", - "if(installedChunkData) {", - Template.indent([ - 'if(event.type !== "load") {', - Template.indent([ - "var errorType = event && event.type;", - "var realSrc = event && event.target && event.target.src;", - "error.message = 'Loading css chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", - "error.name = 'ChunkLoadError';", - "error.type = errorType;", - "error.request = realSrc;", - "installedChunkData[1](error);" - ]), - "} else {", - Template.indent([ - `loadCssChunkData(${RuntimeGlobals.moduleFactories}, link, chunkId);`, - "installedChunkData[0]();" - ]), - "}" - ]), - "}" - ]), - "}" - ] - )};`, - "var link = loadStylesheet(chunkId, url, loadingEnded);" - ]), - "} else installedChunks[chunkId] = 0;" - ]), - "}" - ]), - "}" - ])};` - ]) - : "// no chunk loading", - "", - withHmr - ? Template.asString([ - "var oldTags = [];", - "var newTags = [];", - `var applyHandler = ${runtimeTemplate.basicFunction("options", [ - `return { dispose: ${runtimeTemplate.basicFunction( - "", - [] - )}, apply: ${runtimeTemplate.basicFunction("", [ - "var moduleIds = [];", - `newTags.forEach(${runtimeTemplate.expressionFunction( - "info[1].sheet.disabled = false", - "info" - )});`, - "while(oldTags.length) {", - Template.indent([ - "var oldTag = oldTags.pop();", - "if(oldTag.parentNode) oldTag.parentNode.removeChild(oldTag);" - ]), - "}", - "while(newTags.length) {", - Template.indent([ - `var info = newTags.pop();`, - `var chunkModuleIds = loadCssChunkData(${RuntimeGlobals.moduleFactories}, info[1], info[0]);`, - `chunkModuleIds.forEach(${runtimeTemplate.expressionFunction( - "moduleIds.push(id)", - "id" - )});` - ]), - "}", - "return moduleIds;" - ])} };` - ])}`, - `var cssTextKey = ${runtimeTemplate.returningFunction( - `Array.from(link.sheet.cssRules, ${runtimeTemplate.returningFunction( - "r.cssText", - "r" - )}).join()`, - "link" - )}`, - `${ - RuntimeGlobals.hmrDownloadUpdateHandlers - }.css = ${runtimeTemplate.basicFunction( - "chunkIds, removedChunks, removedModules, promises, applyHandlers, updatedModulesList", - [ - "applyHandlers.push(applyHandler);", - `chunkIds.forEach(${runtimeTemplate.basicFunction("chunkId", [ - `var filename = ${RuntimeGlobals.getChunkCssFilename}(chunkId);`, - `var url = ${RuntimeGlobals.publicPath} + filename;`, - "var oldTag = loadStylesheet(chunkId, url);", - "if(!oldTag) return;", - `promises.push(new Promise(${runtimeTemplate.basicFunction( - "resolve, reject", - [ - `var link = loadStylesheet(chunkId, url + (url.indexOf("?") < 0 ? "?" : "&") + "hmr=" + Date.now(), ${runtimeTemplate.basicFunction( - "event", - [ - 'if(event.type !== "load") {', - Template.indent([ - "var errorType = event && event.type;", - "var realSrc = event && event.target && event.target.src;", - "error.message = 'Loading css hot update chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", - "error.name = 'ChunkLoadError';", - "error.type = errorType;", - "error.request = realSrc;", - "reject(error);" - ]), - "} else {", - Template.indent([ - "try { if(cssTextKey(oldTag) == cssTextKey(link)) { if(link.parentNode) link.parentNode.removeChild(link); return resolve(); } } catch(e) {}", - "var factories = {};", - "loadCssChunkData(factories, link, chunkId);", - `Object.keys(factories).forEach(${runtimeTemplate.expressionFunction( - "updatedModulesList.push(id)", - "id" - )})`, - "link.sheet.disabled = true;", - "oldTags.push(oldTag);", - "newTags.push([chunkId, link]);", - "resolve();" - ]), - "}" - ] - )}, oldTag);` - ] - )}));` - ])});` - ] - )}` - ]) - : "// no hmr" - ]); - } -} - -module.exports = CssLoadingRuntimeModule; + parser.hooks.call + .for("require.resolve") + .tap("RequireResolveDependencyParserPlugin", expr => { + return processResolve(expr, false); + }); + parser.hooks.call + .for("require.resolveWeak") + .tap("RequireResolveDependencyParserPlugin", expr => { + return processResolve(expr, true); + }); + } +} +module.exports = CommonJsImportsParserPlugin; /***/ }), -/***/ 47283: +/***/ 32406: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -75788,466 +73970,347 @@ module.exports = CssLoadingRuntimeModule; -const { ConcatSource } = __webpack_require__(51255); -const HotUpdateChunk = __webpack_require__(9597); const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); const SelfModuleFactory = __webpack_require__(63560); -const CssExportDependency = __webpack_require__(76760); -const CssImportDependency = __webpack_require__(90542); -const CssLocalIdentifierDependency = __webpack_require__(92328); -const CssSelfLocalIdentifierDependency = __webpack_require__(29094); -const CssUrlDependency = __webpack_require__(70749); -const StaticExportsDependency = __webpack_require__(91418); -const { compareModulesByIdentifier } = __webpack_require__(29579); -const createSchemaValidation = __webpack_require__(32540); -const createHash = __webpack_require__(49835); -const memoize = __webpack_require__(78676); -const nonNumericOnlyHash = __webpack_require__(55668); -const CssExportsGenerator = __webpack_require__(91254); -const CssGenerator = __webpack_require__(46061); -const CssParser = __webpack_require__(98305); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").CssExperimentOptions} CssExperimentOptions */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ - -const getCssLoadingRuntimeModule = memoize(() => - __webpack_require__(80806) -); - -const getSchema = name => { - const { definitions } = __webpack_require__(73342); - return { - definitions, - oneOf: [{ $ref: `#/definitions/${name}` }] - }; -}; - -const validateGeneratorOptions = createSchemaValidation( - __webpack_require__(59170), - () => getSchema("CssGeneratorOptions"), - { - name: "Css Modules Plugin", - baseDataPath: "parser" - } -); -const validateParserOptions = createSchemaValidation( - __webpack_require__(38542), - () => getSchema("CssParserOptions"), - { - name: "Css Modules Plugin", - baseDataPath: "parser" - } -); +const Template = __webpack_require__(1626); +const CommonJsExportsDependency = __webpack_require__(45598); +const CommonJsFullRequireDependency = __webpack_require__(59440); +const CommonJsRequireContextDependency = __webpack_require__(23962); +const CommonJsRequireDependency = __webpack_require__(21264); +const CommonJsSelfReferenceDependency = __webpack_require__(52225); +const ModuleDecoratorDependency = __webpack_require__(88488); +const RequireHeaderDependency = __webpack_require__(89183); +const RequireResolveContextDependency = __webpack_require__(55627); +const RequireResolveDependency = __webpack_require__(68582); +const RequireResolveHeaderDependency = __webpack_require__(9880); +const RuntimeRequirementsDependency = __webpack_require__(24187); -const escapeCss = (str, omitOptionalUnderscore) => { - const escaped = `${str}`.replace( - // cspell:word uffff - /[^a-zA-Z0-9_\u0081-\uffff-]/g, - s => `\\${s}` - ); - return !omitOptionalUnderscore && /^(?!--)[0-9_-]/.test(escaped) - ? `_${escaped}` - : escaped; -}; +const CommonJsExportsParserPlugin = __webpack_require__(97107); +const CommonJsImportsParserPlugin = __webpack_require__(36013); -const plugin = "CssModulesPlugin"; +const { + evaluateToIdentifier, + toConstantDependency +} = __webpack_require__(93998); +const CommonJsExportRequireDependency = __webpack_require__(62892); -class CssModulesPlugin { - /** - * @param {CssExperimentOptions} options options - */ - constructor({ exportsOnly = false }) { - this._exportsOnly = exportsOnly; - } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ +class CommonJsPlugin { apply(compiler) { compiler.hooks.compilation.tap( - plugin, - (compilation, { normalModuleFactory }) => { - const selfFactory = new SelfModuleFactory(compilation.moduleGraph); + "CommonJsPlugin", + (compilation, { contextModuleFactory, normalModuleFactory }) => { compilation.dependencyFactories.set( - CssUrlDependency, + CommonJsRequireDependency, normalModuleFactory ); compilation.dependencyTemplates.set( - CssUrlDependency, - new CssUrlDependency.Template() + CommonJsRequireDependency, + new CommonJsRequireDependency.Template() + ); + + compilation.dependencyFactories.set( + CommonJsFullRequireDependency, + normalModuleFactory ); compilation.dependencyTemplates.set( - CssLocalIdentifierDependency, - new CssLocalIdentifierDependency.Template() + CommonJsFullRequireDependency, + new CommonJsFullRequireDependency.Template() ); + compilation.dependencyFactories.set( - CssSelfLocalIdentifierDependency, - selfFactory + CommonJsRequireContextDependency, + contextModuleFactory ); compilation.dependencyTemplates.set( - CssSelfLocalIdentifierDependency, - new CssSelfLocalIdentifierDependency.Template() + CommonJsRequireContextDependency, + new CommonJsRequireContextDependency.Template() + ); + + compilation.dependencyFactories.set( + RequireResolveDependency, + normalModuleFactory ); compilation.dependencyTemplates.set( - CssExportDependency, - new CssExportDependency.Template() + RequireResolveDependency, + new RequireResolveDependency.Template() ); + compilation.dependencyFactories.set( - CssImportDependency, + RequireResolveContextDependency, + contextModuleFactory + ); + compilation.dependencyTemplates.set( + RequireResolveContextDependency, + new RequireResolveContextDependency.Template() + ); + + compilation.dependencyTemplates.set( + RequireResolveHeaderDependency, + new RequireResolveHeaderDependency.Template() + ); + + compilation.dependencyTemplates.set( + RequireHeaderDependency, + new RequireHeaderDependency.Template() + ); + + compilation.dependencyTemplates.set( + CommonJsExportsDependency, + new CommonJsExportsDependency.Template() + ); + + compilation.dependencyFactories.set( + CommonJsExportRequireDependency, normalModuleFactory ); compilation.dependencyTemplates.set( - CssImportDependency, - new CssImportDependency.Template() + CommonJsExportRequireDependency, + new CommonJsExportRequireDependency.Template() + ); + + const selfFactory = new SelfModuleFactory(compilation.moduleGraph); + + compilation.dependencyFactories.set( + CommonJsSelfReferenceDependency, + selfFactory ); compilation.dependencyTemplates.set( - StaticExportsDependency, - new StaticExportsDependency.Template() + CommonJsSelfReferenceDependency, + new CommonJsSelfReferenceDependency.Template() ); - normalModuleFactory.hooks.createParser - .for("css") - .tap(plugin, parserOptions => { - validateParserOptions(parserOptions); - return new CssParser(); - }); - normalModuleFactory.hooks.createParser - .for("css/global") - .tap(plugin, parserOptions => { - validateParserOptions(parserOptions); - return new CssParser({ - allowPseudoBlocks: false, - allowModeSwitch: false - }); - }); - normalModuleFactory.hooks.createParser - .for("css/module") - .tap(plugin, parserOptions => { - validateParserOptions(parserOptions); - return new CssParser({ - defaultMode: "local" - }); - }); - normalModuleFactory.hooks.createGenerator - .for("css") - .tap(plugin, generatorOptions => { - validateGeneratorOptions(generatorOptions); - return this._exportsOnly - ? new CssExportsGenerator() - : new CssGenerator(); - }); - normalModuleFactory.hooks.createGenerator - .for("css/global") - .tap(plugin, generatorOptions => { - validateGeneratorOptions(generatorOptions); - return this._exportsOnly - ? new CssExportsGenerator() - : new CssGenerator(); + + compilation.dependencyFactories.set( + ModuleDecoratorDependency, + selfFactory + ); + compilation.dependencyTemplates.set( + ModuleDecoratorDependency, + new ModuleDecoratorDependency.Template() + ); + + compilation.hooks.runtimeRequirementInModule + .for(RuntimeGlobals.harmonyModuleDecorator) + .tap("CommonJsPlugin", (module, set) => { + set.add(RuntimeGlobals.module); + set.add(RuntimeGlobals.requireScope); }); - normalModuleFactory.hooks.createGenerator - .for("css/module") - .tap(plugin, generatorOptions => { - validateGeneratorOptions(generatorOptions); - return this._exportsOnly - ? new CssExportsGenerator() - : new CssGenerator(); + + compilation.hooks.runtimeRequirementInModule + .for(RuntimeGlobals.nodeModuleDecorator) + .tap("CommonJsPlugin", (module, set) => { + set.add(RuntimeGlobals.module); + set.add(RuntimeGlobals.requireScope); }); - const orderedCssModulesPerChunk = new WeakMap(); - compilation.hooks.afterCodeGeneration.tap("CssModulesPlugin", () => { - const { chunkGraph } = compilation; - for (const chunk of compilation.chunks) { - if (CssModulesPlugin.chunkHasCss(chunk, chunkGraph)) { - orderedCssModulesPerChunk.set( - chunk, - this.getOrderedChunkCssModules(chunk, chunkGraph, compilation) - ); - } - } - }); - compilation.hooks.contentHash.tap("CssModulesPlugin", chunk => { - const { - chunkGraph, - outputOptions: { - hashSalt, - hashDigest, - hashDigestLength, - hashFunction - } - } = compilation; - const modules = orderedCssModulesPerChunk.get(chunk); - if (modules === undefined) return; - const hash = createHash(hashFunction); - if (hashSalt) hash.update(hashSalt); - for (const module of modules) { - hash.update(chunkGraph.getModuleHash(module, chunk.runtime)); - } - const digest = /** @type {string} */ (hash.digest(hashDigest)); - chunk.contentHash.css = nonNumericOnlyHash(digest, hashDigestLength); - }); - compilation.hooks.renderManifest.tap(plugin, (result, options) => { - const { chunkGraph } = compilation; - const { hash, chunk, codeGenerationResults } = options; - if (chunk instanceof HotUpdateChunk) return result; + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.harmonyModuleDecorator) + .tap("CommonJsPlugin", (chunk, set) => { + compilation.addRuntimeModule( + chunk, + new HarmonyModuleDecoratorRuntimeModule() + ); + }); - const modules = orderedCssModulesPerChunk.get(chunk); - if (modules !== undefined) { - result.push({ - render: () => - this.renderChunk({ - chunk, - chunkGraph, - codeGenerationResults, - uniqueName: compilation.outputOptions.uniqueName, - modules - }), - filenameTemplate: CssModulesPlugin.getChunkFilenameTemplate( - chunk, - compilation.outputOptions - ), - pathOptions: { - hash, - runtime: chunk.runtime, - chunk, - contentHashType: "css" - }, - identifier: `css${chunk.id}`, - hash: chunk.contentHash.css - }); - } - return result; - }); - const enabledChunks = new WeakSet(); - const handler = (chunk, set) => { - if (enabledChunks.has(chunk)) { + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.nodeModuleDecorator) + .tap("CommonJsPlugin", (chunk, set) => { + compilation.addRuntimeModule( + chunk, + new NodeModuleDecoratorRuntimeModule() + ); + }); + + const handler = (parser, parserOptions) => { + if (parserOptions.commonjs !== undefined && !parserOptions.commonjs) return; - } - enabledChunks.add(chunk); + parser.hooks.typeof + .for("module") + .tap( + "CommonJsPlugin", + toConstantDependency(parser, JSON.stringify("object")) + ); - set.add(RuntimeGlobals.publicPath); - set.add(RuntimeGlobals.getChunkCssFilename); - set.add(RuntimeGlobals.hasOwnProperty); - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - set.add(RuntimeGlobals.makeNamespaceObject); + parser.hooks.expression + .for("require.main") + .tap( + "CommonJsPlugin", + toConstantDependency( + parser, + `${RuntimeGlobals.moduleCache}[${RuntimeGlobals.entryModuleId}]`, + [RuntimeGlobals.moduleCache, RuntimeGlobals.entryModuleId] + ) + ); + parser.hooks.expression + .for("module.loaded") + .tap("CommonJsPlugin", expr => { + parser.state.module.buildInfo.moduleConcatenationBailout = + "module.loaded"; + const dep = new RuntimeRequirementsDependency([ + RuntimeGlobals.moduleLoaded + ]); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); - const CssLoadingRuntimeModule = getCssLoadingRuntimeModule(); - compilation.addRuntimeModule(chunk, new CssLoadingRuntimeModule(set)); + parser.hooks.expression + .for("module.id") + .tap("CommonJsPlugin", expr => { + parser.state.module.buildInfo.moduleConcatenationBailout = + "module.id"; + const dep = new RuntimeRequirementsDependency([ + RuntimeGlobals.moduleId + ]); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + + parser.hooks.evaluateIdentifier.for("module.hot").tap( + "CommonJsPlugin", + evaluateToIdentifier("module.hot", "module", () => ["hot"], null) + ); + + new CommonJsImportsParserPlugin(parserOptions).apply(parser); + new CommonJsExportsParserPlugin(compilation.moduleGraph).apply( + parser + ); }; - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hasCssModules) - .tap(plugin, handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap(plugin, handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadUpdateHandlers) - .tap(plugin, handler); + + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("CommonJsPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("CommonJsPlugin", handler); } ); } +} - getModulesInOrder(chunk, modules, compilation) { - if (!modules) return []; +class HarmonyModuleDecoratorRuntimeModule extends RuntimeModule { + constructor() { + super("harmony module decorator"); + } - const modulesList = [...modules]; + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeTemplate } = this.compilation; + return Template.asString([ + `${ + RuntimeGlobals.harmonyModuleDecorator + } = ${runtimeTemplate.basicFunction("module", [ + "module = Object.create(module);", + "if (!module.children) module.children = [];", + "Object.defineProperty(module, 'exports', {", + Template.indent([ + "enumerable: true,", + `set: ${runtimeTemplate.basicFunction("", [ + "throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id);" + ])}` + ]), + "});", + "return module;" + ])};` + ]); + } +} - // Get ordered list of modules per chunk group - // Lists are in reverse order to allow to use Array.pop() - const modulesByChunkGroup = Array.from(chunk.groupsIterable, chunkGroup => { - const sortedModules = modulesList - .map(module => { - return { - module, - index: chunkGroup.getModulePostOrderIndex(module) - }; - }) - .filter(item => item.index !== undefined) - .sort((a, b) => b.index - a.index) - .map(item => item.module); +class NodeModuleDecoratorRuntimeModule extends RuntimeModule { + constructor() { + super("node module decorator"); + } - return { list: sortedModules, set: new Set(sortedModules) }; - }); + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeTemplate } = this.compilation; + return Template.asString([ + `${RuntimeGlobals.nodeModuleDecorator} = ${runtimeTemplate.basicFunction( + "module", + [ + "module.paths = [];", + "if (!module.children) module.children = [];", + "return module;" + ] + )};` + ]); + } +} - if (modulesByChunkGroup.length === 1) - return modulesByChunkGroup[0].list.reverse(); +module.exports = CommonJsPlugin; - const compareModuleLists = ({ list: a }, { list: b }) => { - if (a.length === 0) { - return b.length === 0 ? 0 : 1; - } else { - if (b.length === 0) return -1; - return compareModulesByIdentifier(a[a.length - 1], b[b.length - 1]); - } - }; - modulesByChunkGroup.sort(compareModuleLists); +/***/ }), - const finalModules = []; +/***/ 23962: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - for (;;) { - const failedModules = new Set(); - const list = modulesByChunkGroup[0].list; - if (list.length === 0) { - // done, everything empty - break; - } - let selectedModule = list[list.length - 1]; - let hasFailed = undefined; - outer: for (;;) { - for (const { list, set } of modulesByChunkGroup) { - if (list.length === 0) continue; - const lastModule = list[list.length - 1]; - if (lastModule === selectedModule) continue; - if (!set.has(selectedModule)) continue; - failedModules.add(selectedModule); - if (failedModules.has(lastModule)) { - // There is a conflict, try other alternatives - hasFailed = lastModule; - continue; - } - selectedModule = lastModule; - hasFailed = false; - continue outer; // restart - } - break; - } - if (hasFailed) { - // There is a not resolve-able conflict with the selectedModule - if (compilation) { - // TODO print better warning - compilation.warnings.push( - new Error( - `chunk ${ - chunk.name || chunk.id - }\nConflicting order between ${hasFailed.readableIdentifier( - compilation.requestShortener - )} and ${selectedModule.readableIdentifier( - compilation.requestShortener - )}` - ) - ); - } - selectedModule = hasFailed; - } - // Insert the selected module into the final modules list - finalModules.push(selectedModule); - // Remove the selected module from all lists - for (const { list, set } of modulesByChunkGroup) { - const lastModule = list[list.length - 1]; - if (lastModule === selectedModule) list.pop(); - else if (hasFailed && set.has(selectedModule)) { - const idx = list.indexOf(selectedModule); - if (idx >= 0) list.splice(idx, 1); - } - } - modulesByChunkGroup.sort(compareModuleLists); - } - return finalModules; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const makeSerializable = __webpack_require__(33032); +const ContextDependency = __webpack_require__(88101); +const ContextDependencyTemplateAsRequireCall = __webpack_require__(75815); + +class CommonJsRequireContextDependency extends ContextDependency { + constructor(options, range, valueRange, inShorthand) { + super(options); + + this.range = range; + this.valueRange = valueRange; + // inShorthand must be serialized by subclasses that use it + this.inShorthand = inShorthand; } - getOrderedChunkCssModules(chunk, chunkGraph, compilation) { - return [ - ...this.getModulesInOrder( - chunk, - chunkGraph.getOrderedChunkModulesIterableBySourceType( - chunk, - "css-import", - compareModulesByIdentifier - ), - compilation - ), - ...this.getModulesInOrder( - chunk, - chunkGraph.getOrderedChunkModulesIterableBySourceType( - chunk, - "css", - compareModulesByIdentifier - ), - compilation - ) - ]; + get type() { + return "cjs require context"; } - renderChunk({ - uniqueName, - chunk, - chunkGraph, - codeGenerationResults, - modules - }) { - const source = new ConcatSource(); - const metaData = []; - for (const module of modules) { - try { - const codeGenResult = codeGenerationResults.get(module, chunk.runtime); + serialize(context) { + const { write } = context; - const s = - codeGenResult.sources.get("css") || - codeGenResult.sources.get("css-import"); - if (s) { - source.add(s); - source.add("\n"); - } - const exports = - codeGenResult.data && codeGenResult.data.get("css-exports"); - const moduleId = chunkGraph.getModuleId(module) + ""; - metaData.push( - `${ - exports - ? Array.from(exports, ([n, v]) => { - const shortcutValue = `${ - uniqueName ? uniqueName + "-" : "" - }${moduleId}-${n}`; - return v === shortcutValue - ? `${escapeCss(n)}/` - : v === "--" + shortcutValue - ? `${escapeCss(n)}%` - : `${escapeCss(n)}(${escapeCss(v)})`; - }).join("") - : "" - }${escapeCss(moduleId)}` - ); - } catch (e) { - e.message += `\nduring rendering of css ${module.identifier()}`; - throw e; - } - } - source.add( - `head{--webpack-${escapeCss( - (uniqueName ? uniqueName + "-" : "") + chunk.id, - true - )}:${metaData.join(",")};}` - ); - return source; - } + write(this.range); + write(this.valueRange); + write(this.inShorthand); - static getChunkFilenameTemplate(chunk, outputOptions) { - if (chunk.cssFilenameTemplate) { - return chunk.cssFilenameTemplate; - } else if (chunk.canBeInitial()) { - return outputOptions.cssFilename; - } else { - return outputOptions.cssChunkFilename; - } + super.serialize(context); } - static chunkHasCss(chunk, chunkGraph) { - return ( - !!chunkGraph.getChunkModulesIterableBySourceType(chunk, "css") || - !!chunkGraph.getChunkModulesIterableBySourceType(chunk, "css-import") - ); + deserialize(context) { + const { read } = context; + + this.range = read(); + this.valueRange = read(); + this.inShorthand = read(); + + super.deserialize(context); } } -module.exports = CssModulesPlugin; +makeSerializable( + CommonJsRequireContextDependency, + "webpack/lib/dependencies/CommonJsRequireContextDependency" +); + +CommonJsRequireContextDependency.Template = + ContextDependencyTemplateAsRequireCall; + +module.exports = CommonJsRequireContextDependency; /***/ }), -/***/ 98305: +/***/ 21264: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -76258,623 +74321,39 @@ module.exports = CssModulesPlugin; -const Parser = __webpack_require__(11715); -const ConstDependency = __webpack_require__(76911); -const CssExportDependency = __webpack_require__(76760); -const CssImportDependency = __webpack_require__(90542); -const CssLocalIdentifierDependency = __webpack_require__(92328); -const CssSelfLocalIdentifierDependency = __webpack_require__(29094); -const CssUrlDependency = __webpack_require__(70749); -const StaticExportsDependency = __webpack_require__(91418); -const walkCssTokens = __webpack_require__(44124); - -/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ - -const CC_LEFT_CURLY = "{".charCodeAt(0); -const CC_RIGHT_CURLY = "}".charCodeAt(0); -const CC_COLON = ":".charCodeAt(0); -const CC_SLASH = "/".charCodeAt(0); -const CC_SEMICOLON = ";".charCodeAt(0); +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); +const ModuleDependencyTemplateAsId = __webpack_require__(80825); -const cssUnescape = str => { - return str.replace(/\\([0-9a-fA-F]{1,6}[ \t\n\r\f]?|[\s\S])/g, match => { - if (match.length > 2) { - return String.fromCharCode(parseInt(match.slice(1).trim(), 16)); - } else { - return match[1]; - } - }); -}; +class CommonJsRequireDependency extends ModuleDependency { + constructor(request, range) { + super(request); + this.range = range; + } -class LocConverter { - constructor(input) { - this._input = input; - this.line = 1; - this.column = 0; - this.pos = 0; + get type() { + return "cjs require"; } - get(pos) { - if (this.pos !== pos) { - if (this.pos < pos) { - const str = this._input.slice(this.pos, pos); - let i = str.lastIndexOf("\n"); - if (i === -1) { - this.column += str.length; - } else { - this.column = str.length - i - 1; - this.line++; - while (i > 0 && (i = str.lastIndexOf("\n", i - 1)) !== -1) - this.line++; - } - } else { - let i = this._input.lastIndexOf("\n", this.pos); - while (i >= pos) { - this.line--; - i = i > 0 ? this._input.lastIndexOf("\n", i - 1) : -1; - } - this.column = pos - i; - } - this.pos = pos; - } - return this; + get category() { + return "commonjs"; } } -const CSS_MODE_TOP_LEVEL = 0; -const CSS_MODE_IN_RULE = 1; -const CSS_MODE_IN_LOCAL_RULE = 2; -const CSS_MODE_AT_IMPORT_EXPECT_URL = 3; -// TODO implement layer and supports for @import -const CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS = 4; -const CSS_MODE_AT_IMPORT_EXPECT_MEDIA = 5; -const CSS_MODE_AT_OTHER = 6; +CommonJsRequireDependency.Template = ModuleDependencyTemplateAsId; -const explainMode = mode => { - switch (mode) { - case CSS_MODE_TOP_LEVEL: - return "parsing top level css"; - case CSS_MODE_IN_RULE: - return "parsing css rule content (global)"; - case CSS_MODE_IN_LOCAL_RULE: - return "parsing css rule content (local)"; - case CSS_MODE_AT_IMPORT_EXPECT_URL: - return "parsing @import (expecting url)"; - case CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS: - return "parsing @import (expecting optionally supports or media query)"; - case CSS_MODE_AT_IMPORT_EXPECT_MEDIA: - return "parsing @import (expecting optionally media query)"; - case CSS_MODE_AT_OTHER: - return "parsing at-rule"; - default: - return mode; - } -}; +makeSerializable( + CommonJsRequireDependency, + "webpack/lib/dependencies/CommonJsRequireDependency" +); -class CssParser extends Parser { - constructor({ - allowPseudoBlocks = true, - allowModeSwitch = true, - defaultMode = "global" - } = {}) { - super(); - this.allowPseudoBlocks = allowPseudoBlocks; - this.allowModeSwitch = allowModeSwitch; - this.defaultMode = defaultMode; - } - - /** - * @param {string | Buffer | PreparsedAst} source the source to parse - * @param {ParserState} state the parser state - * @returns {ParserState} the parser state - */ - parse(source, state) { - if (Buffer.isBuffer(source)) { - source = source.toString("utf-8"); - } else if (typeof source === "object") { - throw new Error("webpackAst is unexpected for the CssParser"); - } - if (source[0] === "\ufeff") { - source = source.slice(1); - } - - const module = state.module; - - const declaredCssVariables = new Set(); - - const locConverter = new LocConverter(source); - let mode = CSS_MODE_TOP_LEVEL; - let modePos = 0; - let modeNestingLevel = 0; - let modeData = undefined; - let singleClassSelector = undefined; - let lastIdentifier = undefined; - const modeStack = []; - const isTopLevelLocal = () => - modeData === "local" || - (this.defaultMode === "local" && modeData === undefined); - const eatWhiteLine = (input, pos) => { - for (;;) { - const cc = input.charCodeAt(pos); - if (cc === 32 || cc === 9) { - pos++; - continue; - } - if (cc === 10) pos++; - break; - } - return pos; - }; - const eatUntil = chars => { - const charCodes = Array.from({ length: chars.length }, (_, i) => - chars.charCodeAt(i) - ); - const arr = Array.from( - { length: charCodes.reduce((a, b) => Math.max(a, b), 0) + 1 }, - () => false - ); - charCodes.forEach(cc => (arr[cc] = true)); - return (input, pos) => { - for (;;) { - const cc = input.charCodeAt(pos); - if (cc < arr.length && arr[cc]) { - return pos; - } - pos++; - if (pos === input.length) return pos; - } - }; - }; - const eatText = (input, pos, eater) => { - let text = ""; - for (;;) { - if (input.charCodeAt(pos) === CC_SLASH) { - const newPos = walkCssTokens.eatComments(input, pos); - if (pos !== newPos) { - pos = newPos; - if (pos === input.length) break; - } else { - text += "/"; - pos++; - if (pos === input.length) break; - } - } - const newPos = eater(input, pos); - if (pos !== newPos) { - text += input.slice(pos, newPos); - pos = newPos; - } else { - break; - } - if (pos === input.length) break; - } - return [pos, text.trimRight()]; - }; - const eatExportName = eatUntil(":};/"); - const eatExportValue = eatUntil("};/"); - const parseExports = (input, pos) => { - pos = walkCssTokens.eatWhitespaceAndComments(input, pos); - const cc = input.charCodeAt(pos); - if (cc !== CC_LEFT_CURLY) - throw new Error( - `Unexpected ${input[pos]} at ${pos} during parsing of ':export' (expected '{')` - ); - pos++; - pos = walkCssTokens.eatWhitespaceAndComments(input, pos); - for (;;) { - if (input.charCodeAt(pos) === CC_RIGHT_CURLY) break; - pos = walkCssTokens.eatWhitespaceAndComments(input, pos); - if (pos === input.length) return pos; - let start = pos; - let name; - [pos, name] = eatText(input, pos, eatExportName); - if (pos === input.length) return pos; - if (input.charCodeAt(pos) !== CC_COLON) { - throw new Error( - `Unexpected ${input[pos]} at ${pos} during parsing of export name in ':export' (expected ':')` - ); - } - pos++; - if (pos === input.length) return pos; - pos = walkCssTokens.eatWhitespaceAndComments(input, pos); - if (pos === input.length) return pos; - let value; - [pos, value] = eatText(input, pos, eatExportValue); - if (pos === input.length) return pos; - const cc = input.charCodeAt(pos); - if (cc === CC_SEMICOLON) { - pos++; - if (pos === input.length) return pos; - pos = walkCssTokens.eatWhitespaceAndComments(input, pos); - if (pos === input.length) return pos; - } else if (cc !== CC_RIGHT_CURLY) { - throw new Error( - `Unexpected ${input[pos]} at ${pos} during parsing of export value in ':export' (expected ';' or '}')` - ); - } - const dep = new CssExportDependency(name, value); - const { line: sl, column: sc } = locConverter.get(start); - const { line: el, column: ec } = locConverter.get(pos); - dep.setLoc(sl, sc, el, ec); - module.addDependency(dep); - } - pos++; - if (pos === input.length) return pos; - pos = eatWhiteLine(input, pos); - return pos; - }; - const eatPropertyName = eatUntil(":{};"); - const processLocalDeclaration = (input, pos) => { - modeData = undefined; - const start = pos; - pos = walkCssTokens.eatWhitespaceAndComments(input, pos); - const propertyNameStart = pos; - const [propertyNameEnd, propertyName] = eatText( - input, - pos, - eatPropertyName - ); - if (input.charCodeAt(propertyNameEnd) !== CC_COLON) return start; - pos = propertyNameEnd + 1; - if (propertyName.startsWith("--")) { - // CSS Variable - const { line: sl, column: sc } = locConverter.get(propertyNameStart); - const { line: el, column: ec } = locConverter.get(propertyNameEnd); - const name = propertyName.slice(2); - const dep = new CssLocalIdentifierDependency( - name, - [propertyNameStart, propertyNameEnd], - "--" - ); - dep.setLoc(sl, sc, el, ec); - module.addDependency(dep); - declaredCssVariables.add(name); - } else if ( - propertyName === "animation-name" || - propertyName === "animation" - ) { - modeData = "animation"; - lastIdentifier = undefined; - } - return pos; - }; - const processDeclarationValueDone = (input, pos) => { - if (modeData === "animation" && lastIdentifier) { - const { line: sl, column: sc } = locConverter.get(lastIdentifier[0]); - const { line: el, column: ec } = locConverter.get(lastIdentifier[1]); - const name = input.slice(lastIdentifier[0], lastIdentifier[1]); - const dep = new CssSelfLocalIdentifierDependency(name, lastIdentifier); - dep.setLoc(sl, sc, el, ec); - module.addDependency(dep); - } - }; - const eatKeyframes = eatUntil("{};/"); - const eatNameInVar = eatUntil(",)};/"); - walkCssTokens(source, { - isSelector: () => { - return mode !== CSS_MODE_IN_RULE && mode !== CSS_MODE_IN_LOCAL_RULE; - }, - url: (input, start, end, contentStart, contentEnd) => { - const value = cssUnescape(input.slice(contentStart, contentEnd)); - switch (mode) { - case CSS_MODE_AT_IMPORT_EXPECT_URL: { - modeData.url = value; - mode = CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS; - break; - } - case CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS: - case CSS_MODE_AT_IMPORT_EXPECT_MEDIA: - throw new Error( - `Unexpected ${input.slice( - start, - end - )} at ${start} during ${explainMode(mode)}` - ); - default: { - const dep = new CssUrlDependency(value, [start, end], "url"); - const { line: sl, column: sc } = locConverter.get(start); - const { line: el, column: ec } = locConverter.get(end); - dep.setLoc(sl, sc, el, ec); - module.addDependency(dep); - module.addCodeGenerationDependency(dep); - break; - } - } - return end; - }, - string: (input, start, end) => { - switch (mode) { - case CSS_MODE_AT_IMPORT_EXPECT_URL: { - modeData.url = cssUnescape(input.slice(start + 1, end - 1)); - mode = CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS; - break; - } - } - return end; - }, - atKeyword: (input, start, end) => { - const name = input.slice(start, end); - if (name === "@namespace") { - throw new Error("@namespace is not supported in bundled CSS"); - } - if (name === "@import") { - if (mode !== CSS_MODE_TOP_LEVEL) { - throw new Error( - `Unexpected @import at ${start} during ${explainMode(mode)}` - ); - } - mode = CSS_MODE_AT_IMPORT_EXPECT_URL; - modePos = end; - modeData = { - start: start, - url: undefined, - supports: undefined - }; - } - if (name === "@keyframes") { - let pos = end; - pos = walkCssTokens.eatWhitespaceAndComments(input, pos); - if (pos === input.length) return pos; - const [newPos, name] = eatText(input, pos, eatKeyframes); - const { line: sl, column: sc } = locConverter.get(pos); - const { line: el, column: ec } = locConverter.get(newPos); - const dep = new CssLocalIdentifierDependency(name, [pos, newPos]); - dep.setLoc(sl, sc, el, ec); - module.addDependency(dep); - pos = newPos; - if (pos === input.length) return pos; - if (input.charCodeAt(pos) !== CC_LEFT_CURLY) { - throw new Error( - `Unexpected ${input[pos]} at ${pos} during parsing of @keyframes (expected '{')` - ); - } - mode = CSS_MODE_IN_LOCAL_RULE; - modeNestingLevel = 1; - return pos + 1; - } - return end; - }, - semicolon: (input, start, end) => { - switch (mode) { - case CSS_MODE_AT_IMPORT_EXPECT_URL: - throw new Error(`Expected URL for @import at ${start}`); - case CSS_MODE_AT_IMPORT_EXPECT_MEDIA: - case CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS: { - const { line: sl, column: sc } = locConverter.get(modeData.start); - const { line: el, column: ec } = locConverter.get(end); - end = eatWhiteLine(input, end); - const media = input.slice(modePos, start).trim(); - const dep = new CssImportDependency( - modeData.url, - [modeData.start, end], - modeData.supports, - media - ); - dep.setLoc(sl, sc, el, ec); - module.addDependency(dep); - break; - } - case CSS_MODE_IN_LOCAL_RULE: { - processDeclarationValueDone(input, start); - return processLocalDeclaration(input, end); - } - case CSS_MODE_IN_RULE: { - return end; - } - } - mode = CSS_MODE_TOP_LEVEL; - modeData = undefined; - singleClassSelector = undefined; - return end; - }, - leftCurlyBracket: (input, start, end) => { - switch (mode) { - case CSS_MODE_TOP_LEVEL: - mode = isTopLevelLocal() - ? CSS_MODE_IN_LOCAL_RULE - : CSS_MODE_IN_RULE; - modeNestingLevel = 1; - if (mode === CSS_MODE_IN_LOCAL_RULE) - return processLocalDeclaration(input, end); - break; - case CSS_MODE_IN_RULE: - case CSS_MODE_IN_LOCAL_RULE: - modeNestingLevel++; - break; - } - return end; - }, - rightCurlyBracket: (input, start, end) => { - switch (mode) { - case CSS_MODE_IN_LOCAL_RULE: - processDeclarationValueDone(input, start); - /* falls through */ - case CSS_MODE_IN_RULE: - if (--modeNestingLevel === 0) { - mode = CSS_MODE_TOP_LEVEL; - modeData = undefined; - singleClassSelector = undefined; - } - break; - } - return end; - }, - id: (input, start, end) => { - singleClassSelector = false; - switch (mode) { - case CSS_MODE_TOP_LEVEL: - if (isTopLevelLocal()) { - const name = input.slice(start + 1, end); - const dep = new CssLocalIdentifierDependency(name, [ - start + 1, - end - ]); - const { line: sl, column: sc } = locConverter.get(start); - const { line: el, column: ec } = locConverter.get(end); - dep.setLoc(sl, sc, el, ec); - module.addDependency(dep); - } - break; - } - return end; - }, - identifier: (input, start, end) => { - singleClassSelector = false; - switch (mode) { - case CSS_MODE_IN_LOCAL_RULE: - if (modeData === "animation") { - lastIdentifier = [start, end]; - } - break; - } - return end; - }, - class: (input, start, end) => { - switch (mode) { - case CSS_MODE_TOP_LEVEL: { - if (isTopLevelLocal()) { - const name = input.slice(start + 1, end); - const dep = new CssLocalIdentifierDependency(name, [ - start + 1, - end - ]); - const { line: sl, column: sc } = locConverter.get(start); - const { line: el, column: ec } = locConverter.get(end); - dep.setLoc(sl, sc, el, ec); - module.addDependency(dep); - if (singleClassSelector === undefined) singleClassSelector = name; - } else { - singleClassSelector = false; - } - break; - } - } - return end; - }, - leftParenthesis: (input, start, end) => { - switch (mode) { - case CSS_MODE_TOP_LEVEL: { - modeStack.push(false); - break; - } - } - return end; - }, - rightParenthesis: (input, start, end) => { - switch (mode) { - case CSS_MODE_TOP_LEVEL: { - const newModeData = modeStack.pop(); - if (newModeData !== false) { - modeData = newModeData; - const dep = new ConstDependency("", [start, end]); - module.addPresentationalDependency(dep); - } - break; - } - } - return end; - }, - pseudoClass: (input, start, end) => { - singleClassSelector = false; - switch (mode) { - case CSS_MODE_TOP_LEVEL: { - const name = input.slice(start, end); - if (this.allowModeSwitch && name === ":global") { - modeData = "global"; - const dep = new ConstDependency("", [start, end]); - module.addPresentationalDependency(dep); - } else if (this.allowModeSwitch && name === ":local") { - modeData = "local"; - const dep = new ConstDependency("", [start, end]); - module.addPresentationalDependency(dep); - } else if (this.allowPseudoBlocks && name === ":export") { - const pos = parseExports(input, end); - const dep = new ConstDependency("", [start, pos]); - module.addPresentationalDependency(dep); - return pos; - } - break; - } - } - return end; - }, - pseudoFunction: (input, start, end) => { - switch (mode) { - case CSS_MODE_TOP_LEVEL: { - const name = input.slice(start, end - 1); - if (this.allowModeSwitch && name === ":global") { - modeStack.push(modeData); - modeData = "global"; - const dep = new ConstDependency("", [start, end]); - module.addPresentationalDependency(dep); - } else if (this.allowModeSwitch && name === ":local") { - modeStack.push(modeData); - modeData = "local"; - const dep = new ConstDependency("", [start, end]); - module.addPresentationalDependency(dep); - } else { - modeStack.push(false); - } - break; - } - } - return end; - }, - function: (input, start, end) => { - switch (mode) { - case CSS_MODE_IN_LOCAL_RULE: { - const name = input.slice(start, end - 1); - if (name === "var") { - let pos = walkCssTokens.eatWhitespaceAndComments(input, end); - if (pos === input.length) return pos; - const [newPos, name] = eatText(input, pos, eatNameInVar); - if (!name.startsWith("--")) return end; - const { line: sl, column: sc } = locConverter.get(pos); - const { line: el, column: ec } = locConverter.get(newPos); - const dep = new CssSelfLocalIdentifierDependency( - name.slice(2), - [pos, newPos], - "--", - declaredCssVariables - ); - dep.setLoc(sl, sc, el, ec); - module.addDependency(dep); - return newPos; - } - break; - } - } - return end; - }, - comma: (input, start, end) => { - switch (mode) { - case CSS_MODE_TOP_LEVEL: - modeData = undefined; - modeStack.length = 0; - break; - case CSS_MODE_IN_LOCAL_RULE: - processDeclarationValueDone(input, start); - break; - } - return end; - } - }); - - module.buildInfo.strict = true; - module.buildMeta.exportsType = "namespace"; - module.addDependency(new StaticExportsDependency([], true)); - return state; - } -} - -module.exports = CssParser; +module.exports = CommonJsRequireDependency; /***/ }), -/***/ 44124: -/***/ (function(module) { +/***/ 52225: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -76884,1125 +74363,877 @@ module.exports = CssParser; -/** - * @typedef {Object} CssTokenCallbacks - * @property {function(string, number): boolean} isSelector - * @property {function(string, number, number, number, number): number=} url - * @property {function(string, number, number): number=} string - * @property {function(string, number, number): number=} leftParenthesis - * @property {function(string, number, number): number=} rightParenthesis - * @property {function(string, number, number): number=} pseudoFunction - * @property {function(string, number, number): number=} function - * @property {function(string, number, number): number=} pseudoClass - * @property {function(string, number, number): number=} atKeyword - * @property {function(string, number, number): number=} class - * @property {function(string, number, number): number=} identifier - * @property {function(string, number, number): number=} id - * @property {function(string, number, number): number=} leftCurlyBracket - * @property {function(string, number, number): number=} rightCurlyBracket - * @property {function(string, number, number): number=} semicolon - * @property {function(string, number, number): number=} comma - */ +const RuntimeGlobals = __webpack_require__(16475); +const { equals } = __webpack_require__(84953); +const makeSerializable = __webpack_require__(33032); +const propertyAccess = __webpack_require__(54190); +const NullDependency = __webpack_require__(31830); -/** @typedef {function(string, number, CssTokenCallbacks): number} CharHandler */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -// spec: https://drafts.csswg.org/css-syntax/ +class CommonJsSelfReferenceDependency extends NullDependency { + constructor(range, base, names, call) { + super(); + this.range = range; + this.base = base; + this.names = names; + this.call = call; + } -const CC_LINE_FEED = "\n".charCodeAt(0); -const CC_CARRIAGE_RETURN = "\r".charCodeAt(0); -const CC_FORM_FEED = "\f".charCodeAt(0); + get type() { + return "cjs self exports reference"; + } -const CC_TAB = "\t".charCodeAt(0); -const CC_SPACE = " ".charCodeAt(0); + get category() { + return "self"; + } -const CC_SLASH = "/".charCodeAt(0); -const CC_BACK_SLASH = "\\".charCodeAt(0); -const CC_ASTERISK = "*".charCodeAt(0); + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + return `self`; + } -const CC_LEFT_PARENTHESIS = "(".charCodeAt(0); -const CC_RIGHT_PARENTHESIS = ")".charCodeAt(0); -const CC_LEFT_CURLY = "{".charCodeAt(0); -const CC_RIGHT_CURLY = "}".charCodeAt(0); + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + return [this.call ? this.names.slice(0, -1) : this.names]; + } -const CC_QUOTATION_MARK = '"'.charCodeAt(0); -const CC_APOSTROPHE = "'".charCodeAt(0); + serialize(context) { + const { write } = context; + write(this.range); + write(this.base); + write(this.names); + write(this.call); + super.serialize(context); + } -const CC_FULL_STOP = ".".charCodeAt(0); -const CC_COLON = ":".charCodeAt(0); -const CC_SEMICOLON = ";".charCodeAt(0); -const CC_COMMA = ",".charCodeAt(0); -const CC_PERCENTAGE = "%".charCodeAt(0); -const CC_AT_SIGN = "@".charCodeAt(0); + deserialize(context) { + const { read } = context; + this.range = read(); + this.base = read(); + this.names = read(); + this.call = read(); + super.deserialize(context); + } +} -const CC_LOW_LINE = "_".charCodeAt(0); -const CC_LOWER_A = "a".charCodeAt(0); -const CC_LOWER_U = "u".charCodeAt(0); -const CC_LOWER_E = "e".charCodeAt(0); -const CC_LOWER_Z = "z".charCodeAt(0); -const CC_UPPER_A = "A".charCodeAt(0); -const CC_UPPER_E = "E".charCodeAt(0); -const CC_UPPER_Z = "Z".charCodeAt(0); -const CC_0 = "0".charCodeAt(0); -const CC_9 = "9".charCodeAt(0); +makeSerializable( + CommonJsSelfReferenceDependency, + "webpack/lib/dependencies/CommonJsSelfReferenceDependency" +); -const CC_NUMBER_SIGN = "#".charCodeAt(0); -const CC_PLUS_SIGN = "+".charCodeAt(0); -const CC_HYPHEN_MINUS = "-".charCodeAt(0); +CommonJsSelfReferenceDependency.Template = class CommonJsSelfReferenceDependencyTemplate extends ( + NullDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { module, moduleGraph, runtime, runtimeRequirements } + ) { + const dep = /** @type {CommonJsSelfReferenceDependency} */ (dependency); + let used; + if (dep.names.length === 0) { + used = dep.names; + } else { + used = moduleGraph.getExportsInfo(module).getUsedName(dep.names, runtime); + } + if (!used) { + throw new Error( + "Self-reference dependency has unused export name: This should not happen" + ); + } -const CC_LESS_THAN_SIGN = "<".charCodeAt(0); -const CC_GREATER_THAN_SIGN = ">".charCodeAt(0); + let base = undefined; + switch (dep.base) { + case "exports": + runtimeRequirements.add(RuntimeGlobals.exports); + base = module.exportsArgument; + break; + case "module.exports": + runtimeRequirements.add(RuntimeGlobals.module); + base = `${module.moduleArgument}.exports`; + break; + case "this": + runtimeRequirements.add(RuntimeGlobals.thisAsExports); + base = "this"; + break; + default: + throw new Error(`Unsupported base ${dep.base}`); + } -const _isNewLine = cc => { - return ( - cc === CC_LINE_FEED || cc === CC_CARRIAGE_RETURN || cc === CC_FORM_FEED - ); -}; + if (base === dep.base && equals(used, dep.names)) { + // Nothing has to be changed + // We don't use a replacement for compat reasons + // for plugins that update `module._source` which they + // shouldn't do! + return; + } -/** @type {CharHandler} */ -const consumeSpace = (input, pos, callbacks) => { - let cc; - do { - pos++; - cc = input.charCodeAt(pos); - } while (_isWhiteSpace(cc)); - return pos; + source.replace( + dep.range[0], + dep.range[1] - 1, + `${base}${propertyAccess(used)}` + ); + } }; -const _isWhiteSpace = cc => { - return ( - cc === CC_LINE_FEED || - cc === CC_CARRIAGE_RETURN || - cc === CC_FORM_FEED || - cc === CC_TAB || - cc === CC_SPACE - ); -}; +module.exports = CommonJsSelfReferenceDependency; -/** @type {CharHandler} */ -const consumeSingleCharToken = (input, pos, callbacks) => { - return pos + 1; -}; -/** @type {CharHandler} */ -const consumePotentialComment = (input, pos, callbacks) => { - pos++; - if (pos === input.length) return pos; - let cc = input.charCodeAt(pos); - if (cc !== CC_ASTERISK) return pos; - for (;;) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - while (cc === CC_ASTERISK) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - if (cc === CC_SLASH) return pos + 1; - } - } -}; +/***/ }), -/** @type {function(number): CharHandler} */ -const consumeString = end => (input, pos, callbacks) => { - const start = pos; - pos = _consumeString(input, pos, end); - if (callbacks.string !== undefined) { - pos = callbacks.string(input, start, pos); - } - return pos; -}; +/***/ 76911: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -const _consumeString = (input, pos, end) => { - pos++; - for (;;) { - if (pos === input.length) return pos; - const cc = input.charCodeAt(pos); - if (cc === end) return pos + 1; - if (_isNewLine(cc)) { - // bad string - return pos; - } - if (cc === CC_BACK_SLASH) { - // we don't need to fully parse the escaped code point - // just skip over a potential new line - pos++; - if (pos === input.length) return pos; - pos++; - } else { - pos++; - } - } -}; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -const _isIdentifierStartCode = cc => { - return ( - cc === CC_LOW_LINE || - (cc >= CC_LOWER_A && cc <= CC_LOWER_Z) || - (cc >= CC_UPPER_A && cc <= CC_UPPER_Z) || - cc > 0x80 - ); -}; -const _isDigit = cc => { - return cc >= CC_0 && cc <= CC_9; -}; -const _startsIdentifier = (input, pos) => { - const cc = input.charCodeAt(pos); - if (cc === CC_HYPHEN_MINUS) { - if (pos === input.length) return false; - const cc = input.charCodeAt(pos + 1); - if (cc === CC_HYPHEN_MINUS) return true; - if (cc === CC_BACK_SLASH) { - const cc = input.charCodeAt(pos + 2); - return !_isNewLine(cc); +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../util/Hash")} Hash */ + +class ConstDependency extends NullDependency { + /** + * @param {string} expression the expression + * @param {number|[number, number]} range the source range + * @param {string[]=} runtimeRequirements runtime requirements + */ + constructor(expression, range, runtimeRequirements) { + super(); + this.expression = expression; + this.range = range; + this.runtimeRequirements = runtimeRequirements + ? new Set(runtimeRequirements) + : null; + this._hashUpdate = undefined; + } + + /** + * Update the hash + * @param {Hash} hash hash to be updated + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + if (this._hashUpdate === undefined) { + let hashUpdate = "" + this.range + "|" + this.expression; + if (this.runtimeRequirements) { + for (const item of this.runtimeRequirements) { + hashUpdate += "|"; + hashUpdate += item; + } + } + this._hashUpdate = hashUpdate; } - return _isIdentifierStartCode(cc); + hash.update(this._hashUpdate); } - if (cc === CC_BACK_SLASH) { - const cc = input.charCodeAt(pos + 1); - return !_isNewLine(cc); + + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this dependency connects the module to referencing modules + */ + getModuleEvaluationSideEffectsState(moduleGraph) { + return false; } - return _isIdentifierStartCode(cc); -}; -/** @type {CharHandler} */ -const consumeNumberSign = (input, pos, callbacks) => { - const start = pos; - pos++; - if (pos === input.length) return pos; - if (callbacks.isSelector(input, pos) && _startsIdentifier(input, pos)) { - pos = _consumeIdentifier(input, pos); - if (callbacks.id !== undefined) { - return callbacks.id(input, start, pos); - } + serialize(context) { + const { write } = context; + write(this.expression); + write(this.range); + write(this.runtimeRequirements); + super.serialize(context); } - return pos; -}; -/** @type {CharHandler} */ -const consumeMinus = (input, pos, callbacks) => { - const start = pos; - pos++; - if (pos === input.length) return pos; - const cc = input.charCodeAt(pos); - if (cc === CC_FULL_STOP || _isDigit(cc)) { - return consumeNumericToken(input, pos, callbacks); - } else if (cc === CC_HYPHEN_MINUS) { - pos++; - if (pos === input.length) return pos; - const cc = input.charCodeAt(pos); - if (cc === CC_GREATER_THAN_SIGN) { - return pos + 1; - } else { - pos = _consumeIdentifier(input, pos); - if (callbacks.identifier !== undefined) { - return callbacks.identifier(input, start, pos); + deserialize(context) { + const { read } = context; + this.expression = read(); + this.range = read(); + this.runtimeRequirements = read(); + super.deserialize(context); + } +} + +makeSerializable(ConstDependency, "webpack/lib/dependencies/ConstDependency"); + +ConstDependency.Template = class ConstDependencyTemplate extends ( + NullDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply(dependency, source, templateContext) { + const dep = /** @type {ConstDependency} */ (dependency); + if (dep.runtimeRequirements) { + for (const req of dep.runtimeRequirements) { + templateContext.runtimeRequirements.add(req); } } - } else if (cc === CC_BACK_SLASH) { - if (pos + 1 === input.length) return pos; - const cc = input.charCodeAt(pos + 1); - if (_isNewLine(cc)) return pos; - pos = _consumeIdentifier(input, pos); - if (callbacks.identifier !== undefined) { - return callbacks.identifier(input, start, pos); - } - } else if (_isIdentifierStartCode(cc)) { - pos++; - pos = _consumeIdentifier(input, pos); - if (callbacks.identifier !== undefined) { - return callbacks.identifier(input, start, pos); + if (typeof dep.range === "number") { + source.insert(dep.range, dep.expression); + return; } + + source.replace(dep.range[0], dep.range[1] - 1, dep.expression); } - return pos; }; -/** @type {CharHandler} */ -const consumeDot = (input, pos, callbacks) => { - const start = pos; - pos++; - if (pos === input.length) return pos; - const cc = input.charCodeAt(pos); - if (_isDigit(cc)) return consumeNumericToken(input, pos - 2, callbacks); - if (!callbacks.isSelector(input, pos) || !_startsIdentifier(input, pos)) - return pos; - pos = _consumeIdentifier(input, pos); - if (callbacks.class !== undefined) return callbacks.class(input, start, pos); - return pos; -}; +module.exports = ConstDependency; -/** @type {CharHandler} */ -const consumeNumericToken = (input, pos, callbacks) => { - pos = _consumeNumber(input, pos); - if (pos === input.length) return pos; - if (_startsIdentifier(input, pos)) return _consumeIdentifier(input, pos); - const cc = input.charCodeAt(pos); - if (cc === CC_PERCENTAGE) return pos + 1; - return pos; -}; -/** @type {CharHandler} */ -const consumeOtherIdentifier = (input, pos, callbacks) => { - const start = pos; - pos = _consumeIdentifier(input, pos); - if ( - pos !== input.length && - !callbacks.isSelector(input, pos) && - input.charCodeAt(pos) === CC_LEFT_PARENTHESIS - ) { - pos++; - if (callbacks.function !== undefined) { - return callbacks.function(input, start, pos); - } - } else { - if (callbacks.identifier !== undefined) { - return callbacks.identifier(input, start, pos); +/***/ }), + +/***/ 88101: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const Dependency = __webpack_require__(54912); +const DependencyTemplate = __webpack_require__(5160); +const makeSerializable = __webpack_require__(33032); +const memoize = __webpack_require__(78676); + +/** @typedef {import("../ContextModule").ContextOptions} ContextOptions */ +/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../WebpackError")} WebpackError */ + +const getCriticalDependencyWarning = memoize(() => + __webpack_require__(15427) +); + +/** @typedef {ContextOptions & { request: string }} ContextDependencyOptions */ + +const regExpToString = r => (r ? r + "" : ""); + +class ContextDependency extends Dependency { + /** + * @param {ContextDependencyOptions} options options for the context module + */ + constructor(options) { + super(); + + this.options = options; + this.userRequest = this.options && this.options.request; + /** @type {false | string} */ + this.critical = false; + this.hadGlobalOrStickyRegExp = false; + + if ( + this.options && + (this.options.regExp.global || this.options.regExp.sticky) + ) { + this.options = { ...this.options, regExp: null }; + this.hadGlobalOrStickyRegExp = true; } + + this.request = undefined; + this.range = undefined; + this.valueRange = undefined; + this.inShorthand = undefined; + // TODO refactor this + this.replaces = undefined; } - return pos; -}; -/** @type {CharHandler} */ -const consumePotentialUrl = (input, pos, callbacks) => { - const start = pos; - pos = _consumeIdentifier(input, pos); - if (pos === start + 3 && input.slice(start, pos + 1) === "url(") { - pos++; - let cc = input.charCodeAt(pos); - while (_isWhiteSpace(cc)) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - } - if (cc === CC_QUOTATION_MARK || cc === CC_APOSTROPHE) { - pos++; - const contentStart = pos; - pos = _consumeString(input, pos, cc); - const contentEnd = pos - 1; - cc = input.charCodeAt(pos); - while (_isWhiteSpace(cc)) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - } - if (cc !== CC_RIGHT_PARENTHESIS) return pos; - pos++; - if (callbacks.url !== undefined) - return callbacks.url(input, start, pos, contentStart, contentEnd); - return pos; - } else { - const contentStart = pos; - let contentEnd; - for (;;) { - if (cc === CC_BACK_SLASH) { - pos++; - if (pos === input.length) return pos; - pos++; - } else if (_isWhiteSpace(cc)) { - contentEnd = pos; - do { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - } while (_isWhiteSpace(cc)); - if (cc !== CC_RIGHT_PARENTHESIS) return pos; - pos++; - if (callbacks.url !== undefined) { - return callbacks.url(input, start, pos, contentStart, contentEnd); - } - return pos; - } else if (cc === CC_RIGHT_PARENTHESIS) { - contentEnd = pos; - pos++; - if (callbacks.url !== undefined) { - return callbacks.url(input, start, pos, contentStart, contentEnd); - } - return pos; - } else if (cc === CC_LEFT_PARENTHESIS) { - return pos; - } else { - pos++; - } - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - } - } - } else { - if (callbacks.identifier !== undefined) { - return callbacks.identifier(input, start, pos); - } - return pos; + get category() { + return "commonjs"; } -}; -/** @type {CharHandler} */ -const consumePotentialPseudo = (input, pos, callbacks) => { - const start = pos; - pos++; - if (!callbacks.isSelector(input, pos) || !_startsIdentifier(input, pos)) - return pos; - pos = _consumeIdentifier(input, pos); - let cc = input.charCodeAt(pos); - if (cc === CC_LEFT_PARENTHESIS) { - pos++; - if (callbacks.pseudoFunction !== undefined) { - return callbacks.pseudoFunction(input, start, pos); - } - return pos; - } - if (callbacks.pseudoClass !== undefined) { - return callbacks.pseudoClass(input, start, pos); + /** + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + */ + couldAffectReferencingModule() { + return true; } - return pos; -}; -/** @type {CharHandler} */ -const consumeLeftParenthesis = (input, pos, callbacks) => { - pos++; - if (callbacks.leftParenthesis !== undefined) { - return callbacks.leftParenthesis(input, pos - 1, pos); + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + return ( + `context${this.options.request} ${this.options.recursive} ` + + `${regExpToString(this.options.regExp)} ${regExpToString( + this.options.include + )} ${regExpToString(this.options.exclude)} ` + + `${this.options.mode} ${this.options.chunkName} ` + + `${JSON.stringify(this.options.groupOptions)}` + ); } - return pos; -}; -/** @type {CharHandler} */ -const consumeRightParenthesis = (input, pos, callbacks) => { - pos++; - if (callbacks.rightParenthesis !== undefined) { - return callbacks.rightParenthesis(input, pos - 1, pos); - } - return pos; -}; + /** + * Returns warnings + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[]} warnings + */ + getWarnings(moduleGraph) { + let warnings = super.getWarnings(moduleGraph); -/** @type {CharHandler} */ -const consumeLeftCurlyBracket = (input, pos, callbacks) => { - pos++; - if (callbacks.leftCurlyBracket !== undefined) { - return callbacks.leftCurlyBracket(input, pos - 1, pos); - } - return pos; -}; + if (this.critical) { + if (!warnings) warnings = []; + const CriticalDependencyWarning = getCriticalDependencyWarning(); + warnings.push(new CriticalDependencyWarning(this.critical)); + } -/** @type {CharHandler} */ -const consumeRightCurlyBracket = (input, pos, callbacks) => { - pos++; - if (callbacks.rightCurlyBracket !== undefined) { - return callbacks.rightCurlyBracket(input, pos - 1, pos); - } - return pos; -}; + if (this.hadGlobalOrStickyRegExp) { + if (!warnings) warnings = []; + const CriticalDependencyWarning = getCriticalDependencyWarning(); + warnings.push( + new CriticalDependencyWarning( + "Contexts can't use RegExps with the 'g' or 'y' flags." + ) + ); + } -/** @type {CharHandler} */ -const consumeSemicolon = (input, pos, callbacks) => { - pos++; - if (callbacks.semicolon !== undefined) { - return callbacks.semicolon(input, pos - 1, pos); + return warnings; } - return pos; -}; -/** @type {CharHandler} */ -const consumeComma = (input, pos, callbacks) => { - pos++; - if (callbacks.comma !== undefined) { - return callbacks.comma(input, pos - 1, pos); - } - return pos; -}; + serialize(context) { + const { write } = context; -const _consumeIdentifier = (input, pos) => { - for (;;) { - const cc = input.charCodeAt(pos); - if (cc === CC_BACK_SLASH) { - pos++; - if (pos === input.length) return pos; - pos++; - } else if ( - _isIdentifierStartCode(cc) || - _isDigit(cc) || - cc === CC_HYPHEN_MINUS - ) { - pos++; - } else { - return pos; - } - } -}; + write(this.options); + write(this.userRequest); + write(this.critical); + write(this.hadGlobalOrStickyRegExp); + write(this.request); + write(this.range); + write(this.valueRange); + write(this.prepend); + write(this.replaces); -const _consumeNumber = (input, pos) => { - pos++; - if (pos === input.length) return pos; - let cc = input.charCodeAt(pos); - while (_isDigit(cc)) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - } - if (cc === CC_FULL_STOP && pos + 1 !== input.length) { - const next = input.charCodeAt(pos + 1); - if (_isDigit(next)) { - pos += 2; - cc = input.charCodeAt(pos); - while (_isDigit(cc)) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - } - } - } - if (cc === CC_LOWER_E || cc === CC_UPPER_E) { - if (pos + 1 !== input.length) { - const next = input.charCodeAt(pos + 2); - if (_isDigit(next)) { - pos += 2; - } else if ( - (next === CC_HYPHEN_MINUS || next === CC_PLUS_SIGN) && - pos + 2 !== input.length - ) { - const next = input.charCodeAt(pos + 2); - if (_isDigit(next)) { - pos += 3; - } else { - return pos; - } - } else { - return pos; - } - } - } else { - return pos; - } - cc = input.charCodeAt(pos); - while (_isDigit(cc)) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); + super.serialize(context); } - return pos; -}; -/** @type {CharHandler} */ -const consumeLessThan = (input, pos, callbacks) => { - if (input.slice(pos + 1, pos + 4) === "!--") return pos + 4; - return pos + 1; -}; + deserialize(context) { + const { read } = context; -/** @type {CharHandler} */ -const consumeAt = (input, pos, callbacks) => { - const start = pos; - pos++; - if (pos === input.length) return pos; - if (_startsIdentifier(input, pos)) { - pos = _consumeIdentifier(input, pos); - if (callbacks.atKeyword !== undefined) { - pos = callbacks.atKeyword(input, start, pos); - } - } - return pos; -}; + this.options = read(); + this.userRequest = read(); + this.critical = read(); + this.hadGlobalOrStickyRegExp = read(); + this.request = read(); + this.range = read(); + this.valueRange = read(); + this.prepend = read(); + this.replaces = read(); -const CHAR_MAP = Array.from({ length: 0x80 }, (_, cc) => { - // https://drafts.csswg.org/css-syntax/#consume-token - switch (cc) { - case CC_LINE_FEED: - case CC_CARRIAGE_RETURN: - case CC_FORM_FEED: - case CC_TAB: - case CC_SPACE: - return consumeSpace; - case CC_QUOTATION_MARK: - case CC_APOSTROPHE: - return consumeString(cc); - case CC_NUMBER_SIGN: - return consumeNumberSign; - case CC_SLASH: - return consumePotentialComment; - // case CC_LEFT_SQUARE: - // case CC_RIGHT_SQUARE: - // case CC_COMMA: - // case CC_COLON: - // return consumeSingleCharToken; - case CC_COMMA: - return consumeComma; - case CC_SEMICOLON: - return consumeSemicolon; - case CC_LEFT_PARENTHESIS: - return consumeLeftParenthesis; - case CC_RIGHT_PARENTHESIS: - return consumeRightParenthesis; - case CC_LEFT_CURLY: - return consumeLeftCurlyBracket; - case CC_RIGHT_CURLY: - return consumeRightCurlyBracket; - case CC_COLON: - return consumePotentialPseudo; - case CC_PLUS_SIGN: - return consumeNumericToken; - case CC_FULL_STOP: - return consumeDot; - case CC_HYPHEN_MINUS: - return consumeMinus; - case CC_LESS_THAN_SIGN: - return consumeLessThan; - case CC_AT_SIGN: - return consumeAt; - case CC_LOWER_U: - return consumePotentialUrl; - case CC_LOW_LINE: - return consumeOtherIdentifier; - default: - if (_isDigit(cc)) return consumeNumericToken; - if ( - (cc >= CC_LOWER_A && cc <= CC_LOWER_Z) || - (cc >= CC_UPPER_A && cc <= CC_UPPER_Z) - ) { - return consumeOtherIdentifier; - } - return consumeSingleCharToken; + super.deserialize(context); } -}); +} -/** - * @param {string} input input css - * @param {CssTokenCallbacks} callbacks callbacks - * @returns {void} - */ -module.exports = (input, callbacks) => { - let pos = 0; - while (pos < input.length) { - const cc = input.charCodeAt(pos); - if (cc < 0x80) { - pos = CHAR_MAP[cc](input, pos, callbacks); - } else { - pos++; - } - } -}; +makeSerializable( + ContextDependency, + "webpack/lib/dependencies/ContextDependency" +); -module.exports.eatComments = (input, pos) => { - loop: for (;;) { - const cc = input.charCodeAt(pos); - if (cc === CC_SLASH) { - if (pos === input.length) return pos; - let cc = input.charCodeAt(pos + 1); - if (cc !== CC_ASTERISK) return pos; - pos++; - for (;;) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - while (cc === CC_ASTERISK) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - if (cc === CC_SLASH) { - pos++; - continue loop; - } - } - } - } - return pos; - } -}; +ContextDependency.Template = DependencyTemplate; -module.exports.eatWhitespaceAndComments = (input, pos) => { - loop: for (;;) { - const cc = input.charCodeAt(pos); - if (cc === CC_SLASH) { - if (pos === input.length) return pos; - let cc = input.charCodeAt(pos + 1); - if (cc !== CC_ASTERISK) return pos; - pos++; - for (;;) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - while (cc === CC_ASTERISK) { - pos++; - if (pos === input.length) return pos; - cc = input.charCodeAt(pos); - if (cc === CC_SLASH) { - pos++; - continue loop; - } - } - } - } else if (_isWhiteSpace(cc)) { - pos++; - continue; - } - return pos; - } -}; +module.exports = ContextDependency; /***/ }), -/***/ 2757: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 99630: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const { Tracer } = __webpack_require__(5787); -const createSchemaValidation = __webpack_require__(32540); -const { dirname, mkdirpSync } = __webpack_require__(17139); - -/** @typedef {import("../../declarations/plugins/debug/ProfilingPlugin").ProfilingPluginOptions} ProfilingPluginOptions */ -/** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */ - -const validate = createSchemaValidation( - __webpack_require__(37134), - () => __webpack_require__(50686), - { - name: "Profiling Plugin", - baseDataPath: "options" - } -); -let inspector = undefined; +const { parseResource } = __webpack_require__(82186); -try { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - inspector = __webpack_require__(31405); -} catch (e) { - console.log("Unable to CPU profile in < node 8.0"); -} +/** @typedef {import("estree").Node} EsTreeNode */ +/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ +/** @typedef {import("../../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */ +/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */ +/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ +/** @typedef {import("./ContextDependency")} ContextDependency */ +/** @typedef {import("./ContextDependency").ContextDependencyOptions} ContextDependencyOptions */ -class Profiler { - constructor(inspector) { - this.session = undefined; - this.inspector = inspector; - this._startTime = 0; - } +/** + * Escapes regular expression metacharacters + * @param {string} str String to quote + * @returns {string} Escaped string + */ +const quoteMeta = str => { + return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); +}; - hasSession() { - return this.session !== undefined; +const splitContextFromPrefix = prefix => { + const idx = prefix.lastIndexOf("/"); + let context = "."; + if (idx >= 0) { + context = prefix.substr(0, idx); + prefix = `.${prefix.substr(idx)}`; } + return { + context, + prefix + }; +}; - startProfiling() { - if (this.inspector === undefined) { - return Promise.resolve(); - } +/** @typedef {Partial>} PartialContextDependencyOptions */ - try { - this.session = new inspector.Session(); - this.session.connect(); - } catch (_) { - this.session = undefined; - return Promise.resolve(); - } +/** @typedef {{ new(options: ContextDependencyOptions, range: [number, number], valueRange: [number, number]): ContextDependency }} ContextDependencyConstructor */ - const hrtime = process.hrtime(); - this._startTime = hrtime[0] * 1000000 + Math.round(hrtime[1] / 1000); +/** + * @param {ContextDependencyConstructor} Dep the Dependency class + * @param {[number, number]} range source range + * @param {BasicEvaluatedExpression} param context param + * @param {EsTreeNode} expr expr + * @param {Pick} options options for context creation + * @param {PartialContextDependencyOptions} contextOptions options for the ContextModule + * @param {JavascriptParser} parser the parser + * @returns {ContextDependency} the created Dependency + */ +exports.create = (Dep, range, param, expr, options, contextOptions, parser) => { + if (param.isTemplateString()) { + let prefixRaw = param.quasis[0].string; + let postfixRaw = + param.quasis.length > 1 + ? param.quasis[param.quasis.length - 1].string + : ""; - return Promise.all([ - this.sendCommand("Profiler.setSamplingInterval", { - interval: 100 - }), - this.sendCommand("Profiler.enable"), - this.sendCommand("Profiler.start") - ]); - } + const valueRange = param.range; + const { context, prefix } = splitContextFromPrefix(prefixRaw); + const { + path: postfix, + query, + fragment + } = parseResource(postfixRaw, parser); - sendCommand(method, params) { - if (this.hasSession()) { - return new Promise((res, rej) => { - return this.session.post(method, params, (err, params) => { - if (err !== null) { - rej(err); - } else { - res(params); - } + // When there are more than two quasis, the generated RegExp can be more precise + // We join the quasis with the expression regexp + const innerQuasis = param.quasis.slice(1, param.quasis.length - 1); + const innerRegExp = + options.wrappedContextRegExp.source + + innerQuasis + .map(q => quoteMeta(q.string) + options.wrappedContextRegExp.source) + .join(""); + + // Example: `./context/pre${e}inner${e}inner2${e}post?query#frag` + // context: "./context" + // prefix: "./pre" + // innerQuasis: [BEE("inner"), BEE("inner2")] + // (BEE = BasicEvaluatedExpression) + // postfix: "post" + // query: "?query" + // fragment: "#frag" + // regExp: /^\.\/pre.*inner.*inner2.*post$/ + const regExp = new RegExp( + `^${quoteMeta(prefix)}${innerRegExp}${quoteMeta(postfix)}$` + ); + const dep = new Dep( + { + request: context + query + fragment, + recursive: options.wrappedContextRecursive, + regExp, + mode: "sync", + ...contextOptions + }, + range, + valueRange + ); + dep.loc = expr.loc; + const replaces = []; + + param.parts.forEach((part, i) => { + if (i % 2 === 0) { + // Quasis or merged quasi + let range = part.range; + let value = part.string; + if (param.templateStringKind === "cooked") { + value = JSON.stringify(value); + value = value.slice(1, value.length - 1); + } + if (i === 0) { + // prefix + value = prefix; + range = [param.range[0], part.range[1]]; + value = + (param.templateStringKind === "cooked" ? "`" : "String.raw`") + + value; + } else if (i === param.parts.length - 1) { + // postfix + value = postfix; + range = [part.range[0], param.range[1]]; + value = value + "`"; + } else if ( + part.expression && + part.expression.type === "TemplateElement" && + part.expression.value.raw === value + ) { + // Shortcut when it's a single quasi and doesn't need to be replaced + return; + } + replaces.push({ + range, + value }); + } else { + // Expression + parser.walkExpression(part.expression); + } + }); + + dep.replaces = replaces; + dep.critical = + options.wrappedContextCritical && + "a part of the request of a dependency is an expression"; + return dep; + } else if ( + param.isWrapped() && + ((param.prefix && param.prefix.isString()) || + (param.postfix && param.postfix.isString())) + ) { + let prefixRaw = + param.prefix && param.prefix.isString() ? param.prefix.string : ""; + let postfixRaw = + param.postfix && param.postfix.isString() ? param.postfix.string : ""; + const prefixRange = + param.prefix && param.prefix.isString() ? param.prefix.range : null; + const postfixRange = + param.postfix && param.postfix.isString() ? param.postfix.range : null; + const valueRange = param.range; + const { context, prefix } = splitContextFromPrefix(prefixRaw); + const { + path: postfix, + query, + fragment + } = parseResource(postfixRaw, parser); + const regExp = new RegExp( + `^${quoteMeta(prefix)}${options.wrappedContextRegExp.source}${quoteMeta( + postfix + )}$` + ); + const dep = new Dep( + { + request: context + query + fragment, + recursive: options.wrappedContextRecursive, + regExp, + mode: "sync", + ...contextOptions + }, + range, + valueRange + ); + dep.loc = expr.loc; + const replaces = []; + if (prefixRange) { + replaces.push({ + range: prefixRange, + value: JSON.stringify(prefix) }); - } else { - return Promise.resolve(); } - } - - destroy() { - if (this.hasSession()) { - this.session.disconnect(); + if (postfixRange) { + replaces.push({ + range: postfixRange, + value: JSON.stringify(postfix) + }); } + dep.replaces = replaces; + dep.critical = + options.wrappedContextCritical && + "a part of the request of a dependency is an expression"; - return Promise.resolve(); - } - - stopProfiling() { - return this.sendCommand("Profiler.stop").then(({ profile }) => { - const hrtime = process.hrtime(); - const endTime = hrtime[0] * 1000000 + Math.round(hrtime[1] / 1000); - if (profile.startTime < this._startTime || profile.endTime > endTime) { - // In some cases timestamps mismatch and we need to adjust them - // Both process.hrtime and the inspector timestamps claim to be relative - // to a unknown point in time. But they do not guarantee that this is the - // same point in time. - const duration = profile.endTime - profile.startTime; - const ownDuration = endTime - this._startTime; - const untracked = Math.max(0, ownDuration - duration); - profile.startTime = this._startTime + untracked / 2; - profile.endTime = endTime - untracked / 2; + if (parser && param.wrappedInnerExpressions) { + for (const part of param.wrappedInnerExpressions) { + if (part.expression) parser.walkExpression(part.expression); } - return { profile }; - }); - } -} + } -/** - * an object that wraps Tracer and Profiler with a counter - * @typedef {Object} Trace - * @property {Tracer} trace instance of Tracer - * @property {number} counter Counter - * @property {Profiler} profiler instance of Profiler - * @property {Function} end the end function - */ + return dep; + } else { + const dep = new Dep( + { + request: options.exprContextRequest, + recursive: options.exprContextRecursive, + regExp: /** @type {RegExp} */ (options.exprContextRegExp), + mode: "sync", + ...contextOptions + }, + range, + param.range + ); + dep.loc = expr.loc; + dep.critical = + options.exprContextCritical && + "the request of a dependency is an expression"; -/** - * @param {IntermediateFileSystem} fs filesystem used for output - * @param {string} outputPath The location where to write the log. - * @returns {Trace} The trace object - */ -const createTrace = (fs, outputPath) => { - const trace = new Tracer(); - const profiler = new Profiler(inspector); - if (/\/|\\/.test(outputPath)) { - const dirPath = dirname(fs, outputPath); - mkdirpSync(fs, dirPath); + parser.walkExpression(param.expression); + + return dep; } - const fsStream = fs.createWriteStream(outputPath); +}; - let counter = 0; - trace.pipe(fsStream); - // These are critical events that need to be inserted so that tools like - // chrome dev tools can load the profile. - trace.instantEvent({ - name: "TracingStartedInPage", - id: ++counter, - cat: ["disabled-by-default-devtools.timeline"], - args: { - data: { - sessionId: "-1", - page: "0xfff", - frames: [ - { - frame: "0xfff", - url: "webpack", - name: "" - } - ] - } - } - }); +/***/ }), - trace.instantEvent({ - name: "TracingStartedInBrowser", - id: ++counter, - cat: ["disabled-by-default-devtools.timeline"], - args: { - data: { - sessionId: "-1" - } - } - }); +/***/ 76081: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - return { - trace, - counter, - profiler, - end: callback => { - trace.push("]"); - // Wait until the write stream finishes. - fsStream.on("close", () => { - callback(); - }); - // Tear down the readable trace stream. - trace.push(null); - } - }; -}; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -const pluginName = "ProfilingPlugin"; -class ProfilingPlugin { - /** - * @param {ProfilingPluginOptions=} options options object - */ - constructor(options = {}) { - validate(options); - this.outputPath = options.outputPath || "events.json"; - } - apply(compiler) { - const tracer = createTrace( - compiler.intermediateFileSystem, - this.outputPath - ); - tracer.profiler.startProfiling(); +const ContextDependency = __webpack_require__(88101); - // Compiler Hooks - Object.keys(compiler.hooks).forEach(hookName => { - const hook = compiler.hooks[hookName]; - if (hook) { - hook.intercept(makeInterceptorFor("Compiler", tracer)(hookName)); - } - }); +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ - Object.keys(compiler.resolverFactory.hooks).forEach(hookName => { - const hook = compiler.resolverFactory.hooks[hookName]; - if (hook) { - hook.intercept(makeInterceptorFor("Resolver", tracer)(hookName)); - } +class ContextDependencyTemplateAsId extends ContextDependency.Template { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } + ) { + const dep = /** @type {ContextDependency} */ (dependency); + const moduleExports = runtimeTemplate.moduleExports({ + module: moduleGraph.getModule(dep), + chunkGraph, + request: dep.request, + weak: dep.weak, + runtimeRequirements }); - compiler.hooks.compilation.tap( - pluginName, - (compilation, { normalModuleFactory, contextModuleFactory }) => { - interceptAllHooksFor(compilation, tracer, "Compilation"); - interceptAllHooksFor( - normalModuleFactory, - tracer, - "Normal Module Factory" + if (moduleGraph.getModule(dep)) { + if (dep.valueRange) { + if (Array.isArray(dep.replaces)) { + for (let i = 0; i < dep.replaces.length; i++) { + const rep = dep.replaces[i]; + source.replace(rep.range[0], rep.range[1] - 1, rep.value); + } + } + source.replace(dep.valueRange[1], dep.range[1] - 1, ")"); + source.replace( + dep.range[0], + dep.valueRange[0] - 1, + `${moduleExports}.resolve(` ); - interceptAllHooksFor( - contextModuleFactory, - tracer, - "Context Module Factory" + } else { + source.replace( + dep.range[0], + dep.range[1] - 1, + `${moduleExports}.resolve` ); - interceptAllParserHooks(normalModuleFactory, tracer); - interceptAllJavascriptModulesPluginHooks(compilation, tracer); } - ); + } else { + source.replace(dep.range[0], dep.range[1] - 1, moduleExports); + } + } +} +module.exports = ContextDependencyTemplateAsId; - // We need to write out the CPU profile when we are all done. - compiler.hooks.done.tapAsync( - { - name: pluginName, - stage: Infinity - }, - (stats, callback) => { - if (compiler.watchMode) return callback(); - tracer.profiler.stopProfiling().then(parsedResults => { - if (parsedResults === undefined) { - tracer.profiler.destroy(); - tracer.end(callback); - return; - } - const cpuStartTime = parsedResults.profile.startTime; - const cpuEndTime = parsedResults.profile.endTime; +/***/ }), - tracer.trace.completeEvent({ - name: "TaskQueueManager::ProcessTaskFromWorkQueue", - id: ++tracer.counter, - cat: ["toplevel"], - ts: cpuStartTime, - args: { - src_file: "../../ipc/ipc_moji_bootstrap.cc", - src_func: "Accept" - } - }); +/***/ 75815: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - tracer.trace.completeEvent({ - name: "EvaluateScript", - id: ++tracer.counter, - cat: ["devtools.timeline"], - ts: cpuStartTime, - dur: cpuEndTime - cpuStartTime, - args: { - data: { - url: "webpack", - lineNumber: 1, - columnNumber: 1, - frame: "0xFFF" - } - } - }); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - tracer.trace.instantEvent({ - name: "CpuProfile", - id: ++tracer.counter, - cat: ["disabled-by-default-devtools.timeline"], - ts: cpuEndTime, - args: { - data: { - cpuProfile: parsedResults.profile - } - } - }); - tracer.profiler.destroy(); - tracer.end(callback); - }); + +const ContextDependency = __webpack_require__(88101); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + +class ContextDependencyTemplateAsRequireCall extends ContextDependency.Template { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } + ) { + const dep = /** @type {ContextDependency} */ (dependency); + let moduleExports = runtimeTemplate.moduleExports({ + module: moduleGraph.getModule(dep), + chunkGraph, + request: dep.request, + runtimeRequirements + }); + + if (dep.inShorthand) { + moduleExports = `${dep.inShorthand}: ${moduleExports}`; + } + if (moduleGraph.getModule(dep)) { + if (dep.valueRange) { + if (Array.isArray(dep.replaces)) { + for (let i = 0; i < dep.replaces.length; i++) { + const rep = dep.replaces[i]; + source.replace(rep.range[0], rep.range[1] - 1, rep.value); + } + } + source.replace(dep.valueRange[1], dep.range[1] - 1, ")"); + source.replace( + dep.range[0], + dep.valueRange[0] - 1, + `${moduleExports}(` + ); + } else { + source.replace(dep.range[0], dep.range[1] - 1, moduleExports); } - ); + } else { + source.replace(dep.range[0], dep.range[1] - 1, moduleExports); + } } } +module.exports = ContextDependencyTemplateAsRequireCall; -const interceptAllHooksFor = (instance, tracer, logLabel) => { - if (Reflect.has(instance, "hooks")) { - Object.keys(instance.hooks).forEach(hookName => { - const hook = instance.hooks[hookName]; - if (hook && !hook._fakeHook) { - hook.intercept(makeInterceptorFor(logLabel, tracer)(hookName)); - } - }); - } -}; -const interceptAllParserHooks = (moduleFactory, tracer) => { - const moduleTypes = [ - "javascript/auto", - "javascript/dynamic", - "javascript/esm", - "json", - "webassembly/async", - "webassembly/sync" - ]; +/***/ }), - moduleTypes.forEach(moduleType => { - moduleFactory.hooks.parser - .for(moduleType) - .tap("ProfilingPlugin", (parser, parserOpts) => { - interceptAllHooksFor(parser, tracer, "Parser"); - }); - }); -}; +/***/ 58477: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -const interceptAllJavascriptModulesPluginHooks = (compilation, tracer) => { - interceptAllHooksFor( - { - hooks: - (__webpack_require__(89464).getCompilationHooks)( - compilation - ) - }, - tracer, - "JavascriptModulesPlugin" - ); -}; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -const makeInterceptorFor = (instance, tracer) => hookName => ({ - register: tapInfo => { - const { name, type, fn } = tapInfo; - const newFn = - // Don't tap our own hooks to ensure stream can close cleanly - name === pluginName - ? fn - : makeNewProfiledTapFn(hookName, tracer, { - name, - type, - fn - }); - return { - ...tapInfo, - fn: newFn - }; + + +const Dependency = __webpack_require__(54912); +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); + +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + +class ContextElementDependency extends ModuleDependency { + constructor(request, userRequest, typePrefix, category, referencedExports) { + super(request); + this.referencedExports = referencedExports; + this._typePrefix = typePrefix; + this._category = category; + + if (userRequest) { + this.userRequest = userRequest; + } } -}); -// TODO improve typing -/** @typedef {(...args: TODO[]) => void | Promise} PluginFunction */ + get type() { + if (this._typePrefix) { + return `${this._typePrefix} context element`; + } -/** - * @param {string} hookName Name of the hook to profile. - * @param {Trace} tracer The trace object. - * @param {object} options Options for the profiled fn. - * @param {string} options.name Plugin name - * @param {string} options.type Plugin type (sync | async | promise) - * @param {PluginFunction} options.fn Plugin function - * @returns {PluginFunction} Chainable hooked function. - */ -const makeNewProfiledTapFn = (hookName, tracer, { name, type, fn }) => { - const defaultCategory = ["blink.user_timing"]; + return "context element"; + } - switch (type) { - case "promise": - return (...args) => { - const id = ++tracer.counter; - tracer.trace.begin({ - name, - id, - cat: defaultCategory - }); - const promise = /** @type {Promise<*>} */ (fn(...args)); - return promise.then(r => { - tracer.trace.end({ - name, - id, - cat: defaultCategory - }); - return r; - }); - }; - case "async": - return (...args) => { - const id = ++tracer.counter; - tracer.trace.begin({ - name, - id, - cat: defaultCategory - }); - const callback = args.pop(); - fn(...args, (...r) => { - tracer.trace.end({ - name, - id, - cat: defaultCategory - }); - callback(...r); - }); - }; - case "sync": - return (...args) => { - const id = ++tracer.counter; - // Do not instrument ourself due to the CPU - // profile needing to be the last event in the trace. - if (name === pluginName) { - return fn(...args); - } + get category() { + return this._category; + } - tracer.trace.begin({ - name, - id, - cat: defaultCategory - }); - let r; - try { - r = fn(...args); - } catch (error) { - tracer.trace.end({ - name, - id, - cat: defaultCategory - }); - throw error; - } - tracer.trace.end({ - name, - id, - cat: defaultCategory - }); - return r; - }; - default: - break; + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + return this.referencedExports + ? this.referencedExports.map(e => ({ + name: e, + canMangle: false + })) + : Dependency.EXPORTS_OBJECT_REFERENCED; } -}; -module.exports = ProfilingPlugin; -module.exports.Profiler = Profiler; + serialize(context) { + const { write } = context; + write(this._typePrefix); + write(this._category); + write(this.referencedExports); + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + this._typePrefix = read(); + this._category = read(); + this.referencedExports = read(); + super.deserialize(context); + } +} + +makeSerializable( + ContextElementDependency, + "webpack/lib/dependencies/ContextElementDependency" +); + +module.exports = ContextElementDependency; /***/ }), -/***/ 96816: +/***/ 79062: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -78021,141 +75252,33 @@ const NullDependency = __webpack_require__(31830); /** @typedef {import("../Dependency")} Dependency */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @type {Record} */ -const DEFINITIONS = { - f: { - definition: "var __WEBPACK_AMD_DEFINE_RESULT__;", - content: `!(__WEBPACK_AMD_DEFINE_RESULT__ = (#).call(exports, __webpack_require__, exports, module), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`, - requests: [ - RuntimeGlobals.require, - RuntimeGlobals.exports, - RuntimeGlobals.module - ] - }, - o: { - definition: "", - content: "!(module.exports = #)", - requests: [RuntimeGlobals.module] - }, - of: { - definition: - "var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;", - content: `!(__WEBPACK_AMD_DEFINE_FACTORY__ = (#), - __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? - (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : - __WEBPACK_AMD_DEFINE_FACTORY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`, - requests: [ - RuntimeGlobals.require, - RuntimeGlobals.exports, - RuntimeGlobals.module - ] - }, - af: { - definition: - "var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;", - content: `!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, __WEBPACK_AMD_DEFINE_RESULT__ = (#).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`, - requests: [RuntimeGlobals.exports, RuntimeGlobals.module] - }, - ao: { - definition: "", - content: "!(#, module.exports = #)", - requests: [RuntimeGlobals.module] - }, - aof: { - definition: - "var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;", - content: `!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, __WEBPACK_AMD_DEFINE_FACTORY__ = (#), - __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? - (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`, - requests: [RuntimeGlobals.exports, RuntimeGlobals.module] - }, - lf: { - definition: "var XXX, XXXmodule;", - content: - "!(XXXmodule = { id: YYY, exports: {}, loaded: false }, XXX = (#).call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule), XXXmodule.loaded = true, XXX === undefined && (XXX = XXXmodule.exports))", - requests: [RuntimeGlobals.require, RuntimeGlobals.module] - }, - lo: { - definition: "var XXX;", - content: "!(XXX = #)", - requests: [] - }, - lof: { - definition: "var XXX, XXXfactory, XXXmodule;", - content: - "!(XXXfactory = (#), (typeof XXXfactory === 'function' ? ((XXXmodule = { id: YYY, exports: {}, loaded: false }), (XXX = XXXfactory.call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule)), (XXXmodule.loaded = true), XXX === undefined && (XXX = XXXmodule.exports)) : XXX = XXXfactory))", - requests: [RuntimeGlobals.require, RuntimeGlobals.module] - }, - laf: { - definition: "var __WEBPACK_AMD_DEFINE_ARRAY__, XXX, XXXexports;", - content: - "!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, XXX = (#).apply(XXXexports = {}, __WEBPACK_AMD_DEFINE_ARRAY__), XXX === undefined && (XXX = XXXexports))", - requests: [] - }, - lao: { - definition: "var XXX;", - content: "!(#, XXX = #)", - requests: [] - }, - laof: { - definition: "var XXXarray, XXXfactory, XXXexports, XXX;", - content: `!(XXXarray = #, XXXfactory = (#), - (typeof XXXfactory === 'function' ? - ((XXX = XXXfactory.apply(XXXexports = {}, XXXarray)), XXX === undefined && (XXX = XXXexports)) : - (XXX = XXXfactory) - ))`, - requests: [] - } -}; - -class AMDDefineDependency extends NullDependency { - constructor(range, arrayRange, functionRange, objectRange, namedModule) { +class CreateScriptUrlDependency extends NullDependency { + /** + * @param {[number, number]} range range + */ + constructor(range) { super(); this.range = range; - this.arrayRange = arrayRange; - this.functionRange = functionRange; - this.objectRange = objectRange; - this.namedModule = namedModule; - this.localModule = null; } get type() { - return "amd define"; + return "create script url"; } serialize(context) { const { write } = context; write(this.range); - write(this.arrayRange); - write(this.functionRange); - write(this.objectRange); - write(this.namedModule); - write(this.localModule); super.serialize(context); } deserialize(context) { const { read } = context; this.range = read(); - this.arrayRange = read(); - this.functionRange = read(); - this.objectRange = read(); - this.namedModule = read(); - this.localModule = read(); super.deserialize(context); } } -makeSerializable( - AMDDefineDependency, - "webpack/lib/dependencies/AMDDefineDependency" -); - -AMDDefineDependency.Template = class AMDDefineDependencyTemplate extends ( +CreateScriptUrlDependency.Template = class CreateScriptUrlDependencyTemplate extends ( NullDependency.Template ) { /** @@ -78165,719 +75288,446 @@ AMDDefineDependency.Template = class AMDDefineDependencyTemplate extends ( * @returns {void} */ apply(dependency, source, { runtimeRequirements }) { - const dep = /** @type {AMDDefineDependency} */ (dependency); - const branch = this.branch(dep); - const { definition, content, requests } = DEFINITIONS[branch]; - for (const req of requests) { - runtimeRequirements.add(req); - } - this.replace(dep, source, definition, content); - } + const dep = /** @type {CreateScriptUrlDependency} */ (dependency); - localModuleVar(dependency) { - return ( - dependency.localModule && - dependency.localModule.used && - dependency.localModule.variableName() - ); - } + runtimeRequirements.add(RuntimeGlobals.createScriptUrl); - branch(dependency) { - const localModuleVar = this.localModuleVar(dependency) ? "l" : ""; - const arrayRange = dependency.arrayRange ? "a" : ""; - const objectRange = dependency.objectRange ? "o" : ""; - const functionRange = dependency.functionRange ? "f" : ""; - return localModuleVar + arrayRange + objectRange + functionRange; + source.insert(dep.range[0], `${RuntimeGlobals.createScriptUrl}(`); + source.insert(dep.range[1], ")"); } +}; - replace(dependency, source, definition, text) { - const localModuleVar = this.localModuleVar(dependency); - if (localModuleVar) { - text = text.replace(/XXX/g, localModuleVar.replace(/\$/g, "$$$$")); - definition = definition.replace( - /XXX/g, - localModuleVar.replace(/\$/g, "$$$$") - ); - } +makeSerializable( + CreateScriptUrlDependency, + "webpack/lib/dependencies/CreateScriptUrlDependency" +); - if (dependency.namedModule) { - text = text.replace(/YYY/g, JSON.stringify(dependency.namedModule)); - } +module.exports = CreateScriptUrlDependency; - const texts = text.split("#"); - if (definition) source.insert(0, definition); +/***/ }), - let current = dependency.range[0]; - if (dependency.arrayRange) { - source.replace(current, dependency.arrayRange[0] - 1, texts.shift()); - current = dependency.arrayRange[1]; - } +/***/ 15427: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (dependency.objectRange) { - source.replace(current, dependency.objectRange[0] - 1, texts.shift()); - current = dependency.objectRange[1]; - } else if (dependency.functionRange) { - source.replace(current, dependency.functionRange[0] - 1, texts.shift()); - current = dependency.functionRange[1]; - } - source.replace(current, dependency.range[1] - 1, texts.shift()); - if (texts.length > 0) throw new Error("Implementation error"); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const WebpackError = __webpack_require__(53799); +const makeSerializable = __webpack_require__(33032); + +class CriticalDependencyWarning extends WebpackError { + constructor(message) { + super(); + + this.name = "CriticalDependencyWarning"; + this.message = "Critical dependency: " + message; } -}; +} -module.exports = AMDDefineDependency; +makeSerializable( + CriticalDependencyWarning, + "webpack/lib/dependencies/CriticalDependencyWarning" +); + +module.exports = CriticalDependencyWarning; /***/ }), -/***/ 48519: +/***/ 76760: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ -const RuntimeGlobals = __webpack_require__(16475); -const AMDDefineDependency = __webpack_require__(96816); -const AMDRequireArrayDependency = __webpack_require__(33516); -const AMDRequireContextDependency = __webpack_require__(96123); -const AMDRequireItemDependency = __webpack_require__(71806); -const ConstDependency = __webpack_require__(76911); -const ContextDependencyHelpers = __webpack_require__(99630); -const DynamicExports = __webpack_require__(32006); -const LocalModuleDependency = __webpack_require__(52805); -const { addLocalModule, getLocalModule } = __webpack_require__(75827); +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); -const isBoundFunctionExpression = expr => { - if (expr.type !== "CallExpression") return false; - if (expr.callee.type !== "MemberExpression") return false; - if (expr.callee.computed) return false; - if (expr.callee.object.type !== "FunctionExpression") return false; - if (expr.callee.property.type !== "Identifier") return false; - if (expr.callee.property.name !== "bind") return false; - return true; -}; +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ -const isUnboundFunctionExpression = expr => { - if (expr.type === "FunctionExpression") return true; - if (expr.type === "ArrowFunctionExpression") return true; - return false; -}; +class CssExportDependency extends NullDependency { + /** + * @param {string} name name + * @param {string} value value + */ + constructor(name, value) { + super(); + this.name = name; + this.value = value; + } -const isCallable = expr => { - if (isUnboundFunctionExpression(expr)) return true; - if (isBoundFunctionExpression(expr)) return true; - return false; -}; + get type() { + return "css :export"; + } -class AMDDefineDependencyParserPlugin { - constructor(options) { - this.options = options; + /** + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names + */ + getExports(moduleGraph) { + const name = this.name; + return { + exports: [ + { + name, + canMangle: true + } + ], + dependencies: undefined + }; } - apply(parser) { - parser.hooks.call - .for("define") - .tap( - "AMDDefineDependencyParserPlugin", - this.processCallDefine.bind(this, parser) - ); + serialize(context) { + const { write } = context; + write(this.name); + write(this.value); + super.serialize(context); } - processArray(parser, expr, param, identifiers, namedModule) { - if (param.isArray()) { - param.items.forEach((param, idx) => { - if ( - param.isString() && - ["require", "module", "exports"].includes(param.string) - ) - identifiers[idx] = param.string; - const result = this.processItem(parser, expr, param, namedModule); - if (result === undefined) { - this.processContext(parser, expr, param); - } - }); - return true; - } else if (param.isConstArray()) { - const deps = []; - param.array.forEach((request, idx) => { - let dep; - let localModule; - if (request === "require") { - identifiers[idx] = request; - dep = "__webpack_require__"; - } else if (["exports", "module"].includes(request)) { - identifiers[idx] = request; - dep = request; - } else if ((localModule = getLocalModule(parser.state, request))) { - localModule.flagUsed(); - dep = new LocalModuleDependency(localModule, undefined, false); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - } else { - dep = this.newRequireItemDependency(request); - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - } - deps.push(dep); - }); - const dep = this.newRequireArrayDependency(deps, param.range); - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.module.addPresentationalDependency(dep); - return true; - } - } - processItem(parser, expr, param, namedModule) { - if (param.isConditional()) { - param.options.forEach(param => { - const result = this.processItem(parser, expr, param); - if (result === undefined) { - this.processContext(parser, expr, param); - } - }); - return true; - } else if (param.isString()) { - let dep, localModule; - if (param.string === "require") { - dep = new ConstDependency("__webpack_require__", param.range, [ - RuntimeGlobals.require - ]); - } else if (param.string === "exports") { - dep = new ConstDependency("exports", param.range, [ - RuntimeGlobals.exports - ]); - } else if (param.string === "module") { - dep = new ConstDependency("module", param.range, [ - RuntimeGlobals.module - ]); - } else if ( - (localModule = getLocalModule(parser.state, param.string, namedModule)) - ) { - localModule.flagUsed(); - dep = new LocalModuleDependency(localModule, param.range, false); - } else { - dep = this.newRequireItemDependency(param.string, param.range); - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; - } - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - } - } - processContext(parser, expr, param) { - const dep = ContextDependencyHelpers.create( - AMDRequireContextDependency, - param.range, - param, - expr, - this.options, - { - category: "amd" - }, - parser - ); - if (!dep) return; - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; + deserialize(context) { + const { read } = context; + this.name = read(); + this.value = read(); + super.deserialize(context); } +} - processCallDefine(parser, expr) { - let array, fn, obj, namedModule; - switch (expr.arguments.length) { - case 1: - if (isCallable(expr.arguments[0])) { - // define(f() {…}) - fn = expr.arguments[0]; - } else if (expr.arguments[0].type === "ObjectExpression") { - // define({…}) - obj = expr.arguments[0]; - } else { - // define(expr) - // unclear if function or object - obj = fn = expr.arguments[0]; - } - break; - case 2: - if (expr.arguments[0].type === "Literal") { - namedModule = expr.arguments[0].value; - // define("…", …) - if (isCallable(expr.arguments[1])) { - // define("…", f() {…}) - fn = expr.arguments[1]; - } else if (expr.arguments[1].type === "ObjectExpression") { - // define("…", {…}) - obj = expr.arguments[1]; - } else { - // define("…", expr) - // unclear if function or object - obj = fn = expr.arguments[1]; - } - } else { - array = expr.arguments[0]; - if (isCallable(expr.arguments[1])) { - // define([…], f() {}) - fn = expr.arguments[1]; - } else if (expr.arguments[1].type === "ObjectExpression") { - // define([…], {…}) - obj = expr.arguments[1]; - } else { - // define([…], expr) - // unclear if function or object - obj = fn = expr.arguments[1]; - } - } - break; - case 3: - // define("…", […], f() {…}) - namedModule = expr.arguments[0].value; - array = expr.arguments[1]; - if (isCallable(expr.arguments[2])) { - // define("…", […], f() {}) - fn = expr.arguments[2]; - } else if (expr.arguments[2].type === "ObjectExpression") { - // define("…", […], {…}) - obj = expr.arguments[2]; - } else { - // define("…", […], expr) - // unclear if function or object - obj = fn = expr.arguments[2]; - } - break; - default: - return; - } - DynamicExports.bailout(parser.state); - let fnParams = null; - let fnParamsOffset = 0; - if (fn) { - if (isUnboundFunctionExpression(fn)) { - fnParams = fn.params; - } else if (isBoundFunctionExpression(fn)) { - fnParams = fn.callee.object.params; - fnParamsOffset = fn.arguments.length - 1; - if (fnParamsOffset < 0) { - fnParamsOffset = 0; - } - } - } - let fnRenames = new Map(); - if (array) { - const identifiers = {}; - const param = parser.evaluateExpression(array); - const result = this.processArray( - parser, - expr, - param, - identifiers, - namedModule - ); - if (!result) return; - if (fnParams) { - fnParams = fnParams.slice(fnParamsOffset).filter((param, idx) => { - if (identifiers[idx]) { - fnRenames.set(param.name, parser.getVariableInfo(identifiers[idx])); - return false; - } - return true; - }); - } - } else { - const identifiers = ["require", "exports", "module"]; - if (fnParams) { - fnParams = fnParams.slice(fnParamsOffset).filter((param, idx) => { - if (identifiers[idx]) { - fnRenames.set(param.name, parser.getVariableInfo(identifiers[idx])); - return false; - } - return true; - }); - } - } - let inTry; - if (fn && isUnboundFunctionExpression(fn)) { - inTry = parser.scope.inTry; - parser.inScope(fnParams, () => { - for (const [name, varInfo] of fnRenames) { - parser.setVariable(name, varInfo); - } - parser.scope.inTry = inTry; - if (fn.body.type === "BlockStatement") { - parser.detectMode(fn.body.body); - const prev = parser.prevStatement; - parser.preWalkStatement(fn.body); - parser.prevStatement = prev; - parser.walkStatement(fn.body); - } else { - parser.walkExpression(fn.body); - } - }); - } else if (fn && isBoundFunctionExpression(fn)) { - inTry = parser.scope.inTry; - parser.inScope( - fn.callee.object.params.filter( - i => !["require", "module", "exports"].includes(i.name) - ), - () => { - for (const [name, varInfo] of fnRenames) { - parser.setVariable(name, varInfo); - } - parser.scope.inTry = inTry; - if (fn.callee.object.body.type === "BlockStatement") { - parser.detectMode(fn.callee.object.body.body); - const prev = parser.prevStatement; - parser.preWalkStatement(fn.callee.object.body); - parser.prevStatement = prev; - parser.walkStatement(fn.callee.object.body); - } else { - parser.walkExpression(fn.callee.object.body); - } - } - ); - if (fn.arguments) { - parser.walkExpressions(fn.arguments); - } - } else if (fn || obj) { - parser.walkExpression(fn || obj); - } - - const dep = this.newDefineDependency( - expr.range, - array ? array.range : null, - fn ? fn.range : null, - obj ? obj.range : null, - namedModule ? namedModule : null - ); - dep.loc = expr.loc; - if (namedModule) { - dep.localModule = addLocalModule(parser.state, namedModule); - } - parser.state.module.addPresentationalDependency(dep); - return true; +CssExportDependency.Template = class CssExportDependencyTemplate extends ( + NullDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply(dependency, source, { cssExports }) { + const dep = /** @type {CssExportDependency} */ (dependency); + cssExports.set(dep.name, dep.value); } +}; - newDefineDependency( - range, - arrayRange, - functionRange, - objectRange, - namedModule - ) { - return new AMDDefineDependency( - range, - arrayRange, - functionRange, - objectRange, - namedModule - ); - } - newRequireArrayDependency(depsArray, range) { - return new AMDRequireArrayDependency(depsArray, range); - } - newRequireItemDependency(request, range) { - return new AMDRequireItemDependency(request, range); - } -} -module.exports = AMDDefineDependencyParserPlugin; +makeSerializable( + CssExportDependency, + "webpack/lib/dependencies/CssExportDependency" +); + +module.exports = CssExportDependency; /***/ }), -/***/ 50067: +/***/ 90542: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ -const RuntimeGlobals = __webpack_require__(16475); -const { - approve, - evaluateToIdentifier, - evaluateToString, - toConstantDependency -} = __webpack_require__(93998); +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); -const AMDDefineDependency = __webpack_require__(96816); -const AMDDefineDependencyParserPlugin = __webpack_require__(48519); -const AMDRequireArrayDependency = __webpack_require__(33516); -const AMDRequireContextDependency = __webpack_require__(96123); -const AMDRequireDependenciesBlockParserPlugin = __webpack_require__(66866); -const AMDRequireDependency = __webpack_require__(43911); -const AMDRequireItemDependency = __webpack_require__(71806); -const { - AMDDefineRuntimeModule, - AMDOptionsRuntimeModule -} = __webpack_require__(45242); -const ConstDependency = __webpack_require__(76911); -const LocalModuleDependency = __webpack_require__(52805); -const UnsupportedDependency = __webpack_require__(51669); +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -/** @typedef {import("../../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */ -/** @typedef {import("../Compiler")} Compiler */ +class CssImportDependency extends ModuleDependency { + /** + * @param {string} request request + * @param {[number, number]} range range of the argument + * @param {string | undefined} supports list of supports conditions + * @param {string | undefined} media list of media conditions + */ + constructor(request, range, supports, media) { + super(request); + this.range = range; + this.supports = supports; + this.media = media; + } + + get type() { + return "css @import"; + } + + get category() { + return "css-import"; + } -class AMDPlugin { /** - * @param {Record} amdOptions the AMD options + * @param {string} context context directory + * @returns {Module} a module */ - constructor(amdOptions) { - this.amdOptions = amdOptions; + createIgnoredModule(context) { + return null; } +} +CssImportDependency.Template = class CssImportDependencyTemplate extends ( + ModuleDependency.Template +) { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply(compiler) { - const amdOptions = this.amdOptions; - compiler.hooks.compilation.tap( - "AMDPlugin", - (compilation, { contextModuleFactory, normalModuleFactory }) => { - compilation.dependencyTemplates.set( - AMDRequireDependency, - new AMDRequireDependency.Template() - ); - - compilation.dependencyFactories.set( - AMDRequireItemDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - AMDRequireItemDependency, - new AMDRequireItemDependency.Template() - ); + apply(dependency, source, templateContext) { + const dep = /** @type {CssImportDependency} */ (dependency); - compilation.dependencyTemplates.set( - AMDRequireArrayDependency, - new AMDRequireArrayDependency.Template() - ); + source.replace(dep.range[0], dep.range[1] - 1, ""); + } +}; - compilation.dependencyFactories.set( - AMDRequireContextDependency, - contextModuleFactory - ); - compilation.dependencyTemplates.set( - AMDRequireContextDependency, - new AMDRequireContextDependency.Template() - ); +makeSerializable( + CssImportDependency, + "webpack/lib/dependencies/CssImportDependency" +); - compilation.dependencyTemplates.set( - AMDDefineDependency, - new AMDDefineDependency.Template() - ); +module.exports = CssImportDependency; - compilation.dependencyTemplates.set( - UnsupportedDependency, - new UnsupportedDependency.Template() - ); - compilation.dependencyTemplates.set( - LocalModuleDependency, - new LocalModuleDependency.Template() - ); +/***/ }), - compilation.hooks.runtimeRequirementInModule - .for(RuntimeGlobals.amdDefine) - .tap("AMDPlugin", (module, set) => { - set.add(RuntimeGlobals.require); - }); +/***/ 92328: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - compilation.hooks.runtimeRequirementInModule - .for(RuntimeGlobals.amdOptions) - .tap("AMDPlugin", (module, set) => { - set.add(RuntimeGlobals.requireScope); - }); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.amdDefine) - .tap("AMDPlugin", (chunk, set) => { - compilation.addRuntimeModule(chunk, new AMDDefineRuntimeModule()); - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.amdOptions) - .tap("AMDPlugin", (chunk, set) => { - compilation.addRuntimeModule( - chunk, - new AMDOptionsRuntimeModule(amdOptions) - ); - }); - const handler = (parser, parserOptions) => { - if (parserOptions.amd !== undefined && !parserOptions.amd) return; +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); - const tapOptionsHooks = (optionExpr, rootName, getMembers) => { - parser.hooks.expression - .for(optionExpr) - .tap( - "AMDPlugin", - toConstantDependency(parser, RuntimeGlobals.amdOptions, [ - RuntimeGlobals.amdOptions - ]) - ); - parser.hooks.evaluateIdentifier - .for(optionExpr) - .tap( - "AMDPlugin", - evaluateToIdentifier(optionExpr, rootName, getMembers, true) - ); - parser.hooks.evaluateTypeof - .for(optionExpr) - .tap("AMDPlugin", evaluateToString("object")); - parser.hooks.typeof - .for(optionExpr) - .tap( - "AMDPlugin", - toConstantDependency(parser, JSON.stringify("object")) - ); - }; +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ - new AMDRequireDependenciesBlockParserPlugin(parserOptions).apply( - parser - ); - new AMDDefineDependencyParserPlugin(parserOptions).apply(parser); +class CssLocalIdentifierDependency extends NullDependency { + /** + * @param {string} name name + * @param {[number, number]} range range + * @param {string=} prefix prefix + */ + constructor(name, range, prefix = "") { + super(); + this.name = name; + this.range = range; + this.prefix = prefix; + } - tapOptionsHooks("define.amd", "define", () => "amd"); - tapOptionsHooks("require.amd", "require", () => ["amd"]); - tapOptionsHooks( - "__webpack_amd_options__", - "__webpack_amd_options__", - () => [] - ); + get type() { + return "css local identifier"; + } - parser.hooks.expression.for("define").tap("AMDPlugin", expr => { - const dep = new ConstDependency( - RuntimeGlobals.amdDefine, - expr.range, - [RuntimeGlobals.amdDefine] - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - parser.hooks.typeof - .for("define") - .tap( - "AMDPlugin", - toConstantDependency(parser, JSON.stringify("function")) - ); - parser.hooks.evaluateTypeof - .for("define") - .tap("AMDPlugin", evaluateToString("function")); - parser.hooks.canRename.for("define").tap("AMDPlugin", approve); - parser.hooks.rename.for("define").tap("AMDPlugin", expr => { - const dep = new ConstDependency( - RuntimeGlobals.amdDefine, - expr.range, - [RuntimeGlobals.amdDefine] - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return false; - }); - parser.hooks.typeof - .for("require") - .tap( - "AMDPlugin", - toConstantDependency(parser, JSON.stringify("function")) - ); - parser.hooks.evaluateTypeof - .for("require") - .tap("AMDPlugin", evaluateToString("function")); - }; + /** + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names + */ + getExports(moduleGraph) { + const name = this.name; + return { + exports: [ + { + name, + canMangle: true + } + ], + dependencies: undefined + }; + } - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("AMDPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("AMDPlugin", handler); - } - ); + serialize(context) { + const { write } = context; + write(this.name); + write(this.range); + write(this.prefix); + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + this.name = read(); + this.range = read(); + this.prefix = read(); + super.deserialize(context); } } -module.exports = AMDPlugin; +const escapeCssIdentifier = (str, omitUnderscore) => { + const escaped = `${str}`.replace( + // cspell:word uffff + /[^a-zA-Z0-9_\u0081-\uffff-]/g, + s => `\\${s}` + ); + return !omitUnderscore && /^(?!--)[0-9-]/.test(escaped) + ? `_${escaped}` + : escaped; +}; + +CssLocalIdentifierDependency.Template = class CssLocalIdentifierDependencyTemplate extends ( + NullDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { module, moduleGraph, chunkGraph, runtime, runtimeTemplate, cssExports } + ) { + const dep = /** @type {CssLocalIdentifierDependency} */ (dependency); + const used = moduleGraph + .getExportInfo(module, dep.name) + .getUsedName(dep.name, runtime); + const moduleId = chunkGraph.getModuleId(module); + const identifier = + dep.prefix + + (runtimeTemplate.outputOptions.uniqueName + ? runtimeTemplate.outputOptions.uniqueName + "-" + : "") + + (used ? moduleId + "-" + used : "-"); + source.replace( + dep.range[0], + dep.range[1] - 1, + escapeCssIdentifier(identifier, dep.prefix) + ); + if (used) cssExports.set(used, identifier); + } +}; + +makeSerializable( + CssLocalIdentifierDependency, + "webpack/lib/dependencies/CssLocalIdentifierDependency" +); + +module.exports = CssLocalIdentifierDependency; /***/ }), -/***/ 33516: +/***/ 29094: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ -const DependencyTemplate = __webpack_require__(5160); +const Dependency = __webpack_require__(54912); const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); +const CssLocalIdentifierDependency = __webpack_require__(92328); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ - -class AMDRequireArrayDependency extends NullDependency { - constructor(depsArray, range) { - super(); +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - this.depsArray = depsArray; - this.range = range; +class CssSelfLocalIdentifierDependency extends CssLocalIdentifierDependency { + /** + * @param {string} name name + * @param {[number, number]} range range + * @param {string=} prefix prefix + * @param {Set=} declaredSet set of declared names (will only be active when in declared set) + */ + constructor(name, range, prefix = "", declaredSet = undefined) { + super(name, range, prefix); + this.declaredSet = declaredSet; } get type() { - return "amd require array"; + return "css self local identifier"; } get category() { - return "amd"; + return "self"; } - serialize(context) { - const { write } = context; + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + return `self`; + } + /** + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names + */ + getExports(moduleGraph) { + if (this.declaredSet && !this.declaredSet.has(this.name)) return; + return super.getExports(moduleGraph); + } - write(this.depsArray); - write(this.range); + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + if (this.declaredSet && !this.declaredSet.has(this.name)) + return Dependency.NO_EXPORTS_REFERENCED; + return [[this.name]]; + } + serialize(context) { + const { write } = context; + write(this.declaredSet); super.serialize(context); } deserialize(context) { const { read } = context; - - this.depsArray = read(); - this.range = read(); - + this.declaredSet = read(); super.deserialize(context); } } -makeSerializable( - AMDRequireArrayDependency, - "webpack/lib/dependencies/AMDRequireArrayDependency" -); - -AMDRequireArrayDependency.Template = class AMDRequireArrayDependencyTemplate extends ( - DependencyTemplate +CssSelfLocalIdentifierDependency.Template = class CssSelfLocalIdentifierDependencyTemplate extends ( + CssLocalIdentifierDependency.Template ) { /** * @param {Dependency} dependency the dependency for which the template should be applied @@ -78886,106 +75736,163 @@ AMDRequireArrayDependency.Template = class AMDRequireArrayDependencyTemplate ext * @returns {void} */ apply(dependency, source, templateContext) { - const dep = /** @type {AMDRequireArrayDependency} */ (dependency); - const content = this.getContent(dep, templateContext); - source.replace(dep.range[0], dep.range[1] - 1, content); - } - - getContent(dep, templateContext) { - const requires = dep.depsArray.map(dependency => { - return this.contentForDependency(dependency, templateContext); - }); - return `[${requires.join(", ")}]`; - } - - contentForDependency( - dep, - { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } - ) { - if (typeof dep === "string") { - return dep; - } - - if (dep.localModule) { - return dep.localModule.variableName(); - } else { - return runtimeTemplate.moduleExports({ - module: moduleGraph.getModule(dep), - chunkGraph, - request: dep.request, - runtimeRequirements - }); - } + const dep = /** @type {CssSelfLocalIdentifierDependency} */ (dependency); + if (dep.declaredSet && !dep.declaredSet.has(dep.name)) return; + super.apply(dependency, source, templateContext); } }; -module.exports = AMDRequireArrayDependency; +makeSerializable( + CssSelfLocalIdentifierDependency, + "webpack/lib/dependencies/CssSelfLocalIdentifierDependency" +); + +module.exports = CssSelfLocalIdentifierDependency; /***/ }), -/***/ 96123: +/***/ 70749: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ const makeSerializable = __webpack_require__(33032); -const ContextDependency = __webpack_require__(88101); +const memoize = __webpack_require__(78676); +const ModuleDependency = __webpack_require__(80321); -class AMDRequireContextDependency extends ContextDependency { - constructor(options, range, valueRange) { - super(options); +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + +const getRawDataUrlModule = memoize(() => __webpack_require__(19684)); +class CssUrlDependency extends ModuleDependency { + /** + * @param {string} request request + * @param {[number, number]} range range of the argument + * @param {string} cssFunctionKind kind of css function, e. g. url(), image() + */ + constructor(request, range, cssFunctionKind) { + super(request); this.range = range; - this.valueRange = valueRange; + this.cssFunctionKind = cssFunctionKind; } get type() { - return "amd require context"; + return "css url()"; } get category() { - return "amd"; + return "url"; + } + + /** + * @param {string} context context directory + * @returns {Module} a module + */ + createIgnoredModule(context) { + const RawDataUrlModule = getRawDataUrlModule(); + return new RawDataUrlModule("data:,", `ignored-asset`, `(ignored asset)`); } serialize(context) { const { write } = context; - - write(this.range); - write(this.valueRange); - + write(this.cssFunctionKind); super.serialize(context); } deserialize(context) { const { read } = context; - - this.range = read(); - this.valueRange = read(); - + this.cssFunctionKind = read(); super.deserialize(context); } } -makeSerializable( - AMDRequireContextDependency, - "webpack/lib/dependencies/AMDRequireContextDependency" -); +const cssEscapeString = str => { + let countWhiteOrBracket = 0; + let countQuotation = 0; + let countApostrophe = 0; + for (let i = 0; i < str.length; i++) { + const cc = str.charCodeAt(i); + switch (cc) { + case 9: // tab + case 10: // nl + case 32: // space + case 40: // ( + case 41: // ) + countWhiteOrBracket++; + break; + case 34: + countQuotation++; + break; + case 39: + countApostrophe++; + break; + } + } + if (countWhiteOrBracket < 2) { + return str.replace(/[\n\t ()'"\\]/g, m => `\\${m}`); + } else if (countQuotation <= countApostrophe) { + return `"${str.replace(/[\n"\\]/g, m => `\\${m}`)}"`; + } else { + return `'${str.replace(/[\n'\\]/g, m => `\\${m}`)}'`; + } +}; -AMDRequireContextDependency.Template = __webpack_require__(75815); +CssUrlDependency.Template = class CssUrlDependencyTemplate extends ( + ModuleDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { runtime, moduleGraph, runtimeTemplate, codeGenerationResults } + ) { + const dep = /** @type {CssUrlDependency} */ (dependency); -module.exports = AMDRequireContextDependency; + source.replace( + dep.range[0], + dep.range[1] - 1, + `${dep.cssFunctionKind}(${cssEscapeString( + runtimeTemplate.assetUrl({ + publicPath: "", + runtime, + module: moduleGraph.getModule(dep), + codeGenerationResults + }) + )})` + ); + } +}; + +makeSerializable(CssUrlDependency, "webpack/lib/dependencies/CssUrlDependency"); + +module.exports = CssUrlDependency; /***/ }), -/***/ 76932: +/***/ 22914: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -78996,26 +75903,34 @@ module.exports = AMDRequireContextDependency; -const AsyncDependenciesBlock = __webpack_require__(47736); const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); -class AMDRequireDependenciesBlock extends AsyncDependenciesBlock { - constructor(loc, request) { - super(null, loc, request); +class DelegatedSourceDependency extends ModuleDependency { + constructor(request) { + super(request); + } + + get type() { + return "delegated source"; + } + + get category() { + return "esm"; } } makeSerializable( - AMDRequireDependenciesBlock, - "webpack/lib/dependencies/AMDRequireDependenciesBlock" + DelegatedSourceDependency, + "webpack/lib/dependencies/DelegatedSourceDependency" ); -module.exports = AMDRequireDependenciesBlock; +module.exports = DelegatedSourceDependency; /***/ }), -/***/ 66866: +/***/ 95666: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -79026,283 +75941,166 @@ module.exports = AMDRequireDependenciesBlock; -const RuntimeGlobals = __webpack_require__(16475); -const UnsupportedFeatureWarning = __webpack_require__(42495); -const AMDRequireArrayDependency = __webpack_require__(33516); -const AMDRequireContextDependency = __webpack_require__(96123); -const AMDRequireDependenciesBlock = __webpack_require__(76932); -const AMDRequireDependency = __webpack_require__(43911); -const AMDRequireItemDependency = __webpack_require__(71806); -const ConstDependency = __webpack_require__(76911); -const ContextDependencyHelpers = __webpack_require__(99630); -const LocalModuleDependency = __webpack_require__(52805); -const { getLocalModule } = __webpack_require__(75827); -const UnsupportedDependency = __webpack_require__(51669); -const getFunctionExpression = __webpack_require__(50396); +const Dependency = __webpack_require__(54912); +const makeSerializable = __webpack_require__(33032); -class AMDRequireDependenciesBlockParserPlugin { - constructor(options) { - this.options = options; +class DllEntryDependency extends Dependency { + constructor(dependencies, name) { + super(); + + this.dependencies = dependencies; + this.name = name; } - processFunctionArgument(parser, expression) { - let bindThis = true; - const fnData = getFunctionExpression(expression); - if (fnData) { - parser.inScope( - fnData.fn.params.filter(i => { - return !["require", "module", "exports"].includes(i.name); - }), - () => { - if (fnData.fn.body.type === "BlockStatement") { - parser.walkStatement(fnData.fn.body); - } else { - parser.walkExpression(fnData.fn.body); - } - } - ); - parser.walkExpressions(fnData.expressions); - if (fnData.needThis === false) { - bindThis = false; - } - } else { - parser.walkExpression(expression); - } - return bindThis; + get type() { + return "dll entry"; } - apply(parser) { - parser.hooks.call - .for("require") - .tap( - "AMDRequireDependenciesBlockParserPlugin", - this.processCallRequire.bind(this, parser) - ); + serialize(context) { + const { write } = context; + + write(this.dependencies); + write(this.name); + + super.serialize(context); } - processArray(parser, expr, param) { - if (param.isArray()) { - for (const p of param.items) { - const result = this.processItem(parser, expr, p); - if (result === undefined) { - this.processContext(parser, expr, p); - } - } - return true; - } else if (param.isConstArray()) { - const deps = []; - for (const request of param.array) { - let dep, localModule; - if (request === "require") { - dep = "__webpack_require__"; - } else if (["exports", "module"].includes(request)) { - dep = request; - } else if ((localModule = getLocalModule(parser.state, request))) { - localModule.flagUsed(); - dep = new LocalModuleDependency(localModule, undefined, false); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - } else { - dep = this.newRequireItemDependency(request); - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - } - deps.push(dep); - } - const dep = this.newRequireArrayDependency(deps, param.range); - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.module.addPresentationalDependency(dep); - return true; - } - } - processItem(parser, expr, param) { - if (param.isConditional()) { - for (const p of param.options) { - const result = this.processItem(parser, expr, p); - if (result === undefined) { - this.processContext(parser, expr, p); - } - } - return true; - } else if (param.isString()) { - let dep, localModule; - if (param.string === "require") { - dep = new ConstDependency("__webpack_require__", param.string, [ - RuntimeGlobals.require - ]); - } else if (param.string === "module") { - dep = new ConstDependency( - parser.state.module.buildInfo.moduleArgument, - param.range, - [RuntimeGlobals.module] - ); - } else if (param.string === "exports") { - dep = new ConstDependency( - parser.state.module.buildInfo.exportsArgument, - param.range, - [RuntimeGlobals.exports] - ); - } else if ((localModule = getLocalModule(parser.state, param.string))) { - localModule.flagUsed(); - dep = new LocalModuleDependency(localModule, param.range, false); - } else { - dep = this.newRequireItemDependency(param.string, param.range); - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; - } - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - } - } - processContext(parser, expr, param) { - const dep = ContextDependencyHelpers.create( - AMDRequireContextDependency, - param.range, - param, - expr, - this.options, - { - category: "amd" - }, - parser - ); - if (!dep) return; - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; + deserialize(context) { + const { read } = context; + + this.dependencies = read(); + this.name = read(); + + super.deserialize(context); } +} - processArrayForRequestString(param) { - if (param.isArray()) { - const result = param.items.map(item => - this.processItemForRequestString(item) - ); - if (result.every(Boolean)) return result.join(" "); - } else if (param.isConstArray()) { - return param.array.join(" "); - } - } +makeSerializable( + DllEntryDependency, + "webpack/lib/dependencies/DllEntryDependency" +); - processItemForRequestString(param) { - if (param.isConditional()) { - const result = param.options.map(item => - this.processItemForRequestString(item) - ); - if (result.every(Boolean)) return result.join("|"); - } else if (param.isString()) { - return param.string; - } - } +module.exports = DllEntryDependency; - processCallRequire(parser, expr) { - let param; - let depBlock; - let dep; - let result; - const old = parser.state.current; +/***/ }), - if (expr.arguments.length >= 1) { - param = parser.evaluateExpression(expr.arguments[0]); - depBlock = this.newRequireDependenciesBlock( - expr.loc, - this.processArrayForRequestString(param) - ); - dep = this.newRequireDependency( - expr.range, - param.range, - expr.arguments.length > 1 ? expr.arguments[1].range : null, - expr.arguments.length > 2 ? expr.arguments[2].range : null - ); - dep.loc = expr.loc; - depBlock.addDependency(dep); +/***/ 32006: +/***/ (function(__unused_webpack_module, exports) { - parser.state.current = depBlock; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (expr.arguments.length === 1) { - parser.inScope([], () => { - result = this.processArray(parser, expr, param); - }); - parser.state.current = old; - if (!result) return; - parser.state.current.addBlock(depBlock); - return true; - } - if (expr.arguments.length === 2 || expr.arguments.length === 3) { - try { - parser.inScope([], () => { - result = this.processArray(parser, expr, param); - }); - if (!result) { - const dep = new UnsupportedDependency("unsupported", expr.range); - old.addPresentationalDependency(dep); - if (parser.state.module) { - parser.state.module.addError( - new UnsupportedFeatureWarning( - "Cannot statically analyse 'require(…, …)' in line " + - expr.loc.start.line, - expr.loc - ) - ); - } - depBlock = null; - return true; - } - dep.functionBindThis = this.processFunctionArgument( - parser, - expr.arguments[1] - ); - if (expr.arguments.length === 3) { - dep.errorCallbackBindThis = this.processFunctionArgument( - parser, - expr.arguments[2] - ); - } - } finally { - parser.state.current = old; - if (depBlock) parser.state.current.addBlock(depBlock); - } - return true; - } + +/** @typedef {import("../Parser").ParserState} ParserState */ + +/** @type {WeakMap} */ +const parserStateExportsState = new WeakMap(); + +/** + * @param {ParserState} parserState parser state + * @returns {void} + */ +exports.bailout = parserState => { + const value = parserStateExportsState.get(parserState); + parserStateExportsState.set(parserState, false); + if (value === true) { + parserState.module.buildMeta.exportsType = undefined; + parserState.module.buildMeta.defaultObject = false; } +}; - newRequireDependenciesBlock(loc, request) { - return new AMDRequireDependenciesBlock(loc, request); +/** + * @param {ParserState} parserState parser state + * @returns {void} + */ +exports.enable = parserState => { + const value = parserStateExportsState.get(parserState); + if (value === false) return; + parserStateExportsState.set(parserState, true); + if (value !== true) { + parserState.module.buildMeta.exportsType = "default"; + parserState.module.buildMeta.defaultObject = "redirect"; } - newRequireDependency( - outerRange, - arrayRange, - functionRange, - errorCallbackRange - ) { - return new AMDRequireDependency( - outerRange, - arrayRange, - functionRange, - errorCallbackRange - ); +}; + +/** + * @param {ParserState} parserState parser state + * @returns {void} + */ +exports.setFlagged = parserState => { + const value = parserStateExportsState.get(parserState); + if (value !== true) return; + const buildMeta = parserState.module.buildMeta; + if (buildMeta.exportsType === "dynamic") return; + buildMeta.exportsType = "flagged"; +}; + +/** + * @param {ParserState} parserState parser state + * @returns {void} + */ +exports.setDynamic = parserState => { + const value = parserStateExportsState.get(parserState); + if (value !== true) return; + parserState.module.buildMeta.exportsType = "dynamic"; +}; + +/** + * @param {ParserState} parserState parser state + * @returns {boolean} true, when enabled + */ +exports.isEnabled = parserState => { + const value = parserStateExportsState.get(parserState); + return value === true; +}; + + +/***/ }), + +/***/ 3979: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); + +class EntryDependency extends ModuleDependency { + /** + * @param {string} request request path for entry + */ + constructor(request) { + super(request); } - newRequireItemDependency(request, range) { - return new AMDRequireItemDependency(request, range); + + get type() { + return "entry"; } - newRequireArrayDependency(depsArray, range) { - return new AMDRequireArrayDependency(depsArray, range); + + get category() { + return "esm"; } } -module.exports = AMDRequireDependenciesBlockParserPlugin; + +makeSerializable(EntryDependency, "webpack/lib/dependencies/EntryDependency"); + +module.exports = EntryDependency; /***/ }), -/***/ 43911: +/***/ 78988: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -79313,64 +76111,115 @@ module.exports = AMDRequireDependenciesBlockParserPlugin; -const RuntimeGlobals = __webpack_require__(16475); +const { UsageState } = __webpack_require__(63686); const makeSerializable = __webpack_require__(33032); const NullDependency = __webpack_require__(31830); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ /** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -class AMDRequireDependency extends NullDependency { - constructor(outerRange, arrayRange, functionRange, errorCallbackRange) { - super(); - - this.outerRange = outerRange; - this.arrayRange = arrayRange; - this.functionRange = functionRange; - this.errorCallbackRange = errorCallbackRange; - this.functionBindThis = false; - this.errorCallbackBindThis = false; +/** + * @param {ModuleGraph} moduleGraph the module graph + * @param {Module} module the module + * @param {string | null} exportName name of the export if any + * @param {string | null} property name of the requested property + * @param {RuntimeSpec} runtime for which runtime + * @returns {any} value of the property + */ +const getProperty = (moduleGraph, module, exportName, property, runtime) => { + if (!exportName) { + switch (property) { + case "usedExports": { + const usedExports = moduleGraph + .getExportsInfo(module) + .getUsedExports(runtime); + if ( + typeof usedExports === "boolean" || + usedExports === undefined || + usedExports === null + ) { + return usedExports; + } + return Array.from(usedExports).sort(); + } + } + } + switch (property) { + case "canMangle": { + const exportsInfo = moduleGraph.getExportsInfo(module); + const exportInfo = exportsInfo.getExportInfo(exportName); + if (exportInfo) return exportInfo.canMangle; + return exportsInfo.otherExportsInfo.canMangle; + } + case "used": + return ( + moduleGraph.getExportsInfo(module).getUsed(exportName, runtime) !== + UsageState.Unused + ); + case "useInfo": { + const state = moduleGraph + .getExportsInfo(module) + .getUsed(exportName, runtime); + switch (state) { + case UsageState.Used: + case UsageState.OnlyPropertiesUsed: + return true; + case UsageState.Unused: + return false; + case UsageState.NoInfo: + return undefined; + case UsageState.Unknown: + return null; + default: + throw new Error(`Unexpected UsageState ${state}`); + } + } + case "provideInfo": + return moduleGraph.getExportsInfo(module).isExportProvided(exportName); } + return undefined; +}; - get category() { - return "amd"; +class ExportsInfoDependency extends NullDependency { + constructor(range, exportName, property) { + super(); + this.range = range; + this.exportName = exportName; + this.property = property; } serialize(context) { const { write } = context; - - write(this.outerRange); - write(this.arrayRange); - write(this.functionRange); - write(this.errorCallbackRange); - write(this.functionBindThis); - write(this.errorCallbackBindThis); - + write(this.range); + write(this.exportName); + write(this.property); super.serialize(context); } - deserialize(context) { - const { read } = context; - - this.outerRange = read(); - this.arrayRange = read(); - this.functionRange = read(); - this.errorCallbackRange = read(); - this.functionBindThis = read(); - this.errorCallbackBindThis = read(); - - super.deserialize(context); + static deserialize(context) { + const obj = new ExportsInfoDependency( + context.read(), + context.read(), + context.read() + ); + obj.deserialize(context); + return obj; } } makeSerializable( - AMDRequireDependency, - "webpack/lib/dependencies/AMDRequireDependency" + ExportsInfoDependency, + "webpack/lib/dependencies/ExportsInfoDependency" ); -AMDRequireDependency.Template = class AMDRequireDependencyTemplate extends ( +ExportsInfoDependency.Template = class ExportsInfoDependencyTemplate extends ( NullDependency.Template ) { /** @@ -79379,112 +76228,30 @@ AMDRequireDependency.Template = class AMDRequireDependencyTemplate extends ( * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply( - dependency, - source, - { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } - ) { - const dep = /** @type {AMDRequireDependency} */ (dependency); - const depBlock = /** @type {AsyncDependenciesBlock} */ ( - moduleGraph.getParentBlock(dep) - ); - const promise = runtimeTemplate.blockPromise({ - chunkGraph, - block: depBlock, - message: "AMD require", - runtimeRequirements - }); - - // has array range but no function range - if (dep.arrayRange && !dep.functionRange) { - const startBlock = `${promise}.then(function() {`; - const endBlock = `;})['catch'](${RuntimeGlobals.uncaughtErrorHandler})`; - runtimeRequirements.add(RuntimeGlobals.uncaughtErrorHandler); - - source.replace(dep.outerRange[0], dep.arrayRange[0] - 1, startBlock); - - source.replace(dep.arrayRange[1], dep.outerRange[1] - 1, endBlock); - - return; - } - - // has function range but no array range - if (dep.functionRange && !dep.arrayRange) { - const startBlock = `${promise}.then((`; - const endBlock = `).bind(exports, __webpack_require__, exports, module))['catch'](${RuntimeGlobals.uncaughtErrorHandler})`; - runtimeRequirements.add(RuntimeGlobals.uncaughtErrorHandler); - - source.replace(dep.outerRange[0], dep.functionRange[0] - 1, startBlock); - - source.replace(dep.functionRange[1], dep.outerRange[1] - 1, endBlock); - - return; - } - - // has array range, function range, and errorCallbackRange - if (dep.arrayRange && dep.functionRange && dep.errorCallbackRange) { - const startBlock = `${promise}.then(function() { `; - const errorRangeBlock = `}${ - dep.functionBindThis ? ".bind(this)" : "" - })['catch'](`; - const endBlock = `${dep.errorCallbackBindThis ? ".bind(this)" : ""})`; - - source.replace(dep.outerRange[0], dep.arrayRange[0] - 1, startBlock); - - source.insert(dep.arrayRange[0], "var __WEBPACK_AMD_REQUIRE_ARRAY__ = "); - - source.replace(dep.arrayRange[1], dep.functionRange[0] - 1, "; ("); - - source.insert( - dep.functionRange[1], - ").apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__);" - ); - - source.replace( - dep.functionRange[1], - dep.errorCallbackRange[0] - 1, - errorRangeBlock - ); - - source.replace( - dep.errorCallbackRange[1], - dep.outerRange[1] - 1, - endBlock - ); - - return; - } - - // has array range, function range, but no errorCallbackRange - if (dep.arrayRange && dep.functionRange) { - const startBlock = `${promise}.then(function() { `; - const endBlock = `}${ - dep.functionBindThis ? ".bind(this)" : "" - })['catch'](${RuntimeGlobals.uncaughtErrorHandler})`; - runtimeRequirements.add(RuntimeGlobals.uncaughtErrorHandler); - - source.replace(dep.outerRange[0], dep.arrayRange[0] - 1, startBlock); - - source.insert(dep.arrayRange[0], "var __WEBPACK_AMD_REQUIRE_ARRAY__ = "); - - source.replace(dep.arrayRange[1], dep.functionRange[0] - 1, "; ("); - - source.insert( - dep.functionRange[1], - ").apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__);" - ); + apply(dependency, source, { module, moduleGraph, runtime }) { + const dep = /** @type {ExportsInfoDependency} */ (dependency); - source.replace(dep.functionRange[1], dep.outerRange[1] - 1, endBlock); - } + const value = getProperty( + moduleGraph, + module, + dep.exportName, + dep.property, + runtime + ); + source.replace( + dep.range[0], + dep.range[1] - 1, + value === undefined ? "undefined" : JSON.stringify(value) + ); } }; -module.exports = AMDRequireDependency; +module.exports = ExportsInfoDependency; /***/ }), -/***/ 71806: +/***/ 23624: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -79495,170 +76262,215 @@ module.exports = AMDRequireDependency; +const Template = __webpack_require__(1626); const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); -const ModuleDependencyTemplateAsRequireId = __webpack_require__(36873); +const HarmonyImportDependency = __webpack_require__(57154); +const NullDependency = __webpack_require__(31830); -class AMDRequireItemDependency extends ModuleDependency { - constructor(request, range) { - super(request); +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("./HarmonyAcceptImportDependency")} HarmonyAcceptImportDependency */ +class HarmonyAcceptDependency extends NullDependency { + /** + * @param {[number, number]} range expression range + * @param {HarmonyAcceptImportDependency[]} dependencies import dependencies + * @param {boolean} hasCallback true, if the range wraps an existing callback + */ + constructor(range, dependencies, hasCallback) { + super(); this.range = range; + this.dependencies = dependencies; + this.hasCallback = hasCallback; } get type() { - return "amd require"; + return "accepted harmony modules"; } - get category() { - return "amd"; + serialize(context) { + const { write } = context; + write(this.range); + write(this.dependencies); + write(this.hasCallback); + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + this.range = read(); + this.dependencies = read(); + this.hasCallback = read(); + super.deserialize(context); } } makeSerializable( - AMDRequireItemDependency, - "webpack/lib/dependencies/AMDRequireItemDependency" + HarmonyAcceptDependency, + "webpack/lib/dependencies/HarmonyAcceptDependency" ); -AMDRequireItemDependency.Template = ModuleDependencyTemplateAsRequireId; +HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate extends ( + NullDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply(dependency, source, templateContext) { + const dep = /** @type {HarmonyAcceptDependency} */ (dependency); + const { + module, + runtime, + runtimeRequirements, + runtimeTemplate, + moduleGraph, + chunkGraph + } = templateContext; + const content = dep.dependencies + .map(dependency => { + const referencedModule = moduleGraph.getModule(dependency); + return { + dependency, + runtimeCondition: referencedModule + ? HarmonyImportDependency.Template.getImportEmittedRuntime( + module, + referencedModule + ) + : false + }; + }) + .filter(({ runtimeCondition }) => runtimeCondition !== false) + .map(({ dependency, runtimeCondition }) => { + const condition = runtimeTemplate.runtimeConditionExpression({ + chunkGraph, + runtime, + runtimeCondition, + runtimeRequirements + }); + const s = dependency.getImportStatement(true, templateContext); + const code = s[0] + s[1]; + if (condition !== "true") { + return `if (${condition}) {\n${Template.indent(code)}\n}\n`; + } + return code; + }) + .join(""); -module.exports = AMDRequireItemDependency; + if (dep.hasCallback) { + if (runtimeTemplate.supportsArrowFunction()) { + source.insert( + dep.range[0], + `__WEBPACK_OUTDATED_DEPENDENCIES__ => { ${content}(` + ); + source.insert(dep.range[1], ")(__WEBPACK_OUTDATED_DEPENDENCIES__); }"); + } else { + source.insert( + dep.range[0], + `function(__WEBPACK_OUTDATED_DEPENDENCIES__) { ${content}(` + ); + source.insert( + dep.range[1], + ")(__WEBPACK_OUTDATED_DEPENDENCIES__); }.bind(this)" + ); + } + return; + } + + const arrow = runtimeTemplate.supportsArrowFunction(); + source.insert( + dep.range[1] - 0.5, + `, ${arrow ? "() =>" : "function()"} { ${content} }` + ); + } +}; + +module.exports = HarmonyAcceptDependency; /***/ }), -/***/ 45242: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 99843: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); +const makeSerializable = __webpack_require__(33032); +const HarmonyImportDependency = __webpack_require__(57154); -class AMDDefineRuntimeModule extends RuntimeModule { - constructor() { - super("amd define"); +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + +class HarmonyAcceptImportDependency extends HarmonyImportDependency { + constructor(request) { + super(request, NaN); + this.weak = true; } - /** - * @returns {string} runtime code - */ - generate() { - return Template.asString([ - `${RuntimeGlobals.amdDefine} = function () {`, - Template.indent("throw new Error('define cannot be used indirect');"), - "};" - ]); + get type() { + return "harmony accept"; } } -class AMDOptionsRuntimeModule extends RuntimeModule { - /** - * @param {Record} options the AMD options - */ - constructor(options) { - super("amd options"); - this.options = options; - } +makeSerializable( + HarmonyAcceptImportDependency, + "webpack/lib/dependencies/HarmonyAcceptImportDependency" +); - /** - * @returns {string} runtime code - */ - generate() { - return Template.asString([ - `${RuntimeGlobals.amdOptions} = ${JSON.stringify(this.options)};` - ]); - } -} +HarmonyAcceptImportDependency.Template = class HarmonyAcceptImportDependencyTemplate extends ( + HarmonyImportDependency.Template +) {}; -exports.AMDDefineRuntimeModule = AMDDefineRuntimeModule; -exports.AMDOptionsRuntimeModule = AMDOptionsRuntimeModule; +module.exports = HarmonyAcceptImportDependency; /***/ }), -/***/ 57403: +/***/ 72906: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent + Author Tobias Koppers @sokra */ -const DependencyTemplate = __webpack_require__(5160); +const { UsageState } = __webpack_require__(63686); const InitFragment = __webpack_require__(55870); +const RuntimeGlobals = __webpack_require__(16475); const makeSerializable = __webpack_require__(33032); const NullDependency = __webpack_require__(31830); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ /** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("../util/Hash")} Hash */ - -class CachedConstDependency extends NullDependency { - constructor(expression, range, identifier) { - super(); - - this.expression = expression; - this.range = range; - this.identifier = identifier; - this._hashUpdate = undefined; - } - - /** - * Update the hash - * @param {Hash} hash hash to be updated - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - if (this._hashUpdate === undefined) - this._hashUpdate = "" + this.identifier + this.range + this.expression; - hash.update(this._hashUpdate); - } - - serialize(context) { - const { write } = context; - - write(this.expression); - write(this.range); - write(this.identifier); - - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - - this.expression = read(); - this.range = read(); - this.identifier = read(); +/** @typedef {import("../Module")} Module */ - super.deserialize(context); +class HarmonyCompatibilityDependency extends NullDependency { + get type() { + return "harmony export header"; } } makeSerializable( - CachedConstDependency, - "webpack/lib/dependencies/CachedConstDependency" + HarmonyCompatibilityDependency, + "webpack/lib/dependencies/HarmonyCompatibilityDependency" ); -CachedConstDependency.Template = class CachedConstDependencyTemplate extends ( - DependencyTemplate +HarmonyCompatibilityDependency.Template = class HarmonyExportDependencyTemplate extends ( + NullDependency.Template ) { /** * @param {Dependency} dependency the dependency for which the template should be applied @@ -79669,36 +76481,62 @@ CachedConstDependency.Template = class CachedConstDependencyTemplate extends ( apply( dependency, source, - { runtimeTemplate, dependencyTemplates, initFragments } + { + module, + runtimeTemplate, + moduleGraph, + initFragments, + runtimeRequirements, + runtime, + concatenationScope + } ) { - const dep = /** @type {CachedConstDependency} */ (dependency); - - initFragments.push( - new InitFragment( - `var ${dep.identifier} = ${dep.expression};\n`, - InitFragment.STAGE_CONSTANTS, - 0, - `const ${dep.identifier}` - ) - ); - - if (typeof dep.range === "number") { - source.insert(dep.range, dep.identifier); - - return; + if (concatenationScope) return; + const exportsInfo = moduleGraph.getExportsInfo(module); + if ( + exportsInfo.getReadOnlyExportInfo("__esModule").getUsed(runtime) !== + UsageState.Unused + ) { + const content = runtimeTemplate.defineEsModuleFlagStatement({ + exportsArgument: module.exportsArgument, + runtimeRequirements + }); + initFragments.push( + new InitFragment( + content, + InitFragment.STAGE_HARMONY_EXPORTS, + 0, + "harmony compatibility" + ) + ); + } + if (moduleGraph.isAsync(module)) { + runtimeRequirements.add(RuntimeGlobals.module); + runtimeRequirements.add(RuntimeGlobals.asyncModule); + initFragments.push( + new InitFragment( + runtimeTemplate.supportsArrowFunction() + ? `${RuntimeGlobals.asyncModule}(${module.moduleArgument}, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n` + : `${RuntimeGlobals.asyncModule}(${module.moduleArgument}, async function (__webpack_handle_async_dependencies__, __webpack_async_result__) { try {\n`, + InitFragment.STAGE_ASYNC_BOUNDARY, + 0, + undefined, + `\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } }${ + module.buildMeta.async ? ", 1" : "" + });` + ) + ); } - - source.replace(dep.range[0], dep.range[1] - 1, dep.identifier); } }; -module.exports = CachedConstDependency; +module.exports = HarmonyCompatibilityDependency; /***/ }), -/***/ 59643: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 17223: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -79708,53 +76546,101 @@ module.exports = CachedConstDependency; -const RuntimeGlobals = __webpack_require__(16475); +const DynamicExports = __webpack_require__(32006); +const HarmonyCompatibilityDependency = __webpack_require__(72906); +const HarmonyExports = __webpack_require__(39211); -exports.handleDependencyBase = (depBase, module, runtimeRequirements) => { - let base = undefined; - let type; - switch (depBase) { - case "exports": - runtimeRequirements.add(RuntimeGlobals.exports); - base = module.exportsArgument; - type = "expression"; - break; - case "module.exports": - runtimeRequirements.add(RuntimeGlobals.module); - base = `${module.moduleArgument}.exports`; - type = "expression"; - break; - case "this": - runtimeRequirements.add(RuntimeGlobals.thisAsExports); - base = "this"; - type = "expression"; - break; - case "Object.defineProperty(exports)": - runtimeRequirements.add(RuntimeGlobals.exports); - base = module.exportsArgument; - type = "Object.defineProperty"; - break; - case "Object.defineProperty(module.exports)": - runtimeRequirements.add(RuntimeGlobals.module); - base = `${module.moduleArgument}.exports`; - type = "Object.defineProperty"; - break; - case "Object.defineProperty(this)": - runtimeRequirements.add(RuntimeGlobals.thisAsExports); - base = "this"; - type = "Object.defineProperty"; - break; - default: - throw new Error(`Unsupported base ${depBase}`); +module.exports = class HarmonyDetectionParserPlugin { + constructor(options) { + const { topLevelAwait = false } = options || {}; + this.topLevelAwait = topLevelAwait; } - return [type, base]; + apply(parser) { + parser.hooks.program.tap("HarmonyDetectionParserPlugin", ast => { + const isStrictHarmony = parser.state.module.type === "javascript/esm"; + const isHarmony = + isStrictHarmony || + ast.body.some( + statement => + statement.type === "ImportDeclaration" || + statement.type === "ExportDefaultDeclaration" || + statement.type === "ExportNamedDeclaration" || + statement.type === "ExportAllDeclaration" + ); + if (isHarmony) { + const module = parser.state.module; + const compatDep = new HarmonyCompatibilityDependency(); + compatDep.loc = { + start: { + line: -1, + column: 0 + }, + end: { + line: -1, + column: 0 + }, + index: -3 + }; + module.addPresentationalDependency(compatDep); + DynamicExports.bailout(parser.state); + HarmonyExports.enable(parser.state, isStrictHarmony); + parser.scope.isStrict = true; + } + }); + + parser.hooks.topLevelAwait.tap("HarmonyDetectionParserPlugin", () => { + const module = parser.state.module; + if (!this.topLevelAwait) { + throw new Error( + "The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it)" + ); + } + if (!HarmonyExports.isEnabled(parser.state)) { + throw new Error( + "Top-level-await is only supported in EcmaScript Modules" + ); + } + module.buildMeta.async = true; + }); + + const skipInHarmony = () => { + if (HarmonyExports.isEnabled(parser.state)) { + return true; + } + }; + + const nullInHarmony = () => { + if (HarmonyExports.isEnabled(parser.state)) { + return null; + } + }; + + const nonHarmonyIdentifiers = ["define", "exports"]; + for (const identifier of nonHarmonyIdentifiers) { + parser.hooks.evaluateTypeof + .for(identifier) + .tap("HarmonyDetectionParserPlugin", nullInHarmony); + parser.hooks.typeof + .for(identifier) + .tap("HarmonyDetectionParserPlugin", skipInHarmony); + parser.hooks.evaluate + .for(identifier) + .tap("HarmonyDetectionParserPlugin", nullInHarmony); + parser.hooks.expression + .for(identifier) + .tap("HarmonyDetectionParserPlugin", skipInHarmony); + parser.hooks.call + .for(identifier) + .tap("HarmonyDetectionParserPlugin", skipInHarmony); + } + } }; /***/ }), -/***/ 62892: +/***/ 93466: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -79765,378 +76651,189 @@ exports.handleDependencyBase = (depBase, module, runtimeRequirements) => { -const Dependency = __webpack_require__(54912); -const { UsageState } = __webpack_require__(63686); -const Template = __webpack_require__(39722); -const { equals } = __webpack_require__(84953); -const makeSerializable = __webpack_require__(33032); -const propertyAccess = __webpack_require__(54190); -const { handleDependencyBase } = __webpack_require__(59643); -const ModuleDependency = __webpack_require__(80321); -const processExportInfo = __webpack_require__(55207); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - -const idsSymbol = Symbol("CommonJsExportRequireDependency.ids"); - -const EMPTY_OBJECT = {}; - -class CommonJsExportRequireDependency extends ModuleDependency { - constructor(range, valueRange, base, names, request, ids, resultUsed) { - super(request); - this.range = range; - this.valueRange = valueRange; - this.base = base; - this.names = names; - this.ids = ids; - this.resultUsed = resultUsed; - this.asiSafe = undefined; - } - - get type() { - return "cjs export require"; - } +const InnerGraph = __webpack_require__(38988); +const ConstDependency = __webpack_require__(76911); +const HarmonyExportExpressionDependency = __webpack_require__(51340); +const HarmonyExportHeaderDependency = __webpack_require__(38873); +const HarmonyExportImportedSpecifierDependency = __webpack_require__(67157); +const HarmonyExportSpecifierDependency = __webpack_require__(48567); +const { ExportPresenceModes } = __webpack_require__(57154); +const { + harmonySpecifierTag, + getAssertions +} = __webpack_require__(20862); +const HarmonyImportSideEffectDependency = __webpack_require__(73132); - /** - * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module - */ - couldAffectReferencingModule() { - return Dependency.TRANSITIVE; - } +const { HarmonyStarExportsList } = HarmonyExportImportedSpecifierDependency; - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {string[]} the imported id - */ - getIds(moduleGraph) { - return moduleGraph.getMeta(this)[idsSymbol] || this.ids; +module.exports = class HarmonyExportDependencyParserPlugin { + constructor(options) { + this.exportPresenceMode = + options.reexportExportsPresence !== undefined + ? ExportPresenceModes.fromUserOption(options.reexportExportsPresence) + : options.exportsPresence !== undefined + ? ExportPresenceModes.fromUserOption(options.exportsPresence) + : options.strictExportPresence + ? ExportPresenceModes.ERROR + : ExportPresenceModes.AUTO; } - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {string[]} ids the imported ids - * @returns {void} - */ - setIds(moduleGraph, ids) { - moduleGraph.getMeta(this)[idsSymbol] = ids; - } - - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - const ids = this.getIds(moduleGraph); - const getFullResult = () => { - if (ids.length === 0) { - return Dependency.EXPORTS_OBJECT_REFERENCED; - } else { - return [ - { - name: ids, - canMangle: false - } - ]; + apply(parser) { + const { exportPresenceMode } = this; + parser.hooks.export.tap( + "HarmonyExportDependencyParserPlugin", + statement => { + const dep = new HarmonyExportHeaderDependency( + statement.declaration && statement.declaration.range, + statement.range + ); + dep.loc = Object.create(statement.loc); + dep.loc.index = -1; + parser.state.module.addPresentationalDependency(dep); + return true; } - }; - if (this.resultUsed) return getFullResult(); - let exportsInfo = moduleGraph.getExportsInfo( - moduleGraph.getParentModule(this) ); - for (const name of this.names) { - const exportInfo = exportsInfo.getReadOnlyExportInfo(name); - const used = exportInfo.getUsed(runtime); - if (used === UsageState.Unused) return Dependency.NO_EXPORTS_REFERENCED; - if (used !== UsageState.OnlyPropertiesUsed) return getFullResult(); - exportsInfo = exportInfo.exportsInfo; - if (!exportsInfo) return getFullResult(); - } - if (exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused) { - return getFullResult(); - } - /** @type {string[][]} */ - const referencedExports = []; - for (const exportInfo of exportsInfo.orderedExports) { - processExportInfo( - runtime, - referencedExports, - ids.concat(exportInfo.name), - exportInfo, - false - ); - } - return referencedExports.map(name => ({ - name, - canMangle: false - })); - } - - /** - * Returns the exported names - * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names - */ - getExports(moduleGraph) { - const ids = this.getIds(moduleGraph); - if (this.names.length === 1) { - const name = this.names[0]; - const from = moduleGraph.getConnection(this); - if (!from) return; - return { - exports: [ - { - name, - from, - export: ids.length === 0 ? null : ids, - // we can't mangle names that are in an empty object - // because one could access the prototype property - // when export isn't set yet - canMangle: !(name in EMPTY_OBJECT) && false - } - ], - dependencies: [from.module] - }; - } else if (this.names.length > 0) { - const name = this.names[0]; - return { - exports: [ - { - name, - // we can't mangle names that are in an empty object - // because one could access the prototype property - // when export isn't set yet - canMangle: !(name in EMPTY_OBJECT) && false - } - ], - dependencies: undefined - }; - } else { - const from = moduleGraph.getConnection(this); - if (!from) return; - const reexportInfo = this.getStarReexports( - moduleGraph, - undefined, - from.module - ); - if (reexportInfo) { - return { - exports: Array.from(reexportInfo.exports, name => { - return { - name, - from, - export: ids.concat(name), - canMangle: !(name in EMPTY_OBJECT) && false - }; - }), - // TODO handle deep reexports - dependencies: [from.module] - }; - } else { - return { - exports: true, - from: ids.length === 0 ? from : undefined, - canMangle: false, - dependencies: [from.module] - }; + parser.hooks.exportImport.tap( + "HarmonyExportDependencyParserPlugin", + (statement, source) => { + parser.state.lastHarmonyImportOrder = + (parser.state.lastHarmonyImportOrder || 0) + 1; + const clearDep = new ConstDependency("", statement.range); + clearDep.loc = Object.create(statement.loc); + clearDep.loc.index = -1; + parser.state.module.addPresentationalDependency(clearDep); + const sideEffectDep = new HarmonyImportSideEffectDependency( + source, + parser.state.lastHarmonyImportOrder, + getAssertions(statement) + ); + sideEffectDep.loc = Object.create(statement.loc); + sideEffectDep.loc.index = -1; + parser.state.current.addDependency(sideEffectDep); + return true; } - } - } - - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {RuntimeSpec} runtime the runtime - * @param {Module} importedModule the imported module (optional) - * @returns {{exports?: Set, checked?: Set}} information - */ - getStarReexports( - moduleGraph, - runtime, - importedModule = moduleGraph.getModule(this) - ) { - let importedExportsInfo = moduleGraph.getExportsInfo(importedModule); - const ids = this.getIds(moduleGraph); - if (ids.length > 0) - importedExportsInfo = importedExportsInfo.getNestedExportsInfo(ids); - let exportsInfo = moduleGraph.getExportsInfo( - moduleGraph.getParentModule(this) ); - if (this.names.length > 0) - exportsInfo = exportsInfo.getNestedExportsInfo(this.names); - - const noExtraExports = - importedExportsInfo && - importedExportsInfo.otherExportsInfo.provided === false; - const noExtraImports = - exportsInfo && - exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused; - - if (!noExtraExports && !noExtraImports) { - return; - } - - const isNamespaceImport = - importedModule.getExportsType(moduleGraph, false) === "namespace"; - - /** @type {Set} */ - const exports = new Set(); - /** @type {Set} */ - const checked = new Set(); - - if (noExtraImports) { - for (const exportInfo of exportsInfo.orderedExports) { - const name = exportInfo.name; - if (exportInfo.getUsed(runtime) === UsageState.Unused) continue; - if (name === "__esModule" && isNamespaceImport) { - exports.add(name); - } else if (importedExportsInfo) { - const importedExportInfo = - importedExportsInfo.getReadOnlyExportInfo(name); - if (importedExportInfo.provided === false) continue; - exports.add(name); - if (importedExportInfo.provided === true) continue; - checked.add(name); + parser.hooks.exportExpression.tap( + "HarmonyExportDependencyParserPlugin", + (statement, expr) => { + const isFunctionDeclaration = expr.type === "FunctionDeclaration"; + const comments = parser.getComments([ + statement.range[0], + expr.range[0] + ]); + const dep = new HarmonyExportExpressionDependency( + expr.range, + statement.range, + comments + .map(c => { + switch (c.type) { + case "Block": + return `/*${c.value}*/`; + case "Line": + return `//${c.value}\n`; + } + return ""; + }) + .join(""), + expr.type.endsWith("Declaration") && expr.id + ? expr.id.name + : isFunctionDeclaration + ? { + id: expr.id ? expr.id.name : undefined, + range: [ + expr.range[0], + expr.params.length > 0 + ? expr.params[0].range[0] + : expr.body.range[0] + ], + prefix: `${expr.async ? "async " : ""}function${ + expr.generator ? "*" : "" + } `, + suffix: `(${expr.params.length > 0 ? "" : ") "}` + } + : undefined + ); + dep.loc = Object.create(statement.loc); + dep.loc.index = -1; + parser.state.current.addDependency(dep); + InnerGraph.addVariableUsage( + parser, + expr.type.endsWith("Declaration") && expr.id + ? expr.id.name + : "*default*", + "default" + ); + return true; + } + ); + parser.hooks.exportSpecifier.tap( + "HarmonyExportDependencyParserPlugin", + (statement, id, name, idx) => { + const settings = parser.getTagData(id, harmonySpecifierTag); + let dep; + const harmonyNamedExports = (parser.state.harmonyNamedExports = + parser.state.harmonyNamedExports || new Set()); + harmonyNamedExports.add(name); + InnerGraph.addVariableUsage(parser, id, name); + if (settings) { + dep = new HarmonyExportImportedSpecifierDependency( + settings.source, + settings.sourceOrder, + settings.ids, + name, + harmonyNamedExports, + null, + exportPresenceMode, + null, + settings.assertions + ); } else { - exports.add(name); - checked.add(name); + dep = new HarmonyExportSpecifierDependency(id, name); } + dep.loc = Object.create(statement.loc); + dep.loc.index = idx; + parser.state.current.addDependency(dep); + return true; } - } else if (noExtraExports) { - for (const importedExportInfo of importedExportsInfo.orderedExports) { - const name = importedExportInfo.name; - if (importedExportInfo.provided === false) continue; - if (exportsInfo) { - const exportInfo = exportsInfo.getReadOnlyExportInfo(name); - if (exportInfo.getUsed(runtime) === UsageState.Unused) continue; + ); + parser.hooks.exportImportSpecifier.tap( + "HarmonyExportDependencyParserPlugin", + (statement, source, id, name, idx) => { + const harmonyNamedExports = (parser.state.harmonyNamedExports = + parser.state.harmonyNamedExports || new Set()); + let harmonyStarExports = null; + if (name) { + harmonyNamedExports.add(name); + } else { + harmonyStarExports = parser.state.harmonyStarExports = + parser.state.harmonyStarExports || new HarmonyStarExportsList(); } - exports.add(name); - if (importedExportInfo.provided === true) continue; - checked.add(name); - } - if (isNamespaceImport) { - exports.add("__esModule"); - checked.delete("__esModule"); + const dep = new HarmonyExportImportedSpecifierDependency( + source, + parser.state.lastHarmonyImportOrder, + id ? [id] : [], + name, + harmonyNamedExports, + harmonyStarExports && harmonyStarExports.slice(), + exportPresenceMode, + harmonyStarExports + ); + if (harmonyStarExports) { + harmonyStarExports.push(dep); + } + dep.loc = Object.create(statement.loc); + dep.loc.index = idx; + parser.state.current.addDependency(dep); + return true; } - } - - return { exports, checked }; - } - - serialize(context) { - const { write } = context; - write(this.asiSafe); - write(this.range); - write(this.valueRange); - write(this.base); - write(this.names); - write(this.ids); - write(this.resultUsed); - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - this.asiSafe = read(); - this.range = read(); - this.valueRange = read(); - this.base = read(); - this.names = read(); - this.ids = read(); - this.resultUsed = read(); - super.deserialize(context); - } -} - -makeSerializable( - CommonJsExportRequireDependency, - "webpack/lib/dependencies/CommonJsExportRequireDependency" -); - -CommonJsExportRequireDependency.Template = class CommonJsExportRequireDependencyTemplate extends ( - ModuleDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply( - dependency, - source, - { - module, - runtimeTemplate, - chunkGraph, - moduleGraph, - runtimeRequirements, - runtime - } - ) { - const dep = /** @type {CommonJsExportRequireDependency} */ (dependency); - const used = moduleGraph - .getExportsInfo(module) - .getUsedName(dep.names, runtime); - - const [type, base] = handleDependencyBase( - dep.base, - module, - runtimeRequirements ); - - const importedModule = moduleGraph.getModule(dep); - let requireExpr = runtimeTemplate.moduleExports({ - module: importedModule, - chunkGraph, - request: dep.request, - weak: dep.weak, - runtimeRequirements - }); - if (importedModule) { - const ids = dep.getIds(moduleGraph); - const usedImported = moduleGraph - .getExportsInfo(importedModule) - .getUsedName(ids, runtime); - if (usedImported) { - const comment = equals(usedImported, ids) - ? "" - : Template.toNormalComment(propertyAccess(ids)) + " "; - requireExpr += `${comment}${propertyAccess(usedImported)}`; - } - } - - switch (type) { - case "expression": - source.replace( - dep.range[0], - dep.range[1] - 1, - used - ? `${base}${propertyAccess(used)} = ${requireExpr}` - : `/* unused reexport */ ${requireExpr}` - ); - return; - case "Object.defineProperty": - throw new Error("TODO"); - default: - throw new Error("Unexpected type"); - } } }; -module.exports = CommonJsExportRequireDependency; - /***/ }), -/***/ 45598: +/***/ 51340: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -80147,10 +76844,10 @@ module.exports = CommonJsExportRequireDependency; -const InitFragment = __webpack_require__(55870); +const ConcatenationScope = __webpack_require__(98229); +const RuntimeGlobals = __webpack_require__(16475); const makeSerializable = __webpack_require__(33032); -const propertyAccess = __webpack_require__(54190); -const { handleDependencyBase } = __webpack_require__(59643); +const HarmonyExportInitFragment = __webpack_require__(89500); const NullDependency = __webpack_require__(31830); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ @@ -80158,20 +76855,19 @@ const NullDependency = __webpack_require__(31830); /** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -const EMPTY_OBJECT = {}; - -class CommonJsExportsDependency extends NullDependency { - constructor(range, valueRange, base, names) { +class HarmonyExportExpressionDependency extends NullDependency { + constructor(range, rangeStatement, prefix, declarationId) { super(); this.range = range; - this.valueRange = valueRange; - this.base = base; - this.names = names; + this.rangeStatement = rangeStatement; + this.prefix = prefix; + this.declarationId = declarationId; } get type() { - return "cjs exports"; + return "harmony export expression"; } /** @@ -80180,46 +76876,48 @@ class CommonJsExportsDependency extends NullDependency { * @returns {ExportsSpec | undefined} export names */ getExports(moduleGraph) { - const name = this.names[0]; return { - exports: [ - { - name, - // we can't mangle names that are in an empty object - // because one could access the prototype property - // when export isn't set yet - canMangle: !(name in EMPTY_OBJECT) - } - ], + exports: ["default"], + priority: 1, + terminalBinding: true, dependencies: undefined }; } + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this dependency connects the module to referencing modules + */ + getModuleEvaluationSideEffectsState(moduleGraph) { + // The expression/declaration is already covered by SideEffectsFlagPlugin + return false; + } + serialize(context) { const { write } = context; write(this.range); - write(this.valueRange); - write(this.base); - write(this.names); + write(this.rangeStatement); + write(this.prefix); + write(this.declarationId); super.serialize(context); } deserialize(context) { const { read } = context; this.range = read(); - this.valueRange = read(); - this.base = read(); - this.names = read(); + this.rangeStatement = read(); + this.prefix = read(); + this.declarationId = read(); super.deserialize(context); } } makeSerializable( - CommonJsExportsDependency, - "webpack/lib/dependencies/CommonJsExportsDependency" + HarmonyExportExpressionDependency, + "webpack/lib/dependencies/HarmonyExportExpressionDependency" ); -CommonJsExportsDependency.Template = class CommonJsExportsDependencyTemplate extends ( +HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTemplate extends ( NullDependency.Template ) { /** @@ -80231,80 +76929,109 @@ CommonJsExportsDependency.Template = class CommonJsExportsDependencyTemplate ext apply( dependency, source, - { module, moduleGraph, initFragments, runtimeRequirements, runtime } - ) { - const dep = /** @type {CommonJsExportsDependency} */ (dependency); - const used = moduleGraph - .getExportsInfo(module) - .getUsedName(dep.names, runtime); - - const [type, base] = handleDependencyBase( - dep.base, + { module, - runtimeRequirements - ); - - switch (type) { - case "expression": - if (!used) { - initFragments.push( - new InitFragment( - "var __webpack_unused_export__;\n", - InitFragment.STAGE_CONSTANTS, - 0, - "__webpack_unused_export__" - ) - ); - source.replace( - dep.range[0], - dep.range[1] - 1, - "__webpack_unused_export__" - ); - return; - } + moduleGraph, + runtimeTemplate, + runtimeRequirements, + initFragments, + runtime, + concatenationScope + } + ) { + const dep = /** @type {HarmonyExportExpressionDependency} */ (dependency); + const { declarationId } = dep; + const exportsName = module.exportsArgument; + if (declarationId) { + let name; + if (typeof declarationId === "string") { + name = declarationId; + } else { + name = ConcatenationScope.DEFAULT_EXPORT; source.replace( - dep.range[0], - dep.range[1] - 1, - `${base}${propertyAccess(used)}` + declarationId.range[0], + declarationId.range[1] - 1, + `${declarationId.prefix}${name}${declarationId.suffix}` ); - return; - case "Object.defineProperty": - if (!used) { - initFragments.push( - new InitFragment( - "var __webpack_unused_export__;\n", - InitFragment.STAGE_CONSTANTS, - 0, - "__webpack_unused_export__" - ) - ); - source.replace( - dep.range[0], - dep.valueRange[0] - 1, - "__webpack_unused_export__ = (" - ); - source.replace(dep.valueRange[1], dep.range[1] - 1, ")"); - return; + } + + if (concatenationScope) { + concatenationScope.registerExport("default", name); + } else { + const used = moduleGraph + .getExportsInfo(module) + .getUsedName("default", runtime); + if (used) { + const map = new Map(); + map.set(used, `/* export default binding */ ${name}`); + initFragments.push(new HarmonyExportInitFragment(exportsName, map)); + } + } + + source.replace( + dep.rangeStatement[0], + dep.range[0] - 1, + `/* harmony default export */ ${dep.prefix}` + ); + } else { + let content; + const name = ConcatenationScope.DEFAULT_EXPORT; + if (runtimeTemplate.supportsConst()) { + content = `/* harmony default export */ const ${name} = `; + if (concatenationScope) { + concatenationScope.registerExport("default", name); + } else { + const used = moduleGraph + .getExportsInfo(module) + .getUsedName("default", runtime); + if (used) { + runtimeRequirements.add(RuntimeGlobals.exports); + const map = new Map(); + map.set(used, name); + initFragments.push(new HarmonyExportInitFragment(exportsName, map)); + } else { + content = `/* unused harmony default export */ var ${name} = `; + } + } + } else if (concatenationScope) { + content = `/* harmony default export */ var ${name} = `; + concatenationScope.registerExport("default", name); + } else { + const used = moduleGraph + .getExportsInfo(module) + .getUsedName("default", runtime); + if (used) { + runtimeRequirements.add(RuntimeGlobals.exports); + // This is a little bit incorrect as TDZ is not correct, but we can't use const. + content = `/* harmony default export */ ${exportsName}[${JSON.stringify( + used + )}] = `; + } else { + content = `/* unused harmony default export */ var ${name} = `; } + } + + if (dep.range) { source.replace( - dep.range[0], - dep.valueRange[0] - 1, - `Object.defineProperty(${base}${propertyAccess( - used.slice(0, -1) - )}, ${JSON.stringify(used[used.length - 1])}, (` + dep.rangeStatement[0], + dep.range[0] - 1, + content + "(" + dep.prefix ); - source.replace(dep.valueRange[1], dep.range[1] - 1, "))"); + source.replace(dep.range[1], dep.rangeStatement[1] - 0.5, ");"); return; + } + + source.replace(dep.rangeStatement[0], dep.rangeStatement[1] - 1, content); } } }; -module.exports = CommonJsExportsDependency; +module.exports = HarmonyExportExpressionDependency; /***/ }), -/***/ 97107: +/***/ 38873: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -80315,340 +77042,69 @@ module.exports = CommonJsExportsDependency; -const RuntimeGlobals = __webpack_require__(16475); -const formatLocation = __webpack_require__(16734); -const { evaluateToString } = __webpack_require__(93998); -const propertyAccess = __webpack_require__(54190); -const CommonJsExportRequireDependency = __webpack_require__(62892); -const CommonJsExportsDependency = __webpack_require__(45598); -const CommonJsSelfReferenceDependency = __webpack_require__(52225); -const DynamicExports = __webpack_require__(32006); -const HarmonyExports = __webpack_require__(39211); -const ModuleDecoratorDependency = __webpack_require__(88488); +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); -/** @typedef {import("estree").Expression} ExpressionNode */ -/** @typedef {import("../NormalModule")} NormalModule */ -/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */ -/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -const getValueOfPropertyDescription = expr => { - if (expr.type !== "ObjectExpression") return; - for (const property of expr.properties) { - if (property.computed) continue; - const key = property.key; - if (key.type !== "Identifier" || key.name !== "value") continue; - return property.value; +class HarmonyExportHeaderDependency extends NullDependency { + constructor(range, rangeStatement) { + super(); + this.range = range; + this.rangeStatement = rangeStatement; } -}; -const isTruthyLiteral = expr => { - switch (expr.type) { - case "Literal": - return !!expr.value; - case "UnaryExpression": - if (expr.operator === "!") return isFalsyLiteral(expr.argument); + get type() { + return "harmony export header"; } - return false; -}; -const isFalsyLiteral = expr => { - switch (expr.type) { - case "Literal": - return !expr.value; - case "UnaryExpression": - if (expr.operator === "!") return isTruthyLiteral(expr.argument); + serialize(context) { + const { write } = context; + write(this.range); + write(this.rangeStatement); + super.serialize(context); } - return false; -}; -/** - * @param {JavascriptParser} parser the parser - * @param {ExpressionNode} expr expression - * @returns {{ argument: BasicEvaluatedExpression, ids: string[] } | undefined} parsed call - */ -const parseRequireCall = (parser, expr) => { - const ids = []; - while (expr.type === "MemberExpression") { - if (expr.object.type === "Super") return; - if (!expr.property) return; - const prop = expr.property; - if (expr.computed) { - if (prop.type !== "Literal") return; - ids.push(`${prop.value}`); - } else { - if (prop.type !== "Identifier") return; - ids.push(prop.name); - } - expr = expr.object; - } - if (expr.type !== "CallExpression" || expr.arguments.length !== 1) return; - const callee = expr.callee; - if ( - callee.type !== "Identifier" || - parser.getVariableInfo(callee.name) !== "require" - ) { - return; + deserialize(context) { + const { read } = context; + this.range = read(); + this.rangeStatement = read(); + super.deserialize(context); } - const arg = expr.arguments[0]; - if (arg.type === "SpreadElement") return; - const argValue = parser.evaluateExpression(arg); - return { argument: argValue, ids: ids.reverse() }; -}; +} -class CommonJsExportsParserPlugin { - constructor(moduleGraph) { - this.moduleGraph = moduleGraph; - } +makeSerializable( + HarmonyExportHeaderDependency, + "webpack/lib/dependencies/HarmonyExportHeaderDependency" +); +HarmonyExportHeaderDependency.Template = class HarmonyExportDependencyTemplate extends ( + NullDependency.Template +) { /** - * @param {JavascriptParser} parser the parser + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - apply(parser) { - const enableStructuredExports = () => { - DynamicExports.enable(parser.state); - }; - const checkNamespace = (topLevel, members, valueExpr) => { - if (!DynamicExports.isEnabled(parser.state)) return; - if (members.length > 0 && members[0] === "__esModule") { - if (valueExpr && isTruthyLiteral(valueExpr) && topLevel) { - DynamicExports.setFlagged(parser.state); - } else { - DynamicExports.setDynamic(parser.state); - } - } - }; - const bailout = reason => { - DynamicExports.bailout(parser.state); - if (reason) bailoutHint(reason); - }; - const bailoutHint = reason => { - this.moduleGraph - .getOptimizationBailout(parser.state.module) - .push(`CommonJS bailout: ${reason}`); - }; - - // metadata // - parser.hooks.evaluateTypeof - .for("module") - .tap("CommonJsExportsParserPlugin", evaluateToString("object")); - parser.hooks.evaluateTypeof - .for("exports") - .tap("CommonJsPlugin", evaluateToString("object")); - - // exporting // - const handleAssignExport = (expr, base, members) => { - if (HarmonyExports.isEnabled(parser.state)) return; - // Handle reexporting - const requireCall = parseRequireCall(parser, expr.right); - if ( - requireCall && - requireCall.argument.isString() && - (members.length === 0 || members[0] !== "__esModule") - ) { - enableStructuredExports(); - // It's possible to reexport __esModule, so we must convert to a dynamic module - if (members.length === 0) DynamicExports.setDynamic(parser.state); - const dep = new CommonJsExportRequireDependency( - expr.range, - null, - base, - members, - requireCall.argument.string, - requireCall.ids, - !parser.isStatementLevelExpression(expr) - ); - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.module.addDependency(dep); - return true; - } - if (members.length === 0) return; - enableStructuredExports(); - const remainingMembers = members; - checkNamespace( - parser.statementPath.length === 1 && - parser.isStatementLevelExpression(expr), - remainingMembers, - expr.right - ); - const dep = new CommonJsExportsDependency( - expr.left.range, - null, - base, - remainingMembers - ); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - parser.walkExpression(expr.right); - return true; - }; - parser.hooks.assignMemberChain - .for("exports") - .tap("CommonJsExportsParserPlugin", (expr, members) => { - return handleAssignExport(expr, "exports", members); - }); - parser.hooks.assignMemberChain - .for("this") - .tap("CommonJsExportsParserPlugin", (expr, members) => { - if (!parser.scope.topLevelScope) return; - return handleAssignExport(expr, "this", members); - }); - parser.hooks.assignMemberChain - .for("module") - .tap("CommonJsExportsParserPlugin", (expr, members) => { - if (members[0] !== "exports") return; - return handleAssignExport(expr, "module.exports", members.slice(1)); - }); - parser.hooks.call - .for("Object.defineProperty") - .tap("CommonJsExportsParserPlugin", expression => { - const expr = /** @type {import("estree").CallExpression} */ ( - expression - ); - if (!parser.isStatementLevelExpression(expr)) return; - if (expr.arguments.length !== 3) return; - if (expr.arguments[0].type === "SpreadElement") return; - if (expr.arguments[1].type === "SpreadElement") return; - if (expr.arguments[2].type === "SpreadElement") return; - const exportsArg = parser.evaluateExpression(expr.arguments[0]); - if (!exportsArg || !exportsArg.isIdentifier()) return; - if ( - exportsArg.identifier !== "exports" && - exportsArg.identifier !== "module.exports" && - (exportsArg.identifier !== "this" || !parser.scope.topLevelScope) - ) { - return; - } - const propertyArg = parser.evaluateExpression(expr.arguments[1]); - if (!propertyArg) return; - const property = propertyArg.asString(); - if (typeof property !== "string") return; - enableStructuredExports(); - const descArg = expr.arguments[2]; - checkNamespace( - parser.statementPath.length === 1, - [property], - getValueOfPropertyDescription(descArg) - ); - const dep = new CommonJsExportsDependency( - expr.range, - expr.arguments[2].range, - `Object.defineProperty(${exportsArg.identifier})`, - [property] - ); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - - parser.walkExpression(expr.arguments[2]); - return true; - }); - - // Self reference // - const handleAccessExport = (expr, base, members, call = undefined) => { - if (HarmonyExports.isEnabled(parser.state)) return; - if (members.length === 0) { - bailout(`${base} is used directly at ${formatLocation(expr.loc)}`); - } - if (call && members.length === 1) { - bailoutHint( - `${base}${propertyAccess( - members - )}(...) prevents optimization as ${base} is passed as call context at ${formatLocation( - expr.loc - )}` - ); - } - const dep = new CommonJsSelfReferenceDependency( - expr.range, - base, - members, - !!call - ); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - if (call) { - parser.walkExpressions(call.arguments); - } - return true; - }; - parser.hooks.callMemberChain - .for("exports") - .tap("CommonJsExportsParserPlugin", (expr, members) => { - return handleAccessExport(expr.callee, "exports", members, expr); - }); - parser.hooks.expressionMemberChain - .for("exports") - .tap("CommonJsExportsParserPlugin", (expr, members) => { - return handleAccessExport(expr, "exports", members); - }); - parser.hooks.expression - .for("exports") - .tap("CommonJsExportsParserPlugin", expr => { - return handleAccessExport(expr, "exports", []); - }); - parser.hooks.callMemberChain - .for("module") - .tap("CommonJsExportsParserPlugin", (expr, members) => { - if (members[0] !== "exports") return; - return handleAccessExport( - expr.callee, - "module.exports", - members.slice(1), - expr - ); - }); - parser.hooks.expressionMemberChain - .for("module") - .tap("CommonJsExportsParserPlugin", (expr, members) => { - if (members[0] !== "exports") return; - return handleAccessExport(expr, "module.exports", members.slice(1)); - }); - parser.hooks.expression - .for("module.exports") - .tap("CommonJsExportsParserPlugin", expr => { - return handleAccessExport(expr, "module.exports", []); - }); - parser.hooks.callMemberChain - .for("this") - .tap("CommonJsExportsParserPlugin", (expr, members) => { - if (!parser.scope.topLevelScope) return; - return handleAccessExport(expr.callee, "this", members, expr); - }); - parser.hooks.expressionMemberChain - .for("this") - .tap("CommonJsExportsParserPlugin", (expr, members) => { - if (!parser.scope.topLevelScope) return; - return handleAccessExport(expr, "this", members); - }); - parser.hooks.expression - .for("this") - .tap("CommonJsExportsParserPlugin", expr => { - if (!parser.scope.topLevelScope) return; - return handleAccessExport(expr, "this", []); - }); - - // Bailouts // - parser.hooks.expression.for("module").tap("CommonJsPlugin", expr => { - bailout(); - const isHarmony = HarmonyExports.isEnabled(parser.state); - const dep = new ModuleDecoratorDependency( - isHarmony - ? RuntimeGlobals.harmonyModuleDecorator - : RuntimeGlobals.nodeModuleDecorator, - !isHarmony - ); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - return true; - }); + apply(dependency, source, templateContext) { + const dep = /** @type {HarmonyExportHeaderDependency} */ (dependency); + const content = ""; + const replaceUntil = dep.range + ? dep.range[0] - 1 + : dep.rangeStatement[1] - 1; + source.replace(dep.rangeStatement[0], replaceUntil, content); } -} -module.exports = CommonJsExportsParserPlugin; +}; + +module.exports = HarmonyExportHeaderDependency; /***/ }), -/***/ 59440: +/***/ 67157: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -80659,1078 +77115,1275 @@ module.exports = CommonJsExportsParserPlugin; -const Template = __webpack_require__(39722); -const { equals } = __webpack_require__(84953); +const Dependency = __webpack_require__(54912); +const { UsageState } = __webpack_require__(63686); +const HarmonyLinkingError = __webpack_require__(97511); +const InitFragment = __webpack_require__(55870); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const { countIterable } = __webpack_require__(39104); +const { first, combine } = __webpack_require__(93347); const makeSerializable = __webpack_require__(33032); const propertyAccess = __webpack_require__(54190); -const ModuleDependency = __webpack_require__(80321); +const { getRuntimeKey, keyToRuntime } = __webpack_require__(17156); +const HarmonyExportInitFragment = __webpack_require__(89500); +const HarmonyImportDependency = __webpack_require__(57154); +const processExportInfo = __webpack_require__(55207); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ExportsInfo")} ExportsInfo */ +/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */ +/** @typedef {import("../Module")} Module */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/Hash")} Hash */ /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -class CommonJsFullRequireDependency extends ModuleDependency { +/** @typedef {"missing"|"unused"|"empty-star"|"reexport-dynamic-default"|"reexport-named-default"|"reexport-namespace-object"|"reexport-fake-namespace-object"|"reexport-undefined"|"normal-reexport"|"dynamic-reexport"} ExportModeType */ + +const { ExportPresenceModes } = HarmonyImportDependency; + +const idsSymbol = Symbol("HarmonyExportImportedSpecifierDependency.ids"); + +class NormalReexportItem { /** - * @param {string} request the request string - * @param {[number, number]} range location in source code - * @param {string[]} names accessed properties on module + * @param {string} name export name + * @param {string[]} ids reexported ids from other module + * @param {ExportInfo} exportInfo export info from other module + * @param {boolean} checked true, if it should be checked at runtime if this export exists + * @param {boolean} hidden true, if it is hidden behind another active export in the same module */ - constructor(request, range, names) { - super(request); - this.range = range; - this.names = names; - this.call = false; - this.asiSafe = undefined; + constructor(name, ids, exportInfo, checked, hidden) { + this.name = name; + this.ids = ids; + this.exportInfo = exportInfo; + this.checked = checked; + this.hidden = hidden; } +} +class ExportMode { /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports + * @param {ExportModeType} type type of the mode */ - getReferencedExports(moduleGraph, runtime) { - if (this.call) { - const importedModule = moduleGraph.getModule(this); - if ( - !importedModule || - importedModule.getExportsType(moduleGraph, false) !== "namespace" - ) { - return [this.names.slice(0, -1)]; + constructor(type) { + /** @type {ExportModeType} */ + this.type = type; + + // for "normal-reexport": + /** @type {NormalReexportItem[] | null} */ + this.items = null; + + // for "reexport-named-default" | "reexport-fake-namespace-object" | "reexport-namespace-object" + /** @type {string|null} */ + this.name = null; + /** @type {ExportInfo | null} */ + this.partialNamespaceExportInfo = null; + + // for "dynamic-reexport": + /** @type {Set | null} */ + this.ignored = null; + + // for "dynamic-reexport" | "empty-star": + /** @type {Set | null} */ + this.hidden = null; + + // for "missing": + /** @type {string | null} */ + this.userRequest = null; + + // for "reexport-fake-namespace-object": + /** @type {number} */ + this.fakeType = 0; + } +} + +const determineExportAssignments = ( + moduleGraph, + dependencies, + additionalDependency +) => { + const names = new Set(); + const dependencyIndices = []; + + if (additionalDependency) { + dependencies = dependencies.concat(additionalDependency); + } + + for (const dep of dependencies) { + const i = dependencyIndices.length; + dependencyIndices[i] = names.size; + const otherImportedModule = moduleGraph.getModule(dep); + if (otherImportedModule) { + const exportsInfo = moduleGraph.getExportsInfo(otherImportedModule); + for (const exportInfo of exportsInfo.exports) { + if ( + exportInfo.provided === true && + exportInfo.name !== "default" && + !names.has(exportInfo.name) + ) { + names.add(exportInfo.name); + dependencyIndices[i] = names.size; + } } } - return [this.names]; } + dependencyIndices.push(names.size); - serialize(context) { - const { write } = context; - write(this.names); - write(this.call); - write(this.asiSafe); - super.serialize(context); - } + return { names: Array.from(names), dependencyIndices }; +}; - deserialize(context) { - const { read } = context; - this.names = read(); - this.call = read(); - this.asiSafe = read(); - super.deserialize(context); +const findDependencyForName = ( + { names, dependencyIndices }, + name, + dependencies +) => { + const dependenciesIt = dependencies[Symbol.iterator](); + const dependencyIndicesIt = dependencyIndices[Symbol.iterator](); + let dependenciesItResult = dependenciesIt.next(); + let dependencyIndicesItResult = dependencyIndicesIt.next(); + if (dependencyIndicesItResult.done) return; + for (let i = 0; i < names.length; i++) { + while (i >= dependencyIndicesItResult.value) { + dependenciesItResult = dependenciesIt.next(); + dependencyIndicesItResult = dependencyIndicesIt.next(); + if (dependencyIndicesItResult.done) return; + } + if (names[i] === name) return dependenciesItResult.value; } + return undefined; +}; - get type() { - return "cjs full require"; +/** + * @param {ModuleGraph} moduleGraph the module graph + * @param {HarmonyExportImportedSpecifierDependency} dep the dependency + * @param {string} runtimeKey the runtime key + * @returns {ExportMode} the export mode + */ +const getMode = (moduleGraph, dep, runtimeKey) => { + const importedModule = moduleGraph.getModule(dep); + + if (!importedModule) { + const mode = new ExportMode("missing"); + + mode.userRequest = dep.userRequest; + + return mode; } - get category() { - return "commonjs"; + const name = dep.name; + const runtime = keyToRuntime(runtimeKey); + const parentModule = moduleGraph.getParentModule(dep); + const exportsInfo = moduleGraph.getExportsInfo(parentModule); + + if ( + name + ? exportsInfo.getUsed(name, runtime) === UsageState.Unused + : exportsInfo.isUsed(runtime) === false + ) { + const mode = new ExportMode("unused"); + + mode.name = name || "*"; + + return mode; } -} -CommonJsFullRequireDependency.Template = class CommonJsFullRequireDependencyTemplate extends ( - ModuleDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply( - dependency, - source, - { - module, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtimeRequirements, - runtime, - initFragments + const importedExportsType = importedModule.getExportsType( + moduleGraph, + parentModule.buildMeta.strictHarmonyModule + ); + + const ids = dep.getIds(moduleGraph); + + // Special handling for reexporting the default export + // from non-namespace modules + if (name && ids.length > 0 && ids[0] === "default") { + switch (importedExportsType) { + case "dynamic": { + const mode = new ExportMode("reexport-dynamic-default"); + + mode.name = name; + + return mode; + } + case "default-only": + case "default-with-named": { + const exportInfo = exportsInfo.getReadOnlyExportInfo(name); + const mode = new ExportMode("reexport-named-default"); + + mode.name = name; + mode.partialNamespaceExportInfo = exportInfo; + + return mode; + } } - ) { - const dep = /** @type {CommonJsFullRequireDependency} */ (dependency); - if (!dep.range) return; - const importedModule = moduleGraph.getModule(dep); - let requireExpr = runtimeTemplate.moduleExports({ - module: importedModule, - chunkGraph, - request: dep.request, - weak: dep.weak, - runtimeRequirements - }); - if (importedModule) { - const ids = dep.names; - const usedImported = moduleGraph - .getExportsInfo(importedModule) - .getUsedName(ids, runtime); - if (usedImported) { - const comment = equals(usedImported, ids) - ? "" - : Template.toNormalComment(propertyAccess(ids)) + " "; - const access = `${comment}${propertyAccess(usedImported)}`; - requireExpr = - dep.asiSafe === true - ? `(${requireExpr}${access})` - : `${requireExpr}${access}`; + } + + // reexporting with a fixed name + if (name) { + let mode; + const exportInfo = exportsInfo.getReadOnlyExportInfo(name); + + if (ids.length > 0) { + // export { name as name } + switch (importedExportsType) { + case "default-only": + mode = new ExportMode("reexport-undefined"); + mode.name = name; + break; + default: + mode = new ExportMode("normal-reexport"); + mode.items = [ + new NormalReexportItem(name, ids, exportInfo, false, false) + ]; + break; + } + } else { + // export * as name + switch (importedExportsType) { + case "default-only": + mode = new ExportMode("reexport-fake-namespace-object"); + mode.name = name; + mode.partialNamespaceExportInfo = exportInfo; + mode.fakeType = 0; + break; + case "default-with-named": + mode = new ExportMode("reexport-fake-namespace-object"); + mode.name = name; + mode.partialNamespaceExportInfo = exportInfo; + mode.fakeType = 2; + break; + case "dynamic": + default: + mode = new ExportMode("reexport-namespace-object"); + mode.name = name; + mode.partialNamespaceExportInfo = exportInfo; } } - source.replace(dep.range[0], dep.range[1] - 1, requireExpr); + + return mode; } -}; -makeSerializable( - CommonJsFullRequireDependency, - "webpack/lib/dependencies/CommonJsFullRequireDependency" -); + // Star reexporting -module.exports = CommonJsFullRequireDependency; + const { ignoredExports, exports, checked, hidden } = dep.getStarReexports( + moduleGraph, + runtime, + exportsInfo, + importedModule + ); + if (!exports) { + // We have too few info about the modules + // Delegate the logic to the runtime code + const mode = new ExportMode("dynamic-reexport"); + mode.ignored = ignoredExports; + mode.hidden = hidden; -/***/ }), + return mode; + } -/***/ 36013: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (exports.size === 0) { + const mode = new ExportMode("empty-star"); + mode.hidden = hidden; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + return mode; + } + const mode = new ExportMode("normal-reexport"); + mode.items = Array.from( + exports, + exportName => + new NormalReexportItem( + exportName, + [exportName], + exportsInfo.getReadOnlyExportInfo(exportName), + checked.has(exportName), + false + ) + ); + if (hidden !== undefined) { + for (const exportName of hidden) { + mode.items.push( + new NormalReexportItem( + exportName, + [exportName], + exportsInfo.getReadOnlyExportInfo(exportName), + false, + true + ) + ); + } + } -const CommentCompilationWarning = __webpack_require__(98427); -const RuntimeGlobals = __webpack_require__(16475); -const UnsupportedFeatureWarning = __webpack_require__(42495); -const { - evaluateToIdentifier, - evaluateToString, - expressionIsUnsupported, - toConstantDependency -} = __webpack_require__(93998); -const CommonJsFullRequireDependency = __webpack_require__(59440); -const CommonJsRequireContextDependency = __webpack_require__(23962); -const CommonJsRequireDependency = __webpack_require__(21264); -const ConstDependency = __webpack_require__(76911); -const ContextDependencyHelpers = __webpack_require__(99630); -const LocalModuleDependency = __webpack_require__(52805); -const { getLocalModule } = __webpack_require__(75827); -const RequireHeaderDependency = __webpack_require__(89183); -const RequireResolveContextDependency = __webpack_require__(55627); -const RequireResolveDependency = __webpack_require__(68582); -const RequireResolveHeaderDependency = __webpack_require__(9880); + return mode; +}; -/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ +class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { + /** + * @param {string} request the request string + * @param {number} sourceOrder the order in the original source file + * @param {string[]} ids the requested export name of the imported module + * @param {string | null} name the export name of for this module + * @param {Set} activeExports other named exports in the module + * @param {ReadonlyArray | Iterable} otherStarExports other star exports in the module before this import + * @param {number} exportPresenceMode mode of checking export names + * @param {HarmonyStarExportsList} allStarExports all star exports in the module + * @param {Record=} assertions import assertions + */ + constructor( + request, + sourceOrder, + ids, + name, + activeExports, + otherStarExports, + exportPresenceMode, + allStarExports, + assertions + ) { + super(request, sourceOrder, assertions); + + this.ids = ids; + this.name = name; + this.activeExports = activeExports; + this.otherStarExports = otherStarExports; + this.exportPresenceMode = exportPresenceMode; + this.allStarExports = allStarExports; + } -class CommonJsImportsParserPlugin { /** - * @param {JavascriptParserOptions} options parser options + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module */ - constructor(options) { - this.options = options; + couldAffectReferencingModule() { + return Dependency.TRANSITIVE; } - apply(parser) { - const options = this.options; + // TODO webpack 6 remove + get id() { + throw new Error("id was renamed to ids and type changed to string[]"); + } - // metadata // - const tapRequireExpression = (expression, getMembers) => { - parser.hooks.typeof - .for(expression) - .tap( - "CommonJsPlugin", - toConstantDependency(parser, JSON.stringify("function")) - ); - parser.hooks.evaluateTypeof - .for(expression) - .tap("CommonJsPlugin", evaluateToString("function")); - parser.hooks.evaluateIdentifier - .for(expression) - .tap( - "CommonJsPlugin", - evaluateToIdentifier(expression, "require", getMembers, true) - ); - }; - tapRequireExpression("require", () => []); - tapRequireExpression("require.resolve", () => ["resolve"]); - tapRequireExpression("require.resolveWeak", () => ["resolveWeak"]); + // TODO webpack 6 remove + getId() { + throw new Error("id was renamed to ids and type changed to string[]"); + } - // Weird stuff // - parser.hooks.assign.for("require").tap("CommonJsPlugin", expr => { - // to not leak to global "require", we need to define a local require here. - const dep = new ConstDependency("var require;", 0); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); + // TODO webpack 6 remove + setId() { + throw new Error("id was renamed to ids and type changed to string[]"); + } - // Unsupported // - parser.hooks.expression - .for("require.main.require") - .tap( - "CommonJsPlugin", - expressionIsUnsupported( - parser, - "require.main.require is not supported by webpack." - ) - ); - parser.hooks.call - .for("require.main.require") - .tap( - "CommonJsPlugin", - expressionIsUnsupported( - parser, - "require.main.require is not supported by webpack." - ) - ); - parser.hooks.expression - .for("module.parent.require") - .tap( - "CommonJsPlugin", - expressionIsUnsupported( - parser, - "module.parent.require is not supported by webpack." - ) - ); - parser.hooks.call - .for("module.parent.require") - .tap( - "CommonJsPlugin", - expressionIsUnsupported( - parser, - "module.parent.require is not supported by webpack." - ) - ); + get type() { + return "harmony export imported specifier"; + } - // renaming // - parser.hooks.canRename.for("require").tap("CommonJsPlugin", () => true); - parser.hooks.rename.for("require").tap("CommonJsPlugin", expr => { - // To avoid "not defined" error, replace the value with undefined - const dep = new ConstDependency("undefined", expr.range); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return false; - }); + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {string[]} the imported id + */ + getIds(moduleGraph) { + return moduleGraph.getMeta(this)[idsSymbol] || this.ids; + } - // inspection // - parser.hooks.expression - .for("require.cache") - .tap( - "CommonJsImportsParserPlugin", - toConstantDependency(parser, RuntimeGlobals.moduleCache, [ - RuntimeGlobals.moduleCache, - RuntimeGlobals.moduleId, - RuntimeGlobals.moduleLoaded - ]) - ); + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {string[]} ids the imported ids + * @returns {void} + */ + setIds(moduleGraph, ids) { + moduleGraph.getMeta(this)[idsSymbol] = ids; + } - // require as expression // - parser.hooks.expression - .for("require") - .tap("CommonJsImportsParserPlugin", expr => { - const dep = new CommonJsRequireContextDependency( - { - request: options.unknownContextRequest, - recursive: options.unknownContextRecursive, - regExp: options.unknownContextRegExp, - mode: "sync" - }, - expr.range, - undefined, - parser.scope.inShorthand - ); - dep.critical = - options.unknownContextCritical && - "require function is used in a way in which dependencies cannot be statically extracted"; - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; - }); + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {RuntimeSpec} runtime the runtime + * @returns {ExportMode} the export mode + */ + getMode(moduleGraph, runtime) { + return moduleGraph.dependencyCacheProvide( + this, + getRuntimeKey(runtime), + getMode + ); + } - // require // - const processRequireItem = (expr, param) => { - if (param.isString()) { - const dep = new CommonJsRequireDependency(param.string, param.range); - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; - } - }; - const processRequireContext = (expr, param) => { - const dep = ContextDependencyHelpers.create( - CommonJsRequireContextDependency, - expr.range, - param, - expr, - options, - { - category: "commonjs" - }, - parser - ); - if (!dep) return; - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; - }; - const createRequireHandler = callNew => expr => { - if (options.commonjsMagicComments) { - const { options: requireOptions, errors: commentErrors } = - parser.parseCommentOptions(expr.range); + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {RuntimeSpec} runtime the runtime + * @param {ExportsInfo} exportsInfo exports info about the current module (optional) + * @param {Module} importedModule the imported module (optional) + * @returns {{exports?: Set, checked?: Set, ignoredExports: Set, hidden?: Set}} information + */ + getStarReexports( + moduleGraph, + runtime, + exportsInfo = moduleGraph.getExportsInfo(moduleGraph.getParentModule(this)), + importedModule = moduleGraph.getModule(this) + ) { + const importedExportsInfo = moduleGraph.getExportsInfo(importedModule); - if (commentErrors) { - for (const e of commentErrors) { - const { comment } = e; - parser.state.module.addWarning( - new CommentCompilationWarning( - `Compilation error while processing magic comment(-s): /*${comment.value}*/: ${e.message}`, - comment.loc - ) - ); - } - } - if (requireOptions) { - if (requireOptions.webpackIgnore !== undefined) { - if (typeof requireOptions.webpackIgnore !== "boolean") { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackIgnore\` expected a boolean, but received: ${requireOptions.webpackIgnore}.`, - expr.loc - ) - ); - } else { - // Do not instrument `require()` if `webpackIgnore` is `true` - if (requireOptions.webpackIgnore) { - return true; - } - } - } - } + const noExtraExports = + importedExportsInfo.otherExportsInfo.provided === false; + const noExtraImports = + exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused; + + const ignoredExports = new Set(["default", ...this.activeExports]); + + let hiddenExports = undefined; + const otherStarExports = + this._discoverActiveExportsFromOtherStarExports(moduleGraph); + if (otherStarExports !== undefined) { + hiddenExports = new Set(); + for (let i = 0; i < otherStarExports.namesSlice; i++) { + hiddenExports.add(otherStarExports.names[i]); } + for (const e of ignoredExports) hiddenExports.delete(e); + } - if (expr.arguments.length !== 1) return; - let localModule; - const param = parser.evaluateExpression(expr.arguments[0]); - if (param.isConditional()) { - let isExpression = false; - for (const p of param.options) { - const result = processRequireItem(expr, p); - if (result === undefined) { - isExpression = true; - } - } - if (!isExpression) { - const dep = new RequireHeaderDependency(expr.callee.range); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; + if (!noExtraExports && !noExtraImports) { + return { + ignoredExports, + hidden: hiddenExports + }; + } + + /** @type {Set} */ + const exports = new Set(); + /** @type {Set} */ + const checked = new Set(); + /** @type {Set} */ + const hidden = hiddenExports !== undefined ? new Set() : undefined; + + if (noExtraImports) { + for (const exportInfo of exportsInfo.orderedExports) { + const name = exportInfo.name; + if (ignoredExports.has(name)) continue; + if (exportInfo.getUsed(runtime) === UsageState.Unused) continue; + const importedExportInfo = + importedExportsInfo.getReadOnlyExportInfo(name); + if (importedExportInfo.provided === false) continue; + if (hiddenExports !== undefined && hiddenExports.has(name)) { + hidden.add(name); + continue; } + exports.add(name); + if (importedExportInfo.provided === true) continue; + checked.add(name); } - if ( - param.isString() && - (localModule = getLocalModule(parser.state, param.string)) - ) { - localModule.flagUsed(); - const dep = new LocalModuleDependency(localModule, expr.range, callNew); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - } else { - const result = processRequireItem(expr, param); - if (result === undefined) { - processRequireContext(expr, param); - } else { - const dep = new RequireHeaderDependency(expr.callee.range); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); + } else if (noExtraExports) { + for (const importedExportInfo of importedExportsInfo.orderedExports) { + const name = importedExportInfo.name; + if (ignoredExports.has(name)) continue; + if (importedExportInfo.provided === false) continue; + const exportInfo = exportsInfo.getReadOnlyExportInfo(name); + if (exportInfo.getUsed(runtime) === UsageState.Unused) continue; + if (hiddenExports !== undefined && hiddenExports.has(name)) { + hidden.add(name); + continue; } - return true; + exports.add(name); + if (importedExportInfo.provided === true) continue; + checked.add(name); } + } + + return { ignoredExports, exports, checked, hidden }; + } + + /** + * @param {ModuleGraph} moduleGraph module graph + * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active + */ + getCondition(moduleGraph) { + return (connection, runtime) => { + const mode = this.getMode(moduleGraph, runtime); + return mode.type !== "unused" && mode.type !== "empty-star"; }; - parser.hooks.call - .for("require") - .tap("CommonJsImportsParserPlugin", createRequireHandler(false)); - parser.hooks.new - .for("require") - .tap("CommonJsImportsParserPlugin", createRequireHandler(true)); - parser.hooks.call - .for("module.require") - .tap("CommonJsImportsParserPlugin", createRequireHandler(false)); - parser.hooks.new - .for("module.require") - .tap("CommonJsImportsParserPlugin", createRequireHandler(true)); + } - // require with property access // - const chainHandler = (expr, calleeMembers, callExpr, members) => { - if (callExpr.arguments.length !== 1) return; - const param = parser.evaluateExpression(callExpr.arguments[0]); - if (param.isString() && !getLocalModule(parser.state, param.string)) { - const dep = new CommonJsFullRequireDependency( - param.string, - expr.range, - members + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this dependency connects the module to referencing modules + */ + getModuleEvaluationSideEffectsState(moduleGraph) { + return false; + } + + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + const mode = this.getMode(moduleGraph, runtime); + + switch (mode.type) { + case "missing": + case "unused": + case "empty-star": + case "reexport-undefined": + return Dependency.NO_EXPORTS_REFERENCED; + + case "reexport-dynamic-default": + return Dependency.EXPORTS_OBJECT_REFERENCED; + + case "reexport-named-default": { + if (!mode.partialNamespaceExportInfo) + return Dependency.EXPORTS_OBJECT_REFERENCED; + /** @type {string[][]} */ + const referencedExports = []; + processExportInfo( + runtime, + referencedExports, + [], + /** @type {ExportInfo} */ (mode.partialNamespaceExportInfo) ); - dep.asiSafe = !parser.isAsiPosition(expr.range[0]); - dep.optional = !!parser.scope.inTry; - dep.loc = expr.loc; - parser.state.current.addDependency(dep); - return true; + return referencedExports; } - }; - const callChainHandler = (expr, calleeMembers, callExpr, members) => { - if (callExpr.arguments.length !== 1) return; - const param = parser.evaluateExpression(callExpr.arguments[0]); - if (param.isString() && !getLocalModule(parser.state, param.string)) { - const dep = new CommonJsFullRequireDependency( - param.string, - expr.callee.range, - members + + case "reexport-namespace-object": + case "reexport-fake-namespace-object": { + if (!mode.partialNamespaceExportInfo) + return Dependency.EXPORTS_OBJECT_REFERENCED; + /** @type {string[][]} */ + const referencedExports = []; + processExportInfo( + runtime, + referencedExports, + [], + /** @type {ExportInfo} */ (mode.partialNamespaceExportInfo), + mode.type === "reexport-fake-namespace-object" ); - dep.call = true; - dep.asiSafe = !parser.isAsiPosition(expr.range[0]); - dep.optional = !!parser.scope.inTry; - dep.loc = expr.callee.loc; - parser.state.current.addDependency(dep); - parser.walkExpressions(expr.arguments); - return true; + return referencedExports; } - }; - parser.hooks.memberChainOfCallMemberChain - .for("require") - .tap("CommonJsImportsParserPlugin", chainHandler); - parser.hooks.memberChainOfCallMemberChain - .for("module.require") - .tap("CommonJsImportsParserPlugin", chainHandler); - parser.hooks.callMemberChainOfCallMemberChain - .for("require") - .tap("CommonJsImportsParserPlugin", callChainHandler); - parser.hooks.callMemberChainOfCallMemberChain - .for("module.require") - .tap("CommonJsImportsParserPlugin", callChainHandler); - // require.resolve // - const processResolve = (expr, weak) => { - if (expr.arguments.length !== 1) return; - const param = parser.evaluateExpression(expr.arguments[0]); - if (param.isConditional()) { - for (const option of param.options) { - const result = processResolveItem(expr, option, weak); - if (result === undefined) { - processResolveContext(expr, option, weak); - } - } - const dep = new RequireResolveHeaderDependency(expr.callee.range); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - } else { - const result = processResolveItem(expr, param, weak); - if (result === undefined) { - processResolveContext(expr, param, weak); + case "dynamic-reexport": + return Dependency.EXPORTS_OBJECT_REFERENCED; + + case "normal-reexport": { + const referencedExports = []; + for (const { ids, exportInfo, hidden } of mode.items) { + if (hidden) continue; + processExportInfo(runtime, referencedExports, ids, exportInfo, false); } - const dep = new RequireResolveHeaderDependency(expr.callee.range); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - } - }; - const processResolveItem = (expr, param, weak) => { - if (param.isString()) { - const dep = new RequireResolveDependency(param.string, param.range); - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - dep.weak = weak; - parser.state.current.addDependency(dep); - return true; + return referencedExports; } - }; - const processResolveContext = (expr, param, weak) => { - const dep = ContextDependencyHelpers.create( - RequireResolveContextDependency, - param.range, - param, - expr, - options, - { - category: "commonjs", - mode: weak ? "weak" : "sync" - }, - parser - ); - if (!dep) return; - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; - }; - parser.hooks.call - .for("require.resolve") - .tap("RequireResolveDependencyParserPlugin", expr => { - return processResolve(expr, false); - }); - parser.hooks.call - .for("require.resolveWeak") - .tap("RequireResolveDependencyParserPlugin", expr => { - return processResolve(expr, true); - }); + default: + throw new Error(`Unknown mode ${mode.type}`); + } } -} -module.exports = CommonJsImportsParserPlugin; + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {{ names: string[], namesSlice: number, dependencyIndices: number[], dependencyIndex: number } | undefined} exported names and their origin dependency + */ + _discoverActiveExportsFromOtherStarExports(moduleGraph) { + if (!this.otherStarExports) return undefined; -/***/ }), - -/***/ 32406: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const i = + "length" in this.otherStarExports + ? this.otherStarExports.length + : countIterable(this.otherStarExports); + if (i === 0) return undefined; + if (this.allStarExports) { + const { names, dependencyIndices } = moduleGraph.cached( + determineExportAssignments, + this.allStarExports.dependencies + ); + return { + names, + namesSlice: dependencyIndices[i - 1], + dependencyIndices, + dependencyIndex: i + }; + } -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const SelfModuleFactory = __webpack_require__(63560); -const Template = __webpack_require__(39722); -const CommonJsExportsDependency = __webpack_require__(45598); -const CommonJsFullRequireDependency = __webpack_require__(59440); -const CommonJsRequireContextDependency = __webpack_require__(23962); -const CommonJsRequireDependency = __webpack_require__(21264); -const CommonJsSelfReferenceDependency = __webpack_require__(52225); -const ModuleDecoratorDependency = __webpack_require__(88488); -const RequireHeaderDependency = __webpack_require__(89183); -const RequireResolveContextDependency = __webpack_require__(55627); -const RequireResolveDependency = __webpack_require__(68582); -const RequireResolveHeaderDependency = __webpack_require__(9880); -const RuntimeRequirementsDependency = __webpack_require__(24187); + const { names, dependencyIndices } = moduleGraph.cached( + determineExportAssignments, + this.otherStarExports, + this + ); -const CommonJsExportsParserPlugin = __webpack_require__(97107); -const CommonJsImportsParserPlugin = __webpack_require__(36013); + return { + names, + namesSlice: dependencyIndices[i - 1], + dependencyIndices, + dependencyIndex: i + }; + } -const { - evaluateToIdentifier, - toConstantDependency -} = __webpack_require__(93998); -const CommonJsExportRequireDependency = __webpack_require__(62892); + /** + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names + */ + getExports(moduleGraph) { + const mode = this.getMode(moduleGraph, undefined); -class CommonJsPlugin { - apply(compiler) { - compiler.hooks.compilation.tap( - "CommonJsPlugin", - (compilation, { contextModuleFactory, normalModuleFactory }) => { - compilation.dependencyFactories.set( - CommonJsRequireDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - CommonJsRequireDependency, - new CommonJsRequireDependency.Template() - ); - - compilation.dependencyFactories.set( - CommonJsFullRequireDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - CommonJsFullRequireDependency, - new CommonJsFullRequireDependency.Template() - ); - - compilation.dependencyFactories.set( - CommonJsRequireContextDependency, - contextModuleFactory - ); - compilation.dependencyTemplates.set( - CommonJsRequireContextDependency, - new CommonJsRequireContextDependency.Template() - ); - - compilation.dependencyFactories.set( - RequireResolveDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - RequireResolveDependency, - new RequireResolveDependency.Template() - ); - - compilation.dependencyFactories.set( - RequireResolveContextDependency, - contextModuleFactory - ); - compilation.dependencyTemplates.set( - RequireResolveContextDependency, - new RequireResolveContextDependency.Template() - ); - - compilation.dependencyTemplates.set( - RequireResolveHeaderDependency, - new RequireResolveHeaderDependency.Template() - ); - - compilation.dependencyTemplates.set( - RequireHeaderDependency, - new RequireHeaderDependency.Template() - ); - - compilation.dependencyTemplates.set( - CommonJsExportsDependency, - new CommonJsExportsDependency.Template() - ); - - compilation.dependencyFactories.set( - CommonJsExportRequireDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - CommonJsExportRequireDependency, - new CommonJsExportRequireDependency.Template() - ); - - const selfFactory = new SelfModuleFactory(compilation.moduleGraph); - - compilation.dependencyFactories.set( - CommonJsSelfReferenceDependency, - selfFactory - ); - compilation.dependencyTemplates.set( - CommonJsSelfReferenceDependency, - new CommonJsSelfReferenceDependency.Template() - ); - - compilation.dependencyFactories.set( - ModuleDecoratorDependency, - selfFactory - ); - compilation.dependencyTemplates.set( - ModuleDecoratorDependency, - new ModuleDecoratorDependency.Template() - ); - - compilation.hooks.runtimeRequirementInModule - .for(RuntimeGlobals.harmonyModuleDecorator) - .tap("CommonJsPlugin", (module, set) => { - set.add(RuntimeGlobals.module); - set.add(RuntimeGlobals.requireScope); - }); - - compilation.hooks.runtimeRequirementInModule - .for(RuntimeGlobals.nodeModuleDecorator) - .tap("CommonJsPlugin", (module, set) => { - set.add(RuntimeGlobals.module); - set.add(RuntimeGlobals.requireScope); - }); - - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.harmonyModuleDecorator) - .tap("CommonJsPlugin", (chunk, set) => { - compilation.addRuntimeModule( - chunk, - new HarmonyModuleDecoratorRuntimeModule() - ); - }); - - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.nodeModuleDecorator) - .tap("CommonJsPlugin", (chunk, set) => { - compilation.addRuntimeModule( - chunk, - new NodeModuleDecoratorRuntimeModule() - ); - }); - - const handler = (parser, parserOptions) => { - if (parserOptions.commonjs !== undefined && !parserOptions.commonjs) - return; - parser.hooks.typeof - .for("module") - .tap( - "CommonJsPlugin", - toConstantDependency(parser, JSON.stringify("object")) - ); - - parser.hooks.expression - .for("require.main") - .tap( - "CommonJsPlugin", - toConstantDependency( - parser, - `${RuntimeGlobals.moduleCache}[${RuntimeGlobals.entryModuleId}]`, - [RuntimeGlobals.moduleCache, RuntimeGlobals.entryModuleId] - ) - ); - parser.hooks.expression - .for("module.loaded") - .tap("CommonJsPlugin", expr => { - parser.state.module.buildInfo.moduleConcatenationBailout = - "module.loaded"; - const dep = new RuntimeRequirementsDependency([ - RuntimeGlobals.moduleLoaded - ]); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - - parser.hooks.expression - .for("module.id") - .tap("CommonJsPlugin", expr => { - parser.state.module.buildInfo.moduleConcatenationBailout = - "module.id"; - const dep = new RuntimeRequirementsDependency([ - RuntimeGlobals.moduleId - ]); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - - parser.hooks.evaluateIdentifier.for("module.hot").tap( - "CommonJsPlugin", - evaluateToIdentifier("module.hot", "module", () => ["hot"], null) - ); - - new CommonJsImportsParserPlugin(parserOptions).apply(parser); - new CommonJsExportsParserPlugin(compilation.moduleGraph).apply( - parser - ); + switch (mode.type) { + case "missing": + return undefined; + case "dynamic-reexport": { + const from = moduleGraph.getConnection(this); + return { + exports: true, + from, + canMangle: false, + excludeExports: mode.hidden + ? combine(mode.ignored, mode.hidden) + : mode.ignored, + hideExports: mode.hidden, + dependencies: [from.module] }; - - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("CommonJsPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("CommonJsPlugin", handler); } - ); - } -} - -class HarmonyModuleDecoratorRuntimeModule extends RuntimeModule { - constructor() { - super("harmony module decorator"); + case "empty-star": + return { + exports: [], + hideExports: mode.hidden, + dependencies: [moduleGraph.getModule(this)] + }; + // falls through + case "normal-reexport": { + const from = moduleGraph.getConnection(this); + return { + exports: Array.from(mode.items, item => ({ + name: item.name, + from, + export: item.ids, + hidden: item.hidden + })), + priority: 1, + dependencies: [from.module] + }; + } + case "reexport-dynamic-default": { + { + const from = moduleGraph.getConnection(this); + return { + exports: [ + { + name: mode.name, + from, + export: ["default"] + } + ], + priority: 1, + dependencies: [from.module] + }; + } + } + case "reexport-undefined": + return { + exports: [mode.name], + dependencies: [moduleGraph.getModule(this)] + }; + case "reexport-fake-namespace-object": { + const from = moduleGraph.getConnection(this); + return { + exports: [ + { + name: mode.name, + from, + export: null, + exports: [ + { + name: "default", + canMangle: false, + from, + export: null + } + ] + } + ], + priority: 1, + dependencies: [from.module] + }; + } + case "reexport-namespace-object": { + const from = moduleGraph.getConnection(this); + return { + exports: [ + { + name: mode.name, + from, + export: null + } + ], + priority: 1, + dependencies: [from.module] + }; + } + case "reexport-named-default": { + const from = moduleGraph.getConnection(this); + return { + exports: [ + { + name: mode.name, + from, + export: ["default"] + } + ], + priority: 1, + dependencies: [from.module] + }; + } + default: + throw new Error(`Unknown mode ${mode.type}`); + } } /** - * @returns {string} runtime code + * @param {ModuleGraph} moduleGraph module graph + * @returns {number} effective mode */ - generate() { - const { runtimeTemplate } = this.compilation; - return Template.asString([ - `${ - RuntimeGlobals.harmonyModuleDecorator - } = ${runtimeTemplate.basicFunction("module", [ - "module = Object.create(module);", - "if (!module.children) module.children = [];", - "Object.defineProperty(module, 'exports', {", - Template.indent([ - "enumerable: true,", - `set: ${runtimeTemplate.basicFunction("", [ - "throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id);" - ])}` - ]), - "});", - "return module;" - ])};` - ]); - } -} - -class NodeModuleDecoratorRuntimeModule extends RuntimeModule { - constructor() { - super("node module decorator"); + _getEffectiveExportPresenceLevel(moduleGraph) { + if (this.exportPresenceMode !== ExportPresenceModes.AUTO) + return this.exportPresenceMode; + return moduleGraph.getParentModule(this).buildMeta.strictHarmonyModule + ? ExportPresenceModes.ERROR + : ExportPresenceModes.WARN; } /** - * @returns {string} runtime code + * Returns warnings + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[]} warnings */ - generate() { - const { runtimeTemplate } = this.compilation; - return Template.asString([ - `${RuntimeGlobals.nodeModuleDecorator} = ${runtimeTemplate.basicFunction( - "module", - [ - "module.paths = [];", - "if (!module.children) module.children = [];", - "return module;" - ] - )};` - ]); + getWarnings(moduleGraph) { + const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); + if (exportsPresence === ExportPresenceModes.WARN) { + return this._getErrors(moduleGraph); + } + return null; } -} - -module.exports = CommonJsPlugin; - -/***/ }), - -/***/ 23962: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const makeSerializable = __webpack_require__(33032); -const ContextDependency = __webpack_require__(88101); -const ContextDependencyTemplateAsRequireCall = __webpack_require__(75815); - -class CommonJsRequireContextDependency extends ContextDependency { - constructor(options, range, valueRange, inShorthand) { - super(options); - - this.range = range; - this.valueRange = valueRange; - // inShorthand must be serialized by subclasses that use it - this.inShorthand = inShorthand; + /** + * Returns errors + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[]} errors + */ + getErrors(moduleGraph) { + const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); + if (exportsPresence === ExportPresenceModes.ERROR) { + return this._getErrors(moduleGraph); + } + return null; } - get type() { - return "cjs require context"; + /** + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[] | undefined} errors + */ + _getErrors(moduleGraph) { + const ids = this.getIds(moduleGraph); + let errors = this.getLinkingErrors( + moduleGraph, + ids, + `(reexported as '${this.name}')` + ); + if (ids.length === 0 && this.name === null) { + const potentialConflicts = + this._discoverActiveExportsFromOtherStarExports(moduleGraph); + if (potentialConflicts && potentialConflicts.namesSlice > 0) { + const ownNames = new Set( + potentialConflicts.names.slice( + potentialConflicts.namesSlice, + potentialConflicts.dependencyIndices[ + potentialConflicts.dependencyIndex + ] + ) + ); + const importedModule = moduleGraph.getModule(this); + if (importedModule) { + const exportsInfo = moduleGraph.getExportsInfo(importedModule); + const conflicts = new Map(); + for (const exportInfo of exportsInfo.orderedExports) { + if (exportInfo.provided !== true) continue; + if (exportInfo.name === "default") continue; + if (this.activeExports.has(exportInfo.name)) continue; + if (ownNames.has(exportInfo.name)) continue; + const conflictingDependency = findDependencyForName( + potentialConflicts, + exportInfo.name, + this.allStarExports + ? this.allStarExports.dependencies + : [...this.otherStarExports, this] + ); + if (!conflictingDependency) continue; + const target = exportInfo.getTerminalBinding(moduleGraph); + if (!target) continue; + const conflictingModule = moduleGraph.getModule( + conflictingDependency + ); + if (conflictingModule === importedModule) continue; + const conflictingExportInfo = moduleGraph.getExportInfo( + conflictingModule, + exportInfo.name + ); + const conflictingTarget = + conflictingExportInfo.getTerminalBinding(moduleGraph); + if (!conflictingTarget) continue; + if (target === conflictingTarget) continue; + const list = conflicts.get(conflictingDependency.request); + if (list === undefined) { + conflicts.set(conflictingDependency.request, [exportInfo.name]); + } else { + list.push(exportInfo.name); + } + } + for (const [request, exports] of conflicts) { + if (!errors) errors = []; + errors.push( + new HarmonyLinkingError( + `The requested module '${ + this.request + }' contains conflicting star exports for the ${ + exports.length > 1 ? "names" : "name" + } ${exports + .map(e => `'${e}'`) + .join(", ")} with the previous requested module '${request}'` + ) + ); + } + } + } + } + return errors; } serialize(context) { - const { write } = context; + const { write, setCircularReference } = context; - write(this.range); - write(this.valueRange); - write(this.inShorthand); + setCircularReference(this); + write(this.ids); + write(this.name); + write(this.activeExports); + write(this.otherStarExports); + write(this.exportPresenceMode); + write(this.allStarExports); super.serialize(context); } deserialize(context) { - const { read } = context; + const { read, setCircularReference } = context; - this.range = read(); - this.valueRange = read(); - this.inShorthand = read(); + setCircularReference(this); + this.ids = read(); + this.name = read(); + this.activeExports = read(); + this.otherStarExports = read(); + this.exportPresenceMode = read(); + this.allStarExports = read(); super.deserialize(context); } } makeSerializable( - CommonJsRequireContextDependency, - "webpack/lib/dependencies/CommonJsRequireContextDependency" + HarmonyExportImportedSpecifierDependency, + "webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency" ); -CommonJsRequireContextDependency.Template = - ContextDependencyTemplateAsRequireCall; +module.exports = HarmonyExportImportedSpecifierDependency; -module.exports = CommonJsRequireContextDependency; +HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedSpecifierDependencyTemplate extends ( + HarmonyImportDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply(dependency, source, templateContext) { + const { moduleGraph, runtime, concatenationScope } = templateContext; + const dep = /** @type {HarmonyExportImportedSpecifierDependency} */ ( + dependency + ); -/***/ }), + const mode = dep.getMode(moduleGraph, runtime); -/***/ 21264: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (concatenationScope) { + switch (mode.type) { + case "reexport-undefined": + concatenationScope.registerRawExport( + mode.name, + "/* reexport non-default export from non-harmony */ undefined" + ); + } + return; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (mode.type !== "unused" && mode.type !== "empty-star") { + super.apply(dependency, source, templateContext); + this._addExportFragments( + templateContext.initFragments, + dep, + mode, + templateContext.module, + moduleGraph, + runtime, + templateContext.runtimeTemplate, + templateContext.runtimeRequirements + ); + } + } + /** + * @param {InitFragment[]} initFragments target array for init fragments + * @param {HarmonyExportImportedSpecifierDependency} dep dependency + * @param {ExportMode} mode the export mode + * @param {Module} module the current module + * @param {ModuleGraph} moduleGraph the module graph + * @param {RuntimeSpec} runtime the runtime + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @param {Set} runtimeRequirements runtime requirements + * @returns {void} + */ + _addExportFragments( + initFragments, + dep, + mode, + module, + moduleGraph, + runtime, + runtimeTemplate, + runtimeRequirements + ) { + const importedModule = moduleGraph.getModule(dep); + const importVar = dep.getImportVar(moduleGraph); -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); -const ModuleDependencyTemplateAsId = __webpack_require__(80825); + switch (mode.type) { + case "missing": + case "empty-star": + initFragments.push( + new InitFragment( + "/* empty/unused harmony star reexport */\n", + InitFragment.STAGE_HARMONY_EXPORTS, + 1 + ) + ); + break; -class CommonJsRequireDependency extends ModuleDependency { - constructor(request, range) { - super(request); - this.range = range; - } + case "unused": + initFragments.push( + new InitFragment( + `${Template.toNormalComment( + `unused harmony reexport ${mode.name}` + )}\n`, + InitFragment.STAGE_HARMONY_EXPORTS, + 1 + ) + ); + break; - get type() { - return "cjs require"; - } + case "reexport-dynamic-default": + initFragments.push( + this.getReexportFragment( + module, + "reexport default from dynamic", + moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), + importVar, + null, + runtimeRequirements + ) + ); + break; - get category() { - return "commonjs"; - } -} + case "reexport-fake-namespace-object": + initFragments.push( + ...this.getReexportFakeNamespaceObjectFragments( + module, + moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), + importVar, + mode.fakeType, + runtimeRequirements + ) + ); + break; -CommonJsRequireDependency.Template = ModuleDependencyTemplateAsId; + case "reexport-undefined": + initFragments.push( + this.getReexportFragment( + module, + "reexport non-default export from non-harmony", + moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), + "undefined", + "", + runtimeRequirements + ) + ); + break; -makeSerializable( - CommonJsRequireDependency, - "webpack/lib/dependencies/CommonJsRequireDependency" -); + case "reexport-named-default": + initFragments.push( + this.getReexportFragment( + module, + "reexport default export from named module", + moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), + importVar, + "", + runtimeRequirements + ) + ); + break; -module.exports = CommonJsRequireDependency; + case "reexport-namespace-object": + initFragments.push( + this.getReexportFragment( + module, + "reexport module object", + moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), + importVar, + "", + runtimeRequirements + ) + ); + break; + case "normal-reexport": + for (const { name, ids, checked, hidden } of mode.items) { + if (hidden) continue; + if (checked) { + initFragments.push( + new InitFragment( + "/* harmony reexport (checked) */ " + + this.getConditionalReexportStatement( + module, + name, + importVar, + ids, + runtimeRequirements + ), + moduleGraph.isAsync(importedModule) + ? InitFragment.STAGE_ASYNC_HARMONY_IMPORTS + : InitFragment.STAGE_HARMONY_IMPORTS, + dep.sourceOrder + ) + ); + } else { + initFragments.push( + this.getReexportFragment( + module, + "reexport safe", + moduleGraph.getExportsInfo(module).getUsedName(name, runtime), + importVar, + moduleGraph + .getExportsInfo(importedModule) + .getUsedName(ids, runtime), + runtimeRequirements + ) + ); + } + } + break; -/***/ }), + case "dynamic-reexport": { + const ignored = mode.hidden + ? combine(mode.ignored, mode.hidden) + : mode.ignored; + const modern = + runtimeTemplate.supportsConst() && + runtimeTemplate.supportsArrowFunction(); + let content = + "/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};\n" + + `/* harmony reexport (unknown) */ for(${ + modern ? "const" : "var" + } __WEBPACK_IMPORT_KEY__ in ${importVar}) `; -/***/ 52225: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Filter out exports which are defined by other exports + // and filter out default export because it cannot be reexported with * + if (ignored.size > 1) { + content += + "if(" + + JSON.stringify(Array.from(ignored)) + + ".indexOf(__WEBPACK_IMPORT_KEY__) < 0) "; + } else if (ignored.size === 1) { + content += `if(__WEBPACK_IMPORT_KEY__ !== ${JSON.stringify( + first(ignored) + )}) `; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + content += `__WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = `; + if (modern) { + content += `() => ${importVar}[__WEBPACK_IMPORT_KEY__]`; + } else { + content += `function(key) { return ${importVar}[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)`; + } + runtimeRequirements.add(RuntimeGlobals.exports); + runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); + const exportsName = module.exportsArgument; + initFragments.push( + new InitFragment( + `${content}\n/* harmony reexport (unknown) */ ${RuntimeGlobals.definePropertyGetters}(${exportsName}, __WEBPACK_REEXPORT_OBJECT__);\n`, + moduleGraph.isAsync(importedModule) + ? InitFragment.STAGE_ASYNC_HARMONY_IMPORTS + : InitFragment.STAGE_HARMONY_IMPORTS, + dep.sourceOrder + ) + ); + break; + } -const RuntimeGlobals = __webpack_require__(16475); -const { equals } = __webpack_require__(84953); -const makeSerializable = __webpack_require__(33032); -const propertyAccess = __webpack_require__(54190); -const NullDependency = __webpack_require__(31830); + default: + throw new Error(`Unknown mode ${mode.type}`); + } + } -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + getReexportFragment( + module, + comment, + key, + name, + valueKey, + runtimeRequirements + ) { + const returnValue = this.getReturnValue(name, valueKey); -class CommonJsSelfReferenceDependency extends NullDependency { - constructor(range, base, names, call) { - super(); - this.range = range; - this.base = base; - this.names = names; - this.call = call; - } + runtimeRequirements.add(RuntimeGlobals.exports); + runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); - get type() { - return "cjs self exports reference"; - } + const map = new Map(); + map.set(key, `/* ${comment} */ ${returnValue}`); - get category() { - return "self"; + return new HarmonyExportInitFragment(module.exportsArgument, map); } - /** - * @returns {string | null} an identifier to merge equal requests - */ - getResourceIdentifier() { - return `self`; - } + getReexportFakeNamespaceObjectFragments( + module, + key, + name, + fakeType, + runtimeRequirements + ) { + runtimeRequirements.add(RuntimeGlobals.exports); + runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); + runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - return [this.call ? this.names.slice(0, -1) : this.names]; + const map = new Map(); + map.set( + key, + `/* reexport fake namespace object from non-harmony */ ${name}_namespace_cache || (${name}_namespace_cache = ${ + RuntimeGlobals.createFakeNamespaceObject + }(${name}${fakeType ? `, ${fakeType}` : ""}))` + ); + + return [ + new InitFragment( + `var ${name}_namespace_cache;\n`, + InitFragment.STAGE_CONSTANTS, + -1, + `${name}_namespace_cache` + ), + new HarmonyExportInitFragment(module.exportsArgument, map) + ]; } - serialize(context) { - const { write } = context; - write(this.range); - write(this.base); - write(this.names); - write(this.call); - super.serialize(context); + getConditionalReexportStatement( + module, + key, + name, + valueKey, + runtimeRequirements + ) { + if (valueKey === false) { + return "/* unused export */\n"; + } + + const exportsName = module.exportsArgument; + const returnValue = this.getReturnValue(name, valueKey); + + runtimeRequirements.add(RuntimeGlobals.exports); + runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); + runtimeRequirements.add(RuntimeGlobals.hasOwnProperty); + + return `if(${RuntimeGlobals.hasOwnProperty}(${name}, ${JSON.stringify( + valueKey[0] + )})) ${ + RuntimeGlobals.definePropertyGetters + }(${exportsName}, { ${JSON.stringify( + key + )}: function() { return ${returnValue}; } });\n`; } - deserialize(context) { - const { read } = context; - this.range = read(); - this.base = read(); - this.names = read(); - this.call = read(); - super.deserialize(context); + getReturnValue(name, valueKey) { + if (valueKey === null) { + return `${name}_default.a`; + } + + if (valueKey === "") { + return name; + } + + if (valueKey === false) { + return "/* unused export */ undefined"; + } + + return `${name}${propertyAccess(valueKey)}`; } -} +}; -makeSerializable( - CommonJsSelfReferenceDependency, - "webpack/lib/dependencies/CommonJsSelfReferenceDependency" -); +class HarmonyStarExportsList { + constructor() { + /** @type {HarmonyExportImportedSpecifierDependency[]} */ + this.dependencies = []; + } -CommonJsSelfReferenceDependency.Template = class CommonJsSelfReferenceDependencyTemplate extends ( - NullDependency.Template -) { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object + * @param {HarmonyExportImportedSpecifierDependency} dep dependency * @returns {void} */ - apply( - dependency, - source, - { module, moduleGraph, runtime, runtimeRequirements } - ) { - const dep = /** @type {CommonJsSelfReferenceDependency} */ (dependency); - let used; - if (dep.names.length === 0) { - used = dep.names; - } else { - used = moduleGraph.getExportsInfo(module).getUsedName(dep.names, runtime); - } - if (!used) { - throw new Error( - "Self-reference dependency has unused export name: This should not happen" - ); - } + push(dep) { + this.dependencies.push(dep); + } - let base = undefined; - switch (dep.base) { - case "exports": - runtimeRequirements.add(RuntimeGlobals.exports); - base = module.exportsArgument; - break; - case "module.exports": - runtimeRequirements.add(RuntimeGlobals.module); - base = `${module.moduleArgument}.exports`; - break; - case "this": - runtimeRequirements.add(RuntimeGlobals.thisAsExports); - base = "this"; - break; - default: - throw new Error(`Unsupported base ${dep.base}`); - } + slice() { + return this.dependencies.slice(); + } - if (base === dep.base && equals(used, dep.names)) { - // Nothing has to be changed - // We don't use a replacement for compat reasons - // for plugins that update `module._source` which they - // shouldn't do! - return; - } + serialize({ write, setCircularReference }) { + setCircularReference(this); + write(this.dependencies); + } - source.replace( - dep.range[0], - dep.range[1] - 1, - `${base}${propertyAccess(used)}` - ); + deserialize({ read, setCircularReference }) { + setCircularReference(this); + this.dependencies = read(); } -}; +} -module.exports = CommonJsSelfReferenceDependency; +makeSerializable( + HarmonyStarExportsList, + "webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency", + "HarmonyStarExportsList" +); + +module.exports.HarmonyStarExportsList = HarmonyStarExportsList; /***/ }), -/***/ 76911: +/***/ 89500: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -81741,112 +78394,169 @@ module.exports = CommonJsSelfReferenceDependency; -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../util/Hash")} Hash */ +const InitFragment = __webpack_require__(55870); +const RuntimeGlobals = __webpack_require__(16475); +const { first } = __webpack_require__(93347); -class ConstDependency extends NullDependency { - /** - * @param {string} expression the expression - * @param {number|[number, number]} range the source range - * @param {string[]=} runtimeRequirements runtime requirements - */ - constructor(expression, range, runtimeRequirements) { - super(); - this.expression = expression; - this.range = range; - this.runtimeRequirements = runtimeRequirements - ? new Set(runtimeRequirements) - : null; - this._hashUpdate = undefined; - } +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ - /** - * Update the hash - * @param {Hash} hash hash to be updated - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - if (this._hashUpdate === undefined) { - let hashUpdate = "" + this.range + "|" + this.expression; - if (this.runtimeRequirements) { - for (const item of this.runtimeRequirements) { - hashUpdate += "|"; - hashUpdate += item; - } - } - this._hashUpdate = hashUpdate; +const joinIterableWithComma = iterable => { + // This is more performant than Array.from().join(", ") + // as it doesn't create an array + let str = ""; + let first = true; + for (const item of iterable) { + if (first) { + first = false; + } else { + str += ", "; } - hash.update(this._hashUpdate); + str += item; } + return str; +}; +const EMPTY_MAP = new Map(); +const EMPTY_SET = new Set(); + +/** + * @typedef {GenerateContext} Context + */ +class HarmonyExportInitFragment extends InitFragment { /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this dependency connects the module to referencing modules + * @param {string} exportsArgument the exports identifier + * @param {Map} exportMap mapping from used name to exposed variable name + * @param {Set} unusedExports list of unused export names */ - getModuleEvaluationSideEffectsState(moduleGraph) { - return false; + constructor( + exportsArgument, + exportMap = EMPTY_MAP, + unusedExports = EMPTY_SET + ) { + super(undefined, InitFragment.STAGE_HARMONY_EXPORTS, 1, "harmony-exports"); + this.exportsArgument = exportsArgument; + this.exportMap = exportMap; + this.unusedExports = unusedExports; } - serialize(context) { - const { write } = context; - write(this.expression); - write(this.range); - write(this.runtimeRequirements); - super.serialize(context); - } + /** + * @param {HarmonyExportInitFragment[]} fragments all fragments to merge + * @returns {HarmonyExportInitFragment} merged fragment + */ + mergeAll(fragments) { + let exportMap; + let exportMapOwned = false; + let unusedExports; + let unusedExportsOwned = false; - deserialize(context) { - const { read } = context; - this.expression = read(); - this.range = read(); - this.runtimeRequirements = read(); - super.deserialize(context); + for (const fragment of fragments) { + if (fragment.exportMap.size !== 0) { + if (exportMap === undefined) { + exportMap = fragment.exportMap; + exportMapOwned = false; + } else { + if (!exportMapOwned) { + exportMap = new Map(exportMap); + exportMapOwned = true; + } + for (const [key, value] of fragment.exportMap) { + if (!exportMap.has(key)) exportMap.set(key, value); + } + } + } + if (fragment.unusedExports.size !== 0) { + if (unusedExports === undefined) { + unusedExports = fragment.unusedExports; + unusedExportsOwned = false; + } else { + if (!unusedExportsOwned) { + unusedExports = new Set(unusedExports); + unusedExportsOwned = true; + } + for (const value of fragment.unusedExports) { + unusedExports.add(value); + } + } + } + } + return new HarmonyExportInitFragment( + this.exportsArgument, + exportMap, + unusedExports + ); } -} - -makeSerializable(ConstDependency, "webpack/lib/dependencies/ConstDependency"); -ConstDependency.Template = class ConstDependencyTemplate extends ( - NullDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, templateContext) { - const dep = /** @type {ConstDependency} */ (dependency); - if (dep.runtimeRequirements) { - for (const req of dep.runtimeRequirements) { - templateContext.runtimeRequirements.add(req); + merge(other) { + let exportMap; + if (this.exportMap.size === 0) { + exportMap = other.exportMap; + } else if (other.exportMap.size === 0) { + exportMap = this.exportMap; + } else { + exportMap = new Map(other.exportMap); + for (const [key, value] of this.exportMap) { + if (!exportMap.has(key)) exportMap.set(key, value); } } - if (typeof dep.range === "number") { - source.insert(dep.range, dep.expression); - return; + let unusedExports; + if (this.unusedExports.size === 0) { + unusedExports = other.unusedExports; + } else if (other.unusedExports.size === 0) { + unusedExports = this.unusedExports; + } else { + unusedExports = new Set(other.unusedExports); + for (const value of this.unusedExports) { + unusedExports.add(value); + } } + return new HarmonyExportInitFragment( + this.exportsArgument, + exportMap, + unusedExports + ); + } - source.replace(dep.range[0], dep.range[1] - 1, dep.expression); + /** + * @param {Context} context context + * @returns {string|Source} the source code that will be included as initialization code + */ + getContent({ runtimeTemplate, runtimeRequirements }) { + runtimeRequirements.add(RuntimeGlobals.exports); + runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); + + const unusedPart = + this.unusedExports.size > 1 + ? `/* unused harmony exports ${joinIterableWithComma( + this.unusedExports + )} */\n` + : this.unusedExports.size > 0 + ? `/* unused harmony export ${first(this.unusedExports)} */\n` + : ""; + const definitions = []; + for (const [key, value] of this.exportMap) { + definitions.push( + `\n/* harmony export */ ${JSON.stringify( + key + )}: ${runtimeTemplate.returningFunction(value)}` + ); + } + const definePart = + this.exportMap.size > 0 + ? `/* harmony export */ ${RuntimeGlobals.definePropertyGetters}(${ + this.exportsArgument + }, {${definitions.join(",")}\n/* harmony export */ });\n` + : ""; + return `${definePart}${unusedPart}`; } -}; +} -module.exports = ConstDependency; +module.exports = HarmonyExportInitFragment; /***/ }), -/***/ 88101: +/***/ 48567: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -81857,152 +78567,116 @@ module.exports = ConstDependency; -const Dependency = __webpack_require__(54912); -const DependencyTemplate = __webpack_require__(5160); const makeSerializable = __webpack_require__(33032); -const memoize = __webpack_require__(78676); +const HarmonyExportInitFragment = __webpack_require__(89500); +const NullDependency = __webpack_require__(31830); -/** @typedef {import("../ContextModule").ContextOptions} ContextOptions */ -/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../WebpackError")} WebpackError */ - -const getCriticalDependencyWarning = memoize(() => - __webpack_require__(15427) -); - -/** @typedef {ContextOptions & { request: string }} ContextDependencyOptions */ - -const regExpToString = r => (r ? r + "" : ""); +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -class ContextDependency extends Dependency { - /** - * @param {ContextDependencyOptions} options options for the context module - */ - constructor(options) { +class HarmonyExportSpecifierDependency extends NullDependency { + constructor(id, name) { super(); - - this.options = options; - this.userRequest = this.options && this.options.request; - /** @type {false | string} */ - this.critical = false; - this.hadGlobalOrStickyRegExp = false; - - if ( - this.options && - (this.options.regExp.global || this.options.regExp.sticky) - ) { - this.options = { ...this.options, regExp: null }; - this.hadGlobalOrStickyRegExp = true; - } - - this.request = undefined; - this.range = undefined; - this.valueRange = undefined; - this.inShorthand = undefined; - // TODO refactor this - this.replaces = undefined; - } - - get category() { - return "commonjs"; + this.id = id; + this.name = name; } - /** - * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module - */ - couldAffectReferencingModule() { - return true; + get type() { + return "harmony export specifier"; } /** - * @returns {string | null} an identifier to merge equal requests + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names */ - getResourceIdentifier() { - return ( - `context${this.options.request} ${this.options.recursive} ` + - `${regExpToString(this.options.regExp)} ${regExpToString( - this.options.include - )} ${regExpToString(this.options.exclude)} ` + - `${this.options.mode} ${this.options.chunkName} ` + - `${JSON.stringify(this.options.groupOptions)}` - ); + getExports(moduleGraph) { + return { + exports: [this.name], + priority: 1, + terminalBinding: true, + dependencies: undefined + }; } /** - * Returns warnings - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[]} warnings + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this dependency connects the module to referencing modules */ - getWarnings(moduleGraph) { - let warnings = super.getWarnings(moduleGraph); - - if (this.critical) { - if (!warnings) warnings = []; - const CriticalDependencyWarning = getCriticalDependencyWarning(); - warnings.push(new CriticalDependencyWarning(this.critical)); - } - - if (this.hadGlobalOrStickyRegExp) { - if (!warnings) warnings = []; - const CriticalDependencyWarning = getCriticalDependencyWarning(); - warnings.push( - new CriticalDependencyWarning( - "Contexts can't use RegExps with the 'g' or 'y' flags." - ) - ); - } - - return warnings; + getModuleEvaluationSideEffectsState(moduleGraph) { + return false; } serialize(context) { const { write } = context; - - write(this.options); - write(this.userRequest); - write(this.critical); - write(this.hadGlobalOrStickyRegExp); - write(this.request); - write(this.range); - write(this.valueRange); - write(this.prepend); - write(this.replaces); - + write(this.id); + write(this.name); super.serialize(context); } deserialize(context) { const { read } = context; - - this.options = read(); - this.userRequest = read(); - this.critical = read(); - this.hadGlobalOrStickyRegExp = read(); - this.request = read(); - this.range = read(); - this.valueRange = read(); - this.prepend = read(); - this.replaces = read(); - + this.id = read(); + this.name = read(); super.deserialize(context); } } makeSerializable( - ContextDependency, - "webpack/lib/dependencies/ContextDependency" + HarmonyExportSpecifierDependency, + "webpack/lib/dependencies/HarmonyExportSpecifierDependency" ); -ContextDependency.Template = DependencyTemplate; +HarmonyExportSpecifierDependency.Template = class HarmonyExportSpecifierDependencyTemplate extends ( + NullDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply( + dependency, + source, + { module, moduleGraph, initFragments, runtime, concatenationScope } + ) { + const dep = /** @type {HarmonyExportSpecifierDependency} */ (dependency); + if (concatenationScope) { + concatenationScope.registerExport(dep.name, dep.id); + return; + } + const used = moduleGraph + .getExportsInfo(module) + .getUsedName(dep.name, runtime); + if (!used) { + const set = new Set(); + set.add(dep.name || "namespace"); + initFragments.push( + new HarmonyExportInitFragment(module.exportsArgument, undefined, set) + ); + return; + } -module.exports = ContextDependency; + const map = new Map(); + map.set(used, `/* binding */ ${dep.id}`); + initFragments.push( + new HarmonyExportInitFragment(module.exportsArgument, map, undefined) + ); + } +}; + +module.exports = HarmonyExportSpecifierDependency; /***/ }), -/***/ 99630: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 39211: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* @@ -82012,531 +78686,411 @@ module.exports = ContextDependency; -const { parseResource } = __webpack_require__(82186); +/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("estree").Node} EsTreeNode */ -/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ -/** @typedef {import("../../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */ -/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */ -/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ -/** @typedef {import("./ContextDependency")} ContextDependency */ -/** @typedef {import("./ContextDependency").ContextDependencyOptions} ContextDependencyOptions */ +/** @type {WeakMap} */ +const parserStateExportsState = new WeakMap(); /** - * Escapes regular expression metacharacters - * @param {string} str String to quote - * @returns {string} Escaped string + * @param {ParserState} parserState parser state + * @param {boolean} isStrictHarmony strict harmony mode should be enabled + * @returns {void} */ -const quoteMeta = str => { - return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); +exports.enable = (parserState, isStrictHarmony) => { + const value = parserStateExportsState.get(parserState); + if (value === false) return; + parserStateExportsState.set(parserState, true); + if (value !== true) { + parserState.module.buildMeta.exportsType = "namespace"; + parserState.module.buildInfo.strict = true; + parserState.module.buildInfo.exportsArgument = "__webpack_exports__"; + if (isStrictHarmony) { + parserState.module.buildMeta.strictHarmonyModule = true; + parserState.module.buildInfo.moduleArgument = "__webpack_module__"; + } + } }; -const splitContextFromPrefix = prefix => { - const idx = prefix.lastIndexOf("/"); - let context = "."; - if (idx >= 0) { - context = prefix.substr(0, idx); - prefix = `.${prefix.substr(idx)}`; - } - return { - context, - prefix - }; +/** + * @param {ParserState} parserState parser state + * @returns {boolean} true, when enabled + */ +exports.isEnabled = parserState => { + const value = parserStateExportsState.get(parserState); + return value === true; }; -/** @typedef {Partial>} PartialContextDependencyOptions */ -/** @typedef {{ new(options: ContextDependencyOptions, range: [number, number], valueRange: [number, number]): ContextDependency }} ContextDependencyConstructor */ +/***/ }), -/** - * @param {ContextDependencyConstructor} Dep the Dependency class - * @param {[number, number]} range source range - * @param {BasicEvaluatedExpression} param context param - * @param {EsTreeNode} expr expr - * @param {Pick} options options for context creation - * @param {PartialContextDependencyOptions} contextOptions options for the ContextModule - * @param {JavascriptParser} parser the parser - * @returns {ContextDependency} the created Dependency - */ -exports.create = (Dep, range, param, expr, options, contextOptions, parser) => { - if (param.isTemplateString()) { - let prefixRaw = param.quasis[0].string; - let postfixRaw = - param.quasis.length > 1 - ? param.quasis[param.quasis.length - 1].string - : ""; +/***/ 57154: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const valueRange = param.range; - const { context, prefix } = splitContextFromPrefix(prefixRaw); - const { - path: postfix, - query, - fragment - } = parseResource(postfixRaw, parser); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // When there are more than two quasis, the generated RegExp can be more precise - // We join the quasis with the expression regexp - const innerQuasis = param.quasis.slice(1, param.quasis.length - 1); - const innerRegExp = - options.wrappedContextRegExp.source + - innerQuasis - .map(q => quoteMeta(q.string) + options.wrappedContextRegExp.source) - .join(""); - // Example: `./context/pre${e}inner${e}inner2${e}post?query#frag` - // context: "./context" - // prefix: "./pre" - // innerQuasis: [BEE("inner"), BEE("inner2")] - // (BEE = BasicEvaluatedExpression) - // postfix: "post" - // query: "?query" - // fragment: "#frag" - // regExp: /^\.\/pre.*inner.*inner2.*post$/ - const regExp = new RegExp( - `^${quoteMeta(prefix)}${innerRegExp}${quoteMeta(postfix)}$` - ); - const dep = new Dep( - { - request: context + query + fragment, - recursive: options.wrappedContextRecursive, - regExp, - mode: "sync", - ...contextOptions - }, - range, - valueRange - ); - dep.loc = expr.loc; - const replaces = []; - param.parts.forEach((part, i) => { - if (i % 2 === 0) { - // Quasis or merged quasi - let range = part.range; - let value = part.string; - if (param.templateStringKind === "cooked") { - value = JSON.stringify(value); - value = value.slice(1, value.length - 1); - } - if (i === 0) { - // prefix - value = prefix; - range = [param.range[0], part.range[1]]; - value = - (param.templateStringKind === "cooked" ? "`" : "String.raw`") + - value; - } else if (i === param.parts.length - 1) { - // postfix - value = postfix; - range = [part.range[0], param.range[1]]; - value = value + "`"; - } else if ( - part.expression && - part.expression.type === "TemplateElement" && - part.expression.value.raw === value - ) { - // Shortcut when it's a single quasi and doesn't need to be replaced - return; - } - replaces.push({ - range, - value - }); - } else { - // Expression - parser.walkExpression(part.expression); - } - }); +const ConditionalInitFragment = __webpack_require__(61333); +const Dependency = __webpack_require__(54912); +const HarmonyLinkingError = __webpack_require__(97511); +const InitFragment = __webpack_require__(55870); +const Template = __webpack_require__(1626); +const AwaitDependenciesInitFragment = __webpack_require__(41153); +const { filterRuntime, mergeRuntime } = __webpack_require__(17156); +const ModuleDependency = __webpack_require__(80321); - dep.replaces = replaces; - dep.critical = - options.wrappedContextCritical && - "a part of the request of a dependency is an expression"; - return dep; - } else if ( - param.isWrapped() && - ((param.prefix && param.prefix.isString()) || - (param.postfix && param.postfix.isString())) - ) { - let prefixRaw = - param.prefix && param.prefix.isString() ? param.prefix.string : ""; - let postfixRaw = - param.postfix && param.postfix.isString() ? param.postfix.string : ""; - const prefixRange = - param.prefix && param.prefix.isString() ? param.prefix.range : null; - const postfixRange = - param.postfix && param.postfix.isString() ? param.postfix.range : null; - const valueRange = param.range; - const { context, prefix } = splitContextFromPrefix(prefixRaw); - const { - path: postfix, - query, - fragment - } = parseResource(postfixRaw, parser); - const regExp = new RegExp( - `^${quoteMeta(prefix)}${options.wrappedContextRegExp.source}${quoteMeta( - postfix - )}$` - ); - const dep = new Dep( - { - request: context + query + fragment, - recursive: options.wrappedContextRecursive, - regExp, - mode: "sync", - ...contextOptions - }, - range, - valueRange - ); - dep.loc = expr.loc; - const replaces = []; - if (prefixRange) { - replaces.push({ - range: prefixRange, - value: JSON.stringify(prefix) - }); - } - if (postfixRange) { - replaces.push({ - range: postfixRange, - value: JSON.stringify(postfix) - }); - } - dep.replaces = replaces; - dep.critical = - options.wrappedContextCritical && - "a part of the request of a dependency is an expression"; +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - if (parser && param.wrappedInnerExpressions) { - for (const part of param.wrappedInnerExpressions) { - if (part.expression) parser.walkExpression(part.expression); - } +const ExportPresenceModes = { + NONE: /** @type {0} */ (0), + WARN: /** @type {1} */ (1), + AUTO: /** @type {2} */ (2), + ERROR: /** @type {3} */ (3), + fromUserOption(str) { + switch (str) { + case "error": + return ExportPresenceModes.ERROR; + case "warn": + return ExportPresenceModes.WARN; + case "auto": + return ExportPresenceModes.AUTO; + case false: + return ExportPresenceModes.NONE; + default: + throw new Error(`Invalid export presence value ${str}`); } - - return dep; - } else { - const dep = new Dep( - { - request: options.exprContextRequest, - recursive: options.exprContextRecursive, - regExp: /** @type {RegExp} */ (options.exprContextRegExp), - mode: "sync", - ...contextOptions - }, - range, - param.range - ); - dep.loc = expr.loc; - dep.critical = - options.exprContextCritical && - "the request of a dependency is an expression"; - - parser.walkExpression(param.expression); - - return dep; } }; - -/***/ }), - -/***/ 76081: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const ContextDependency = __webpack_require__(88101); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ - -class ContextDependencyTemplateAsId extends ContextDependency.Template { +class HarmonyImportDependency extends ModuleDependency { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} + * + * @param {string} request request string + * @param {number} sourceOrder source order + * @param {Record=} assertions import assertions */ - apply( - dependency, - source, - { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } - ) { - const dep = /** @type {ContextDependency} */ (dependency); - const moduleExports = runtimeTemplate.moduleExports({ - module: moduleGraph.getModule(dep), - chunkGraph, - request: dep.request, - weak: dep.weak, - runtimeRequirements - }); - - if (moduleGraph.getModule(dep)) { - if (dep.valueRange) { - if (Array.isArray(dep.replaces)) { - for (let i = 0; i < dep.replaces.length; i++) { - const rep = dep.replaces[i]; - source.replace(rep.range[0], rep.range[1] - 1, rep.value); - } - } - source.replace(dep.valueRange[1], dep.range[1] - 1, ")"); - source.replace( - dep.range[0], - dep.valueRange[0] - 1, - `${moduleExports}.resolve(` - ); - } else { - source.replace( - dep.range[0], - dep.range[1] - 1, - `${moduleExports}.resolve` - ); - } - } else { - source.replace(dep.range[0], dep.range[1] - 1, moduleExports); - } + constructor(request, sourceOrder, assertions) { + super(request); + this.sourceOrder = sourceOrder; + this.assertions = assertions; } -} -module.exports = ContextDependencyTemplateAsId; - - -/***/ }), - -/***/ 75815: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - + get category() { + return "esm"; + } -const ContextDependency = __webpack_require__(88101); + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + return Dependency.NO_EXPORTS_REFERENCED; + } -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {string} name of the variable for the import + */ + getImportVar(moduleGraph) { + const module = moduleGraph.getParentModule(this); + const meta = moduleGraph.getMeta(module); + let importVarMap = meta.importVarMap; + if (!importVarMap) meta.importVarMap = importVarMap = new Map(); + let importVar = importVarMap.get(moduleGraph.getModule(this)); + if (importVar) return importVar; + importVar = `${Template.toIdentifier( + `${this.userRequest}` + )}__WEBPACK_IMPORTED_MODULE_${importVarMap.size}__`; + importVarMap.set(moduleGraph.getModule(this), importVar); + return importVar; + } -class ContextDependencyTemplateAsRequireCall extends ContextDependency.Template { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} + * @param {boolean} update create new variables or update existing one + * @param {DependencyTemplateContext} templateContext the template context + * @returns {[string, string]} the import statement and the compat statement */ - apply( - dependency, - source, - { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } + getImportStatement( + update, + { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements } ) { - const dep = /** @type {ContextDependency} */ (dependency); - let moduleExports = runtimeTemplate.moduleExports({ - module: moduleGraph.getModule(dep), + return runtimeTemplate.importStatement({ + update, + module: moduleGraph.getModule(this), chunkGraph, - request: dep.request, + importVar: this.getImportVar(moduleGraph), + request: this.request, + originModule: module, runtimeRequirements }); - - if (dep.inShorthand) { - moduleExports = `${dep.inShorthand}: ${moduleExports}`; - } - if (moduleGraph.getModule(dep)) { - if (dep.valueRange) { - if (Array.isArray(dep.replaces)) { - for (let i = 0; i < dep.replaces.length; i++) { - const rep = dep.replaces[i]; - source.replace(rep.range[0], rep.range[1] - 1, rep.value); - } - } - source.replace(dep.valueRange[1], dep.range[1] - 1, ")"); - source.replace( - dep.range[0], - dep.valueRange[0] - 1, - `${moduleExports}(` - ); - } else { - source.replace(dep.range[0], dep.range[1] - 1, moduleExports); - } - } else { - source.replace(dep.range[0], dep.range[1] - 1, moduleExports); - } } -} -module.exports = ContextDependencyTemplateAsRequireCall; - - -/***/ }), - -/***/ 58477: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - + /** + * @param {ModuleGraph} moduleGraph module graph + * @param {string[]} ids imported ids + * @param {string} additionalMessage extra info included in the error message + * @returns {WebpackError[] | undefined} errors + */ + getLinkingErrors(moduleGraph, ids, additionalMessage) { + const importedModule = moduleGraph.getModule(this); + // ignore errors for missing or failed modules + if (!importedModule || importedModule.getNumberOfErrors() > 0) { + return; + } -const Dependency = __webpack_require__(54912); -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); + const parentModule = moduleGraph.getParentModule(this); + const exportsType = importedModule.getExportsType( + moduleGraph, + parentModule.buildMeta.strictHarmonyModule + ); + if (exportsType === "namespace" || exportsType === "default-with-named") { + if (ids.length === 0) { + return; + } -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + if ( + (exportsType !== "default-with-named" || ids[0] !== "default") && + moduleGraph.isExportProvided(importedModule, ids) === false + ) { + // We are sure that it's not provided -class ContextElementDependency extends ModuleDependency { - constructor(request, userRequest, typePrefix, category, referencedExports) { - super(request); - this.referencedExports = referencedExports; - this._typePrefix = typePrefix; - this._category = category; + // Try to provide detailed info in the error message + let pos = 0; + let exportsInfo = moduleGraph.getExportsInfo(importedModule); + while (pos < ids.length && exportsInfo) { + const id = ids[pos++]; + const exportInfo = exportsInfo.getReadOnlyExportInfo(id); + if (exportInfo.provided === false) { + // We are sure that it's not provided + const providedExports = exportsInfo.getProvidedExports(); + const moreInfo = !Array.isArray(providedExports) + ? " (possible exports unknown)" + : providedExports.length === 0 + ? " (module has no exports)" + : ` (possible exports: ${providedExports.join(", ")})`; + return [ + new HarmonyLinkingError( + `export ${ids + .slice(0, pos) + .map(id => `'${id}'`) + .join(".")} ${additionalMessage} was not found in '${ + this.userRequest + }'${moreInfo}` + ) + ]; + } + exportsInfo = exportInfo.getNestedExportsInfo(); + } - if (userRequest) { - this.userRequest = userRequest; + // General error message + return [ + new HarmonyLinkingError( + `export ${ids + .map(id => `'${id}'`) + .join(".")} ${additionalMessage} was not found in '${ + this.userRequest + }'` + ) + ]; + } } - } - - get type() { - if (this._typePrefix) { - return `${this._typePrefix} context element`; + switch (exportsType) { + case "default-only": + // It's has only a default export + if (ids.length > 0 && ids[0] !== "default") { + // In strict harmony modules we only support the default export + return [ + new HarmonyLinkingError( + `Can't import the named export ${ids + .map(id => `'${id}'`) + .join( + "." + )} ${additionalMessage} from default-exporting module (only default export is available)` + ) + ]; + } + break; + case "default-with-named": + // It has a default export and named properties redirect + // In some cases we still want to warn here + if ( + ids.length > 0 && + ids[0] !== "default" && + importedModule.buildMeta.defaultObject === "redirect-warn" + ) { + // For these modules only the default export is supported + return [ + new HarmonyLinkingError( + `Should not import the named export ${ids + .map(id => `'${id}'`) + .join( + "." + )} ${additionalMessage} from default-exporting module (only default export is available soon)` + ) + ]; + } + break; } - - return "context element"; - } - - get category() { - return this._category; - } - - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - return this.referencedExports - ? this.referencedExports.map(e => ({ - name: e, - canMangle: false - })) - : Dependency.EXPORTS_OBJECT_REFERENCED; } serialize(context) { const { write } = context; - write(this._typePrefix); - write(this._category); - write(this.referencedExports); + write(this.sourceOrder); + write(this.assertions); super.serialize(context); } deserialize(context) { const { read } = context; - this._typePrefix = read(); - this._category = read(); - this.referencedExports = read(); + this.sourceOrder = read(); + this.assertions = read(); super.deserialize(context); } } -makeSerializable( - ContextElementDependency, - "webpack/lib/dependencies/ContextElementDependency" -); - -module.exports = ContextElementDependency; +module.exports = HarmonyImportDependency; +/** @type {WeakMap>} */ +const importEmittedMap = new WeakMap(); -/***/ }), +HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate extends ( + ModuleDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply(dependency, source, templateContext) { + const dep = /** @type {HarmonyImportDependency} */ (dependency); + const { module, chunkGraph, moduleGraph, runtime } = templateContext; -/***/ 79062: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + const connection = moduleGraph.getConnection(dep); + if (connection && !connection.isTargetActive(runtime)) return; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const referencedModule = connection && connection.module; + if ( + connection && + connection.weak && + referencedModule && + chunkGraph.getModuleId(referencedModule) === null + ) { + // in weak references, module might not be in any chunk + // but that's ok, we don't need that logic in this case + return; + } + const moduleKey = referencedModule + ? referencedModule.identifier() + : dep.request; + const key = `harmony import ${moduleKey}`; -const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ - -class CreateScriptUrlDependency extends NullDependency { - /** - * @param {[number, number]} range range - */ - constructor(range) { - super(); - this.range = range; - } - - get type() { - return "create script url"; - } + const runtimeCondition = dep.weak + ? false + : connection + ? filterRuntime(runtime, r => connection.isTargetActive(r)) + : true; - serialize(context) { - const { write } = context; - write(this.range); - super.serialize(context); - } + if (module && referencedModule) { + let emittedModules = importEmittedMap.get(module); + if (emittedModules === undefined) { + emittedModules = new WeakMap(); + importEmittedMap.set(module, emittedModules); + } + let mergedRuntimeCondition = runtimeCondition; + const oldRuntimeCondition = emittedModules.get(referencedModule) || false; + if (oldRuntimeCondition !== false && mergedRuntimeCondition !== true) { + if (mergedRuntimeCondition === false || oldRuntimeCondition === true) { + mergedRuntimeCondition = oldRuntimeCondition; + } else { + mergedRuntimeCondition = mergeRuntime( + oldRuntimeCondition, + mergedRuntimeCondition + ); + } + } + emittedModules.set(referencedModule, mergedRuntimeCondition); + } - deserialize(context) { - const { read } = context; - this.range = read(); - super.deserialize(context); + const importStatement = dep.getImportStatement(false, templateContext); + if ( + referencedModule && + templateContext.moduleGraph.isAsync(referencedModule) + ) { + templateContext.initFragments.push( + new ConditionalInitFragment( + importStatement[0], + InitFragment.STAGE_HARMONY_IMPORTS, + dep.sourceOrder, + key, + runtimeCondition + ) + ); + templateContext.initFragments.push( + new AwaitDependenciesInitFragment( + new Set([dep.getImportVar(templateContext.moduleGraph)]) + ) + ); + templateContext.initFragments.push( + new ConditionalInitFragment( + importStatement[1], + InitFragment.STAGE_ASYNC_HARMONY_IMPORTS, + dep.sourceOrder, + key + " compat", + runtimeCondition + ) + ); + } else { + templateContext.initFragments.push( + new ConditionalInitFragment( + importStatement[0] + importStatement[1], + InitFragment.STAGE_HARMONY_IMPORTS, + dep.sourceOrder, + key, + runtimeCondition + ) + ); + } } -} -CreateScriptUrlDependency.Template = class CreateScriptUrlDependencyTemplate extends ( - NullDependency.Template -) { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} + * + * @param {Module} module the module + * @param {Module} referencedModule the referenced module + * @returns {RuntimeSpec | boolean} runtimeCondition in which this import has been emitted */ - apply(dependency, source, { runtimeRequirements }) { - const dep = /** @type {CreateScriptUrlDependency} */ (dependency); - - runtimeRequirements.add(RuntimeGlobals.createScriptUrl); - - source.insert(dep.range[0], `${RuntimeGlobals.createScriptUrl}(`); - source.insert(dep.range[1], ")"); + static getImportEmittedRuntime(module, referencedModule) { + const emittedModules = importEmittedMap.get(module); + if (emittedModules === undefined) return false; + return emittedModules.get(referencedModule) || false; } }; -makeSerializable( - CreateScriptUrlDependency, - "webpack/lib/dependencies/CreateScriptUrlDependency" -); - -module.exports = CreateScriptUrlDependency; +module.exports.ExportPresenceModes = ExportPresenceModes; /***/ }), -/***/ 15427: +/***/ 20862: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -82547,98 +79101,323 @@ module.exports = CreateScriptUrlDependency; -const WebpackError = __webpack_require__(53799); -const makeSerializable = __webpack_require__(33032); +const HotModuleReplacementPlugin = __webpack_require__(6404); +const InnerGraph = __webpack_require__(38988); +const ConstDependency = __webpack_require__(76911); +const HarmonyAcceptDependency = __webpack_require__(23624); +const HarmonyAcceptImportDependency = __webpack_require__(99843); +const HarmonyExports = __webpack_require__(39211); +const { ExportPresenceModes } = __webpack_require__(57154); +const HarmonyImportSideEffectDependency = __webpack_require__(73132); +const HarmonyImportSpecifierDependency = __webpack_require__(14077); -class CriticalDependencyWarning extends WebpackError { - constructor(message) { - super(); +/** @typedef {import("estree").ExportAllDeclaration} ExportAllDeclaration */ +/** @typedef {import("estree").ExportNamedDeclaration} ExportNamedDeclaration */ +/** @typedef {import("estree").Identifier} Identifier */ +/** @typedef {import("estree").ImportDeclaration} ImportDeclaration */ +/** @typedef {import("estree").ImportExpression} ImportExpression */ +/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ +/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ +/** @typedef {import("../optimize/InnerGraph").InnerGraph} InnerGraph */ +/** @typedef {import("../optimize/InnerGraph").TopLevelSymbol} TopLevelSymbol */ +/** @typedef {import("./HarmonyImportDependency")} HarmonyImportDependency */ - this.name = "CriticalDependencyWarning"; - this.message = "Critical dependency: " + message; +const harmonySpecifierTag = Symbol("harmony import"); + +/** + * @typedef {Object} HarmonySettings + * @property {string[]} ids + * @property {string} source + * @property {number} sourceOrder + * @property {string} name + * @property {boolean} await + * @property {Record | undefined} assertions + */ + +/** + * @param {ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | ImportExpression} node node with assertions + * @returns {Record | undefined} assertions + */ +function getAssertions(node) { + // TODO remove cast when @types/estree has been updated to import assertions + const assertions = /** @type {{ assertions?: ImportAttributeNode[] }} */ ( + node + ).assertions; + if (assertions === undefined) { + return undefined; + } + const result = {}; + for (const assertion of assertions) { + const key = + assertion.key.type === "Identifier" + ? assertion.key.name + : assertion.key.value; + result[key] = assertion.value.value; } + return result; } -makeSerializable( - CriticalDependencyWarning, - "webpack/lib/dependencies/CriticalDependencyWarning" -); +module.exports = class HarmonyImportDependencyParserPlugin { + /** + * @param {JavascriptParserOptions} options options + */ + constructor(options) { + this.exportPresenceMode = + options.importExportsPresence !== undefined + ? ExportPresenceModes.fromUserOption(options.importExportsPresence) + : options.exportsPresence !== undefined + ? ExportPresenceModes.fromUserOption(options.exportsPresence) + : options.strictExportPresence + ? ExportPresenceModes.ERROR + : ExportPresenceModes.AUTO; + this.strictThisContextOnImports = options.strictThisContextOnImports; + } -module.exports = CriticalDependencyWarning; + /** + * @param {JavascriptParser} parser the parser + * @returns {void} + */ + apply(parser) { + const { exportPresenceMode } = this; + parser.hooks.isPure + .for("Identifier") + .tap("HarmonyImportDependencyParserPlugin", expression => { + const expr = /** @type {Identifier} */ (expression); + if ( + parser.isVariableDefined(expr.name) || + parser.getTagData(expr.name, harmonySpecifierTag) + ) { + return true; + } + }); + parser.hooks.import.tap( + "HarmonyImportDependencyParserPlugin", + (statement, source) => { + parser.state.lastHarmonyImportOrder = + (parser.state.lastHarmonyImportOrder || 0) + 1; + const clearDep = new ConstDependency( + parser.isAsiPosition(statement.range[0]) ? ";" : "", + statement.range + ); + clearDep.loc = statement.loc; + parser.state.module.addPresentationalDependency(clearDep); + parser.unsetAsiPosition(statement.range[1]); + const assertions = getAssertions(statement); + const sideEffectDep = new HarmonyImportSideEffectDependency( + source, + parser.state.lastHarmonyImportOrder, + assertions + ); + sideEffectDep.loc = statement.loc; + parser.state.module.addDependency(sideEffectDep); + return true; + } + ); + parser.hooks.importSpecifier.tap( + "HarmonyImportDependencyParserPlugin", + (statement, source, id, name) => { + const ids = id === null ? [] : [id]; + parser.tagVariable(name, harmonySpecifierTag, { + name, + source, + ids, + sourceOrder: parser.state.lastHarmonyImportOrder, + assertions: getAssertions(statement) + }); + return true; + } + ); + parser.hooks.expression + .for(harmonySpecifierTag) + .tap("HarmonyImportDependencyParserPlugin", expr => { + const settings = /** @type {HarmonySettings} */ (parser.currentTagData); + const dep = new HarmonyImportSpecifierDependency( + settings.source, + settings.sourceOrder, + settings.ids, + settings.name, + expr.range, + exportPresenceMode, + settings.assertions + ); + dep.shorthand = parser.scope.inShorthand; + dep.directImport = true; + dep.asiSafe = !parser.isAsiPosition(expr.range[0]); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); + return true; + }); + parser.hooks.expressionMemberChain + .for(harmonySpecifierTag) + .tap("HarmonyImportDependencyParserPlugin", (expr, members) => { + const settings = /** @type {HarmonySettings} */ (parser.currentTagData); + const ids = settings.ids.concat(members); + const dep = new HarmonyImportSpecifierDependency( + settings.source, + settings.sourceOrder, + ids, + settings.name, + expr.range, + exportPresenceMode, + settings.assertions + ); + dep.asiSafe = !parser.isAsiPosition(expr.range[0]); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); + return true; + }); + parser.hooks.callMemberChain + .for(harmonySpecifierTag) + .tap("HarmonyImportDependencyParserPlugin", (expr, members) => { + const { arguments: args, callee } = expr; + const settings = /** @type {HarmonySettings} */ (parser.currentTagData); + const ids = settings.ids.concat(members); + const dep = new HarmonyImportSpecifierDependency( + settings.source, + settings.sourceOrder, + ids, + settings.name, + callee.range, + exportPresenceMode, + settings.assertions + ); + dep.directImport = members.length === 0; + dep.call = true; + dep.asiSafe = !parser.isAsiPosition(callee.range[0]); + // only in case when we strictly follow the spec we need a special case here + dep.namespaceObjectAsContext = + members.length > 0 && this.strictThisContextOnImports; + dep.loc = callee.loc; + parser.state.module.addDependency(dep); + if (args) parser.walkExpressions(args); + InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); + return true; + }); + const { hotAcceptCallback, hotAcceptWithoutCallback } = + HotModuleReplacementPlugin.getParserHooks(parser); + hotAcceptCallback.tap( + "HarmonyImportDependencyParserPlugin", + (expr, requests) => { + if (!HarmonyExports.isEnabled(parser.state)) { + // This is not a harmony module, skip it + return; + } + const dependencies = requests.map(request => { + const dep = new HarmonyAcceptImportDependency(request); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + return dep; + }); + if (dependencies.length > 0) { + const dep = new HarmonyAcceptDependency( + expr.range, + dependencies, + true + ); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + } + } + ); + hotAcceptWithoutCallback.tap( + "HarmonyImportDependencyParserPlugin", + (expr, requests) => { + if (!HarmonyExports.isEnabled(parser.state)) { + // This is not a harmony module, skip it + return; + } + const dependencies = requests.map(request => { + const dep = new HarmonyAcceptImportDependency(request); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + return dep; + }); + if (dependencies.length > 0) { + const dep = new HarmonyAcceptDependency( + expr.range, + dependencies, + false + ); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + } + } + ); + } +}; + +module.exports.harmonySpecifierTag = harmonySpecifierTag; +module.exports.getAssertions = getAssertions; /***/ }), -/***/ 76760: +/***/ 73132: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); +const HarmonyImportDependency = __webpack_require__(57154); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ /** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../InitFragment")} InitFragment */ +/** @typedef {import("../Module")} Module */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -class CssExportDependency extends NullDependency { - /** - * @param {string} name name - * @param {string} value value - */ - constructor(name, value) { - super(); - this.name = name; - this.value = value; +class HarmonyImportSideEffectDependency extends HarmonyImportDependency { + constructor(request, sourceOrder, assertions) { + super(request, sourceOrder, assertions); } get type() { - return "css :export"; + return "harmony side effect evaluation"; } /** - * Returns the exported names * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names + * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active */ - getExports(moduleGraph) { - const name = this.name; - return { - exports: [ - { - name, - canMangle: true - } - ], - dependencies: undefined + getCondition(moduleGraph) { + return connection => { + const refModule = connection.resolvedModule; + if (!refModule) return true; + return refModule.getSideEffectsConnectionState(moduleGraph); }; } - serialize(context) { - const { write } = context; - write(this.name); - write(this.value); - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - this.name = read(); - this.value = read(); - super.deserialize(context); + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this dependency connects the module to referencing modules + */ + getModuleEvaluationSideEffectsState(moduleGraph) { + const refModule = moduleGraph.getModule(this); + if (!refModule) return true; + return refModule.getSideEffectsConnectionState(moduleGraph); } } -CssExportDependency.Template = class CssExportDependencyTemplate extends ( - NullDependency.Template +makeSerializable( + HarmonyImportSideEffectDependency, + "webpack/lib/dependencies/HarmonyImportSideEffectDependency" +); + +HarmonyImportSideEffectDependency.Template = class HarmonyImportSideEffectDependencyTemplate extends ( + HarmonyImportDependency.Template ) { /** * @param {Dependency} dependency the dependency for which the template should be applied @@ -82646,317 +79425,281 @@ CssExportDependency.Template = class CssExportDependencyTemplate extends ( * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply(dependency, source, { cssExports }) { - const dep = /** @type {CssExportDependency} */ (dependency); - cssExports.set(dep.name, dep.value); + apply(dependency, source, templateContext) { + const { moduleGraph, concatenationScope } = templateContext; + if (concatenationScope) { + const module = moduleGraph.getModule(dependency); + if (concatenationScope.isModuleInScope(module)) { + return; + } + } + super.apply(dependency, source, templateContext); } }; -makeSerializable( - CssExportDependency, - "webpack/lib/dependencies/CssExportDependency" -); - -module.exports = CssExportDependency; +module.exports = HarmonyImportSideEffectDependency; /***/ }), -/***/ 90542: +/***/ 14077: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ +const Dependency = __webpack_require__(54912); +const { + getDependencyUsedByExportsCondition +} = __webpack_require__(38988); const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); +const propertyAccess = __webpack_require__(54190); +const HarmonyImportDependency = __webpack_require__(57154); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ /** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ /** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../Module")} Module */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ /** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ /** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../WebpackError")} WebpackError */ /** @typedef {import("../util/Hash")} Hash */ /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -class CssImportDependency extends ModuleDependency { - /** - * @param {string} request request - * @param {[number, number]} range range of the argument - * @param {string | undefined} supports list of supports conditions - * @param {string | undefined} media list of media conditions - */ - constructor(request, range, supports, media) { - super(request); - this.range = range; - this.supports = supports; - this.media = media; - } +const idsSymbol = Symbol("HarmonyImportSpecifierDependency.ids"); - get type() { - return "css @import"; - } +const { ExportPresenceModes } = HarmonyImportDependency; - get category() { - return "css-import"; +class HarmonyImportSpecifierDependency extends HarmonyImportDependency { + constructor( + request, + sourceOrder, + ids, + name, + range, + exportPresenceMode, + assertions + ) { + super(request, sourceOrder, assertions); + this.ids = ids; + this.name = name; + this.range = range; + this.exportPresenceMode = exportPresenceMode; + this.namespaceObjectAsContext = false; + this.call = undefined; + this.directImport = undefined; + this.shorthand = undefined; + this.asiSafe = undefined; + /** @type {Set | boolean} */ + this.usedByExports = undefined; } - /** - * @param {string} context context directory - * @returns {Module} a module - */ - createIgnoredModule(context) { - return null; + // TODO webpack 6 remove + get id() { + throw new Error("id was renamed to ids and type changed to string[]"); } -} - -CssImportDependency.Template = class CssImportDependencyTemplate extends ( - ModuleDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, templateContext) { - const dep = /** @type {CssImportDependency} */ (dependency); - source.replace(dep.range[0], dep.range[1] - 1, ""); + // TODO webpack 6 remove + getId() { + throw new Error("id was renamed to ids and type changed to string[]"); } -}; - -makeSerializable( - CssImportDependency, - "webpack/lib/dependencies/CssImportDependency" -); - -module.exports = CssImportDependency; - - -/***/ }), - -/***/ 92328: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ - - - -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -class CssLocalIdentifierDependency extends NullDependency { - /** - * @param {string} name name - * @param {[number, number]} range range - * @param {string=} prefix prefix - */ - constructor(name, range, prefix = "") { - super(); - this.name = name; - this.range = range; - this.prefix = prefix; + // TODO webpack 6 remove + setId() { + throw new Error("id was renamed to ids and type changed to string[]"); } get type() { - return "css local identifier"; + return "harmony import specifier"; } /** - * Returns the exported names - * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names + * @param {ModuleGraph} moduleGraph the module graph + * @returns {string[]} the imported ids */ - getExports(moduleGraph) { - const name = this.name; - return { - exports: [ - { - name, - canMangle: true - } - ], - dependencies: undefined - }; - } - - serialize(context) { - const { write } = context; - write(this.name); - write(this.range); - write(this.prefix); - super.serialize(context); + getIds(moduleGraph) { + const meta = moduleGraph.getMetaIfExisting(this); + if (meta === undefined) return this.ids; + const ids = meta[idsSymbol]; + return ids !== undefined ? ids : this.ids; } - deserialize(context) { - const { read } = context; - this.name = read(); - this.range = read(); - this.prefix = read(); - super.deserialize(context); + /** + * @param {ModuleGraph} moduleGraph the module graph + * @param {string[]} ids the imported ids + * @returns {void} + */ + setIds(moduleGraph, ids) { + moduleGraph.getMeta(this)[idsSymbol] = ids; } -} - -const escapeCssIdentifier = (str, omitUnderscore) => { - const escaped = `${str}`.replace( - // cspell:word uffff - /[^a-zA-Z0-9_\u0081-\uffff-]/g, - s => `\\${s}` - ); - return !omitUnderscore && /^(?!--)[0-9-]/.test(escaped) - ? `_${escaped}` - : escaped; -}; -CssLocalIdentifierDependency.Template = class CssLocalIdentifierDependencyTemplate extends ( - NullDependency.Template -) { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} + * @param {ModuleGraph} moduleGraph module graph + * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active */ - apply( - dependency, - source, - { module, moduleGraph, chunkGraph, runtime, runtimeTemplate, cssExports } - ) { - const dep = /** @type {CssLocalIdentifierDependency} */ (dependency); - const used = moduleGraph - .getExportInfo(module, dep.name) - .getUsedName(dep.name, runtime); - const moduleId = chunkGraph.getModuleId(module); - const identifier = - dep.prefix + - (runtimeTemplate.outputOptions.uniqueName - ? runtimeTemplate.outputOptions.uniqueName + "-" - : "") + - (used ? moduleId + "-" + used : "-"); - source.replace( - dep.range[0], - dep.range[1] - 1, - escapeCssIdentifier(identifier, dep.prefix) + getCondition(moduleGraph) { + return getDependencyUsedByExportsCondition( + this, + this.usedByExports, + moduleGraph ); - if (used) cssExports.set(used, identifier); } -}; - -makeSerializable( - CssLocalIdentifierDependency, - "webpack/lib/dependencies/CssLocalIdentifierDependency" -); - -module.exports = CssLocalIdentifierDependency; - - -/***/ }), - -/***/ 29094: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ + /** + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this dependency connects the module to referencing modules + */ + getModuleEvaluationSideEffectsState(moduleGraph) { + return false; + } + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + let ids = this.getIds(moduleGraph); + if (ids.length === 0) return Dependency.EXPORTS_OBJECT_REFERENCED; + let namespaceObjectAsContext = this.namespaceObjectAsContext; + if (ids[0] === "default") { + const selfModule = moduleGraph.getParentModule(this); + const importedModule = moduleGraph.getModule(this); + switch ( + importedModule.getExportsType( + moduleGraph, + selfModule.buildMeta.strictHarmonyModule + ) + ) { + case "default-only": + case "default-with-named": + if (ids.length === 1) return Dependency.EXPORTS_OBJECT_REFERENCED; + ids = ids.slice(1); + namespaceObjectAsContext = true; + break; + case "dynamic": + return Dependency.EXPORTS_OBJECT_REFERENCED; + } + } -const Dependency = __webpack_require__(54912); -const makeSerializable = __webpack_require__(33032); -const CssLocalIdentifierDependency = __webpack_require__(92328); + if ( + this.call && + !this.directImport && + (namespaceObjectAsContext || ids.length > 1) + ) { + if (ids.length === 1) return Dependency.EXPORTS_OBJECT_REFERENCED; + ids = ids.slice(0, -1); + } -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + return [ids]; + } -class CssSelfLocalIdentifierDependency extends CssLocalIdentifierDependency { /** - * @param {string} name name - * @param {[number, number]} range range - * @param {string=} prefix prefix - * @param {Set=} declaredSet set of declared names (will only be active when in declared set) + * @param {ModuleGraph} moduleGraph module graph + * @returns {number} effective mode */ - constructor(name, range, prefix = "", declaredSet = undefined) { - super(name, range, prefix); - this.declaredSet = declaredSet; - } - - get type() { - return "css self local identifier"; + _getEffectiveExportPresenceLevel(moduleGraph) { + if (this.exportPresenceMode !== ExportPresenceModes.AUTO) + return this.exportPresenceMode; + return moduleGraph.getParentModule(this).buildMeta.strictHarmonyModule + ? ExportPresenceModes.ERROR + : ExportPresenceModes.WARN; } - get category() { - return "self"; + /** + * Returns warnings + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[]} warnings + */ + getWarnings(moduleGraph) { + const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); + if (exportsPresence === ExportPresenceModes.WARN) { + return this._getErrors(moduleGraph); + } + return null; } /** - * @returns {string | null} an identifier to merge equal requests + * Returns errors + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[]} errors */ - getResourceIdentifier() { - return `self`; + getErrors(moduleGraph) { + const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); + if (exportsPresence === ExportPresenceModes.ERROR) { + return this._getErrors(moduleGraph); + } + return null; } + /** - * Returns the exported names * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names + * @returns {WebpackError[] | undefined} errors */ - getExports(moduleGraph) { - if (this.declaredSet && !this.declaredSet.has(this.name)) return; - return super.getExports(moduleGraph); + _getErrors(moduleGraph) { + const ids = this.getIds(moduleGraph); + return this.getLinkingErrors( + moduleGraph, + ids, + `(imported as '${this.name}')` + ); } /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports + * implement this method to allow the occurrence order plugin to count correctly + * @returns {number} count how often the id is used in this dependency */ - getReferencedExports(moduleGraph, runtime) { - if (this.declaredSet && !this.declaredSet.has(this.name)) - return Dependency.NO_EXPORTS_REFERENCED; - return [[this.name]]; + getNumberOfIdOccurrences() { + return 0; } serialize(context) { const { write } = context; - write(this.declaredSet); + write(this.ids); + write(this.name); + write(this.range); + write(this.exportPresenceMode); + write(this.namespaceObjectAsContext); + write(this.call); + write(this.directImport); + write(this.shorthand); + write(this.asiSafe); + write(this.usedByExports); super.serialize(context); } deserialize(context) { const { read } = context; - this.declaredSet = read(); + this.ids = read(); + this.name = read(); + this.range = read(); + this.exportPresenceMode = read(); + this.namespaceObjectAsContext = read(); + this.call = read(); + this.directImport = read(); + this.shorthand = read(); + this.asiSafe = read(); + this.usedByExports = read(); super.deserialize(context); } } -CssSelfLocalIdentifierDependency.Template = class CssSelfLocalIdentifierDependencyTemplate extends ( - CssLocalIdentifierDependency.Template +makeSerializable( + HarmonyImportSpecifierDependency, + "webpack/lib/dependencies/HarmonyImportSpecifierDependency" +); + +HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependencyTemplate extends ( + HarmonyImportDependency.Template ) { /** * @param {Dependency} dependency the dependency for which the template should be applied @@ -82965,201 +79708,244 @@ CssSelfLocalIdentifierDependency.Template = class CssSelfLocalIdentifierDependen * @returns {void} */ apply(dependency, source, templateContext) { - const dep = /** @type {CssSelfLocalIdentifierDependency} */ (dependency); - if (dep.declaredSet && !dep.declaredSet.has(dep.name)) return; - super.apply(dependency, source, templateContext); + const dep = /** @type {HarmonyImportSpecifierDependency} */ (dependency); + const { moduleGraph, module, runtime, concatenationScope } = + templateContext; + const connection = moduleGraph.getConnection(dep); + // Skip rendering depending when dependency is conditional + if (connection && !connection.isTargetActive(runtime)) return; + + const ids = dep.getIds(moduleGraph); + + let exportExpr; + if ( + connection && + concatenationScope && + concatenationScope.isModuleInScope(connection.module) + ) { + if (ids.length === 0) { + exportExpr = concatenationScope.createModuleReference( + connection.module, + { + asiSafe: dep.asiSafe + } + ); + } else if (dep.namespaceObjectAsContext && ids.length === 1) { + exportExpr = + concatenationScope.createModuleReference(connection.module, { + asiSafe: dep.asiSafe + }) + propertyAccess(ids); + } else { + exportExpr = concatenationScope.createModuleReference( + connection.module, + { + ids, + call: dep.call, + directImport: dep.directImport, + asiSafe: dep.asiSafe + } + ); + } + } else { + super.apply(dependency, source, templateContext); + + const { runtimeTemplate, initFragments, runtimeRequirements } = + templateContext; + + exportExpr = runtimeTemplate.exportFromImport({ + moduleGraph, + module: moduleGraph.getModule(dep), + request: dep.request, + exportName: ids, + originModule: module, + asiSafe: dep.shorthand ? true : dep.asiSafe, + isCall: dep.call, + callContext: !dep.directImport, + defaultInterop: true, + importVar: dep.getImportVar(moduleGraph), + initFragments, + runtime, + runtimeRequirements + }); + } + if (dep.shorthand) { + source.insert(dep.range[1], `: ${exportExpr}`); + } else { + source.replace(dep.range[0], dep.range[1] - 1, exportExpr); + } } }; -makeSerializable( - CssSelfLocalIdentifierDependency, - "webpack/lib/dependencies/CssSelfLocalIdentifierDependency" -); - -module.exports = CssSelfLocalIdentifierDependency; +module.exports = HarmonyImportSpecifierDependency; /***/ }), -/***/ 70749: +/***/ 39029: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ -const makeSerializable = __webpack_require__(33032); -const memoize = __webpack_require__(78676); -const ModuleDependency = __webpack_require__(80321); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - -const getRawDataUrlModule = memoize(() => __webpack_require__(19684)); +const HarmonyAcceptDependency = __webpack_require__(23624); +const HarmonyAcceptImportDependency = __webpack_require__(99843); +const HarmonyCompatibilityDependency = __webpack_require__(72906); +const HarmonyExportExpressionDependency = __webpack_require__(51340); +const HarmonyExportHeaderDependency = __webpack_require__(38873); +const HarmonyExportImportedSpecifierDependency = __webpack_require__(67157); +const HarmonyExportSpecifierDependency = __webpack_require__(48567); +const HarmonyImportSideEffectDependency = __webpack_require__(73132); +const HarmonyImportSpecifierDependency = __webpack_require__(14077); -class CssUrlDependency extends ModuleDependency { - /** - * @param {string} request request - * @param {[number, number]} range range of the argument - * @param {string} cssFunctionKind kind of css function, e. g. url(), image() - */ - constructor(request, range, cssFunctionKind) { - super(request); - this.range = range; - this.cssFunctionKind = cssFunctionKind; - } +const HarmonyDetectionParserPlugin = __webpack_require__(17223); +const HarmonyExportDependencyParserPlugin = __webpack_require__(93466); +const HarmonyImportDependencyParserPlugin = __webpack_require__(20862); +const HarmonyTopLevelThisParserPlugin = __webpack_require__(63232); - get type() { - return "css url()"; - } +/** @typedef {import("../Compiler")} Compiler */ - get category() { - return "url"; +class HarmonyModulesPlugin { + constructor(options) { + this.options = options; } /** - * @param {string} context context directory - * @returns {Module} a module + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - createIgnoredModule(context) { - const RawDataUrlModule = getRawDataUrlModule(); - return new RawDataUrlModule("data:,", `ignored-asset`, `(ignored asset)`); - } + apply(compiler) { + compiler.hooks.compilation.tap( + "HarmonyModulesPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyTemplates.set( + HarmonyCompatibilityDependency, + new HarmonyCompatibilityDependency.Template() + ); - serialize(context) { - const { write } = context; - write(this.cssFunctionKind); - super.serialize(context); - } + compilation.dependencyFactories.set( + HarmonyImportSideEffectDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + HarmonyImportSideEffectDependency, + new HarmonyImportSideEffectDependency.Template() + ); - deserialize(context) { - const { read } = context; - this.cssFunctionKind = read(); - super.deserialize(context); - } -} + compilation.dependencyFactories.set( + HarmonyImportSpecifierDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + HarmonyImportSpecifierDependency, + new HarmonyImportSpecifierDependency.Template() + ); -const cssEscapeString = str => { - let countWhiteOrBracket = 0; - let countQuotation = 0; - let countApostrophe = 0; - for (let i = 0; i < str.length; i++) { - const cc = str.charCodeAt(i); - switch (cc) { - case 9: // tab - case 10: // nl - case 32: // space - case 40: // ( - case 41: // ) - countWhiteOrBracket++; - break; - case 34: - countQuotation++; - break; - case 39: - countApostrophe++; - break; - } - } - if (countWhiteOrBracket < 2) { - return str.replace(/[\n\t ()'"\\]/g, m => `\\${m}`); - } else if (countQuotation <= countApostrophe) { - return `"${str.replace(/[\n"\\]/g, m => `\\${m}`)}"`; - } else { - return `'${str.replace(/[\n'\\]/g, m => `\\${m}`)}'`; - } -}; + compilation.dependencyTemplates.set( + HarmonyExportHeaderDependency, + new HarmonyExportHeaderDependency.Template() + ); -CssUrlDependency.Template = class CssUrlDependencyTemplate extends ( - ModuleDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply( - dependency, - source, - { runtime, moduleGraph, runtimeTemplate, codeGenerationResults } - ) { - const dep = /** @type {CssUrlDependency} */ (dependency); + compilation.dependencyTemplates.set( + HarmonyExportExpressionDependency, + new HarmonyExportExpressionDependency.Template() + ); - source.replace( - dep.range[0], - dep.range[1] - 1, - `${dep.cssFunctionKind}(${cssEscapeString( - runtimeTemplate.assetUrl({ - publicPath: "", - runtime, - module: moduleGraph.getModule(dep), - codeGenerationResults - }) - )})` - ); - } -}; + compilation.dependencyTemplates.set( + HarmonyExportSpecifierDependency, + new HarmonyExportSpecifierDependency.Template() + ); -makeSerializable(CssUrlDependency, "webpack/lib/dependencies/CssUrlDependency"); + compilation.dependencyFactories.set( + HarmonyExportImportedSpecifierDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + HarmonyExportImportedSpecifierDependency, + new HarmonyExportImportedSpecifierDependency.Template() + ); -module.exports = CssUrlDependency; + compilation.dependencyTemplates.set( + HarmonyAcceptDependency, + new HarmonyAcceptDependency.Template() + ); + + compilation.dependencyFactories.set( + HarmonyAcceptImportDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + HarmonyAcceptImportDependency, + new HarmonyAcceptImportDependency.Template() + ); + + const handler = (parser, parserOptions) => { + // TODO webpack 6: rename harmony to esm or module + if (parserOptions.harmony !== undefined && !parserOptions.harmony) + return; + + new HarmonyDetectionParserPlugin(this.options).apply(parser); + new HarmonyImportDependencyParserPlugin(parserOptions).apply(parser); + new HarmonyExportDependencyParserPlugin(parserOptions).apply(parser); + new HarmonyTopLevelThisParserPlugin().apply(parser); + }; + + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("HarmonyModulesPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("HarmonyModulesPlugin", handler); + } + ); + } +} +module.exports = HarmonyModulesPlugin; /***/ }), -/***/ 22914: +/***/ 63232: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Florent Cailhol @ooflorent */ -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); - -class DelegatedSourceDependency extends ModuleDependency { - constructor(request) { - super(request); - } - - get type() { - return "delegated source"; - } +const ConstDependency = __webpack_require__(76911); +const HarmonyExports = __webpack_require__(39211); - get category() { - return "esm"; +class HarmonyTopLevelThisParserPlugin { + apply(parser) { + parser.hooks.expression + .for("this") + .tap("HarmonyTopLevelThisParserPlugin", node => { + if (!parser.scope.topLevelScope) return; + if (HarmonyExports.isEnabled(parser.state)) { + const dep = new ConstDependency("undefined", node.range, null); + dep.loc = node.loc; + parser.state.module.addPresentationalDependency(dep); + return this; + } + }); } } -makeSerializable( - DelegatedSourceDependency, - "webpack/lib/dependencies/DelegatedSourceDependency" -); - -module.exports = DelegatedSourceDependency; +module.exports = HarmonyTopLevelThisParserPlugin; /***/ }), -/***/ 95666: +/***/ 1902: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -83170,26 +79956,31 @@ module.exports = DelegatedSourceDependency; -const Dependency = __webpack_require__(54912); const makeSerializable = __webpack_require__(33032); +const ContextDependency = __webpack_require__(88101); +const ContextDependencyTemplateAsRequireCall = __webpack_require__(75815); -class DllEntryDependency extends Dependency { - constructor(dependencies, name) { - super(); +class ImportContextDependency extends ContextDependency { + constructor(options, range, valueRange) { + super(options); - this.dependencies = dependencies; - this.name = name; + this.range = range; + this.valueRange = valueRange; } get type() { - return "dll entry"; + return `import() context ${this.options.mode}`; + } + + get category() { + return "esm"; } serialize(context) { const { write } = context; - write(this.dependencies); - write(this.name); + write(this.range); + write(this.valueRange); super.serialize(context); } @@ -83197,101 +79988,26 @@ class DllEntryDependency extends Dependency { deserialize(context) { const { read } = context; - this.dependencies = read(); - this.name = read(); + this.range = read(); + this.valueRange = read(); super.deserialize(context); } } makeSerializable( - DllEntryDependency, - "webpack/lib/dependencies/DllEntryDependency" + ImportContextDependency, + "webpack/lib/dependencies/ImportContextDependency" ); -module.exports = DllEntryDependency; - - -/***/ }), - -/***/ 32006: -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** @typedef {import("../Parser").ParserState} ParserState */ - -/** @type {WeakMap} */ -const parserStateExportsState = new WeakMap(); - -/** - * @param {ParserState} parserState parser state - * @returns {void} - */ -exports.bailout = parserState => { - const value = parserStateExportsState.get(parserState); - parserStateExportsState.set(parserState, false); - if (value === true) { - parserState.module.buildMeta.exportsType = undefined; - parserState.module.buildMeta.defaultObject = false; - } -}; - -/** - * @param {ParserState} parserState parser state - * @returns {void} - */ -exports.enable = parserState => { - const value = parserStateExportsState.get(parserState); - if (value === false) return; - parserStateExportsState.set(parserState, true); - if (value !== true) { - parserState.module.buildMeta.exportsType = "default"; - parserState.module.buildMeta.defaultObject = "redirect"; - } -}; - -/** - * @param {ParserState} parserState parser state - * @returns {void} - */ -exports.setFlagged = parserState => { - const value = parserStateExportsState.get(parserState); - if (value !== true) return; - const buildMeta = parserState.module.buildMeta; - if (buildMeta.exportsType === "dynamic") return; - buildMeta.exportsType = "flagged"; -}; - -/** - * @param {ParserState} parserState parser state - * @returns {void} - */ -exports.setDynamic = parserState => { - const value = parserStateExportsState.get(parserState); - if (value !== true) return; - parserState.module.buildMeta.exportsType = "dynamic"; -}; +ImportContextDependency.Template = ContextDependencyTemplateAsRequireCall; -/** - * @param {ParserState} parserState parser state - * @returns {boolean} true, when enabled - */ -exports.isEnabled = parserState => { - const value = parserStateExportsState.get(parserState); - return value === true; -}; +module.exports = ImportContextDependency; /***/ }), -/***/ 3979: +/***/ 89376: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -83302,154 +80018,69 @@ exports.isEnabled = parserState => { +const Dependency = __webpack_require__(54912); const makeSerializable = __webpack_require__(33032); const ModuleDependency = __webpack_require__(80321); -class EntryDependency extends ModuleDependency { +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + +class ImportDependency extends ModuleDependency { /** - * @param {string} request request path for entry + * @param {string} request the request + * @param {[number, number]} range expression range + * @param {string[][]=} referencedExports list of referenced exports */ - constructor(request) { + constructor(request, range, referencedExports) { super(request); + this.range = range; + this.referencedExports = referencedExports; } get type() { - return "entry"; + return "import()"; } get category() { return "esm"; } -} - -makeSerializable(EntryDependency, "webpack/lib/dependencies/EntryDependency"); - -module.exports = EntryDependency; - - -/***/ }), - -/***/ 78988: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { UsageState } = __webpack_require__(63686); -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - -/** - * @param {ModuleGraph} moduleGraph the module graph - * @param {Module} module the module - * @param {string | null} exportName name of the export if any - * @param {string | null} property name of the requested property - * @param {RuntimeSpec} runtime for which runtime - * @returns {any} value of the property - */ -const getProperty = (moduleGraph, module, exportName, property, runtime) => { - if (!exportName) { - switch (property) { - case "usedExports": { - const usedExports = moduleGraph - .getExportsInfo(module) - .getUsedExports(runtime); - if ( - typeof usedExports === "boolean" || - usedExports === undefined || - usedExports === null - ) { - return usedExports; - } - return Array.from(usedExports).sort(); - } - } - } - switch (property) { - case "canMangle": { - const exportsInfo = moduleGraph.getExportsInfo(module); - const exportInfo = exportsInfo.getExportInfo(exportName); - if (exportInfo) return exportInfo.canMangle; - return exportsInfo.otherExportsInfo.canMangle; - } - case "used": - return ( - moduleGraph.getExportsInfo(module).getUsed(exportName, runtime) !== - UsageState.Unused - ); - case "useInfo": { - const state = moduleGraph - .getExportsInfo(module) - .getUsed(exportName, runtime); - switch (state) { - case UsageState.Used: - case UsageState.OnlyPropertiesUsed: - return true; - case UsageState.Unused: - return false; - case UsageState.NoInfo: - return undefined; - case UsageState.Unknown: - return null; - default: - throw new Error(`Unexpected UsageState ${state}`); - } - } - case "provideInfo": - return moduleGraph.getExportsInfo(module).isExportProvided(exportName); - } - return undefined; -}; -class ExportsInfoDependency extends NullDependency { - constructor(range, exportName, property) { - super(); - this.range = range; - this.exportName = exportName; - this.property = property; + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + return this.referencedExports + ? this.referencedExports.map(e => ({ + name: e, + canMangle: false + })) + : Dependency.EXPORTS_OBJECT_REFERENCED; } serialize(context) { - const { write } = context; - write(this.range); - write(this.exportName); - write(this.property); + context.write(this.range); + context.write(this.referencedExports); super.serialize(context); } - static deserialize(context) { - const obj = new ExportsInfoDependency( - context.read(), - context.read(), - context.read() - ); - obj.deserialize(context); - return obj; + deserialize(context) { + this.range = context.read(); + this.referencedExports = context.read(); + super.deserialize(context); } } -makeSerializable( - ExportsInfoDependency, - "webpack/lib/dependencies/ExportsInfoDependency" -); +makeSerializable(ImportDependency, "webpack/lib/dependencies/ImportDependency"); -ExportsInfoDependency.Template = class ExportsInfoDependencyTemplate extends ( - NullDependency.Template +ImportDependency.Template = class ImportDependencyTemplate extends ( + ModuleDependency.Template ) { /** * @param {Dependency} dependency the dependency for which the template should be applied @@ -83457,30 +80088,35 @@ ExportsInfoDependency.Template = class ExportsInfoDependencyTemplate extends ( * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply(dependency, source, { module, moduleGraph, runtime }) { - const dep = /** @type {ExportsInfoDependency} */ (dependency); - - const value = getProperty( - moduleGraph, - module, - dep.exportName, - dep.property, - runtime - ); - source.replace( - dep.range[0], - dep.range[1] - 1, - value === undefined ? "undefined" : JSON.stringify(value) + apply( + dependency, + source, + { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements } + ) { + const dep = /** @type {ImportDependency} */ (dependency); + const block = /** @type {AsyncDependenciesBlock} */ ( + moduleGraph.getParentBlock(dep) ); + const content = runtimeTemplate.moduleNamespacePromise({ + chunkGraph, + block: block, + module: moduleGraph.getModule(dep), + request: dep.request, + strict: module.buildMeta.strictHarmonyModule, + message: "import()", + runtimeRequirements + }); + + source.replace(dep.range[0], dep.range[1] - 1, content); } }; -module.exports = ExportsInfoDependency; +module.exports = ImportDependency; /***/ }), -/***/ 23624: +/***/ 50718: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -83491,57 +80127,41 @@ module.exports = ExportsInfoDependency; -const Template = __webpack_require__(39722); const makeSerializable = __webpack_require__(33032); -const HarmonyImportDependency = __webpack_require__(57154); -const NullDependency = __webpack_require__(31830); +const ImportDependency = __webpack_require__(89376); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ /** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("./HarmonyAcceptImportDependency")} HarmonyAcceptImportDependency */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ -class HarmonyAcceptDependency extends NullDependency { +class ImportEagerDependency extends ImportDependency { /** + * @param {string} request the request * @param {[number, number]} range expression range - * @param {HarmonyAcceptImportDependency[]} dependencies import dependencies - * @param {boolean} hasCallback true, if the range wraps an existing callback + * @param {string[][]=} referencedExports list of referenced exports */ - constructor(range, dependencies, hasCallback) { - super(); - this.range = range; - this.dependencies = dependencies; - this.hasCallback = hasCallback; + constructor(request, range, referencedExports) { + super(request, range, referencedExports); } get type() { - return "accepted harmony modules"; - } - - serialize(context) { - const { write } = context; - write(this.range); - write(this.dependencies); - write(this.hasCallback); - super.serialize(context); + return "import() eager"; } - deserialize(context) { - const { read } = context; - this.range = read(); - this.dependencies = read(); - this.hasCallback = read(); - super.deserialize(context); + get category() { + return "esm"; } } makeSerializable( - HarmonyAcceptDependency, - "webpack/lib/dependencies/HarmonyAcceptDependency" + ImportEagerDependency, + "webpack/lib/dependencies/ImportEagerDependency" ); -HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate extends ( - NullDependency.Template +ImportEagerDependency.Template = class ImportEagerDependencyTemplate extends ( + ImportDependency.Template ) { /** * @param {Dependency} dependency the dependency for which the template should be applied @@ -83549,327 +80169,329 @@ HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate extends * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply(dependency, source, templateContext) { - const dep = /** @type {HarmonyAcceptDependency} */ (dependency); - const { - module, - runtime, - runtimeRequirements, - runtimeTemplate, - moduleGraph, - chunkGraph - } = templateContext; - const content = dep.dependencies - .map(dependency => { - const referencedModule = moduleGraph.getModule(dependency); - return { - dependency, - runtimeCondition: referencedModule - ? HarmonyImportDependency.Template.getImportEmittedRuntime( - module, - referencedModule - ) - : false - }; - }) - .filter(({ runtimeCondition }) => runtimeCondition !== false) - .map(({ dependency, runtimeCondition }) => { - const condition = runtimeTemplate.runtimeConditionExpression({ - chunkGraph, - runtime, - runtimeCondition, - runtimeRequirements - }); - const s = dependency.getImportStatement(true, templateContext); - const code = s[0] + s[1]; - if (condition !== "true") { - return `if (${condition}) {\n${Template.indent(code)}\n}\n`; - } - return code; - }) - .join(""); - - if (dep.hasCallback) { - if (runtimeTemplate.supportsArrowFunction()) { - source.insert( - dep.range[0], - `__WEBPACK_OUTDATED_DEPENDENCIES__ => { ${content}(` - ); - source.insert(dep.range[1], ")(__WEBPACK_OUTDATED_DEPENDENCIES__); }"); - } else { - source.insert( - dep.range[0], - `function(__WEBPACK_OUTDATED_DEPENDENCIES__) { ${content}(` - ); - source.insert( - dep.range[1], - ")(__WEBPACK_OUTDATED_DEPENDENCIES__); }.bind(this)" - ); - } - return; - } + apply( + dependency, + source, + { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements } + ) { + const dep = /** @type {ImportEagerDependency} */ (dependency); + const content = runtimeTemplate.moduleNamespacePromise({ + chunkGraph, + module: moduleGraph.getModule(dep), + request: dep.request, + strict: module.buildMeta.strictHarmonyModule, + message: "import() eager", + runtimeRequirements + }); - const arrow = runtimeTemplate.supportsArrowFunction(); - source.insert( - dep.range[1] - 0.5, - `, ${arrow ? "() =>" : "function()"} { ${content} }` - ); + source.replace(dep.range[0], dep.range[1] - 1, content); } }; -module.exports = HarmonyAcceptDependency; +module.exports = ImportEagerDependency; /***/ }), -/***/ 99843: +/***/ 51274: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ const makeSerializable = __webpack_require__(33032); -const HarmonyImportDependency = __webpack_require__(57154); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +const ModuleDependency = __webpack_require__(80321); +const ModuleDependencyTemplateAsId = __webpack_require__(80825); -class HarmonyAcceptImportDependency extends HarmonyImportDependency { - constructor(request) { - super(request, NaN); +class ImportMetaHotAcceptDependency extends ModuleDependency { + constructor(request, range) { + super(request); + this.range = range; this.weak = true; } get type() { - return "harmony accept"; + return "import.meta.webpackHot.accept"; + } + + get category() { + return "esm"; } } makeSerializable( - HarmonyAcceptImportDependency, - "webpack/lib/dependencies/HarmonyAcceptImportDependency" + ImportMetaHotAcceptDependency, + "webpack/lib/dependencies/ImportMetaHotAcceptDependency" ); -HarmonyAcceptImportDependency.Template = class HarmonyAcceptImportDependencyTemplate extends ( - HarmonyImportDependency.Template -) {}; +ImportMetaHotAcceptDependency.Template = ModuleDependencyTemplateAsId; -module.exports = HarmonyAcceptImportDependency; +module.exports = ImportMetaHotAcceptDependency; /***/ }), -/***/ 72906: +/***/ 53141: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ -const { UsageState } = __webpack_require__(63686); -const InitFragment = __webpack_require__(55870); -const RuntimeGlobals = __webpack_require__(16475); const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); +const ModuleDependency = __webpack_require__(80321); +const ModuleDependencyTemplateAsId = __webpack_require__(80825); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../Module")} Module */ +class ImportMetaHotDeclineDependency extends ModuleDependency { + constructor(request, range) { + super(request); + + this.range = range; + this.weak = true; + } -class HarmonyCompatibilityDependency extends NullDependency { get type() { - return "harmony export header"; + return "import.meta.webpackHot.decline"; + } + + get category() { + return "esm"; } } makeSerializable( - HarmonyCompatibilityDependency, - "webpack/lib/dependencies/HarmonyCompatibilityDependency" + ImportMetaHotDeclineDependency, + "webpack/lib/dependencies/ImportMetaHotDeclineDependency" ); -HarmonyCompatibilityDependency.Template = class HarmonyExportDependencyTemplate extends ( - NullDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply( - dependency, - source, - { - module, - runtimeTemplate, - moduleGraph, - initFragments, - runtimeRequirements, - runtime, - concatenationScope - } - ) { - if (concatenationScope) return; - const exportsInfo = moduleGraph.getExportsInfo(module); - if ( - exportsInfo.getReadOnlyExportInfo("__esModule").getUsed(runtime) !== - UsageState.Unused - ) { - const content = runtimeTemplate.defineEsModuleFlagStatement({ - exportsArgument: module.exportsArgument, - runtimeRequirements - }); - initFragments.push( - new InitFragment( - content, - InitFragment.STAGE_HARMONY_EXPORTS, - 0, - "harmony compatibility" - ) - ); - } - if (moduleGraph.isAsync(module)) { - runtimeRequirements.add(RuntimeGlobals.module); - runtimeRequirements.add(RuntimeGlobals.asyncModule); - initFragments.push( - new InitFragment( - runtimeTemplate.supportsArrowFunction() - ? `${RuntimeGlobals.asyncModule}(${module.moduleArgument}, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n` - : `${RuntimeGlobals.asyncModule}(${module.moduleArgument}, async function (__webpack_handle_async_dependencies__, __webpack_async_result__) { try {\n`, - InitFragment.STAGE_ASYNC_BOUNDARY, - 0, - undefined, - `\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } }${ - module.buildMeta.async ? ", 1" : "" - });` - ) - ); - } - } -}; +ImportMetaHotDeclineDependency.Template = ModuleDependencyTemplateAsId; -module.exports = HarmonyCompatibilityDependency; +module.exports = ImportMetaHotDeclineDependency; /***/ }), -/***/ 17223: +/***/ 17228: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ -const DynamicExports = __webpack_require__(32006); -const HarmonyCompatibilityDependency = __webpack_require__(72906); -const HarmonyExports = __webpack_require__(39211); +const { pathToFileURL } = __webpack_require__(57310); +const ModuleDependencyWarning = __webpack_require__(29656); +const Template = __webpack_require__(1626); +const BasicEvaluatedExpression = __webpack_require__(950); +const { + evaluateToIdentifier, + toConstantDependency, + evaluateToString, + evaluateToNumber +} = __webpack_require__(93998); +const memoize = __webpack_require__(78676); +const propertyAccess = __webpack_require__(54190); +const ConstDependency = __webpack_require__(76911); -module.exports = class HarmonyDetectionParserPlugin { - constructor(options) { - const { topLevelAwait = false } = options || {}; - this.topLevelAwait = topLevelAwait; - } +/** @typedef {import("estree").MemberExpression} MemberExpression */ +/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../javascript/JavascriptParser")} Parser */ - apply(parser) { - parser.hooks.program.tap("HarmonyDetectionParserPlugin", ast => { - const isStrictHarmony = parser.state.module.type === "javascript/esm"; - const isHarmony = - isStrictHarmony || - ast.body.some( - statement => - statement.type === "ImportDeclaration" || - statement.type === "ExportDefaultDeclaration" || - statement.type === "ExportNamedDeclaration" || - statement.type === "ExportAllDeclaration" - ); - if (isHarmony) { - const module = parser.state.module; - const compatDep = new HarmonyCompatibilityDependency(); - compatDep.loc = { - start: { - line: -1, - column: 0 - }, - end: { - line: -1, - column: 0 - }, - index: -3 +const getCriticalDependencyWarning = memoize(() => + __webpack_require__(15427) +); + +class ImportMetaPlugin { + /** + * @param {Compiler} compiler compiler + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "ImportMetaPlugin", + (compilation, { normalModuleFactory }) => { + /** + * @param {NormalModule} module module + * @returns {string} file url + */ + const getUrl = module => { + return pathToFileURL(module.resource).toString(); }; - module.addPresentationalDependency(compatDep); - DynamicExports.bailout(parser.state); - HarmonyExports.enable(parser.state, isStrictHarmony); - parser.scope.isStrict = true; - } - }); + /** + * @param {Parser} parser parser parser + * @param {JavascriptParserOptions} parserOptions parserOptions + * @returns {void} + */ + const parserHandler = (parser, { importMeta }) => { + if (importMeta === false) { + const { importMetaName } = compilation.outputOptions; + if (importMetaName === "import.meta") return; - parser.hooks.topLevelAwait.tap("HarmonyDetectionParserPlugin", () => { - const module = parser.state.module; - if (!this.topLevelAwait) { - throw new Error( - "The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it)" - ); - } - if (!HarmonyExports.isEnabled(parser.state)) { - throw new Error( - "Top-level-await is only supported in EcmaScript Modules" - ); - } - module.buildMeta.async = true; - }); + parser.hooks.expression + .for("import.meta") + .tap("ImportMetaPlugin", metaProperty => { + const dep = new ConstDependency( + importMetaName, + metaProperty.range + ); + dep.loc = metaProperty.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + return; + } - const skipInHarmony = () => { - if (HarmonyExports.isEnabled(parser.state)) { - return true; - } - }; + /// import.meta direct /// + parser.hooks.typeof + .for("import.meta") + .tap( + "ImportMetaPlugin", + toConstantDependency(parser, JSON.stringify("object")) + ); + parser.hooks.expression + .for("import.meta") + .tap("ImportMetaPlugin", metaProperty => { + const CriticalDependencyWarning = getCriticalDependencyWarning(); + parser.state.module.addWarning( + new ModuleDependencyWarning( + parser.state.module, + new CriticalDependencyWarning( + "Accessing import.meta directly is unsupported (only property access is supported)" + ), + metaProperty.loc + ) + ); + const dep = new ConstDependency( + `${parser.isAsiPosition(metaProperty.range[0]) ? ";" : ""}({})`, + metaProperty.range + ); + dep.loc = metaProperty.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + parser.hooks.evaluateTypeof + .for("import.meta") + .tap("ImportMetaPlugin", evaluateToString("object")); + parser.hooks.evaluateIdentifier.for("import.meta").tap( + "ImportMetaPlugin", + evaluateToIdentifier("import.meta", "import.meta", () => [], true) + ); - const nullInHarmony = () => { - if (HarmonyExports.isEnabled(parser.state)) { - return null; - } - }; + /// import.meta.url /// + parser.hooks.typeof + .for("import.meta.url") + .tap( + "ImportMetaPlugin", + toConstantDependency(parser, JSON.stringify("string")) + ); + parser.hooks.expression + .for("import.meta.url") + .tap("ImportMetaPlugin", expr => { + const dep = new ConstDependency( + JSON.stringify(getUrl(parser.state.module)), + expr.range + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + parser.hooks.evaluateTypeof + .for("import.meta.url") + .tap("ImportMetaPlugin", evaluateToString("string")); + parser.hooks.evaluateIdentifier + .for("import.meta.url") + .tap("ImportMetaPlugin", expr => { + return new BasicEvaluatedExpression() + .setString(getUrl(parser.state.module)) + .setRange(expr.range); + }); - const nonHarmonyIdentifiers = ["define", "exports"]; - for (const identifier of nonHarmonyIdentifiers) { - parser.hooks.evaluateTypeof - .for(identifier) - .tap("HarmonyDetectionParserPlugin", nullInHarmony); - parser.hooks.typeof - .for(identifier) - .tap("HarmonyDetectionParserPlugin", skipInHarmony); - parser.hooks.evaluate - .for(identifier) - .tap("HarmonyDetectionParserPlugin", nullInHarmony); - parser.hooks.expression - .for(identifier) - .tap("HarmonyDetectionParserPlugin", skipInHarmony); - parser.hooks.call - .for(identifier) - .tap("HarmonyDetectionParserPlugin", skipInHarmony); - } + /// import.meta.webpack /// + const webpackVersion = parseInt( + (__webpack_require__(32702)/* .version */ .i8), + 10 + ); + parser.hooks.typeof + .for("import.meta.webpack") + .tap( + "ImportMetaPlugin", + toConstantDependency(parser, JSON.stringify("number")) + ); + parser.hooks.expression + .for("import.meta.webpack") + .tap( + "ImportMetaPlugin", + toConstantDependency(parser, JSON.stringify(webpackVersion)) + ); + parser.hooks.evaluateTypeof + .for("import.meta.webpack") + .tap("ImportMetaPlugin", evaluateToString("number")); + parser.hooks.evaluateIdentifier + .for("import.meta.webpack") + .tap("ImportMetaPlugin", evaluateToNumber(webpackVersion)); + + /// Unknown properties /// + parser.hooks.unhandledExpressionMemberChain + .for("import.meta") + .tap("ImportMetaPlugin", (expr, members) => { + const dep = new ConstDependency( + `${Template.toNormalComment( + "unsupported import.meta." + members.join(".") + )} undefined${propertyAccess(members, 1)}`, + expr.range + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + parser.hooks.evaluate + .for("MemberExpression") + .tap("ImportMetaPlugin", expression => { + const expr = /** @type {MemberExpression} */ (expression); + if ( + expr.object.type === "MetaProperty" && + expr.object.meta.name === "import" && + expr.object.property.name === "meta" && + expr.property.type === + (expr.computed ? "Literal" : "Identifier") + ) { + return new BasicEvaluatedExpression() + .setUndefined() + .setRange(expr.range); + } + }); + }; + + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("ImportMetaPlugin", parserHandler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("ImportMetaPlugin", parserHandler); + } + ); } -}; +} + +module.exports = ImportMetaPlugin; /***/ }), -/***/ 93466: +/***/ 88130: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -83880,189 +80502,271 @@ module.exports = class HarmonyDetectionParserPlugin { -const InnerGraph = __webpack_require__(38988); -const ConstDependency = __webpack_require__(76911); -const HarmonyExportExpressionDependency = __webpack_require__(51340); -const HarmonyExportHeaderDependency = __webpack_require__(38873); -const HarmonyExportImportedSpecifierDependency = __webpack_require__(67157); -const HarmonyExportSpecifierDependency = __webpack_require__(48567); -const { ExportPresenceModes } = __webpack_require__(57154); -const { - harmonySpecifierTag, - getAssertions -} = __webpack_require__(20862); -const HarmonyImportSideEffectDependency = __webpack_require__(73132); +const AsyncDependenciesBlock = __webpack_require__(47736); +const CommentCompilationWarning = __webpack_require__(98427); +const UnsupportedFeatureWarning = __webpack_require__(42495); +const ContextDependencyHelpers = __webpack_require__(99630); +const ImportContextDependency = __webpack_require__(1902); +const ImportDependency = __webpack_require__(89376); +const ImportEagerDependency = __webpack_require__(50718); +const ImportWeakDependency = __webpack_require__(82483); -const { HarmonyStarExportsList } = HarmonyExportImportedSpecifierDependency; +/** @typedef {import("../ChunkGroup").RawChunkGroupOptions} RawChunkGroupOptions */ +/** @typedef {import("../ContextModule").ContextMode} ContextMode */ -module.exports = class HarmonyExportDependencyParserPlugin { +class ImportParserPlugin { constructor(options) { - this.exportPresenceMode = - options.reexportExportsPresence !== undefined - ? ExportPresenceModes.fromUserOption(options.reexportExportsPresence) - : options.exportsPresence !== undefined - ? ExportPresenceModes.fromUserOption(options.exportsPresence) - : options.strictExportPresence - ? ExportPresenceModes.ERROR - : ExportPresenceModes.AUTO; + this.options = options; } apply(parser) { - const { exportPresenceMode } = this; - parser.hooks.export.tap( - "HarmonyExportDependencyParserPlugin", - statement => { - const dep = new HarmonyExportHeaderDependency( - statement.declaration && statement.declaration.range, - statement.range - ); - dep.loc = Object.create(statement.loc); - dep.loc.index = -1; - parser.state.module.addPresentationalDependency(dep); - return true; - } - ); - parser.hooks.exportImport.tap( - "HarmonyExportDependencyParserPlugin", - (statement, source) => { - parser.state.lastHarmonyImportOrder = - (parser.state.lastHarmonyImportOrder || 0) + 1; - const clearDep = new ConstDependency("", statement.range); - clearDep.loc = Object.create(statement.loc); - clearDep.loc.index = -1; - parser.state.module.addPresentationalDependency(clearDep); - const sideEffectDep = new HarmonyImportSideEffectDependency( - source, - parser.state.lastHarmonyImportOrder, - getAssertions(statement) - ); - sideEffectDep.loc = Object.create(statement.loc); - sideEffectDep.loc.index = -1; - parser.state.current.addDependency(sideEffectDep); - return true; + parser.hooks.importCall.tap("ImportParserPlugin", expr => { + const param = parser.evaluateExpression(expr.source); + + let chunkName = null; + /** @type {ContextMode} */ + let mode = "lazy"; + let include = null; + let exclude = null; + /** @type {string[][] | null} */ + let exports = null; + /** @type {RawChunkGroupOptions} */ + const groupOptions = {}; + + const { options: importOptions, errors: commentErrors } = + parser.parseCommentOptions(expr.range); + + if (commentErrors) { + for (const e of commentErrors) { + const { comment } = e; + parser.state.module.addWarning( + new CommentCompilationWarning( + `Compilation error while processing magic comment(-s): /*${comment.value}*/: ${e.message}`, + comment.loc + ) + ); + } } - ); - parser.hooks.exportExpression.tap( - "HarmonyExportDependencyParserPlugin", - (statement, expr) => { - const isFunctionDeclaration = expr.type === "FunctionDeclaration"; - const comments = parser.getComments([ - statement.range[0], - expr.range[0] - ]); - const dep = new HarmonyExportExpressionDependency( - expr.range, - statement.range, - comments - .map(c => { - switch (c.type) { - case "Block": - return `/*${c.value}*/`; - case "Line": - return `//${c.value}\n`; - } - return ""; - }) - .join(""), - expr.type.endsWith("Declaration") && expr.id - ? expr.id.name - : isFunctionDeclaration - ? { - id: expr.id ? expr.id.name : undefined, - range: [ - expr.range[0], - expr.params.length > 0 - ? expr.params[0].range[0] - : expr.body.range[0] - ], - prefix: `${expr.async ? "async " : ""}function${ - expr.generator ? "*" : "" - } `, - suffix: `(${expr.params.length > 0 ? "" : ") "}` - } - : undefined - ); - dep.loc = Object.create(statement.loc); - dep.loc.index = -1; - parser.state.current.addDependency(dep); - InnerGraph.addVariableUsage( - parser, - expr.type.endsWith("Declaration") && expr.id - ? expr.id.name - : "*default*", - "default" - ); - return true; + + if (importOptions) { + if (importOptions.webpackIgnore !== undefined) { + if (typeof importOptions.webpackIgnore !== "boolean") { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackIgnore\` expected a boolean, but received: ${importOptions.webpackIgnore}.`, + expr.loc + ) + ); + } else { + // Do not instrument `import()` if `webpackIgnore` is `true` + if (importOptions.webpackIgnore) { + return false; + } + } + } + if (importOptions.webpackChunkName !== undefined) { + if (typeof importOptions.webpackChunkName !== "string") { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackChunkName\` expected a string, but received: ${importOptions.webpackChunkName}.`, + expr.loc + ) + ); + } else { + chunkName = importOptions.webpackChunkName; + } + } + if (importOptions.webpackMode !== undefined) { + if (typeof importOptions.webpackMode !== "string") { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackMode\` expected a string, but received: ${importOptions.webpackMode}.`, + expr.loc + ) + ); + } else { + mode = importOptions.webpackMode; + } + } + if (importOptions.webpackPrefetch !== undefined) { + if (importOptions.webpackPrefetch === true) { + groupOptions.prefetchOrder = 0; + } else if (typeof importOptions.webpackPrefetch === "number") { + groupOptions.prefetchOrder = importOptions.webpackPrefetch; + } else { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackPrefetch\` expected true or a number, but received: ${importOptions.webpackPrefetch}.`, + expr.loc + ) + ); + } + } + if (importOptions.webpackPreload !== undefined) { + if (importOptions.webpackPreload === true) { + groupOptions.preloadOrder = 0; + } else if (typeof importOptions.webpackPreload === "number") { + groupOptions.preloadOrder = importOptions.webpackPreload; + } else { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackPreload\` expected true or a number, but received: ${importOptions.webpackPreload}.`, + expr.loc + ) + ); + } + } + if (importOptions.webpackInclude !== undefined) { + if ( + !importOptions.webpackInclude || + importOptions.webpackInclude.constructor.name !== "RegExp" + ) { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackInclude\` expected a regular expression, but received: ${importOptions.webpackInclude}.`, + expr.loc + ) + ); + } else { + include = new RegExp(importOptions.webpackInclude); + } + } + if (importOptions.webpackExclude !== undefined) { + if ( + !importOptions.webpackExclude || + importOptions.webpackExclude.constructor.name !== "RegExp" + ) { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackExclude\` expected a regular expression, but received: ${importOptions.webpackExclude}.`, + expr.loc + ) + ); + } else { + exclude = new RegExp(importOptions.webpackExclude); + } + } + if (importOptions.webpackExports !== undefined) { + if ( + !( + typeof importOptions.webpackExports === "string" || + (Array.isArray(importOptions.webpackExports) && + importOptions.webpackExports.every( + item => typeof item === "string" + )) + ) + ) { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackExports\` expected a string or an array of strings, but received: ${importOptions.webpackExports}.`, + expr.loc + ) + ); + } else { + if (typeof importOptions.webpackExports === "string") { + exports = [[importOptions.webpackExports]]; + } else { + exports = Array.from(importOptions.webpackExports, e => [e]); + } + } + } } - ); - parser.hooks.exportSpecifier.tap( - "HarmonyExportDependencyParserPlugin", - (statement, id, name, idx) => { - const settings = parser.getTagData(id, harmonySpecifierTag); - let dep; - const harmonyNamedExports = (parser.state.harmonyNamedExports = - parser.state.harmonyNamedExports || new Set()); - harmonyNamedExports.add(name); - InnerGraph.addVariableUsage(parser, id, name); - if (settings) { - dep = new HarmonyExportImportedSpecifierDependency( - settings.source, - settings.sourceOrder, - settings.ids, - name, - harmonyNamedExports, - null, - exportPresenceMode, - null, - settings.assertions + + if (param.isString()) { + if (mode !== "lazy" && mode !== "eager" && mode !== "weak") { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackMode\` expected 'lazy', 'eager' or 'weak', but received: ${mode}.`, + expr.loc + ) + ); + } + + if (mode === "eager") { + const dep = new ImportEagerDependency( + param.string, + expr.range, + exports + ); + parser.state.current.addDependency(dep); + } else if (mode === "weak") { + const dep = new ImportWeakDependency( + param.string, + expr.range, + exports ); + parser.state.current.addDependency(dep); } else { - dep = new HarmonyExportSpecifierDependency(id, name); + const depBlock = new AsyncDependenciesBlock( + { + ...groupOptions, + name: chunkName + }, + expr.loc, + param.string + ); + const dep = new ImportDependency(param.string, expr.range, exports); + dep.loc = expr.loc; + depBlock.addDependency(dep); + parser.state.current.addBlock(depBlock); } - dep.loc = Object.create(statement.loc); - dep.loc.index = idx; - parser.state.current.addDependency(dep); return true; - } - ); - parser.hooks.exportImportSpecifier.tap( - "HarmonyExportDependencyParserPlugin", - (statement, source, id, name, idx) => { - const harmonyNamedExports = (parser.state.harmonyNamedExports = - parser.state.harmonyNamedExports || new Set()); - let harmonyStarExports = null; - if (name) { - harmonyNamedExports.add(name); - } else { - harmonyStarExports = parser.state.harmonyStarExports = - parser.state.harmonyStarExports || new HarmonyStarExportsList(); + } else { + if ( + mode !== "lazy" && + mode !== "lazy-once" && + mode !== "eager" && + mode !== "weak" + ) { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackMode\` expected 'lazy', 'lazy-once', 'eager' or 'weak', but received: ${mode}.`, + expr.loc + ) + ); + mode = "lazy"; } - const dep = new HarmonyExportImportedSpecifierDependency( - source, - parser.state.lastHarmonyImportOrder, - id ? [id] : [], - name, - harmonyNamedExports, - harmonyStarExports && harmonyStarExports.slice(), - exportPresenceMode, - harmonyStarExports - ); - if (harmonyStarExports) { - harmonyStarExports.push(dep); + + if (mode === "weak") { + mode = "async-weak"; } - dep.loc = Object.create(statement.loc); - dep.loc.index = idx; + const dep = ContextDependencyHelpers.create( + ImportContextDependency, + expr.range, + param, + expr, + this.options, + { + chunkName, + groupOptions, + include, + exclude, + mode, + namespaceObject: parser.state.module.buildMeta.strictHarmonyModule + ? "strict" + : true, + typePrefix: "import()", + category: "esm", + referencedExports: exports + }, + parser + ); + if (!dep) return; + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; parser.state.current.addDependency(dep); return true; } - ); + }); } -}; +} + +module.exports = ImportParserPlugin; /***/ }), -/***/ 51340: +/***/ 41293: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -84073,194 +80777,86 @@ module.exports = class HarmonyExportDependencyParserPlugin { -const ConcatenationScope = __webpack_require__(98229); -const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); -const HarmonyExportInitFragment = __webpack_require__(89500); -const NullDependency = __webpack_require__(31830); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ - -class HarmonyExportExpressionDependency extends NullDependency { - constructor(range, rangeStatement, prefix, declarationId) { - super(); - this.range = range; - this.rangeStatement = rangeStatement; - this.prefix = prefix; - this.declarationId = declarationId; - } +const ImportContextDependency = __webpack_require__(1902); +const ImportDependency = __webpack_require__(89376); +const ImportEagerDependency = __webpack_require__(50718); +const ImportParserPlugin = __webpack_require__(88130); +const ImportWeakDependency = __webpack_require__(82483); - get type() { - return "harmony export expression"; - } +/** @typedef {import("../Compiler")} Compiler */ +class ImportPlugin { /** - * Returns the exported names - * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - getExports(moduleGraph) { - return { - exports: ["default"], - priority: 1, - terminalBinding: true, - dependencies: undefined - }; - } + apply(compiler) { + compiler.hooks.compilation.tap( + "ImportPlugin", + (compilation, { contextModuleFactory, normalModuleFactory }) => { + compilation.dependencyFactories.set( + ImportDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + ImportDependency, + new ImportDependency.Template() + ); - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this dependency connects the module to referencing modules - */ - getModuleEvaluationSideEffectsState(moduleGraph) { - // The expression/declaration is already covered by SideEffectsFlagPlugin - return false; - } + compilation.dependencyFactories.set( + ImportEagerDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + ImportEagerDependency, + new ImportEagerDependency.Template() + ); - serialize(context) { - const { write } = context; - write(this.range); - write(this.rangeStatement); - write(this.prefix); - write(this.declarationId); - super.serialize(context); - } + compilation.dependencyFactories.set( + ImportWeakDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + ImportWeakDependency, + new ImportWeakDependency.Template() + ); - deserialize(context) { - const { read } = context; - this.range = read(); - this.rangeStatement = read(); - this.prefix = read(); - this.declarationId = read(); - super.deserialize(context); - } -} + compilation.dependencyFactories.set( + ImportContextDependency, + contextModuleFactory + ); + compilation.dependencyTemplates.set( + ImportContextDependency, + new ImportContextDependency.Template() + ); -makeSerializable( - HarmonyExportExpressionDependency, - "webpack/lib/dependencies/HarmonyExportExpressionDependency" -); - -HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTemplate extends ( - NullDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply( - dependency, - source, - { - module, - moduleGraph, - runtimeTemplate, - runtimeRequirements, - initFragments, - runtime, - concatenationScope - } - ) { - const dep = /** @type {HarmonyExportExpressionDependency} */ (dependency); - const { declarationId } = dep; - const exportsName = module.exportsArgument; - if (declarationId) { - let name; - if (typeof declarationId === "string") { - name = declarationId; - } else { - name = ConcatenationScope.DEFAULT_EXPORT; - source.replace( - declarationId.range[0], - declarationId.range[1] - 1, - `${declarationId.prefix}${name}${declarationId.suffix}` - ); - } - - if (concatenationScope) { - concatenationScope.registerExport("default", name); - } else { - const used = moduleGraph - .getExportsInfo(module) - .getUsedName("default", runtime); - if (used) { - const map = new Map(); - map.set(used, `/* export default binding */ ${name}`); - initFragments.push(new HarmonyExportInitFragment(exportsName, map)); - } - } + const handler = (parser, parserOptions) => { + if (parserOptions.import !== undefined && !parserOptions.import) + return; - source.replace( - dep.rangeStatement[0], - dep.range[0] - 1, - `/* harmony default export */ ${dep.prefix}` - ); - } else { - let content; - const name = ConcatenationScope.DEFAULT_EXPORT; - if (runtimeTemplate.supportsConst()) { - content = `/* harmony default export */ const ${name} = `; - if (concatenationScope) { - concatenationScope.registerExport("default", name); - } else { - const used = moduleGraph - .getExportsInfo(module) - .getUsedName("default", runtime); - if (used) { - runtimeRequirements.add(RuntimeGlobals.exports); - const map = new Map(); - map.set(used, name); - initFragments.push(new HarmonyExportInitFragment(exportsName, map)); - } else { - content = `/* unused harmony default export */ var ${name} = `; - } - } - } else if (concatenationScope) { - content = `/* harmony default export */ var ${name} = `; - concatenationScope.registerExport("default", name); - } else { - const used = moduleGraph - .getExportsInfo(module) - .getUsedName("default", runtime); - if (used) { - runtimeRequirements.add(RuntimeGlobals.exports); - // This is a little bit incorrect as TDZ is not correct, but we can't use const. - content = `/* harmony default export */ ${exportsName}[${JSON.stringify( - used - )}] = `; - } else { - content = `/* unused harmony default export */ var ${name} = `; - } - } + new ImportParserPlugin(parserOptions).apply(parser); + }; - if (dep.range) { - source.replace( - dep.rangeStatement[0], - dep.range[0] - 1, - content + "(" + dep.prefix - ); - source.replace(dep.range[1], dep.rangeStatement[1] - 0.5, ");"); - return; + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("ImportPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("ImportPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("ImportPlugin", handler); } - - source.replace(dep.rangeStatement[0], dep.rangeStatement[1] - 1, content); - } + ); } -}; - -module.exports = HarmonyExportExpressionDependency; +} +module.exports = ImportPlugin; /***/ }), -/***/ 38873: +/***/ 82483: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -84272,45 +80868,37 @@ module.exports = HarmonyExportExpressionDependency; const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); +const ImportDependency = __webpack_require__(89376); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ /** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ -class HarmonyExportHeaderDependency extends NullDependency { - constructor(range, rangeStatement) { - super(); - this.range = range; - this.rangeStatement = rangeStatement; +class ImportWeakDependency extends ImportDependency { + /** + * @param {string} request the request + * @param {[number, number]} range expression range + * @param {string[][]=} referencedExports list of referenced exports + */ + constructor(request, range, referencedExports) { + super(request, range, referencedExports); + this.weak = true; } get type() { - return "harmony export header"; - } - - serialize(context) { - const { write } = context; - write(this.range); - write(this.rangeStatement); - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - this.range = read(); - this.rangeStatement = read(); - super.deserialize(context); + return "import() weak"; } } makeSerializable( - HarmonyExportHeaderDependency, - "webpack/lib/dependencies/HarmonyExportHeaderDependency" + ImportWeakDependency, + "webpack/lib/dependencies/ImportWeakDependency" ); -HarmonyExportHeaderDependency.Template = class HarmonyExportDependencyTemplate extends ( - NullDependency.Template +ImportWeakDependency.Template = class ImportDependencyTemplate extends ( + ImportDependency.Template ) { /** * @param {Dependency} dependency the dependency for which the template should be applied @@ -84318,22 +80906,32 @@ HarmonyExportHeaderDependency.Template = class HarmonyExportDependencyTemplate e * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply(dependency, source, templateContext) { - const dep = /** @type {HarmonyExportHeaderDependency} */ (dependency); - const content = ""; - const replaceUntil = dep.range - ? dep.range[0] - 1 - : dep.rangeStatement[1] - 1; - source.replace(dep.rangeStatement[0], replaceUntil, content); + apply( + dependency, + source, + { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements } + ) { + const dep = /** @type {ImportWeakDependency} */ (dependency); + const content = runtimeTemplate.moduleNamespacePromise({ + chunkGraph, + module: moduleGraph.getModule(dep), + request: dep.request, + strict: module.buildMeta.strictHarmonyModule, + message: "import() weak", + weak: true, + runtimeRequirements + }); + + source.replace(dep.range[0], dep.range[1] - 1, content); } }; -module.exports = HarmonyExportHeaderDependency; +module.exports = ImportWeakDependency; /***/ }), -/***/ 67157: +/***/ 750: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -84344,895 +80942,735 @@ module.exports = HarmonyExportHeaderDependency; -const Dependency = __webpack_require__(54912); -const { UsageState } = __webpack_require__(63686); -const HarmonyLinkingError = __webpack_require__(97511); -const InitFragment = __webpack_require__(55870); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const { countIterable } = __webpack_require__(39104); -const { first, combine } = __webpack_require__(93347); const makeSerializable = __webpack_require__(33032); -const propertyAccess = __webpack_require__(54190); -const { getRuntimeKey, keyToRuntime } = __webpack_require__(17156); -const HarmonyExportInitFragment = __webpack_require__(89500); -const HarmonyImportDependency = __webpack_require__(57154); -const processExportInfo = __webpack_require__(55207); +const NullDependency = __webpack_require__(31830); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ /** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency").ExportSpec} ExportSpec */ /** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ /** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ExportsInfo")} ExportsInfo */ -/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */ -/** @typedef {import("../Module")} Module */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("../WebpackError")} WebpackError */ /** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -/** @typedef {"missing"|"unused"|"empty-star"|"reexport-dynamic-default"|"reexport-named-default"|"reexport-namespace-object"|"reexport-fake-namespace-object"|"reexport-undefined"|"normal-reexport"|"dynamic-reexport"} ExportModeType */ +const getExportsFromData = data => { + if (data && typeof data === "object") { + if (Array.isArray(data)) { + return data.map((item, idx) => { + return { + name: `${idx}`, + canMangle: true, + exports: getExportsFromData(item) + }; + }); + } else { + const exports = []; + for (const key of Object.keys(data)) { + exports.push({ + name: key, + canMangle: true, + exports: getExportsFromData(data[key]) + }); + } + return exports; + } + } + return undefined; +}; -const { ExportPresenceModes } = HarmonyImportDependency; +class JsonExportsDependency extends NullDependency { + /** + * @param {(string | ExportSpec)[]} exports json exports + */ + constructor(exports) { + super(); + this.exports = exports; + this._hashUpdate = undefined; + } -const idsSymbol = Symbol("HarmonyExportImportedSpecifierDependency.ids"); + get type() { + return "json exports"; + } -class NormalReexportItem { /** - * @param {string} name export name - * @param {string[]} ids reexported ids from other module - * @param {ExportInfo} exportInfo export info from other module - * @param {boolean} checked true, if it should be checked at runtime if this export exists - * @param {boolean} hidden true, if it is hidden behind another active export in the same module + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names */ - constructor(name, ids, exportInfo, checked, hidden) { - this.name = name; - this.ids = ids; - this.exportInfo = exportInfo; - this.checked = checked; - this.hidden = hidden; + getExports(moduleGraph) { + return { + exports: this.exports, + dependencies: undefined + }; } -} -class ExportMode { /** - * @param {ExportModeType} type type of the mode + * Update the hash + * @param {Hash} hash hash to be updated + * @param {UpdateHashContext} context context + * @returns {void} */ - constructor(type) { - /** @type {ExportModeType} */ - this.type = type; + updateHash(hash, context) { + if (this._hashUpdate === undefined) { + this._hashUpdate = this.exports + ? JSON.stringify(this.exports) + : "undefined"; + } + hash.update(this._hashUpdate); + } - // for "normal-reexport": - /** @type {NormalReexportItem[] | null} */ - this.items = null; + serialize(context) { + const { write } = context; + write(this.exports); + super.serialize(context); + } - // for "reexport-named-default" | "reexport-fake-namespace-object" | "reexport-namespace-object" - /** @type {string|null} */ - this.name = null; - /** @type {ExportInfo | null} */ - this.partialNamespaceExportInfo = null; + deserialize(context) { + const { read } = context; + this.exports = read(); + super.deserialize(context); + } +} - // for "dynamic-reexport": - /** @type {Set | null} */ - this.ignored = null; +makeSerializable( + JsonExportsDependency, + "webpack/lib/dependencies/JsonExportsDependency" +); - // for "dynamic-reexport" | "empty-star": - /** @type {Set | null} */ - this.hidden = null; +module.exports = JsonExportsDependency; +module.exports.getExportsFromData = getExportsFromData; - // for "missing": - /** @type {string | null} */ - this.userRequest = null; - // for "reexport-fake-namespace-object": - /** @type {number} */ - this.fakeType = 0; - } -} +/***/ }), -const determineExportAssignments = ( - moduleGraph, - dependencies, - additionalDependency -) => { - const names = new Set(); - const dependencyIndices = []; +/***/ 71693: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (additionalDependency) { - dependencies = dependencies.concat(additionalDependency); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - for (const dep of dependencies) { - const i = dependencyIndices.length; - dependencyIndices[i] = names.size; - const otherImportedModule = moduleGraph.getModule(dep); - if (otherImportedModule) { - const exportsInfo = moduleGraph.getExportsInfo(otherImportedModule); - for (const exportInfo of exportsInfo.exports) { - if ( - exportInfo.provided === true && - exportInfo.name !== "default" && - !names.has(exportInfo.name) - ) { - names.add(exportInfo.name); - dependencyIndices[i] = names.size; - } - } - } + + +const ModuleDependency = __webpack_require__(80321); + +class LoaderDependency extends ModuleDependency { + /** + * @param {string} request request string + */ + constructor(request) { + super(request); } - dependencyIndices.push(names.size); - return { names: Array.from(names), dependencyIndices }; -}; + get type() { + return "loader"; + } -const findDependencyForName = ( - { names, dependencyIndices }, - name, - dependencies -) => { - const dependenciesIt = dependencies[Symbol.iterator](); - const dependencyIndicesIt = dependencyIndices[Symbol.iterator](); - let dependenciesItResult = dependenciesIt.next(); - let dependencyIndicesItResult = dependencyIndicesIt.next(); - if (dependencyIndicesItResult.done) return; - for (let i = 0; i < names.length; i++) { - while (i >= dependencyIndicesItResult.value) { - dependenciesItResult = dependenciesIt.next(); - dependencyIndicesItResult = dependencyIndicesIt.next(); - if (dependencyIndicesItResult.done) return; - } - if (names[i] === name) return dependenciesItResult.value; + get category() { + return "loader"; } - return undefined; -}; +} -/** - * @param {ModuleGraph} moduleGraph the module graph - * @param {HarmonyExportImportedSpecifierDependency} dep the dependency - * @param {string} runtimeKey the runtime key - * @returns {ExportMode} the export mode - */ -const getMode = (moduleGraph, dep, runtimeKey) => { - const importedModule = moduleGraph.getModule(dep); +module.exports = LoaderDependency; - if (!importedModule) { - const mode = new ExportMode("missing"); - mode.userRequest = dep.userRequest; +/***/ }), - return mode; - } +/***/ 223: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const name = dep.name; - const runtime = keyToRuntime(runtimeKey); - const parentModule = moduleGraph.getParentModule(dep); - const exportsInfo = moduleGraph.getExportsInfo(parentModule); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if ( - name - ? exportsInfo.getUsed(name, runtime) === UsageState.Unused - : exportsInfo.isUsed(runtime) === false - ) { - const mode = new ExportMode("unused"); - mode.name = name || "*"; - return mode; +const ModuleDependency = __webpack_require__(80321); + +class LoaderImportDependency extends ModuleDependency { + /** + * @param {string} request request string + */ + constructor(request) { + super(request); + this.weak = true; } - const importedExportsType = importedModule.getExportsType( - moduleGraph, - parentModule.buildMeta.strictHarmonyModule - ); + get type() { + return "loader import"; + } - const ids = dep.getIds(moduleGraph); + get category() { + return "loaderImport"; + } +} - // Special handling for reexporting the default export - // from non-namespace modules - if (name && ids.length > 0 && ids[0] === "default") { - switch (importedExportsType) { - case "dynamic": { - const mode = new ExportMode("reexport-dynamic-default"); +module.exports = LoaderImportDependency; - mode.name = name; - return mode; - } - case "default-only": - case "default-with-named": { - const exportInfo = exportsInfo.getReadOnlyExportInfo(name); - const mode = new ExportMode("reexport-named-default"); +/***/ }), - mode.name = name; - mode.partialNamespaceExportInfo = exportInfo; +/***/ 24721: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - return mode; - } - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // reexporting with a fixed name - if (name) { - let mode; - const exportInfo = exportsInfo.getReadOnlyExportInfo(name); - if (ids.length > 0) { - // export { name as name } - switch (importedExportsType) { - case "default-only": - mode = new ExportMode("reexport-undefined"); - mode.name = name; - break; - default: - mode = new ExportMode("normal-reexport"); - mode.items = [ - new NormalReexportItem(name, ids, exportInfo, false, false) - ]; - break; - } - } else { - // export * as name - switch (importedExportsType) { - case "default-only": - mode = new ExportMode("reexport-fake-namespace-object"); - mode.name = name; - mode.partialNamespaceExportInfo = exportInfo; - mode.fakeType = 0; - break; - case "default-with-named": - mode = new ExportMode("reexport-fake-namespace-object"); - mode.name = name; - mode.partialNamespaceExportInfo = exportInfo; - mode.fakeType = 2; - break; - case "dynamic": - default: - mode = new ExportMode("reexport-namespace-object"); - mode.name = name; - mode.partialNamespaceExportInfo = exportInfo; - } - } - return mode; - } +const NormalModule = __webpack_require__(39); +const LazySet = __webpack_require__(38938); +const LoaderDependency = __webpack_require__(71693); +const LoaderImportDependency = __webpack_require__(223); - // Star reexporting +/** @typedef {import("../Compilation").DepConstructor} DepConstructor */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ - const { ignoredExports, exports, checked, hidden } = dep.getStarReexports( - moduleGraph, - runtime, - exportsInfo, - importedModule - ); - if (!exports) { - // We have too few info about the modules - // Delegate the logic to the runtime code +/** + * @callback LoadModuleCallback + * @param {(Error | null)=} err error object + * @param {string | Buffer=} source source code + * @param {object=} map source map + * @param {Module=} module loaded module if successful + */ - const mode = new ExportMode("dynamic-reexport"); - mode.ignored = ignoredExports; - mode.hidden = hidden; +/** + * @callback ImportModuleCallback + * @param {(Error | null)=} err error object + * @param {any=} exports exports of the evaluated module + */ - return mode; - } +/** + * @typedef {Object} ImportModuleOptions + * @property {string=} layer the target layer + * @property {string=} publicPath the target public path + */ - if (exports.size === 0) { - const mode = new ExportMode("empty-star"); - mode.hidden = hidden; +class LoaderPlugin { + /** + * @param {Object} options options + */ + constructor(options = {}) {} - return mode; - } + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "LoaderPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + LoaderDependency, + normalModuleFactory + ); + compilation.dependencyFactories.set( + LoaderImportDependency, + normalModuleFactory + ); + } + ); - const mode = new ExportMode("normal-reexport"); + compiler.hooks.compilation.tap("LoaderPlugin", compilation => { + const moduleGraph = compilation.moduleGraph; + NormalModule.getCompilationHooks(compilation).loader.tap( + "LoaderPlugin", + loaderContext => { + /** + * @param {string} request the request string to load the module from + * @param {LoadModuleCallback} callback callback returning the loaded module or error + * @returns {void} + */ + loaderContext.loadModule = (request, callback) => { + const dep = new LoaderDependency(request); + dep.loc = { + name: request + }; + const factory = compilation.dependencyFactories.get( + /** @type {DepConstructor} */ (dep.constructor) + ); + if (factory === undefined) { + return callback( + new Error( + `No module factory available for dependency type: ${dep.constructor.name}` + ) + ); + } + compilation.buildQueue.increaseParallelism(); + compilation.handleModuleCreation( + { + factory, + dependencies: [dep], + originModule: loaderContext._module, + context: loaderContext.context, + recursive: false + }, + err => { + compilation.buildQueue.decreaseParallelism(); + if (err) { + return callback(err); + } + const referencedModule = moduleGraph.getModule(dep); + if (!referencedModule) { + return callback(new Error("Cannot load the module")); + } + if (referencedModule.getNumberOfErrors() > 0) { + return callback( + new Error("The loaded module contains errors") + ); + } + const moduleSource = referencedModule.originalSource(); + if (!moduleSource) { + return callback( + new Error( + "The module created for a LoaderDependency must have an original source" + ) + ); + } + let source, map; + if (moduleSource.sourceAndMap) { + const sourceAndMap = moduleSource.sourceAndMap(); + map = sourceAndMap.map; + source = sourceAndMap.source; + } else { + map = moduleSource.map(); + source = moduleSource.source(); + } + const fileDependencies = new LazySet(); + const contextDependencies = new LazySet(); + const missingDependencies = new LazySet(); + const buildDependencies = new LazySet(); + referencedModule.addCacheDependencies( + fileDependencies, + contextDependencies, + missingDependencies, + buildDependencies + ); - mode.items = Array.from( - exports, - exportName => - new NormalReexportItem( - exportName, - [exportName], - exportsInfo.getReadOnlyExportInfo(exportName), - checked.has(exportName), - false - ) - ); - if (hidden !== undefined) { - for (const exportName of hidden) { - mode.items.push( - new NormalReexportItem( - exportName, - [exportName], - exportsInfo.getReadOnlyExportInfo(exportName), - false, - true - ) + for (const d of fileDependencies) { + loaderContext.addDependency(d); + } + for (const d of contextDependencies) { + loaderContext.addContextDependency(d); + } + for (const d of missingDependencies) { + loaderContext.addMissingDependency(d); + } + for (const d of buildDependencies) { + loaderContext.addBuildDependency(d); + } + return callback(null, source, map, referencedModule); + } + ); + }; + + /** + * @param {string} request the request string to load the module from + * @param {ImportModuleOptions=} options options + * @param {ImportModuleCallback=} callback callback returning the exports + * @returns {void} + */ + const importModule = (request, options, callback) => { + const dep = new LoaderImportDependency(request); + dep.loc = { + name: request + }; + const factory = compilation.dependencyFactories.get( + /** @type {DepConstructor} */ (dep.constructor) + ); + if (factory === undefined) { + return callback( + new Error( + `No module factory available for dependency type: ${dep.constructor.name}` + ) + ); + } + compilation.buildQueue.increaseParallelism(); + compilation.handleModuleCreation( + { + factory, + dependencies: [dep], + originModule: loaderContext._module, + contextInfo: { + issuerLayer: options.layer + }, + context: loaderContext.context, + connectOrigin: false + }, + err => { + compilation.buildQueue.decreaseParallelism(); + if (err) { + return callback(err); + } + const referencedModule = moduleGraph.getModule(dep); + if (!referencedModule) { + return callback(new Error("Cannot load the module")); + } + compilation.executeModule( + referencedModule, + { + entryOptions: { + publicPath: options.publicPath + } + }, + (err, result) => { + if (err) return callback(err); + for (const d of result.fileDependencies) { + loaderContext.addDependency(d); + } + for (const d of result.contextDependencies) { + loaderContext.addContextDependency(d); + } + for (const d of result.missingDependencies) { + loaderContext.addMissingDependency(d); + } + for (const d of result.buildDependencies) { + loaderContext.addBuildDependency(d); + } + if (result.cacheable === false) + loaderContext.cacheable(false); + for (const [name, { source, info }] of result.assets) { + const { buildInfo } = loaderContext._module; + if (!buildInfo.assets) { + buildInfo.assets = Object.create(null); + buildInfo.assetsInfo = new Map(); + } + buildInfo.assets[name] = source; + buildInfo.assetsInfo.set(name, info); + } + callback(null, result.exports); + } + ); + } + ); + }; + + /** + * @param {string} request the request string to load the module from + * @param {ImportModuleOptions} options options + * @param {ImportModuleCallback=} callback callback returning the exports + * @returns {Promise | void} exports + */ + loaderContext.importModule = (request, options, callback) => { + if (!callback) { + return new Promise((resolve, reject) => { + importModule(request, options || {}, (err, result) => { + if (err) reject(err); + else resolve(result); + }); + }); + } + return importModule(request, options || {}, callback); + }; + } ); - } + }); } +} +module.exports = LoaderPlugin; - return mode; -}; -class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { - /** - * @param {string} request the request string - * @param {number} sourceOrder the order in the original source file - * @param {string[]} ids the requested export name of the imported module - * @param {string | null} name the export name of for this module - * @param {Set} activeExports other named exports in the module - * @param {ReadonlyArray | Iterable} otherStarExports other star exports in the module before this import - * @param {number} exportPresenceMode mode of checking export names - * @param {HarmonyStarExportsList} allStarExports all star exports in the module - * @param {Record=} assertions import assertions - */ - constructor( - request, - sourceOrder, - ids, - name, - activeExports, - otherStarExports, - exportPresenceMode, - allStarExports, - assertions - ) { - super(request, sourceOrder, assertions); +/***/ }), - this.ids = ids; +/***/ 5826: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const makeSerializable = __webpack_require__(33032); + +class LocalModule { + constructor(name, idx) { this.name = name; - this.activeExports = activeExports; - this.otherStarExports = otherStarExports; - this.exportPresenceMode = exportPresenceMode; - this.allStarExports = allStarExports; + this.idx = idx; + this.used = false; } - /** - * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module - */ - couldAffectReferencingModule() { - return Dependency.TRANSITIVE; + flagUsed() { + this.used = true; } - // TODO webpack 6 remove - get id() { - throw new Error("id was renamed to ids and type changed to string[]"); + variableName() { + return "__WEBPACK_LOCAL_MODULE_" + this.idx + "__"; } - // TODO webpack 6 remove - getId() { - throw new Error("id was renamed to ids and type changed to string[]"); + serialize(context) { + const { write } = context; + + write(this.name); + write(this.idx); + write(this.used); } - // TODO webpack 6 remove - setId() { - throw new Error("id was renamed to ids and type changed to string[]"); + deserialize(context) { + const { read } = context; + + this.name = read(); + this.idx = read(); + this.used = read(); } +} - get type() { - return "harmony export imported specifier"; +makeSerializable(LocalModule, "webpack/lib/dependencies/LocalModule"); + +module.exports = LocalModule; + + +/***/ }), + +/***/ 52805: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + +class LocalModuleDependency extends NullDependency { + constructor(localModule, range, callNew) { + super(); + + this.localModule = localModule; + this.range = range; + this.callNew = callNew; } - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {string[]} the imported id - */ - getIds(moduleGraph) { - return moduleGraph.getMeta(this)[idsSymbol] || this.ids; + serialize(context) { + const { write } = context; + + write(this.localModule); + write(this.range); + write(this.callNew); + + super.serialize(context); } - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {string[]} ids the imported ids - * @returns {void} - */ - setIds(moduleGraph, ids) { - moduleGraph.getMeta(this)[idsSymbol] = ids; + deserialize(context) { + const { read } = context; + + this.localModule = read(); + this.range = read(); + this.callNew = read(); + + super.deserialize(context); } +} + +makeSerializable( + LocalModuleDependency, + "webpack/lib/dependencies/LocalModuleDependency" +); +LocalModuleDependency.Template = class LocalModuleDependencyTemplate extends ( + NullDependency.Template +) { /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {RuntimeSpec} runtime the runtime - * @returns {ExportMode} the export mode + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - getMode(moduleGraph, runtime) { - return moduleGraph.dependencyCacheProvide( - this, - getRuntimeKey(runtime), - getMode - ); + apply(dependency, source, templateContext) { + const dep = /** @type {LocalModuleDependency} */ (dependency); + if (!dep.range) return; + const moduleInstance = dep.callNew + ? `new (function () { return ${dep.localModule.variableName()}; })()` + : dep.localModule.variableName(); + source.replace(dep.range[0], dep.range[1] - 1, moduleInstance); } +}; - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {RuntimeSpec} runtime the runtime - * @param {ExportsInfo} exportsInfo exports info about the current module (optional) - * @param {Module} importedModule the imported module (optional) - * @returns {{exports?: Set, checked?: Set, ignoredExports: Set, hidden?: Set}} information - */ - getStarReexports( - moduleGraph, - runtime, - exportsInfo = moduleGraph.getExportsInfo(moduleGraph.getParentModule(this)), - importedModule = moduleGraph.getModule(this) - ) { - const importedExportsInfo = moduleGraph.getExportsInfo(importedModule); +module.exports = LocalModuleDependency; - const noExtraExports = - importedExportsInfo.otherExportsInfo.provided === false; - const noExtraImports = - exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused; - const ignoredExports = new Set(["default", ...this.activeExports]); +/***/ }), - let hiddenExports = undefined; - const otherStarExports = - this._discoverActiveExportsFromOtherStarExports(moduleGraph); - if (otherStarExports !== undefined) { - hiddenExports = new Set(); - for (let i = 0; i < otherStarExports.namesSlice; i++) { - hiddenExports.add(otherStarExports.names[i]); - } - for (const e of ignoredExports) hiddenExports.delete(e); - } +/***/ 75827: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - if (!noExtraExports && !noExtraImports) { - return { - ignoredExports, - hidden: hiddenExports - }; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** @type {Set} */ - const exports = new Set(); - /** @type {Set} */ - const checked = new Set(); - /** @type {Set} */ - const hidden = hiddenExports !== undefined ? new Set() : undefined; - if (noExtraImports) { - for (const exportInfo of exportsInfo.orderedExports) { - const name = exportInfo.name; - if (ignoredExports.has(name)) continue; - if (exportInfo.getUsed(runtime) === UsageState.Unused) continue; - const importedExportInfo = - importedExportsInfo.getReadOnlyExportInfo(name); - if (importedExportInfo.provided === false) continue; - if (hiddenExports !== undefined && hiddenExports.has(name)) { - hidden.add(name); - continue; - } - exports.add(name); - if (importedExportInfo.provided === true) continue; - checked.add(name); - } - } else if (noExtraExports) { - for (const importedExportInfo of importedExportsInfo.orderedExports) { - const name = importedExportInfo.name; - if (ignoredExports.has(name)) continue; - if (importedExportInfo.provided === false) continue; - const exportInfo = exportsInfo.getReadOnlyExportInfo(name); - if (exportInfo.getUsed(runtime) === UsageState.Unused) continue; - if (hiddenExports !== undefined && hiddenExports.has(name)) { - hidden.add(name); - continue; - } - exports.add(name); - if (importedExportInfo.provided === true) continue; - checked.add(name); - } - } - return { ignoredExports, exports, checked, hidden }; +const LocalModule = __webpack_require__(5826); + +const lookup = (parent, mod) => { + if (mod.charAt(0) !== ".") return mod; + + var path = parent.split("/"); + var segments = mod.split("/"); + path.pop(); + + for (let i = 0; i < segments.length; i++) { + const seg = segments[i]; + if (seg === "..") { + path.pop(); + } else if (seg !== ".") { + path.push(seg); + } } - /** - * @param {ModuleGraph} moduleGraph module graph - * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active - */ - getCondition(moduleGraph) { - return (connection, runtime) => { - const mode = this.getMode(moduleGraph, runtime); - return mode.type !== "unused" && mode.type !== "empty-star"; - }; + return path.join("/"); +}; + +exports.addLocalModule = (state, name) => { + if (!state.localModules) { + state.localModules = []; } + const m = new LocalModule(name, state.localModules.length); + state.localModules.push(m); + return m; +}; - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this dependency connects the module to referencing modules - */ - getModuleEvaluationSideEffectsState(moduleGraph) { - return false; +exports.getLocalModule = (state, name, namedModule) => { + if (!state.localModules) return null; + if (namedModule) { + // resolve dependency name relative to the defining named module + name = lookup(namedModule, name); + } + for (let i = 0; i < state.localModules.length; i++) { + if (state.localModules[i].name === name) { + return state.localModules[i]; + } } + return null; +}; - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - const mode = this.getMode(moduleGraph, runtime); - switch (mode.type) { - case "missing": - case "unused": - case "empty-star": - case "reexport-undefined": - return Dependency.NO_EXPORTS_REFERENCED; +/***/ }), - case "reexport-dynamic-default": - return Dependency.EXPORTS_OBJECT_REFERENCED; +/***/ 88488: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - case "reexport-named-default": { - if (!mode.partialNamespaceExportInfo) - return Dependency.EXPORTS_OBJECT_REFERENCED; - /** @type {string[][]} */ - const referencedExports = []; - processExportInfo( - runtime, - referencedExports, - [], - /** @type {ExportInfo} */ (mode.partialNamespaceExportInfo) - ); - return referencedExports; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - case "reexport-namespace-object": - case "reexport-fake-namespace-object": { - if (!mode.partialNamespaceExportInfo) - return Dependency.EXPORTS_OBJECT_REFERENCED; - /** @type {string[][]} */ - const referencedExports = []; - processExportInfo( - runtime, - referencedExports, - [], - /** @type {ExportInfo} */ (mode.partialNamespaceExportInfo), - mode.type === "reexport-fake-namespace-object" - ); - return referencedExports; - } - case "dynamic-reexport": - return Dependency.EXPORTS_OBJECT_REFERENCED; - case "normal-reexport": { - const referencedExports = []; - for (const { ids, exportInfo, hidden } of mode.items) { - if (hidden) continue; - processExportInfo(runtime, referencedExports, ids, exportInfo, false); - } - return referencedExports; - } +const Dependency = __webpack_require__(54912); +const InitFragment = __webpack_require__(55870); +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); - default: - throw new Error(`Unknown mode ${mode.type}`); - } - } +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +class ModuleDecoratorDependency extends NullDependency { /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {{ names: string[], namesSlice: number, dependencyIndices: number[], dependencyIndex: number } | undefined} exported names and their origin dependency + * @param {string} decorator the decorator requirement + * @param {boolean} allowExportsAccess allow to access exports from module */ - _discoverActiveExportsFromOtherStarExports(moduleGraph) { - if (!this.otherStarExports) return undefined; - - const i = - "length" in this.otherStarExports - ? this.otherStarExports.length - : countIterable(this.otherStarExports); - if (i === 0) return undefined; - - if (this.allStarExports) { - const { names, dependencyIndices } = moduleGraph.cached( - determineExportAssignments, - this.allStarExports.dependencies - ); - - return { - names, - namesSlice: dependencyIndices[i - 1], - dependencyIndices, - dependencyIndex: i - }; - } - - const { names, dependencyIndices } = moduleGraph.cached( - determineExportAssignments, - this.otherStarExports, - this - ); - - return { - names, - namesSlice: dependencyIndices[i - 1], - dependencyIndices, - dependencyIndex: i - }; + constructor(decorator, allowExportsAccess) { + super(); + this.decorator = decorator; + this.allowExportsAccess = allowExportsAccess; + this._hashUpdate = undefined; } /** - * Returns the exported names - * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names + * @returns {string} a display name for the type of dependency */ - getExports(moduleGraph) { - const mode = this.getMode(moduleGraph, undefined); - - switch (mode.type) { - case "missing": - return undefined; - case "dynamic-reexport": { - const from = moduleGraph.getConnection(this); - return { - exports: true, - from, - canMangle: false, - excludeExports: mode.hidden - ? combine(mode.ignored, mode.hidden) - : mode.ignored, - hideExports: mode.hidden, - dependencies: [from.module] - }; - } - case "empty-star": - return { - exports: [], - hideExports: mode.hidden, - dependencies: [moduleGraph.getModule(this)] - }; - // falls through - case "normal-reexport": { - const from = moduleGraph.getConnection(this); - return { - exports: Array.from(mode.items, item => ({ - name: item.name, - from, - export: item.ids, - hidden: item.hidden - })), - priority: 1, - dependencies: [from.module] - }; - } - case "reexport-dynamic-default": { - { - const from = moduleGraph.getConnection(this); - return { - exports: [ - { - name: mode.name, - from, - export: ["default"] - } - ], - priority: 1, - dependencies: [from.module] - }; - } - } - case "reexport-undefined": - return { - exports: [mode.name], - dependencies: [moduleGraph.getModule(this)] - }; - case "reexport-fake-namespace-object": { - const from = moduleGraph.getConnection(this); - return { - exports: [ - { - name: mode.name, - from, - export: null, - exports: [ - { - name: "default", - canMangle: false, - from, - export: null - } - ] - } - ], - priority: 1, - dependencies: [from.module] - }; - } - case "reexport-namespace-object": { - const from = moduleGraph.getConnection(this); - return { - exports: [ - { - name: mode.name, - from, - export: null - } - ], - priority: 1, - dependencies: [from.module] - }; - } - case "reexport-named-default": { - const from = moduleGraph.getConnection(this); - return { - exports: [ - { - name: mode.name, - from, - export: ["default"] - } - ], - priority: 1, - dependencies: [from.module] - }; - } - default: - throw new Error(`Unknown mode ${mode.type}`); - } + get type() { + return "module decorator"; } - /** - * @param {ModuleGraph} moduleGraph module graph - * @returns {number} effective mode - */ - _getEffectiveExportPresenceLevel(moduleGraph) { - if (this.exportPresenceMode !== ExportPresenceModes.AUTO) - return this.exportPresenceMode; - return moduleGraph.getParentModule(this).buildMeta.strictHarmonyModule - ? ExportPresenceModes.ERROR - : ExportPresenceModes.WARN; + get category() { + return "self"; } /** - * Returns warnings - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[]} warnings + * @returns {string | null} an identifier to merge equal requests */ - getWarnings(moduleGraph) { - const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); - if (exportsPresence === ExportPresenceModes.WARN) { - return this._getErrors(moduleGraph); - } - return null; + getResourceIdentifier() { + return `self`; } /** - * Returns errors + * Returns list of exports referenced by this dependency * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[]} errors + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports */ - getErrors(moduleGraph) { - const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); - if (exportsPresence === ExportPresenceModes.ERROR) { - return this._getErrors(moduleGraph); - } - return null; + getReferencedExports(moduleGraph, runtime) { + return this.allowExportsAccess + ? Dependency.EXPORTS_OBJECT_REFERENCED + : Dependency.NO_EXPORTS_REFERENCED; } /** - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[] | undefined} errors + * Update the hash + * @param {Hash} hash hash to be updated + * @param {UpdateHashContext} context context + * @returns {void} */ - _getErrors(moduleGraph) { - const ids = this.getIds(moduleGraph); - let errors = this.getLinkingErrors( - moduleGraph, - ids, - `(reexported as '${this.name}')` - ); - if (ids.length === 0 && this.name === null) { - const potentialConflicts = - this._discoverActiveExportsFromOtherStarExports(moduleGraph); - if (potentialConflicts && potentialConflicts.namesSlice > 0) { - const ownNames = new Set( - potentialConflicts.names.slice( - potentialConflicts.namesSlice, - potentialConflicts.dependencyIndices[ - potentialConflicts.dependencyIndex - ] - ) - ); - const importedModule = moduleGraph.getModule(this); - if (importedModule) { - const exportsInfo = moduleGraph.getExportsInfo(importedModule); - const conflicts = new Map(); - for (const exportInfo of exportsInfo.orderedExports) { - if (exportInfo.provided !== true) continue; - if (exportInfo.name === "default") continue; - if (this.activeExports.has(exportInfo.name)) continue; - if (ownNames.has(exportInfo.name)) continue; - const conflictingDependency = findDependencyForName( - potentialConflicts, - exportInfo.name, - this.allStarExports - ? this.allStarExports.dependencies - : [...this.otherStarExports, this] - ); - if (!conflictingDependency) continue; - const target = exportInfo.getTerminalBinding(moduleGraph); - if (!target) continue; - const conflictingModule = moduleGraph.getModule( - conflictingDependency - ); - if (conflictingModule === importedModule) continue; - const conflictingExportInfo = moduleGraph.getExportInfo( - conflictingModule, - exportInfo.name - ); - const conflictingTarget = - conflictingExportInfo.getTerminalBinding(moduleGraph); - if (!conflictingTarget) continue; - if (target === conflictingTarget) continue; - const list = conflicts.get(conflictingDependency.request); - if (list === undefined) { - conflicts.set(conflictingDependency.request, [exportInfo.name]); - } else { - list.push(exportInfo.name); - } - } - for (const [request, exports] of conflicts) { - if (!errors) errors = []; - errors.push( - new HarmonyLinkingError( - `The requested module '${ - this.request - }' contains conflicting star exports for the ${ - exports.length > 1 ? "names" : "name" - } ${exports - .map(e => `'${e}'`) - .join(", ")} with the previous requested module '${request}'` - ) - ); - } - } - } + updateHash(hash, context) { + if (this._hashUpdate === undefined) { + this._hashUpdate = `${this.decorator}${this.allowExportsAccess}`; } - return errors; + hash.update(this._hashUpdate); } serialize(context) { - const { write, setCircularReference } = context; - - setCircularReference(this); - write(this.ids); - write(this.name); - write(this.activeExports); - write(this.otherStarExports); - write(this.exportPresenceMode); - write(this.allStarExports); - + const { write } = context; + write(this.decorator); + write(this.allowExportsAccess); super.serialize(context); } deserialize(context) { - const { read, setCircularReference } = context; - - setCircularReference(this); - this.ids = read(); - this.name = read(); - this.activeExports = read(); - this.otherStarExports = read(); - this.exportPresenceMode = read(); - this.allStarExports = read(); - + const { read } = context; + this.decorator = read(); + this.allowExportsAccess = read(); super.deserialize(context); } } makeSerializable( - HarmonyExportImportedSpecifierDependency, - "webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency" + ModuleDecoratorDependency, + "webpack/lib/dependencies/ModuleDecoratorDependency" ); -module.exports = HarmonyExportImportedSpecifierDependency; - -HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedSpecifierDependencyTemplate extends ( - HarmonyImportDependency.Template +ModuleDecoratorDependency.Template = class ModuleDecoratorDependencyTemplate extends ( + NullDependency.Template ) { /** * @param {Dependency} dependency the dependency for which the template should be applied @@ -85240,379 +81678,253 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply(dependency, source, templateContext) { - const { moduleGraph, runtime, concatenationScope } = templateContext; - - const dep = /** @type {HarmonyExportImportedSpecifierDependency} */ ( - dependency + apply( + dependency, + source, + { module, chunkGraph, initFragments, runtimeRequirements } + ) { + const dep = /** @type {ModuleDecoratorDependency} */ (dependency); + runtimeRequirements.add(RuntimeGlobals.moduleLoaded); + runtimeRequirements.add(RuntimeGlobals.moduleId); + runtimeRequirements.add(RuntimeGlobals.module); + runtimeRequirements.add(dep.decorator); + initFragments.push( + new InitFragment( + `/* module decorator */ ${module.moduleArgument} = ${dep.decorator}(${module.moduleArgument});\n`, + InitFragment.STAGE_PROVIDES, + 0, + `module decorator ${chunkGraph.getModuleId(module)}` + ) ); + } +}; - const mode = dep.getMode(moduleGraph, runtime); +module.exports = ModuleDecoratorDependency; - if (concatenationScope) { - switch (mode.type) { - case "reexport-undefined": - concatenationScope.registerRawExport( - mode.name, - "/* reexport non-default export from non-harmony */ undefined" - ); - } - return; - } - if (mode.type !== "unused" && mode.type !== "empty-star") { - super.apply(dependency, source, templateContext); +/***/ }), - this._addExportFragments( - templateContext.initFragments, - dep, - mode, - templateContext.module, - moduleGraph, - runtime, - templateContext.runtimeTemplate, - templateContext.runtimeRequirements - ); - } - } +/***/ 80321: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {InitFragment[]} initFragments target array for init fragments - * @param {HarmonyExportImportedSpecifierDependency} dep dependency - * @param {ExportMode} mode the export mode - * @param {Module} module the current module - * @param {ModuleGraph} moduleGraph the module graph - * @param {RuntimeSpec} runtime the runtime - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @param {Set} runtimeRequirements runtime requirements - * @returns {void} - */ - _addExportFragments( - initFragments, - dep, - mode, - module, - moduleGraph, - runtime, - runtimeTemplate, - runtimeRequirements - ) { - const importedModule = moduleGraph.getModule(dep); - const importVar = dep.getImportVar(moduleGraph); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - switch (mode.type) { - case "missing": - case "empty-star": - initFragments.push( - new InitFragment( - "/* empty/unused harmony star reexport */\n", - InitFragment.STAGE_HARMONY_EXPORTS, - 1 - ) - ); - break; - case "unused": - initFragments.push( - new InitFragment( - `${Template.toNormalComment( - `unused harmony reexport ${mode.name}` - )}\n`, - InitFragment.STAGE_HARMONY_EXPORTS, - 1 - ) - ); - break; - case "reexport-dynamic-default": - initFragments.push( - this.getReexportFragment( - module, - "reexport default from dynamic", - moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), - importVar, - null, - runtimeRequirements - ) - ); - break; +const Dependency = __webpack_require__(54912); +const DependencyTemplate = __webpack_require__(5160); +const memoize = __webpack_require__(78676); - case "reexport-fake-namespace-object": - initFragments.push( - ...this.getReexportFakeNamespaceObjectFragments( - module, - moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), - importVar, - mode.fakeType, - runtimeRequirements - ) - ); - break; +/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ +/** @typedef {import("../Module")} Module */ - case "reexport-undefined": - initFragments.push( - this.getReexportFragment( - module, - "reexport non-default export from non-harmony", - moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), - "undefined", - "", - runtimeRequirements - ) - ); - break; +const getRawModule = memoize(() => __webpack_require__(84929)); - case "reexport-named-default": - initFragments.push( - this.getReexportFragment( - module, - "reexport default export from named module", - moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), - importVar, - "", - runtimeRequirements - ) - ); - break; +class ModuleDependency extends Dependency { + /** + * @param {string} request request path which needs resolving + */ + constructor(request) { + super(); + this.request = request; + this.userRequest = request; + this.range = undefined; + // assertions must be serialized by subclasses that use it + /** @type {Record | undefined} */ + this.assertions = undefined; + } - case "reexport-namespace-object": - initFragments.push( - this.getReexportFragment( - module, - "reexport module object", - moduleGraph.getExportsInfo(module).getUsedName(mode.name, runtime), - importVar, - "", - runtimeRequirements - ) - ); - break; + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + let str = `module${this.request}`; + if (this.assertions !== undefined) { + str += JSON.stringify(this.assertions); + } + return str; + } - case "normal-reexport": - for (const { name, ids, checked, hidden } of mode.items) { - if (hidden) continue; - if (checked) { - initFragments.push( - new InitFragment( - "/* harmony reexport (checked) */ " + - this.getConditionalReexportStatement( - module, - name, - importVar, - ids, - runtimeRequirements - ), - moduleGraph.isAsync(importedModule) - ? InitFragment.STAGE_ASYNC_HARMONY_IMPORTS - : InitFragment.STAGE_HARMONY_IMPORTS, - dep.sourceOrder - ) - ); - } else { - initFragments.push( - this.getReexportFragment( - module, - "reexport safe", - moduleGraph.getExportsInfo(module).getUsedName(name, runtime), - importVar, - moduleGraph - .getExportsInfo(importedModule) - .getUsedName(ids, runtime), - runtimeRequirements - ) - ); - } - } - break; + /** + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + */ + couldAffectReferencingModule() { + return true; + } - case "dynamic-reexport": { - const ignored = mode.hidden - ? combine(mode.ignored, mode.hidden) - : mode.ignored; - const modern = - runtimeTemplate.supportsConst() && - runtimeTemplate.supportsArrowFunction(); - let content = - "/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};\n" + - `/* harmony reexport (unknown) */ for(${ - modern ? "const" : "var" - } __WEBPACK_IMPORT_KEY__ in ${importVar}) `; + /** + * @param {string} context context directory + * @returns {Module} a module + */ + createIgnoredModule(context) { + const RawModule = getRawModule(); + return new RawModule( + "/* (ignored) */", + `ignored|${context}|${this.request}`, + `${this.request} (ignored)` + ); + } - // Filter out exports which are defined by other exports - // and filter out default export because it cannot be reexported with * - if (ignored.size > 1) { - content += - "if(" + - JSON.stringify(Array.from(ignored)) + - ".indexOf(__WEBPACK_IMPORT_KEY__) < 0) "; - } else if (ignored.size === 1) { - content += `if(__WEBPACK_IMPORT_KEY__ !== ${JSON.stringify( - first(ignored) - )}) `; - } + serialize(context) { + const { write } = context; + write(this.request); + write(this.userRequest); + write(this.range); + super.serialize(context); + } - content += `__WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = `; - if (modern) { - content += `() => ${importVar}[__WEBPACK_IMPORT_KEY__]`; - } else { - content += `function(key) { return ${importVar}[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)`; - } + deserialize(context) { + const { read } = context; + this.request = read(); + this.userRequest = read(); + this.range = read(); + super.deserialize(context); + } +} - runtimeRequirements.add(RuntimeGlobals.exports); - runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); +ModuleDependency.Template = DependencyTemplate; - const exportsName = module.exportsArgument; - initFragments.push( - new InitFragment( - `${content}\n/* harmony reexport (unknown) */ ${RuntimeGlobals.definePropertyGetters}(${exportsName}, __WEBPACK_REEXPORT_OBJECT__);\n`, - moduleGraph.isAsync(importedModule) - ? InitFragment.STAGE_ASYNC_HARMONY_IMPORTS - : InitFragment.STAGE_HARMONY_IMPORTS, - dep.sourceOrder - ) - ); - break; - } +module.exports = ModuleDependency; - default: - throw new Error(`Unknown mode ${mode.type}`); - } - } - getReexportFragment( - module, - comment, - key, - name, - valueKey, - runtimeRequirements - ) { - const returnValue = this.getReturnValue(name, valueKey); +/***/ }), - runtimeRequirements.add(RuntimeGlobals.exports); - runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); +/***/ 80825: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const map = new Map(); - map.set(key, `/* ${comment} */ ${returnValue}`); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - return new HarmonyExportInitFragment(module.exportsArgument, map); - } - getReexportFakeNamespaceObjectFragments( - module, - key, - name, - fakeType, - runtimeRequirements - ) { - runtimeRequirements.add(RuntimeGlobals.exports); - runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); - runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); - const map = new Map(); - map.set( - key, - `/* reexport fake namespace object from non-harmony */ ${name}_namespace_cache || (${name}_namespace_cache = ${ - RuntimeGlobals.createFakeNamespaceObject - }(${name}${fakeType ? `, ${fakeType}` : ""}))` - ); +const ModuleDependency = __webpack_require__(80321); - return [ - new InitFragment( - `var ${name}_namespace_cache;\n`, - InitFragment.STAGE_CONSTANTS, - -1, - `${name}_namespace_cache` - ), - new HarmonyExportInitFragment(module.exportsArgument, map) - ]; +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + +class ModuleDependencyTemplateAsId extends ModuleDependency.Template { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply(dependency, source, { runtimeTemplate, moduleGraph, chunkGraph }) { + const dep = /** @type {ModuleDependency} */ (dependency); + if (!dep.range) return; + const content = runtimeTemplate.moduleId({ + module: moduleGraph.getModule(dep), + chunkGraph, + request: dep.request, + weak: dep.weak + }); + source.replace(dep.range[0], dep.range[1] - 1, content); } +} - getConditionalReexportStatement( - module, - key, - name, - valueKey, - runtimeRequirements - ) { - if (valueKey === false) { - return "/* unused export */\n"; - } +module.exports = ModuleDependencyTemplateAsId; - const exportsName = module.exportsArgument; - const returnValue = this.getReturnValue(name, valueKey); - runtimeRequirements.add(RuntimeGlobals.exports); - runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); - runtimeRequirements.add(RuntimeGlobals.hasOwnProperty); +/***/ }), - return `if(${RuntimeGlobals.hasOwnProperty}(${name}, ${JSON.stringify( - valueKey[0] - )})) ${ - RuntimeGlobals.definePropertyGetters - }(${exportsName}, { ${JSON.stringify( - key - )}: function() { return ${returnValue}; } });\n`; - } +/***/ 36873: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - getReturnValue(name, valueKey) { - if (valueKey === null) { - return `${name}_default.a`; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (valueKey === "") { - return name; - } - if (valueKey === false) { - return "/* unused export */ undefined"; - } - return `${name}${propertyAccess(valueKey)}`; - } -}; +const ModuleDependency = __webpack_require__(80321); -class HarmonyStarExportsList { - constructor() { - /** @type {HarmonyExportImportedSpecifierDependency[]} */ - this.dependencies = []; - } +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +class ModuleDependencyTemplateAsRequireId extends ModuleDependency.Template { /** - * @param {HarmonyExportImportedSpecifierDependency} dep dependency + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - push(dep) { - this.dependencies.push(dep); + apply( + dependency, + source, + { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } + ) { + const dep = /** @type {ModuleDependency} */ (dependency); + if (!dep.range) return; + const content = runtimeTemplate.moduleExports({ + module: moduleGraph.getModule(dep), + chunkGraph, + request: dep.request, + weak: dep.weak, + runtimeRequirements + }); + source.replace(dep.range[0], dep.range[1] - 1, content); } +} +module.exports = ModuleDependencyTemplateAsRequireId; - slice() { - return this.dependencies.slice(); + +/***/ }), + +/***/ 47511: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); +const ModuleDependencyTemplateAsId = __webpack_require__(80825); + +class ModuleHotAcceptDependency extends ModuleDependency { + constructor(request, range) { + super(request); + this.range = range; + this.weak = true; } - serialize({ write, setCircularReference }) { - setCircularReference(this); - write(this.dependencies); + get type() { + return "module.hot.accept"; } - deserialize({ read, setCircularReference }) { - setCircularReference(this); - this.dependencies = read(); + get category() { + return "commonjs"; } } makeSerializable( - HarmonyStarExportsList, - "webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency", - "HarmonyStarExportsList" + ModuleHotAcceptDependency, + "webpack/lib/dependencies/ModuleHotAcceptDependency" ); -module.exports.HarmonyStarExportsList = HarmonyStarExportsList; +ModuleHotAcceptDependency.Template = ModuleDependencyTemplateAsId; + +module.exports = ModuleHotAcceptDependency; /***/ }), -/***/ 89500: +/***/ 86301: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -85623,246 +81935,205 @@ module.exports.HarmonyStarExportsList = HarmonyStarExportsList; -const InitFragment = __webpack_require__(55870); -const RuntimeGlobals = __webpack_require__(16475); -const { first } = __webpack_require__(93347); +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); +const ModuleDependencyTemplateAsId = __webpack_require__(80825); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +class ModuleHotDeclineDependency extends ModuleDependency { + constructor(request, range) { + super(request); -const joinIterableWithComma = iterable => { - // This is more performant than Array.from().join(", ") - // as it doesn't create an array - let str = ""; - let first = true; - for (const item of iterable) { - if (first) { - first = false; - } else { - str += ", "; - } - str += item; + this.range = range; + this.weak = true; } - return str; -}; -const EMPTY_MAP = new Map(); -const EMPTY_SET = new Set(); + get type() { + return "module.hot.decline"; + } + + get category() { + return "commonjs"; + } +} + +makeSerializable( + ModuleHotDeclineDependency, + "webpack/lib/dependencies/ModuleHotDeclineDependency" +); + +ModuleHotDeclineDependency.Template = ModuleDependencyTemplateAsId; + +module.exports = ModuleHotDeclineDependency; + + +/***/ }), + +/***/ 31830: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const Dependency = __webpack_require__(54912); +const DependencyTemplate = __webpack_require__(5160); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + +class NullDependency extends Dependency { + get type() { + return "null"; + } -/** - * @typedef {GenerateContext} Context - */ -class HarmonyExportInitFragment extends InitFragment { /** - * @param {string} exportsArgument the exports identifier - * @param {Map} exportMap mapping from used name to exposed variable name - * @param {Set} unusedExports list of unused export names + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module */ - constructor( - exportsArgument, - exportMap = EMPTY_MAP, - unusedExports = EMPTY_SET - ) { - super(undefined, InitFragment.STAGE_HARMONY_EXPORTS, 1, "harmony-exports"); - this.exportsArgument = exportsArgument; - this.exportMap = exportMap; - this.unusedExports = unusedExports; + couldAffectReferencingModule() { + return false; } +} +NullDependency.Template = class NullDependencyTemplate extends ( + DependencyTemplate +) { /** - * @param {HarmonyExportInitFragment[]} fragments all fragments to merge - * @returns {HarmonyExportInitFragment} merged fragment + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} */ - mergeAll(fragments) { - let exportMap; - let exportMapOwned = false; - let unusedExports; - let unusedExportsOwned = false; + apply(dependency, source, templateContext) {} +}; - for (const fragment of fragments) { - if (fragment.exportMap.size !== 0) { - if (exportMap === undefined) { - exportMap = fragment.exportMap; - exportMapOwned = false; - } else { - if (!exportMapOwned) { - exportMap = new Map(exportMap); - exportMapOwned = true; - } - for (const [key, value] of fragment.exportMap) { - if (!exportMap.has(key)) exportMap.set(key, value); - } - } - } - if (fragment.unusedExports.size !== 0) { - if (unusedExports === undefined) { - unusedExports = fragment.unusedExports; - unusedExportsOwned = false; - } else { - if (!unusedExportsOwned) { - unusedExports = new Set(unusedExports); - unusedExportsOwned = true; - } - for (const value of fragment.unusedExports) { - unusedExports.add(value); - } - } - } - } - return new HarmonyExportInitFragment( - this.exportsArgument, - exportMap, - unusedExports - ); - } +module.exports = NullDependency; - merge(other) { - let exportMap; - if (this.exportMap.size === 0) { - exportMap = other.exportMap; - } else if (other.exportMap.size === 0) { - exportMap = this.exportMap; - } else { - exportMap = new Map(other.exportMap); - for (const [key, value] of this.exportMap) { - if (!exportMap.has(key)) exportMap.set(key, value); - } - } - let unusedExports; - if (this.unusedExports.size === 0) { - unusedExports = other.unusedExports; - } else if (other.unusedExports.size === 0) { - unusedExports = this.unusedExports; - } else { - unusedExports = new Set(other.unusedExports); - for (const value of this.unusedExports) { - unusedExports.add(value); - } - } - return new HarmonyExportInitFragment( - this.exportsArgument, - exportMap, - unusedExports - ); + +/***/ }), + +/***/ 31618: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ModuleDependency = __webpack_require__(80321); + +class PrefetchDependency extends ModuleDependency { + constructor(request) { + super(request); } - /** - * @param {Context} context context - * @returns {string|Source} the source code that will be included as initialization code - */ - getContent({ runtimeTemplate, runtimeRequirements }) { - runtimeRequirements.add(RuntimeGlobals.exports); - runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); + get type() { + return "prefetch"; + } - const unusedPart = - this.unusedExports.size > 1 - ? `/* unused harmony exports ${joinIterableWithComma( - this.unusedExports - )} */\n` - : this.unusedExports.size > 0 - ? `/* unused harmony export ${first(this.unusedExports)} */\n` - : ""; - const definitions = []; - for (const [key, value] of this.exportMap) { - definitions.push( - `\n/* harmony export */ ${JSON.stringify( - key - )}: ${runtimeTemplate.returningFunction(value)}` - ); - } - const definePart = - this.exportMap.size > 0 - ? `/* harmony export */ ${RuntimeGlobals.definePropertyGetters}(${ - this.exportsArgument - }, {${definitions.join(",")}\n/* harmony export */ });\n` - : ""; - return `${definePart}${unusedPart}`; + get category() { + return "esm"; } } -module.exports = HarmonyExportInitFragment; +module.exports = PrefetchDependency; /***/ }), -/***/ 48567: +/***/ 95770: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Florent Cailhol @ooflorent */ +const InitFragment = __webpack_require__(55870); const makeSerializable = __webpack_require__(33032); -const HarmonyExportInitFragment = __webpack_require__(89500); -const NullDependency = __webpack_require__(31830); +const ModuleDependency = __webpack_require__(80321); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ /** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../util/Hash")} Hash */ -class HarmonyExportSpecifierDependency extends NullDependency { - constructor(id, name) { - super(); - this.id = id; - this.name = name; +/** + * @param {string[]|null} path the property path array + * @returns {string} the converted path + */ +const pathToString = path => + path !== null && path.length > 0 + ? path.map(part => `[${JSON.stringify(part)}]`).join("") + : ""; + +class ProvidedDependency extends ModuleDependency { + constructor(request, identifier, path, range) { + super(request); + this.identifier = identifier; + this.path = path; + this.range = range; + this._hashUpdate = undefined; } get type() { - return "harmony export specifier"; + return "provided"; } - /** - * Returns the exported names - * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names - */ - getExports(moduleGraph) { - return { - exports: [this.name], - priority: 1, - terminalBinding: true, - dependencies: undefined - }; + get category() { + return "esm"; } /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this dependency connects the module to referencing modules + * Update the hash + * @param {Hash} hash hash to be updated + * @param {UpdateHashContext} context context + * @returns {void} */ - getModuleEvaluationSideEffectsState(moduleGraph) { - return false; + updateHash(hash, context) { + if (this._hashUpdate === undefined) { + this._hashUpdate = + this.identifier + (this.path ? this.path.join(",") : "null"); + } + hash.update(this._hashUpdate); } serialize(context) { const { write } = context; - write(this.id); - write(this.name); + write(this.identifier); + write(this.path); super.serialize(context); } deserialize(context) { const { read } = context; - this.id = read(); - this.name = read(); + this.identifier = read(); + this.path = read(); super.deserialize(context); } } makeSerializable( - HarmonyExportSpecifierDependency, - "webpack/lib/dependencies/HarmonyExportSpecifierDependency" + ProvidedDependency, + "webpack/lib/dependencies/ProvidedDependency" ); -HarmonyExportSpecifierDependency.Template = class HarmonyExportSpecifierDependencyTemplate extends ( - NullDependency.Template -) { +class ProvidedDependencyTemplate extends ModuleDependency.Template { /** * @param {Dependency} dependency the dependency for which the template should be applied * @param {ReplaceSource} source the current replace source which can be modified @@ -85872,87 +82143,42 @@ HarmonyExportSpecifierDependency.Template = class HarmonyExportSpecifierDependen apply( dependency, source, - { module, moduleGraph, initFragments, runtime, concatenationScope } - ) { - const dep = /** @type {HarmonyExportSpecifierDependency} */ (dependency); - if (concatenationScope) { - concatenationScope.registerExport(dep.name, dep.id); - return; - } - const used = moduleGraph - .getExportsInfo(module) - .getUsedName(dep.name, runtime); - if (!used) { - const set = new Set(); - set.add(dep.name || "namespace"); - initFragments.push( - new HarmonyExportInitFragment(module.exportsArgument, undefined, set) - ); - return; + { + runtimeTemplate, + moduleGraph, + chunkGraph, + initFragments, + runtimeRequirements } - - const map = new Map(); - map.set(used, `/* binding */ ${dep.id}`); + ) { + const dep = /** @type {ProvidedDependency} */ (dependency); initFragments.push( - new HarmonyExportInitFragment(module.exportsArgument, map, undefined) + new InitFragment( + `/* provided dependency */ var ${ + dep.identifier + } = ${runtimeTemplate.moduleExports({ + module: moduleGraph.getModule(dep), + chunkGraph, + request: dep.request, + runtimeRequirements + })}${pathToString(dep.path)};\n`, + InitFragment.STAGE_PROVIDES, + 1, + `provided ${dep.identifier}` + ) ); + source.replace(dep.range[0], dep.range[1] - 1, dep.identifier); } -}; - -module.exports = HarmonyExportSpecifierDependency; - - -/***/ }), - -/***/ 39211: -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** @typedef {import("../Parser").ParserState} ParserState */ - -/** @type {WeakMap} */ -const parserStateExportsState = new WeakMap(); +} -/** - * @param {ParserState} parserState parser state - * @param {boolean} isStrictHarmony strict harmony mode should be enabled - * @returns {void} - */ -exports.enable = (parserState, isStrictHarmony) => { - const value = parserStateExportsState.get(parserState); - if (value === false) return; - parserStateExportsState.set(parserState, true); - if (value !== true) { - parserState.module.buildMeta.exportsType = "namespace"; - parserState.module.buildInfo.strict = true; - parserState.module.buildInfo.exportsArgument = "__webpack_exports__"; - if (isStrictHarmony) { - parserState.module.buildMeta.strictHarmonyModule = true; - parserState.module.buildInfo.moduleArgument = "__webpack_module__"; - } - } -}; +ProvidedDependency.Template = ProvidedDependencyTemplate; -/** - * @param {ParserState} parserState parser state - * @returns {boolean} true, when enabled - */ -exports.isEnabled = parserState => { - const value = parserStateExportsState.get(parserState); - return value === true; -}; +module.exports = ProvidedDependency; /***/ }), -/***/ 57154: +/***/ 55799: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -85963,244 +82189,75 @@ exports.isEnabled = parserState => { -const ConditionalInitFragment = __webpack_require__(61333); -const Dependency = __webpack_require__(54912); -const HarmonyLinkingError = __webpack_require__(97511); -const InitFragment = __webpack_require__(55870); -const Template = __webpack_require__(39722); -const AwaitDependenciesInitFragment = __webpack_require__(41153); -const { filterRuntime, mergeRuntime } = __webpack_require__(17156); -const ModuleDependency = __webpack_require__(80321); +const { UsageState } = __webpack_require__(63686); +const makeSerializable = __webpack_require__(33032); +const { filterRuntime } = __webpack_require__(17156); +const NullDependency = __webpack_require__(31830); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("webpack-sources").Source} Source */ /** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../Dependency")} Dependency */ /** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../Module")} Module */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ /** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - -const ExportPresenceModes = { - NONE: /** @type {0} */ (0), - WARN: /** @type {1} */ (1), - AUTO: /** @type {2} */ (2), - ERROR: /** @type {3} */ (3), - fromUserOption(str) { - switch (str) { - case "error": - return ExportPresenceModes.ERROR; - case "warn": - return ExportPresenceModes.WARN; - case "auto": - return ExportPresenceModes.AUTO; - case false: - return ExportPresenceModes.NONE; - default: - throw new Error(`Invalid export presence value ${str}`); - } - } -}; -class HarmonyImportDependency extends ModuleDependency { +class PureExpressionDependency extends NullDependency { /** - * - * @param {string} request request string - * @param {number} sourceOrder source order - * @param {Record=} assertions import assertions + * @param {[number, number]} range the source range */ - constructor(request, sourceOrder, assertions) { - super(request); - this.sourceOrder = sourceOrder; - this.assertions = assertions; - } - - get category() { - return "esm"; + constructor(range) { + super(); + this.range = range; + /** @type {Set | false} */ + this.usedByExports = false; + this._hashUpdate = undefined; } /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports + * Update the hash + * @param {Hash} hash hash to be updated + * @param {UpdateHashContext} context context + * @returns {void} */ - getReferencedExports(moduleGraph, runtime) { - return Dependency.NO_EXPORTS_REFERENCED; + updateHash(hash, context) { + if (this._hashUpdate === undefined) { + this._hashUpdate = this.range + ""; + } + hash.update(this._hashUpdate); } /** * @param {ModuleGraph} moduleGraph the module graph - * @returns {string} name of the variable for the import - */ - getImportVar(moduleGraph) { - const module = moduleGraph.getParentModule(this); - const meta = moduleGraph.getMeta(module); - let importVarMap = meta.importVarMap; - if (!importVarMap) meta.importVarMap = importVarMap = new Map(); - let importVar = importVarMap.get(moduleGraph.getModule(this)); - if (importVar) return importVar; - importVar = `${Template.toIdentifier( - `${this.userRequest}` - )}__WEBPACK_IMPORTED_MODULE_${importVarMap.size}__`; - importVarMap.set(moduleGraph.getModule(this), importVar); - return importVar; - } - - /** - * @param {boolean} update create new variables or update existing one - * @param {DependencyTemplateContext} templateContext the template context - * @returns {[string, string]} the import statement and the compat statement + * @returns {ConnectionState} how this dependency connects the module to referencing modules */ - getImportStatement( - update, - { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements } - ) { - return runtimeTemplate.importStatement({ - update, - module: moduleGraph.getModule(this), - chunkGraph, - importVar: this.getImportVar(moduleGraph), - request: this.request, - originModule: module, - runtimeRequirements - }); - } - - /** - * @param {ModuleGraph} moduleGraph module graph - * @param {string[]} ids imported ids - * @param {string} additionalMessage extra info included in the error message - * @returns {WebpackError[] | undefined} errors - */ - getLinkingErrors(moduleGraph, ids, additionalMessage) { - const importedModule = moduleGraph.getModule(this); - // ignore errors for missing or failed modules - if (!importedModule || importedModule.getNumberOfErrors() > 0) { - return; - } - - const parentModule = moduleGraph.getParentModule(this); - const exportsType = importedModule.getExportsType( - moduleGraph, - parentModule.buildMeta.strictHarmonyModule - ); - if (exportsType === "namespace" || exportsType === "default-with-named") { - if (ids.length === 0) { - return; - } - - if ( - (exportsType !== "default-with-named" || ids[0] !== "default") && - moduleGraph.isExportProvided(importedModule, ids) === false - ) { - // We are sure that it's not provided - - // Try to provide detailed info in the error message - let pos = 0; - let exportsInfo = moduleGraph.getExportsInfo(importedModule); - while (pos < ids.length && exportsInfo) { - const id = ids[pos++]; - const exportInfo = exportsInfo.getReadOnlyExportInfo(id); - if (exportInfo.provided === false) { - // We are sure that it's not provided - const providedExports = exportsInfo.getProvidedExports(); - const moreInfo = !Array.isArray(providedExports) - ? " (possible exports unknown)" - : providedExports.length === 0 - ? " (module has no exports)" - : ` (possible exports: ${providedExports.join(", ")})`; - return [ - new HarmonyLinkingError( - `export ${ids - .slice(0, pos) - .map(id => `'${id}'`) - .join(".")} ${additionalMessage} was not found in '${ - this.userRequest - }'${moreInfo}` - ) - ]; - } - exportsInfo = exportInfo.getNestedExportsInfo(); - } - - // General error message - return [ - new HarmonyLinkingError( - `export ${ids - .map(id => `'${id}'`) - .join(".")} ${additionalMessage} was not found in '${ - this.userRequest - }'` - ) - ]; - } - } - switch (exportsType) { - case "default-only": - // It's has only a default export - if (ids.length > 0 && ids[0] !== "default") { - // In strict harmony modules we only support the default export - return [ - new HarmonyLinkingError( - `Can't import the named export ${ids - .map(id => `'${id}'`) - .join( - "." - )} ${additionalMessage} from default-exporting module (only default export is available)` - ) - ]; - } - break; - case "default-with-named": - // It has a default export and named properties redirect - // In some cases we still want to warn here - if ( - ids.length > 0 && - ids[0] !== "default" && - importedModule.buildMeta.defaultObject === "redirect-warn" - ) { - // For these modules only the default export is supported - return [ - new HarmonyLinkingError( - `Should not import the named export ${ids - .map(id => `'${id}'`) - .join( - "." - )} ${additionalMessage} from default-exporting module (only default export is available soon)` - ) - ]; - } - break; - } + getModuleEvaluationSideEffectsState(moduleGraph) { + return false; } serialize(context) { const { write } = context; - write(this.sourceOrder); - write(this.assertions); + write(this.range); + write(this.usedByExports); super.serialize(context); } deserialize(context) { const { read } = context; - this.sourceOrder = read(); - this.assertions = read(); + this.range = read(); + this.usedByExports = read(); super.deserialize(context); } } -module.exports = HarmonyImportDependency; - -/** @type {WeakMap>} */ -const importEmittedMap = new WeakMap(); +makeSerializable( + PureExpressionDependency, + "webpack/lib/dependencies/PureExpressionDependency" +); -HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate extends ( - ModuleDependency.Template +PureExpressionDependency.Template = class PureExpressionDependencyTemplate extends ( + NullDependency.Template ) { /** * @param {Dependency} dependency the dependency for which the template should be applied @@ -86208,118 +82265,56 @@ HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate extends * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply(dependency, source, templateContext) { - const dep = /** @type {HarmonyImportDependency} */ (dependency); - const { module, chunkGraph, moduleGraph, runtime } = templateContext; - - const connection = moduleGraph.getConnection(dep); - if (connection && !connection.isTargetActive(runtime)) return; - - const referencedModule = connection && connection.module; - - if ( - connection && - connection.weak && - referencedModule && - chunkGraph.getModuleId(referencedModule) === null - ) { - // in weak references, module might not be in any chunk - // but that's ok, we don't need that logic in this case - return; - } - - const moduleKey = referencedModule - ? referencedModule.identifier() - : dep.request; - const key = `harmony import ${moduleKey}`; - - const runtimeCondition = dep.weak - ? false - : connection - ? filterRuntime(runtime, r => connection.isTargetActive(r)) - : true; + apply( + dependency, + source, + { chunkGraph, moduleGraph, runtime, runtimeTemplate, runtimeRequirements } + ) { + const dep = /** @type {PureExpressionDependency} */ (dependency); - if (module && referencedModule) { - let emittedModules = importEmittedMap.get(module); - if (emittedModules === undefined) { - emittedModules = new WeakMap(); - importEmittedMap.set(module, emittedModules); - } - let mergedRuntimeCondition = runtimeCondition; - const oldRuntimeCondition = emittedModules.get(referencedModule) || false; - if (oldRuntimeCondition !== false && mergedRuntimeCondition !== true) { - if (mergedRuntimeCondition === false || oldRuntimeCondition === true) { - mergedRuntimeCondition = oldRuntimeCondition; - } else { - mergedRuntimeCondition = mergeRuntime( - oldRuntimeCondition, - mergedRuntimeCondition - ); + const usedByExports = dep.usedByExports; + if (usedByExports !== false) { + const selfModule = moduleGraph.getParentModule(dep); + const exportsInfo = moduleGraph.getExportsInfo(selfModule); + const runtimeCondition = filterRuntime(runtime, runtime => { + for (const exportName of usedByExports) { + if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) { + return true; + } } + return false; + }); + if (runtimeCondition === true) return; + if (runtimeCondition !== false) { + const condition = runtimeTemplate.runtimeConditionExpression({ + chunkGraph, + runtime, + runtimeCondition, + runtimeRequirements + }); + source.insert( + dep.range[0], + `(/* runtime-dependent pure expression or super */ ${condition} ? (` + ); + source.insert(dep.range[1], ") : null)"); + return; } - emittedModules.set(referencedModule, mergedRuntimeCondition); - } - - const importStatement = dep.getImportStatement(false, templateContext); - if ( - referencedModule && - templateContext.moduleGraph.isAsync(referencedModule) - ) { - templateContext.initFragments.push( - new ConditionalInitFragment( - importStatement[0], - InitFragment.STAGE_HARMONY_IMPORTS, - dep.sourceOrder, - key, - runtimeCondition - ) - ); - templateContext.initFragments.push( - new AwaitDependenciesInitFragment( - new Set([dep.getImportVar(templateContext.moduleGraph)]) - ) - ); - templateContext.initFragments.push( - new ConditionalInitFragment( - importStatement[1], - InitFragment.STAGE_ASYNC_HARMONY_IMPORTS, - dep.sourceOrder, - key + " compat", - runtimeCondition - ) - ); - } else { - templateContext.initFragments.push( - new ConditionalInitFragment( - importStatement[0] + importStatement[1], - InitFragment.STAGE_HARMONY_IMPORTS, - dep.sourceOrder, - key, - runtimeCondition - ) - ); } - } - /** - * - * @param {Module} module the module - * @param {Module} referencedModule the referenced module - * @returns {RuntimeSpec | boolean} runtimeCondition in which this import has been emitted - */ - static getImportEmittedRuntime(module, referencedModule) { - const emittedModules = importEmittedMap.get(module); - if (emittedModules === undefined) return false; - return emittedModules.get(referencedModule) || false; + source.insert( + dep.range[0], + `(/* unused pure expression or super */ null && (` + ); + source.insert(dep.range[1], "))"); } }; -module.exports.ExportPresenceModes = ExportPresenceModes; +module.exports = PureExpressionDependency; /***/ }), -/***/ 20862: +/***/ 46917: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -86330,260 +82325,434 @@ module.exports.ExportPresenceModes = ExportPresenceModes; -const HotModuleReplacementPlugin = __webpack_require__(6404); -const InnerGraph = __webpack_require__(38988); -const ConstDependency = __webpack_require__(76911); -const HarmonyAcceptDependency = __webpack_require__(23624); -const HarmonyAcceptImportDependency = __webpack_require__(99843); -const HarmonyExports = __webpack_require__(39211); -const { ExportPresenceModes } = __webpack_require__(57154); -const HarmonyImportSideEffectDependency = __webpack_require__(73132); -const HarmonyImportSpecifierDependency = __webpack_require__(14077); +const makeSerializable = __webpack_require__(33032); +const ContextDependency = __webpack_require__(88101); +const ModuleDependencyTemplateAsRequireId = __webpack_require__(36873); -/** @typedef {import("estree").ExportAllDeclaration} ExportAllDeclaration */ -/** @typedef {import("estree").ExportNamedDeclaration} ExportNamedDeclaration */ -/** @typedef {import("estree").Identifier} Identifier */ -/** @typedef {import("estree").ImportDeclaration} ImportDeclaration */ -/** @typedef {import("estree").ImportExpression} ImportExpression */ -/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ -/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ -/** @typedef {import("../optimize/InnerGraph").InnerGraph} InnerGraph */ -/** @typedef {import("../optimize/InnerGraph").TopLevelSymbol} TopLevelSymbol */ -/** @typedef {import("./HarmonyImportDependency")} HarmonyImportDependency */ +class RequireContextDependency extends ContextDependency { + constructor(options, range) { + super(options); -const harmonySpecifierTag = Symbol("harmony import"); + this.range = range; + } -/** - * @typedef {Object} HarmonySettings - * @property {string[]} ids - * @property {string} source - * @property {number} sourceOrder - * @property {string} name - * @property {boolean} await - * @property {Record | undefined} assertions - */ + get type() { + return "require.context"; + } -/** - * @param {ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | ImportExpression} node node with assertions - * @returns {Record | undefined} assertions - */ -function getAssertions(node) { - // TODO remove cast when @types/estree has been updated to import assertions - const assertions = /** @type {{ assertions?: ImportAttributeNode[] }} */ ( - node - ).assertions; - if (assertions === undefined) { - return undefined; + serialize(context) { + const { write } = context; + + write(this.range); + + super.serialize(context); } - const result = {}; - for (const assertion of assertions) { - const key = - assertion.key.type === "Identifier" - ? assertion.key.name - : assertion.key.value; - result[key] = assertion.value.value; + + deserialize(context) { + const { read } = context; + + this.range = read(); + + super.deserialize(context); } - return result; } -module.exports = class HarmonyImportDependencyParserPlugin { - /** - * @param {JavascriptParserOptions} options options - */ - constructor(options) { - this.exportPresenceMode = - options.importExportsPresence !== undefined - ? ExportPresenceModes.fromUserOption(options.importExportsPresence) - : options.exportsPresence !== undefined - ? ExportPresenceModes.fromUserOption(options.exportsPresence) - : options.strictExportPresence - ? ExportPresenceModes.ERROR - : ExportPresenceModes.AUTO; - this.strictThisContextOnImports = options.strictThisContextOnImports; +makeSerializable( + RequireContextDependency, + "webpack/lib/dependencies/RequireContextDependency" +); + +RequireContextDependency.Template = ModuleDependencyTemplateAsRequireId; + +module.exports = RequireContextDependency; + + +/***/ }), + +/***/ 18851: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const RequireContextDependency = __webpack_require__(46917); + +module.exports = class RequireContextDependencyParserPlugin { + apply(parser) { + parser.hooks.call + .for("require.context") + .tap("RequireContextDependencyParserPlugin", expr => { + let regExp = /^\.\/.*$/; + let recursive = true; + let mode = "sync"; + switch (expr.arguments.length) { + case 4: { + const modeExpr = parser.evaluateExpression(expr.arguments[3]); + if (!modeExpr.isString()) return; + mode = modeExpr.string; + } + // falls through + case 3: { + const regExpExpr = parser.evaluateExpression(expr.arguments[2]); + if (!regExpExpr.isRegExp()) return; + regExp = regExpExpr.regExp; + } + // falls through + case 2: { + const recursiveExpr = parser.evaluateExpression(expr.arguments[1]); + if (!recursiveExpr.isBoolean()) return; + recursive = recursiveExpr.bool; + } + // falls through + case 1: { + const requestExpr = parser.evaluateExpression(expr.arguments[0]); + if (!requestExpr.isString()) return; + const dep = new RequireContextDependency( + { + request: requestExpr.string, + recursive, + regExp, + mode, + category: "commonjs" + }, + expr.range + ); + dep.loc = expr.loc; + dep.optional = !!parser.scope.inTry; + parser.state.current.addDependency(dep); + return true; + } + } + }); } +}; + + +/***/ }), + +/***/ 2928: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { cachedSetProperty } = __webpack_require__(60839); +const ContextElementDependency = __webpack_require__(58477); +const RequireContextDependency = __webpack_require__(46917); +const RequireContextDependencyParserPlugin = __webpack_require__(18851); + +/** @typedef {import("../../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ +/** @typedef {import("../Compiler")} Compiler */ + +/** @type {ResolveOptions} */ +const EMPTY_RESOLVE_OPTIONS = {}; +class RequireContextPlugin { /** - * @param {JavascriptParser} parser the parser + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply(parser) { - const { exportPresenceMode } = this; - parser.hooks.isPure - .for("Identifier") - .tap("HarmonyImportDependencyParserPlugin", expression => { - const expr = /** @type {Identifier} */ (expression); - if ( - parser.isVariableDefined(expr.name) || - parser.getTagData(expr.name, harmonySpecifierTag) - ) { - return true; - } - }); - parser.hooks.import.tap( - "HarmonyImportDependencyParserPlugin", - (statement, source) => { - parser.state.lastHarmonyImportOrder = - (parser.state.lastHarmonyImportOrder || 0) + 1; - const clearDep = new ConstDependency( - parser.isAsiPosition(statement.range[0]) ? ";" : "", - statement.range + apply(compiler) { + compiler.hooks.compilation.tap( + "RequireContextPlugin", + (compilation, { contextModuleFactory, normalModuleFactory }) => { + compilation.dependencyFactories.set( + RequireContextDependency, + contextModuleFactory ); - clearDep.loc = statement.loc; - parser.state.module.addPresentationalDependency(clearDep); - parser.unsetAsiPosition(statement.range[1]); - const assertions = getAssertions(statement); - const sideEffectDep = new HarmonyImportSideEffectDependency( - source, - parser.state.lastHarmonyImportOrder, - assertions + compilation.dependencyTemplates.set( + RequireContextDependency, + new RequireContextDependency.Template() ); - sideEffectDep.loc = statement.loc; - parser.state.module.addDependency(sideEffectDep); - return true; - } - ); - parser.hooks.importSpecifier.tap( - "HarmonyImportDependencyParserPlugin", - (statement, source, id, name) => { - const ids = id === null ? [] : [id]; - parser.tagVariable(name, harmonySpecifierTag, { - name, - source, - ids, - sourceOrder: parser.state.lastHarmonyImportOrder, - assertions: getAssertions(statement) - }); - return true; - } - ); - parser.hooks.expression - .for(harmonySpecifierTag) - .tap("HarmonyImportDependencyParserPlugin", expr => { - const settings = /** @type {HarmonySettings} */ (parser.currentTagData); - const dep = new HarmonyImportSpecifierDependency( - settings.source, - settings.sourceOrder, - settings.ids, - settings.name, - expr.range, - exportPresenceMode, - settings.assertions - ); - dep.shorthand = parser.scope.inShorthand; - dep.directImport = true; - dep.asiSafe = !parser.isAsiPosition(expr.range[0]); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); - return true; - }); - parser.hooks.expressionMemberChain - .for(harmonySpecifierTag) - .tap("HarmonyImportDependencyParserPlugin", (expr, members) => { - const settings = /** @type {HarmonySettings} */ (parser.currentTagData); - const ids = settings.ids.concat(members); - const dep = new HarmonyImportSpecifierDependency( - settings.source, - settings.sourceOrder, - ids, - settings.name, - expr.range, - exportPresenceMode, - settings.assertions + + compilation.dependencyFactories.set( + ContextElementDependency, + normalModuleFactory ); - dep.asiSafe = !parser.isAsiPosition(expr.range[0]); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); - return true; - }); - parser.hooks.callMemberChain - .for(harmonySpecifierTag) - .tap("HarmonyImportDependencyParserPlugin", (expr, members) => { - const { arguments: args, callee } = expr; - const settings = /** @type {HarmonySettings} */ (parser.currentTagData); - const ids = settings.ids.concat(members); - const dep = new HarmonyImportSpecifierDependency( - settings.source, - settings.sourceOrder, - ids, - settings.name, - callee.range, - exportPresenceMode, - settings.assertions + + const handler = (parser, parserOptions) => { + if ( + parserOptions.requireContext !== undefined && + !parserOptions.requireContext + ) + return; + + new RequireContextDependencyParserPlugin().apply(parser); + }; + + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("RequireContextPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("RequireContextPlugin", handler); + + contextModuleFactory.hooks.alternativeRequests.tap( + "RequireContextPlugin", + (items, options) => { + if (items.length === 0) return items; + + const finalResolveOptions = compiler.resolverFactory.get( + "normal", + cachedSetProperty( + options.resolveOptions || EMPTY_RESOLVE_OPTIONS, + "dependencyType", + options.category + ) + ).options; + + let newItems; + if (!finalResolveOptions.fullySpecified) { + newItems = []; + for (const item of items) { + const { request, context } = item; + for (const ext of finalResolveOptions.extensions) { + if (request.endsWith(ext)) { + newItems.push({ + context, + request: request.slice(0, -ext.length) + }); + } + } + if (!finalResolveOptions.enforceExtension) { + newItems.push(item); + } + } + items = newItems; + + newItems = []; + for (const obj of items) { + const { request, context } = obj; + for (const mainFile of finalResolveOptions.mainFiles) { + if (request.endsWith(`/${mainFile}`)) { + newItems.push({ + context, + request: request.slice(0, -mainFile.length) + }); + newItems.push({ + context, + request: request.slice(0, -mainFile.length - 1) + }); + } + } + newItems.push(obj); + } + items = newItems; + } + + newItems = []; + for (const item of items) { + let hideOriginal = false; + for (const modulesItems of finalResolveOptions.modules) { + if (Array.isArray(modulesItems)) { + for (const dir of modulesItems) { + if (item.request.startsWith(`./${dir}/`)) { + newItems.push({ + context: item.context, + request: item.request.slice(dir.length + 3) + }); + hideOriginal = true; + } + } + } else { + const dir = modulesItems.replace(/\\/g, "/"); + const fullPath = + item.context.replace(/\\/g, "/") + item.request.slice(1); + if (fullPath.startsWith(dir)) { + newItems.push({ + context: item.context, + request: fullPath.slice(dir.length + 1) + }); + } + } + } + if (!hideOriginal) { + newItems.push(item); + } + } + return newItems; + } ); - dep.directImport = members.length === 0; - dep.call = true; - dep.asiSafe = !parser.isAsiPosition(callee.range[0]); - // only in case when we strictly follow the spec we need a special case here - dep.namespaceObjectAsContext = - members.length > 0 && this.strictThisContextOnImports; - dep.loc = callee.loc; - parser.state.module.addDependency(dep); - if (args) parser.walkExpressions(args); - InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); - return true; - }); - const { hotAcceptCallback, hotAcceptWithoutCallback } = - HotModuleReplacementPlugin.getParserHooks(parser); - hotAcceptCallback.tap( - "HarmonyImportDependencyParserPlugin", - (expr, requests) => { - if (!HarmonyExports.isEnabled(parser.state)) { - // This is not a harmony module, skip it - return; - } - const dependencies = requests.map(request => { - const dep = new HarmonyAcceptImportDependency(request); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - return dep; - }); - if (dependencies.length > 0) { - const dep = new HarmonyAcceptDependency( - expr.range, - dependencies, - true - ); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - } } ); - hotAcceptWithoutCallback.tap( - "HarmonyImportDependencyParserPlugin", - (expr, requests) => { - if (!HarmonyExports.isEnabled(parser.state)) { - // This is not a harmony module, skip it - return; - } - const dependencies = requests.map(request => { - const dep = new HarmonyAcceptImportDependency(request); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - return dep; - }); - if (dependencies.length > 0) { - const dep = new HarmonyAcceptDependency( - expr.range, - dependencies, - false - ); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); + } +} +module.exports = RequireContextPlugin; + + +/***/ }), + +/***/ 27153: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const AsyncDependenciesBlock = __webpack_require__(47736); +const makeSerializable = __webpack_require__(33032); + +class RequireEnsureDependenciesBlock extends AsyncDependenciesBlock { + constructor(chunkName, loc) { + super(chunkName, loc, null); + } +} + +makeSerializable( + RequireEnsureDependenciesBlock, + "webpack/lib/dependencies/RequireEnsureDependenciesBlock" +); + +module.exports = RequireEnsureDependenciesBlock; + + +/***/ }), + +/***/ 7235: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const RequireEnsureDependenciesBlock = __webpack_require__(27153); +const RequireEnsureDependency = __webpack_require__(27223); +const RequireEnsureItemDependency = __webpack_require__(50329); +const getFunctionExpression = __webpack_require__(50396); + +module.exports = class RequireEnsureDependenciesBlockParserPlugin { + apply(parser) { + parser.hooks.call + .for("require.ensure") + .tap("RequireEnsureDependenciesBlockParserPlugin", expr => { + let chunkName = null; + let errorExpressionArg = null; + let errorExpression = null; + switch (expr.arguments.length) { + case 4: { + const chunkNameExpr = parser.evaluateExpression(expr.arguments[3]); + if (!chunkNameExpr.isString()) return; + chunkName = chunkNameExpr.string; + } + // falls through + case 3: { + errorExpressionArg = expr.arguments[2]; + errorExpression = getFunctionExpression(errorExpressionArg); + + if (!errorExpression && !chunkName) { + const chunkNameExpr = parser.evaluateExpression( + expr.arguments[2] + ); + if (!chunkNameExpr.isString()) return; + chunkName = chunkNameExpr.string; + } + } + // falls through + case 2: { + const dependenciesExpr = parser.evaluateExpression( + expr.arguments[0] + ); + const dependenciesItems = dependenciesExpr.isArray() + ? dependenciesExpr.items + : [dependenciesExpr]; + const successExpressionArg = expr.arguments[1]; + const successExpression = + getFunctionExpression(successExpressionArg); + + if (successExpression) { + parser.walkExpressions(successExpression.expressions); + } + if (errorExpression) { + parser.walkExpressions(errorExpression.expressions); + } + + const depBlock = new RequireEnsureDependenciesBlock( + chunkName, + expr.loc + ); + const errorCallbackExists = + expr.arguments.length === 4 || + (!chunkName && expr.arguments.length === 3); + const dep = new RequireEnsureDependency( + expr.range, + expr.arguments[1].range, + errorCallbackExists && expr.arguments[2].range + ); + dep.loc = expr.loc; + depBlock.addDependency(dep); + const old = parser.state.current; + parser.state.current = depBlock; + try { + let failed = false; + parser.inScope([], () => { + for (const ee of dependenciesItems) { + if (ee.isString()) { + const ensureDependency = new RequireEnsureItemDependency( + ee.string + ); + ensureDependency.loc = ee.loc || expr.loc; + depBlock.addDependency(ensureDependency); + } else { + failed = true; + } + } + }); + if (failed) { + return; + } + if (successExpression) { + if (successExpression.fn.body.type === "BlockStatement") { + parser.walkStatement(successExpression.fn.body); + } else { + parser.walkExpression(successExpression.fn.body); + } + } + old.addBlock(depBlock); + } finally { + parser.state.current = old; + } + if (!successExpression) { + parser.walkExpression(successExpressionArg); + } + if (errorExpression) { + if (errorExpression.fn.body.type === "BlockStatement") { + parser.walkStatement(errorExpression.fn.body); + } else { + parser.walkExpression(errorExpression.fn.body); + } + } else if (errorExpressionArg) { + parser.walkExpression(errorExpressionArg); + } + return true; + } } - } - ); + }); } }; -module.exports.harmonySpecifierTag = harmonySpecifierTag; -module.exports.getAssertions = getAssertions; - /***/ }), -/***/ 73132: +/***/ 27223: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -86594,59 +82763,56 @@ module.exports.getAssertions = getAssertions; +const RuntimeGlobals = __webpack_require__(16475); const makeSerializable = __webpack_require__(33032); -const HarmonyImportDependency = __webpack_require__(57154); +const NullDependency = __webpack_require__(31830); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../AsyncDependenciesBlock")} AsyncDependenciesBlock */ /** @typedef {import("../Dependency")} Dependency */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../InitFragment")} InitFragment */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -class HarmonyImportSideEffectDependency extends HarmonyImportDependency { - constructor(request, sourceOrder, assertions) { - super(request, sourceOrder, assertions); +class RequireEnsureDependency extends NullDependency { + constructor(range, contentRange, errorHandlerRange) { + super(); + + this.range = range; + this.contentRange = contentRange; + this.errorHandlerRange = errorHandlerRange; } get type() { - return "harmony side effect evaluation"; + return "require.ensure"; } - /** - * @param {ModuleGraph} moduleGraph module graph - * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active - */ - getCondition(moduleGraph) { - return connection => { - const refModule = connection.resolvedModule; - if (!refModule) return true; - return refModule.getSideEffectsConnectionState(moduleGraph); - }; + serialize(context) { + const { write } = context; + + write(this.range); + write(this.contentRange); + write(this.errorHandlerRange); + + super.serialize(context); } - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this dependency connects the module to referencing modules - */ - getModuleEvaluationSideEffectsState(moduleGraph) { - const refModule = moduleGraph.getModule(this); - if (!refModule) return true; - return refModule.getSideEffectsConnectionState(moduleGraph); + deserialize(context) { + const { read } = context; + + this.range = read(); + this.contentRange = read(); + this.errorHandlerRange = read(); + + super.deserialize(context); } } makeSerializable( - HarmonyImportSideEffectDependency, - "webpack/lib/dependencies/HarmonyImportSideEffectDependency" + RequireEnsureDependency, + "webpack/lib/dependencies/RequireEnsureDependency" ); -HarmonyImportSideEffectDependency.Template = class HarmonyImportSideEffectDependencyTemplate extends ( - HarmonyImportDependency.Template +RequireEnsureDependency.Template = class RequireEnsureDependencyTemplate extends ( + NullDependency.Template ) { /** * @param {Dependency} dependency the dependency for which the template should be applied @@ -86654,24 +82820,48 @@ HarmonyImportSideEffectDependency.Template = class HarmonyImportSideEffectDepend * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply(dependency, source, templateContext) { - const { moduleGraph, concatenationScope } = templateContext; - if (concatenationScope) { - const module = moduleGraph.getModule(dependency); - if (concatenationScope.isModuleInScope(module)) { - return; - } + apply( + dependency, + source, + { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } + ) { + const dep = /** @type {RequireEnsureDependency} */ (dependency); + const depBlock = /** @type {AsyncDependenciesBlock} */ ( + moduleGraph.getParentBlock(dep) + ); + const promise = runtimeTemplate.blockPromise({ + chunkGraph, + block: depBlock, + message: "require.ensure", + runtimeRequirements + }); + const range = dep.range; + const contentRange = dep.contentRange; + const errorHandlerRange = dep.errorHandlerRange; + source.replace(range[0], contentRange[0] - 1, `${promise}.then((`); + if (errorHandlerRange) { + source.replace( + contentRange[1], + errorHandlerRange[0] - 1, + ").bind(null, __webpack_require__))['catch'](" + ); + source.replace(errorHandlerRange[1], range[1] - 1, ")"); + } else { + source.replace( + contentRange[1], + range[1] - 1, + `).bind(null, __webpack_require__))['catch'](${RuntimeGlobals.uncaughtErrorHandler})` + ); } - super.apply(dependency, source, templateContext); } }; -module.exports = HarmonyImportSideEffectDependency; +module.exports = RequireEnsureDependency; /***/ }), -/***/ 14077: +/***/ 50329: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -86682,335 +82872,37 @@ module.exports = HarmonyImportSideEffectDependency; -const Dependency = __webpack_require__(54912); -const { - getDependencyUsedByExportsCondition -} = __webpack_require__(38988); const makeSerializable = __webpack_require__(33032); -const propertyAccess = __webpack_require__(54190); -const HarmonyImportDependency = __webpack_require__(57154); +const ModuleDependency = __webpack_require__(80321); +const NullDependency = __webpack_require__(31830); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - -const idsSymbol = Symbol("HarmonyImportSpecifierDependency.ids"); - -const { ExportPresenceModes } = HarmonyImportDependency; - -class HarmonyImportSpecifierDependency extends HarmonyImportDependency { - constructor( - request, - sourceOrder, - ids, - name, - range, - exportPresenceMode, - assertions - ) { - super(request, sourceOrder, assertions); - this.ids = ids; - this.name = name; - this.range = range; - this.exportPresenceMode = exportPresenceMode; - this.namespaceObjectAsContext = false; - this.call = undefined; - this.directImport = undefined; - this.shorthand = undefined; - this.asiSafe = undefined; - /** @type {Set | boolean} */ - this.usedByExports = undefined; - } - - // TODO webpack 6 remove - get id() { - throw new Error("id was renamed to ids and type changed to string[]"); - } - - // TODO webpack 6 remove - getId() { - throw new Error("id was renamed to ids and type changed to string[]"); - } - - // TODO webpack 6 remove - setId() { - throw new Error("id was renamed to ids and type changed to string[]"); +class RequireEnsureItemDependency extends ModuleDependency { + constructor(request) { + super(request); } get type() { - return "harmony import specifier"; - } - - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {string[]} the imported ids - */ - getIds(moduleGraph) { - const meta = moduleGraph.getMetaIfExisting(this); - if (meta === undefined) return this.ids; - const ids = meta[idsSymbol]; - return ids !== undefined ? ids : this.ids; - } - - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {string[]} ids the imported ids - * @returns {void} - */ - setIds(moduleGraph, ids) { - moduleGraph.getMeta(this)[idsSymbol] = ids; - } - - /** - * @param {ModuleGraph} moduleGraph module graph - * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active - */ - getCondition(moduleGraph) { - return getDependencyUsedByExportsCondition( - this, - this.usedByExports, - moduleGraph - ); - } - - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this dependency connects the module to referencing modules - */ - getModuleEvaluationSideEffectsState(moduleGraph) { - return false; - } - - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - let ids = this.getIds(moduleGraph); - if (ids.length === 0) return Dependency.EXPORTS_OBJECT_REFERENCED; - let namespaceObjectAsContext = this.namespaceObjectAsContext; - if (ids[0] === "default") { - const selfModule = moduleGraph.getParentModule(this); - const importedModule = moduleGraph.getModule(this); - switch ( - importedModule.getExportsType( - moduleGraph, - selfModule.buildMeta.strictHarmonyModule - ) - ) { - case "default-only": - case "default-with-named": - if (ids.length === 1) return Dependency.EXPORTS_OBJECT_REFERENCED; - ids = ids.slice(1); - namespaceObjectAsContext = true; - break; - case "dynamic": - return Dependency.EXPORTS_OBJECT_REFERENCED; - } - } - - if ( - this.call && - !this.directImport && - (namespaceObjectAsContext || ids.length > 1) - ) { - if (ids.length === 1) return Dependency.EXPORTS_OBJECT_REFERENCED; - ids = ids.slice(0, -1); - } - - return [ids]; - } - - /** - * @param {ModuleGraph} moduleGraph module graph - * @returns {number} effective mode - */ - _getEffectiveExportPresenceLevel(moduleGraph) { - if (this.exportPresenceMode !== ExportPresenceModes.AUTO) - return this.exportPresenceMode; - return moduleGraph.getParentModule(this).buildMeta.strictHarmonyModule - ? ExportPresenceModes.ERROR - : ExportPresenceModes.WARN; - } - - /** - * Returns warnings - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[]} warnings - */ - getWarnings(moduleGraph) { - const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); - if (exportsPresence === ExportPresenceModes.WARN) { - return this._getErrors(moduleGraph); - } - return null; - } - - /** - * Returns errors - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[]} errors - */ - getErrors(moduleGraph) { - const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); - if (exportsPresence === ExportPresenceModes.ERROR) { - return this._getErrors(moduleGraph); - } - return null; - } - - /** - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[] | undefined} errors - */ - _getErrors(moduleGraph) { - const ids = this.getIds(moduleGraph); - return this.getLinkingErrors( - moduleGraph, - ids, - `(imported as '${this.name}')` - ); - } - - /** - * implement this method to allow the occurrence order plugin to count correctly - * @returns {number} count how often the id is used in this dependency - */ - getNumberOfIdOccurrences() { - return 0; - } - - serialize(context) { - const { write } = context; - write(this.ids); - write(this.name); - write(this.range); - write(this.exportPresenceMode); - write(this.namespaceObjectAsContext); - write(this.call); - write(this.directImport); - write(this.shorthand); - write(this.asiSafe); - write(this.usedByExports); - super.serialize(context); + return "require.ensure item"; } - deserialize(context) { - const { read } = context; - this.ids = read(); - this.name = read(); - this.range = read(); - this.exportPresenceMode = read(); - this.namespaceObjectAsContext = read(); - this.call = read(); - this.directImport = read(); - this.shorthand = read(); - this.asiSafe = read(); - this.usedByExports = read(); - super.deserialize(context); + get category() { + return "commonjs"; } } makeSerializable( - HarmonyImportSpecifierDependency, - "webpack/lib/dependencies/HarmonyImportSpecifierDependency" + RequireEnsureItemDependency, + "webpack/lib/dependencies/RequireEnsureItemDependency" ); -HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependencyTemplate extends ( - HarmonyImportDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, templateContext) { - const dep = /** @type {HarmonyImportSpecifierDependency} */ (dependency); - const { moduleGraph, module, runtime, concatenationScope } = - templateContext; - const connection = moduleGraph.getConnection(dep); - // Skip rendering depending when dependency is conditional - if (connection && !connection.isTargetActive(runtime)) return; - - const ids = dep.getIds(moduleGraph); - - let exportExpr; - if ( - connection && - concatenationScope && - concatenationScope.isModuleInScope(connection.module) - ) { - if (ids.length === 0) { - exportExpr = concatenationScope.createModuleReference( - connection.module, - { - asiSafe: dep.asiSafe - } - ); - } else if (dep.namespaceObjectAsContext && ids.length === 1) { - exportExpr = - concatenationScope.createModuleReference(connection.module, { - asiSafe: dep.asiSafe - }) + propertyAccess(ids); - } else { - exportExpr = concatenationScope.createModuleReference( - connection.module, - { - ids, - call: dep.call, - directImport: dep.directImport, - asiSafe: dep.asiSafe - } - ); - } - } else { - super.apply(dependency, source, templateContext); - - const { runtimeTemplate, initFragments, runtimeRequirements } = - templateContext; - - exportExpr = runtimeTemplate.exportFromImport({ - moduleGraph, - module: moduleGraph.getModule(dep), - request: dep.request, - exportName: ids, - originModule: module, - asiSafe: dep.shorthand ? true : dep.asiSafe, - isCall: dep.call, - callContext: !dep.directImport, - defaultInterop: true, - importVar: dep.getImportVar(moduleGraph), - initFragments, - runtime, - runtimeRequirements - }); - } - if (dep.shorthand) { - source.insert(dep.range[1], `: ${exportExpr}`); - } else { - source.replace(dep.range[0], dep.range[1] - 1, exportExpr); - } - } -}; +RequireEnsureItemDependency.Template = NullDependency.Template; -module.exports = HarmonyImportSpecifierDependency; +module.exports = RequireEnsureItemDependency; /***/ }), -/***/ 39029: +/***/ 8434: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -87021,160 +82913,135 @@ module.exports = HarmonyImportSpecifierDependency; -const HarmonyAcceptDependency = __webpack_require__(23624); -const HarmonyAcceptImportDependency = __webpack_require__(99843); -const HarmonyCompatibilityDependency = __webpack_require__(72906); -const HarmonyExportExpressionDependency = __webpack_require__(51340); -const HarmonyExportHeaderDependency = __webpack_require__(38873); -const HarmonyExportImportedSpecifierDependency = __webpack_require__(67157); -const HarmonyExportSpecifierDependency = __webpack_require__(48567); -const HarmonyImportSideEffectDependency = __webpack_require__(73132); -const HarmonyImportSpecifierDependency = __webpack_require__(14077); - -const HarmonyDetectionParserPlugin = __webpack_require__(17223); -const HarmonyExportDependencyParserPlugin = __webpack_require__(93466); -const HarmonyImportDependencyParserPlugin = __webpack_require__(20862); -const HarmonyTopLevelThisParserPlugin = __webpack_require__(63232); +const RequireEnsureDependency = __webpack_require__(27223); +const RequireEnsureItemDependency = __webpack_require__(50329); -/** @typedef {import("../Compiler")} Compiler */ +const RequireEnsureDependenciesBlockParserPlugin = __webpack_require__(7235); -class HarmonyModulesPlugin { - constructor(options) { - this.options = options; - } +const { + evaluateToString, + toConstantDependency +} = __webpack_require__(93998); - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ +class RequireEnsurePlugin { apply(compiler) { compiler.hooks.compilation.tap( - "HarmonyModulesPlugin", + "RequireEnsurePlugin", (compilation, { normalModuleFactory }) => { - compilation.dependencyTemplates.set( - HarmonyCompatibilityDependency, - new HarmonyCompatibilityDependency.Template() - ); - - compilation.dependencyFactories.set( - HarmonyImportSideEffectDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - HarmonyImportSideEffectDependency, - new HarmonyImportSideEffectDependency.Template() - ); - - compilation.dependencyFactories.set( - HarmonyImportSpecifierDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - HarmonyImportSpecifierDependency, - new HarmonyImportSpecifierDependency.Template() - ); - - compilation.dependencyTemplates.set( - HarmonyExportHeaderDependency, - new HarmonyExportHeaderDependency.Template() - ); - - compilation.dependencyTemplates.set( - HarmonyExportExpressionDependency, - new HarmonyExportExpressionDependency.Template() - ); - - compilation.dependencyTemplates.set( - HarmonyExportSpecifierDependency, - new HarmonyExportSpecifierDependency.Template() - ); - compilation.dependencyFactories.set( - HarmonyExportImportedSpecifierDependency, + RequireEnsureItemDependency, normalModuleFactory ); compilation.dependencyTemplates.set( - HarmonyExportImportedSpecifierDependency, - new HarmonyExportImportedSpecifierDependency.Template() - ); - - compilation.dependencyTemplates.set( - HarmonyAcceptDependency, - new HarmonyAcceptDependency.Template() + RequireEnsureItemDependency, + new RequireEnsureItemDependency.Template() ); - compilation.dependencyFactories.set( - HarmonyAcceptImportDependency, - normalModuleFactory - ); compilation.dependencyTemplates.set( - HarmonyAcceptImportDependency, - new HarmonyAcceptImportDependency.Template() + RequireEnsureDependency, + new RequireEnsureDependency.Template() ); const handler = (parser, parserOptions) => { - // TODO webpack 6: rename harmony to esm or module - if (parserOptions.harmony !== undefined && !parserOptions.harmony) + if ( + parserOptions.requireEnsure !== undefined && + !parserOptions.requireEnsure + ) return; - new HarmonyDetectionParserPlugin(this.options).apply(parser); - new HarmonyImportDependencyParserPlugin(parserOptions).apply(parser); - new HarmonyExportDependencyParserPlugin(parserOptions).apply(parser); - new HarmonyTopLevelThisParserPlugin().apply(parser); + new RequireEnsureDependenciesBlockParserPlugin().apply(parser); + parser.hooks.evaluateTypeof + .for("require.ensure") + .tap("RequireEnsurePlugin", evaluateToString("function")); + parser.hooks.typeof + .for("require.ensure") + .tap( + "RequireEnsurePlugin", + toConstantDependency(parser, JSON.stringify("function")) + ); }; normalModuleFactory.hooks.parser .for("javascript/auto") - .tap("HarmonyModulesPlugin", handler); + .tap("RequireEnsurePlugin", handler); normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("HarmonyModulesPlugin", handler); + .for("javascript/dynamic") + .tap("RequireEnsurePlugin", handler); } ); } } -module.exports = HarmonyModulesPlugin; +module.exports = RequireEnsurePlugin; /***/ }), -/***/ 63232: +/***/ 89183: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent + Author Tobias Koppers @sokra */ -const ConstDependency = __webpack_require__(76911); -const HarmonyExports = __webpack_require__(39211); +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); +const NullDependency = __webpack_require__(31830); -class HarmonyTopLevelThisParserPlugin { - apply(parser) { - parser.hooks.expression - .for("this") - .tap("HarmonyTopLevelThisParserPlugin", node => { - if (!parser.scope.topLevelScope) return; - if (HarmonyExports.isEnabled(parser.state)) { - const dep = new ConstDependency("undefined", node.range, null); - dep.loc = node.loc; - parser.state.module.addPresentationalDependency(dep); - return this; - } - }); +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + +class RequireHeaderDependency extends NullDependency { + constructor(range) { + super(); + if (!Array.isArray(range)) throw new Error("range must be valid"); + this.range = range; + } + + serialize(context) { + const { write } = context; + write(this.range); + super.serialize(context); + } + + static deserialize(context) { + const obj = new RequireHeaderDependency(context.read()); + obj.deserialize(context); + return obj; } } -module.exports = HarmonyTopLevelThisParserPlugin; +makeSerializable( + RequireHeaderDependency, + "webpack/lib/dependencies/RequireHeaderDependency" +); + +RequireHeaderDependency.Template = class RequireHeaderDependencyTemplate extends ( + NullDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply(dependency, source, { runtimeRequirements }) { + const dep = /** @type {RequireHeaderDependency} */ (dependency); + runtimeRequirements.add(RuntimeGlobals.require); + source.replace(dep.range[0], dep.range[1] - 1, "__webpack_require__"); + } +}; + +module.exports = RequireHeaderDependency; /***/ }), -/***/ 1902: +/***/ 71284: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -87185,24 +83052,237 @@ module.exports = HarmonyTopLevelThisParserPlugin; +const Dependency = __webpack_require__(54912); +const Template = __webpack_require__(1626); const makeSerializable = __webpack_require__(33032); -const ContextDependency = __webpack_require__(88101); -const ContextDependencyTemplateAsRequireCall = __webpack_require__(75815); +const ModuleDependency = __webpack_require__(80321); -class ImportContextDependency extends ContextDependency { - constructor(options, range, valueRange) { - super(options); +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + +class RequireIncludeDependency extends ModuleDependency { + constructor(request, range) { + super(request); this.range = range; - this.valueRange = valueRange; } - get type() { - return `import() context ${this.options.mode}`; - } + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + // This doesn't use any export + return Dependency.NO_EXPORTS_REFERENCED; + } + + get type() { + return "require.include"; + } get category() { - return "esm"; + return "commonjs"; + } +} + +makeSerializable( + RequireIncludeDependency, + "webpack/lib/dependencies/RequireIncludeDependency" +); + +RequireIncludeDependency.Template = class RequireIncludeDependencyTemplate extends ( + ModuleDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply(dependency, source, { runtimeTemplate }) { + const dep = /** @type {RequireIncludeDependency} */ (dependency); + const comment = runtimeTemplate.outputOptions.pathinfo + ? Template.toComment( + `require.include ${runtimeTemplate.requestShortener.shorten( + dep.request + )}` + ) + : ""; + + source.replace(dep.range[0], dep.range[1] - 1, `undefined${comment}`); + } +}; + +module.exports = RequireIncludeDependency; + + +/***/ }), + +/***/ 35768: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const WebpackError = __webpack_require__(53799); +const { + evaluateToString, + toConstantDependency +} = __webpack_require__(93998); +const makeSerializable = __webpack_require__(33032); +const RequireIncludeDependency = __webpack_require__(71284); + +module.exports = class RequireIncludeDependencyParserPlugin { + constructor(warn) { + this.warn = warn; + } + apply(parser) { + const { warn } = this; + parser.hooks.call + .for("require.include") + .tap("RequireIncludeDependencyParserPlugin", expr => { + if (expr.arguments.length !== 1) return; + const param = parser.evaluateExpression(expr.arguments[0]); + if (!param.isString()) return; + + if (warn) { + parser.state.module.addWarning( + new RequireIncludeDeprecationWarning(expr.loc) + ); + } + + const dep = new RequireIncludeDependency(param.string, expr.range); + dep.loc = expr.loc; + parser.state.current.addDependency(dep); + return true; + }); + parser.hooks.evaluateTypeof + .for("require.include") + .tap("RequireIncludePlugin", expr => { + if (warn) { + parser.state.module.addWarning( + new RequireIncludeDeprecationWarning(expr.loc) + ); + } + return evaluateToString("function")(expr); + }); + parser.hooks.typeof + .for("require.include") + .tap("RequireIncludePlugin", expr => { + if (warn) { + parser.state.module.addWarning( + new RequireIncludeDeprecationWarning(expr.loc) + ); + } + return toConstantDependency(parser, JSON.stringify("function"))(expr); + }); + } +}; + +class RequireIncludeDeprecationWarning extends WebpackError { + constructor(loc) { + super("require.include() is deprecated and will be removed soon."); + + this.name = "RequireIncludeDeprecationWarning"; + + this.loc = loc; + } +} + +makeSerializable( + RequireIncludeDeprecationWarning, + "webpack/lib/dependencies/RequireIncludeDependencyParserPlugin", + "RequireIncludeDeprecationWarning" +); + + +/***/ }), + +/***/ 37378: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const RequireIncludeDependency = __webpack_require__(71284); +const RequireIncludeDependencyParserPlugin = __webpack_require__(35768); + +class RequireIncludePlugin { + apply(compiler) { + compiler.hooks.compilation.tap( + "RequireIncludePlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + RequireIncludeDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + RequireIncludeDependency, + new RequireIncludeDependency.Template() + ); + + const handler = (parser, parserOptions) => { + if (parserOptions.requireInclude === false) return; + const warn = parserOptions.requireInclude === undefined; + + new RequireIncludeDependencyParserPlugin(warn).apply(parser); + }; + + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("RequireIncludePlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/dynamic") + .tap("RequireIncludePlugin", handler); + } + ); + } +} +module.exports = RequireIncludePlugin; + + +/***/ }), + +/***/ 55627: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const makeSerializable = __webpack_require__(33032); +const ContextDependency = __webpack_require__(88101); +const ContextDependencyTemplateAsId = __webpack_require__(76081); + +class RequireResolveContextDependency extends ContextDependency { + constructor(options, range, valueRange) { + super(options); + + this.range = range; + this.valueRange = valueRange; + } + + get type() { + return "amd require context"; } serialize(context) { @@ -87225,18 +83305,18 @@ class ImportContextDependency extends ContextDependency { } makeSerializable( - ImportContextDependency, - "webpack/lib/dependencies/ImportContextDependency" + RequireResolveContextDependency, + "webpack/lib/dependencies/RequireResolveContextDependency" ); -ImportContextDependency.Template = ContextDependencyTemplateAsRequireCall; +RequireResolveContextDependency.Template = ContextDependencyTemplateAsId; -module.exports = ImportContextDependency; +module.exports = RequireResolveContextDependency; /***/ }), -/***/ 89376: +/***/ 68582: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -87250,32 +83330,25 @@ module.exports = ImportContextDependency; const Dependency = __webpack_require__(54912); const makeSerializable = __webpack_require__(33032); const ModuleDependency = __webpack_require__(80321); +const ModuleDependencyAsId = __webpack_require__(80825); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../AsyncDependenciesBlock")} AsyncDependenciesBlock */ /** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -class ImportDependency extends ModuleDependency { - /** - * @param {string} request the request - * @param {[number, number]} range expression range - * @param {string[][]=} referencedExports list of referenced exports - */ - constructor(request, range, referencedExports) { +class RequireResolveDependency extends ModuleDependency { + constructor(request, range) { super(request); + this.range = range; - this.referencedExports = referencedExports; } get type() { - return "import()"; + return "require.resolve"; } get category() { - return "esm"; + return "commonjs"; } /** @@ -87285,67 +83358,24 @@ class ImportDependency extends ModuleDependency { * @returns {(string[] | ReferencedExport)[]} referenced exports */ getReferencedExports(moduleGraph, runtime) { - return this.referencedExports - ? this.referencedExports.map(e => ({ - name: e, - canMangle: false - })) - : Dependency.EXPORTS_OBJECT_REFERENCED; - } - - serialize(context) { - context.write(this.range); - context.write(this.referencedExports); - super.serialize(context); - } - - deserialize(context) { - this.range = context.read(); - this.referencedExports = context.read(); - super.deserialize(context); + // This doesn't use any export + return Dependency.NO_EXPORTS_REFERENCED; } } -makeSerializable(ImportDependency, "webpack/lib/dependencies/ImportDependency"); - -ImportDependency.Template = class ImportDependencyTemplate extends ( - ModuleDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply( - dependency, - source, - { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements } - ) { - const dep = /** @type {ImportDependency} */ (dependency); - const block = /** @type {AsyncDependenciesBlock} */ ( - moduleGraph.getParentBlock(dep) - ); - const content = runtimeTemplate.moduleNamespacePromise({ - chunkGraph, - block: block, - module: moduleGraph.getModule(dep), - request: dep.request, - strict: module.buildMeta.strictHarmonyModule, - message: "import()", - runtimeRequirements - }); +makeSerializable( + RequireResolveDependency, + "webpack/lib/dependencies/RequireResolveDependency" +); - source.replace(dep.range[0], dep.range[1] - 1, content); - } -}; +RequireResolveDependency.Template = ModuleDependencyAsId; -module.exports = ImportDependency; +module.exports = RequireResolveDependency; /***/ }), -/***/ 50718: +/***/ 9880: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -87357,40 +83387,43 @@ module.exports = ImportDependency; const makeSerializable = __webpack_require__(33032); -const ImportDependency = __webpack_require__(89376); +const NullDependency = __webpack_require__(31830); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ /** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -class ImportEagerDependency extends ImportDependency { - /** - * @param {string} request the request - * @param {[number, number]} range expression range - * @param {string[][]=} referencedExports list of referenced exports - */ - constructor(request, range, referencedExports) { - super(request, range, referencedExports); +class RequireResolveHeaderDependency extends NullDependency { + constructor(range) { + super(); + + if (!Array.isArray(range)) throw new Error("range must be valid"); + + this.range = range; } - get type() { - return "import() eager"; + serialize(context) { + const { write } = context; + + write(this.range); + + super.serialize(context); } - get category() { - return "esm"; + static deserialize(context) { + const obj = new RequireResolveHeaderDependency(context.read()); + obj.deserialize(context); + return obj; } } makeSerializable( - ImportEagerDependency, - "webpack/lib/dependencies/ImportEagerDependency" + RequireResolveHeaderDependency, + "webpack/lib/dependencies/RequireResolveHeaderDependency" ); -ImportEagerDependency.Template = class ImportEagerDependencyTemplate extends ( - ImportDependency.Template +RequireResolveHeaderDependency.Template = class RequireResolveHeaderDependencyTemplate extends ( + NullDependency.Template ) { /** * @param {Dependency} dependency the dependency for which the template should be applied @@ -87398,694 +83431,660 @@ ImportEagerDependency.Template = class ImportEagerDependencyTemplate extends ( * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply( - dependency, - source, - { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements } - ) { - const dep = /** @type {ImportEagerDependency} */ (dependency); - const content = runtimeTemplate.moduleNamespacePromise({ - chunkGraph, - module: moduleGraph.getModule(dep), - request: dep.request, - strict: module.buildMeta.strictHarmonyModule, - message: "import() eager", - runtimeRequirements - }); + apply(dependency, source, templateContext) { + const dep = /** @type {RequireResolveHeaderDependency} */ (dependency); + source.replace(dep.range[0], dep.range[1] - 1, "/*require.resolve*/"); + } - source.replace(dep.range[0], dep.range[1] - 1, content); + applyAsTemplateArgument(name, dep, source) { + source.replace(dep.range[0], dep.range[1] - 1, "/*require.resolve*/"); } }; -module.exports = ImportEagerDependency; +module.exports = RequireResolveHeaderDependency; /***/ }), -/***/ 51274: +/***/ 24187: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); -const ModuleDependencyTemplateAsId = __webpack_require__(80825); +const NullDependency = __webpack_require__(31830); -class ImportMetaHotAcceptDependency extends ModuleDependency { - constructor(request, range) { - super(request); - this.range = range; - this.weak = true; +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/Hash")} Hash */ + +class RuntimeRequirementsDependency extends NullDependency { + /** + * @param {string[]} runtimeRequirements runtime requirements + */ + constructor(runtimeRequirements) { + super(); + this.runtimeRequirements = new Set(runtimeRequirements); + this._hashUpdate = undefined; } - get type() { - return "import.meta.webpackHot.accept"; + /** + * Update the hash + * @param {Hash} hash hash to be updated + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + if (this._hashUpdate === undefined) { + this._hashUpdate = Array.from(this.runtimeRequirements).join() + ""; + } + hash.update(this._hashUpdate); } - get category() { - return "esm"; + serialize(context) { + const { write } = context; + write(this.runtimeRequirements); + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + this.runtimeRequirements = read(); + super.deserialize(context); } } makeSerializable( - ImportMetaHotAcceptDependency, - "webpack/lib/dependencies/ImportMetaHotAcceptDependency" + RuntimeRequirementsDependency, + "webpack/lib/dependencies/RuntimeRequirementsDependency" ); -ImportMetaHotAcceptDependency.Template = ModuleDependencyTemplateAsId; +RuntimeRequirementsDependency.Template = class RuntimeRequirementsDependencyTemplate extends ( + NullDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply(dependency, source, { runtimeRequirements }) { + const dep = /** @type {RuntimeRequirementsDependency} */ (dependency); + for (const req of dep.runtimeRequirements) { + runtimeRequirements.add(req); + } + } +}; -module.exports = ImportMetaHotAcceptDependency; +module.exports = RuntimeRequirementsDependency; /***/ }), -/***/ 53141: +/***/ 91418: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); -const ModuleDependencyTemplateAsId = __webpack_require__(80825); +const NullDependency = __webpack_require__(31830); -class ImportMetaHotDeclineDependency extends ModuleDependency { - constructor(request, range) { - super(request); +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency").ExportSpec} ExportSpec */ +/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/Hash")} Hash */ - this.range = range; - this.weak = true; +class StaticExportsDependency extends NullDependency { + /** + * @param {string[] | true} exports export names + * @param {boolean} canMangle true, if mangling exports names is allowed + */ + constructor(exports, canMangle) { + super(); + this.exports = exports; + this.canMangle = canMangle; } get type() { - return "import.meta.webpackHot.decline"; + return "static exports"; } - get category() { - return "esm"; + /** + * Returns the exported names + * @param {ModuleGraph} moduleGraph module graph + * @returns {ExportsSpec | undefined} export names + */ + getExports(moduleGraph) { + return { + exports: this.exports, + canMangle: this.canMangle, + dependencies: undefined + }; + } + + serialize(context) { + const { write } = context; + write(this.exports); + write(this.canMangle); + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + this.exports = read(); + this.canMangle = read(); + super.deserialize(context); } } makeSerializable( - ImportMetaHotDeclineDependency, - "webpack/lib/dependencies/ImportMetaHotDeclineDependency" + StaticExportsDependency, + "webpack/lib/dependencies/StaticExportsDependency" ); -ImportMetaHotDeclineDependency.Template = ModuleDependencyTemplateAsId; - -module.exports = ImportMetaHotDeclineDependency; +module.exports = StaticExportsDependency; /***/ }), -/***/ 17228: +/***/ 97981: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ -const { pathToFileURL } = __webpack_require__(57310); -const ModuleDependencyWarning = __webpack_require__(29656); -const Template = __webpack_require__(39722); -const BasicEvaluatedExpression = __webpack_require__(950); +const RuntimeGlobals = __webpack_require__(16475); +const WebpackError = __webpack_require__(53799); const { - evaluateToIdentifier, - toConstantDependency, evaluateToString, - evaluateToNumber + expressionIsUnsupported, + toConstantDependency } = __webpack_require__(93998); -const memoize = __webpack_require__(78676); -const propertyAccess = __webpack_require__(54190); +const makeSerializable = __webpack_require__(33032); const ConstDependency = __webpack_require__(76911); +const SystemRuntimeModule = __webpack_require__(85439); -/** @typedef {import("estree").MemberExpression} MemberExpression */ -/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ /** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../NormalModule")} NormalModule */ -/** @typedef {import("../javascript/JavascriptParser")} Parser */ -const getCriticalDependencyWarning = memoize(() => - __webpack_require__(15427) -); - -class ImportMetaPlugin { +class SystemPlugin { /** - * @param {Compiler} compiler compiler + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ apply(compiler) { compiler.hooks.compilation.tap( - "ImportMetaPlugin", + "SystemPlugin", (compilation, { normalModuleFactory }) => { - /** - * @param {NormalModule} module module - * @returns {string} file url - */ - const getUrl = module => { - return pathToFileURL(module.resource).toString(); - }; - /** - * @param {Parser} parser parser parser - * @param {JavascriptParserOptions} parserOptions parserOptions - * @returns {void} - */ - const parserHandler = (parser, { importMeta }) => { - if (importMeta === false) { - const { importMetaName } = compilation.outputOptions; - if (importMetaName === "import.meta") return; + compilation.hooks.runtimeRequirementInModule + .for(RuntimeGlobals.system) + .tap("SystemPlugin", (module, set) => { + set.add(RuntimeGlobals.requireScope); + }); - parser.hooks.expression - .for("import.meta") - .tap("ImportMetaPlugin", metaProperty => { - const dep = new ConstDependency( - importMetaName, - metaProperty.range - ); - dep.loc = metaProperty.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.system) + .tap("SystemPlugin", (chunk, set) => { + compilation.addRuntimeModule(chunk, new SystemRuntimeModule()); + }); + + const handler = (parser, parserOptions) => { + if (parserOptions.system === undefined || !parserOptions.system) { return; } - /// import.meta direct /// - parser.hooks.typeof - .for("import.meta") - .tap( - "ImportMetaPlugin", - toConstantDependency(parser, JSON.stringify("object")) - ); - parser.hooks.expression - .for("import.meta") - .tap("ImportMetaPlugin", metaProperty => { - const CriticalDependencyWarning = getCriticalDependencyWarning(); - parser.state.module.addWarning( - new ModuleDependencyWarning( - parser.state.module, - new CriticalDependencyWarning( - "Accessing import.meta directly is unsupported (only property access is supported)" - ), - metaProperty.loc + const setNotSupported = name => { + parser.hooks.evaluateTypeof + .for(name) + .tap("SystemPlugin", evaluateToString("undefined")); + parser.hooks.expression + .for(name) + .tap( + "SystemPlugin", + expressionIsUnsupported( + parser, + name + " is not supported by webpack." ) ); - const dep = new ConstDependency( - `${parser.isAsiPosition(metaProperty.range[0]) ? ";" : ""}({})`, - metaProperty.range - ); - dep.loc = metaProperty.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - parser.hooks.evaluateTypeof - .for("import.meta") - .tap("ImportMetaPlugin", evaluateToString("object")); - parser.hooks.evaluateIdentifier.for("import.meta").tap( - "ImportMetaPlugin", - evaluateToIdentifier("import.meta", "import.meta", () => [], true) - ); + }; - /// import.meta.url /// parser.hooks.typeof - .for("import.meta.url") + .for("System.import") .tap( - "ImportMetaPlugin", - toConstantDependency(parser, JSON.stringify("string")) + "SystemPlugin", + toConstantDependency(parser, JSON.stringify("function")) ); - parser.hooks.expression - .for("import.meta.url") - .tap("ImportMetaPlugin", expr => { - const dep = new ConstDependency( - JSON.stringify(getUrl(parser.state.module)), - expr.range - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); parser.hooks.evaluateTypeof - .for("import.meta.url") - .tap("ImportMetaPlugin", evaluateToString("string")); - parser.hooks.evaluateIdentifier - .for("import.meta.url") - .tap("ImportMetaPlugin", expr => { - return new BasicEvaluatedExpression() - .setString(getUrl(parser.state.module)) - .setRange(expr.range); - }); - - /// import.meta.webpack /// - const webpackVersion = parseInt( - (__webpack_require__(32702)/* .version */ .i8), - 10 - ); + .for("System.import") + .tap("SystemPlugin", evaluateToString("function")); parser.hooks.typeof - .for("import.meta.webpack") - .tap( - "ImportMetaPlugin", - toConstantDependency(parser, JSON.stringify("number")) - ); - parser.hooks.expression - .for("import.meta.webpack") + .for("System") .tap( - "ImportMetaPlugin", - toConstantDependency(parser, JSON.stringify(webpackVersion)) + "SystemPlugin", + toConstantDependency(parser, JSON.stringify("object")) ); parser.hooks.evaluateTypeof - .for("import.meta.webpack") - .tap("ImportMetaPlugin", evaluateToString("number")); - parser.hooks.evaluateIdentifier - .for("import.meta.webpack") - .tap("ImportMetaPlugin", evaluateToNumber(webpackVersion)); + .for("System") + .tap("SystemPlugin", evaluateToString("object")); - /// Unknown properties /// - parser.hooks.unhandledExpressionMemberChain - .for("import.meta") - .tap("ImportMetaPlugin", (expr, members) => { - const dep = new ConstDependency( - `${Template.toNormalComment( - "unsupported import.meta." + members.join(".") - )} undefined${propertyAccess(members, 1)}`, - expr.range - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - parser.hooks.evaluate - .for("MemberExpression") - .tap("ImportMetaPlugin", expression => { - const expr = /** @type {MemberExpression} */ (expression); - if ( - expr.object.type === "MetaProperty" && - expr.object.meta.name === "import" && - expr.object.property.name === "meta" && - expr.property.type === - (expr.computed ? "Literal" : "Identifier") - ) { - return new BasicEvaluatedExpression() - .setUndefined() - .setRange(expr.range); - } + setNotSupported("System.set"); + setNotSupported("System.get"); + setNotSupported("System.register"); + + parser.hooks.expression.for("System").tap("SystemPlugin", expr => { + const dep = new ConstDependency(RuntimeGlobals.system, expr.range, [ + RuntimeGlobals.system + ]); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + + parser.hooks.call.for("System.import").tap("SystemPlugin", expr => { + parser.state.module.addWarning( + new SystemImportDeprecationWarning(expr.loc) + ); + + return parser.hooks.importCall.call({ + type: "ImportExpression", + source: expr.arguments[0], + loc: expr.loc, + range: expr.range }); + }); }; normalModuleFactory.hooks.parser .for("javascript/auto") - .tap("ImportMetaPlugin", parserHandler); + .tap("SystemPlugin", handler); normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("ImportMetaPlugin", parserHandler); + .for("javascript/dynamic") + .tap("SystemPlugin", handler); } ); } } -module.exports = ImportMetaPlugin; +class SystemImportDeprecationWarning extends WebpackError { + constructor(loc) { + super( + "System.import() is deprecated and will be removed soon. Use import() instead.\n" + + "For more info visit https://webpack.js.org/guides/code-splitting/" + ); + + this.name = "SystemImportDeprecationWarning"; + + this.loc = loc; + } +} + +makeSerializable( + SystemImportDeprecationWarning, + "webpack/lib/dependencies/SystemPlugin", + "SystemImportDeprecationWarning" +); + +module.exports = SystemPlugin; +module.exports.SystemImportDeprecationWarning = SystemImportDeprecationWarning; /***/ }), -/***/ 88130: +/***/ 85439: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Florent Cailhol @ooflorent */ -const AsyncDependenciesBlock = __webpack_require__(47736); -const CommentCompilationWarning = __webpack_require__(98427); -const UnsupportedFeatureWarning = __webpack_require__(42495); -const ContextDependencyHelpers = __webpack_require__(99630); -const ImportContextDependency = __webpack_require__(1902); -const ImportDependency = __webpack_require__(89376); -const ImportEagerDependency = __webpack_require__(50718); -const ImportWeakDependency = __webpack_require__(82483); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); -/** @typedef {import("../ChunkGroup").RawChunkGroupOptions} RawChunkGroupOptions */ -/** @typedef {import("../ContextModule").ContextMode} ContextMode */ +class SystemRuntimeModule extends RuntimeModule { + constructor() { + super("system"); + } -class ImportParserPlugin { - constructor(options) { - this.options = options; + /** + * @returns {string} runtime code + */ + generate() { + return Template.asString([ + `${RuntimeGlobals.system} = {`, + Template.indent([ + "import: function () {", + Template.indent( + "throw new Error('System.import cannot be used indirectly');" + ), + "}" + ]), + "};" + ]); } +} - apply(parser) { - parser.hooks.importCall.tap("ImportParserPlugin", expr => { - const param = parser.evaluateExpression(expr.source); +module.exports = SystemRuntimeModule; - let chunkName = null; - /** @type {ContextMode} */ - let mode = "lazy"; - let include = null; - let exclude = null; - /** @type {string[][] | null} */ - let exports = null; - /** @type {RawChunkGroupOptions} */ - const groupOptions = {}; - const { options: importOptions, errors: commentErrors } = - parser.parseCommentOptions(expr.range); +/***/ }), - if (commentErrors) { - for (const e of commentErrors) { - const { comment } = e; - parser.state.module.addWarning( - new CommentCompilationWarning( - `Compilation error while processing magic comment(-s): /*${comment.value}*/: ${e.message}`, - comment.loc - ) - ); - } - } +/***/ 58612: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (importOptions) { - if (importOptions.webpackIgnore !== undefined) { - if (typeof importOptions.webpackIgnore !== "boolean") { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackIgnore\` expected a boolean, but received: ${importOptions.webpackIgnore}.`, - expr.loc - ) - ); - } else { - // Do not instrument `import()` if `webpackIgnore` is `true` - if (importOptions.webpackIgnore) { - return false; - } - } - } - if (importOptions.webpackChunkName !== undefined) { - if (typeof importOptions.webpackChunkName !== "string") { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackChunkName\` expected a string, but received: ${importOptions.webpackChunkName}.`, - expr.loc - ) - ); - } else { - chunkName = importOptions.webpackChunkName; - } - } - if (importOptions.webpackMode !== undefined) { - if (typeof importOptions.webpackMode !== "string") { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackMode\` expected a string, but received: ${importOptions.webpackMode}.`, - expr.loc - ) - ); - } else { - mode = importOptions.webpackMode; - } - } - if (importOptions.webpackPrefetch !== undefined) { - if (importOptions.webpackPrefetch === true) { - groupOptions.prefetchOrder = 0; - } else if (typeof importOptions.webpackPrefetch === "number") { - groupOptions.prefetchOrder = importOptions.webpackPrefetch; - } else { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackPrefetch\` expected true or a number, but received: ${importOptions.webpackPrefetch}.`, - expr.loc - ) - ); - } - } - if (importOptions.webpackPreload !== undefined) { - if (importOptions.webpackPreload === true) { - groupOptions.preloadOrder = 0; - } else if (typeof importOptions.webpackPreload === "number") { - groupOptions.preloadOrder = importOptions.webpackPreload; - } else { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackPreload\` expected true or a number, but received: ${importOptions.webpackPreload}.`, - expr.loc - ) - ); - } - } - if (importOptions.webpackInclude !== undefined) { - if ( - !importOptions.webpackInclude || - importOptions.webpackInclude.constructor.name !== "RegExp" - ) { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackInclude\` expected a regular expression, but received: ${importOptions.webpackInclude}.`, - expr.loc - ) - ); - } else { - include = new RegExp(importOptions.webpackInclude); - } - } - if (importOptions.webpackExclude !== undefined) { - if ( - !importOptions.webpackExclude || - importOptions.webpackExclude.constructor.name !== "RegExp" - ) { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackExclude\` expected a regular expression, but received: ${importOptions.webpackExclude}.`, - expr.loc - ) - ); - } else { - exclude = new RegExp(importOptions.webpackExclude); - } - } - if (importOptions.webpackExports !== undefined) { - if ( - !( - typeof importOptions.webpackExports === "string" || - (Array.isArray(importOptions.webpackExports) && - importOptions.webpackExports.every( - item => typeof item === "string" - )) - ) - ) { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackExports\` expected a string or an array of strings, but received: ${importOptions.webpackExports}.`, - expr.loc - ) - ); - } else { - if (typeof importOptions.webpackExports === "string") { - exports = [[importOptions.webpackExports]]; - } else { - exports = Array.from(importOptions.webpackExports, e => [e]); - } - } - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ - if (param.isString()) { - if (mode !== "lazy" && mode !== "eager" && mode !== "weak") { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackMode\` expected 'lazy', 'eager' or 'weak', but received: ${mode}.`, - expr.loc - ) - ); - } - if (mode === "eager") { - const dep = new ImportEagerDependency( - param.string, - expr.range, - exports - ); - parser.state.current.addDependency(dep); - } else if (mode === "weak") { - const dep = new ImportWeakDependency( - param.string, - expr.range, - exports - ); - parser.state.current.addDependency(dep); - } else { - const depBlock = new AsyncDependenciesBlock( - { - ...groupOptions, - name: chunkName - }, - expr.loc, - param.string - ); - const dep = new ImportDependency(param.string, expr.range, exports); - dep.loc = expr.loc; - depBlock.addDependency(dep); - parser.state.current.addBlock(depBlock); - } - return true; - } else { - if ( - mode !== "lazy" && - mode !== "lazy-once" && - mode !== "eager" && - mode !== "weak" - ) { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackMode\` expected 'lazy', 'lazy-once', 'eager' or 'weak', but received: ${mode}.`, - expr.loc - ) - ); - mode = "lazy"; - } - if (mode === "weak") { - mode = "async-weak"; - } - const dep = ContextDependencyHelpers.create( - ImportContextDependency, - expr.range, - param, - expr, - this.options, - { - chunkName, - groupOptions, - include, - exclude, - mode, - namespaceObject: parser.state.module.buildMeta.strictHarmonyModule - ? "strict" - : true, - typePrefix: "import()", - category: "esm", - referencedExports: exports - }, - parser - ); - if (!dep) return; - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; - } - }); +const RuntimeGlobals = __webpack_require__(16475); +const { + getDependencyUsedByExportsCondition +} = __webpack_require__(38988); +const makeSerializable = __webpack_require__(33032); +const memoize = __webpack_require__(78676); +const ModuleDependency = __webpack_require__(80321); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + +const getRawDataUrlModule = memoize(() => __webpack_require__(19684)); + +class URLDependency extends ModuleDependency { + /** + * @param {string} request request + * @param {[number, number]} range range of the arguments of new URL( |> ... <| ) + * @param {[number, number]} outerRange range of the full |> new URL(...) <| + * @param {boolean=} relative use relative urls instead of absolute with base uri + */ + constructor(request, range, outerRange, relative) { + super(request); + this.range = range; + this.outerRange = outerRange; + this.relative = relative || false; + /** @type {Set | boolean} */ + this.usedByExports = undefined; + } + + get type() { + return "new URL()"; + } + + get category() { + return "url"; + } + + /** + * @param {ModuleGraph} moduleGraph module graph + * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active + */ + getCondition(moduleGraph) { + return getDependencyUsedByExportsCondition( + this, + this.usedByExports, + moduleGraph + ); + } + + /** + * @param {string} context context directory + * @returns {Module} a module + */ + createIgnoredModule(context) { + const RawDataUrlModule = getRawDataUrlModule(); + return new RawDataUrlModule("data:,", `ignored-asset`, `(ignored asset)`); + } + + serialize(context) { + const { write } = context; + write(this.outerRange); + write(this.relative); + write(this.usedByExports); + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + this.outerRange = read(); + this.relative = read(); + this.usedByExports = read(); + super.deserialize(context); } } -module.exports = ImportParserPlugin; +URLDependency.Template = class URLDependencyTemplate extends ( + ModuleDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply(dependency, source, templateContext) { + const { + chunkGraph, + moduleGraph, + runtimeRequirements, + runtimeTemplate, + runtime + } = templateContext; + const dep = /** @type {URLDependency} */ (dependency); + const connection = moduleGraph.getConnection(dep); + // Skip rendering depending when dependency is conditional + if (connection && !connection.isTargetActive(runtime)) { + source.replace( + dep.outerRange[0], + dep.outerRange[1] - 1, + "/* unused asset import */ undefined" + ); + return; + } + + runtimeRequirements.add(RuntimeGlobals.require); + + if (dep.relative) { + runtimeRequirements.add(RuntimeGlobals.relativeUrl); + source.replace( + dep.outerRange[0], + dep.outerRange[1] - 1, + `/* asset import */ new ${ + RuntimeGlobals.relativeUrl + }(${runtimeTemplate.moduleRaw({ + chunkGraph, + module: moduleGraph.getModule(dep), + request: dep.request, + runtimeRequirements, + weak: false + })})` + ); + } else { + runtimeRequirements.add(RuntimeGlobals.baseURI); + + source.replace( + dep.range[0], + dep.range[1] - 1, + `/* asset import */ ${runtimeTemplate.moduleRaw({ + chunkGraph, + module: moduleGraph.getModule(dep), + request: dep.request, + runtimeRequirements, + weak: false + })}, ${RuntimeGlobals.baseURI}` + ); + } + } +}; + +makeSerializable(URLDependency, "webpack/lib/dependencies/URLDependency"); + +module.exports = URLDependency; /***/ }), -/***/ 41293: +/***/ 14412: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ -const ImportContextDependency = __webpack_require__(1902); -const ImportDependency = __webpack_require__(89376); -const ImportEagerDependency = __webpack_require__(50718); -const ImportParserPlugin = __webpack_require__(88130); -const ImportWeakDependency = __webpack_require__(82483); +const { approve } = __webpack_require__(93998); +const InnerGraph = __webpack_require__(38988); +const URLDependency = __webpack_require__(58612); +/** @typedef {import("estree").NewExpression} NewExpressionNode */ /** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ -class ImportPlugin { +class URLPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {Compiler} compiler compiler */ apply(compiler) { compiler.hooks.compilation.tap( - "ImportPlugin", - (compilation, { contextModuleFactory, normalModuleFactory }) => { - compilation.dependencyFactories.set( - ImportDependency, - normalModuleFactory - ); + "URLPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set(URLDependency, normalModuleFactory); compilation.dependencyTemplates.set( - ImportDependency, - new ImportDependency.Template() + URLDependency, + new URLDependency.Template() ); - compilation.dependencyFactories.set( - ImportEagerDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - ImportEagerDependency, - new ImportEagerDependency.Template() - ); + /** + * @param {JavascriptParser} parser parser + * @param {object} parserOptions options + */ + const parserCallback = (parser, parserOptions) => { + if (parserOptions.url === false) return; + const relative = parserOptions.url === "relative"; - compilation.dependencyFactories.set( - ImportWeakDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - ImportWeakDependency, - new ImportWeakDependency.Template() - ); + /** + * @param {NewExpressionNode} expr expression + * @returns {undefined | string} request + */ + const getUrlRequest = expr => { + if (expr.arguments.length !== 2) return; - compilation.dependencyFactories.set( - ImportContextDependency, - contextModuleFactory - ); - compilation.dependencyTemplates.set( - ImportContextDependency, - new ImportContextDependency.Template() - ); + const [arg1, arg2] = expr.arguments; - const handler = (parser, parserOptions) => { - if (parserOptions.import !== undefined && !parserOptions.import) - return; + if ( + arg2.type !== "MemberExpression" || + arg1.type === "SpreadElement" + ) + return; - new ImportParserPlugin(parserOptions).apply(parser); + const chain = parser.extractMemberExpressionChain(arg2); + + if ( + chain.members.length !== 1 || + chain.object.type !== "MetaProperty" || + chain.object.meta.name !== "import" || + chain.object.property.name !== "meta" || + chain.members[0] !== "url" + ) + return; + + const request = parser.evaluateExpression(arg1).asString(); + + return request; + }; + + parser.hooks.canRename.for("URL").tap("URLPlugin", approve); + parser.hooks.new.for("URL").tap("URLPlugin", _expr => { + const expr = /** @type {NewExpressionNode} */ (_expr); + + const request = getUrlRequest(expr); + + if (!request) return; + + const [arg1, arg2] = expr.arguments; + const dep = new URLDependency( + request, + [arg1.range[0], arg2.range[1]], + expr.range, + relative + ); + dep.loc = expr.loc; + parser.state.current.addDependency(dep); + InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); + return true; + }); + parser.hooks.isPure.for("NewExpression").tap("URLPlugin", _expr => { + const expr = /** @type {NewExpressionNode} */ (_expr); + const { callee } = expr; + if (callee.type !== "Identifier") return; + const calleeInfo = parser.getFreeInfoFromVariable(callee.name); + if (!calleeInfo || calleeInfo.name !== "URL") return; + + const request = getUrlRequest(expr); + + if (request) return true; + }); }; normalModuleFactory.hooks.parser .for("javascript/auto") - .tap("ImportPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("ImportPlugin", handler); + .tap("URLPlugin", parserCallback); + normalModuleFactory.hooks.parser .for("javascript/esm") - .tap("ImportPlugin", handler); + .tap("URLPlugin", parserCallback); } ); } } -module.exports = ImportPlugin; + +module.exports = URLPlugin; /***/ }), -/***/ 82483: +/***/ 51669: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -88097,37 +84096,46 @@ module.exports = ImportPlugin; const makeSerializable = __webpack_require__(33032); -const ImportDependency = __webpack_require__(89376); +const NullDependency = __webpack_require__(31830); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ /** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -class ImportWeakDependency extends ImportDependency { - /** - * @param {string} request the request - * @param {[number, number]} range expression range - * @param {string[][]=} referencedExports list of referenced exports - */ - constructor(request, range, referencedExports) { - super(request, range, referencedExports); - this.weak = true; +class UnsupportedDependency extends NullDependency { + constructor(request, range) { + super(); + + this.request = request; + this.range = range; } - get type() { - return "import() weak"; + serialize(context) { + const { write } = context; + + write(this.request); + write(this.range); + + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + + this.request = read(); + this.range = read(); + + super.deserialize(context); } } makeSerializable( - ImportWeakDependency, - "webpack/lib/dependencies/ImportWeakDependency" + UnsupportedDependency, + "webpack/lib/dependencies/UnsupportedDependency" ); -ImportWeakDependency.Template = class ImportDependencyTemplate extends ( - ImportDependency.Template +UnsupportedDependency.Template = class UnsupportedDependencyTemplate extends ( + NullDependency.Template ) { /** * @param {Dependency} dependency the dependency for which the template should be applied @@ -88135,32 +84143,25 @@ ImportWeakDependency.Template = class ImportDependencyTemplate extends ( * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply( - dependency, - source, - { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements } - ) { - const dep = /** @type {ImportWeakDependency} */ (dependency); - const content = runtimeTemplate.moduleNamespacePromise({ - chunkGraph, - module: moduleGraph.getModule(dep), - request: dep.request, - strict: module.buildMeta.strictHarmonyModule, - message: "import() weak", - weak: true, - runtimeRequirements - }); + apply(dependency, source, { runtimeTemplate }) { + const dep = /** @type {UnsupportedDependency} */ (dependency); - source.replace(dep.range[0], dep.range[1] - 1, content); + source.replace( + dep.range[0], + dep.range[1], + runtimeTemplate.missingModule({ + request: dep.request + }) + ); } }; -module.exports = ImportWeakDependency; +module.exports = UnsupportedDependency; /***/ }), -/***/ 750: +/***/ 52204: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -88171,107 +84172,83 @@ module.exports = ImportWeakDependency; +const Dependency = __webpack_require__(54912); const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); +const ModuleDependency = __webpack_require__(80321); -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency").ExportSpec} ExportSpec */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -const getExportsFromData = data => { - if (data && typeof data === "object") { - if (Array.isArray(data)) { - return data.map((item, idx) => { - return { - name: `${idx}`, - canMangle: true, - exports: getExportsFromData(item) - }; - }); - } else { - const exports = []; - for (const key of Object.keys(data)) { - exports.push({ - name: key, - canMangle: true, - exports: getExportsFromData(data[key]) - }); - } - return exports; - } +class WebAssemblyExportImportedDependency extends ModuleDependency { + constructor(exportName, request, name, valueType) { + super(request); + /** @type {string} */ + this.exportName = exportName; + /** @type {string} */ + this.name = name; + /** @type {string} */ + this.valueType = valueType; } - return undefined; -}; -class JsonExportsDependency extends NullDependency { /** - * @param {(string | ExportSpec)[]} exports json exports + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module */ - constructor(exports) { - super(); - this.exports = exports; - this._hashUpdate = undefined; - } - - get type() { - return "json exports"; + couldAffectReferencingModule() { + return Dependency.TRANSITIVE; } /** - * Returns the exported names + * Returns list of exports referenced by this dependency * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports */ - getExports(moduleGraph) { - return { - exports: this.exports, - dependencies: undefined - }; + getReferencedExports(moduleGraph, runtime) { + return [[this.name]]; } - /** - * Update the hash - * @param {Hash} hash hash to be updated - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - if (this._hashUpdate === undefined) { - this._hashUpdate = this.exports - ? JSON.stringify(this.exports) - : "undefined"; - } - hash.update(this._hashUpdate); + get type() { + return "wasm export import"; + } + + get category() { + return "wasm"; } serialize(context) { const { write } = context; - write(this.exports); + + write(this.exportName); + write(this.name); + write(this.valueType); + super.serialize(context); } deserialize(context) { const { read } = context; - this.exports = read(); + + this.exportName = read(); + this.name = read(); + this.valueType = read(); + super.deserialize(context); } } makeSerializable( - JsonExportsDependency, - "webpack/lib/dependencies/JsonExportsDependency" + WebAssemblyExportImportedDependency, + "webpack/lib/dependencies/WebAssemblyExportImportedDependency" ); -module.exports = JsonExportsDependency; -module.exports.getExportsFromData = getExportsFromData; +module.exports = WebAssemblyExportImportedDependency; /***/ }), -/***/ 71693: +/***/ 5239: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -88282,440 +84259,157 @@ module.exports.getExportsFromData = getExportsFromData; +const makeSerializable = __webpack_require__(33032); +const UnsupportedWebAssemblyFeatureError = __webpack_require__(78455); const ModuleDependency = __webpack_require__(80321); -class LoaderDependency extends ModuleDependency { +/** @typedef {import("@webassemblyjs/ast").ModuleImportDescription} ModuleImportDescription */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + +class WebAssemblyImportDependency extends ModuleDependency { /** - * @param {string} request request string + * @param {string} request the request + * @param {string} name the imported name + * @param {ModuleImportDescription} description the WASM ast node + * @param {false | string} onlyDirectImport if only direct imports are allowed */ - constructor(request) { + constructor(request, name, description, onlyDirectImport) { super(request); + /** @type {string} */ + this.name = name; + /** @type {ModuleImportDescription} */ + this.description = description; + /** @type {false | string} */ + this.onlyDirectImport = onlyDirectImport; } get type() { - return "loader"; + return "wasm import"; } get category() { - return "loader"; + return "wasm"; } -} - -module.exports = LoaderDependency; - - -/***/ }), - -/***/ 223: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const ModuleDependency = __webpack_require__(80321); -class LoaderImportDependency extends ModuleDependency { /** - * @param {string} request request string + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports */ - constructor(request) { - super(request); - this.weak = true; - } - - get type() { - return "loader import"; - } - - get category() { - return "loaderImport"; + getReferencedExports(moduleGraph, runtime) { + return [[this.name]]; } -} - -module.exports = LoaderImportDependency; - - -/***/ }), - -/***/ 24721: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const NormalModule = __webpack_require__(39); -const LazySet = __webpack_require__(38938); -const LoaderDependency = __webpack_require__(71693); -const LoaderImportDependency = __webpack_require__(223); - -/** @typedef {import("../Compilation").DepConstructor} DepConstructor */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ - -/** - * @callback LoadModuleCallback - * @param {(Error | null)=} err error object - * @param {string | Buffer=} source source code - * @param {object=} map source map - * @param {Module=} module loaded module if successful - */ - -/** - * @callback ImportModuleCallback - * @param {(Error | null)=} err error object - * @param {any=} exports exports of the evaluated module - */ - -/** - * @typedef {Object} ImportModuleOptions - * @property {string=} layer the target layer - * @property {string=} publicPath the target public path - */ - -class LoaderPlugin { - /** - * @param {Object} options options - */ - constructor(options = {}) {} /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * Returns errors + * @param {ModuleGraph} moduleGraph module graph + * @returns {WebpackError[]} errors */ - apply(compiler) { - compiler.hooks.compilation.tap( - "LoaderPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - LoaderDependency, - normalModuleFactory - ); - compilation.dependencyFactories.set( - LoaderImportDependency, - normalModuleFactory - ); - } - ); - - compiler.hooks.compilation.tap("LoaderPlugin", compilation => { - const moduleGraph = compilation.moduleGraph; - NormalModule.getCompilationHooks(compilation).loader.tap( - "LoaderPlugin", - loaderContext => { - /** - * @param {string} request the request string to load the module from - * @param {LoadModuleCallback} callback callback returning the loaded module or error - * @returns {void} - */ - loaderContext.loadModule = (request, callback) => { - const dep = new LoaderDependency(request); - dep.loc = { - name: request - }; - const factory = compilation.dependencyFactories.get( - /** @type {DepConstructor} */ (dep.constructor) - ); - if (factory === undefined) { - return callback( - new Error( - `No module factory available for dependency type: ${dep.constructor.name}` - ) - ); - } - compilation.buildQueue.increaseParallelism(); - compilation.handleModuleCreation( - { - factory, - dependencies: [dep], - originModule: loaderContext._module, - context: loaderContext.context, - recursive: false - }, - err => { - compilation.buildQueue.decreaseParallelism(); - if (err) { - return callback(err); - } - const referencedModule = moduleGraph.getModule(dep); - if (!referencedModule) { - return callback(new Error("Cannot load the module")); - } - if (referencedModule.getNumberOfErrors() > 0) { - return callback( - new Error("The loaded module contains errors") - ); - } - const moduleSource = referencedModule.originalSource(); - if (!moduleSource) { - return callback( - new Error( - "The module created for a LoaderDependency must have an original source" - ) - ); - } - let source, map; - if (moduleSource.sourceAndMap) { - const sourceAndMap = moduleSource.sourceAndMap(); - map = sourceAndMap.map; - source = sourceAndMap.source; - } else { - map = moduleSource.map(); - source = moduleSource.source(); - } - const fileDependencies = new LazySet(); - const contextDependencies = new LazySet(); - const missingDependencies = new LazySet(); - const buildDependencies = new LazySet(); - referencedModule.addCacheDependencies( - fileDependencies, - contextDependencies, - missingDependencies, - buildDependencies - ); - - for (const d of fileDependencies) { - loaderContext.addDependency(d); - } - for (const d of contextDependencies) { - loaderContext.addContextDependency(d); - } - for (const d of missingDependencies) { - loaderContext.addMissingDependency(d); - } - for (const d of buildDependencies) { - loaderContext.addBuildDependency(d); - } - return callback(null, source, map, referencedModule); - } - ); - }; - - /** - * @param {string} request the request string to load the module from - * @param {ImportModuleOptions=} options options - * @param {ImportModuleCallback=} callback callback returning the exports - * @returns {void} - */ - const importModule = (request, options, callback) => { - const dep = new LoaderImportDependency(request); - dep.loc = { - name: request - }; - const factory = compilation.dependencyFactories.get( - /** @type {DepConstructor} */ (dep.constructor) - ); - if (factory === undefined) { - return callback( - new Error( - `No module factory available for dependency type: ${dep.constructor.name}` - ) - ); - } - compilation.buildQueue.increaseParallelism(); - compilation.handleModuleCreation( - { - factory, - dependencies: [dep], - originModule: loaderContext._module, - contextInfo: { - issuerLayer: options.layer - }, - context: loaderContext.context, - connectOrigin: false - }, - err => { - compilation.buildQueue.decreaseParallelism(); - if (err) { - return callback(err); - } - const referencedModule = moduleGraph.getModule(dep); - if (!referencedModule) { - return callback(new Error("Cannot load the module")); - } - compilation.executeModule( - referencedModule, - { - entryOptions: { - publicPath: options.publicPath - } - }, - (err, result) => { - if (err) return callback(err); - for (const d of result.fileDependencies) { - loaderContext.addDependency(d); - } - for (const d of result.contextDependencies) { - loaderContext.addContextDependency(d); - } - for (const d of result.missingDependencies) { - loaderContext.addMissingDependency(d); - } - for (const d of result.buildDependencies) { - loaderContext.addBuildDependency(d); - } - if (result.cacheable === false) - loaderContext.cacheable(false); - for (const [name, { source, info }] of result.assets) { - const { buildInfo } = loaderContext._module; - if (!buildInfo.assets) { - buildInfo.assets = Object.create(null); - buildInfo.assetsInfo = new Map(); - } - buildInfo.assets[name] = source; - buildInfo.assetsInfo.set(name, info); - } - callback(null, result.exports); - } - ); - } - ); - }; - - /** - * @param {string} request the request string to load the module from - * @param {ImportModuleOptions} options options - * @param {ImportModuleCallback=} callback callback returning the exports - * @returns {Promise | void} exports - */ - loaderContext.importModule = (request, options, callback) => { - if (!callback) { - return new Promise((resolve, reject) => { - importModule(request, options || {}, (err, result) => { - if (err) reject(err); - else resolve(result); - }); - }); - } - return importModule(request, options || {}, callback); - }; - } - ); - }); - } -} -module.exports = LoaderPlugin; - - -/***/ }), - -/***/ 5826: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const makeSerializable = __webpack_require__(33032); - -class LocalModule { - constructor(name, idx) { - this.name = name; - this.idx = idx; - this.used = false; - } - - flagUsed() { - this.used = true; - } + getErrors(moduleGraph) { + const module = moduleGraph.getModule(this); - variableName() { - return "__WEBPACK_LOCAL_MODULE_" + this.idx + "__"; + if ( + this.onlyDirectImport && + module && + !module.type.startsWith("webassembly") + ) { + return [ + new UnsupportedWebAssemblyFeatureError( + `Import "${this.name}" from "${this.request}" with ${this.onlyDirectImport} can only be used for direct wasm to wasm dependencies` + ) + ]; + } } serialize(context) { const { write } = context; write(this.name); - write(this.idx); - write(this.used); + write(this.description); + write(this.onlyDirectImport); + + super.serialize(context); } deserialize(context) { const { read } = context; this.name = read(); - this.idx = read(); - this.used = read(); + this.description = read(); + this.onlyDirectImport = read(); + + super.deserialize(context); } } -makeSerializable(LocalModule, "webpack/lib/dependencies/LocalModule"); +makeSerializable( + WebAssemblyImportDependency, + "webpack/lib/dependencies/WebAssemblyImportDependency" +); -module.exports = LocalModule; +module.exports = WebAssemblyImportDependency; /***/ }), -/***/ 52805: +/***/ 26505: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ +const Dependency = __webpack_require__(54912); +const Template = __webpack_require__(1626); const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); +const ModuleDependency = __webpack_require__(80321); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -class LocalModuleDependency extends NullDependency { - constructor(localModule, range, callNew) { - super(); +class WebpackIsIncludedDependency extends ModuleDependency { + constructor(request, range) { + super(request); - this.localModule = localModule; + this.weak = true; this.range = range; - this.callNew = callNew; } - serialize(context) { - const { write } = context; - - write(this.localModule); - write(this.range); - write(this.callNew); - - super.serialize(context); + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + // This doesn't use any export + return Dependency.NO_EXPORTS_REFERENCED; } - deserialize(context) { - const { read } = context; - - this.localModule = read(); - this.range = read(); - this.callNew = read(); - - super.deserialize(context); + get type() { + return "__webpack_is_included__"; } } makeSerializable( - LocalModuleDependency, - "webpack/lib/dependencies/LocalModuleDependency" + WebpackIsIncludedDependency, + "webpack/lib/dependencies/WebpackIsIncludedDependency" ); -LocalModuleDependency.Template = class LocalModuleDependencyTemplate extends ( - NullDependency.Template +WebpackIsIncludedDependency.Template = class WebpackIsIncludedDependencyTemplate extends ( + ModuleDependency.Template ) { /** * @param {Dependency} dependency the dependency for which the template should be applied @@ -88723,183 +84417,91 @@ LocalModuleDependency.Template = class LocalModuleDependencyTemplate extends ( * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply(dependency, source, templateContext) { - const dep = /** @type {LocalModuleDependency} */ (dependency); - if (!dep.range) return; - const moduleInstance = dep.callNew - ? `new (function () { return ${dep.localModule.variableName()}; })()` - : dep.localModule.variableName(); - source.replace(dep.range[0], dep.range[1] - 1, moduleInstance); + apply(dependency, source, { runtimeTemplate, chunkGraph, moduleGraph }) { + const dep = /** @type {WebpackIsIncludedDependency} */ (dependency); + const connection = moduleGraph.getConnection(dep); + const included = connection + ? chunkGraph.getNumberOfModuleChunks(connection.module) > 0 + : false; + const comment = runtimeTemplate.outputOptions.pathinfo + ? Template.toComment( + `__webpack_is_included__ ${runtimeTemplate.requestShortener.shorten( + dep.request + )}` + ) + : ""; + + source.replace( + dep.range[0], + dep.range[1] - 1, + `${comment}${JSON.stringify(included)}` + ); } }; -module.exports = LocalModuleDependency; +module.exports = WebpackIsIncludedDependency; /***/ }), -/***/ 75827: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 1466: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ -const LocalModule = __webpack_require__(5826); +const Dependency = __webpack_require__(54912); +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); +const ModuleDependency = __webpack_require__(80321); -const lookup = (parent, mod) => { - if (mod.charAt(0) !== ".") return mod; +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../AsyncDependenciesBlock")} AsyncDependenciesBlock */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../Entrypoint")} Entrypoint */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - var path = parent.split("/"); - var segments = mod.split("/"); - path.pop(); +class WorkerDependency extends ModuleDependency { + /** + * @param {string} request request + * @param {[number, number]} range range + */ + constructor(request, range) { + super(request); + this.range = range; + } - for (let i = 0; i < segments.length; i++) { - const seg = segments[i]; - if (seg === "..") { - path.pop(); - } else if (seg !== ".") { - path.push(seg); - } + /** + * Returns list of exports referenced by this dependency + * @param {ModuleGraph} moduleGraph module graph + * @param {RuntimeSpec} runtime the runtime for which the module is analysed + * @returns {(string[] | ReferencedExport)[]} referenced exports + */ + getReferencedExports(moduleGraph, runtime) { + return Dependency.NO_EXPORTS_REFERENCED; } - return path.join("/"); -}; - -exports.addLocalModule = (state, name) => { - if (!state.localModules) { - state.localModules = []; - } - const m = new LocalModule(name, state.localModules.length); - state.localModules.push(m); - return m; -}; - -exports.getLocalModule = (state, name, namedModule) => { - if (!state.localModules) return null; - if (namedModule) { - // resolve dependency name relative to the defining named module - name = lookup(namedModule, name); - } - for (let i = 0; i < state.localModules.length; i++) { - if (state.localModules[i].name === name) { - return state.localModules[i]; - } - } - return null; -}; - - -/***/ }), - -/***/ 88488: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const Dependency = __webpack_require__(54912); -const InitFragment = __webpack_require__(55870); -const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - -class ModuleDecoratorDependency extends NullDependency { - /** - * @param {string} decorator the decorator requirement - * @param {boolean} allowExportsAccess allow to access exports from module - */ - constructor(decorator, allowExportsAccess) { - super(); - this.decorator = decorator; - this.allowExportsAccess = allowExportsAccess; - this._hashUpdate = undefined; - } - - /** - * @returns {string} a display name for the type of dependency - */ - get type() { - return "module decorator"; - } + get type() { + return "new Worker()"; + } get category() { - return "self"; - } - - /** - * @returns {string | null} an identifier to merge equal requests - */ - getResourceIdentifier() { - return `self`; - } - - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - return this.allowExportsAccess - ? Dependency.EXPORTS_OBJECT_REFERENCED - : Dependency.NO_EXPORTS_REFERENCED; - } - - /** - * Update the hash - * @param {Hash} hash hash to be updated - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - if (this._hashUpdate === undefined) { - this._hashUpdate = `${this.decorator}${this.allowExportsAccess}`; - } - hash.update(this._hashUpdate); - } - - serialize(context) { - const { write } = context; - write(this.decorator); - write(this.allowExportsAccess); - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - this.decorator = read(); - this.allowExportsAccess = read(); - super.deserialize(context); + return "worker"; } } -makeSerializable( - ModuleDecoratorDependency, - "webpack/lib/dependencies/ModuleDecoratorDependency" -); - -ModuleDecoratorDependency.Template = class ModuleDecoratorDependencyTemplate extends ( - NullDependency.Template +WorkerDependency.Template = class WorkerDependencyTemplate extends ( + ModuleDependency.Template ) { /** * @param {Dependency} dependency the dependency for which the template should be applied @@ -88907,33 +84509,39 @@ ModuleDecoratorDependency.Template = class ModuleDecoratorDependencyTemplate ext * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply( - dependency, - source, - { module, chunkGraph, initFragments, runtimeRequirements } - ) { - const dep = /** @type {ModuleDecoratorDependency} */ (dependency); - runtimeRequirements.add(RuntimeGlobals.moduleLoaded); - runtimeRequirements.add(RuntimeGlobals.moduleId); - runtimeRequirements.add(RuntimeGlobals.module); - runtimeRequirements.add(dep.decorator); - initFragments.push( - new InitFragment( - `/* module decorator */ ${module.moduleArgument} = ${dep.decorator}(${module.moduleArgument});\n`, - InitFragment.STAGE_PROVIDES, - 0, - `module decorator ${chunkGraph.getModuleId(module)}` - ) + apply(dependency, source, templateContext) { + const { chunkGraph, moduleGraph, runtimeRequirements } = templateContext; + const dep = /** @type {WorkerDependency} */ (dependency); + const block = /** @type {AsyncDependenciesBlock} */ ( + moduleGraph.getParentBlock(dependency) + ); + const entrypoint = /** @type {Entrypoint} */ ( + chunkGraph.getBlockChunkGroup(block) + ); + const chunk = entrypoint.getEntrypointChunk(); + + runtimeRequirements.add(RuntimeGlobals.publicPath); + runtimeRequirements.add(RuntimeGlobals.baseURI); + runtimeRequirements.add(RuntimeGlobals.getChunkScriptFilename); + + source.replace( + dep.range[0], + dep.range[1] - 1, + `/* worker import */ ${RuntimeGlobals.publicPath} + ${ + RuntimeGlobals.getChunkScriptFilename + }(${JSON.stringify(chunk.id)}), ${RuntimeGlobals.baseURI}` ); } }; -module.exports = ModuleDecoratorDependency; +makeSerializable(WorkerDependency, "webpack/lib/dependencies/WorkerDependency"); + +module.exports = WorkerDependency; /***/ }), -/***/ 80321: +/***/ 82509: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -88944,128 +84552,421 @@ module.exports = ModuleDecoratorDependency; -const Dependency = __webpack_require__(54912); -const DependencyTemplate = __webpack_require__(5160); -const memoize = __webpack_require__(78676); +const { pathToFileURL } = __webpack_require__(57310); +const AsyncDependenciesBlock = __webpack_require__(47736); +const CommentCompilationWarning = __webpack_require__(98427); +const UnsupportedFeatureWarning = __webpack_require__(42495); +const EnableChunkLoadingPlugin = __webpack_require__(61291); +const { equals } = __webpack_require__(84953); +const createHash = __webpack_require__(49835); +const { contextify } = __webpack_require__(82186); +const EnableWasmLoadingPlugin = __webpack_require__(78613); +const ConstDependency = __webpack_require__(76911); +const CreateScriptUrlDependency = __webpack_require__(79062); +const { + harmonySpecifierTag +} = __webpack_require__(20862); +const WorkerDependency = __webpack_require__(1466); -/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ -/** @typedef {import("../Module")} Module */ +/** @typedef {import("estree").Expression} Expression */ +/** @typedef {import("estree").ObjectExpression} ObjectExpression */ +/** @typedef {import("estree").Pattern} Pattern */ +/** @typedef {import("estree").Property} Property */ +/** @typedef {import("estree").SpreadElement} SpreadElement */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Entrypoint").EntryOptions} EntryOptions */ +/** @typedef {import("../Parser").ParserState} ParserState */ +/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */ +/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ +/** @typedef {import("./HarmonyImportDependencyParserPlugin").HarmonySettings} HarmonySettings */ -const getRawModule = memoize(() => __webpack_require__(84929)); +const getUrl = module => { + return pathToFileURL(module.resource).toString(); +}; -class ModuleDependency extends Dependency { - /** - * @param {string} request request path which needs resolving - */ - constructor(request) { - super(); - this.request = request; - this.userRequest = request; - this.range = undefined; - // assertions must be serialized by subclasses that use it - /** @type {Record | undefined} */ - this.assertions = undefined; - } +const DEFAULT_SYNTAX = [ + "Worker", + "SharedWorker", + "navigator.serviceWorker.register()", + "Worker from worker_threads" +]; - /** - * @returns {string | null} an identifier to merge equal requests - */ - getResourceIdentifier() { - let str = `module${this.request}`; - if (this.assertions !== undefined) { - str += JSON.stringify(this.assertions); - } - return str; - } +/** @type {WeakMap} */ +const workerIndexMap = new WeakMap(); - /** - * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module - */ - couldAffectReferencingModule() { - return true; +class WorkerPlugin { + constructor(chunkLoading, wasmLoading, module) { + this._chunkLoading = chunkLoading; + this._wasmLoading = wasmLoading; + this._module = module; } - /** - * @param {string} context context directory - * @returns {Module} a module + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - createIgnoredModule(context) { - const RawModule = getRawModule(); - return new RawModule( - "/* (ignored) */", - `ignored|${context}|${this.request}`, - `${this.request} (ignored)` + apply(compiler) { + if (this._chunkLoading) { + new EnableChunkLoadingPlugin(this._chunkLoading).apply(compiler); + } + if (this._wasmLoading) { + new EnableWasmLoadingPlugin(this._wasmLoading).apply(compiler); + } + const cachedContextify = contextify.bindContextCache( + compiler.context, + compiler.root ); - } - - serialize(context) { - const { write } = context; - write(this.request); - write(this.userRequest); - write(this.range); - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - this.request = read(); - this.userRequest = read(); - this.range = read(); - super.deserialize(context); - } -} - -ModuleDependency.Template = DependencyTemplate; - -module.exports = ModuleDependency; + compiler.hooks.thisCompilation.tap( + "WorkerPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + WorkerDependency, + normalModuleFactory + ); + compilation.dependencyTemplates.set( + WorkerDependency, + new WorkerDependency.Template() + ); + compilation.dependencyTemplates.set( + CreateScriptUrlDependency, + new CreateScriptUrlDependency.Template() + ); + /** + * @param {JavascriptParser} parser the parser + * @param {Expression} expr expression + * @returns {[BasicEvaluatedExpression, [number, number]]} parsed + */ + const parseModuleUrl = (parser, expr) => { + if ( + expr.type !== "NewExpression" || + expr.callee.type === "Super" || + expr.arguments.length !== 2 + ) + return; + const [arg1, arg2] = expr.arguments; + if (arg1.type === "SpreadElement") return; + if (arg2.type === "SpreadElement") return; + const callee = parser.evaluateExpression(expr.callee); + if (!callee.isIdentifier() || callee.identifier !== "URL") return; + const arg2Value = parser.evaluateExpression(arg2); + if ( + !arg2Value.isString() || + !arg2Value.string.startsWith("file://") || + arg2Value.string !== getUrl(parser.state.module) + ) { + return; + } + const arg1Value = parser.evaluateExpression(arg1); + return [arg1Value, [arg1.range[0], arg2.range[1]]]; + }; -/***/ }), + /** + * @param {JavascriptParser} parser the parser + * @param {ObjectExpression} expr expression + * @returns {{ expressions: Record, otherElements: (Property | SpreadElement)[], values: Record, spread: boolean, insertType: "comma" | "single", insertLocation: number }} parsed object + */ + const parseObjectExpression = (parser, expr) => { + /** @type {Record} */ + const values = {}; + /** @type {Record} */ + const expressions = {}; + /** @type {(Property | SpreadElement)[]} */ + const otherElements = []; + let spread = false; + for (const prop of expr.properties) { + if (prop.type === "SpreadElement") { + spread = true; + } else if ( + prop.type === "Property" && + !prop.method && + !prop.computed && + prop.key.type === "Identifier" + ) { + expressions[prop.key.name] = prop.value; + if (!prop.shorthand && !prop.value.type.endsWith("Pattern")) { + const value = parser.evaluateExpression( + /** @type {Expression} */ (prop.value) + ); + if (value.isCompileTimeValue()) + values[prop.key.name] = value.asCompileTimeValue(); + } + } else { + otherElements.push(prop); + } + } + const insertType = expr.properties.length > 0 ? "comma" : "single"; + const insertLocation = + expr.properties[expr.properties.length - 1].range[1]; + return { + expressions, + otherElements, + values, + spread, + insertType, + insertLocation + }; + }; -/***/ 80825: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * @param {JavascriptParser} parser the parser + * @param {object} parserOptions options + */ + const parserPlugin = (parser, parserOptions) => { + if (parserOptions.worker === false) return; + const options = !Array.isArray(parserOptions.worker) + ? ["..."] + : parserOptions.worker; + const handleNewWorker = expr => { + if (expr.arguments.length === 0 || expr.arguments.length > 2) + return; + const [arg1, arg2] = expr.arguments; + if (arg1.type === "SpreadElement") return; + if (arg2 && arg2.type === "SpreadElement") return; + const parsedUrl = parseModuleUrl(parser, arg1); + if (!parsedUrl) return; + const [url, range] = parsedUrl; + if (!url.isString()) return; + const { + expressions, + otherElements, + values: options, + spread: hasSpreadInOptions, + insertType, + insertLocation + } = arg2 && arg2.type === "ObjectExpression" + ? parseObjectExpression(parser, arg2) + : { + expressions: {}, + otherElements: [], + values: {}, + spread: false, + insertType: arg2 ? "spread" : "argument", + insertLocation: arg2 ? arg2.range : arg1.range[1] + }; + const { options: importOptions, errors: commentErrors } = + parser.parseCommentOptions(expr.range); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (commentErrors) { + for (const e of commentErrors) { + const { comment } = e; + parser.state.module.addWarning( + new CommentCompilationWarning( + `Compilation error while processing magic comment(-s): /*${comment.value}*/: ${e.message}`, + comment.loc + ) + ); + } + } + /** @type {EntryOptions} */ + let entryOptions = {}; + if (importOptions) { + if (importOptions.webpackIgnore !== undefined) { + if (typeof importOptions.webpackIgnore !== "boolean") { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackIgnore\` expected a boolean, but received: ${importOptions.webpackIgnore}.`, + expr.loc + ) + ); + } else { + if (importOptions.webpackIgnore) { + return false; + } + } + } + if (importOptions.webpackEntryOptions !== undefined) { + if ( + typeof importOptions.webpackEntryOptions !== "object" || + importOptions.webpackEntryOptions === null + ) { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackEntryOptions\` expected a object, but received: ${importOptions.webpackEntryOptions}.`, + expr.loc + ) + ); + } else { + Object.assign( + entryOptions, + importOptions.webpackEntryOptions + ); + } + } + if (importOptions.webpackChunkName !== undefined) { + if (typeof importOptions.webpackChunkName !== "string") { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackChunkName\` expected a string, but received: ${importOptions.webpackChunkName}.`, + expr.loc + ) + ); + } else { + entryOptions.name = importOptions.webpackChunkName; + } + } + } -const ModuleDependency = __webpack_require__(80321); + if ( + !Object.prototype.hasOwnProperty.call(entryOptions, "name") && + options && + typeof options.name === "string" + ) { + entryOptions.name = options.name; + } -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + if (entryOptions.runtime === undefined) { + let i = workerIndexMap.get(parser.state) || 0; + workerIndexMap.set(parser.state, i + 1); + let name = `${cachedContextify( + parser.state.module.identifier() + )}|${i}`; + const hash = createHash(compilation.outputOptions.hashFunction); + hash.update(name); + const digest = /** @type {string} */ ( + hash.digest(compilation.outputOptions.hashDigest) + ); + entryOptions.runtime = digest.slice( + 0, + compilation.outputOptions.hashDigestLength + ); + } -class ModuleDependencyTemplateAsId extends ModuleDependency.Template { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, { runtimeTemplate, moduleGraph, chunkGraph }) { - const dep = /** @type {ModuleDependency} */ (dependency); - if (!dep.range) return; - const content = runtimeTemplate.moduleId({ - module: moduleGraph.getModule(dep), - chunkGraph, - request: dep.request, - weak: dep.weak - }); - source.replace(dep.range[0], dep.range[1] - 1, content); + const block = new AsyncDependenciesBlock({ + name: entryOptions.name, + entryOptions: { + chunkLoading: this._chunkLoading, + wasmLoading: this._wasmLoading, + ...entryOptions + } + }); + block.loc = expr.loc; + const dep = new WorkerDependency(url.string, range); + dep.loc = expr.loc; + block.addDependency(dep); + parser.state.module.addBlock(block); + + if (compilation.outputOptions.trustedTypes) { + const dep = new CreateScriptUrlDependency( + expr.arguments[0].range + ); + dep.loc = expr.loc; + parser.state.module.addDependency(dep); + } + + if (expressions.type) { + const expr = expressions.type; + if (options.type !== false) { + const dep = new ConstDependency( + this._module ? '"module"' : "undefined", + expr.range + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + expressions.type = undefined; + } + } else if (insertType === "comma") { + if (this._module || hasSpreadInOptions) { + const dep = new ConstDependency( + `, type: ${this._module ? '"module"' : "undefined"}`, + insertLocation + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + } + } else if (insertType === "spread") { + const dep1 = new ConstDependency( + "Object.assign({}, ", + insertLocation[0] + ); + const dep2 = new ConstDependency( + `, { type: ${this._module ? '"module"' : "undefined"} })`, + insertLocation[1] + ); + dep1.loc = expr.loc; + dep2.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep1); + parser.state.module.addPresentationalDependency(dep2); + } else if (insertType === "argument") { + if (this._module) { + const dep = new ConstDependency( + ', { type: "module" }', + insertLocation + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + } + } + + parser.walkExpression(expr.callee); + for (const key of Object.keys(expressions)) { + if (expressions[key]) parser.walkExpression(expressions[key]); + } + for (const prop of otherElements) { + parser.walkProperty(prop); + } + if (insertType === "spread") { + parser.walkExpression(arg2); + } + + return true; + }; + const processItem = item => { + if (item.endsWith("()")) { + parser.hooks.call + .for(item.slice(0, -2)) + .tap("WorkerPlugin", handleNewWorker); + } else { + const match = /^(.+?)(\(\))?\s+from\s+(.+)$/.exec(item); + if (match) { + const ids = match[1].split("."); + const call = match[2]; + const source = match[3]; + (call ? parser.hooks.call : parser.hooks.new) + .for(harmonySpecifierTag) + .tap("WorkerPlugin", expr => { + const settings = /** @type {HarmonySettings} */ ( + parser.currentTagData + ); + if ( + !settings || + settings.source !== source || + !equals(settings.ids, ids) + ) { + return; + } + return handleNewWorker(expr); + }); + } else { + parser.hooks.new.for(item).tap("WorkerPlugin", handleNewWorker); + } + } + }; + for (const item of options) { + if (item === "...") { + DEFAULT_SYNTAX.forEach(processItem); + } else processItem(item); + } + }; + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("WorkerPlugin", parserPlugin); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("WorkerPlugin", parserPlugin); + } + ); } } - -module.exports = ModuleDependencyTemplateAsId; +module.exports = WorkerPlugin; /***/ }), -/***/ 36873: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 50396: +/***/ (function(module) { "use strict"; /* @@ -89075,42 +84976,59 @@ module.exports = ModuleDependencyTemplateAsId; -const ModuleDependency = __webpack_require__(80321); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +module.exports = expr => { + // + if ( + expr.type === "FunctionExpression" || + expr.type === "ArrowFunctionExpression" + ) { + return { + fn: expr, + expressions: [], + needThis: false + }; + } -class ModuleDependencyTemplateAsRequireId extends ModuleDependency.Template { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply( - dependency, - source, - { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } + // .bind() + if ( + expr.type === "CallExpression" && + expr.callee.type === "MemberExpression" && + expr.callee.object.type === "FunctionExpression" && + expr.callee.property.type === "Identifier" && + expr.callee.property.name === "bind" && + expr.arguments.length === 1 ) { - const dep = /** @type {ModuleDependency} */ (dependency); - if (!dep.range) return; - const content = runtimeTemplate.moduleExports({ - module: moduleGraph.getModule(dep), - chunkGraph, - request: dep.request, - weak: dep.weak, - runtimeRequirements - }); - source.replace(dep.range[0], dep.range[1] - 1, content); + return { + fn: expr.callee.object, + expressions: [expr.arguments[0]], + needThis: undefined + }; } -} -module.exports = ModuleDependencyTemplateAsRequireId; + // (function(_this) {return })(this) (Coffeescript) + if ( + expr.type === "CallExpression" && + expr.callee.type === "FunctionExpression" && + expr.callee.body.type === "BlockStatement" && + expr.arguments.length === 1 && + expr.arguments[0].type === "ThisExpression" && + expr.callee.body.body && + expr.callee.body.body.length === 1 && + expr.callee.body.body[0].type === "ReturnStatement" && + expr.callee.body.body[0].argument && + expr.callee.body.body[0].argument.type === "FunctionExpression" + ) { + return { + fn: expr.callee.body.body[0].argument, + expressions: [], + needThis: true + }; + } +}; /***/ }), -/***/ 47511: +/***/ 55207: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -89121,39 +85039,69 @@ module.exports = ModuleDependencyTemplateAsRequireId; -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); -const ModuleDependencyTemplateAsId = __webpack_require__(80825); +const { UsageState } = __webpack_require__(63686); -class ModuleHotAcceptDependency extends ModuleDependency { - constructor(request, range) { - super(request); - this.range = range; - this.weak = true; - } +/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - get type() { - return "module.hot.accept"; +/** + * @param {RuntimeSpec} runtime the runtime + * @param {string[][]} referencedExports list of referenced exports, will be added to + * @param {string[]} prefix export prefix + * @param {ExportInfo=} exportInfo the export info + * @param {boolean} defaultPointsToSelf when true, using default will reference itself + * @param {Set} alreadyVisited already visited export info (to handle circular reexports) + */ +const processExportInfo = ( + runtime, + referencedExports, + prefix, + exportInfo, + defaultPointsToSelf = false, + alreadyVisited = new Set() +) => { + if (!exportInfo) { + referencedExports.push(prefix); + return; } - - get category() { - return "commonjs"; + const used = exportInfo.getUsed(runtime); + if (used === UsageState.Unused) return; + if (alreadyVisited.has(exportInfo)) { + referencedExports.push(prefix); + return; } -} - -makeSerializable( - ModuleHotAcceptDependency, - "webpack/lib/dependencies/ModuleHotAcceptDependency" -); - -ModuleHotAcceptDependency.Template = ModuleDependencyTemplateAsId; - -module.exports = ModuleHotAcceptDependency; + alreadyVisited.add(exportInfo); + if ( + used !== UsageState.OnlyPropertiesUsed || + !exportInfo.exportsInfo || + exportInfo.exportsInfo.otherExportsInfo.getUsed(runtime) !== + UsageState.Unused + ) { + alreadyVisited.delete(exportInfo); + referencedExports.push(prefix); + return; + } + const exportsInfo = exportInfo.exportsInfo; + for (const exportInfo of exportsInfo.orderedExports) { + processExportInfo( + runtime, + referencedExports, + defaultPointsToSelf && exportInfo.name === "default" + ? prefix + : prefix.concat(exportInfo.name), + exportInfo, + false, + alreadyVisited + ); + } + alreadyVisited.delete(exportInfo); +}; +module.exports = processExportInfo; /***/ }), -/***/ 86301: +/***/ 32277: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -89164,40 +85112,72 @@ module.exports = ModuleHotAcceptDependency; -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); -const ModuleDependencyTemplateAsId = __webpack_require__(80825); - -class ModuleHotDeclineDependency extends ModuleDependency { - constructor(request, range) { - super(request); +const ExternalsPlugin = __webpack_require__(6652); - this.range = range; - this.weak = true; - } +/** @typedef {import("../Compiler")} Compiler */ - get type() { - return "module.hot.decline"; +class ElectronTargetPlugin { + /** + * @param {"main" | "preload" | "renderer"=} context in main, preload or renderer context? + */ + constructor(context) { + this._context = context; } - - get category() { - return "commonjs"; + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + new ExternalsPlugin("node-commonjs", [ + "clipboard", + "crash-reporter", + "electron", + "ipc", + "native-image", + "original-fs", + "screen", + "shell" + ]).apply(compiler); + switch (this._context) { + case "main": + new ExternalsPlugin("node-commonjs", [ + "app", + "auto-updater", + "browser-window", + "content-tracing", + "dialog", + "global-shortcut", + "ipc-main", + "menu", + "menu-item", + "power-monitor", + "power-save-blocker", + "protocol", + "session", + "tray", + "web-contents" + ]).apply(compiler); + break; + case "preload": + case "renderer": + new ExternalsPlugin("node-commonjs", [ + "desktop-capturer", + "ipc-renderer", + "remote", + "web-frame" + ]).apply(compiler); + break; + } } } -makeSerializable( - ModuleHotDeclineDependency, - "webpack/lib/dependencies/ModuleHotDeclineDependency" -); - -ModuleHotDeclineDependency.Template = ModuleDependencyTemplateAsId; - -module.exports = ModuleHotDeclineDependency; +module.exports = ElectronTargetPlugin; /***/ }), -/***/ 31830: +/***/ 22273: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -89208,206 +85188,278 @@ module.exports = ModuleHotDeclineDependency; -const Dependency = __webpack_require__(54912); -const DependencyTemplate = __webpack_require__(5160); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +const WebpackError = __webpack_require__(53799); -class NullDependency extends Dependency { - get type() { - return "null"; - } +/** @typedef {import("../Module")} Module */ +class BuildCycleError extends WebpackError { /** - * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + * Creates an instance of ModuleDependencyError. + * @param {Module} module the module starting the cycle */ - couldAffectReferencingModule() { - return false; + constructor(module) { + super( + "There is a circular build dependency, which makes it impossible to create this module" + ); + + this.name = "BuildCycleError"; + this.module = module; } } -NullDependency.Template = class NullDependencyTemplate extends ( - DependencyTemplate -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, templateContext) {} -}; - -module.exports = NullDependency; +module.exports = BuildCycleError; /***/ }), -/***/ 31618: +/***/ 5294: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const ModuleDependency = __webpack_require__(80321); +const RuntimeModule = __webpack_require__(16963); -class PrefetchDependency extends ModuleDependency { - constructor(request) { - super(request); +class ExportWebpackRequireRuntimeModule extends RuntimeModule { + constructor() { + super("export webpack runtime", RuntimeModule.STAGE_ATTACH); } - get type() { - return "prefetch"; + /** + * @returns {boolean} true, if the runtime module should get it's own scope + */ + shouldIsolate() { + return false; } - get category() { - return "esm"; + /** + * @returns {string} runtime code + */ + generate() { + return "export default __webpack_require__;"; } } -module.exports = PrefetchDependency; +module.exports = ExportWebpackRequireRuntimeModule; /***/ }), -/***/ 95770: +/***/ 68927: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent + Author Tobias Koppers @sokra */ -const InitFragment = __webpack_require__(55870); -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("../util/Hash")} Hash */ - -/** - * @param {string[]|null} path the property path array - * @returns {string} the converted path - */ -const pathToString = path => - path !== null && path.length > 0 - ? path.map(part => `[${JSON.stringify(part)}]`).join("") - : ""; - -class ProvidedDependency extends ModuleDependency { - constructor(request, identifier, path, range) { - super(request); - this.identifier = identifier; - this.path = path; - this.range = range; - this._hashUpdate = undefined; - } - - get type() { - return "provided"; - } +const { ConcatSource } = __webpack_require__(51255); +const { RuntimeGlobals } = __webpack_require__(91919); +const HotUpdateChunk = __webpack_require__(9597); +const Template = __webpack_require__(1626); +const { getAllChunks } = __webpack_require__(91145); +const { + getCompilationHooks, + getChunkFilenameTemplate +} = __webpack_require__(89464); +const { updateHashForEntryStartup } = __webpack_require__(98124); - get category() { - return "esm"; - } +/** @typedef {import("../Compiler")} Compiler */ +class ModuleChunkFormatPlugin { /** - * Update the hash - * @param {Hash} hash hash to be updated - * @param {UpdateHashContext} context context + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - updateHash(hash, context) { - if (this._hashUpdate === undefined) { - this._hashUpdate = - this.identifier + (this.path ? this.path.join(",") : "null"); - } - hash.update(this._hashUpdate); - } + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "ModuleChunkFormatPlugin", + compilation => { + compilation.hooks.additionalChunkRuntimeRequirements.tap( + "ModuleChunkFormatPlugin", + (chunk, set) => { + if (chunk.hasRuntime()) return; + if (compilation.chunkGraph.getNumberOfEntryModules(chunk) > 0) { + set.add(RuntimeGlobals.require); + set.add(RuntimeGlobals.startupEntrypoint); + set.add(RuntimeGlobals.externalInstallChunk); + } + } + ); + const hooks = getCompilationHooks(compilation); + hooks.renderChunk.tap( + "ModuleChunkFormatPlugin", + (modules, renderContext) => { + const { chunk, chunkGraph, runtimeTemplate } = renderContext; + const hotUpdateChunk = + chunk instanceof HotUpdateChunk ? chunk : null; + const source = new ConcatSource(); + if (hotUpdateChunk) { + throw new Error( + "HMR is not implemented for module chunk format yet" + ); + } else { + source.add(`export const id = ${JSON.stringify(chunk.id)};\n`); + source.add(`export const ids = ${JSON.stringify(chunk.ids)};\n`); + source.add(`export const modules = `); + source.add(modules); + source.add(`;\n`); + const runtimeModules = + chunkGraph.getChunkRuntimeModulesInOrder(chunk); + if (runtimeModules.length > 0) { + source.add("export const runtime =\n"); + source.add( + Template.renderChunkRuntimeModules( + runtimeModules, + renderContext + ) + ); + } + const entries = Array.from( + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ); + if (entries.length > 0) { + const runtimeChunk = entries[0][1].getRuntimeChunk(); + const currentOutputName = compilation + .getPath( + getChunkFilenameTemplate(chunk, compilation.outputOptions), + { + chunk, + contentHashType: "javascript" + } + ) + .split("/"); - serialize(context) { - const { write } = context; - write(this.identifier); - write(this.path); - super.serialize(context); - } + // remove filename, we only need the directory + currentOutputName.pop(); - deserialize(context) { - const { read } = context; - this.identifier = read(); - this.path = read(); - super.deserialize(context); - } -} + const getRelativePath = chunk => { + const baseOutputName = currentOutputName.slice(); + const chunkOutputName = compilation + .getPath( + getChunkFilenameTemplate( + chunk, + compilation.outputOptions + ), + { + chunk: chunk, + contentHashType: "javascript" + } + ) + .split("/"); -makeSerializable( - ProvidedDependency, - "webpack/lib/dependencies/ProvidedDependency" -); + // remove common parts + while ( + baseOutputName.length > 0 && + chunkOutputName.length > 0 && + baseOutputName[0] === chunkOutputName[0] + ) { + baseOutputName.shift(); + chunkOutputName.shift(); + } + // create final path + return ( + (baseOutputName.length > 0 + ? "../".repeat(baseOutputName.length) + : "./") + chunkOutputName.join("/") + ); + }; -class ProvidedDependencyTemplate extends ModuleDependency.Template { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply( - dependency, - source, - { - runtimeTemplate, - moduleGraph, - chunkGraph, - initFragments, - runtimeRequirements - } - ) { - const dep = /** @type {ProvidedDependency} */ (dependency); - initFragments.push( - new InitFragment( - `/* provided dependency */ var ${ - dep.identifier - } = ${runtimeTemplate.moduleExports({ - module: moduleGraph.getModule(dep), - chunkGraph, - request: dep.request, - runtimeRequirements - })}${pathToString(dep.path)};\n`, - InitFragment.STAGE_PROVIDES, - 1, - `provided ${dep.identifier}` - ) + const entrySource = new ConcatSource(); + entrySource.add(source); + entrySource.add(";\n\n// load runtime\n"); + entrySource.add( + `import __webpack_require__ from ${JSON.stringify( + getRelativePath(runtimeChunk) + )};\n` + ); + + const startupSource = new ConcatSource(); + startupSource.add( + `var __webpack_exec__ = ${runtimeTemplate.returningFunction( + `__webpack_require__(${RuntimeGlobals.entryModuleId} = moduleId)`, + "moduleId" + )}\n` + ); + + const loadedChunks = new Set(); + let index = 0; + for (let i = 0; i < entries.length; i++) { + const [module, entrypoint] = entries[i]; + const final = i + 1 === entries.length; + const moduleId = chunkGraph.getModuleId(module); + const chunks = getAllChunks( + entrypoint, + runtimeChunk, + undefined + ); + for (const chunk of chunks) { + if (loadedChunks.has(chunk)) continue; + loadedChunks.add(chunk); + startupSource.add( + `import * as __webpack_chunk_${index}__ from ${JSON.stringify( + getRelativePath(chunk) + )};\n` + ); + startupSource.add( + `${RuntimeGlobals.externalInstallChunk}(__webpack_chunk_${index}__);\n` + ); + index++; + } + startupSource.add( + `${ + final ? "var __webpack_exports__ = " : "" + }__webpack_exec__(${JSON.stringify(moduleId)});\n` + ); + } + + entrySource.add( + hooks.renderStartup.call( + startupSource, + entries[entries.length - 1][0], + { + ...renderContext, + inlined: false + } + ) + ); + return entrySource; + } + } + return source; + } + ); + hooks.chunkHash.tap( + "ModuleChunkFormatPlugin", + (chunk, hash, { chunkGraph, runtimeTemplate }) => { + if (chunk.hasRuntime()) return; + hash.update("ModuleChunkFormatPlugin"); + hash.update("1"); + const entries = Array.from( + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ); + updateHashForEntryStartup(hash, chunkGraph, entries, chunk); + } + ); + } ); - source.replace(dep.range[0], dep.range[1] - 1, dep.identifier); } } -ProvidedDependency.Template = ProvidedDependencyTemplate; - -module.exports = ProvidedDependency; +module.exports = ModuleChunkFormatPlugin; /***/ }), -/***/ 55799: +/***/ 89831: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -89418,188 +85470,315 @@ module.exports = ProvidedDependency; -const { UsageState } = __webpack_require__(63686); -const makeSerializable = __webpack_require__(33032); -const { filterRuntime } = __webpack_require__(17156); -const NullDependency = __webpack_require__(31830); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../util/Hash")} Hash */ - -class PureExpressionDependency extends NullDependency { - /** - * @param {[number, number]} range the source range - */ - constructor(range) { - super(); - this.range = range; - /** @type {Set | false} */ - this.usedByExports = false; - this._hashUpdate = undefined; - } - - /** - * Update the hash - * @param {Hash} hash hash to be updated - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - if (this._hashUpdate === undefined) { - this._hashUpdate = this.range + ""; - } - hash.update(this._hashUpdate); - } - - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this dependency connects the module to referencing modules - */ - getModuleEvaluationSideEffectsState(moduleGraph) { - return false; - } - - serialize(context) { - const { write } = context; - write(this.range); - write(this.usedByExports); - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - this.range = read(); - this.usedByExports = read(); - super.deserialize(context); - } -} +const RuntimeGlobals = __webpack_require__(16475); +const ExportWebpackRequireRuntimeModule = __webpack_require__(5294); +const ModuleChunkLoadingRuntimeModule = __webpack_require__(64747); -makeSerializable( - PureExpressionDependency, - "webpack/lib/dependencies/PureExpressionDependency" -); +/** @typedef {import("../Compiler")} Compiler */ -PureExpressionDependency.Template = class PureExpressionDependencyTemplate extends ( - NullDependency.Template -) { +class ModuleChunkLoadingPlugin { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply( - dependency, - source, - { chunkGraph, moduleGraph, runtime, runtimeTemplate, runtimeRequirements } - ) { - const dep = /** @type {PureExpressionDependency} */ (dependency); + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "ModuleChunkLoadingPlugin", + compilation => { + const globalChunkLoading = compilation.outputOptions.chunkLoading; + const isEnabledForChunk = chunk => { + const options = chunk.getEntryOptions(); + const chunkLoading = + (options && options.chunkLoading) || globalChunkLoading; + return chunkLoading === "import"; + }; + const onceForChunkSet = new WeakSet(); + const handler = (chunk, set) => { + if (onceForChunkSet.has(chunk)) return; + onceForChunkSet.add(chunk); + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + set.add(RuntimeGlobals.hasOwnProperty); + compilation.addRuntimeModule( + chunk, + new ModuleChunkLoadingRuntimeModule(set) + ); + }; + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("ModuleChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.baseURI) + .tap("ModuleChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.externalInstallChunk) + .tap("ModuleChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.onChunksLoaded) + .tap("ModuleChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.externalInstallChunk) + .tap("ModuleChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + compilation.addRuntimeModule( + chunk, + new ExportWebpackRequireRuntimeModule() + ); + }); - const usedByExports = dep.usedByExports; - if (usedByExports !== false) { - const selfModule = moduleGraph.getParentModule(dep); - const exportsInfo = moduleGraph.getExportsInfo(selfModule); - const runtimeCondition = filterRuntime(runtime, runtime => { - for (const exportName of usedByExports) { - if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) { - return true; - } - } - return false; - }); - if (runtimeCondition === true) return; - if (runtimeCondition !== false) { - const condition = runtimeTemplate.runtimeConditionExpression({ - chunkGraph, - runtime, - runtimeCondition, - runtimeRequirements - }); - source.insert( - dep.range[0], - `(/* runtime-dependent pure expression or super */ ${condition} ? (` - ); - source.insert(dep.range[1], ") : null)"); - return; + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("ModuleChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.getChunkScriptFilename); + }); } - } - - source.insert( - dep.range[0], - `(/* unused pure expression or super */ null && (` ); - source.insert(dep.range[1], "))"); } -}; +} -module.exports = PureExpressionDependency; +module.exports = ModuleChunkLoadingPlugin; /***/ }), -/***/ 46917: +/***/ 64747: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const makeSerializable = __webpack_require__(33032); -const ContextDependency = __webpack_require__(88101); -const ModuleDependencyTemplateAsRequireId = __webpack_require__(36873); - -class RequireContextDependency extends ContextDependency { - constructor(options, range) { - super(options); - - this.range = range; - } +const { SyncWaterfallHook } = __webpack_require__(6967); +const Compilation = __webpack_require__(85720); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); +const { + getChunkFilenameTemplate, + chunkHasJs +} = __webpack_require__(89464); +const { getInitialChunkIds } = __webpack_require__(98124); +const compileBooleanMatcher = __webpack_require__(29404); +const { getUndoPath } = __webpack_require__(82186); - get type() { - return "require.context"; - } +/** @typedef {import("../Chunk")} Chunk */ - serialize(context) { - const { write } = context; +/** + * @typedef {Object} JsonpCompilationPluginHooks + * @property {SyncWaterfallHook<[string, Chunk]>} linkPreload + * @property {SyncWaterfallHook<[string, Chunk]>} linkPrefetch + */ - write(this.range); +/** @type {WeakMap} */ +const compilationHooksMap = new WeakMap(); - super.serialize(context); +class ModuleChunkLoadingRuntimeModule extends RuntimeModule { + /** + * @param {Compilation} compilation the compilation + * @returns {JsonpCompilationPluginHooks} hooks + */ + static getCompilationHooks(compilation) { + if (!(compilation instanceof Compilation)) { + throw new TypeError( + "The 'compilation' argument must be an instance of Compilation" + ); + } + let hooks = compilationHooksMap.get(compilation); + if (hooks === undefined) { + hooks = { + linkPreload: new SyncWaterfallHook(["source", "chunk"]), + linkPrefetch: new SyncWaterfallHook(["source", "chunk"]) + }; + compilationHooksMap.set(compilation, hooks); + } + return hooks; } - deserialize(context) { - const { read } = context; - - this.range = read(); - - super.deserialize(context); + constructor(runtimeRequirements) { + super("import chunk loading", RuntimeModule.STAGE_ATTACH); + this._runtimeRequirements = runtimeRequirements; } -} -makeSerializable( - RequireContextDependency, - "webpack/lib/dependencies/RequireContextDependency" -); + /** + * @returns {string} runtime code + */ + generate() { + const { compilation, chunk } = this; + const { + runtimeTemplate, + chunkGraph, + outputOptions: { importFunctionName, importMetaName } + } = compilation; + const fn = RuntimeGlobals.ensureChunkHandlers; + const withBaseURI = this._runtimeRequirements.has(RuntimeGlobals.baseURI); + const withExternalInstallChunk = this._runtimeRequirements.has( + RuntimeGlobals.externalInstallChunk + ); + const withLoading = this._runtimeRequirements.has( + RuntimeGlobals.ensureChunkHandlers + ); + const withOnChunkLoad = this._runtimeRequirements.has( + RuntimeGlobals.onChunksLoaded + ); + const withHmr = this._runtimeRequirements.has( + RuntimeGlobals.hmrDownloadUpdateHandlers + ); + const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs); + const hasJsMatcher = compileBooleanMatcher(conditionMap); + const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); -RequireContextDependency.Template = ModuleDependencyTemplateAsRequireId; + const outputName = this.compilation.getPath( + getChunkFilenameTemplate(chunk, this.compilation.outputOptions), + { + chunk, + contentHashType: "javascript" + } + ); + const rootOutputDir = getUndoPath( + outputName, + this.compilation.outputOptions.path, + true + ); -module.exports = RequireContextDependency; + const stateExpression = withHmr + ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_module` + : undefined; + + return Template.asString([ + withBaseURI + ? Template.asString([ + `${RuntimeGlobals.baseURI} = new URL(${JSON.stringify( + rootOutputDir + )}, ${importMetaName}.url);` + ]) + : "// no baseURI", + "", + "// object to store loaded and loading chunks", + "// undefined = chunk not loaded, null = chunk preloaded/prefetched", + "// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded", + `var installedChunks = ${ + stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" + }{`, + Template.indent( + Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join( + ",\n" + ) + ), + "};", + "", + withLoading || withExternalInstallChunk + ? `var installChunk = ${runtimeTemplate.basicFunction("data", [ + runtimeTemplate.destructureObject( + ["ids", "modules", "runtime"], + "data" + ), + '// add "modules" to the modules object,', + '// then flag all "ids" as loaded and fire callback', + "var moduleId, chunkId, i = 0;", + "for(moduleId in modules) {", + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(modules, moduleId)) {`, + Template.indent( + `${RuntimeGlobals.moduleFactories}[moduleId] = modules[moduleId];` + ), + "}" + ]), + "}", + "if(runtime) runtime(__webpack_require__);", + "for(;i < ids.length; i++) {", + Template.indent([ + "chunkId = ids[i];", + `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) && installedChunks[chunkId]) {`, + Template.indent("installedChunks[chunkId][0]();"), + "}", + "installedChunks[ids[i]] = 0;" + ]), + "}", + withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : "" + ])}` + : "// no install chunk", + "", + withLoading + ? Template.asString([ + `${fn}.j = ${runtimeTemplate.basicFunction( + "chunkId, promises", + hasJsMatcher !== false + ? Template.indent([ + "// import() chunk loading for javascript", + `var installedChunkData = ${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;`, + 'if(installedChunkData !== 0) { // 0 means "already installed".', + Template.indent([ + "", + '// a Promise means "currently loading".', + "if(installedChunkData) {", + Template.indent([ + "promises.push(installedChunkData[1]);" + ]), + "} else {", + Template.indent([ + hasJsMatcher === true + ? "if(true) { // all chunks have JS" + : `if(${hasJsMatcher("chunkId")}) {`, + Template.indent([ + "// setup Promise in chunk cache", + `var promise = ${importFunctionName}(${JSON.stringify( + rootOutputDir + )} + ${ + RuntimeGlobals.getChunkScriptFilename + }(chunkId)).then(installChunk, ${runtimeTemplate.basicFunction( + "e", + [ + "if(installedChunks[chunkId] !== 0) installedChunks[chunkId] = undefined;", + "throw e;" + ] + )});`, + `var promise = Promise.race([promise, new Promise(${runtimeTemplate.expressionFunction( + `installedChunkData = installedChunks[chunkId] = [resolve]`, + "resolve" + )})])`, + `promises.push(installedChunkData[1] = promise);` + ]), + "} else installedChunks[chunkId] = 0;" + ]), + "}" + ]), + "}" + ]) + : Template.indent(["installedChunks[chunkId] = 0;"]) + )};` + ]) + : "// no chunk on demand loading", + "", + withExternalInstallChunk + ? Template.asString([ + `${RuntimeGlobals.externalInstallChunk} = installChunk;` + ]) + : "// no external install chunk", + "", + withOnChunkLoad + ? `${ + RuntimeGlobals.onChunksLoaded + }.j = ${runtimeTemplate.returningFunction( + "installedChunks[chunkId] === 0", + "chunkId" + )};` + : "// no on chunks loaded" + ]); + } +} + +module.exports = ModuleChunkLoadingRuntimeModule; /***/ }), -/***/ 18851: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 16734: +/***/ (function(module) { "use strict"; /* @@ -89609,62 +85788,72 @@ module.exports = RequireContextDependency; -const RequireContextDependency = __webpack_require__(46917); +/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("./Dependency").SourcePosition} SourcePosition */ -module.exports = class RequireContextDependencyParserPlugin { - apply(parser) { - parser.hooks.call - .for("require.context") - .tap("RequireContextDependencyParserPlugin", expr => { - let regExp = /^\.\/.*$/; - let recursive = true; - let mode = "sync"; - switch (expr.arguments.length) { - case 4: { - const modeExpr = parser.evaluateExpression(expr.arguments[3]); - if (!modeExpr.isString()) return; - mode = modeExpr.string; - } - // falls through - case 3: { - const regExpExpr = parser.evaluateExpression(expr.arguments[2]); - if (!regExpExpr.isRegExp()) return; - regExp = regExpExpr.regExp; - } - // falls through - case 2: { - const recursiveExpr = parser.evaluateExpression(expr.arguments[1]); - if (!recursiveExpr.isBoolean()) return; - recursive = recursiveExpr.bool; - } - // falls through - case 1: { - const requestExpr = parser.evaluateExpression(expr.arguments[0]); - if (!requestExpr.isString()) return; - const dep = new RequireContextDependency( - { - request: requestExpr.string, - recursive, - regExp, - mode, - category: "commonjs" - }, - expr.range - ); - dep.loc = expr.loc; - dep.optional = !!parser.scope.inTry; - parser.state.current.addDependency(dep); - return true; - } - } - }); +/** + * @param {SourcePosition} pos position + * @returns {string} formatted position + */ +const formatPosition = pos => { + if (pos && typeof pos === "object") { + if ("line" in pos && "column" in pos) { + return `${pos.line}:${pos.column}`; + } else if ("line" in pos) { + return `${pos.line}:?`; + } + } + return ""; +}; + +/** + * @param {DependencyLocation} loc location + * @returns {string} formatted location + */ +const formatLocation = loc => { + if (loc && typeof loc === "object") { + if ("start" in loc && loc.start && "end" in loc && loc.end) { + if ( + typeof loc.start === "object" && + typeof loc.start.line === "number" && + typeof loc.end === "object" && + typeof loc.end.line === "number" && + typeof loc.end.column === "number" && + loc.start.line === loc.end.line + ) { + return `${formatPosition(loc.start)}-${loc.end.column}`; + } else if ( + typeof loc.start === "object" && + typeof loc.start.line === "number" && + typeof loc.start.column !== "number" && + typeof loc.end === "object" && + typeof loc.end.line === "number" && + typeof loc.end.column !== "number" + ) { + return `${loc.start.line}-${loc.end.line}`; + } else { + return `${formatPosition(loc.start)}-${formatPosition(loc.end)}`; + } + } + if ("start" in loc && loc.start) { + return formatPosition(loc.start); + } + if ("name" in loc && "index" in loc) { + return `${loc.name}[${loc.index}]`; + } + if ("name" in loc) { + return loc.name; + } } + return ""; }; +module.exports = formatLocation; + /***/ }), -/***/ 2928: +/***/ 27899: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -89675,154 +85864,46 @@ module.exports = class RequireContextDependencyParserPlugin { -const { cachedSetProperty } = __webpack_require__(60839); -const ContextElementDependency = __webpack_require__(58477); -const RequireContextDependency = __webpack_require__(46917); -const RequireContextDependencyParserPlugin = __webpack_require__(18851); - -/** @typedef {import("../../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ -/** @typedef {import("../Compiler")} Compiler */ - -/** @type {ResolveOptions} */ -const EMPTY_RESOLVE_OPTIONS = {}; +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); -class RequireContextPlugin { +class HotModuleReplacementRuntimeModule extends RuntimeModule { + constructor() { + super("hot module replacement", RuntimeModule.STAGE_BASIC); + } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @returns {string} runtime code */ - apply(compiler) { - compiler.hooks.compilation.tap( - "RequireContextPlugin", - (compilation, { contextModuleFactory, normalModuleFactory }) => { - compilation.dependencyFactories.set( - RequireContextDependency, - contextModuleFactory - ); - compilation.dependencyTemplates.set( - RequireContextDependency, - new RequireContextDependency.Template() - ); - - compilation.dependencyFactories.set( - ContextElementDependency, - normalModuleFactory - ); - - const handler = (parser, parserOptions) => { - if ( - parserOptions.requireContext !== undefined && - !parserOptions.requireContext - ) - return; - - new RequireContextDependencyParserPlugin().apply(parser); - }; - - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("RequireContextPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("RequireContextPlugin", handler); - - contextModuleFactory.hooks.alternativeRequests.tap( - "RequireContextPlugin", - (items, options) => { - if (items.length === 0) return items; - - const finalResolveOptions = compiler.resolverFactory.get( - "normal", - cachedSetProperty( - options.resolveOptions || EMPTY_RESOLVE_OPTIONS, - "dependencyType", - options.category - ) - ).options; - - let newItems; - if (!finalResolveOptions.fullySpecified) { - newItems = []; - for (const item of items) { - const { request, context } = item; - for (const ext of finalResolveOptions.extensions) { - if (request.endsWith(ext)) { - newItems.push({ - context, - request: request.slice(0, -ext.length) - }); - } - } - if (!finalResolveOptions.enforceExtension) { - newItems.push(item); - } - } - items = newItems; - - newItems = []; - for (const obj of items) { - const { request, context } = obj; - for (const mainFile of finalResolveOptions.mainFiles) { - if (request.endsWith(`/${mainFile}`)) { - newItems.push({ - context, - request: request.slice(0, -mainFile.length) - }); - newItems.push({ - context, - request: request.slice(0, -mainFile.length - 1) - }); - } - } - newItems.push(obj); - } - items = newItems; - } - - newItems = []; - for (const item of items) { - let hideOriginal = false; - for (const modulesItems of finalResolveOptions.modules) { - if (Array.isArray(modulesItems)) { - for (const dir of modulesItems) { - if (item.request.startsWith(`./${dir}/`)) { - newItems.push({ - context: item.context, - request: item.request.slice(dir.length + 3) - }); - hideOriginal = true; - } - } - } else { - const dir = modulesItems.replace(/\\/g, "/"); - const fullPath = - item.context.replace(/\\/g, "/") + item.request.slice(1); - if (fullPath.startsWith(dir)) { - newItems.push({ - context: item.context, - request: fullPath.slice(dir.length + 1) - }); - } - } - } - if (!hideOriginal) { - newItems.push(item); - } - } - return newItems; - } - ); - } - ); + generate() { + return Template.getFunctionContent( + require('./HotModuleReplacement.runtime.js') + ) + .replace(/\$getFullHash\$/g, RuntimeGlobals.getFullHash) + .replace( + /\$interceptModuleExecution\$/g, + RuntimeGlobals.interceptModuleExecution + ) + .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) + .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) + .replace(/\$hmrDownloadManifest\$/g, RuntimeGlobals.hmrDownloadManifest) + .replace( + /\$hmrInvalidateModuleHandlers\$/g, + RuntimeGlobals.hmrInvalidateModuleHandlers + ) + .replace( + /\$hmrDownloadUpdateHandlers\$/g, + RuntimeGlobals.hmrDownloadUpdateHandlers + ); } } -module.exports = RequireContextPlugin; + +module.exports = HotModuleReplacementRuntimeModule; /***/ }), -/***/ 27153: +/***/ 79040: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -89833,264 +85914,422 @@ module.exports = RequireContextPlugin; +const { RawSource } = __webpack_require__(51255); const AsyncDependenciesBlock = __webpack_require__(47736); -const makeSerializable = __webpack_require__(33032); +const Dependency = __webpack_require__(54912); +const Module = __webpack_require__(73208); +const ModuleFactory = __webpack_require__(51010); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const CommonJsRequireDependency = __webpack_require__(21264); +const { registerNotSerializable } = __webpack_require__(8282); -class RequireEnsureDependenciesBlock extends AsyncDependenciesBlock { - constructor(chunkName, loc) { - super(chunkName, loc, null); - } -} +/** @typedef {import("../../declarations/WebpackOptions")} WebpackOptions */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../Module").BuildMeta} BuildMeta */ +/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ +/** @typedef {import("../ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../dependencies/HarmonyImportDependency")} HarmonyImportDependency */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ -makeSerializable( - RequireEnsureDependenciesBlock, - "webpack/lib/dependencies/RequireEnsureDependenciesBlock" -); +/** + * @typedef {Object} BackendApi + * @property {function(Error=): void} dispose + * @property {function(Module): { client: string, data: string, active: boolean }} module + */ -module.exports = RequireEnsureDependenciesBlock; +const HMR_DEPENDENCY_TYPES = new Set([ + "import.meta.webpackHot.accept", + "import.meta.webpackHot.decline", + "module.hot.accept", + "module.hot.decline" +]); +/** + * @param {undefined|string|RegExp|Function} test test option + * @param {Module} module the module + * @returns {boolean} true, if the module should be selected + */ +const checkTest = (test, module) => { + if (test === undefined) return true; + if (typeof test === "function") { + return test(module); + } + if (typeof test === "string") { + const name = module.nameForCondition(); + return name && name.startsWith(test); + } + if (test instanceof RegExp) { + const name = module.nameForCondition(); + return name && test.test(name); + } + return false; +}; -/***/ }), +const TYPES = new Set(["javascript"]); -/***/ 7235: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +class LazyCompilationDependency extends Dependency { + constructor(proxyModule) { + super(); + this.proxyModule = proxyModule; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + get category() { + return "esm"; + } + get type() { + return "lazy import()"; + } + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + return this.proxyModule.originalModule.identifier(); + } +} -const RequireEnsureDependenciesBlock = __webpack_require__(27153); -const RequireEnsureDependency = __webpack_require__(27223); -const RequireEnsureItemDependency = __webpack_require__(50329); -const getFunctionExpression = __webpack_require__(50396); +registerNotSerializable(LazyCompilationDependency); -module.exports = class RequireEnsureDependenciesBlockParserPlugin { - apply(parser) { - parser.hooks.call - .for("require.ensure") - .tap("RequireEnsureDependenciesBlockParserPlugin", expr => { - let chunkName = null; - let errorExpressionArg = null; - let errorExpression = null; - switch (expr.arguments.length) { - case 4: { - const chunkNameExpr = parser.evaluateExpression(expr.arguments[3]); - if (!chunkNameExpr.isString()) return; - chunkName = chunkNameExpr.string; - } - // falls through - case 3: { - errorExpressionArg = expr.arguments[2]; - errorExpression = getFunctionExpression(errorExpressionArg); - - if (!errorExpression && !chunkName) { - const chunkNameExpr = parser.evaluateExpression( - expr.arguments[2] - ); - if (!chunkNameExpr.isString()) return; - chunkName = chunkNameExpr.string; - } - } - // falls through - case 2: { - const dependenciesExpr = parser.evaluateExpression( - expr.arguments[0] - ); - const dependenciesItems = dependenciesExpr.isArray() - ? dependenciesExpr.items - : [dependenciesExpr]; - const successExpressionArg = expr.arguments[1]; - const successExpression = - getFunctionExpression(successExpressionArg); - - if (successExpression) { - parser.walkExpressions(successExpression.expressions); - } - if (errorExpression) { - parser.walkExpressions(errorExpression.expressions); - } - - const depBlock = new RequireEnsureDependenciesBlock( - chunkName, - expr.loc - ); - const errorCallbackExists = - expr.arguments.length === 4 || - (!chunkName && expr.arguments.length === 3); - const dep = new RequireEnsureDependency( - expr.range, - expr.arguments[1].range, - errorCallbackExists && expr.arguments[2].range - ); - dep.loc = expr.loc; - depBlock.addDependency(dep); - const old = parser.state.current; - parser.state.current = depBlock; - try { - let failed = false; - parser.inScope([], () => { - for (const ee of dependenciesItems) { - if (ee.isString()) { - const ensureDependency = new RequireEnsureItemDependency( - ee.string - ); - ensureDependency.loc = ee.loc || expr.loc; - depBlock.addDependency(ensureDependency); - } else { - failed = true; - } - } - }); - if (failed) { - return; - } - if (successExpression) { - if (successExpression.fn.body.type === "BlockStatement") { - parser.walkStatement(successExpression.fn.body); - } else { - parser.walkExpression(successExpression.fn.body); - } - } - old.addBlock(depBlock); - } finally { - parser.state.current = old; - } - if (!successExpression) { - parser.walkExpression(successExpressionArg); - } - if (errorExpression) { - if (errorExpression.fn.body.type === "BlockStatement") { - parser.walkStatement(errorExpression.fn.body); - } else { - parser.walkExpression(errorExpression.fn.body); - } - } else if (errorExpressionArg) { - parser.walkExpression(errorExpressionArg); - } - return true; - } - } - }); +class LazyCompilationProxyModule extends Module { + constructor(context, originalModule, request, client, data, active) { + super("lazy-compilation-proxy", context, originalModule.layer); + this.originalModule = originalModule; + this.request = request; + this.client = client; + this.data = data; + this.active = active; } -}; - - -/***/ }), - -/***/ 27223: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @returns {string} a unique identifier of the module + */ + identifier() { + return `lazy-compilation-proxy|${this.originalModule.identifier()}`; + } + /** + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + return `lazy-compilation-proxy ${this.originalModule.readableIdentifier( + requestShortener + )}`; + } -const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); + /** + * Assuming this module is in the cache. Update the (cached) module with + * the fresh module from the factory. Usually updates internal references + * and properties. + * @param {Module} module fresh module + * @returns {void} + */ + updateCacheModule(module) { + super.updateCacheModule(module); + const m = /** @type {LazyCompilationProxyModule} */ (module); + this.originalModule = m.originalModule; + this.request = m.request; + this.client = m.client; + this.data = m.data; + this.active = m.active; + } -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../AsyncDependenciesBlock")} AsyncDependenciesBlock */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ + /** + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion + */ + libIdent(options) { + return `${this.originalModule.libIdent(options)}!lazy-compilation-proxy`; + } -class RequireEnsureDependency extends NullDependency { - constructor(range, contentRange, errorHandlerRange) { - super(); + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + callback(null, !this.buildInfo || this.buildInfo.active !== this.active); + } - this.range = range; - this.contentRange = contentRange; - this.errorHandlerRange = errorHandlerRange; + /** + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + this.buildInfo = { + active: this.active + }; + /** @type {BuildMeta} */ + this.buildMeta = {}; + this.clearDependenciesAndBlocks(); + const dep = new CommonJsRequireDependency(this.client); + this.addDependency(dep); + if (this.active) { + const dep = new LazyCompilationDependency(this); + const block = new AsyncDependenciesBlock({}); + block.addDependency(dep); + this.addBlock(block); + } + callback(); } - get type() { - return "require.ensure"; + /** + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + return TYPES; } - serialize(context) { - const { write } = context; + /** + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + return 200; + } - write(this.range); - write(this.contentRange); - write(this.errorHandlerRange); + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration({ runtimeTemplate, chunkGraph, moduleGraph }) { + const sources = new Map(); + const runtimeRequirements = new Set(); + runtimeRequirements.add(RuntimeGlobals.module); + const clientDep = /** @type {CommonJsRequireDependency} */ ( + this.dependencies[0] + ); + const clientModule = moduleGraph.getModule(clientDep); + const block = this.blocks[0]; + const client = Template.asString([ + `var client = ${runtimeTemplate.moduleExports({ + module: clientModule, + chunkGraph, + request: clientDep.userRequest, + runtimeRequirements + })}`, + `var data = ${JSON.stringify(this.data)};` + ]); + const keepActive = Template.asString([ + `var dispose = client.keepAlive({ data: data, active: ${JSON.stringify( + !!block + )}, module: module, onError: onError });` + ]); + let source; + if (block) { + const dep = block.dependencies[0]; + const module = moduleGraph.getModule(dep); + source = Template.asString([ + client, + `module.exports = ${runtimeTemplate.moduleNamespacePromise({ + chunkGraph, + block, + module, + request: this.request, + strict: false, // TODO this should be inherited from the original module + message: "import()", + runtimeRequirements + })};`, + "if (module.hot) {", + Template.indent([ + "module.hot.accept();", + `module.hot.accept(${JSON.stringify( + chunkGraph.getModuleId(module) + )}, function() { module.hot.invalidate(); });`, + "module.hot.dispose(function(data) { delete data.resolveSelf; dispose(data); });", + "if (module.hot.data && module.hot.data.resolveSelf) module.hot.data.resolveSelf(module.exports);" + ]), + "}", + "function onError() { /* ignore */ }", + keepActive + ]); + } else { + source = Template.asString([ + client, + "var resolveSelf, onError;", + `module.exports = new Promise(function(resolve, reject) { resolveSelf = resolve; onError = reject; });`, + "if (module.hot) {", + Template.indent([ + "module.hot.accept();", + "if (module.hot.data && module.hot.data.resolveSelf) module.hot.data.resolveSelf(module.exports);", + "module.hot.dispose(function(data) { data.resolveSelf = resolveSelf; dispose(data); });" + ]), + "}", + keepActive + ]); + } + sources.set("javascript", new RawSource(source)); + return { + sources, + runtimeRequirements + }; + } - super.serialize(context); + /** + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + super.updateHash(hash, context); + hash.update(this.active ? "active" : ""); + hash.update(JSON.stringify(this.data)); } +} - deserialize(context) { - const { read } = context; +registerNotSerializable(LazyCompilationProxyModule); - this.range = read(); - this.contentRange = read(); - this.errorHandlerRange = read(); +class LazyCompilationDependencyFactory extends ModuleFactory { + constructor(factory) { + super(); + this._factory = factory; + } - super.deserialize(context); + /** + * @param {ModuleFactoryCreateData} data data object + * @param {function(Error=, ModuleFactoryResult=): void} callback callback + * @returns {void} + */ + create(data, callback) { + const dependency = /** @type {LazyCompilationDependency} */ ( + data.dependencies[0] + ); + callback(null, { + module: dependency.proxyModule.originalModule + }); } } -makeSerializable( - RequireEnsureDependency, - "webpack/lib/dependencies/RequireEnsureDependency" -); - -RequireEnsureDependency.Template = class RequireEnsureDependencyTemplate extends ( - NullDependency.Template -) { +class LazyCompilationPlugin { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object + * @param {Object} options options + * @param {(function(Compiler, function(Error?, BackendApi?): void): void) | function(Compiler): Promise} options.backend the backend + * @param {boolean} options.entries true, when entries are lazy compiled + * @param {boolean} options.imports true, when import() modules are lazy compiled + * @param {RegExp | string | (function(Module): boolean)} options.test additional filter for lazy compiled entrypoint modules + */ + constructor({ backend, entries, imports, test }) { + this.backend = backend; + this.entries = entries; + this.imports = imports; + this.test = test; + } + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply( - dependency, - source, - { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements } - ) { - const dep = /** @type {RequireEnsureDependency} */ (dependency); - const depBlock = /** @type {AsyncDependenciesBlock} */ ( - moduleGraph.getParentBlock(dep) + apply(compiler) { + let backend; + compiler.hooks.beforeCompile.tapAsync( + "LazyCompilationPlugin", + (params, callback) => { + if (backend !== undefined) return callback(); + const promise = this.backend(compiler, (err, result) => { + if (err) return callback(err); + backend = result; + callback(); + }); + if (promise && promise.then) { + promise.then(b => { + backend = b; + callback(); + }, callback); + } + } ); - const promise = runtimeTemplate.blockPromise({ - chunkGraph, - block: depBlock, - message: "require.ensure", - runtimeRequirements + compiler.hooks.thisCompilation.tap( + "LazyCompilationPlugin", + (compilation, { normalModuleFactory }) => { + normalModuleFactory.hooks.module.tap( + "LazyCompilationPlugin", + (originalModule, createData, resolveData) => { + if ( + resolveData.dependencies.every(dep => + HMR_DEPENDENCY_TYPES.has(dep.type) + ) + ) { + // for HMR only resolving, try to determine if the HMR accept/decline refers to + // an import() or not + const hmrDep = resolveData.dependencies[0]; + const originModule = + compilation.moduleGraph.getParentModule(hmrDep); + const isReferringToDynamicImport = originModule.blocks.some( + block => + block.dependencies.some( + dep => + dep.type === "import()" && + /** @type {HarmonyImportDependency} */ (dep).request === + hmrDep.request + ) + ); + if (!isReferringToDynamicImport) return; + } else if ( + !resolveData.dependencies.every( + dep => + HMR_DEPENDENCY_TYPES.has(dep.type) || + (this.imports && + (dep.type === "import()" || + dep.type === "import() context element")) || + (this.entries && dep.type === "entry") + ) + ) + return; + if ( + /webpack[/\\]hot[/\\]|webpack-dev-server[/\\]client|webpack-hot-middleware[/\\]client/.test( + resolveData.request + ) || + !checkTest(this.test, originalModule) + ) + return; + const moduleInfo = backend.module(originalModule); + if (!moduleInfo) return; + const { client, data, active } = moduleInfo; + + return new LazyCompilationProxyModule( + compiler.context, + originalModule, + resolveData.request, + client, + data, + active + ); + } + ); + compilation.dependencyFactories.set( + LazyCompilationDependency, + new LazyCompilationDependencyFactory() + ); + } + ); + compiler.hooks.shutdown.tapAsync("LazyCompilationPlugin", callback => { + backend.dispose(callback); }); - const range = dep.range; - const contentRange = dep.contentRange; - const errorHandlerRange = dep.errorHandlerRange; - source.replace(range[0], contentRange[0] - 1, `${promise}.then((`); - if (errorHandlerRange) { - source.replace( - contentRange[1], - errorHandlerRange[0] - 1, - ").bind(null, __webpack_require__))['catch'](" - ); - source.replace(errorHandlerRange[1], range[1] - 1, ")"); - } else { - source.replace( - contentRange[1], - range[1] - 1, - `).bind(null, __webpack_require__))['catch'](${RuntimeGlobals.uncaughtErrorHandler})` - ); - } } -}; +} -module.exports = RequireEnsureDependency; +module.exports = LazyCompilationPlugin; /***/ }), -/***/ 50329: +/***/ 17781: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -90101,37 +86340,147 @@ module.exports = RequireEnsureDependency; -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); -const NullDependency = __webpack_require__(31830); +/** @typedef {import("http").ServerOptions} HttpServerOptions */ +/** @typedef {import("https").ServerOptions} HttpsServerOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LazyCompilationDefaultBackendOptions} LazyCompilationDefaultBackendOptions */ +/** @typedef {import("../Compiler")} Compiler */ -class RequireEnsureItemDependency extends ModuleDependency { - constructor(request) { - super(request); - } +/** + * @callback BackendHandler + * @param {Compiler} compiler compiler + * @param {function((Error | null)=, any=): void} callback callback + * @returns {void} + */ - get type() { - return "require.ensure item"; - } +/** + * @param {Omit & { client: NonNullable}} options additional options for the backend + * @returns {BackendHandler} backend + */ +module.exports = options => (compiler, callback) => { + const logger = compiler.getInfrastructureLogger("LazyCompilationBackend"); + const activeModules = new Map(); + const prefix = "/lazy-compilation-using-"; - get category() { - return "commonjs"; - } -} + const isHttps = + options.protocol === "https" || + (typeof options.server === "object" && + ("key" in options.server || "pfx" in options.server)); -makeSerializable( - RequireEnsureItemDependency, - "webpack/lib/dependencies/RequireEnsureItemDependency" -); + const createServer = + typeof options.server === "function" + ? options.server + : (() => { + const http = isHttps ? __webpack_require__(95687) : __webpack_require__(13685); + return http.createServer.bind(http, options.server); + })(); + const listen = + typeof options.listen === "function" + ? options.listen + : server => { + let listen = options.listen; + if (typeof listen === "object" && !("port" in listen)) + listen = { ...listen, port: undefined }; + server.listen(listen); + }; -RequireEnsureItemDependency.Template = NullDependency.Template; + const protocol = options.protocol || (isHttps ? "https" : "http"); -module.exports = RequireEnsureItemDependency; + const requestListener = (req, res) => { + const keys = req.url.slice(prefix.length).split("@"); + req.socket.on("close", () => { + setTimeout(() => { + for (const key of keys) { + const oldValue = activeModules.get(key) || 0; + activeModules.set(key, oldValue - 1); + if (oldValue === 1) { + logger.log( + `${key} is no longer in use. Next compilation will skip this module.` + ); + } + } + }, 120000); + }); + req.socket.setNoDelay(true); + res.writeHead(200, { + "content-type": "text/event-stream", + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "*", + "Access-Control-Allow-Headers": "*" + }); + res.write("\n"); + let moduleActivated = false; + for (const key of keys) { + const oldValue = activeModules.get(key) || 0; + activeModules.set(key, oldValue + 1); + if (oldValue === 0) { + logger.log(`${key} is now in use and will be compiled.`); + moduleActivated = true; + } + } + if (moduleActivated && compiler.watching) compiler.watching.invalidate(); + }; + + const server = /** @type {import("net").Server} */ (createServer()); + server.on("request", requestListener); + + let isClosing = false; + /** @type {Set} */ + const sockets = new Set(); + server.on("connection", socket => { + sockets.add(socket); + socket.on("close", () => { + sockets.delete(socket); + }); + if (isClosing) socket.destroy(); + }); + server.on("clientError", e => { + if (e.message !== "Server is disposing") logger.warn(e); + }); + server.on("listening", err => { + if (err) return callback(err); + const addr = server.address(); + if (typeof addr === "string") throw new Error("addr must not be a string"); + const urlBase = + addr.address === "::" || addr.address === "0.0.0.0" + ? `${protocol}://localhost:${addr.port}` + : addr.family === "IPv6" + ? `${protocol}://[${addr.address}]:${addr.port}` + : `${protocol}://${addr.address}:${addr.port}`; + logger.log( + `Server-Sent-Events server for lazy compilation open at ${urlBase}.` + ); + callback(null, { + dispose(callback) { + isClosing = true; + // Removing the listener is a workaround for a memory leak in node.js + server.off("request", requestListener); + server.close(err => { + callback(err); + }); + for (const socket of sockets) { + socket.destroy(new Error("Server is disposing")); + } + }, + module(originalModule) { + const key = `${encodeURIComponent( + originalModule.identifier().replace(/\\/g, "/").replace(/@/g, "_") + ).replace(/%(2F|3A|24|26|2B|2C|3B|3D|3A)/g, decodeURIComponent)}`; + const active = activeModules.get(key) > 0; + return { + client: `${options.client}?${encodeURIComponent(urlBase + prefix)}`, + data: key, + active + }; + } + }); + }); + listen(server); +}; /***/ }), -/***/ 8434: +/***/ 64618: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -90142,217 +86491,263 @@ module.exports = RequireEnsureItemDependency; -const RequireEnsureDependency = __webpack_require__(27223); -const RequireEnsureItemDependency = __webpack_require__(50329); +const { find } = __webpack_require__(93347); +const { + compareModulesByPreOrderIndexOrIdentifier, + compareModulesByPostOrderIndexOrIdentifier +} = __webpack_require__(29579); -const RequireEnsureDependenciesBlockParserPlugin = __webpack_require__(7235); +/** @typedef {import("../Compiler")} Compiler */ -const { - evaluateToString, - toConstantDependency -} = __webpack_require__(93998); +class ChunkModuleIdRangePlugin { + constructor(options) { + this.options = options; + } -class RequireEnsurePlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ apply(compiler) { - compiler.hooks.compilation.tap( - "RequireEnsurePlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - RequireEnsureItemDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - RequireEnsureItemDependency, - new RequireEnsureItemDependency.Template() - ); - - compilation.dependencyTemplates.set( - RequireEnsureDependency, - new RequireEnsureDependency.Template() + const options = this.options; + compiler.hooks.compilation.tap("ChunkModuleIdRangePlugin", compilation => { + const moduleGraph = compilation.moduleGraph; + compilation.hooks.moduleIds.tap("ChunkModuleIdRangePlugin", modules => { + const chunkGraph = compilation.chunkGraph; + const chunk = find( + compilation.chunks, + chunk => chunk.name === options.name ); + if (!chunk) { + throw new Error( + `ChunkModuleIdRangePlugin: Chunk with name '${options.name}"' was not found` + ); + } - const handler = (parser, parserOptions) => { - if ( - parserOptions.requireEnsure !== undefined && - !parserOptions.requireEnsure - ) - return; - - new RequireEnsureDependenciesBlockParserPlugin().apply(parser); - parser.hooks.evaluateTypeof - .for("require.ensure") - .tap("RequireEnsurePlugin", evaluateToString("function")); - parser.hooks.typeof - .for("require.ensure") - .tap( - "RequireEnsurePlugin", - toConstantDependency(parser, JSON.stringify("function")) - ); - }; + let chunkModules; + if (options.order) { + let cmpFn; + switch (options.order) { + case "index": + case "preOrderIndex": + cmpFn = compareModulesByPreOrderIndexOrIdentifier(moduleGraph); + break; + case "index2": + case "postOrderIndex": + cmpFn = compareModulesByPostOrderIndexOrIdentifier(moduleGraph); + break; + default: + throw new Error( + "ChunkModuleIdRangePlugin: unexpected value of order" + ); + } + chunkModules = chunkGraph.getOrderedChunkModules(chunk, cmpFn); + } else { + chunkModules = Array.from(modules) + .filter(m => { + return chunkGraph.isModuleInChunk(m, chunk); + }) + .sort(compareModulesByPreOrderIndexOrIdentifier(moduleGraph)); + } - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("RequireEnsurePlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("RequireEnsurePlugin", handler); - } - ); + let currentId = options.start || 0; + for (let i = 0; i < chunkModules.length; i++) { + const m = chunkModules[i]; + if (m.needId && chunkGraph.getModuleId(m) === null) { + chunkGraph.setModuleId(m, currentId++); + } + if (options.end && currentId > options.end) break; + } + }); + }); } } -module.exports = RequireEnsurePlugin; +module.exports = ChunkModuleIdRangePlugin; /***/ }), -/***/ 89183: +/***/ 8747: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Florent Cailhol @ooflorent */ -const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ - -class RequireHeaderDependency extends NullDependency { - constructor(range) { - super(); - if (!Array.isArray(range)) throw new Error("range must be valid"); - this.range = range; - } +const { compareChunksNatural } = __webpack_require__(29579); +const { + getFullChunkName, + getUsedChunkIds, + assignDeterministicIds +} = __webpack_require__(63290); - serialize(context) { - const { write } = context; - write(this.range); - super.serialize(context); - } +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ - static deserialize(context) { - const obj = new RequireHeaderDependency(context.read()); - obj.deserialize(context); - return obj; +class DeterministicChunkIdsPlugin { + constructor(options) { + this.options = options || {}; } -} - -makeSerializable( - RequireHeaderDependency, - "webpack/lib/dependencies/RequireHeaderDependency" -); -RequireHeaderDependency.Template = class RequireHeaderDependencyTemplate extends ( - NullDependency.Template -) { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply(dependency, source, { runtimeRequirements }) { - const dep = /** @type {RequireHeaderDependency} */ (dependency); - runtimeRequirements.add(RuntimeGlobals.require); - source.replace(dep.range[0], dep.range[1] - 1, "__webpack_require__"); + apply(compiler) { + compiler.hooks.compilation.tap( + "DeterministicChunkIdsPlugin", + compilation => { + compilation.hooks.chunkIds.tap( + "DeterministicChunkIdsPlugin", + chunks => { + const chunkGraph = compilation.chunkGraph; + const context = this.options.context + ? this.options.context + : compiler.context; + const maxLength = this.options.maxLength || 3; + + const compareNatural = compareChunksNatural(chunkGraph); + + const usedIds = getUsedChunkIds(compilation); + assignDeterministicIds( + Array.from(chunks).filter(chunk => { + return chunk.id === null; + }), + chunk => + getFullChunkName(chunk, chunkGraph, context, compiler.root), + compareNatural, + (chunk, id) => { + const size = usedIds.size; + usedIds.add(`${id}`); + if (size === usedIds.size) return false; + chunk.id = id; + chunk.ids = [id]; + return true; + }, + [Math.pow(10, maxLength)], + 10, + usedIds.size + ); + } + ); + } + ); } -}; +} -module.exports = RequireHeaderDependency; +module.exports = DeterministicChunkIdsPlugin; /***/ }), -/***/ 71284: +/***/ 76692: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Florent Cailhol @ooflorent */ -const Dependency = __webpack_require__(54912); -const Template = __webpack_require__(39722); -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - -class RequireIncludeDependency extends ModuleDependency { - constructor(request, range) { - super(request); +const { + compareModulesByPreOrderIndexOrIdentifier +} = __webpack_require__(29579); +const { + getUsedModuleIdsAndModules, + getFullModuleName, + assignDeterministicIds +} = __webpack_require__(63290); - this.range = range; - } +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ +class DeterministicModuleIdsPlugin { /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports + * @param {Object} options options + * @param {string=} options.context context relative to which module identifiers are computed + * @param {function(Module): boolean=} options.test selector function for modules + * @param {number=} options.maxLength maximum id length in digits (used as starting point) + * @param {number=} options.salt hash salt for ids + * @param {boolean=} options.fixedLength do not increase the maxLength to find an optimal id space size + * @param {boolean=} options.failOnConflict throw an error when id conflicts occur (instead of rehashing) */ - getReferencedExports(moduleGraph, runtime) { - // This doesn't use any export - return Dependency.NO_EXPORTS_REFERENCED; - } - - get type() { - return "require.include"; - } - - get category() { - return "commonjs"; + constructor(options = {}) { + this.options = options; } -} - -makeSerializable( - RequireIncludeDependency, - "webpack/lib/dependencies/RequireIncludeDependency" -); -RequireIncludeDependency.Template = class RequireIncludeDependencyTemplate extends ( - ModuleDependency.Template -) { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply(dependency, source, { runtimeTemplate }) { - const dep = /** @type {RequireIncludeDependency} */ (dependency); - const comment = runtimeTemplate.outputOptions.pathinfo - ? Template.toComment( - `require.include ${runtimeTemplate.requestShortener.shorten( - dep.request - )}` - ) - : ""; + apply(compiler) { + compiler.hooks.compilation.tap( + "DeterministicModuleIdsPlugin", + compilation => { + compilation.hooks.moduleIds.tap("DeterministicModuleIdsPlugin", () => { + const chunkGraph = compilation.chunkGraph; + const context = this.options.context + ? this.options.context + : compiler.context; + const maxLength = this.options.maxLength || 3; + const failOnConflict = this.options.failOnConflict || false; + const fixedLength = this.options.fixedLength || false; + const salt = this.options.salt || 0; + let conflicts = 0; - source.replace(dep.range[0], dep.range[1] - 1, `undefined${comment}`); + const [usedIds, modules] = getUsedModuleIdsAndModules( + compilation, + this.options.test + ); + assignDeterministicIds( + modules, + module => getFullModuleName(module, context, compiler.root), + failOnConflict + ? () => 0 + : compareModulesByPreOrderIndexOrIdentifier( + compilation.moduleGraph + ), + (module, id) => { + const size = usedIds.size; + usedIds.add(`${id}`); + if (size === usedIds.size) { + conflicts++; + return false; + } + chunkGraph.setModuleId(module, id); + return true; + }, + [Math.pow(10, maxLength)], + fixedLength ? 0 : 10, + usedIds.size, + salt + ); + if (failOnConflict && conflicts) + throw new Error( + `Assigning deterministic module ids has lead to ${conflicts} conflict${ + conflicts > 1 ? "s" : "" + }.\nIncrease the 'maxLength' to increase the id space and make conflicts less likely (recommended when there are many conflicts or application is expected to grow), or add an 'salt' number to try another hash starting value in the same id space (recommended when there is only a single conflict).` + ); + }); + } + ); } -}; +} -module.exports = RequireIncludeDependency; +module.exports = DeterministicModuleIdsPlugin; /***/ }), -/***/ 35768: +/***/ 21825: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -90363,82 +86758,82 @@ module.exports = RequireIncludeDependency; -const WebpackError = __webpack_require__(53799); const { - evaluateToString, - toConstantDependency -} = __webpack_require__(93998); -const makeSerializable = __webpack_require__(33032); -const RequireIncludeDependency = __webpack_require__(71284); + compareModulesByPreOrderIndexOrIdentifier +} = __webpack_require__(29579); +const createSchemaValidation = __webpack_require__(32540); +const createHash = __webpack_require__(49835); +const { + getUsedModuleIdsAndModules, + getFullModuleName +} = __webpack_require__(63290); -module.exports = class RequireIncludeDependencyParserPlugin { - constructor(warn) { - this.warn = warn; - } - apply(parser) { - const { warn } = this; - parser.hooks.call - .for("require.include") - .tap("RequireIncludeDependencyParserPlugin", expr => { - if (expr.arguments.length !== 1) return; - const param = parser.evaluateExpression(expr.arguments[0]); - if (!param.isString()) return; +/** @typedef {import("../../declarations/plugins/HashedModuleIdsPlugin").HashedModuleIdsPluginOptions} HashedModuleIdsPluginOptions */ - if (warn) { - parser.state.module.addWarning( - new RequireIncludeDeprecationWarning(expr.loc) - ); - } +const validate = createSchemaValidation( + __webpack_require__(52210), + () => __webpack_require__(59106), + { + name: "Hashed Module Ids Plugin", + baseDataPath: "options" + } +); - const dep = new RequireIncludeDependency(param.string, expr.range); - dep.loc = expr.loc; - parser.state.current.addDependency(dep); - return true; - }); - parser.hooks.evaluateTypeof - .for("require.include") - .tap("RequireIncludePlugin", expr => { - if (warn) { - parser.state.module.addWarning( - new RequireIncludeDeprecationWarning(expr.loc) - ); - } - return evaluateToString("function")(expr); - }); - parser.hooks.typeof - .for("require.include") - .tap("RequireIncludePlugin", expr => { - if (warn) { - parser.state.module.addWarning( - new RequireIncludeDeprecationWarning(expr.loc) - ); - } - return toConstantDependency(parser, JSON.stringify("function"))(expr); - }); - } -}; +class HashedModuleIdsPlugin { + /** + * @param {HashedModuleIdsPluginOptions=} options options object + */ + constructor(options = {}) { + validate(options); -class RequireIncludeDeprecationWarning extends WebpackError { - constructor(loc) { - super("require.include() is deprecated and will be removed soon."); + /** @type {HashedModuleIdsPluginOptions} */ + this.options = { + context: null, + hashFunction: "md4", + hashDigest: "base64", + hashDigestLength: 4, + ...options + }; + } - this.name = "RequireIncludeDeprecationWarning"; + apply(compiler) { + const options = this.options; + compiler.hooks.compilation.tap("HashedModuleIdsPlugin", compilation => { + compilation.hooks.moduleIds.tap("HashedModuleIdsPlugin", () => { + const chunkGraph = compilation.chunkGraph; + const context = this.options.context + ? this.options.context + : compiler.context; - this.loc = loc; + const [usedIds, modules] = getUsedModuleIdsAndModules(compilation); + const modulesInNaturalOrder = modules.sort( + compareModulesByPreOrderIndexOrIdentifier(compilation.moduleGraph) + ); + for (const module of modulesInNaturalOrder) { + const ident = getFullModuleName(module, context, compiler.root); + const hash = createHash(options.hashFunction); + hash.update(ident || ""); + const hashId = /** @type {string} */ ( + hash.digest(options.hashDigest) + ); + let len = options.hashDigestLength; + while (usedIds.has(hashId.substr(0, len))) len++; + const moduleId = hashId.substr(0, len); + chunkGraph.setModuleId(module, moduleId); + usedIds.add(moduleId); + } + }); + }); } } -makeSerializable( - RequireIncludeDeprecationWarning, - "webpack/lib/dependencies/RequireIncludeDependencyParserPlugin", - "RequireIncludeDeprecationWarning" -); +module.exports = HashedModuleIdsPlugin; /***/ }), -/***/ 37378: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 63290: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -90448,163 +86843,481 @@ makeSerializable( -const RequireIncludeDependency = __webpack_require__(71284); -const RequireIncludeDependencyParserPlugin = __webpack_require__(35768); - -class RequireIncludePlugin { - apply(compiler) { - compiler.hooks.compilation.tap( - "RequireIncludePlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - RequireIncludeDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - RequireIncludeDependency, - new RequireIncludeDependency.Template() - ); +const createHash = __webpack_require__(49835); +const { makePathsRelative } = __webpack_require__(82186); +const numberHash = __webpack_require__(70002); - const handler = (parser, parserOptions) => { - if (parserOptions.requireInclude === false) return; - const warn = parserOptions.requireInclude === undefined; +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Module")} Module */ +/** @typedef {typeof import("../util/Hash")} Hash */ - new RequireIncludeDependencyParserPlugin(warn).apply(parser); - }; +/** + * @param {string} str string to hash + * @param {number} len max length of the hash + * @param {string | Hash} hashFunction hash function to use + * @returns {string} hash + */ +const getHash = (str, len, hashFunction) => { + const hash = createHash(hashFunction); + hash.update(str); + const digest = /** @type {string} */ (hash.digest("hex")); + return digest.substr(0, len); +}; - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("RequireIncludePlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("RequireIncludePlugin", handler); - } - ); +/** + * @param {string} str the string + * @returns {string} string prefixed by an underscore if it is a number + */ +const avoidNumber = str => { + // max length of a number is 21 chars, bigger numbers a written as "...e+xx" + if (str.length > 21) return str; + const firstChar = str.charCodeAt(0); + // skip everything that doesn't look like a number + // charCodes: "-": 45, "1": 49, "9": 57 + if (firstChar < 49) { + if (firstChar !== 45) return str; + } else if (firstChar > 57) { + return str; } -} -module.exports = RequireIncludePlugin; - + if (str === +str + "") { + return `_${str}`; + } + return str; +}; -/***/ }), +/** + * @param {string} request the request + * @returns {string} id representation + */ +const requestToId = request => { + return request + .replace(/^(\.\.?\/)+/, "") + .replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_"); +}; +exports.requestToId = requestToId; -/***/ 55627: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * @param {string} string the string + * @param {string} delimiter separator for string and hash + * @param {string | Hash} hashFunction hash function to use + * @returns {string} string with limited max length to 100 chars + */ +const shortenLongString = (string, delimiter, hashFunction) => { + if (string.length < 100) return string; + return ( + string.slice(0, 100 - 6 - delimiter.length) + + delimiter + + getHash(string, 6, hashFunction) + ); +}; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** + * @param {Module} module the module + * @param {string} context context directory + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {string} short module name + */ +const getShortModuleName = (module, context, associatedObjectForCache) => { + const libIdent = module.libIdent({ context, associatedObjectForCache }); + if (libIdent) return avoidNumber(libIdent); + const nameForCondition = module.nameForCondition(); + if (nameForCondition) + return avoidNumber( + makePathsRelative(context, nameForCondition, associatedObjectForCache) + ); + return ""; +}; +exports.getShortModuleName = getShortModuleName; +/** + * @param {string} shortName the short name + * @param {Module} module the module + * @param {string} context context directory + * @param {string | Hash} hashFunction hash function to use + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {string} long module name + */ +const getLongModuleName = ( + shortName, + module, + context, + hashFunction, + associatedObjectForCache +) => { + const fullName = getFullModuleName(module, context, associatedObjectForCache); + return `${shortName}?${getHash(fullName, 4, hashFunction)}`; +}; +exports.getLongModuleName = getLongModuleName; +/** + * @param {Module} module the module + * @param {string} context context directory + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {string} full module name + */ +const getFullModuleName = (module, context, associatedObjectForCache) => { + return makePathsRelative( + context, + module.identifier(), + associatedObjectForCache + ); +}; +exports.getFullModuleName = getFullModuleName; -const makeSerializable = __webpack_require__(33032); -const ContextDependency = __webpack_require__(88101); -const ContextDependencyTemplateAsId = __webpack_require__(76081); +/** + * @param {Chunk} chunk the chunk + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {string} context context directory + * @param {string} delimiter delimiter for names + * @param {string | Hash} hashFunction hash function to use + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {string} short chunk name + */ +const getShortChunkName = ( + chunk, + chunkGraph, + context, + delimiter, + hashFunction, + associatedObjectForCache +) => { + const modules = chunkGraph.getChunkRootModules(chunk); + const shortModuleNames = modules.map(m => + requestToId(getShortModuleName(m, context, associatedObjectForCache)) + ); + chunk.idNameHints.sort(); + const chunkName = Array.from(chunk.idNameHints) + .concat(shortModuleNames) + .filter(Boolean) + .join(delimiter); + return shortenLongString(chunkName, delimiter, hashFunction); +}; +exports.getShortChunkName = getShortChunkName; -class RequireResolveContextDependency extends ContextDependency { - constructor(options, range, valueRange) { - super(options); +/** + * @param {Chunk} chunk the chunk + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {string} context context directory + * @param {string} delimiter delimiter for names + * @param {string | Hash} hashFunction hash function to use + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {string} short chunk name + */ +const getLongChunkName = ( + chunk, + chunkGraph, + context, + delimiter, + hashFunction, + associatedObjectForCache +) => { + const modules = chunkGraph.getChunkRootModules(chunk); + const shortModuleNames = modules.map(m => + requestToId(getShortModuleName(m, context, associatedObjectForCache)) + ); + const longModuleNames = modules.map(m => + requestToId( + getLongModuleName("", m, context, hashFunction, associatedObjectForCache) + ) + ); + chunk.idNameHints.sort(); + const chunkName = Array.from(chunk.idNameHints) + .concat(shortModuleNames, longModuleNames) + .filter(Boolean) + .join(delimiter); + return shortenLongString(chunkName, delimiter, hashFunction); +}; +exports.getLongChunkName = getLongChunkName; - this.range = range; - this.valueRange = valueRange; - } +/** + * @param {Chunk} chunk the chunk + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {string} context context directory + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {string} full chunk name + */ +const getFullChunkName = ( + chunk, + chunkGraph, + context, + associatedObjectForCache +) => { + if (chunk.name) return chunk.name; + const modules = chunkGraph.getChunkRootModules(chunk); + const fullModuleNames = modules.map(m => + makePathsRelative(context, m.identifier(), associatedObjectForCache) + ); + return fullModuleNames.join(); +}; +exports.getFullChunkName = getFullChunkName; - get type() { - return "amd require context"; +/** + * @template K + * @template V + * @param {Map} map a map from key to values + * @param {K} key key + * @param {V} value value + * @returns {void} + */ +const addToMapOfItems = (map, key, value) => { + let array = map.get(key); + if (array === undefined) { + array = []; + map.set(key, array); } + array.push(value); +}; - serialize(context) { - const { write } = context; +/** + * @param {Compilation} compilation the compilation + * @param {function(Module): boolean=} filter filter modules + * @returns {[Set, Module[]]} used module ids as strings and modules without id matching the filter + */ +const getUsedModuleIdsAndModules = (compilation, filter) => { + const chunkGraph = compilation.chunkGraph; - write(this.range); - write(this.valueRange); + const modules = []; - super.serialize(context); + /** @type {Set} */ + const usedIds = new Set(); + if (compilation.usedModuleIds) { + for (const id of compilation.usedModuleIds) { + usedIds.add(id + ""); + } } - deserialize(context) { - const { read } = context; - - this.range = read(); - this.valueRange = read(); - - super.deserialize(context); + for (const module of compilation.modules) { + if (!module.needId) continue; + const moduleId = chunkGraph.getModuleId(module); + if (moduleId !== null) { + usedIds.add(moduleId + ""); + } else { + if ( + (!filter || filter(module)) && + chunkGraph.getNumberOfModuleChunks(module) !== 0 + ) { + modules.push(module); + } + } } -} - -makeSerializable( - RequireResolveContextDependency, - "webpack/lib/dependencies/RequireResolveContextDependency" -); - -RequireResolveContextDependency.Template = ContextDependencyTemplateAsId; - -module.exports = RequireResolveContextDependency; + return [usedIds, modules]; +}; +exports.getUsedModuleIdsAndModules = getUsedModuleIdsAndModules; -/***/ }), - -/***/ 68582: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** + * @param {Compilation} compilation the compilation + * @returns {Set} used chunk ids as strings + */ +const getUsedChunkIds = compilation => { + /** @type {Set} */ + const usedIds = new Set(); + if (compilation.usedChunkIds) { + for (const id of compilation.usedChunkIds) { + usedIds.add(id + ""); + } + } + for (const chunk of compilation.chunks) { + const chunkId = chunk.id; + if (chunkId !== null) { + usedIds.add(chunkId + ""); + } + } + return usedIds; +}; +exports.getUsedChunkIds = getUsedChunkIds; -const Dependency = __webpack_require__(54912); -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); -const ModuleDependencyAsId = __webpack_require__(80825); +/** + * @template T + * @param {Iterable} items list of items to be named + * @param {function(T): string} getShortName get a short name for an item + * @param {function(T, string): string} getLongName get a long name for an item + * @param {function(T, T): -1|0|1} comparator order of items + * @param {Set} usedIds already used ids, will not be assigned + * @param {function(T, string): void} assignName assign a name to an item + * @returns {T[]} list of items without a name + */ +const assignNames = ( + items, + getShortName, + getLongName, + comparator, + usedIds, + assignName +) => { + /** @type {Map} */ + const nameToItems = new Map(); -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + for (const item of items) { + const name = getShortName(item); + addToMapOfItems(nameToItems, name, item); + } -class RequireResolveDependency extends ModuleDependency { - constructor(request, range) { - super(request); + /** @type {Map} */ + const nameToItems2 = new Map(); - this.range = range; + for (const [name, items] of nameToItems) { + if (items.length > 1 || !name) { + for (const item of items) { + const longName = getLongName(item, name); + addToMapOfItems(nameToItems2, longName, item); + } + } else { + addToMapOfItems(nameToItems2, name, items[0]); + } } - get type() { - return "require.resolve"; - } + /** @type {T[]} */ + const unnamedItems = []; - get category() { - return "commonjs"; + for (const [name, items] of nameToItems2) { + if (!name) { + for (const item of items) { + unnamedItems.push(item); + } + } else if (items.length === 1 && !usedIds.has(name)) { + assignName(items[0], name); + usedIds.add(name); + } else { + items.sort(comparator); + let i = 0; + for (const item of items) { + while (nameToItems2.has(name + i) && usedIds.has(name + i)) i++; + assignName(item, name + i); + usedIds.add(name + i); + i++; + } + } } - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - // This doesn't use any export - return Dependency.NO_EXPORTS_REFERENCED; - } -} + unnamedItems.sort(comparator); + return unnamedItems; +}; +exports.assignNames = assignNames; -makeSerializable( - RequireResolveDependency, - "webpack/lib/dependencies/RequireResolveDependency" -); +/** + * @template T + * @param {T[]} items list of items to be named + * @param {function(T): string} getName get a name for an item + * @param {function(T, T): -1|0|1} comparator order of items + * @param {function(T, number): boolean} assignId assign an id to an item + * @param {number[]} ranges usable ranges for ids + * @param {number} expandFactor factor to create more ranges + * @param {number} extraSpace extra space to allocate, i. e. when some ids are already used + * @param {number} salt salting number to initialize hashing + * @returns {void} + */ +const assignDeterministicIds = ( + items, + getName, + comparator, + assignId, + ranges = [10], + expandFactor = 10, + extraSpace = 0, + salt = 0 +) => { + items.sort(comparator); -RequireResolveDependency.Template = ModuleDependencyAsId; + // max 5% fill rate + const optimalRange = Math.min( + Math.ceil(items.length * 20) + extraSpace, + Number.MAX_SAFE_INTEGER + ); -module.exports = RequireResolveDependency; + let i = 0; + let range = ranges[i]; + while (range < optimalRange) { + i++; + if (i < ranges.length) { + range = Math.min(ranges[i], Number.MAX_SAFE_INTEGER); + } else if (expandFactor) { + range = Math.min(range * expandFactor, Number.MAX_SAFE_INTEGER); + } else { + break; + } + } + + for (const item of items) { + const ident = getName(item); + let id; + let i = salt; + do { + id = numberHash(ident + i++, range); + } while (!assignId(item, id)); + } +}; +exports.assignDeterministicIds = assignDeterministicIds; + +/** + * @param {Set} usedIds used ids + * @param {Iterable} modules the modules + * @param {Compilation} compilation the compilation + * @returns {void} + */ +const assignAscendingModuleIds = (usedIds, modules, compilation) => { + const chunkGraph = compilation.chunkGraph; + + let nextId = 0; + let assignId; + if (usedIds.size > 0) { + assignId = module => { + if (chunkGraph.getModuleId(module) === null) { + while (usedIds.has(nextId + "")) nextId++; + chunkGraph.setModuleId(module, nextId++); + } + }; + } else { + assignId = module => { + if (chunkGraph.getModuleId(module) === null) { + chunkGraph.setModuleId(module, nextId++); + } + }; + } + for (const module of modules) { + assignId(module); + } +}; +exports.assignAscendingModuleIds = assignAscendingModuleIds; + +/** + * @param {Iterable} chunks the chunks + * @param {Compilation} compilation the compilation + * @returns {void} + */ +const assignAscendingChunkIds = (chunks, compilation) => { + const usedIds = getUsedChunkIds(compilation); + + let nextId = 0; + if (usedIds.size > 0) { + for (const chunk of chunks) { + if (chunk.id === null) { + while (usedIds.has(nextId + "")) nextId++; + chunk.id = nextId; + chunk.ids = [nextId]; + nextId++; + } + } + } else { + for (const chunk of chunks) { + if (chunk.id === null) { + chunk.id = nextId; + chunk.ids = [nextId]; + nextId++; + } + } + } +}; +exports.assignAscendingChunkIds = assignAscendingChunkIds; /***/ }), -/***/ 9880: +/***/ 6454: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -90615,67 +87328,85 @@ module.exports = RequireResolveDependency; -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); - -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ - -class RequireResolveHeaderDependency extends NullDependency { - constructor(range) { - super(); - - if (!Array.isArray(range)) throw new Error("range must be valid"); - - this.range = range; - } - - serialize(context) { - const { write } = context; - - write(this.range); +const { compareChunksNatural } = __webpack_require__(29579); +const { + getShortChunkName, + getLongChunkName, + assignNames, + getUsedChunkIds, + assignAscendingChunkIds +} = __webpack_require__(63290); - super.serialize(context); - } +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ - static deserialize(context) { - const obj = new RequireResolveHeaderDependency(context.read()); - obj.deserialize(context); - return obj; +class NamedChunkIdsPlugin { + constructor(options) { + this.delimiter = (options && options.delimiter) || "-"; + this.context = options && options.context; } -} - -makeSerializable( - RequireResolveHeaderDependency, - "webpack/lib/dependencies/RequireResolveHeaderDependency" -); -RequireResolveHeaderDependency.Template = class RequireResolveHeaderDependencyTemplate extends ( - NullDependency.Template -) { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply(dependency, source, templateContext) { - const dep = /** @type {RequireResolveHeaderDependency} */ (dependency); - source.replace(dep.range[0], dep.range[1] - 1, "/*require.resolve*/"); - } + apply(compiler) { + compiler.hooks.compilation.tap("NamedChunkIdsPlugin", compilation => { + const { hashFunction } = compilation.outputOptions; + compilation.hooks.chunkIds.tap("NamedChunkIdsPlugin", chunks => { + const chunkGraph = compilation.chunkGraph; + const context = this.context ? this.context : compiler.context; + const delimiter = this.delimiter; - applyAsTemplateArgument(name, dep, source) { - source.replace(dep.range[0], dep.range[1] - 1, "/*require.resolve*/"); + const unnamedChunks = assignNames( + Array.from(chunks).filter(chunk => { + if (chunk.name) { + chunk.id = chunk.name; + chunk.ids = [chunk.name]; + } + return chunk.id === null; + }), + chunk => + getShortChunkName( + chunk, + chunkGraph, + context, + delimiter, + hashFunction, + compiler.root + ), + chunk => + getLongChunkName( + chunk, + chunkGraph, + context, + delimiter, + hashFunction, + compiler.root + ), + compareChunksNatural(chunkGraph), + getUsedChunkIds(compilation), + (chunk, name) => { + chunk.id = name; + chunk.ids = [name]; + } + ); + if (unnamedChunks.length > 0) { + assignAscendingChunkIds(unnamedChunks, compilation); + } + }); + }); } -}; +} -module.exports = RequireResolveHeaderDependency; +module.exports = NamedChunkIdsPlugin; /***/ }), -/***/ 24187: +/***/ 24339: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -90686,81 +87417,62 @@ module.exports = RequireResolveHeaderDependency; -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); +const { compareModulesByIdentifier } = __webpack_require__(29579); +const { + getShortModuleName, + getLongModuleName, + assignNames, + getUsedModuleIdsAndModules, + assignAscendingModuleIds +} = __webpack_require__(63290); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ -class RuntimeRequirementsDependency extends NullDependency { - /** - * @param {string[]} runtimeRequirements runtime requirements - */ - constructor(runtimeRequirements) { - super(); - this.runtimeRequirements = new Set(runtimeRequirements); - this._hashUpdate = undefined; +class NamedModuleIdsPlugin { + constructor(options) { + this.options = options || {}; } /** - * Update the hash - * @param {Hash} hash hash to be updated - * @param {UpdateHashContext} context context + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - updateHash(hash, context) { - if (this._hashUpdate === undefined) { - this._hashUpdate = Array.from(this.runtimeRequirements).join() + ""; - } - hash.update(this._hashUpdate); - } - - serialize(context) { - const { write } = context; - write(this.runtimeRequirements); - super.serialize(context); - } + apply(compiler) { + const { root } = compiler; + compiler.hooks.compilation.tap("NamedModuleIdsPlugin", compilation => { + const { hashFunction } = compilation.outputOptions; + compilation.hooks.moduleIds.tap("NamedModuleIdsPlugin", () => { + const chunkGraph = compilation.chunkGraph; + const context = this.options.context + ? this.options.context + : compiler.context; - deserialize(context) { - const { read } = context; - this.runtimeRequirements = read(); - super.deserialize(context); + const [usedIds, modules] = getUsedModuleIdsAndModules(compilation); + const unnamedModules = assignNames( + modules, + m => getShortModuleName(m, context, root), + (m, shortName) => + getLongModuleName(shortName, m, context, hashFunction, root), + compareModulesByIdentifier, + usedIds, + (m, name) => chunkGraph.setModuleId(m, name) + ); + if (unnamedModules.length > 0) { + assignAscendingModuleIds(usedIds, unnamedModules, compilation); + } + }); + }); } } -makeSerializable( - RuntimeRequirementsDependency, - "webpack/lib/dependencies/RuntimeRequirementsDependency" -); - -RuntimeRequirementsDependency.Template = class RuntimeRequirementsDependencyTemplate extends ( - NullDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, { runtimeRequirements }) { - const dep = /** @type {RuntimeRequirementsDependency} */ (dependency); - for (const req of dep.runtimeRequirements) { - runtimeRequirements.add(req); - } - } -}; - -module.exports = RuntimeRequirementsDependency; +module.exports = NamedModuleIdsPlugin; /***/ }), -/***/ 91418: +/***/ 86221: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -90771,70 +87483,84 @@ module.exports = RuntimeRequirementsDependency; -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); +const { compareChunksNatural } = __webpack_require__(29579); +const { assignAscendingChunkIds } = __webpack_require__(63290); -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency").ExportSpec} ExportSpec */ -/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ -class StaticExportsDependency extends NullDependency { +class NaturalChunkIdsPlugin { /** - * @param {string[] | true} exports export names - * @param {boolean} canMangle true, if mangling exports names is allowed + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - constructor(exports, canMangle) { - super(); - this.exports = exports; - this.canMangle = canMangle; + apply(compiler) { + compiler.hooks.compilation.tap("NaturalChunkIdsPlugin", compilation => { + compilation.hooks.chunkIds.tap("NaturalChunkIdsPlugin", chunks => { + const chunkGraph = compilation.chunkGraph; + const compareNatural = compareChunksNatural(chunkGraph); + const chunksInNaturalOrder = Array.from(chunks).sort(compareNatural); + assignAscendingChunkIds(chunksInNaturalOrder, compilation); + }); + }); } +} - get type() { - return "static exports"; - } +module.exports = NaturalChunkIdsPlugin; - /** - * Returns the exported names - * @param {ModuleGraph} moduleGraph module graph - * @returns {ExportsSpec | undefined} export names - */ - getExports(moduleGraph) { - return { - exports: this.exports, - canMangle: this.canMangle, - dependencies: undefined - }; - } - serialize(context) { - const { write } = context; - write(this.exports); - write(this.canMangle); - super.serialize(context); - } +/***/ }), - deserialize(context) { - const { read } = context; - this.exports = read(); - this.canMangle = read(); - super.deserialize(context); +/***/ 83366: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Florent Cailhol @ooflorent +*/ + + + +const { + compareModulesByPreOrderIndexOrIdentifier +} = __webpack_require__(29579); +const { + assignAscendingModuleIds, + getUsedModuleIdsAndModules +} = __webpack_require__(63290); + +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ + +class NaturalModuleIdsPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap("NaturalModuleIdsPlugin", compilation => { + compilation.hooks.moduleIds.tap("NaturalModuleIdsPlugin", modules => { + const [usedIds, modulesInNaturalOrder] = + getUsedModuleIdsAndModules(compilation); + modulesInNaturalOrder.sort( + compareModulesByPreOrderIndexOrIdentifier(compilation.moduleGraph) + ); + assignAscendingModuleIds(usedIds, modulesInNaturalOrder, compilation); + }); + }); } } -makeSerializable( - StaticExportsDependency, - "webpack/lib/dependencies/StaticExportsDependency" -); - -module.exports = StaticExportsDependency; +module.exports = NaturalModuleIdsPlugin; /***/ }), -/***/ 97981: +/***/ 51020: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -90845,475 +87571,399 @@ module.exports = StaticExportsDependency; -const RuntimeGlobals = __webpack_require__(16475); -const WebpackError = __webpack_require__(53799); -const { - evaluateToString, - expressionIsUnsupported, - toConstantDependency -} = __webpack_require__(93998); -const makeSerializable = __webpack_require__(33032); -const ConstDependency = __webpack_require__(76911); -const SystemRuntimeModule = __webpack_require__(85439); +const { compareChunksNatural } = __webpack_require__(29579); +const createSchemaValidation = __webpack_require__(32540); +const { assignAscendingChunkIds } = __webpack_require__(63290); +/** @typedef {import("../../declarations/plugins/ids/OccurrenceChunkIdsPlugin").OccurrenceChunkIdsPluginOptions} OccurrenceChunkIdsPluginOptions */ +/** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ + +const validate = createSchemaValidation( + __webpack_require__(24344), + () => __webpack_require__(53576), + { + name: "Occurrence Order Chunk Ids Plugin", + baseDataPath: "options" + } +); + +class OccurrenceChunkIdsPlugin { + /** + * @param {OccurrenceChunkIdsPluginOptions=} options options object + */ + constructor(options = {}) { + validate(options); + this.options = options; + } -class SystemPlugin { /** * Apply the plugin * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap( - "SystemPlugin", - (compilation, { normalModuleFactory }) => { - compilation.hooks.runtimeRequirementInModule - .for(RuntimeGlobals.system) - .tap("SystemPlugin", (module, set) => { - set.add(RuntimeGlobals.requireScope); - }); + const prioritiseInitial = this.options.prioritiseInitial; + compiler.hooks.compilation.tap("OccurrenceChunkIdsPlugin", compilation => { + compilation.hooks.chunkIds.tap("OccurrenceChunkIdsPlugin", chunks => { + const chunkGraph = compilation.chunkGraph; - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.system) - .tap("SystemPlugin", (chunk, set) => { - compilation.addRuntimeModule(chunk, new SystemRuntimeModule()); - }); + /** @type {Map} */ + const occursInInitialChunksMap = new Map(); - const handler = (parser, parserOptions) => { - if (parserOptions.system === undefined || !parserOptions.system) { - return; + const compareNatural = compareChunksNatural(chunkGraph); + + for (const c of chunks) { + let occurs = 0; + for (const chunkGroup of c.groupsIterable) { + for (const parent of chunkGroup.parentsIterable) { + if (parent.isInitial()) occurs++; + } } + occursInInitialChunksMap.set(c, occurs); + } - const setNotSupported = name => { - parser.hooks.evaluateTypeof - .for(name) - .tap("SystemPlugin", evaluateToString("undefined")); - parser.hooks.expression - .for(name) - .tap( - "SystemPlugin", - expressionIsUnsupported( - parser, - name + " is not supported by webpack." - ) - ); - }; - - parser.hooks.typeof - .for("System.import") - .tap( - "SystemPlugin", - toConstantDependency(parser, JSON.stringify("function")) - ); - parser.hooks.evaluateTypeof - .for("System.import") - .tap("SystemPlugin", evaluateToString("function")); - parser.hooks.typeof - .for("System") - .tap( - "SystemPlugin", - toConstantDependency(parser, JSON.stringify("object")) - ); - parser.hooks.evaluateTypeof - .for("System") - .tap("SystemPlugin", evaluateToString("object")); - - setNotSupported("System.set"); - setNotSupported("System.get"); - setNotSupported("System.register"); - - parser.hooks.expression.for("System").tap("SystemPlugin", expr => { - const dep = new ConstDependency(RuntimeGlobals.system, expr.range, [ - RuntimeGlobals.system - ]); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; - }); - - parser.hooks.call.for("System.import").tap("SystemPlugin", expr => { - parser.state.module.addWarning( - new SystemImportDeprecationWarning(expr.loc) - ); - - return parser.hooks.importCall.call({ - type: "ImportExpression", - source: expr.arguments[0], - loc: expr.loc, - range: expr.range - }); - }); - }; - - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("SystemPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("SystemPlugin", handler); - } - ); - } -} - -class SystemImportDeprecationWarning extends WebpackError { - constructor(loc) { - super( - "System.import() is deprecated and will be removed soon. Use import() instead.\n" + - "For more info visit https://webpack.js.org/guides/code-splitting/" - ); - - this.name = "SystemImportDeprecationWarning"; - - this.loc = loc; - } -} - -makeSerializable( - SystemImportDeprecationWarning, - "webpack/lib/dependencies/SystemPlugin", - "SystemImportDeprecationWarning" -); - -module.exports = SystemPlugin; -module.exports.SystemImportDeprecationWarning = SystemImportDeprecationWarning; - - -/***/ }), - -/***/ 85439: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); - -class SystemRuntimeModule extends RuntimeModule { - constructor() { - super("system"); - } - - /** - * @returns {string} runtime code - */ - generate() { - return Template.asString([ - `${RuntimeGlobals.system} = {`, - Template.indent([ - "import: function () {", - Template.indent( - "throw new Error('System.import cannot be used indirectly');" - ), - "}" - ]), - "};" - ]); + const chunksInOccurrenceOrder = Array.from(chunks).sort((a, b) => { + if (prioritiseInitial) { + const aEntryOccurs = occursInInitialChunksMap.get(a); + const bEntryOccurs = occursInInitialChunksMap.get(b); + if (aEntryOccurs > bEntryOccurs) return -1; + if (aEntryOccurs < bEntryOccurs) return 1; + } + const aOccurs = a.getNumberOfGroups(); + const bOccurs = b.getNumberOfGroups(); + if (aOccurs > bOccurs) return -1; + if (aOccurs < bOccurs) return 1; + return compareNatural(a, b); + }); + assignAscendingChunkIds(chunksInOccurrenceOrder, compilation); + }); + }); } } -module.exports = SystemRuntimeModule; +module.exports = OccurrenceChunkIdsPlugin; /***/ }), -/***/ 58612: +/***/ 35371: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ -const RuntimeGlobals = __webpack_require__(16475); const { - getDependencyUsedByExportsCondition -} = __webpack_require__(38988); -const makeSerializable = __webpack_require__(33032); -const memoize = __webpack_require__(78676); -const ModuleDependency = __webpack_require__(80321); + compareModulesByPreOrderIndexOrIdentifier +} = __webpack_require__(29579); +const createSchemaValidation = __webpack_require__(32540); +const { + assignAscendingModuleIds, + getUsedModuleIdsAndModules +} = __webpack_require__(63290); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../../declarations/plugins/ids/OccurrenceModuleIdsPlugin").OccurrenceModuleIdsPluginOptions} OccurrenceModuleIdsPluginOptions */ +/** @typedef {import("../Compiler")} Compiler */ /** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ /** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - -const getRawDataUrlModule = memoize(() => __webpack_require__(19684)); - -class URLDependency extends ModuleDependency { - /** - * @param {string} request request - * @param {[number, number]} range range of the arguments of new URL( |> ... <| ) - * @param {[number, number]} outerRange range of the full |> new URL(...) <| - * @param {boolean=} relative use relative urls instead of absolute with base uri - */ - constructor(request, range, outerRange, relative) { - super(request); - this.range = range; - this.outerRange = outerRange; - this.relative = relative || false; - /** @type {Set | boolean} */ - this.usedByExports = undefined; - } - - get type() { - return "new URL()"; - } - get category() { - return "url"; +const validate = createSchemaValidation( + __webpack_require__(14916), + () => __webpack_require__(19330), + { + name: "Occurrence Order Module Ids Plugin", + baseDataPath: "options" } +); +class OccurrenceModuleIdsPlugin { /** - * @param {ModuleGraph} moduleGraph module graph - * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active + * @param {OccurrenceModuleIdsPluginOptions=} options options object */ - getCondition(moduleGraph) { - return getDependencyUsedByExportsCondition( - this, - this.usedByExports, - moduleGraph - ); + constructor(options = {}) { + validate(options); + this.options = options; } /** - * @param {string} context context directory - * @returns {Module} a module + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - createIgnoredModule(context) { - const RawDataUrlModule = getRawDataUrlModule(); - return new RawDataUrlModule("data:,", `ignored-asset`, `(ignored asset)`); - } + apply(compiler) { + const prioritiseInitial = this.options.prioritiseInitial; + compiler.hooks.compilation.tap("OccurrenceModuleIdsPlugin", compilation => { + const moduleGraph = compilation.moduleGraph; - serialize(context) { - const { write } = context; - write(this.outerRange); - write(this.relative); - write(this.usedByExports); - super.serialize(context); - } + compilation.hooks.moduleIds.tap("OccurrenceModuleIdsPlugin", () => { + const chunkGraph = compilation.chunkGraph; - deserialize(context) { - const { read } = context; - this.outerRange = read(); - this.relative = read(); - this.usedByExports = read(); - super.deserialize(context); - } -} + const [usedIds, modulesInOccurrenceOrder] = + getUsedModuleIdsAndModules(compilation); -URLDependency.Template = class URLDependencyTemplate extends ( - ModuleDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, templateContext) { - const { - chunkGraph, - moduleGraph, - runtimeRequirements, - runtimeTemplate, - runtime - } = templateContext; - const dep = /** @type {URLDependency} */ (dependency); - const connection = moduleGraph.getConnection(dep); - // Skip rendering depending when dependency is conditional - if (connection && !connection.isTargetActive(runtime)) { - source.replace( - dep.outerRange[0], - dep.outerRange[1] - 1, - "/* unused asset import */ undefined" - ); - return; - } + const occursInInitialChunksMap = new Map(); + const occursInAllChunksMap = new Map(); - runtimeRequirements.add(RuntimeGlobals.require); + const initialChunkChunkMap = new Map(); + const entryCountMap = new Map(); + for (const m of modulesInOccurrenceOrder) { + let initial = 0; + let entry = 0; + for (const c of chunkGraph.getModuleChunksIterable(m)) { + if (c.canBeInitial()) initial++; + if (chunkGraph.isEntryModuleInChunk(m, c)) entry++; + } + initialChunkChunkMap.set(m, initial); + entryCountMap.set(m, entry); + } - if (dep.relative) { - runtimeRequirements.add(RuntimeGlobals.relativeUrl); - source.replace( - dep.outerRange[0], - dep.outerRange[1] - 1, - `/* asset import */ new ${ - RuntimeGlobals.relativeUrl - }(${runtimeTemplate.moduleRaw({ - chunkGraph, - module: moduleGraph.getModule(dep), - request: dep.request, - runtimeRequirements, - weak: false - })})` - ); - } else { - runtimeRequirements.add(RuntimeGlobals.baseURI); + /** + * @param {Module} module module + * @returns {number} count of occurs + */ + const countOccursInEntry = module => { + let sum = 0; + for (const [ + originModule, + connections + ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { + if (!originModule) continue; + if (!connections.some(c => c.isTargetActive(undefined))) continue; + sum += initialChunkChunkMap.get(originModule); + } + return sum; + }; - source.replace( - dep.range[0], - dep.range[1] - 1, - `/* asset import */ ${runtimeTemplate.moduleRaw({ - chunkGraph, - module: moduleGraph.getModule(dep), - request: dep.request, - runtimeRequirements, - weak: false - })}, ${RuntimeGlobals.baseURI}` - ); - } - } -}; + /** + * @param {Module} module module + * @returns {number} count of occurs + */ + const countOccurs = module => { + let sum = 0; + for (const [ + originModule, + connections + ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { + if (!originModule) continue; + const chunkModules = + chunkGraph.getNumberOfModuleChunks(originModule); + for (const c of connections) { + if (!c.isTargetActive(undefined)) continue; + if (!c.dependency) continue; + const factor = c.dependency.getNumberOfIdOccurrences(); + if (factor === 0) continue; + sum += factor * chunkModules; + } + } + return sum; + }; -makeSerializable(URLDependency, "webpack/lib/dependencies/URLDependency"); + if (prioritiseInitial) { + for (const m of modulesInOccurrenceOrder) { + const result = + countOccursInEntry(m) + + initialChunkChunkMap.get(m) + + entryCountMap.get(m); + occursInInitialChunksMap.set(m, result); + } + } -module.exports = URLDependency; + for (const m of modulesInOccurrenceOrder) { + const result = + countOccurs(m) + + chunkGraph.getNumberOfModuleChunks(m) + + entryCountMap.get(m); + occursInAllChunksMap.set(m, result); + } + + const naturalCompare = compareModulesByPreOrderIndexOrIdentifier( + compilation.moduleGraph + ); + + modulesInOccurrenceOrder.sort((a, b) => { + if (prioritiseInitial) { + const aEntryOccurs = occursInInitialChunksMap.get(a); + const bEntryOccurs = occursInInitialChunksMap.get(b); + if (aEntryOccurs > bEntryOccurs) return -1; + if (aEntryOccurs < bEntryOccurs) return 1; + } + const aOccurs = occursInAllChunksMap.get(a); + const bOccurs = occursInAllChunksMap.get(b); + if (aOccurs > bOccurs) return -1; + if (aOccurs < bOccurs) return 1; + return naturalCompare(a, b); + }); + + assignAscendingModuleIds( + usedIds, + modulesInOccurrenceOrder, + compilation + ); + }); + }); + } +} + +module.exports = OccurrenceModuleIdsPlugin; /***/ }), -/***/ 14412: +/***/ 8635: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ -const { approve } = __webpack_require__(93998); -const InnerGraph = __webpack_require__(38988); -const URLDependency = __webpack_require__(58612); +const { WebpackError } = __webpack_require__(91919); +const { getUsedModuleIdsAndModules } = __webpack_require__(63290); -/** @typedef {import("estree").NewExpression} NewExpressionNode */ /** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ +/** @typedef {import("../Module")} Module */ -class URLPlugin { +const plugin = "SyncModuleIdsPlugin"; + +class SyncModuleIdsPlugin { /** - * @param {Compiler} compiler compiler + * @param {Object} options options + * @param {string} options.path path to file + * @param {string=} options.context context for module names + * @param {function(Module): boolean} options.test selector for modules + * @param {"read" | "create" | "merge" | "update"=} options.mode operation mode (defaults to merge) */ - apply(compiler) { - compiler.hooks.compilation.tap( - "URLPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set(URLDependency, normalModuleFactory); - compilation.dependencyTemplates.set( - URLDependency, - new URLDependency.Template() - ); - - /** - * @param {JavascriptParser} parser parser - * @param {object} parserOptions options - */ - const parserCallback = (parser, parserOptions) => { - if (parserOptions.url === false) return; - const relative = parserOptions.url === "relative"; - - /** - * @param {NewExpressionNode} expr expression - * @returns {undefined | string} request - */ - const getUrlRequest = expr => { - if (expr.arguments.length !== 2) return; - - const [arg1, arg2] = expr.arguments; - - if ( - arg2.type !== "MemberExpression" || - arg1.type === "SpreadElement" - ) - return; - - const chain = parser.extractMemberExpressionChain(arg2); - - if ( - chain.members.length !== 1 || - chain.object.type !== "MetaProperty" || - chain.object.meta.name !== "import" || - chain.object.property.name !== "meta" || - chain.members[0] !== "url" - ) - return; - - const request = parser.evaluateExpression(arg1).asString(); - - return request; - }; - - parser.hooks.canRename.for("URL").tap("URLPlugin", approve); - parser.hooks.new.for("URL").tap("URLPlugin", _expr => { - const expr = /** @type {NewExpressionNode} */ (_expr); - - const request = getUrlRequest(expr); - - if (!request) return; + constructor({ path, context, test, mode }) { + this._path = path; + this._context = context; + this._test = test || (() => true); + const readAndWrite = !mode || mode === "merge" || mode === "update"; + this._read = readAndWrite || mode === "read"; + this._write = readAndWrite || mode === "create"; + this._prune = mode === "update"; + } - const [arg1, arg2] = expr.arguments; - const dep = new URLDependency( - request, - [arg1.range[0], arg2.range[1]], - expr.range, - relative - ); - dep.loc = expr.loc; - parser.state.current.addDependency(dep); - InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); - return true; - }); - parser.hooks.isPure.for("NewExpression").tap("URLPlugin", _expr => { - const expr = /** @type {NewExpressionNode} */ (_expr); - const { callee } = expr; - if (callee.type !== "Identifier") return; - const calleeInfo = parser.getFreeInfoFromVariable(callee.name); - if (!calleeInfo || calleeInfo.name !== "URL") return; - - const request = getUrlRequest(expr); - - if (request) return true; - }); - }; - - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("URLPlugin", parserCallback); - - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("URLPlugin", parserCallback); + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + /** @type {Map} */ + let data; + let dataChanged = false; + if (this._read) { + compiler.hooks.readRecords.tapAsync(plugin, callback => { + const fs = compiler.intermediateFileSystem; + fs.readFile(this._path, (err, buffer) => { + if (err) { + if (err.code !== "ENOENT") { + return callback(err); + } + return callback(); + } + const json = JSON.parse(buffer.toString()); + data = new Map(); + for (const key of Object.keys(json)) { + data.set(key, json[key]); + } + dataChanged = false; + return callback(); + }); + }); + } + if (this._write) { + compiler.hooks.emitRecords.tapAsync(plugin, callback => { + if (!data || !dataChanged) return callback(); + const json = {}; + const sorted = Array.from(data).sort(([a], [b]) => (a < b ? -1 : 1)); + for (const [key, value] of sorted) { + json[key] = value; + } + const fs = compiler.intermediateFileSystem; + fs.writeFile(this._path, JSON.stringify(json), callback); + }); + } + compiler.hooks.thisCompilation.tap(plugin, compilation => { + const associatedObjectForCache = compiler.root; + const context = this._context || compiler.context; + if (this._read) { + compilation.hooks.reviveModules.tap(plugin, (_1, _2) => { + if (!data) return; + const { chunkGraph } = compilation; + const [usedIds, modules] = getUsedModuleIdsAndModules( + compilation, + this._test + ); + for (const module of modules) { + const name = module.libIdent({ + context, + associatedObjectForCache + }); + if (!name) continue; + const id = data.get(name); + const idAsString = `${id}`; + if (usedIds.has(idAsString)) { + const err = new WebpackError( + `SyncModuleIdsPlugin: Unable to restore id '${id}' from '${this._path}' as it's already used.` + ); + err.module = module; + compilation.errors.push(err); + } + chunkGraph.setModuleId(module, id); + usedIds.add(idAsString); + } + }); } - ); + if (this._write) { + compilation.hooks.recordModules.tap(plugin, modules => { + const { chunkGraph } = compilation; + let oldData = data; + if (!oldData) { + oldData = data = new Map(); + } else if (this._prune) { + data = new Map(); + } + for (const module of modules) { + if (this._test(module)) { + const name = module.libIdent({ + context, + associatedObjectForCache + }); + if (!name) continue; + const id = chunkGraph.getModuleId(module); + if (id === null) continue; + const oldId = oldData.get(name); + if (oldId !== id) { + dataChanged = true; + } else if (data === oldData) { + continue; + } + data.set(name, id); + } + } + if (data.size !== oldData.size) dataChanged = true; + }); + } + }); } } -module.exports = URLPlugin; +module.exports = SyncModuleIdsPlugin; /***/ }), -/***/ 51669: +/***/ 91919: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -91324,160 +87974,583 @@ module.exports = URLPlugin; -const makeSerializable = __webpack_require__(33032); -const NullDependency = __webpack_require__(31830); +const util = __webpack_require__(73837); +const memoize = __webpack_require__(78676); -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../declarations/WebpackOptions").Entry} Entry */ +/** @typedef {import("../declarations/WebpackOptions").EntryNormalized} EntryNormalized */ +/** @typedef {import("../declarations/WebpackOptions").EntryObject} EntryObject */ +/** @typedef {import("../declarations/WebpackOptions").FileCacheOptions} FileCacheOptions */ +/** @typedef {import("../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../declarations/WebpackOptions").ModuleOptions} ModuleOptions */ +/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ +/** @typedef {import("../declarations/WebpackOptions").RuleSetCondition} RuleSetCondition */ +/** @typedef {import("../declarations/WebpackOptions").RuleSetConditionAbsolute} RuleSetConditionAbsolute */ +/** @typedef {import("../declarations/WebpackOptions").RuleSetRule} RuleSetRule */ +/** @typedef {import("../declarations/WebpackOptions").RuleSetUse} RuleSetUse */ +/** @typedef {import("../declarations/WebpackOptions").RuleSetUseItem} RuleSetUseItem */ +/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} Configuration */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptionsNormalized */ +/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */ +/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */ +/** @typedef {import("./Compilation").Asset} Asset */ +/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("./Compilation").EntryOptions} EntryOptions */ +/** @typedef {import("./Compiler").AssetEmittedInfo} AssetEmittedInfo */ +/** @typedef {import("./MultiStats")} MultiStats */ +/** @typedef {import("./Parser").ParserState} ParserState */ +/** @typedef {import("./ResolverFactory").ResolvePluginInstance} ResolvePluginInstance */ +/** @typedef {import("./ResolverFactory").Resolver} Resolver */ +/** @typedef {import("./Watching")} Watching */ +/** @typedef {import("./cli").Argument} Argument */ +/** @typedef {import("./cli").Problem} Problem */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunk} StatsChunk */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunkGroup} StatsChunkGroup */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunkOrigin} StatsChunkOrigin */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsError} StatsError */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsLogging} StatsLogging */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsLoggingEntry} StatsLoggingEntry */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModule} StatsModule */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleIssuer} StatsModuleIssuer */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleReason} StatsModuleReason */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleTraceDependency} StatsModuleTraceDependency */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleTraceItem} StatsModuleTraceItem */ +/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsProfile} StatsProfile */ -class UnsupportedDependency extends NullDependency { - constructor(request, range) { - super(); +/** + * @template {Function} T + * @param {function(): T} factory factory function + * @returns {T} function + */ +const lazyFunction = factory => { + const fac = memoize(factory); + const f = /** @type {any} */ ( + (...args) => { + return fac()(...args); + } + ); + return /** @type {T} */ (f); +}; - this.request = request; - this.range = range; +/** + * @template A + * @template B + * @param {A} obj input a + * @param {B} exports input b + * @returns {A & B} merged + */ +const mergeExports = (obj, exports) => { + const descriptors = Object.getOwnPropertyDescriptors(exports); + for (const name of Object.keys(descriptors)) { + const descriptor = descriptors[name]; + if (descriptor.get) { + const fn = descriptor.get; + Object.defineProperty(obj, name, { + configurable: false, + enumerable: true, + get: memoize(fn) + }); + } else if (typeof descriptor.value === "object") { + Object.defineProperty(obj, name, { + configurable: false, + enumerable: true, + writable: false, + value: mergeExports({}, descriptor.value) + }); + } else { + throw new Error( + "Exposed values must be either a getter or an nested object" + ); + } } + return /** @type {A & B} */ (Object.freeze(obj)); +}; - serialize(context) { - const { write } = context; +const fn = lazyFunction(() => __webpack_require__(36243)); +module.exports = mergeExports(fn, { + get webpack() { + return __webpack_require__(36243); + }, + get validate() { + const webpackOptionsSchemaCheck = __webpack_require__(10382); + const getRealValidate = memoize(() => { + const validateSchema = __webpack_require__(12047); + const webpackOptionsSchema = __webpack_require__(73342); + return options => validateSchema(webpackOptionsSchema, options); + }); + return options => { + if (!webpackOptionsSchemaCheck(options)) getRealValidate()(options); + }; + }, + get validateSchema() { + const validateSchema = __webpack_require__(12047); + return validateSchema; + }, + get version() { + return /** @type {string} */ ((__webpack_require__(32702)/* .version */ .i8)); + }, - write(this.request); - write(this.range); + get cli() { + return __webpack_require__(13462); + }, + get AutomaticPrefetchPlugin() { + return __webpack_require__(17714); + }, + get AsyncDependenciesBlock() { + return __webpack_require__(47736); + }, + get BannerPlugin() { + return __webpack_require__(21242); + }, + get Cache() { + return __webpack_require__(7592); + }, + get Chunk() { + return __webpack_require__(39385); + }, + get ChunkGraph() { + return __webpack_require__(64971); + }, + get CleanPlugin() { + return __webpack_require__(31085); + }, + get Compilation() { + return __webpack_require__(85720); + }, + get Compiler() { + return __webpack_require__(70845); + }, + get ConcatenationScope() { + return __webpack_require__(98229); + }, + get ContextExclusionPlugin() { + return __webpack_require__(21411); + }, + get ContextReplacementPlugin() { + return __webpack_require__(12206); + }, + get DefinePlugin() { + return __webpack_require__(79065); + }, + get DelegatedPlugin() { + return __webpack_require__(80632); + }, + get Dependency() { + return __webpack_require__(54912); + }, + get DllPlugin() { + return __webpack_require__(40038); + }, + get DllReferencePlugin() { + return __webpack_require__(90999); + }, + get DynamicEntryPlugin() { + return __webpack_require__(96475); + }, + get EntryOptionPlugin() { + return __webpack_require__(9909); + }, + get EntryPlugin() { + return __webpack_require__(96953); + }, + get EnvironmentPlugin() { + return __webpack_require__(22070); + }, + get EvalDevToolModulePlugin() { + return __webpack_require__(65218); + }, + get EvalSourceMapDevToolPlugin() { + return __webpack_require__(14790); + }, + get ExternalModule() { + return __webpack_require__(73071); + }, + get ExternalsPlugin() { + return __webpack_require__(6652); + }, + get Generator() { + return __webpack_require__(93401); + }, + get HotUpdateChunk() { + return __webpack_require__(9597); + }, + get HotModuleReplacementPlugin() { + return __webpack_require__(6404); + }, + get IgnorePlugin() { + return __webpack_require__(84808); + }, + get JavascriptModulesPlugin() { + return util.deprecate( + () => __webpack_require__(89464), + "webpack.JavascriptModulesPlugin has moved to webpack.javascript.JavascriptModulesPlugin", + "DEP_WEBPACK_JAVASCRIPT_MODULES_PLUGIN" + )(); + }, + get LibManifestPlugin() { + return __webpack_require__(93837); + }, + get LibraryTemplatePlugin() { + return util.deprecate( + () => __webpack_require__(14157), + "webpack.LibraryTemplatePlugin is deprecated and has been replaced by compilation.outputOptions.library or compilation.addEntry + passing a library option", + "DEP_WEBPACK_LIBRARY_TEMPLATE_PLUGIN" + )(); + }, + get LoaderOptionsPlugin() { + return __webpack_require__(22078); + }, + get LoaderTargetPlugin() { + return __webpack_require__(86738); + }, + get Module() { + return __webpack_require__(73208); + }, + get ModuleFilenameHelpers() { + return __webpack_require__(88821); + }, + get ModuleGraph() { + return __webpack_require__(99988); + }, + get ModuleGraphConnection() { + return __webpack_require__(40639); + }, + get NoEmitOnErrorsPlugin() { + return __webpack_require__(50169); + }, + get NormalModule() { + return __webpack_require__(39); + }, + get NormalModuleReplacementPlugin() { + return __webpack_require__(30633); + }, + get MultiCompiler() { + return __webpack_require__(33370); + }, + get Parser() { + return __webpack_require__(11715); + }, + get PrefetchPlugin() { + return __webpack_require__(73850); + }, + get ProgressPlugin() { + return __webpack_require__(13216); + }, + get ProvidePlugin() { + return __webpack_require__(38309); + }, + get RuntimeGlobals() { + return __webpack_require__(16475); + }, + get RuntimeModule() { + return __webpack_require__(16963); + }, + get SingleEntryPlugin() { + return util.deprecate( + () => __webpack_require__(96953), + "SingleEntryPlugin was renamed to EntryPlugin", + "DEP_WEBPACK_SINGLE_ENTRY_PLUGIN" + )(); + }, + get SourceMapDevToolPlugin() { + return __webpack_require__(63872); + }, + get Stats() { + return __webpack_require__(31743); + }, + get Template() { + return __webpack_require__(1626); + }, + get UsageState() { + return (__webpack_require__(63686).UsageState); + }, + get WatchIgnorePlugin() { + return __webpack_require__(65193); + }, + get WebpackError() { + return __webpack_require__(53799); + }, + get WebpackOptionsApply() { + return __webpack_require__(88422); + }, + get WebpackOptionsDefaulter() { + return util.deprecate( + () => __webpack_require__(14452), + "webpack.WebpackOptionsDefaulter is deprecated and has been replaced by webpack.config.getNormalizedWebpackOptions and webpack.config.applyWebpackOptionsDefaults", + "DEP_WEBPACK_OPTIONS_DEFAULTER" + )(); + }, + // TODO webpack 6 deprecate + get WebpackOptionsValidationError() { + return (__webpack_require__(38476).ValidationError); + }, + get ValidationError() { + return (__webpack_require__(38476).ValidationError); + }, - super.serialize(context); - } + cache: { + get MemoryCachePlugin() { + return __webpack_require__(52539); + } + }, - deserialize(context) { - const { read } = context; + config: { + get getNormalizedWebpackOptions() { + return (__webpack_require__(26693).getNormalizedWebpackOptions); + }, + get applyWebpackOptionsDefaults() { + return (__webpack_require__(92988).applyWebpackOptionsDefaults); + } + }, - this.request = read(); - this.range = read(); + dependencies: { + get ModuleDependency() { + return __webpack_require__(80321); + }, + get ConstDependency() { + return __webpack_require__(76911); + }, + get NullDependency() { + return __webpack_require__(31830); + } + }, - super.deserialize(context); - } -} + ids: { + get ChunkModuleIdRangePlugin() { + return __webpack_require__(64618); + }, + get NaturalModuleIdsPlugin() { + return __webpack_require__(83366); + }, + get OccurrenceModuleIdsPlugin() { + return __webpack_require__(35371); + }, + get NamedModuleIdsPlugin() { + return __webpack_require__(24339); + }, + get DeterministicChunkIdsPlugin() { + return __webpack_require__(8747); + }, + get DeterministicModuleIdsPlugin() { + return __webpack_require__(76692); + }, + get NamedChunkIdsPlugin() { + return __webpack_require__(6454); + }, + get OccurrenceChunkIdsPlugin() { + return __webpack_require__(51020); + }, + get HashedModuleIdsPlugin() { + return __webpack_require__(21825); + } + }, -makeSerializable( - UnsupportedDependency, - "webpack/lib/dependencies/UnsupportedDependency" -); - -UnsupportedDependency.Template = class UnsupportedDependencyTemplate extends ( - NullDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, { runtimeTemplate }) { - const dep = /** @type {UnsupportedDependency} */ (dependency); - - source.replace( - dep.range[0], - dep.range[1], - runtimeTemplate.missingModule({ - request: dep.request - }) - ); - } -}; - -module.exports = UnsupportedDependency; - - -/***/ }), - -/***/ 52204: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + javascript: { + get EnableChunkLoadingPlugin() { + return __webpack_require__(61291); + }, + get JavascriptModulesPlugin() { + return __webpack_require__(89464); + }, + get JavascriptParser() { + return __webpack_require__(29050); + } + }, + optimize: { + get AggressiveMergingPlugin() { + return __webpack_require__(64395); + }, + get AggressiveSplittingPlugin() { + return util.deprecate( + () => __webpack_require__(15543), + "AggressiveSplittingPlugin is deprecated in favor of SplitChunksPlugin", + "DEP_WEBPACK_AGGRESSIVE_SPLITTING_PLUGIN" + )(); + }, + get InnerGraph() { + return __webpack_require__(38988); + }, + get LimitChunkCountPlugin() { + return __webpack_require__(83608); + }, + get MinChunkSizePlugin() { + return __webpack_require__(53912); + }, + get ModuleConcatenationPlugin() { + return __webpack_require__(74844); + }, + get RealContentHashPlugin() { + return __webpack_require__(46043); + }, + get RuntimeChunkPlugin() { + return __webpack_require__(2837); + }, + get SideEffectsFlagPlugin() { + return __webpack_require__(84800); + }, + get SplitChunksPlugin() { + return __webpack_require__(21478); + } + }, + runtime: { + get GetChunkFilenameRuntimeModule() { + return __webpack_require__(34277); + }, + get LoadScriptRuntimeModule() { + return __webpack_require__(19942); + } + }, -const Dependency = __webpack_require__(54912); -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); + prefetch: { + get ChunkPrefetchPreloadPlugin() { + return __webpack_require__(33895); + } + }, -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + web: { + get FetchCompileAsyncWasmPlugin() { + return __webpack_require__(8437); + }, + get FetchCompileWasmPlugin() { + return __webpack_require__(35537); + }, + get JsonpChunkLoadingRuntimeModule() { + return __webpack_require__(84154); + }, + get JsonpTemplatePlugin() { + return __webpack_require__(4607); + } + }, -class WebAssemblyExportImportedDependency extends ModuleDependency { - constructor(exportName, request, name, valueType) { - super(request); - /** @type {string} */ - this.exportName = exportName; - /** @type {string} */ - this.name = name; - /** @type {string} */ - this.valueType = valueType; - } + webworker: { + get WebWorkerTemplatePlugin() { + return __webpack_require__(68693); + } + }, - /** - * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module - */ - couldAffectReferencingModule() { - return Dependency.TRANSITIVE; - } + node: { + get NodeEnvironmentPlugin() { + return __webpack_require__(7553); + }, + get NodeSourcePlugin() { + return __webpack_require__(7103); + }, + get NodeTargetPlugin() { + return __webpack_require__(17916); + }, + get NodeTemplatePlugin() { + return __webpack_require__(61052); + }, + get ReadFileCompileWasmPlugin() { + return __webpack_require__(98939); + } + }, - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - return [[this.name]]; - } + electron: { + get ElectronTargetPlugin() { + return __webpack_require__(32277); + } + }, - get type() { - return "wasm export import"; - } + wasm: { + get AsyncWebAssemblyModulesPlugin() { + return __webpack_require__(7538); + } + }, - get category() { - return "wasm"; - } + library: { + get AbstractLibraryPlugin() { + return __webpack_require__(26030); + }, + get EnableLibraryPlugin() { + return __webpack_require__(91452); + } + }, - serialize(context) { - const { write } = context; + container: { + get ContainerPlugin() { + return __webpack_require__(9244); + }, + get ContainerReferencePlugin() { + return __webpack_require__(95757); + }, + get ModuleFederationPlugin() { + return __webpack_require__(30569); + }, + get scope() { + return (__webpack_require__(3083).scope); + } + }, - write(this.exportName); - write(this.name); - write(this.valueType); + sharing: { + get ConsumeSharedPlugin() { + return __webpack_require__(15046); + }, + get ProvideSharedPlugin() { + return __webpack_require__(31225); + }, + get SharePlugin() { + return __webpack_require__(26335); + }, + get scope() { + return (__webpack_require__(3083).scope); + } + }, - super.serialize(context); - } + debug: { + get ProfilingPlugin() { + return __webpack_require__(2757); + } + }, - deserialize(context) { - const { read } = context; + util: { + get createHash() { + return __webpack_require__(49835); + }, + get comparators() { + return __webpack_require__(29579); + }, + get runtime() { + return __webpack_require__(17156); + }, + get serialization() { + return __webpack_require__(8282); + }, + get cleverMerge() { + return (__webpack_require__(60839).cachedCleverMerge); + }, + get LazySet() { + return __webpack_require__(38938); + } + }, - this.exportName = read(); - this.name = read(); - this.valueType = read(); + get sources() { + return __webpack_require__(51255); + }, - super.deserialize(context); + experiments: { + schemes: { + get HttpUriPlugin() { + return __webpack_require__(42110); + } + }, + ids: { + get SyncModuleIdsPlugin() { + return __webpack_require__(8635); + } + } } -} - -makeSerializable( - WebAssemblyExportImportedDependency, - "webpack/lib/dependencies/WebAssemblyExportImportedDependency" -); - -module.exports = WebAssemblyExportImportedDependency; +}); /***/ }), -/***/ 5239: +/***/ 18535: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -91488,714 +88561,647 @@ module.exports = WebAssemblyExportImportedDependency; -const makeSerializable = __webpack_require__(33032); -const UnsupportedWebAssemblyFeatureError = __webpack_require__(78455); -const ModuleDependency = __webpack_require__(80321); - -/** @typedef {import("@webassemblyjs/ast").ModuleImportDescription} ModuleImportDescription */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - -class WebAssemblyImportDependency extends ModuleDependency { - /** - * @param {string} request the request - * @param {string} name the imported name - * @param {ModuleImportDescription} description the WASM ast node - * @param {false | string} onlyDirectImport if only direct imports are allowed - */ - constructor(request, name, description, onlyDirectImport) { - super(request); - /** @type {string} */ - this.name = name; - /** @type {ModuleImportDescription} */ - this.description = description; - /** @type {false | string} */ - this.onlyDirectImport = onlyDirectImport; - } - - get type() { - return "wasm import"; - } - - get category() { - return "wasm"; - } +const { ConcatSource, PrefixSource, RawSource } = __webpack_require__(51255); +const { RuntimeGlobals } = __webpack_require__(91919); +const HotUpdateChunk = __webpack_require__(9597); +const Template = __webpack_require__(1626); +const { getCompilationHooks } = __webpack_require__(89464); +const { + generateEntryStartup, + updateHashForEntryStartup +} = __webpack_require__(98124); - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - return [[this.name]]; - } +/** @typedef {import("../Compiler")} Compiler */ +class ArrayPushCallbackChunkFormatPlugin { /** - * Returns errors - * @param {ModuleGraph} moduleGraph module graph - * @returns {WebpackError[]} errors + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - getErrors(moduleGraph) { - const module = moduleGraph.getModule(this); - - if ( - this.onlyDirectImport && - module && - !module.type.startsWith("webassembly") - ) { - return [ - new UnsupportedWebAssemblyFeatureError( - `Import "${this.name}" from "${this.request}" with ${this.onlyDirectImport} can only be used for direct wasm to wasm dependencies` - ) - ]; - } - } - - serialize(context) { - const { write } = context; - - write(this.name); - write(this.description); - write(this.onlyDirectImport); - - super.serialize(context); - } - - deserialize(context) { - const { read } = context; - - this.name = read(); - this.description = read(); - this.onlyDirectImport = read(); - - super.deserialize(context); + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "ArrayPushCallbackChunkFormatPlugin", + compilation => { + compilation.hooks.additionalChunkRuntimeRequirements.tap( + "ArrayPushCallbackChunkFormatPlugin", + (chunk, set, { chunkGraph }) => { + if (chunk.hasRuntime()) return; + if (chunkGraph.getNumberOfEntryModules(chunk) > 0) { + set.add(RuntimeGlobals.onChunksLoaded); + set.add(RuntimeGlobals.require); + } + set.add(RuntimeGlobals.chunkCallback); + } + ); + const hooks = getCompilationHooks(compilation); + hooks.renderChunk.tap( + "ArrayPushCallbackChunkFormatPlugin", + (modules, renderContext) => { + const { chunk, chunkGraph, runtimeTemplate } = renderContext; + const hotUpdateChunk = + chunk instanceof HotUpdateChunk ? chunk : null; + const globalObject = runtimeTemplate.globalObject; + const source = new ConcatSource(); + const runtimeModules = + chunkGraph.getChunkRuntimeModulesInOrder(chunk); + if (hotUpdateChunk) { + const hotUpdateGlobal = + runtimeTemplate.outputOptions.hotUpdateGlobal; + source.add( + `${globalObject}[${JSON.stringify(hotUpdateGlobal)}](` + ); + source.add(`${JSON.stringify(chunk.id)},`); + source.add(modules); + if (runtimeModules.length > 0) { + source.add(",\n"); + const runtimePart = Template.renderChunkRuntimeModules( + runtimeModules, + renderContext + ); + source.add(runtimePart); + } + source.add(")"); + } else { + const chunkLoadingGlobal = + runtimeTemplate.outputOptions.chunkLoadingGlobal; + source.add( + `(${globalObject}[${JSON.stringify( + chunkLoadingGlobal + )}] = ${globalObject}[${JSON.stringify( + chunkLoadingGlobal + )}] || []).push([` + ); + source.add(`${JSON.stringify(chunk.ids)},`); + source.add(modules); + const entries = Array.from( + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ); + if (runtimeModules.length > 0 || entries.length > 0) { + const runtime = new ConcatSource( + (runtimeTemplate.supportsArrowFunction() + ? "__webpack_require__ =>" + : "function(__webpack_require__)") + + " { // webpackRuntimeModules\n" + ); + if (runtimeModules.length > 0) { + runtime.add( + Template.renderRuntimeModules(runtimeModules, { + ...renderContext, + codeGenerationResults: compilation.codeGenerationResults + }) + ); + } + if (entries.length > 0) { + const startupSource = new RawSource( + generateEntryStartup( + chunkGraph, + runtimeTemplate, + entries, + chunk, + true + ) + ); + runtime.add( + hooks.renderStartup.call( + startupSource, + entries[entries.length - 1][0], + { + ...renderContext, + inlined: false + } + ) + ); + if ( + chunkGraph + .getChunkRuntimeRequirements(chunk) + .has(RuntimeGlobals.returnExportsFromRuntime) + ) { + runtime.add("return __webpack_exports__;\n"); + } + } + runtime.add("}\n"); + source.add(",\n"); + source.add(new PrefixSource("/******/ ", runtime)); + } + source.add("])"); + } + return source; + } + ); + hooks.chunkHash.tap( + "ArrayPushCallbackChunkFormatPlugin", + (chunk, hash, { chunkGraph, runtimeTemplate }) => { + if (chunk.hasRuntime()) return; + hash.update( + `ArrayPushCallbackChunkFormatPlugin1${runtimeTemplate.outputOptions.chunkLoadingGlobal}${runtimeTemplate.outputOptions.hotUpdateGlobal}${runtimeTemplate.globalObject}` + ); + const entries = Array.from( + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ); + updateHashForEntryStartup(hash, chunkGraph, entries, chunk); + } + ); + } + ); } } -makeSerializable( - WebAssemblyImportDependency, - "webpack/lib/dependencies/WebAssemblyImportDependency" -); - -module.exports = WebAssemblyImportDependency; +module.exports = ArrayPushCallbackChunkFormatPlugin; /***/ }), -/***/ 26505: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 950: +/***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ -const Dependency = __webpack_require__(54912); -const Template = __webpack_require__(39722); -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); +/** @typedef {import("estree").Node} EsTreeNode */ +/** @typedef {import("./JavascriptParser").VariableInfoInterface} VariableInfoInterface */ -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +const TypeUnknown = 0; +const TypeUndefined = 1; +const TypeNull = 2; +const TypeString = 3; +const TypeNumber = 4; +const TypeBoolean = 5; +const TypeRegExp = 6; +const TypeConditional = 7; +const TypeArray = 8; +const TypeConstArray = 9; +const TypeIdentifier = 10; +const TypeWrapped = 11; +const TypeTemplateString = 12; +const TypeBigInt = 13; -class WebpackIsIncludedDependency extends ModuleDependency { - constructor(request, range) { - super(request); +class BasicEvaluatedExpression { + constructor() { + this.type = TypeUnknown; + /** @type {[number, number]} */ + this.range = undefined; + /** @type {boolean} */ + this.falsy = false; + /** @type {boolean} */ + this.truthy = false; + /** @type {boolean | undefined} */ + this.nullish = undefined; + /** @type {boolean} */ + this.sideEffects = true; + /** @type {boolean | undefined} */ + this.bool = undefined; + /** @type {number | undefined} */ + this.number = undefined; + /** @type {bigint | undefined} */ + this.bigint = undefined; + /** @type {RegExp | undefined} */ + this.regExp = undefined; + /** @type {string | undefined} */ + this.string = undefined; + /** @type {BasicEvaluatedExpression[] | undefined} */ + this.quasis = undefined; + /** @type {BasicEvaluatedExpression[] | undefined} */ + this.parts = undefined; + /** @type {any[] | undefined} */ + this.array = undefined; + /** @type {BasicEvaluatedExpression[] | undefined} */ + this.items = undefined; + /** @type {BasicEvaluatedExpression[] | undefined} */ + this.options = undefined; + /** @type {BasicEvaluatedExpression | undefined} */ + this.prefix = undefined; + /** @type {BasicEvaluatedExpression | undefined} */ + this.postfix = undefined; + this.wrappedInnerExpressions = undefined; + /** @type {string | undefined} */ + this.identifier = undefined; + /** @type {VariableInfoInterface} */ + this.rootInfo = undefined; + /** @type {() => string[]} */ + this.getMembers = undefined; + /** @type {EsTreeNode} */ + this.expression = undefined; + } - this.weak = true; - this.range = range; + isUnknown() { + return this.type === TypeUnknown; } - /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports - */ - getReferencedExports(moduleGraph, runtime) { - // This doesn't use any export - return Dependency.NO_EXPORTS_REFERENCED; + isNull() { + return this.type === TypeNull; } - get type() { - return "__webpack_is_included__"; + isUndefined() { + return this.type === TypeUndefined; } -} -makeSerializable( - WebpackIsIncludedDependency, - "webpack/lib/dependencies/WebpackIsIncludedDependency" -); + isString() { + return this.type === TypeString; + } -WebpackIsIncludedDependency.Template = class WebpackIsIncludedDependencyTemplate extends ( - ModuleDependency.Template -) { - /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} - */ - apply(dependency, source, { runtimeTemplate, chunkGraph, moduleGraph }) { - const dep = /** @type {WebpackIsIncludedDependency} */ (dependency); - const connection = moduleGraph.getConnection(dep); - const included = connection - ? chunkGraph.getNumberOfModuleChunks(connection.module) > 0 - : false; - const comment = runtimeTemplate.outputOptions.pathinfo - ? Template.toComment( - `__webpack_is_included__ ${runtimeTemplate.requestShortener.shorten( - dep.request - )}` - ) - : ""; + isNumber() { + return this.type === TypeNumber; + } - source.replace( - dep.range[0], - dep.range[1] - 1, - `${comment}${JSON.stringify(included)}` - ); + isBigInt() { + return this.type === TypeBigInt; } -}; -module.exports = WebpackIsIncludedDependency; + isBoolean() { + return this.type === TypeBoolean; + } + isRegExp() { + return this.type === TypeRegExp; + } -/***/ }), + isConditional() { + return this.type === TypeConditional; + } -/***/ 1466: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + isArray() { + return this.type === TypeArray; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ + isConstArray() { + return this.type === TypeConstArray; + } + isIdentifier() { + return this.type === TypeIdentifier; + } + isWrapped() { + return this.type === TypeWrapped; + } -const Dependency = __webpack_require__(54912); -const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); -const ModuleDependency = __webpack_require__(80321); + isTemplateString() { + return this.type === TypeTemplateString; + } -/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../AsyncDependenciesBlock")} AsyncDependenciesBlock */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../Entrypoint")} Entrypoint */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + /** + * Is expression a primitive or an object type value? + * @returns {boolean | undefined} true: primitive type, false: object type, undefined: unknown/runtime-defined + */ + isPrimitiveType() { + switch (this.type) { + case TypeUndefined: + case TypeNull: + case TypeString: + case TypeNumber: + case TypeBoolean: + case TypeBigInt: + case TypeWrapped: + case TypeTemplateString: + return true; + case TypeRegExp: + case TypeArray: + case TypeConstArray: + return false; + default: + return undefined; + } + } -class WorkerDependency extends ModuleDependency { /** - * @param {string} request request - * @param {[number, number]} range range + * Is expression a runtime or compile-time value? + * @returns {boolean} true: compile time value, false: runtime value */ - constructor(request, range) { - super(request); - this.range = range; + isCompileTimeValue() { + switch (this.type) { + case TypeUndefined: + case TypeNull: + case TypeString: + case TypeNumber: + case TypeBoolean: + case TypeRegExp: + case TypeConstArray: + case TypeBigInt: + return true; + default: + return false; + } } /** - * Returns list of exports referenced by this dependency - * @param {ModuleGraph} moduleGraph module graph - * @param {RuntimeSpec} runtime the runtime for which the module is analysed - * @returns {(string[] | ReferencedExport)[]} referenced exports + * Gets the compile-time value of the expression + * @returns {any} the javascript value */ - getReferencedExports(moduleGraph, runtime) { - return Dependency.NO_EXPORTS_REFERENCED; + asCompileTimeValue() { + switch (this.type) { + case TypeUndefined: + return undefined; + case TypeNull: + return null; + case TypeString: + return this.string; + case TypeNumber: + return this.number; + case TypeBoolean: + return this.bool; + case TypeRegExp: + return this.regExp; + case TypeConstArray: + return this.array; + case TypeBigInt: + return this.bigint; + default: + throw new Error( + "asCompileTimeValue must only be called for compile-time values" + ); + } } - get type() { - return "new Worker()"; + isTruthy() { + return this.truthy; } - get category() { - return "worker"; + isFalsy() { + return this.falsy; + } + + isNullish() { + return this.nullish; } -} -WorkerDependency.Template = class WorkerDependencyTemplate extends ( - ModuleDependency.Template -) { /** - * @param {Dependency} dependency the dependency for which the template should be applied - * @param {ReplaceSource} source the current replace source which can be modified - * @param {DependencyTemplateContext} templateContext the context object - * @returns {void} + * Can this expression have side effects? + * @returns {boolean} false: never has side effects */ - apply(dependency, source, templateContext) { - const { chunkGraph, moduleGraph, runtimeRequirements } = templateContext; - const dep = /** @type {WorkerDependency} */ (dependency); - const block = /** @type {AsyncDependenciesBlock} */ ( - moduleGraph.getParentBlock(dependency) - ); - const entrypoint = /** @type {Entrypoint} */ ( - chunkGraph.getBlockChunkGroup(block) - ); - const chunk = entrypoint.getEntrypointChunk(); - - runtimeRequirements.add(RuntimeGlobals.publicPath); - runtimeRequirements.add(RuntimeGlobals.baseURI); - runtimeRequirements.add(RuntimeGlobals.getChunkScriptFilename); + couldHaveSideEffects() { + return this.sideEffects; + } - source.replace( - dep.range[0], - dep.range[1] - 1, - `/* worker import */ ${RuntimeGlobals.publicPath} + ${ - RuntimeGlobals.getChunkScriptFilename - }(${JSON.stringify(chunk.id)}), ${RuntimeGlobals.baseURI}` - ); + asBool() { + if (this.truthy) return true; + if (this.falsy || this.nullish) return false; + if (this.isBoolean()) return this.bool; + if (this.isNull()) return false; + if (this.isUndefined()) return false; + if (this.isString()) return this.string !== ""; + if (this.isNumber()) return this.number !== 0; + if (this.isBigInt()) return this.bigint !== BigInt(0); + if (this.isRegExp()) return true; + if (this.isArray()) return true; + if (this.isConstArray()) return true; + if (this.isWrapped()) { + return (this.prefix && this.prefix.asBool()) || + (this.postfix && this.postfix.asBool()) + ? true + : undefined; + } + if (this.isTemplateString()) { + const str = this.asString(); + if (typeof str === "string") return str !== ""; + } + return undefined; } -}; -makeSerializable(WorkerDependency, "webpack/lib/dependencies/WorkerDependency"); + asNullish() { + const nullish = this.isNullish(); -module.exports = WorkerDependency; + if (nullish === true || this.isNull() || this.isUndefined()) return true; + if (nullish === false) return false; + if (this.isTruthy()) return false; + if (this.isBoolean()) return false; + if (this.isString()) return false; + if (this.isNumber()) return false; + if (this.isBigInt()) return false; + if (this.isRegExp()) return false; + if (this.isArray()) return false; + if (this.isConstArray()) return false; + if (this.isTemplateString()) return false; + if (this.isRegExp()) return false; -/***/ }), + return undefined; + } -/***/ 82509: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + asString() { + if (this.isBoolean()) return `${this.bool}`; + if (this.isNull()) return "null"; + if (this.isUndefined()) return "undefined"; + if (this.isString()) return this.string; + if (this.isNumber()) return `${this.number}`; + if (this.isBigInt()) return `${this.bigint}`; + if (this.isRegExp()) return `${this.regExp}`; + if (this.isArray()) { + let array = []; + for (const item of this.items) { + const itemStr = item.asString(); + if (itemStr === undefined) return undefined; + array.push(itemStr); + } + return `${array}`; + } + if (this.isConstArray()) return `${this.array}`; + if (this.isTemplateString()) { + let str = ""; + for (const part of this.parts) { + const partStr = part.asString(); + if (partStr === undefined) return undefined; + str += partStr; + } + return str; + } + return undefined; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + setString(string) { + this.type = TypeString; + this.string = string; + this.sideEffects = false; + return this; + } + setUndefined() { + this.type = TypeUndefined; + this.sideEffects = false; + return this; + } + setNull() { + this.type = TypeNull; + this.sideEffects = false; + return this; + } -const { pathToFileURL } = __webpack_require__(57310); -const AsyncDependenciesBlock = __webpack_require__(47736); -const CommentCompilationWarning = __webpack_require__(98427); -const UnsupportedFeatureWarning = __webpack_require__(42495); -const EnableChunkLoadingPlugin = __webpack_require__(61291); -const { equals } = __webpack_require__(84953); -const createHash = __webpack_require__(49835); -const { contextify } = __webpack_require__(82186); -const EnableWasmLoadingPlugin = __webpack_require__(78613); -const ConstDependency = __webpack_require__(76911); -const CreateScriptUrlDependency = __webpack_require__(79062); -const { - harmonySpecifierTag -} = __webpack_require__(20862); -const WorkerDependency = __webpack_require__(1466); + setNumber(number) { + this.type = TypeNumber; + this.number = number; + this.sideEffects = false; + return this; + } -/** @typedef {import("estree").Expression} Expression */ -/** @typedef {import("estree").ObjectExpression} ObjectExpression */ -/** @typedef {import("estree").Pattern} Pattern */ -/** @typedef {import("estree").Property} Property */ -/** @typedef {import("estree").SpreadElement} SpreadElement */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Entrypoint").EntryOptions} EntryOptions */ -/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */ -/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ -/** @typedef {import("./HarmonyImportDependencyParserPlugin").HarmonySettings} HarmonySettings */ + setBigInt(bigint) { + this.type = TypeBigInt; + this.bigint = bigint; + this.sideEffects = false; + return this; + } -const getUrl = module => { - return pathToFileURL(module.resource).toString(); -}; + setBoolean(bool) { + this.type = TypeBoolean; + this.bool = bool; + this.sideEffects = false; + return this; + } -const DEFAULT_SYNTAX = [ - "Worker", - "SharedWorker", - "navigator.serviceWorker.register()", - "Worker from worker_threads" -]; + setRegExp(regExp) { + this.type = TypeRegExp; + this.regExp = regExp; + this.sideEffects = false; + return this; + } -/** @type {WeakMap} */ -const workerIndexMap = new WeakMap(); + setIdentifier(identifier, rootInfo, getMembers) { + this.type = TypeIdentifier; + this.identifier = identifier; + this.rootInfo = rootInfo; + this.getMembers = getMembers; + this.sideEffects = true; + return this; + } -class WorkerPlugin { - constructor(chunkLoading, wasmLoading, module) { - this._chunkLoading = chunkLoading; - this._wasmLoading = wasmLoading; - this._module = module; + setWrapped(prefix, postfix, innerExpressions) { + this.type = TypeWrapped; + this.prefix = prefix; + this.postfix = postfix; + this.wrappedInnerExpressions = innerExpressions; + this.sideEffects = true; + return this; } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - if (this._chunkLoading) { - new EnableChunkLoadingPlugin(this._chunkLoading).apply(compiler); + + setOptions(options) { + this.type = TypeConditional; + this.options = options; + this.sideEffects = true; + return this; + } + + addOptions(options) { + if (!this.options) { + this.type = TypeConditional; + this.options = []; + this.sideEffects = true; } - if (this._wasmLoading) { - new EnableWasmLoadingPlugin(this._wasmLoading).apply(compiler); + for (const item of options) { + this.options.push(item); } - const cachedContextify = contextify.bindContextCache( - compiler.context, - compiler.root - ); - compiler.hooks.thisCompilation.tap( - "WorkerPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - WorkerDependency, - normalModuleFactory - ); - compilation.dependencyTemplates.set( - WorkerDependency, - new WorkerDependency.Template() - ); - compilation.dependencyTemplates.set( - CreateScriptUrlDependency, - new CreateScriptUrlDependency.Template() - ); - - /** - * @param {JavascriptParser} parser the parser - * @param {Expression} expr expression - * @returns {[BasicEvaluatedExpression, [number, number]]} parsed - */ - const parseModuleUrl = (parser, expr) => { - if ( - expr.type !== "NewExpression" || - expr.callee.type === "Super" || - expr.arguments.length !== 2 - ) - return; - const [arg1, arg2] = expr.arguments; - if (arg1.type === "SpreadElement") return; - if (arg2.type === "SpreadElement") return; - const callee = parser.evaluateExpression(expr.callee); - if (!callee.isIdentifier() || callee.identifier !== "URL") return; - const arg2Value = parser.evaluateExpression(arg2); - if ( - !arg2Value.isString() || - !arg2Value.string.startsWith("file://") || - arg2Value.string !== getUrl(parser.state.module) - ) { - return; - } - const arg1Value = parser.evaluateExpression(arg1); - return [arg1Value, [arg1.range[0], arg2.range[1]]]; - }; - - /** - * @param {JavascriptParser} parser the parser - * @param {ObjectExpression} expr expression - * @returns {{ expressions: Record, otherElements: (Property | SpreadElement)[], values: Record, spread: boolean, insertType: "comma" | "single", insertLocation: number }} parsed object - */ - const parseObjectExpression = (parser, expr) => { - /** @type {Record} */ - const values = {}; - /** @type {Record} */ - const expressions = {}; - /** @type {(Property | SpreadElement)[]} */ - const otherElements = []; - let spread = false; - for (const prop of expr.properties) { - if (prop.type === "SpreadElement") { - spread = true; - } else if ( - prop.type === "Property" && - !prop.method && - !prop.computed && - prop.key.type === "Identifier" - ) { - expressions[prop.key.name] = prop.value; - if (!prop.shorthand && !prop.value.type.endsWith("Pattern")) { - const value = parser.evaluateExpression( - /** @type {Expression} */ (prop.value) - ); - if (value.isCompileTimeValue()) - values[prop.key.name] = value.asCompileTimeValue(); - } - } else { - otherElements.push(prop); - } - } - const insertType = expr.properties.length > 0 ? "comma" : "single"; - const insertLocation = - expr.properties[expr.properties.length - 1].range[1]; - return { - expressions, - otherElements, - values, - spread, - insertType, - insertLocation - }; - }; + return this; + } - /** - * @param {JavascriptParser} parser the parser - * @param {object} parserOptions options - */ - const parserPlugin = (parser, parserOptions) => { - if (parserOptions.worker === false) return; - const options = !Array.isArray(parserOptions.worker) - ? ["..."] - : parserOptions.worker; - const handleNewWorker = expr => { - if (expr.arguments.length === 0 || expr.arguments.length > 2) - return; - const [arg1, arg2] = expr.arguments; - if (arg1.type === "SpreadElement") return; - if (arg2 && arg2.type === "SpreadElement") return; - const parsedUrl = parseModuleUrl(parser, arg1); - if (!parsedUrl) return; - const [url, range] = parsedUrl; - if (!url.isString()) return; - const { - expressions, - otherElements, - values: options, - spread: hasSpreadInOptions, - insertType, - insertLocation - } = arg2 && arg2.type === "ObjectExpression" - ? parseObjectExpression(parser, arg2) - : { - expressions: {}, - otherElements: [], - values: {}, - spread: false, - insertType: arg2 ? "spread" : "argument", - insertLocation: arg2 ? arg2.range : arg1.range[1] - }; - const { options: importOptions, errors: commentErrors } = - parser.parseCommentOptions(expr.range); + setItems(items) { + this.type = TypeArray; + this.items = items; + this.sideEffects = items.some(i => i.couldHaveSideEffects()); + return this; + } - if (commentErrors) { - for (const e of commentErrors) { - const { comment } = e; - parser.state.module.addWarning( - new CommentCompilationWarning( - `Compilation error while processing magic comment(-s): /*${comment.value}*/: ${e.message}`, - comment.loc - ) - ); - } - } + setArray(array) { + this.type = TypeConstArray; + this.array = array; + this.sideEffects = false; + return this; + } - /** @type {EntryOptions} */ - let entryOptions = {}; + setTemplateString(quasis, parts, kind) { + this.type = TypeTemplateString; + this.quasis = quasis; + this.parts = parts; + this.templateStringKind = kind; + this.sideEffects = parts.some(p => p.sideEffects); + return this; + } - if (importOptions) { - if (importOptions.webpackIgnore !== undefined) { - if (typeof importOptions.webpackIgnore !== "boolean") { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackIgnore\` expected a boolean, but received: ${importOptions.webpackIgnore}.`, - expr.loc - ) - ); - } else { - if (importOptions.webpackIgnore) { - return false; - } - } - } - if (importOptions.webpackEntryOptions !== undefined) { - if ( - typeof importOptions.webpackEntryOptions !== "object" || - importOptions.webpackEntryOptions === null - ) { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackEntryOptions\` expected a object, but received: ${importOptions.webpackEntryOptions}.`, - expr.loc - ) - ); - } else { - Object.assign( - entryOptions, - importOptions.webpackEntryOptions - ); - } - } - if (importOptions.webpackChunkName !== undefined) { - if (typeof importOptions.webpackChunkName !== "string") { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackChunkName\` expected a string, but received: ${importOptions.webpackChunkName}.`, - expr.loc - ) - ); - } else { - entryOptions.name = importOptions.webpackChunkName; - } - } - } + setTruthy() { + this.falsy = false; + this.truthy = true; + this.nullish = false; + return this; + } - if ( - !Object.prototype.hasOwnProperty.call(entryOptions, "name") && - options && - typeof options.name === "string" - ) { - entryOptions.name = options.name; - } + setFalsy() { + this.falsy = true; + this.truthy = false; + return this; + } - if (entryOptions.runtime === undefined) { - let i = workerIndexMap.get(parser.state) || 0; - workerIndexMap.set(parser.state, i + 1); - let name = `${cachedContextify( - parser.state.module.identifier() - )}|${i}`; - const hash = createHash(compilation.outputOptions.hashFunction); - hash.update(name); - const digest = /** @type {string} */ ( - hash.digest(compilation.outputOptions.hashDigest) - ); - entryOptions.runtime = digest.slice( - 0, - compilation.outputOptions.hashDigestLength - ); - } + setNullish(value) { + this.nullish = value; - const block = new AsyncDependenciesBlock({ - name: entryOptions.name, - entryOptions: { - chunkLoading: this._chunkLoading, - wasmLoading: this._wasmLoading, - ...entryOptions - } - }); - block.loc = expr.loc; - const dep = new WorkerDependency(url.string, range); - dep.loc = expr.loc; - block.addDependency(dep); - parser.state.module.addBlock(block); + if (value) return this.setFalsy(); - if (compilation.outputOptions.trustedTypes) { - const dep = new CreateScriptUrlDependency( - expr.arguments[0].range - ); - dep.loc = expr.loc; - parser.state.module.addDependency(dep); - } + return this; + } - if (expressions.type) { - const expr = expressions.type; - if (options.type !== false) { - const dep = new ConstDependency( - this._module ? '"module"' : "undefined", - expr.range - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - expressions.type = undefined; - } - } else if (insertType === "comma") { - if (this._module || hasSpreadInOptions) { - const dep = new ConstDependency( - `, type: ${this._module ? '"module"' : "undefined"}`, - insertLocation - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - } - } else if (insertType === "spread") { - const dep1 = new ConstDependency( - "Object.assign({}, ", - insertLocation[0] - ); - const dep2 = new ConstDependency( - `, { type: ${this._module ? '"module"' : "undefined"} })`, - insertLocation[1] - ); - dep1.loc = expr.loc; - dep2.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep1); - parser.state.module.addPresentationalDependency(dep2); - } else if (insertType === "argument") { - if (this._module) { - const dep = new ConstDependency( - ', { type: "module" }', - insertLocation - ); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - } - } + setRange(range) { + this.range = range; + return this; + } - parser.walkExpression(expr.callee); - for (const key of Object.keys(expressions)) { - if (expressions[key]) parser.walkExpression(expressions[key]); - } - for (const prop of otherElements) { - parser.walkProperty(prop); - } - if (insertType === "spread") { - parser.walkExpression(arg2); - } + setSideEffects(sideEffects = true) { + this.sideEffects = sideEffects; + return this; + } - return true; - }; - const processItem = item => { - if (item.endsWith("()")) { - parser.hooks.call - .for(item.slice(0, -2)) - .tap("WorkerPlugin", handleNewWorker); - } else { - const match = /^(.+?)(\(\))?\s+from\s+(.+)$/.exec(item); - if (match) { - const ids = match[1].split("."); - const call = match[2]; - const source = match[3]; - (call ? parser.hooks.call : parser.hooks.new) - .for(harmonySpecifierTag) - .tap("WorkerPlugin", expr => { - const settings = /** @type {HarmonySettings} */ ( - parser.currentTagData - ); - if ( - !settings || - settings.source !== source || - !equals(settings.ids, ids) - ) { - return; - } - return handleNewWorker(expr); - }); - } else { - parser.hooks.new.for(item).tap("WorkerPlugin", handleNewWorker); - } - } - }; - for (const item of options) { - if (item === "...") { - DEFAULT_SYNTAX.forEach(processItem); - } else processItem(item); - } - }; - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("WorkerPlugin", parserPlugin); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("WorkerPlugin", parserPlugin); - } - ); + setExpression(expression) { + this.expression = expression; + return this; } } -module.exports = WorkerPlugin; + +/** + * @param {string} flags regexp flags + * @returns {boolean} is valid flags + */ +BasicEvaluatedExpression.isValidRegExpFlags = flags => { + const len = flags.length; + + if (len === 0) return true; + if (len > 4) return false; + + // cspell:word gimy + let remaining = 0b0000; // bit per RegExp flag: gimy + + for (let i = 0; i < len; i++) + switch (flags.charCodeAt(i)) { + case 103 /* g */: + if (remaining & 0b1000) return false; + remaining |= 0b1000; + break; + case 105 /* i */: + if (remaining & 0b0100) return false; + remaining |= 0b0100; + break; + case 109 /* m */: + if (remaining & 0b0010) return false; + remaining |= 0b0010; + break; + case 121 /* y */: + if (remaining & 0b0001) return false; + remaining |= 0b0001; + break; + default: + return false; + } + + return true; +}; + +module.exports = BasicEvaluatedExpression; /***/ }), -/***/ 50396: -/***/ (function(module) { +/***/ 91145: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -92205,59 +89211,37 @@ module.exports = WorkerPlugin; -module.exports = expr => { - // - if ( - expr.type === "FunctionExpression" || - expr.type === "ArrowFunctionExpression" - ) { - return { - fn: expr, - expressions: [], - needThis: false - }; - } +const Entrypoint = __webpack_require__(13795); - // .bind() - if ( - expr.type === "CallExpression" && - expr.callee.type === "MemberExpression" && - expr.callee.object.type === "FunctionExpression" && - expr.callee.property.type === "Identifier" && - expr.callee.property.name === "bind" && - expr.arguments.length === 1 - ) { - return { - fn: expr.callee.object, - expressions: [expr.arguments[0]], - needThis: undefined - }; - } - // (function(_this) {return })(this) (Coffeescript) - if ( - expr.type === "CallExpression" && - expr.callee.type === "FunctionExpression" && - expr.callee.body.type === "BlockStatement" && - expr.arguments.length === 1 && - expr.arguments[0].type === "ThisExpression" && - expr.callee.body.body && - expr.callee.body.body.length === 1 && - expr.callee.body.body[0].type === "ReturnStatement" && - expr.callee.body.body[0].argument && - expr.callee.body.body[0].argument.type === "FunctionExpression" - ) { - return { - fn: expr.callee.body.body[0].argument, - expressions: [], - needThis: true - }; +/** @typedef {import("../Chunk")} Chunk */ + +/** + * @param {Entrypoint} entrypoint a chunk group + * @param {Chunk} excludedChunk1 current chunk which is excluded + * @param {Chunk} excludedChunk2 runtime chunk which is excluded + * @returns {Set} chunks + */ +const getAllChunks = (entrypoint, excludedChunk1, excludedChunk2) => { + const queue = new Set([entrypoint]); + const chunks = new Set(); + for (const entrypoint of queue) { + for (const chunk of entrypoint.chunks) { + if (chunk === excludedChunk1) continue; + if (chunk === excludedChunk2) continue; + chunks.add(chunk); + } + for (const parent of entrypoint.parentsIterable) { + if (parent instanceof Entrypoint) queue.add(parent); + } } + return chunks; }; +exports.getAllChunks = getAllChunks; /***/ }), -/***/ 55207: +/***/ 84508: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -92268,69 +89252,176 @@ module.exports = expr => { -const { UsageState } = __webpack_require__(63686); +const { ConcatSource, RawSource } = __webpack_require__(51255); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const { + getChunkFilenameTemplate, + getCompilationHooks +} = __webpack_require__(89464); +const { + generateEntryStartup, + updateHashForEntryStartup +} = __webpack_require__(98124); -/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +/** @typedef {import("../Compiler")} Compiler */ -/** - * @param {RuntimeSpec} runtime the runtime - * @param {string[][]} referencedExports list of referenced exports, will be added to - * @param {string[]} prefix export prefix - * @param {ExportInfo=} exportInfo the export info - * @param {boolean} defaultPointsToSelf when true, using default will reference itself - * @param {Set} alreadyVisited already visited export info (to handle circular reexports) - */ -const processExportInfo = ( - runtime, - referencedExports, - prefix, - exportInfo, - defaultPointsToSelf = false, - alreadyVisited = new Set() -) => { - if (!exportInfo) { - referencedExports.push(prefix); - return; - } - const used = exportInfo.getUsed(runtime); - if (used === UsageState.Unused) return; - if (alreadyVisited.has(exportInfo)) { - referencedExports.push(prefix); - return; - } - alreadyVisited.add(exportInfo); - if ( - used !== UsageState.OnlyPropertiesUsed || - !exportInfo.exportsInfo || - exportInfo.exportsInfo.otherExportsInfo.getUsed(runtime) !== - UsageState.Unused - ) { - alreadyVisited.delete(exportInfo); - referencedExports.push(prefix); - return; - } - const exportsInfo = exportInfo.exportsInfo; - for (const exportInfo of exportsInfo.orderedExports) { - processExportInfo( - runtime, - referencedExports, - defaultPointsToSelf && exportInfo.name === "default" - ? prefix - : prefix.concat(exportInfo.name), - exportInfo, - false, - alreadyVisited +class CommonJsChunkFormatPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "CommonJsChunkFormatPlugin", + compilation => { + compilation.hooks.additionalChunkRuntimeRequirements.tap( + "CommonJsChunkLoadingPlugin", + (chunk, set, { chunkGraph }) => { + if (chunk.hasRuntime()) return; + if (chunkGraph.getNumberOfEntryModules(chunk) > 0) { + set.add(RuntimeGlobals.require); + set.add(RuntimeGlobals.startupEntrypoint); + set.add(RuntimeGlobals.externalInstallChunk); + } + } + ); + const hooks = getCompilationHooks(compilation); + hooks.renderChunk.tap( + "CommonJsChunkFormatPlugin", + (modules, renderContext) => { + const { chunk, chunkGraph, runtimeTemplate } = renderContext; + const source = new ConcatSource(); + source.add(`exports.id = ${JSON.stringify(chunk.id)};\n`); + source.add(`exports.ids = ${JSON.stringify(chunk.ids)};\n`); + source.add(`exports.modules = `); + source.add(modules); + source.add(";\n"); + const runtimeModules = + chunkGraph.getChunkRuntimeModulesInOrder(chunk); + if (runtimeModules.length > 0) { + source.add("exports.runtime =\n"); + source.add( + Template.renderChunkRuntimeModules( + runtimeModules, + renderContext + ) + ); + } + const entries = Array.from( + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ); + if (entries.length > 0) { + const runtimeChunk = entries[0][1].getRuntimeChunk(); + const currentOutputName = compilation + .getPath( + getChunkFilenameTemplate(chunk, compilation.outputOptions), + { + chunk, + contentHashType: "javascript" + } + ) + .split("/"); + const runtimeOutputName = compilation + .getPath( + getChunkFilenameTemplate( + runtimeChunk, + compilation.outputOptions + ), + { + chunk: runtimeChunk, + contentHashType: "javascript" + } + ) + .split("/"); + + // remove filename, we only need the directory + currentOutputName.pop(); + + // remove common parts + while ( + currentOutputName.length > 0 && + runtimeOutputName.length > 0 && + currentOutputName[0] === runtimeOutputName[0] + ) { + currentOutputName.shift(); + runtimeOutputName.shift(); + } + + // create final path + const runtimePath = + (currentOutputName.length > 0 + ? "../".repeat(currentOutputName.length) + : "./") + runtimeOutputName.join("/"); + + const entrySource = new ConcatSource(); + entrySource.add( + `(${ + runtimeTemplate.supportsArrowFunction() + ? "() => " + : "function() " + }{\n` + ); + entrySource.add("var exports = {};\n"); + entrySource.add(source); + entrySource.add(";\n\n// load runtime\n"); + entrySource.add( + `var __webpack_require__ = require(${JSON.stringify( + runtimePath + )});\n` + ); + entrySource.add( + `${RuntimeGlobals.externalInstallChunk}(exports);\n` + ); + const startupSource = new RawSource( + generateEntryStartup( + chunkGraph, + runtimeTemplate, + entries, + chunk, + false + ) + ); + entrySource.add( + hooks.renderStartup.call( + startupSource, + entries[entries.length - 1][0], + { + ...renderContext, + inlined: false + } + ) + ); + entrySource.add("\n})()"); + return entrySource; + } + return source; + } + ); + hooks.chunkHash.tap( + "CommonJsChunkFormatPlugin", + (chunk, hash, { chunkGraph }) => { + if (chunk.hasRuntime()) return; + hash.update("CommonJsChunkFormatPlugin"); + hash.update("1"); + const entries = Array.from( + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ); + updateHashForEntryStartup(hash, chunkGraph, entries, chunk); + } + ); + } ); } - alreadyVisited.delete(exportInfo); -}; -module.exports = processExportInfo; +} + +module.exports = CommonJsChunkFormatPlugin; /***/ }), -/***/ 32277: +/***/ 61291: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -92341,72 +89432,122 @@ module.exports = processExportInfo; -const ExternalsPlugin = __webpack_require__(6652); - +/** @typedef {import("../../declarations/WebpackOptions").ChunkLoadingType} ChunkLoadingType */ /** @typedef {import("../Compiler")} Compiler */ -class ElectronTargetPlugin { +/** @type {WeakMap>} */ +const enabledTypes = new WeakMap(); + +const getEnabledTypes = compiler => { + let set = enabledTypes.get(compiler); + if (set === undefined) { + set = new Set(); + enabledTypes.set(compiler, set); + } + return set; +}; + +class EnableChunkLoadingPlugin { /** - * @param {"main" | "preload" | "renderer"=} context in main, preload or renderer context? + * @param {ChunkLoadingType} type library type that should be available */ - constructor(context) { - this._context = context; + constructor(type) { + this.type = type; + } + + /** + * @param {Compiler} compiler the compiler instance + * @param {ChunkLoadingType} type type of library + * @returns {void} + */ + static setEnabled(compiler, type) { + getEnabledTypes(compiler).add(type); + } + + /** + * @param {Compiler} compiler the compiler instance + * @param {ChunkLoadingType} type type of library + * @returns {void} + */ + static checkEnabled(compiler, type) { + if (!getEnabledTypes(compiler).has(type)) { + throw new Error( + `Chunk loading type "${type}" is not enabled. ` + + "EnableChunkLoadingPlugin need to be used to enable this type of chunk loading. " + + 'This usually happens through the "output.enabledChunkLoadingTypes" option. ' + + 'If you are using a function as entry which sets "chunkLoading", you need to add all potential chunk loading types to "output.enabledChunkLoadingTypes". ' + + "These types are enabled: " + + Array.from(getEnabledTypes(compiler)).join(", ") + ); + } } + /** * Apply the plugin * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { - new ExternalsPlugin("node-commonjs", [ - "clipboard", - "crash-reporter", - "electron", - "ipc", - "native-image", - "original-fs", - "screen", - "shell" - ]).apply(compiler); - switch (this._context) { - case "main": - new ExternalsPlugin("node-commonjs", [ - "app", - "auto-updater", - "browser-window", - "content-tracing", - "dialog", - "global-shortcut", - "ipc-main", - "menu", - "menu-item", - "power-monitor", - "power-save-blocker", - "protocol", - "session", - "tray", - "web-contents" - ]).apply(compiler); - break; - case "preload": - case "renderer": - new ExternalsPlugin("node-commonjs", [ - "desktop-capturer", - "ipc-renderer", - "remote", - "web-frame" - ]).apply(compiler); - break; + const { type } = this; + + // Only enable once + const enabled = getEnabledTypes(compiler); + if (enabled.has(type)) return; + enabled.add(type); + + if (typeof type === "string") { + switch (type) { + case "jsonp": { + const JsonpChunkLoadingPlugin = __webpack_require__(83121); + new JsonpChunkLoadingPlugin().apply(compiler); + break; + } + case "import-scripts": { + const ImportScriptsChunkLoadingPlugin = __webpack_require__(54182); + new ImportScriptsChunkLoadingPlugin().apply(compiler); + break; + } + case "require": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const CommonJsChunkLoadingPlugin = __webpack_require__(1313); + new CommonJsChunkLoadingPlugin({ + asyncChunkLoading: false + }).apply(compiler); + break; + } + case "async-node": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const CommonJsChunkLoadingPlugin = __webpack_require__(1313); + new CommonJsChunkLoadingPlugin({ + asyncChunkLoading: true + }).apply(compiler); + break; + } + case "import": { + const ModuleChunkLoadingPlugin = __webpack_require__(89831); + new ModuleChunkLoadingPlugin().apply(compiler); + break; + } + case "universal": + // TODO implement universal chunk loading + throw new Error("Universal Chunk Loading is not implemented yet"); + default: + throw new Error(`Unsupported chunk loading type ${type}. +Plugins which provide custom chunk loading types must call EnableChunkLoadingPlugin.setEnabled(compiler, type) to disable this error.`); + } + } else { + // TODO support plugin instances here + // apply them to the compiler } } } -module.exports = ElectronTargetPlugin; +module.exports = EnableChunkLoadingPlugin; /***/ }), -/***/ 22273: +/***/ 77106: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -92417,278 +89558,229 @@ module.exports = ElectronTargetPlugin; -const WebpackError = __webpack_require__(53799); +const util = __webpack_require__(73837); +const { RawSource, ReplaceSource } = __webpack_require__(51255); +const Generator = __webpack_require__(93401); +const InitFragment = __webpack_require__(55870); +const HarmonyCompatibilityDependency = __webpack_require__(72906); +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../DependenciesBlock")} DependenciesBlock */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ /** @typedef {import("../Module")} Module */ +/** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -class BuildCycleError extends WebpackError { - /** - * Creates an instance of ModuleDependencyError. - * @param {Module} module the module starting the cycle - */ - constructor(module) { - super( - "There is a circular build dependency, which makes it impossible to create this module" - ); - - this.name = "BuildCycleError"; - this.module = module; - } -} - -module.exports = BuildCycleError; - - -/***/ }), - -/***/ 5294: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - +// TODO: clean up this file +// replace with newer constructs -const RuntimeModule = __webpack_require__(16963); +const deprecatedGetInitFragments = util.deprecate( + (template, dependency, templateContext) => + template.getInitFragments(dependency, templateContext), + "DependencyTemplate.getInitFragment is deprecated (use apply(dep, source, { initFragments }) instead)", + "DEP_WEBPACK_JAVASCRIPT_GENERATOR_GET_INIT_FRAGMENTS" +); -class ExportWebpackRequireRuntimeModule extends RuntimeModule { - constructor() { - super("export webpack runtime", RuntimeModule.STAGE_ATTACH); - } +const TYPES = new Set(["javascript"]); +class JavascriptGenerator extends Generator { /** - * @returns {boolean} true, if the runtime module should get it's own scope + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) */ - shouldIsolate() { - return false; + getTypes(module) { + return TYPES; } /** - * @returns {string} runtime code + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module */ - generate() { - return "export default __webpack_require__;"; + getSize(module, type) { + const originalSource = module.originalSource(); + if (!originalSource) { + return 39; + } + return originalSource.size(); } -} - -module.exports = ExportWebpackRequireRuntimeModule; - - -/***/ }), -/***/ 68927: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * @param {NormalModule} module module for which the bailout reason should be determined + * @param {ConcatenationBailoutReasonContext} context context + * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated + */ + getConcatenationBailoutReason(module, context) { + // Only harmony modules are valid for optimization + if ( + !module.buildMeta || + module.buildMeta.exportsType !== "namespace" || + module.presentationalDependencies === undefined || + !module.presentationalDependencies.some( + d => d instanceof HarmonyCompatibilityDependency + ) + ) { + return "Module is not an ECMAScript module"; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // Some expressions are not compatible with module concatenation + // because they may produce unexpected results. The plugin bails out + // if some were detected upfront. + if (module.buildInfo && module.buildInfo.moduleConcatenationBailout) { + return `Module uses ${module.buildInfo.moduleConcatenationBailout}`; + } + } + /** + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code + */ + generate(module, generateContext) { + const originalSource = module.originalSource(); + if (!originalSource) { + return new RawSource("throw new Error('No source available');"); + } + const source = new ReplaceSource(originalSource); + const initFragments = []; -const { ConcatSource } = __webpack_require__(51255); -const { RuntimeGlobals } = __webpack_require__(91919); -const HotUpdateChunk = __webpack_require__(9597); -const Template = __webpack_require__(39722); -const { getAllChunks } = __webpack_require__(91145); -const { - getCompilationHooks, - getChunkFilenameTemplate -} = __webpack_require__(89464); -const { updateHashForEntryStartup } = __webpack_require__(98124); + this.sourceModule(module, initFragments, source, generateContext); -/** @typedef {import("../Compiler")} Compiler */ + return InitFragment.addToSource(source, initFragments, generateContext); + } -class ModuleChunkFormatPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {Module} module the module to generate + * @param {InitFragment[]} initFragments mutable list of init fragments + * @param {ReplaceSource} source the current replace source which can be modified + * @param {GenerateContext} generateContext the generateContext * @returns {void} */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - "ModuleChunkFormatPlugin", - compilation => { - compilation.hooks.additionalChunkRuntimeRequirements.tap( - "ModuleChunkFormatPlugin", - (chunk, set) => { - if (chunk.hasRuntime()) return; - if (compilation.chunkGraph.getNumberOfEntryModules(chunk) > 0) { - set.add(RuntimeGlobals.require); - set.add(RuntimeGlobals.startupEntrypoint); - set.add(RuntimeGlobals.externalInstallChunk); - } - } - ); - const hooks = getCompilationHooks(compilation); - hooks.renderChunk.tap( - "ModuleChunkFormatPlugin", - (modules, renderContext) => { - const { chunk, chunkGraph, runtimeTemplate } = renderContext; - const hotUpdateChunk = - chunk instanceof HotUpdateChunk ? chunk : null; - const source = new ConcatSource(); - if (hotUpdateChunk) { - throw new Error( - "HMR is not implemented for module chunk format yet" - ); - } else { - source.add(`export const id = ${JSON.stringify(chunk.id)};\n`); - source.add(`export const ids = ${JSON.stringify(chunk.ids)};\n`); - source.add(`export const modules = `); - source.add(modules); - source.add(`;\n`); - const runtimeModules = - chunkGraph.getChunkRuntimeModulesInOrder(chunk); - if (runtimeModules.length > 0) { - source.add("export const runtime =\n"); - source.add( - Template.renderChunkRuntimeModules( - runtimeModules, - renderContext - ) - ); - } - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); - if (entries.length > 0) { - const runtimeChunk = entries[0][1].getRuntimeChunk(); - const currentOutputName = compilation - .getPath( - getChunkFilenameTemplate(chunk, compilation.outputOptions), - { - chunk, - contentHashType: "javascript" - } - ) - .split("/"); + sourceModule(module, initFragments, source, generateContext) { + for (const dependency of module.dependencies) { + this.sourceDependency( + module, + dependency, + initFragments, + source, + generateContext + ); + } - // remove filename, we only need the directory - currentOutputName.pop(); + if (module.presentationalDependencies !== undefined) { + for (const dependency of module.presentationalDependencies) { + this.sourceDependency( + module, + dependency, + initFragments, + source, + generateContext + ); + } + } - const getRelativePath = chunk => { - const baseOutputName = currentOutputName.slice(); - const chunkOutputName = compilation - .getPath( - getChunkFilenameTemplate( - chunk, - compilation.outputOptions - ), - { - chunk: chunk, - contentHashType: "javascript" - } - ) - .split("/"); + for (const childBlock of module.blocks) { + this.sourceBlock( + module, + childBlock, + initFragments, + source, + generateContext + ); + } + } - // remove common parts - while ( - baseOutputName.length > 0 && - chunkOutputName.length > 0 && - baseOutputName[0] === chunkOutputName[0] - ) { - baseOutputName.shift(); - chunkOutputName.shift(); - } - // create final path - return ( - (baseOutputName.length > 0 - ? "../".repeat(baseOutputName.length) - : "./") + chunkOutputName.join("/") - ); - }; + /** + * @param {Module} module the module to generate + * @param {DependenciesBlock} block the dependencies block which will be processed + * @param {InitFragment[]} initFragments mutable list of init fragments + * @param {ReplaceSource} source the current replace source which can be modified + * @param {GenerateContext} generateContext the generateContext + * @returns {void} + */ + sourceBlock(module, block, initFragments, source, generateContext) { + for (const dependency of block.dependencies) { + this.sourceDependency( + module, + dependency, + initFragments, + source, + generateContext + ); + } - const entrySource = new ConcatSource(); - entrySource.add(source); - entrySource.add(";\n\n// load runtime\n"); - entrySource.add( - `import __webpack_require__ from ${JSON.stringify( - getRelativePath(runtimeChunk) - )};\n` - ); + for (const childBlock of block.blocks) { + this.sourceBlock( + module, + childBlock, + initFragments, + source, + generateContext + ); + } + } - const startupSource = new ConcatSource(); - startupSource.add( - `var __webpack_exec__ = ${runtimeTemplate.returningFunction( - `__webpack_require__(${RuntimeGlobals.entryModuleId} = moduleId)`, - "moduleId" - )}\n` - ); + /** + * @param {Module} module the current module + * @param {Dependency} dependency the dependency to generate + * @param {InitFragment[]} initFragments mutable list of init fragments + * @param {ReplaceSource} source the current replace source which can be modified + * @param {GenerateContext} generateContext the render context + * @returns {void} + */ + sourceDependency(module, dependency, initFragments, source, generateContext) { + const constructor = /** @type {new (...args: any[]) => Dependency} */ ( + dependency.constructor + ); + const template = generateContext.dependencyTemplates.get(constructor); + if (!template) { + throw new Error( + "No template for dependency: " + dependency.constructor.name + ); + } - const loadedChunks = new Set(); - let index = 0; - for (let i = 0; i < entries.length; i++) { - const [module, entrypoint] = entries[i]; - const final = i + 1 === entries.length; - const moduleId = chunkGraph.getModuleId(module); - const chunks = getAllChunks( - entrypoint, - runtimeChunk, - undefined - ); - for (const chunk of chunks) { - if (loadedChunks.has(chunk)) continue; - loadedChunks.add(chunk); - startupSource.add( - `import * as __webpack_chunk_${index}__ from ${JSON.stringify( - getRelativePath(chunk) - )};\n` - ); - startupSource.add( - `${RuntimeGlobals.externalInstallChunk}(__webpack_chunk_${index}__);\n` - ); - index++; - } - startupSource.add( - `${ - final ? "var __webpack_exports__ = " : "" - }__webpack_exec__(${JSON.stringify(moduleId)});\n` - ); - } + const templateContext = { + runtimeTemplate: generateContext.runtimeTemplate, + dependencyTemplates: generateContext.dependencyTemplates, + moduleGraph: generateContext.moduleGraph, + chunkGraph: generateContext.chunkGraph, + module, + runtime: generateContext.runtime, + runtimeRequirements: generateContext.runtimeRequirements, + concatenationScope: generateContext.concatenationScope, + codeGenerationResults: generateContext.codeGenerationResults, + initFragments + }; - entrySource.add( - hooks.renderStartup.call( - startupSource, - entries[entries.length - 1][0], - { - ...renderContext, - inlined: false - } - ) - ); - return entrySource; - } - } - return source; - } - ); - hooks.chunkHash.tap( - "ModuleChunkFormatPlugin", - (chunk, hash, { chunkGraph, runtimeTemplate }) => { - if (chunk.hasRuntime()) return; - hash.update("ModuleChunkFormatPlugin"); - hash.update("1"); - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); - updateHashForEntryStartup(hash, chunkGraph, entries, chunk); - } - ); + template.apply(dependency, source, templateContext); + + // TODO remove in webpack 6 + if ("getInitFragments" in template) { + const fragments = deprecatedGetInitFragments( + template, + dependency, + templateContext + ); + + if (fragments) { + for (const fragment of fragments) { + initFragments.push(fragment); + } } - ); + } } } -module.exports = ModuleChunkFormatPlugin; +module.exports = JavascriptGenerator; /***/ }), -/***/ 89831: +/***/ 89464: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -92699,117 +89791,138 @@ module.exports = ModuleChunkFormatPlugin; +const { SyncWaterfallHook, SyncHook, SyncBailHook } = __webpack_require__(6967); +const vm = __webpack_require__(26144); +const { + ConcatSource, + OriginalSource, + PrefixSource, + RawSource, + CachedSource +} = __webpack_require__(51255); +const Compilation = __webpack_require__(85720); +const { tryRunOrWebpackError } = __webpack_require__(11351); +const HotUpdateChunk = __webpack_require__(9597); +const InitFragment = __webpack_require__(55870); const RuntimeGlobals = __webpack_require__(16475); -const ExportWebpackRequireRuntimeModule = __webpack_require__(5294); -const ModuleChunkLoadingRuntimeModule = __webpack_require__(64747); +const Template = __webpack_require__(1626); +const { last, someInIterable } = __webpack_require__(39104); +const StringXor = __webpack_require__(40293); +const { compareModulesByIdentifier } = __webpack_require__(29579); +const createHash = __webpack_require__(49835); +const nonNumericOnlyHash = __webpack_require__(55668); +const { intersectRuntime } = __webpack_require__(17156); +const JavascriptGenerator = __webpack_require__(77106); +const JavascriptParser = __webpack_require__(29050); +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../CodeGenerationResults")} CodeGenerationResults */ +/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ /** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../util/Hash")} Hash */ -class ModuleChunkLoadingPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - "ModuleChunkLoadingPlugin", - compilation => { - const globalChunkLoading = compilation.outputOptions.chunkLoading; - const isEnabledForChunk = chunk => { - const options = chunk.getEntryOptions(); - const chunkLoading = - (options && options.chunkLoading) || globalChunkLoading; - return chunkLoading === "import"; - }; - const onceForChunkSet = new WeakSet(); - const handler = (chunk, set) => { - if (onceForChunkSet.has(chunk)) return; - onceForChunkSet.add(chunk); - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - set.add(RuntimeGlobals.hasOwnProperty); - compilation.addRuntimeModule( - chunk, - new ModuleChunkLoadingRuntimeModule(set) - ); - }; - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("ModuleChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.baseURI) - .tap("ModuleChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.externalInstallChunk) - .tap("ModuleChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.onChunksLoaded) - .tap("ModuleChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.externalInstallChunk) - .tap("ModuleChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - compilation.addRuntimeModule( - chunk, - new ExportWebpackRequireRuntimeModule() - ); - }); - - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("ModuleChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.getChunkScriptFilename); - }); - } - ); - } -} - -module.exports = ModuleChunkLoadingPlugin; - +/** + * @param {Chunk} chunk a chunk + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {boolean} true, when a JS file is needed for this chunk + */ +const chunkHasJs = (chunk, chunkGraph) => { + if (chunkGraph.getNumberOfEntryModules(chunk) > 0) return true; -/***/ }), + return chunkGraph.getChunkModulesIterableBySourceType(chunk, "javascript") + ? true + : false; +}; -/***/ 64747: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +const printGeneratedCodeForStack = (module, code) => { + const lines = code.split("\n"); + const n = `${lines.length}`.length; + return `\n\nGenerated code for ${module.identifier()}\n${lines + .map((line, i, lines) => { + const iStr = `${i + 1}`; + return `${" ".repeat(n - iStr.length)}${iStr} | ${line}`; + }) + .join("\n")}`; +}; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ +/** + * @typedef {Object} RenderContext + * @property {Chunk} chunk the chunk + * @property {DependencyTemplates} dependencyTemplates the dependency templates + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {CodeGenerationResults} codeGenerationResults results of code generation + * @property {boolean} strictMode rendering in strict context + */ +/** + * @typedef {Object} MainRenderContext + * @property {Chunk} chunk the chunk + * @property {DependencyTemplates} dependencyTemplates the dependency templates + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {CodeGenerationResults} codeGenerationResults results of code generation + * @property {string} hash hash to be used for render call + * @property {boolean} strictMode rendering in strict context + */ +/** + * @typedef {Object} ChunkRenderContext + * @property {Chunk} chunk the chunk + * @property {DependencyTemplates} dependencyTemplates the dependency templates + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {CodeGenerationResults} codeGenerationResults results of code generation + * @property {InitFragment[]} chunkInitFragments init fragments for the chunk + * @property {boolean} strictMode rendering in strict context + */ -const { SyncWaterfallHook } = __webpack_require__(41242); -const Compilation = __webpack_require__(85720); -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); -const { - getChunkFilenameTemplate, - chunkHasJs -} = __webpack_require__(89464); -const { getInitialChunkIds } = __webpack_require__(98124); -const compileBooleanMatcher = __webpack_require__(29404); -const { getUndoPath } = __webpack_require__(82186); +/** + * @typedef {Object} RenderBootstrapContext + * @property {Chunk} chunk the chunk + * @property {CodeGenerationResults} codeGenerationResults results of code generation + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {string} hash hash to be used for render call + */ -/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {RenderContext & { inlined: boolean }} StartupRenderContext */ /** - * @typedef {Object} JsonpCompilationPluginHooks - * @property {SyncWaterfallHook<[string, Chunk]>} linkPreload - * @property {SyncWaterfallHook<[string, Chunk]>} linkPrefetch + * @typedef {Object} CompilationHooks + * @property {SyncWaterfallHook<[Source, Module, ChunkRenderContext]>} renderModuleContent + * @property {SyncWaterfallHook<[Source, Module, ChunkRenderContext]>} renderModuleContainer + * @property {SyncWaterfallHook<[Source, Module, ChunkRenderContext]>} renderModulePackage + * @property {SyncWaterfallHook<[Source, RenderContext]>} renderChunk + * @property {SyncWaterfallHook<[Source, RenderContext]>} renderMain + * @property {SyncWaterfallHook<[Source, RenderContext]>} renderContent + * @property {SyncWaterfallHook<[Source, RenderContext]>} render + * @property {SyncWaterfallHook<[Source, Module, StartupRenderContext]>} renderStartup + * @property {SyncWaterfallHook<[string, RenderBootstrapContext]>} renderRequire + * @property {SyncBailHook<[Module, RenderBootstrapContext], string>} inlineInRuntimeBailout + * @property {SyncBailHook<[Module, RenderContext], string>} embedInRuntimeBailout + * @property {SyncBailHook<[RenderContext], string>} strictRuntimeBailout + * @property {SyncHook<[Chunk, Hash, ChunkHashContext]>} chunkHash + * @property {SyncBailHook<[Chunk, RenderContext], boolean>} useSourceMap */ -/** @type {WeakMap} */ +/** @type {WeakMap} */ const compilationHooksMap = new WeakMap(); -class ModuleChunkLoadingRuntimeModule extends RuntimeModule { +class JavascriptModulesPlugin { /** * @param {Compilation} compilation the compilation - * @returns {JsonpCompilationPluginHooks} hooks + * @returns {CompilationHooks} the attached hooks */ static getCompilationHooks(compilation) { if (!(compilation instanceof Compilation)) { @@ -92820,896 +89933,1232 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule { let hooks = compilationHooksMap.get(compilation); if (hooks === undefined) { hooks = { - linkPreload: new SyncWaterfallHook(["source", "chunk"]), - linkPrefetch: new SyncWaterfallHook(["source", "chunk"]) + renderModuleContent: new SyncWaterfallHook([ + "source", + "module", + "renderContext" + ]), + renderModuleContainer: new SyncWaterfallHook([ + "source", + "module", + "renderContext" + ]), + renderModulePackage: new SyncWaterfallHook([ + "source", + "module", + "renderContext" + ]), + render: new SyncWaterfallHook(["source", "renderContext"]), + renderContent: new SyncWaterfallHook(["source", "renderContext"]), + renderStartup: new SyncWaterfallHook([ + "source", + "module", + "startupRenderContext" + ]), + renderChunk: new SyncWaterfallHook(["source", "renderContext"]), + renderMain: new SyncWaterfallHook(["source", "renderContext"]), + renderRequire: new SyncWaterfallHook(["code", "renderContext"]), + inlineInRuntimeBailout: new SyncBailHook(["module", "renderContext"]), + embedInRuntimeBailout: new SyncBailHook(["module", "renderContext"]), + strictRuntimeBailout: new SyncBailHook(["renderContext"]), + chunkHash: new SyncHook(["chunk", "hash", "context"]), + useSourceMap: new SyncBailHook(["chunk", "renderContext"]) }; compilationHooksMap.set(compilation, hooks); } return hooks; } - constructor(runtimeRequirements) { - super("import chunk loading", RuntimeModule.STAGE_ATTACH); - this._runtimeRequirements = runtimeRequirements; + constructor(options = {}) { + this.options = options; + /** @type {WeakMap} */ + this._moduleFactoryCache = new WeakMap(); } /** - * @returns {string} runtime code + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - generate() { - const { compilation, chunk } = this; - const { - runtimeTemplate, - chunkGraph, - outputOptions: { importFunctionName, importMetaName } - } = compilation; - const fn = RuntimeGlobals.ensureChunkHandlers; - const withBaseURI = this._runtimeRequirements.has(RuntimeGlobals.baseURI); - const withExternalInstallChunk = this._runtimeRequirements.has( - RuntimeGlobals.externalInstallChunk - ); - const withLoading = this._runtimeRequirements.has( - RuntimeGlobals.ensureChunkHandlers - ); - const withOnChunkLoad = this._runtimeRequirements.has( - RuntimeGlobals.onChunksLoaded - ); - const withHmr = this._runtimeRequirements.has( - RuntimeGlobals.hmrDownloadUpdateHandlers - ); - const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs); - const hasJsMatcher = compileBooleanMatcher(conditionMap); - const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); - - const outputName = this.compilation.getPath( - getChunkFilenameTemplate(chunk, this.compilation.outputOptions), - { - chunk, - contentHashType: "javascript" - } - ); - const rootOutputDir = getUndoPath( - outputName, - this.compilation.outputOptions.path, - true - ); - - const stateExpression = withHmr - ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_module` - : undefined; - - return Template.asString([ - withBaseURI - ? Template.asString([ - `${RuntimeGlobals.baseURI} = new URL(${JSON.stringify( - rootOutputDir - )}, ${importMetaName}.url);` - ]) - : "// no baseURI", - "", - "// object to store loaded and loading chunks", - "// undefined = chunk not loaded, null = chunk preloaded/prefetched", - "// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded", - `var installedChunks = ${ - stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" - }{`, - Template.indent( - Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join( - ",\n" - ) - ), - "};", - "", - withLoading || withExternalInstallChunk - ? `var installChunk = ${runtimeTemplate.basicFunction("data", [ - runtimeTemplate.destructureObject( - ["ids", "modules", "runtime"], - "data" - ), - '// add "modules" to the modules object,', - '// then flag all "ids" as loaded and fire callback', - "var moduleId, chunkId, i = 0;", - "for(moduleId in modules) {", - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(modules, moduleId)) {`, - Template.indent( - `${RuntimeGlobals.moduleFactories}[moduleId] = modules[moduleId];` - ), - "}" - ]), - "}", - "if(runtime) runtime(__webpack_require__);", - "for(;i < ids.length; i++) {", - Template.indent([ - "chunkId = ids[i];", - `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) && installedChunks[chunkId]) {`, - Template.indent("installedChunks[chunkId][0]();"), - "}", - "installedChunks[ids[i]] = 0;" - ]), - "}", - withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : "" - ])}` - : "// no install chunk", - "", - withLoading - ? Template.asString([ - `${fn}.j = ${runtimeTemplate.basicFunction( - "chunkId, promises", - hasJsMatcher !== false - ? Template.indent([ - "// import() chunk loading for javascript", - `var installedChunkData = ${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;`, - 'if(installedChunkData !== 0) { // 0 means "already installed".', - Template.indent([ - "", - '// a Promise means "currently loading".', - "if(installedChunkData) {", - Template.indent([ - "promises.push(installedChunkData[1]);" - ]), - "} else {", - Template.indent([ - hasJsMatcher === true - ? "if(true) { // all chunks have JS" - : `if(${hasJsMatcher("chunkId")}) {`, - Template.indent([ - "// setup Promise in chunk cache", - `var promise = ${importFunctionName}(${JSON.stringify( - rootOutputDir - )} + ${ - RuntimeGlobals.getChunkScriptFilename - }(chunkId)).then(installChunk, ${runtimeTemplate.basicFunction( - "e", - [ - "if(installedChunks[chunkId] !== 0) installedChunks[chunkId] = undefined;", - "throw e;" - ] - )});`, - `var promise = Promise.race([promise, new Promise(${runtimeTemplate.expressionFunction( - `installedChunkData = installedChunks[chunkId] = [resolve]`, - "resolve" - )})])`, - `promises.push(installedChunkData[1] = promise);` - ]), - "} else installedChunks[chunkId] = 0;" - ]), - "}" - ]), - "}" - ]) - : Template.indent(["installedChunks[chunkId] = 0;"]) - )};` - ]) - : "// no chunk on demand loading", - "", - withExternalInstallChunk - ? Template.asString([ - `${RuntimeGlobals.externalInstallChunk} = installChunk;` - ]) - : "// no external install chunk", - "", - withOnChunkLoad - ? `${ - RuntimeGlobals.onChunksLoaded - }.j = ${runtimeTemplate.returningFunction( - "installedChunks[chunkId] === 0", - "chunkId" - )};` - : "// no on chunks loaded" - ]); - } -} - -module.exports = ModuleChunkLoadingRuntimeModule; - + apply(compiler) { + compiler.hooks.compilation.tap( + "JavascriptModulesPlugin", + (compilation, { normalModuleFactory }) => { + const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); + normalModuleFactory.hooks.createParser + .for("javascript/auto") + .tap("JavascriptModulesPlugin", options => { + return new JavascriptParser("auto"); + }); + normalModuleFactory.hooks.createParser + .for("javascript/dynamic") + .tap("JavascriptModulesPlugin", options => { + return new JavascriptParser("script"); + }); + normalModuleFactory.hooks.createParser + .for("javascript/esm") + .tap("JavascriptModulesPlugin", options => { + return new JavascriptParser("module"); + }); + normalModuleFactory.hooks.createGenerator + .for("javascript/auto") + .tap("JavascriptModulesPlugin", () => { + return new JavascriptGenerator(); + }); + normalModuleFactory.hooks.createGenerator + .for("javascript/dynamic") + .tap("JavascriptModulesPlugin", () => { + return new JavascriptGenerator(); + }); + normalModuleFactory.hooks.createGenerator + .for("javascript/esm") + .tap("JavascriptModulesPlugin", () => { + return new JavascriptGenerator(); + }); + compilation.hooks.renderManifest.tap( + "JavascriptModulesPlugin", + (result, options) => { + const { + hash, + chunk, + chunkGraph, + moduleGraph, + runtimeTemplate, + dependencyTemplates, + outputOptions, + codeGenerationResults + } = options; -/***/ }), + const hotUpdateChunk = + chunk instanceof HotUpdateChunk ? chunk : null; -/***/ 16734: -/***/ (function(module) { + let render; + const filenameTemplate = + JavascriptModulesPlugin.getChunkFilenameTemplate( + chunk, + outputOptions + ); + if (hotUpdateChunk) { + render = () => + this.renderChunk( + { + chunk, + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + codeGenerationResults, + strictMode: runtimeTemplate.isModule() + }, + hooks + ); + } else if (chunk.hasRuntime()) { + render = () => + this.renderMain( + { + hash, + chunk, + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + codeGenerationResults, + strictMode: runtimeTemplate.isModule() + }, + hooks, + compilation + ); + } else { + if (!chunkHasJs(chunk, chunkGraph)) { + return result; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + render = () => + this.renderChunk( + { + chunk, + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + codeGenerationResults, + strictMode: runtimeTemplate.isModule() + }, + hooks + ); + } + result.push({ + render, + filenameTemplate, + pathOptions: { + hash, + runtime: chunk.runtime, + chunk, + contentHashType: "javascript" + }, + info: { + javascriptModule: compilation.runtimeTemplate.isModule() + }, + identifier: hotUpdateChunk + ? `hotupdatechunk${chunk.id}` + : `chunk${chunk.id}`, + hash: chunk.contentHash.javascript + }); + return result; + } + ); + compilation.hooks.chunkHash.tap( + "JavascriptModulesPlugin", + (chunk, hash, context) => { + hooks.chunkHash.call(chunk, hash, context); + if (chunk.hasRuntime()) { + this.updateHashWithBootstrap( + hash, + { + hash: "0000", + chunk, + codeGenerationResults: context.codeGenerationResults, + chunkGraph: context.chunkGraph, + moduleGraph: context.moduleGraph, + runtimeTemplate: context.runtimeTemplate + }, + hooks + ); + } + } + ); + compilation.hooks.contentHash.tap("JavascriptModulesPlugin", chunk => { + const { + chunkGraph, + codeGenerationResults, + moduleGraph, + runtimeTemplate, + outputOptions: { + hashSalt, + hashDigest, + hashDigestLength, + hashFunction + } + } = compilation; + const hash = createHash(hashFunction); + if (hashSalt) hash.update(hashSalt); + if (chunk.hasRuntime()) { + this.updateHashWithBootstrap( + hash, + { + hash: "0000", + chunk, + codeGenerationResults, + chunkGraph: compilation.chunkGraph, + moduleGraph: compilation.moduleGraph, + runtimeTemplate: compilation.runtimeTemplate + }, + hooks + ); + } else { + hash.update(`${chunk.id} `); + hash.update(chunk.ids ? chunk.ids.join(",") : ""); + } + hooks.chunkHash.call(chunk, hash, { + chunkGraph, + codeGenerationResults, + moduleGraph, + runtimeTemplate + }); + const modules = chunkGraph.getChunkModulesIterableBySourceType( + chunk, + "javascript" + ); + if (modules) { + const xor = new StringXor(); + for (const m of modules) { + xor.add(chunkGraph.getModuleHash(m, chunk.runtime)); + } + xor.updateHash(hash); + } + const runtimeModules = chunkGraph.getChunkModulesIterableBySourceType( + chunk, + "runtime" + ); + if (runtimeModules) { + const xor = new StringXor(); + for (const m of runtimeModules) { + xor.add(chunkGraph.getModuleHash(m, chunk.runtime)); + } + xor.updateHash(hash); + } + const digest = /** @type {string} */ (hash.digest(hashDigest)); + chunk.contentHash.javascript = nonNumericOnlyHash( + digest, + hashDigestLength + ); + }); + compilation.hooks.additionalTreeRuntimeRequirements.tap( + "JavascriptModulesPlugin", + (chunk, set, { chunkGraph }) => { + if ( + !set.has(RuntimeGlobals.startupNoDefault) && + chunkGraph.hasChunkEntryDependentChunks(chunk) + ) { + set.add(RuntimeGlobals.onChunksLoaded); + set.add(RuntimeGlobals.require); + } + } + ); + compilation.hooks.executeModule.tap( + "JavascriptModulesPlugin", + (options, context) => { + const source = + options.codeGenerationResult.sources.get("javascript"); + if (source === undefined) return; + const { module, moduleObject } = options; + const code = source.source(); -/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("./Dependency").SourcePosition} SourcePosition */ + const fn = vm.runInThisContext( + `(function(${module.moduleArgument}, ${module.exportsArgument}, __webpack_require__) {\n${code}\n/**/})`, + { + filename: module.identifier(), + lineOffset: -1 + } + ); + try { + fn.call( + moduleObject.exports, + moduleObject, + moduleObject.exports, + context.__webpack_require__ + ); + } catch (e) { + e.stack += printGeneratedCodeForStack(options.module, code); + throw e; + } + } + ); + compilation.hooks.executeModule.tap( + "JavascriptModulesPlugin", + (options, context) => { + const source = options.codeGenerationResult.sources.get("runtime"); + if (source === undefined) return; + let code = source.source(); + if (typeof code !== "string") code = code.toString(); -/** - * @param {SourcePosition} pos position - * @returns {string} formatted position - */ -const formatPosition = pos => { - if (pos && typeof pos === "object") { - if ("line" in pos && "column" in pos) { - return `${pos.line}:${pos.column}`; - } else if ("line" in pos) { - return `${pos.line}:?`; - } + const fn = vm.runInThisContext( + `(function(__webpack_require__) {\n${code}\n/**/})`, + { + filename: options.module.identifier(), + lineOffset: -1 + } + ); + try { + fn.call(null, context.__webpack_require__); + } catch (e) { + e.stack += printGeneratedCodeForStack(options.module, code); + throw e; + } + } + ); + } + ); } - return ""; -}; -/** - * @param {DependencyLocation} loc location - * @returns {string} formatted location - */ -const formatLocation = loc => { - if (loc && typeof loc === "object") { - if ("start" in loc && loc.start && "end" in loc && loc.end) { - if ( - typeof loc.start === "object" && - typeof loc.start.line === "number" && - typeof loc.end === "object" && - typeof loc.end.line === "number" && - typeof loc.end.column === "number" && - loc.start.line === loc.end.line - ) { - return `${formatPosition(loc.start)}-${loc.end.column}`; - } else if ( - typeof loc.start === "object" && - typeof loc.start.line === "number" && - typeof loc.start.column !== "number" && - typeof loc.end === "object" && - typeof loc.end.line === "number" && - typeof loc.end.column !== "number" - ) { - return `${loc.start.line}-${loc.end.line}`; - } else { - return `${formatPosition(loc.start)}-${formatPosition(loc.end)}`; - } - } - if ("start" in loc && loc.start) { - return formatPosition(loc.start); - } - if ("name" in loc && "index" in loc) { - return `${loc.name}[${loc.index}]`; - } - if ("name" in loc) { - return loc.name; + static getChunkFilenameTemplate(chunk, outputOptions) { + if (chunk.filenameTemplate) { + return chunk.filenameTemplate; + } else if (chunk instanceof HotUpdateChunk) { + return outputOptions.hotUpdateChunkFilename; + } else if (chunk.canBeInitial()) { + return outputOptions.filename; + } else { + return outputOptions.chunkFilename; } } - return ""; -}; - -module.exports = formatLocation; - - -/***/ }), -/***/ 27899: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); - -class HotModuleReplacementRuntimeModule extends RuntimeModule { - constructor() { - super("hot module replacement", RuntimeModule.STAGE_BASIC); - } /** - * @returns {string} runtime code + * @param {Module} module the rendered module + * @param {ChunkRenderContext} renderContext options object + * @param {CompilationHooks} hooks hooks + * @param {boolean} factory true: renders as factory method, false: pure module content + * @returns {Source} the newly generated source from rendering */ - generate() { - return Template.getFunctionContent( - require('./HotModuleReplacement.runtime.js') - ) - .replace(/\$getFullHash\$/g, RuntimeGlobals.getFullHash) - .replace( - /\$interceptModuleExecution\$/g, - RuntimeGlobals.interceptModuleExecution - ) - .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) - .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) - .replace(/\$hmrDownloadManifest\$/g, RuntimeGlobals.hmrDownloadManifest) - .replace( - /\$hmrInvalidateModuleHandlers\$/g, - RuntimeGlobals.hmrInvalidateModuleHandlers - ) - .replace( - /\$hmrDownloadUpdateHandlers\$/g, - RuntimeGlobals.hmrDownloadUpdateHandlers + renderModule(module, renderContext, hooks, factory) { + const { + chunk, + chunkGraph, + runtimeTemplate, + codeGenerationResults, + strictMode + } = renderContext; + try { + const codeGenResult = codeGenerationResults.get(module, chunk.runtime); + const moduleSource = codeGenResult.sources.get("javascript"); + if (!moduleSource) return null; + if (codeGenResult.data !== undefined) { + const chunkInitFragments = codeGenResult.data.get("chunkInitFragments"); + if (chunkInitFragments) { + for (const i of chunkInitFragments) + renderContext.chunkInitFragments.push(i); + } + } + const moduleSourcePostContent = tryRunOrWebpackError( + () => + hooks.renderModuleContent.call(moduleSource, module, renderContext), + "JavascriptModulesPlugin.getCompilationHooks().renderModuleContent" ); - } -} - -module.exports = HotModuleReplacementRuntimeModule; - - -/***/ }), - -/***/ 79040: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { RawSource } = __webpack_require__(51255); -const AsyncDependenciesBlock = __webpack_require__(47736); -const Dependency = __webpack_require__(54912); -const Module = __webpack_require__(73208); -const ModuleFactory = __webpack_require__(51010); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const CommonJsRequireDependency = __webpack_require__(21264); -const { registerNotSerializable } = __webpack_require__(8282); - -/** @typedef {import("../../declarations/WebpackOptions")} WebpackOptions */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../Module").BuildMeta} BuildMeta */ -/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ -/** @typedef {import("../ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../dependencies/HarmonyImportDependency")} HarmonyImportDependency */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ - -/** - * @typedef {Object} BackendApi - * @property {function(Error=): void} dispose - * @property {function(Module): { client: string, data: string, active: boolean }} module - */ - -const HMR_DEPENDENCY_TYPES = new Set([ - "import.meta.webpackHot.accept", - "import.meta.webpackHot.decline", - "module.hot.accept", - "module.hot.decline" -]); - -/** - * @param {undefined|string|RegExp|Function} test test option - * @param {Module} module the module - * @returns {boolean} true, if the module should be selected - */ -const checkTest = (test, module) => { - if (test === undefined) return true; - if (typeof test === "function") { - return test(module); - } - if (typeof test === "string") { - const name = module.nameForCondition(); - return name && name.startsWith(test); - } - if (test instanceof RegExp) { - const name = module.nameForCondition(); - return name && test.test(name); - } - return false; -}; - -const TYPES = new Set(["javascript"]); - -class LazyCompilationDependency extends Dependency { - constructor(proxyModule) { - super(); - this.proxyModule = proxyModule; - } - - get category() { - return "esm"; - } - - get type() { - return "lazy import()"; + let moduleSourcePostContainer; + if (factory) { + const runtimeRequirements = chunkGraph.getModuleRuntimeRequirements( + module, + chunk.runtime + ); + const needModule = runtimeRequirements.has(RuntimeGlobals.module); + const needExports = runtimeRequirements.has(RuntimeGlobals.exports); + const needRequire = + runtimeRequirements.has(RuntimeGlobals.require) || + runtimeRequirements.has(RuntimeGlobals.requireScope); + const needThisAsExports = runtimeRequirements.has( + RuntimeGlobals.thisAsExports + ); + const needStrict = module.buildInfo.strict && !strictMode; + const cacheEntry = this._moduleFactoryCache.get( + moduleSourcePostContent + ); + let source; + if ( + cacheEntry && + cacheEntry.needModule === needModule && + cacheEntry.needExports === needExports && + cacheEntry.needRequire === needRequire && + cacheEntry.needThisAsExports === needThisAsExports && + cacheEntry.needStrict === needStrict + ) { + source = cacheEntry.source; + } else { + const factorySource = new ConcatSource(); + const args = []; + if (needExports || needRequire || needModule) + args.push( + needModule + ? module.moduleArgument + : "__unused_webpack_" + module.moduleArgument + ); + if (needExports || needRequire) + args.push( + needExports + ? module.exportsArgument + : "__unused_webpack_" + module.exportsArgument + ); + if (needRequire) args.push("__webpack_require__"); + if (!needThisAsExports && runtimeTemplate.supportsArrowFunction()) { + factorySource.add("/***/ ((" + args.join(", ") + ") => {\n\n"); + } else { + factorySource.add("/***/ (function(" + args.join(", ") + ") {\n\n"); + } + if (needStrict) { + factorySource.add('"use strict";\n'); + } + factorySource.add(moduleSourcePostContent); + factorySource.add("\n\n/***/ })"); + source = new CachedSource(factorySource); + this._moduleFactoryCache.set(moduleSourcePostContent, { + source, + needModule, + needExports, + needRequire, + needThisAsExports, + needStrict + }); + } + moduleSourcePostContainer = tryRunOrWebpackError( + () => hooks.renderModuleContainer.call(source, module, renderContext), + "JavascriptModulesPlugin.getCompilationHooks().renderModuleContainer" + ); + } else { + moduleSourcePostContainer = moduleSourcePostContent; + } + return tryRunOrWebpackError( + () => + hooks.renderModulePackage.call( + moduleSourcePostContainer, + module, + renderContext + ), + "JavascriptModulesPlugin.getCompilationHooks().renderModulePackage" + ); + } catch (e) { + e.module = module; + throw e; + } } /** - * @returns {string | null} an identifier to merge equal requests + * @param {RenderContext} renderContext the render context + * @param {CompilationHooks} hooks hooks + * @returns {Source} the rendered source */ - getResourceIdentifier() { - return this.proxyModule.originalModule.identifier(); - } -} - -registerNotSerializable(LazyCompilationDependency); - -class LazyCompilationProxyModule extends Module { - constructor(context, originalModule, request, client, data, active) { - super("lazy-compilation-proxy", context, originalModule.layer); - this.originalModule = originalModule; - this.request = request; - this.client = client; - this.data = data; - this.active = active; + renderChunk(renderContext, hooks) { + const { chunk, chunkGraph } = renderContext; + const modules = chunkGraph.getOrderedChunkModulesIterableBySourceType( + chunk, + "javascript", + compareModulesByIdentifier + ); + const allModules = modules ? Array.from(modules) : []; + let strictHeader; + let allStrict = renderContext.strictMode; + if (!allStrict && allModules.every(m => m.buildInfo.strict)) { + const strictBailout = hooks.strictRuntimeBailout.call(renderContext); + strictHeader = strictBailout + ? `// runtime can't be in strict mode because ${strictBailout}.\n` + : '"use strict";\n'; + if (!strictBailout) allStrict = true; + } + /** @type {ChunkRenderContext} */ + const chunkRenderContext = { + ...renderContext, + chunkInitFragments: [], + strictMode: allStrict + }; + const moduleSources = + Template.renderChunkModules(chunkRenderContext, allModules, module => + this.renderModule(module, chunkRenderContext, hooks, true) + ) || new RawSource("{}"); + let source = tryRunOrWebpackError( + () => hooks.renderChunk.call(moduleSources, chunkRenderContext), + "JavascriptModulesPlugin.getCompilationHooks().renderChunk" + ); + source = tryRunOrWebpackError( + () => hooks.renderContent.call(source, chunkRenderContext), + "JavascriptModulesPlugin.getCompilationHooks().renderContent" + ); + if (!source) { + throw new Error( + "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().renderContent plugins should return something" + ); + } + source = InitFragment.addToSource( + source, + chunkRenderContext.chunkInitFragments, + chunkRenderContext + ); + source = tryRunOrWebpackError( + () => hooks.render.call(source, chunkRenderContext), + "JavascriptModulesPlugin.getCompilationHooks().render" + ); + if (!source) { + throw new Error( + "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().render plugins should return something" + ); + } + chunk.rendered = true; + return strictHeader + ? new ConcatSource(strictHeader, source, ";") + : renderContext.runtimeTemplate.isModule() + ? source + : new ConcatSource(source, ";"); } /** - * @returns {string} a unique identifier of the module + * @param {MainRenderContext} renderContext options object + * @param {CompilationHooks} hooks hooks + * @param {Compilation} compilation the compilation + * @returns {Source} the newly generated source from rendering */ - identifier() { - return `lazy-compilation-proxy|${this.originalModule.identifier()}`; - } + renderMain(renderContext, hooks, compilation) { + const { chunk, chunkGraph, runtimeTemplate } = renderContext; - /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module - */ - readableIdentifier(requestShortener) { - return `lazy-compilation-proxy ${this.originalModule.readableIdentifier( - requestShortener - )}`; - } + const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk); + const iife = runtimeTemplate.isIIFE(); - /** - * Assuming this module is in the cache. Update the (cached) module with - * the fresh module from the factory. Usually updates internal references - * and properties. - * @param {Module} module fresh module - * @returns {void} - */ - updateCacheModule(module) { - super.updateCacheModule(module); - const m = /** @type {LazyCompilationProxyModule} */ (module); - this.originalModule = m.originalModule; - this.request = m.request; - this.client = m.client; - this.data = m.data; - this.active = m.active; - } + const bootstrap = this.renderBootstrap(renderContext, hooks); + const useSourceMap = hooks.useSourceMap.call(chunk, renderContext); - /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion - */ - libIdent(options) { - return `${this.originalModule.libIdent(options)}!lazy-compilation-proxy`; - } + const allModules = Array.from( + chunkGraph.getOrderedChunkModulesIterableBySourceType( + chunk, + "javascript", + compareModulesByIdentifier + ) || [] + ); - /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} - */ - needBuild(context, callback) { - callback(null, !this.buildInfo || this.buildInfo.active !== this.active); - } + const hasEntryModules = chunkGraph.getNumberOfEntryModules(chunk) > 0; + let inlinedModules; + if (bootstrap.allowInlineStartup && hasEntryModules) { + inlinedModules = new Set(chunkGraph.getChunkEntryModulesIterable(chunk)); + } - /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} - */ - build(options, compilation, resolver, fs, callback) { - this.buildInfo = { - active: this.active + let source = new ConcatSource(); + let prefix; + if (iife) { + if (runtimeTemplate.supportsArrowFunction()) { + source.add("/******/ (() => { // webpackBootstrap\n"); + } else { + source.add("/******/ (function() { // webpackBootstrap\n"); + } + prefix = "/******/ \t"; + } else { + prefix = "/******/ "; + } + let allStrict = renderContext.strictMode; + if (!allStrict && allModules.every(m => m.buildInfo.strict)) { + const strictBailout = hooks.strictRuntimeBailout.call(renderContext); + if (strictBailout) { + source.add( + prefix + + `// runtime can't be in strict mode because ${strictBailout}.\n` + ); + } else { + allStrict = true; + source.add(prefix + '"use strict";\n'); + } + } + + /** @type {ChunkRenderContext} */ + const chunkRenderContext = { + ...renderContext, + chunkInitFragments: [], + strictMode: allStrict }; - /** @type {BuildMeta} */ - this.buildMeta = {}; - this.clearDependenciesAndBlocks(); - const dep = new CommonJsRequireDependency(this.client); - this.addDependency(dep); - if (this.active) { - const dep = new LazyCompilationDependency(this); - const block = new AsyncDependenciesBlock({}); - block.addDependency(dep); - this.addBlock(block); + + const chunkModules = Template.renderChunkModules( + chunkRenderContext, + inlinedModules + ? allModules.filter(m => !inlinedModules.has(m)) + : allModules, + module => this.renderModule(module, chunkRenderContext, hooks, true), + prefix + ); + if ( + chunkModules || + runtimeRequirements.has(RuntimeGlobals.moduleFactories) || + runtimeRequirements.has(RuntimeGlobals.moduleFactoriesAddOnly) || + runtimeRequirements.has(RuntimeGlobals.require) + ) { + source.add(prefix + "var __webpack_modules__ = ("); + source.add(chunkModules || "{}"); + source.add(");\n"); + source.add( + "/************************************************************************/\n" + ); } - callback(); - } - /** - * @returns {Set} types available (do not mutate) - */ - getSourceTypes() { - return TYPES; - } + if (bootstrap.header.length > 0) { + const header = Template.asString(bootstrap.header) + "\n"; + source.add( + new PrefixSource( + prefix, + useSourceMap + ? new OriginalSource(header, "webpack/bootstrap") + : new RawSource(header) + ) + ); + source.add( + "/************************************************************************/\n" + ); + } - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - return 200; - } + const runtimeModules = + renderContext.chunkGraph.getChunkRuntimeModulesInOrder(chunk); - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration({ runtimeTemplate, chunkGraph, moduleGraph }) { - const sources = new Map(); - const runtimeRequirements = new Set(); - runtimeRequirements.add(RuntimeGlobals.module); - const clientDep = /** @type {CommonJsRequireDependency} */ ( - this.dependencies[0] - ); - const clientModule = moduleGraph.getModule(clientDep); - const block = this.blocks[0]; - const client = Template.asString([ - `var client = ${runtimeTemplate.moduleExports({ - module: clientModule, - chunkGraph, - request: clientDep.userRequest, - runtimeRequirements - })}`, - `var data = ${JSON.stringify(this.data)};` - ]); - const keepActive = Template.asString([ - `var dispose = client.keepAlive({ data: data, active: ${JSON.stringify( - !!block - )}, module: module, onError: onError });` - ]); - let source; - if (block) { - const dep = block.dependencies[0]; - const module = moduleGraph.getModule(dep); - source = Template.asString([ - client, - `module.exports = ${runtimeTemplate.moduleNamespacePromise({ - chunkGraph, - block, - module, - request: this.request, - strict: false, // TODO this should be inherited from the original module - message: "import()", - runtimeRequirements - })};`, - "if (module.hot) {", - Template.indent([ - "module.hot.accept();", - `module.hot.accept(${JSON.stringify( - chunkGraph.getModuleId(module) - )}, function() { module.hot.invalidate(); });`, - "module.hot.dispose(function(data) { delete data.resolveSelf; dispose(data); });", - "if (module.hot.data && module.hot.data.resolveSelf) module.hot.data.resolveSelf(module.exports);" - ]), - "}", - "function onError() { /* ignore */ }", - keepActive - ]); + if (runtimeModules.length > 0) { + source.add( + new PrefixSource( + prefix, + Template.renderRuntimeModules(runtimeModules, chunkRenderContext) + ) + ); + source.add( + "/************************************************************************/\n" + ); + // runtimeRuntimeModules calls codeGeneration + for (const module of runtimeModules) { + compilation.codeGeneratedModules.add(module); + } + } + if (inlinedModules) { + if (bootstrap.beforeStartup.length > 0) { + const beforeStartup = Template.asString(bootstrap.beforeStartup) + "\n"; + source.add( + new PrefixSource( + prefix, + useSourceMap + ? new OriginalSource(beforeStartup, "webpack/before-startup") + : new RawSource(beforeStartup) + ) + ); + } + const lastInlinedModule = last(inlinedModules); + const startupSource = new ConcatSource(); + startupSource.add(`var __webpack_exports__ = {};\n`); + for (const m of inlinedModules) { + const renderedModule = this.renderModule( + m, + chunkRenderContext, + hooks, + false + ); + if (renderedModule) { + const innerStrict = !allStrict && m.buildInfo.strict; + const runtimeRequirements = chunkGraph.getModuleRuntimeRequirements( + m, + chunk.runtime + ); + const exports = runtimeRequirements.has(RuntimeGlobals.exports); + const webpackExports = + exports && m.exportsArgument === "__webpack_exports__"; + let iife = innerStrict + ? "it need to be in strict mode." + : inlinedModules.size > 1 + ? // TODO check globals and top-level declarations of other entries and chunk modules + // to make a better decision + "it need to be isolated against other entry modules." + : chunkModules + ? "it need to be isolated against other modules in the chunk." + : exports && !webpackExports + ? `it uses a non-standard name for the exports (${m.exportsArgument}).` + : hooks.embedInRuntimeBailout.call(m, renderContext); + let footer; + if (iife !== undefined) { + startupSource.add( + `// This entry need to be wrapped in an IIFE because ${iife}\n` + ); + const arrow = runtimeTemplate.supportsArrowFunction(); + if (arrow) { + startupSource.add("(() => {\n"); + footer = "\n})();\n\n"; + } else { + startupSource.add("!function() {\n"); + footer = "\n}();\n"; + } + if (innerStrict) startupSource.add('"use strict";\n'); + } else { + footer = "\n"; + } + if (exports) { + if (m !== lastInlinedModule) + startupSource.add(`var ${m.exportsArgument} = {};\n`); + else if (m.exportsArgument !== "__webpack_exports__") + startupSource.add( + `var ${m.exportsArgument} = __webpack_exports__;\n` + ); + } + startupSource.add(renderedModule); + startupSource.add(footer); + } + } + if (runtimeRequirements.has(RuntimeGlobals.onChunksLoaded)) { + startupSource.add( + `__webpack_exports__ = ${RuntimeGlobals.onChunksLoaded}(__webpack_exports__);\n` + ); + } + source.add( + hooks.renderStartup.call(startupSource, lastInlinedModule, { + ...renderContext, + inlined: true + }) + ); + if (bootstrap.afterStartup.length > 0) { + const afterStartup = Template.asString(bootstrap.afterStartup) + "\n"; + source.add( + new PrefixSource( + prefix, + useSourceMap + ? new OriginalSource(afterStartup, "webpack/after-startup") + : new RawSource(afterStartup) + ) + ); + } } else { - source = Template.asString([ - client, - "var resolveSelf, onError;", - `module.exports = new Promise(function(resolve, reject) { resolveSelf = resolve; onError = reject; });`, - "if (module.hot) {", - Template.indent([ - "module.hot.accept();", - "if (module.hot.data && module.hot.data.resolveSelf) module.hot.data.resolveSelf(module.exports);", - "module.hot.dispose(function(data) { data.resolveSelf = resolveSelf; dispose(data); });" - ]), - "}", - keepActive - ]); + const lastEntryModule = last( + chunkGraph.getChunkEntryModulesIterable(chunk) + ); + const toSource = useSourceMap + ? (content, name) => + new OriginalSource(Template.asString(content), name) + : content => new RawSource(Template.asString(content)); + source.add( + new PrefixSource( + prefix, + new ConcatSource( + toSource(bootstrap.beforeStartup, "webpack/before-startup"), + "\n", + hooks.renderStartup.call( + toSource(bootstrap.startup.concat(""), "webpack/startup"), + lastEntryModule, + { + ...renderContext, + inlined: false + } + ), + toSource(bootstrap.afterStartup, "webpack/after-startup"), + "\n" + ) + ) + ); + } + if ( + hasEntryModules && + runtimeRequirements.has(RuntimeGlobals.returnExportsFromRuntime) + ) { + source.add(`${prefix}return __webpack_exports__;\n`); + } + if (iife) { + source.add("/******/ })()\n"); } - sources.set("javascript", new RawSource(source)); - return { - sources, - runtimeRequirements - }; - } - - /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - super.updateHash(hash, context); - hash.update(this.active ? "active" : ""); - hash.update(JSON.stringify(this.data)); - } -} - -registerNotSerializable(LazyCompilationProxyModule); - -class LazyCompilationDependencyFactory extends ModuleFactory { - constructor(factory) { - super(); - this._factory = factory; - } - /** - * @param {ModuleFactoryCreateData} data data object - * @param {function(Error=, ModuleFactoryResult=): void} callback callback - * @returns {void} - */ - create(data, callback) { - const dependency = /** @type {LazyCompilationDependency} */ ( - data.dependencies[0] + /** @type {Source} */ + let finalSource = tryRunOrWebpackError( + () => hooks.renderMain.call(source, renderContext), + "JavascriptModulesPlugin.getCompilationHooks().renderMain" ); - callback(null, { - module: dependency.proxyModule.originalModule - }); + if (!finalSource) { + throw new Error( + "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().renderMain plugins should return something" + ); + } + finalSource = tryRunOrWebpackError( + () => hooks.renderContent.call(finalSource, renderContext), + "JavascriptModulesPlugin.getCompilationHooks().renderContent" + ); + if (!finalSource) { + throw new Error( + "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().renderContent plugins should return something" + ); + } + finalSource = InitFragment.addToSource( + finalSource, + chunkRenderContext.chunkInitFragments, + chunkRenderContext + ); + finalSource = tryRunOrWebpackError( + () => hooks.render.call(finalSource, renderContext), + "JavascriptModulesPlugin.getCompilationHooks().render" + ); + if (!finalSource) { + throw new Error( + "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().render plugins should return something" + ); + } + chunk.rendered = true; + return iife ? new ConcatSource(finalSource, ";") : finalSource; } -} -class LazyCompilationPlugin { - /** - * @param {Object} options options - * @param {(function(Compiler, function(Error?, BackendApi?): void): void) | function(Compiler): Promise} options.backend the backend - * @param {boolean} options.entries true, when entries are lazy compiled - * @param {boolean} options.imports true, when import() modules are lazy compiled - * @param {RegExp | string | (function(Module): boolean)} options.test additional filter for lazy compiled entrypoint modules - */ - constructor({ backend, entries, imports, test }) { - this.backend = backend; - this.entries = entries; - this.imports = imports; - this.test = test; - } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {Hash} hash the hash to be updated + * @param {RenderBootstrapContext} renderContext options object + * @param {CompilationHooks} hooks hooks */ - apply(compiler) { - let backend; - compiler.hooks.beforeCompile.tapAsync( - "LazyCompilationPlugin", - (params, callback) => { - if (backend !== undefined) return callback(); - const promise = this.backend(compiler, (err, result) => { - if (err) return callback(err); - backend = result; - callback(); - }); - if (promise && promise.then) { - promise.then(b => { - backend = b; - callback(); - }, callback); + updateHashWithBootstrap(hash, renderContext, hooks) { + const bootstrap = this.renderBootstrap(renderContext, hooks); + for (const key of Object.keys(bootstrap)) { + hash.update(key); + if (Array.isArray(bootstrap[key])) { + for (const line of bootstrap[key]) { + hash.update(line); } + } else { + hash.update(JSON.stringify(bootstrap[key])); } - ); - compiler.hooks.thisCompilation.tap( - "LazyCompilationPlugin", - (compilation, { normalModuleFactory }) => { - normalModuleFactory.hooks.module.tap( - "LazyCompilationPlugin", - (originalModule, createData, resolveData) => { - if ( - resolveData.dependencies.every(dep => - HMR_DEPENDENCY_TYPES.has(dep.type) - ) - ) { - // for HMR only resolving, try to determine if the HMR accept/decline refers to - // an import() or not - const hmrDep = resolveData.dependencies[0]; - const originModule = - compilation.moduleGraph.getParentModule(hmrDep); - const isReferringToDynamicImport = originModule.blocks.some( - block => - block.dependencies.some( - dep => - dep.type === "import()" && - /** @type {HarmonyImportDependency} */ (dep).request === - hmrDep.request - ) - ); - if (!isReferringToDynamicImport) return; - } else if ( - !resolveData.dependencies.every( - dep => - HMR_DEPENDENCY_TYPES.has(dep.type) || - (this.imports && - (dep.type === "import()" || - dep.type === "import() context element")) || - (this.entries && dep.type === "entry") - ) - ) - return; - if ( - /webpack[/\\]hot[/\\]|webpack-dev-server[/\\]client|webpack-hot-middleware[/\\]client/.test( - resolveData.request - ) || - !checkTest(this.test, originalModule) - ) - return; - const moduleInfo = backend.module(originalModule); - if (!moduleInfo) return; - const { client, data, active } = moduleInfo; - - return new LazyCompilationProxyModule( - compiler.context, - originalModule, - resolveData.request, - client, - data, - active - ); - } - ); - compilation.dependencyFactories.set( - LazyCompilationDependency, - new LazyCompilationDependencyFactory() - ); - } - ); - compiler.hooks.shutdown.tapAsync("LazyCompilationPlugin", callback => { - backend.dispose(callback); - }); + } } -} - -module.exports = LazyCompilationPlugin; + /** + * @param {RenderBootstrapContext} renderContext options object + * @param {CompilationHooks} hooks hooks + * @returns {{ header: string[], beforeStartup: string[], startup: string[], afterStartup: string[], allowInlineStartup: boolean }} the generated source of the bootstrap code + */ + renderBootstrap(renderContext, hooks) { + const { + chunkGraph, + codeGenerationResults, + moduleGraph, + chunk, + runtimeTemplate + } = renderContext; -/***/ }), + const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk); -/***/ 17781: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + const requireFunction = runtimeRequirements.has(RuntimeGlobals.require); + const moduleCache = runtimeRequirements.has(RuntimeGlobals.moduleCache); + const moduleFactories = runtimeRequirements.has( + RuntimeGlobals.moduleFactories + ); + const moduleUsed = runtimeRequirements.has(RuntimeGlobals.module); + const requireScopeUsed = runtimeRequirements.has( + RuntimeGlobals.requireScope + ); + const interceptModuleExecution = runtimeRequirements.has( + RuntimeGlobals.interceptModuleExecution + ); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const useRequire = + requireFunction || interceptModuleExecution || moduleUsed; + const result = { + header: [], + beforeStartup: [], + startup: [], + afterStartup: [], + allowInlineStartup: true + }; + let { header: buf, startup, beforeStartup, afterStartup } = result; -/** @typedef {import("http").ServerOptions} HttpServerOptions */ -/** @typedef {import("https").ServerOptions} HttpsServerOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LazyCompilationDefaultBackendOptions} LazyCompilationDefaultBackendOptions */ -/** @typedef {import("../Compiler")} Compiler */ + if (result.allowInlineStartup && moduleFactories) { + startup.push( + "// module factories are used so entry inlining is disabled" + ); + result.allowInlineStartup = false; + } + if (result.allowInlineStartup && moduleCache) { + startup.push("// module cache are used so entry inlining is disabled"); + result.allowInlineStartup = false; + } + if (result.allowInlineStartup && interceptModuleExecution) { + startup.push( + "// module execution is intercepted so entry inlining is disabled" + ); + result.allowInlineStartup = false; + } -/** - * @callback BackendHandler - * @param {Compiler} compiler compiler - * @param {function((Error | null)=, any=): void} callback callback - * @returns {void} - */ + if (useRequire || moduleCache) { + buf.push("// The module cache"); + buf.push("var __webpack_module_cache__ = {};"); + buf.push(""); + } -/** - * @param {Omit & { client: NonNullable}} options additional options for the backend - * @returns {BackendHandler} backend - */ -module.exports = options => (compiler, callback) => { - const logger = compiler.getInfrastructureLogger("LazyCompilationBackend"); - const activeModules = new Map(); - const prefix = "/lazy-compilation-using-"; + if (useRequire) { + buf.push("// The require function"); + buf.push(`function __webpack_require__(moduleId) {`); + buf.push(Template.indent(this.renderRequire(renderContext, hooks))); + buf.push("}"); + buf.push(""); + } else if (runtimeRequirements.has(RuntimeGlobals.requireScope)) { + buf.push("// The require scope"); + buf.push("var __webpack_require__ = {};"); + buf.push(""); + } - const isHttps = - options.protocol === "https" || - (typeof options.server === "object" && - ("key" in options.server || "pfx" in options.server)); + if ( + moduleFactories || + runtimeRequirements.has(RuntimeGlobals.moduleFactoriesAddOnly) + ) { + buf.push("// expose the modules object (__webpack_modules__)"); + buf.push(`${RuntimeGlobals.moduleFactories} = __webpack_modules__;`); + buf.push(""); + } - const createServer = - typeof options.server === "function" - ? options.server - : (() => { - const http = isHttps ? __webpack_require__(95687) : __webpack_require__(13685); - return http.createServer.bind(http, options.server); - })(); - const listen = - typeof options.listen === "function" - ? options.listen - : server => { - let listen = options.listen; - if (typeof listen === "object" && !("port" in listen)) - listen = { ...listen, port: undefined }; - server.listen(listen); - }; + if (moduleCache) { + buf.push("// expose the module cache"); + buf.push(`${RuntimeGlobals.moduleCache} = __webpack_module_cache__;`); + buf.push(""); + } - const protocol = options.protocol || (isHttps ? "https" : "http"); + if (interceptModuleExecution) { + buf.push("// expose the module execution interceptor"); + buf.push(`${RuntimeGlobals.interceptModuleExecution} = [];`); + buf.push(""); + } - const requestListener = (req, res) => { - const keys = req.url.slice(prefix.length).split("@"); - req.socket.on("close", () => { - setTimeout(() => { - for (const key of keys) { - const oldValue = activeModules.get(key) || 0; - activeModules.set(key, oldValue - 1); - if (oldValue === 1) { - logger.log( - `${key} is no longer in use. Next compilation will skip this module.` - ); - } - } - }, 120000); - }); - req.socket.setNoDelay(true); - res.writeHead(200, { - "content-type": "text/event-stream", - "Access-Control-Allow-Origin": "*", - "Access-Control-Allow-Methods": "*", - "Access-Control-Allow-Headers": "*" - }); - res.write("\n"); - let moduleActivated = false; - for (const key of keys) { - const oldValue = activeModules.get(key) || 0; - activeModules.set(key, oldValue + 1); - if (oldValue === 0) { - logger.log(`${key} is now in use and will be compiled.`); - moduleActivated = true; + if (!runtimeRequirements.has(RuntimeGlobals.startupNoDefault)) { + if (chunkGraph.getNumberOfEntryModules(chunk) > 0) { + /** @type {string[]} */ + const buf2 = []; + const runtimeRequirements = + chunkGraph.getTreeRuntimeRequirements(chunk); + buf2.push("// Load entry module and return exports"); + let i = chunkGraph.getNumberOfEntryModules(chunk); + for (const [ + entryModule, + entrypoint + ] of chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk)) { + const chunks = entrypoint.chunks.filter(c => c !== chunk); + if (result.allowInlineStartup && chunks.length > 0) { + buf2.push( + "// This entry module depends on other loaded chunks and execution need to be delayed" + ); + result.allowInlineStartup = false; + } + if ( + result.allowInlineStartup && + someInIterable( + moduleGraph.getIncomingConnectionsByOriginModule(entryModule), + ([originModule, connections]) => + originModule && + connections.some(c => c.isTargetActive(chunk.runtime)) && + someInIterable( + chunkGraph.getModuleRuntimes(originModule), + runtime => + intersectRuntime(runtime, chunk.runtime) !== undefined + ) + ) + ) { + buf2.push( + "// This entry module is referenced by other modules so it can't be inlined" + ); + result.allowInlineStartup = false; + } + + let data; + if (codeGenerationResults.has(entryModule, chunk.runtime)) { + const result = codeGenerationResults.get( + entryModule, + chunk.runtime + ); + data = result.data; + } + if ( + result.allowInlineStartup && + (!data || !data.get("topLevelDeclarations")) && + (!entryModule.buildInfo || + !entryModule.buildInfo.topLevelDeclarations) + ) { + buf2.push( + "// This entry module doesn't tell about it's top-level declarations so it can't be inlined" + ); + result.allowInlineStartup = false; + } + if (result.allowInlineStartup) { + const bailout = hooks.inlineInRuntimeBailout.call( + entryModule, + renderContext + ); + if (bailout !== undefined) { + buf2.push( + `// This entry module can't be inlined because ${bailout}` + ); + result.allowInlineStartup = false; + } + } + i--; + const moduleId = chunkGraph.getModuleId(entryModule); + const entryRuntimeRequirements = + chunkGraph.getModuleRuntimeRequirements(entryModule, chunk.runtime); + let moduleIdExpr = JSON.stringify(moduleId); + if (runtimeRequirements.has(RuntimeGlobals.entryModuleId)) { + moduleIdExpr = `${RuntimeGlobals.entryModuleId} = ${moduleIdExpr}`; + } + if ( + result.allowInlineStartup && + entryRuntimeRequirements.has(RuntimeGlobals.module) + ) { + result.allowInlineStartup = false; + buf2.push( + "// This entry module used 'module' so it can't be inlined" + ); + } + if (chunks.length > 0) { + buf2.push( + `${i === 0 ? "var __webpack_exports__ = " : ""}${ + RuntimeGlobals.onChunksLoaded + }(undefined, ${JSON.stringify( + chunks.map(c => c.id) + )}, ${runtimeTemplate.returningFunction( + `__webpack_require__(${moduleIdExpr})` + )})` + ); + } else if (useRequire) { + buf2.push( + `${ + i === 0 ? "var __webpack_exports__ = " : "" + }__webpack_require__(${moduleIdExpr});` + ); + } else { + if (i === 0) buf2.push("var __webpack_exports__ = {};"); + if (requireScopeUsed) { + buf2.push( + `__webpack_modules__[${moduleIdExpr}](0, ${ + i === 0 ? "__webpack_exports__" : "{}" + }, __webpack_require__);` + ); + } else if (entryRuntimeRequirements.has(RuntimeGlobals.exports)) { + buf2.push( + `__webpack_modules__[${moduleIdExpr}](0, ${ + i === 0 ? "__webpack_exports__" : "{}" + });` + ); + } else { + buf2.push(`__webpack_modules__[${moduleIdExpr}]();`); + } + } + } + if (runtimeRequirements.has(RuntimeGlobals.onChunksLoaded)) { + buf2.push( + `__webpack_exports__ = ${RuntimeGlobals.onChunksLoaded}(__webpack_exports__);` + ); + } + if ( + runtimeRequirements.has(RuntimeGlobals.startup) || + (runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore) && + runtimeRequirements.has(RuntimeGlobals.startupOnlyAfter)) + ) { + result.allowInlineStartup = false; + buf.push("// the startup function"); + buf.push( + `${RuntimeGlobals.startup} = ${runtimeTemplate.basicFunction("", [ + ...buf2, + "return __webpack_exports__;" + ])};` + ); + buf.push(""); + startup.push("// run startup"); + startup.push( + `var __webpack_exports__ = ${RuntimeGlobals.startup}();` + ); + } else if (runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore)) { + buf.push("// the startup function"); + buf.push( + `${RuntimeGlobals.startup} = ${runtimeTemplate.emptyFunction()};` + ); + beforeStartup.push("// run runtime startup"); + beforeStartup.push(`${RuntimeGlobals.startup}();`); + startup.push("// startup"); + startup.push(Template.asString(buf2)); + } else if (runtimeRequirements.has(RuntimeGlobals.startupOnlyAfter)) { + buf.push("// the startup function"); + buf.push( + `${RuntimeGlobals.startup} = ${runtimeTemplate.emptyFunction()};` + ); + startup.push("// startup"); + startup.push(Template.asString(buf2)); + afterStartup.push("// run runtime startup"); + afterStartup.push(`${RuntimeGlobals.startup}();`); + } else { + startup.push("// startup"); + startup.push(Template.asString(buf2)); + } + } else if ( + runtimeRequirements.has(RuntimeGlobals.startup) || + runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore) || + runtimeRequirements.has(RuntimeGlobals.startupOnlyAfter) + ) { + buf.push( + "// the startup function", + "// It's empty as no entry modules are in this chunk", + `${RuntimeGlobals.startup} = ${runtimeTemplate.emptyFunction()};`, + "" + ); } + } else if ( + runtimeRequirements.has(RuntimeGlobals.startup) || + runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore) || + runtimeRequirements.has(RuntimeGlobals.startupOnlyAfter) + ) { + result.allowInlineStartup = false; + buf.push( + "// the startup function", + "// It's empty as some runtime module handles the default behavior", + `${RuntimeGlobals.startup} = ${runtimeTemplate.emptyFunction()};` + ); + startup.push("// run startup"); + startup.push(`var __webpack_exports__ = ${RuntimeGlobals.startup}();`); } - if (moduleActivated && compiler.watching) compiler.watching.invalidate(); - }; - - const server = /** @type {import("net").Server} */ (createServer()); - server.on("request", requestListener); + return result; + } - let isClosing = false; - /** @type {Set} */ - const sockets = new Set(); - server.on("connection", socket => { - sockets.add(socket); - socket.on("close", () => { - sockets.delete(socket); - }); - if (isClosing) socket.destroy(); - }); - server.on("clientError", e => { - if (e.message !== "Server is disposing") logger.warn(e); - }); - server.on("listening", err => { - if (err) return callback(err); - const addr = server.address(); - if (typeof addr === "string") throw new Error("addr must not be a string"); - const urlBase = - addr.address === "::" || addr.address === "0.0.0.0" - ? `${protocol}://localhost:${addr.port}` - : addr.family === "IPv6" - ? `${protocol}://[${addr.address}]:${addr.port}` - : `${protocol}://${addr.address}:${addr.port}`; - logger.log( - `Server-Sent-Events server for lazy compilation open at ${urlBase}.` + /** + * @param {RenderBootstrapContext} renderContext options object + * @param {CompilationHooks} hooks hooks + * @returns {string} the generated source of the require function + */ + renderRequire(renderContext, hooks) { + const { + chunk, + chunkGraph, + runtimeTemplate: { outputOptions } + } = renderContext; + const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk); + const moduleExecution = runtimeRequirements.has( + RuntimeGlobals.interceptModuleExecution + ) + ? Template.asString([ + "var execOptions = { id: moduleId, module: module, factory: __webpack_modules__[moduleId], require: __webpack_require__ };", + `${RuntimeGlobals.interceptModuleExecution}.forEach(function(handler) { handler(execOptions); });`, + "module = execOptions.module;", + "execOptions.factory.call(module.exports, module, module.exports, execOptions.require);" + ]) + : runtimeRequirements.has(RuntimeGlobals.thisAsExports) + ? Template.asString([ + "__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);" + ]) + : Template.asString([ + "__webpack_modules__[moduleId](module, module.exports, __webpack_require__);" + ]); + const needModuleId = runtimeRequirements.has(RuntimeGlobals.moduleId); + const needModuleLoaded = runtimeRequirements.has( + RuntimeGlobals.moduleLoaded ); - callback(null, { - dispose(callback) { - isClosing = true; - // Removing the listener is a workaround for a memory leak in node.js - server.off("request", requestListener); - server.close(err => { - callback(err); - }); - for (const socket of sockets) { - socket.destroy(new Error("Server is disposing")); - } - }, - module(originalModule) { - const key = `${encodeURIComponent( - originalModule.identifier().replace(/\\/g, "/").replace(/@/g, "_") - ).replace(/%(2F|3A|24|26|2B|2C|3B|3D|3A)/g, decodeURIComponent)}`; - const active = activeModules.get(key) > 0; - return { - client: `${options.client}?${encodeURIComponent(urlBase + prefix)}`, - data: key, - active - }; - } - }); - }); - listen(server); -}; + const content = Template.asString([ + "// Check if module is in cache", + "var cachedModule = __webpack_module_cache__[moduleId];", + "if (cachedModule !== undefined) {", + outputOptions.strictModuleErrorHandling + ? Template.indent([ + "if (cachedModule.error !== undefined) throw cachedModule.error;", + "return cachedModule.exports;" + ]) + : Template.indent("return cachedModule.exports;"), + "}", + "// Create a new module (and put it into the cache)", + "var module = __webpack_module_cache__[moduleId] = {", + Template.indent([ + needModuleId ? "id: moduleId," : "// no module.id needed", + needModuleLoaded ? "loaded: false," : "// no module.loaded needed", + "exports: {}" + ]), + "};", + "", + outputOptions.strictModuleExceptionHandling + ? Template.asString([ + "// Execute the module function", + "var threw = true;", + "try {", + Template.indent([moduleExecution, "threw = false;"]), + "} finally {", + Template.indent([ + "if(threw) delete __webpack_module_cache__[moduleId];" + ]), + "}" + ]) + : outputOptions.strictModuleErrorHandling + ? Template.asString([ + "// Execute the module function", + "try {", + Template.indent(moduleExecution), + "} catch(e) {", + Template.indent(["module.error = e;", "throw e;"]), + "}" + ]) + : Template.asString([ + "// Execute the module function", + moduleExecution + ]), + needModuleLoaded + ? Template.asString([ + "", + "// Flag the module as loaded", + "module.loaded = true;", + "" + ]) + : "", + "// Return the exports of the module", + "return module.exports;" + ]); + return tryRunOrWebpackError( + () => hooks.renderRequire.call(content, renderContext), + "JavascriptModulesPlugin.getCompilationHooks().renderRequire" + ); + } +} + +module.exports = JavascriptModulesPlugin; +module.exports.chunkHasJs = chunkHasJs; /***/ }), -/***/ 64618: +/***/ 29050: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -93720,2938 +91169,3781 @@ module.exports = options => (compiler, callback) => { -const { find } = __webpack_require__(93347); -const { - compareModulesByPreOrderIndexOrIdentifier, - compareModulesByPostOrderIndexOrIdentifier -} = __webpack_require__(29579); +const { Parser: AcornParser } = __webpack_require__(31988); +const { importAssertions } = __webpack_require__(72617); +const { SyncBailHook, HookMap } = __webpack_require__(6967); +const vm = __webpack_require__(26144); +const Parser = __webpack_require__(11715); +const StackedMap = __webpack_require__(58845); +const binarySearchBounds = __webpack_require__(92229); +const memoize = __webpack_require__(78676); +const BasicEvaluatedExpression = __webpack_require__(950); -/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("acorn").Options} AcornOptions */ +/** @typedef {import("estree").ArrayExpression} ArrayExpressionNode */ +/** @typedef {import("estree").BinaryExpression} BinaryExpressionNode */ +/** @typedef {import("estree").BlockStatement} BlockStatementNode */ +/** @typedef {import("estree").SequenceExpression} SequenceExpressionNode */ +/** @typedef {import("estree").CallExpression} CallExpressionNode */ +/** @typedef {import("estree").ClassDeclaration} ClassDeclarationNode */ +/** @typedef {import("estree").ClassExpression} ClassExpressionNode */ +/** @typedef {import("estree").Comment} CommentNode */ +/** @typedef {import("estree").ConditionalExpression} ConditionalExpressionNode */ +/** @typedef {import("estree").Declaration} DeclarationNode */ +/** @typedef {import("estree").PrivateIdentifier} PrivateIdentifierNode */ +/** @typedef {import("estree").PropertyDefinition} PropertyDefinitionNode */ +/** @typedef {import("estree").Expression} ExpressionNode */ +/** @typedef {import("estree").Identifier} IdentifierNode */ +/** @typedef {import("estree").IfStatement} IfStatementNode */ +/** @typedef {import("estree").LabeledStatement} LabeledStatementNode */ +/** @typedef {import("estree").Literal} LiteralNode */ +/** @typedef {import("estree").LogicalExpression} LogicalExpressionNode */ +/** @typedef {import("estree").ChainExpression} ChainExpressionNode */ +/** @typedef {import("estree").MemberExpression} MemberExpressionNode */ +/** @typedef {import("estree").MetaProperty} MetaPropertyNode */ +/** @typedef {import("estree").MethodDefinition} MethodDefinitionNode */ +/** @typedef {import("estree").ModuleDeclaration} ModuleDeclarationNode */ +/** @typedef {import("estree").NewExpression} NewExpressionNode */ +/** @typedef {import("estree").Node} AnyNode */ +/** @typedef {import("estree").Program} ProgramNode */ +/** @typedef {import("estree").Statement} StatementNode */ +/** @typedef {import("estree").ImportDeclaration} ImportDeclarationNode */ +/** @typedef {import("estree").ExportNamedDeclaration} ExportNamedDeclarationNode */ +/** @typedef {import("estree").ExportDefaultDeclaration} ExportDefaultDeclarationNode */ +/** @typedef {import("estree").ExportAllDeclaration} ExportAllDeclarationNode */ +/** @typedef {import("estree").Super} SuperNode */ +/** @typedef {import("estree").TaggedTemplateExpression} TaggedTemplateExpressionNode */ +/** @typedef {import("estree").TemplateLiteral} TemplateLiteralNode */ +/** @typedef {import("estree").ThisExpression} ThisExpressionNode */ +/** @typedef {import("estree").UnaryExpression} UnaryExpressionNode */ +/** @typedef {import("estree").VariableDeclarator} VariableDeclaratorNode */ +/** @template T @typedef {import("tapable").AsArray} AsArray */ +/** @typedef {import("../Parser").ParserState} ParserState */ +/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ +/** @typedef {{declaredScope: ScopeInfo, freeName: string | true, tagInfo: TagInfo | undefined}} VariableInfoInterface */ +/** @typedef {{ name: string | VariableInfo, rootInfo: string | VariableInfo, getMembers: () => string[] }} GetInfoResult */ -class ChunkModuleIdRangePlugin { - constructor(options) { - this.options = options; - } +const EMPTY_ARRAY = []; +const ALLOWED_MEMBER_TYPES_CALL_EXPRESSION = 0b01; +const ALLOWED_MEMBER_TYPES_EXPRESSION = 0b10; +const ALLOWED_MEMBER_TYPES_ALL = 0b11; - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const options = this.options; - compiler.hooks.compilation.tap("ChunkModuleIdRangePlugin", compilation => { - const moduleGraph = compilation.moduleGraph; - compilation.hooks.moduleIds.tap("ChunkModuleIdRangePlugin", modules => { - const chunkGraph = compilation.chunkGraph; - const chunk = find( - compilation.chunks, - chunk => chunk.name === options.name - ); - if (!chunk) { - throw new Error( - `ChunkModuleIdRangePlugin: Chunk with name '${options.name}"' was not found` - ); - } +// Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API - let chunkModules; - if (options.order) { - let cmpFn; - switch (options.order) { - case "index": - case "preOrderIndex": - cmpFn = compareModulesByPreOrderIndexOrIdentifier(moduleGraph); - break; - case "index2": - case "postOrderIndex": - cmpFn = compareModulesByPostOrderIndexOrIdentifier(moduleGraph); - break; - default: - throw new Error( - "ChunkModuleIdRangePlugin: unexpected value of order" - ); - } - chunkModules = chunkGraph.getOrderedChunkModules(chunk, cmpFn); - } else { - chunkModules = Array.from(modules) - .filter(m => { - return chunkGraph.isModuleInChunk(m, chunk); - }) - .sort(compareModulesByPreOrderIndexOrIdentifier(moduleGraph)); - } +const parser = AcornParser.extend(importAssertions); - let currentId = options.start || 0; - for (let i = 0; i < chunkModules.length; i++) { - const m = chunkModules[i]; - if (m.needId && chunkGraph.getModuleId(m) === null) { - chunkGraph.setModuleId(m, currentId++); - } - if (options.end && currentId > options.end) break; - } - }); - }); +class VariableInfo { + /** + * @param {ScopeInfo} declaredScope scope in which the variable is declared + * @param {string | true} freeName which free name the variable aliases, or true when none + * @param {TagInfo | undefined} tagInfo info about tags + */ + constructor(declaredScope, freeName, tagInfo) { + this.declaredScope = declaredScope; + this.freeName = freeName; + this.tagInfo = tagInfo; } } -module.exports = ChunkModuleIdRangePlugin; - -/***/ }), +/** @typedef {string | ScopeInfo | VariableInfo} ExportedVariableInfo */ +/** @typedef {LiteralNode | string | null | undefined} ImportSource */ +/** @typedef {Omit & { sourceType: "module" | "script" | "auto", ecmaVersion?: AcornOptions["ecmaVersion"] }} ParseOptions */ -/***/ 8747: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * @typedef {Object} TagInfo + * @property {any} tag + * @property {any} data + * @property {TagInfo | undefined} next + */ -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent -*/ +/** + * @typedef {Object} ScopeInfo + * @property {StackedMap} definitions + * @property {boolean | "arrow"} topLevelScope + * @property {boolean} inShorthand + * @property {boolean} isStrict + * @property {boolean} isAsmJs + * @property {boolean} inTry + */ +const joinRanges = (startRange, endRange) => { + if (!endRange) return startRange; + if (!startRange) return endRange; + return [startRange[0], endRange[1]]; +}; +const objectAndMembersToName = (object, membersReversed) => { + let name = object; + for (let i = membersReversed.length - 1; i >= 0; i--) { + name = name + "." + membersReversed[i]; + } + return name; +}; -const { compareChunksNatural } = __webpack_require__(29579); -const { - getFullChunkName, - getUsedChunkIds, - assignDeterministicIds -} = __webpack_require__(63290); +const getRootName = expression => { + switch (expression.type) { + case "Identifier": + return expression.name; + case "ThisExpression": + return "this"; + case "MetaProperty": + return `${expression.meta.name}.${expression.property.name}`; + default: + return undefined; + } +}; -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ +/** @type {AcornOptions} */ +const defaultParserOptions = { + ranges: true, + locations: true, + ecmaVersion: "latest", + sourceType: "module", + // https://github.com/tc39/proposal-hashbang + allowHashBang: true, + onComment: null +}; -class DeterministicChunkIdsPlugin { - constructor(options) { - this.options = options || {}; - } +// regexp to match at least one "magic comment" +const webpackCommentRegExp = new RegExp(/(^|\W)webpack[A-Z]{1,}[A-Za-z]{1,}:/); + +const EMPTY_COMMENT_OPTIONS = { + options: null, + errors: null +}; +class JavascriptParser extends Parser { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {"module" | "script" | "auto"} sourceType default source type */ - apply(compiler) { - compiler.hooks.compilation.tap( - "DeterministicChunkIdsPlugin", - compilation => { - compilation.hooks.chunkIds.tap( - "DeterministicChunkIdsPlugin", - chunks => { - const chunkGraph = compilation.chunkGraph; - const context = this.options.context - ? this.options.context - : compiler.context; - const maxLength = this.options.maxLength || 3; - - const compareNatural = compareChunksNatural(chunkGraph); + constructor(sourceType = "auto") { + super(); + this.hooks = Object.freeze({ + /** @type {HookMap>} */ + evaluateTypeof: new HookMap(() => new SyncBailHook(["expression"])), + /** @type {HookMap>} */ + evaluate: new HookMap(() => new SyncBailHook(["expression"])), + /** @type {HookMap>} */ + evaluateIdentifier: new HookMap(() => new SyncBailHook(["expression"])), + /** @type {HookMap>} */ + evaluateDefinedIdentifier: new HookMap( + () => new SyncBailHook(["expression"]) + ), + /** @type {HookMap>} */ + evaluateCallExpressionMember: new HookMap( + () => new SyncBailHook(["expression", "param"]) + ), + /** @type {HookMap>} */ + isPure: new HookMap( + () => new SyncBailHook(["expression", "commentsStartPosition"]) + ), + /** @type {SyncBailHook<[StatementNode | ModuleDeclarationNode], boolean | void>} */ + preStatement: new SyncBailHook(["statement"]), - const usedIds = getUsedChunkIds(compilation); - assignDeterministicIds( - Array.from(chunks).filter(chunk => { - return chunk.id === null; - }), - chunk => - getFullChunkName(chunk, chunkGraph, context, compiler.root), - compareNatural, - (chunk, id) => { - const size = usedIds.size; - usedIds.add(`${id}`); - if (size === usedIds.size) return false; - chunk.id = id; - chunk.ids = [id]; - return true; - }, - [Math.pow(10, maxLength)], - 10, - usedIds.size - ); - } - ); - } - ); + /** @type {SyncBailHook<[StatementNode | ModuleDeclarationNode], boolean | void>} */ + blockPreStatement: new SyncBailHook(["declaration"]), + /** @type {SyncBailHook<[StatementNode | ModuleDeclarationNode], boolean | void>} */ + statement: new SyncBailHook(["statement"]), + /** @type {SyncBailHook<[IfStatementNode], boolean | void>} */ + statementIf: new SyncBailHook(["statement"]), + /** @type {SyncBailHook<[ExpressionNode, ClassExpressionNode | ClassDeclarationNode], boolean | void>} */ + classExtendsExpression: new SyncBailHook([ + "expression", + "classDefinition" + ]), + /** @type {SyncBailHook<[MethodDefinitionNode | PropertyDefinitionNode, ClassExpressionNode | ClassDeclarationNode], boolean | void>} */ + classBodyElement: new SyncBailHook(["element", "classDefinition"]), + /** @type {SyncBailHook<[ExpressionNode, MethodDefinitionNode | PropertyDefinitionNode, ClassExpressionNode | ClassDeclarationNode], boolean | void>} */ + classBodyValue: new SyncBailHook([ + "expression", + "element", + "classDefinition" + ]), + /** @type {HookMap>} */ + label: new HookMap(() => new SyncBailHook(["statement"])), + /** @type {SyncBailHook<[ImportDeclarationNode, ImportSource], boolean | void>} */ + import: new SyncBailHook(["statement", "source"]), + /** @type {SyncBailHook<[ImportDeclarationNode, ImportSource, string, string], boolean | void>} */ + importSpecifier: new SyncBailHook([ + "statement", + "source", + "exportName", + "identifierName" + ]), + /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode], boolean | void>} */ + export: new SyncBailHook(["statement"]), + /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, ImportSource], boolean | void>} */ + exportImport: new SyncBailHook(["statement", "source"]), + /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, DeclarationNode], boolean | void>} */ + exportDeclaration: new SyncBailHook(["statement", "declaration"]), + /** @type {SyncBailHook<[ExportDefaultDeclarationNode, DeclarationNode], boolean | void>} */ + exportExpression: new SyncBailHook(["statement", "declaration"]), + /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, string, string, number | undefined], boolean | void>} */ + exportSpecifier: new SyncBailHook([ + "statement", + "identifierName", + "exportName", + "index" + ]), + /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, ImportSource, string, string, number | undefined], boolean | void>} */ + exportImportSpecifier: new SyncBailHook([ + "statement", + "source", + "identifierName", + "exportName", + "index" + ]), + /** @type {SyncBailHook<[VariableDeclaratorNode, StatementNode], boolean | void>} */ + preDeclarator: new SyncBailHook(["declarator", "statement"]), + /** @type {SyncBailHook<[VariableDeclaratorNode, StatementNode], boolean | void>} */ + declarator: new SyncBailHook(["declarator", "statement"]), + /** @type {HookMap>} */ + varDeclaration: new HookMap(() => new SyncBailHook(["declaration"])), + /** @type {HookMap>} */ + varDeclarationLet: new HookMap(() => new SyncBailHook(["declaration"])), + /** @type {HookMap>} */ + varDeclarationConst: new HookMap(() => new SyncBailHook(["declaration"])), + /** @type {HookMap>} */ + varDeclarationVar: new HookMap(() => new SyncBailHook(["declaration"])), + /** @type {HookMap>} */ + pattern: new HookMap(() => new SyncBailHook(["pattern"])), + /** @type {HookMap>} */ + canRename: new HookMap(() => new SyncBailHook(["initExpression"])), + /** @type {HookMap>} */ + rename: new HookMap(() => new SyncBailHook(["initExpression"])), + /** @type {HookMap>} */ + assign: new HookMap(() => new SyncBailHook(["expression"])), + /** @type {HookMap>} */ + assignMemberChain: new HookMap( + () => new SyncBailHook(["expression", "members"]) + ), + /** @type {HookMap>} */ + typeof: new HookMap(() => new SyncBailHook(["expression"])), + /** @type {SyncBailHook<[ExpressionNode], boolean | void>} */ + importCall: new SyncBailHook(["expression"]), + /** @type {SyncBailHook<[ExpressionNode], boolean | void>} */ + topLevelAwait: new SyncBailHook(["expression"]), + /** @type {HookMap>} */ + call: new HookMap(() => new SyncBailHook(["expression"])), + /** Something like "a.b()" */ + /** @type {HookMap>} */ + callMemberChain: new HookMap( + () => new SyncBailHook(["expression", "members"]) + ), + /** Something like "a.b().c.d" */ + /** @type {HookMap>} */ + memberChainOfCallMemberChain: new HookMap( + () => + new SyncBailHook([ + "expression", + "calleeMembers", + "callExpression", + "members" + ]) + ), + /** Something like "a.b().c.d()"" */ + /** @type {HookMap>} */ + callMemberChainOfCallMemberChain: new HookMap( + () => + new SyncBailHook([ + "expression", + "calleeMembers", + "innerCallExpression", + "members" + ]) + ), + /** @type {SyncBailHook<[ChainExpressionNode], boolean | void>} */ + optionalChaining: new SyncBailHook(["optionalChaining"]), + /** @type {HookMap>} */ + new: new HookMap(() => new SyncBailHook(["expression"])), + /** @type {HookMap>} */ + expression: new HookMap(() => new SyncBailHook(["expression"])), + /** @type {HookMap>} */ + expressionMemberChain: new HookMap( + () => new SyncBailHook(["expression", "members"]) + ), + /** @type {HookMap>} */ + unhandledExpressionMemberChain: new HookMap( + () => new SyncBailHook(["expression", "members"]) + ), + /** @type {SyncBailHook<[ExpressionNode], boolean | void>} */ + expressionConditionalOperator: new SyncBailHook(["expression"]), + /** @type {SyncBailHook<[ExpressionNode], boolean | void>} */ + expressionLogicalOperator: new SyncBailHook(["expression"]), + /** @type {SyncBailHook<[ProgramNode, CommentNode[]], boolean | void>} */ + program: new SyncBailHook(["ast", "comments"]), + /** @type {SyncBailHook<[ProgramNode, CommentNode[]], boolean | void>} */ + finish: new SyncBailHook(["ast", "comments"]) + }); + this.sourceType = sourceType; + /** @type {ScopeInfo} */ + this.scope = undefined; + /** @type {ParserState} */ + this.state = undefined; + this.comments = undefined; + this.semicolons = undefined; + /** @type {(StatementNode|ExpressionNode)[]} */ + this.statementPath = undefined; + this.prevStatement = undefined; + this.currentTagData = undefined; + this._initializeEvaluating(); } -} - -module.exports = DeterministicChunkIdsPlugin; - - -/***/ }), -/***/ 76692: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent -*/ + _initializeEvaluating() { + this.hooks.evaluate.for("Literal").tap("JavascriptParser", _expr => { + const expr = /** @type {LiteralNode} */ (_expr); + switch (typeof expr.value) { + case "number": + return new BasicEvaluatedExpression() + .setNumber(expr.value) + .setRange(expr.range); + case "bigint": + return new BasicEvaluatedExpression() + .setBigInt(expr.value) + .setRange(expr.range); + case "string": + return new BasicEvaluatedExpression() + .setString(expr.value) + .setRange(expr.range); + case "boolean": + return new BasicEvaluatedExpression() + .setBoolean(expr.value) + .setRange(expr.range); + } + if (expr.value === null) { + return new BasicEvaluatedExpression().setNull().setRange(expr.range); + } + if (expr.value instanceof RegExp) { + return new BasicEvaluatedExpression() + .setRegExp(expr.value) + .setRange(expr.range); + } + }); + this.hooks.evaluate.for("NewExpression").tap("JavascriptParser", _expr => { + const expr = /** @type {NewExpressionNode} */ (_expr); + const callee = expr.callee; + if ( + callee.type !== "Identifier" || + callee.name !== "RegExp" || + expr.arguments.length > 2 || + this.getVariableInfo("RegExp") !== "RegExp" + ) + return; + let regExp, flags; + const arg1 = expr.arguments[0]; -const { - compareModulesByPreOrderIndexOrIdentifier -} = __webpack_require__(29579); -const { - getUsedModuleIdsAndModules, - getFullModuleName, - assignDeterministicIds -} = __webpack_require__(63290); + if (arg1) { + if (arg1.type === "SpreadElement") return; -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ + const evaluatedRegExp = this.evaluateExpression(arg1); -class DeterministicModuleIdsPlugin { - /** - * @param {Object} options options - * @param {string=} options.context context relative to which module identifiers are computed - * @param {function(Module): boolean=} options.test selector function for modules - * @param {number=} options.maxLength maximum id length in digits (used as starting point) - * @param {number=} options.salt hash salt for ids - * @param {boolean=} options.fixedLength do not increase the maxLength to find an optimal id space size - * @param {boolean=} options.failOnConflict throw an error when id conflicts occur (instead of rehashing) - */ - constructor(options = {}) { - this.options = options; - } + if (!evaluatedRegExp) return; - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "DeterministicModuleIdsPlugin", - compilation => { - compilation.hooks.moduleIds.tap("DeterministicModuleIdsPlugin", () => { - const chunkGraph = compilation.chunkGraph; - const context = this.options.context - ? this.options.context - : compiler.context; - const maxLength = this.options.maxLength || 3; - const failOnConflict = this.options.failOnConflict || false; - const fixedLength = this.options.fixedLength || false; - const salt = this.options.salt || 0; - let conflicts = 0; + regExp = evaluatedRegExp.asString(); - const [usedIds, modules] = getUsedModuleIdsAndModules( - compilation, - this.options.test - ); - assignDeterministicIds( - modules, - module => getFullModuleName(module, context, compiler.root), - failOnConflict - ? () => 0 - : compareModulesByPreOrderIndexOrIdentifier( - compilation.moduleGraph - ), - (module, id) => { - const size = usedIds.size; - usedIds.add(`${id}`); - if (size === usedIds.size) { - conflicts++; - return false; - } - chunkGraph.setModuleId(module, id); - return true; - }, - [Math.pow(10, maxLength)], - fixedLength ? 0 : 10, - usedIds.size, - salt - ); - if (failOnConflict && conflicts) - throw new Error( - `Assigning deterministic module ids has lead to ${conflicts} conflict${ - conflicts > 1 ? "s" : "" - }.\nIncrease the 'maxLength' to increase the id space and make conflicts less likely (recommended when there are many conflicts or application is expected to grow), or add an 'salt' number to try another hash starting value in the same id space (recommended when there is only a single conflict).` - ); - }); + if (!regExp) return; + } else { + return new BasicEvaluatedExpression() + .setRegExp(new RegExp("")) + .setRange(expr.range); } - ); - } -} -module.exports = DeterministicModuleIdsPlugin; + const arg2 = expr.arguments[1]; + if (arg2) { + if (arg2.type === "SpreadElement") return; -/***/ }), + const evaluatedFlags = this.evaluateExpression(arg2); -/***/ 21825: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (!evaluatedFlags) return; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (!evaluatedFlags.isUndefined()) { + flags = evaluatedFlags.asString(); + if ( + flags === undefined || + !BasicEvaluatedExpression.isValidRegExpFlags(flags) + ) + return; + } + } + return new BasicEvaluatedExpression() + .setRegExp(flags ? new RegExp(regExp, flags) : new RegExp(regExp)) + .setRange(expr.range); + }); + this.hooks.evaluate + .for("LogicalExpression") + .tap("JavascriptParser", _expr => { + const expr = /** @type {LogicalExpressionNode} */ (_expr); -const { - compareModulesByPreOrderIndexOrIdentifier -} = __webpack_require__(29579); -const createSchemaValidation = __webpack_require__(32540); -const createHash = __webpack_require__(49835); -const { - getUsedModuleIdsAndModules, - getFullModuleName -} = __webpack_require__(63290); + const left = this.evaluateExpression(expr.left); + if (!left) return; + let returnRight = false; + /** @type {boolean|undefined} */ + let allowedRight; + if (expr.operator === "&&") { + const leftAsBool = left.asBool(); + if (leftAsBool === false) return left.setRange(expr.range); + returnRight = leftAsBool === true; + allowedRight = false; + } else if (expr.operator === "||") { + const leftAsBool = left.asBool(); + if (leftAsBool === true) return left.setRange(expr.range); + returnRight = leftAsBool === false; + allowedRight = true; + } else if (expr.operator === "??") { + const leftAsNullish = left.asNullish(); + if (leftAsNullish === false) return left.setRange(expr.range); + if (leftAsNullish !== true) return; + returnRight = true; + } else return; + const right = this.evaluateExpression(expr.right); + if (!right) return; + if (returnRight) { + if (left.couldHaveSideEffects()) right.setSideEffects(); + return right.setRange(expr.range); + } -/** @typedef {import("../../declarations/plugins/HashedModuleIdsPlugin").HashedModuleIdsPluginOptions} HashedModuleIdsPluginOptions */ + const asBool = right.asBool(); -const validate = createSchemaValidation( - __webpack_require__(52210), - () => __webpack_require__(59106), - { - name: "Hashed Module Ids Plugin", - baseDataPath: "options" - } -); + if (allowedRight === true && asBool === true) { + return new BasicEvaluatedExpression() + .setRange(expr.range) + .setTruthy(); + } else if (allowedRight === false && asBool === false) { + return new BasicEvaluatedExpression().setRange(expr.range).setFalsy(); + } + }); -class HashedModuleIdsPlugin { - /** - * @param {HashedModuleIdsPluginOptions=} options options object - */ - constructor(options = {}) { - validate(options); - - /** @type {HashedModuleIdsPluginOptions} */ - this.options = { - context: null, - hashFunction: "md4", - hashDigest: "base64", - hashDigestLength: 4, - ...options + const valueAsExpression = (value, expr, sideEffects) => { + switch (typeof value) { + case "boolean": + return new BasicEvaluatedExpression() + .setBoolean(value) + .setSideEffects(sideEffects) + .setRange(expr.range); + case "number": + return new BasicEvaluatedExpression() + .setNumber(value) + .setSideEffects(sideEffects) + .setRange(expr.range); + case "bigint": + return new BasicEvaluatedExpression() + .setBigInt(value) + .setSideEffects(sideEffects) + .setRange(expr.range); + case "string": + return new BasicEvaluatedExpression() + .setString(value) + .setSideEffects(sideEffects) + .setRange(expr.range); + } }; - } - - apply(compiler) { - const options = this.options; - compiler.hooks.compilation.tap("HashedModuleIdsPlugin", compilation => { - compilation.hooks.moduleIds.tap("HashedModuleIdsPlugin", () => { - const chunkGraph = compilation.chunkGraph; - const context = this.options.context - ? this.options.context - : compiler.context; - const [usedIds, modules] = getUsedModuleIdsAndModules(compilation); - const modulesInNaturalOrder = modules.sort( - compareModulesByPreOrderIndexOrIdentifier(compilation.moduleGraph) - ); - for (const module of modulesInNaturalOrder) { - const ident = getFullModuleName(module, context, compiler.root); - const hash = createHash(options.hashFunction); - hash.update(ident || ""); - const hashId = /** @type {string} */ ( - hash.digest(options.hashDigest) - ); - let len = options.hashDigestLength; - while (usedIds.has(hashId.substr(0, len))) len++; - const moduleId = hashId.substr(0, len); - chunkGraph.setModuleId(module, moduleId); - usedIds.add(moduleId); - } - }); - }); - } -} + this.hooks.evaluate + .for("BinaryExpression") + .tap("JavascriptParser", _expr => { + const expr = /** @type {BinaryExpressionNode} */ (_expr); -module.exports = HashedModuleIdsPlugin; + const handleConstOperation = fn => { + const left = this.evaluateExpression(expr.left); + if (!left || !left.isCompileTimeValue()) return; + const right = this.evaluateExpression(expr.right); + if (!right || !right.isCompileTimeValue()) return; -/***/ }), + const result = fn( + left.asCompileTimeValue(), + right.asCompileTimeValue() + ); + return valueAsExpression( + result, + expr, + left.couldHaveSideEffects() || right.couldHaveSideEffects() + ); + }; -/***/ 63290: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + const isAlwaysDifferent = (a, b) => + (a === true && b === false) || (a === false && b === true); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const handleTemplateStringCompare = (left, right, res, eql) => { + const getPrefix = parts => { + let value = ""; + for (const p of parts) { + const v = p.asString(); + if (v !== undefined) value += v; + else break; + } + return value; + }; + const getSuffix = parts => { + let value = ""; + for (let i = parts.length - 1; i >= 0; i--) { + const v = parts[i].asString(); + if (v !== undefined) value = v + value; + else break; + } + return value; + }; + const leftPrefix = getPrefix(left.parts); + const rightPrefix = getPrefix(right.parts); + const leftSuffix = getSuffix(left.parts); + const rightSuffix = getSuffix(right.parts); + const lenPrefix = Math.min(leftPrefix.length, rightPrefix.length); + const lenSuffix = Math.min(leftSuffix.length, rightSuffix.length); + if ( + leftPrefix.slice(0, lenPrefix) !== + rightPrefix.slice(0, lenPrefix) || + leftSuffix.slice(-lenSuffix) !== rightSuffix.slice(-lenSuffix) + ) { + return res + .setBoolean(!eql) + .setSideEffects( + left.couldHaveSideEffects() || right.couldHaveSideEffects() + ); + } + }; + const handleStrictEqualityComparison = eql => { + const left = this.evaluateExpression(expr.left); + if (!left) return; + const right = this.evaluateExpression(expr.right); + if (!right) return; + const res = new BasicEvaluatedExpression(); + res.setRange(expr.range); + const leftConst = left.isCompileTimeValue(); + const rightConst = right.isCompileTimeValue(); -const createHash = __webpack_require__(49835); -const { makePathsRelative } = __webpack_require__(82186); -const numberHash = __webpack_require__(70002); + if (leftConst && rightConst) { + return res + .setBoolean( + eql === + (left.asCompileTimeValue() === right.asCompileTimeValue()) + ) + .setSideEffects( + left.couldHaveSideEffects() || right.couldHaveSideEffects() + ); + } -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Module")} Module */ -/** @typedef {typeof import("../util/Hash")} Hash */ + if (left.isArray() && right.isArray()) { + return res + .setBoolean(!eql) + .setSideEffects( + left.couldHaveSideEffects() || right.couldHaveSideEffects() + ); + } + if (left.isTemplateString() && right.isTemplateString()) { + return handleTemplateStringCompare(left, right, res, eql); + } -/** - * @param {string} str string to hash - * @param {number} len max length of the hash - * @param {string | Hash} hashFunction hash function to use - * @returns {string} hash - */ -const getHash = (str, len, hashFunction) => { - const hash = createHash(hashFunction); - hash.update(str); - const digest = /** @type {string} */ (hash.digest("hex")); - return digest.substr(0, len); -}; + const leftPrimitive = left.isPrimitiveType(); + const rightPrimitive = right.isPrimitiveType(); -/** - * @param {string} str the string - * @returns {string} string prefixed by an underscore if it is a number - */ -const avoidNumber = str => { - // max length of a number is 21 chars, bigger numbers a written as "...e+xx" - if (str.length > 21) return str; - const firstChar = str.charCodeAt(0); - // skip everything that doesn't look like a number - // charCodes: "-": 45, "1": 49, "9": 57 - if (firstChar < 49) { - if (firstChar !== 45) return str; - } else if (firstChar > 57) { - return str; - } - if (str === +str + "") { - return `_${str}`; - } - return str; -}; + if ( + // Primitive !== Object or + // compile-time object types are never equal to something at runtime + (leftPrimitive === false && + (leftConst || rightPrimitive === true)) || + (rightPrimitive === false && + (rightConst || leftPrimitive === true)) || + // Different nullish or boolish status also means not equal + isAlwaysDifferent(left.asBool(), right.asBool()) || + isAlwaysDifferent(left.asNullish(), right.asNullish()) + ) { + return res + .setBoolean(!eql) + .setSideEffects( + left.couldHaveSideEffects() || right.couldHaveSideEffects() + ); + } + }; -/** - * @param {string} request the request - * @returns {string} id representation - */ -const requestToId = request => { - return request - .replace(/^(\.\.?\/)+/, "") - .replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_"); -}; -exports.requestToId = requestToId; + const handleAbstractEqualityComparison = eql => { + const left = this.evaluateExpression(expr.left); + if (!left) return; + const right = this.evaluateExpression(expr.right); + if (!right) return; + const res = new BasicEvaluatedExpression(); + res.setRange(expr.range); -/** - * @param {string} string the string - * @param {string} delimiter separator for string and hash - * @param {string | Hash} hashFunction hash function to use - * @returns {string} string with limited max length to 100 chars - */ -const shortenLongString = (string, delimiter, hashFunction) => { - if (string.length < 100) return string; - return ( - string.slice(0, 100 - 6 - delimiter.length) + - delimiter + - getHash(string, 6, hashFunction) - ); -}; + const leftConst = left.isCompileTimeValue(); + const rightConst = right.isCompileTimeValue(); -/** - * @param {Module} module the module - * @param {string} context context directory - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {string} short module name - */ -const getShortModuleName = (module, context, associatedObjectForCache) => { - const libIdent = module.libIdent({ context, associatedObjectForCache }); - if (libIdent) return avoidNumber(libIdent); - const nameForCondition = module.nameForCondition(); - if (nameForCondition) - return avoidNumber( - makePathsRelative(context, nameForCondition, associatedObjectForCache) - ); - return ""; -}; -exports.getShortModuleName = getShortModuleName; + if (leftConst && rightConst) { + return res + .setBoolean( + eql === + // eslint-disable-next-line eqeqeq + (left.asCompileTimeValue() == right.asCompileTimeValue()) + ) + .setSideEffects( + left.couldHaveSideEffects() || right.couldHaveSideEffects() + ); + } -/** - * @param {string} shortName the short name - * @param {Module} module the module - * @param {string} context context directory - * @param {string | Hash} hashFunction hash function to use - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {string} long module name - */ -const getLongModuleName = ( - shortName, - module, - context, - hashFunction, - associatedObjectForCache -) => { - const fullName = getFullModuleName(module, context, associatedObjectForCache); - return `${shortName}?${getHash(fullName, 4, hashFunction)}`; -}; -exports.getLongModuleName = getLongModuleName; + if (left.isArray() && right.isArray()) { + return res + .setBoolean(!eql) + .setSideEffects( + left.couldHaveSideEffects() || right.couldHaveSideEffects() + ); + } + if (left.isTemplateString() && right.isTemplateString()) { + return handleTemplateStringCompare(left, right, res, eql); + } + }; -/** - * @param {Module} module the module - * @param {string} context context directory - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {string} full module name - */ -const getFullModuleName = (module, context, associatedObjectForCache) => { - return makePathsRelative( - context, - module.identifier(), - associatedObjectForCache - ); -}; -exports.getFullModuleName = getFullModuleName; + if (expr.operator === "+") { + const left = this.evaluateExpression(expr.left); + if (!left) return; + const right = this.evaluateExpression(expr.right); + if (!right) return; + const res = new BasicEvaluatedExpression(); + if (left.isString()) { + if (right.isString()) { + res.setString(left.string + right.string); + } else if (right.isNumber()) { + res.setString(left.string + right.number); + } else if ( + right.isWrapped() && + right.prefix && + right.prefix.isString() + ) { + // "left" + ("prefix" + inner + "postfix") + // => ("leftPrefix" + inner + "postfix") + res.setWrapped( + new BasicEvaluatedExpression() + .setString(left.string + right.prefix.string) + .setRange(joinRanges(left.range, right.prefix.range)), + right.postfix, + right.wrappedInnerExpressions + ); + } else if (right.isWrapped()) { + // "left" + ([null] + inner + "postfix") + // => ("left" + inner + "postfix") + res.setWrapped( + left, + right.postfix, + right.wrappedInnerExpressions + ); + } else { + // "left" + expr + // => ("left" + expr + "") + res.setWrapped(left, null, [right]); + } + } else if (left.isNumber()) { + if (right.isString()) { + res.setString(left.number + right.string); + } else if (right.isNumber()) { + res.setNumber(left.number + right.number); + } else { + return; + } + } else if (left.isBigInt()) { + if (right.isBigInt()) { + res.setBigInt(left.bigint + right.bigint); + } + } else if (left.isWrapped()) { + if (left.postfix && left.postfix.isString() && right.isString()) { + // ("prefix" + inner + "postfix") + "right" + // => ("prefix" + inner + "postfixRight") + res.setWrapped( + left.prefix, + new BasicEvaluatedExpression() + .setString(left.postfix.string + right.string) + .setRange(joinRanges(left.postfix.range, right.range)), + left.wrappedInnerExpressions + ); + } else if ( + left.postfix && + left.postfix.isString() && + right.isNumber() + ) { + // ("prefix" + inner + "postfix") + 123 + // => ("prefix" + inner + "postfix123") + res.setWrapped( + left.prefix, + new BasicEvaluatedExpression() + .setString(left.postfix.string + right.number) + .setRange(joinRanges(left.postfix.range, right.range)), + left.wrappedInnerExpressions + ); + } else if (right.isString()) { + // ("prefix" + inner + [null]) + "right" + // => ("prefix" + inner + "right") + res.setWrapped(left.prefix, right, left.wrappedInnerExpressions); + } else if (right.isNumber()) { + // ("prefix" + inner + [null]) + 123 + // => ("prefix" + inner + "123") + res.setWrapped( + left.prefix, + new BasicEvaluatedExpression() + .setString(right.number + "") + .setRange(right.range), + left.wrappedInnerExpressions + ); + } else if (right.isWrapped()) { + // ("prefix1" + inner1 + "postfix1") + ("prefix2" + inner2 + "postfix2") + // ("prefix1" + inner1 + "postfix1" + "prefix2" + inner2 + "postfix2") + res.setWrapped( + left.prefix, + right.postfix, + left.wrappedInnerExpressions && + right.wrappedInnerExpressions && + left.wrappedInnerExpressions + .concat(left.postfix ? [left.postfix] : []) + .concat(right.prefix ? [right.prefix] : []) + .concat(right.wrappedInnerExpressions) + ); + } else { + // ("prefix" + inner + postfix) + expr + // => ("prefix" + inner + postfix + expr + [null]) + res.setWrapped( + left.prefix, + null, + left.wrappedInnerExpressions && + left.wrappedInnerExpressions.concat( + left.postfix ? [left.postfix, right] : [right] + ) + ); + } + } else { + if (right.isString()) { + // left + "right" + // => ([null] + left + "right") + res.setWrapped(null, right, [left]); + } else if (right.isWrapped()) { + // left + (prefix + inner + "postfix") + // => ([null] + left + prefix + inner + "postfix") + res.setWrapped( + null, + right.postfix, + right.wrappedInnerExpressions && + (right.prefix ? [left, right.prefix] : [left]).concat( + right.wrappedInnerExpressions + ) + ); + } else { + return; + } + } + if (left.couldHaveSideEffects() || right.couldHaveSideEffects()) + res.setSideEffects(); + res.setRange(expr.range); + return res; + } else if (expr.operator === "-") { + return handleConstOperation((l, r) => l - r); + } else if (expr.operator === "*") { + return handleConstOperation((l, r) => l * r); + } else if (expr.operator === "/") { + return handleConstOperation((l, r) => l / r); + } else if (expr.operator === "**") { + return handleConstOperation((l, r) => l ** r); + } else if (expr.operator === "===") { + return handleStrictEqualityComparison(true); + } else if (expr.operator === "==") { + return handleAbstractEqualityComparison(true); + } else if (expr.operator === "!==") { + return handleStrictEqualityComparison(false); + } else if (expr.operator === "!=") { + return handleAbstractEqualityComparison(false); + } else if (expr.operator === "&") { + return handleConstOperation((l, r) => l & r); + } else if (expr.operator === "|") { + return handleConstOperation((l, r) => l | r); + } else if (expr.operator === "^") { + return handleConstOperation((l, r) => l ^ r); + } else if (expr.operator === ">>>") { + return handleConstOperation((l, r) => l >>> r); + } else if (expr.operator === ">>") { + return handleConstOperation((l, r) => l >> r); + } else if (expr.operator === "<<") { + return handleConstOperation((l, r) => l << r); + } else if (expr.operator === "<") { + return handleConstOperation((l, r) => l < r); + } else if (expr.operator === ">") { + return handleConstOperation((l, r) => l > r); + } else if (expr.operator === "<=") { + return handleConstOperation((l, r) => l <= r); + } else if (expr.operator === ">=") { + return handleConstOperation((l, r) => l >= r); + } + }); + this.hooks.evaluate + .for("UnaryExpression") + .tap("JavascriptParser", _expr => { + const expr = /** @type {UnaryExpressionNode} */ (_expr); -/** - * @param {Chunk} chunk the chunk - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {string} context context directory - * @param {string} delimiter delimiter for names - * @param {string | Hash} hashFunction hash function to use - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {string} short chunk name - */ -const getShortChunkName = ( - chunk, - chunkGraph, - context, - delimiter, - hashFunction, - associatedObjectForCache -) => { - const modules = chunkGraph.getChunkRootModules(chunk); - const shortModuleNames = modules.map(m => - requestToId(getShortModuleName(m, context, associatedObjectForCache)) - ); - chunk.idNameHints.sort(); - const chunkName = Array.from(chunk.idNameHints) - .concat(shortModuleNames) - .filter(Boolean) - .join(delimiter); - return shortenLongString(chunkName, delimiter, hashFunction); -}; -exports.getShortChunkName = getShortChunkName; - -/** - * @param {Chunk} chunk the chunk - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {string} context context directory - * @param {string} delimiter delimiter for names - * @param {string | Hash} hashFunction hash function to use - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {string} short chunk name - */ -const getLongChunkName = ( - chunk, - chunkGraph, - context, - delimiter, - hashFunction, - associatedObjectForCache -) => { - const modules = chunkGraph.getChunkRootModules(chunk); - const shortModuleNames = modules.map(m => - requestToId(getShortModuleName(m, context, associatedObjectForCache)) - ); - const longModuleNames = modules.map(m => - requestToId( - getLongModuleName("", m, context, hashFunction, associatedObjectForCache) - ) - ); - chunk.idNameHints.sort(); - const chunkName = Array.from(chunk.idNameHints) - .concat(shortModuleNames, longModuleNames) - .filter(Boolean) - .join(delimiter); - return shortenLongString(chunkName, delimiter, hashFunction); -}; -exports.getLongChunkName = getLongChunkName; - -/** - * @param {Chunk} chunk the chunk - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {string} context context directory - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {string} full chunk name - */ -const getFullChunkName = ( - chunk, - chunkGraph, - context, - associatedObjectForCache -) => { - if (chunk.name) return chunk.name; - const modules = chunkGraph.getChunkRootModules(chunk); - const fullModuleNames = modules.map(m => - makePathsRelative(context, m.identifier(), associatedObjectForCache) - ); - return fullModuleNames.join(); -}; -exports.getFullChunkName = getFullChunkName; - -/** - * @template K - * @template V - * @param {Map} map a map from key to values - * @param {K} key key - * @param {V} value value - * @returns {void} - */ -const addToMapOfItems = (map, key, value) => { - let array = map.get(key); - if (array === undefined) { - array = []; - map.set(key, array); - } - array.push(value); -}; + const handleConstOperation = fn => { + const argument = this.evaluateExpression(expr.argument); + if (!argument || !argument.isCompileTimeValue()) return; + const result = fn(argument.asCompileTimeValue()); + return valueAsExpression( + result, + expr, + argument.couldHaveSideEffects() + ); + }; -/** - * @param {Compilation} compilation the compilation - * @param {function(Module): boolean=} filter filter modules - * @returns {[Set, Module[]]} used module ids as strings and modules without id matching the filter - */ -const getUsedModuleIdsAndModules = (compilation, filter) => { - const chunkGraph = compilation.chunkGraph; + if (expr.operator === "typeof") { + switch (expr.argument.type) { + case "Identifier": { + const res = this.callHooksForName( + this.hooks.evaluateTypeof, + expr.argument.name, + expr + ); + if (res !== undefined) return res; + break; + } + case "MetaProperty": { + const res = this.callHooksForName( + this.hooks.evaluateTypeof, + getRootName(expr.argument), + expr + ); + if (res !== undefined) return res; + break; + } + case "MemberExpression": { + const res = this.callHooksForExpression( + this.hooks.evaluateTypeof, + expr.argument, + expr + ); + if (res !== undefined) return res; + break; + } + case "ChainExpression": { + const res = this.callHooksForExpression( + this.hooks.evaluateTypeof, + expr.argument.expression, + expr + ); + if (res !== undefined) return res; + break; + } + case "FunctionExpression": { + return new BasicEvaluatedExpression() + .setString("function") + .setRange(expr.range); + } + } + const arg = this.evaluateExpression(expr.argument); + if (arg.isUnknown()) return; + if (arg.isString()) { + return new BasicEvaluatedExpression() + .setString("string") + .setRange(expr.range); + } + if (arg.isWrapped()) { + return new BasicEvaluatedExpression() + .setString("string") + .setSideEffects() + .setRange(expr.range); + } + if (arg.isUndefined()) { + return new BasicEvaluatedExpression() + .setString("undefined") + .setRange(expr.range); + } + if (arg.isNumber()) { + return new BasicEvaluatedExpression() + .setString("number") + .setRange(expr.range); + } + if (arg.isBigInt()) { + return new BasicEvaluatedExpression() + .setString("bigint") + .setRange(expr.range); + } + if (arg.isBoolean()) { + return new BasicEvaluatedExpression() + .setString("boolean") + .setRange(expr.range); + } + if (arg.isConstArray() || arg.isRegExp() || arg.isNull()) { + return new BasicEvaluatedExpression() + .setString("object") + .setRange(expr.range); + } + if (arg.isArray()) { + return new BasicEvaluatedExpression() + .setString("object") + .setSideEffects(arg.couldHaveSideEffects()) + .setRange(expr.range); + } + } else if (expr.operator === "!") { + const argument = this.evaluateExpression(expr.argument); + if (!argument) return; + const bool = argument.asBool(); + if (typeof bool !== "boolean") return; + return new BasicEvaluatedExpression() + .setBoolean(!bool) + .setSideEffects(argument.couldHaveSideEffects()) + .setRange(expr.range); + } else if (expr.operator === "~") { + return handleConstOperation(v => ~v); + } else if (expr.operator === "+") { + return handleConstOperation(v => +v); + } else if (expr.operator === "-") { + return handleConstOperation(v => -v); + } + }); + this.hooks.evaluateTypeof.for("undefined").tap("JavascriptParser", expr => { + return new BasicEvaluatedExpression() + .setString("undefined") + .setRange(expr.range); + }); + this.hooks.evaluate.for("Identifier").tap("JavascriptParser", expr => { + if (/** @type {IdentifierNode} */ (expr).name === "undefined") { + return new BasicEvaluatedExpression() + .setUndefined() + .setRange(expr.range); + } + }); + /** + * @param {string} exprType expression type name + * @param {function(ExpressionNode): GetInfoResult | undefined} getInfo get info + * @returns {void} + */ + const tapEvaluateWithVariableInfo = (exprType, getInfo) => { + /** @type {ExpressionNode | undefined} */ + let cachedExpression = undefined; + /** @type {GetInfoResult | undefined} */ + let cachedInfo = undefined; + this.hooks.evaluate.for(exprType).tap("JavascriptParser", expr => { + const expression = /** @type {MemberExpressionNode} */ (expr); - const modules = []; + const info = getInfo(expr); + if (info !== undefined) { + return this.callHooksForInfoWithFallback( + this.hooks.evaluateIdentifier, + info.name, + name => { + cachedExpression = expression; + cachedInfo = info; + }, + name => { + const hook = this.hooks.evaluateDefinedIdentifier.get(name); + if (hook !== undefined) { + return hook.call(expression); + } + }, + expression + ); + } + }); + this.hooks.evaluate + .for(exprType) + .tap({ name: "JavascriptParser", stage: 100 }, expr => { + const info = cachedExpression === expr ? cachedInfo : getInfo(expr); + if (info !== undefined) { + return new BasicEvaluatedExpression() + .setIdentifier(info.name, info.rootInfo, info.getMembers) + .setRange(expr.range); + } + }); + this.hooks.finish.tap("JavascriptParser", () => { + // Cleanup for GC + cachedExpression = cachedInfo = undefined; + }); + }; + tapEvaluateWithVariableInfo("Identifier", expr => { + const info = this.getVariableInfo( + /** @type {IdentifierNode} */ (expr).name + ); + if ( + typeof info === "string" || + (info instanceof VariableInfo && typeof info.freeName === "string") + ) { + return { name: info, rootInfo: info, getMembers: () => [] }; + } + }); + tapEvaluateWithVariableInfo("ThisExpression", expr => { + const info = this.getVariableInfo("this"); + if ( + typeof info === "string" || + (info instanceof VariableInfo && typeof info.freeName === "string") + ) { + return { name: info, rootInfo: info, getMembers: () => [] }; + } + }); + this.hooks.evaluate.for("MetaProperty").tap("JavascriptParser", expr => { + const metaProperty = /** @type {MetaPropertyNode} */ (expr); - /** @type {Set} */ - const usedIds = new Set(); - if (compilation.usedModuleIds) { - for (const id of compilation.usedModuleIds) { - usedIds.add(id + ""); - } - } + return this.callHooksForName( + this.hooks.evaluateIdentifier, + getRootName(expr), + metaProperty + ); + }); + tapEvaluateWithVariableInfo("MemberExpression", expr => + this.getMemberExpressionInfo( + /** @type {MemberExpressionNode} */ (expr), + ALLOWED_MEMBER_TYPES_EXPRESSION + ) + ); - for (const module of compilation.modules) { - if (!module.needId) continue; - const moduleId = chunkGraph.getModuleId(module); - if (moduleId !== null) { - usedIds.add(moduleId + ""); - } else { + this.hooks.evaluate.for("CallExpression").tap("JavascriptParser", _expr => { + const expr = /** @type {CallExpressionNode} */ (_expr); if ( - (!filter || filter(module)) && - chunkGraph.getNumberOfModuleChunks(module) !== 0 + expr.callee.type !== "MemberExpression" || + expr.callee.property.type !== + (expr.callee.computed ? "Literal" : "Identifier") ) { - modules.push(module); + return; } - } - } - - return [usedIds, modules]; -}; -exports.getUsedModuleIdsAndModules = getUsedModuleIdsAndModules; -/** - * @param {Compilation} compilation the compilation - * @returns {Set} used chunk ids as strings - */ -const getUsedChunkIds = compilation => { - /** @type {Set} */ - const usedIds = new Set(); - if (compilation.usedChunkIds) { - for (const id of compilation.usedChunkIds) { - usedIds.add(id + ""); - } - } + // type Super also possible here + const param = this.evaluateExpression( + /** @type {ExpressionNode} */ (expr.callee.object) + ); + if (!param) return; + const property = + expr.callee.property.type === "Literal" + ? `${expr.callee.property.value}` + : expr.callee.property.name; + const hook = this.hooks.evaluateCallExpressionMember.get(property); + if (hook !== undefined) { + return hook.call(expr, param); + } + }); + this.hooks.evaluateCallExpressionMember + .for("indexOf") + .tap("JavascriptParser", (expr, param) => { + if (!param.isString()) return; + if (expr.arguments.length === 0) return; + const [arg1, arg2] = expr.arguments; + if (arg1.type === "SpreadElement") return; + const arg1Eval = this.evaluateExpression(arg1); + if (!arg1Eval.isString()) return; + const arg1Value = arg1Eval.string; - for (const chunk of compilation.chunks) { - const chunkId = chunk.id; - if (chunkId !== null) { - usedIds.add(chunkId + ""); - } - } + let result; + if (arg2) { + if (arg2.type === "SpreadElement") return; + const arg2Eval = this.evaluateExpression(arg2); + if (!arg2Eval.isNumber()) return; + result = param.string.indexOf(arg1Value, arg2Eval.number); + } else { + result = param.string.indexOf(arg1Value); + } + return new BasicEvaluatedExpression() + .setNumber(result) + .setSideEffects(param.couldHaveSideEffects()) + .setRange(expr.range); + }); + this.hooks.evaluateCallExpressionMember + .for("replace") + .tap("JavascriptParser", (expr, param) => { + if (!param.isString()) return; + if (expr.arguments.length !== 2) return; + if (expr.arguments[0].type === "SpreadElement") return; + if (expr.arguments[1].type === "SpreadElement") return; + let arg1 = this.evaluateExpression(expr.arguments[0]); + let arg2 = this.evaluateExpression(expr.arguments[1]); + if (!arg1.isString() && !arg1.isRegExp()) return; + const arg1Value = arg1.regExp || arg1.string; + if (!arg2.isString()) return; + const arg2Value = arg2.string; + return new BasicEvaluatedExpression() + .setString(param.string.replace(arg1Value, arg2Value)) + .setSideEffects(param.couldHaveSideEffects()) + .setRange(expr.range); + }); + ["substr", "substring", "slice"].forEach(fn => { + this.hooks.evaluateCallExpressionMember + .for(fn) + .tap("JavascriptParser", (expr, param) => { + if (!param.isString()) return; + let arg1; + let result, + str = param.string; + switch (expr.arguments.length) { + case 1: + if (expr.arguments[0].type === "SpreadElement") return; + arg1 = this.evaluateExpression(expr.arguments[0]); + if (!arg1.isNumber()) return; + result = str[fn](arg1.number); + break; + case 2: { + if (expr.arguments[0].type === "SpreadElement") return; + if (expr.arguments[1].type === "SpreadElement") return; + arg1 = this.evaluateExpression(expr.arguments[0]); + const arg2 = this.evaluateExpression(expr.arguments[1]); + if (!arg1.isNumber()) return; + if (!arg2.isNumber()) return; + result = str[fn](arg1.number, arg2.number); + break; + } + default: + return; + } + return new BasicEvaluatedExpression() + .setString(result) + .setSideEffects(param.couldHaveSideEffects()) + .setRange(expr.range); + }); + }); - return usedIds; -}; -exports.getUsedChunkIds = getUsedChunkIds; + /** + * @param {"cooked" | "raw"} kind kind of values to get + * @param {TemplateLiteralNode} templateLiteralExpr TemplateLiteral expr + * @returns {{quasis: BasicEvaluatedExpression[], parts: BasicEvaluatedExpression[]}} Simplified template + */ + const getSimplifiedTemplateResult = (kind, templateLiteralExpr) => { + /** @type {BasicEvaluatedExpression[]} */ + const quasis = []; + /** @type {BasicEvaluatedExpression[]} */ + const parts = []; -/** - * @template T - * @param {Iterable} items list of items to be named - * @param {function(T): string} getShortName get a short name for an item - * @param {function(T, string): string} getLongName get a long name for an item - * @param {function(T, T): -1|0|1} comparator order of items - * @param {Set} usedIds already used ids, will not be assigned - * @param {function(T, string): void} assignName assign a name to an item - * @returns {T[]} list of items without a name - */ -const assignNames = ( - items, - getShortName, - getLongName, - comparator, - usedIds, - assignName -) => { - /** @type {Map} */ - const nameToItems = new Map(); + for (let i = 0; i < templateLiteralExpr.quasis.length; i++) { + const quasiExpr = templateLiteralExpr.quasis[i]; + const quasi = quasiExpr.value[kind]; - for (const item of items) { - const name = getShortName(item); - addToMapOfItems(nameToItems, name, item); - } + if (i > 0) { + const prevExpr = parts[parts.length - 1]; + const expr = this.evaluateExpression( + templateLiteralExpr.expressions[i - 1] + ); + const exprAsString = expr.asString(); + if ( + typeof exprAsString === "string" && + !expr.couldHaveSideEffects() + ) { + // We can merge quasi + expr + quasi when expr + // is a const string - /** @type {Map} */ - const nameToItems2 = new Map(); + prevExpr.setString(prevExpr.string + exprAsString + quasi); + prevExpr.setRange([prevExpr.range[0], quasiExpr.range[1]]); + // We unset the expression as it doesn't match to a single expression + prevExpr.setExpression(undefined); + continue; + } + parts.push(expr); + } - for (const [name, items] of nameToItems) { - if (items.length > 1 || !name) { - for (const item of items) { - const longName = getLongName(item, name); - addToMapOfItems(nameToItems2, longName, item); - } - } else { - addToMapOfItems(nameToItems2, name, items[0]); - } - } - - /** @type {T[]} */ - const unnamedItems = []; - - for (const [name, items] of nameToItems2) { - if (!name) { - for (const item of items) { - unnamedItems.push(item); - } - } else if (items.length === 1 && !usedIds.has(name)) { - assignName(items[0], name); - usedIds.add(name); - } else { - items.sort(comparator); - let i = 0; - for (const item of items) { - while (nameToItems2.has(name + i) && usedIds.has(name + i)) i++; - assignName(item, name + i); - usedIds.add(name + i); - i++; + const part = new BasicEvaluatedExpression() + .setString(quasi) + .setRange(quasiExpr.range) + .setExpression(quasiExpr); + quasis.push(part); + parts.push(part); } - } - } - - unnamedItems.sort(comparator); - return unnamedItems; -}; -exports.assignNames = assignNames; - -/** - * @template T - * @param {T[]} items list of items to be named - * @param {function(T): string} getName get a name for an item - * @param {function(T, T): -1|0|1} comparator order of items - * @param {function(T, number): boolean} assignId assign an id to an item - * @param {number[]} ranges usable ranges for ids - * @param {number} expandFactor factor to create more ranges - * @param {number} extraSpace extra space to allocate, i. e. when some ids are already used - * @param {number} salt salting number to initialize hashing - * @returns {void} - */ -const assignDeterministicIds = ( - items, - getName, - comparator, - assignId, - ranges = [10], - expandFactor = 10, - extraSpace = 0, - salt = 0 -) => { - items.sort(comparator); - - // max 5% fill rate - const optimalRange = Math.min( - Math.ceil(items.length * 20) + extraSpace, - Number.MAX_SAFE_INTEGER - ); - - let i = 0; - let range = ranges[i]; - while (range < optimalRange) { - i++; - if (i < ranges.length) { - range = Math.min(ranges[i], Number.MAX_SAFE_INTEGER); - } else if (expandFactor) { - range = Math.min(range * expandFactor, Number.MAX_SAFE_INTEGER); - } else { - break; - } - } + return { + quasis, + parts + }; + }; - for (const item of items) { - const ident = getName(item); - let id; - let i = salt; - do { - id = numberHash(ident + i++, range); - } while (!assignId(item, id)); - } -}; -exports.assignDeterministicIds = assignDeterministicIds; + this.hooks.evaluate + .for("TemplateLiteral") + .tap("JavascriptParser", _node => { + const node = /** @type {TemplateLiteralNode} */ (_node); -/** - * @param {Set} usedIds used ids - * @param {Iterable} modules the modules - * @param {Compilation} compilation the compilation - * @returns {void} - */ -const assignAscendingModuleIds = (usedIds, modules, compilation) => { - const chunkGraph = compilation.chunkGraph; + const { quasis, parts } = getSimplifiedTemplateResult("cooked", node); + if (parts.length === 1) { + return parts[0].setRange(node.range); + } + return new BasicEvaluatedExpression() + .setTemplateString(quasis, parts, "cooked") + .setRange(node.range); + }); + this.hooks.evaluate + .for("TaggedTemplateExpression") + .tap("JavascriptParser", _node => { + const node = /** @type {TaggedTemplateExpressionNode} */ (_node); + const tag = this.evaluateExpression(node.tag); - let nextId = 0; - let assignId; - if (usedIds.size > 0) { - assignId = module => { - if (chunkGraph.getModuleId(module) === null) { - while (usedIds.has(nextId + "")) nextId++; - chunkGraph.setModuleId(module, nextId++); - } - }; - } else { - assignId = module => { - if (chunkGraph.getModuleId(module) === null) { - chunkGraph.setModuleId(module, nextId++); - } - }; - } - for (const module of modules) { - assignId(module); - } -}; -exports.assignAscendingModuleIds = assignAscendingModuleIds; + if (tag.isIdentifier() && tag.identifier === "String.raw") { + const { quasis, parts } = getSimplifiedTemplateResult( + "raw", + node.quasi + ); + return new BasicEvaluatedExpression() + .setTemplateString(quasis, parts, "raw") + .setRange(node.range); + } + }); -/** - * @param {Iterable} chunks the chunks - * @param {Compilation} compilation the compilation - * @returns {void} - */ -const assignAscendingChunkIds = (chunks, compilation) => { - const usedIds = getUsedChunkIds(compilation); + this.hooks.evaluateCallExpressionMember + .for("concat") + .tap("JavascriptParser", (expr, param) => { + if (!param.isString() && !param.isWrapped()) return; - let nextId = 0; - if (usedIds.size > 0) { - for (const chunk of chunks) { - if (chunk.id === null) { - while (usedIds.has(nextId + "")) nextId++; - chunk.id = nextId; - chunk.ids = [nextId]; - nextId++; - } - } - } else { - for (const chunk of chunks) { - if (chunk.id === null) { - chunk.id = nextId; - chunk.ids = [nextId]; - nextId++; - } - } - } -}; -exports.assignAscendingChunkIds = assignAscendingChunkIds; + let stringSuffix = null; + let hasUnknownParams = false; + const innerExpressions = []; + for (let i = expr.arguments.length - 1; i >= 0; i--) { + const arg = expr.arguments[i]; + if (arg.type === "SpreadElement") return; + const argExpr = this.evaluateExpression(arg); + if ( + hasUnknownParams || + (!argExpr.isString() && !argExpr.isNumber()) + ) { + hasUnknownParams = true; + innerExpressions.push(argExpr); + continue; + } + const value = argExpr.isString() + ? argExpr.string + : "" + argExpr.number; -/***/ }), + const newString = value + (stringSuffix ? stringSuffix.string : ""); + const newRange = [ + argExpr.range[0], + (stringSuffix || argExpr).range[1] + ]; + stringSuffix = new BasicEvaluatedExpression() + .setString(newString) + .setSideEffects( + (stringSuffix && stringSuffix.couldHaveSideEffects()) || + argExpr.couldHaveSideEffects() + ) + .setRange(newRange); + } -/***/ 6454: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (hasUnknownParams) { + const prefix = param.isString() ? param : param.prefix; + const inner = + param.isWrapped() && param.wrappedInnerExpressions + ? param.wrappedInnerExpressions.concat(innerExpressions.reverse()) + : innerExpressions.reverse(); + return new BasicEvaluatedExpression() + .setWrapped(prefix, stringSuffix, inner) + .setRange(expr.range); + } else if (param.isWrapped()) { + const postfix = stringSuffix || param.postfix; + const inner = param.wrappedInnerExpressions + ? param.wrappedInnerExpressions.concat(innerExpressions.reverse()) + : innerExpressions.reverse(); + return new BasicEvaluatedExpression() + .setWrapped(param.prefix, postfix, inner) + .setRange(expr.range); + } else { + const newString = + param.string + (stringSuffix ? stringSuffix.string : ""); + return new BasicEvaluatedExpression() + .setString(newString) + .setSideEffects( + (stringSuffix && stringSuffix.couldHaveSideEffects()) || + param.couldHaveSideEffects() + ) + .setRange(expr.range); + } + }); + this.hooks.evaluateCallExpressionMember + .for("split") + .tap("JavascriptParser", (expr, param) => { + if (!param.isString()) return; + if (expr.arguments.length !== 1) return; + if (expr.arguments[0].type === "SpreadElement") return; + let result; + const arg = this.evaluateExpression(expr.arguments[0]); + if (arg.isString()) { + result = param.string.split(arg.string); + } else if (arg.isRegExp()) { + result = param.string.split(arg.regExp); + } else { + return; + } + return new BasicEvaluatedExpression() + .setArray(result) + .setSideEffects(param.couldHaveSideEffects()) + .setRange(expr.range); + }); + this.hooks.evaluate + .for("ConditionalExpression") + .tap("JavascriptParser", _expr => { + const expr = /** @type {ConditionalExpressionNode} */ (_expr); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const condition = this.evaluateExpression(expr.test); + const conditionValue = condition.asBool(); + let res; + if (conditionValue === undefined) { + const consequent = this.evaluateExpression(expr.consequent); + const alternate = this.evaluateExpression(expr.alternate); + if (!consequent || !alternate) return; + res = new BasicEvaluatedExpression(); + if (consequent.isConditional()) { + res.setOptions(consequent.options); + } else { + res.setOptions([consequent]); + } + if (alternate.isConditional()) { + res.addOptions(alternate.options); + } else { + res.addOptions([alternate]); + } + } else { + res = this.evaluateExpression( + conditionValue ? expr.consequent : expr.alternate + ); + if (condition.couldHaveSideEffects()) res.setSideEffects(); + } + res.setRange(expr.range); + return res; + }); + this.hooks.evaluate + .for("ArrayExpression") + .tap("JavascriptParser", _expr => { + const expr = /** @type {ArrayExpressionNode} */ (_expr); + const items = expr.elements.map(element => { + return ( + element !== null && + element.type !== "SpreadElement" && + this.evaluateExpression(element) + ); + }); + if (!items.every(Boolean)) return; + return new BasicEvaluatedExpression() + .setItems(items) + .setRange(expr.range); + }); + this.hooks.evaluate + .for("ChainExpression") + .tap("JavascriptParser", _expr => { + const expr = /** @type {ChainExpressionNode} */ (_expr); + /** @type {ExpressionNode[]} */ + const optionalExpressionsStack = []; + /** @type {ExpressionNode|SuperNode} */ + let next = expr.expression; + while ( + next.type === "MemberExpression" || + next.type === "CallExpression" + ) { + if (next.type === "MemberExpression") { + if (next.optional) { + // SuperNode can not be optional + optionalExpressionsStack.push( + /** @type {ExpressionNode} */ (next.object) + ); + } + next = next.object; + } else { + if (next.optional) { + // SuperNode can not be optional + optionalExpressionsStack.push( + /** @type {ExpressionNode} */ (next.callee) + ); + } + next = next.callee; + } + } -const { compareChunksNatural } = __webpack_require__(29579); -const { - getShortChunkName, - getLongChunkName, - assignNames, - getUsedChunkIds, - assignAscendingChunkIds -} = __webpack_require__(63290); + while (optionalExpressionsStack.length > 0) { + const expression = optionalExpressionsStack.pop(); + const evaluated = this.evaluateExpression(expression); -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ + if (evaluated && evaluated.asNullish()) { + return evaluated.setRange(_expr.range); + } + } + return this.evaluateExpression(expr.expression); + }); + } -class NamedChunkIdsPlugin { - constructor(options) { - this.delimiter = (options && options.delimiter) || "-"; - this.context = options && options.context; + getRenameIdentifier(expr) { + const result = this.evaluateExpression(expr); + if (result && result.isIdentifier()) { + return result.identifier; + } } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {ClassExpressionNode | ClassDeclarationNode} classy a class node * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap("NamedChunkIdsPlugin", compilation => { - const { hashFunction } = compilation.outputOptions; - compilation.hooks.chunkIds.tap("NamedChunkIdsPlugin", chunks => { - const chunkGraph = compilation.chunkGraph; - const context = this.context ? this.context : compiler.context; - const delimiter = this.delimiter; - - const unnamedChunks = assignNames( - Array.from(chunks).filter(chunk => { - if (chunk.name) { - chunk.id = chunk.name; - chunk.ids = [chunk.name]; + walkClass(classy) { + if (classy.superClass) { + if (!this.hooks.classExtendsExpression.call(classy.superClass, classy)) { + this.walkExpression(classy.superClass); + } + } + if (classy.body && classy.body.type === "ClassBody") { + for (const classElement of /** @type {TODO} */ (classy.body.body)) { + if (!this.hooks.classBodyElement.call(classElement, classy)) { + if (classElement.computed && classElement.key) { + this.walkExpression(classElement.key); + } + if (classElement.value) { + if ( + !this.hooks.classBodyValue.call( + classElement.value, + classElement, + classy + ) + ) { + const wasTopLevel = this.scope.topLevelScope; + this.scope.topLevelScope = false; + this.walkExpression(classElement.value); + this.scope.topLevelScope = wasTopLevel; } - return chunk.id === null; - }), - chunk => - getShortChunkName( - chunk, - chunkGraph, - context, - delimiter, - hashFunction, - compiler.root - ), - chunk => - getLongChunkName( - chunk, - chunkGraph, - context, - delimiter, - hashFunction, - compiler.root - ), - compareChunksNatural(chunkGraph), - getUsedChunkIds(compilation), - (chunk, name) => { - chunk.id = name; - chunk.ids = [name]; } - ); - if (unnamedChunks.length > 0) { - assignAscendingChunkIds(unnamedChunks, compilation); } - }); - }); + } + } } -} - -module.exports = NamedChunkIdsPlugin; - - -/***/ }), - -/***/ 24339: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // Pre walking iterates the scope for variable declarations + preWalkStatements(statements) { + for (let index = 0, len = statements.length; index < len; index++) { + const statement = statements[index]; + this.preWalkStatement(statement); + } + } + // Block pre walking iterates the scope for block variable declarations + blockPreWalkStatements(statements) { + for (let index = 0, len = statements.length; index < len; index++) { + const statement = statements[index]; + this.blockPreWalkStatement(statement); + } + } -const { compareModulesByIdentifier } = __webpack_require__(29579); -const { - getShortModuleName, - getLongModuleName, - assignNames, - getUsedModuleIdsAndModules, - assignAscendingModuleIds -} = __webpack_require__(63290); - -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ - -class NamedModuleIdsPlugin { - constructor(options) { - this.options = options || {}; + // Walking iterates the statements and expressions and processes them + walkStatements(statements) { + for (let index = 0, len = statements.length; index < len; index++) { + const statement = statements[index]; + this.walkStatement(statement); + } } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const { root } = compiler; - compiler.hooks.compilation.tap("NamedModuleIdsPlugin", compilation => { - const { hashFunction } = compilation.outputOptions; - compilation.hooks.moduleIds.tap("NamedModuleIdsPlugin", () => { - const chunkGraph = compilation.chunkGraph; - const context = this.options.context - ? this.options.context - : compiler.context; - - const [usedIds, modules] = getUsedModuleIdsAndModules(compilation); - const unnamedModules = assignNames( - modules, - m => getShortModuleName(m, context, root), - (m, shortName) => - getLongModuleName(shortName, m, context, hashFunction, root), - compareModulesByIdentifier, - usedIds, - (m, name) => chunkGraph.setModuleId(m, name) - ); - if (unnamedModules.length > 0) { - assignAscendingModuleIds(usedIds, unnamedModules, compilation); - } - }); - }); + preWalkStatement(statement) { + this.statementPath.push(statement); + if (this.hooks.preStatement.call(statement)) { + this.prevStatement = this.statementPath.pop(); + return; + } + switch (statement.type) { + case "BlockStatement": + this.preWalkBlockStatement(statement); + break; + case "DoWhileStatement": + this.preWalkDoWhileStatement(statement); + break; + case "ForInStatement": + this.preWalkForInStatement(statement); + break; + case "ForOfStatement": + this.preWalkForOfStatement(statement); + break; + case "ForStatement": + this.preWalkForStatement(statement); + break; + case "FunctionDeclaration": + this.preWalkFunctionDeclaration(statement); + break; + case "IfStatement": + this.preWalkIfStatement(statement); + break; + case "LabeledStatement": + this.preWalkLabeledStatement(statement); + break; + case "SwitchStatement": + this.preWalkSwitchStatement(statement); + break; + case "TryStatement": + this.preWalkTryStatement(statement); + break; + case "VariableDeclaration": + this.preWalkVariableDeclaration(statement); + break; + case "WhileStatement": + this.preWalkWhileStatement(statement); + break; + case "WithStatement": + this.preWalkWithStatement(statement); + break; + } + this.prevStatement = this.statementPath.pop(); } -} - -module.exports = NamedModuleIdsPlugin; - - -/***/ }), - -/***/ 86221: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + blockPreWalkStatement(statement) { + this.statementPath.push(statement); + if (this.hooks.blockPreStatement.call(statement)) { + this.prevStatement = this.statementPath.pop(); + return; + } + switch (statement.type) { + case "ImportDeclaration": + this.blockPreWalkImportDeclaration(statement); + break; + case "ExportAllDeclaration": + this.blockPreWalkExportAllDeclaration(statement); + break; + case "ExportDefaultDeclaration": + this.blockPreWalkExportDefaultDeclaration(statement); + break; + case "ExportNamedDeclaration": + this.blockPreWalkExportNamedDeclaration(statement); + break; + case "VariableDeclaration": + this.blockPreWalkVariableDeclaration(statement); + break; + case "ClassDeclaration": + this.blockPreWalkClassDeclaration(statement); + break; + } + this.prevStatement = this.statementPath.pop(); + } + walkStatement(statement) { + this.statementPath.push(statement); + if (this.hooks.statement.call(statement) !== undefined) { + this.prevStatement = this.statementPath.pop(); + return; + } + switch (statement.type) { + case "BlockStatement": + this.walkBlockStatement(statement); + break; + case "ClassDeclaration": + this.walkClassDeclaration(statement); + break; + case "DoWhileStatement": + this.walkDoWhileStatement(statement); + break; + case "ExportDefaultDeclaration": + this.walkExportDefaultDeclaration(statement); + break; + case "ExportNamedDeclaration": + this.walkExportNamedDeclaration(statement); + break; + case "ExpressionStatement": + this.walkExpressionStatement(statement); + break; + case "ForInStatement": + this.walkForInStatement(statement); + break; + case "ForOfStatement": + this.walkForOfStatement(statement); + break; + case "ForStatement": + this.walkForStatement(statement); + break; + case "FunctionDeclaration": + this.walkFunctionDeclaration(statement); + break; + case "IfStatement": + this.walkIfStatement(statement); + break; + case "LabeledStatement": + this.walkLabeledStatement(statement); + break; + case "ReturnStatement": + this.walkReturnStatement(statement); + break; + case "SwitchStatement": + this.walkSwitchStatement(statement); + break; + case "ThrowStatement": + this.walkThrowStatement(statement); + break; + case "TryStatement": + this.walkTryStatement(statement); + break; + case "VariableDeclaration": + this.walkVariableDeclaration(statement); + break; + case "WhileStatement": + this.walkWhileStatement(statement); + break; + case "WithStatement": + this.walkWithStatement(statement); + break; + } + this.prevStatement = this.statementPath.pop(); + } -const { compareChunksNatural } = __webpack_require__(29579); -const { assignAscendingChunkIds } = __webpack_require__(63290); - -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ - -class NaturalChunkIdsPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * Walks a statements that is nested within a parent statement + * and can potentially be a non-block statement. + * This enforces the nested statement to never be in ASI position. + * @param {StatementNode} statement the nested statement * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap("NaturalChunkIdsPlugin", compilation => { - compilation.hooks.chunkIds.tap("NaturalChunkIdsPlugin", chunks => { - const chunkGraph = compilation.chunkGraph; - const compareNatural = compareChunksNatural(chunkGraph); - const chunksInNaturalOrder = Array.from(chunks).sort(compareNatural); - assignAscendingChunkIds(chunksInNaturalOrder, compilation); - }); - }); + walkNestedStatement(statement) { + this.prevStatement = undefined; + this.walkStatement(statement); } -} - -module.exports = NaturalChunkIdsPlugin; + // Real Statements + preWalkBlockStatement(statement) { + this.preWalkStatements(statement.body); + } -/***/ }), - -/***/ 83366: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Florent Cailhol @ooflorent -*/ + walkBlockStatement(statement) { + this.inBlockScope(() => { + const body = statement.body; + const prev = this.prevStatement; + this.blockPreWalkStatements(body); + this.prevStatement = prev; + this.walkStatements(body); + }); + } + walkExpressionStatement(statement) { + this.walkExpression(statement.expression); + } + preWalkIfStatement(statement) { + this.preWalkStatement(statement.consequent); + if (statement.alternate) { + this.preWalkStatement(statement.alternate); + } + } -const { - compareModulesByPreOrderIndexOrIdentifier -} = __webpack_require__(29579); -const { - assignAscendingModuleIds, - getUsedModuleIdsAndModules -} = __webpack_require__(63290); + walkIfStatement(statement) { + const result = this.hooks.statementIf.call(statement); + if (result === undefined) { + this.walkExpression(statement.test); + this.walkNestedStatement(statement.consequent); + if (statement.alternate) { + this.walkNestedStatement(statement.alternate); + } + } else { + if (result) { + this.walkNestedStatement(statement.consequent); + } else if (statement.alternate) { + this.walkNestedStatement(statement.alternate); + } + } + } -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ + preWalkLabeledStatement(statement) { + this.preWalkStatement(statement.body); + } -class NaturalModuleIdsPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap("NaturalModuleIdsPlugin", compilation => { - compilation.hooks.moduleIds.tap("NaturalModuleIdsPlugin", modules => { - const [usedIds, modulesInNaturalOrder] = - getUsedModuleIdsAndModules(compilation); - modulesInNaturalOrder.sort( - compareModulesByPreOrderIndexOrIdentifier(compilation.moduleGraph) - ); - assignAscendingModuleIds(usedIds, modulesInNaturalOrder, compilation); - }); - }); + walkLabeledStatement(statement) { + const hook = this.hooks.label.get(statement.label.name); + if (hook !== undefined) { + const result = hook.call(statement); + if (result === true) return; + } + this.walkNestedStatement(statement.body); } -} -module.exports = NaturalModuleIdsPlugin; + preWalkWithStatement(statement) { + this.preWalkStatement(statement.body); + } + walkWithStatement(statement) { + this.walkExpression(statement.object); + this.walkNestedStatement(statement.body); + } -/***/ }), + preWalkSwitchStatement(statement) { + this.preWalkSwitchCases(statement.cases); + } -/***/ 51020: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + walkSwitchStatement(statement) { + this.walkExpression(statement.discriminant); + this.walkSwitchCases(statement.cases); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + walkTerminatingStatement(statement) { + if (statement.argument) this.walkExpression(statement.argument); + } + walkReturnStatement(statement) { + this.walkTerminatingStatement(statement); + } + walkThrowStatement(statement) { + this.walkTerminatingStatement(statement); + } -const { compareChunksNatural } = __webpack_require__(29579); -const createSchemaValidation = __webpack_require__(32540); -const { assignAscendingChunkIds } = __webpack_require__(63290); + preWalkTryStatement(statement) { + this.preWalkStatement(statement.block); + if (statement.handler) this.preWalkCatchClause(statement.handler); + if (statement.finializer) this.preWalkStatement(statement.finializer); + } -/** @typedef {import("../../declarations/plugins/ids/OccurrenceChunkIdsPlugin").OccurrenceChunkIdsPluginOptions} OccurrenceChunkIdsPluginOptions */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ + walkTryStatement(statement) { + if (this.scope.inTry) { + this.walkStatement(statement.block); + } else { + this.scope.inTry = true; + this.walkStatement(statement.block); + this.scope.inTry = false; + } + if (statement.handler) this.walkCatchClause(statement.handler); + if (statement.finalizer) this.walkStatement(statement.finalizer); + } -const validate = createSchemaValidation( - __webpack_require__(24344), - () => __webpack_require__(53576), - { - name: "Occurrence Order Chunk Ids Plugin", - baseDataPath: "options" + preWalkWhileStatement(statement) { + this.preWalkStatement(statement.body); } -); -class OccurrenceChunkIdsPlugin { - /** - * @param {OccurrenceChunkIdsPluginOptions=} options options object - */ - constructor(options = {}) { - validate(options); - this.options = options; + walkWhileStatement(statement) { + this.walkExpression(statement.test); + this.walkNestedStatement(statement.body); } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const prioritiseInitial = this.options.prioritiseInitial; - compiler.hooks.compilation.tap("OccurrenceChunkIdsPlugin", compilation => { - compilation.hooks.chunkIds.tap("OccurrenceChunkIdsPlugin", chunks => { - const chunkGraph = compilation.chunkGraph; + preWalkDoWhileStatement(statement) { + this.preWalkStatement(statement.body); + } - /** @type {Map} */ - const occursInInitialChunksMap = new Map(); + walkDoWhileStatement(statement) { + this.walkNestedStatement(statement.body); + this.walkExpression(statement.test); + } - const compareNatural = compareChunksNatural(chunkGraph); + preWalkForStatement(statement) { + if (statement.init) { + if (statement.init.type === "VariableDeclaration") { + this.preWalkStatement(statement.init); + } + } + this.preWalkStatement(statement.body); + } - for (const c of chunks) { - let occurs = 0; - for (const chunkGroup of c.groupsIterable) { - for (const parent of chunkGroup.parentsIterable) { - if (parent.isInitial()) occurs++; - } - } - occursInInitialChunksMap.set(c, occurs); + walkForStatement(statement) { + this.inBlockScope(() => { + if (statement.init) { + if (statement.init.type === "VariableDeclaration") { + this.blockPreWalkVariableDeclaration(statement.init); + this.prevStatement = undefined; + this.walkStatement(statement.init); + } else { + this.walkExpression(statement.init); } - - const chunksInOccurrenceOrder = Array.from(chunks).sort((a, b) => { - if (prioritiseInitial) { - const aEntryOccurs = occursInInitialChunksMap.get(a); - const bEntryOccurs = occursInInitialChunksMap.get(b); - if (aEntryOccurs > bEntryOccurs) return -1; - if (aEntryOccurs < bEntryOccurs) return 1; - } - const aOccurs = a.getNumberOfGroups(); - const bOccurs = b.getNumberOfGroups(); - if (aOccurs > bOccurs) return -1; - if (aOccurs < bOccurs) return 1; - return compareNatural(a, b); - }); - assignAscendingChunkIds(chunksInOccurrenceOrder, compilation); - }); + } + if (statement.test) { + this.walkExpression(statement.test); + } + if (statement.update) { + this.walkExpression(statement.update); + } + const body = statement.body; + if (body.type === "BlockStatement") { + // no need to add additional scope + const prev = this.prevStatement; + this.blockPreWalkStatements(body.body); + this.prevStatement = prev; + this.walkStatements(body.body); + } else { + this.walkNestedStatement(body); + } }); } -} -module.exports = OccurrenceChunkIdsPlugin; + preWalkForInStatement(statement) { + if (statement.left.type === "VariableDeclaration") { + this.preWalkVariableDeclaration(statement.left); + } + this.preWalkStatement(statement.body); + } + walkForInStatement(statement) { + this.inBlockScope(() => { + if (statement.left.type === "VariableDeclaration") { + this.blockPreWalkVariableDeclaration(statement.left); + this.walkVariableDeclaration(statement.left); + } else { + this.walkPattern(statement.left); + } + this.walkExpression(statement.right); + const body = statement.body; + if (body.type === "BlockStatement") { + // no need to add additional scope + const prev = this.prevStatement; + this.blockPreWalkStatements(body.body); + this.prevStatement = prev; + this.walkStatements(body.body); + } else { + this.walkNestedStatement(body); + } + }); + } -/***/ }), + preWalkForOfStatement(statement) { + if (statement.await && this.scope.topLevelScope === true) { + this.hooks.topLevelAwait.call(statement); + } + if (statement.left.type === "VariableDeclaration") { + this.preWalkVariableDeclaration(statement.left); + } + this.preWalkStatement(statement.body); + } -/***/ 35371: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + walkForOfStatement(statement) { + this.inBlockScope(() => { + if (statement.left.type === "VariableDeclaration") { + this.blockPreWalkVariableDeclaration(statement.left); + this.walkVariableDeclaration(statement.left); + } else { + this.walkPattern(statement.left); + } + this.walkExpression(statement.right); + const body = statement.body; + if (body.type === "BlockStatement") { + // no need to add additional scope + const prev = this.prevStatement; + this.blockPreWalkStatements(body.body); + this.prevStatement = prev; + this.walkStatements(body.body); + } else { + this.walkNestedStatement(body); + } + }); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // Declarations + preWalkFunctionDeclaration(statement) { + if (statement.id) { + this.defineVariable(statement.id.name); + } + } + walkFunctionDeclaration(statement) { + const wasTopLevel = this.scope.topLevelScope; + this.scope.topLevelScope = false; + this.inFunctionScope(true, statement.params, () => { + for (const param of statement.params) { + this.walkPattern(param); + } + if (statement.body.type === "BlockStatement") { + this.detectMode(statement.body.body); + const prev = this.prevStatement; + this.preWalkStatement(statement.body); + this.prevStatement = prev; + this.walkStatement(statement.body); + } else { + this.walkExpression(statement.body); + } + }); + this.scope.topLevelScope = wasTopLevel; + } + blockPreWalkImportDeclaration(statement) { + const source = statement.source.value; + this.hooks.import.call(statement, source); + for (const specifier of statement.specifiers) { + const name = specifier.local.name; + switch (specifier.type) { + case "ImportDefaultSpecifier": + if ( + !this.hooks.importSpecifier.call(statement, source, "default", name) + ) { + this.defineVariable(name); + } + break; + case "ImportSpecifier": + if ( + !this.hooks.importSpecifier.call( + statement, + source, + specifier.imported.name, + name + ) + ) { + this.defineVariable(name); + } + break; + case "ImportNamespaceSpecifier": + if (!this.hooks.importSpecifier.call(statement, source, null, name)) { + this.defineVariable(name); + } + break; + default: + this.defineVariable(name); + } + } + } -const { - compareModulesByPreOrderIndexOrIdentifier -} = __webpack_require__(29579); -const createSchemaValidation = __webpack_require__(32540); -const { - assignAscendingModuleIds, - getUsedModuleIdsAndModules -} = __webpack_require__(63290); + enterDeclaration(declaration, onIdent) { + switch (declaration.type) { + case "VariableDeclaration": + for (const declarator of declaration.declarations) { + switch (declarator.type) { + case "VariableDeclarator": { + this.enterPattern(declarator.id, onIdent); + break; + } + } + } + break; + case "FunctionDeclaration": + this.enterPattern(declaration.id, onIdent); + break; + case "ClassDeclaration": + this.enterPattern(declaration.id, onIdent); + break; + } + } -/** @typedef {import("../../declarations/plugins/ids/OccurrenceModuleIdsPlugin").OccurrenceModuleIdsPluginOptions} OccurrenceModuleIdsPluginOptions */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ + blockPreWalkExportNamedDeclaration(statement) { + let source; + if (statement.source) { + source = statement.source.value; + this.hooks.exportImport.call(statement, source); + } else { + this.hooks.export.call(statement); + } + if (statement.declaration) { + if ( + !this.hooks.exportDeclaration.call(statement, statement.declaration) + ) { + const prev = this.prevStatement; + this.preWalkStatement(statement.declaration); + this.prevStatement = prev; + this.blockPreWalkStatement(statement.declaration); + let index = 0; + this.enterDeclaration(statement.declaration, def => { + this.hooks.exportSpecifier.call(statement, def, def, index++); + }); + } + } + if (statement.specifiers) { + for ( + let specifierIndex = 0; + specifierIndex < statement.specifiers.length; + specifierIndex++ + ) { + const specifier = statement.specifiers[specifierIndex]; + switch (specifier.type) { + case "ExportSpecifier": { + const name = specifier.exported.name; + if (source) { + this.hooks.exportImportSpecifier.call( + statement, + source, + specifier.local.name, + name, + specifierIndex + ); + } else { + this.hooks.exportSpecifier.call( + statement, + specifier.local.name, + name, + specifierIndex + ); + } + break; + } + } + } + } + } -const validate = createSchemaValidation( - __webpack_require__(14916), - () => __webpack_require__(19330), - { - name: "Occurrence Order Module Ids Plugin", - baseDataPath: "options" + walkExportNamedDeclaration(statement) { + if (statement.declaration) { + this.walkStatement(statement.declaration); + } } -); -class OccurrenceModuleIdsPlugin { - /** - * @param {OccurrenceModuleIdsPluginOptions=} options options object - */ - constructor(options = {}) { - validate(options); - this.options = options; + blockPreWalkExportDefaultDeclaration(statement) { + const prev = this.prevStatement; + this.preWalkStatement(statement.declaration); + this.prevStatement = prev; + this.blockPreWalkStatement(statement.declaration); + if ( + statement.declaration.id && + statement.declaration.type !== "FunctionExpression" && + statement.declaration.type !== "ClassExpression" + ) { + this.hooks.exportSpecifier.call( + statement, + statement.declaration.id.name, + "default", + undefined + ); + } } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const prioritiseInitial = this.options.prioritiseInitial; - compiler.hooks.compilation.tap("OccurrenceModuleIdsPlugin", compilation => { - const moduleGraph = compilation.moduleGraph; + walkExportDefaultDeclaration(statement) { + this.hooks.export.call(statement); + if ( + statement.declaration.id && + statement.declaration.type !== "FunctionExpression" && + statement.declaration.type !== "ClassExpression" + ) { + if ( + !this.hooks.exportDeclaration.call(statement, statement.declaration) + ) { + this.walkStatement(statement.declaration); + } + } else { + // Acorn parses `export default function() {}` as `FunctionDeclaration` and + // `export default class {}` as `ClassDeclaration`, both with `id = null`. + // These nodes must be treated as expressions. + if ( + statement.declaration.type === "FunctionDeclaration" || + statement.declaration.type === "ClassDeclaration" + ) { + this.walkStatement(statement.declaration); + } else { + this.walkExpression(statement.declaration); + } + if (!this.hooks.exportExpression.call(statement, statement.declaration)) { + this.hooks.exportSpecifier.call( + statement, + statement.declaration, + "default", + undefined + ); + } + } + } - compilation.hooks.moduleIds.tap("OccurrenceModuleIdsPlugin", () => { - const chunkGraph = compilation.chunkGraph; + blockPreWalkExportAllDeclaration(statement) { + const source = statement.source.value; + const name = statement.exported ? statement.exported.name : null; + this.hooks.exportImport.call(statement, source); + this.hooks.exportImportSpecifier.call(statement, source, null, name, 0); + } - const [usedIds, modulesInOccurrenceOrder] = - getUsedModuleIdsAndModules(compilation); + preWalkVariableDeclaration(statement) { + if (statement.kind !== "var") return; + this._preWalkVariableDeclaration(statement, this.hooks.varDeclarationVar); + } - const occursInInitialChunksMap = new Map(); - const occursInAllChunksMap = new Map(); + blockPreWalkVariableDeclaration(statement) { + if (statement.kind === "var") return; + const hookMap = + statement.kind === "const" + ? this.hooks.varDeclarationConst + : this.hooks.varDeclarationLet; + this._preWalkVariableDeclaration(statement, hookMap); + } - const initialChunkChunkMap = new Map(); - const entryCountMap = new Map(); - for (const m of modulesInOccurrenceOrder) { - let initial = 0; - let entry = 0; - for (const c of chunkGraph.getModuleChunksIterable(m)) { - if (c.canBeInitial()) initial++; - if (chunkGraph.isEntryModuleInChunk(m, c)) entry++; + _preWalkVariableDeclaration(statement, hookMap) { + for (const declarator of statement.declarations) { + switch (declarator.type) { + case "VariableDeclarator": { + if (!this.hooks.preDeclarator.call(declarator, statement)) { + this.enterPattern(declarator.id, (name, decl) => { + let hook = hookMap.get(name); + if (hook === undefined || !hook.call(decl)) { + hook = this.hooks.varDeclaration.get(name); + if (hook === undefined || !hook.call(decl)) { + this.defineVariable(name); + } + } + }); } - initialChunkChunkMap.set(m, initial); - entryCountMap.set(m, entry); + break; } + } + } + } - /** - * @param {Module} module module - * @returns {number} count of occurs - */ - const countOccursInEntry = module => { - let sum = 0; - for (const [ - originModule, - connections - ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { - if (!originModule) continue; - if (!connections.some(c => c.isTargetActive(undefined))) continue; - sum += initialChunkChunkMap.get(originModule); - } - return sum; - }; - - /** - * @param {Module} module module - * @returns {number} count of occurs - */ - const countOccurs = module => { - let sum = 0; - for (const [ - originModule, - connections - ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { - if (!originModule) continue; - const chunkModules = - chunkGraph.getNumberOfModuleChunks(originModule); - for (const c of connections) { - if (!c.isTargetActive(undefined)) continue; - if (!c.dependency) continue; - const factor = c.dependency.getNumberOfIdOccurrences(); - if (factor === 0) continue; - sum += factor * chunkModules; + walkVariableDeclaration(statement) { + for (const declarator of statement.declarations) { + switch (declarator.type) { + case "VariableDeclarator": { + const renameIdentifier = + declarator.init && this.getRenameIdentifier(declarator.init); + if (renameIdentifier && declarator.id.type === "Identifier") { + const hook = this.hooks.canRename.get(renameIdentifier); + if (hook !== undefined && hook.call(declarator.init)) { + // renaming with "var a = b;" + const hook = this.hooks.rename.get(renameIdentifier); + if (hook === undefined || !hook.call(declarator.init)) { + this.setVariable(declarator.id.name, renameIdentifier); + } + break; } } - return sum; - }; - - if (prioritiseInitial) { - for (const m of modulesInOccurrenceOrder) { - const result = - countOccursInEntry(m) + - initialChunkChunkMap.get(m) + - entryCountMap.get(m); - occursInInitialChunksMap.set(m, result); + if (!this.hooks.declarator.call(declarator, statement)) { + this.walkPattern(declarator.id); + if (declarator.init) this.walkExpression(declarator.init); } + break; } + } + } + } - for (const m of modulesInOccurrenceOrder) { - const result = - countOccurs(m) + - chunkGraph.getNumberOfModuleChunks(m) + - entryCountMap.get(m); - occursInAllChunksMap.set(m, result); - } - - const naturalCompare = compareModulesByPreOrderIndexOrIdentifier( - compilation.moduleGraph - ); + blockPreWalkClassDeclaration(statement) { + if (statement.id) { + this.defineVariable(statement.id.name); + } + } - modulesInOccurrenceOrder.sort((a, b) => { - if (prioritiseInitial) { - const aEntryOccurs = occursInInitialChunksMap.get(a); - const bEntryOccurs = occursInInitialChunksMap.get(b); - if (aEntryOccurs > bEntryOccurs) return -1; - if (aEntryOccurs < bEntryOccurs) return 1; - } - const aOccurs = occursInAllChunksMap.get(a); - const bOccurs = occursInAllChunksMap.get(b); - if (aOccurs > bOccurs) return -1; - if (aOccurs < bOccurs) return 1; - return naturalCompare(a, b); - }); + walkClassDeclaration(statement) { + this.walkClass(statement); + } - assignAscendingModuleIds( - usedIds, - modulesInOccurrenceOrder, - compilation - ); - }); - }); + preWalkSwitchCases(switchCases) { + for (let index = 0, len = switchCases.length; index < len; index++) { + const switchCase = switchCases[index]; + this.preWalkStatements(switchCase.consequent); + } } -} -module.exports = OccurrenceModuleIdsPlugin; + walkSwitchCases(switchCases) { + this.inBlockScope(() => { + const len = switchCases.length; + // we need to pre walk all statements first since we can have invalid code + // import A from "module"; + // switch(1) { + // case 1: + // console.log(A); // should fail at runtime + // case 2: + // const A = 1; + // } + for (let index = 0; index < len; index++) { + const switchCase = switchCases[index]; -/***/ }), + if (switchCase.consequent.length > 0) { + const prev = this.prevStatement; + this.blockPreWalkStatements(switchCase.consequent); + this.prevStatement = prev; + } + } -/***/ 8635: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + for (let index = 0; index < len; index++) { + const switchCase = switchCases[index]; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (switchCase.test) { + this.walkExpression(switchCase.test); + } + if (switchCase.consequent.length > 0) { + this.walkStatements(switchCase.consequent); + } + } + }); + } + preWalkCatchClause(catchClause) { + this.preWalkStatement(catchClause.body); + } + walkCatchClause(catchClause) { + this.inBlockScope(() => { + // Error binding is optional in catch clause since ECMAScript 2019 + if (catchClause.param !== null) { + this.enterPattern(catchClause.param, ident => { + this.defineVariable(ident); + }); + this.walkPattern(catchClause.param); + } + const prev = this.prevStatement; + this.blockPreWalkStatement(catchClause.body); + this.prevStatement = prev; + this.walkStatement(catchClause.body); + }); + } -const { WebpackError } = __webpack_require__(91919); -const { getUsedModuleIdsAndModules } = __webpack_require__(63290); + walkPattern(pattern) { + switch (pattern.type) { + case "ArrayPattern": + this.walkArrayPattern(pattern); + break; + case "AssignmentPattern": + this.walkAssignmentPattern(pattern); + break; + case "MemberExpression": + this.walkMemberExpression(pattern); + break; + case "ObjectPattern": + this.walkObjectPattern(pattern); + break; + case "RestElement": + this.walkRestElement(pattern); + break; + } + } -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ + walkAssignmentPattern(pattern) { + this.walkExpression(pattern.right); + this.walkPattern(pattern.left); + } -const plugin = "SyncModuleIdsPlugin"; + walkObjectPattern(pattern) { + for (let i = 0, len = pattern.properties.length; i < len; i++) { + const prop = pattern.properties[i]; + if (prop) { + if (prop.computed) this.walkExpression(prop.key); + if (prop.value) this.walkPattern(prop.value); + } + } + } -class SyncModuleIdsPlugin { - /** - * @param {Object} options options - * @param {string} options.path path to file - * @param {string=} options.context context for module names - * @param {function(Module): boolean} options.test selector for modules - * @param {"read" | "create" | "merge" | "update"=} options.mode operation mode (defaults to merge) - */ - constructor({ path, context, test, mode }) { - this._path = path; - this._context = context; - this._test = test || (() => true); - const readAndWrite = !mode || mode === "merge" || mode === "update"; - this._read = readAndWrite || mode === "read"; - this._write = readAndWrite || mode === "create"; - this._prune = mode === "update"; + walkArrayPattern(pattern) { + for (let i = 0, len = pattern.elements.length; i < len; i++) { + const element = pattern.elements[i]; + if (element) this.walkPattern(element); + } } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - /** @type {Map} */ - let data; - let dataChanged = false; - if (this._read) { - compiler.hooks.readRecords.tapAsync(plugin, callback => { - const fs = compiler.intermediateFileSystem; - fs.readFile(this._path, (err, buffer) => { - if (err) { - if (err.code !== "ENOENT") { - return callback(err); - } - return callback(); - } - const json = JSON.parse(buffer.toString()); - data = new Map(); - for (const key of Object.keys(json)) { - data.set(key, json[key]); - } - dataChanged = false; - return callback(); - }); - }); + walkRestElement(pattern) { + this.walkPattern(pattern.argument); + } + + walkExpressions(expressions) { + for (const expression of expressions) { + if (expression) { + this.walkExpression(expression); + } } - if (this._write) { - compiler.hooks.emitRecords.tapAsync(plugin, callback => { - if (!data || !dataChanged) return callback(); - const json = {}; - const sorted = Array.from(data).sort(([a], [b]) => (a < b ? -1 : 1)); - for (const [key, value] of sorted) { - json[key] = value; - } - const fs = compiler.intermediateFileSystem; - fs.writeFile(this._path, JSON.stringify(json), callback); - }); + } + + walkExpression(expression) { + switch (expression.type) { + case "ArrayExpression": + this.walkArrayExpression(expression); + break; + case "ArrowFunctionExpression": + this.walkArrowFunctionExpression(expression); + break; + case "AssignmentExpression": + this.walkAssignmentExpression(expression); + break; + case "AwaitExpression": + this.walkAwaitExpression(expression); + break; + case "BinaryExpression": + this.walkBinaryExpression(expression); + break; + case "CallExpression": + this.walkCallExpression(expression); + break; + case "ChainExpression": + this.walkChainExpression(expression); + break; + case "ClassExpression": + this.walkClassExpression(expression); + break; + case "ConditionalExpression": + this.walkConditionalExpression(expression); + break; + case "FunctionExpression": + this.walkFunctionExpression(expression); + break; + case "Identifier": + this.walkIdentifier(expression); + break; + case "ImportExpression": + this.walkImportExpression(expression); + break; + case "LogicalExpression": + this.walkLogicalExpression(expression); + break; + case "MetaProperty": + this.walkMetaProperty(expression); + break; + case "MemberExpression": + this.walkMemberExpression(expression); + break; + case "NewExpression": + this.walkNewExpression(expression); + break; + case "ObjectExpression": + this.walkObjectExpression(expression); + break; + case "SequenceExpression": + this.walkSequenceExpression(expression); + break; + case "SpreadElement": + this.walkSpreadElement(expression); + break; + case "TaggedTemplateExpression": + this.walkTaggedTemplateExpression(expression); + break; + case "TemplateLiteral": + this.walkTemplateLiteral(expression); + break; + case "ThisExpression": + this.walkThisExpression(expression); + break; + case "UnaryExpression": + this.walkUnaryExpression(expression); + break; + case "UpdateExpression": + this.walkUpdateExpression(expression); + break; + case "YieldExpression": + this.walkYieldExpression(expression); + break; } - compiler.hooks.thisCompilation.tap(plugin, compilation => { - const associatedObjectForCache = compiler.root; - const context = this._context || compiler.context; - if (this._read) { - compilation.hooks.reviveModules.tap(plugin, (_1, _2) => { - if (!data) return; - const { chunkGraph } = compilation; - const [usedIds, modules] = getUsedModuleIdsAndModules( - compilation, - this._test - ); - for (const module of modules) { - const name = module.libIdent({ - context, - associatedObjectForCache - }); - if (!name) continue; - const id = data.get(name); - const idAsString = `${id}`; - if (usedIds.has(idAsString)) { - const err = new WebpackError( - `SyncModuleIdsPlugin: Unable to restore id '${id}' from '${this._path}' as it's already used.` - ); - err.module = module; - compilation.errors.push(err); - } - chunkGraph.setModuleId(module, id); - usedIds.add(idAsString); - } - }); - } - if (this._write) { - compilation.hooks.recordModules.tap(plugin, modules => { - const { chunkGraph } = compilation; - let oldData = data; - if (!oldData) { - oldData = data = new Map(); - } else if (this._prune) { - data = new Map(); - } - for (const module of modules) { - if (this._test(module)) { - const name = module.libIdent({ - context, - associatedObjectForCache - }); - if (!name) continue; - const id = chunkGraph.getModuleId(module); - if (id === null) continue; - const oldId = oldData.get(name); - if (oldId !== id) { - dataChanged = true; - } else if (data === oldData) { - continue; - } - data.set(name, id); - } - } - if (data.size !== oldData.size) dataChanged = true; - }); - } - }); } -} -module.exports = SyncModuleIdsPlugin; + walkAwaitExpression(expression) { + if (this.scope.topLevelScope === true) + this.hooks.topLevelAwait.call(expression); + this.walkExpression(expression.argument); + } + walkArrayExpression(expression) { + if (expression.elements) { + this.walkExpressions(expression.elements); + } + } -/***/ }), + walkSpreadElement(expression) { + if (expression.argument) { + this.walkExpression(expression.argument); + } + } -/***/ 91919: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + walkObjectExpression(expression) { + for ( + let propIndex = 0, len = expression.properties.length; + propIndex < len; + propIndex++ + ) { + const prop = expression.properties[propIndex]; + this.walkProperty(prop); + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + walkProperty(prop) { + if (prop.type === "SpreadElement") { + this.walkExpression(prop.argument); + return; + } + if (prop.computed) { + this.walkExpression(prop.key); + } + if (prop.shorthand && prop.value && prop.value.type === "Identifier") { + this.scope.inShorthand = prop.value.name; + this.walkIdentifier(prop.value); + this.scope.inShorthand = false; + } else { + this.walkExpression(prop.value); + } + } + walkFunctionExpression(expression) { + const wasTopLevel = this.scope.topLevelScope; + this.scope.topLevelScope = false; + const scopeParams = expression.params; + // Add function name in scope for recursive calls + if (expression.id) { + scopeParams.push(expression.id.name); + } -const util = __webpack_require__(73837); -const memoize = __webpack_require__(78676); + this.inFunctionScope(true, scopeParams, () => { + for (const param of expression.params) { + this.walkPattern(param); + } + if (expression.body.type === "BlockStatement") { + this.detectMode(expression.body.body); + const prev = this.prevStatement; + this.preWalkStatement(expression.body); + this.prevStatement = prev; + this.walkStatement(expression.body); + } else { + this.walkExpression(expression.body); + } + }); + this.scope.topLevelScope = wasTopLevel; + } -/** @typedef {import("../declarations/WebpackOptions").Entry} Entry */ -/** @typedef {import("../declarations/WebpackOptions").EntryNormalized} EntryNormalized */ -/** @typedef {import("../declarations/WebpackOptions").EntryObject} EntryObject */ -/** @typedef {import("../declarations/WebpackOptions").FileCacheOptions} FileCacheOptions */ -/** @typedef {import("../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../declarations/WebpackOptions").ModuleOptions} ModuleOptions */ -/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ -/** @typedef {import("../declarations/WebpackOptions").RuleSetCondition} RuleSetCondition */ -/** @typedef {import("../declarations/WebpackOptions").RuleSetConditionAbsolute} RuleSetConditionAbsolute */ -/** @typedef {import("../declarations/WebpackOptions").RuleSetRule} RuleSetRule */ -/** @typedef {import("../declarations/WebpackOptions").RuleSetUse} RuleSetUse */ -/** @typedef {import("../declarations/WebpackOptions").RuleSetUseItem} RuleSetUseItem */ -/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} Configuration */ -/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptionsNormalized */ -/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */ -/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */ -/** @typedef {import("./Compilation").Asset} Asset */ -/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("./Compilation").EntryOptions} EntryOptions */ -/** @typedef {import("./Compiler").AssetEmittedInfo} AssetEmittedInfo */ -/** @typedef {import("./MultiStats")} MultiStats */ -/** @typedef {import("./Parser").ParserState} ParserState */ -/** @typedef {import("./ResolverFactory").ResolvePluginInstance} ResolvePluginInstance */ -/** @typedef {import("./ResolverFactory").Resolver} Resolver */ -/** @typedef {import("./Watching")} Watching */ -/** @typedef {import("./cli").Argument} Argument */ -/** @typedef {import("./cli").Problem} Problem */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunk} StatsChunk */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunkGroup} StatsChunkGroup */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunkOrigin} StatsChunkOrigin */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsError} StatsError */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsLogging} StatsLogging */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsLoggingEntry} StatsLoggingEntry */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModule} StatsModule */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleIssuer} StatsModuleIssuer */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleReason} StatsModuleReason */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleTraceDependency} StatsModuleTraceDependency */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleTraceItem} StatsModuleTraceItem */ -/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsProfile} StatsProfile */ + walkArrowFunctionExpression(expression) { + const wasTopLevel = this.scope.topLevelScope; + this.scope.topLevelScope = wasTopLevel ? "arrow" : false; + this.inFunctionScope(false, expression.params, () => { + for (const param of expression.params) { + this.walkPattern(param); + } + if (expression.body.type === "BlockStatement") { + this.detectMode(expression.body.body); + const prev = this.prevStatement; + this.preWalkStatement(expression.body); + this.prevStatement = prev; + this.walkStatement(expression.body); + } else { + this.walkExpression(expression.body); + } + }); + this.scope.topLevelScope = wasTopLevel; + } -/** - * @template {Function} T - * @param {function(): T} factory factory function - * @returns {T} function - */ -const lazyFunction = factory => { - const fac = memoize(factory); - const f = /** @type {any} */ ( - (...args) => { - return fac()(...args); + /** + * @param {SequenceExpressionNode} expression the sequence + */ + walkSequenceExpression(expression) { + if (!expression.expressions) return; + // We treat sequence expressions like statements when they are one statement level + // This has some benefits for optimizations that only work on statement level + const currentStatement = this.statementPath[this.statementPath.length - 1]; + if ( + currentStatement === expression || + (currentStatement.type === "ExpressionStatement" && + currentStatement.expression === expression) + ) { + const old = this.statementPath.pop(); + for (const expr of expression.expressions) { + this.statementPath.push(expr); + this.walkExpression(expr); + this.statementPath.pop(); + } + this.statementPath.push(old); + } else { + this.walkExpressions(expression.expressions); } - ); - return /** @type {T} */ (f); -}; + } -/** - * @template A - * @template B - * @param {A} obj input a - * @param {B} exports input b - * @returns {A & B} merged - */ -const mergeExports = (obj, exports) => { - const descriptors = Object.getOwnPropertyDescriptors(exports); - for (const name of Object.keys(descriptors)) { - const descriptor = descriptors[name]; - if (descriptor.get) { - const fn = descriptor.get; - Object.defineProperty(obj, name, { - configurable: false, - enumerable: true, - get: memoize(fn) + walkUpdateExpression(expression) { + this.walkExpression(expression.argument); + } + + walkUnaryExpression(expression) { + if (expression.operator === "typeof") { + const result = this.callHooksForExpression( + this.hooks.typeof, + expression.argument, + expression + ); + if (result === true) return; + if (expression.argument.type === "ChainExpression") { + const result = this.callHooksForExpression( + this.hooks.typeof, + expression.argument.expression, + expression + ); + if (result === true) return; + } + } + this.walkExpression(expression.argument); + } + + walkLeftRightExpression(expression) { + this.walkExpression(expression.left); + this.walkExpression(expression.right); + } + + walkBinaryExpression(expression) { + this.walkLeftRightExpression(expression); + } + + walkLogicalExpression(expression) { + const result = this.hooks.expressionLogicalOperator.call(expression); + if (result === undefined) { + this.walkLeftRightExpression(expression); + } else { + if (result) { + this.walkExpression(expression.right); + } + } + } + + walkAssignmentExpression(expression) { + if (expression.left.type === "Identifier") { + const renameIdentifier = this.getRenameIdentifier(expression.right); + if (renameIdentifier) { + if ( + this.callHooksForInfo( + this.hooks.canRename, + renameIdentifier, + expression.right + ) + ) { + // renaming "a = b;" + if ( + !this.callHooksForInfo( + this.hooks.rename, + renameIdentifier, + expression.right + ) + ) { + this.setVariable( + expression.left.name, + this.getVariableInfo(renameIdentifier) + ); + } + return; + } + } + this.walkExpression(expression.right); + this.enterPattern(expression.left, (name, decl) => { + if (!this.callHooksForName(this.hooks.assign, name, expression)) { + this.walkExpression(expression.left); + } }); - } else if (typeof descriptor.value === "object") { - Object.defineProperty(obj, name, { - configurable: false, - enumerable: true, - writable: false, - value: mergeExports({}, descriptor.value) + return; + } + if (expression.left.type.endsWith("Pattern")) { + this.walkExpression(expression.right); + this.enterPattern(expression.left, (name, decl) => { + if (!this.callHooksForName(this.hooks.assign, name, expression)) { + this.defineVariable(name); + } }); - } else { - throw new Error( - "Exposed values must be either a getter or an nested object" + this.walkPattern(expression.left); + } else if (expression.left.type === "MemberExpression") { + const exprName = this.getMemberExpressionInfo( + expression.left, + ALLOWED_MEMBER_TYPES_EXPRESSION ); + if (exprName) { + if ( + this.callHooksForInfo( + this.hooks.assignMemberChain, + exprName.rootInfo, + expression, + exprName.getMembers() + ) + ) { + return; + } + } + this.walkExpression(expression.right); + this.walkExpression(expression.left); + } else { + this.walkExpression(expression.right); + this.walkExpression(expression.left); } } - return /** @type {A & B} */ (Object.freeze(obj)); -}; -const fn = lazyFunction(() => __webpack_require__(36243)); -module.exports = mergeExports(fn, { - get webpack() { - return __webpack_require__(36243); - }, - get validate() { - const webpackOptionsSchemaCheck = __webpack_require__(10382); - const getRealValidate = memoize(() => { - const validateSchema = __webpack_require__(12047); - const webpackOptionsSchema = __webpack_require__(73342); - return options => validateSchema(webpackOptionsSchema, options); - }); - return options => { - if (!webpackOptionsSchemaCheck(options)) getRealValidate()(options); - }; - }, - get validateSchema() { - const validateSchema = __webpack_require__(12047); - return validateSchema; - }, - get version() { - return /** @type {string} */ ((__webpack_require__(32702)/* .version */ .i8)); - }, - - get cli() { - return __webpack_require__(13462); - }, - get AutomaticPrefetchPlugin() { - return __webpack_require__(17714); - }, - get AsyncDependenciesBlock() { - return __webpack_require__(47736); - }, - get BannerPlugin() { - return __webpack_require__(21242); - }, - get Cache() { - return __webpack_require__(7592); - }, - get Chunk() { - return __webpack_require__(39385); - }, - get ChunkGraph() { - return __webpack_require__(64971); - }, - get CleanPlugin() { - return __webpack_require__(31085); - }, - get Compilation() { - return __webpack_require__(85720); - }, - get Compiler() { - return __webpack_require__(70845); - }, - get ConcatenationScope() { - return __webpack_require__(98229); - }, - get ContextExclusionPlugin() { - return __webpack_require__(21411); - }, - get ContextReplacementPlugin() { - return __webpack_require__(12206); - }, - get DefinePlugin() { - return __webpack_require__(79065); - }, - get DelegatedPlugin() { - return __webpack_require__(80632); - }, - get Dependency() { - return __webpack_require__(54912); - }, - get DllPlugin() { - return __webpack_require__(40038); - }, - get DllReferencePlugin() { - return __webpack_require__(90999); - }, - get DynamicEntryPlugin() { - return __webpack_require__(96475); - }, - get EntryOptionPlugin() { - return __webpack_require__(9909); - }, - get EntryPlugin() { - return __webpack_require__(96953); - }, - get EnvironmentPlugin() { - return __webpack_require__(22070); - }, - get EvalDevToolModulePlugin() { - return __webpack_require__(65218); - }, - get EvalSourceMapDevToolPlugin() { - return __webpack_require__(14790); - }, - get ExternalModule() { - return __webpack_require__(73071); - }, - get ExternalsPlugin() { - return __webpack_require__(6652); - }, - get Generator() { - return __webpack_require__(93401); - }, - get HotUpdateChunk() { - return __webpack_require__(9597); - }, - get HotModuleReplacementPlugin() { - return __webpack_require__(6404); - }, - get IgnorePlugin() { - return __webpack_require__(84808); - }, - get JavascriptModulesPlugin() { - return util.deprecate( - () => __webpack_require__(89464), - "webpack.JavascriptModulesPlugin has moved to webpack.javascript.JavascriptModulesPlugin", - "DEP_WEBPACK_JAVASCRIPT_MODULES_PLUGIN" - )(); - }, - get LibManifestPlugin() { - return __webpack_require__(93837); - }, - get LibraryTemplatePlugin() { - return util.deprecate( - () => __webpack_require__(14157), - "webpack.LibraryTemplatePlugin is deprecated and has been replaced by compilation.outputOptions.library or compilation.addEntry + passing a library option", - "DEP_WEBPACK_LIBRARY_TEMPLATE_PLUGIN" - )(); - }, - get LoaderOptionsPlugin() { - return __webpack_require__(22078); - }, - get LoaderTargetPlugin() { - return __webpack_require__(86738); - }, - get Module() { - return __webpack_require__(73208); - }, - get ModuleFilenameHelpers() { - return __webpack_require__(88821); - }, - get ModuleGraph() { - return __webpack_require__(99988); - }, - get ModuleGraphConnection() { - return __webpack_require__(40639); - }, - get NoEmitOnErrorsPlugin() { - return __webpack_require__(50169); - }, - get NormalModule() { - return __webpack_require__(39); - }, - get NormalModuleReplacementPlugin() { - return __webpack_require__(30633); - }, - get MultiCompiler() { - return __webpack_require__(33370); - }, - get Parser() { - return __webpack_require__(11715); - }, - get PrefetchPlugin() { - return __webpack_require__(73850); - }, - get ProgressPlugin() { - return __webpack_require__(13216); - }, - get ProvidePlugin() { - return __webpack_require__(38309); - }, - get RuntimeGlobals() { - return __webpack_require__(16475); - }, - get RuntimeModule() { - return __webpack_require__(16963); - }, - get SingleEntryPlugin() { - return util.deprecate( - () => __webpack_require__(96953), - "SingleEntryPlugin was renamed to EntryPlugin", - "DEP_WEBPACK_SINGLE_ENTRY_PLUGIN" - )(); - }, - get SourceMapDevToolPlugin() { - return __webpack_require__(63872); - }, - get Stats() { - return __webpack_require__(31743); - }, - get Template() { - return __webpack_require__(39722); - }, - get UsageState() { - return (__webpack_require__(63686).UsageState); - }, - get WatchIgnorePlugin() { - return __webpack_require__(65193); - }, - get WebpackError() { - return __webpack_require__(53799); - }, - get WebpackOptionsApply() { - return __webpack_require__(88422); - }, - get WebpackOptionsDefaulter() { - return util.deprecate( - () => __webpack_require__(14452), - "webpack.WebpackOptionsDefaulter is deprecated and has been replaced by webpack.config.getNormalizedWebpackOptions and webpack.config.applyWebpackOptionsDefaults", - "DEP_WEBPACK_OPTIONS_DEFAULTER" - )(); - }, - // TODO webpack 6 deprecate - get WebpackOptionsValidationError() { - return (__webpack_require__(38476).ValidationError); - }, - get ValidationError() { - return (__webpack_require__(38476).ValidationError); - }, - - cache: { - get MemoryCachePlugin() { - return __webpack_require__(52539); - } - }, - - config: { - get getNormalizedWebpackOptions() { - return (__webpack_require__(26693).getNormalizedWebpackOptions); - }, - get applyWebpackOptionsDefaults() { - return (__webpack_require__(92988).applyWebpackOptionsDefaults); - } - }, - - dependencies: { - get ModuleDependency() { - return __webpack_require__(80321); - }, - get ConstDependency() { - return __webpack_require__(76911); - }, - get NullDependency() { - return __webpack_require__(31830); - } - }, - - ids: { - get ChunkModuleIdRangePlugin() { - return __webpack_require__(64618); - }, - get NaturalModuleIdsPlugin() { - return __webpack_require__(83366); - }, - get OccurrenceModuleIdsPlugin() { - return __webpack_require__(35371); - }, - get NamedModuleIdsPlugin() { - return __webpack_require__(24339); - }, - get DeterministicChunkIdsPlugin() { - return __webpack_require__(8747); - }, - get DeterministicModuleIdsPlugin() { - return __webpack_require__(76692); - }, - get NamedChunkIdsPlugin() { - return __webpack_require__(6454); - }, - get OccurrenceChunkIdsPlugin() { - return __webpack_require__(51020); - }, - get HashedModuleIdsPlugin() { - return __webpack_require__(21825); + walkConditionalExpression(expression) { + const result = this.hooks.expressionConditionalOperator.call(expression); + if (result === undefined) { + this.walkExpression(expression.test); + this.walkExpression(expression.consequent); + if (expression.alternate) { + this.walkExpression(expression.alternate); + } + } else { + if (result) { + this.walkExpression(expression.consequent); + } else if (expression.alternate) { + this.walkExpression(expression.alternate); + } } - }, + } - javascript: { - get EnableChunkLoadingPlugin() { - return __webpack_require__(61291); - }, - get JavascriptModulesPlugin() { - return __webpack_require__(89464); - }, - get JavascriptParser() { - return __webpack_require__(29050); + walkNewExpression(expression) { + const result = this.callHooksForExpression( + this.hooks.new, + expression.callee, + expression + ); + if (result === true) return; + this.walkExpression(expression.callee); + if (expression.arguments) { + this.walkExpressions(expression.arguments); } - }, + } - optimize: { - get AggressiveMergingPlugin() { - return __webpack_require__(64395); - }, - get AggressiveSplittingPlugin() { - return util.deprecate( - () => __webpack_require__(15543), - "AggressiveSplittingPlugin is deprecated in favor of SplitChunksPlugin", - "DEP_WEBPACK_AGGRESSIVE_SPLITTING_PLUGIN" - )(); - }, - get InnerGraph() { - return __webpack_require__(38988); - }, - get LimitChunkCountPlugin() { - return __webpack_require__(83608); - }, - get MinChunkSizePlugin() { - return __webpack_require__(53912); - }, - get ModuleConcatenationPlugin() { - return __webpack_require__(74844); - }, - get RealContentHashPlugin() { - return __webpack_require__(46043); - }, - get RuntimeChunkPlugin() { - return __webpack_require__(2837); - }, - get SideEffectsFlagPlugin() { - return __webpack_require__(84800); - }, - get SplitChunksPlugin() { - return __webpack_require__(21478); + walkYieldExpression(expression) { + if (expression.argument) { + this.walkExpression(expression.argument); } - }, + } - runtime: { - get GetChunkFilenameRuntimeModule() { - return __webpack_require__(34277); - }, - get LoadScriptRuntimeModule() { - return __webpack_require__(19942); + walkTemplateLiteral(expression) { + if (expression.expressions) { + this.walkExpressions(expression.expressions); } - }, + } - prefetch: { - get ChunkPrefetchPreloadPlugin() { - return __webpack_require__(33895); + walkTaggedTemplateExpression(expression) { + if (expression.tag) { + this.walkExpression(expression.tag); } - }, - - web: { - get FetchCompileAsyncWasmPlugin() { - return __webpack_require__(8437); - }, - get FetchCompileWasmPlugin() { - return __webpack_require__(35537); - }, - get JsonpChunkLoadingRuntimeModule() { - return __webpack_require__(84154); - }, - get JsonpTemplatePlugin() { - return __webpack_require__(4607); + if (expression.quasi && expression.quasi.expressions) { + this.walkExpressions(expression.quasi.expressions); } - }, + } - webworker: { - get WebWorkerTemplatePlugin() { - return __webpack_require__(68693); - } - }, + walkClassExpression(expression) { + this.walkClass(expression); + } - node: { - get NodeEnvironmentPlugin() { - return __webpack_require__(7553); - }, - get NodeSourcePlugin() { - return __webpack_require__(7103); - }, - get NodeTargetPlugin() { - return __webpack_require__(17916); - }, - get NodeTemplatePlugin() { - return __webpack_require__(61052); - }, - get ReadFileCompileWasmPlugin() { - return __webpack_require__(98939); - } - }, + /** + * @param {ChainExpressionNode} expression expression + */ + walkChainExpression(expression) { + const result = this.hooks.optionalChaining.call(expression); - electron: { - get ElectronTargetPlugin() { - return __webpack_require__(32277); + if (result === undefined) { + if (expression.expression.type === "CallExpression") { + this.walkCallExpression(expression.expression); + } else { + this.walkMemberExpression(expression.expression); + } } - }, + } - wasm: { - get AsyncWebAssemblyModulesPlugin() { - return __webpack_require__(7538); - } - }, + _walkIIFE(functionExpression, options, currentThis) { + const getVarInfo = argOrThis => { + const renameIdentifier = this.getRenameIdentifier(argOrThis); + if (renameIdentifier) { + if ( + this.callHooksForInfo( + this.hooks.canRename, + renameIdentifier, + argOrThis + ) + ) { + if ( + !this.callHooksForInfo( + this.hooks.rename, + renameIdentifier, + argOrThis + ) + ) { + return this.getVariableInfo(renameIdentifier); + } + } + } + this.walkExpression(argOrThis); + }; + const { params, type } = functionExpression; + const arrow = type === "ArrowFunctionExpression"; + const renameThis = currentThis ? getVarInfo(currentThis) : null; + const varInfoForArgs = options.map(getVarInfo); + const wasTopLevel = this.scope.topLevelScope; + this.scope.topLevelScope = wasTopLevel && arrow ? "arrow" : false; + const scopeParams = params.filter( + (identifier, idx) => !varInfoForArgs[idx] + ); - library: { - get AbstractLibraryPlugin() { - return __webpack_require__(26030); - }, - get EnableLibraryPlugin() { - return __webpack_require__(91452); + // Add function name in scope for recursive calls + if (functionExpression.id) { + scopeParams.push(functionExpression.id.name); } - }, - container: { - get ContainerPlugin() { - return __webpack_require__(9244); - }, - get ContainerReferencePlugin() { - return __webpack_require__(95757); - }, - get ModuleFederationPlugin() { - return __webpack_require__(30569); - }, - get scope() { - return (__webpack_require__(3083).scope); - } - }, + this.inFunctionScope(true, scopeParams, () => { + if (renameThis && !arrow) { + this.setVariable("this", renameThis); + } + for (let i = 0; i < varInfoForArgs.length; i++) { + const varInfo = varInfoForArgs[i]; + if (!varInfo) continue; + if (!params[i] || params[i].type !== "Identifier") continue; + this.setVariable(params[i].name, varInfo); + } + if (functionExpression.body.type === "BlockStatement") { + this.detectMode(functionExpression.body.body); + const prev = this.prevStatement; + this.preWalkStatement(functionExpression.body); + this.prevStatement = prev; + this.walkStatement(functionExpression.body); + } else { + this.walkExpression(functionExpression.body); + } + }); + this.scope.topLevelScope = wasTopLevel; + } - sharing: { - get ConsumeSharedPlugin() { - return __webpack_require__(15046); - }, - get ProvideSharedPlugin() { - return __webpack_require__(31225); - }, - get SharePlugin() { - return __webpack_require__(26335); - }, - get scope() { - return (__webpack_require__(3083).scope); - } - }, + walkImportExpression(expression) { + let result = this.hooks.importCall.call(expression); + if (result === true) return; - debug: { - get ProfilingPlugin() { - return __webpack_require__(2757); - } - }, + this.walkExpression(expression.source); + } - util: { - get createHash() { - return __webpack_require__(49835); - }, - get comparators() { - return __webpack_require__(29579); - }, - get runtime() { - return __webpack_require__(17156); - }, - get serialization() { - return __webpack_require__(8282); - }, - get cleverMerge() { - return (__webpack_require__(60839).cachedCleverMerge); - }, - get LazySet() { - return __webpack_require__(38938); - } - }, - - get sources() { - return __webpack_require__(51255); - }, - - experiments: { - schemes: { - get HttpUriPlugin() { - return __webpack_require__(42110); - } - }, - ids: { - get SyncModuleIdsPlugin() { - return __webpack_require__(8635); - } - } - } -}); - - -/***/ }), - -/***/ 18535: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { ConcatSource, PrefixSource, RawSource } = __webpack_require__(51255); -const { RuntimeGlobals } = __webpack_require__(91919); -const HotUpdateChunk = __webpack_require__(9597); -const Template = __webpack_require__(39722); -const { getCompilationHooks } = __webpack_require__(89464); -const { - generateEntryStartup, - updateHashForEntryStartup -} = __webpack_require__(98124); - -/** @typedef {import("../Compiler")} Compiler */ - -class ArrayPushCallbackChunkFormatPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - "ArrayPushCallbackChunkFormatPlugin", - compilation => { - compilation.hooks.additionalChunkRuntimeRequirements.tap( - "ArrayPushCallbackChunkFormatPlugin", - (chunk, set, { chunkGraph }) => { - if (chunk.hasRuntime()) return; - if (chunkGraph.getNumberOfEntryModules(chunk) > 0) { - set.add(RuntimeGlobals.onChunksLoaded); - set.add(RuntimeGlobals.require); - } - set.add(RuntimeGlobals.chunkCallback); - } + walkCallExpression(expression) { + const isSimpleFunction = fn => { + return fn.params.every(p => p.type === "Identifier"); + }; + if ( + expression.callee.type === "MemberExpression" && + expression.callee.object.type.endsWith("FunctionExpression") && + !expression.callee.computed && + (expression.callee.property.name === "call" || + expression.callee.property.name === "bind") && + expression.arguments.length > 0 && + isSimpleFunction(expression.callee.object) + ) { + // (function(…) { }.call/bind(?, …)) + this._walkIIFE( + expression.callee.object, + expression.arguments.slice(1), + expression.arguments[0] + ); + } else if ( + expression.callee.type.endsWith("FunctionExpression") && + isSimpleFunction(expression.callee) + ) { + // (function(…) { }(…)) + this._walkIIFE(expression.callee, expression.arguments, null); + } else { + if (expression.callee.type === "MemberExpression") { + const exprInfo = this.getMemberExpressionInfo( + expression.callee, + ALLOWED_MEMBER_TYPES_CALL_EXPRESSION ); - const hooks = getCompilationHooks(compilation); - hooks.renderChunk.tap( - "ArrayPushCallbackChunkFormatPlugin", - (modules, renderContext) => { - const { chunk, chunkGraph, runtimeTemplate } = renderContext; - const hotUpdateChunk = - chunk instanceof HotUpdateChunk ? chunk : null; - const globalObject = runtimeTemplate.globalObject; - const source = new ConcatSource(); - const runtimeModules = - chunkGraph.getChunkRuntimeModulesInOrder(chunk); - if (hotUpdateChunk) { - const hotUpdateGlobal = - runtimeTemplate.outputOptions.hotUpdateGlobal; - source.add( - `${globalObject}[${JSON.stringify(hotUpdateGlobal)}](` - ); - source.add(`${JSON.stringify(chunk.id)},`); - source.add(modules); - if (runtimeModules.length > 0) { - source.add(",\n"); - const runtimePart = Template.renderChunkRuntimeModules( - runtimeModules, - renderContext - ); - source.add(runtimePart); - } - source.add(")"); - } else { - const chunkLoadingGlobal = - runtimeTemplate.outputOptions.chunkLoadingGlobal; - source.add( - `(${globalObject}[${JSON.stringify( - chunkLoadingGlobal - )}] = ${globalObject}[${JSON.stringify( - chunkLoadingGlobal - )}] || []).push([` - ); - source.add(`${JSON.stringify(chunk.ids)},`); - source.add(modules); - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); - if (runtimeModules.length > 0 || entries.length > 0) { - const runtime = new ConcatSource( - (runtimeTemplate.supportsArrowFunction() - ? "__webpack_require__ =>" - : "function(__webpack_require__)") + - " { // webpackRuntimeModules\n" - ); - if (runtimeModules.length > 0) { - runtime.add( - Template.renderRuntimeModules(runtimeModules, { - ...renderContext, - codeGenerationResults: compilation.codeGenerationResults - }) - ); - } - if (entries.length > 0) { - const startupSource = new RawSource( - generateEntryStartup( - chunkGraph, - runtimeTemplate, - entries, - chunk, - true - ) - ); - runtime.add( - hooks.renderStartup.call( - startupSource, - entries[entries.length - 1][0], - { - ...renderContext, - inlined: false - } - ) - ); - if ( - chunkGraph - .getChunkRuntimeRequirements(chunk) - .has(RuntimeGlobals.returnExportsFromRuntime) - ) { - runtime.add("return __webpack_exports__;\n"); - } - } - runtime.add("}\n"); - source.add(",\n"); - source.add(new PrefixSource("/******/ ", runtime)); - } - source.add("])"); - } - return source; - } + if (exprInfo && exprInfo.type === "call") { + const result = this.callHooksForInfo( + this.hooks.callMemberChainOfCallMemberChain, + exprInfo.rootInfo, + expression, + exprInfo.getCalleeMembers(), + exprInfo.call, + exprInfo.getMembers() + ); + if (result === true) return; + } + } + const callee = this.evaluateExpression(expression.callee); + if (callee.isIdentifier()) { + const result1 = this.callHooksForInfo( + this.hooks.callMemberChain, + callee.rootInfo, + expression, + callee.getMembers() ); - hooks.chunkHash.tap( - "ArrayPushCallbackChunkFormatPlugin", - (chunk, hash, { chunkGraph, runtimeTemplate }) => { - if (chunk.hasRuntime()) return; - hash.update( - `ArrayPushCallbackChunkFormatPlugin1${runtimeTemplate.outputOptions.chunkLoadingGlobal}${runtimeTemplate.outputOptions.hotUpdateGlobal}${runtimeTemplate.globalObject}` - ); - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); - updateHashForEntryStartup(hash, chunkGraph, entries, chunk); - } + if (result1 === true) return; + const result2 = this.callHooksForInfo( + this.hooks.call, + callee.identifier, + expression ); + if (result2 === true) return; } - ); - } -} - -module.exports = ArrayPushCallbackChunkFormatPlugin; - - -/***/ }), - -/***/ 950: -/***/ (function(module) { -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** @typedef {import("estree").Node} EsTreeNode */ -/** @typedef {import("./JavascriptParser").VariableInfoInterface} VariableInfoInterface */ - -const TypeUnknown = 0; -const TypeUndefined = 1; -const TypeNull = 2; -const TypeString = 3; -const TypeNumber = 4; -const TypeBoolean = 5; -const TypeRegExp = 6; -const TypeConditional = 7; -const TypeArray = 8; -const TypeConstArray = 9; -const TypeIdentifier = 10; -const TypeWrapped = 11; -const TypeTemplateString = 12; -const TypeBigInt = 13; - -class BasicEvaluatedExpression { - constructor() { - this.type = TypeUnknown; - /** @type {[number, number]} */ - this.range = undefined; - /** @type {boolean} */ - this.falsy = false; - /** @type {boolean} */ - this.truthy = false; - /** @type {boolean | undefined} */ - this.nullish = undefined; - /** @type {boolean} */ - this.sideEffects = true; - /** @type {boolean | undefined} */ - this.bool = undefined; - /** @type {number | undefined} */ - this.number = undefined; - /** @type {bigint | undefined} */ - this.bigint = undefined; - /** @type {RegExp | undefined} */ - this.regExp = undefined; - /** @type {string | undefined} */ - this.string = undefined; - /** @type {BasicEvaluatedExpression[] | undefined} */ - this.quasis = undefined; - /** @type {BasicEvaluatedExpression[] | undefined} */ - this.parts = undefined; - /** @type {any[] | undefined} */ - this.array = undefined; - /** @type {BasicEvaluatedExpression[] | undefined} */ - this.items = undefined; - /** @type {BasicEvaluatedExpression[] | undefined} */ - this.options = undefined; - /** @type {BasicEvaluatedExpression | undefined} */ - this.prefix = undefined; - /** @type {BasicEvaluatedExpression | undefined} */ - this.postfix = undefined; - this.wrappedInnerExpressions = undefined; - /** @type {string | undefined} */ - this.identifier = undefined; - /** @type {VariableInfoInterface} */ - this.rootInfo = undefined; - /** @type {() => string[]} */ - this.getMembers = undefined; - /** @type {EsTreeNode} */ - this.expression = undefined; - } - - isUnknown() { - return this.type === TypeUnknown; + if (expression.callee) { + if (expression.callee.type === "MemberExpression") { + // because of call context we need to walk the call context as expression + this.walkExpression(expression.callee.object); + if (expression.callee.computed === true) + this.walkExpression(expression.callee.property); + } else { + this.walkExpression(expression.callee); + } + } + if (expression.arguments) this.walkExpressions(expression.arguments); + } } - isNull() { - return this.type === TypeNull; + walkMemberExpression(expression) { + const exprInfo = this.getMemberExpressionInfo( + expression, + ALLOWED_MEMBER_TYPES_ALL + ); + if (exprInfo) { + switch (exprInfo.type) { + case "expression": { + const result1 = this.callHooksForInfo( + this.hooks.expression, + exprInfo.name, + expression + ); + if (result1 === true) return; + const members = exprInfo.getMembers(); + const result2 = this.callHooksForInfo( + this.hooks.expressionMemberChain, + exprInfo.rootInfo, + expression, + members + ); + if (result2 === true) return; + this.walkMemberExpressionWithExpressionName( + expression, + exprInfo.name, + exprInfo.rootInfo, + members.slice(), + () => + this.callHooksForInfo( + this.hooks.unhandledExpressionMemberChain, + exprInfo.rootInfo, + expression, + members + ) + ); + return; + } + case "call": { + const result = this.callHooksForInfo( + this.hooks.memberChainOfCallMemberChain, + exprInfo.rootInfo, + expression, + exprInfo.getCalleeMembers(), + exprInfo.call, + exprInfo.getMembers() + ); + if (result === true) return; + // Fast skip over the member chain as we already called memberChainOfCallMemberChain + // and call computed property are literals anyway + this.walkExpression(exprInfo.call); + return; + } + } + } + this.walkExpression(expression.object); + if (expression.computed === true) this.walkExpression(expression.property); } - isUndefined() { - return this.type === TypeUndefined; + walkMemberExpressionWithExpressionName( + expression, + name, + rootInfo, + members, + onUnhandled + ) { + if (expression.object.type === "MemberExpression") { + // optimize the case where expression.object is a MemberExpression too. + // we can keep info here when calling walkMemberExpression directly + const property = + expression.property.name || `${expression.property.value}`; + name = name.slice(0, -property.length - 1); + members.pop(); + const result = this.callHooksForInfo( + this.hooks.expression, + name, + expression.object + ); + if (result === true) return; + this.walkMemberExpressionWithExpressionName( + expression.object, + name, + rootInfo, + members, + onUnhandled + ); + } else if (!onUnhandled || !onUnhandled()) { + this.walkExpression(expression.object); + } + if (expression.computed === true) this.walkExpression(expression.property); } - isString() { - return this.type === TypeString; + walkThisExpression(expression) { + this.callHooksForName(this.hooks.expression, "this", expression); } - isNumber() { - return this.type === TypeNumber; + walkIdentifier(expression) { + this.callHooksForName(this.hooks.expression, expression.name, expression); } - isBigInt() { - return this.type === TypeBigInt; + /** + * @param {MetaPropertyNode} metaProperty meta property + */ + walkMetaProperty(metaProperty) { + this.hooks.expression.for(getRootName(metaProperty)).call(metaProperty); } - isBoolean() { - return this.type === TypeBoolean; + callHooksForExpression(hookMap, expr, ...args) { + return this.callHooksForExpressionWithFallback( + hookMap, + expr, + undefined, + undefined, + ...args + ); } - isRegExp() { - return this.type === TypeRegExp; + /** + * @template T + * @template R + * @param {HookMap>} hookMap hooks the should be called + * @param {MemberExpressionNode} expr expression info + * @param {function(string, string | ScopeInfo | VariableInfo, function(): string[]): any} fallback callback when variable in not handled by hooks + * @param {function(string): any} defined callback when variable is defined + * @param {AsArray} args args for the hook + * @returns {R} result of hook + */ + callHooksForExpressionWithFallback( + hookMap, + expr, + fallback, + defined, + ...args + ) { + const exprName = this.getMemberExpressionInfo( + expr, + ALLOWED_MEMBER_TYPES_EXPRESSION + ); + if (exprName !== undefined) { + const members = exprName.getMembers(); + return this.callHooksForInfoWithFallback( + hookMap, + members.length === 0 ? exprName.rootInfo : exprName.name, + fallback && + (name => fallback(name, exprName.rootInfo, exprName.getMembers)), + defined && (() => defined(exprName.name)), + ...args + ); + } } - isConditional() { - return this.type === TypeConditional; - } - - isArray() { - return this.type === TypeArray; - } - - isConstArray() { - return this.type === TypeConstArray; - } - - isIdentifier() { - return this.type === TypeIdentifier; - } - - isWrapped() { - return this.type === TypeWrapped; - } - - isTemplateString() { - return this.type === TypeTemplateString; + /** + * @template T + * @template R + * @param {HookMap>} hookMap hooks the should be called + * @param {string} name key in map + * @param {AsArray} args args for the hook + * @returns {R} result of hook + */ + callHooksForName(hookMap, name, ...args) { + return this.callHooksForNameWithFallback( + hookMap, + name, + undefined, + undefined, + ...args + ); } /** - * Is expression a primitive or an object type value? - * @returns {boolean | undefined} true: primitive type, false: object type, undefined: unknown/runtime-defined + * @template T + * @template R + * @param {HookMap>} hookMap hooks that should be called + * @param {ExportedVariableInfo} info variable info + * @param {AsArray} args args for the hook + * @returns {R} result of hook */ - isPrimitiveType() { - switch (this.type) { - case TypeUndefined: - case TypeNull: - case TypeString: - case TypeNumber: - case TypeBoolean: - case TypeBigInt: - case TypeWrapped: - case TypeTemplateString: - return true; - case TypeRegExp: - case TypeArray: - case TypeConstArray: - return false; - default: - return undefined; - } + callHooksForInfo(hookMap, info, ...args) { + return this.callHooksForInfoWithFallback( + hookMap, + info, + undefined, + undefined, + ...args + ); } /** - * Is expression a runtime or compile-time value? - * @returns {boolean} true: compile time value, false: runtime value + * @template T + * @template R + * @param {HookMap>} hookMap hooks the should be called + * @param {ExportedVariableInfo} info variable info + * @param {function(string): any} fallback callback when variable in not handled by hooks + * @param {function(): any} defined callback when variable is defined + * @param {AsArray} args args for the hook + * @returns {R} result of hook */ - isCompileTimeValue() { - switch (this.type) { - case TypeUndefined: - case TypeNull: - case TypeString: - case TypeNumber: - case TypeBoolean: - case TypeRegExp: - case TypeConstArray: - case TypeBigInt: - return true; - default: - return false; + callHooksForInfoWithFallback(hookMap, info, fallback, defined, ...args) { + let name; + if (typeof info === "string") { + name = info; + } else { + if (!(info instanceof VariableInfo)) { + if (defined !== undefined) { + return defined(); + } + return; + } + let tagInfo = info.tagInfo; + while (tagInfo !== undefined) { + const hook = hookMap.get(tagInfo.tag); + if (hook !== undefined) { + this.currentTagData = tagInfo.data; + const result = hook.call(...args); + this.currentTagData = undefined; + if (result !== undefined) return result; + } + tagInfo = tagInfo.next; + } + if (info.freeName === true) { + if (defined !== undefined) { + return defined(); + } + return; + } + name = info.freeName; + } + const hook = hookMap.get(name); + if (hook !== undefined) { + const result = hook.call(...args); + if (result !== undefined) return result; + } + if (fallback !== undefined) { + return fallback(name); } } /** - * Gets the compile-time value of the expression - * @returns {any} the javascript value + * @template T + * @template R + * @param {HookMap>} hookMap hooks the should be called + * @param {string} name key in map + * @param {function(string): any} fallback callback when variable in not handled by hooks + * @param {function(): any} defined callback when variable is defined + * @param {AsArray} args args for the hook + * @returns {R} result of hook */ - asCompileTimeValue() { - switch (this.type) { - case TypeUndefined: - return undefined; - case TypeNull: - return null; - case TypeString: - return this.string; - case TypeNumber: - return this.number; - case TypeBoolean: - return this.bool; - case TypeRegExp: - return this.regExp; - case TypeConstArray: - return this.array; - case TypeBigInt: - return this.bigint; - default: - throw new Error( - "asCompileTimeValue must only be called for compile-time values" - ); - } - } - - isTruthy() { - return this.truthy; - } - - isFalsy() { - return this.falsy; - } - - isNullish() { - return this.nullish; + callHooksForNameWithFallback(hookMap, name, fallback, defined, ...args) { + return this.callHooksForInfoWithFallback( + hookMap, + this.getVariableInfo(name), + fallback, + defined, + ...args + ); } /** - * Can this expression have side effects? - * @returns {boolean} false: never has side effects + * @deprecated + * @param {any} params scope params + * @param {function(): void} fn inner function + * @returns {void} */ - couldHaveSideEffects() { - return this.sideEffects; - } - - asBool() { - if (this.truthy) return true; - if (this.falsy || this.nullish) return false; - if (this.isBoolean()) return this.bool; - if (this.isNull()) return false; - if (this.isUndefined()) return false; - if (this.isString()) return this.string !== ""; - if (this.isNumber()) return this.number !== 0; - if (this.isBigInt()) return this.bigint !== BigInt(0); - if (this.isRegExp()) return true; - if (this.isArray()) return true; - if (this.isConstArray()) return true; - if (this.isWrapped()) { - return (this.prefix && this.prefix.asBool()) || - (this.postfix && this.postfix.asBool()) - ? true - : undefined; - } - if (this.isTemplateString()) { - const str = this.asString(); - if (typeof str === "string") return str !== ""; - } - return undefined; - } - - asNullish() { - const nullish = this.isNullish(); - - if (nullish === true || this.isNull() || this.isUndefined()) return true; - - if (nullish === false) return false; - if (this.isTruthy()) return false; - if (this.isBoolean()) return false; - if (this.isString()) return false; - if (this.isNumber()) return false; - if (this.isBigInt()) return false; - if (this.isRegExp()) return false; - if (this.isArray()) return false; - if (this.isConstArray()) return false; - if (this.isTemplateString()) return false; - if (this.isRegExp()) return false; + inScope(params, fn) { + const oldScope = this.scope; + this.scope = { + topLevelScope: oldScope.topLevelScope, + inTry: false, + inShorthand: false, + isStrict: oldScope.isStrict, + isAsmJs: oldScope.isAsmJs, + definitions: oldScope.definitions.createChild() + }; - return undefined; - } + this.undefineVariable("this"); - asString() { - if (this.isBoolean()) return `${this.bool}`; - if (this.isNull()) return "null"; - if (this.isUndefined()) return "undefined"; - if (this.isString()) return this.string; - if (this.isNumber()) return `${this.number}`; - if (this.isBigInt()) return `${this.bigint}`; - if (this.isRegExp()) return `${this.regExp}`; - if (this.isArray()) { - let array = []; - for (const item of this.items) { - const itemStr = item.asString(); - if (itemStr === undefined) return undefined; - array.push(itemStr); - } - return `${array}`; - } - if (this.isConstArray()) return `${this.array}`; - if (this.isTemplateString()) { - let str = ""; - for (const part of this.parts) { - const partStr = part.asString(); - if (partStr === undefined) return undefined; - str += partStr; - } - return str; - } - return undefined; - } + this.enterPatterns(params, (ident, pattern) => { + this.defineVariable(ident); + }); - setString(string) { - this.type = TypeString; - this.string = string; - this.sideEffects = false; - return this; - } + fn(); - setUndefined() { - this.type = TypeUndefined; - this.sideEffects = false; - return this; + this.scope = oldScope; } - setNull() { - this.type = TypeNull; - this.sideEffects = false; - return this; - } + inFunctionScope(hasThis, params, fn) { + const oldScope = this.scope; + this.scope = { + topLevelScope: oldScope.topLevelScope, + inTry: false, + inShorthand: false, + isStrict: oldScope.isStrict, + isAsmJs: oldScope.isAsmJs, + definitions: oldScope.definitions.createChild() + }; - setNumber(number) { - this.type = TypeNumber; - this.number = number; - this.sideEffects = false; - return this; - } + if (hasThis) { + this.undefineVariable("this"); + } - setBigInt(bigint) { - this.type = TypeBigInt; - this.bigint = bigint; - this.sideEffects = false; - return this; - } + this.enterPatterns(params, (ident, pattern) => { + this.defineVariable(ident); + }); - setBoolean(bool) { - this.type = TypeBoolean; - this.bool = bool; - this.sideEffects = false; - return this; - } + fn(); - setRegExp(regExp) { - this.type = TypeRegExp; - this.regExp = regExp; - this.sideEffects = false; - return this; + this.scope = oldScope; } - setIdentifier(identifier, rootInfo, getMembers) { - this.type = TypeIdentifier; - this.identifier = identifier; - this.rootInfo = rootInfo; - this.getMembers = getMembers; - this.sideEffects = true; - return this; - } + inBlockScope(fn) { + const oldScope = this.scope; + this.scope = { + topLevelScope: oldScope.topLevelScope, + inTry: oldScope.inTry, + inShorthand: false, + isStrict: oldScope.isStrict, + isAsmJs: oldScope.isAsmJs, + definitions: oldScope.definitions.createChild() + }; - setWrapped(prefix, postfix, innerExpressions) { - this.type = TypeWrapped; - this.prefix = prefix; - this.postfix = postfix; - this.wrappedInnerExpressions = innerExpressions; - this.sideEffects = true; - return this; - } + fn(); - setOptions(options) { - this.type = TypeConditional; - this.options = options; - this.sideEffects = true; - return this; + this.scope = oldScope; } - addOptions(options) { - if (!this.options) { - this.type = TypeConditional; - this.options = []; - this.sideEffects = true; + detectMode(statements) { + const isLiteral = + statements.length >= 1 && + statements[0].type === "ExpressionStatement" && + statements[0].expression.type === "Literal"; + if (isLiteral && statements[0].expression.value === "use strict") { + this.scope.isStrict = true; } - for (const item of options) { - this.options.push(item); + if (isLiteral && statements[0].expression.value === "use asm") { + this.scope.isAsmJs = true; } - return this; } - setItems(items) { - this.type = TypeArray; - this.items = items; - this.sideEffects = items.some(i => i.couldHaveSideEffects()); - return this; + enterPatterns(patterns, onIdent) { + for (const pattern of patterns) { + if (typeof pattern !== "string") { + this.enterPattern(pattern, onIdent); + } else if (pattern) { + onIdent(pattern); + } + } } - setArray(array) { - this.type = TypeConstArray; - this.array = array; - this.sideEffects = false; - return this; + enterPattern(pattern, onIdent) { + if (!pattern) return; + switch (pattern.type) { + case "ArrayPattern": + this.enterArrayPattern(pattern, onIdent); + break; + case "AssignmentPattern": + this.enterAssignmentPattern(pattern, onIdent); + break; + case "Identifier": + this.enterIdentifier(pattern, onIdent); + break; + case "ObjectPattern": + this.enterObjectPattern(pattern, onIdent); + break; + case "RestElement": + this.enterRestElement(pattern, onIdent); + break; + case "Property": + if (pattern.shorthand && pattern.value.type === "Identifier") { + this.scope.inShorthand = pattern.value.name; + this.enterIdentifier(pattern.value, onIdent); + this.scope.inShorthand = false; + } else { + this.enterPattern(pattern.value, onIdent); + } + break; + } } - setTemplateString(quasis, parts, kind) { - this.type = TypeTemplateString; - this.quasis = quasis; - this.parts = parts; - this.templateStringKind = kind; - this.sideEffects = parts.some(p => p.sideEffects); - return this; + enterIdentifier(pattern, onIdent) { + if (!this.callHooksForName(this.hooks.pattern, pattern.name, pattern)) { + onIdent(pattern.name, pattern); + } } - setTruthy() { - this.falsy = false; - this.truthy = true; - this.nullish = false; - return this; + enterObjectPattern(pattern, onIdent) { + for ( + let propIndex = 0, len = pattern.properties.length; + propIndex < len; + propIndex++ + ) { + const prop = pattern.properties[propIndex]; + this.enterPattern(prop, onIdent); + } } - setFalsy() { - this.falsy = true; - this.truthy = false; - return this; + enterArrayPattern(pattern, onIdent) { + for ( + let elementIndex = 0, len = pattern.elements.length; + elementIndex < len; + elementIndex++ + ) { + const element = pattern.elements[elementIndex]; + this.enterPattern(element, onIdent); + } } - setNullish(value) { - this.nullish = value; - - if (value) return this.setFalsy(); + enterRestElement(pattern, onIdent) { + this.enterPattern(pattern.argument, onIdent); + } - return this; + enterAssignmentPattern(pattern, onIdent) { + this.enterPattern(pattern.left, onIdent); } - setRange(range) { - this.range = range; - return this; + /** + * @param {ExpressionNode} expression expression node + * @returns {BasicEvaluatedExpression | undefined} evaluation result + */ + evaluateExpression(expression) { + try { + const hook = this.hooks.evaluate.get(expression.type); + if (hook !== undefined) { + const result = hook.call(expression); + if (result !== undefined) { + if (result) { + result.setExpression(expression); + } + return result; + } + } + } catch (e) { + console.warn(e); + // ignore error + } + return new BasicEvaluatedExpression() + .setRange(expression.range) + .setExpression(expression); } - setSideEffects(sideEffects = true) { - this.sideEffects = sideEffects; - return this; + parseString(expression) { + switch (expression.type) { + case "BinaryExpression": + if (expression.operator === "+") { + return ( + this.parseString(expression.left) + + this.parseString(expression.right) + ); + } + break; + case "Literal": + return expression.value + ""; + } + throw new Error( + expression.type + " is not supported as parameter for require" + ); } - setExpression(expression) { - this.expression = expression; - return this; + parseCalculatedString(expression) { + switch (expression.type) { + case "BinaryExpression": + if (expression.operator === "+") { + const left = this.parseCalculatedString(expression.left); + const right = this.parseCalculatedString(expression.right); + if (left.code) { + return { + range: left.range, + value: left.value, + code: true, + conditional: false + }; + } else if (right.code) { + return { + range: [ + left.range[0], + right.range ? right.range[1] : left.range[1] + ], + value: left.value + right.value, + code: true, + conditional: false + }; + } else { + return { + range: [left.range[0], right.range[1]], + value: left.value + right.value, + code: false, + conditional: false + }; + } + } + break; + case "ConditionalExpression": { + const consequent = this.parseCalculatedString(expression.consequent); + const alternate = this.parseCalculatedString(expression.alternate); + const items = []; + if (consequent.conditional) { + items.push(...consequent.conditional); + } else if (!consequent.code) { + items.push(consequent); + } else { + break; + } + if (alternate.conditional) { + items.push(...alternate.conditional); + } else if (!alternate.code) { + items.push(alternate); + } else { + break; + } + return { + range: undefined, + value: "", + code: true, + conditional: items + }; + } + case "Literal": + return { + range: expression.range, + value: expression.value + "", + code: false, + conditional: false + }; + } + return { + range: undefined, + value: "", + code: true, + conditional: false + }; } -} - -/** - * @param {string} flags regexp flags - * @returns {boolean} is valid flags - */ -BasicEvaluatedExpression.isValidRegExpFlags = flags => { - const len = flags.length; - if (len === 0) return true; - if (len > 4) return false; + /** + * @param {string | Buffer | PreparsedAst} source the source to parse + * @param {ParserState} state the parser state + * @returns {ParserState} the parser state + */ + parse(source, state) { + let ast; + let comments; + const semicolons = new Set(); + if (source === null) { + throw new Error("source must not be null"); + } + if (Buffer.isBuffer(source)) { + source = source.toString("utf-8"); + } + if (typeof source === "object") { + ast = /** @type {ProgramNode} */ (source); + comments = source.comments; + } else { + comments = []; + ast = JavascriptParser._parse(source, { + sourceType: this.sourceType, + onComment: comments, + onInsertedSemicolon: pos => semicolons.add(pos) + }); + } - // cspell:word gimy - let remaining = 0b0000; // bit per RegExp flag: gimy + const oldScope = this.scope; + const oldState = this.state; + const oldComments = this.comments; + const oldSemicolons = this.semicolons; + const oldStatementPath = this.statementPath; + const oldPrevStatement = this.prevStatement; + this.scope = { + topLevelScope: true, + inTry: false, + inShorthand: false, + isStrict: false, + isAsmJs: false, + definitions: new StackedMap() + }; + /** @type {ParserState} */ + this.state = state; + this.comments = comments; + this.semicolons = semicolons; + this.statementPath = []; + this.prevStatement = undefined; + if (this.hooks.program.call(ast, comments) === undefined) { + this.detectMode(ast.body); + this.preWalkStatements(ast.body); + this.prevStatement = undefined; + this.blockPreWalkStatements(ast.body); + this.prevStatement = undefined; + this.walkStatements(ast.body); + } + this.hooks.finish.call(ast, comments); + this.scope = oldScope; + /** @type {ParserState} */ + this.state = oldState; + this.comments = oldComments; + this.semicolons = oldSemicolons; + this.statementPath = oldStatementPath; + this.prevStatement = oldPrevStatement; + return state; + } - for (let i = 0; i < len; i++) - switch (flags.charCodeAt(i)) { - case 103 /* g */: - if (remaining & 0b1000) return false; - remaining |= 0b1000; - break; - case 105 /* i */: - if (remaining & 0b0100) return false; - remaining |= 0b0100; - break; - case 109 /* m */: - if (remaining & 0b0010) return false; - remaining |= 0b0010; - break; - case 121 /* y */: - if (remaining & 0b0001) return false; - remaining |= 0b0001; - break; - default: - return false; + evaluate(source) { + const ast = JavascriptParser._parse("(" + source + ")", { + sourceType: this.sourceType, + locations: false + }); + if (ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement") { + throw new Error("evaluate: Source is not a expression"); } + return this.evaluateExpression(ast.body[0].expression); + } - return true; -}; + /** + * @param {ExpressionNode | DeclarationNode | PrivateIdentifierNode | null | undefined} expr an expression + * @param {number} commentsStartPos source position from which annotation comments are checked + * @returns {boolean} true, when the expression is pure + */ + isPure(expr, commentsStartPos) { + if (!expr) return true; + const result = this.hooks.isPure + .for(expr.type) + .call(expr, commentsStartPos); + if (typeof result === "boolean") return result; + switch (expr.type) { + case "ClassDeclaration": + case "ClassExpression": { + if (expr.body.type !== "ClassBody") return false; + if (expr.superClass && !this.isPure(expr.superClass, expr.range[0])) { + return false; + } + const items = + /** @type {(MethodDefinitionNode | PropertyDefinitionNode)[]} */ ( + expr.body.body + ); + return items.every( + item => + (!item.computed || + !item.key || + this.isPure(item.key, item.range[0])) && + (!item.static || + !item.value || + this.isPure( + item.value, + item.key ? item.key.range[1] : item.range[0] + )) + ); + } -module.exports = BasicEvaluatedExpression; + case "FunctionDeclaration": + case "FunctionExpression": + case "ArrowFunctionExpression": + case "Literal": + case "PrivateIdentifier": + return true; + case "VariableDeclaration": + return expr.declarations.every(decl => + this.isPure(decl.init, decl.range[0]) + ); -/***/ }), + case "ConditionalExpression": + return ( + this.isPure(expr.test, commentsStartPos) && + this.isPure(expr.consequent, expr.test.range[1]) && + this.isPure(expr.alternate, expr.consequent.range[1]) + ); -/***/ 91145: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + case "SequenceExpression": + return expr.expressions.every(expr => { + const pureFlag = this.isPure(expr, commentsStartPos); + commentsStartPos = expr.range[1]; + return pureFlag; + }); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + case "CallExpression": { + const pureFlag = + expr.range[0] - commentsStartPos > 12 && + this.getComments([commentsStartPos, expr.range[0]]).some( + comment => + comment.type === "Block" && + /^\s*(#|@)__PURE__\s*$/.test(comment.value) + ); + if (!pureFlag) return false; + commentsStartPos = expr.callee.range[1]; + return expr.arguments.every(arg => { + if (arg.type === "SpreadElement") return false; + const pureFlag = this.isPure(arg, commentsStartPos); + commentsStartPos = arg.range[1]; + return pureFlag; + }); + } + } + const evaluated = this.evaluateExpression(expr); + return !evaluated.couldHaveSideEffects(); + } + getComments(range) { + const [rangeStart, rangeEnd] = range; + const compare = (comment, needle) => comment.range[0] - needle; + let idx = binarySearchBounds.ge(this.comments, rangeStart, compare); + let commentsInRange = []; + while (this.comments[idx] && this.comments[idx].range[1] <= rangeEnd) { + commentsInRange.push(this.comments[idx]); + idx++; + } + return commentsInRange; + } -const Entrypoint = __webpack_require__(13795); + /** + * @param {number} pos source code position + * @returns {boolean} true when a semicolon has been inserted before this position, false if not + */ + isAsiPosition(pos) { + const currentStatement = this.statementPath[this.statementPath.length - 1]; + if (currentStatement === undefined) throw new Error("Not in statement"); + return ( + // Either asking directly for the end position of the current statement + (currentStatement.range[1] === pos && this.semicolons.has(pos)) || + // Or asking for the start position of the current statement, + // here we have to check multiple things + (currentStatement.range[0] === pos && + // is there a previous statement which might be relevant? + this.prevStatement !== undefined && + // is the end position of the previous statement an ASI position? + this.semicolons.has(this.prevStatement.range[1])) + ); + } -/** @typedef {import("../Chunk")} Chunk */ + /** + * @param {number} pos source code position + * @returns {void} + */ + unsetAsiPosition(pos) { + this.semicolons.delete(pos); + } -/** - * @param {Entrypoint} entrypoint a chunk group - * @param {Chunk} excludedChunk1 current chunk which is excluded - * @param {Chunk} excludedChunk2 runtime chunk which is excluded - * @returns {Set} chunks - */ -const getAllChunks = (entrypoint, excludedChunk1, excludedChunk2) => { - const queue = new Set([entrypoint]); - const chunks = new Set(); - for (const entrypoint of queue) { - for (const chunk of entrypoint.chunks) { - if (chunk === excludedChunk1) continue; - if (chunk === excludedChunk2) continue; - chunks.add(chunk); + isStatementLevelExpression(expr) { + const currentStatement = this.statementPath[this.statementPath.length - 1]; + return ( + expr === currentStatement || + (currentStatement.type === "ExpressionStatement" && + currentStatement.expression === expr) + ); + } + + getTagData(name, tag) { + const info = this.scope.definitions.get(name); + if (info instanceof VariableInfo) { + let tagInfo = info.tagInfo; + while (tagInfo !== undefined) { + if (tagInfo.tag === tag) return tagInfo.data; + tagInfo = tagInfo.next; + } } - for (const parent of entrypoint.parentsIterable) { - if (parent instanceof Entrypoint) queue.add(parent); + } + + tagVariable(name, tag, data) { + const oldInfo = this.scope.definitions.get(name); + /** @type {VariableInfo} */ + let newInfo; + if (oldInfo === undefined) { + newInfo = new VariableInfo(this.scope, name, { + tag, + data, + next: undefined + }); + } else if (oldInfo instanceof VariableInfo) { + newInfo = new VariableInfo(oldInfo.declaredScope, oldInfo.freeName, { + tag, + data, + next: oldInfo.tagInfo + }); + } else { + newInfo = new VariableInfo(oldInfo, true, { + tag, + data, + next: undefined + }); } + this.scope.definitions.set(name, newInfo); } - return chunks; -}; -exports.getAllChunks = getAllChunks; + defineVariable(name) { + const oldInfo = this.scope.definitions.get(name); + // Don't redefine variable in same scope to keep existing tags + if (oldInfo instanceof VariableInfo && oldInfo.declaredScope === this.scope) + return; + this.scope.definitions.set(name, this.scope); + } -/***/ }), + undefineVariable(name) { + this.scope.definitions.delete(name); + } -/***/ 84508: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + isVariableDefined(name) { + const info = this.scope.definitions.get(name); + if (info === undefined) return false; + if (info instanceof VariableInfo) { + return info.freeName === true; + } + return true; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {string} name variable name + * @returns {ExportedVariableInfo} info for this variable + */ + getVariableInfo(name) { + const value = this.scope.definitions.get(name); + if (value === undefined) { + return name; + } else { + return value; + } + } + /** + * @param {string} name variable name + * @param {ExportedVariableInfo} variableInfo new info for this variable + * @returns {void} + */ + setVariable(name, variableInfo) { + if (typeof variableInfo === "string") { + if (variableInfo === name) { + this.scope.definitions.delete(name); + } else { + this.scope.definitions.set( + name, + new VariableInfo(this.scope, variableInfo, undefined) + ); + } + } else { + this.scope.definitions.set(name, variableInfo); + } + } + parseCommentOptions(range) { + const comments = this.getComments(range); + if (comments.length === 0) { + return EMPTY_COMMENT_OPTIONS; + } + let options = {}; + let errors = []; + for (const comment of comments) { + const { value } = comment; + if (value && webpackCommentRegExp.test(value)) { + // try compile only if webpack options comment is present + try { + const val = vm.runInNewContext(`(function(){return {${value}};})()`); + Object.assign(options, val); + } catch (e) { + e.comment = comment; + errors.push(e); + } + } + } + return { options, errors }; + } -const { ConcatSource, RawSource } = __webpack_require__(51255); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const { - getChunkFilenameTemplate, - getCompilationHooks -} = __webpack_require__(89464); -const { - generateEntryStartup, - updateHashForEntryStartup -} = __webpack_require__(98124); + /** + * @param {MemberExpressionNode} expression a member expression + * @returns {{ members: string[], object: ExpressionNode | SuperNode }} member names (reverse order) and remaining object + */ + extractMemberExpressionChain(expression) { + /** @type {AnyNode} */ + let expr = expression; + const members = []; + while (expr.type === "MemberExpression") { + if (expr.computed) { + if (expr.property.type !== "Literal") break; + members.push(`${expr.property.value}`); + } else { + if (expr.property.type !== "Identifier") break; + members.push(expr.property.name); + } + expr = expr.object; + } + return { + members, + object: expr + }; + } -/** @typedef {import("../Compiler")} Compiler */ + /** + * @param {string} varName variable name + * @returns {{name: string, info: VariableInfo | string}} name of the free variable and variable info for that + */ + getFreeInfoFromVariable(varName) { + const info = this.getVariableInfo(varName); + let name; + if (info instanceof VariableInfo) { + name = info.freeName; + if (typeof name !== "string") return undefined; + } else if (typeof info !== "string") { + return undefined; + } else { + name = info; + } + return { info, name }; + } + + /** @typedef {{ type: "call", call: CallExpressionNode, calleeName: string, rootInfo: string | VariableInfo, getCalleeMembers: () => string[], name: string, getMembers: () => string[]}} CallExpressionInfo */ + /** @typedef {{ type: "expression", rootInfo: string | VariableInfo, name: string, getMembers: () => string[]}} ExpressionExpressionInfo */ -class CommonJsChunkFormatPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {MemberExpressionNode} expression a member expression + * @param {number} allowedTypes which types should be returned, presented in bit mask + * @returns {CallExpressionInfo | ExpressionExpressionInfo | undefined} expression info */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - "CommonJsChunkFormatPlugin", - compilation => { - compilation.hooks.additionalChunkRuntimeRequirements.tap( - "CommonJsChunkLoadingPlugin", - (chunk, set, { chunkGraph }) => { - if (chunk.hasRuntime()) return; - if (chunkGraph.getNumberOfEntryModules(chunk) > 0) { - set.add(RuntimeGlobals.require); - set.add(RuntimeGlobals.startupEntrypoint); - set.add(RuntimeGlobals.externalInstallChunk); - } - } - ); - const hooks = getCompilationHooks(compilation); - hooks.renderChunk.tap( - "CommonJsChunkFormatPlugin", - (modules, renderContext) => { - const { chunk, chunkGraph, runtimeTemplate } = renderContext; - const source = new ConcatSource(); - source.add(`exports.id = ${JSON.stringify(chunk.id)};\n`); - source.add(`exports.ids = ${JSON.stringify(chunk.ids)};\n`); - source.add(`exports.modules = `); - source.add(modules); - source.add(";\n"); - const runtimeModules = - chunkGraph.getChunkRuntimeModulesInOrder(chunk); - if (runtimeModules.length > 0) { - source.add("exports.runtime =\n"); - source.add( - Template.renderChunkRuntimeModules( - runtimeModules, - renderContext - ) - ); - } - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); - if (entries.length > 0) { - const runtimeChunk = entries[0][1].getRuntimeChunk(); - const currentOutputName = compilation - .getPath( - getChunkFilenameTemplate(chunk, compilation.outputOptions), - { - chunk, - contentHashType: "javascript" - } - ) - .split("/"); - const runtimeOutputName = compilation - .getPath( - getChunkFilenameTemplate( - runtimeChunk, - compilation.outputOptions - ), - { - chunk: runtimeChunk, - contentHashType: "javascript" - } - ) - .split("/"); + getMemberExpressionInfo(expression, allowedTypes) { + const { object, members } = this.extractMemberExpressionChain(expression); + switch (object.type) { + case "CallExpression": { + if ((allowedTypes & ALLOWED_MEMBER_TYPES_CALL_EXPRESSION) === 0) + return undefined; + let callee = object.callee; + let rootMembers = EMPTY_ARRAY; + if (callee.type === "MemberExpression") { + ({ object: callee, members: rootMembers } = + this.extractMemberExpressionChain(callee)); + } + const rootName = getRootName(callee); + if (!rootName) return undefined; + const result = this.getFreeInfoFromVariable(rootName); + if (!result) return undefined; + const { info: rootInfo, name: resolvedRoot } = result; + const calleeName = objectAndMembersToName(resolvedRoot, rootMembers); + return { + type: "call", + call: object, + calleeName, + rootInfo, + getCalleeMembers: memoize(() => rootMembers.reverse()), + name: objectAndMembersToName(`${calleeName}()`, members), + getMembers: memoize(() => members.reverse()) + }; + } + case "Identifier": + case "MetaProperty": + case "ThisExpression": { + if ((allowedTypes & ALLOWED_MEMBER_TYPES_EXPRESSION) === 0) + return undefined; + const rootName = getRootName(object); + if (!rootName) return undefined; - // remove filename, we only need the directory - currentOutputName.pop(); + const result = this.getFreeInfoFromVariable(rootName); + if (!result) return undefined; + const { info: rootInfo, name: resolvedRoot } = result; + return { + type: "expression", + name: objectAndMembersToName(resolvedRoot, members), + rootInfo, + getMembers: memoize(() => members.reverse()) + }; + } + } + } - // remove common parts - while ( - currentOutputName.length > 0 && - runtimeOutputName.length > 0 && - currentOutputName[0] === runtimeOutputName[0] - ) { - currentOutputName.shift(); - runtimeOutputName.shift(); - } + /** + * @param {MemberExpressionNode} expression an expression + * @returns {{ name: string, rootInfo: ExportedVariableInfo, getMembers: () => string[]}} name info + */ + getNameForExpression(expression) { + return this.getMemberExpressionInfo( + expression, + ALLOWED_MEMBER_TYPES_EXPRESSION + ); + } - // create final path - const runtimePath = - (currentOutputName.length > 0 - ? "../".repeat(currentOutputName.length) - : "./") + runtimeOutputName.join("/"); + /** + * @param {string} code source code + * @param {ParseOptions} options parsing options + * @returns {ProgramNode} parsed ast + */ + static _parse(code, options) { + const type = options ? options.sourceType : "module"; + /** @type {AcornOptions} */ + const parserOptions = { + ...defaultParserOptions, + allowReturnOutsideFunction: type === "script", + ...options, + sourceType: type === "auto" ? "module" : type + }; - const entrySource = new ConcatSource(); - entrySource.add( - `(${ - runtimeTemplate.supportsArrowFunction() - ? "() => " - : "function() " - }{\n` - ); - entrySource.add("var exports = {};\n"); - entrySource.add(source); - entrySource.add(";\n\n// load runtime\n"); - entrySource.add( - `var __webpack_require__ = require(${JSON.stringify( - runtimePath - )});\n` - ); - entrySource.add( - `${RuntimeGlobals.externalInstallChunk}(exports);\n` - ); - const startupSource = new RawSource( - generateEntryStartup( - chunkGraph, - runtimeTemplate, - entries, - chunk, - false - ) - ); - entrySource.add( - hooks.renderStartup.call( - startupSource, - entries[entries.length - 1][0], - { - ...renderContext, - inlined: false - } - ) - ); - entrySource.add("\n})()"); - return entrySource; - } - return source; - } - ); - hooks.chunkHash.tap( - "CommonJsChunkFormatPlugin", - (chunk, hash, { chunkGraph }) => { - if (chunk.hasRuntime()) return; - hash.update("CommonJsChunkFormatPlugin"); - hash.update("1"); - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); - updateHashForEntryStartup(hash, chunkGraph, entries, chunk); - } - ); + /** @type {AnyNode} */ + let ast; + let error; + let threw = false; + try { + ast = /** @type {AnyNode} */ (parser.parse(code, parserOptions)); + } catch (e) { + error = e; + threw = true; + } + + if (threw && type === "auto") { + parserOptions.sourceType = "script"; + if (!("allowReturnOutsideFunction" in options)) { + parserOptions.allowReturnOutsideFunction = true; } - ); + if (Array.isArray(parserOptions.onComment)) { + parserOptions.onComment.length = 0; + } + try { + ast = /** @type {AnyNode} */ (parser.parse(code, parserOptions)); + threw = false; + } catch (e) { + // we use the error from first parse try + // so nothing to do here + } + } + + if (threw) { + throw error; + } + + return /** @type {ProgramNode} */ (ast); } } -module.exports = CommonJsChunkFormatPlugin; +module.exports = JavascriptParser; +module.exports.ALLOWED_MEMBER_TYPES_ALL = ALLOWED_MEMBER_TYPES_ALL; +module.exports.ALLOWED_MEMBER_TYPES_EXPRESSION = + ALLOWED_MEMBER_TYPES_EXPRESSION; +module.exports.ALLOWED_MEMBER_TYPES_CALL_EXPRESSION = + ALLOWED_MEMBER_TYPES_CALL_EXPRESSION; /***/ }), -/***/ 61291: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 93998: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -96661,123 +94953,112 @@ module.exports = CommonJsChunkFormatPlugin; -/** @typedef {import("../../declarations/WebpackOptions").ChunkLoadingType} ChunkLoadingType */ -/** @typedef {import("../Compiler")} Compiler */ +const UnsupportedFeatureWarning = __webpack_require__(42495); +const ConstDependency = __webpack_require__(76911); +const BasicEvaluatedExpression = __webpack_require__(950); -/** @type {WeakMap>} */ -const enabledTypes = new WeakMap(); +/** @typedef {import("estree").Expression} ExpressionNode */ +/** @typedef {import("estree").Node} Node */ +/** @typedef {import("./JavascriptParser")} JavascriptParser */ -const getEnabledTypes = compiler => { - let set = enabledTypes.get(compiler); - if (set === undefined) { - set = new Set(); - enabledTypes.set(compiler, set); - } - return set; +/** + * @param {JavascriptParser} parser the parser + * @param {string} value the const value + * @param {string[]=} runtimeRequirements runtime requirements + * @returns {function(ExpressionNode): true} plugin function + */ +exports.toConstantDependency = (parser, value, runtimeRequirements) => { + return function constDependency(expr) { + const dep = new ConstDependency(value, expr.range, runtimeRequirements); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + return true; + }; }; -class EnableChunkLoadingPlugin { - /** - * @param {ChunkLoadingType} type library type that should be available - */ - constructor(type) { - this.type = type; - } +/** + * @param {string} value the string value + * @returns {function(ExpressionNode): BasicEvaluatedExpression} plugin function + */ +exports.evaluateToString = value => { + return function stringExpression(expr) { + return new BasicEvaluatedExpression().setString(value).setRange(expr.range); + }; +}; - /** - * @param {Compiler} compiler the compiler instance - * @param {ChunkLoadingType} type type of library - * @returns {void} - */ - static setEnabled(compiler, type) { - getEnabledTypes(compiler).add(type); - } +/** + * @param {number} value the number value + * @returns {function(ExpressionNode): BasicEvaluatedExpression} plugin function + */ +exports.evaluateToNumber = value => { + return function stringExpression(expr) { + return new BasicEvaluatedExpression().setNumber(value).setRange(expr.range); + }; +}; - /** - * @param {Compiler} compiler the compiler instance - * @param {ChunkLoadingType} type type of library - * @returns {void} - */ - static checkEnabled(compiler, type) { - if (!getEnabledTypes(compiler).has(type)) { - throw new Error( - `Chunk loading type "${type}" is not enabled. ` + - "EnableChunkLoadingPlugin need to be used to enable this type of chunk loading. " + - 'This usually happens through the "output.enabledChunkLoadingTypes" option. ' + - 'If you are using a function as entry which sets "chunkLoading", you need to add all potential chunk loading types to "output.enabledChunkLoadingTypes". ' + - "These types are enabled: " + - Array.from(getEnabledTypes(compiler)).join(", ") - ); +/** + * @param {boolean} value the boolean value + * @returns {function(ExpressionNode): BasicEvaluatedExpression} plugin function + */ +exports.evaluateToBoolean = value => { + return function booleanExpression(expr) { + return new BasicEvaluatedExpression() + .setBoolean(value) + .setRange(expr.range); + }; +}; + +/** + * @param {string} identifier identifier + * @param {string} rootInfo rootInfo + * @param {function(): string[]} getMembers getMembers + * @param {boolean|null=} truthy is truthy, null if nullish + * @returns {function(ExpressionNode): BasicEvaluatedExpression} callback + */ +exports.evaluateToIdentifier = (identifier, rootInfo, getMembers, truthy) => { + return function identifierExpression(expr) { + let evaluatedExpression = new BasicEvaluatedExpression() + .setIdentifier(identifier, rootInfo, getMembers) + .setSideEffects(false) + .setRange(expr.range); + switch (truthy) { + case true: + evaluatedExpression.setTruthy(); + break; + case null: + evaluatedExpression.setNullish(true); + break; + case false: + evaluatedExpression.setFalsy(); + break; } - } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const { type } = this; + return evaluatedExpression; + }; +}; - // Only enable once - const enabled = getEnabledTypes(compiler); - if (enabled.has(type)) return; - enabled.add(type); +exports.expressionIsUnsupported = (parser, message) => { + return function unsupportedExpression(expr) { + const dep = new ConstDependency("(void 0)", expr.range, null); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + if (!parser.state.module) return; + parser.state.module.addWarning( + new UnsupportedFeatureWarning(message, expr.loc) + ); + return true; + }; +}; - if (typeof type === "string") { - switch (type) { - case "jsonp": { - const JsonpChunkLoadingPlugin = __webpack_require__(83121); - new JsonpChunkLoadingPlugin().apply(compiler); - break; - } - case "import-scripts": { - const ImportScriptsChunkLoadingPlugin = __webpack_require__(54182); - new ImportScriptsChunkLoadingPlugin().apply(compiler); - break; - } - case "require": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const CommonJsChunkLoadingPlugin = __webpack_require__(1313); - new CommonJsChunkLoadingPlugin({ - asyncChunkLoading: false - }).apply(compiler); - break; - } - case "async-node": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const CommonJsChunkLoadingPlugin = __webpack_require__(1313); - new CommonJsChunkLoadingPlugin({ - asyncChunkLoading: true - }).apply(compiler); - break; - } - case "import": { - const ModuleChunkLoadingPlugin = __webpack_require__(89831); - new ModuleChunkLoadingPlugin().apply(compiler); - break; - } - case "universal": - // TODO implement universal chunk loading - throw new Error("Universal Chunk Loading is not implemented yet"); - default: - throw new Error(`Unsupported chunk loading type ${type}. -Plugins which provide custom chunk loading types must call EnableChunkLoadingPlugin.setEnabled(compiler, type) to disable this error.`); - } - } else { - // TODO support plugin instances here - // apply them to the compiler - } - } -} +exports.skipTraversal = () => true; -module.exports = EnableChunkLoadingPlugin; +exports.approve = () => true; /***/ }), -/***/ 77106: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 98124: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -96787,229 +95068,185 @@ module.exports = EnableChunkLoadingPlugin; -const util = __webpack_require__(73837); -const { RawSource, ReplaceSource } = __webpack_require__(51255); -const Generator = __webpack_require__(93401); -const InitFragment = __webpack_require__(55870); -const HarmonyCompatibilityDependency = __webpack_require__(72906); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const { isSubset } = __webpack_require__(93347); +const { getAllChunks } = __webpack_require__(91145); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../DependenciesBlock")} DependenciesBlock */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ -/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../ChunkGraph").EntryModuleWithChunkGroup} EntryModuleWithChunkGroup */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ /** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {(string|number)[]} EntryItem */ -// TODO: clean up this file -// replace with newer constructs - -const deprecatedGetInitFragments = util.deprecate( - (template, dependency, templateContext) => - template.getInitFragments(dependency, templateContext), - "DependencyTemplate.getInitFragment is deprecated (use apply(dep, source, { initFragments }) instead)", - "DEP_WEBPACK_JAVASCRIPT_GENERATOR_GET_INIT_FRAGMENTS" -); - -const TYPES = new Set(["javascript"]); +const EXPORT_PREFIX = "var __webpack_exports__ = "; -class JavascriptGenerator extends Generator { - /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) - */ - getTypes(module) { - return TYPES; - } +/** + * @param {ChunkGraph} chunkGraph chunkGraph + * @param {RuntimeTemplate} runtimeTemplate runtimeTemplate + * @param {EntryModuleWithChunkGroup[]} entries entries + * @param {Chunk} chunk chunk + * @param {boolean} passive true: passive startup with on chunks loaded + * @returns {string} runtime code + */ +exports.generateEntryStartup = ( + chunkGraph, + runtimeTemplate, + entries, + chunk, + passive +) => { + /** @type {string[]} */ + const runtime = [ + `var __webpack_exec__ = ${runtimeTemplate.returningFunction( + `__webpack_require__(${RuntimeGlobals.entryModuleId} = moduleId)`, + "moduleId" + )}` + ]; - /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module - */ - getSize(module, type) { - const originalSource = module.originalSource(); - if (!originalSource) { - return 39; + const runModule = id => { + return `__webpack_exec__(${JSON.stringify(id)})`; + }; + const outputCombination = (chunks, moduleIds, final) => { + if (chunks.size === 0) { + runtime.push( + `${final ? EXPORT_PREFIX : ""}(${moduleIds.map(runModule).join(", ")});` + ); + } else { + const fn = runtimeTemplate.returningFunction( + moduleIds.map(runModule).join(", ") + ); + runtime.push( + `${final && !passive ? EXPORT_PREFIX : ""}${ + passive + ? RuntimeGlobals.onChunksLoaded + : RuntimeGlobals.startupEntrypoint + }(0, ${JSON.stringify(Array.from(chunks, c => c.id))}, ${fn});` + ); + if (final && passive) { + runtime.push(`${EXPORT_PREFIX}${RuntimeGlobals.onChunksLoaded}();`); + } } - return originalSource.size(); - } + }; - /** - * @param {NormalModule} module module for which the bailout reason should be determined - * @param {ConcatenationBailoutReasonContext} context context - * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated - */ - getConcatenationBailoutReason(module, context) { - // Only harmony modules are valid for optimization + let currentChunks = undefined; + let currentModuleIds = undefined; + + for (const [module, entrypoint] of entries) { + const runtimeChunk = entrypoint.getRuntimeChunk(); + const moduleId = chunkGraph.getModuleId(module); + const chunks = getAllChunks(entrypoint, chunk, runtimeChunk); if ( - !module.buildMeta || - module.buildMeta.exportsType !== "namespace" || - module.presentationalDependencies === undefined || - !module.presentationalDependencies.some( - d => d instanceof HarmonyCompatibilityDependency - ) + currentChunks && + currentChunks.size === chunks.size && + isSubset(currentChunks, chunks) ) { - return "Module is not an ECMAScript module"; + currentModuleIds.push(moduleId); + } else { + if (currentChunks) { + outputCombination(currentChunks, currentModuleIds); + } + currentChunks = chunks; + currentModuleIds = [moduleId]; } + } - // Some expressions are not compatible with module concatenation - // because they may produce unexpected results. The plugin bails out - // if some were detected upfront. - if (module.buildInfo && module.buildInfo.moduleConcatenationBailout) { - return `Module uses ${module.buildInfo.moduleConcatenationBailout}`; - } + // output current modules with export prefix + if (currentChunks) { + outputCombination(currentChunks, currentModuleIds, true); } + runtime.push(""); + return Template.asString(runtime); +}; - /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code - */ - generate(module, generateContext) { - const originalSource = module.originalSource(); - if (!originalSource) { - return new RawSource("throw new Error('No source available');"); - } +/** + * @param {Hash} hash the hash to update + * @param {ChunkGraph} chunkGraph chunkGraph + * @param {EntryModuleWithChunkGroup[]} entries entries + * @param {Chunk} chunk chunk + * @returns {void} + */ +exports.updateHashForEntryStartup = (hash, chunkGraph, entries, chunk) => { + for (const [module, entrypoint] of entries) { + const runtimeChunk = entrypoint.getRuntimeChunk(); + const moduleId = chunkGraph.getModuleId(module); + hash.update(`${moduleId}`); + for (const c of getAllChunks(entrypoint, chunk, runtimeChunk)) + hash.update(`${c.id}`); + } +}; - const source = new ReplaceSource(originalSource); - const initFragments = []; +/** + * @param {Chunk} chunk the chunk + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {function(Chunk, ChunkGraph): boolean} filterFn filter function + * @returns {Set} initially fulfilled chunk ids + */ +exports.getInitialChunkIds = (chunk, chunkGraph, filterFn) => { + const initialChunkIds = new Set(chunk.ids); + for (const c of chunk.getAllInitialChunks()) { + if (c === chunk || filterFn(c, chunkGraph)) continue; + for (const id of c.ids) initialChunkIds.add(id); + } + return initialChunkIds; +}; - this.sourceModule(module, initFragments, source, generateContext); - return InitFragment.addToSource(source, initFragments, generateContext); - } +/***/ }), - /** - * @param {Module} module the module to generate - * @param {InitFragment[]} initFragments mutable list of init fragments - * @param {ReplaceSource} source the current replace source which can be modified - * @param {GenerateContext} generateContext the generateContext - * @returns {void} - */ - sourceModule(module, initFragments, source, generateContext) { - for (const dependency of module.dependencies) { - this.sourceDependency( - module, - dependency, - initFragments, - source, - generateContext - ); - } +/***/ 90490: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (module.presentationalDependencies !== undefined) { - for (const dependency of module.presentationalDependencies) { - this.sourceDependency( - module, - dependency, - initFragments, - source, - generateContext - ); - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - for (const childBlock of module.blocks) { - this.sourceBlock( - module, - childBlock, - initFragments, - source, - generateContext - ); - } - } - /** - * @param {Module} module the module to generate - * @param {DependenciesBlock} block the dependencies block which will be processed - * @param {InitFragment[]} initFragments mutable list of init fragments - * @param {ReplaceSource} source the current replace source which can be modified - * @param {GenerateContext} generateContext the generateContext - * @returns {void} - */ - sourceBlock(module, block, initFragments, source, generateContext) { - for (const dependency of block.dependencies) { - this.sourceDependency( - module, - dependency, - initFragments, - source, - generateContext - ); - } - for (const childBlock of block.blocks) { - this.sourceBlock( - module, - childBlock, - initFragments, - source, - generateContext - ); +const { register } = __webpack_require__(8282); + +class JsonData { + constructor(data) { + this._buffer = undefined; + this._data = undefined; + if (Buffer.isBuffer(data)) { + this._buffer = data; + } else { + this._data = data; } } - /** - * @param {Module} module the current module - * @param {Dependency} dependency the dependency to generate - * @param {InitFragment[]} initFragments mutable list of init fragments - * @param {ReplaceSource} source the current replace source which can be modified - * @param {GenerateContext} generateContext the render context - * @returns {void} - */ - sourceDependency(module, dependency, initFragments, source, generateContext) { - const constructor = /** @type {new (...args: any[]) => Dependency} */ ( - dependency.constructor - ); - const template = generateContext.dependencyTemplates.get(constructor); - if (!template) { - throw new Error( - "No template for dependency: " + dependency.constructor.name - ); + get() { + if (this._data === undefined && this._buffer !== undefined) { + this._data = JSON.parse(this._buffer.toString()); } + return this._data; + } +} - const templateContext = { - runtimeTemplate: generateContext.runtimeTemplate, - dependencyTemplates: generateContext.dependencyTemplates, - moduleGraph: generateContext.moduleGraph, - chunkGraph: generateContext.chunkGraph, - module, - runtime: generateContext.runtime, - runtimeRequirements: generateContext.runtimeRequirements, - concatenationScope: generateContext.concatenationScope, - codeGenerationResults: generateContext.codeGenerationResults, - initFragments - }; - - template.apply(dependency, source, templateContext); - - // TODO remove in webpack 6 - if ("getInitFragments" in template) { - const fragments = deprecatedGetInitFragments( - template, - dependency, - templateContext - ); - - if (fragments) { - for (const fragment of fragments) { - initFragments.push(fragment); - } - } +register(JsonData, "webpack/lib/json/JsonData", null, { + serialize(obj, { write }) { + if (obj._buffer === undefined && obj._data !== undefined) { + obj._buffer = Buffer.from(JSON.stringify(obj._data)); } + write(obj._buffer); + }, + deserialize({ read }) { + return new JsonData(read()); } -} +}); -module.exports = JavascriptGenerator; +module.exports = JsonData; /***/ }), -/***/ 89464: +/***/ 70393: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -97020,190 +95257,221 @@ module.exports = JavascriptGenerator; -const { SyncWaterfallHook, SyncHook, SyncBailHook } = __webpack_require__(41242); -const vm = __webpack_require__(26144); -const { - ConcatSource, - OriginalSource, - PrefixSource, - RawSource, - CachedSource -} = __webpack_require__(51255); -const Compilation = __webpack_require__(85720); -const { tryRunOrWebpackError } = __webpack_require__(11351); -const HotUpdateChunk = __webpack_require__(9597); -const InitFragment = __webpack_require__(55870); +const { RawSource } = __webpack_require__(51255); +const ConcatenationScope = __webpack_require__(98229); +const { UsageState } = __webpack_require__(63686); +const Generator = __webpack_require__(93401); const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const { last, someInIterable } = __webpack_require__(39104); -const StringXor = __webpack_require__(40293); -const { compareModulesByIdentifier } = __webpack_require__(29579); -const createHash = __webpack_require__(49835); -const nonNumericOnlyHash = __webpack_require__(55668); -const { intersectRuntime } = __webpack_require__(17156); -const JavascriptGenerator = __webpack_require__(77106); -const JavascriptParser = __webpack_require__(29050); /** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../CodeGenerationResults")} CodeGenerationResults */ -/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("../util/Hash")} Hash */ - -/** - * @param {Chunk} chunk a chunk - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {boolean} true, when a JS file is needed for this chunk - */ -const chunkHasJs = (chunk, chunkGraph) => { - if (chunkGraph.getNumberOfEntryModules(chunk) > 0) return true; +/** @typedef {import("../ExportsInfo")} ExportsInfo */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - return chunkGraph.getChunkModulesIterableBySourceType(chunk, "javascript") - ? true - : false; -}; +const stringifySafe = data => { + const stringified = JSON.stringify(data); + if (!stringified) { + return undefined; // Invalid JSON + } -const printGeneratedCodeForStack = (module, code) => { - const lines = code.split("\n"); - const n = `${lines.length}`.length; - return `\n\nGenerated code for ${module.identifier()}\n${lines - .map((line, i, lines) => { - const iStr = `${i + 1}`; - return `${" ".repeat(n - iStr.length)}${iStr} | ${line}`; - }) - .join("\n")}`; + return stringified.replace(/\u2028|\u2029/g, str => + str === "\u2029" ? "\\u2029" : "\\u2028" + ); // invalid in JavaScript but valid JSON }; /** - * @typedef {Object} RenderContext - * @property {Chunk} chunk the chunk - * @property {DependencyTemplates} dependencyTemplates the dependency templates - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {CodeGenerationResults} codeGenerationResults results of code generation - * @property {boolean} strictMode rendering in strict context + * @param {Object} data data (always an object or array) + * @param {ExportsInfo} exportsInfo exports info + * @param {RuntimeSpec} runtime the runtime + * @returns {Object} reduced data */ +const createObjectForExportsInfo = (data, exportsInfo, runtime) => { + if (exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused) + return data; + const isArray = Array.isArray(data); + const reducedData = isArray ? [] : {}; + for (const key of Object.keys(data)) { + const exportInfo = exportsInfo.getReadOnlyExportInfo(key); + const used = exportInfo.getUsed(runtime); + if (used === UsageState.Unused) continue; -/** - * @typedef {Object} MainRenderContext - * @property {Chunk} chunk the chunk - * @property {DependencyTemplates} dependencyTemplates the dependency templates - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {CodeGenerationResults} codeGenerationResults results of code generation - * @property {string} hash hash to be used for render call - * @property {boolean} strictMode rendering in strict context - */ + let value; + if (used === UsageState.OnlyPropertiesUsed && exportInfo.exportsInfo) { + value = createObjectForExportsInfo( + data[key], + exportInfo.exportsInfo, + runtime + ); + } else { + value = data[key]; + } + const name = exportInfo.getUsedName(key, runtime); + reducedData[name] = value; + } + if (isArray) { + let arrayLengthWhenUsed = + exportsInfo.getReadOnlyExportInfo("length").getUsed(runtime) !== + UsageState.Unused + ? data.length + : undefined; -/** - * @typedef {Object} ChunkRenderContext - * @property {Chunk} chunk the chunk - * @property {DependencyTemplates} dependencyTemplates the dependency templates - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {CodeGenerationResults} codeGenerationResults results of code generation - * @property {InitFragment[]} chunkInitFragments init fragments for the chunk - * @property {boolean} strictMode rendering in strict context - */ + let sizeObjectMinusArray = 0; + for (let i = 0; i < reducedData.length; i++) { + if (reducedData[i] === undefined) { + sizeObjectMinusArray -= 2; + } else { + sizeObjectMinusArray += `${i}`.length + 3; + } + } + if (arrayLengthWhenUsed !== undefined) { + sizeObjectMinusArray += + `${arrayLengthWhenUsed}`.length + + 8 - + (arrayLengthWhenUsed - reducedData.length) * 2; + } + if (sizeObjectMinusArray < 0) + return Object.assign( + arrayLengthWhenUsed === undefined + ? {} + : { length: arrayLengthWhenUsed }, + reducedData + ); + const generatedLength = + arrayLengthWhenUsed !== undefined + ? Math.max(arrayLengthWhenUsed, reducedData.length) + : reducedData.length; + for (let i = 0; i < generatedLength; i++) { + if (reducedData[i] === undefined) { + reducedData[i] = 0; + } + } + } + return reducedData; +}; -/** - * @typedef {Object} RenderBootstrapContext - * @property {Chunk} chunk the chunk - * @property {CodeGenerationResults} codeGenerationResults results of code generation - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {string} hash hash to be used for render call - */ +const TYPES = new Set(["javascript"]); -/** @typedef {RenderContext & { inlined: boolean }} StartupRenderContext */ +class JsonGenerator extends Generator { + /** + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) + */ + getTypes(module) { + return TYPES; + } -/** - * @typedef {Object} CompilationHooks - * @property {SyncWaterfallHook<[Source, Module, ChunkRenderContext]>} renderModuleContent - * @property {SyncWaterfallHook<[Source, Module, ChunkRenderContext]>} renderModuleContainer - * @property {SyncWaterfallHook<[Source, Module, ChunkRenderContext]>} renderModulePackage - * @property {SyncWaterfallHook<[Source, RenderContext]>} renderChunk - * @property {SyncWaterfallHook<[Source, RenderContext]>} renderMain - * @property {SyncWaterfallHook<[Source, RenderContext]>} renderContent - * @property {SyncWaterfallHook<[Source, RenderContext]>} render - * @property {SyncWaterfallHook<[Source, Module, StartupRenderContext]>} renderStartup - * @property {SyncWaterfallHook<[string, RenderBootstrapContext]>} renderRequire - * @property {SyncBailHook<[Module, RenderBootstrapContext], string>} inlineInRuntimeBailout - * @property {SyncBailHook<[Module, RenderContext], string>} embedInRuntimeBailout - * @property {SyncBailHook<[RenderContext], string>} strictRuntimeBailout - * @property {SyncHook<[Chunk, Hash, ChunkHashContext]>} chunkHash - * @property {SyncBailHook<[Chunk, RenderContext], boolean>} useSourceMap - */ + /** + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module + */ + getSize(module, type) { + let data = + module.buildInfo && + module.buildInfo.jsonData && + module.buildInfo.jsonData.get(); + if (!data) return 0; + return stringifySafe(data).length + 10; + } -/** @type {WeakMap} */ -const compilationHooksMap = new WeakMap(); + /** + * @param {NormalModule} module module for which the bailout reason should be determined + * @param {ConcatenationBailoutReasonContext} context context + * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated + */ + getConcatenationBailoutReason(module, context) { + return undefined; + } -class JavascriptModulesPlugin { /** - * @param {Compilation} compilation the compilation - * @returns {CompilationHooks} the attached hooks + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code */ - static getCompilationHooks(compilation) { - if (!(compilation instanceof Compilation)) { - throw new TypeError( - "The 'compilation' argument must be an instance of Compilation" + generate( + module, + { + moduleGraph, + runtimeTemplate, + runtimeRequirements, + runtime, + concatenationScope + } + ) { + const data = + module.buildInfo && + module.buildInfo.jsonData && + module.buildInfo.jsonData.get(); + if (data === undefined) { + return new RawSource( + runtimeTemplate.missingModuleStatement({ + request: module.rawRequest + }) ); } - let hooks = compilationHooksMap.get(compilation); - if (hooks === undefined) { - hooks = { - renderModuleContent: new SyncWaterfallHook([ - "source", - "module", - "renderContext" - ]), - renderModuleContainer: new SyncWaterfallHook([ - "source", - "module", - "renderContext" - ]), - renderModulePackage: new SyncWaterfallHook([ - "source", - "module", - "renderContext" - ]), - render: new SyncWaterfallHook(["source", "renderContext"]), - renderContent: new SyncWaterfallHook(["source", "renderContext"]), - renderStartup: new SyncWaterfallHook([ - "source", - "module", - "startupRenderContext" - ]), - renderChunk: new SyncWaterfallHook(["source", "renderContext"]), - renderMain: new SyncWaterfallHook(["source", "renderContext"]), - renderRequire: new SyncWaterfallHook(["code", "renderContext"]), - inlineInRuntimeBailout: new SyncBailHook(["module", "renderContext"]), - embedInRuntimeBailout: new SyncBailHook(["module", "renderContext"]), - strictRuntimeBailout: new SyncBailHook(["renderContext"]), - chunkHash: new SyncHook(["chunk", "hash", "context"]), - useSourceMap: new SyncBailHook(["chunk", "renderContext"]) - }; - compilationHooksMap.set(compilation, hooks); + const exportsInfo = moduleGraph.getExportsInfo(module); + let finalJson = + typeof data === "object" && + data && + exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused + ? createObjectForExportsInfo(data, exportsInfo, runtime) + : data; + // Use JSON because JSON.parse() is much faster than JavaScript evaluation + const jsonStr = stringifySafe(finalJson); + const jsonExpr = + jsonStr.length > 20 && typeof finalJson === "object" + ? `JSON.parse('${jsonStr.replace(/[\\']/g, "\\$&")}')` + : jsonStr; + let content; + if (concatenationScope) { + content = `${runtimeTemplate.supportsConst() ? "const" : "var"} ${ + ConcatenationScope.NAMESPACE_OBJECT_EXPORT + } = ${jsonExpr};`; + concatenationScope.registerNamespaceExport( + ConcatenationScope.NAMESPACE_OBJECT_EXPORT + ); + } else { + runtimeRequirements.add(RuntimeGlobals.module); + content = `${module.moduleArgument}.exports = ${jsonExpr};`; } - return hooks; + return new RawSource(content); } +} - constructor(options = {}) { - this.options = options; - /** @type {WeakMap} */ - this._moduleFactoryCache = new WeakMap(); +module.exports = JsonGenerator; + + +/***/ }), + +/***/ 86770: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const createSchemaValidation = __webpack_require__(32540); +const JsonGenerator = __webpack_require__(70393); +const JsonParser = __webpack_require__(41090); + +/** @typedef {import("../Compiler")} Compiler */ + +const validate = createSchemaValidation( + __webpack_require__(54094), + () => __webpack_require__(50166), + { + name: "Json Modules Plugin", + baseDataPath: "parser" } +); +class JsonModulesPlugin { /** * Apply the plugin * @param {Compiler} compiler the compiler instance @@ -97211,1183 +95479,954 @@ class JavascriptModulesPlugin { */ apply(compiler) { compiler.hooks.compilation.tap( - "JavascriptModulesPlugin", + "JsonModulesPlugin", (compilation, { normalModuleFactory }) => { - const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); - normalModuleFactory.hooks.createParser - .for("javascript/auto") - .tap("JavascriptModulesPlugin", options => { - return new JavascriptParser("auto"); - }); normalModuleFactory.hooks.createParser - .for("javascript/dynamic") - .tap("JavascriptModulesPlugin", options => { - return new JavascriptParser("script"); - }); - normalModuleFactory.hooks.createParser - .for("javascript/esm") - .tap("JavascriptModulesPlugin", options => { - return new JavascriptParser("module"); - }); - normalModuleFactory.hooks.createGenerator - .for("javascript/auto") - .tap("JavascriptModulesPlugin", () => { - return new JavascriptGenerator(); - }); - normalModuleFactory.hooks.createGenerator - .for("javascript/dynamic") - .tap("JavascriptModulesPlugin", () => { - return new JavascriptGenerator(); + .for("json") + .tap("JsonModulesPlugin", parserOptions => { + validate(parserOptions); + + return new JsonParser(parserOptions); }); normalModuleFactory.hooks.createGenerator - .for("javascript/esm") - .tap("JavascriptModulesPlugin", () => { - return new JavascriptGenerator(); + .for("json") + .tap("JsonModulesPlugin", () => { + return new JsonGenerator(); }); - compilation.hooks.renderManifest.tap( - "JavascriptModulesPlugin", - (result, options) => { - const { - hash, - chunk, - chunkGraph, - moduleGraph, - runtimeTemplate, - dependencyTemplates, - outputOptions, - codeGenerationResults - } = options; + } + ); + } +} - const hotUpdateChunk = - chunk instanceof HotUpdateChunk ? chunk : null; +module.exports = JsonModulesPlugin; - let render; - const filenameTemplate = - JavascriptModulesPlugin.getChunkFilenameTemplate( - chunk, - outputOptions - ); - if (hotUpdateChunk) { - render = () => - this.renderChunk( - { - chunk, - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - codeGenerationResults, - strictMode: runtimeTemplate.isModule() - }, - hooks - ); - } else if (chunk.hasRuntime()) { - render = () => - this.renderMain( - { - hash, - chunk, - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - codeGenerationResults, - strictMode: runtimeTemplate.isModule() - }, - hooks, - compilation - ); - } else { - if (!chunkHasJs(chunk, chunkGraph)) { - return result; - } - render = () => - this.renderChunk( - { - chunk, - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - codeGenerationResults, - strictMode: runtimeTemplate.isModule() - }, - hooks - ); - } +/***/ }), - result.push({ - render, - filenameTemplate, - pathOptions: { - hash, - runtime: chunk.runtime, - chunk, - contentHashType: "javascript" - }, - info: { - javascriptModule: compilation.runtimeTemplate.isModule() - }, - identifier: hotUpdateChunk - ? `hotupdatechunk${chunk.id}` - : `chunk${chunk.id}`, - hash: chunk.contentHash.javascript - }); +/***/ 41090: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - return result; - } - ); - compilation.hooks.chunkHash.tap( - "JavascriptModulesPlugin", - (chunk, hash, context) => { - hooks.chunkHash.call(chunk, hash, context); - if (chunk.hasRuntime()) { - this.updateHashWithBootstrap( - hash, - { - hash: "0000", - chunk, - codeGenerationResults: context.codeGenerationResults, - chunkGraph: context.chunkGraph, - moduleGraph: context.moduleGraph, - runtimeTemplate: context.runtimeTemplate - }, - hooks - ); - } - } - ); - compilation.hooks.contentHash.tap("JavascriptModulesPlugin", chunk => { - const { - chunkGraph, - codeGenerationResults, - moduleGraph, - runtimeTemplate, - outputOptions: { - hashSalt, - hashDigest, - hashDigestLength, - hashFunction - } - } = compilation; - const hash = createHash(hashFunction); - if (hashSalt) hash.update(hashSalt); - if (chunk.hasRuntime()) { - this.updateHashWithBootstrap( - hash, - { - hash: "0000", - chunk, - codeGenerationResults, - chunkGraph: compilation.chunkGraph, - moduleGraph: compilation.moduleGraph, - runtimeTemplate: compilation.runtimeTemplate - }, - hooks - ); - } else { - hash.update(`${chunk.id} `); - hash.update(chunk.ids ? chunk.ids.join(",") : ""); - } - hooks.chunkHash.call(chunk, hash, { - chunkGraph, - codeGenerationResults, - moduleGraph, - runtimeTemplate - }); - const modules = chunkGraph.getChunkModulesIterableBySourceType( - chunk, - "javascript" - ); - if (modules) { - const xor = new StringXor(); - for (const m of modules) { - xor.add(chunkGraph.getModuleHash(m, chunk.runtime)); - } - xor.updateHash(hash); - } - const runtimeModules = chunkGraph.getChunkModulesIterableBySourceType( - chunk, - "runtime" - ); - if (runtimeModules) { - const xor = new StringXor(); - for (const m of runtimeModules) { - xor.add(chunkGraph.getModuleHash(m, chunk.runtime)); - } - xor.updateHash(hash); - } - const digest = /** @type {string} */ (hash.digest(hashDigest)); - chunk.contentHash.javascript = nonNumericOnlyHash( - digest, - hashDigestLength - ); - }); - compilation.hooks.additionalTreeRuntimeRequirements.tap( - "JavascriptModulesPlugin", - (chunk, set, { chunkGraph }) => { - if ( - !set.has(RuntimeGlobals.startupNoDefault) && - chunkGraph.hasChunkEntryDependentChunks(chunk) - ) { - set.add(RuntimeGlobals.onChunksLoaded); - set.add(RuntimeGlobals.require); - } - } - ); - compilation.hooks.executeModule.tap( - "JavascriptModulesPlugin", - (options, context) => { - const source = - options.codeGenerationResult.sources.get("javascript"); - if (source === undefined) return; - const { module, moduleObject } = options; - const code = source.source(); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - const fn = vm.runInThisContext( - `(function(${module.moduleArgument}, ${module.exportsArgument}, __webpack_require__) {\n${code}\n/**/})`, - { - filename: module.identifier(), - lineOffset: -1 - } - ); - try { - fn.call( - moduleObject.exports, - moduleObject, - moduleObject.exports, - context.__webpack_require__ - ); - } catch (e) { - e.stack += printGeneratedCodeForStack(options.module, code); - throw e; - } - } - ); - compilation.hooks.executeModule.tap( - "JavascriptModulesPlugin", - (options, context) => { - const source = options.codeGenerationResult.sources.get("runtime"); - if (source === undefined) return; - let code = source.source(); - if (typeof code !== "string") code = code.toString(); - const fn = vm.runInThisContext( - `(function(__webpack_require__) {\n${code}\n/**/})`, - { - filename: options.module.identifier(), - lineOffset: -1 - } - ); - try { - fn.call(null, context.__webpack_require__); - } catch (e) { - e.stack += printGeneratedCodeForStack(options.module, code); - throw e; - } - } - ); - } - ); + +const parseJson = __webpack_require__(15235); +const Parser = __webpack_require__(11715); +const JsonExportsDependency = __webpack_require__(750); +const JsonData = __webpack_require__(90490); + +/** @typedef {import("../../declarations/plugins/JsonModulesPluginParser").JsonModulesPluginParserOptions} JsonModulesPluginParserOptions */ +/** @typedef {import("../Parser").ParserState} ParserState */ +/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ + +class JsonParser extends Parser { + /** + * @param {JsonModulesPluginParserOptions} options parser options + */ + constructor(options) { + super(); + this.options = options || {}; } - static getChunkFilenameTemplate(chunk, outputOptions) { - if (chunk.filenameTemplate) { - return chunk.filenameTemplate; - } else if (chunk instanceof HotUpdateChunk) { - return outputOptions.hotUpdateChunkFilename; - } else if (chunk.canBeInitial()) { - return outputOptions.filename; - } else { - return outputOptions.chunkFilename; + /** + * @param {string | Buffer | PreparsedAst} source the source to parse + * @param {ParserState} state the parser state + * @returns {ParserState} the parser state + */ + parse(source, state) { + if (Buffer.isBuffer(source)) { + source = source.toString("utf-8"); } + + /** @type {JsonModulesPluginParserOptions["parse"]} */ + const parseFn = + typeof this.options.parse === "function" ? this.options.parse : parseJson; + + const data = + typeof source === "object" + ? source + : parseFn(source[0] === "\ufeff" ? source.slice(1) : source); + + state.module.buildInfo.jsonData = new JsonData(data); + state.module.buildInfo.strict = true; + state.module.buildMeta.exportsType = "default"; + state.module.buildMeta.defaultObject = + typeof data === "object" ? "redirect-warn" : false; + state.module.addDependency( + new JsonExportsDependency(JsonExportsDependency.getExportsFromData(data)) + ); + return state; } +} + +module.exports = JsonParser; + + +/***/ }), + +/***/ 26030: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const JavascriptModulesPlugin = __webpack_require__(89464); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */ +/** @typedef {import("../util/Hash")} Hash */ + +const COMMON_LIBRARY_NAME_MESSAGE = + "Common configuration options that specific library names are 'output.library[.name]', 'entry.xyz.library[.name]', 'ModuleFederationPlugin.name' and 'ModuleFederationPlugin.library[.name]'."; + +/** + * @template T + * @typedef {Object} LibraryContext + * @property {Compilation} compilation + * @property {ChunkGraph} chunkGraph + * @property {T} options + */ +/** + * @template T + */ +class AbstractLibraryPlugin { /** - * @param {Module} module the rendered module - * @param {ChunkRenderContext} renderContext options object - * @param {CompilationHooks} hooks hooks - * @param {boolean} factory true: renders as factory method, false: pure module content - * @returns {Source} the newly generated source from rendering + * @param {Object} options options + * @param {string} options.pluginName name of the plugin + * @param {LibraryType} options.type used library type */ - renderModule(module, renderContext, hooks, factory) { - const { - chunk, - chunkGraph, - runtimeTemplate, - codeGenerationResults, - strictMode - } = renderContext; - try { - const codeGenResult = codeGenerationResults.get(module, chunk.runtime); - const moduleSource = codeGenResult.sources.get("javascript"); - if (!moduleSource) return null; - if (codeGenResult.data !== undefined) { - const chunkInitFragments = codeGenResult.data.get("chunkInitFragments"); - if (chunkInitFragments) { - for (const i of chunkInitFragments) - renderContext.chunkInitFragments.push(i); - } - } - const moduleSourcePostContent = tryRunOrWebpackError( - () => - hooks.renderModuleContent.call(moduleSource, module, renderContext), - "JavascriptModulesPlugin.getCompilationHooks().renderModuleContent" + constructor({ pluginName, type }) { + this._pluginName = pluginName; + this._type = type; + this._parseCache = new WeakMap(); + } + + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const { _pluginName } = this; + compiler.hooks.thisCompilation.tap(_pluginName, compilation => { + compilation.hooks.finishModules.tap( + { name: _pluginName, stage: 10 }, + () => { + for (const [ + name, + { + dependencies: deps, + options: { library } + } + ] of compilation.entries) { + const options = this._parseOptionsCached( + library !== undefined + ? library + : compilation.outputOptions.library + ); + if (options !== false) { + const dep = deps[deps.length - 1]; + if (dep) { + const module = compilation.moduleGraph.getModule(dep); + if (module) { + this.finishEntryModule(module, name, { + options, + compilation, + chunkGraph: compilation.chunkGraph + }); + } + } + } + } + } ); - let moduleSourcePostContainer; - if (factory) { - const runtimeRequirements = chunkGraph.getModuleRuntimeRequirements( - module, - chunk.runtime - ); - const needModule = runtimeRequirements.has(RuntimeGlobals.module); - const needExports = runtimeRequirements.has(RuntimeGlobals.exports); - const needRequire = - runtimeRequirements.has(RuntimeGlobals.require) || - runtimeRequirements.has(RuntimeGlobals.requireScope); - const needThisAsExports = runtimeRequirements.has( - RuntimeGlobals.thisAsExports - ); - const needStrict = module.buildInfo.strict && !strictMode; - const cacheEntry = this._moduleFactoryCache.get( - moduleSourcePostContent + + const getOptionsForChunk = chunk => { + if (compilation.chunkGraph.getNumberOfEntryModules(chunk) === 0) + return false; + const options = chunk.getEntryOptions(); + const library = options && options.library; + return this._parseOptionsCached( + library !== undefined ? library : compilation.outputOptions.library ); - let source; - if ( - cacheEntry && - cacheEntry.needModule === needModule && - cacheEntry.needExports === needExports && - cacheEntry.needRequire === needRequire && - cacheEntry.needThisAsExports === needThisAsExports && - cacheEntry.needStrict === needStrict - ) { - source = cacheEntry.source; - } else { - const factorySource = new ConcatSource(); - const args = []; - if (needExports || needRequire || needModule) - args.push( - needModule - ? module.moduleArgument - : "__unused_webpack_" + module.moduleArgument - ); - if (needExports || needRequire) - args.push( - needExports - ? module.exportsArgument - : "__unused_webpack_" + module.exportsArgument - ); - if (needRequire) args.push("__webpack_require__"); - if (!needThisAsExports && runtimeTemplate.supportsArrowFunction()) { - factorySource.add("/***/ ((" + args.join(", ") + ") => {\n\n"); - } else { - factorySource.add("/***/ (function(" + args.join(", ") + ") {\n\n"); + }; + + if ( + this.render !== AbstractLibraryPlugin.prototype.render || + this.runtimeRequirements !== + AbstractLibraryPlugin.prototype.runtimeRequirements + ) { + compilation.hooks.additionalChunkRuntimeRequirements.tap( + _pluginName, + (chunk, set, { chunkGraph }) => { + const options = getOptionsForChunk(chunk); + if (options !== false) { + this.runtimeRequirements(chunk, set, { + options, + compilation, + chunkGraph + }); + } } - if (needStrict) { - factorySource.add('"use strict";\n'); + ); + } + + const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); + + if (this.render !== AbstractLibraryPlugin.prototype.render) { + hooks.render.tap(_pluginName, (source, renderContext) => { + const options = getOptionsForChunk(renderContext.chunk); + if (options === false) return source; + return this.render(source, renderContext, { + options, + compilation, + chunkGraph: compilation.chunkGraph + }); + }); + } + + if ( + this.embedInRuntimeBailout !== + AbstractLibraryPlugin.prototype.embedInRuntimeBailout + ) { + hooks.embedInRuntimeBailout.tap( + _pluginName, + (module, renderContext) => { + const options = getOptionsForChunk(renderContext.chunk); + if (options === false) return; + return this.embedInRuntimeBailout(module, renderContext, { + options, + compilation, + chunkGraph: compilation.chunkGraph + }); } - factorySource.add(moduleSourcePostContent); - factorySource.add("\n\n/***/ })"); - source = new CachedSource(factorySource); - this._moduleFactoryCache.set(moduleSourcePostContent, { - source, - needModule, - needExports, - needRequire, - needThisAsExports, - needStrict + ); + } + + if ( + this.strictRuntimeBailout !== + AbstractLibraryPlugin.prototype.strictRuntimeBailout + ) { + hooks.strictRuntimeBailout.tap(_pluginName, renderContext => { + const options = getOptionsForChunk(renderContext.chunk); + if (options === false) return; + return this.strictRuntimeBailout(renderContext, { + options, + compilation, + chunkGraph: compilation.chunkGraph }); - } - moduleSourcePostContainer = tryRunOrWebpackError( - () => hooks.renderModuleContainer.call(source, module, renderContext), - "JavascriptModulesPlugin.getCompilationHooks().renderModuleContainer" + }); + } + + if ( + this.renderStartup !== AbstractLibraryPlugin.prototype.renderStartup + ) { + hooks.renderStartup.tap( + _pluginName, + (source, module, renderContext) => { + const options = getOptionsForChunk(renderContext.chunk); + if (options === false) return source; + return this.renderStartup(source, module, renderContext, { + options, + compilation, + chunkGraph: compilation.chunkGraph + }); + } ); - } else { - moduleSourcePostContainer = moduleSourcePostContent; } - return tryRunOrWebpackError( - () => - hooks.renderModulePackage.call( - moduleSourcePostContainer, - module, - renderContext - ), - "JavascriptModulesPlugin.getCompilationHooks().renderModulePackage" - ); - } catch (e) { - e.module = module; - throw e; - } + + hooks.chunkHash.tap(_pluginName, (chunk, hash, context) => { + const options = getOptionsForChunk(chunk); + if (options === false) return; + this.chunkHash(chunk, hash, context, { + options, + compilation, + chunkGraph: compilation.chunkGraph + }); + }); + }); } /** - * @param {RenderContext} renderContext the render context - * @param {CompilationHooks} hooks hooks - * @returns {Source} the rendered source + * @param {LibraryOptions=} library normalized library option + * @returns {T | false} preprocess as needed by overriding */ - renderChunk(renderContext, hooks) { - const { chunk, chunkGraph } = renderContext; - const modules = chunkGraph.getOrderedChunkModulesIterableBySourceType( - chunk, - "javascript", - compareModulesByIdentifier - ); - const allModules = modules ? Array.from(modules) : []; - let strictHeader; - let allStrict = renderContext.strictMode; - if (!allStrict && allModules.every(m => m.buildInfo.strict)) { - const strictBailout = hooks.strictRuntimeBailout.call(renderContext); - strictHeader = strictBailout - ? `// runtime can't be in strict mode because ${strictBailout}.\n` - : '"use strict";\n'; - if (!strictBailout) allStrict = true; - } - /** @type {ChunkRenderContext} */ - const chunkRenderContext = { - ...renderContext, - chunkInitFragments: [], - strictMode: allStrict - }; - const moduleSources = - Template.renderChunkModules(chunkRenderContext, allModules, module => - this.renderModule(module, chunkRenderContext, hooks, true) - ) || new RawSource("{}"); - let source = tryRunOrWebpackError( - () => hooks.renderChunk.call(moduleSources, chunkRenderContext), - "JavascriptModulesPlugin.getCompilationHooks().renderChunk" - ); - source = tryRunOrWebpackError( - () => hooks.renderContent.call(source, chunkRenderContext), - "JavascriptModulesPlugin.getCompilationHooks().renderContent" - ); - if (!source) { - throw new Error( - "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().renderContent plugins should return something" - ); - } - source = InitFragment.addToSource( - source, - chunkRenderContext.chunkInitFragments, - chunkRenderContext - ); - source = tryRunOrWebpackError( - () => hooks.render.call(source, chunkRenderContext), - "JavascriptModulesPlugin.getCompilationHooks().render" - ); - if (!source) { - throw new Error( - "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().render plugins should return something" - ); - } - chunk.rendered = true; - return strictHeader - ? new ConcatSource(strictHeader, source, ";") - : renderContext.runtimeTemplate.isModule() - ? source - : new ConcatSource(source, ";"); + _parseOptionsCached(library) { + if (!library) return false; + if (library.type !== this._type) return false; + const cacheEntry = this._parseCache.get(library); + if (cacheEntry !== undefined) return cacheEntry; + const result = this.parseOptions(library); + this._parseCache.set(library, result); + return result; } + /* istanbul ignore next */ /** - * @param {MainRenderContext} renderContext options object - * @param {CompilationHooks} hooks hooks - * @param {Compilation} compilation the compilation - * @returns {Source} the newly generated source from rendering + * @abstract + * @param {LibraryOptions} library normalized library option + * @returns {T | false} preprocess as needed by overriding */ - renderMain(renderContext, hooks, compilation) { - const { chunk, chunkGraph, runtimeTemplate } = renderContext; + parseOptions(library) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); + } - const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk); - const iife = runtimeTemplate.isIIFE(); + /** + * @param {Module} module the exporting entry module + * @param {string} entryName the name of the entrypoint + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + finishEntryModule(module, entryName, libraryContext) {} - const bootstrap = this.renderBootstrap(renderContext, hooks); - const useSourceMap = hooks.useSourceMap.call(chunk, renderContext); + /** + * @param {Module} module the exporting entry module + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {string | undefined} bailout reason + */ + embedInRuntimeBailout(module, renderContext, libraryContext) { + return undefined; + } - const allModules = Array.from( - chunkGraph.getOrderedChunkModulesIterableBySourceType( - chunk, - "javascript", - compareModulesByIdentifier - ) || [] + /** + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {string | undefined} bailout reason + */ + strictRuntimeBailout(renderContext, libraryContext) { + return undefined; + } + + /** + * @param {Chunk} chunk the chunk + * @param {Set} set runtime requirements + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + runtimeRequirements(chunk, set, libraryContext) { + if (this.render !== AbstractLibraryPlugin.prototype.render) + set.add(RuntimeGlobals.returnExportsFromRuntime); + } + + /** + * @param {Source} source source + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + render(source, renderContext, libraryContext) { + return source; + } + + /** + * @param {Source} source source + * @param {Module} module module + * @param {StartupRenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + renderStartup(source, module, renderContext, libraryContext) { + return source; + } + + /** + * @param {Chunk} chunk the chunk + * @param {Hash} hash hash + * @param {ChunkHashContext} chunkHashContext chunk hash context + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + chunkHash(chunk, hash, chunkHashContext, libraryContext) { + const options = this._parseOptionsCached( + libraryContext.compilation.outputOptions.library ); + hash.update(this._pluginName); + hash.update(JSON.stringify(options)); + } +} - const hasEntryModules = chunkGraph.getNumberOfEntryModules(chunk) > 0; - let inlinedModules; - if (bootstrap.allowInlineStartup && hasEntryModules) { - inlinedModules = new Set(chunkGraph.getChunkEntryModulesIterable(chunk)); - } +AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE = COMMON_LIBRARY_NAME_MESSAGE; +module.exports = AbstractLibraryPlugin; - let source = new ConcatSource(); - let prefix; - if (iife) { - if (runtimeTemplate.supportsArrowFunction()) { - source.add("/******/ (() => { // webpackBootstrap\n"); - } else { - source.add("/******/ (function() { // webpackBootstrap\n"); + +/***/ }), + +/***/ 67416: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { ConcatSource } = __webpack_require__(51255); +const ExternalModule = __webpack_require__(73071); +const Template = __webpack_require__(1626); +const AbstractLibraryPlugin = __webpack_require__(26030); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ +/** @typedef {import("../util/Hash")} Hash */ +/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ + +/** + * @typedef {Object} AmdLibraryPluginOptions + * @property {LibraryType} type + * @property {boolean=} requireAsWrapper + */ + +/** + * @typedef {Object} AmdLibraryPluginParsed + * @property {string} name + */ + +/** + * @typedef {AmdLibraryPluginParsed} T + * @extends {AbstractLibraryPlugin} + */ +class AmdLibraryPlugin extends AbstractLibraryPlugin { + /** + * @param {AmdLibraryPluginOptions} options the plugin options + */ + constructor(options) { + super({ + pluginName: "AmdLibraryPlugin", + type: options.type + }); + this.requireAsWrapper = options.requireAsWrapper; + } + + /** + * @param {LibraryOptions} library normalized library option + * @returns {T | false} preprocess as needed by overriding + */ + parseOptions(library) { + const { name } = library; + if (this.requireAsWrapper) { + if (name) { + throw new Error( + `AMD library name must be unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` + ); } - prefix = "/******/ \t"; } else { - prefix = "/******/ "; - } - let allStrict = renderContext.strictMode; - if (!allStrict && allModules.every(m => m.buildInfo.strict)) { - const strictBailout = hooks.strictRuntimeBailout.call(renderContext); - if (strictBailout) { - source.add( - prefix + - `// runtime can't be in strict mode because ${strictBailout}.\n` + if (name && typeof name !== "string") { + throw new Error( + `AMD library name must be a simple string or unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` ); - } else { - allStrict = true; - source.add(prefix + '"use strict";\n'); } } - - /** @type {ChunkRenderContext} */ - const chunkRenderContext = { - ...renderContext, - chunkInitFragments: [], - strictMode: allStrict + return { + name: /** @type {string=} */ (name) }; + } - const chunkModules = Template.renderChunkModules( - chunkRenderContext, - inlinedModules - ? allModules.filter(m => !inlinedModules.has(m)) - : allModules, - module => this.renderModule(module, chunkRenderContext, hooks, true), - prefix - ); - if ( - chunkModules || - runtimeRequirements.has(RuntimeGlobals.moduleFactories) || - runtimeRequirements.has(RuntimeGlobals.moduleFactoriesAddOnly) || - runtimeRequirements.has(RuntimeGlobals.require) - ) { - source.add(prefix + "var __webpack_modules__ = ("); - source.add(chunkModules || "{}"); - source.add(");\n"); - source.add( - "/************************************************************************/\n" - ); - } - - if (bootstrap.header.length > 0) { - const header = Template.asString(bootstrap.header) + "\n"; - source.add( - new PrefixSource( - prefix, - useSourceMap - ? new OriginalSource(header, "webpack/bootstrap") - : new RawSource(header) - ) - ); - source.add( - "/************************************************************************/\n" - ); - } + /** + * @param {Source} source source + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + render( + source, + { chunkGraph, chunk, runtimeTemplate }, + { options, compilation } + ) { + const modern = runtimeTemplate.supportsArrowFunction(); + const modules = chunkGraph + .getChunkModules(chunk) + .filter(m => m instanceof ExternalModule); + const externals = /** @type {ExternalModule[]} */ (modules); + const externalsDepsArray = JSON.stringify( + externals.map(m => + typeof m.request === "object" && !Array.isArray(m.request) + ? m.request.amd + : m.request + ) + ); + const externalsArguments = externals + .map( + m => + `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( + `${chunkGraph.getModuleId(m)}` + )}__` + ) + .join(", "); - const runtimeModules = - renderContext.chunkGraph.getChunkRuntimeModulesInOrder(chunk); + const iife = runtimeTemplate.isIIFE(); + const fnStart = + (modern + ? `(${externalsArguments}) => {` + : `function(${externalsArguments}) {`) + + (iife || !chunk.hasRuntime() ? " return " : "\n"); + const fnEnd = iife ? ";\n}" : "\n}"; - if (runtimeModules.length > 0) { - source.add( - new PrefixSource( - prefix, - Template.renderRuntimeModules(runtimeModules, chunkRenderContext) - ) - ); - source.add( - "/************************************************************************/\n" - ); - // runtimeRuntimeModules calls codeGeneration - for (const module of runtimeModules) { - compilation.codeGeneratedModules.add(module); - } - } - if (inlinedModules) { - if (bootstrap.beforeStartup.length > 0) { - const beforeStartup = Template.asString(bootstrap.beforeStartup) + "\n"; - source.add( - new PrefixSource( - prefix, - useSourceMap - ? new OriginalSource(beforeStartup, "webpack/before-startup") - : new RawSource(beforeStartup) - ) - ); - } - const lastInlinedModule = last(inlinedModules); - const startupSource = new ConcatSource(); - startupSource.add(`var __webpack_exports__ = {};\n`); - for (const m of inlinedModules) { - const renderedModule = this.renderModule( - m, - chunkRenderContext, - hooks, - false - ); - if (renderedModule) { - const innerStrict = !allStrict && m.buildInfo.strict; - const runtimeRequirements = chunkGraph.getModuleRuntimeRequirements( - m, - chunk.runtime - ); - const exports = runtimeRequirements.has(RuntimeGlobals.exports); - const webpackExports = - exports && m.exportsArgument === "__webpack_exports__"; - let iife = innerStrict - ? "it need to be in strict mode." - : inlinedModules.size > 1 - ? // TODO check globals and top-level declarations of other entries and chunk modules - // to make a better decision - "it need to be isolated against other entry modules." - : chunkModules - ? "it need to be isolated against other modules in the chunk." - : exports && !webpackExports - ? `it uses a non-standard name for the exports (${m.exportsArgument}).` - : hooks.embedInRuntimeBailout.call(m, renderContext); - let footer; - if (iife !== undefined) { - startupSource.add( - `// This entry need to be wrapped in an IIFE because ${iife}\n` - ); - const arrow = runtimeTemplate.supportsArrowFunction(); - if (arrow) { - startupSource.add("(() => {\n"); - footer = "\n})();\n\n"; - } else { - startupSource.add("!function() {\n"); - footer = "\n}();\n"; - } - if (innerStrict) startupSource.add('"use strict";\n'); - } else { - footer = "\n"; - } - if (exports) { - if (m !== lastInlinedModule) - startupSource.add(`var ${m.exportsArgument} = {};\n`); - else if (m.exportsArgument !== "__webpack_exports__") - startupSource.add( - `var ${m.exportsArgument} = __webpack_exports__;\n` - ); - } - startupSource.add(renderedModule); - startupSource.add(footer); - } - } - if (runtimeRequirements.has(RuntimeGlobals.onChunksLoaded)) { - startupSource.add( - `__webpack_exports__ = ${RuntimeGlobals.onChunksLoaded}(__webpack_exports__);\n` - ); - } - source.add( - hooks.renderStartup.call(startupSource, lastInlinedModule, { - ...renderContext, - inlined: true - }) - ); - if (bootstrap.afterStartup.length > 0) { - const afterStartup = Template.asString(bootstrap.afterStartup) + "\n"; - source.add( - new PrefixSource( - prefix, - useSourceMap - ? new OriginalSource(afterStartup, "webpack/after-startup") - : new RawSource(afterStartup) - ) - ); - } - } else { - const lastEntryModule = last( - chunkGraph.getChunkEntryModulesIterable(chunk) - ); - const toSource = useSourceMap - ? (content, name) => - new OriginalSource(Template.asString(content), name) - : content => new RawSource(Template.asString(content)); - source.add( - new PrefixSource( - prefix, - new ConcatSource( - toSource(bootstrap.beforeStartup, "webpack/before-startup"), - "\n", - hooks.renderStartup.call( - toSource(bootstrap.startup.concat(""), "webpack/startup"), - lastEntryModule, - { - ...renderContext, - inlined: false - } - ), - toSource(bootstrap.afterStartup, "webpack/after-startup"), - "\n" - ) - ) + if (this.requireAsWrapper) { + return new ConcatSource( + `require(${externalsDepsArray}, ${fnStart}`, + source, + `${fnEnd});` ); - } - if ( - hasEntryModules && - runtimeRequirements.has(RuntimeGlobals.returnExportsFromRuntime) - ) { - source.add(`${prefix}return __webpack_exports__;\n`); - } - if (iife) { - source.add("/******/ })()\n"); - } + } else if (options.name) { + const name = compilation.getPath(options.name, { + chunk + }); - /** @type {Source} */ - let finalSource = tryRunOrWebpackError( - () => hooks.renderMain.call(source, renderContext), - "JavascriptModulesPlugin.getCompilationHooks().renderMain" - ); - if (!finalSource) { - throw new Error( - "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().renderMain plugins should return something" - ); - } - finalSource = tryRunOrWebpackError( - () => hooks.renderContent.call(finalSource, renderContext), - "JavascriptModulesPlugin.getCompilationHooks().renderContent" - ); - if (!finalSource) { - throw new Error( - "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().renderContent plugins should return something" + return new ConcatSource( + `define(${JSON.stringify(name)}, ${externalsDepsArray}, ${fnStart}`, + source, + `${fnEnd});` ); - } - finalSource = InitFragment.addToSource( - finalSource, - chunkRenderContext.chunkInitFragments, - chunkRenderContext - ); - finalSource = tryRunOrWebpackError( - () => hooks.render.call(finalSource, renderContext), - "JavascriptModulesPlugin.getCompilationHooks().render" - ); - if (!finalSource) { - throw new Error( - "JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().render plugins should return something" + } else if (externalsArguments) { + return new ConcatSource( + `define(${externalsDepsArray}, ${fnStart}`, + source, + `${fnEnd});` ); + } else { + return new ConcatSource(`define(${fnStart}`, source, `${fnEnd});`); } - chunk.rendered = true; - return iife ? new ConcatSource(finalSource, ";") : finalSource; } /** - * @param {Hash} hash the hash to be updated - * @param {RenderBootstrapContext} renderContext options object - * @param {CompilationHooks} hooks hooks + * @param {Chunk} chunk the chunk + * @param {Hash} hash hash + * @param {ChunkHashContext} chunkHashContext chunk hash context + * @param {LibraryContext} libraryContext context + * @returns {void} */ - updateHashWithBootstrap(hash, renderContext, hooks) { - const bootstrap = this.renderBootstrap(renderContext, hooks); - for (const key of Object.keys(bootstrap)) { - hash.update(key); - if (Array.isArray(bootstrap[key])) { - for (const line of bootstrap[key]) { - hash.update(line); - } - } else { - hash.update(JSON.stringify(bootstrap[key])); - } + chunkHash(chunk, hash, chunkHashContext, { options, compilation }) { + hash.update("AmdLibraryPlugin"); + if (this.requireAsWrapper) { + hash.update("requireAsWrapper"); + } else if (options.name) { + hash.update("named"); + const name = compilation.getPath(options.name, { + chunk + }); + hash.update(name); } } +} - /** - * @param {RenderBootstrapContext} renderContext options object - * @param {CompilationHooks} hooks hooks - * @returns {{ header: string[], beforeStartup: string[], startup: string[], afterStartup: string[], allowInlineStartup: boolean }} the generated source of the bootstrap code - */ - renderBootstrap(renderContext, hooks) { - const { - chunkGraph, - codeGenerationResults, - moduleGraph, - chunk, - runtimeTemplate - } = renderContext; +module.exports = AmdLibraryPlugin; - const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk); - const requireFunction = runtimeRequirements.has(RuntimeGlobals.require); - const moduleCache = runtimeRequirements.has(RuntimeGlobals.moduleCache); - const moduleFactories = runtimeRequirements.has( - RuntimeGlobals.moduleFactories - ); - const moduleUsed = runtimeRequirements.has(RuntimeGlobals.module); - const requireScopeUsed = runtimeRequirements.has( - RuntimeGlobals.requireScope - ); - const interceptModuleExecution = runtimeRequirements.has( - RuntimeGlobals.interceptModuleExecution - ); +/***/ }), - const useRequire = - requireFunction || interceptModuleExecution || moduleUsed; +/***/ 40080: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const result = { - header: [], - beforeStartup: [], - startup: [], - afterStartup: [], - allowInlineStartup: true - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - let { header: buf, startup, beforeStartup, afterStartup } = result; - if (result.allowInlineStartup && moduleFactories) { - startup.push( - "// module factories are used so entry inlining is disabled" - ); - result.allowInlineStartup = false; - } - if (result.allowInlineStartup && moduleCache) { - startup.push("// module cache are used so entry inlining is disabled"); - result.allowInlineStartup = false; - } - if (result.allowInlineStartup && interceptModuleExecution) { - startup.push( - "// module execution is intercepted so entry inlining is disabled" - ); - result.allowInlineStartup = false; - } - if (useRequire || moduleCache) { - buf.push("// The module cache"); - buf.push("var __webpack_module_cache__ = {};"); - buf.push(""); - } +const { ConcatSource } = __webpack_require__(51255); +const { UsageState } = __webpack_require__(63686); +const Template = __webpack_require__(1626); +const propertyAccess = __webpack_require__(54190); +const { getEntryRuntime } = __webpack_require__(17156); +const AbstractLibraryPlugin = __webpack_require__(26030); - if (useRequire) { - buf.push("// The require function"); - buf.push(`function __webpack_require__(moduleId) {`); - buf.push(Template.indent(this.renderRequire(renderContext, hooks))); - buf.push("}"); - buf.push(""); - } else if (runtimeRequirements.has(RuntimeGlobals.requireScope)) { - buf.push("// The require scope"); - buf.push("var __webpack_require__ = {};"); - buf.push(""); - } +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */ +/** @typedef {import("../util/Hash")} Hash */ +/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ - if ( - moduleFactories || - runtimeRequirements.has(RuntimeGlobals.moduleFactoriesAddOnly) - ) { - buf.push("// expose the modules object (__webpack_modules__)"); - buf.push(`${RuntimeGlobals.moduleFactories} = __webpack_modules__;`); - buf.push(""); - } +const KEYWORD_REGEX = + /^(await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|super|switch|static|this|throw|try|true|typeof|var|void|while|with|yield)$/; +const IDENTIFIER_REGEX = + /^[\p{L}\p{Nl}$_][\p{L}\p{Nl}$\p{Mn}\p{Mc}\p{Nd}\p{Pc}]*$/iu; - if (moduleCache) { - buf.push("// expose the module cache"); - buf.push(`${RuntimeGlobals.moduleCache} = __webpack_module_cache__;`); - buf.push(""); - } +/** + * Validates the library name by checking for keywords and valid characters + * @param {string} name name to be validated + * @returns {boolean} true, when valid + */ +const isNameValid = name => { + return !KEYWORD_REGEX.test(name) && IDENTIFIER_REGEX.test(name); +}; - if (interceptModuleExecution) { - buf.push("// expose the module execution interceptor"); - buf.push(`${RuntimeGlobals.interceptModuleExecution} = [];`); - buf.push(""); - } +/** + * @param {string[]} accessor variable plus properties + * @param {number} existingLength items of accessor that are existing already + * @param {boolean=} initLast if the last property should also be initialized to an object + * @returns {string} code to access the accessor while initializing + */ +const accessWithInit = (accessor, existingLength, initLast = false) => { + // This generates for [a, b, c, d]: + // (((a = typeof a === "undefined" ? {} : a).b = a.b || {}).c = a.b.c || {}).d + const base = accessor[0]; + if (accessor.length === 1 && !initLast) return base; + let current = + existingLength > 0 + ? base + : `(${base} = typeof ${base} === "undefined" ? {} : ${base})`; - if (!runtimeRequirements.has(RuntimeGlobals.startupNoDefault)) { - if (chunkGraph.getNumberOfEntryModules(chunk) > 0) { - /** @type {string[]} */ - const buf2 = []; - const runtimeRequirements = - chunkGraph.getTreeRuntimeRequirements(chunk); - buf2.push("// Load entry module and return exports"); - let i = chunkGraph.getNumberOfEntryModules(chunk); - for (const [ - entryModule, - entrypoint - ] of chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk)) { - const chunks = entrypoint.chunks.filter(c => c !== chunk); - if (result.allowInlineStartup && chunks.length > 0) { - buf2.push( - "// This entry module depends on other loaded chunks and execution need to be delayed" - ); - result.allowInlineStartup = false; - } - if ( - result.allowInlineStartup && - someInIterable( - moduleGraph.getIncomingConnectionsByOriginModule(entryModule), - ([originModule, connections]) => - originModule && - connections.some(c => c.isTargetActive(chunk.runtime)) && - someInIterable( - chunkGraph.getModuleRuntimes(originModule), - runtime => - intersectRuntime(runtime, chunk.runtime) !== undefined - ) - ) - ) { - buf2.push( - "// This entry module is referenced by other modules so it can't be inlined" - ); - result.allowInlineStartup = false; - } + // i is the current position in accessor that has been printed + let i = 1; - let data; - if (codeGenerationResults.has(entryModule, chunk.runtime)) { - const result = codeGenerationResults.get( - entryModule, - chunk.runtime - ); - data = result.data; - } - if ( - result.allowInlineStartup && - (!data || !data.get("topLevelDeclarations")) && - (!entryModule.buildInfo || - !entryModule.buildInfo.topLevelDeclarations) - ) { - buf2.push( - "// This entry module doesn't tell about it's top-level declarations so it can't be inlined" - ); - result.allowInlineStartup = false; - } - if (result.allowInlineStartup) { - const bailout = hooks.inlineInRuntimeBailout.call( - entryModule, - renderContext - ); - if (bailout !== undefined) { - buf2.push( - `// This entry module can't be inlined because ${bailout}` - ); - result.allowInlineStartup = false; - } - } - i--; - const moduleId = chunkGraph.getModuleId(entryModule); - const entryRuntimeRequirements = - chunkGraph.getModuleRuntimeRequirements(entryModule, chunk.runtime); - let moduleIdExpr = JSON.stringify(moduleId); - if (runtimeRequirements.has(RuntimeGlobals.entryModuleId)) { - moduleIdExpr = `${RuntimeGlobals.entryModuleId} = ${moduleIdExpr}`; - } - if ( - result.allowInlineStartup && - entryRuntimeRequirements.has(RuntimeGlobals.module) - ) { - result.allowInlineStartup = false; - buf2.push( - "// This entry module used 'module' so it can't be inlined" - ); - } - if (chunks.length > 0) { - buf2.push( - `${i === 0 ? "var __webpack_exports__ = " : ""}${ - RuntimeGlobals.onChunksLoaded - }(undefined, ${JSON.stringify( - chunks.map(c => c.id) - )}, ${runtimeTemplate.returningFunction( - `__webpack_require__(${moduleIdExpr})` - )})` - ); - } else if (useRequire) { - buf2.push( - `${ - i === 0 ? "var __webpack_exports__ = " : "" - }__webpack_require__(${moduleIdExpr});` - ); - } else { - if (i === 0) buf2.push("var __webpack_exports__ = {};"); - if (requireScopeUsed) { - buf2.push( - `__webpack_modules__[${moduleIdExpr}](0, ${ - i === 0 ? "__webpack_exports__" : "{}" - }, __webpack_require__);` - ); - } else if (entryRuntimeRequirements.has(RuntimeGlobals.exports)) { - buf2.push( - `__webpack_modules__[${moduleIdExpr}](0, ${ - i === 0 ? "__webpack_exports__" : "{}" - });` - ); - } else { - buf2.push(`__webpack_modules__[${moduleIdExpr}]();`); - } - } - } - if (runtimeRequirements.has(RuntimeGlobals.onChunksLoaded)) { - buf2.push( - `__webpack_exports__ = ${RuntimeGlobals.onChunksLoaded}(__webpack_exports__);` - ); - } - if ( - runtimeRequirements.has(RuntimeGlobals.startup) || - (runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore) && - runtimeRequirements.has(RuntimeGlobals.startupOnlyAfter)) - ) { - result.allowInlineStartup = false; - buf.push("// the startup function"); - buf.push( - `${RuntimeGlobals.startup} = ${runtimeTemplate.basicFunction("", [ - ...buf2, - "return __webpack_exports__;" - ])};` - ); - buf.push(""); - startup.push("// run startup"); - startup.push( - `var __webpack_exports__ = ${RuntimeGlobals.startup}();` - ); - } else if (runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore)) { - buf.push("// the startup function"); - buf.push( - `${RuntimeGlobals.startup} = ${runtimeTemplate.emptyFunction()};` - ); - beforeStartup.push("// run runtime startup"); - beforeStartup.push(`${RuntimeGlobals.startup}();`); - startup.push("// startup"); - startup.push(Template.asString(buf2)); - } else if (runtimeRequirements.has(RuntimeGlobals.startupOnlyAfter)) { - buf.push("// the startup function"); - buf.push( - `${RuntimeGlobals.startup} = ${runtimeTemplate.emptyFunction()};` - ); - startup.push("// startup"); - startup.push(Template.asString(buf2)); - afterStartup.push("// run runtime startup"); - afterStartup.push(`${RuntimeGlobals.startup}();`); - } else { - startup.push("// startup"); - startup.push(Template.asString(buf2)); - } - } else if ( - runtimeRequirements.has(RuntimeGlobals.startup) || - runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore) || - runtimeRequirements.has(RuntimeGlobals.startupOnlyAfter) - ) { - buf.push( - "// the startup function", - "// It's empty as no entry modules are in this chunk", - `${RuntimeGlobals.startup} = ${runtimeTemplate.emptyFunction()};`, - "" + // all properties printed so far (excluding base) + let propsSoFar; + + // if there is existingLength, print all properties until this position as property access + if (existingLength > i) { + propsSoFar = accessor.slice(1, existingLength); + i = existingLength; + current += propertyAccess(propsSoFar); + } else { + propsSoFar = []; + } + + // all remaining properties (except the last one when initLast is not set) + // should be printed as initializer + const initUntil = initLast ? accessor.length : accessor.length - 1; + for (; i < initUntil; i++) { + const prop = accessor[i]; + propsSoFar.push(prop); + current = `(${current}${propertyAccess([prop])} = ${base}${propertyAccess( + propsSoFar + )} || {})`; + } + + // print the last property as property access if not yet printed + if (i < accessor.length) + current = `${current}${propertyAccess([accessor[accessor.length - 1]])}`; + + return current; +}; + +/** + * @typedef {Object} AssignLibraryPluginOptions + * @property {LibraryType} type + * @property {string[] | "global"} prefix name prefix + * @property {string | false} declare declare name as variable + * @property {"error"|"static"|"copy"|"assign"} unnamed behavior for unnamed library name + * @property {"copy"|"assign"=} named behavior for named library name + */ + +/** + * @typedef {Object} AssignLibraryPluginParsed + * @property {string | string[]} name + * @property {string | string[] | undefined} export + */ + +/** + * @typedef {AssignLibraryPluginParsed} T + * @extends {AbstractLibraryPlugin} + */ +class AssignLibraryPlugin extends AbstractLibraryPlugin { + /** + * @param {AssignLibraryPluginOptions} options the plugin options + */ + constructor(options) { + super({ + pluginName: "AssignLibraryPlugin", + type: options.type + }); + this.prefix = options.prefix; + this.declare = options.declare; + this.unnamed = options.unnamed; + this.named = options.named || "assign"; + } + + /** + * @param {LibraryOptions} library normalized library option + * @returns {T | false} preprocess as needed by overriding + */ + parseOptions(library) { + const { name } = library; + if (this.unnamed === "error") { + if (typeof name !== "string" && !Array.isArray(name)) { + throw new Error( + `Library name must be a string or string array. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` ); } - } else if ( - runtimeRequirements.has(RuntimeGlobals.startup) || - runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore) || - runtimeRequirements.has(RuntimeGlobals.startupOnlyAfter) + } else { + if (name && typeof name !== "string" && !Array.isArray(name)) { + throw new Error( + `Library name must be a string, string array or unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` + ); + } + } + return { + name: /** @type {string|string[]=} */ (name), + export: library.export + }; + } + + /** + * @param {Module} module the exporting entry module + * @param {string} entryName the name of the entrypoint + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + finishEntryModule( + module, + entryName, + { options, compilation, compilation: { moduleGraph } } + ) { + const runtime = getEntryRuntime(compilation, entryName); + if (options.export) { + const exportsInfo = moduleGraph.getExportInfo( + module, + Array.isArray(options.export) ? options.export[0] : options.export + ); + exportsInfo.setUsed(UsageState.Used, runtime); + exportsInfo.canMangleUse = false; + } else { + const exportsInfo = moduleGraph.getExportsInfo(module); + exportsInfo.setUsedInUnknownWay(runtime); + } + moduleGraph.addExtraReason(module, "used as library export"); + } + + _getPrefix(compilation) { + return this.prefix === "global" + ? [compilation.runtimeTemplate.globalObject] + : this.prefix; + } + + _getResolvedFullName(options, chunk, compilation) { + const prefix = this._getPrefix(compilation); + const fullName = options.name ? prefix.concat(options.name) : prefix; + return fullName.map(n => + compilation.getPath(n, { + chunk + }) + ); + } + + /** + * @param {Source} source source + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + render(source, { chunk }, { options, compilation }) { + const fullNameResolved = this._getResolvedFullName( + options, + chunk, + compilation + ); + if (this.declare) { + const base = fullNameResolved[0]; + if (!isNameValid(base)) { + throw new Error( + `Library name base (${base}) must be a valid identifier when using a var declaring library type. Either use a valid identifier (e. g. ${Template.toIdentifier( + base + )}) or use a different library type (e. g. 'type: "global"', which assign a property on the global scope instead of declaring a variable). ${ + AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE + }` + ); + } + source = new ConcatSource(`${this.declare} ${base};\n`, source); + } + return source; + } + + /** + * @param {Module} module the exporting entry module + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {string | undefined} bailout reason + */ + embedInRuntimeBailout( + module, + { chunk, codeGenerationResults }, + { options, compilation } + ) { + const { data } = codeGenerationResults.get(module, chunk.runtime); + const topLevelDeclarations = + (data && data.get("topLevelDeclarations")) || + (module.buildInfo && module.buildInfo.topLevelDeclarations); + if (!topLevelDeclarations) + return "it doesn't tell about top level declarations."; + const fullNameResolved = this._getResolvedFullName( + options, + chunk, + compilation + ); + const base = fullNameResolved[0]; + if (topLevelDeclarations.has(base)) + return `it declares '${base}' on top-level, which conflicts with the current library output.`; + } + + /** + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {string | undefined} bailout reason + */ + strictRuntimeBailout({ chunk }, { options, compilation }) { + if ( + this.declare || + this.prefix === "global" || + this.prefix.length > 0 || + !options.name ) { - result.allowInlineStartup = false; - buf.push( - "// the startup function", - "// It's empty as some runtime module handles the default behavior", - `${RuntimeGlobals.startup} = ${runtimeTemplate.emptyFunction()};` + return; + } + return "a global variable is assign and maybe created"; + } + + /** + * @param {Source} source source + * @param {Module} module module + * @param {StartupRenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + renderStartup( + source, + module, + { moduleGraph, chunk }, + { options, compilation } + ) { + const fullNameResolved = this._getResolvedFullName( + options, + chunk, + compilation + ); + const staticExports = this.unnamed === "static"; + const exportAccess = options.export + ? propertyAccess( + Array.isArray(options.export) ? options.export : [options.export] + ) + : ""; + const result = new ConcatSource(source); + if (staticExports) { + const exportsInfo = moduleGraph.getExportsInfo(module); + const exportTarget = accessWithInit( + fullNameResolved, + this._getPrefix(compilation).length, + true + ); + for (const exportInfo of exportsInfo.orderedExports) { + if (!exportInfo.provided) continue; + const nameAccess = propertyAccess([exportInfo.name]); + result.add( + `${exportTarget}${nameAccess} = __webpack_exports__${exportAccess}${nameAccess};\n` + ); + } + result.add( + `Object.defineProperty(${exportTarget}, "__esModule", { value: true });\n` + ); + } else if (options.name ? this.named === "copy" : this.unnamed === "copy") { + result.add( + `var __webpack_export_target__ = ${accessWithInit( + fullNameResolved, + this._getPrefix(compilation).length, + true + )};\n` + ); + let exports = "__webpack_exports__"; + if (exportAccess) { + result.add( + `var __webpack_exports_export__ = __webpack_exports__${exportAccess};\n` + ); + exports = "__webpack_exports_export__"; + } + result.add( + `for(var i in ${exports}) __webpack_export_target__[i] = ${exports}[i];\n` + ); + result.add( + `if(${exports}.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true });\n` + ); + } else { + result.add( + `${accessWithInit( + fullNameResolved, + this._getPrefix(compilation).length, + false + )} = __webpack_exports__${exportAccess};\n` ); - startup.push("// run startup"); - startup.push(`var __webpack_exports__ = ${RuntimeGlobals.startup}();`); } return result; } /** - * @param {RenderBootstrapContext} renderContext options object - * @param {CompilationHooks} hooks hooks - * @returns {string} the generated source of the require function + * @param {Chunk} chunk the chunk + * @param {Set} set runtime requirements + * @param {LibraryContext} libraryContext context + * @returns {void} */ - renderRequire(renderContext, hooks) { - const { + runtimeRequirements(chunk, set, libraryContext) { + // we don't need to return exports from runtime + } + + /** + * @param {Chunk} chunk the chunk + * @param {Hash} hash hash + * @param {ChunkHashContext} chunkHashContext chunk hash context + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + chunkHash(chunk, hash, chunkHashContext, { options, compilation }) { + hash.update("AssignLibraryPlugin"); + const fullNameResolved = this._getResolvedFullName( + options, chunk, - chunkGraph, - runtimeTemplate: { outputOptions } - } = renderContext; - const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk); - const moduleExecution = runtimeRequirements.has( - RuntimeGlobals.interceptModuleExecution - ) - ? Template.asString([ - "var execOptions = { id: moduleId, module: module, factory: __webpack_modules__[moduleId], require: __webpack_require__ };", - `${RuntimeGlobals.interceptModuleExecution}.forEach(function(handler) { handler(execOptions); });`, - "module = execOptions.module;", - "execOptions.factory.call(module.exports, module, module.exports, execOptions.require);" - ]) - : runtimeRequirements.has(RuntimeGlobals.thisAsExports) - ? Template.asString([ - "__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);" - ]) - : Template.asString([ - "__webpack_modules__[moduleId](module, module.exports, __webpack_require__);" - ]); - const needModuleId = runtimeRequirements.has(RuntimeGlobals.moduleId); - const needModuleLoaded = runtimeRequirements.has( - RuntimeGlobals.moduleLoaded - ); - const content = Template.asString([ - "// Check if module is in cache", - "var cachedModule = __webpack_module_cache__[moduleId];", - "if (cachedModule !== undefined) {", - outputOptions.strictModuleErrorHandling - ? Template.indent([ - "if (cachedModule.error !== undefined) throw cachedModule.error;", - "return cachedModule.exports;" - ]) - : Template.indent("return cachedModule.exports;"), - "}", - "// Create a new module (and put it into the cache)", - "var module = __webpack_module_cache__[moduleId] = {", - Template.indent([ - needModuleId ? "id: moduleId," : "// no module.id needed", - needModuleLoaded ? "loaded: false," : "// no module.loaded needed", - "exports: {}" - ]), - "};", - "", - outputOptions.strictModuleExceptionHandling - ? Template.asString([ - "// Execute the module function", - "var threw = true;", - "try {", - Template.indent([moduleExecution, "threw = false;"]), - "} finally {", - Template.indent([ - "if(threw) delete __webpack_module_cache__[moduleId];" - ]), - "}" - ]) - : outputOptions.strictModuleErrorHandling - ? Template.asString([ - "// Execute the module function", - "try {", - Template.indent(moduleExecution), - "} catch(e) {", - Template.indent(["module.error = e;", "throw e;"]), - "}" - ]) - : Template.asString([ - "// Execute the module function", - moduleExecution - ]), - needModuleLoaded - ? Template.asString([ - "", - "// Flag the module as loaded", - "module.loaded = true;", - "" - ]) - : "", - "// Return the exports of the module", - "return module.exports;" - ]); - return tryRunOrWebpackError( - () => hooks.renderRequire.call(content, renderContext), - "JavascriptModulesPlugin.getCompilationHooks().renderRequire" + compilation ); + if (options.name ? this.named === "copy" : this.unnamed === "copy") { + hash.update("copy"); + } + if (this.declare) { + hash.update(this.declare); + } + hash.update(fullNameResolved.join(".")); + if (options.export) { + hash.update(`${options.export}`); + } } } -module.exports = JavascriptModulesPlugin; -module.exports.chunkHasJs = chunkHasJs; +module.exports = AssignLibraryPlugin; /***/ }), -/***/ 29050: +/***/ 91452: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -98398,3781 +96437,2923 @@ module.exports.chunkHasJs = chunkHasJs; -const { Parser: AcornParser } = __webpack_require__(31988); -const { importAssertions } = __webpack_require__(72617); -const { SyncBailHook, HookMap } = __webpack_require__(41242); -const vm = __webpack_require__(26144); -const Parser = __webpack_require__(11715); -const StackedMap = __webpack_require__(58845); -const binarySearchBounds = __webpack_require__(92229); -const memoize = __webpack_require__(78676); -const BasicEvaluatedExpression = __webpack_require__(950); +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("acorn").Options} AcornOptions */ -/** @typedef {import("estree").ArrayExpression} ArrayExpressionNode */ -/** @typedef {import("estree").BinaryExpression} BinaryExpressionNode */ -/** @typedef {import("estree").BlockStatement} BlockStatementNode */ -/** @typedef {import("estree").SequenceExpression} SequenceExpressionNode */ -/** @typedef {import("estree").CallExpression} CallExpressionNode */ -/** @typedef {import("estree").ClassDeclaration} ClassDeclarationNode */ -/** @typedef {import("estree").ClassExpression} ClassExpressionNode */ -/** @typedef {import("estree").Comment} CommentNode */ -/** @typedef {import("estree").ConditionalExpression} ConditionalExpressionNode */ -/** @typedef {import("estree").Declaration} DeclarationNode */ -/** @typedef {import("estree").PrivateIdentifier} PrivateIdentifierNode */ -/** @typedef {import("estree").PropertyDefinition} PropertyDefinitionNode */ -/** @typedef {import("estree").Expression} ExpressionNode */ -/** @typedef {import("estree").Identifier} IdentifierNode */ -/** @typedef {import("estree").IfStatement} IfStatementNode */ -/** @typedef {import("estree").LabeledStatement} LabeledStatementNode */ -/** @typedef {import("estree").Literal} LiteralNode */ -/** @typedef {import("estree").LogicalExpression} LogicalExpressionNode */ -/** @typedef {import("estree").ChainExpression} ChainExpressionNode */ -/** @typedef {import("estree").MemberExpression} MemberExpressionNode */ -/** @typedef {import("estree").MetaProperty} MetaPropertyNode */ -/** @typedef {import("estree").MethodDefinition} MethodDefinitionNode */ -/** @typedef {import("estree").ModuleDeclaration} ModuleDeclarationNode */ -/** @typedef {import("estree").NewExpression} NewExpressionNode */ -/** @typedef {import("estree").Node} AnyNode */ -/** @typedef {import("estree").Program} ProgramNode */ -/** @typedef {import("estree").Statement} StatementNode */ -/** @typedef {import("estree").ImportDeclaration} ImportDeclarationNode */ -/** @typedef {import("estree").ExportNamedDeclaration} ExportNamedDeclarationNode */ -/** @typedef {import("estree").ExportDefaultDeclaration} ExportDefaultDeclarationNode */ -/** @typedef {import("estree").ExportAllDeclaration} ExportAllDeclarationNode */ -/** @typedef {import("estree").Super} SuperNode */ -/** @typedef {import("estree").TaggedTemplateExpression} TaggedTemplateExpressionNode */ -/** @typedef {import("estree").TemplateLiteral} TemplateLiteralNode */ -/** @typedef {import("estree").ThisExpression} ThisExpressionNode */ -/** @typedef {import("estree").UnaryExpression} UnaryExpressionNode */ -/** @typedef {import("estree").VariableDeclarator} VariableDeclaratorNode */ -/** @template T @typedef {import("tapable").AsArray} AsArray */ -/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ -/** @typedef {{declaredScope: ScopeInfo, freeName: string | true, tagInfo: TagInfo | undefined}} VariableInfoInterface */ -/** @typedef {{ name: string | VariableInfo, rootInfo: string | VariableInfo, getMembers: () => string[] }} GetInfoResult */ +/** @type {WeakMap>} */ +const enabledTypes = new WeakMap(); -const EMPTY_ARRAY = []; -const ALLOWED_MEMBER_TYPES_CALL_EXPRESSION = 0b01; -const ALLOWED_MEMBER_TYPES_EXPRESSION = 0b10; -const ALLOWED_MEMBER_TYPES_ALL = 0b11; +const getEnabledTypes = compiler => { + let set = enabledTypes.get(compiler); + if (set === undefined) { + set = new Set(); + enabledTypes.set(compiler, set); + } + return set; +}; -// Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API +class EnableLibraryPlugin { + /** + * @param {LibraryType} type library type that should be available + */ + constructor(type) { + this.type = type; + } -const parser = AcornParser.extend(importAssertions); + /** + * @param {Compiler} compiler the compiler instance + * @param {LibraryType} type type of library + * @returns {void} + */ + static setEnabled(compiler, type) { + getEnabledTypes(compiler).add(type); + } -class VariableInfo { /** - * @param {ScopeInfo} declaredScope scope in which the variable is declared - * @param {string | true} freeName which free name the variable aliases, or true when none - * @param {TagInfo | undefined} tagInfo info about tags + * @param {Compiler} compiler the compiler instance + * @param {LibraryType} type type of library + * @returns {void} */ - constructor(declaredScope, freeName, tagInfo) { - this.declaredScope = declaredScope; - this.freeName = freeName; - this.tagInfo = tagInfo; + static checkEnabled(compiler, type) { + if (!getEnabledTypes(compiler).has(type)) { + throw new Error( + `Library type "${type}" is not enabled. ` + + "EnableLibraryPlugin need to be used to enable this type of library. " + + 'This usually happens through the "output.enabledLibraryTypes" option. ' + + 'If you are using a function as entry which sets "library", you need to add all potential library types to "output.enabledLibraryTypes". ' + + "These types are enabled: " + + Array.from(getEnabledTypes(compiler)).join(", ") + ); + } + } + + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const { type } = this; + + // Only enable once + const enabled = getEnabledTypes(compiler); + if (enabled.has(type)) return; + enabled.add(type); + + if (typeof type === "string") { + const enableExportProperty = () => { + const ExportPropertyTemplatePlugin = __webpack_require__(5487); + new ExportPropertyTemplatePlugin({ + type, + nsObjectUsed: type !== "module" + }).apply(compiler); + }; + switch (type) { + case "var": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: [], + declare: "var", + unnamed: "error" + }).apply(compiler); + break; + } + case "assign-properties": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: [], + declare: false, + unnamed: "error", + named: "copy" + }).apply(compiler); + break; + } + case "assign": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: [], + declare: false, + unnamed: "error" + }).apply(compiler); + break; + } + case "this": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: ["this"], + declare: false, + unnamed: "copy" + }).apply(compiler); + break; + } + case "window": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: ["window"], + declare: false, + unnamed: "copy" + }).apply(compiler); + break; + } + case "self": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: ["self"], + declare: false, + unnamed: "copy" + }).apply(compiler); + break; + } + case "global": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: "global", + declare: false, + unnamed: "copy" + }).apply(compiler); + break; + } + case "commonjs": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: ["exports"], + declare: false, + unnamed: "copy" + }).apply(compiler); + break; + } + case "commonjs-static": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: ["exports"], + declare: false, + unnamed: "static" + }).apply(compiler); + break; + } + case "commonjs2": + case "commonjs-module": { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const AssignLibraryPlugin = __webpack_require__(40080); + new AssignLibraryPlugin({ + type, + prefix: ["module", "exports"], + declare: false, + unnamed: "assign" + }).apply(compiler); + break; + } + case "amd": + case "amd-require": { + enableExportProperty(); + const AmdLibraryPlugin = __webpack_require__(67416); + new AmdLibraryPlugin({ + type, + requireAsWrapper: type === "amd-require" + }).apply(compiler); + break; + } + case "umd": + case "umd2": { + enableExportProperty(); + const UmdLibraryPlugin = __webpack_require__(54442); + new UmdLibraryPlugin({ + type, + optionalAmdExternalAsGlobal: type === "umd2" + }).apply(compiler); + break; + } + case "system": { + enableExportProperty(); + const SystemLibraryPlugin = __webpack_require__(11707); + new SystemLibraryPlugin({ + type + }).apply(compiler); + break; + } + case "jsonp": { + enableExportProperty(); + const JsonpLibraryPlugin = __webpack_require__(84415); + new JsonpLibraryPlugin({ + type + }).apply(compiler); + break; + } + case "module": { + enableExportProperty(); + const ModuleLibraryPlugin = __webpack_require__(59780); + new ModuleLibraryPlugin({ + type + }).apply(compiler); + break; + } + default: + throw new Error(`Unsupported library type ${type}. +Plugins which provide custom library types must call EnableLibraryPlugin.setEnabled(compiler, type) to disable this error.`); + } + } else { + // TODO support plugin instances here + // apply them to the compiler + } } } -/** @typedef {string | ScopeInfo | VariableInfo} ExportedVariableInfo */ -/** @typedef {LiteralNode | string | null | undefined} ImportSource */ -/** @typedef {Omit & { sourceType: "module" | "script" | "auto", ecmaVersion?: AcornOptions["ecmaVersion"] }} ParseOptions */ +module.exports = EnableLibraryPlugin; + + +/***/ }), + +/***/ 5487: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { ConcatSource } = __webpack_require__(51255); +const { UsageState } = __webpack_require__(63686); +const propertyAccess = __webpack_require__(54190); +const { getEntryRuntime } = __webpack_require__(17156); +const AbstractLibraryPlugin = __webpack_require__(26030); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */ +/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ /** - * @typedef {Object} TagInfo - * @property {any} tag - * @property {any} data - * @property {TagInfo | undefined} next + * @typedef {Object} ExportPropertyLibraryPluginParsed + * @property {string | string[]} export */ /** - * @typedef {Object} ScopeInfo - * @property {StackedMap} definitions - * @property {boolean | "arrow"} topLevelScope - * @property {boolean} inShorthand - * @property {boolean} isStrict - * @property {boolean} isAsmJs - * @property {boolean} inTry + * @typedef {Object} ExportPropertyLibraryPluginOptions + * @property {LibraryType} type + * @property {boolean} nsObjectUsed the namespace object is used + */ +/** + * @typedef {ExportPropertyLibraryPluginParsed} T + * @extends {AbstractLibraryPlugin} */ +class ExportPropertyLibraryPlugin extends AbstractLibraryPlugin { + /** + * @param {ExportPropertyLibraryPluginOptions} options options + */ + constructor({ type, nsObjectUsed }) { + super({ + pluginName: "ExportPropertyLibraryPlugin", + type + }); + this.nsObjectUsed = nsObjectUsed; + } -const joinRanges = (startRange, endRange) => { - if (!endRange) return startRange; - if (!startRange) return endRange; - return [startRange[0], endRange[1]]; -}; + /** + * @param {LibraryOptions} library normalized library option + * @returns {T | false} preprocess as needed by overriding + */ + parseOptions(library) { + return { + export: library.export + }; + } -const objectAndMembersToName = (object, membersReversed) => { - let name = object; - for (let i = membersReversed.length - 1; i >= 0; i--) { - name = name + "." + membersReversed[i]; + /** + * @param {Module} module the exporting entry module + * @param {string} entryName the name of the entrypoint + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + finishEntryModule( + module, + entryName, + { options, compilation, compilation: { moduleGraph } } + ) { + const runtime = getEntryRuntime(compilation, entryName); + if (options.export) { + const exportsInfo = moduleGraph.getExportInfo( + module, + Array.isArray(options.export) ? options.export[0] : options.export + ); + exportsInfo.setUsed(UsageState.Used, runtime); + exportsInfo.canMangleUse = false; + } else { + const exportsInfo = moduleGraph.getExportsInfo(module); + if (this.nsObjectUsed) { + exportsInfo.setUsedInUnknownWay(runtime); + } else { + exportsInfo.setAllKnownExportsUsed(runtime); + } + } + moduleGraph.addExtraReason(module, "used as library export"); } - return name; -}; -const getRootName = expression => { - switch (expression.type) { - case "Identifier": - return expression.name; - case "ThisExpression": - return "this"; - case "MetaProperty": - return `${expression.meta.name}.${expression.property.name}`; - default: - return undefined; + /** + * @param {Chunk} chunk the chunk + * @param {Set} set runtime requirements + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + runtimeRequirements(chunk, set, libraryContext) {} + + /** + * @param {Source} source source + * @param {Module} module module + * @param {StartupRenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + renderStartup(source, module, renderContext, { options }) { + if (!options.export) return source; + const postfix = `__webpack_exports__ = __webpack_exports__${propertyAccess( + Array.isArray(options.export) ? options.export : [options.export] + )};\n`; + return new ConcatSource(source, postfix); } -}; +} -/** @type {AcornOptions} */ -const defaultParserOptions = { - ranges: true, - locations: true, - ecmaVersion: "latest", - sourceType: "module", - // https://github.com/tc39/proposal-hashbang - allowHashBang: true, - onComment: null -}; +module.exports = ExportPropertyLibraryPlugin; -// regexp to match at least one "magic comment" -const webpackCommentRegExp = new RegExp(/(^|\W)webpack[A-Z]{1,}[A-Za-z]{1,}:/); -const EMPTY_COMMENT_OPTIONS = { - options: null, - errors: null -}; +/***/ }), -class JavascriptParser extends Parser { +/***/ 84415: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { ConcatSource } = __webpack_require__(51255); +const AbstractLibraryPlugin = __webpack_require__(26030); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ +/** @typedef {import("../util/Hash")} Hash */ +/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ + +/** + * @typedef {Object} JsonpLibraryPluginOptions + * @property {LibraryType} type + */ + +/** + * @typedef {Object} JsonpLibraryPluginParsed + * @property {string} name + */ + +/** + * @typedef {JsonpLibraryPluginParsed} T + * @extends {AbstractLibraryPlugin} + */ +class JsonpLibraryPlugin extends AbstractLibraryPlugin { /** - * @param {"module" | "script" | "auto"} sourceType default source type + * @param {JsonpLibraryPluginOptions} options the plugin options */ - constructor(sourceType = "auto") { - super(); - this.hooks = Object.freeze({ - /** @type {HookMap>} */ - evaluateTypeof: new HookMap(() => new SyncBailHook(["expression"])), - /** @type {HookMap>} */ - evaluate: new HookMap(() => new SyncBailHook(["expression"])), - /** @type {HookMap>} */ - evaluateIdentifier: new HookMap(() => new SyncBailHook(["expression"])), - /** @type {HookMap>} */ - evaluateDefinedIdentifier: new HookMap( - () => new SyncBailHook(["expression"]) - ), - /** @type {HookMap>} */ - evaluateCallExpressionMember: new HookMap( - () => new SyncBailHook(["expression", "param"]) - ), - /** @type {HookMap>} */ - isPure: new HookMap( - () => new SyncBailHook(["expression", "commentsStartPosition"]) - ), - /** @type {SyncBailHook<[StatementNode | ModuleDeclarationNode], boolean | void>} */ - preStatement: new SyncBailHook(["statement"]), - - /** @type {SyncBailHook<[StatementNode | ModuleDeclarationNode], boolean | void>} */ - blockPreStatement: new SyncBailHook(["declaration"]), - /** @type {SyncBailHook<[StatementNode | ModuleDeclarationNode], boolean | void>} */ - statement: new SyncBailHook(["statement"]), - /** @type {SyncBailHook<[IfStatementNode], boolean | void>} */ - statementIf: new SyncBailHook(["statement"]), - /** @type {SyncBailHook<[ExpressionNode, ClassExpressionNode | ClassDeclarationNode], boolean | void>} */ - classExtendsExpression: new SyncBailHook([ - "expression", - "classDefinition" - ]), - /** @type {SyncBailHook<[MethodDefinitionNode | PropertyDefinitionNode, ClassExpressionNode | ClassDeclarationNode], boolean | void>} */ - classBodyElement: new SyncBailHook(["element", "classDefinition"]), - /** @type {SyncBailHook<[ExpressionNode, MethodDefinitionNode | PropertyDefinitionNode, ClassExpressionNode | ClassDeclarationNode], boolean | void>} */ - classBodyValue: new SyncBailHook([ - "expression", - "element", - "classDefinition" - ]), - /** @type {HookMap>} */ - label: new HookMap(() => new SyncBailHook(["statement"])), - /** @type {SyncBailHook<[ImportDeclarationNode, ImportSource], boolean | void>} */ - import: new SyncBailHook(["statement", "source"]), - /** @type {SyncBailHook<[ImportDeclarationNode, ImportSource, string, string], boolean | void>} */ - importSpecifier: new SyncBailHook([ - "statement", - "source", - "exportName", - "identifierName" - ]), - /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode], boolean | void>} */ - export: new SyncBailHook(["statement"]), - /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, ImportSource], boolean | void>} */ - exportImport: new SyncBailHook(["statement", "source"]), - /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, DeclarationNode], boolean | void>} */ - exportDeclaration: new SyncBailHook(["statement", "declaration"]), - /** @type {SyncBailHook<[ExportDefaultDeclarationNode, DeclarationNode], boolean | void>} */ - exportExpression: new SyncBailHook(["statement", "declaration"]), - /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, string, string, number | undefined], boolean | void>} */ - exportSpecifier: new SyncBailHook([ - "statement", - "identifierName", - "exportName", - "index" - ]), - /** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, ImportSource, string, string, number | undefined], boolean | void>} */ - exportImportSpecifier: new SyncBailHook([ - "statement", - "source", - "identifierName", - "exportName", - "index" - ]), - /** @type {SyncBailHook<[VariableDeclaratorNode, StatementNode], boolean | void>} */ - preDeclarator: new SyncBailHook(["declarator", "statement"]), - /** @type {SyncBailHook<[VariableDeclaratorNode, StatementNode], boolean | void>} */ - declarator: new SyncBailHook(["declarator", "statement"]), - /** @type {HookMap>} */ - varDeclaration: new HookMap(() => new SyncBailHook(["declaration"])), - /** @type {HookMap>} */ - varDeclarationLet: new HookMap(() => new SyncBailHook(["declaration"])), - /** @type {HookMap>} */ - varDeclarationConst: new HookMap(() => new SyncBailHook(["declaration"])), - /** @type {HookMap>} */ - varDeclarationVar: new HookMap(() => new SyncBailHook(["declaration"])), - /** @type {HookMap>} */ - pattern: new HookMap(() => new SyncBailHook(["pattern"])), - /** @type {HookMap>} */ - canRename: new HookMap(() => new SyncBailHook(["initExpression"])), - /** @type {HookMap>} */ - rename: new HookMap(() => new SyncBailHook(["initExpression"])), - /** @type {HookMap>} */ - assign: new HookMap(() => new SyncBailHook(["expression"])), - /** @type {HookMap>} */ - assignMemberChain: new HookMap( - () => new SyncBailHook(["expression", "members"]) - ), - /** @type {HookMap>} */ - typeof: new HookMap(() => new SyncBailHook(["expression"])), - /** @type {SyncBailHook<[ExpressionNode], boolean | void>} */ - importCall: new SyncBailHook(["expression"]), - /** @type {SyncBailHook<[ExpressionNode], boolean | void>} */ - topLevelAwait: new SyncBailHook(["expression"]), - /** @type {HookMap>} */ - call: new HookMap(() => new SyncBailHook(["expression"])), - /** Something like "a.b()" */ - /** @type {HookMap>} */ - callMemberChain: new HookMap( - () => new SyncBailHook(["expression", "members"]) - ), - /** Something like "a.b().c.d" */ - /** @type {HookMap>} */ - memberChainOfCallMemberChain: new HookMap( - () => - new SyncBailHook([ - "expression", - "calleeMembers", - "callExpression", - "members" - ]) - ), - /** Something like "a.b().c.d()"" */ - /** @type {HookMap>} */ - callMemberChainOfCallMemberChain: new HookMap( - () => - new SyncBailHook([ - "expression", - "calleeMembers", - "innerCallExpression", - "members" - ]) - ), - /** @type {SyncBailHook<[ChainExpressionNode], boolean | void>} */ - optionalChaining: new SyncBailHook(["optionalChaining"]), - /** @type {HookMap>} */ - new: new HookMap(() => new SyncBailHook(["expression"])), - /** @type {HookMap>} */ - expression: new HookMap(() => new SyncBailHook(["expression"])), - /** @type {HookMap>} */ - expressionMemberChain: new HookMap( - () => new SyncBailHook(["expression", "members"]) - ), - /** @type {HookMap>} */ - unhandledExpressionMemberChain: new HookMap( - () => new SyncBailHook(["expression", "members"]) - ), - /** @type {SyncBailHook<[ExpressionNode], boolean | void>} */ - expressionConditionalOperator: new SyncBailHook(["expression"]), - /** @type {SyncBailHook<[ExpressionNode], boolean | void>} */ - expressionLogicalOperator: new SyncBailHook(["expression"]), - /** @type {SyncBailHook<[ProgramNode, CommentNode[]], boolean | void>} */ - program: new SyncBailHook(["ast", "comments"]), - /** @type {SyncBailHook<[ProgramNode, CommentNode[]], boolean | void>} */ - finish: new SyncBailHook(["ast", "comments"]) + constructor(options) { + super({ + pluginName: "JsonpLibraryPlugin", + type: options.type }); - this.sourceType = sourceType; - /** @type {ScopeInfo} */ - this.scope = undefined; - /** @type {ParserState} */ - this.state = undefined; - this.comments = undefined; - this.semicolons = undefined; - /** @type {(StatementNode|ExpressionNode)[]} */ - this.statementPath = undefined; - this.prevStatement = undefined; - this.currentTagData = undefined; - this._initializeEvaluating(); } - _initializeEvaluating() { - this.hooks.evaluate.for("Literal").tap("JavascriptParser", _expr => { - const expr = /** @type {LiteralNode} */ (_expr); + /** + * @param {LibraryOptions} library normalized library option + * @returns {T | false} preprocess as needed by overriding + */ + parseOptions(library) { + const { name } = library; + if (typeof name !== "string") { + throw new Error( + `Jsonp library name must be a simple string. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` + ); + } + return { + name: /** @type {string} */ (name) + }; + } - switch (typeof expr.value) { - case "number": - return new BasicEvaluatedExpression() - .setNumber(expr.value) - .setRange(expr.range); - case "bigint": - return new BasicEvaluatedExpression() - .setBigInt(expr.value) - .setRange(expr.range); - case "string": - return new BasicEvaluatedExpression() - .setString(expr.value) - .setRange(expr.range); - case "boolean": - return new BasicEvaluatedExpression() - .setBoolean(expr.value) - .setRange(expr.range); - } - if (expr.value === null) { - return new BasicEvaluatedExpression().setNull().setRange(expr.range); - } - if (expr.value instanceof RegExp) { - return new BasicEvaluatedExpression() - .setRegExp(expr.value) - .setRange(expr.range); - } + /** + * @param {Source} source source + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + render(source, { chunk }, { options, compilation }) { + const name = compilation.getPath(options.name, { + chunk }); - this.hooks.evaluate.for("NewExpression").tap("JavascriptParser", _expr => { - const expr = /** @type {NewExpressionNode} */ (_expr); - const callee = expr.callee; - if ( - callee.type !== "Identifier" || - callee.name !== "RegExp" || - expr.arguments.length > 2 || - this.getVariableInfo("RegExp") !== "RegExp" - ) - return; + return new ConcatSource(`${name}(`, source, ")"); + } - let regExp, flags; - const arg1 = expr.arguments[0]; + /** + * @param {Chunk} chunk the chunk + * @param {Hash} hash hash + * @param {ChunkHashContext} chunkHashContext chunk hash context + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + chunkHash(chunk, hash, chunkHashContext, { options, compilation }) { + hash.update("JsonpLibraryPlugin"); + hash.update(compilation.getPath(options.name, { chunk })); + } +} - if (arg1) { - if (arg1.type === "SpreadElement") return; +module.exports = JsonpLibraryPlugin; - const evaluatedRegExp = this.evaluateExpression(arg1); - if (!evaluatedRegExp) return; +/***/ }), - regExp = evaluatedRegExp.asString(); +/***/ 59780: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (!regExp) return; - } else { - return new BasicEvaluatedExpression() - .setRegExp(new RegExp("")) - .setRange(expr.range); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - const arg2 = expr.arguments[1]; - if (arg2) { - if (arg2.type === "SpreadElement") return; - const evaluatedFlags = this.evaluateExpression(arg2); +const { ConcatSource } = __webpack_require__(51255); +const Template = __webpack_require__(1626); +const propertyAccess = __webpack_require__(54190); +const AbstractLibraryPlugin = __webpack_require__(26030); - if (!evaluatedFlags) return; +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */ +/** @typedef {import("../util/Hash")} Hash */ +/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ - if (!evaluatedFlags.isUndefined()) { - flags = evaluatedFlags.asString(); +/** + * @typedef {Object} ModuleLibraryPluginOptions + * @property {LibraryType} type + */ - if ( - flags === undefined || - !BasicEvaluatedExpression.isValidRegExpFlags(flags) - ) - return; - } - } +/** + * @typedef {Object} ModuleLibraryPluginParsed + * @property {string} name + */ - return new BasicEvaluatedExpression() - .setRegExp(flags ? new RegExp(regExp, flags) : new RegExp(regExp)) - .setRange(expr.range); +/** + * @typedef {ModuleLibraryPluginParsed} T + * @extends {AbstractLibraryPlugin} + */ +class ModuleLibraryPlugin extends AbstractLibraryPlugin { + /** + * @param {ModuleLibraryPluginOptions} options the plugin options + */ + constructor(options) { + super({ + pluginName: "ModuleLibraryPlugin", + type: options.type }); - this.hooks.evaluate - .for("LogicalExpression") - .tap("JavascriptParser", _expr => { - const expr = /** @type {LogicalExpressionNode} */ (_expr); + } - const left = this.evaluateExpression(expr.left); - if (!left) return; - let returnRight = false; - /** @type {boolean|undefined} */ - let allowedRight; - if (expr.operator === "&&") { - const leftAsBool = left.asBool(); - if (leftAsBool === false) return left.setRange(expr.range); - returnRight = leftAsBool === true; - allowedRight = false; - } else if (expr.operator === "||") { - const leftAsBool = left.asBool(); - if (leftAsBool === true) return left.setRange(expr.range); - returnRight = leftAsBool === false; - allowedRight = true; - } else if (expr.operator === "??") { - const leftAsNullish = left.asNullish(); - if (leftAsNullish === false) return left.setRange(expr.range); - if (leftAsNullish !== true) return; - returnRight = true; - } else return; - const right = this.evaluateExpression(expr.right); - if (!right) return; - if (returnRight) { - if (left.couldHaveSideEffects()) right.setSideEffects(); - return right.setRange(expr.range); - } + /** + * @param {LibraryOptions} library normalized library option + * @returns {T | false} preprocess as needed by overriding + */ + parseOptions(library) { + const { name } = library; + if (name) { + throw new Error( + `Library name must be unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` + ); + } + return { + name: /** @type {string} */ (name) + }; + } - const asBool = right.asBool(); + /** + * @param {Source} source source + * @param {Module} module module + * @param {StartupRenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + renderStartup( + source, + module, + { moduleGraph, chunk }, + { options, compilation } + ) { + const result = new ConcatSource(source); + const exportsInfo = moduleGraph.getExportsInfo(module); + const exports = []; + const isAsync = moduleGraph.isAsync(module); + if (isAsync) { + result.add(`__webpack_exports__ = await __webpack_exports__;\n`); + } + for (const exportInfo of exportsInfo.orderedExports) { + if (!exportInfo.provided) continue; + const varName = `__webpack_exports__${Template.toIdentifier( + exportInfo.name + )}`; + result.add( + `var ${varName} = __webpack_exports__${propertyAccess([ + exportInfo.getUsedName(exportInfo.name, chunk.runtime) + ])};\n` + ); + exports.push(`${varName} as ${exportInfo.name}`); + } + if (exports.length > 0) { + result.add(`export { ${exports.join(", ")} };\n`); + } + return result; + } +} - if (allowedRight === true && asBool === true) { - return new BasicEvaluatedExpression() - .setRange(expr.range) - .setTruthy(); - } else if (allowedRight === false && asBool === false) { - return new BasicEvaluatedExpression().setRange(expr.range).setFalsy(); - } - }); +module.exports = ModuleLibraryPlugin; - const valueAsExpression = (value, expr, sideEffects) => { - switch (typeof value) { - case "boolean": - return new BasicEvaluatedExpression() - .setBoolean(value) - .setSideEffects(sideEffects) - .setRange(expr.range); - case "number": - return new BasicEvaluatedExpression() - .setNumber(value) - .setSideEffects(sideEffects) - .setRange(expr.range); - case "bigint": - return new BasicEvaluatedExpression() - .setBigInt(value) - .setSideEffects(sideEffects) - .setRange(expr.range); - case "string": - return new BasicEvaluatedExpression() - .setString(value) - .setSideEffects(sideEffects) - .setRange(expr.range); - } - }; - this.hooks.evaluate - .for("BinaryExpression") - .tap("JavascriptParser", _expr => { - const expr = /** @type {BinaryExpressionNode} */ (_expr); +/***/ }), - const handleConstOperation = fn => { - const left = this.evaluateExpression(expr.left); - if (!left || !left.isCompileTimeValue()) return; +/***/ 11707: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const right = this.evaluateExpression(expr.right); - if (!right || !right.isCompileTimeValue()) return; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Joel Denning @joeldenning +*/ - const result = fn( - left.asCompileTimeValue(), - right.asCompileTimeValue() - ); - return valueAsExpression( - result, - expr, - left.couldHaveSideEffects() || right.couldHaveSideEffects() - ); - }; - const isAlwaysDifferent = (a, b) => - (a === true && b === false) || (a === false && b === true); - const handleTemplateStringCompare = (left, right, res, eql) => { - const getPrefix = parts => { - let value = ""; - for (const p of parts) { - const v = p.asString(); - if (v !== undefined) value += v; - else break; - } - return value; - }; - const getSuffix = parts => { - let value = ""; - for (let i = parts.length - 1; i >= 0; i--) { - const v = parts[i].asString(); - if (v !== undefined) value = v + value; - else break; - } - return value; - }; - const leftPrefix = getPrefix(left.parts); - const rightPrefix = getPrefix(right.parts); - const leftSuffix = getSuffix(left.parts); - const rightSuffix = getSuffix(right.parts); - const lenPrefix = Math.min(leftPrefix.length, rightPrefix.length); - const lenSuffix = Math.min(leftSuffix.length, rightSuffix.length); - if ( - leftPrefix.slice(0, lenPrefix) !== - rightPrefix.slice(0, lenPrefix) || - leftSuffix.slice(-lenSuffix) !== rightSuffix.slice(-lenSuffix) - ) { - return res - .setBoolean(!eql) - .setSideEffects( - left.couldHaveSideEffects() || right.couldHaveSideEffects() - ); - } - }; +const { ConcatSource } = __webpack_require__(51255); +const { UsageState } = __webpack_require__(63686); +const ExternalModule = __webpack_require__(73071); +const Template = __webpack_require__(1626); +const propertyAccess = __webpack_require__(54190); +const AbstractLibraryPlugin = __webpack_require__(26030); - const handleStrictEqualityComparison = eql => { - const left = this.evaluateExpression(expr.left); - if (!left) return; - const right = this.evaluateExpression(expr.right); - if (!right) return; - const res = new BasicEvaluatedExpression(); - res.setRange(expr.range); +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ +/** @typedef {import("../util/Hash")} Hash */ +/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ - const leftConst = left.isCompileTimeValue(); - const rightConst = right.isCompileTimeValue(); +/** + * @typedef {Object} SystemLibraryPluginOptions + * @property {LibraryType} type + */ - if (leftConst && rightConst) { - return res - .setBoolean( - eql === - (left.asCompileTimeValue() === right.asCompileTimeValue()) - ) - .setSideEffects( - left.couldHaveSideEffects() || right.couldHaveSideEffects() - ); - } +/** + * @typedef {Object} SystemLibraryPluginParsed + * @property {string} name + */ - if (left.isArray() && right.isArray()) { - return res - .setBoolean(!eql) - .setSideEffects( - left.couldHaveSideEffects() || right.couldHaveSideEffects() - ); - } - if (left.isTemplateString() && right.isTemplateString()) { - return handleTemplateStringCompare(left, right, res, eql); - } +/** + * @typedef {SystemLibraryPluginParsed} T + * @extends {AbstractLibraryPlugin} + */ +class SystemLibraryPlugin extends AbstractLibraryPlugin { + /** + * @param {SystemLibraryPluginOptions} options the plugin options + */ + constructor(options) { + super({ + pluginName: "SystemLibraryPlugin", + type: options.type + }); + } - const leftPrimitive = left.isPrimitiveType(); - const rightPrimitive = right.isPrimitiveType(); + /** + * @param {LibraryOptions} library normalized library option + * @returns {T | false} preprocess as needed by overriding + */ + parseOptions(library) { + const { name } = library; + if (name && typeof name !== "string") { + throw new Error( + `System.js library name must be a simple string or unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` + ); + } + return { + name: /** @type {string=} */ (name) + }; + } - if ( - // Primitive !== Object or - // compile-time object types are never equal to something at runtime - (leftPrimitive === false && - (leftConst || rightPrimitive === true)) || - (rightPrimitive === false && - (rightConst || leftPrimitive === true)) || - // Different nullish or boolish status also means not equal - isAlwaysDifferent(left.asBool(), right.asBool()) || - isAlwaysDifferent(left.asNullish(), right.asNullish()) - ) { - return res - .setBoolean(!eql) - .setSideEffects( - left.couldHaveSideEffects() || right.couldHaveSideEffects() - ); - } - }; + /** + * @param {Source} source source + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + render(source, { chunkGraph, moduleGraph, chunk }, { options, compilation }) { + const modules = chunkGraph + .getChunkModules(chunk) + .filter(m => m instanceof ExternalModule && m.externalType === "system"); + const externals = /** @type {ExternalModule[]} */ (modules); - const handleAbstractEqualityComparison = eql => { - const left = this.evaluateExpression(expr.left); - if (!left) return; - const right = this.evaluateExpression(expr.right); - if (!right) return; - const res = new BasicEvaluatedExpression(); - res.setRange(expr.range); + // The name this bundle should be registered as with System + const name = options.name + ? `${JSON.stringify(compilation.getPath(options.name, { chunk }))}, ` + : ""; - const leftConst = left.isCompileTimeValue(); - const rightConst = right.isCompileTimeValue(); + // The array of dependencies that are external to webpack and will be provided by System + const systemDependencies = JSON.stringify( + externals.map(m => + typeof m.request === "object" && !Array.isArray(m.request) + ? m.request.amd + : m.request + ) + ); - if (leftConst && rightConst) { - return res - .setBoolean( - eql === - // eslint-disable-next-line eqeqeq - (left.asCompileTimeValue() == right.asCompileTimeValue()) - ) - .setSideEffects( - left.couldHaveSideEffects() || right.couldHaveSideEffects() - ); - } + // The name of the variable provided by System for exporting + const dynamicExport = "__WEBPACK_DYNAMIC_EXPORT__"; - if (left.isArray() && right.isArray()) { - return res - .setBoolean(!eql) - .setSideEffects( - left.couldHaveSideEffects() || right.couldHaveSideEffects() - ); - } - if (left.isTemplateString() && right.isTemplateString()) { - return handleTemplateStringCompare(left, right, res, eql); - } - }; + // An array of the internal variable names for the webpack externals + const externalWebpackNames = externals.map( + m => + `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( + `${chunkGraph.getModuleId(m)}` + )}__` + ); - if (expr.operator === "+") { - const left = this.evaluateExpression(expr.left); - if (!left) return; - const right = this.evaluateExpression(expr.right); - if (!right) return; - const res = new BasicEvaluatedExpression(); - if (left.isString()) { - if (right.isString()) { - res.setString(left.string + right.string); - } else if (right.isNumber()) { - res.setString(left.string + right.number); - } else if ( - right.isWrapped() && - right.prefix && - right.prefix.isString() - ) { - // "left" + ("prefix" + inner + "postfix") - // => ("leftPrefix" + inner + "postfix") - res.setWrapped( - new BasicEvaluatedExpression() - .setString(left.string + right.prefix.string) - .setRange(joinRanges(left.range, right.prefix.range)), - right.postfix, - right.wrappedInnerExpressions - ); - } else if (right.isWrapped()) { - // "left" + ([null] + inner + "postfix") - // => ("left" + inner + "postfix") - res.setWrapped( - left, - right.postfix, - right.wrappedInnerExpressions + // Declaring variables for the internal variable names for the webpack externals + const externalVarDeclarations = externalWebpackNames + .map(name => `var ${name} = {};`) + .join("\n"); + + // Define __esModule flag on all internal variables and helpers + const externalVarInitialization = []; + + // The system.register format requires an array of setter functions for externals. + const setters = + externalWebpackNames.length === 0 + ? "" + : Template.asString([ + "setters: [", + Template.indent( + externals + .map((module, i) => { + const external = externalWebpackNames[i]; + const exportsInfo = moduleGraph.getExportsInfo(module); + const otherUnused = + exportsInfo.otherExportsInfo.getUsed(chunk.runtime) === + UsageState.Unused; + const instructions = []; + const handledNames = []; + for (const exportInfo of exportsInfo.orderedExports) { + const used = exportInfo.getUsedName( + undefined, + chunk.runtime + ); + if (used) { + if (otherUnused || used !== exportInfo.name) { + instructions.push( + `${external}${propertyAccess([ + used + ])} = module${propertyAccess([exportInfo.name])};` + ); + handledNames.push(exportInfo.name); + } + } else { + handledNames.push(exportInfo.name); + } + } + if (!otherUnused) { + if ( + !Array.isArray(module.request) || + module.request.length === 1 + ) { + externalVarInitialization.push( + `Object.defineProperty(${external}, "__esModule", { value: true });` + ); + } + if (handledNames.length > 0) { + const name = `${external}handledNames`; + externalVarInitialization.push( + `var ${name} = ${JSON.stringify(handledNames)};` + ); + instructions.push( + Template.asString([ + "Object.keys(module).forEach(function(key) {", + Template.indent([ + `if(${name}.indexOf(key) >= 0)`, + Template.indent(`${external}[key] = module[key];`) + ]), + "});" + ]) + ); + } else { + instructions.push( + Template.asString([ + "Object.keys(module).forEach(function(key) {", + Template.indent([`${external}[key] = module[key];`]), + "});" + ]) + ); + } + } + if (instructions.length === 0) return "function() {}"; + return Template.asString([ + "function(module) {", + Template.indent(instructions), + "}" + ]); + }) + .join(",\n") + ), + "]," + ]); + + return new ConcatSource( + Template.asString([ + `System.register(${name}${systemDependencies}, function(${dynamicExport}, __system_context__) {`, + Template.indent([ + externalVarDeclarations, + Template.asString(externalVarInitialization), + "return {", + Template.indent([ + setters, + "execute: function() {", + Template.indent(`${dynamicExport}(`) + ]) + ]), + "" + ]), + source, + Template.asString([ + "", + Template.indent([ + Template.indent([Template.indent([");"]), "}"]), + "};" + ]), + "})" + ]) + ); + } + + /** + * @param {Chunk} chunk the chunk + * @param {Hash} hash hash + * @param {ChunkHashContext} chunkHashContext chunk hash context + * @param {LibraryContext} libraryContext context + * @returns {void} + */ + chunkHash(chunk, hash, chunkHashContext, { options, compilation }) { + hash.update("SystemLibraryPlugin"); + if (options.name) { + hash.update(compilation.getPath(options.name, { chunk })); + } + } +} + +module.exports = SystemLibraryPlugin; + + +/***/ }), + +/***/ 54442: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { ConcatSource, OriginalSource } = __webpack_require__(51255); +const ExternalModule = __webpack_require__(73071); +const Template = __webpack_require__(1626); +const AbstractLibraryPlugin = __webpack_require__(26030); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryCustomUmdCommentObject} LibraryCustomUmdCommentObject */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryCustomUmdObject} LibraryCustomUmdObject */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryName} LibraryName */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ +/** @typedef {import("../util/Hash")} Hash */ +/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ + +/** + * @param {string[]} accessor the accessor to convert to path + * @returns {string} the path + */ +const accessorToObjectAccess = accessor => { + return accessor.map(a => `[${JSON.stringify(a)}]`).join(""); +}; + +/** + * @param {string|undefined} base the path prefix + * @param {string|string[]} accessor the accessor + * @param {string=} joinWith the element separator + * @returns {string} the path + */ +const accessorAccess = (base, accessor, joinWith = ", ") => { + const accessors = Array.isArray(accessor) ? accessor : [accessor]; + return accessors + .map((_, idx) => { + const a = base + ? base + accessorToObjectAccess(accessors.slice(0, idx + 1)) + : accessors[0] + accessorToObjectAccess(accessors.slice(1, idx + 1)); + if (idx === accessors.length - 1) return a; + if (idx === 0 && base === undefined) + return `${a} = typeof ${a} === "object" ? ${a} : {}`; + return `${a} = ${a} || {}`; + }) + .join(joinWith); +}; + +/** @typedef {string | string[] | LibraryCustomUmdObject} UmdLibraryPluginName */ + +/** + * @typedef {Object} UmdLibraryPluginOptions + * @property {LibraryType} type + * @property {boolean=} optionalAmdExternalAsGlobal + */ + +/** + * @typedef {Object} UmdLibraryPluginParsed + * @property {string | string[]} name + * @property {LibraryCustomUmdObject} names + * @property {string | LibraryCustomUmdCommentObject} auxiliaryComment + * @property {boolean} namedDefine + */ + +/** + * @typedef {UmdLibraryPluginParsed} T + * @extends {AbstractLibraryPlugin} + */ +class UmdLibraryPlugin extends AbstractLibraryPlugin { + /** + * @param {UmdLibraryPluginOptions} options the plugin option + */ + constructor(options) { + super({ + pluginName: "UmdLibraryPlugin", + type: options.type + }); + + this.optionalAmdExternalAsGlobal = options.optionalAmdExternalAsGlobal; + } + + /** + * @param {LibraryOptions} library normalized library option + * @returns {T | false} preprocess as needed by overriding + */ + parseOptions(library) { + /** @type {LibraryName} */ + let name; + /** @type {LibraryCustomUmdObject} */ + let names; + if (typeof library.name === "object" && !Array.isArray(library.name)) { + name = library.name.root || library.name.amd || library.name.commonjs; + names = library.name; + } else { + name = library.name; + const singleName = Array.isArray(name) ? name[0] : name; + names = { + commonjs: singleName, + root: library.name, + amd: singleName + }; + } + return { + name, + names, + auxiliaryComment: library.auxiliaryComment, + namedDefine: library.umdNamedDefine + }; + } + + /** + * @param {Source} source source + * @param {RenderContext} renderContext render context + * @param {LibraryContext} libraryContext context + * @returns {Source} source with library export + */ + render( + source, + { chunkGraph, runtimeTemplate, chunk, moduleGraph }, + { options, compilation } + ) { + const modules = chunkGraph + .getChunkModules(chunk) + .filter( + m => + m instanceof ExternalModule && + (m.externalType === "umd" || m.externalType === "umd2") + ); + let externals = /** @type {ExternalModule[]} */ (modules); + /** @type {ExternalModule[]} */ + const optionalExternals = []; + /** @type {ExternalModule[]} */ + let requiredExternals = []; + if (this.optionalAmdExternalAsGlobal) { + for (const m of externals) { + if (m.isOptional(moduleGraph)) { + optionalExternals.push(m); + } else { + requiredExternals.push(m); + } + } + externals = requiredExternals.concat(optionalExternals); + } else { + requiredExternals = externals; + } + + const replaceKeys = str => { + return compilation.getPath(str, { + chunk + }); + }; + + const externalsDepsArray = modules => { + return `[${replaceKeys( + modules + .map(m => + JSON.stringify( + typeof m.request === "object" ? m.request.amd : m.request + ) + ) + .join(", ") + )}]`; + }; + + const externalsRootArray = modules => { + return replaceKeys( + modules + .map(m => { + let request = m.request; + if (typeof request === "object") request = request.root; + return `root${accessorToObjectAccess([].concat(request))}`; + }) + .join(", ") + ); + }; + + const externalsRequireArray = type => { + return replaceKeys( + externals + .map(m => { + let expr; + let request = m.request; + if (typeof request === "object") { + request = request[type]; + } + if (request === undefined) { + throw new Error( + "Missing external configuration for type:" + type ); - } else { - // "left" + expr - // => ("left" + expr + "") - res.setWrapped(left, null, [right]); } - } else if (left.isNumber()) { - if (right.isString()) { - res.setString(left.number + right.string); - } else if (right.isNumber()) { - res.setNumber(left.number + right.number); + if (Array.isArray(request)) { + expr = `require(${JSON.stringify( + request[0] + )})${accessorToObjectAccess(request.slice(1))}`; } else { - return; + expr = `require(${JSON.stringify(request)})`; } - } else if (left.isBigInt()) { - if (right.isBigInt()) { - res.setBigInt(left.bigint + right.bigint); - } - } else if (left.isWrapped()) { - if (left.postfix && left.postfix.isString() && right.isString()) { - // ("prefix" + inner + "postfix") + "right" - // => ("prefix" + inner + "postfixRight") - res.setWrapped( - left.prefix, - new BasicEvaluatedExpression() - .setString(left.postfix.string + right.string) - .setRange(joinRanges(left.postfix.range, right.range)), - left.wrappedInnerExpressions - ); - } else if ( - left.postfix && - left.postfix.isString() && - right.isNumber() - ) { - // ("prefix" + inner + "postfix") + 123 - // => ("prefix" + inner + "postfix123") - res.setWrapped( - left.prefix, - new BasicEvaluatedExpression() - .setString(left.postfix.string + right.number) - .setRange(joinRanges(left.postfix.range, right.range)), - left.wrappedInnerExpressions - ); - } else if (right.isString()) { - // ("prefix" + inner + [null]) + "right" - // => ("prefix" + inner + "right") - res.setWrapped(left.prefix, right, left.wrappedInnerExpressions); - } else if (right.isNumber()) { - // ("prefix" + inner + [null]) + 123 - // => ("prefix" + inner + "123") - res.setWrapped( - left.prefix, - new BasicEvaluatedExpression() - .setString(right.number + "") - .setRange(right.range), - left.wrappedInnerExpressions - ); - } else if (right.isWrapped()) { - // ("prefix1" + inner1 + "postfix1") + ("prefix2" + inner2 + "postfix2") - // ("prefix1" + inner1 + "postfix1" + "prefix2" + inner2 + "postfix2") - res.setWrapped( - left.prefix, - right.postfix, - left.wrappedInnerExpressions && - right.wrappedInnerExpressions && - left.wrappedInnerExpressions - .concat(left.postfix ? [left.postfix] : []) - .concat(right.prefix ? [right.prefix] : []) - .concat(right.wrappedInnerExpressions) - ); - } else { - // ("prefix" + inner + postfix) + expr - // => ("prefix" + inner + postfix + expr + [null]) - res.setWrapped( - left.prefix, - null, - left.wrappedInnerExpressions && - left.wrappedInnerExpressions.concat( - left.postfix ? [left.postfix, right] : [right] - ) - ); - } - } else { - if (right.isString()) { - // left + "right" - // => ([null] + left + "right") - res.setWrapped(null, right, [left]); - } else if (right.isWrapped()) { - // left + (prefix + inner + "postfix") - // => ([null] + left + prefix + inner + "postfix") - res.setWrapped( - null, - right.postfix, - right.wrappedInnerExpressions && - (right.prefix ? [left, right.prefix] : [left]).concat( - right.wrappedInnerExpressions - ) - ); - } else { - return; + if (m.isOptional(moduleGraph)) { + expr = `(function webpackLoadOptionalExternalModule() { try { return ${expr}; } catch(e) {} }())`; } - } - if (left.couldHaveSideEffects() || right.couldHaveSideEffects()) - res.setSideEffects(); - res.setRange(expr.range); - return res; - } else if (expr.operator === "-") { - return handleConstOperation((l, r) => l - r); - } else if (expr.operator === "*") { - return handleConstOperation((l, r) => l * r); - } else if (expr.operator === "/") { - return handleConstOperation((l, r) => l / r); - } else if (expr.operator === "**") { - return handleConstOperation((l, r) => l ** r); - } else if (expr.operator === "===") { - return handleStrictEqualityComparison(true); - } else if (expr.operator === "==") { - return handleAbstractEqualityComparison(true); - } else if (expr.operator === "!==") { - return handleStrictEqualityComparison(false); - } else if (expr.operator === "!=") { - return handleAbstractEqualityComparison(false); - } else if (expr.operator === "&") { - return handleConstOperation((l, r) => l & r); - } else if (expr.operator === "|") { - return handleConstOperation((l, r) => l | r); - } else if (expr.operator === "^") { - return handleConstOperation((l, r) => l ^ r); - } else if (expr.operator === ">>>") { - return handleConstOperation((l, r) => l >>> r); - } else if (expr.operator === ">>") { - return handleConstOperation((l, r) => l >> r); - } else if (expr.operator === "<<") { - return handleConstOperation((l, r) => l << r); - } else if (expr.operator === "<") { - return handleConstOperation((l, r) => l < r); - } else if (expr.operator === ">") { - return handleConstOperation((l, r) => l > r); - } else if (expr.operator === "<=") { - return handleConstOperation((l, r) => l <= r); - } else if (expr.operator === ">=") { - return handleConstOperation((l, r) => l >= r); - } - }); - this.hooks.evaluate - .for("UnaryExpression") - .tap("JavascriptParser", _expr => { - const expr = /** @type {UnaryExpressionNode} */ (_expr); - - const handleConstOperation = fn => { - const argument = this.evaluateExpression(expr.argument); - if (!argument || !argument.isCompileTimeValue()) return; - const result = fn(argument.asCompileTimeValue()); - return valueAsExpression( - result, - expr, - argument.couldHaveSideEffects() - ); - }; + return expr; + }) + .join(", ") + ); + }; - if (expr.operator === "typeof") { - switch (expr.argument.type) { - case "Identifier": { - const res = this.callHooksForName( - this.hooks.evaluateTypeof, - expr.argument.name, - expr - ); - if (res !== undefined) return res; - break; - } - case "MetaProperty": { - const res = this.callHooksForName( - this.hooks.evaluateTypeof, - getRootName(expr.argument), - expr - ); - if (res !== undefined) return res; - break; - } - case "MemberExpression": { - const res = this.callHooksForExpression( - this.hooks.evaluateTypeof, - expr.argument, - expr - ); - if (res !== undefined) return res; - break; - } - case "ChainExpression": { - const res = this.callHooksForExpression( - this.hooks.evaluateTypeof, - expr.argument.expression, - expr - ); - if (res !== undefined) return res; - break; - } - case "FunctionExpression": { - return new BasicEvaluatedExpression() - .setString("function") - .setRange(expr.range); - } - } - const arg = this.evaluateExpression(expr.argument); - if (arg.isUnknown()) return; - if (arg.isString()) { - return new BasicEvaluatedExpression() - .setString("string") - .setRange(expr.range); - } - if (arg.isWrapped()) { - return new BasicEvaluatedExpression() - .setString("string") - .setSideEffects() - .setRange(expr.range); - } - if (arg.isUndefined()) { - return new BasicEvaluatedExpression() - .setString("undefined") - .setRange(expr.range); - } - if (arg.isNumber()) { - return new BasicEvaluatedExpression() - .setString("number") - .setRange(expr.range); - } - if (arg.isBigInt()) { - return new BasicEvaluatedExpression() - .setString("bigint") - .setRange(expr.range); - } - if (arg.isBoolean()) { - return new BasicEvaluatedExpression() - .setString("boolean") - .setRange(expr.range); - } - if (arg.isConstArray() || arg.isRegExp() || arg.isNull()) { - return new BasicEvaluatedExpression() - .setString("object") - .setRange(expr.range); - } - if (arg.isArray()) { - return new BasicEvaluatedExpression() - .setString("object") - .setSideEffects(arg.couldHaveSideEffects()) - .setRange(expr.range); - } - } else if (expr.operator === "!") { - const argument = this.evaluateExpression(expr.argument); - if (!argument) return; - const bool = argument.asBool(); - if (typeof bool !== "boolean") return; - return new BasicEvaluatedExpression() - .setBoolean(!bool) - .setSideEffects(argument.couldHaveSideEffects()) - .setRange(expr.range); - } else if (expr.operator === "~") { - return handleConstOperation(v => ~v); - } else if (expr.operator === "+") { - return handleConstOperation(v => +v); - } else if (expr.operator === "-") { - return handleConstOperation(v => -v); - } - }); - this.hooks.evaluateTypeof.for("undefined").tap("JavascriptParser", expr => { - return new BasicEvaluatedExpression() - .setString("undefined") - .setRange(expr.range); - }); - this.hooks.evaluate.for("Identifier").tap("JavascriptParser", expr => { - if (/** @type {IdentifierNode} */ (expr).name === "undefined") { - return new BasicEvaluatedExpression() - .setUndefined() - .setRange(expr.range); - } - }); - /** - * @param {string} exprType expression type name - * @param {function(ExpressionNode): GetInfoResult | undefined} getInfo get info - * @returns {void} - */ - const tapEvaluateWithVariableInfo = (exprType, getInfo) => { - /** @type {ExpressionNode | undefined} */ - let cachedExpression = undefined; - /** @type {GetInfoResult | undefined} */ - let cachedInfo = undefined; - this.hooks.evaluate.for(exprType).tap("JavascriptParser", expr => { - const expression = /** @type {MemberExpressionNode} */ (expr); + const externalsArguments = modules => { + return modules + .map( + m => + `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( + `${chunkGraph.getModuleId(m)}` + )}__` + ) + .join(", "); + }; - const info = getInfo(expr); - if (info !== undefined) { - return this.callHooksForInfoWithFallback( - this.hooks.evaluateIdentifier, - info.name, - name => { - cachedExpression = expression; - cachedInfo = info; - }, - name => { - const hook = this.hooks.evaluateDefinedIdentifier.get(name); - if (hook !== undefined) { - return hook.call(expression); - } - }, - expression - ); - } - }); - this.hooks.evaluate - .for(exprType) - .tap({ name: "JavascriptParser", stage: 100 }, expr => { - const info = cachedExpression === expr ? cachedInfo : getInfo(expr); - if (info !== undefined) { - return new BasicEvaluatedExpression() - .setIdentifier(info.name, info.rootInfo, info.getMembers) - .setRange(expr.range); - } - }); - this.hooks.finish.tap("JavascriptParser", () => { - // Cleanup for GC - cachedExpression = cachedInfo = undefined; - }); + const libraryName = library => { + return JSON.stringify(replaceKeys([].concat(library).pop())); }; - tapEvaluateWithVariableInfo("Identifier", expr => { - const info = this.getVariableInfo( - /** @type {IdentifierNode} */ (expr).name - ); - if ( - typeof info === "string" || - (info instanceof VariableInfo && typeof info.freeName === "string") - ) { - return { name: info, rootInfo: info, getMembers: () => [] }; - } - }); - tapEvaluateWithVariableInfo("ThisExpression", expr => { - const info = this.getVariableInfo("this"); - if ( - typeof info === "string" || - (info instanceof VariableInfo && typeof info.freeName === "string") - ) { - return { name: info, rootInfo: info, getMembers: () => [] }; + + let amdFactory; + if (optionalExternals.length > 0) { + const wrapperArguments = externalsArguments(requiredExternals); + const factoryArguments = + requiredExternals.length > 0 + ? externalsArguments(requiredExternals) + + ", " + + externalsRootArray(optionalExternals) + : externalsRootArray(optionalExternals); + amdFactory = + `function webpackLoadOptionalExternalModuleAmd(${wrapperArguments}) {\n` + + ` return factory(${factoryArguments});\n` + + " }"; + } else { + amdFactory = "factory"; + } + + const { auxiliaryComment, namedDefine, names } = options; + + const getAuxiliaryComment = type => { + if (auxiliaryComment) { + if (typeof auxiliaryComment === "string") + return "\t//" + auxiliaryComment + "\n"; + if (auxiliaryComment[type]) + return "\t//" + auxiliaryComment[type] + "\n"; } - }); - this.hooks.evaluate.for("MetaProperty").tap("JavascriptParser", expr => { - const metaProperty = /** @type {MetaPropertyNode} */ (expr); + return ""; + }; - return this.callHooksForName( - this.hooks.evaluateIdentifier, - getRootName(expr), - metaProperty - ); - }); - tapEvaluateWithVariableInfo("MemberExpression", expr => - this.getMemberExpressionInfo( - /** @type {MemberExpressionNode} */ (expr), - ALLOWED_MEMBER_TYPES_EXPRESSION - ) + return new ConcatSource( + new OriginalSource( + "(function webpackUniversalModuleDefinition(root, factory) {\n" + + getAuxiliaryComment("commonjs2") + + " if(typeof exports === 'object' && typeof module === 'object')\n" + + " module.exports = factory(" + + externalsRequireArray("commonjs2") + + ");\n" + + getAuxiliaryComment("amd") + + " else if(typeof define === 'function' && define.amd)\n" + + (requiredExternals.length > 0 + ? names.amd && namedDefine === true + ? " define(" + + libraryName(names.amd) + + ", " + + externalsDepsArray(requiredExternals) + + ", " + + amdFactory + + ");\n" + : " define(" + + externalsDepsArray(requiredExternals) + + ", " + + amdFactory + + ");\n" + : names.amd && namedDefine === true + ? " define(" + + libraryName(names.amd) + + ", [], " + + amdFactory + + ");\n" + : " define([], " + amdFactory + ");\n") + + (names.root || names.commonjs + ? getAuxiliaryComment("commonjs") + + " else if(typeof exports === 'object')\n" + + " exports[" + + libraryName(names.commonjs || names.root) + + "] = factory(" + + externalsRequireArray("commonjs") + + ");\n" + + getAuxiliaryComment("root") + + " else\n" + + " " + + replaceKeys( + accessorAccess("root", names.root || names.commonjs) + ) + + " = factory(" + + externalsRootArray(externals) + + ");\n" + : " else {\n" + + (externals.length > 0 + ? " var a = typeof exports === 'object' ? factory(" + + externalsRequireArray("commonjs") + + ") : factory(" + + externalsRootArray(externals) + + ");\n" + : " var a = factory();\n") + + " for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n" + + " }\n") + + `})(${ + runtimeTemplate.outputOptions.globalObject + }, function(${externalsArguments(externals)}) {\nreturn `, + "webpack/universalModuleDefinition" + ), + source, + ";\n})" ); + } +} - this.hooks.evaluate.for("CallExpression").tap("JavascriptParser", _expr => { - const expr = /** @type {CallExpressionNode} */ (_expr); - if ( - expr.callee.type !== "MemberExpression" || - expr.callee.property.type !== - (expr.callee.computed ? "Literal" : "Identifier") - ) { - return; - } +module.exports = UmdLibraryPlugin; - // type Super also possible here - const param = this.evaluateExpression( - /** @type {ExpressionNode} */ (expr.callee.object) - ); - if (!param) return; - const property = - expr.callee.property.type === "Literal" - ? `${expr.callee.property.value}` - : expr.callee.property.name; - const hook = this.hooks.evaluateCallExpressionMember.get(property); - if (hook !== undefined) { - return hook.call(expr, param); - } - }); - this.hooks.evaluateCallExpressionMember - .for("indexOf") - .tap("JavascriptParser", (expr, param) => { - if (!param.isString()) return; - if (expr.arguments.length === 0) return; - const [arg1, arg2] = expr.arguments; - if (arg1.type === "SpreadElement") return; - const arg1Eval = this.evaluateExpression(arg1); - if (!arg1Eval.isString()) return; - const arg1Value = arg1Eval.string; - let result; - if (arg2) { - if (arg2.type === "SpreadElement") return; - const arg2Eval = this.evaluateExpression(arg2); - if (!arg2Eval.isNumber()) return; - result = param.string.indexOf(arg1Value, arg2Eval.number); - } else { - result = param.string.indexOf(arg1Value); - } - return new BasicEvaluatedExpression() - .setNumber(result) - .setSideEffects(param.couldHaveSideEffects()) - .setRange(expr.range); - }); - this.hooks.evaluateCallExpressionMember - .for("replace") - .tap("JavascriptParser", (expr, param) => { - if (!param.isString()) return; - if (expr.arguments.length !== 2) return; - if (expr.arguments[0].type === "SpreadElement") return; - if (expr.arguments[1].type === "SpreadElement") return; - let arg1 = this.evaluateExpression(expr.arguments[0]); - let arg2 = this.evaluateExpression(expr.arguments[1]); - if (!arg1.isString() && !arg1.isRegExp()) return; - const arg1Value = arg1.regExp || arg1.string; - if (!arg2.isString()) return; - const arg2Value = arg2.string; - return new BasicEvaluatedExpression() - .setString(param.string.replace(arg1Value, arg2Value)) - .setSideEffects(param.couldHaveSideEffects()) - .setRange(expr.range); - }); - ["substr", "substring", "slice"].forEach(fn => { - this.hooks.evaluateCallExpressionMember - .for(fn) - .tap("JavascriptParser", (expr, param) => { - if (!param.isString()) return; - let arg1; - let result, - str = param.string; - switch (expr.arguments.length) { - case 1: - if (expr.arguments[0].type === "SpreadElement") return; - arg1 = this.evaluateExpression(expr.arguments[0]); - if (!arg1.isNumber()) return; - result = str[fn](arg1.number); - break; - case 2: { - if (expr.arguments[0].type === "SpreadElement") return; - if (expr.arguments[1].type === "SpreadElement") return; - arg1 = this.evaluateExpression(expr.arguments[0]); - const arg2 = this.evaluateExpression(expr.arguments[1]); - if (!arg1.isNumber()) return; - if (!arg2.isNumber()) return; - result = str[fn](arg1.number, arg2.number); - break; - } - default: - return; - } - return new BasicEvaluatedExpression() - .setString(result) - .setSideEffects(param.couldHaveSideEffects()) - .setRange(expr.range); - }); - }); +/***/ }), - /** - * @param {"cooked" | "raw"} kind kind of values to get - * @param {TemplateLiteralNode} templateLiteralExpr TemplateLiteral expr - * @returns {{quasis: BasicEvaluatedExpression[], parts: BasicEvaluatedExpression[]}} Simplified template - */ - const getSimplifiedTemplateResult = (kind, templateLiteralExpr) => { - /** @type {BasicEvaluatedExpression[]} */ - const quasis = []; - /** @type {BasicEvaluatedExpression[]} */ - const parts = []; +/***/ 32597: +/***/ (function(__unused_webpack_module, exports) { - for (let i = 0; i < templateLiteralExpr.quasis.length; i++) { - const quasiExpr = templateLiteralExpr.quasis[i]; - const quasi = quasiExpr.value[kind]; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (i > 0) { - const prevExpr = parts[parts.length - 1]; - const expr = this.evaluateExpression( - templateLiteralExpr.expressions[i - 1] - ); - const exprAsString = expr.asString(); - if ( - typeof exprAsString === "string" && - !expr.couldHaveSideEffects() - ) { - // We can merge quasi + expr + quasi when expr - // is a const string - prevExpr.setString(prevExpr.string + exprAsString + quasi); - prevExpr.setRange([prevExpr.range[0], quasiExpr.range[1]]); - // We unset the expression as it doesn't match to a single expression - prevExpr.setExpression(undefined); - continue; - } - parts.push(expr); - } - const part = new BasicEvaluatedExpression() - .setString(quasi) - .setRange(quasiExpr.range) - .setExpression(quasiExpr); - quasis.push(part); - parts.push(part); - } - return { - quasis, - parts - }; - }; +const LogType = Object.freeze({ + error: /** @type {"error"} */ ("error"), // message, c style arguments + warn: /** @type {"warn"} */ ("warn"), // message, c style arguments + info: /** @type {"info"} */ ("info"), // message, c style arguments + log: /** @type {"log"} */ ("log"), // message, c style arguments + debug: /** @type {"debug"} */ ("debug"), // message, c style arguments - this.hooks.evaluate - .for("TemplateLiteral") - .tap("JavascriptParser", _node => { - const node = /** @type {TemplateLiteralNode} */ (_node); + trace: /** @type {"trace"} */ ("trace"), // no arguments - const { quasis, parts } = getSimplifiedTemplateResult("cooked", node); - if (parts.length === 1) { - return parts[0].setRange(node.range); - } - return new BasicEvaluatedExpression() - .setTemplateString(quasis, parts, "cooked") - .setRange(node.range); - }); - this.hooks.evaluate - .for("TaggedTemplateExpression") - .tap("JavascriptParser", _node => { - const node = /** @type {TaggedTemplateExpressionNode} */ (_node); - const tag = this.evaluateExpression(node.tag); + group: /** @type {"group"} */ ("group"), // [label] + groupCollapsed: /** @type {"groupCollapsed"} */ ("groupCollapsed"), // [label] + groupEnd: /** @type {"groupEnd"} */ ("groupEnd"), // [label] - if (tag.isIdentifier() && tag.identifier === "String.raw") { - const { quasis, parts } = getSimplifiedTemplateResult( - "raw", - node.quasi - ); - return new BasicEvaluatedExpression() - .setTemplateString(quasis, parts, "raw") - .setRange(node.range); - } - }); + profile: /** @type {"profile"} */ ("profile"), // [profileName] + profileEnd: /** @type {"profileEnd"} */ ("profileEnd"), // [profileName] - this.hooks.evaluateCallExpressionMember - .for("concat") - .tap("JavascriptParser", (expr, param) => { - if (!param.isString() && !param.isWrapped()) return; + time: /** @type {"time"} */ ("time"), // name, time as [seconds, nanoseconds] - let stringSuffix = null; - let hasUnknownParams = false; - const innerExpressions = []; - for (let i = expr.arguments.length - 1; i >= 0; i--) { - const arg = expr.arguments[i]; - if (arg.type === "SpreadElement") return; - const argExpr = this.evaluateExpression(arg); - if ( - hasUnknownParams || - (!argExpr.isString() && !argExpr.isNumber()) - ) { - hasUnknownParams = true; - innerExpressions.push(argExpr); - continue; - } + clear: /** @type {"clear"} */ ("clear"), // no arguments + status: /** @type {"status"} */ ("status") // message, arguments +}); - const value = argExpr.isString() - ? argExpr.string - : "" + argExpr.number; +exports.LogType = LogType; - const newString = value + (stringSuffix ? stringSuffix.string : ""); - const newRange = [ - argExpr.range[0], - (stringSuffix || argExpr).range[1] - ]; - stringSuffix = new BasicEvaluatedExpression() - .setString(newString) - .setSideEffects( - (stringSuffix && stringSuffix.couldHaveSideEffects()) || - argExpr.couldHaveSideEffects() - ) - .setRange(newRange); - } +/** @typedef {typeof LogType[keyof typeof LogType]} LogTypeEnum */ - if (hasUnknownParams) { - const prefix = param.isString() ? param : param.prefix; - const inner = - param.isWrapped() && param.wrappedInnerExpressions - ? param.wrappedInnerExpressions.concat(innerExpressions.reverse()) - : innerExpressions.reverse(); - return new BasicEvaluatedExpression() - .setWrapped(prefix, stringSuffix, inner) - .setRange(expr.range); - } else if (param.isWrapped()) { - const postfix = stringSuffix || param.postfix; - const inner = param.wrappedInnerExpressions - ? param.wrappedInnerExpressions.concat(innerExpressions.reverse()) - : innerExpressions.reverse(); - return new BasicEvaluatedExpression() - .setWrapped(param.prefix, postfix, inner) - .setRange(expr.range); - } else { - const newString = - param.string + (stringSuffix ? stringSuffix.string : ""); - return new BasicEvaluatedExpression() - .setString(newString) - .setSideEffects( - (stringSuffix && stringSuffix.couldHaveSideEffects()) || - param.couldHaveSideEffects() - ) - .setRange(expr.range); - } - }); - this.hooks.evaluateCallExpressionMember - .for("split") - .tap("JavascriptParser", (expr, param) => { - if (!param.isString()) return; - if (expr.arguments.length !== 1) return; - if (expr.arguments[0].type === "SpreadElement") return; - let result; - const arg = this.evaluateExpression(expr.arguments[0]); - if (arg.isString()) { - result = param.string.split(arg.string); - } else if (arg.isRegExp()) { - result = param.string.split(arg.regExp); - } else { - return; - } - return new BasicEvaluatedExpression() - .setArray(result) - .setSideEffects(param.couldHaveSideEffects()) - .setRange(expr.range); - }); - this.hooks.evaluate - .for("ConditionalExpression") - .tap("JavascriptParser", _expr => { - const expr = /** @type {ConditionalExpressionNode} */ (_expr); +const LOG_SYMBOL = Symbol("webpack logger raw log method"); +const TIMERS_SYMBOL = Symbol("webpack logger times"); +const TIMERS_AGGREGATES_SYMBOL = Symbol("webpack logger aggregated times"); - const condition = this.evaluateExpression(expr.test); - const conditionValue = condition.asBool(); - let res; - if (conditionValue === undefined) { - const consequent = this.evaluateExpression(expr.consequent); - const alternate = this.evaluateExpression(expr.alternate); - if (!consequent || !alternate) return; - res = new BasicEvaluatedExpression(); - if (consequent.isConditional()) { - res.setOptions(consequent.options); - } else { - res.setOptions([consequent]); - } - if (alternate.isConditional()) { - res.addOptions(alternate.options); - } else { - res.addOptions([alternate]); - } - } else { - res = this.evaluateExpression( - conditionValue ? expr.consequent : expr.alternate - ); - if (condition.couldHaveSideEffects()) res.setSideEffects(); - } - res.setRange(expr.range); - return res; - }); - this.hooks.evaluate - .for("ArrayExpression") - .tap("JavascriptParser", _expr => { - const expr = /** @type {ArrayExpressionNode} */ (_expr); +class WebpackLogger { + /** + * @param {function(LogTypeEnum, any[]=): void} log log function + * @param {function(string | function(): string): WebpackLogger} getChildLogger function to create child logger + */ + constructor(log, getChildLogger) { + this[LOG_SYMBOL] = log; + this.getChildLogger = getChildLogger; + } - const items = expr.elements.map(element => { - return ( - element !== null && - element.type !== "SpreadElement" && - this.evaluateExpression(element) - ); - }); - if (!items.every(Boolean)) return; - return new BasicEvaluatedExpression() - .setItems(items) - .setRange(expr.range); - }); - this.hooks.evaluate - .for("ChainExpression") - .tap("JavascriptParser", _expr => { - const expr = /** @type {ChainExpressionNode} */ (_expr); - /** @type {ExpressionNode[]} */ - const optionalExpressionsStack = []; - /** @type {ExpressionNode|SuperNode} */ - let next = expr.expression; + error(...args) { + this[LOG_SYMBOL](LogType.error, args); + } - while ( - next.type === "MemberExpression" || - next.type === "CallExpression" - ) { - if (next.type === "MemberExpression") { - if (next.optional) { - // SuperNode can not be optional - optionalExpressionsStack.push( - /** @type {ExpressionNode} */ (next.object) - ); - } - next = next.object; - } else { - if (next.optional) { - // SuperNode can not be optional - optionalExpressionsStack.push( - /** @type {ExpressionNode} */ (next.callee) - ); - } - next = next.callee; - } - } + warn(...args) { + this[LOG_SYMBOL](LogType.warn, args); + } - while (optionalExpressionsStack.length > 0) { - const expression = optionalExpressionsStack.pop(); - const evaluated = this.evaluateExpression(expression); + info(...args) { + this[LOG_SYMBOL](LogType.info, args); + } - if (evaluated && evaluated.asNullish()) { - return evaluated.setRange(_expr.range); - } - } - return this.evaluateExpression(expr.expression); - }); + log(...args) { + this[LOG_SYMBOL](LogType.log, args); } - getRenameIdentifier(expr) { - const result = this.evaluateExpression(expr); - if (result && result.isIdentifier()) { - return result.identifier; - } + debug(...args) { + this[LOG_SYMBOL](LogType.debug, args); } - /** - * @param {ClassExpressionNode | ClassDeclarationNode} classy a class node - * @returns {void} - */ - walkClass(classy) { - if (classy.superClass) { - if (!this.hooks.classExtendsExpression.call(classy.superClass, classy)) { - this.walkExpression(classy.superClass); - } - } - if (classy.body && classy.body.type === "ClassBody") { - for (const classElement of /** @type {TODO} */ (classy.body.body)) { - if (!this.hooks.classBodyElement.call(classElement, classy)) { - if (classElement.computed && classElement.key) { - this.walkExpression(classElement.key); - } - if (classElement.value) { - if ( - !this.hooks.classBodyValue.call( - classElement.value, - classElement, - classy - ) - ) { - const wasTopLevel = this.scope.topLevelScope; - this.scope.topLevelScope = false; - this.walkExpression(classElement.value); - this.scope.topLevelScope = wasTopLevel; - } - } - } - } + assert(assertion, ...args) { + if (!assertion) { + this[LOG_SYMBOL](LogType.error, args); } } - // Pre walking iterates the scope for variable declarations - preWalkStatements(statements) { - for (let index = 0, len = statements.length; index < len; index++) { - const statement = statements[index]; - this.preWalkStatement(statement); - } + trace() { + this[LOG_SYMBOL](LogType.trace, ["Trace"]); } - // Block pre walking iterates the scope for block variable declarations - blockPreWalkStatements(statements) { - for (let index = 0, len = statements.length; index < len; index++) { - const statement = statements[index]; - this.blockPreWalkStatement(statement); - } + clear() { + this[LOG_SYMBOL](LogType.clear); } - // Walking iterates the statements and expressions and processes them - walkStatements(statements) { - for (let index = 0, len = statements.length; index < len; index++) { - const statement = statements[index]; - this.walkStatement(statement); - } + status(...args) { + this[LOG_SYMBOL](LogType.status, args); } - preWalkStatement(statement) { - this.statementPath.push(statement); - if (this.hooks.preStatement.call(statement)) { - this.prevStatement = this.statementPath.pop(); - return; - } - switch (statement.type) { - case "BlockStatement": - this.preWalkBlockStatement(statement); - break; - case "DoWhileStatement": - this.preWalkDoWhileStatement(statement); - break; - case "ForInStatement": - this.preWalkForInStatement(statement); - break; - case "ForOfStatement": - this.preWalkForOfStatement(statement); - break; - case "ForStatement": - this.preWalkForStatement(statement); - break; - case "FunctionDeclaration": - this.preWalkFunctionDeclaration(statement); - break; - case "IfStatement": - this.preWalkIfStatement(statement); - break; - case "LabeledStatement": - this.preWalkLabeledStatement(statement); - break; - case "SwitchStatement": - this.preWalkSwitchStatement(statement); - break; - case "TryStatement": - this.preWalkTryStatement(statement); - break; - case "VariableDeclaration": - this.preWalkVariableDeclaration(statement); - break; - case "WhileStatement": - this.preWalkWhileStatement(statement); - break; - case "WithStatement": - this.preWalkWithStatement(statement); - break; - } - this.prevStatement = this.statementPath.pop(); + group(...args) { + this[LOG_SYMBOL](LogType.group, args); } - blockPreWalkStatement(statement) { - this.statementPath.push(statement); - if (this.hooks.blockPreStatement.call(statement)) { - this.prevStatement = this.statementPath.pop(); - return; - } - switch (statement.type) { - case "ImportDeclaration": - this.blockPreWalkImportDeclaration(statement); - break; - case "ExportAllDeclaration": - this.blockPreWalkExportAllDeclaration(statement); - break; - case "ExportDefaultDeclaration": - this.blockPreWalkExportDefaultDeclaration(statement); - break; - case "ExportNamedDeclaration": - this.blockPreWalkExportNamedDeclaration(statement); - break; - case "VariableDeclaration": - this.blockPreWalkVariableDeclaration(statement); - break; - case "ClassDeclaration": - this.blockPreWalkClassDeclaration(statement); - break; + groupCollapsed(...args) { + this[LOG_SYMBOL](LogType.groupCollapsed, args); + } + + groupEnd(...args) { + this[LOG_SYMBOL](LogType.groupEnd, args); + } + + profile(label) { + this[LOG_SYMBOL](LogType.profile, [label]); + } + + profileEnd(label) { + this[LOG_SYMBOL](LogType.profileEnd, [label]); + } + + time(label) { + this[TIMERS_SYMBOL] = this[TIMERS_SYMBOL] || new Map(); + this[TIMERS_SYMBOL].set(label, process.hrtime()); + } + + timeLog(label) { + const prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label); + if (!prev) { + throw new Error(`No such label '${label}' for WebpackLogger.timeLog()`); } - this.prevStatement = this.statementPath.pop(); + const time = process.hrtime(prev); + this[LOG_SYMBOL](LogType.time, [label, ...time]); } - walkStatement(statement) { - this.statementPath.push(statement); - if (this.hooks.statement.call(statement) !== undefined) { - this.prevStatement = this.statementPath.pop(); - return; + timeEnd(label) { + const prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label); + if (!prev) { + throw new Error(`No such label '${label}' for WebpackLogger.timeEnd()`); } - switch (statement.type) { - case "BlockStatement": - this.walkBlockStatement(statement); - break; - case "ClassDeclaration": - this.walkClassDeclaration(statement); - break; - case "DoWhileStatement": - this.walkDoWhileStatement(statement); - break; - case "ExportDefaultDeclaration": - this.walkExportDefaultDeclaration(statement); - break; - case "ExportNamedDeclaration": - this.walkExportNamedDeclaration(statement); - break; - case "ExpressionStatement": - this.walkExpressionStatement(statement); - break; - case "ForInStatement": - this.walkForInStatement(statement); + const time = process.hrtime(prev); + this[TIMERS_SYMBOL].delete(label); + this[LOG_SYMBOL](LogType.time, [label, ...time]); + } + + timeAggregate(label) { + const prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label); + if (!prev) { + throw new Error( + `No such label '${label}' for WebpackLogger.timeAggregate()` + ); + } + const time = process.hrtime(prev); + this[TIMERS_SYMBOL].delete(label); + this[TIMERS_AGGREGATES_SYMBOL] = + this[TIMERS_AGGREGATES_SYMBOL] || new Map(); + const current = this[TIMERS_AGGREGATES_SYMBOL].get(label); + if (current !== undefined) { + if (time[1] + current[1] > 1e9) { + time[0] += current[0] + 1; + time[1] = time[1] - 1e9 + current[1]; + } else { + time[0] += current[0]; + time[1] += current[1]; + } + } + this[TIMERS_AGGREGATES_SYMBOL].set(label, time); + } + + timeAggregateEnd(label) { + if (this[TIMERS_AGGREGATES_SYMBOL] === undefined) return; + const time = this[TIMERS_AGGREGATES_SYMBOL].get(label); + if (time === undefined) return; + this[TIMERS_AGGREGATES_SYMBOL].delete(label); + this[LOG_SYMBOL](LogType.time, [label, ...time]); + } +} + +exports.Logger = WebpackLogger; + + +/***/ }), + +/***/ 54963: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { LogType } = __webpack_require__(32597); + +/** @typedef {import("../../declarations/WebpackOptions").FilterItemTypes} FilterItemTypes */ +/** @typedef {import("../../declarations/WebpackOptions").FilterTypes} FilterTypes */ +/** @typedef {import("./Logger").LogTypeEnum} LogTypeEnum */ + +/** @typedef {function(string): boolean} FilterFunction */ + +/** + * @typedef {Object} LoggerConsole + * @property {function(): void} clear + * @property {function(): void} trace + * @property {(...args: any[]) => void} info + * @property {(...args: any[]) => void} log + * @property {(...args: any[]) => void} warn + * @property {(...args: any[]) => void} error + * @property {(...args: any[]) => void=} debug + * @property {(...args: any[]) => void=} group + * @property {(...args: any[]) => void=} groupCollapsed + * @property {(...args: any[]) => void=} groupEnd + * @property {(...args: any[]) => void=} status + * @property {(...args: any[]) => void=} profile + * @property {(...args: any[]) => void=} profileEnd + * @property {(...args: any[]) => void=} logTime + */ + +/** + * @typedef {Object} LoggerOptions + * @property {false|true|"none"|"error"|"warn"|"info"|"log"|"verbose"} level loglevel + * @property {FilterTypes|boolean} debug filter for debug logging + * @property {LoggerConsole} console the console to log to + */ + +/** + * @param {FilterItemTypes} item an input item + * @returns {FilterFunction} filter function + */ +const filterToFunction = item => { + if (typeof item === "string") { + const regExp = new RegExp( + `[\\\\/]${item.replace( + // eslint-disable-next-line no-useless-escape + /[-[\]{}()*+?.\\^$|]/g, + "\\$&" + )}([\\\\/]|$|!|\\?)` + ); + return ident => regExp.test(ident); + } + if (item && typeof item === "object" && typeof item.test === "function") { + return ident => item.test(ident); + } + if (typeof item === "function") { + return item; + } + if (typeof item === "boolean") { + return () => item; + } +}; + +/** + * @enum {number} + */ +const LogLevel = { + none: 6, + false: 6, + error: 5, + warn: 4, + info: 3, + log: 2, + true: 2, + verbose: 1 +}; + +/** + * @param {LoggerOptions} options options object + * @returns {function(string, LogTypeEnum, any[]): void} logging function + */ +module.exports = ({ level = "info", debug = false, console }) => { + const debugFilters = + typeof debug === "boolean" + ? [() => debug] + : /** @type {FilterItemTypes[]} */ ([]) + .concat(debug) + .map(filterToFunction); + /** @type {number} */ + const loglevel = LogLevel[`${level}`] || 0; + + /** + * @param {string} name name of the logger + * @param {LogTypeEnum} type type of the log entry + * @param {any[]} args arguments of the log entry + * @returns {void} + */ + const logger = (name, type, args) => { + const labeledArgs = () => { + if (Array.isArray(args)) { + if (args.length > 0 && typeof args[0] === "string") { + return [`[${name}] ${args[0]}`, ...args.slice(1)]; + } else { + return [`[${name}]`, ...args]; + } + } else { + return []; + } + }; + const debug = debugFilters.some(f => f(name)); + switch (type) { + case LogType.debug: + if (!debug) return; + // eslint-disable-next-line node/no-unsupported-features/node-builtins + if (typeof console.debug === "function") { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.debug(...labeledArgs()); + } else { + console.log(...labeledArgs()); + } break; - case "ForOfStatement": - this.walkForOfStatement(statement); + case LogType.log: + if (!debug && loglevel > LogLevel.log) return; + console.log(...labeledArgs()); break; - case "ForStatement": - this.walkForStatement(statement); + case LogType.info: + if (!debug && loglevel > LogLevel.info) return; + console.info(...labeledArgs()); break; - case "FunctionDeclaration": - this.walkFunctionDeclaration(statement); + case LogType.warn: + if (!debug && loglevel > LogLevel.warn) return; + console.warn(...labeledArgs()); break; - case "IfStatement": - this.walkIfStatement(statement); + case LogType.error: + if (!debug && loglevel > LogLevel.error) return; + console.error(...labeledArgs()); break; - case "LabeledStatement": - this.walkLabeledStatement(statement); + case LogType.trace: + if (!debug) return; + console.trace(); break; - case "ReturnStatement": - this.walkReturnStatement(statement); + case LogType.groupCollapsed: + if (!debug && loglevel > LogLevel.log) return; + if (!debug && loglevel > LogLevel.verbose) { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + if (typeof console.groupCollapsed === "function") { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.groupCollapsed(...labeledArgs()); + } else { + console.log(...labeledArgs()); + } + break; + } + // falls through + case LogType.group: + if (!debug && loglevel > LogLevel.log) return; + // eslint-disable-next-line node/no-unsupported-features/node-builtins + if (typeof console.group === "function") { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.group(...labeledArgs()); + } else { + console.log(...labeledArgs()); + } break; - case "SwitchStatement": - this.walkSwitchStatement(statement); + case LogType.groupEnd: + if (!debug && loglevel > LogLevel.log) return; + // eslint-disable-next-line node/no-unsupported-features/node-builtins + if (typeof console.groupEnd === "function") { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.groupEnd(); + } break; - case "ThrowStatement": - this.walkThrowStatement(statement); + case LogType.time: { + if (!debug && loglevel > LogLevel.log) return; + const ms = args[1] * 1000 + args[2] / 1000000; + const msg = `[${name}] ${args[0]}: ${ms} ms`; + if (typeof console.logTime === "function") { + console.logTime(msg); + } else { + console.log(msg); + } break; - case "TryStatement": - this.walkTryStatement(statement); + } + case LogType.profile: + // eslint-disable-next-line node/no-unsupported-features/node-builtins + if (typeof console.profile === "function") { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.profile(...labeledArgs()); + } break; - case "VariableDeclaration": - this.walkVariableDeclaration(statement); + case LogType.profileEnd: + // eslint-disable-next-line node/no-unsupported-features/node-builtins + if (typeof console.profileEnd === "function") { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.profileEnd(...labeledArgs()); + } break; - case "WhileStatement": - this.walkWhileStatement(statement); + case LogType.clear: + if (!debug && loglevel > LogLevel.log) return; + // eslint-disable-next-line node/no-unsupported-features/node-builtins + if (typeof console.clear === "function") { + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.clear(); + } break; - case "WithStatement": - this.walkWithStatement(statement); + case LogType.status: + if (!debug && loglevel > LogLevel.info) return; + if (typeof console.status === "function") { + if (args.length === 0) { + console.status(); + } else { + console.status(...labeledArgs()); + } + } else { + if (args.length !== 0) { + console.info(...labeledArgs()); + } + } break; + default: + throw new Error(`Unexpected LogType ${type}`); } - this.prevStatement = this.statementPath.pop(); - } + }; + return logger; +}; - /** - * Walks a statements that is nested within a parent statement - * and can potentially be a non-block statement. - * This enforces the nested statement to never be in ASI position. - * @param {StatementNode} statement the nested statement - * @returns {void} - */ - walkNestedStatement(statement) { - this.prevStatement = undefined; - this.walkStatement(statement); - } - // Real Statements - preWalkBlockStatement(statement) { - this.preWalkStatements(statement.body); - } +/***/ }), - walkBlockStatement(statement) { - this.inBlockScope(() => { - const body = statement.body; - const prev = this.prevStatement; - this.blockPreWalkStatements(body); - this.prevStatement = prev; - this.walkStatements(body); - }); - } +/***/ 62090: +/***/ (function(module) { - walkExpressionStatement(statement) { - this.walkExpression(statement.expression); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - preWalkIfStatement(statement) { - this.preWalkStatement(statement.consequent); - if (statement.alternate) { - this.preWalkStatement(statement.alternate); - } - } - walkIfStatement(statement) { - const result = this.hooks.statementIf.call(statement); - if (result === undefined) { - this.walkExpression(statement.test); - this.walkNestedStatement(statement.consequent); - if (statement.alternate) { - this.walkNestedStatement(statement.alternate); - } - } else { - if (result) { - this.walkNestedStatement(statement.consequent); - } else if (statement.alternate) { - this.walkNestedStatement(statement.alternate); - } - } - } - preWalkLabeledStatement(statement) { - this.preWalkStatement(statement.body); - } +const arraySum = array => { + let sum = 0; + for (const item of array) sum += item; + return sum; +}; - walkLabeledStatement(statement) { - const hook = this.hooks.label.get(statement.label.name); - if (hook !== undefined) { - const result = hook.call(statement); - if (result === true) return; +/** + * @param {any[]} args items to be truncated + * @param {number} maxLength maximum length of args including spaces between + * @returns {string[]} truncated args + */ +const truncateArgs = (args, maxLength) => { + const lengths = args.map(a => `${a}`.length); + const availableLength = maxLength - lengths.length + 1; + + if (availableLength > 0 && args.length === 1) { + if (availableLength >= args[0].length) { + return args; + } else if (availableLength > 3) { + return ["..." + args[0].slice(-availableLength + 3)]; + } else { + return [args[0].slice(-availableLength)]; } - this.walkNestedStatement(statement.body); } - preWalkWithStatement(statement) { - this.preWalkStatement(statement.body); + // Check if there is space for at least 4 chars per arg + if (availableLength < arraySum(lengths.map(i => Math.min(i, 6)))) { + // remove args + if (args.length > 1) + return truncateArgs(args.slice(0, args.length - 1), maxLength); + return []; } - walkWithStatement(statement) { - this.walkExpression(statement.object); - this.walkNestedStatement(statement.body); - } + let currentLength = arraySum(lengths); - preWalkSwitchStatement(statement) { - this.preWalkSwitchCases(statement.cases); - } + // Check if all fits into maxLength + if (currentLength <= availableLength) return args; - walkSwitchStatement(statement) { - this.walkExpression(statement.discriminant); - this.walkSwitchCases(statement.cases); + // Try to remove chars from the longest items until it fits + while (currentLength > availableLength) { + const maxLength = Math.max(...lengths); + const shorterItems = lengths.filter(l => l !== maxLength); + const nextToMaxLength = + shorterItems.length > 0 ? Math.max(...shorterItems) : 0; + const maxReduce = maxLength - nextToMaxLength; + let maxItems = lengths.length - shorterItems.length; + let overrun = currentLength - availableLength; + for (let i = 0; i < lengths.length; i++) { + if (lengths[i] === maxLength) { + const reduce = Math.min(Math.floor(overrun / maxItems), maxReduce); + lengths[i] -= reduce; + currentLength -= reduce; + overrun -= reduce; + maxItems--; + } + } } - walkTerminatingStatement(statement) { - if (statement.argument) this.walkExpression(statement.argument); - } + // Return args reduced to length in lengths + return args.map((a, i) => { + const str = `${a}`; + const length = lengths[i]; + if (str.length === length) { + return str; + } else if (length > 5) { + return "..." + str.slice(-length + 3); + } else if (length > 0) { + return str.slice(-length); + } else { + return ""; + } + }); +}; - walkReturnStatement(statement) { - this.walkTerminatingStatement(statement); - } +module.exports = truncateArgs; - walkThrowStatement(statement) { - this.walkTerminatingStatement(statement); - } - preWalkTryStatement(statement) { - this.preWalkStatement(statement.block); - if (statement.handler) this.preWalkCatchClause(statement.handler); - if (statement.finializer) this.preWalkStatement(statement.finializer); - } +/***/ }), - walkTryStatement(statement) { - if (this.scope.inTry) { - this.walkStatement(statement.block); - } else { - this.scope.inTry = true; - this.walkStatement(statement.block); - this.scope.inTry = false; - } - if (statement.handler) this.walkCatchClause(statement.handler); - if (statement.finalizer) this.walkStatement(statement.finalizer); - } +/***/ 1313: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - preWalkWhileStatement(statement) { - this.preWalkStatement(statement.body); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - walkWhileStatement(statement) { - this.walkExpression(statement.test); - this.walkNestedStatement(statement.body); - } - preWalkDoWhileStatement(statement) { - this.preWalkStatement(statement.body); - } - walkDoWhileStatement(statement) { - this.walkNestedStatement(statement.body); - this.walkExpression(statement.test); - } +const RuntimeGlobals = __webpack_require__(16475); +const StartupChunkDependenciesPlugin = __webpack_require__(22339); - preWalkForStatement(statement) { - if (statement.init) { - if (statement.init.type === "VariableDeclaration") { - this.preWalkStatement(statement.init); - } - } - this.preWalkStatement(statement.body); +/** @typedef {import("../Compiler")} Compiler */ + +class CommonJsChunkLoadingPlugin { + constructor(options) { + options = options || {}; + this._asyncChunkLoading = options.asyncChunkLoading; } - walkForStatement(statement) { - this.inBlockScope(() => { - if (statement.init) { - if (statement.init.type === "VariableDeclaration") { - this.blockPreWalkVariableDeclaration(statement.init); - this.prevStatement = undefined; - this.walkStatement(statement.init); - } else { - this.walkExpression(statement.init); - } - } - if (statement.test) { - this.walkExpression(statement.test); - } - if (statement.update) { - this.walkExpression(statement.update); - } - const body = statement.body; - if (body.type === "BlockStatement") { - // no need to add additional scope - const prev = this.prevStatement; - this.blockPreWalkStatements(body.body); - this.prevStatement = prev; - this.walkStatements(body.body); - } else { - this.walkNestedStatement(body); - } - }); - } + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const ChunkLoadingRuntimeModule = this._asyncChunkLoading + ? __webpack_require__(73369) + : __webpack_require__(94172); + const chunkLoadingValue = this._asyncChunkLoading + ? "async-node" + : "require"; + new StartupChunkDependenciesPlugin({ + chunkLoading: chunkLoadingValue, + asyncChunkLoading: this._asyncChunkLoading + }).apply(compiler); + compiler.hooks.thisCompilation.tap( + "CommonJsChunkLoadingPlugin", + compilation => { + const globalChunkLoading = compilation.outputOptions.chunkLoading; + const isEnabledForChunk = chunk => { + const options = chunk.getEntryOptions(); + const chunkLoading = + options && options.chunkLoading !== undefined + ? options.chunkLoading + : globalChunkLoading; + return chunkLoading === chunkLoadingValue; + }; + const onceForChunkSet = new WeakSet(); + const handler = (chunk, set) => { + if (onceForChunkSet.has(chunk)) return; + onceForChunkSet.add(chunk); + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + set.add(RuntimeGlobals.hasOwnProperty); + compilation.addRuntimeModule( + chunk, + new ChunkLoadingRuntimeModule(set) + ); + }; - preWalkForInStatement(statement) { - if (statement.left.type === "VariableDeclaration") { - this.preWalkVariableDeclaration(statement.left); - } - this.preWalkStatement(statement.body); - } + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("CommonJsChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadUpdateHandlers) + .tap("CommonJsChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadManifest) + .tap("CommonJsChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.baseURI) + .tap("CommonJsChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.externalInstallChunk) + .tap("CommonJsChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.onChunksLoaded) + .tap("CommonJsChunkLoadingPlugin", handler); - walkForInStatement(statement) { - this.inBlockScope(() => { - if (statement.left.type === "VariableDeclaration") { - this.blockPreWalkVariableDeclaration(statement.left); - this.walkVariableDeclaration(statement.left); - } else { - this.walkPattern(statement.left); - } - this.walkExpression(statement.right); - const body = statement.body; - if (body.type === "BlockStatement") { - // no need to add additional scope - const prev = this.prevStatement; - this.blockPreWalkStatements(body.body); - this.prevStatement = prev; - this.walkStatements(body.body); - } else { - this.walkNestedStatement(body); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("CommonJsChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.getChunkScriptFilename); + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadUpdateHandlers) + .tap("CommonJsChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.getChunkUpdateScriptFilename); + set.add(RuntimeGlobals.moduleCache); + set.add(RuntimeGlobals.hmrModuleData); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadManifest) + .tap("CommonJsChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.getUpdateManifestFilename); + }); } - }); + ); } +} - preWalkForOfStatement(statement) { - if (statement.await && this.scope.topLevelScope === true) { - this.hooks.topLevelAwait.call(statement); - } - if (statement.left.type === "VariableDeclaration") { - this.preWalkVariableDeclaration(statement.left); - } - this.preWalkStatement(statement.body); - } +module.exports = CommonJsChunkLoadingPlugin; - walkForOfStatement(statement) { - this.inBlockScope(() => { - if (statement.left.type === "VariableDeclaration") { - this.blockPreWalkVariableDeclaration(statement.left); - this.walkVariableDeclaration(statement.left); - } else { - this.walkPattern(statement.left); - } - this.walkExpression(statement.right); - const body = statement.body; - if (body.type === "BlockStatement") { - // no need to add additional scope - const prev = this.prevStatement; - this.blockPreWalkStatements(body.body); - this.prevStatement = prev; - this.walkStatements(body.body); - } else { - this.walkNestedStatement(body); - } - }); - } - // Declarations - preWalkFunctionDeclaration(statement) { - if (statement.id) { - this.defineVariable(statement.id.name); - } - } +/***/ }), - walkFunctionDeclaration(statement) { - const wasTopLevel = this.scope.topLevelScope; - this.scope.topLevelScope = false; - this.inFunctionScope(true, statement.params, () => { - for (const param of statement.params) { - this.walkPattern(param); - } - if (statement.body.type === "BlockStatement") { - this.detectMode(statement.body.body); - const prev = this.prevStatement; - this.preWalkStatement(statement.body); - this.prevStatement = prev; - this.walkStatement(statement.body); - } else { - this.walkExpression(statement.body); - } - }); - this.scope.topLevelScope = wasTopLevel; - } +/***/ 7553: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - blockPreWalkImportDeclaration(statement) { - const source = statement.source.value; - this.hooks.import.call(statement, source); - for (const specifier of statement.specifiers) { - const name = specifier.local.name; - switch (specifier.type) { - case "ImportDefaultSpecifier": - if ( - !this.hooks.importSpecifier.call(statement, source, "default", name) - ) { - this.defineVariable(name); - } - break; - case "ImportSpecifier": - if ( - !this.hooks.importSpecifier.call( - statement, - source, - specifier.imported.name, - name - ) - ) { - this.defineVariable(name); - } - break; - case "ImportNamespaceSpecifier": - if (!this.hooks.importSpecifier.call(statement, source, null, name)) { - this.defineVariable(name); - } - break; - default: - this.defineVariable(name); - } - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - enterDeclaration(declaration, onIdent) { - switch (declaration.type) { - case "VariableDeclaration": - for (const declarator of declaration.declarations) { - switch (declarator.type) { - case "VariableDeclarator": { - this.enterPattern(declarator.id, onIdent); - break; - } - } - } - break; - case "FunctionDeclaration": - this.enterPattern(declaration.id, onIdent); - break; - case "ClassDeclaration": - this.enterPattern(declaration.id, onIdent); - break; - } - } - blockPreWalkExportNamedDeclaration(statement) { - let source; - if (statement.source) { - source = statement.source.value; - this.hooks.exportImport.call(statement, source); - } else { - this.hooks.export.call(statement); - } - if (statement.declaration) { - if ( - !this.hooks.exportDeclaration.call(statement, statement.declaration) - ) { - const prev = this.prevStatement; - this.preWalkStatement(statement.declaration); - this.prevStatement = prev; - this.blockPreWalkStatement(statement.declaration); - let index = 0; - this.enterDeclaration(statement.declaration, def => { - this.hooks.exportSpecifier.call(statement, def, def, index++); - }); - } - } - if (statement.specifiers) { - for ( - let specifierIndex = 0; - specifierIndex < statement.specifiers.length; - specifierIndex++ - ) { - const specifier = statement.specifiers[specifierIndex]; - switch (specifier.type) { - case "ExportSpecifier": { - const name = specifier.exported.name; - if (source) { - this.hooks.exportImportSpecifier.call( - statement, - source, - specifier.local.name, - name, - specifierIndex - ); - } else { - this.hooks.exportSpecifier.call( - statement, - specifier.local.name, - name, - specifierIndex - ); - } - break; - } - } - } - } - } - walkExportNamedDeclaration(statement) { - if (statement.declaration) { - this.walkStatement(statement.declaration); - } - } +const CachedInputFileSystem = __webpack_require__(52788); +const fs = __webpack_require__(90552); +const createConsoleLogger = __webpack_require__(54963); +const NodeWatchFileSystem = __webpack_require__(98810); +const nodeConsole = __webpack_require__(91786); - blockPreWalkExportDefaultDeclaration(statement) { - const prev = this.prevStatement; - this.preWalkStatement(statement.declaration); - this.prevStatement = prev; - this.blockPreWalkStatement(statement.declaration); - if ( - statement.declaration.id && - statement.declaration.type !== "FunctionExpression" && - statement.declaration.type !== "ClassExpression" - ) { - this.hooks.exportSpecifier.call( - statement, - statement.declaration.id.name, - "default", - undefined - ); - } +/** @typedef {import("../../declarations/WebpackOptions").InfrastructureLogging} InfrastructureLogging */ +/** @typedef {import("../Compiler")} Compiler */ + +class NodeEnvironmentPlugin { + /** + * @param {Object} options options + * @param {InfrastructureLogging} options.infrastructureLogging infrastructure logging options + */ + constructor(options) { + this.options = options; } - walkExportDefaultDeclaration(statement) { - this.hooks.export.call(statement); - if ( - statement.declaration.id && - statement.declaration.type !== "FunctionExpression" && - statement.declaration.type !== "ClassExpression" - ) { - if ( - !this.hooks.exportDeclaration.call(statement, statement.declaration) - ) { - this.walkStatement(statement.declaration); - } - } else { - // Acorn parses `export default function() {}` as `FunctionDeclaration` and - // `export default class {}` as `ClassDeclaration`, both with `id = null`. - // These nodes must be treated as expressions. - if ( - statement.declaration.type === "FunctionDeclaration" || - statement.declaration.type === "ClassDeclaration" - ) { - this.walkStatement(statement.declaration); - } else { - this.walkExpression(statement.declaration); - } - if (!this.hooks.exportExpression.call(statement, statement.declaration)) { - this.hooks.exportSpecifier.call( - statement, - statement.declaration, - "default", - undefined - ); + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const { infrastructureLogging } = this.options; + compiler.infrastructureLogger = createConsoleLogger({ + level: infrastructureLogging.level || "info", + debug: infrastructureLogging.debug || false, + console: + infrastructureLogging.console || + nodeConsole({ + colors: infrastructureLogging.colors, + appendOnly: infrastructureLogging.appendOnly, + stream: infrastructureLogging.stream + }) + }); + compiler.inputFileSystem = new CachedInputFileSystem(fs, 60000); + const inputFileSystem = compiler.inputFileSystem; + compiler.outputFileSystem = fs; + compiler.intermediateFileSystem = fs; + compiler.watchFileSystem = new NodeWatchFileSystem( + compiler.inputFileSystem + ); + compiler.hooks.beforeRun.tap("NodeEnvironmentPlugin", compiler => { + if (compiler.inputFileSystem === inputFileSystem) { + compiler.fsStartTime = Date.now(); + inputFileSystem.purge(); } - } + }); } +} - blockPreWalkExportAllDeclaration(statement) { - const source = statement.source.value; - const name = statement.exported ? statement.exported.name : null; - this.hooks.exportImport.call(statement, source); - this.hooks.exportImportSpecifier.call(statement, source, null, name, 0); - } +module.exports = NodeEnvironmentPlugin; - preWalkVariableDeclaration(statement) { - if (statement.kind !== "var") return; - this._preWalkVariableDeclaration(statement, this.hooks.varDeclarationVar); - } - blockPreWalkVariableDeclaration(statement) { - if (statement.kind === "var") return; - const hookMap = - statement.kind === "const" - ? this.hooks.varDeclarationConst - : this.hooks.varDeclarationLet; - this._preWalkVariableDeclaration(statement, hookMap); - } +/***/ }), - _preWalkVariableDeclaration(statement, hookMap) { - for (const declarator of statement.declarations) { - switch (declarator.type) { - case "VariableDeclarator": { - if (!this.hooks.preDeclarator.call(declarator, statement)) { - this.enterPattern(declarator.id, (name, decl) => { - let hook = hookMap.get(name); - if (hook === undefined || !hook.call(decl)) { - hook = this.hooks.varDeclaration.get(name); - if (hook === undefined || !hook.call(decl)) { - this.defineVariable(name); - } - } - }); - } - break; - } - } - } - } +/***/ 7103: +/***/ (function(module) { - walkVariableDeclaration(statement) { - for (const declarator of statement.declarations) { - switch (declarator.type) { - case "VariableDeclarator": { - const renameIdentifier = - declarator.init && this.getRenameIdentifier(declarator.init); - if (renameIdentifier && declarator.id.type === "Identifier") { - const hook = this.hooks.canRename.get(renameIdentifier); - if (hook !== undefined && hook.call(declarator.init)) { - // renaming with "var a = b;" - const hook = this.hooks.rename.get(renameIdentifier); - if (hook === undefined || !hook.call(declarator.init)) { - this.setVariable(declarator.id.name, renameIdentifier); - } - break; - } - } - if (!this.hooks.declarator.call(declarator, statement)) { - this.walkPattern(declarator.id); - if (declarator.init) this.walkExpression(declarator.init); - } - break; - } - } - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - blockPreWalkClassDeclaration(statement) { - if (statement.id) { - this.defineVariable(statement.id.name); - } - } - walkClassDeclaration(statement) { - this.walkClass(statement); - } - preWalkSwitchCases(switchCases) { - for (let index = 0, len = switchCases.length; index < len; index++) { - const switchCase = switchCases[index]; - this.preWalkStatements(switchCase.consequent); - } - } +/** @typedef {import("../Compiler")} Compiler */ - walkSwitchCases(switchCases) { - this.inBlockScope(() => { - const len = switchCases.length; +class NodeSourcePlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) {} +} - // we need to pre walk all statements first since we can have invalid code - // import A from "module"; - // switch(1) { - // case 1: - // console.log(A); // should fail at runtime - // case 2: - // const A = 1; - // } - for (let index = 0; index < len; index++) { - const switchCase = switchCases[index]; +module.exports = NodeSourcePlugin; - if (switchCase.consequent.length > 0) { - const prev = this.prevStatement; - this.blockPreWalkStatements(switchCase.consequent); - this.prevStatement = prev; - } - } - for (let index = 0; index < len; index++) { - const switchCase = switchCases[index]; +/***/ }), - if (switchCase.test) { - this.walkExpression(switchCase.test); - } - if (switchCase.consequent.length > 0) { - this.walkStatements(switchCase.consequent); - } - } - }); - } +/***/ 17916: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - preWalkCatchClause(catchClause) { - this.preWalkStatement(catchClause.body); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - walkCatchClause(catchClause) { - this.inBlockScope(() => { - // Error binding is optional in catch clause since ECMAScript 2019 - if (catchClause.param !== null) { - this.enterPattern(catchClause.param, ident => { - this.defineVariable(ident); - }); - this.walkPattern(catchClause.param); - } - const prev = this.prevStatement; - this.blockPreWalkStatement(catchClause.body); - this.prevStatement = prev; - this.walkStatement(catchClause.body); - }); - } - walkPattern(pattern) { - switch (pattern.type) { - case "ArrayPattern": - this.walkArrayPattern(pattern); - break; - case "AssignmentPattern": - this.walkAssignmentPattern(pattern); - break; - case "MemberExpression": - this.walkMemberExpression(pattern); - break; - case "ObjectPattern": - this.walkObjectPattern(pattern); - break; - case "RestElement": - this.walkRestElement(pattern); - break; - } - } - walkAssignmentPattern(pattern) { - this.walkExpression(pattern.right); - this.walkPattern(pattern.left); - } +const ExternalsPlugin = __webpack_require__(6652); - walkObjectPattern(pattern) { - for (let i = 0, len = pattern.properties.length; i < len; i++) { - const prop = pattern.properties[i]; - if (prop) { - if (prop.computed) this.walkExpression(prop.key); - if (prop.value) this.walkPattern(prop.value); - } - } - } +/** @typedef {import("../Compiler")} Compiler */ - walkArrayPattern(pattern) { - for (let i = 0, len = pattern.elements.length; i < len; i++) { - const element = pattern.elements[i]; - if (element) this.walkPattern(element); - } - } +const builtins = [ + "assert", + "async_hooks", + "buffer", + "child_process", + "cluster", + "console", + "constants", + "crypto", + "dgram", + "diagnostics_channel", + "dns", + "dns/promises", + "domain", + "events", + "fs", + "fs/promises", + "http", + "http2", + "https", + "inspector", + "module", + "net", + "os", + "path", + "path/posix", + "path/win32", + "perf_hooks", + "process", + "punycode", + "querystring", + "readline", + "repl", + "stream", + "stream/promises", + "stream/web", + "string_decoder", + "sys", + "timers", + "timers/promises", + "tls", + "trace_events", + "tty", + "url", + "util", + "util/types", + "v8", + "vm", + "wasi", + "worker_threads", + "zlib", + /^node:/, - walkRestElement(pattern) { - this.walkPattern(pattern.argument); - } + // cspell:word pnpapi + // Yarn PnP adds pnpapi as "builtin" + "pnpapi" +]; - walkExpressions(expressions) { - for (const expression of expressions) { - if (expression) { - this.walkExpression(expression); - } - } +class NodeTargetPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + new ExternalsPlugin("node-commonjs", builtins).apply(compiler); } +} - walkExpression(expression) { - switch (expression.type) { - case "ArrayExpression": - this.walkArrayExpression(expression); - break; - case "ArrowFunctionExpression": - this.walkArrowFunctionExpression(expression); - break; - case "AssignmentExpression": - this.walkAssignmentExpression(expression); - break; - case "AwaitExpression": - this.walkAwaitExpression(expression); - break; - case "BinaryExpression": - this.walkBinaryExpression(expression); - break; - case "CallExpression": - this.walkCallExpression(expression); - break; - case "ChainExpression": - this.walkChainExpression(expression); - break; - case "ClassExpression": - this.walkClassExpression(expression); - break; - case "ConditionalExpression": - this.walkConditionalExpression(expression); - break; - case "FunctionExpression": - this.walkFunctionExpression(expression); - break; - case "Identifier": - this.walkIdentifier(expression); - break; - case "ImportExpression": - this.walkImportExpression(expression); - break; - case "LogicalExpression": - this.walkLogicalExpression(expression); - break; - case "MetaProperty": - this.walkMetaProperty(expression); - break; - case "MemberExpression": - this.walkMemberExpression(expression); - break; - case "NewExpression": - this.walkNewExpression(expression); - break; - case "ObjectExpression": - this.walkObjectExpression(expression); - break; - case "SequenceExpression": - this.walkSequenceExpression(expression); - break; - case "SpreadElement": - this.walkSpreadElement(expression); - break; - case "TaggedTemplateExpression": - this.walkTaggedTemplateExpression(expression); - break; - case "TemplateLiteral": - this.walkTemplateLiteral(expression); - break; - case "ThisExpression": - this.walkThisExpression(expression); - break; - case "UnaryExpression": - this.walkUnaryExpression(expression); - break; - case "UpdateExpression": - this.walkUpdateExpression(expression); - break; - case "YieldExpression": - this.walkYieldExpression(expression); - break; - } - } +module.exports = NodeTargetPlugin; - walkAwaitExpression(expression) { - if (this.scope.topLevelScope === true) - this.hooks.topLevelAwait.call(expression); - this.walkExpression(expression.argument); - } - walkArrayExpression(expression) { - if (expression.elements) { - this.walkExpressions(expression.elements); - } - } +/***/ }), - walkSpreadElement(expression) { - if (expression.argument) { - this.walkExpression(expression.argument); - } - } +/***/ 61052: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - walkObjectExpression(expression) { - for ( - let propIndex = 0, len = expression.properties.length; - propIndex < len; - propIndex++ - ) { - const prop = expression.properties[propIndex]; - this.walkProperty(prop); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const CommonJsChunkFormatPlugin = __webpack_require__(84508); +const EnableChunkLoadingPlugin = __webpack_require__(61291); + +/** @typedef {import("../Compiler")} Compiler */ + +class NodeTemplatePlugin { + constructor(options) { + this._options = options || {}; } - walkProperty(prop) { - if (prop.type === "SpreadElement") { - this.walkExpression(prop.argument); - return; - } - if (prop.computed) { - this.walkExpression(prop.key); - } - if (prop.shorthand && prop.value && prop.value.type === "Identifier") { - this.scope.inShorthand = prop.value.name; - this.walkIdentifier(prop.value); - this.scope.inShorthand = false; - } else { - this.walkExpression(prop.value); - } + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const chunkLoading = this._options.asyncChunkLoading + ? "async-node" + : "require"; + compiler.options.output.chunkLoading = chunkLoading; + new CommonJsChunkFormatPlugin().apply(compiler); + new EnableChunkLoadingPlugin(chunkLoading).apply(compiler); } +} - walkFunctionExpression(expression) { - const wasTopLevel = this.scope.topLevelScope; - this.scope.topLevelScope = false; - const scopeParams = expression.params; +module.exports = NodeTemplatePlugin; - // Add function name in scope for recursive calls - if (expression.id) { - scopeParams.push(expression.id.name); - } - this.inFunctionScope(true, scopeParams, () => { - for (const param of expression.params) { - this.walkPattern(param); - } - if (expression.body.type === "BlockStatement") { - this.detectMode(expression.body.body); - const prev = this.prevStatement; - this.preWalkStatement(expression.body); - this.prevStatement = prev; - this.walkStatement(expression.body); - } else { - this.walkExpression(expression.body); - } - }); - this.scope.topLevelScope = wasTopLevel; - } +/***/ }), - walkArrowFunctionExpression(expression) { - const wasTopLevel = this.scope.topLevelScope; - this.scope.topLevelScope = wasTopLevel ? "arrow" : false; - this.inFunctionScope(false, expression.params, () => { - for (const param of expression.params) { - this.walkPattern(param); - } - if (expression.body.type === "BlockStatement") { - this.detectMode(expression.body.body); - const prev = this.prevStatement; - this.preWalkStatement(expression.body); - this.prevStatement = prev; - this.walkStatement(expression.body); - } else { - this.walkExpression(expression.body); - } - }); - this.scope.topLevelScope = wasTopLevel; +/***/ 98810: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const util = __webpack_require__(73837); +const Watchpack = __webpack_require__(36871); + +/** @typedef {import("../../declarations/WebpackOptions").WatchOptions} WatchOptions */ +/** @typedef {import("../FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */ +/** @typedef {import("../util/fs").WatchFileSystem} WatchFileSystem */ +/** @typedef {import("../util/fs").WatchMethod} WatchMethod */ +/** @typedef {import("../util/fs").Watcher} Watcher */ + +class NodeWatchFileSystem { + constructor(inputFileSystem) { + this.inputFileSystem = inputFileSystem; + this.watcherOptions = { + aggregateTimeout: 0 + }; + this.watcher = new Watchpack(this.watcherOptions); } /** - * @param {SequenceExpressionNode} expression the sequence + * @param {Iterable} files watched files + * @param {Iterable} directories watched directories + * @param {Iterable} missing watched exitance entries + * @param {number} startTime timestamp of start time + * @param {WatchOptions} options options object + * @param {function(Error=, Map, Map, Set, Set): void} callback aggregated callback + * @param {function(string, number): void} callbackUndelayed callback when the first change was detected + * @returns {Watcher} a watcher */ - walkSequenceExpression(expression) { - if (!expression.expressions) return; - // We treat sequence expressions like statements when they are one statement level - // This has some benefits for optimizations that only work on statement level - const currentStatement = this.statementPath[this.statementPath.length - 1]; - if ( - currentStatement === expression || - (currentStatement.type === "ExpressionStatement" && - currentStatement.expression === expression) - ) { - const old = this.statementPath.pop(); - for (const expr of expression.expressions) { - this.statementPath.push(expr); - this.walkExpression(expr); - this.statementPath.pop(); - } - this.statementPath.push(old); - } else { - this.walkExpressions(expression.expressions); + watch( + files, + directories, + missing, + startTime, + options, + callback, + callbackUndelayed + ) { + if (!files || typeof files[Symbol.iterator] !== "function") { + throw new Error("Invalid arguments: 'files'"); } - } + if (!directories || typeof directories[Symbol.iterator] !== "function") { + throw new Error("Invalid arguments: 'directories'"); + } + if (!missing || typeof missing[Symbol.iterator] !== "function") { + throw new Error("Invalid arguments: 'missing'"); + } + if (typeof callback !== "function") { + throw new Error("Invalid arguments: 'callback'"); + } + if (typeof startTime !== "number" && startTime) { + throw new Error("Invalid arguments: 'startTime'"); + } + if (typeof options !== "object") { + throw new Error("Invalid arguments: 'options'"); + } + if (typeof callbackUndelayed !== "function" && callbackUndelayed) { + throw new Error("Invalid arguments: 'callbackUndelayed'"); + } + const oldWatcher = this.watcher; + this.watcher = new Watchpack(options); - walkUpdateExpression(expression) { - this.walkExpression(expression.argument); - } + if (callbackUndelayed) { + this.watcher.once("change", callbackUndelayed); + } - walkUnaryExpression(expression) { - if (expression.operator === "typeof") { - const result = this.callHooksForExpression( - this.hooks.typeof, - expression.argument, - expression - ); - if (result === true) return; - if (expression.argument.type === "ChainExpression") { - const result = this.callHooksForExpression( - this.hooks.typeof, - expression.argument.expression, - expression + const fetchTimeInfo = () => { + const fileTimeInfoEntries = new Map(); + const contextTimeInfoEntries = new Map(); + if (this.watcher) { + this.watcher.collectTimeInfoEntries( + fileTimeInfoEntries, + contextTimeInfoEntries ); - if (result === true) return; } - } - this.walkExpression(expression.argument); - } + return { fileTimeInfoEntries, contextTimeInfoEntries }; + }; + this.watcher.once("aggregated", (changes, removals) => { + // pause emitting events (avoids clearing aggregated changes and removals on timeout) + this.watcher.pause(); - walkLeftRightExpression(expression) { - this.walkExpression(expression.left); - this.walkExpression(expression.right); - } + if (this.inputFileSystem && this.inputFileSystem.purge) { + const fs = this.inputFileSystem; + for (const item of changes) { + fs.purge(item); + } + for (const item of removals) { + fs.purge(item); + } + } + const { fileTimeInfoEntries, contextTimeInfoEntries } = fetchTimeInfo(); + callback( + null, + fileTimeInfoEntries, + contextTimeInfoEntries, + changes, + removals + ); + }); - walkBinaryExpression(expression) { - this.walkLeftRightExpression(expression); - } + this.watcher.watch({ files, directories, missing, startTime }); - walkLogicalExpression(expression) { - const result = this.hooks.expressionLogicalOperator.call(expression); - if (result === undefined) { - this.walkLeftRightExpression(expression); - } else { - if (result) { - this.walkExpression(expression.right); - } + if (oldWatcher) { + oldWatcher.close(); } - } - - walkAssignmentExpression(expression) { - if (expression.left.type === "Identifier") { - const renameIdentifier = this.getRenameIdentifier(expression.right); - if (renameIdentifier) { - if ( - this.callHooksForInfo( - this.hooks.canRename, - renameIdentifier, - expression.right - ) - ) { - // renaming "a = b;" - if ( - !this.callHooksForInfo( - this.hooks.rename, - renameIdentifier, - expression.right - ) - ) { - this.setVariable( - expression.left.name, - this.getVariableInfo(renameIdentifier) - ); - } - return; - } - } - this.walkExpression(expression.right); - this.enterPattern(expression.left, (name, decl) => { - if (!this.callHooksForName(this.hooks.assign, name, expression)) { - this.walkExpression(expression.left); - } - }); - return; - } - if (expression.left.type.endsWith("Pattern")) { - this.walkExpression(expression.right); - this.enterPattern(expression.left, (name, decl) => { - if (!this.callHooksForName(this.hooks.assign, name, expression)) { - this.defineVariable(name); + return { + close: () => { + if (this.watcher) { + this.watcher.close(); + this.watcher = null; } - }); - this.walkPattern(expression.left); - } else if (expression.left.type === "MemberExpression") { - const exprName = this.getMemberExpressionInfo( - expression.left, - ALLOWED_MEMBER_TYPES_EXPRESSION - ); - if (exprName) { - if ( - this.callHooksForInfo( - this.hooks.assignMemberChain, - exprName.rootInfo, - expression, - exprName.getMembers() - ) - ) { - return; + }, + pause: () => { + if (this.watcher) { + this.watcher.pause(); } - } - this.walkExpression(expression.right); - this.walkExpression(expression.left); - } else { - this.walkExpression(expression.right); - this.walkExpression(expression.left); - } - } - - walkConditionalExpression(expression) { - const result = this.hooks.expressionConditionalOperator.call(expression); - if (result === undefined) { - this.walkExpression(expression.test); - this.walkExpression(expression.consequent); - if (expression.alternate) { - this.walkExpression(expression.alternate); - } - } else { - if (result) { - this.walkExpression(expression.consequent); - } else if (expression.alternate) { - this.walkExpression(expression.alternate); - } - } - } - - walkNewExpression(expression) { - const result = this.callHooksForExpression( - this.hooks.new, - expression.callee, - expression - ); - if (result === true) return; - this.walkExpression(expression.callee); - if (expression.arguments) { - this.walkExpressions(expression.arguments); - } - } - - walkYieldExpression(expression) { - if (expression.argument) { - this.walkExpression(expression.argument); - } - } - - walkTemplateLiteral(expression) { - if (expression.expressions) { - this.walkExpressions(expression.expressions); - } - } - - walkTaggedTemplateExpression(expression) { - if (expression.tag) { - this.walkExpression(expression.tag); - } - if (expression.quasi && expression.quasi.expressions) { - this.walkExpressions(expression.quasi.expressions); - } - } - - walkClassExpression(expression) { - this.walkClass(expression); - } - - /** - * @param {ChainExpressionNode} expression expression - */ - walkChainExpression(expression) { - const result = this.hooks.optionalChaining.call(expression); - - if (result === undefined) { - if (expression.expression.type === "CallExpression") { - this.walkCallExpression(expression.expression); - } else { - this.walkMemberExpression(expression.expression); - } - } - } - - _walkIIFE(functionExpression, options, currentThis) { - const getVarInfo = argOrThis => { - const renameIdentifier = this.getRenameIdentifier(argOrThis); - if (renameIdentifier) { - if ( - this.callHooksForInfo( - this.hooks.canRename, - renameIdentifier, - argOrThis - ) - ) { - if ( - !this.callHooksForInfo( - this.hooks.rename, - renameIdentifier, - argOrThis - ) - ) { - return this.getVariableInfo(renameIdentifier); + }, + getAggregatedRemovals: util.deprecate( + () => { + const items = this.watcher && this.watcher.aggregatedRemovals; + if (items && this.inputFileSystem && this.inputFileSystem.purge) { + const fs = this.inputFileSystem; + for (const item of items) { + fs.purge(item); + } + } + return items; + }, + "Watcher.getAggregatedRemovals is deprecated in favor of Watcher.getInfo since that's more performant.", + "DEP_WEBPACK_WATCHER_GET_AGGREGATED_REMOVALS" + ), + getAggregatedChanges: util.deprecate( + () => { + const items = this.watcher && this.watcher.aggregatedChanges; + if (items && this.inputFileSystem && this.inputFileSystem.purge) { + const fs = this.inputFileSystem; + for (const item of items) { + fs.purge(item); + } + } + return items; + }, + "Watcher.getAggregatedChanges is deprecated in favor of Watcher.getInfo since that's more performant.", + "DEP_WEBPACK_WATCHER_GET_AGGREGATED_CHANGES" + ), + getFileTimeInfoEntries: util.deprecate( + () => { + return fetchTimeInfo().fileTimeInfoEntries; + }, + "Watcher.getFileTimeInfoEntries is deprecated in favor of Watcher.getInfo since that's more performant.", + "DEP_WEBPACK_WATCHER_FILE_TIME_INFO_ENTRIES" + ), + getContextTimeInfoEntries: util.deprecate( + () => { + return fetchTimeInfo().contextTimeInfoEntries; + }, + "Watcher.getContextTimeInfoEntries is deprecated in favor of Watcher.getInfo since that's more performant.", + "DEP_WEBPACK_WATCHER_CONTEXT_TIME_INFO_ENTRIES" + ), + getInfo: () => { + const removals = this.watcher && this.watcher.aggregatedRemovals; + const changes = this.watcher && this.watcher.aggregatedChanges; + if (this.inputFileSystem && this.inputFileSystem.purge) { + const fs = this.inputFileSystem; + if (removals) { + for (const item of removals) { + fs.purge(item); + } + } + if (changes) { + for (const item of changes) { + fs.purge(item); + } } } + const { fileTimeInfoEntries, contextTimeInfoEntries } = fetchTimeInfo(); + return { + changes, + removals, + fileTimeInfoEntries, + contextTimeInfoEntries + }; } - this.walkExpression(argOrThis); }; - const { params, type } = functionExpression; - const arrow = type === "ArrowFunctionExpression"; - const renameThis = currentThis ? getVarInfo(currentThis) : null; - const varInfoForArgs = options.map(getVarInfo); - const wasTopLevel = this.scope.topLevelScope; - this.scope.topLevelScope = wasTopLevel && arrow ? "arrow" : false; - const scopeParams = params.filter( - (identifier, idx) => !varInfoForArgs[idx] - ); - - // Add function name in scope for recursive calls - if (functionExpression.id) { - scopeParams.push(functionExpression.id.name); - } - - this.inFunctionScope(true, scopeParams, () => { - if (renameThis && !arrow) { - this.setVariable("this", renameThis); - } - for (let i = 0; i < varInfoForArgs.length; i++) { - const varInfo = varInfoForArgs[i]; - if (!varInfo) continue; - if (!params[i] || params[i].type !== "Identifier") continue; - this.setVariable(params[i].name, varInfo); - } - if (functionExpression.body.type === "BlockStatement") { - this.detectMode(functionExpression.body.body); - const prev = this.prevStatement; - this.preWalkStatement(functionExpression.body); - this.prevStatement = prev; - this.walkStatement(functionExpression.body); - } else { - this.walkExpression(functionExpression.body); - } - }); - this.scope.topLevelScope = wasTopLevel; } +} - walkImportExpression(expression) { - let result = this.hooks.importCall.call(expression); - if (result === true) return; +module.exports = NodeWatchFileSystem; - this.walkExpression(expression.source); - } - walkCallExpression(expression) { - const isSimpleFunction = fn => { - return fn.params.every(p => p.type === "Identifier"); - }; - if ( - expression.callee.type === "MemberExpression" && - expression.callee.object.type.endsWith("FunctionExpression") && - !expression.callee.computed && - (expression.callee.property.name === "call" || - expression.callee.property.name === "bind") && - expression.arguments.length > 0 && - isSimpleFunction(expression.callee.object) - ) { - // (function(…) { }.call/bind(?, …)) - this._walkIIFE( - expression.callee.object, - expression.arguments.slice(1), - expression.arguments[0] - ); - } else if ( - expression.callee.type.endsWith("FunctionExpression") && - isSimpleFunction(expression.callee) - ) { - // (function(…) { }(…)) - this._walkIIFE(expression.callee, expression.arguments, null); - } else { - if (expression.callee.type === "MemberExpression") { - const exprInfo = this.getMemberExpressionInfo( - expression.callee, - ALLOWED_MEMBER_TYPES_CALL_EXPRESSION - ); - if (exprInfo && exprInfo.type === "call") { - const result = this.callHooksForInfo( - this.hooks.callMemberChainOfCallMemberChain, - exprInfo.rootInfo, - expression, - exprInfo.getCalleeMembers(), - exprInfo.call, - exprInfo.getMembers() - ); - if (result === true) return; - } - } - const callee = this.evaluateExpression(expression.callee); - if (callee.isIdentifier()) { - const result1 = this.callHooksForInfo( - this.hooks.callMemberChain, - callee.rootInfo, - expression, - callee.getMembers() - ); - if (result1 === true) return; - const result2 = this.callHooksForInfo( - this.hooks.call, - callee.identifier, - expression - ); - if (result2 === true) return; - } +/***/ }), - if (expression.callee) { - if (expression.callee.type === "MemberExpression") { - // because of call context we need to walk the call context as expression - this.walkExpression(expression.callee.object); - if (expression.callee.computed === true) - this.walkExpression(expression.callee.property); - } else { - this.walkExpression(expression.callee); - } - } - if (expression.arguments) this.walkExpressions(expression.arguments); - } - } +/***/ 73369: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - walkMemberExpression(expression) { - const exprInfo = this.getMemberExpressionInfo( - expression, - ALLOWED_MEMBER_TYPES_ALL - ); - if (exprInfo) { - switch (exprInfo.type) { - case "expression": { - const result1 = this.callHooksForInfo( - this.hooks.expression, - exprInfo.name, - expression - ); - if (result1 === true) return; - const members = exprInfo.getMembers(); - const result2 = this.callHooksForInfo( - this.hooks.expressionMemberChain, - exprInfo.rootInfo, - expression, - members - ); - if (result2 === true) return; - this.walkMemberExpressionWithExpressionName( - expression, - exprInfo.name, - exprInfo.rootInfo, - members.slice(), - () => - this.callHooksForInfo( - this.hooks.unhandledExpressionMemberChain, - exprInfo.rootInfo, - expression, - members - ) - ); - return; - } - case "call": { - const result = this.callHooksForInfo( - this.hooks.memberChainOfCallMemberChain, - exprInfo.rootInfo, - expression, - exprInfo.getCalleeMembers(), - exprInfo.call, - exprInfo.getMembers() - ); - if (result === true) return; - // Fast skip over the member chain as we already called memberChainOfCallMemberChain - // and call computed property are literals anyway - this.walkExpression(exprInfo.call); - return; - } - } - } - this.walkExpression(expression.object); - if (expression.computed === true) this.walkExpression(expression.property); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ - walkMemberExpressionWithExpressionName( - expression, - name, - rootInfo, - members, - onUnhandled - ) { - if (expression.object.type === "MemberExpression") { - // optimize the case where expression.object is a MemberExpression too. - // we can keep info here when calling walkMemberExpression directly - const property = - expression.property.name || `${expression.property.value}`; - name = name.slice(0, -property.length - 1); - members.pop(); - const result = this.callHooksForInfo( - this.hooks.expression, - name, - expression.object - ); - if (result === true) return; - this.walkMemberExpressionWithExpressionName( - expression.object, - name, - rootInfo, - members, - onUnhandled - ); - } else if (!onUnhandled || !onUnhandled()) { - this.walkExpression(expression.object); - } - if (expression.computed === true) this.walkExpression(expression.property); - } - walkThisExpression(expression) { - this.callHooksForName(this.hooks.expression, "this", expression); - } - walkIdentifier(expression) { - this.callHooksForName(this.hooks.expression, expression.name, expression); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); +const { + chunkHasJs, + getChunkFilenameTemplate +} = __webpack_require__(89464); +const { getInitialChunkIds } = __webpack_require__(98124); +const compileBooleanMatcher = __webpack_require__(29404); +const { getUndoPath } = __webpack_require__(82186); + +class ReadFileChunkLoadingRuntimeModule extends RuntimeModule { + constructor(runtimeRequirements) { + super("readFile chunk loading", RuntimeModule.STAGE_ATTACH); + this.runtimeRequirements = runtimeRequirements; } /** - * @param {MetaPropertyNode} metaProperty meta property + * @returns {string} runtime code */ - walkMetaProperty(metaProperty) { - this.hooks.expression.for(getRootName(metaProperty)).call(metaProperty); - } + generate() { + const { chunkGraph, chunk } = this; + const { runtimeTemplate } = this.compilation; + const fn = RuntimeGlobals.ensureChunkHandlers; + const withBaseURI = this.runtimeRequirements.has(RuntimeGlobals.baseURI); + const withExternalInstallChunk = this.runtimeRequirements.has( + RuntimeGlobals.externalInstallChunk + ); + const withOnChunkLoad = this.runtimeRequirements.has( + RuntimeGlobals.onChunksLoaded + ); + const withLoading = this.runtimeRequirements.has( + RuntimeGlobals.ensureChunkHandlers + ); + const withHmr = this.runtimeRequirements.has( + RuntimeGlobals.hmrDownloadUpdateHandlers + ); + const withHmrManifest = this.runtimeRequirements.has( + RuntimeGlobals.hmrDownloadManifest + ); + const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs); + const hasJsMatcher = compileBooleanMatcher(conditionMap); + const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); - callHooksForExpression(hookMap, expr, ...args) { - return this.callHooksForExpressionWithFallback( - hookMap, - expr, - undefined, - undefined, - ...args + const outputName = this.compilation.getPath( + getChunkFilenameTemplate(chunk, this.compilation.outputOptions), + { + chunk, + contentHashType: "javascript" + } + ); + const rootOutputDir = getUndoPath( + outputName, + this.compilation.outputOptions.path, + false ); - } - /** - * @template T - * @template R - * @param {HookMap>} hookMap hooks the should be called - * @param {MemberExpressionNode} expr expression info - * @param {function(string, string | ScopeInfo | VariableInfo, function(): string[]): any} fallback callback when variable in not handled by hooks - * @param {function(string): any} defined callback when variable is defined - * @param {AsArray} args args for the hook - * @returns {R} result of hook - */ - callHooksForExpressionWithFallback( - hookMap, - expr, - fallback, - defined, - ...args - ) { - const exprName = this.getMemberExpressionInfo( - expr, - ALLOWED_MEMBER_TYPES_EXPRESSION - ); - if (exprName !== undefined) { - const members = exprName.getMembers(); - return this.callHooksForInfoWithFallback( - hookMap, - members.length === 0 ? exprName.rootInfo : exprName.name, - fallback && - (name => fallback(name, exprName.rootInfo, exprName.getMembers)), - defined && (() => defined(exprName.name)), - ...args - ); - } - } + const stateExpression = withHmr + ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_readFileVm` + : undefined; - /** - * @template T - * @template R - * @param {HookMap>} hookMap hooks the should be called - * @param {string} name key in map - * @param {AsArray} args args for the hook - * @returns {R} result of hook - */ - callHooksForName(hookMap, name, ...args) { - return this.callHooksForNameWithFallback( - hookMap, - name, - undefined, - undefined, - ...args - ); + return Template.asString([ + withBaseURI + ? Template.asString([ + `${RuntimeGlobals.baseURI} = require("url").pathToFileURL(${ + rootOutputDir + ? `__dirname + ${JSON.stringify("/" + rootOutputDir)}` + : "__filename" + });` + ]) + : "// no baseURI", + "", + "// object to store loaded chunks", + '// "0" means "already loaded", Promise means loading', + `var installedChunks = ${ + stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" + }{`, + Template.indent( + Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join( + ",\n" + ) + ), + "};", + "", + withOnChunkLoad + ? `${ + RuntimeGlobals.onChunksLoaded + }.readFileVm = ${runtimeTemplate.returningFunction( + "installedChunks[chunkId] === 0", + "chunkId" + )};` + : "// no on chunks loaded", + "", + withLoading || withExternalInstallChunk + ? `var installChunk = ${runtimeTemplate.basicFunction("chunk", [ + "var moreModules = chunk.modules, chunkIds = chunk.ids, runtime = chunk.runtime;", + "for(var moduleId in moreModules) {", + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, + Template.indent([ + `${RuntimeGlobals.moduleFactories}[moduleId] = moreModules[moduleId];` + ]), + "}" + ]), + "}", + `if(runtime) runtime(__webpack_require__);`, + "for(var i = 0; i < chunkIds.length; i++) {", + Template.indent([ + "if(installedChunks[chunkIds[i]]) {", + Template.indent(["installedChunks[chunkIds[i]][0]();"]), + "}", + "installedChunks[chunkIds[i]] = 0;" + ]), + "}", + withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : "" + ])};` + : "// no chunk install function needed", + "", + withLoading + ? Template.asString([ + "// ReadFile + VM.run chunk loading for javascript", + `${fn}.readFileVm = function(chunkId, promises) {`, + hasJsMatcher !== false + ? Template.indent([ + "", + "var installedChunkData = installedChunks[chunkId];", + 'if(installedChunkData !== 0) { // 0 means "already installed".', + Template.indent([ + '// array of [resolve, reject, promise] means "currently loading"', + "if(installedChunkData) {", + Template.indent(["promises.push(installedChunkData[2]);"]), + "} else {", + Template.indent([ + hasJsMatcher === true + ? "if(true) { // all chunks have JS" + : `if(${hasJsMatcher("chunkId")}) {`, + Template.indent([ + "// load the chunk and return promise to it", + "var promise = new Promise(function(resolve, reject) {", + Template.indent([ + "installedChunkData = installedChunks[chunkId] = [resolve, reject];", + `var filename = require('path').join(__dirname, ${JSON.stringify( + rootOutputDir + )} + ${ + RuntimeGlobals.getChunkScriptFilename + }(chunkId));`, + "require('fs').readFile(filename, 'utf-8', function(err, content) {", + Template.indent([ + "if(err) return reject(err);", + "var chunk = {};", + "require('vm').runInThisContext('(function(exports, require, __dirname, __filename) {' + content + '\\n})', filename)" + + "(chunk, require, require('path').dirname(filename), filename);", + "installChunk(chunk);" + ]), + "});" + ]), + "});", + "promises.push(installedChunkData[2] = promise);" + ]), + "} else installedChunks[chunkId] = 0;" + ]), + "}" + ]), + "}" + ]) + : Template.indent(["installedChunks[chunkId] = 0;"]), + "};" + ]) + : "// no chunk loading", + "", + withExternalInstallChunk + ? Template.asString([ + "module.exports = __webpack_require__;", + `${RuntimeGlobals.externalInstallChunk} = installChunk;` + ]) + : "// no external install chunk", + "", + withHmr + ? Template.asString([ + "function loadUpdateChunk(chunkId, updatedModulesList) {", + Template.indent([ + "return new Promise(function(resolve, reject) {", + Template.indent([ + `var filename = require('path').join(__dirname, ${JSON.stringify( + rootOutputDir + )} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId));`, + "require('fs').readFile(filename, 'utf-8', function(err, content) {", + Template.indent([ + "if(err) return reject(err);", + "var update = {};", + "require('vm').runInThisContext('(function(exports, require, __dirname, __filename) {' + content + '\\n})', filename)" + + "(update, require, require('path').dirname(filename), filename);", + "var updatedModules = update.modules;", + "var runtime = update.runtime;", + "for(var moduleId in updatedModules) {", + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(updatedModules, moduleId)) {`, + Template.indent([ + `currentUpdate[moduleId] = updatedModules[moduleId];`, + "if(updatedModulesList) updatedModulesList.push(moduleId);" + ]), + "}" + ]), + "}", + "if(runtime) currentUpdateRuntime.push(runtime);", + "resolve();" + ]), + "});" + ]), + "});" + ]), + "}", + "", + Template.getFunctionContent( + require('./JavascriptHotModuleReplacement.runtime.js') + ) + .replace(/\$key\$/g, "readFileVm") + .replace(/\$installedChunks\$/g, "installedChunks") + .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") + .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) + .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) + .replace( + /\$ensureChunkHandlers\$/g, + RuntimeGlobals.ensureChunkHandlers + ) + .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) + .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) + .replace( + /\$hmrDownloadUpdateHandlers\$/g, + RuntimeGlobals.hmrDownloadUpdateHandlers + ) + .replace( + /\$hmrInvalidateModuleHandlers\$/g, + RuntimeGlobals.hmrInvalidateModuleHandlers + ) + ]) + : "// no HMR", + "", + withHmrManifest + ? Template.asString([ + `${RuntimeGlobals.hmrDownloadManifest} = function() {`, + Template.indent([ + "return new Promise(function(resolve, reject) {", + Template.indent([ + `var filename = require('path').join(__dirname, ${JSON.stringify( + rootOutputDir + )} + ${RuntimeGlobals.getUpdateManifestFilename}());`, + "require('fs').readFile(filename, 'utf-8', function(err, content) {", + Template.indent([ + "if(err) {", + Template.indent([ + 'if(err.code === "ENOENT") return resolve();', + "return reject(err);" + ]), + "}", + "try { resolve(JSON.parse(content)); }", + "catch(e) { reject(e); }" + ]), + "});" + ]), + "});" + ]), + "}" + ]) + : "// no HMR manifest" + ]); } +} - /** - * @template T - * @template R - * @param {HookMap>} hookMap hooks that should be called - * @param {ExportedVariableInfo} info variable info - * @param {AsArray} args args for the hook - * @returns {R} result of hook - */ - callHooksForInfo(hookMap, info, ...args) { - return this.callHooksForInfoWithFallback( - hookMap, - info, - undefined, - undefined, - ...args - ); - } +module.exports = ReadFileChunkLoadingRuntimeModule; - /** - * @template T - * @template R - * @param {HookMap>} hookMap hooks the should be called - * @param {ExportedVariableInfo} info variable info - * @param {function(string): any} fallback callback when variable in not handled by hooks - * @param {function(): any} defined callback when variable is defined - * @param {AsArray} args args for the hook - * @returns {R} result of hook - */ - callHooksForInfoWithFallback(hookMap, info, fallback, defined, ...args) { - let name; - if (typeof info === "string") { - name = info; - } else { - if (!(info instanceof VariableInfo)) { - if (defined !== undefined) { - return defined(); - } - return; - } - let tagInfo = info.tagInfo; - while (tagInfo !== undefined) { - const hook = hookMap.get(tagInfo.tag); - if (hook !== undefined) { - this.currentTagData = tagInfo.data; - const result = hook.call(...args); - this.currentTagData = undefined; - if (result !== undefined) return result; - } - tagInfo = tagInfo.next; - } - if (info.freeName === true) { - if (defined !== undefined) { - return defined(); - } - return; - } - name = info.freeName; - } - const hook = hookMap.get(name); - if (hook !== undefined) { - const result = hook.call(...args); - if (result !== undefined) return result; - } - if (fallback !== undefined) { - return fallback(name); - } - } - /** - * @template T - * @template R - * @param {HookMap>} hookMap hooks the should be called - * @param {string} name key in map - * @param {function(string): any} fallback callback when variable in not handled by hooks - * @param {function(): any} defined callback when variable is defined - * @param {AsArray} args args for the hook - * @returns {R} result of hook - */ - callHooksForNameWithFallback(hookMap, name, fallback, defined, ...args) { - return this.callHooksForInfoWithFallback( - hookMap, - this.getVariableInfo(name), - fallback, - defined, - ...args - ); - } +/***/ }), + +/***/ 73163: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const AsyncWasmLoadingRuntimeModule = __webpack_require__(5434); +/** @typedef {import("../Compiler")} Compiler */ + +class ReadFileCompileAsyncWasmPlugin { + constructor({ type = "async-node", import: useImport = false } = {}) { + this._type = type; + this._import = useImport; + } /** - * @deprecated - * @param {any} params scope params - * @param {function(): void} fn inner function + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - inScope(params, fn) { - const oldScope = this.scope; - this.scope = { - topLevelScope: oldScope.topLevelScope, - inTry: false, - inShorthand: false, - isStrict: oldScope.isStrict, - isAsmJs: oldScope.isAsmJs, - definitions: oldScope.definitions.createChild() - }; + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "ReadFileCompileAsyncWasmPlugin", + compilation => { + const globalWasmLoading = compilation.outputOptions.wasmLoading; + const isEnabledForChunk = chunk => { + const options = chunk.getEntryOptions(); + const wasmLoading = + options && options.wasmLoading !== undefined + ? options.wasmLoading + : globalWasmLoading; + return wasmLoading === this._type; + }; + const generateLoadBinaryCode = this._import + ? path => + Template.asString([ + "Promise.all([import('fs'), import('url')]).then(([{ readFile }, { URL }]) => new Promise((resolve, reject) => {", + Template.indent([ + `readFile(new URL(${path}, import.meta.url), (err, buffer) => {`, + Template.indent([ + "if (err) return reject(err);", + "", + "// Fake fetch response", + "resolve({", + Template.indent(["arrayBuffer() { return buffer; }"]), + "});" + ]), + "});" + ]), + "}))" + ]) + : path => + Template.asString([ + "new Promise(function (resolve, reject) {", + Template.indent([ + "try {", + Template.indent([ + "var { readFile } = require('fs');", + "var { join } = require('path');", + "", + `readFile(join(__dirname, ${path}), function(err, buffer){`, + Template.indent([ + "if (err) return reject(err);", + "", + "// Fake fetch response", + "resolve({", + Template.indent(["arrayBuffer() { return buffer; }"]), + "});" + ]), + "});" + ]), + "} catch (err) { reject(err); }" + ]), + "})" + ]); - this.undefineVariable("this"); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.instantiateWasm) + .tap("ReadFileCompileAsyncWasmPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + const chunkGraph = compilation.chunkGraph; + if ( + !chunkGraph.hasModuleInGraph( + chunk, + m => m.type === "webassembly/async" + ) + ) { + return; + } + set.add(RuntimeGlobals.publicPath); + compilation.addRuntimeModule( + chunk, + new AsyncWasmLoadingRuntimeModule({ + generateLoadBinaryCode, + supportsStreaming: false + }) + ); + }); + } + ); + } +} - this.enterPatterns(params, (ident, pattern) => { - this.defineVariable(ident); - }); +module.exports = ReadFileCompileAsyncWasmPlugin; - fn(); - this.scope = oldScope; - } +/***/ }), - inFunctionScope(hasThis, params, fn) { - const oldScope = this.scope; - this.scope = { - topLevelScope: oldScope.topLevelScope, - inTry: false, - inShorthand: false, - isStrict: oldScope.isStrict, - isAsmJs: oldScope.isAsmJs, - definitions: oldScope.definitions.createChild() - }; +/***/ 98939: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (hasThis) { - this.undefineVariable("this"); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - this.enterPatterns(params, (ident, pattern) => { - this.defineVariable(ident); - }); - fn(); - this.scope = oldScope; - } +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const WasmChunkLoadingRuntimeModule = __webpack_require__(87394); - inBlockScope(fn) { - const oldScope = this.scope; - this.scope = { - topLevelScope: oldScope.topLevelScope, - inTry: oldScope.inTry, - inShorthand: false, - isStrict: oldScope.isStrict, - isAsmJs: oldScope.isAsmJs, - definitions: oldScope.definitions.createChild() - }; +/** @typedef {import("../Compiler")} Compiler */ - fn(); +// TODO webpack 6 remove - this.scope = oldScope; - } - - detectMode(statements) { - const isLiteral = - statements.length >= 1 && - statements[0].type === "ExpressionStatement" && - statements[0].expression.type === "Literal"; - if (isLiteral && statements[0].expression.value === "use strict") { - this.scope.isStrict = true; - } - if (isLiteral && statements[0].expression.value === "use asm") { - this.scope.isAsmJs = true; - } - } - - enterPatterns(patterns, onIdent) { - for (const pattern of patterns) { - if (typeof pattern !== "string") { - this.enterPattern(pattern, onIdent); - } else if (pattern) { - onIdent(pattern); - } - } - } - - enterPattern(pattern, onIdent) { - if (!pattern) return; - switch (pattern.type) { - case "ArrayPattern": - this.enterArrayPattern(pattern, onIdent); - break; - case "AssignmentPattern": - this.enterAssignmentPattern(pattern, onIdent); - break; - case "Identifier": - this.enterIdentifier(pattern, onIdent); - break; - case "ObjectPattern": - this.enterObjectPattern(pattern, onIdent); - break; - case "RestElement": - this.enterRestElement(pattern, onIdent); - break; - case "Property": - if (pattern.shorthand && pattern.value.type === "Identifier") { - this.scope.inShorthand = pattern.value.name; - this.enterIdentifier(pattern.value, onIdent); - this.scope.inShorthand = false; - } else { - this.enterPattern(pattern.value, onIdent); - } - break; - } - } - - enterIdentifier(pattern, onIdent) { - if (!this.callHooksForName(this.hooks.pattern, pattern.name, pattern)) { - onIdent(pattern.name, pattern); - } - } - - enterObjectPattern(pattern, onIdent) { - for ( - let propIndex = 0, len = pattern.properties.length; - propIndex < len; - propIndex++ - ) { - const prop = pattern.properties[propIndex]; - this.enterPattern(prop, onIdent); - } - } - - enterArrayPattern(pattern, onIdent) { - for ( - let elementIndex = 0, len = pattern.elements.length; - elementIndex < len; - elementIndex++ - ) { - const element = pattern.elements[elementIndex]; - this.enterPattern(element, onIdent); - } - } - - enterRestElement(pattern, onIdent) { - this.enterPattern(pattern.argument, onIdent); - } - - enterAssignmentPattern(pattern, onIdent) { - this.enterPattern(pattern.left, onIdent); +class ReadFileCompileWasmPlugin { + constructor(options) { + this.options = options || {}; } /** - * @param {ExpressionNode} expression expression node - * @returns {BasicEvaluatedExpression | undefined} evaluation result + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - evaluateExpression(expression) { - try { - const hook = this.hooks.evaluate.get(expression.type); - if (hook !== undefined) { - const result = hook.call(expression); - if (result !== undefined) { - if (result) { - result.setExpression(expression); - } - return result; - } - } - } catch (e) { - console.warn(e); - // ignore error - } - return new BasicEvaluatedExpression() - .setRange(expression.range) - .setExpression(expression); - } - - parseString(expression) { - switch (expression.type) { - case "BinaryExpression": - if (expression.operator === "+") { - return ( - this.parseString(expression.left) + - this.parseString(expression.right) - ); - } - break; - case "Literal": - return expression.value + ""; - } - throw new Error( - expression.type + " is not supported as parameter for require" - ); - } - - parseCalculatedString(expression) { - switch (expression.type) { - case "BinaryExpression": - if (expression.operator === "+") { - const left = this.parseCalculatedString(expression.left); - const right = this.parseCalculatedString(expression.right); - if (left.code) { - return { - range: left.range, - value: left.value, - code: true, - conditional: false - }; - } else if (right.code) { - return { - range: [ - left.range[0], - right.range ? right.range[1] : left.range[1] - ], - value: left.value + right.value, - code: true, - conditional: false - }; - } else { - return { - range: [left.range[0], right.range[1]], - value: left.value + right.value, - code: false, - conditional: false - }; - } - } - break; - case "ConditionalExpression": { - const consequent = this.parseCalculatedString(expression.consequent); - const alternate = this.parseCalculatedString(expression.alternate); - const items = []; - if (consequent.conditional) { - items.push(...consequent.conditional); - } else if (!consequent.code) { - items.push(consequent); - } else { - break; - } - if (alternate.conditional) { - items.push(...alternate.conditional); - } else if (!alternate.code) { - items.push(alternate); - } else { - break; - } - return { - range: undefined, - value: "", - code: true, - conditional: items - }; - } - case "Literal": - return { - range: expression.range, - value: expression.value + "", - code: false, - conditional: false + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "ReadFileCompileWasmPlugin", + compilation => { + const globalWasmLoading = compilation.outputOptions.wasmLoading; + const isEnabledForChunk = chunk => { + const options = chunk.getEntryOptions(); + const wasmLoading = + options && options.wasmLoading !== undefined + ? options.wasmLoading + : globalWasmLoading; + return wasmLoading === "async-node"; }; - } - return { - range: undefined, - value: "", - code: true, - conditional: false - }; - } - - /** - * @param {string | Buffer | PreparsedAst} source the source to parse - * @param {ParserState} state the parser state - * @returns {ParserState} the parser state - */ - parse(source, state) { - let ast; - let comments; - const semicolons = new Set(); - if (source === null) { - throw new Error("source must not be null"); - } - if (Buffer.isBuffer(source)) { - source = source.toString("utf-8"); - } - if (typeof source === "object") { - ast = /** @type {ProgramNode} */ (source); - comments = source.comments; - } else { - comments = []; - ast = JavascriptParser._parse(source, { - sourceType: this.sourceType, - onComment: comments, - onInsertedSemicolon: pos => semicolons.add(pos) - }); - } + const generateLoadBinaryCode = path => + Template.asString([ + "new Promise(function (resolve, reject) {", + Template.indent([ + "var { readFile } = require('fs');", + "var { join } = require('path');", + "", + "try {", + Template.indent([ + `readFile(join(__dirname, ${path}), function(err, buffer){`, + Template.indent([ + "if (err) return reject(err);", + "", + "// Fake fetch response", + "resolve({", + Template.indent(["arrayBuffer() { return buffer; }"]), + "});" + ]), + "});" + ]), + "} catch (err) { reject(err); }" + ]), + "})" + ]); - const oldScope = this.scope; - const oldState = this.state; - const oldComments = this.comments; - const oldSemicolons = this.semicolons; - const oldStatementPath = this.statementPath; - const oldPrevStatement = this.prevStatement; - this.scope = { - topLevelScope: true, - inTry: false, - inShorthand: false, - isStrict: false, - isAsmJs: false, - definitions: new StackedMap() - }; - /** @type {ParserState} */ - this.state = state; - this.comments = comments; - this.semicolons = semicolons; - this.statementPath = []; - this.prevStatement = undefined; - if (this.hooks.program.call(ast, comments) === undefined) { - this.detectMode(ast.body); - this.preWalkStatements(ast.body); - this.prevStatement = undefined; - this.blockPreWalkStatements(ast.body); - this.prevStatement = undefined; - this.walkStatements(ast.body); - } - this.hooks.finish.call(ast, comments); - this.scope = oldScope; - /** @type {ParserState} */ - this.state = oldState; - this.comments = oldComments; - this.semicolons = oldSemicolons; - this.statementPath = oldStatementPath; - this.prevStatement = oldPrevStatement; - return state; + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("ReadFileCompileWasmPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + const chunkGraph = compilation.chunkGraph; + if ( + !chunkGraph.hasModuleInGraph( + chunk, + m => m.type === "webassembly/sync" + ) + ) { + return; + } + set.add(RuntimeGlobals.moduleCache); + compilation.addRuntimeModule( + chunk, + new WasmChunkLoadingRuntimeModule({ + generateLoadBinaryCode, + supportsStreaming: false, + mangleImports: this.options.mangleImports, + runtimeRequirements: set + }) + ); + }); + } + ); } +} - evaluate(source) { - const ast = JavascriptParser._parse("(" + source + ")", { - sourceType: this.sourceType, - locations: false - }); - if (ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement") { - throw new Error("evaluate: Source is not a expression"); - } - return this.evaluateExpression(ast.body[0].expression); - } +module.exports = ReadFileCompileWasmPlugin; - /** - * @param {ExpressionNode | DeclarationNode | PrivateIdentifierNode | null | undefined} expr an expression - * @param {number} commentsStartPos source position from which annotation comments are checked - * @returns {boolean} true, when the expression is pure - */ - isPure(expr, commentsStartPos) { - if (!expr) return true; - const result = this.hooks.isPure - .for(expr.type) - .call(expr, commentsStartPos); - if (typeof result === "boolean") return result; - switch (expr.type) { - case "ClassDeclaration": - case "ClassExpression": { - if (expr.body.type !== "ClassBody") return false; - if (expr.superClass && !this.isPure(expr.superClass, expr.range[0])) { - return false; - } - const items = - /** @type {(MethodDefinitionNode | PropertyDefinitionNode)[]} */ ( - expr.body.body - ); - return items.every( - item => - (!item.computed || - !item.key || - this.isPure(item.key, item.range[0])) && - (!item.static || - !item.value || - this.isPure( - item.value, - item.key ? item.key.range[1] : item.range[0] - )) - ); - } - case "FunctionDeclaration": - case "FunctionExpression": - case "ArrowFunctionExpression": - case "Literal": - case "PrivateIdentifier": - return true; +/***/ }), - case "VariableDeclaration": - return expr.declarations.every(decl => - this.isPure(decl.init, decl.range[0]) - ); +/***/ 94172: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - case "ConditionalExpression": - return ( - this.isPure(expr.test, commentsStartPos) && - this.isPure(expr.consequent, expr.test.range[1]) && - this.isPure(expr.alternate, expr.consequent.range[1]) - ); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ - case "SequenceExpression": - return expr.expressions.every(expr => { - const pureFlag = this.isPure(expr, commentsStartPos); - commentsStartPos = expr.range[1]; - return pureFlag; - }); - case "CallExpression": { - const pureFlag = - expr.range[0] - commentsStartPos > 12 && - this.getComments([commentsStartPos, expr.range[0]]).some( - comment => - comment.type === "Block" && - /^\s*(#|@)__PURE__\s*$/.test(comment.value) - ); - if (!pureFlag) return false; - commentsStartPos = expr.callee.range[1]; - return expr.arguments.every(arg => { - if (arg.type === "SpreadElement") return false; - const pureFlag = this.isPure(arg, commentsStartPos); - commentsStartPos = arg.range[1]; - return pureFlag; - }); - } - } - const evaluated = this.evaluateExpression(expr); - return !evaluated.couldHaveSideEffects(); - } - getComments(range) { - const [rangeStart, rangeEnd] = range; - const compare = (comment, needle) => comment.range[0] - needle; - let idx = binarySearchBounds.ge(this.comments, rangeStart, compare); - let commentsInRange = []; - while (this.comments[idx] && this.comments[idx].range[1] <= rangeEnd) { - commentsInRange.push(this.comments[idx]); - idx++; - } +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); +const { + chunkHasJs, + getChunkFilenameTemplate +} = __webpack_require__(89464); +const { getInitialChunkIds } = __webpack_require__(98124); +const compileBooleanMatcher = __webpack_require__(29404); +const { getUndoPath } = __webpack_require__(82186); - return commentsInRange; +class RequireChunkLoadingRuntimeModule extends RuntimeModule { + constructor(runtimeRequirements) { + super("require chunk loading", RuntimeModule.STAGE_ATTACH); + this.runtimeRequirements = runtimeRequirements; } /** - * @param {number} pos source code position - * @returns {boolean} true when a semicolon has been inserted before this position, false if not + * @returns {string} runtime code */ - isAsiPosition(pos) { - const currentStatement = this.statementPath[this.statementPath.length - 1]; - if (currentStatement === undefined) throw new Error("Not in statement"); - return ( - // Either asking directly for the end position of the current statement - (currentStatement.range[1] === pos && this.semicolons.has(pos)) || - // Or asking for the start position of the current statement, - // here we have to check multiple things - (currentStatement.range[0] === pos && - // is there a previous statement which might be relevant? - this.prevStatement !== undefined && - // is the end position of the previous statement an ASI position? - this.semicolons.has(this.prevStatement.range[1])) + generate() { + const { chunkGraph, chunk } = this; + const { runtimeTemplate } = this.compilation; + const fn = RuntimeGlobals.ensureChunkHandlers; + const withBaseURI = this.runtimeRequirements.has(RuntimeGlobals.baseURI); + const withExternalInstallChunk = this.runtimeRequirements.has( + RuntimeGlobals.externalInstallChunk ); - } - - /** - * @param {number} pos source code position - * @returns {void} - */ - unsetAsiPosition(pos) { - this.semicolons.delete(pos); - } - - isStatementLevelExpression(expr) { - const currentStatement = this.statementPath[this.statementPath.length - 1]; - return ( - expr === currentStatement || - (currentStatement.type === "ExpressionStatement" && - currentStatement.expression === expr) + const withOnChunkLoad = this.runtimeRequirements.has( + RuntimeGlobals.onChunksLoaded ); - } + const withLoading = this.runtimeRequirements.has( + RuntimeGlobals.ensureChunkHandlers + ); + const withHmr = this.runtimeRequirements.has( + RuntimeGlobals.hmrDownloadUpdateHandlers + ); + const withHmrManifest = this.runtimeRequirements.has( + RuntimeGlobals.hmrDownloadManifest + ); + const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs); + const hasJsMatcher = compileBooleanMatcher(conditionMap); + const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); - getTagData(name, tag) { - const info = this.scope.definitions.get(name); - if (info instanceof VariableInfo) { - let tagInfo = info.tagInfo; - while (tagInfo !== undefined) { - if (tagInfo.tag === tag) return tagInfo.data; - tagInfo = tagInfo.next; - } - } - } - - tagVariable(name, tag, data) { - const oldInfo = this.scope.definitions.get(name); - /** @type {VariableInfo} */ - let newInfo; - if (oldInfo === undefined) { - newInfo = new VariableInfo(this.scope, name, { - tag, - data, - next: undefined - }); - } else if (oldInfo instanceof VariableInfo) { - newInfo = new VariableInfo(oldInfo.declaredScope, oldInfo.freeName, { - tag, - data, - next: oldInfo.tagInfo - }); - } else { - newInfo = new VariableInfo(oldInfo, true, { - tag, - data, - next: undefined - }); - } - this.scope.definitions.set(name, newInfo); - } - - defineVariable(name) { - const oldInfo = this.scope.definitions.get(name); - // Don't redefine variable in same scope to keep existing tags - if (oldInfo instanceof VariableInfo && oldInfo.declaredScope === this.scope) - return; - this.scope.definitions.set(name, this.scope); - } - - undefineVariable(name) { - this.scope.definitions.delete(name); - } - - isVariableDefined(name) { - const info = this.scope.definitions.get(name); - if (info === undefined) return false; - if (info instanceof VariableInfo) { - return info.freeName === true; - } - return true; - } - - /** - * @param {string} name variable name - * @returns {ExportedVariableInfo} info for this variable - */ - getVariableInfo(name) { - const value = this.scope.definitions.get(name); - if (value === undefined) { - return name; - } else { - return value; - } - } - - /** - * @param {string} name variable name - * @param {ExportedVariableInfo} variableInfo new info for this variable - * @returns {void} - */ - setVariable(name, variableInfo) { - if (typeof variableInfo === "string") { - if (variableInfo === name) { - this.scope.definitions.delete(name); - } else { - this.scope.definitions.set( - name, - new VariableInfo(this.scope, variableInfo, undefined) - ); - } - } else { - this.scope.definitions.set(name, variableInfo); - } - } - - parseCommentOptions(range) { - const comments = this.getComments(range); - if (comments.length === 0) { - return EMPTY_COMMENT_OPTIONS; - } - let options = {}; - let errors = []; - for (const comment of comments) { - const { value } = comment; - if (value && webpackCommentRegExp.test(value)) { - // try compile only if webpack options comment is present - try { - const val = vm.runInNewContext(`(function(){return {${value}};})()`); - Object.assign(options, val); - } catch (e) { - e.comment = comment; - errors.push(e); - } - } - } - return { options, errors }; - } - - /** - * @param {MemberExpressionNode} expression a member expression - * @returns {{ members: string[], object: ExpressionNode | SuperNode }} member names (reverse order) and remaining object - */ - extractMemberExpressionChain(expression) { - /** @type {AnyNode} */ - let expr = expression; - const members = []; - while (expr.type === "MemberExpression") { - if (expr.computed) { - if (expr.property.type !== "Literal") break; - members.push(`${expr.property.value}`); - } else { - if (expr.property.type !== "Identifier") break; - members.push(expr.property.name); - } - expr = expr.object; - } - return { - members, - object: expr - }; - } - - /** - * @param {string} varName variable name - * @returns {{name: string, info: VariableInfo | string}} name of the free variable and variable info for that - */ - getFreeInfoFromVariable(varName) { - const info = this.getVariableInfo(varName); - let name; - if (info instanceof VariableInfo) { - name = info.freeName; - if (typeof name !== "string") return undefined; - } else if (typeof info !== "string") { - return undefined; - } else { - name = info; - } - return { info, name }; - } - - /** @typedef {{ type: "call", call: CallExpressionNode, calleeName: string, rootInfo: string | VariableInfo, getCalleeMembers: () => string[], name: string, getMembers: () => string[]}} CallExpressionInfo */ - /** @typedef {{ type: "expression", rootInfo: string | VariableInfo, name: string, getMembers: () => string[]}} ExpressionExpressionInfo */ - - /** - * @param {MemberExpressionNode} expression a member expression - * @param {number} allowedTypes which types should be returned, presented in bit mask - * @returns {CallExpressionInfo | ExpressionExpressionInfo | undefined} expression info - */ - getMemberExpressionInfo(expression, allowedTypes) { - const { object, members } = this.extractMemberExpressionChain(expression); - switch (object.type) { - case "CallExpression": { - if ((allowedTypes & ALLOWED_MEMBER_TYPES_CALL_EXPRESSION) === 0) - return undefined; - let callee = object.callee; - let rootMembers = EMPTY_ARRAY; - if (callee.type === "MemberExpression") { - ({ object: callee, members: rootMembers } = - this.extractMemberExpressionChain(callee)); - } - const rootName = getRootName(callee); - if (!rootName) return undefined; - const result = this.getFreeInfoFromVariable(rootName); - if (!result) return undefined; - const { info: rootInfo, name: resolvedRoot } = result; - const calleeName = objectAndMembersToName(resolvedRoot, rootMembers); - return { - type: "call", - call: object, - calleeName, - rootInfo, - getCalleeMembers: memoize(() => rootMembers.reverse()), - name: objectAndMembersToName(`${calleeName}()`, members), - getMembers: memoize(() => members.reverse()) - }; - } - case "Identifier": - case "MetaProperty": - case "ThisExpression": { - if ((allowedTypes & ALLOWED_MEMBER_TYPES_EXPRESSION) === 0) - return undefined; - const rootName = getRootName(object); - if (!rootName) return undefined; - - const result = this.getFreeInfoFromVariable(rootName); - if (!result) return undefined; - const { info: rootInfo, name: resolvedRoot } = result; - return { - type: "expression", - name: objectAndMembersToName(resolvedRoot, members), - rootInfo, - getMembers: memoize(() => members.reverse()) - }; + const outputName = this.compilation.getPath( + getChunkFilenameTemplate(chunk, this.compilation.outputOptions), + { + chunk, + contentHashType: "javascript" } - } - } - - /** - * @param {MemberExpressionNode} expression an expression - * @returns {{ name: string, rootInfo: ExportedVariableInfo, getMembers: () => string[]}} name info - */ - getNameForExpression(expression) { - return this.getMemberExpressionInfo( - expression, - ALLOWED_MEMBER_TYPES_EXPRESSION ); - } - - /** - * @param {string} code source code - * @param {ParseOptions} options parsing options - * @returns {ProgramNode} parsed ast - */ - static _parse(code, options) { - const type = options ? options.sourceType : "module"; - /** @type {AcornOptions} */ - const parserOptions = { - ...defaultParserOptions, - allowReturnOutsideFunction: type === "script", - ...options, - sourceType: type === "auto" ? "module" : type - }; - - /** @type {AnyNode} */ - let ast; - let error; - let threw = false; - try { - ast = /** @type {AnyNode} */ (parser.parse(code, parserOptions)); - } catch (e) { - error = e; - threw = true; - } - - if (threw && type === "auto") { - parserOptions.sourceType = "script"; - if (!("allowReturnOutsideFunction" in options)) { - parserOptions.allowReturnOutsideFunction = true; - } - if (Array.isArray(parserOptions.onComment)) { - parserOptions.onComment.length = 0; - } - try { - ast = /** @type {AnyNode} */ (parser.parse(code, parserOptions)); - threw = false; - } catch (e) { - // we use the error from first parse try - // so nothing to do here - } - } + const rootOutputDir = getUndoPath( + outputName, + this.compilation.outputOptions.path, + true + ); - if (threw) { - throw error; - } + const stateExpression = withHmr + ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_require` + : undefined; - return /** @type {ProgramNode} */ (ast); + return Template.asString([ + withBaseURI + ? Template.asString([ + `${RuntimeGlobals.baseURI} = require("url").pathToFileURL(${ + rootOutputDir !== "./" + ? `__dirname + ${JSON.stringify("/" + rootOutputDir)}` + : "__filename" + });` + ]) + : "// no baseURI", + "", + "// object to store loaded chunks", + '// "1" means "loaded", otherwise not loaded yet', + `var installedChunks = ${ + stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" + }{`, + Template.indent( + Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 1`).join( + ",\n" + ) + ), + "};", + "", + withOnChunkLoad + ? `${ + RuntimeGlobals.onChunksLoaded + }.require = ${runtimeTemplate.returningFunction( + "installedChunks[chunkId]", + "chunkId" + )};` + : "// no on chunks loaded", + "", + withLoading || withExternalInstallChunk + ? `var installChunk = ${runtimeTemplate.basicFunction("chunk", [ + "var moreModules = chunk.modules, chunkIds = chunk.ids, runtime = chunk.runtime;", + "for(var moduleId in moreModules) {", + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, + Template.indent([ + `${RuntimeGlobals.moduleFactories}[moduleId] = moreModules[moduleId];` + ]), + "}" + ]), + "}", + `if(runtime) runtime(__webpack_require__);`, + "for(var i = 0; i < chunkIds.length; i++)", + Template.indent("installedChunks[chunkIds[i]] = 1;"), + withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : "" + ])};` + : "// no chunk install function needed", + "", + withLoading + ? Template.asString([ + "// require() chunk loading for javascript", + `${fn}.require = ${runtimeTemplate.basicFunction( + "chunkId, promises", + hasJsMatcher !== false + ? [ + '// "1" is the signal for "already loaded"', + "if(!installedChunks[chunkId]) {", + Template.indent([ + hasJsMatcher === true + ? "if(true) { // all chunks have JS" + : `if(${hasJsMatcher("chunkId")}) {`, + Template.indent([ + `installChunk(require(${JSON.stringify( + rootOutputDir + )} + ${ + RuntimeGlobals.getChunkScriptFilename + }(chunkId)));` + ]), + "} else installedChunks[chunkId] = 1;", + "" + ]), + "}" + ] + : "installedChunks[chunkId] = 1;" + )};` + ]) + : "// no chunk loading", + "", + withExternalInstallChunk + ? Template.asString([ + "module.exports = __webpack_require__;", + `${RuntimeGlobals.externalInstallChunk} = installChunk;` + ]) + : "// no external install chunk", + "", + withHmr + ? Template.asString([ + "function loadUpdateChunk(chunkId, updatedModulesList) {", + Template.indent([ + `var update = require(${JSON.stringify(rootOutputDir)} + ${ + RuntimeGlobals.getChunkUpdateScriptFilename + }(chunkId));`, + "var updatedModules = update.modules;", + "var runtime = update.runtime;", + "for(var moduleId in updatedModules) {", + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(updatedModules, moduleId)) {`, + Template.indent([ + `currentUpdate[moduleId] = updatedModules[moduleId];`, + "if(updatedModulesList) updatedModulesList.push(moduleId);" + ]), + "}" + ]), + "}", + "if(runtime) currentUpdateRuntime.push(runtime);" + ]), + "}", + "", + Template.getFunctionContent( + require('./JavascriptHotModuleReplacement.runtime.js') + ) + .replace(/\$key\$/g, "require") + .replace(/\$installedChunks\$/g, "installedChunks") + .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") + .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) + .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) + .replace( + /\$ensureChunkHandlers\$/g, + RuntimeGlobals.ensureChunkHandlers + ) + .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) + .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) + .replace( + /\$hmrDownloadUpdateHandlers\$/g, + RuntimeGlobals.hmrDownloadUpdateHandlers + ) + .replace( + /\$hmrInvalidateModuleHandlers\$/g, + RuntimeGlobals.hmrInvalidateModuleHandlers + ) + ]) + : "// no HMR", + "", + withHmrManifest + ? Template.asString([ + `${RuntimeGlobals.hmrDownloadManifest} = function() {`, + Template.indent([ + "return Promise.resolve().then(function() {", + Template.indent([ + `return require(${JSON.stringify(rootOutputDir)} + ${ + RuntimeGlobals.getUpdateManifestFilename + }());` + ]), + "})['catch'](function(err) { if(err.code !== 'MODULE_NOT_FOUND') throw err; });" + ]), + "}" + ]) + : "// no HMR manifest" + ]); } } -module.exports = JavascriptParser; -module.exports.ALLOWED_MEMBER_TYPES_ALL = ALLOWED_MEMBER_TYPES_ALL; -module.exports.ALLOWED_MEMBER_TYPES_EXPRESSION = - ALLOWED_MEMBER_TYPES_EXPRESSION; -module.exports.ALLOWED_MEMBER_TYPES_CALL_EXPRESSION = - ALLOWED_MEMBER_TYPES_CALL_EXPRESSION; +module.exports = RequireChunkLoadingRuntimeModule; /***/ }), -/***/ 93998: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 91786: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -102182,112 +99363,148 @@ module.exports.ALLOWED_MEMBER_TYPES_CALL_EXPRESSION = -const UnsupportedFeatureWarning = __webpack_require__(42495); -const ConstDependency = __webpack_require__(76911); -const BasicEvaluatedExpression = __webpack_require__(950); +const util = __webpack_require__(73837); +const truncateArgs = __webpack_require__(62090); -/** @typedef {import("estree").Expression} ExpressionNode */ -/** @typedef {import("estree").Node} Node */ -/** @typedef {import("./JavascriptParser")} JavascriptParser */ +module.exports = ({ colors, appendOnly, stream }) => { + let currentStatusMessage = undefined; + let hasStatusMessage = false; + let currentIndent = ""; + let currentCollapsed = 0; -/** - * @param {JavascriptParser} parser the parser - * @param {string} value the const value - * @param {string[]=} runtimeRequirements runtime requirements - * @returns {function(ExpressionNode): true} plugin function - */ -exports.toConstantDependency = (parser, value, runtimeRequirements) => { - return function constDependency(expr) { - const dep = new ConstDependency(value, expr.range, runtimeRequirements); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - return true; + const indent = (str, prefix, colorPrefix, colorSuffix) => { + if (str === "") return str; + prefix = currentIndent + prefix; + if (colors) { + return ( + prefix + + colorPrefix + + str.replace(/\n/g, colorSuffix + "\n" + prefix + colorPrefix) + + colorSuffix + ); + } else { + return prefix + str.replace(/\n/g, "\n" + prefix); + } }; -}; -/** - * @param {string} value the string value - * @returns {function(ExpressionNode): BasicEvaluatedExpression} plugin function - */ -exports.evaluateToString = value => { - return function stringExpression(expr) { - return new BasicEvaluatedExpression().setString(value).setRange(expr.range); + const clearStatusMessage = () => { + if (hasStatusMessage) { + stream.write("\x1b[2K\r"); + hasStatusMessage = false; + } }; -}; -/** - * @param {number} value the number value - * @returns {function(ExpressionNode): BasicEvaluatedExpression} plugin function - */ -exports.evaluateToNumber = value => { - return function stringExpression(expr) { - return new BasicEvaluatedExpression().setNumber(value).setRange(expr.range); + const writeStatusMessage = () => { + if (!currentStatusMessage) return; + const l = stream.columns; + const args = l + ? truncateArgs(currentStatusMessage, l - 1) + : currentStatusMessage; + const str = args.join(" "); + const coloredStr = `\u001b[1m${str}\u001b[39m\u001b[22m`; + stream.write(`\x1b[2K\r${coloredStr}`); + hasStatusMessage = true; }; -}; -/** - * @param {boolean} value the boolean value - * @returns {function(ExpressionNode): BasicEvaluatedExpression} plugin function - */ -exports.evaluateToBoolean = value => { - return function booleanExpression(expr) { - return new BasicEvaluatedExpression() - .setBoolean(value) - .setRange(expr.range); + const writeColored = (prefix, colorPrefix, colorSuffix) => { + return (...args) => { + if (currentCollapsed > 0) return; + clearStatusMessage(); + const str = indent( + util.format(...args), + prefix, + colorPrefix, + colorSuffix + ); + stream.write(str + "\n"); + writeStatusMessage(); + }; }; -}; -/** - * @param {string} identifier identifier - * @param {string} rootInfo rootInfo - * @param {function(): string[]} getMembers getMembers - * @param {boolean|null=} truthy is truthy, null if nullish - * @returns {function(ExpressionNode): BasicEvaluatedExpression} callback - */ -exports.evaluateToIdentifier = (identifier, rootInfo, getMembers, truthy) => { - return function identifierExpression(expr) { - let evaluatedExpression = new BasicEvaluatedExpression() - .setIdentifier(identifier, rootInfo, getMembers) - .setSideEffects(false) - .setRange(expr.range); - switch (truthy) { - case true: - evaluatedExpression.setTruthy(); - break; - case null: - evaluatedExpression.setNullish(true); - break; - case false: - evaluatedExpression.setFalsy(); - break; - } + const writeGroupMessage = writeColored( + "<-> ", + "\u001b[1m\u001b[36m", + "\u001b[39m\u001b[22m" + ); - return evaluatedExpression; - }; -}; + const writeGroupCollapsedMessage = writeColored( + "<+> ", + "\u001b[1m\u001b[36m", + "\u001b[39m\u001b[22m" + ); -exports.expressionIsUnsupported = (parser, message) => { - return function unsupportedExpression(expr) { - const dep = new ConstDependency("(void 0)", expr.range, null); - dep.loc = expr.loc; - parser.state.module.addPresentationalDependency(dep); - if (!parser.state.module) return; - parser.state.module.addWarning( - new UnsupportedFeatureWarning(message, expr.loc) - ); - return true; + return { + log: writeColored(" ", "\u001b[1m", "\u001b[22m"), + debug: writeColored(" ", "", ""), + trace: writeColored(" ", "", ""), + info: writeColored(" ", "\u001b[1m\u001b[32m", "\u001b[39m\u001b[22m"), + warn: writeColored(" ", "\u001b[1m\u001b[33m", "\u001b[39m\u001b[22m"), + error: writeColored(" ", "\u001b[1m\u001b[31m", "\u001b[39m\u001b[22m"), + logTime: writeColored( + " ", + "\u001b[1m\u001b[35m", + "\u001b[39m\u001b[22m" + ), + group: (...args) => { + writeGroupMessage(...args); + if (currentCollapsed > 0) { + currentCollapsed++; + } else { + currentIndent += " "; + } + }, + groupCollapsed: (...args) => { + writeGroupCollapsedMessage(...args); + currentCollapsed++; + }, + groupEnd: () => { + if (currentCollapsed > 0) currentCollapsed--; + else if (currentIndent.length >= 2) + currentIndent = currentIndent.slice(0, currentIndent.length - 2); + }, + // eslint-disable-next-line node/no-unsupported-features/node-builtins + profile: console.profile && (name => console.profile(name)), + // eslint-disable-next-line node/no-unsupported-features/node-builtins + profileEnd: console.profileEnd && (name => console.profileEnd(name)), + clear: + !appendOnly && + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.clear && + (() => { + clearStatusMessage(); + // eslint-disable-next-line node/no-unsupported-features/node-builtins + console.clear(); + writeStatusMessage(); + }), + status: appendOnly + ? writeColored(" ", "", "") + : (name, ...args) => { + args = args.filter(Boolean); + if (name === undefined && args.length === 0) { + clearStatusMessage(); + currentStatusMessage = undefined; + } else if ( + typeof name === "string" && + name.startsWith("[webpack.Progress] ") + ) { + currentStatusMessage = [name.slice(19), ...args]; + writeStatusMessage(); + } else if (name === "[webpack.Progress]") { + currentStatusMessage = [...args]; + writeStatusMessage(); + } else { + currentStatusMessage = [name, ...args]; + writeStatusMessage(); + } + } }; }; -exports.skipTraversal = () => true; - -exports.approve = () => true; - /***/ }), -/***/ 98124: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 64395: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -102297,185 +99514,96 @@ exports.approve = () => true; -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const { isSubset } = __webpack_require__(93347); -const { getAllChunks } = __webpack_require__(91145); +const { STAGE_ADVANCED } = __webpack_require__(80057); -/** @typedef {import("../util/Hash")} Hash */ /** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../ChunkGraph").EntryModuleWithChunkGroup} EntryModuleWithChunkGroup */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {(string|number)[]} EntryItem */ - -const EXPORT_PREFIX = "var __webpack_exports__ = "; - -/** - * @param {ChunkGraph} chunkGraph chunkGraph - * @param {RuntimeTemplate} runtimeTemplate runtimeTemplate - * @param {EntryModuleWithChunkGroup[]} entries entries - * @param {Chunk} chunk chunk - * @param {boolean} passive true: passive startup with on chunks loaded - * @returns {string} runtime code - */ -exports.generateEntryStartup = ( - chunkGraph, - runtimeTemplate, - entries, - chunk, - passive -) => { - /** @type {string[]} */ - const runtime = [ - `var __webpack_exec__ = ${runtimeTemplate.returningFunction( - `__webpack_require__(${RuntimeGlobals.entryModuleId} = moduleId)`, - "moduleId" - )}` - ]; - - const runModule = id => { - return `__webpack_exec__(${JSON.stringify(id)})`; - }; - const outputCombination = (chunks, moduleIds, final) => { - if (chunks.size === 0) { - runtime.push( - `${final ? EXPORT_PREFIX : ""}(${moduleIds.map(runModule).join(", ")});` - ); - } else { - const fn = runtimeTemplate.returningFunction( - moduleIds.map(runModule).join(", ") - ); - runtime.push( - `${final && !passive ? EXPORT_PREFIX : ""}${ - passive - ? RuntimeGlobals.onChunksLoaded - : RuntimeGlobals.startupEntrypoint - }(0, ${JSON.stringify(Array.from(chunks, c => c.id))}, ${fn});` - ); - if (final && passive) { - runtime.push(`${EXPORT_PREFIX}${RuntimeGlobals.onChunksLoaded}();`); - } - } - }; - - let currentChunks = undefined; - let currentModuleIds = undefined; +/** @typedef {import("../Compiler")} Compiler */ - for (const [module, entrypoint] of entries) { - const runtimeChunk = entrypoint.getRuntimeChunk(); - const moduleId = chunkGraph.getModuleId(module); - const chunks = getAllChunks(entrypoint, chunk, runtimeChunk); +class AggressiveMergingPlugin { + constructor(options) { if ( - currentChunks && - currentChunks.size === chunks.size && - isSubset(currentChunks, chunks) + (options !== undefined && typeof options !== "object") || + Array.isArray(options) ) { - currentModuleIds.push(moduleId); - } else { - if (currentChunks) { - outputCombination(currentChunks, currentModuleIds); - } - currentChunks = chunks; - currentModuleIds = [moduleId]; + throw new Error( + "Argument should be an options object. To use defaults, pass in nothing.\nFor more info on options, see https://webpack.js.org/plugins/" + ); } + this.options = options || {}; } - // output current modules with export prefix - if (currentChunks) { - outputCombination(currentChunks, currentModuleIds, true); - } - runtime.push(""); - return Template.asString(runtime); -}; - -/** - * @param {Hash} hash the hash to update - * @param {ChunkGraph} chunkGraph chunkGraph - * @param {EntryModuleWithChunkGroup[]} entries entries - * @param {Chunk} chunk chunk - * @returns {void} - */ -exports.updateHashForEntryStartup = (hash, chunkGraph, entries, chunk) => { - for (const [module, entrypoint] of entries) { - const runtimeChunk = entrypoint.getRuntimeChunk(); - const moduleId = chunkGraph.getModuleId(module); - hash.update(`${moduleId}`); - for (const c of getAllChunks(entrypoint, chunk, runtimeChunk)) - hash.update(`${c.id}`); - } -}; - -/** - * @param {Chunk} chunk the chunk - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {function(Chunk, ChunkGraph): boolean} filterFn filter function - * @returns {Set} initially fulfilled chunk ids - */ -exports.getInitialChunkIds = (chunk, chunkGraph, filterFn) => { - const initialChunkIds = new Set(chunk.ids); - for (const c of chunk.getAllInitialChunks()) { - if (c === chunk || filterFn(c, chunkGraph)) continue; - for (const id of c.ids) initialChunkIds.add(id); - } - return initialChunkIds; -}; - - -/***/ }), - -/***/ 90490: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const options = this.options; + const minSizeReduce = options.minSizeReduce || 1.5; + compiler.hooks.thisCompilation.tap( + "AggressiveMergingPlugin", + compilation => { + compilation.hooks.optimizeChunks.tap( + { + name: "AggressiveMergingPlugin", + stage: STAGE_ADVANCED + }, + chunks => { + const chunkGraph = compilation.chunkGraph; + /** @type {{a: Chunk, b: Chunk, improvement: number}[]} */ + let combinations = []; + for (const a of chunks) { + if (a.canBeInitial()) continue; + for (const b of chunks) { + if (b.canBeInitial()) continue; + if (b === a) break; + if (!chunkGraph.canChunksBeIntegrated(a, b)) { + continue; + } + const aSize = chunkGraph.getChunkSize(b, { + chunkOverhead: 0 + }); + const bSize = chunkGraph.getChunkSize(a, { + chunkOverhead: 0 + }); + const abSize = chunkGraph.getIntegratedChunksSize(b, a, { + chunkOverhead: 0 + }); + const improvement = (aSize + bSize) / abSize; + combinations.push({ + a, + b, + improvement + }); + } + } + combinations.sort((a, b) => { + return b.improvement - a.improvement; + }); -const { register } = __webpack_require__(8282); + const pair = combinations[0]; -class JsonData { - constructor(data) { - this._buffer = undefined; - this._data = undefined; - if (Buffer.isBuffer(data)) { - this._buffer = data; - } else { - this._data = data; - } - } + if (!pair) return; + if (pair.improvement < minSizeReduce) return; - get() { - if (this._data === undefined && this._buffer !== undefined) { - this._data = JSON.parse(this._buffer.toString()); - } - return this._data; + chunkGraph.integrateChunks(pair.b, pair.a); + compilation.chunks.delete(pair.a); + return true; + } + ); + } + ); } } -register(JsonData, "webpack/lib/json/JsonData", null, { - serialize(obj, { write }) { - if (obj._buffer === undefined && obj._data !== undefined) { - obj._buffer = Buffer.from(JSON.stringify(obj._data)); - } - write(obj._buffer); - }, - deserialize({ read }) { - return new JsonData(read()); - } -}); - -module.exports = JsonData; +module.exports = AggressiveMergingPlugin; /***/ }), -/***/ 70393: +/***/ 15543: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -102486,318 +99614,333 @@ module.exports = JsonData; -const { RawSource } = __webpack_require__(51255); -const ConcatenationScope = __webpack_require__(98229); -const { UsageState } = __webpack_require__(63686); -const Generator = __webpack_require__(93401); -const RuntimeGlobals = __webpack_require__(16475); +const { STAGE_ADVANCED } = __webpack_require__(80057); +const { intersect } = __webpack_require__(93347); +const { + compareModulesByIdentifier, + compareChunks +} = __webpack_require__(29579); +const createSchemaValidation = __webpack_require__(32540); +const identifierUtils = __webpack_require__(82186); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../ExportsInfo")} ExportsInfo */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ -/** @typedef {import("../NormalModule")} NormalModule */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +/** @typedef {import("../../declarations/plugins/optimize/AggressiveSplittingPlugin").AggressiveSplittingPluginOptions} AggressiveSplittingPluginOptions */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ -const stringifySafe = data => { - const stringified = JSON.stringify(data); - if (!stringified) { - return undefined; // Invalid JSON +const validate = createSchemaValidation( + __webpack_require__(32697), + () => + __webpack_require__(47995), + { + name: "Aggressive Splitting Plugin", + baseDataPath: "options" } +); - return stringified.replace(/\u2028|\u2029/g, str => - str === "\u2029" ? "\\u2029" : "\\u2028" - ); // invalid in JavaScript but valid JSON +const moveModuleBetween = (chunkGraph, oldChunk, newChunk) => { + return module => { + chunkGraph.disconnectChunkAndModule(oldChunk, module); + chunkGraph.connectChunkAndModule(newChunk, module); + }; }; /** - * @param {Object} data data (always an object or array) - * @param {ExportsInfo} exportsInfo exports info - * @param {RuntimeSpec} runtime the runtime - * @returns {Object} reduced data + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {Chunk} chunk the chunk + * @returns {function(Module): boolean} filter for entry module */ -const createObjectForExportsInfo = (data, exportsInfo, runtime) => { - if (exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused) - return data; - const isArray = Array.isArray(data); - const reducedData = isArray ? [] : {}; - for (const key of Object.keys(data)) { - const exportInfo = exportsInfo.getReadOnlyExportInfo(key); - const used = exportInfo.getUsed(runtime); - if (used === UsageState.Unused) continue; +const isNotAEntryModule = (chunkGraph, chunk) => { + return module => { + return !chunkGraph.isEntryModuleInChunk(module, chunk); + }; +}; - let value; - if (used === UsageState.OnlyPropertiesUsed && exportInfo.exportsInfo) { - value = createObjectForExportsInfo( - data[key], - exportInfo.exportsInfo, - runtime - ); - } else { - value = data[key]; - } - const name = exportInfo.getUsedName(key, runtime); - reducedData[name] = value; - } - if (isArray) { - let arrayLengthWhenUsed = - exportsInfo.getReadOnlyExportInfo("length").getUsed(runtime) !== - UsageState.Unused - ? data.length - : undefined; +/** @type {WeakSet} */ +const recordedChunks = new WeakSet(); - let sizeObjectMinusArray = 0; - for (let i = 0; i < reducedData.length; i++) { - if (reducedData[i] === undefined) { - sizeObjectMinusArray -= 2; - } else { - sizeObjectMinusArray += `${i}`.length + 3; - } +class AggressiveSplittingPlugin { + /** + * @param {AggressiveSplittingPluginOptions=} options options object + */ + constructor(options = {}) { + validate(options); + + this.options = options; + if (typeof this.options.minSize !== "number") { + this.options.minSize = 30 * 1024; } - if (arrayLengthWhenUsed !== undefined) { - sizeObjectMinusArray += - `${arrayLengthWhenUsed}`.length + - 8 - - (arrayLengthWhenUsed - reducedData.length) * 2; + if (typeof this.options.maxSize !== "number") { + this.options.maxSize = 50 * 1024; } - if (sizeObjectMinusArray < 0) - return Object.assign( - arrayLengthWhenUsed === undefined - ? {} - : { length: arrayLengthWhenUsed }, - reducedData - ); - const generatedLength = - arrayLengthWhenUsed !== undefined - ? Math.max(arrayLengthWhenUsed, reducedData.length) - : reducedData.length; - for (let i = 0; i < generatedLength; i++) { - if (reducedData[i] === undefined) { - reducedData[i] = 0; - } + if (typeof this.options.chunkOverhead !== "number") { + this.options.chunkOverhead = 0; + } + if (typeof this.options.entryChunkMultiplicator !== "number") { + this.options.entryChunkMultiplicator = 1; } } - return reducedData; -}; - -const TYPES = new Set(["javascript"]); -class JsonGenerator extends Generator { /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) + * @param {Chunk} chunk the chunk to test + * @returns {boolean} true if the chunk was recorded */ - getTypes(module) { - return TYPES; + static wasChunkRecorded(chunk) { + return recordedChunks.has(chunk); } /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - getSize(module, type) { - let data = - module.buildInfo && - module.buildInfo.jsonData && - module.buildInfo.jsonData.get(); - if (!data) return 0; - return stringifySafe(data).length + 10; - } - - /** - * @param {NormalModule} module module for which the bailout reason should be determined - * @param {ConcatenationBailoutReasonContext} context context - * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated - */ - getConcatenationBailoutReason(module, context) { - return undefined; - } - - /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code - */ - generate( - module, - { - moduleGraph, - runtimeTemplate, - runtimeRequirements, - runtime, - concatenationScope - } - ) { - const data = - module.buildInfo && - module.buildInfo.jsonData && - module.buildInfo.jsonData.get(); - if (data === undefined) { - return new RawSource( - runtimeTemplate.missingModuleStatement({ - request: module.rawRequest - }) - ); - } - const exportsInfo = moduleGraph.getExportsInfo(module); - let finalJson = - typeof data === "object" && - data && - exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused - ? createObjectForExportsInfo(data, exportsInfo, runtime) - : data; - // Use JSON because JSON.parse() is much faster than JavaScript evaluation - const jsonStr = stringifySafe(finalJson); - const jsonExpr = - jsonStr.length > 20 && typeof finalJson === "object" - ? `JSON.parse('${jsonStr.replace(/[\\']/g, "\\$&")}')` - : jsonStr; - let content; - if (concatenationScope) { - content = `${runtimeTemplate.supportsConst() ? "const" : "var"} ${ - ConcatenationScope.NAMESPACE_OBJECT_EXPORT - } = ${jsonExpr};`; - concatenationScope.registerNamespaceExport( - ConcatenationScope.NAMESPACE_OBJECT_EXPORT - ); - } else { - runtimeRequirements.add(RuntimeGlobals.module); - content = `${module.moduleArgument}.exports = ${jsonExpr};`; - } - return new RawSource(content); - } -} - -module.exports = JsonGenerator; - - -/***/ }), - -/***/ 86770: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "AggressiveSplittingPlugin", + compilation => { + let needAdditionalSeal = false; + let newSplits; + let fromAggressiveSplittingSet; + let chunkSplitDataMap; + compilation.hooks.optimize.tap("AggressiveSplittingPlugin", () => { + newSplits = []; + fromAggressiveSplittingSet = new Set(); + chunkSplitDataMap = new Map(); + }); + compilation.hooks.optimizeChunks.tap( + { + name: "AggressiveSplittingPlugin", + stage: STAGE_ADVANCED + }, + chunks => { + const chunkGraph = compilation.chunkGraph; + // Precompute stuff + const nameToModuleMap = new Map(); + const moduleToNameMap = new Map(); + const makePathsRelative = + identifierUtils.makePathsRelative.bindContextCache( + compiler.context, + compiler.root + ); + for (const m of compilation.modules) { + const name = makePathsRelative(m.identifier()); + nameToModuleMap.set(name, m); + moduleToNameMap.set(m, name); + } + // Check used chunk ids + const usedIds = new Set(); + for (const chunk of chunks) { + usedIds.add(chunk.id); + } -const createSchemaValidation = __webpack_require__(32540); -const JsonGenerator = __webpack_require__(70393); -const JsonParser = __webpack_require__(41090); + const recordedSplits = + (compilation.records && compilation.records.aggressiveSplits) || + []; + const usedSplits = newSplits + ? recordedSplits.concat(newSplits) + : recordedSplits; -/** @typedef {import("../Compiler")} Compiler */ + const minSize = this.options.minSize; + const maxSize = this.options.maxSize; -const validate = createSchemaValidation( - __webpack_require__(54094), - () => __webpack_require__(50166), - { - name: "Json Modules Plugin", - baseDataPath: "parser" - } -); + const applySplit = splitData => { + // Cannot split if id is already taken + if (splitData.id !== undefined && usedIds.has(splitData.id)) { + return false; + } -class JsonModulesPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "JsonModulesPlugin", - (compilation, { normalModuleFactory }) => { - normalModuleFactory.hooks.createParser - .for("json") - .tap("JsonModulesPlugin", parserOptions => { - validate(parserOptions); + // Get module objects from names + const selectedModules = splitData.modules.map(name => + nameToModuleMap.get(name) + ); - return new JsonParser(parserOptions); - }); - normalModuleFactory.hooks.createGenerator - .for("json") - .tap("JsonModulesPlugin", () => { - return new JsonGenerator(); - }); - } - ); - } -} + // Does the modules exist at all? + if (!selectedModules.every(Boolean)) return false; -module.exports = JsonModulesPlugin; + // Check if size matches (faster than waiting for hash) + let size = 0; + for (const m of selectedModules) size += m.size(); + if (size !== splitData.size) return false; + // get chunks with all modules + const selectedChunks = intersect( + selectedModules.map( + m => new Set(chunkGraph.getModuleChunksIterable(m)) + ) + ); -/***/ }), + // No relevant chunks found + if (selectedChunks.size === 0) return false; -/***/ 41090: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // The found chunk is already the split or similar + if ( + selectedChunks.size === 1 && + chunkGraph.getNumberOfChunkModules( + Array.from(selectedChunks)[0] + ) === selectedModules.length + ) { + const chunk = Array.from(selectedChunks)[0]; + if (fromAggressiveSplittingSet.has(chunk)) return false; + fromAggressiveSplittingSet.add(chunk); + chunkSplitDataMap.set(chunk, splitData); + return true; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // split the chunk into two parts + const newChunk = compilation.addChunk(); + newChunk.chunkReason = "aggressive splitted"; + for (const chunk of selectedChunks) { + selectedModules.forEach( + moveModuleBetween(chunkGraph, chunk, newChunk) + ); + chunk.split(newChunk); + chunk.name = null; + } + fromAggressiveSplittingSet.add(newChunk); + chunkSplitDataMap.set(newChunk, splitData); + if (splitData.id !== null && splitData.id !== undefined) { + newChunk.id = splitData.id; + newChunk.ids = [splitData.id]; + } + return true; + }; + // try to restore to recorded splitting + let changed = false; + for (let j = 0; j < usedSplits.length; j++) { + const splitData = usedSplits[j]; + if (applySplit(splitData)) changed = true; + } -const parseJson = __webpack_require__(15235); -const Parser = __webpack_require__(11715); -const JsonExportsDependency = __webpack_require__(750); -const JsonData = __webpack_require__(90490); + // for any chunk which isn't splitted yet, split it and create a new entry + // start with the biggest chunk + const cmpFn = compareChunks(chunkGraph); + const sortedChunks = Array.from(chunks).sort((a, b) => { + const diff1 = + chunkGraph.getChunkModulesSize(b) - + chunkGraph.getChunkModulesSize(a); + if (diff1) return diff1; + const diff2 = + chunkGraph.getNumberOfChunkModules(a) - + chunkGraph.getNumberOfChunkModules(b); + if (diff2) return diff2; + return cmpFn(a, b); + }); + for (const chunk of sortedChunks) { + if (fromAggressiveSplittingSet.has(chunk)) continue; + const size = chunkGraph.getChunkModulesSize(chunk); + if ( + size > maxSize && + chunkGraph.getNumberOfChunkModules(chunk) > 1 + ) { + const modules = chunkGraph + .getOrderedChunkModules(chunk, compareModulesByIdentifier) + .filter(isNotAEntryModule(chunkGraph, chunk)); + const selectedModules = []; + let selectedModulesSize = 0; + for (let k = 0; k < modules.length; k++) { + const module = modules[k]; + const newSize = selectedModulesSize + module.size(); + if (newSize > maxSize && selectedModulesSize >= minSize) { + break; + } + selectedModulesSize = newSize; + selectedModules.push(module); + } + if (selectedModules.length === 0) continue; + const splitData = { + modules: selectedModules + .map(m => moduleToNameMap.get(m)) + .sort(), + size: selectedModulesSize + }; -/** @typedef {import("../../declarations/plugins/JsonModulesPluginParser").JsonModulesPluginParserOptions} JsonModulesPluginParserOptions */ -/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ + if (applySplit(splitData)) { + newSplits = (newSplits || []).concat(splitData); + changed = true; + } + } + } + if (changed) return true; + } + ); + compilation.hooks.recordHash.tap( + "AggressiveSplittingPlugin", + records => { + // 4. save made splittings to records + const allSplits = new Set(); + const invalidSplits = new Set(); -class JsonParser extends Parser { - /** - * @param {JsonModulesPluginParserOptions} options parser options - */ - constructor(options) { - super(); - this.options = options || {}; - } + // Check if some splittings are invalid + // We remove invalid splittings and try again + for (const chunk of compilation.chunks) { + const splitData = chunkSplitDataMap.get(chunk); + if (splitData !== undefined) { + if (splitData.hash && chunk.hash !== splitData.hash) { + // Split was successful, but hash doesn't equal + // We can throw away the split since it's useless now + invalidSplits.add(splitData); + } + } + } - /** - * @param {string | Buffer | PreparsedAst} source the source to parse - * @param {ParserState} state the parser state - * @returns {ParserState} the parser state - */ - parse(source, state) { - if (Buffer.isBuffer(source)) { - source = source.toString("utf-8"); - } + if (invalidSplits.size > 0) { + records.aggressiveSplits = records.aggressiveSplits.filter( + splitData => !invalidSplits.has(splitData) + ); + needAdditionalSeal = true; + } else { + // set hash and id values on all (new) splittings + for (const chunk of compilation.chunks) { + const splitData = chunkSplitDataMap.get(chunk); + if (splitData !== undefined) { + splitData.hash = chunk.hash; + splitData.id = chunk.id; + allSplits.add(splitData); + // set flag for stats + recordedChunks.add(chunk); + } + } - /** @type {JsonModulesPluginParserOptions["parse"]} */ - const parseFn = - typeof this.options.parse === "function" ? this.options.parse : parseJson; + // Also add all unused historical splits (after the used ones) + // They can still be used in some future compilation + const recordedSplits = + compilation.records && compilation.records.aggressiveSplits; + if (recordedSplits) { + for (const splitData of recordedSplits) { + if (!invalidSplits.has(splitData)) allSplits.add(splitData); + } + } - const data = - typeof source === "object" - ? source - : parseFn(source[0] === "\ufeff" ? source.slice(1) : source); + // record all splits + records.aggressiveSplits = Array.from(allSplits); - state.module.buildInfo.jsonData = new JsonData(data); - state.module.buildInfo.strict = true; - state.module.buildMeta.exportsType = "default"; - state.module.buildMeta.defaultObject = - typeof data === "object" ? "redirect-warn" : false; - state.module.addDependency( - new JsonExportsDependency(JsonExportsDependency.getExportsFromData(data)) + needAdditionalSeal = false; + } + } + ); + compilation.hooks.needAdditionalSeal.tap( + "AggressiveSplittingPlugin", + () => { + if (needAdditionalSeal) { + needAdditionalSeal = false; + return true; + } + } + ); + } ); - return state; } } - -module.exports = JsonParser; +module.exports = AggressiveSplittingPlugin; /***/ }), -/***/ 26030: +/***/ 97198: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -102808,1680 +99951,1883 @@ module.exports = JsonParser; +const eslintScope = __webpack_require__(36007); +const Referencer = __webpack_require__(44585); +const { + CachedSource, + ConcatSource, + ReplaceSource +} = __webpack_require__(51255); +const ConcatenationScope = __webpack_require__(98229); +const { UsageState } = __webpack_require__(63686); +const Module = __webpack_require__(73208); const RuntimeGlobals = __webpack_require__(16475); -const JavascriptModulesPlugin = __webpack_require__(89464); +const Template = __webpack_require__(1626); +const HarmonyImportDependency = __webpack_require__(57154); +const JavascriptParser = __webpack_require__(29050); +const { equals } = __webpack_require__(84953); +const LazySet = __webpack_require__(38938); +const { concatComparators, keepOriginalOrder } = __webpack_require__(29579); +const createHash = __webpack_require__(49835); +const { makePathsRelative } = __webpack_require__(82186); +const makeSerializable = __webpack_require__(33032); +const propertyAccess = __webpack_require__(54190); +const { + filterRuntime, + intersectRuntime, + mergeRuntimeCondition, + mergeRuntimeConditionNonFalse, + runtimeConditionToString, + subtractRuntimeCondition +} = __webpack_require__(17156); +/** @typedef {import("eslint-scope").Scope} Scope */ /** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ -/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ /** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../CodeGenerationResults")} CodeGenerationResults */ /** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */ +/** @template T @typedef {import("../InitFragment")} InitFragment */ +/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */ /** @typedef {import("../util/Hash")} Hash */ +/** @typedef {typeof import("../util/Hash")} HashConstructor */ +/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -const COMMON_LIBRARY_NAME_MESSAGE = - "Common configuration options that specific library names are 'output.library[.name]', 'entry.xyz.library[.name]', 'ModuleFederationPlugin.name' and 'ModuleFederationPlugin.library[.name]'."; +// fix eslint-scope to support class properties correctly +// cspell:word Referencer +const ReferencerClass = Referencer; +if (!ReferencerClass.prototype.PropertyDefinition) { + ReferencerClass.prototype.PropertyDefinition = + ReferencerClass.prototype.Property; +} /** - * @template T - * @typedef {Object} LibraryContext - * @property {Compilation} compilation - * @property {ChunkGraph} chunkGraph - * @property {T} options + * @typedef {Object} ReexportInfo + * @property {Module} module + * @property {string[]} export */ +/** @typedef {RawBinding | SymbolBinding} Binding */ + /** - * @template T + * @typedef {Object} RawBinding + * @property {ModuleInfo} info + * @property {string} rawName + * @property {string=} comment + * @property {string[]} ids + * @property {string[]} exportName */ -class AbstractLibraryPlugin { - /** - * @param {Object} options options - * @param {string} options.pluginName name of the plugin - * @param {LibraryType} options.type used library type - */ - constructor({ pluginName, type }) { - this._pluginName = pluginName; - this._type = type; - this._parseCache = new WeakMap(); - } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const { _pluginName } = this; - compiler.hooks.thisCompilation.tap(_pluginName, compilation => { - compilation.hooks.finishModules.tap( - { name: _pluginName, stage: 10 }, - () => { - for (const [ - name, - { - dependencies: deps, - options: { library } - } - ] of compilation.entries) { - const options = this._parseOptionsCached( - library !== undefined - ? library - : compilation.outputOptions.library - ); - if (options !== false) { - const dep = deps[deps.length - 1]; - if (dep) { - const module = compilation.moduleGraph.getModule(dep); - if (module) { - this.finishEntryModule(module, name, { - options, - compilation, - chunkGraph: compilation.chunkGraph - }); - } - } - } - } - } - ); - - const getOptionsForChunk = chunk => { - if (compilation.chunkGraph.getNumberOfEntryModules(chunk) === 0) - return false; - const options = chunk.getEntryOptions(); - const library = options && options.library; - return this._parseOptionsCached( - library !== undefined ? library : compilation.outputOptions.library - ); - }; - - if ( - this.render !== AbstractLibraryPlugin.prototype.render || - this.runtimeRequirements !== - AbstractLibraryPlugin.prototype.runtimeRequirements - ) { - compilation.hooks.additionalChunkRuntimeRequirements.tap( - _pluginName, - (chunk, set, { chunkGraph }) => { - const options = getOptionsForChunk(chunk); - if (options !== false) { - this.runtimeRequirements(chunk, set, { - options, - compilation, - chunkGraph - }); - } - } - ); - } - - const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); - - if (this.render !== AbstractLibraryPlugin.prototype.render) { - hooks.render.tap(_pluginName, (source, renderContext) => { - const options = getOptionsForChunk(renderContext.chunk); - if (options === false) return source; - return this.render(source, renderContext, { - options, - compilation, - chunkGraph: compilation.chunkGraph - }); - }); - } - - if ( - this.embedInRuntimeBailout !== - AbstractLibraryPlugin.prototype.embedInRuntimeBailout - ) { - hooks.embedInRuntimeBailout.tap( - _pluginName, - (module, renderContext) => { - const options = getOptionsForChunk(renderContext.chunk); - if (options === false) return; - return this.embedInRuntimeBailout(module, renderContext, { - options, - compilation, - chunkGraph: compilation.chunkGraph - }); - } - ); - } - - if ( - this.strictRuntimeBailout !== - AbstractLibraryPlugin.prototype.strictRuntimeBailout - ) { - hooks.strictRuntimeBailout.tap(_pluginName, renderContext => { - const options = getOptionsForChunk(renderContext.chunk); - if (options === false) return; - return this.strictRuntimeBailout(renderContext, { - options, - compilation, - chunkGraph: compilation.chunkGraph - }); - }); - } - - if ( - this.renderStartup !== AbstractLibraryPlugin.prototype.renderStartup - ) { - hooks.renderStartup.tap( - _pluginName, - (source, module, renderContext) => { - const options = getOptionsForChunk(renderContext.chunk); - if (options === false) return source; - return this.renderStartup(source, module, renderContext, { - options, - compilation, - chunkGraph: compilation.chunkGraph - }); - } - ); - } - - hooks.chunkHash.tap(_pluginName, (chunk, hash, context) => { - const options = getOptionsForChunk(chunk); - if (options === false) return; - this.chunkHash(chunk, hash, context, { - options, - compilation, - chunkGraph: compilation.chunkGraph - }); - }); - }); - } - - /** - * @param {LibraryOptions=} library normalized library option - * @returns {T | false} preprocess as needed by overriding - */ - _parseOptionsCached(library) { - if (!library) return false; - if (library.type !== this._type) return false; - const cacheEntry = this._parseCache.get(library); - if (cacheEntry !== undefined) return cacheEntry; - const result = this.parseOptions(library); - this._parseCache.set(library, result); - return result; - } - - /* istanbul ignore next */ - /** - * @abstract - * @param {LibraryOptions} library normalized library option - * @returns {T | false} preprocess as needed by overriding - */ - parseOptions(library) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); - } - - /** - * @param {Module} module the exporting entry module - * @param {string} entryName the name of the entrypoint - * @param {LibraryContext} libraryContext context - * @returns {void} - */ - finishEntryModule(module, entryName, libraryContext) {} - - /** - * @param {Module} module the exporting entry module - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {string | undefined} bailout reason - */ - embedInRuntimeBailout(module, renderContext, libraryContext) { - return undefined; - } - - /** - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {string | undefined} bailout reason - */ - strictRuntimeBailout(renderContext, libraryContext) { - return undefined; - } - - /** - * @param {Chunk} chunk the chunk - * @param {Set} set runtime requirements - * @param {LibraryContext} libraryContext context - * @returns {void} - */ - runtimeRequirements(chunk, set, libraryContext) { - if (this.render !== AbstractLibraryPlugin.prototype.render) - set.add(RuntimeGlobals.returnExportsFromRuntime); - } - - /** - * @param {Source} source source - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export - */ - render(source, renderContext, libraryContext) { - return source; - } - - /** - * @param {Source} source source - * @param {Module} module module - * @param {StartupRenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export - */ - renderStartup(source, module, renderContext, libraryContext) { - return source; - } - - /** - * @param {Chunk} chunk the chunk - * @param {Hash} hash hash - * @param {ChunkHashContext} chunkHashContext chunk hash context - * @param {LibraryContext} libraryContext context - * @returns {void} - */ - chunkHash(chunk, hash, chunkHashContext, libraryContext) { - const options = this._parseOptionsCached( - libraryContext.compilation.outputOptions.library - ); - hash.update(this._pluginName); - hash.update(JSON.stringify(options)); - } -} - -AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE = COMMON_LIBRARY_NAME_MESSAGE; -module.exports = AbstractLibraryPlugin; - - -/***/ }), - -/***/ 67416: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { ConcatSource } = __webpack_require__(51255); -const ExternalModule = __webpack_require__(73071); -const Template = __webpack_require__(39722); -const AbstractLibraryPlugin = __webpack_require__(26030); +/** + * @typedef {Object} SymbolBinding + * @property {ConcatenatedModuleInfo} info + * @property {string} name + * @property {string=} comment + * @property {string[]} ids + * @property {string[]} exportName + */ -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ -/** @typedef {import("../util/Hash")} Hash */ -/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ +/** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo } ModuleInfo */ +/** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo | ReferenceToModuleInfo } ModuleInfoOrReference */ /** - * @typedef {Object} AmdLibraryPluginOptions - * @property {LibraryType} type - * @property {boolean=} requireAsWrapper + * @typedef {Object} ConcatenatedModuleInfo + * @property {"concatenated"} type + * @property {Module} module + * @property {number} index + * @property {Object} ast + * @property {Source} internalSource + * @property {ReplaceSource} source + * @property {InitFragment[]=} chunkInitFragments + * @property {Iterable} runtimeRequirements + * @property {Scope} globalScope + * @property {Scope} moduleScope + * @property {Map} internalNames + * @property {Map} exportMap + * @property {Map} rawExportMap + * @property {string=} namespaceExportSymbol + * @property {string} namespaceObjectName + * @property {boolean} interopNamespaceObjectUsed + * @property {string} interopNamespaceObjectName + * @property {boolean} interopNamespaceObject2Used + * @property {string} interopNamespaceObject2Name + * @property {boolean} interopDefaultAccessUsed + * @property {string} interopDefaultAccessName */ /** - * @typedef {Object} AmdLibraryPluginParsed + * @typedef {Object} ExternalModuleInfo + * @property {"external"} type + * @property {Module} module + * @property {RuntimeSpec | boolean} runtimeCondition + * @property {number} index * @property {string} name + * @property {boolean} interopNamespaceObjectUsed + * @property {string} interopNamespaceObjectName + * @property {boolean} interopNamespaceObject2Used + * @property {string} interopNamespaceObject2Name + * @property {boolean} interopDefaultAccessUsed + * @property {string} interopDefaultAccessName */ /** - * @typedef {AmdLibraryPluginParsed} T - * @extends {AbstractLibraryPlugin} + * @typedef {Object} ReferenceToModuleInfo + * @property {"reference"} type + * @property {RuntimeSpec | boolean} runtimeCondition + * @property {ConcatenatedModuleInfo | ExternalModuleInfo} target */ -class AmdLibraryPlugin extends AbstractLibraryPlugin { - /** - * @param {AmdLibraryPluginOptions} options the plugin options - */ - constructor(options) { - super({ - pluginName: "AmdLibraryPlugin", - type: options.type - }); - this.requireAsWrapper = options.requireAsWrapper; - } - /** - * @param {LibraryOptions} library normalized library option - * @returns {T | false} preprocess as needed by overriding - */ - parseOptions(library) { - const { name } = library; - if (this.requireAsWrapper) { - if (name) { - throw new Error( - `AMD library name must be unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` - ); - } - } else { - if (name && typeof name !== "string") { - throw new Error( - `AMD library name must be a simple string or unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` - ); - } - } - return { - name: /** @type {string=} */ (name) - }; - } +const RESERVED_NAMES = new Set( + [ + // internal names (should always be renamed) + ConcatenationScope.DEFAULT_EXPORT, + ConcatenationScope.NAMESPACE_OBJECT_EXPORT, - /** - * @param {Source} source source - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export - */ - render( - source, - { chunkGraph, chunk, runtimeTemplate }, - { options, compilation } - ) { - const modern = runtimeTemplate.supportsArrowFunction(); - const modules = chunkGraph - .getChunkModules(chunk) - .filter(m => m instanceof ExternalModule); - const externals = /** @type {ExternalModule[]} */ (modules); - const externalsDepsArray = JSON.stringify( - externals.map(m => - typeof m.request === "object" && !Array.isArray(m.request) - ? m.request.amd - : m.request - ) - ); - const externalsArguments = externals - .map( - m => - `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( - `${chunkGraph.getModuleId(m)}` - )}__` - ) - .join(", "); + // keywords + "abstract,arguments,async,await,boolean,break,byte,case,catch,char,class,const,continue", + "debugger,default,delete,do,double,else,enum,eval,export,extends,false,final,finally,float", + "for,function,goto,if,implements,import,in,instanceof,int,interface,let,long,native,new,null", + "package,private,protected,public,return,short,static,super,switch,synchronized,this,throw", + "throws,transient,true,try,typeof,var,void,volatile,while,with,yield", - const iife = runtimeTemplate.isIIFE(); - const fnStart = - (modern - ? `(${externalsArguments}) => {` - : `function(${externalsArguments}) {`) + - (iife || !chunk.hasRuntime() ? " return " : "\n"); - const fnEnd = iife ? ";\n}" : "\n}"; + // commonjs/amd + "module,__dirname,__filename,exports,require,define", - if (this.requireAsWrapper) { - return new ConcatSource( - `require(${externalsDepsArray}, ${fnStart}`, - source, - `${fnEnd});` - ); - } else if (options.name) { - const name = compilation.getPath(options.name, { - chunk - }); + // js globals + "Array,Date,eval,function,hasOwnProperty,Infinity,isFinite,isNaN,isPrototypeOf,length,Math", + "NaN,name,Number,Object,prototype,String,toString,undefined,valueOf", - return new ConcatSource( - `define(${JSON.stringify(name)}, ${externalsDepsArray}, ${fnStart}`, - source, - `${fnEnd});` - ); - } else if (externalsArguments) { - return new ConcatSource( - `define(${externalsDepsArray}, ${fnStart}`, - source, - `${fnEnd});` - ); - } else { - return new ConcatSource(`define(${fnStart}`, source, `${fnEnd});`); + // browser globals + "alert,all,anchor,anchors,area,assign,blur,button,checkbox,clearInterval,clearTimeout", + "clientInformation,close,closed,confirm,constructor,crypto,decodeURI,decodeURIComponent", + "defaultStatus,document,element,elements,embed,embeds,encodeURI,encodeURIComponent,escape", + "event,fileUpload,focus,form,forms,frame,innerHeight,innerWidth,layer,layers,link,location", + "mimeTypes,navigate,navigator,frames,frameRate,hidden,history,image,images,offscreenBuffering", + "open,opener,option,outerHeight,outerWidth,packages,pageXOffset,pageYOffset,parent,parseFloat", + "parseInt,password,pkcs11,plugin,prompt,propertyIsEnum,radio,reset,screenX,screenY,scroll", + "secure,select,self,setInterval,setTimeout,status,submit,taint,text,textarea,top,unescape", + "untaint,window", + + // window events + "onblur,onclick,onerror,onfocus,onkeydown,onkeypress,onkeyup,onmouseover,onload,onmouseup,onmousedown,onsubmit" + ] + .join(",") + .split(",") +); + +const bySourceOrder = (a, b) => { + const aOrder = a.sourceOrder; + const bOrder = b.sourceOrder; + if (isNaN(aOrder)) { + if (!isNaN(bOrder)) { + return 1; + } + } else { + if (isNaN(bOrder)) { + return -1; + } + if (aOrder !== bOrder) { + return aOrder < bOrder ? -1 : 1; } } + return 0; +}; - /** - * @param {Chunk} chunk the chunk - * @param {Hash} hash hash - * @param {ChunkHashContext} chunkHashContext chunk hash context - * @param {LibraryContext} libraryContext context - * @returns {void} - */ - chunkHash(chunk, hash, chunkHashContext, { options, compilation }) { - hash.update("AmdLibraryPlugin"); - if (this.requireAsWrapper) { - hash.update("requireAsWrapper"); - } else if (options.name) { - hash.update("named"); - const name = compilation.getPath(options.name, { - chunk - }); - hash.update(name); +const joinIterableWithComma = iterable => { + // This is more performant than Array.from().join(", ") + // as it doesn't create an array + let str = ""; + let first = true; + for (const item of iterable) { + if (first) { + first = false; + } else { + str += ", "; } + str += item; } -} - -module.exports = AmdLibraryPlugin; - - -/***/ }), - -/***/ 40080: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - + return str; +}; -const { ConcatSource } = __webpack_require__(51255); -const { UsageState } = __webpack_require__(63686); -const Template = __webpack_require__(39722); -const propertyAccess = __webpack_require__(54190); -const { getEntryRuntime } = __webpack_require__(17156); -const AbstractLibraryPlugin = __webpack_require__(26030); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */ -/** @typedef {import("../util/Hash")} Hash */ -/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ - -const KEYWORD_REGEX = - /^(await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|super|switch|static|this|throw|try|true|typeof|var|void|while|with|yield)$/; -const IDENTIFIER_REGEX = - /^[\p{L}\p{Nl}$_][\p{L}\p{Nl}$\p{Mn}\p{Mc}\p{Nd}\p{Pc}]*$/iu; - -/** - * Validates the library name by checking for keywords and valid characters - * @param {string} name name to be validated - * @returns {boolean} true, when valid - */ -const isNameValid = name => { - return !KEYWORD_REGEX.test(name) && IDENTIFIER_REGEX.test(name); -}; +/** + * @typedef {Object} ConcatenationEntry + * @property {"concatenated" | "external"} type + * @property {Module} module + * @property {RuntimeSpec | boolean} runtimeCondition + */ /** - * @param {string[]} accessor variable plus properties - * @param {number} existingLength items of accessor that are existing already - * @param {boolean=} initLast if the last property should also be initialized to an object - * @returns {string} code to access the accessor while initializing + * @param {ModuleGraph} moduleGraph the module graph + * @param {ModuleInfo} info module info + * @param {string[]} exportName exportName + * @param {Map} moduleToInfoMap moduleToInfoMap + * @param {RuntimeSpec} runtime for which runtime + * @param {RequestShortener} requestShortener the request shortener + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @param {Set} neededNamespaceObjects modules for which a namespace object should be generated + * @param {boolean} asCall asCall + * @param {boolean} strictHarmonyModule strictHarmonyModule + * @param {boolean | undefined} asiSafe asiSafe + * @param {Set} alreadyVisited alreadyVisited + * @returns {Binding} the final variable */ -const accessWithInit = (accessor, existingLength, initLast = false) => { - // This generates for [a, b, c, d]: - // (((a = typeof a === "undefined" ? {} : a).b = a.b || {}).c = a.b.c || {}).d - const base = accessor[0]; - if (accessor.length === 1 && !initLast) return base; - let current = - existingLength > 0 - ? base - : `(${base} = typeof ${base} === "undefined" ? {} : ${base})`; - - // i is the current position in accessor that has been printed - let i = 1; - - // all properties printed so far (excluding base) - let propsSoFar; - - // if there is existingLength, print all properties until this position as property access - if (existingLength > i) { - propsSoFar = accessor.slice(1, existingLength); - i = existingLength; - current += propertyAccess(propsSoFar); +const getFinalBinding = ( + moduleGraph, + info, + exportName, + moduleToInfoMap, + runtime, + requestShortener, + runtimeTemplate, + neededNamespaceObjects, + asCall, + strictHarmonyModule, + asiSafe, + alreadyVisited = new Set() +) => { + const exportsType = info.module.getExportsType( + moduleGraph, + strictHarmonyModule + ); + if (exportName.length === 0) { + switch (exportsType) { + case "default-only": + info.interopNamespaceObject2Used = true; + return { + info, + rawName: info.interopNamespaceObject2Name, + ids: exportName, + exportName + }; + case "default-with-named": + info.interopNamespaceObjectUsed = true; + return { + info, + rawName: info.interopNamespaceObjectName, + ids: exportName, + exportName + }; + case "namespace": + case "dynamic": + break; + default: + throw new Error(`Unexpected exportsType ${exportsType}`); + } } else { - propsSoFar = []; + switch (exportsType) { + case "namespace": + break; + case "default-with-named": + switch (exportName[0]) { + case "default": + exportName = exportName.slice(1); + break; + case "__esModule": + return { + info, + rawName: "/* __esModule */true", + ids: exportName.slice(1), + exportName + }; + } + break; + case "default-only": { + const exportId = exportName[0]; + if (exportId === "__esModule") { + return { + info, + rawName: "/* __esModule */true", + ids: exportName.slice(1), + exportName + }; + } + exportName = exportName.slice(1); + if (exportId !== "default") { + return { + info, + rawName: + "/* non-default import from default-exporting module */undefined", + ids: exportName, + exportName + }; + } + break; + } + case "dynamic": + switch (exportName[0]) { + case "default": { + exportName = exportName.slice(1); + info.interopDefaultAccessUsed = true; + const defaultExport = asCall + ? `${info.interopDefaultAccessName}()` + : asiSafe + ? `(${info.interopDefaultAccessName}())` + : asiSafe === false + ? `;(${info.interopDefaultAccessName}())` + : `${info.interopDefaultAccessName}.a`; + return { + info, + rawName: defaultExport, + ids: exportName, + exportName + }; + } + case "__esModule": + return { + info, + rawName: "/* __esModule */true", + ids: exportName.slice(1), + exportName + }; + } + break; + default: + throw new Error(`Unexpected exportsType ${exportsType}`); + } } - - // all remaining properties (except the last one when initLast is not set) - // should be printed as initializer - const initUntil = initLast ? accessor.length : accessor.length - 1; - for (; i < initUntil; i++) { - const prop = accessor[i]; - propsSoFar.push(prop); - current = `(${current}${propertyAccess([prop])} = ${base}${propertyAccess( - propsSoFar - )} || {})`; + if (exportName.length === 0) { + switch (info.type) { + case "concatenated": + neededNamespaceObjects.add(info); + return { + info, + rawName: info.namespaceObjectName, + ids: exportName, + exportName + }; + case "external": + return { info, rawName: info.name, ids: exportName, exportName }; + } } + const exportsInfo = moduleGraph.getExportsInfo(info.module); + const exportInfo = exportsInfo.getExportInfo(exportName[0]); + if (alreadyVisited.has(exportInfo)) { + return { + info, + rawName: "/* circular reexport */ Object(function x() { x() }())", + ids: [], + exportName + }; + } + alreadyVisited.add(exportInfo); + switch (info.type) { + case "concatenated": { + const exportId = exportName[0]; + if (exportInfo.provided === false) { + // It's not provided, but it could be on the prototype + neededNamespaceObjects.add(info); + return { + info, + rawName: info.namespaceObjectName, + ids: exportName, + exportName + }; + } + const directExport = info.exportMap && info.exportMap.get(exportId); + if (directExport) { + const usedName = /** @type {string[]} */ ( + exportsInfo.getUsedName(exportName, runtime) + ); + if (!usedName) { + return { + info, + rawName: "/* unused export */ undefined", + ids: exportName.slice(1), + exportName + }; + } + return { + info, + name: directExport, + ids: usedName.slice(1), + exportName + }; + } + const rawExport = info.rawExportMap && info.rawExportMap.get(exportId); + if (rawExport) { + return { + info, + rawName: rawExport, + ids: exportName.slice(1), + exportName + }; + } + const reexport = exportInfo.findTarget(moduleGraph, module => + moduleToInfoMap.has(module) + ); + if (reexport === false) { + throw new Error( + `Target module of reexport from '${info.module.readableIdentifier( + requestShortener + )}' is not part of the concatenation (export '${exportId}')\nModules in the concatenation:\n${Array.from( + moduleToInfoMap, + ([m, info]) => + ` * ${info.type} ${m.readableIdentifier(requestShortener)}` + ).join("\n")}` + ); + } + if (reexport) { + const refInfo = moduleToInfoMap.get(reexport.module); + return getFinalBinding( + moduleGraph, + refInfo, + reexport.export + ? [...reexport.export, ...exportName.slice(1)] + : exportName.slice(1), + moduleToInfoMap, + runtime, + requestShortener, + runtimeTemplate, + neededNamespaceObjects, + asCall, + info.module.buildMeta.strictHarmonyModule, + asiSafe, + alreadyVisited + ); + } + if (info.namespaceExportSymbol) { + const usedName = /** @type {string[]} */ ( + exportsInfo.getUsedName(exportName, runtime) + ); + return { + info, + rawName: info.namespaceObjectName, + ids: usedName, + exportName + }; + } + throw new Error( + `Cannot get final name for export '${exportName.join( + "." + )}' of ${info.module.readableIdentifier(requestShortener)}` + ); + } - // print the last property as property access if not yet printed - if (i < accessor.length) - current = `${current}${propertyAccess([accessor[accessor.length - 1]])}`; - - return current; + case "external": { + const used = /** @type {string[]} */ ( + exportsInfo.getUsedName(exportName, runtime) + ); + if (!used) { + return { + info, + rawName: "/* unused export */ undefined", + ids: exportName.slice(1), + exportName + }; + } + const comment = equals(used, exportName) + ? "" + : Template.toNormalComment(`${exportName.join(".")}`); + return { info, rawName: info.name + comment, ids: used, exportName }; + } + } }; /** - * @typedef {Object} AssignLibraryPluginOptions - * @property {LibraryType} type - * @property {string[] | "global"} prefix name prefix - * @property {string | false} declare declare name as variable - * @property {"error"|"static"|"copy"|"assign"} unnamed behavior for unnamed library name - * @property {"copy"|"assign"=} named behavior for named library name - */ - -/** - * @typedef {Object} AssignLibraryPluginParsed - * @property {string | string[]} name - * @property {string | string[] | undefined} export - */ - -/** - * @typedef {AssignLibraryPluginParsed} T - * @extends {AbstractLibraryPlugin} + * @param {ModuleGraph} moduleGraph the module graph + * @param {ModuleInfo} info module info + * @param {string[]} exportName exportName + * @param {Map} moduleToInfoMap moduleToInfoMap + * @param {RuntimeSpec} runtime for which runtime + * @param {RequestShortener} requestShortener the request shortener + * @param {RuntimeTemplate} runtimeTemplate the runtime template + * @param {Set} neededNamespaceObjects modules for which a namespace object should be generated + * @param {boolean} asCall asCall + * @param {boolean} callContext callContext + * @param {boolean} strictHarmonyModule strictHarmonyModule + * @param {boolean | undefined} asiSafe asiSafe + * @returns {string} the final name */ -class AssignLibraryPlugin extends AbstractLibraryPlugin { - /** - * @param {AssignLibraryPluginOptions} options the plugin options - */ - constructor(options) { - super({ - pluginName: "AssignLibraryPlugin", - type: options.type - }); - this.prefix = options.prefix; - this.declare = options.declare; - this.unnamed = options.unnamed; - this.named = options.named || "assign"; - } - - /** - * @param {LibraryOptions} library normalized library option - * @returns {T | false} preprocess as needed by overriding - */ - parseOptions(library) { - const { name } = library; - if (this.unnamed === "error") { - if (typeof name !== "string" && !Array.isArray(name)) { - throw new Error( - `Library name must be a string or string array. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` - ); - } +const getFinalName = ( + moduleGraph, + info, + exportName, + moduleToInfoMap, + runtime, + requestShortener, + runtimeTemplate, + neededNamespaceObjects, + asCall, + callContext, + strictHarmonyModule, + asiSafe +) => { + const binding = getFinalBinding( + moduleGraph, + info, + exportName, + moduleToInfoMap, + runtime, + requestShortener, + runtimeTemplate, + neededNamespaceObjects, + asCall, + strictHarmonyModule, + asiSafe + ); + { + const { ids, comment } = binding; + let reference; + let isPropertyAccess; + if ("rawName" in binding) { + reference = `${binding.rawName}${comment || ""}${propertyAccess(ids)}`; + isPropertyAccess = ids.length > 0; } else { - if (name && typeof name !== "string" && !Array.isArray(name)) { + const { info, name: exportId } = binding; + const name = info.internalNames.get(exportId); + if (!name) { throw new Error( - `Library name must be a string, string array or unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` + `The export "${exportId}" in "${info.module.readableIdentifier( + requestShortener + )}" has no internal name (existing names: ${ + Array.from( + info.internalNames, + ([name, symbol]) => `${name}: ${symbol}` + ).join(", ") || "none" + })` ); } + reference = `${name}${comment || ""}${propertyAccess(ids)}`; + isPropertyAccess = ids.length > 1; } - return { - name: /** @type {string|string[]=} */ (name), - export: library.export - }; + if (isPropertyAccess && asCall && callContext === false) { + return asiSafe + ? `(0,${reference})` + : asiSafe === false + ? `;(0,${reference})` + : `/*#__PURE__*/Object(${reference})`; + } + return reference; } +}; - /** - * @param {Module} module the exporting entry module - * @param {string} entryName the name of the entrypoint - * @param {LibraryContext} libraryContext context - * @returns {void} - */ - finishEntryModule( - module, - entryName, - { options, compilation, compilation: { moduleGraph } } - ) { - const runtime = getEntryRuntime(compilation, entryName); - if (options.export) { - const exportsInfo = moduleGraph.getExportInfo( - module, - Array.isArray(options.export) ? options.export[0] : options.export - ); - exportsInfo.setUsed(UsageState.Used, runtime); - exportsInfo.canMangleUse = false; - } else { - const exportsInfo = moduleGraph.getExportsInfo(module); - exportsInfo.setUsedInUnknownWay(runtime); +const addScopeSymbols = (s, nameSet, scopeSet1, scopeSet2) => { + let scope = s; + while (scope) { + if (scopeSet1.has(scope)) break; + if (scopeSet2.has(scope)) break; + scopeSet1.add(scope); + for (const variable of scope.variables) { + nameSet.add(variable.name); } - moduleGraph.addExtraReason(module, "used as library export"); + scope = scope.upper; } +}; - _getPrefix(compilation) { - return this.prefix === "global" - ? [compilation.runtimeTemplate.globalObject] - : this.prefix; +const getAllReferences = variable => { + let set = variable.references; + // Look for inner scope variables too (like in class Foo { t() { Foo } }) + const identifiers = new Set(variable.identifiers); + for (const scope of variable.scope.childScopes) { + for (const innerVar of scope.variables) { + if (innerVar.identifiers.some(id => identifiers.has(id))) { + set = set.concat(innerVar.references); + break; + } + } } + return set; +}; - _getResolvedFullName(options, chunk, compilation) { - const prefix = this._getPrefix(compilation); - const fullName = options.name ? prefix.concat(options.name) : prefix; - return fullName.map(n => - compilation.getPath(n, { - chunk - }) - ); +const getPathInAst = (ast, node) => { + if (ast === node) { + return []; } - /** - * @param {Source} source source - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export - */ - render(source, { chunk }, { options, compilation }) { - const fullNameResolved = this._getResolvedFullName( - options, - chunk, - compilation - ); - if (this.declare) { - const base = fullNameResolved[0]; - if (!isNameValid(base)) { - throw new Error( - `Library name base (${base}) must be a valid identifier when using a var declaring library type. Either use a valid identifier (e. g. ${Template.toIdentifier( - base - )}) or use a different library type (e. g. 'type: "global"', which assign a property on the global scope instead of declaring a variable). ${ - AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE - }` - ); + const nr = node.range; + + const enterNode = n => { + if (!n) return undefined; + const r = n.range; + if (r) { + if (r[0] <= nr[0] && r[1] >= nr[1]) { + const path = getPathInAst(n, node); + if (path) { + path.push(n); + return path; + } + } + } + return undefined; + }; + + if (Array.isArray(ast)) { + for (let i = 0; i < ast.length; i++) { + const enterResult = enterNode(ast[i]); + if (enterResult !== undefined) return enterResult; + } + } else if (ast && typeof ast === "object") { + const keys = Object.keys(ast); + for (let i = 0; i < keys.length; i++) { + const value = ast[keys[i]]; + if (Array.isArray(value)) { + const pathResult = getPathInAst(value, node); + if (pathResult !== undefined) return pathResult; + } else if (value && typeof value === "object") { + const enterResult = enterNode(value); + if (enterResult !== undefined) return enterResult; } - source = new ConcatSource(`${this.declare} ${base};\n`, source); } - return source; } +}; + +const TYPES = new Set(["javascript"]); +class ConcatenatedModule extends Module { /** - * @param {Module} module the exporting entry module - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {string | undefined} bailout reason + * @param {Module} rootModule the root module of the concatenation + * @param {Set} modules all modules in the concatenation (including the root module) + * @param {RuntimeSpec} runtime the runtime + * @param {Object=} associatedObjectForCache object for caching + * @param {string | HashConstructor=} hashFunction hash function to use + * @returns {ConcatenatedModule} the module */ - embedInRuntimeBailout( - module, - { chunk, codeGenerationResults }, - { options, compilation } + static create( + rootModule, + modules, + runtime, + associatedObjectForCache, + hashFunction = "md4" ) { - const { data } = codeGenerationResults.get(module, chunk.runtime); - const topLevelDeclarations = - (data && data.get("topLevelDeclarations")) || - (module.buildInfo && module.buildInfo.topLevelDeclarations); - if (!topLevelDeclarations) - return "it doesn't tell about top level declarations."; - const fullNameResolved = this._getResolvedFullName( - options, - chunk, - compilation + const identifier = ConcatenatedModule._createIdentifier( + rootModule, + modules, + associatedObjectForCache, + hashFunction ); - const base = fullNameResolved[0]; - if (topLevelDeclarations.has(base)) - return `it declares '${base}' on top-level, which conflicts with the current library output.`; + return new ConcatenatedModule({ + identifier, + rootModule, + modules, + runtime + }); } /** - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {string | undefined} bailout reason + * @param {Object} options options + * @param {string} options.identifier the identifier of the module + * @param {Module=} options.rootModule the root module of the concatenation + * @param {RuntimeSpec} options.runtime the selected runtime + * @param {Set=} options.modules all concatenated modules */ - strictRuntimeBailout({ chunk }, { options, compilation }) { - if ( - this.declare || - this.prefix === "global" || - this.prefix.length > 0 || - !options.name - ) { - return; - } - return "a global variable is assign and maybe created"; - } + constructor({ identifier, rootModule, modules, runtime }) { + super("javascript/esm", null, rootModule && rootModule.layer); - /** - * @param {Source} source source - * @param {Module} module module - * @param {StartupRenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export - */ - renderStartup( - source, - module, - { moduleGraph, chunk }, - { options, compilation } - ) { - const fullNameResolved = this._getResolvedFullName( - options, - chunk, - compilation - ); - const staticExports = this.unnamed === "static"; - const exportAccess = options.export - ? propertyAccess( - Array.isArray(options.export) ? options.export : [options.export] - ) - : ""; - const result = new ConcatSource(source); - if (staticExports) { - const exportsInfo = moduleGraph.getExportsInfo(module); - const exportTarget = accessWithInit( - fullNameResolved, - this._getPrefix(compilation).length, - true - ); - for (const exportInfo of exportsInfo.orderedExports) { - if (!exportInfo.provided) continue; - const nameAccess = propertyAccess([exportInfo.name]); - result.add( - `${exportTarget}${nameAccess} = __webpack_exports__${exportAccess}${nameAccess};\n` - ); - } - result.add( - `Object.defineProperty(${exportTarget}, "__esModule", { value: true });\n` - ); - } else if (options.name ? this.named === "copy" : this.unnamed === "copy") { - result.add( - `var __webpack_export_target__ = ${accessWithInit( - fullNameResolved, - this._getPrefix(compilation).length, - true - )};\n` - ); - let exports = "__webpack_exports__"; - if (exportAccess) { - result.add( - `var __webpack_exports_export__ = __webpack_exports__${exportAccess};\n` - ); - exports = "__webpack_exports_export__"; - } - result.add( - `for(var i in ${exports}) __webpack_export_target__[i] = ${exports}[i];\n` - ); - result.add( - `if(${exports}.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true });\n` - ); - } else { - result.add( - `${accessWithInit( - fullNameResolved, - this._getPrefix(compilation).length, - false - )} = __webpack_exports__${exportAccess};\n` - ); - } - return result; + // Info from Factory + /** @type {string} */ + this._identifier = identifier; + /** @type {Module} */ + this.rootModule = rootModule; + /** @type {Set} */ + this._modules = modules; + this._runtime = runtime; + this.factoryMeta = rootModule && rootModule.factoryMeta; } /** - * @param {Chunk} chunk the chunk - * @param {Set} set runtime requirements - * @param {LibraryContext} libraryContext context + * Assuming this module is in the cache. Update the (cached) module with + * the fresh module from the factory. Usually updates internal references + * and properties. + * @param {Module} module fresh module * @returns {void} */ - runtimeRequirements(chunk, set, libraryContext) { - // we don't need to return exports from runtime + updateCacheModule(module) { + throw new Error("Must not be called"); } /** - * @param {Chunk} chunk the chunk - * @param {Hash} hash hash - * @param {ChunkHashContext} chunkHashContext chunk hash context - * @param {LibraryContext} libraryContext context - * @returns {void} + * @returns {Set} types available (do not mutate) */ - chunkHash(chunk, hash, chunkHashContext, { options, compilation }) { - hash.update("AssignLibraryPlugin"); - const fullNameResolved = this._getResolvedFullName( - options, - chunk, - compilation - ); - if (options.name ? this.named === "copy" : this.unnamed === "copy") { - hash.update("copy"); - } - if (this.declare) { - hash.update(this.declare); - } - hash.update(fullNameResolved.join(".")); - if (options.export) { - hash.update(`${options.export}`); - } + getSourceTypes() { + return TYPES; } -} - -module.exports = AssignLibraryPlugin; - - -/***/ }), - -/***/ 91452: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - + get modules() { + return Array.from(this._modules); + } -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ -/** @typedef {import("../Compiler")} Compiler */ - -/** @type {WeakMap>} */ -const enabledTypes = new WeakMap(); + /** + * @returns {string} a unique identifier of the module + */ + identifier() { + return this._identifier; + } -const getEnabledTypes = compiler => { - let set = enabledTypes.get(compiler); - if (set === undefined) { - set = new Set(); - enabledTypes.set(compiler, set); + /** + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + return ( + this.rootModule.readableIdentifier(requestShortener) + + ` + ${this._modules.size - 1} modules` + ); } - return set; -}; -class EnableLibraryPlugin { /** - * @param {LibraryType} type library type that should be available + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion */ - constructor(type) { - this.type = type; + libIdent(options) { + return this.rootModule.libIdent(options); } /** - * @param {Compiler} compiler the compiler instance - * @param {LibraryType} type type of library - * @returns {void} + * @returns {string | null} absolute path which should be used for condition matching (usually the resource path) */ - static setEnabled(compiler, type) { - getEnabledTypes(compiler).add(type); + nameForCondition() { + return this.rootModule.nameForCondition(); } /** - * @param {Compiler} compiler the compiler instance - * @param {LibraryType} type type of library - * @returns {void} + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConnectionState} how this module should be connected to referencing modules when consumed for side-effects only */ - static checkEnabled(compiler, type) { - if (!getEnabledTypes(compiler).has(type)) { - throw new Error( - `Library type "${type}" is not enabled. ` + - "EnableLibraryPlugin need to be used to enable this type of library. " + - 'This usually happens through the "output.enabledLibraryTypes" option. ' + - 'If you are using a function as entry which sets "library", you need to add all potential library types to "output.enabledLibraryTypes". ' + - "These types are enabled: " + - Array.from(getEnabledTypes(compiler)).join(", ") - ); - } + getSideEffectsConnectionState(moduleGraph) { + return this.rootModule.getSideEffectsConnectionState(moduleGraph); } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function * @returns {void} */ - apply(compiler) { - const { type } = this; + build(options, compilation, resolver, fs, callback) { + const { rootModule } = this; + this.buildInfo = { + strict: true, + cacheable: true, + moduleArgument: rootModule.buildInfo.moduleArgument, + exportsArgument: rootModule.buildInfo.exportsArgument, + fileDependencies: new LazySet(), + contextDependencies: new LazySet(), + missingDependencies: new LazySet(), + topLevelDeclarations: new Set(), + assets: undefined + }; + this.buildMeta = rootModule.buildMeta; + this.clearDependenciesAndBlocks(); + this.clearWarningsAndErrors(); - // Only enable once - const enabled = getEnabledTypes(compiler); - if (enabled.has(type)) return; - enabled.add(type); + for (const m of this._modules) { + // populate cacheable + if (!m.buildInfo.cacheable) { + this.buildInfo.cacheable = false; + } - if (typeof type === "string") { - const enableExportProperty = () => { - const ExportPropertyTemplatePlugin = __webpack_require__(5487); - new ExportPropertyTemplatePlugin({ - type, - nsObjectUsed: type !== "module" - }).apply(compiler); - }; - switch (type) { - case "var": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: [], - declare: "var", - unnamed: "error" - }).apply(compiler); - break; - } - case "assign-properties": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: [], - declare: false, - unnamed: "error", - named: "copy" - }).apply(compiler); - break; - } - case "assign": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: [], - declare: false, - unnamed: "error" - }).apply(compiler); - break; - } - case "this": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: ["this"], - declare: false, - unnamed: "copy" - }).apply(compiler); - break; - } - case "window": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: ["window"], - declare: false, - unnamed: "copy" - }).apply(compiler); - break; + // populate dependencies + for (const d of m.dependencies.filter( + dep => + !(dep instanceof HarmonyImportDependency) || + !this._modules.has(compilation.moduleGraph.getModule(dep)) + )) { + this.dependencies.push(d); + } + // populate blocks + for (const d of m.blocks) { + this.blocks.push(d); + } + + // populate warnings + const warnings = m.getWarnings(); + if (warnings !== undefined) { + for (const warning of warnings) { + this.addWarning(warning); } - case "self": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: ["self"], - declare: false, - unnamed: "copy" - }).apply(compiler); - break; + } + + // populate errors + const errors = m.getErrors(); + if (errors !== undefined) { + for (const error of errors) { + this.addError(error); } - case "global": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: "global", - declare: false, - unnamed: "copy" - }).apply(compiler); - break; + } + + // populate topLevelDeclarations + if (m.buildInfo.topLevelDeclarations) { + const topLevelDeclarations = this.buildInfo.topLevelDeclarations; + if (topLevelDeclarations !== undefined) { + for (const decl of m.buildInfo.topLevelDeclarations) { + topLevelDeclarations.add(decl); + } } - case "commonjs": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: ["exports"], - declare: false, - unnamed: "copy" - }).apply(compiler); - break; + } else { + this.buildInfo.topLevelDeclarations = undefined; + } + + // populate assets + if (m.buildInfo.assets) { + if (this.buildInfo.assets === undefined) { + this.buildInfo.assets = Object.create(null); } - case "commonjs-static": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: ["exports"], - declare: false, - unnamed: "static" - }).apply(compiler); - break; + Object.assign(this.buildInfo.assets, m.buildInfo.assets); + } + if (m.buildInfo.assetsInfo) { + if (this.buildInfo.assetsInfo === undefined) { + this.buildInfo.assetsInfo = new Map(); } - case "commonjs2": - case "commonjs-module": { - //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 - const AssignLibraryPlugin = __webpack_require__(40080); - new AssignLibraryPlugin({ - type, - prefix: ["module", "exports"], - declare: false, - unnamed: "assign" - }).apply(compiler); - break; + for (const [key, value] of m.buildInfo.assetsInfo) { + this.buildInfo.assetsInfo.set(key, value); } - case "amd": - case "amd-require": { - enableExportProperty(); - const AmdLibraryPlugin = __webpack_require__(67416); - new AmdLibraryPlugin({ - type, - requireAsWrapper: type === "amd-require" - }).apply(compiler); - break; - } - case "umd": - case "umd2": { - enableExportProperty(); - const UmdLibraryPlugin = __webpack_require__(54442); - new UmdLibraryPlugin({ - type, - optionalAmdExternalAsGlobal: type === "umd2" - }).apply(compiler); - break; - } - case "system": { - enableExportProperty(); - const SystemLibraryPlugin = __webpack_require__(11707); - new SystemLibraryPlugin({ - type - }).apply(compiler); - break; - } - case "jsonp": { - enableExportProperty(); - const JsonpLibraryPlugin = __webpack_require__(84415); - new JsonpLibraryPlugin({ - type - }).apply(compiler); - break; - } - case "module": { - enableExportProperty(); - const ModuleLibraryPlugin = __webpack_require__(59780); - new ModuleLibraryPlugin({ - type - }).apply(compiler); - break; - } - default: - throw new Error(`Unsupported library type ${type}. -Plugins which provide custom library types must call EnableLibraryPlugin.setEnabled(compiler, type) to disable this error.`); } - } else { - // TODO support plugin instances here - // apply them to the compiler } + callback(); } -} - -module.exports = EnableLibraryPlugin; - - -/***/ }), - -/***/ 5487: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { ConcatSource } = __webpack_require__(51255); -const { UsageState } = __webpack_require__(63686); -const propertyAccess = __webpack_require__(54190); -const { getEntryRuntime } = __webpack_require__(17156); -const AbstractLibraryPlugin = __webpack_require__(26030); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */ -/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ - -/** - * @typedef {Object} ExportPropertyLibraryPluginParsed - * @property {string | string[]} export - */ -/** - * @typedef {Object} ExportPropertyLibraryPluginOptions - * @property {LibraryType} type - * @property {boolean} nsObjectUsed the namespace object is used - */ -/** - * @typedef {ExportPropertyLibraryPluginParsed} T - * @extends {AbstractLibraryPlugin} - */ -class ExportPropertyLibraryPlugin extends AbstractLibraryPlugin { /** - * @param {ExportPropertyLibraryPluginOptions} options options + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) */ - constructor({ type, nsObjectUsed }) { - super({ - pluginName: "ExportPropertyLibraryPlugin", - type - }); - this.nsObjectUsed = nsObjectUsed; + size(type) { + // Guess size from embedded modules + let size = 0; + for (const module of this._modules) { + size += module.size(type); + } + return size; } /** - * @param {LibraryOptions} library normalized library option - * @returns {T | false} preprocess as needed by overriding + * @private + * @param {Module} rootModule the root of the concatenation + * @param {Set} modulesSet a set of modules which should be concatenated + * @param {RuntimeSpec} runtime for this runtime + * @param {ModuleGraph} moduleGraph the module graph + * @returns {ConcatenationEntry[]} concatenation list */ - parseOptions(library) { - return { - export: library.export - }; - } + _createConcatenationList(rootModule, modulesSet, runtime, moduleGraph) { + /** @type {ConcatenationEntry[]} */ + const list = []; + /** @type {Map} */ + const existingEntries = new Map(); - /** - * @param {Module} module the exporting entry module - * @param {string} entryName the name of the entrypoint - * @param {LibraryContext} libraryContext context - * @returns {void} - */ - finishEntryModule( - module, - entryName, - { options, compilation, compilation: { moduleGraph } } - ) { - const runtime = getEntryRuntime(compilation, entryName); - if (options.export) { - const exportsInfo = moduleGraph.getExportInfo( - module, - Array.isArray(options.export) ? options.export[0] : options.export + /** + * @param {Module} module a module + * @returns {Iterable<{ connection: ModuleGraphConnection, runtimeCondition: RuntimeSpec | true }>} imported modules in order + */ + const getConcatenatedImports = module => { + let connections = Array.from(moduleGraph.getOutgoingConnections(module)); + if (module === rootModule) { + for (const c of moduleGraph.getOutgoingConnections(this)) + connections.push(c); + } + const references = connections + .filter(connection => { + if (!(connection.dependency instanceof HarmonyImportDependency)) + return false; + return ( + connection && + connection.resolvedOriginModule === module && + connection.module && + connection.isTargetActive(runtime) + ); + }) + .map(connection => ({ + connection, + sourceOrder: /** @type {HarmonyImportDependency} */ ( + connection.dependency + ).sourceOrder + })); + references.sort( + concatComparators(bySourceOrder, keepOriginalOrder(references)) ); - exportsInfo.setUsed(UsageState.Used, runtime); - exportsInfo.canMangleUse = false; - } else { - const exportsInfo = moduleGraph.getExportsInfo(module); - if (this.nsObjectUsed) { - exportsInfo.setUsedInUnknownWay(runtime); + /** @type {Map} */ + const referencesMap = new Map(); + for (const { connection } of references) { + const runtimeCondition = filterRuntime(runtime, r => + connection.isTargetActive(r) + ); + if (runtimeCondition === false) continue; + const module = connection.module; + const entry = referencesMap.get(module); + if (entry === undefined) { + referencesMap.set(module, { connection, runtimeCondition }); + continue; + } + entry.runtimeCondition = mergeRuntimeConditionNonFalse( + entry.runtimeCondition, + runtimeCondition, + runtime + ); + } + return referencesMap.values(); + }; + + /** + * @param {ModuleGraphConnection} connection graph connection + * @param {RuntimeSpec | true} runtimeCondition runtime condition + * @returns {void} + */ + const enterModule = (connection, runtimeCondition) => { + const module = connection.module; + if (!module) return; + const existingEntry = existingEntries.get(module); + if (existingEntry === true) { + return; + } + if (modulesSet.has(module)) { + existingEntries.set(module, true); + if (runtimeCondition !== true) { + throw new Error( + `Cannot runtime-conditional concatenate a module (${module.identifier()} in ${this.rootModule.identifier()}, ${runtimeConditionToString( + runtimeCondition + )}). This should not happen.` + ); + } + const imports = getConcatenatedImports(module); + for (const { connection, runtimeCondition } of imports) + enterModule(connection, runtimeCondition); + list.push({ + type: "concatenated", + module: connection.module, + runtimeCondition + }); } else { - exportsInfo.setAllKnownExportsUsed(runtime); + if (existingEntry !== undefined) { + const reducedRuntimeCondition = subtractRuntimeCondition( + runtimeCondition, + existingEntry, + runtime + ); + if (reducedRuntimeCondition === false) return; + runtimeCondition = reducedRuntimeCondition; + existingEntries.set( + connection.module, + mergeRuntimeConditionNonFalse( + existingEntry, + runtimeCondition, + runtime + ) + ); + } else { + existingEntries.set(connection.module, runtimeCondition); + } + if (list.length > 0) { + const lastItem = list[list.length - 1]; + if ( + lastItem.type === "external" && + lastItem.module === connection.module + ) { + lastItem.runtimeCondition = mergeRuntimeCondition( + lastItem.runtimeCondition, + runtimeCondition, + runtime + ); + return; + } + } + list.push({ + type: "external", + get module() { + // We need to use a getter here, because the module in the dependency + // could be replaced by some other process (i. e. also replaced with a + // concatenated module) + return connection.module; + }, + runtimeCondition + }); } - } - moduleGraph.addExtraReason(module, "used as library export"); - } + }; - /** - * @param {Chunk} chunk the chunk - * @param {Set} set runtime requirements - * @param {LibraryContext} libraryContext context - * @returns {void} - */ - runtimeRequirements(chunk, set, libraryContext) {} + existingEntries.set(rootModule, true); + const imports = getConcatenatedImports(rootModule); + for (const { connection, runtimeCondition } of imports) + enterModule(connection, runtimeCondition); + list.push({ + type: "concatenated", + module: rootModule, + runtimeCondition: true + }); - /** - * @param {Source} source source - * @param {Module} module module - * @param {StartupRenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export - */ - renderStartup(source, module, renderContext, { options }) { - if (!options.export) return source; - const postfix = `__webpack_exports__ = __webpack_exports__${propertyAccess( - Array.isArray(options.export) ? options.export : [options.export] - )};\n`; - return new ConcatSource(source, postfix); + return list; } -} - -module.exports = ExportPropertyLibraryPlugin; - - -/***/ }), - -/***/ 84415: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { ConcatSource } = __webpack_require__(51255); -const AbstractLibraryPlugin = __webpack_require__(26030); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ -/** @typedef {import("../util/Hash")} Hash */ -/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ - -/** - * @typedef {Object} JsonpLibraryPluginOptions - * @property {LibraryType} type - */ - -/** - * @typedef {Object} JsonpLibraryPluginParsed - * @property {string} name - */ - -/** - * @typedef {JsonpLibraryPluginParsed} T - * @extends {AbstractLibraryPlugin} - */ -class JsonpLibraryPlugin extends AbstractLibraryPlugin { /** - * @param {JsonpLibraryPluginOptions} options the plugin options + * @param {Module} rootModule the root module of the concatenation + * @param {Set} modules all modules in the concatenation (including the root module) + * @param {Object=} associatedObjectForCache object for caching + * @param {string | HashConstructor=} hashFunction hash function to use + * @returns {string} the identifier */ - constructor(options) { - super({ - pluginName: "JsonpLibraryPlugin", - type: options.type - }); + static _createIdentifier( + rootModule, + modules, + associatedObjectForCache, + hashFunction = "md4" + ) { + const cachedMakePathsRelative = makePathsRelative.bindContextCache( + rootModule.context, + associatedObjectForCache + ); + let identifiers = []; + for (const module of modules) { + identifiers.push(cachedMakePathsRelative(module.identifier())); + } + identifiers.sort(); + const hash = createHash(hashFunction); + hash.update(identifiers.join(" ")); + return rootModule.identifier() + "|" + hash.digest("hex"); } /** - * @param {LibraryOptions} library normalized library option - * @returns {T | false} preprocess as needed by overriding + * @param {LazySet} fileDependencies set where file dependencies are added to + * @param {LazySet} contextDependencies set where context dependencies are added to + * @param {LazySet} missingDependencies set where missing dependencies are added to + * @param {LazySet} buildDependencies set where build dependencies are added to */ - parseOptions(library) { - const { name } = library; - if (typeof name !== "string") { - throw new Error( - `Jsonp library name must be a simple string. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` + addCacheDependencies( + fileDependencies, + contextDependencies, + missingDependencies, + buildDependencies + ) { + for (const module of this._modules) { + module.addCacheDependencies( + fileDependencies, + contextDependencies, + missingDependencies, + buildDependencies ); } - return { - name: /** @type {string} */ (name) - }; - } - - /** - * @param {Source} source source - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export - */ - render(source, { chunk }, { options, compilation }) { - const name = compilation.getPath(options.name, { - chunk - }); - return new ConcatSource(`${name}(`, source, ")"); } /** - * @param {Chunk} chunk the chunk - * @param {Hash} hash hash - * @param {ChunkHashContext} chunkHashContext chunk hash context - * @param {LibraryContext} libraryContext context - * @returns {void} + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result */ - chunkHash(chunk, hash, chunkHashContext, { options, compilation }) { - hash.update("JsonpLibraryPlugin"); - hash.update(compilation.getPath(options.name, { chunk })); - } -} + codeGeneration({ + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtime: generationRuntime, + codeGenerationResults + }) { + /** @type {Set} */ + const runtimeRequirements = new Set(); + const runtime = intersectRuntime(generationRuntime, this._runtime); -module.exports = JsonpLibraryPlugin; + const requestShortener = runtimeTemplate.requestShortener; + // Meta info for each module + const [modulesWithInfo, moduleToInfoMap] = this._getModulesWithInfo( + moduleGraph, + runtime + ); + // Set with modules that need a generated namespace object + /** @type {Set} */ + const neededNamespaceObjects = new Set(); -/***/ }), + // Generate source code and analyse scopes + // Prepare a ReplaceSource for the final source + for (const info of moduleToInfoMap.values()) { + this._analyseModule( + moduleToInfoMap, + info, + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtime, + codeGenerationResults + ); + } -/***/ 59780: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // List of all used names to avoid conflicts + const allUsedNames = new Set(RESERVED_NAMES); + // Updated Top level declarations are created by renaming + const topLevelDeclarations = new Set(); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // List of additional names in scope for module references + /** @type {Map, alreadyCheckedScopes: Set }>} */ + const usedNamesInScopeInfo = new Map(); + /** + * @param {string} module module identifier + * @param {string} id export id + * @returns {{ usedNames: Set, alreadyCheckedScopes: Set }} info + */ + const getUsedNamesInScopeInfo = (module, id) => { + const key = `${module}-${id}`; + let info = usedNamesInScopeInfo.get(key); + if (info === undefined) { + info = { + usedNames: new Set(), + alreadyCheckedScopes: new Set() + }; + usedNamesInScopeInfo.set(key, info); + } + return info; + }; + // Set of already checked scopes + const ignoredScopes = new Set(); + // get all global names + for (const info of modulesWithInfo) { + if (info.type === "concatenated") { + // ignore symbols from moduleScope + if (info.moduleScope) { + ignoredScopes.add(info.moduleScope); + } -const { ConcatSource } = __webpack_require__(51255); -const Template = __webpack_require__(39722); -const propertyAccess = __webpack_require__(54190); -const AbstractLibraryPlugin = __webpack_require__(26030); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */ -/** @typedef {import("../util/Hash")} Hash */ -/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ - -/** - * @typedef {Object} ModuleLibraryPluginOptions - * @property {LibraryType} type - */ - -/** - * @typedef {Object} ModuleLibraryPluginParsed - * @property {string} name - */ - -/** - * @typedef {ModuleLibraryPluginParsed} T - * @extends {AbstractLibraryPlugin} - */ -class ModuleLibraryPlugin extends AbstractLibraryPlugin { - /** - * @param {ModuleLibraryPluginOptions} options the plugin options - */ - constructor(options) { - super({ - pluginName: "ModuleLibraryPlugin", - type: options.type - }); - } + // The super class expression in class scopes behaves weird + // We get ranges of all super class expressions to make + // renaming to work correctly + const superClassCache = new WeakMap(); + const getSuperClassExpressions = scope => { + const cacheEntry = superClassCache.get(scope); + if (cacheEntry !== undefined) return cacheEntry; + const superClassExpressions = []; + for (const childScope of scope.childScopes) { + if (childScope.type !== "class") continue; + const block = childScope.block; + if ( + (block.type === "ClassDeclaration" || + block.type === "ClassExpression") && + block.superClass + ) { + superClassExpressions.push({ + range: block.superClass.range, + variables: childScope.variables + }); + } + } + superClassCache.set(scope, superClassExpressions); + return superClassExpressions; + }; - /** - * @param {LibraryOptions} library normalized library option - * @returns {T | false} preprocess as needed by overriding - */ - parseOptions(library) { - const { name } = library; - if (name) { - throw new Error( - `Library name must be unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` - ); + // add global symbols + if (info.globalScope) { + for (const reference of info.globalScope.through) { + const name = reference.identifier.name; + if (ConcatenationScope.isModuleReference(name)) { + const match = ConcatenationScope.matchModuleReference(name); + if (!match) continue; + const referencedInfo = modulesWithInfo[match.index]; + if (referencedInfo.type === "reference") + throw new Error("Module reference can't point to a reference"); + const binding = getFinalBinding( + moduleGraph, + referencedInfo, + match.ids, + moduleToInfoMap, + runtime, + requestShortener, + runtimeTemplate, + neededNamespaceObjects, + false, + info.module.buildMeta.strictHarmonyModule, + true + ); + if (!binding.ids) continue; + const { usedNames, alreadyCheckedScopes } = + getUsedNamesInScopeInfo( + binding.info.module.identifier(), + "name" in binding ? binding.name : "" + ); + for (const expr of getSuperClassExpressions(reference.from)) { + if ( + expr.range[0] <= reference.identifier.range[0] && + expr.range[1] >= reference.identifier.range[1] + ) { + for (const variable of expr.variables) { + usedNames.add(variable.name); + } + } + } + addScopeSymbols( + reference.from, + usedNames, + alreadyCheckedScopes, + ignoredScopes + ); + } else { + allUsedNames.add(name); + } + } + } + } } - return { - name: /** @type {string} */ (name) - }; - } - /** - * @param {Source} source source - * @param {Module} module module - * @param {StartupRenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export - */ - renderStartup( - source, - module, - { moduleGraph, chunk }, - { options, compilation } - ) { - const result = new ConcatSource(source); - const exportsInfo = moduleGraph.getExportsInfo(module); - const exports = []; - const isAsync = moduleGraph.isAsync(module); - if (isAsync) { - result.add(`__webpack_exports__ = await __webpack_exports__;\n`); - } - for (const exportInfo of exportsInfo.orderedExports) { - if (!exportInfo.provided) continue; - const varName = `__webpack_exports__${Template.toIdentifier( - exportInfo.name - )}`; - result.add( - `var ${varName} = __webpack_exports__${propertyAccess([ - exportInfo.getUsedName(exportInfo.name, chunk.runtime) - ])};\n` + // generate names for symbols + for (const info of moduleToInfoMap.values()) { + const { usedNames: namespaceObjectUsedNames } = getUsedNamesInScopeInfo( + info.module.identifier(), + "" ); - exports.push(`${varName} as ${exportInfo.name}`); - } - if (exports.length > 0) { - result.add(`export { ${exports.join(", ")} };\n`); + switch (info.type) { + case "concatenated": { + for (const variable of info.moduleScope.variables) { + const name = variable.name; + const { usedNames, alreadyCheckedScopes } = getUsedNamesInScopeInfo( + info.module.identifier(), + name + ); + if (allUsedNames.has(name) || usedNames.has(name)) { + const references = getAllReferences(variable); + for (const ref of references) { + addScopeSymbols( + ref.from, + usedNames, + alreadyCheckedScopes, + ignoredScopes + ); + } + const newName = this.findNewName( + name, + allUsedNames, + usedNames, + info.module.readableIdentifier(requestShortener) + ); + allUsedNames.add(newName); + info.internalNames.set(name, newName); + topLevelDeclarations.add(newName); + const source = info.source; + const allIdentifiers = new Set( + references.map(r => r.identifier).concat(variable.identifiers) + ); + for (const identifier of allIdentifiers) { + const r = identifier.range; + const path = getPathInAst(info.ast, identifier); + if (path && path.length > 1) { + const maybeProperty = + path[1].type === "AssignmentPattern" && + path[1].left === path[0] + ? path[2] + : path[1]; + if ( + maybeProperty.type === "Property" && + maybeProperty.shorthand + ) { + source.insert(r[1], `: ${newName}`); + continue; + } + } + source.replace(r[0], r[1] - 1, newName); + } + } else { + allUsedNames.add(name); + info.internalNames.set(name, name); + topLevelDeclarations.add(name); + } + } + let namespaceObjectName; + if (info.namespaceExportSymbol) { + namespaceObjectName = info.internalNames.get( + info.namespaceExportSymbol + ); + } else { + namespaceObjectName = this.findNewName( + "namespaceObject", + allUsedNames, + namespaceObjectUsedNames, + info.module.readableIdentifier(requestShortener) + ); + allUsedNames.add(namespaceObjectName); + } + info.namespaceObjectName = namespaceObjectName; + topLevelDeclarations.add(namespaceObjectName); + break; + } + case "external": { + const externalName = this.findNewName( + "", + allUsedNames, + namespaceObjectUsedNames, + info.module.readableIdentifier(requestShortener) + ); + allUsedNames.add(externalName); + info.name = externalName; + topLevelDeclarations.add(externalName); + break; + } + } + if (info.module.buildMeta.exportsType !== "namespace") { + const externalNameInterop = this.findNewName( + "namespaceObject", + allUsedNames, + namespaceObjectUsedNames, + info.module.readableIdentifier(requestShortener) + ); + allUsedNames.add(externalNameInterop); + info.interopNamespaceObjectName = externalNameInterop; + topLevelDeclarations.add(externalNameInterop); + } + if ( + info.module.buildMeta.exportsType === "default" && + info.module.buildMeta.defaultObject !== "redirect" + ) { + const externalNameInterop = this.findNewName( + "namespaceObject2", + allUsedNames, + namespaceObjectUsedNames, + info.module.readableIdentifier(requestShortener) + ); + allUsedNames.add(externalNameInterop); + info.interopNamespaceObject2Name = externalNameInterop; + topLevelDeclarations.add(externalNameInterop); + } + if ( + info.module.buildMeta.exportsType === "dynamic" || + !info.module.buildMeta.exportsType + ) { + const externalNameInterop = this.findNewName( + "default", + allUsedNames, + namespaceObjectUsedNames, + info.module.readableIdentifier(requestShortener) + ); + allUsedNames.add(externalNameInterop); + info.interopDefaultAccessName = externalNameInterop; + topLevelDeclarations.add(externalNameInterop); + } } - return result; - } -} -module.exports = ModuleLibraryPlugin; + // Find and replace references to modules + for (const info of moduleToInfoMap.values()) { + if (info.type === "concatenated") { + for (const reference of info.globalScope.through) { + const name = reference.identifier.name; + const match = ConcatenationScope.matchModuleReference(name); + if (match) { + const referencedInfo = modulesWithInfo[match.index]; + if (referencedInfo.type === "reference") + throw new Error("Module reference can't point to a reference"); + const finalName = getFinalName( + moduleGraph, + referencedInfo, + match.ids, + moduleToInfoMap, + runtime, + requestShortener, + runtimeTemplate, + neededNamespaceObjects, + match.call, + !match.directImport, + info.module.buildMeta.strictHarmonyModule, + match.asiSafe + ); + const r = reference.identifier.range; + const source = info.source; + // range is extended by 2 chars to cover the appended "._" + source.replace(r[0], r[1] + 1, finalName); + } + } + } + } + // Map with all root exposed used exports + /** @type {Map} */ + const exportsMap = new Map(); -/***/ }), + // Set with all root exposed unused exports + /** @type {Set} */ + const unusedExports = new Set(); -/***/ 11707: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + const rootInfo = /** @type {ConcatenatedModuleInfo} */ ( + moduleToInfoMap.get(this.rootModule) + ); + const strictHarmonyModule = rootInfo.module.buildMeta.strictHarmonyModule; + const exportsInfo = moduleGraph.getExportsInfo(rootInfo.module); + for (const exportInfo of exportsInfo.orderedExports) { + const name = exportInfo.name; + if (exportInfo.provided === false) continue; + const used = exportInfo.getUsedName(undefined, runtime); + if (!used) { + unusedExports.add(name); + continue; + } + exportsMap.set(used, requestShortener => { + try { + const finalName = getFinalName( + moduleGraph, + rootInfo, + [name], + moduleToInfoMap, + runtime, + requestShortener, + runtimeTemplate, + neededNamespaceObjects, + false, + false, + strictHarmonyModule, + true + ); + return `/* ${ + exportInfo.isReexport() ? "reexport" : "binding" + } */ ${finalName}`; + } catch (e) { + e.message += `\nwhile generating the root export '${name}' (used name: '${used}')`; + throw e; + } + }); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Joel Denning @joeldenning -*/ + const result = new ConcatSource(); + // add harmony compatibility flag (must be first because of possible circular dependencies) + if ( + moduleGraph.getExportsInfo(this).otherExportsInfo.getUsed(runtime) !== + UsageState.Unused + ) { + result.add(`// ESM COMPAT FLAG\n`); + result.add( + runtimeTemplate.defineEsModuleFlagStatement({ + exportsArgument: this.exportsArgument, + runtimeRequirements + }) + ); + } + // define exports + if (exportsMap.size > 0) { + runtimeRequirements.add(RuntimeGlobals.exports); + runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); + const definitions = []; + for (const [key, value] of exportsMap) { + definitions.push( + `\n ${JSON.stringify(key)}: ${runtimeTemplate.returningFunction( + value(requestShortener) + )}` + ); + } + result.add(`\n// EXPORTS\n`); + result.add( + `${RuntimeGlobals.definePropertyGetters}(${ + this.exportsArgument + }, {${definitions.join(",")}\n});\n` + ); + } -const { ConcatSource } = __webpack_require__(51255); -const { UsageState } = __webpack_require__(63686); -const ExternalModule = __webpack_require__(73071); -const Template = __webpack_require__(39722); -const propertyAccess = __webpack_require__(54190); -const AbstractLibraryPlugin = __webpack_require__(26030); + // list unused exports + if (unusedExports.size > 0) { + result.add( + `\n// UNUSED EXPORTS: ${joinIterableWithComma(unusedExports)}\n` + ); + } -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ -/** @typedef {import("../util/Hash")} Hash */ -/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ + // generate namespace objects + const namespaceObjectSources = new Map(); + for (const info of neededNamespaceObjects) { + if (info.namespaceExportSymbol) continue; + const nsObj = []; + const exportsInfo = moduleGraph.getExportsInfo(info.module); + for (const exportInfo of exportsInfo.orderedExports) { + if (exportInfo.provided === false) continue; + const usedName = exportInfo.getUsedName(undefined, runtime); + if (usedName) { + const finalName = getFinalName( + moduleGraph, + info, + [exportInfo.name], + moduleToInfoMap, + runtime, + requestShortener, + runtimeTemplate, + neededNamespaceObjects, + false, + undefined, + info.module.buildMeta.strictHarmonyModule, + true + ); + nsObj.push( + `\n ${JSON.stringify( + usedName + )}: ${runtimeTemplate.returningFunction(finalName)}` + ); + } + } + const name = info.namespaceObjectName; + const defineGetters = + nsObj.length > 0 + ? `${RuntimeGlobals.definePropertyGetters}(${name}, {${nsObj.join( + "," + )}\n});\n` + : ""; + if (nsObj.length > 0) + runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); + namespaceObjectSources.set( + info, + ` +// NAMESPACE OBJECT: ${info.module.readableIdentifier(requestShortener)} +var ${name} = {}; +${RuntimeGlobals.makeNamespaceObject}(${name}); +${defineGetters}` + ); + runtimeRequirements.add(RuntimeGlobals.makeNamespaceObject); + } -/** - * @typedef {Object} SystemLibraryPluginOptions - * @property {LibraryType} type - */ + // define required namespace objects (must be before evaluation modules) + for (const info of modulesWithInfo) { + if (info.type === "concatenated") { + const source = namespaceObjectSources.get(info); + if (!source) continue; + result.add(source); + } + } -/** - * @typedef {Object} SystemLibraryPluginParsed - * @property {string} name - */ + const chunkInitFragments = []; -/** - * @typedef {SystemLibraryPluginParsed} T - * @extends {AbstractLibraryPlugin} - */ -class SystemLibraryPlugin extends AbstractLibraryPlugin { - /** - * @param {SystemLibraryPluginOptions} options the plugin options - */ - constructor(options) { - super({ - pluginName: "SystemLibraryPlugin", - type: options.type - }); + // evaluate modules in order + for (const rawInfo of modulesWithInfo) { + let name; + let isConditional = false; + const info = rawInfo.type === "reference" ? rawInfo.target : rawInfo; + switch (info.type) { + case "concatenated": { + result.add( + `\n;// CONCATENATED MODULE: ${info.module.readableIdentifier( + requestShortener + )}\n` + ); + result.add(info.source); + if (info.chunkInitFragments) { + for (const f of info.chunkInitFragments) chunkInitFragments.push(f); + } + if (info.runtimeRequirements) { + for (const r of info.runtimeRequirements) { + runtimeRequirements.add(r); + } + } + name = info.namespaceObjectName; + break; + } + case "external": { + result.add( + `\n// EXTERNAL MODULE: ${info.module.readableIdentifier( + requestShortener + )}\n` + ); + runtimeRequirements.add(RuntimeGlobals.require); + const { runtimeCondition } = + /** @type {ExternalModuleInfo | ReferenceToModuleInfo} */ (rawInfo); + const condition = runtimeTemplate.runtimeConditionExpression({ + chunkGraph, + runtimeCondition, + runtime, + runtimeRequirements + }); + if (condition !== "true") { + isConditional = true; + result.add(`if (${condition}) {\n`); + } + result.add( + `var ${info.name} = __webpack_require__(${JSON.stringify( + chunkGraph.getModuleId(info.module) + )});` + ); + name = info.name; + break; + } + default: + // @ts-expect-error never is expected here + throw new Error(`Unsupported concatenation entry type ${info.type}`); + } + if (info.interopNamespaceObjectUsed) { + runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); + result.add( + `\nvar ${info.interopNamespaceObjectName} = /*#__PURE__*/${RuntimeGlobals.createFakeNamespaceObject}(${name}, 2);` + ); + } + if (info.interopNamespaceObject2Used) { + runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); + result.add( + `\nvar ${info.interopNamespaceObject2Name} = /*#__PURE__*/${RuntimeGlobals.createFakeNamespaceObject}(${name});` + ); + } + if (info.interopDefaultAccessUsed) { + runtimeRequirements.add(RuntimeGlobals.compatGetDefaultExport); + result.add( + `\nvar ${info.interopDefaultAccessName} = /*#__PURE__*/${RuntimeGlobals.compatGetDefaultExport}(${name});` + ); + } + if (isConditional) { + result.add("\n}"); + } + } + + const data = new Map(); + if (chunkInitFragments.length > 0) + data.set("chunkInitFragments", chunkInitFragments); + data.set("topLevelDeclarations", topLevelDeclarations); + + /** @type {CodeGenerationResult} */ + const resultEntry = { + sources: new Map([["javascript", new CachedSource(result)]]), + data, + runtimeRequirements + }; + + return resultEntry; } /** - * @param {LibraryOptions} library normalized library option - * @returns {T | false} preprocess as needed by overriding + * @param {Map} modulesMap modulesMap + * @param {ModuleInfo} info info + * @param {DependencyTemplates} dependencyTemplates dependencyTemplates + * @param {RuntimeTemplate} runtimeTemplate runtimeTemplate + * @param {ModuleGraph} moduleGraph moduleGraph + * @param {ChunkGraph} chunkGraph chunkGraph + * @param {RuntimeSpec} runtime runtime + * @param {CodeGenerationResults} codeGenerationResults codeGenerationResults */ - parseOptions(library) { - const { name } = library; - if (name && typeof name !== "string") { - throw new Error( - `System.js library name must be a simple string or unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}` - ); + _analyseModule( + modulesMap, + info, + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtime, + codeGenerationResults + ) { + if (info.type === "concatenated") { + const m = info.module; + try { + // Create a concatenation scope to track and capture information + const concatenationScope = new ConcatenationScope(modulesMap, info); + + // TODO cache codeGeneration results + const codeGenResult = m.codeGeneration({ + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtime, + concatenationScope, + codeGenerationResults + }); + const source = codeGenResult.sources.get("javascript"); + const data = codeGenResult.data; + const chunkInitFragments = data && data.get("chunkInitFragments"); + const code = source.source().toString(); + let ast; + try { + ast = JavascriptParser._parse(code, { + sourceType: "module" + }); + } catch (err) { + if ( + err.loc && + typeof err.loc === "object" && + typeof err.loc.line === "number" + ) { + const lineNumber = err.loc.line; + const lines = code.split("\n"); + err.message += + "\n| " + + lines + .slice(Math.max(0, lineNumber - 3), lineNumber + 2) + .join("\n| "); + } + throw err; + } + const scopeManager = eslintScope.analyze(ast, { + ecmaVersion: 6, + sourceType: "module", + optimistic: true, + ignoreEval: true, + impliedStrict: true + }); + const globalScope = scopeManager.acquire(ast); + const moduleScope = globalScope.childScopes[0]; + const resultSource = new ReplaceSource(source); + info.runtimeRequirements = codeGenResult.runtimeRequirements; + info.ast = ast; + info.internalSource = source; + info.source = resultSource; + info.chunkInitFragments = chunkInitFragments; + info.globalScope = globalScope; + info.moduleScope = moduleScope; + } catch (err) { + err.message += `\nwhile analyzing module ${m.identifier()} for concatenation`; + throw err; + } } - return { - name: /** @type {string=} */ (name) - }; } /** - * @param {Source} source source - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export + * @param {ModuleGraph} moduleGraph the module graph + * @param {RuntimeSpec} runtime the runtime + * @returns {[ModuleInfoOrReference[], Map]} module info items */ - render(source, { chunkGraph, moduleGraph, chunk }, { options, compilation }) { - const modules = chunkGraph - .getChunkModules(chunk) - .filter(m => m instanceof ExternalModule && m.externalType === "system"); - const externals = /** @type {ExternalModule[]} */ (modules); - - // The name this bundle should be registered as with System - const name = options.name - ? `${JSON.stringify(compilation.getPath(options.name, { chunk }))}, ` - : ""; - - // The array of dependencies that are external to webpack and will be provided by System - const systemDependencies = JSON.stringify( - externals.map(m => - typeof m.request === "object" && !Array.isArray(m.request) - ? m.request.amd - : m.request - ) + _getModulesWithInfo(moduleGraph, runtime) { + const orderedConcatenationList = this._createConcatenationList( + this.rootModule, + this._modules, + runtime, + moduleGraph ); + /** @type {Map} */ + const map = new Map(); + const list = orderedConcatenationList.map((info, index) => { + let item = map.get(info.module); + if (item === undefined) { + switch (info.type) { + case "concatenated": + item = { + type: "concatenated", + module: info.module, + index, + ast: undefined, + internalSource: undefined, + runtimeRequirements: undefined, + source: undefined, + globalScope: undefined, + moduleScope: undefined, + internalNames: new Map(), + exportMap: undefined, + rawExportMap: undefined, + namespaceExportSymbol: undefined, + namespaceObjectName: undefined, + interopNamespaceObjectUsed: false, + interopNamespaceObjectName: undefined, + interopNamespaceObject2Used: false, + interopNamespaceObject2Name: undefined, + interopDefaultAccessUsed: false, + interopDefaultAccessName: undefined + }; + break; + case "external": + item = { + type: "external", + module: info.module, + runtimeCondition: info.runtimeCondition, + index, + name: undefined, + interopNamespaceObjectUsed: false, + interopNamespaceObjectName: undefined, + interopNamespaceObject2Used: false, + interopNamespaceObject2Name: undefined, + interopDefaultAccessUsed: false, + interopDefaultAccessName: undefined + }; + break; + default: + throw new Error( + `Unsupported concatenation entry type ${info.type}` + ); + } + map.set(item.module, item); + return item; + } else { + /** @type {ReferenceToModuleInfo} */ + const ref = { + type: "reference", + runtimeCondition: info.runtimeCondition, + target: item + }; + return ref; + } + }); + return [list, map]; + } - // The name of the variable provided by System for exporting - const dynamicExport = "__WEBPACK_DYNAMIC_EXPORT__"; - - // An array of the internal variable names for the webpack externals - const externalWebpackNames = externals.map( - m => - `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( - `${chunkGraph.getModuleId(m)}` - )}__` - ); + findNewName(oldName, usedNamed1, usedNamed2, extraInfo) { + let name = oldName; - // Declaring variables for the internal variable names for the webpack externals - const externalVarDeclarations = externalWebpackNames - .map(name => `var ${name} = {};`) - .join("\n"); + if (name === ConcatenationScope.DEFAULT_EXPORT) { + name = ""; + } + if (name === ConcatenationScope.NAMESPACE_OBJECT_EXPORT) { + name = "namespaceObject"; + } - // Define __esModule flag on all internal variables and helpers - const externalVarInitialization = []; + // Remove uncool stuff + extraInfo = extraInfo.replace( + /\.+\/|(\/index)?\.([a-zA-Z0-9]{1,4})($|\s|\?)|\s*\+\s*\d+\s*modules/g, + "" + ); - // The system.register format requires an array of setter functions for externals. - const setters = - externalWebpackNames.length === 0 - ? "" - : Template.asString([ - "setters: [", - Template.indent( - externals - .map((module, i) => { - const external = externalWebpackNames[i]; - const exportsInfo = moduleGraph.getExportsInfo(module); - const otherUnused = - exportsInfo.otherExportsInfo.getUsed(chunk.runtime) === - UsageState.Unused; - const instructions = []; - const handledNames = []; - for (const exportInfo of exportsInfo.orderedExports) { - const used = exportInfo.getUsedName( - undefined, - chunk.runtime - ); - if (used) { - if (otherUnused || used !== exportInfo.name) { - instructions.push( - `${external}${propertyAccess([ - used - ])} = module${propertyAccess([exportInfo.name])};` - ); - handledNames.push(exportInfo.name); - } - } else { - handledNames.push(exportInfo.name); - } - } - if (!otherUnused) { - if ( - !Array.isArray(module.request) || - module.request.length === 1 - ) { - externalVarInitialization.push( - `Object.defineProperty(${external}, "__esModule", { value: true });` - ); - } - if (handledNames.length > 0) { - const name = `${external}handledNames`; - externalVarInitialization.push( - `var ${name} = ${JSON.stringify(handledNames)};` - ); - instructions.push( - Template.asString([ - "Object.keys(module).forEach(function(key) {", - Template.indent([ - `if(${name}.indexOf(key) >= 0)`, - Template.indent(`${external}[key] = module[key];`) - ]), - "});" - ]) - ); - } else { - instructions.push( - Template.asString([ - "Object.keys(module).forEach(function(key) {", - Template.indent([`${external}[key] = module[key];`]), - "});" - ]) - ); - } - } - if (instructions.length === 0) return "function() {}"; - return Template.asString([ - "function(module) {", - Template.indent(instructions), - "}" - ]); - }) - .join(",\n") - ), - "]," - ]); + const splittedInfo = extraInfo.split("/"); + while (splittedInfo.length) { + name = splittedInfo.pop() + (name ? "_" + name : ""); + const nameIdent = Template.toIdentifier(name); + if ( + !usedNamed1.has(nameIdent) && + (!usedNamed2 || !usedNamed2.has(nameIdent)) + ) + return nameIdent; + } - return new ConcatSource( - Template.asString([ - `System.register(${name}${systemDependencies}, function(${dynamicExport}, __system_context__) {`, - Template.indent([ - externalVarDeclarations, - Template.asString(externalVarInitialization), - "return {", - Template.indent([ - setters, - "execute: function() {", - Template.indent(`${dynamicExport}(`) - ]) - ]), - "" - ]), - source, - Template.asString([ - "", - Template.indent([ - Template.indent([Template.indent([");"]), "}"]), - "};" - ]), - "})" - ]) - ); + let i = 0; + let nameWithNumber = Template.toIdentifier(`${name}_${i}`); + while ( + usedNamed1.has(nameWithNumber) || + (usedNamed2 && usedNamed2.has(nameWithNumber)) + ) { + i++; + nameWithNumber = Template.toIdentifier(`${name}_${i}`); + } + return nameWithNumber; } /** - * @param {Chunk} chunk the chunk - * @param {Hash} hash hash - * @param {ChunkHashContext} chunkHashContext chunk hash context - * @param {LibraryContext} libraryContext context + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context * @returns {void} */ - chunkHash(chunk, hash, chunkHashContext, { options, compilation }) { - hash.update("SystemLibraryPlugin"); - if (options.name) { - hash.update(compilation.getPath(options.name, { chunk })); + updateHash(hash, context) { + const { chunkGraph, runtime } = context; + for (const info of this._createConcatenationList( + this.rootModule, + this._modules, + intersectRuntime(runtime, this._runtime), + chunkGraph.moduleGraph + )) { + switch (info.type) { + case "concatenated": + info.module.updateHash(hash, context); + break; + case "external": + hash.update(`${chunkGraph.getModuleId(info.module)}`); + // TODO runtimeCondition + break; + } } + super.updateHash(hash, context); + } + + static deserialize(context) { + const obj = new ConcatenatedModule({ + identifier: undefined, + rootModule: undefined, + modules: undefined, + runtime: undefined + }); + obj.deserialize(context); + return obj; } } -module.exports = SystemLibraryPlugin; +makeSerializable(ConcatenatedModule, "webpack/lib/optimize/ConcatenatedModule"); + +module.exports = ConcatenatedModule; /***/ }), -/***/ 54442: +/***/ 96260: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -104492,329 +101838,90 @@ module.exports = SystemLibraryPlugin; -const { ConcatSource, OriginalSource } = __webpack_require__(51255); -const ExternalModule = __webpack_require__(73071); -const Template = __webpack_require__(39722); -const AbstractLibraryPlugin = __webpack_require__(26030); +const { STAGE_BASIC } = __webpack_require__(80057); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryCustomUmdCommentObject} LibraryCustomUmdCommentObject */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryCustomUmdObject} LibraryCustomUmdObject */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryName} LibraryName */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ /** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ -/** @typedef {import("../util/Hash")} Hash */ -/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ - -/** - * @param {string[]} accessor the accessor to convert to path - * @returns {string} the path - */ -const accessorToObjectAccess = accessor => { - return accessor.map(a => `[${JSON.stringify(a)}]`).join(""); -}; - -/** - * @param {string|undefined} base the path prefix - * @param {string|string[]} accessor the accessor - * @param {string=} joinWith the element separator - * @returns {string} the path - */ -const accessorAccess = (base, accessor, joinWith = ", ") => { - const accessors = Array.isArray(accessor) ? accessor : [accessor]; - return accessors - .map((_, idx) => { - const a = base - ? base + accessorToObjectAccess(accessors.slice(0, idx + 1)) - : accessors[0] + accessorToObjectAccess(accessors.slice(1, idx + 1)); - if (idx === accessors.length - 1) return a; - if (idx === 0 && base === undefined) - return `${a} = typeof ${a} === "object" ? ${a} : {}`; - return `${a} = ${a} || {}`; - }) - .join(joinWith); -}; - -/** @typedef {string | string[] | LibraryCustomUmdObject} UmdLibraryPluginName */ - -/** - * @typedef {Object} UmdLibraryPluginOptions - * @property {LibraryType} type - * @property {boolean=} optionalAmdExternalAsGlobal - */ - -/** - * @typedef {Object} UmdLibraryPluginParsed - * @property {string | string[]} name - * @property {LibraryCustomUmdObject} names - * @property {string | LibraryCustomUmdCommentObject} auxiliaryComment - * @property {boolean} namedDefine - */ - -/** - * @typedef {UmdLibraryPluginParsed} T - * @extends {AbstractLibraryPlugin} - */ -class UmdLibraryPlugin extends AbstractLibraryPlugin { - /** - * @param {UmdLibraryPluginOptions} options the plugin option - */ - constructor(options) { - super({ - pluginName: "UmdLibraryPlugin", - type: options.type - }); - - this.optionalAmdExternalAsGlobal = options.optionalAmdExternalAsGlobal; - } - - /** - * @param {LibraryOptions} library normalized library option - * @returns {T | false} preprocess as needed by overriding - */ - parseOptions(library) { - /** @type {LibraryName} */ - let name; - /** @type {LibraryCustomUmdObject} */ - let names; - if (typeof library.name === "object" && !Array.isArray(library.name)) { - name = library.name.root || library.name.amd || library.name.commonjs; - names = library.name; - } else { - name = library.name; - const singleName = Array.isArray(name) ? name[0] : name; - names = { - commonjs: singleName, - root: library.name, - amd: singleName - }; - } - return { - name, - names, - auxiliaryComment: library.auxiliaryComment, - namedDefine: library.umdNamedDefine - }; - } +class EnsureChunkConditionsPlugin { /** - * @param {Source} source source - * @param {RenderContext} renderContext render context - * @param {LibraryContext} libraryContext context - * @returns {Source} source with library export + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - render( - source, - { chunkGraph, runtimeTemplate, chunk, moduleGraph }, - { options, compilation } - ) { - const modules = chunkGraph - .getChunkModules(chunk) - .filter( - m => - m instanceof ExternalModule && - (m.externalType === "umd" || m.externalType === "umd2") - ); - let externals = /** @type {ExternalModule[]} */ (modules); - /** @type {ExternalModule[]} */ - const optionalExternals = []; - /** @type {ExternalModule[]} */ - let requiredExternals = []; - if (this.optionalAmdExternalAsGlobal) { - for (const m of externals) { - if (m.isOptional(moduleGraph)) { - optionalExternals.push(m); - } else { - requiredExternals.push(m); - } - } - externals = requiredExternals.concat(optionalExternals); - } else { - requiredExternals = externals; - } - - const replaceKeys = str => { - return compilation.getPath(str, { - chunk - }); - }; - - const externalsDepsArray = modules => { - return `[${replaceKeys( - modules - .map(m => - JSON.stringify( - typeof m.request === "object" ? m.request.amd : m.request - ) - ) - .join(", ") - )}]`; - }; - - const externalsRootArray = modules => { - return replaceKeys( - modules - .map(m => { - let request = m.request; - if (typeof request === "object") request = request.root; - return `root${accessorToObjectAccess([].concat(request))}`; - }) - .join(", ") - ); - }; - - const externalsRequireArray = type => { - return replaceKeys( - externals - .map(m => { - let expr; - let request = m.request; - if (typeof request === "object") { - request = request[type]; + apply(compiler) { + compiler.hooks.compilation.tap( + "EnsureChunkConditionsPlugin", + compilation => { + const handler = chunks => { + const chunkGraph = compilation.chunkGraph; + // These sets are hoisted here to save memory + // They are cleared at the end of every loop + /** @type {Set} */ + const sourceChunks = new Set(); + /** @type {Set} */ + const chunkGroups = new Set(); + for (const module of compilation.modules) { + if (!module.hasChunkCondition()) continue; + for (const chunk of chunkGraph.getModuleChunksIterable(module)) { + if (!module.chunkCondition(chunk, compilation)) { + sourceChunks.add(chunk); + for (const group of chunk.groupsIterable) { + chunkGroups.add(group); + } + } } - if (request === undefined) { - throw new Error( - "Missing external configuration for type:" + type - ); + if (sourceChunks.size === 0) continue; + /** @type {Set} */ + const targetChunks = new Set(); + chunkGroupLoop: for (const chunkGroup of chunkGroups) { + // Can module be placed in a chunk of this group? + for (const chunk of chunkGroup.chunks) { + if (module.chunkCondition(chunk, compilation)) { + targetChunks.add(chunk); + continue chunkGroupLoop; + } + } + // We reached the entrypoint: fail + if (chunkGroup.isInitial()) { + throw new Error( + "Cannot fullfil chunk condition of " + module.identifier() + ); + } + // Try placing in all parents + for (const group of chunkGroup.parentsIterable) { + chunkGroups.add(group); + } } - if (Array.isArray(request)) { - expr = `require(${JSON.stringify( - request[0] - )})${accessorToObjectAccess(request.slice(1))}`; - } else { - expr = `require(${JSON.stringify(request)})`; + for (const sourceChunk of sourceChunks) { + chunkGraph.disconnectChunkAndModule(sourceChunk, module); } - if (m.isOptional(moduleGraph)) { - expr = `(function webpackLoadOptionalExternalModule() { try { return ${expr}; } catch(e) {} }())`; + for (const targetChunk of targetChunks) { + chunkGraph.connectChunkAndModule(targetChunk, module); } - return expr; - }) - .join(", ") - ); - }; - - const externalsArguments = modules => { - return modules - .map( - m => - `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( - `${chunkGraph.getModuleId(m)}` - )}__` - ) - .join(", "); - }; - - const libraryName = library => { - return JSON.stringify(replaceKeys([].concat(library).pop())); - }; - - let amdFactory; - if (optionalExternals.length > 0) { - const wrapperArguments = externalsArguments(requiredExternals); - const factoryArguments = - requiredExternals.length > 0 - ? externalsArguments(requiredExternals) + - ", " + - externalsRootArray(optionalExternals) - : externalsRootArray(optionalExternals); - amdFactory = - `function webpackLoadOptionalExternalModuleAmd(${wrapperArguments}) {\n` + - ` return factory(${factoryArguments});\n` + - " }"; - } else { - amdFactory = "factory"; - } - - const { auxiliaryComment, namedDefine, names } = options; - - const getAuxiliaryComment = type => { - if (auxiliaryComment) { - if (typeof auxiliaryComment === "string") - return "\t//" + auxiliaryComment + "\n"; - if (auxiliaryComment[type]) - return "\t//" + auxiliaryComment[type] + "\n"; + sourceChunks.clear(); + chunkGroups.clear(); + } + }; + compilation.hooks.optimizeChunks.tap( + { + name: "EnsureChunkConditionsPlugin", + stage: STAGE_BASIC + }, + handler + ); } - return ""; - }; - - return new ConcatSource( - new OriginalSource( - "(function webpackUniversalModuleDefinition(root, factory) {\n" + - getAuxiliaryComment("commonjs2") + - " if(typeof exports === 'object' && typeof module === 'object')\n" + - " module.exports = factory(" + - externalsRequireArray("commonjs2") + - ");\n" + - getAuxiliaryComment("amd") + - " else if(typeof define === 'function' && define.amd)\n" + - (requiredExternals.length > 0 - ? names.amd && namedDefine === true - ? " define(" + - libraryName(names.amd) + - ", " + - externalsDepsArray(requiredExternals) + - ", " + - amdFactory + - ");\n" - : " define(" + - externalsDepsArray(requiredExternals) + - ", " + - amdFactory + - ");\n" - : names.amd && namedDefine === true - ? " define(" + - libraryName(names.amd) + - ", [], " + - amdFactory + - ");\n" - : " define([], " + amdFactory + ");\n") + - (names.root || names.commonjs - ? getAuxiliaryComment("commonjs") + - " else if(typeof exports === 'object')\n" + - " exports[" + - libraryName(names.commonjs || names.root) + - "] = factory(" + - externalsRequireArray("commonjs") + - ");\n" + - getAuxiliaryComment("root") + - " else\n" + - " " + - replaceKeys( - accessorAccess("root", names.root || names.commonjs) - ) + - " = factory(" + - externalsRootArray(externals) + - ");\n" - : " else {\n" + - (externals.length > 0 - ? " var a = typeof exports === 'object' ? factory(" + - externalsRequireArray("commonjs") + - ") : factory(" + - externalsRootArray(externals) + - ");\n" - : " var a = factory();\n") + - " for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n" + - " }\n") + - `})(${ - runtimeTemplate.outputOptions.globalObject - }, function(${externalsArguments(externals)}) {\nreturn `, - "webpack/universalModuleDefinition" - ), - source, - ";\n})" ); } } - -module.exports = UmdLibraryPlugin; +module.exports = EnsureChunkConditionsPlugin; /***/ }), -/***/ 32597: -/***/ (function(__unused_webpack_module, exports) { +/***/ 50089: +/***/ (function(module) { "use strict"; /* @@ -104824,606 +101931,476 @@ module.exports = UmdLibraryPlugin; -const LogType = Object.freeze({ - error: /** @type {"error"} */ ("error"), // message, c style arguments - warn: /** @type {"warn"} */ ("warn"), // message, c style arguments - info: /** @type {"info"} */ ("info"), // message, c style arguments - log: /** @type {"log"} */ ("log"), // message, c style arguments - debug: /** @type {"debug"} */ ("debug"), // message, c style arguments - - trace: /** @type {"trace"} */ ("trace"), // no arguments +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ - group: /** @type {"group"} */ ("group"), // [label] - groupCollapsed: /** @type {"groupCollapsed"} */ ("groupCollapsed"), // [label] - groupEnd: /** @type {"groupEnd"} */ ("groupEnd"), // [label] +class FlagIncludedChunksPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap("FlagIncludedChunksPlugin", compilation => { + compilation.hooks.optimizeChunkIds.tap( + "FlagIncludedChunksPlugin", + chunks => { + const chunkGraph = compilation.chunkGraph; - profile: /** @type {"profile"} */ ("profile"), // [profileName] - profileEnd: /** @type {"profileEnd"} */ ("profileEnd"), // [profileName] + // prepare two bit integers for each module + // 2^31 is the max number represented as SMI in v8 + // we want the bits distributed this way: + // the bit 2^31 is pretty rar and only one module should get it + // so it has a probability of 1 / modulesCount + // the first bit (2^0) is the easiest and every module could get it + // if it doesn't get a better bit + // from bit 2^n to 2^(n+1) there is a probability of p + // so 1 / modulesCount == p^31 + // <=> p = sqrt31(1 / modulesCount) + // so we use a modulo of 1 / sqrt31(1 / modulesCount) + /** @type {WeakMap} */ + const moduleBits = new WeakMap(); + const modulesCount = compilation.modules.size; - time: /** @type {"time"} */ ("time"), // name, time as [seconds, nanoseconds] + // precalculate the modulo values for each bit + const modulo = 1 / Math.pow(1 / modulesCount, 1 / 31); + const modulos = Array.from( + { length: 31 }, + (x, i) => Math.pow(modulo, i) | 0 + ); - clear: /** @type {"clear"} */ ("clear"), // no arguments - status: /** @type {"status"} */ ("status") // message, arguments -}); + // iterate all modules to generate bit values + let i = 0; + for (const module of compilation.modules) { + let bit = 30; + while (i % modulos[bit] !== 0) { + bit--; + } + moduleBits.set(module, 1 << bit); + i++; + } -exports.LogType = LogType; + // iterate all chunks to generate bitmaps + /** @type {WeakMap} */ + const chunkModulesHash = new WeakMap(); + for (const chunk of chunks) { + let hash = 0; + for (const module of chunkGraph.getChunkModulesIterable(chunk)) { + hash |= moduleBits.get(module); + } + chunkModulesHash.set(chunk, hash); + } -/** @typedef {typeof LogType[keyof typeof LogType]} LogTypeEnum */ + for (const chunkA of chunks) { + const chunkAHash = chunkModulesHash.get(chunkA); + const chunkAModulesCount = + chunkGraph.getNumberOfChunkModules(chunkA); + if (chunkAModulesCount === 0) continue; + let bestModule = undefined; + for (const module of chunkGraph.getChunkModulesIterable(chunkA)) { + if ( + bestModule === undefined || + chunkGraph.getNumberOfModuleChunks(bestModule) > + chunkGraph.getNumberOfModuleChunks(module) + ) + bestModule = module; + } + loopB: for (const chunkB of chunkGraph.getModuleChunksIterable( + bestModule + )) { + // as we iterate the same iterables twice + // skip if we find ourselves + if (chunkA === chunkB) continue; -const LOG_SYMBOL = Symbol("webpack logger raw log method"); -const TIMERS_SYMBOL = Symbol("webpack logger times"); -const TIMERS_AGGREGATES_SYMBOL = Symbol("webpack logger aggregated times"); + const chunkBModulesCount = + chunkGraph.getNumberOfChunkModules(chunkB); -class WebpackLogger { - /** - * @param {function(LogTypeEnum, any[]=): void} log log function - * @param {function(string | function(): string): WebpackLogger} getChildLogger function to create child logger - */ - constructor(log, getChildLogger) { - this[LOG_SYMBOL] = log; - this.getChildLogger = getChildLogger; - } + // ids for empty chunks are not included + if (chunkBModulesCount === 0) continue; - error(...args) { - this[LOG_SYMBOL](LogType.error, args); - } + // instead of swapping A and B just bail + // as we loop twice the current A will be B and B then A + if (chunkAModulesCount > chunkBModulesCount) continue; - warn(...args) { - this[LOG_SYMBOL](LogType.warn, args); - } + // is chunkA in chunkB? - info(...args) { - this[LOG_SYMBOL](LogType.info, args); - } + // we do a cheap check for the hash value + const chunkBHash = chunkModulesHash.get(chunkB); + if ((chunkBHash & chunkAHash) !== chunkAHash) continue; - log(...args) { - this[LOG_SYMBOL](LogType.log, args); + // compare all modules + for (const m of chunkGraph.getChunkModulesIterable(chunkA)) { + if (!chunkGraph.isModuleInChunk(m, chunkB)) continue loopB; + } + chunkB.ids.push(chunkA.id); + } + } + } + ); + }); } +} +module.exports = FlagIncludedChunksPlugin; - debug(...args) { - this[LOG_SYMBOL](LogType.debug, args); - } - assert(assertion, ...args) { - if (!assertion) { - this[LOG_SYMBOL](LogType.error, args); - } - } +/***/ }), - trace() { - this[LOG_SYMBOL](LogType.trace, ["Trace"]); - } +/***/ 38988: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - clear() { - this[LOG_SYMBOL](LogType.clear); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Sergey Melyukov @smelukov +*/ - status(...args) { - this[LOG_SYMBOL](LogType.status, args); - } - group(...args) { - this[LOG_SYMBOL](LogType.group, args); - } - groupCollapsed(...args) { - this[LOG_SYMBOL](LogType.groupCollapsed, args); - } +const { UsageState } = __webpack_require__(63686); - groupEnd(...args) { - this[LOG_SYMBOL](LogType.groupEnd, args); - } - - profile(label) { - this[LOG_SYMBOL](LogType.profile, [label]); - } - - profileEnd(label) { - this[LOG_SYMBOL](LogType.profileEnd, [label]); - } +/** @typedef {import("estree").Node} AnyNode */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../Parser").ParserState} ParserState */ +/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - time(label) { - this[TIMERS_SYMBOL] = this[TIMERS_SYMBOL] || new Map(); - this[TIMERS_SYMBOL].set(label, process.hrtime()); - } +/** @typedef {Map | true>} InnerGraph */ +/** @typedef {function(boolean | Set | undefined): void} UsageCallback */ - timeLog(label) { - const prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label); - if (!prev) { - throw new Error(`No such label '${label}' for WebpackLogger.timeLog()`); - } - const time = process.hrtime(prev); - this[LOG_SYMBOL](LogType.time, [label, ...time]); - } +/** + * @typedef {Object} StateObject + * @property {InnerGraph} innerGraph + * @property {TopLevelSymbol=} currentTopLevelSymbol + * @property {Map>} usageCallbackMap + */ - timeEnd(label) { - const prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label); - if (!prev) { - throw new Error(`No such label '${label}' for WebpackLogger.timeEnd()`); - } - const time = process.hrtime(prev); - this[TIMERS_SYMBOL].delete(label); - this[LOG_SYMBOL](LogType.time, [label, ...time]); - } +/** @typedef {false|StateObject} State */ - timeAggregate(label) { - const prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label); - if (!prev) { - throw new Error( - `No such label '${label}' for WebpackLogger.timeAggregate()` - ); - } - const time = process.hrtime(prev); - this[TIMERS_SYMBOL].delete(label); - this[TIMERS_AGGREGATES_SYMBOL] = - this[TIMERS_AGGREGATES_SYMBOL] || new Map(); - const current = this[TIMERS_AGGREGATES_SYMBOL].get(label); - if (current !== undefined) { - if (time[1] + current[1] > 1e9) { - time[0] += current[0] + 1; - time[1] = time[1] - 1e9 + current[1]; - } else { - time[0] += current[0]; - time[1] += current[1]; - } - } - this[TIMERS_AGGREGATES_SYMBOL].set(label, time); - } +/** @type {WeakMap} */ +const parserStateMap = new WeakMap(); +const topLevelSymbolTag = Symbol("top level symbol"); - timeAggregateEnd(label) { - if (this[TIMERS_AGGREGATES_SYMBOL] === undefined) return; - const time = this[TIMERS_AGGREGATES_SYMBOL].get(label); - if (time === undefined) return; - this[TIMERS_AGGREGATES_SYMBOL].delete(label); - this[LOG_SYMBOL](LogType.time, [label, ...time]); - } +/** + * @param {ParserState} parserState parser state + * @returns {State} state + */ +function getState(parserState) { + return parserStateMap.get(parserState); } -exports.Logger = WebpackLogger; - - -/***/ }), - -/***/ 54963: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { LogType } = __webpack_require__(32597); - -/** @typedef {import("../../declarations/WebpackOptions").FilterItemTypes} FilterItemTypes */ -/** @typedef {import("../../declarations/WebpackOptions").FilterTypes} FilterTypes */ -/** @typedef {import("./Logger").LogTypeEnum} LogTypeEnum */ - -/** @typedef {function(string): boolean} FilterFunction */ +/** + * @param {ParserState} parserState parser state + * @returns {void} + */ +exports.bailout = parserState => { + parserStateMap.set(parserState, false); +}; /** - * @typedef {Object} LoggerConsole - * @property {function(): void} clear - * @property {function(): void} trace - * @property {(...args: any[]) => void} info - * @property {(...args: any[]) => void} log - * @property {(...args: any[]) => void} warn - * @property {(...args: any[]) => void} error - * @property {(...args: any[]) => void=} debug - * @property {(...args: any[]) => void=} group - * @property {(...args: any[]) => void=} groupCollapsed - * @property {(...args: any[]) => void=} groupEnd - * @property {(...args: any[]) => void=} status - * @property {(...args: any[]) => void=} profile - * @property {(...args: any[]) => void=} profileEnd - * @property {(...args: any[]) => void=} logTime + * @param {ParserState} parserState parser state + * @returns {void} */ +exports.enable = parserState => { + const state = parserStateMap.get(parserState); + if (state === false) { + return; + } + parserStateMap.set(parserState, { + innerGraph: new Map(), + currentTopLevelSymbol: undefined, + usageCallbackMap: new Map() + }); +}; /** - * @typedef {Object} LoggerOptions - * @property {false|true|"none"|"error"|"warn"|"info"|"log"|"verbose"} level loglevel - * @property {FilterTypes|boolean} debug filter for debug logging - * @property {LoggerConsole} console the console to log to + * @param {ParserState} parserState parser state + * @returns {boolean} true, when enabled */ +exports.isEnabled = parserState => { + const state = parserStateMap.get(parserState); + return !!state; +}; /** - * @param {FilterItemTypes} item an input item - * @returns {FilterFunction} filter function + * @param {ParserState} state parser state + * @param {TopLevelSymbol | null} symbol the symbol, or null for all symbols + * @param {string | TopLevelSymbol | true} usage usage data + * @returns {void} */ -const filterToFunction = item => { - if (typeof item === "string") { - const regExp = new RegExp( - `[\\\\/]${item.replace( - // eslint-disable-next-line no-useless-escape - /[-[\]{}()*+?.\\^$|]/g, - "\\$&" - )}([\\\\/]|$|!|\\?)` - ); - return ident => regExp.test(ident); - } - if (item && typeof item === "object" && typeof item.test === "function") { - return ident => item.test(ident); - } - if (typeof item === "function") { - return item; - } - if (typeof item === "boolean") { - return () => item; +exports.addUsage = (state, symbol, usage) => { + const innerGraphState = getState(state); + + if (innerGraphState) { + const { innerGraph } = innerGraphState; + const info = innerGraph.get(symbol); + if (usage === true) { + innerGraph.set(symbol, true); + } else if (info === undefined) { + innerGraph.set(symbol, new Set([usage])); + } else if (info !== true) { + info.add(usage); + } } }; /** - * @enum {number} + * @param {JavascriptParser} parser the parser + * @param {string} name name of variable + * @param {string | TopLevelSymbol | true} usage usage data + * @returns {void} */ -const LogLevel = { - none: 6, - false: 6, - error: 5, - warn: 4, - info: 3, - log: 2, - true: 2, - verbose: 1 +exports.addVariableUsage = (parser, name, usage) => { + const symbol = + /** @type {TopLevelSymbol} */ ( + parser.getTagData(name, topLevelSymbolTag) + ) || exports.tagTopLevelSymbol(parser, name); + if (symbol) { + exports.addUsage(parser.state, symbol, usage); + } }; /** - * @param {LoggerOptions} options options object - * @returns {function(string, LogTypeEnum, any[]): void} logging function + * @param {ParserState} state parser state + * @returns {void} */ -module.exports = ({ level = "info", debug = false, console }) => { - const debugFilters = - typeof debug === "boolean" - ? [() => debug] - : /** @type {FilterItemTypes[]} */ ([]) - .concat(debug) - .map(filterToFunction); - /** @type {number} */ - const loglevel = LogLevel[`${level}`] || 0; +exports.inferDependencyUsage = state => { + const innerGraphState = getState(state); - /** - * @param {string} name name of the logger - * @param {LogTypeEnum} type type of the log entry - * @param {any[]} args arguments of the log entry - * @returns {void} - */ - const logger = (name, type, args) => { - const labeledArgs = () => { - if (Array.isArray(args)) { - if (args.length > 0 && typeof args[0] === "string") { - return [`[${name}] ${args[0]}`, ...args.slice(1)]; - } else { - return [`[${name}]`, ...args]; - } - } else { - return []; + if (!innerGraphState) { + return; + } + + const { innerGraph, usageCallbackMap } = innerGraphState; + const processed = new Map(); + // flatten graph to terminal nodes (string, undefined or true) + const nonTerminal = new Set(innerGraph.keys()); + while (nonTerminal.size > 0) { + for (const key of nonTerminal) { + /** @type {Set | true} */ + let newSet = new Set(); + let isTerminal = true; + const value = innerGraph.get(key); + let alreadyProcessed = processed.get(key); + if (alreadyProcessed === undefined) { + alreadyProcessed = new Set(); + processed.set(key, alreadyProcessed); } - }; - const debug = debugFilters.some(f => f(name)); - switch (type) { - case LogType.debug: - if (!debug) return; - // eslint-disable-next-line node/no-unsupported-features/node-builtins - if (typeof console.debug === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.debug(...labeledArgs()); - } else { - console.log(...labeledArgs()); + if (value !== true && value !== undefined) { + for (const item of value) { + alreadyProcessed.add(item); } - break; - case LogType.log: - if (!debug && loglevel > LogLevel.log) return; - console.log(...labeledArgs()); - break; - case LogType.info: - if (!debug && loglevel > LogLevel.info) return; - console.info(...labeledArgs()); - break; - case LogType.warn: - if (!debug && loglevel > LogLevel.warn) return; - console.warn(...labeledArgs()); - break; - case LogType.error: - if (!debug && loglevel > LogLevel.error) return; - console.error(...labeledArgs()); - break; - case LogType.trace: - if (!debug) return; - console.trace(); - break; - case LogType.groupCollapsed: - if (!debug && loglevel > LogLevel.log) return; - if (!debug && loglevel > LogLevel.verbose) { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - if (typeof console.groupCollapsed === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.groupCollapsed(...labeledArgs()); + for (const item of value) { + if (typeof item === "string") { + newSet.add(item); } else { - console.log(...labeledArgs()); + const itemValue = innerGraph.get(item); + if (itemValue === true) { + newSet = true; + break; + } + if (itemValue !== undefined) { + for (const i of itemValue) { + if (i === key) continue; + if (alreadyProcessed.has(i)) continue; + newSet.add(i); + if (typeof i !== "string") { + isTerminal = false; + } + } + } } - break; - } - // falls through - case LogType.group: - if (!debug && loglevel > LogLevel.log) return; - // eslint-disable-next-line node/no-unsupported-features/node-builtins - if (typeof console.group === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.group(...labeledArgs()); - } else { - console.log(...labeledArgs()); - } - break; - case LogType.groupEnd: - if (!debug && loglevel > LogLevel.log) return; - // eslint-disable-next-line node/no-unsupported-features/node-builtins - if (typeof console.groupEnd === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.groupEnd(); } - break; - case LogType.time: { - if (!debug && loglevel > LogLevel.log) return; - const ms = args[1] * 1000 + args[2] / 1000000; - const msg = `[${name}] ${args[0]}: ${ms} ms`; - if (typeof console.logTime === "function") { - console.logTime(msg); + if (newSet === true) { + innerGraph.set(key, true); + } else if (newSet.size === 0) { + innerGraph.set(key, undefined); } else { - console.log(msg); + innerGraph.set(key, newSet); } - break; } - case LogType.profile: - // eslint-disable-next-line node/no-unsupported-features/node-builtins - if (typeof console.profile === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.profile(...labeledArgs()); - } - break; - case LogType.profileEnd: - // eslint-disable-next-line node/no-unsupported-features/node-builtins - if (typeof console.profileEnd === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.profileEnd(...labeledArgs()); - } - break; - case LogType.clear: - if (!debug && loglevel > LogLevel.log) return; - // eslint-disable-next-line node/no-unsupported-features/node-builtins - if (typeof console.clear === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.clear(); - } - break; - case LogType.status: - if (!debug && loglevel > LogLevel.info) return; - if (typeof console.status === "function") { - if (args.length === 0) { - console.status(); - } else { - console.status(...labeledArgs()); - } - } else { - if (args.length !== 0) { - console.info(...labeledArgs()); + if (isTerminal) { + nonTerminal.delete(key); + + // For the global key, merge with all other keys + if (key === null) { + const globalValue = innerGraph.get(null); + if (globalValue) { + for (const [key, value] of innerGraph) { + if (key !== null && value !== true) { + if (globalValue === true) { + innerGraph.set(key, true); + } else { + const newSet = new Set(value); + for (const item of globalValue) { + newSet.add(item); + } + innerGraph.set(key, newSet); + } + } + } } } - break; - default: - throw new Error(`Unexpected LogType ${type}`); + } } - }; - return logger; -}; - - -/***/ }), + } -/***/ 62090: -/***/ (function(module) { + /** @type {Map>} */ + for (const [symbol, callbacks] of usageCallbackMap) { + const usage = /** @type {true | Set | undefined} */ ( + innerGraph.get(symbol) + ); + for (const callback of callbacks) { + callback(usage === undefined ? false : usage); + } + } +}; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** + * @param {ParserState} state parser state + * @param {UsageCallback} onUsageCallback on usage callback + */ +exports.onUsage = (state, onUsageCallback) => { + const innerGraphState = getState(state); + if (innerGraphState) { + const { usageCallbackMap, currentTopLevelSymbol } = innerGraphState; + if (currentTopLevelSymbol) { + let callbacks = usageCallbackMap.get(currentTopLevelSymbol); + if (callbacks === undefined) { + callbacks = new Set(); + usageCallbackMap.set(currentTopLevelSymbol, callbacks); + } -const arraySum = array => { - let sum = 0; - for (const item of array) sum += item; - return sum; + callbacks.add(onUsageCallback); + } else { + onUsageCallback(true); + } + } else { + onUsageCallback(undefined); + } }; /** - * @param {any[]} args items to be truncated - * @param {number} maxLength maximum length of args including spaces between - * @returns {string[]} truncated args + * @param {ParserState} state parser state + * @param {TopLevelSymbol} symbol the symbol */ -const truncateArgs = (args, maxLength) => { - const lengths = args.map(a => `${a}`.length); - const availableLength = maxLength - lengths.length + 1; +exports.setTopLevelSymbol = (state, symbol) => { + const innerGraphState = getState(state); - if (availableLength > 0 && args.length === 1) { - if (availableLength >= args[0].length) { - return args; - } else if (availableLength > 3) { - return ["..." + args[0].slice(-availableLength + 3)]; - } else { - return [args[0].slice(-availableLength)]; - } + if (innerGraphState) { + innerGraphState.currentTopLevelSymbol = symbol; } +}; - // Check if there is space for at least 4 chars per arg - if (availableLength < arraySum(lengths.map(i => Math.min(i, 6)))) { - // remove args - if (args.length > 1) - return truncateArgs(args.slice(0, args.length - 1), maxLength); - return []; +/** + * @param {ParserState} state parser state + * @returns {TopLevelSymbol|void} usage data + */ +exports.getTopLevelSymbol = state => { + const innerGraphState = getState(state); + + if (innerGraphState) { + return innerGraphState.currentTopLevelSymbol; } +}; - let currentLength = arraySum(lengths); +/** + * @param {JavascriptParser} parser parser + * @param {string} name name of variable + * @returns {TopLevelSymbol} symbol + */ +exports.tagTopLevelSymbol = (parser, name) => { + const innerGraphState = getState(parser.state); + if (!innerGraphState) return; - // Check if all fits into maxLength - if (currentLength <= availableLength) return args; + parser.defineVariable(name); - // Try to remove chars from the longest items until it fits - while (currentLength > availableLength) { - const maxLength = Math.max(...lengths); - const shorterItems = lengths.filter(l => l !== maxLength); - const nextToMaxLength = - shorterItems.length > 0 ? Math.max(...shorterItems) : 0; - const maxReduce = maxLength - nextToMaxLength; - let maxItems = lengths.length - shorterItems.length; - let overrun = currentLength - availableLength; - for (let i = 0; i < lengths.length; i++) { - if (lengths[i] === maxLength) { - const reduce = Math.min(Math.floor(overrun / maxItems), maxReduce); - lengths[i] -= reduce; - currentLength -= reduce; - overrun -= reduce; - maxItems--; - } - } + const existingTag = /** @type {TopLevelSymbol} */ ( + parser.getTagData(name, topLevelSymbolTag) + ); + if (existingTag) { + return existingTag; } - // Return args reduced to length in lengths - return args.map((a, i) => { - const str = `${a}`; - const length = lengths[i]; - if (str.length === length) { - return str; - } else if (length > 5) { - return "..." + str.slice(-length + 3); - } else if (length > 0) { - return str.slice(-length); - } else { - return ""; - } - }); + const fn = new TopLevelSymbol(name); + parser.tagVariable(name, topLevelSymbolTag, fn); + return fn; }; -module.exports = truncateArgs; - - -/***/ }), - -/***/ 1313: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const StartupChunkDependenciesPlugin = __webpack_require__(22339); - -/** @typedef {import("../Compiler")} Compiler */ +/** + * @param {Dependency} dependency the dependency + * @param {Set | boolean} usedByExports usedByExports info + * @param {ModuleGraph} moduleGraph moduleGraph + * @param {RuntimeSpec} runtime runtime + * @returns {boolean} false, when unused. Otherwise true + */ +exports.isDependencyUsedByExports = ( + dependency, + usedByExports, + moduleGraph, + runtime +) => { + if (usedByExports === false) return false; + if (usedByExports !== true && usedByExports !== undefined) { + const selfModule = moduleGraph.getParentModule(dependency); + const exportsInfo = moduleGraph.getExportsInfo(selfModule); + let used = false; + for (const exportName of usedByExports) { + if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) + used = true; + } + if (!used) return false; + } + return true; +}; -class CommonJsChunkLoadingPlugin { - constructor(options) { - options = options || {}; - this._asyncChunkLoading = options.asyncChunkLoading; +/** + * @param {Dependency} dependency the dependency + * @param {Set | boolean} usedByExports usedByExports info + * @param {ModuleGraph} moduleGraph moduleGraph + * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active + */ +exports.getDependencyUsedByExportsCondition = ( + dependency, + usedByExports, + moduleGraph +) => { + if (usedByExports === false) return false; + if (usedByExports !== true && usedByExports !== undefined) { + const selfModule = moduleGraph.getParentModule(dependency); + const exportsInfo = moduleGraph.getExportsInfo(selfModule); + return (connections, runtime) => { + for (const exportName of usedByExports) { + if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) + return true; + } + return false; + }; } + return null; +}; +class TopLevelSymbol { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {string} name name of the variable */ - apply(compiler) { - const ChunkLoadingRuntimeModule = this._asyncChunkLoading - ? __webpack_require__(73369) - : __webpack_require__(94172); - const chunkLoadingValue = this._asyncChunkLoading - ? "async-node" - : "require"; - new StartupChunkDependenciesPlugin({ - chunkLoading: chunkLoadingValue, - asyncChunkLoading: this._asyncChunkLoading - }).apply(compiler); - compiler.hooks.thisCompilation.tap( - "CommonJsChunkLoadingPlugin", - compilation => { - const globalChunkLoading = compilation.outputOptions.chunkLoading; - const isEnabledForChunk = chunk => { - const options = chunk.getEntryOptions(); - const chunkLoading = - options && options.chunkLoading !== undefined - ? options.chunkLoading - : globalChunkLoading; - return chunkLoading === chunkLoadingValue; - }; - const onceForChunkSet = new WeakSet(); - const handler = (chunk, set) => { - if (onceForChunkSet.has(chunk)) return; - onceForChunkSet.add(chunk); - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - set.add(RuntimeGlobals.hasOwnProperty); - compilation.addRuntimeModule( - chunk, - new ChunkLoadingRuntimeModule(set) - ); - }; - - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("CommonJsChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadUpdateHandlers) - .tap("CommonJsChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadManifest) - .tap("CommonJsChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.baseURI) - .tap("CommonJsChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.externalInstallChunk) - .tap("CommonJsChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.onChunksLoaded) - .tap("CommonJsChunkLoadingPlugin", handler); - - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("CommonJsChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.getChunkScriptFilename); - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadUpdateHandlers) - .tap("CommonJsChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.getChunkUpdateScriptFilename); - set.add(RuntimeGlobals.moduleCache); - set.add(RuntimeGlobals.hmrModuleData); - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadManifest) - .tap("CommonJsChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.getUpdateManifestFilename); - }); - } - ); + constructor(name) { + this.name = name; } } -module.exports = CommonJsChunkLoadingPlugin; +exports.TopLevelSymbol = TopLevelSymbol; +exports.topLevelSymbolTag = topLevelSymbolTag; /***/ }), -/***/ 7553: +/***/ 28758: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -105434,221 +102411,372 @@ module.exports = CommonJsChunkLoadingPlugin; -const CachedInputFileSystem = __webpack_require__(89429); -const fs = __webpack_require__(90552); -const createConsoleLogger = __webpack_require__(54963); -const NodeWatchFileSystem = __webpack_require__(98810); -const nodeConsole = __webpack_require__(91786); +const PureExpressionDependency = __webpack_require__(55799); +const InnerGraph = __webpack_require__(38988); -/** @typedef {import("../../declarations/WebpackOptions").InfrastructureLogging} InfrastructureLogging */ +/** @typedef {import("estree").ClassDeclaration} ClassDeclarationNode */ +/** @typedef {import("estree").ClassExpression} ClassExpressionNode */ +/** @typedef {import("estree").Node} Node */ +/** @typedef {import("estree").VariableDeclarator} VariableDeclaratorNode */ /** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../dependencies/HarmonyImportSpecifierDependency")} HarmonyImportSpecifierDependency */ +/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ +/** @typedef {import("./InnerGraph").InnerGraph} InnerGraph */ +/** @typedef {import("./InnerGraph").TopLevelSymbol} TopLevelSymbol */ -class NodeEnvironmentPlugin { - /** - * @param {Object} options options - * @param {InfrastructureLogging} options.infrastructureLogging infrastructure logging options - */ - constructor(options) { - this.options = options; - } +const { topLevelSymbolTag } = InnerGraph; +class InnerGraphPlugin { /** * Apply the plugin * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { - const { infrastructureLogging } = this.options; - compiler.infrastructureLogger = createConsoleLogger({ - level: infrastructureLogging.level || "info", - debug: infrastructureLogging.debug || false, - console: - infrastructureLogging.console || - nodeConsole({ - colors: infrastructureLogging.colors, - appendOnly: infrastructureLogging.appendOnly, - stream: infrastructureLogging.stream - }) - }); - compiler.inputFileSystem = new CachedInputFileSystem(fs, 60000); - const inputFileSystem = compiler.inputFileSystem; - compiler.outputFileSystem = fs; - compiler.intermediateFileSystem = fs; - compiler.watchFileSystem = new NodeWatchFileSystem( - compiler.inputFileSystem - ); - compiler.hooks.beforeRun.tap("NodeEnvironmentPlugin", compiler => { - if (compiler.inputFileSystem === inputFileSystem) { - compiler.fsStartTime = Date.now(); - inputFileSystem.purge(); - } - }); - } -} - -module.exports = NodeEnvironmentPlugin; - - -/***/ }), - -/***/ 7103: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** @typedef {import("../Compiler")} Compiler */ + compiler.hooks.compilation.tap( + "InnerGraphPlugin", + (compilation, { normalModuleFactory }) => { + const logger = compilation.getLogger("webpack.InnerGraphPlugin"); -class NodeSourcePlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) {} -} + compilation.dependencyTemplates.set( + PureExpressionDependency, + new PureExpressionDependency.Template() + ); -module.exports = NodeSourcePlugin; + /** + * @param {JavascriptParser} parser the parser + * @param {Object} parserOptions options + * @returns {void} + */ + const handler = (parser, parserOptions) => { + const onUsageSuper = sup => { + InnerGraph.onUsage(parser.state, usedByExports => { + switch (usedByExports) { + case undefined: + case true: + return; + default: { + const dep = new PureExpressionDependency(sup.range); + dep.loc = sup.loc; + dep.usedByExports = usedByExports; + parser.state.module.addDependency(dep); + break; + } + } + }); + }; + parser.hooks.program.tap("InnerGraphPlugin", () => { + InnerGraph.enable(parser.state); + }); -/***/ }), + parser.hooks.finish.tap("InnerGraphPlugin", () => { + if (!InnerGraph.isEnabled(parser.state)) return; -/***/ 17916: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + logger.time("infer dependency usage"); + InnerGraph.inferDependencyUsage(parser.state); + logger.timeAggregate("infer dependency usage"); + }); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // During prewalking the following datastructures are filled with + // nodes that have a TopLevelSymbol assigned and + // variables are tagged with the assigned TopLevelSymbol + // We differ 3 types of nodes: + // 1. full statements (export default, function declaration) + // 2. classes (class declaration, class expression) + // 3. variable declarators (const x = ...) + /** @type {WeakMap} */ + const statementWithTopLevelSymbol = new WeakMap(); + /** @type {WeakMap} */ + const statementPurePart = new WeakMap(); -const ExternalsPlugin = __webpack_require__(6652); + /** @type {WeakMap} */ + const classWithTopLevelSymbol = new WeakMap(); -/** @typedef {import("../Compiler")} Compiler */ + /** @type {WeakMap} */ + const declWithTopLevelSymbol = new WeakMap(); + /** @type {WeakSet} */ + const pureDeclarators = new WeakSet(); -const builtins = [ - "assert", - "async_hooks", - "buffer", - "child_process", - "cluster", - "console", - "constants", - "crypto", - "dgram", - "diagnostics_channel", - "dns", - "dns/promises", - "domain", - "events", - "fs", - "fs/promises", - "http", - "http2", - "https", - "inspector", - "module", - "net", - "os", - "path", - "path/posix", - "path/win32", - "perf_hooks", - "process", - "punycode", - "querystring", - "readline", - "repl", - "stream", - "stream/promises", - "stream/web", - "string_decoder", - "sys", - "timers", - "timers/promises", - "tls", - "trace_events", - "tty", - "url", - "util", - "util/types", - "v8", - "vm", - "wasi", - "worker_threads", - "zlib", - /^node:/, + // The following hooks are used during prewalking: - // cspell:word pnpapi - // Yarn PnP adds pnpapi as "builtin" - "pnpapi" -]; + parser.hooks.preStatement.tap("InnerGraphPlugin", statement => { + if (!InnerGraph.isEnabled(parser.state)) return; -class NodeTargetPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - new ExternalsPlugin("node-commonjs", builtins).apply(compiler); - } -} + if (parser.scope.topLevelScope === true) { + if (statement.type === "FunctionDeclaration") { + const name = statement.id ? statement.id.name : "*default*"; + const fn = InnerGraph.tagTopLevelSymbol(parser, name); + statementWithTopLevelSymbol.set(statement, fn); + return true; + } + } + }); -module.exports = NodeTargetPlugin; + parser.hooks.blockPreStatement.tap("InnerGraphPlugin", statement => { + if (!InnerGraph.isEnabled(parser.state)) return; + if (parser.scope.topLevelScope === true) { + if (statement.type === "ClassDeclaration") { + const name = statement.id ? statement.id.name : "*default*"; + const fn = InnerGraph.tagTopLevelSymbol(parser, name); + classWithTopLevelSymbol.set(statement, fn); + return true; + } + if (statement.type === "ExportDefaultDeclaration") { + const name = "*default*"; + const fn = InnerGraph.tagTopLevelSymbol(parser, name); + const decl = statement.declaration; + if ( + decl.type === "ClassExpression" || + decl.type === "ClassDeclaration" + ) { + classWithTopLevelSymbol.set(decl, fn); + } else if (parser.isPure(decl, statement.range[0])) { + statementWithTopLevelSymbol.set(statement, fn); + if ( + !decl.type.endsWith("FunctionExpression") && + !decl.type.endsWith("Declaration") && + decl.type !== "Literal" + ) { + statementPurePart.set(statement, decl); + } + } + } + } + }); -/***/ }), + parser.hooks.preDeclarator.tap( + "InnerGraphPlugin", + (decl, statement) => { + if (!InnerGraph.isEnabled(parser.state)) return; + if ( + parser.scope.topLevelScope === true && + decl.init && + decl.id.type === "Identifier" + ) { + const name = decl.id.name; + if (decl.init.type === "ClassExpression") { + const fn = InnerGraph.tagTopLevelSymbol(parser, name); + classWithTopLevelSymbol.set(decl.init, fn); + } else if (parser.isPure(decl.init, decl.id.range[1])) { + const fn = InnerGraph.tagTopLevelSymbol(parser, name); + declWithTopLevelSymbol.set(decl, fn); + if ( + !decl.init.type.endsWith("FunctionExpression") && + decl.init.type !== "Literal" + ) { + pureDeclarators.add(decl); + } + return true; + } + } + } + ); -/***/ 61052: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // During real walking we set the TopLevelSymbol state to the assigned + // TopLevelSymbol by using the fill datastructures. -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // In addition to tracking TopLevelSymbols, we sometimes need to + // add a PureExpressionDependency. This is needed to skip execution + // of pure expressions, even when they are not dropped due to + // minimizing. Otherwise symbols used there might not exist anymore + // as they are removed as unused by this optimization + // When we find a reference to a TopLevelSymbol, we register a + // TopLevelSymbol dependency from TopLevelSymbol in state to the + // referenced TopLevelSymbol. This way we get a graph of all + // TopLevelSymbols. + // The following hooks are called during walking: -const CommonJsChunkFormatPlugin = __webpack_require__(84508); -const EnableChunkLoadingPlugin = __webpack_require__(61291); + parser.hooks.statement.tap("InnerGraphPlugin", statement => { + if (!InnerGraph.isEnabled(parser.state)) return; + if (parser.scope.topLevelScope === true) { + InnerGraph.setTopLevelSymbol(parser.state, undefined); -/** @typedef {import("../Compiler")} Compiler */ + const fn = statementWithTopLevelSymbol.get(statement); + if (fn) { + InnerGraph.setTopLevelSymbol(parser.state, fn); + const purePart = statementPurePart.get(statement); + if (purePart) { + InnerGraph.onUsage(parser.state, usedByExports => { + switch (usedByExports) { + case undefined: + case true: + return; + default: { + const dep = new PureExpressionDependency( + purePart.range + ); + dep.loc = statement.loc; + dep.usedByExports = usedByExports; + parser.state.module.addDependency(dep); + break; + } + } + }); + } + } + } + }); -class NodeTemplatePlugin { - constructor(options) { - this._options = options || {}; - } + parser.hooks.classExtendsExpression.tap( + "InnerGraphPlugin", + (expr, statement) => { + if (!InnerGraph.isEnabled(parser.state)) return; + if (parser.scope.topLevelScope === true) { + const fn = classWithTopLevelSymbol.get(statement); + if ( + fn && + parser.isPure( + expr, + statement.id ? statement.id.range[1] : statement.range[0] + ) + ) { + InnerGraph.setTopLevelSymbol(parser.state, fn); + onUsageSuper(expr); + } + } + } + ); - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const chunkLoading = this._options.asyncChunkLoading - ? "async-node" - : "require"; - compiler.options.output.chunkLoading = chunkLoading; - new CommonJsChunkFormatPlugin().apply(compiler); - new EnableChunkLoadingPlugin(chunkLoading).apply(compiler); + parser.hooks.classBodyElement.tap( + "InnerGraphPlugin", + (element, classDefinition) => { + if (!InnerGraph.isEnabled(parser.state)) return; + if (parser.scope.topLevelScope === true) { + const fn = classWithTopLevelSymbol.get(classDefinition); + if (fn) { + InnerGraph.setTopLevelSymbol(parser.state, undefined); + } + } + } + ); + + parser.hooks.classBodyValue.tap( + "InnerGraphPlugin", + (expression, element, classDefinition) => { + if (!InnerGraph.isEnabled(parser.state)) return; + if (parser.scope.topLevelScope === true) { + const fn = classWithTopLevelSymbol.get(classDefinition); + if (fn) { + if ( + !element.static || + parser.isPure( + expression, + element.key ? element.key.range[1] : element.range[0] + ) + ) { + InnerGraph.setTopLevelSymbol(parser.state, fn); + if (element.type !== "MethodDefinition" && element.static) { + InnerGraph.onUsage(parser.state, usedByExports => { + switch (usedByExports) { + case undefined: + case true: + return; + default: { + const dep = new PureExpressionDependency( + expression.range + ); + dep.loc = expression.loc; + dep.usedByExports = usedByExports; + parser.state.module.addDependency(dep); + break; + } + } + }); + } + } else { + InnerGraph.setTopLevelSymbol(parser.state, undefined); + } + } + } + } + ); + + parser.hooks.declarator.tap("InnerGraphPlugin", (decl, statement) => { + if (!InnerGraph.isEnabled(parser.state)) return; + const fn = declWithTopLevelSymbol.get(decl); + + if (fn) { + InnerGraph.setTopLevelSymbol(parser.state, fn); + if (pureDeclarators.has(decl)) { + if (decl.init.type === "ClassExpression") { + if (decl.init.superClass) { + onUsageSuper(decl.init.superClass); + } + } else { + InnerGraph.onUsage(parser.state, usedByExports => { + switch (usedByExports) { + case undefined: + case true: + return; + default: { + const dep = new PureExpressionDependency( + decl.init.range + ); + dep.loc = decl.loc; + dep.usedByExports = usedByExports; + parser.state.module.addDependency(dep); + break; + } + } + }); + } + } + parser.walkExpression(decl.init); + InnerGraph.setTopLevelSymbol(parser.state, undefined); + return true; + } + }); + + parser.hooks.expression + .for(topLevelSymbolTag) + .tap("InnerGraphPlugin", () => { + const topLevelSymbol = /** @type {TopLevelSymbol} */ ( + parser.currentTagData + ); + const currentTopLevelSymbol = InnerGraph.getTopLevelSymbol( + parser.state + ); + InnerGraph.addUsage( + parser.state, + topLevelSymbol, + currentTopLevelSymbol || true + ); + }); + parser.hooks.assign + .for(topLevelSymbolTag) + .tap("InnerGraphPlugin", expr => { + if (!InnerGraph.isEnabled(parser.state)) return; + if (expr.operator === "=") return true; + }); + }; + normalModuleFactory.hooks.parser + .for("javascript/auto") + .tap("InnerGraphPlugin", handler); + normalModuleFactory.hooks.parser + .for("javascript/esm") + .tap("InnerGraphPlugin", handler); + + compilation.hooks.finishModules.tap("InnerGraphPlugin", () => { + logger.timeAggregateEnd("infer dependency usage"); + }); + } + ); } } -module.exports = NodeTemplatePlugin; +module.exports = InnerGraphPlugin; /***/ }), -/***/ 98810: +/***/ 83608: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -105659,482 +102787,260 @@ module.exports = NodeTemplatePlugin; -const util = __webpack_require__(73837); -const Watchpack = __webpack_require__(36871); +const { STAGE_ADVANCED } = __webpack_require__(80057); +const LazyBucketSortedSet = __webpack_require__(48424); +const { compareChunks } = __webpack_require__(29579); +const createSchemaValidation = __webpack_require__(32540); -/** @typedef {import("../../declarations/WebpackOptions").WatchOptions} WatchOptions */ -/** @typedef {import("../FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */ -/** @typedef {import("../util/fs").WatchFileSystem} WatchFileSystem */ -/** @typedef {import("../util/fs").WatchMethod} WatchMethod */ -/** @typedef {import("../util/fs").Watcher} Watcher */ +/** @typedef {import("../../declarations/plugins/optimize/LimitChunkCountPlugin").LimitChunkCountPluginOptions} LimitChunkCountPluginOptions */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compiler")} Compiler */ -class NodeWatchFileSystem { - constructor(inputFileSystem) { - this.inputFileSystem = inputFileSystem; - this.watcherOptions = { - aggregateTimeout: 0 - }; - this.watcher = new Watchpack(this.watcherOptions); +const validate = createSchemaValidation( + __webpack_require__(36557), + () => __webpack_require__(30837), + { + name: "Limit Chunk Count Plugin", + baseDataPath: "options" } +); - /** - * @param {Iterable} files watched files - * @param {Iterable} directories watched directories - * @param {Iterable} missing watched exitance entries - * @param {number} startTime timestamp of start time - * @param {WatchOptions} options options object - * @param {function(Error=, Map, Map, Set, Set): void} callback aggregated callback - * @param {function(string, number): void} callbackUndelayed callback when the first change was detected - * @returns {Watcher} a watcher - */ - watch( - files, - directories, - missing, - startTime, - options, - callback, - callbackUndelayed - ) { - if (!files || typeof files[Symbol.iterator] !== "function") { - throw new Error("Invalid arguments: 'files'"); - } - if (!directories || typeof directories[Symbol.iterator] !== "function") { - throw new Error("Invalid arguments: 'directories'"); - } - if (!missing || typeof missing[Symbol.iterator] !== "function") { - throw new Error("Invalid arguments: 'missing'"); - } - if (typeof callback !== "function") { - throw new Error("Invalid arguments: 'callback'"); - } - if (typeof startTime !== "number" && startTime) { - throw new Error("Invalid arguments: 'startTime'"); - } - if (typeof options !== "object") { - throw new Error("Invalid arguments: 'options'"); - } - if (typeof callbackUndelayed !== "function" && callbackUndelayed) { - throw new Error("Invalid arguments: 'callbackUndelayed'"); - } - const oldWatcher = this.watcher; - this.watcher = new Watchpack(options); +/** + * @typedef {Object} ChunkCombination + * @property {boolean} deleted this is set to true when combination was removed + * @property {number} sizeDiff + * @property {number} integratedSize + * @property {Chunk} a + * @property {Chunk} b + * @property {number} aIdx + * @property {number} bIdx + * @property {number} aSize + * @property {number} bSize + */ - if (callbackUndelayed) { - this.watcher.once("change", callbackUndelayed); - } +const addToSetMap = (map, key, value) => { + const set = map.get(key); + if (set === undefined) { + map.set(key, new Set([value])); + } else { + set.add(value); + } +}; - const fetchTimeInfo = () => { - const fileTimeInfoEntries = new Map(); - const contextTimeInfoEntries = new Map(); - if (this.watcher) { - this.watcher.collectTimeInfoEntries( - fileTimeInfoEntries, - contextTimeInfoEntries - ); - } - return { fileTimeInfoEntries, contextTimeInfoEntries }; - }; - this.watcher.once("aggregated", (changes, removals) => { - // pause emitting events (avoids clearing aggregated changes and removals on timeout) - this.watcher.pause(); +class LimitChunkCountPlugin { + /** + * @param {LimitChunkCountPluginOptions=} options options object + */ + constructor(options) { + validate(options); + this.options = options; + } - if (this.inputFileSystem && this.inputFileSystem.purge) { - const fs = this.inputFileSystem; - for (const item of changes) { - fs.purge(item); - } - for (const item of removals) { - fs.purge(item); - } - } - const { fileTimeInfoEntries, contextTimeInfoEntries } = fetchTimeInfo(); - callback( - null, - fileTimeInfoEntries, - contextTimeInfoEntries, - changes, - removals - ); - }); + /** + * @param {Compiler} compiler the webpack compiler + * @returns {void} + */ + apply(compiler) { + const options = this.options; + compiler.hooks.compilation.tap("LimitChunkCountPlugin", compilation => { + compilation.hooks.optimizeChunks.tap( + { + name: "LimitChunkCountPlugin", + stage: STAGE_ADVANCED + }, + chunks => { + const chunkGraph = compilation.chunkGraph; + const maxChunks = options.maxChunks; + if (!maxChunks) return; + if (maxChunks < 1) return; + if (compilation.chunks.size <= maxChunks) return; - this.watcher.watch({ files, directories, missing, startTime }); + let remainingChunksToMerge = compilation.chunks.size - maxChunks; - if (oldWatcher) { - oldWatcher.close(); - } - return { - close: () => { - if (this.watcher) { - this.watcher.close(); - this.watcher = null; - } - }, - pause: () => { - if (this.watcher) { - this.watcher.pause(); - } - }, - getAggregatedRemovals: util.deprecate( - () => { - const items = this.watcher && this.watcher.aggregatedRemovals; - if (items && this.inputFileSystem && this.inputFileSystem.purge) { - const fs = this.inputFileSystem; - for (const item of items) { - fs.purge(item); - } - } - return items; - }, - "Watcher.getAggregatedRemovals is deprecated in favor of Watcher.getInfo since that's more performant.", - "DEP_WEBPACK_WATCHER_GET_AGGREGATED_REMOVALS" - ), - getAggregatedChanges: util.deprecate( - () => { - const items = this.watcher && this.watcher.aggregatedChanges; - if (items && this.inputFileSystem && this.inputFileSystem.purge) { - const fs = this.inputFileSystem; - for (const item of items) { - fs.purge(item); - } - } - return items; - }, - "Watcher.getAggregatedChanges is deprecated in favor of Watcher.getInfo since that's more performant.", - "DEP_WEBPACK_WATCHER_GET_AGGREGATED_CHANGES" - ), - getFileTimeInfoEntries: util.deprecate( - () => { - return fetchTimeInfo().fileTimeInfoEntries; - }, - "Watcher.getFileTimeInfoEntries is deprecated in favor of Watcher.getInfo since that's more performant.", - "DEP_WEBPACK_WATCHER_FILE_TIME_INFO_ENTRIES" - ), - getContextTimeInfoEntries: util.deprecate( - () => { - return fetchTimeInfo().contextTimeInfoEntries; - }, - "Watcher.getContextTimeInfoEntries is deprecated in favor of Watcher.getInfo since that's more performant.", - "DEP_WEBPACK_WATCHER_CONTEXT_TIME_INFO_ENTRIES" - ), - getInfo: () => { - const removals = this.watcher && this.watcher.aggregatedRemovals; - const changes = this.watcher && this.watcher.aggregatedChanges; - if (this.inputFileSystem && this.inputFileSystem.purge) { - const fs = this.inputFileSystem; - if (removals) { - for (const item of removals) { - fs.purge(item); - } - } - if (changes) { - for (const item of changes) { - fs.purge(item); - } - } - } - const { fileTimeInfoEntries, contextTimeInfoEntries } = fetchTimeInfo(); - return { - changes, - removals, - fileTimeInfoEntries, - contextTimeInfoEntries - }; - } - }; - } -} + // order chunks in a deterministic way + const compareChunksWithGraph = compareChunks(chunkGraph); + const orderedChunks = Array.from(chunks).sort(compareChunksWithGraph); -module.exports = NodeWatchFileSystem; + // create a lazy sorted data structure to keep all combinations + // this is large. Size = chunks * (chunks - 1) / 2 + // It uses a multi layer bucket sort plus normal sort in the last layer + // It's also lazy so only accessed buckets are sorted + const combinations = new LazyBucketSortedSet( + // Layer 1: ordered by largest size benefit + c => c.sizeDiff, + (a, b) => b - a, + // Layer 2: ordered by smallest combined size + c => c.integratedSize, + (a, b) => a - b, + // Layer 3: ordered by position difference in orderedChunk (-> to be deterministic) + c => c.bIdx - c.aIdx, + (a, b) => a - b, + // Layer 4: ordered by position in orderedChunk (-> to be deterministic) + (a, b) => a.bIdx - b.bIdx + ); + // we keep a mapping from chunk to all combinations + // but this mapping is not kept up-to-date with deletions + // so `deleted` flag need to be considered when iterating this + /** @type {Map>} */ + const combinationsByChunk = new Map(); -/***/ }), + orderedChunks.forEach((b, bIdx) => { + // create combination pairs with size and integrated size + for (let aIdx = 0; aIdx < bIdx; aIdx++) { + const a = orderedChunks[aIdx]; + // filter pairs that can not be integrated! + if (!chunkGraph.canChunksBeIntegrated(a, b)) continue; -/***/ 73369: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + const integratedSize = chunkGraph.getIntegratedChunksSize( + a, + b, + options + ); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + const aSize = chunkGraph.getChunkSize(a, options); + const bSize = chunkGraph.getChunkSize(b, options); + const c = { + deleted: false, + sizeDiff: aSize + bSize - integratedSize, + integratedSize, + a, + b, + aIdx, + bIdx, + aSize, + bSize + }; + combinations.add(c); + addToSetMap(combinationsByChunk, a, c); + addToSetMap(combinationsByChunk, b, c); + } + return combinations; + }); + // list of modified chunks during this run + // combinations affected by this change are skipped to allow + // further optimizations + /** @type {Set} */ + const modifiedChunks = new Set(); + let changed = false; + // eslint-disable-next-line no-constant-condition + loop: while (true) { + const combination = combinations.popFirst(); + if (combination === undefined) break; -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); -const { - chunkHasJs, - getChunkFilenameTemplate -} = __webpack_require__(89464); -const { getInitialChunkIds } = __webpack_require__(98124); -const compileBooleanMatcher = __webpack_require__(29404); -const { getUndoPath } = __webpack_require__(82186); + combination.deleted = true; + const { a, b, integratedSize } = combination; -class ReadFileChunkLoadingRuntimeModule extends RuntimeModule { - constructor(runtimeRequirements) { - super("readFile chunk loading", RuntimeModule.STAGE_ATTACH); - this.runtimeRequirements = runtimeRequirements; - } + // skip over pair when + // one of the already merged chunks is a parent of one of the chunks + if (modifiedChunks.size > 0) { + const queue = new Set(a.groupsIterable); + for (const group of b.groupsIterable) { + queue.add(group); + } + for (const group of queue) { + for (const mChunk of modifiedChunks) { + if (mChunk !== a && mChunk !== b && mChunk.isInGroup(group)) { + // This is a potential pair which needs recalculation + // We can't do that now, but it merge before following pairs + // so we leave space for it, and consider chunks as modified + // just for the worse case + remainingChunksToMerge--; + if (remainingChunksToMerge <= 0) break loop; + modifiedChunks.add(a); + modifiedChunks.add(b); + continue loop; + } + } + for (const parent of group.parentsIterable) { + queue.add(parent); + } + } + } - /** - * @returns {string} runtime code - */ - generate() { - const { chunkGraph, chunk } = this; - const { runtimeTemplate } = this.compilation; - const fn = RuntimeGlobals.ensureChunkHandlers; - const withBaseURI = this.runtimeRequirements.has(RuntimeGlobals.baseURI); - const withExternalInstallChunk = this.runtimeRequirements.has( - RuntimeGlobals.externalInstallChunk - ); - const withOnChunkLoad = this.runtimeRequirements.has( - RuntimeGlobals.onChunksLoaded - ); - const withLoading = this.runtimeRequirements.has( - RuntimeGlobals.ensureChunkHandlers - ); - const withHmr = this.runtimeRequirements.has( - RuntimeGlobals.hmrDownloadUpdateHandlers - ); - const withHmrManifest = this.runtimeRequirements.has( - RuntimeGlobals.hmrDownloadManifest - ); - const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs); - const hasJsMatcher = compileBooleanMatcher(conditionMap); - const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); + // merge the chunks + if (chunkGraph.canChunksBeIntegrated(a, b)) { + chunkGraph.integrateChunks(a, b); + compilation.chunks.delete(b); - const outputName = this.compilation.getPath( - getChunkFilenameTemplate(chunk, this.compilation.outputOptions), - { - chunk, - contentHashType: "javascript" - } - ); - const rootOutputDir = getUndoPath( - outputName, - this.compilation.outputOptions.path, - false - ); + // flag chunk a as modified as further optimization are possible for all children here + modifiedChunks.add(a); - const stateExpression = withHmr - ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_readFileVm` - : undefined; + changed = true; + remainingChunksToMerge--; + if (remainingChunksToMerge <= 0) break; - return Template.asString([ - withBaseURI - ? Template.asString([ - `${RuntimeGlobals.baseURI} = require("url").pathToFileURL(${ - rootOutputDir - ? `__dirname + ${JSON.stringify("/" + rootOutputDir)}` - : "__filename" - });` - ]) - : "// no baseURI", - "", - "// object to store loaded chunks", - '// "0" means "already loaded", Promise means loading', - `var installedChunks = ${ - stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" - }{`, - Template.indent( - Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join( - ",\n" - ) - ), - "};", - "", - withOnChunkLoad - ? `${ - RuntimeGlobals.onChunksLoaded - }.readFileVm = ${runtimeTemplate.returningFunction( - "installedChunks[chunkId] === 0", - "chunkId" - )};` - : "// no on chunks loaded", - "", - withLoading || withExternalInstallChunk - ? `var installChunk = ${runtimeTemplate.basicFunction("chunk", [ - "var moreModules = chunk.modules, chunkIds = chunk.ids, runtime = chunk.runtime;", - "for(var moduleId in moreModules) {", - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, - Template.indent([ - `${RuntimeGlobals.moduleFactories}[moduleId] = moreModules[moduleId];` - ]), - "}" - ]), - "}", - `if(runtime) runtime(__webpack_require__);`, - "for(var i = 0; i < chunkIds.length; i++) {", - Template.indent([ - "if(installedChunks[chunkIds[i]]) {", - Template.indent(["installedChunks[chunkIds[i]][0]();"]), - "}", - "installedChunks[chunkIds[i]] = 0;" - ]), - "}", - withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : "" - ])};` - : "// no chunk install function needed", - "", - withLoading - ? Template.asString([ - "// ReadFile + VM.run chunk loading for javascript", - `${fn}.readFileVm = function(chunkId, promises) {`, - hasJsMatcher !== false - ? Template.indent([ - "", - "var installedChunkData = installedChunks[chunkId];", - 'if(installedChunkData !== 0) { // 0 means "already installed".', - Template.indent([ - '// array of [resolve, reject, promise] means "currently loading"', - "if(installedChunkData) {", - Template.indent(["promises.push(installedChunkData[2]);"]), - "} else {", - Template.indent([ - hasJsMatcher === true - ? "if(true) { // all chunks have JS" - : `if(${hasJsMatcher("chunkId")}) {`, - Template.indent([ - "// load the chunk and return promise to it", - "var promise = new Promise(function(resolve, reject) {", - Template.indent([ - "installedChunkData = installedChunks[chunkId] = [resolve, reject];", - `var filename = require('path').join(__dirname, ${JSON.stringify( - rootOutputDir - )} + ${ - RuntimeGlobals.getChunkScriptFilename - }(chunkId));`, - "require('fs').readFile(filename, 'utf-8', function(err, content) {", - Template.indent([ - "if(err) return reject(err);", - "var chunk = {};", - "require('vm').runInThisContext('(function(exports, require, __dirname, __filename) {' + content + '\\n})', filename)" + - "(chunk, require, require('path').dirname(filename), filename);", - "installChunk(chunk);" - ]), - "});" - ]), - "});", - "promises.push(installedChunkData[2] = promise);" - ]), - "} else installedChunks[chunkId] = 0;" - ]), - "}" - ]), - "}" - ]) - : Template.indent(["installedChunks[chunkId] = 0;"]), - "};" - ]) - : "// no chunk loading", - "", - withExternalInstallChunk - ? Template.asString([ - "module.exports = __webpack_require__;", - `${RuntimeGlobals.externalInstallChunk} = installChunk;` - ]) - : "// no external install chunk", - "", - withHmr - ? Template.asString([ - "function loadUpdateChunk(chunkId, updatedModulesList) {", - Template.indent([ - "return new Promise(function(resolve, reject) {", - Template.indent([ - `var filename = require('path').join(__dirname, ${JSON.stringify( - rootOutputDir - )} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId));`, - "require('fs').readFile(filename, 'utf-8', function(err, content) {", - Template.indent([ - "if(err) return reject(err);", - "var update = {};", - "require('vm').runInThisContext('(function(exports, require, __dirname, __filename) {' + content + '\\n})', filename)" + - "(update, require, require('path').dirname(filename), filename);", - "var updatedModules = update.modules;", - "var runtime = update.runtime;", - "for(var moduleId in updatedModules) {", - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(updatedModules, moduleId)) {`, - Template.indent([ - `currentUpdate[moduleId] = updatedModules[moduleId];`, - "if(updatedModulesList) updatedModulesList.push(moduleId);" - ]), - "}" - ]), - "}", - "if(runtime) currentUpdateRuntime.push(runtime);", - "resolve();" - ]), - "});" - ]), - "});" - ]), - "}", - "", - Template.getFunctionContent( - require('./JavascriptHotModuleReplacement.runtime.js') - ) - .replace(/\$key\$/g, "readFileVm") - .replace(/\$installedChunks\$/g, "installedChunks") - .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") - .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) - .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) - .replace( - /\$ensureChunkHandlers\$/g, - RuntimeGlobals.ensureChunkHandlers - ) - .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) - .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) - .replace( - /\$hmrDownloadUpdateHandlers\$/g, - RuntimeGlobals.hmrDownloadUpdateHandlers - ) - .replace( - /\$hmrInvalidateModuleHandlers\$/g, - RuntimeGlobals.hmrInvalidateModuleHandlers - ) - ]) - : "// no HMR", - "", - withHmrManifest - ? Template.asString([ - `${RuntimeGlobals.hmrDownloadManifest} = function() {`, - Template.indent([ - "return new Promise(function(resolve, reject) {", - Template.indent([ - `var filename = require('path').join(__dirname, ${JSON.stringify( - rootOutputDir - )} + ${RuntimeGlobals.getUpdateManifestFilename}());`, - "require('fs').readFile(filename, 'utf-8', function(err, content) {", - Template.indent([ - "if(err) {", - Template.indent([ - 'if(err.code === "ENOENT") return resolve();', - "return reject(err);" - ]), - "}", - "try { resolve(JSON.parse(content)); }", - "catch(e) { reject(e); }" - ]), - "});" - ]), - "});" - ]), - "}" - ]) - : "// no HMR manifest" - ]); + // Update all affected combinations + // delete all combination with the removed chunk + // we will use combinations with the kept chunk instead + for (const combination of combinationsByChunk.get(a)) { + if (combination.deleted) continue; + combination.deleted = true; + combinations.delete(combination); + } + + // Update combinations with the kept chunk with new sizes + for (const combination of combinationsByChunk.get(b)) { + if (combination.deleted) continue; + if (combination.a === b) { + if (!chunkGraph.canChunksBeIntegrated(a, combination.b)) { + combination.deleted = true; + combinations.delete(combination); + continue; + } + // Update size + const newIntegratedSize = chunkGraph.getIntegratedChunksSize( + a, + combination.b, + options + ); + const finishUpdate = combinations.startUpdate(combination); + combination.a = a; + combination.integratedSize = newIntegratedSize; + combination.aSize = integratedSize; + combination.sizeDiff = + combination.bSize + integratedSize - newIntegratedSize; + finishUpdate(); + } else if (combination.b === b) { + if (!chunkGraph.canChunksBeIntegrated(combination.a, a)) { + combination.deleted = true; + combinations.delete(combination); + continue; + } + // Update size + const newIntegratedSize = chunkGraph.getIntegratedChunksSize( + combination.a, + a, + options + ); + + const finishUpdate = combinations.startUpdate(combination); + combination.b = a; + combination.integratedSize = newIntegratedSize; + combination.bSize = integratedSize; + combination.sizeDiff = + integratedSize + combination.aSize - newIntegratedSize; + finishUpdate(); + } + } + combinationsByChunk.set(a, combinationsByChunk.get(b)); + combinationsByChunk.delete(b); + } + } + if (changed) return true; + } + ); + }); } } - -module.exports = ReadFileChunkLoadingRuntimeModule; +module.exports = LimitChunkCountPlugin; /***/ }), -/***/ 73163: +/***/ 27868: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -106145,16 +103051,145 @@ module.exports = ReadFileChunkLoadingRuntimeModule; -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const AsyncWasmLoadingRuntimeModule = __webpack_require__(5434); +const { UsageState } = __webpack_require__(63686); +const { + numberToIdentifier, + NUMBER_OF_IDENTIFIER_START_CHARS, + NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS +} = __webpack_require__(1626); +const { assignDeterministicIds } = __webpack_require__(63290); +const { compareSelect, compareStringsNumeric } = __webpack_require__(29579); /** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../ExportsInfo")} ExportsInfo */ +/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */ -class ReadFileCompileAsyncWasmPlugin { - constructor({ type = "async-node", import: useImport = false } = {}) { - this._type = type; - this._import = useImport; +/** + * @param {ExportsInfo} exportsInfo exports info + * @returns {boolean} mangle is possible + */ +const canMangle = exportsInfo => { + if (exportsInfo.otherExportsInfo.getUsed(undefined) !== UsageState.Unused) + return false; + let hasSomethingToMangle = false; + for (const exportInfo of exportsInfo.exports) { + if (exportInfo.canMangle === true) { + hasSomethingToMangle = true; + } + } + return hasSomethingToMangle; +}; + +// Sort by name +const comparator = compareSelect(e => e.name, compareStringsNumeric); +/** + * @param {boolean} deterministic use deterministic names + * @param {ExportsInfo} exportsInfo exports info + * @param {boolean} isNamespace is namespace object + * @returns {void} + */ +const mangleExportsInfo = (deterministic, exportsInfo, isNamespace) => { + if (!canMangle(exportsInfo)) return; + const usedNames = new Set(); + /** @type {ExportInfo[]} */ + const mangleableExports = []; + + // Avoid to renamed exports that are not provided when + // 1. it's not a namespace export: non-provided exports can be found in prototype chain + // 2. there are other provided exports and deterministic mode is chosen: + // non-provided exports would break the determinism + let avoidMangleNonProvided = !isNamespace; + if (!avoidMangleNonProvided && deterministic) { + for (const exportInfo of exportsInfo.ownedExports) { + if (exportInfo.provided !== false) { + avoidMangleNonProvided = true; + break; + } + } + } + for (const exportInfo of exportsInfo.ownedExports) { + const name = exportInfo.name; + if (!exportInfo.hasUsedName()) { + if ( + // Can the export be mangled? + exportInfo.canMangle !== true || + // Never rename 1 char exports + (name.length === 1 && /^[a-zA-Z0-9_$]/.test(name)) || + // Don't rename 2 char exports in deterministic mode + (deterministic && + name.length === 2 && + /^[a-zA-Z_$][a-zA-Z0-9_$]|^[1-9][0-9]/.test(name)) || + // Don't rename exports that are not provided + (avoidMangleNonProvided && exportInfo.provided !== true) + ) { + exportInfo.setUsedName(name); + usedNames.add(name); + } else { + mangleableExports.push(exportInfo); + } + } + if (exportInfo.exportsInfoOwned) { + const used = exportInfo.getUsed(undefined); + if ( + used === UsageState.OnlyPropertiesUsed || + used === UsageState.Unused + ) { + mangleExportsInfo(deterministic, exportInfo.exportsInfo, false); + } + } + } + if (deterministic) { + assignDeterministicIds( + mangleableExports, + e => e.name, + comparator, + (e, id) => { + const name = numberToIdentifier(id); + const size = usedNames.size; + usedNames.add(name); + if (size === usedNames.size) return false; + e.setUsedName(name); + return true; + }, + [ + NUMBER_OF_IDENTIFIER_START_CHARS, + NUMBER_OF_IDENTIFIER_START_CHARS * + NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS + ], + NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS, + usedNames.size + ); + } else { + const usedExports = []; + const unusedExports = []; + for (const exportInfo of mangleableExports) { + if (exportInfo.getUsed(undefined) === UsageState.Unused) { + unusedExports.push(exportInfo); + } else { + usedExports.push(exportInfo); + } + } + usedExports.sort(comparator); + unusedExports.sort(comparator); + let i = 0; + for (const list of [usedExports, unusedExports]) { + for (const exportInfo of list) { + let name; + do { + name = numberToIdentifier(i++); + } while (usedNames.has(name)); + exportInfo.setUsedName(name); + } + } + } +}; + +class MangleExportsPlugin { + /** + * @param {boolean} deterministic use deterministic names + */ + constructor(deterministic) { + this._deterministic = deterministic; } /** * Apply the plugin @@ -106162,94 +103197,158 @@ class ReadFileCompileAsyncWasmPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap( - "ReadFileCompileAsyncWasmPlugin", - compilation => { - const globalWasmLoading = compilation.outputOptions.wasmLoading; - const isEnabledForChunk = chunk => { - const options = chunk.getEntryOptions(); - const wasmLoading = - options && options.wasmLoading !== undefined - ? options.wasmLoading - : globalWasmLoading; - return wasmLoading === this._type; - }; - const generateLoadBinaryCode = this._import - ? path => - Template.asString([ - "Promise.all([import('fs'), import('url')]).then(([{ readFile }, { URL }]) => new Promise((resolve, reject) => {", - Template.indent([ - `readFile(new URL(${path}, import.meta.url), (err, buffer) => {`, - Template.indent([ - "if (err) return reject(err);", - "", - "// Fake fetch response", - "resolve({", - Template.indent(["arrayBuffer() { return buffer; }"]), - "});" - ]), - "});" - ]), - "}))" - ]) - : path => - Template.asString([ - "new Promise(function (resolve, reject) {", - Template.indent([ - "try {", - Template.indent([ - "var { readFile } = require('fs');", - "var { join } = require('path');", - "", - `readFile(join(__dirname, ${path}), function(err, buffer){`, - Template.indent([ - "if (err) return reject(err);", - "", - "// Fake fetch response", - "resolve({", - Template.indent(["arrayBuffer() { return buffer; }"]), - "});" - ]), - "});" - ]), - "} catch (err) { reject(err); }" - ]), - "})" - ]); + const { _deterministic: deterministic } = this; + compiler.hooks.compilation.tap("MangleExportsPlugin", compilation => { + const moduleGraph = compilation.moduleGraph; + compilation.hooks.optimizeCodeGeneration.tap( + "MangleExportsPlugin", + modules => { + if (compilation.moduleMemCaches) { + throw new Error( + "optimization.mangleExports can't be used with cacheUnaffected as export mangling is a global effect" + ); + } + for (const module of modules) { + const isNamespace = + module.buildMeta && module.buildMeta.exportsType === "namespace"; + const exportsInfo = moduleGraph.getExportsInfo(module); + mangleExportsInfo(deterministic, exportsInfo, isNamespace); + } + } + ); + }); + } +} - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.instantiateWasm) - .tap("ReadFileCompileAsyncWasmPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - const chunkGraph = compilation.chunkGraph; - if ( - !chunkGraph.hasModuleInGraph( - chunk, - m => m.type === "webassembly/async" - ) - ) { - return; +module.exports = MangleExportsPlugin; + + +/***/ }), + +/***/ 85067: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { STAGE_BASIC } = __webpack_require__(80057); +const { runtimeEqual } = __webpack_require__(17156); + +/** @typedef {import("../Compiler")} Compiler */ + +class MergeDuplicateChunksPlugin { + /** + * @param {Compiler} compiler the compiler + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "MergeDuplicateChunksPlugin", + compilation => { + compilation.hooks.optimizeChunks.tap( + { + name: "MergeDuplicateChunksPlugin", + stage: STAGE_BASIC + }, + chunks => { + const { chunkGraph, moduleGraph } = compilation; + + // remember already tested chunks for performance + const notDuplicates = new Set(); + + // for each chunk + for (const chunk of chunks) { + // track a Set of all chunk that could be duplicates + let possibleDuplicates; + for (const module of chunkGraph.getChunkModulesIterable(chunk)) { + if (possibleDuplicates === undefined) { + // when possibleDuplicates is not yet set, + // create a new Set from chunks of the current module + // including only chunks with the same number of modules + for (const dup of chunkGraph.getModuleChunksIterable( + module + )) { + if ( + dup !== chunk && + chunkGraph.getNumberOfChunkModules(chunk) === + chunkGraph.getNumberOfChunkModules(dup) && + !notDuplicates.has(dup) + ) { + // delay allocating the new Set until here, reduce memory pressure + if (possibleDuplicates === undefined) { + possibleDuplicates = new Set(); + } + possibleDuplicates.add(dup); + } + } + // when no chunk is possible we can break here + if (possibleDuplicates === undefined) break; + } else { + // validate existing possible duplicates + for (const dup of possibleDuplicates) { + // remove possible duplicate when module is not contained + if (!chunkGraph.isModuleInChunk(module, dup)) { + possibleDuplicates.delete(dup); + } + } + // when all chunks has been removed we can break here + if (possibleDuplicates.size === 0) break; + } + } + + // when we found duplicates + if ( + possibleDuplicates !== undefined && + possibleDuplicates.size > 0 + ) { + outer: for (const otherChunk of possibleDuplicates) { + if (otherChunk.hasRuntime() !== chunk.hasRuntime()) continue; + if (chunkGraph.getNumberOfEntryModules(chunk) > 0) continue; + if (chunkGraph.getNumberOfEntryModules(otherChunk) > 0) + continue; + if (!runtimeEqual(chunk.runtime, otherChunk.runtime)) { + for (const module of chunkGraph.getChunkModulesIterable( + chunk + )) { + const exportsInfo = moduleGraph.getExportsInfo(module); + if ( + !exportsInfo.isEquallyUsed( + chunk.runtime, + otherChunk.runtime + ) + ) { + continue outer; + } + } + } + // merge them + if (chunkGraph.canChunksBeIntegrated(chunk, otherChunk)) { + chunkGraph.integrateChunks(chunk, otherChunk); + compilation.chunks.delete(otherChunk); + } + } + } + + // don't check already processed chunks twice + notDuplicates.add(chunk); } - set.add(RuntimeGlobals.publicPath); - compilation.addRuntimeModule( - chunk, - new AsyncWasmLoadingRuntimeModule({ - generateLoadBinaryCode, - supportsStreaming: false - }) - ); - }); + } + ); } ); } } - -module.exports = ReadFileCompileAsyncWasmPlugin; +module.exports = MergeDuplicateChunksPlugin; /***/ }), -/***/ 98939: +/***/ 53912: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -106260,17 +103359,29 @@ module.exports = ReadFileCompileAsyncWasmPlugin; -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const WasmChunkLoadingRuntimeModule = __webpack_require__(87394); +const { STAGE_ADVANCED } = __webpack_require__(80057); +const createSchemaValidation = __webpack_require__(32540); +/** @typedef {import("../../declarations/plugins/optimize/MinChunkSizePlugin").MinChunkSizePluginOptions} MinChunkSizePluginOptions */ +/** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../Compiler")} Compiler */ -// TODO webpack 6 remove +const validate = createSchemaValidation( + __webpack_require__(60135), + () => __webpack_require__(53850), + { + name: "Min Chunk Size Plugin", + baseDataPath: "options" + } +); -class ReadFileCompileWasmPlugin { +class MinChunkSizePlugin { + /** + * @param {MinChunkSizePluginOptions} options options object + */ constructor(options) { - this.options = options || {}; + validate(options); + this.options = options; } /** @@ -106279,897 +103390,998 @@ class ReadFileCompileWasmPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap( - "ReadFileCompileWasmPlugin", - compilation => { - const globalWasmLoading = compilation.outputOptions.wasmLoading; - const isEnabledForChunk = chunk => { - const options = chunk.getEntryOptions(); - const wasmLoading = - options && options.wasmLoading !== undefined - ? options.wasmLoading - : globalWasmLoading; - return wasmLoading === "async-node"; - }; - const generateLoadBinaryCode = path => - Template.asString([ - "new Promise(function (resolve, reject) {", - Template.indent([ - "var { readFile } = require('fs');", - "var { join } = require('path');", - "", - "try {", - Template.indent([ - `readFile(join(__dirname, ${path}), function(err, buffer){`, - Template.indent([ - "if (err) return reject(err);", - "", - "// Fake fetch response", - "resolve({", - Template.indent(["arrayBuffer() { return buffer; }"]), - "});" - ]), - "});" - ]), - "} catch (err) { reject(err); }" - ]), - "})" - ]); + const options = this.options; + const minChunkSize = options.minChunkSize; + compiler.hooks.compilation.tap("MinChunkSizePlugin", compilation => { + compilation.hooks.optimizeChunks.tap( + { + name: "MinChunkSizePlugin", + stage: STAGE_ADVANCED + }, + chunks => { + const chunkGraph = compilation.chunkGraph; + const equalOptions = { + chunkOverhead: 1, + entryChunkMultiplicator: 1 + }; - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("ReadFileCompileWasmPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - const chunkGraph = compilation.chunkGraph; - if ( - !chunkGraph.hasModuleInGraph( - chunk, - m => m.type === "webassembly/sync" - ) - ) { - return; + const chunkSizesMap = new Map(); + /** @type {[Chunk, Chunk][]} */ + const combinations = []; + /** @type {Chunk[]} */ + const smallChunks = []; + const visitedChunks = []; + for (const a of chunks) { + // check if one of the chunks sizes is smaller than the minChunkSize + // and filter pairs that can NOT be integrated! + if (chunkGraph.getChunkSize(a, equalOptions) < minChunkSize) { + smallChunks.push(a); + for (const b of visitedChunks) { + if (chunkGraph.canChunksBeIntegrated(b, a)) + combinations.push([b, a]); + } + } else { + for (const b of smallChunks) { + if (chunkGraph.canChunksBeIntegrated(b, a)) + combinations.push([b, a]); + } } - set.add(RuntimeGlobals.moduleCache); - compilation.addRuntimeModule( - chunk, - new WasmChunkLoadingRuntimeModule({ - generateLoadBinaryCode, - supportsStreaming: false, - mangleImports: this.options.mangleImports, - runtimeRequirements: set - }) - ); - }); - } + chunkSizesMap.set(a, chunkGraph.getChunkSize(a, options)); + visitedChunks.push(a); + } + + const sortedSizeFilteredExtendedPairCombinations = combinations + .map(pair => { + // extend combination pairs with size and integrated size + const a = chunkSizesMap.get(pair[0]); + const b = chunkSizesMap.get(pair[1]); + const ab = chunkGraph.getIntegratedChunksSize( + pair[0], + pair[1], + options + ); + /** @type {[number, number, Chunk, Chunk]} */ + const extendedPair = [a + b - ab, ab, pair[0], pair[1]]; + return extendedPair; + }) + .sort((a, b) => { + // sadly javascript does an in place sort here + // sort by size + const diff = b[0] - a[0]; + if (diff !== 0) return diff; + return a[1] - b[1]; + }); + + if (sortedSizeFilteredExtendedPairCombinations.length === 0) return; + + const pair = sortedSizeFilteredExtendedPairCombinations[0]; + + chunkGraph.integrateChunks(pair[2], pair[3]); + compilation.chunks.delete(pair[3]); + return true; + } + ); + }); + } +} +module.exports = MinChunkSizePlugin; + + +/***/ }), + +/***/ 85305: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const SizeFormatHelpers = __webpack_require__(71070); +const WebpackError = __webpack_require__(53799); + +class MinMaxSizeWarning extends WebpackError { + constructor(keys, minSize, maxSize) { + let keysMessage = "Fallback cache group"; + if (keys) { + keysMessage = + keys.length > 1 + ? `Cache groups ${keys.sort().join(", ")}` + : `Cache group ${keys[0]}`; + } + super( + `SplitChunksPlugin\n` + + `${keysMessage}\n` + + `Configured minSize (${SizeFormatHelpers.formatSize(minSize)}) is ` + + `bigger than maxSize (${SizeFormatHelpers.formatSize(maxSize)}).\n` + + "This seem to be a invalid optimization.splitChunks configuration." ); } } -module.exports = ReadFileCompileWasmPlugin; +module.exports = MinMaxSizeWarning; /***/ }), -/***/ 94172: +/***/ 74844: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); +const asyncLib = __webpack_require__(78175); +const ChunkGraph = __webpack_require__(64971); +const ModuleGraph = __webpack_require__(99988); +const { STAGE_DEFAULT } = __webpack_require__(80057); +const HarmonyImportDependency = __webpack_require__(57154); +const { compareModulesByIdentifier } = __webpack_require__(29579); const { - chunkHasJs, - getChunkFilenameTemplate -} = __webpack_require__(89464); -const { getInitialChunkIds } = __webpack_require__(98124); -const compileBooleanMatcher = __webpack_require__(29404); -const { getUndoPath } = __webpack_require__(82186); + intersectRuntime, + mergeRuntimeOwned, + filterRuntime, + runtimeToString, + mergeRuntime +} = __webpack_require__(17156); +const ConcatenatedModule = __webpack_require__(97198); -class RequireChunkLoadingRuntimeModule extends RuntimeModule { - constructor(runtimeRequirements) { - super("require chunk loading", RuntimeModule.STAGE_ATTACH); - this.runtimeRequirements = runtimeRequirements; +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + +/** + * @typedef {Object} Statistics + * @property {number} cached + * @property {number} alreadyInConfig + * @property {number} invalidModule + * @property {number} incorrectChunks + * @property {number} incorrectDependency + * @property {number} incorrectModuleDependency + * @property {number} incorrectChunksOfImporter + * @property {number} incorrectRuntimeCondition + * @property {number} importerFailed + * @property {number} added + */ + +const formatBailoutReason = msg => { + return "ModuleConcatenation bailout: " + msg; +}; + +class ModuleConcatenationPlugin { + constructor(options) { + if (typeof options !== "object") options = {}; + this.options = options; } /** - * @returns {string} runtime code + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - generate() { - const { chunkGraph, chunk } = this; - const { runtimeTemplate } = this.compilation; - const fn = RuntimeGlobals.ensureChunkHandlers; - const withBaseURI = this.runtimeRequirements.has(RuntimeGlobals.baseURI); - const withExternalInstallChunk = this.runtimeRequirements.has( - RuntimeGlobals.externalInstallChunk - ); - const withOnChunkLoad = this.runtimeRequirements.has( - RuntimeGlobals.onChunksLoaded - ); - const withLoading = this.runtimeRequirements.has( - RuntimeGlobals.ensureChunkHandlers - ); - const withHmr = this.runtimeRequirements.has( - RuntimeGlobals.hmrDownloadUpdateHandlers - ); - const withHmrManifest = this.runtimeRequirements.has( - RuntimeGlobals.hmrDownloadManifest - ); - const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs); - const hasJsMatcher = compileBooleanMatcher(conditionMap); - const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); + apply(compiler) { + const { _backCompat: backCompat } = compiler; + compiler.hooks.compilation.tap("ModuleConcatenationPlugin", compilation => { + const moduleGraph = compilation.moduleGraph; + const bailoutReasonMap = new Map(); - const outputName = this.compilation.getPath( - getChunkFilenameTemplate(chunk, this.compilation.outputOptions), - { - chunk, - contentHashType: "javascript" - } - ); - const rootOutputDir = getUndoPath( - outputName, - this.compilation.outputOptions.path, - true - ); + const setBailoutReason = (module, reason) => { + setInnerBailoutReason(module, reason); + moduleGraph + .getOptimizationBailout(module) + .push( + typeof reason === "function" + ? rs => formatBailoutReason(reason(rs)) + : formatBailoutReason(reason) + ); + }; - const stateExpression = withHmr - ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_require` - : undefined; - - return Template.asString([ - withBaseURI - ? Template.asString([ - `${RuntimeGlobals.baseURI} = require("url").pathToFileURL(${ - rootOutputDir !== "./" - ? `__dirname + ${JSON.stringify("/" + rootOutputDir)}` - : "__filename" - });` - ]) - : "// no baseURI", - "", - "// object to store loaded chunks", - '// "1" means "loaded", otherwise not loaded yet', - `var installedChunks = ${ - stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" - }{`, - Template.indent( - Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 1`).join( - ",\n" - ) - ), - "};", - "", - withOnChunkLoad - ? `${ - RuntimeGlobals.onChunksLoaded - }.require = ${runtimeTemplate.returningFunction( - "installedChunks[chunkId]", - "chunkId" - )};` - : "// no on chunks loaded", - "", - withLoading || withExternalInstallChunk - ? `var installChunk = ${runtimeTemplate.basicFunction("chunk", [ - "var moreModules = chunk.modules, chunkIds = chunk.ids, runtime = chunk.runtime;", - "for(var moduleId in moreModules) {", - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, - Template.indent([ - `${RuntimeGlobals.moduleFactories}[moduleId] = moreModules[moduleId];` - ]), - "}" - ]), - "}", - `if(runtime) runtime(__webpack_require__);`, - "for(var i = 0; i < chunkIds.length; i++)", - Template.indent("installedChunks[chunkIds[i]] = 1;"), - withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : "" - ])};` - : "// no chunk install function needed", - "", - withLoading - ? Template.asString([ - "// require() chunk loading for javascript", - `${fn}.require = ${runtimeTemplate.basicFunction( - "chunkId, promises", - hasJsMatcher !== false - ? [ - '// "1" is the signal for "already loaded"', - "if(!installedChunks[chunkId]) {", - Template.indent([ - hasJsMatcher === true - ? "if(true) { // all chunks have JS" - : `if(${hasJsMatcher("chunkId")}) {`, - Template.indent([ - `installChunk(require(${JSON.stringify( - rootOutputDir - )} + ${ - RuntimeGlobals.getChunkScriptFilename - }(chunkId)));` - ]), - "} else installedChunks[chunkId] = 1;", - "" - ]), - "}" - ] - : "installedChunks[chunkId] = 1;" - )};` - ]) - : "// no chunk loading", - "", - withExternalInstallChunk - ? Template.asString([ - "module.exports = __webpack_require__;", - `${RuntimeGlobals.externalInstallChunk} = installChunk;` - ]) - : "// no external install chunk", - "", - withHmr - ? Template.asString([ - "function loadUpdateChunk(chunkId, updatedModulesList) {", - Template.indent([ - `var update = require(${JSON.stringify(rootOutputDir)} + ${ - RuntimeGlobals.getChunkUpdateScriptFilename - }(chunkId));`, - "var updatedModules = update.modules;", - "var runtime = update.runtime;", - "for(var moduleId in updatedModules) {", - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(updatedModules, moduleId)) {`, - Template.indent([ - `currentUpdate[moduleId] = updatedModules[moduleId];`, - "if(updatedModulesList) updatedModulesList.push(moduleId);" - ]), - "}" - ]), - "}", - "if(runtime) currentUpdateRuntime.push(runtime);" - ]), - "}", - "", - Template.getFunctionContent( - require('./JavascriptHotModuleReplacement.runtime.js') - ) - .replace(/\$key\$/g, "require") - .replace(/\$installedChunks\$/g, "installedChunks") - .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") - .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) - .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) - .replace( - /\$ensureChunkHandlers\$/g, - RuntimeGlobals.ensureChunkHandlers - ) - .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) - .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) - .replace( - /\$hmrDownloadUpdateHandlers\$/g, - RuntimeGlobals.hmrDownloadUpdateHandlers - ) - .replace( - /\$hmrInvalidateModuleHandlers\$/g, - RuntimeGlobals.hmrInvalidateModuleHandlers - ) - ]) - : "// no HMR", - "", - withHmrManifest - ? Template.asString([ - `${RuntimeGlobals.hmrDownloadManifest} = function() {`, - Template.indent([ - "return Promise.resolve().then(function() {", - Template.indent([ - `return require(${JSON.stringify(rootOutputDir)} + ${ - RuntimeGlobals.getUpdateManifestFilename - }());` - ]), - "})['catch'](function(err) { if(err.code !== 'MODULE_NOT_FOUND') throw err; });" - ]), - "}" - ]) - : "// no HMR manifest" - ]); - } -} - -module.exports = RequireChunkLoadingRuntimeModule; - - -/***/ }), - -/***/ 91786: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const setInnerBailoutReason = (module, reason) => { + bailoutReasonMap.set(module, reason); + }; + const getInnerBailoutReason = (module, requestShortener) => { + const reason = bailoutReasonMap.get(module); + if (typeof reason === "function") return reason(requestShortener); + return reason; + }; + const formatBailoutWarning = (module, problem) => requestShortener => { + if (typeof problem === "function") { + return formatBailoutReason( + `Cannot concat with ${module.readableIdentifier( + requestShortener + )}: ${problem(requestShortener)}` + ); + } + const reason = getInnerBailoutReason(module, requestShortener); + const reasonWithPrefix = reason ? `: ${reason}` : ""; + if (module === problem) { + return formatBailoutReason( + `Cannot concat with ${module.readableIdentifier( + requestShortener + )}${reasonWithPrefix}` + ); + } else { + return formatBailoutReason( + `Cannot concat with ${module.readableIdentifier( + requestShortener + )} because of ${problem.readableIdentifier( + requestShortener + )}${reasonWithPrefix}` + ); + } + }; -const util = __webpack_require__(73837); -const truncateArgs = __webpack_require__(62090); + compilation.hooks.optimizeChunkModules.tapAsync( + { + name: "ModuleConcatenationPlugin", + stage: STAGE_DEFAULT + }, + (allChunks, modules, callback) => { + const logger = compilation.getLogger( + "webpack.ModuleConcatenationPlugin" + ); + const { chunkGraph, moduleGraph } = compilation; + const relevantModules = []; + const possibleInners = new Set(); + const context = { + chunkGraph, + moduleGraph + }; + logger.time("select relevant modules"); + for (const module of modules) { + let canBeRoot = true; + let canBeInner = true; -module.exports = ({ colors, appendOnly, stream }) => { - let currentStatusMessage = undefined; - let hasStatusMessage = false; - let currentIndent = ""; - let currentCollapsed = 0; + const bailoutReason = module.getConcatenationBailoutReason(context); + if (bailoutReason) { + setBailoutReason(module, bailoutReason); + continue; + } - const indent = (str, prefix, colorPrefix, colorSuffix) => { - if (str === "") return str; - prefix = currentIndent + prefix; - if (colors) { - return ( - prefix + - colorPrefix + - str.replace(/\n/g, colorSuffix + "\n" + prefix + colorPrefix) + - colorSuffix - ); - } else { - return prefix + str.replace(/\n/g, "\n" + prefix); - } - }; + // Must not be an async module + if (moduleGraph.isAsync(module)) { + setBailoutReason(module, `Module is async`); + continue; + } - const clearStatusMessage = () => { - if (hasStatusMessage) { - stream.write("\x1b[2K\r"); - hasStatusMessage = false; - } - }; + // Must be in strict mode + if (!module.buildInfo.strict) { + setBailoutReason(module, `Module is not in strict mode`); + continue; + } - const writeStatusMessage = () => { - if (!currentStatusMessage) return; - const l = stream.columns; - const args = l - ? truncateArgs(currentStatusMessage, l - 1) - : currentStatusMessage; - const str = args.join(" "); - const coloredStr = `\u001b[1m${str}\u001b[39m\u001b[22m`; - stream.write(`\x1b[2K\r${coloredStr}`); - hasStatusMessage = true; - }; + // Module must be in any chunk (we don't want to do useless work) + if (chunkGraph.getNumberOfModuleChunks(module) === 0) { + setBailoutReason(module, "Module is not in any chunk"); + continue; + } - const writeColored = (prefix, colorPrefix, colorSuffix) => { - return (...args) => { - if (currentCollapsed > 0) return; - clearStatusMessage(); - const str = indent( - util.format(...args), - prefix, - colorPrefix, - colorSuffix - ); - stream.write(str + "\n"); - writeStatusMessage(); - }; - }; + // Exports must be known (and not dynamic) + const exportsInfo = moduleGraph.getExportsInfo(module); + const relevantExports = exportsInfo.getRelevantExports(undefined); + const unknownReexports = relevantExports.filter(exportInfo => { + return ( + exportInfo.isReexport() && !exportInfo.getTarget(moduleGraph) + ); + }); + if (unknownReexports.length > 0) { + setBailoutReason( + module, + `Reexports in this module do not have a static target (${Array.from( + unknownReexports, + exportInfo => + `${ + exportInfo.name || "other exports" + }: ${exportInfo.getUsedInfo()}` + ).join(", ")})` + ); + continue; + } - const writeGroupMessage = writeColored( - "<-> ", - "\u001b[1m\u001b[36m", - "\u001b[39m\u001b[22m" - ); + // Root modules must have a static list of exports + const unknownProvidedExports = relevantExports.filter( + exportInfo => { + return exportInfo.provided !== true; + } + ); + if (unknownProvidedExports.length > 0) { + setBailoutReason( + module, + `List of module exports is dynamic (${Array.from( + unknownProvidedExports, + exportInfo => + `${ + exportInfo.name || "other exports" + }: ${exportInfo.getProvidedInfo()} and ${exportInfo.getUsedInfo()}` + ).join(", ")})` + ); + canBeRoot = false; + } - const writeGroupCollapsedMessage = writeColored( - "<+> ", - "\u001b[1m\u001b[36m", - "\u001b[39m\u001b[22m" - ); + // Module must not be an entry point + if (chunkGraph.isEntryModule(module)) { + setInnerBailoutReason(module, "Module is an entry point"); + canBeInner = false; + } - return { - log: writeColored(" ", "\u001b[1m", "\u001b[22m"), - debug: writeColored(" ", "", ""), - trace: writeColored(" ", "", ""), - info: writeColored(" ", "\u001b[1m\u001b[32m", "\u001b[39m\u001b[22m"), - warn: writeColored(" ", "\u001b[1m\u001b[33m", "\u001b[39m\u001b[22m"), - error: writeColored(" ", "\u001b[1m\u001b[31m", "\u001b[39m\u001b[22m"), - logTime: writeColored( - " ", - "\u001b[1m\u001b[35m", - "\u001b[39m\u001b[22m" - ), - group: (...args) => { - writeGroupMessage(...args); - if (currentCollapsed > 0) { - currentCollapsed++; - } else { - currentIndent += " "; - } - }, - groupCollapsed: (...args) => { - writeGroupCollapsedMessage(...args); - currentCollapsed++; - }, - groupEnd: () => { - if (currentCollapsed > 0) currentCollapsed--; - else if (currentIndent.length >= 2) - currentIndent = currentIndent.slice(0, currentIndent.length - 2); - }, - // eslint-disable-next-line node/no-unsupported-features/node-builtins - profile: console.profile && (name => console.profile(name)), - // eslint-disable-next-line node/no-unsupported-features/node-builtins - profileEnd: console.profileEnd && (name => console.profileEnd(name)), - clear: - !appendOnly && - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.clear && - (() => { - clearStatusMessage(); - // eslint-disable-next-line node/no-unsupported-features/node-builtins - console.clear(); - writeStatusMessage(); - }), - status: appendOnly - ? writeColored(" ", "", "") - : (name, ...args) => { - args = args.filter(Boolean); - if (name === undefined && args.length === 0) { - clearStatusMessage(); - currentStatusMessage = undefined; - } else if ( - typeof name === "string" && - name.startsWith("[webpack.Progress] ") - ) { - currentStatusMessage = [name.slice(19), ...args]; - writeStatusMessage(); - } else if (name === "[webpack.Progress]") { - currentStatusMessage = [...args]; - writeStatusMessage(); - } else { - currentStatusMessage = [name, ...args]; - writeStatusMessage(); + if (canBeRoot) relevantModules.push(module); + if (canBeInner) possibleInners.add(module); } - } - }; -}; - - -/***/ }), - -/***/ 64395: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + logger.timeEnd("select relevant modules"); + logger.debug( + `${relevantModules.length} potential root modules, ${possibleInners.size} potential inner modules` + ); + // sort by depth + // modules with lower depth are more likely suited as roots + // this improves performance, because modules already selected as inner are skipped + logger.time("sort relevant modules"); + relevantModules.sort((a, b) => { + return moduleGraph.getDepth(a) - moduleGraph.getDepth(b); + }); + logger.timeEnd("sort relevant modules"); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** @type {Statistics} */ + const stats = { + cached: 0, + alreadyInConfig: 0, + invalidModule: 0, + incorrectChunks: 0, + incorrectDependency: 0, + incorrectModuleDependency: 0, + incorrectChunksOfImporter: 0, + incorrectRuntimeCondition: 0, + importerFailed: 0, + added: 0 + }; + let statsCandidates = 0; + let statsSizeSum = 0; + let statsEmptyConfigurations = 0; + logger.time("find modules to concatenate"); + const concatConfigurations = []; + const usedAsInner = new Set(); + for (const currentRoot of relevantModules) { + // when used by another configuration as inner: + // the other configuration is better and we can skip this one + // TODO reconsider that when it's only used in a different runtime + if (usedAsInner.has(currentRoot)) continue; + let chunkRuntime = undefined; + for (const r of chunkGraph.getModuleRuntimes(currentRoot)) { + chunkRuntime = mergeRuntimeOwned(chunkRuntime, r); + } + const exportsInfo = moduleGraph.getExportsInfo(currentRoot); + const filteredRuntime = filterRuntime(chunkRuntime, r => + exportsInfo.isModuleUsed(r) + ); + const activeRuntime = + filteredRuntime === true + ? chunkRuntime + : filteredRuntime === false + ? undefined + : filteredRuntime; -const { STAGE_ADVANCED } = __webpack_require__(80057); + // create a configuration with the root + const currentConfiguration = new ConcatConfiguration( + currentRoot, + activeRuntime + ); -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ + // cache failures to add modules + const failureCache = new Map(); -class AggressiveMergingPlugin { - constructor(options) { - if ( - (options !== undefined && typeof options !== "object") || - Array.isArray(options) - ) { - throw new Error( - "Argument should be an options object. To use defaults, pass in nothing.\nFor more info on options, see https://webpack.js.org/plugins/" - ); - } - this.options = options || {}; - } + // potential optional import candidates + /** @type {Set} */ + const candidates = new Set(); - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const options = this.options; - const minSizeReduce = options.minSizeReduce || 1.5; + // try to add all imports + for (const imp of this._getImports( + compilation, + currentRoot, + activeRuntime + )) { + candidates.add(imp); + } - compiler.hooks.thisCompilation.tap( - "AggressiveMergingPlugin", - compilation => { - compilation.hooks.optimizeChunks.tap( - { - name: "AggressiveMergingPlugin", - stage: STAGE_ADVANCED - }, - chunks => { - const chunkGraph = compilation.chunkGraph; - /** @type {{a: Chunk, b: Chunk, improvement: number}[]} */ - let combinations = []; - for (const a of chunks) { - if (a.canBeInitial()) continue; - for (const b of chunks) { - if (b.canBeInitial()) continue; - if (b === a) break; - if (!chunkGraph.canChunksBeIntegrated(a, b)) { - continue; + for (const imp of candidates) { + const impCandidates = new Set(); + const problem = this._tryToAdd( + compilation, + currentConfiguration, + imp, + chunkRuntime, + activeRuntime, + possibleInners, + impCandidates, + failureCache, + chunkGraph, + true, + stats + ); + if (problem) { + failureCache.set(imp, problem); + currentConfiguration.addWarning(imp, problem); + } else { + for (const c of impCandidates) { + candidates.add(c); } - const aSize = chunkGraph.getChunkSize(b, { - chunkOverhead: 0 - }); - const bSize = chunkGraph.getChunkSize(a, { - chunkOverhead: 0 - }); - const abSize = chunkGraph.getIntegratedChunksSize(b, a, { - chunkOverhead: 0 - }); - const improvement = (aSize + bSize) / abSize; - combinations.push({ - a, - b, - improvement - }); } } - - combinations.sort((a, b) => { - return b.improvement - a.improvement; - }); - - const pair = combinations[0]; - - if (!pair) return; - if (pair.improvement < minSizeReduce) return; - - chunkGraph.integrateChunks(pair.b, pair.a); - compilation.chunks.delete(pair.a); - return true; + statsCandidates += candidates.size; + if (!currentConfiguration.isEmpty()) { + const modules = currentConfiguration.getModules(); + statsSizeSum += modules.size; + concatConfigurations.push(currentConfiguration); + for (const module of modules) { + if (module !== currentConfiguration.rootModule) { + usedAsInner.add(module); + } + } + } else { + statsEmptyConfigurations++; + const optimizationBailouts = + moduleGraph.getOptimizationBailout(currentRoot); + for (const warning of currentConfiguration.getWarningsSorted()) { + optimizationBailouts.push( + formatBailoutWarning(warning[0], warning[1]) + ); + } + } } - ); - } - ); - } -} - -module.exports = AggressiveMergingPlugin; + logger.timeEnd("find modules to concatenate"); + logger.debug( + `${ + concatConfigurations.length + } successful concat configurations (avg size: ${ + statsSizeSum / concatConfigurations.length + }), ${statsEmptyConfigurations} bailed out completely` + ); + logger.debug( + `${statsCandidates} candidates were considered for adding (${stats.cached} cached failure, ${stats.alreadyInConfig} already in config, ${stats.invalidModule} invalid module, ${stats.incorrectChunks} incorrect chunks, ${stats.incorrectDependency} incorrect dependency, ${stats.incorrectChunksOfImporter} incorrect chunks of importer, ${stats.incorrectModuleDependency} incorrect module dependency, ${stats.incorrectRuntimeCondition} incorrect runtime condition, ${stats.importerFailed} importer failed, ${stats.added} added)` + ); + // HACK: Sort configurations by length and start with the longest one + // to get the biggest groups possible. Used modules are marked with usedModules + // TODO: Allow to reuse existing configuration while trying to add dependencies. + // This would improve performance. O(n^2) -> O(n) + logger.time(`sort concat configurations`); + concatConfigurations.sort((a, b) => { + return b.modules.size - a.modules.size; + }); + logger.timeEnd(`sort concat configurations`); + const usedModules = new Set(); + logger.time("create concatenated modules"); + asyncLib.each( + concatConfigurations, + (concatConfiguration, callback) => { + const rootModule = concatConfiguration.rootModule; -/***/ }), + // Avoid overlapping configurations + // TODO: remove this when todo above is fixed + if (usedModules.has(rootModule)) return callback(); + const modules = concatConfiguration.getModules(); + for (const m of modules) { + usedModules.add(m); + } -/***/ 15543: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Create a new ConcatenatedModule + let newModule = ConcatenatedModule.create( + rootModule, + modules, + concatConfiguration.runtime, + compiler.root, + compilation.outputOptions.hashFunction + ); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const build = () => { + newModule.build( + compiler.options, + compilation, + null, + null, + err => { + if (err) { + if (!err.module) { + err.module = newModule; + } + return callback(err); + } + integrate(); + } + ); + }; + const integrate = () => { + if (backCompat) { + ChunkGraph.setChunkGraphForModule(newModule, chunkGraph); + ModuleGraph.setModuleGraphForModule(newModule, moduleGraph); + } + for (const warning of concatConfiguration.getWarningsSorted()) { + moduleGraph + .getOptimizationBailout(newModule) + .push(formatBailoutWarning(warning[0], warning[1])); + } + moduleGraph.cloneModuleAttributes(rootModule, newModule); + for (const m of modules) { + // add to builtModules when one of the included modules was built + if (compilation.builtModules.has(m)) { + compilation.builtModules.add(newModule); + } + if (m !== rootModule) { + // attach external references to the concatenated module too + moduleGraph.copyOutgoingModuleConnections( + m, + newModule, + c => { + return ( + c.originModule === m && + !( + c.dependency instanceof HarmonyImportDependency && + modules.has(c.module) + ) + ); + } + ); + // remove module from chunk + for (const chunk of chunkGraph.getModuleChunksIterable( + rootModule + )) { + chunkGraph.disconnectChunkAndModule(chunk, m); + } + } + } + compilation.modules.delete(rootModule); + ChunkGraph.clearChunkGraphForModule(rootModule); + ModuleGraph.clearModuleGraphForModule(rootModule); -const { STAGE_ADVANCED } = __webpack_require__(80057); -const { intersect } = __webpack_require__(93347); -const { - compareModulesByIdentifier, - compareChunks -} = __webpack_require__(29579); -const createSchemaValidation = __webpack_require__(32540); -const identifierUtils = __webpack_require__(82186); + // remove module from chunk + chunkGraph.replaceModule(rootModule, newModule); + // replace module references with the concatenated module + moduleGraph.moveModuleConnections(rootModule, newModule, c => { + const otherModule = + c.module === rootModule ? c.originModule : c.module; + const innerConnection = + c.dependency instanceof HarmonyImportDependency && + modules.has(otherModule); + return !innerConnection; + }); + // add concatenated module to the compilation + compilation.modules.add(newModule); -/** @typedef {import("../../declarations/plugins/optimize/AggressiveSplittingPlugin").AggressiveSplittingPluginOptions} AggressiveSplittingPluginOptions */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ + callback(); + }; -const validate = createSchemaValidation( - __webpack_require__(32697), - () => - __webpack_require__(47995), - { - name: "Aggressive Splitting Plugin", - baseDataPath: "options" + build(); + }, + err => { + logger.timeEnd("create concatenated modules"); + process.nextTick(callback.bind(null, err)); + } + ); + } + ); + }); } -); - -const moveModuleBetween = (chunkGraph, oldChunk, newChunk) => { - return module => { - chunkGraph.disconnectChunkAndModule(oldChunk, module); - chunkGraph.connectChunkAndModule(newChunk, module); - }; -}; - -/** - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {Chunk} chunk the chunk - * @returns {function(Module): boolean} filter for entry module - */ -const isNotAEntryModule = (chunkGraph, chunk) => { - return module => { - return !chunkGraph.isEntryModuleInChunk(module, chunk); - }; -}; - -/** @type {WeakSet} */ -const recordedChunks = new WeakSet(); -class AggressiveSplittingPlugin { /** - * @param {AggressiveSplittingPluginOptions=} options options object + * @param {Compilation} compilation the compilation + * @param {Module} module the module to be added + * @param {RuntimeSpec} runtime the runtime scope + * @returns {Set} the imported modules */ - constructor(options = {}) { - validate(options); + _getImports(compilation, module, runtime) { + const moduleGraph = compilation.moduleGraph; + const set = new Set(); + for (const dep of module.dependencies) { + // Get reference info only for harmony Dependencies + if (!(dep instanceof HarmonyImportDependency)) continue; - this.options = options; - if (typeof this.options.minSize !== "number") { - this.options.minSize = 30 * 1024; - } - if (typeof this.options.maxSize !== "number") { - this.options.maxSize = 50 * 1024; - } - if (typeof this.options.chunkOverhead !== "number") { - this.options.chunkOverhead = 0; - } - if (typeof this.options.entryChunkMultiplicator !== "number") { - this.options.entryChunkMultiplicator = 1; - } - } + const connection = moduleGraph.getConnection(dep); + // Reference is valid and has a module + if ( + !connection || + !connection.module || + !connection.isTargetActive(runtime) + ) { + continue; + } - /** - * @param {Chunk} chunk the chunk to test - * @returns {boolean} true if the chunk was recorded - */ - static wasChunkRecorded(chunk) { - return recordedChunks.has(chunk); + const importedNames = compilation.getDependencyReferencedExports( + dep, + undefined + ); + + if ( + importedNames.every(i => + Array.isArray(i) ? i.length > 0 : i.name.length > 0 + ) || + Array.isArray(moduleGraph.getProvidedExports(module)) + ) { + set.add(connection.module); + } + } + return set; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {Compilation} compilation webpack compilation + * @param {ConcatConfiguration} config concat configuration (will be modified when added) + * @param {Module} module the module to be added + * @param {RuntimeSpec} runtime the runtime scope of the generated code + * @param {RuntimeSpec} activeRuntime the runtime scope of the root module + * @param {Set} possibleModules modules that are candidates + * @param {Set} candidates list of potential candidates (will be added to) + * @param {Map} failureCache cache for problematic modules to be more performant + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {boolean} avoidMutateOnFailure avoid mutating the config when adding fails + * @param {Statistics} statistics gathering metrics + * @returns {Module | function(RequestShortener): string} the problematic module */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - "AggressiveSplittingPlugin", - compilation => { - let needAdditionalSeal = false; - let newSplits; - let fromAggressiveSplittingSet; - let chunkSplitDataMap; - compilation.hooks.optimize.tap("AggressiveSplittingPlugin", () => { - newSplits = []; - fromAggressiveSplittingSet = new Set(); - chunkSplitDataMap = new Map(); - }); - compilation.hooks.optimizeChunks.tap( - { - name: "AggressiveSplittingPlugin", - stage: STAGE_ADVANCED - }, - chunks => { - const chunkGraph = compilation.chunkGraph; - // Precompute stuff - const nameToModuleMap = new Map(); - const moduleToNameMap = new Map(); - const makePathsRelative = - identifierUtils.makePathsRelative.bindContextCache( - compiler.context, - compiler.root - ); - for (const m of compilation.modules) { - const name = makePathsRelative(m.identifier()); - nameToModuleMap.set(name, m); - moduleToNameMap.set(m, name); - } + _tryToAdd( + compilation, + config, + module, + runtime, + activeRuntime, + possibleModules, + candidates, + failureCache, + chunkGraph, + avoidMutateOnFailure, + statistics + ) { + const cacheEntry = failureCache.get(module); + if (cacheEntry) { + statistics.cached++; + return cacheEntry; + } - // Check used chunk ids - const usedIds = new Set(); - for (const chunk of chunks) { - usedIds.add(chunk.id); - } + // Already added? + if (config.has(module)) { + statistics.alreadyInConfig++; + return null; + } - const recordedSplits = - (compilation.records && compilation.records.aggressiveSplits) || - []; - const usedSplits = newSplits - ? recordedSplits.concat(newSplits) - : recordedSplits; + // Not possible to add? + if (!possibleModules.has(module)) { + statistics.invalidModule++; + failureCache.set(module, module); // cache failures for performance + return module; + } - const minSize = this.options.minSize; - const maxSize = this.options.maxSize; + // Module must be in the correct chunks + const missingChunks = Array.from( + chunkGraph.getModuleChunksIterable(config.rootModule) + ).filter(chunk => !chunkGraph.isModuleInChunk(module, chunk)); + if (missingChunks.length > 0) { + const problem = requestShortener => { + const missingChunksList = Array.from( + new Set(missingChunks.map(chunk => chunk.name || "unnamed chunk(s)")) + ).sort(); + const chunks = Array.from( + new Set( + Array.from(chunkGraph.getModuleChunksIterable(module)).map( + chunk => chunk.name || "unnamed chunk(s)" + ) + ) + ).sort(); + return `Module ${module.readableIdentifier( + requestShortener + )} is not in the same chunk(s) (expected in chunk(s) ${missingChunksList.join( + ", " + )}, module is in chunk(s) ${chunks.join(", ")})`; + }; + statistics.incorrectChunks++; + failureCache.set(module, problem); // cache failures for performance + return problem; + } - const applySplit = splitData => { - // Cannot split if id is already taken - if (splitData.id !== undefined && usedIds.has(splitData.id)) { - return false; - } + const moduleGraph = compilation.moduleGraph; - // Get module objects from names - const selectedModules = splitData.modules.map(name => - nameToModuleMap.get(name) - ); + const incomingConnections = + moduleGraph.getIncomingConnectionsByOriginModule(module); - // Does the modules exist at all? - if (!selectedModules.every(Boolean)) return false; + const incomingConnectionsFromNonModules = + incomingConnections.get(null) || incomingConnections.get(undefined); + if (incomingConnectionsFromNonModules) { + const activeNonModulesConnections = + incomingConnectionsFromNonModules.filter(connection => { + // We are not interested in inactive connections + // or connections without dependency + return connection.isActive(runtime) || connection.dependency; + }); + if (activeNonModulesConnections.length > 0) { + const problem = requestShortener => { + const importingExplanations = new Set( + activeNonModulesConnections.map(c => c.explanation).filter(Boolean) + ); + const explanations = Array.from(importingExplanations).sort(); + return `Module ${module.readableIdentifier( + requestShortener + )} is referenced ${ + explanations.length > 0 + ? `by: ${explanations.join(", ")}` + : "in an unsupported way" + }`; + }; + statistics.incorrectDependency++; + failureCache.set(module, problem); // cache failures for performance + return problem; + } + } - // Check if size matches (faster than waiting for hash) - let size = 0; - for (const m of selectedModules) size += m.size(); - if (size !== splitData.size) return false; + /** @type {Map} */ + const incomingConnectionsFromModules = new Map(); + for (const [originModule, connections] of incomingConnections) { + if (originModule) { + // Ignore connection from orphan modules + if (chunkGraph.getNumberOfModuleChunks(originModule) === 0) continue; - // get chunks with all modules - const selectedChunks = intersect( - selectedModules.map( - m => new Set(chunkGraph.getModuleChunksIterable(m)) - ) - ); + // We don't care for connections from other runtimes + let originRuntime = undefined; + for (const r of chunkGraph.getModuleRuntimes(originModule)) { + originRuntime = mergeRuntimeOwned(originRuntime, r); + } - // No relevant chunks found - if (selectedChunks.size === 0) return false; + if (!intersectRuntime(runtime, originRuntime)) continue; - // The found chunk is already the split or similar - if ( - selectedChunks.size === 1 && - chunkGraph.getNumberOfChunkModules( - Array.from(selectedChunks)[0] - ) === selectedModules.length - ) { - const chunk = Array.from(selectedChunks)[0]; - if (fromAggressiveSplittingSet.has(chunk)) return false; - fromAggressiveSplittingSet.add(chunk); - chunkSplitDataMap.set(chunk, splitData); - return true; - } - - // split the chunk into two parts - const newChunk = compilation.addChunk(); - newChunk.chunkReason = "aggressive splitted"; - for (const chunk of selectedChunks) { - selectedModules.forEach( - moveModuleBetween(chunkGraph, chunk, newChunk) - ); - chunk.split(newChunk); - chunk.name = null; - } - fromAggressiveSplittingSet.add(newChunk); - chunkSplitDataMap.set(newChunk, splitData); + // We are not interested in inactive connections + const activeConnections = connections.filter(connection => + connection.isActive(runtime) + ); + if (activeConnections.length > 0) + incomingConnectionsFromModules.set(originModule, activeConnections); + } + } - if (splitData.id !== null && splitData.id !== undefined) { - newChunk.id = splitData.id; - newChunk.ids = [splitData.id]; - } - return true; - }; + const incomingModules = Array.from(incomingConnectionsFromModules.keys()); - // try to restore to recorded splitting - let changed = false; - for (let j = 0; j < usedSplits.length; j++) { - const splitData = usedSplits[j]; - if (applySplit(splitData)) changed = true; - } + // Module must be in the same chunks like the referencing module + const otherChunkModules = incomingModules.filter(originModule => { + for (const chunk of chunkGraph.getModuleChunksIterable( + config.rootModule + )) { + if (!chunkGraph.isModuleInChunk(originModule, chunk)) { + return true; + } + } + return false; + }); + if (otherChunkModules.length > 0) { + const problem = requestShortener => { + const names = otherChunkModules + .map(m => m.readableIdentifier(requestShortener)) + .sort(); + return `Module ${module.readableIdentifier( + requestShortener + )} is referenced from different chunks by these modules: ${names.join( + ", " + )}`; + }; + statistics.incorrectChunksOfImporter++; + failureCache.set(module, problem); // cache failures for performance + return problem; + } - // for any chunk which isn't splitted yet, split it and create a new entry - // start with the biggest chunk - const cmpFn = compareChunks(chunkGraph); - const sortedChunks = Array.from(chunks).sort((a, b) => { - const diff1 = - chunkGraph.getChunkModulesSize(b) - - chunkGraph.getChunkModulesSize(a); - if (diff1) return diff1; - const diff2 = - chunkGraph.getNumberOfChunkModules(a) - - chunkGraph.getNumberOfChunkModules(b); - if (diff2) return diff2; - return cmpFn(a, b); - }); - for (const chunk of sortedChunks) { - if (fromAggressiveSplittingSet.has(chunk)) continue; - const size = chunkGraph.getChunkModulesSize(chunk); - if ( - size > maxSize && - chunkGraph.getNumberOfChunkModules(chunk) > 1 - ) { - const modules = chunkGraph - .getOrderedChunkModules(chunk, compareModulesByIdentifier) - .filter(isNotAEntryModule(chunkGraph, chunk)); - const selectedModules = []; - let selectedModulesSize = 0; - for (let k = 0; k < modules.length; k++) { - const module = modules[k]; - const newSize = selectedModulesSize + module.size(); - if (newSize > maxSize && selectedModulesSize >= minSize) { - break; - } - selectedModulesSize = newSize; - selectedModules.push(module); - } - if (selectedModules.length === 0) continue; - const splitData = { - modules: selectedModules - .map(m => moduleToNameMap.get(m)) - .sort(), - size: selectedModulesSize - }; + /** @type {Map} */ + const nonHarmonyConnections = new Map(); + for (const [originModule, connections] of incomingConnectionsFromModules) { + const selected = connections.filter( + connection => + !connection.dependency || + !(connection.dependency instanceof HarmonyImportDependency) + ); + if (selected.length > 0) + nonHarmonyConnections.set(originModule, connections); + } + if (nonHarmonyConnections.size > 0) { + const problem = requestShortener => { + const names = Array.from(nonHarmonyConnections) + .map(([originModule, connections]) => { + return `${originModule.readableIdentifier( + requestShortener + )} (referenced with ${Array.from( + new Set( + connections + .map(c => c.dependency && c.dependency.type) + .filter(Boolean) + ) + ) + .sort() + .join(", ")})`; + }) + .sort(); + return `Module ${module.readableIdentifier( + requestShortener + )} is referenced from these modules with unsupported syntax: ${names.join( + ", " + )}`; + }; + statistics.incorrectModuleDependency++; + failureCache.set(module, problem); // cache failures for performance + return problem; + } - if (applySplit(splitData)) { - newSplits = (newSplits || []).concat(splitData); - changed = true; - } - } - } - if (changed) return true; + if (runtime !== undefined && typeof runtime !== "string") { + // Module must be consistently referenced in the same runtimes + /** @type {{ originModule: Module, runtimeCondition: RuntimeSpec }[]} */ + const otherRuntimeConnections = []; + outer: for (const [ + originModule, + connections + ] of incomingConnectionsFromModules) { + /** @type {false | RuntimeSpec} */ + let currentRuntimeCondition = false; + for (const connection of connections) { + const runtimeCondition = filterRuntime(runtime, runtime => { + return connection.isTargetActive(runtime); + }); + if (runtimeCondition === false) continue; + if (runtimeCondition === true) continue outer; + if (currentRuntimeCondition !== false) { + currentRuntimeCondition = mergeRuntime( + currentRuntimeCondition, + runtimeCondition + ); + } else { + currentRuntimeCondition = runtimeCondition; } - ); - compilation.hooks.recordHash.tap( - "AggressiveSplittingPlugin", - records => { - // 4. save made splittings to records - const allSplits = new Set(); - const invalidSplits = new Set(); - - // Check if some splittings are invalid - // We remove invalid splittings and try again - for (const chunk of compilation.chunks) { - const splitData = chunkSplitDataMap.get(chunk); - if (splitData !== undefined) { - if (splitData.hash && chunk.hash !== splitData.hash) { - // Split was successful, but hash doesn't equal - // We can throw away the split since it's useless now - invalidSplits.add(splitData); - } - } - } + } + if (currentRuntimeCondition !== false) { + otherRuntimeConnections.push({ + originModule, + runtimeCondition: currentRuntimeCondition + }); + } + } + if (otherRuntimeConnections.length > 0) { + const problem = requestShortener => { + return `Module ${module.readableIdentifier( + requestShortener + )} is runtime-dependent referenced by these modules: ${Array.from( + otherRuntimeConnections, + ({ originModule, runtimeCondition }) => + `${originModule.readableIdentifier( + requestShortener + )} (expected runtime ${runtimeToString( + runtime + )}, module is only referenced in ${runtimeToString( + /** @type {RuntimeSpec} */ (runtimeCondition) + )})` + ).join(", ")}`; + }; + statistics.incorrectRuntimeCondition++; + failureCache.set(module, problem); // cache failures for performance + return problem; + } + } - if (invalidSplits.size > 0) { - records.aggressiveSplits = records.aggressiveSplits.filter( - splitData => !invalidSplits.has(splitData) - ); - needAdditionalSeal = true; - } else { - // set hash and id values on all (new) splittings - for (const chunk of compilation.chunks) { - const splitData = chunkSplitDataMap.get(chunk); - if (splitData !== undefined) { - splitData.hash = chunk.hash; - splitData.id = chunk.id; - allSplits.add(splitData); - // set flag for stats - recordedChunks.add(chunk); - } - } + let backup; + if (avoidMutateOnFailure) { + backup = config.snapshot(); + } - // Also add all unused historical splits (after the used ones) - // They can still be used in some future compilation - const recordedSplits = - compilation.records && compilation.records.aggressiveSplits; - if (recordedSplits) { - for (const splitData of recordedSplits) { - if (!invalidSplits.has(splitData)) allSplits.add(splitData); - } - } + // Add the module + config.add(module); - // record all splits - records.aggressiveSplits = Array.from(allSplits); + incomingModules.sort(compareModulesByIdentifier); - needAdditionalSeal = false; - } - } - ); - compilation.hooks.needAdditionalSeal.tap( - "AggressiveSplittingPlugin", - () => { - if (needAdditionalSeal) { - needAdditionalSeal = false; - return true; - } - } - ); + // Every module which depends on the added module must be in the configuration too. + for (const originModule of incomingModules) { + const problem = this._tryToAdd( + compilation, + config, + originModule, + runtime, + activeRuntime, + possibleModules, + candidates, + failureCache, + chunkGraph, + false, + statistics + ); + if (problem) { + if (backup !== undefined) config.rollback(backup); + statistics.importerFailed++; + failureCache.set(module, problem); // cache failures for performance + return problem; } + } + + // Add imports to possible candidates list + for (const imp of this._getImports(compilation, module, runtime)) { + candidates.add(imp); + } + statistics.added++; + return null; + } +} + +class ConcatConfiguration { + /** + * @param {Module} rootModule the root module + * @param {RuntimeSpec} runtime the runtime + */ + constructor(rootModule, runtime) { + this.rootModule = rootModule; + this.runtime = runtime; + /** @type {Set} */ + this.modules = new Set(); + this.modules.add(rootModule); + /** @type {Map} */ + this.warnings = new Map(); + } + + add(module) { + this.modules.add(module); + } + + has(module) { + return this.modules.has(module); + } + + isEmpty() { + return this.modules.size === 1; + } + + addWarning(module, problem) { + this.warnings.set(module, problem); + } + + getWarningsSorted() { + return new Map( + Array.from(this.warnings).sort((a, b) => { + const ai = a[0].identifier(); + const bi = b[0].identifier(); + if (ai < bi) return -1; + if (ai > bi) return 1; + return 0; + }) ); } + + /** + * @returns {Set} modules as set + */ + getModules() { + return this.modules; + } + + snapshot() { + return this.modules.size; + } + + rollback(snapshot) { + const modules = this.modules; + for (const m of modules) { + if (snapshot === 0) { + modules.delete(m); + } else { + snapshot--; + } + } + } } -module.exports = AggressiveSplittingPlugin; + +module.exports = ModuleConcatenationPlugin; /***/ }), -/***/ 97198: +/***/ 46043: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -107180,3437 +104392,2901 @@ module.exports = AggressiveSplittingPlugin; -const eslintScope = __webpack_require__(36007); -const Referencer = __webpack_require__(44585); -const { - CachedSource, - ConcatSource, - ReplaceSource -} = __webpack_require__(51255); -const ConcatenationScope = __webpack_require__(98229); -const { UsageState } = __webpack_require__(63686); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const HarmonyImportDependency = __webpack_require__(57154); -const JavascriptParser = __webpack_require__(29050); -const { equals } = __webpack_require__(84953); -const LazySet = __webpack_require__(38938); -const { concatComparators, keepOriginalOrder } = __webpack_require__(29579); +const { SyncBailHook } = __webpack_require__(6967); +const { RawSource, CachedSource, CompatSource } = __webpack_require__(51255); +const Compilation = __webpack_require__(85720); +const WebpackError = __webpack_require__(53799); +const { compareSelect, compareStrings } = __webpack_require__(29579); const createHash = __webpack_require__(49835); -const { makePathsRelative } = __webpack_require__(82186); -const makeSerializable = __webpack_require__(33032); -const propertyAccess = __webpack_require__(54190); -const { - filterRuntime, - intersectRuntime, - mergeRuntimeCondition, - mergeRuntimeConditionNonFalse, - runtimeConditionToString, - subtractRuntimeCondition -} = __webpack_require__(17156); -/** @typedef {import("eslint-scope").Scope} Scope */ /** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../CodeGenerationResults")} CodeGenerationResults */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */ -/** @template T @typedef {import("../InitFragment")} InitFragment */ -/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {typeof import("../util/Hash")} HashConstructor */ -/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - -// fix eslint-scope to support class properties correctly -// cspell:word Referencer -const ReferencerClass = Referencer; -if (!ReferencerClass.prototype.PropertyDefinition) { - ReferencerClass.prototype.PropertyDefinition = - ReferencerClass.prototype.Property; -} +/** @typedef {import("../Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("../Compiler")} Compiler */ -/** - * @typedef {Object} ReexportInfo - * @property {Module} module - * @property {string[]} export - */ +const EMPTY_SET = new Set(); -/** @typedef {RawBinding | SymbolBinding} Binding */ +const addToList = (itemOrItems, list) => { + if (Array.isArray(itemOrItems)) { + for (const item of itemOrItems) { + list.add(item); + } + } else if (itemOrItems) { + list.add(itemOrItems); + } +}; /** - * @typedef {Object} RawBinding - * @property {ModuleInfo} info - * @property {string} rawName - * @property {string=} comment - * @property {string[]} ids - * @property {string[]} exportName + * @template T + * @param {T[]} input list + * @param {function(T): Buffer} fn map function + * @returns {Buffer[]} buffers without duplicates */ +const mapAndDeduplicateBuffers = (input, fn) => { + // Buffer.equals compares size first so this should be efficient enough + // If it becomes a performance problem we can use a map and group by size + // instead of looping over all assets. + const result = []; + outer: for (const value of input) { + const buf = fn(value); + for (const other of result) { + if (buf.equals(other)) continue outer; + } + result.push(buf); + } + return result; +}; /** - * @typedef {Object} SymbolBinding - * @property {ConcatenatedModuleInfo} info - * @property {string} name - * @property {string=} comment - * @property {string[]} ids - * @property {string[]} exportName + * Escapes regular expression metacharacters + * @param {string} str String to quote + * @returns {string} Escaped string */ +const quoteMeta = str => { + return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); +}; -/** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo } ModuleInfo */ -/** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo | ReferenceToModuleInfo } ModuleInfoOrReference */ +const cachedSourceMap = new WeakMap(); + +const toCachedSource = source => { + if (source instanceof CachedSource) { + return source; + } + const entry = cachedSourceMap.get(source); + if (entry !== undefined) return entry; + const newSource = new CachedSource(CompatSource.from(source)); + cachedSourceMap.set(source, newSource); + return newSource; +}; /** - * @typedef {Object} ConcatenatedModuleInfo - * @property {"concatenated"} type - * @property {Module} module - * @property {number} index - * @property {Object} ast - * @property {Source} internalSource - * @property {ReplaceSource} source - * @property {InitFragment[]=} chunkInitFragments - * @property {Iterable} runtimeRequirements - * @property {Scope} globalScope - * @property {Scope} moduleScope - * @property {Map} internalNames - * @property {Map} exportMap - * @property {Map} rawExportMap - * @property {string=} namespaceExportSymbol - * @property {string} namespaceObjectName - * @property {boolean} interopNamespaceObjectUsed - * @property {string} interopNamespaceObjectName - * @property {boolean} interopNamespaceObject2Used - * @property {string} interopNamespaceObject2Name - * @property {boolean} interopDefaultAccessUsed - * @property {string} interopDefaultAccessName - */ - -/** - * @typedef {Object} ExternalModuleInfo - * @property {"external"} type - * @property {Module} module - * @property {RuntimeSpec | boolean} runtimeCondition - * @property {number} index + * @typedef {Object} AssetInfoForRealContentHash * @property {string} name - * @property {boolean} interopNamespaceObjectUsed - * @property {string} interopNamespaceObjectName - * @property {boolean} interopNamespaceObject2Used - * @property {string} interopNamespaceObject2Name - * @property {boolean} interopDefaultAccessUsed - * @property {string} interopDefaultAccessName + * @property {AssetInfo} info + * @property {Source} source + * @property {RawSource | undefined} newSource + * @property {RawSource | undefined} newSourceWithoutOwn + * @property {string} content + * @property {Set} ownHashes + * @property {Promise} contentComputePromise + * @property {Promise} contentComputeWithoutOwnPromise + * @property {Set} referencedHashes + * @property {Set} hashes */ /** - * @typedef {Object} ReferenceToModuleInfo - * @property {"reference"} type - * @property {RuntimeSpec | boolean} runtimeCondition - * @property {ConcatenatedModuleInfo | ExternalModuleInfo} target + * @typedef {Object} CompilationHooks + * @property {SyncBailHook<[Buffer[], string], string>} updateHash */ -const RESERVED_NAMES = new Set( - [ - // internal names (should always be renamed) - ConcatenationScope.DEFAULT_EXPORT, - ConcatenationScope.NAMESPACE_OBJECT_EXPORT, - - // keywords - "abstract,arguments,async,await,boolean,break,byte,case,catch,char,class,const,continue", - "debugger,default,delete,do,double,else,enum,eval,export,extends,false,final,finally,float", - "for,function,goto,if,implements,import,in,instanceof,int,interface,let,long,native,new,null", - "package,private,protected,public,return,short,static,super,switch,synchronized,this,throw", - "throws,transient,true,try,typeof,var,void,volatile,while,with,yield", - - // commonjs/amd - "module,__dirname,__filename,exports,require,define", - - // js globals - "Array,Date,eval,function,hasOwnProperty,Infinity,isFinite,isNaN,isPrototypeOf,length,Math", - "NaN,name,Number,Object,prototype,String,toString,undefined,valueOf", - - // browser globals - "alert,all,anchor,anchors,area,assign,blur,button,checkbox,clearInterval,clearTimeout", - "clientInformation,close,closed,confirm,constructor,crypto,decodeURI,decodeURIComponent", - "defaultStatus,document,element,elements,embed,embeds,encodeURI,encodeURIComponent,escape", - "event,fileUpload,focus,form,forms,frame,innerHeight,innerWidth,layer,layers,link,location", - "mimeTypes,navigate,navigator,frames,frameRate,hidden,history,image,images,offscreenBuffering", - "open,opener,option,outerHeight,outerWidth,packages,pageXOffset,pageYOffset,parent,parseFloat", - "parseInt,password,pkcs11,plugin,prompt,propertyIsEnum,radio,reset,screenX,screenY,scroll", - "secure,select,self,setInterval,setTimeout,status,submit,taint,text,textarea,top,unescape", - "untaint,window", - - // window events - "onblur,onclick,onerror,onfocus,onkeydown,onkeypress,onkeyup,onmouseover,onload,onmouseup,onmousedown,onsubmit" - ] - .join(",") - .split(",") -); +/** @type {WeakMap} */ +const compilationHooksMap = new WeakMap(); -const bySourceOrder = (a, b) => { - const aOrder = a.sourceOrder; - const bOrder = b.sourceOrder; - if (isNaN(aOrder)) { - if (!isNaN(bOrder)) { - return 1; - } - } else { - if (isNaN(bOrder)) { - return -1; +class RealContentHashPlugin { + /** + * @param {Compilation} compilation the compilation + * @returns {CompilationHooks} the attached hooks + */ + static getCompilationHooks(compilation) { + if (!(compilation instanceof Compilation)) { + throw new TypeError( + "The 'compilation' argument must be an instance of Compilation" + ); } - if (aOrder !== bOrder) { - return aOrder < bOrder ? -1 : 1; + let hooks = compilationHooksMap.get(compilation); + if (hooks === undefined) { + hooks = { + updateHash: new SyncBailHook(["content", "oldHash"]) + }; + compilationHooksMap.set(compilation, hooks); } + return hooks; } - return 0; -}; -const joinIterableWithComma = iterable => { - // This is more performant than Array.from().join(", ") - // as it doesn't create an array - let str = ""; - let first = true; - for (const item of iterable) { - if (first) { - first = false; - } else { - str += ", "; - } - str += item; + constructor({ hashFunction, hashDigest }) { + this._hashFunction = hashFunction; + this._hashDigest = hashDigest; } - return str; -}; - -/** - * @typedef {Object} ConcatenationEntry - * @property {"concatenated" | "external"} type - * @property {Module} module - * @property {RuntimeSpec | boolean} runtimeCondition - */ -/** - * @param {ModuleGraph} moduleGraph the module graph - * @param {ModuleInfo} info module info - * @param {string[]} exportName exportName - * @param {Map} moduleToInfoMap moduleToInfoMap - * @param {RuntimeSpec} runtime for which runtime - * @param {RequestShortener} requestShortener the request shortener - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @param {Set} neededNamespaceObjects modules for which a namespace object should be generated - * @param {boolean} asCall asCall - * @param {boolean} strictHarmonyModule strictHarmonyModule - * @param {boolean | undefined} asiSafe asiSafe - * @param {Set} alreadyVisited alreadyVisited - * @returns {Binding} the final variable - */ -const getFinalBinding = ( - moduleGraph, - info, - exportName, - moduleToInfoMap, - runtime, - requestShortener, - runtimeTemplate, - neededNamespaceObjects, - asCall, - strictHarmonyModule, - asiSafe, - alreadyVisited = new Set() -) => { - const exportsType = info.module.getExportsType( - moduleGraph, - strictHarmonyModule - ); - if (exportName.length === 0) { - switch (exportsType) { - case "default-only": - info.interopNamespaceObject2Used = true; - return { - info, - rawName: info.interopNamespaceObject2Name, - ids: exportName, - exportName - }; - case "default-with-named": - info.interopNamespaceObjectUsed = true; - return { - info, - rawName: info.interopNamespaceObjectName, - ids: exportName, - exportName - }; - case "namespace": - case "dynamic": - break; - default: - throw new Error(`Unexpected exportsType ${exportsType}`); - } - } else { - switch (exportsType) { - case "namespace": - break; - case "default-with-named": - switch (exportName[0]) { - case "default": - exportName = exportName.slice(1); - break; - case "__esModule": - return { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap("RealContentHashPlugin", compilation => { + const cacheAnalyse = compilation.getCache( + "RealContentHashPlugin|analyse" + ); + const cacheGenerate = compilation.getCache( + "RealContentHashPlugin|generate" + ); + const hooks = RealContentHashPlugin.getCompilationHooks(compilation); + compilation.hooks.processAssets.tapPromise( + { + name: "RealContentHashPlugin", + stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH + }, + async () => { + const assets = compilation.getAssets(); + /** @type {AssetInfoForRealContentHash[]} */ + const assetsWithInfo = []; + const hashToAssets = new Map(); + for (const { source, info, name } of assets) { + const cachedSource = toCachedSource(source); + const content = cachedSource.source(); + /** @type {Set} */ + const hashes = new Set(); + addToList(info.contenthash, hashes); + const data = { + name, info, - rawName: "/* __esModule */true", - ids: exportName.slice(1), - exportName + source: cachedSource, + /** @type {RawSource | undefined} */ + newSource: undefined, + /** @type {RawSource | undefined} */ + newSourceWithoutOwn: undefined, + content, + /** @type {Set} */ + ownHashes: undefined, + contentComputePromise: undefined, + contentComputeWithoutOwnPromise: undefined, + /** @type {Set} */ + referencedHashes: undefined, + hashes }; - } - break; - case "default-only": { - const exportId = exportName[0]; - if (exportId === "__esModule") { - return { - info, - rawName: "/* __esModule */true", - ids: exportName.slice(1), - exportName + assetsWithInfo.push(data); + for (const hash of hashes) { + const list = hashToAssets.get(hash); + if (list === undefined) { + hashToAssets.set(hash, [data]); + } else { + list.push(data); + } + } + } + if (hashToAssets.size === 0) return; + const hashRegExp = new RegExp( + Array.from(hashToAssets.keys(), quoteMeta).join("|"), + "g" + ); + await Promise.all( + assetsWithInfo.map(async asset => { + const { name, source, content, hashes } = asset; + if (Buffer.isBuffer(content)) { + asset.referencedHashes = EMPTY_SET; + asset.ownHashes = EMPTY_SET; + return; + } + const etag = cacheAnalyse.mergeEtags( + cacheAnalyse.getLazyHashedEtag(source), + Array.from(hashes).join("|") + ); + [asset.referencedHashes, asset.ownHashes] = + await cacheAnalyse.providePromise(name, etag, () => { + const referencedHashes = new Set(); + let ownHashes = new Set(); + const inContent = content.match(hashRegExp); + if (inContent) { + for (const hash of inContent) { + if (hashes.has(hash)) { + ownHashes.add(hash); + continue; + } + referencedHashes.add(hash); + } + } + return [referencedHashes, ownHashes]; + }); + }) + ); + const getDependencies = hash => { + const assets = hashToAssets.get(hash); + if (!assets) { + const referencingAssets = assetsWithInfo.filter(asset => + asset.referencedHashes.has(hash) + ); + const err = new WebpackError(`RealContentHashPlugin +Some kind of unexpected caching problem occurred. +An asset was cached with a reference to another asset (${hash}) that's not in the compilation anymore. +Either the asset was incorrectly cached, or the referenced asset should also be restored from cache. +Referenced by: +${referencingAssets + .map(a => { + const match = new RegExp(`.{0,20}${quoteMeta(hash)}.{0,20}`).exec( + a.content + ); + return ` - ${a.name}: ...${match ? match[0] : "???"}...`; + }) + .join("\n")}`); + compilation.errors.push(err); + return undefined; + } + const hashes = new Set(); + for (const { referencedHashes, ownHashes } of assets) { + if (!ownHashes.has(hash)) { + for (const hash of ownHashes) { + hashes.add(hash); + } + } + for (const hash of referencedHashes) { + hashes.add(hash); + } + } + return hashes; }; - } - exportName = exportName.slice(1); - if (exportId !== "default") { - return { - info, - rawName: - "/* non-default import from default-exporting module */undefined", - ids: exportName, - exportName + const hashInfo = hash => { + const assets = hashToAssets.get(hash); + return `${hash} (${Array.from(assets, a => a.name)})`; }; - } - break; - } - case "dynamic": - switch (exportName[0]) { - case "default": { - exportName = exportName.slice(1); - info.interopDefaultAccessUsed = true; - const defaultExport = asCall - ? `${info.interopDefaultAccessName}()` - : asiSafe - ? `(${info.interopDefaultAccessName}())` - : asiSafe === false - ? `;(${info.interopDefaultAccessName}())` - : `${info.interopDefaultAccessName}.a`; - return { - info, - rawName: defaultExport, - ids: exportName, - exportName + const hashesInOrder = new Set(); + for (const hash of hashToAssets.keys()) { + const add = (hash, stack) => { + const deps = getDependencies(hash); + if (!deps) return; + stack.add(hash); + for (const dep of deps) { + if (hashesInOrder.has(dep)) continue; + if (stack.has(dep)) { + throw new Error( + `Circular hash dependency ${Array.from( + stack, + hashInfo + ).join(" -> ")} -> ${hashInfo(dep)}` + ); + } + add(dep, stack); + } + hashesInOrder.add(hash); + stack.delete(hash); }; + if (hashesInOrder.has(hash)) continue; + add(hash, new Set()); } - case "__esModule": - return { - info, - rawName: "/* __esModule */true", - ids: exportName.slice(1), - exportName - }; - } - break; - default: - throw new Error(`Unexpected exportsType ${exportsType}`); - } - } - if (exportName.length === 0) { - switch (info.type) { - case "concatenated": - neededNamespaceObjects.add(info); - return { - info, - rawName: info.namespaceObjectName, - ids: exportName, - exportName - }; - case "external": - return { info, rawName: info.name, ids: exportName, exportName }; - } - } - const exportsInfo = moduleGraph.getExportsInfo(info.module); - const exportInfo = exportsInfo.getExportInfo(exportName[0]); - if (alreadyVisited.has(exportInfo)) { - return { - info, - rawName: "/* circular reexport */ Object(function x() { x() }())", - ids: [], - exportName - }; - } - alreadyVisited.add(exportInfo); - switch (info.type) { - case "concatenated": { - const exportId = exportName[0]; - if (exportInfo.provided === false) { - // It's not provided, but it could be on the prototype - neededNamespaceObjects.add(info); - return { - info, - rawName: info.namespaceObjectName, - ids: exportName, - exportName - }; - } - const directExport = info.exportMap && info.exportMap.get(exportId); - if (directExport) { - const usedName = /** @type {string[]} */ ( - exportsInfo.getUsedName(exportName, runtime) - ); - if (!usedName) { - return { - info, - rawName: "/* unused export */ undefined", - ids: exportName.slice(1), - exportName + const hashToNewHash = new Map(); + const getEtag = asset => + cacheGenerate.mergeEtags( + cacheGenerate.getLazyHashedEtag(asset.source), + Array.from(asset.referencedHashes, hash => + hashToNewHash.get(hash) + ).join("|") + ); + const computeNewContent = asset => { + if (asset.contentComputePromise) return asset.contentComputePromise; + return (asset.contentComputePromise = (async () => { + if ( + asset.ownHashes.size > 0 || + Array.from(asset.referencedHashes).some( + hash => hashToNewHash.get(hash) !== hash + ) + ) { + const identifier = asset.name; + const etag = getEtag(asset); + asset.newSource = await cacheGenerate.providePromise( + identifier, + etag, + () => { + const newContent = asset.content.replace(hashRegExp, hash => + hashToNewHash.get(hash) + ); + return new RawSource(newContent); + } + ); + } + })()); }; - } - return { - info, - name: directExport, - ids: usedName.slice(1), - exportName - }; - } - const rawExport = info.rawExportMap && info.rawExportMap.get(exportId); - if (rawExport) { - return { - info, - rawName: rawExport, - ids: exportName.slice(1), - exportName - }; - } - const reexport = exportInfo.findTarget(moduleGraph, module => - moduleToInfoMap.has(module) - ); - if (reexport === false) { - throw new Error( - `Target module of reexport from '${info.module.readableIdentifier( - requestShortener - )}' is not part of the concatenation (export '${exportId}')\nModules in the concatenation:\n${Array.from( - moduleToInfoMap, - ([m, info]) => - ` * ${info.type} ${m.readableIdentifier(requestShortener)}` - ).join("\n")}` - ); - } - if (reexport) { - const refInfo = moduleToInfoMap.get(reexport.module); - return getFinalBinding( - moduleGraph, - refInfo, - reexport.export - ? [...reexport.export, ...exportName.slice(1)] - : exportName.slice(1), - moduleToInfoMap, - runtime, - requestShortener, - runtimeTemplate, - neededNamespaceObjects, - asCall, - info.module.buildMeta.strictHarmonyModule, - asiSafe, - alreadyVisited - ); - } - if (info.namespaceExportSymbol) { - const usedName = /** @type {string[]} */ ( - exportsInfo.getUsedName(exportName, runtime) - ); - return { - info, - rawName: info.namespaceObjectName, - ids: usedName, - exportName - }; - } - throw new Error( - `Cannot get final name for export '${exportName.join( - "." - )}' of ${info.module.readableIdentifier(requestShortener)}` - ); - } + const computeNewContentWithoutOwn = asset => { + if (asset.contentComputeWithoutOwnPromise) + return asset.contentComputeWithoutOwnPromise; + return (asset.contentComputeWithoutOwnPromise = (async () => { + if ( + asset.ownHashes.size > 0 || + Array.from(asset.referencedHashes).some( + hash => hashToNewHash.get(hash) !== hash + ) + ) { + const identifier = asset.name + "|without-own"; + const etag = getEtag(asset); + asset.newSourceWithoutOwn = await cacheGenerate.providePromise( + identifier, + etag, + () => { + const newContent = asset.content.replace( + hashRegExp, + hash => { + if (asset.ownHashes.has(hash)) { + return ""; + } + return hashToNewHash.get(hash); + } + ); + return new RawSource(newContent); + } + ); + } + })()); + }; + const comparator = compareSelect(a => a.name, compareStrings); + for (const oldHash of hashesInOrder) { + const assets = hashToAssets.get(oldHash); + assets.sort(comparator); + const hash = createHash(this._hashFunction); + await Promise.all( + assets.map(asset => + asset.ownHashes.has(oldHash) + ? computeNewContentWithoutOwn(asset) + : computeNewContent(asset) + ) + ); + const assetsContent = mapAndDeduplicateBuffers(assets, asset => { + if (asset.ownHashes.has(oldHash)) { + return asset.newSourceWithoutOwn + ? asset.newSourceWithoutOwn.buffer() + : asset.source.buffer(); + } else { + return asset.newSource + ? asset.newSource.buffer() + : asset.source.buffer(); + } + }); + let newHash = hooks.updateHash.call(assetsContent, oldHash); + if (!newHash) { + for (const content of assetsContent) { + hash.update(content); + } + const digest = hash.digest(this._hashDigest); + newHash = /** @type {string} */ (digest.slice(0, oldHash.length)); + } + hashToNewHash.set(oldHash, newHash); + } + await Promise.all( + assetsWithInfo.map(async asset => { + await computeNewContent(asset); + const newName = asset.name.replace(hashRegExp, hash => + hashToNewHash.get(hash) + ); - case "external": { - const used = /** @type {string[]} */ ( - exportsInfo.getUsedName(exportName, runtime) - ); - if (!used) { - return { - info, - rawName: "/* unused export */ undefined", - ids: exportName.slice(1), - exportName - }; - } - const comment = equals(used, exportName) - ? "" - : Template.toNormalComment(`${exportName.join(".")}`); - return { info, rawName: info.name + comment, ids: used, exportName }; - } - } -}; + const infoUpdate = {}; + const hash = asset.info.contenthash; + infoUpdate.contenthash = Array.isArray(hash) + ? hash.map(hash => hashToNewHash.get(hash)) + : hashToNewHash.get(hash); -/** - * @param {ModuleGraph} moduleGraph the module graph - * @param {ModuleInfo} info module info - * @param {string[]} exportName exportName - * @param {Map} moduleToInfoMap moduleToInfoMap - * @param {RuntimeSpec} runtime for which runtime - * @param {RequestShortener} requestShortener the request shortener - * @param {RuntimeTemplate} runtimeTemplate the runtime template - * @param {Set} neededNamespaceObjects modules for which a namespace object should be generated - * @param {boolean} asCall asCall - * @param {boolean} callContext callContext - * @param {boolean} strictHarmonyModule strictHarmonyModule - * @param {boolean | undefined} asiSafe asiSafe - * @returns {string} the final name - */ -const getFinalName = ( - moduleGraph, - info, - exportName, - moduleToInfoMap, - runtime, - requestShortener, - runtimeTemplate, - neededNamespaceObjects, - asCall, - callContext, - strictHarmonyModule, - asiSafe -) => { - const binding = getFinalBinding( - moduleGraph, - info, - exportName, - moduleToInfoMap, - runtime, - requestShortener, - runtimeTemplate, - neededNamespaceObjects, - asCall, - strictHarmonyModule, - asiSafe - ); - { - const { ids, comment } = binding; - let reference; - let isPropertyAccess; - if ("rawName" in binding) { - reference = `${binding.rawName}${comment || ""}${propertyAccess(ids)}`; - isPropertyAccess = ids.length > 0; - } else { - const { info, name: exportId } = binding; - const name = info.internalNames.get(exportId); - if (!name) { - throw new Error( - `The export "${exportId}" in "${info.module.readableIdentifier( - requestShortener - )}" has no internal name (existing names: ${ - Array.from( - info.internalNames, - ([name, symbol]) => `${name}: ${symbol}` - ).join(", ") || "none" - })` - ); - } - reference = `${name}${comment || ""}${propertyAccess(ids)}`; - isPropertyAccess = ids.length > 1; - } - if (isPropertyAccess && asCall && callContext === false) { - return asiSafe - ? `(0,${reference})` - : asiSafe === false - ? `;(0,${reference})` - : `/*#__PURE__*/Object(${reference})`; - } - return reference; - } -}; + if (asset.newSource !== undefined) { + compilation.updateAsset( + asset.name, + asset.newSource, + infoUpdate + ); + } else { + compilation.updateAsset(asset.name, asset.source, infoUpdate); + } -const addScopeSymbols = (s, nameSet, scopeSet1, scopeSet2) => { - let scope = s; - while (scope) { - if (scopeSet1.has(scope)) break; - if (scopeSet2.has(scope)) break; - scopeSet1.add(scope); - for (const variable of scope.variables) { - nameSet.add(variable.name); - } - scope = scope.upper; + if (asset.name !== newName) { + compilation.renameAsset(asset.name, newName); + } + }) + ); + } + ); + }); } -}; +} -const getAllReferences = variable => { - let set = variable.references; - // Look for inner scope variables too (like in class Foo { t() { Foo } }) - const identifiers = new Set(variable.identifiers); - for (const scope of variable.scope.childScopes) { - for (const innerVar of scope.variables) { - if (innerVar.identifiers.some(id => identifiers.has(id))) { - set = set.concat(innerVar.references); - break; - } - } - } - return set; -}; +module.exports = RealContentHashPlugin; -const getPathInAst = (ast, node) => { - if (ast === node) { - return []; - } - const nr = node.range; +/***/ }), - const enterNode = n => { - if (!n) return undefined; - const r = n.range; - if (r) { - if (r[0] <= nr[0] && r[1] >= nr[1]) { - const path = getPathInAst(n, node); - if (path) { - path.push(n); - return path; - } - } - } - return undefined; - }; +/***/ 84760: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (Array.isArray(ast)) { - for (let i = 0; i < ast.length; i++) { - const enterResult = enterNode(ast[i]); - if (enterResult !== undefined) return enterResult; - } - } else if (ast && typeof ast === "object") { - const keys = Object.keys(ast); - for (let i = 0; i < keys.length; i++) { - const value = ast[keys[i]]; - if (Array.isArray(value)) { - const pathResult = getPathInAst(value, node); - if (pathResult !== undefined) return pathResult; - } else if (value && typeof value === "object") { - const enterResult = enterNode(value); - if (enterResult !== undefined) return enterResult; - } - } - } -}; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -const TYPES = new Set(["javascript"]); -class ConcatenatedModule extends Module { - /** - * @param {Module} rootModule the root module of the concatenation - * @param {Set} modules all modules in the concatenation (including the root module) - * @param {RuntimeSpec} runtime the runtime - * @param {Object=} associatedObjectForCache object for caching - * @param {string | HashConstructor=} hashFunction hash function to use - * @returns {ConcatenatedModule} the module - */ - static create( - rootModule, - modules, - runtime, - associatedObjectForCache, - hashFunction = "md4" - ) { - const identifier = ConcatenatedModule._createIdentifier( - rootModule, - modules, - associatedObjectForCache, - hashFunction - ); - return new ConcatenatedModule({ - identifier, - rootModule, - modules, - runtime - }); - } - /** - * @param {Object} options options - * @param {string} options.identifier the identifier of the module - * @param {Module=} options.rootModule the root module of the concatenation - * @param {RuntimeSpec} options.runtime the selected runtime - * @param {Set=} options.modules all concatenated modules - */ - constructor({ identifier, rootModule, modules, runtime }) { - super("javascript/esm", null, rootModule && rootModule.layer); +const { STAGE_BASIC, STAGE_ADVANCED } = __webpack_require__(80057); - // Info from Factory - /** @type {string} */ - this._identifier = identifier; - /** @type {Module} */ - this.rootModule = rootModule; - /** @type {Set} */ - this._modules = modules; - this._runtime = runtime; - this.factoryMeta = rootModule && rootModule.factoryMeta; - } +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compiler")} Compiler */ +class RemoveEmptyChunksPlugin { /** - * Assuming this module is in the cache. Update the (cached) module with - * the fresh module from the factory. Usually updates internal references - * and properties. - * @param {Module} module fresh module + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - updateCacheModule(module) { - throw new Error("Must not be called"); - } + apply(compiler) { + compiler.hooks.compilation.tap("RemoveEmptyChunksPlugin", compilation => { + /** + * @param {Iterable} chunks the chunks array + * @returns {void} + */ + const handler = chunks => { + const chunkGraph = compilation.chunkGraph; + for (const chunk of chunks) { + if ( + chunkGraph.getNumberOfChunkModules(chunk) === 0 && + !chunk.hasRuntime() && + chunkGraph.getNumberOfEntryModules(chunk) === 0 + ) { + compilation.chunkGraph.disconnectChunk(chunk); + compilation.chunks.delete(chunk); + } + } + }; - /** - * @returns {Set} types available (do not mutate) - */ - getSourceTypes() { - return TYPES; + // TODO do it once + compilation.hooks.optimizeChunks.tap( + { + name: "RemoveEmptyChunksPlugin", + stage: STAGE_BASIC + }, + handler + ); + compilation.hooks.optimizeChunks.tap( + { + name: "RemoveEmptyChunksPlugin", + stage: STAGE_ADVANCED + }, + handler + ); + }); } +} +module.exports = RemoveEmptyChunksPlugin; - get modules() { - return Array.from(this._modules); - } - /** - * @returns {string} a unique identifier of the module - */ - identifier() { - return this._identifier; - } +/***/ }), - /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module - */ - readableIdentifier(requestShortener) { - return ( - this.rootModule.readableIdentifier(requestShortener) + - ` + ${this._modules.size - 1} modules` - ); - } +/***/ 7081: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion - */ - libIdent(options) { - return this.rootModule.libIdent(options); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @returns {string | null} absolute path which should be used for condition matching (usually the resource path) - */ - nameForCondition() { - return this.rootModule.nameForCondition(); - } - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConnectionState} how this module should be connected to referencing modules when consumed for side-effects only - */ - getSideEffectsConnectionState(moduleGraph) { - return this.rootModule.getSideEffectsConnectionState(moduleGraph); - } +const { STAGE_BASIC } = __webpack_require__(80057); +const Queue = __webpack_require__(65930); +const { intersect } = __webpack_require__(93347); + +/** @typedef {import("../Compiler")} Compiler */ + +class RemoveParentModulesPlugin { /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function + * @param {Compiler} compiler the compiler * @returns {void} */ - build(options, compilation, resolver, fs, callback) { - const { rootModule } = this; - this.buildInfo = { - strict: true, - cacheable: true, - moduleArgument: rootModule.buildInfo.moduleArgument, - exportsArgument: rootModule.buildInfo.exportsArgument, - fileDependencies: new LazySet(), - contextDependencies: new LazySet(), - missingDependencies: new LazySet(), - topLevelDeclarations: new Set(), - assets: undefined - }; - this.buildMeta = rootModule.buildMeta; - this.clearDependenciesAndBlocks(); - this.clearWarningsAndErrors(); - - for (const m of this._modules) { - // populate cacheable - if (!m.buildInfo.cacheable) { - this.buildInfo.cacheable = false; - } + apply(compiler) { + compiler.hooks.compilation.tap("RemoveParentModulesPlugin", compilation => { + const handler = (chunks, chunkGroups) => { + const chunkGraph = compilation.chunkGraph; + const queue = new Queue(); + const availableModulesMap = new WeakMap(); - // populate dependencies - for (const d of m.dependencies.filter( - dep => - !(dep instanceof HarmonyImportDependency) || - !this._modules.has(compilation.moduleGraph.getModule(dep)) - )) { - this.dependencies.push(d); - } - // populate blocks - for (const d of m.blocks) { - this.blocks.push(d); - } - - // populate warnings - const warnings = m.getWarnings(); - if (warnings !== undefined) { - for (const warning of warnings) { - this.addWarning(warning); + for (const chunkGroup of compilation.entrypoints.values()) { + // initialize available modules for chunks without parents + availableModulesMap.set(chunkGroup, new Set()); + for (const child of chunkGroup.childrenIterable) { + queue.enqueue(child); + } } - } - - // populate errors - const errors = m.getErrors(); - if (errors !== undefined) { - for (const error of errors) { - this.addError(error); + for (const chunkGroup of compilation.asyncEntrypoints) { + // initialize available modules for chunks without parents + availableModulesMap.set(chunkGroup, new Set()); + for (const child of chunkGroup.childrenIterable) { + queue.enqueue(child); + } } - } - // populate topLevelDeclarations - if (m.buildInfo.topLevelDeclarations) { - const topLevelDeclarations = this.buildInfo.topLevelDeclarations; - if (topLevelDeclarations !== undefined) { - for (const decl of m.buildInfo.topLevelDeclarations) { - topLevelDeclarations.add(decl); + while (queue.length > 0) { + const chunkGroup = queue.dequeue(); + let availableModules = availableModulesMap.get(chunkGroup); + let changed = false; + for (const parent of chunkGroup.parentsIterable) { + const availableModulesInParent = availableModulesMap.get(parent); + if (availableModulesInParent !== undefined) { + // If we know the available modules in parent: process these + if (availableModules === undefined) { + // if we have not own info yet: create new entry + availableModules = new Set(availableModulesInParent); + for (const chunk of parent.chunks) { + for (const m of chunkGraph.getChunkModulesIterable(chunk)) { + availableModules.add(m); + } + } + availableModulesMap.set(chunkGroup, availableModules); + changed = true; + } else { + for (const m of availableModules) { + if ( + !chunkGraph.isModuleInChunkGroup(m, parent) && + !availableModulesInParent.has(m) + ) { + availableModules.delete(m); + changed = true; + } + } + } + } + } + if (changed) { + // if something changed: enqueue our children + for (const child of chunkGroup.childrenIterable) { + queue.enqueue(child); + } } } - } else { - this.buildInfo.topLevelDeclarations = undefined; - } - // populate assets - if (m.buildInfo.assets) { - if (this.buildInfo.assets === undefined) { - this.buildInfo.assets = Object.create(null); - } - Object.assign(this.buildInfo.assets, m.buildInfo.assets); - } - if (m.buildInfo.assetsInfo) { - if (this.buildInfo.assetsInfo === undefined) { - this.buildInfo.assetsInfo = new Map(); - } - for (const [key, value] of m.buildInfo.assetsInfo) { - this.buildInfo.assetsInfo.set(key, value); + // now we have available modules for every chunk + for (const chunk of chunks) { + const availableModulesSets = Array.from( + chunk.groupsIterable, + chunkGroup => availableModulesMap.get(chunkGroup) + ); + if (availableModulesSets.some(s => s === undefined)) continue; // No info about this chunk group + const availableModules = + availableModulesSets.length === 1 + ? availableModulesSets[0] + : intersect(availableModulesSets); + const numberOfModules = chunkGraph.getNumberOfChunkModules(chunk); + const toRemove = new Set(); + if (numberOfModules < availableModules.size) { + for (const m of chunkGraph.getChunkModulesIterable(chunk)) { + if (availableModules.has(m)) { + toRemove.add(m); + } + } + } else { + for (const m of availableModules) { + if (chunkGraph.isModuleInChunk(m, chunk)) { + toRemove.add(m); + } + } + } + for (const module of toRemove) { + chunkGraph.disconnectChunkAndModule(chunk, module); + } } - } - } - callback(); + }; + compilation.hooks.optimizeChunks.tap( + { + name: "RemoveParentModulesPlugin", + stage: STAGE_BASIC + }, + handler + ); + }); } +} +module.exports = RemoveParentModulesPlugin; - /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) - */ - size(type) { - // Guess size from embedded modules - let size = 0; - for (const module of this._modules) { - size += module.size(type); - } - return size; - } - /** - * @private - * @param {Module} rootModule the root of the concatenation - * @param {Set} modulesSet a set of modules which should be concatenated - * @param {RuntimeSpec} runtime for this runtime - * @param {ModuleGraph} moduleGraph the module graph - * @returns {ConcatenationEntry[]} concatenation list - */ - _createConcatenationList(rootModule, modulesSet, runtime, moduleGraph) { - /** @type {ConcatenationEntry[]} */ - const list = []; - /** @type {Map} */ - const existingEntries = new Map(); +/***/ }), - /** - * @param {Module} module a module - * @returns {Iterable<{ connection: ModuleGraphConnection, runtimeCondition: RuntimeSpec | true }>} imported modules in order - */ - const getConcatenatedImports = module => { - let connections = Array.from(moduleGraph.getOutgoingConnections(module)); - if (module === rootModule) { - for (const c of moduleGraph.getOutgoingConnections(this)) - connections.push(c); - } - const references = connections - .filter(connection => { - if (!(connection.dependency instanceof HarmonyImportDependency)) - return false; - return ( - connection && - connection.resolvedOriginModule === module && - connection.module && - connection.isTargetActive(runtime) - ); - }) - .map(connection => ({ - connection, - sourceOrder: /** @type {HarmonyImportDependency} */ ( - connection.dependency - ).sourceOrder - })); - references.sort( - concatComparators(bySourceOrder, keepOriginalOrder(references)) - ); - /** @type {Map} */ - const referencesMap = new Map(); - for (const { connection } of references) { - const runtimeCondition = filterRuntime(runtime, r => - connection.isTargetActive(r) - ); - if (runtimeCondition === false) continue; - const module = connection.module; - const entry = referencesMap.get(module); - if (entry === undefined) { - referencesMap.set(module, { connection, runtimeCondition }); - continue; - } - entry.runtimeCondition = mergeRuntimeConditionNonFalse( - entry.runtimeCondition, - runtimeCondition, - runtime - ); - } - return referencesMap.values(); - }; +/***/ 2837: +/***/ (function(module) { - /** - * @param {ModuleGraphConnection} connection graph connection - * @param {RuntimeSpec | true} runtimeCondition runtime condition - * @returns {void} - */ - const enterModule = (connection, runtimeCondition) => { - const module = connection.module; - if (!module) return; - const existingEntry = existingEntries.get(module); - if (existingEntry === true) { - return; - } - if (modulesSet.has(module)) { - existingEntries.set(module, true); - if (runtimeCondition !== true) { - throw new Error( - `Cannot runtime-conditional concatenate a module (${module.identifier()} in ${this.rootModule.identifier()}, ${runtimeConditionToString( - runtimeCondition - )}). This should not happen.` - ); - } - const imports = getConcatenatedImports(module); - for (const { connection, runtimeCondition } of imports) - enterModule(connection, runtimeCondition); - list.push({ - type: "concatenated", - module: connection.module, - runtimeCondition - }); - } else { - if (existingEntry !== undefined) { - const reducedRuntimeCondition = subtractRuntimeCondition( - runtimeCondition, - existingEntry, - runtime - ); - if (reducedRuntimeCondition === false) return; - runtimeCondition = reducedRuntimeCondition; - existingEntries.set( - connection.module, - mergeRuntimeConditionNonFalse( - existingEntry, - runtimeCondition, - runtime - ) - ); - } else { - existingEntries.set(connection.module, runtimeCondition); - } - if (list.length > 0) { - const lastItem = list[list.length - 1]; - if ( - lastItem.type === "external" && - lastItem.module === connection.module - ) { - lastItem.runtimeCondition = mergeRuntimeCondition( - lastItem.runtimeCondition, - runtimeCondition, - runtime - ); - return; - } - } - list.push({ - type: "external", - get module() { - // We need to use a getter here, because the module in the dependency - // could be replaced by some other process (i. e. also replaced with a - // concatenated module) - return connection.module; - }, - runtimeCondition - }); - } - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - existingEntries.set(rootModule, true); - const imports = getConcatenatedImports(rootModule); - for (const { connection, runtimeCondition } of imports) - enterModule(connection, runtimeCondition); - list.push({ - type: "concatenated", - module: rootModule, - runtimeCondition: true - }); - return list; - } - /** - * @param {Module} rootModule the root module of the concatenation - * @param {Set} modules all modules in the concatenation (including the root module) - * @param {Object=} associatedObjectForCache object for caching - * @param {string | HashConstructor=} hashFunction hash function to use - * @returns {string} the identifier - */ - static _createIdentifier( - rootModule, - modules, - associatedObjectForCache, - hashFunction = "md4" - ) { - const cachedMakePathsRelative = makePathsRelative.bindContextCache( - rootModule.context, - associatedObjectForCache - ); - let identifiers = []; - for (const module of modules) { - identifiers.push(cachedMakePathsRelative(module.identifier())); - } - identifiers.sort(); - const hash = createHash(hashFunction); - hash.update(identifiers.join(" ")); - return rootModule.identifier() + "|" + hash.digest("hex"); +/** @typedef {import("../Compiler")} Compiler */ + +class RuntimeChunkPlugin { + constructor(options) { + this.options = { + name: entrypoint => `runtime~${entrypoint.name}`, + ...options + }; } /** - * @param {LazySet} fileDependencies set where file dependencies are added to - * @param {LazySet} contextDependencies set where context dependencies are added to - * @param {LazySet} missingDependencies set where missing dependencies are added to - * @param {LazySet} buildDependencies set where build dependencies are added to + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - addCacheDependencies( - fileDependencies, - contextDependencies, - missingDependencies, - buildDependencies - ) { - for (const module of this._modules) { - module.addCacheDependencies( - fileDependencies, - contextDependencies, - missingDependencies, - buildDependencies + apply(compiler) { + compiler.hooks.thisCompilation.tap("RuntimeChunkPlugin", compilation => { + compilation.hooks.addEntry.tap( + "RuntimeChunkPlugin", + (_, { name: entryName }) => { + if (entryName === undefined) return; + const data = compilation.entries.get(entryName); + if (data.options.runtime === undefined && !data.options.dependOn) { + // Determine runtime chunk name + let name = this.options.name; + if (typeof name === "function") { + name = name({ name: entryName }); + } + data.options.runtime = name; + } + } ); - } + }); } +} - /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result - */ - codeGeneration({ - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtime: generationRuntime, - codeGenerationResults - }) { - /** @type {Set} */ - const runtimeRequirements = new Set(); - const runtime = intersectRuntime(generationRuntime, this._runtime); +module.exports = RuntimeChunkPlugin; - const requestShortener = runtimeTemplate.requestShortener; - // Meta info for each module - const [modulesWithInfo, moduleToInfoMap] = this._getModulesWithInfo( - moduleGraph, - runtime - ); - // Set with modules that need a generated namespace object - /** @type {Set} */ - const neededNamespaceObjects = new Set(); +/***/ }), - // Generate source code and analyse scopes - // Prepare a ReplaceSource for the final source - for (const info of moduleToInfoMap.values()) { - this._analyseModule( - moduleToInfoMap, - info, - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtime, - codeGenerationResults - ); - } +/***/ 84800: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // List of all used names to avoid conflicts - const allUsedNames = new Set(RESERVED_NAMES); - // Updated Top level declarations are created by renaming - const topLevelDeclarations = new Set(); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // List of additional names in scope for module references - /** @type {Map, alreadyCheckedScopes: Set }>} */ - const usedNamesInScopeInfo = new Map(); - /** - * @param {string} module module identifier - * @param {string} id export id - * @returns {{ usedNames: Set, alreadyCheckedScopes: Set }} info - */ - const getUsedNamesInScopeInfo = (module, id) => { - const key = `${module}-${id}`; - let info = usedNamesInScopeInfo.get(key); - if (info === undefined) { - info = { - usedNames: new Set(), - alreadyCheckedScopes: new Set() - }; - usedNamesInScopeInfo.set(key, info); - } - return info; - }; - // Set of already checked scopes - const ignoredScopes = new Set(); - // get all global names - for (const info of modulesWithInfo) { - if (info.type === "concatenated") { - // ignore symbols from moduleScope - if (info.moduleScope) { - ignoredScopes.add(info.moduleScope); - } +const glob2regexp = __webpack_require__(86140); +const { STAGE_DEFAULT } = __webpack_require__(80057); +const HarmonyExportImportedSpecifierDependency = __webpack_require__(67157); +const HarmonyImportSpecifierDependency = __webpack_require__(14077); +const formatLocation = __webpack_require__(16734); - // The super class expression in class scopes behaves weird - // We get ranges of all super class expressions to make - // renaming to work correctly - const superClassCache = new WeakMap(); - const getSuperClassExpressions = scope => { - const cacheEntry = superClassCache.get(scope); - if (cacheEntry !== undefined) return cacheEntry; - const superClassExpressions = []; - for (const childScope of scope.childScopes) { - if (childScope.type !== "class") continue; - const block = childScope.block; - if ( - (block.type === "ClassDeclaration" || - block.type === "ClassExpression") && - block.superClass - ) { - superClassExpressions.push({ - range: block.superClass.range, - variables: childScope.variables - }); - } - } - superClassCache.set(scope, superClassExpressions); - return superClassExpressions; - }; +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ - // add global symbols - if (info.globalScope) { - for (const reference of info.globalScope.through) { - const name = reference.identifier.name; - if (ConcatenationScope.isModuleReference(name)) { - const match = ConcatenationScope.matchModuleReference(name); - if (!match) continue; - const referencedInfo = modulesWithInfo[match.index]; - if (referencedInfo.type === "reference") - throw new Error("Module reference can't point to a reference"); - const binding = getFinalBinding( - moduleGraph, - referencedInfo, - match.ids, - moduleToInfoMap, - runtime, - requestShortener, - runtimeTemplate, - neededNamespaceObjects, - false, - info.module.buildMeta.strictHarmonyModule, - true - ); - if (!binding.ids) continue; - const { usedNames, alreadyCheckedScopes } = - getUsedNamesInScopeInfo( - binding.info.module.identifier(), - "name" in binding ? binding.name : "" - ); - for (const expr of getSuperClassExpressions(reference.from)) { - if ( - expr.range[0] <= reference.identifier.range[0] && - expr.range[1] >= reference.identifier.range[1] - ) { - for (const variable of expr.variables) { - usedNames.add(variable.name); - } +/** + * @typedef {Object} ExportInModule + * @property {Module} module the module + * @property {string} exportName the name of the export + * @property {boolean} checked if the export is conditional + */ + +/** + * @typedef {Object} ReexportInfo + * @property {Map} static + * @property {Map>} dynamic + */ + +/** @type {WeakMap>} */ +const globToRegexpCache = new WeakMap(); + +/** + * @param {string} glob the pattern + * @param {Map} cache the glob to RegExp cache + * @returns {RegExp} a regular expression + */ +const globToRegexp = (glob, cache) => { + const cacheEntry = cache.get(glob); + if (cacheEntry !== undefined) return cacheEntry; + if (!glob.includes("/")) { + glob = `**/${glob}`; + } + const baseRegexp = glob2regexp(glob, { globstar: true, extended: true }); + const regexpSource = baseRegexp.source; + const regexp = new RegExp("^(\\./)?" + regexpSource.slice(1)); + cache.set(glob, regexp); + return regexp; +}; + +class SideEffectsFlagPlugin { + /** + * @param {boolean} analyseSource analyse source code for side effects + */ + constructor(analyseSource = true) { + this._analyseSource = analyseSource; + } + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + let cache = globToRegexpCache.get(compiler.root); + if (cache === undefined) { + cache = new Map(); + globToRegexpCache.set(compiler.root, cache); + } + compiler.hooks.compilation.tap( + "SideEffectsFlagPlugin", + (compilation, { normalModuleFactory }) => { + const moduleGraph = compilation.moduleGraph; + normalModuleFactory.hooks.module.tap( + "SideEffectsFlagPlugin", + (module, data) => { + const resolveData = data.resourceResolveData; + if ( + resolveData && + resolveData.descriptionFileData && + resolveData.relativePath + ) { + const sideEffects = resolveData.descriptionFileData.sideEffects; + if (sideEffects !== undefined) { + if (module.factoryMeta === undefined) { + module.factoryMeta = {}; } + const hasSideEffects = + SideEffectsFlagPlugin.moduleHasSideEffects( + resolveData.relativePath, + sideEffects, + cache + ); + module.factoryMeta.sideEffectFree = !hasSideEffects; } - addScopeSymbols( - reference.from, - usedNames, - alreadyCheckedScopes, - ignoredScopes - ); - } else { - allUsedNames.add(name); } - } - } - } - } - // generate names for symbols - for (const info of moduleToInfoMap.values()) { - const { usedNames: namespaceObjectUsedNames } = getUsedNamesInScopeInfo( - info.module.identifier(), - "" - ); - switch (info.type) { - case "concatenated": { - for (const variable of info.moduleScope.variables) { - const name = variable.name; - const { usedNames, alreadyCheckedScopes } = getUsedNamesInScopeInfo( - info.module.identifier(), - name + return module; + } + ); + normalModuleFactory.hooks.module.tap( + "SideEffectsFlagPlugin", + (module, data) => { + if (typeof data.settings.sideEffects === "boolean") { + if (module.factoryMeta === undefined) { + module.factoryMeta = {}; + } + module.factoryMeta.sideEffectFree = !data.settings.sideEffects; + } + return module; + } + ); + if (this._analyseSource) { + /** + * @param {JavascriptParser} parser the parser + * @returns {void} + */ + const parserHandler = parser => { + let sideEffectsStatement; + parser.hooks.program.tap("SideEffectsFlagPlugin", () => { + sideEffectsStatement = undefined; + }); + parser.hooks.statement.tap( + { name: "SideEffectsFlagPlugin", stage: -100 }, + statement => { + if (sideEffectsStatement) return; + if (parser.scope.topLevelScope !== true) return; + switch (statement.type) { + case "ExpressionStatement": + if ( + !parser.isPure(statement.expression, statement.range[0]) + ) { + sideEffectsStatement = statement; + } + break; + case "IfStatement": + case "WhileStatement": + case "DoWhileStatement": + if (!parser.isPure(statement.test, statement.range[0])) { + sideEffectsStatement = statement; + } + // statement hook will be called for child statements too + break; + case "ForStatement": + if ( + !parser.isPure(statement.init, statement.range[0]) || + !parser.isPure( + statement.test, + statement.init + ? statement.init.range[1] + : statement.range[0] + ) || + !parser.isPure( + statement.update, + statement.test + ? statement.test.range[1] + : statement.init + ? statement.init.range[1] + : statement.range[0] + ) + ) { + sideEffectsStatement = statement; + } + // statement hook will be called for child statements too + break; + case "SwitchStatement": + if ( + !parser.isPure(statement.discriminant, statement.range[0]) + ) { + sideEffectsStatement = statement; + } + // statement hook will be called for child statements too + break; + case "VariableDeclaration": + case "ClassDeclaration": + case "FunctionDeclaration": + if (!parser.isPure(statement, statement.range[0])) { + sideEffectsStatement = statement; + } + break; + case "ExportNamedDeclaration": + case "ExportDefaultDeclaration": + if ( + !parser.isPure(statement.declaration, statement.range[0]) + ) { + sideEffectsStatement = statement; + } + break; + case "LabeledStatement": + case "BlockStatement": + // statement hook will be called for child statements too + break; + case "EmptyStatement": + break; + case "ExportAllDeclaration": + case "ImportDeclaration": + // imports will be handled by the dependencies + break; + default: + sideEffectsStatement = statement; + break; + } + } ); - if (allUsedNames.has(name) || usedNames.has(name)) { - const references = getAllReferences(variable); - for (const ref of references) { - addScopeSymbols( - ref.from, - usedNames, - alreadyCheckedScopes, - ignoredScopes - ); + parser.hooks.finish.tap("SideEffectsFlagPlugin", () => { + if (sideEffectsStatement === undefined) { + parser.state.module.buildMeta.sideEffectFree = true; + } else { + const { loc, type } = sideEffectsStatement; + moduleGraph + .getOptimizationBailout(parser.state.module) + .push( + () => + `Statement (${type}) with side effects in source code at ${formatLocation( + loc + )}` + ); } - const newName = this.findNewName( - name, - allUsedNames, - usedNames, - info.module.readableIdentifier(requestShortener) - ); - allUsedNames.add(newName); - info.internalNames.set(name, newName); - topLevelDeclarations.add(newName); - const source = info.source; - const allIdentifiers = new Set( - references.map(r => r.identifier).concat(variable.identifiers) - ); - for (const identifier of allIdentifiers) { - const r = identifier.range; - const path = getPathInAst(info.ast, identifier); - if (path && path.length > 1) { - const maybeProperty = - path[1].type === "AssignmentPattern" && - path[1].left === path[0] - ? path[2] - : path[1]; + }); + }; + for (const key of [ + "javascript/auto", + "javascript/esm", + "javascript/dynamic" + ]) { + normalModuleFactory.hooks.parser + .for(key) + .tap("SideEffectsFlagPlugin", parserHandler); + } + } + compilation.hooks.optimizeDependencies.tap( + { + name: "SideEffectsFlagPlugin", + stage: STAGE_DEFAULT + }, + modules => { + const logger = compilation.getLogger( + "webpack.SideEffectsFlagPlugin" + ); + + logger.time("update dependencies"); + for (const module of modules) { + if (module.getSideEffectsConnectionState(moduleGraph) === false) { + const exportsInfo = moduleGraph.getExportsInfo(module); + for (const connection of moduleGraph.getIncomingConnections( + module + )) { + const dep = connection.dependency; + let isReexport; if ( - maybeProperty.type === "Property" && - maybeProperty.shorthand + (isReexport = + dep instanceof + HarmonyExportImportedSpecifierDependency) || + (dep instanceof HarmonyImportSpecifierDependency && + !dep.namespaceObjectAsContext) ) { - source.insert(r[1], `: ${newName}`); - continue; + // TODO improve for export * + if (isReexport && dep.name) { + const exportInfo = moduleGraph.getExportInfo( + connection.originModule, + dep.name + ); + exportInfo.moveTarget( + moduleGraph, + ({ module }) => + module.getSideEffectsConnectionState(moduleGraph) === + false, + ({ module: newModule, export: exportName }) => { + moduleGraph.updateModule(dep, newModule); + moduleGraph.addExplanation( + dep, + "(skipped side-effect-free modules)" + ); + const ids = dep.getIds(moduleGraph); + dep.setIds( + moduleGraph, + exportName + ? [...exportName, ...ids.slice(1)] + : ids.slice(1) + ); + return moduleGraph.getConnection(dep); + } + ); + continue; + } + // TODO improve for nested imports + const ids = dep.getIds(moduleGraph); + if (ids.length > 0) { + const exportInfo = exportsInfo.getExportInfo(ids[0]); + const target = exportInfo.getTarget( + moduleGraph, + ({ module }) => + module.getSideEffectsConnectionState(moduleGraph) === + false + ); + if (!target) continue; + + moduleGraph.updateModule(dep, target.module); + moduleGraph.addExplanation( + dep, + "(skipped side-effect-free modules)" + ); + dep.setIds( + moduleGraph, + target.export + ? [...target.export, ...ids.slice(1)] + : ids.slice(1) + ); + } } } - source.replace(r[0], r[1] - 1, newName); } - } else { - allUsedNames.add(name); - info.internalNames.set(name, name); - topLevelDeclarations.add(name); } + logger.timeEnd("update dependencies"); } - let namespaceObjectName; - if (info.namespaceExportSymbol) { - namespaceObjectName = info.internalNames.get( - info.namespaceExportSymbol - ); - } else { - namespaceObjectName = this.findNewName( - "namespaceObject", - allUsedNames, - namespaceObjectUsedNames, - info.module.readableIdentifier(requestShortener) - ); - allUsedNames.add(namespaceObjectName); - } - info.namespaceObjectName = namespaceObjectName; - topLevelDeclarations.add(namespaceObjectName); - break; - } - case "external": { - const externalName = this.findNewName( - "", - allUsedNames, - namespaceObjectUsedNames, - info.module.readableIdentifier(requestShortener) - ); - allUsedNames.add(externalName); - info.name = externalName; - topLevelDeclarations.add(externalName); - break; - } - } - if (info.module.buildMeta.exportsType !== "namespace") { - const externalNameInterop = this.findNewName( - "namespaceObject", - allUsedNames, - namespaceObjectUsedNames, - info.module.readableIdentifier(requestShortener) - ); - allUsedNames.add(externalNameInterop); - info.interopNamespaceObjectName = externalNameInterop; - topLevelDeclarations.add(externalNameInterop); - } - if ( - info.module.buildMeta.exportsType === "default" && - info.module.buildMeta.defaultObject !== "redirect" - ) { - const externalNameInterop = this.findNewName( - "namespaceObject2", - allUsedNames, - namespaceObjectUsedNames, - info.module.readableIdentifier(requestShortener) ); - allUsedNames.add(externalNameInterop); - info.interopNamespaceObject2Name = externalNameInterop; - topLevelDeclarations.add(externalNameInterop); } - if ( - info.module.buildMeta.exportsType === "dynamic" || - !info.module.buildMeta.exportsType - ) { - const externalNameInterop = this.findNewName( - "default", - allUsedNames, - namespaceObjectUsedNames, - info.module.readableIdentifier(requestShortener) + ); + } + + static moduleHasSideEffects(moduleName, flagValue, cache) { + switch (typeof flagValue) { + case "undefined": + return true; + case "boolean": + return flagValue; + case "string": + return globToRegexp(flagValue, cache).test(moduleName); + case "object": + return flagValue.some(glob => + SideEffectsFlagPlugin.moduleHasSideEffects(moduleName, glob, cache) ); - allUsedNames.add(externalNameInterop); - info.interopDefaultAccessName = externalNameInterop; - topLevelDeclarations.add(externalNameInterop); - } } + } +} +module.exports = SideEffectsFlagPlugin; - // Find and replace references to modules - for (const info of moduleToInfoMap.values()) { - if (info.type === "concatenated") { - for (const reference of info.globalScope.through) { - const name = reference.identifier.name; - const match = ConcatenationScope.matchModuleReference(name); - if (match) { - const referencedInfo = modulesWithInfo[match.index]; - if (referencedInfo.type === "reference") - throw new Error("Module reference can't point to a reference"); - const finalName = getFinalName( - moduleGraph, - referencedInfo, - match.ids, - moduleToInfoMap, - runtime, - requestShortener, - runtimeTemplate, - neededNamespaceObjects, - match.call, - !match.directImport, - info.module.buildMeta.strictHarmonyModule, - match.asiSafe - ); - const r = reference.identifier.range; - const source = info.source; - // range is extended by 2 chars to cover the appended "._" - source.replace(r[0], r[1] + 1, finalName); - } - } - } - } - // Map with all root exposed used exports - /** @type {Map} */ - const exportsMap = new Map(); +/***/ }), - // Set with all root exposed unused exports - /** @type {Set} */ - const unusedExports = new Set(); +/***/ 21478: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const rootInfo = /** @type {ConcatenatedModuleInfo} */ ( - moduleToInfoMap.get(this.rootModule) - ); - const strictHarmonyModule = rootInfo.module.buildMeta.strictHarmonyModule; - const exportsInfo = moduleGraph.getExportsInfo(rootInfo.module); - for (const exportInfo of exportsInfo.orderedExports) { - const name = exportInfo.name; - if (exportInfo.provided === false) continue; - const used = exportInfo.getUsedName(undefined, runtime); - if (!used) { - unusedExports.add(name); - continue; - } - exportsMap.set(used, requestShortener => { - try { - const finalName = getFinalName( - moduleGraph, - rootInfo, - [name], - moduleToInfoMap, - runtime, - requestShortener, - runtimeTemplate, - neededNamespaceObjects, - false, - false, - strictHarmonyModule, - true - ); - return `/* ${ - exportInfo.isReexport() ? "reexport" : "binding" - } */ ${finalName}`; - } catch (e) { - e.message += `\nwhile generating the root export '${name}' (used name: '${used}')`; - throw e; - } - }); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - const result = new ConcatSource(); - // add harmony compatibility flag (must be first because of possible circular dependencies) - if ( - moduleGraph.getExportsInfo(this).otherExportsInfo.getUsed(runtime) !== - UsageState.Unused - ) { - result.add(`// ESM COMPAT FLAG\n`); - result.add( - runtimeTemplate.defineEsModuleFlagStatement({ - exportsArgument: this.exportsArgument, - runtimeRequirements - }) - ); - } - // define exports - if (exportsMap.size > 0) { - runtimeRequirements.add(RuntimeGlobals.exports); - runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); - const definitions = []; - for (const [key, value] of exportsMap) { - definitions.push( - `\n ${JSON.stringify(key)}: ${runtimeTemplate.returningFunction( - value(requestShortener) - )}` - ); - } - result.add(`\n// EXPORTS\n`); - result.add( - `${RuntimeGlobals.definePropertyGetters}(${ - this.exportsArgument - }, {${definitions.join(",")}\n});\n` - ); - } +const Chunk = __webpack_require__(39385); +const { STAGE_ADVANCED } = __webpack_require__(80057); +const WebpackError = __webpack_require__(53799); +const { requestToId } = __webpack_require__(63290); +const { isSubset } = __webpack_require__(93347); +const SortableSet = __webpack_require__(13098); +const { + compareModulesByIdentifier, + compareIterables +} = __webpack_require__(29579); +const createHash = __webpack_require__(49835); +const deterministicGrouping = __webpack_require__(59836); +const { makePathsRelative } = __webpack_require__(82186); +const memoize = __webpack_require__(78676); +const MinMaxSizeWarning = __webpack_require__(85305); - // list unused exports - if (unusedExports.size > 0) { - result.add( - `\n// UNUSED EXPORTS: ${joinIterableWithComma(unusedExports)}\n` - ); - } +/** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksCacheGroup} OptimizationSplitChunksCacheGroup */ +/** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksGetCacheGroups} OptimizationSplitChunksGetCacheGroups */ +/** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksOptions} OptimizationSplitChunksOptions */ +/** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksSizes} OptimizationSplitChunksSizes */ +/** @typedef {import("../../declarations/WebpackOptions").Output} OutputOptions */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ +/** @typedef {import("../Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("../Compilation").PathData} PathData */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../util/deterministicGrouping").GroupedItems} DeterministicGroupingGroupedItemsForModule */ +/** @typedef {import("../util/deterministicGrouping").Options} DeterministicGroupingOptionsForModule */ - // generate namespace objects - const namespaceObjectSources = new Map(); - for (const info of neededNamespaceObjects) { - if (info.namespaceExportSymbol) continue; - const nsObj = []; - const exportsInfo = moduleGraph.getExportsInfo(info.module); - for (const exportInfo of exportsInfo.orderedExports) { - if (exportInfo.provided === false) continue; - const usedName = exportInfo.getUsedName(undefined, runtime); - if (usedName) { - const finalName = getFinalName( - moduleGraph, - info, - [exportInfo.name], - moduleToInfoMap, - runtime, - requestShortener, - runtimeTemplate, - neededNamespaceObjects, - false, - undefined, - info.module.buildMeta.strictHarmonyModule, - true - ); - nsObj.push( - `\n ${JSON.stringify( - usedName - )}: ${runtimeTemplate.returningFunction(finalName)}` - ); - } - } - const name = info.namespaceObjectName; - const defineGetters = - nsObj.length > 0 - ? `${RuntimeGlobals.definePropertyGetters}(${name}, {${nsObj.join( - "," - )}\n});\n` - : ""; - if (nsObj.length > 0) - runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); - namespaceObjectSources.set( - info, - ` -// NAMESPACE OBJECT: ${info.module.readableIdentifier(requestShortener)} -var ${name} = {}; -${RuntimeGlobals.makeNamespaceObject}(${name}); -${defineGetters}` - ); - runtimeRequirements.add(RuntimeGlobals.makeNamespaceObject); - } +/** @typedef {Record} SplitChunksSizes */ - // define required namespace objects (must be before evaluation modules) - for (const info of modulesWithInfo) { - if (info.type === "concatenated") { - const source = namespaceObjectSources.get(info); - if (!source) continue; - result.add(source); - } - } +/** + * @callback ChunkFilterFunction + * @param {Chunk} chunk + * @returns {boolean} + */ - const chunkInitFragments = []; +/** + * @callback CombineSizeFunction + * @param {number} a + * @param {number} b + * @returns {number} + */ - // evaluate modules in order - for (const rawInfo of modulesWithInfo) { - let name; - let isConditional = false; - const info = rawInfo.type === "reference" ? rawInfo.target : rawInfo; - switch (info.type) { - case "concatenated": { - result.add( - `\n;// CONCATENATED MODULE: ${info.module.readableIdentifier( - requestShortener - )}\n` - ); - result.add(info.source); - if (info.chunkInitFragments) { - for (const f of info.chunkInitFragments) chunkInitFragments.push(f); - } - if (info.runtimeRequirements) { - for (const r of info.runtimeRequirements) { - runtimeRequirements.add(r); - } - } - name = info.namespaceObjectName; - break; - } - case "external": { - result.add( - `\n// EXTERNAL MODULE: ${info.module.readableIdentifier( - requestShortener - )}\n` - ); - runtimeRequirements.add(RuntimeGlobals.require); - const { runtimeCondition } = - /** @type {ExternalModuleInfo | ReferenceToModuleInfo} */ (rawInfo); - const condition = runtimeTemplate.runtimeConditionExpression({ - chunkGraph, - runtimeCondition, - runtime, - runtimeRequirements - }); - if (condition !== "true") { - isConditional = true; - result.add(`if (${condition}) {\n`); - } - result.add( - `var ${info.name} = __webpack_require__(${JSON.stringify( - chunkGraph.getModuleId(info.module) - )});` - ); - name = info.name; - break; - } - default: - // @ts-expect-error never is expected here - throw new Error(`Unsupported concatenation entry type ${info.type}`); - } - if (info.interopNamespaceObjectUsed) { - runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); - result.add( - `\nvar ${info.interopNamespaceObjectName} = /*#__PURE__*/${RuntimeGlobals.createFakeNamespaceObject}(${name}, 2);` - ); - } - if (info.interopNamespaceObject2Used) { - runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); - result.add( - `\nvar ${info.interopNamespaceObject2Name} = /*#__PURE__*/${RuntimeGlobals.createFakeNamespaceObject}(${name});` - ); - } - if (info.interopDefaultAccessUsed) { - runtimeRequirements.add(RuntimeGlobals.compatGetDefaultExport); - result.add( - `\nvar ${info.interopDefaultAccessName} = /*#__PURE__*/${RuntimeGlobals.compatGetDefaultExport}(${name});` - ); - } - if (isConditional) { - result.add("\n}"); - } - } +/** + * @typedef {Object} CacheGroupSource + * @property {string=} key + * @property {number=} priority + * @property {GetName=} getName + * @property {ChunkFilterFunction=} chunksFilter + * @property {boolean=} enforce + * @property {SplitChunksSizes} minSize + * @property {SplitChunksSizes} minSizeReduction + * @property {SplitChunksSizes} minRemainingSize + * @property {SplitChunksSizes} enforceSizeThreshold + * @property {SplitChunksSizes} maxAsyncSize + * @property {SplitChunksSizes} maxInitialSize + * @property {number=} minChunks + * @property {number=} maxAsyncRequests + * @property {number=} maxInitialRequests + * @property {(string | function(PathData, AssetInfo=): string)=} filename + * @property {string=} idHint + * @property {string} automaticNameDelimiter + * @property {boolean=} reuseExistingChunk + * @property {boolean=} usedExports + */ - const data = new Map(); - if (chunkInitFragments.length > 0) - data.set("chunkInitFragments", chunkInitFragments); - data.set("topLevelDeclarations", topLevelDeclarations); +/** + * @typedef {Object} CacheGroup + * @property {string} key + * @property {number=} priority + * @property {GetName=} getName + * @property {ChunkFilterFunction=} chunksFilter + * @property {SplitChunksSizes} minSize + * @property {SplitChunksSizes} minSizeReduction + * @property {SplitChunksSizes} minRemainingSize + * @property {SplitChunksSizes} enforceSizeThreshold + * @property {SplitChunksSizes} maxAsyncSize + * @property {SplitChunksSizes} maxInitialSize + * @property {number=} minChunks + * @property {number=} maxAsyncRequests + * @property {number=} maxInitialRequests + * @property {(string | function(PathData, AssetInfo=): string)=} filename + * @property {string=} idHint + * @property {string} automaticNameDelimiter + * @property {boolean} reuseExistingChunk + * @property {boolean} usedExports + * @property {boolean} _validateSize + * @property {boolean} _validateRemainingSize + * @property {SplitChunksSizes} _minSizeForMaxSize + * @property {boolean} _conditionalEnforce + */ - /** @type {CodeGenerationResult} */ - const resultEntry = { - sources: new Map([["javascript", new CachedSource(result)]]), - data, - runtimeRequirements - }; +/** + * @typedef {Object} FallbackCacheGroup + * @property {ChunkFilterFunction} chunksFilter + * @property {SplitChunksSizes} minSize + * @property {SplitChunksSizes} maxAsyncSize + * @property {SplitChunksSizes} maxInitialSize + * @property {string} automaticNameDelimiter + */ - return resultEntry; - } +/** + * @typedef {Object} CacheGroupsContext + * @property {ModuleGraph} moduleGraph + * @property {ChunkGraph} chunkGraph + */ - /** - * @param {Map} modulesMap modulesMap - * @param {ModuleInfo} info info - * @param {DependencyTemplates} dependencyTemplates dependencyTemplates - * @param {RuntimeTemplate} runtimeTemplate runtimeTemplate - * @param {ModuleGraph} moduleGraph moduleGraph - * @param {ChunkGraph} chunkGraph chunkGraph - * @param {RuntimeSpec} runtime runtime - * @param {CodeGenerationResults} codeGenerationResults codeGenerationResults - */ - _analyseModule( - modulesMap, - info, - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtime, - codeGenerationResults - ) { - if (info.type === "concatenated") { - const m = info.module; - try { - // Create a concatenation scope to track and capture information - const concatenationScope = new ConcatenationScope(modulesMap, info); +/** + * @callback GetCacheGroups + * @param {Module} module + * @param {CacheGroupsContext} context + * @returns {CacheGroupSource[]} + */ - // TODO cache codeGeneration results - const codeGenResult = m.codeGeneration({ - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtime, - concatenationScope, - codeGenerationResults - }); - const source = codeGenResult.sources.get("javascript"); - const data = codeGenResult.data; - const chunkInitFragments = data && data.get("chunkInitFragments"); - const code = source.source().toString(); - let ast; - try { - ast = JavascriptParser._parse(code, { - sourceType: "module" - }); - } catch (err) { - if ( - err.loc && - typeof err.loc === "object" && - typeof err.loc.line === "number" - ) { - const lineNumber = err.loc.line; - const lines = code.split("\n"); - err.message += - "\n| " + - lines - .slice(Math.max(0, lineNumber - 3), lineNumber + 2) - .join("\n| "); - } - throw err; - } - const scopeManager = eslintScope.analyze(ast, { - ecmaVersion: 6, - sourceType: "module", - optimistic: true, - ignoreEval: true, - impliedStrict: true - }); - const globalScope = scopeManager.acquire(ast); - const moduleScope = globalScope.childScopes[0]; - const resultSource = new ReplaceSource(source); - info.runtimeRequirements = codeGenResult.runtimeRequirements; - info.ast = ast; - info.internalSource = source; - info.source = resultSource; - info.chunkInitFragments = chunkInitFragments; - info.globalScope = globalScope; - info.moduleScope = moduleScope; - } catch (err) { - err.message += `\nwhile analyzing module ${m.identifier()} for concatenation`; - throw err; - } - } - } +/** + * @callback GetName + * @param {Module=} module + * @param {Chunk[]=} chunks + * @param {string=} key + * @returns {string=} + */ - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {RuntimeSpec} runtime the runtime - * @returns {[ModuleInfoOrReference[], Map]} module info items - */ - _getModulesWithInfo(moduleGraph, runtime) { - const orderedConcatenationList = this._createConcatenationList( - this.rootModule, - this._modules, - runtime, - moduleGraph - ); - /** @type {Map} */ - const map = new Map(); - const list = orderedConcatenationList.map((info, index) => { - let item = map.get(info.module); - if (item === undefined) { - switch (info.type) { - case "concatenated": - item = { - type: "concatenated", - module: info.module, - index, - ast: undefined, - internalSource: undefined, - runtimeRequirements: undefined, - source: undefined, - globalScope: undefined, - moduleScope: undefined, - internalNames: new Map(), - exportMap: undefined, - rawExportMap: undefined, - namespaceExportSymbol: undefined, - namespaceObjectName: undefined, - interopNamespaceObjectUsed: false, - interopNamespaceObjectName: undefined, - interopNamespaceObject2Used: false, - interopNamespaceObject2Name: undefined, - interopDefaultAccessUsed: false, - interopDefaultAccessName: undefined - }; - break; - case "external": - item = { - type: "external", - module: info.module, - runtimeCondition: info.runtimeCondition, - index, - name: undefined, - interopNamespaceObjectUsed: false, - interopNamespaceObjectName: undefined, - interopNamespaceObject2Used: false, - interopNamespaceObject2Name: undefined, - interopDefaultAccessUsed: false, - interopDefaultAccessName: undefined - }; - break; - default: - throw new Error( - `Unsupported concatenation entry type ${info.type}` - ); - } - map.set(item.module, item); - return item; - } else { - /** @type {ReferenceToModuleInfo} */ - const ref = { - type: "reference", - runtimeCondition: info.runtimeCondition, - target: item - }; - return ref; - } - }); - return [list, map]; - } +/** + * @typedef {Object} SplitChunksOptions + * @property {ChunkFilterFunction} chunksFilter + * @property {string[]} defaultSizeTypes + * @property {SplitChunksSizes} minSize + * @property {SplitChunksSizes} minSizeReduction + * @property {SplitChunksSizes} minRemainingSize + * @property {SplitChunksSizes} enforceSizeThreshold + * @property {SplitChunksSizes} maxInitialSize + * @property {SplitChunksSizes} maxAsyncSize + * @property {number} minChunks + * @property {number} maxAsyncRequests + * @property {number} maxInitialRequests + * @property {boolean} hidePathInfo + * @property {string | function(PathData, AssetInfo=): string} filename + * @property {string} automaticNameDelimiter + * @property {GetCacheGroups} getCacheGroups + * @property {GetName} getName + * @property {boolean} usedExports + * @property {FallbackCacheGroup} fallbackCacheGroup + */ - findNewName(oldName, usedNamed1, usedNamed2, extraInfo) { - let name = oldName; - - if (name === ConcatenationScope.DEFAULT_EXPORT) { - name = ""; - } - if (name === ConcatenationScope.NAMESPACE_OBJECT_EXPORT) { - name = "namespaceObject"; - } - - // Remove uncool stuff - extraInfo = extraInfo.replace( - /\.+\/|(\/index)?\.([a-zA-Z0-9]{1,4})($|\s|\?)|\s*\+\s*\d+\s*modules/g, - "" - ); - - const splittedInfo = extraInfo.split("/"); - while (splittedInfo.length) { - name = splittedInfo.pop() + (name ? "_" + name : ""); - const nameIdent = Template.toIdentifier(name); - if ( - !usedNamed1.has(nameIdent) && - (!usedNamed2 || !usedNamed2.has(nameIdent)) - ) - return nameIdent; - } - - let i = 0; - let nameWithNumber = Template.toIdentifier(`${name}_${i}`); - while ( - usedNamed1.has(nameWithNumber) || - (usedNamed2 && usedNamed2.has(nameWithNumber)) - ) { - i++; - nameWithNumber = Template.toIdentifier(`${name}_${i}`); - } - return nameWithNumber; - } - - /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context - * @returns {void} - */ - updateHash(hash, context) { - const { chunkGraph, runtime } = context; - for (const info of this._createConcatenationList( - this.rootModule, - this._modules, - intersectRuntime(runtime, this._runtime), - chunkGraph.moduleGraph - )) { - switch (info.type) { - case "concatenated": - info.module.updateHash(hash, context); - break; - case "external": - hash.update(`${chunkGraph.getModuleId(info.module)}`); - // TODO runtimeCondition - break; - } - } - super.updateHash(hash, context); - } - - static deserialize(context) { - const obj = new ConcatenatedModule({ - identifier: undefined, - rootModule: undefined, - modules: undefined, - runtime: undefined - }); - obj.deserialize(context); - return obj; - } -} - -makeSerializable(ConcatenatedModule, "webpack/lib/optimize/ConcatenatedModule"); - -module.exports = ConcatenatedModule; - - -/***/ }), - -/***/ 96260: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** + * @typedef {Object} ChunksInfoItem + * @property {SortableSet} modules + * @property {CacheGroup} cacheGroup + * @property {number} cacheGroupIndex + * @property {string} name + * @property {Record} sizes + * @property {Set} chunks + * @property {Set} reuseableChunks + * @property {Set} chunksKeys + */ +const defaultGetName = /** @type {GetName} */ (() => {}); +const deterministicGroupingForModules = + /** @type {function(DeterministicGroupingOptionsForModule): DeterministicGroupingGroupedItemsForModule[]} */ ( + deterministicGrouping + ); -const { STAGE_BASIC } = __webpack_require__(80057); +/** @type {WeakMap} */ +const getKeyCache = new WeakMap(); -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../Compiler")} Compiler */ +/** + * @param {string} name a filename to hash + * @param {OutputOptions} outputOptions hash function used + * @returns {string} hashed filename + */ +const hashFilename = (name, outputOptions) => { + const digest = /** @type {string} */ ( + createHash(outputOptions.hashFunction) + .update(name) + .digest(outputOptions.hashDigest) + ); + return digest.slice(0, 8); +}; -class EnsureChunkConditionsPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "EnsureChunkConditionsPlugin", - compilation => { - const handler = chunks => { - const chunkGraph = compilation.chunkGraph; - // These sets are hoisted here to save memory - // They are cleared at the end of every loop - /** @type {Set} */ - const sourceChunks = new Set(); - /** @type {Set} */ - const chunkGroups = new Set(); - for (const module of compilation.modules) { - if (!module.hasChunkCondition()) continue; - for (const chunk of chunkGraph.getModuleChunksIterable(module)) { - if (!module.chunkCondition(chunk, compilation)) { - sourceChunks.add(chunk); - for (const group of chunk.groupsIterable) { - chunkGroups.add(group); - } - } - } - if (sourceChunks.size === 0) continue; - /** @type {Set} */ - const targetChunks = new Set(); - chunkGroupLoop: for (const chunkGroup of chunkGroups) { - // Can module be placed in a chunk of this group? - for (const chunk of chunkGroup.chunks) { - if (module.chunkCondition(chunk, compilation)) { - targetChunks.add(chunk); - continue chunkGroupLoop; - } - } - // We reached the entrypoint: fail - if (chunkGroup.isInitial()) { - throw new Error( - "Cannot fullfil chunk condition of " + module.identifier() - ); - } - // Try placing in all parents - for (const group of chunkGroup.parentsIterable) { - chunkGroups.add(group); - } - } - for (const sourceChunk of sourceChunks) { - chunkGraph.disconnectChunkAndModule(sourceChunk, module); - } - for (const targetChunk of targetChunks) { - chunkGraph.connectChunkAndModule(targetChunk, module); - } - sourceChunks.clear(); - chunkGroups.clear(); - } - }; - compilation.hooks.optimizeChunks.tap( - { - name: "EnsureChunkConditionsPlugin", - stage: STAGE_BASIC - }, - handler - ); - } - ); +/** + * @param {Chunk} chunk the chunk + * @returns {number} the number of requests + */ +const getRequests = chunk => { + let requests = 0; + for (const chunkGroup of chunk.groupsIterable) { + requests = Math.max(requests, chunkGroup.chunks.length); } -} -module.exports = EnsureChunkConditionsPlugin; - - -/***/ }), - -/***/ 50089: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ - -class FlagIncludedChunksPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap("FlagIncludedChunksPlugin", compilation => { - compilation.hooks.optimizeChunkIds.tap( - "FlagIncludedChunksPlugin", - chunks => { - const chunkGraph = compilation.chunkGraph; - - // prepare two bit integers for each module - // 2^31 is the max number represented as SMI in v8 - // we want the bits distributed this way: - // the bit 2^31 is pretty rar and only one module should get it - // so it has a probability of 1 / modulesCount - // the first bit (2^0) is the easiest and every module could get it - // if it doesn't get a better bit - // from bit 2^n to 2^(n+1) there is a probability of p - // so 1 / modulesCount == p^31 - // <=> p = sqrt31(1 / modulesCount) - // so we use a modulo of 1 / sqrt31(1 / modulesCount) - /** @type {WeakMap} */ - const moduleBits = new WeakMap(); - const modulesCount = compilation.modules.size; - - // precalculate the modulo values for each bit - const modulo = 1 / Math.pow(1 / modulesCount, 1 / 31); - const modulos = Array.from( - { length: 31 }, - (x, i) => Math.pow(modulo, i) | 0 - ); - - // iterate all modules to generate bit values - let i = 0; - for (const module of compilation.modules) { - let bit = 30; - while (i % modulos[bit] !== 0) { - bit--; - } - moduleBits.set(module, 1 << bit); - i++; - } - - // iterate all chunks to generate bitmaps - /** @type {WeakMap} */ - const chunkModulesHash = new WeakMap(); - for (const chunk of chunks) { - let hash = 0; - for (const module of chunkGraph.getChunkModulesIterable(chunk)) { - hash |= moduleBits.get(module); - } - chunkModulesHash.set(chunk, hash); - } - - for (const chunkA of chunks) { - const chunkAHash = chunkModulesHash.get(chunkA); - const chunkAModulesCount = - chunkGraph.getNumberOfChunkModules(chunkA); - if (chunkAModulesCount === 0) continue; - let bestModule = undefined; - for (const module of chunkGraph.getChunkModulesIterable(chunkA)) { - if ( - bestModule === undefined || - chunkGraph.getNumberOfModuleChunks(bestModule) > - chunkGraph.getNumberOfModuleChunks(module) - ) - bestModule = module; - } - loopB: for (const chunkB of chunkGraph.getModuleChunksIterable( - bestModule - )) { - // as we iterate the same iterables twice - // skip if we find ourselves - if (chunkA === chunkB) continue; - - const chunkBModulesCount = - chunkGraph.getNumberOfChunkModules(chunkB); - - // ids for empty chunks are not included - if (chunkBModulesCount === 0) continue; - - // instead of swapping A and B just bail - // as we loop twice the current A will be B and B then A - if (chunkAModulesCount > chunkBModulesCount) continue; - - // is chunkA in chunkB? - - // we do a cheap check for the hash value - const chunkBHash = chunkModulesHash.get(chunkB); - if ((chunkBHash & chunkAHash) !== chunkAHash) continue; + return requests; +}; - // compare all modules - for (const m of chunkGraph.getChunkModulesIterable(chunkA)) { - if (!chunkGraph.isModuleInChunk(m, chunkB)) continue loopB; - } - chunkB.ids.push(chunkA.id); - } - } - } - ); - }); +const mapObject = (obj, fn) => { + const newObj = Object.create(null); + for (const key of Object.keys(obj)) { + newObj[key] = fn(obj[key], key); } -} -module.exports = FlagIncludedChunksPlugin; - - -/***/ }), - -/***/ 38988: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sergey Melyukov @smelukov -*/ - - - -const { UsageState } = __webpack_require__(63686); - -/** @typedef {import("estree").Node} AnyNode */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - -/** @typedef {Map | true>} InnerGraph */ -/** @typedef {function(boolean | Set | undefined): void} UsageCallback */ + return newObj; +}; /** - * @typedef {Object} StateObject - * @property {InnerGraph} innerGraph - * @property {TopLevelSymbol=} currentTopLevelSymbol - * @property {Map>} usageCallbackMap + * @template T + * @param {Set} a set + * @param {Set} b other set + * @returns {boolean} true if at least one item of a is in b */ +const isOverlap = (a, b) => { + for (const item of a) { + if (b.has(item)) return true; + } + return false; +}; -/** @typedef {false|StateObject} State */ - -/** @type {WeakMap} */ -const parserStateMap = new WeakMap(); -const topLevelSymbolTag = Symbol("top level symbol"); +const compareModuleIterables = compareIterables(compareModulesByIdentifier); /** - * @param {ParserState} parserState parser state - * @returns {State} state + * @param {ChunksInfoItem} a item + * @param {ChunksInfoItem} b item + * @returns {number} compare result */ -function getState(parserState) { - return parserStateMap.get(parserState); -} +const compareEntries = (a, b) => { + // 1. by priority + const diffPriority = a.cacheGroup.priority - b.cacheGroup.priority; + if (diffPriority) return diffPriority; + // 2. by number of chunks + const diffCount = a.chunks.size - b.chunks.size; + if (diffCount) return diffCount; + // 3. by size reduction + const aSizeReduce = totalSize(a.sizes) * (a.chunks.size - 1); + const bSizeReduce = totalSize(b.sizes) * (b.chunks.size - 1); + const diffSizeReduce = aSizeReduce - bSizeReduce; + if (diffSizeReduce) return diffSizeReduce; + // 4. by cache group index + const indexDiff = b.cacheGroupIndex - a.cacheGroupIndex; + if (indexDiff) return indexDiff; + // 5. by number of modules (to be able to compare by identifier) + const modulesA = a.modules; + const modulesB = b.modules; + const diff = modulesA.size - modulesB.size; + if (diff) return diff; + // 6. by module identifiers + modulesA.sort(); + modulesB.sort(); + return compareModuleIterables(modulesA, modulesB); +}; + +const INITIAL_CHUNK_FILTER = chunk => chunk.canBeInitial(); +const ASYNC_CHUNK_FILTER = chunk => !chunk.canBeInitial(); +const ALL_CHUNK_FILTER = chunk => true; /** - * @param {ParserState} parserState parser state - * @returns {void} + * @param {OptimizationSplitChunksSizes} value the sizes + * @param {string[]} defaultSizeTypes the default size types + * @returns {SplitChunksSizes} normalized representation */ -exports.bailout = parserState => { - parserStateMap.set(parserState, false); +const normalizeSizes = (value, defaultSizeTypes) => { + if (typeof value === "number") { + /** @type {Record} */ + const o = {}; + for (const sizeType of defaultSizeTypes) o[sizeType] = value; + return o; + } else if (typeof value === "object" && value !== null) { + return { ...value }; + } else { + return {}; + } }; /** - * @param {ParserState} parserState parser state - * @returns {void} + * @param {...SplitChunksSizes} sizes the sizes + * @returns {SplitChunksSizes} the merged sizes */ -exports.enable = parserState => { - const state = parserStateMap.get(parserState); - if (state === false) { - return; +const mergeSizes = (...sizes) => { + /** @type {SplitChunksSizes} */ + let merged = {}; + for (let i = sizes.length - 1; i >= 0; i--) { + merged = Object.assign(merged, sizes[i]); } - parserStateMap.set(parserState, { - innerGraph: new Map(), - currentTopLevelSymbol: undefined, - usageCallbackMap: new Map() - }); + return merged; }; /** - * @param {ParserState} parserState parser state - * @returns {boolean} true, when enabled + * @param {SplitChunksSizes} sizes the sizes + * @returns {boolean} true, if there are sizes > 0 */ -exports.isEnabled = parserState => { - const state = parserStateMap.get(parserState); - return !!state; +const hasNonZeroSizes = sizes => { + for (const key of Object.keys(sizes)) { + if (sizes[key] > 0) return true; + } + return false; }; /** - * @param {ParserState} state parser state - * @param {TopLevelSymbol | null} symbol the symbol, or null for all symbols - * @param {string | TopLevelSymbol | true} usage usage data - * @returns {void} + * @param {SplitChunksSizes} a first sizes + * @param {SplitChunksSizes} b second sizes + * @param {CombineSizeFunction} combine a function to combine sizes + * @returns {SplitChunksSizes} the combine sizes */ -exports.addUsage = (state, symbol, usage) => { - const innerGraphState = getState(state); - - if (innerGraphState) { - const { innerGraph } = innerGraphState; - const info = innerGraph.get(symbol); - if (usage === true) { - innerGraph.set(symbol, true); - } else if (info === undefined) { - innerGraph.set(symbol, new Set([usage])); - } else if (info !== true) { - info.add(usage); +const combineSizes = (a, b, combine) => { + const aKeys = new Set(Object.keys(a)); + const bKeys = new Set(Object.keys(b)); + /** @type {SplitChunksSizes} */ + const result = {}; + for (const key of aKeys) { + if (bKeys.has(key)) { + result[key] = combine(a[key], b[key]); + } else { + result[key] = a[key]; + } + } + for (const key of bKeys) { + if (!aKeys.has(key)) { + result[key] = b[key]; } } + return result; }; /** - * @param {JavascriptParser} parser the parser - * @param {string} name name of variable - * @param {string | TopLevelSymbol | true} usage usage data - * @returns {void} + * @param {SplitChunksSizes} sizes the sizes + * @param {SplitChunksSizes} minSize the min sizes + * @returns {boolean} true if there are sizes and all existing sizes are at least `minSize` */ -exports.addVariableUsage = (parser, name, usage) => { - const symbol = - /** @type {TopLevelSymbol} */ ( - parser.getTagData(name, topLevelSymbolTag) - ) || exports.tagTopLevelSymbol(parser, name); - if (symbol) { - exports.addUsage(parser.state, symbol, usage); +const checkMinSize = (sizes, minSize) => { + for (const key of Object.keys(minSize)) { + const size = sizes[key]; + if (size === undefined || size === 0) continue; + if (size < minSize[key]) return false; } + return true; }; /** - * @param {ParserState} state parser state - * @returns {void} + * @param {SplitChunksSizes} sizes the sizes + * @param {SplitChunksSizes} minSizeReduction the min sizes + * @param {number} chunkCount number of chunks + * @returns {boolean} true if there are sizes and all existing sizes are at least `minSizeReduction` */ -exports.inferDependencyUsage = state => { - const innerGraphState = getState(state); - - if (!innerGraphState) { - return; +const checkMinSizeReduction = (sizes, minSizeReduction, chunkCount) => { + for (const key of Object.keys(minSizeReduction)) { + const size = sizes[key]; + if (size === undefined || size === 0) continue; + if (size * chunkCount < minSizeReduction[key]) return false; } + return true; +}; - const { innerGraph, usageCallbackMap } = innerGraphState; - const processed = new Map(); - // flatten graph to terminal nodes (string, undefined or true) - const nonTerminal = new Set(innerGraph.keys()); - while (nonTerminal.size > 0) { - for (const key of nonTerminal) { - /** @type {Set | true} */ - let newSet = new Set(); - let isTerminal = true; - const value = innerGraph.get(key); - let alreadyProcessed = processed.get(key); - if (alreadyProcessed === undefined) { - alreadyProcessed = new Set(); - processed.set(key, alreadyProcessed); - } - if (value !== true && value !== undefined) { - for (const item of value) { - alreadyProcessed.add(item); - } - for (const item of value) { - if (typeof item === "string") { - newSet.add(item); - } else { - const itemValue = innerGraph.get(item); - if (itemValue === true) { - newSet = true; - break; - } - if (itemValue !== undefined) { - for (const i of itemValue) { - if (i === key) continue; - if (alreadyProcessed.has(i)) continue; - newSet.add(i); - if (typeof i !== "string") { - isTerminal = false; - } - } - } - } - } - if (newSet === true) { - innerGraph.set(key, true); - } else if (newSet.size === 0) { - innerGraph.set(key, undefined); - } else { - innerGraph.set(key, newSet); - } - } - if (isTerminal) { - nonTerminal.delete(key); - - // For the global key, merge with all other keys - if (key === null) { - const globalValue = innerGraph.get(null); - if (globalValue) { - for (const [key, value] of innerGraph) { - if (key !== null && value !== true) { - if (globalValue === true) { - innerGraph.set(key, true); - } else { - const newSet = new Set(value); - for (const item of globalValue) { - newSet.add(item); - } - innerGraph.set(key, newSet); - } - } - } - } - } - } +/** + * @param {SplitChunksSizes} sizes the sizes + * @param {SplitChunksSizes} minSize the min sizes + * @returns {undefined | string[]} list of size types that are below min size + */ +const getViolatingMinSizes = (sizes, minSize) => { + let list; + for (const key of Object.keys(minSize)) { + const size = sizes[key]; + if (size === undefined || size === 0) continue; + if (size < minSize[key]) { + if (list === undefined) list = [key]; + else list.push(key); } } + return list; +}; - /** @type {Map>} */ - for (const [symbol, callbacks] of usageCallbackMap) { - const usage = /** @type {true | Set | undefined} */ ( - innerGraph.get(symbol) - ); - for (const callback of callbacks) { - callback(usage === undefined ? false : usage); - } +/** + * @param {SplitChunksSizes} sizes the sizes + * @returns {number} the total size + */ +const totalSize = sizes => { + let size = 0; + for (const key of Object.keys(sizes)) { + size += sizes[key]; } + return size; }; /** - * @param {ParserState} state parser state - * @param {UsageCallback} onUsageCallback on usage callback + * @param {false|string|Function} name the chunk name + * @returns {GetName} a function to get the name of the chunk */ -exports.onUsage = (state, onUsageCallback) => { - const innerGraphState = getState(state); - - if (innerGraphState) { - const { usageCallbackMap, currentTopLevelSymbol } = innerGraphState; - if (currentTopLevelSymbol) { - let callbacks = usageCallbackMap.get(currentTopLevelSymbol); - - if (callbacks === undefined) { - callbacks = new Set(); - usageCallbackMap.set(currentTopLevelSymbol, callbacks); - } - - callbacks.add(onUsageCallback); - } else { - onUsageCallback(true); - } - } else { - onUsageCallback(undefined); +const normalizeName = name => { + if (typeof name === "string") { + return () => name; + } + if (typeof name === "function") { + return /** @type {GetName} */ (name); } }; /** - * @param {ParserState} state parser state - * @param {TopLevelSymbol} symbol the symbol + * @param {OptimizationSplitChunksCacheGroup["chunks"]} chunks the chunk filter option + * @returns {ChunkFilterFunction} the chunk filter function */ -exports.setTopLevelSymbol = (state, symbol) => { - const innerGraphState = getState(state); - - if (innerGraphState) { - innerGraphState.currentTopLevelSymbol = symbol; +const normalizeChunksFilter = chunks => { + if (chunks === "initial") { + return INITIAL_CHUNK_FILTER; + } + if (chunks === "async") { + return ASYNC_CHUNK_FILTER; + } + if (chunks === "all") { + return ALL_CHUNK_FILTER; + } + if (typeof chunks === "function") { + return chunks; } }; /** - * @param {ParserState} state parser state - * @returns {TopLevelSymbol|void} usage data + * @param {GetCacheGroups | Record} cacheGroups the cache group options + * @param {string[]} defaultSizeTypes the default size types + * @returns {GetCacheGroups} a function to get the cache groups */ -exports.getTopLevelSymbol = state => { - const innerGraphState = getState(state); - - if (innerGraphState) { - return innerGraphState.currentTopLevelSymbol; +const normalizeCacheGroups = (cacheGroups, defaultSizeTypes) => { + if (typeof cacheGroups === "function") { + return cacheGroups; + } + if (typeof cacheGroups === "object" && cacheGroups !== null) { + /** @type {(function(Module, CacheGroupsContext, CacheGroupSource[]): void)[]} */ + const handlers = []; + for (const key of Object.keys(cacheGroups)) { + const option = cacheGroups[key]; + if (option === false) { + continue; + } + if (typeof option === "string" || option instanceof RegExp) { + const source = createCacheGroupSource({}, key, defaultSizeTypes); + handlers.push((module, context, results) => { + if (checkTest(option, module, context)) { + results.push(source); + } + }); + } else if (typeof option === "function") { + const cache = new WeakMap(); + handlers.push((module, context, results) => { + const result = option(module); + if (result) { + const groups = Array.isArray(result) ? result : [result]; + for (const group of groups) { + const cachedSource = cache.get(group); + if (cachedSource !== undefined) { + results.push(cachedSource); + } else { + const source = createCacheGroupSource( + group, + key, + defaultSizeTypes + ); + cache.set(group, source); + results.push(source); + } + } + } + }); + } else { + const source = createCacheGroupSource(option, key, defaultSizeTypes); + handlers.push((module, context, results) => { + if ( + checkTest(option.test, module, context) && + checkModuleType(option.type, module) && + checkModuleLayer(option.layer, module) + ) { + results.push(source); + } + }); + } + } + /** + * @param {Module} module the current module + * @param {CacheGroupsContext} context the current context + * @returns {CacheGroupSource[]} the matching cache groups + */ + const fn = (module, context) => { + /** @type {CacheGroupSource[]} */ + let results = []; + for (const fn of handlers) { + fn(module, context, results); + } + return results; + }; + return fn; } + return () => null; }; /** - * @param {JavascriptParser} parser parser - * @param {string} name name of variable - * @returns {TopLevelSymbol} symbol + * @param {undefined|boolean|string|RegExp|Function} test test option + * @param {Module} module the module + * @param {CacheGroupsContext} context context object + * @returns {boolean} true, if the module should be selected */ -exports.tagTopLevelSymbol = (parser, name) => { - const innerGraphState = getState(parser.state); - if (!innerGraphState) return; - - parser.defineVariable(name); - - const existingTag = /** @type {TopLevelSymbol} */ ( - parser.getTagData(name, topLevelSymbolTag) - ); - if (existingTag) { - return existingTag; +const checkTest = (test, module, context) => { + if (test === undefined) return true; + if (typeof test === "function") { + return test(module, context); } - - const fn = new TopLevelSymbol(name); - parser.tagVariable(name, topLevelSymbolTag, fn); - return fn; + if (typeof test === "boolean") return test; + if (typeof test === "string") { + const name = module.nameForCondition(); + return name && name.startsWith(test); + } + if (test instanceof RegExp) { + const name = module.nameForCondition(); + return name && test.test(name); + } + return false; }; /** - * @param {Dependency} dependency the dependency - * @param {Set | boolean} usedByExports usedByExports info - * @param {ModuleGraph} moduleGraph moduleGraph - * @param {RuntimeSpec} runtime runtime - * @returns {boolean} false, when unused. Otherwise true + * @param {undefined|string|RegExp|Function} test type option + * @param {Module} module the module + * @returns {boolean} true, if the module should be selected */ -exports.isDependencyUsedByExports = ( - dependency, - usedByExports, - moduleGraph, - runtime -) => { - if (usedByExports === false) return false; - if (usedByExports !== true && usedByExports !== undefined) { - const selfModule = moduleGraph.getParentModule(dependency); - const exportsInfo = moduleGraph.getExportsInfo(selfModule); - let used = false; - for (const exportName of usedByExports) { - if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) - used = true; - } - if (!used) return false; +const checkModuleType = (test, module) => { + if (test === undefined) return true; + if (typeof test === "function") { + return test(module.type); } - return true; + if (typeof test === "string") { + const type = module.type; + return test === type; + } + if (test instanceof RegExp) { + const type = module.type; + return test.test(type); + } + return false; }; /** - * @param {Dependency} dependency the dependency - * @param {Set | boolean} usedByExports usedByExports info - * @param {ModuleGraph} moduleGraph moduleGraph - * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active + * @param {undefined|string|RegExp|Function} test type option + * @param {Module} module the module + * @returns {boolean} true, if the module should be selected */ -exports.getDependencyUsedByExportsCondition = ( - dependency, - usedByExports, - moduleGraph -) => { - if (usedByExports === false) return false; - if (usedByExports !== true && usedByExports !== undefined) { - const selfModule = moduleGraph.getParentModule(dependency); - const exportsInfo = moduleGraph.getExportsInfo(selfModule); - return (connections, runtime) => { - for (const exportName of usedByExports) { - if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) - return true; - } - return false; - }; +const checkModuleLayer = (test, module) => { + if (test === undefined) return true; + if (typeof test === "function") { + return test(module.layer); } - return null; + if (typeof test === "string") { + const layer = module.layer; + return test === "" ? !layer : layer && layer.startsWith(test); + } + if (test instanceof RegExp) { + const layer = module.layer; + return test.test(layer); + } + return false; }; -class TopLevelSymbol { +/** + * @param {OptimizationSplitChunksCacheGroup} options the group options + * @param {string} key key of cache group + * @param {string[]} defaultSizeTypes the default size types + * @returns {CacheGroupSource} the normalized cached group + */ +const createCacheGroupSource = (options, key, defaultSizeTypes) => { + const minSize = normalizeSizes(options.minSize, defaultSizeTypes); + const minSizeReduction = normalizeSizes( + options.minSizeReduction, + defaultSizeTypes + ); + const maxSize = normalizeSizes(options.maxSize, defaultSizeTypes); + return { + key, + priority: options.priority, + getName: normalizeName(options.name), + chunksFilter: normalizeChunksFilter(options.chunks), + enforce: options.enforce, + minSize, + minSizeReduction, + minRemainingSize: mergeSizes( + normalizeSizes(options.minRemainingSize, defaultSizeTypes), + minSize + ), + enforceSizeThreshold: normalizeSizes( + options.enforceSizeThreshold, + defaultSizeTypes + ), + maxAsyncSize: mergeSizes( + normalizeSizes(options.maxAsyncSize, defaultSizeTypes), + maxSize + ), + maxInitialSize: mergeSizes( + normalizeSizes(options.maxInitialSize, defaultSizeTypes), + maxSize + ), + minChunks: options.minChunks, + maxAsyncRequests: options.maxAsyncRequests, + maxInitialRequests: options.maxInitialRequests, + filename: options.filename, + idHint: options.idHint, + automaticNameDelimiter: options.automaticNameDelimiter, + reuseExistingChunk: options.reuseExistingChunk, + usedExports: options.usedExports + }; +}; + +module.exports = class SplitChunksPlugin { /** - * @param {string} name name of the variable + * @param {OptimizationSplitChunksOptions=} options plugin options */ - constructor(name) { - this.name = name; - } -} - -exports.TopLevelSymbol = TopLevelSymbol; -exports.topLevelSymbolTag = topLevelSymbolTag; - - -/***/ }), - -/***/ 28758: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - + constructor(options = {}) { + const defaultSizeTypes = options.defaultSizeTypes || [ + "javascript", + "unknown" + ]; + const fallbackCacheGroup = options.fallbackCacheGroup || {}; + const minSize = normalizeSizes(options.minSize, defaultSizeTypes); + const minSizeReduction = normalizeSizes( + options.minSizeReduction, + defaultSizeTypes + ); + const maxSize = normalizeSizes(options.maxSize, defaultSizeTypes); + /** @type {SplitChunksOptions} */ + this.options = { + chunksFilter: normalizeChunksFilter(options.chunks || "all"), + defaultSizeTypes, + minSize, + minSizeReduction, + minRemainingSize: mergeSizes( + normalizeSizes(options.minRemainingSize, defaultSizeTypes), + minSize + ), + enforceSizeThreshold: normalizeSizes( + options.enforceSizeThreshold, + defaultSizeTypes + ), + maxAsyncSize: mergeSizes( + normalizeSizes(options.maxAsyncSize, defaultSizeTypes), + maxSize + ), + maxInitialSize: mergeSizes( + normalizeSizes(options.maxInitialSize, defaultSizeTypes), + maxSize + ), + minChunks: options.minChunks || 1, + maxAsyncRequests: options.maxAsyncRequests || 1, + maxInitialRequests: options.maxInitialRequests || 1, + hidePathInfo: options.hidePathInfo || false, + filename: options.filename || undefined, + getCacheGroups: normalizeCacheGroups( + options.cacheGroups, + defaultSizeTypes + ), + getName: options.name ? normalizeName(options.name) : defaultGetName, + automaticNameDelimiter: options.automaticNameDelimiter, + usedExports: options.usedExports, + fallbackCacheGroup: { + chunksFilter: normalizeChunksFilter( + fallbackCacheGroup.chunks || options.chunks || "all" + ), + minSize: mergeSizes( + normalizeSizes(fallbackCacheGroup.minSize, defaultSizeTypes), + minSize + ), + maxAsyncSize: mergeSizes( + normalizeSizes(fallbackCacheGroup.maxAsyncSize, defaultSizeTypes), + normalizeSizes(fallbackCacheGroup.maxSize, defaultSizeTypes), + normalizeSizes(options.maxAsyncSize, defaultSizeTypes), + normalizeSizes(options.maxSize, defaultSizeTypes) + ), + maxInitialSize: mergeSizes( + normalizeSizes(fallbackCacheGroup.maxInitialSize, defaultSizeTypes), + normalizeSizes(fallbackCacheGroup.maxSize, defaultSizeTypes), + normalizeSizes(options.maxInitialSize, defaultSizeTypes), + normalizeSizes(options.maxSize, defaultSizeTypes) + ), + automaticNameDelimiter: + fallbackCacheGroup.automaticNameDelimiter || + options.automaticNameDelimiter || + "~" + } + }; -const PureExpressionDependency = __webpack_require__(55799); -const InnerGraph = __webpack_require__(38988); + /** @type {WeakMap} */ + this._cacheGroupCache = new WeakMap(); + } -/** @typedef {import("estree").ClassDeclaration} ClassDeclarationNode */ -/** @typedef {import("estree").ClassExpression} ClassExpressionNode */ -/** @typedef {import("estree").Node} Node */ -/** @typedef {import("estree").VariableDeclarator} VariableDeclaratorNode */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../dependencies/HarmonyImportSpecifierDependency")} HarmonyImportSpecifierDependency */ -/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ -/** @typedef {import("./InnerGraph").InnerGraph} InnerGraph */ -/** @typedef {import("./InnerGraph").TopLevelSymbol} TopLevelSymbol */ - -const { topLevelSymbolTag } = InnerGraph; + /** + * @param {CacheGroupSource} cacheGroupSource source + * @returns {CacheGroup} the cache group (cached) + */ + _getCacheGroup(cacheGroupSource) { + const cacheEntry = this._cacheGroupCache.get(cacheGroupSource); + if (cacheEntry !== undefined) return cacheEntry; + const minSize = mergeSizes( + cacheGroupSource.minSize, + cacheGroupSource.enforce ? undefined : this.options.minSize + ); + const minSizeReduction = mergeSizes( + cacheGroupSource.minSizeReduction, + cacheGroupSource.enforce ? undefined : this.options.minSizeReduction + ); + const minRemainingSize = mergeSizes( + cacheGroupSource.minRemainingSize, + cacheGroupSource.enforce ? undefined : this.options.minRemainingSize + ); + const enforceSizeThreshold = mergeSizes( + cacheGroupSource.enforceSizeThreshold, + cacheGroupSource.enforce ? undefined : this.options.enforceSizeThreshold + ); + const cacheGroup = { + key: cacheGroupSource.key, + priority: cacheGroupSource.priority || 0, + chunksFilter: cacheGroupSource.chunksFilter || this.options.chunksFilter, + minSize, + minSizeReduction, + minRemainingSize, + enforceSizeThreshold, + maxAsyncSize: mergeSizes( + cacheGroupSource.maxAsyncSize, + cacheGroupSource.enforce ? undefined : this.options.maxAsyncSize + ), + maxInitialSize: mergeSizes( + cacheGroupSource.maxInitialSize, + cacheGroupSource.enforce ? undefined : this.options.maxInitialSize + ), + minChunks: + cacheGroupSource.minChunks !== undefined + ? cacheGroupSource.minChunks + : cacheGroupSource.enforce + ? 1 + : this.options.minChunks, + maxAsyncRequests: + cacheGroupSource.maxAsyncRequests !== undefined + ? cacheGroupSource.maxAsyncRequests + : cacheGroupSource.enforce + ? Infinity + : this.options.maxAsyncRequests, + maxInitialRequests: + cacheGroupSource.maxInitialRequests !== undefined + ? cacheGroupSource.maxInitialRequests + : cacheGroupSource.enforce + ? Infinity + : this.options.maxInitialRequests, + getName: + cacheGroupSource.getName !== undefined + ? cacheGroupSource.getName + : this.options.getName, + usedExports: + cacheGroupSource.usedExports !== undefined + ? cacheGroupSource.usedExports + : this.options.usedExports, + filename: + cacheGroupSource.filename !== undefined + ? cacheGroupSource.filename + : this.options.filename, + automaticNameDelimiter: + cacheGroupSource.automaticNameDelimiter !== undefined + ? cacheGroupSource.automaticNameDelimiter + : this.options.automaticNameDelimiter, + idHint: + cacheGroupSource.idHint !== undefined + ? cacheGroupSource.idHint + : cacheGroupSource.key, + reuseExistingChunk: cacheGroupSource.reuseExistingChunk || false, + _validateSize: hasNonZeroSizes(minSize), + _validateRemainingSize: hasNonZeroSizes(minRemainingSize), + _minSizeForMaxSize: mergeSizes( + cacheGroupSource.minSize, + this.options.minSize + ), + _conditionalEnforce: hasNonZeroSizes(enforceSizeThreshold) + }; + this._cacheGroupCache.set(cacheGroupSource, cacheGroup); + return cacheGroup; + } -class InnerGraphPlugin { /** * Apply the plugin * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap( - "InnerGraphPlugin", - (compilation, { normalModuleFactory }) => { - const logger = compilation.getLogger("webpack.InnerGraphPlugin"); - - compilation.dependencyTemplates.set( - PureExpressionDependency, - new PureExpressionDependency.Template() - ); + const cachedMakePathsRelative = makePathsRelative.bindContextCache( + compiler.context, + compiler.root + ); + compiler.hooks.thisCompilation.tap("SplitChunksPlugin", compilation => { + const logger = compilation.getLogger("webpack.SplitChunksPlugin"); + let alreadyOptimized = false; + compilation.hooks.unseal.tap("SplitChunksPlugin", () => { + alreadyOptimized = false; + }); + compilation.hooks.optimizeChunks.tap( + { + name: "SplitChunksPlugin", + stage: STAGE_ADVANCED + }, + chunks => { + if (alreadyOptimized) return; + alreadyOptimized = true; + logger.time("prepare"); + const chunkGraph = compilation.chunkGraph; + const moduleGraph = compilation.moduleGraph; + // Give each selected chunk an index (to create strings from chunks) + /** @type {Map} */ + const chunkIndexMap = new Map(); + const ZERO = BigInt("0"); + const ONE = BigInt("1"); + const START = ONE << BigInt("31"); + let index = START; + for (const chunk of chunks) { + chunkIndexMap.set( + chunk, + index | BigInt((Math.random() * 0x7fffffff) | 0) + ); + index = index << ONE; + } + /** + * @param {Iterable} chunks list of chunks + * @returns {bigint | Chunk} key of the chunks + */ + const getKey = chunks => { + const iterator = chunks[Symbol.iterator](); + let result = iterator.next(); + if (result.done) return ZERO; + const first = result.value; + result = iterator.next(); + if (result.done) return first; + let key = + chunkIndexMap.get(first) | chunkIndexMap.get(result.value); + while (!(result = iterator.next()).done) { + const raw = chunkIndexMap.get(result.value); + key = key ^ raw; + } + return key; + }; + const keyToString = key => { + if (typeof key === "bigint") return key.toString(16); + return chunkIndexMap.get(key).toString(16); + }; - /** - * @param {JavascriptParser} parser the parser - * @param {Object} parserOptions options - * @returns {void} - */ - const handler = (parser, parserOptions) => { - const onUsageSuper = sup => { - InnerGraph.onUsage(parser.state, usedByExports => { - switch (usedByExports) { - case undefined: - case true: - return; - default: { - const dep = new PureExpressionDependency(sup.range); - dep.loc = sup.loc; - dep.usedByExports = usedByExports; - parser.state.module.addDependency(dep); - break; + const getChunkSetsInGraph = memoize(() => { + /** @type {Map>} */ + const chunkSetsInGraph = new Map(); + /** @type {Set} */ + const singleChunkSets = new Set(); + for (const module of compilation.modules) { + const chunks = chunkGraph.getModuleChunksIterable(module); + const chunksKey = getKey(chunks); + if (typeof chunksKey === "bigint") { + if (!chunkSetsInGraph.has(chunksKey)) { + chunkSetsInGraph.set(chunksKey, new Set(chunks)); } + } else { + singleChunkSets.add(chunksKey); } - }); - }; - - parser.hooks.program.tap("InnerGraphPlugin", () => { - InnerGraph.enable(parser.state); - }); - - parser.hooks.finish.tap("InnerGraphPlugin", () => { - if (!InnerGraph.isEnabled(parser.state)) return; - - logger.time("infer dependency usage"); - InnerGraph.inferDependencyUsage(parser.state); - logger.timeAggregate("infer dependency usage"); + } + return { chunkSetsInGraph, singleChunkSets }; }); - // During prewalking the following datastructures are filled with - // nodes that have a TopLevelSymbol assigned and - // variables are tagged with the assigned TopLevelSymbol - - // We differ 3 types of nodes: - // 1. full statements (export default, function declaration) - // 2. classes (class declaration, class expression) - // 3. variable declarators (const x = ...) - - /** @type {WeakMap} */ - const statementWithTopLevelSymbol = new WeakMap(); - /** @type {WeakMap} */ - const statementPurePart = new WeakMap(); - - /** @type {WeakMap} */ - const classWithTopLevelSymbol = new WeakMap(); - - /** @type {WeakMap} */ - const declWithTopLevelSymbol = new WeakMap(); - /** @type {WeakSet} */ - const pureDeclarators = new WeakSet(); - - // The following hooks are used during prewalking: - - parser.hooks.preStatement.tap("InnerGraphPlugin", statement => { - if (!InnerGraph.isEnabled(parser.state)) return; - - if (parser.scope.topLevelScope === true) { - if (statement.type === "FunctionDeclaration") { - const name = statement.id ? statement.id.name : "*default*"; - const fn = InnerGraph.tagTopLevelSymbol(parser, name); - statementWithTopLevelSymbol.set(statement, fn); - return true; + /** + * @param {Module} module the module + * @returns {Iterable} groups of chunks with equal exports + */ + const groupChunksByExports = module => { + const exportsInfo = moduleGraph.getExportsInfo(module); + const groupedByUsedExports = new Map(); + for (const chunk of chunkGraph.getModuleChunksIterable(module)) { + const key = exportsInfo.getUsageKey(chunk.runtime); + const list = groupedByUsedExports.get(key); + if (list !== undefined) { + list.push(chunk); + } else { + groupedByUsedExports.set(key, [chunk]); } } - }); + return groupedByUsedExports.values(); + }; - parser.hooks.blockPreStatement.tap("InnerGraphPlugin", statement => { - if (!InnerGraph.isEnabled(parser.state)) return; + /** @type {Map>} */ + const groupedByExportsMap = new Map(); - if (parser.scope.topLevelScope === true) { - if (statement.type === "ClassDeclaration") { - const name = statement.id ? statement.id.name : "*default*"; - const fn = InnerGraph.tagTopLevelSymbol(parser, name); - classWithTopLevelSymbol.set(statement, fn); - return true; - } - if (statement.type === "ExportDefaultDeclaration") { - const name = "*default*"; - const fn = InnerGraph.tagTopLevelSymbol(parser, name); - const decl = statement.declaration; - if ( - decl.type === "ClassExpression" || - decl.type === "ClassDeclaration" - ) { - classWithTopLevelSymbol.set(decl, fn); - } else if (parser.isPure(decl, statement.range[0])) { - statementWithTopLevelSymbol.set(statement, fn); - if ( - !decl.type.endsWith("FunctionExpression") && - !decl.type.endsWith("Declaration") && - decl.type !== "Literal" - ) { - statementPurePart.set(statement, decl); + const getExportsChunkSetsInGraph = memoize(() => { + /** @type {Map>} */ + const chunkSetsInGraph = new Map(); + /** @type {Set} */ + const singleChunkSets = new Set(); + for (const module of compilation.modules) { + const groupedChunks = Array.from(groupChunksByExports(module)); + groupedByExportsMap.set(module, groupedChunks); + for (const chunks of groupedChunks) { + if (chunks.length === 1) { + singleChunkSets.add(chunks[0]); + } else { + const chunksKey = /** @type {bigint} */ (getKey(chunks)); + if (!chunkSetsInGraph.has(chunksKey)) { + chunkSetsInGraph.set(chunksKey, new Set(chunks)); } } } } + return { chunkSetsInGraph, singleChunkSets }; }); - parser.hooks.preDeclarator.tap( - "InnerGraphPlugin", - (decl, statement) => { - if (!InnerGraph.isEnabled(parser.state)) return; - if ( - parser.scope.topLevelScope === true && - decl.init && - decl.id.type === "Identifier" - ) { - const name = decl.id.name; - if (decl.init.type === "ClassExpression") { - const fn = InnerGraph.tagTopLevelSymbol(parser, name); - classWithTopLevelSymbol.set(decl.init, fn); - } else if (parser.isPure(decl.init, decl.id.range[1])) { - const fn = InnerGraph.tagTopLevelSymbol(parser, name); - declWithTopLevelSymbol.set(decl, fn); - if ( - !decl.init.type.endsWith("FunctionExpression") && - decl.init.type !== "Literal" - ) { - pureDeclarators.add(decl); - } - return true; - } + // group these set of chunks by count + // to allow to check less sets via isSubset + // (only smaller sets can be subset) + const groupChunkSetsByCount = chunkSets => { + /** @type {Map>>} */ + const chunkSetsByCount = new Map(); + for (const chunksSet of chunkSets) { + const count = chunksSet.size; + let array = chunkSetsByCount.get(count); + if (array === undefined) { + array = []; + chunkSetsByCount.set(count, array); } + array.push(chunksSet); } + return chunkSetsByCount; + }; + const getChunkSetsByCount = memoize(() => + groupChunkSetsByCount( + getChunkSetsInGraph().chunkSetsInGraph.values() + ) + ); + const getExportsChunkSetsByCount = memoize(() => + groupChunkSetsByCount( + getExportsChunkSetsInGraph().chunkSetsInGraph.values() + ) ); - // During real walking we set the TopLevelSymbol state to the assigned - // TopLevelSymbol by using the fill datastructures. - - // In addition to tracking TopLevelSymbols, we sometimes need to - // add a PureExpressionDependency. This is needed to skip execution - // of pure expressions, even when they are not dropped due to - // minimizing. Otherwise symbols used there might not exist anymore - // as they are removed as unused by this optimization - - // When we find a reference to a TopLevelSymbol, we register a - // TopLevelSymbol dependency from TopLevelSymbol in state to the - // referenced TopLevelSymbol. This way we get a graph of all - // TopLevelSymbols. - - // The following hooks are called during walking: - - parser.hooks.statement.tap("InnerGraphPlugin", statement => { - if (!InnerGraph.isEnabled(parser.state)) return; - if (parser.scope.topLevelScope === true) { - InnerGraph.setTopLevelSymbol(parser.state, undefined); + // Create a list of possible combinations + const createGetCombinations = ( + chunkSets, + singleChunkSets, + chunkSetsByCount + ) => { + /** @type {Map | Chunk)[]>} */ + const combinationsCache = new Map(); - const fn = statementWithTopLevelSymbol.get(statement); - if (fn) { - InnerGraph.setTopLevelSymbol(parser.state, fn); - const purePart = statementPurePart.get(statement); - if (purePart) { - InnerGraph.onUsage(parser.state, usedByExports => { - switch (usedByExports) { - case undefined: - case true: - return; - default: { - const dep = new PureExpressionDependency( - purePart.range - ); - dep.loc = statement.loc; - dep.usedByExports = usedByExports; - parser.state.module.addDependency(dep); - break; - } + return key => { + const cacheEntry = combinationsCache.get(key); + if (cacheEntry !== undefined) return cacheEntry; + if (key instanceof Chunk) { + const result = [key]; + combinationsCache.set(key, result); + return result; + } + const chunksSet = chunkSets.get(key); + /** @type {(Set | Chunk)[]} */ + const array = [chunksSet]; + for (const [count, setArray] of chunkSetsByCount) { + // "equal" is not needed because they would have been merge in the first step + if (count < chunksSet.size) { + for (const set of setArray) { + if (isSubset(chunksSet, set)) { + array.push(set); } - }); + } } } - } + for (const chunk of singleChunkSets) { + if (chunksSet.has(chunk)) { + array.push(chunk); + } + } + combinationsCache.set(key, array); + return array; + }; + }; + + const getCombinationsFactory = memoize(() => { + const { chunkSetsInGraph, singleChunkSets } = getChunkSetsInGraph(); + return createGetCombinations( + chunkSetsInGraph, + singleChunkSets, + getChunkSetsByCount() + ); }); + const getCombinations = key => getCombinationsFactory()(key); - parser.hooks.classExtendsExpression.tap( - "InnerGraphPlugin", - (expr, statement) => { - if (!InnerGraph.isEnabled(parser.state)) return; - if (parser.scope.topLevelScope === true) { - const fn = classWithTopLevelSymbol.get(statement); - if ( - fn && - parser.isPure( - expr, - statement.id ? statement.id.range[1] : statement.range[0] - ) - ) { - InnerGraph.setTopLevelSymbol(parser.state, fn); - onUsageSuper(expr); + const getExportsCombinationsFactory = memoize(() => { + const { chunkSetsInGraph, singleChunkSets } = + getExportsChunkSetsInGraph(); + return createGetCombinations( + chunkSetsInGraph, + singleChunkSets, + getExportsChunkSetsByCount() + ); + }); + const getExportsCombinations = key => + getExportsCombinationsFactory()(key); + + /** + * @typedef {Object} SelectedChunksResult + * @property {Chunk[]} chunks the list of chunks + * @property {bigint | Chunk} key a key of the list + */ + + /** @type {WeakMap | Chunk, WeakMap>} */ + const selectedChunksCacheByChunksSet = new WeakMap(); + + /** + * get list and key by applying the filter function to the list + * It is cached for performance reasons + * @param {Set | Chunk} chunks list of chunks + * @param {ChunkFilterFunction} chunkFilter filter function for chunks + * @returns {SelectedChunksResult} list and key + */ + const getSelectedChunks = (chunks, chunkFilter) => { + let entry = selectedChunksCacheByChunksSet.get(chunks); + if (entry === undefined) { + entry = new WeakMap(); + selectedChunksCacheByChunksSet.set(chunks, entry); + } + /** @type {SelectedChunksResult} */ + let entry2 = entry.get(chunkFilter); + if (entry2 === undefined) { + /** @type {Chunk[]} */ + const selectedChunks = []; + if (chunks instanceof Chunk) { + if (chunkFilter(chunks)) selectedChunks.push(chunks); + } else { + for (const chunk of chunks) { + if (chunkFilter(chunk)) selectedChunks.push(chunk); } } + entry2 = { + chunks: selectedChunks, + key: getKey(selectedChunks) + }; + entry.set(chunkFilter, entry2); } - ); + return entry2; + }; - parser.hooks.classBodyElement.tap( - "InnerGraphPlugin", - (element, classDefinition) => { - if (!InnerGraph.isEnabled(parser.state)) return; - if (parser.scope.topLevelScope === true) { - const fn = classWithTopLevelSymbol.get(classDefinition); - if (fn) { - InnerGraph.setTopLevelSymbol(parser.state, undefined); - } - } - } - ); + /** @type {Map} */ + const alreadyValidatedParents = new Map(); + /** @type {Set} */ + const alreadyReportedErrors = new Set(); - parser.hooks.classBodyValue.tap( - "InnerGraphPlugin", - (expression, element, classDefinition) => { - if (!InnerGraph.isEnabled(parser.state)) return; - if (parser.scope.topLevelScope === true) { - const fn = classWithTopLevelSymbol.get(classDefinition); - if (fn) { - if ( - !element.static || - parser.isPure( - expression, - element.key ? element.key.range[1] : element.range[0] - ) - ) { - InnerGraph.setTopLevelSymbol(parser.state, fn); - if (element.type !== "MethodDefinition" && element.static) { - InnerGraph.onUsage(parser.state, usedByExports => { - switch (usedByExports) { - case undefined: - case true: - return; - default: { - const dep = new PureExpressionDependency( - expression.range - ); - dep.loc = expression.loc; - dep.usedByExports = usedByExports; - parser.state.module.addDependency(dep); - break; - } - } - }); - } - } else { - InnerGraph.setTopLevelSymbol(parser.state, undefined); + // Map a list of chunks to a list of modules + // For the key the chunk "index" is used, the value is a SortableSet of modules + /** @type {Map} */ + const chunksInfoMap = new Map(); + + /** + * @param {CacheGroup} cacheGroup the current cache group + * @param {number} cacheGroupIndex the index of the cache group of ordering + * @param {Chunk[]} selectedChunks chunks selected for this module + * @param {bigint | Chunk} selectedChunksKey a key of selectedChunks + * @param {Module} module the current module + * @returns {void} + */ + const addModuleToChunksInfoMap = ( + cacheGroup, + cacheGroupIndex, + selectedChunks, + selectedChunksKey, + module + ) => { + // Break if minimum number of chunks is not reached + if (selectedChunks.length < cacheGroup.minChunks) return; + // Determine name for split chunk + const name = cacheGroup.getName( + module, + selectedChunks, + cacheGroup.key + ); + // Check if the name is ok + const existingChunk = compilation.namedChunks.get(name); + if (existingChunk) { + const parentValidationKey = `${name}|${ + typeof selectedChunksKey === "bigint" + ? selectedChunksKey + : selectedChunksKey.debugId + }`; + const valid = alreadyValidatedParents.get(parentValidationKey); + if (valid === false) return; + if (valid === undefined) { + // Module can only be moved into the existing chunk if the existing chunk + // is a parent of all selected chunks + let isInAllParents = true; + /** @type {Set} */ + const queue = new Set(); + for (const chunk of selectedChunks) { + for (const group of chunk.groupsIterable) { + queue.add(group); } } - } - } - ); - - parser.hooks.declarator.tap("InnerGraphPlugin", (decl, statement) => { - if (!InnerGraph.isEnabled(parser.state)) return; - const fn = declWithTopLevelSymbol.get(decl); - - if (fn) { - InnerGraph.setTopLevelSymbol(parser.state, fn); - if (pureDeclarators.has(decl)) { - if (decl.init.type === "ClassExpression") { - if (decl.init.superClass) { - onUsageSuper(decl.init.superClass); + for (const group of queue) { + if (existingChunk.isInGroup(group)) continue; + let hasParent = false; + for (const parent of group.parentsIterable) { + hasParent = true; + queue.add(parent); } - } else { - InnerGraph.onUsage(parser.state, usedByExports => { - switch (usedByExports) { - case undefined: - case true: - return; - default: { - const dep = new PureExpressionDependency( - decl.init.range - ); - dep.loc = decl.loc; - dep.usedByExports = usedByExports; - parser.state.module.addDependency(dep); - break; - } - } - }); + if (!hasParent) { + isInAllParents = false; + } + } + const valid = isInAllParents; + alreadyValidatedParents.set(parentValidationKey, valid); + if (!valid) { + if (!alreadyReportedErrors.has(name)) { + alreadyReportedErrors.add(name); + compilation.errors.push( + new WebpackError( + "SplitChunksPlugin\n" + + `Cache group "${cacheGroup.key}" conflicts with existing chunk.\n` + + `Both have the same name "${name}" and existing chunk is not a parent of the selected modules.\n` + + "Use a different name for the cache group or make sure that the existing chunk is a parent (e. g. via dependOn).\n" + + 'HINT: You can omit "name" to automatically create a name.\n' + + "BREAKING CHANGE: webpack < 5 used to allow to use an entrypoint as splitChunk. " + + "This is no longer allowed when the entrypoint is not a parent of the selected modules.\n" + + "Remove this entrypoint and add modules to cache group's 'test' instead. " + + "If you need modules to be evaluated on startup, add them to the existing entrypoints (make them arrays). " + + "See migration guide of more info." + ) + ); + } + return; } } - parser.walkExpression(decl.init); - InnerGraph.setTopLevelSymbol(parser.state, undefined); - return true; } - }); - - parser.hooks.expression - .for(topLevelSymbolTag) - .tap("InnerGraphPlugin", () => { - const topLevelSymbol = /** @type {TopLevelSymbol} */ ( - parser.currentTagData - ); - const currentTopLevelSymbol = InnerGraph.getTopLevelSymbol( - parser.state - ); - InnerGraph.addUsage( - parser.state, - topLevelSymbol, - currentTopLevelSymbol || true + // Create key for maps + // When it has a name we use the name as key + // Otherwise we create the key from chunks and cache group key + // This automatically merges equal names + const key = + cacheGroup.key + + (name + ? ` name:${name}` + : ` chunks:${keyToString(selectedChunksKey)}`); + // Add module to maps + let info = chunksInfoMap.get(key); + if (info === undefined) { + chunksInfoMap.set( + key, + (info = { + modules: new SortableSet( + undefined, + compareModulesByIdentifier + ), + cacheGroup, + cacheGroupIndex, + name, + sizes: {}, + chunks: new Set(), + reuseableChunks: new Set(), + chunksKeys: new Set() + }) ); - }); - parser.hooks.assign - .for(topLevelSymbolTag) - .tap("InnerGraphPlugin", expr => { - if (!InnerGraph.isEnabled(parser.state)) return; - if (expr.operator === "=") return true; - }); - }; - normalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("InnerGraphPlugin", handler); - normalModuleFactory.hooks.parser - .for("javascript/esm") - .tap("InnerGraphPlugin", handler); - - compilation.hooks.finishModules.tap("InnerGraphPlugin", () => { - logger.timeAggregateEnd("infer dependency usage"); - }); - } - ); - } -} - -module.exports = InnerGraphPlugin; - - -/***/ }), - -/***/ 83608: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + } + const oldSize = info.modules.size; + info.modules.add(module); + if (info.modules.size !== oldSize) { + for (const type of module.getSourceTypes()) { + info.sizes[type] = (info.sizes[type] || 0) + module.size(type); + } + } + const oldChunksKeysSize = info.chunksKeys.size; + info.chunksKeys.add(selectedChunksKey); + if (oldChunksKeysSize !== info.chunksKeys.size) { + for (const chunk of selectedChunks) { + info.chunks.add(chunk); + } + } + }; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const context = { + moduleGraph, + chunkGraph + }; + logger.timeEnd("prepare"); + logger.time("modules"); -const { STAGE_ADVANCED } = __webpack_require__(80057); -const LazyBucketSortedSet = __webpack_require__(48424); -const { compareChunks } = __webpack_require__(29579); -const createSchemaValidation = __webpack_require__(32540); + // Walk through all modules + for (const module of compilation.modules) { + // Get cache group + let cacheGroups = this.options.getCacheGroups(module, context); + if (!Array.isArray(cacheGroups) || cacheGroups.length === 0) { + continue; + } -/** @typedef {import("../../declarations/plugins/optimize/LimitChunkCountPlugin").LimitChunkCountPluginOptions} LimitChunkCountPluginOptions */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ + // Prepare some values (usedExports = false) + const getCombs = memoize(() => { + const chunks = chunkGraph.getModuleChunksIterable(module); + const chunksKey = getKey(chunks); + return getCombinations(chunksKey); + }); -const validate = createSchemaValidation( - __webpack_require__(36557), - () => __webpack_require__(30837), - { - name: "Limit Chunk Count Plugin", - baseDataPath: "options" - } -); + // Prepare some values (usedExports = true) + const getCombsByUsedExports = memoize(() => { + // fill the groupedByExportsMap + getExportsChunkSetsInGraph(); + /** @type {Set | Chunk>} */ + const set = new Set(); + const groupedByUsedExports = groupedByExportsMap.get(module); + for (const chunks of groupedByUsedExports) { + const chunksKey = getKey(chunks); + for (const comb of getExportsCombinations(chunksKey)) + set.add(comb); + } + return set; + }); -/** - * @typedef {Object} ChunkCombination - * @property {boolean} deleted this is set to true when combination was removed - * @property {number} sizeDiff - * @property {number} integratedSize - * @property {Chunk} a - * @property {Chunk} b - * @property {number} aIdx - * @property {number} bIdx - * @property {number} aSize - * @property {number} bSize - */ + let cacheGroupIndex = 0; + for (const cacheGroupSource of cacheGroups) { + const cacheGroup = this._getCacheGroup(cacheGroupSource); -const addToSetMap = (map, key, value) => { - const set = map.get(key); - if (set === undefined) { - map.set(key, new Set([value])); - } else { - set.add(value); - } -}; + const combs = cacheGroup.usedExports + ? getCombsByUsedExports() + : getCombs(); + // For all combination of chunk selection + for (const chunkCombination of combs) { + // Break if minimum number of chunks is not reached + const count = + chunkCombination instanceof Chunk ? 1 : chunkCombination.size; + if (count < cacheGroup.minChunks) continue; + // Select chunks by configuration + const { chunks: selectedChunks, key: selectedChunksKey } = + getSelectedChunks(chunkCombination, cacheGroup.chunksFilter); -class LimitChunkCountPlugin { - /** - * @param {LimitChunkCountPluginOptions=} options options object - */ - constructor(options) { - validate(options); - this.options = options; - } + addModuleToChunksInfoMap( + cacheGroup, + cacheGroupIndex, + selectedChunks, + selectedChunksKey, + module + ); + } + cacheGroupIndex++; + } + } - /** - * @param {Compiler} compiler the webpack compiler - * @returns {void} - */ - apply(compiler) { - const options = this.options; - compiler.hooks.compilation.tap("LimitChunkCountPlugin", compilation => { - compilation.hooks.optimizeChunks.tap( - { - name: "LimitChunkCountPlugin", - stage: STAGE_ADVANCED - }, - chunks => { - const chunkGraph = compilation.chunkGraph; - const maxChunks = options.maxChunks; - if (!maxChunks) return; - if (maxChunks < 1) return; - if (compilation.chunks.size <= maxChunks) return; + logger.timeEnd("modules"); - let remainingChunksToMerge = compilation.chunks.size - maxChunks; + logger.time("queue"); - // order chunks in a deterministic way - const compareChunksWithGraph = compareChunks(chunkGraph); - const orderedChunks = Array.from(chunks).sort(compareChunksWithGraph); + /** + * @param {ChunksInfoItem} info entry + * @param {string[]} sourceTypes source types to be removed + */ + const removeModulesWithSourceType = (info, sourceTypes) => { + for (const module of info.modules) { + const types = module.getSourceTypes(); + if (sourceTypes.some(type => types.has(type))) { + info.modules.delete(module); + for (const type of types) { + info.sizes[type] -= module.size(type); + } + } + } + }; - // create a lazy sorted data structure to keep all combinations - // this is large. Size = chunks * (chunks - 1) / 2 - // It uses a multi layer bucket sort plus normal sort in the last layer - // It's also lazy so only accessed buckets are sorted - const combinations = new LazyBucketSortedSet( - // Layer 1: ordered by largest size benefit - c => c.sizeDiff, - (a, b) => b - a, - // Layer 2: ordered by smallest combined size - c => c.integratedSize, - (a, b) => a - b, - // Layer 3: ordered by position difference in orderedChunk (-> to be deterministic) - c => c.bIdx - c.aIdx, - (a, b) => a - b, - // Layer 4: ordered by position in orderedChunk (-> to be deterministic) - (a, b) => a.bIdx - b.bIdx - ); + /** + * @param {ChunksInfoItem} info entry + * @returns {boolean} true, if entry become empty + */ + const removeMinSizeViolatingModules = info => { + if (!info.cacheGroup._validateSize) return false; + const violatingSizes = getViolatingMinSizes( + info.sizes, + info.cacheGroup.minSize + ); + if (violatingSizes === undefined) return false; + removeModulesWithSourceType(info, violatingSizes); + return info.modules.size === 0; + }; - // we keep a mapping from chunk to all combinations - // but this mapping is not kept up-to-date with deletions - // so `deleted` flag need to be considered when iterating this - /** @type {Map>} */ - const combinationsByChunk = new Map(); + // Filter items were size < minSize + for (const [key, info] of chunksInfoMap) { + if (removeMinSizeViolatingModules(info)) { + chunksInfoMap.delete(key); + } else if ( + !checkMinSizeReduction( + info.sizes, + info.cacheGroup.minSizeReduction, + info.chunks.size + ) + ) { + chunksInfoMap.delete(key); + } + } - orderedChunks.forEach((b, bIdx) => { - // create combination pairs with size and integrated size - for (let aIdx = 0; aIdx < bIdx; aIdx++) { - const a = orderedChunks[aIdx]; - // filter pairs that can not be integrated! - if (!chunkGraph.canChunksBeIntegrated(a, b)) continue; + /** + * @typedef {Object} MaxSizeQueueItem + * @property {SplitChunksSizes} minSize + * @property {SplitChunksSizes} maxAsyncSize + * @property {SplitChunksSizes} maxInitialSize + * @property {string} automaticNameDelimiter + * @property {string[]} keys + */ - const integratedSize = chunkGraph.getIntegratedChunksSize( - a, - b, - options - ); + /** @type {Map} */ + const maxSizeQueueMap = new Map(); - const aSize = chunkGraph.getChunkSize(a, options); - const bSize = chunkGraph.getChunkSize(b, options); - const c = { - deleted: false, - sizeDiff: aSize + bSize - integratedSize, - integratedSize, - a, - b, - aIdx, - bIdx, - aSize, - bSize - }; - combinations.add(c); - addToSetMap(combinationsByChunk, a, c); - addToSetMap(combinationsByChunk, b, c); + while (chunksInfoMap.size > 0) { + // Find best matching entry + let bestEntryKey; + let bestEntry; + for (const pair of chunksInfoMap) { + const key = pair[0]; + const info = pair[1]; + if ( + bestEntry === undefined || + compareEntries(bestEntry, info) < 0 + ) { + bestEntry = info; + bestEntryKey = key; + } } - return combinations; - }); - - // list of modified chunks during this run - // combinations affected by this change are skipped to allow - // further optimizations - /** @type {Set} */ - const modifiedChunks = new Set(); - - let changed = false; - // eslint-disable-next-line no-constant-condition - loop: while (true) { - const combination = combinations.popFirst(); - if (combination === undefined) break; - combination.deleted = true; - const { a, b, integratedSize } = combination; + const item = bestEntry; + chunksInfoMap.delete(bestEntryKey); - // skip over pair when - // one of the already merged chunks is a parent of one of the chunks - if (modifiedChunks.size > 0) { - const queue = new Set(a.groupsIterable); - for (const group of b.groupsIterable) { - queue.add(group); + let chunkName = item.name; + // Variable for the new chunk (lazy created) + /** @type {Chunk} */ + let newChunk; + // When no chunk name, check if we can reuse a chunk instead of creating a new one + let isExistingChunk = false; + let isReusedWithAllModules = false; + if (chunkName) { + const chunkByName = compilation.namedChunks.get(chunkName); + if (chunkByName !== undefined) { + newChunk = chunkByName; + const oldSize = item.chunks.size; + item.chunks.delete(newChunk); + isExistingChunk = item.chunks.size !== oldSize; } - for (const group of queue) { - for (const mChunk of modifiedChunks) { - if (mChunk !== a && mChunk !== b && mChunk.isInGroup(group)) { - // This is a potential pair which needs recalculation - // We can't do that now, but it merge before following pairs - // so we leave space for it, and consider chunks as modified - // just for the worse case - remainingChunksToMerge--; - if (remainingChunksToMerge <= 0) break loop; - modifiedChunks.add(a); - modifiedChunks.add(b); - continue loop; + } else if (item.cacheGroup.reuseExistingChunk) { + outer: for (const chunk of item.chunks) { + if ( + chunkGraph.getNumberOfChunkModules(chunk) !== + item.modules.size + ) { + continue; + } + if ( + item.chunks.size > 1 && + chunkGraph.getNumberOfEntryModules(chunk) > 0 + ) { + continue; + } + for (const module of item.modules) { + if (!chunkGraph.isModuleInChunk(module, chunk)) { + continue outer; } } - for (const parent of group.parentsIterable) { - queue.add(parent); + if (!newChunk || !newChunk.name) { + newChunk = chunk; + } else if ( + chunk.name && + chunk.name.length < newChunk.name.length + ) { + newChunk = chunk; + } else if ( + chunk.name && + chunk.name.length === newChunk.name.length && + chunk.name < newChunk.name + ) { + newChunk = chunk; } } + if (newChunk) { + item.chunks.delete(newChunk); + chunkName = undefined; + isExistingChunk = true; + isReusedWithAllModules = true; + } } - // merge the chunks - if (chunkGraph.canChunksBeIntegrated(a, b)) { - chunkGraph.integrateChunks(a, b); - compilation.chunks.delete(b); + const enforced = + item.cacheGroup._conditionalEnforce && + checkMinSize(item.sizes, item.cacheGroup.enforceSizeThreshold); - // flag chunk a as modified as further optimization are possible for all children here - modifiedChunks.add(a); + const usedChunks = new Set(item.chunks); - changed = true; - remainingChunksToMerge--; - if (remainingChunksToMerge <= 0) break; + // Check if maxRequests condition can be fulfilled + if ( + !enforced && + (Number.isFinite(item.cacheGroup.maxInitialRequests) || + Number.isFinite(item.cacheGroup.maxAsyncRequests)) + ) { + for (const chunk of usedChunks) { + // respect max requests + const maxRequests = chunk.isOnlyInitial() + ? item.cacheGroup.maxInitialRequests + : chunk.canBeInitial() + ? Math.min( + item.cacheGroup.maxInitialRequests, + item.cacheGroup.maxAsyncRequests + ) + : item.cacheGroup.maxAsyncRequests; + if ( + isFinite(maxRequests) && + getRequests(chunk) >= maxRequests + ) { + usedChunks.delete(chunk); + } + } + } - // Update all affected combinations - // delete all combination with the removed chunk - // we will use combinations with the kept chunk instead - for (const combination of combinationsByChunk.get(a)) { - if (combination.deleted) continue; - combination.deleted = true; - combinations.delete(combination); + outer: for (const chunk of usedChunks) { + for (const module of item.modules) { + if (chunkGraph.isModuleInChunk(module, chunk)) continue outer; } + usedChunks.delete(chunk); + } - // Update combinations with the kept chunk with new sizes - for (const combination of combinationsByChunk.get(b)) { - if (combination.deleted) continue; - if (combination.a === b) { - if (!chunkGraph.canChunksBeIntegrated(a, combination.b)) { - combination.deleted = true; - combinations.delete(combination); + // Were some (invalid) chunks removed from usedChunks? + // => readd all modules to the queue, as things could have been changed + if (usedChunks.size < item.chunks.size) { + if (isExistingChunk) usedChunks.add(newChunk); + if (usedChunks.size >= item.cacheGroup.minChunks) { + const chunksArr = Array.from(usedChunks); + for (const module of item.modules) { + addModuleToChunksInfoMap( + item.cacheGroup, + item.cacheGroupIndex, + chunksArr, + getKey(usedChunks), + module + ); + } + } + continue; + } + + // Validate minRemainingSize constraint when a single chunk is left over + if ( + !enforced && + item.cacheGroup._validateRemainingSize && + usedChunks.size === 1 + ) { + const [chunk] = usedChunks; + let chunkSizes = Object.create(null); + for (const module of chunkGraph.getChunkModulesIterable(chunk)) { + if (!item.modules.has(module)) { + for (const type of module.getSourceTypes()) { + chunkSizes[type] = + (chunkSizes[type] || 0) + module.size(type); + } + } + } + const violatingSizes = getViolatingMinSizes( + chunkSizes, + item.cacheGroup.minRemainingSize + ); + if (violatingSizes !== undefined) { + const oldModulesSize = item.modules.size; + removeModulesWithSourceType(item, violatingSizes); + if ( + item.modules.size > 0 && + item.modules.size !== oldModulesSize + ) { + // queue this item again to be processed again + // without violating modules + chunksInfoMap.set(bestEntryKey, item); + } + continue; + } + } + + // Create the new chunk if not reusing one + if (newChunk === undefined) { + newChunk = compilation.addChunk(chunkName); + } + // Walk through all chunks + for (const chunk of usedChunks) { + // Add graph connections for splitted chunk + chunk.split(newChunk); + } + + // Add a note to the chunk + newChunk.chunkReason = + (newChunk.chunkReason ? newChunk.chunkReason + ", " : "") + + (isReusedWithAllModules + ? "reused as split chunk" + : "split chunk"); + if (item.cacheGroup.key) { + newChunk.chunkReason += ` (cache group: ${item.cacheGroup.key})`; + } + if (chunkName) { + newChunk.chunkReason += ` (name: ${chunkName})`; + } + if (item.cacheGroup.filename) { + newChunk.filenameTemplate = item.cacheGroup.filename; + } + if (item.cacheGroup.idHint) { + newChunk.idNameHints.add(item.cacheGroup.idHint); + } + if (!isReusedWithAllModules) { + // Add all modules to the new chunk + for (const module of item.modules) { + if (!module.chunkCondition(newChunk, compilation)) continue; + // Add module to new chunk + chunkGraph.connectChunkAndModule(newChunk, module); + // Remove module from used chunks + for (const chunk of usedChunks) { + chunkGraph.disconnectChunkAndModule(chunk, module); + } + } + } else { + // Remove all modules from used chunks + for (const module of item.modules) { + for (const chunk of usedChunks) { + chunkGraph.disconnectChunkAndModule(chunk, module); + } + } + } + + if ( + Object.keys(item.cacheGroup.maxAsyncSize).length > 0 || + Object.keys(item.cacheGroup.maxInitialSize).length > 0 + ) { + const oldMaxSizeSettings = maxSizeQueueMap.get(newChunk); + maxSizeQueueMap.set(newChunk, { + minSize: oldMaxSizeSettings + ? combineSizes( + oldMaxSizeSettings.minSize, + item.cacheGroup._minSizeForMaxSize, + Math.max + ) + : item.cacheGroup.minSize, + maxAsyncSize: oldMaxSizeSettings + ? combineSizes( + oldMaxSizeSettings.maxAsyncSize, + item.cacheGroup.maxAsyncSize, + Math.min + ) + : item.cacheGroup.maxAsyncSize, + maxInitialSize: oldMaxSizeSettings + ? combineSizes( + oldMaxSizeSettings.maxInitialSize, + item.cacheGroup.maxInitialSize, + Math.min + ) + : item.cacheGroup.maxInitialSize, + automaticNameDelimiter: item.cacheGroup.automaticNameDelimiter, + keys: oldMaxSizeSettings + ? oldMaxSizeSettings.keys.concat(item.cacheGroup.key) + : [item.cacheGroup.key] + }); + } + + // remove all modules from other entries and update size + for (const [key, info] of chunksInfoMap) { + if (isOverlap(info.chunks, usedChunks)) { + // update modules and total size + // may remove it from the map when < minSize + let updated = false; + for (const module of item.modules) { + if (info.modules.has(module)) { + // remove module + info.modules.delete(module); + // update size + for (const key of module.getSourceTypes()) { + info.sizes[key] -= module.size(key); + } + updated = true; + } + } + if (updated) { + if (info.modules.size === 0) { + chunksInfoMap.delete(key); continue; } - // Update size - const newIntegratedSize = chunkGraph.getIntegratedChunksSize( - a, - combination.b, - options - ); - const finishUpdate = combinations.startUpdate(combination); - combination.a = a; - combination.integratedSize = newIntegratedSize; - combination.aSize = integratedSize; - combination.sizeDiff = - combination.bSize + integratedSize - newIntegratedSize; - finishUpdate(); - } else if (combination.b === b) { - if (!chunkGraph.canChunksBeIntegrated(combination.a, a)) { - combination.deleted = true; - combinations.delete(combination); + if ( + removeMinSizeViolatingModules(info) || + !checkMinSizeReduction( + info.sizes, + info.cacheGroup.minSizeReduction, + info.chunks.size + ) + ) { + chunksInfoMap.delete(key); continue; } - // Update size - const newIntegratedSize = chunkGraph.getIntegratedChunksSize( - combination.a, - a, - options - ); + } + } + } + } - const finishUpdate = combinations.startUpdate(combination); - combination.b = a; - combination.integratedSize = newIntegratedSize; - combination.bSize = integratedSize; - combination.sizeDiff = - integratedSize + combination.aSize - newIntegratedSize; - finishUpdate(); + logger.timeEnd("queue"); + + logger.time("maxSize"); + + /** @type {Set} */ + const incorrectMinMaxSizeSet = new Set(); + + const { outputOptions } = compilation; + + // Make sure that maxSize is fulfilled + const { fallbackCacheGroup } = this.options; + for (const chunk of Array.from(compilation.chunks)) { + const chunkConfig = maxSizeQueueMap.get(chunk); + const { + minSize, + maxAsyncSize, + maxInitialSize, + automaticNameDelimiter + } = chunkConfig || fallbackCacheGroup; + if (!chunkConfig && !fallbackCacheGroup.chunksFilter(chunk)) + continue; + /** @type {SplitChunksSizes} */ + let maxSize; + if (chunk.isOnlyInitial()) { + maxSize = maxInitialSize; + } else if (chunk.canBeInitial()) { + maxSize = combineSizes(maxAsyncSize, maxInitialSize, Math.min); + } else { + maxSize = maxAsyncSize; + } + if (Object.keys(maxSize).length === 0) { + continue; + } + for (const key of Object.keys(maxSize)) { + const maxSizeValue = maxSize[key]; + const minSizeValue = minSize[key]; + if ( + typeof minSizeValue === "number" && + minSizeValue > maxSizeValue + ) { + const keys = chunkConfig && chunkConfig.keys; + const warningKey = `${ + keys && keys.join() + } ${minSizeValue} ${maxSizeValue}`; + if (!incorrectMinMaxSizeSet.has(warningKey)) { + incorrectMinMaxSizeSet.add(warningKey); + compilation.warnings.push( + new MinMaxSizeWarning(keys, minSizeValue, maxSizeValue) + ); } } - combinationsByChunk.set(a, combinationsByChunk.get(b)); - combinationsByChunk.delete(b); + } + const results = deterministicGroupingForModules({ + minSize, + maxSize: mapObject(maxSize, (value, key) => { + const minSizeValue = minSize[key]; + return typeof minSizeValue === "number" + ? Math.max(value, minSizeValue) + : value; + }), + items: chunkGraph.getChunkModulesIterable(chunk), + getKey(module) { + const cache = getKeyCache.get(module); + if (cache !== undefined) return cache; + const ident = cachedMakePathsRelative(module.identifier()); + const nameForCondition = + module.nameForCondition && module.nameForCondition(); + const name = nameForCondition + ? cachedMakePathsRelative(nameForCondition) + : ident.replace(/^.*!|\?[^?!]*$/g, ""); + const fullKey = + name + + automaticNameDelimiter + + hashFilename(ident, outputOptions); + const key = requestToId(fullKey); + getKeyCache.set(module, key); + return key; + }, + getSize(module) { + const size = Object.create(null); + for (const key of module.getSourceTypes()) { + size[key] = module.size(key); + } + return size; + } + }); + if (results.length <= 1) { + continue; + } + for (let i = 0; i < results.length; i++) { + const group = results[i]; + const key = this.options.hidePathInfo + ? hashFilename(group.key, outputOptions) + : group.key; + let name = chunk.name + ? chunk.name + automaticNameDelimiter + key + : null; + if (name && name.length > 100) { + name = + name.slice(0, 100) + + automaticNameDelimiter + + hashFilename(name, outputOptions); + } + if (i !== results.length - 1) { + const newPart = compilation.addChunk(name); + chunk.split(newPart); + newPart.chunkReason = chunk.chunkReason; + // Add all modules to the new chunk + for (const module of group.items) { + if (!module.chunkCondition(newPart, compilation)) { + continue; + } + // Add module to new chunk + chunkGraph.connectChunkAndModule(newPart, module); + // Remove module from used chunks + chunkGraph.disconnectChunkAndModule(chunk, module); + } + } else { + // change the chunk to be a part + chunk.name = name; + } } } - if (changed) return true; + logger.timeEnd("maxSize"); } ); }); } -} -module.exports = LimitChunkCountPlugin; +}; /***/ }), -/***/ 27868: +/***/ 52149: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Sean Larkin @thelarkinn */ -const { UsageState } = __webpack_require__(63686); -const { - numberToIdentifier, - NUMBER_OF_IDENTIFIER_START_CHARS, - NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS -} = __webpack_require__(39722); -const { assignDeterministicIds } = __webpack_require__(63290); -const { compareSelect, compareStringsNumeric } = __webpack_require__(29579); +const { formatSize } = __webpack_require__(71070); +const WebpackError = __webpack_require__(53799); -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../ExportsInfo")} ExportsInfo */ -/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */ +/** @typedef {import("./SizeLimitsPlugin").AssetDetails} AssetDetails */ -/** - * @param {ExportsInfo} exportsInfo exports info - * @returns {boolean} mangle is possible - */ -const canMangle = exportsInfo => { - if (exportsInfo.otherExportsInfo.getUsed(undefined) !== UsageState.Unused) - return false; - let hasSomethingToMangle = false; - for (const exportInfo of exportsInfo.exports) { - if (exportInfo.canMangle === true) { - hasSomethingToMangle = true; - } +module.exports = class AssetsOverSizeLimitWarning extends WebpackError { + /** + * @param {AssetDetails[]} assetsOverSizeLimit the assets + * @param {number} assetLimit the size limit + */ + constructor(assetsOverSizeLimit, assetLimit) { + const assetLists = assetsOverSizeLimit + .map(asset => `\n ${asset.name} (${formatSize(asset.size)})`) + .join(""); + + super(`asset size limit: The following asset(s) exceed the recommended size limit (${formatSize( + assetLimit + )}). +This can impact web performance. +Assets: ${assetLists}`); + + this.name = "AssetsOverSizeLimitWarning"; + this.assets = assetsOverSizeLimit; } - return hasSomethingToMangle; }; -// Sort by name -const comparator = compareSelect(e => e.name, compareStringsNumeric); -/** - * @param {boolean} deterministic use deterministic names - * @param {ExportsInfo} exportsInfo exports info - * @param {boolean} isNamespace is namespace object - * @returns {void} - */ -const mangleExportsInfo = (deterministic, exportsInfo, isNamespace) => { - if (!canMangle(exportsInfo)) return; - const usedNames = new Set(); - /** @type {ExportInfo[]} */ - const mangleableExports = []; - - // Avoid to renamed exports that are not provided when - // 1. it's not a namespace export: non-provided exports can be found in prototype chain - // 2. there are other provided exports and deterministic mode is chosen: - // non-provided exports would break the determinism - let avoidMangleNonProvided = !isNamespace; - if (!avoidMangleNonProvided && deterministic) { - for (const exportInfo of exportsInfo.ownedExports) { - if (exportInfo.provided !== false) { - avoidMangleNonProvided = true; - break; - } - } - } - for (const exportInfo of exportsInfo.ownedExports) { - const name = exportInfo.name; - if (!exportInfo.hasUsedName()) { - if ( - // Can the export be mangled? - exportInfo.canMangle !== true || - // Never rename 1 char exports - (name.length === 1 && /^[a-zA-Z0-9_$]/.test(name)) || - // Don't rename 2 char exports in deterministic mode - (deterministic && - name.length === 2 && - /^[a-zA-Z_$][a-zA-Z0-9_$]|^[1-9][0-9]/.test(name)) || - // Don't rename exports that are not provided - (avoidMangleNonProvided && exportInfo.provided !== true) - ) { - exportInfo.setUsedName(name); - usedNames.add(name); - } else { - mangleableExports.push(exportInfo); - } - } - if (exportInfo.exportsInfoOwned) { - const used = exportInfo.getUsed(undefined); - if ( - used === UsageState.OnlyPropertiesUsed || - used === UsageState.Unused - ) { - mangleExportsInfo(deterministic, exportInfo.exportsInfo, false); - } - } - } - if (deterministic) { - assignDeterministicIds( - mangleableExports, - e => e.name, - comparator, - (e, id) => { - const name = numberToIdentifier(id); - const size = usedNames.size; - usedNames.add(name); - if (size === usedNames.size) return false; - e.setUsedName(name); - return true; - }, - [ - NUMBER_OF_IDENTIFIER_START_CHARS, - NUMBER_OF_IDENTIFIER_START_CHARS * - NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS - ], - NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS, - usedNames.size - ); - } else { - const usedExports = []; - const unusedExports = []; - for (const exportInfo of mangleableExports) { - if (exportInfo.getUsed(undefined) === UsageState.Unused) { - unusedExports.push(exportInfo); - } else { - usedExports.push(exportInfo); - } - } - usedExports.sort(comparator); - unusedExports.sort(comparator); - let i = 0; - for (const list of [usedExports, unusedExports]) { - for (const exportInfo of list) { - let name; - do { - name = numberToIdentifier(i++); - } while (usedNames.has(name)); - exportInfo.setUsedName(name); - } - } - } -}; - -class MangleExportsPlugin { - /** - * @param {boolean} deterministic use deterministic names - */ - constructor(deterministic) { - this._deterministic = deterministic; - } - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const { _deterministic: deterministic } = this; - compiler.hooks.compilation.tap("MangleExportsPlugin", compilation => { - const moduleGraph = compilation.moduleGraph; - compilation.hooks.optimizeCodeGeneration.tap( - "MangleExportsPlugin", - modules => { - if (compilation.moduleMemCaches) { - throw new Error( - "optimization.mangleExports can't be used with cacheUnaffected as export mangling is a global effect" - ); - } - for (const module of modules) { - const isNamespace = - module.buildMeta && module.buildMeta.exportsType === "namespace"; - const exportsInfo = moduleGraph.getExportsInfo(module); - mangleExportsInfo(deterministic, exportsInfo, isNamespace); - } - } - ); - }); - } -} - -module.exports = MangleExportsPlugin; - /***/ }), -/***/ 85067: +/***/ 84229: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Sean Larkin @thelarkinn */ -const { STAGE_BASIC } = __webpack_require__(80057); -const { runtimeEqual } = __webpack_require__(17156); +const { formatSize } = __webpack_require__(71070); +const WebpackError = __webpack_require__(53799); -/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("./SizeLimitsPlugin").EntrypointDetails} EntrypointDetails */ -class MergeDuplicateChunksPlugin { +module.exports = class EntrypointsOverSizeLimitWarning extends WebpackError { /** - * @param {Compiler} compiler the compiler - * @returns {void} + * @param {EntrypointDetails[]} entrypoints the entrypoints + * @param {number} entrypointLimit the size limit */ - apply(compiler) { - compiler.hooks.compilation.tap( - "MergeDuplicateChunksPlugin", - compilation => { - compilation.hooks.optimizeChunks.tap( - { - name: "MergeDuplicateChunksPlugin", - stage: STAGE_BASIC - }, - chunks => { - const { chunkGraph, moduleGraph } = compilation; + constructor(entrypoints, entrypointLimit) { + const entrypointList = entrypoints + .map( + entrypoint => + `\n ${entrypoint.name} (${formatSize( + entrypoint.size + )})\n${entrypoint.files.map(asset => ` ${asset}`).join("\n")}` + ) + .join(""); + super(`entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (${formatSize( + entrypointLimit + )}). This can impact web performance. +Entrypoints:${entrypointList}\n`); - // remember already tested chunks for performance - const notDuplicates = new Set(); + this.name = "EntrypointsOverSizeLimitWarning"; + this.entrypoints = entrypoints; + } +}; - // for each chunk - for (const chunk of chunks) { - // track a Set of all chunk that could be duplicates - let possibleDuplicates; - for (const module of chunkGraph.getChunkModulesIterable(chunk)) { - if (possibleDuplicates === undefined) { - // when possibleDuplicates is not yet set, - // create a new Set from chunks of the current module - // including only chunks with the same number of modules - for (const dup of chunkGraph.getModuleChunksIterable( - module - )) { - if ( - dup !== chunk && - chunkGraph.getNumberOfChunkModules(chunk) === - chunkGraph.getNumberOfChunkModules(dup) && - !notDuplicates.has(dup) - ) { - // delay allocating the new Set until here, reduce memory pressure - if (possibleDuplicates === undefined) { - possibleDuplicates = new Set(); - } - possibleDuplicates.add(dup); - } - } - // when no chunk is possible we can break here - if (possibleDuplicates === undefined) break; - } else { - // validate existing possible duplicates - for (const dup of possibleDuplicates) { - // remove possible duplicate when module is not contained - if (!chunkGraph.isModuleInChunk(module, dup)) { - possibleDuplicates.delete(dup); - } - } - // when all chunks has been removed we can break here - if (possibleDuplicates.size === 0) break; - } - } - // when we found duplicates - if ( - possibleDuplicates !== undefined && - possibleDuplicates.size > 0 - ) { - outer: for (const otherChunk of possibleDuplicates) { - if (otherChunk.hasRuntime() !== chunk.hasRuntime()) continue; - if (chunkGraph.getNumberOfEntryModules(chunk) > 0) continue; - if (chunkGraph.getNumberOfEntryModules(otherChunk) > 0) - continue; - if (!runtimeEqual(chunk.runtime, otherChunk.runtime)) { - for (const module of chunkGraph.getChunkModulesIterable( - chunk - )) { - const exportsInfo = moduleGraph.getExportsInfo(module); - if ( - !exportsInfo.isEquallyUsed( - chunk.runtime, - otherChunk.runtime - ) - ) { - continue outer; - } - } - } - // merge them - if (chunkGraph.canChunksBeIntegrated(chunk, otherChunk)) { - chunkGraph.integrateChunks(chunk, otherChunk); - compilation.chunks.delete(otherChunk); - } - } - } +/***/ }), - // don't check already processed chunks twice - notDuplicates.add(chunk); - } - } - ); - } +/***/ 17791: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Sean Larkin @thelarkinn +*/ + + + +const WebpackError = __webpack_require__(53799); + +module.exports = class NoAsyncChunksWarning extends WebpackError { + constructor() { + super( + "webpack performance recommendations: \n" + + "You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.\n" + + "For more info visit https://webpack.js.org/guides/code-splitting/" ); + + this.name = "NoAsyncChunksWarning"; } -} -module.exports = MergeDuplicateChunksPlugin; +}; /***/ }), -/***/ 53912: +/***/ 32557: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Sean Larkin @thelarkinn */ -const { STAGE_ADVANCED } = __webpack_require__(80057); -const createSchemaValidation = __webpack_require__(32540); +const { find } = __webpack_require__(93347); +const AssetsOverSizeLimitWarning = __webpack_require__(52149); +const EntrypointsOverSizeLimitWarning = __webpack_require__(84229); +const NoAsyncChunksWarning = __webpack_require__(17791); -/** @typedef {import("../../declarations/plugins/optimize/MinChunkSizePlugin").MinChunkSizePluginOptions} MinChunkSizePluginOptions */ -/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../../declarations/WebpackOptions").PerformanceOptions} PerformanceOptions */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ /** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Entrypoint")} Entrypoint */ +/** @typedef {import("../WebpackError")} WebpackError */ -const validate = createSchemaValidation( - __webpack_require__(60135), - () => __webpack_require__(53850), - { - name: "Min Chunk Size Plugin", - baseDataPath: "options" - } -); +/** + * @typedef {Object} AssetDetails + * @property {string} name + * @property {number} size + */ -class MinChunkSizePlugin { +/** + * @typedef {Object} EntrypointDetails + * @property {string} name + * @property {number} size + * @property {string[]} files + */ + +const isOverSizeLimitSet = new WeakSet(); + +const excludeSourceMap = (name, source, info) => !info.development; + +module.exports = class SizeLimitsPlugin { /** - * @param {MinChunkSizePluginOptions} options options object + * @param {PerformanceOptions} options the plugin options */ constructor(options) { - validate(options); - this.options = options; + this.hints = options.hints; + this.maxAssetSize = options.maxAssetSize; + this.maxEntrypointSize = options.maxEntrypointSize; + this.assetFilter = options.assetFilter; + } + + /** + * @param {ChunkGroup | Source} thing the resource to test + * @returns {boolean} true if over the limit + */ + static isOverSizeLimit(thing) { + return isOverSizeLimitSet.has(thing); } /** @@ -110619,124 +107295,167 @@ class MinChunkSizePlugin { * @returns {void} */ apply(compiler) { - const options = this.options; - const minChunkSize = options.minChunkSize; - compiler.hooks.compilation.tap("MinChunkSizePlugin", compilation => { - compilation.hooks.optimizeChunks.tap( - { - name: "MinChunkSizePlugin", - stage: STAGE_ADVANCED - }, - chunks => { - const chunkGraph = compilation.chunkGraph; - const equalOptions = { - chunkOverhead: 1, - entryChunkMultiplicator: 1 - }; + const entrypointSizeLimit = this.maxEntrypointSize; + const assetSizeLimit = this.maxAssetSize; + const hints = this.hints; + const assetFilter = this.assetFilter || excludeSourceMap; - const chunkSizesMap = new Map(); - /** @type {[Chunk, Chunk][]} */ - const combinations = []; - /** @type {Chunk[]} */ - const smallChunks = []; - const visitedChunks = []; - for (const a of chunks) { - // check if one of the chunks sizes is smaller than the minChunkSize - // and filter pairs that can NOT be integrated! - if (chunkGraph.getChunkSize(a, equalOptions) < minChunkSize) { - smallChunks.push(a); - for (const b of visitedChunks) { - if (chunkGraph.canChunksBeIntegrated(b, a)) - combinations.push([b, a]); - } - } else { - for (const b of smallChunks) { - if (chunkGraph.canChunksBeIntegrated(b, a)) - combinations.push([b, a]); - } - } - chunkSizesMap.set(a, chunkGraph.getChunkSize(a, options)); - visitedChunks.push(a); + compiler.hooks.afterEmit.tap("SizeLimitsPlugin", compilation => { + /** @type {WebpackError[]} */ + const warnings = []; + + /** + * @param {Entrypoint} entrypoint an entrypoint + * @returns {number} the size of the entrypoint + */ + const getEntrypointSize = entrypoint => { + let size = 0; + for (const file of entrypoint.getFiles()) { + const asset = compilation.getAsset(file); + if ( + asset && + assetFilter(asset.name, asset.source, asset.info) && + asset.source + ) { + size += asset.info.size || asset.source.size(); } + } + return size; + }; - const sortedSizeFilteredExtendedPairCombinations = combinations - .map(pair => { - // extend combination pairs with size and integrated size - const a = chunkSizesMap.get(pair[0]); - const b = chunkSizesMap.get(pair[1]); - const ab = chunkGraph.getIntegratedChunksSize( - pair[0], - pair[1], - options - ); - /** @type {[number, number, Chunk, Chunk]} */ - const extendedPair = [a + b - ab, ab, pair[0], pair[1]]; - return extendedPair; - }) - .sort((a, b) => { - // sadly javascript does an in place sort here - // sort by size - const diff = b[0] - a[0]; - if (diff !== 0) return diff; - return a[1] - b[1]; - }); + /** @type {AssetDetails[]} */ + const assetsOverSizeLimit = []; + for (const { name, source, info } of compilation.getAssets()) { + if (!assetFilter(name, source, info) || !source) { + continue; + } - if (sortedSizeFilteredExtendedPairCombinations.length === 0) return; + const size = info.size || source.size(); + if (size > assetSizeLimit) { + assetsOverSizeLimit.push({ + name, + size + }); + isOverSizeLimitSet.add(source); + } + } - const pair = sortedSizeFilteredExtendedPairCombinations[0]; + const fileFilter = name => { + const asset = compilation.getAsset(name); + return asset && assetFilter(asset.name, asset.source, asset.info); + }; - chunkGraph.integrateChunks(pair[2], pair[3]); - compilation.chunks.delete(pair[3]); - return true; + /** @type {EntrypointDetails[]} */ + const entrypointsOverLimit = []; + for (const [name, entry] of compilation.entrypoints) { + const size = getEntrypointSize(entry); + + if (size > entrypointSizeLimit) { + entrypointsOverLimit.push({ + name: name, + size: size, + files: entry.getFiles().filter(fileFilter) + }); + isOverSizeLimitSet.add(entry); } - ); + } + + if (hints) { + // 1. Individual Chunk: Size < 250kb + // 2. Collective Initial Chunks [entrypoint] (Each Set?): Size < 250kb + // 3. No Async Chunks + // if !1, then 2, if !2 return + if (assetsOverSizeLimit.length > 0) { + warnings.push( + new AssetsOverSizeLimitWarning(assetsOverSizeLimit, assetSizeLimit) + ); + } + if (entrypointsOverLimit.length > 0) { + warnings.push( + new EntrypointsOverSizeLimitWarning( + entrypointsOverLimit, + entrypointSizeLimit + ) + ); + } + + if (warnings.length > 0) { + const someAsyncChunk = find( + compilation.chunks, + chunk => !chunk.canBeInitial() + ); + + if (!someAsyncChunk) { + warnings.push(new NoAsyncChunksWarning()); + } + + if (hints === "error") { + compilation.errors.push(...warnings); + } else { + compilation.warnings.push(...warnings); + } + } + } }); } -} -module.exports = MinChunkSizePlugin; +}; /***/ }), -/***/ 85305: +/***/ 95175: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const SizeFormatHelpers = __webpack_require__(71070); -const WebpackError = __webpack_require__(53799); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); -class MinMaxSizeWarning extends WebpackError { - constructor(keys, minSize, maxSize) { - let keysMessage = "Fallback cache group"; - if (keys) { - keysMessage = - keys.length > 1 - ? `Cache groups ${keys.sort().join(", ")}` - : `Cache group ${keys[0]}`; - } - super( - `SplitChunksPlugin\n` + - `${keysMessage}\n` + - `Configured minSize (${SizeFormatHelpers.formatSize(minSize)}) is ` + - `bigger than maxSize (${SizeFormatHelpers.formatSize(maxSize)}).\n` + - "This seem to be a invalid optimization.splitChunks configuration." - ); +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ + +class ChunkPrefetchFunctionRuntimeModule extends RuntimeModule { + /** + * @param {string} childType TODO + * @param {string} runtimeFunction TODO + * @param {string} runtimeHandlers TODO + */ + constructor(childType, runtimeFunction, runtimeHandlers) { + super(`chunk ${childType} function`); + this.childType = childType; + this.runtimeFunction = runtimeFunction; + this.runtimeHandlers = runtimeHandlers; + } + + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeFunction, runtimeHandlers } = this; + const { runtimeTemplate } = this.compilation; + return Template.asString([ + `${runtimeHandlers} = {};`, + `${runtimeFunction} = ${runtimeTemplate.basicFunction("chunkId", [ + // map is shorter than forEach + `Object.keys(${runtimeHandlers}).map(${runtimeTemplate.basicFunction( + "key", + `${runtimeHandlers}[key](chunkId);` + )});` + ])}` + ]); } } -module.exports = MinMaxSizeWarning; +module.exports = ChunkPrefetchFunctionRuntimeModule; /***/ }), -/***/ 74844: +/***/ 33895: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -110747,870 +107466,424 @@ module.exports = MinMaxSizeWarning; -const asyncLib = __webpack_require__(78175); -const ChunkGraph = __webpack_require__(64971); -const ModuleGraph = __webpack_require__(99988); -const { STAGE_DEFAULT } = __webpack_require__(80057); -const HarmonyImportDependency = __webpack_require__(57154); -const { compareModulesByIdentifier } = __webpack_require__(29579); -const { - intersectRuntime, - mergeRuntimeOwned, - filterRuntime, - runtimeToString, - mergeRuntime -} = __webpack_require__(17156); -const ConcatenatedModule = __webpack_require__(97198); +const RuntimeGlobals = __webpack_require__(16475); +const ChunkPrefetchFunctionRuntimeModule = __webpack_require__(95175); +const ChunkPrefetchStartupRuntimeModule = __webpack_require__(15294); +const ChunkPrefetchTriggerRuntimeModule = __webpack_require__(98441); +const ChunkPreloadTriggerRuntimeModule = __webpack_require__(56236); -/** @typedef {import("../Compilation")} Compilation */ /** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - -/** - * @typedef {Object} Statistics - * @property {number} cached - * @property {number} alreadyInConfig - * @property {number} invalidModule - * @property {number} incorrectChunks - * @property {number} incorrectDependency - * @property {number} incorrectModuleDependency - * @property {number} incorrectChunksOfImporter - * @property {number} incorrectRuntimeCondition - * @property {number} importerFailed - * @property {number} added - */ - -const formatBailoutReason = msg => { - return "ModuleConcatenation bailout: " + msg; -}; - -class ModuleConcatenationPlugin { - constructor(options) { - if (typeof options !== "object") options = {}; - this.options = options; - } +class ChunkPrefetchPreloadPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {Compiler} compiler the compiler * @returns {void} */ apply(compiler) { - const { _backCompat: backCompat } = compiler; - compiler.hooks.compilation.tap("ModuleConcatenationPlugin", compilation => { - const moduleGraph = compilation.moduleGraph; - const bailoutReasonMap = new Map(); + compiler.hooks.compilation.tap( + "ChunkPrefetchPreloadPlugin", + compilation => { + compilation.hooks.additionalChunkRuntimeRequirements.tap( + "ChunkPrefetchPreloadPlugin", + (chunk, set, { chunkGraph }) => { + if (chunkGraph.getNumberOfEntryModules(chunk) === 0) return; + const startupChildChunks = chunk.getChildrenOfTypeInOrder( + chunkGraph, + "prefetchOrder" + ); + if (startupChildChunks) { + set.add(RuntimeGlobals.prefetchChunk); + set.add(RuntimeGlobals.onChunksLoaded); + compilation.addRuntimeModule( + chunk, + new ChunkPrefetchStartupRuntimeModule(startupChildChunks) + ); + } + } + ); + compilation.hooks.additionalTreeRuntimeRequirements.tap( + "ChunkPrefetchPreloadPlugin", + (chunk, set, { chunkGraph }) => { + const chunkMap = chunk.getChildIdsByOrdersMap(chunkGraph, false); - const setBailoutReason = (module, reason) => { - setInnerBailoutReason(module, reason); - moduleGraph - .getOptimizationBailout(module) - .push( - typeof reason === "function" - ? rs => formatBailoutReason(reason(rs)) - : formatBailoutReason(reason) - ); - }; + if (chunkMap.prefetch) { + set.add(RuntimeGlobals.prefetchChunk); + compilation.addRuntimeModule( + chunk, + new ChunkPrefetchTriggerRuntimeModule(chunkMap.prefetch) + ); + } + if (chunkMap.preload) { + set.add(RuntimeGlobals.preloadChunk); + compilation.addRuntimeModule( + chunk, + new ChunkPreloadTriggerRuntimeModule(chunkMap.preload) + ); + } + } + ); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.prefetchChunk) + .tap("ChunkPrefetchPreloadPlugin", (chunk, set) => { + compilation.addRuntimeModule( + chunk, + new ChunkPrefetchFunctionRuntimeModule( + "prefetch", + RuntimeGlobals.prefetchChunk, + RuntimeGlobals.prefetchChunkHandlers + ) + ); + set.add(RuntimeGlobals.prefetchChunkHandlers); + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.preloadChunk) + .tap("ChunkPrefetchPreloadPlugin", (chunk, set) => { + compilation.addRuntimeModule( + chunk, + new ChunkPrefetchFunctionRuntimeModule( + "preload", + RuntimeGlobals.preloadChunk, + RuntimeGlobals.preloadChunkHandlers + ) + ); + set.add(RuntimeGlobals.preloadChunkHandlers); + }); + } + ); + } +} - const setInnerBailoutReason = (module, reason) => { - bailoutReasonMap.set(module, reason); - }; +module.exports = ChunkPrefetchPreloadPlugin; - const getInnerBailoutReason = (module, requestShortener) => { - const reason = bailoutReasonMap.get(module); - if (typeof reason === "function") return reason(requestShortener); - return reason; - }; - const formatBailoutWarning = (module, problem) => requestShortener => { - if (typeof problem === "function") { - return formatBailoutReason( - `Cannot concat with ${module.readableIdentifier( - requestShortener - )}: ${problem(requestShortener)}` - ); - } - const reason = getInnerBailoutReason(module, requestShortener); - const reasonWithPrefix = reason ? `: ${reason}` : ""; - if (module === problem) { - return formatBailoutReason( - `Cannot concat with ${module.readableIdentifier( - requestShortener - )}${reasonWithPrefix}` - ); - } else { - return formatBailoutReason( - `Cannot concat with ${module.readableIdentifier( - requestShortener - )} because of ${problem.readableIdentifier( - requestShortener - )}${reasonWithPrefix}` - ); - } - }; +/***/ }), - compilation.hooks.optimizeChunkModules.tapAsync( - { - name: "ModuleConcatenationPlugin", - stage: STAGE_DEFAULT - }, - (allChunks, modules, callback) => { - const logger = compilation.getLogger( - "webpack.ModuleConcatenationPlugin" - ); - const { chunkGraph, moduleGraph } = compilation; - const relevantModules = []; - const possibleInners = new Set(); - const context = { - chunkGraph, - moduleGraph - }; - logger.time("select relevant modules"); - for (const module of modules) { - let canBeRoot = true; - let canBeInner = true; +/***/ 15294: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const bailoutReason = module.getConcatenationBailoutReason(context); - if (bailoutReason) { - setBailoutReason(module, bailoutReason); - continue; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ - // Must not be an async module - if (moduleGraph.isAsync(module)) { - setBailoutReason(module, `Module is async`); - continue; - } - // Must be in strict mode - if (!module.buildInfo.strict) { - setBailoutReason(module, `Module is not in strict mode`); - continue; - } - // Module must be in any chunk (we don't want to do useless work) - if (chunkGraph.getNumberOfModuleChunks(module) === 0) { - setBailoutReason(module, "Module is not in any chunk"); - continue; - } +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); - // Exports must be known (and not dynamic) - const exportsInfo = moduleGraph.getExportsInfo(module); - const relevantExports = exportsInfo.getRelevantExports(undefined); - const unknownReexports = relevantExports.filter(exportInfo => { - return ( - exportInfo.isReexport() && !exportInfo.getTarget(moduleGraph) - ); - }); - if (unknownReexports.length > 0) { - setBailoutReason( - module, - `Reexports in this module do not have a static target (${Array.from( - unknownReexports, - exportInfo => - `${ - exportInfo.name || "other exports" - }: ${exportInfo.getUsedInfo()}` - ).join(", ")})` - ); - continue; - } +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ - // Root modules must have a static list of exports - const unknownProvidedExports = relevantExports.filter( - exportInfo => { - return exportInfo.provided !== true; - } - ); - if (unknownProvidedExports.length > 0) { - setBailoutReason( - module, - `List of module exports is dynamic (${Array.from( - unknownProvidedExports, - exportInfo => - `${ - exportInfo.name || "other exports" - }: ${exportInfo.getProvidedInfo()} and ${exportInfo.getUsedInfo()}` - ).join(", ")})` - ); - canBeRoot = false; - } +class ChunkPrefetchStartupRuntimeModule extends RuntimeModule { + /** + * @param {{ onChunks: Chunk[], chunks: Set }[]} startupChunks chunk ids to trigger when chunks are loaded + */ + constructor(startupChunks) { + super("startup prefetch", RuntimeModule.STAGE_TRIGGER); + this.startupChunks = startupChunks; + } - // Module must not be an entry point - if (chunkGraph.isEntryModule(module)) { - setInnerBailoutReason(module, "Module is an entry point"); - canBeInner = false; - } + /** + * @returns {string} runtime code + */ + generate() { + const { startupChunks, chunk } = this; + const { runtimeTemplate } = this.compilation; + return Template.asString( + startupChunks.map( + ({ onChunks, chunks }) => + `${RuntimeGlobals.onChunksLoaded}(0, ${JSON.stringify( + // This need to include itself to delay execution after this chunk has been fully loaded + onChunks.filter(c => c === chunk).map(c => c.id) + )}, ${runtimeTemplate.basicFunction( + "", + chunks.size < 3 + ? Array.from( + chunks, + c => + `${RuntimeGlobals.prefetchChunk}(${JSON.stringify(c.id)});` + ) + : `${JSON.stringify(Array.from(chunks, c => c.id))}.map(${ + RuntimeGlobals.prefetchChunk + });` + )}, 5);` + ) + ); + } +} - if (canBeRoot) relevantModules.push(module); - if (canBeInner) possibleInners.add(module); - } - logger.timeEnd("select relevant modules"); - logger.debug( - `${relevantModules.length} potential root modules, ${possibleInners.size} potential inner modules` - ); - // sort by depth - // modules with lower depth are more likely suited as roots - // this improves performance, because modules already selected as inner are skipped - logger.time("sort relevant modules"); - relevantModules.sort((a, b) => { - return moduleGraph.getDepth(a) - moduleGraph.getDepth(b); - }); - logger.timeEnd("sort relevant modules"); +module.exports = ChunkPrefetchStartupRuntimeModule; - /** @type {Statistics} */ - const stats = { - cached: 0, - alreadyInConfig: 0, - invalidModule: 0, - incorrectChunks: 0, - incorrectDependency: 0, - incorrectModuleDependency: 0, - incorrectChunksOfImporter: 0, - incorrectRuntimeCondition: 0, - importerFailed: 0, - added: 0 - }; - let statsCandidates = 0; - let statsSizeSum = 0; - let statsEmptyConfigurations = 0; - logger.time("find modules to concatenate"); - const concatConfigurations = []; - const usedAsInner = new Set(); - for (const currentRoot of relevantModules) { - // when used by another configuration as inner: - // the other configuration is better and we can skip this one - // TODO reconsider that when it's only used in a different runtime - if (usedAsInner.has(currentRoot)) continue; +/***/ }), - let chunkRuntime = undefined; - for (const r of chunkGraph.getModuleRuntimes(currentRoot)) { - chunkRuntime = mergeRuntimeOwned(chunkRuntime, r); - } - const exportsInfo = moduleGraph.getExportsInfo(currentRoot); - const filteredRuntime = filterRuntime(chunkRuntime, r => - exportsInfo.isModuleUsed(r) - ); - const activeRuntime = - filteredRuntime === true - ? chunkRuntime - : filteredRuntime === false - ? undefined - : filteredRuntime; +/***/ 98441: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // create a configuration with the root - const currentConfiguration = new ConcatConfiguration( - currentRoot, - activeRuntime - ); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ - // cache failures to add modules - const failureCache = new Map(); - // potential optional import candidates - /** @type {Set} */ - const candidates = new Set(); - // try to add all imports - for (const imp of this._getImports( - compilation, - currentRoot, - activeRuntime - )) { - candidates.add(imp); - } +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); - for (const imp of candidates) { - const impCandidates = new Set(); - const problem = this._tryToAdd( - compilation, - currentConfiguration, - imp, - chunkRuntime, - activeRuntime, - possibleInners, - impCandidates, - failureCache, - chunkGraph, - true, - stats - ); - if (problem) { - failureCache.set(imp, problem); - currentConfiguration.addWarning(imp, problem); - } else { - for (const c of impCandidates) { - candidates.add(c); - } - } - } - statsCandidates += candidates.size; - if (!currentConfiguration.isEmpty()) { - const modules = currentConfiguration.getModules(); - statsSizeSum += modules.size; - concatConfigurations.push(currentConfiguration); - for (const module of modules) { - if (module !== currentConfiguration.rootModule) { - usedAsInner.add(module); - } - } - } else { - statsEmptyConfigurations++; - const optimizationBailouts = - moduleGraph.getOptimizationBailout(currentRoot); - for (const warning of currentConfiguration.getWarningsSorted()) { - optimizationBailouts.push( - formatBailoutWarning(warning[0], warning[1]) - ); - } - } - } - logger.timeEnd("find modules to concatenate"); - logger.debug( - `${ - concatConfigurations.length - } successful concat configurations (avg size: ${ - statsSizeSum / concatConfigurations.length - }), ${statsEmptyConfigurations} bailed out completely` - ); - logger.debug( - `${statsCandidates} candidates were considered for adding (${stats.cached} cached failure, ${stats.alreadyInConfig} already in config, ${stats.invalidModule} invalid module, ${stats.incorrectChunks} incorrect chunks, ${stats.incorrectDependency} incorrect dependency, ${stats.incorrectChunksOfImporter} incorrect chunks of importer, ${stats.incorrectModuleDependency} incorrect module dependency, ${stats.incorrectRuntimeCondition} incorrect runtime condition, ${stats.importerFailed} importer failed, ${stats.added} added)` - ); - // HACK: Sort configurations by length and start with the longest one - // to get the biggest groups possible. Used modules are marked with usedModules - // TODO: Allow to reuse existing configuration while trying to add dependencies. - // This would improve performance. O(n^2) -> O(n) - logger.time(`sort concat configurations`); - concatConfigurations.sort((a, b) => { - return b.modules.size - a.modules.size; - }); - logger.timeEnd(`sort concat configurations`); - const usedModules = new Set(); +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ - logger.time("create concatenated modules"); - asyncLib.each( - concatConfigurations, - (concatConfiguration, callback) => { - const rootModule = concatConfiguration.rootModule; +class ChunkPrefetchTriggerRuntimeModule extends RuntimeModule { + /** + * @param {Record} chunkMap map from chunk to + */ + constructor(chunkMap) { + super(`chunk prefetch trigger`, RuntimeModule.STAGE_TRIGGER); + this.chunkMap = chunkMap; + } - // Avoid overlapping configurations - // TODO: remove this when todo above is fixed - if (usedModules.has(rootModule)) return callback(); - const modules = concatConfiguration.getModules(); - for (const m of modules) { - usedModules.add(m); - } - - // Create a new ConcatenatedModule - let newModule = ConcatenatedModule.create( - rootModule, - modules, - concatConfiguration.runtime, - compiler.root, - compilation.outputOptions.hashFunction - ); + /** + * @returns {string} runtime code + */ + generate() { + const { chunkMap } = this; + const { runtimeTemplate } = this.compilation; + const body = [ + "var chunks = chunkToChildrenMap[chunkId];", + `Array.isArray(chunks) && chunks.map(${RuntimeGlobals.prefetchChunk});` + ]; + return Template.asString([ + Template.asString([ + `var chunkToChildrenMap = ${JSON.stringify(chunkMap, null, "\t")};`, + `${ + RuntimeGlobals.ensureChunkHandlers + }.prefetch = ${runtimeTemplate.expressionFunction( + `Promise.all(promises).then(${runtimeTemplate.basicFunction( + "", + body + )})`, + "chunkId, promises" + )};` + ]) + ]); + } +} - const build = () => { - newModule.build( - compiler.options, - compilation, - null, - null, - err => { - if (err) { - if (!err.module) { - err.module = newModule; - } - return callback(err); - } - integrate(); - } - ); - }; +module.exports = ChunkPrefetchTriggerRuntimeModule; - const integrate = () => { - if (backCompat) { - ChunkGraph.setChunkGraphForModule(newModule, chunkGraph); - ModuleGraph.setModuleGraphForModule(newModule, moduleGraph); - } - for (const warning of concatConfiguration.getWarningsSorted()) { - moduleGraph - .getOptimizationBailout(newModule) - .push(formatBailoutWarning(warning[0], warning[1])); - } - moduleGraph.cloneModuleAttributes(rootModule, newModule); - for (const m of modules) { - // add to builtModules when one of the included modules was built - if (compilation.builtModules.has(m)) { - compilation.builtModules.add(newModule); - } - if (m !== rootModule) { - // attach external references to the concatenated module too - moduleGraph.copyOutgoingModuleConnections( - m, - newModule, - c => { - return ( - c.originModule === m && - !( - c.dependency instanceof HarmonyImportDependency && - modules.has(c.module) - ) - ); - } - ); - // remove module from chunk - for (const chunk of chunkGraph.getModuleChunksIterable( - rootModule - )) { - chunkGraph.disconnectChunkAndModule(chunk, m); - } - } - } - compilation.modules.delete(rootModule); - ChunkGraph.clearChunkGraphForModule(rootModule); - ModuleGraph.clearModuleGraphForModule(rootModule); +/***/ }), - // remove module from chunk - chunkGraph.replaceModule(rootModule, newModule); - // replace module references with the concatenated module - moduleGraph.moveModuleConnections(rootModule, newModule, c => { - const otherModule = - c.module === rootModule ? c.originModule : c.module; - const innerConnection = - c.dependency instanceof HarmonyImportDependency && - modules.has(otherModule); - return !innerConnection; - }); - // add concatenated module to the compilation - compilation.modules.add(newModule); +/***/ 56236: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - callback(); - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ - build(); - }, - err => { - logger.timeEnd("create concatenated modules"); - process.nextTick(callback.bind(null, err)); - } - ); - } - ); - }); - } - /** - * @param {Compilation} compilation the compilation - * @param {Module} module the module to be added - * @param {RuntimeSpec} runtime the runtime scope - * @returns {Set} the imported modules - */ - _getImports(compilation, module, runtime) { - const moduleGraph = compilation.moduleGraph; - const set = new Set(); - for (const dep of module.dependencies) { - // Get reference info only for harmony Dependencies - if (!(dep instanceof HarmonyImportDependency)) continue; - const connection = moduleGraph.getConnection(dep); - // Reference is valid and has a module - if ( - !connection || - !connection.module || - !connection.isTargetActive(runtime) - ) { - continue; - } +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); - const importedNames = compilation.getDependencyReferencedExports( - dep, - undefined - ); +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ - if ( - importedNames.every(i => - Array.isArray(i) ? i.length > 0 : i.name.length > 0 - ) || - Array.isArray(moduleGraph.getProvidedExports(module)) - ) { - set.add(connection.module); - } - } - return set; +class ChunkPreloadTriggerRuntimeModule extends RuntimeModule { + /** + * @param {Record} chunkMap map from chunk to chunks + */ + constructor(chunkMap) { + super(`chunk preload trigger`, RuntimeModule.STAGE_TRIGGER); + this.chunkMap = chunkMap; } /** - * @param {Compilation} compilation webpack compilation - * @param {ConcatConfiguration} config concat configuration (will be modified when added) - * @param {Module} module the module to be added - * @param {RuntimeSpec} runtime the runtime scope of the generated code - * @param {RuntimeSpec} activeRuntime the runtime scope of the root module - * @param {Set} possibleModules modules that are candidates - * @param {Set} candidates list of potential candidates (will be added to) - * @param {Map} failureCache cache for problematic modules to be more performant - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {boolean} avoidMutateOnFailure avoid mutating the config when adding fails - * @param {Statistics} statistics gathering metrics - * @returns {Module | function(RequestShortener): string} the problematic module + * @returns {string} runtime code */ - _tryToAdd( - compilation, - config, - module, - runtime, - activeRuntime, - possibleModules, - candidates, - failureCache, - chunkGraph, - avoidMutateOnFailure, - statistics - ) { - const cacheEntry = failureCache.get(module); - if (cacheEntry) { - statistics.cached++; - return cacheEntry; - } + generate() { + const { chunkMap } = this; + const { runtimeTemplate } = this.compilation; + const body = [ + "var chunks = chunkToChildrenMap[chunkId];", + `Array.isArray(chunks) && chunks.map(${RuntimeGlobals.preloadChunk});` + ]; + return Template.asString([ + Template.asString([ + `var chunkToChildrenMap = ${JSON.stringify(chunkMap, null, "\t")};`, + `${ + RuntimeGlobals.ensureChunkHandlers + }.preload = ${runtimeTemplate.basicFunction("chunkId", body)};` + ]) + ]); + } +} - // Already added? - if (config.has(module)) { - statistics.alreadyInConfig++; - return null; - } +module.exports = ChunkPreloadTriggerRuntimeModule; - // Not possible to add? - if (!possibleModules.has(module)) { - statistics.invalidModule++; - failureCache.set(module, module); // cache failures for performance - return module; - } - // Module must be in the correct chunks - const missingChunks = Array.from( - chunkGraph.getModuleChunksIterable(config.rootModule) - ).filter(chunk => !chunkGraph.isModuleInChunk(module, chunk)); - if (missingChunks.length > 0) { - const problem = requestShortener => { - const missingChunksList = Array.from( - new Set(missingChunks.map(chunk => chunk.name || "unnamed chunk(s)")) - ).sort(); - const chunks = Array.from( - new Set( - Array.from(chunkGraph.getModuleChunksIterable(module)).map( - chunk => chunk.name || "unnamed chunk(s)" - ) - ) - ).sort(); - return `Module ${module.readableIdentifier( - requestShortener - )} is not in the same chunk(s) (expected in chunk(s) ${missingChunksList.join( - ", " - )}, module is in chunk(s) ${chunks.join(", ")})`; - }; - statistics.incorrectChunks++; - failureCache.set(module, problem); // cache failures for performance - return problem; - } +/***/ }), - const moduleGraph = compilation.moduleGraph; +/***/ 30318: +/***/ (function(module) { - const incomingConnections = - moduleGraph.getIncomingConnectionsByOriginModule(module); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - const incomingConnectionsFromNonModules = - incomingConnections.get(null) || incomingConnections.get(undefined); - if (incomingConnectionsFromNonModules) { - const activeNonModulesConnections = - incomingConnectionsFromNonModules.filter(connection => { - // We are not interested in inactive connections - // or connections without dependency - return connection.isActive(runtime) || connection.dependency; - }); - if (activeNonModulesConnections.length > 0) { - const problem = requestShortener => { - const importingExplanations = new Set( - activeNonModulesConnections.map(c => c.explanation).filter(Boolean) - ); - const explanations = Array.from(importingExplanations).sort(); - return `Module ${module.readableIdentifier( - requestShortener - )} is referenced ${ - explanations.length > 0 - ? `by: ${explanations.join(", ")}` - : "in an unsupported way" - }`; - }; - statistics.incorrectDependency++; - failureCache.set(module, problem); // cache failures for performance - return problem; - } - } - /** @type {Map} */ - const incomingConnectionsFromModules = new Map(); - for (const [originModule, connections] of incomingConnections) { - if (originModule) { - // Ignore connection from orphan modules - if (chunkGraph.getNumberOfModuleChunks(originModule) === 0) continue; - // We don't care for connections from other runtimes - let originRuntime = undefined; - for (const r of chunkGraph.getModuleRuntimes(originModule)) { - originRuntime = mergeRuntimeOwned(originRuntime, r); - } +/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */ - if (!intersectRuntime(runtime, originRuntime)) continue; +class BasicEffectRulePlugin { + constructor(ruleProperty, effectType) { + this.ruleProperty = ruleProperty; + this.effectType = effectType || ruleProperty; + } - // We are not interested in inactive connections - const activeConnections = connections.filter(connection => - connection.isActive(runtime) - ); - if (activeConnections.length > 0) - incomingConnectionsFromModules.set(originModule, activeConnections); - } - } + /** + * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler + * @returns {void} + */ + apply(ruleSetCompiler) { + ruleSetCompiler.hooks.rule.tap( + "BasicEffectRulePlugin", + (path, rule, unhandledProperties, result, references) => { + if (unhandledProperties.has(this.ruleProperty)) { + unhandledProperties.delete(this.ruleProperty); - const incomingModules = Array.from(incomingConnectionsFromModules.keys()); + const value = rule[this.ruleProperty]; - // Module must be in the same chunks like the referencing module - const otherChunkModules = incomingModules.filter(originModule => { - for (const chunk of chunkGraph.getModuleChunksIterable( - config.rootModule - )) { - if (!chunkGraph.isModuleInChunk(originModule, chunk)) { - return true; + result.effects.push({ + type: this.effectType, + value + }); } } - return false; - }); - if (otherChunkModules.length > 0) { - const problem = requestShortener => { - const names = otherChunkModules - .map(m => m.readableIdentifier(requestShortener)) - .sort(); - return `Module ${module.readableIdentifier( - requestShortener - )} is referenced from different chunks by these modules: ${names.join( - ", " - )}`; - }; - statistics.incorrectChunksOfImporter++; - failureCache.set(module, problem); // cache failures for performance - return problem; - } + ); + } +} - /** @type {Map} */ - const nonHarmonyConnections = new Map(); - for (const [originModule, connections] of incomingConnectionsFromModules) { - const selected = connections.filter( - connection => - !connection.dependency || - !(connection.dependency instanceof HarmonyImportDependency) - ); - if (selected.length > 0) - nonHarmonyConnections.set(originModule, connections); - } - if (nonHarmonyConnections.size > 0) { - const problem = requestShortener => { - const names = Array.from(nonHarmonyConnections) - .map(([originModule, connections]) => { - return `${originModule.readableIdentifier( - requestShortener - )} (referenced with ${Array.from( - new Set( - connections - .map(c => c.dependency && c.dependency.type) - .filter(Boolean) - ) - ) - .sort() - .join(", ")})`; - }) - .sort(); - return `Module ${module.readableIdentifier( - requestShortener - )} is referenced from these modules with unsupported syntax: ${names.join( - ", " - )}`; - }; - statistics.incorrectModuleDependency++; - failureCache.set(module, problem); // cache failures for performance - return problem; - } +module.exports = BasicEffectRulePlugin; - if (runtime !== undefined && typeof runtime !== "string") { - // Module must be consistently referenced in the same runtimes - /** @type {{ originModule: Module, runtimeCondition: RuntimeSpec }[]} */ - const otherRuntimeConnections = []; - outer: for (const [ - originModule, - connections - ] of incomingConnectionsFromModules) { - /** @type {false | RuntimeSpec} */ - let currentRuntimeCondition = false; - for (const connection of connections) { - const runtimeCondition = filterRuntime(runtime, runtime => { - return connection.isTargetActive(runtime); - }); - if (runtimeCondition === false) continue; - if (runtimeCondition === true) continue outer; - if (currentRuntimeCondition !== false) { - currentRuntimeCondition = mergeRuntime( - currentRuntimeCondition, - runtimeCondition - ); - } else { - currentRuntimeCondition = runtimeCondition; - } - } - if (currentRuntimeCondition !== false) { - otherRuntimeConnections.push({ - originModule, - runtimeCondition: currentRuntimeCondition - }); - } - } - if (otherRuntimeConnections.length > 0) { - const problem = requestShortener => { - return `Module ${module.readableIdentifier( - requestShortener - )} is runtime-dependent referenced by these modules: ${Array.from( - otherRuntimeConnections, - ({ originModule, runtimeCondition }) => - `${originModule.readableIdentifier( - requestShortener - )} (expected runtime ${runtimeToString( - runtime - )}, module is only referenced in ${runtimeToString( - /** @type {RuntimeSpec} */ (runtimeCondition) - )})` - ).join(", ")}`; - }; - statistics.incorrectRuntimeCondition++; - failureCache.set(module, problem); // cache failures for performance - return problem; - } - } - let backup; - if (avoidMutateOnFailure) { - backup = config.snapshot(); - } +/***/ }), - // Add the module - config.add(module); +/***/ 94215: +/***/ (function(module) { - incomingModules.sort(compareModulesByIdentifier); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // Every module which depends on the added module must be in the configuration too. - for (const originModule of incomingModules) { - const problem = this._tryToAdd( - compilation, - config, - originModule, - runtime, - activeRuntime, - possibleModules, - candidates, - failureCache, - chunkGraph, - false, - statistics - ); - if (problem) { - if (backup !== undefined) config.rollback(backup); - statistics.importerFailed++; - failureCache.set(module, problem); // cache failures for performance - return problem; - } - } - // Add imports to possible candidates list - for (const imp of this._getImports(compilation, module, runtime)) { - candidates.add(imp); - } - statistics.added++; - return null; + +/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */ +/** @typedef {import("./RuleSetCompiler").RuleCondition} RuleCondition */ + +class BasicMatcherRulePlugin { + constructor(ruleProperty, dataProperty, invert) { + this.ruleProperty = ruleProperty; + this.dataProperty = dataProperty || ruleProperty; + this.invert = invert || false; } -} -class ConcatConfiguration { /** - * @param {Module} rootModule the root module - * @param {RuntimeSpec} runtime the runtime + * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler + * @returns {void} */ - constructor(rootModule, runtime) { - this.rootModule = rootModule; - this.runtime = runtime; - /** @type {Set} */ - this.modules = new Set(); - this.modules.add(rootModule); - /** @type {Map} */ - this.warnings = new Map(); + apply(ruleSetCompiler) { + ruleSetCompiler.hooks.rule.tap( + "BasicMatcherRulePlugin", + (path, rule, unhandledProperties, result) => { + if (unhandledProperties.has(this.ruleProperty)) { + unhandledProperties.delete(this.ruleProperty); + const value = rule[this.ruleProperty]; + const condition = ruleSetCompiler.compileCondition( + `${path}.${this.ruleProperty}`, + value + ); + const fn = condition.fn; + result.conditions.push({ + property: this.dataProperty, + matchWhenEmpty: this.invert + ? !condition.matchWhenEmpty + : condition.matchWhenEmpty, + fn: this.invert ? v => !fn(v) : fn + }); + } + } + ); } +} - add(module) { - this.modules.add(module); - } +module.exports = BasicMatcherRulePlugin; - has(module) { - return this.modules.has(module); - } - isEmpty() { - return this.modules.size === 1; - } +/***/ }), - addWarning(module, problem) { - this.warnings.set(module, problem); - } +/***/ 72021: +/***/ (function(module) { - getWarningsSorted() { - return new Map( - Array.from(this.warnings).sort((a, b) => { - const ai = a[0].identifier(); - const bi = b[0].identifier(); - if (ai < bi) return -1; - if (ai > bi) return 1; - return 0; - }) - ); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @returns {Set} modules as set - */ - getModules() { - return this.modules; - } - snapshot() { - return this.modules.size; + +/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */ +/** @typedef {import("./RuleSetCompiler").RuleCondition} RuleCondition */ + +class ObjectMatcherRulePlugin { + constructor(ruleProperty, dataProperty) { + this.ruleProperty = ruleProperty; + this.dataProperty = dataProperty || ruleProperty; } - rollback(snapshot) { - const modules = this.modules; - for (const m of modules) { - if (snapshot === 0) { - modules.delete(m); - } else { - snapshot--; + /** + * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler + * @returns {void} + */ + apply(ruleSetCompiler) { + const { ruleProperty, dataProperty } = this; + ruleSetCompiler.hooks.rule.tap( + "ObjectMatcherRulePlugin", + (path, rule, unhandledProperties, result) => { + if (unhandledProperties.has(ruleProperty)) { + unhandledProperties.delete(ruleProperty); + const value = rule[ruleProperty]; + for (const property of Object.keys(value)) { + const nestedDataProperties = property.split("."); + const condition = ruleSetCompiler.compileCondition( + `${path}.${ruleProperty}.${property}`, + value[property] + ); + result.conditions.push({ + property: [dataProperty, ...nestedDataProperties], + matchWhenEmpty: condition.matchWhenEmpty, + fn: condition.fn + }); + } + } } - } + ); } } -module.exports = ModuleConcatenationPlugin; +module.exports = ObjectMatcherRulePlugin; /***/ }), -/***/ 46043: +/***/ 83349: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -111621,412 +107894,383 @@ module.exports = ModuleConcatenationPlugin; -const { SyncBailHook } = __webpack_require__(41242); -const { RawSource, CachedSource, CompatSource } = __webpack_require__(51255); -const Compilation = __webpack_require__(85720); -const WebpackError = __webpack_require__(53799); -const { compareSelect, compareStrings } = __webpack_require__(29579); -const createHash = __webpack_require__(49835); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("../Compiler")} Compiler */ - -const EMPTY_SET = new Set(); - -const addToList = (itemOrItems, list) => { - if (Array.isArray(itemOrItems)) { - for (const item of itemOrItems) { - list.add(item); - } - } else if (itemOrItems) { - list.add(itemOrItems); - } -}; +const { SyncHook } = __webpack_require__(6967); /** - * @template T - * @param {T[]} input list - * @param {function(T): Buffer} fn map function - * @returns {Buffer[]} buffers without duplicates + * @typedef {Object} RuleCondition + * @property {string | string[]} property + * @property {boolean} matchWhenEmpty + * @property {function(string): boolean} fn */ -const mapAndDeduplicateBuffers = (input, fn) => { - // Buffer.equals compares size first so this should be efficient enough - // If it becomes a performance problem we can use a map and group by size - // instead of looping over all assets. - const result = []; - outer: for (const value of input) { - const buf = fn(value); - for (const other of result) { - if (buf.equals(other)) continue outer; - } - result.push(buf); - } - return result; -}; /** - * Escapes regular expression metacharacters - * @param {string} str String to quote - * @returns {string} Escaped string + * @typedef {Object} Condition + * @property {boolean} matchWhenEmpty + * @property {function(string): boolean} fn */ -const quoteMeta = str => { - return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); -}; - -const cachedSourceMap = new WeakMap(); -const toCachedSource = source => { - if (source instanceof CachedSource) { - return source; - } - const entry = cachedSourceMap.get(source); - if (entry !== undefined) return entry; - const newSource = new CachedSource(CompatSource.from(source)); - cachedSourceMap.set(source, newSource); - return newSource; -}; +/** + * @typedef {Object} CompiledRule + * @property {RuleCondition[]} conditions + * @property {(Effect|function(object): Effect[])[]} effects + * @property {CompiledRule[]=} rules + * @property {CompiledRule[]=} oneOf + */ /** - * @typedef {Object} AssetInfoForRealContentHash - * @property {string} name - * @property {AssetInfo} info - * @property {Source} source - * @property {RawSource | undefined} newSource - * @property {RawSource | undefined} newSourceWithoutOwn - * @property {string} content - * @property {Set} ownHashes - * @property {Promise} contentComputePromise - * @property {Promise} contentComputeWithoutOwnPromise - * @property {Set} referencedHashes - * @property {Set} hashes + * @typedef {Object} Effect + * @property {string} type + * @property {any} value */ /** - * @typedef {Object} CompilationHooks - * @property {SyncBailHook<[Buffer[], string], string>} updateHash + * @typedef {Object} RuleSet + * @property {Map} references map of references in the rule set (may grow over time) + * @property {function(object): Effect[]} exec execute the rule set */ -/** @type {WeakMap} */ -const compilationHooksMap = new WeakMap(); +class RuleSetCompiler { + constructor(plugins) { + this.hooks = Object.freeze({ + /** @type {SyncHook<[string, object, Set, CompiledRule, Map]>} */ + rule: new SyncHook([ + "path", + "rule", + "unhandledProperties", + "compiledRule", + "references" + ]) + }); + if (plugins) { + for (const plugin of plugins) { + plugin.apply(this); + } + } + } -class RealContentHashPlugin { /** - * @param {Compilation} compilation the compilation - * @returns {CompilationHooks} the attached hooks + * @param {object[]} ruleSet raw user provided rules + * @returns {RuleSet} compiled RuleSet */ - static getCompilationHooks(compilation) { - if (!(compilation instanceof Compilation)) { - throw new TypeError( - "The 'compilation' argument must be an instance of Compilation" - ); + compile(ruleSet) { + const refs = new Map(); + const rules = this.compileRules("ruleSet", ruleSet, refs); + + /** + * @param {object} data data passed in + * @param {CompiledRule} rule the compiled rule + * @param {Effect[]} effects an array where effects are pushed to + * @returns {boolean} true, if the rule has matched + */ + const execRule = (data, rule, effects) => { + for (const condition of rule.conditions) { + const p = condition.property; + if (Array.isArray(p)) { + let current = data; + for (const subProperty of p) { + if ( + current && + typeof current === "object" && + Object.prototype.hasOwnProperty.call(current, subProperty) + ) { + current = current[subProperty]; + } else { + current = undefined; + break; + } + } + if (current !== undefined) { + if (!condition.fn(current)) return false; + continue; + } + } else if (p in data) { + const value = data[p]; + if (value !== undefined) { + if (!condition.fn(value)) return false; + continue; + } + } + if (!condition.matchWhenEmpty) { + return false; + } + } + for (const effect of rule.effects) { + if (typeof effect === "function") { + const returnedEffects = effect(data); + for (const effect of returnedEffects) { + effects.push(effect); + } + } else { + effects.push(effect); + } + } + if (rule.rules) { + for (const childRule of rule.rules) { + execRule(data, childRule, effects); + } + } + if (rule.oneOf) { + for (const childRule of rule.oneOf) { + if (execRule(data, childRule, effects)) { + break; + } + } + } + return true; + }; + + return { + references: refs, + exec: data => { + /** @type {Effect[]} */ + const effects = []; + for (const rule of rules) { + execRule(data, rule, effects); + } + return effects; + } + }; + } + + /** + * @param {string} path current path + * @param {object[]} rules the raw rules provided by user + * @param {Map} refs references + * @returns {CompiledRule[]} rules + */ + compileRules(path, rules, refs) { + return rules.map((rule, i) => + this.compileRule(`${path}[${i}]`, rule, refs) + ); + } + + /** + * @param {string} path current path + * @param {object} rule the raw rule provided by user + * @param {Map} refs references + * @returns {CompiledRule} normalized and compiled rule for processing + */ + compileRule(path, rule, refs) { + const unhandledProperties = new Set( + Object.keys(rule).filter(key => rule[key] !== undefined) + ); + + /** @type {CompiledRule} */ + const compiledRule = { + conditions: [], + effects: [], + rules: undefined, + oneOf: undefined + }; + + this.hooks.rule.call(path, rule, unhandledProperties, compiledRule, refs); + + if (unhandledProperties.has("rules")) { + unhandledProperties.delete("rules"); + const rules = rule.rules; + if (!Array.isArray(rules)) + throw this.error(path, rules, "Rule.rules must be an array of rules"); + compiledRule.rules = this.compileRules(`${path}.rules`, rules, refs); } - let hooks = compilationHooksMap.get(compilation); - if (hooks === undefined) { - hooks = { - updateHash: new SyncBailHook(["content", "oldHash"]) - }; - compilationHooksMap.set(compilation, hooks); + + if (unhandledProperties.has("oneOf")) { + unhandledProperties.delete("oneOf"); + const oneOf = rule.oneOf; + if (!Array.isArray(oneOf)) + throw this.error(path, oneOf, "Rule.oneOf must be an array of rules"); + compiledRule.oneOf = this.compileRules(`${path}.oneOf`, oneOf, refs); } - return hooks; - } - constructor({ hashFunction, hashDigest }) { - this._hashFunction = hashFunction; - this._hashDigest = hashDigest; + if (unhandledProperties.size > 0) { + throw this.error( + path, + rule, + `Properties ${Array.from(unhandledProperties).join(", ")} are unknown` + ); + } + + return compiledRule; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {string} path current path + * @param {any} condition user provided condition value + * @returns {Condition} compiled condition */ - apply(compiler) { - compiler.hooks.compilation.tap("RealContentHashPlugin", compilation => { - const cacheAnalyse = compilation.getCache( - "RealContentHashPlugin|analyse" + compileCondition(path, condition) { + if (condition === "") { + return { + matchWhenEmpty: true, + fn: str => str === "" + }; + } + if (!condition) { + throw this.error( + path, + condition, + "Expected condition but got falsy value" ); - const cacheGenerate = compilation.getCache( - "RealContentHashPlugin|generate" + } + if (typeof condition === "string") { + return { + matchWhenEmpty: condition.length === 0, + fn: str => typeof str === "string" && str.startsWith(condition) + }; + } + if (typeof condition === "function") { + try { + return { + matchWhenEmpty: condition(""), + fn: condition + }; + } catch (err) { + throw this.error( + path, + condition, + "Evaluation of condition function threw error" + ); + } + } + if (condition instanceof RegExp) { + return { + matchWhenEmpty: condition.test(""), + fn: v => typeof v === "string" && condition.test(v) + }; + } + if (Array.isArray(condition)) { + const items = condition.map((c, i) => + this.compileCondition(`${path}[${i}]`, c) ); - const hooks = RealContentHashPlugin.getCompilationHooks(compilation); - compilation.hooks.processAssets.tapPromise( - { - name: "RealContentHashPlugin", - stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH - }, - async () => { - const assets = compilation.getAssets(); - /** @type {AssetInfoForRealContentHash[]} */ - const assetsWithInfo = []; - const hashToAssets = new Map(); - for (const { source, info, name } of assets) { - const cachedSource = toCachedSource(source); - const content = cachedSource.source(); - /** @type {Set} */ - const hashes = new Set(); - addToList(info.contenthash, hashes); - const data = { - name, - info, - source: cachedSource, - /** @type {RawSource | undefined} */ - newSource: undefined, - /** @type {RawSource | undefined} */ - newSourceWithoutOwn: undefined, - content, - /** @type {Set} */ - ownHashes: undefined, - contentComputePromise: undefined, - contentComputeWithoutOwnPromise: undefined, - /** @type {Set} */ - referencedHashes: undefined, - hashes - }; - assetsWithInfo.push(data); - for (const hash of hashes) { - const list = hashToAssets.get(hash); - if (list === undefined) { - hashToAssets.set(hash, [data]); - } else { - list.push(data); - } + return this.combineConditionsOr(items); + } + + if (typeof condition !== "object") { + throw this.error( + path, + condition, + `Unexpected ${typeof condition} when condition was expected` + ); + } + + const conditions = []; + for (const key of Object.keys(condition)) { + const value = condition[key]; + switch (key) { + case "or": + if (value) { + if (!Array.isArray(value)) { + throw this.error( + `${path}.or`, + condition.and, + "Expected array of conditions" + ); } + conditions.push(this.compileCondition(`${path}.or`, value)); } - if (hashToAssets.size === 0) return; - const hashRegExp = new RegExp( - Array.from(hashToAssets.keys(), quoteMeta).join("|"), - "g" - ); - await Promise.all( - assetsWithInfo.map(async asset => { - const { name, source, content, hashes } = asset; - if (Buffer.isBuffer(content)) { - asset.referencedHashes = EMPTY_SET; - asset.ownHashes = EMPTY_SET; - return; - } - const etag = cacheAnalyse.mergeEtags( - cacheAnalyse.getLazyHashedEtag(source), - Array.from(hashes).join("|") - ); - [asset.referencedHashes, asset.ownHashes] = - await cacheAnalyse.providePromise(name, etag, () => { - const referencedHashes = new Set(); - let ownHashes = new Set(); - const inContent = content.match(hashRegExp); - if (inContent) { - for (const hash of inContent) { - if (hashes.has(hash)) { - ownHashes.add(hash); - continue; - } - referencedHashes.add(hash); - } - } - return [referencedHashes, ownHashes]; - }); - }) - ); - const getDependencies = hash => { - const assets = hashToAssets.get(hash); - if (!assets) { - const referencingAssets = assetsWithInfo.filter(asset => - asset.referencedHashes.has(hash) + break; + case "and": + if (value) { + if (!Array.isArray(value)) { + throw this.error( + `${path}.and`, + condition.and, + "Expected array of conditions" ); - const err = new WebpackError(`RealContentHashPlugin -Some kind of unexpected caching problem occurred. -An asset was cached with a reference to another asset (${hash}) that's not in the compilation anymore. -Either the asset was incorrectly cached, or the referenced asset should also be restored from cache. -Referenced by: -${referencingAssets - .map(a => { - const match = new RegExp(`.{0,20}${quoteMeta(hash)}.{0,20}`).exec( - a.content - ); - return ` - ${a.name}: ...${match ? match[0] : "???"}...`; - }) - .join("\n")}`); - compilation.errors.push(err); - return undefined; } - const hashes = new Set(); - for (const { referencedHashes, ownHashes } of assets) { - if (!ownHashes.has(hash)) { - for (const hash of ownHashes) { - hashes.add(hash); - } - } - for (const hash of referencedHashes) { - hashes.add(hash); - } + let i = 0; + for (const item of value) { + conditions.push(this.compileCondition(`${path}.and[${i}]`, item)); + i++; } - return hashes; - }; - const hashInfo = hash => { - const assets = hashToAssets.get(hash); - return `${hash} (${Array.from(assets, a => a.name)})`; - }; - const hashesInOrder = new Set(); - for (const hash of hashToAssets.keys()) { - const add = (hash, stack) => { - const deps = getDependencies(hash); - if (!deps) return; - stack.add(hash); - for (const dep of deps) { - if (hashesInOrder.has(dep)) continue; - if (stack.has(dep)) { - throw new Error( - `Circular hash dependency ${Array.from( - stack, - hashInfo - ).join(" -> ")} -> ${hashInfo(dep)}` - ); - } - add(dep, stack); - } - hashesInOrder.add(hash); - stack.delete(hash); - }; - if (hashesInOrder.has(hash)) continue; - add(hash, new Set()); } - const hashToNewHash = new Map(); - const getEtag = asset => - cacheGenerate.mergeEtags( - cacheGenerate.getLazyHashedEtag(asset.source), - Array.from(asset.referencedHashes, hash => - hashToNewHash.get(hash) - ).join("|") - ); - const computeNewContent = asset => { - if (asset.contentComputePromise) return asset.contentComputePromise; - return (asset.contentComputePromise = (async () => { - if ( - asset.ownHashes.size > 0 || - Array.from(asset.referencedHashes).some( - hash => hashToNewHash.get(hash) !== hash - ) - ) { - const identifier = asset.name; - const etag = getEtag(asset); - asset.newSource = await cacheGenerate.providePromise( - identifier, - etag, - () => { - const newContent = asset.content.replace(hashRegExp, hash => - hashToNewHash.get(hash) - ); - return new RawSource(newContent); - } - ); - } - })()); - }; - const computeNewContentWithoutOwn = asset => { - if (asset.contentComputeWithoutOwnPromise) - return asset.contentComputeWithoutOwnPromise; - return (asset.contentComputeWithoutOwnPromise = (async () => { - if ( - asset.ownHashes.size > 0 || - Array.from(asset.referencedHashes).some( - hash => hashToNewHash.get(hash) !== hash - ) - ) { - const identifier = asset.name + "|without-own"; - const etag = getEtag(asset); - asset.newSourceWithoutOwn = await cacheGenerate.providePromise( - identifier, - etag, - () => { - const newContent = asset.content.replace( - hashRegExp, - hash => { - if (asset.ownHashes.has(hash)) { - return ""; - } - return hashToNewHash.get(hash); - } - ); - return new RawSource(newContent); - } - ); - } - })()); - }; - const comparator = compareSelect(a => a.name, compareStrings); - for (const oldHash of hashesInOrder) { - const assets = hashToAssets.get(oldHash); - assets.sort(comparator); - const hash = createHash(this._hashFunction); - await Promise.all( - assets.map(asset => - asset.ownHashes.has(oldHash) - ? computeNewContentWithoutOwn(asset) - : computeNewContent(asset) - ) - ); - const assetsContent = mapAndDeduplicateBuffers(assets, asset => { - if (asset.ownHashes.has(oldHash)) { - return asset.newSourceWithoutOwn - ? asset.newSourceWithoutOwn.buffer() - : asset.source.buffer(); - } else { - return asset.newSource - ? asset.newSource.buffer() - : asset.source.buffer(); - } + break; + case "not": + if (value) { + const matcher = this.compileCondition(`${path}.not`, value); + const fn = matcher.fn; + conditions.push({ + matchWhenEmpty: !matcher.matchWhenEmpty, + fn: v => !fn(v) }); - let newHash = hooks.updateHash.call(assetsContent, oldHash); - if (!newHash) { - for (const content of assetsContent) { - hash.update(content); - } - const digest = hash.digest(this._hashDigest); - newHash = /** @type {string} */ (digest.slice(0, oldHash.length)); - } - hashToNewHash.set(oldHash, newHash); } - await Promise.all( - assetsWithInfo.map(async asset => { - await computeNewContent(asset); - const newName = asset.name.replace(hashRegExp, hash => - hashToNewHash.get(hash) - ); + break; + default: + throw this.error( + `${path}.${key}`, + condition[key], + `Unexpected property ${key} in condition` + ); + } + } + if (conditions.length === 0) { + throw this.error( + path, + condition, + "Expected condition, but got empty thing" + ); + } + return this.combineConditionsAnd(conditions); + } - const infoUpdate = {}; - const hash = asset.info.contenthash; - infoUpdate.contenthash = Array.isArray(hash) - ? hash.map(hash => hashToNewHash.get(hash)) - : hashToNewHash.get(hash); + /** + * @param {Condition[]} conditions some conditions + * @returns {Condition} merged condition + */ + combineConditionsOr(conditions) { + if (conditions.length === 0) { + return { + matchWhenEmpty: false, + fn: () => false + }; + } else if (conditions.length === 1) { + return conditions[0]; + } else { + return { + matchWhenEmpty: conditions.some(c => c.matchWhenEmpty), + fn: v => conditions.some(c => c.fn(v)) + }; + } + } - if (asset.newSource !== undefined) { - compilation.updateAsset( - asset.name, - asset.newSource, - infoUpdate - ); - } else { - compilation.updateAsset(asset.name, asset.source, infoUpdate); - } + /** + * @param {Condition[]} conditions some conditions + * @returns {Condition} merged condition + */ + combineConditionsAnd(conditions) { + if (conditions.length === 0) { + return { + matchWhenEmpty: false, + fn: () => false + }; + } else if (conditions.length === 1) { + return conditions[0]; + } else { + return { + matchWhenEmpty: conditions.every(c => c.matchWhenEmpty), + fn: v => conditions.every(c => c.fn(v)) + }; + } + } - if (asset.name !== newName) { - compilation.renameAsset(asset.name, newName); - } - }) - ); - } - ); - }); + /** + * @param {string} path current path + * @param {any} value value at the error location + * @param {string} message message explaining the problem + * @returns {Error} an error object + */ + error(path, value, message) { + return new Error( + `Compiling RuleSet failed: ${message} (at ${path}: ${value})` + ); } } -module.exports = RealContentHashPlugin; +module.exports = RuleSetCompiler; /***/ }), -/***/ 84760: +/***/ 84977: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -112037,2485 +108281,1899 @@ module.exports = RealContentHashPlugin; -const { STAGE_BASIC, STAGE_ADVANCED } = __webpack_require__(80057); +const util = __webpack_require__(73837); -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */ +/** @typedef {import("./RuleSetCompiler").Effect} Effect */ -class RemoveEmptyChunksPlugin { +class UseEffectRulePlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap("RemoveEmptyChunksPlugin", compilation => { - /** - * @param {Iterable} chunks the chunks array - * @returns {void} - */ - const handler = chunks => { - const chunkGraph = compilation.chunkGraph; - for (const chunk of chunks) { - if ( - chunkGraph.getNumberOfChunkModules(chunk) === 0 && - !chunk.hasRuntime() && - chunkGraph.getNumberOfEntryModules(chunk) === 0 - ) { - compilation.chunkGraph.disconnectChunk(chunk); - compilation.chunks.delete(chunk); + apply(ruleSetCompiler) { + ruleSetCompiler.hooks.rule.tap( + "UseEffectRulePlugin", + (path, rule, unhandledProperties, result, references) => { + const conflictWith = (property, correctProperty) => { + if (unhandledProperties.has(property)) { + throw ruleSetCompiler.error( + `${path}.${property}`, + rule[property], + `A Rule must not have a '${property}' property when it has a '${correctProperty}' property` + ); } - } - }; - - // TODO do it once - compilation.hooks.optimizeChunks.tap( - { - name: "RemoveEmptyChunksPlugin", - stage: STAGE_BASIC - }, - handler - ); - compilation.hooks.optimizeChunks.tap( - { - name: "RemoveEmptyChunksPlugin", - stage: STAGE_ADVANCED - }, - handler - ); - }); - } -} -module.exports = RemoveEmptyChunksPlugin; - + }; -/***/ }), + if (unhandledProperties.has("use")) { + unhandledProperties.delete("use"); + unhandledProperties.delete("enforce"); -/***/ 7081: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + conflictWith("loader", "use"); + conflictWith("options", "use"); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const use = rule.use; + const enforce = rule.enforce; + const type = enforce ? `use-${enforce}` : "use"; + /** + * + * @param {string} path options path + * @param {string} defaultIdent default ident when none is provided + * @param {object} item user provided use value + * @returns {Effect|function(any): Effect[]} effect + */ + const useToEffect = (path, defaultIdent, item) => { + if (typeof item === "function") { + return data => useToEffectsWithoutIdent(path, item(data)); + } else { + return useToEffectRaw(path, defaultIdent, item); + } + }; -const { STAGE_BASIC } = __webpack_require__(80057); -const Queue = __webpack_require__(65930); -const { intersect } = __webpack_require__(93347); + /** + * + * @param {string} path options path + * @param {string} defaultIdent default ident when none is provided + * @param {object} item user provided use value + * @returns {Effect} effect + */ + const useToEffectRaw = (path, defaultIdent, item) => { + if (typeof item === "string") { + return { + type, + value: { + loader: item, + options: undefined, + ident: undefined + } + }; + } else { + const loader = item.loader; + const options = item.options; + let ident = item.ident; + if (options && typeof options === "object") { + if (!ident) ident = defaultIdent; + references.set(ident, options); + } + if (typeof options === "string") { + util.deprecate( + () => {}, + `Using a string as loader options is deprecated (${path}.options)`, + "DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING" + )(); + } + return { + type: enforce ? `use-${enforce}` : "use", + value: { + loader, + options, + ident + } + }; + } + }; -/** @typedef {import("../Compiler")} Compiler */ + /** + * @param {string} path options path + * @param {any} items user provided use value + * @returns {Effect[]} effects + */ + const useToEffectsWithoutIdent = (path, items) => { + if (Array.isArray(items)) { + return items.map((item, idx) => + useToEffectRaw(`${path}[${idx}]`, "[[missing ident]]", item) + ); + } + return [useToEffectRaw(path, "[[missing ident]]", items)]; + }; -class RemoveParentModulesPlugin { - /** - * @param {Compiler} compiler the compiler - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap("RemoveParentModulesPlugin", compilation => { - const handler = (chunks, chunkGroups) => { - const chunkGraph = compilation.chunkGraph; - const queue = new Queue(); - const availableModulesMap = new WeakMap(); + /** + * @param {string} path current path + * @param {any} items user provided use value + * @returns {(Effect|function(any): Effect[])[]} effects + */ + const useToEffects = (path, items) => { + if (Array.isArray(items)) { + return items.map((item, idx) => { + const subPath = `${path}[${idx}]`; + return useToEffect(subPath, subPath, item); + }); + } + return [useToEffect(path, path, items)]; + }; - for (const chunkGroup of compilation.entrypoints.values()) { - // initialize available modules for chunks without parents - availableModulesMap.set(chunkGroup, new Set()); - for (const child of chunkGroup.childrenIterable) { - queue.enqueue(child); - } - } - for (const chunkGroup of compilation.asyncEntrypoints) { - // initialize available modules for chunks without parents - availableModulesMap.set(chunkGroup, new Set()); - for (const child of chunkGroup.childrenIterable) { - queue.enqueue(child); + if (typeof use === "function") { + result.effects.push(data => + useToEffectsWithoutIdent(`${path}.use`, use(data)) + ); + } else { + for (const effect of useToEffects(`${path}.use`, use)) { + result.effects.push(effect); + } } } - while (queue.length > 0) { - const chunkGroup = queue.dequeue(); - let availableModules = availableModulesMap.get(chunkGroup); - let changed = false; - for (const parent of chunkGroup.parentsIterable) { - const availableModulesInParent = availableModulesMap.get(parent); - if (availableModulesInParent !== undefined) { - // If we know the available modules in parent: process these - if (availableModules === undefined) { - // if we have not own info yet: create new entry - availableModules = new Set(availableModulesInParent); - for (const chunk of parent.chunks) { - for (const m of chunkGraph.getChunkModulesIterable(chunk)) { - availableModules.add(m); - } - } - availableModulesMap.set(chunkGroup, availableModules); - changed = true; - } else { - for (const m of availableModules) { - if ( - !chunkGraph.isModuleInChunkGroup(m, parent) && - !availableModulesInParent.has(m) - ) { - availableModules.delete(m); - changed = true; - } - } - } - } - } - if (changed) { - // if something changed: enqueue our children - for (const child of chunkGroup.childrenIterable) { - queue.enqueue(child); - } + if (unhandledProperties.has("loader")) { + unhandledProperties.delete("loader"); + unhandledProperties.delete("options"); + unhandledProperties.delete("enforce"); + + const loader = rule.loader; + const options = rule.options; + const enforce = rule.enforce; + + if (loader.includes("!")) { + throw ruleSetCompiler.error( + `${path}.loader`, + loader, + "Exclamation mark separated loader lists has been removed in favor of the 'use' property with arrays" + ); } - } - // now we have available modules for every chunk - for (const chunk of chunks) { - const availableModulesSets = Array.from( - chunk.groupsIterable, - chunkGroup => availableModulesMap.get(chunkGroup) - ); - if (availableModulesSets.some(s => s === undefined)) continue; // No info about this chunk group - const availableModules = - availableModulesSets.length === 1 - ? availableModulesSets[0] - : intersect(availableModulesSets); - const numberOfModules = chunkGraph.getNumberOfChunkModules(chunk); - const toRemove = new Set(); - if (numberOfModules < availableModules.size) { - for (const m of chunkGraph.getChunkModulesIterable(chunk)) { - if (availableModules.has(m)) { - toRemove.add(m); - } - } - } else { - for (const m of availableModules) { - if (chunkGraph.isModuleInChunk(m, chunk)) { - toRemove.add(m); - } - } + if (loader.includes("?")) { + throw ruleSetCompiler.error( + `${path}.loader`, + loader, + "Query arguments on 'loader' has been removed in favor of the 'options' property" + ); } - for (const module of toRemove) { - chunkGraph.disconnectChunkAndModule(chunk, module); + + if (typeof options === "string") { + util.deprecate( + () => {}, + `Using a string as loader options is deprecated (${path}.options)`, + "DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING" + )(); } + + const ident = + options && typeof options === "object" ? path : undefined; + references.set(ident, options); + result.effects.push({ + type: enforce ? `use-${enforce}` : "use", + value: { + loader, + options, + ident + } + }); } - }; - compilation.hooks.optimizeChunks.tap( - { - name: "RemoveParentModulesPlugin", - stage: STAGE_BASIC - }, - handler - ); - }); + } + ); } + + useItemToEffects(path, item) {} } -module.exports = RemoveParentModulesPlugin; + +module.exports = UseEffectRulePlugin; /***/ }), -/***/ 2837: -/***/ (function(module) { +/***/ 63672: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -/** @typedef {import("../Compiler")} Compiler */ +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const HelperRuntimeModule = __webpack_require__(82444); -class RuntimeChunkPlugin { - constructor(options) { - this.options = { - name: entrypoint => `runtime~${entrypoint.name}`, - ...options - }; +class AsyncModuleRuntimeModule extends HelperRuntimeModule { + constructor() { + super("async module"); } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @returns {string} runtime code */ - apply(compiler) { - compiler.hooks.thisCompilation.tap("RuntimeChunkPlugin", compilation => { - compilation.hooks.addEntry.tap( - "RuntimeChunkPlugin", - (_, { name: entryName }) => { - if (entryName === undefined) return; - const data = compilation.entries.get(entryName); - if (data.options.runtime === undefined && !data.options.dependOn) { - // Determine runtime chunk name - let name = this.options.name; - if (typeof name === "function") { - name = name({ name: entryName }); - } - data.options.runtime = name; - } - } - ); - }); + generate() { + const { runtimeTemplate } = this.compilation; + const fn = RuntimeGlobals.asyncModule; + return Template.asString([ + 'var webpackThen = typeof Symbol === "function" ? Symbol("webpack then") : "__webpack_then__";', + 'var webpackExports = typeof Symbol === "function" ? Symbol("webpack exports") : "__webpack_exports__";', + 'var webpackError = typeof Symbol === "function" ? Symbol("webpack error") : "__webpack_error__";', + `var completeQueue = ${runtimeTemplate.basicFunction("queue", [ + "if(queue) {", + Template.indent([ + `queue.forEach(${runtimeTemplate.expressionFunction( + "fn.r--", + "fn" + )});`, + `queue.forEach(${runtimeTemplate.expressionFunction( + "fn.r-- ? fn.r++ : fn()", + "fn" + )});` + ]), + "}" + ])}`, + `var completeFunction = ${runtimeTemplate.expressionFunction( + "!--fn.r && fn()", + "fn" + )};`, + `var queueFunction = ${runtimeTemplate.expressionFunction( + "queue ? queue.push(fn) : completeFunction(fn)", + "queue, fn" + )};`, + `var wrapDeps = ${runtimeTemplate.returningFunction( + `deps.map(${runtimeTemplate.basicFunction("dep", [ + 'if(dep !== null && typeof dep === "object") {', + Template.indent([ + "if(dep[webpackThen]) return dep;", + "if(dep.then) {", + Template.indent([ + "var queue = [];", + `dep.then(${runtimeTemplate.basicFunction("r", [ + "obj[webpackExports] = r;", + "completeQueue(queue);", + "queue = 0;" + ])}, ${runtimeTemplate.basicFunction("e", [ + "obj[webpackError] = e;", + "completeQueue(queue);", + "queue = 0;" + ])});`, + "var obj = {};", + `obj[webpackThen] = ${runtimeTemplate.expressionFunction( + "queueFunction(queue, fn), dep['catch'](reject)", + "fn, reject" + )};`, + "return obj;" + ]), + "}" + ]), + "}", + "var ret = {};", + `ret[webpackThen] = ${runtimeTemplate.expressionFunction( + "completeFunction(fn)", + "fn" + )};`, + "ret[webpackExports] = dep;", + "return ret;" + ])})`, + "deps" + )};`, + `${fn} = ${runtimeTemplate.basicFunction("module, body, hasAwait", [ + "var queue = hasAwait && [];", + "var exports = module.exports;", + "var currentDeps;", + "var outerResolve;", + "var reject;", + "var isEvaluating = true;", + "var nested = false;", + `var whenAll = ${runtimeTemplate.basicFunction( + "deps, onResolve, onReject", + [ + "if (nested) return;", + "nested = true;", + "onResolve.r += deps.length;", + `deps.map(${runtimeTemplate.expressionFunction( + "dep[webpackThen](onResolve, onReject)", + "dep, i" + )});`, + "nested = false;" + ] + )};`, + `var promise = new Promise(${runtimeTemplate.basicFunction( + "resolve, rej", + [ + "reject = rej;", + `outerResolve = ${runtimeTemplate.expressionFunction( + "resolve(exports), completeQueue(queue), queue = 0" + )};` + ] + )});`, + "promise[webpackExports] = exports;", + `promise[webpackThen] = ${runtimeTemplate.basicFunction( + "fn, rejectFn", + [ + "if (isEvaluating) { return completeFunction(fn); }", + "if (currentDeps) whenAll(currentDeps, fn, rejectFn);", + "queueFunction(queue, fn);", + "promise['catch'](rejectFn);" + ] + )};`, + "module.exports = promise;", + `body(${runtimeTemplate.basicFunction("deps", [ + "currentDeps = wrapDeps(deps);", + "var fn;", + `var getResult = ${runtimeTemplate.returningFunction( + `currentDeps.map(${runtimeTemplate.basicFunction("d", [ + "if(d[webpackError]) throw d[webpackError];", + "return d[webpackExports];" + ])})` + )}`, + `var promise = new Promise(${runtimeTemplate.basicFunction( + "resolve, reject", + [ + `fn = ${runtimeTemplate.expressionFunction( + "resolve(getResult)" + )};`, + "fn.r = 0;", + "whenAll(currentDeps, fn, reject);" + ] + )});`, + "return fn.r ? promise : getResult();" + ])}, ${runtimeTemplate.expressionFunction( + "err && reject(promise[webpackError] = err), outerResolve()", + "err" + )});`, + "isEvaluating = false;" + ])};` + ]); } } -module.exports = RuntimeChunkPlugin; +module.exports = AsyncModuleRuntimeModule; /***/ }), -/***/ 84800: +/***/ 66532: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const glob2regexp = __webpack_require__(86140); -const { STAGE_DEFAULT } = __webpack_require__(80057); -const HarmonyExportImportedSpecifierDependency = __webpack_require__(67157); -const HarmonyImportSpecifierDependency = __webpack_require__(14077); -const formatLocation = __webpack_require__(16734); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); +const JavascriptModulesPlugin = __webpack_require__(89464); +const { getUndoPath } = __webpack_require__(82186); -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ +class AutoPublicPathRuntimeModule extends RuntimeModule { + constructor() { + super("publicPath", RuntimeModule.STAGE_BASIC); + } -/** - * @typedef {Object} ExportInModule - * @property {Module} module the module - * @property {string} exportName the name of the export - * @property {boolean} checked if the export is conditional - */ + /** + * @returns {string} runtime code + */ + generate() { + const { compilation } = this; + const { scriptType, importMetaName, path } = compilation.outputOptions; + const chunkName = compilation.getPath( + JavascriptModulesPlugin.getChunkFilenameTemplate( + this.chunk, + compilation.outputOptions + ), + { + chunk: this.chunk, + contentHashType: "javascript" + } + ); + const undoPath = getUndoPath(chunkName, path, false); -/** - * @typedef {Object} ReexportInfo - * @property {Map} static - * @property {Map>} dynamic - */ + return Template.asString([ + "var scriptUrl;", + scriptType === "module" + ? `if (typeof ${importMetaName}.url === "string") scriptUrl = ${importMetaName}.url` + : Template.asString([ + `if (${RuntimeGlobals.global}.importScripts) scriptUrl = ${RuntimeGlobals.global}.location + "";`, + `var document = ${RuntimeGlobals.global}.document;`, + "if (!scriptUrl && document) {", + Template.indent([ + `if (document.currentScript)`, + Template.indent(`scriptUrl = document.currentScript.src`), + "if (!scriptUrl) {", + Template.indent([ + 'var scripts = document.getElementsByTagName("script");', + "if(scripts.length) scriptUrl = scripts[scripts.length - 1].src" + ]), + "}" + ]), + "}" + ]), + "// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration", + '// or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.', + 'if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");', + 'scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\\?.*$/, "").replace(/\\/[^\\/]+$/, "/");', + !undoPath + ? `${RuntimeGlobals.publicPath} = scriptUrl;` + : `${RuntimeGlobals.publicPath} = scriptUrl + ${JSON.stringify( + undoPath + )};` + ]); + } +} -/** @type {WeakMap>} */ -const globToRegexpCache = new WeakMap(); +module.exports = AutoPublicPathRuntimeModule; -/** - * @param {string} glob the pattern - * @param {Map} cache the glob to RegExp cache - * @returns {RegExp} a regular expression - */ -const globToRegexp = (glob, cache) => { - const cacheEntry = cache.get(glob); - if (cacheEntry !== undefined) return cacheEntry; - if (!glob.includes("/")) { - glob = `**/${glob}`; + +/***/ }), + +/***/ 84519: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); + +class ChunkNameRuntimeModule extends RuntimeModule { + /** + * @param {string} chunkName the chunk's name + */ + constructor(chunkName) { + super("chunkName"); + this.chunkName = chunkName; } - const baseRegexp = glob2regexp(glob, { globstar: true, extended: true }); - const regexpSource = baseRegexp.source; - const regexp = new RegExp("^(\\./)?" + regexpSource.slice(1)); - cache.set(glob, regexp); - return regexp; -}; -class SideEffectsFlagPlugin { /** - * @param {boolean} analyseSource analyse source code for side effects + * @returns {string} runtime code */ - constructor(analyseSource = true) { - this._analyseSource = analyseSource; + generate() { + return `${RuntimeGlobals.chunkName} = ${JSON.stringify(this.chunkName)};`; + } +} + +module.exports = ChunkNameRuntimeModule; + + +/***/ }), + +/***/ 44793: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const HelperRuntimeModule = __webpack_require__(82444); + +class CompatGetDefaultExportRuntimeModule extends HelperRuntimeModule { + constructor() { + super("compat get default export"); } + /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @returns {string} runtime code */ - apply(compiler) { - let cache = globToRegexpCache.get(compiler.root); - if (cache === undefined) { - cache = new Map(); - globToRegexpCache.set(compiler.root, cache); - } - compiler.hooks.compilation.tap( - "SideEffectsFlagPlugin", - (compilation, { normalModuleFactory }) => { - const moduleGraph = compilation.moduleGraph; - normalModuleFactory.hooks.module.tap( - "SideEffectsFlagPlugin", - (module, data) => { - const resolveData = data.resourceResolveData; - if ( - resolveData && - resolveData.descriptionFileData && - resolveData.relativePath - ) { - const sideEffects = resolveData.descriptionFileData.sideEffects; - if (sideEffects !== undefined) { - if (module.factoryMeta === undefined) { - module.factoryMeta = {}; - } - const hasSideEffects = - SideEffectsFlagPlugin.moduleHasSideEffects( - resolveData.relativePath, - sideEffects, - cache - ); - module.factoryMeta.sideEffectFree = !hasSideEffects; - } - } + generate() { + const { runtimeTemplate } = this.compilation; + const fn = RuntimeGlobals.compatGetDefaultExport; + return Template.asString([ + "// getDefaultExport function for compatibility with non-harmony modules", + `${fn} = ${runtimeTemplate.basicFunction("module", [ + "var getter = module && module.__esModule ?", + Template.indent([ + `${runtimeTemplate.returningFunction("module['default']")} :`, + `${runtimeTemplate.returningFunction("module")};` + ]), + `${RuntimeGlobals.definePropertyGetters}(getter, { a: getter });`, + "return getter;" + ])};` + ]); + } +} - return module; - } - ); - normalModuleFactory.hooks.module.tap( - "SideEffectsFlagPlugin", - (module, data) => { - if (typeof data.settings.sideEffects === "boolean") { - if (module.factoryMeta === undefined) { - module.factoryMeta = {}; - } - module.factoryMeta.sideEffectFree = !data.settings.sideEffects; - } - return module; - } - ); - if (this._analyseSource) { - /** - * @param {JavascriptParser} parser the parser - * @returns {void} - */ - const parserHandler = parser => { - let sideEffectsStatement; - parser.hooks.program.tap("SideEffectsFlagPlugin", () => { - sideEffectsStatement = undefined; - }); - parser.hooks.statement.tap( - { name: "SideEffectsFlagPlugin", stage: -100 }, - statement => { - if (sideEffectsStatement) return; - if (parser.scope.topLevelScope !== true) return; - switch (statement.type) { - case "ExpressionStatement": - if ( - !parser.isPure(statement.expression, statement.range[0]) - ) { - sideEffectsStatement = statement; - } - break; - case "IfStatement": - case "WhileStatement": - case "DoWhileStatement": - if (!parser.isPure(statement.test, statement.range[0])) { - sideEffectsStatement = statement; - } - // statement hook will be called for child statements too - break; - case "ForStatement": - if ( - !parser.isPure(statement.init, statement.range[0]) || - !parser.isPure( - statement.test, - statement.init - ? statement.init.range[1] - : statement.range[0] - ) || - !parser.isPure( - statement.update, - statement.test - ? statement.test.range[1] - : statement.init - ? statement.init.range[1] - : statement.range[0] - ) - ) { - sideEffectsStatement = statement; - } - // statement hook will be called for child statements too - break; - case "SwitchStatement": - if ( - !parser.isPure(statement.discriminant, statement.range[0]) - ) { - sideEffectsStatement = statement; - } - // statement hook will be called for child statements too - break; - case "VariableDeclaration": - case "ClassDeclaration": - case "FunctionDeclaration": - if (!parser.isPure(statement, statement.range[0])) { - sideEffectsStatement = statement; - } - break; - case "ExportNamedDeclaration": - case "ExportDefaultDeclaration": - if ( - !parser.isPure(statement.declaration, statement.range[0]) - ) { - sideEffectsStatement = statement; - } - break; - case "LabeledStatement": - case "BlockStatement": - // statement hook will be called for child statements too - break; - case "EmptyStatement": - break; - case "ExportAllDeclaration": - case "ImportDeclaration": - // imports will be handled by the dependencies - break; - default: - sideEffectsStatement = statement; - break; - } - } - ); - parser.hooks.finish.tap("SideEffectsFlagPlugin", () => { - if (sideEffectsStatement === undefined) { - parser.state.module.buildMeta.sideEffectFree = true; - } else { - const { loc, type } = sideEffectsStatement; - moduleGraph - .getOptimizationBailout(parser.state.module) - .push( - () => - `Statement (${type}) with side effects in source code at ${formatLocation( - loc - )}` - ); - } - }); - }; - for (const key of [ - "javascript/auto", - "javascript/esm", - "javascript/dynamic" - ]) { - normalModuleFactory.hooks.parser - .for(key) - .tap("SideEffectsFlagPlugin", parserHandler); - } - } - compilation.hooks.optimizeDependencies.tap( - { - name: "SideEffectsFlagPlugin", - stage: STAGE_DEFAULT - }, - modules => { - const logger = compilation.getLogger( - "webpack.SideEffectsFlagPlugin" - ); +module.exports = CompatGetDefaultExportRuntimeModule; - logger.time("update dependencies"); - for (const module of modules) { - if (module.getSideEffectsConnectionState(moduleGraph) === false) { - const exportsInfo = moduleGraph.getExportsInfo(module); - for (const connection of moduleGraph.getIncomingConnections( - module - )) { - const dep = connection.dependency; - let isReexport; - if ( - (isReexport = - dep instanceof - HarmonyExportImportedSpecifierDependency) || - (dep instanceof HarmonyImportSpecifierDependency && - !dep.namespaceObjectAsContext) - ) { - // TODO improve for export * - if (isReexport && dep.name) { - const exportInfo = moduleGraph.getExportInfo( - connection.originModule, - dep.name - ); - exportInfo.moveTarget( - moduleGraph, - ({ module }) => - module.getSideEffectsConnectionState(moduleGraph) === - false, - ({ module: newModule, export: exportName }) => { - moduleGraph.updateModule(dep, newModule); - moduleGraph.addExplanation( - dep, - "(skipped side-effect-free modules)" - ); - const ids = dep.getIds(moduleGraph); - dep.setIds( - moduleGraph, - exportName - ? [...exportName, ...ids.slice(1)] - : ids.slice(1) - ); - return moduleGraph.getConnection(dep); - } - ); - continue; - } - // TODO improve for nested imports - const ids = dep.getIds(moduleGraph); - if (ids.length > 0) { - const exportInfo = exportsInfo.getExportInfo(ids[0]); - const target = exportInfo.getTarget( - moduleGraph, - ({ module }) => - module.getSideEffectsConnectionState(moduleGraph) === - false - ); - if (!target) continue; - moduleGraph.updateModule(dep, target.module); - moduleGraph.addExplanation( - dep, - "(skipped side-effect-free modules)" - ); - dep.setIds( - moduleGraph, - target.export - ? [...target.export, ...ids.slice(1)] - : ids.slice(1) - ); - } - } - } - } - } - logger.timeEnd("update dependencies"); - } - ); - } - ); +/***/ }), + +/***/ 88234: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); + +/** @typedef {import("../MainTemplate")} MainTemplate */ + +class CompatRuntimeModule extends RuntimeModule { + constructor() { + super("compat", RuntimeModule.STAGE_ATTACH); + this.fullHash = true; } - static moduleHasSideEffects(moduleName, flagValue, cache) { - switch (typeof flagValue) { - case "undefined": - return true; - case "boolean": - return flagValue; - case "string": - return globToRegexp(flagValue, cache).test(moduleName); - case "object": - return flagValue.some(glob => - SideEffectsFlagPlugin.moduleHasSideEffects(moduleName, glob, cache) - ); + /** + * @returns {string} runtime code + */ + generate() { + const { chunkGraph, chunk, compilation } = this; + const { + runtimeTemplate, + mainTemplate, + moduleTemplates, + dependencyTemplates + } = compilation; + const bootstrap = mainTemplate.hooks.bootstrap.call( + "", + chunk, + compilation.hash || "XXXX", + moduleTemplates.javascript, + dependencyTemplates + ); + const localVars = mainTemplate.hooks.localVars.call( + "", + chunk, + compilation.hash || "XXXX" + ); + const requireExtensions = mainTemplate.hooks.requireExtensions.call( + "", + chunk, + compilation.hash || "XXXX" + ); + const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk); + let requireEnsure = ""; + if (runtimeRequirements.has(RuntimeGlobals.ensureChunk)) { + const requireEnsureHandler = mainTemplate.hooks.requireEnsure.call( + "", + chunk, + compilation.hash || "XXXX", + "chunkId" + ); + if (requireEnsureHandler) { + requireEnsure = `${ + RuntimeGlobals.ensureChunkHandlers + }.compat = ${runtimeTemplate.basicFunction( + "chunkId, promises", + requireEnsureHandler + )};`; + } } + return [bootstrap, localVars, requireEnsure, requireExtensions] + .filter(Boolean) + .join("\n"); + } + + /** + * @returns {boolean} true, if the runtime module should get it's own scope + */ + shouldIsolate() { + // We avoid isolating this to have better backward-compat + return false; } } -module.exports = SideEffectsFlagPlugin; + +module.exports = CompatRuntimeModule; /***/ }), -/***/ 21478: +/***/ 94669: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const Chunk = __webpack_require__(39385); -const { STAGE_ADVANCED } = __webpack_require__(80057); -const WebpackError = __webpack_require__(53799); -const { requestToId } = __webpack_require__(63290); -const { isSubset } = __webpack_require__(93347); -const SortableSet = __webpack_require__(13098); -const { - compareModulesByIdentifier, - compareIterables -} = __webpack_require__(29579); -const createHash = __webpack_require__(49835); -const deterministicGrouping = __webpack_require__(59836); -const { makePathsRelative } = __webpack_require__(82186); -const memoize = __webpack_require__(78676); -const MinMaxSizeWarning = __webpack_require__(85305); - -/** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksCacheGroup} OptimizationSplitChunksCacheGroup */ -/** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksGetCacheGroups} OptimizationSplitChunksGetCacheGroups */ -/** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksOptions} OptimizationSplitChunksOptions */ -/** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksSizes} OptimizationSplitChunksSizes */ -/** @typedef {import("../../declarations/WebpackOptions").Output} OutputOptions */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("../Compilation").PathData} PathData */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/deterministicGrouping").GroupedItems} DeterministicGroupingGroupedItemsForModule */ -/** @typedef {import("../util/deterministicGrouping").Options} DeterministicGroupingOptionsForModule */ - -/** @typedef {Record} SplitChunksSizes */ +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const HelperRuntimeModule = __webpack_require__(82444); -/** - * @callback ChunkFilterFunction - * @param {Chunk} chunk - * @returns {boolean} - */ +class CreateFakeNamespaceObjectRuntimeModule extends HelperRuntimeModule { + constructor() { + super("create fake namespace object"); + } -/** - * @callback CombineSizeFunction - * @param {number} a - * @param {number} b - * @returns {number} - */ + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeTemplate } = this.compilation; + const fn = RuntimeGlobals.createFakeNamespaceObject; + return Template.asString([ + `var getProto = Object.getPrototypeOf ? ${runtimeTemplate.returningFunction( + "Object.getPrototypeOf(obj)", + "obj" + )} : ${runtimeTemplate.returningFunction("obj.__proto__", "obj")};`, + "var leafPrototypes;", + "// create a fake namespace object", + "// mode & 1: value is a module id, require it", + "// mode & 2: merge all properties of value into the ns", + "// mode & 4: return value when already ns object", + "// mode & 16: return value when it's Promise-like", + "// mode & 8|1: behave like require", + // Note: must be a function (not arrow), because this is used in body! + `${fn} = function(value, mode) {`, + Template.indent([ + `if(mode & 1) value = this(value);`, + `if(mode & 8) return value;`, + "if(typeof value === 'object' && value) {", + Template.indent([ + "if((mode & 4) && value.__esModule) return value;", + "if((mode & 16) && typeof value.then === 'function') return value;" + ]), + "}", + "var ns = Object.create(null);", + `${RuntimeGlobals.makeNamespaceObject}(ns);`, + "var def = {};", + "leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];", + "for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {", + Template.indent([ + `Object.getOwnPropertyNames(current).forEach(${runtimeTemplate.expressionFunction( + `def[key] = ${runtimeTemplate.returningFunction("value[key]", "")}`, + "key" + )});` + ]), + "}", + `def['default'] = ${runtimeTemplate.returningFunction("value", "")};`, + `${RuntimeGlobals.definePropertyGetters}(ns, def);`, + "return ns;" + ]), + "};" + ]); + } +} -/** - * @typedef {Object} CacheGroupSource - * @property {string=} key - * @property {number=} priority - * @property {GetName=} getName - * @property {ChunkFilterFunction=} chunksFilter - * @property {boolean=} enforce - * @property {SplitChunksSizes} minSize - * @property {SplitChunksSizes} minSizeReduction - * @property {SplitChunksSizes} minRemainingSize - * @property {SplitChunksSizes} enforceSizeThreshold - * @property {SplitChunksSizes} maxAsyncSize - * @property {SplitChunksSizes} maxInitialSize - * @property {number=} minChunks - * @property {number=} maxAsyncRequests - * @property {number=} maxInitialRequests - * @property {(string | function(PathData, AssetInfo=): string)=} filename - * @property {string=} idHint - * @property {string} automaticNameDelimiter - * @property {boolean=} reuseExistingChunk - * @property {boolean=} usedExports - */ +module.exports = CreateFakeNamespaceObjectRuntimeModule; -/** - * @typedef {Object} CacheGroup - * @property {string} key - * @property {number=} priority - * @property {GetName=} getName - * @property {ChunkFilterFunction=} chunksFilter - * @property {SplitChunksSizes} minSize - * @property {SplitChunksSizes} minSizeReduction - * @property {SplitChunksSizes} minRemainingSize - * @property {SplitChunksSizes} enforceSizeThreshold - * @property {SplitChunksSizes} maxAsyncSize - * @property {SplitChunksSizes} maxInitialSize - * @property {number=} minChunks - * @property {number=} maxAsyncRequests - * @property {number=} maxInitialRequests - * @property {(string | function(PathData, AssetInfo=): string)=} filename - * @property {string=} idHint - * @property {string} automaticNameDelimiter - * @property {boolean} reuseExistingChunk - * @property {boolean} usedExports - * @property {boolean} _validateSize - * @property {boolean} _validateRemainingSize - * @property {SplitChunksSizes} _minSizeForMaxSize - * @property {boolean} _conditionalEnforce - */ -/** - * @typedef {Object} FallbackCacheGroup - * @property {ChunkFilterFunction} chunksFilter - * @property {SplitChunksSizes} minSize - * @property {SplitChunksSizes} maxAsyncSize - * @property {SplitChunksSizes} maxInitialSize - * @property {string} automaticNameDelimiter - */ +/***/ }), -/** - * @typedef {Object} CacheGroupsContext - * @property {ModuleGraph} moduleGraph - * @property {ChunkGraph} chunkGraph - */ +/***/ 2759: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** - * @callback GetCacheGroups - * @param {Module} module - * @param {CacheGroupsContext} context - * @returns {CacheGroupSource[]} - */ +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ -/** - * @callback GetName - * @param {Module=} module - * @param {Chunk[]=} chunks - * @param {string=} key - * @returns {string=} - */ -/** - * @typedef {Object} SplitChunksOptions - * @property {ChunkFilterFunction} chunksFilter - * @property {string[]} defaultSizeTypes - * @property {SplitChunksSizes} minSize - * @property {SplitChunksSizes} minSizeReduction - * @property {SplitChunksSizes} minRemainingSize - * @property {SplitChunksSizes} enforceSizeThreshold - * @property {SplitChunksSizes} maxInitialSize - * @property {SplitChunksSizes} maxAsyncSize - * @property {number} minChunks - * @property {number} maxAsyncRequests - * @property {number} maxInitialRequests - * @property {boolean} hidePathInfo - * @property {string | function(PathData, AssetInfo=): string} filename - * @property {string} automaticNameDelimiter - * @property {GetCacheGroups} getCacheGroups - * @property {GetName} getName - * @property {boolean} usedExports - * @property {FallbackCacheGroup} fallbackCacheGroup - */ -/** - * @typedef {Object} ChunksInfoItem - * @property {SortableSet} modules - * @property {CacheGroup} cacheGroup - * @property {number} cacheGroupIndex - * @property {string} name - * @property {Record} sizes - * @property {Set} chunks - * @property {Set} reuseableChunks - * @property {Set} chunksKeys - */ +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const HelperRuntimeModule = __webpack_require__(82444); -const defaultGetName = /** @type {GetName} */ (() => {}); +class CreateScriptRuntimeModule extends HelperRuntimeModule { + constructor() { + super("trusted types script"); + } -const deterministicGroupingForModules = - /** @type {function(DeterministicGroupingOptionsForModule): DeterministicGroupingGroupedItemsForModule[]} */ ( - deterministicGrouping - ); + /** + * @returns {string} runtime code + */ + generate() { + const { compilation } = this; + const { runtimeTemplate, outputOptions } = compilation; + const { trustedTypes } = outputOptions; + const fn = RuntimeGlobals.createScript; -/** @type {WeakMap} */ -const getKeyCache = new WeakMap(); + return Template.asString( + `${fn} = ${runtimeTemplate.returningFunction( + trustedTypes + ? `${RuntimeGlobals.getTrustedTypesPolicy}().createScript(script)` + : "script", + "script" + )};` + ); + } +} -/** - * @param {string} name a filename to hash - * @param {OutputOptions} outputOptions hash function used - * @returns {string} hashed filename - */ -const hashFilename = (name, outputOptions) => { - const digest = /** @type {string} */ ( - createHash(outputOptions.hashFunction) - .update(name) - .digest(outputOptions.hashDigest) - ); - return digest.slice(0, 8); -}; +module.exports = CreateScriptRuntimeModule; -/** - * @param {Chunk} chunk the chunk - * @returns {number} the number of requests - */ -const getRequests = chunk => { - let requests = 0; - for (const chunkGroup of chunk.groupsIterable) { - requests = Math.max(requests, chunkGroup.chunks.length); - } - return requests; -}; -const mapObject = (obj, fn) => { - const newObj = Object.create(null); - for (const key of Object.keys(obj)) { - newObj[key] = fn(obj[key], key); +/***/ }), + +/***/ 21213: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const HelperRuntimeModule = __webpack_require__(82444); + +class CreateScriptUrlRuntimeModule extends HelperRuntimeModule { + constructor() { + super("trusted types script url"); } - return newObj; -}; -/** - * @template T - * @param {Set} a set - * @param {Set} b other set - * @returns {boolean} true if at least one item of a is in b - */ -const isOverlap = (a, b) => { - for (const item of a) { - if (b.has(item)) return true; + /** + * @returns {string} runtime code + */ + generate() { + const { compilation } = this; + const { runtimeTemplate, outputOptions } = compilation; + const { trustedTypes } = outputOptions; + const fn = RuntimeGlobals.createScriptUrl; + + return Template.asString( + `${fn} = ${runtimeTemplate.returningFunction( + trustedTypes + ? `${RuntimeGlobals.getTrustedTypesPolicy}().createScriptURL(url)` + : "url", + "url" + )};` + ); } - return false; -}; +} -const compareModuleIterables = compareIterables(compareModulesByIdentifier); +module.exports = CreateScriptUrlRuntimeModule; -/** - * @param {ChunksInfoItem} a item - * @param {ChunksInfoItem} b item - * @returns {number} compare result - */ -const compareEntries = (a, b) => { - // 1. by priority - const diffPriority = a.cacheGroup.priority - b.cacheGroup.priority; - if (diffPriority) return diffPriority; - // 2. by number of chunks - const diffCount = a.chunks.size - b.chunks.size; - if (diffCount) return diffCount; - // 3. by size reduction - const aSizeReduce = totalSize(a.sizes) * (a.chunks.size - 1); - const bSizeReduce = totalSize(b.sizes) * (b.chunks.size - 1); - const diffSizeReduce = aSizeReduce - bSizeReduce; - if (diffSizeReduce) return diffSizeReduce; - // 4. by cache group index - const indexDiff = b.cacheGroupIndex - a.cacheGroupIndex; - if (indexDiff) return indexDiff; - // 5. by number of modules (to be able to compare by identifier) - const modulesA = a.modules; - const modulesB = b.modules; - const diff = modulesA.size - modulesB.size; - if (diff) return diff; - // 6. by module identifiers - modulesA.sort(); - modulesB.sort(); - return compareModuleIterables(modulesA, modulesB); -}; -const INITIAL_CHUNK_FILTER = chunk => chunk.canBeInitial(); -const ASYNC_CHUNK_FILTER = chunk => !chunk.canBeInitial(); -const ALL_CHUNK_FILTER = chunk => true; +/***/ }), -/** - * @param {OptimizationSplitChunksSizes} value the sizes - * @param {string[]} defaultSizeTypes the default size types - * @returns {SplitChunksSizes} normalized representation - */ -const normalizeSizes = (value, defaultSizeTypes) => { - if (typeof value === "number") { - /** @type {Record} */ - const o = {}; - for (const sizeType of defaultSizeTypes) o[sizeType] = value; - return o; - } else if (typeof value === "object" && value !== null) { - return { ...value }; - } else { - return {}; +/***/ 75481: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const HelperRuntimeModule = __webpack_require__(82444); + +class DefinePropertyGettersRuntimeModule extends HelperRuntimeModule { + constructor() { + super("define property getters"); } -}; -/** - * @param {...SplitChunksSizes} sizes the sizes - * @returns {SplitChunksSizes} the merged sizes - */ -const mergeSizes = (...sizes) => { - /** @type {SplitChunksSizes} */ - let merged = {}; - for (let i = sizes.length - 1; i >= 0; i--) { - merged = Object.assign(merged, sizes[i]); + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeTemplate } = this.compilation; + const fn = RuntimeGlobals.definePropertyGetters; + return Template.asString([ + "// define getter functions for harmony exports", + `${fn} = ${runtimeTemplate.basicFunction("exports, definition", [ + `for(var key in definition) {`, + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(definition, key) && !${RuntimeGlobals.hasOwnProperty}(exports, key)) {`, + Template.indent([ + "Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });" + ]), + "}" + ]), + "}" + ])};` + ]); } - return merged; -}; +} -/** - * @param {SplitChunksSizes} sizes the sizes - * @returns {boolean} true, if there are sizes > 0 - */ -const hasNonZeroSizes = sizes => { - for (const key of Object.keys(sizes)) { - if (sizes[key] > 0) return true; +module.exports = DefinePropertyGettersRuntimeModule; + + +/***/ }), + +/***/ 71519: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); + +class EnsureChunkRuntimeModule extends RuntimeModule { + constructor(runtimeRequirements) { + super("ensure chunk"); + this.runtimeRequirements = runtimeRequirements; } - return false; -}; -/** - * @param {SplitChunksSizes} a first sizes - * @param {SplitChunksSizes} b second sizes - * @param {CombineSizeFunction} combine a function to combine sizes - * @returns {SplitChunksSizes} the combine sizes - */ -const combineSizes = (a, b, combine) => { - const aKeys = new Set(Object.keys(a)); - const bKeys = new Set(Object.keys(b)); - /** @type {SplitChunksSizes} */ - const result = {}; - for (const key of aKeys) { - if (bKeys.has(key)) { - result[key] = combine(a[key], b[key]); + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeTemplate } = this.compilation; + // Check if there are non initial chunks which need to be imported using require-ensure + if (this.runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers)) { + const handlers = RuntimeGlobals.ensureChunkHandlers; + return Template.asString([ + `${handlers} = {};`, + "// This file contains only the entry chunk.", + "// The chunk loading function for additional chunks", + `${RuntimeGlobals.ensureChunk} = ${runtimeTemplate.basicFunction( + "chunkId", + [ + `return Promise.all(Object.keys(${handlers}).reduce(${runtimeTemplate.basicFunction( + "promises, key", + [`${handlers}[key](chunkId, promises);`, "return promises;"] + )}, []));` + ] + )};` + ]); } else { - result[key] = a[key]; - } - } - for (const key of bKeys) { - if (!aKeys.has(key)) { - result[key] = b[key]; + // There ensureChunk is used somewhere in the tree, so we need an empty requireEnsure + // function. This can happen with multiple entrypoints. + return Template.asString([ + "// The chunk loading function for additional chunks", + "// Since all referenced chunks are already included", + "// in this file, this function is empty here.", + `${RuntimeGlobals.ensureChunk} = ${runtimeTemplate.returningFunction( + "Promise.resolve()" + )};` + ]); } } - return result; -}; +} -/** - * @param {SplitChunksSizes} sizes the sizes - * @param {SplitChunksSizes} minSize the min sizes - * @returns {boolean} true if there are sizes and all existing sizes are at least `minSize` - */ -const checkMinSize = (sizes, minSize) => { - for (const key of Object.keys(minSize)) { - const size = sizes[key]; - if (size === undefined || size === 0) continue; - if (size < minSize[key]) return false; - } - return true; -}; +module.exports = EnsureChunkRuntimeModule; -/** - * @param {SplitChunksSizes} sizes the sizes - * @param {SplitChunksSizes} minSizeReduction the min sizes - * @param {number} chunkCount number of chunks - * @returns {boolean} true if there are sizes and all existing sizes are at least `minSizeReduction` - */ -const checkMinSizeReduction = (sizes, minSizeReduction, chunkCount) => { - for (const key of Object.keys(minSizeReduction)) { - const size = sizes[key]; - if (size === undefined || size === 0) continue; - if (size * chunkCount < minSizeReduction[key]) return false; - } - return true; -}; -/** - * @param {SplitChunksSizes} sizes the sizes - * @param {SplitChunksSizes} minSize the min sizes - * @returns {undefined | string[]} list of size types that are below min size - */ -const getViolatingMinSizes = (sizes, minSize) => { - let list; - for (const key of Object.keys(minSize)) { - const size = sizes[key]; - if (size === undefined || size === 0) continue; - if (size < minSize[key]) { - if (list === undefined) list = [key]; - else list.push(key); - } - } - return list; -}; +/***/ }), -/** - * @param {SplitChunksSizes} sizes the sizes - * @returns {number} the total size - */ -const totalSize = sizes => { - let size = 0; - for (const key of Object.keys(sizes)) { - size += sizes[key]; - } - return size; -}; +/***/ 34277: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** - * @param {false|string|Function} name the chunk name - * @returns {GetName} a function to get the name of the chunk - */ -const normalizeName = name => { - if (typeof name === "string") { - return () => name; - } - if (typeof name === "function") { - return /** @type {GetName} */ (name); - } -}; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ -/** - * @param {OptimizationSplitChunksCacheGroup["chunks"]} chunks the chunk filter option - * @returns {ChunkFilterFunction} the chunk filter function - */ -const normalizeChunksFilter = chunks => { - if (chunks === "initial") { - return INITIAL_CHUNK_FILTER; - } - if (chunks === "async") { - return ASYNC_CHUNK_FILTER; - } - if (chunks === "all") { - return ALL_CHUNK_FILTER; - } - if (typeof chunks === "function") { - return chunks; - } -}; -/** - * @param {GetCacheGroups | Record} cacheGroups the cache group options - * @param {string[]} defaultSizeTypes the default size types - * @returns {GetCacheGroups} a function to get the cache groups - */ -const normalizeCacheGroups = (cacheGroups, defaultSizeTypes) => { - if (typeof cacheGroups === "function") { - return cacheGroups; + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); +const { first } = __webpack_require__(93347); + +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("../Compilation").PathData} PathData */ + +/** @typedef {function(PathData, AssetInfo=): string} FilenameFunction */ + +class GetChunkFilenameRuntimeModule extends RuntimeModule { + /** + * @param {string} contentType the contentType to use the content hash for + * @param {string} name kind of filename + * @param {string} global function name to be assigned + * @param {function(Chunk): string | FilenameFunction} getFilenameForChunk functor to get the filename or function + * @param {boolean} allChunks when false, only async chunks are included + */ + constructor(contentType, name, global, getFilenameForChunk, allChunks) { + super(`get ${name} chunk filename`); + this.contentType = contentType; + this.global = global; + this.getFilenameForChunk = getFilenameForChunk; + this.allChunks = allChunks; + this.dependentHash = true; } - if (typeof cacheGroups === "object" && cacheGroups !== null) { - /** @type {(function(Module, CacheGroupsContext, CacheGroupSource[]): void)[]} */ - const handlers = []; - for (const key of Object.keys(cacheGroups)) { - const option = cacheGroups[key]; - if (option === false) { - continue; - } - if (typeof option === "string" || option instanceof RegExp) { - const source = createCacheGroupSource({}, key, defaultSizeTypes); - handlers.push((module, context, results) => { - if (checkTest(option, module, context)) { - results.push(source); - } - }); - } else if (typeof option === "function") { - const cache = new WeakMap(); - handlers.push((module, context, results) => { - const result = option(module); - if (result) { - const groups = Array.isArray(result) ? result : [result]; - for (const group of groups) { - const cachedSource = cache.get(group); - if (cachedSource !== undefined) { - results.push(cachedSource); - } else { - const source = createCacheGroupSource( - group, - key, - defaultSizeTypes - ); - cache.set(group, source); - results.push(source); - } + + /** + * @returns {string} runtime code + */ + generate() { + const { + global, + chunk, + chunkGraph, + contentType, + getFilenameForChunk, + allChunks, + compilation + } = this; + const { runtimeTemplate } = compilation; + + /** @type {Map>} */ + const chunkFilenames = new Map(); + let maxChunks = 0; + /** @type {string} */ + let dynamicFilename; + + /** + * @param {Chunk} c the chunk + * @returns {void} + */ + const addChunk = c => { + const chunkFilename = getFilenameForChunk(c); + if (chunkFilename) { + let set = chunkFilenames.get(chunkFilename); + if (set === undefined) { + chunkFilenames.set(chunkFilename, (set = new Set())); + } + set.add(c); + if (typeof chunkFilename === "string") { + if (set.size < maxChunks) return; + if (set.size === maxChunks) { + if (chunkFilename.length < dynamicFilename.length) return; + if (chunkFilename.length === dynamicFilename.length) { + if (chunkFilename < dynamicFilename) return; } } - }); - } else { - const source = createCacheGroupSource(option, key, defaultSizeTypes); - handlers.push((module, context, results) => { - if ( - checkTest(option.test, module, context) && - checkModuleType(option.type, module) && - checkModuleLayer(option.layer, module) - ) { - results.push(source); - } - }); + maxChunks = set.size; + dynamicFilename = chunkFilename; + } } - } - /** - * @param {Module} module the current module - * @param {CacheGroupsContext} context the current context - * @returns {CacheGroupSource[]} the matching cache groups - */ - const fn = (module, context) => { - /** @type {CacheGroupSource[]} */ - let results = []; - for (const fn of handlers) { - fn(module, context, results); + }; + + /** @type {string[]} */ + const includedChunksMessages = []; + if (allChunks) { + includedChunksMessages.push("all chunks"); + for (const c of chunk.getAllReferencedChunks()) { + addChunk(c); } - return results; + } else { + includedChunksMessages.push("async chunks"); + for (const c of chunk.getAllAsyncChunks()) { + addChunk(c); + } + const includeEntries = chunkGraph + .getTreeRuntimeRequirements(chunk) + .has(RuntimeGlobals.ensureChunkIncludeEntries); + if (includeEntries) { + includedChunksMessages.push("sibling chunks for the entrypoint"); + for (const c of chunkGraph.getChunkEntryDependentChunksIterable( + chunk + )) { + addChunk(c); + } + } + } + for (const entrypoint of chunk.getAllReferencedAsyncEntrypoints()) { + addChunk(entrypoint.chunks[entrypoint.chunks.length - 1]); + } + + /** @type {Map>} */ + const staticUrls = new Map(); + /** @type {Set} */ + const dynamicUrlChunks = new Set(); + + /** + * @param {Chunk} c the chunk + * @param {string | FilenameFunction} chunkFilename the filename template for the chunk + * @returns {void} + */ + const addStaticUrl = (c, chunkFilename) => { + /** + * @param {string | number} value a value + * @returns {string} string to put in quotes + */ + const unquotedStringify = value => { + const str = `${value}`; + if (str.length >= 5 && str === `${c.id}`) { + // This is shorter and generates the same result + return '" + chunkId + "'; + } + const s = JSON.stringify(str); + return s.slice(1, s.length - 1); + }; + const unquotedStringifyWithLength = value => length => + unquotedStringify(`${value}`.slice(0, length)); + const chunkFilenameValue = + typeof chunkFilename === "function" + ? JSON.stringify( + chunkFilename({ + chunk: c, + contentHashType: contentType + }) + ) + : JSON.stringify(chunkFilename); + const staticChunkFilename = compilation.getPath(chunkFilenameValue, { + hash: `" + ${RuntimeGlobals.getFullHash}() + "`, + hashWithLength: length => + `" + ${RuntimeGlobals.getFullHash}().slice(0, ${length}) + "`, + chunk: { + id: unquotedStringify(c.id), + hash: unquotedStringify(c.renderedHash), + hashWithLength: unquotedStringifyWithLength(c.renderedHash), + name: unquotedStringify(c.name || c.id), + contentHash: { + [contentType]: unquotedStringify(c.contentHash[contentType]) + }, + contentHashWithLength: { + [contentType]: unquotedStringifyWithLength( + c.contentHash[contentType] + ) + } + }, + contentHashType: contentType + }); + let set = staticUrls.get(staticChunkFilename); + if (set === undefined) { + staticUrls.set(staticChunkFilename, (set = new Set())); + } + set.add(c.id); }; - return fn; - } - return () => null; -}; -/** - * @param {undefined|boolean|string|RegExp|Function} test test option - * @param {Module} module the module - * @param {CacheGroupsContext} context context object - * @returns {boolean} true, if the module should be selected - */ -const checkTest = (test, module, context) => { - if (test === undefined) return true; - if (typeof test === "function") { - return test(module, context); - } - if (typeof test === "boolean") return test; - if (typeof test === "string") { - const name = module.nameForCondition(); - return name && name.startsWith(test); - } - if (test instanceof RegExp) { - const name = module.nameForCondition(); - return name && test.test(name); - } - return false; -}; + for (const [filename, chunks] of chunkFilenames) { + if (filename !== dynamicFilename) { + for (const c of chunks) addStaticUrl(c, filename); + } else { + for (const c of chunks) dynamicUrlChunks.add(c); + } + } -/** - * @param {undefined|string|RegExp|Function} test type option - * @param {Module} module the module - * @returns {boolean} true, if the module should be selected - */ -const checkModuleType = (test, module) => { - if (test === undefined) return true; - if (typeof test === "function") { - return test(module.type); - } - if (typeof test === "string") { - const type = module.type; - return test === type; - } - if (test instanceof RegExp) { - const type = module.type; - return test.test(type); - } - return false; -}; + /** + * @param {function(Chunk): string | number} fn function from chunk to value + * @returns {string} code with static mapping of results of fn + */ + const createMap = fn => { + const obj = {}; + let useId = false; + let lastKey; + let entries = 0; + for (const c of dynamicUrlChunks) { + const value = fn(c); + if (value === c.id) { + useId = true; + } else { + obj[c.id] = value; + lastKey = c.id; + entries++; + } + } + if (entries === 0) return "chunkId"; + if (entries === 1) { + return useId + ? `(chunkId === ${JSON.stringify(lastKey)} ? ${JSON.stringify( + obj[lastKey] + )} : chunkId)` + : JSON.stringify(obj[lastKey]); + } + return useId + ? `(${JSON.stringify(obj)}[chunkId] || chunkId)` + : `${JSON.stringify(obj)}[chunkId]`; + }; -/** - * @param {undefined|string|RegExp|Function} test type option - * @param {Module} module the module - * @returns {boolean} true, if the module should be selected - */ -const checkModuleLayer = (test, module) => { - if (test === undefined) return true; - if (typeof test === "function") { - return test(module.layer); + /** + * @param {function(Chunk): string | number} fn function from chunk to value + * @returns {string} code with static mapping of results of fn for including in quoted string + */ + const mapExpr = fn => { + return `" + ${createMap(fn)} + "`; + }; + + /** + * @param {function(Chunk): string | number} fn function from chunk to value + * @returns {function(number): string} function which generates code with static mapping of results of fn for including in quoted string for specific length + */ + const mapExprWithLength = fn => length => { + return `" + ${createMap(c => `${fn(c)}`.slice(0, length))} + "`; + }; + + const url = + dynamicFilename && + compilation.getPath(JSON.stringify(dynamicFilename), { + hash: `" + ${RuntimeGlobals.getFullHash}() + "`, + hashWithLength: length => + `" + ${RuntimeGlobals.getFullHash}().slice(0, ${length}) + "`, + chunk: { + id: `" + chunkId + "`, + hash: mapExpr(c => c.renderedHash), + hashWithLength: mapExprWithLength(c => c.renderedHash), + name: mapExpr(c => c.name || c.id), + contentHash: { + [contentType]: mapExpr(c => c.contentHash[contentType]) + }, + contentHashWithLength: { + [contentType]: mapExprWithLength(c => c.contentHash[contentType]) + } + }, + contentHashType: contentType + }); + + return Template.asString([ + `// This function allow to reference ${includedChunksMessages.join( + " and " + )}`, + `${global} = ${runtimeTemplate.basicFunction( + "chunkId", + + staticUrls.size > 0 + ? [ + "// return url for filenames not based on template", + // it minimizes to `x===1?"...":x===2?"...":"..."` + Template.asString( + Array.from(staticUrls, ([url, ids]) => { + const condition = + ids.size === 1 + ? `chunkId === ${JSON.stringify(first(ids))}` + : `{${Array.from( + ids, + id => `${JSON.stringify(id)}:1` + ).join(",")}}[chunkId]`; + return `if (${condition}) return ${url};`; + }) + ), + "// return url for filenames based on template", + `return ${url};` + ] + : ["// return url for filenames based on template", `return ${url};`] + )};` + ]); } - if (typeof test === "string") { - const layer = module.layer; - return test === "" ? !layer : layer && layer.startsWith(test); +} + +module.exports = GetChunkFilenameRuntimeModule; + + +/***/ }), + +/***/ 88732: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); + +/** @typedef {import("../Compilation")} Compilation */ + +class GetFullHashRuntimeModule extends RuntimeModule { + constructor() { + super("getFullHash"); + this.fullHash = true; } - if (test instanceof RegExp) { - const layer = module.layer; - return test.test(layer); + + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeTemplate } = this.compilation; + return `${RuntimeGlobals.getFullHash} = ${runtimeTemplate.returningFunction( + JSON.stringify(this.compilation.hash || "XXXX") + )}`; } - return false; -}; +} -/** - * @param {OptimizationSplitChunksCacheGroup} options the group options - * @param {string} key key of cache group - * @param {string[]} defaultSizeTypes the default size types - * @returns {CacheGroupSource} the normalized cached group - */ -const createCacheGroupSource = (options, key, defaultSizeTypes) => { - const minSize = normalizeSizes(options.minSize, defaultSizeTypes); - const minSizeReduction = normalizeSizes( - options.minSizeReduction, - defaultSizeTypes - ); - const maxSize = normalizeSizes(options.maxSize, defaultSizeTypes); - return { - key, - priority: options.priority, - getName: normalizeName(options.name), - chunksFilter: normalizeChunksFilter(options.chunks), - enforce: options.enforce, - minSize, - minSizeReduction, - minRemainingSize: mergeSizes( - normalizeSizes(options.minRemainingSize, defaultSizeTypes), - minSize - ), - enforceSizeThreshold: normalizeSizes( - options.enforceSizeThreshold, - defaultSizeTypes - ), - maxAsyncSize: mergeSizes( - normalizeSizes(options.maxAsyncSize, defaultSizeTypes), - maxSize - ), - maxInitialSize: mergeSizes( - normalizeSizes(options.maxInitialSize, defaultSizeTypes), - maxSize - ), - minChunks: options.minChunks, - maxAsyncRequests: options.maxAsyncRequests, - maxInitialRequests: options.maxInitialRequests, - filename: options.filename, - idHint: options.idHint, - automaticNameDelimiter: options.automaticNameDelimiter, - reuseExistingChunk: options.reuseExistingChunk, - usedExports: options.usedExports - }; -}; +module.exports = GetFullHashRuntimeModule; -module.exports = class SplitChunksPlugin { + +/***/ }), + +/***/ 10029: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); + +/** @typedef {import("../Compilation")} Compilation */ + +class GetMainFilenameRuntimeModule extends RuntimeModule { /** - * @param {OptimizationSplitChunksOptions=} options plugin options + * @param {string} name readable name + * @param {string} global global object binding + * @param {string} filename main file name */ - constructor(options = {}) { - const defaultSizeTypes = options.defaultSizeTypes || [ - "javascript", - "unknown" - ]; - const fallbackCacheGroup = options.fallbackCacheGroup || {}; - const minSize = normalizeSizes(options.minSize, defaultSizeTypes); - const minSizeReduction = normalizeSizes( - options.minSizeReduction, - defaultSizeTypes - ); - const maxSize = normalizeSizes(options.maxSize, defaultSizeTypes); + constructor(name, global, filename) { + super(`get ${name} filename`); + this.global = global; + this.filename = filename; + } - /** @type {SplitChunksOptions} */ - this.options = { - chunksFilter: normalizeChunksFilter(options.chunks || "all"), - defaultSizeTypes, - minSize, - minSizeReduction, - minRemainingSize: mergeSizes( - normalizeSizes(options.minRemainingSize, defaultSizeTypes), - minSize - ), - enforceSizeThreshold: normalizeSizes( - options.enforceSizeThreshold, - defaultSizeTypes - ), - maxAsyncSize: mergeSizes( - normalizeSizes(options.maxAsyncSize, defaultSizeTypes), - maxSize - ), - maxInitialSize: mergeSizes( - normalizeSizes(options.maxInitialSize, defaultSizeTypes), - maxSize - ), - minChunks: options.minChunks || 1, - maxAsyncRequests: options.maxAsyncRequests || 1, - maxInitialRequests: options.maxInitialRequests || 1, - hidePathInfo: options.hidePathInfo || false, - filename: options.filename || undefined, - getCacheGroups: normalizeCacheGroups( - options.cacheGroups, - defaultSizeTypes - ), - getName: options.name ? normalizeName(options.name) : defaultGetName, - automaticNameDelimiter: options.automaticNameDelimiter, - usedExports: options.usedExports, - fallbackCacheGroup: { - chunksFilter: normalizeChunksFilter( - fallbackCacheGroup.chunks || options.chunks || "all" - ), - minSize: mergeSizes( - normalizeSizes(fallbackCacheGroup.minSize, defaultSizeTypes), - minSize - ), - maxAsyncSize: mergeSizes( - normalizeSizes(fallbackCacheGroup.maxAsyncSize, defaultSizeTypes), - normalizeSizes(fallbackCacheGroup.maxSize, defaultSizeTypes), - normalizeSizes(options.maxAsyncSize, defaultSizeTypes), - normalizeSizes(options.maxSize, defaultSizeTypes) - ), - maxInitialSize: mergeSizes( - normalizeSizes(fallbackCacheGroup.maxInitialSize, defaultSizeTypes), - normalizeSizes(fallbackCacheGroup.maxSize, defaultSizeTypes), - normalizeSizes(options.maxInitialSize, defaultSizeTypes), - normalizeSizes(options.maxSize, defaultSizeTypes) - ), - automaticNameDelimiter: - fallbackCacheGroup.automaticNameDelimiter || - options.automaticNameDelimiter || - "~" - } - }; + /** + * @returns {string} runtime code + */ + generate() { + const { global, filename, compilation, chunk } = this; + const { runtimeTemplate } = compilation; + const url = compilation.getPath(JSON.stringify(filename), { + hash: `" + ${RuntimeGlobals.getFullHash}() + "`, + hashWithLength: length => + `" + ${RuntimeGlobals.getFullHash}().slice(0, ${length}) + "`, + chunk, + runtime: chunk.runtime + }); + return Template.asString([ + `${global} = ${runtimeTemplate.returningFunction(url)};` + ]); + } +} - /** @type {WeakMap} */ - this._cacheGroupCache = new WeakMap(); +module.exports = GetMainFilenameRuntimeModule; + + +/***/ }), + +/***/ 38713: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const HelperRuntimeModule = __webpack_require__(82444); + +class GetTrustedTypesPolicyRuntimeModule extends HelperRuntimeModule { + /** + * @param {Set} runtimeRequirements runtime requirements + */ + constructor(runtimeRequirements) { + super("trusted types policy"); + this.runtimeRequirements = runtimeRequirements; } /** - * @param {CacheGroupSource} cacheGroupSource source - * @returns {CacheGroup} the cache group (cached) + * @returns {string} runtime code */ - _getCacheGroup(cacheGroupSource) { - const cacheEntry = this._cacheGroupCache.get(cacheGroupSource); - if (cacheEntry !== undefined) return cacheEntry; - const minSize = mergeSizes( - cacheGroupSource.minSize, - cacheGroupSource.enforce ? undefined : this.options.minSize - ); - const minSizeReduction = mergeSizes( - cacheGroupSource.minSizeReduction, - cacheGroupSource.enforce ? undefined : this.options.minSizeReduction - ); - const minRemainingSize = mergeSizes( - cacheGroupSource.minRemainingSize, - cacheGroupSource.enforce ? undefined : this.options.minRemainingSize - ); - const enforceSizeThreshold = mergeSizes( - cacheGroupSource.enforceSizeThreshold, - cacheGroupSource.enforce ? undefined : this.options.enforceSizeThreshold - ); - const cacheGroup = { - key: cacheGroupSource.key, - priority: cacheGroupSource.priority || 0, - chunksFilter: cacheGroupSource.chunksFilter || this.options.chunksFilter, - minSize, - minSizeReduction, - minRemainingSize, - enforceSizeThreshold, - maxAsyncSize: mergeSizes( - cacheGroupSource.maxAsyncSize, - cacheGroupSource.enforce ? undefined : this.options.maxAsyncSize - ), - maxInitialSize: mergeSizes( - cacheGroupSource.maxInitialSize, - cacheGroupSource.enforce ? undefined : this.options.maxInitialSize - ), - minChunks: - cacheGroupSource.minChunks !== undefined - ? cacheGroupSource.minChunks - : cacheGroupSource.enforce - ? 1 - : this.options.minChunks, - maxAsyncRequests: - cacheGroupSource.maxAsyncRequests !== undefined - ? cacheGroupSource.maxAsyncRequests - : cacheGroupSource.enforce - ? Infinity - : this.options.maxAsyncRequests, - maxInitialRequests: - cacheGroupSource.maxInitialRequests !== undefined - ? cacheGroupSource.maxInitialRequests - : cacheGroupSource.enforce - ? Infinity - : this.options.maxInitialRequests, - getName: - cacheGroupSource.getName !== undefined - ? cacheGroupSource.getName - : this.options.getName, - usedExports: - cacheGroupSource.usedExports !== undefined - ? cacheGroupSource.usedExports - : this.options.usedExports, - filename: - cacheGroupSource.filename !== undefined - ? cacheGroupSource.filename - : this.options.filename, - automaticNameDelimiter: - cacheGroupSource.automaticNameDelimiter !== undefined - ? cacheGroupSource.automaticNameDelimiter - : this.options.automaticNameDelimiter, - idHint: - cacheGroupSource.idHint !== undefined - ? cacheGroupSource.idHint - : cacheGroupSource.key, - reuseExistingChunk: cacheGroupSource.reuseExistingChunk || false, - _validateSize: hasNonZeroSizes(minSize), - _validateRemainingSize: hasNonZeroSizes(minRemainingSize), - _minSizeForMaxSize: mergeSizes( - cacheGroupSource.minSize, - this.options.minSize - ), - _conditionalEnforce: hasNonZeroSizes(enforceSizeThreshold) - }; - this._cacheGroupCache.set(cacheGroupSource, cacheGroup); - return cacheGroup; + generate() { + const { compilation } = this; + const { runtimeTemplate, outputOptions } = compilation; + const { trustedTypes } = outputOptions; + const fn = RuntimeGlobals.getTrustedTypesPolicy; + + return Template.asString([ + "var policy;", + `${fn} = ${runtimeTemplate.basicFunction("", [ + "// Create Trusted Type policy if Trusted Types are available and the policy doesn't exist yet.", + "if (policy === undefined) {", + Template.indent([ + "policy = {", + Template.indent( + [ + ...(this.runtimeRequirements.has(RuntimeGlobals.createScript) + ? [ + `createScript: ${runtimeTemplate.returningFunction( + "script", + "script" + )}` + ] + : []), + ...(this.runtimeRequirements.has(RuntimeGlobals.createScriptUrl) + ? [ + `createScriptURL: ${runtimeTemplate.returningFunction( + "url", + "url" + )}` + ] + : []) + ].join(",\n") + ), + "};", + ...(trustedTypes + ? [ + 'if (typeof trustedTypes !== "undefined" && trustedTypes.createPolicy) {', + Template.indent([ + `policy = trustedTypes.createPolicy(${JSON.stringify( + trustedTypes.policyName + )}, policy);` + ]), + "}" + ] + : []) + ]), + "}", + "return policy;" + ])};` + ]); + } +} + +module.exports = GetTrustedTypesPolicyRuntimeModule; + + +/***/ }), + +/***/ 23255: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); + +class GlobalRuntimeModule extends RuntimeModule { + constructor() { + super("global"); } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @returns {string} runtime code */ - apply(compiler) { - const cachedMakePathsRelative = makePathsRelative.bindContextCache( - compiler.context, - compiler.root - ); - compiler.hooks.thisCompilation.tap("SplitChunksPlugin", compilation => { - const logger = compilation.getLogger("webpack.SplitChunksPlugin"); - let alreadyOptimized = false; - compilation.hooks.unseal.tap("SplitChunksPlugin", () => { - alreadyOptimized = false; - }); - compilation.hooks.optimizeChunks.tap( - { - name: "SplitChunksPlugin", - stage: STAGE_ADVANCED - }, - chunks => { - if (alreadyOptimized) return; - alreadyOptimized = true; - logger.time("prepare"); - const chunkGraph = compilation.chunkGraph; - const moduleGraph = compilation.moduleGraph; - // Give each selected chunk an index (to create strings from chunks) - /** @type {Map} */ - const chunkIndexMap = new Map(); - const ZERO = BigInt("0"); - const ONE = BigInt("1"); - const START = ONE << BigInt("31"); - let index = START; - for (const chunk of chunks) { - chunkIndexMap.set( - chunk, - index | BigInt((Math.random() * 0x7fffffff) | 0) - ); - index = index << ONE; - } - /** - * @param {Iterable} chunks list of chunks - * @returns {bigint | Chunk} key of the chunks - */ - const getKey = chunks => { - const iterator = chunks[Symbol.iterator](); - let result = iterator.next(); - if (result.done) return ZERO; - const first = result.value; - result = iterator.next(); - if (result.done) return first; - let key = - chunkIndexMap.get(first) | chunkIndexMap.get(result.value); - while (!(result = iterator.next()).done) { - const raw = chunkIndexMap.get(result.value); - key = key ^ raw; - } - return key; - }; - const keyToString = key => { - if (typeof key === "bigint") return key.toString(16); - return chunkIndexMap.get(key).toString(16); - }; + generate() { + return Template.asString([ + `${RuntimeGlobals.global} = (function() {`, + Template.indent([ + "if (typeof globalThis === 'object') return globalThis;", + "try {", + Template.indent( + // This works in non-strict mode + // or + // This works if eval is allowed (see CSP) + "return this || new Function('return this')();" + ), + "} catch (e) {", + Template.indent( + // This works if the window reference is available + "if (typeof window === 'object') return window;" + ), + "}" + // It can still be `undefined`, but nothing to do about it... + // We return `undefined`, instead of nothing here, so it's + // easier to handle this case: + // if (!global) { … } + ]), + "})();" + ]); + } +} - const getChunkSetsInGraph = memoize(() => { - /** @type {Map>} */ - const chunkSetsInGraph = new Map(); - /** @type {Set} */ - const singleChunkSets = new Set(); - for (const module of compilation.modules) { - const chunks = chunkGraph.getModuleChunksIterable(module); - const chunksKey = getKey(chunks); - if (typeof chunksKey === "bigint") { - if (!chunkSetsInGraph.has(chunksKey)) { - chunkSetsInGraph.set(chunksKey, new Set(chunks)); - } - } else { - singleChunkSets.add(chunksKey); - } - } - return { chunkSetsInGraph, singleChunkSets }; - }); +module.exports = GlobalRuntimeModule; - /** - * @param {Module} module the module - * @returns {Iterable} groups of chunks with equal exports - */ - const groupChunksByExports = module => { - const exportsInfo = moduleGraph.getExportsInfo(module); - const groupedByUsedExports = new Map(); - for (const chunk of chunkGraph.getModuleChunksIterable(module)) { - const key = exportsInfo.getUsageKey(chunk.runtime); - const list = groupedByUsedExports.get(key); - if (list !== undefined) { - list.push(chunk); - } else { - groupedByUsedExports.set(key, [chunk]); - } - } - return groupedByUsedExports.values(); - }; - /** @type {Map>} */ - const groupedByExportsMap = new Map(); +/***/ }), - const getExportsChunkSetsInGraph = memoize(() => { - /** @type {Map>} */ - const chunkSetsInGraph = new Map(); - /** @type {Set} */ - const singleChunkSets = new Set(); - for (const module of compilation.modules) { - const groupedChunks = Array.from(groupChunksByExports(module)); - groupedByExportsMap.set(module, groupedChunks); - for (const chunks of groupedChunks) { - if (chunks.length === 1) { - singleChunkSets.add(chunks[0]); - } else { - const chunksKey = /** @type {bigint} */ (getKey(chunks)); - if (!chunkSetsInGraph.has(chunksKey)) { - chunkSetsInGraph.set(chunksKey, new Set(chunks)); - } - } - } - } - return { chunkSetsInGraph, singleChunkSets }; - }); +/***/ 8011: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // group these set of chunks by count - // to allow to check less sets via isSubset - // (only smaller sets can be subset) - const groupChunkSetsByCount = chunkSets => { - /** @type {Map>>} */ - const chunkSetsByCount = new Map(); - for (const chunksSet of chunkSets) { - const count = chunksSet.size; - let array = chunkSetsByCount.get(count); - if (array === undefined) { - array = []; - chunkSetsByCount.set(count, array); - } - array.push(chunksSet); - } - return chunkSetsByCount; - }; - const getChunkSetsByCount = memoize(() => - groupChunkSetsByCount( - getChunkSetsInGraph().chunkSetsInGraph.values() - ) - ); - const getExportsChunkSetsByCount = memoize(() => - groupChunkSetsByCount( - getExportsChunkSetsInGraph().chunkSetsInGraph.values() - ) - ); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Sergey Melyukov @smelukov +*/ - // Create a list of possible combinations - const createGetCombinations = ( - chunkSets, - singleChunkSets, - chunkSetsByCount - ) => { - /** @type {Map | Chunk)[]>} */ - const combinationsCache = new Map(); - return key => { - const cacheEntry = combinationsCache.get(key); - if (cacheEntry !== undefined) return cacheEntry; - if (key instanceof Chunk) { - const result = [key]; - combinationsCache.set(key, result); - return result; - } - const chunksSet = chunkSets.get(key); - /** @type {(Set | Chunk)[]} */ - const array = [chunksSet]; - for (const [count, setArray] of chunkSetsByCount) { - // "equal" is not needed because they would have been merge in the first step - if (count < chunksSet.size) { - for (const set of setArray) { - if (isSubset(chunksSet, set)) { - array.push(set); - } - } - } - } - for (const chunk of singleChunkSets) { - if (chunksSet.has(chunk)) { - array.push(chunk); - } - } - combinationsCache.set(key, array); - return array; - }; - }; - const getCombinationsFactory = memoize(() => { - const { chunkSetsInGraph, singleChunkSets } = getChunkSetsInGraph(); - return createGetCombinations( - chunkSetsInGraph, - singleChunkSets, - getChunkSetsByCount() - ); - }); - const getCombinations = key => getCombinationsFactory()(key); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); - const getExportsCombinationsFactory = memoize(() => { - const { chunkSetsInGraph, singleChunkSets } = - getExportsChunkSetsInGraph(); - return createGetCombinations( - chunkSetsInGraph, - singleChunkSets, - getExportsChunkSetsByCount() - ); - }); - const getExportsCombinations = key => - getExportsCombinationsFactory()(key); +class HasOwnPropertyRuntimeModule extends RuntimeModule { + constructor() { + super("hasOwnProperty shorthand"); + } - /** - * @typedef {Object} SelectedChunksResult - * @property {Chunk[]} chunks the list of chunks - * @property {bigint | Chunk} key a key of the list - */ + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeTemplate } = this.compilation; - /** @type {WeakMap | Chunk, WeakMap>} */ - const selectedChunksCacheByChunksSet = new WeakMap(); + return Template.asString([ + `${RuntimeGlobals.hasOwnProperty} = ${runtimeTemplate.returningFunction( + "Object.prototype.hasOwnProperty.call(obj, prop)", + "obj, prop" + )}` + ]); + } +} - /** - * get list and key by applying the filter function to the list - * It is cached for performance reasons - * @param {Set | Chunk} chunks list of chunks - * @param {ChunkFilterFunction} chunkFilter filter function for chunks - * @returns {SelectedChunksResult} list and key - */ - const getSelectedChunks = (chunks, chunkFilter) => { - let entry = selectedChunksCacheByChunksSet.get(chunks); - if (entry === undefined) { - entry = new WeakMap(); - selectedChunksCacheByChunksSet.set(chunks, entry); - } - /** @type {SelectedChunksResult} */ - let entry2 = entry.get(chunkFilter); - if (entry2 === undefined) { - /** @type {Chunk[]} */ - const selectedChunks = []; - if (chunks instanceof Chunk) { - if (chunkFilter(chunks)) selectedChunks.push(chunks); - } else { - for (const chunk of chunks) { - if (chunkFilter(chunk)) selectedChunks.push(chunk); - } - } - entry2 = { - chunks: selectedChunks, - key: getKey(selectedChunks) - }; - entry.set(chunkFilter, entry2); - } - return entry2; - }; +module.exports = HasOwnPropertyRuntimeModule; - /** @type {Map} */ - const alreadyValidatedParents = new Map(); - /** @type {Set} */ - const alreadyReportedErrors = new Set(); - // Map a list of chunks to a list of modules - // For the key the chunk "index" is used, the value is a SortableSet of modules - /** @type {Map} */ - const chunksInfoMap = new Map(); +/***/ }), - /** - * @param {CacheGroup} cacheGroup the current cache group - * @param {number} cacheGroupIndex the index of the cache group of ordering - * @param {Chunk[]} selectedChunks chunks selected for this module - * @param {bigint | Chunk} selectedChunksKey a key of selectedChunks - * @param {Module} module the current module - * @returns {void} - */ - const addModuleToChunksInfoMap = ( - cacheGroup, - cacheGroupIndex, - selectedChunks, - selectedChunksKey, - module - ) => { - // Break if minimum number of chunks is not reached - if (selectedChunks.length < cacheGroup.minChunks) return; - // Determine name for split chunk - const name = cacheGroup.getName( - module, - selectedChunks, - cacheGroup.key - ); - // Check if the name is ok - const existingChunk = compilation.namedChunks.get(name); - if (existingChunk) { - const parentValidationKey = `${name}|${ - typeof selectedChunksKey === "bigint" - ? selectedChunksKey - : selectedChunksKey.debugId - }`; - const valid = alreadyValidatedParents.get(parentValidationKey); - if (valid === false) return; - if (valid === undefined) { - // Module can only be moved into the existing chunk if the existing chunk - // is a parent of all selected chunks - let isInAllParents = true; - /** @type {Set} */ - const queue = new Set(); - for (const chunk of selectedChunks) { - for (const group of chunk.groupsIterable) { - queue.add(group); - } - } - for (const group of queue) { - if (existingChunk.isInGroup(group)) continue; - let hasParent = false; - for (const parent of group.parentsIterable) { - hasParent = true; - queue.add(parent); - } - if (!hasParent) { - isInAllParents = false; - } - } - const valid = isInAllParents; - alreadyValidatedParents.set(parentValidationKey, valid); - if (!valid) { - if (!alreadyReportedErrors.has(name)) { - alreadyReportedErrors.add(name); - compilation.errors.push( - new WebpackError( - "SplitChunksPlugin\n" + - `Cache group "${cacheGroup.key}" conflicts with existing chunk.\n` + - `Both have the same name "${name}" and existing chunk is not a parent of the selected modules.\n` + - "Use a different name for the cache group or make sure that the existing chunk is a parent (e. g. via dependOn).\n" + - 'HINT: You can omit "name" to automatically create a name.\n' + - "BREAKING CHANGE: webpack < 5 used to allow to use an entrypoint as splitChunk. " + - "This is no longer allowed when the entrypoint is not a parent of the selected modules.\n" + - "Remove this entrypoint and add modules to cache group's 'test' instead. " + - "If you need modules to be evaluated on startup, add them to the existing entrypoints (make them arrays). " + - "See migration guide of more info." - ) - ); - } - return; - } - } - } - // Create key for maps - // When it has a name we use the name as key - // Otherwise we create the key from chunks and cache group key - // This automatically merges equal names - const key = - cacheGroup.key + - (name - ? ` name:${name}` - : ` chunks:${keyToString(selectedChunksKey)}`); - // Add module to maps - let info = chunksInfoMap.get(key); - if (info === undefined) { - chunksInfoMap.set( - key, - (info = { - modules: new SortableSet( - undefined, - compareModulesByIdentifier - ), - cacheGroup, - cacheGroupIndex, - name, - sizes: {}, - chunks: new Set(), - reuseableChunks: new Set(), - chunksKeys: new Set() - }) - ); - } - const oldSize = info.modules.size; - info.modules.add(module); - if (info.modules.size !== oldSize) { - for (const type of module.getSourceTypes()) { - info.sizes[type] = (info.sizes[type] || 0) + module.size(type); - } - } - const oldChunksKeysSize = info.chunksKeys.size; - info.chunksKeys.add(selectedChunksKey); - if (oldChunksKeysSize !== info.chunksKeys.size) { - for (const chunk of selectedChunks) { - info.chunks.add(chunk); - } - } - }; +/***/ 82444: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const context = { - moduleGraph, - chunkGraph - }; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ - logger.timeEnd("prepare"); - logger.time("modules"); - // Walk through all modules - for (const module of compilation.modules) { - // Get cache group - let cacheGroups = this.options.getCacheGroups(module, context); - if (!Array.isArray(cacheGroups) || cacheGroups.length === 0) { - continue; - } +const RuntimeModule = __webpack_require__(16963); - // Prepare some values (usedExports = false) - const getCombs = memoize(() => { - const chunks = chunkGraph.getModuleChunksIterable(module); - const chunksKey = getKey(chunks); - return getCombinations(chunksKey); - }); +class HelperRuntimeModule extends RuntimeModule { + /** + * @param {string} name a readable name + */ + constructor(name) { + super(name); + } +} - // Prepare some values (usedExports = true) - const getCombsByUsedExports = memoize(() => { - // fill the groupedByExportsMap - getExportsChunkSetsInGraph(); - /** @type {Set | Chunk>} */ - const set = new Set(); - const groupedByUsedExports = groupedByExportsMap.get(module); - for (const chunks of groupedByUsedExports) { - const chunksKey = getKey(chunks); - for (const comb of getExportsCombinations(chunksKey)) - set.add(comb); - } - return set; - }); +module.exports = HelperRuntimeModule; - let cacheGroupIndex = 0; - for (const cacheGroupSource of cacheGroups) { - const cacheGroup = this._getCacheGroup(cacheGroupSource); - const combs = cacheGroup.usedExports - ? getCombsByUsedExports() - : getCombs(); - // For all combination of chunk selection - for (const chunkCombination of combs) { - // Break if minimum number of chunks is not reached - const count = - chunkCombination instanceof Chunk ? 1 : chunkCombination.size; - if (count < cacheGroup.minChunks) continue; - // Select chunks by configuration - const { chunks: selectedChunks, key: selectedChunksKey } = - getSelectedChunks(chunkCombination, cacheGroup.chunksFilter); +/***/ }), - addModuleToChunksInfoMap( - cacheGroup, - cacheGroupIndex, - selectedChunks, - selectedChunksKey, - module - ); - } - cacheGroupIndex++; - } - } +/***/ 19942: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - logger.timeEnd("modules"); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ - logger.time("queue"); - /** - * @param {ChunksInfoItem} info entry - * @param {string[]} sourceTypes source types to be removed - */ - const removeModulesWithSourceType = (info, sourceTypes) => { - for (const module of info.modules) { - const types = module.getSourceTypes(); - if (sourceTypes.some(type => types.has(type))) { - info.modules.delete(module); - for (const type of types) { - info.sizes[type] -= module.size(type); - } - } - } - }; - /** - * @param {ChunksInfoItem} info entry - * @returns {boolean} true, if entry become empty - */ - const removeMinSizeViolatingModules = info => { - if (!info.cacheGroup._validateSize) return false; - const violatingSizes = getViolatingMinSizes( - info.sizes, - info.cacheGroup.minSize - ); - if (violatingSizes === undefined) return false; - removeModulesWithSourceType(info, violatingSizes); - return info.modules.size === 0; - }; +const { SyncWaterfallHook } = __webpack_require__(6967); +const Compilation = __webpack_require__(85720); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const HelperRuntimeModule = __webpack_require__(82444); - // Filter items were size < minSize - for (const [key, info] of chunksInfoMap) { - if (removeMinSizeViolatingModules(info)) { - chunksInfoMap.delete(key); - } else if ( - !checkMinSizeReduction( - info.sizes, - info.cacheGroup.minSizeReduction, - info.chunks.size - ) - ) { - chunksInfoMap.delete(key); - } - } +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compiler")} Compiler */ - /** - * @typedef {Object} MaxSizeQueueItem - * @property {SplitChunksSizes} minSize - * @property {SplitChunksSizes} maxAsyncSize - * @property {SplitChunksSizes} maxInitialSize - * @property {string} automaticNameDelimiter - * @property {string[]} keys - */ +/** + * @typedef {Object} LoadScriptCompilationHooks + * @property {SyncWaterfallHook<[string, Chunk]>} createScript + */ - /** @type {Map} */ - const maxSizeQueueMap = new Map(); +/** @type {WeakMap} */ +const compilationHooksMap = new WeakMap(); - while (chunksInfoMap.size > 0) { - // Find best matching entry - let bestEntryKey; - let bestEntry; - for (const pair of chunksInfoMap) { - const key = pair[0]; - const info = pair[1]; - if ( - bestEntry === undefined || - compareEntries(bestEntry, info) < 0 - ) { - bestEntry = info; - bestEntryKey = key; - } - } +class LoadScriptRuntimeModule extends HelperRuntimeModule { + /** + * @param {Compilation} compilation the compilation + * @returns {LoadScriptCompilationHooks} hooks + */ + static getCompilationHooks(compilation) { + if (!(compilation instanceof Compilation)) { + throw new TypeError( + "The 'compilation' argument must be an instance of Compilation" + ); + } + let hooks = compilationHooksMap.get(compilation); + if (hooks === undefined) { + hooks = { + createScript: new SyncWaterfallHook(["source", "chunk"]) + }; + compilationHooksMap.set(compilation, hooks); + } + return hooks; + } - const item = bestEntry; - chunksInfoMap.delete(bestEntryKey); + /** + * @param {boolean=} withCreateScriptUrl use create script url for trusted types + */ + constructor(withCreateScriptUrl) { + super("load script"); + this._withCreateScriptUrl = withCreateScriptUrl; + } - let chunkName = item.name; - // Variable for the new chunk (lazy created) - /** @type {Chunk} */ - let newChunk; - // When no chunk name, check if we can reuse a chunk instead of creating a new one - let isExistingChunk = false; - let isReusedWithAllModules = false; - if (chunkName) { - const chunkByName = compilation.namedChunks.get(chunkName); - if (chunkByName !== undefined) { - newChunk = chunkByName; - const oldSize = item.chunks.size; - item.chunks.delete(newChunk); - isExistingChunk = item.chunks.size !== oldSize; - } - } else if (item.cacheGroup.reuseExistingChunk) { - outer: for (const chunk of item.chunks) { - if ( - chunkGraph.getNumberOfChunkModules(chunk) !== - item.modules.size - ) { - continue; - } - if ( - item.chunks.size > 1 && - chunkGraph.getNumberOfEntryModules(chunk) > 0 - ) { - continue; - } - for (const module of item.modules) { - if (!chunkGraph.isModuleInChunk(module, chunk)) { - continue outer; - } - } - if (!newChunk || !newChunk.name) { - newChunk = chunk; - } else if ( - chunk.name && - chunk.name.length < newChunk.name.length - ) { - newChunk = chunk; - } else if ( - chunk.name && - chunk.name.length === newChunk.name.length && - chunk.name < newChunk.name - ) { - newChunk = chunk; - } - } - if (newChunk) { - item.chunks.delete(newChunk); - chunkName = undefined; - isExistingChunk = true; - isReusedWithAllModules = true; - } - } + /** + * @returns {string} runtime code + */ + generate() { + const { compilation } = this; + const { runtimeTemplate, outputOptions } = compilation; + const { + scriptType, + chunkLoadTimeout: loadTimeout, + crossOriginLoading, + uniqueName, + charset + } = outputOptions; + const fn = RuntimeGlobals.loadScript; - const enforced = - item.cacheGroup._conditionalEnforce && - checkMinSize(item.sizes, item.cacheGroup.enforceSizeThreshold); + const { createScript } = + LoadScriptRuntimeModule.getCompilationHooks(compilation); - const usedChunks = new Set(item.chunks); + const code = Template.asString([ + "script = document.createElement('script');", + scriptType ? `script.type = ${JSON.stringify(scriptType)};` : "", + charset ? "script.charset = 'utf-8';" : "", + `script.timeout = ${loadTimeout / 1000};`, + `if (${RuntimeGlobals.scriptNonce}) {`, + Template.indent( + `script.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});` + ), + "}", + uniqueName + ? 'script.setAttribute("data-webpack", dataWebpackPrefix + key);' + : "", + `script.src = ${ + this._withCreateScriptUrl + ? `${RuntimeGlobals.createScriptUrl}(url)` + : "url" + };`, + crossOriginLoading + ? Template.asString([ + "if (script.src.indexOf(window.location.origin + '/') !== 0) {", + Template.indent( + `script.crossOrigin = ${JSON.stringify(crossOriginLoading)};` + ), + "}" + ]) + : "" + ]); - // Check if maxRequests condition can be fulfilled - if ( - !enforced && - (Number.isFinite(item.cacheGroup.maxInitialRequests) || - Number.isFinite(item.cacheGroup.maxAsyncRequests)) - ) { - for (const chunk of usedChunks) { - // respect max requests - const maxRequests = chunk.isOnlyInitial() - ? item.cacheGroup.maxInitialRequests - : chunk.canBeInitial() - ? Math.min( - item.cacheGroup.maxInitialRequests, - item.cacheGroup.maxAsyncRequests - ) - : item.cacheGroup.maxAsyncRequests; - if ( - isFinite(maxRequests) && - getRequests(chunk) >= maxRequests - ) { - usedChunks.delete(chunk); - } - } - } + return Template.asString([ + "var inProgress = {};", + uniqueName + ? `var dataWebpackPrefix = ${JSON.stringify(uniqueName + ":")};` + : "// data-webpack is not used as build has no uniqueName", + "// loadScript function to load a script via script tag", + `${fn} = ${runtimeTemplate.basicFunction("url, done, key, chunkId", [ + "if(inProgress[url]) { inProgress[url].push(done); return; }", + "var script, needAttach;", + "if(key !== undefined) {", + Template.indent([ + 'var scripts = document.getElementsByTagName("script");', + "for(var i = 0; i < scripts.length; i++) {", + Template.indent([ + "var s = scripts[i];", + `if(s.getAttribute("src") == url${ + uniqueName + ? ' || s.getAttribute("data-webpack") == dataWebpackPrefix + key' + : "" + }) { script = s; break; }` + ]), + "}" + ]), + "}", + "if(!script) {", + Template.indent([ + "needAttach = true;", + createScript.call(code, this.chunk) + ]), + "}", + "inProgress[url] = [done];", + "var onScriptComplete = " + + runtimeTemplate.basicFunction( + "prev, event", + Template.asString([ + "// avoid mem leaks in IE.", + "script.onerror = script.onload = null;", + "clearTimeout(timeout);", + "var doneFns = inProgress[url];", + "delete inProgress[url];", + "script.parentNode && script.parentNode.removeChild(script);", + `doneFns && doneFns.forEach(${runtimeTemplate.returningFunction( + "fn(event)", + "fn" + )});`, + "if(prev) return prev(event);" + ]) + ), + ";", + `var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), ${loadTimeout});`, + "script.onerror = onScriptComplete.bind(null, script.onerror);", + "script.onload = onScriptComplete.bind(null, script.onload);", + "needAttach && document.head.appendChild(script);" + ])};` + ]); + } +} - outer: for (const chunk of usedChunks) { - for (const module of item.modules) { - if (chunkGraph.isModuleInChunk(module, chunk)) continue outer; - } - usedChunks.delete(chunk); - } +module.exports = LoadScriptRuntimeModule; - // Were some (invalid) chunks removed from usedChunks? - // => readd all modules to the queue, as things could have been changed - if (usedChunks.size < item.chunks.size) { - if (isExistingChunk) usedChunks.add(newChunk); - if (usedChunks.size >= item.cacheGroup.minChunks) { - const chunksArr = Array.from(usedChunks); - for (const module of item.modules) { - addModuleToChunksInfoMap( - item.cacheGroup, - item.cacheGroupIndex, - chunksArr, - getKey(usedChunks), - module - ); - } - } - continue; - } - // Validate minRemainingSize constraint when a single chunk is left over - if ( - !enforced && - item.cacheGroup._validateRemainingSize && - usedChunks.size === 1 - ) { - const [chunk] = usedChunks; - let chunkSizes = Object.create(null); - for (const module of chunkGraph.getChunkModulesIterable(chunk)) { - if (!item.modules.has(module)) { - for (const type of module.getSourceTypes()) { - chunkSizes[type] = - (chunkSizes[type] || 0) + module.size(type); - } - } - } - const violatingSizes = getViolatingMinSizes( - chunkSizes, - item.cacheGroup.minRemainingSize - ); - if (violatingSizes !== undefined) { - const oldModulesSize = item.modules.size; - removeModulesWithSourceType(item, violatingSizes); - if ( - item.modules.size > 0 && - item.modules.size !== oldModulesSize - ) { - // queue this item again to be processed again - // without violating modules - chunksInfoMap.set(bestEntryKey, item); - } - continue; - } - } +/***/ }), - // Create the new chunk if not reusing one - if (newChunk === undefined) { - newChunk = compilation.addChunk(chunkName); - } - // Walk through all chunks - for (const chunk of usedChunks) { - // Add graph connections for splitted chunk - chunk.split(newChunk); - } +/***/ 65714: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // Add a note to the chunk - newChunk.chunkReason = - (newChunk.chunkReason ? newChunk.chunkReason + ", " : "") + - (isReusedWithAllModules - ? "reused as split chunk" - : "split chunk"); - if (item.cacheGroup.key) { - newChunk.chunkReason += ` (cache group: ${item.cacheGroup.key})`; - } - if (chunkName) { - newChunk.chunkReason += ` (name: ${chunkName})`; - } - if (item.cacheGroup.filename) { - newChunk.filenameTemplate = item.cacheGroup.filename; - } - if (item.cacheGroup.idHint) { - newChunk.idNameHints.add(item.cacheGroup.idHint); - } - if (!isReusedWithAllModules) { - // Add all modules to the new chunk - for (const module of item.modules) { - if (!module.chunkCondition(newChunk, compilation)) continue; - // Add module to new chunk - chunkGraph.connectChunkAndModule(newChunk, module); - // Remove module from used chunks - for (const chunk of usedChunks) { - chunkGraph.disconnectChunkAndModule(chunk, module); - } - } - } else { - // Remove all modules from used chunks - for (const module of item.modules) { - for (const chunk of usedChunks) { - chunkGraph.disconnectChunkAndModule(chunk, module); - } - } - } - - if ( - Object.keys(item.cacheGroup.maxAsyncSize).length > 0 || - Object.keys(item.cacheGroup.maxInitialSize).length > 0 - ) { - const oldMaxSizeSettings = maxSizeQueueMap.get(newChunk); - maxSizeQueueMap.set(newChunk, { - minSize: oldMaxSizeSettings - ? combineSizes( - oldMaxSizeSettings.minSize, - item.cacheGroup._minSizeForMaxSize, - Math.max - ) - : item.cacheGroup.minSize, - maxAsyncSize: oldMaxSizeSettings - ? combineSizes( - oldMaxSizeSettings.maxAsyncSize, - item.cacheGroup.maxAsyncSize, - Math.min - ) - : item.cacheGroup.maxAsyncSize, - maxInitialSize: oldMaxSizeSettings - ? combineSizes( - oldMaxSizeSettings.maxInitialSize, - item.cacheGroup.maxInitialSize, - Math.min - ) - : item.cacheGroup.maxInitialSize, - automaticNameDelimiter: item.cacheGroup.automaticNameDelimiter, - keys: oldMaxSizeSettings - ? oldMaxSizeSettings.keys.concat(item.cacheGroup.key) - : [item.cacheGroup.key] - }); - } - - // remove all modules from other entries and update size - for (const [key, info] of chunksInfoMap) { - if (isOverlap(info.chunks, usedChunks)) { - // update modules and total size - // may remove it from the map when < minSize - let updated = false; - for (const module of item.modules) { - if (info.modules.has(module)) { - // remove module - info.modules.delete(module); - // update size - for (const key of module.getSourceTypes()) { - info.sizes[key] -= module.size(key); - } - updated = true; - } - } - if (updated) { - if (info.modules.size === 0) { - chunksInfoMap.delete(key); - continue; - } - if ( - removeMinSizeViolatingModules(info) || - !checkMinSizeReduction( - info.sizes, - info.cacheGroup.minSizeReduction, - info.chunks.size - ) - ) { - chunksInfoMap.delete(key); - continue; - } - } - } - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ - logger.timeEnd("queue"); - logger.time("maxSize"); - /** @type {Set} */ - const incorrectMinMaxSizeSet = new Set(); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const HelperRuntimeModule = __webpack_require__(82444); - const { outputOptions } = compilation; +class MakeNamespaceObjectRuntimeModule extends HelperRuntimeModule { + constructor() { + super("make namespace object"); + } - // Make sure that maxSize is fulfilled - const { fallbackCacheGroup } = this.options; - for (const chunk of Array.from(compilation.chunks)) { - const chunkConfig = maxSizeQueueMap.get(chunk); - const { - minSize, - maxAsyncSize, - maxInitialSize, - automaticNameDelimiter - } = chunkConfig || fallbackCacheGroup; - if (!chunkConfig && !fallbackCacheGroup.chunksFilter(chunk)) - continue; - /** @type {SplitChunksSizes} */ - let maxSize; - if (chunk.isOnlyInitial()) { - maxSize = maxInitialSize; - } else if (chunk.canBeInitial()) { - maxSize = combineSizes(maxAsyncSize, maxInitialSize, Math.min); - } else { - maxSize = maxAsyncSize; - } - if (Object.keys(maxSize).length === 0) { - continue; - } - for (const key of Object.keys(maxSize)) { - const maxSizeValue = maxSize[key]; - const minSizeValue = minSize[key]; - if ( - typeof minSizeValue === "number" && - minSizeValue > maxSizeValue - ) { - const keys = chunkConfig && chunkConfig.keys; - const warningKey = `${ - keys && keys.join() - } ${minSizeValue} ${maxSizeValue}`; - if (!incorrectMinMaxSizeSet.has(warningKey)) { - incorrectMinMaxSizeSet.add(warningKey); - compilation.warnings.push( - new MinMaxSizeWarning(keys, minSizeValue, maxSizeValue) - ); - } - } - } - const results = deterministicGroupingForModules({ - minSize, - maxSize: mapObject(maxSize, (value, key) => { - const minSizeValue = minSize[key]; - return typeof minSizeValue === "number" - ? Math.max(value, minSizeValue) - : value; - }), - items: chunkGraph.getChunkModulesIterable(chunk), - getKey(module) { - const cache = getKeyCache.get(module); - if (cache !== undefined) return cache; - const ident = cachedMakePathsRelative(module.identifier()); - const nameForCondition = - module.nameForCondition && module.nameForCondition(); - const name = nameForCondition - ? cachedMakePathsRelative(nameForCondition) - : ident.replace(/^.*!|\?[^?!]*$/g, ""); - const fullKey = - name + - automaticNameDelimiter + - hashFilename(ident, outputOptions); - const key = requestToId(fullKey); - getKeyCache.set(module, key); - return key; - }, - getSize(module) { - const size = Object.create(null); - for (const key of module.getSourceTypes()) { - size[key] = module.size(key); - } - return size; - } - }); - if (results.length <= 1) { - continue; - } - for (let i = 0; i < results.length; i++) { - const group = results[i]; - const key = this.options.hidePathInfo - ? hashFilename(group.key, outputOptions) - : group.key; - let name = chunk.name - ? chunk.name + automaticNameDelimiter + key - : null; - if (name && name.length > 100) { - name = - name.slice(0, 100) + - automaticNameDelimiter + - hashFilename(name, outputOptions); - } - if (i !== results.length - 1) { - const newPart = compilation.addChunk(name); - chunk.split(newPart); - newPart.chunkReason = chunk.chunkReason; - // Add all modules to the new chunk - for (const module of group.items) { - if (!module.chunkCondition(newPart, compilation)) { - continue; - } - // Add module to new chunk - chunkGraph.connectChunkAndModule(newPart, module); - // Remove module from used chunks - chunkGraph.disconnectChunkAndModule(chunk, module); - } - } else { - // change the chunk to be a part - chunk.name = name; - } - } - } - logger.timeEnd("maxSize"); - } - ); - }); + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeTemplate } = this.compilation; + const fn = RuntimeGlobals.makeNamespaceObject; + return Template.asString([ + "// define __esModule on exports", + `${fn} = ${runtimeTemplate.basicFunction("exports", [ + "if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {", + Template.indent([ + "Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });" + ]), + "}", + "Object.defineProperty(exports, '__esModule', { value: true });" + ])};` + ]); } -}; +} + +module.exports = MakeNamespaceObjectRuntimeModule; /***/ }), -/***/ 52149: +/***/ 44518: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Sean Larkin @thelarkinn */ -const { formatSize } = __webpack_require__(71070); -const WebpackError = __webpack_require__(53799); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); -/** @typedef {import("./SizeLimitsPlugin").AssetDetails} AssetDetails */ +class OnChunksLoadedRuntimeModule extends RuntimeModule { + constructor() { + super("chunk loaded"); + } -module.exports = class AssetsOverSizeLimitWarning extends WebpackError { /** - * @param {AssetDetails[]} assetsOverSizeLimit the assets - * @param {number} assetLimit the size limit + * @returns {string} runtime code */ - constructor(assetsOverSizeLimit, assetLimit) { - const assetLists = assetsOverSizeLimit - .map(asset => `\n ${asset.name} (${formatSize(asset.size)})`) - .join(""); - - super(`asset size limit: The following asset(s) exceed the recommended size limit (${formatSize( - assetLimit - )}). -This can impact web performance. -Assets: ${assetLists}`); - - this.name = "AssetsOverSizeLimitWarning"; - this.assets = assetsOverSizeLimit; + generate() { + const { compilation } = this; + const { runtimeTemplate } = compilation; + return Template.asString([ + "var deferred = [];", + `${RuntimeGlobals.onChunksLoaded} = ${runtimeTemplate.basicFunction( + "result, chunkIds, fn, priority", + [ + "if(chunkIds) {", + Template.indent([ + "priority = priority || 0;", + "for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];", + "deferred[i] = [chunkIds, fn, priority];", + "return;" + ]), + "}", + "var notFulfilled = Infinity;", + "for (var i = 0; i < deferred.length; i++) {", + Template.indent([ + runtimeTemplate.destructureArray( + ["chunkIds", "fn", "priority"], + "deferred[i]" + ), + "var fulfilled = true;", + "for (var j = 0; j < chunkIds.length; j++) {", + Template.indent([ + `if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(${ + RuntimeGlobals.onChunksLoaded + }).every(${runtimeTemplate.returningFunction( + `${RuntimeGlobals.onChunksLoaded}[key](chunkIds[j])`, + "key" + )})) {`, + Template.indent(["chunkIds.splice(j--, 1);"]), + "} else {", + Template.indent([ + "fulfilled = false;", + "if(priority < notFulfilled) notFulfilled = priority;" + ]), + "}" + ]), + "}", + "if(fulfilled) {", + Template.indent([ + "deferred.splice(i--, 1)", + "var r = fn();", + "if (r !== undefined) result = r;" + ]), + "}" + ]), + "}", + "return result;" + ] + )};` + ]); } -}; +} + +module.exports = OnChunksLoadedRuntimeModule; /***/ }), -/***/ 84229: +/***/ 56030: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Sean Larkin @thelarkinn */ -const { formatSize } = __webpack_require__(71070); -const WebpackError = __webpack_require__(53799); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); -/** @typedef {import("./SizeLimitsPlugin").EntrypointDetails} EntrypointDetails */ +class PublicPathRuntimeModule extends RuntimeModule { + constructor(publicPath) { + super("publicPath", RuntimeModule.STAGE_BASIC); + this.publicPath = publicPath; + } -module.exports = class EntrypointsOverSizeLimitWarning extends WebpackError { /** - * @param {EntrypointDetails[]} entrypoints the entrypoints - * @param {number} entrypointLimit the size limit + * @returns {string} runtime code */ - constructor(entrypoints, entrypointLimit) { - const entrypointList = entrypoints - .map( - entrypoint => - `\n ${entrypoint.name} (${formatSize( - entrypoint.size - )})\n${entrypoint.files.map(asset => ` ${asset}`).join("\n")}` - ) - .join(""); - super(`entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (${formatSize( - entrypointLimit - )}). This can impact web performance. -Entrypoints:${entrypointList}\n`); + generate() { + const { compilation, publicPath } = this; - this.name = "EntrypointsOverSizeLimitWarning"; - this.entrypoints = entrypoints; + return `${RuntimeGlobals.publicPath} = ${JSON.stringify( + compilation.getPath(publicPath || "", { + hash: compilation.hash || "XXXX" + }) + )};`; } -}; +} + +module.exports = PublicPathRuntimeModule; /***/ }), -/***/ 17791: +/***/ 4537: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Sean Larkin @thelarkinn */ -const WebpackError = __webpack_require__(53799); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const HelperRuntimeModule = __webpack_require__(82444); -module.exports = class NoAsyncChunksWarning extends WebpackError { +class RelativeUrlRuntimeModule extends HelperRuntimeModule { constructor() { - super( - "webpack performance recommendations: \n" + - "You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.\n" + - "For more info visit https://webpack.js.org/guides/code-splitting/" - ); + super("relative url"); + } - this.name = "NoAsyncChunksWarning"; + /** + * @returns {string} runtime code + */ + generate() { + const { runtimeTemplate } = this.compilation; + return Template.asString([ + `${RuntimeGlobals.relativeUrl} = function RelativeURL(url) {`, + Template.indent([ + 'var realUrl = new URL(url, "x:/");', + "var values = {};", + "for (var key in realUrl) values[key] = realUrl[key];", + "values.href = url;", + 'values.pathname = url.replace(/[?#].*/, "");', + 'values.origin = values.protocol = "";', + `values.toString = values.toJSON = ${runtimeTemplate.returningFunction( + "url" + )};`, + "for (var key in values) Object.defineProperty(this, key, { enumerable: true, configurable: true, value: values[key] });" + ]), + "};", + `${RuntimeGlobals.relativeUrl}.prototype = URL.prototype;` + ]); } -}; +} + +module.exports = RelativeUrlRuntimeModule; /***/ }), -/***/ 32557: +/***/ 97115: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Sean Larkin @thelarkinn */ -const { find } = __webpack_require__(93347); -const AssetsOverSizeLimitWarning = __webpack_require__(52149); -const EntrypointsOverSizeLimitWarning = __webpack_require__(84229); -const NoAsyncChunksWarning = __webpack_require__(17791); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").PerformanceOptions} PerformanceOptions */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Entrypoint")} Entrypoint */ -/** @typedef {import("../WebpackError")} WebpackError */ +class RuntimeIdRuntimeModule extends RuntimeModule { + constructor() { + super("runtimeId"); + } -/** - * @typedef {Object} AssetDetails - * @property {string} name - * @property {number} size - */ + /** + * @returns {string} runtime code + */ + generate() { + const { chunkGraph, chunk } = this; + const runtime = chunk.runtime; + if (typeof runtime !== "string") + throw new Error("RuntimeIdRuntimeModule must be in a single runtime"); + const id = chunkGraph.getRuntimeId(runtime); + return `${RuntimeGlobals.runtimeId} = ${JSON.stringify(id)};`; + } +} -/** - * @typedef {Object} EntrypointDetails - * @property {string} name - * @property {number} size - * @property {string[]} files - */ +module.exports = RuntimeIdRuntimeModule; -const isOverSizeLimitSet = new WeakSet(); -const excludeSourceMap = (name, source, info) => !info.development; +/***/ }), -module.exports = class SizeLimitsPlugin { - /** - * @param {PerformanceOptions} options the plugin options - */ +/***/ 22339: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const StartupChunkDependenciesRuntimeModule = __webpack_require__(38157); +const StartupEntrypointRuntimeModule = __webpack_require__(97672); + +/** @typedef {import("../Compiler")} Compiler */ + +class StartupChunkDependenciesPlugin { constructor(options) { - this.hints = options.hints; - this.maxAssetSize = options.maxAssetSize; - this.maxEntrypointSize = options.maxEntrypointSize; - this.assetFilter = options.assetFilter; - } - - /** - * @param {ChunkGroup | Source} thing the resource to test - * @returns {boolean} true if over the limit - */ - static isOverSizeLimit(thing) { - return isOverSizeLimitSet.has(thing); + this.chunkLoading = options.chunkLoading; + this.asyncChunkLoading = + typeof options.asyncChunkLoading === "boolean" + ? options.asyncChunkLoading + : true; } /** @@ -114524,330 +110182,133 @@ module.exports = class SizeLimitsPlugin { * @returns {void} */ apply(compiler) { - const entrypointSizeLimit = this.maxEntrypointSize; - const assetSizeLimit = this.maxAssetSize; - const hints = this.hints; - const assetFilter = this.assetFilter || excludeSourceMap; - - compiler.hooks.afterEmit.tap("SizeLimitsPlugin", compilation => { - /** @type {WebpackError[]} */ - const warnings = []; - - /** - * @param {Entrypoint} entrypoint an entrypoint - * @returns {number} the size of the entrypoint - */ - const getEntrypointSize = entrypoint => { - let size = 0; - for (const file of entrypoint.getFiles()) { - const asset = compilation.getAsset(file); - if ( - asset && - assetFilter(asset.name, asset.source, asset.info) && - asset.source - ) { - size += asset.info.size || asset.source.size(); - } - } - return size; - }; - - /** @type {AssetDetails[]} */ - const assetsOverSizeLimit = []; - for (const { name, source, info } of compilation.getAssets()) { - if (!assetFilter(name, source, info) || !source) { - continue; - } - - const size = info.size || source.size(); - if (size > assetSizeLimit) { - assetsOverSizeLimit.push({ - name, - size - }); - isOverSizeLimitSet.add(source); - } - } - - const fileFilter = name => { - const asset = compilation.getAsset(name); - return asset && assetFilter(asset.name, asset.source, asset.info); - }; - - /** @type {EntrypointDetails[]} */ - const entrypointsOverLimit = []; - for (const [name, entry] of compilation.entrypoints) { - const size = getEntrypointSize(entry); - - if (size > entrypointSizeLimit) { - entrypointsOverLimit.push({ - name: name, - size: size, - files: entry.getFiles().filter(fileFilter) - }); - isOverSizeLimitSet.add(entry); - } - } - - if (hints) { - // 1. Individual Chunk: Size < 250kb - // 2. Collective Initial Chunks [entrypoint] (Each Set?): Size < 250kb - // 3. No Async Chunks - // if !1, then 2, if !2 return - if (assetsOverSizeLimit.length > 0) { - warnings.push( - new AssetsOverSizeLimitWarning(assetsOverSizeLimit, assetSizeLimit) - ); - } - if (entrypointsOverLimit.length > 0) { - warnings.push( - new EntrypointsOverSizeLimitWarning( - entrypointsOverLimit, - entrypointSizeLimit - ) - ); - } - - if (warnings.length > 0) { - const someAsyncChunk = find( - compilation.chunks, - chunk => !chunk.canBeInitial() - ); - - if (!someAsyncChunk) { - warnings.push(new NoAsyncChunksWarning()); - } - - if (hints === "error") { - compilation.errors.push(...warnings); - } else { - compilation.warnings.push(...warnings); - } - } - } - }); - } -}; - - -/***/ }), - -/***/ 95175: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - - -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); - -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ - -class ChunkPrefetchFunctionRuntimeModule extends RuntimeModule { - /** - * @param {string} childType TODO - * @param {string} runtimeFunction TODO - * @param {string} runtimeHandlers TODO - */ - constructor(childType, runtimeFunction, runtimeHandlers) { - super(`chunk ${childType} function`); - this.childType = childType; - this.runtimeFunction = runtimeFunction; - this.runtimeHandlers = runtimeHandlers; - } - - /** - * @returns {string} runtime code - */ - generate() { - const { runtimeFunction, runtimeHandlers } = this; - const { runtimeTemplate } = this.compilation; - return Template.asString([ - `${runtimeHandlers} = {};`, - `${runtimeFunction} = ${runtimeTemplate.basicFunction("chunkId", [ - // map is shorter than forEach - `Object.keys(${runtimeHandlers}).map(${runtimeTemplate.basicFunction( - "key", - `${runtimeHandlers}[key](chunkId);` - )});` - ])}` - ]); - } -} - -module.exports = ChunkPrefetchFunctionRuntimeModule; - - -/***/ }), - -/***/ 33895: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const ChunkPrefetchFunctionRuntimeModule = __webpack_require__(95175); -const ChunkPrefetchStartupRuntimeModule = __webpack_require__(15294); -const ChunkPrefetchTriggerRuntimeModule = __webpack_require__(98441); -const ChunkPreloadTriggerRuntimeModule = __webpack_require__(56236); - -/** @typedef {import("../Compiler")} Compiler */ - -class ChunkPrefetchPreloadPlugin { - /** - * @param {Compiler} compiler the compiler - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "ChunkPrefetchPreloadPlugin", + compiler.hooks.thisCompilation.tap( + "StartupChunkDependenciesPlugin", compilation => { - compilation.hooks.additionalChunkRuntimeRequirements.tap( - "ChunkPrefetchPreloadPlugin", - (chunk, set, { chunkGraph }) => { - if (chunkGraph.getNumberOfEntryModules(chunk) === 0) return; - const startupChildChunks = chunk.getChildrenOfTypeInOrder( - chunkGraph, - "prefetchOrder" - ); - if (startupChildChunks) { - set.add(RuntimeGlobals.prefetchChunk); - set.add(RuntimeGlobals.onChunksLoaded); - compilation.addRuntimeModule( - chunk, - new ChunkPrefetchStartupRuntimeModule(startupChildChunks) - ); - } - } - ); + const globalChunkLoading = compilation.outputOptions.chunkLoading; + const isEnabledForChunk = chunk => { + const options = chunk.getEntryOptions(); + const chunkLoading = + options && options.chunkLoading !== undefined + ? options.chunkLoading + : globalChunkLoading; + return chunkLoading === this.chunkLoading; + }; compilation.hooks.additionalTreeRuntimeRequirements.tap( - "ChunkPrefetchPreloadPlugin", + "StartupChunkDependenciesPlugin", (chunk, set, { chunkGraph }) => { - const chunkMap = chunk.getChildIdsByOrdersMap(chunkGraph, false); - - if (chunkMap.prefetch) { - set.add(RuntimeGlobals.prefetchChunk); - compilation.addRuntimeModule( - chunk, - new ChunkPrefetchTriggerRuntimeModule(chunkMap.prefetch) - ); - } - if (chunkMap.preload) { - set.add(RuntimeGlobals.preloadChunk); + if (!isEnabledForChunk(chunk)) return; + if (chunkGraph.hasChunkEntryDependentChunks(chunk)) { + set.add(RuntimeGlobals.startup); + set.add(RuntimeGlobals.ensureChunk); + set.add(RuntimeGlobals.ensureChunkIncludeEntries); compilation.addRuntimeModule( chunk, - new ChunkPreloadTriggerRuntimeModule(chunkMap.preload) + new StartupChunkDependenciesRuntimeModule( + this.asyncChunkLoading + ) ); } } ); compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.prefetchChunk) - .tap("ChunkPrefetchPreloadPlugin", (chunk, set) => { - compilation.addRuntimeModule( - chunk, - new ChunkPrefetchFunctionRuntimeModule( - "prefetch", - RuntimeGlobals.prefetchChunk, - RuntimeGlobals.prefetchChunkHandlers - ) - ); - set.add(RuntimeGlobals.prefetchChunkHandlers); - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.preloadChunk) - .tap("ChunkPrefetchPreloadPlugin", (chunk, set) => { + .for(RuntimeGlobals.startupEntrypoint) + .tap("StartupChunkDependenciesPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.require); + set.add(RuntimeGlobals.ensureChunk); + set.add(RuntimeGlobals.ensureChunkIncludeEntries); compilation.addRuntimeModule( chunk, - new ChunkPrefetchFunctionRuntimeModule( - "preload", - RuntimeGlobals.preloadChunk, - RuntimeGlobals.preloadChunkHandlers - ) + new StartupEntrypointRuntimeModule(this.asyncChunkLoading) ); - set.add(RuntimeGlobals.preloadChunkHandlers); }); } ); } } -module.exports = ChunkPrefetchPreloadPlugin; +module.exports = StartupChunkDependenciesPlugin; /***/ }), -/***/ 15294: +/***/ 38157: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ const RuntimeGlobals = __webpack_require__(16475); const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); - -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +const Template = __webpack_require__(1626); -class ChunkPrefetchStartupRuntimeModule extends RuntimeModule { - /** - * @param {{ onChunks: Chunk[], chunks: Set }[]} startupChunks chunk ids to trigger when chunks are loaded - */ - constructor(startupChunks) { - super("startup prefetch", RuntimeModule.STAGE_TRIGGER); - this.startupChunks = startupChunks; +class StartupChunkDependenciesRuntimeModule extends RuntimeModule { + constructor(asyncChunkLoading) { + super("startup chunk dependencies", RuntimeModule.STAGE_TRIGGER); + this.asyncChunkLoading = asyncChunkLoading; } /** * @returns {string} runtime code */ generate() { - const { startupChunks, chunk } = this; - const { runtimeTemplate } = this.compilation; - return Template.asString( - startupChunks.map( - ({ onChunks, chunks }) => - `${RuntimeGlobals.onChunksLoaded}(0, ${JSON.stringify( - // This need to include itself to delay execution after this chunk has been fully loaded - onChunks.filter(c => c === chunk).map(c => c.id) - )}, ${runtimeTemplate.basicFunction( - "", - chunks.size < 3 - ? Array.from( - chunks, - c => - `${RuntimeGlobals.prefetchChunk}(${JSON.stringify(c.id)});` - ) - : `${JSON.stringify(Array.from(chunks, c => c.id))}.map(${ - RuntimeGlobals.prefetchChunk - });` - )}, 5);` - ) - ); + const { chunkGraph, chunk, compilation } = this; + const { runtimeTemplate } = compilation; + const chunkIds = Array.from( + chunkGraph.getChunkEntryDependentChunksIterable(chunk) + ).map(chunk => { + return chunk.id; + }); + return Template.asString([ + `var next = ${RuntimeGlobals.startup};`, + `${RuntimeGlobals.startup} = ${runtimeTemplate.basicFunction( + "", + !this.asyncChunkLoading + ? chunkIds + .map( + id => `${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)});` + ) + .concat("return next();") + : chunkIds.length === 1 + ? `return ${RuntimeGlobals.ensureChunk}(${JSON.stringify( + chunkIds[0] + )}).then(next);` + : chunkIds.length > 2 + ? [ + // using map is shorter for 3 or more chunks + `return Promise.all(${JSON.stringify(chunkIds)}.map(${ + RuntimeGlobals.ensureChunk + }, __webpack_require__)).then(next);` + ] + : [ + // calling ensureChunk directly is shorter for 0 - 2 chunks + "return Promise.all([", + Template.indent( + chunkIds + .map( + id => `${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)})` + ) + .join(",\n") + ), + "]).then(next);" + ] + )};` + ]); } } -module.exports = ChunkPrefetchStartupRuntimeModule; +module.exports = StartupChunkDependenciesRuntimeModule; /***/ }), -/***/ 98441: +/***/ 97672: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -114859,52 +110320,53 @@ module.exports = ChunkPrefetchStartupRuntimeModule; const RuntimeGlobals = __webpack_require__(16475); const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../MainTemplate")} MainTemplate */ -class ChunkPrefetchTriggerRuntimeModule extends RuntimeModule { - /** - * @param {Record} chunkMap map from chunk to - */ - constructor(chunkMap) { - super(`chunk prefetch trigger`, RuntimeModule.STAGE_TRIGGER); - this.chunkMap = chunkMap; +class StartupEntrypointRuntimeModule extends RuntimeModule { + constructor(asyncChunkLoading) { + super("startup entrypoint"); + this.asyncChunkLoading = asyncChunkLoading; } /** * @returns {string} runtime code */ generate() { - const { chunkMap } = this; - const { runtimeTemplate } = this.compilation; - const body = [ - "var chunks = chunkToChildrenMap[chunkId];", - `Array.isArray(chunks) && chunks.map(${RuntimeGlobals.prefetchChunk});` - ]; - return Template.asString([ - Template.asString([ - `var chunkToChildrenMap = ${JSON.stringify(chunkMap, null, "\t")};`, - `${ - RuntimeGlobals.ensureChunkHandlers - }.prefetch = ${runtimeTemplate.expressionFunction( - `Promise.all(promises).then(${runtimeTemplate.basicFunction( - "", - body - )})`, - "chunkId, promises" - )};` - ]) - ]); + const { compilation } = this; + const { runtimeTemplate } = compilation; + return `${ + RuntimeGlobals.startupEntrypoint + } = ${runtimeTemplate.basicFunction("result, chunkIds, fn", [ + "// arguments: chunkIds, moduleId are deprecated", + "var moduleId = chunkIds;", + `if(!fn) chunkIds = result, fn = ${runtimeTemplate.returningFunction( + `__webpack_require__(${RuntimeGlobals.entryModuleId} = moduleId)` + )};`, + ...(this.asyncChunkLoading + ? [ + `return Promise.all(chunkIds.map(${ + RuntimeGlobals.ensureChunk + }, __webpack_require__)).then(${runtimeTemplate.basicFunction("", [ + "var r = fn();", + "return r === undefined ? result : r;" + ])})` + ] + : [ + `chunkIds.map(${RuntimeGlobals.ensureChunk}, __webpack_require__)`, + "var r = fn();", + "return r === undefined ? result : r;" + ]) + ])}`; } } -module.exports = ChunkPrefetchTriggerRuntimeModule; +module.exports = StartupEntrypointRuntimeModule; /***/ }), -/***/ 56236: +/***/ 80655: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -114916,47 +110378,29 @@ module.exports = ChunkPrefetchTriggerRuntimeModule; const RuntimeGlobals = __webpack_require__(16475); const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../Compilation")} Compilation */ -class ChunkPreloadTriggerRuntimeModule extends RuntimeModule { - /** - * @param {Record} chunkMap map from chunk to chunks - */ - constructor(chunkMap) { - super(`chunk preload trigger`, RuntimeModule.STAGE_TRIGGER); - this.chunkMap = chunkMap; +class SystemContextRuntimeModule extends RuntimeModule { + constructor() { + super("__system_context__"); } /** * @returns {string} runtime code */ generate() { - const { chunkMap } = this; - const { runtimeTemplate } = this.compilation; - const body = [ - "var chunks = chunkToChildrenMap[chunkId];", - `Array.isArray(chunks) && chunks.map(${RuntimeGlobals.preloadChunk});` - ]; - return Template.asString([ - Template.asString([ - `var chunkToChildrenMap = ${JSON.stringify(chunkMap, null, "\t")};`, - `${ - RuntimeGlobals.ensureChunkHandlers - }.preload = ${runtimeTemplate.basicFunction("chunkId", body)};` - ]) - ]); + return `${RuntimeGlobals.systemContext} = __system_context__;`; } } -module.exports = ChunkPreloadTriggerRuntimeModule; +module.exports = SystemContextRuntimeModule; /***/ }), -/***/ 30318: -/***/ (function(module) { +/***/ 64820: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -114966,44 +110410,61 @@ module.exports = ChunkPreloadTriggerRuntimeModule; -/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */ +const NormalModule = __webpack_require__(39); -class BasicEffectRulePlugin { - constructor(ruleProperty, effectType) { - this.ruleProperty = ruleProperty; - this.effectType = effectType || ruleProperty; - } +/** @typedef {import("../Compiler")} Compiler */ + +// data URL scheme: "data:text/javascript;charset=utf-8;base64,some-string" +// http://www.ietf.org/rfc/rfc2397.txt +const URIRegEx = /^data:([^;,]+)?((?:;[^;,]+)*?)(?:;(base64))?,(.*)$/i; +const decodeDataURI = uri => { + const match = URIRegEx.exec(uri); + if (!match) return null; + + const isBase64 = match[3]; + const body = match[4]; + return isBase64 + ? Buffer.from(body, "base64") + : Buffer.from(decodeURIComponent(body), "ascii"); +}; + +class DataUriPlugin { /** - * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply(ruleSetCompiler) { - ruleSetCompiler.hooks.rule.tap( - "BasicEffectRulePlugin", - (path, rule, unhandledProperties, result, references) => { - if (unhandledProperties.has(this.ruleProperty)) { - unhandledProperties.delete(this.ruleProperty); - - const value = rule[this.ruleProperty]; - - result.effects.push({ - type: this.effectType, - value + apply(compiler) { + compiler.hooks.compilation.tap( + "DataUriPlugin", + (compilation, { normalModuleFactory }) => { + normalModuleFactory.hooks.resolveForScheme + .for("data") + .tap("DataUriPlugin", resourceData => { + const match = URIRegEx.exec(resourceData.resource); + if (match) { + resourceData.data.mimetype = match[1] || ""; + resourceData.data.parameters = match[2] || ""; + resourceData.data.encoding = match[3] || false; + resourceData.data.encodedContent = match[4] || ""; + } }); - } + NormalModule.getCompilationHooks(compilation) + .readResourceForScheme.for("data") + .tap("DataUriPlugin", resource => decodeDataURI(resource)); } ); } } -module.exports = BasicEffectRulePlugin; +module.exports = DataUriPlugin; /***/ }), -/***/ 94215: -/***/ (function(module) { +/***/ 57637: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -115013,52 +110474,54 @@ module.exports = BasicEffectRulePlugin; -/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */ -/** @typedef {import("./RuleSetCompiler").RuleCondition} RuleCondition */ +const { URL, fileURLToPath } = __webpack_require__(57310); +const { NormalModule } = __webpack_require__(91919); -class BasicMatcherRulePlugin { - constructor(ruleProperty, dataProperty, invert) { - this.ruleProperty = ruleProperty; - this.dataProperty = dataProperty || ruleProperty; - this.invert = invert || false; - } +/** @typedef {import("../Compiler")} Compiler */ +class FileUriPlugin { /** - * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply(ruleSetCompiler) { - ruleSetCompiler.hooks.rule.tap( - "BasicMatcherRulePlugin", - (path, rule, unhandledProperties, result) => { - if (unhandledProperties.has(this.ruleProperty)) { - unhandledProperties.delete(this.ruleProperty); - const value = rule[this.ruleProperty]; - const condition = ruleSetCompiler.compileCondition( - `${path}.${this.ruleProperty}`, - value - ); - const fn = condition.fn; - result.conditions.push({ - property: this.dataProperty, - matchWhenEmpty: this.invert - ? !condition.matchWhenEmpty - : condition.matchWhenEmpty, - fn: this.invert ? v => !fn(v) : fn + apply(compiler) { + compiler.hooks.compilation.tap( + "FileUriPlugin", + (compilation, { normalModuleFactory }) => { + normalModuleFactory.hooks.resolveForScheme + .for("file") + .tap("FileUriPlugin", resourceData => { + const url = new URL(resourceData.resource); + const path = fileURLToPath(url); + const query = url.search; + const fragment = url.hash; + resourceData.path = path; + resourceData.query = query; + resourceData.fragment = fragment; + resourceData.resource = path + query + fragment; + return true; + }); + const hooks = NormalModule.getCompilationHooks(compilation); + hooks.readResource + .for(undefined) + .tapAsync("FileUriPlugin", (loaderContext, callback) => { + const { resourcePath } = loaderContext; + loaderContext.addDependency(resourcePath); + loaderContext.fs.readFile(resourcePath, callback); }); - } } ); } } -module.exports = BasicMatcherRulePlugin; +module.exports = FileUriPlugin; /***/ }), -/***/ 72021: -/***/ (function(module) { +/***/ 42110: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -115068,805 +110531,1082 @@ module.exports = BasicMatcherRulePlugin; -/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */ -/** @typedef {import("./RuleSetCompiler").RuleCondition} RuleCondition */ - -class ObjectMatcherRulePlugin { - constructor(ruleProperty, dataProperty) { - this.ruleProperty = ruleProperty; - this.dataProperty = dataProperty || ruleProperty; - } - - /** - * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler - * @returns {void} - */ - apply(ruleSetCompiler) { - const { ruleProperty, dataProperty } = this; - ruleSetCompiler.hooks.rule.tap( - "ObjectMatcherRulePlugin", - (path, rule, unhandledProperties, result) => { - if (unhandledProperties.has(ruleProperty)) { - unhandledProperties.delete(ruleProperty); - const value = rule[ruleProperty]; - for (const property of Object.keys(value)) { - const nestedDataProperties = property.split("."); - const condition = ruleSetCompiler.compileCondition( - `${path}.${ruleProperty}.${property}`, - value[property] - ); - result.conditions.push({ - property: [dataProperty, ...nestedDataProperties], - matchWhenEmpty: condition.matchWhenEmpty, - fn: condition.fn - }); - } - } - } - ); - } -} - -module.exports = ObjectMatcherRulePlugin; +const { extname, basename } = __webpack_require__(71017); +const { URL } = __webpack_require__(57310); +const { createGunzip, createBrotliDecompress, createInflate } = __webpack_require__(59796); +const NormalModule = __webpack_require__(39); +const createSchemaValidation = __webpack_require__(32540); +const createHash = __webpack_require__(49835); +const { mkdirp, dirname, join } = __webpack_require__(17139); +const memoize = __webpack_require__(78676); +/** @typedef {import("../../declarations/plugins/schemes/HttpUriPlugin").HttpUriPluginOptions} HttpUriPluginOptions */ +/** @typedef {import("../Compiler")} Compiler */ -/***/ }), +const getHttp = memoize(() => __webpack_require__(13685)); +const getHttps = memoize(() => __webpack_require__(95687)); -/***/ 83349: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** @type {(() => void)[] | undefined} */ +let inProgressWrite = undefined; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +const validate = createSchemaValidation( + __webpack_require__(67263), + () => __webpack_require__(27256), + { + name: "Http Uri Plugin", + baseDataPath: "options" + } +); +const toSafePath = str => + str + .replace(/^[^a-zA-Z0-9]+|[^a-zA-Z0-9]+$/g, "") + .replace(/[^a-zA-Z0-9._-]+/g, "_"); +const computeIntegrity = content => { + const hash = createHash("sha512"); + hash.update(content); + const integrity = "sha512-" + hash.digest("base64"); + return integrity; +}; -const { SyncHook } = __webpack_require__(41242); +const verifyIntegrity = (content, integrity) => { + if (integrity === "ignore") return true; + return computeIntegrity(content) === integrity; +}; /** - * @typedef {Object} RuleCondition - * @property {string | string[]} property - * @property {boolean} matchWhenEmpty - * @property {function(string): boolean} fn + * @param {string} str input + * @returns {Record} parsed */ +const parseKeyValuePairs = str => { + /** @type {Record} */ + const result = {}; + for (const item of str.split(",")) { + const i = item.indexOf("="); + if (i >= 0) { + const key = item.slice(0, i).trim(); + const value = item.slice(i + 1).trim(); + result[key] = value; + } else { + const key = item.trim(); + if (!key) continue; + result[key] = key; + } + } + return result; +}; -/** - * @typedef {Object} Condition - * @property {boolean} matchWhenEmpty - * @property {function(string): boolean} fn - */ +const parseCacheControl = (cacheControl, requestTime) => { + // When false resource is not stored in cache + let storeCache = true; + // When false resource is not stored in lockfile cache + let storeLock = true; + // Resource is only revalidated, after that timestamp and when upgrade is chosen + let validUntil = 0; + if (cacheControl) { + const parsed = parseKeyValuePairs(cacheControl); + if (parsed["no-cache"]) storeCache = storeLock = false; + if (parsed["max-age"] && !isNaN(+parsed["max-age"])) { + validUntil = requestTime + +parsed["max-age"] * 1000; + } + if (parsed["must-revalidate"]) validUntil = 0; + } + return { + storeLock, + storeCache, + validUntil + }; +}; /** - * @typedef {Object} CompiledRule - * @property {RuleCondition[]} conditions - * @property {(Effect|function(object): Effect[])[]} effects - * @property {CompiledRule[]=} rules - * @property {CompiledRule[]=} oneOf + * @typedef {Object} LockfileEntry + * @property {string} resolved + * @property {string} integrity + * @property {string} contentType */ -/** - * @typedef {Object} Effect - * @property {string} type - * @property {any} value - */ +const areLockfileEntriesEqual = (a, b) => { + return ( + a.resolved === b.resolved && + a.integrity === b.integrity && + a.contentType === b.contentType + ); +}; -/** - * @typedef {Object} RuleSet - * @property {Map} references map of references in the rule set (may grow over time) - * @property {function(object): Effect[]} exec execute the rule set - */ +const entryToString = entry => { + return `resolved: ${entry.resolved}, integrity: ${entry.integrity}, contentType: ${entry.contentType}`; +}; -class RuleSetCompiler { - constructor(plugins) { - this.hooks = Object.freeze({ - /** @type {SyncHook<[string, object, Set, CompiledRule, Map]>} */ - rule: new SyncHook([ - "path", - "rule", - "unhandledProperties", - "compiledRule", - "references" - ]) - }); - if (plugins) { - for (const plugin of plugins) { - plugin.apply(this); +class Lockfile { + constructor() { + this.version = 1; + /** @type {Map} */ + this.entries = new Map(); + } + + static parse(content) { + // TODO handle merge conflicts + const data = JSON.parse(content); + if (data.version !== 1) + throw new Error(`Unsupported lockfile version ${data.version}`); + const lockfile = new Lockfile(); + for (const key of Object.keys(data)) { + if (key === "version") continue; + const entry = data[key]; + lockfile.entries.set( + key, + typeof entry === "string" + ? entry + : { + resolved: key, + ...entry + } + ); + } + return lockfile; + } + + toString() { + let str = "{\n"; + const entries = Array.from(this.entries).sort(([a], [b]) => + a < b ? -1 : 1 + ); + for (const [key, entry] of entries) { + if (typeof entry === "string") { + str += ` ${JSON.stringify(key)}: ${JSON.stringify(entry)},\n`; + } else { + str += ` ${JSON.stringify(key)}: { `; + if (entry.resolved !== key) + str += `"resolved": ${JSON.stringify(entry.resolved)}, `; + str += `"integrity": ${JSON.stringify( + entry.integrity + )}, "contentType": ${JSON.stringify(entry.contentType)} },\n`; } } + str += ` "version": ${this.version}\n}\n`; + return str; } +} - /** - * @param {object[]} ruleSet raw user provided rules - * @returns {RuleSet} compiled RuleSet - */ - compile(ruleSet) { - const refs = new Map(); - const rules = this.compileRules("ruleSet", ruleSet, refs); +/** + * @template R + * @param {function(function(Error=, R=): void): void} fn function + * @returns {function(function((Error | null)=, R=): void): void} cached function + */ +const cachedWithoutKey = fn => { + let inFlight = false; + /** @type {Error | undefined} */ + let cachedError = undefined; + /** @type {R | undefined} */ + let cachedResult = undefined; + /** @type {(function(Error=, R=): void)[] | undefined} */ + let cachedCallbacks = undefined; + return callback => { + if (inFlight) { + if (cachedResult !== undefined) return callback(null, cachedResult); + if (cachedError !== undefined) return callback(cachedError); + if (cachedCallbacks === undefined) cachedCallbacks = [callback]; + else cachedCallbacks.push(callback); + return; + } + inFlight = true; + fn((err, result) => { + if (err) cachedError = err; + else cachedResult = result; + const callbacks = cachedCallbacks; + cachedCallbacks = undefined; + callback(err, result); + if (callbacks !== undefined) for (const cb of callbacks) cb(err, result); + }); + }; +}; - /** - * @param {object} data data passed in - * @param {CompiledRule} rule the compiled rule - * @param {Effect[]} effects an array where effects are pushed to - * @returns {boolean} true, if the rule has matched - */ - const execRule = (data, rule, effects) => { - for (const condition of rule.conditions) { - const p = condition.property; - if (Array.isArray(p)) { - let current = data; - for (const subProperty of p) { - if ( - current && - typeof current === "object" && - Object.prototype.hasOwnProperty.call(current, subProperty) - ) { - current = current[subProperty]; - } else { - current = undefined; - break; - } - } - if (current !== undefined) { - if (!condition.fn(current)) return false; - continue; - } - } else if (p in data) { - const value = data[p]; - if (value !== undefined) { - if (!condition.fn(value)) return false; - continue; - } - } - if (!condition.matchWhenEmpty) { - return false; - } - } - for (const effect of rule.effects) { - if (typeof effect === "function") { - const returnedEffects = effect(data); - for (const effect of returnedEffects) { - effects.push(effect); - } - } else { - effects.push(effect); - } - } - if (rule.rules) { - for (const childRule of rule.rules) { - execRule(data, childRule, effects); - } - } - if (rule.oneOf) { - for (const childRule of rule.oneOf) { - if (execRule(data, childRule, effects)) { - break; - } - } - } - return true; +/** + * @template T + * @template R + * @param {function(T, function(Error=, R=): void): void} fn function + * @param {function(T, function(Error=, R=): void): void=} forceFn function for the second try + * @returns {(function(T, function((Error | null)=, R=): void): void) & { force: function(T, function((Error | null)=, R=): void): void }} cached function + */ +const cachedWithKey = (fn, forceFn = fn) => { + /** @typedef {{ result?: R, error?: Error, callbacks?: (function((Error | null)=, R=): void)[], force?: true }} CacheEntry */ + /** @type {Map} */ + const cache = new Map(); + const resultFn = (arg, callback) => { + const cacheEntry = cache.get(arg); + if (cacheEntry !== undefined) { + if (cacheEntry.result !== undefined) + return callback(null, cacheEntry.result); + if (cacheEntry.error !== undefined) return callback(cacheEntry.error); + if (cacheEntry.callbacks === undefined) cacheEntry.callbacks = [callback]; + else cacheEntry.callbacks.push(callback); + return; + } + /** @type {CacheEntry} */ + const newCacheEntry = { + result: undefined, + error: undefined, + callbacks: undefined }; - - return { - references: refs, - exec: data => { - /** @type {Effect[]} */ - const effects = []; - for (const rule of rules) { - execRule(data, rule, effects); - } - return effects; - } + cache.set(arg, newCacheEntry); + fn(arg, (err, result) => { + if (err) newCacheEntry.error = err; + else newCacheEntry.result = result; + const callbacks = newCacheEntry.callbacks; + newCacheEntry.callbacks = undefined; + callback(err, result); + if (callbacks !== undefined) for (const cb of callbacks) cb(err, result); + }); + }; + resultFn.force = (arg, callback) => { + const cacheEntry = cache.get(arg); + if (cacheEntry !== undefined && cacheEntry.force) { + if (cacheEntry.result !== undefined) + return callback(null, cacheEntry.result); + if (cacheEntry.error !== undefined) return callback(cacheEntry.error); + if (cacheEntry.callbacks === undefined) cacheEntry.callbacks = [callback]; + else cacheEntry.callbacks.push(callback); + return; + } + /** @type {CacheEntry} */ + const newCacheEntry = { + result: undefined, + error: undefined, + callbacks: undefined, + force: true }; - } + cache.set(arg, newCacheEntry); + forceFn(arg, (err, result) => { + if (err) newCacheEntry.error = err; + else newCacheEntry.result = result; + const callbacks = newCacheEntry.callbacks; + newCacheEntry.callbacks = undefined; + callback(err, result); + if (callbacks !== undefined) for (const cb of callbacks) cb(err, result); + }); + }; + return resultFn; +}; +class HttpUriPlugin { /** - * @param {string} path current path - * @param {object[]} rules the raw rules provided by user - * @param {Map} refs references - * @returns {CompiledRule[]} rules + * @param {HttpUriPluginOptions} options options */ - compileRules(path, rules, refs) { - return rules.map((rule, i) => - this.compileRule(`${path}[${i}]`, rule, refs) - ); + constructor(options) { + validate(options); + this._lockfileLocation = options.lockfileLocation; + this._cacheLocation = options.cacheLocation; + this._upgrade = options.upgrade; + this._frozen = options.frozen; + this._allowedUris = options.allowedUris; } /** - * @param {string} path current path - * @param {object} rule the raw rule provided by user - * @param {Map} refs references - * @returns {CompiledRule} normalized and compiled rule for processing + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - compileRule(path, rule, refs) { - const unhandledProperties = new Set( - Object.keys(rule).filter(key => rule[key] !== undefined) - ); - - /** @type {CompiledRule} */ - const compiledRule = { - conditions: [], - effects: [], - rules: undefined, - oneOf: undefined - }; - - this.hooks.rule.call(path, rule, unhandledProperties, compiledRule, refs); - - if (unhandledProperties.has("rules")) { - unhandledProperties.delete("rules"); - const rules = rule.rules; - if (!Array.isArray(rules)) - throw this.error(path, rules, "Rule.rules must be an array of rules"); - compiledRule.rules = this.compileRules(`${path}.rules`, rules, refs); - } - - if (unhandledProperties.has("oneOf")) { - unhandledProperties.delete("oneOf"); - const oneOf = rule.oneOf; - if (!Array.isArray(oneOf)) - throw this.error(path, oneOf, "Rule.oneOf must be an array of rules"); - compiledRule.oneOf = this.compileRules(`${path}.oneOf`, oneOf, refs); - } - - if (unhandledProperties.size > 0) { - throw this.error( - path, - rule, - `Properties ${Array.from(unhandledProperties).join(", ")} are unknown` - ); - } + apply(compiler) { + const schemes = [ + { + scheme: "http", + fetch: (url, options, callback) => getHttp().get(url, options, callback) + }, + { + scheme: "https", + fetch: (url, options, callback) => + getHttps().get(url, options, callback) + } + ]; + let lockfileCache; + compiler.hooks.compilation.tap( + "HttpUriPlugin", + (compilation, { normalModuleFactory }) => { + const intermediateFs = compiler.intermediateFileSystem; + const fs = compilation.inputFileSystem; + const cache = compilation.getCache("webpack.HttpUriPlugin"); + const logger = compilation.getLogger("webpack.HttpUriPlugin"); + const lockfileLocation = + this._lockfileLocation || + join( + intermediateFs, + compiler.context, + compiler.name + ? `${toSafePath(compiler.name)}.webpack.lock` + : "webpack.lock" + ); + const cacheLocation = + this._cacheLocation !== undefined + ? this._cacheLocation + : lockfileLocation + ".data"; + const upgrade = this._upgrade || false; + const frozen = this._frozen || false; + const hashFunction = "sha512"; + const hashDigest = "hex"; + const hashDigestLength = 20; + const allowedUris = this._allowedUris; - return compiledRule; - } + let warnedAboutEol = false; - /** - * @param {string} path current path - * @param {any} condition user provided condition value - * @returns {Condition} compiled condition - */ - compileCondition(path, condition) { - if (condition === "") { - return { - matchWhenEmpty: true, - fn: str => str === "" - }; - } - if (!condition) { - throw this.error( - path, - condition, - "Expected condition but got falsy value" - ); - } - if (typeof condition === "string") { - return { - matchWhenEmpty: condition.length === 0, - fn: str => typeof str === "string" && str.startsWith(condition) - }; - } - if (typeof condition === "function") { - try { - return { - matchWhenEmpty: condition(""), - fn: condition + const cacheKeyCache = new Map(); + /** + * @param {string} url the url + * @returns {string} the key + */ + const getCacheKey = url => { + const cachedResult = cacheKeyCache.get(url); + if (cachedResult !== undefined) return cachedResult; + const result = _getCacheKey(url); + cacheKeyCache.set(url, result); + return result; }; - } catch (err) { - throw this.error( - path, - condition, - "Evaluation of condition function threw error" - ); - } - } - if (condition instanceof RegExp) { - return { - matchWhenEmpty: condition.test(""), - fn: v => typeof v === "string" && condition.test(v) - }; - } - if (Array.isArray(condition)) { - const items = condition.map((c, i) => - this.compileCondition(`${path}[${i}]`, c) - ); - return this.combineConditionsOr(items); - } - if (typeof condition !== "object") { - throw this.error( - path, - condition, - `Unexpected ${typeof condition} when condition was expected` - ); - } + /** + * @param {string} url the url + * @returns {string} the key + */ + const _getCacheKey = url => { + const parsedUrl = new URL(url); + const folder = toSafePath(parsedUrl.origin); + const name = toSafePath(parsedUrl.pathname); + const query = toSafePath(parsedUrl.search); + let ext = extname(name); + if (ext.length > 20) ext = ""; + const basename = ext ? name.slice(0, -ext.length) : name; + const hash = createHash(hashFunction); + hash.update(url); + const digest = hash.digest(hashDigest).slice(0, hashDigestLength); + return `${folder.slice(-50)}/${`${basename}${ + query ? `_${query}` : "" + }`.slice(0, 150)}_${digest}${ext}`; + }; - const conditions = []; - for (const key of Object.keys(condition)) { - const value = condition[key]; - switch (key) { - case "or": - if (value) { - if (!Array.isArray(value)) { - throw this.error( - `${path}.or`, - condition.and, - "Expected array of conditions" + const getLockfile = cachedWithoutKey( + /** + * @param {function((Error | null)=, Lockfile=): void} callback callback + * @returns {void} + */ + callback => { + const readLockfile = () => { + intermediateFs.readFile(lockfileLocation, (err, buffer) => { + if (err && err.code !== "ENOENT") { + compilation.missingDependencies.add(lockfileLocation); + return callback(err); + } + compilation.fileDependencies.add(lockfileLocation); + compilation.fileSystemInfo.createSnapshot( + compiler.fsStartTime, + buffer ? [lockfileLocation] : [], + [], + buffer ? [] : [lockfileLocation], + { timestamp: true }, + (err, snapshot) => { + if (err) return callback(err); + const lockfile = buffer + ? Lockfile.parse(buffer.toString("utf-8")) + : new Lockfile(); + lockfileCache = { + lockfile, + snapshot + }; + callback(null, lockfile); + } + ); + }); + }; + if (lockfileCache) { + compilation.fileSystemInfo.checkSnapshotValid( + lockfileCache.snapshot, + (err, valid) => { + if (err) return callback(err); + if (!valid) return readLockfile(); + callback(null, lockfileCache.lockfile); + } ); + } else { + readLockfile(); } - conditions.push(this.compileCondition(`${path}.or`, value)); } - break; - case "and": - if (value) { - if (!Array.isArray(value)) { - throw this.error( - `${path}.and`, - condition.and, - "Expected array of conditions" + ); + + /** @type {Map | undefined} */ + let lockfileUpdates = undefined; + const storeLockEntry = (lockfile, url, entry) => { + const oldEntry = lockfile.entries.get(url); + if (lockfileUpdates === undefined) lockfileUpdates = new Map(); + lockfileUpdates.set(url, entry); + lockfile.entries.set(url, entry); + if (!oldEntry) { + logger.log(`${url} added to lockfile`); + } else if (typeof oldEntry === "string") { + if (typeof entry === "string") { + logger.log(`${url} updated in lockfile: ${oldEntry} -> ${entry}`); + } else { + logger.log( + `${url} updated in lockfile: ${oldEntry} -> ${entry.resolved}` ); } - let i = 0; - for (const item of value) { - conditions.push(this.compileCondition(`${path}.and[${i}]`, item)); - i++; - } - } - break; - case "not": - if (value) { - const matcher = this.compileCondition(`${path}.not`, value); - const fn = matcher.fn; - conditions.push({ - matchWhenEmpty: !matcher.matchWhenEmpty, - fn: v => !fn(v) - }); - } - break; - default: - throw this.error( - `${path}.${key}`, - condition[key], - `Unexpected property ${key} in condition` - ); - } - } - if (conditions.length === 0) { - throw this.error( - path, - condition, - "Expected condition, but got empty thing" - ); - } - return this.combineConditionsAnd(conditions); - } - - /** - * @param {Condition[]} conditions some conditions - * @returns {Condition} merged condition - */ - combineConditionsOr(conditions) { - if (conditions.length === 0) { - return { - matchWhenEmpty: false, - fn: () => false - }; - } else if (conditions.length === 1) { - return conditions[0]; - } else { - return { - matchWhenEmpty: conditions.some(c => c.matchWhenEmpty), - fn: v => conditions.some(c => c.fn(v)) - }; - } - } - - /** - * @param {Condition[]} conditions some conditions - * @returns {Condition} merged condition - */ - combineConditionsAnd(conditions) { - if (conditions.length === 0) { - return { - matchWhenEmpty: false, - fn: () => false - }; - } else if (conditions.length === 1) { - return conditions[0]; - } else { - return { - matchWhenEmpty: conditions.every(c => c.matchWhenEmpty), - fn: v => conditions.every(c => c.fn(v)) - }; - } - } - - /** - * @param {string} path current path - * @param {any} value value at the error location - * @param {string} message message explaining the problem - * @returns {Error} an error object - */ - error(path, value, message) { - return new Error( - `Compiling RuleSet failed: ${message} (at ${path}: ${value})` - ); - } -} - -module.exports = RuleSetCompiler; - - -/***/ }), - -/***/ 84977: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const util = __webpack_require__(73837); - -/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */ -/** @typedef {import("./RuleSetCompiler").Effect} Effect */ - -class UseEffectRulePlugin { - /** - * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler - * @returns {void} - */ - apply(ruleSetCompiler) { - ruleSetCompiler.hooks.rule.tap( - "UseEffectRulePlugin", - (path, rule, unhandledProperties, result, references) => { - const conflictWith = (property, correctProperty) => { - if (unhandledProperties.has(property)) { - throw ruleSetCompiler.error( - `${path}.${property}`, - rule[property], - `A Rule must not have a '${property}' property when it has a '${correctProperty}' property` + } else if (typeof entry === "string") { + logger.log( + `${url} updated in lockfile: ${oldEntry.resolved} -> ${entry}` + ); + } else if (oldEntry.resolved !== entry.resolved) { + logger.log( + `${url} updated in lockfile: ${oldEntry.resolved} -> ${entry.resolved}` + ); + } else if (oldEntry.integrity !== entry.integrity) { + logger.log(`${url} updated in lockfile: content changed`); + } else if (oldEntry.contentType !== entry.contentType) { + logger.log( + `${url} updated in lockfile: ${oldEntry.contentType} -> ${entry.contentType}` ); + } else { + logger.log(`${url} updated in lockfile`); } }; - if (unhandledProperties.has("use")) { - unhandledProperties.delete("use"); - unhandledProperties.delete("enforce"); - - conflictWith("loader", "use"); - conflictWith("options", "use"); - - const use = rule.use; - const enforce = rule.enforce; - - const type = enforce ? `use-${enforce}` : "use"; - - /** - * - * @param {string} path options path - * @param {string} defaultIdent default ident when none is provided - * @param {object} item user provided use value - * @returns {Effect|function(any): Effect[]} effect - */ - const useToEffect = (path, defaultIdent, item) => { - if (typeof item === "function") { - return data => useToEffectsWithoutIdent(path, item(data)); - } else { - return useToEffectRaw(path, defaultIdent, item); - } - }; + const storeResult = (lockfile, url, result, callback) => { + if (result.storeLock) { + storeLockEntry(lockfile, url, result.entry); + if (!cacheLocation || !result.content) + return callback(null, result); + const key = getCacheKey(result.entry.resolved); + const filePath = join(intermediateFs, cacheLocation, key); + mkdirp(intermediateFs, dirname(intermediateFs, filePath), err => { + if (err) return callback(err); + intermediateFs.writeFile(filePath, result.content, err => { + if (err) return callback(err); + callback(null, result); + }); + }); + } else { + storeLockEntry(lockfile, url, "no-cache"); + callback(null, result); + } + }; + for (const { scheme, fetch } of schemes) { /** * - * @param {string} path options path - * @param {string} defaultIdent default ident when none is provided - * @param {object} item user provided use value - * @returns {Effect} effect + * @param {string} url URL + * @param {string} integrity integrity + * @param {function((Error | null)=, { entry: LockfileEntry, content: Buffer, storeLock: boolean }=): void} callback callback */ - const useToEffectRaw = (path, defaultIdent, item) => { - if (typeof item === "string") { - return { - type, - value: { - loader: item, - options: undefined, - ident: undefined + const resolveContent = (url, integrity, callback) => { + const handleResult = (err, result) => { + if (err) return callback(err); + if ("location" in result) { + return resolveContent( + result.location, + integrity, + (err, innerResult) => { + if (err) return callback(err); + callback(null, { + entry: innerResult.entry, + content: innerResult.content, + storeLock: innerResult.storeLock && result.storeLock + }); + } + ); + } else { + if ( + !result.fresh && + integrity && + result.entry.integrity !== integrity && + !verifyIntegrity(result.content, integrity) + ) { + return fetchContent.force(url, handleResult); } - }; - } else { - const loader = item.loader; - const options = item.options; - let ident = item.ident; - if (options && typeof options === "object") { - if (!ident) ident = defaultIdent; - references.set(ident, options); - } - if (typeof options === "string") { - util.deprecate( - () => {}, - `Using a string as loader options is deprecated (${path}.options)`, - "DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING" - )(); + return callback(null, { + entry: result.entry, + content: result.content, + storeLock: result.storeLock + }); } - return { - type: enforce ? `use-${enforce}` : "use", - value: { - loader, - options, - ident - } - }; - } + }; + fetchContent(url, handleResult); }; - /** - * @param {string} path options path - * @param {any} items user provided use value - * @returns {Effect[]} effects - */ - const useToEffectsWithoutIdent = (path, items) => { - if (Array.isArray(items)) { - return items.map((item, idx) => - useToEffectRaw(`${path}[${idx}]`, "[[missing ident]]", item) - ); - } - return [useToEffectRaw(path, "[[missing ident]]", items)]; - }; + /** @typedef {{ storeCache: boolean, storeLock: boolean, validUntil: number, etag: string | undefined, fresh: boolean }} FetchResultMeta */ + /** @typedef {FetchResultMeta & { location: string }} RedirectFetchResult */ + /** @typedef {FetchResultMeta & { entry: LockfileEntry, content: Buffer }} ContentFetchResult */ + /** @typedef {RedirectFetchResult | ContentFetchResult} FetchResult */ /** - * @param {string} path current path - * @param {any} items user provided use value - * @returns {(Effect|function(any): Effect[])[]} effects + * @param {string} url URL + * @param {FetchResult | RedirectFetchResult} cachedResult result from cache + * @param {function((Error | null)=, FetchResult=): void} callback callback + * @returns {void} */ - const useToEffects = (path, items) => { - if (Array.isArray(items)) { - return items.map((item, idx) => { - const subPath = `${path}[${idx}]`; - return useToEffect(subPath, subPath, item); - }); - } - return [useToEffect(path, path, items)]; - }; - - if (typeof use === "function") { - result.effects.push(data => - useToEffectsWithoutIdent(`${path}.use`, use(data)) - ); - } else { - for (const effect of useToEffects(`${path}.use`, use)) { - result.effects.push(effect); - } - } - } - - if (unhandledProperties.has("loader")) { - unhandledProperties.delete("loader"); - unhandledProperties.delete("options"); - unhandledProperties.delete("enforce"); - - const loader = rule.loader; - const options = rule.options; - const enforce = rule.enforce; - - if (loader.includes("!")) { - throw ruleSetCompiler.error( - `${path}.loader`, - loader, - "Exclamation mark separated loader lists has been removed in favor of the 'use' property with arrays" - ); - } - - if (loader.includes("?")) { - throw ruleSetCompiler.error( - `${path}.loader`, - loader, - "Query arguments on 'loader' has been removed in favor of the 'options' property" - ); - } - - if (typeof options === "string") { - util.deprecate( - () => {}, - `Using a string as loader options is deprecated (${path}.options)`, - "DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING" - )(); - } - - const ident = - options && typeof options === "object" ? path : undefined; - references.set(ident, options); - result.effects.push({ - type: enforce ? `use-${enforce}` : "use", - value: { - loader, - options, - ident - } - }); - } - } - ); - } + const fetchContentRaw = (url, cachedResult, callback) => { + const requestTime = Date.now(); + fetch( + new URL(url), + { + headers: { + "accept-encoding": "gzip, deflate, br", + "user-agent": "webpack", + "if-none-match": cachedResult + ? cachedResult.etag || null + : null + } + }, + res => { + const etag = res.headers["etag"]; + const location = res.headers["location"]; + const cacheControl = res.headers["cache-control"]; + const { storeLock, storeCache, validUntil } = parseCacheControl( + cacheControl, + requestTime + ); + /** + * @param {Partial> & (Pick | Pick)} partialResult result + * @returns {void} + */ + const finishWith = partialResult => { + if ("location" in partialResult) { + logger.debug( + `GET ${url} [${res.statusCode}] -> ${partialResult.location}` + ); + } else { + logger.debug( + `GET ${url} [${res.statusCode}] ${Math.ceil( + partialResult.content.length / 1024 + )} kB${!storeLock ? " no-cache" : ""}` + ); + } + const result = { + ...partialResult, + fresh: true, + storeLock, + storeCache, + validUntil, + etag + }; + if (!storeCache) { + logger.log( + `${url} can't be stored in cache, due to Cache-Control header: ${cacheControl}` + ); + return callback(null, result); + } + cache.store( + url, + null, + { + ...result, + fresh: false + }, + err => { + if (err) { + logger.warn( + `${url} can't be stored in cache: ${err.message}` + ); + logger.debug(err.stack); + } + callback(null, result); + } + ); + }; + if (res.statusCode === 304) { + if ( + cachedResult.validUntil < validUntil || + cachedResult.storeLock !== storeLock || + cachedResult.storeCache !== storeCache || + cachedResult.etag !== etag + ) { + return finishWith(cachedResult); + } else { + logger.debug(`GET ${url} [${res.statusCode}] (unchanged)`); + return callback(null, { + ...cachedResult, + fresh: true + }); + } + } + if ( + location && + res.statusCode >= 301 && + res.statusCode <= 308 + ) { + const result = { + location: new URL(location, url).href + }; + if ( + !cachedResult || + !("location" in cachedResult) || + cachedResult.location !== result.location || + cachedResult.validUntil < validUntil || + cachedResult.storeLock !== storeLock || + cachedResult.storeCache !== storeCache || + cachedResult.etag !== etag + ) { + return finishWith(result); + } else { + logger.debug(`GET ${url} [${res.statusCode}] (unchanged)`); + return callback(null, { + ...result, + fresh: true, + storeLock, + storeCache, + validUntil, + etag + }); + } + } + const contentType = res.headers["content-type"] || ""; + const bufferArr = []; - useItemToEffects(path, item) {} -} + const contentEncoding = res.headers["content-encoding"]; + let stream = res; + if (contentEncoding === "gzip") { + stream = stream.pipe(createGunzip()); + } else if (contentEncoding === "br") { + stream = stream.pipe(createBrotliDecompress()); + } else if (contentEncoding === "deflate") { + stream = stream.pipe(createInflate()); + } -module.exports = UseEffectRulePlugin; + stream.on("data", chunk => { + bufferArr.push(chunk); + }); + stream.on("end", () => { + if (!res.complete) { + logger.log(`GET ${url} [${res.statusCode}] (terminated)`); + return callback(new Error(`${url} request was terminated`)); + } -/***/ }), + const content = Buffer.concat(bufferArr); -/***/ 63672: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (res.statusCode !== 200) { + logger.log(`GET ${url} [${res.statusCode}]`); + return callback( + new Error( + `${url} request status code = ${ + res.statusCode + }\n${content.toString("utf-8")}` + ) + ); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + const integrity = computeIntegrity(content); + const entry = { resolved: url, integrity, contentType }; + finishWith({ + entry, + content + }); + }); + } + ).on("error", err => { + logger.log(`GET ${url} (error)`); + err.message += `\nwhile fetching ${url}`; + callback(err); + }); + }; + const fetchContent = cachedWithKey( + /** + * @param {string} url URL + * @param {function((Error | null)=, { validUntil: number, etag?: string, entry: LockfileEntry, content: Buffer, fresh: boolean } | { validUntil: number, etag?: string, location: string, fresh: boolean }=): void} callback callback + * @returns {void} + */ (url, callback) => { + cache.get(url, null, (err, cachedResult) => { + if (err) return callback(err); + if (cachedResult) { + const isValid = cachedResult.validUntil >= Date.now(); + if (isValid) return callback(null, cachedResult); + } + fetchContentRaw(url, cachedResult, callback); + }); + }, + (url, callback) => fetchContentRaw(url, undefined, callback) + ); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const HelperRuntimeModule = __webpack_require__(82444); + const isAllowed = uri => { + for (const allowed of allowedUris) { + if (typeof allowed === "string") { + if (uri.startsWith(allowed)) return true; + } else if (typeof allowed === "function") { + if (allowed(uri)) return true; + } else { + if (allowed.test(uri)) return true; + } + } + return false; + }; -class AsyncModuleRuntimeModule extends HelperRuntimeModule { - constructor() { - super("async module"); - } + const getInfo = cachedWithKey( + /** + * @param {string} url the url + * @param {function((Error | null)=, { entry: LockfileEntry, content: Buffer }=): void} callback callback + * @returns {void} + */ + (url, callback) => { + if (!isAllowed(url)) { + return callback( + new Error( + `${url} doesn't match the allowedUris policy. These URIs are allowed:\n${allowedUris + .map(uri => ` - ${uri}`) + .join("\n")}` + ) + ); + } + getLockfile((err, lockfile) => { + if (err) return callback(err); + const entryOrString = lockfile.entries.get(url); + if (!entryOrString) { + if (frozen) { + return callback( + new Error( + `${url} has no lockfile entry and lockfile is frozen` + ) + ); + } + resolveContent(url, null, (err, result) => { + if (err) return callback(err); + storeResult(lockfile, url, result, callback); + }); + return; + } + if (typeof entryOrString === "string") { + const entryTag = entryOrString; + resolveContent(url, null, (err, result) => { + if (err) return callback(err); + if (!result.storeLock || entryTag === "ignore") + return callback(null, result); + if (frozen) { + return callback( + new Error( + `${url} used to have ${entryTag} lockfile entry and has content now, but lockfile is frozen` + ) + ); + } + if (!upgrade) { + return callback( + new Error( + `${url} used to have ${entryTag} lockfile entry and has content now. +This should be reflected in the lockfile, so this lockfile entry must be upgraded, but upgrading is not enabled. +Remove this line from the lockfile to force upgrading.` + ) + ); + } + storeResult(lockfile, url, result, callback); + }); + return; + } + let entry = entryOrString; + const doFetch = lockedContent => { + resolveContent(url, entry.integrity, (err, result) => { + if (err) { + if (lockedContent) { + logger.warn( + `Upgrade request to ${url} failed: ${err.message}` + ); + logger.debug(err.stack); + return callback(null, { + entry, + content: lockedContent + }); + } + return callback(err); + } + if (!result.storeLock) { + // When the lockfile entry should be no-cache + // we need to update the lockfile + if (frozen) { + return callback( + new Error( + `${url} has a lockfile entry and is no-cache now, but lockfile is frozen\nLockfile: ${entryToString( + entry + )}` + ) + ); + } + storeResult(lockfile, url, result, callback); + return; + } + if (!areLockfileEntriesEqual(result.entry, entry)) { + // When the lockfile entry is outdated + // we need to update the lockfile + if (frozen) { + return callback( + new Error( + `${url} has an outdated lockfile entry, but lockfile is frozen\nLockfile: ${entryToString( + entry + )}\nExpected: ${entryToString(result.entry)}` + ) + ); + } + storeResult(lockfile, url, result, callback); + return; + } + if (!lockedContent && cacheLocation) { + // When the lockfile cache content is missing + // we need to update the lockfile + if (frozen) { + return callback( + new Error( + `${url} is missing content in the lockfile cache, but lockfile is frozen\nLockfile: ${entryToString( + entry + )}` + ) + ); + } + storeResult(lockfile, url, result, callback); + return; + } + return callback(null, result); + }); + }; + if (cacheLocation) { + // When there is a lockfile cache + // we read the content from there + const key = getCacheKey(entry.resolved); + const filePath = join(intermediateFs, cacheLocation, key); + fs.readFile(filePath, (err, result) => { + const content = /** @type {Buffer} */ (result); + if (err) { + if (err.code === "ENOENT") return doFetch(); + return callback(err); + } + const continueWithCachedContent = result => { + if (!upgrade) { + // When not in upgrade mode, we accept the result from the lockfile cache + return callback(null, { entry, content }); + } + return doFetch(content); + }; + if (!verifyIntegrity(content, entry.integrity)) { + let contentWithChangedEol; + let isEolChanged = false; + try { + contentWithChangedEol = Buffer.from( + content.toString("utf-8").replace(/\r\n/g, "\n") + ); + isEolChanged = verifyIntegrity( + contentWithChangedEol, + entry.integrity + ); + } catch (e) { + // ignore + } + if (isEolChanged) { + if (!warnedAboutEol) { + const explainer = `Incorrect end of line sequence was detected in the lockfile cache. +The lockfile cache is protected by integrity checks, so any external modification will lead to a corrupted lockfile cache. +When using git make sure to configure .gitattributes correctly for the lockfile cache: + **/*webpack.lock.data/** -text +This will avoid that the end of line sequence is changed by git on Windows.`; + if (frozen) { + logger.error(explainer); + } else { + logger.warn(explainer); + logger.info( + "Lockfile cache will be automatically fixed now, but when lockfile is frozen this would result in an error." + ); + } + warnedAboutEol = true; + } + if (!frozen) { + // "fix" the end of line sequence of the lockfile content + logger.log( + `${filePath} fixed end of line sequence (\\r\\n instead of \\n).` + ); + intermediateFs.writeFile( + filePath, + contentWithChangedEol, + err => { + if (err) return callback(err); + continueWithCachedContent(contentWithChangedEol); + } + ); + return; + } + } + if (frozen) { + return callback( + new Error( + `${ + entry.resolved + } integrity mismatch, expected content with integrity ${ + entry.integrity + } but got ${computeIntegrity(content)}. +Lockfile corrupted (${ + isEolChanged + ? "end of line sequence was unexpectedly changed" + : "incorrectly merged? changed by other tools?" + }). +Run build with un-frozen lockfile to automatically fix lockfile.` + ) + ); + } else { + // "fix" the lockfile entry to the correct integrity + // the content has priority over the integrity value + entry = { + ...entry, + integrity: computeIntegrity(content) + }; + storeLockEntry(lockfile, url, entry); + } + } + continueWithCachedContent(result); + }); + } else { + doFetch(); + } + }); + } + ); - /** - * @returns {string} runtime code - */ - generate() { - const { runtimeTemplate } = this.compilation; - const fn = RuntimeGlobals.asyncModule; - return Template.asString([ - 'var webpackThen = typeof Symbol === "function" ? Symbol("webpack then") : "__webpack_then__";', - 'var webpackExports = typeof Symbol === "function" ? Symbol("webpack exports") : "__webpack_exports__";', - 'var webpackError = typeof Symbol === "function" ? Symbol("webpack error") : "__webpack_error__";', - `var completeQueue = ${runtimeTemplate.basicFunction("queue", [ - "if(queue) {", - Template.indent([ - `queue.forEach(${runtimeTemplate.expressionFunction( - "fn.r--", - "fn" - )});`, - `queue.forEach(${runtimeTemplate.expressionFunction( - "fn.r-- ? fn.r++ : fn()", - "fn" - )});` - ]), - "}" - ])}`, - `var completeFunction = ${runtimeTemplate.expressionFunction( - "!--fn.r && fn()", - "fn" - )};`, - `var queueFunction = ${runtimeTemplate.expressionFunction( - "queue ? queue.push(fn) : completeFunction(fn)", - "queue, fn" - )};`, - `var wrapDeps = ${runtimeTemplate.returningFunction( - `deps.map(${runtimeTemplate.basicFunction("dep", [ - 'if(dep !== null && typeof dep === "object") {', - Template.indent([ - "if(dep[webpackThen]) return dep;", - "if(dep.then) {", - Template.indent([ - "var queue = [];", - `dep.then(${runtimeTemplate.basicFunction("r", [ - "obj[webpackExports] = r;", - "completeQueue(queue);", - "queue = 0;" - ])}, ${runtimeTemplate.basicFunction("e", [ - "obj[webpackError] = e;", - "completeQueue(queue);", - "queue = 0;" - ])});`, - "var obj = {};", - `obj[webpackThen] = ${runtimeTemplate.expressionFunction( - "queueFunction(queue, fn), dep['catch'](reject)", - "fn, reject" - )};`, - "return obj;" - ]), - "}" - ]), - "}", - "var ret = {};", - `ret[webpackThen] = ${runtimeTemplate.expressionFunction( - "completeFunction(fn)", - "fn" - )};`, - "ret[webpackExports] = dep;", - "return ret;" - ])})`, - "deps" - )};`, - `${fn} = ${runtimeTemplate.basicFunction("module, body, hasAwait", [ - "var queue = hasAwait && [];", - "var exports = module.exports;", - "var currentDeps;", - "var outerResolve;", - "var reject;", - "var isEvaluating = true;", - "var nested = false;", - `var whenAll = ${runtimeTemplate.basicFunction( - "deps, onResolve, onReject", - [ - "if (nested) return;", - "nested = true;", - "onResolve.r += deps.length;", - `deps.map(${runtimeTemplate.expressionFunction( - "dep[webpackThen](onResolve, onReject)", - "dep, i" - )});`, - "nested = false;" - ] - )};`, - `var promise = new Promise(${runtimeTemplate.basicFunction( - "resolve, rej", - [ - "reject = rej;", - `outerResolve = ${runtimeTemplate.expressionFunction( - "resolve(exports), completeQueue(queue), queue = 0" - )};` - ] - )});`, - "promise[webpackExports] = exports;", - `promise[webpackThen] = ${runtimeTemplate.basicFunction( - "fn, rejectFn", - [ - "if (isEvaluating) { return completeFunction(fn); }", - "if (currentDeps) whenAll(currentDeps, fn, rejectFn);", - "queueFunction(queue, fn);", - "promise['catch'](rejectFn);" - ] - )};`, - "module.exports = promise;", - `body(${runtimeTemplate.basicFunction("deps", [ - "currentDeps = wrapDeps(deps);", - "var fn;", - `var getResult = ${runtimeTemplate.returningFunction( - `currentDeps.map(${runtimeTemplate.basicFunction("d", [ - "if(d[webpackError]) throw d[webpackError];", - "return d[webpackExports];" - ])})` - )}`, - `var promise = new Promise(${runtimeTemplate.basicFunction( - "resolve, reject", - [ - `fn = ${runtimeTemplate.expressionFunction( - "resolve(getResult)" - )};`, - "fn.r = 0;", - "whenAll(currentDeps, fn, reject);" - ] - )});`, - "return fn.r ? promise : getResult();" - ])}, ${runtimeTemplate.expressionFunction( - "err && reject(promise[webpackError] = err), outerResolve()", - "err" - )});`, - "isEvaluating = false;" - ])};` - ]); + const respondWithUrlModule = (url, resourceData, callback) => { + getInfo(url.href, (err, result) => { + if (err) return callback(err); + resourceData.resource = url.href; + resourceData.path = url.origin + url.pathname; + resourceData.query = url.search; + resourceData.fragment = url.hash; + resourceData.context = new URL( + ".", + result.entry.resolved + ).href.slice(0, -1); + resourceData.data.mimetype = result.entry.contentType; + callback(null, true); + }); + }; + normalModuleFactory.hooks.resolveForScheme + .for(scheme) + .tapAsync( + "HttpUriPlugin", + (resourceData, resolveData, callback) => { + respondWithUrlModule( + new URL(resourceData.resource), + resourceData, + callback + ); + } + ); + normalModuleFactory.hooks.resolveInScheme + .for(scheme) + .tapAsync("HttpUriPlugin", (resourceData, data, callback) => { + // Only handle relative urls (./xxx, ../xxx, /xxx, //xxx) + if ( + data.dependencyType !== "url" && + !/^\.{0,2}\//.test(resourceData.resource) + ) { + return callback(); + } + respondWithUrlModule( + new URL(resourceData.resource, data.context + "/"), + resourceData, + callback + ); + }); + const hooks = NormalModule.getCompilationHooks(compilation); + hooks.readResourceForScheme + .for(scheme) + .tapAsync("HttpUriPlugin", (resource, module, callback) => { + return getInfo(resource, (err, result) => { + if (err) return callback(err); + module.buildInfo.resourceIntegrity = result.entry.integrity; + callback(null, result.content); + }); + }); + hooks.needBuild.tapAsync( + "HttpUriPlugin", + (module, context, callback) => { + if ( + module.resource && + module.resource.startsWith(`${scheme}://`) + ) { + getInfo(module.resource, (err, result) => { + if (err) return callback(err); + if ( + result.entry.integrity !== + module.buildInfo.resourceIntegrity + ) { + return callback(null, true); + } + callback(); + }); + } else { + return callback(); + } + } + ); + } + compilation.hooks.finishModules.tapAsync( + "HttpUriPlugin", + (modules, callback) => { + if (!lockfileUpdates) return callback(); + const ext = extname(lockfileLocation); + const tempFile = join( + intermediateFs, + dirname(intermediateFs, lockfileLocation), + `.${basename(lockfileLocation, ext)}.${ + (Math.random() * 10000) | 0 + }${ext}` + ); + + const writeDone = () => { + const nextOperation = inProgressWrite.shift(); + if (nextOperation) { + nextOperation(); + } else { + inProgressWrite = undefined; + } + }; + const runWrite = () => { + intermediateFs.readFile(lockfileLocation, (err, buffer) => { + if (err && err.code !== "ENOENT") { + writeDone(); + return callback(err); + } + const lockfile = buffer + ? Lockfile.parse(buffer.toString("utf-8")) + : new Lockfile(); + for (const [key, value] of lockfileUpdates) { + lockfile.entries.set(key, value); + } + intermediateFs.writeFile(tempFile, lockfile.toString(), err => { + if (err) { + writeDone(); + return intermediateFs.unlink(tempFile, () => callback(err)); + } + intermediateFs.rename(tempFile, lockfileLocation, err => { + if (err) { + writeDone(); + return intermediateFs.unlink(tempFile, () => + callback(err) + ); + } + writeDone(); + callback(); + }); + }); + }); + }; + if (inProgressWrite) { + inProgressWrite.push(runWrite); + } else { + inProgressWrite = []; + runWrite(); + } + } + ); + } + ); } } -module.exports = AsyncModuleRuntimeModule; +module.exports = HttpUriPlugin; /***/ }), -/***/ 66532: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 41721: +/***/ (function(module) { "use strict"; /* @@ -115875,74 +111615,27 @@ module.exports = AsyncModuleRuntimeModule; -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); -const JavascriptModulesPlugin = __webpack_require__(89464); -const { getUndoPath } = __webpack_require__(82186); - -class AutoPublicPathRuntimeModule extends RuntimeModule { - constructor() { - super("publicPath", RuntimeModule.STAGE_BASIC); +class ArraySerializer { + serialize(array, { write }) { + write(array.length); + for (const item of array) write(item); } - - /** - * @returns {string} runtime code - */ - generate() { - const { compilation } = this; - const { scriptType, importMetaName, path } = compilation.outputOptions; - const chunkName = compilation.getPath( - JavascriptModulesPlugin.getChunkFilenameTemplate( - this.chunk, - compilation.outputOptions - ), - { - chunk: this.chunk, - contentHashType: "javascript" - } - ); - const undoPath = getUndoPath(chunkName, path, false); - - return Template.asString([ - "var scriptUrl;", - scriptType === "module" - ? `if (typeof ${importMetaName}.url === "string") scriptUrl = ${importMetaName}.url` - : Template.asString([ - `if (${RuntimeGlobals.global}.importScripts) scriptUrl = ${RuntimeGlobals.global}.location + "";`, - `var document = ${RuntimeGlobals.global}.document;`, - "if (!scriptUrl && document) {", - Template.indent([ - `if (document.currentScript)`, - Template.indent(`scriptUrl = document.currentScript.src`), - "if (!scriptUrl) {", - Template.indent([ - 'var scripts = document.getElementsByTagName("script");', - "if(scripts.length) scriptUrl = scripts[scripts.length - 1].src" - ]), - "}" - ]), - "}" - ]), - "// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration", - '// or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.', - 'if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");', - 'scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\\?.*$/, "").replace(/\\/[^\\/]+$/, "/");', - !undoPath - ? `${RuntimeGlobals.publicPath} = scriptUrl;` - : `${RuntimeGlobals.publicPath} = scriptUrl + ${JSON.stringify( - undoPath - )};` - ]); + deserialize({ read }) { + const length = read(); + const array = []; + for (let i = 0; i < length; i++) { + array.push(read()); + } + return array; } } -module.exports = AutoPublicPathRuntimeModule; +module.exports = ArraySerializer; /***/ }), -/***/ 84519: +/***/ 97059: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -115952,282 +111645,956 @@ module.exports = AutoPublicPathRuntimeModule; -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); - -class ChunkNameRuntimeModule extends RuntimeModule { - /** - * @param {string} chunkName the chunk's name - */ - constructor(chunkName) { - super("chunkName"); - this.chunkName = chunkName; - } +const memoize = __webpack_require__(78676); +const SerializerMiddleware = __webpack_require__(83137); - /** - * @returns {string} runtime code - */ - generate() { - return `${RuntimeGlobals.chunkName} = ${JSON.stringify(this.chunkName)};`; - } -} +/** @typedef {import("./types").BufferSerializableType} BufferSerializableType */ +/** @typedef {import("./types").PrimitiveSerializableType} PrimitiveSerializableType */ -module.exports = ChunkNameRuntimeModule; +/* +Format: +File -> Section* -/***/ }), +Section -> NullsSection | + BooleansSection | + F64NumbersSection | + I32NumbersSection | + I8NumbersSection | + ShortStringSection | + StringSection | + BufferSection | + NopSection -/***/ 44793: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ +NullsSection -> + NullHeaderByte | Null2HeaderByte | Null3HeaderByte | + Nulls8HeaderByte 0xnn (n:count - 4) | + Nulls32HeaderByte n:ui32 (n:count - 260) | +BooleansSection -> TrueHeaderByte | FalseHeaderByte | BooleansSectionHeaderByte BooleansCountAndBitsByte +F64NumbersSection -> F64NumbersSectionHeaderByte f64* +I32NumbersSection -> I32NumbersSectionHeaderByte i32* +I8NumbersSection -> I8NumbersSectionHeaderByte i8* +ShortStringSection -> ShortStringSectionHeaderByte ascii-byte* +StringSection -> StringSectionHeaderByte i32:length utf8-byte* +BufferSection -> BufferSectionHeaderByte i32:length byte* +NopSection --> NopSectionHeaderByte +ShortStringSectionHeaderByte -> 0b1nnn_nnnn (n:length) -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const HelperRuntimeModule = __webpack_require__(82444); +F64NumbersSectionHeaderByte -> 0b001n_nnnn (n:count - 1) +I32NumbersSectionHeaderByte -> 0b010n_nnnn (n:count - 1) +I8NumbersSectionHeaderByte -> 0b011n_nnnn (n:count - 1) -class CompatGetDefaultExportRuntimeModule extends HelperRuntimeModule { - constructor() { - super("compat get default export"); - } +NullsSectionHeaderByte -> 0b0001_nnnn (n:count - 1) +BooleansCountAndBitsByte -> + 0b0000_1xxx (count = 3) | + 0b0001_xxxx (count = 4) | + 0b001x_xxxx (count = 5) | + 0b01xx_xxxx (count = 6) | + 0b1nnn_nnnn (n:count - 7, 7 <= count <= 133) + 0xff n:ui32 (n:count, 134 <= count < 2^32) - /** - * @returns {string} runtime code - */ - generate() { - const { runtimeTemplate } = this.compilation; - const fn = RuntimeGlobals.compatGetDefaultExport; - return Template.asString([ - "// getDefaultExport function for compatibility with non-harmony modules", - `${fn} = ${runtimeTemplate.basicFunction("module", [ - "var getter = module && module.__esModule ?", - Template.indent([ - `${runtimeTemplate.returningFunction("module['default']")} :`, - `${runtimeTemplate.returningFunction("module")};` - ]), - `${RuntimeGlobals.definePropertyGetters}(getter, { a: getter });`, - "return getter;" - ])};` - ]); - } -} +StringSectionHeaderByte -> 0b0000_1110 +BufferSectionHeaderByte -> 0b0000_1111 +NopSectionHeaderByte -> 0b0000_1011 +FalseHeaderByte -> 0b0000_1100 +TrueHeaderByte -> 0b0000_1101 -module.exports = CompatGetDefaultExportRuntimeModule; +RawNumber -> n (n <= 10) +*/ -/***/ }), +const LAZY_HEADER = 0x0b; +const TRUE_HEADER = 0x0c; +const FALSE_HEADER = 0x0d; +const BOOLEANS_HEADER = 0x0e; +const NULL_HEADER = 0x10; +const NULL2_HEADER = 0x11; +const NULL3_HEADER = 0x12; +const NULLS8_HEADER = 0x13; +const NULLS32_HEADER = 0x14; +const NULL_AND_I8_HEADER = 0x15; +const NULL_AND_I32_HEADER = 0x16; +const NULL_AND_TRUE_HEADER = 0x17; +const NULL_AND_FALSE_HEADER = 0x18; +const STRING_HEADER = 0x1e; +const BUFFER_HEADER = 0x1f; +const I8_HEADER = 0x60; +const I32_HEADER = 0x40; +const F64_HEADER = 0x20; +const SHORT_STRING_HEADER = 0x80; -/***/ 88234: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** Uplift high-order bits */ +const NUMBERS_HEADER_MASK = 0xe0; +const NUMBERS_COUNT_MASK = 0x1f; // 0b0001_1111 +const SHORT_STRING_LENGTH_MASK = 0x7f; // 0b0111_1111 -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ +const HEADER_SIZE = 1; +const I8_SIZE = 1; +const I32_SIZE = 4; +const F64_SIZE = 8; +const MEASURE_START_OPERATION = Symbol("MEASURE_START_OPERATION"); +const MEASURE_END_OPERATION = Symbol("MEASURE_END_OPERATION"); +/** @typedef {typeof MEASURE_START_OPERATION} MEASURE_START_OPERATION_TYPE */ +/** @typedef {typeof MEASURE_END_OPERATION} MEASURE_END_OPERATION_TYPE */ -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); +const identifyNumber = n => { + if (n === (n | 0)) { + if (n <= 127 && n >= -128) return 0; + if (n <= 2147483647 && n >= -2147483648) return 1; + } + return 2; +}; -/** @typedef {import("../MainTemplate")} MainTemplate */ +/** + * @typedef {PrimitiveSerializableType[]} DeserializedType + * @typedef {BufferSerializableType[]} SerializedType + * @extends {SerializerMiddleware} + */ +class BinaryMiddleware extends SerializerMiddleware { + /** + * @param {DeserializedType} data data + * @param {Object} context context object + * @returns {SerializedType|Promise} serialized data + */ + serialize(data, context) { + return this._serialize(data, context); + } -class CompatRuntimeModule extends RuntimeModule { - constructor() { - super("compat", RuntimeModule.STAGE_ATTACH); - this.fullHash = true; + _serializeLazy(fn, context) { + return SerializerMiddleware.serializeLazy(fn, data => + this._serialize(data, context) + ); } /** - * @returns {string} runtime code + * @param {DeserializedType} data data + * @param {Object} context context object + * @param {{ leftOverBuffer: Buffer | null, allocationSize: number, increaseCounter: number }} allocationScope allocation scope + * @returns {SerializedType} serialized data */ - generate() { - const { chunkGraph, chunk, compilation } = this; - const { - runtimeTemplate, - mainTemplate, - moduleTemplates, - dependencyTemplates - } = compilation; - const bootstrap = mainTemplate.hooks.bootstrap.call( - "", - chunk, - compilation.hash || "XXXX", - moduleTemplates.javascript, - dependencyTemplates - ); - const localVars = mainTemplate.hooks.localVars.call( - "", - chunk, - compilation.hash || "XXXX" - ); - const requireExtensions = mainTemplate.hooks.requireExtensions.call( - "", - chunk, - compilation.hash || "XXXX" - ); - const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk); - let requireEnsure = ""; - if (runtimeRequirements.has(RuntimeGlobals.ensureChunk)) { - const requireEnsureHandler = mainTemplate.hooks.requireEnsure.call( - "", - chunk, - compilation.hash || "XXXX", - "chunkId" - ); - if (requireEnsureHandler) { - requireEnsure = `${ - RuntimeGlobals.ensureChunkHandlers - }.compat = ${runtimeTemplate.basicFunction( - "chunkId, promises", - requireEnsureHandler - )};`; - } + _serialize( + data, + context, + allocationScope = { + allocationSize: 1024, + increaseCounter: 0, + leftOverBuffer: null } - return [bootstrap, localVars, requireEnsure, requireExtensions] - .filter(Boolean) - .join("\n"); - } - - /** - * @returns {boolean} true, if the runtime module should get it's own scope - */ - shouldIsolate() { - // We avoid isolating this to have better backward-compat - return false; - } -} - -module.exports = CompatRuntimeModule; - - -/***/ }), + ) { + /** @type {Buffer} */ + let leftOverBuffer = null; + /** @type {BufferSerializableType[]} */ + let buffers = []; + /** @type {Buffer} */ + let currentBuffer = allocationScope ? allocationScope.leftOverBuffer : null; + allocationScope.leftOverBuffer = null; + let currentPosition = 0; + if (currentBuffer === null) { + currentBuffer = Buffer.allocUnsafe(allocationScope.allocationSize); + } + const allocate = bytesNeeded => { + if (currentBuffer !== null) { + if (currentBuffer.length - currentPosition >= bytesNeeded) return; + flush(); + } + if (leftOverBuffer && leftOverBuffer.length >= bytesNeeded) { + currentBuffer = leftOverBuffer; + leftOverBuffer = null; + } else { + currentBuffer = Buffer.allocUnsafe( + Math.max(bytesNeeded, allocationScope.allocationSize) + ); + if ( + !(allocationScope.increaseCounter = + (allocationScope.increaseCounter + 1) % 4) && + allocationScope.allocationSize < 16777216 + ) { + allocationScope.allocationSize = allocationScope.allocationSize << 1; + } + } + }; + const flush = () => { + if (currentBuffer !== null) { + if (currentPosition > 0) { + buffers.push( + Buffer.from( + currentBuffer.buffer, + currentBuffer.byteOffset, + currentPosition + ) + ); + } + if ( + !leftOverBuffer || + leftOverBuffer.length < currentBuffer.length - currentPosition + ) { + leftOverBuffer = Buffer.from( + currentBuffer.buffer, + currentBuffer.byteOffset + currentPosition, + currentBuffer.byteLength - currentPosition + ); + } -/***/ 94669: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + currentBuffer = null; + currentPosition = 0; + } + }; + const writeU8 = byte => { + currentBuffer.writeUInt8(byte, currentPosition++); + }; + const writeU32 = ui32 => { + currentBuffer.writeUInt32LE(ui32, currentPosition); + currentPosition += 4; + }; + const measureStack = []; + const measureStart = () => { + measureStack.push(buffers.length, currentPosition); + }; + const measureEnd = () => { + const oldPos = measureStack.pop(); + const buffersIndex = measureStack.pop(); + let size = currentPosition - oldPos; + for (let i = buffersIndex; i < buffers.length; i++) { + size += buffers[i].length; + } + return size; + }; + for (let i = 0; i < data.length; i++) { + const thing = data[i]; + switch (typeof thing) { + case "function": { + if (!SerializerMiddleware.isLazy(thing)) + throw new Error("Unexpected function " + thing); + /** @type {SerializedType | (() => SerializedType)} */ + let serializedData = + SerializerMiddleware.getLazySerializedValue(thing); + if (serializedData === undefined) { + if (SerializerMiddleware.isLazy(thing, this)) { + flush(); + allocationScope.leftOverBuffer = leftOverBuffer; + const result = + /** @type {(Exclude>)[]} */ ( + thing() + ); + const data = this._serialize(result, context, allocationScope); + leftOverBuffer = allocationScope.leftOverBuffer; + allocationScope.leftOverBuffer = null; + SerializerMiddleware.setLazySerializedValue(thing, data); + serializedData = data; + } else { + serializedData = this._serializeLazy(thing, context); + flush(); + buffers.push(serializedData); + break; + } + } else { + if (typeof serializedData === "function") { + flush(); + buffers.push(serializedData); + break; + } + } + const lengths = []; + for (const item of serializedData) { + let last; + if (typeof item === "function") { + lengths.push(0); + } else if (item.length === 0) { + // ignore + } else if ( + lengths.length > 0 && + (last = lengths[lengths.length - 1]) !== 0 + ) { + const remaining = 0xffffffff - last; + if (remaining >= item.length) { + lengths[lengths.length - 1] += item.length; + } else { + lengths.push(item.length - remaining); + lengths[lengths.length - 2] = 0xffffffff; + } + } else { + lengths.push(item.length); + } + } + allocate(5 + lengths.length * 4); + writeU8(LAZY_HEADER); + writeU32(lengths.length); + for (const l of lengths) { + writeU32(l); + } + flush(); + for (const item of serializedData) { + buffers.push(item); + } + break; + } + case "string": { + const len = Buffer.byteLength(thing); + if (len >= 128 || len !== thing.length) { + allocate(len + HEADER_SIZE + I32_SIZE); + writeU8(STRING_HEADER); + writeU32(len); + currentBuffer.write(thing, currentPosition); + currentPosition += len; + } else if (len >= 70) { + allocate(len + HEADER_SIZE); + writeU8(SHORT_STRING_HEADER | len); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + currentBuffer.write(thing, currentPosition, "latin1"); + currentPosition += len; + } else { + allocate(len + HEADER_SIZE); + writeU8(SHORT_STRING_HEADER | len); + for (let i = 0; i < len; i++) { + currentBuffer[currentPosition++] = thing.charCodeAt(i); + } + } + break; + } + case "number": { + const type = identifyNumber(thing); + if (type === 0 && thing >= 0 && thing <= 10) { + // shortcut for very small numbers + allocate(I8_SIZE); + writeU8(thing); + break; + } + /** + * amount of numbers to write + * @type {number} + */ + let n = 1; + for (; n < 32 && i + n < data.length; n++) { + const item = data[i + n]; + if (typeof item !== "number") break; + if (identifyNumber(item) !== type) break; + } + switch (type) { + case 0: + allocate(HEADER_SIZE + I8_SIZE * n); + writeU8(I8_HEADER | (n - 1)); + while (n > 0) { + currentBuffer.writeInt8( + /** @type {number} */ (data[i]), + currentPosition + ); + currentPosition += I8_SIZE; + n--; + i++; + } + break; + case 1: + allocate(HEADER_SIZE + I32_SIZE * n); + writeU8(I32_HEADER | (n - 1)); + while (n > 0) { + currentBuffer.writeInt32LE( + /** @type {number} */ (data[i]), + currentPosition + ); + currentPosition += I32_SIZE; + n--; + i++; + } + break; + case 2: + allocate(HEADER_SIZE + F64_SIZE * n); + writeU8(F64_HEADER | (n - 1)); + while (n > 0) { + currentBuffer.writeDoubleLE( + /** @type {number} */ (data[i]), + currentPosition + ); + currentPosition += F64_SIZE; + n--; + i++; + } + break; + } + i--; + break; + } + case "boolean": { + let lastByte = thing === true ? 1 : 0; + const bytes = []; + let count = 1; + let n; + for (n = 1; n < 0xffffffff && i + n < data.length; n++) { + const item = data[i + n]; + if (typeof item !== "boolean") break; + const pos = count & 0x7; + if (pos === 0) { + bytes.push(lastByte); + lastByte = item === true ? 1 : 0; + } else if (item === true) { + lastByte |= 1 << pos; + } + count++; + } + i += count - 1; + if (count === 1) { + allocate(HEADER_SIZE); + writeU8(lastByte === 1 ? TRUE_HEADER : FALSE_HEADER); + } else if (count === 2) { + allocate(HEADER_SIZE * 2); + writeU8(lastByte & 1 ? TRUE_HEADER : FALSE_HEADER); + writeU8(lastByte & 2 ? TRUE_HEADER : FALSE_HEADER); + } else if (count <= 6) { + allocate(HEADER_SIZE + I8_SIZE); + writeU8(BOOLEANS_HEADER); + writeU8((1 << count) | lastByte); + } else if (count <= 133) { + allocate(HEADER_SIZE + I8_SIZE + I8_SIZE * bytes.length + I8_SIZE); + writeU8(BOOLEANS_HEADER); + writeU8(0x80 | (count - 7)); + for (const byte of bytes) writeU8(byte); + writeU8(lastByte); + } else { + allocate( + HEADER_SIZE + + I8_SIZE + + I32_SIZE + + I8_SIZE * bytes.length + + I8_SIZE + ); + writeU8(BOOLEANS_HEADER); + writeU8(0xff); + writeU32(count); + for (const byte of bytes) writeU8(byte); + writeU8(lastByte); + } + break; + } + case "object": { + if (thing === null) { + let n; + for (n = 1; n < 0x100000104 && i + n < data.length; n++) { + const item = data[i + n]; + if (item !== null) break; + } + i += n - 1; + if (n === 1) { + if (i + 1 < data.length) { + const next = data[i + 1]; + if (next === true) { + allocate(HEADER_SIZE); + writeU8(NULL_AND_TRUE_HEADER); + i++; + } else if (next === false) { + allocate(HEADER_SIZE); + writeU8(NULL_AND_FALSE_HEADER); + i++; + } else if (typeof next === "number") { + const type = identifyNumber(next); + if (type === 0) { + allocate(HEADER_SIZE + I8_SIZE); + writeU8(NULL_AND_I8_HEADER); + currentBuffer.writeInt8(next, currentPosition); + currentPosition += I8_SIZE; + i++; + } else if (type === 1) { + allocate(HEADER_SIZE + I32_SIZE); + writeU8(NULL_AND_I32_HEADER); + currentBuffer.writeInt32LE(next, currentPosition); + currentPosition += I32_SIZE; + i++; + } else { + allocate(HEADER_SIZE); + writeU8(NULL_HEADER); + } + } else { + allocate(HEADER_SIZE); + writeU8(NULL_HEADER); + } + } else { + allocate(HEADER_SIZE); + writeU8(NULL_HEADER); + } + } else if (n === 2) { + allocate(HEADER_SIZE); + writeU8(NULL2_HEADER); + } else if (n === 3) { + allocate(HEADER_SIZE); + writeU8(NULL3_HEADER); + } else if (n < 260) { + allocate(HEADER_SIZE + I8_SIZE); + writeU8(NULLS8_HEADER); + writeU8(n - 4); + } else { + allocate(HEADER_SIZE + I32_SIZE); + writeU8(NULLS32_HEADER); + writeU32(n - 260); + } + } else if (Buffer.isBuffer(thing)) { + if (thing.length < 8192) { + allocate(HEADER_SIZE + I32_SIZE + thing.length); + writeU8(BUFFER_HEADER); + writeU32(thing.length); + thing.copy(currentBuffer, currentPosition); + currentPosition += thing.length; + } else { + allocate(HEADER_SIZE + I32_SIZE); + writeU8(BUFFER_HEADER); + writeU32(thing.length); + flush(); + buffers.push(thing); + } + } + break; + } + case "symbol": { + if (thing === MEASURE_START_OPERATION) { + measureStart(); + } else if (thing === MEASURE_END_OPERATION) { + const size = measureEnd(); + allocate(HEADER_SIZE + I32_SIZE); + writeU8(I32_HEADER); + currentBuffer.writeInt32LE(size, currentPosition); + currentPosition += I32_SIZE; + } + break; + } + } + } + flush(); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const HelperRuntimeModule = __webpack_require__(82444); + allocationScope.leftOverBuffer = leftOverBuffer; -class CreateFakeNamespaceObjectRuntimeModule extends HelperRuntimeModule { - constructor() { - super("create fake namespace object"); + // avoid leaking memory + currentBuffer = null; + leftOverBuffer = null; + allocationScope = undefined; + const _buffers = buffers; + buffers = undefined; + return _buffers; } /** - * @returns {string} runtime code + * @param {SerializedType} data data + * @param {Object} context context object + * @returns {DeserializedType|Promise} deserialized data */ - generate() { - const { runtimeTemplate } = this.compilation; - const fn = RuntimeGlobals.createFakeNamespaceObject; - return Template.asString([ - `var getProto = Object.getPrototypeOf ? ${runtimeTemplate.returningFunction( - "Object.getPrototypeOf(obj)", - "obj" - )} : ${runtimeTemplate.returningFunction("obj.__proto__", "obj")};`, - "var leafPrototypes;", - "// create a fake namespace object", - "// mode & 1: value is a module id, require it", - "// mode & 2: merge all properties of value into the ns", - "// mode & 4: return value when already ns object", - "// mode & 16: return value when it's Promise-like", - "// mode & 8|1: behave like require", - // Note: must be a function (not arrow), because this is used in body! - `${fn} = function(value, mode) {`, - Template.indent([ - `if(mode & 1) value = this(value);`, - `if(mode & 8) return value;`, - "if(typeof value === 'object' && value) {", - Template.indent([ - "if((mode & 4) && value.__esModule) return value;", - "if((mode & 16) && typeof value.then === 'function') return value;" - ]), - "}", - "var ns = Object.create(null);", - `${RuntimeGlobals.makeNamespaceObject}(ns);`, - "var def = {};", - "leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];", - "for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {", - Template.indent([ - `Object.getOwnPropertyNames(current).forEach(${runtimeTemplate.expressionFunction( - `def[key] = ${runtimeTemplate.returningFunction("value[key]", "")}`, - "key" - )});` - ]), - "}", - `def['default'] = ${runtimeTemplate.returningFunction("value", "")};`, - `${RuntimeGlobals.definePropertyGetters}(ns, def);`, - "return ns;" - ]), - "};" - ]); + deserialize(data, context) { + return this._deserialize(data, context); } -} - -module.exports = CreateFakeNamespaceObjectRuntimeModule; + _createLazyDeserialized(content, context) { + return SerializerMiddleware.createLazy( + memoize(() => this._deserialize(content, context)), + this, + undefined, + content + ); + } -/***/ }), - -/***/ 2759: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const HelperRuntimeModule = __webpack_require__(82444); - -class CreateScriptRuntimeModule extends HelperRuntimeModule { - constructor() { - super("trusted types script"); + _deserializeLazy(fn, context) { + return SerializerMiddleware.deserializeLazy(fn, data => + this._deserialize(data, context) + ); } /** - * @returns {string} runtime code + * @param {SerializedType} data data + * @param {Object} context context object + * @returns {DeserializedType} deserialized data */ - generate() { - const { compilation } = this; - const { runtimeTemplate, outputOptions } = compilation; - const { trustedTypes } = outputOptions; - const fn = RuntimeGlobals.createScript; + _deserialize(data, context) { + let currentDataItem = 0; + let currentBuffer = data[0]; + let currentIsBuffer = Buffer.isBuffer(currentBuffer); + let currentPosition = 0; - return Template.asString( - `${fn} = ${runtimeTemplate.returningFunction( - trustedTypes - ? `${RuntimeGlobals.getTrustedTypesPolicy}().createScript(script)` - : "script", - "script" - )};` - ); + const retainedBuffer = context.retainedBuffer || (x => x); + + const checkOverflow = () => { + if (currentPosition >= currentBuffer.length) { + currentPosition = 0; + currentDataItem++; + currentBuffer = + currentDataItem < data.length ? data[currentDataItem] : null; + currentIsBuffer = Buffer.isBuffer(currentBuffer); + } + }; + const isInCurrentBuffer = n => { + return currentIsBuffer && n + currentPosition <= currentBuffer.length; + }; + const ensureBuffer = () => { + if (!currentIsBuffer) { + throw new Error( + currentBuffer === null + ? "Unexpected end of stream" + : "Unexpected lazy element in stream" + ); + } + }; + /** + * Reads n bytes + * @param {number} n amount of bytes to read + * @returns {Buffer} buffer with bytes + */ + const read = n => { + ensureBuffer(); + const rem = currentBuffer.length - currentPosition; + if (rem < n) { + const buffers = [read(rem)]; + n -= rem; + ensureBuffer(); + while (currentBuffer.length < n) { + const b = /** @type {Buffer} */ (currentBuffer); + buffers.push(b); + n -= b.length; + currentDataItem++; + currentBuffer = + currentDataItem < data.length ? data[currentDataItem] : null; + currentIsBuffer = Buffer.isBuffer(currentBuffer); + ensureBuffer(); + } + buffers.push(read(n)); + return Buffer.concat(buffers); + } + const b = /** @type {Buffer} */ (currentBuffer); + const res = Buffer.from(b.buffer, b.byteOffset + currentPosition, n); + currentPosition += n; + checkOverflow(); + return res; + }; + /** + * Reads up to n bytes + * @param {number} n amount of bytes to read + * @returns {Buffer} buffer with bytes + */ + const readUpTo = n => { + ensureBuffer(); + const rem = currentBuffer.length - currentPosition; + if (rem < n) { + n = rem; + } + const b = /** @type {Buffer} */ (currentBuffer); + const res = Buffer.from(b.buffer, b.byteOffset + currentPosition, n); + currentPosition += n; + checkOverflow(); + return res; + }; + const readU8 = () => { + ensureBuffer(); + /** + * There is no need to check remaining buffer size here + * since {@link checkOverflow} guarantees at least one byte remaining + */ + const byte = /** @type {Buffer} */ (currentBuffer).readUInt8( + currentPosition + ); + currentPosition += I8_SIZE; + checkOverflow(); + return byte; + }; + const readU32 = () => { + return read(I32_SIZE).readUInt32LE(0); + }; + const readBits = (data, n) => { + let mask = 1; + while (n !== 0) { + result.push((data & mask) !== 0); + mask = mask << 1; + n--; + } + }; + const dispatchTable = Array.from({ length: 256 }).map((_, header) => { + switch (header) { + case LAZY_HEADER: + return () => { + const count = readU32(); + const lengths = Array.from({ length: count }).map(() => readU32()); + const content = []; + for (let l of lengths) { + if (l === 0) { + if (typeof currentBuffer !== "function") { + throw new Error("Unexpected non-lazy element in stream"); + } + content.push(currentBuffer); + currentDataItem++; + currentBuffer = + currentDataItem < data.length ? data[currentDataItem] : null; + currentIsBuffer = Buffer.isBuffer(currentBuffer); + } else { + do { + const buf = readUpTo(l); + l -= buf.length; + content.push(retainedBuffer(buf)); + } while (l > 0); + } + } + result.push(this._createLazyDeserialized(content, context)); + }; + case BUFFER_HEADER: + return () => { + const len = readU32(); + result.push(retainedBuffer(read(len))); + }; + case TRUE_HEADER: + return () => result.push(true); + case FALSE_HEADER: + return () => result.push(false); + case NULL3_HEADER: + return () => result.push(null, null, null); + case NULL2_HEADER: + return () => result.push(null, null); + case NULL_HEADER: + return () => result.push(null); + case NULL_AND_TRUE_HEADER: + return () => result.push(null, true); + case NULL_AND_FALSE_HEADER: + return () => result.push(null, false); + case NULL_AND_I8_HEADER: + return () => { + if (currentIsBuffer) { + result.push( + null, + /** @type {Buffer} */ (currentBuffer).readInt8(currentPosition) + ); + currentPosition += I8_SIZE; + checkOverflow(); + } else { + result.push(null, read(I8_SIZE).readInt8(0)); + } + }; + case NULL_AND_I32_HEADER: + return () => { + result.push(null); + if (isInCurrentBuffer(I32_SIZE)) { + result.push( + /** @type {Buffer} */ (currentBuffer).readInt32LE( + currentPosition + ) + ); + currentPosition += I32_SIZE; + checkOverflow(); + } else { + result.push(read(I32_SIZE).readInt32LE(0)); + } + }; + case NULLS8_HEADER: + return () => { + const len = readU8() + 4; + for (let i = 0; i < len; i++) { + result.push(null); + } + }; + case NULLS32_HEADER: + return () => { + const len = readU32() + 260; + for (let i = 0; i < len; i++) { + result.push(null); + } + }; + case BOOLEANS_HEADER: + return () => { + const innerHeader = readU8(); + if ((innerHeader & 0xf0) === 0) { + readBits(innerHeader, 3); + } else if ((innerHeader & 0xe0) === 0) { + readBits(innerHeader, 4); + } else if ((innerHeader & 0xc0) === 0) { + readBits(innerHeader, 5); + } else if ((innerHeader & 0x80) === 0) { + readBits(innerHeader, 6); + } else if (innerHeader !== 0xff) { + let count = (innerHeader & 0x7f) + 7; + while (count > 8) { + readBits(readU8(), 8); + count -= 8; + } + readBits(readU8(), count); + } else { + let count = readU32(); + while (count > 8) { + readBits(readU8(), 8); + count -= 8; + } + readBits(readU8(), count); + } + }; + case STRING_HEADER: + return () => { + const len = readU32(); + if (isInCurrentBuffer(len) && currentPosition + len < 0x7fffffff) { + result.push( + currentBuffer.toString( + undefined, + currentPosition, + currentPosition + len + ) + ); + currentPosition += len; + checkOverflow(); + } else { + result.push(read(len).toString()); + } + }; + case SHORT_STRING_HEADER: + return () => result.push(""); + case SHORT_STRING_HEADER | 1: + return () => { + if (currentIsBuffer && currentPosition < 0x7ffffffe) { + result.push( + currentBuffer.toString( + "latin1", + currentPosition, + currentPosition + 1 + ) + ); + currentPosition++; + checkOverflow(); + } else { + result.push(read(1).toString("latin1")); + } + }; + case I8_HEADER: + return () => { + if (currentIsBuffer) { + result.push( + /** @type {Buffer} */ (currentBuffer).readInt8(currentPosition) + ); + currentPosition++; + checkOverflow(); + } else { + result.push(read(1).readInt8(0)); + } + }; + default: + if (header <= 10) { + return () => result.push(header); + } else if ((header & SHORT_STRING_HEADER) === SHORT_STRING_HEADER) { + const len = header & SHORT_STRING_LENGTH_MASK; + return () => { + if ( + isInCurrentBuffer(len) && + currentPosition + len < 0x7fffffff + ) { + result.push( + currentBuffer.toString( + "latin1", + currentPosition, + currentPosition + len + ) + ); + currentPosition += len; + checkOverflow(); + } else { + result.push(read(len).toString("latin1")); + } + }; + } else if ((header & NUMBERS_HEADER_MASK) === F64_HEADER) { + const len = (header & NUMBERS_COUNT_MASK) + 1; + return () => { + const need = F64_SIZE * len; + if (isInCurrentBuffer(need)) { + for (let i = 0; i < len; i++) { + result.push( + /** @type {Buffer} */ (currentBuffer).readDoubleLE( + currentPosition + ) + ); + currentPosition += F64_SIZE; + } + checkOverflow(); + } else { + const buf = read(need); + for (let i = 0; i < len; i++) { + result.push(buf.readDoubleLE(i * F64_SIZE)); + } + } + }; + } else if ((header & NUMBERS_HEADER_MASK) === I32_HEADER) { + const len = (header & NUMBERS_COUNT_MASK) + 1; + return () => { + const need = I32_SIZE * len; + if (isInCurrentBuffer(need)) { + for (let i = 0; i < len; i++) { + result.push( + /** @type {Buffer} */ (currentBuffer).readInt32LE( + currentPosition + ) + ); + currentPosition += I32_SIZE; + } + checkOverflow(); + } else { + const buf = read(need); + for (let i = 0; i < len; i++) { + result.push(buf.readInt32LE(i * I32_SIZE)); + } + } + }; + } else if ((header & NUMBERS_HEADER_MASK) === I8_HEADER) { + const len = (header & NUMBERS_COUNT_MASK) + 1; + return () => { + const need = I8_SIZE * len; + if (isInCurrentBuffer(need)) { + for (let i = 0; i < len; i++) { + result.push( + /** @type {Buffer} */ (currentBuffer).readInt8( + currentPosition + ) + ); + currentPosition += I8_SIZE; + } + checkOverflow(); + } else { + const buf = read(need); + for (let i = 0; i < len; i++) { + result.push(buf.readInt8(i * I8_SIZE)); + } + } + }; + } else { + return () => { + throw new Error( + `Unexpected header byte 0x${header.toString(16)}` + ); + }; + } + } + }); + + /** @type {DeserializedType} */ + let result = []; + while (currentBuffer !== null) { + if (typeof currentBuffer === "function") { + result.push(this._deserializeLazy(currentBuffer, context)); + currentDataItem++; + currentBuffer = + currentDataItem < data.length ? data[currentDataItem] : null; + currentIsBuffer = Buffer.isBuffer(currentBuffer); + } else { + const header = readU8(); + dispatchTable[header](); + } + } + + // avoid leaking memory in context + let _result = result; + result = undefined; + return _result; } } -module.exports = CreateScriptRuntimeModule; +module.exports = BinaryMiddleware; + +module.exports.MEASURE_START_OPERATION = MEASURE_START_OPERATION; +module.exports.MEASURE_END_OPERATION = MEASURE_END_OPERATION; /***/ }), -/***/ 21213: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 93475: +/***/ (function(module) { "use strict"; /* @@ -116236,42 +112603,22 @@ module.exports = CreateScriptRuntimeModule; -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const HelperRuntimeModule = __webpack_require__(82444); - -class CreateScriptUrlRuntimeModule extends HelperRuntimeModule { - constructor() { - super("trusted types script url"); +class DateObjectSerializer { + serialize(obj, { write }) { + write(obj.getTime()); } - - /** - * @returns {string} runtime code - */ - generate() { - const { compilation } = this; - const { runtimeTemplate, outputOptions } = compilation; - const { trustedTypes } = outputOptions; - const fn = RuntimeGlobals.createScriptUrl; - - return Template.asString( - `${fn} = ${runtimeTemplate.returningFunction( - trustedTypes - ? `${RuntimeGlobals.getTrustedTypesPolicy}().createScriptURL(url)` - : "url", - "url" - )};` - ); + deserialize({ read }) { + return new Date(read()); } } -module.exports = CreateScriptUrlRuntimeModule; +module.exports = DateObjectSerializer; /***/ }), -/***/ 75481: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 79479: +/***/ (function(module) { "use strict"; /* @@ -116280,44 +112627,32 @@ module.exports = CreateScriptUrlRuntimeModule; -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const HelperRuntimeModule = __webpack_require__(82444); +class ErrorObjectSerializer { + constructor(Type) { + this.Type = Type; + } -class DefinePropertyGettersRuntimeModule extends HelperRuntimeModule { - constructor() { - super("define property getters"); + serialize(obj, { write }) { + write(obj.message); + write(obj.stack); } - /** - * @returns {string} runtime code - */ - generate() { - const { runtimeTemplate } = this.compilation; - const fn = RuntimeGlobals.definePropertyGetters; - return Template.asString([ - "// define getter functions for harmony exports", - `${fn} = ${runtimeTemplate.basicFunction("exports, definition", [ - `for(var key in definition) {`, - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(definition, key) && !${RuntimeGlobals.hasOwnProperty}(exports, key)) {`, - Template.indent([ - "Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });" - ]), - "}" - ]), - "}" - ])};` - ]); + deserialize({ read }) { + const err = new this.Type(); + + err.message = read(); + err.stack = read(); + + return err; } } -module.exports = DefinePropertyGettersRuntimeModule; +module.exports = ErrorObjectSerializer; /***/ }), -/***/ 71519: +/***/ 65321: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -116327,350 +112662,671 @@ module.exports = DefinePropertyGettersRuntimeModule; -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); - -class EnsureChunkRuntimeModule extends RuntimeModule { - constructor(runtimeRequirements) { - super("ensure chunk"); - this.runtimeRequirements = runtimeRequirements; - } - - /** - * @returns {string} runtime code - */ - generate() { - const { runtimeTemplate } = this.compilation; - // Check if there are non initial chunks which need to be imported using require-ensure - if (this.runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers)) { - const handlers = RuntimeGlobals.ensureChunkHandlers; - return Template.asString([ - `${handlers} = {};`, - "// This file contains only the entry chunk.", - "// The chunk loading function for additional chunks", - `${RuntimeGlobals.ensureChunk} = ${runtimeTemplate.basicFunction( - "chunkId", - [ - `return Promise.all(Object.keys(${handlers}).reduce(${runtimeTemplate.basicFunction( - "promises, key", - [`${handlers}[key](chunkId, promises);`, "return promises;"] - )}, []));` - ] - )};` - ]); - } else { - // There ensureChunk is used somewhere in the tree, so we need an empty requireEnsure - // function. This can happen with multiple entrypoints. - return Template.asString([ - "// The chunk loading function for additional chunks", - "// Since all referenced chunks are already included", - "// in this file, this function is empty here.", - `${RuntimeGlobals.ensureChunk} = ${runtimeTemplate.returningFunction( - "Promise.resolve()" - )};` - ]); - } - } -} +const { constants } = __webpack_require__(14300); +const { pipeline } = __webpack_require__(12781); +const { + createBrotliCompress, + createBrotliDecompress, + createGzip, + createGunzip, + constants: zConstants +} = __webpack_require__(59796); +const createHash = __webpack_require__(49835); +const { dirname, join, mkdirp } = __webpack_require__(17139); +const memoize = __webpack_require__(78676); +const SerializerMiddleware = __webpack_require__(83137); -module.exports = EnsureChunkRuntimeModule; +/** @typedef {typeof import("../util/Hash")} Hash */ +/** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */ +/** @typedef {import("./types").BufferSerializableType} BufferSerializableType */ +/* +Format: -/***/ }), +File -> Header Section* -/***/ 34277: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +Version -> u32 +AmountOfSections -> u32 +SectionSize -> i32 (if less than zero represents lazy value) -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ +Header -> Version AmountOfSections SectionSize* +Buffer -> n bytes +Section -> Buffer +*/ -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); -const { first } = __webpack_require__(93347); +// "wpc" + 1 in little-endian +const VERSION = 0x01637077; +const WRITE_LIMIT_TOTAL = 0x7fff0000; +const WRITE_LIMIT_CHUNK = 511 * 1024 * 1024; -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("../Compilation").PathData} PathData */ +/** + * @param {Buffer[]} buffers buffers + * @param {string | Hash} hashFunction hash function to use + * @returns {string} hash + */ +const hashForName = (buffers, hashFunction) => { + const hash = createHash(hashFunction); + for (const buf of buffers) hash.update(buf); + return /** @type {string} */ (hash.digest("hex")); +}; -/** @typedef {function(PathData, AssetInfo=): string} FilenameFunction */ +const COMPRESSION_CHUNK_SIZE = 100 * 1024 * 1024; +const DECOMPRESSION_CHUNK_SIZE = 100 * 1024 * 1024; -class GetChunkFilenameRuntimeModule extends RuntimeModule { - /** - * @param {string} contentType the contentType to use the content hash for - * @param {string} name kind of filename - * @param {string} global function name to be assigned - * @param {function(Chunk): string | FilenameFunction} getFilenameForChunk functor to get the filename or function - * @param {boolean} allChunks when false, only async chunks are included - */ - constructor(contentType, name, global, getFilenameForChunk, allChunks) { - super(`get ${name} chunk filename`); - this.contentType = contentType; - this.global = global; - this.getFilenameForChunk = getFilenameForChunk; - this.allChunks = allChunks; - this.dependentHash = true; - } +const writeUInt64LE = Buffer.prototype.writeBigUInt64LE + ? (buf, value, offset) => { + buf.writeBigUInt64LE(BigInt(value), offset); + } + : (buf, value, offset) => { + const low = value % 0x100000000; + const high = (value - low) / 0x100000000; + buf.writeUInt32LE(low, offset); + buf.writeUInt32LE(high, offset + 4); + }; - /** - * @returns {string} runtime code - */ - generate() { - const { - global, - chunk, - chunkGraph, - contentType, - getFilenameForChunk, - allChunks, - compilation - } = this; - const { runtimeTemplate } = compilation; +const readUInt64LE = Buffer.prototype.readBigUInt64LE + ? (buf, offset) => { + return Number(buf.readBigUInt64LE(offset)); + } + : (buf, offset) => { + const low = buf.readUInt32LE(offset); + const high = buf.readUInt32LE(offset + 4); + return high * 0x100000000 + low; + }; - /** @type {Map>} */ - const chunkFilenames = new Map(); - let maxChunks = 0; - /** @type {string} */ - let dynamicFilename; +/** + * @typedef {Object} SerializeResult + * @property {string | false} name + * @property {number} size + * @property {Promise=} backgroundJob + */ - /** - * @param {Chunk} c the chunk - * @returns {void} - */ - const addChunk = c => { - const chunkFilename = getFilenameForChunk(c); - if (chunkFilename) { - let set = chunkFilenames.get(chunkFilename); - if (set === undefined) { - chunkFilenames.set(chunkFilename, (set = new Set())); +/** + * @param {FileMiddleware} middleware this + * @param {BufferSerializableType[] | Promise} data data to be serialized + * @param {string | boolean} name file base name + * @param {function(string | false, Buffer[], number): Promise} writeFile writes a file + * @param {string | Hash} hashFunction hash function to use + * @returns {Promise} resulting file pointer and promise + */ +const serialize = async ( + middleware, + data, + name, + writeFile, + hashFunction = "md4" +) => { + /** @type {(Buffer[] | Buffer | SerializeResult | Promise)[]} */ + const processedData = []; + /** @type {WeakMap>} */ + const resultToLazy = new WeakMap(); + /** @type {Buffer[]} */ + let lastBuffers = undefined; + for (const item of await data) { + if (typeof item === "function") { + if (!SerializerMiddleware.isLazy(item)) + throw new Error("Unexpected function"); + if (!SerializerMiddleware.isLazy(item, middleware)) { + throw new Error( + "Unexpected lazy value with non-this target (can't pass through lazy values)" + ); + } + lastBuffers = undefined; + const serializedInfo = SerializerMiddleware.getLazySerializedValue(item); + if (serializedInfo) { + if (typeof serializedInfo === "function") { + throw new Error( + "Unexpected lazy value with non-this target (can't pass through lazy values)" + ); + } else { + processedData.push(serializedInfo); } - set.add(c); - if (typeof chunkFilename === "string") { - if (set.size < maxChunks) return; - if (set.size === maxChunks) { - if (chunkFilename.length < dynamicFilename.length) return; - if (chunkFilename.length === dynamicFilename.length) { - if (chunkFilename < dynamicFilename) return; - } - } - maxChunks = set.size; - dynamicFilename = chunkFilename; + } else { + const content = item(); + if (content) { + const options = SerializerMiddleware.getLazyOptions(item); + processedData.push( + serialize( + middleware, + content, + (options && options.name) || true, + writeFile, + hashFunction + ).then(result => { + /** @type {any} */ (item).options.size = result.size; + resultToLazy.set(result, item); + return result; + }) + ); + } else { + throw new Error( + "Unexpected falsy value returned by lazy value function" + ); } } - }; - - /** @type {string[]} */ - const includedChunksMessages = []; - if (allChunks) { - includedChunksMessages.push("all chunks"); - for (const c of chunk.getAllReferencedChunks()) { - addChunk(c); + } else if (item) { + if (lastBuffers) { + lastBuffers.push(item); + } else { + lastBuffers = [item]; + processedData.push(lastBuffers); } } else { - includedChunksMessages.push("async chunks"); - for (const c of chunk.getAllAsyncChunks()) { - addChunk(c); - } - const includeEntries = chunkGraph - .getTreeRuntimeRequirements(chunk) - .has(RuntimeGlobals.ensureChunkIncludeEntries); - if (includeEntries) { - includedChunksMessages.push("sibling chunks for the entrypoint"); - for (const c of chunkGraph.getChunkEntryDependentChunksIterable( - chunk - )) { - addChunk(c); - } - } - } - for (const entrypoint of chunk.getAllReferencedAsyncEntrypoints()) { - addChunk(entrypoint.chunks[entrypoint.chunks.length - 1]); + throw new Error("Unexpected falsy value in items array"); } + } + /** @type {Promise[]} */ + const backgroundJobs = []; + const resolvedData = ( + await Promise.all( + /** @type {Promise[]} */ ( + processedData + ) + ) + ).map(item => { + if (Array.isArray(item) || Buffer.isBuffer(item)) return item; - /** @type {Map>} */ - const staticUrls = new Map(); - /** @type {Set} */ - const dynamicUrlChunks = new Set(); - - /** - * @param {Chunk} c the chunk - * @param {string | FilenameFunction} chunkFilename the filename template for the chunk - * @returns {void} - */ - const addStaticUrl = (c, chunkFilename) => { - /** - * @param {string | number} value a value - * @returns {string} string to put in quotes - */ - const unquotedStringify = value => { - const str = `${value}`; - if (str.length >= 5 && str === `${c.id}`) { - // This is shorter and generates the same result - return '" + chunkId + "'; - } - const s = JSON.stringify(str); - return s.slice(1, s.length - 1); - }; - const unquotedStringifyWithLength = value => length => - unquotedStringify(`${value}`.slice(0, length)); - const chunkFilenameValue = - typeof chunkFilename === "function" - ? JSON.stringify( - chunkFilename({ - chunk: c, - contentHashType: contentType - }) - ) - : JSON.stringify(chunkFilename); - const staticChunkFilename = compilation.getPath(chunkFilenameValue, { - hash: `" + ${RuntimeGlobals.getFullHash}() + "`, - hashWithLength: length => - `" + ${RuntimeGlobals.getFullHash}().slice(0, ${length}) + "`, - chunk: { - id: unquotedStringify(c.id), - hash: unquotedStringify(c.renderedHash), - hashWithLength: unquotedStringifyWithLength(c.renderedHash), - name: unquotedStringify(c.name || c.id), - contentHash: { - [contentType]: unquotedStringify(c.contentHash[contentType]) - }, - contentHashWithLength: { - [contentType]: unquotedStringifyWithLength( - c.contentHash[contentType] - ) - } - }, - contentHashType: contentType - }); - let set = staticUrls.get(staticChunkFilename); - if (set === undefined) { - staticUrls.set(staticChunkFilename, (set = new Set())); - } - set.add(c.id); - }; - - for (const [filename, chunks] of chunkFilenames) { - if (filename !== dynamicFilename) { - for (const c of chunks) addStaticUrl(c, filename); - } else { - for (const c of chunks) dynamicUrlChunks.add(c); + backgroundJobs.push(item.backgroundJob); + // create pointer buffer from size and name + const name = /** @type {string} */ (item.name); + const nameBuffer = Buffer.from(name); + const buf = Buffer.allocUnsafe(8 + nameBuffer.length); + writeUInt64LE(buf, item.size, 0); + nameBuffer.copy(buf, 8, 0); + const lazy = resultToLazy.get(item); + SerializerMiddleware.setLazySerializedValue(lazy, buf); + return buf; + }); + const lengths = []; + for (const item of resolvedData) { + if (Array.isArray(item)) { + let l = 0; + for (const b of item) l += b.length; + while (l > 0x7fffffff) { + lengths.push(0x7fffffff); + l -= 0x7fffffff; } + lengths.push(l); + } else if (item) { + lengths.push(-item.length); + } else { + throw new Error("Unexpected falsy value in resolved data " + item); + } + } + const header = Buffer.allocUnsafe(8 + lengths.length * 4); + header.writeUInt32LE(VERSION, 0); + header.writeUInt32LE(lengths.length, 4); + for (let i = 0; i < lengths.length; i++) { + header.writeInt32LE(lengths[i], 8 + i * 4); + } + const buf = [header]; + for (const item of resolvedData) { + if (Array.isArray(item)) { + for (const b of item) buf.push(b); + } else if (item) { + buf.push(item); } + } + if (name === true) { + name = hashForName(buf, hashFunction); + } + let size = 0; + for (const b of buf) size += b.length; + backgroundJobs.push(writeFile(name, buf, size)); + return { + size, + name, + backgroundJob: + backgroundJobs.length === 1 + ? backgroundJobs[0] + : Promise.all(backgroundJobs) + }; +}; - /** - * @param {function(Chunk): string | number} fn function from chunk to value - * @returns {string} code with static mapping of results of fn - */ - const createMap = fn => { - const obj = {}; - let useId = false; - let lastKey; - let entries = 0; - for (const c of dynamicUrlChunks) { - const value = fn(c); - if (value === c.id) { - useId = true; +/** + * @param {FileMiddleware} middleware this + * @param {string | false} name filename + * @param {function(string | false): Promise} readFile read content of a file + * @returns {Promise} deserialized data + */ +const deserialize = async (middleware, name, readFile) => { + const contents = await readFile(name); + if (contents.length === 0) throw new Error("Empty file " + name); + let contentsIndex = 0; + let contentItem = contents[0]; + let contentItemLength = contentItem.length; + let contentPosition = 0; + if (contentItemLength === 0) throw new Error("Empty file " + name); + const nextContent = () => { + contentsIndex++; + contentItem = contents[contentsIndex]; + contentItemLength = contentItem.length; + contentPosition = 0; + }; + const ensureData = n => { + if (contentPosition === contentItemLength) { + nextContent(); + } + while (contentItemLength - contentPosition < n) { + const remaining = contentItem.slice(contentPosition); + let lengthFromNext = n - remaining.length; + const buffers = [remaining]; + for (let i = contentsIndex + 1; i < contents.length; i++) { + const l = contents[i].length; + if (l > lengthFromNext) { + buffers.push(contents[i].slice(0, lengthFromNext)); + contents[i] = contents[i].slice(lengthFromNext); + lengthFromNext = 0; + break; } else { - obj[c.id] = value; - lastKey = c.id; - entries++; + buffers.push(contents[i]); + contentsIndex = i; + lengthFromNext -= l; } } - if (entries === 0) return "chunkId"; - if (entries === 1) { - return useId - ? `(chunkId === ${JSON.stringify(lastKey)} ? ${JSON.stringify( - obj[lastKey] - )} : chunkId)` - : JSON.stringify(obj[lastKey]); + if (lengthFromNext > 0) throw new Error("Unexpected end of data"); + contentItem = Buffer.concat(buffers, n); + contentItemLength = n; + contentPosition = 0; + } + }; + const readUInt32LE = () => { + ensureData(4); + const value = contentItem.readUInt32LE(contentPosition); + contentPosition += 4; + return value; + }; + const readInt32LE = () => { + ensureData(4); + const value = contentItem.readInt32LE(contentPosition); + contentPosition += 4; + return value; + }; + const readSlice = l => { + ensureData(l); + if (contentPosition === 0 && contentItemLength === l) { + const result = contentItem; + if (contentsIndex + 1 < contents.length) { + nextContent(); + } else { + contentPosition = l; } - return useId - ? `(${JSON.stringify(obj)}[chunkId] || chunkId)` - : `${JSON.stringify(obj)}[chunkId]`; - }; - - /** - * @param {function(Chunk): string | number} fn function from chunk to value - * @returns {string} code with static mapping of results of fn for including in quoted string - */ - const mapExpr = fn => { - return `" + ${createMap(fn)} + "`; - }; - - /** - * @param {function(Chunk): string | number} fn function from chunk to value - * @returns {function(number): string} function which generates code with static mapping of results of fn for including in quoted string for specific length - */ - const mapExprWithLength = fn => length => { - return `" + ${createMap(c => `${fn(c)}`.slice(0, length))} + "`; - }; - - const url = - dynamicFilename && - compilation.getPath(JSON.stringify(dynamicFilename), { - hash: `" + ${RuntimeGlobals.getFullHash}() + "`, - hashWithLength: length => - `" + ${RuntimeGlobals.getFullHash}().slice(0, ${length}) + "`, - chunk: { - id: `" + chunkId + "`, - hash: mapExpr(c => c.renderedHash), - hashWithLength: mapExprWithLength(c => c.renderedHash), - name: mapExpr(c => c.name || c.id), - contentHash: { - [contentType]: mapExpr(c => c.contentHash[contentType]) + return result; + } + const result = contentItem.slice(contentPosition, contentPosition + l); + contentPosition += l; + // we clone the buffer here to allow the original content to be garbage collected + return l * 2 < contentItem.buffer.byteLength ? Buffer.from(result) : result; + }; + const version = readUInt32LE(); + if (version !== VERSION) { + throw new Error("Invalid file version"); + } + const sectionCount = readUInt32LE(); + const lengths = []; + let lastLengthPositive = false; + for (let i = 0; i < sectionCount; i++) { + const value = readInt32LE(); + const valuePositive = value >= 0; + if (lastLengthPositive && valuePositive) { + lengths[lengths.length - 1] += value; + } else { + lengths.push(value); + lastLengthPositive = valuePositive; + } + } + const result = []; + for (let length of lengths) { + if (length < 0) { + const slice = readSlice(-length); + const size = Number(readUInt64LE(slice, 0)); + const nameBuffer = slice.slice(8); + const name = nameBuffer.toString(); + result.push( + SerializerMiddleware.createLazy( + memoize(() => deserialize(middleware, name, readFile)), + middleware, + { + name, + size }, - contentHashWithLength: { - [contentType]: mapExprWithLength(c => c.contentHash[contentType]) - } - }, - contentHashType: contentType - }); + slice + ) + ); + } else { + if (contentPosition === contentItemLength) { + nextContent(); + } else if (contentPosition !== 0) { + if (length <= contentItemLength - contentPosition) { + result.push( + Buffer.from( + contentItem.buffer, + contentItem.byteOffset + contentPosition, + length + ) + ); + contentPosition += length; + length = 0; + } else { + const l = contentItemLength - contentPosition; + result.push( + Buffer.from( + contentItem.buffer, + contentItem.byteOffset + contentPosition, + l + ) + ); + length -= l; + contentPosition = contentItemLength; + } + } else { + if (length >= contentItemLength) { + result.push(contentItem); + length -= contentItemLength; + contentPosition = contentItemLength; + } else { + result.push( + Buffer.from(contentItem.buffer, contentItem.byteOffset, length) + ); + contentPosition += length; + length = 0; + } + } + while (length > 0) { + nextContent(); + if (length >= contentItemLength) { + result.push(contentItem); + length -= contentItemLength; + contentPosition = contentItemLength; + } else { + result.push( + Buffer.from(contentItem.buffer, contentItem.byteOffset, length) + ); + contentPosition += length; + length = 0; + } + } + } + } + return result; +}; - return Template.asString([ - `// This function allow to reference ${includedChunksMessages.join( - " and " - )}`, - `${global} = ${runtimeTemplate.basicFunction( - "chunkId", +/** + * @typedef {BufferSerializableType[]} DeserializedType + * @typedef {true} SerializedType + * @extends {SerializerMiddleware} + */ +class FileMiddleware extends SerializerMiddleware { + /** + * @param {IntermediateFileSystem} fs filesystem + * @param {string | Hash} hashFunction hash function to use + */ + constructor(fs, hashFunction = "md4") { + super(); + this.fs = fs; + this._hashFunction = hashFunction; + } + /** + * @param {DeserializedType} data data + * @param {Object} context context object + * @returns {SerializedType|Promise} serialized data + */ + serialize(data, context) { + const { filename, extension = "" } = context; + return new Promise((resolve, reject) => { + mkdirp(this.fs, dirname(this.fs, filename), err => { + if (err) return reject(err); - staticUrls.size > 0 - ? [ - "// return url for filenames not based on template", - // it minimizes to `x===1?"...":x===2?"...":"..."` - Template.asString( - Array.from(staticUrls, ([url, ids]) => { - const condition = - ids.size === 1 - ? `chunkId === ${JSON.stringify(first(ids))}` - : `{${Array.from( - ids, - id => `${JSON.stringify(id)}:1` - ).join(",")}}[chunkId]`; - return `if (${condition}) return ${url};`; + // It's important that we don't touch existing files during serialization + // because serialize may read existing files (when deserializing) + const allWrittenFiles = new Set(); + const writeFile = async (name, content, size) => { + const file = name + ? join(this.fs, filename, `../${name}${extension}`) + : filename; + await new Promise((resolve, reject) => { + let stream = this.fs.createWriteStream(file + "_"); + let compression; + if (file.endsWith(".gz")) { + compression = createGzip({ + chunkSize: COMPRESSION_CHUNK_SIZE, + level: zConstants.Z_BEST_SPEED + }); + } else if (file.endsWith(".br")) { + compression = createBrotliCompress({ + chunkSize: COMPRESSION_CHUNK_SIZE, + params: { + [zConstants.BROTLI_PARAM_MODE]: zConstants.BROTLI_MODE_TEXT, + [zConstants.BROTLI_PARAM_QUALITY]: 2, + [zConstants.BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING]: true, + [zConstants.BROTLI_PARAM_SIZE_HINT]: size + } + }); + } + if (compression) { + pipeline(compression, stream, reject); + stream = compression; + stream.on("finish", () => resolve()); + } else { + stream.on("error", err => reject(err)); + stream.on("finish", () => resolve()); + } + // split into chunks for WRITE_LIMIT_CHUNK size + const chunks = []; + for (const b of content) { + if (b.length < WRITE_LIMIT_CHUNK) { + chunks.push(b); + } else { + for (let i = 0; i < b.length; i += WRITE_LIMIT_CHUNK) { + chunks.push(b.slice(i, i + WRITE_LIMIT_CHUNK)); + } + } + } + + const len = chunks.length; + let i = 0; + const batchWrite = err => { + // will be handled in "on" error handler + if (err) return; + + if (i === len) { + stream.end(); + return; + } + + // queue up a batch of chunks up to the write limit + // end is exclusive + let end = i; + let sum = chunks[end++].length; + while (end < len) { + sum += chunks[end].length; + if (sum > WRITE_LIMIT_TOTAL) break; + end++; + } + while (i < end - 1) { + stream.write(chunks[i++]); + } + stream.write(chunks[i++], batchWrite); + }; + batchWrite(); + }); + if (name) allWrittenFiles.add(file); + }; + + resolve( + serialize(this, data, false, writeFile, this._hashFunction).then( + async ({ backgroundJob }) => { + await backgroundJob; + + // Rename the index file to disallow access during inconsistent file state + await new Promise(resolve => + this.fs.rename(filename, filename + ".old", err => { + resolve(); }) - ), - "// return url for filenames based on template", - `return ${url};` - ] - : ["// return url for filenames based on template", `return ${url};`] - )};` - ]); + ); + + // update all written files + await Promise.all( + Array.from( + allWrittenFiles, + file => + new Promise((resolve, reject) => { + this.fs.rename(file + "_", file, err => { + if (err) return reject(err); + resolve(); + }); + }) + ) + ); + + // As final step automatically update the index file to have a consistent pack again + await new Promise(resolve => { + this.fs.rename(filename + "_", filename, err => { + if (err) return reject(err); + resolve(); + }); + }); + return /** @type {true} */ (true); + } + ) + ); + }); + }); + } + + /** + * @param {SerializedType} data data + * @param {Object} context context object + * @returns {DeserializedType|Promise} deserialized data + */ + deserialize(data, context) { + const { filename, extension = "" } = context; + const readFile = name => + new Promise((resolve, reject) => { + const file = name + ? join(this.fs, filename, `../${name}${extension}`) + : filename; + this.fs.stat(file, (err, stats) => { + if (err) { + reject(err); + return; + } + let remaining = /** @type {number} */ (stats.size); + let currentBuffer; + let currentBufferUsed; + const buf = []; + let decompression; + if (file.endsWith(".gz")) { + decompression = createGunzip({ + chunkSize: DECOMPRESSION_CHUNK_SIZE + }); + } else if (file.endsWith(".br")) { + decompression = createBrotliDecompress({ + chunkSize: DECOMPRESSION_CHUNK_SIZE + }); + } + if (decompression) { + let newResolve, newReject; + resolve( + Promise.all([ + new Promise((rs, rj) => { + newResolve = rs; + newReject = rj; + }), + new Promise((resolve, reject) => { + decompression.on("data", chunk => buf.push(chunk)); + decompression.on("end", () => resolve()); + decompression.on("error", err => reject(err)); + }) + ]).then(() => buf) + ); + resolve = newResolve; + reject = newReject; + } + this.fs.open(file, "r", (err, fd) => { + if (err) { + reject(err); + return; + } + const read = () => { + if (currentBuffer === undefined) { + currentBuffer = Buffer.allocUnsafeSlow( + Math.min( + constants.MAX_LENGTH, + remaining, + decompression ? DECOMPRESSION_CHUNK_SIZE : Infinity + ) + ); + currentBufferUsed = 0; + } + let readBuffer = currentBuffer; + let readOffset = currentBufferUsed; + let readLength = currentBuffer.length - currentBufferUsed; + // values passed to fs.read must be valid int32 values + if (readOffset > 0x7fffffff) { + readBuffer = currentBuffer.slice(readOffset); + readOffset = 0; + } + if (readLength > 0x7fffffff) { + readLength = 0x7fffffff; + } + this.fs.read( + fd, + readBuffer, + readOffset, + readLength, + null, + (err, bytesRead) => { + if (err) { + this.fs.close(fd, () => { + reject(err); + }); + return; + } + currentBufferUsed += bytesRead; + remaining -= bytesRead; + if (currentBufferUsed === currentBuffer.length) { + if (decompression) { + decompression.write(currentBuffer); + } else { + buf.push(currentBuffer); + } + currentBuffer = undefined; + if (remaining === 0) { + if (decompression) { + decompression.end(); + } + this.fs.close(fd, err => { + if (err) { + reject(err); + return; + } + resolve(buf); + }); + return; + } + } + read(); + } + ); + }; + read(); + }); + }); + }); + return deserialize(this, false, readFile); } } -module.exports = GetChunkFilenameRuntimeModule; +module.exports = FileMiddleware; /***/ }), -/***/ 88732: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 86791: +/***/ (function(module) { "use strict"; /* @@ -116679,35 +113335,37 @@ module.exports = GetChunkFilenameRuntimeModule; -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); - -/** @typedef {import("../Compilation")} Compilation */ - -class GetFullHashRuntimeModule extends RuntimeModule { - constructor() { - super("getFullHash"); - this.fullHash = true; +class MapObjectSerializer { + serialize(obj, { write }) { + write(obj.size); + for (const key of obj.keys()) { + write(key); + } + for (const value of obj.values()) { + write(value); + } } - - /** - * @returns {string} runtime code - */ - generate() { - const { runtimeTemplate } = this.compilation; - return `${RuntimeGlobals.getFullHash} = ${runtimeTemplate.returningFunction( - JSON.stringify(this.compilation.hash || "XXXX") - )}`; + deserialize({ read }) { + let size = read(); + const map = new Map(); + const keys = []; + for (let i = 0; i < size; i++) { + keys.push(read()); + } + for (let i = 0; i < size; i++) { + map.set(keys[i], read()); + } + return map; } } -module.exports = GetFullHashRuntimeModule; +module.exports = MapObjectSerializer; /***/ }), -/***/ 10029: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 21048: +/***/ (function(module) { "use strict"; /* @@ -116716,50 +113374,39 @@ module.exports = GetFullHashRuntimeModule; -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); - -/** @typedef {import("../Compilation")} Compilation */ - -class GetMainFilenameRuntimeModule extends RuntimeModule { - /** - * @param {string} name readable name - * @param {string} global global object binding - * @param {string} filename main file name - */ - constructor(name, global, filename) { - super(`get ${name} filename`); - this.global = global; - this.filename = filename; +class NullPrototypeObjectSerializer { + serialize(obj, { write }) { + const keys = Object.keys(obj); + for (const key of keys) { + write(key); + } + write(null); + for (const key of keys) { + write(obj[key]); + } } - - /** - * @returns {string} runtime code - */ - generate() { - const { global, filename, compilation, chunk } = this; - const { runtimeTemplate } = compilation; - const url = compilation.getPath(JSON.stringify(filename), { - hash: `" + ${RuntimeGlobals.getFullHash}() + "`, - hashWithLength: length => - `" + ${RuntimeGlobals.getFullHash}().slice(0, ${length}) + "`, - chunk, - runtime: chunk.runtime - }); - return Template.asString([ - `${global} = ${runtimeTemplate.returningFunction(url)};` - ]); + deserialize({ read }) { + const obj = Object.create(null); + const keys = []; + let key = read(); + while (key !== null) { + keys.push(key); + key = read(); + } + for (const key of keys) { + obj[key] = read(); + } + return obj; } } -module.exports = GetMainFilenameRuntimeModule; +module.exports = NullPrototypeObjectSerializer; /***/ }), -/***/ 38713: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 34795: +/***/ (function(module, exports, __webpack_require__) { "use strict"; /* @@ -116768,584 +113415,740 @@ module.exports = GetMainFilenameRuntimeModule; -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const HelperRuntimeModule = __webpack_require__(82444); +const createHash = __webpack_require__(49835); +const ArraySerializer = __webpack_require__(41721); +const DateObjectSerializer = __webpack_require__(93475); +const ErrorObjectSerializer = __webpack_require__(79479); +const MapObjectSerializer = __webpack_require__(86791); +const NullPrototypeObjectSerializer = __webpack_require__(21048); +const PlainObjectSerializer = __webpack_require__(33040); +const RegExpObjectSerializer = __webpack_require__(57328); +const SerializerMiddleware = __webpack_require__(83137); +const SetObjectSerializer = __webpack_require__(79240); -class GetTrustedTypesPolicyRuntimeModule extends HelperRuntimeModule { - /** - * @param {Set} runtimeRequirements runtime requirements - */ - constructor(runtimeRequirements) { - super("trusted types policy"); - this.runtimeRequirements = runtimeRequirements; - } +/** @typedef {typeof import("../util/Hash")} Hash */ +/** @typedef {import("./types").ComplexSerializableType} ComplexSerializableType */ +/** @typedef {import("./types").PrimitiveSerializableType} PrimitiveSerializableType */ - /** - * @returns {string} runtime code - */ - generate() { - const { compilation } = this; - const { runtimeTemplate, outputOptions } = compilation; - const { trustedTypes } = outputOptions; - const fn = RuntimeGlobals.getTrustedTypesPolicy; +/** @typedef {new (...params: any[]) => any} Constructor */ - return Template.asString([ - "var policy;", - `${fn} = ${runtimeTemplate.basicFunction("", [ - "// Create Trusted Type policy if Trusted Types are available and the policy doesn't exist yet.", - "if (policy === undefined) {", - Template.indent([ - "policy = {", - Template.indent( - [ - ...(this.runtimeRequirements.has(RuntimeGlobals.createScript) - ? [ - `createScript: ${runtimeTemplate.returningFunction( - "script", - "script" - )}` - ] - : []), - ...(this.runtimeRequirements.has(RuntimeGlobals.createScriptUrl) - ? [ - `createScriptURL: ${runtimeTemplate.returningFunction( - "url", - "url" - )}` - ] - : []) - ].join(",\n") - ), - "};", - ...(trustedTypes - ? [ - 'if (typeof trustedTypes !== "undefined" && trustedTypes.createPolicy) {', - Template.indent([ - `policy = trustedTypes.createPolicy(${JSON.stringify( - trustedTypes.policyName - )}, policy);` - ]), - "}" - ] - : []) - ]), - "}", - "return policy;" - ])};` - ]); - } -} +/* -module.exports = GetTrustedTypesPolicyRuntimeModule; +Format: +File -> Section* +Section -> ObjectSection | ReferenceSection | EscapeSection | OtherSection -/***/ }), +ObjectSection -> ESCAPE ( + number:relativeOffset (number > 0) | + string:request (string|null):export +) Section:value* ESCAPE ESCAPE_END_OBJECT +ReferenceSection -> ESCAPE number:relativeOffset (number < 0) +EscapeSection -> ESCAPE ESCAPE_ESCAPE_VALUE (escaped value ESCAPE) +EscapeSection -> ESCAPE ESCAPE_UNDEFINED (escaped value ESCAPE) +OtherSection -> any (except ESCAPE) -/***/ 23255: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +Why using null as escape value? +Multiple null values can merged by the BinaryMiddleware, which makes it very efficient +Technically any value can be used. -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php */ +/** + * @typedef {Object} ObjectSerializerContext + * @property {function(any): void} write + */ +/** + * @typedef {Object} ObjectDeserializerContext + * @property {function(): any} read + */ -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); +/** + * @typedef {Object} ObjectSerializer + * @property {function(any, ObjectSerializerContext): void} serialize + * @property {function(ObjectDeserializerContext): any} deserialize + */ -class GlobalRuntimeModule extends RuntimeModule { - constructor() { - super("global"); +const setSetSize = (set, size) => { + let i = 0; + for (const item of set) { + if (i++ >= size) { + set.delete(item); + } } +}; - /** - * @returns {string} runtime code - */ - generate() { - return Template.asString([ - `${RuntimeGlobals.global} = (function() {`, - Template.indent([ - "if (typeof globalThis === 'object') return globalThis;", - "try {", - Template.indent( - // This works in non-strict mode - // or - // This works if eval is allowed (see CSP) - "return this || new Function('return this')();" - ), - "} catch (e) {", - Template.indent( - // This works if the window reference is available - "if (typeof window === 'object') return window;" - ), - "}" - // It can still be `undefined`, but nothing to do about it... - // We return `undefined`, instead of nothing here, so it's - // easier to handle this case: - // if (!global) { … } - ]), - "})();" - ]); +const setMapSize = (map, size) => { + let i = 0; + for (const item of map.keys()) { + if (i++ >= size) { + map.delete(item); + } } -} - -module.exports = GlobalRuntimeModule; - - -/***/ }), +}; -/***/ 8011: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * @param {Buffer} buffer buffer + * @param {string | Hash} hashFunction hash function to use + * @returns {string} hash + */ +const toHash = (buffer, hashFunction) => { + const hash = createHash(hashFunction); + hash.update(buffer); + return /** @type {string} */ (hash.digest("latin1")); +}; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Sergey Melyukov @smelukov -*/ +const ESCAPE = null; +const ESCAPE_ESCAPE_VALUE = null; +const ESCAPE_END_OBJECT = true; +const ESCAPE_UNDEFINED = false; +const CURRENT_VERSION = 2; +const serializers = new Map(); +const serializerInversed = new Map(); -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); +const loadedRequests = new Set(); -class HasOwnPropertyRuntimeModule extends RuntimeModule { - constructor() { - super("hasOwnProperty shorthand"); - } +const NOT_SERIALIZABLE = {}; - /** - * @returns {string} runtime code - */ - generate() { - const { runtimeTemplate } = this.compilation; +const jsTypes = new Map(); +jsTypes.set(Object, new PlainObjectSerializer()); +jsTypes.set(Array, new ArraySerializer()); +jsTypes.set(null, new NullPrototypeObjectSerializer()); +jsTypes.set(Map, new MapObjectSerializer()); +jsTypes.set(Set, new SetObjectSerializer()); +jsTypes.set(Date, new DateObjectSerializer()); +jsTypes.set(RegExp, new RegExpObjectSerializer()); +jsTypes.set(Error, new ErrorObjectSerializer(Error)); +jsTypes.set(EvalError, new ErrorObjectSerializer(EvalError)); +jsTypes.set(RangeError, new ErrorObjectSerializer(RangeError)); +jsTypes.set(ReferenceError, new ErrorObjectSerializer(ReferenceError)); +jsTypes.set(SyntaxError, new ErrorObjectSerializer(SyntaxError)); +jsTypes.set(TypeError, new ErrorObjectSerializer(TypeError)); - return Template.asString([ - `${RuntimeGlobals.hasOwnProperty} = ${runtimeTemplate.returningFunction( - "Object.prototype.hasOwnProperty.call(obj, prop)", - "obj, prop" - )}` - ]); +// If in a sandboxed environment (e. g. jest), this escapes the sandbox and registers +// real Object and Array types to. These types may occur in the wild too, e. g. when +// using Structured Clone in postMessage. +if (exports.constructor !== Object) { + const Obj = /** @type {typeof Object} */ (exports.constructor); + const Fn = /** @type {typeof Function} */ (Obj.constructor); + for (const [type, config] of Array.from(jsTypes)) { + if (type) { + const Type = new Fn(`return ${type.name};`)(); + jsTypes.set(Type, config); + } } } -module.exports = HasOwnPropertyRuntimeModule; - - -/***/ }), - -/***/ 82444: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - - -const RuntimeModule = __webpack_require__(16963); - -class HelperRuntimeModule extends RuntimeModule { - /** - * @param {string} name a readable name - */ - constructor(name) { - super(name); +{ + let i = 1; + for (const [type, serializer] of jsTypes) { + serializers.set(type, { + request: "", + name: i++, + serializer + }); } } -module.exports = HelperRuntimeModule; - - -/***/ }), - -/***/ 19942: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - - -const { SyncWaterfallHook } = __webpack_require__(41242); -const Compilation = __webpack_require__(85720); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const HelperRuntimeModule = __webpack_require__(82444); +for (const { request, name, serializer } of serializers.values()) { + serializerInversed.set(`${request}/${name}`, serializer); +} -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compiler")} Compiler */ +/** @type {Map boolean>} */ +const loaders = new Map(); /** - * @typedef {Object} LoadScriptCompilationHooks - * @property {SyncWaterfallHook<[string, Chunk]>} createScript + * @typedef {ComplexSerializableType[]} DeserializedType + * @typedef {PrimitiveSerializableType[]} SerializedType + * @extends {SerializerMiddleware} */ - -/** @type {WeakMap} */ -const compilationHooksMap = new WeakMap(); - -class LoadScriptRuntimeModule extends HelperRuntimeModule { +class ObjectMiddleware extends SerializerMiddleware { /** - * @param {Compilation} compilation the compilation - * @returns {LoadScriptCompilationHooks} hooks + * @param {function(any): void} extendContext context extensions + * @param {string | Hash} hashFunction hash function to use */ - static getCompilationHooks(compilation) { - if (!(compilation instanceof Compilation)) { - throw new TypeError( - "The 'compilation' argument must be an instance of Compilation" - ); - } - let hooks = compilationHooksMap.get(compilation); - if (hooks === undefined) { - hooks = { - createScript: new SyncWaterfallHook(["source", "chunk"]) - }; - compilationHooksMap.set(compilation, hooks); - } - return hooks; + constructor(extendContext, hashFunction = "md4") { + super(); + this.extendContext = extendContext; + this._hashFunction = hashFunction; } - /** - * @param {boolean=} withCreateScriptUrl use create script url for trusted types + * @param {RegExp} regExp RegExp for which the request is tested + * @param {function(string): boolean} loader loader to load the request, returns true when successful + * @returns {void} */ - constructor(withCreateScriptUrl) { - super("load script"); - this._withCreateScriptUrl = withCreateScriptUrl; + static registerLoader(regExp, loader) { + loaders.set(regExp, loader); } /** - * @returns {string} runtime code + * @param {Constructor} Constructor the constructor + * @param {string} request the request which will be required when deserializing + * @param {string} name the name to make multiple serializer unique when sharing a request + * @param {ObjectSerializer} serializer the serializer + * @returns {void} */ - generate() { - const { compilation } = this; - const { runtimeTemplate, outputOptions } = compilation; - const { - scriptType, - chunkLoadTimeout: loadTimeout, - crossOriginLoading, - uniqueName, - charset - } = outputOptions; - const fn = RuntimeGlobals.loadScript; + static register(Constructor, request, name, serializer) { + const key = request + "/" + name; - const { createScript } = - LoadScriptRuntimeModule.getCompilationHooks(compilation); + if (serializers.has(Constructor)) { + throw new Error( + `ObjectMiddleware.register: serializer for ${Constructor.name} is already registered` + ); + } - const code = Template.asString([ - "script = document.createElement('script');", - scriptType ? `script.type = ${JSON.stringify(scriptType)};` : "", - charset ? "script.charset = 'utf-8';" : "", - `script.timeout = ${loadTimeout / 1000};`, - `if (${RuntimeGlobals.scriptNonce}) {`, - Template.indent( - `script.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});` - ), - "}", - uniqueName - ? 'script.setAttribute("data-webpack", dataWebpackPrefix + key);' - : "", - `script.src = ${ - this._withCreateScriptUrl - ? `${RuntimeGlobals.createScriptUrl}(url)` - : "url" - };`, - crossOriginLoading - ? Template.asString([ - "if (script.src.indexOf(window.location.origin + '/') !== 0) {", - Template.indent( - `script.crossOrigin = ${JSON.stringify(crossOriginLoading)};` - ), - "}" - ]) - : "" - ]); + if (serializerInversed.has(key)) { + throw new Error( + `ObjectMiddleware.register: serializer for ${key} is already registered` + ); + } - return Template.asString([ - "var inProgress = {};", - uniqueName - ? `var dataWebpackPrefix = ${JSON.stringify(uniqueName + ":")};` - : "// data-webpack is not used as build has no uniqueName", - "// loadScript function to load a script via script tag", - `${fn} = ${runtimeTemplate.basicFunction("url, done, key, chunkId", [ - "if(inProgress[url]) { inProgress[url].push(done); return; }", - "var script, needAttach;", - "if(key !== undefined) {", - Template.indent([ - 'var scripts = document.getElementsByTagName("script");', - "for(var i = 0; i < scripts.length; i++) {", - Template.indent([ - "var s = scripts[i];", - `if(s.getAttribute("src") == url${ - uniqueName - ? ' || s.getAttribute("data-webpack") == dataWebpackPrefix + key' - : "" - }) { script = s; break; }` - ]), - "}" - ]), - "}", - "if(!script) {", - Template.indent([ - "needAttach = true;", - createScript.call(code, this.chunk) - ]), - "}", - "inProgress[url] = [done];", - "var onScriptComplete = " + - runtimeTemplate.basicFunction( - "prev, event", - Template.asString([ - "// avoid mem leaks in IE.", - "script.onerror = script.onload = null;", - "clearTimeout(timeout);", - "var doneFns = inProgress[url];", - "delete inProgress[url];", - "script.parentNode && script.parentNode.removeChild(script);", - `doneFns && doneFns.forEach(${runtimeTemplate.returningFunction( - "fn(event)", - "fn" - )});`, - "if(prev) return prev(event);" - ]) - ), - ";", - `var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), ${loadTimeout});`, - "script.onerror = onScriptComplete.bind(null, script.onerror);", - "script.onload = onScriptComplete.bind(null, script.onload);", - "needAttach && document.head.appendChild(script);" - ])};` - ]); + serializers.set(Constructor, { + request, + name, + serializer + }); + + serializerInversed.set(key, serializer); } -} -module.exports = LoadScriptRuntimeModule; + /** + * @param {Constructor} Constructor the constructor + * @returns {void} + */ + static registerNotSerializable(Constructor) { + if (serializers.has(Constructor)) { + throw new Error( + `ObjectMiddleware.registerNotSerializable: serializer for ${Constructor.name} is already registered` + ); + } + serializers.set(Constructor, NOT_SERIALIZABLE); + } -/***/ }), + static getSerializerFor(object) { + const proto = Object.getPrototypeOf(object); + let c; + if (proto === null) { + // Object created with Object.create(null) + c = null; + } else { + c = proto.constructor; + if (!c) { + throw new Error( + "Serialization of objects with prototype without valid constructor property not possible" + ); + } + } + const config = serializers.get(c); -/***/ 65714: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (!config) throw new Error(`No serializer registered for ${c.name}`); + if (config === NOT_SERIALIZABLE) throw NOT_SERIALIZABLE; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + return config; + } + static getDeserializerFor(request, name) { + const key = request + "/" + name; + const serializer = serializerInversed.get(key); + if (serializer === undefined) { + throw new Error(`No deserializer registered for ${key}`); + } -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const HelperRuntimeModule = __webpack_require__(82444); + return serializer; + } -class MakeNamespaceObjectRuntimeModule extends HelperRuntimeModule { - constructor() { - super("make namespace object"); + static _getDeserializerForWithoutError(request, name) { + const key = request + "/" + name; + const serializer = serializerInversed.get(key); + return serializer; } /** - * @returns {string} runtime code + * @param {DeserializedType} data data + * @param {Object} context context object + * @returns {SerializedType|Promise} serialized data */ - generate() { - const { runtimeTemplate } = this.compilation; - const fn = RuntimeGlobals.makeNamespaceObject; - return Template.asString([ - "// define __esModule on exports", - `${fn} = ${runtimeTemplate.basicFunction("exports", [ - "if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {", - Template.indent([ - "Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });" - ]), - "}", - "Object.defineProperty(exports, '__esModule', { value: true });" - ])};` - ]); - } -} + serialize(data, context) { + /** @type {any[]} */ + let result = [CURRENT_VERSION]; + let currentPos = 0; + let referenceable = new Map(); + const addReferenceable = item => { + referenceable.set(item, currentPos++); + }; + let bufferDedupeMap = new Map(); + const dedupeBuffer = buf => { + const len = buf.length; + const entry = bufferDedupeMap.get(len); + if (entry === undefined) { + bufferDedupeMap.set(len, buf); + return buf; + } + if (Buffer.isBuffer(entry)) { + if (len < 32) { + if (buf.equals(entry)) { + return entry; + } + bufferDedupeMap.set(len, [entry, buf]); + return buf; + } else { + const hash = toHash(entry, this._hashFunction); + const newMap = new Map(); + newMap.set(hash, entry); + bufferDedupeMap.set(len, newMap); + const hashBuf = toHash(buf, this._hashFunction); + if (hash === hashBuf) { + return entry; + } + return buf; + } + } else if (Array.isArray(entry)) { + if (entry.length < 16) { + for (const item of entry) { + if (buf.equals(item)) { + return item; + } + } + entry.push(buf); + return buf; + } else { + const newMap = new Map(); + const hash = toHash(buf, this._hashFunction); + let found; + for (const item of entry) { + const itemHash = toHash(item, this._hashFunction); + newMap.set(itemHash, item); + if (found === undefined && itemHash === hash) found = item; + } + bufferDedupeMap.set(len, newMap); + if (found === undefined) { + newMap.set(hash, buf); + return buf; + } else { + return found; + } + } + } else { + const hash = toHash(buf, this._hashFunction); + const item = entry.get(hash); + if (item !== undefined) { + return item; + } + entry.set(hash, buf); + return buf; + } + }; + let currentPosTypeLookup = 0; + let objectTypeLookup = new Map(); + const cycleStack = new Set(); + const stackToString = item => { + const arr = Array.from(cycleStack); + arr.push(item); + return arr + .map(item => { + if (typeof item === "string") { + if (item.length > 100) { + return `String ${JSON.stringify(item.slice(0, 100)).slice( + 0, + -1 + )}..."`; + } + return `String ${JSON.stringify(item)}`; + } + try { + const { request, name } = ObjectMiddleware.getSerializerFor(item); + if (request) { + return `${request}${name ? `.${name}` : ""}`; + } + } catch (e) { + // ignore -> fallback + } + if (typeof item === "object" && item !== null) { + if (item.constructor) { + if (item.constructor === Object) + return `Object { ${Object.keys(item).join(", ")} }`; + if (item.constructor === Map) return `Map { ${item.size} items }`; + if (item.constructor === Array) + return `Array { ${item.length} items }`; + if (item.constructor === Set) return `Set { ${item.size} items }`; + if (item.constructor === RegExp) return item.toString(); + return `${item.constructor.name}`; + } + return `Object [null prototype] { ${Object.keys(item).join( + ", " + )} }`; + } + try { + return `${item}`; + } catch (e) { + return `(${e.message})`; + } + }) + .join(" -> "); + }; + let hasDebugInfoAttached; + let ctx = { + write(value, key) { + try { + process(value); + } catch (e) { + if (e !== NOT_SERIALIZABLE) { + if (hasDebugInfoAttached === undefined) + hasDebugInfoAttached = new WeakSet(); + if (!hasDebugInfoAttached.has(e)) { + e.message += `\nwhile serializing ${stackToString(value)}`; + hasDebugInfoAttached.add(e); + } + } + throw e; + } + }, + setCircularReference(ref) { + addReferenceable(ref); + }, + snapshot() { + return { + length: result.length, + cycleStackSize: cycleStack.size, + referenceableSize: referenceable.size, + currentPos, + objectTypeLookupSize: objectTypeLookup.size, + currentPosTypeLookup + }; + }, + rollback(snapshot) { + result.length = snapshot.length; + setSetSize(cycleStack, snapshot.cycleStackSize); + setMapSize(referenceable, snapshot.referenceableSize); + currentPos = snapshot.currentPos; + setMapSize(objectTypeLookup, snapshot.objectTypeLookupSize); + currentPosTypeLookup = snapshot.currentPosTypeLookup; + }, + ...context + }; + this.extendContext(ctx); + const process = item => { + if (Buffer.isBuffer(item)) { + // check if we can emit a reference + const ref = referenceable.get(item); + if (ref !== undefined) { + result.push(ESCAPE, ref - currentPos); + return; + } + const alreadyUsedBuffer = dedupeBuffer(item); + if (alreadyUsedBuffer !== item) { + const ref = referenceable.get(alreadyUsedBuffer); + if (ref !== undefined) { + referenceable.set(item, ref); + result.push(ESCAPE, ref - currentPos); + return; + } + item = alreadyUsedBuffer; + } + addReferenceable(item); -module.exports = MakeNamespaceObjectRuntimeModule; + result.push(item); + } else if (item === ESCAPE) { + result.push(ESCAPE, ESCAPE_ESCAPE_VALUE); + } else if ( + typeof item === "object" + // We don't have to check for null as ESCAPE is null and this has been checked before + ) { + // check if we can emit a reference + const ref = referenceable.get(item); + if (ref !== undefined) { + result.push(ESCAPE, ref - currentPos); + return; + } + if (cycleStack.has(item)) { + throw new Error( + `This is a circular references. To serialize circular references use 'setCircularReference' somewhere in the circle during serialize and deserialize.` + ); + } -/***/ }), + const { request, name, serializer } = + ObjectMiddleware.getSerializerFor(item); + const key = `${request}/${name}`; + const lastIndex = objectTypeLookup.get(key); -/***/ 44518: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (lastIndex === undefined) { + objectTypeLookup.set(key, currentPosTypeLookup++); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + result.push(ESCAPE, request, name); + } else { + result.push(ESCAPE, currentPosTypeLookup - lastIndex); + } + cycleStack.add(item); + try { + serializer.serialize(item, ctx); + } finally { + cycleStack.delete(item); + } -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); + result.push(ESCAPE, ESCAPE_END_OBJECT); -class OnChunksLoadedRuntimeModule extends RuntimeModule { - constructor() { - super("chunk loaded"); - } + addReferenceable(item); + } else if (typeof item === "string") { + if (item.length > 1) { + // short strings are shorter when not emitting a reference (this saves 1 byte per empty string) + // check if we can emit a reference + const ref = referenceable.get(item); + if (ref !== undefined) { + result.push(ESCAPE, ref - currentPos); + return; + } + addReferenceable(item); + } - /** - * @returns {string} runtime code - */ - generate() { - const { compilation } = this; - const { runtimeTemplate } = compilation; - return Template.asString([ - "var deferred = [];", - `${RuntimeGlobals.onChunksLoaded} = ${runtimeTemplate.basicFunction( - "result, chunkIds, fn, priority", - [ - "if(chunkIds) {", - Template.indent([ - "priority = priority || 0;", - "for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];", - "deferred[i] = [chunkIds, fn, priority];", - "return;" - ]), - "}", - "var notFulfilled = Infinity;", - "for (var i = 0; i < deferred.length; i++) {", - Template.indent([ - runtimeTemplate.destructureArray( - ["chunkIds", "fn", "priority"], - "deferred[i]" - ), - "var fulfilled = true;", - "for (var j = 0; j < chunkIds.length; j++) {", - Template.indent([ - `if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(${ - RuntimeGlobals.onChunksLoaded - }).every(${runtimeTemplate.returningFunction( - `${RuntimeGlobals.onChunksLoaded}[key](chunkIds[j])`, - "key" - )})) {`, - Template.indent(["chunkIds.splice(j--, 1);"]), - "} else {", - Template.indent([ - "fulfilled = false;", - "if(priority < notFulfilled) notFulfilled = priority;" - ]), - "}" - ]), - "}", - "if(fulfilled) {", - Template.indent([ - "deferred.splice(i--, 1)", - "var r = fn();", - "if (r !== undefined) result = r;" - ]), - "}" - ]), - "}", - "return result;" - ] - )};` - ]); - } -} + if (item.length > 102400 && context.logger) { + context.logger.warn( + `Serializing big strings (${Math.round( + item.length / 1024 + )}kiB) impacts deserialization performance (consider using Buffer instead and decode when needed)` + ); + } -module.exports = OnChunksLoadedRuntimeModule; + result.push(item); + } else if (typeof item === "function") { + if (!SerializerMiddleware.isLazy(item)) + throw new Error("Unexpected function " + item); + /** @type {SerializedType} */ + const serializedData = + SerializerMiddleware.getLazySerializedValue(item); + if (serializedData !== undefined) { + if (typeof serializedData === "function") { + result.push(serializedData); + } else { + throw new Error("Not implemented"); + } + } else if (SerializerMiddleware.isLazy(item, this)) { + throw new Error("Not implemented"); + } else { + const data = SerializerMiddleware.serializeLazy(item, data => + this.serialize([data], context) + ); + SerializerMiddleware.setLazySerializedValue(item, data); + result.push(data); + } + } else if (item === undefined) { + result.push(ESCAPE, ESCAPE_UNDEFINED); + } else { + result.push(item); + } + }; + try { + for (const item of data) { + process(item); + } + return result; + } catch (e) { + if (e === NOT_SERIALIZABLE) return null; -/***/ }), + throw e; + } finally { + // Get rid of these references to avoid leaking memory + // This happens because the optimized code v8 generates + // is optimized for our "ctx.write" method so it will reference + // it from e. g. Dependency.prototype.serialize -(IC)-> ctx.write + data = + result = + referenceable = + bufferDedupeMap = + objectTypeLookup = + ctx = + undefined; + } + } -/***/ 56030: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * @param {SerializedType} data data + * @param {Object} context context object + * @returns {DeserializedType|Promise} deserialized data + */ + deserialize(data, context) { + let currentDataPos = 0; + const read = () => { + if (currentDataPos >= data.length) + throw new Error("Unexpected end of stream"); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + return data[currentDataPos++]; + }; + if (read() !== CURRENT_VERSION) + throw new Error("Version mismatch, serializer changed"); + let currentPos = 0; + let referenceable = []; + const addReferenceable = item => { + referenceable.push(item); + currentPos++; + }; + let currentPosTypeLookup = 0; + let objectTypeLookup = []; + let result = []; + let ctx = { + read() { + return decodeValue(); + }, + setCircularReference(ref) { + addReferenceable(ref); + }, + ...context + }; + this.extendContext(ctx); + const decodeValue = () => { + const item = read(); -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); + if (item === ESCAPE) { + const nextItem = read(); -class PublicPathRuntimeModule extends RuntimeModule { - constructor(publicPath) { - super("publicPath", RuntimeModule.STAGE_BASIC); - this.publicPath = publicPath; - } + if (nextItem === ESCAPE_ESCAPE_VALUE) { + return ESCAPE; + } else if (nextItem === ESCAPE_UNDEFINED) { + return undefined; + } else if (nextItem === ESCAPE_END_OBJECT) { + throw new Error( + `Unexpected end of object at position ${currentDataPos - 1}` + ); + } else { + const request = nextItem; + let serializer; - /** - * @returns {string} runtime code - */ - generate() { - const { compilation, publicPath } = this; + if (typeof request === "number") { + if (request < 0) { + // relative reference + return referenceable[currentPos + request]; + } + serializer = objectTypeLookup[currentPosTypeLookup - request]; + } else { + if (typeof request !== "string") { + throw new Error( + `Unexpected type (${typeof request}) of request ` + + `at position ${currentDataPos - 1}` + ); + } + const name = read(); - return `${RuntimeGlobals.publicPath} = ${JSON.stringify( - compilation.getPath(publicPath || "", { - hash: compilation.hash || "XXXX" - }) - )};`; - } -} + serializer = ObjectMiddleware._getDeserializerForWithoutError( + request, + name + ); -module.exports = PublicPathRuntimeModule; + if (serializer === undefined) { + if (request && !loadedRequests.has(request)) { + let loaded = false; + for (const [regExp, loader] of loaders) { + if (regExp.test(request)) { + if (loader(request)) { + loaded = true; + break; + } + } + } + if (!loaded) { + require(request); + } + loadedRequests.add(request); + } -/***/ }), + serializer = ObjectMiddleware.getDeserializerFor(request, name); + } -/***/ 4537: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + objectTypeLookup.push(serializer); + currentPosTypeLookup++; + } + try { + const item = serializer.deserialize(ctx); + const end1 = read(); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + if (end1 !== ESCAPE) { + throw new Error("Expected end of object"); + } + const end2 = read(); + if (end2 !== ESCAPE_END_OBJECT) { + throw new Error("Expected end of object"); + } -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const HelperRuntimeModule = __webpack_require__(82444); + addReferenceable(item); -class RelativeUrlRuntimeModule extends HelperRuntimeModule { - constructor() { - super("relative url"); - } + return item; + } catch (err) { + // As this is only for error handling, we omit creating a Map for + // faster access to this information, as this would affect performance + // in the good case + let serializerEntry; + for (const entry of serializers) { + if (entry[1].serializer === serializer) { + serializerEntry = entry; + break; + } + } + const name = !serializerEntry + ? "unknown" + : !serializerEntry[1].request + ? serializerEntry[0].name + : serializerEntry[1].name + ? `${serializerEntry[1].request} ${serializerEntry[1].name}` + : serializerEntry[1].request; + err.message += `\n(during deserialization of ${name})`; + throw err; + } + } + } else if (typeof item === "string") { + if (item.length > 1) { + addReferenceable(item); + } - /** - * @returns {string} runtime code - */ - generate() { - const { runtimeTemplate } = this.compilation; - return Template.asString([ - `${RuntimeGlobals.relativeUrl} = function RelativeURL(url) {`, - Template.indent([ - 'var realUrl = new URL(url, "x:/");', - "var values = {};", - "for (var key in realUrl) values[key] = realUrl[key];", - "values.href = url;", - 'values.pathname = url.replace(/[?#].*/, "");', - 'values.origin = values.protocol = "";', - `values.toString = values.toJSON = ${runtimeTemplate.returningFunction( - "url" - )};`, - "for (var key in values) Object.defineProperty(this, key, { enumerable: true, configurable: true, value: values[key] });" - ]), - "};", - `${RuntimeGlobals.relativeUrl}.prototype = URL.prototype;` - ]); + return item; + } else if (Buffer.isBuffer(item)) { + addReferenceable(item); + + return item; + } else if (typeof item === "function") { + return SerializerMiddleware.deserializeLazy( + item, + data => this.deserialize(data, context)[0] + ); + } else { + return item; + } + }; + + try { + while (currentDataPos < data.length) { + result.push(decodeValue()); + } + return result; + } finally { + // Get rid of these references to avoid leaking memory + // This happens because the optimized code v8 generates + // is optimized for our "ctx.read" method so it will reference + // it from e. g. Dependency.prototype.deserialize -(IC)-> ctx.read + result = referenceable = data = objectTypeLookup = ctx = undefined; + } } } -module.exports = RelativeUrlRuntimeModule; +module.exports = ObjectMiddleware; +module.exports.NOT_SERIALIZABLE = NOT_SERIALIZABLE; /***/ }), -/***/ 97115: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 33040: +/***/ (function(module) { "use strict"; /* @@ -117354,191 +114157,111 @@ module.exports = RelativeUrlRuntimeModule; -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); +const cache = new WeakMap(); -class RuntimeIdRuntimeModule extends RuntimeModule { +class ObjectStructure { constructor() { - super("runtimeId"); + this.keys = undefined; + this.children = undefined; } - /** - * @returns {string} runtime code - */ - generate() { - const { chunkGraph, chunk } = this; - const runtime = chunk.runtime; - if (typeof runtime !== "string") - throw new Error("RuntimeIdRuntimeModule must be in a single runtime"); - const id = chunkGraph.getRuntimeId(runtime); - return `${RuntimeGlobals.runtimeId} = ${JSON.stringify(id)};`; + getKeys(keys) { + if (this.keys === undefined) this.keys = keys; + return this.keys; } -} - -module.exports = RuntimeIdRuntimeModule; - - -/***/ }), - -/***/ 22339: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - + key(key) { + if (this.children === undefined) this.children = new Map(); + const child = this.children.get(key); + if (child !== undefined) return child; + const newChild = new ObjectStructure(); + this.children.set(key, newChild); + return newChild; + } +} -const RuntimeGlobals = __webpack_require__(16475); -const StartupChunkDependenciesRuntimeModule = __webpack_require__(38157); -const StartupEntrypointRuntimeModule = __webpack_require__(97672); - -/** @typedef {import("../Compiler")} Compiler */ - -class StartupChunkDependenciesPlugin { - constructor(options) { - this.chunkLoading = options.chunkLoading; - this.asyncChunkLoading = - typeof options.asyncChunkLoading === "boolean" - ? options.asyncChunkLoading - : true; +const getCachedKeys = (keys, cacheAssoc) => { + let root = cache.get(cacheAssoc); + if (root === undefined) { + root = new ObjectStructure(); + cache.set(cacheAssoc, root); + } + let current = root; + for (const key of keys) { + current = current.key(key); } + return current.getKeys(keys); +}; - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - "StartupChunkDependenciesPlugin", - compilation => { - const globalChunkLoading = compilation.outputOptions.chunkLoading; - const isEnabledForChunk = chunk => { - const options = chunk.getEntryOptions(); - const chunkLoading = - options && options.chunkLoading !== undefined - ? options.chunkLoading - : globalChunkLoading; - return chunkLoading === this.chunkLoading; - }; - compilation.hooks.additionalTreeRuntimeRequirements.tap( - "StartupChunkDependenciesPlugin", - (chunk, set, { chunkGraph }) => { - if (!isEnabledForChunk(chunk)) return; - if (chunkGraph.hasChunkEntryDependentChunks(chunk)) { - set.add(RuntimeGlobals.startup); - set.add(RuntimeGlobals.ensureChunk); - set.add(RuntimeGlobals.ensureChunkIncludeEntries); - compilation.addRuntimeModule( - chunk, - new StartupChunkDependenciesRuntimeModule( - this.asyncChunkLoading - ) - ); - } - } - ); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.startupEntrypoint) - .tap("StartupChunkDependenciesPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.require); - set.add(RuntimeGlobals.ensureChunk); - set.add(RuntimeGlobals.ensureChunkIncludeEntries); - compilation.addRuntimeModule( - chunk, - new StartupEntrypointRuntimeModule(this.asyncChunkLoading) - ); - }); +class PlainObjectSerializer { + serialize(obj, { write }) { + const keys = Object.keys(obj); + if (keys.length > 128) { + // Objects with so many keys are unlikely to share structure + // with other objects + write(keys); + for (const key of keys) { + write(obj[key]); } - ); + } else if (keys.length > 1) { + write(getCachedKeys(keys, write)); + for (const key of keys) { + write(obj[key]); + } + } else if (keys.length === 1) { + const key = keys[0]; + write(key); + write(obj[key]); + } else { + write(null); + } + } + deserialize({ read }) { + const keys = read(); + const obj = {}; + if (Array.isArray(keys)) { + for (const key of keys) { + obj[key] = read(); + } + } else if (keys !== null) { + obj[keys] = read(); + } + return obj; } } -module.exports = StartupChunkDependenciesPlugin; +module.exports = PlainObjectSerializer; /***/ }), -/***/ 38157: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 57328: +/***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); - -class StartupChunkDependenciesRuntimeModule extends RuntimeModule { - constructor(asyncChunkLoading) { - super("startup chunk dependencies", RuntimeModule.STAGE_TRIGGER); - this.asyncChunkLoading = asyncChunkLoading; +class RegExpObjectSerializer { + serialize(obj, { write }) { + write(obj.source); + write(obj.flags); } - - /** - * @returns {string} runtime code - */ - generate() { - const { chunkGraph, chunk, compilation } = this; - const { runtimeTemplate } = compilation; - const chunkIds = Array.from( - chunkGraph.getChunkEntryDependentChunksIterable(chunk) - ).map(chunk => { - return chunk.id; - }); - return Template.asString([ - `var next = ${RuntimeGlobals.startup};`, - `${RuntimeGlobals.startup} = ${runtimeTemplate.basicFunction( - "", - !this.asyncChunkLoading - ? chunkIds - .map( - id => `${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)});` - ) - .concat("return next();") - : chunkIds.length === 1 - ? `return ${RuntimeGlobals.ensureChunk}(${JSON.stringify( - chunkIds[0] - )}).then(next);` - : chunkIds.length > 2 - ? [ - // using map is shorter for 3 or more chunks - `return Promise.all(${JSON.stringify(chunkIds)}.map(${ - RuntimeGlobals.ensureChunk - }, __webpack_require__)).then(next);` - ] - : [ - // calling ensureChunk directly is shorter for 0 - 2 chunks - "return Promise.all([", - Template.indent( - chunkIds - .map( - id => `${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)})` - ) - .join(",\n") - ), - "]).then(next);" - ] - )};` - ]); + deserialize({ read }) { + return new RegExp(read(), read()); } } -module.exports = StartupChunkDependenciesRuntimeModule; +module.exports = RegExpObjectSerializer; /***/ }), -/***/ 97672: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 53080: +/***/ (function(module) { "use strict"; /* @@ -117547,55 +114270,51 @@ module.exports = StartupChunkDependenciesRuntimeModule; -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); - -/** @typedef {import("../MainTemplate")} MainTemplate */ +class Serializer { + constructor(middlewares, context) { + this.serializeMiddlewares = middlewares.slice(); + this.deserializeMiddlewares = middlewares.slice().reverse(); + this.context = context; + } -class StartupEntrypointRuntimeModule extends RuntimeModule { - constructor(asyncChunkLoading) { - super("startup entrypoint"); - this.asyncChunkLoading = asyncChunkLoading; + serialize(obj, context) { + const ctx = { ...context, ...this.context }; + let current = obj; + for (const middleware of this.serializeMiddlewares) { + if (current && typeof current.then === "function") { + current = current.then(data => data && middleware.serialize(data, ctx)); + } else if (current) { + try { + current = middleware.serialize(current, ctx); + } catch (err) { + current = Promise.reject(err); + } + } else break; + } + return current; } - /** - * @returns {string} runtime code - */ - generate() { - const { compilation } = this; - const { runtimeTemplate } = compilation; - return `${ - RuntimeGlobals.startupEntrypoint - } = ${runtimeTemplate.basicFunction("result, chunkIds, fn", [ - "// arguments: chunkIds, moduleId are deprecated", - "var moduleId = chunkIds;", - `if(!fn) chunkIds = result, fn = ${runtimeTemplate.returningFunction( - `__webpack_require__(${RuntimeGlobals.entryModuleId} = moduleId)` - )};`, - ...(this.asyncChunkLoading - ? [ - `return Promise.all(chunkIds.map(${ - RuntimeGlobals.ensureChunk - }, __webpack_require__)).then(${runtimeTemplate.basicFunction("", [ - "var r = fn();", - "return r === undefined ? result : r;" - ])})` - ] - : [ - `chunkIds.map(${RuntimeGlobals.ensureChunk}, __webpack_require__)`, - "var r = fn();", - "return r === undefined ? result : r;" - ]) - ])}`; + deserialize(value, context) { + const ctx = { ...context, ...this.context }; + /** @type {any} */ + let current = value; + for (const middleware of this.deserializeMiddlewares) { + if (current && typeof current.then === "function") { + current = current.then(data => middleware.deserialize(data, ctx)); + } else { + current = middleware.deserialize(current, ctx); + } + } + return current; } } -module.exports = StartupEntrypointRuntimeModule; +module.exports = Serializer; /***/ }), -/***/ 80655: +/***/ 83137: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -117605,151 +114324,232 @@ module.exports = StartupEntrypointRuntimeModule; -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); +const memoize = __webpack_require__(78676); -/** @typedef {import("../Compilation")} Compilation */ +const LAZY_TARGET = Symbol("lazy serialization target"); +const LAZY_SERIALIZED_VALUE = Symbol("lazy serialization data"); -class SystemContextRuntimeModule extends RuntimeModule { - constructor() { - super("__system_context__"); +/** + * @template DeserializedType + * @template SerializedType + */ +class SerializerMiddleware { + /* istanbul ignore next */ + /** + * @abstract + * @param {DeserializedType} data data + * @param {Object} context context object + * @returns {SerializedType|Promise} serialized data + */ + serialize(data, context) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } + /* istanbul ignore next */ /** - * @returns {string} runtime code + * @abstract + * @param {SerializedType} data data + * @param {Object} context context object + * @returns {DeserializedType|Promise} deserialized data */ - generate() { - return `${RuntimeGlobals.systemContext} = __system_context__;`; + deserialize(data, context) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } -} - -module.exports = SystemContextRuntimeModule; - - -/***/ }), - -/***/ 64820: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - + /** + * @param {any | function(): Promise | any} value contained value or function to value + * @param {SerializerMiddleware} target target middleware + * @param {object=} options lazy options + * @param {any=} serializedValue serialized value + * @returns {function(): Promise | any} lazy function + */ + static createLazy(value, target, options = {}, serializedValue) { + if (SerializerMiddleware.isLazy(value, target)) return value; + const fn = typeof value === "function" ? value : () => value; + fn[LAZY_TARGET] = target; + /** @type {any} */ (fn).options = options; + fn[LAZY_SERIALIZED_VALUE] = serializedValue; + return fn; + } -const NormalModule = __webpack_require__(39); - -/** @typedef {import("../Compiler")} Compiler */ - -// data URL scheme: "data:text/javascript;charset=utf-8;base64,some-string" -// http://www.ietf.org/rfc/rfc2397.txt -const URIRegEx = /^data:([^;,]+)?((?:;[^;,]+)*?)(?:;(base64))?,(.*)$/i; - -const decodeDataURI = uri => { - const match = URIRegEx.exec(uri); - if (!match) return null; + /** + * @param {function(): Promise | any} fn lazy function + * @param {SerializerMiddleware=} target target middleware + * @returns {boolean} true, when fn is a lazy function (optionally of that target) + */ + static isLazy(fn, target) { + if (typeof fn !== "function") return false; + const t = fn[LAZY_TARGET]; + return target ? t === target : !!t; + } - const isBase64 = match[3]; - const body = match[4]; - return isBase64 - ? Buffer.from(body, "base64") - : Buffer.from(decodeURIComponent(body), "ascii"); -}; + /** + * @param {function(): Promise | any} fn lazy function + * @returns {object} options + */ + static getLazyOptions(fn) { + if (typeof fn !== "function") return undefined; + return /** @type {any} */ (fn).options; + } -class DataUriPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {function(): Promise | any} fn lazy function + * @returns {any} serialized value */ - apply(compiler) { - compiler.hooks.compilation.tap( - "DataUriPlugin", - (compilation, { normalModuleFactory }) => { - normalModuleFactory.hooks.resolveForScheme - .for("data") - .tap("DataUriPlugin", resourceData => { - const match = URIRegEx.exec(resourceData.resource); - if (match) { - resourceData.data.mimetype = match[1] || ""; - resourceData.data.parameters = match[2] || ""; - resourceData.data.encoding = match[3] || false; - resourceData.data.encodedContent = match[4] || ""; - } - }); - NormalModule.getCompilationHooks(compilation) - .readResourceForScheme.for("data") - .tap("DataUriPlugin", resource => decodeDataURI(resource)); - } - ); + static getLazySerializedValue(fn) { + if (typeof fn !== "function") return undefined; + return fn[LAZY_SERIALIZED_VALUE]; } -} -module.exports = DataUriPlugin; + /** + * @param {function(): Promise | any} fn lazy function + * @param {any} value serialized value + * @returns {void} + */ + static setLazySerializedValue(fn, value) { + fn[LAZY_SERIALIZED_VALUE] = value; + } + + /** + * @param {function(): Promise | any} lazy lazy function + * @param {function(any): Promise | any} serialize serialize function + * @returns {function(): Promise | any} new lazy + */ + static serializeLazy(lazy, serialize) { + const fn = memoize(() => { + const r = lazy(); + if (r && typeof r.then === "function") { + return r.then(data => data && serialize(data)); + } + return serialize(r); + }); + fn[LAZY_TARGET] = lazy[LAZY_TARGET]; + /** @type {any} */ (fn).options = /** @type {any} */ (lazy).options; + lazy[LAZY_SERIALIZED_VALUE] = fn; + return fn; + } + + /** + * @param {function(): Promise | any} lazy lazy function + * @param {function(any): Promise | any} deserialize deserialize function + * @returns {function(): Promise | any} new lazy + */ + static deserializeLazy(lazy, deserialize) { + const fn = memoize(() => { + const r = lazy(); + if (r && typeof r.then === "function") { + return r.then(data => deserialize(data)); + } + return deserialize(r); + }); + fn[LAZY_TARGET] = lazy[LAZY_TARGET]; + /** @type {any} */ (fn).options = /** @type {any} */ (lazy).options; + fn[LAZY_SERIALIZED_VALUE] = lazy; + return fn; + } + + /** + * @param {function(): Promise | any} lazy lazy function + * @returns {function(): Promise | any} new lazy + */ + static unMemoizeLazy(lazy) { + if (!SerializerMiddleware.isLazy(lazy)) return lazy; + const fn = () => { + throw new Error( + "A lazy value that has been unmemorized can't be called again" + ); + }; + fn[LAZY_SERIALIZED_VALUE] = SerializerMiddleware.unMemoizeLazy( + lazy[LAZY_SERIALIZED_VALUE] + ); + fn[LAZY_TARGET] = lazy[LAZY_TARGET]; + fn.options = /** @type {any} */ (lazy).options; + return fn; + } +} + +module.exports = SerializerMiddleware; /***/ }), -/***/ 57637: +/***/ 79240: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +class SetObjectSerializer { + serialize(obj, { write }) { + write(obj.size); + for (const value of obj) { + write(value); + } + } + deserialize({ read }) { + let size = read(); + const set = new Set(); + for (let i = 0; i < size; i++) { + set.add(read()); + } + return set; + } +} + +module.exports = SetObjectSerializer; + + +/***/ }), + +/***/ 65112: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const { URL, fileURLToPath } = __webpack_require__(57310); -const { NormalModule } = __webpack_require__(91919); +const SerializerMiddleware = __webpack_require__(83137); -/** @typedef {import("../Compiler")} Compiler */ +/** + * @typedef {any} DeserializedType + * @typedef {any[]} SerializedType + * @extends {SerializerMiddleware} + */ +class SingleItemMiddleware extends SerializerMiddleware { + /** + * @param {DeserializedType} data data + * @param {Object} context context object + * @returns {SerializedType|Promise} serialized data + */ + serialize(data, context) { + return [data]; + } -class FileUriPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {SerializedType} data data + * @param {Object} context context object + * @returns {DeserializedType|Promise} deserialized data */ - apply(compiler) { - compiler.hooks.compilation.tap( - "FileUriPlugin", - (compilation, { normalModuleFactory }) => { - normalModuleFactory.hooks.resolveForScheme - .for("file") - .tap("FileUriPlugin", resourceData => { - const url = new URL(resourceData.resource); - const path = fileURLToPath(url); - const query = url.search; - const fragment = url.hash; - resourceData.path = path; - resourceData.query = query; - resourceData.fragment = fragment; - resourceData.resource = path + query + fragment; - return true; - }); - const hooks = NormalModule.getCompilationHooks(compilation); - hooks.readResource - .for(undefined) - .tapAsync("FileUriPlugin", (loaderContext, callback) => { - const { resourcePath } = loaderContext; - loaderContext.addDependency(resourcePath); - loaderContext.fs.readFile(resourcePath, callback); - }); - } - ); + deserialize(data, context) { + return data[0]; } } -module.exports = FileUriPlugin; +module.exports = SingleItemMiddleware; /***/ }), -/***/ 42110: +/***/ 58831: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -117760,275 +114560,399 @@ module.exports = FileUriPlugin; -const { extname, basename } = __webpack_require__(71017); -const { URL } = __webpack_require__(57310); -const { createGunzip, createBrotliDecompress, createInflate } = __webpack_require__(59796); -const NormalModule = __webpack_require__(39); -const createSchemaValidation = __webpack_require__(32540); -const createHash = __webpack_require__(49835); -const { mkdirp, dirname, join } = __webpack_require__(17139); -const memoize = __webpack_require__(78676); - -/** @typedef {import("../../declarations/plugins/schemes/HttpUriPlugin").HttpUriPluginOptions} HttpUriPluginOptions */ -/** @typedef {import("../Compiler")} Compiler */ +const ModuleDependency = __webpack_require__(80321); +const makeSerializable = __webpack_require__(33032); -const getHttp = memoize(() => __webpack_require__(13685)); -const getHttps = memoize(() => __webpack_require__(95687)); +class ConsumeSharedFallbackDependency extends ModuleDependency { + constructor(request) { + super(request); + } -/** @type {(() => void)[] | undefined} */ -let inProgressWrite = undefined; + get type() { + return "consume shared fallback"; + } -const validate = createSchemaValidation( - __webpack_require__(67263), - () => __webpack_require__(27256), - { - name: "Http Uri Plugin", - baseDataPath: "options" + get category() { + return "esm"; } +} + +makeSerializable( + ConsumeSharedFallbackDependency, + "webpack/lib/sharing/ConsumeSharedFallbackDependency" ); -const toSafePath = str => - str - .replace(/^[^a-zA-Z0-9]+|[^a-zA-Z0-9]+$/g, "") - .replace(/[^a-zA-Z0-9._-]+/g, "_"); +module.exports = ConsumeSharedFallbackDependency; -const computeIntegrity = content => { - const hash = createHash("sha512"); - hash.update(content); - const integrity = "sha512-" + hash.digest("base64"); - return integrity; -}; -const verifyIntegrity = (content, integrity) => { - if (integrity === "ignore") return true; - return computeIntegrity(content) === integrity; -}; +/***/ }), -/** - * @param {string} str input - * @returns {Record} parsed - */ -const parseKeyValuePairs = str => { - /** @type {Record} */ - const result = {}; - for (const item of str.split(",")) { - const i = item.indexOf("="); - if (i >= 0) { - const key = item.slice(0, i).trim(); - const value = item.slice(i + 1).trim(); - result[key] = value; - } else { - const key = item.trim(); - if (!key) continue; - result[key] = key; - } - } - return result; -}; +/***/ 62286: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -const parseCacheControl = (cacheControl, requestTime) => { - // When false resource is not stored in cache - let storeCache = true; - // When false resource is not stored in lockfile cache - let storeLock = true; - // Resource is only revalidated, after that timestamp and when upgrade is chosen - let validUntil = 0; - if (cacheControl) { - const parsed = parseKeyValuePairs(cacheControl); - if (parsed["no-cache"]) storeCache = storeLock = false; - if (parsed["max-age"] && !isNaN(+parsed["max-age"])) { - validUntil = requestTime + +parsed["max-age"] * 1000; - } - if (parsed["must-revalidate"]) validUntil = 0; - } - return { - storeLock, - storeCache, - validUntil - }; -}; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { RawSource } = __webpack_require__(51255); +const AsyncDependenciesBlock = __webpack_require__(47736); +const Module = __webpack_require__(73208); +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); +const { rangeToString, stringifyHoley } = __webpack_require__(19702); +const ConsumeSharedFallbackDependency = __webpack_require__(58831); + +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ +/** @typedef {import("../util/semver").SemVerRange} SemVerRange */ /** - * @typedef {Object} LockfileEntry - * @property {string} resolved - * @property {string} integrity - * @property {string} contentType + * @typedef {Object} ConsumeOptions + * @property {string=} import fallback request + * @property {string=} importResolved resolved fallback request + * @property {string} shareKey global share key + * @property {string} shareScope share scope + * @property {SemVerRange | false | undefined} requiredVersion version requirement + * @property {string} packageName package name to determine required version automatically + * @property {boolean} strictVersion don't use shared version even if version isn't valid + * @property {boolean} singleton use single global version + * @property {boolean} eager include the fallback module in a sync way */ -const areLockfileEntriesEqual = (a, b) => { - return ( - a.resolved === b.resolved && - a.integrity === b.integrity && - a.contentType === b.contentType - ); -}; +const TYPES = new Set(["consume-shared"]); -const entryToString = entry => { - return `resolved: ${entry.resolved}, integrity: ${entry.integrity}, contentType: ${entry.contentType}`; -}; +class ConsumeSharedModule extends Module { + /** + * @param {string} context context + * @param {ConsumeOptions} options consume options + */ + constructor(context, options) { + super("consume-shared-module", context); + this.options = options; + } -class Lockfile { - constructor() { - this.version = 1; - /** @type {Map} */ - this.entries = new Map(); + /** + * @returns {string} a unique identifier of the module + */ + identifier() { + const { + shareKey, + shareScope, + importResolved, + requiredVersion, + strictVersion, + singleton, + eager + } = this.options; + return `consume-shared-module|${shareScope}|${shareKey}|${ + requiredVersion && rangeToString(requiredVersion) + }|${strictVersion}|${importResolved}|${singleton}|${eager}`; } - static parse(content) { - // TODO handle merge conflicts - const data = JSON.parse(content); - if (data.version !== 1) - throw new Error(`Unsupported lockfile version ${data.version}`); - const lockfile = new Lockfile(); - for (const key of Object.keys(data)) { - if (key === "version") continue; - const entry = data[key]; - lockfile.entries.set( - key, - typeof entry === "string" - ? entry - : { - resolved: key, - ...entry - } - ); - } - return lockfile; + /** + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + const { + shareKey, + shareScope, + importResolved, + requiredVersion, + strictVersion, + singleton, + eager + } = this.options; + return `consume shared module (${shareScope}) ${shareKey}@${ + requiredVersion ? rangeToString(requiredVersion) : "*" + }${strictVersion ? " (strict)" : ""}${singleton ? " (singleton)" : ""}${ + importResolved + ? ` (fallback: ${requestShortener.shorten(importResolved)})` + : "" + }${eager ? " (eager)" : ""}`; } - toString() { - let str = "{\n"; - const entries = Array.from(this.entries).sort(([a], [b]) => - a < b ? -1 : 1 - ); - for (const [key, entry] of entries) { - if (typeof entry === "string") { - str += ` ${JSON.stringify(key)}: ${JSON.stringify(entry)},\n`; + /** + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion + */ + libIdent(options) { + const { shareKey, shareScope, import: request } = this.options; + return `${ + this.layer ? `(${this.layer})/` : "" + }webpack/sharing/consume/${shareScope}/${shareKey}${ + request ? `/${request}` : "" + }`; + } + + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + callback(null, !this.buildInfo); + } + + /** + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + this.buildMeta = {}; + this.buildInfo = {}; + if (this.options.import) { + const dep = new ConsumeSharedFallbackDependency(this.options.import); + if (this.options.eager) { + this.addDependency(dep); } else { - str += ` ${JSON.stringify(key)}: { `; - if (entry.resolved !== key) - str += `"resolved": ${JSON.stringify(entry.resolved)}, `; - str += `"integrity": ${JSON.stringify( - entry.integrity - )}, "contentType": ${JSON.stringify(entry.contentType)} },\n`; + const block = new AsyncDependenciesBlock({}); + block.addDependency(dep); + this.addBlock(block); } } - str += ` "version": ${this.version}\n}\n`; - return str; + callback(); } -} -/** - * @template R - * @param {function(function(Error=, R=): void): void} fn function - * @returns {function(function((Error | null)=, R=): void): void} cached function - */ -const cachedWithoutKey = fn => { - let inFlight = false; - /** @type {Error | undefined} */ - let cachedError = undefined; - /** @type {R | undefined} */ - let cachedResult = undefined; - /** @type {(function(Error=, R=): void)[] | undefined} */ - let cachedCallbacks = undefined; - return callback => { - if (inFlight) { - if (cachedResult !== undefined) return callback(null, cachedResult); - if (cachedError !== undefined) return callback(cachedError); - if (cachedCallbacks === undefined) cachedCallbacks = [callback]; - else cachedCallbacks.push(callback); - return; - } - inFlight = true; - fn((err, result) => { - if (err) cachedError = err; - else cachedResult = result; - const callbacks = cachedCallbacks; - cachedCallbacks = undefined; - callback(err, result); - if (callbacks !== undefined) for (const cb of callbacks) cb(err, result); - }); - }; -}; + /** + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + return TYPES; + } -/** - * @template T - * @template R - * @param {function(T, function(Error=, R=): void): void} fn function - * @param {function(T, function(Error=, R=): void): void=} forceFn function for the second try - * @returns {(function(T, function((Error | null)=, R=): void): void) & { force: function(T, function((Error | null)=, R=): void): void }} cached function - */ -const cachedWithKey = (fn, forceFn = fn) => { - /** @typedef {{ result?: R, error?: Error, callbacks?: (function((Error | null)=, R=): void)[], force?: true }} CacheEntry */ - /** @type {Map} */ - const cache = new Map(); - const resultFn = (arg, callback) => { - const cacheEntry = cache.get(arg); - if (cacheEntry !== undefined) { - if (cacheEntry.result !== undefined) - return callback(null, cacheEntry.result); - if (cacheEntry.error !== undefined) return callback(cacheEntry.error); - if (cacheEntry.callbacks === undefined) cacheEntry.callbacks = [callback]; - else cacheEntry.callbacks.push(callback); - return; - } - /** @type {CacheEntry} */ - const newCacheEntry = { - result: undefined, - error: undefined, - callbacks: undefined - }; - cache.set(arg, newCacheEntry); - fn(arg, (err, result) => { - if (err) newCacheEntry.error = err; - else newCacheEntry.result = result; - const callbacks = newCacheEntry.callbacks; - newCacheEntry.callbacks = undefined; - callback(err, result); - if (callbacks !== undefined) for (const cb of callbacks) cb(err, result); - }); - }; - resultFn.force = (arg, callback) => { - const cacheEntry = cache.get(arg); - if (cacheEntry !== undefined && cacheEntry.force) { - if (cacheEntry.result !== undefined) - return callback(null, cacheEntry.result); - if (cacheEntry.error !== undefined) return callback(cacheEntry.error); - if (cacheEntry.callbacks === undefined) cacheEntry.callbacks = [callback]; - else cacheEntry.callbacks.push(callback); - return; + /** + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + return 42; + } + + /** + * @param {Hash} hash the hash used to track dependencies + * @param {UpdateHashContext} context context + * @returns {void} + */ + updateHash(hash, context) { + hash.update(JSON.stringify(this.options)); + super.updateHash(hash, context); + } + + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration({ chunkGraph, moduleGraph, runtimeTemplate }) { + const runtimeRequirements = new Set([RuntimeGlobals.shareScopeMap]); + const { + shareScope, + shareKey, + strictVersion, + requiredVersion, + import: request, + singleton, + eager + } = this.options; + let fallbackCode; + if (request) { + if (eager) { + const dep = this.dependencies[0]; + fallbackCode = runtimeTemplate.syncModuleFactory({ + dependency: dep, + chunkGraph, + runtimeRequirements, + request: this.options.import + }); + } else { + const block = this.blocks[0]; + fallbackCode = runtimeTemplate.asyncModuleFactory({ + block, + chunkGraph, + runtimeRequirements, + request: this.options.import + }); + } } - /** @type {CacheEntry} */ - const newCacheEntry = { - result: undefined, - error: undefined, - callbacks: undefined, - force: true + let fn = "load"; + const args = [JSON.stringify(shareScope), JSON.stringify(shareKey)]; + if (requiredVersion) { + if (strictVersion) { + fn += "Strict"; + } + if (singleton) { + fn += "Singleton"; + } + args.push(stringifyHoley(requiredVersion)); + fn += "VersionCheck"; + } else { + if (singleton) { + fn += "Singleton"; + } + } + if (fallbackCode) { + fn += "Fallback"; + args.push(fallbackCode); + } + const code = runtimeTemplate.returningFunction(`${fn}(${args.join(", ")})`); + const sources = new Map(); + sources.set("consume-shared", new RawSource(code)); + return { + runtimeRequirements, + sources }; - cache.set(arg, newCacheEntry); - forceFn(arg, (err, result) => { - if (err) newCacheEntry.error = err; - else newCacheEntry.result = result; - const callbacks = newCacheEntry.callbacks; - newCacheEntry.callbacks = undefined; - callback(err, result); - if (callbacks !== undefined) for (const cb of callbacks) cb(err, result); - }); - }; - return resultFn; -}; + } -class HttpUriPlugin { + serialize(context) { + const { write } = context; + write(this.options); + super.serialize(context); + } + + deserialize(context) { + const { read } = context; + this.options = read(); + super.deserialize(context); + } +} + +makeSerializable( + ConsumeSharedModule, + "webpack/lib/sharing/ConsumeSharedModule" +); + +module.exports = ConsumeSharedModule; + + +/***/ }), + +/***/ 15046: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ModuleNotFoundError = __webpack_require__(32882); +const RuntimeGlobals = __webpack_require__(16475); +const WebpackError = __webpack_require__(53799); +const { parseOptions } = __webpack_require__(3083); +const LazySet = __webpack_require__(38938); +const createSchemaValidation = __webpack_require__(32540); +const { parseRange } = __webpack_require__(19702); +const ConsumeSharedFallbackDependency = __webpack_require__(58831); +const ConsumeSharedModule = __webpack_require__(62286); +const ConsumeSharedRuntimeModule = __webpack_require__(10394); +const ProvideForSharedDependency = __webpack_require__(40017); +const { resolveMatchedConfigs } = __webpack_require__(3591); +const { + isRequiredVersion, + getDescriptionFile, + getRequiredVersionFromDescriptionFile +} = __webpack_require__(84379); + +/** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumeSharedPluginOptions} ConsumeSharedPluginOptions */ +/** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumesConfig} ConsumesConfig */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../ResolverFactory").ResolveOptionsWithDependencyType} ResolveOptionsWithDependencyType */ +/** @typedef {import("./ConsumeSharedModule").ConsumeOptions} ConsumeOptions */ + +const validate = createSchemaValidation( + __webpack_require__(6464), + () => __webpack_require__(16116), + { + name: "Consume Shared Plugin", + baseDataPath: "options" + } +); + +/** @type {ResolveOptionsWithDependencyType} */ +const RESOLVE_OPTIONS = { dependencyType: "esm" }; +const PLUGIN_NAME = "ConsumeSharedPlugin"; + +class ConsumeSharedPlugin { /** - * @param {HttpUriPluginOptions} options options + * @param {ConsumeSharedPluginOptions} options options */ constructor(options) { - validate(options); - this._lockfileLocation = options.lockfileLocation; - this._cacheLocation = options.cacheLocation; - this._upgrade = options.upgrade; - this._frozen = options.frozen; - this._allowedUris = options.allowedUris; + if (typeof options !== "string") { + validate(options); + } + + /** @type {[string, ConsumeOptions][]} */ + this._consumes = parseOptions( + options.consumes, + (item, key) => { + if (Array.isArray(item)) throw new Error("Unexpected array in options"); + /** @type {ConsumeOptions} */ + let result = + item === key || !isRequiredVersion(item) + ? // item is a request/key + { + import: key, + shareScope: options.shareScope || "default", + shareKey: key, + requiredVersion: undefined, + packageName: undefined, + strictVersion: false, + singleton: false, + eager: false + } + : // key is a request/key + // item is a version + { + import: key, + shareScope: options.shareScope || "default", + shareKey: key, + requiredVersion: parseRange(item), + strictVersion: true, + packageName: undefined, + singleton: false, + eager: false + }; + return result; + }, + (item, key) => ({ + import: item.import === false ? undefined : item.import || key, + shareScope: item.shareScope || options.shareScope || "default", + shareKey: item.shareKey || key, + requiredVersion: + typeof item.requiredVersion === "string" + ? parseRange(item.requiredVersion) + : item.requiredVersion, + strictVersion: + typeof item.strictVersion === "boolean" + ? item.strictVersion + : item.import !== false && !item.singleton, + packageName: item.packageName, + singleton: !!item.singleton, + eager: !!item.eager + }) + ); } /** @@ -118037,3787 +114961,7421 @@ class HttpUriPlugin { * @returns {void} */ apply(compiler) { - const schemes = [ - { - scheme: "http", - fetch: (url, options, callback) => getHttp().get(url, options, callback) - }, - { - scheme: "https", - fetch: (url, options, callback) => - getHttps().get(url, options, callback) - } - ]; - let lockfileCache; - compiler.hooks.compilation.tap( - "HttpUriPlugin", + compiler.hooks.thisCompilation.tap( + PLUGIN_NAME, (compilation, { normalModuleFactory }) => { - const intermediateFs = compiler.intermediateFileSystem; - const fs = compilation.inputFileSystem; - const cache = compilation.getCache("webpack.HttpUriPlugin"); - const logger = compilation.getLogger("webpack.HttpUriPlugin"); - const lockfileLocation = - this._lockfileLocation || - join( - intermediateFs, - compiler.context, - compiler.name - ? `${toSafePath(compiler.name)}.webpack.lock` - : "webpack.lock" - ); - const cacheLocation = - this._cacheLocation !== undefined - ? this._cacheLocation - : lockfileLocation + ".data"; - const upgrade = this._upgrade || false; - const frozen = this._frozen || false; - const hashFunction = "sha512"; - const hashDigest = "hex"; - const hashDigestLength = 20; - const allowedUris = this._allowedUris; + compilation.dependencyFactories.set( + ConsumeSharedFallbackDependency, + normalModuleFactory + ); - let warnedAboutEol = false; + let unresolvedConsumes, resolvedConsumes, prefixedConsumes; + const promise = resolveMatchedConfigs(compilation, this._consumes).then( + ({ resolved, unresolved, prefixed }) => { + resolvedConsumes = resolved; + unresolvedConsumes = unresolved; + prefixedConsumes = prefixed; + } + ); - const cacheKeyCache = new Map(); - /** - * @param {string} url the url - * @returns {string} the key - */ - const getCacheKey = url => { - const cachedResult = cacheKeyCache.get(url); - if (cachedResult !== undefined) return cachedResult; - const result = _getCacheKey(url); - cacheKeyCache.set(url, result); - return result; - }; + const resolver = compilation.resolverFactory.get( + "normal", + RESOLVE_OPTIONS + ); /** - * @param {string} url the url - * @returns {string} the key + * @param {string} context issuer directory + * @param {string} request request + * @param {ConsumeOptions} config options + * @returns {Promise} create module */ - const _getCacheKey = url => { - const parsedUrl = new URL(url); - const folder = toSafePath(parsedUrl.origin); - const name = toSafePath(parsedUrl.pathname); - const query = toSafePath(parsedUrl.search); - let ext = extname(name); - if (ext.length > 20) ext = ""; - const basename = ext ? name.slice(0, -ext.length) : name; - const hash = createHash(hashFunction); - hash.update(url); - const digest = hash.digest(hashDigest).slice(0, hashDigestLength); - return `${folder.slice(-50)}/${`${basename}${ - query ? `_${query}` : "" - }`.slice(0, 150)}_${digest}${ext}`; - }; - - const getLockfile = cachedWithoutKey( - /** - * @param {function((Error | null)=, Lockfile=): void} callback callback - * @returns {void} - */ - callback => { - const readLockfile = () => { - intermediateFs.readFile(lockfileLocation, (err, buffer) => { - if (err && err.code !== "ENOENT") { - compilation.missingDependencies.add(lockfileLocation); - return callback(err); - } - compilation.fileDependencies.add(lockfileLocation); - compilation.fileSystemInfo.createSnapshot( - compiler.fsStartTime, - buffer ? [lockfileLocation] : [], - [], - buffer ? [] : [lockfileLocation], - { timestamp: true }, - (err, snapshot) => { - if (err) return callback(err); - const lockfile = buffer - ? Lockfile.parse(buffer.toString("utf-8")) - : new Lockfile(); - lockfileCache = { - lockfile, - snapshot - }; - callback(null, lockfile); + const createConsumeSharedModule = (context, request, config) => { + const requiredVersionWarning = details => { + const error = new WebpackError( + `No required version specified and unable to automatically determine one. ${details}` + ); + error.file = `shared module ${request}`; + compilation.warnings.push(error); + }; + const directFallback = + config.import && + /^(\.\.?(\/|$)|\/|[A-Za-z]:|\\\\)/.test(config.import); + return Promise.all([ + new Promise(resolve => { + if (!config.import) return resolve(); + const resolveContext = { + /** @type {LazySet} */ + fileDependencies: new LazySet(), + /** @type {LazySet} */ + contextDependencies: new LazySet(), + /** @type {LazySet} */ + missingDependencies: new LazySet() + }; + resolver.resolve( + {}, + directFallback ? compiler.context : context, + config.import, + resolveContext, + (err, result) => { + compilation.contextDependencies.addAll( + resolveContext.contextDependencies + ); + compilation.fileDependencies.addAll( + resolveContext.fileDependencies + ); + compilation.missingDependencies.addAll( + resolveContext.missingDependencies + ); + if (err) { + compilation.errors.push( + new ModuleNotFoundError(null, err, { + name: `resolving fallback for shared module ${request}` + }) + ); + return resolve(); } - ); - }); - }; - if (lockfileCache) { - compilation.fileSystemInfo.checkSnapshotValid( - lockfileCache.snapshot, - (err, valid) => { - if (err) return callback(err); - if (!valid) return readLockfile(); - callback(null, lockfileCache.lockfile); + resolve(result); } ); - } else { - readLockfile(); - } - } - ); + }), + new Promise(resolve => { + if (config.requiredVersion !== undefined) + return resolve(config.requiredVersion); + let packageName = config.packageName; + if (packageName === undefined) { + if (/^(\/|[A-Za-z]:|\\\\)/.test(request)) { + // For relative or absolute requests we don't automatically use a packageName. + // If wished one can specify one with the packageName option. + return resolve(); + } + const match = /^((?:@[^\\/]+[\\/])?[^\\/]+)/.exec(request); + if (!match) { + requiredVersionWarning( + "Unable to extract the package name from request." + ); + return resolve(); + } + packageName = match[0]; + } - /** @type {Map | undefined} */ - let lockfileUpdates = undefined; - const storeLockEntry = (lockfile, url, entry) => { - const oldEntry = lockfile.entries.get(url); - if (lockfileUpdates === undefined) lockfileUpdates = new Map(); - lockfileUpdates.set(url, entry); - lockfile.entries.set(url, entry); - if (!oldEntry) { - logger.log(`${url} added to lockfile`); - } else if (typeof oldEntry === "string") { - if (typeof entry === "string") { - logger.log(`${url} updated in lockfile: ${oldEntry} -> ${entry}`); - } else { - logger.log( - `${url} updated in lockfile: ${oldEntry} -> ${entry.resolved}` + getDescriptionFile( + compilation.inputFileSystem, + context, + ["package.json"], + (err, result) => { + if (err) { + requiredVersionWarning( + `Unable to read description file: ${err}` + ); + return resolve(); + } + const { data, path: descriptionPath } = result; + if (!data) { + requiredVersionWarning( + `Unable to find description file in ${context}.` + ); + return resolve(); + } + const requiredVersion = getRequiredVersionFromDescriptionFile( + data, + packageName + ); + if (typeof requiredVersion !== "string") { + requiredVersionWarning( + `Unable to find required version for "${packageName}" in description file (${descriptionPath}). It need to be in dependencies, devDependencies or peerDependencies.` + ); + return resolve(); + } + resolve(parseRange(requiredVersion)); + } ); - } - } else if (typeof entry === "string") { - logger.log( - `${url} updated in lockfile: ${oldEntry.resolved} -> ${entry}` - ); - } else if (oldEntry.resolved !== entry.resolved) { - logger.log( - `${url} updated in lockfile: ${oldEntry.resolved} -> ${entry.resolved}` + }) + ]).then(([importResolved, requiredVersion]) => { + return new ConsumeSharedModule( + directFallback ? compiler.context : context, + { + ...config, + importResolved, + import: importResolved ? config.import : undefined, + requiredVersion + } ); - } else if (oldEntry.integrity !== entry.integrity) { - logger.log(`${url} updated in lockfile: content changed`); - } else if (oldEntry.contentType !== entry.contentType) { - logger.log( - `${url} updated in lockfile: ${oldEntry.contentType} -> ${entry.contentType}` - ); - } else { - logger.log(`${url} updated in lockfile`); - } - }; - - const storeResult = (lockfile, url, result, callback) => { - if (result.storeLock) { - storeLockEntry(lockfile, url, result.entry); - if (!cacheLocation || !result.content) - return callback(null, result); - const key = getCacheKey(result.entry.resolved); - const filePath = join(intermediateFs, cacheLocation, key); - mkdirp(intermediateFs, dirname(intermediateFs, filePath), err => { - if (err) return callback(err); - intermediateFs.writeFile(filePath, result.content, err => { - if (err) return callback(err); - callback(null, result); - }); - }); - } else { - storeLockEntry(lockfile, url, "no-cache"); - callback(null, result); - } + }); }; - for (const { scheme, fetch } of schemes) { - /** - * - * @param {string} url URL - * @param {string} integrity integrity - * @param {function((Error | null)=, { entry: LockfileEntry, content: Buffer, storeLock: boolean }=): void} callback callback - */ - const resolveContent = (url, integrity, callback) => { - const handleResult = (err, result) => { - if (err) return callback(err); - if ("location" in result) { - return resolveContent( - result.location, - integrity, - (err, innerResult) => { - if (err) return callback(err); - callback(null, { - entry: innerResult.entry, - content: innerResult.content, - storeLock: innerResult.storeLock && result.storeLock - }); - } - ); - } else { - if ( - !result.fresh && - integrity && - result.entry.integrity !== integrity && - !verifyIntegrity(result.content, integrity) - ) { - return fetchContent.force(url, handleResult); + normalModuleFactory.hooks.factorize.tapPromise( + PLUGIN_NAME, + ({ context, request, dependencies }) => + // wait for resolving to be complete + promise.then(() => { + if ( + dependencies[0] instanceof ConsumeSharedFallbackDependency || + dependencies[0] instanceof ProvideForSharedDependency + ) { + return; + } + const match = unresolvedConsumes.get(request); + if (match !== undefined) { + return createConsumeSharedModule(context, request, match); + } + for (const [prefix, options] of prefixedConsumes) { + if (request.startsWith(prefix)) { + const remainder = request.slice(prefix.length); + return createConsumeSharedModule(context, request, { + ...options, + import: options.import + ? options.import + remainder + : undefined, + shareKey: options.shareKey + remainder + }); } - return callback(null, { - entry: result.entry, - content: result.content, - storeLock: result.storeLock - }); } - }; - fetchContent(url, handleResult); - }; - - /** @typedef {{ storeCache: boolean, storeLock: boolean, validUntil: number, etag: string | undefined, fresh: boolean }} FetchResultMeta */ - /** @typedef {FetchResultMeta & { location: string }} RedirectFetchResult */ - /** @typedef {FetchResultMeta & { entry: LockfileEntry, content: Buffer }} ContentFetchResult */ - /** @typedef {RedirectFetchResult | ContentFetchResult} FetchResult */ + }) + ); + normalModuleFactory.hooks.createModule.tapPromise( + PLUGIN_NAME, + ({ resource }, { context, dependencies }) => { + if ( + dependencies[0] instanceof ConsumeSharedFallbackDependency || + dependencies[0] instanceof ProvideForSharedDependency + ) { + return Promise.resolve(); + } + const options = resolvedConsumes.get(resource); + if (options !== undefined) { + return createConsumeSharedModule(context, resource, options); + } + return Promise.resolve(); + } + ); + compilation.hooks.additionalTreeRuntimeRequirements.tap( + PLUGIN_NAME, + (chunk, set) => { + set.add(RuntimeGlobals.module); + set.add(RuntimeGlobals.moduleCache); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + set.add(RuntimeGlobals.shareScopeMap); + set.add(RuntimeGlobals.initializeSharing); + set.add(RuntimeGlobals.hasOwnProperty); + compilation.addRuntimeModule( + chunk, + new ConsumeSharedRuntimeModule(set) + ); + } + ); + } + ); + } +} - /** - * @param {string} url URL - * @param {FetchResult | RedirectFetchResult} cachedResult result from cache - * @param {function((Error | null)=, FetchResult=): void} callback callback - * @returns {void} - */ - const fetchContentRaw = (url, cachedResult, callback) => { - const requestTime = Date.now(); - fetch( - new URL(url), - { - headers: { - "accept-encoding": "gzip, deflate, br", - "user-agent": "webpack", - "if-none-match": cachedResult - ? cachedResult.etag || null - : null - } - }, - res => { - const etag = res.headers["etag"]; - const location = res.headers["location"]; - const cacheControl = res.headers["cache-control"]; - const { storeLock, storeCache, validUntil } = parseCacheControl( - cacheControl, - requestTime - ); - /** - * @param {Partial> & (Pick | Pick)} partialResult result - * @returns {void} - */ - const finishWith = partialResult => { - if ("location" in partialResult) { - logger.debug( - `GET ${url} [${res.statusCode}] -> ${partialResult.location}` - ); - } else { - logger.debug( - `GET ${url} [${res.statusCode}] ${Math.ceil( - partialResult.content.length / 1024 - )} kB${!storeLock ? " no-cache" : ""}` - ); - } - const result = { - ...partialResult, - fresh: true, - storeLock, - storeCache, - validUntil, - etag - }; - if (!storeCache) { - logger.log( - `${url} can't be stored in cache, due to Cache-Control header: ${cacheControl}` - ); - return callback(null, result); - } - cache.store( - url, - null, - { - ...result, - fresh: false - }, - err => { - if (err) { - logger.warn( - `${url} can't be stored in cache: ${err.message}` - ); - logger.debug(err.stack); - } - callback(null, result); - } - ); - }; - if (res.statusCode === 304) { - if ( - cachedResult.validUntil < validUntil || - cachedResult.storeLock !== storeLock || - cachedResult.storeCache !== storeCache || - cachedResult.etag !== etag - ) { - return finishWith(cachedResult); - } else { - logger.debug(`GET ${url} [${res.statusCode}] (unchanged)`); - return callback(null, { - ...cachedResult, - fresh: true - }); - } - } - if ( - location && - res.statusCode >= 301 && - res.statusCode <= 308 - ) { - const result = { - location: new URL(location, url).href - }; - if ( - !cachedResult || - !("location" in cachedResult) || - cachedResult.location !== result.location || - cachedResult.validUntil < validUntil || - cachedResult.storeLock !== storeLock || - cachedResult.storeCache !== storeCache || - cachedResult.etag !== etag - ) { - return finishWith(result); - } else { - logger.debug(`GET ${url} [${res.statusCode}] (unchanged)`); - return callback(null, { - ...result, - fresh: true, - storeLock, - storeCache, - validUntil, - etag - }); - } - } - const contentType = res.headers["content-type"] || ""; - const bufferArr = []; +module.exports = ConsumeSharedPlugin; - const contentEncoding = res.headers["content-encoding"]; - let stream = res; - if (contentEncoding === "gzip") { - stream = stream.pipe(createGunzip()); - } else if (contentEncoding === "br") { - stream = stream.pipe(createBrotliDecompress()); - } else if (contentEncoding === "deflate") { - stream = stream.pipe(createInflate()); - } - stream.on("data", chunk => { - bufferArr.push(chunk); - }); +/***/ }), - stream.on("end", () => { - if (!res.complete) { - logger.log(`GET ${url} [${res.statusCode}] (terminated)`); - return callback(new Error(`${url} request was terminated`)); - } +/***/ 10394: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const content = Buffer.concat(bufferArr); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (res.statusCode !== 200) { - logger.log(`GET ${url} [${res.statusCode}]`); - return callback( - new Error( - `${url} request status code = ${ - res.statusCode - }\n${content.toString("utf-8")}` - ) - ); - } - const integrity = computeIntegrity(content); - const entry = { resolved: url, integrity, contentType }; - finishWith({ - entry, - content - }); - }); - } - ).on("error", err => { - logger.log(`GET ${url} (error)`); - err.message += `\nwhile fetching ${url}`; - callback(err); - }); - }; +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); +const { + parseVersionRuntimeCode, + versionLtRuntimeCode, + rangeToStringRuntimeCode, + satisfyRuntimeCode +} = __webpack_require__(19702); - const fetchContent = cachedWithKey( - /** - * @param {string} url URL - * @param {function((Error | null)=, { validUntil: number, etag?: string, entry: LockfileEntry, content: Buffer, fresh: boolean } | { validUntil: number, etag?: string, location: string, fresh: boolean }=): void} callback callback - * @returns {void} - */ (url, callback) => { - cache.get(url, null, (err, cachedResult) => { - if (err) return callback(err); - if (cachedResult) { - const isValid = cachedResult.validUntil >= Date.now(); - if (isValid) return callback(null, cachedResult); - } - fetchContentRaw(url, cachedResult, callback); - }); - }, - (url, callback) => fetchContentRaw(url, undefined, callback) - ); +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("./ConsumeSharedModule")} ConsumeSharedModule */ - const isAllowed = uri => { - for (const allowed of allowedUris) { - if (typeof allowed === "string") { - if (uri.startsWith(allowed)) return true; - } else if (typeof allowed === "function") { - if (allowed(uri)) return true; - } else { - if (allowed.test(uri)) return true; - } - } - return false; - }; +class ConsumeSharedRuntimeModule extends RuntimeModule { + constructor(runtimeRequirements) { + super("consumes", RuntimeModule.STAGE_ATTACH); + this._runtimeRequirements = runtimeRequirements; + } - const getInfo = cachedWithKey( - /** - * @param {string} url the url - * @param {function((Error | null)=, { entry: LockfileEntry, content: Buffer }=): void} callback callback - * @returns {void} - */ - (url, callback) => { - if (!isAllowed(url)) { - return callback( - new Error( - `${url} doesn't match the allowedUris policy. These URIs are allowed:\n${allowedUris - .map(uri => ` - ${uri}`) - .join("\n")}` - ) - ); - } - getLockfile((err, lockfile) => { - if (err) return callback(err); - const entryOrString = lockfile.entries.get(url); - if (!entryOrString) { - if (frozen) { - return callback( - new Error( - `${url} has no lockfile entry and lockfile is frozen` - ) - ); - } - resolveContent(url, null, (err, result) => { - if (err) return callback(err); - storeResult(lockfile, url, result, callback); - }); - return; - } - if (typeof entryOrString === "string") { - const entryTag = entryOrString; - resolveContent(url, null, (err, result) => { - if (err) return callback(err); - if (!result.storeLock || entryTag === "ignore") - return callback(null, result); - if (frozen) { - return callback( - new Error( - `${url} used to have ${entryTag} lockfile entry and has content now, but lockfile is frozen` - ) - ); - } - if (!upgrade) { - return callback( - new Error( - `${url} used to have ${entryTag} lockfile entry and has content now. -This should be reflected in the lockfile, so this lockfile entry must be upgraded, but upgrading is not enabled. -Remove this line from the lockfile to force upgrading.` - ) - ); - } - storeResult(lockfile, url, result, callback); - }); - return; - } - let entry = entryOrString; - const doFetch = lockedContent => { - resolveContent(url, entry.integrity, (err, result) => { - if (err) { - if (lockedContent) { - logger.warn( - `Upgrade request to ${url} failed: ${err.message}` - ); - logger.debug(err.stack); - return callback(null, { - entry, - content: lockedContent - }); - } - return callback(err); - } - if (!result.storeLock) { - // When the lockfile entry should be no-cache - // we need to update the lockfile - if (frozen) { - return callback( - new Error( - `${url} has a lockfile entry and is no-cache now, but lockfile is frozen\nLockfile: ${entryToString( - entry - )}` - ) - ); - } - storeResult(lockfile, url, result, callback); - return; - } - if (!areLockfileEntriesEqual(result.entry, entry)) { - // When the lockfile entry is outdated - // we need to update the lockfile - if (frozen) { - return callback( - new Error( - `${url} has an outdated lockfile entry, but lockfile is frozen\nLockfile: ${entryToString( - entry - )}\nExpected: ${entryToString(result.entry)}` - ) - ); - } - storeResult(lockfile, url, result, callback); - return; - } - if (!lockedContent && cacheLocation) { - // When the lockfile cache content is missing - // we need to update the lockfile - if (frozen) { - return callback( - new Error( - `${url} is missing content in the lockfile cache, but lockfile is frozen\nLockfile: ${entryToString( - entry - )}` - ) - ); - } - storeResult(lockfile, url, result, callback); - return; - } - return callback(null, result); - }); - }; - if (cacheLocation) { - // When there is a lockfile cache - // we read the content from there - const key = getCacheKey(entry.resolved); - const filePath = join(intermediateFs, cacheLocation, key); - fs.readFile(filePath, (err, result) => { - const content = /** @type {Buffer} */ (result); - if (err) { - if (err.code === "ENOENT") return doFetch(); - return callback(err); - } - const continueWithCachedContent = result => { - if (!upgrade) { - // When not in upgrade mode, we accept the result from the lockfile cache - return callback(null, { entry, content }); - } - return doFetch(content); - }; - if (!verifyIntegrity(content, entry.integrity)) { - let contentWithChangedEol; - let isEolChanged = false; - try { - contentWithChangedEol = Buffer.from( - content.toString("utf-8").replace(/\r\n/g, "\n") - ); - isEolChanged = verifyIntegrity( - contentWithChangedEol, - entry.integrity - ); - } catch (e) { - // ignore - } - if (isEolChanged) { - if (!warnedAboutEol) { - const explainer = `Incorrect end of line sequence was detected in the lockfile cache. -The lockfile cache is protected by integrity checks, so any external modification will lead to a corrupted lockfile cache. -When using git make sure to configure .gitattributes correctly for the lockfile cache: - **/*webpack.lock.data/** -text -This will avoid that the end of line sequence is changed by git on Windows.`; - if (frozen) { - logger.error(explainer); - } else { - logger.warn(explainer); - logger.info( - "Lockfile cache will be automatically fixed now, but when lockfile is frozen this would result in an error." - ); - } - warnedAboutEol = true; - } - if (!frozen) { - // "fix" the end of line sequence of the lockfile content - logger.log( - `${filePath} fixed end of line sequence (\\r\\n instead of \\n).` - ); - intermediateFs.writeFile( - filePath, - contentWithChangedEol, - err => { - if (err) return callback(err); - continueWithCachedContent(contentWithChangedEol); - } - ); - return; - } - } - if (frozen) { - return callback( - new Error( - `${ - entry.resolved - } integrity mismatch, expected content with integrity ${ - entry.integrity - } but got ${computeIntegrity(content)}. -Lockfile corrupted (${ - isEolChanged - ? "end of line sequence was unexpectedly changed" - : "incorrectly merged? changed by other tools?" - }). -Run build with un-frozen lockfile to automatically fix lockfile.` - ) - ); - } else { - // "fix" the lockfile entry to the correct integrity - // the content has priority over the integrity value - entry = { - ...entry, - integrity: computeIntegrity(content) - }; - storeLockEntry(lockfile, url, entry); - } - } - continueWithCachedContent(result); - }); - } else { - doFetch(); + /** + * @returns {string} runtime code + */ + generate() { + const { compilation, chunkGraph } = this; + const { runtimeTemplate, codeGenerationResults } = compilation; + const chunkToModuleMapping = {}; + /** @type {Map} */ + const moduleIdToSourceMapping = new Map(); + const initialConsumes = []; + /** + * + * @param {Iterable} modules modules + * @param {Chunk} chunk the chunk + * @param {(string | number)[]} list list of ids + */ + const addModules = (modules, chunk, list) => { + for (const m of modules) { + const module = /** @type {ConsumeSharedModule} */ (m); + const id = chunkGraph.getModuleId(module); + list.push(id); + moduleIdToSourceMapping.set( + id, + codeGenerationResults.getSource( + module, + chunk.runtime, + "consume-shared" + ) + ); + } + }; + for (const chunk of this.chunk.getAllAsyncChunks()) { + const modules = chunkGraph.getChunkModulesIterableBySourceType( + chunk, + "consume-shared" + ); + if (!modules) continue; + addModules(modules, chunk, (chunkToModuleMapping[chunk.id] = [])); + } + for (const chunk of this.chunk.getAllInitialChunks()) { + const modules = chunkGraph.getChunkModulesIterableBySourceType( + chunk, + "consume-shared" + ); + if (!modules) continue; + addModules(modules, chunk, initialConsumes); + } + if (moduleIdToSourceMapping.size === 0) return null; + return Template.asString([ + parseVersionRuntimeCode(runtimeTemplate), + versionLtRuntimeCode(runtimeTemplate), + rangeToStringRuntimeCode(runtimeTemplate), + satisfyRuntimeCode(runtimeTemplate), + `var ensureExistence = ${runtimeTemplate.basicFunction("scopeName, key", [ + `var scope = ${RuntimeGlobals.shareScopeMap}[scopeName];`, + `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) throw new Error("Shared module " + key + " doesn't exist in shared scope " + scopeName);`, + "return scope;" + ])};`, + `var findVersion = ${runtimeTemplate.basicFunction("scope, key", [ + "var versions = scope[key];", + `var key = Object.keys(versions).reduce(${runtimeTemplate.basicFunction( + "a, b", + ["return !a || versionLt(a, b) ? b : a;"] + )}, 0);`, + "return key && versions[key]" + ])};`, + `var findSingletonVersionKey = ${runtimeTemplate.basicFunction( + "scope, key", + [ + "var versions = scope[key];", + `return Object.keys(versions).reduce(${runtimeTemplate.basicFunction( + "a, b", + ["return !a || (!versions[a].loaded && versionLt(a, b)) ? b : a;"] + )}, 0);` + ] + )};`, + `var getInvalidSingletonVersionMessage = ${runtimeTemplate.basicFunction( + "scope, key, version, requiredVersion", + [ + `return "Unsatisfied version " + version + " from " + (version && scope[key][version].from) + " of shared singleton module " + key + " (required " + rangeToString(requiredVersion) + ")"` + ] + )};`, + `var getSingleton = ${runtimeTemplate.basicFunction( + "scope, scopeName, key, requiredVersion", + [ + "var version = findSingletonVersionKey(scope, key);", + "return get(scope[key][version]);" + ] + )};`, + `var getSingletonVersion = ${runtimeTemplate.basicFunction( + "scope, scopeName, key, requiredVersion", + [ + "var version = findSingletonVersionKey(scope, key);", + "if (!satisfy(requiredVersion, version)) " + + 'typeof console !== "undefined" && console.warn && console.warn(getInvalidSingletonVersionMessage(scope, key, version, requiredVersion));', + "return get(scope[key][version]);" + ] + )};`, + `var getStrictSingletonVersion = ${runtimeTemplate.basicFunction( + "scope, scopeName, key, requiredVersion", + [ + "var version = findSingletonVersionKey(scope, key);", + "if (!satisfy(requiredVersion, version)) " + + "throw new Error(getInvalidSingletonVersionMessage(scope, key, version, requiredVersion));", + "return get(scope[key][version]);" + ] + )};`, + `var findValidVersion = ${runtimeTemplate.basicFunction( + "scope, key, requiredVersion", + [ + "var versions = scope[key];", + `var key = Object.keys(versions).reduce(${runtimeTemplate.basicFunction( + "a, b", + [ + "if (!satisfy(requiredVersion, b)) return a;", + "return !a || versionLt(a, b) ? b : a;" + ] + )}, 0);`, + "return key && versions[key]" + ] + )};`, + `var getInvalidVersionMessage = ${runtimeTemplate.basicFunction( + "scope, scopeName, key, requiredVersion", + [ + "var versions = scope[key];", + 'return "No satisfying version (" + rangeToString(requiredVersion) + ") of shared module " + key + " found in shared scope " + scopeName + ".\\n" +', + `\t"Available versions: " + Object.keys(versions).map(${runtimeTemplate.basicFunction( + "key", + ['return key + " from " + versions[key].from;'] + )}).join(", ");` + ] + )};`, + `var getValidVersion = ${runtimeTemplate.basicFunction( + "scope, scopeName, key, requiredVersion", + [ + "var entry = findValidVersion(scope, key, requiredVersion);", + "if(entry) return get(entry);", + "throw new Error(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));" + ] + )};`, + `var warnInvalidVersion = ${runtimeTemplate.basicFunction( + "scope, scopeName, key, requiredVersion", + [ + 'typeof console !== "undefined" && console.warn && console.warn(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));' + ] + )};`, + `var get = ${runtimeTemplate.basicFunction("entry", [ + "entry.loaded = 1;", + "return entry.get()" + ])};`, + `var init = ${runtimeTemplate.returningFunction( + Template.asString([ + "function(scopeName, a, b, c) {", + Template.indent([ + `var promise = ${RuntimeGlobals.initializeSharing}(scopeName);`, + `if (promise && promise.then) return promise.then(fn.bind(fn, scopeName, ${RuntimeGlobals.shareScopeMap}[scopeName], a, b, c));`, + `return fn(scopeName, ${RuntimeGlobals.shareScopeMap}[scopeName], a, b, c);` + ]), + "}" + ]), + "fn" + )};`, + "", + `var load = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key", + [ + "ensureExistence(scopeName, key);", + "return get(findVersion(scope, key));" + ] + )});`, + `var loadFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, fallback", + [ + `return scope && ${RuntimeGlobals.hasOwnProperty}(scope, key) ? get(findVersion(scope, key)) : fallback();` + ] + )});`, + `var loadVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, version", + [ + "ensureExistence(scopeName, key);", + "return get(findValidVersion(scope, key, version) || warnInvalidVersion(scope, scopeName, key, version) || findVersion(scope, key));" + ] + )});`, + `var loadSingleton = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key", + [ + "ensureExistence(scopeName, key);", + "return getSingleton(scope, scopeName, key);" + ] + )});`, + `var loadSingletonVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, version", + [ + "ensureExistence(scopeName, key);", + "return getSingletonVersion(scope, scopeName, key, version);" + ] + )});`, + `var loadStrictVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, version", + [ + "ensureExistence(scopeName, key);", + "return getValidVersion(scope, scopeName, key, version);" + ] + )});`, + `var loadStrictSingletonVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, version", + [ + "ensureExistence(scopeName, key);", + "return getStrictSingletonVersion(scope, scopeName, key, version);" + ] + )});`, + `var loadVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, version, fallback", + [ + `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`, + "return get(findValidVersion(scope, key, version) || warnInvalidVersion(scope, scopeName, key, version) || findVersion(scope, key));" + ] + )});`, + `var loadSingletonFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, fallback", + [ + `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`, + "return getSingleton(scope, scopeName, key);" + ] + )});`, + `var loadSingletonVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, version, fallback", + [ + `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`, + "return getSingletonVersion(scope, scopeName, key, version);" + ] + )});`, + `var loadStrictVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, version, fallback", + [ + `var entry = scope && ${RuntimeGlobals.hasOwnProperty}(scope, key) && findValidVersion(scope, key, version);`, + `return entry ? get(entry) : fallback();` + ] + )});`, + `var loadStrictSingletonVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( + "scopeName, scope, key, version, fallback", + [ + `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`, + "return getStrictSingletonVersion(scope, scopeName, key, version);" + ] + )});`, + "var installedModules = {};", + "var moduleToHandlerMapping = {", + Template.indent( + Array.from( + moduleIdToSourceMapping, + ([key, source]) => `${JSON.stringify(key)}: ${source.source()}` + ).join(",\n") + ), + "};", + + initialConsumes.length > 0 + ? Template.asString([ + `var initialConsumes = ${JSON.stringify(initialConsumes)};`, + `initialConsumes.forEach(${runtimeTemplate.basicFunction("id", [ + `${ + RuntimeGlobals.moduleFactories + }[id] = ${runtimeTemplate.basicFunction("module", [ + "// Handle case when module is used sync", + "installedModules[id] = 0;", + `delete ${RuntimeGlobals.moduleCache}[id];`, + "var factory = moduleToHandlerMapping[id]();", + 'if(typeof factory !== "function") throw new Error("Shared module is not available for eager consumption: " + id);', + `module.exports = factory();` + ])}` + ])});` + ]) + : "// no consumes in initial chunks", + this._runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers) + ? Template.asString([ + `var chunkMapping = ${JSON.stringify( + chunkToModuleMapping, + null, + "\t" + )};`, + `${ + RuntimeGlobals.ensureChunkHandlers + }.consumes = ${runtimeTemplate.basicFunction("chunkId, promises", [ + `if(${RuntimeGlobals.hasOwnProperty}(chunkMapping, chunkId)) {`, + Template.indent([ + `chunkMapping[chunkId].forEach(${runtimeTemplate.basicFunction( + "id", + [ + `if(${RuntimeGlobals.hasOwnProperty}(installedModules, id)) return promises.push(installedModules[id]);`, + `var onFactory = ${runtimeTemplate.basicFunction( + "factory", + [ + "installedModules[id] = 0;", + `${ + RuntimeGlobals.moduleFactories + }[id] = ${runtimeTemplate.basicFunction("module", [ + `delete ${RuntimeGlobals.moduleCache}[id];`, + "module.exports = factory();" + ])}` + ] + )};`, + `var onError = ${runtimeTemplate.basicFunction("error", [ + "delete installedModules[id];", + `${ + RuntimeGlobals.moduleFactories + }[id] = ${runtimeTemplate.basicFunction("module", [ + `delete ${RuntimeGlobals.moduleCache}[id];`, + "throw error;" + ])}` + ])};`, + "try {", + Template.indent([ + "var promise = moduleToHandlerMapping[id]();", + "if(promise.then) {", + Template.indent( + "promises.push(installedModules[id] = promise.then(onFactory)['catch'](onError));" + ), + "} else onFactory(promise);" + ]), + "} catch(e) { onError(e); }" + ] + )});` + ]), + "}" + ])}` + ]) + : "// no chunk loading of consumes" + ]); + } +} + +module.exports = ConsumeSharedRuntimeModule; + + +/***/ }), + +/***/ 40017: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ModuleDependency = __webpack_require__(80321); +const makeSerializable = __webpack_require__(33032); + +class ProvideForSharedDependency extends ModuleDependency { + /** + * + * @param {string} request request string + */ + constructor(request) { + super(request); + } + + get type() { + return "provide module for shared"; + } + + get category() { + return "esm"; + } +} + +makeSerializable( + ProvideForSharedDependency, + "webpack/lib/sharing/ProvideForSharedDependency" +); + +module.exports = ProvideForSharedDependency; + + +/***/ }), + +/***/ 1798: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const Dependency = __webpack_require__(54912); +const makeSerializable = __webpack_require__(33032); + +class ProvideSharedDependency extends Dependency { + constructor(shareScope, name, version, request, eager) { + super(); + this.shareScope = shareScope; + this.name = name; + this.version = version; + this.request = request; + this.eager = eager; + } + + get type() { + return "provide shared module"; + } + + /** + * @returns {string | null} an identifier to merge equal requests + */ + getResourceIdentifier() { + return `provide module (${this.shareScope}) ${this.request} as ${ + this.name + } @ ${this.version}${this.eager ? " (eager)" : ""}`; + } + + serialize(context) { + context.write(this.shareScope); + context.write(this.name); + context.write(this.request); + context.write(this.version); + context.write(this.eager); + super.serialize(context); + } + + static deserialize(context) { + const { read } = context; + const obj = new ProvideSharedDependency( + read(), + read(), + read(), + read(), + read() + ); + this.shareScope = context.read(); + obj.deserialize(context); + return obj; + } +} + +makeSerializable( + ProvideSharedDependency, + "webpack/lib/sharing/ProvideSharedDependency" +); + +module.exports = ProvideSharedDependency; + + +/***/ }), + +/***/ 50821: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy +*/ + + + +const AsyncDependenciesBlock = __webpack_require__(47736); +const Module = __webpack_require__(73208); +const RuntimeGlobals = __webpack_require__(16475); +const makeSerializable = __webpack_require__(33032); +const ProvideForSharedDependency = __webpack_require__(40017); + +/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ +/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/Hash")} Hash */ +/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ + +const TYPES = new Set(["share-init"]); + +class ProvideSharedModule extends Module { + /** + * @param {string} shareScope shared scope name + * @param {string} name shared key + * @param {string | false} version version + * @param {string} request request to the provided module + * @param {boolean} eager include the module in sync way + */ + constructor(shareScope, name, version, request, eager) { + super("provide-module"); + this._shareScope = shareScope; + this._name = name; + this._version = version; + this._request = request; + this._eager = eager; + } + + /** + * @returns {string} a unique identifier of the module + */ + identifier() { + return `provide module (${this._shareScope}) ${this._name}@${this._version} = ${this._request}`; + } + + /** + * @param {RequestShortener} requestShortener the request shortener + * @returns {string} a user readable identifier of the module + */ + readableIdentifier(requestShortener) { + return `provide shared module (${this._shareScope}) ${this._name}@${ + this._version + } = ${requestShortener.shorten(this._request)}`; + } + + /** + * @param {LibIdentOptions} options options + * @returns {string | null} an identifier for library inclusion + */ + libIdent(options) { + return `${this.layer ? `(${this.layer})/` : ""}webpack/sharing/provide/${ + this._shareScope + }/${this._name}`; + } + + /** + * @param {NeedBuildContext} context context info + * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild + * @returns {void} + */ + needBuild(context, callback) { + callback(null, !this.buildInfo); + } + + /** + * @param {WebpackOptions} options webpack options + * @param {Compilation} compilation the compilation + * @param {ResolverWithOptions} resolver the resolver + * @param {InputFileSystem} fs the file system + * @param {function(WebpackError=): void} callback callback function + * @returns {void} + */ + build(options, compilation, resolver, fs, callback) { + this.buildMeta = {}; + this.buildInfo = { + strict: true + }; + + this.clearDependenciesAndBlocks(); + const dep = new ProvideForSharedDependency(this._request); + if (this._eager) { + this.addDependency(dep); + } else { + const block = new AsyncDependenciesBlock({}); + block.addDependency(dep); + this.addBlock(block); + } + + callback(); + } + + /** + * @param {string=} type the source type for which the size should be estimated + * @returns {number} the estimated size of the module (must be non-zero) + */ + size(type) { + return 42; + } + + /** + * @returns {Set} types available (do not mutate) + */ + getSourceTypes() { + return TYPES; + } + + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { + const runtimeRequirements = new Set([RuntimeGlobals.initializeSharing]); + const code = `register(${JSON.stringify(this._name)}, ${JSON.stringify( + this._version || "0" + )}, ${ + this._eager + ? runtimeTemplate.syncModuleFactory({ + dependency: this.dependencies[0], + chunkGraph, + request: this._request, + runtimeRequirements + }) + : runtimeTemplate.asyncModuleFactory({ + block: this.blocks[0], + chunkGraph, + request: this._request, + runtimeRequirements + }) + }${this._eager ? ", 1" : ""});`; + const sources = new Map(); + const data = new Map(); + data.set("share-init", [ + { + shareScope: this._shareScope, + initStage: 10, + init: code + } + ]); + return { sources, data, runtimeRequirements }; + } + + serialize(context) { + const { write } = context; + write(this._shareScope); + write(this._name); + write(this._version); + write(this._request); + write(this._eager); + super.serialize(context); + } + + static deserialize(context) { + const { read } = context; + const obj = new ProvideSharedModule(read(), read(), read(), read(), read()); + obj.deserialize(context); + return obj; + } +} + +makeSerializable( + ProvideSharedModule, + "webpack/lib/sharing/ProvideSharedModule" +); + +module.exports = ProvideSharedModule; + + +/***/ }), + +/***/ 39344: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy +*/ + + + +const ModuleFactory = __webpack_require__(51010); +const ProvideSharedModule = __webpack_require__(50821); + +/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ +/** @typedef {import("../ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ +/** @typedef {import("./ProvideSharedDependency")} ProvideSharedDependency */ + +class ProvideSharedModuleFactory extends ModuleFactory { + /** + * @param {ModuleFactoryCreateData} data data object + * @param {function(Error=, ModuleFactoryResult=): void} callback callback + * @returns {void} + */ + create(data, callback) { + const dep = /** @type {ProvideSharedDependency} */ (data.dependencies[0]); + callback(null, { + module: new ProvideSharedModule( + dep.shareScope, + dep.name, + dep.version, + dep.request, + dep.eager + ) + }); + } +} + +module.exports = ProvideSharedModuleFactory; + + +/***/ }), + +/***/ 31225: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy +*/ + + + +const WebpackError = __webpack_require__(53799); +const { parseOptions } = __webpack_require__(3083); +const createSchemaValidation = __webpack_require__(32540); +const ProvideForSharedDependency = __webpack_require__(40017); +const ProvideSharedDependency = __webpack_require__(1798); +const ProvideSharedModuleFactory = __webpack_require__(39344); + +/** @typedef {import("../../declarations/plugins/sharing/ProvideSharedPlugin").ProvideSharedPluginOptions} ProvideSharedPluginOptions */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Compiler")} Compiler */ + +const validate = createSchemaValidation( + __webpack_require__(91924), + () => __webpack_require__(438), + { + name: "Provide Shared Plugin", + baseDataPath: "options" + } +); + +/** + * @typedef {Object} ProvideOptions + * @property {string} shareKey + * @property {string} shareScope + * @property {string | undefined | false} version + * @property {boolean} eager + */ + +/** @typedef {Map} ResolvedProvideMap */ + +class ProvideSharedPlugin { + /** + * @param {ProvideSharedPluginOptions} options options + */ + constructor(options) { + validate(options); + + /** @type {[string, ProvideOptions][]} */ + this._provides = parseOptions( + options.provides, + item => { + if (Array.isArray(item)) + throw new Error("Unexpected array of provides"); + /** @type {ProvideOptions} */ + const result = { + shareKey: item, + version: undefined, + shareScope: options.shareScope || "default", + eager: false + }; + return result; + }, + item => ({ + shareKey: item.shareKey, + version: item.version, + shareScope: item.shareScope || options.shareScope || "default", + eager: !!item.eager + }) + ); + this._provides.sort(([a], [b]) => { + if (a < b) return -1; + if (b < a) return 1; + return 0; + }); + } + + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + /** @type {WeakMap} */ + const compilationData = new WeakMap(); + + compiler.hooks.compilation.tap( + "ProvideSharedPlugin", + (compilation, { normalModuleFactory }) => { + /** @type {ResolvedProvideMap} */ + const resolvedProvideMap = new Map(); + /** @type {Map} */ + const matchProvides = new Map(); + /** @type {Map} */ + const prefixMatchProvides = new Map(); + for (const [request, config] of this._provides) { + if (/^(\/|[A-Za-z]:\\|\\\\|\.\.?(\/|$))/.test(request)) { + // relative request + resolvedProvideMap.set(request, { + config, + version: config.version + }); + } else if (/^(\/|[A-Za-z]:\\|\\\\)/.test(request)) { + // absolute path + resolvedProvideMap.set(request, { + config, + version: config.version + }); + } else if (request.endsWith("/")) { + // module request prefix + prefixMatchProvides.set(request, config); + } else { + // module request + matchProvides.set(request, config); + } + } + compilationData.set(compilation, resolvedProvideMap); + const provideSharedModule = ( + key, + config, + resource, + resourceResolveData + ) => { + let version = config.version; + if (version === undefined) { + let details = ""; + if (!resourceResolveData) { + details = `No resolve data provided from resolver.`; + } else { + const descriptionFileData = + resourceResolveData.descriptionFileData; + if (!descriptionFileData) { + details = + "No description file (usually package.json) found. Add description file with name and version, or manually specify version in shared config."; + } else if (!descriptionFileData.version) { + details = + "No version in description file (usually package.json). Add version to description file, or manually specify version in shared config."; + } else { + version = descriptionFileData.version; + } + } + if (!version) { + const error = new WebpackError( + `No version specified and unable to automatically determine one. ${details}` + ); + error.file = `shared module ${key} -> ${resource}`; + compilation.warnings.push(error); + } + } + resolvedProvideMap.set(resource, { + config, + version + }); + }; + normalModuleFactory.hooks.module.tap( + "ProvideSharedPlugin", + (module, { resource, resourceResolveData }, resolveData) => { + if (resolvedProvideMap.has(resource)) { + return module; + } + const { request } = resolveData; + { + const config = matchProvides.get(request); + if (config !== undefined) { + provideSharedModule( + request, + config, + resource, + resourceResolveData + ); + resolveData.cacheable = false; + } + } + for (const [prefix, config] of prefixMatchProvides) { + if (request.startsWith(prefix)) { + const remainder = request.slice(prefix.length); + provideSharedModule( + resource, + { + ...config, + shareKey: config.shareKey + remainder + }, + resource, + resourceResolveData + ); + resolveData.cacheable = false; + } + } + return module; + } + ); + } + ); + compiler.hooks.finishMake.tapPromise("ProvideSharedPlugin", compilation => { + const resolvedProvideMap = compilationData.get(compilation); + if (!resolvedProvideMap) return Promise.resolve(); + return Promise.all( + Array.from( + resolvedProvideMap, + ([resource, { config, version }]) => + new Promise((resolve, reject) => { + compilation.addInclude( + compiler.context, + new ProvideSharedDependency( + config.shareScope, + config.shareKey, + version || false, + resource, + config.eager + ), + { + name: undefined + }, + err => { + if (err) return reject(err); + resolve(); } - }); + ); + }) + ) + ).then(() => {}); + }); + + compiler.hooks.compilation.tap( + "ProvideSharedPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + ProvideForSharedDependency, + normalModuleFactory + ); + + compilation.dependencyFactories.set( + ProvideSharedDependency, + new ProvideSharedModuleFactory() + ); + } + ); + } +} + +module.exports = ProvideSharedPlugin; + + +/***/ }), + +/***/ 26335: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy +*/ + + + +const { parseOptions } = __webpack_require__(3083); +const ConsumeSharedPlugin = __webpack_require__(15046); +const ProvideSharedPlugin = __webpack_require__(31225); +const { isRequiredVersion } = __webpack_require__(84379); + +/** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumeSharedPluginOptions} ConsumeSharedPluginOptions */ +/** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumesConfig} ConsumesConfig */ +/** @typedef {import("../../declarations/plugins/sharing/ProvideSharedPlugin").ProvideSharedPluginOptions} ProvideSharedPluginOptions */ +/** @typedef {import("../../declarations/plugins/sharing/ProvideSharedPlugin").ProvidesConfig} ProvidesConfig */ +/** @typedef {import("../../declarations/plugins/sharing/SharePlugin").SharePluginOptions} SharePluginOptions */ +/** @typedef {import("../../declarations/plugins/sharing/SharePlugin").SharedConfig} SharedConfig */ +/** @typedef {import("../Compiler")} Compiler */ + +class SharePlugin { + /** + * @param {SharePluginOptions} options options + */ + constructor(options) { + /** @type {[string, SharedConfig][]} */ + const sharedOptions = parseOptions( + options.shared, + (item, key) => { + if (typeof item !== "string") + throw new Error("Unexpected array in shared"); + /** @type {SharedConfig} */ + const config = + item === key || !isRequiredVersion(item) + ? { + import: item + } + : { + import: key, + requiredVersion: item + }; + return config; + }, + item => item + ); + /** @type {Record[]} */ + const consumes = sharedOptions.map(([key, options]) => ({ + [key]: { + import: options.import, + shareKey: options.shareKey || key, + shareScope: options.shareScope, + requiredVersion: options.requiredVersion, + strictVersion: options.strictVersion, + singleton: options.singleton, + packageName: options.packageName, + eager: options.eager + } + })); + /** @type {Record[]} */ + const provides = sharedOptions + .filter(([, options]) => options.import !== false) + .map(([key, options]) => ({ + [options.import || key]: { + shareKey: options.shareKey || key, + shareScope: options.shareScope, + version: options.version, + eager: options.eager + } + })); + this._shareScope = options.shareScope; + this._consumes = consumes; + this._provides = provides; + } + + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + new ConsumeSharedPlugin({ + shareScope: this._shareScope, + consumes: this._consumes + }).apply(compiler); + new ProvideSharedPlugin({ + shareScope: this._shareScope, + provides: this._provides + }).apply(compiler); + } +} + +module.exports = SharePlugin; + + +/***/ }), + +/***/ 96066: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); +const { + compareModulesByIdentifier, + compareStrings +} = __webpack_require__(29579); + +class ShareRuntimeModule extends RuntimeModule { + constructor() { + super("sharing"); + } + + /** + * @returns {string} runtime code + */ + generate() { + const { compilation, chunkGraph } = this; + const { + runtimeTemplate, + codeGenerationResults, + outputOptions: { uniqueName } + } = compilation; + /** @type {Map>>} */ + const initCodePerScope = new Map(); + for (const chunk of this.chunk.getAllReferencedChunks()) { + const modules = chunkGraph.getOrderedChunkModulesIterableBySourceType( + chunk, + "share-init", + compareModulesByIdentifier + ); + if (!modules) continue; + for (const m of modules) { + const data = codeGenerationResults.getData( + m, + chunk.runtime, + "share-init" + ); + if (!data) continue; + for (const item of data) { + const { shareScope, initStage, init } = item; + let stages = initCodePerScope.get(shareScope); + if (stages === undefined) { + initCodePerScope.set(shareScope, (stages = new Map())); + } + let list = stages.get(initStage || 0); + if (list === undefined) { + stages.set(initStage || 0, (list = new Set())); + } + list.add(init); + } + } + } + return Template.asString([ + `${RuntimeGlobals.shareScopeMap} = {};`, + "var initPromises = {};", + "var initTokens = {};", + `${RuntimeGlobals.initializeSharing} = ${runtimeTemplate.basicFunction( + "name, initScope", + [ + "if(!initScope) initScope = [];", + "// handling circular init calls", + "var initToken = initTokens[name];", + "if(!initToken) initToken = initTokens[name] = {};", + "if(initScope.indexOf(initToken) >= 0) return;", + "initScope.push(initToken);", + "// only runs once", + "if(initPromises[name]) return initPromises[name];", + "// creates a new share scope if needed", + `if(!${RuntimeGlobals.hasOwnProperty}(${RuntimeGlobals.shareScopeMap}, name)) ${RuntimeGlobals.shareScopeMap}[name] = {};`, + "// runs all init snippets from all modules reachable", + `var scope = ${RuntimeGlobals.shareScopeMap}[name];`, + `var warn = ${runtimeTemplate.returningFunction( + 'typeof console !== "undefined" && console.warn && console.warn(msg)', + "msg" + )};`, + `var uniqueName = ${JSON.stringify(uniqueName || undefined)};`, + `var register = ${runtimeTemplate.basicFunction( + "name, version, factory, eager", + [ + "var versions = scope[name] = scope[name] || {};", + "var activeVersion = versions[version];", + "if(!activeVersion || (!activeVersion.loaded && (!eager != !activeVersion.eager ? eager : uniqueName > activeVersion.from))) versions[version] = { get: factory, from: uniqueName, eager: !!eager };" + ] + )};`, + `var initExternal = ${runtimeTemplate.basicFunction("id", [ + `var handleError = ${runtimeTemplate.expressionFunction( + 'warn("Initialization of sharing external failed: " + err)', + "err" + )};`, + "try {", + Template.indent([ + "var module = __webpack_require__(id);", + "if(!module) return;", + `var initFn = ${runtimeTemplate.returningFunction( + `module && module.init && module.init(${RuntimeGlobals.shareScopeMap}[name], initScope)`, + "module" + )}`, + "if(module.then) return promises.push(module.then(initFn, handleError));", + "var initResult = initFn(module);", + "if(initResult && initResult.then) return promises.push(initResult['catch'](handleError));" + ]), + "} catch(err) { handleError(err); }" + ])}`, + "var promises = [];", + "switch(name) {", + ...Array.from(initCodePerScope) + .sort(([a], [b]) => compareStrings(a, b)) + .map(([name, stages]) => + Template.indent([ + `case ${JSON.stringify(name)}: {`, + Template.indent( + Array.from(stages) + .sort(([a], [b]) => a - b) + .map(([, initCode]) => + Template.asString(Array.from(initCode)) + ) + ), + "}", + "break;" + ]) + ), + "}", + "if(!promises.length) return initPromises[name] = 1;", + `return initPromises[name] = Promise.all(promises).then(${runtimeTemplate.returningFunction( + "initPromises[name] = 1" + )});` + ] + )};` + ]); + } +} + +module.exports = ShareRuntimeModule; + + +/***/ }), + +/***/ 3591: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const ModuleNotFoundError = __webpack_require__(32882); +const LazySet = __webpack_require__(38938); + +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../ResolverFactory").ResolveOptionsWithDependencyType} ResolveOptionsWithDependencyType */ + +/** + * @template T + * @typedef {Object} MatchedConfigs + * @property {Map} resolved + * @property {Map} unresolved + * @property {Map} prefixed + */ + +/** @type {ResolveOptionsWithDependencyType} */ +const RESOLVE_OPTIONS = { dependencyType: "esm" }; + +/** + * @template T + * @param {Compilation} compilation the compilation + * @param {[string, T][]} configs to be processed configs + * @returns {Promise>} resolved matchers + */ +exports.resolveMatchedConfigs = (compilation, configs) => { + /** @type {Map} */ + const resolved = new Map(); + /** @type {Map} */ + const unresolved = new Map(); + /** @type {Map} */ + const prefixed = new Map(); + const resolveContext = { + /** @type {LazySet} */ + fileDependencies: new LazySet(), + /** @type {LazySet} */ + contextDependencies: new LazySet(), + /** @type {LazySet} */ + missingDependencies: new LazySet() + }; + const resolver = compilation.resolverFactory.get("normal", RESOLVE_OPTIONS); + const context = compilation.compiler.context; + + return Promise.all( + configs.map(([request, config]) => { + if (/^\.\.?(\/|$)/.test(request)) { + // relative request + return new Promise(resolve => { + resolver.resolve( + {}, + context, + request, + resolveContext, + (err, result) => { + if (err || result === false) { + err = err || new Error(`Can't resolve ${request}`); + compilation.errors.push( + new ModuleNotFoundError(null, err, { + name: `shared module ${request}` + }) + ); + return resolve(); + } + resolved.set(result, config); + resolve(); + } + ); + }); + } else if (/^(\/|[A-Za-z]:\\|\\\\)/.test(request)) { + // absolute path + resolved.set(request, config); + } else if (request.endsWith("/")) { + // module request prefix + prefixed.set(request, config); + } else { + // module request + unresolved.set(request, config); + } + }) + ).then(() => { + compilation.contextDependencies.addAll(resolveContext.contextDependencies); + compilation.fileDependencies.addAll(resolveContext.fileDependencies); + compilation.missingDependencies.addAll(resolveContext.missingDependencies); + return { resolved, unresolved, prefixed }; + }); +}; + + +/***/ }), + +/***/ 84379: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { join, dirname, readJson } = __webpack_require__(17139); + +/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ + +/** + * @param {string} str maybe required version + * @returns {boolean} true, if it looks like a version + */ +exports.isRequiredVersion = str => { + return /^([\d^=v<>~]|[*xX]$)/.test(str); +}; + +/** + * + * @param {InputFileSystem} fs file system + * @param {string} directory directory to start looking into + * @param {string[]} descriptionFiles possible description filenames + * @param {function((Error | null)=, {data: object, path: string}=): void} callback callback + */ +const getDescriptionFile = (fs, directory, descriptionFiles, callback) => { + let i = 0; + const tryLoadCurrent = () => { + if (i >= descriptionFiles.length) { + const parentDirectory = dirname(fs, directory); + if (!parentDirectory || parentDirectory === directory) return callback(); + return getDescriptionFile( + fs, + parentDirectory, + descriptionFiles, + callback + ); + } + const filePath = join(fs, directory, descriptionFiles[i]); + readJson(fs, filePath, (err, data) => { + if (err) { + if ("code" in err && err.code === "ENOENT") { + i++; + return tryLoadCurrent(); + } + return callback(err); + } + if (!data || typeof data !== "object" || Array.isArray(data)) { + return callback( + new Error(`Description file ${filePath} is not an object`) + ); + } + callback(null, { data, path: filePath }); + }); + }; + tryLoadCurrent(); +}; +exports.getDescriptionFile = getDescriptionFile; + +exports.getRequiredVersionFromDescriptionFile = (data, packageName) => { + if ( + data.optionalDependencies && + typeof data.optionalDependencies === "object" && + packageName in data.optionalDependencies + ) { + return data.optionalDependencies[packageName]; + } + if ( + data.dependencies && + typeof data.dependencies === "object" && + packageName in data.dependencies + ) { + return data.dependencies[packageName]; + } + if ( + data.peerDependencies && + typeof data.peerDependencies === "object" && + packageName in data.peerDependencies + ) { + return data.peerDependencies[packageName]; + } + if ( + data.devDependencies && + typeof data.devDependencies === "object" && + packageName in data.devDependencies + ) { + return data.devDependencies[packageName]; + } +}; + + +/***/ }), + +/***/ 71760: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const util = __webpack_require__(73837); +const ModuleDependency = __webpack_require__(80321); +const formatLocation = __webpack_require__(16734); +const { LogType } = __webpack_require__(32597); +const AggressiveSplittingPlugin = __webpack_require__(15543); +const SizeLimitsPlugin = __webpack_require__(32557); +const { countIterable } = __webpack_require__(39104); +const { + compareLocations, + compareChunksById, + compareNumbers, + compareIds, + concatComparators, + compareSelect, + compareModulesByIdentifier +} = __webpack_require__(29579); +const { makePathsRelative, parseResource } = __webpack_require__(82186); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ +/** @typedef {import("../ChunkGroup").OriginRecord} OriginRecord */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Compilation").Asset} Asset */ +/** @typedef {import("../Compilation").AssetInfo} AssetInfo */ +/** @typedef {import("../Compilation").NormalizedStatsOptions} NormalizedStatsOptions */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ +/** @typedef {import("../ModuleProfile")} ModuleProfile */ +/** @typedef {import("../RequestShortener")} RequestShortener */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @template T @typedef {import("../util/comparators").Comparator} Comparator */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +/** @typedef {import("../util/smartGrouping").GroupConfig} GroupConfig */ +/** @typedef {import("./StatsFactory")} StatsFactory */ +/** @typedef {import("./StatsFactory").StatsFactoryContext} StatsFactoryContext */ + +/** @typedef {KnownStatsCompilation & Record} StatsCompilation */ +/** + * @typedef {Object} KnownStatsCompilation + * @property {any=} env + * @property {string=} name + * @property {string=} hash + * @property {string=} version + * @property {number=} time + * @property {number=} builtAt + * @property {boolean=} needAdditionalPass + * @property {string=} publicPath + * @property {string=} outputPath + * @property {Record=} assetsByChunkName + * @property {StatsAsset[]=} assets + * @property {number=} filteredAssets + * @property {StatsChunk[]=} chunks + * @property {StatsModule[]=} modules + * @property {number=} filteredModules + * @property {Record=} entrypoints + * @property {Record=} namedChunkGroups + * @property {StatsError[]=} errors + * @property {number=} errorsCount + * @property {StatsError[]=} warnings + * @property {number=} warningsCount + * @property {StatsCompilation[]=} children + * @property {Record=} logging + */ + +/** @typedef {KnownStatsLogging & Record} StatsLogging */ +/** + * @typedef {Object} KnownStatsLogging + * @property {StatsLoggingEntry[]} entries + * @property {number} filteredEntries + * @property {boolean} debug + */ + +/** @typedef {KnownStatsLoggingEntry & Record} StatsLoggingEntry */ +/** + * @typedef {Object} KnownStatsLoggingEntry + * @property {string} type + * @property {string} message + * @property {string[]=} trace + * @property {StatsLoggingEntry[]=} children + * @property {any[]=} args + * @property {number=} time + */ + +/** @typedef {KnownStatsAsset & Record} StatsAsset */ +/** + * @typedef {Object} KnownStatsAsset + * @property {string} type + * @property {string} name + * @property {AssetInfo} info + * @property {number} size + * @property {boolean} emitted + * @property {boolean} comparedForEmit + * @property {boolean} cached + * @property {StatsAsset[]=} related + * @property {(string|number)[]=} chunkNames + * @property {(string|number)[]=} chunkIdHints + * @property {(string|number)[]=} chunks + * @property {(string|number)[]=} auxiliaryChunkNames + * @property {(string|number)[]=} auxiliaryChunks + * @property {(string|number)[]=} auxiliaryChunkIdHints + * @property {number=} filteredRelated + * @property {boolean=} isOverSizeLimit + */ + +/** @typedef {KnownStatsChunkGroup & Record} StatsChunkGroup */ +/** + * @typedef {Object} KnownStatsChunkGroup + * @property {string=} name + * @property {(string|number)[]=} chunks + * @property {({ name: string, size?: number })[]=} assets + * @property {number=} filteredAssets + * @property {number=} assetsSize + * @property {({ name: string, size?: number })[]=} auxiliaryAssets + * @property {number=} filteredAuxiliaryAssets + * @property {number=} auxiliaryAssetsSize + * @property {{ [x: string]: StatsChunkGroup[] }=} children + * @property {{ [x: string]: string[] }=} childAssets + * @property {boolean=} isOverSizeLimit + */ + +/** @typedef {KnownStatsModule & Record} StatsModule */ +/** + * @typedef {Object} KnownStatsModule + * @property {string=} type + * @property {string=} moduleType + * @property {string=} layer + * @property {string=} identifier + * @property {string=} name + * @property {string=} nameForCondition + * @property {number=} index + * @property {number=} preOrderIndex + * @property {number=} index2 + * @property {number=} postOrderIndex + * @property {number=} size + * @property {{[x: string]: number}=} sizes + * @property {boolean=} cacheable + * @property {boolean=} built + * @property {boolean=} codeGenerated + * @property {boolean=} buildTimeExecuted + * @property {boolean=} cached + * @property {boolean=} optional + * @property {boolean=} orphan + * @property {string|number=} id + * @property {string|number=} issuerId + * @property {(string|number)[]=} chunks + * @property {(string|number)[]=} assets + * @property {boolean=} dependent + * @property {string=} issuer + * @property {string=} issuerName + * @property {StatsModuleIssuer[]=} issuerPath + * @property {boolean=} failed + * @property {number=} errors + * @property {number=} warnings + * @property {StatsProfile=} profile + * @property {StatsModuleReason[]=} reasons + * @property {(boolean | string[])=} usedExports + * @property {string[]=} providedExports + * @property {string[]=} optimizationBailout + * @property {number=} depth + * @property {StatsModule[]=} modules + * @property {number=} filteredModules + * @property {ReturnType=} source + */ + +/** @typedef {KnownStatsProfile & Record} StatsProfile */ +/** + * @typedef {Object} KnownStatsProfile + * @property {number} total + * @property {number} resolving + * @property {number} restoring + * @property {number} building + * @property {number} integration + * @property {number} storing + * @property {number} additionalResolving + * @property {number} additionalIntegration + * @property {number} factory + * @property {number} dependencies + */ + +/** @typedef {KnownStatsModuleIssuer & Record} StatsModuleIssuer */ +/** + * @typedef {Object} KnownStatsModuleIssuer + * @property {string=} identifier + * @property {string=} name + * @property {(string|number)=} id + * @property {StatsProfile=} profile + */ + +/** @typedef {KnownStatsModuleReason & Record} StatsModuleReason */ +/** + * @typedef {Object} KnownStatsModuleReason + * @property {string=} moduleIdentifier + * @property {string=} module + * @property {string=} moduleName + * @property {string=} resolvedModuleIdentifier + * @property {string=} resolvedModule + * @property {string=} type + * @property {boolean} active + * @property {string=} explanation + * @property {string=} userRequest + * @property {string=} loc + * @property {(string|number)=} moduleId + * @property {(string|number)=} resolvedModuleId + */ + +/** @typedef {KnownStatsChunk & Record} StatsChunk */ +/** + * @typedef {Object} KnownStatsChunk + * @property {boolean} rendered + * @property {boolean} initial + * @property {boolean} entry + * @property {boolean} recorded + * @property {string=} reason + * @property {number} size + * @property {Record=} sizes + * @property {string[]=} names + * @property {string[]=} idHints + * @property {string[]=} runtime + * @property {string[]=} files + * @property {string[]=} auxiliaryFiles + * @property {string} hash + * @property {Record=} childrenByOrder + * @property {(string|number)=} id + * @property {(string|number)[]=} siblings + * @property {(string|number)[]=} parents + * @property {(string|number)[]=} children + * @property {StatsModule[]=} modules + * @property {number=} filteredModules + * @property {StatsChunkOrigin[]=} origins + */ + +/** @typedef {KnownStatsChunkOrigin & Record} StatsChunkOrigin */ +/** + * @typedef {Object} KnownStatsChunkOrigin + * @property {string=} module + * @property {string=} moduleIdentifier + * @property {string=} moduleName + * @property {string=} loc + * @property {string=} request + * @property {(string|number)=} moduleId + */ + +/** @typedef {KnownStatsModuleTraceItem & Record} StatsModuleTraceItem */ +/** + * @typedef {Object} KnownStatsModuleTraceItem + * @property {string=} originIdentifier + * @property {string=} originName + * @property {string=} moduleIdentifier + * @property {string=} moduleName + * @property {StatsModuleTraceDependency[]=} dependencies + * @property {(string|number)=} originId + * @property {(string|number)=} moduleId + */ + +/** @typedef {KnownStatsModuleTraceDependency & Record} StatsModuleTraceDependency */ +/** + * @typedef {Object} KnownStatsModuleTraceDependency + * @property {string=} loc + */ + +/** @typedef {KnownStatsError & Record} StatsError */ +/** + * @typedef {Object} KnownStatsError + * @property {string} message + * @property {string=} chunkName + * @property {boolean=} chunkEntry + * @property {boolean=} chunkInitial + * @property {string=} file + * @property {string=} moduleIdentifier + * @property {string=} moduleName + * @property {string=} loc + * @property {string|number=} chunkId + * @property {string|number=} moduleId + * @property {StatsModuleTraceItem[]=} moduleTrace + * @property {any=} details + * @property {string=} stack + */ + +/** @typedef {Asset & { type: string, related: PreprocessedAsset[] }} PreprocessedAsset */ + +/** + * @template T + * @template O + * @typedef {Record void>} ExtractorsByOption + */ + +/** + * @typedef {Object} SimpleExtractors + * @property {ExtractorsByOption} compilation + * @property {ExtractorsByOption} asset + * @property {ExtractorsByOption} asset$visible + * @property {ExtractorsByOption<{ name: string, chunkGroup: ChunkGroup }, StatsChunkGroup>} chunkGroup + * @property {ExtractorsByOption} module + * @property {ExtractorsByOption} module$visible + * @property {ExtractorsByOption} moduleIssuer + * @property {ExtractorsByOption} profile + * @property {ExtractorsByOption} moduleReason + * @property {ExtractorsByOption} chunk + * @property {ExtractorsByOption} chunkOrigin + * @property {ExtractorsByOption} error + * @property {ExtractorsByOption} warning + * @property {ExtractorsByOption<{ origin: Module, module: Module }, StatsModuleTraceItem>} moduleTraceItem + * @property {ExtractorsByOption} moduleTraceDependency + */ + +/** + * @template T + * @template I + * @param {Iterable} items items to select from + * @param {function(T): Iterable} selector selector function to select values from item + * @returns {I[]} array of values + */ +const uniqueArray = (items, selector) => { + /** @type {Set} */ + const set = new Set(); + for (const item of items) { + for (const i of selector(item)) { + set.add(i); + } + } + return Array.from(set); +}; + +/** + * @template T + * @template I + * @param {Iterable} items items to select from + * @param {function(T): Iterable} selector selector function to select values from item + * @param {Comparator} comparator comparator function + * @returns {I[]} array of values + */ +const uniqueOrderedArray = (items, selector, comparator) => { + return uniqueArray(items, selector).sort(comparator); +}; + +/** @template T @template R @typedef {{ [P in keyof T]: R }} MappedValues */ + +/** + * @template T + * @template R + * @param {T} obj object to be mapped + * @param {function(T[keyof T], keyof T): R} fn mapping function + * @returns {MappedValues} mapped object + */ +const mapObject = (obj, fn) => { + const newObj = Object.create(null); + for (const key of Object.keys(obj)) { + newObj[key] = fn(obj[key], /** @type {keyof T} */ (key)); + } + return newObj; +}; + +/** + * @param {Compilation} compilation the compilation + * @param {function(Compilation, string): any[]} getItems get items + * @returns {number} total number + */ +const countWithChildren = (compilation, getItems) => { + let count = getItems(compilation, "").length; + for (const child of compilation.children) { + count += countWithChildren(child, (c, type) => + getItems(c, `.children[].compilation${type}`) + ); + } + return count; +}; + +/** @type {ExtractorsByOption} */ +const EXTRACT_ERROR = { + _: (object, error, context, { requestShortener }) => { + // TODO webpack 6 disallow strings in the errors/warnings list + if (typeof error === "string") { + object.message = error; + } else { + if (error.chunk) { + object.chunkName = error.chunk.name; + object.chunkEntry = error.chunk.hasRuntime(); + object.chunkInitial = error.chunk.canBeInitial(); + } + if (error.file) { + object.file = error.file; + } + if (error.module) { + object.moduleIdentifier = error.module.identifier(); + object.moduleName = error.module.readableIdentifier(requestShortener); + } + if (error.loc) { + object.loc = formatLocation(error.loc); + } + object.message = error.message; + } + }, + ids: (object, error, { compilation: { chunkGraph } }) => { + if (typeof error !== "string") { + if (error.chunk) { + object.chunkId = error.chunk.id; + } + if (error.module) { + object.moduleId = chunkGraph.getModuleId(error.module); + } + } + }, + moduleTrace: (object, error, context, options, factory) => { + if (typeof error !== "string" && error.module) { + const { + type, + compilation: { moduleGraph } + } = context; + /** @type {Set} */ + const visitedModules = new Set(); + const moduleTrace = []; + let current = error.module; + while (current) { + if (visitedModules.has(current)) break; // circular (technically impossible, but how knows) + visitedModules.add(current); + const origin = moduleGraph.getIssuer(current); + if (!origin) break; + moduleTrace.push({ origin, module: current }); + current = origin; + } + object.moduleTrace = factory.create( + `${type}.moduleTrace`, + moduleTrace, + context + ); + } + }, + errorDetails: ( + object, + error, + { type, compilation, cachedGetErrors, cachedGetWarnings }, + { errorDetails } + ) => { + if ( + typeof error !== "string" && + (errorDetails === true || + (type.endsWith(".error") && cachedGetErrors(compilation).length < 3)) + ) { + object.details = error.details; + } + }, + errorStack: (object, error) => { + if (typeof error !== "string") { + object.stack = error.stack; + } + } +}; + +/** @type {SimpleExtractors} */ +const SIMPLE_EXTRACTORS = { + compilation: { + _: (object, compilation, context, options) => { + if (!context.makePathsRelative) { + context.makePathsRelative = makePathsRelative.bindContextCache( + compilation.compiler.context, + compilation.compiler.root + ); + } + if (!context.cachedGetErrors) { + const map = new WeakMap(); + context.cachedGetErrors = compilation => { + return ( + map.get(compilation) || + (errors => (map.set(compilation, errors), errors))( + compilation.getErrors() + ) + ); + }; + } + if (!context.cachedGetWarnings) { + const map = new WeakMap(); + context.cachedGetWarnings = compilation => { + return ( + map.get(compilation) || + (warnings => (map.set(compilation, warnings), warnings))( + compilation.getWarnings() + ) + ); + }; + } + if (compilation.name) { + object.name = compilation.name; + } + if (compilation.needAdditionalPass) { + object.needAdditionalPass = true; + } + + const { logging, loggingDebug, loggingTrace } = options; + if (logging || (loggingDebug && loggingDebug.length > 0)) { + const util = __webpack_require__(73837); + object.logging = {}; + let acceptedTypes; + let collapsedGroups = false; + switch (logging) { + default: + acceptedTypes = new Set(); + break; + case "error": + acceptedTypes = new Set([LogType.error]); + break; + case "warn": + acceptedTypes = new Set([LogType.error, LogType.warn]); + break; + case "info": + acceptedTypes = new Set([ + LogType.error, + LogType.warn, + LogType.info + ]); + break; + case "log": + acceptedTypes = new Set([ + LogType.error, + LogType.warn, + LogType.info, + LogType.log, + LogType.group, + LogType.groupEnd, + LogType.groupCollapsed, + LogType.clear + ]); + break; + case "verbose": + acceptedTypes = new Set([ + LogType.error, + LogType.warn, + LogType.info, + LogType.log, + LogType.group, + LogType.groupEnd, + LogType.groupCollapsed, + LogType.profile, + LogType.profileEnd, + LogType.time, + LogType.status, + LogType.clear + ]); + collapsedGroups = true; + break; + } + const cachedMakePathsRelative = makePathsRelative.bindContextCache( + options.context, + compilation.compiler.root + ); + let depthInCollapsedGroup = 0; + for (const [origin, logEntries] of compilation.logging) { + const debugMode = loggingDebug.some(fn => fn(origin)); + if (logging === false && !debugMode) continue; + /** @type {KnownStatsLoggingEntry[]} */ + const groupStack = []; + /** @type {KnownStatsLoggingEntry[]} */ + const rootList = []; + let currentList = rootList; + let processedLogEntries = 0; + for (const entry of logEntries) { + let type = entry.type; + if (!debugMode && !acceptedTypes.has(type)) continue; + + // Expand groups in verbose and debug modes + if ( + type === LogType.groupCollapsed && + (debugMode || collapsedGroups) + ) + type = LogType.group; + + if (depthInCollapsedGroup === 0) { + processedLogEntries++; + } + + if (type === LogType.groupEnd) { + groupStack.pop(); + if (groupStack.length > 0) { + currentList = groupStack[groupStack.length - 1].children; + } else { + currentList = rootList; + } + if (depthInCollapsedGroup > 0) depthInCollapsedGroup--; + continue; + } + let message = undefined; + if (entry.type === LogType.time) { + message = `${entry.args[0]}: ${ + entry.args[1] * 1000 + entry.args[2] / 1000000 + } ms`; + } else if (entry.args && entry.args.length > 0) { + message = util.format(entry.args[0], ...entry.args.slice(1)); } - ); - - const respondWithUrlModule = (url, resourceData, callback) => { - getInfo(url.href, (err, result) => { - if (err) return callback(err); - resourceData.resource = url.href; - resourceData.path = url.origin + url.pathname; - resourceData.query = url.search; - resourceData.fragment = url.hash; - resourceData.context = new URL( - ".", - result.entry.resolved - ).href.slice(0, -1); - resourceData.data.mimetype = result.entry.contentType; - callback(null, true); - }); - }; - normalModuleFactory.hooks.resolveForScheme - .for(scheme) - .tapAsync( - "HttpUriPlugin", - (resourceData, resolveData, callback) => { - respondWithUrlModule( - new URL(resourceData.resource), - resourceData, - callback - ); + /** @type {KnownStatsLoggingEntry} */ + const newEntry = { + ...entry, + type, + message, + trace: loggingTrace ? entry.trace : undefined, + children: + type === LogType.group || type === LogType.groupCollapsed + ? [] + : undefined + }; + currentList.push(newEntry); + if (newEntry.children) { + groupStack.push(newEntry); + currentList = newEntry.children; + if (depthInCollapsedGroup > 0) { + depthInCollapsedGroup++; + } else if (type === LogType.groupCollapsed) { + depthInCollapsedGroup = 1; } + } + } + let name = cachedMakePathsRelative(origin).replace(/\|/g, " "); + if (name in object.logging) { + let i = 1; + while (`${name}#${i}` in object.logging) { + i++; + } + name = `${name}#${i}`; + } + object.logging[name] = { + entries: rootList, + filteredEntries: logEntries.length - processedLogEntries, + debug: debugMode + }; + } + } + }, + hash: (object, compilation) => { + object.hash = compilation.hash; + }, + version: object => { + object.version = (__webpack_require__(32702)/* .version */ .i8); + }, + env: (object, compilation, context, { _env }) => { + object.env = _env; + }, + timings: (object, compilation) => { + object.time = compilation.endTime - compilation.startTime; + }, + builtAt: (object, compilation) => { + object.builtAt = compilation.endTime; + }, + publicPath: (object, compilation) => { + object.publicPath = compilation.getPath( + compilation.outputOptions.publicPath + ); + }, + outputPath: (object, compilation) => { + object.outputPath = compilation.outputOptions.path; + }, + assets: (object, compilation, context, options, factory) => { + const { type } = context; + /** @type {Map} */ + const compilationFileToChunks = new Map(); + /** @type {Map} */ + const compilationAuxiliaryFileToChunks = new Map(); + for (const chunk of compilation.chunks) { + for (const file of chunk.files) { + let array = compilationFileToChunks.get(file); + if (array === undefined) { + array = []; + compilationFileToChunks.set(file, array); + } + array.push(chunk); + } + for (const file of chunk.auxiliaryFiles) { + let array = compilationAuxiliaryFileToChunks.get(file); + if (array === undefined) { + array = []; + compilationAuxiliaryFileToChunks.set(file, array); + } + array.push(chunk); + } + } + /** @type {Map} */ + const assetMap = new Map(); + /** @type {Set} */ + const assets = new Set(); + for (const asset of compilation.getAssets()) { + /** @type {PreprocessedAsset} */ + const item = { + ...asset, + type: "asset", + related: undefined + }; + assets.add(item); + assetMap.set(asset.name, item); + } + for (const item of assetMap.values()) { + const related = item.info.related; + if (!related) continue; + for (const type of Object.keys(related)) { + const relatedEntry = related[type]; + const deps = Array.isArray(relatedEntry) + ? relatedEntry + : [relatedEntry]; + for (const dep of deps) { + const depItem = assetMap.get(dep); + if (!depItem) continue; + assets.delete(depItem); + depItem.type = type; + item.related = item.related || []; + item.related.push(depItem); + } + } + } + + object.assetsByChunkName = {}; + for (const [file, chunks] of compilationFileToChunks) { + for (const chunk of chunks) { + const name = chunk.name; + if (!name) continue; + if ( + !Object.prototype.hasOwnProperty.call( + object.assetsByChunkName, + name + ) + ) { + object.assetsByChunkName[name] = []; + } + object.assetsByChunkName[name].push(file); + } + } + + const groupedAssets = factory.create( + `${type}.assets`, + Array.from(assets), + { + ...context, + compilationFileToChunks, + compilationAuxiliaryFileToChunks + } + ); + const limited = spaceLimited(groupedAssets, options.assetsSpace); + object.assets = limited.children; + object.filteredAssets = limited.filteredChildren; + }, + chunks: (object, compilation, context, options, factory) => { + const { type } = context; + object.chunks = factory.create( + `${type}.chunks`, + Array.from(compilation.chunks), + context + ); + }, + modules: (object, compilation, context, options, factory) => { + const { type } = context; + const array = Array.from(compilation.modules); + const groupedModules = factory.create(`${type}.modules`, array, context); + const limited = spaceLimited(groupedModules, options.modulesSpace); + object.modules = limited.children; + object.filteredModules = limited.filteredChildren; + }, + entrypoints: ( + object, + compilation, + context, + { entrypoints, chunkGroups, chunkGroupAuxiliary, chunkGroupChildren }, + factory + ) => { + const { type } = context; + const array = Array.from(compilation.entrypoints, ([key, value]) => ({ + name: key, + chunkGroup: value + })); + if (entrypoints === "auto" && !chunkGroups) { + if (array.length > 5) return; + if ( + !chunkGroupChildren && + array.every(({ chunkGroup }) => { + if (chunkGroup.chunks.length !== 1) return false; + const chunk = chunkGroup.chunks[0]; + return ( + chunk.files.size === 1 && + (!chunkGroupAuxiliary || chunk.auxiliaryFiles.size === 0) ); - normalModuleFactory.hooks.resolveInScheme - .for(scheme) - .tapAsync("HttpUriPlugin", (resourceData, data, callback) => { - // Only handle relative urls (./xxx, ../xxx, /xxx, //xxx) - if ( - data.dependencyType !== "url" && - !/^\.{0,2}\//.test(resourceData.resource) - ) { - return callback(); - } - respondWithUrlModule( - new URL(resourceData.resource, data.context + "/"), - resourceData, - callback - ); - }); - const hooks = NormalModule.getCompilationHooks(compilation); - hooks.readResourceForScheme - .for(scheme) - .tapAsync("HttpUriPlugin", (resource, module, callback) => { - return getInfo(resource, (err, result) => { - if (err) return callback(err); - module.buildInfo.resourceIntegrity = result.entry.integrity; - callback(null, result.content); - }); - }); - hooks.needBuild.tapAsync( - "HttpUriPlugin", - (module, context, callback) => { - if ( - module.resource && - module.resource.startsWith(`${scheme}://`) - ) { - getInfo(module.resource, (err, result) => { - if (err) return callback(err); - if ( - result.entry.integrity !== - module.buildInfo.resourceIntegrity - ) { - return callback(null, true); + }) + ) { + return; + } + } + object.entrypoints = factory.create( + `${type}.entrypoints`, + array, + context + ); + }, + chunkGroups: (object, compilation, context, options, factory) => { + const { type } = context; + const array = Array.from( + compilation.namedChunkGroups, + ([key, value]) => ({ + name: key, + chunkGroup: value + }) + ); + object.namedChunkGroups = factory.create( + `${type}.namedChunkGroups`, + array, + context + ); + }, + errors: (object, compilation, context, options, factory) => { + const { type, cachedGetErrors } = context; + object.errors = factory.create( + `${type}.errors`, + cachedGetErrors(compilation), + context + ); + }, + errorsCount: (object, compilation, { cachedGetErrors }) => { + object.errorsCount = countWithChildren(compilation, c => + cachedGetErrors(c) + ); + }, + warnings: (object, compilation, context, options, factory) => { + const { type, cachedGetWarnings } = context; + object.warnings = factory.create( + `${type}.warnings`, + cachedGetWarnings(compilation), + context + ); + }, + warningsCount: ( + object, + compilation, + context, + { warningsFilter }, + factory + ) => { + const { type, cachedGetWarnings } = context; + object.warningsCount = countWithChildren(compilation, (c, childType) => { + if (!warningsFilter && warningsFilter.length === 0) + return cachedGetWarnings(c); + return factory + .create(`${type}${childType}.warnings`, cachedGetWarnings(c), context) + .filter(warning => { + const warningString = Object.keys(warning) + .map(key => `${warning[key]}`) + .join("\n"); + return !warningsFilter.some(filter => + filter(warning, warningString) + ); + }); + }); + }, + errorDetails: ( + object, + compilation, + { cachedGetErrors, cachedGetWarnings }, + { errorDetails, errors, warnings } + ) => { + if (errorDetails === "auto") { + if (warnings) { + const warnings = cachedGetWarnings(compilation); + object.filteredWarningDetailsCount = warnings + .map(e => typeof e !== "string" && e.details) + .filter(Boolean).length; + } + if (errors) { + const errors = cachedGetErrors(compilation); + if (errors.length >= 3) { + object.filteredErrorDetailsCount = errors + .map(e => typeof e !== "string" && e.details) + .filter(Boolean).length; + } + } + } + }, + children: (object, compilation, context, options, factory) => { + const { type } = context; + object.children = factory.create( + `${type}.children`, + compilation.children, + context + ); + } + }, + asset: { + _: (object, asset, context, options, factory) => { + const { compilation } = context; + object.type = asset.type; + object.name = asset.name; + object.size = asset.source.size(); + object.emitted = compilation.emittedAssets.has(asset.name); + object.comparedForEmit = compilation.comparedForEmitAssets.has( + asset.name + ); + const cached = !object.emitted && !object.comparedForEmit; + object.cached = cached; + object.info = asset.info; + if (!cached || options.cachedAssets) { + Object.assign( + object, + factory.create(`${context.type}$visible`, asset, context) + ); + } + } + }, + asset$visible: { + _: ( + object, + asset, + { compilation, compilationFileToChunks, compilationAuxiliaryFileToChunks } + ) => { + const chunks = compilationFileToChunks.get(asset.name) || []; + const auxiliaryChunks = + compilationAuxiliaryFileToChunks.get(asset.name) || []; + object.chunkNames = uniqueOrderedArray( + chunks, + c => (c.name ? [c.name] : []), + compareIds + ); + object.chunkIdHints = uniqueOrderedArray( + chunks, + c => Array.from(c.idNameHints), + compareIds + ); + object.auxiliaryChunkNames = uniqueOrderedArray( + auxiliaryChunks, + c => (c.name ? [c.name] : []), + compareIds + ); + object.auxiliaryChunkIdHints = uniqueOrderedArray( + auxiliaryChunks, + c => Array.from(c.idNameHints), + compareIds + ); + object.filteredRelated = asset.related ? asset.related.length : undefined; + }, + relatedAssets: (object, asset, context, options, factory) => { + const { type } = context; + object.related = factory.create( + `${type.slice(0, -8)}.related`, + asset.related, + context + ); + object.filteredRelated = asset.related + ? asset.related.length - object.related.length + : undefined; + }, + ids: ( + object, + asset, + { compilationFileToChunks, compilationAuxiliaryFileToChunks } + ) => { + const chunks = compilationFileToChunks.get(asset.name) || []; + const auxiliaryChunks = + compilationAuxiliaryFileToChunks.get(asset.name) || []; + object.chunks = uniqueOrderedArray(chunks, c => c.ids, compareIds); + object.auxiliaryChunks = uniqueOrderedArray( + auxiliaryChunks, + c => c.ids, + compareIds + ); + }, + performance: (object, asset) => { + object.isOverSizeLimit = SizeLimitsPlugin.isOverSizeLimit(asset.source); + } + }, + chunkGroup: { + _: ( + object, + { name, chunkGroup }, + { compilation, compilation: { moduleGraph, chunkGraph } }, + { ids, chunkGroupAuxiliary, chunkGroupChildren, chunkGroupMaxAssets } + ) => { + const children = + chunkGroupChildren && + chunkGroup.getChildrenByOrders(moduleGraph, chunkGraph); + /** + * @param {string} name Name + * @returns {{ name: string, size: number }} Asset object + */ + const toAsset = name => { + const asset = compilation.getAsset(name); + return { + name, + size: asset ? asset.info.size : -1 + }; + }; + /** @type {(total: number, asset: { size: number }) => number} */ + const sizeReducer = (total, { size }) => total + size; + const assets = uniqueArray(chunkGroup.chunks, c => c.files).map(toAsset); + const auxiliaryAssets = uniqueOrderedArray( + chunkGroup.chunks, + c => c.auxiliaryFiles, + compareIds + ).map(toAsset); + const assetsSize = assets.reduce(sizeReducer, 0); + const auxiliaryAssetsSize = auxiliaryAssets.reduce(sizeReducer, 0); + /** @type {KnownStatsChunkGroup} */ + const statsChunkGroup = { + name, + chunks: ids ? chunkGroup.chunks.map(c => c.id) : undefined, + assets: assets.length <= chunkGroupMaxAssets ? assets : undefined, + filteredAssets: + assets.length <= chunkGroupMaxAssets ? 0 : assets.length, + assetsSize, + auxiliaryAssets: + chunkGroupAuxiliary && auxiliaryAssets.length <= chunkGroupMaxAssets + ? auxiliaryAssets + : undefined, + filteredAuxiliaryAssets: + chunkGroupAuxiliary && auxiliaryAssets.length <= chunkGroupMaxAssets + ? 0 + : auxiliaryAssets.length, + auxiliaryAssetsSize, + children: children + ? mapObject(children, groups => + groups.map(group => { + const assets = uniqueArray(group.chunks, c => c.files).map( + toAsset + ); + const auxiliaryAssets = uniqueOrderedArray( + group.chunks, + c => c.auxiliaryFiles, + compareIds + ).map(toAsset); + + /** @type {KnownStatsChunkGroup} */ + const childStatsChunkGroup = { + name: group.name, + chunks: ids ? group.chunks.map(c => c.id) : undefined, + assets: + assets.length <= chunkGroupMaxAssets ? assets : undefined, + filteredAssets: + assets.length <= chunkGroupMaxAssets ? 0 : assets.length, + auxiliaryAssets: + chunkGroupAuxiliary && + auxiliaryAssets.length <= chunkGroupMaxAssets + ? auxiliaryAssets + : undefined, + filteredAuxiliaryAssets: + chunkGroupAuxiliary && + auxiliaryAssets.length <= chunkGroupMaxAssets + ? 0 + : auxiliaryAssets.length + }; + + return childStatsChunkGroup; + }) + ) + : undefined, + childAssets: children + ? mapObject(children, groups => { + /** @type {Set} */ + const set = new Set(); + for (const group of groups) { + for (const chunk of group.chunks) { + for (const asset of chunk.files) { + set.add(asset); } - callback(); - }); - } else { - return callback(); + } } - } - ); + return Array.from(set); + }) + : undefined + }; + Object.assign(object, statsChunkGroup); + }, + performance: (object, { chunkGroup }) => { + object.isOverSizeLimit = SizeLimitsPlugin.isOverSizeLimit(chunkGroup); + } + }, + module: { + _: (object, module, context, options, factory) => { + const { compilation, type } = context; + const built = compilation.builtModules.has(module); + const codeGenerated = compilation.codeGeneratedModules.has(module); + const buildTimeExecuted = + compilation.buildTimeExecutedModules.has(module); + /** @type {{[x: string]: number}} */ + const sizes = {}; + for (const sourceType of module.getSourceTypes()) { + sizes[sourceType] = module.size(sourceType); + } + /** @type {KnownStatsModule} */ + const statsModule = { + type: "module", + moduleType: module.type, + layer: module.layer, + size: module.size(), + sizes, + built, + codeGenerated, + buildTimeExecuted, + cached: !built && !codeGenerated + }; + Object.assign(object, statsModule); + + if (built || codeGenerated || options.cachedModules) { + Object.assign( + object, + factory.create(`${type}$visible`, module, context) + ); + } + } + }, + module$visible: { + _: (object, module, context, { requestShortener }, factory) => { + const { compilation, type, rootModules } = context; + const { moduleGraph } = compilation; + /** @type {Module[]} */ + const path = []; + const issuer = moduleGraph.getIssuer(module); + let current = issuer; + while (current) { + path.push(current); + current = moduleGraph.getIssuer(current); + } + path.reverse(); + const profile = moduleGraph.getProfile(module); + const errors = module.getErrors(); + const errorsCount = errors !== undefined ? countIterable(errors) : 0; + const warnings = module.getWarnings(); + const warningsCount = + warnings !== undefined ? countIterable(warnings) : 0; + /** @type {{[x: string]: number}} */ + const sizes = {}; + for (const sourceType of module.getSourceTypes()) { + sizes[sourceType] = module.size(sourceType); + } + /** @type {KnownStatsModule} */ + const statsModule = { + identifier: module.identifier(), + name: module.readableIdentifier(requestShortener), + nameForCondition: module.nameForCondition(), + index: moduleGraph.getPreOrderIndex(module), + preOrderIndex: moduleGraph.getPreOrderIndex(module), + index2: moduleGraph.getPostOrderIndex(module), + postOrderIndex: moduleGraph.getPostOrderIndex(module), + cacheable: module.buildInfo.cacheable, + optional: module.isOptional(moduleGraph), + orphan: + !type.endsWith("module.modules[].module$visible") && + compilation.chunkGraph.getNumberOfModuleChunks(module) === 0, + dependent: rootModules ? !rootModules.has(module) : undefined, + issuer: issuer && issuer.identifier(), + issuerName: issuer && issuer.readableIdentifier(requestShortener), + issuerPath: + issuer && + factory.create(`${type.slice(0, -8)}.issuerPath`, path, context), + failed: errorsCount > 0, + errors: errorsCount, + warnings: warningsCount + }; + Object.assign(object, statsModule); + if (profile) { + object.profile = factory.create( + `${type.slice(0, -8)}.profile`, + profile, + context + ); + } + }, + ids: (object, module, { compilation: { chunkGraph, moduleGraph } }) => { + object.id = chunkGraph.getModuleId(module); + const issuer = moduleGraph.getIssuer(module); + object.issuerId = issuer && chunkGraph.getModuleId(issuer); + object.chunks = Array.from( + chunkGraph.getOrderedModuleChunksIterable(module, compareChunksById), + chunk => chunk.id + ); + }, + moduleAssets: (object, module) => { + object.assets = module.buildInfo.assets + ? Object.keys(module.buildInfo.assets) + : []; + }, + reasons: (object, module, context, options, factory) => { + const { + type, + compilation: { moduleGraph } + } = context; + const groupsReasons = factory.create( + `${type.slice(0, -8)}.reasons`, + Array.from(moduleGraph.getIncomingConnections(module)), + context + ); + const limited = spaceLimited(groupsReasons, options.reasonsSpace); + object.reasons = limited.children; + object.filteredReasons = limited.filteredChildren; + }, + usedExports: ( + object, + module, + { runtime, compilation: { moduleGraph } } + ) => { + const usedExports = moduleGraph.getUsedExports(module, runtime); + if (usedExports === null) { + object.usedExports = null; + } else if (typeof usedExports === "boolean") { + object.usedExports = usedExports; + } else { + object.usedExports = Array.from(usedExports); + } + }, + providedExports: (object, module, { compilation: { moduleGraph } }) => { + const providedExports = moduleGraph.getProvidedExports(module); + object.providedExports = Array.isArray(providedExports) + ? providedExports + : null; + }, + optimizationBailout: ( + object, + module, + { compilation: { moduleGraph } }, + { requestShortener } + ) => { + object.optimizationBailout = moduleGraph + .getOptimizationBailout(module) + .map(item => { + if (typeof item === "function") return item(requestShortener); + return item; + }); + }, + depth: (object, module, { compilation: { moduleGraph } }) => { + object.depth = moduleGraph.getDepth(module); + }, + nestedModules: (object, module, context, options, factory) => { + const { type } = context; + const innerModules = /** @type {Module & { modules?: Module[] }} */ ( + module + ).modules; + if (Array.isArray(innerModules)) { + const groupedModules = factory.create( + `${type.slice(0, -8)}.modules`, + innerModules, + context + ); + const limited = spaceLimited( + groupedModules, + options.nestedModulesSpace + ); + object.modules = limited.children; + object.filteredModules = limited.filteredChildren; + } + }, + source: (object, module) => { + const originalSource = module.originalSource(); + if (originalSource) { + object.source = originalSource.source(); + } + } + }, + profile: { + _: (object, profile) => { + /** @type {KnownStatsProfile} */ + const statsProfile = { + total: + profile.factory + + profile.restoring + + profile.integration + + profile.building + + profile.storing, + resolving: profile.factory, + restoring: profile.restoring, + building: profile.building, + integration: profile.integration, + storing: profile.storing, + additionalResolving: profile.additionalFactories, + additionalIntegration: profile.additionalIntegration, + // TODO remove this in webpack 6 + factory: profile.factory, + // TODO remove this in webpack 6 + dependencies: profile.additionalFactories + }; + Object.assign(object, statsProfile); + } + }, + moduleIssuer: { + _: (object, module, context, { requestShortener }, factory) => { + const { compilation, type } = context; + const { moduleGraph } = compilation; + const profile = moduleGraph.getProfile(module); + /** @type {KnownStatsModuleIssuer} */ + const statsModuleIssuer = { + identifier: module.identifier(), + name: module.readableIdentifier(requestShortener) + }; + Object.assign(object, statsModuleIssuer); + if (profile) { + object.profile = factory.create(`${type}.profile`, profile, context); + } + }, + ids: (object, module, { compilation: { chunkGraph } }) => { + object.id = chunkGraph.getModuleId(module); + } + }, + moduleReason: { + _: (object, reason, { runtime }, { requestShortener }) => { + const dep = reason.dependency; + const moduleDep = + dep && dep instanceof ModuleDependency ? dep : undefined; + /** @type {KnownStatsModuleReason} */ + const statsModuleReason = { + moduleIdentifier: reason.originModule + ? reason.originModule.identifier() + : null, + module: reason.originModule + ? reason.originModule.readableIdentifier(requestShortener) + : null, + moduleName: reason.originModule + ? reason.originModule.readableIdentifier(requestShortener) + : null, + resolvedModuleIdentifier: reason.resolvedOriginModule + ? reason.resolvedOriginModule.identifier() + : null, + resolvedModule: reason.resolvedOriginModule + ? reason.resolvedOriginModule.readableIdentifier(requestShortener) + : null, + type: reason.dependency ? reason.dependency.type : null, + active: reason.isActive(runtime), + explanation: reason.explanation, + userRequest: (moduleDep && moduleDep.userRequest) || null + }; + Object.assign(object, statsModuleReason); + if (reason.dependency) { + const locInfo = formatLocation(reason.dependency.loc); + if (locInfo) { + object.loc = locInfo; } - compilation.hooks.finishModules.tapAsync( - "HttpUriPlugin", - (modules, callback) => { - if (!lockfileUpdates) return callback(); - const ext = extname(lockfileLocation); - const tempFile = join( - intermediateFs, - dirname(intermediateFs, lockfileLocation), - `.${basename(lockfileLocation, ext)}.${ - (Math.random() * 10000) | 0 - }${ext}` - ); + } + }, + ids: (object, reason, { compilation: { chunkGraph } }) => { + object.moduleId = reason.originModule + ? chunkGraph.getModuleId(reason.originModule) + : null; + object.resolvedModuleId = reason.resolvedOriginModule + ? chunkGraph.getModuleId(reason.resolvedOriginModule) + : null; + } + }, + chunk: { + _: (object, chunk, { makePathsRelative, compilation: { chunkGraph } }) => { + const childIdByOrder = chunk.getChildIdsByOrders(chunkGraph); - const writeDone = () => { - const nextOperation = inProgressWrite.shift(); - if (nextOperation) { - nextOperation(); - } else { - inProgressWrite = undefined; - } - }; - const runWrite = () => { - intermediateFs.readFile(lockfileLocation, (err, buffer) => { - if (err && err.code !== "ENOENT") { - writeDone(); - return callback(err); - } - const lockfile = buffer - ? Lockfile.parse(buffer.toString("utf-8")) - : new Lockfile(); - for (const [key, value] of lockfileUpdates) { - lockfile.entries.set(key, value); - } - intermediateFs.writeFile(tempFile, lockfile.toString(), err => { - if (err) { - writeDone(); - return intermediateFs.unlink(tempFile, () => callback(err)); - } - intermediateFs.rename(tempFile, lockfileLocation, err => { - if (err) { - writeDone(); - return intermediateFs.unlink(tempFile, () => - callback(err) - ); - } - writeDone(); - callback(); - }); - }); - }); - }; - if (inProgressWrite) { - inProgressWrite.push(runWrite); - } else { - inProgressWrite = []; - runWrite(); - } + /** @type {KnownStatsChunk} */ + const statsChunk = { + rendered: chunk.rendered, + initial: chunk.canBeInitial(), + entry: chunk.hasRuntime(), + recorded: AggressiveSplittingPlugin.wasChunkRecorded(chunk), + reason: chunk.chunkReason, + size: chunkGraph.getChunkModulesSize(chunk), + sizes: chunkGraph.getChunkModulesSizes(chunk), + names: chunk.name ? [chunk.name] : [], + idHints: Array.from(chunk.idNameHints), + runtime: + chunk.runtime === undefined + ? undefined + : typeof chunk.runtime === "string" + ? [makePathsRelative(chunk.runtime)] + : Array.from(chunk.runtime.sort(), makePathsRelative), + files: Array.from(chunk.files), + auxiliaryFiles: Array.from(chunk.auxiliaryFiles).sort(compareIds), + hash: chunk.renderedHash, + childrenByOrder: childIdByOrder + }; + Object.assign(object, statsChunk); + }, + ids: (object, chunk) => { + object.id = chunk.id; + }, + chunkRelations: (object, chunk, { compilation: { chunkGraph } }) => { + /** @type {Set} */ + const parents = new Set(); + /** @type {Set} */ + const children = new Set(); + /** @type {Set} */ + const siblings = new Set(); + + for (const chunkGroup of chunk.groupsIterable) { + for (const parentGroup of chunkGroup.parentsIterable) { + for (const chunk of parentGroup.chunks) { + parents.add(chunk.id); } - ); + } + for (const childGroup of chunkGroup.childrenIterable) { + for (const chunk of childGroup.chunks) { + children.add(chunk.id); + } + } + for (const sibling of chunkGroup.chunks) { + if (sibling !== chunk) siblings.add(sibling.id); + } } - ); + object.siblings = Array.from(siblings).sort(compareIds); + object.parents = Array.from(parents).sort(compareIds); + object.children = Array.from(children).sort(compareIds); + }, + chunkModules: (object, chunk, context, options, factory) => { + const { + type, + compilation: { chunkGraph } + } = context; + const array = chunkGraph.getChunkModules(chunk); + const groupedModules = factory.create(`${type}.modules`, array, { + ...context, + runtime: chunk.runtime, + rootModules: new Set(chunkGraph.getChunkRootModules(chunk)) + }); + const limited = spaceLimited(groupedModules, options.chunkModulesSpace); + object.modules = limited.children; + object.filteredModules = limited.filteredChildren; + }, + chunkOrigins: (object, chunk, context, options, factory) => { + const { + type, + compilation: { chunkGraph } + } = context; + /** @type {Set} */ + const originsKeySet = new Set(); + const origins = []; + for (const g of chunk.groupsIterable) { + origins.push(...g.origins); + } + const array = origins.filter(origin => { + const key = [ + origin.module ? chunkGraph.getModuleId(origin.module) : undefined, + formatLocation(origin.loc), + origin.request + ].join(); + if (originsKeySet.has(key)) return false; + originsKeySet.add(key); + return true; + }); + object.origins = factory.create(`${type}.origins`, array, context); + } + }, + chunkOrigin: { + _: (object, origin, context, { requestShortener }) => { + /** @type {KnownStatsChunkOrigin} */ + const statsChunkOrigin = { + module: origin.module ? origin.module.identifier() : "", + moduleIdentifier: origin.module ? origin.module.identifier() : "", + moduleName: origin.module + ? origin.module.readableIdentifier(requestShortener) + : "", + loc: formatLocation(origin.loc), + request: origin.request + }; + Object.assign(object, statsChunkOrigin); + }, + ids: (object, origin, { compilation: { chunkGraph } }) => { + object.moduleId = origin.module + ? chunkGraph.getModuleId(origin.module) + : undefined; + } + }, + error: EXTRACT_ERROR, + warning: EXTRACT_ERROR, + moduleTraceItem: { + _: (object, { origin, module }, context, { requestShortener }, factory) => { + const { + type, + compilation: { moduleGraph } + } = context; + object.originIdentifier = origin.identifier(); + object.originName = origin.readableIdentifier(requestShortener); + object.moduleIdentifier = module.identifier(); + object.moduleName = module.readableIdentifier(requestShortener); + const dependencies = Array.from( + moduleGraph.getIncomingConnections(module) + ) + .filter(c => c.resolvedOriginModule === origin && c.dependency) + .map(c => c.dependency); + object.dependencies = factory.create( + `${type}.dependencies`, + Array.from(new Set(dependencies)), + context + ); + }, + ids: (object, { origin, module }, { compilation: { chunkGraph } }) => { + object.originId = chunkGraph.getModuleId(origin); + object.moduleId = chunkGraph.getModuleId(module); + } + }, + moduleTraceDependency: { + _: (object, dependency) => { + object.loc = formatLocation(dependency.loc); + } } -} - -module.exports = HttpUriPlugin; - - -/***/ }), - -/***/ 41721: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - +}; -class ArraySerializer { - serialize(array, { write }) { - write(array.length); - for (const item of array) write(item); - } - deserialize({ read }) { - const length = read(); - const array = []; - for (let i = 0; i < length; i++) { - array.push(read()); +/** @type {Record boolean | undefined>>} */ +const FILTER = { + "module.reasons": { + "!orphanModules": (reason, { compilation: { chunkGraph } }) => { + if ( + reason.originModule && + chunkGraph.getNumberOfModuleChunks(reason.originModule) === 0 + ) { + return false; + } } - return array; } -} - -module.exports = ArraySerializer; - - -/***/ }), - -/***/ 97059: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - - -const memoize = __webpack_require__(78676); -const SerializerMiddleware = __webpack_require__(83137); - -/** @typedef {import("./types").BufferSerializableType} BufferSerializableType */ -/** @typedef {import("./types").PrimitiveSerializableType} PrimitiveSerializableType */ - -/* -Format: - -File -> Section* - -Section -> NullsSection | - BooleansSection | - F64NumbersSection | - I32NumbersSection | - I8NumbersSection | - ShortStringSection | - StringSection | - BufferSection | - NopSection - - - -NullsSection -> - NullHeaderByte | Null2HeaderByte | Null3HeaderByte | - Nulls8HeaderByte 0xnn (n:count - 4) | - Nulls32HeaderByte n:ui32 (n:count - 260) | -BooleansSection -> TrueHeaderByte | FalseHeaderByte | BooleansSectionHeaderByte BooleansCountAndBitsByte -F64NumbersSection -> F64NumbersSectionHeaderByte f64* -I32NumbersSection -> I32NumbersSectionHeaderByte i32* -I8NumbersSection -> I8NumbersSectionHeaderByte i8* -ShortStringSection -> ShortStringSectionHeaderByte ascii-byte* -StringSection -> StringSectionHeaderByte i32:length utf8-byte* -BufferSection -> BufferSectionHeaderByte i32:length byte* -NopSection --> NopSectionHeaderByte - -ShortStringSectionHeaderByte -> 0b1nnn_nnnn (n:length) - -F64NumbersSectionHeaderByte -> 0b001n_nnnn (n:count - 1) -I32NumbersSectionHeaderByte -> 0b010n_nnnn (n:count - 1) -I8NumbersSectionHeaderByte -> 0b011n_nnnn (n:count - 1) - -NullsSectionHeaderByte -> 0b0001_nnnn (n:count - 1) -BooleansCountAndBitsByte -> - 0b0000_1xxx (count = 3) | - 0b0001_xxxx (count = 4) | - 0b001x_xxxx (count = 5) | - 0b01xx_xxxx (count = 6) | - 0b1nnn_nnnn (n:count - 7, 7 <= count <= 133) - 0xff n:ui32 (n:count, 134 <= count < 2^32) - -StringSectionHeaderByte -> 0b0000_1110 -BufferSectionHeaderByte -> 0b0000_1111 -NopSectionHeaderByte -> 0b0000_1011 -FalseHeaderByte -> 0b0000_1100 -TrueHeaderByte -> 0b0000_1101 - -RawNumber -> n (n <= 10) - -*/ - -const LAZY_HEADER = 0x0b; -const TRUE_HEADER = 0x0c; -const FALSE_HEADER = 0x0d; -const BOOLEANS_HEADER = 0x0e; -const NULL_HEADER = 0x10; -const NULL2_HEADER = 0x11; -const NULL3_HEADER = 0x12; -const NULLS8_HEADER = 0x13; -const NULLS32_HEADER = 0x14; -const NULL_AND_I8_HEADER = 0x15; -const NULL_AND_I32_HEADER = 0x16; -const NULL_AND_TRUE_HEADER = 0x17; -const NULL_AND_FALSE_HEADER = 0x18; -const STRING_HEADER = 0x1e; -const BUFFER_HEADER = 0x1f; -const I8_HEADER = 0x60; -const I32_HEADER = 0x40; -const F64_HEADER = 0x20; -const SHORT_STRING_HEADER = 0x80; - -/** Uplift high-order bits */ -const NUMBERS_HEADER_MASK = 0xe0; -const NUMBERS_COUNT_MASK = 0x1f; // 0b0001_1111 -const SHORT_STRING_LENGTH_MASK = 0x7f; // 0b0111_1111 - -const HEADER_SIZE = 1; -const I8_SIZE = 1; -const I32_SIZE = 4; -const F64_SIZE = 8; - -const MEASURE_START_OPERATION = Symbol("MEASURE_START_OPERATION"); -const MEASURE_END_OPERATION = Symbol("MEASURE_END_OPERATION"); +}; -/** @typedef {typeof MEASURE_START_OPERATION} MEASURE_START_OPERATION_TYPE */ -/** @typedef {typeof MEASURE_END_OPERATION} MEASURE_END_OPERATION_TYPE */ +/** @type {Record boolean | undefined>>} */ +const FILTER_RESULTS = { + "compilation.warnings": { + warningsFilter: util.deprecate( + (warning, context, { warningsFilter }) => { + const warningString = Object.keys(warning) + .map(key => `${warning[key]}`) + .join("\n"); + return !warningsFilter.some(filter => filter(warning, warningString)); + }, + "config.stats.warningsFilter is deprecated in favor of config.ignoreWarnings", + "DEP_WEBPACK_STATS_WARNINGS_FILTER" + ) + } +}; -const identifyNumber = n => { - if (n === (n | 0)) { - if (n <= 127 && n >= -128) return 0; - if (n <= 2147483647 && n >= -2147483648) return 1; +/** @type {Record void>} */ +const MODULES_SORTER = { + _: (comparators, { compilation: { moduleGraph } }) => { + comparators.push( + compareSelect( + /** + * @param {Module} m module + * @returns {number} depth + */ + m => moduleGraph.getDepth(m), + compareNumbers + ), + compareSelect( + /** + * @param {Module} m module + * @returns {number} index + */ + m => moduleGraph.getPreOrderIndex(m), + compareNumbers + ), + compareSelect( + /** + * @param {Module} m module + * @returns {string} identifier + */ + m => m.identifier(), + compareIds + ) + ); } - return 2; }; -/** - * @typedef {PrimitiveSerializableType[]} DeserializedType - * @typedef {BufferSerializableType[]} SerializedType - * @extends {SerializerMiddleware} - */ -class BinaryMiddleware extends SerializerMiddleware { - /** - * @param {DeserializedType} data data - * @param {Object} context context object - * @returns {SerializedType|Promise} serialized data - */ - serialize(data, context) { - return this._serialize(data, context); +/** @type {Record void>>} */ +const SORTERS = { + "compilation.chunks": { + _: comparators => { + comparators.push(compareSelect(c => c.id, compareIds)); + } + }, + "compilation.modules": MODULES_SORTER, + "chunk.rootModules": MODULES_SORTER, + "chunk.modules": MODULES_SORTER, + "module.modules": MODULES_SORTER, + "module.reasons": { + _: (comparators, { compilation: { chunkGraph } }) => { + comparators.push( + compareSelect(x => x.originModule, compareModulesByIdentifier) + ); + comparators.push( + compareSelect(x => x.resolvedOriginModule, compareModulesByIdentifier) + ); + comparators.push( + compareSelect( + x => x.dependency, + concatComparators( + compareSelect( + /** + * @param {Dependency} x dependency + * @returns {DependencyLocation} location + */ + x => x.loc, + compareLocations + ), + compareSelect(x => x.type, compareIds) + ) + ) + ); + } + }, + "chunk.origins": { + _: (comparators, { compilation: { chunkGraph } }) => { + comparators.push( + compareSelect( + origin => + origin.module ? chunkGraph.getModuleId(origin.module) : undefined, + compareIds + ), + compareSelect(origin => formatLocation(origin.loc), compareIds), + compareSelect(origin => origin.request, compareIds) + ); + } } +}; - _serializeLazy(fn, context) { - return SerializerMiddleware.serializeLazy(fn, data => - this._serialize(data, context) - ); +const getItemSize = item => { + // Each item takes 1 line + // + the size of the children + // + 1 extra line when it has children and filteredChildren + return !item.children + ? 1 + : item.filteredChildren + ? 2 + getTotalSize(item.children) + : 1 + getTotalSize(item.children); +}; + +const getTotalSize = children => { + let size = 0; + for (const child of children) { + size += getItemSize(child); } + return size; +}; - /** - * @param {DeserializedType} data data - * @param {Object} context context object - * @param {{ leftOverBuffer: Buffer | null, allocationSize: number, increaseCounter: number }} allocationScope allocation scope - * @returns {SerializedType} serialized data - */ - _serialize( - data, - context, - allocationScope = { - allocationSize: 1024, - increaseCounter: 0, - leftOverBuffer: null +const getTotalItems = children => { + let count = 0; + for (const child of children) { + if (!child.children && !child.filteredChildren) { + count++; + } else { + if (child.children) count += getTotalItems(child.children); + if (child.filteredChildren) count += child.filteredChildren; } - ) { - /** @type {Buffer} */ - let leftOverBuffer = null; - /** @type {BufferSerializableType[]} */ - let buffers = []; - /** @type {Buffer} */ - let currentBuffer = allocationScope ? allocationScope.leftOverBuffer : null; - allocationScope.leftOverBuffer = null; - let currentPosition = 0; - if (currentBuffer === null) { - currentBuffer = Buffer.allocUnsafe(allocationScope.allocationSize); + } + return count; +}; + +const collapse = children => { + // After collapse each child must take exactly one line + const newChildren = []; + for (const child of children) { + if (child.children) { + let filteredChildren = child.filteredChildren || 0; + filteredChildren += getTotalItems(child.children); + newChildren.push({ + ...child, + children: undefined, + filteredChildren + }); + } else { + newChildren.push(child); } - const allocate = bytesNeeded => { - if (currentBuffer !== null) { - if (currentBuffer.length - currentPosition >= bytesNeeded) return; - flush(); - } - if (leftOverBuffer && leftOverBuffer.length >= bytesNeeded) { - currentBuffer = leftOverBuffer; - leftOverBuffer = null; - } else { - currentBuffer = Buffer.allocUnsafe( - Math.max(bytesNeeded, allocationScope.allocationSize) - ); - if ( - !(allocationScope.increaseCounter = - (allocationScope.increaseCounter + 1) % 4) && - allocationScope.allocationSize < 16777216 - ) { - allocationScope.allocationSize = allocationScope.allocationSize << 1; - } - } - }; - const flush = () => { - if (currentBuffer !== null) { - if (currentPosition > 0) { - buffers.push( - Buffer.from( - currentBuffer.buffer, - currentBuffer.byteOffset, - currentPosition - ) - ); - } - if ( - !leftOverBuffer || - leftOverBuffer.length < currentBuffer.length - currentPosition - ) { - leftOverBuffer = Buffer.from( - currentBuffer.buffer, - currentBuffer.byteOffset + currentPosition, - currentBuffer.byteLength - currentPosition - ); - } + } + return newChildren; +}; - currentBuffer = null; - currentPosition = 0; - } - }; - const writeU8 = byte => { - currentBuffer.writeUInt8(byte, currentPosition++); - }; - const writeU32 = ui32 => { - currentBuffer.writeUInt32LE(ui32, currentPosition); - currentPosition += 4; - }; - const measureStack = []; - const measureStart = () => { - measureStack.push(buffers.length, currentPosition); - }; - const measureEnd = () => { - const oldPos = measureStack.pop(); - const buffersIndex = measureStack.pop(); - let size = currentPosition - oldPos; - for (let i = buffersIndex; i < buffers.length; i++) { - size += buffers[i].length; - } - return size; +const spaceLimited = ( + itemsAndGroups, + max, + filteredChildrenLineReserved = false +) => { + if (max < 1) { + return { + children: undefined, + filteredChildren: getTotalItems(itemsAndGroups) }; - for (let i = 0; i < data.length; i++) { - const thing = data[i]; - switch (typeof thing) { - case "function": { - if (!SerializerMiddleware.isLazy(thing)) - throw new Error("Unexpected function " + thing); - /** @type {SerializedType | (() => SerializedType)} */ - let serializedData = - SerializerMiddleware.getLazySerializedValue(thing); - if (serializedData === undefined) { - if (SerializerMiddleware.isLazy(thing, this)) { - flush(); - allocationScope.leftOverBuffer = leftOverBuffer; - const result = - /** @type {(Exclude>)[]} */ ( - thing() - ); - const data = this._serialize(result, context, allocationScope); - leftOverBuffer = allocationScope.leftOverBuffer; - allocationScope.leftOverBuffer = null; - SerializerMiddleware.setLazySerializedValue(thing, data); - serializedData = data; - } else { - serializedData = this._serializeLazy(thing, context); - flush(); - buffers.push(serializedData); - break; - } - } else { - if (typeof serializedData === "function") { - flush(); - buffers.push(serializedData); - break; - } - } - const lengths = []; - for (const item of serializedData) { - let last; - if (typeof item === "function") { - lengths.push(0); - } else if (item.length === 0) { - // ignore - } else if ( - lengths.length > 0 && - (last = lengths[lengths.length - 1]) !== 0 - ) { - const remaining = 0xffffffff - last; - if (remaining >= item.length) { - lengths[lengths.length - 1] += item.length; - } else { - lengths.push(item.length - remaining); - lengths[lengths.length - 2] = 0xffffffff; - } - } else { - lengths.push(item.length); - } - } - allocate(5 + lengths.length * 4); - writeU8(LAZY_HEADER); - writeU32(lengths.length); - for (const l of lengths) { - writeU32(l); - } - flush(); - for (const item of serializedData) { - buffers.push(item); - } - break; - } - case "string": { - const len = Buffer.byteLength(thing); - if (len >= 128 || len !== thing.length) { - allocate(len + HEADER_SIZE + I32_SIZE); - writeU8(STRING_HEADER); - writeU32(len); - currentBuffer.write(thing, currentPosition); - currentPosition += len; - } else if (len >= 70) { - allocate(len + HEADER_SIZE); - writeU8(SHORT_STRING_HEADER | len); + } + /** @type {any[] | undefined} */ + let children = undefined; + /** @type {number | undefined} */ + let filteredChildren = undefined; + // This are the groups, which take 1+ lines each + const groups = []; + // The sizes of the groups are stored in groupSizes + const groupSizes = []; + // This are the items, which take 1 line each + const items = []; + // The total of group sizes + let groupsSize = 0; - currentBuffer.write(thing, currentPosition, "latin1"); - currentPosition += len; - } else { - allocate(len + HEADER_SIZE); - writeU8(SHORT_STRING_HEADER | len); + for (const itemOrGroup of itemsAndGroups) { + // is item + if (!itemOrGroup.children && !itemOrGroup.filteredChildren) { + items.push(itemOrGroup); + } else { + groups.push(itemOrGroup); + const size = getItemSize(itemOrGroup); + groupSizes.push(size); + groupsSize += size; + } + } - for (let i = 0; i < len; i++) { - currentBuffer[currentPosition++] = thing.charCodeAt(i); - } - } - break; + if (groupsSize + items.length <= max) { + // The total size in the current state fits into the max + // keep all + children = groups.length > 0 ? groups.concat(items) : items; + } else if (groups.length === 0) { + // slice items to max + // inner space marks that lines for filteredChildren already reserved + const limit = max - (filteredChildrenLineReserved ? 0 : 1); + filteredChildren = items.length - limit; + items.length = limit; + children = items; + } else { + // limit is the size when all groups are collapsed + const limit = + groups.length + + (filteredChildrenLineReserved || items.length === 0 ? 0 : 1); + if (limit < max) { + // calculate how much we are over the size limit + // this allows to approach the limit faster + let oversize; + // If each group would take 1 line the total would be below the maximum + // collapse some groups, keep items + while ( + (oversize = + groupsSize + + items.length + + (filteredChildren && !filteredChildrenLineReserved ? 1 : 0) - + max) > 0 + ) { + // Find the maximum group and process only this one + const maxGroupSize = Math.max(...groupSizes); + if (maxGroupSize < items.length) { + filteredChildren = items.length; + items.length = 0; + continue; } - case "number": { - const type = identifyNumber(thing); - if (type === 0 && thing >= 0 && thing <= 10) { - // shortcut for very small numbers - allocate(I8_SIZE); - writeU8(thing); + for (let i = 0; i < groups.length; i++) { + if (groupSizes[i] === maxGroupSize) { + const group = groups[i]; + // run this algorithm recursively and limit the size of the children to + // current size - oversize / number of groups + // So it should always end up being smaller + const headerSize = group.filteredChildren ? 2 : 1; + const limited = spaceLimited( + group.children, + maxGroupSize - + // we should use ceil to always feet in max + Math.ceil(oversize / groups.length) - + // we substitute size of group head + headerSize, + headerSize === 2 + ); + groups[i] = { + ...group, + children: limited.children, + filteredChildren: limited.filteredChildren + ? (group.filteredChildren || 0) + limited.filteredChildren + : group.filteredChildren + }; + const newSize = getItemSize(groups[i]); + groupsSize -= maxGroupSize - newSize; + groupSizes[i] = newSize; break; } - /** - * amount of numbers to write - * @type {number} - */ - let n = 1; - for (; n < 32 && i + n < data.length; n++) { - const item = data[i + n]; - if (typeof item !== "number") break; - if (identifyNumber(item) !== type) break; - } - switch (type) { - case 0: - allocate(HEADER_SIZE + I8_SIZE * n); - writeU8(I8_HEADER | (n - 1)); - while (n > 0) { - currentBuffer.writeInt8( - /** @type {number} */ (data[i]), - currentPosition - ); - currentPosition += I8_SIZE; - n--; - i++; - } - break; - case 1: - allocate(HEADER_SIZE + I32_SIZE * n); - writeU8(I32_HEADER | (n - 1)); - while (n > 0) { - currentBuffer.writeInt32LE( - /** @type {number} */ (data[i]), - currentPosition - ); - currentPosition += I32_SIZE; - n--; - i++; - } - break; - case 2: - allocate(HEADER_SIZE + F64_SIZE * n); - writeU8(F64_HEADER | (n - 1)); - while (n > 0) { - currentBuffer.writeDoubleLE( - /** @type {number} */ (data[i]), - currentPosition - ); - currentPosition += F64_SIZE; - n--; - i++; - } - break; - } + } + } + children = groups.concat(items); + } else if (limit === max) { + // If we have only enough space to show one line per group and one line for the filtered items + // collapse all groups and items + children = collapse(groups); + filteredChildren = items.length; + } else { + // If we have no space + // collapse complete group + filteredChildren = getTotalItems(itemsAndGroups); + } + } - i--; - break; + return { + children, + filteredChildren + }; +}; + +const assetGroup = (children, assets) => { + let size = 0; + for (const asset of children) { + size += asset.size; + } + return { + size + }; +}; + +const moduleGroup = (children, modules) => { + let size = 0; + const sizes = {}; + for (const module of children) { + size += module.size; + for (const key of Object.keys(module.sizes)) { + sizes[key] = (sizes[key] || 0) + module.sizes[key]; + } + } + return { + size, + sizes + }; +}; + +const reasonGroup = (children, reasons) => { + let active = false; + for (const reason of children) { + active = active || reason.active; + } + return { + active + }; +}; + +const GROUP_EXTENSION_REGEXP = /(\.[^.]+?)(?:\?|(?: \+ \d+ modules?)?$)/; +const GROUP_PATH_REGEXP = /(.+)[/\\][^/\\]+?(?:\?|(?: \+ \d+ modules?)?$)/; + +/** @type {Record void>} */ +const ASSETS_GROUPERS = { + _: (groupConfigs, context, options) => { + const groupByFlag = (name, exclude) => { + groupConfigs.push({ + getKeys: asset => { + return asset[name] ? ["1"] : undefined; + }, + getOptions: () => { + return { + groupChildren: !exclude, + force: exclude + }; + }, + createGroup: (key, children, assets) => { + return exclude + ? { + type: "assets by status", + [name]: !!key, + filteredChildren: assets.length, + ...assetGroup(children, assets) + } + : { + type: "assets by status", + [name]: !!key, + children, + ...assetGroup(children, assets) + }; } - case "boolean": { - let lastByte = thing === true ? 1 : 0; - const bytes = []; - let count = 1; - let n; - for (n = 1; n < 0xffffffff && i + n < data.length; n++) { - const item = data[i + n]; - if (typeof item !== "boolean") break; - const pos = count & 0x7; - if (pos === 0) { - bytes.push(lastByte); - lastByte = item === true ? 1 : 0; - } else if (item === true) { - lastByte |= 1 << pos; + }); + }; + const { + groupAssetsByEmitStatus, + groupAssetsByPath, + groupAssetsByExtension + } = options; + if (groupAssetsByEmitStatus) { + groupByFlag("emitted"); + groupByFlag("comparedForEmit"); + groupByFlag("isOverSizeLimit"); + } + if (groupAssetsByEmitStatus || !options.cachedAssets) { + groupByFlag("cached", !options.cachedAssets); + } + if (groupAssetsByPath || groupAssetsByExtension) { + groupConfigs.push({ + getKeys: asset => { + const extensionMatch = + groupAssetsByExtension && GROUP_EXTENSION_REGEXP.exec(asset.name); + const extension = extensionMatch ? extensionMatch[1] : ""; + const pathMatch = + groupAssetsByPath && GROUP_PATH_REGEXP.exec(asset.name); + const path = pathMatch ? pathMatch[1].split(/[/\\]/) : []; + const keys = []; + if (groupAssetsByPath) { + keys.push("."); + if (extension) + keys.push( + path.length + ? `${path.join("/")}/*${extension}` + : `*${extension}` + ); + while (path.length > 0) { + keys.push(path.join("/") + "/"); + path.pop(); } - count++; - } - i += count - 1; - if (count === 1) { - allocate(HEADER_SIZE); - writeU8(lastByte === 1 ? TRUE_HEADER : FALSE_HEADER); - } else if (count === 2) { - allocate(HEADER_SIZE * 2); - writeU8(lastByte & 1 ? TRUE_HEADER : FALSE_HEADER); - writeU8(lastByte & 2 ? TRUE_HEADER : FALSE_HEADER); - } else if (count <= 6) { - allocate(HEADER_SIZE + I8_SIZE); - writeU8(BOOLEANS_HEADER); - writeU8((1 << count) | lastByte); - } else if (count <= 133) { - allocate(HEADER_SIZE + I8_SIZE + I8_SIZE * bytes.length + I8_SIZE); - writeU8(BOOLEANS_HEADER); - writeU8(0x80 | (count - 7)); - for (const byte of bytes) writeU8(byte); - writeU8(lastByte); } else { - allocate( - HEADER_SIZE + - I8_SIZE + - I32_SIZE + - I8_SIZE * bytes.length + - I8_SIZE - ); - writeU8(BOOLEANS_HEADER); - writeU8(0xff); - writeU32(count); - for (const byte of bytes) writeU8(byte); - writeU8(lastByte); + if (extension) keys.push(`*${extension}`); } - break; + return keys; + }, + createGroup: (key, children, assets) => { + return { + type: groupAssetsByPath ? "assets by path" : "assets by extension", + name: key, + children, + ...assetGroup(children, assets) + }; } - case "object": { - if (thing === null) { - let n; - for (n = 1; n < 0x100000104 && i + n < data.length; n++) { - const item = data[i + n]; - if (item !== null) break; - } - i += n - 1; - if (n === 1) { - if (i + 1 < data.length) { - const next = data[i + 1]; - if (next === true) { - allocate(HEADER_SIZE); - writeU8(NULL_AND_TRUE_HEADER); - i++; - } else if (next === false) { - allocate(HEADER_SIZE); - writeU8(NULL_AND_FALSE_HEADER); - i++; - } else if (typeof next === "number") { - const type = identifyNumber(next); - if (type === 0) { - allocate(HEADER_SIZE + I8_SIZE); - writeU8(NULL_AND_I8_HEADER); - currentBuffer.writeInt8(next, currentPosition); - currentPosition += I8_SIZE; - i++; - } else if (type === 1) { - allocate(HEADER_SIZE + I32_SIZE); - writeU8(NULL_AND_I32_HEADER); - currentBuffer.writeInt32LE(next, currentPosition); - currentPosition += I32_SIZE; - i++; - } else { - allocate(HEADER_SIZE); - writeU8(NULL_HEADER); - } - } else { - allocate(HEADER_SIZE); - writeU8(NULL_HEADER); - } - } else { - allocate(HEADER_SIZE); - writeU8(NULL_HEADER); - } - } else if (n === 2) { - allocate(HEADER_SIZE); - writeU8(NULL2_HEADER); - } else if (n === 3) { - allocate(HEADER_SIZE); - writeU8(NULL3_HEADER); - } else if (n < 260) { - allocate(HEADER_SIZE + I8_SIZE); - writeU8(NULLS8_HEADER); - writeU8(n - 4); - } else { - allocate(HEADER_SIZE + I32_SIZE); - writeU8(NULLS32_HEADER); - writeU32(n - 260); - } - } else if (Buffer.isBuffer(thing)) { - if (thing.length < 8192) { - allocate(HEADER_SIZE + I32_SIZE + thing.length); - writeU8(BUFFER_HEADER); - writeU32(thing.length); - thing.copy(currentBuffer, currentPosition); - currentPosition += thing.length; - } else { - allocate(HEADER_SIZE + I32_SIZE); - writeU8(BUFFER_HEADER); - writeU32(thing.length); - flush(); - buffers.push(thing); - } + }); + } + }, + groupAssetsByInfo: (groupConfigs, context, options) => { + const groupByAssetInfoFlag = name => { + groupConfigs.push({ + getKeys: asset => { + return asset.info && asset.info[name] ? ["1"] : undefined; + }, + createGroup: (key, children, assets) => { + return { + type: "assets by info", + info: { + [name]: !!key + }, + children, + ...assetGroup(children, assets) + }; + } + }); + }; + groupByAssetInfoFlag("immutable"); + groupByAssetInfoFlag("development"); + groupByAssetInfoFlag("hotModuleReplacement"); + }, + groupAssetsByChunk: (groupConfigs, context, options) => { + const groupByNames = name => { + groupConfigs.push({ + getKeys: asset => { + return asset[name]; + }, + createGroup: (key, children, assets) => { + return { + type: "assets by chunk", + [name]: [key], + children, + ...assetGroup(children, assets) + }; + } + }); + }; + groupByNames("chunkNames"); + groupByNames("auxiliaryChunkNames"); + groupByNames("chunkIdHints"); + groupByNames("auxiliaryChunkIdHints"); + }, + excludeAssets: (groupConfigs, context, { excludeAssets }) => { + groupConfigs.push({ + getKeys: asset => { + const ident = asset.name; + const excluded = excludeAssets.some(fn => fn(ident, asset)); + if (excluded) return ["excluded"]; + }, + getOptions: () => ({ + groupChildren: false, + force: true + }), + createGroup: (key, children, assets) => ({ + type: "hidden assets", + filteredChildren: assets.length, + ...assetGroup(children, assets) + }) + }); + } +}; + +/** @type {function("module" | "chunk" | "root-of-chunk" | "nested"): Record void>} */ +const MODULES_GROUPERS = type => ({ + _: (groupConfigs, context, options) => { + const groupByFlag = (name, type, exclude) => { + groupConfigs.push({ + getKeys: module => { + return module[name] ? ["1"] : undefined; + }, + getOptions: () => { + return { + groupChildren: !exclude, + force: exclude + }; + }, + createGroup: (key, children, modules) => { + return { + type, + [name]: !!key, + ...(exclude ? { filteredChildren: modules.length } : { children }), + ...moduleGroup(children, modules) + }; + } + }); + }; + const { + groupModulesByCacheStatus, + groupModulesByLayer, + groupModulesByAttributes, + groupModulesByType, + groupModulesByPath, + groupModulesByExtension + } = options; + if (groupModulesByAttributes) { + groupByFlag("errors", "modules with errors"); + groupByFlag("warnings", "modules with warnings"); + groupByFlag("assets", "modules with assets"); + groupByFlag("optional", "optional modules"); + } + if (groupModulesByCacheStatus) { + groupByFlag("cacheable", "cacheable modules"); + groupByFlag("built", "built modules"); + groupByFlag("codeGenerated", "code generated modules"); + } + if (groupModulesByCacheStatus || !options.cachedModules) { + groupByFlag("cached", "cached modules", !options.cachedModules); + } + if (groupModulesByAttributes || !options.orphanModules) { + groupByFlag("orphan", "orphan modules", !options.orphanModules); + } + if (groupModulesByAttributes || !options.dependentModules) { + groupByFlag("dependent", "dependent modules", !options.dependentModules); + } + if (groupModulesByType || !options.runtimeModules) { + groupConfigs.push({ + getKeys: module => { + if (!module.moduleType) return; + if (groupModulesByType) { + return [module.moduleType.split("/", 1)[0]]; + } else if (module.moduleType === "runtime") { + return ["runtime"]; } - break; + }, + getOptions: key => { + const exclude = key === "runtime" && !options.runtimeModules; + return { + groupChildren: !exclude, + force: exclude + }; + }, + createGroup: (key, children, modules) => { + const exclude = key === "runtime" && !options.runtimeModules; + return { + type: `${key} modules`, + moduleType: key, + ...(exclude ? { filteredChildren: modules.length } : { children }), + ...moduleGroup(children, modules) + }; } - case "symbol": { - if (thing === MEASURE_START_OPERATION) { - measureStart(); - } else if (thing === MEASURE_END_OPERATION) { - const size = measureEnd(); - allocate(HEADER_SIZE + I32_SIZE); - writeU8(I32_HEADER); - currentBuffer.writeInt32LE(size, currentPosition); - currentPosition += I32_SIZE; + }); + } + if (groupModulesByLayer) { + groupConfigs.push({ + getKeys: module => { + return [module.layer]; + }, + createGroup: (key, children, modules) => { + return { + type: "modules by layer", + layer: key, + children, + ...moduleGroup(children, modules) + }; + } + }); + } + if (groupModulesByPath || groupModulesByExtension) { + groupConfigs.push({ + getKeys: module => { + if (!module.name) return; + const resource = parseResource(module.name.split("!").pop()).path; + const dataUrl = /^data:[^,;]+/.exec(resource); + if (dataUrl) return [dataUrl[0]]; + const extensionMatch = + groupModulesByExtension && GROUP_EXTENSION_REGEXP.exec(resource); + const extension = extensionMatch ? extensionMatch[1] : ""; + const pathMatch = + groupModulesByPath && GROUP_PATH_REGEXP.exec(resource); + const path = pathMatch ? pathMatch[1].split(/[/\\]/) : []; + const keys = []; + if (groupModulesByPath) { + if (extension) + keys.push( + path.length + ? `${path.join("/")}/*${extension}` + : `*${extension}` + ); + while (path.length > 0) { + keys.push(path.join("/") + "/"); + path.pop(); + } + } else { + if (extension) keys.push(`*${extension}`); } - break; + return keys; + }, + createGroup: (key, children, modules) => { + const isDataUrl = key.startsWith("data:"); + return { + type: isDataUrl + ? "modules by mime type" + : groupModulesByPath + ? "modules by path" + : "modules by extension", + name: isDataUrl ? key.slice(/* 'data:'.length */ 5) : key, + children, + ...moduleGroup(children, modules) + }; } - } + }); } - flush(); + }, + excludeModules: (groupConfigs, context, { excludeModules }) => { + groupConfigs.push({ + getKeys: module => { + const name = module.name; + if (name) { + const excluded = excludeModules.some(fn => fn(name, module, type)); + if (excluded) return ["1"]; + } + }, + getOptions: () => ({ + groupChildren: false, + force: true + }), + createGroup: (key, children, modules) => ({ + type: "hidden modules", + filteredChildren: children.length, + ...moduleGroup(children, modules) + }) + }); + } +}); - allocationScope.leftOverBuffer = leftOverBuffer; +/** @type {Record void>>} */ +const RESULT_GROUPERS = { + "compilation.assets": ASSETS_GROUPERS, + "asset.related": ASSETS_GROUPERS, + "compilation.modules": MODULES_GROUPERS("module"), + "chunk.modules": MODULES_GROUPERS("chunk"), + "chunk.rootModules": MODULES_GROUPERS("root-of-chunk"), + "module.modules": MODULES_GROUPERS("nested"), + "module.reasons": { + groupReasonsByOrigin: groupConfigs => { + groupConfigs.push({ + getKeys: reason => { + return [reason.module]; + }, + createGroup: (key, children, reasons) => { + return { + type: "from origin", + module: key, + children, + ...reasonGroup(children, reasons) + }; + } + }); + } + } +}; - // avoid leaking memory - currentBuffer = null; - leftOverBuffer = null; - allocationScope = undefined; - const _buffers = buffers; - buffers = undefined; - return _buffers; +// remove a prefixed "!" that can be specified to reverse sort order +const normalizeFieldKey = field => { + if (field[0] === "!") { + return field.substr(1); } + return field; +}; - /** - * @param {SerializedType} data data - * @param {Object} context context object - * @returns {DeserializedType|Promise} deserialized data - */ - deserialize(data, context) { - return this._deserialize(data, context); +// if a field is prefixed by a "!" reverse sort order +const sortOrderRegular = field => { + if (field[0] === "!") { + return false; } + return true; +}; - _createLazyDeserialized(content, context) { - return SerializerMiddleware.createLazy( - memoize(() => this._deserialize(content, context)), - this, - undefined, - content - ); +/** + * @param {string} field field name + * @returns {function(Object, Object): number} comparators + */ +const sortByField = field => { + if (!field) { + /** + * @param {any} a first + * @param {any} b second + * @returns {-1|0|1} zero + */ + const noSort = (a, b) => 0; + return noSort; } - _deserializeLazy(fn, context) { - return SerializerMiddleware.deserializeLazy(fn, data => - this._deserialize(data, context) - ); + const fieldKey = normalizeFieldKey(field); + + let sortFn = compareSelect(m => m[fieldKey], compareIds); + + // if a field is prefixed with a "!" the sort is reversed! + const sortIsRegular = sortOrderRegular(field); + + if (!sortIsRegular) { + const oldSortFn = sortFn; + sortFn = (a, b) => oldSortFn(b, a); } - /** - * @param {SerializedType} data data - * @param {Object} context context object - * @returns {DeserializedType} deserialized data - */ - _deserialize(data, context) { - let currentDataItem = 0; - let currentBuffer = data[0]; - let currentIsBuffer = Buffer.isBuffer(currentBuffer); - let currentPosition = 0; + return sortFn; +}; - const retainedBuffer = context.retainedBuffer || (x => x); +const ASSET_SORTERS = { + /** @type {(comparators: Function[], context: StatsFactoryContext, options: NormalizedStatsOptions) => void} */ + assetsSort: (comparators, context, { assetsSort }) => { + comparators.push(sortByField(assetsSort)); + }, + _: comparators => { + comparators.push(compareSelect(a => a.name, compareIds)); + } +}; - const checkOverflow = () => { - if (currentPosition >= currentBuffer.length) { - currentPosition = 0; - currentDataItem++; - currentBuffer = - currentDataItem < data.length ? data[currentDataItem] : null; - currentIsBuffer = Buffer.isBuffer(currentBuffer); - } - }; - const isInCurrentBuffer = n => { - return currentIsBuffer && n + currentPosition <= currentBuffer.length; - }; - const ensureBuffer = () => { - if (!currentIsBuffer) { - throw new Error( - currentBuffer === null - ? "Unexpected end of stream" - : "Unexpected lazy element in stream" - ); - } - }; - /** - * Reads n bytes - * @param {number} n amount of bytes to read - * @returns {Buffer} buffer with bytes - */ - const read = n => { - ensureBuffer(); - const rem = currentBuffer.length - currentPosition; - if (rem < n) { - const buffers = [read(rem)]; - n -= rem; - ensureBuffer(); - while (currentBuffer.length < n) { - const b = /** @type {Buffer} */ (currentBuffer); - buffers.push(b); - n -= b.length; - currentDataItem++; - currentBuffer = - currentDataItem < data.length ? data[currentDataItem] : null; - currentIsBuffer = Buffer.isBuffer(currentBuffer); - ensureBuffer(); +/** @type {Record void>>} */ +const RESULT_SORTERS = { + "compilation.chunks": { + chunksSort: (comparators, context, { chunksSort }) => { + comparators.push(sortByField(chunksSort)); + } + }, + "compilation.modules": { + modulesSort: (comparators, context, { modulesSort }) => { + comparators.push(sortByField(modulesSort)); + } + }, + "chunk.modules": { + chunkModulesSort: (comparators, context, { chunkModulesSort }) => { + comparators.push(sortByField(chunkModulesSort)); + } + }, + "module.modules": { + nestedModulesSort: (comparators, context, { nestedModulesSort }) => { + comparators.push(sortByField(nestedModulesSort)); + } + }, + "compilation.assets": ASSET_SORTERS, + "asset.related": ASSET_SORTERS +}; + +/** + * @param {Record>} config the config see above + * @param {NormalizedStatsOptions} options stats options + * @param {function(string, Function): void} fn handler function called for every active line in config + * @returns {void} + */ +const iterateConfig = (config, options, fn) => { + for (const hookFor of Object.keys(config)) { + const subConfig = config[hookFor]; + for (const option of Object.keys(subConfig)) { + if (option !== "_") { + if (option.startsWith("!")) { + if (options[option.slice(1)]) continue; + } else { + const value = options[option]; + if ( + value === false || + value === undefined || + (Array.isArray(value) && value.length === 0) + ) + continue; } - buffers.push(read(n)); - return Buffer.concat(buffers); - } - const b = /** @type {Buffer} */ (currentBuffer); - const res = Buffer.from(b.buffer, b.byteOffset + currentPosition, n); - currentPosition += n; - checkOverflow(); - return res; - }; - /** - * Reads up to n bytes - * @param {number} n amount of bytes to read - * @returns {Buffer} buffer with bytes - */ - const readUpTo = n => { - ensureBuffer(); - const rem = currentBuffer.length - currentPosition; - if (rem < n) { - n = rem; - } - const b = /** @type {Buffer} */ (currentBuffer); - const res = Buffer.from(b.buffer, b.byteOffset + currentPosition, n); - currentPosition += n; - checkOverflow(); - return res; - }; - const readU8 = () => { - ensureBuffer(); - /** - * There is no need to check remaining buffer size here - * since {@link checkOverflow} guarantees at least one byte remaining - */ - const byte = /** @type {Buffer} */ (currentBuffer).readUInt8( - currentPosition - ); - currentPosition += I8_SIZE; - checkOverflow(); - return byte; - }; - const readU32 = () => { - return read(I32_SIZE).readUInt32LE(0); - }; - const readBits = (data, n) => { - let mask = 1; - while (n !== 0) { - result.push((data & mask) !== 0); - mask = mask << 1; - n--; } - }; - const dispatchTable = Array.from({ length: 256 }).map((_, header) => { - switch (header) { - case LAZY_HEADER: - return () => { - const count = readU32(); - const lengths = Array.from({ length: count }).map(() => readU32()); - const content = []; - for (let l of lengths) { - if (l === 0) { - if (typeof currentBuffer !== "function") { - throw new Error("Unexpected non-lazy element in stream"); - } - content.push(currentBuffer); - currentDataItem++; - currentBuffer = - currentDataItem < data.length ? data[currentDataItem] : null; - currentIsBuffer = Buffer.isBuffer(currentBuffer); - } else { - do { - const buf = readUpTo(l); - l -= buf.length; - content.push(retainedBuffer(buf)); - } while (l > 0); - } - } - result.push(this._createLazyDeserialized(content, context)); - }; - case BUFFER_HEADER: - return () => { - const len = readU32(); - result.push(retainedBuffer(read(len))); - }; - case TRUE_HEADER: - return () => result.push(true); - case FALSE_HEADER: - return () => result.push(false); - case NULL3_HEADER: - return () => result.push(null, null, null); - case NULL2_HEADER: - return () => result.push(null, null); - case NULL_HEADER: - return () => result.push(null); - case NULL_AND_TRUE_HEADER: - return () => result.push(null, true); - case NULL_AND_FALSE_HEADER: - return () => result.push(null, false); - case NULL_AND_I8_HEADER: - return () => { - if (currentIsBuffer) { - result.push( - null, - /** @type {Buffer} */ (currentBuffer).readInt8(currentPosition) - ); - currentPosition += I8_SIZE; - checkOverflow(); - } else { - result.push(null, read(I8_SIZE).readInt8(0)); - } - }; - case NULL_AND_I32_HEADER: - return () => { - result.push(null); - if (isInCurrentBuffer(I32_SIZE)) { - result.push( - /** @type {Buffer} */ (currentBuffer).readInt32LE( - currentPosition - ) - ); - currentPosition += I32_SIZE; - checkOverflow(); - } else { - result.push(read(I32_SIZE).readInt32LE(0)); - } - }; - case NULLS8_HEADER: - return () => { - const len = readU8() + 4; - for (let i = 0; i < len; i++) { - result.push(null); - } - }; - case NULLS32_HEADER: - return () => { - const len = readU32() + 260; - for (let i = 0; i < len; i++) { - result.push(null); - } - }; - case BOOLEANS_HEADER: - return () => { - const innerHeader = readU8(); - if ((innerHeader & 0xf0) === 0) { - readBits(innerHeader, 3); - } else if ((innerHeader & 0xe0) === 0) { - readBits(innerHeader, 4); - } else if ((innerHeader & 0xc0) === 0) { - readBits(innerHeader, 5); - } else if ((innerHeader & 0x80) === 0) { - readBits(innerHeader, 6); - } else if (innerHeader !== 0xff) { - let count = (innerHeader & 0x7f) + 7; - while (count > 8) { - readBits(readU8(), 8); - count -= 8; - } - readBits(readU8(), count); - } else { - let count = readU32(); - while (count > 8) { - readBits(readU8(), 8); - count -= 8; - } - readBits(readU8(), count); - } - }; - case STRING_HEADER: - return () => { - const len = readU32(); - if (isInCurrentBuffer(len) && currentPosition + len < 0x7fffffff) { - result.push( - currentBuffer.toString( - undefined, - currentPosition, - currentPosition + len - ) + fn(hookFor, subConfig[option]); + } + } +}; + +/** @type {Record} */ +const ITEM_NAMES = { + "compilation.children[]": "compilation", + "compilation.modules[]": "module", + "compilation.entrypoints[]": "chunkGroup", + "compilation.namedChunkGroups[]": "chunkGroup", + "compilation.errors[]": "error", + "compilation.warnings[]": "warning", + "chunk.modules[]": "module", + "chunk.rootModules[]": "module", + "chunk.origins[]": "chunkOrigin", + "compilation.chunks[]": "chunk", + "compilation.assets[]": "asset", + "asset.related[]": "asset", + "module.issuerPath[]": "moduleIssuer", + "module.reasons[]": "moduleReason", + "module.modules[]": "module", + "module.children[]": "module", + "moduleTrace[]": "moduleTraceItem", + "moduleTraceItem.dependencies[]": "moduleTraceDependency" +}; + +/** + * @param {Object[]} items items to be merged + * @returns {Object} an object + */ +const mergeToObject = items => { + const obj = Object.create(null); + for (const item of items) { + obj[item.name] = item; + } + return obj; +}; + +/** @type {Record any>} */ +const MERGER = { + "compilation.entrypoints": mergeToObject, + "compilation.namedChunkGroups": mergeToObject +}; + +class DefaultStatsFactoryPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap("DefaultStatsFactoryPlugin", compilation => { + compilation.hooks.statsFactory.tap( + "DefaultStatsFactoryPlugin", + (stats, options, context) => { + iterateConfig(SIMPLE_EXTRACTORS, options, (hookFor, fn) => { + stats.hooks.extract + .for(hookFor) + .tap("DefaultStatsFactoryPlugin", (obj, data, ctx) => + fn(obj, data, ctx, options, stats) ); - currentPosition += len; - checkOverflow(); - } else { - result.push(read(len).toString()); - } - }; - case SHORT_STRING_HEADER: - return () => result.push(""); - case SHORT_STRING_HEADER | 1: - return () => { - if (currentIsBuffer && currentPosition < 0x7ffffffe) { - result.push( - currentBuffer.toString( - "latin1", - currentPosition, - currentPosition + 1 - ) + }); + iterateConfig(FILTER, options, (hookFor, fn) => { + stats.hooks.filter + .for(hookFor) + .tap("DefaultStatsFactoryPlugin", (item, ctx, idx, i) => + fn(item, ctx, options, idx, i) ); - currentPosition++; - checkOverflow(); - } else { - result.push(read(1).toString("latin1")); - } - }; - case I8_HEADER: - return () => { - if (currentIsBuffer) { - result.push( - /** @type {Buffer} */ (currentBuffer).readInt8(currentPosition) + }); + iterateConfig(FILTER_RESULTS, options, (hookFor, fn) => { + stats.hooks.filterResults + .for(hookFor) + .tap("DefaultStatsFactoryPlugin", (item, ctx, idx, i) => + fn(item, ctx, options, idx, i) ); - currentPosition++; - checkOverflow(); - } else { - result.push(read(1).readInt8(0)); - } - }; - default: - if (header <= 10) { - return () => result.push(header); - } else if ((header & SHORT_STRING_HEADER) === SHORT_STRING_HEADER) { - const len = header & SHORT_STRING_LENGTH_MASK; - return () => { - if ( - isInCurrentBuffer(len) && - currentPosition + len < 0x7fffffff - ) { - result.push( - currentBuffer.toString( - "latin1", - currentPosition, - currentPosition + len - ) - ); - currentPosition += len; - checkOverflow(); - } else { - result.push(read(len).toString("latin1")); - } - }; - } else if ((header & NUMBERS_HEADER_MASK) === F64_HEADER) { - const len = (header & NUMBERS_COUNT_MASK) + 1; - return () => { - const need = F64_SIZE * len; - if (isInCurrentBuffer(need)) { - for (let i = 0; i < len; i++) { - result.push( - /** @type {Buffer} */ (currentBuffer).readDoubleLE( - currentPosition - ) - ); - currentPosition += F64_SIZE; - } - checkOverflow(); - } else { - const buf = read(need); - for (let i = 0; i < len; i++) { - result.push(buf.readDoubleLE(i * F64_SIZE)); - } - } - }; - } else if ((header & NUMBERS_HEADER_MASK) === I32_HEADER) { - const len = (header & NUMBERS_COUNT_MASK) + 1; - return () => { - const need = I32_SIZE * len; - if (isInCurrentBuffer(need)) { - for (let i = 0; i < len; i++) { - result.push( - /** @type {Buffer} */ (currentBuffer).readInt32LE( - currentPosition - ) - ); - currentPosition += I32_SIZE; - } - checkOverflow(); - } else { - const buf = read(need); - for (let i = 0; i < len; i++) { - result.push(buf.readInt32LE(i * I32_SIZE)); - } - } - }; - } else if ((header & NUMBERS_HEADER_MASK) === I8_HEADER) { - const len = (header & NUMBERS_COUNT_MASK) + 1; - return () => { - const need = I8_SIZE * len; - if (isInCurrentBuffer(need)) { - for (let i = 0; i < len; i++) { - result.push( - /** @type {Buffer} */ (currentBuffer).readInt8( - currentPosition - ) - ); - currentPosition += I8_SIZE; - } - checkOverflow(); - } else { - const buf = read(need); - for (let i = 0; i < len; i++) { - result.push(buf.readInt8(i * I8_SIZE)); - } - } - }; - } else { - return () => { - throw new Error( - `Unexpected header byte 0x${header.toString(16)}` + }); + iterateConfig(SORTERS, options, (hookFor, fn) => { + stats.hooks.sort + .for(hookFor) + .tap("DefaultStatsFactoryPlugin", (comparators, ctx) => + fn(comparators, ctx, options) ); - }; + }); + iterateConfig(RESULT_SORTERS, options, (hookFor, fn) => { + stats.hooks.sortResults + .for(hookFor) + .tap("DefaultStatsFactoryPlugin", (comparators, ctx) => + fn(comparators, ctx, options) + ); + }); + iterateConfig(RESULT_GROUPERS, options, (hookFor, fn) => { + stats.hooks.groupResults + .for(hookFor) + .tap("DefaultStatsFactoryPlugin", (groupConfigs, ctx) => + fn(groupConfigs, ctx, options) + ); + }); + for (const key of Object.keys(ITEM_NAMES)) { + const itemName = ITEM_NAMES[key]; + stats.hooks.getItemName + .for(key) + .tap("DefaultStatsFactoryPlugin", () => itemName); } - } + for (const key of Object.keys(MERGER)) { + const merger = MERGER[key]; + stats.hooks.merge.for(key).tap("DefaultStatsFactoryPlugin", merger); + } + if (options.children) { + if (Array.isArray(options.children)) { + stats.hooks.getItemFactory + .for("compilation.children[].compilation") + .tap("DefaultStatsFactoryPlugin", (comp, { _index: idx }) => { + if (idx < options.children.length) { + return compilation.createStatsFactory( + compilation.createStatsOptions( + options.children[idx], + context + ) + ); + } + }); + } else if (options.children !== true) { + const childFactory = compilation.createStatsFactory( + compilation.createStatsOptions(options.children, context) + ); + stats.hooks.getItemFactory + .for("compilation.children[].compilation") + .tap("DefaultStatsFactoryPlugin", () => { + return childFactory; + }); + } + } + } + ); }); + } +} +module.exports = DefaultStatsFactoryPlugin; - /** @type {DeserializedType} */ - let result = []; - while (currentBuffer !== null) { - if (typeof currentBuffer === "function") { - result.push(this._deserializeLazy(currentBuffer, context)); - currentDataItem++; - currentBuffer = - currentDataItem < data.length ? data[currentDataItem] : null; - currentIsBuffer = Buffer.isBuffer(currentBuffer); - } else { - const header = readU8(); - dispatchTable[header](); + +/***/ }), + +/***/ 55442: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const RequestShortener = __webpack_require__(73406); + +/** @typedef {import("../../declarations/WebpackOptions").StatsOptions} StatsOptions */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Compilation").CreateStatsOptionsContext} CreateStatsOptionsContext */ +/** @typedef {import("../Compiler")} Compiler */ + +const applyDefaults = (options, defaults) => { + for (const key of Object.keys(defaults)) { + if (typeof options[key] === "undefined") { + options[key] = defaults[key]; + } + } +}; + +const NAMED_PRESETS = { + verbose: { + hash: true, + builtAt: true, + relatedAssets: true, + entrypoints: true, + chunkGroups: true, + ids: true, + modules: false, + chunks: true, + chunkRelations: true, + chunkModules: true, + dependentModules: true, + chunkOrigins: true, + depth: true, + env: true, + reasons: true, + usedExports: true, + providedExports: true, + optimizationBailout: true, + errorDetails: true, + errorStack: true, + publicPath: true, + logging: "verbose", + orphanModules: true, + runtimeModules: true, + exclude: false, + modulesSpace: Infinity, + chunkModulesSpace: Infinity, + assetsSpace: Infinity, + reasonsSpace: Infinity, + children: true + }, + detailed: { + hash: true, + builtAt: true, + relatedAssets: true, + entrypoints: true, + chunkGroups: true, + ids: true, + chunks: true, + chunkRelations: true, + chunkModules: false, + chunkOrigins: true, + depth: true, + usedExports: true, + providedExports: true, + optimizationBailout: true, + errorDetails: true, + publicPath: true, + logging: true, + runtimeModules: true, + exclude: false, + modulesSpace: 1000, + assetsSpace: 1000, + reasonsSpace: 1000 + }, + minimal: { + all: false, + version: true, + timings: true, + modules: true, + modulesSpace: 0, + assets: true, + assetsSpace: 0, + errors: true, + errorsCount: true, + warnings: true, + warningsCount: true, + logging: "warn" + }, + "errors-only": { + all: false, + errors: true, + errorsCount: true, + moduleTrace: true, + logging: "error" + }, + "errors-warnings": { + all: false, + errors: true, + errorsCount: true, + warnings: true, + warningsCount: true, + logging: "warn" + }, + summary: { + all: false, + version: true, + errorsCount: true, + warningsCount: true + }, + none: { + all: false + } +}; + +const NORMAL_ON = ({ all }) => all !== false; +const NORMAL_OFF = ({ all }) => all === true; +const ON_FOR_TO_STRING = ({ all }, { forToString }) => + forToString ? all !== false : all === true; +const OFF_FOR_TO_STRING = ({ all }, { forToString }) => + forToString ? all === true : all !== false; +const AUTO_FOR_TO_STRING = ({ all }, { forToString }) => { + if (all === false) return false; + if (all === true) return true; + if (forToString) return "auto"; + return true; +}; + +/** @type {Record any>} */ +const DEFAULTS = { + context: (options, context, compilation) => compilation.compiler.context, + requestShortener: (options, context, compilation) => + compilation.compiler.context === options.context + ? compilation.requestShortener + : new RequestShortener(options.context, compilation.compiler.root), + performance: NORMAL_ON, + hash: OFF_FOR_TO_STRING, + env: NORMAL_OFF, + version: NORMAL_ON, + timings: NORMAL_ON, + builtAt: OFF_FOR_TO_STRING, + assets: NORMAL_ON, + entrypoints: AUTO_FOR_TO_STRING, + chunkGroups: OFF_FOR_TO_STRING, + chunkGroupAuxiliary: OFF_FOR_TO_STRING, + chunkGroupChildren: OFF_FOR_TO_STRING, + chunkGroupMaxAssets: (o, { forToString }) => (forToString ? 5 : Infinity), + chunks: OFF_FOR_TO_STRING, + chunkRelations: OFF_FOR_TO_STRING, + chunkModules: ({ all, modules }) => { + if (all === false) return false; + if (all === true) return true; + if (modules) return false; + return true; + }, + dependentModules: OFF_FOR_TO_STRING, + chunkOrigins: OFF_FOR_TO_STRING, + ids: OFF_FOR_TO_STRING, + modules: ({ all, chunks, chunkModules }, { forToString }) => { + if (all === false) return false; + if (all === true) return true; + if (forToString && chunks && chunkModules) return false; + return true; + }, + nestedModules: OFF_FOR_TO_STRING, + groupModulesByType: ON_FOR_TO_STRING, + groupModulesByCacheStatus: ON_FOR_TO_STRING, + groupModulesByLayer: ON_FOR_TO_STRING, + groupModulesByAttributes: ON_FOR_TO_STRING, + groupModulesByPath: ON_FOR_TO_STRING, + groupModulesByExtension: ON_FOR_TO_STRING, + modulesSpace: (o, { forToString }) => (forToString ? 15 : Infinity), + chunkModulesSpace: (o, { forToString }) => (forToString ? 10 : Infinity), + nestedModulesSpace: (o, { forToString }) => (forToString ? 10 : Infinity), + relatedAssets: OFF_FOR_TO_STRING, + groupAssetsByEmitStatus: ON_FOR_TO_STRING, + groupAssetsByInfo: ON_FOR_TO_STRING, + groupAssetsByPath: ON_FOR_TO_STRING, + groupAssetsByExtension: ON_FOR_TO_STRING, + groupAssetsByChunk: ON_FOR_TO_STRING, + assetsSpace: (o, { forToString }) => (forToString ? 15 : Infinity), + orphanModules: OFF_FOR_TO_STRING, + runtimeModules: ({ all, runtime }, { forToString }) => + runtime !== undefined + ? runtime + : forToString + ? all === true + : all !== false, + cachedModules: ({ all, cached }, { forToString }) => + cached !== undefined ? cached : forToString ? all === true : all !== false, + moduleAssets: OFF_FOR_TO_STRING, + depth: OFF_FOR_TO_STRING, + cachedAssets: OFF_FOR_TO_STRING, + reasons: OFF_FOR_TO_STRING, + reasonsSpace: (o, { forToString }) => (forToString ? 15 : Infinity), + groupReasonsByOrigin: ON_FOR_TO_STRING, + usedExports: OFF_FOR_TO_STRING, + providedExports: OFF_FOR_TO_STRING, + optimizationBailout: OFF_FOR_TO_STRING, + children: OFF_FOR_TO_STRING, + source: NORMAL_OFF, + moduleTrace: NORMAL_ON, + errors: NORMAL_ON, + errorsCount: NORMAL_ON, + errorDetails: AUTO_FOR_TO_STRING, + errorStack: OFF_FOR_TO_STRING, + warnings: NORMAL_ON, + warningsCount: NORMAL_ON, + publicPath: OFF_FOR_TO_STRING, + logging: ({ all }, { forToString }) => + forToString && all !== false ? "info" : false, + loggingDebug: () => [], + loggingTrace: OFF_FOR_TO_STRING, + excludeModules: () => [], + excludeAssets: () => [], + modulesSort: () => "depth", + chunkModulesSort: () => "name", + nestedModulesSort: () => false, + chunksSort: () => false, + assetsSort: () => "!size", + outputPath: OFF_FOR_TO_STRING, + colors: () => false +}; + +const normalizeFilter = item => { + if (typeof item === "string") { + const regExp = new RegExp( + `[\\\\/]${item.replace( + // eslint-disable-next-line no-useless-escape + /[-[\]{}()*+?.\\^$|]/g, + "\\$&" + )}([\\\\/]|$|!|\\?)` + ); + return ident => regExp.test(ident); + } + if (item && typeof item === "object" && typeof item.test === "function") { + return ident => item.test(ident); + } + if (typeof item === "function") { + return item; + } + if (typeof item === "boolean") { + return () => item; + } +}; + +const NORMALIZER = { + excludeModules: value => { + if (!Array.isArray(value)) { + value = value ? [value] : []; + } + return value.map(normalizeFilter); + }, + excludeAssets: value => { + if (!Array.isArray(value)) { + value = value ? [value] : []; + } + return value.map(normalizeFilter); + }, + warningsFilter: value => { + if (!Array.isArray(value)) { + value = value ? [value] : []; + } + return value.map(filter => { + if (typeof filter === "string") { + return (warning, warningString) => warningString.includes(filter); + } + if (filter instanceof RegExp) { + return (warning, warningString) => filter.test(warningString); + } + if (typeof filter === "function") { + return filter; } + throw new Error( + `Can only filter warnings with Strings or RegExps. (Given: ${filter})` + ); + }); + }, + logging: value => { + if (value === true) value = "log"; + return value; + }, + loggingDebug: value => { + if (!Array.isArray(value)) { + value = value ? [value] : []; } + return value.map(normalizeFilter); + } +}; - // avoid leaking memory in context - let _result = result; - result = undefined; - return _result; +class DefaultStatsPresetPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap("DefaultStatsPresetPlugin", compilation => { + for (const key of Object.keys(NAMED_PRESETS)) { + const defaults = NAMED_PRESETS[key]; + compilation.hooks.statsPreset + .for(key) + .tap("DefaultStatsPresetPlugin", (options, context) => { + applyDefaults(options, defaults); + }); + } + compilation.hooks.statsNormalize.tap( + "DefaultStatsPresetPlugin", + (options, context) => { + for (const key of Object.keys(DEFAULTS)) { + if (options[key] === undefined) + options[key] = DEFAULTS[key](options, context, compilation); + } + for (const key of Object.keys(NORMALIZER)) { + options[key] = NORMALIZER[key](options[key]); + } + } + ); + }); } } - -module.exports = BinaryMiddleware; - -module.exports.MEASURE_START_OPERATION = MEASURE_START_OPERATION; -module.exports.MEASURE_END_OPERATION = MEASURE_END_OPERATION; +module.exports = DefaultStatsPresetPlugin; /***/ }), -/***/ 93475: -/***/ (function(module) { +/***/ 58692: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -class DateObjectSerializer { - serialize(obj, { write }) { - write(obj.getTime()); - } - deserialize({ read }) { - return new Date(read()); +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("./StatsPrinter")} StatsPrinter */ +/** @typedef {import("./StatsPrinter").StatsPrinterContext} StatsPrinterContext */ + +const DATA_URI_CONTENT_LENGTH = 16; + +const plural = (n, singular, plural) => (n === 1 ? singular : plural); + +/** + * @param {Record} sizes sizes by source type + * @param {Object} options options + * @param {(number) => string=} options.formatSize size formatter + * @returns {string} text + */ +const printSizes = (sizes, { formatSize = n => `${n}` }) => { + const keys = Object.keys(sizes); + if (keys.length > 1) { + return keys.map(key => `${formatSize(sizes[key])} (${key})`).join(" "); + } else if (keys.length === 1) { + return formatSize(sizes[keys[0]]); } -} +}; -module.exports = DateObjectSerializer; +const getResourceName = resource => { + const dataUrl = /^data:[^,]+,/.exec(resource); + if (!dataUrl) return resource; + const len = dataUrl[0].length + DATA_URI_CONTENT_LENGTH; + if (resource.length < len) return resource; + return `${resource.slice( + 0, + Math.min(resource.length - /* '..'.length */ 2, len) + )}..`; +}; -/***/ }), +const getModuleName = name => { + const [, prefix, resource] = /^(.*!)?([^!]*)$/.exec(name); + return [prefix, getResourceName(resource)]; +}; -/***/ 79479: -/***/ (function(module) { +const mapLines = (str, fn) => str.split("\n").map(fn).join("\n"); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ +/** + * @param {number} n a number + * @returns {string} number as two digit string, leading 0 + */ +const twoDigit = n => (n >= 10 ? `${n}` : `0${n}`); +const isValidId = id => { + return typeof id === "number" || id; +}; +const moreCount = (list, count) => { + return list && list.length > 0 ? `+ ${count}` : `${count}`; +}; -class ErrorObjectSerializer { - constructor(Type) { - this.Type = Type; - } +/** @type {Record string | void>} */ +const SIMPLE_PRINTERS = { + "compilation.summary!": ( + _, + { + type, + bold, + green, + red, + yellow, + formatDateTime, + formatTime, + compilation: { + name, + hash, + version, + time, + builtAt, + errorsCount, + warningsCount + } + } + ) => { + const root = type === "compilation.summary!"; + const warningsMessage = + warningsCount > 0 + ? yellow( + `${warningsCount} ${plural(warningsCount, "warning", "warnings")}` + ) + : ""; + const errorsMessage = + errorsCount > 0 + ? red(`${errorsCount} ${plural(errorsCount, "error", "errors")}`) + : ""; + const timeMessage = root && time ? ` in ${formatTime(time)}` : ""; + const hashMessage = hash ? ` (${hash})` : ""; + const builtAtMessage = + root && builtAt ? `${formatDateTime(builtAt)}: ` : ""; + const versionMessage = root && version ? `webpack ${version}` : ""; + const nameMessage = + root && name + ? bold(name) + : name + ? `Child ${bold(name)}` + : root + ? "" + : "Child"; + const subjectMessage = + nameMessage && versionMessage + ? `${nameMessage} (${versionMessage})` + : versionMessage || nameMessage || "webpack"; + let statusMessage; + if (errorsMessage && warningsMessage) { + statusMessage = `compiled with ${errorsMessage} and ${warningsMessage}`; + } else if (errorsMessage) { + statusMessage = `compiled with ${errorsMessage}`; + } else if (warningsMessage) { + statusMessage = `compiled with ${warningsMessage}`; + } else if (errorsCount === 0 && warningsCount === 0) { + statusMessage = `compiled ${green("successfully")}`; + } else { + statusMessage = `compiled`; + } + if ( + builtAtMessage || + versionMessage || + errorsMessage || + warningsMessage || + (errorsCount === 0 && warningsCount === 0) || + timeMessage || + hashMessage + ) + return `${builtAtMessage}${subjectMessage} ${statusMessage}${timeMessage}${hashMessage}`; + }, + "compilation.filteredWarningDetailsCount": count => + count + ? `${count} ${plural( + count, + "warning has", + "warnings have" + )} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.` + : undefined, + "compilation.filteredErrorDetailsCount": (count, { yellow }) => + count + ? yellow( + `${count} ${plural( + count, + "error has", + "errors have" + )} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.` + ) + : undefined, + "compilation.env": (env, { bold }) => + env + ? `Environment (--env): ${bold(JSON.stringify(env, null, 2))}` + : undefined, + "compilation.publicPath": (publicPath, { bold }) => + `PublicPath: ${bold(publicPath || "(none)")}`, + "compilation.entrypoints": (entrypoints, context, printer) => + Array.isArray(entrypoints) + ? undefined + : printer.print(context.type, Object.values(entrypoints), { + ...context, + chunkGroupKind: "Entrypoint" + }), + "compilation.namedChunkGroups": (namedChunkGroups, context, printer) => { + if (!Array.isArray(namedChunkGroups)) { + const { + compilation: { entrypoints } + } = context; + let chunkGroups = Object.values(namedChunkGroups); + if (entrypoints) { + chunkGroups = chunkGroups.filter( + group => + !Object.prototype.hasOwnProperty.call(entrypoints, group.name) + ); + } + return printer.print(context.type, chunkGroups, { + ...context, + chunkGroupKind: "Chunk Group" + }); + } + }, + "compilation.assetsByChunkName": () => "", - serialize(obj, { write }) { - write(obj.message); - write(obj.stack); - } + "compilation.filteredModules": ( + filteredModules, + { compilation: { modules } } + ) => + filteredModules > 0 + ? `${moreCount(modules, filteredModules)} ${plural( + filteredModules, + "module", + "modules" + )}` + : undefined, + "compilation.filteredAssets": (filteredAssets, { compilation: { assets } }) => + filteredAssets > 0 + ? `${moreCount(assets, filteredAssets)} ${plural( + filteredAssets, + "asset", + "assets" + )}` + : undefined, + "compilation.logging": (logging, context, printer) => + Array.isArray(logging) + ? undefined + : printer.print( + context.type, + Object.entries(logging).map(([name, value]) => ({ ...value, name })), + context + ), + "compilation.warningsInChildren!": (_, { yellow, compilation }) => { + if ( + !compilation.children && + compilation.warningsCount > 0 && + compilation.warnings + ) { + const childWarnings = + compilation.warningsCount - compilation.warnings.length; + if (childWarnings > 0) { + return yellow( + `${childWarnings} ${plural( + childWarnings, + "WARNING", + "WARNINGS" + )} in child compilations${ + compilation.children + ? "" + : " (Use 'stats.children: true' resp. '--stats-children' for more details)" + }` + ); + } + } + }, + "compilation.errorsInChildren!": (_, { red, compilation }) => { + if ( + !compilation.children && + compilation.errorsCount > 0 && + compilation.errors + ) { + const childErrors = compilation.errorsCount - compilation.errors.length; + if (childErrors > 0) { + return red( + `${childErrors} ${plural( + childErrors, + "ERROR", + "ERRORS" + )} in child compilations${ + compilation.children + ? "" + : " (Use 'stats.children: true' resp. '--stats-children' for more details)" + }` + ); + } + } + }, - deserialize({ read }) { - const err = new this.Type(); + "asset.type": type => type, + "asset.name": (name, { formatFilename, asset: { isOverSizeLimit } }) => + formatFilename(name, isOverSizeLimit), + "asset.size": ( + size, + { asset: { isOverSizeLimit }, yellow, green, formatSize } + ) => (isOverSizeLimit ? yellow(formatSize(size)) : formatSize(size)), + "asset.emitted": (emitted, { green, formatFlag }) => + emitted ? green(formatFlag("emitted")) : undefined, + "asset.comparedForEmit": (comparedForEmit, { yellow, formatFlag }) => + comparedForEmit ? yellow(formatFlag("compared for emit")) : undefined, + "asset.cached": (cached, { green, formatFlag }) => + cached ? green(formatFlag("cached")) : undefined, + "asset.isOverSizeLimit": (isOverSizeLimit, { yellow, formatFlag }) => + isOverSizeLimit ? yellow(formatFlag("big")) : undefined, - err.message = read(); - err.stack = read(); + "asset.info.immutable": (immutable, { green, formatFlag }) => + immutable ? green(formatFlag("immutable")) : undefined, + "asset.info.javascriptModule": (javascriptModule, { formatFlag }) => + javascriptModule ? formatFlag("javascript module") : undefined, + "asset.info.sourceFilename": (sourceFilename, { formatFlag }) => + sourceFilename + ? formatFlag( + sourceFilename === true + ? "from source file" + : `from: ${sourceFilename}` + ) + : undefined, + "asset.info.development": (development, { green, formatFlag }) => + development ? green(formatFlag("dev")) : undefined, + "asset.info.hotModuleReplacement": ( + hotModuleReplacement, + { green, formatFlag } + ) => (hotModuleReplacement ? green(formatFlag("hmr")) : undefined), + "asset.separator!": () => "\n", + "asset.filteredRelated": (filteredRelated, { asset: { related } }) => + filteredRelated > 0 + ? `${moreCount(related, filteredRelated)} related ${plural( + filteredRelated, + "asset", + "assets" + )}` + : undefined, + "asset.filteredChildren": (filteredChildren, { asset: { children } }) => + filteredChildren > 0 + ? `${moreCount(children, filteredChildren)} ${plural( + filteredChildren, + "asset", + "assets" + )}` + : undefined, - return err; - } -} + assetChunk: (id, { formatChunkId }) => formatChunkId(id), -module.exports = ErrorObjectSerializer; + assetChunkName: name => name, + assetChunkIdHint: name => name, + + "module.type": type => (type !== "module" ? type : undefined), + "module.id": (id, { formatModuleId }) => + isValidId(id) ? formatModuleId(id) : undefined, + "module.name": (name, { bold }) => { + const [prefix, resource] = getModuleName(name); + return `${prefix || ""}${bold(resource || "")}`; + }, + "module.identifier": identifier => undefined, + "module.layer": (layer, { formatLayer }) => + layer ? formatLayer(layer) : undefined, + "module.sizes": printSizes, + "module.chunks[]": (id, { formatChunkId }) => formatChunkId(id), + "module.depth": (depth, { formatFlag }) => + depth !== null ? formatFlag(`depth ${depth}`) : undefined, + "module.cacheable": (cacheable, { formatFlag, red }) => + cacheable === false ? red(formatFlag("not cacheable")) : undefined, + "module.orphan": (orphan, { formatFlag, yellow }) => + orphan ? yellow(formatFlag("orphan")) : undefined, + "module.runtime": (runtime, { formatFlag, yellow }) => + runtime ? yellow(formatFlag("runtime")) : undefined, + "module.optional": (optional, { formatFlag, yellow }) => + optional ? yellow(formatFlag("optional")) : undefined, + "module.dependent": (dependent, { formatFlag, cyan }) => + dependent ? cyan(formatFlag("dependent")) : undefined, + "module.built": (built, { formatFlag, yellow }) => + built ? yellow(formatFlag("built")) : undefined, + "module.codeGenerated": (codeGenerated, { formatFlag, yellow }) => + codeGenerated ? yellow(formatFlag("code generated")) : undefined, + "module.buildTimeExecuted": (buildTimeExecuted, { formatFlag, green }) => + buildTimeExecuted ? green(formatFlag("build time executed")) : undefined, + "module.cached": (cached, { formatFlag, green }) => + cached ? green(formatFlag("cached")) : undefined, + "module.assets": (assets, { formatFlag, magenta }) => + assets && assets.length + ? magenta( + formatFlag( + `${assets.length} ${plural(assets.length, "asset", "assets")}` + ) + ) + : undefined, + "module.warnings": (warnings, { formatFlag, yellow }) => + warnings === true + ? yellow(formatFlag("warnings")) + : warnings + ? yellow( + formatFlag(`${warnings} ${plural(warnings, "warning", "warnings")}`) + ) + : undefined, + "module.errors": (errors, { formatFlag, red }) => + errors === true + ? red(formatFlag("errors")) + : errors + ? red(formatFlag(`${errors} ${plural(errors, "error", "errors")}`)) + : undefined, + "module.providedExports": (providedExports, { formatFlag, cyan }) => { + if (Array.isArray(providedExports)) { + if (providedExports.length === 0) return cyan(formatFlag("no exports")); + return cyan(formatFlag(`exports: ${providedExports.join(", ")}`)); + } + }, + "module.usedExports": (usedExports, { formatFlag, cyan, module }) => { + if (usedExports !== true) { + if (usedExports === null) return cyan(formatFlag("used exports unknown")); + if (usedExports === false) return cyan(formatFlag("module unused")); + if (Array.isArray(usedExports)) { + if (usedExports.length === 0) + return cyan(formatFlag("no exports used")); + const providedExportsCount = Array.isArray(module.providedExports) + ? module.providedExports.length + : null; + if ( + providedExportsCount !== null && + providedExportsCount === usedExports.length + ) { + return cyan(formatFlag("all exports used")); + } else { + return cyan( + formatFlag(`only some exports used: ${usedExports.join(", ")}`) + ); + } + } + } + }, + "module.optimizationBailout[]": (optimizationBailout, { yellow }) => + yellow(optimizationBailout), + "module.issuerPath": (issuerPath, { module }) => + module.profile ? undefined : "", + "module.profile": profile => undefined, + "module.filteredModules": (filteredModules, { module: { modules } }) => + filteredModules > 0 + ? `${moreCount(modules, filteredModules)} nested ${plural( + filteredModules, + "module", + "modules" + )}` + : undefined, + "module.filteredReasons": (filteredReasons, { module: { reasons } }) => + filteredReasons > 0 + ? `${moreCount(reasons, filteredReasons)} ${plural( + filteredReasons, + "reason", + "reasons" + )}` + : undefined, + "module.filteredChildren": (filteredChildren, { module: { children } }) => + filteredChildren > 0 + ? `${moreCount(children, filteredChildren)} ${plural( + filteredChildren, + "module", + "modules" + )}` + : undefined, + "module.separator!": () => "\n", + "moduleIssuer.id": (id, { formatModuleId }) => formatModuleId(id), + "moduleIssuer.profile.total": (value, { formatTime }) => formatTime(value), -/***/ }), + "moduleReason.type": type => type, + "moduleReason.userRequest": (userRequest, { cyan }) => + cyan(getResourceName(userRequest)), + "moduleReason.moduleId": (moduleId, { formatModuleId }) => + isValidId(moduleId) ? formatModuleId(moduleId) : undefined, + "moduleReason.module": (module, { magenta }) => magenta(module), + "moduleReason.loc": loc => loc, + "moduleReason.explanation": (explanation, { cyan }) => cyan(explanation), + "moduleReason.active": (active, { formatFlag }) => + active ? undefined : formatFlag("inactive"), + "moduleReason.resolvedModule": (module, { magenta }) => magenta(module), + "moduleReason.filteredChildren": ( + filteredChildren, + { moduleReason: { children } } + ) => + filteredChildren > 0 + ? `${moreCount(children, filteredChildren)} ${plural( + filteredChildren, + "reason", + "reasons" + )}` + : undefined, -/***/ 65321: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + "module.profile.total": (value, { formatTime }) => formatTime(value), + "module.profile.resolving": (value, { formatTime }) => + `resolving: ${formatTime(value)}`, + "module.profile.restoring": (value, { formatTime }) => + `restoring: ${formatTime(value)}`, + "module.profile.integration": (value, { formatTime }) => + `integration: ${formatTime(value)}`, + "module.profile.building": (value, { formatTime }) => + `building: ${formatTime(value)}`, + "module.profile.storing": (value, { formatTime }) => + `storing: ${formatTime(value)}`, + "module.profile.additionalResolving": (value, { formatTime }) => + value ? `additional resolving: ${formatTime(value)}` : undefined, + "module.profile.additionalIntegration": (value, { formatTime }) => + value ? `additional integration: ${formatTime(value)}` : undefined, -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + "chunkGroup.kind!": (_, { chunkGroupKind }) => chunkGroupKind, + "chunkGroup.separator!": () => "\n", + "chunkGroup.name": (name, { bold }) => bold(name), + "chunkGroup.isOverSizeLimit": (isOverSizeLimit, { formatFlag, yellow }) => + isOverSizeLimit ? yellow(formatFlag("big")) : undefined, + "chunkGroup.assetsSize": (size, { formatSize }) => + size ? formatSize(size) : undefined, + "chunkGroup.auxiliaryAssetsSize": (size, { formatSize }) => + size ? `(${formatSize(size)})` : undefined, + "chunkGroup.filteredAssets": (n, { chunkGroup: { assets } }) => + n > 0 + ? `${moreCount(assets, n)} ${plural(n, "asset", "assets")}` + : undefined, + "chunkGroup.filteredAuxiliaryAssets": ( + n, + { chunkGroup: { auxiliaryAssets } } + ) => + n > 0 + ? `${moreCount(auxiliaryAssets, n)} auxiliary ${plural( + n, + "asset", + "assets" + )}` + : undefined, + "chunkGroup.is!": () => "=", + "chunkGroupAsset.name": (asset, { green }) => green(asset), + "chunkGroupAsset.size": (size, { formatSize, chunkGroup }) => + chunkGroup.assets.length > 1 || + (chunkGroup.auxiliaryAssets && chunkGroup.auxiliaryAssets.length > 0) + ? formatSize(size) + : undefined, + "chunkGroup.children": (children, context, printer) => + Array.isArray(children) + ? undefined + : printer.print( + context.type, + Object.keys(children).map(key => ({ + type: key, + children: children[key] + })), + context + ), + "chunkGroupChildGroup.type": type => `${type}:`, + "chunkGroupChild.assets[]": (file, { formatFilename }) => + formatFilename(file), + "chunkGroupChild.chunks[]": (id, { formatChunkId }) => formatChunkId(id), + "chunkGroupChild.name": name => (name ? `(name: ${name})` : undefined), + "chunk.id": (id, { formatChunkId }) => formatChunkId(id), + "chunk.files[]": (file, { formatFilename }) => formatFilename(file), + "chunk.names[]": name => name, + "chunk.idHints[]": name => name, + "chunk.runtime[]": name => name, + "chunk.sizes": (sizes, context) => printSizes(sizes, context), + "chunk.parents[]": (parents, context) => + context.formatChunkId(parents, "parent"), + "chunk.siblings[]": (siblings, context) => + context.formatChunkId(siblings, "sibling"), + "chunk.children[]": (children, context) => + context.formatChunkId(children, "child"), + "chunk.childrenByOrder": (childrenByOrder, context, printer) => + Array.isArray(childrenByOrder) + ? undefined + : printer.print( + context.type, + Object.keys(childrenByOrder).map(key => ({ + type: key, + children: childrenByOrder[key] + })), + context + ), + "chunk.childrenByOrder[].type": type => `${type}:`, + "chunk.childrenByOrder[].children[]": (id, { formatChunkId }) => + isValidId(id) ? formatChunkId(id) : undefined, + "chunk.entry": (entry, { formatFlag, yellow }) => + entry ? yellow(formatFlag("entry")) : undefined, + "chunk.initial": (initial, { formatFlag, yellow }) => + initial ? yellow(formatFlag("initial")) : undefined, + "chunk.rendered": (rendered, { formatFlag, green }) => + rendered ? green(formatFlag("rendered")) : undefined, + "chunk.recorded": (recorded, { formatFlag, green }) => + recorded ? green(formatFlag("recorded")) : undefined, + "chunk.reason": (reason, { yellow }) => (reason ? yellow(reason) : undefined), + "chunk.filteredModules": (filteredModules, { chunk: { modules } }) => + filteredModules > 0 + ? `${moreCount(modules, filteredModules)} chunk ${plural( + filteredModules, + "module", + "modules" + )}` + : undefined, + "chunk.separator!": () => "\n", + "chunkOrigin.request": request => request, + "chunkOrigin.moduleId": (moduleId, { formatModuleId }) => + isValidId(moduleId) ? formatModuleId(moduleId) : undefined, + "chunkOrigin.moduleName": (moduleName, { bold }) => bold(moduleName), + "chunkOrigin.loc": loc => loc, -const { constants } = __webpack_require__(14300); -const { pipeline } = __webpack_require__(12781); -const { - createBrotliCompress, - createBrotliDecompress, - createGzip, - createGunzip, - constants: zConstants -} = __webpack_require__(59796); -const createHash = __webpack_require__(49835); -const { dirname, join, mkdirp } = __webpack_require__(17139); -const memoize = __webpack_require__(78676); -const SerializerMiddleware = __webpack_require__(83137); + "error.compilerPath": (compilerPath, { bold }) => + compilerPath ? bold(`(${compilerPath})`) : undefined, + "error.chunkId": (chunkId, { formatChunkId }) => + isValidId(chunkId) ? formatChunkId(chunkId) : undefined, + "error.chunkEntry": (chunkEntry, { formatFlag }) => + chunkEntry ? formatFlag("entry") : undefined, + "error.chunkInitial": (chunkInitial, { formatFlag }) => + chunkInitial ? formatFlag("initial") : undefined, + "error.file": (file, { bold }) => bold(file), + "error.moduleName": (moduleName, { bold }) => { + return moduleName.includes("!") + ? `${bold(moduleName.replace(/^(\s|\S)*!/, ""))} (${moduleName})` + : `${bold(moduleName)}`; + }, + "error.loc": (loc, { green }) => green(loc), + "error.message": (message, { bold, formatError }) => + message.includes("\u001b[") ? message : bold(formatError(message)), + "error.details": (details, { formatError }) => formatError(details), + "error.stack": stack => stack, + "error.moduleTrace": moduleTrace => undefined, + "error.separator!": () => "\n", -/** @typedef {typeof import("../util/Hash")} Hash */ -/** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */ -/** @typedef {import("./types").BufferSerializableType} BufferSerializableType */ + "loggingEntry(error).loggingEntry.message": (message, { red }) => + mapLines(message, x => ` ${red(x)}`), + "loggingEntry(warn).loggingEntry.message": (message, { yellow }) => + mapLines(message, x => ` ${yellow(x)}`), + "loggingEntry(info).loggingEntry.message": (message, { green }) => + mapLines(message, x => ` ${green(x)}`), + "loggingEntry(log).loggingEntry.message": (message, { bold }) => + mapLines(message, x => ` ${bold(x)}`), + "loggingEntry(debug).loggingEntry.message": message => + mapLines(message, x => ` ${x}`), + "loggingEntry(trace).loggingEntry.message": message => + mapLines(message, x => ` ${x}`), + "loggingEntry(status).loggingEntry.message": (message, { magenta }) => + mapLines(message, x => ` ${magenta(x)}`), + "loggingEntry(profile).loggingEntry.message": (message, { magenta }) => + mapLines(message, x => `

${magenta(x)}`), + "loggingEntry(profileEnd).loggingEntry.message": (message, { magenta }) => + mapLines(message, x => `

${magenta(x)}`), + "loggingEntry(time).loggingEntry.message": (message, { magenta }) => + mapLines(message, x => ` ${magenta(x)}`), + "loggingEntry(group).loggingEntry.message": (message, { cyan }) => + mapLines(message, x => `<-> ${cyan(x)}`), + "loggingEntry(groupCollapsed).loggingEntry.message": (message, { cyan }) => + mapLines(message, x => `<+> ${cyan(x)}`), + "loggingEntry(clear).loggingEntry": () => " -------", + "loggingEntry(groupCollapsed).loggingEntry.children": () => "", + "loggingEntry.trace[]": trace => + trace ? mapLines(trace, x => `| ${x}`) : undefined, -/* -Format: + "moduleTraceItem.originName": originName => originName, -File -> Header Section* + loggingGroup: loggingGroup => + loggingGroup.entries.length === 0 ? "" : undefined, + "loggingGroup.debug": (flag, { red }) => (flag ? red("DEBUG") : undefined), + "loggingGroup.name": (name, { bold }) => bold(`LOG from ${name}`), + "loggingGroup.separator!": () => "\n", + "loggingGroup.filteredEntries": filteredEntries => + filteredEntries > 0 ? `+ ${filteredEntries} hidden lines` : undefined, -Version -> u32 -AmountOfSections -> u32 -SectionSize -> i32 (if less than zero represents lazy value) + "moduleTraceDependency.loc": loc => loc +}; -Header -> Version AmountOfSections SectionSize* +/** @type {Record} */ +const ITEM_NAMES = { + "compilation.assets[]": "asset", + "compilation.modules[]": "module", + "compilation.chunks[]": "chunk", + "compilation.entrypoints[]": "chunkGroup", + "compilation.namedChunkGroups[]": "chunkGroup", + "compilation.errors[]": "error", + "compilation.warnings[]": "error", + "compilation.logging[]": "loggingGroup", + "compilation.children[]": "compilation", + "asset.related[]": "asset", + "asset.children[]": "asset", + "asset.chunks[]": "assetChunk", + "asset.auxiliaryChunks[]": "assetChunk", + "asset.chunkNames[]": "assetChunkName", + "asset.chunkIdHints[]": "assetChunkIdHint", + "asset.auxiliaryChunkNames[]": "assetChunkName", + "asset.auxiliaryChunkIdHints[]": "assetChunkIdHint", + "chunkGroup.assets[]": "chunkGroupAsset", + "chunkGroup.auxiliaryAssets[]": "chunkGroupAsset", + "chunkGroupChild.assets[]": "chunkGroupAsset", + "chunkGroupChild.auxiliaryAssets[]": "chunkGroupAsset", + "chunkGroup.children[]": "chunkGroupChildGroup", + "chunkGroupChildGroup.children[]": "chunkGroupChild", + "module.modules[]": "module", + "module.children[]": "module", + "module.reasons[]": "moduleReason", + "moduleReason.children[]": "moduleReason", + "module.issuerPath[]": "moduleIssuer", + "chunk.origins[]": "chunkOrigin", + "chunk.modules[]": "module", + "loggingGroup.entries[]": logEntry => + `loggingEntry(${logEntry.type}).loggingEntry`, + "loggingEntry.children[]": logEntry => + `loggingEntry(${logEntry.type}).loggingEntry`, + "error.moduleTrace[]": "moduleTraceItem", + "moduleTraceItem.dependencies[]": "moduleTraceDependency" +}; -Buffer -> n bytes -Section -> Buffer +const ERROR_PREFERRED_ORDER = [ + "compilerPath", + "chunkId", + "chunkEntry", + "chunkInitial", + "file", + "separator!", + "moduleName", + "loc", + "separator!", + "message", + "separator!", + "details", + "separator!", + "stack", + "separator!", + "missing", + "separator!", + "moduleTrace" +]; -*/ +/** @type {Record} */ +const PREFERRED_ORDERS = { + compilation: [ + "name", + "hash", + "version", + "time", + "builtAt", + "env", + "publicPath", + "assets", + "filteredAssets", + "entrypoints", + "namedChunkGroups", + "chunks", + "modules", + "filteredModules", + "children", + "logging", + "warnings", + "warningsInChildren!", + "filteredWarningDetailsCount", + "errors", + "errorsInChildren!", + "filteredErrorDetailsCount", + "summary!", + "needAdditionalPass" + ], + asset: [ + "type", + "name", + "size", + "chunks", + "auxiliaryChunks", + "emitted", + "comparedForEmit", + "cached", + "info", + "isOverSizeLimit", + "chunkNames", + "auxiliaryChunkNames", + "chunkIdHints", + "auxiliaryChunkIdHints", + "related", + "filteredRelated", + "children", + "filteredChildren" + ], + "asset.info": [ + "immutable", + "sourceFilename", + "javascriptModule", + "development", + "hotModuleReplacement" + ], + chunkGroup: [ + "kind!", + "name", + "isOverSizeLimit", + "assetsSize", + "auxiliaryAssetsSize", + "is!", + "assets", + "filteredAssets", + "auxiliaryAssets", + "filteredAuxiliaryAssets", + "separator!", + "children" + ], + chunkGroupAsset: ["name", "size"], + chunkGroupChildGroup: ["type", "children"], + chunkGroupChild: ["assets", "chunks", "name"], + module: [ + "type", + "name", + "identifier", + "id", + "layer", + "sizes", + "chunks", + "depth", + "cacheable", + "orphan", + "runtime", + "optional", + "dependent", + "built", + "codeGenerated", + "cached", + "assets", + "failed", + "warnings", + "errors", + "children", + "filteredChildren", + "providedExports", + "usedExports", + "optimizationBailout", + "reasons", + "filteredReasons", + "issuerPath", + "profile", + "modules", + "filteredModules" + ], + moduleReason: [ + "active", + "type", + "userRequest", + "moduleId", + "module", + "resolvedModule", + "loc", + "explanation", + "children", + "filteredChildren" + ], + "module.profile": [ + "total", + "separator!", + "resolving", + "restoring", + "integration", + "building", + "storing", + "additionalResolving", + "additionalIntegration" + ], + chunk: [ + "id", + "runtime", + "files", + "names", + "idHints", + "sizes", + "parents", + "siblings", + "children", + "childrenByOrder", + "entry", + "initial", + "rendered", + "recorded", + "reason", + "separator!", + "origins", + "separator!", + "modules", + "separator!", + "filteredModules" + ], + chunkOrigin: ["request", "moduleId", "moduleName", "loc"], + error: ERROR_PREFERRED_ORDER, + warning: ERROR_PREFERRED_ORDER, + "chunk.childrenByOrder[]": ["type", "children"], + loggingGroup: [ + "debug", + "name", + "separator!", + "entries", + "separator!", + "filteredEntries" + ], + loggingEntry: ["message", "trace", "children"] +}; -// "wpc" + 1 in little-endian -const VERSION = 0x01637077; -const WRITE_LIMIT_TOTAL = 0x7fff0000; -const WRITE_LIMIT_CHUNK = 511 * 1024 * 1024; +const itemsJoinOneLine = items => items.filter(Boolean).join(" "); +const itemsJoinOneLineBrackets = items => + items.length > 0 ? `(${items.filter(Boolean).join(" ")})` : undefined; +const itemsJoinMoreSpacing = items => items.filter(Boolean).join("\n\n"); +const itemsJoinComma = items => items.filter(Boolean).join(", "); +const itemsJoinCommaBrackets = items => + items.length > 0 ? `(${items.filter(Boolean).join(", ")})` : undefined; +const itemsJoinCommaBracketsWithName = name => items => + items.length > 0 + ? `(${name}: ${items.filter(Boolean).join(", ")})` + : undefined; -/** - * @param {Buffer[]} buffers buffers - * @param {string | Hash} hashFunction hash function to use - * @returns {string} hash - */ -const hashForName = (buffers, hashFunction) => { - const hash = createHash(hashFunction); - for (const buf of buffers) hash.update(buf); - return /** @type {string} */ (hash.digest("hex")); +/** @type {Record string>} */ +const SIMPLE_ITEMS_JOINER = { + "chunk.parents": itemsJoinOneLine, + "chunk.siblings": itemsJoinOneLine, + "chunk.children": itemsJoinOneLine, + "chunk.names": itemsJoinCommaBrackets, + "chunk.idHints": itemsJoinCommaBracketsWithName("id hint"), + "chunk.runtime": itemsJoinCommaBracketsWithName("runtime"), + "chunk.files": itemsJoinComma, + "chunk.childrenByOrder": itemsJoinOneLine, + "chunk.childrenByOrder[].children": itemsJoinOneLine, + "chunkGroup.assets": itemsJoinOneLine, + "chunkGroup.auxiliaryAssets": itemsJoinOneLineBrackets, + "chunkGroupChildGroup.children": itemsJoinComma, + "chunkGroupChild.assets": itemsJoinOneLine, + "chunkGroupChild.auxiliaryAssets": itemsJoinOneLineBrackets, + "asset.chunks": itemsJoinComma, + "asset.auxiliaryChunks": itemsJoinCommaBrackets, + "asset.chunkNames": itemsJoinCommaBracketsWithName("name"), + "asset.auxiliaryChunkNames": itemsJoinCommaBracketsWithName("auxiliary name"), + "asset.chunkIdHints": itemsJoinCommaBracketsWithName("id hint"), + "asset.auxiliaryChunkIdHints": + itemsJoinCommaBracketsWithName("auxiliary id hint"), + "module.chunks": itemsJoinOneLine, + "module.issuerPath": items => + items + .filter(Boolean) + .map(item => `${item} ->`) + .join(" "), + "compilation.errors": itemsJoinMoreSpacing, + "compilation.warnings": itemsJoinMoreSpacing, + "compilation.logging": itemsJoinMoreSpacing, + "compilation.children": items => indent(itemsJoinMoreSpacing(items), " "), + "moduleTraceItem.dependencies": itemsJoinOneLine, + "loggingEntry.children": items => + indent(items.filter(Boolean).join("\n"), " ", false) }; -const COMPRESSION_CHUNK_SIZE = 100 * 1024 * 1024; -const DECOMPRESSION_CHUNK_SIZE = 100 * 1024 * 1024; +const joinOneLine = items => + items + .map(item => item.content) + .filter(Boolean) + .join(" "); + +const joinInBrackets = items => { + const res = []; + let mode = 0; + for (const item of items) { + if (item.element === "separator!") { + switch (mode) { + case 0: + case 1: + mode += 2; + break; + case 4: + res.push(")"); + mode = 3; + break; + } + } + if (!item.content) continue; + switch (mode) { + case 0: + mode = 1; + break; + case 1: + res.push(" "); + break; + case 2: + res.push("("); + mode = 4; + break; + case 3: + res.push(" ("); + mode = 4; + break; + case 4: + res.push(", "); + break; + } + res.push(item.content); + } + if (mode === 4) res.push(")"); + return res.join(""); +}; -const writeUInt64LE = Buffer.prototype.writeBigUInt64LE - ? (buf, value, offset) => { - buf.writeBigUInt64LE(BigInt(value), offset); - } - : (buf, value, offset) => { - const low = value % 0x100000000; - const high = (value - low) / 0x100000000; - buf.writeUInt32LE(low, offset); - buf.writeUInt32LE(high, offset + 4); - }; +const indent = (str, prefix, noPrefixInFirstLine) => { + const rem = str.replace(/\n([^\n])/g, "\n" + prefix + "$1"); + if (noPrefixInFirstLine) return rem; + const ind = str[0] === "\n" ? "" : prefix; + return ind + rem; +}; -const readUInt64LE = Buffer.prototype.readBigUInt64LE - ? (buf, offset) => { - return Number(buf.readBigUInt64LE(offset)); - } - : (buf, offset) => { - const low = buf.readUInt32LE(offset); - const high = buf.readUInt32LE(offset + 4); - return high * 0x100000000 + low; - }; +const joinExplicitNewLine = (items, indenter) => { + let firstInLine = true; + let first = true; + return items + .map(item => { + if (!item || !item.content) return; + let content = indent(item.content, first ? "" : indenter, !firstInLine); + if (firstInLine) { + content = content.replace(/^\n+/, ""); + } + if (!content) return; + first = false; + const noJoiner = firstInLine || content.startsWith("\n"); + firstInLine = content.endsWith("\n"); + return noJoiner ? content : " " + content; + }) + .filter(Boolean) + .join("") + .trim(); +}; -/** - * @typedef {Object} SerializeResult - * @property {string | false} name - * @property {number} size - * @property {Promise=} backgroundJob - */ +const joinError = + error => + (items, { red, yellow }) => + `${error ? red("ERROR") : yellow("WARNING")} in ${joinExplicitNewLine( + items, + "" + )}`; -/** - * @param {FileMiddleware} middleware this - * @param {BufferSerializableType[] | Promise} data data to be serialized - * @param {string | boolean} name file base name - * @param {function(string | false, Buffer[], number): Promise} writeFile writes a file - * @param {string | Hash} hashFunction hash function to use - * @returns {Promise} resulting file pointer and promise - */ -const serialize = async ( - middleware, - data, - name, - writeFile, - hashFunction = "md4" -) => { - /** @type {(Buffer[] | Buffer | SerializeResult | Promise)[]} */ - const processedData = []; - /** @type {WeakMap>} */ - const resultToLazy = new WeakMap(); - /** @type {Buffer[]} */ - let lastBuffers = undefined; - for (const item of await data) { - if (typeof item === "function") { - if (!SerializerMiddleware.isLazy(item)) - throw new Error("Unexpected function"); - if (!SerializerMiddleware.isLazy(item, middleware)) { - throw new Error( - "Unexpected lazy value with non-this target (can't pass through lazy values)" - ); +/** @type {Record string>} */ +const SIMPLE_ELEMENT_JOINERS = { + compilation: items => { + const result = []; + let lastNeedMore = false; + for (const item of items) { + if (!item.content) continue; + const needMoreSpace = + item.element === "warnings" || + item.element === "filteredWarningDetailsCount" || + item.element === "errors" || + item.element === "filteredErrorDetailsCount" || + item.element === "logging"; + if (result.length !== 0) { + result.push(needMoreSpace || lastNeedMore ? "\n\n" : "\n"); } - lastBuffers = undefined; - const serializedInfo = SerializerMiddleware.getLazySerializedValue(item); - if (serializedInfo) { - if (typeof serializedInfo === "function") { - throw new Error( - "Unexpected lazy value with non-this target (can't pass through lazy values)" - ); - } else { - processedData.push(serializedInfo); + result.push(item.content); + lastNeedMore = needMoreSpace; + } + if (lastNeedMore) result.push("\n"); + return result.join(""); + }, + asset: items => + joinExplicitNewLine( + items.map(item => { + if ( + (item.element === "related" || item.element === "children") && + item.content + ) { + return { + ...item, + content: `\n${item.content}\n` + }; } - } else { - const content = item(); - if (content) { - const options = SerializerMiddleware.getLazyOptions(item); - processedData.push( - serialize( - middleware, - content, - (options && options.name) || true, - writeFile, - hashFunction - ).then(result => { - /** @type {any} */ (item).options.size = result.size; - resultToLazy.set(result, item); - return result; - }) - ); - } else { - throw new Error( - "Unexpected falsy value returned by lazy value function" - ); + return item; + }), + " " + ), + "asset.info": joinOneLine, + module: (items, { module }) => { + let hasName = false; + return joinExplicitNewLine( + items.map(item => { + switch (item.element) { + case "id": + if (module.id === module.name) { + if (hasName) return false; + if (item.content) hasName = true; + } + break; + case "name": + if (hasName) return false; + if (item.content) hasName = true; + break; + case "providedExports": + case "usedExports": + case "optimizationBailout": + case "reasons": + case "issuerPath": + case "profile": + case "children": + case "modules": + if (item.content) { + return { + ...item, + content: `\n${item.content}\n` + }; + } + break; } - } - } else if (item) { - if (lastBuffers) { - lastBuffers.push(item); - } else { - lastBuffers = [item]; - processedData.push(lastBuffers); - } - } else { - throw new Error("Unexpected falsy value in items array"); - } - } - /** @type {Promise[]} */ - const backgroundJobs = []; - const resolvedData = ( - await Promise.all( - /** @type {Promise[]} */ ( - processedData + return item; + }), + " " + ); + }, + chunk: items => { + let hasEntry = false; + return ( + "chunk " + + joinExplicitNewLine( + items.filter(item => { + switch (item.element) { + case "entry": + if (item.content) hasEntry = true; + break; + case "initial": + if (hasEntry) return false; + break; + } + return true; + }), + " " ) - ) - ).map(item => { - if (Array.isArray(item) || Buffer.isBuffer(item)) return item; + ); + }, + "chunk.childrenByOrder[]": items => `(${joinOneLine(items)})`, + chunkGroup: items => joinExplicitNewLine(items, " "), + chunkGroupAsset: joinOneLine, + chunkGroupChildGroup: joinOneLine, + chunkGroupChild: joinOneLine, + // moduleReason: (items, { moduleReason }) => { + // let hasName = false; + // return joinOneLine( + // items.filter(item => { + // switch (item.element) { + // case "moduleId": + // if (moduleReason.moduleId === moduleReason.module && item.content) + // hasName = true; + // break; + // case "module": + // if (hasName) return false; + // break; + // case "resolvedModule": + // return ( + // moduleReason.module !== moduleReason.resolvedModule && + // item.content + // ); + // } + // return true; + // }) + // ); + // }, + moduleReason: (items, { moduleReason }) => { + let hasName = false; + return joinExplicitNewLine( + items.map(item => { + switch (item.element) { + case "moduleId": + if (moduleReason.moduleId === moduleReason.module && item.content) + hasName = true; + break; + case "module": + if (hasName) return false; + break; + case "resolvedModule": + if (moduleReason.module === moduleReason.resolvedModule) + return false; + break; + case "children": + if (item.content) { + return { + ...item, + content: `\n${item.content}\n` + }; + } + break; + } + return item; + }), + " " + ); + }, + "module.profile": joinInBrackets, + moduleIssuer: joinOneLine, + chunkOrigin: items => "> " + joinOneLine(items), + "errors[].error": joinError(true), + "warnings[].error": joinError(false), + loggingGroup: items => joinExplicitNewLine(items, "").trimRight(), + moduleTraceItem: items => " @ " + joinOneLine(items), + moduleTraceDependency: joinOneLine +}; - backgroundJobs.push(item.backgroundJob); - // create pointer buffer from size and name - const name = /** @type {string} */ (item.name); - const nameBuffer = Buffer.from(name); - const buf = Buffer.allocUnsafe(8 + nameBuffer.length); - writeUInt64LE(buf, item.size, 0); - nameBuffer.copy(buf, 8, 0); - const lazy = resultToLazy.get(item); - SerializerMiddleware.setLazySerializedValue(lazy, buf); - return buf; - }); - const lengths = []; - for (const item of resolvedData) { - if (Array.isArray(item)) { - let l = 0; - for (const b of item) l += b.length; - while (l > 0x7fffffff) { - lengths.push(0x7fffffff); - l -= 0x7fffffff; - } - lengths.push(l); - } else if (item) { - lengths.push(-item.length); - } else { - throw new Error("Unexpected falsy value in resolved data " + item); - } - } - const header = Buffer.allocUnsafe(8 + lengths.length * 4); - header.writeUInt32LE(VERSION, 0); - header.writeUInt32LE(lengths.length, 4); - for (let i = 0; i < lengths.length; i++) { - header.writeInt32LE(lengths[i], 8 + i * 4); - } - const buf = [header]; - for (const item of resolvedData) { - if (Array.isArray(item)) { - for (const b of item) buf.push(b); - } else if (item) { - buf.push(item); - } - } - if (name === true) { - name = hashForName(buf, hashFunction); - } - let size = 0; - for (const b of buf) size += b.length; - backgroundJobs.push(writeFile(name, buf, size)); - return { - size, - name, - backgroundJob: - backgroundJobs.length === 1 - ? backgroundJobs[0] - : Promise.all(backgroundJobs) - }; +const AVAILABLE_COLORS = { + bold: "\u001b[1m", + yellow: "\u001b[1m\u001b[33m", + red: "\u001b[1m\u001b[31m", + green: "\u001b[1m\u001b[32m", + cyan: "\u001b[1m\u001b[36m", + magenta: "\u001b[1m\u001b[35m" }; -/** - * @param {FileMiddleware} middleware this - * @param {string | false} name filename - * @param {function(string | false): Promise} readFile read content of a file - * @returns {Promise} deserialized data - */ -const deserialize = async (middleware, name, readFile) => { - const contents = await readFile(name); - if (contents.length === 0) throw new Error("Empty file " + name); - let contentsIndex = 0; - let contentItem = contents[0]; - let contentItemLength = contentItem.length; - let contentPosition = 0; - if (contentItemLength === 0) throw new Error("Empty file " + name); - const nextContent = () => { - contentsIndex++; - contentItem = contents[contentsIndex]; - contentItemLength = contentItem.length; - contentPosition = 0; - }; - const ensureData = n => { - if (contentPosition === contentItemLength) { - nextContent(); - } - while (contentItemLength - contentPosition < n) { - const remaining = contentItem.slice(contentPosition); - let lengthFromNext = n - remaining.length; - const buffers = [remaining]; - for (let i = contentsIndex + 1; i < contents.length; i++) { - const l = contents[i].length; - if (l > lengthFromNext) { - buffers.push(contents[i].slice(0, lengthFromNext)); - contents[i] = contents[i].slice(lengthFromNext); - lengthFromNext = 0; - break; - } else { - buffers.push(contents[i]); - contentsIndex = i; - lengthFromNext -= l; - } - } - if (lengthFromNext > 0) throw new Error("Unexpected end of data"); - contentItem = Buffer.concat(buffers, n); - contentItemLength = n; - contentPosition = 0; +const AVAILABLE_FORMATS = { + formatChunkId: (id, { yellow }, direction) => { + switch (direction) { + case "parent": + return `<{${yellow(id)}}>`; + case "sibling": + return `={${yellow(id)}}=`; + case "child": + return `>{${yellow(id)}}<`; + default: + return `{${yellow(id)}}`; } - }; - const readUInt32LE = () => { - ensureData(4); - const value = contentItem.readUInt32LE(contentPosition); - contentPosition += 4; - return value; - }; - const readInt32LE = () => { - ensureData(4); - const value = contentItem.readInt32LE(contentPosition); - contentPosition += 4; - return value; - }; - const readSlice = l => { - ensureData(l); - if (contentPosition === 0 && contentItemLength === l) { - const result = contentItem; - if (contentsIndex + 1 < contents.length) { - nextContent(); - } else { - contentPosition = l; + }, + formatModuleId: id => `[${id}]`, + formatFilename: (filename, { green, yellow }, oversize) => + (oversize ? yellow : green)(filename), + formatFlag: flag => `[${flag}]`, + formatLayer: layer => `(in ${layer})`, + formatSize: (__webpack_require__(71070).formatSize), + formatDateTime: (dateTime, { bold }) => { + const d = new Date(dateTime); + const x = twoDigit; + const date = `${d.getFullYear()}-${x(d.getMonth() + 1)}-${x(d.getDate())}`; + const time = `${x(d.getHours())}:${x(d.getMinutes())}:${x(d.getSeconds())}`; + return `${date} ${bold(time)}`; + }, + formatTime: ( + time, + { timeReference, bold, green, yellow, red }, + boldQuantity + ) => { + const unit = " ms"; + if (timeReference && time !== timeReference) { + const times = [ + timeReference / 2, + timeReference / 4, + timeReference / 8, + timeReference / 16 + ]; + if (time < times[3]) return `${time}${unit}`; + else if (time < times[2]) return bold(`${time}${unit}`); + else if (time < times[1]) return green(`${time}${unit}`); + else if (time < times[0]) return yellow(`${time}${unit}`); + else return red(`${time}${unit}`); + } else { + return `${boldQuantity ? bold(time) : time}${unit}`; + } + }, + formatError: (message, { green, yellow, red }) => { + if (message.includes("\u001b[")) return message; + const highlights = [ + { regExp: /(Did you mean .+)/g, format: green }, + { + regExp: /(Set 'mode' option to 'development' or 'production')/g, + format: green + }, + { regExp: /(\(module has no exports\))/g, format: red }, + { regExp: /\(possible exports: (.+)\)/g, format: green }, + { regExp: /(?:^|\n)(.* doesn't exist)/g, format: red }, + { regExp: /('\w+' option has not been set)/g, format: red }, + { + regExp: /(Emitted value instead of an instance of Error)/g, + format: yellow + }, + { regExp: /(Used? .+ instead)/gi, format: yellow }, + { regExp: /\b(deprecated|must|required)\b/g, format: yellow }, + { + regExp: /\b(BREAKING CHANGE)\b/gi, + format: red + }, + { + regExp: + /\b(error|failed|unexpected|invalid|not found|not supported|not available|not possible|not implemented|doesn't support|conflict|conflicting|not existing|duplicate)\b/gi, + format: red } - return result; + ]; + for (const { regExp, format } of highlights) { + message = message.replace(regExp, (match, content) => { + return match.replace(content, format(content)); + }); } - const result = contentItem.slice(contentPosition, contentPosition + l); - contentPosition += l; - // we clone the buffer here to allow the original content to be garbage collected - return l * 2 < contentItem.buffer.byteLength ? Buffer.from(result) : result; - }; - const version = readUInt32LE(); - if (version !== VERSION) { - throw new Error("Invalid file version"); + return message; } - const sectionCount = readUInt32LE(); - const lengths = []; - let lastLengthPositive = false; - for (let i = 0; i < sectionCount; i++) { - const value = readInt32LE(); - const valuePositive = value >= 0; - if (lastLengthPositive && valuePositive) { - lengths[lengths.length - 1] += value; - } else { - lengths.push(value); - lastLengthPositive = valuePositive; +}; + +const RESULT_MODIFIER = { + "module.modules": result => { + return indent(result, "| "); + } +}; + +const createOrder = (array, preferredOrder) => { + const originalArray = array.slice(); + const set = new Set(array); + const usedSet = new Set(); + array.length = 0; + for (const element of preferredOrder) { + if (element.endsWith("!") || set.has(element)) { + array.push(element); + usedSet.add(element); } } - const result = []; - for (let length of lengths) { - if (length < 0) { - const slice = readSlice(-length); - const size = Number(readUInt64LE(slice, 0)); - const nameBuffer = slice.slice(8); - const name = nameBuffer.toString(); - result.push( - SerializerMiddleware.createLazy( - memoize(() => deserialize(middleware, name, readFile)), - middleware, - { - name, - size - }, - slice - ) - ); - } else { - if (contentPosition === contentItemLength) { - nextContent(); - } else if (contentPosition !== 0) { - if (length <= contentItemLength - contentPosition) { - result.push( - Buffer.from( - contentItem.buffer, - contentItem.byteOffset + contentPosition, - length - ) - ); - contentPosition += length; - length = 0; - } else { - const l = contentItemLength - contentPosition; - result.push( - Buffer.from( - contentItem.buffer, - contentItem.byteOffset + contentPosition, - l - ) - ); - length -= l; - contentPosition = contentItemLength; - } - } else { - if (length >= contentItemLength) { - result.push(contentItem); - length -= contentItemLength; - contentPosition = contentItemLength; - } else { - result.push( - Buffer.from(contentItem.buffer, contentItem.byteOffset, length) - ); - contentPosition += length; - length = 0; - } - } - while (length > 0) { - nextContent(); - if (length >= contentItemLength) { - result.push(contentItem); - length -= contentItemLength; - contentPosition = contentItemLength; - } else { - result.push( - Buffer.from(contentItem.buffer, contentItem.byteOffset, length) - ); - contentPosition += length; - length = 0; - } - } + for (const element of originalArray) { + if (!usedSet.has(element)) { + array.push(element); } } - return result; + return array; }; -/** - * @typedef {BufferSerializableType[]} DeserializedType - * @typedef {true} SerializedType - * @extends {SerializerMiddleware} - */ -class FileMiddleware extends SerializerMiddleware { - /** - * @param {IntermediateFileSystem} fs filesystem - * @param {string | Hash} hashFunction hash function to use - */ - constructor(fs, hashFunction = "md4") { - super(); - this.fs = fs; - this._hashFunction = hashFunction; - } +class DefaultStatsPrinterPlugin { /** - * @param {DeserializedType} data data - * @param {Object} context context object - * @returns {SerializedType|Promise} serialized data + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - serialize(data, context) { - const { filename, extension = "" } = context; - return new Promise((resolve, reject) => { - mkdirp(this.fs, dirname(this.fs, filename), err => { - if (err) return reject(err); - - // It's important that we don't touch existing files during serialization - // because serialize may read existing files (when deserializing) - const allWrittenFiles = new Set(); - const writeFile = async (name, content, size) => { - const file = name - ? join(this.fs, filename, `../${name}${extension}`) - : filename; - await new Promise((resolve, reject) => { - let stream = this.fs.createWriteStream(file + "_"); - let compression; - if (file.endsWith(".gz")) { - compression = createGzip({ - chunkSize: COMPRESSION_CHUNK_SIZE, - level: zConstants.Z_BEST_SPEED - }); - } else if (file.endsWith(".br")) { - compression = createBrotliCompress({ - chunkSize: COMPRESSION_CHUNK_SIZE, - params: { - [zConstants.BROTLI_PARAM_MODE]: zConstants.BROTLI_MODE_TEXT, - [zConstants.BROTLI_PARAM_QUALITY]: 2, - [zConstants.BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING]: true, - [zConstants.BROTLI_PARAM_SIZE_HINT]: size + apply(compiler) { + compiler.hooks.compilation.tap("DefaultStatsPrinterPlugin", compilation => { + compilation.hooks.statsPrinter.tap( + "DefaultStatsPrinterPlugin", + (stats, options, context) => { + // Put colors into context + stats.hooks.print + .for("compilation") + .tap("DefaultStatsPrinterPlugin", (compilation, context) => { + for (const color of Object.keys(AVAILABLE_COLORS)) { + let start; + if (options.colors) { + if ( + typeof options.colors === "object" && + typeof options.colors[color] === "string" + ) { + start = options.colors[color]; + } else { + start = AVAILABLE_COLORS[color]; + } } - }); - } - if (compression) { - pipeline(compression, stream, reject); - stream = compression; - stream.on("finish", () => resolve()); - } else { - stream.on("error", err => reject(err)); - stream.on("finish", () => resolve()); - } - // split into chunks for WRITE_LIMIT_CHUNK size - const chunks = []; - for (const b of content) { - if (b.length < WRITE_LIMIT_CHUNK) { - chunks.push(b); - } else { - for (let i = 0; i < b.length; i += WRITE_LIMIT_CHUNK) { - chunks.push(b.slice(i, i + WRITE_LIMIT_CHUNK)); + if (start) { + context[color] = str => + `${start}${ + typeof str === "string" + ? str.replace( + /((\u001b\[39m|\u001b\[22m|\u001b\[0m)+)/g, + `$1${start}` + ) + : str + }\u001b[39m\u001b[22m`; + } else { + context[color] = str => str; } } - } - - const len = chunks.length; - let i = 0; - const batchWrite = err => { - // will be handled in "on" error handler - if (err) return; - - if (i === len) { - stream.end(); - return; - } - - // queue up a batch of chunks up to the write limit - // end is exclusive - let end = i; - let sum = chunks[end++].length; - while (end < len) { - sum += chunks[end].length; - if (sum > WRITE_LIMIT_TOTAL) break; - end++; - } - while (i < end - 1) { - stream.write(chunks[i++]); + for (const format of Object.keys(AVAILABLE_FORMATS)) { + context[format] = (content, ...args) => + AVAILABLE_FORMATS[format](content, context, ...args); } - stream.write(chunks[i++], batchWrite); - }; - batchWrite(); - }); - if (name) allWrittenFiles.add(file); - }; - - resolve( - serialize(this, data, false, writeFile, this._hashFunction).then( - async ({ backgroundJob }) => { - await backgroundJob; - - // Rename the index file to disallow access during inconsistent file state - await new Promise(resolve => - this.fs.rename(filename, filename + ".old", err => { - resolve(); - }) - ); + context.timeReference = compilation.time; + }); - // update all written files - await Promise.all( - Array.from( - allWrittenFiles, - file => - new Promise((resolve, reject) => { - this.fs.rename(file + "_", file, err => { - if (err) return reject(err); - resolve(); - }); - }) - ) + for (const key of Object.keys(SIMPLE_PRINTERS)) { + stats.hooks.print + .for(key) + .tap("DefaultStatsPrinterPlugin", (obj, ctx) => + SIMPLE_PRINTERS[key](obj, ctx, stats) ); + } - // As final step automatically update the index file to have a consistent pack again - await new Promise(resolve => { - this.fs.rename(filename + "_", filename, err => { - if (err) return reject(err); - resolve(); - }); + for (const key of Object.keys(PREFERRED_ORDERS)) { + const preferredOrder = PREFERRED_ORDERS[key]; + stats.hooks.sortElements + .for(key) + .tap("DefaultStatsPrinterPlugin", (elements, context) => { + createOrder(elements, preferredOrder); }); - return /** @type {true} */ (true); - } - ) - ); - }); - }); - } - - /** - * @param {SerializedType} data data - * @param {Object} context context object - * @returns {DeserializedType|Promise} deserialized data - */ - deserialize(data, context) { - const { filename, extension = "" } = context; - const readFile = name => - new Promise((resolve, reject) => { - const file = name - ? join(this.fs, filename, `../${name}${extension}`) - : filename; - this.fs.stat(file, (err, stats) => { - if (err) { - reject(err); - return; - } - let remaining = /** @type {number} */ (stats.size); - let currentBuffer; - let currentBufferUsed; - const buf = []; - let decompression; - if (file.endsWith(".gz")) { - decompression = createGunzip({ - chunkSize: DECOMPRESSION_CHUNK_SIZE - }); - } else if (file.endsWith(".br")) { - decompression = createBrotliDecompress({ - chunkSize: DECOMPRESSION_CHUNK_SIZE - }); - } - if (decompression) { - let newResolve, newReject; - resolve( - Promise.all([ - new Promise((rs, rj) => { - newResolve = rs; - newReject = rj; - }), - new Promise((resolve, reject) => { - decompression.on("data", chunk => buf.push(chunk)); - decompression.on("end", () => resolve()); - decompression.on("error", err => reject(err)); - }) - ]).then(() => buf) - ); - resolve = newResolve; - reject = newReject; } - this.fs.open(file, "r", (err, fd) => { - if (err) { - reject(err); - return; - } - const read = () => { - if (currentBuffer === undefined) { - currentBuffer = Buffer.allocUnsafeSlow( - Math.min( - constants.MAX_LENGTH, - remaining, - decompression ? DECOMPRESSION_CHUNK_SIZE : Infinity - ) - ); - currentBufferUsed = 0; - } - let readBuffer = currentBuffer; - let readOffset = currentBufferUsed; - let readLength = currentBuffer.length - currentBufferUsed; - // values passed to fs.read must be valid int32 values - if (readOffset > 0x7fffffff) { - readBuffer = currentBuffer.slice(readOffset); - readOffset = 0; - } - if (readLength > 0x7fffffff) { - readLength = 0x7fffffff; - } - this.fs.read( - fd, - readBuffer, - readOffset, - readLength, - null, - (err, bytesRead) => { - if (err) { - this.fs.close(fd, () => { - reject(err); - }); - return; - } - currentBufferUsed += bytesRead; - remaining -= bytesRead; - if (currentBufferUsed === currentBuffer.length) { - if (decompression) { - decompression.write(currentBuffer); - } else { - buf.push(currentBuffer); - } - currentBuffer = undefined; - if (remaining === 0) { - if (decompression) { - decompression.end(); - } - this.fs.close(fd, err => { - if (err) { - reject(err); - return; - } - resolve(buf); - }); - return; - } - } - read(); - } - ); - }; - read(); - }); - }); - }); - return deserialize(this, false, readFile); - } -} - -module.exports = FileMiddleware; - - -/***/ }), - -/***/ 86791: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + for (const key of Object.keys(ITEM_NAMES)) { + const itemName = ITEM_NAMES[key]; + stats.hooks.getItemName + .for(key) + .tap( + "DefaultStatsPrinterPlugin", + typeof itemName === "string" ? () => itemName : itemName + ); + } + for (const key of Object.keys(SIMPLE_ITEMS_JOINER)) { + const joiner = SIMPLE_ITEMS_JOINER[key]; + stats.hooks.printItems + .for(key) + .tap("DefaultStatsPrinterPlugin", joiner); + } -class MapObjectSerializer { - serialize(obj, { write }) { - write(obj.size); - for (const key of obj.keys()) { - write(key); - } - for (const value of obj.values()) { - write(value); - } - } - deserialize({ read }) { - let size = read(); - const map = new Map(); - const keys = []; - for (let i = 0; i < size; i++) { - keys.push(read()); - } - for (let i = 0; i < size; i++) { - map.set(keys[i], read()); - } - return map; + for (const key of Object.keys(SIMPLE_ELEMENT_JOINERS)) { + const joiner = SIMPLE_ELEMENT_JOINERS[key]; + stats.hooks.printElements + .for(key) + .tap("DefaultStatsPrinterPlugin", joiner); + } + + for (const key of Object.keys(RESULT_MODIFIER)) { + const modifier = RESULT_MODIFIER[key]; + stats.hooks.result + .for(key) + .tap("DefaultStatsPrinterPlugin", modifier); + } + } + ); + }); } } - -module.exports = MapObjectSerializer; +module.exports = DefaultStatsPrinterPlugin; /***/ }), -/***/ 21048: -/***/ (function(module) { +/***/ 92629: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -class NullPrototypeObjectSerializer { - serialize(obj, { write }) { - const keys = Object.keys(obj); - for (const key of keys) { - write(key); - } - write(null); - for (const key of keys) { - write(obj[key]); +const { HookMap, SyncBailHook, SyncWaterfallHook } = __webpack_require__(6967); +const { concatComparators, keepOriginalOrder } = __webpack_require__(29579); +const smartGrouping = __webpack_require__(15652); + +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../WebpackError")} WebpackError */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + +/** @typedef {import("../util/smartGrouping").GroupConfig} GroupConfig */ + +/** + * @typedef {Object} KnownStatsFactoryContext + * @property {string} type + * @property {function(string): string=} makePathsRelative + * @property {Compilation=} compilation + * @property {Set=} rootModules + * @property {Map=} compilationFileToChunks + * @property {Map=} compilationAuxiliaryFileToChunks + * @property {RuntimeSpec=} runtime + * @property {function(Compilation): WebpackError[]=} cachedGetErrors + * @property {function(Compilation): WebpackError[]=} cachedGetWarnings + */ + +/** @typedef {KnownStatsFactoryContext & Record} StatsFactoryContext */ + +class StatsFactory { + constructor() { + this.hooks = Object.freeze({ + /** @type {HookMap>} */ + extract: new HookMap( + () => new SyncBailHook(["object", "data", "context"]) + ), + /** @type {HookMap>} */ + filter: new HookMap( + () => new SyncBailHook(["item", "context", "index", "unfilteredIndex"]) + ), + /** @type {HookMap>} */ + sort: new HookMap(() => new SyncBailHook(["comparators", "context"])), + /** @type {HookMap>} */ + filterSorted: new HookMap( + () => new SyncBailHook(["item", "context", "index", "unfilteredIndex"]) + ), + /** @type {HookMap>} */ + groupResults: new HookMap( + () => new SyncBailHook(["groupConfigs", "context"]) + ), + /** @type {HookMap>} */ + sortResults: new HookMap( + () => new SyncBailHook(["comparators", "context"]) + ), + /** @type {HookMap>} */ + filterResults: new HookMap( + () => new SyncBailHook(["item", "context", "index", "unfilteredIndex"]) + ), + /** @type {HookMap>} */ + merge: new HookMap(() => new SyncBailHook(["items", "context"])), + /** @type {HookMap>} */ + result: new HookMap(() => new SyncWaterfallHook(["result", "context"])), + /** @type {HookMap>} */ + getItemName: new HookMap(() => new SyncBailHook(["item", "context"])), + /** @type {HookMap>} */ + getItemFactory: new HookMap(() => new SyncBailHook(["item", "context"])) + }); + const hooks = this.hooks; + this._caches = + /** @type {Record[]>>} */ ({}); + for (const key of Object.keys(hooks)) { + this._caches[key] = new Map(); } + this._inCreate = false; } - deserialize({ read }) { - const obj = Object.create(null); - const keys = []; - let key = read(); - while (key !== null) { - keys.push(key); - key = read(); + + _getAllLevelHooks(hookMap, cache, type) { + const cacheEntry = cache.get(type); + if (cacheEntry !== undefined) { + return cacheEntry; } - for (const key of keys) { - obj[key] = read(); + const hooks = []; + const typeParts = type.split("."); + for (let i = 0; i < typeParts.length; i++) { + const hook = hookMap.get(typeParts.slice(i).join(".")); + if (hook) { + hooks.push(hook); + } } - return obj; + cache.set(type, hooks); + return hooks; } -} - -module.exports = NullPrototypeObjectSerializer; - - -/***/ }), -/***/ 34795: -/***/ (function(module, exports, __webpack_require__) { + _forEachLevel(hookMap, cache, type, fn) { + for (const hook of this._getAllLevelHooks(hookMap, cache, type)) { + const result = fn(hook); + if (result !== undefined) return result; + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + _forEachLevelWaterfall(hookMap, cache, type, data, fn) { + for (const hook of this._getAllLevelHooks(hookMap, cache, type)) { + data = fn(hook, data); + } + return data; + } + _forEachLevelFilter(hookMap, cache, type, items, fn, forceClone) { + const hooks = this._getAllLevelHooks(hookMap, cache, type); + if (hooks.length === 0) return forceClone ? items.slice() : items; + let i = 0; + return items.filter((item, idx) => { + for (const hook of hooks) { + const r = fn(hook, item, idx, i); + if (r !== undefined) { + if (r) i++; + return r; + } + } + i++; + return true; + }); + } + /** + * @param {string} type type + * @param {any} data factory data + * @param {Omit} baseContext context used as base + * @returns {any} created object + */ + create(type, data, baseContext) { + if (this._inCreate) { + return this._create(type, data, baseContext); + } else { + try { + this._inCreate = true; + return this._create(type, data, baseContext); + } finally { + for (const key of Object.keys(this._caches)) this._caches[key].clear(); + this._inCreate = false; + } + } + } -const createHash = __webpack_require__(49835); -const ArraySerializer = __webpack_require__(41721); -const DateObjectSerializer = __webpack_require__(93475); -const ErrorObjectSerializer = __webpack_require__(79479); -const MapObjectSerializer = __webpack_require__(86791); -const NullPrototypeObjectSerializer = __webpack_require__(21048); -const PlainObjectSerializer = __webpack_require__(33040); -const RegExpObjectSerializer = __webpack_require__(57328); -const SerializerMiddleware = __webpack_require__(83137); -const SetObjectSerializer = __webpack_require__(79240); + _create(type, data, baseContext) { + const context = { + ...baseContext, + type, + [type]: data + }; + if (Array.isArray(data)) { + // run filter on unsorted items + const items = this._forEachLevelFilter( + this.hooks.filter, + this._caches.filter, + type, + data, + (h, r, idx, i) => h.call(r, context, idx, i), + true + ); -/** @typedef {typeof import("../util/Hash")} Hash */ -/** @typedef {import("./types").ComplexSerializableType} ComplexSerializableType */ -/** @typedef {import("./types").PrimitiveSerializableType} PrimitiveSerializableType */ + // sort items + const comparators = []; + this._forEachLevel(this.hooks.sort, this._caches.sort, type, h => + h.call(comparators, context) + ); + if (comparators.length > 0) { + items.sort( + // @ts-expect-error number of arguments is correct + concatComparators(...comparators, keepOriginalOrder(items)) + ); + } -/** @typedef {new (...params: any[]) => any} Constructor */ + // run filter on sorted items + const items2 = this._forEachLevelFilter( + this.hooks.filterSorted, + this._caches.filterSorted, + type, + items, + (h, r, idx, i) => h.call(r, context, idx, i), + false + ); -/* + // for each item + let resultItems = items2.map((item, i) => { + const itemContext = { + ...context, + _index: i + }; -Format: + // run getItemName + const itemName = this._forEachLevel( + this.hooks.getItemName, + this._caches.getItemName, + `${type}[]`, + h => h.call(item, itemContext) + ); + if (itemName) itemContext[itemName] = item; + const innerType = itemName ? `${type}[].${itemName}` : `${type}[]`; -File -> Section* -Section -> ObjectSection | ReferenceSection | EscapeSection | OtherSection + // run getItemFactory + const itemFactory = + this._forEachLevel( + this.hooks.getItemFactory, + this._caches.getItemFactory, + innerType, + h => h.call(item, itemContext) + ) || this; -ObjectSection -> ESCAPE ( - number:relativeOffset (number > 0) | - string:request (string|null):export -) Section:value* ESCAPE ESCAPE_END_OBJECT -ReferenceSection -> ESCAPE number:relativeOffset (number < 0) -EscapeSection -> ESCAPE ESCAPE_ESCAPE_VALUE (escaped value ESCAPE) -EscapeSection -> ESCAPE ESCAPE_UNDEFINED (escaped value ESCAPE) -OtherSection -> any (except ESCAPE) + // run item factory + return itemFactory.create(innerType, item, itemContext); + }); -Why using null as escape value? -Multiple null values can merged by the BinaryMiddleware, which makes it very efficient -Technically any value can be used. + // sort result items + const comparators2 = []; + this._forEachLevel( + this.hooks.sortResults, + this._caches.sortResults, + type, + h => h.call(comparators2, context) + ); + if (comparators2.length > 0) { + resultItems.sort( + // @ts-expect-error number of arguments is correct + concatComparators(...comparators2, keepOriginalOrder(resultItems)) + ); + } -*/ + // group result items + const groupConfigs = []; + this._forEachLevel( + this.hooks.groupResults, + this._caches.groupResults, + type, + h => h.call(groupConfigs, context) + ); + if (groupConfigs.length > 0) { + resultItems = smartGrouping(resultItems, groupConfigs); + } -/** - * @typedef {Object} ObjectSerializerContext - * @property {function(any): void} write - */ + // run filter on sorted result items + const finalResultItems = this._forEachLevelFilter( + this.hooks.filterResults, + this._caches.filterResults, + type, + resultItems, + (h, r, idx, i) => h.call(r, context, idx, i), + false + ); -/** - * @typedef {Object} ObjectDeserializerContext - * @property {function(): any} read - */ + // run merge on mapped items + let result = this._forEachLevel( + this.hooks.merge, + this._caches.merge, + type, + h => h.call(finalResultItems, context) + ); + if (result === undefined) result = finalResultItems; -/** - * @typedef {Object} ObjectSerializer - * @property {function(any, ObjectSerializerContext): void} serialize - * @property {function(ObjectDeserializerContext): any} deserialize - */ + // run result on merged items + return this._forEachLevelWaterfall( + this.hooks.result, + this._caches.result, + type, + result, + (h, r) => h.call(r, context) + ); + } else { + const object = {}; -const setSetSize = (set, size) => { - let i = 0; - for (const item of set) { - if (i++ >= size) { - set.delete(item); - } - } -}; + // run extract on value + this._forEachLevel(this.hooks.extract, this._caches.extract, type, h => + h.call(object, data, context) + ); -const setMapSize = (map, size) => { - let i = 0; - for (const item of map.keys()) { - if (i++ >= size) { - map.delete(item); + // run result on extracted object + return this._forEachLevelWaterfall( + this.hooks.result, + this._caches.result, + type, + object, + (h, r) => h.call(r, context) + ); } } -}; - -/** - * @param {Buffer} buffer buffer - * @param {string | Hash} hashFunction hash function to use - * @returns {string} hash - */ -const toHash = (buffer, hashFunction) => { - const hash = createHash(hashFunction); - hash.update(buffer); - return /** @type {string} */ (hash.digest("latin1")); -}; - -const ESCAPE = null; -const ESCAPE_ESCAPE_VALUE = null; -const ESCAPE_END_OBJECT = true; -const ESCAPE_UNDEFINED = false; +} +module.exports = StatsFactory; -const CURRENT_VERSION = 2; -const serializers = new Map(); -const serializerInversed = new Map(); +/***/ }), -const loadedRequests = new Set(); +/***/ 30198: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -const NOT_SERIALIZABLE = {}; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -const jsTypes = new Map(); -jsTypes.set(Object, new PlainObjectSerializer()); -jsTypes.set(Array, new ArraySerializer()); -jsTypes.set(null, new NullPrototypeObjectSerializer()); -jsTypes.set(Map, new MapObjectSerializer()); -jsTypes.set(Set, new SetObjectSerializer()); -jsTypes.set(Date, new DateObjectSerializer()); -jsTypes.set(RegExp, new RegExpObjectSerializer()); -jsTypes.set(Error, new ErrorObjectSerializer(Error)); -jsTypes.set(EvalError, new ErrorObjectSerializer(EvalError)); -jsTypes.set(RangeError, new ErrorObjectSerializer(RangeError)); -jsTypes.set(ReferenceError, new ErrorObjectSerializer(ReferenceError)); -jsTypes.set(SyntaxError, new ErrorObjectSerializer(SyntaxError)); -jsTypes.set(TypeError, new ErrorObjectSerializer(TypeError)); -// If in a sandboxed environment (e. g. jest), this escapes the sandbox and registers -// real Object and Array types to. These types may occur in the wild too, e. g. when -// using Structured Clone in postMessage. -if (exports.constructor !== Object) { - const Obj = /** @type {typeof Object} */ (exports.constructor); - const Fn = /** @type {typeof Function} */ (Obj.constructor); - for (const [type, config] of Array.from(jsTypes)) { - if (type) { - const Type = new Fn(`return ${type.name};`)(); - jsTypes.set(Type, config); - } - } -} -{ - let i = 1; - for (const [type, serializer] of jsTypes) { - serializers.set(type, { - request: "", - name: i++, - serializer - }); - } -} +const { HookMap, SyncWaterfallHook, SyncBailHook } = __webpack_require__(6967); -for (const { request, name, serializer } of serializers.values()) { - serializerInversed.set(`${request}/${name}`, serializer); -} +/** @template T @typedef {import("tapable").AsArray} AsArray */ +/** @typedef {import("tapable").Hook} Hook */ +/** @typedef {import("./DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */ +/** @typedef {import("./DefaultStatsFactoryPlugin").StatsChunk} StatsChunk */ +/** @typedef {import("./DefaultStatsFactoryPlugin").StatsChunkGroup} StatsChunkGroup */ +/** @typedef {import("./DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */ +/** @typedef {import("./DefaultStatsFactoryPlugin").StatsModule} StatsModule */ +/** @typedef {import("./DefaultStatsFactoryPlugin").StatsModuleReason} StatsModuleReason */ -/** @type {Map boolean>} */ -const loaders = new Map(); +/** + * @typedef {Object} PrintedElement + * @property {string} element + * @property {string} content + */ /** - * @typedef {ComplexSerializableType[]} DeserializedType - * @typedef {PrimitiveSerializableType[]} SerializedType - * @extends {SerializerMiddleware} + * @typedef {Object} KnownStatsPrinterContext + * @property {string=} type + * @property {StatsCompilation=} compilation + * @property {StatsChunkGroup=} chunkGroup + * @property {StatsAsset=} asset + * @property {StatsModule=} module + * @property {StatsChunk=} chunk + * @property {StatsModuleReason=} moduleReason + * @property {(str: string) => string=} bold + * @property {(str: string) => string=} yellow + * @property {(str: string) => string=} red + * @property {(str: string) => string=} green + * @property {(str: string) => string=} magenta + * @property {(str: string) => string=} cyan + * @property {(file: string, oversize?: boolean) => string=} formatFilename + * @property {(id: string) => string=} formatModuleId + * @property {(id: string, direction?: "parent"|"child"|"sibling") => string=} formatChunkId + * @property {(size: number) => string=} formatSize + * @property {(dateTime: number) => string=} formatDateTime + * @property {(flag: string) => string=} formatFlag + * @property {(time: number, boldQuantity?: boolean) => string=} formatTime + * @property {string=} chunkGroupKind */ -class ObjectMiddleware extends SerializerMiddleware { - /** - * @param {function(any): void} extendContext context extensions - * @param {string | Hash} hashFunction hash function to use - */ - constructor(extendContext, hashFunction = "md4") { - super(); - this.extendContext = extendContext; - this._hashFunction = hashFunction; + +/** @typedef {KnownStatsPrinterContext & Record} StatsPrinterContext */ + +class StatsPrinter { + constructor() { + this.hooks = Object.freeze({ + /** @type {HookMap>} */ + sortElements: new HookMap( + () => new SyncBailHook(["elements", "context"]) + ), + /** @type {HookMap>} */ + printElements: new HookMap( + () => new SyncBailHook(["printedElements", "context"]) + ), + /** @type {HookMap>} */ + sortItems: new HookMap(() => new SyncBailHook(["items", "context"])), + /** @type {HookMap>} */ + getItemName: new HookMap(() => new SyncBailHook(["item", "context"])), + /** @type {HookMap>} */ + printItems: new HookMap( + () => new SyncBailHook(["printedItems", "context"]) + ), + /** @type {HookMap>} */ + print: new HookMap(() => new SyncBailHook(["object", "context"])), + /** @type {HookMap>} */ + result: new HookMap(() => new SyncWaterfallHook(["result", "context"])) + }); + /** @type {Map, Map>} */ + this._levelHookCache = new Map(); + this._inPrint = false; } + /** - * @param {RegExp} regExp RegExp for which the request is tested - * @param {function(string): boolean} loader loader to load the request, returns true when successful - * @returns {void} + * get all level hooks + * @private + * @template {Hook} T + * @param {HookMap} hookMap HookMap + * @param {string} type type + * @returns {T[]} hooks */ - static registerLoader(regExp, loader) { - loaders.set(regExp, loader); + _getAllLevelHooks(hookMap, type) { + let cache = /** @type {Map} */ ( + this._levelHookCache.get(hookMap) + ); + if (cache === undefined) { + cache = new Map(); + this._levelHookCache.set(hookMap, cache); + } + const cacheEntry = cache.get(type); + if (cacheEntry !== undefined) { + return cacheEntry; + } + /** @type {T[]} */ + const hooks = []; + const typeParts = type.split("."); + for (let i = 0; i < typeParts.length; i++) { + const hook = hookMap.get(typeParts.slice(i).join(".")); + if (hook) { + hooks.push(hook); + } + } + cache.set(type, hooks); + return hooks; } /** - * @param {Constructor} Constructor the constructor - * @param {string} request the request which will be required when deserializing - * @param {string} name the name to make multiple serializer unique when sharing a request - * @param {ObjectSerializer} serializer the serializer - * @returns {void} + * Run `fn` for each level + * @private + * @template T + * @template R + * @param {HookMap>} hookMap HookMap + * @param {string} type type + * @param {(hook: SyncBailHook) => R} fn function + * @returns {R} result of `fn` */ - static register(Constructor, request, name, serializer) { - const key = request + "/" + name; - - if (serializers.has(Constructor)) { - throw new Error( - `ObjectMiddleware.register: serializer for ${Constructor.name} is already registered` - ); - } - - if (serializerInversed.has(key)) { - throw new Error( - `ObjectMiddleware.register: serializer for ${key} is already registered` - ); + _forEachLevel(hookMap, type, fn) { + for (const hook of this._getAllLevelHooks(hookMap, type)) { + const result = fn(hook); + if (result !== undefined) return result; } - - serializers.set(Constructor, { - request, - name, - serializer - }); - - serializerInversed.set(key, serializer); } /** - * @param {Constructor} Constructor the constructor - * @returns {void} + * Run `fn` for each level + * @private + * @template T + * @param {HookMap>} hookMap HookMap + * @param {string} type type + * @param {AsArray[0]} data data + * @param {(hook: SyncWaterfallHook, data: AsArray[0]) => AsArray[0]} fn function + * @returns {AsArray[0]} result of `fn` */ - static registerNotSerializable(Constructor) { - if (serializers.has(Constructor)) { - throw new Error( - `ObjectMiddleware.registerNotSerializable: serializer for ${Constructor.name} is already registered` - ); + _forEachLevelWaterfall(hookMap, type, data, fn) { + for (const hook of this._getAllLevelHooks(hookMap, type)) { + data = fn(hook, data); } - - serializers.set(Constructor, NOT_SERIALIZABLE); + return data; } - static getSerializerFor(object) { - const proto = Object.getPrototypeOf(object); - let c; - if (proto === null) { - // Object created with Object.create(null) - c = null; + /** + * @param {string} type The type + * @param {Object} object Object to print + * @param {Object=} baseContext The base context + * @returns {string} printed result + */ + print(type, object, baseContext) { + if (this._inPrint) { + return this._print(type, object, baseContext); } else { - c = proto.constructor; - if (!c) { - throw new Error( - "Serialization of objects with prototype without valid constructor property not possible" - ); + try { + this._inPrint = true; + return this._print(type, object, baseContext); + } finally { + this._levelHookCache.clear(); + this._inPrint = false; } } - const config = serializers.get(c); - - if (!config) throw new Error(`No serializer registered for ${c.name}`); - if (config === NOT_SERIALIZABLE) throw NOT_SERIALIZABLE; - - return config; - } - - static getDeserializerFor(request, name) { - const key = request + "/" + name; - const serializer = serializerInversed.get(key); - - if (serializer === undefined) { - throw new Error(`No deserializer registered for ${key}`); - } - - return serializer; - } - - static _getDeserializerForWithoutError(request, name) { - const key = request + "/" + name; - const serializer = serializerInversed.get(key); - return serializer; } /** - * @param {DeserializedType} data data - * @param {Object} context context object - * @returns {SerializedType|Promise} serialized data + * @private + * @param {string} type type + * @param {Object} object object + * @param {Object=} baseContext context + * @returns {string} printed result */ - serialize(data, context) { - /** @type {any[]} */ - let result = [CURRENT_VERSION]; - let currentPos = 0; - let referenceable = new Map(); - const addReferenceable = item => { - referenceable.set(item, currentPos++); - }; - let bufferDedupeMap = new Map(); - const dedupeBuffer = buf => { - const len = buf.length; - const entry = bufferDedupeMap.get(len); - if (entry === undefined) { - bufferDedupeMap.set(len, buf); - return buf; - } - if (Buffer.isBuffer(entry)) { - if (len < 32) { - if (buf.equals(entry)) { - return entry; - } - bufferDedupeMap.set(len, [entry, buf]); - return buf; - } else { - const hash = toHash(entry, this._hashFunction); - const newMap = new Map(); - newMap.set(hash, entry); - bufferDedupeMap.set(len, newMap); - const hashBuf = toHash(buf, this._hashFunction); - if (hash === hashBuf) { - return entry; - } - return buf; - } - } else if (Array.isArray(entry)) { - if (entry.length < 16) { - for (const item of entry) { - if (buf.equals(item)) { - return item; - } - } - entry.push(buf); - return buf; - } else { - const newMap = new Map(); - const hash = toHash(buf, this._hashFunction); - let found; - for (const item of entry) { - const itemHash = toHash(item, this._hashFunction); - newMap.set(itemHash, item); - if (found === undefined && itemHash === hash) found = item; - } - bufferDedupeMap.set(len, newMap); - if (found === undefined) { - newMap.set(hash, buf); - return buf; - } else { - return found; - } - } - } else { - const hash = toHash(buf, this._hashFunction); - const item = entry.get(hash); - if (item !== undefined) { - return item; - } - entry.set(hash, buf); - return buf; - } - }; - let currentPosTypeLookup = 0; - let objectTypeLookup = new Map(); - const cycleStack = new Set(); - const stackToString = item => { - const arr = Array.from(cycleStack); - arr.push(item); - return arr - .map(item => { - if (typeof item === "string") { - if (item.length > 100) { - return `String ${JSON.stringify(item.slice(0, 100)).slice( - 0, - -1 - )}..."`; - } - return `String ${JSON.stringify(item)}`; - } - try { - const { request, name } = ObjectMiddleware.getSerializerFor(item); - if (request) { - return `${request}${name ? `.${name}` : ""}`; - } - } catch (e) { - // ignore -> fallback - } - if (typeof item === "object" && item !== null) { - if (item.constructor) { - if (item.constructor === Object) - return `Object { ${Object.keys(item).join(", ")} }`; - if (item.constructor === Map) return `Map { ${item.size} items }`; - if (item.constructor === Array) - return `Array { ${item.length} items }`; - if (item.constructor === Set) return `Set { ${item.size} items }`; - if (item.constructor === RegExp) return item.toString(); - return `${item.constructor.name}`; - } - return `Object [null prototype] { ${Object.keys(item).join( - ", " - )} }`; - } - try { - return `${item}`; - } catch (e) { - return `(${e.message})`; - } - }) - .join(" -> "); - }; - let hasDebugInfoAttached; - let ctx = { - write(value, key) { - try { - process(value); - } catch (e) { - if (e !== NOT_SERIALIZABLE) { - if (hasDebugInfoAttached === undefined) - hasDebugInfoAttached = new WeakSet(); - if (!hasDebugInfoAttached.has(e)) { - e.message += `\nwhile serializing ${stackToString(value)}`; - hasDebugInfoAttached.add(e); - } - } - throw e; - } - }, - setCircularReference(ref) { - addReferenceable(ref); - }, - snapshot() { - return { - length: result.length, - cycleStackSize: cycleStack.size, - referenceableSize: referenceable.size, - currentPos, - objectTypeLookupSize: objectTypeLookup.size, - currentPosTypeLookup - }; - }, - rollback(snapshot) { - result.length = snapshot.length; - setSetSize(cycleStack, snapshot.cycleStackSize); - setMapSize(referenceable, snapshot.referenceableSize); - currentPos = snapshot.currentPos; - setMapSize(objectTypeLookup, snapshot.objectTypeLookupSize); - currentPosTypeLookup = snapshot.currentPosTypeLookup; - }, - ...context + _print(type, object, baseContext) { + const context = { + ...baseContext, + type, + [type]: object }; - this.extendContext(ctx); - const process = item => { - if (Buffer.isBuffer(item)) { - // check if we can emit a reference - const ref = referenceable.get(item); - if (ref !== undefined) { - result.push(ESCAPE, ref - currentPos); - return; - } - const alreadyUsedBuffer = dedupeBuffer(item); - if (alreadyUsedBuffer !== item) { - const ref = referenceable.get(alreadyUsedBuffer); - if (ref !== undefined) { - referenceable.set(item, ref); - result.push(ESCAPE, ref - currentPos); - return; - } - item = alreadyUsedBuffer; - } - addReferenceable(item); - result.push(item); - } else if (item === ESCAPE) { - result.push(ESCAPE, ESCAPE_ESCAPE_VALUE); - } else if ( - typeof item === "object" - // We don't have to check for null as ESCAPE is null and this has been checked before - ) { - // check if we can emit a reference - const ref = referenceable.get(item); - if (ref !== undefined) { - result.push(ESCAPE, ref - currentPos); - return; - } - - if (cycleStack.has(item)) { - throw new Error( - `This is a circular references. To serialize circular references use 'setCircularReference' somewhere in the circle during serialize and deserialize.` + let printResult = this._forEachLevel(this.hooks.print, type, hook => + hook.call(object, context) + ); + if (printResult === undefined) { + if (Array.isArray(object)) { + const sortedItems = object.slice(); + this._forEachLevel(this.hooks.sortItems, type, h => + h.call(sortedItems, context) + ); + const printedItems = sortedItems.map((item, i) => { + const itemContext = { + ...context, + _index: i + }; + const itemName = this._forEachLevel( + this.hooks.getItemName, + `${type}[]`, + h => h.call(item, itemContext) ); - } - - const { request, name, serializer } = - ObjectMiddleware.getSerializerFor(item); - const key = `${request}/${name}`; - const lastIndex = objectTypeLookup.get(key); - - if (lastIndex === undefined) { - objectTypeLookup.set(key, currentPosTypeLookup++); - - result.push(ESCAPE, request, name); - } else { - result.push(ESCAPE, currentPosTypeLookup - lastIndex); - } - - cycleStack.add(item); - - try { - serializer.serialize(item, ctx); - } finally { - cycleStack.delete(item); - } - - result.push(ESCAPE, ESCAPE_END_OBJECT); - - addReferenceable(item); - } else if (typeof item === "string") { - if (item.length > 1) { - // short strings are shorter when not emitting a reference (this saves 1 byte per empty string) - // check if we can emit a reference - const ref = referenceable.get(item); - if (ref !== undefined) { - result.push(ESCAPE, ref - currentPos); - return; - } - addReferenceable(item); - } - - if (item.length > 102400 && context.logger) { - context.logger.warn( - `Serializing big strings (${Math.round( - item.length / 1024 - )}kiB) impacts deserialization performance (consider using Buffer instead and decode when needed)` + if (itemName) itemContext[itemName] = item; + return this.print( + itemName ? `${type}[].${itemName}` : `${type}[]`, + item, + itemContext ); + }); + printResult = this._forEachLevel(this.hooks.printItems, type, h => + h.call(printedItems, context) + ); + if (printResult === undefined) { + const result = printedItems.filter(Boolean); + if (result.length > 0) printResult = result.join("\n"); } - - result.push(item); - } else if (typeof item === "function") { - if (!SerializerMiddleware.isLazy(item)) - throw new Error("Unexpected function " + item); - /** @type {SerializedType} */ - const serializedData = - SerializerMiddleware.getLazySerializedValue(item); - if (serializedData !== undefined) { - if (typeof serializedData === "function") { - result.push(serializedData); - } else { - throw new Error("Not implemented"); - } - } else if (SerializerMiddleware.isLazy(item, this)) { - throw new Error("Not implemented"); - } else { - const data = SerializerMiddleware.serializeLazy(item, data => - this.serialize([data], context) - ); - SerializerMiddleware.setLazySerializedValue(item, data); - result.push(data); + } else if (object !== null && typeof object === "object") { + const elements = Object.keys(object).filter( + key => object[key] !== undefined + ); + this._forEachLevel(this.hooks.sortElements, type, h => + h.call(elements, context) + ); + const printedElements = elements.map(element => { + const content = this.print(`${type}.${element}`, object[element], { + ...context, + _parent: object, + _element: element, + [element]: object[element] + }); + return { element, content }; + }); + printResult = this._forEachLevel(this.hooks.printElements, type, h => + h.call(printedElements, context) + ); + if (printResult === undefined) { + const result = printedElements.map(e => e.content).filter(Boolean); + if (result.length > 0) printResult = result.join("\n"); } - } else if (item === undefined) { - result.push(ESCAPE, ESCAPE_UNDEFINED); - } else { - result.push(item); - } - }; - - try { - for (const item of data) { - process(item); } - return result; - } catch (e) { - if (e === NOT_SERIALIZABLE) return null; - - throw e; - } finally { - // Get rid of these references to avoid leaking memory - // This happens because the optimized code v8 generates - // is optimized for our "ctx.write" method so it will reference - // it from e. g. Dependency.prototype.serialize -(IC)-> ctx.write - data = - result = - referenceable = - bufferDedupeMap = - objectTypeLookup = - ctx = - undefined; } + + return this._forEachLevelWaterfall( + this.hooks.result, + type, + printResult, + (h, r) => h.call(r, context) + ); } +} +module.exports = StatsPrinter; + + +/***/ }), + +/***/ 84953: +/***/ (function(__unused_webpack_module, exports) { - /** - * @param {SerializedType} data data - * @param {Object} context context object - * @returns {DeserializedType|Promise} deserialized data - */ - deserialize(data, context) { - let currentDataPos = 0; - const read = () => { - if (currentDataPos >= data.length) - throw new Error("Unexpected end of stream"); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - return data[currentDataPos++]; - }; - if (read() !== CURRENT_VERSION) - throw new Error("Version mismatch, serializer changed"); - let currentPos = 0; - let referenceable = []; - const addReferenceable = item => { - referenceable.push(item); - currentPos++; - }; - let currentPosTypeLookup = 0; - let objectTypeLookup = []; - let result = []; - let ctx = { - read() { - return decodeValue(); - }, - setCircularReference(ref) { - addReferenceable(ref); - }, - ...context - }; - this.extendContext(ctx); - const decodeValue = () => { - const item = read(); +/** + * Compare two arrays or strings by performing strict equality check for each value. + * @template T [T=any] + * @param {ArrayLike} a Array of values to be compared + * @param {ArrayLike} b Array of values to be compared + * @returns {boolean} returns true if all the elements of passed arrays are strictly equal. + */ - if (item === ESCAPE) { - const nextItem = read(); +exports.equals = (a, b) => { + if (a.length !== b.length) return false; + for (let i = 0; i < a.length; i++) { + if (a[i] !== b[i]) return false; + } + return true; +}; - if (nextItem === ESCAPE_ESCAPE_VALUE) { - return ESCAPE; - } else if (nextItem === ESCAPE_UNDEFINED) { - return undefined; - } else if (nextItem === ESCAPE_END_OBJECT) { - throw new Error( - `Unexpected end of object at position ${currentDataPos - 1}` - ); - } else { - const request = nextItem; - let serializer; +/** + * Partition an array by calling a predicate function on each value. + * @template T [T=any] + * @param {Array} arr Array of values to be partitioned + * @param {(value: T) => boolean} fn Partition function which partitions based on truthiness of result. + * @returns {[Array, Array]} returns the values of `arr` partitioned into two new arrays based on fn predicate. + */ +exports.groupBy = (arr = [], fn) => { + return arr.reduce( + /** + * @param {[Array, Array]} groups An accumulator storing already partitioned values returned from previous call. + * @param {T} value The value of the current element + * @returns {[Array, Array]} returns an array of partitioned groups accumulator resulting from calling a predicate on the current value. + */ + (groups, value) => { + groups[fn(value) ? 0 : 1].push(value); + return groups; + }, + [[], []] + ); +}; - if (typeof request === "number") { - if (request < 0) { - // relative reference - return referenceable[currentPos + request]; - } - serializer = objectTypeLookup[currentPosTypeLookup - request]; - } else { - if (typeof request !== "string") { - throw new Error( - `Unexpected type (${typeof request}) of request ` + - `at position ${currentDataPos - 1}` - ); - } - const name = read(); - serializer = ObjectMiddleware._getDeserializerForWithoutError( - request, - name - ); +/***/ }), - if (serializer === undefined) { - if (request && !loadedRequests.has(request)) { - let loaded = false; - for (const [regExp, loader] of loaders) { - if (regExp.test(request)) { - if (loader(request)) { - loaded = true; - break; - } - } - } - if (!loaded) { - require(request); - } +/***/ 41792: +/***/ (function(module) { - loadedRequests.add(request); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - serializer = ObjectMiddleware.getDeserializerFor(request, name); - } - objectTypeLookup.push(serializer); - currentPosTypeLookup++; - } - try { - const item = serializer.deserialize(ctx); - const end1 = read(); - if (end1 !== ESCAPE) { - throw new Error("Expected end of object"); - } +/** + * @template T + */ +class ArrayQueue { + /** + * @param {Iterable=} items The initial elements. + */ + constructor(items) { + /** @private @type {T[]} */ + this._list = items ? Array.from(items) : []; + /** @private @type {T[]} */ + this._listReversed = []; + } - const end2 = read(); + /** + * Returns the number of elements in this queue. + * @returns {number} The number of elements in this queue. + */ + get length() { + return this._list.length + this._listReversed.length; + } - if (end2 !== ESCAPE_END_OBJECT) { - throw new Error("Expected end of object"); - } + /** + * Empties the queue. + */ + clear() { + this._list.length = 0; + this._listReversed.length = 0; + } - addReferenceable(item); + /** + * Appends the specified element to this queue. + * @param {T} item The element to add. + * @returns {void} + */ + enqueue(item) { + this._list.push(item); + } - return item; - } catch (err) { - // As this is only for error handling, we omit creating a Map for - // faster access to this information, as this would affect performance - // in the good case - let serializerEntry; - for (const entry of serializers) { - if (entry[1].serializer === serializer) { - serializerEntry = entry; - break; - } - } - const name = !serializerEntry - ? "unknown" - : !serializerEntry[1].request - ? serializerEntry[0].name - : serializerEntry[1].name - ? `${serializerEntry[1].request} ${serializerEntry[1].name}` - : serializerEntry[1].request; - err.message += `\n(during deserialization of ${name})`; - throw err; + /** + * Retrieves and removes the head of this queue. + * @returns {T | undefined} The head of the queue of `undefined` if this queue is empty. + */ + dequeue() { + if (this._listReversed.length === 0) { + if (this._list.length === 0) return undefined; + if (this._list.length === 1) return this._list.pop(); + if (this._list.length < 16) return this._list.shift(); + const temp = this._listReversed; + this._listReversed = this._list; + this._listReversed.reverse(); + this._list = temp; + } + return this._listReversed.pop(); + } + + /** + * Finds and removes an item + * @param {T} item the item + * @returns {void} + */ + delete(item) { + const i = this._list.indexOf(item); + if (i >= 0) { + this._list.splice(i, 1); + } else { + const i = this._listReversed.indexOf(item); + if (i >= 0) this._listReversed.splice(i, 1); + } + } + + [Symbol.iterator]() { + let i = -1; + let reversed = false; + return { + next: () => { + if (!reversed) { + i++; + if (i < this._list.length) { + return { + done: false, + value: this._list[i] + }; } + reversed = true; + i = this._listReversed.length; } - } else if (typeof item === "string") { - if (item.length > 1) { - addReferenceable(item); + i--; + if (i < 0) { + return { + done: true, + value: undefined + }; } - - return item; - } else if (Buffer.isBuffer(item)) { - addReferenceable(item); - - return item; - } else if (typeof item === "function") { - return SerializerMiddleware.deserializeLazy( - item, - data => this.deserialize(data, context)[0] - ); - } else { - return item; + return { + done: false, + value: this._listReversed[i] + }; } }; - - try { - while (currentDataPos < data.length) { - result.push(decodeValue()); - } - return result; - } finally { - // Get rid of these references to avoid leaking memory - // This happens because the optimized code v8 generates - // is optimized for our "ctx.read" method so it will reference - // it from e. g. Dependency.prototype.deserialize -(IC)-> ctx.read - result = referenceable = data = objectTypeLookup = ctx = undefined; - } } } -module.exports = ObjectMiddleware; -module.exports.NOT_SERIALIZABLE = NOT_SERIALIZABLE; +module.exports = ArrayQueue; /***/ }), -/***/ 33040: -/***/ (function(module) { +/***/ 12260: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const cache = new WeakMap(); +const { SyncHook, AsyncSeriesHook } = __webpack_require__(6967); +const { makeWebpackError } = __webpack_require__(11351); +const WebpackError = __webpack_require__(53799); +const ArrayQueue = __webpack_require__(41792); -class ObjectStructure { - constructor() { - this.keys = undefined; - this.children = undefined; +const QUEUED_STATE = 0; +const PROCESSING_STATE = 1; +const DONE_STATE = 2; + +let inHandleResult = 0; + +/** + * @template T + * @callback Callback + * @param {(WebpackError | null)=} err + * @param {T=} result + */ + +/** + * @template T + * @template K + * @template R + */ +class AsyncQueueEntry { + /** + * @param {T} item the item + * @param {Callback} callback the callback + */ + constructor(item, callback) { + this.item = item; + /** @type {typeof QUEUED_STATE | typeof PROCESSING_STATE | typeof DONE_STATE} */ + this.state = QUEUED_STATE; + this.callback = callback; + /** @type {Callback[] | undefined} */ + this.callbacks = undefined; + this.result = undefined; + /** @type {WebpackError | undefined} */ + this.error = undefined; + } +} + +/** + * @template T + * @template K + * @template R + */ +class AsyncQueue { + /** + * @param {Object} options options object + * @param {string=} options.name name of the queue + * @param {number=} options.parallelism how many items should be processed at once + * @param {AsyncQueue=} options.parent parent queue, which will have priority over this queue and with shared parallelism + * @param {function(T): K=} options.getKey extract key from item + * @param {function(T, Callback): void} options.processor async function to process items + */ + constructor({ name, parallelism, parent, processor, getKey }) { + this._name = name; + this._parallelism = parallelism || 1; + this._processor = processor; + this._getKey = + getKey || /** @type {(T) => K} */ (item => /** @type {any} */ (item)); + /** @type {Map>} */ + this._entries = new Map(); + /** @type {ArrayQueue>} */ + this._queued = new ArrayQueue(); + /** @type {AsyncQueue[]} */ + this._children = undefined; + this._activeTasks = 0; + this._willEnsureProcessing = false; + this._needProcessing = false; + this._stopped = false; + this._root = parent ? parent._root : this; + if (parent) { + if (this._root._children === undefined) { + this._root._children = [this]; + } else { + this._root._children.push(this); + } + } + + this.hooks = { + /** @type {AsyncSeriesHook<[T]>} */ + beforeAdd: new AsyncSeriesHook(["item"]), + /** @type {SyncHook<[T]>} */ + added: new SyncHook(["item"]), + /** @type {AsyncSeriesHook<[T]>} */ + beforeStart: new AsyncSeriesHook(["item"]), + /** @type {SyncHook<[T]>} */ + started: new SyncHook(["item"]), + /** @type {SyncHook<[T, Error, R]>} */ + result: new SyncHook(["item", "error", "result"]) + }; + + this._ensureProcessing = this._ensureProcessing.bind(this); + } + + /** + * @param {T} item an item + * @param {Callback} callback callback function + * @returns {void} + */ + add(item, callback) { + if (this._stopped) return callback(new WebpackError("Queue was stopped")); + this.hooks.beforeAdd.callAsync(item, err => { + if (err) { + callback( + makeWebpackError(err, `AsyncQueue(${this._name}).hooks.beforeAdd`) + ); + return; + } + const key = this._getKey(item); + const entry = this._entries.get(key); + if (entry !== undefined) { + if (entry.state === DONE_STATE) { + if (inHandleResult++ > 3) { + process.nextTick(() => callback(entry.error, entry.result)); + } else { + callback(entry.error, entry.result); + } + inHandleResult--; + } else if (entry.callbacks === undefined) { + entry.callbacks = [callback]; + } else { + entry.callbacks.push(callback); + } + return; + } + const newEntry = new AsyncQueueEntry(item, callback); + if (this._stopped) { + this.hooks.added.call(item); + this._root._activeTasks++; + process.nextTick(() => + this._handleResult(newEntry, new WebpackError("Queue was stopped")) + ); + } else { + this._entries.set(key, newEntry); + this._queued.enqueue(newEntry); + const root = this._root; + root._needProcessing = true; + if (root._willEnsureProcessing === false) { + root._willEnsureProcessing = true; + setImmediate(root._ensureProcessing); + } + this.hooks.added.call(item); + } + }); + } + + /** + * @param {T} item an item + * @returns {void} + */ + invalidate(item) { + const key = this._getKey(item); + const entry = this._entries.get(key); + this._entries.delete(key); + if (entry.state === QUEUED_STATE) { + this._queued.delete(entry); + } + } + + /** + * Waits for an already started item + * @param {T} item an item + * @param {Callback} callback callback function + * @returns {void} + */ + waitFor(item, callback) { + const key = this._getKey(item); + const entry = this._entries.get(key); + if (entry === undefined) { + return callback( + new WebpackError( + "waitFor can only be called for an already started item" + ) + ); + } + if (entry.state === DONE_STATE) { + process.nextTick(() => callback(entry.error, entry.result)); + } else if (entry.callbacks === undefined) { + entry.callbacks = [callback]; + } else { + entry.callbacks.push(callback); + } + } + + /** + * @returns {void} + */ + stop() { + this._stopped = true; + const queue = this._queued; + this._queued = new ArrayQueue(); + const root = this._root; + for (const entry of queue) { + this._entries.delete(this._getKey(entry.item)); + root._activeTasks++; + this._handleResult(entry, new WebpackError("Queue was stopped")); + } + } + + /** + * @returns {void} + */ + increaseParallelism() { + const root = this._root; + root._parallelism++; + /* istanbul ignore next */ + if (root._willEnsureProcessing === false && root._needProcessing) { + root._willEnsureProcessing = true; + setImmediate(root._ensureProcessing); + } + } + + /** + * @returns {void} + */ + decreaseParallelism() { + const root = this._root; + root._parallelism--; } - getKeys(keys) { - if (this.keys === undefined) this.keys = keys; - return this.keys; + /** + * @param {T} item an item + * @returns {boolean} true, if the item is currently being processed + */ + isProcessing(item) { + const key = this._getKey(item); + const entry = this._entries.get(key); + return entry !== undefined && entry.state === PROCESSING_STATE; } - key(key) { - if (this.children === undefined) this.children = new Map(); - const child = this.children.get(key); - if (child !== undefined) return child; - const newChild = new ObjectStructure(); - this.children.set(key, newChild); - return newChild; + /** + * @param {T} item an item + * @returns {boolean} true, if the item is currently queued + */ + isQueued(item) { + const key = this._getKey(item); + const entry = this._entries.get(key); + return entry !== undefined && entry.state === QUEUED_STATE; } -} -const getCachedKeys = (keys, cacheAssoc) => { - let root = cache.get(cacheAssoc); - if (root === undefined) { - root = new ObjectStructure(); - cache.set(cacheAssoc, root); + /** + * @param {T} item an item + * @returns {boolean} true, if the item is currently queued + */ + isDone(item) { + const key = this._getKey(item); + const entry = this._entries.get(key); + return entry !== undefined && entry.state === DONE_STATE; } - let current = root; - for (const key of keys) { - current = current.key(key); + + /** + * @returns {void} + */ + _ensureProcessing() { + while (this._activeTasks < this._parallelism) { + const entry = this._queued.dequeue(); + if (entry === undefined) break; + this._activeTasks++; + entry.state = PROCESSING_STATE; + this._startProcessing(entry); + } + this._willEnsureProcessing = false; + if (this._queued.length > 0) return; + if (this._children !== undefined) { + for (const child of this._children) { + while (this._activeTasks < this._parallelism) { + const entry = child._queued.dequeue(); + if (entry === undefined) break; + this._activeTasks++; + entry.state = PROCESSING_STATE; + child._startProcessing(entry); + } + if (child._queued.length > 0) return; + } + } + if (!this._willEnsureProcessing) this._needProcessing = false; } - return current.getKeys(keys); -}; -class PlainObjectSerializer { - serialize(obj, { write }) { - const keys = Object.keys(obj); - if (keys.length > 128) { - // Objects with so many keys are unlikely to share structure - // with other objects - write(keys); - for (const key of keys) { - write(obj[key]); + /** + * @param {AsyncQueueEntry} entry the entry + * @returns {void} + */ + _startProcessing(entry) { + this.hooks.beforeStart.callAsync(entry.item, err => { + if (err) { + this._handleResult( + entry, + makeWebpackError(err, `AsyncQueue(${this._name}).hooks.beforeStart`) + ); + return; } - } else if (keys.length > 1) { - write(getCachedKeys(keys, write)); - for (const key of keys) { - write(obj[key]); + let inCallback = false; + try { + this._processor(entry.item, (e, r) => { + inCallback = true; + this._handleResult(entry, e, r); + }); + } catch (err) { + if (inCallback) throw err; + this._handleResult(entry, err, null); } - } else if (keys.length === 1) { - const key = keys[0]; - write(key); - write(obj[key]); - } else { - write(null); - } + this.hooks.started.call(entry.item); + }); } - deserialize({ read }) { - const keys = read(); - const obj = {}; - if (Array.isArray(keys)) { - for (const key of keys) { - obj[key] = read(); + + /** + * @param {AsyncQueueEntry} entry the entry + * @param {WebpackError=} err error, if any + * @param {R=} result result, if any + * @returns {void} + */ + _handleResult(entry, err, result) { + this.hooks.result.callAsync(entry.item, err, result, hookError => { + const error = hookError + ? makeWebpackError(hookError, `AsyncQueue(${this._name}).hooks.result`) + : err; + + const callback = entry.callback; + const callbacks = entry.callbacks; + entry.state = DONE_STATE; + entry.callback = undefined; + entry.callbacks = undefined; + entry.result = result; + entry.error = error; + + const root = this._root; + root._activeTasks--; + if (root._willEnsureProcessing === false && root._needProcessing) { + root._willEnsureProcessing = true; + setImmediate(root._ensureProcessing); } - } else if (keys !== null) { - obj[keys] = read(); - } - return obj; + + if (inHandleResult++ > 3) { + process.nextTick(() => { + callback(error, result); + if (callbacks !== undefined) { + for (const callback of callbacks) { + callback(error, result); + } + } + }); + } else { + callback(error, result); + if (callbacks !== undefined) { + for (const callback of callbacks) { + callback(error, result); + } + } + } + inHandleResult--; + }); + } + + clear() { + this._entries.clear(); + this._queued.clear(); + this._activeTasks = 0; + this._willEnsureProcessing = false; + this._needProcessing = false; + this._stopped = false; } } -module.exports = PlainObjectSerializer; +module.exports = AsyncQueue; /***/ }), -/***/ 57328: -/***/ (function(module) { +/***/ 36692: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -class RegExpObjectSerializer { - serialize(obj, { write }) { - write(obj.source); - write(obj.flags); +class Hash { + /* istanbul ignore next */ + /** + * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} + * @abstract + * @param {string|Buffer} data data + * @param {string=} inputEncoding data encoding + * @returns {this} updated hash + */ + update(data, inputEncoding) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } - deserialize({ read }) { - return new RegExp(read(), read()); + + /* istanbul ignore next */ + /** + * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} + * @abstract + * @param {string=} encoding encoding of the return value + * @returns {string|Buffer} digest + */ + digest(encoding) { + const AbstractMethodError = __webpack_require__(77198); + throw new AbstractMethodError(); } } -module.exports = RegExpObjectSerializer; +module.exports = Hash; /***/ }), -/***/ 53080: -/***/ (function(module) { +/***/ 39104: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -class Serializer { - constructor(middlewares, context) { - this.serializeMiddlewares = middlewares.slice(); - this.deserializeMiddlewares = middlewares.slice().reverse(); - this.context = context; - } +/** + * @template T + * @param {Iterable} set a set + * @returns {T | undefined} last item + */ +const last = set => { + let last; + for (const item of set) last = item; + return last; +}; - serialize(obj, context) { - const ctx = { ...context, ...this.context }; - let current = obj; - for (const middleware of this.serializeMiddlewares) { - if (current && typeof current.then === "function") { - current = current.then(data => data && middleware.serialize(data, ctx)); - } else if (current) { - try { - current = middleware.serialize(current, ctx); - } catch (err) { - current = Promise.reject(err); - } - } else break; - } - return current; +/** + * @template T + * @param {Iterable} iterable iterable + * @param {function(T): boolean} filter predicate + * @returns {boolean} true, if some items match the filter predicate + */ +const someInIterable = (iterable, filter) => { + for (const item of iterable) { + if (filter(item)) return true; } + return false; +}; - deserialize(value, context) { - const ctx = { ...context, ...this.context }; - /** @type {any} */ - let current = value; - for (const middleware of this.deserializeMiddlewares) { - if (current && typeof current.then === "function") { - current = current.then(data => middleware.deserialize(data, ctx)); - } else { - current = middleware.deserialize(current, ctx); - } - } - return current; - } -} +/** + * @template T + * @param {Iterable} iterable an iterable + * @returns {number} count of items + */ +const countIterable = iterable => { + let i = 0; + // eslint-disable-next-line no-unused-vars + for (const _ of iterable) i++; + return i; +}; -module.exports = Serializer; +exports.last = last; +exports.someInIterable = someInIterable; +exports.countIterable = countIterable; /***/ }), -/***/ 83137: +/***/ 48424: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const memoize = __webpack_require__(78676); - -const LAZY_TARGET = Symbol("lazy serialization target"); -const LAZY_SERIALIZED_VALUE = Symbol("lazy serialization data"); +const { first } = __webpack_require__(93347); +const SortableSet = __webpack_require__(13098); /** - * @template DeserializedType - * @template SerializedType + * Multi layer bucket sorted set: + * Supports adding non-existing items (DO NOT ADD ITEM TWICE), + * Supports removing exiting items (DO NOT REMOVE ITEM NOT IN SET), + * Supports popping the first items according to defined order, + * Supports iterating all items without order, + * Supports updating an item in an efficient way, + * Supports size property, which is the number of items, + * Items are lazy partially sorted when needed + * @template T + * @template K */ -class SerializerMiddleware { - /* istanbul ignore next */ +class LazyBucketSortedSet { /** - * @abstract - * @param {DeserializedType} data data - * @param {Object} context context object - * @returns {SerializedType|Promise} serialized data + * @param {function(T): K} getKey function to get key from item + * @param {function(K, K): number} comparator comparator to sort keys + * @param {...((function(T): any) | (function(any, any): number))} args more pairs of getKey and comparator plus optional final comparator for the last layer */ - serialize(data, context) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + constructor(getKey, comparator, ...args) { + this._getKey = getKey; + this._innerArgs = args; + this._leaf = args.length <= 1; + this._keys = new SortableSet(undefined, comparator); + /** @type {Map | SortableSet>} */ + this._map = new Map(); + this._unsortedItems = new Set(); + this.size = 0; } - /* istanbul ignore next */ /** - * @abstract - * @param {SerializedType} data data - * @param {Object} context context object - * @returns {DeserializedType|Promise} deserialized data + * @param {T} item an item + * @returns {void} */ - deserialize(data, context) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); + add(item) { + this.size++; + this._unsortedItems.add(item); } /** - * @param {any | function(): Promise | any} value contained value or function to value - * @param {SerializerMiddleware} target target middleware - * @param {object=} options lazy options - * @param {any=} serializedValue serialized value - * @returns {function(): Promise | any} lazy function + * @param {K} key key of item + * @param {T} item the item + * @returns {void} */ - static createLazy(value, target, options = {}, serializedValue) { - if (SerializerMiddleware.isLazy(value, target)) return value; - const fn = typeof value === "function" ? value : () => value; - fn[LAZY_TARGET] = target; - /** @type {any} */ (fn).options = options; - fn[LAZY_SERIALIZED_VALUE] = serializedValue; - return fn; + _addInternal(key, item) { + let entry = this._map.get(key); + if (entry === undefined) { + entry = this._leaf + ? new SortableSet(undefined, this._innerArgs[0]) + : new /** @type {any} */ (LazyBucketSortedSet)(...this._innerArgs); + this._keys.add(key); + this._map.set(key, entry); + } + entry.add(item); } /** - * @param {function(): Promise | any} fn lazy function - * @param {SerializerMiddleware=} target target middleware - * @returns {boolean} true, when fn is a lazy function (optionally of that target) + * @param {T} item an item + * @returns {void} */ - static isLazy(fn, target) { - if (typeof fn !== "function") return false; - const t = fn[LAZY_TARGET]; - return target ? t === target : !!t; + delete(item) { + this.size--; + if (this._unsortedItems.has(item)) { + this._unsortedItems.delete(item); + return; + } + const key = this._getKey(item); + const entry = this._map.get(key); + entry.delete(item); + if (entry.size === 0) { + this._deleteKey(key); + } } /** - * @param {function(): Promise | any} fn lazy function - * @returns {object} options + * @param {K} key key to be removed + * @returns {void} */ - static getLazyOptions(fn) { - if (typeof fn !== "function") return undefined; - return /** @type {any} */ (fn).options; + _deleteKey(key) { + this._keys.delete(key); + this._map.delete(key); } /** - * @param {function(): Promise | any} fn lazy function - * @returns {any} serialized value + * @returns {T | undefined} an item */ - static getLazySerializedValue(fn) { - if (typeof fn !== "function") return undefined; - return fn[LAZY_SERIALIZED_VALUE]; + popFirst() { + if (this.size === 0) return undefined; + this.size--; + if (this._unsortedItems.size > 0) { + for (const item of this._unsortedItems) { + const key = this._getKey(item); + this._addInternal(key, item); + } + this._unsortedItems.clear(); + } + this._keys.sort(); + const key = first(this._keys); + const entry = this._map.get(key); + if (this._leaf) { + const leafEntry = /** @type {SortableSet} */ (entry); + leafEntry.sort(); + const item = first(leafEntry); + leafEntry.delete(item); + if (leafEntry.size === 0) { + this._deleteKey(key); + } + return item; + } else { + const nodeEntry = /** @type {LazyBucketSortedSet} */ (entry); + const item = nodeEntry.popFirst(); + if (nodeEntry.size === 0) { + this._deleteKey(key); + } + return item; + } } /** - * @param {function(): Promise | any} fn lazy function - * @param {any} value serialized value - * @returns {void} + * @param {T} item to be updated item + * @returns {function(true=): void} finish update */ - static setLazySerializedValue(fn, value) { - fn[LAZY_SERIALIZED_VALUE] = value; + startUpdate(item) { + if (this._unsortedItems.has(item)) { + return remove => { + if (remove) { + this._unsortedItems.delete(item); + this.size--; + return; + } + }; + } + const key = this._getKey(item); + if (this._leaf) { + const oldEntry = /** @type {SortableSet} */ (this._map.get(key)); + return remove => { + if (remove) { + this.size--; + oldEntry.delete(item); + if (oldEntry.size === 0) { + this._deleteKey(key); + } + return; + } + const newKey = this._getKey(item); + if (key === newKey) { + // This flags the sortable set as unordered + oldEntry.add(item); + } else { + oldEntry.delete(item); + if (oldEntry.size === 0) { + this._deleteKey(key); + } + this._addInternal(newKey, item); + } + }; + } else { + const oldEntry = /** @type {LazyBucketSortedSet} */ ( + this._map.get(key) + ); + const finishUpdate = oldEntry.startUpdate(item); + return remove => { + if (remove) { + this.size--; + finishUpdate(true); + if (oldEntry.size === 0) { + this._deleteKey(key); + } + return; + } + const newKey = this._getKey(item); + if (key === newKey) { + finishUpdate(); + } else { + finishUpdate(true); + if (oldEntry.size === 0) { + this._deleteKey(key); + } + this._addInternal(newKey, item); + } + }; + } } /** - * @param {function(): Promise | any} lazy lazy function - * @param {function(any): Promise | any} serialize serialize function - * @returns {function(): Promise | any} new lazy + * @param {Iterator[]} iterators list of iterators to append to + * @returns {void} */ - static serializeLazy(lazy, serialize) { - const fn = memoize(() => { - const r = lazy(); - if (r && typeof r.then === "function") { - return r.then(data => data && serialize(data)); + _appendIterators(iterators) { + if (this._unsortedItems.size > 0) + iterators.push(this._unsortedItems[Symbol.iterator]()); + for (const key of this._keys) { + const entry = this._map.get(key); + if (this._leaf) { + const leafEntry = /** @type {SortableSet} */ (entry); + const iterator = leafEntry[Symbol.iterator](); + iterators.push(iterator); + } else { + const nodeEntry = /** @type {LazyBucketSortedSet} */ (entry); + nodeEntry._appendIterators(iterators); } - return serialize(r); - }); - fn[LAZY_TARGET] = lazy[LAZY_TARGET]; - /** @type {any} */ (fn).options = /** @type {any} */ (lazy).options; - lazy[LAZY_SERIALIZED_VALUE] = fn; - return fn; + } } /** - * @param {function(): Promise | any} lazy lazy function - * @param {function(any): Promise | any} deserialize deserialize function - * @returns {function(): Promise | any} new lazy + * @returns {Iterator} the iterator */ - static deserializeLazy(lazy, deserialize) { - const fn = memoize(() => { - const r = lazy(); - if (r && typeof r.then === "function") { - return r.then(data => deserialize(data)); + [Symbol.iterator]() { + const iterators = []; + this._appendIterators(iterators); + iterators.reverse(); + let currentIterator = iterators.pop(); + return { + next: () => { + const res = currentIterator.next(); + if (res.done) { + if (iterators.length === 0) return res; + currentIterator = iterators.pop(); + return currentIterator.next(); + } + return res; } - return deserialize(r); - }); - fn[LAZY_TARGET] = lazy[LAZY_TARGET]; - /** @type {any} */ (fn).options = /** @type {any} */ (lazy).options; - fn[LAZY_SERIALIZED_VALUE] = lazy; - return fn; - } - - /** - * @param {function(): Promise | any} lazy lazy function - * @returns {function(): Promise | any} new lazy - */ - static unMemoizeLazy(lazy) { - if (!SerializerMiddleware.isLazy(lazy)) return lazy; - const fn = () => { - throw new Error( - "A lazy value that has been unmemorized can't be called again" - ); }; - fn[LAZY_SERIALIZED_VALUE] = SerializerMiddleware.unMemoizeLazy( - lazy[LAZY_SERIALIZED_VALUE] - ); - fn[LAZY_TARGET] = lazy[LAZY_TARGET]; - fn.options = /** @type {any} */ (lazy).options; - return fn; } } -module.exports = SerializerMiddleware; +module.exports = LazyBucketSortedSet; /***/ }), -/***/ 79240: -/***/ (function(module) { +/***/ 38938: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -class SetObjectSerializer { - serialize(obj, { write }) { - write(obj.size); - for (const value of obj) { - write(value); +const makeSerializable = __webpack_require__(33032); + +/** + * @template T + * @param {Set} targetSet set where items should be added + * @param {Set>} toMerge iterables to be merged + * @returns {void} + */ +const merge = (targetSet, toMerge) => { + for (const set of toMerge) { + for (const item of set) { + targetSet.add(item); } } - deserialize({ read }) { - let size = read(); - const set = new Set(); - for (let i = 0; i < size; i++) { - set.add(read()); +}; + +/** + * @template T + * @param {Set>} targetSet set where iterables should be added + * @param {Array>} toDeepMerge lazy sets to be flattened + * @returns {void} + */ +const flatten = (targetSet, toDeepMerge) => { + for (const set of toDeepMerge) { + if (set._set.size > 0) targetSet.add(set._set); + if (set._needMerge) { + for (const mergedSet of set._toMerge) { + targetSet.add(mergedSet); + } + flatten(targetSet, set._toDeepMerge); } - return set; } -} - -module.exports = SetObjectSerializer; - - -/***/ }), +}; -/***/ 65112: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * Like Set but with an addAll method to eventually add items from another iterable. + * Access methods make sure that all delayed operations are executed. + * Iteration methods deopts to normal Set performance until clear is called again (because of the chance of modifications during iteration). + * @template T + */ +class LazySet { + /** + * @param {Iterable=} iterable init iterable + */ + constructor(iterable) { + /** @type {Set} */ + this._set = new Set(iterable); + /** @type {Set>} */ + this._toMerge = new Set(); + /** @type {Array>} */ + this._toDeepMerge = []; + this._needMerge = false; + this._deopt = false; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ + _flatten() { + flatten(this._toMerge, this._toDeepMerge); + this._toDeepMerge.length = 0; + } + _merge() { + this._flatten(); + merge(this._set, this._toMerge); + this._toMerge.clear(); + this._needMerge = false; + } + _isEmpty() { + return ( + this._set.size === 0 && + this._toMerge.size === 0 && + this._toDeepMerge.length === 0 + ); + } -const SerializerMiddleware = __webpack_require__(83137); + get size() { + if (this._needMerge) this._merge(); + return this._set.size; + } -/** - * @typedef {any} DeserializedType - * @typedef {any[]} SerializedType - * @extends {SerializerMiddleware} - */ -class SingleItemMiddleware extends SerializerMiddleware { /** - * @param {DeserializedType} data data - * @param {Object} context context object - * @returns {SerializedType|Promise} serialized data + * @param {T} item an item + * @returns {this} itself */ - serialize(data, context) { - return [data]; + add(item) { + this._set.add(item); + return this; } /** - * @param {SerializedType} data data - * @param {Object} context context object - * @returns {DeserializedType|Promise} deserialized data + * @param {Iterable | LazySet} iterable a immutable iterable or another immutable LazySet which will eventually be merged into the Set + * @returns {this} itself */ - deserialize(data, context) { - return data[0]; + addAll(iterable) { + if (this._deopt) { + const _set = this._set; + for (const item of iterable) { + _set.add(item); + } + } else { + if (iterable instanceof LazySet) { + if (iterable._isEmpty()) return this; + this._toDeepMerge.push(iterable); + this._needMerge = true; + if (this._toDeepMerge.length > 100000) { + this._flatten(); + } + } else { + this._toMerge.add(iterable); + this._needMerge = true; + } + if (this._toMerge.size > 100000) this._merge(); + } + return this; } -} -module.exports = SingleItemMiddleware; + clear() { + this._set.clear(); + this._toMerge.clear(); + this._toDeepMerge.length = 0; + this._needMerge = false; + this._deopt = false; + } + /** + * @param {T} value an item + * @returns {boolean} true, if the value was in the Set before + */ + delete(value) { + if (this._needMerge) this._merge(); + return this._set.delete(value); + } -/***/ }), + entries() { + this._deopt = true; + if (this._needMerge) this._merge(); + return this._set.entries(); + } -/***/ 58831: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * @param {function(T, T, Set): void} callbackFn function called for each entry + * @param {any} thisArg this argument for the callbackFn + * @returns {void} + */ + forEach(callbackFn, thisArg) { + this._deopt = true; + if (this._needMerge) this._merge(); + this._set.forEach(callbackFn, thisArg); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {T} item an item + * @returns {boolean} true, when the item is in the Set + */ + has(item) { + if (this._needMerge) this._merge(); + return this._set.has(item); + } + keys() { + this._deopt = true; + if (this._needMerge) this._merge(); + return this._set.keys(); + } + values() { + this._deopt = true; + if (this._needMerge) this._merge(); + return this._set.values(); + } -const ModuleDependency = __webpack_require__(80321); -const makeSerializable = __webpack_require__(33032); + [Symbol.iterator]() { + this._deopt = true; + if (this._needMerge) this._merge(); + return this._set[Symbol.iterator](); + } -class ConsumeSharedFallbackDependency extends ModuleDependency { - constructor(request) { - super(request); + /* istanbul ignore next */ + get [Symbol.toStringTag]() { + return "LazySet"; } - get type() { - return "consume shared fallback"; + serialize({ write }) { + if (this._needMerge) this._merge(); + write(this._set.size); + for (const item of this._set) write(item); } - get category() { - return "esm"; + static deserialize({ read }) { + const count = read(); + const items = []; + for (let i = 0; i < count; i++) { + items.push(read()); + } + return new LazySet(items); } } -makeSerializable( - ConsumeSharedFallbackDependency, - "webpack/lib/sharing/ConsumeSharedFallbackDependency" -); +makeSerializable(LazySet, "webpack/lib/util/LazySet"); -module.exports = ConsumeSharedFallbackDependency; +module.exports = LazySet; /***/ }), -/***/ 62286: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 82482: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* @@ -121827,256 +122385,255 @@ module.exports = ConsumeSharedFallbackDependency; -const { RawSource } = __webpack_require__(51255); -const AsyncDependenciesBlock = __webpack_require__(47736); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); -const { rangeToString, stringifyHoley } = __webpack_require__(19702); -const ConsumeSharedFallbackDependency = __webpack_require__(58831); - -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ -/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ -/** @typedef {import("../util/semver").SemVerRange} SemVerRange */ - /** - * @typedef {Object} ConsumeOptions - * @property {string=} import fallback request - * @property {string=} importResolved resolved fallback request - * @property {string} shareKey global share key - * @property {string} shareScope share scope - * @property {SemVerRange | false | undefined} requiredVersion version requirement - * @property {string} packageName package name to determine required version automatically - * @property {boolean} strictVersion don't use shared version even if version isn't valid - * @property {boolean} singleton use single global version - * @property {boolean} eager include the fallback module in a sync way + * @template K + * @template V + * @param {Map} map a map + * @param {K} key the key + * @param {function(): V} computer compute value + * @returns {V} value */ +exports.provide = (map, key, computer) => { + const value = map.get(key); + if (value !== undefined) return value; + const newValue = computer(); + map.set(key, newValue); + return newValue; +}; -const TYPES = new Set(["consume-shared"]); -class ConsumeSharedModule extends Module { - /** - * @param {string} context context - * @param {ConsumeOptions} options consume options - */ - constructor(context, options) { - super("consume-shared-module", context); - this.options = options; - } +/***/ }), - /** - * @returns {string} a unique identifier of the module - */ - identifier() { - const { - shareKey, - shareScope, - importResolved, - requiredVersion, - strictVersion, - singleton, - eager - } = this.options; - return `consume-shared-module|${shareScope}|${shareKey}|${ - requiredVersion && rangeToString(requiredVersion) - }|${strictVersion}|${importResolved}|${singleton}|${eager}`; - } +/***/ 50780: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module - */ - readableIdentifier(requestShortener) { - const { - shareKey, - shareScope, - importResolved, - requiredVersion, - strictVersion, - singleton, - eager - } = this.options; - return `consume shared module (${shareScope}) ${shareKey}@${ - requiredVersion ? rangeToString(requiredVersion) : "*" - }${strictVersion ? " (strict)" : ""}${singleton ? " (singleton)" : ""}${ - importResolved - ? ` (fallback: ${requestShortener.shorten(importResolved)})` - : "" - }${eager ? " (eager)" : ""}`; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion - */ - libIdent(options) { - const { shareKey, shareScope, import: request } = this.options; - return `${ - this.layer ? `(${this.layer})/` : "" - }webpack/sharing/consume/${shareScope}/${shareKey}${ - request ? `/${request}` : "" - }`; + + +const binarySearchBounds = __webpack_require__(92229); + +class ParallelismFactorCalculator { + constructor() { + this._rangePoints = []; + this._rangeCallbacks = []; } - /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} - */ - needBuild(context, callback) { - callback(null, !this.buildInfo); + range(start, end, callback) { + if (start === end) return callback(1); + this._rangePoints.push(start); + this._rangePoints.push(end); + this._rangeCallbacks.push(callback); } - /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function - * @returns {void} - */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = {}; - this.buildInfo = {}; - if (this.options.import) { - const dep = new ConsumeSharedFallbackDependency(this.options.import); - if (this.options.eager) { - this.addDependency(dep); - } else { - const block = new AsyncDependenciesBlock({}); - block.addDependency(dep); - this.addBlock(block); - } + calculate() { + const segments = Array.from(new Set(this._rangePoints)).sort((a, b) => + a < b ? -1 : 1 + ); + const parallelism = segments.map(() => 0); + const rangeStartIndices = []; + for (let i = 0; i < this._rangePoints.length; i += 2) { + const start = this._rangePoints[i]; + const end = this._rangePoints[i + 1]; + let idx = binarySearchBounds.eq(segments, start); + rangeStartIndices.push(idx); + do { + parallelism[idx]++; + idx++; + } while (segments[idx] < end); + } + for (let i = 0; i < this._rangeCallbacks.length; i++) { + const start = this._rangePoints[i * 2]; + const end = this._rangePoints[i * 2 + 1]; + let idx = rangeStartIndices[i]; + let sum = 0; + let totalDuration = 0; + let current = start; + do { + const p = parallelism[idx]; + idx++; + const duration = segments[idx] - current; + totalDuration += duration; + current = segments[idx]; + sum += p * duration; + } while (current < end); + this._rangeCallbacks[i](sum / totalDuration); } - callback(); } +} + +module.exports = ParallelismFactorCalculator; + +/***/ }), + +/***/ 65930: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +/** + * @template T + */ +class Queue { /** - * @returns {Set} types available (do not mutate) + * @param {Iterable=} items The initial elements. */ - getSourceTypes() { - return TYPES; + constructor(items) { + /** @private @type {Set} */ + this._set = new Set(items); + /** @private @type {Iterator} */ + this._iterator = this._set[Symbol.iterator](); } /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) + * Returns the number of elements in this queue. + * @returns {number} The number of elements in this queue. */ - size(type) { - return 42; + get length() { + return this._set.size; } /** - * @param {Hash} hash the hash used to track dependencies - * @param {UpdateHashContext} context context + * Appends the specified element to this queue. + * @param {T} item The element to add. * @returns {void} */ - updateHash(hash, context) { - hash.update(JSON.stringify(this.options)); - super.updateHash(hash, context); + enqueue(item) { + this._set.add(item); } /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result + * Retrieves and removes the head of this queue. + * @returns {T | undefined} The head of the queue of `undefined` if this queue is empty. */ - codeGeneration({ chunkGraph, moduleGraph, runtimeTemplate }) { - const runtimeRequirements = new Set([RuntimeGlobals.shareScopeMap]); - const { - shareScope, - shareKey, - strictVersion, - requiredVersion, - import: request, - singleton, - eager - } = this.options; - let fallbackCode; - if (request) { - if (eager) { - const dep = this.dependencies[0]; - fallbackCode = runtimeTemplate.syncModuleFactory({ - dependency: dep, - chunkGraph, - runtimeRequirements, - request: this.options.import - }); - } else { - const block = this.blocks[0]; - fallbackCode = runtimeTemplate.asyncModuleFactory({ - block, - chunkGraph, - runtimeRequirements, - request: this.options.import - }); - } + dequeue() { + const result = this._iterator.next(); + if (result.done) return undefined; + this._set.delete(result.value); + return result.value; + } +} + +module.exports = Queue; + + +/***/ }), + +/***/ 93347: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +/** + * intersect creates Set containing the intersection of elements between all sets + * @template T + * @param {Set[]} sets an array of sets being checked for shared elements + * @returns {Set} returns a new Set containing the intersecting items + */ +const intersect = sets => { + if (sets.length === 0) return new Set(); + if (sets.length === 1) return new Set(sets[0]); + let minSize = Infinity; + let minIndex = -1; + for (let i = 0; i < sets.length; i++) { + const size = sets[i].size; + if (size < minSize) { + minIndex = i; + minSize = size; } - let fn = "load"; - const args = [JSON.stringify(shareScope), JSON.stringify(shareKey)]; - if (requiredVersion) { - if (strictVersion) { - fn += "Strict"; - } - if (singleton) { - fn += "Singleton"; - } - args.push(stringifyHoley(requiredVersion)); - fn += "VersionCheck"; - } else { - if (singleton) { - fn += "Singleton"; + } + const current = new Set(sets[minIndex]); + for (let i = 0; i < sets.length; i++) { + if (i === minIndex) continue; + const set = sets[i]; + for (const item of current) { + if (!set.has(item)) { + current.delete(item); } } - if (fallbackCode) { - fn += "Fallback"; - args.push(fallbackCode); - } - const code = runtimeTemplate.returningFunction(`${fn}(${args.join(", ")})`); - const sources = new Map(); - sources.set("consume-shared", new RawSource(code)); - return { - runtimeRequirements, - sources - }; } + return current; +}; - serialize(context) { - const { write } = context; - write(this.options); - super.serialize(context); +/** + * Checks if a set is the subset of another set + * @template T + * @param {Set} bigSet a Set which contains the original elements to compare against + * @param {Set} smallSet the set whose elements might be contained inside of bigSet + * @returns {boolean} returns true if smallSet contains all elements inside of the bigSet + */ +const isSubset = (bigSet, smallSet) => { + if (bigSet.size < smallSet.size) return false; + for (const item of smallSet) { + if (!bigSet.has(item)) return false; } + return true; +}; - deserialize(context) { - const { read } = context; - this.options = read(); - super.deserialize(context); +/** + * @template T + * @param {Set} set a set + * @param {function(T): boolean} fn selector function + * @returns {T | undefined} found item + */ +const find = (set, fn) => { + for (const item of set) { + if (fn(item)) return item; } -} +}; -makeSerializable( - ConsumeSharedModule, - "webpack/lib/sharing/ConsumeSharedModule" -); +/** + * @template T + * @param {Set} set a set + * @returns {T | undefined} first item + */ +const first = set => { + const entry = set.values().next(); + return entry.done ? undefined : entry.value; +}; -module.exports = ConsumeSharedModule; +/** + * @template T + * @param {Set} a first + * @param {Set} b second + * @returns {Set} combined set, may be identical to a or b + */ +const combine = (a, b) => { + if (b.size === 0) return a; + if (a.size === 0) return b; + const set = new Set(a); + for (const item of b) set.add(item); + return set; +}; + +exports.intersect = intersect; +exports.isSubset = isSubset; +exports.find = find; +exports.first = first; +exports.combine = combine; /***/ }), -/***/ 15046: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 13098: +/***/ (function(module) { "use strict"; /* @@ -122086,324 +122643,165 @@ module.exports = ConsumeSharedModule; -const ModuleNotFoundError = __webpack_require__(32882); -const RuntimeGlobals = __webpack_require__(16475); -const WebpackError = __webpack_require__(53799); -const { parseOptions } = __webpack_require__(3083); -const LazySet = __webpack_require__(38938); -const createSchemaValidation = __webpack_require__(32540); -const { parseRange } = __webpack_require__(19702); -const ConsumeSharedFallbackDependency = __webpack_require__(58831); -const ConsumeSharedModule = __webpack_require__(62286); -const ConsumeSharedRuntimeModule = __webpack_require__(10394); -const ProvideForSharedDependency = __webpack_require__(40017); -const { resolveMatchedConfigs } = __webpack_require__(3591); -const { - isRequiredVersion, - getDescriptionFile, - getRequiredVersionFromDescriptionFile -} = __webpack_require__(84379); - -/** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumeSharedPluginOptions} ConsumeSharedPluginOptions */ -/** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumesConfig} ConsumesConfig */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../ResolverFactory").ResolveOptionsWithDependencyType} ResolveOptionsWithDependencyType */ -/** @typedef {import("./ConsumeSharedModule").ConsumeOptions} ConsumeOptions */ +const NONE = Symbol("not sorted"); -const validate = createSchemaValidation( - __webpack_require__(6464), - () => __webpack_require__(16116), - { - name: "Consume Shared Plugin", - baseDataPath: "options" +/** + * A subset of Set that offers sorting functionality + * @template T item type in set + * @extends {Set} + */ +class SortableSet extends Set { + /** + * Create a new sortable set + * @param {Iterable=} initialIterable The initial iterable value + * @typedef {function(T, T): number} SortFunction + * @param {SortFunction=} defaultSort Default sorting function + */ + constructor(initialIterable, defaultSort) { + super(initialIterable); + /** @private @type {undefined | function(T, T): number}} */ + this._sortFn = defaultSort; + /** @private @type {typeof NONE | undefined | function(T, T): number}} */ + this._lastActiveSortFn = NONE; + /** @private @type {Map | undefined} */ + this._cache = undefined; + /** @private @type {Map | undefined} */ + this._cacheOrderIndependent = undefined; } -); - -/** @type {ResolveOptionsWithDependencyType} */ -const RESOLVE_OPTIONS = { dependencyType: "esm" }; -const PLUGIN_NAME = "ConsumeSharedPlugin"; -class ConsumeSharedPlugin { /** - * @param {ConsumeSharedPluginOptions} options options + * @param {T} value value to add to set + * @returns {this} returns itself */ - constructor(options) { - if (typeof options !== "string") { - validate(options); - } + add(value) { + this._lastActiveSortFn = NONE; + this._invalidateCache(); + this._invalidateOrderedCache(); + super.add(value); + return this; + } - /** @type {[string, ConsumeOptions][]} */ - this._consumes = parseOptions( - options.consumes, - (item, key) => { - if (Array.isArray(item)) throw new Error("Unexpected array in options"); - /** @type {ConsumeOptions} */ - let result = - item === key || !isRequiredVersion(item) - ? // item is a request/key - { - import: key, - shareScope: options.shareScope || "default", - shareKey: key, - requiredVersion: undefined, - packageName: undefined, - strictVersion: false, - singleton: false, - eager: false - } - : // key is a request/key - // item is a version - { - import: key, - shareScope: options.shareScope || "default", - shareKey: key, - requiredVersion: parseRange(item), - strictVersion: true, - packageName: undefined, - singleton: false, - eager: false - }; - return result; - }, - (item, key) => ({ - import: item.import === false ? undefined : item.import || key, - shareScope: item.shareScope || options.shareScope || "default", - shareKey: item.shareKey || key, - requiredVersion: - typeof item.requiredVersion === "string" - ? parseRange(item.requiredVersion) - : item.requiredVersion, - strictVersion: - typeof item.strictVersion === "boolean" - ? item.strictVersion - : item.import !== false && !item.singleton, - packageName: item.packageName, - singleton: !!item.singleton, - eager: !!item.eager - }) - ); + /** + * @param {T} value value to delete + * @returns {boolean} true if value existed in set, false otherwise + */ + delete(value) { + this._invalidateCache(); + this._invalidateOrderedCache(); + return super.delete(value); } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - PLUGIN_NAME, - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - ConsumeSharedFallbackDependency, - normalModuleFactory - ); - - let unresolvedConsumes, resolvedConsumes, prefixedConsumes; - const promise = resolveMatchedConfigs(compilation, this._consumes).then( - ({ resolved, unresolved, prefixed }) => { - resolvedConsumes = resolved; - unresolvedConsumes = unresolved; - prefixedConsumes = prefixed; - } - ); - - const resolver = compilation.resolverFactory.get( - "normal", - RESOLVE_OPTIONS - ); + clear() { + this._invalidateCache(); + this._invalidateOrderedCache(); + return super.clear(); + } - /** - * @param {string} context issuer directory - * @param {string} request request - * @param {ConsumeOptions} config options - * @returns {Promise} create module - */ - const createConsumeSharedModule = (context, request, config) => { - const requiredVersionWarning = details => { - const error = new WebpackError( - `No required version specified and unable to automatically determine one. ${details}` - ); - error.file = `shared module ${request}`; - compilation.warnings.push(error); - }; - const directFallback = - config.import && - /^(\.\.?(\/|$)|\/|[A-Za-z]:|\\\\)/.test(config.import); - return Promise.all([ - new Promise(resolve => { - if (!config.import) return resolve(); - const resolveContext = { - /** @type {LazySet} */ - fileDependencies: new LazySet(), - /** @type {LazySet} */ - contextDependencies: new LazySet(), - /** @type {LazySet} */ - missingDependencies: new LazySet() - }; - resolver.resolve( - {}, - directFallback ? compiler.context : context, - config.import, - resolveContext, - (err, result) => { - compilation.contextDependencies.addAll( - resolveContext.contextDependencies - ); - compilation.fileDependencies.addAll( - resolveContext.fileDependencies - ); - compilation.missingDependencies.addAll( - resolveContext.missingDependencies - ); - if (err) { - compilation.errors.push( - new ModuleNotFoundError(null, err, { - name: `resolving fallback for shared module ${request}` - }) - ); - return resolve(); - } - resolve(result); - } - ); - }), - new Promise(resolve => { - if (config.requiredVersion !== undefined) - return resolve(config.requiredVersion); - let packageName = config.packageName; - if (packageName === undefined) { - if (/^(\/|[A-Za-z]:|\\\\)/.test(request)) { - // For relative or absolute requests we don't automatically use a packageName. - // If wished one can specify one with the packageName option. - return resolve(); - } - const match = /^((?:@[^\\/]+[\\/])?[^\\/]+)/.exec(request); - if (!match) { - requiredVersionWarning( - "Unable to extract the package name from request." - ); - return resolve(); - } - packageName = match[0]; - } + /** + * Sort with a comparer function + * @param {SortFunction} sortFn Sorting comparer function + * @returns {void} + */ + sortWith(sortFn) { + if (this.size <= 1 || sortFn === this._lastActiveSortFn) { + // already sorted - nothing to do + return; + } - getDescriptionFile( - compilation.inputFileSystem, - context, - ["package.json"], - (err, result) => { - if (err) { - requiredVersionWarning( - `Unable to read description file: ${err}` - ); - return resolve(); - } - const { data, path: descriptionPath } = result; - if (!data) { - requiredVersionWarning( - `Unable to find description file in ${context}.` - ); - return resolve(); - } - const requiredVersion = getRequiredVersionFromDescriptionFile( - data, - packageName - ); - if (typeof requiredVersion !== "string") { - requiredVersionWarning( - `Unable to find required version for "${packageName}" in description file (${descriptionPath}). It need to be in dependencies, devDependencies or peerDependencies.` - ); - return resolve(); - } - resolve(parseRange(requiredVersion)); - } - ); - }) - ]).then(([importResolved, requiredVersion]) => { - return new ConsumeSharedModule( - directFallback ? compiler.context : context, - { - ...config, - importResolved, - import: importResolved ? config.import : undefined, - requiredVersion - } - ); - }); - }; + const sortedArray = Array.from(this).sort(sortFn); + super.clear(); + for (let i = 0; i < sortedArray.length; i += 1) { + super.add(sortedArray[i]); + } + this._lastActiveSortFn = sortFn; + this._invalidateCache(); + } - normalModuleFactory.hooks.factorize.tapPromise( - PLUGIN_NAME, - ({ context, request, dependencies }) => - // wait for resolving to be complete - promise.then(() => { - if ( - dependencies[0] instanceof ConsumeSharedFallbackDependency || - dependencies[0] instanceof ProvideForSharedDependency - ) { - return; - } - const match = unresolvedConsumes.get(request); - if (match !== undefined) { - return createConsumeSharedModule(context, request, match); - } - for (const [prefix, options] of prefixedConsumes) { - if (request.startsWith(prefix)) { - const remainder = request.slice(prefix.length); - return createConsumeSharedModule(context, request, { - ...options, - import: options.import - ? options.import + remainder - : undefined, - shareKey: options.shareKey + remainder - }); - } - } - }) - ); - normalModuleFactory.hooks.createModule.tapPromise( - PLUGIN_NAME, - ({ resource }, { context, dependencies }) => { - if ( - dependencies[0] instanceof ConsumeSharedFallbackDependency || - dependencies[0] instanceof ProvideForSharedDependency - ) { - return Promise.resolve(); - } - const options = resolvedConsumes.get(resource); - if (options !== undefined) { - return createConsumeSharedModule(context, resource, options); - } - return Promise.resolve(); - } - ); - compilation.hooks.additionalTreeRuntimeRequirements.tap( - PLUGIN_NAME, - (chunk, set) => { - set.add(RuntimeGlobals.module); - set.add(RuntimeGlobals.moduleCache); - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - set.add(RuntimeGlobals.shareScopeMap); - set.add(RuntimeGlobals.initializeSharing); - set.add(RuntimeGlobals.hasOwnProperty); - compilation.addRuntimeModule( - chunk, - new ConsumeSharedRuntimeModule(set) - ); - } - ); + sort() { + this.sortWith(this._sortFn); + return this; + } + + /** + * Get data from cache + * @template R + * @param {function(SortableSet): R} fn function to calculate value + * @returns {R} returns result of fn(this), cached until set changes + */ + getFromCache(fn) { + if (this._cache === undefined) { + this._cache = new Map(); + } else { + const result = this._cache.get(fn); + const data = /** @type {R} */ (result); + if (data !== undefined) { + return data; } - ); + } + const newData = fn(this); + this._cache.set(fn, newData); + return newData; + } + + /** + * Get data from cache (ignoring sorting) + * @template R + * @param {function(SortableSet): R} fn function to calculate value + * @returns {R} returns result of fn(this), cached until set changes + */ + getFromUnorderedCache(fn) { + if (this._cacheOrderIndependent === undefined) { + this._cacheOrderIndependent = new Map(); + } else { + const result = this._cacheOrderIndependent.get(fn); + const data = /** @type {R} */ (result); + if (data !== undefined) { + return data; + } + } + const newData = fn(this); + this._cacheOrderIndependent.set(fn, newData); + return newData; + } + + /** + * @private + * @returns {void} + */ + _invalidateCache() { + if (this._cache !== undefined) { + this._cache.clear(); + } + } + + /** + * @private + * @returns {void} + */ + _invalidateOrderedCache() { + if (this._cacheOrderIndependent !== undefined) { + this._cacheOrderIndependent.clear(); + } + } + + /** + * @returns {T[]} the raw array + */ + toJSON() { + return Array.from(this); } } -module.exports = ConsumeSharedPlugin; +module.exports = SortableSet; /***/ }), -/***/ 10394: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 64985: +/***/ (function(module) { "use strict"; /* @@ -122413,365 +122811,115 @@ module.exports = ConsumeSharedPlugin; -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); -const { - parseVersionRuntimeCode, - versionLtRuntimeCode, - rangeToStringRuntimeCode, - satisfyRuntimeCode -} = __webpack_require__(19702); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("./ConsumeSharedModule")} ConsumeSharedModule */ - -class ConsumeSharedRuntimeModule extends RuntimeModule { - constructor(runtimeRequirements) { - super("consumes", RuntimeModule.STAGE_ATTACH); - this._runtimeRequirements = runtimeRequirements; +/** + * @template K + * @template V + */ +class StackedCacheMap { + constructor() { + /** @type {Map} */ + this.map = new Map(); + /** @type {ReadonlyMap[]} */ + this.stack = []; } /** - * @returns {string} runtime code + * @param {ReadonlyMap} map map to add + * @param {boolean} immutable if 'map' is immutable and StackedCacheMap can keep referencing it */ - generate() { - const { compilation, chunkGraph } = this; - const { runtimeTemplate, codeGenerationResults } = compilation; - const chunkToModuleMapping = {}; - /** @type {Map} */ - const moduleIdToSourceMapping = new Map(); - const initialConsumes = []; - /** - * - * @param {Iterable} modules modules - * @param {Chunk} chunk the chunk - * @param {(string | number)[]} list list of ids - */ - const addModules = (modules, chunk, list) => { - for (const m of modules) { - const module = /** @type {ConsumeSharedModule} */ (m); - const id = chunkGraph.getModuleId(module); - list.push(id); - moduleIdToSourceMapping.set( - id, - codeGenerationResults.getSource( - module, - chunk.runtime, - "consume-shared" - ) - ); + addAll(map, immutable) { + if (immutable) { + this.stack.push(map); + + // largest map should go first + for (let i = this.stack.length - 1; i > 0; i--) { + const beforeLast = this.stack[i - 1]; + if (beforeLast.size >= map.size) break; + this.stack[i] = beforeLast; + this.stack[i - 1] = map; + } + } else { + for (const [key, value] of map) { + this.map.set(key, value); } - }; - for (const chunk of this.chunk.getAllAsyncChunks()) { - const modules = chunkGraph.getChunkModulesIterableBySourceType( - chunk, - "consume-shared" - ); - if (!modules) continue; - addModules(modules, chunk, (chunkToModuleMapping[chunk.id] = [])); - } - for (const chunk of this.chunk.getAllInitialChunks()) { - const modules = chunkGraph.getChunkModulesIterableBySourceType( - chunk, - "consume-shared" - ); - if (!modules) continue; - addModules(modules, chunk, initialConsumes); } - if (moduleIdToSourceMapping.size === 0) return null; - return Template.asString([ - parseVersionRuntimeCode(runtimeTemplate), - versionLtRuntimeCode(runtimeTemplate), - rangeToStringRuntimeCode(runtimeTemplate), - satisfyRuntimeCode(runtimeTemplate), - `var ensureExistence = ${runtimeTemplate.basicFunction("scopeName, key", [ - `var scope = ${RuntimeGlobals.shareScopeMap}[scopeName];`, - `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) throw new Error("Shared module " + key + " doesn't exist in shared scope " + scopeName);`, - "return scope;" - ])};`, - `var findVersion = ${runtimeTemplate.basicFunction("scope, key", [ - "var versions = scope[key];", - `var key = Object.keys(versions).reduce(${runtimeTemplate.basicFunction( - "a, b", - ["return !a || versionLt(a, b) ? b : a;"] - )}, 0);`, - "return key && versions[key]" - ])};`, - `var findSingletonVersionKey = ${runtimeTemplate.basicFunction( - "scope, key", - [ - "var versions = scope[key];", - `return Object.keys(versions).reduce(${runtimeTemplate.basicFunction( - "a, b", - ["return !a || (!versions[a].loaded && versionLt(a, b)) ? b : a;"] - )}, 0);` - ] - )};`, - `var getInvalidSingletonVersionMessage = ${runtimeTemplate.basicFunction( - "scope, key, version, requiredVersion", - [ - `return "Unsatisfied version " + version + " from " + (version && scope[key][version].from) + " of shared singleton module " + key + " (required " + rangeToString(requiredVersion) + ")"` - ] - )};`, - `var getSingleton = ${runtimeTemplate.basicFunction( - "scope, scopeName, key, requiredVersion", - [ - "var version = findSingletonVersionKey(scope, key);", - "return get(scope[key][version]);" - ] - )};`, - `var getSingletonVersion = ${runtimeTemplate.basicFunction( - "scope, scopeName, key, requiredVersion", - [ - "var version = findSingletonVersionKey(scope, key);", - "if (!satisfy(requiredVersion, version)) " + - 'typeof console !== "undefined" && console.warn && console.warn(getInvalidSingletonVersionMessage(scope, key, version, requiredVersion));', - "return get(scope[key][version]);" - ] - )};`, - `var getStrictSingletonVersion = ${runtimeTemplate.basicFunction( - "scope, scopeName, key, requiredVersion", - [ - "var version = findSingletonVersionKey(scope, key);", - "if (!satisfy(requiredVersion, version)) " + - "throw new Error(getInvalidSingletonVersionMessage(scope, key, version, requiredVersion));", - "return get(scope[key][version]);" - ] - )};`, - `var findValidVersion = ${runtimeTemplate.basicFunction( - "scope, key, requiredVersion", - [ - "var versions = scope[key];", - `var key = Object.keys(versions).reduce(${runtimeTemplate.basicFunction( - "a, b", - [ - "if (!satisfy(requiredVersion, b)) return a;", - "return !a || versionLt(a, b) ? b : a;" - ] - )}, 0);`, - "return key && versions[key]" - ] - )};`, - `var getInvalidVersionMessage = ${runtimeTemplate.basicFunction( - "scope, scopeName, key, requiredVersion", - [ - "var versions = scope[key];", - 'return "No satisfying version (" + rangeToString(requiredVersion) + ") of shared module " + key + " found in shared scope " + scopeName + ".\\n" +', - `\t"Available versions: " + Object.keys(versions).map(${runtimeTemplate.basicFunction( - "key", - ['return key + " from " + versions[key].from;'] - )}).join(", ");` - ] - )};`, - `var getValidVersion = ${runtimeTemplate.basicFunction( - "scope, scopeName, key, requiredVersion", - [ - "var entry = findValidVersion(scope, key, requiredVersion);", - "if(entry) return get(entry);", - "throw new Error(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));" - ] - )};`, - `var warnInvalidVersion = ${runtimeTemplate.basicFunction( - "scope, scopeName, key, requiredVersion", - [ - 'typeof console !== "undefined" && console.warn && console.warn(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));' - ] - )};`, - `var get = ${runtimeTemplate.basicFunction("entry", [ - "entry.loaded = 1;", - "return entry.get()" - ])};`, - `var init = ${runtimeTemplate.returningFunction( - Template.asString([ - "function(scopeName, a, b, c) {", - Template.indent([ - `var promise = ${RuntimeGlobals.initializeSharing}(scopeName);`, - `if (promise && promise.then) return promise.then(fn.bind(fn, scopeName, ${RuntimeGlobals.shareScopeMap}[scopeName], a, b, c));`, - `return fn(scopeName, ${RuntimeGlobals.shareScopeMap}[scopeName], a, b, c);` - ]), - "}" - ]), - "fn" - )};`, - "", - `var load = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key", - [ - "ensureExistence(scopeName, key);", - "return get(findVersion(scope, key));" - ] - )});`, - `var loadFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, fallback", - [ - `return scope && ${RuntimeGlobals.hasOwnProperty}(scope, key) ? get(findVersion(scope, key)) : fallback();` - ] - )});`, - `var loadVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, version", - [ - "ensureExistence(scopeName, key);", - "return get(findValidVersion(scope, key, version) || warnInvalidVersion(scope, scopeName, key, version) || findVersion(scope, key));" - ] - )});`, - `var loadSingleton = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key", - [ - "ensureExistence(scopeName, key);", - "return getSingleton(scope, scopeName, key);" - ] - )});`, - `var loadSingletonVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, version", - [ - "ensureExistence(scopeName, key);", - "return getSingletonVersion(scope, scopeName, key, version);" - ] - )});`, - `var loadStrictVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, version", - [ - "ensureExistence(scopeName, key);", - "return getValidVersion(scope, scopeName, key, version);" - ] - )});`, - `var loadStrictSingletonVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, version", - [ - "ensureExistence(scopeName, key);", - "return getStrictSingletonVersion(scope, scopeName, key, version);" - ] - )});`, - `var loadVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, version, fallback", - [ - `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`, - "return get(findValidVersion(scope, key, version) || warnInvalidVersion(scope, scopeName, key, version) || findVersion(scope, key));" - ] - )});`, - `var loadSingletonFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, fallback", - [ - `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`, - "return getSingleton(scope, scopeName, key);" - ] - )});`, - `var loadSingletonVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, version, fallback", - [ - `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`, - "return getSingletonVersion(scope, scopeName, key, version);" - ] - )});`, - `var loadStrictVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, version, fallback", - [ - `var entry = scope && ${RuntimeGlobals.hasOwnProperty}(scope, key) && findValidVersion(scope, key, version);`, - `return entry ? get(entry) : fallback();` - ] - )});`, - `var loadStrictSingletonVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction( - "scopeName, scope, key, version, fallback", - [ - `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`, - "return getStrictSingletonVersion(scope, scopeName, key, version);" - ] - )});`, - "var installedModules = {};", - "var moduleToHandlerMapping = {", - Template.indent( - Array.from( - moduleIdToSourceMapping, - ([key, source]) => `${JSON.stringify(key)}: ${source.source()}` - ).join(",\n") - ), - "};", - - initialConsumes.length > 0 - ? Template.asString([ - `var initialConsumes = ${JSON.stringify(initialConsumes)};`, - `initialConsumes.forEach(${runtimeTemplate.basicFunction("id", [ - `${ - RuntimeGlobals.moduleFactories - }[id] = ${runtimeTemplate.basicFunction("module", [ - "// Handle case when module is used sync", - "installedModules[id] = 0;", - `delete ${RuntimeGlobals.moduleCache}[id];`, - "var factory = moduleToHandlerMapping[id]();", - 'if(typeof factory !== "function") throw new Error("Shared module is not available for eager consumption: " + id);', - `module.exports = factory();` - ])}` - ])});` - ]) - : "// no consumes in initial chunks", - this._runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers) - ? Template.asString([ - `var chunkMapping = ${JSON.stringify( - chunkToModuleMapping, - null, - "\t" - )};`, - `${ - RuntimeGlobals.ensureChunkHandlers - }.consumes = ${runtimeTemplate.basicFunction("chunkId, promises", [ - `if(${RuntimeGlobals.hasOwnProperty}(chunkMapping, chunkId)) {`, - Template.indent([ - `chunkMapping[chunkId].forEach(${runtimeTemplate.basicFunction( - "id", - [ - `if(${RuntimeGlobals.hasOwnProperty}(installedModules, id)) return promises.push(installedModules[id]);`, - `var onFactory = ${runtimeTemplate.basicFunction( - "factory", - [ - "installedModules[id] = 0;", - `${ - RuntimeGlobals.moduleFactories - }[id] = ${runtimeTemplate.basicFunction("module", [ - `delete ${RuntimeGlobals.moduleCache}[id];`, - "module.exports = factory();" - ])}` - ] - )};`, - `var onError = ${runtimeTemplate.basicFunction("error", [ - "delete installedModules[id];", - `${ - RuntimeGlobals.moduleFactories - }[id] = ${runtimeTemplate.basicFunction("module", [ - `delete ${RuntimeGlobals.moduleCache}[id];`, - "throw error;" - ])}` - ])};`, - "try {", - Template.indent([ - "var promise = moduleToHandlerMapping[id]();", - "if(promise.then) {", - Template.indent( - "promises.push(installedModules[id] = promise.then(onFactory)['catch'](onError));" - ), - "} else onFactory(promise);" - ]), - "} catch(e) { onError(e); }" - ] - )});` - ]), - "}" - ])}` - ]) - : "// no chunk loading of consumes" - ]); + } + + /** + * @param {K} item the key of the element to add + * @param {V} value the value of the element to add + * @returns {void} + */ + set(item, value) { + this.map.set(item, value); + } + + /** + * @param {K} item the item to delete + * @returns {void} + */ + delete(item) { + throw new Error("Items can't be deleted from a StackedCacheMap"); + } + + /** + * @param {K} item the item to test + * @returns {boolean} true if the item exists in this set + */ + has(item) { + throw new Error( + "Checking StackedCacheMap.has before reading is inefficient, use StackedCacheMap.get and check for undefined" + ); + } + + /** + * @param {K} item the key of the element to return + * @returns {V} the value of the element + */ + get(item) { + for (const map of this.stack) { + const value = map.get(item); + if (value !== undefined) return value; + } + return this.map.get(item); + } + + clear() { + this.stack.length = 0; + this.map.clear(); + } + + get size() { + let size = this.map.size; + for (const map of this.stack) { + size += map.size; + } + return size; + } + + [Symbol.iterator]() { + const iterators = this.stack.map(map => map[Symbol.iterator]()); + let current = this.map[Symbol.iterator](); + return { + next() { + let result = current.next(); + while (result.done && iterators.length > 0) { + current = iterators.pop(); + result = current.next(); + } + return result; + } + }; } } -module.exports = ConsumeSharedRuntimeModule; +module.exports = StackedCacheMap; /***/ }), -/***/ 40017: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 58845: +/***/ (function(module) { "use strict"; /* @@ -122781,39 +122929,171 @@ module.exports = ConsumeSharedRuntimeModule; -const ModuleDependency = __webpack_require__(80321); -const makeSerializable = __webpack_require__(33032); +const TOMBSTONE = Symbol("tombstone"); +const UNDEFINED_MARKER = Symbol("undefined"); -class ProvideForSharedDependency extends ModuleDependency { +/** + * @template T + * @typedef {T | undefined} Cell + */ + +/** + * @template T + * @typedef {T | typeof TOMBSTONE | typeof UNDEFINED_MARKER} InternalCell + */ + +/** + * @template K + * @template V + * @param {[K, InternalCell]} pair the internal cell + * @returns {[K, Cell]} its “safe” representation + */ +const extractPair = pair => { + const key = pair[0]; + const val = pair[1]; + if (val === UNDEFINED_MARKER || val === TOMBSTONE) { + return [key, undefined]; + } else { + return /** @type {[K, Cell]} */ (pair); + } +}; + +/** + * @template K + * @template V + */ +class StackedMap { /** - * - * @param {string} request request string + * @param {Map>[]=} parentStack an optional parent */ - constructor(request) { - super(request); + constructor(parentStack) { + /** @type {Map>} */ + this.map = new Map(); + /** @type {Map>[]} */ + this.stack = parentStack === undefined ? [] : parentStack.slice(); + this.stack.push(this.map); } - get type() { - return "provide module for shared"; + /** + * @param {K} item the key of the element to add + * @param {V} value the value of the element to add + * @returns {void} + */ + set(item, value) { + this.map.set(item, value === undefined ? UNDEFINED_MARKER : value); } - get category() { - return "esm"; + /** + * @param {K} item the item to delete + * @returns {void} + */ + delete(item) { + if (this.stack.length > 1) { + this.map.set(item, TOMBSTONE); + } else { + this.map.delete(item); + } } -} -makeSerializable( - ProvideForSharedDependency, - "webpack/lib/sharing/ProvideForSharedDependency" -); + /** + * @param {K} item the item to test + * @returns {boolean} true if the item exists in this set + */ + has(item) { + const topValue = this.map.get(item); + if (topValue !== undefined) { + return topValue !== TOMBSTONE; + } + if (this.stack.length > 1) { + for (let i = this.stack.length - 2; i >= 0; i--) { + const value = this.stack[i].get(item); + if (value !== undefined) { + this.map.set(item, value); + return value !== TOMBSTONE; + } + } + this.map.set(item, TOMBSTONE); + } + return false; + } -module.exports = ProvideForSharedDependency; + /** + * @param {K} item the key of the element to return + * @returns {Cell} the value of the element + */ + get(item) { + const topValue = this.map.get(item); + if (topValue !== undefined) { + return topValue === TOMBSTONE || topValue === UNDEFINED_MARKER + ? undefined + : topValue; + } + if (this.stack.length > 1) { + for (let i = this.stack.length - 2; i >= 0; i--) { + const value = this.stack[i].get(item); + if (value !== undefined) { + this.map.set(item, value); + return value === TOMBSTONE || value === UNDEFINED_MARKER + ? undefined + : value; + } + } + this.map.set(item, TOMBSTONE); + } + return undefined; + } + + _compress() { + if (this.stack.length === 1) return; + this.map = new Map(); + for (const data of this.stack) { + for (const pair of data) { + if (pair[1] === TOMBSTONE) { + this.map.delete(pair[0]); + } else { + this.map.set(pair[0], pair[1]); + } + } + } + this.stack = [this.map]; + } + + asArray() { + this._compress(); + return Array.from(this.map.keys()); + } + + asSet() { + this._compress(); + return new Set(this.map.keys()); + } + + asPairArray() { + this._compress(); + return Array.from(this.map.entries(), extractPair); + } + + asMap() { + return new Map(this.asPairArray()); + } + + get size() { + this._compress(); + return this.map.size; + } + + createChild() { + return new StackedMap(this.stack); + } +} + +module.exports = StackedMap; /***/ }), -/***/ 1798: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 40293: +/***/ (function(module) { "use strict"; /* @@ -122823,648 +123103,655 @@ module.exports = ProvideForSharedDependency; -const Dependency = __webpack_require__(54912); -const makeSerializable = __webpack_require__(33032); - -class ProvideSharedDependency extends Dependency { - constructor(shareScope, name, version, request, eager) { - super(); - this.shareScope = shareScope; - this.name = name; - this.version = version; - this.request = request; - this.eager = eager; - } - - get type() { - return "provide shared module"; +class StringXor { + constructor() { + this._value = undefined; } /** - * @returns {string | null} an identifier to merge equal requests + * @param {string} str string + * @returns {void} */ - getResourceIdentifier() { - return `provide module (${this.shareScope}) ${this.request} as ${ - this.name - } @ ${this.version}${this.eager ? " (eager)" : ""}`; + add(str) { + const len = str.length; + const value = this._value; + if (value === undefined) { + const newValue = (this._value = Buffer.allocUnsafe(len)); + for (let i = 0; i < len; i++) { + newValue[i] = str.charCodeAt(i); + } + return; + } + const valueLen = value.length; + if (valueLen < len) { + const newValue = (this._value = Buffer.allocUnsafe(len)); + let i; + for (i = 0; i < valueLen; i++) { + newValue[i] = value[i] ^ str.charCodeAt(i); + } + for (; i < len; i++) { + newValue[i] = str.charCodeAt(i); + } + } else { + for (let i = 0; i < len; i++) { + value[i] = value[i] ^ str.charCodeAt(i); + } + } } - serialize(context) { - context.write(this.shareScope); - context.write(this.name); - context.write(this.request); - context.write(this.version); - context.write(this.eager); - super.serialize(context); + toString() { + const value = this._value; + return value === undefined ? "" : value.toString("latin1"); } - static deserialize(context) { - const { read } = context; - const obj = new ProvideSharedDependency( - read(), - read(), - read(), - read(), - read() - ); - this.shareScope = context.read(); - obj.deserialize(context); - return obj; + updateHash(hash) { + const value = this._value; + if (value !== undefined) hash.update(value); } } -makeSerializable( - ProvideSharedDependency, - "webpack/lib/sharing/ProvideSharedDependency" -); - -module.exports = ProvideSharedDependency; +module.exports = StringXor; /***/ }), -/***/ 50821: +/***/ 38415: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy + Author Tobias Koppers @sokra */ -const AsyncDependenciesBlock = __webpack_require__(47736); -const Module = __webpack_require__(73208); -const RuntimeGlobals = __webpack_require__(16475); -const makeSerializable = __webpack_require__(33032); -const ProvideForSharedDependency = __webpack_require__(40017); - -/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ -/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ -/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/Hash")} Hash */ -/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ - -const TYPES = new Set(["share-init"]); +const TupleSet = __webpack_require__(76455); -class ProvideSharedModule extends Module { +/** + * @template {any[]} T + */ +class TupleQueue { /** - * @param {string} shareScope shared scope name - * @param {string} name shared key - * @param {string | false} version version - * @param {string} request request to the provided module - * @param {boolean} eager include the module in sync way + * @param {Iterable=} items The initial elements. */ - constructor(shareScope, name, version, request, eager) { - super("provide-module"); - this._shareScope = shareScope; - this._name = name; - this._version = version; - this._request = request; - this._eager = eager; + constructor(items) { + /** @private @type {TupleSet} */ + this._set = new TupleSet(items); + /** @private @type {Iterator} */ + this._iterator = this._set[Symbol.iterator](); } /** - * @returns {string} a unique identifier of the module + * Returns the number of elements in this queue. + * @returns {number} The number of elements in this queue. */ - identifier() { - return `provide module (${this._shareScope}) ${this._name}@${this._version} = ${this._request}`; + get length() { + return this._set.size; } /** - * @param {RequestShortener} requestShortener the request shortener - * @returns {string} a user readable identifier of the module + * Appends the specified element to this queue. + * @param {T} item The element to add. + * @returns {void} */ - readableIdentifier(requestShortener) { - return `provide shared module (${this._shareScope}) ${this._name}@${ - this._version - } = ${requestShortener.shorten(this._request)}`; + enqueue(...item) { + this._set.add(...item); } /** - * @param {LibIdentOptions} options options - * @returns {string | null} an identifier for library inclusion + * Retrieves and removes the head of this queue. + * @returns {T | undefined} The head of the queue of `undefined` if this queue is empty. */ - libIdent(options) { - return `${this.layer ? `(${this.layer})/` : ""}webpack/sharing/provide/${ - this._shareScope - }/${this._name}`; + dequeue() { + const result = this._iterator.next(); + if (result.done) { + if (this._set.size > 0) { + this._iterator = this._set[Symbol.iterator](); + const value = this._iterator.next().value; + this._set.delete(...value); + return value; + } + return undefined; + } + this._set.delete(...result.value); + return result.value; } +} - /** - * @param {NeedBuildContext} context context info - * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild - * @returns {void} - */ - needBuild(context, callback) { - callback(null, !this.buildInfo); +module.exports = TupleQueue; + + +/***/ }), + +/***/ 76455: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +/** + * @template {any[]} T + */ +class TupleSet { + constructor(init) { + this._map = new Map(); + this.size = 0; + if (init) { + for (const tuple of init) { + this.add(...tuple); + } + } } /** - * @param {WebpackOptions} options webpack options - * @param {Compilation} compilation the compilation - * @param {ResolverWithOptions} resolver the resolver - * @param {InputFileSystem} fs the file system - * @param {function(WebpackError=): void} callback callback function + * @param {T} args tuple * @returns {void} */ - build(options, compilation, resolver, fs, callback) { - this.buildMeta = {}; - this.buildInfo = { - strict: true - }; + add(...args) { + let map = this._map; + for (let i = 0; i < args.length - 2; i++) { + const arg = args[i]; + const innerMap = map.get(arg); + if (innerMap === undefined) { + map.set(arg, (map = new Map())); + } else { + map = innerMap; + } + } - this.clearDependenciesAndBlocks(); - const dep = new ProvideForSharedDependency(this._request); - if (this._eager) { - this.addDependency(dep); - } else { - const block = new AsyncDependenciesBlock({}); - block.addDependency(dep); - this.addBlock(block); + const beforeLast = args[args.length - 2]; + let set = map.get(beforeLast); + if (set === undefined) { + map.set(beforeLast, (set = new Set())); } - callback(); + const last = args[args.length - 1]; + this.size -= set.size; + set.add(last); + this.size += set.size; } /** - * @param {string=} type the source type for which the size should be estimated - * @returns {number} the estimated size of the module (must be non-zero) + * @param {T} args tuple + * @returns {boolean} true, if the tuple is in the Set */ - size(type) { - return 42; + has(...args) { + let map = this._map; + for (let i = 0; i < args.length - 2; i++) { + const arg = args[i]; + map = map.get(arg); + if (map === undefined) { + return false; + } + } + + const beforeLast = args[args.length - 2]; + let set = map.get(beforeLast); + if (set === undefined) { + return false; + } + + const last = args[args.length - 1]; + return set.has(last); } /** - * @returns {Set} types available (do not mutate) + * @param {T} args tuple + * @returns {void} */ - getSourceTypes() { - return TYPES; + delete(...args) { + let map = this._map; + for (let i = 0; i < args.length - 2; i++) { + const arg = args[i]; + map = map.get(arg); + if (map === undefined) { + return; + } + } + + const beforeLast = args[args.length - 2]; + let set = map.get(beforeLast); + if (set === undefined) { + return; + } + + const last = args[args.length - 1]; + this.size -= set.size; + set.delete(last); + this.size += set.size; } /** - * @param {CodeGenerationContext} context context for code generation - * @returns {CodeGenerationResult} result + * @returns {Iterator} iterator */ - codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { - const runtimeRequirements = new Set([RuntimeGlobals.initializeSharing]); - const code = `register(${JSON.stringify(this._name)}, ${JSON.stringify( - this._version || "0" - )}, ${ - this._eager - ? runtimeTemplate.syncModuleFactory({ - dependency: this.dependencies[0], - chunkGraph, - request: this._request, - runtimeRequirements - }) - : runtimeTemplate.asyncModuleFactory({ - block: this.blocks[0], - chunkGraph, - request: this._request, - runtimeRequirements - }) - }${this._eager ? ", 1" : ""});`; - const sources = new Map(); - const data = new Map(); - data.set("share-init", [ - { - shareScope: this._shareScope, - initStage: 10, - init: code + [Symbol.iterator]() { + const iteratorStack = []; + const tuple = []; + let currentSetIterator = undefined; + + const next = it => { + const result = it.next(); + if (result.done) { + if (iteratorStack.length === 0) return false; + tuple.pop(); + return next(iteratorStack.pop()); } - ]); - return { sources, data, runtimeRequirements }; - } + const [key, value] = result.value; + iteratorStack.push(it); + tuple.push(key); + if (value instanceof Set) { + currentSetIterator = value[Symbol.iterator](); + return true; + } else { + return next(value[Symbol.iterator]()); + } + }; - serialize(context) { - const { write } = context; - write(this._shareScope); - write(this._name); - write(this._version); - write(this._request); - write(this._eager); - super.serialize(context); - } + next(this._map[Symbol.iterator]()); - static deserialize(context) { - const { read } = context; - const obj = new ProvideSharedModule(read(), read(), read(), read(), read()); - obj.deserialize(context); - return obj; + return { + next() { + while (currentSetIterator) { + const result = currentSetIterator.next(); + if (result.done) { + tuple.pop(); + if (!next(iteratorStack.pop())) { + currentSetIterator = undefined; + } + } else { + return { + done: false, + value: /** @type {T} */ (tuple.concat(result.value)) + }; + } + } + return { done: true, value: undefined }; + } + }; } } -makeSerializable( - ProvideSharedModule, - "webpack/lib/sharing/ProvideSharedModule" -); - -module.exports = ProvideSharedModule; +module.exports = TupleSet; /***/ }), -/***/ 39344: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 54500: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy + Author Ivan Kopeykin @vankop */ -const ModuleFactory = __webpack_require__(51010); -const ProvideSharedModule = __webpack_require__(50821); +/** @typedef {import("./fs").InputFileSystem} InputFileSystem */ +/** @typedef {(error: Error|null, result?: Buffer) => void} ErrorFirstCallback */ -/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */ -/** @typedef {import("../ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ -/** @typedef {import("./ProvideSharedDependency")} ProvideSharedDependency */ +const backSlashCharCode = "\\".charCodeAt(0); +const slashCharCode = "/".charCodeAt(0); +const aLowerCaseCharCode = "a".charCodeAt(0); +const zLowerCaseCharCode = "z".charCodeAt(0); +const aUpperCaseCharCode = "A".charCodeAt(0); +const zUpperCaseCharCode = "Z".charCodeAt(0); +const _0CharCode = "0".charCodeAt(0); +const _9CharCode = "9".charCodeAt(0); +const plusCharCode = "+".charCodeAt(0); +const hyphenCharCode = "-".charCodeAt(0); +const colonCharCode = ":".charCodeAt(0); +const hashCharCode = "#".charCodeAt(0); +const queryCharCode = "?".charCodeAt(0); +/** + * Get scheme if specifier is an absolute URL specifier + * e.g. Absolute specifiers like 'file:///user/webpack/index.js' + * https://tools.ietf.org/html/rfc3986#section-3.1 + * @param {string} specifier specifier + * @returns {string|undefined} scheme if absolute URL specifier provided + */ +function getScheme(specifier) { + const start = specifier.charCodeAt(0); -class ProvideSharedModuleFactory extends ModuleFactory { - /** - * @param {ModuleFactoryCreateData} data data object - * @param {function(Error=, ModuleFactoryResult=): void} callback callback - * @returns {void} - */ - create(data, callback) { - const dep = /** @type {ProvideSharedDependency} */ (data.dependencies[0]); - callback(null, { - module: new ProvideSharedModule( - dep.shareScope, - dep.name, - dep.version, - dep.request, - dep.eager - ) - }); + // First char maybe only a letter + if ( + (start < aLowerCaseCharCode || start > zLowerCaseCharCode) && + (start < aUpperCaseCharCode || start > zUpperCaseCharCode) + ) { + return undefined; + } + + let i = 1; + let ch = specifier.charCodeAt(i); + + while ( + (ch >= aLowerCaseCharCode && ch <= zLowerCaseCharCode) || + (ch >= aUpperCaseCharCode && ch <= zUpperCaseCharCode) || + (ch >= _0CharCode && ch <= _9CharCode) || + ch === plusCharCode || + ch === hyphenCharCode + ) { + if (++i === specifier.length) return undefined; + ch = specifier.charCodeAt(i); + } + + // Scheme must end with colon + if (ch !== colonCharCode) return undefined; + + // Check for Windows absolute path + // https://url.spec.whatwg.org/#url-miscellaneous + if (i === 1) { + const nextChar = i + 1 < specifier.length ? specifier.charCodeAt(i + 1) : 0; + if ( + nextChar === 0 || + nextChar === backSlashCharCode || + nextChar === slashCharCode || + nextChar === hashCharCode || + nextChar === queryCharCode + ) { + return undefined; + } } + + return specifier.slice(0, i).toLowerCase(); } -module.exports = ProvideSharedModuleFactory; +/** + * @param {string} specifier specifier + * @returns {string|null} protocol if absolute URL specifier provided + */ +function getProtocol(specifier) { + const scheme = getScheme(specifier); + return scheme === undefined ? undefined : scheme + ":"; +} + +exports.getScheme = getScheme; +exports.getProtocol = getProtocol; /***/ }), -/***/ 31225: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 28745: +/***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy + Author Tobias Koppers @sokra */ -const WebpackError = __webpack_require__(53799); -const { parseOptions } = __webpack_require__(3083); -const createSchemaValidation = __webpack_require__(32540); -const ProvideForSharedDependency = __webpack_require__(40017); -const ProvideSharedDependency = __webpack_require__(1798); -const ProvideSharedModuleFactory = __webpack_require__(39344); +const isWeakKey = thing => typeof thing === "object" && thing !== null; -/** @typedef {import("../../declarations/plugins/sharing/ProvideSharedPlugin").ProvideSharedPluginOptions} ProvideSharedPluginOptions */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Compiler")} Compiler */ +/** + * @template {any[]} T + * @template V + */ +class WeakTupleMap { + constructor() { + /** @private */ + this.f = 0; + /** @private @type {any} */ + this.v = undefined; + /** @private @type {Map> | undefined} */ + this.m = undefined; + /** @private @type {WeakMap> | undefined} */ + this.w = undefined; + } -const validate = createSchemaValidation( - __webpack_require__(91924), - () => __webpack_require__(438), - { - name: "Provide Shared Plugin", - baseDataPath: "options" + /** + * @param {[...T, V]} args tuple + * @returns {void} + */ + set(...args) { + /** @type {WeakTupleMap} */ + let node = this; + for (let i = 0; i < args.length - 1; i++) { + node = node._get(args[i]); + } + node._setValue(args[args.length - 1]); } -); -/** - * @typedef {Object} ProvideOptions - * @property {string} shareKey - * @property {string} shareScope - * @property {string | undefined | false} version - * @property {boolean} eager - */ + /** + * @param {T} args tuple + * @returns {boolean} true, if the tuple is in the Set + */ + has(...args) { + /** @type {WeakTupleMap} */ + let node = this; + for (let i = 0; i < args.length; i++) { + node = node._peek(args[i]); + if (node === undefined) return false; + } + return node._hasValue(); + } -/** @typedef {Map} ResolvedProvideMap */ + /** + * @param {T} args tuple + * @returns {V} the value + */ + get(...args) { + /** @type {WeakTupleMap} */ + let node = this; + for (let i = 0; i < args.length; i++) { + node = node._peek(args[i]); + if (node === undefined) return undefined; + } + return node._getValue(); + } -class ProvideSharedPlugin { /** - * @param {ProvideSharedPluginOptions} options options + * @param {[...T, function(): V]} args tuple + * @returns {V} the value */ - constructor(options) { - validate(options); + provide(...args) { + /** @type {WeakTupleMap} */ + let node = this; + for (let i = 0; i < args.length - 1; i++) { + node = node._get(args[i]); + } + if (node._hasValue()) return node._getValue(); + const fn = args[args.length - 1]; + const newValue = fn(...args.slice(0, -1)); + node._setValue(newValue); + return newValue; + } - /** @type {[string, ProvideOptions][]} */ - this._provides = parseOptions( - options.provides, - item => { - if (Array.isArray(item)) - throw new Error("Unexpected array of provides"); - /** @type {ProvideOptions} */ - const result = { - shareKey: item, - version: undefined, - shareScope: options.shareScope || "default", - eager: false - }; - return result; - }, - item => ({ - shareKey: item.shareKey, - version: item.version, - shareScope: item.shareScope || options.shareScope || "default", - eager: !!item.eager - }) - ); - this._provides.sort(([a], [b]) => { - if (a < b) return -1; - if (b < a) return 1; - return 0; - }); + /** + * @param {T} args tuple + * @returns {void} + */ + delete(...args) { + /** @type {WeakTupleMap} */ + let node = this; + for (let i = 0; i < args.length; i++) { + node = node._peek(args[i]); + if (node === undefined) return; + } + node._deleteValue(); } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance * @returns {void} */ - apply(compiler) { - /** @type {WeakMap} */ - const compilationData = new WeakMap(); + clear() { + this.f = 0; + this.v = undefined; + this.w = undefined; + this.m = undefined; + } - compiler.hooks.compilation.tap( - "ProvideSharedPlugin", - (compilation, { normalModuleFactory }) => { - /** @type {ResolvedProvideMap} */ - const resolvedProvideMap = new Map(); - /** @type {Map} */ - const matchProvides = new Map(); - /** @type {Map} */ - const prefixMatchProvides = new Map(); - for (const [request, config] of this._provides) { - if (/^(\/|[A-Za-z]:\\|\\\\|\.\.?(\/|$))/.test(request)) { - // relative request - resolvedProvideMap.set(request, { - config, - version: config.version - }); - } else if (/^(\/|[A-Za-z]:\\|\\\\)/.test(request)) { - // absolute path - resolvedProvideMap.set(request, { - config, - version: config.version - }); - } else if (request.endsWith("/")) { - // module request prefix - prefixMatchProvides.set(request, config); - } else { - // module request - matchProvides.set(request, config); - } - } - compilationData.set(compilation, resolvedProvideMap); - const provideSharedModule = ( - key, - config, - resource, - resourceResolveData - ) => { - let version = config.version; - if (version === undefined) { - let details = ""; - if (!resourceResolveData) { - details = `No resolve data provided from resolver.`; - } else { - const descriptionFileData = - resourceResolveData.descriptionFileData; - if (!descriptionFileData) { - details = - "No description file (usually package.json) found. Add description file with name and version, or manually specify version in shared config."; - } else if (!descriptionFileData.version) { - details = - "No version in description file (usually package.json). Add version to description file, or manually specify version in shared config."; - } else { - version = descriptionFileData.version; - } - } - if (!version) { - const error = new WebpackError( - `No version specified and unable to automatically determine one. ${details}` - ); - error.file = `shared module ${key} -> ${resource}`; - compilation.warnings.push(error); - } - } - resolvedProvideMap.set(resource, { - config, - version - }); - }; - normalModuleFactory.hooks.module.tap( - "ProvideSharedPlugin", - (module, { resource, resourceResolveData }, resolveData) => { - if (resolvedProvideMap.has(resource)) { - return module; - } - const { request } = resolveData; - { - const config = matchProvides.get(request); - if (config !== undefined) { - provideSharedModule( - request, - config, - resource, - resourceResolveData - ); - resolveData.cacheable = false; - } - } - for (const [prefix, config] of prefixMatchProvides) { - if (request.startsWith(prefix)) { - const remainder = request.slice(prefix.length); - provideSharedModule( - resource, - { - ...config, - shareKey: config.shareKey + remainder - }, - resource, - resourceResolveData - ); - resolveData.cacheable = false; - } - } - return module; - } - ); - } - ); - compiler.hooks.finishMake.tapPromise("ProvideSharedPlugin", compilation => { - const resolvedProvideMap = compilationData.get(compilation); - if (!resolvedProvideMap) return Promise.resolve(); - return Promise.all( - Array.from( - resolvedProvideMap, - ([resource, { config, version }]) => - new Promise((resolve, reject) => { - compilation.addInclude( - compiler.context, - new ProvideSharedDependency( - config.shareScope, - config.shareKey, - version || false, - resource, - config.eager - ), - { - name: undefined - }, - err => { - if (err) return reject(err); - resolve(); - } - ); - }) - ) - ).then(() => {}); - }); + _getValue() { + return this.v; + } - compiler.hooks.compilation.tap( - "ProvideSharedPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - ProvideForSharedDependency, - normalModuleFactory - ); + _hasValue() { + return (this.f & 1) === 1; + } - compilation.dependencyFactories.set( - ProvideSharedDependency, - new ProvideSharedModuleFactory() - ); + _setValue(v) { + this.f |= 1; + this.v = v; + } + + _deleteValue() { + this.f &= 6; + this.v = undefined; + } + + _peek(thing) { + if (isWeakKey(thing)) { + if ((this.f & 4) !== 4) return undefined; + return this.w.get(thing); + } else { + if ((this.f & 2) !== 2) return undefined; + return this.m.get(thing); + } + } + + _get(thing) { + if (isWeakKey(thing)) { + if ((this.f & 4) !== 4) { + const newMap = new WeakMap(); + this.f |= 4; + const newNode = new WeakTupleMap(); + (this.w = newMap).set(thing, newNode); + return newNode; } - ); + const entry = this.w.get(thing); + if (entry !== undefined) { + return entry; + } + const newNode = new WeakTupleMap(); + this.w.set(thing, newNode); + return newNode; + } else { + if ((this.f & 2) !== 2) { + const newMap = new Map(); + this.f |= 2; + const newNode = new WeakTupleMap(); + (this.m = newMap).set(thing, newNode); + return newNode; + } + const entry = this.m.get(thing); + if (entry !== undefined) { + return entry; + } + const newNode = new WeakTupleMap(); + this.m.set(thing, newNode); + return newNode; + } } } -module.exports = ProvideSharedPlugin; +module.exports = WeakTupleMap; /***/ }), -/***/ 26335: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 92229: +/***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy + Author Mikola Lysenko @mikolalysenko */ -const { parseOptions } = __webpack_require__(3083); -const ConsumeSharedPlugin = __webpack_require__(15046); -const ProvideSharedPlugin = __webpack_require__(31225); -const { isRequiredVersion } = __webpack_require__(84379); +/* cspell:disable-next-line */ +// Refactor: Peter Somogyvari @petermetz -/** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumeSharedPluginOptions} ConsumeSharedPluginOptions */ -/** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumesConfig} ConsumesConfig */ -/** @typedef {import("../../declarations/plugins/sharing/ProvideSharedPlugin").ProvideSharedPluginOptions} ProvideSharedPluginOptions */ -/** @typedef {import("../../declarations/plugins/sharing/ProvideSharedPlugin").ProvidesConfig} ProvidesConfig */ -/** @typedef {import("../../declarations/plugins/sharing/SharePlugin").SharePluginOptions} SharePluginOptions */ -/** @typedef {import("../../declarations/plugins/sharing/SharePlugin").SharedConfig} SharedConfig */ -/** @typedef {import("../Compiler")} Compiler */ +const compileSearch = (funcName, predicate, reversed, extraArgs, earlyOut) => { + const code = [ + "function ", + funcName, + "(a,l,h,", + extraArgs.join(","), + "){", + earlyOut ? "" : "var i=", + reversed ? "l-1" : "h+1", + ";while(l<=h){var m=(l+h)>>>1,x=a[m]" + ]; -class SharePlugin { - /** - * @param {SharePluginOptions} options options - */ - constructor(options) { - /** @type {[string, SharedConfig][]} */ - const sharedOptions = parseOptions( - options.shared, - (item, key) => { - if (typeof item !== "string") - throw new Error("Unexpected array in shared"); - /** @type {SharedConfig} */ - const config = - item === key || !isRequiredVersion(item) - ? { - import: item - } - : { - import: key, - requiredVersion: item - }; - return config; - }, - item => item - ); - /** @type {Record[]} */ - const consumes = sharedOptions.map(([key, options]) => ({ - [key]: { - import: options.import, - shareKey: options.shareKey || key, - shareScope: options.shareScope, - requiredVersion: options.requiredVersion, - strictVersion: options.strictVersion, - singleton: options.singleton, - packageName: options.packageName, - eager: options.eager - } - })); - /** @type {Record[]} */ - const provides = sharedOptions - .filter(([, options]) => options.import !== false) - .map(([key, options]) => ({ - [options.import || key]: { - shareKey: options.shareKey || key, - shareScope: options.shareScope, - version: options.version, - eager: options.eager - } - })); - this._shareScope = options.shareScope; - this._consumes = consumes; - this._provides = provides; + if (earlyOut) { + if (predicate.indexOf("c") < 0) { + code.push(";if(x===y){return m}else if(x<=y){"); + } else { + code.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"); + } + } else { + code.push(";if(", predicate, "){i=m;"); } - - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - new ConsumeSharedPlugin({ - shareScope: this._shareScope, - consumes: this._consumes - }).apply(compiler); - new ProvideSharedPlugin({ - shareScope: this._shareScope, - provides: this._provides - }).apply(compiler); + if (reversed) { + code.push("l=m+1}else{h=m-1}"); + } else { + code.push("h=m-1}else{l=m+1}"); } -} + code.push("}"); + if (earlyOut) { + code.push("return -1};"); + } else { + code.push("return i};"); + } + return code.join(""); +}; -module.exports = SharePlugin; +const compileBoundsSearch = (predicate, reversed, suffix, earlyOut) => { + const arg1 = compileSearch( + "A", + "x" + predicate + "y", + reversed, + ["y"], + earlyOut + ); + + const arg2 = compileSearch( + "P", + "c(x,y)" + predicate + "0", + reversed, + ["y", "c"], + earlyOut + ); + + const fnHeader = "function dispatchBinarySearch"; + + const fnBody = + "(a,y,c,l,h){\ +if(typeof(c)==='function'){\ +return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)\ +}else{\ +return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)\ +}}\ +return dispatchBinarySearch"; + + const fnArgList = [arg1, arg2, fnHeader, suffix, fnBody, suffix]; + const fnSource = fnArgList.join(""); + const result = new Function(fnSource); + return result(); +}; + +module.exports = { + ge: compileBoundsSearch(">=", false, "GE"), + gt: compileBoundsSearch(">", false, "GT"), + lt: compileBoundsSearch("<", true, "LT"), + le: compileBoundsSearch("<=", true, "LE"), + eq: compileBoundsSearch("-", true, "EQ", true) +}; /***/ }), -/***/ 96066: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 60839: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /* @@ -123474,343 +123761,573 @@ module.exports = SharePlugin; -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); -const { - compareModulesByIdentifier, - compareStrings -} = __webpack_require__(29579); +/** @type {WeakMap>} */ +const mergeCache = new WeakMap(); +/** @type {WeakMap>>} */ +const setPropertyCache = new WeakMap(); +const DELETE = Symbol("DELETE"); +const DYNAMIC_INFO = Symbol("cleverMerge dynamic info"); -class ShareRuntimeModule extends RuntimeModule { - constructor() { - super("sharing"); +/** + * Merges two given objects and caches the result to avoid computation if same objects passed as arguments again. + * @template T + * @template O + * @example + * // performs cleverMerge(first, second), stores the result in WeakMap and returns result + * cachedCleverMerge({a: 1}, {a: 2}) + * {a: 2} + * // when same arguments passed, gets the result from WeakMap and returns it. + * cachedCleverMerge({a: 1}, {a: 2}) + * {a: 2} + * @param {T} first first object + * @param {O} second second object + * @returns {T & O | T | O} merged object of first and second object + */ +const cachedCleverMerge = (first, second) => { + if (second === undefined) return first; + if (first === undefined) return second; + if (typeof second !== "object" || second === null) return second; + if (typeof first !== "object" || first === null) return first; + + let innerCache = mergeCache.get(first); + if (innerCache === undefined) { + innerCache = new WeakMap(); + mergeCache.set(first, innerCache); } + const prevMerge = innerCache.get(second); + if (prevMerge !== undefined) return prevMerge; + const newMerge = _cleverMerge(first, second, true); + innerCache.set(second, newMerge); + return newMerge; +}; - /** - * @returns {string} runtime code - */ - generate() { - const { compilation, chunkGraph } = this; - const { - runtimeTemplate, - codeGenerationResults, - outputOptions: { uniqueName } - } = compilation; - /** @type {Map>>} */ - const initCodePerScope = new Map(); - for (const chunk of this.chunk.getAllReferencedChunks()) { - const modules = chunkGraph.getOrderedChunkModulesIterableBySourceType( - chunk, - "share-init", - compareModulesByIdentifier - ); - if (!modules) continue; - for (const m of modules) { - const data = codeGenerationResults.getData( - m, - chunk.runtime, - "share-init" - ); - if (!data) continue; - for (const item of data) { - const { shareScope, initStage, init } = item; - let stages = initCodePerScope.get(shareScope); - if (stages === undefined) { - initCodePerScope.set(shareScope, (stages = new Map())); - } - let list = stages.get(initStage || 0); - if (list === undefined) { - stages.set(initStage || 0, (list = new Set())); +/** + * @template T + * @param {Partial} obj object + * @param {string} property property + * @param {string|number|boolean} value assignment value + * @returns {T} new object + */ +const cachedSetProperty = (obj, property, value) => { + let mapByProperty = setPropertyCache.get(obj); + + if (mapByProperty === undefined) { + mapByProperty = new Map(); + setPropertyCache.set(obj, mapByProperty); + } + + let mapByValue = mapByProperty.get(property); + + if (mapByValue === undefined) { + mapByValue = new Map(); + mapByProperty.set(property, mapByValue); + } + + let result = mapByValue.get(value); + + if (result) return result; + + result = { + ...obj, + [property]: value + }; + mapByValue.set(value, result); + + return result; +}; + +/** + * @typedef {Object} ObjectParsedPropertyEntry + * @property {any | undefined} base base value + * @property {string | undefined} byProperty the name of the selector property + * @property {Map} byValues value depending on selector property, merged with base + */ + +/** + * @typedef {Object} ParsedObject + * @property {Map} static static properties (key is property name) + * @property {{ byProperty: string, fn: Function } | undefined} dynamic dynamic part + */ + +/** @type {WeakMap} */ +const parseCache = new WeakMap(); + +/** + * @param {object} obj the object + * @returns {ParsedObject} parsed object + */ +const cachedParseObject = obj => { + const entry = parseCache.get(obj); + if (entry !== undefined) return entry; + const result = parseObject(obj); + parseCache.set(obj, result); + return result; +}; + +/** + * @param {object} obj the object + * @returns {ParsedObject} parsed object + */ +const parseObject = obj => { + const info = new Map(); + let dynamicInfo; + const getInfo = p => { + const entry = info.get(p); + if (entry !== undefined) return entry; + const newEntry = { + base: undefined, + byProperty: undefined, + byValues: undefined + }; + info.set(p, newEntry); + return newEntry; + }; + for (const key of Object.keys(obj)) { + if (key.startsWith("by")) { + const byProperty = key; + const byObj = obj[byProperty]; + if (typeof byObj === "object") { + for (const byValue of Object.keys(byObj)) { + const obj = byObj[byValue]; + for (const key of Object.keys(obj)) { + const entry = getInfo(key); + if (entry.byProperty === undefined) { + entry.byProperty = byProperty; + entry.byValues = new Map(); + } else if (entry.byProperty !== byProperty) { + throw new Error( + `${byProperty} and ${entry.byProperty} for a single property is not supported` + ); + } + entry.byValues.set(byValue, obj[key]); + if (byValue === "default") { + for (const otherByValue of Object.keys(byObj)) { + if (!entry.byValues.has(otherByValue)) + entry.byValues.set(otherByValue, undefined); + } + } } - list.add(init); } + } else if (typeof byObj === "function") { + if (dynamicInfo === undefined) { + dynamicInfo = { + byProperty: key, + fn: byObj + }; + } else { + throw new Error( + `${key} and ${dynamicInfo.byProperty} when both are functions is not supported` + ); + } + } else { + const entry = getInfo(key); + entry.base = obj[key]; } - } - return Template.asString([ - `${RuntimeGlobals.shareScopeMap} = {};`, - "var initPromises = {};", - "var initTokens = {};", - `${RuntimeGlobals.initializeSharing} = ${runtimeTemplate.basicFunction( - "name, initScope", - [ - "if(!initScope) initScope = [];", - "// handling circular init calls", - "var initToken = initTokens[name];", - "if(!initToken) initToken = initTokens[name] = {};", - "if(initScope.indexOf(initToken) >= 0) return;", - "initScope.push(initToken);", - "// only runs once", - "if(initPromises[name]) return initPromises[name];", - "// creates a new share scope if needed", - `if(!${RuntimeGlobals.hasOwnProperty}(${RuntimeGlobals.shareScopeMap}, name)) ${RuntimeGlobals.shareScopeMap}[name] = {};`, - "// runs all init snippets from all modules reachable", - `var scope = ${RuntimeGlobals.shareScopeMap}[name];`, - `var warn = ${runtimeTemplate.returningFunction( - 'typeof console !== "undefined" && console.warn && console.warn(msg)', - "msg" - )};`, - `var uniqueName = ${JSON.stringify(uniqueName || undefined)};`, - `var register = ${runtimeTemplate.basicFunction( - "name, version, factory, eager", - [ - "var versions = scope[name] = scope[name] || {};", - "var activeVersion = versions[version];", - "if(!activeVersion || (!activeVersion.loaded && (!eager != !activeVersion.eager ? eager : uniqueName > activeVersion.from))) versions[version] = { get: factory, from: uniqueName, eager: !!eager };" - ] - )};`, - `var initExternal = ${runtimeTemplate.basicFunction("id", [ - `var handleError = ${runtimeTemplate.expressionFunction( - 'warn("Initialization of sharing external failed: " + err)', - "err" - )};`, - "try {", - Template.indent([ - "var module = __webpack_require__(id);", - "if(!module) return;", - `var initFn = ${runtimeTemplate.returningFunction( - `module && module.init && module.init(${RuntimeGlobals.shareScopeMap}[name], initScope)`, - "module" - )}`, - "if(module.then) return promises.push(module.then(initFn, handleError));", - "var initResult = initFn(module);", - "if(initResult && initResult.then) return promises.push(initResult['catch'](handleError));" - ]), - "} catch(err) { handleError(err); }" - ])}`, - "var promises = [];", - "switch(name) {", - ...Array.from(initCodePerScope) - .sort(([a], [b]) => compareStrings(a, b)) - .map(([name, stages]) => - Template.indent([ - `case ${JSON.stringify(name)}: {`, - Template.indent( - Array.from(stages) - .sort(([a], [b]) => a - b) - .map(([, initCode]) => - Template.asString(Array.from(initCode)) - ) - ), - "}", - "break;" - ]) - ), - "}", - "if(!promises.length) return initPromises[name] = 1;", - `return initPromises[name] = Promise.all(promises).then(${runtimeTemplate.returningFunction( - "initPromises[name] = 1" - )});` - ] - )};` - ]); + } else { + const entry = getInfo(key); + entry.base = obj[key]; + } } -} - -module.exports = ShareRuntimeModule; - - -/***/ }), - -/***/ 3591: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - + return { + static: info, + dynamic: dynamicInfo + }; +}; +/** + * @param {Map} info static properties (key is property name) + * @param {{ byProperty: string, fn: Function } | undefined} dynamicInfo dynamic part + * @returns {object} the object + */ +const serializeObject = (info, dynamicInfo) => { + const obj = {}; + // Setup byProperty structure + for (const entry of info.values()) { + if (entry.byProperty !== undefined) { + const byObj = (obj[entry.byProperty] = obj[entry.byProperty] || {}); + for (const byValue of entry.byValues.keys()) { + byObj[byValue] = byObj[byValue] || {}; + } + } + } + for (const [key, entry] of info) { + if (entry.base !== undefined) { + obj[key] = entry.base; + } + // Fill byProperty structure + if (entry.byProperty !== undefined) { + const byObj = (obj[entry.byProperty] = obj[entry.byProperty] || {}); + for (const byValue of Object.keys(byObj)) { + const value = getFromByValues(entry.byValues, byValue); + if (value !== undefined) byObj[byValue][key] = value; + } + } + } + if (dynamicInfo !== undefined) { + obj[dynamicInfo.byProperty] = dynamicInfo.fn; + } + return obj; +}; -const ModuleNotFoundError = __webpack_require__(32882); -const LazySet = __webpack_require__(38938); +const VALUE_TYPE_UNDEFINED = 0; +const VALUE_TYPE_ATOM = 1; +const VALUE_TYPE_ARRAY_EXTEND = 2; +const VALUE_TYPE_OBJECT = 3; +const VALUE_TYPE_DELETE = 4; -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../ResolverFactory").ResolveOptionsWithDependencyType} ResolveOptionsWithDependencyType */ +/** + * @param {any} value a single value + * @returns {VALUE_TYPE_UNDEFINED | VALUE_TYPE_ATOM | VALUE_TYPE_ARRAY_EXTEND | VALUE_TYPE_OBJECT | VALUE_TYPE_DELETE} value type + */ +const getValueType = value => { + if (value === undefined) { + return VALUE_TYPE_UNDEFINED; + } else if (value === DELETE) { + return VALUE_TYPE_DELETE; + } else if (Array.isArray(value)) { + if (value.lastIndexOf("...") !== -1) return VALUE_TYPE_ARRAY_EXTEND; + return VALUE_TYPE_ATOM; + } else if ( + typeof value === "object" && + value !== null && + (!value.constructor || value.constructor === Object) + ) { + return VALUE_TYPE_OBJECT; + } + return VALUE_TYPE_ATOM; +}; /** + * Merges two objects. Objects are deeply clever merged. + * Arrays might reference the old value with "...". + * Non-object values take preference over object values. * @template T - * @typedef {Object} MatchedConfigs - * @property {Map} resolved - * @property {Map} unresolved - * @property {Map} prefixed + * @template O + * @param {T} first first object + * @param {O} second second object + * @returns {T & O | T | O} merged object of first and second object */ +const cleverMerge = (first, second) => { + if (second === undefined) return first; + if (first === undefined) return second; + if (typeof second !== "object" || second === null) return second; + if (typeof first !== "object" || first === null) return first; -/** @type {ResolveOptionsWithDependencyType} */ -const RESOLVE_OPTIONS = { dependencyType: "esm" }; + return _cleverMerge(first, second, false); +}; /** - * @template T - * @param {Compilation} compilation the compilation - * @param {[string, T][]} configs to be processed configs - * @returns {Promise>} resolved matchers + * Merges two objects. Objects are deeply clever merged. + * @param {object} first first object + * @param {object} second second object + * @param {boolean} internalCaching should parsing of objects and nested merges be cached + * @returns {object} merged object of first and second object */ -exports.resolveMatchedConfigs = (compilation, configs) => { - /** @type {Map} */ - const resolved = new Map(); - /** @type {Map} */ - const unresolved = new Map(); - /** @type {Map} */ - const prefixed = new Map(); - const resolveContext = { - /** @type {LazySet} */ - fileDependencies: new LazySet(), - /** @type {LazySet} */ - contextDependencies: new LazySet(), - /** @type {LazySet} */ - missingDependencies: new LazySet() - }; - const resolver = compilation.resolverFactory.get("normal", RESOLVE_OPTIONS); - const context = compilation.compiler.context; +const _cleverMerge = (first, second, internalCaching = false) => { + const firstObject = internalCaching + ? cachedParseObject(first) + : parseObject(first); + const { static: firstInfo, dynamic: firstDynamicInfo } = firstObject; - return Promise.all( - configs.map(([request, config]) => { - if (/^\.\.?(\/|$)/.test(request)) { - // relative request - return new Promise(resolve => { - resolver.resolve( - {}, - context, - request, - resolveContext, - (err, result) => { - if (err || result === false) { - err = err || new Error(`Can't resolve ${request}`); - compilation.errors.push( - new ModuleNotFoundError(null, err, { - name: `shared module ${request}` - }) - ); - return resolve(); - } - resolved.set(result, config); - resolve(); - } + // If the first argument has a dynamic part we modify the dynamic part to merge the second argument + if (firstDynamicInfo !== undefined) { + let { byProperty, fn } = firstDynamicInfo; + const fnInfo = fn[DYNAMIC_INFO]; + if (fnInfo) { + second = internalCaching + ? cachedCleverMerge(fnInfo[1], second) + : cleverMerge(fnInfo[1], second); + fn = fnInfo[0]; + } + const newFn = (...args) => { + const fnResult = fn(...args); + return internalCaching + ? cachedCleverMerge(fnResult, second) + : cleverMerge(fnResult, second); + }; + newFn[DYNAMIC_INFO] = [fn, second]; + return serializeObject(firstObject.static, { byProperty, fn: newFn }); + } + + // If the first part is static only, we merge the static parts and keep the dynamic part of the second argument + const secondObject = internalCaching + ? cachedParseObject(second) + : parseObject(second); + const { static: secondInfo, dynamic: secondDynamicInfo } = secondObject; + /** @type {Map} */ + const resultInfo = new Map(); + for (const [key, firstEntry] of firstInfo) { + const secondEntry = secondInfo.get(key); + const entry = + secondEntry !== undefined + ? mergeEntries(firstEntry, secondEntry, internalCaching) + : firstEntry; + resultInfo.set(key, entry); + } + for (const [key, secondEntry] of secondInfo) { + if (!firstInfo.has(key)) { + resultInfo.set(key, secondEntry); + } + } + return serializeObject(resultInfo, secondDynamicInfo); +}; + +/** + * @param {ObjectParsedPropertyEntry} firstEntry a + * @param {ObjectParsedPropertyEntry} secondEntry b + * @param {boolean} internalCaching should parsing of objects and nested merges be cached + * @returns {ObjectParsedPropertyEntry} new entry + */ +const mergeEntries = (firstEntry, secondEntry, internalCaching) => { + switch (getValueType(secondEntry.base)) { + case VALUE_TYPE_ATOM: + case VALUE_TYPE_DELETE: + // No need to consider firstEntry at all + // second value override everything + // = second.base + second.byProperty + return secondEntry; + case VALUE_TYPE_UNDEFINED: + if (!firstEntry.byProperty) { + // = first.base + second.byProperty + return { + base: firstEntry.base, + byProperty: secondEntry.byProperty, + byValues: secondEntry.byValues + }; + } else if (firstEntry.byProperty !== secondEntry.byProperty) { + throw new Error( + `${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported` + ); + } else { + // = first.base + (first.byProperty + second.byProperty) + // need to merge first and second byValues + const newByValues = new Map(firstEntry.byValues); + for (const [key, value] of secondEntry.byValues) { + const firstValue = getFromByValues(firstEntry.byValues, key); + newByValues.set( + key, + mergeSingleValue(firstValue, value, internalCaching) ); - }); - } else if (/^(\/|[A-Za-z]:\\|\\\\)/.test(request)) { - // absolute path - resolved.set(request, config); - } else if (request.endsWith("/")) { - // module request prefix - prefixed.set(request, config); + } + return { + base: firstEntry.base, + byProperty: firstEntry.byProperty, + byValues: newByValues + }; + } + default: { + if (!firstEntry.byProperty) { + // The simple case + // = (first.base + second.base) + second.byProperty + return { + base: mergeSingleValue( + firstEntry.base, + secondEntry.base, + internalCaching + ), + byProperty: secondEntry.byProperty, + byValues: secondEntry.byValues + }; + } + let newBase; + const intermediateByValues = new Map(firstEntry.byValues); + for (const [key, value] of intermediateByValues) { + intermediateByValues.set( + key, + mergeSingleValue(value, secondEntry.base, internalCaching) + ); + } + if ( + Array.from(firstEntry.byValues.values()).every(value => { + const type = getValueType(value); + return type === VALUE_TYPE_ATOM || type === VALUE_TYPE_DELETE; + }) + ) { + // = (first.base + second.base) + ((first.byProperty + second.base) + second.byProperty) + newBase = mergeSingleValue( + firstEntry.base, + secondEntry.base, + internalCaching + ); } else { - // module request - unresolved.set(request, config); + // = first.base + ((first.byProperty (+default) + second.base) + second.byProperty) + newBase = firstEntry.base; + if (!intermediateByValues.has("default")) + intermediateByValues.set("default", secondEntry.base); } - }) - ).then(() => { - compilation.contextDependencies.addAll(resolveContext.contextDependencies); - compilation.fileDependencies.addAll(resolveContext.fileDependencies); - compilation.missingDependencies.addAll(resolveContext.missingDependencies); - return { resolved, unresolved, prefixed }; - }); + if (!secondEntry.byProperty) { + // = first.base + (first.byProperty + second.base) + return { + base: newBase, + byProperty: firstEntry.byProperty, + byValues: intermediateByValues + }; + } else if (firstEntry.byProperty !== secondEntry.byProperty) { + throw new Error( + `${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported` + ); + } + const newByValues = new Map(intermediateByValues); + for (const [key, value] of secondEntry.byValues) { + const firstValue = getFromByValues(intermediateByValues, key); + newByValues.set( + key, + mergeSingleValue(firstValue, value, internalCaching) + ); + } + return { + base: newBase, + byProperty: firstEntry.byProperty, + byValues: newByValues + }; + } + } }; - -/***/ }), - -/***/ 84379: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { join, dirname, readJson } = __webpack_require__(17139); - -/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ - /** - * @param {string} str maybe required version - * @returns {boolean} true, if it looks like a version + * @param {Map} byValues all values + * @param {string} key value of the selector + * @returns {any | undefined} value */ -exports.isRequiredVersion = str => { - return /^([\d^=v<>~]|[*xX]$)/.test(str); +const getFromByValues = (byValues, key) => { + if (key !== "default" && byValues.has(key)) { + return byValues.get(key); + } + return byValues.get("default"); }; /** - * - * @param {InputFileSystem} fs file system - * @param {string} directory directory to start looking into - * @param {string[]} descriptionFiles possible description filenames - * @param {function((Error | null)=, {data: object, path: string}=): void} callback callback + * @param {any} a value + * @param {any} b value + * @param {boolean} internalCaching should parsing of objects and nested merges be cached + * @returns {any} value */ -const getDescriptionFile = (fs, directory, descriptionFiles, callback) => { - let i = 0; - const tryLoadCurrent = () => { - if (i >= descriptionFiles.length) { - const parentDirectory = dirname(fs, directory); - if (!parentDirectory || parentDirectory === directory) return callback(); - return getDescriptionFile( - fs, - parentDirectory, - descriptionFiles, - callback - ); +const mergeSingleValue = (a, b, internalCaching) => { + const bType = getValueType(b); + const aType = getValueType(a); + switch (bType) { + case VALUE_TYPE_DELETE: + case VALUE_TYPE_ATOM: + return b; + case VALUE_TYPE_OBJECT: { + return aType !== VALUE_TYPE_OBJECT + ? b + : internalCaching + ? cachedCleverMerge(a, b) + : cleverMerge(a, b); } - const filePath = join(fs, directory, descriptionFiles[i]); - readJson(fs, filePath, (err, data) => { - if (err) { - if ("code" in err && err.code === "ENOENT") { - i++; - return tryLoadCurrent(); + case VALUE_TYPE_UNDEFINED: + return a; + case VALUE_TYPE_ARRAY_EXTEND: + switch ( + aType !== VALUE_TYPE_ATOM + ? aType + : Array.isArray(a) + ? VALUE_TYPE_ARRAY_EXTEND + : VALUE_TYPE_OBJECT + ) { + case VALUE_TYPE_UNDEFINED: + return b; + case VALUE_TYPE_DELETE: + return b.filter(item => item !== "..."); + case VALUE_TYPE_ARRAY_EXTEND: { + const newArray = []; + for (const item of b) { + if (item === "...") { + for (const item of a) { + newArray.push(item); + } + } else { + newArray.push(item); + } + } + return newArray; } - return callback(err); - } - if (!data || typeof data !== "object" || Array.isArray(data)) { - return callback( - new Error(`Description file ${filePath} is not an object`) - ); + case VALUE_TYPE_OBJECT: + return b.map(item => (item === "..." ? a : item)); + default: + throw new Error("Not implemented"); } - callback(null, { data, path: filePath }); - }); - }; - tryLoadCurrent(); + default: + throw new Error("Not implemented"); + } }; -exports.getDescriptionFile = getDescriptionFile; -exports.getRequiredVersionFromDescriptionFile = (data, packageName) => { - if ( - data.optionalDependencies && - typeof data.optionalDependencies === "object" && - packageName in data.optionalDependencies - ) { - return data.optionalDependencies[packageName]; - } - if ( - data.dependencies && - typeof data.dependencies === "object" && - packageName in data.dependencies - ) { - return data.dependencies[packageName]; +/** + * @template T + * @param {T} obj the object + * @returns {T} the object without operations like "..." or DELETE + */ +const removeOperations = obj => { + const newObj = /** @type {T} */ ({}); + for (const key of Object.keys(obj)) { + const value = obj[key]; + const type = getValueType(value); + switch (type) { + case VALUE_TYPE_UNDEFINED: + case VALUE_TYPE_DELETE: + break; + case VALUE_TYPE_OBJECT: + newObj[key] = removeOperations(value); + break; + case VALUE_TYPE_ARRAY_EXTEND: + newObj[key] = value.filter(i => i !== "..."); + break; + default: + newObj[key] = value; + break; + } } - if ( - data.peerDependencies && - typeof data.peerDependencies === "object" && - packageName in data.peerDependencies - ) { - return data.peerDependencies[packageName]; + return newObj; +}; + +/** + * @template T + * @template {string} P + * @param {T} obj the object + * @param {P} byProperty the by description + * @param {...any} values values + * @returns {Omit} object with merged byProperty + */ +const resolveByProperty = (obj, byProperty, ...values) => { + if (typeof obj !== "object" || obj === null || !(byProperty in obj)) { + return obj; } - if ( - data.devDependencies && - typeof data.devDependencies === "object" && - packageName in data.devDependencies - ) { - return data.devDependencies[packageName]; + const { [byProperty]: _byValue, ..._remaining } = /** @type {object} */ (obj); + const remaining = /** @type {T} */ (_remaining); + const byValue = /** @type {Record | function(...any[]): T} */ ( + _byValue + ); + if (typeof byValue === "object") { + const key = values[0]; + if (key in byValue) { + return cachedCleverMerge(remaining, byValue[key]); + } else if ("default" in byValue) { + return cachedCleverMerge(remaining, byValue.default); + } else { + return /** @type {T} */ (remaining); + } + } else if (typeof byValue === "function") { + const result = byValue.apply(null, values); + return cachedCleverMerge( + remaining, + resolveByProperty(result, byProperty, ...values) + ); } }; +exports.cachedSetProperty = cachedSetProperty; +exports.cachedCleverMerge = cachedCleverMerge; +exports.cleverMerge = cleverMerge; +exports.resolveByProperty = resolveByProperty; +exports.removeOperations = removeOperations; +exports.DELETE = DELETE; + /***/ }), -/***/ 71760: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 29579: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -123820,2736 +124337,2976 @@ exports.getRequiredVersionFromDescriptionFile = (data, packageName) => { -const util = __webpack_require__(73837); -const ModuleDependency = __webpack_require__(80321); -const formatLocation = __webpack_require__(16734); -const { LogType } = __webpack_require__(32597); -const AggressiveSplittingPlugin = __webpack_require__(15543); -const SizeLimitsPlugin = __webpack_require__(32557); -const { countIterable } = __webpack_require__(39104); -const { - compareLocations, - compareChunksById, - compareNumbers, - compareIds, - concatComparators, - compareSelect, - compareModulesByIdentifier -} = __webpack_require__(29579); -const { makePathsRelative, parseResource } = __webpack_require__(82186); +const { compareRuntime } = __webpack_require__(17156); -/** @typedef {import("webpack-sources").Source} Source */ /** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ /** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../ChunkGroup").OriginRecord} OriginRecord */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Compilation").Asset} Asset */ -/** @typedef {import("../Compilation").AssetInfo} AssetInfo */ -/** @typedef {import("../Compilation").NormalizedStatsOptions} NormalizedStatsOptions */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Dependency")} Dependency */ /** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */ /** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ -/** @typedef {import("../ModuleProfile")} ModuleProfile */ -/** @typedef {import("../RequestShortener")} RequestShortener */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @template T @typedef {import("../util/comparators").Comparator} Comparator */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -/** @typedef {import("../util/smartGrouping").GroupConfig} GroupConfig */ -/** @typedef {import("./StatsFactory")} StatsFactory */ -/** @typedef {import("./StatsFactory").StatsFactoryContext} StatsFactoryContext */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ + +/** @template T @typedef {function(T, T): -1|0|1} Comparator */ +/** @template TArg @template T @typedef {function(TArg, T, T): -1|0|1} RawParameterizedComparator */ +/** @template TArg @template T @typedef {function(TArg): Comparator} ParameterizedComparator */ -/** @typedef {KnownStatsCompilation & Record} StatsCompilation */ /** - * @typedef {Object} KnownStatsCompilation - * @property {any=} env - * @property {string=} name - * @property {string=} hash - * @property {string=} version - * @property {number=} time - * @property {number=} builtAt - * @property {boolean=} needAdditionalPass - * @property {string=} publicPath - * @property {string=} outputPath - * @property {Record=} assetsByChunkName - * @property {StatsAsset[]=} assets - * @property {number=} filteredAssets - * @property {StatsChunk[]=} chunks - * @property {StatsModule[]=} modules - * @property {number=} filteredModules - * @property {Record=} entrypoints - * @property {Record=} namedChunkGroups - * @property {StatsError[]=} errors - * @property {number=} errorsCount - * @property {StatsError[]=} warnings - * @property {number=} warningsCount - * @property {StatsCompilation[]=} children - * @property {Record=} logging + * @template T + * @param {RawParameterizedComparator} fn comparator with argument + * @returns {ParameterizedComparator} comparator */ +const createCachedParameterizedComparator = fn => { + /** @type {WeakMap>} */ + const map = new WeakMap(); + return arg => { + const cachedResult = map.get(arg); + if (cachedResult !== undefined) return cachedResult; + /** + * @param {T} a first item + * @param {T} b second item + * @returns {-1|0|1} compare result + */ + const result = fn.bind(null, arg); + map.set(arg, result); + return result; + }; +}; -/** @typedef {KnownStatsLogging & Record} StatsLogging */ /** - * @typedef {Object} KnownStatsLogging - * @property {StatsLoggingEntry[]} entries - * @property {number} filteredEntries - * @property {boolean} debug + * @param {Chunk} a chunk + * @param {Chunk} b chunk + * @returns {-1|0|1} compare result */ +exports.compareChunksById = (a, b) => { + return compareIds(a.id, b.id); +}; -/** @typedef {KnownStatsLoggingEntry & Record} StatsLoggingEntry */ /** - * @typedef {Object} KnownStatsLoggingEntry - * @property {string} type - * @property {string} message - * @property {string[]=} trace - * @property {StatsLoggingEntry[]=} children - * @property {any[]=} args - * @property {number=} time + * @param {Module} a module + * @param {Module} b module + * @returns {-1|0|1} compare result */ +exports.compareModulesByIdentifier = (a, b) => { + return compareIds(a.identifier(), b.identifier()); +}; -/** @typedef {KnownStatsAsset & Record} StatsAsset */ /** - * @typedef {Object} KnownStatsAsset - * @property {string} type - * @property {string} name - * @property {AssetInfo} info - * @property {number} size - * @property {boolean} emitted - * @property {boolean} comparedForEmit - * @property {boolean} cached - * @property {StatsAsset[]=} related - * @property {(string|number)[]=} chunkNames - * @property {(string|number)[]=} chunkIdHints - * @property {(string|number)[]=} chunks - * @property {(string|number)[]=} auxiliaryChunkNames - * @property {(string|number)[]=} auxiliaryChunks - * @property {(string|number)[]=} auxiliaryChunkIdHints - * @property {number=} filteredRelated - * @property {boolean=} isOverSizeLimit + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {Module} a module + * @param {Module} b module + * @returns {-1|0|1} compare result */ +const compareModulesById = (chunkGraph, a, b) => { + return compareIds(chunkGraph.getModuleId(a), chunkGraph.getModuleId(b)); +}; +/** @type {ParameterizedComparator} */ +exports.compareModulesById = + createCachedParameterizedComparator(compareModulesById); -/** @typedef {KnownStatsChunkGroup & Record} StatsChunkGroup */ /** - * @typedef {Object} KnownStatsChunkGroup - * @property {string=} name - * @property {(string|number)[]=} chunks - * @property {({ name: string, size?: number })[]=} assets - * @property {number=} filteredAssets - * @property {number=} assetsSize - * @property {({ name: string, size?: number })[]=} auxiliaryAssets - * @property {number=} filteredAuxiliaryAssets - * @property {number=} auxiliaryAssetsSize - * @property {{ [x: string]: StatsChunkGroup[] }=} children - * @property {{ [x: string]: string[] }=} childAssets - * @property {boolean=} isOverSizeLimit + * @param {number} a number + * @param {number} b number + * @returns {-1|0|1} compare result */ +const compareNumbers = (a, b) => { + if (typeof a !== typeof b) { + return typeof a < typeof b ? -1 : 1; + } + if (a < b) return -1; + if (a > b) return 1; + return 0; +}; +exports.compareNumbers = compareNumbers; -/** @typedef {KnownStatsModule & Record} StatsModule */ /** - * @typedef {Object} KnownStatsModule - * @property {string=} type - * @property {string=} moduleType - * @property {string=} layer - * @property {string=} identifier - * @property {string=} name - * @property {string=} nameForCondition - * @property {number=} index - * @property {number=} preOrderIndex - * @property {number=} index2 - * @property {number=} postOrderIndex - * @property {number=} size - * @property {{[x: string]: number}=} sizes - * @property {boolean=} cacheable - * @property {boolean=} built - * @property {boolean=} codeGenerated - * @property {boolean=} buildTimeExecuted - * @property {boolean=} cached - * @property {boolean=} optional - * @property {boolean=} orphan - * @property {string|number=} id - * @property {string|number=} issuerId - * @property {(string|number)[]=} chunks - * @property {(string|number)[]=} assets - * @property {boolean=} dependent - * @property {string=} issuer - * @property {string=} issuerName - * @property {StatsModuleIssuer[]=} issuerPath - * @property {boolean=} failed - * @property {number=} errors - * @property {number=} warnings - * @property {StatsProfile=} profile - * @property {StatsModuleReason[]=} reasons - * @property {(boolean | string[])=} usedExports - * @property {string[]=} providedExports - * @property {string[]=} optimizationBailout - * @property {number=} depth - * @property {StatsModule[]=} modules - * @property {number=} filteredModules - * @property {ReturnType=} source + * @param {string} a string + * @param {string} b string + * @returns {-1|0|1} compare result + */ +const compareStringsNumeric = (a, b) => { + const partsA = a.split(/(\d+)/); + const partsB = b.split(/(\d+)/); + const len = Math.min(partsA.length, partsB.length); + for (let i = 0; i < len; i++) { + const pA = partsA[i]; + const pB = partsB[i]; + if (i % 2 === 0) { + if (pA.length > pB.length) { + if (pA.slice(0, pB.length) > pB) return 1; + return -1; + } else if (pB.length > pA.length) { + if (pB.slice(0, pA.length) > pA) return -1; + return 1; + } else { + if (pA < pB) return -1; + if (pA > pB) return 1; + } + } else { + const nA = +pA; + const nB = +pB; + if (nA < nB) return -1; + if (nA > nB) return 1; + } + } + if (partsB.length < partsA.length) return 1; + if (partsB.length > partsA.length) return -1; + return 0; +}; +exports.compareStringsNumeric = compareStringsNumeric; + +/** + * @param {ModuleGraph} moduleGraph the module graph + * @param {Module} a module + * @param {Module} b module + * @returns {-1|0|1} compare result */ +const compareModulesByPostOrderIndexOrIdentifier = (moduleGraph, a, b) => { + const cmp = compareNumbers( + moduleGraph.getPostOrderIndex(a), + moduleGraph.getPostOrderIndex(b) + ); + if (cmp !== 0) return cmp; + return compareIds(a.identifier(), b.identifier()); +}; +/** @type {ParameterizedComparator} */ +exports.compareModulesByPostOrderIndexOrIdentifier = + createCachedParameterizedComparator( + compareModulesByPostOrderIndexOrIdentifier + ); -/** @typedef {KnownStatsProfile & Record} StatsProfile */ /** - * @typedef {Object} KnownStatsProfile - * @property {number} total - * @property {number} resolving - * @property {number} restoring - * @property {number} building - * @property {number} integration - * @property {number} storing - * @property {number} additionalResolving - * @property {number} additionalIntegration - * @property {number} factory - * @property {number} dependencies + * @param {ModuleGraph} moduleGraph the module graph + * @param {Module} a module + * @param {Module} b module + * @returns {-1|0|1} compare result */ +const compareModulesByPreOrderIndexOrIdentifier = (moduleGraph, a, b) => { + const cmp = compareNumbers( + moduleGraph.getPreOrderIndex(a), + moduleGraph.getPreOrderIndex(b) + ); + if (cmp !== 0) return cmp; + return compareIds(a.identifier(), b.identifier()); +}; +/** @type {ParameterizedComparator} */ +exports.compareModulesByPreOrderIndexOrIdentifier = + createCachedParameterizedComparator( + compareModulesByPreOrderIndexOrIdentifier + ); -/** @typedef {KnownStatsModuleIssuer & Record} StatsModuleIssuer */ /** - * @typedef {Object} KnownStatsModuleIssuer - * @property {string=} identifier - * @property {string=} name - * @property {(string|number)=} id - * @property {StatsProfile=} profile + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {Module} a module + * @param {Module} b module + * @returns {-1|0|1} compare result */ +const compareModulesByIdOrIdentifier = (chunkGraph, a, b) => { + const cmp = compareIds(chunkGraph.getModuleId(a), chunkGraph.getModuleId(b)); + if (cmp !== 0) return cmp; + return compareIds(a.identifier(), b.identifier()); +}; +/** @type {ParameterizedComparator} */ +exports.compareModulesByIdOrIdentifier = createCachedParameterizedComparator( + compareModulesByIdOrIdentifier +); -/** @typedef {KnownStatsModuleReason & Record} StatsModuleReason */ /** - * @typedef {Object} KnownStatsModuleReason - * @property {string=} moduleIdentifier - * @property {string=} module - * @property {string=} moduleName - * @property {string=} resolvedModuleIdentifier - * @property {string=} resolvedModule - * @property {string=} type - * @property {boolean} active - * @property {string=} explanation - * @property {string=} userRequest - * @property {string=} loc - * @property {(string|number)=} moduleId - * @property {(string|number)=} resolvedModuleId + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {Chunk} a chunk + * @param {Chunk} b chunk + * @returns {-1|0|1} compare result */ +const compareChunks = (chunkGraph, a, b) => { + return chunkGraph.compareChunks(a, b); +}; +/** @type {ParameterizedComparator} */ +exports.compareChunks = createCachedParameterizedComparator(compareChunks); -/** @typedef {KnownStatsChunk & Record} StatsChunk */ /** - * @typedef {Object} KnownStatsChunk - * @property {boolean} rendered - * @property {boolean} initial - * @property {boolean} entry - * @property {boolean} recorded - * @property {string=} reason - * @property {number} size - * @property {Record=} sizes - * @property {string[]=} names - * @property {string[]=} idHints - * @property {string[]=} runtime - * @property {string[]=} files - * @property {string[]=} auxiliaryFiles - * @property {string} hash - * @property {Record=} childrenByOrder - * @property {(string|number)=} id - * @property {(string|number)[]=} siblings - * @property {(string|number)[]=} parents - * @property {(string|number)[]=} children - * @property {StatsModule[]=} modules - * @property {number=} filteredModules - * @property {StatsChunkOrigin[]=} origins + * @param {string|number} a first id + * @param {string|number} b second id + * @returns {-1|0|1} compare result */ +const compareIds = (a, b) => { + if (typeof a !== typeof b) { + return typeof a < typeof b ? -1 : 1; + } + if (a < b) return -1; + if (a > b) return 1; + return 0; +}; + +exports.compareIds = compareIds; -/** @typedef {KnownStatsChunkOrigin & Record} StatsChunkOrigin */ /** - * @typedef {Object} KnownStatsChunkOrigin - * @property {string=} module - * @property {string=} moduleIdentifier - * @property {string=} moduleName - * @property {string=} loc - * @property {string=} request - * @property {(string|number)=} moduleId + * @param {string} a first string + * @param {string} b second string + * @returns {-1|0|1} compare result */ +const compareStrings = (a, b) => { + if (a < b) return -1; + if (a > b) return 1; + return 0; +}; + +exports.compareStrings = compareStrings; -/** @typedef {KnownStatsModuleTraceItem & Record} StatsModuleTraceItem */ /** - * @typedef {Object} KnownStatsModuleTraceItem - * @property {string=} originIdentifier - * @property {string=} originName - * @property {string=} moduleIdentifier - * @property {string=} moduleName - * @property {StatsModuleTraceDependency[]=} dependencies - * @property {(string|number)=} originId - * @property {(string|number)=} moduleId + * @param {ChunkGroup} a first chunk group + * @param {ChunkGroup} b second chunk group + * @returns {-1|0|1} compare result */ +const compareChunkGroupsByIndex = (a, b) => { + return a.index < b.index ? -1 : 1; +}; + +exports.compareChunkGroupsByIndex = compareChunkGroupsByIndex; -/** @typedef {KnownStatsModuleTraceDependency & Record} StatsModuleTraceDependency */ /** - * @typedef {Object} KnownStatsModuleTraceDependency - * @property {string=} loc + * @template K1 {Object} + * @template K2 + * @template T */ +class TwoKeyWeakMap { + constructor() { + /** @private @type {WeakMap>} */ + this._map = new WeakMap(); + } + + /** + * @param {K1} key1 first key + * @param {K2} key2 second key + * @returns {T | undefined} value + */ + get(key1, key2) { + const childMap = this._map.get(key1); + if (childMap === undefined) { + return undefined; + } + return childMap.get(key2); + } + + /** + * @param {K1} key1 first key + * @param {K2} key2 second key + * @param {T | undefined} value new value + * @returns {void} + */ + set(key1, key2, value) { + let childMap = this._map.get(key1); + if (childMap === undefined) { + childMap = new WeakMap(); + this._map.set(key1, childMap); + } + childMap.set(key2, value); + } +} + +/** @type {TwoKeyWeakMap, Comparator, Comparator>}} */ +const concatComparatorsCache = new TwoKeyWeakMap(); -/** @typedef {KnownStatsError & Record} StatsError */ /** - * @typedef {Object} KnownStatsError - * @property {string} message - * @property {string=} chunkName - * @property {boolean=} chunkEntry - * @property {boolean=} chunkInitial - * @property {string=} file - * @property {string=} moduleIdentifier - * @property {string=} moduleName - * @property {string=} loc - * @property {string|number=} chunkId - * @property {string|number=} moduleId - * @property {StatsModuleTraceItem[]=} moduleTrace - * @property {any=} details - * @property {string=} stack + * @template T + * @param {Comparator} c1 comparator + * @param {Comparator} c2 comparator + * @param {Comparator[]} cRest comparators + * @returns {Comparator} comparator */ +const concatComparators = (c1, c2, ...cRest) => { + if (cRest.length > 0) { + const [c3, ...cRest2] = cRest; + return concatComparators(c1, concatComparators(c2, c3, ...cRest2)); + } + const cacheEntry = /** @type {Comparator} */ ( + concatComparatorsCache.get(c1, c2) + ); + if (cacheEntry !== undefined) return cacheEntry; + /** + * @param {T} a first value + * @param {T} b second value + * @returns {-1|0|1} compare result + */ + const result = (a, b) => { + const res = c1(a, b); + if (res !== 0) return res; + return c2(a, b); + }; + concatComparatorsCache.set(c1, c2, result); + return result; +}; +exports.concatComparators = concatComparators; + +/** @template A, B @typedef {(input: A) => B} Selector */ -/** @typedef {Asset & { type: string, related: PreprocessedAsset[] }} PreprocessedAsset */ +/** @type {TwoKeyWeakMap, Comparator, Comparator>}} */ +const compareSelectCache = new TwoKeyWeakMap(); /** * @template T - * @template O - * @typedef {Record void>} ExtractorsByOption + * @template R + * @param {Selector} getter getter for value + * @param {Comparator} comparator comparator + * @returns {Comparator} comparator */ +const compareSelect = (getter, comparator) => { + const cacheEntry = compareSelectCache.get(getter, comparator); + if (cacheEntry !== undefined) return cacheEntry; + /** + * @param {T} a first value + * @param {T} b second value + * @returns {-1|0|1} compare result + */ + const result = (a, b) => { + const aValue = getter(a); + const bValue = getter(b); + if (aValue !== undefined && aValue !== null) { + if (bValue !== undefined && bValue !== null) { + return comparator(aValue, bValue); + } + return -1; + } else { + if (bValue !== undefined && bValue !== null) { + return 1; + } + return 0; + } + }; + compareSelectCache.set(getter, comparator, result); + return result; +}; +exports.compareSelect = compareSelect; -/** - * @typedef {Object} SimpleExtractors - * @property {ExtractorsByOption} compilation - * @property {ExtractorsByOption} asset - * @property {ExtractorsByOption} asset$visible - * @property {ExtractorsByOption<{ name: string, chunkGroup: ChunkGroup }, StatsChunkGroup>} chunkGroup - * @property {ExtractorsByOption} module - * @property {ExtractorsByOption} module$visible - * @property {ExtractorsByOption} moduleIssuer - * @property {ExtractorsByOption} profile - * @property {ExtractorsByOption} moduleReason - * @property {ExtractorsByOption} chunk - * @property {ExtractorsByOption} chunkOrigin - * @property {ExtractorsByOption} error - * @property {ExtractorsByOption} warning - * @property {ExtractorsByOption<{ origin: Module, module: Module }, StatsModuleTraceItem>} moduleTraceItem - * @property {ExtractorsByOption} moduleTraceDependency - */ +/** @type {WeakMap, Comparator>>} */ +const compareIteratorsCache = new WeakMap(); /** * @template T - * @template I - * @param {Iterable} items items to select from - * @param {function(T): Iterable} selector selector function to select values from item - * @returns {I[]} array of values + * @param {Comparator} elementComparator comparator for elements + * @returns {Comparator>} comparator for iterables of elements */ -const uniqueArray = (items, selector) => { - /** @type {Set} */ - const set = new Set(); - for (const item of items) { - for (const i of selector(item)) { - set.add(i); +const compareIterables = elementComparator => { + const cacheEntry = compareIteratorsCache.get(elementComparator); + if (cacheEntry !== undefined) return cacheEntry; + /** + * @param {Iterable} a first value + * @param {Iterable} b second value + * @returns {-1|0|1} compare result + */ + const result = (a, b) => { + const aI = a[Symbol.iterator](); + const bI = b[Symbol.iterator](); + // eslint-disable-next-line no-constant-condition + while (true) { + const aItem = aI.next(); + const bItem = bI.next(); + if (aItem.done) { + return bItem.done ? 0 : -1; + } else if (bItem.done) { + return 1; + } + const res = elementComparator(aItem.value, bItem.value); + if (res !== 0) return res; } - } - return Array.from(set); + }; + compareIteratorsCache.set(elementComparator, result); + return result; }; +exports.compareIterables = compareIterables; +// TODO this is no longer needed when minimum node.js version is >= 12 +// since these versions ship with a stable sort function /** * @template T - * @template I - * @param {Iterable} items items to select from - * @param {function(T): Iterable} selector selector function to select values from item - * @param {Comparator} comparator comparator function - * @returns {I[]} array of values + * @param {Iterable} iterable original ordered list + * @returns {Comparator} comparator */ -const uniqueOrderedArray = (items, selector, comparator) => { - return uniqueArray(items, selector).sort(comparator); +exports.keepOriginalOrder = iterable => { + /** @type {Map} */ + const map = new Map(); + let i = 0; + for (const item of iterable) { + map.set(item, i++); + } + return (a, b) => compareNumbers(map.get(a), map.get(b)); }; -/** @template T @template R @typedef {{ [P in keyof T]: R }} MappedValues */ +/** + * @param {ChunkGraph} chunkGraph the chunk graph + * @returns {Comparator} comparator + */ +exports.compareChunksNatural = chunkGraph => { + const cmpFn = exports.compareModulesById(chunkGraph); + const cmpIterableFn = compareIterables(cmpFn); + return concatComparators( + compareSelect(chunk => chunk.name, compareIds), + compareSelect(chunk => chunk.runtime, compareRuntime), + compareSelect( + /** + * @param {Chunk} chunk a chunk + * @returns {Iterable} modules + */ + chunk => chunkGraph.getOrderedChunkModulesIterable(chunk, cmpFn), + cmpIterableFn + ) + ); +}; /** - * @template T - * @template R - * @param {T} obj object to be mapped - * @param {function(T[keyof T], keyof T): R} fn mapping function - * @returns {MappedValues} mapped object + * Compare two locations + * @param {DependencyLocation} a A location node + * @param {DependencyLocation} b A location node + * @returns {-1|0|1} sorting comparator value */ -const mapObject = (obj, fn) => { - const newObj = Object.create(null); - for (const key of Object.keys(obj)) { - newObj[key] = fn(obj[key], /** @type {keyof T} */ (key)); +exports.compareLocations = (a, b) => { + let isObjectA = typeof a === "object" && a !== null; + let isObjectB = typeof b === "object" && b !== null; + if (!isObjectA || !isObjectB) { + if (isObjectA) return 1; + if (isObjectB) return -1; + return 0; } - return newObj; + if ("start" in a) { + if ("start" in b) { + const ap = a.start; + const bp = b.start; + if (ap.line < bp.line) return -1; + if (ap.line > bp.line) return 1; + if (ap.column < bp.column) return -1; + if (ap.column > bp.column) return 1; + } else return -1; + } else if ("start" in b) return 1; + if ("name" in a) { + if ("name" in b) { + if (a.name < b.name) return -1; + if (a.name > b.name) return 1; + } else return -1; + } else if ("name" in b) return 1; + if ("index" in a) { + if ("index" in b) { + if (a.index < b.index) return -1; + if (a.index > b.index) return 1; + } else return -1; + } else if ("index" in b) return 1; + return 0; +}; + + +/***/ }), + +/***/ 29404: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const quoteMeta = str => { + return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); +}; + +const toSimpleString = str => { + if (`${+str}` === str) { + return str; + } + return JSON.stringify(str); }; /** - * @param {Compilation} compilation the compilation - * @param {function(Compilation, string): any[]} getItems get items - * @returns {number} total number + * @param {Record} map value map + * @returns {boolean|(function(string): string)} true/false, when unconditionally true/false, or a template function to determine the value at runtime */ -const countWithChildren = (compilation, getItems) => { - let count = getItems(compilation, "").length; - for (const child of compilation.children) { - count += countWithChildren(child, (c, type) => - getItems(c, `.children[].compilation${type}`) - ); +const compileBooleanMatcher = map => { + const positiveItems = Object.keys(map).filter(i => map[i]); + const negativeItems = Object.keys(map).filter(i => !map[i]); + if (positiveItems.length === 0) return false; + if (negativeItems.length === 0) return true; + return compileBooleanMatcherFromLists(positiveItems, negativeItems); +}; + +/** + * @param {string[]} positiveItems positive items + * @param {string[]} negativeItems negative items + * @returns {function(string): string} a template function to determine the value at runtime + */ +const compileBooleanMatcherFromLists = (positiveItems, negativeItems) => { + if (positiveItems.length === 0) return () => "false"; + if (negativeItems.length === 0) return () => "true"; + if (positiveItems.length === 1) + return value => `${toSimpleString(positiveItems[0])} == ${value}`; + if (negativeItems.length === 1) + return value => `${toSimpleString(negativeItems[0])} != ${value}`; + const positiveRegexp = itemsToRegexp(positiveItems); + const negativeRegexp = itemsToRegexp(negativeItems); + if (positiveRegexp.length <= negativeRegexp.length) { + return value => `/^${positiveRegexp}$/.test(${value})`; + } else { + return value => `!/^${negativeRegexp}$/.test(${value})`; } - return count; }; -/** @type {ExtractorsByOption} */ -const EXTRACT_ERROR = { - _: (object, error, context, { requestShortener }) => { - // TODO webpack 6 disallow strings in the errors/warnings list - if (typeof error === "string") { - object.message = error; - } else { - if (error.chunk) { - object.chunkName = error.chunk.name; - object.chunkEntry = error.chunk.hasRuntime(); - object.chunkInitial = error.chunk.canBeInitial(); - } - if (error.file) { - object.file = error.file; +const popCommonItems = (itemsSet, getKey, condition) => { + const map = new Map(); + for (const item of itemsSet) { + const key = getKey(item); + if (key) { + let list = map.get(key); + if (list === undefined) { + list = []; + map.set(key, list); } - if (error.module) { - object.moduleIdentifier = error.module.identifier(); - object.moduleName = error.module.readableIdentifier(requestShortener); + list.push(item); + } + } + const result = []; + for (const list of map.values()) { + if (condition(list)) { + for (const item of list) { + itemsSet.delete(item); } - if (error.loc) { - object.loc = formatLocation(error.loc); + result.push(list); + } + } + return result; +}; + +const getCommonPrefix = items => { + let prefix = items[0]; + for (let i = 1; i < items.length; i++) { + const item = items[i]; + for (let p = 0; p < prefix.length; p++) { + if (item[p] !== prefix[p]) { + prefix = prefix.slice(0, p); + break; } - object.message = error.message; } - }, - ids: (object, error, { compilation: { chunkGraph } }) => { - if (typeof error !== "string") { - if (error.chunk) { - object.chunkId = error.chunk.id; + } + return prefix; +}; + +const getCommonSuffix = items => { + let suffix = items[0]; + for (let i = 1; i < items.length; i++) { + const item = items[i]; + for (let p = item.length - 1, s = suffix.length - 1; s >= 0; p--, s--) { + if (item[p] !== suffix[s]) { + suffix = suffix.slice(s + 1); + break; } - if (error.module) { - object.moduleId = chunkGraph.getModuleId(error.module); + } + } + return suffix; +}; + +const itemsToRegexp = itemsArr => { + if (itemsArr.length === 1) { + return quoteMeta(itemsArr[0]); + } + const finishedItems = []; + + // merge single char items: (a|b|c|d|ef) => ([abcd]|ef) + let countOfSingleCharItems = 0; + for (const item of itemsArr) { + if (item.length === 1) { + countOfSingleCharItems++; + } + } + // special case for only single char items + if (countOfSingleCharItems === itemsArr.length) { + return `[${quoteMeta(itemsArr.sort().join(""))}]`; + } + const items = new Set(itemsArr.sort()); + if (countOfSingleCharItems > 2) { + let singleCharItems = ""; + for (const item of items) { + if (item.length === 1) { + singleCharItems += item; + items.delete(item); } } - }, - moduleTrace: (object, error, context, options, factory) => { - if (typeof error !== "string" && error.module) { - const { - type, - compilation: { moduleGraph } - } = context; - /** @type {Set} */ - const visitedModules = new Set(); - const moduleTrace = []; - let current = error.module; - while (current) { - if (visitedModules.has(current)) break; // circular (technically impossible, but how knows) - visitedModules.add(current); - const origin = moduleGraph.getIssuer(current); - if (!origin) break; - moduleTrace.push({ origin, module: current }); - current = origin; + finishedItems.push(`[${quoteMeta(singleCharItems)}]`); + } + + // special case for 2 items with common prefix/suffix + if (finishedItems.length === 0 && items.size === 2) { + const prefix = getCommonPrefix(itemsArr); + const suffix = getCommonSuffix( + itemsArr.map(item => item.slice(prefix.length)) + ); + if (prefix.length > 0 || suffix.length > 0) { + return `${quoteMeta(prefix)}${itemsToRegexp( + itemsArr.map(i => i.slice(prefix.length, -suffix.length || undefined)) + )}${quoteMeta(suffix)}`; + } + } + + // special case for 2 items with common suffix + if (finishedItems.length === 0 && items.size === 2) { + const it = items[Symbol.iterator](); + const a = it.next().value; + const b = it.next().value; + if (a.length > 0 && b.length > 0 && a.slice(-1) === b.slice(-1)) { + return `${itemsToRegexp([a.slice(0, -1), b.slice(0, -1)])}${quoteMeta( + a.slice(-1) + )}`; + } + } + + // find common prefix: (a1|a2|a3|a4|b5) => (a(1|2|3|4)|b5) + const prefixed = popCommonItems( + items, + item => (item.length >= 1 ? item[0] : false), + list => { + if (list.length >= 3) return true; + if (list.length <= 1) return false; + return list[0][1] === list[1][1]; + } + ); + for (const prefixedItems of prefixed) { + const prefix = getCommonPrefix(prefixedItems); + finishedItems.push( + `${quoteMeta(prefix)}${itemsToRegexp( + prefixedItems.map(i => i.slice(prefix.length)) + )}` + ); + } + + // find common suffix: (a1|b1|c1|d1|e2) => ((a|b|c|d)1|e2) + const suffixed = popCommonItems( + items, + item => (item.length >= 1 ? item.slice(-1) : false), + list => { + if (list.length >= 3) return true; + if (list.length <= 1) return false; + return list[0].slice(-2) === list[1].slice(-2); + } + ); + for (const suffixedItems of suffixed) { + const suffix = getCommonSuffix(suffixedItems); + finishedItems.push( + `${itemsToRegexp( + suffixedItems.map(i => i.slice(0, -suffix.length)) + )}${quoteMeta(suffix)}` + ); + } + + // TODO further optimize regexp, i. e. + // use ranges: (1|2|3|4|a) => [1-4a] + const conditional = finishedItems.concat(Array.from(items, quoteMeta)); + if (conditional.length === 1) return conditional[0]; + return `(${conditional.join("|")})`; +}; + +compileBooleanMatcher.fromLists = compileBooleanMatcherFromLists; +compileBooleanMatcher.itemsToRegexp = itemsToRegexp; +module.exports = compileBooleanMatcher; + + +/***/ }), + +/***/ 32540: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const memoize = __webpack_require__(78676); + +const getValidate = memoize(() => (__webpack_require__(38476).validate)); + +const createSchemaValidation = (check, getSchema, options) => { + getSchema = memoize(getSchema); + return value => { + if (check && !check(value)) { + getValidate()(getSchema(), value, options); + if (check) { + (__webpack_require__(73837).deprecate)( + () => {}, + "webpack bug: Pre-compiled schema reports error while real schema is happy. This has performance drawbacks.", + "DEP_WEBPACK_PRE_COMPILED_SCHEMA_INVALID" + )(); } - object.moduleTrace = factory.create( - `${type}.moduleTrace`, - moduleTrace, - context - ); } - }, - errorDetails: ( - object, - error, - { type, compilation, cachedGetErrors, cachedGetWarnings }, - { errorDetails } - ) => { + }; +}; + +module.exports = createSchemaValidation; + + +/***/ }), + +/***/ 49835: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const Hash = __webpack_require__(36692); + +const BULK_SIZE = 2000; + +// We are using an object instead of a Map as this will stay static during the runtime +// so access to it can be optimized by v8 +const digestCaches = {}; + +class BulkUpdateDecorator extends Hash { + /** + * @param {Hash | function(): Hash} hashOrFactory function to create a hash + * @param {string=} hashKey key for caching + */ + constructor(hashOrFactory, hashKey) { + super(); + this.hashKey = hashKey; + if (typeof hashOrFactory === "function") { + this.hashFactory = hashOrFactory; + this.hash = undefined; + } else { + this.hashFactory = undefined; + this.hash = hashOrFactory; + } + this.buffer = ""; + } + + /** + * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} + * @param {string|Buffer} data data + * @param {string=} inputEncoding data encoding + * @returns {this} updated hash + */ + update(data, inputEncoding) { if ( - typeof error !== "string" && - (errorDetails === true || - (type.endsWith(".error") && cachedGetErrors(compilation).length < 3)) + inputEncoding !== undefined || + typeof data !== "string" || + data.length > BULK_SIZE ) { - object.details = error.details; - } - }, - errorStack: (object, error) => { - if (typeof error !== "string") { - object.stack = error.stack; + if (this.hash === undefined) this.hash = this.hashFactory(); + if (this.buffer.length > 0) { + this.hash.update(this.buffer); + this.buffer = ""; + } + this.hash.update(data, inputEncoding); + } else { + this.buffer += data; + if (this.buffer.length > BULK_SIZE) { + if (this.hash === undefined) this.hash = this.hashFactory(); + this.hash.update(this.buffer); + this.buffer = ""; + } } + return this; } -}; -/** @type {SimpleExtractors} */ -const SIMPLE_EXTRACTORS = { - compilation: { - _: (object, compilation, context, options) => { - if (!context.makePathsRelative) { - context.makePathsRelative = makePathsRelative.bindContextCache( - compilation.compiler.context, - compilation.compiler.root - ); - } - if (!context.cachedGetErrors) { - const map = new WeakMap(); - context.cachedGetErrors = compilation => { - return ( - map.get(compilation) || - (errors => (map.set(compilation, errors), errors))( - compilation.getErrors() - ) - ); - }; - } - if (!context.cachedGetWarnings) { - const map = new WeakMap(); - context.cachedGetWarnings = compilation => { - return ( - map.get(compilation) || - (warnings => (map.set(compilation, warnings), warnings))( - compilation.getWarnings() - ) - ); - }; - } - if (compilation.name) { - object.name = compilation.name; - } - if (compilation.needAdditionalPass) { - object.needAdditionalPass = true; + /** + * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} + * @param {string=} encoding encoding of the return value + * @returns {string|Buffer} digest + */ + digest(encoding) { + let digestCache; + const buffer = this.buffer; + if (this.hash === undefined) { + // short data for hash, we can use caching + const cacheKey = `${this.hashKey}-${encoding}`; + digestCache = digestCaches[cacheKey]; + if (digestCache === undefined) { + digestCache = digestCaches[cacheKey] = new Map(); } + const cacheEntry = digestCache.get(buffer); + if (cacheEntry !== undefined) return cacheEntry; + this.hash = this.hashFactory(); + } + if (buffer.length > 0) { + this.hash.update(buffer); + } + const digestResult = this.hash.digest(encoding); + const result = + typeof digestResult === "string" ? digestResult : digestResult.toString(); + if (digestCache !== undefined) { + digestCache.set(buffer, result); + } + return result; + } +} - const { logging, loggingDebug, loggingTrace } = options; - if (logging || (loggingDebug && loggingDebug.length > 0)) { - const util = __webpack_require__(73837); - object.logging = {}; - let acceptedTypes; - let collapsedGroups = false; - switch (logging) { - default: - acceptedTypes = new Set(); - break; - case "error": - acceptedTypes = new Set([LogType.error]); - break; - case "warn": - acceptedTypes = new Set([LogType.error, LogType.warn]); - break; - case "info": - acceptedTypes = new Set([ - LogType.error, - LogType.warn, - LogType.info - ]); - break; - case "log": - acceptedTypes = new Set([ - LogType.error, - LogType.warn, - LogType.info, - LogType.log, - LogType.group, - LogType.groupEnd, - LogType.groupCollapsed, - LogType.clear - ]); - break; - case "verbose": - acceptedTypes = new Set([ - LogType.error, - LogType.warn, - LogType.info, - LogType.log, - LogType.group, - LogType.groupEnd, - LogType.groupCollapsed, - LogType.profile, - LogType.profileEnd, - LogType.time, - LogType.status, - LogType.clear - ]); - collapsedGroups = true; - break; - } - const cachedMakePathsRelative = makePathsRelative.bindContextCache( - options.context, - compilation.compiler.root - ); - let depthInCollapsedGroup = 0; - for (const [origin, logEntries] of compilation.logging) { - const debugMode = loggingDebug.some(fn => fn(origin)); - if (logging === false && !debugMode) continue; - /** @type {KnownStatsLoggingEntry[]} */ - const groupStack = []; - /** @type {KnownStatsLoggingEntry[]} */ - const rootList = []; - let currentList = rootList; - let processedLogEntries = 0; - for (const entry of logEntries) { - let type = entry.type; - if (!debugMode && !acceptedTypes.has(type)) continue; - - // Expand groups in verbose and debug modes - if ( - type === LogType.groupCollapsed && - (debugMode || collapsedGroups) - ) - type = LogType.group; - - if (depthInCollapsedGroup === 0) { - processedLogEntries++; - } +/* istanbul ignore next */ +class DebugHash extends Hash { + constructor() { + super(); + this.string = ""; + } - if (type === LogType.groupEnd) { - groupStack.pop(); - if (groupStack.length > 0) { - currentList = groupStack[groupStack.length - 1].children; - } else { - currentList = rootList; - } - if (depthInCollapsedGroup > 0) depthInCollapsedGroup--; - continue; - } - let message = undefined; - if (entry.type === LogType.time) { - message = `${entry.args[0]}: ${ - entry.args[1] * 1000 + entry.args[2] / 1000000 - } ms`; - } else if (entry.args && entry.args.length > 0) { - message = util.format(entry.args[0], ...entry.args.slice(1)); - } - /** @type {KnownStatsLoggingEntry} */ - const newEntry = { - ...entry, - type, - message, - trace: loggingTrace ? entry.trace : undefined, - children: - type === LogType.group || type === LogType.groupCollapsed - ? [] - : undefined - }; - currentList.push(newEntry); - if (newEntry.children) { - groupStack.push(newEntry); - currentList = newEntry.children; - if (depthInCollapsedGroup > 0) { - depthInCollapsedGroup++; - } else if (type === LogType.groupCollapsed) { - depthInCollapsedGroup = 1; - } - } - } - let name = cachedMakePathsRelative(origin).replace(/\|/g, " "); - if (name in object.logging) { - let i = 1; - while (`${name}#${i}` in object.logging) { - i++; - } - name = `${name}#${i}`; - } - object.logging[name] = { - entries: rootList, - filteredEntries: logEntries.length - processedLogEntries, - debug: debugMode - }; - } - } - }, - hash: (object, compilation) => { - object.hash = compilation.hash; - }, - version: object => { - object.version = (__webpack_require__(32702)/* .version */ .i8); - }, - env: (object, compilation, context, { _env }) => { - object.env = _env; - }, - timings: (object, compilation) => { - object.time = compilation.endTime - compilation.startTime; - }, - builtAt: (object, compilation) => { - object.builtAt = compilation.endTime; - }, - publicPath: (object, compilation) => { - object.publicPath = compilation.getPath( - compilation.outputOptions.publicPath - ); - }, - outputPath: (object, compilation) => { - object.outputPath = compilation.outputOptions.path; - }, - assets: (object, compilation, context, options, factory) => { - const { type } = context; - /** @type {Map} */ - const compilationFileToChunks = new Map(); - /** @type {Map} */ - const compilationAuxiliaryFileToChunks = new Map(); - for (const chunk of compilation.chunks) { - for (const file of chunk.files) { - let array = compilationFileToChunks.get(file); - if (array === undefined) { - array = []; - compilationFileToChunks.set(file, array); - } - array.push(chunk); - } - for (const file of chunk.auxiliaryFiles) { - let array = compilationAuxiliaryFileToChunks.get(file); - if (array === undefined) { - array = []; - compilationAuxiliaryFileToChunks.set(file, array); - } - array.push(chunk); - } - } - /** @type {Map} */ - const assetMap = new Map(); - /** @type {Set} */ - const assets = new Set(); - for (const asset of compilation.getAssets()) { - /** @type {PreprocessedAsset} */ - const item = { - ...asset, - type: "asset", - related: undefined - }; - assets.add(item); - assetMap.set(asset.name, item); - } - for (const item of assetMap.values()) { - const related = item.info.related; - if (!related) continue; - for (const type of Object.keys(related)) { - const relatedEntry = related[type]; - const deps = Array.isArray(relatedEntry) - ? relatedEntry - : [relatedEntry]; - for (const dep of deps) { - const depItem = assetMap.get(dep); - if (!depItem) continue; - assets.delete(depItem); - depItem.type = type; - item.related = item.related || []; - item.related.push(depItem); - } - } - } + /** + * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} + * @param {string|Buffer} data data + * @param {string=} inputEncoding data encoding + * @returns {this} updated hash + */ + update(data, inputEncoding) { + if (typeof data !== "string") data = data.toString("utf-8"); + if (data.startsWith("debug-digest-")) { + data = Buffer.from(data.slice("debug-digest-".length), "hex").toString(); + } + this.string += `[${data}](${new Error().stack.split("\n", 3)[2]})\n`; + return this; + } - object.assetsByChunkName = {}; - for (const [file, chunks] of compilationFileToChunks) { - for (const chunk of chunks) { - const name = chunk.name; - if (!name) continue; - if ( - !Object.prototype.hasOwnProperty.call( - object.assetsByChunkName, - name - ) - ) { - object.assetsByChunkName[name] = []; - } - object.assetsByChunkName[name].push(file); - } - } + /** + * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} + * @param {string=} encoding encoding of the return value + * @returns {string|Buffer} digest + */ + digest(encoding) { + return "debug-digest-" + Buffer.from(this.string).toString("hex"); + } +} - const groupedAssets = factory.create( - `${type}.assets`, - Array.from(assets), - { - ...context, - compilationFileToChunks, - compilationAuxiliaryFileToChunks - } - ); - const limited = spaceLimited(groupedAssets, options.assetsSpace); - object.assets = limited.children; - object.filteredAssets = limited.filteredChildren; - }, - chunks: (object, compilation, context, options, factory) => { - const { type } = context; - object.chunks = factory.create( - `${type}.chunks`, - Array.from(compilation.chunks), - context - ); - }, - modules: (object, compilation, context, options, factory) => { - const { type } = context; - const array = Array.from(compilation.modules); - const groupedModules = factory.create(`${type}.modules`, array, context); - const limited = spaceLimited(groupedModules, options.modulesSpace); - object.modules = limited.children; - object.filteredModules = limited.filteredChildren; - }, - entrypoints: ( - object, - compilation, - context, - { entrypoints, chunkGroups, chunkGroupAuxiliary, chunkGroupChildren }, - factory - ) => { - const { type } = context; - const array = Array.from(compilation.entrypoints, ([key, value]) => ({ - name: key, - chunkGroup: value - })); - if (entrypoints === "auto" && !chunkGroups) { - if (array.length > 5) return; - if ( - !chunkGroupChildren && - array.every(({ chunkGroup }) => { - if (chunkGroup.chunks.length !== 1) return false; - const chunk = chunkGroup.chunks[0]; - return ( - chunk.files.size === 1 && - (!chunkGroupAuxiliary || chunk.auxiliaryFiles.size === 0) - ); - }) - ) { - return; - } - } - object.entrypoints = factory.create( - `${type}.entrypoints`, - array, - context - ); - }, - chunkGroups: (object, compilation, context, options, factory) => { - const { type } = context; - const array = Array.from( - compilation.namedChunkGroups, - ([key, value]) => ({ - name: key, - chunkGroup: value - }) - ); - object.namedChunkGroups = factory.create( - `${type}.namedChunkGroups`, - array, - context - ); - }, - errors: (object, compilation, context, options, factory) => { - const { type, cachedGetErrors } = context; - object.errors = factory.create( - `${type}.errors`, - cachedGetErrors(compilation), - context - ); - }, - errorsCount: (object, compilation, { cachedGetErrors }) => { - object.errorsCount = countWithChildren(compilation, c => - cachedGetErrors(c) - ); - }, - warnings: (object, compilation, context, options, factory) => { - const { type, cachedGetWarnings } = context; - object.warnings = factory.create( - `${type}.warnings`, - cachedGetWarnings(compilation), - context - ); - }, - warningsCount: ( - object, - compilation, - context, - { warningsFilter }, - factory - ) => { - const { type, cachedGetWarnings } = context; - object.warningsCount = countWithChildren(compilation, (c, childType) => { - if (!warningsFilter && warningsFilter.length === 0) - return cachedGetWarnings(c); - return factory - .create(`${type}${childType}.warnings`, cachedGetWarnings(c), context) - .filter(warning => { - const warningString = Object.keys(warning) - .map(key => `${warning[key]}`) - .join("\n"); - return !warningsFilter.some(filter => - filter(warning, warningString) - ); - }); - }); - }, - errorDetails: ( - object, - compilation, - { cachedGetErrors, cachedGetWarnings }, - { errorDetails, errors, warnings } - ) => { - if (errorDetails === "auto") { - if (warnings) { - const warnings = cachedGetWarnings(compilation); - object.filteredWarningDetailsCount = warnings - .map(e => typeof e !== "string" && e.details) - .filter(Boolean).length; +let crypto = undefined; +let createXXHash64 = undefined; +let createMd4 = undefined; +let BatchedHash = undefined; + +/** + * Creates a hash by name or function + * @param {string | typeof Hash} algorithm the algorithm name or a constructor creating a hash + * @returns {Hash} the hash + */ +module.exports = algorithm => { + if (typeof algorithm === "function") { + return new BulkUpdateDecorator(() => new algorithm()); + } + switch (algorithm) { + // TODO add non-cryptographic algorithm here + case "debug": + return new DebugHash(); + case "xxhash64": + if (createXXHash64 === undefined) { + createXXHash64 = __webpack_require__(35028); + if (BatchedHash === undefined) { + BatchedHash = __webpack_require__(59461); } - if (errors) { - const errors = cachedGetErrors(compilation); - if (errors.length >= 3) { - object.filteredErrorDetailsCount = errors - .map(e => typeof e !== "string" && e.details) - .filter(Boolean).length; - } + } + return new BatchedHash(createXXHash64()); + case "md4": + if (createMd4 === undefined) { + createMd4 = __webpack_require__(86884); + if (BatchedHash === undefined) { + BatchedHash = __webpack_require__(59461); } } - }, - children: (object, compilation, context, options, factory) => { - const { type } = context; - object.children = factory.create( - `${type}.children`, - compilation.children, - context + return new BatchedHash(createMd4()); + case "native-md4": + if (crypto === undefined) crypto = __webpack_require__(6113); + return new BulkUpdateDecorator(() => crypto.createHash("md4"), "md4"); + default: + if (crypto === undefined) crypto = __webpack_require__(6113); + return new BulkUpdateDecorator( + () => crypto.createHash(algorithm), + algorithm ); + } +}; + + +/***/ }), + +/***/ 64518: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const util = __webpack_require__(73837); + +/** @type {Map} */ +const deprecationCache = new Map(); + +/** + * @typedef {Object} FakeHookMarker + * @property {true} _fakeHook it's a fake hook + */ + +/** @template T @typedef {T & FakeHookMarker} FakeHook */ + +/** + * @param {string} message deprecation message + * @param {string} code deprecation code + * @returns {Function} function to trigger deprecation + */ +const createDeprecation = (message, code) => { + const cached = deprecationCache.get(message); + if (cached !== undefined) return cached; + const fn = util.deprecate( + () => {}, + message, + "DEP_WEBPACK_DEPRECATION_" + code + ); + deprecationCache.set(message, fn); + return fn; +}; + +const COPY_METHODS = [ + "concat", + "entry", + "filter", + "find", + "findIndex", + "includes", + "indexOf", + "join", + "lastIndexOf", + "map", + "reduce", + "reduceRight", + "slice", + "some" +]; + +const DISABLED_METHODS = [ + "copyWithin", + "entries", + "fill", + "keys", + "pop", + "reverse", + "shift", + "splice", + "sort", + "unshift" +]; + +/** + * @param {any} set new set + * @param {string} name property name + * @returns {void} + */ +exports.arrayToSetDeprecation = (set, name) => { + for (const method of COPY_METHODS) { + if (set[method]) continue; + const d = createDeprecation( + `${name} was changed from Array to Set (using Array method '${method}' is deprecated)`, + "ARRAY_TO_SET" + ); + /** + * @deprecated + * @this {Set} + * @returns {number} count + */ + set[method] = function () { + d(); + const array = Array.from(this); + return Array.prototype[method].apply(array, arguments); + }; + } + const dPush = createDeprecation( + `${name} was changed from Array to Set (using Array method 'push' is deprecated)`, + "ARRAY_TO_SET_PUSH" + ); + const dLength = createDeprecation( + `${name} was changed from Array to Set (using Array property 'length' is deprecated)`, + "ARRAY_TO_SET_LENGTH" + ); + const dIndexer = createDeprecation( + `${name} was changed from Array to Set (indexing Array is deprecated)`, + "ARRAY_TO_SET_INDEXER" + ); + /** + * @deprecated + * @this {Set} + * @returns {number} count + */ + set.push = function () { + dPush(); + for (const item of Array.from(arguments)) { + this.add(item); } - }, - asset: { - _: (object, asset, context, options, factory) => { - const { compilation } = context; - object.type = asset.type; - object.name = asset.name; - object.size = asset.source.size(); - object.emitted = compilation.emittedAssets.has(asset.name); - object.comparedForEmit = compilation.comparedForEmitAssets.has( - asset.name + return this.size; + }; + for (const method of DISABLED_METHODS) { + if (set[method]) continue; + set[method] = () => { + throw new Error( + `${name} was changed from Array to Set (using Array method '${method}' is not possible)` ); - const cached = !object.emitted && !object.comparedForEmit; - object.cached = cached; - object.info = asset.info; - if (!cached || options.cachedAssets) { - Object.assign( - object, - factory.create(`${context.type}$visible`, asset, context) + }; + } + const createIndexGetter = index => { + /** + * @this {Set} a Set + * @returns {any} the value at this location + */ + const fn = function () { + dIndexer(); + let i = 0; + for (const item of this) { + if (i++ === index) return item; + } + return undefined; + }; + return fn; + }; + const defineIndexGetter = index => { + Object.defineProperty(set, index, { + get: createIndexGetter(index), + set(value) { + throw new Error( + `${name} was changed from Array to Set (indexing Array with write is not possible)` ); } - } - }, - asset$visible: { - _: ( - object, - asset, - { compilation, compilationFileToChunks, compilationAuxiliaryFileToChunks } - ) => { - const chunks = compilationFileToChunks.get(asset.name) || []; - const auxiliaryChunks = - compilationAuxiliaryFileToChunks.get(asset.name) || []; - object.chunkNames = uniqueOrderedArray( - chunks, - c => (c.name ? [c.name] : []), - compareIds - ); - object.chunkIdHints = uniqueOrderedArray( - chunks, - c => Array.from(c.idNameHints), - compareIds - ); - object.auxiliaryChunkNames = uniqueOrderedArray( - auxiliaryChunks, - c => (c.name ? [c.name] : []), - compareIds - ); - object.auxiliaryChunkIdHints = uniqueOrderedArray( - auxiliaryChunks, - c => Array.from(c.idNameHints), - compareIds - ); - object.filteredRelated = asset.related ? asset.related.length : undefined; - }, - relatedAssets: (object, asset, context, options, factory) => { - const { type } = context; - object.related = factory.create( - `${type.slice(0, -8)}.related`, - asset.related, - context - ); - object.filteredRelated = asset.related - ? asset.related.length - object.related.length - : undefined; + }); + }; + defineIndexGetter(0); + let indexerDefined = 1; + Object.defineProperty(set, "length", { + get() { + dLength(); + const length = this.size; + for (indexerDefined; indexerDefined < length + 1; indexerDefined++) { + defineIndexGetter(indexerDefined); + } + return length; }, - ids: ( - object, - asset, - { compilationFileToChunks, compilationAuxiliaryFileToChunks } - ) => { - const chunks = compilationFileToChunks.get(asset.name) || []; - const auxiliaryChunks = - compilationAuxiliaryFileToChunks.get(asset.name) || []; - object.chunks = uniqueOrderedArray(chunks, c => c.ids, compareIds); - object.auxiliaryChunks = uniqueOrderedArray( - auxiliaryChunks, - c => c.ids, - compareIds + set(value) { + throw new Error( + `${name} was changed from Array to Set (writing to Array property 'length' is not possible)` ); - }, - performance: (object, asset) => { - object.isOverSizeLimit = SizeLimitsPlugin.isOverSizeLimit(asset.source); } - }, - chunkGroup: { - _: ( - object, - { name, chunkGroup }, - { compilation, compilation: { moduleGraph, chunkGraph } }, - { ids, chunkGroupAuxiliary, chunkGroupChildren, chunkGroupMaxAssets } - ) => { - const children = - chunkGroupChildren && - chunkGroup.getChildrenByOrders(moduleGraph, chunkGraph); - /** - * @param {string} name Name - * @returns {{ name: string, size: number }} Asset object - */ - const toAsset = name => { - const asset = compilation.getAsset(name); - return { - name, - size: asset ? asset.info.size : -1 - }; - }; - /** @type {(total: number, asset: { size: number }) => number} */ - const sizeReducer = (total, { size }) => total + size; - const assets = uniqueArray(chunkGroup.chunks, c => c.files).map(toAsset); - const auxiliaryAssets = uniqueOrderedArray( - chunkGroup.chunks, - c => c.auxiliaryFiles, - compareIds - ).map(toAsset); - const assetsSize = assets.reduce(sizeReducer, 0); - const auxiliaryAssetsSize = auxiliaryAssets.reduce(sizeReducer, 0); - /** @type {KnownStatsChunkGroup} */ - const statsChunkGroup = { - name, - chunks: ids ? chunkGroup.chunks.map(c => c.id) : undefined, - assets: assets.length <= chunkGroupMaxAssets ? assets : undefined, - filteredAssets: - assets.length <= chunkGroupMaxAssets ? 0 : assets.length, - assetsSize, - auxiliaryAssets: - chunkGroupAuxiliary && auxiliaryAssets.length <= chunkGroupMaxAssets - ? auxiliaryAssets - : undefined, - filteredAuxiliaryAssets: - chunkGroupAuxiliary && auxiliaryAssets.length <= chunkGroupMaxAssets - ? 0 - : auxiliaryAssets.length, - auxiliaryAssetsSize, - children: children - ? mapObject(children, groups => - groups.map(group => { - const assets = uniqueArray(group.chunks, c => c.files).map( - toAsset - ); - const auxiliaryAssets = uniqueOrderedArray( - group.chunks, - c => c.auxiliaryFiles, - compareIds - ).map(toAsset); + }); + set[Symbol.isConcatSpreadable] = true; +}; + +exports.createArrayToSetDeprecationSet = name => { + let initialized = false; + class SetDeprecatedArray extends Set { + constructor(items) { + super(items); + if (!initialized) { + initialized = true; + exports.arrayToSetDeprecation(SetDeprecatedArray.prototype, name); + } + } + } + return SetDeprecatedArray; +}; + +exports.soonFrozenObjectDeprecation = (obj, name, code, note = "") => { + const message = `${name} will be frozen in future, all modifications are deprecated.${ + note && `\n${note}` + }`; + return new Proxy(obj, { + set: util.deprecate( + (target, property, value, receiver) => + Reflect.set(target, property, value, receiver), + message, + code + ), + defineProperty: util.deprecate( + (target, property, descriptor) => + Reflect.defineProperty(target, property, descriptor), + message, + code + ), + deleteProperty: util.deprecate( + (target, property) => Reflect.deleteProperty(target, property), + message, + code + ), + setPrototypeOf: util.deprecate( + (target, proto) => Reflect.setPrototypeOf(target, proto), + message, + code + ) + }); +}; + +/** + * @template T + * @param {T} obj object + * @param {string} message deprecation message + * @param {string} code deprecation code + * @returns {T} object with property access deprecated + */ +const deprecateAllProperties = (obj, message, code) => { + const newObj = {}; + const descriptors = Object.getOwnPropertyDescriptors(obj); + for (const name of Object.keys(descriptors)) { + const descriptor = descriptors[name]; + if (typeof descriptor.value === "function") { + Object.defineProperty(newObj, name, { + ...descriptor, + value: util.deprecate(descriptor.value, message, code) + }); + } else if (descriptor.get || descriptor.set) { + Object.defineProperty(newObj, name, { + ...descriptor, + get: descriptor.get && util.deprecate(descriptor.get, message, code), + set: descriptor.set && util.deprecate(descriptor.set, message, code) + }); + } else { + let value = descriptor.value; + Object.defineProperty(newObj, name, { + configurable: descriptor.configurable, + enumerable: descriptor.enumerable, + get: util.deprecate(() => value, message, code), + set: descriptor.writable + ? util.deprecate(v => (value = v), message, code) + : undefined + }); + } + } + return /** @type {T} */ (newObj); +}; +exports.deprecateAllProperties = deprecateAllProperties; + +/** + * @template T + * @param {T} fakeHook fake hook implementation + * @param {string=} message deprecation message (not deprecated when unset) + * @param {string=} code deprecation code (not deprecated when unset) + * @returns {FakeHook} fake hook which redirects + */ +exports.createFakeHook = (fakeHook, message, code) => { + if (message && code) { + fakeHook = deprecateAllProperties(fakeHook, message, code); + } + return Object.freeze( + Object.assign(fakeHook, { _fakeHook: /** @type {true} */ (true) }) + ); +}; + + +/***/ }), + +/***/ 59836: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +// Simulations show these probabilities for a single change +// 93.1% that one group is invalidated +// 4.8% that two groups are invalidated +// 1.1% that 3 groups are invalidated +// 0.1% that 4 or more groups are invalidated +// +// And these for removing/adding 10 lexically adjacent files +// 64.5% that one group is invalidated +// 24.8% that two groups are invalidated +// 7.8% that 3 groups are invalidated +// 2.7% that 4 or more groups are invalidated +// +// And these for removing/adding 3 random files +// 0% that one group is invalidated +// 3.7% that two groups are invalidated +// 80.8% that 3 groups are invalidated +// 12.3% that 4 groups are invalidated +// 3.2% that 5 or more groups are invalidated + +/** + * + * @param {string} a key + * @param {string} b key + * @returns {number} the similarity as number + */ +const similarity = (a, b) => { + const l = Math.min(a.length, b.length); + let dist = 0; + for (let i = 0; i < l; i++) { + const ca = a.charCodeAt(i); + const cb = b.charCodeAt(i); + dist += Math.max(0, 10 - Math.abs(ca - cb)); + } + return dist; +}; + +/** + * @param {string} a key + * @param {string} b key + * @param {Set} usedNames set of already used names + * @returns {string} the common part and a single char for the difference + */ +const getName = (a, b, usedNames) => { + const l = Math.min(a.length, b.length); + let i = 0; + while (i < l) { + if (a.charCodeAt(i) !== b.charCodeAt(i)) { + i++; + break; + } + i++; + } + while (i < l) { + const name = a.slice(0, i); + const lowerName = name.toLowerCase(); + if (!usedNames.has(lowerName)) { + usedNames.add(lowerName); + return name; + } + i++; + } + // names always contain a hash, so this is always unique + // we don't need to check usedNames nor add it + return a; +}; - /** @type {KnownStatsChunkGroup} */ - const childStatsChunkGroup = { - name: group.name, - chunks: ids ? group.chunks.map(c => c.id) : undefined, - assets: - assets.length <= chunkGroupMaxAssets ? assets : undefined, - filteredAssets: - assets.length <= chunkGroupMaxAssets ? 0 : assets.length, - auxiliaryAssets: - chunkGroupAuxiliary && - auxiliaryAssets.length <= chunkGroupMaxAssets - ? auxiliaryAssets - : undefined, - filteredAuxiliaryAssets: - chunkGroupAuxiliary && - auxiliaryAssets.length <= chunkGroupMaxAssets - ? 0 - : auxiliaryAssets.length - }; +/** + * @param {Record} total total size + * @param {Record} size single size + * @returns {void} + */ +const addSizeTo = (total, size) => { + for (const key of Object.keys(size)) { + total[key] = (total[key] || 0) + size[key]; + } +}; - return childStatsChunkGroup; - }) - ) - : undefined, - childAssets: children - ? mapObject(children, groups => { - /** @type {Set} */ - const set = new Set(); - for (const group of groups) { - for (const chunk of group.chunks) { - for (const asset of chunk.files) { - set.add(asset); - } - } - } - return Array.from(set); - }) - : undefined - }; - Object.assign(object, statsChunkGroup); - }, - performance: (object, { chunkGroup }) => { - object.isOverSizeLimit = SizeLimitsPlugin.isOverSizeLimit(chunkGroup); +/** + * @param {Record} total total size + * @param {Record} size single size + * @returns {void} + */ +const subtractSizeFrom = (total, size) => { + for (const key of Object.keys(size)) { + total[key] -= size[key]; + } +}; + +/** + * @param {Iterable} nodes some nodes + * @returns {Record} total size + */ +const sumSize = nodes => { + const sum = Object.create(null); + for (const node of nodes) { + addSizeTo(sum, node.size); + } + return sum; +}; + +const isTooBig = (size, maxSize) => { + for (const key of Object.keys(size)) { + const s = size[key]; + if (s === 0) continue; + const maxSizeValue = maxSize[key]; + if (typeof maxSizeValue === "number") { + if (s > maxSizeValue) return true; } - }, - module: { - _: (object, module, context, options, factory) => { - const { compilation, type } = context; - const built = compilation.builtModules.has(module); - const codeGenerated = compilation.codeGeneratedModules.has(module); - const buildTimeExecuted = - compilation.buildTimeExecutedModules.has(module); - /** @type {{[x: string]: number}} */ - const sizes = {}; - for (const sourceType of module.getSourceTypes()) { - sizes[sourceType] = module.size(sourceType); - } - /** @type {KnownStatsModule} */ - const statsModule = { - type: "module", - moduleType: module.type, - layer: module.layer, - size: module.size(), - sizes, - built, - codeGenerated, - buildTimeExecuted, - cached: !built && !codeGenerated - }; - Object.assign(object, statsModule); + } + return false; +}; - if (built || codeGenerated || options.cachedModules) { - Object.assign( - object, - factory.create(`${type}$visible`, module, context) - ); - } +const isTooSmall = (size, minSize) => { + for (const key of Object.keys(size)) { + const s = size[key]; + if (s === 0) continue; + const minSizeValue = minSize[key]; + if (typeof minSizeValue === "number") { + if (s < minSizeValue) return true; } - }, - module$visible: { - _: (object, module, context, { requestShortener }, factory) => { - const { compilation, type, rootModules } = context; - const { moduleGraph } = compilation; - /** @type {Module[]} */ - const path = []; - const issuer = moduleGraph.getIssuer(module); - let current = issuer; - while (current) { - path.push(current); - current = moduleGraph.getIssuer(current); - } - path.reverse(); - const profile = moduleGraph.getProfile(module); - const errors = module.getErrors(); - const errorsCount = errors !== undefined ? countIterable(errors) : 0; - const warnings = module.getWarnings(); - const warningsCount = - warnings !== undefined ? countIterable(warnings) : 0; - /** @type {{[x: string]: number}} */ - const sizes = {}; - for (const sourceType of module.getSourceTypes()) { - sizes[sourceType] = module.size(sourceType); - } - /** @type {KnownStatsModule} */ - const statsModule = { - identifier: module.identifier(), - name: module.readableIdentifier(requestShortener), - nameForCondition: module.nameForCondition(), - index: moduleGraph.getPreOrderIndex(module), - preOrderIndex: moduleGraph.getPreOrderIndex(module), - index2: moduleGraph.getPostOrderIndex(module), - postOrderIndex: moduleGraph.getPostOrderIndex(module), - cacheable: module.buildInfo.cacheable, - optional: module.isOptional(moduleGraph), - orphan: - !type.endsWith("module.modules[].module$visible") && - compilation.chunkGraph.getNumberOfModuleChunks(module) === 0, - dependent: rootModules ? !rootModules.has(module) : undefined, - issuer: issuer && issuer.identifier(), - issuerName: issuer && issuer.readableIdentifier(requestShortener), - issuerPath: - issuer && - factory.create(`${type.slice(0, -8)}.issuerPath`, path, context), - failed: errorsCount > 0, - errors: errorsCount, - warnings: warningsCount - }; - Object.assign(object, statsModule); - if (profile) { - object.profile = factory.create( - `${type.slice(0, -8)}.profile`, - profile, - context - ); - } - }, - ids: (object, module, { compilation: { chunkGraph, moduleGraph } }) => { - object.id = chunkGraph.getModuleId(module); - const issuer = moduleGraph.getIssuer(module); - object.issuerId = issuer && chunkGraph.getModuleId(issuer); - object.chunks = Array.from( - chunkGraph.getOrderedModuleChunksIterable(module, compareChunksById), - chunk => chunk.id - ); - }, - moduleAssets: (object, module) => { - object.assets = module.buildInfo.assets - ? Object.keys(module.buildInfo.assets) - : []; - }, - reasons: (object, module, context, options, factory) => { - const { - type, - compilation: { moduleGraph } - } = context; - const groupsReasons = factory.create( - `${type.slice(0, -8)}.reasons`, - Array.from(moduleGraph.getIncomingConnections(module)), - context - ); - const limited = spaceLimited(groupsReasons, options.reasonsSpace); - object.reasons = limited.children; - object.filteredReasons = limited.filteredChildren; - }, - usedExports: ( - object, - module, - { runtime, compilation: { moduleGraph } } - ) => { - const usedExports = moduleGraph.getUsedExports(module, runtime); - if (usedExports === null) { - object.usedExports = null; - } else if (typeof usedExports === "boolean") { - object.usedExports = usedExports; + } + return false; +}; + +const getTooSmallTypes = (size, minSize) => { + const types = new Set(); + for (const key of Object.keys(size)) { + const s = size[key]; + if (s === 0) continue; + const minSizeValue = minSize[key]; + if (typeof minSizeValue === "number") { + if (s < minSizeValue) types.add(key); + } + } + return types; +}; + +const getNumberOfMatchingSizeTypes = (size, types) => { + let i = 0; + for (const key of Object.keys(size)) { + if (size[key] !== 0 && types.has(key)) i++; + } + return i; +}; + +const selectiveSizeSum = (size, types) => { + let sum = 0; + for (const key of Object.keys(size)) { + if (size[key] !== 0 && types.has(key)) sum += size[key]; + } + return sum; +}; + +/** + * @template T + */ +class Node { + /** + * @param {T} item item + * @param {string} key key + * @param {Record} size size + */ + constructor(item, key, size) { + this.item = item; + this.key = key; + this.size = size; + } +} + +/** + * @template T + */ +class Group { + /** + * @param {Node[]} nodes nodes + * @param {number[]} similarities similarities between the nodes (length = nodes.length - 1) + * @param {Record=} size size of the group + */ + constructor(nodes, similarities, size) { + this.nodes = nodes; + this.similarities = similarities; + this.size = size || sumSize(nodes); + /** @type {string} */ + this.key = undefined; + } + + /** + * @param {function(Node): boolean} filter filter function + * @returns {Node[]} removed nodes + */ + popNodes(filter) { + const newNodes = []; + const newSimilarities = []; + const resultNodes = []; + let lastNode; + for (let i = 0; i < this.nodes.length; i++) { + const node = this.nodes[i]; + if (filter(node)) { + resultNodes.push(node); } else { - object.usedExports = Array.from(usedExports); - } - }, - providedExports: (object, module, { compilation: { moduleGraph } }) => { - const providedExports = moduleGraph.getProvidedExports(module); - object.providedExports = Array.isArray(providedExports) - ? providedExports - : null; - }, - optimizationBailout: ( - object, - module, - { compilation: { moduleGraph } }, - { requestShortener } - ) => { - object.optimizationBailout = moduleGraph - .getOptimizationBailout(module) - .map(item => { - if (typeof item === "function") return item(requestShortener); - return item; - }); - }, - depth: (object, module, { compilation: { moduleGraph } }) => { - object.depth = moduleGraph.getDepth(module); - }, - nestedModules: (object, module, context, options, factory) => { - const { type } = context; - const innerModules = /** @type {Module & { modules?: Module[] }} */ ( - module - ).modules; - if (Array.isArray(innerModules)) { - const groupedModules = factory.create( - `${type.slice(0, -8)}.modules`, - innerModules, - context - ); - const limited = spaceLimited( - groupedModules, - options.nestedModulesSpace - ); - object.modules = limited.children; - object.filteredModules = limited.filteredChildren; - } - }, - source: (object, module) => { - const originalSource = module.originalSource(); - if (originalSource) { - object.source = originalSource.source(); + if (newNodes.length > 0) { + newSimilarities.push( + lastNode === this.nodes[i - 1] + ? this.similarities[i - 1] + : similarity(lastNode.key, node.key) + ); + } + newNodes.push(node); + lastNode = node; } } - }, - profile: { - _: (object, profile) => { - /** @type {KnownStatsProfile} */ - const statsProfile = { - total: - profile.factory + - profile.restoring + - profile.integration + - profile.building + - profile.storing, - resolving: profile.factory, - restoring: profile.restoring, - building: profile.building, - integration: profile.integration, - storing: profile.storing, - additionalResolving: profile.additionalFactories, - additionalIntegration: profile.additionalIntegration, - // TODO remove this in webpack 6 - factory: profile.factory, - // TODO remove this in webpack 6 - dependencies: profile.additionalFactories - }; - Object.assign(object, statsProfile); - } - }, - moduleIssuer: { - _: (object, module, context, { requestShortener }, factory) => { - const { compilation, type } = context; - const { moduleGraph } = compilation; - const profile = moduleGraph.getProfile(module); - /** @type {KnownStatsModuleIssuer} */ - const statsModuleIssuer = { - identifier: module.identifier(), - name: module.readableIdentifier(requestShortener) - }; - Object.assign(object, statsModuleIssuer); - if (profile) { - object.profile = factory.create(`${type}.profile`, profile, context); - } - }, - ids: (object, module, { compilation: { chunkGraph } }) => { - object.id = chunkGraph.getModuleId(module); + if (resultNodes.length === this.nodes.length) return undefined; + this.nodes = newNodes; + this.similarities = newSimilarities; + this.size = sumSize(newNodes); + return resultNodes; + } +} + +/** + * @param {Iterable} nodes nodes + * @returns {number[]} similarities + */ +const getSimilarities = nodes => { + // calculate similarities between lexically adjacent nodes + /** @type {number[]} */ + const similarities = []; + let last = undefined; + for (const node of nodes) { + if (last !== undefined) { + similarities.push(similarity(last.key, node.key)); } - }, - moduleReason: { - _: (object, reason, { runtime }, { requestShortener }) => { - const dep = reason.dependency; - const moduleDep = - dep && dep instanceof ModuleDependency ? dep : undefined; - /** @type {KnownStatsModuleReason} */ - const statsModuleReason = { - moduleIdentifier: reason.originModule - ? reason.originModule.identifier() - : null, - module: reason.originModule - ? reason.originModule.readableIdentifier(requestShortener) - : null, - moduleName: reason.originModule - ? reason.originModule.readableIdentifier(requestShortener) - : null, - resolvedModuleIdentifier: reason.resolvedOriginModule - ? reason.resolvedOriginModule.identifier() - : null, - resolvedModule: reason.resolvedOriginModule - ? reason.resolvedOriginModule.readableIdentifier(requestShortener) - : null, - type: reason.dependency ? reason.dependency.type : null, - active: reason.isActive(runtime), - explanation: reason.explanation, - userRequest: (moduleDep && moduleDep.userRequest) || null - }; - Object.assign(object, statsModuleReason); - if (reason.dependency) { - const locInfo = formatLocation(reason.dependency.loc); - if (locInfo) { - object.loc = locInfo; + last = node; + } + return similarities; +}; + +/** + * @template T + * @typedef {Object} GroupedItems + * @property {string} key + * @property {T[]} items + * @property {Record} size + */ + +/** + * @template T + * @typedef {Object} Options + * @property {Record} maxSize maximum size of a group + * @property {Record} minSize minimum size of a group (preferred over maximum size) + * @property {Iterable} items a list of items + * @property {function(T): Record} getSize function to get size of an item + * @property {function(T): string} getKey function to get the key of an item + */ + +/** + * @template T + * @param {Options} options options object + * @returns {GroupedItems[]} grouped items + */ +module.exports = ({ maxSize, minSize, items, getSize, getKey }) => { + /** @type {Group[]} */ + const result = []; + + const nodes = Array.from( + items, + item => new Node(item, getKey(item), getSize(item)) + ); + + /** @type {Node[]} */ + const initialNodes = []; + + // lexically ordering of keys + nodes.sort((a, b) => { + if (a.key < b.key) return -1; + if (a.key > b.key) return 1; + return 0; + }); + + // return nodes bigger than maxSize directly as group + // But make sure that minSize is not violated + for (const node of nodes) { + if (isTooBig(node.size, maxSize) && !isTooSmall(node.size, minSize)) { + result.push(new Group([node], [])); + } else { + initialNodes.push(node); + } + } + + if (initialNodes.length > 0) { + const initialGroup = new Group(initialNodes, getSimilarities(initialNodes)); + + const removeProblematicNodes = (group, consideredSize = group.size) => { + const problemTypes = getTooSmallTypes(consideredSize, minSize); + if (problemTypes.size > 0) { + // We hit an edge case where the working set is already smaller than minSize + // We merge problematic nodes with the smallest result node to keep minSize intact + const problemNodes = group.popNodes( + n => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0 + ); + if (problemNodes === undefined) return false; + // Only merge it with result nodes that have the problematic size type + const possibleResultGroups = result.filter( + n => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0 + ); + if (possibleResultGroups.length > 0) { + const bestGroup = possibleResultGroups.reduce((min, group) => { + const minMatches = getNumberOfMatchingSizeTypes(min, problemTypes); + const groupMatches = getNumberOfMatchingSizeTypes( + group, + problemTypes + ); + if (minMatches !== groupMatches) + return minMatches < groupMatches ? group : min; + if ( + selectiveSizeSum(min.size, problemTypes) > + selectiveSizeSum(group.size, problemTypes) + ) + return group; + return min; + }); + for (const node of problemNodes) bestGroup.nodes.push(node); + bestGroup.nodes.sort((a, b) => { + if (a.key < b.key) return -1; + if (a.key > b.key) return 1; + return 0; + }); + } else { + // There are no other nodes with the same size types + // We create a new group and have to accept that it's smaller than minSize + result.push(new Group(problemNodes, null)); } + return true; + } else { + return false; } - }, - ids: (object, reason, { compilation: { chunkGraph } }) => { - object.moduleId = reason.originModule - ? chunkGraph.getModuleId(reason.originModule) - : null; - object.resolvedModuleId = reason.resolvedOriginModule - ? chunkGraph.getModuleId(reason.resolvedOriginModule) - : null; - } - }, - chunk: { - _: (object, chunk, { makePathsRelative, compilation: { chunkGraph } }) => { - const childIdByOrder = chunk.getChildIdsByOrders(chunkGraph); + }; - /** @type {KnownStatsChunk} */ - const statsChunk = { - rendered: chunk.rendered, - initial: chunk.canBeInitial(), - entry: chunk.hasRuntime(), - recorded: AggressiveSplittingPlugin.wasChunkRecorded(chunk), - reason: chunk.chunkReason, - size: chunkGraph.getChunkModulesSize(chunk), - sizes: chunkGraph.getChunkModulesSizes(chunk), - names: chunk.name ? [chunk.name] : [], - idHints: Array.from(chunk.idNameHints), - runtime: - chunk.runtime === undefined - ? undefined - : typeof chunk.runtime === "string" - ? [makePathsRelative(chunk.runtime)] - : Array.from(chunk.runtime.sort(), makePathsRelative), - files: Array.from(chunk.files), - auxiliaryFiles: Array.from(chunk.auxiliaryFiles).sort(compareIds), - hash: chunk.renderedHash, - childrenByOrder: childIdByOrder - }; - Object.assign(object, statsChunk); - }, - ids: (object, chunk) => { - object.id = chunk.id; - }, - chunkRelations: (object, chunk, { compilation: { chunkGraph } }) => { - /** @type {Set} */ - const parents = new Set(); - /** @type {Set} */ - const children = new Set(); - /** @type {Set} */ - const siblings = new Set(); + if (initialGroup.nodes.length > 0) { + const queue = [initialGroup]; - for (const chunkGroup of chunk.groupsIterable) { - for (const parentGroup of chunkGroup.parentsIterable) { - for (const chunk of parentGroup.chunks) { - parents.add(chunk.id); + while (queue.length) { + const group = queue.pop(); + // only groups bigger than maxSize need to be splitted + if (!isTooBig(group.size, maxSize)) { + result.push(group); + continue; + } + // If the group is already too small + // we try to work only with the unproblematic nodes + if (removeProblematicNodes(group)) { + // This changed something, so we try this group again + queue.push(group); + continue; + } + + // find unsplittable area from left and right + // going minSize from left and right + // at least one node need to be included otherwise we get stuck + let left = 1; + let leftSize = Object.create(null); + addSizeTo(leftSize, group.nodes[0].size); + while (left < group.nodes.length && isTooSmall(leftSize, minSize)) { + addSizeTo(leftSize, group.nodes[left].size); + left++; + } + let right = group.nodes.length - 2; + let rightSize = Object.create(null); + addSizeTo(rightSize, group.nodes[group.nodes.length - 1].size); + while (right >= 0 && isTooSmall(rightSize, minSize)) { + addSizeTo(rightSize, group.nodes[right].size); + right--; + } + + // left v v right + // [ O O O ] O O O [ O O O ] + // ^^^^^^^^^ leftSize + // rightSize ^^^^^^^^^ + // leftSize > minSize + // rightSize > minSize + + // Perfect split: [ O O O ] [ O O O ] + // right === left - 1 + + if (left - 1 > right) { + // We try to remove some problematic nodes to "fix" that + let prevSize; + if (right < group.nodes.length - left) { + subtractSizeFrom(rightSize, group.nodes[right + 1].size); + prevSize = rightSize; + } else { + subtractSizeFrom(leftSize, group.nodes[left - 1].size); + prevSize = leftSize; } + if (removeProblematicNodes(group, prevSize)) { + // This changed something, so we try this group again + queue.push(group); + continue; + } + // can't split group while holding minSize + // because minSize is preferred of maxSize we return + // the problematic nodes as result here even while it's too big + // To avoid this make sure maxSize > minSize * 3 + result.push(group); + continue; } - for (const childGroup of chunkGroup.childrenIterable) { - for (const chunk of childGroup.chunks) { - children.add(chunk.id); + if (left <= right) { + // when there is a area between left and right + // we look for best split point + // we split at the minimum similarity + // here key space is separated the most + // But we also need to make sure to not create too small groups + let best = -1; + let bestSimilarity = Infinity; + let pos = left; + let rightSize = sumSize(group.nodes.slice(pos)); + + // pos v v right + // [ O O O ] O O O [ O O O ] + // ^^^^^^^^^ leftSize + // rightSize ^^^^^^^^^^^^^^^ + + while (pos <= right + 1) { + const similarity = group.similarities[pos - 1]; + if ( + similarity < bestSimilarity && + !isTooSmall(leftSize, minSize) && + !isTooSmall(rightSize, minSize) + ) { + best = pos; + bestSimilarity = similarity; + } + addSizeTo(leftSize, group.nodes[pos].size); + subtractSizeFrom(rightSize, group.nodes[pos].size); + pos++; + } + if (best < 0) { + // This can't happen + // but if that assumption is wrong + // fallback to a big group + result.push(group); + continue; } + left = best; + right = best - 1; } - for (const sibling of chunkGroup.chunks) { - if (sibling !== chunk) siblings.add(sibling.id); + + // create two new groups for left and right area + // and queue them up + const rightNodes = [group.nodes[right + 1]]; + /** @type {number[]} */ + const rightSimilarities = []; + for (let i = right + 2; i < group.nodes.length; i++) { + rightSimilarities.push(group.similarities[i - 1]); + rightNodes.push(group.nodes[i]); + } + queue.push(new Group(rightNodes, rightSimilarities)); + + const leftNodes = [group.nodes[0]]; + /** @type {number[]} */ + const leftSimilarities = []; + for (let i = 1; i < left; i++) { + leftSimilarities.push(group.similarities[i - 1]); + leftNodes.push(group.nodes[i]); } + queue.push(new Group(leftNodes, leftSimilarities)); } - object.siblings = Array.from(siblings).sort(compareIds); - object.parents = Array.from(parents).sort(compareIds); - object.children = Array.from(children).sort(compareIds); - }, - chunkModules: (object, chunk, context, options, factory) => { - const { - type, - compilation: { chunkGraph } - } = context; - const array = chunkGraph.getChunkModules(chunk); - const groupedModules = factory.create(`${type}.modules`, array, { - ...context, - runtime: chunk.runtime, - rootModules: new Set(chunkGraph.getChunkRootModules(chunk)) - }); - const limited = spaceLimited(groupedModules, options.chunkModulesSpace); - object.modules = limited.children; - object.filteredModules = limited.filteredChildren; - }, - chunkOrigins: (object, chunk, context, options, factory) => { - const { - type, - compilation: { chunkGraph } - } = context; - /** @type {Set} */ - const originsKeySet = new Set(); - const origins = []; - for (const g of chunk.groupsIterable) { - origins.push(...g.origins); + } + } + + // lexically ordering + result.sort((a, b) => { + if (a.nodes[0].key < b.nodes[0].key) return -1; + if (a.nodes[0].key > b.nodes[0].key) return 1; + return 0; + }); + + // give every group a name + const usedNames = new Set(); + for (let i = 0; i < result.length; i++) { + const group = result[i]; + if (group.nodes.length === 1) { + group.key = group.nodes[0].key; + } else { + const first = group.nodes[0]; + const last = group.nodes[group.nodes.length - 1]; + const name = getName(first.key, last.key, usedNames); + group.key = name; + } + } + + // return the results + return result.map(group => { + /** @type {GroupedItems} */ + return { + key: group.key, + items: group.nodes.map(node => node.item), + size: group.size + }; + }); +}; + + +/***/ }), + +/***/ 11850: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Sam Chen @chenxsan +*/ + + + +/** + * @param {string} urlAndGlobal the script request + * @returns {string[]} script url and its global variable + */ +module.exports = function extractUrlAndGlobal(urlAndGlobal) { + const index = urlAndGlobal.indexOf("@"); + if (index <= 0 || index === urlAndGlobal.length - 1) { + throw new Error(`Invalid request "${urlAndGlobal}"`); + } + return [urlAndGlobal.substring(index + 1), urlAndGlobal.substring(0, index)]; +}; + + +/***/ }), + +/***/ 6261: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const NO_MARKER = 0; +const IN_PROGRESS_MARKER = 1; +const DONE_MARKER = 2; +const DONE_MAYBE_ROOT_CYCLE_MARKER = 3; +const DONE_AND_ROOT_MARKER = 4; + +/** + * @template T + */ +class Node { + /** + * @param {T} item the value of the node + */ + constructor(item) { + this.item = item; + /** @type {Set>} */ + this.dependencies = new Set(); + this.marker = NO_MARKER; + /** @type {Cycle | undefined} */ + this.cycle = undefined; + this.incoming = 0; + } +} + +/** + * @template T + */ +class Cycle { + constructor() { + /** @type {Set>} */ + this.nodes = new Set(); + } +} + +/** + * @template T + * @typedef {Object} StackEntry + * @property {Node} node + * @property {Node[]} openEdges + */ + +/** + * @template T + * @param {Iterable} items list of items + * @param {function(T): Iterable} getDependencies function to get dependencies of an item (items that are not in list are ignored) + * @returns {Iterable} graph roots of the items + */ +module.exports = (items, getDependencies) => { + /** @type {Map>} */ + const itemToNode = new Map(); + for (const item of items) { + const node = new Node(item); + itemToNode.set(item, node); + } + + // early exit when there is only a single item + if (itemToNode.size <= 1) return items; + + // grab all the dependencies + for (const node of itemToNode.values()) { + for (const dep of getDependencies(node.item)) { + const depNode = itemToNode.get(dep); + if (depNode !== undefined) { + node.dependencies.add(depNode); + } + } + } + + // Set of current root modules + // items will be removed if a new reference to it has been found + /** @type {Set>} */ + const roots = new Set(); + + // Set of current cycles without references to it + // cycles will be removed if a new reference to it has been found + // that is not part of the cycle + /** @type {Set>} */ + const rootCycles = new Set(); + + // For all non-marked nodes + for (const selectedNode of itemToNode.values()) { + if (selectedNode.marker === NO_MARKER) { + // deep-walk all referenced modules + // in a non-recursive way + + // start by entering the selected node + selectedNode.marker = IN_PROGRESS_MARKER; + + // keep a stack to avoid recursive walk + /** @type {StackEntry[]} */ + const stack = [ + { + node: selectedNode, + openEdges: Array.from(selectedNode.dependencies) + } + ]; + + // process the top item until stack is empty + while (stack.length > 0) { + const topOfStack = stack[stack.length - 1]; + + // Are there still edges unprocessed in the current node? + if (topOfStack.openEdges.length > 0) { + // Process one dependency + const dependency = topOfStack.openEdges.pop(); + switch (dependency.marker) { + case NO_MARKER: + // dependency has not be visited yet + // mark it as in-progress and recurse + stack.push({ + node: dependency, + openEdges: Array.from(dependency.dependencies) + }); + dependency.marker = IN_PROGRESS_MARKER; + break; + case IN_PROGRESS_MARKER: { + // It's a in-progress cycle + let cycle = dependency.cycle; + if (!cycle) { + cycle = new Cycle(); + cycle.nodes.add(dependency); + dependency.cycle = cycle; + } + // set cycle property for each node in the cycle + // if nodes are already part of a cycle + // we merge the cycles to a shared cycle + for ( + let i = stack.length - 1; + stack[i].node !== dependency; + i-- + ) { + const node = stack[i].node; + if (node.cycle) { + if (node.cycle !== cycle) { + // merge cycles + for (const cycleNode of node.cycle.nodes) { + cycleNode.cycle = cycle; + cycle.nodes.add(cycleNode); + } + } + } else { + node.cycle = cycle; + cycle.nodes.add(node); + } + } + // don't recurse into dependencies + // these are already on the stack + break; + } + case DONE_AND_ROOT_MARKER: + // This node has be visited yet and is currently a root node + // But as this is a new reference to the node + // it's not really a root + // so we have to convert it to a normal node + dependency.marker = DONE_MARKER; + roots.delete(dependency); + break; + case DONE_MAYBE_ROOT_CYCLE_MARKER: + // This node has be visited yet and + // is maybe currently part of a completed root cycle + // we found a new reference to the cycle + // so it's not really a root cycle + // remove the cycle from the root cycles + // and convert it to a normal node + rootCycles.delete(dependency.cycle); + dependency.marker = DONE_MARKER; + break; + // DONE_MARKER: nothing to do, don't recurse into dependencies + } + } else { + // All dependencies of the current node has been visited + // we leave the node + stack.pop(); + topOfStack.node.marker = DONE_MARKER; + } + } + const cycle = selectedNode.cycle; + if (cycle) { + for (const node of cycle.nodes) { + node.marker = DONE_MAYBE_ROOT_CYCLE_MARKER; + } + rootCycles.add(cycle); + } else { + selectedNode.marker = DONE_AND_ROOT_MARKER; + roots.add(selectedNode); } - const array = origins.filter(origin => { - const key = [ - origin.module ? chunkGraph.getModuleId(origin.module) : undefined, - formatLocation(origin.loc), - origin.request - ].join(); - if (originsKeySet.has(key)) return false; - originsKeySet.add(key); - return true; - }); - object.origins = factory.create(`${type}.origins`, array, context); - } - }, - chunkOrigin: { - _: (object, origin, context, { requestShortener }) => { - /** @type {KnownStatsChunkOrigin} */ - const statsChunkOrigin = { - module: origin.module ? origin.module.identifier() : "", - moduleIdentifier: origin.module ? origin.module.identifier() : "", - moduleName: origin.module - ? origin.module.readableIdentifier(requestShortener) - : "", - loc: formatLocation(origin.loc), - request: origin.request - }; - Object.assign(object, statsChunkOrigin); - }, - ids: (object, origin, { compilation: { chunkGraph } }) => { - object.moduleId = origin.module - ? chunkGraph.getModuleId(origin.module) - : undefined; - } - }, - error: EXTRACT_ERROR, - warning: EXTRACT_ERROR, - moduleTraceItem: { - _: (object, { origin, module }, context, { requestShortener }, factory) => { - const { - type, - compilation: { moduleGraph } - } = context; - object.originIdentifier = origin.identifier(); - object.originName = origin.readableIdentifier(requestShortener); - object.moduleIdentifier = module.identifier(); - object.moduleName = module.readableIdentifier(requestShortener); - const dependencies = Array.from( - moduleGraph.getIncomingConnections(module) - ) - .filter(c => c.resolvedOriginModule === origin && c.dependency) - .map(c => c.dependency); - object.dependencies = factory.create( - `${type}.dependencies`, - Array.from(new Set(dependencies)), - context - ); - }, - ids: (object, { origin, module }, { compilation: { chunkGraph } }) => { - object.originId = chunkGraph.getModuleId(origin); - object.moduleId = chunkGraph.getModuleId(module); - } - }, - moduleTraceDependency: { - _: (object, dependency) => { - object.loc = formatLocation(dependency.loc); } } -}; -/** @type {Record boolean | undefined>>} */ -const FILTER = { - "module.reasons": { - "!orphanModules": (reason, { compilation: { chunkGraph } }) => { - if ( - reason.originModule && - chunkGraph.getNumberOfModuleChunks(reason.originModule) === 0 - ) { - return false; + // Extract roots from root cycles + // We take the nodes with most incoming edges + // inside of the cycle + for (const cycle of rootCycles) { + let max = 0; + /** @type {Set>} */ + const cycleRoots = new Set(); + const nodes = cycle.nodes; + for (const node of nodes) { + for (const dep of node.dependencies) { + if (nodes.has(dep)) { + dep.incoming++; + if (dep.incoming < max) continue; + if (dep.incoming > max) { + cycleRoots.clear(); + max = dep.incoming; + } + cycleRoots.add(dep); + } } } + for (const cycleRoot of cycleRoots) { + roots.add(cycleRoot); + } } -}; -/** @type {Record boolean | undefined>>} */ -const FILTER_RESULTS = { - "compilation.warnings": { - warningsFilter: util.deprecate( - (warning, context, { warningsFilter }) => { - const warningString = Object.keys(warning) - .map(key => `${warning[key]}`) - .join("\n"); - return !warningsFilter.some(filter => filter(warning, warningString)); - }, - "config.stats.warningsFilter is deprecated in favor of config.ignoreWarnings", - "DEP_WEBPACK_STATS_WARNINGS_FILTER" - ) + // When roots were found, return them + if (roots.size > 0) { + return Array.from(roots, r => r.item); + } else { + throw new Error("Implementation of findGraphRoots is broken"); } }; -/** @type {Record void>} */ -const MODULES_SORTER = { - _: (comparators, { compilation: { moduleGraph } }) => { - comparators.push( - compareSelect( - /** - * @param {Module} m module - * @returns {number} depth - */ - m => moduleGraph.getDepth(m), - compareNumbers - ), - compareSelect( - /** - * @param {Module} m module - * @returns {number} index - */ - m => moduleGraph.getPreOrderIndex(m), - compareNumbers - ), - compareSelect( - /** - * @param {Module} m module - * @returns {string} identifier - */ - m => m.identifier(), - compareIds - ) - ); - } -}; -/** @type {Record void>>} */ -const SORTERS = { - "compilation.chunks": { - _: comparators => { - comparators.push(compareSelect(c => c.id, compareIds)); - } - }, - "compilation.modules": MODULES_SORTER, - "chunk.rootModules": MODULES_SORTER, - "chunk.modules": MODULES_SORTER, - "module.modules": MODULES_SORTER, - "module.reasons": { - _: (comparators, { compilation: { chunkGraph } }) => { - comparators.push( - compareSelect(x => x.originModule, compareModulesByIdentifier) - ); - comparators.push( - compareSelect(x => x.resolvedOriginModule, compareModulesByIdentifier) - ); - comparators.push( - compareSelect( - x => x.dependency, - concatComparators( - compareSelect( - /** - * @param {Dependency} x dependency - * @returns {DependencyLocation} location - */ - x => x.loc, - compareLocations - ), - compareSelect(x => x.type, compareIds) - ) - ) - ); - } - }, - "chunk.origins": { - _: (comparators, { compilation: { chunkGraph } }) => { - comparators.push( - compareSelect( - origin => - origin.module ? chunkGraph.getModuleId(origin.module) : undefined, - compareIds - ), - compareSelect(origin => formatLocation(origin.loc), compareIds), - compareSelect(origin => origin.request, compareIds) - ); - } - } -}; +/***/ }), -const getItemSize = item => { - // Each item takes 1 line - // + the size of the children - // + 1 extra line when it has children and filteredChildren - return !item.children - ? 1 - : item.filteredChildren - ? 2 + getTotalSize(item.children) - : 1 + getTotalSize(item.children); -}; +/***/ 17139: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -const getTotalSize = children => { - let size = 0; - for (const child of children) { - size += getItemSize(child); - } - return size; -}; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -const getTotalItems = children => { - let count = 0; - for (const child of children) { - if (!child.children && !child.filteredChildren) { - count++; - } else { - if (child.children) count += getTotalItems(child.children); - if (child.filteredChildren) count += child.filteredChildren; - } - } - return count; -}; -const collapse = children => { - // After collapse each child must take exactly one line - const newChildren = []; - for (const child of children) { - if (child.children) { - let filteredChildren = child.filteredChildren || 0; - filteredChildren += getTotalItems(child.children); - newChildren.push({ - ...child, - children: undefined, - filteredChildren - }); - } else { - newChildren.push(child); - } - } - return newChildren; -}; -const spaceLimited = ( - itemsAndGroups, - max, - filteredChildrenLineReserved = false -) => { - if (max < 1) { - return { - children: undefined, - filteredChildren: getTotalItems(itemsAndGroups) - }; - } - /** @type {any[] | undefined} */ - let children = undefined; - /** @type {number | undefined} */ - let filteredChildren = undefined; - // This are the groups, which take 1+ lines each - const groups = []; - // The sizes of the groups are stored in groupSizes - const groupSizes = []; - // This are the items, which take 1 line each - const items = []; - // The total of group sizes - let groupsSize = 0; +const path = __webpack_require__(71017); - for (const itemOrGroup of itemsAndGroups) { - // is item - if (!itemOrGroup.children && !itemOrGroup.filteredChildren) { - items.push(itemOrGroup); - } else { - groups.push(itemOrGroup); - const size = getItemSize(itemOrGroup); - groupSizes.push(size); - groupsSize += size; - } - } +/** @typedef {import("../../declarations/WebpackOptions").WatchOptions} WatchOptions */ +/** @typedef {import("../FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */ - if (groupsSize + items.length <= max) { - // The total size in the current state fits into the max - // keep all - children = groups.length > 0 ? groups.concat(items) : items; - } else if (groups.length === 0) { - // slice items to max - // inner space marks that lines for filteredChildren already reserved - const limit = max - (filteredChildrenLineReserved ? 0 : 1); - filteredChildren = items.length - limit; - items.length = limit; - children = items; - } else { - // limit is the size when all groups are collapsed - const limit = - groups.length + - (filteredChildrenLineReserved || items.length === 0 ? 0 : 1); - if (limit < max) { - // calculate how much we are over the size limit - // this allows to approach the limit faster - let oversize; - // If each group would take 1 line the total would be below the maximum - // collapse some groups, keep items - while ( - (oversize = - groupsSize + - items.length + - (filteredChildren && !filteredChildrenLineReserved ? 1 : 0) - - max) > 0 - ) { - // Find the maximum group and process only this one - const maxGroupSize = Math.max(...groupSizes); - if (maxGroupSize < items.length) { - filteredChildren = items.length; - items.length = 0; - continue; - } - for (let i = 0; i < groups.length; i++) { - if (groupSizes[i] === maxGroupSize) { - const group = groups[i]; - // run this algorithm recursively and limit the size of the children to - // current size - oversize / number of groups - // So it should always end up being smaller - const headerSize = group.filteredChildren ? 2 : 1; - const limited = spaceLimited( - group.children, - maxGroupSize - - // we should use ceil to always feet in max - Math.ceil(oversize / groups.length) - - // we substitute size of group head - headerSize, - headerSize === 2 - ); - groups[i] = { - ...group, - children: limited.children, - filteredChildren: limited.filteredChildren - ? (group.filteredChildren || 0) + limited.filteredChildren - : group.filteredChildren - }; - const newSize = getItemSize(groups[i]); - groupsSize -= maxGroupSize - newSize; - groupSizes[i] = newSize; - break; - } - } - } - children = groups.concat(items); - } else if (limit === max) { - // If we have only enough space to show one line per group and one line for the filtered items - // collapse all groups and items - children = collapse(groups); - filteredChildren = items.length; - } else { - // If we have no space - // collapse complete group - filteredChildren = getTotalItems(itemsAndGroups); - } - } +/** + * @typedef {Object} IStats + * @property {() => boolean} isFile + * @property {() => boolean} isDirectory + * @property {() => boolean} isBlockDevice + * @property {() => boolean} isCharacterDevice + * @property {() => boolean} isSymbolicLink + * @property {() => boolean} isFIFO + * @property {() => boolean} isSocket + * @property {number | bigint} dev + * @property {number | bigint} ino + * @property {number | bigint} mode + * @property {number | bigint} nlink + * @property {number | bigint} uid + * @property {number | bigint} gid + * @property {number | bigint} rdev + * @property {number | bigint} size + * @property {number | bigint} blksize + * @property {number | bigint} blocks + * @property {number | bigint} atimeMs + * @property {number | bigint} mtimeMs + * @property {number | bigint} ctimeMs + * @property {number | bigint} birthtimeMs + * @property {Date} atime + * @property {Date} mtime + * @property {Date} ctime + * @property {Date} birthtime + */ + +/** + * @typedef {Object} IDirent + * @property {() => boolean} isFile + * @property {() => boolean} isDirectory + * @property {() => boolean} isBlockDevice + * @property {() => boolean} isCharacterDevice + * @property {() => boolean} isSymbolicLink + * @property {() => boolean} isFIFO + * @property {() => boolean} isSocket + * @property {string | Buffer} name + */ + +/** @typedef {function((NodeJS.ErrnoException | null)=): void} Callback */ +/** @typedef {function((NodeJS.ErrnoException | null)=, Buffer=): void} BufferCallback */ +/** @typedef {function((NodeJS.ErrnoException | null)=, Buffer|string=): void} BufferOrStringCallback */ +/** @typedef {function((NodeJS.ErrnoException | null)=, (string | Buffer)[] | IDirent[]=): void} DirentArrayCallback */ +/** @typedef {function((NodeJS.ErrnoException | null)=, string=): void} StringCallback */ +/** @typedef {function((NodeJS.ErrnoException | null)=, number=): void} NumberCallback */ +/** @typedef {function((NodeJS.ErrnoException | null)=, IStats=): void} StatsCallback */ +/** @typedef {function((NodeJS.ErrnoException | Error | null)=, any=): void} ReadJsonCallback */ +/** @typedef {function((NodeJS.ErrnoException | Error | null)=, IStats|string=): void} LstatReadlinkAbsoluteCallback */ + +/** + * @typedef {Object} WatcherInfo + * @property {Set} changes get current aggregated changes that have not yet send to callback + * @property {Set} removals get current aggregated removals that have not yet send to callback + * @property {Map} fileTimeInfoEntries get info about files + * @property {Map} contextTimeInfoEntries get info about directories + */ + +// TODO webpack 6 deprecate missing getInfo +/** + * @typedef {Object} Watcher + * @property {function(): void} close closes the watcher and all underlying file watchers + * @property {function(): void} pause closes the watcher, but keeps underlying file watchers alive until the next watch call + * @property {function(): Set=} getAggregatedChanges get current aggregated changes that have not yet send to callback + * @property {function(): Set=} getAggregatedRemovals get current aggregated removals that have not yet send to callback + * @property {function(): Map} getFileTimeInfoEntries get info about files + * @property {function(): Map} getContextTimeInfoEntries get info about directories + * @property {function(): WatcherInfo=} getInfo get info about timestamps and changes + */ + +/** + * @callback WatchMethod + * @param {Iterable} files watched files + * @param {Iterable} directories watched directories + * @param {Iterable} missing watched exitance entries + * @param {number} startTime timestamp of start time + * @param {WatchOptions} options options object + * @param {function(Error=, Map, Map, Set, Set): void} callback aggregated callback + * @param {function(string, number): void} callbackUndelayed callback when the first change was detected + * @returns {Watcher} a watcher + */ + +// TODO webpack 6 make optional methods required + +/** + * @typedef {Object} OutputFileSystem + * @property {function(string, Buffer|string, Callback): void} writeFile + * @property {function(string, Callback): void} mkdir + * @property {function(string, DirentArrayCallback): void=} readdir + * @property {function(string, Callback): void=} rmdir + * @property {function(string, Callback): void=} unlink + * @property {function(string, StatsCallback): void} stat + * @property {function(string, StatsCallback): void=} lstat + * @property {function(string, BufferOrStringCallback): void} readFile + * @property {(function(string, string): string)=} join + * @property {(function(string, string): string)=} relative + * @property {(function(string): string)=} dirname + */ + +/** + * @typedef {Object} InputFileSystem + * @property {function(string, BufferOrStringCallback): void} readFile + * @property {(function(string, ReadJsonCallback): void)=} readJson + * @property {function(string, BufferOrStringCallback): void} readlink + * @property {function(string, DirentArrayCallback): void} readdir + * @property {function(string, StatsCallback): void} stat + * @property {function(string, StatsCallback): void=} lstat + * @property {(function(string, BufferOrStringCallback): void)=} realpath + * @property {(function(string=): void)=} purge + * @property {(function(string, string): string)=} join + * @property {(function(string, string): string)=} relative + * @property {(function(string): string)=} dirname + */ + +/** + * @typedef {Object} WatchFileSystem + * @property {WatchMethod} watch + */ + +/** + * @typedef {Object} IntermediateFileSystemExtras + * @property {function(string): void} mkdirSync + * @property {function(string): NodeJS.WritableStream} createWriteStream + * @property {function(string, string, NumberCallback): void} open + * @property {function(number, Buffer, number, number, number, NumberCallback): void} read + * @property {function(number, Callback): void} close + * @property {function(string, string, Callback): void} rename + */ - return { - children, - filteredChildren - }; -}; +/** @typedef {InputFileSystem & OutputFileSystem & IntermediateFileSystemExtras} IntermediateFileSystem */ -const assetGroup = (children, assets) => { - let size = 0; - for (const asset of children) { - size += asset.size; +/** + * + * @param {InputFileSystem|OutputFileSystem|undefined} fs a file system + * @param {string} rootPath the root path + * @param {string} targetPath the target path + * @returns {string} location of targetPath relative to rootPath + */ +const relative = (fs, rootPath, targetPath) => { + if (fs && fs.relative) { + return fs.relative(rootPath, targetPath); + } else if (path.posix.isAbsolute(rootPath)) { + return path.posix.relative(rootPath, targetPath); + } else if (path.win32.isAbsolute(rootPath)) { + return path.win32.relative(rootPath, targetPath); + } else { + throw new Error( + `${rootPath} is neither a posix nor a windows path, and there is no 'relative' method defined in the file system` + ); } - return { - size - }; }; +exports.relative = relative; -const moduleGroup = (children, modules) => { - let size = 0; - const sizes = {}; - for (const module of children) { - size += module.size; - for (const key of Object.keys(module.sizes)) { - sizes[key] = (sizes[key] || 0) + module.sizes[key]; - } +/** + * @param {InputFileSystem|OutputFileSystem|undefined} fs a file system + * @param {string} rootPath a path + * @param {string} filename a filename + * @returns {string} the joined path + */ +const join = (fs, rootPath, filename) => { + if (fs && fs.join) { + return fs.join(rootPath, filename); + } else if (path.posix.isAbsolute(rootPath)) { + return path.posix.join(rootPath, filename); + } else if (path.win32.isAbsolute(rootPath)) { + return path.win32.join(rootPath, filename); + } else { + throw new Error( + `${rootPath} is neither a posix nor a windows path, and there is no 'join' method defined in the file system` + ); } - return { - size, - sizes - }; }; +exports.join = join; -const reasonGroup = (children, reasons) => { - let active = false; - for (const reason of children) { - active = active || reason.active; +/** + * @param {InputFileSystem|OutputFileSystem|undefined} fs a file system + * @param {string} absPath an absolute path + * @returns {string} the parent directory of the absolute path + */ +const dirname = (fs, absPath) => { + if (fs && fs.dirname) { + return fs.dirname(absPath); + } else if (path.posix.isAbsolute(absPath)) { + return path.posix.dirname(absPath); + } else if (path.win32.isAbsolute(absPath)) { + return path.win32.dirname(absPath); + } else { + throw new Error( + `${absPath} is neither a posix nor a windows path, and there is no 'dirname' method defined in the file system` + ); } - return { - active - }; }; +exports.dirname = dirname; -const GROUP_EXTENSION_REGEXP = /(\.[^.]+?)(?:\?|(?: \+ \d+ modules?)?$)/; -const GROUP_PATH_REGEXP = /(.+)[/\\][^/\\]+?(?:\?|(?: \+ \d+ modules?)?$)/; - -/** @type {Record void>} */ -const ASSETS_GROUPERS = { - _: (groupConfigs, context, options) => { - const groupByFlag = (name, exclude) => { - groupConfigs.push({ - getKeys: asset => { - return asset[name] ? ["1"] : undefined; - }, - getOptions: () => { - return { - groupChildren: !exclude, - force: exclude - }; - }, - createGroup: (key, children, assets) => { - return exclude - ? { - type: "assets by status", - [name]: !!key, - filteredChildren: assets.length, - ...assetGroup(children, assets) - } - : { - type: "assets by status", - [name]: !!key, - children, - ...assetGroup(children, assets) - }; +/** + * @param {OutputFileSystem} fs a file system + * @param {string} p an absolute path + * @param {function(Error=): void} callback callback function for the error + * @returns {void} + */ +const mkdirp = (fs, p, callback) => { + fs.mkdir(p, err => { + if (err) { + if (err.code === "ENOENT") { + const dir = dirname(fs, p); + if (dir === p) { + callback(err); + return; } - }); - }; - const { - groupAssetsByEmitStatus, - groupAssetsByPath, - groupAssetsByExtension - } = options; - if (groupAssetsByEmitStatus) { - groupByFlag("emitted"); - groupByFlag("comparedForEmit"); - groupByFlag("isOverSizeLimit"); - } - if (groupAssetsByEmitStatus || !options.cachedAssets) { - groupByFlag("cached", !options.cachedAssets); - } - if (groupAssetsByPath || groupAssetsByExtension) { - groupConfigs.push({ - getKeys: asset => { - const extensionMatch = - groupAssetsByExtension && GROUP_EXTENSION_REGEXP.exec(asset.name); - const extension = extensionMatch ? extensionMatch[1] : ""; - const pathMatch = - groupAssetsByPath && GROUP_PATH_REGEXP.exec(asset.name); - const path = pathMatch ? pathMatch[1].split(/[/\\]/) : []; - const keys = []; - if (groupAssetsByPath) { - keys.push("."); - if (extension) - keys.push( - path.length - ? `${path.join("/")}/*${extension}` - : `*${extension}` - ); - while (path.length > 0) { - keys.push(path.join("/") + "/"); - path.pop(); - } - } else { - if (extension) keys.push(`*${extension}`); + mkdirp(fs, dir, err => { + if (err) { + callback(err); + return; } - return keys; - }, - createGroup: (key, children, assets) => { - return { - type: groupAssetsByPath ? "assets by path" : "assets by extension", - name: key, - children, - ...assetGroup(children, assets) - }; - } - }); + fs.mkdir(p, err => { + if (err) { + if (err.code === "EEXIST") { + callback(); + return; + } + callback(err); + return; + } + callback(); + }); + }); + return; + } else if (err.code === "EEXIST") { + callback(); + return; + } + callback(err); + return; } - }, - groupAssetsByInfo: (groupConfigs, context, options) => { - const groupByAssetInfoFlag = name => { - groupConfigs.push({ - getKeys: asset => { - return asset.info && asset.info[name] ? ["1"] : undefined; - }, - createGroup: (key, children, assets) => { - return { - type: "assets by info", - info: { - [name]: !!key - }, - children, - ...assetGroup(children, assets) - }; - } - }); - }; - groupByAssetInfoFlag("immutable"); - groupByAssetInfoFlag("development"); - groupByAssetInfoFlag("hotModuleReplacement"); - }, - groupAssetsByChunk: (groupConfigs, context, options) => { - const groupByNames = name => { - groupConfigs.push({ - getKeys: asset => { - return asset[name]; - }, - createGroup: (key, children, assets) => { - return { - type: "assets by chunk", - [name]: [key], - children, - ...assetGroup(children, assets) - }; + callback(); + }); +}; +exports.mkdirp = mkdirp; + +/** + * @param {IntermediateFileSystem} fs a file system + * @param {string} p an absolute path + * @returns {void} + */ +const mkdirpSync = (fs, p) => { + try { + fs.mkdirSync(p); + } catch (err) { + if (err) { + if (err.code === "ENOENT") { + const dir = dirname(fs, p); + if (dir === p) { + throw err; } - }); - }; - groupByNames("chunkNames"); - groupByNames("auxiliaryChunkNames"); - groupByNames("chunkIdHints"); - groupByNames("auxiliaryChunkIdHints"); - }, - excludeAssets: (groupConfigs, context, { excludeAssets }) => { - groupConfigs.push({ - getKeys: asset => { - const ident = asset.name; - const excluded = excludeAssets.some(fn => fn(ident, asset)); - if (excluded) return ["excluded"]; - }, - getOptions: () => ({ - groupChildren: false, - force: true - }), - createGroup: (key, children, assets) => ({ - type: "hidden assets", - filteredChildren: assets.length, - ...assetGroup(children, assets) - }) - }); + mkdirpSync(fs, dir); + fs.mkdirSync(p); + return; + } else if (err.code === "EEXIST") { + return; + } + throw err; + } } }; +exports.mkdirpSync = mkdirpSync; -/** @type {function("module" | "chunk" | "root-of-chunk" | "nested"): Record void>} */ -const MODULES_GROUPERS = type => ({ - _: (groupConfigs, context, options) => { - const groupByFlag = (name, type, exclude) => { - groupConfigs.push({ - getKeys: module => { - return module[name] ? ["1"] : undefined; - }, - getOptions: () => { - return { - groupChildren: !exclude, - force: exclude - }; - }, - createGroup: (key, children, modules) => { - return { - type, - [name]: !!key, - ...(exclude ? { filteredChildren: modules.length } : { children }), - ...moduleGroup(children, modules) - }; +/** + * @param {InputFileSystem} fs a file system + * @param {string} p an absolute path + * @param {ReadJsonCallback} callback callback + * @returns {void} + */ +const readJson = (fs, p, callback) => { + if ("readJson" in fs) return fs.readJson(p, callback); + fs.readFile(p, (err, buf) => { + if (err) return callback(err); + let data; + try { + data = JSON.parse(buf.toString("utf-8")); + } catch (e) { + return callback(e); + } + return callback(null, data); + }); +}; +exports.readJson = readJson; + +/** + * @param {InputFileSystem} fs a file system + * @param {string} p an absolute path + * @param {ReadJsonCallback} callback callback + * @returns {void} + */ +const lstatReadlinkAbsolute = (fs, p, callback) => { + let i = 3; + const doReadLink = () => { + fs.readlink(p, (err, target) => { + if (err && --i > 0) { + // It might was just changed from symlink to file + // we retry 2 times to catch this case before throwing the error + return doStat(); + } + if (err || !target) return doStat(); + const value = target.toString(); + callback(null, join(fs, dirname(fs, p), value)); + }); + }; + const doStat = () => { + if ("lstat" in fs) { + return fs.lstat(p, (err, stats) => { + if (err) return callback(err); + if (stats.isSymbolicLink()) { + return doReadLink(); } + callback(null, stats); }); - }; - const { - groupModulesByCacheStatus, - groupModulesByLayer, - groupModulesByAttributes, - groupModulesByType, - groupModulesByPath, - groupModulesByExtension - } = options; - if (groupModulesByAttributes) { - groupByFlag("errors", "modules with errors"); - groupByFlag("warnings", "modules with warnings"); - groupByFlag("assets", "modules with assets"); - groupByFlag("optional", "optional modules"); + } else { + return fs.stat(p, callback); } - if (groupModulesByCacheStatus) { - groupByFlag("cacheable", "cacheable modules"); - groupByFlag("built", "built modules"); - groupByFlag("codeGenerated", "code generated modules"); + }; + if ("lstat" in fs) return doStat(); + doReadLink(); +}; +exports.lstatReadlinkAbsolute = lstatReadlinkAbsolute; + + +/***/ }), + +/***/ 59461: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const Hash = __webpack_require__(36692); +const MAX_SHORT_STRING = (__webpack_require__(1842).MAX_SHORT_STRING); + +class BatchedHash extends Hash { + constructor(hash) { + super(); + this.string = undefined; + this.encoding = undefined; + this.hash = hash; + } + + /** + * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} + * @param {string|Buffer} data data + * @param {string=} inputEncoding data encoding + * @returns {this} updated hash + */ + update(data, inputEncoding) { + if (this.string !== undefined) { + if ( + typeof data === "string" && + inputEncoding === this.encoding && + this.string.length + data.length < MAX_SHORT_STRING + ) { + this.string += data; + return this; + } + this.hash.update(this.string, this.encoding); + this.string = undefined; } - if (groupModulesByCacheStatus || !options.cachedModules) { - groupByFlag("cached", "cached modules", !options.cachedModules); + if (typeof data === "string") { + if ( + data.length < MAX_SHORT_STRING && + // base64 encoding is not valid since it may contain padding chars + (!inputEncoding || !inputEncoding.startsWith("ba")) + ) { + this.string = data; + this.encoding = inputEncoding; + } else { + this.hash.update(data, inputEncoding); + } + } else { + this.hash.update(data); } - if (groupModulesByAttributes || !options.orphanModules) { - groupByFlag("orphan", "orphan modules", !options.orphanModules); + return this; + } + + /** + * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} + * @param {string=} encoding encoding of the return value + * @returns {string|Buffer} digest + */ + digest(encoding) { + if (this.string !== undefined) { + this.hash.update(this.string, this.encoding); } - if (groupModulesByAttributes || !options.dependentModules) { - groupByFlag("dependent", "dependent modules", !options.dependentModules); + return this.hash.digest(encoding); + } +} + +module.exports = BatchedHash; + + +/***/ }), + +/***/ 86884: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const create = __webpack_require__(1842); + +//#region wasm code: md4 (../../../assembly/hash/md4.asm.ts) --initialMemory 1 +const md4 = new WebAssembly.Module( + Buffer.from( + // 2156 bytes + "AGFzbQEAAAABCAJgAX8AYAAAAwUEAQAAAAUDAQABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwciBARpbml0AAAGdXBkYXRlAAIFZmluYWwAAwZtZW1vcnkCAAqLEAQmAEGBxpS6BiQBQYnXtv5+JAJB/rnrxXkkA0H2qMmBASQEQQAkAAvSCgEZfyMBIQUjAiECIwMhAyMEIQQDQCAAIAFLBEAgASgCJCISIAEoAiAiEyABKAIcIgkgASgCGCIIIAEoAhQiByABKAIQIg4gASgCDCIGIAEoAggiDyABKAIEIhAgASgCACIRIAMgBHMgAnEgBHMgBWpqQQN3IgogAiADc3EgA3MgBGpqQQd3IgsgAiAKc3EgAnMgA2pqQQt3IgwgCiALc3EgCnMgAmpqQRN3Ig0gCyAMc3EgC3MgCmpqQQN3IgogDCANc3EgDHMgC2pqQQd3IgsgCiANc3EgDXMgDGpqQQt3IgwgCiALc3EgCnMgDWpqQRN3Ig0gCyAMc3EgC3MgCmpqQQN3IhQgDCANc3EgDHMgC2pqQQd3IRUgASgCLCILIAEoAigiCiAMIA0gDSAUcyAVcXNqakELdyIWIBQgFXNxIBRzIA1qakETdyEXIAEoAjQiGCABKAIwIhkgFSAWcyAXcSAVcyAUampBA3ciFCAWIBdzcSAWcyAVampBB3chFSABKAI8Ig0gASgCOCIMIBQgF3MgFXEgF3MgFmpqQQt3IhYgFCAVc3EgFHMgF2pqQRN3IRcgEyAOIBEgFCAVIBZyIBdxIBUgFnFyampBmfOJ1AVqQQN3IhQgFiAXcnEgFiAXcXIgFWpqQZnzidQFakEFdyIVIBQgF3JxIBQgF3FyIBZqakGZ84nUBWpBCXchFiAPIBggEiAWIAcgFSAQIBQgGSAUIBVyIBZxIBQgFXFyIBdqakGZ84nUBWpBDXciFCAVIBZycSAVIBZxcmpqQZnzidQFakEDdyIVIBQgFnJxIBQgFnFyampBmfOJ1AVqQQV3IhcgFCAVcnEgFCAVcXJqakGZ84nUBWpBCXciFiAVIBdycSAVIBdxciAUampBmfOJ1AVqQQ13IhQgFiAXcnEgFiAXcXIgFWpqQZnzidQFakEDdyEVIBEgBiAVIAwgFCAKIBYgCCAUIBZyIBVxIBQgFnFyIBdqakGZ84nUBWpBBXciFyAUIBVycSAUIBVxcmpqQZnzidQFakEJdyIWIBUgF3JxIBUgF3FyampBmfOJ1AVqQQ13IhQgFiAXcnEgFiAXcXJqakGZ84nUBWpBA3ciFSALIBYgCSAUIBZyIBVxIBQgFnFyIBdqakGZ84nUBWpBBXciFiAUIBVycSAUIBVxcmpqQZnzidQFakEJdyIXIA0gFSAWciAXcSAVIBZxciAUampBmfOJ1AVqQQ13IhRzIBZzampBodfn9gZqQQN3IREgByAIIA4gFCARIBcgESAUc3MgFmogE2pBodfn9gZqQQl3IhNzcyAXampBodfn9gZqQQt3Ig4gDyARIBMgDiARIA4gE3NzIBRqIBlqQaHX5/YGakEPdyIRc3NqakGh1+f2BmpBA3ciDyAOIA8gEXNzIBNqIApqQaHX5/YGakEJdyIKcyARc2pqQaHX5/YGakELdyIIIBAgDyAKIAggDCAPIAggCnNzIBFqakGh1+f2BmpBD3ciDHNzampBodfn9gZqQQN3Ig4gEiAIIAwgDnNzIApqakGh1+f2BmpBCXciCHMgDHNqakGh1+f2BmpBC3chByAFIAYgCCAHIBggDiAHIAhzcyAMampBodfn9gZqQQ93IgpzcyAOampBodfn9gZqQQN3IgZqIQUgDSAGIAkgByAGIAsgByAGIApzcyAIampBodfn9gZqQQl3IgdzIApzampBodfn9gZqQQt3IgYgB3NzIApqakGh1+f2BmpBD3cgAmohAiADIAZqIQMgBCAHaiEEIAFBQGshAQwBCwsgBSQBIAIkAiADJAMgBCQECw0AIAAQASAAIwBqJAAL/wQCA38BfiAAIwBqrUIDhiEEIABByABqQUBxIgJBCGshAyAAIgFBAWohACABQYABOgAAA0AgACACSUEAIABBB3EbBEAgAEEAOgAAIABBAWohAAwBCwsDQCAAIAJJBEAgAEIANwMAIABBCGohAAwBCwsgAyAENwMAIAIQAUEAIwGtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEIIwKtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEQIwOtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEYIwStIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAAs=", + "base64" + ) +); +//#endregion + +module.exports = create.bind(null, md4, [], 64, 32); + + +/***/ }), + +/***/ 1842: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +// 65536 is the size of a wasm memory page +// 64 is the maximum chunk size for every possible wasm hash implementation +// 4 is the maximum number of bytes per char for string encoding (max is utf-8) +// ~3 makes sure that it's always a block of 4 chars, so avoid partially encoded bytes for base64 +const MAX_SHORT_STRING = Math.floor((65536 - 64) / 4) & ~3; + +class WasmHash { + /** + * @param {WebAssembly.Instance} instance wasm instance + * @param {WebAssembly.Instance[]} instancesPool pool of instances + * @param {number} chunkSize size of data chunks passed to wasm + * @param {number} digestSize size of digest returned by wasm + */ + constructor(instance, instancesPool, chunkSize, digestSize) { + const exports = /** @type {any} */ (instance.exports); + exports.init(); + this.exports = exports; + this.mem = Buffer.from(exports.memory.buffer, 0, 65536); + this.buffered = 0; + this.instancesPool = instancesPool; + this.chunkSize = chunkSize; + this.digestSize = digestSize; + } + + reset() { + this.buffered = 0; + this.exports.init(); + } + + /** + * @param {Buffer | string} data data + * @param {BufferEncoding=} encoding encoding + * @returns {this} itself + */ + update(data, encoding) { + if (typeof data === "string") { + while (data.length > MAX_SHORT_STRING) { + this._updateWithShortString(data.slice(0, MAX_SHORT_STRING), encoding); + data = data.slice(MAX_SHORT_STRING); + } + this._updateWithShortString(data, encoding); + return this; } - if (groupModulesByType || !options.runtimeModules) { - groupConfigs.push({ - getKeys: module => { - if (!module.moduleType) return; - if (groupModulesByType) { - return [module.moduleType.split("/", 1)[0]]; - } else if (module.moduleType === "runtime") { - return ["runtime"]; + this._updateWithBuffer(data); + return this; + } + + /** + * @param {string} data data + * @param {BufferEncoding=} encoding encoding + * @returns {void} + */ + _updateWithShortString(data, encoding) { + const { exports, buffered, mem, chunkSize } = this; + let endPos; + if (data.length < 70) { + if (!encoding || encoding === "utf-8" || encoding === "utf8") { + endPos = buffered; + for (let i = 0; i < data.length; i++) { + const cc = data.charCodeAt(i); + if (cc < 0x80) mem[endPos++] = cc; + else if (cc < 0x800) { + mem[endPos] = (cc >> 6) | 0xc0; + mem[endPos + 1] = (cc & 0x3f) | 0x80; + endPos += 2; + } else { + // bail-out for weird chars + endPos += mem.write(data.slice(i), endPos, encoding); + break; } - }, - getOptions: key => { - const exclude = key === "runtime" && !options.runtimeModules; - return { - groupChildren: !exclude, - force: exclude - }; - }, - createGroup: (key, children, modules) => { - const exclude = key === "runtime" && !options.runtimeModules; - return { - type: `${key} modules`, - moduleType: key, - ...(exclude ? { filteredChildren: modules.length } : { children }), - ...moduleGroup(children, modules) - }; } - }); - } - if (groupModulesByLayer) { - groupConfigs.push({ - getKeys: module => { - return [module.layer]; - }, - createGroup: (key, children, modules) => { - return { - type: "modules by layer", - layer: key, - children, - ...moduleGroup(children, modules) - }; + } else if (encoding === "latin1") { + endPos = buffered; + for (let i = 0; i < data.length; i++) { + const cc = data.charCodeAt(i); + mem[endPos++] = cc; } - }); + } else { + endPos = buffered + mem.write(data, buffered, encoding); + } + } else { + endPos = buffered + mem.write(data, buffered, encoding); } - if (groupModulesByPath || groupModulesByExtension) { - groupConfigs.push({ - getKeys: module => { - if (!module.name) return; - const resource = parseResource(module.name.split("!").pop()).path; - const dataUrl = /^data:[^,;]+/.exec(resource); - if (dataUrl) return [dataUrl[0]]; - const extensionMatch = - groupModulesByExtension && GROUP_EXTENSION_REGEXP.exec(resource); - const extension = extensionMatch ? extensionMatch[1] : ""; - const pathMatch = - groupModulesByPath && GROUP_PATH_REGEXP.exec(resource); - const path = pathMatch ? pathMatch[1].split(/[/\\]/) : []; - const keys = []; - if (groupModulesByPath) { - if (extension) - keys.push( - path.length - ? `${path.join("/")}/*${extension}` - : `*${extension}` - ); - while (path.length > 0) { - keys.push(path.join("/") + "/"); - path.pop(); - } - } else { - if (extension) keys.push(`*${extension}`); - } - return keys; - }, - createGroup: (key, children, modules) => { - const isDataUrl = key.startsWith("data:"); - return { - type: isDataUrl - ? "modules by mime type" - : groupModulesByPath - ? "modules by path" - : "modules by extension", - name: isDataUrl ? key.slice(/* 'data:'.length */ 5) : key, - children, - ...moduleGroup(children, modules) - }; - } - }); + if (endPos < chunkSize) { + this.buffered = endPos; + } else { + const l = endPos & ~(this.chunkSize - 1); + exports.update(l); + const newBuffered = endPos - l; + this.buffered = newBuffered; + if (newBuffered > 0) mem.copyWithin(0, l, endPos); } - }, - excludeModules: (groupConfigs, context, { excludeModules }) => { - groupConfigs.push({ - getKeys: module => { - const name = module.name; - if (name) { - const excluded = excludeModules.some(fn => fn(name, module, type)); - if (excluded) return ["1"]; - } - }, - getOptions: () => ({ - groupChildren: false, - force: true - }), - createGroup: (key, children, modules) => ({ - type: "hidden modules", - filteredChildren: children.length, - ...moduleGroup(children, modules) - }) - }); } -}); -/** @type {Record void>>} */ -const RESULT_GROUPERS = { - "compilation.assets": ASSETS_GROUPERS, - "asset.related": ASSETS_GROUPERS, - "compilation.modules": MODULES_GROUPERS("module"), - "chunk.modules": MODULES_GROUPERS("chunk"), - "chunk.rootModules": MODULES_GROUPERS("root-of-chunk"), - "module.modules": MODULES_GROUPERS("nested"), - "module.reasons": { - groupReasonsByOrigin: groupConfigs => { - groupConfigs.push({ - getKeys: reason => { - return [reason.module]; - }, - createGroup: (key, children, reasons) => { - return { - type: "from origin", - module: key, - children, - ...reasonGroup(children, reasons) - }; + /** + * @param {Buffer} data data + * @returns {void} + */ + _updateWithBuffer(data) { + const { exports, buffered, mem } = this; + const length = data.length; + if (buffered + length < this.chunkSize) { + data.copy(mem, buffered, 0, length); + this.buffered += length; + } else { + const l = (buffered + length) & ~(this.chunkSize - 1); + if (l > 65536) { + let i = 65536 - buffered; + data.copy(mem, buffered, 0, i); + exports.update(65536); + const stop = l - buffered - 65536; + while (i < stop) { + data.copy(mem, 0, i, i + 65536); + exports.update(65536); + i += 65536; } - }); + data.copy(mem, 0, i, l - buffered); + exports.update(l - buffered - i); + } else { + data.copy(mem, buffered, 0, l - buffered); + exports.update(l); + } + const newBuffered = length + buffered - l; + this.buffered = newBuffered; + if (newBuffered > 0) data.copy(mem, 0, length - newBuffered, length); } } -}; -// remove a prefixed "!" that can be specified to reverse sort order -const normalizeFieldKey = field => { - if (field[0] === "!") { - return field.substr(1); + digest(type) { + const { exports, buffered, mem, digestSize } = this; + exports.final(buffered); + this.instancesPool.push(this); + const hex = mem.toString("latin1", 0, digestSize); + if (type === "hex") return hex; + if (type === "binary" || !type) return Buffer.from(hex, "hex"); + return Buffer.from(hex, "hex").toString(type); } - return field; -}; +} -// if a field is prefixed by a "!" reverse sort order -const sortOrderRegular = field => { - if (field[0] === "!") { - return false; +const create = (wasmModule, instancesPool, chunkSize, digestSize) => { + if (instancesPool.length > 0) { + const old = instancesPool.pop(); + old.reset(); + return old; + } else { + return new WasmHash( + new WebAssembly.Instance(wasmModule), + instancesPool, + chunkSize, + digestSize + ); } - return true; }; -/** - * @param {string} field field name - * @returns {function(Object, Object): number} comparators - */ -const sortByField = field => { - if (!field) { - /** - * @param {any} a first - * @param {any} b second - * @returns {-1|0|1} zero - */ - const noSort = (a, b) => 0; - return noSort; - } +module.exports = create; +module.exports.MAX_SHORT_STRING = MAX_SHORT_STRING; - const fieldKey = normalizeFieldKey(field); - let sortFn = compareSelect(m => m[fieldKey], compareIds); +/***/ }), - // if a field is prefixed with a "!" the sort is reversed! - const sortIsRegular = sortOrderRegular(field); +/***/ 35028: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (!sortIsRegular) { - const oldSortFn = sortFn; - sortFn = (a, b) => oldSortFn(b, a); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - return sortFn; -}; -const ASSET_SORTERS = { - /** @type {(comparators: Function[], context: StatsFactoryContext, options: NormalizedStatsOptions) => void} */ - assetsSort: (comparators, context, { assetsSort }) => { - comparators.push(sortByField(assetsSort)); - }, - _: comparators => { - comparators.push(compareSelect(a => a.name, compareIds)); - } -}; -/** @type {Record void>>} */ -const RESULT_SORTERS = { - "compilation.chunks": { - chunksSort: (comparators, context, { chunksSort }) => { - comparators.push(sortByField(chunksSort)); - } - }, - "compilation.modules": { - modulesSort: (comparators, context, { modulesSort }) => { - comparators.push(sortByField(modulesSort)); - } - }, - "chunk.modules": { - chunkModulesSort: (comparators, context, { chunkModulesSort }) => { - comparators.push(sortByField(chunkModulesSort)); - } - }, - "module.modules": { - nestedModulesSort: (comparators, context, { nestedModulesSort }) => { - comparators.push(sortByField(nestedModulesSort)); - } - }, - "compilation.assets": ASSET_SORTERS, - "asset.related": ASSET_SORTERS +const create = __webpack_require__(1842); + +//#region wasm code: xxhash64 (../../../assembly/hash/xxhash64.asm.ts) --initialMemory 1 +const xxhash64 = new WebAssembly.Module( + Buffer.from( + // 1170 bytes + "AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrIIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEEIAUgASkDGELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEFIAAgAUEgaiIBSw0ACyACJAAgAyQBIAQkAiAFJAMLqAYCAX8EfiMEQgBSBH4jACICQgGJIwEiA0IHiXwjAiIEQgyJfCMDIgVCEol8IAJCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0gA0LP1tO+0ser2UJ+Qh+JQoeVr6+Ytt6bnn9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSAEQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IAVCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0FQsXP2bLx5brqJwsjBCAArXx8IQIDQCABQQhqIABNBEAgAiABKQMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQIgAUEIaiEBDAELCyABQQRqIABNBEAgAiABNQIAQoeVr6+Ytt6bnn9+hUIXiULP1tO+0ser2UJ+Qvnz3fGZ9pmrFnwhAiABQQRqIQELA0AgACABRwRAIAIgATEAAELFz9my8eW66id+hUILiUKHla+vmLbem55/fiECIAFBAWohAQwBCwtBACACIAJCIYiFQs/W077Sx6vZQn4iAkIdiCAChUL5893xmfaZqxZ+IgJCIIggAoUiAkIgiCIDQv//A4NCIIYgA0KAgPz/D4NCEIiEIgNC/4GAgPAfg0IQhiADQoD+g4CA4D+DQgiIhCIDQo+AvIDwgcAHg0IIhiADQvCBwIeAnoD4AINCBIiEIgNChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IANCsODAgYOGjJgwhHw3AwBBCCACQv////8PgyICQv//A4NCIIYgAkKAgPz/D4NCEIiEIgJC/4GAgPAfg0IQhiACQoD+g4CA4D+DQgiIhCICQo+AvIDwgcAHg0IIhiACQvCBwIeAnoD4AINCBIiEIgJChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IAJCsODAgYOGjJgwhHw3AwAL", + "base64" + ) +); +//#endregion + +module.exports = create.bind(null, xxhash64, [], 32, 16); + + +/***/ }), + +/***/ 82186: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +const path = __webpack_require__(71017); + +const WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/; +const SEGMENTS_SPLIT_REGEXP = /([|!])/; +const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g; + +/** + * @typedef {Object} MakeRelativePathsCache + * @property {Map>=} relativePaths + */ + +const relativePathToRequest = relativePath => { + if (relativePath === "") return "./."; + if (relativePath === "..") return "../."; + if (relativePath.startsWith("../")) return relativePath; + return `./${relativePath}`; }; /** - * @param {Record>} config the config see above - * @param {NormalizedStatsOptions} options stats options - * @param {function(string, Function): void} fn handler function called for every active line in config - * @returns {void} + * @param {string} context context for relative path + * @param {string} maybeAbsolutePath path to make relative + * @returns {string} relative path in request style */ -const iterateConfig = (config, options, fn) => { - for (const hookFor of Object.keys(config)) { - const subConfig = config[hookFor]; - for (const option of Object.keys(subConfig)) { - if (option !== "_") { - if (option.startsWith("!")) { - if (options[option.slice(1)]) continue; - } else { - const value = options[option]; - if ( - value === false || - value === undefined || - (Array.isArray(value) && value.length === 0) - ) - continue; - } - } - fn(hookFor, subConfig[option]); +const absoluteToRequest = (context, maybeAbsolutePath) => { + if (maybeAbsolutePath[0] === "/") { + if ( + maybeAbsolutePath.length > 1 && + maybeAbsolutePath[maybeAbsolutePath.length - 1] === "/" + ) { + // this 'path' is actually a regexp generated by dynamic requires. + // Don't treat it as an absolute path. + return maybeAbsolutePath; } + + const querySplitPos = maybeAbsolutePath.indexOf("?"); + let resource = + querySplitPos === -1 + ? maybeAbsolutePath + : maybeAbsolutePath.slice(0, querySplitPos); + resource = relativePathToRequest(path.posix.relative(context, resource)); + return querySplitPos === -1 + ? resource + : resource + maybeAbsolutePath.slice(querySplitPos); } -}; -/** @type {Record} */ -const ITEM_NAMES = { - "compilation.children[]": "compilation", - "compilation.modules[]": "module", - "compilation.entrypoints[]": "chunkGroup", - "compilation.namedChunkGroups[]": "chunkGroup", - "compilation.errors[]": "error", - "compilation.warnings[]": "warning", - "chunk.modules[]": "module", - "chunk.rootModules[]": "module", - "chunk.origins[]": "chunkOrigin", - "compilation.chunks[]": "chunk", - "compilation.assets[]": "asset", - "asset.related[]": "asset", - "module.issuerPath[]": "moduleIssuer", - "module.reasons[]": "moduleReason", - "module.modules[]": "module", - "module.children[]": "module", - "moduleTrace[]": "moduleTraceItem", - "moduleTraceItem.dependencies[]": "moduleTraceDependency" + if (WINDOWS_ABS_PATH_REGEXP.test(maybeAbsolutePath)) { + const querySplitPos = maybeAbsolutePath.indexOf("?"); + let resource = + querySplitPos === -1 + ? maybeAbsolutePath + : maybeAbsolutePath.slice(0, querySplitPos); + resource = path.win32.relative(context, resource); + if (!WINDOWS_ABS_PATH_REGEXP.test(resource)) { + resource = relativePathToRequest( + resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, "/") + ); + } + return querySplitPos === -1 + ? resource + : resource + maybeAbsolutePath.slice(querySplitPos); + } + + // not an absolute path + return maybeAbsolutePath; }; /** - * @param {Object[]} items items to be merged - * @returns {Object} an object + * @param {string} context context for relative path + * @param {string} relativePath path + * @returns {string} absolute path */ -const mergeToObject = items => { - const obj = Object.create(null); - for (const item of items) { - obj[item.name] = item; - } - return obj; +const requestToAbsolute = (context, relativePath) => { + if (relativePath.startsWith("./") || relativePath.startsWith("../")) + return path.join(context, relativePath); + return relativePath; }; -/** @type {Record any>} */ -const MERGER = { - "compilation.entrypoints": mergeToObject, - "compilation.namedChunkGroups": mergeToObject +const makeCacheable = realFn => { + /** @type {WeakMap>} */ + const cache = new WeakMap(); + + const getCache = associatedObjectForCache => { + const entry = cache.get(associatedObjectForCache); + if (entry !== undefined) return entry; + /** @type {Map} */ + const map = new Map(); + cache.set(associatedObjectForCache, map); + return map; + }; + + /** + * @param {string} str the path with query and fragment + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {ParsedResource} parsed parts + */ + const fn = (str, associatedObjectForCache) => { + if (!associatedObjectForCache) return realFn(str); + const cache = getCache(associatedObjectForCache); + const entry = cache.get(str); + if (entry !== undefined) return entry; + const result = realFn(str); + cache.set(str, result); + return result; + }; + + fn.bindCache = associatedObjectForCache => { + const cache = getCache(associatedObjectForCache); + return str => { + const entry = cache.get(str); + if (entry !== undefined) return entry; + const result = realFn(str); + cache.set(str, result); + return result; + }; + }; + + return fn; }; -class DefaultStatsFactoryPlugin { +const makeCacheableWithContext = fn => { + /** @type {WeakMap>>} */ + const cache = new WeakMap(); + /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {string} context context used to create relative path + * @param {string} identifier identifier used to create relative path + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {string} the returned relative path */ - apply(compiler) { - compiler.hooks.compilation.tap("DefaultStatsFactoryPlugin", compilation => { - compilation.hooks.statsFactory.tap( - "DefaultStatsFactoryPlugin", - (stats, options, context) => { - iterateConfig(SIMPLE_EXTRACTORS, options, (hookFor, fn) => { - stats.hooks.extract - .for(hookFor) - .tap("DefaultStatsFactoryPlugin", (obj, data, ctx) => - fn(obj, data, ctx, options, stats) - ); - }); - iterateConfig(FILTER, options, (hookFor, fn) => { - stats.hooks.filter - .for(hookFor) - .tap("DefaultStatsFactoryPlugin", (item, ctx, idx, i) => - fn(item, ctx, options, idx, i) - ); - }); - iterateConfig(FILTER_RESULTS, options, (hookFor, fn) => { - stats.hooks.filterResults - .for(hookFor) - .tap("DefaultStatsFactoryPlugin", (item, ctx, idx, i) => - fn(item, ctx, options, idx, i) - ); - }); - iterateConfig(SORTERS, options, (hookFor, fn) => { - stats.hooks.sort - .for(hookFor) - .tap("DefaultStatsFactoryPlugin", (comparators, ctx) => - fn(comparators, ctx, options) - ); - }); - iterateConfig(RESULT_SORTERS, options, (hookFor, fn) => { - stats.hooks.sortResults - .for(hookFor) - .tap("DefaultStatsFactoryPlugin", (comparators, ctx) => - fn(comparators, ctx, options) - ); - }); - iterateConfig(RESULT_GROUPERS, options, (hookFor, fn) => { - stats.hooks.groupResults - .for(hookFor) - .tap("DefaultStatsFactoryPlugin", (groupConfigs, ctx) => - fn(groupConfigs, ctx, options) - ); - }); - for (const key of Object.keys(ITEM_NAMES)) { - const itemName = ITEM_NAMES[key]; - stats.hooks.getItemName - .for(key) - .tap("DefaultStatsFactoryPlugin", () => itemName); - } - for (const key of Object.keys(MERGER)) { - const merger = MERGER[key]; - stats.hooks.merge.for(key).tap("DefaultStatsFactoryPlugin", merger); - } - if (options.children) { - if (Array.isArray(options.children)) { - stats.hooks.getItemFactory - .for("compilation.children[].compilation") - .tap("DefaultStatsFactoryPlugin", (comp, { _index: idx }) => { - if (idx < options.children.length) { - return compilation.createStatsFactory( - compilation.createStatsOptions( - options.children[idx], - context - ) - ); - } - }); - } else if (options.children !== true) { - const childFactory = compilation.createStatsFactory( - compilation.createStatsOptions(options.children, context) - ); - stats.hooks.getItemFactory - .for("compilation.children[].compilation") - .tap("DefaultStatsFactoryPlugin", () => { - return childFactory; - }); - } - } - } - ); - }); - } -} -module.exports = DefaultStatsFactoryPlugin; + const cachedFn = (context, identifier, associatedObjectForCache) => { + if (!associatedObjectForCache) return fn(context, identifier); + let innerCache = cache.get(associatedObjectForCache); + if (innerCache === undefined) { + innerCache = new Map(); + cache.set(associatedObjectForCache, innerCache); + } -/***/ }), + let cachedResult; + let innerSubCache = innerCache.get(context); + if (innerSubCache === undefined) { + innerCache.set(context, (innerSubCache = new Map())); + } else { + cachedResult = innerSubCache.get(identifier); + } -/***/ 55442: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (cachedResult !== undefined) { + return cachedResult; + } else { + const result = fn(context, identifier); + innerSubCache.set(identifier, result); + return result; + } + }; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + /** + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {function(string, string): string} cached function + */ + cachedFn.bindCache = associatedObjectForCache => { + let innerCache; + if (associatedObjectForCache) { + innerCache = cache.get(associatedObjectForCache); + if (innerCache === undefined) { + innerCache = new Map(); + cache.set(associatedObjectForCache, innerCache); + } + } else { + innerCache = new Map(); + } + /** + * @param {string} context context used to create relative path + * @param {string} identifier identifier used to create relative path + * @returns {string} the returned relative path + */ + const boundFn = (context, identifier) => { + let cachedResult; + let innerSubCache = innerCache.get(context); + if (innerSubCache === undefined) { + innerCache.set(context, (innerSubCache = new Map())); + } else { + cachedResult = innerSubCache.get(identifier); + } + if (cachedResult !== undefined) { + return cachedResult; + } else { + const result = fn(context, identifier); + innerSubCache.set(identifier, result); + return result; + } + }; -const RequestShortener = __webpack_require__(73406); + return boundFn; + }; -/** @typedef {import("../../declarations/WebpackOptions").StatsOptions} StatsOptions */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Compilation").CreateStatsOptionsContext} CreateStatsOptionsContext */ -/** @typedef {import("../Compiler")} Compiler */ + /** + * @param {string} context context used to create relative path + * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @returns {function(string): string} cached function + */ + cachedFn.bindContextCache = (context, associatedObjectForCache) => { + let innerSubCache; + if (associatedObjectForCache) { + let innerCache = cache.get(associatedObjectForCache); + if (innerCache === undefined) { + innerCache = new Map(); + cache.set(associatedObjectForCache, innerCache); + } -const applyDefaults = (options, defaults) => { - for (const key of Object.keys(defaults)) { - if (typeof options[key] === "undefined") { - options[key] = defaults[key]; + innerSubCache = innerCache.get(context); + if (innerSubCache === undefined) { + innerCache.set(context, (innerSubCache = new Map())); + } + } else { + innerSubCache = new Map(); } - } + + /** + * @param {string} identifier identifier used to create relative path + * @returns {string} the returned relative path + */ + const boundFn = identifier => { + const cachedResult = innerSubCache.get(identifier); + if (cachedResult !== undefined) { + return cachedResult; + } else { + const result = fn(context, identifier); + innerSubCache.set(identifier, result); + return result; + } + }; + + return boundFn; + }; + + return cachedFn; }; -const NAMED_PRESETS = { - verbose: { - hash: true, - builtAt: true, - relatedAssets: true, - entrypoints: true, - chunkGroups: true, - ids: true, - modules: false, - chunks: true, - chunkRelations: true, - chunkModules: true, - dependentModules: true, - chunkOrigins: true, - depth: true, - env: true, - reasons: true, - usedExports: true, - providedExports: true, - optimizationBailout: true, - errorDetails: true, - errorStack: true, - publicPath: true, - logging: "verbose", - orphanModules: true, - runtimeModules: true, - exclude: false, - modulesSpace: Infinity, - chunkModulesSpace: Infinity, - assetsSpace: Infinity, - reasonsSpace: Infinity, - children: true - }, - detailed: { - hash: true, - builtAt: true, - relatedAssets: true, - entrypoints: true, - chunkGroups: true, - ids: true, - chunks: true, - chunkRelations: true, - chunkModules: false, - chunkOrigins: true, - depth: true, - usedExports: true, - providedExports: true, - optimizationBailout: true, - errorDetails: true, - publicPath: true, - logging: true, - runtimeModules: true, - exclude: false, - modulesSpace: 1000, - assetsSpace: 1000, - reasonsSpace: 1000 - }, - minimal: { - all: false, - version: true, - timings: true, - modules: true, - modulesSpace: 0, - assets: true, - assetsSpace: 0, - errors: true, - errorsCount: true, - warnings: true, - warningsCount: true, - logging: "warn" - }, - "errors-only": { - all: false, - errors: true, - errorsCount: true, - moduleTrace: true, - logging: "error" - }, - "errors-warnings": { - all: false, - errors: true, - errorsCount: true, - warnings: true, - warningsCount: true, - logging: "warn" - }, - summary: { - all: false, - version: true, - errorsCount: true, - warningsCount: true - }, - none: { - all: false - } +/** + * + * @param {string} context context for relative path + * @param {string} identifier identifier for path + * @returns {string} a converted relative path + */ +const _makePathsRelative = (context, identifier) => { + return identifier + .split(SEGMENTS_SPLIT_REGEXP) + .map(str => absoluteToRequest(context, str)) + .join(""); }; -const NORMAL_ON = ({ all }) => all !== false; -const NORMAL_OFF = ({ all }) => all === true; -const ON_FOR_TO_STRING = ({ all }, { forToString }) => - forToString ? all !== false : all === true; -const OFF_FOR_TO_STRING = ({ all }, { forToString }) => - forToString ? all === true : all !== false; -const AUTO_FOR_TO_STRING = ({ all }, { forToString }) => { - if (all === false) return false; - if (all === true) return true; - if (forToString) return "auto"; - return true; +exports.makePathsRelative = makeCacheableWithContext(_makePathsRelative); + +/** + * + * @param {string} context context for relative path + * @param {string} identifier identifier for path + * @returns {string} a converted relative path + */ +const _makePathsAbsolute = (context, identifier) => { + return identifier + .split(SEGMENTS_SPLIT_REGEXP) + .map(str => requestToAbsolute(context, str)) + .join(""); }; -/** @type {Record any>} */ -const DEFAULTS = { - context: (options, context, compilation) => compilation.compiler.context, - requestShortener: (options, context, compilation) => - compilation.compiler.context === options.context - ? compilation.requestShortener - : new RequestShortener(options.context, compilation.compiler.root), - performance: NORMAL_ON, - hash: OFF_FOR_TO_STRING, - env: NORMAL_OFF, - version: NORMAL_ON, - timings: NORMAL_ON, - builtAt: OFF_FOR_TO_STRING, - assets: NORMAL_ON, - entrypoints: AUTO_FOR_TO_STRING, - chunkGroups: OFF_FOR_TO_STRING, - chunkGroupAuxiliary: OFF_FOR_TO_STRING, - chunkGroupChildren: OFF_FOR_TO_STRING, - chunkGroupMaxAssets: (o, { forToString }) => (forToString ? 5 : Infinity), - chunks: OFF_FOR_TO_STRING, - chunkRelations: OFF_FOR_TO_STRING, - chunkModules: ({ all, modules }) => { - if (all === false) return false; - if (all === true) return true; - if (modules) return false; - return true; - }, - dependentModules: OFF_FOR_TO_STRING, - chunkOrigins: OFF_FOR_TO_STRING, - ids: OFF_FOR_TO_STRING, - modules: ({ all, chunks, chunkModules }, { forToString }) => { - if (all === false) return false; - if (all === true) return true; - if (forToString && chunks && chunkModules) return false; - return true; - }, - nestedModules: OFF_FOR_TO_STRING, - groupModulesByType: ON_FOR_TO_STRING, - groupModulesByCacheStatus: ON_FOR_TO_STRING, - groupModulesByLayer: ON_FOR_TO_STRING, - groupModulesByAttributes: ON_FOR_TO_STRING, - groupModulesByPath: ON_FOR_TO_STRING, - groupModulesByExtension: ON_FOR_TO_STRING, - modulesSpace: (o, { forToString }) => (forToString ? 15 : Infinity), - chunkModulesSpace: (o, { forToString }) => (forToString ? 10 : Infinity), - nestedModulesSpace: (o, { forToString }) => (forToString ? 10 : Infinity), - relatedAssets: OFF_FOR_TO_STRING, - groupAssetsByEmitStatus: ON_FOR_TO_STRING, - groupAssetsByInfo: ON_FOR_TO_STRING, - groupAssetsByPath: ON_FOR_TO_STRING, - groupAssetsByExtension: ON_FOR_TO_STRING, - groupAssetsByChunk: ON_FOR_TO_STRING, - assetsSpace: (o, { forToString }) => (forToString ? 15 : Infinity), - orphanModules: OFF_FOR_TO_STRING, - runtimeModules: ({ all, runtime }, { forToString }) => - runtime !== undefined - ? runtime - : forToString - ? all === true - : all !== false, - cachedModules: ({ all, cached }, { forToString }) => - cached !== undefined ? cached : forToString ? all === true : all !== false, - moduleAssets: OFF_FOR_TO_STRING, - depth: OFF_FOR_TO_STRING, - cachedAssets: OFF_FOR_TO_STRING, - reasons: OFF_FOR_TO_STRING, - reasonsSpace: (o, { forToString }) => (forToString ? 15 : Infinity), - groupReasonsByOrigin: ON_FOR_TO_STRING, - usedExports: OFF_FOR_TO_STRING, - providedExports: OFF_FOR_TO_STRING, - optimizationBailout: OFF_FOR_TO_STRING, - children: OFF_FOR_TO_STRING, - source: NORMAL_OFF, - moduleTrace: NORMAL_ON, - errors: NORMAL_ON, - errorsCount: NORMAL_ON, - errorDetails: AUTO_FOR_TO_STRING, - errorStack: OFF_FOR_TO_STRING, - warnings: NORMAL_ON, - warningsCount: NORMAL_ON, - publicPath: OFF_FOR_TO_STRING, - logging: ({ all }, { forToString }) => - forToString && all !== false ? "info" : false, - loggingDebug: () => [], - loggingTrace: OFF_FOR_TO_STRING, - excludeModules: () => [], - excludeAssets: () => [], - modulesSort: () => "depth", - chunkModulesSort: () => "name", - nestedModulesSort: () => false, - chunksSort: () => false, - assetsSort: () => "!size", - outputPath: OFF_FOR_TO_STRING, - colors: () => false +exports.makePathsAbsolute = makeCacheableWithContext(_makePathsAbsolute); + +/** + * @param {string} context absolute context path + * @param {string} request any request string may containing absolute paths, query string, etc. + * @returns {string} a new request string avoiding absolute paths when possible + */ +const _contextify = (context, request) => { + return request + .split("!") + .map(r => absoluteToRequest(context, r)) + .join("!"); }; -const normalizeFilter = item => { - if (typeof item === "string") { - const regExp = new RegExp( - `[\\\\/]${item.replace( - // eslint-disable-next-line no-useless-escape - /[-[\]{}()*+?.\\^$|]/g, - "\\$&" - )}([\\\\/]|$|!|\\?)` - ); - return ident => regExp.test(ident); - } - if (item && typeof item === "object" && typeof item.test === "function") { - return ident => item.test(ident); - } - if (typeof item === "function") { - return item; - } - if (typeof item === "boolean") { - return () => item; - } +const contextify = makeCacheableWithContext(_contextify); +exports.contextify = contextify; + +/** + * @param {string} context absolute context path + * @param {string} request any request string + * @returns {string} a new request string using absolute paths when possible + */ +const _absolutify = (context, request) => { + return request + .split("!") + .map(r => requestToAbsolute(context, r)) + .join("!"); +}; + +const absolutify = makeCacheableWithContext(_absolutify); +exports.absolutify = absolutify; + +const PATH_QUERY_FRAGMENT_REGEXP = + /^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/; +const PATH_QUERY_REGEXP = /^((?:\0.|[^?\0])*)(\?.*)?$/; + +/** @typedef {{ resource: string, path: string, query: string, fragment: string }} ParsedResource */ +/** @typedef {{ resource: string, path: string, query: string }} ParsedResourceWithoutFragment */ + +/** + * @param {string} str the path with query and fragment + * @returns {ParsedResource} parsed parts + */ +const _parseResource = str => { + const match = PATH_QUERY_FRAGMENT_REGEXP.exec(str); + return { + resource: str, + path: match[1].replace(/\0(.)/g, "$1"), + query: match[2] ? match[2].replace(/\0(.)/g, "$1") : "", + fragment: match[3] || "" + }; }; +exports.parseResource = makeCacheable(_parseResource); -const NORMALIZER = { - excludeModules: value => { - if (!Array.isArray(value)) { - value = value ? [value] : []; - } - return value.map(normalizeFilter); - }, - excludeAssets: value => { - if (!Array.isArray(value)) { - value = value ? [value] : []; - } - return value.map(normalizeFilter); - }, - warningsFilter: value => { - if (!Array.isArray(value)) { - value = value ? [value] : []; - } - return value.map(filter => { - if (typeof filter === "string") { - return (warning, warningString) => warningString.includes(filter); - } - if (filter instanceof RegExp) { - return (warning, warningString) => filter.test(warningString); - } - if (typeof filter === "function") { - return filter; - } - throw new Error( - `Can only filter warnings with Strings or RegExps. (Given: ${filter})` - ); - }); - }, - logging: value => { - if (value === true) value = "log"; - return value; - }, - loggingDebug: value => { - if (!Array.isArray(value)) { - value = value ? [value] : []; - } - return value.map(normalizeFilter); - } +/** + * Parse resource, skips fragment part + * @param {string} str the path with query and fragment + * @returns {ParsedResourceWithoutFragment} parsed parts + */ +const _parseResourceWithoutFragment = str => { + const match = PATH_QUERY_REGEXP.exec(str); + return { + resource: str, + path: match[1].replace(/\0(.)/g, "$1"), + query: match[2] ? match[2].replace(/\0(.)/g, "$1") : "" + }; }; +exports.parseResourceWithoutFragment = makeCacheable( + _parseResourceWithoutFragment +); -class DefaultStatsPresetPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap("DefaultStatsPresetPlugin", compilation => { - for (const key of Object.keys(NAMED_PRESETS)) { - const defaults = NAMED_PRESETS[key]; - compilation.hooks.statsPreset - .for(key) - .tap("DefaultStatsPresetPlugin", (options, context) => { - applyDefaults(options, defaults); - }); +/** + * @param {string} filename the filename which should be undone + * @param {string} outputPath the output path that is restored (only relevant when filename contains "..") + * @param {boolean} enforceRelative true returns ./ for empty paths + * @returns {string} repeated ../ to leave the directory of the provided filename to be back on output dir + */ +exports.getUndoPath = (filename, outputPath, enforceRelative) => { + let depth = -1; + let append = ""; + outputPath = outputPath.replace(/[\\/]$/, ""); + for (const part of filename.split(/[/\\]+/)) { + if (part === "..") { + if (depth > -1) { + depth--; + } else { + const i = outputPath.lastIndexOf("/"); + const j = outputPath.lastIndexOf("\\"); + const pos = i < 0 ? j : j < 0 ? i : Math.max(i, j); + if (pos < 0) return outputPath + "/"; + append = outputPath.slice(pos + 1) + "/" + append; + outputPath = outputPath.slice(0, pos); } - compilation.hooks.statsNormalize.tap( - "DefaultStatsPresetPlugin", - (options, context) => { - for (const key of Object.keys(DEFAULTS)) { - if (options[key] === undefined) - options[key] = DEFAULTS[key](options, context, compilation); - } - for (const key of Object.keys(NORMALIZER)) { - options[key] = NORMALIZER[key](options[key]); - } - } - ); - }); + } else if (part !== ".") { + depth++; + } } -} -module.exports = DefaultStatsPresetPlugin; + return depth > 0 + ? `${"../".repeat(depth)}${append}` + : enforceRelative + ? `./${append}` + : append; +}; /***/ }), -/***/ 58692: +/***/ 53023: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -126560,1385 +127317,876 @@ module.exports = DefaultStatsPresetPlugin; -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("./StatsPrinter")} StatsPrinter */ -/** @typedef {import("./StatsPrinter").StatsPrinterContext} StatsPrinterContext */ - -const DATA_URI_CONTENT_LENGTH = 16; - -const plural = (n, singular, plural) => (n === 1 ? singular : plural); +// We need to include a list of requires here +// to allow webpack to be bundled with only static requires +// We could use a dynamic require(`../${request}`) but this +// would include too many modules and not every tool is able +// to process this +module.exports = { + AsyncDependenciesBlock: () => __webpack_require__(47736), + CommentCompilationWarning: () => __webpack_require__(98427), + ContextModule: () => __webpack_require__(76729), + "cache/PackFileCacheStrategy": () => + __webpack_require__(86180), + "cache/ResolverCachePlugin": () => __webpack_require__(97347), + "container/ContainerEntryDependency": () => + __webpack_require__(64813), + "container/ContainerEntryModule": () => + __webpack_require__(80580), + "container/ContainerExposedDependency": () => + __webpack_require__(72374), + "container/FallbackDependency": () => + __webpack_require__(57764), + "container/FallbackItemDependency": () => + __webpack_require__(29593), + "container/FallbackModule": () => __webpack_require__(82886), + "container/RemoteModule": () => __webpack_require__(62916), + "container/RemoteToExternalDependency": () => + __webpack_require__(14389), + "dependencies/AMDDefineDependency": () => + __webpack_require__(96816), + "dependencies/AMDRequireArrayDependency": () => + __webpack_require__(33516), + "dependencies/AMDRequireContextDependency": () => + __webpack_require__(96123), + "dependencies/AMDRequireDependenciesBlock": () => + __webpack_require__(76932), + "dependencies/AMDRequireDependency": () => + __webpack_require__(43911), + "dependencies/AMDRequireItemDependency": () => + __webpack_require__(71806), + "dependencies/CachedConstDependency": () => + __webpack_require__(57403), + "dependencies/CreateScriptUrlDependency": () => + __webpack_require__(79062), + "dependencies/CommonJsRequireContextDependency": () => + __webpack_require__(23962), + "dependencies/CommonJsExportRequireDependency": () => + __webpack_require__(62892), + "dependencies/CommonJsExportsDependency": () => + __webpack_require__(45598), + "dependencies/CommonJsFullRequireDependency": () => + __webpack_require__(59440), + "dependencies/CommonJsRequireDependency": () => + __webpack_require__(21264), + "dependencies/CommonJsSelfReferenceDependency": () => + __webpack_require__(52225), + "dependencies/ConstDependency": () => + __webpack_require__(76911), + "dependencies/ContextDependency": () => + __webpack_require__(88101), + "dependencies/ContextElementDependency": () => + __webpack_require__(58477), + "dependencies/CriticalDependencyWarning": () => + __webpack_require__(15427), + "dependencies/CssImportDependency": () => + __webpack_require__(90542), + "dependencies/CssLocalIdentifierDependency": () => + __webpack_require__(92328), + "dependencies/CssSelfLocalIdentifierDependency": () => + __webpack_require__(29094), + "dependencies/CssExportDependency": () => + __webpack_require__(76760), + "dependencies/CssUrlDependency": () => + __webpack_require__(70749), + "dependencies/DelegatedSourceDependency": () => + __webpack_require__(22914), + "dependencies/DllEntryDependency": () => + __webpack_require__(95666), + "dependencies/EntryDependency": () => + __webpack_require__(3979), + "dependencies/ExportsInfoDependency": () => + __webpack_require__(78988), + "dependencies/HarmonyAcceptDependency": () => + __webpack_require__(23624), + "dependencies/HarmonyAcceptImportDependency": () => + __webpack_require__(99843), + "dependencies/HarmonyCompatibilityDependency": () => + __webpack_require__(72906), + "dependencies/HarmonyExportExpressionDependency": () => + __webpack_require__(51340), + "dependencies/HarmonyExportHeaderDependency": () => + __webpack_require__(38873), + "dependencies/HarmonyExportImportedSpecifierDependency": () => + __webpack_require__(67157), + "dependencies/HarmonyExportSpecifierDependency": () => + __webpack_require__(48567), + "dependencies/HarmonyImportSideEffectDependency": () => + __webpack_require__(73132), + "dependencies/HarmonyImportSpecifierDependency": () => + __webpack_require__(14077), + "dependencies/ImportContextDependency": () => + __webpack_require__(1902), + "dependencies/ImportDependency": () => + __webpack_require__(89376), + "dependencies/ImportEagerDependency": () => + __webpack_require__(50718), + "dependencies/ImportWeakDependency": () => + __webpack_require__(82483), + "dependencies/JsonExportsDependency": () => + __webpack_require__(750), + "dependencies/LocalModule": () => __webpack_require__(5826), + "dependencies/LocalModuleDependency": () => + __webpack_require__(52805), + "dependencies/ModuleDecoratorDependency": () => + __webpack_require__(88488), + "dependencies/ModuleHotAcceptDependency": () => + __webpack_require__(47511), + "dependencies/ModuleHotDeclineDependency": () => + __webpack_require__(86301), + "dependencies/ImportMetaHotAcceptDependency": () => + __webpack_require__(51274), + "dependencies/ImportMetaHotDeclineDependency": () => + __webpack_require__(53141), + "dependencies/ProvidedDependency": () => + __webpack_require__(95770), + "dependencies/PureExpressionDependency": () => + __webpack_require__(55799), + "dependencies/RequireContextDependency": () => + __webpack_require__(46917), + "dependencies/RequireEnsureDependenciesBlock": () => + __webpack_require__(27153), + "dependencies/RequireEnsureDependency": () => + __webpack_require__(27223), + "dependencies/RequireEnsureItemDependency": () => + __webpack_require__(50329), + "dependencies/RequireHeaderDependency": () => + __webpack_require__(89183), + "dependencies/RequireIncludeDependency": () => + __webpack_require__(71284), + "dependencies/RequireIncludeDependencyParserPlugin": () => + __webpack_require__(35768), + "dependencies/RequireResolveContextDependency": () => + __webpack_require__(55627), + "dependencies/RequireResolveDependency": () => + __webpack_require__(68582), + "dependencies/RequireResolveHeaderDependency": () => + __webpack_require__(9880), + "dependencies/RuntimeRequirementsDependency": () => + __webpack_require__(24187), + "dependencies/StaticExportsDependency": () => + __webpack_require__(91418), + "dependencies/SystemPlugin": () => __webpack_require__(97981), + "dependencies/UnsupportedDependency": () => + __webpack_require__(51669), + "dependencies/URLDependency": () => __webpack_require__(58612), + "dependencies/WebAssemblyExportImportedDependency": () => + __webpack_require__(52204), + "dependencies/WebAssemblyImportDependency": () => + __webpack_require__(5239), + "dependencies/WebpackIsIncludedDependency": () => + __webpack_require__(26505), + "dependencies/WorkerDependency": () => + __webpack_require__(1466), + "json/JsonData": () => __webpack_require__(90490), + "optimize/ConcatenatedModule": () => + __webpack_require__(97198), + DelegatedModule: () => __webpack_require__(28623), + DependenciesBlock: () => __webpack_require__(71040), + DllModule: () => __webpack_require__(28280), + ExternalModule: () => __webpack_require__(73071), + FileSystemInfo: () => __webpack_require__(79453), + InitFragment: () => __webpack_require__(55870), + InvalidDependenciesModuleWarning: () => + __webpack_require__(68257), + Module: () => __webpack_require__(73208), + ModuleBuildError: () => __webpack_require__(21305), + ModuleDependencyWarning: () => __webpack_require__(29656), + ModuleError: () => __webpack_require__(23744), + ModuleGraph: () => __webpack_require__(99988), + ModuleParseError: () => __webpack_require__(58443), + ModuleWarning: () => __webpack_require__(11234), + NormalModule: () => __webpack_require__(39), + RawDataUrlModule: () => __webpack_require__(19684), + RawModule: () => __webpack_require__(84929), + "sharing/ConsumeSharedModule": () => + __webpack_require__(62286), + "sharing/ConsumeSharedFallbackDependency": () => + __webpack_require__(58831), + "sharing/ProvideSharedModule": () => + __webpack_require__(50821), + "sharing/ProvideSharedDependency": () => + __webpack_require__(1798), + "sharing/ProvideForSharedDependency": () => + __webpack_require__(40017), + UnsupportedFeatureWarning: () => __webpack_require__(42495), + "util/LazySet": () => __webpack_require__(38938), + UnhandledSchemeError: () => __webpack_require__(68099), + NodeStuffInWebError: () => __webpack_require__(6325), + WebpackError: () => __webpack_require__(53799), -/** - * @param {Record} sizes sizes by source type - * @param {Object} options options - * @param {(number) => string=} options.formatSize size formatter - * @returns {string} text - */ -const printSizes = (sizes, { formatSize = n => `${n}` }) => { - const keys = Object.keys(sizes); - if (keys.length > 1) { - return keys.map(key => `${formatSize(sizes[key])} (${key})`).join(" "); - } else if (keys.length === 1) { - return formatSize(sizes[keys[0]]); + "util/registerExternalSerializer": () => { + // already registered } }; -const getResourceName = resource => { - const dataUrl = /^data:[^,]+,/.exec(resource); - if (!dataUrl) return resource; - const len = dataUrl[0].length + DATA_URI_CONTENT_LENGTH; - if (resource.length < len) return resource; - return `${resource.slice( - 0, - Math.min(resource.length - /* '..'.length */ 2, len) - )}..`; -}; +/***/ }), -const getModuleName = name => { - const [, prefix, resource] = /^(.*!)?([^!]*)$/.exec(name); - return [prefix, getResourceName(resource)]; -}; +/***/ 33032: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -const mapLines = (str, fn) => str.split("\n").map(fn).join("\n"); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ -/** - * @param {number} n a number - * @returns {string} number as two digit string, leading 0 - */ -const twoDigit = n => (n >= 10 ? `${n}` : `0${n}`); -const isValidId = id => { - return typeof id === "number" || id; -}; -const moreCount = (list, count) => { - return list && list.length > 0 ? `+ ${count}` : `${count}`; -}; +const { register } = __webpack_require__(8282); -/** @type {Record string | void>} */ -const SIMPLE_PRINTERS = { - "compilation.summary!": ( - _, - { - type, - bold, - green, - red, - yellow, - formatDateTime, - formatTime, - compilation: { - name, - hash, - version, - time, - builtAt, - errorsCount, - warningsCount - } - } - ) => { - const root = type === "compilation.summary!"; - const warningsMessage = - warningsCount > 0 - ? yellow( - `${warningsCount} ${plural(warningsCount, "warning", "warnings")}` - ) - : ""; - const errorsMessage = - errorsCount > 0 - ? red(`${errorsCount} ${plural(errorsCount, "error", "errors")}`) - : ""; - const timeMessage = root && time ? ` in ${formatTime(time)}` : ""; - const hashMessage = hash ? ` (${hash})` : ""; - const builtAtMessage = - root && builtAt ? `${formatDateTime(builtAt)}: ` : ""; - const versionMessage = root && version ? `webpack ${version}` : ""; - const nameMessage = - root && name - ? bold(name) - : name - ? `Child ${bold(name)}` - : root - ? "" - : "Child"; - const subjectMessage = - nameMessage && versionMessage - ? `${nameMessage} (${versionMessage})` - : versionMessage || nameMessage || "webpack"; - let statusMessage; - if (errorsMessage && warningsMessage) { - statusMessage = `compiled with ${errorsMessage} and ${warningsMessage}`; - } else if (errorsMessage) { - statusMessage = `compiled with ${errorsMessage}`; - } else if (warningsMessage) { - statusMessage = `compiled with ${warningsMessage}`; - } else if (errorsCount === 0 && warningsCount === 0) { - statusMessage = `compiled ${green("successfully")}`; - } else { - statusMessage = `compiled`; - } - if ( - builtAtMessage || - versionMessage || - errorsMessage || - warningsMessage || - (errorsCount === 0 && warningsCount === 0) || - timeMessage || - hashMessage - ) - return `${builtAtMessage}${subjectMessage} ${statusMessage}${timeMessage}${hashMessage}`; - }, - "compilation.filteredWarningDetailsCount": count => - count - ? `${count} ${plural( - count, - "warning has", - "warnings have" - )} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.` - : undefined, - "compilation.filteredErrorDetailsCount": (count, { yellow }) => - count - ? yellow( - `${count} ${plural( - count, - "error has", - "errors have" - )} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.` - ) - : undefined, - "compilation.env": (env, { bold }) => - env - ? `Environment (--env): ${bold(JSON.stringify(env, null, 2))}` - : undefined, - "compilation.publicPath": (publicPath, { bold }) => - `PublicPath: ${bold(publicPath || "(none)")}`, - "compilation.entrypoints": (entrypoints, context, printer) => - Array.isArray(entrypoints) - ? undefined - : printer.print(context.type, Object.values(entrypoints), { - ...context, - chunkGroupKind: "Entrypoint" - }), - "compilation.namedChunkGroups": (namedChunkGroups, context, printer) => { - if (!Array.isArray(namedChunkGroups)) { - const { - compilation: { entrypoints } - } = context; - let chunkGroups = Object.values(namedChunkGroups); - if (entrypoints) { - chunkGroups = chunkGroups.filter( - group => - !Object.prototype.hasOwnProperty.call(entrypoints, group.name) - ); - } - return printer.print(context.type, chunkGroups, { - ...context, - chunkGroupKind: "Chunk Group" - }); - } - }, - "compilation.assetsByChunkName": () => "", +class ClassSerializer { + constructor(Constructor) { + this.Constructor = Constructor; + } - "compilation.filteredModules": ( - filteredModules, - { compilation: { modules } } - ) => - filteredModules > 0 - ? `${moreCount(modules, filteredModules)} ${plural( - filteredModules, - "module", - "modules" - )}` - : undefined, - "compilation.filteredAssets": (filteredAssets, { compilation: { assets } }) => - filteredAssets > 0 - ? `${moreCount(assets, filteredAssets)} ${plural( - filteredAssets, - "asset", - "assets" - )}` - : undefined, - "compilation.logging": (logging, context, printer) => - Array.isArray(logging) - ? undefined - : printer.print( - context.type, - Object.entries(logging).map(([name, value]) => ({ ...value, name })), - context - ), - "compilation.warningsInChildren!": (_, { yellow, compilation }) => { - if ( - !compilation.children && - compilation.warningsCount > 0 && - compilation.warnings - ) { - const childWarnings = - compilation.warningsCount - compilation.warnings.length; - if (childWarnings > 0) { - return yellow( - `${childWarnings} ${plural( - childWarnings, - "WARNING", - "WARNINGS" - )} in child compilations${ - compilation.children - ? "" - : " (Use 'stats.children: true' resp. '--stats-children' for more details)" - }` - ); - } + serialize(obj, context) { + obj.serialize(context); + } + + deserialize(context) { + if (typeof this.Constructor.deserialize === "function") { + return this.Constructor.deserialize(context); } - }, - "compilation.errorsInChildren!": (_, { red, compilation }) => { - if ( - !compilation.children && - compilation.errorsCount > 0 && - compilation.errors - ) { - const childErrors = compilation.errorsCount - compilation.errors.length; - if (childErrors > 0) { - return red( - `${childErrors} ${plural( - childErrors, - "ERROR", - "ERRORS" - )} in child compilations${ - compilation.children - ? "" - : " (Use 'stats.children: true' resp. '--stats-children' for more details)" - }` - ); - } + const obj = new this.Constructor(); + obj.deserialize(context); + return obj; + } +} + +module.exports = (Constructor, request, name = null) => { + register(Constructor, request, name, new ClassSerializer(Constructor)); +}; + + +/***/ }), + +/***/ 78676: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + + + +/** @template T @typedef {function(): T} FunctionReturning */ + +/** + * @template T + * @param {FunctionReturning} fn memorized function + * @returns {FunctionReturning} new function + */ +const memoize = fn => { + let cache = false; + /** @type {T} */ + let result = undefined; + return () => { + if (cache) { + return result; + } else { + result = fn(); + cache = true; + // Allow to clean up memory for fn + // and all dependent resources + fn = undefined; + return result; } - }, + }; +}; - "asset.type": type => type, - "asset.name": (name, { formatFilename, asset: { isOverSizeLimit } }) => - formatFilename(name, isOverSizeLimit), - "asset.size": ( - size, - { asset: { isOverSizeLimit }, yellow, green, formatSize } - ) => (isOverSizeLimit ? yellow(formatSize(size)) : formatSize(size)), - "asset.emitted": (emitted, { green, formatFlag }) => - emitted ? green(formatFlag("emitted")) : undefined, - "asset.comparedForEmit": (comparedForEmit, { yellow, formatFlag }) => - comparedForEmit ? yellow(formatFlag("compared for emit")) : undefined, - "asset.cached": (cached, { green, formatFlag }) => - cached ? green(formatFlag("cached")) : undefined, - "asset.isOverSizeLimit": (isOverSizeLimit, { yellow, formatFlag }) => - isOverSizeLimit ? yellow(formatFlag("big")) : undefined, +module.exports = memoize; - "asset.info.immutable": (immutable, { green, formatFlag }) => - immutable ? green(formatFlag("immutable")) : undefined, - "asset.info.javascriptModule": (javascriptModule, { formatFlag }) => - javascriptModule ? formatFlag("javascript module") : undefined, - "asset.info.sourceFilename": (sourceFilename, { formatFlag }) => - sourceFilename - ? formatFlag( - sourceFilename === true - ? "from source file" - : `from: ${sourceFilename}` - ) - : undefined, - "asset.info.development": (development, { green, formatFlag }) => - development ? green(formatFlag("dev")) : undefined, - "asset.info.hotModuleReplacement": ( - hotModuleReplacement, - { green, formatFlag } - ) => (hotModuleReplacement ? green(formatFlag("hmr")) : undefined), - "asset.separator!": () => "\n", - "asset.filteredRelated": (filteredRelated, { asset: { related } }) => - filteredRelated > 0 - ? `${moreCount(related, filteredRelated)} related ${plural( - filteredRelated, - "asset", - "assets" - )}` - : undefined, - "asset.filteredChildren": (filteredChildren, { asset: { children } }) => - filteredChildren > 0 - ? `${moreCount(children, filteredChildren)} ${plural( - filteredChildren, - "asset", - "assets" - )}` - : undefined, - assetChunk: (id, { formatChunkId }) => formatChunkId(id), +/***/ }), - assetChunkName: name => name, - assetChunkIdHint: name => name, +/***/ 55668: +/***/ (function(module) { - "module.type": type => (type !== "module" ? type : undefined), - "module.id": (id, { formatModuleId }) => - isValidId(id) ? formatModuleId(id) : undefined, - "module.name": (name, { bold }) => { - const [prefix, resource] = getModuleName(name); - return `${prefix || ""}${bold(resource || "")}`; - }, - "module.identifier": identifier => undefined, - "module.layer": (layer, { formatLayer }) => - layer ? formatLayer(layer) : undefined, - "module.sizes": printSizes, - "module.chunks[]": (id, { formatChunkId }) => formatChunkId(id), - "module.depth": (depth, { formatFlag }) => - depth !== null ? formatFlag(`depth ${depth}`) : undefined, - "module.cacheable": (cacheable, { formatFlag, red }) => - cacheable === false ? red(formatFlag("not cacheable")) : undefined, - "module.orphan": (orphan, { formatFlag, yellow }) => - orphan ? yellow(formatFlag("orphan")) : undefined, - "module.runtime": (runtime, { formatFlag, yellow }) => - runtime ? yellow(formatFlag("runtime")) : undefined, - "module.optional": (optional, { formatFlag, yellow }) => - optional ? yellow(formatFlag("optional")) : undefined, - "module.dependent": (dependent, { formatFlag, cyan }) => - dependent ? cyan(formatFlag("dependent")) : undefined, - "module.built": (built, { formatFlag, yellow }) => - built ? yellow(formatFlag("built")) : undefined, - "module.codeGenerated": (codeGenerated, { formatFlag, yellow }) => - codeGenerated ? yellow(formatFlag("code generated")) : undefined, - "module.buildTimeExecuted": (buildTimeExecuted, { formatFlag, green }) => - buildTimeExecuted ? green(formatFlag("build time executed")) : undefined, - "module.cached": (cached, { formatFlag, green }) => - cached ? green(formatFlag("cached")) : undefined, - "module.assets": (assets, { formatFlag, magenta }) => - assets && assets.length - ? magenta( - formatFlag( - `${assets.length} ${plural(assets.length, "asset", "assets")}` - ) - ) - : undefined, - "module.warnings": (warnings, { formatFlag, yellow }) => - warnings === true - ? yellow(formatFlag("warnings")) - : warnings - ? yellow( - formatFlag(`${warnings} ${plural(warnings, "warning", "warnings")}`) - ) - : undefined, - "module.errors": (errors, { formatFlag, red }) => - errors === true - ? red(formatFlag("errors")) - : errors - ? red(formatFlag(`${errors} ${plural(errors, "error", "errors")}`)) - : undefined, - "module.providedExports": (providedExports, { formatFlag, cyan }) => { - if (Array.isArray(providedExports)) { - if (providedExports.length === 0) return cyan(formatFlag("no exports")); - return cyan(formatFlag(`exports: ${providedExports.join(", ")}`)); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ + + + +const A_CODE = "a".charCodeAt(0); + +/** + * @param {string} hash hash + * @param {number} hashLength hash length + * @returns {string} returns hash that has at least one non numeric char + */ +module.exports = (hash, hashLength) => { + if (hashLength < 1) return ""; + const slice = hash.slice(0, hashLength); + if (slice.match(/[^\d]/)) return slice; + return `${String.fromCharCode( + A_CODE + (parseInt(hash[0], 10) % 6) + )}${slice.slice(1)}`; +}; + + +/***/ }), + +/***/ 70002: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const SAFE_LIMIT = 0x80000000; +const SAFE_PART = SAFE_LIMIT - 1; +const COUNT = 4; +const arr = [0, 0, 0, 0, 0]; +const primes = [3, 7, 17, 19]; + +module.exports = (str, range) => { + arr.fill(0); + for (let i = 0; i < str.length; i++) { + const c = str.charCodeAt(i); + for (let j = 0; j < COUNT; j++) { + const p = (j + COUNT - 1) % COUNT; + arr[j] = (arr[j] + c * primes[j] + arr[p]) & SAFE_PART; } - }, - "module.usedExports": (usedExports, { formatFlag, cyan, module }) => { - if (usedExports !== true) { - if (usedExports === null) return cyan(formatFlag("used exports unknown")); - if (usedExports === false) return cyan(formatFlag("module unused")); - if (Array.isArray(usedExports)) { - if (usedExports.length === 0) - return cyan(formatFlag("no exports used")); - const providedExportsCount = Array.isArray(module.providedExports) - ? module.providedExports.length - : null; - if ( - providedExportsCount !== null && - providedExportsCount === usedExports.length - ) { - return cyan(formatFlag("all exports used")); - } else { - return cyan( - formatFlag(`only some exports used: ${usedExports.join(", ")}`) - ); - } - } + for (let j = 0; j < COUNT; j++) { + const q = arr[j] % COUNT; + arr[j] = arr[j] ^ (arr[q] >> 1); } - }, - "module.optimizationBailout[]": (optimizationBailout, { yellow }) => - yellow(optimizationBailout), - "module.issuerPath": (issuerPath, { module }) => - module.profile ? undefined : "", - "module.profile": profile => undefined, - "module.filteredModules": (filteredModules, { module: { modules } }) => - filteredModules > 0 - ? `${moreCount(modules, filteredModules)} nested ${plural( - filteredModules, - "module", - "modules" - )}` - : undefined, - "module.filteredReasons": (filteredReasons, { module: { reasons } }) => - filteredReasons > 0 - ? `${moreCount(reasons, filteredReasons)} ${plural( - filteredReasons, - "reason", - "reasons" - )}` - : undefined, - "module.filteredChildren": (filteredChildren, { module: { children } }) => - filteredChildren > 0 - ? `${moreCount(children, filteredChildren)} ${plural( - filteredChildren, - "module", - "modules" - )}` - : undefined, - "module.separator!": () => "\n", + } + if (range <= SAFE_PART) { + let sum = 0; + for (let j = 0; j < COUNT; j++) { + sum = (sum + arr[j]) % range; + } + return sum; + } else { + let sum1 = 0; + let sum2 = 0; + const rangeExt = Math.floor(range / SAFE_LIMIT); + for (let j = 0; j < COUNT; j += 2) { + sum1 = (sum1 + arr[j]) & SAFE_PART; + } + for (let j = 1; j < COUNT; j += 2) { + sum2 = (sum2 + arr[j]) % rangeExt; + } + return (sum2 * SAFE_LIMIT + sum1) % range; + } +}; - "moduleIssuer.id": (id, { formatModuleId }) => formatModuleId(id), - "moduleIssuer.profile.total": (value, { formatTime }) => formatTime(value), - "moduleReason.type": type => type, - "moduleReason.userRequest": (userRequest, { cyan }) => - cyan(getResourceName(userRequest)), - "moduleReason.moduleId": (moduleId, { formatModuleId }) => - isValidId(moduleId) ? formatModuleId(moduleId) : undefined, - "moduleReason.module": (module, { magenta }) => magenta(module), - "moduleReason.loc": loc => loc, - "moduleReason.explanation": (explanation, { cyan }) => cyan(explanation), - "moduleReason.active": (active, { formatFlag }) => - active ? undefined : formatFlag("inactive"), - "moduleReason.resolvedModule": (module, { magenta }) => magenta(module), - "moduleReason.filteredChildren": ( - filteredChildren, - { moduleReason: { children } } - ) => - filteredChildren > 0 - ? `${moreCount(children, filteredChildren)} ${plural( - filteredChildren, - "reason", - "reasons" - )}` - : undefined, +/***/ }), - "module.profile.total": (value, { formatTime }) => formatTime(value), - "module.profile.resolving": (value, { formatTime }) => - `resolving: ${formatTime(value)}`, - "module.profile.restoring": (value, { formatTime }) => - `restoring: ${formatTime(value)}`, - "module.profile.integration": (value, { formatTime }) => - `integration: ${formatTime(value)}`, - "module.profile.building": (value, { formatTime }) => - `building: ${formatTime(value)}`, - "module.profile.storing": (value, { formatTime }) => - `storing: ${formatTime(value)}`, - "module.profile.additionalResolving": (value, { formatTime }) => - value ? `additional resolving: ${formatTime(value)}` : undefined, - "module.profile.additionalIntegration": (value, { formatTime }) => - value ? `additional integration: ${formatTime(value)}` : undefined, +/***/ 42791: +/***/ (function(module) { - "chunkGroup.kind!": (_, { chunkGroupKind }) => chunkGroupKind, - "chunkGroup.separator!": () => "\n", - "chunkGroup.name": (name, { bold }) => bold(name), - "chunkGroup.isOverSizeLimit": (isOverSizeLimit, { formatFlag, yellow }) => - isOverSizeLimit ? yellow(formatFlag("big")) : undefined, - "chunkGroup.assetsSize": (size, { formatSize }) => - size ? formatSize(size) : undefined, - "chunkGroup.auxiliaryAssetsSize": (size, { formatSize }) => - size ? `(${formatSize(size)})` : undefined, - "chunkGroup.filteredAssets": (n, { chunkGroup: { assets } }) => - n > 0 - ? `${moreCount(assets, n)} ${plural(n, "asset", "assets")}` - : undefined, - "chunkGroup.filteredAuxiliaryAssets": ( - n, - { chunkGroup: { auxiliaryAssets } } - ) => - n > 0 - ? `${moreCount(auxiliaryAssets, n)} auxiliary ${plural( - n, - "asset", - "assets" - )}` - : undefined, - "chunkGroup.is!": () => "=", - "chunkGroupAsset.name": (asset, { green }) => green(asset), - "chunkGroupAsset.size": (size, { formatSize, chunkGroup }) => - chunkGroup.assets.length > 1 || - (chunkGroup.auxiliaryAssets && chunkGroup.auxiliaryAssets.length > 0) - ? formatSize(size) - : undefined, - "chunkGroup.children": (children, context, printer) => - Array.isArray(children) - ? undefined - : printer.print( - context.type, - Object.keys(children).map(key => ({ - type: key, - children: children[key] - })), - context - ), - "chunkGroupChildGroup.type": type => `${type}:`, - "chunkGroupChild.assets[]": (file, { formatFilename }) => - formatFilename(file), - "chunkGroupChild.chunks[]": (id, { formatChunkId }) => formatChunkId(id), - "chunkGroupChild.name": name => (name ? `(name: ${name})` : undefined), +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +/** + * @template T + * @template {Error} E + * @param {Iterable} items initial items + * @param {number} concurrency number of items running in parallel + * @param {function(T, function(T): void, function(E=): void): void} processor worker which pushes more items + * @param {function(E=): void} callback all items processed + * @returns {void} + */ +const processAsyncTree = (items, concurrency, processor, callback) => { + const queue = Array.from(items); + if (queue.length === 0) return callback(); + let processing = 0; + let finished = false; + let processScheduled = true; + + const push = item => { + queue.push(item); + if (!processScheduled && processing < concurrency) { + processScheduled = true; + process.nextTick(processQueue); + } + }; + + const processorCallback = err => { + processing--; + if (err && !finished) { + finished = true; + callback(err); + return; + } + if (!processScheduled) { + processScheduled = true; + process.nextTick(processQueue); + } + }; + + const processQueue = () => { + if (finished) return; + while (processing < concurrency && queue.length > 0) { + processing++; + const item = queue.pop(); + processor(item, push, processorCallback); + } + processScheduled = false; + if (queue.length === 0 && processing === 0 && !finished) { + finished = true; + callback(); + } + }; - "chunk.id": (id, { formatChunkId }) => formatChunkId(id), - "chunk.files[]": (file, { formatFilename }) => formatFilename(file), - "chunk.names[]": name => name, - "chunk.idHints[]": name => name, - "chunk.runtime[]": name => name, - "chunk.sizes": (sizes, context) => printSizes(sizes, context), - "chunk.parents[]": (parents, context) => - context.formatChunkId(parents, "parent"), - "chunk.siblings[]": (siblings, context) => - context.formatChunkId(siblings, "sibling"), - "chunk.children[]": (children, context) => - context.formatChunkId(children, "child"), - "chunk.childrenByOrder": (childrenByOrder, context, printer) => - Array.isArray(childrenByOrder) - ? undefined - : printer.print( - context.type, - Object.keys(childrenByOrder).map(key => ({ - type: key, - children: childrenByOrder[key] - })), - context - ), - "chunk.childrenByOrder[].type": type => `${type}:`, - "chunk.childrenByOrder[].children[]": (id, { formatChunkId }) => - isValidId(id) ? formatChunkId(id) : undefined, - "chunk.entry": (entry, { formatFlag, yellow }) => - entry ? yellow(formatFlag("entry")) : undefined, - "chunk.initial": (initial, { formatFlag, yellow }) => - initial ? yellow(formatFlag("initial")) : undefined, - "chunk.rendered": (rendered, { formatFlag, green }) => - rendered ? green(formatFlag("rendered")) : undefined, - "chunk.recorded": (recorded, { formatFlag, green }) => - recorded ? green(formatFlag("recorded")) : undefined, - "chunk.reason": (reason, { yellow }) => (reason ? yellow(reason) : undefined), - "chunk.filteredModules": (filteredModules, { chunk: { modules } }) => - filteredModules > 0 - ? `${moreCount(modules, filteredModules)} chunk ${plural( - filteredModules, - "module", - "modules" - )}` - : undefined, - "chunk.separator!": () => "\n", + processQueue(); +}; - "chunkOrigin.request": request => request, - "chunkOrigin.moduleId": (moduleId, { formatModuleId }) => - isValidId(moduleId) ? formatModuleId(moduleId) : undefined, - "chunkOrigin.moduleName": (moduleName, { bold }) => bold(moduleName), - "chunkOrigin.loc": loc => loc, +module.exports = processAsyncTree; - "error.compilerPath": (compilerPath, { bold }) => - compilerPath ? bold(`(${compilerPath})`) : undefined, - "error.chunkId": (chunkId, { formatChunkId }) => - isValidId(chunkId) ? formatChunkId(chunkId) : undefined, - "error.chunkEntry": (chunkEntry, { formatFlag }) => - chunkEntry ? formatFlag("entry") : undefined, - "error.chunkInitial": (chunkInitial, { formatFlag }) => - chunkInitial ? formatFlag("initial") : undefined, - "error.file": (file, { bold }) => bold(file), - "error.moduleName": (moduleName, { bold }) => { - return moduleName.includes("!") - ? `${bold(moduleName.replace(/^(\s|\S)*!/, ""))} (${moduleName})` - : `${bold(moduleName)}`; - }, - "error.loc": (loc, { green }) => green(loc), - "error.message": (message, { bold, formatError }) => - message.includes("\u001b[") ? message : bold(formatError(message)), - "error.details": (details, { formatError }) => formatError(details), - "error.stack": stack => stack, - "error.moduleTrace": moduleTrace => undefined, - "error.separator!": () => "\n", - "loggingEntry(error).loggingEntry.message": (message, { red }) => - mapLines(message, x => ` ${red(x)}`), - "loggingEntry(warn).loggingEntry.message": (message, { yellow }) => - mapLines(message, x => ` ${yellow(x)}`), - "loggingEntry(info).loggingEntry.message": (message, { green }) => - mapLines(message, x => ` ${green(x)}`), - "loggingEntry(log).loggingEntry.message": (message, { bold }) => - mapLines(message, x => ` ${bold(x)}`), - "loggingEntry(debug).loggingEntry.message": message => - mapLines(message, x => ` ${x}`), - "loggingEntry(trace).loggingEntry.message": message => - mapLines(message, x => ` ${x}`), - "loggingEntry(status).loggingEntry.message": (message, { magenta }) => - mapLines(message, x => ` ${magenta(x)}`), - "loggingEntry(profile).loggingEntry.message": (message, { magenta }) => - mapLines(message, x => `

${magenta(x)}`), - "loggingEntry(profileEnd).loggingEntry.message": (message, { magenta }) => - mapLines(message, x => `

${magenta(x)}`), - "loggingEntry(time).loggingEntry.message": (message, { magenta }) => - mapLines(message, x => ` ${magenta(x)}`), - "loggingEntry(group).loggingEntry.message": (message, { cyan }) => - mapLines(message, x => `<-> ${cyan(x)}`), - "loggingEntry(groupCollapsed).loggingEntry.message": (message, { cyan }) => - mapLines(message, x => `<+> ${cyan(x)}`), - "loggingEntry(clear).loggingEntry": () => " -------", - "loggingEntry(groupCollapsed).loggingEntry.children": () => "", - "loggingEntry.trace[]": trace => - trace ? mapLines(trace, x => `| ${x}`) : undefined, +/***/ }), - "moduleTraceItem.originName": originName => originName, +/***/ 54190: +/***/ (function(module) { - loggingGroup: loggingGroup => - loggingGroup.entries.length === 0 ? "" : undefined, - "loggingGroup.debug": (flag, { red }) => (flag ? red("DEBUG") : undefined), - "loggingGroup.name": (name, { bold }) => bold(`LOG from ${name}`), - "loggingGroup.separator!": () => "\n", - "loggingGroup.filteredEntries": filteredEntries => - filteredEntries > 0 ? `+ ${filteredEntries} hidden lines` : undefined, +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - "moduleTraceDependency.loc": loc => loc -}; -/** @type {Record} */ -const ITEM_NAMES = { - "compilation.assets[]": "asset", - "compilation.modules[]": "module", - "compilation.chunks[]": "chunk", - "compilation.entrypoints[]": "chunkGroup", - "compilation.namedChunkGroups[]": "chunkGroup", - "compilation.errors[]": "error", - "compilation.warnings[]": "error", - "compilation.logging[]": "loggingGroup", - "compilation.children[]": "compilation", - "asset.related[]": "asset", - "asset.children[]": "asset", - "asset.chunks[]": "assetChunk", - "asset.auxiliaryChunks[]": "assetChunk", - "asset.chunkNames[]": "assetChunkName", - "asset.chunkIdHints[]": "assetChunkIdHint", - "asset.auxiliaryChunkNames[]": "assetChunkName", - "asset.auxiliaryChunkIdHints[]": "assetChunkIdHint", - "chunkGroup.assets[]": "chunkGroupAsset", - "chunkGroup.auxiliaryAssets[]": "chunkGroupAsset", - "chunkGroupChild.assets[]": "chunkGroupAsset", - "chunkGroupChild.auxiliaryAssets[]": "chunkGroupAsset", - "chunkGroup.children[]": "chunkGroupChildGroup", - "chunkGroupChildGroup.children[]": "chunkGroupChild", - "module.modules[]": "module", - "module.children[]": "module", - "module.reasons[]": "moduleReason", - "moduleReason.children[]": "moduleReason", - "module.issuerPath[]": "moduleIssuer", - "chunk.origins[]": "chunkOrigin", - "chunk.modules[]": "module", - "loggingGroup.entries[]": logEntry => - `loggingEntry(${logEntry.type}).loggingEntry`, - "loggingEntry.children[]": logEntry => - `loggingEntry(${logEntry.type}).loggingEntry`, - "error.moduleTrace[]": "moduleTraceItem", - "moduleTraceItem.dependencies[]": "moduleTraceDependency" -}; -const ERROR_PREFERRED_ORDER = [ - "compilerPath", - "chunkId", - "chunkEntry", - "chunkInitial", - "file", - "separator!", - "moduleName", - "loc", - "separator!", - "message", - "separator!", - "details", - "separator!", - "stack", - "separator!", - "missing", - "separator!", - "moduleTrace" -]; +const SAFE_IDENTIFIER = /^[_a-zA-Z$][_a-zA-Z$0-9]*$/; +const RESERVED_IDENTIFIER = new Set([ + "break", + "case", + "catch", + "class", + "const", + "continue", + "debugger", + "default", + "delete", + "do", + "else", + "export", + "extends", + "finally", + "for", + "function", + "if", + "import", + "in", + "instanceof", + "new", + "return", + "super", + "switch", + "this", + "throw", + "try", + "typeof", + "var", + "void", + "while", + "with", + "enum", + // strict mode + "implements", + "interface", + "let", + "package", + "private", + "protected", + "public", + "static", + "yield", + "yield", + // module code + "await", + // skip future reserved keywords defined under ES1 till ES3 + // additional + "null", + "true", + "false" +]); -/** @type {Record} */ -const PREFERRED_ORDERS = { - compilation: [ - "name", - "hash", - "version", - "time", - "builtAt", - "env", - "publicPath", - "assets", - "filteredAssets", - "entrypoints", - "namedChunkGroups", - "chunks", - "modules", - "filteredModules", - "children", - "logging", - "warnings", - "warningsInChildren!", - "filteredWarningDetailsCount", - "errors", - "errorsInChildren!", - "filteredErrorDetailsCount", - "summary!", - "needAdditionalPass" - ], - asset: [ - "type", - "name", - "size", - "chunks", - "auxiliaryChunks", - "emitted", - "comparedForEmit", - "cached", - "info", - "isOverSizeLimit", - "chunkNames", - "auxiliaryChunkNames", - "chunkIdHints", - "auxiliaryChunkIdHints", - "related", - "filteredRelated", - "children", - "filteredChildren" - ], - "asset.info": [ - "immutable", - "sourceFilename", - "javascriptModule", - "development", - "hotModuleReplacement" - ], - chunkGroup: [ - "kind!", - "name", - "isOverSizeLimit", - "assetsSize", - "auxiliaryAssetsSize", - "is!", - "assets", - "filteredAssets", - "auxiliaryAssets", - "filteredAuxiliaryAssets", - "separator!", - "children" - ], - chunkGroupAsset: ["name", "size"], - chunkGroupChildGroup: ["type", "children"], - chunkGroupChild: ["assets", "chunks", "name"], - module: [ - "type", - "name", - "identifier", - "id", - "layer", - "sizes", - "chunks", - "depth", - "cacheable", - "orphan", - "runtime", - "optional", - "dependent", - "built", - "codeGenerated", - "cached", - "assets", - "failed", - "warnings", - "errors", - "children", - "filteredChildren", - "providedExports", - "usedExports", - "optimizationBailout", - "reasons", - "filteredReasons", - "issuerPath", - "profile", - "modules", - "filteredModules" - ], - moduleReason: [ - "active", - "type", - "userRequest", - "moduleId", - "module", - "resolvedModule", - "loc", - "explanation", - "children", - "filteredChildren" - ], - "module.profile": [ - "total", - "separator!", - "resolving", - "restoring", - "integration", - "building", - "storing", - "additionalResolving", - "additionalIntegration" - ], - chunk: [ - "id", - "runtime", - "files", - "names", - "idHints", - "sizes", - "parents", - "siblings", - "children", - "childrenByOrder", - "entry", - "initial", - "rendered", - "recorded", - "reason", - "separator!", - "origins", - "separator!", - "modules", - "separator!", - "filteredModules" - ], - chunkOrigin: ["request", "moduleId", "moduleName", "loc"], - error: ERROR_PREFERRED_ORDER, - warning: ERROR_PREFERRED_ORDER, - "chunk.childrenByOrder[]": ["type", "children"], - loggingGroup: [ - "debug", - "name", - "separator!", - "entries", - "separator!", - "filteredEntries" - ], - loggingEntry: ["message", "trace", "children"] +const propertyAccess = (properties, start = 0) => { + let str = ""; + for (let i = start; i < properties.length; i++) { + const p = properties[i]; + if (`${+p}` === p) { + str += `[${p}]`; + } else if (SAFE_IDENTIFIER.test(p) && !RESERVED_IDENTIFIER.has(p)) { + str += `.${p}`; + } else { + str += `[${JSON.stringify(p)}]`; + } + } + return str; }; -const itemsJoinOneLine = items => items.filter(Boolean).join(" "); -const itemsJoinOneLineBrackets = items => - items.length > 0 ? `(${items.filter(Boolean).join(" ")})` : undefined; -const itemsJoinMoreSpacing = items => items.filter(Boolean).join("\n\n"); -const itemsJoinComma = items => items.filter(Boolean).join(", "); -const itemsJoinCommaBrackets = items => - items.length > 0 ? `(${items.filter(Boolean).join(", ")})` : undefined; -const itemsJoinCommaBracketsWithName = name => items => - items.length > 0 - ? `(${name}: ${items.filter(Boolean).join(", ")})` - : undefined; +module.exports = propertyAccess; -/** @type {Record string>} */ -const SIMPLE_ITEMS_JOINER = { - "chunk.parents": itemsJoinOneLine, - "chunk.siblings": itemsJoinOneLine, - "chunk.children": itemsJoinOneLine, - "chunk.names": itemsJoinCommaBrackets, - "chunk.idHints": itemsJoinCommaBracketsWithName("id hint"), - "chunk.runtime": itemsJoinCommaBracketsWithName("runtime"), - "chunk.files": itemsJoinComma, - "chunk.childrenByOrder": itemsJoinOneLine, - "chunk.childrenByOrder[].children": itemsJoinOneLine, - "chunkGroup.assets": itemsJoinOneLine, - "chunkGroup.auxiliaryAssets": itemsJoinOneLineBrackets, - "chunkGroupChildGroup.children": itemsJoinComma, - "chunkGroupChild.assets": itemsJoinOneLine, - "chunkGroupChild.auxiliaryAssets": itemsJoinOneLineBrackets, - "asset.chunks": itemsJoinComma, - "asset.auxiliaryChunks": itemsJoinCommaBrackets, - "asset.chunkNames": itemsJoinCommaBracketsWithName("name"), - "asset.auxiliaryChunkNames": itemsJoinCommaBracketsWithName("auxiliary name"), - "asset.chunkIdHints": itemsJoinCommaBracketsWithName("id hint"), - "asset.auxiliaryChunkIdHints": - itemsJoinCommaBracketsWithName("auxiliary id hint"), - "module.chunks": itemsJoinOneLine, - "module.issuerPath": items => - items - .filter(Boolean) - .map(item => `${item} ->`) - .join(" "), - "compilation.errors": itemsJoinMoreSpacing, - "compilation.warnings": itemsJoinMoreSpacing, - "compilation.logging": itemsJoinMoreSpacing, - "compilation.children": items => indent(itemsJoinMoreSpacing(items), " "), - "moduleTraceItem.dependencies": itemsJoinOneLine, - "loggingEntry.children": items => - indent(items.filter(Boolean).join("\n"), " ", false) -}; -const joinOneLine = items => - items - .map(item => item.content) - .filter(Boolean) - .join(" "); +/***/ }), -const joinInBrackets = items => { - const res = []; - let mode = 0; - for (const item of items) { - if (item.element === "separator!") { - switch (mode) { - case 0: - case 1: - mode += 2; - break; - case 4: - res.push(")"); - mode = 3; - break; +/***/ 26611: +/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { register } = __webpack_require__(8282); + +const Position = /** @type {TODO} */ (__webpack_require__(31988).Position); +const SourceLocation = (__webpack_require__(31988).SourceLocation); +const ValidationError = (__webpack_require__(54983)/* ["default"] */ .Z); +const { + CachedSource, + ConcatSource, + OriginalSource, + PrefixSource, + RawSource, + ReplaceSource, + SourceMapSource +} = __webpack_require__(51255); + +/** @typedef {import("acorn").Position} Position */ +/** @typedef {import("../Dependency").RealDependencyLocation} RealDependencyLocation */ +/** @typedef {import("../Dependency").SourcePosition} SourcePosition */ +/** @typedef {import("./serialization").ObjectDeserializerContext} ObjectDeserializerContext */ +/** @typedef {import("./serialization").ObjectSerializerContext} ObjectSerializerContext */ + +/** @typedef {ObjectSerializerContext & { writeLazy?: (any) => void }} WebpackObjectSerializerContext */ + +const CURRENT_MODULE = "webpack/lib/util/registerExternalSerializer"; + +register( + CachedSource, + CURRENT_MODULE, + "webpack-sources/CachedSource", + new (class CachedSourceSerializer { + /** + * @param {CachedSource} source the cached source to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(source, { write, writeLazy }) { + if (writeLazy) { + writeLazy(source.originalLazy()); + } else { + write(source.original()); } + write(source.getCachedData()); } - if (!item.content) continue; - switch (mode) { - case 0: - mode = 1; - break; - case 1: - res.push(" "); - break; - case 2: - res.push("("); - mode = 4; - break; - case 3: - res.push(" ("); - mode = 4; - break; - case 4: - res.push(", "); - break; - } - res.push(item.content); - } - if (mode === 4) res.push(")"); - return res.join(""); -}; -const indent = (str, prefix, noPrefixInFirstLine) => { - const rem = str.replace(/\n([^\n])/g, "\n" + prefix + "$1"); - if (noPrefixInFirstLine) return rem; - const ind = str[0] === "\n" ? "" : prefix; - return ind + rem; -}; + /** + * @param {ObjectDeserializerContext} context context + * @returns {CachedSource} cached source + */ + deserialize({ read }) { + const source = read(); + const cachedData = read(); + return new CachedSource(source, cachedData); + } + })() +); -const joinExplicitNewLine = (items, indenter) => { - let firstInLine = true; - let first = true; - return items - .map(item => { - if (!item || !item.content) return; - let content = indent(item.content, first ? "" : indenter, !firstInLine); - if (firstInLine) { - content = content.replace(/^\n+/, ""); - } - if (!content) return; - first = false; - const noJoiner = firstInLine || content.startsWith("\n"); - firstInLine = content.endsWith("\n"); - return noJoiner ? content : " " + content; - }) - .filter(Boolean) - .join("") - .trim(); -}; +register( + RawSource, + CURRENT_MODULE, + "webpack-sources/RawSource", + new (class RawSourceSerializer { + /** + * @param {RawSource} source the raw source to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(source, { write }) { + write(source.buffer()); + write(!source.isBuffer()); + } -const joinError = - error => - (items, { red, yellow }) => - `${error ? red("ERROR") : yellow("WARNING")} in ${joinExplicitNewLine( - items, - "" - )}`; + /** + * @param {ObjectDeserializerContext} context context + * @returns {RawSource} raw source + */ + deserialize({ read }) { + const source = read(); + const convertToString = read(); + return new RawSource(source, convertToString); + } + })() +); -/** @type {Record string>} */ -const SIMPLE_ELEMENT_JOINERS = { - compilation: items => { - const result = []; - let lastNeedMore = false; - for (const item of items) { - if (!item.content) continue; - const needMoreSpace = - item.element === "warnings" || - item.element === "filteredWarningDetailsCount" || - item.element === "errors" || - item.element === "filteredErrorDetailsCount" || - item.element === "logging"; - if (result.length !== 0) { - result.push(needMoreSpace || lastNeedMore ? "\n\n" : "\n"); - } - result.push(item.content); - lastNeedMore = needMoreSpace; +register( + ConcatSource, + CURRENT_MODULE, + "webpack-sources/ConcatSource", + new (class ConcatSourceSerializer { + /** + * @param {ConcatSource} source the concat source to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(source, { write }) { + write(source.getChildren()); } - if (lastNeedMore) result.push("\n"); - return result.join(""); - }, - asset: items => - joinExplicitNewLine( - items.map(item => { - if ( - (item.element === "related" || item.element === "children") && - item.content - ) { - return { - ...item, - content: `\n${item.content}\n` - }; - } - return item; - }), - " " - ), - "asset.info": joinOneLine, - module: (items, { module }) => { - let hasName = false; - return joinExplicitNewLine( - items.map(item => { - switch (item.element) { - case "id": - if (module.id === module.name) { - if (hasName) return false; - if (item.content) hasName = true; - } - break; - case "name": - if (hasName) return false; - if (item.content) hasName = true; - break; - case "providedExports": - case "usedExports": - case "optimizationBailout": - case "reasons": - case "issuerPath": - case "profile": - case "children": - case "modules": - if (item.content) { - return { - ...item, - content: `\n${item.content}\n` - }; - } - break; - } - return item; - }), - " " - ); - }, - chunk: items => { - let hasEntry = false; - return ( - "chunk " + - joinExplicitNewLine( - items.filter(item => { - switch (item.element) { - case "entry": - if (item.content) hasEntry = true; - break; - case "initial": - if (hasEntry) return false; - break; - } - return true; - }), - " " - ) - ); - }, - "chunk.childrenByOrder[]": items => `(${joinOneLine(items)})`, - chunkGroup: items => joinExplicitNewLine(items, " "), - chunkGroupAsset: joinOneLine, - chunkGroupChildGroup: joinOneLine, - chunkGroupChild: joinOneLine, - // moduleReason: (items, { moduleReason }) => { - // let hasName = false; - // return joinOneLine( - // items.filter(item => { - // switch (item.element) { - // case "moduleId": - // if (moduleReason.moduleId === moduleReason.module && item.content) - // hasName = true; - // break; - // case "module": - // if (hasName) return false; - // break; - // case "resolvedModule": - // return ( - // moduleReason.module !== moduleReason.resolvedModule && - // item.content - // ); - // } - // return true; - // }) - // ); - // }, - moduleReason: (items, { moduleReason }) => { - let hasName = false; - return joinExplicitNewLine( - items.map(item => { - switch (item.element) { - case "moduleId": - if (moduleReason.moduleId === moduleReason.module && item.content) - hasName = true; - break; - case "module": - if (hasName) return false; - break; - case "resolvedModule": - if (moduleReason.module === moduleReason.resolvedModule) - return false; - break; - case "children": - if (item.content) { - return { - ...item, - content: `\n${item.content}\n` - }; - } - break; - } - return item; - }), - " " - ); - }, - "module.profile": joinInBrackets, - moduleIssuer: joinOneLine, - chunkOrigin: items => "> " + joinOneLine(items), - "errors[].error": joinError(true), - "warnings[].error": joinError(false), - loggingGroup: items => joinExplicitNewLine(items, "").trimRight(), - moduleTraceItem: items => " @ " + joinOneLine(items), - moduleTraceDependency: joinOneLine -}; -const AVAILABLE_COLORS = { - bold: "\u001b[1m", - yellow: "\u001b[1m\u001b[33m", - red: "\u001b[1m\u001b[31m", - green: "\u001b[1m\u001b[32m", - cyan: "\u001b[1m\u001b[36m", - magenta: "\u001b[1m\u001b[35m" -}; + /** + * @param {ObjectDeserializerContext} context context + * @returns {ConcatSource} concat source + */ + deserialize({ read }) { + const source = new ConcatSource(); + source.addAllSkipOptimizing(read()); + return source; + } + })() +); -const AVAILABLE_FORMATS = { - formatChunkId: (id, { yellow }, direction) => { - switch (direction) { - case "parent": - return `<{${yellow(id)}}>`; - case "sibling": - return `={${yellow(id)}}=`; - case "child": - return `>{${yellow(id)}}<`; - default: - return `{${yellow(id)}}`; +register( + PrefixSource, + CURRENT_MODULE, + "webpack-sources/PrefixSource", + new (class PrefixSourceSerializer { + /** + * @param {PrefixSource} source the prefix source to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(source, { write }) { + write(source.getPrefix()); + write(source.original()); } - }, - formatModuleId: id => `[${id}]`, - formatFilename: (filename, { green, yellow }, oversize) => - (oversize ? yellow : green)(filename), - formatFlag: flag => `[${flag}]`, - formatLayer: layer => `(in ${layer})`, - formatSize: (__webpack_require__(71070).formatSize), - formatDateTime: (dateTime, { bold }) => { - const d = new Date(dateTime); - const x = twoDigit; - const date = `${d.getFullYear()}-${x(d.getMonth() + 1)}-${x(d.getDate())}`; - const time = `${x(d.getHours())}:${x(d.getMinutes())}:${x(d.getSeconds())}`; - return `${date} ${bold(time)}`; - }, - formatTime: ( - time, - { timeReference, bold, green, yellow, red }, - boldQuantity - ) => { - const unit = " ms"; - if (timeReference && time !== timeReference) { - const times = [ - timeReference / 2, - timeReference / 4, - timeReference / 8, - timeReference / 16 - ]; - if (time < times[3]) return `${time}${unit}`; - else if (time < times[2]) return bold(`${time}${unit}`); - else if (time < times[1]) return green(`${time}${unit}`); - else if (time < times[0]) return yellow(`${time}${unit}`); - else return red(`${time}${unit}`); - } else { - return `${boldQuantity ? bold(time) : time}${unit}`; + + /** + * @param {ObjectDeserializerContext} context context + * @returns {PrefixSource} prefix source + */ + deserialize({ read }) { + return new PrefixSource(read(), read()); } - }, - formatError: (message, { green, yellow, red }) => { - if (message.includes("\u001b[")) return message; - const highlights = [ - { regExp: /(Did you mean .+)/g, format: green }, - { - regExp: /(Set 'mode' option to 'development' or 'production')/g, - format: green - }, - { regExp: /(\(module has no exports\))/g, format: red }, - { regExp: /\(possible exports: (.+)\)/g, format: green }, - { regExp: /(?:^|\n)(.* doesn't exist)/g, format: red }, - { regExp: /('\w+' option has not been set)/g, format: red }, - { - regExp: /(Emitted value instead of an instance of Error)/g, - format: yellow - }, - { regExp: /(Used? .+ instead)/gi, format: yellow }, - { regExp: /\b(deprecated|must|required)\b/g, format: yellow }, - { - regExp: /\b(BREAKING CHANGE)\b/gi, - format: red - }, - { - regExp: - /\b(error|failed|unexpected|invalid|not found|not supported|not available|not possible|not implemented|doesn't support|conflict|conflicting|not existing|duplicate)\b/gi, - format: red + })() +); + +register( + ReplaceSource, + CURRENT_MODULE, + "webpack-sources/ReplaceSource", + new (class ReplaceSourceSerializer { + /** + * @param {ReplaceSource} source the replace source to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(source, { write }) { + write(source.original()); + write(source.getName()); + const replacements = source.getReplacements(); + write(replacements.length); + for (const repl of replacements) { + write(repl.start); + write(repl.end); + } + for (const repl of replacements) { + write(repl.content); + write(repl.name); } - ]; - for (const { regExp, format } of highlights) { - message = message.replace(regExp, (match, content) => { - return match.replace(content, format(content)); - }); } - return message; - } -}; -const RESULT_MODIFIER = { - "module.modules": result => { - return indent(result, "| "); - } -}; + /** + * @param {ObjectDeserializerContext} context context + * @returns {ReplaceSource} replace source + */ + deserialize({ read }) { + const source = new ReplaceSource(read(), read()); + const len = read(); + const startEndBuffer = []; + for (let i = 0; i < len; i++) { + startEndBuffer.push(read(), read()); + } + let j = 0; + for (let i = 0; i < len; i++) { + source.replace( + startEndBuffer[j++], + startEndBuffer[j++], + read(), + read() + ); + } + return source; + } + })() +); -const createOrder = (array, preferredOrder) => { - const originalArray = array.slice(); - const set = new Set(array); - const usedSet = new Set(); - array.length = 0; - for (const element of preferredOrder) { - if (element.endsWith("!") || set.has(element)) { - array.push(element); - usedSet.add(element); +register( + OriginalSource, + CURRENT_MODULE, + "webpack-sources/OriginalSource", + new (class OriginalSourceSerializer { + /** + * @param {OriginalSource} source the original source to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(source, { write }) { + write(source.buffer()); + write(source.getName()); } - } - for (const element of originalArray) { - if (!usedSet.has(element)) { - array.push(element); + + /** + * @param {ObjectDeserializerContext} context context + * @returns {OriginalSource} original source + */ + deserialize({ read }) { + const buffer = read(); + const name = read(); + return new OriginalSource(buffer, name); + } + })() +); + +register( + SourceLocation, + CURRENT_MODULE, + "acorn/SourceLocation", + new (class SourceLocationSerializer { + /** + * @param {SourceLocation} loc the location to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(loc, { write }) { + write(loc.start.line); + write(loc.start.column); + write(loc.end.line); + write(loc.end.column); } - } - return array; -}; -class DefaultStatsPrinterPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap("DefaultStatsPrinterPlugin", compilation => { - compilation.hooks.statsPrinter.tap( - "DefaultStatsPrinterPlugin", - (stats, options, context) => { - // Put colors into context - stats.hooks.print - .for("compilation") - .tap("DefaultStatsPrinterPlugin", (compilation, context) => { - for (const color of Object.keys(AVAILABLE_COLORS)) { - let start; - if (options.colors) { - if ( - typeof options.colors === "object" && - typeof options.colors[color] === "string" - ) { - start = options.colors[color]; - } else { - start = AVAILABLE_COLORS[color]; - } - } - if (start) { - context[color] = str => - `${start}${ - typeof str === "string" - ? str.replace( - /((\u001b\[39m|\u001b\[22m|\u001b\[0m)+)/g, - `$1${start}` - ) - : str - }\u001b[39m\u001b[22m`; - } else { - context[color] = str => str; - } - } - for (const format of Object.keys(AVAILABLE_FORMATS)) { - context[format] = (content, ...args) => - AVAILABLE_FORMATS[format](content, context, ...args); - } - context.timeReference = compilation.time; - }); + /** + * @param {ObjectDeserializerContext} context context + * @returns {RealDependencyLocation} location + */ + deserialize({ read }) { + return { + start: { + line: read(), + column: read() + }, + end: { + line: read(), + column: read() + } + }; + } + })() +); - for (const key of Object.keys(SIMPLE_PRINTERS)) { - stats.hooks.print - .for(key) - .tap("DefaultStatsPrinterPlugin", (obj, ctx) => - SIMPLE_PRINTERS[key](obj, ctx, stats) - ); - } +register( + Position, + CURRENT_MODULE, + "acorn/Position", + new (class PositionSerializer { + /** + * @param {Position} pos the position to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(pos, { write }) { + write(pos.line); + write(pos.column); + } - for (const key of Object.keys(PREFERRED_ORDERS)) { - const preferredOrder = PREFERRED_ORDERS[key]; - stats.hooks.sortElements - .for(key) - .tap("DefaultStatsPrinterPlugin", (elements, context) => { - createOrder(elements, preferredOrder); - }); - } + /** + * @param {ObjectDeserializerContext} context context + * @returns {SourcePosition} position + */ + deserialize({ read }) { + return { + line: read(), + column: read() + }; + } + })() +); - for (const key of Object.keys(ITEM_NAMES)) { - const itemName = ITEM_NAMES[key]; - stats.hooks.getItemName - .for(key) - .tap( - "DefaultStatsPrinterPlugin", - typeof itemName === "string" ? () => itemName : itemName - ); - } +register( + SourceMapSource, + CURRENT_MODULE, + "webpack-sources/SourceMapSource", + new (class SourceMapSourceSerializer { + /** + * @param {SourceMapSource} source the source map source to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(source, { write }) { + write(source.getArgsAsBuffers()); + } - for (const key of Object.keys(SIMPLE_ITEMS_JOINER)) { - const joiner = SIMPLE_ITEMS_JOINER[key]; - stats.hooks.printItems - .for(key) - .tap("DefaultStatsPrinterPlugin", joiner); - } + /** + * @param {ObjectDeserializerContext} context context + * @returns {SourceMapSource} source source map source + */ + deserialize({ read }) { + // @ts-expect-error + return new SourceMapSource(...read()); + } + })() +); - for (const key of Object.keys(SIMPLE_ELEMENT_JOINERS)) { - const joiner = SIMPLE_ELEMENT_JOINERS[key]; - stats.hooks.printElements - .for(key) - .tap("DefaultStatsPrinterPlugin", joiner); - } +register( + ValidationError, + CURRENT_MODULE, + "schema-utils/ValidationError", + new (class ValidationErrorSerializer { + // TODO error should be ValidationError, but this fails the type checks + /** + * @param {TODO} error the source map source to be serialized + * @param {WebpackObjectSerializerContext} context context + * @returns {void} + */ + serialize(error, { write }) { + write(error.errors); + write(error.schema); + write({ + name: error.headerName, + baseDataPath: error.baseDataPath, + postFormatter: error.postFormatter + }); + } - for (const key of Object.keys(RESULT_MODIFIER)) { - const modifier = RESULT_MODIFIER[key]; - stats.hooks.result - .for(key) - .tap("DefaultStatsPrinterPlugin", modifier); - } - } - ); - }); - } -} -module.exports = DefaultStatsPrinterPlugin; + /** + * @param {ObjectDeserializerContext} context context + * @returns {TODO} error + */ + deserialize({ read }) { + return new ValidationError(read(), read(), read()); + } + })() +); /***/ }), -/***/ 92629: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 17156: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -127948,553 +128196,627 @@ module.exports = DefaultStatsPrinterPlugin; -const { HookMap, SyncBailHook, SyncWaterfallHook } = __webpack_require__(41242); -const { concatComparators, keepOriginalOrder } = __webpack_require__(29579); -const smartGrouping = __webpack_require__(15652); +const SortableSet = __webpack_require__(13098); -/** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../WebpackError")} WebpackError */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +/** @typedef {import("../Entrypoint").EntryOptions} EntryOptions */ -/** @typedef {import("../util/smartGrouping").GroupConfig} GroupConfig */ +/** @typedef {string | SortableSet | undefined} RuntimeSpec */ +/** @typedef {RuntimeSpec | boolean} RuntimeCondition */ /** - * @typedef {Object} KnownStatsFactoryContext - * @property {string} type - * @property {function(string): string=} makePathsRelative - * @property {Compilation=} compilation - * @property {Set=} rootModules - * @property {Map=} compilationFileToChunks - * @property {Map=} compilationAuxiliaryFileToChunks - * @property {RuntimeSpec=} runtime - * @property {function(Compilation): WebpackError[]=} cachedGetErrors - * @property {function(Compilation): WebpackError[]=} cachedGetWarnings + * @param {Compilation} compilation the compilation + * @param {string} name name of the entry + * @param {EntryOptions=} options optionally already received entry options + * @returns {RuntimeSpec} runtime */ +exports.getEntryRuntime = (compilation, name, options) => { + let dependOn; + let runtime; + if (options) { + ({ dependOn, runtime } = options); + } else { + const entry = compilation.entries.get(name); + if (!entry) return name; + ({ dependOn, runtime } = entry.options); + } + if (dependOn) { + /** @type {RuntimeSpec} */ + let result = undefined; + const queue = new Set(dependOn); + for (const name of queue) { + const dep = compilation.entries.get(name); + if (!dep) continue; + const { dependOn, runtime } = dep.options; + if (dependOn) { + for (const name of dependOn) { + queue.add(name); + } + } else { + result = mergeRuntimeOwned(result, runtime || name); + } + } + return result || name; + } else { + return runtime || name; + } +}; -/** @typedef {KnownStatsFactoryContext & Record} StatsFactoryContext */ +/** + * @param {RuntimeSpec} runtime runtime + * @param {function(string): void} fn functor + * @param {boolean} deterministicOrder enforce a deterministic order + * @returns {void} + */ +exports.forEachRuntime = (runtime, fn, deterministicOrder = false) => { + if (runtime === undefined) { + fn(undefined); + } else if (typeof runtime === "string") { + fn(runtime); + } else { + if (deterministicOrder) runtime.sort(); + for (const r of runtime) { + fn(r); + } + } +}; -class StatsFactory { - constructor() { - this.hooks = Object.freeze({ - /** @type {HookMap>} */ - extract: new HookMap( - () => new SyncBailHook(["object", "data", "context"]) - ), - /** @type {HookMap>} */ - filter: new HookMap( - () => new SyncBailHook(["item", "context", "index", "unfilteredIndex"]) - ), - /** @type {HookMap>} */ - sort: new HookMap(() => new SyncBailHook(["comparators", "context"])), - /** @type {HookMap>} */ - filterSorted: new HookMap( - () => new SyncBailHook(["item", "context", "index", "unfilteredIndex"]) - ), - /** @type {HookMap>} */ - groupResults: new HookMap( - () => new SyncBailHook(["groupConfigs", "context"]) - ), - /** @type {HookMap>} */ - sortResults: new HookMap( - () => new SyncBailHook(["comparators", "context"]) - ), - /** @type {HookMap>} */ - filterResults: new HookMap( - () => new SyncBailHook(["item", "context", "index", "unfilteredIndex"]) - ), - /** @type {HookMap>} */ - merge: new HookMap(() => new SyncBailHook(["items", "context"])), - /** @type {HookMap>} */ - result: new HookMap(() => new SyncWaterfallHook(["result", "context"])), - /** @type {HookMap>} */ - getItemName: new HookMap(() => new SyncBailHook(["item", "context"])), - /** @type {HookMap>} */ - getItemFactory: new HookMap(() => new SyncBailHook(["item", "context"])) - }); - const hooks = this.hooks; - this._caches = - /** @type {Record[]>>} */ ({}); - for (const key of Object.keys(hooks)) { - this._caches[key] = new Map(); +const getRuntimesKey = set => { + set.sort(); + return Array.from(set).join("\n"); +}; + +/** + * @param {RuntimeSpec} runtime runtime(s) + * @returns {string} key of runtimes + */ +const getRuntimeKey = runtime => { + if (runtime === undefined) return "*"; + if (typeof runtime === "string") return runtime; + return runtime.getFromUnorderedCache(getRuntimesKey); +}; +exports.getRuntimeKey = getRuntimeKey; + +/** + * @param {string} key key of runtimes + * @returns {RuntimeSpec} runtime(s) + */ +const keyToRuntime = key => { + if (key === "*") return undefined; + const items = key.split("\n"); + if (items.length === 1) return items[0]; + return new SortableSet(items); +}; +exports.keyToRuntime = keyToRuntime; + +const getRuntimesString = set => { + set.sort(); + return Array.from(set).join("+"); +}; + +/** + * @param {RuntimeSpec} runtime runtime(s) + * @returns {string} readable version + */ +const runtimeToString = runtime => { + if (runtime === undefined) return "*"; + if (typeof runtime === "string") return runtime; + return runtime.getFromUnorderedCache(getRuntimesString); +}; +exports.runtimeToString = runtimeToString; + +/** + * @param {RuntimeCondition} runtimeCondition runtime condition + * @returns {string} readable version + */ +exports.runtimeConditionToString = runtimeCondition => { + if (runtimeCondition === true) return "true"; + if (runtimeCondition === false) return "false"; + return runtimeToString(runtimeCondition); +}; + +/** + * @param {RuntimeSpec} a first + * @param {RuntimeSpec} b second + * @returns {boolean} true, when they are equal + */ +const runtimeEqual = (a, b) => { + if (a === b) { + return true; + } else if ( + a === undefined || + b === undefined || + typeof a === "string" || + typeof b === "string" + ) { + return false; + } else if (a.size !== b.size) { + return false; + } else { + a.sort(); + b.sort(); + const aIt = a[Symbol.iterator](); + const bIt = b[Symbol.iterator](); + for (;;) { + const aV = aIt.next(); + if (aV.done) return true; + const bV = bIt.next(); + if (aV.value !== bV.value) return false; + } + } +}; +exports.runtimeEqual = runtimeEqual; + +/** + * @param {RuntimeSpec} a first + * @param {RuntimeSpec} b second + * @returns {-1|0|1} compare + */ +exports.compareRuntime = (a, b) => { + if (a === b) { + return 0; + } else if (a === undefined) { + return -1; + } else if (b === undefined) { + return 1; + } else { + const aKey = getRuntimeKey(a); + const bKey = getRuntimeKey(b); + if (aKey < bKey) return -1; + if (aKey > bKey) return 1; + return 0; + } +}; + +/** + * @param {RuntimeSpec} a first + * @param {RuntimeSpec} b second + * @returns {RuntimeSpec} merged + */ +const mergeRuntime = (a, b) => { + if (a === undefined) { + return b; + } else if (b === undefined) { + return a; + } else if (a === b) { + return a; + } else if (typeof a === "string") { + if (typeof b === "string") { + const set = new SortableSet(); + set.add(a); + set.add(b); + return set; + } else if (b.has(a)) { + return b; + } else { + const set = new SortableSet(b); + set.add(a); + return set; + } + } else { + if (typeof b === "string") { + if (a.has(b)) return a; + const set = new SortableSet(a); + set.add(b); + return set; + } else { + const set = new SortableSet(a); + for (const item of b) set.add(item); + if (set.size === a.size) return a; + return set; + } + } +}; +exports.mergeRuntime = mergeRuntime; + +/** + * @param {RuntimeCondition} a first + * @param {RuntimeCondition} b second + * @param {RuntimeSpec} runtime full runtime + * @returns {RuntimeCondition} result + */ +exports.mergeRuntimeCondition = (a, b, runtime) => { + if (a === false) return b; + if (b === false) return a; + if (a === true || b === true) return true; + const merged = mergeRuntime(a, b); + if (merged === undefined) return undefined; + if (typeof merged === "string") { + if (typeof runtime === "string" && merged === runtime) return true; + return merged; + } + if (typeof runtime === "string" || runtime === undefined) return merged; + if (merged.size === runtime.size) return true; + return merged; +}; + +/** + * @param {RuntimeSpec | true} a first + * @param {RuntimeSpec | true} b second + * @param {RuntimeSpec} runtime full runtime + * @returns {RuntimeSpec | true} result + */ +exports.mergeRuntimeConditionNonFalse = (a, b, runtime) => { + if (a === true || b === true) return true; + const merged = mergeRuntime(a, b); + if (merged === undefined) return undefined; + if (typeof merged === "string") { + if (typeof runtime === "string" && merged === runtime) return true; + return merged; + } + if (typeof runtime === "string" || runtime === undefined) return merged; + if (merged.size === runtime.size) return true; + return merged; +}; + +/** + * @param {RuntimeSpec} a first (may be modified) + * @param {RuntimeSpec} b second + * @returns {RuntimeSpec} merged + */ +const mergeRuntimeOwned = (a, b) => { + if (b === undefined) { + return a; + } else if (a === b) { + return a; + } else if (a === undefined) { + if (typeof b === "string") { + return b; + } else { + return new SortableSet(b); } - this._inCreate = false; - } - - _getAllLevelHooks(hookMap, cache, type) { - const cacheEntry = cache.get(type); - if (cacheEntry !== undefined) { - return cacheEntry; + } else if (typeof a === "string") { + if (typeof b === "string") { + const set = new SortableSet(); + set.add(a); + set.add(b); + return set; + } else { + const set = new SortableSet(b); + set.add(a); + return set; } - const hooks = []; - const typeParts = type.split("."); - for (let i = 0; i < typeParts.length; i++) { - const hook = hookMap.get(typeParts.slice(i).join(".")); - if (hook) { - hooks.push(hook); - } + } else { + if (typeof b === "string") { + a.add(b); + return a; + } else { + for (const item of b) a.add(item); + return a; } - cache.set(type, hooks); - return hooks; } +}; +exports.mergeRuntimeOwned = mergeRuntimeOwned; - _forEachLevel(hookMap, cache, type, fn) { - for (const hook of this._getAllLevelHooks(hookMap, cache, type)) { - const result = fn(hook); - if (result !== undefined) return result; +/** + * @param {RuntimeSpec} a first + * @param {RuntimeSpec} b second + * @returns {RuntimeSpec} merged + */ +exports.intersectRuntime = (a, b) => { + if (a === undefined) { + return b; + } else if (b === undefined) { + return a; + } else if (a === b) { + return a; + } else if (typeof a === "string") { + if (typeof b === "string") { + return undefined; + } else if (b.has(a)) { + return a; + } else { + return undefined; } - } - - _forEachLevelWaterfall(hookMap, cache, type, data, fn) { - for (const hook of this._getAllLevelHooks(hookMap, cache, type)) { - data = fn(hook, data); + } else { + if (typeof b === "string") { + if (a.has(b)) return b; + return undefined; + } else { + const set = new SortableSet(); + for (const item of b) { + if (a.has(item)) set.add(item); + } + if (set.size === 0) return undefined; + if (set.size === 1) for (const item of set) return item; + return set; } - return data; } +}; - _forEachLevelFilter(hookMap, cache, type, items, fn, forceClone) { - const hooks = this._getAllLevelHooks(hookMap, cache, type); - if (hooks.length === 0) return forceClone ? items.slice() : items; - let i = 0; - return items.filter((item, idx) => { - for (const hook of hooks) { - const r = fn(hook, item, idx, i); - if (r !== undefined) { - if (r) i++; - return r; +/** + * @param {RuntimeSpec} a first + * @param {RuntimeSpec} b second + * @returns {RuntimeSpec} result + */ +const subtractRuntime = (a, b) => { + if (a === undefined) { + return undefined; + } else if (b === undefined) { + return a; + } else if (a === b) { + return undefined; + } else if (typeof a === "string") { + if (typeof b === "string") { + return a; + } else if (b.has(a)) { + return undefined; + } else { + return a; + } + } else { + if (typeof b === "string") { + if (!a.has(b)) return a; + if (a.size === 2) { + for (const item of a) { + if (item !== b) return item; } } - i++; - return true; - }); - } - - /** - * @param {string} type type - * @param {any} data factory data - * @param {Omit} baseContext context used as base - * @returns {any} created object - */ - create(type, data, baseContext) { - if (this._inCreate) { - return this._create(type, data, baseContext); + const set = new SortableSet(a); + set.delete(b); } else { - try { - this._inCreate = true; - return this._create(type, data, baseContext); - } finally { - for (const key of Object.keys(this._caches)) this._caches[key].clear(); - this._inCreate = false; + const set = new SortableSet(); + for (const item of a) { + if (!b.has(item)) set.add(item); } + if (set.size === 0) return undefined; + if (set.size === 1) for (const item of set) return item; + return set; } } +}; +exports.subtractRuntime = subtractRuntime; - _create(type, data, baseContext) { - const context = { - ...baseContext, - type, - [type]: data - }; - if (Array.isArray(data)) { - // run filter on unsorted items - const items = this._forEachLevelFilter( - this.hooks.filter, - this._caches.filter, - type, - data, - (h, r, idx, i) => h.call(r, context, idx, i), - true - ); - - // sort items - const comparators = []; - this._forEachLevel(this.hooks.sort, this._caches.sort, type, h => - h.call(comparators, context) - ); - if (comparators.length > 0) { - items.sort( - // @ts-expect-error number of arguments is correct - concatComparators(...comparators, keepOriginalOrder(items)) - ); - } - - // run filter on sorted items - const items2 = this._forEachLevelFilter( - this.hooks.filterSorted, - this._caches.filterSorted, - type, - items, - (h, r, idx, i) => h.call(r, context, idx, i), - false - ); - - // for each item - let resultItems = items2.map((item, i) => { - const itemContext = { - ...context, - _index: i - }; - - // run getItemName - const itemName = this._forEachLevel( - this.hooks.getItemName, - this._caches.getItemName, - `${type}[]`, - h => h.call(item, itemContext) - ); - if (itemName) itemContext[itemName] = item; - const innerType = itemName ? `${type}[].${itemName}` : `${type}[]`; - - // run getItemFactory - const itemFactory = - this._forEachLevel( - this.hooks.getItemFactory, - this._caches.getItemFactory, - innerType, - h => h.call(item, itemContext) - ) || this; - - // run item factory - return itemFactory.create(innerType, item, itemContext); - }); - - // sort result items - const comparators2 = []; - this._forEachLevel( - this.hooks.sortResults, - this._caches.sortResults, - type, - h => h.call(comparators2, context) - ); - if (comparators2.length > 0) { - resultItems.sort( - // @ts-expect-error number of arguments is correct - concatComparators(...comparators2, keepOriginalOrder(resultItems)) - ); - } - - // group result items - const groupConfigs = []; - this._forEachLevel( - this.hooks.groupResults, - this._caches.groupResults, - type, - h => h.call(groupConfigs, context) - ); - if (groupConfigs.length > 0) { - resultItems = smartGrouping(resultItems, groupConfigs); - } - - // run filter on sorted result items - const finalResultItems = this._forEachLevelFilter( - this.hooks.filterResults, - this._caches.filterResults, - type, - resultItems, - (h, r, idx, i) => h.call(r, context, idx, i), - false - ); - - // run merge on mapped items - let result = this._forEachLevel( - this.hooks.merge, - this._caches.merge, - type, - h => h.call(finalResultItems, context) - ); - if (result === undefined) result = finalResultItems; +/** + * @param {RuntimeCondition} a first + * @param {RuntimeCondition} b second + * @param {RuntimeSpec} runtime runtime + * @returns {RuntimeCondition} result + */ +exports.subtractRuntimeCondition = (a, b, runtime) => { + if (b === true) return false; + if (b === false) return a; + if (a === false) return false; + const result = subtractRuntime(a === true ? runtime : a, b); + return result === undefined ? false : result; +}; - // run result on merged items - return this._forEachLevelWaterfall( - this.hooks.result, - this._caches.result, - type, - result, - (h, r) => h.call(r, context) - ); +/** + * @param {RuntimeSpec} runtime runtime + * @param {function(RuntimeSpec): boolean} filter filter function + * @returns {boolean | RuntimeSpec} true/false if filter is constant for all runtimes, otherwise runtimes that are active + */ +exports.filterRuntime = (runtime, filter) => { + if (runtime === undefined) return filter(undefined); + if (typeof runtime === "string") return filter(runtime); + let some = false; + let every = true; + let result = undefined; + for (const r of runtime) { + const v = filter(r); + if (v) { + some = true; + result = mergeRuntimeOwned(result, r); } else { - const object = {}; - - // run extract on value - this._forEachLevel(this.hooks.extract, this._caches.extract, type, h => - h.call(object, data, context) - ); - - // run result on extracted object - return this._forEachLevelWaterfall( - this.hooks.result, - this._caches.result, - type, - object, - (h, r) => h.call(r, context) - ); + every = false; } } -} -module.exports = StatsFactory; - - -/***/ }), - -/***/ 30198: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { HookMap, SyncWaterfallHook, SyncBailHook } = __webpack_require__(41242); - -/** @template T @typedef {import("tapable").AsArray} AsArray */ -/** @typedef {import("tapable").Hook} Hook */ -/** @typedef {import("./DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */ -/** @typedef {import("./DefaultStatsFactoryPlugin").StatsChunk} StatsChunk */ -/** @typedef {import("./DefaultStatsFactoryPlugin").StatsChunkGroup} StatsChunkGroup */ -/** @typedef {import("./DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */ -/** @typedef {import("./DefaultStatsFactoryPlugin").StatsModule} StatsModule */ -/** @typedef {import("./DefaultStatsFactoryPlugin").StatsModuleReason} StatsModuleReason */ - -/** - * @typedef {Object} PrintedElement - * @property {string} element - * @property {string} content - */ + if (!some) return false; + if (every) return true; + return result; +}; /** - * @typedef {Object} KnownStatsPrinterContext - * @property {string=} type - * @property {StatsCompilation=} compilation - * @property {StatsChunkGroup=} chunkGroup - * @property {StatsAsset=} asset - * @property {StatsModule=} module - * @property {StatsChunk=} chunk - * @property {StatsModuleReason=} moduleReason - * @property {(str: string) => string=} bold - * @property {(str: string) => string=} yellow - * @property {(str: string) => string=} red - * @property {(str: string) => string=} green - * @property {(str: string) => string=} magenta - * @property {(str: string) => string=} cyan - * @property {(file: string, oversize?: boolean) => string=} formatFilename - * @property {(id: string) => string=} formatModuleId - * @property {(id: string, direction?: "parent"|"child"|"sibling") => string=} formatChunkId - * @property {(size: number) => string=} formatSize - * @property {(dateTime: number) => string=} formatDateTime - * @property {(flag: string) => string=} formatFlag - * @property {(time: number, boldQuantity?: boolean) => string=} formatTime - * @property {string=} chunkGroupKind + * @template T */ +class RuntimeSpecMap { + /** + * @param {RuntimeSpecMap=} clone copy form this + */ + constructor(clone) { + this._mode = clone ? clone._mode : 0; // 0 = empty, 1 = single entry, 2 = map + /** @type {RuntimeSpec} */ + this._singleRuntime = clone ? clone._singleRuntime : undefined; + /** @type {T} */ + this._singleValue = clone ? clone._singleValue : undefined; + /** @type {Map | undefined} */ + this._map = clone && clone._map ? new Map(clone._map) : undefined; + } -/** @typedef {KnownStatsPrinterContext & Record} StatsPrinterContext */ - -class StatsPrinter { - constructor() { - this.hooks = Object.freeze({ - /** @type {HookMap>} */ - sortElements: new HookMap( - () => new SyncBailHook(["elements", "context"]) - ), - /** @type {HookMap>} */ - printElements: new HookMap( - () => new SyncBailHook(["printedElements", "context"]) - ), - /** @type {HookMap>} */ - sortItems: new HookMap(() => new SyncBailHook(["items", "context"])), - /** @type {HookMap>} */ - getItemName: new HookMap(() => new SyncBailHook(["item", "context"])), - /** @type {HookMap>} */ - printItems: new HookMap( - () => new SyncBailHook(["printedItems", "context"]) - ), - /** @type {HookMap>} */ - print: new HookMap(() => new SyncBailHook(["object", "context"])), - /** @type {HookMap>} */ - result: new HookMap(() => new SyncWaterfallHook(["result", "context"])) - }); - /** @type {Map, Map>} */ - this._levelHookCache = new Map(); - this._inPrint = false; + /** + * @param {RuntimeSpec} runtime the runtimes + * @returns {T} value + */ + get(runtime) { + switch (this._mode) { + case 0: + return undefined; + case 1: + return runtimeEqual(this._singleRuntime, runtime) + ? this._singleValue + : undefined; + default: + return this._map.get(getRuntimeKey(runtime)); + } } /** - * get all level hooks - * @private - * @template {Hook} T - * @param {HookMap} hookMap HookMap - * @param {string} type type - * @returns {T[]} hooks + * @param {RuntimeSpec} runtime the runtimes + * @returns {boolean} true, when the runtime is stored */ - _getAllLevelHooks(hookMap, type) { - let cache = /** @type {Map} */ ( - this._levelHookCache.get(hookMap) - ); - if (cache === undefined) { - cache = new Map(); - this._levelHookCache.set(hookMap, cache); + has(runtime) { + switch (this._mode) { + case 0: + return false; + case 1: + return runtimeEqual(this._singleRuntime, runtime); + default: + return this._map.has(getRuntimeKey(runtime)); } - const cacheEntry = cache.get(type); - if (cacheEntry !== undefined) { - return cacheEntry; + } + + set(runtime, value) { + switch (this._mode) { + case 0: + this._mode = 1; + this._singleRuntime = runtime; + this._singleValue = value; + break; + case 1: + if (runtimeEqual(this._singleRuntime, runtime)) { + this._singleValue = value; + break; + } + this._mode = 2; + this._map = new Map(); + this._map.set(getRuntimeKey(this._singleRuntime), this._singleValue); + this._singleRuntime = undefined; + this._singleValue = undefined; + /* falls through */ + default: + this._map.set(getRuntimeKey(runtime), value); } - /** @type {T[]} */ - const hooks = []; - const typeParts = type.split("."); - for (let i = 0; i < typeParts.length; i++) { - const hook = hookMap.get(typeParts.slice(i).join(".")); - if (hook) { - hooks.push(hook); + } + + provide(runtime, computer) { + switch (this._mode) { + case 0: + this._mode = 1; + this._singleRuntime = runtime; + return (this._singleValue = computer()); + case 1: { + if (runtimeEqual(this._singleRuntime, runtime)) { + return this._singleValue; + } + this._mode = 2; + this._map = new Map(); + this._map.set(getRuntimeKey(this._singleRuntime), this._singleValue); + this._singleRuntime = undefined; + this._singleValue = undefined; + const newValue = computer(); + this._map.set(getRuntimeKey(runtime), newValue); + return newValue; + } + default: { + const key = getRuntimeKey(runtime); + const value = this._map.get(key); + if (value !== undefined) return value; + const newValue = computer(); + this._map.set(key, newValue); + return newValue; } } - cache.set(type, hooks); - return hooks; } - /** - * Run `fn` for each level - * @private - * @template T - * @template R - * @param {HookMap>} hookMap HookMap - * @param {string} type type - * @param {(hook: SyncBailHook) => R} fn function - * @returns {R} result of `fn` - */ - _forEachLevel(hookMap, type, fn) { - for (const hook of this._getAllLevelHooks(hookMap, type)) { - const result = fn(hook); - if (result !== undefined) return result; + delete(runtime) { + switch (this._mode) { + case 0: + return; + case 1: + if (runtimeEqual(this._singleRuntime, runtime)) { + this._mode = 0; + this._singleRuntime = undefined; + this._singleValue = undefined; + } + return; + default: + this._map.delete(getRuntimeKey(runtime)); } } - /** - * Run `fn` for each level - * @private - * @template T - * @param {HookMap>} hookMap HookMap - * @param {string} type type - * @param {AsArray[0]} data data - * @param {(hook: SyncWaterfallHook, data: AsArray[0]) => AsArray[0]} fn function - * @returns {AsArray[0]} result of `fn` - */ - _forEachLevelWaterfall(hookMap, type, data, fn) { - for (const hook of this._getAllLevelHooks(hookMap, type)) { - data = fn(hook, data); + update(runtime, fn) { + switch (this._mode) { + case 0: + throw new Error("runtime passed to update must exist"); + case 1: { + if (runtimeEqual(this._singleRuntime, runtime)) { + this._singleValue = fn(this._singleValue); + break; + } + const newValue = fn(undefined); + if (newValue !== undefined) { + this._mode = 2; + this._map = new Map(); + this._map.set(getRuntimeKey(this._singleRuntime), this._singleValue); + this._singleRuntime = undefined; + this._singleValue = undefined; + this._map.set(getRuntimeKey(runtime), newValue); + } + break; + } + default: { + const key = getRuntimeKey(runtime); + const oldValue = this._map.get(key); + const newValue = fn(oldValue); + if (newValue !== oldValue) this._map.set(key, newValue); + } } - return data; } - /** - * @param {string} type The type - * @param {Object} object Object to print - * @param {Object=} baseContext The base context - * @returns {string} printed result - */ - print(type, object, baseContext) { - if (this._inPrint) { - return this._print(type, object, baseContext); - } else { - try { - this._inPrint = true; - return this._print(type, object, baseContext); - } finally { - this._levelHookCache.clear(); - this._inPrint = false; - } + keys() { + switch (this._mode) { + case 0: + return []; + case 1: + return [this._singleRuntime]; + default: + return Array.from(this._map.keys(), keyToRuntime); } } - /** - * @private - * @param {string} type type - * @param {Object} object object - * @param {Object=} baseContext context - * @returns {string} printed result - */ - _print(type, object, baseContext) { - const context = { - ...baseContext, - type, - [type]: object - }; + values() { + switch (this._mode) { + case 0: + return [][Symbol.iterator](); + case 1: + return [this._singleValue][Symbol.iterator](); + default: + return this._map.values(); + } + } - let printResult = this._forEachLevel(this.hooks.print, type, hook => - hook.call(object, context) - ); - if (printResult === undefined) { - if (Array.isArray(object)) { - const sortedItems = object.slice(); - this._forEachLevel(this.hooks.sortItems, type, h => - h.call(sortedItems, context) - ); - const printedItems = sortedItems.map((item, i) => { - const itemContext = { - ...context, - _index: i - }; - const itemName = this._forEachLevel( - this.hooks.getItemName, - `${type}[]`, - h => h.call(item, itemContext) - ); - if (itemName) itemContext[itemName] = item; - return this.print( - itemName ? `${type}[].${itemName}` : `${type}[]`, - item, - itemContext - ); - }); - printResult = this._forEachLevel(this.hooks.printItems, type, h => - h.call(printedItems, context) - ); - if (printResult === undefined) { - const result = printedItems.filter(Boolean); - if (result.length > 0) printResult = result.join("\n"); - } - } else if (object !== null && typeof object === "object") { - const elements = Object.keys(object).filter( - key => object[key] !== undefined - ); - this._forEachLevel(this.hooks.sortElements, type, h => - h.call(elements, context) - ); - const printedElements = elements.map(element => { - const content = this.print(`${type}.${element}`, object[element], { - ...context, - _parent: object, - _element: element, - [element]: object[element] - }); - return { element, content }; - }); - printResult = this._forEachLevel(this.hooks.printElements, type, h => - h.call(printedElements, context) - ); - if (printResult === undefined) { - const result = printedElements.map(e => e.content).filter(Boolean); - if (result.length > 0) printResult = result.join("\n"); - } + get size() { + if (this._mode <= 1) return this._mode; + return this._map.size; + } +} + +exports.RuntimeSpecMap = RuntimeSpecMap; + +class RuntimeSpecSet { + constructor(iterable) { + /** @type {Map} */ + this._map = new Map(); + if (iterable) { + for (const item of iterable) { + this.add(item); } } + } - return this._forEachLevelWaterfall( - this.hooks.result, - type, - printResult, - (h, r) => h.call(r, context) - ); + add(runtime) { + this._map.set(getRuntimeKey(runtime), runtime); + } + + has(runtime) { + return this._map.has(getRuntimeKey(runtime)); + } + + [Symbol.iterator]() { + return this._map.values(); + } + + get size() { + return this._map.size; } } -module.exports = StatsPrinter; + +exports.RuntimeSpecSet = RuntimeSpecSet; /***/ }), -/***/ 84953: +/***/ 19702: /***/ (function(__unused_webpack_module, exports) { "use strict"; @@ -128505,591 +128827,838 @@ module.exports = StatsPrinter; +/** @typedef {(string|number|undefined|[])[]} SemVerRange */ + /** - * Compare two arrays or strings by performing strict equality check for each value. - * @template T [T=any] - * @param {ArrayLike} a Array of values to be compared - * @param {ArrayLike} b Array of values to be compared - * @returns {boolean} returns true if all the elements of passed arrays are strictly equal. + * @param {string} str version string + * @returns {(string|number|undefined|[])[]} parsed version */ +const parseVersion = str => { + var splitAndConvert = function (str) { + return str.split(".").map(function (item) { + // eslint-disable-next-line eqeqeq + return +item == item ? +item : item; + }); + }; + var match = /^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(str); + /** @type {(string|number|undefined|[])[]} */ + var ver = match[1] ? splitAndConvert(match[1]) : []; + if (match[2]) { + ver.length++; + ver.push.apply(ver, splitAndConvert(match[2])); + } + if (match[3]) { + ver.push([]); + ver.push.apply(ver, splitAndConvert(match[3])); + } + return ver; +}; +exports.parseVersion = parseVersion; -exports.equals = (a, b) => { - if (a.length !== b.length) return false; - for (let i = 0; i < a.length; i++) { - if (a[i] !== b[i]) return false; +/* eslint-disable eqeqeq */ +/** + * @param {string} a version + * @param {string} b version + * @returns {boolean} true, iff a < b + */ +const versionLt = (a, b) => { + // @ts-expect-error + a = parseVersion(a); + // @ts-expect-error + b = parseVersion(b); + var i = 0; + for (;;) { + // a b EOA object undefined number string + // EOA a == b a < b b < a a < b a < b + // object b < a (0) b < a a < b a < b + // undefined a < b a < b (0) a < b a < b + // number b < a b < a b < a (1) a < b + // string b < a b < a b < a b < a (1) + // EOA end of array + // (0) continue on + // (1) compare them via "<" + + // Handles first row in table + if (i >= a.length) return i < b.length && (typeof b[i])[0] != "u"; + + var aValue = a[i]; + var aType = (typeof aValue)[0]; + + // Handles first column in table + if (i >= b.length) return aType == "u"; + + var bValue = b[i]; + var bType = (typeof bValue)[0]; + + if (aType == bType) { + if (aType != "o" && aType != "u" && aValue != bValue) { + return aValue < bValue; + } + i++; + } else { + // Handles remaining cases + if (aType == "o" && bType == "n") return true; + return bType == "s" || aType == "u"; + } } - return true; }; +/* eslint-enable eqeqeq */ +exports.versionLt = versionLt; /** - * Partition an array by calling a predicate function on each value. - * @template T [T=any] - * @param {Array} arr Array of values to be partitioned - * @param {(value: T) => boolean} fn Partition function which partitions based on truthiness of result. - * @returns {[Array, Array]} returns the values of `arr` partitioned into two new arrays based on fn predicate. + * @param {string} str range string + * @returns {SemVerRange} parsed range */ -exports.groupBy = (arr = [], fn) => { - return arr.reduce( - /** - * @param {[Array, Array]} groups An accumulator storing already partitioned values returned from previous call. - * @param {T} value The value of the current element - * @returns {[Array, Array]} returns an array of partitioned groups accumulator resulting from calling a predicate on the current value. - */ - (groups, value) => { - groups[fn(value) ? 0 : 1].push(value); - return groups; - }, - [[], []] - ); +exports.parseRange = str => { + const splitAndConvert = str => { + return str + .split(".") + .map(item => (item !== "NaN" && `${+item}` === item ? +item : item)); + }; + // see https://docs.npmjs.com/misc/semver#range-grammar for grammar + const parsePartial = str => { + const match = /^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(str); + /** @type {(string|number|undefined|[])[]} */ + const ver = match[1] ? [0, ...splitAndConvert(match[1])] : [0]; + if (match[2]) { + ver.length++; + ver.push.apply(ver, splitAndConvert(match[2])); + } + + // remove trailing any matchers + let last = ver[ver.length - 1]; + while ( + ver.length && + (last === undefined || /^[*xX]$/.test(/** @type {string} */ (last))) + ) { + ver.pop(); + last = ver[ver.length - 1]; + } + + return ver; + }; + const toFixed = range => { + if (range.length === 1) { + // Special case for "*" is "x.x.x" instead of "=" + return [0]; + } else if (range.length === 2) { + // Special case for "1" is "1.x.x" instead of "=1" + return [1, ...range.slice(1)]; + } else if (range.length === 3) { + // Special case for "1.2" is "1.2.x" instead of "=1.2" + return [2, ...range.slice(1)]; + } else { + return [range.length, ...range.slice(1)]; + } + }; + const negate = range => { + return [-range[0] - 1, ...range.slice(1)]; + }; + const parseSimple = str => { + // simple ::= primitive | partial | tilde | caret + // primitive ::= ( '<' | '>' | '>=' | '<=' | '=' | '!' ) ( ' ' ) * partial + // tilde ::= '~' ( ' ' ) * partial + // caret ::= '^' ( ' ' ) * partial + const match = /^(\^|~|<=|<|>=|>|=|v|!)/.exec(str); + const start = match ? match[0] : ""; + const remainder = parsePartial( + start.length ? str.slice(start.length).trim() : str.trim() + ); + switch (start) { + case "^": + if (remainder.length > 1 && remainder[1] === 0) { + if (remainder.length > 2 && remainder[2] === 0) { + return [3, ...remainder.slice(1)]; + } + return [2, ...remainder.slice(1)]; + } + return [1, ...remainder.slice(1)]; + case "~": + return [2, ...remainder.slice(1)]; + case ">=": + return remainder; + case "=": + case "v": + case "": + return toFixed(remainder); + case "<": + return negate(remainder); + case ">": { + // and( >=, not( = ) ) => >=, =, not, and + const fixed = toFixed(remainder); + // eslint-disable-next-line no-sparse-arrays + return [, fixed, 0, remainder, 2]; + } + case "<=": + // or( <, = ) => <, =, or + // eslint-disable-next-line no-sparse-arrays + return [, toFixed(remainder), negate(remainder), 1]; + case "!": { + // not = + const fixed = toFixed(remainder); + // eslint-disable-next-line no-sparse-arrays + return [, fixed, 0]; + } + default: + throw new Error("Unexpected start value"); + } + }; + const combine = (items, fn) => { + if (items.length === 1) return items[0]; + const arr = []; + for (const item of items.slice().reverse()) { + if (0 in item) { + arr.push(item); + } else { + arr.push(...item.slice(1)); + } + } + // eslint-disable-next-line no-sparse-arrays + return [, ...arr, ...items.slice(1).map(() => fn)]; + }; + const parseRange = str => { + // range ::= hyphen | simple ( ' ' ( ' ' ) * simple ) * | '' + // hyphen ::= partial ( ' ' ) * ' - ' ( ' ' ) * partial + const items = str.split(/\s+-\s+/); + if (items.length === 1) { + const items = str + .trim() + .split(/(?<=[-0-9A-Za-z])\s+/g) + .map(parseSimple); + return combine(items, 2); + } + const a = parsePartial(items[0]); + const b = parsePartial(items[1]); + // >=a <=b => and( >=a, or( >=a, { + // range-set ::= range ( logical-or range ) * + // logical-or ::= ( ' ' ) * '||' ( ' ' ) * + const items = str.split(/\s*\|\|\s*/).map(parseRange); + return combine(items, 1); + }; + return parseLogicalOr(str); +}; + +/* eslint-disable eqeqeq */ +const rangeToString = range => { + var fixCount = range[0]; + var str = ""; + if (range.length === 1) { + return "*"; + } else if (fixCount + 0.5) { + str += + fixCount == 0 + ? ">=" + : fixCount == -1 + ? "<" + : fixCount == 1 + ? "^" + : fixCount == 2 + ? "~" + : fixCount > 0 + ? "=" + : "!="; + var needDot = 1; + // eslint-disable-next-line no-redeclare + for (var i = 1; i < range.length; i++) { + var item = range[i]; + var t = (typeof item)[0]; + needDot--; + str += + t == "u" + ? // undefined: prerelease marker, add an "-" + "-" + : // number or string: add the item, set flag to add an "." between two of them + (needDot > 0 ? "." : "") + ((needDot = 2), item); + } + return str; + } else { + var stack = []; + // eslint-disable-next-line no-redeclare + for (var i = 1; i < range.length; i++) { + // eslint-disable-next-line no-redeclare + var item = range[i]; + stack.push( + item === 0 + ? "not(" + pop() + ")" + : item === 1 + ? "(" + pop() + " || " + pop() + ")" + : item === 2 + ? stack.pop() + " " + stack.pop() + : rangeToString(item) + ); + } + return pop(); + } + function pop() { + return stack.pop().replace(/^\((.+)\)$/, "$1"); + } }; +/* eslint-enable eqeqeq */ +exports.rangeToString = rangeToString; + +/* eslint-disable eqeqeq */ +/** + * @param {SemVerRange} range version range + * @param {string} version the version + * @returns {boolean} if version satisfy the range + */ +const satisfy = (range, version) => { + if (0 in range) { + // @ts-expect-error + version = parseVersion(version); + var fixCount = range[0]; + // when negated is set it swill set for < instead of >= + var negated = fixCount < 0; + if (negated) fixCount = -fixCount - 1; + for (var i = 0, j = 1, isEqual = true; ; j++, i++) { + // cspell:word nequal nequ + // when isEqual = true: + // range version: EOA/object undefined number string + // EOA equal block big-ver big-ver + // undefined bigger next big-ver big-ver + // number smaller block cmp big-cmp + // fixed number smaller block cmp-fix differ + // string smaller block differ cmp + // fixed string smaller block small-cmp cmp-fix -/***/ }), + // when isEqual = false: + // range version: EOA/object undefined number string + // EOA nequal block next-ver next-ver + // undefined nequal block next-ver next-ver + // number nequal block next next + // fixed number nequal block next next (this never happens) + // string nequal block next next + // fixed string nequal block next next (this never happens) -/***/ 41792: -/***/ (function(module) { + // EOA end of array + // equal (version is equal range): + // when !negated: return true, + // when negated: return false + // bigger (version is bigger as range): + // when fixed: return false, + // when !negated: return true, + // when negated: return false, + // smaller (version is smaller as range): + // when !negated: return false, + // when negated: return true + // nequal (version is not equal range (> resp <)): return true + // block (version is in different prerelease area): return false + // differ (version is different from fixed range (string vs. number)): return false + // next: continues to the next items + // next-ver: when fixed: return false, continues to the next item only for the version, sets isEqual=false + // big-ver: when fixed || negated: return false, continues to the next item only for the version, sets isEqual=false + // next-nequ: continues to the next items, sets isEqual=false + // cmp (negated === false): version < range => return false, version > range => next-nequ, else => next + // cmp (negated === true): version > range => return false, version < range => next-nequ, else => next + // cmp-fix: version == range => next, else => return false + // big-cmp: when negated => return false, else => next-nequ + // small-cmp: when negated => next-nequ, else => return false -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + var rangeType = j < range.length ? (typeof range[j])[0] : ""; + var versionValue; + var versionType; + // Handles first column in both tables (end of version or object) + if ( + i >= version.length || + ((versionValue = version[i]), + (versionType = (typeof versionValue)[0]) == "o") + ) { + // Handles nequal + if (!isEqual) return true; + // Handles bigger + if (rangeType == "u") return j > fixCount && !negated; + // Handles equal and smaller: (range === EOA) XOR negated + return (rangeType == "") != negated; // equal + smaller + } -/** - * @template T - */ -class ArrayQueue { - /** - * @param {Iterable=} items The initial elements. - */ - constructor(items) { - /** @private @type {T[]} */ - this._list = items ? Array.from(items) : []; - /** @private @type {T[]} */ - this._listReversed = []; - } + // Handles second column in both tables (version = undefined) + if (versionType == "u") { + if (!isEqual || rangeType != "u") { + return false; + } + } - /** - * Returns the number of elements in this queue. - * @returns {number} The number of elements in this queue. - */ - get length() { - return this._list.length + this._listReversed.length; - } + // switch between first and second table + else if (isEqual) { + // Handle diagonal + if (rangeType == versionType) { + if (j <= fixCount) { + // Handles "cmp-fix" cases + if (versionValue != range[j]) { + return false; + } + } else { + // Handles "cmp" cases + if (negated ? versionValue > range[j] : versionValue < range[j]) { + return false; + } + if (versionValue != range[j]) isEqual = false; + } + } - /** - * Empties the queue. - */ - clear() { - this._list.length = 0; - this._listReversed.length = 0; - } + // Handle big-ver + else if (rangeType != "s" && rangeType != "n") { + if (negated || j <= fixCount) return false; + isEqual = false; + j--; + } - /** - * Appends the specified element to this queue. - * @param {T} item The element to add. - * @returns {void} - */ - enqueue(item) { - this._list.push(item); - } + // Handle differ, big-cmp and small-cmp + else if (j <= fixCount || versionType < rangeType != negated) { + return false; + } else { + isEqual = false; + } + } else { + // Handles all "next-ver" cases in the second table + if (rangeType != "s" && rangeType != "n") { + isEqual = false; + j--; + } - /** - * Retrieves and removes the head of this queue. - * @returns {T | undefined} The head of the queue of `undefined` if this queue is empty. - */ - dequeue() { - if (this._listReversed.length === 0) { - if (this._list.length === 0) return undefined; - if (this._list.length === 1) return this._list.pop(); - if (this._list.length < 16) return this._list.shift(); - const temp = this._listReversed; - this._listReversed = this._list; - this._listReversed.reverse(); - this._list = temp; + // next is applied by default + } } - return this._listReversed.pop(); } - - /** - * Finds and removes an item - * @param {T} item the item - * @returns {void} - */ - delete(item) { - const i = this._list.indexOf(item); - if (i >= 0) { - this._list.splice(i, 1); - } else { - const i = this._listReversed.indexOf(item); - if (i >= 0) this._listReversed.splice(i, 1); - } + /** @type {(boolean | number)[]} */ + var stack = []; + var p = stack.pop.bind(stack); + // eslint-disable-next-line no-redeclare + for (var i = 1; i < range.length; i++) { + var item = /** @type {SemVerRange | 0 | 1 | 2} */ (range[i]); + stack.push( + item == 1 + ? p() | p() + : item == 2 + ? p() & p() + : item + ? satisfy(item, version) + : !p() + ); } + return !!p(); +}; +/* eslint-enable eqeqeq */ +exports.satisfy = satisfy; - [Symbol.iterator]() { - let i = -1; - let reversed = false; - return { - next: () => { - if (!reversed) { - i++; - if (i < this._list.length) { - return { - done: false, - value: this._list[i] - }; - } - reversed = true; - i = this._listReversed.length; - } - i--; - if (i < 0) { - return { - done: true, - value: undefined - }; +exports.stringifyHoley = json => { + switch (typeof json) { + case "undefined": + return ""; + case "object": + if (Array.isArray(json)) { + let str = "["; + for (let i = 0; i < json.length; i++) { + if (i !== 0) str += ","; + str += this.stringifyHoley(json[i]); } - return { - done: false, - value: this._listReversed[i] - }; + str += "]"; + return str; + } else { + return JSON.stringify(json); } - }; + default: + return JSON.stringify(json); } -} +}; -module.exports = ArrayQueue; +//#region runtime code: parseVersion +exports.parseVersionRuntimeCode = runtimeTemplate => + `var parseVersion = ${runtimeTemplate.basicFunction("str", [ + "// see webpack/lib/util/semver.js for original code", + `var p=${ + runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)" + }{return p.split(".").map((${ + runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)" + }{return+p==p?+p:p}))},n=/^([^-+]+)?(?:-([^+]+))?(?:\\+(.+))?$/.exec(str),r=n[1]?p(n[1]):[];return n[2]&&(r.length++,r.push.apply(r,p(n[2]))),n[3]&&(r.push([]),r.push.apply(r,p(n[3]))),r;` + ])}`; +//#endregion + +//#region runtime code: versionLt +exports.versionLtRuntimeCode = runtimeTemplate => + `var versionLt = ${runtimeTemplate.basicFunction("a, b", [ + "// see webpack/lib/util/semver.js for original code", + 'a=parseVersion(a),b=parseVersion(b);for(var r=0;;){if(r>=a.length)return r=b.length)return"u"==n;var t=b[r],f=(typeof t)[0];if(n!=f)return"o"==n&&"n"==f||("s"==f||"u"==n);if("o"!=n&&"u"!=n&&e!=t)return e + `var rangeToString = ${runtimeTemplate.basicFunction("range", [ + "// see webpack/lib/util/semver.js for original code", + 'var r=range[0],n="";if(1===range.length)return"*";if(r+.5){n+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var e=1,a=1;a0?".":"")+(e=2,t)}return n}var g=[];for(a=1;a + `var satisfy = ${runtimeTemplate.basicFunction("range, version", [ + "// see webpack/lib/util/semver.js for original code", + 'if(0 in range){version=parseVersion(version);var e=range[0],r=e<0;r&&(e=-e-1);for(var n=0,i=1,a=!0;;i++,n++){var f,s,g=i=version.length||"o"==(s=(typeof(f=version[n]))[0]))return!a||("u"==g?i>e&&!r:""==g!=r);if("u"==s){if(!a||"u"!=g)return!1}else if(a)if(g==s)if(i<=e){if(f!=range[i])return!1}else{if(r?f>range[i]:f + __webpack_require__(97059) +); +const getObjectMiddleware = memoize(() => + __webpack_require__(34795) +); +const getSingleItemMiddleware = memoize(() => + __webpack_require__(65112) +); +const getSerializer = memoize(() => __webpack_require__(53080)); +const getSerializerMiddleware = memoize(() => + __webpack_require__(83137) +); -/** - * @template T - * @callback Callback - * @param {(WebpackError | null)=} err - * @param {T=} result - */ +const getBinaryMiddlewareInstance = memoize( + () => new (getBinaryMiddleware())() +); -/** - * @template T - * @template K - * @template R - */ -class AsyncQueueEntry { - /** - * @param {T} item the item - * @param {Callback} callback the callback - */ - constructor(item, callback) { - this.item = item; - /** @type {typeof QUEUED_STATE | typeof PROCESSING_STATE | typeof DONE_STATE} */ - this.state = QUEUED_STATE; - this.callback = callback; - /** @type {Callback[] | undefined} */ - this.callbacks = undefined; - this.result = undefined; - /** @type {WebpackError | undefined} */ - this.error = undefined; - } -} +const registerSerializers = memoize(() => { + __webpack_require__(26611); -/** - * @template T - * @template K - * @template R - */ -class AsyncQueue { - /** - * @param {Object} options options object - * @param {string=} options.name name of the queue - * @param {number=} options.parallelism how many items should be processed at once - * @param {AsyncQueue=} options.parent parent queue, which will have priority over this queue and with shared parallelism - * @param {function(T): K=} options.getKey extract key from item - * @param {function(T, Callback): void} options.processor async function to process items - */ - constructor({ name, parallelism, parent, processor, getKey }) { - this._name = name; - this._parallelism = parallelism || 1; - this._processor = processor; - this._getKey = - getKey || /** @type {(T) => K} */ (item => /** @type {any} */ (item)); - /** @type {Map>} */ - this._entries = new Map(); - /** @type {ArrayQueue>} */ - this._queued = new ArrayQueue(); - /** @type {AsyncQueue[]} */ - this._children = undefined; - this._activeTasks = 0; - this._willEnsureProcessing = false; - this._needProcessing = false; - this._stopped = false; - this._root = parent ? parent._root : this; - if (parent) { - if (this._root._children === undefined) { - this._root._children = [this]; - } else { - this._root._children.push(this); - } + // Load internal paths with a relative require + // This allows bundling all internal serializers + const internalSerializables = __webpack_require__(53023); + getObjectMiddleware().registerLoader(/^webpack\/lib\//, req => { + const loader = internalSerializables[req.slice("webpack/lib/".length)]; + if (loader) { + loader(); + } else { + console.warn(`${req} not found in internalSerializables`); } + return true; + }); +}); - this.hooks = { - /** @type {AsyncSeriesHook<[T]>} */ - beforeAdd: new AsyncSeriesHook(["item"]), - /** @type {SyncHook<[T]>} */ - added: new SyncHook(["item"]), - /** @type {AsyncSeriesHook<[T]>} */ - beforeStart: new AsyncSeriesHook(["item"]), - /** @type {SyncHook<[T]>} */ - started: new SyncHook(["item"]), - /** @type {SyncHook<[T, Error, R]>} */ - result: new SyncHook(["item", "error", "result"]) - }; - - this._ensureProcessing = this._ensureProcessing.bind(this); - } +/** @type {Serializer} */ +let buffersSerializer; - /** - * @param {T} item an item - * @param {Callback} callback callback function - * @returns {void} - */ - add(item, callback) { - if (this._stopped) return callback(new WebpackError("Queue was stopped")); - this.hooks.beforeAdd.callAsync(item, err => { - if (err) { - callback( - makeWebpackError(err, `AsyncQueue(${this._name}).hooks.beforeAdd`) - ); - return; - } - const key = this._getKey(item); - const entry = this._entries.get(key); - if (entry !== undefined) { - if (entry.state === DONE_STATE) { - if (inHandleResult++ > 3) { - process.nextTick(() => callback(entry.error, entry.result)); - } else { - callback(entry.error, entry.result); - } - inHandleResult--; - } else if (entry.callbacks === undefined) { - entry.callbacks = [callback]; - } else { - entry.callbacks.push(callback); +// Expose serialization API +module.exports = { + get register() { + return getObjectMiddleware().register; + }, + get registerLoader() { + return getObjectMiddleware().registerLoader; + }, + get registerNotSerializable() { + return getObjectMiddleware().registerNotSerializable; + }, + get NOT_SERIALIZABLE() { + return getObjectMiddleware().NOT_SERIALIZABLE; + }, + /** @type {MEASURE_START_OPERATION} */ + get MEASURE_START_OPERATION() { + return getBinaryMiddleware().MEASURE_START_OPERATION; + }, + /** @type {MEASURE_END_OPERATION} */ + get MEASURE_END_OPERATION() { + return getBinaryMiddleware().MEASURE_END_OPERATION; + }, + get buffersSerializer() { + if (buffersSerializer !== undefined) return buffersSerializer; + registerSerializers(); + const Serializer = getSerializer(); + const binaryMiddleware = getBinaryMiddlewareInstance(); + const SerializerMiddleware = getSerializerMiddleware(); + const SingleItemMiddleware = getSingleItemMiddleware(); + return (buffersSerializer = new Serializer([ + new SingleItemMiddleware(), + new (getObjectMiddleware())(context => { + if (context.write) { + context.writeLazy = value => { + context.write( + SerializerMiddleware.createLazy(value, binaryMiddleware) + ); + }; } - return; - } - const newEntry = new AsyncQueueEntry(item, callback); - if (this._stopped) { - this.hooks.added.call(item); - this._root._activeTasks++; - process.nextTick(() => - this._handleResult(newEntry, new WebpackError("Queue was stopped")) - ); - } else { - this._entries.set(key, newEntry); - this._queued.enqueue(newEntry); - const root = this._root; - root._needProcessing = true; - if (root._willEnsureProcessing === false) { - root._willEnsureProcessing = true; - setImmediate(root._ensureProcessing); + }, "md4"), + binaryMiddleware + ])); + }, + createFileSerializer: (fs, hashFunction) => { + registerSerializers(); + const Serializer = getSerializer(); + const FileMiddleware = __webpack_require__(65321); + const fileMiddleware = new FileMiddleware(fs, hashFunction); + const binaryMiddleware = getBinaryMiddlewareInstance(); + const SerializerMiddleware = getSerializerMiddleware(); + const SingleItemMiddleware = getSingleItemMiddleware(); + return new Serializer([ + new SingleItemMiddleware(), + new (getObjectMiddleware())(context => { + if (context.write) { + context.writeLazy = value => { + context.write( + SerializerMiddleware.createLazy(value, binaryMiddleware) + ); + }; + context.writeSeparate = (value, options) => { + const lazy = SerializerMiddleware.createLazy( + value, + fileMiddleware, + options + ); + context.write(lazy); + return lazy; + }; } - this.hooks.added.call(item); - } - }); + }, hashFunction), + binaryMiddleware, + fileMiddleware + ]); } +}; - /** - * @param {T} item an item - * @returns {void} - */ - invalidate(item) { - const key = this._getKey(item); - const entry = this._entries.get(key); - this._entries.delete(key); - if (entry.state === QUEUED_STATE) { - this._queued.delete(entry); - } - } - /** - * Waits for an already started item - * @param {T} item an item - * @param {Callback} callback callback function - * @returns {void} - */ - waitFor(item, callback) { - const key = this._getKey(item); - const entry = this._entries.get(key); - if (entry === undefined) { - return callback( - new WebpackError( - "waitFor can only be called for an already started item" - ) - ); - } - if (entry.state === DONE_STATE) { - process.nextTick(() => callback(entry.error, entry.result)); - } else if (entry.callbacks === undefined) { - entry.callbacks = [callback]; - } else { - entry.callbacks.push(callback); - } - } +/***/ }), - /** - * @returns {void} - */ - stop() { - this._stopped = true; - const queue = this._queued; - this._queued = new ArrayQueue(); - const root = this._root; - for (const entry of queue) { - this._entries.delete(this._getKey(entry.item)); - root._activeTasks++; - this._handleResult(entry, new WebpackError("Queue was stopped")); - } - } +/***/ 15652: +/***/ (function(module) { - /** - * @returns {void} - */ - increaseParallelism() { - const root = this._root; - root._parallelism++; - /* istanbul ignore next */ - if (root._willEnsureProcessing === false && root._needProcessing) { - root._willEnsureProcessing = true; - setImmediate(root._ensureProcessing); - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @returns {void} - */ - decreaseParallelism() { - const root = this._root; - root._parallelism--; - } - /** - * @param {T} item an item - * @returns {boolean} true, if the item is currently being processed - */ - isProcessing(item) { - const key = this._getKey(item); - const entry = this._entries.get(key); - return entry !== undefined && entry.state === PROCESSING_STATE; - } - /** - * @param {T} item an item - * @returns {boolean} true, if the item is currently queued - */ - isQueued(item) { - const key = this._getKey(item); - const entry = this._entries.get(key); - return entry !== undefined && entry.state === QUEUED_STATE; - } +/** + * @typedef {Object} GroupOptions + * @property {boolean=} groupChildren + * @property {boolean=} force + * @property {number=} targetGroupCount + */ - /** - * @param {T} item an item - * @returns {boolean} true, if the item is currently queued - */ - isDone(item) { - const key = this._getKey(item); - const entry = this._entries.get(key); - return entry !== undefined && entry.state === DONE_STATE; - } +/** + * @template T + * @template R + * @typedef {Object} GroupConfig + * @property {function(T): string[]} getKeys + * @property {function(string, (R | T)[], T[]): R} createGroup + * @property {function(string, T[]): GroupOptions=} getOptions + */ - /** - * @returns {void} - */ - _ensureProcessing() { - while (this._activeTasks < this._parallelism) { - const entry = this._queued.dequeue(); - if (entry === undefined) break; - this._activeTasks++; - entry.state = PROCESSING_STATE; - this._startProcessing(entry); - } - this._willEnsureProcessing = false; - if (this._queued.length > 0) return; - if (this._children !== undefined) { - for (const child of this._children) { - while (this._activeTasks < this._parallelism) { - const entry = child._queued.dequeue(); - if (entry === undefined) break; - this._activeTasks++; - entry.state = PROCESSING_STATE; - child._startProcessing(entry); +/** + * @template T + * @template R + * @typedef {Object} ItemWithGroups + * @property {T} item + * @property {Set>} groups + */ + +/** + * @template T + * @template R + * @typedef {{ config: GroupConfig, name: string, alreadyGrouped: boolean, items: Set> | undefined }} Group + */ + +/** + * @template T + * @template R + * @param {T[]} items the list of items + * @param {GroupConfig[]} groupConfigs configuration + * @returns {(R | T)[]} grouped items + */ +const smartGrouping = (items, groupConfigs) => { + /** @type {Set>} */ + const itemsWithGroups = new Set(); + /** @type {Map>} */ + const allGroups = new Map(); + for (const item of items) { + /** @type {Set>} */ + const groups = new Set(); + for (let i = 0; i < groupConfigs.length; i++) { + const groupConfig = groupConfigs[i]; + const keys = groupConfig.getKeys(item); + if (keys) { + for (const name of keys) { + const key = `${i}:${name}`; + let group = allGroups.get(key); + if (group === undefined) { + allGroups.set( + key, + (group = { + config: groupConfig, + name, + alreadyGrouped: false, + items: undefined + }) + ); + } + groups.add(group); } - if (child._queued.length > 0) return; } } - if (!this._willEnsureProcessing) this._needProcessing = false; + itemsWithGroups.add({ + item, + groups + }); } - /** - * @param {AsyncQueueEntry} entry the entry - * @returns {void} + * @param {Set>} itemsWithGroups input items with groups + * @returns {(T | R)[]} groups items */ - _startProcessing(entry) { - this.hooks.beforeStart.callAsync(entry.item, err => { - if (err) { - this._handleResult( - entry, - makeWebpackError(err, `AsyncQueue(${this._name}).hooks.beforeStart`) - ); - return; + const runGrouping = itemsWithGroups => { + const totalSize = itemsWithGroups.size; + for (const entry of itemsWithGroups) { + for (const group of entry.groups) { + if (group.alreadyGrouped) continue; + const items = group.items; + if (items === undefined) { + group.items = new Set([entry]); + } else { + items.add(entry); + } } - let inCallback = false; - try { - this._processor(entry.item, (e, r) => { - inCallback = true; - this._handleResult(entry, e, r); + } + /** @type {Map, { items: Set>, options: GroupOptions | false | undefined, used: boolean }>} */ + const groupMap = new Map(); + for (const group of allGroups.values()) { + if (group.items) { + const items = group.items; + group.items = undefined; + groupMap.set(group, { + items, + options: undefined, + used: false }); - } catch (err) { - if (inCallback) throw err; - this._handleResult(entry, err, null); } - this.hooks.started.call(entry.item); - }); - } - - /** - * @param {AsyncQueueEntry} entry the entry - * @param {WebpackError=} err error, if any - * @param {R=} result result, if any - * @returns {void} - */ - _handleResult(entry, err, result) { - this.hooks.result.callAsync(entry.item, err, result, hookError => { - const error = hookError - ? makeWebpackError(hookError, `AsyncQueue(${this._name}).hooks.result`) - : err; - - const callback = entry.callback; - const callbacks = entry.callbacks; - entry.state = DONE_STATE; - entry.callback = undefined; - entry.callbacks = undefined; - entry.result = result; - entry.error = error; + } + /** @type {(T | R)[]} */ + const results = []; + for (;;) { + /** @type {Group} */ + let bestGroup = undefined; + let bestGroupSize = -1; + let bestGroupItems = undefined; + let bestGroupOptions = undefined; + for (const [group, state] of groupMap) { + const { items, used } = state; + let options = state.options; + if (options === undefined) { + const groupConfig = group.config; + state.options = options = + (groupConfig.getOptions && + groupConfig.getOptions( + group.name, + Array.from(items, ({ item }) => item) + )) || + false; + } - const root = this._root; - root._activeTasks--; - if (root._willEnsureProcessing === false && root._needProcessing) { - root._willEnsureProcessing = true; - setImmediate(root._ensureProcessing); + const force = options && options.force; + if (!force) { + if (bestGroupOptions && bestGroupOptions.force) continue; + if (used) continue; + if (items.size <= 1 || totalSize - items.size <= 1) { + continue; + } + } + const targetGroupCount = (options && options.targetGroupCount) || 4; + let sizeValue = force + ? items.size + : Math.min( + items.size, + (totalSize * 2) / targetGroupCount + + itemsWithGroups.size - + items.size + ); + if ( + sizeValue > bestGroupSize || + (force && (!bestGroupOptions || !bestGroupOptions.force)) + ) { + bestGroup = group; + bestGroupSize = sizeValue; + bestGroupItems = items; + bestGroupOptions = options; + } + } + if (bestGroup === undefined) { + break; } + const items = new Set(bestGroupItems); + const options = bestGroupOptions; - if (inHandleResult++ > 3) { - process.nextTick(() => { - callback(error, result); - if (callbacks !== undefined) { - for (const callback of callbacks) { - callback(error, result); + const groupChildren = !options || options.groupChildren !== false; + + for (const item of items) { + itemsWithGroups.delete(item); + // Remove all groups that items have from the map to not select them again + for (const group of item.groups) { + const state = groupMap.get(group); + if (state !== undefined) { + state.items.delete(item); + if (state.items.size === 0) { + groupMap.delete(group); + } else { + state.options = undefined; + if (groupChildren) { + state.used = true; + } } } - }); - } else { - callback(error, result); - if (callbacks !== undefined) { - for (const callback of callbacks) { - callback(error, result); - } } } - inHandleResult--; - }); - } - - clear() { - this._entries.clear(); - this._queued.clear(); - this._activeTasks = 0; - this._willEnsureProcessing = false; - this._needProcessing = false; - this._stopped = false; - } -} - -module.exports = AsyncQueue; - - -/***/ }), - -/***/ 36692: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + groupMap.delete(bestGroup); + const key = bestGroup.name; + const groupConfig = bestGroup.config; + const allItems = Array.from(items, ({ item }) => item); -class Hash { - /* istanbul ignore next */ - /** - * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} - * @abstract - * @param {string|Buffer} data data - * @param {string=} inputEncoding data encoding - * @returns {this} updated hash - */ - update(data, inputEncoding) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); - } + bestGroup.alreadyGrouped = true; + const children = groupChildren ? runGrouping(items) : allItems; + bestGroup.alreadyGrouped = false; - /* istanbul ignore next */ - /** - * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} - * @abstract - * @param {string=} encoding encoding of the return value - * @returns {string|Buffer} digest - */ - digest(encoding) { - const AbstractMethodError = __webpack_require__(77198); - throw new AbstractMethodError(); - } -} + results.push(groupConfig.createGroup(key, children, allItems)); + } + for (const { item } of itemsWithGroups) { + results.push(item); + } + return results; + }; + return runGrouping(itemsWithGroups); +}; -module.exports = Hash; +module.exports = smartGrouping; /***/ }), -/***/ 39104: +/***/ 41245: /***/ (function(__unused_webpack_module, exports) { "use strict"; @@ -129100,50 +129669,65 @@ module.exports = Hash; -/** - * @template T - * @param {Iterable} set a set - * @returns {T | undefined} last item - */ -const last = set => { - let last; - for (const item of set) last = item; - return last; -}; +/** @typedef {import("webpack-sources").Source} Source */ + +/** @type {WeakMap>} */ +const equalityCache = new WeakMap(); /** - * @template T - * @param {Iterable} iterable iterable - * @param {function(T): boolean} filter predicate - * @returns {boolean} true, if some items match the filter predicate + * @param {Source} a a source + * @param {Source} b another source + * @returns {boolean} true, when both sources are equal */ -const someInIterable = (iterable, filter) => { - for (const item of iterable) { - if (filter(item)) return true; - } - return false; +const _isSourceEqual = (a, b) => { + // prefer .buffer(), it's called anyway during emit + /** @type {Buffer|string} */ + let aSource = typeof a.buffer === "function" ? a.buffer() : a.source(); + /** @type {Buffer|string} */ + let bSource = typeof b.buffer === "function" ? b.buffer() : b.source(); + if (aSource === bSource) return true; + if (typeof aSource === "string" && typeof bSource === "string") return false; + if (!Buffer.isBuffer(aSource)) aSource = Buffer.from(aSource, "utf-8"); + if (!Buffer.isBuffer(bSource)) bSource = Buffer.from(bSource, "utf-8"); + return aSource.equals(bSource); }; /** - * @template T - * @param {Iterable} iterable an iterable - * @returns {number} count of items + * @param {Source} a a source + * @param {Source} b another source + * @returns {boolean} true, when both sources are equal */ -const countIterable = iterable => { - let i = 0; - // eslint-disable-next-line no-unused-vars - for (const _ of iterable) i++; - return i; -}; - -exports.last = last; -exports.someInIterable = someInIterable; -exports.countIterable = countIterable; +const isSourceEqual = (a, b) => { + if (a === b) return true; + const cache1 = equalityCache.get(a); + if (cache1 !== undefined) { + const result = cache1.get(b); + if (result !== undefined) return result; + } + const result = _isSourceEqual(a, b); + if (cache1 !== undefined) { + cache1.set(b, result); + } else { + const map = new WeakMap(); + map.set(b, result); + equalityCache.set(a, map); + } + const cache2 = equalityCache.get(b); + if (cache2 !== undefined) { + cache2.set(a, result); + } else { + const map = new WeakMap(); + map.set(a, result); + equalityCache.set(b, map); + } + return result; +}; +exports.isSourceEqual = isSourceEqual; /***/ }), -/***/ 48424: +/***/ 12047: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -129154,240 +129738,179 @@ exports.countIterable = countIterable; -const { first } = __webpack_require__(93347); -const SortableSet = __webpack_require__(13098); +const { validate } = __webpack_require__(38476); + +/* cSpell:disable */ +const DID_YOU_MEAN = { + rules: "module.rules", + loaders: "module.rules or module.rules.*.use", + query: "module.rules.*.options (BREAKING CHANGE since webpack 5)", + noParse: "module.noParse", + filename: "output.filename or module.rules.*.generator.filename", + file: "output.filename", + chunkFilename: "output.chunkFilename", + chunkfilename: "output.chunkFilename", + ecmaVersion: + "output.environment (output.ecmaVersion was a temporary configuration option during webpack 5 beta)", + ecmaversion: + "output.environment (output.ecmaVersion was a temporary configuration option during webpack 5 beta)", + ecma: "output.environment (output.ecmaVersion was a temporary configuration option during webpack 5 beta)", + path: "output.path", + pathinfo: "output.pathinfo", + pathInfo: "output.pathinfo", + jsonpFunction: "output.chunkLoadingGlobal (BREAKING CHANGE since webpack 5)", + chunkCallbackName: + "output.chunkLoadingGlobal (BREAKING CHANGE since webpack 5)", + jsonpScriptType: "output.scriptType (BREAKING CHANGE since webpack 5)", + hotUpdateFunction: "output.hotUpdateGlobal (BREAKING CHANGE since webpack 5)", + splitChunks: "optimization.splitChunks", + immutablePaths: "snapshot.immutablePaths", + managedPaths: "snapshot.managedPaths", + maxModules: "stats.modulesSpace (BREAKING CHANGE since webpack 5)", + hashedModuleIds: + 'optimization.moduleIds: "hashed" (BREAKING CHANGE since webpack 5)', + namedChunks: + 'optimization.chunkIds: "named" (BREAKING CHANGE since webpack 5)', + namedModules: + 'optimization.moduleIds: "named" (BREAKING CHANGE since webpack 5)', + occurrenceOrder: + 'optimization.chunkIds: "size" and optimization.moduleIds: "size" (BREAKING CHANGE since webpack 5)', + automaticNamePrefix: + "optimization.splitChunks.[cacheGroups.*].idHint (BREAKING CHANGE since webpack 5)", + noEmitOnErrors: + "optimization.emitOnErrors (BREAKING CHANGE since webpack 5: logic is inverted to avoid negative flags)", + Buffer: + "to use the ProvidePlugin to process the Buffer variable to modules as polyfill\n" + + "BREAKING CHANGE: webpack 5 no longer provided Node.js polyfills by default.\n" + + "Note: if you are using 'node.Buffer: false', you can just remove that as this is the default behavior now.\n" + + "To provide a polyfill to modules use:\n" + + 'new ProvidePlugin({ Buffer: ["buffer", "Buffer"] }) and npm install buffer.', + process: + "to use the ProvidePlugin to process the process variable to modules as polyfill\n" + + "BREAKING CHANGE: webpack 5 no longer provided Node.js polyfills by default.\n" + + "Note: if you are using 'node.process: false', you can just remove that as this is the default behavior now.\n" + + "To provide a polyfill to modules use:\n" + + 'new ProvidePlugin({ process: "process" }) and npm install buffer.' +}; + +const REMOVED = { + concord: + "BREAKING CHANGE: resolve.concord has been removed and is no longer available.", + devtoolLineToLine: + "BREAKING CHANGE: output.devtoolLineToLine has been removed and is no longer available." +}; +/* cSpell:enable */ /** - * Multi layer bucket sorted set: - * Supports adding non-existing items (DO NOT ADD ITEM TWICE), - * Supports removing exiting items (DO NOT REMOVE ITEM NOT IN SET), - * Supports popping the first items according to defined order, - * Supports iterating all items without order, - * Supports updating an item in an efficient way, - * Supports size property, which is the number of items, - * Items are lazy partially sorted when needed - * @template T - * @template K + * @param {Parameters[0]} schema a json schema + * @param {Parameters[1]} options the options that should be validated + * @param {Parameters[2]=} validationConfiguration configuration for generating errors + * @returns {void} */ -class LazyBucketSortedSet { - /** - * @param {function(T): K} getKey function to get key from item - * @param {function(K, K): number} comparator comparator to sort keys - * @param {...((function(T): any) | (function(any, any): number))} args more pairs of getKey and comparator plus optional final comparator for the last layer - */ - constructor(getKey, comparator, ...args) { - this._getKey = getKey; - this._innerArgs = args; - this._leaf = args.length <= 1; - this._keys = new SortableSet(undefined, comparator); - /** @type {Map | SortableSet>} */ - this._map = new Map(); - this._unsortedItems = new Set(); - this.size = 0; - } - - /** - * @param {T} item an item - * @returns {void} - */ - add(item) { - this.size++; - this._unsortedItems.add(item); - } +const validateSchema = (schema, options, validationConfiguration) => { + validate( + schema, + options, + validationConfiguration || { + name: "Webpack", + postFormatter: (formattedError, error) => { + const children = error.children; + if ( + children && + children.some( + child => + child.keyword === "absolutePath" && + child.dataPath === ".output.filename" + ) + ) { + return `${formattedError}\nPlease use output.path to specify absolute path and output.filename for the file name.`; + } - /** - * @param {K} key key of item - * @param {T} item the item - * @returns {void} - */ - _addInternal(key, item) { - let entry = this._map.get(key); - if (entry === undefined) { - entry = this._leaf - ? new SortableSet(undefined, this._innerArgs[0]) - : new /** @type {any} */ (LazyBucketSortedSet)(...this._innerArgs); - this._keys.add(key); - this._map.set(key, entry); - } - entry.add(item); - } + if ( + children && + children.some( + child => + child.keyword === "pattern" && child.dataPath === ".devtool" + ) + ) { + return ( + `${formattedError}\n` + + "BREAKING CHANGE since webpack 5: The devtool option is more strict.\n" + + "Please strictly follow the order of the keywords in the pattern." + ); + } - /** - * @param {T} item an item - * @returns {void} - */ - delete(item) { - this.size--; - if (this._unsortedItems.has(item)) { - this._unsortedItems.delete(item); - return; - } - const key = this._getKey(item); - const entry = this._map.get(key); - entry.delete(item); - if (entry.size === 0) { - this._deleteKey(key); - } - } + if (error.keyword === "additionalProperties") { + const params = + /** @type {import("ajv").AdditionalPropertiesParams} */ ( + error.params + ); + if ( + Object.prototype.hasOwnProperty.call( + DID_YOU_MEAN, + params.additionalProperty + ) + ) { + return `${formattedError}\nDid you mean ${ + DID_YOU_MEAN[params.additionalProperty] + }?`; + } - /** - * @param {K} key key to be removed - * @returns {void} - */ - _deleteKey(key) { - this._keys.delete(key); - this._map.delete(key); - } + if ( + Object.prototype.hasOwnProperty.call( + REMOVED, + params.additionalProperty + ) + ) { + return `${formattedError}\n${REMOVED[params.additionalProperty]}?`; + } - /** - * @returns {T | undefined} an item - */ - popFirst() { - if (this.size === 0) return undefined; - this.size--; - if (this._unsortedItems.size > 0) { - for (const item of this._unsortedItems) { - const key = this._getKey(item); - this._addInternal(key, item); - } - this._unsortedItems.clear(); - } - this._keys.sort(); - const key = first(this._keys); - const entry = this._map.get(key); - if (this._leaf) { - const leafEntry = /** @type {SortableSet} */ (entry); - leafEntry.sort(); - const item = first(leafEntry); - leafEntry.delete(item); - if (leafEntry.size === 0) { - this._deleteKey(key); - } - return item; - } else { - const nodeEntry = /** @type {LazyBucketSortedSet} */ (entry); - const item = nodeEntry.popFirst(); - if (nodeEntry.size === 0) { - this._deleteKey(key); - } - return item; - } - } + if (!error.dataPath) { + if (params.additionalProperty === "debug") { + return ( + `${formattedError}\n` + + "The 'debug' property was removed in webpack 2.0.0.\n" + + "Loaders should be updated to allow passing this option via loader options in module.rules.\n" + + "Until loaders are updated one can use the LoaderOptionsPlugin to switch loaders into debug mode:\n" + + "plugins: [\n" + + " new webpack.LoaderOptionsPlugin({\n" + + " debug: true\n" + + " })\n" + + "]" + ); + } - /** - * @param {T} item to be updated item - * @returns {function(true=): void} finish update - */ - startUpdate(item) { - if (this._unsortedItems.has(item)) { - return remove => { - if (remove) { - this._unsortedItems.delete(item); - this.size--; - return; - } - }; - } - const key = this._getKey(item); - if (this._leaf) { - const oldEntry = /** @type {SortableSet} */ (this._map.get(key)); - return remove => { - if (remove) { - this.size--; - oldEntry.delete(item); - if (oldEntry.size === 0) { - this._deleteKey(key); - } - return; - } - const newKey = this._getKey(item); - if (key === newKey) { - // This flags the sortable set as unordered - oldEntry.add(item); - } else { - oldEntry.delete(item); - if (oldEntry.size === 0) { - this._deleteKey(key); - } - this._addInternal(newKey, item); - } - }; - } else { - const oldEntry = /** @type {LazyBucketSortedSet} */ ( - this._map.get(key) - ); - const finishUpdate = oldEntry.startUpdate(item); - return remove => { - if (remove) { - this.size--; - finishUpdate(true); - if (oldEntry.size === 0) { - this._deleteKey(key); - } - return; - } - const newKey = this._getKey(item); - if (key === newKey) { - finishUpdate(); - } else { - finishUpdate(true); - if (oldEntry.size === 0) { - this._deleteKey(key); + if (params.additionalProperty) { + return ( + `${formattedError}\n` + + "For typos: please correct them.\n" + + "For loader options: webpack >= v2.0.0 no longer allows custom properties in configuration.\n" + + " Loaders should be updated to allow passing options via loader options in module.rules.\n" + + " Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:\n" + + " plugins: [\n" + + " new webpack.LoaderOptionsPlugin({\n" + + " // test: /\\.xxx$/, // may apply this only for some modules\n" + + " options: {\n" + + ` ${params.additionalProperty}: …\n` + + " }\n" + + " })\n" + + " ]" + ); + } } - this._addInternal(newKey, item); } - }; - } - } - /** - * @param {Iterator[]} iterators list of iterators to append to - * @returns {void} - */ - _appendIterators(iterators) { - if (this._unsortedItems.size > 0) - iterators.push(this._unsortedItems[Symbol.iterator]()); - for (const key of this._keys) { - const entry = this._map.get(key); - if (this._leaf) { - const leafEntry = /** @type {SortableSet} */ (entry); - const iterator = leafEntry[Symbol.iterator](); - iterators.push(iterator); - } else { - const nodeEntry = /** @type {LazyBucketSortedSet} */ (entry); - nodeEntry._appendIterators(iterators); + return formattedError; } } - } - - /** - * @returns {Iterator} the iterator - */ - [Symbol.iterator]() { - const iterators = []; - this._appendIterators(iterators); - iterators.reverse(); - let currentIterator = iterators.pop(); - return { - next: () => { - const res = currentIterator.next(); - if (res.done) { - if (iterators.length === 0) return res; - currentIterator = iterators.pop(); - return currentIterator.next(); - } - return res; - } - }; - } -} - -module.exports = LazyBucketSortedSet; + ); +}; +module.exports = validateSchema; /***/ }), -/***/ 38938: +/***/ 5434: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -129398,213 +129921,346 @@ module.exports = LazyBucketSortedSet; -const makeSerializable = __webpack_require__(33032); - -/** - * @template T - * @param {Set} targetSet set where items should be added - * @param {Set>} toMerge iterables to be merged - * @returns {void} - */ -const merge = (targetSet, toMerge) => { - for (const set of toMerge) { - for (const item of set) { - targetSet.add(item); - } - } -}; +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); -/** - * @template T - * @param {Set>} targetSet set where iterables should be added - * @param {Array>} toDeepMerge lazy sets to be flattened - * @returns {void} - */ -const flatten = (targetSet, toDeepMerge) => { - for (const set of toDeepMerge) { - if (set._set.size > 0) targetSet.add(set._set); - if (set._needMerge) { - for (const mergedSet of set._toMerge) { - targetSet.add(mergedSet); - } - flatten(targetSet, set._toDeepMerge); - } +class AsyncWasmLoadingRuntimeModule extends RuntimeModule { + constructor({ generateLoadBinaryCode, supportsStreaming }) { + super("wasm loading", RuntimeModule.STAGE_NORMAL); + this.generateLoadBinaryCode = generateLoadBinaryCode; + this.supportsStreaming = supportsStreaming; } -}; -/** - * Like Set but with an addAll method to eventually add items from another iterable. - * Access methods make sure that all delayed operations are executed. - * Iteration methods deopts to normal Set performance until clear is called again (because of the chance of modifications during iteration). - * @template T - */ -class LazySet { /** - * @param {Iterable=} iterable init iterable + * @returns {string} runtime code */ - constructor(iterable) { - /** @type {Set} */ - this._set = new Set(iterable); - /** @type {Set>} */ - this._toMerge = new Set(); - /** @type {Array>} */ - this._toDeepMerge = []; - this._needMerge = false; - this._deopt = false; + generate() { + const { compilation, chunk } = this; + const { outputOptions, runtimeTemplate } = compilation; + const fn = RuntimeGlobals.instantiateWasm; + const wasmModuleSrcPath = compilation.getPath( + JSON.stringify(outputOptions.webassemblyModuleFilename), + { + hash: `" + ${RuntimeGlobals.getFullHash}() + "`, + hashWithLength: length => + `" + ${RuntimeGlobals.getFullHash}}().slice(0, ${length}) + "`, + module: { + id: '" + wasmModuleId + "', + hash: `" + wasmModuleHash + "`, + hashWithLength(length) { + return `" + wasmModuleHash.slice(0, ${length}) + "`; + } + }, + runtime: chunk.runtime + } + ); + return `${fn} = ${runtimeTemplate.basicFunction( + "exports, wasmModuleId, wasmModuleHash, importsObj", + [ + `var req = ${this.generateLoadBinaryCode(wasmModuleSrcPath)};`, + this.supportsStreaming + ? Template.asString([ + "if (typeof WebAssembly.instantiateStreaming === 'function') {", + Template.indent([ + "return WebAssembly.instantiateStreaming(req, importsObj)", + Template.indent([ + `.then(${runtimeTemplate.returningFunction( + "Object.assign(exports, res.instance.exports)", + "res" + )});` + ]) + ]), + "}" + ]) + : "// no support for streaming compilation", + "return req", + Template.indent([ + `.then(${runtimeTemplate.returningFunction("x.arrayBuffer()", "x")})`, + `.then(${runtimeTemplate.returningFunction( + "WebAssembly.instantiate(bytes, importsObj)", + "bytes" + )})`, + `.then(${runtimeTemplate.returningFunction( + "Object.assign(exports, res.instance.exports)", + "res" + )});` + ]) + ] + )};`; } +} - _flatten() { - flatten(this._toMerge, this._toDeepMerge); - this._toDeepMerge.length = 0; - } +module.exports = AsyncWasmLoadingRuntimeModule; + + +/***/ }), + +/***/ 58461: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - _merge() { - this._flatten(); - merge(this._set, this._toMerge); - this._toMerge.clear(); - this._needMerge = false; - } - _isEmpty() { - return ( - this._set.size === 0 && - this._toMerge.size === 0 && - this._toDeepMerge.length === 0 - ); - } - get size() { - if (this._needMerge) this._merge(); - return this._set.size; +const Generator = __webpack_require__(93401); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../NormalModule")} NormalModule */ + +const TYPES = new Set(["webassembly"]); + +class AsyncWebAssemblyGenerator extends Generator { + constructor(options) { + super(); + this.options = options; } /** - * @param {T} item an item - * @returns {this} itself + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) */ - add(item) { - this._set.add(item); - return this; + getTypes(module) { + return TYPES; } /** - * @param {Iterable | LazySet} iterable a immutable iterable or another immutable LazySet which will eventually be merged into the Set - * @returns {this} itself + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module */ - addAll(iterable) { - if (this._deopt) { - const _set = this._set; - for (const item of iterable) { - _set.add(item); - } - } else { - if (iterable instanceof LazySet) { - if (iterable._isEmpty()) return this; - this._toDeepMerge.push(iterable); - this._needMerge = true; - if (this._toDeepMerge.length > 100000) { - this._flatten(); - } - } else { - this._toMerge.add(iterable); - this._needMerge = true; - } - if (this._toMerge.size > 100000) this._merge(); + getSize(module, type) { + const originalSource = module.originalSource(); + if (!originalSource) { + return 0; } - return this; - } - - clear() { - this._set.clear(); - this._toMerge.clear(); - this._toDeepMerge.length = 0; - this._needMerge = false; - this._deopt = false; + return originalSource.size(); } /** - * @param {T} value an item - * @returns {boolean} true, if the value was in the Set before + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code */ - delete(value) { - if (this._needMerge) this._merge(); - return this._set.delete(value); + generate(module, generateContext) { + return module.originalSource(); } +} - entries() { - this._deopt = true; - if (this._needMerge) this._merge(); - return this._set.entries(); +module.exports = AsyncWebAssemblyGenerator; + + +/***/ }), + +/***/ 95614: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { RawSource } = __webpack_require__(51255); +const Generator = __webpack_require__(93401); +const InitFragment = __webpack_require__(55870); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const WebAssemblyImportDependency = __webpack_require__(5239); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ + +const TYPES = new Set(["webassembly"]); + +class AsyncWebAssemblyJavascriptGenerator extends Generator { + constructor(filenameTemplate) { + super(); + this.filenameTemplate = filenameTemplate; } /** - * @param {function(T, T, Set): void} callbackFn function called for each entry - * @param {any} thisArg this argument for the callbackFn - * @returns {void} + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) */ - forEach(callbackFn, thisArg) { - this._deopt = true; - if (this._needMerge) this._merge(); - this._set.forEach(callbackFn, thisArg); + getTypes(module) { + return TYPES; } /** - * @param {T} item an item - * @returns {boolean} true, when the item is in the Set + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module */ - has(item) { - if (this._needMerge) this._merge(); - return this._set.has(item); + getSize(module, type) { + return 40 + module.dependencies.length * 10; } - keys() { - this._deopt = true; - if (this._needMerge) this._merge(); - return this._set.keys(); - } + /** + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code + */ + generate(module, generateContext) { + const { + runtimeTemplate, + chunkGraph, + moduleGraph, + runtimeRequirements, + runtime + } = generateContext; + runtimeRequirements.add(RuntimeGlobals.module); + runtimeRequirements.add(RuntimeGlobals.moduleId); + runtimeRequirements.add(RuntimeGlobals.exports); + runtimeRequirements.add(RuntimeGlobals.instantiateWasm); + /** @type {InitFragment[]} */ + const initFragments = []; + /** @type {Map} */ + const depModules = new Map(); + /** @type {Map} */ + const wasmDepsByRequest = new Map(); + for (const dep of module.dependencies) { + if (dep instanceof WebAssemblyImportDependency) { + const module = moduleGraph.getModule(dep); + if (!depModules.has(module)) { + depModules.set(module, { + request: dep.request, + importVar: `WEBPACK_IMPORTED_MODULE_${depModules.size}` + }); + } + let list = wasmDepsByRequest.get(dep.request); + if (list === undefined) { + list = []; + wasmDepsByRequest.set(dep.request, list); + } + list.push(dep); + } + } - values() { - this._deopt = true; - if (this._needMerge) this._merge(); - return this._set.values(); - } + const promises = []; - [Symbol.iterator]() { - this._deopt = true; - if (this._needMerge) this._merge(); - return this._set[Symbol.iterator](); - } + const importStatements = Array.from( + depModules, + ([importedModule, { request, importVar }]) => { + if (moduleGraph.isAsync(importedModule)) { + promises.push(importVar); + } + return runtimeTemplate.importStatement({ + update: false, + module: importedModule, + chunkGraph, + request, + originModule: module, + importVar, + runtimeRequirements + }); + } + ); + const importsCode = importStatements.map(([x]) => x).join(""); + const importsCompatCode = importStatements.map(([_, x]) => x).join(""); - /* istanbul ignore next */ - get [Symbol.toStringTag]() { - return "LazySet"; - } + const importObjRequestItems = Array.from( + wasmDepsByRequest, + ([request, deps]) => { + const exportItems = deps.map(dep => { + const importedModule = moduleGraph.getModule(dep); + const importVar = depModules.get(importedModule).importVar; + return `${JSON.stringify( + dep.name + )}: ${runtimeTemplate.exportFromImport({ + moduleGraph, + module: importedModule, + request, + exportName: dep.name, + originModule: module, + asiSafe: true, + isCall: false, + callContext: false, + defaultInterop: true, + importVar, + initFragments, + runtime, + runtimeRequirements + })}`; + }); + return Template.asString([ + `${JSON.stringify(request)}: {`, + Template.indent(exportItems.join(",\n")), + "}" + ]); + } + ); - serialize({ write }) { - if (this._needMerge) this._merge(); - write(this._set.size); - for (const item of this._set) write(item); - } + const importsObj = + importObjRequestItems.length > 0 + ? Template.asString([ + "{", + Template.indent(importObjRequestItems.join(",\n")), + "}" + ]) + : undefined; - static deserialize({ read }) { - const count = read(); - const items = []; - for (let i = 0; i < count; i++) { - items.push(read()); - } - return new LazySet(items); + const instantiateCall = + `${RuntimeGlobals.instantiateWasm}(${module.exportsArgument}, ${ + module.moduleArgument + }.id, ${JSON.stringify( + chunkGraph.getRenderedModuleHash(module, runtime) + )}` + (importsObj ? `, ${importsObj})` : `)`); + + if (promises.length > 0) + runtimeRequirements.add(RuntimeGlobals.asyncModule); + + const source = new RawSource( + promises.length > 0 + ? Template.asString([ + `var __webpack_instantiate__ = ${runtimeTemplate.basicFunction( + `[${promises.join(", ")}]`, + `${importsCompatCode}return ${instantiateCall};` + )}`, + `${RuntimeGlobals.asyncModule}(${ + module.moduleArgument + }, async ${runtimeTemplate.basicFunction( + "__webpack_handle_async_dependencies__, __webpack_async_result__", + [ + "try {", + importsCode, + `var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${promises.join( + ", " + )}]);`, + `var [${promises.join( + ", " + )}] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__;`, + `${importsCompatCode}await ${instantiateCall};`, + "__webpack_async_result__();", + "} catch(e) { __webpack_async_result__(e); }" + ] + )}, 1);` + ]) + : `${importsCode}${importsCompatCode}module.exports = ${instantiateCall};` + ); + + return InitFragment.addToSource(source, initFragments, generateContext); } } -makeSerializable(LazySet, "webpack/lib/util/LazySet"); - -module.exports = LazySet; +module.exports = AsyncWebAssemblyJavascriptGenerator; /***/ }), -/***/ 82482: -/***/ (function(__unused_webpack_module, exports) { +/***/ 7538: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -129614,94 +130270,203 @@ module.exports = LazySet; +const { SyncWaterfallHook } = __webpack_require__(6967); +const Compilation = __webpack_require__(85720); +const Generator = __webpack_require__(93401); +const { tryRunOrWebpackError } = __webpack_require__(11351); +const WebAssemblyImportDependency = __webpack_require__(5239); +const { compareModulesByIdentifier } = __webpack_require__(29579); +const memoize = __webpack_require__(78676); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../CodeGenerationResults")} CodeGenerationResults */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../Template").RenderManifestEntry} RenderManifestEntry */ +/** @typedef {import("../Template").RenderManifestOptions} RenderManifestOptions */ + +const getAsyncWebAssemblyGenerator = memoize(() => + __webpack_require__(58461) +); +const getAsyncWebAssemblyJavascriptGenerator = memoize(() => + __webpack_require__(95614) +); +const getAsyncWebAssemblyParser = memoize(() => + __webpack_require__(96305) +); + /** - * @template K - * @template V - * @param {Map} map a map - * @param {K} key the key - * @param {function(): V} computer compute value - * @returns {V} value + * @typedef {Object} WebAssemblyRenderContext + * @property {Chunk} chunk the chunk + * @property {DependencyTemplates} dependencyTemplates the dependency templates + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + * @property {CodeGenerationResults} codeGenerationResults results of code generation */ -exports.provide = (map, key, computer) => { - const value = map.get(key); - if (value !== undefined) return value; - const newValue = computer(); - map.set(key, newValue); - return newValue; -}; +/** + * @typedef {Object} CompilationHooks + * @property {SyncWaterfallHook<[Source, Module, WebAssemblyRenderContext]>} renderModuleContent + */ -/***/ }), +/** @type {WeakMap} */ +const compilationHooksMap = new WeakMap(); -/***/ 50780: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +class AsyncWebAssemblyModulesPlugin { + /** + * @param {Compilation} compilation the compilation + * @returns {CompilationHooks} the attached hooks + */ + static getCompilationHooks(compilation) { + if (!(compilation instanceof Compilation)) { + throw new TypeError( + "The 'compilation' argument must be an instance of Compilation" + ); + } + let hooks = compilationHooksMap.get(compilation); + if (hooks === undefined) { + hooks = { + renderModuleContent: new SyncWaterfallHook([ + "source", + "module", + "renderContext" + ]) + }; + compilationHooksMap.set(compilation, hooks); + } + return hooks; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + constructor(options) { + this.options = options; + } + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "AsyncWebAssemblyModulesPlugin", + (compilation, { normalModuleFactory }) => { + const hooks = + AsyncWebAssemblyModulesPlugin.getCompilationHooks(compilation); + compilation.dependencyFactories.set( + WebAssemblyImportDependency, + normalModuleFactory + ); + normalModuleFactory.hooks.createParser + .for("webassembly/async") + .tap("AsyncWebAssemblyModulesPlugin", () => { + const AsyncWebAssemblyParser = getAsyncWebAssemblyParser(); -const binarySearchBounds = __webpack_require__(92229); + return new AsyncWebAssemblyParser(); + }); + normalModuleFactory.hooks.createGenerator + .for("webassembly/async") + .tap("AsyncWebAssemblyModulesPlugin", () => { + const AsyncWebAssemblyJavascriptGenerator = + getAsyncWebAssemblyJavascriptGenerator(); + const AsyncWebAssemblyGenerator = getAsyncWebAssemblyGenerator(); -class ParallelismFactorCalculator { - constructor() { - this._rangePoints = []; - this._rangeCallbacks = []; - } + return Generator.byType({ + javascript: new AsyncWebAssemblyJavascriptGenerator( + compilation.outputOptions.webassemblyModuleFilename + ), + webassembly: new AsyncWebAssemblyGenerator(this.options) + }); + }); - range(start, end, callback) { - if (start === end) return callback(1); - this._rangePoints.push(start); - this._rangePoints.push(end); - this._rangeCallbacks.push(callback); - } + compilation.hooks.renderManifest.tap( + "WebAssemblyModulesPlugin", + (result, options) => { + const { moduleGraph, chunkGraph, runtimeTemplate } = compilation; + const { + chunk, + outputOptions, + dependencyTemplates, + codeGenerationResults + } = options; - calculate() { - const segments = Array.from(new Set(this._rangePoints)).sort((a, b) => - a < b ? -1 : 1 - ); - const parallelism = segments.map(() => 0); - const rangeStartIndices = []; - for (let i = 0; i < this._rangePoints.length; i += 2) { - const start = this._rangePoints[i]; - const end = this._rangePoints[i + 1]; - let idx = binarySearchBounds.eq(segments, start); - rangeStartIndices.push(idx); - do { - parallelism[idx]++; - idx++; - } while (segments[idx] < end); - } - for (let i = 0; i < this._rangeCallbacks.length; i++) { - const start = this._rangePoints[i * 2]; - const end = this._rangePoints[i * 2 + 1]; - let idx = rangeStartIndices[i]; - let sum = 0; - let totalDuration = 0; - let current = start; - do { - const p = parallelism[idx]; - idx++; - const duration = segments[idx] - current; - totalDuration += duration; - current = segments[idx]; - sum += p * duration; - } while (current < end); - this._rangeCallbacks[i](sum / totalDuration); + for (const module of chunkGraph.getOrderedChunkModulesIterable( + chunk, + compareModulesByIdentifier + )) { + if (module.type === "webassembly/async") { + const filenameTemplate = + outputOptions.webassemblyModuleFilename; + + result.push({ + render: () => + this.renderModule( + module, + { + chunk, + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + codeGenerationResults + }, + hooks + ), + filenameTemplate, + pathOptions: { + module, + runtime: chunk.runtime, + chunkGraph + }, + auxiliary: true, + identifier: `webassemblyAsyncModule${chunkGraph.getModuleId( + module + )}`, + hash: chunkGraph.getModuleHash(module, chunk.runtime) + }); + } + } + + return result; + } + ); + } + ); + } + + renderModule(module, renderContext, hooks) { + const { codeGenerationResults, chunk } = renderContext; + try { + const moduleSource = codeGenerationResults.getSource( + module, + chunk.runtime, + "webassembly" + ); + return tryRunOrWebpackError( + () => + hooks.renderModuleContent.call(moduleSource, module, renderContext), + "AsyncWebAssemblyModulesPlugin.getCompilationHooks().renderModuleContent" + ); + } catch (e) { + e.module = module; + throw e; } } } -module.exports = ParallelismFactorCalculator; +module.exports = AsyncWebAssemblyModulesPlugin; /***/ }), -/***/ 65930: -/***/ (function(module) { +/***/ 96305: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -129711,326 +130476,484 @@ module.exports = ParallelismFactorCalculator; -/** - * @template T - */ -class Queue { - /** - * @param {Iterable=} items The initial elements. - */ - constructor(items) { - /** @private @type {Set} */ - this._set = new Set(items); - /** @private @type {Iterator} */ - this._iterator = this._set[Symbol.iterator](); - } +const t = __webpack_require__(51826); +const { decode } = __webpack_require__(73726); +const Parser = __webpack_require__(11715); +const StaticExportsDependency = __webpack_require__(91418); +const WebAssemblyImportDependency = __webpack_require__(5239); - /** - * Returns the number of elements in this queue. - * @returns {number} The number of elements in this queue. - */ - get length() { - return this._set.size; - } +/** @typedef {import("../Parser").ParserState} ParserState */ +/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ - /** - * Appends the specified element to this queue. - * @param {T} item The element to add. - * @returns {void} - */ - enqueue(item) { - this._set.add(item); +const decoderOpts = { + ignoreCodeSection: true, + ignoreDataSection: true, + + // this will avoid having to lookup with identifiers in the ModuleContext + ignoreCustomNameSection: true +}; + +class WebAssemblyParser extends Parser { + constructor(options) { + super(); + this.hooks = Object.freeze({}); + this.options = options; } /** - * Retrieves and removes the head of this queue. - * @returns {T | undefined} The head of the queue of `undefined` if this queue is empty. + * @param {string | Buffer | PreparsedAst} source the source to parse + * @param {ParserState} state the parser state + * @returns {ParserState} the parser state */ - dequeue() { - const result = this._iterator.next(); - if (result.done) return undefined; - this._set.delete(result.value); - return result.value; + parse(source, state) { + if (!Buffer.isBuffer(source)) { + throw new Error("WebAssemblyParser input must be a Buffer"); + } + + // flag it as async module + state.module.buildInfo.strict = true; + state.module.buildMeta.exportsType = "namespace"; + state.module.buildMeta.async = true; + + // parse it + const program = decode(source, decoderOpts); + const module = program.body[0]; + + const exports = []; + t.traverse(module, { + ModuleExport({ node }) { + exports.push(node.name); + }, + + ModuleImport({ node }) { + const dep = new WebAssemblyImportDependency( + node.module, + node.name, + node.descr, + false + ); + + state.module.addDependency(dep); + } + }); + + state.module.addDependency(new StaticExportsDependency(exports, false)); + + return state; } } -module.exports = Queue; +module.exports = WebAssemblyParser; /***/ }), -/***/ 93347: -/***/ (function(__unused_webpack_module, exports) { +/***/ 78455: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -/** - * intersect creates Set containing the intersection of elements between all sets - * @template T - * @param {Set[]} sets an array of sets being checked for shared elements - * @returns {Set} returns a new Set containing the intersecting items - */ -const intersect = sets => { - if (sets.length === 0) return new Set(); - if (sets.length === 1) return new Set(sets[0]); - let minSize = Infinity; - let minIndex = -1; - for (let i = 0; i < sets.length; i++) { - const size = sets[i].size; - if (size < minSize) { - minIndex = i; - minSize = size; - } - } - const current = new Set(sets[minIndex]); - for (let i = 0; i < sets.length; i++) { - if (i === minIndex) continue; - const set = sets[i]; - for (const item of current) { - if (!set.has(item)) { - current.delete(item); - } - } - } - return current; -}; - -/** - * Checks if a set is the subset of another set - * @template T - * @param {Set} bigSet a Set which contains the original elements to compare against - * @param {Set} smallSet the set whose elements might be contained inside of bigSet - * @returns {boolean} returns true if smallSet contains all elements inside of the bigSet - */ -const isSubset = (bigSet, smallSet) => { - if (bigSet.size < smallSet.size) return false; - for (const item of smallSet) { - if (!bigSet.has(item)) return false; - } - return true; -}; +const WebpackError = __webpack_require__(53799); -/** - * @template T - * @param {Set} set a set - * @param {function(T): boolean} fn selector function - * @returns {T | undefined} found item - */ -const find = (set, fn) => { - for (const item of set) { - if (fn(item)) return item; +module.exports = class UnsupportedWebAssemblyFeatureError extends WebpackError { + /** @param {string} message Error message */ + constructor(message) { + super(message); + this.name = "UnsupportedWebAssemblyFeatureError"; + this.hideStack = true; } }; -/** - * @template T - * @param {Set} set a set - * @returns {T | undefined} first item - */ -const first = set => { - const entry = set.values().next(); - return entry.done ? undefined : entry.value; -}; - -/** - * @template T - * @param {Set} a first - * @param {Set} b second - * @returns {Set} combined set, may be identical to a or b - */ -const combine = (a, b) => { - if (b.size === 0) return a; - if (a.size === 0) return b; - const set = new Set(a); - for (const item of b) set.add(item); - return set; -}; - -exports.intersect = intersect; -exports.isSubset = isSubset; -exports.find = find; -exports.first = first; -exports.combine = combine; - /***/ }), -/***/ 13098: -/***/ (function(module) { +/***/ 87394: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const NONE = Symbol("not sorted"); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); +const { compareModulesByIdentifier } = __webpack_require__(29579); +const WebAssemblyUtils = __webpack_require__(18650); + +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ + +// TODO webpack 6 remove the whole folder + +// Get all wasm modules +const getAllWasmModules = (moduleGraph, chunkGraph, chunk) => { + const wasmModules = chunk.getAllAsyncChunks(); + const array = []; + for (const chunk of wasmModules) { + for (const m of chunkGraph.getOrderedChunkModulesIterable( + chunk, + compareModulesByIdentifier + )) { + if (m.type.startsWith("webassembly")) { + array.push(m); + } + } + } + + return array; +}; /** - * A subset of Set that offers sorting functionality - * @template T item type in set - * @extends {Set} + * generates the import object function for a module + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {Module} module the module + * @param {boolean} mangle mangle imports + * @param {string[]} declarations array where declarations are pushed to + * @param {RuntimeSpec} runtime the runtime + * @returns {string} source code */ -class SortableSet extends Set { - /** - * Create a new sortable set - * @param {Iterable=} initialIterable The initial iterable value - * @typedef {function(T, T): number} SortFunction - * @param {SortFunction=} defaultSort Default sorting function - */ - constructor(initialIterable, defaultSort) { - super(initialIterable); - /** @private @type {undefined | function(T, T): number}} */ - this._sortFn = defaultSort; - /** @private @type {typeof NONE | undefined | function(T, T): number}} */ - this._lastActiveSortFn = NONE; - /** @private @type {Map | undefined} */ - this._cache = undefined; - /** @private @type {Map | undefined} */ - this._cacheOrderIndependent = undefined; - } +const generateImportObject = ( + chunkGraph, + module, + mangle, + declarations, + runtime +) => { + const moduleGraph = chunkGraph.moduleGraph; + const waitForInstances = new Map(); + const properties = []; + const usedWasmDependencies = WebAssemblyUtils.getUsedDependencies( + moduleGraph, + module, + mangle + ); + for (const usedDep of usedWasmDependencies) { + const dep = usedDep.dependency; + const importedModule = moduleGraph.getModule(dep); + const exportName = dep.name; + const usedName = + importedModule && + moduleGraph + .getExportsInfo(importedModule) + .getUsedName(exportName, runtime); + const description = dep.description; + const direct = dep.onlyDirectImport; - /** - * @param {T} value value to add to set - * @returns {this} returns itself - */ - add(value) { - this._lastActiveSortFn = NONE; - this._invalidateCache(); - this._invalidateOrderedCache(); - super.add(value); - return this; - } + const module = usedDep.module; + const name = usedDep.name; - /** - * @param {T} value value to delete - * @returns {boolean} true if value existed in set, false otherwise - */ - delete(value) { - this._invalidateCache(); - this._invalidateOrderedCache(); - return super.delete(value); - } + if (direct) { + const instanceVar = `m${waitForInstances.size}`; + waitForInstances.set(instanceVar, chunkGraph.getModuleId(importedModule)); + properties.push({ + module, + name, + value: `${instanceVar}[${JSON.stringify(usedName)}]` + }); + } else { + const params = description.signature.params.map( + (param, k) => "p" + k + param.valtype + ); - /** - * @returns {void} - */ - clear() { - this._invalidateCache(); - this._invalidateOrderedCache(); - return super.clear(); - } + const mod = `${RuntimeGlobals.moduleCache}[${JSON.stringify( + chunkGraph.getModuleId(importedModule) + )}]`; + const modExports = `${mod}.exports`; - /** - * Sort with a comparer function - * @param {SortFunction} sortFn Sorting comparer function - * @returns {void} - */ - sortWith(sortFn) { - if (this.size <= 1 || sortFn === this._lastActiveSortFn) { - // already sorted - nothing to do - return; - } + const cache = `wasmImportedFuncCache${declarations.length}`; + declarations.push(`var ${cache};`); - const sortedArray = Array.from(this).sort(sortFn); - super.clear(); - for (let i = 0; i < sortedArray.length; i += 1) { - super.add(sortedArray[i]); + properties.push({ + module, + name, + value: Template.asString([ + (importedModule.type.startsWith("webassembly") + ? `${mod} ? ${modExports}[${JSON.stringify(usedName)}] : ` + : "") + `function(${params}) {`, + Template.indent([ + `if(${cache} === undefined) ${cache} = ${modExports};`, + `return ${cache}[${JSON.stringify(usedName)}](${params});` + ]), + "}" + ]) + }); } - this._lastActiveSortFn = sortFn; - this._invalidateCache(); - } - - sort() { - this.sortWith(this._sortFn); - return this; } - /** - * Get data from cache - * @template R - * @param {function(SortableSet): R} fn function to calculate value - * @returns {R} returns result of fn(this), cached until set changes - */ - getFromCache(fn) { - if (this._cache === undefined) { - this._cache = new Map(); - } else { - const result = this._cache.get(fn); - const data = /** @type {R} */ (result); - if (data !== undefined) { - return data; + let importObject; + if (mangle) { + importObject = [ + "return {", + Template.indent([ + properties.map(p => `${JSON.stringify(p.name)}: ${p.value}`).join(",\n") + ]), + "};" + ]; + } else { + const propertiesByModule = new Map(); + for (const p of properties) { + let list = propertiesByModule.get(p.module); + if (list === undefined) { + propertiesByModule.set(p.module, (list = [])); } + list.push(p); } - const newData = fn(this); - this._cache.set(fn, newData); - return newData; + importObject = [ + "return {", + Template.indent([ + Array.from(propertiesByModule, ([module, list]) => { + return Template.asString([ + `${JSON.stringify(module)}: {`, + Template.indent([ + list.map(p => `${JSON.stringify(p.name)}: ${p.value}`).join(",\n") + ]), + "}" + ]); + }).join(",\n") + ]), + "};" + ]; } - /** - * Get data from cache (ignoring sorting) - * @template R - * @param {function(SortableSet): R} fn function to calculate value - * @returns {R} returns result of fn(this), cached until set changes - */ - getFromUnorderedCache(fn) { - if (this._cacheOrderIndependent === undefined) { - this._cacheOrderIndependent = new Map(); - } else { - const result = this._cacheOrderIndependent.get(fn); - const data = /** @type {R} */ (result); - if (data !== undefined) { - return data; - } - } - const newData = fn(this); - this._cacheOrderIndependent.set(fn, newData); - return newData; + const moduleIdStringified = JSON.stringify(chunkGraph.getModuleId(module)); + if (waitForInstances.size === 1) { + const moduleId = Array.from(waitForInstances.values())[0]; + const promise = `installedWasmModules[${JSON.stringify(moduleId)}]`; + const variable = Array.from(waitForInstances.keys())[0]; + return Template.asString([ + `${moduleIdStringified}: function() {`, + Template.indent([ + `return promiseResolve().then(function() { return ${promise}; }).then(function(${variable}) {`, + Template.indent(importObject), + "});" + ]), + "}," + ]); + } else if (waitForInstances.size > 0) { + const promises = Array.from( + waitForInstances.values(), + id => `installedWasmModules[${JSON.stringify(id)}]` + ).join(", "); + const variables = Array.from( + waitForInstances.keys(), + (name, i) => `${name} = array[${i}]` + ).join(", "); + return Template.asString([ + `${moduleIdStringified}: function() {`, + Template.indent([ + `return promiseResolve().then(function() { return Promise.all([${promises}]); }).then(function(array) {`, + Template.indent([`var ${variables};`, ...importObject]), + "});" + ]), + "}," + ]); + } else { + return Template.asString([ + `${moduleIdStringified}: function() {`, + Template.indent(importObject), + "}," + ]); } +}; - /** - * @private - * @returns {void} - */ - _invalidateCache() { - if (this._cache !== undefined) { - this._cache.clear(); - } +class WasmChunkLoadingRuntimeModule extends RuntimeModule { + constructor({ + generateLoadBinaryCode, + supportsStreaming, + mangleImports, + runtimeRequirements + }) { + super("wasm chunk loading", RuntimeModule.STAGE_ATTACH); + this.generateLoadBinaryCode = generateLoadBinaryCode; + this.supportsStreaming = supportsStreaming; + this.mangleImports = mangleImports; + this._runtimeRequirements = runtimeRequirements; } /** - * @private - * @returns {void} + * @returns {string} runtime code */ - _invalidateOrderedCache() { - if (this._cacheOrderIndependent !== undefined) { - this._cacheOrderIndependent.clear(); - } - } + generate() { + const { chunkGraph, compilation, chunk, mangleImports } = this; + const { moduleGraph, outputOptions } = compilation; + const fn = RuntimeGlobals.ensureChunkHandlers; + const withHmr = this._runtimeRequirements.has( + RuntimeGlobals.hmrDownloadUpdateHandlers + ); + const wasmModules = getAllWasmModules(moduleGraph, chunkGraph, chunk); + const declarations = []; + const importObjects = wasmModules.map(module => { + return generateImportObject( + chunkGraph, + module, + this.mangleImports, + declarations, + chunk.runtime + ); + }); + const chunkModuleIdMap = chunkGraph.getChunkModuleIdMap(chunk, m => + m.type.startsWith("webassembly") + ); + const createImportObject = content => + mangleImports + ? `{ ${JSON.stringify(WebAssemblyUtils.MANGLED_MODULE)}: ${content} }` + : content; + const wasmModuleSrcPath = compilation.getPath( + JSON.stringify(outputOptions.webassemblyModuleFilename), + { + hash: `" + ${RuntimeGlobals.getFullHash}() + "`, + hashWithLength: length => + `" + ${RuntimeGlobals.getFullHash}}().slice(0, ${length}) + "`, + module: { + id: '" + wasmModuleId + "', + hash: `" + ${JSON.stringify( + chunkGraph.getChunkModuleRenderedHashMap(chunk, m => + m.type.startsWith("webassembly") + ) + )}[chunkId][wasmModuleId] + "`, + hashWithLength(length) { + return `" + ${JSON.stringify( + chunkGraph.getChunkModuleRenderedHashMap( + chunk, + m => m.type.startsWith("webassembly"), + length + ) + )}[chunkId][wasmModuleId] + "`; + } + }, + runtime: chunk.runtime + } + ); - /** - * @returns {T[]} the raw array - */ - toJSON() { - return Array.from(this); + const stateExpression = withHmr + ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_wasm` + : undefined; + + return Template.asString([ + "// object to store loaded and loading wasm modules", + `var installedWasmModules = ${ + stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" + }{};`, + "", + // This function is used to delay reading the installed wasm module promises + // by a microtask. Sorting them doesn't help because there are edge cases where + // sorting is not possible (modules splitted into different chunks). + // So we not even trying and solve this by a microtask delay. + "function promiseResolve() { return Promise.resolve(); }", + "", + Template.asString(declarations), + "var wasmImportObjects = {", + Template.indent(importObjects), + "};", + "", + `var wasmModuleMap = ${JSON.stringify( + chunkModuleIdMap, + undefined, + "\t" + )};`, + "", + "// object with all WebAssembly.instance exports", + `${RuntimeGlobals.wasmInstances} = {};`, + "", + "// Fetch + compile chunk loading for webassembly", + `${fn}.wasm = function(chunkId, promises) {`, + Template.indent([ + "", + `var wasmModules = wasmModuleMap[chunkId] || [];`, + "", + "wasmModules.forEach(function(wasmModuleId, idx) {", + Template.indent([ + "var installedWasmModuleData = installedWasmModules[wasmModuleId];", + "", + '// a Promise means "currently loading" or "already loaded".', + "if(installedWasmModuleData)", + Template.indent(["promises.push(installedWasmModuleData);"]), + "else {", + Template.indent([ + `var importObject = wasmImportObjects[wasmModuleId]();`, + `var req = ${this.generateLoadBinaryCode(wasmModuleSrcPath)};`, + "var promise;", + this.supportsStreaming + ? Template.asString([ + "if(importObject && typeof importObject.then === 'function' && typeof WebAssembly.compileStreaming === 'function') {", + Template.indent([ + "promise = Promise.all([WebAssembly.compileStreaming(req), importObject]).then(function(items) {", + Template.indent([ + `return WebAssembly.instantiate(items[0], ${createImportObject( + "items[1]" + )});` + ]), + "});" + ]), + "} else if(typeof WebAssembly.instantiateStreaming === 'function') {", + Template.indent([ + `promise = WebAssembly.instantiateStreaming(req, ${createImportObject( + "importObject" + )});` + ]) + ]) + : Template.asString([ + "if(importObject && typeof importObject.then === 'function') {", + Template.indent([ + "var bytesPromise = req.then(function(x) { return x.arrayBuffer(); });", + "promise = Promise.all([", + Template.indent([ + "bytesPromise.then(function(bytes) { return WebAssembly.compile(bytes); }),", + "importObject" + ]), + "]).then(function(items) {", + Template.indent([ + `return WebAssembly.instantiate(items[0], ${createImportObject( + "items[1]" + )});` + ]), + "});" + ]) + ]), + "} else {", + Template.indent([ + "var bytesPromise = req.then(function(x) { return x.arrayBuffer(); });", + "promise = bytesPromise.then(function(bytes) {", + Template.indent([ + `return WebAssembly.instantiate(bytes, ${createImportObject( + "importObject" + )});` + ]), + "});" + ]), + "}", + "promises.push(installedWasmModules[wasmModuleId] = promise.then(function(res) {", + Template.indent([ + `return ${RuntimeGlobals.wasmInstances}[wasmModuleId] = (res.instance || res).exports;` + ]), + "}));" + ]), + "}" + ]), + "});" + ]), + "};" + ]); } } -module.exports = SortableSet; +module.exports = WasmChunkLoadingRuntimeModule; /***/ }), -/***/ 64985: -/***/ (function(module) { +/***/ 19810: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -130040,115 +130963,87 @@ module.exports = SortableSet; -/** - * @template K - * @template V - */ -class StackedCacheMap { - constructor() { - /** @type {Map} */ - this.map = new Map(); - /** @type {ReadonlyMap[]} */ - this.stack = []; - } - - /** - * @param {ReadonlyMap} map map to add - * @param {boolean} immutable if 'map' is immutable and StackedCacheMap can keep referencing it - */ - addAll(map, immutable) { - if (immutable) { - this.stack.push(map); - - // largest map should go first - for (let i = this.stack.length - 1; i > 0; i--) { - const beforeLast = this.stack[i - 1]; - if (beforeLast.size >= map.size) break; - this.stack[i] = beforeLast; - this.stack[i - 1] = map; - } - } else { - for (const [key, value] of map) { - this.map.set(key, value); - } - } - } +const formatLocation = __webpack_require__(16734); +const UnsupportedWebAssemblyFeatureError = __webpack_require__(78455); - /** - * @param {K} item the key of the element to add - * @param {V} value the value of the element to add - * @returns {void} - */ - set(item, value) { - this.map.set(item, value); - } +/** @typedef {import("../Compiler")} Compiler */ +class WasmFinalizeExportsPlugin { /** - * @param {K} item the item to delete + * Apply the plugin + * @param {Compiler} compiler the compiler instance * @returns {void} */ - delete(item) { - throw new Error("Items can't be deleted from a StackedCacheMap"); - } - - /** - * @param {K} item the item to test - * @returns {boolean} true if the item exists in this set - */ - has(item) { - throw new Error( - "Checking StackedCacheMap.has before reading is inefficient, use StackedCacheMap.get and check for undefined" - ); - } - - /** - * @param {K} item the key of the element to return - * @returns {V} the value of the element - */ - get(item) { - for (const map of this.stack) { - const value = map.get(item); - if (value !== undefined) return value; - } - return this.map.get(item); - } + apply(compiler) { + compiler.hooks.compilation.tap("WasmFinalizeExportsPlugin", compilation => { + compilation.hooks.finishModules.tap( + "WasmFinalizeExportsPlugin", + modules => { + for (const module of modules) { + // 1. if a WebAssembly module + if (module.type.startsWith("webassembly") === true) { + const jsIncompatibleExports = + module.buildMeta.jsIncompatibleExports; - clear() { - this.stack.length = 0; - this.map.clear(); - } + if (jsIncompatibleExports === undefined) { + continue; + } - get size() { - let size = this.map.size; - for (const map of this.stack) { - size += map.size; - } - return size; - } + for (const connection of compilation.moduleGraph.getIncomingConnections( + module + )) { + // 2. is active and referenced by a non-WebAssembly module + if ( + connection.isTargetActive(undefined) && + connection.originModule.type.startsWith("webassembly") === + false + ) { + const referencedExports = + compilation.getDependencyReferencedExports( + connection.dependency, + undefined + ); - [Symbol.iterator]() { - const iterators = this.stack.map(map => map[Symbol.iterator]()); - let current = this.map[Symbol.iterator](); - return { - next() { - let result = current.next(); - while (result.done && iterators.length > 0) { - current = iterators.pop(); - result = current.next(); + for (const info of referencedExports) { + const names = Array.isArray(info) ? info : info.name; + if (names.length === 0) continue; + const name = names[0]; + if (typeof name === "object") continue; + // 3. and uses a func with an incompatible JS signature + if ( + Object.prototype.hasOwnProperty.call( + jsIncompatibleExports, + name + ) + ) { + // 4. error + const error = new UnsupportedWebAssemblyFeatureError( + `Export "${name}" with ${jsIncompatibleExports[name]} can only be used for direct wasm to wasm dependencies\n` + + `It's used from ${connection.originModule.readableIdentifier( + compilation.requestShortener + )} at ${formatLocation(connection.dependency.loc)}.` + ); + error.module = module; + compilation.errors.push(error); + } + } + } + } + } + } } - return result; - } - }; + ); + }); } } -module.exports = StackedCacheMap; +module.exports = WasmFinalizeExportsPlugin; /***/ }), -/***/ 58845: -/***/ (function(module) { +/***/ 47012: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -130158,556 +131053,620 @@ module.exports = StackedCacheMap; -const TOMBSTONE = Symbol("tombstone"); -const UNDEFINED_MARKER = Symbol("undefined"); +const { RawSource } = __webpack_require__(51255); +const Generator = __webpack_require__(93401); +const WebAssemblyUtils = __webpack_require__(18650); + +const t = __webpack_require__(51826); +const { moduleContextFromModuleAST } = __webpack_require__(51826); +const { editWithAST, addWithAST } = __webpack_require__(87362); +const { decode } = __webpack_require__(73726); + +const WebAssemblyExportImportedDependency = __webpack_require__(52204); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +/** @typedef {import("./WebAssemblyUtils").UsedWasmDependency} UsedWasmDependency */ /** - * @template T - * @typedef {T | undefined} Cell + * @typedef {(ArrayBuffer) => ArrayBuffer} ArrayBufferTransform */ /** * @template T - * @typedef {T | typeof TOMBSTONE | typeof UNDEFINED_MARKER} InternalCell + * @param {Function[]} fns transforms + * @returns {Function} composed transform */ +const compose = (...fns) => { + return fns.reduce( + (prevFn, nextFn) => { + return value => nextFn(prevFn(value)); + }, + value => value + ); +}; /** - * @template K - * @template V - * @param {[K, InternalCell]} pair the internal cell - * @returns {[K, Cell]} its “safe” representation + * Removes the start instruction + * + * @param {Object} state unused state + * @returns {ArrayBufferTransform} transform */ -const extractPair = pair => { - const key = pair[0]; - const val = pair[1]; - if (val === UNDEFINED_MARKER || val === TOMBSTONE) { - return [key, undefined]; - } else { - return /** @type {[K, Cell]} */ (pair); - } +const removeStartFunc = state => bin => { + return editWithAST(state.ast, bin, { + Start(path) { + path.remove(); + } + }); }; /** - * @template K - * @template V + * Get imported globals + * + * @param {Object} ast Module's AST + * @returns {Array} - nodes */ -class StackedMap { - /** - * @param {Map>[]=} parentStack an optional parent - */ - constructor(parentStack) { - /** @type {Map>} */ - this.map = new Map(); - /** @type {Map>[]} */ - this.stack = parentStack === undefined ? [] : parentStack.slice(); - this.stack.push(this.map); - } - - /** - * @param {K} item the key of the element to add - * @param {V} value the value of the element to add - * @returns {void} - */ - set(item, value) { - this.map.set(item, value === undefined ? UNDEFINED_MARKER : value); - } - - /** - * @param {K} item the item to delete - * @returns {void} - */ - delete(item) { - if (this.stack.length > 1) { - this.map.set(item, TOMBSTONE); - } else { - this.map.delete(item); - } - } +const getImportedGlobals = ast => { + const importedGlobals = []; - /** - * @param {K} item the item to test - * @returns {boolean} true if the item exists in this set - */ - has(item) { - const topValue = this.map.get(item); - if (topValue !== undefined) { - return topValue !== TOMBSTONE; - } - if (this.stack.length > 1) { - for (let i = this.stack.length - 2; i >= 0; i--) { - const value = this.stack[i].get(item); - if (value !== undefined) { - this.map.set(item, value); - return value !== TOMBSTONE; - } + t.traverse(ast, { + ModuleImport({ node }) { + if (t.isGlobalType(node.descr)) { + importedGlobals.push(node); } - this.map.set(item, TOMBSTONE); } - return false; - } + }); - /** - * @param {K} item the key of the element to return - * @returns {Cell} the value of the element - */ - get(item) { - const topValue = this.map.get(item); - if (topValue !== undefined) { - return topValue === TOMBSTONE || topValue === UNDEFINED_MARKER - ? undefined - : topValue; - } - if (this.stack.length > 1) { - for (let i = this.stack.length - 2; i >= 0; i--) { - const value = this.stack[i].get(item); - if (value !== undefined) { - this.map.set(item, value); - return value === TOMBSTONE || value === UNDEFINED_MARKER - ? undefined - : value; - } - } - this.map.set(item, TOMBSTONE); - } - return undefined; - } + return importedGlobals; +}; - _compress() { - if (this.stack.length === 1) return; - this.map = new Map(); - for (const data of this.stack) { - for (const pair of data) { - if (pair[1] === TOMBSTONE) { - this.map.delete(pair[0]); - } else { - this.map.set(pair[0], pair[1]); - } +/** + * Get the count for imported func + * + * @param {Object} ast Module's AST + * @returns {Number} - count + */ +const getCountImportedFunc = ast => { + let count = 0; + + t.traverse(ast, { + ModuleImport({ node }) { + if (t.isFuncImportDescr(node.descr)) { + count++; } } - this.stack = [this.map]; - } + }); - asArray() { - this._compress(); - return Array.from(this.map.keys()); - } + return count; +}; - asSet() { - this._compress(); - return new Set(this.map.keys()); - } +/** + * Get next type index + * + * @param {Object} ast Module's AST + * @returns {t.Index} - index + */ +const getNextTypeIndex = ast => { + const typeSectionMetadata = t.getSectionMetadata(ast, "type"); - asPairArray() { - this._compress(); - return Array.from(this.map.entries(), extractPair); + if (typeSectionMetadata === undefined) { + return t.indexLiteral(0); } - asMap() { - return new Map(this.asPairArray()); - } + return t.indexLiteral(typeSectionMetadata.vectorOfSize.value); +}; - get size() { - this._compress(); - return this.map.size; - } +/** + * Get next func index + * + * The Func section metadata provide informations for implemented funcs + * in order to have the correct index we shift the index by number of external + * functions. + * + * @param {Object} ast Module's AST + * @param {Number} countImportedFunc number of imported funcs + * @returns {t.Index} - index + */ +const getNextFuncIndex = (ast, countImportedFunc) => { + const funcSectionMetadata = t.getSectionMetadata(ast, "func"); - createChild() { - return new StackedMap(this.stack); + if (funcSectionMetadata === undefined) { + return t.indexLiteral(0 + countImportedFunc); } -} -module.exports = StackedMap; + const vectorOfSize = funcSectionMetadata.vectorOfSize.value; + return t.indexLiteral(vectorOfSize + countImportedFunc); +}; -/***/ }), +/** + * Creates an init instruction for a global type + * @param {t.GlobalType} globalType the global type + * @returns {t.Instruction} init expression + */ +const createDefaultInitForGlobal = globalType => { + if (globalType.valtype[0] === "i") { + // create NumberLiteral global initializer + return t.objectInstruction("const", globalType.valtype, [ + t.numberLiteralFromRaw(66) + ]); + } else if (globalType.valtype[0] === "f") { + // create FloatLiteral global initializer + return t.objectInstruction("const", globalType.valtype, [ + t.floatLiteral(66, false, false, "66") + ]); + } else { + throw new Error("unknown type: " + globalType.valtype); + } +}; -/***/ 40293: -/***/ (function(module) { +/** + * Rewrite the import globals: + * - removes the ModuleImport instruction + * - injects at the same offset a mutable global of the same type + * + * Since the imported globals are before the other global declarations, our + * indices will be preserved. + * + * Note that globals will become mutable. + * + * @param {Object} state unused state + * @returns {ArrayBufferTransform} transform + */ +const rewriteImportedGlobals = state => bin => { + const additionalInitCode = state.additionalInitCode; + const newGlobals = []; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + bin = editWithAST(state.ast, bin, { + ModuleImport(path) { + if (t.isGlobalType(path.node.descr)) { + const globalType = path.node.descr; + globalType.mutability = "var"; + const init = [ + createDefaultInitForGlobal(globalType), + t.instruction("end") + ]; -class StringXor { - constructor() { - this._value = undefined; - } + newGlobals.push(t.global(globalType, init)); - /** - * @param {string} str string - * @returns {void} - */ - add(str) { - const len = str.length; - const value = this._value; - if (value === undefined) { - const newValue = (this._value = Buffer.allocUnsafe(len)); - for (let i = 0; i < len; i++) { - newValue[i] = str.charCodeAt(i); - } - return; - } - const valueLen = value.length; - if (valueLen < len) { - const newValue = (this._value = Buffer.allocUnsafe(len)); - let i; - for (i = 0; i < valueLen; i++) { - newValue[i] = value[i] ^ str.charCodeAt(i); - } - for (; i < len; i++) { - newValue[i] = str.charCodeAt(i); - } - } else { - for (let i = 0; i < len; i++) { - value[i] = value[i] ^ str.charCodeAt(i); + path.remove(); } - } - } + }, - toString() { - const value = this._value; - return value === undefined ? "" : value.toString("latin1"); - } + // in order to preserve non-imported global's order we need to re-inject + // those as well + Global(path) { + const { node } = path; + const [init] = node.init; - updateHash(hash) { - const value = this._value; - if (value !== undefined) hash.update(value); - } -} + if (init.id === "get_global") { + node.globalType.mutability = "var"; -module.exports = StringXor; + const initialGlobalIdx = init.args[0]; + node.init = [ + createDefaultInitForGlobal(node.globalType), + t.instruction("end") + ]; -/***/ }), + additionalInitCode.push( + /** + * get_global in global initializer only works for imported globals. + * They have the same indices as the init params, so use the + * same index. + */ + t.instruction("get_local", [initialGlobalIdx]), + t.instruction("set_global", [t.indexLiteral(newGlobals.length)]) + ); + } -/***/ 38415: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + newGlobals.push(node); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + path.remove(); + } + }); + // Add global declaration instructions + return addWithAST(state.ast, bin, newGlobals); +}; +/** + * Rewrite the export names + * @param {Object} state state + * @param {Object} state.ast Module's ast + * @param {Module} state.module Module + * @param {ModuleGraph} state.moduleGraph module graph + * @param {Set} state.externalExports Module + * @param {RuntimeSpec} state.runtime runtime + * @returns {ArrayBufferTransform} transform + */ +const rewriteExportNames = + ({ ast, moduleGraph, module, externalExports, runtime }) => + bin => { + return editWithAST(ast, bin, { + ModuleExport(path) { + const isExternal = externalExports.has(path.node.name); + if (isExternal) { + path.remove(); + return; + } + const usedName = moduleGraph + .getExportsInfo(module) + .getUsedName(path.node.name, runtime); + if (!usedName) { + path.remove(); + return; + } + path.node.name = usedName; + } + }); + }; -const TupleSet = __webpack_require__(76455); +/** + * Mangle import names and modules + * @param {Object} state state + * @param {Object} state.ast Module's ast + * @param {Map} state.usedDependencyMap mappings to mangle names + * @returns {ArrayBufferTransform} transform + */ +const rewriteImports = + ({ ast, usedDependencyMap }) => + bin => { + return editWithAST(ast, bin, { + ModuleImport(path) { + const result = usedDependencyMap.get( + path.node.module + ":" + path.node.name + ); + + if (result !== undefined) { + path.node.module = result.module; + path.node.name = result.name; + } + } + }); + }; /** - * @template {any[]} T + * Add an init function. + * + * The init function fills the globals given input arguments. + * + * @param {Object} state transformation state + * @param {Object} state.ast Module's ast + * @param {t.Identifier} state.initFuncId identifier of the init function + * @param {t.Index} state.startAtFuncOffset index of the start function + * @param {t.ModuleImport[]} state.importedGlobals list of imported globals + * @param {t.Instruction[]} state.additionalInitCode list of addition instructions for the init function + * @param {t.Index} state.nextFuncIndex index of the next function + * @param {t.Index} state.nextTypeIndex index of the next type + * @returns {ArrayBufferTransform} transform */ -class TupleQueue { - /** - * @param {Iterable=} items The initial elements. - */ - constructor(items) { - /** @private @type {TupleSet} */ - this._set = new TupleSet(items); - /** @private @type {Iterator} */ - this._iterator = this._set[Symbol.iterator](); - } +const addInitFunction = + ({ + ast, + initFuncId, + startAtFuncOffset, + importedGlobals, + additionalInitCode, + nextFuncIndex, + nextTypeIndex + }) => + bin => { + const funcParams = importedGlobals.map(importedGlobal => { + // used for debugging + const id = t.identifier( + `${importedGlobal.module}.${importedGlobal.name}` + ); - /** - * Returns the number of elements in this queue. - * @returns {number} The number of elements in this queue. - */ - get length() { - return this._set.size; - } + return t.funcParam(importedGlobal.descr.valtype, id); + }); - /** - * Appends the specified element to this queue. - * @param {T} item The element to add. - * @returns {void} - */ - enqueue(...item) { - this._set.add(...item); - } + const funcBody = []; + importedGlobals.forEach((importedGlobal, index) => { + const args = [t.indexLiteral(index)]; + const body = [ + t.instruction("get_local", args), + t.instruction("set_global", args) + ]; - /** - * Retrieves and removes the head of this queue. - * @returns {T | undefined} The head of the queue of `undefined` if this queue is empty. - */ - dequeue() { - const result = this._iterator.next(); - if (result.done) { - if (this._set.size > 0) { - this._iterator = this._set[Symbol.iterator](); - const value = this._iterator.next().value; - this._set.delete(...value); - return value; - } - return undefined; + funcBody.push(...body); + }); + + if (typeof startAtFuncOffset === "number") { + funcBody.push( + t.callInstruction(t.numberLiteralFromRaw(startAtFuncOffset)) + ); } - this._set.delete(...result.value); - return result.value; - } -} -module.exports = TupleQueue; + for (const instr of additionalInitCode) { + funcBody.push(instr); + } + funcBody.push(t.instruction("end")); -/***/ }), + const funcResults = []; -/***/ 76455: -/***/ (function(module) { + // Code section + const funcSignature = t.signature(funcParams, funcResults); + const func = t.func(initFuncId, funcSignature, funcBody); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // Type section + const functype = t.typeInstruction(undefined, funcSignature); + + // Func section + const funcindex = t.indexInFuncSection(nextTypeIndex); + // Export section + const moduleExport = t.moduleExport( + initFuncId.value, + t.moduleExportDescr("Func", nextFuncIndex) + ); + return addWithAST(ast, bin, [func, moduleExport, funcindex, functype]); + }; /** - * @template {any[]} T + * Extract mangle mappings from module + * @param {ModuleGraph} moduleGraph module graph + * @param {Module} module current module + * @param {boolean} mangle mangle imports + * @returns {Map} mappings to mangled names */ -class TupleSet { - constructor(init) { - this._map = new Map(); - this.size = 0; - if (init) { - for (const tuple of init) { - this.add(...tuple); - } - } +const getUsedDependencyMap = (moduleGraph, module, mangle) => { + /** @type {Map} */ + const map = new Map(); + for (const usedDep of WebAssemblyUtils.getUsedDependencies( + moduleGraph, + module, + mangle + )) { + const dep = usedDep.dependency; + const request = dep.request; + const exportName = dep.name; + map.set(request + ":" + exportName, usedDep); + } + return map; +}; + +const TYPES = new Set(["webassembly"]); + +class WebAssemblyGenerator extends Generator { + constructor(options) { + super(); + this.options = options; } /** - * @param {T} args tuple - * @returns {void} + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) */ - add(...args) { - let map = this._map; - for (let i = 0; i < args.length - 2; i++) { - const arg = args[i]; - const innerMap = map.get(arg); - if (innerMap === undefined) { - map.set(arg, (map = new Map())); - } else { - map = innerMap; - } - } + getTypes(module) { + return TYPES; + } - const beforeLast = args[args.length - 2]; - let set = map.get(beforeLast); - if (set === undefined) { - map.set(beforeLast, (set = new Set())); + /** + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module + */ + getSize(module, type) { + const originalSource = module.originalSource(); + if (!originalSource) { + return 0; } - - const last = args[args.length - 1]; - this.size -= set.size; - set.add(last); - this.size += set.size; + return originalSource.size(); } /** - * @param {T} args tuple - * @returns {boolean} true, if the tuple is in the Set + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code */ - has(...args) { - let map = this._map; - for (let i = 0; i < args.length - 2; i++) { - const arg = args[i]; - map = map.get(arg); - if (map === undefined) { - return false; - } - } + generate(module, { moduleGraph, runtime }) { + const bin = module.originalSource().source(); + + const initFuncId = t.identifier(""); + + // parse it + const ast = decode(bin, { + ignoreDataSection: true, + ignoreCodeSection: true, + ignoreCustomNameSection: true + }); + + const moduleContext = moduleContextFromModuleAST(ast.body[0]); + + const importedGlobals = getImportedGlobals(ast); + const countImportedFunc = getCountImportedFunc(ast); + const startAtFuncOffset = moduleContext.getStart(); + const nextFuncIndex = getNextFuncIndex(ast, countImportedFunc); + const nextTypeIndex = getNextTypeIndex(ast); + + const usedDependencyMap = getUsedDependencyMap( + moduleGraph, + module, + this.options.mangleImports + ); + const externalExports = new Set( + module.dependencies + .filter(d => d instanceof WebAssemblyExportImportedDependency) + .map(d => { + const wasmDep = /** @type {WebAssemblyExportImportedDependency} */ ( + d + ); + return wasmDep.exportName; + }) + ); - const beforeLast = args[args.length - 2]; - let set = map.get(beforeLast); - if (set === undefined) { - return false; - } + /** @type {t.Instruction[]} */ + const additionalInitCode = []; - const last = args[args.length - 1]; - return set.has(last); - } + const transform = compose( + rewriteExportNames({ + ast, + moduleGraph, + module, + externalExports, + runtime + }), - /** - * @param {T} args tuple - * @returns {void} - */ - delete(...args) { - let map = this._map; - for (let i = 0; i < args.length - 2; i++) { - const arg = args[i]; - map = map.get(arg); - if (map === undefined) { - return; - } - } + removeStartFunc({ ast }), - const beforeLast = args[args.length - 2]; - let set = map.get(beforeLast); - if (set === undefined) { - return; - } + rewriteImportedGlobals({ ast, additionalInitCode }), - const last = args[args.length - 1]; - this.size -= set.size; - set.delete(last); - this.size += set.size; - } + rewriteImports({ + ast, + usedDependencyMap + }), - /** - * @returns {Iterator} iterator - */ - [Symbol.iterator]() { - const iteratorStack = []; - const tuple = []; - let currentSetIterator = undefined; + addInitFunction({ + ast, + initFuncId, + importedGlobals, + additionalInitCode, + startAtFuncOffset, + nextFuncIndex, + nextTypeIndex + }) + ); - const next = it => { - const result = it.next(); - if (result.done) { - if (iteratorStack.length === 0) return false; - tuple.pop(); - return next(iteratorStack.pop()); - } - const [key, value] = result.value; - iteratorStack.push(it); - tuple.push(key); - if (value instanceof Set) { - currentSetIterator = value[Symbol.iterator](); - return true; - } else { - return next(value[Symbol.iterator]()); - } - }; + const newBin = transform(bin); - next(this._map[Symbol.iterator]()); + const newBuf = Buffer.from(newBin); - return { - next() { - while (currentSetIterator) { - const result = currentSetIterator.next(); - if (result.done) { - tuple.pop(); - if (!next(iteratorStack.pop())) { - currentSetIterator = undefined; - } - } else { - return { - done: false, - value: /** @type {T} */ (tuple.concat(result.value)) - }; - } - } - return { done: true, value: undefined }; - } - }; + return new RawSource(newBuf); } } -module.exports = TupleSet; +module.exports = WebAssemblyGenerator; /***/ }), -/***/ 54500: -/***/ (function(__unused_webpack_module, exports) { +/***/ 47342: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop */ -/** @typedef {import("./fs").InputFileSystem} InputFileSystem */ -/** @typedef {(error: Error|null, result?: Buffer) => void} ErrorFirstCallback */ +const WebpackError = __webpack_require__(53799); + +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ +/** @typedef {import("../RequestShortener")} RequestShortener */ -const backSlashCharCode = "\\".charCodeAt(0); -const slashCharCode = "/".charCodeAt(0); -const aLowerCaseCharCode = "a".charCodeAt(0); -const zLowerCaseCharCode = "z".charCodeAt(0); -const aUpperCaseCharCode = "A".charCodeAt(0); -const zUpperCaseCharCode = "Z".charCodeAt(0); -const _0CharCode = "0".charCodeAt(0); -const _9CharCode = "9".charCodeAt(0); -const plusCharCode = "+".charCodeAt(0); -const hyphenCharCode = "-".charCodeAt(0); -const colonCharCode = ":".charCodeAt(0); -const hashCharCode = "#".charCodeAt(0); -const queryCharCode = "?".charCodeAt(0); /** - * Get scheme if specifier is an absolute URL specifier - * e.g. Absolute specifiers like 'file:///user/webpack/index.js' - * https://tools.ietf.org/html/rfc3986#section-3.1 - * @param {string} specifier specifier - * @returns {string|undefined} scheme if absolute URL specifier provided + * @param {Module} module module to get chains from + * @param {ModuleGraph} moduleGraph the module graph + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {RequestShortener} requestShortener to make readable identifiers + * @returns {string[]} all chains to the module */ -function getScheme(specifier) { - const start = specifier.charCodeAt(0); +const getInitialModuleChains = ( + module, + moduleGraph, + chunkGraph, + requestShortener +) => { + const queue = [ + { head: module, message: module.readableIdentifier(requestShortener) } + ]; + /** @type {Set} */ + const results = new Set(); + /** @type {Set} */ + const incompleteResults = new Set(); + /** @type {Set} */ + const visitedModules = new Set(); - // First char maybe only a letter - if ( - (start < aLowerCaseCharCode || start > zLowerCaseCharCode) && - (start < aUpperCaseCharCode || start > zUpperCaseCharCode) - ) { - return undefined; + for (const chain of queue) { + const { head, message } = chain; + let final = true; + /** @type {Set} */ + const alreadyReferencedModules = new Set(); + for (const connection of moduleGraph.getIncomingConnections(head)) { + const newHead = connection.originModule; + if (newHead) { + if (!chunkGraph.getModuleChunks(newHead).some(c => c.canBeInitial())) + continue; + final = false; + if (alreadyReferencedModules.has(newHead)) continue; + alreadyReferencedModules.add(newHead); + const moduleName = newHead.readableIdentifier(requestShortener); + const detail = connection.explanation + ? ` (${connection.explanation})` + : ""; + const newMessage = `${moduleName}${detail} --> ${message}`; + if (visitedModules.has(newHead)) { + incompleteResults.add(`... --> ${newMessage}`); + continue; + } + visitedModules.add(newHead); + queue.push({ + head: newHead, + message: newMessage + }); + } else { + final = false; + const newMessage = connection.explanation + ? `(${connection.explanation}) --> ${message}` + : message; + results.add(newMessage); + } + } + if (final) { + results.add(message); + } } - - let i = 1; - let ch = specifier.charCodeAt(i); - - while ( - (ch >= aLowerCaseCharCode && ch <= zLowerCaseCharCode) || - (ch >= aUpperCaseCharCode && ch <= zUpperCaseCharCode) || - (ch >= _0CharCode && ch <= _9CharCode) || - ch === plusCharCode || - ch === hyphenCharCode - ) { - if (++i === specifier.length) return undefined; - ch = specifier.charCodeAt(i); + for (const result of incompleteResults) { + results.add(result); } + return Array.from(results); +}; - // Scheme must end with colon - if (ch !== colonCharCode) return undefined; +module.exports = class WebAssemblyInInitialChunkError extends WebpackError { + /** + * @param {Module} module WASM module + * @param {ModuleGraph} moduleGraph the module graph + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {RequestShortener} requestShortener request shortener + */ + constructor(module, moduleGraph, chunkGraph, requestShortener) { + const moduleChains = getInitialModuleChains( + module, + moduleGraph, + chunkGraph, + requestShortener + ); + const message = `WebAssembly module is included in initial chunk. +This is not allowed, because WebAssembly download and compilation must happen asynchronous. +Add an async split point (i. e. import()) somewhere between your entrypoint and the WebAssembly module: +${moduleChains.map(s => `* ${s}`).join("\n")}`; - // Check for Windows absolute path - // https://url.spec.whatwg.org/#url-miscellaneous - if (i === 1) { - const nextChar = i + 1 < specifier.length ? specifier.charCodeAt(i + 1) : 0; - if ( - nextChar === 0 || - nextChar === backSlashCharCode || - nextChar === slashCharCode || - nextChar === hashCharCode || - nextChar === queryCharCode - ) { - return undefined; - } + super(message); + this.name = "WebAssemblyInInitialChunkError"; + this.hideStack = true; + this.module = module; } - - return specifier.slice(0, i).toLowerCase(); -} - -/** - * @param {string} specifier specifier - * @returns {string|null} protocol if absolute URL specifier provided - */ -function getProtocol(specifier) { - const scheme = getScheme(specifier); - return scheme === undefined ? undefined : scheme + ":"; -} - -exports.getScheme = getScheme; -exports.getProtocol = getProtocol; +}; /***/ }), -/***/ 28745: -/***/ (function(module) { +/***/ 46545: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -130717,270 +131676,221 @@ exports.getProtocol = getProtocol; -const isWeakKey = thing => typeof thing === "object" && thing !== null; - -/** - * @template {any[]} T - * @template V - */ -class WeakTupleMap { - constructor() { - /** @private */ - this.f = 0; - /** @private @type {any} */ - this.v = undefined; - /** @private @type {Map> | undefined} */ - this.m = undefined; - /** @private @type {WeakMap> | undefined} */ - this.w = undefined; - } - - /** - * @param {[...T, V]} args tuple - * @returns {void} - */ - set(...args) { - /** @type {WeakTupleMap} */ - let node = this; - for (let i = 0; i < args.length - 1; i++) { - node = node._get(args[i]); - } - node._setValue(args[args.length - 1]); - } +const { RawSource } = __webpack_require__(51255); +const { UsageState } = __webpack_require__(63686); +const Generator = __webpack_require__(93401); +const InitFragment = __webpack_require__(55870); +const RuntimeGlobals = __webpack_require__(16475); +const Template = __webpack_require__(1626); +const ModuleDependency = __webpack_require__(80321); +const WebAssemblyExportImportedDependency = __webpack_require__(52204); +const WebAssemblyImportDependency = __webpack_require__(5239); - /** - * @param {T} args tuple - * @returns {boolean} true, if the tuple is in the Set - */ - has(...args) { - /** @type {WeakTupleMap} */ - let node = this; - for (let i = 0; i < args.length; i++) { - node = node._peek(args[i]); - if (node === undefined) return false; - } - return node._hasValue(); - } +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../Generator").GenerateContext} GenerateContext */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ - /** - * @param {T} args tuple - * @returns {V} the value - */ - get(...args) { - /** @type {WeakTupleMap} */ - let node = this; - for (let i = 0; i < args.length; i++) { - node = node._peek(args[i]); - if (node === undefined) return undefined; - } - return node._getValue(); - } +const TYPES = new Set(["webassembly"]); +class WebAssemblyJavascriptGenerator extends Generator { /** - * @param {[...T, function(): V]} args tuple - * @returns {V} the value + * @param {NormalModule} module fresh module + * @returns {Set} available types (do not mutate) */ - provide(...args) { - /** @type {WeakTupleMap} */ - let node = this; - for (let i = 0; i < args.length - 1; i++) { - node = node._get(args[i]); - } - if (node._hasValue()) return node._getValue(); - const fn = args[args.length - 1]; - const newValue = fn(...args.slice(0, -1)); - node._setValue(newValue); - return newValue; + getTypes(module) { + return TYPES; } /** - * @param {T} args tuple - * @returns {void} + * @param {NormalModule} module the module + * @param {string=} type source type + * @returns {number} estimate size of the module */ - delete(...args) { - /** @type {WeakTupleMap} */ - let node = this; - for (let i = 0; i < args.length; i++) { - node = node._peek(args[i]); - if (node === undefined) return; - } - node._deleteValue(); + getSize(module, type) { + return 95 + module.dependencies.length * 5; } /** - * @returns {void} + * @param {NormalModule} module module for which the code should be generated + * @param {GenerateContext} generateContext context for generate + * @returns {Source} generated code */ - clear() { - this.f = 0; - this.v = undefined; - this.w = undefined; - this.m = undefined; - } - - _getValue() { - return this.v; - } - - _hasValue() { - return (this.f & 1) === 1; - } - - _setValue(v) { - this.f |= 1; - this.v = v; - } + generate(module, generateContext) { + const { + runtimeTemplate, + moduleGraph, + chunkGraph, + runtimeRequirements, + runtime + } = generateContext; + /** @type {InitFragment[]} */ + const initFragments = []; - _deleteValue() { - this.f &= 6; - this.v = undefined; - } + const exportsInfo = moduleGraph.getExportsInfo(module); - _peek(thing) { - if (isWeakKey(thing)) { - if ((this.f & 4) !== 4) return undefined; - return this.w.get(thing); - } else { - if ((this.f & 2) !== 2) return undefined; - return this.m.get(thing); - } - } + let needExportsCopy = false; + const importedModules = new Map(); + const initParams = []; + let index = 0; + for (const dep of module.dependencies) { + const moduleDep = + dep && dep instanceof ModuleDependency ? dep : undefined; + if (moduleGraph.getModule(dep)) { + let importData = importedModules.get(moduleGraph.getModule(dep)); + if (importData === undefined) { + importedModules.set( + moduleGraph.getModule(dep), + (importData = { + importVar: `m${index}`, + index, + request: (moduleDep && moduleDep.userRequest) || undefined, + names: new Set(), + reexports: [] + }) + ); + index++; + } + if (dep instanceof WebAssemblyImportDependency) { + importData.names.add(dep.name); + if (dep.description.type === "GlobalType") { + const exportName = dep.name; + const importedModule = moduleGraph.getModule(dep); - _get(thing) { - if (isWeakKey(thing)) { - if ((this.f & 4) !== 4) { - const newMap = new WeakMap(); - this.f |= 4; - const newNode = new WeakTupleMap(); - (this.w = newMap).set(thing, newNode); - return newNode; - } - const entry = this.w.get(thing); - if (entry !== undefined) { - return entry; - } - const newNode = new WeakTupleMap(); - this.w.set(thing, newNode); - return newNode; - } else { - if ((this.f & 2) !== 2) { - const newMap = new Map(); - this.f |= 2; - const newNode = new WeakTupleMap(); - (this.m = newMap).set(thing, newNode); - return newNode; - } - const entry = this.m.get(thing); - if (entry !== undefined) { - return entry; + if (importedModule) { + const usedName = moduleGraph + .getExportsInfo(importedModule) + .getUsedName(exportName, runtime); + if (usedName) { + initParams.push( + runtimeTemplate.exportFromImport({ + moduleGraph, + module: importedModule, + request: dep.request, + importVar: importData.importVar, + originModule: module, + exportName: dep.name, + asiSafe: true, + isCall: false, + callContext: null, + defaultInterop: true, + initFragments, + runtime, + runtimeRequirements + }) + ); + } + } + } + } + if (dep instanceof WebAssemblyExportImportedDependency) { + importData.names.add(dep.name); + const usedName = moduleGraph + .getExportsInfo(module) + .getUsedName(dep.exportName, runtime); + if (usedName) { + runtimeRequirements.add(RuntimeGlobals.exports); + const exportProp = `${module.exportsArgument}[${JSON.stringify( + usedName + )}]`; + const defineStatement = Template.asString([ + `${exportProp} = ${runtimeTemplate.exportFromImport({ + moduleGraph, + module: moduleGraph.getModule(dep), + request: dep.request, + importVar: importData.importVar, + originModule: module, + exportName: dep.name, + asiSafe: true, + isCall: false, + callContext: null, + defaultInterop: true, + initFragments, + runtime, + runtimeRequirements + })};`, + `if(WebAssembly.Global) ${exportProp} = ` + + `new WebAssembly.Global({ value: ${JSON.stringify( + dep.valueType + )} }, ${exportProp});` + ]); + importData.reexports.push(defineStatement); + needExportsCopy = true; + } + } } - const newNode = new WeakTupleMap(); - this.m.set(thing, newNode); - return newNode; } - } -} - -module.exports = WeakTupleMap; - - -/***/ }), - -/***/ 92229: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Mikola Lysenko @mikolalysenko -*/ - - - -/* cspell:disable-next-line */ -// Refactor: Peter Somogyvari @petermetz + const importsCode = Template.asString( + Array.from( + importedModules, + ([module, { importVar, request, reexports }]) => { + const importStatement = runtimeTemplate.importStatement({ + module, + chunkGraph, + request, + importVar, + originModule: module, + runtimeRequirements + }); + return importStatement[0] + importStatement[1] + reexports.join("\n"); + } + ) + ); -const compileSearch = (funcName, predicate, reversed, extraArgs, earlyOut) => { - const code = [ - "function ", - funcName, - "(a,l,h,", - extraArgs.join(","), - "){", - earlyOut ? "" : "var i=", - reversed ? "l-1" : "h+1", - ";while(l<=h){var m=(l+h)>>>1,x=a[m]" - ]; + const copyAllExports = + exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused && + !needExportsCopy; - if (earlyOut) { - if (predicate.indexOf("c") < 0) { - code.push(";if(x===y){return m}else if(x<=y){"); - } else { - code.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"); + // need these globals + runtimeRequirements.add(RuntimeGlobals.module); + runtimeRequirements.add(RuntimeGlobals.moduleId); + runtimeRequirements.add(RuntimeGlobals.wasmInstances); + if (exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused) { + runtimeRequirements.add(RuntimeGlobals.makeNamespaceObject); + runtimeRequirements.add(RuntimeGlobals.exports); + } + if (!copyAllExports) { + runtimeRequirements.add(RuntimeGlobals.exports); } - } else { - code.push(";if(", predicate, "){i=m;"); - } - if (reversed) { - code.push("l=m+1}else{h=m-1}"); - } else { - code.push("h=m-1}else{l=m+1}"); - } - code.push("}"); - if (earlyOut) { - code.push("return -1};"); - } else { - code.push("return i};"); - } - return code.join(""); -}; - -const compileBoundsSearch = (predicate, reversed, suffix, earlyOut) => { - const arg1 = compileSearch( - "A", - "x" + predicate + "y", - reversed, - ["y"], - earlyOut - ); - - const arg2 = compileSearch( - "P", - "c(x,y)" + predicate + "0", - reversed, - ["y", "c"], - earlyOut - ); - const fnHeader = "function dispatchBinarySearch"; + // create source + const source = new RawSource( + [ + '"use strict";', + "// Instantiate WebAssembly module", + `var wasmExports = ${RuntimeGlobals.wasmInstances}[${module.moduleArgument}.id];`, - const fnBody = - "(a,y,c,l,h){\ -if(typeof(c)==='function'){\ -return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)\ -}else{\ -return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)\ -}}\ -return dispatchBinarySearch"; + exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused + ? `${RuntimeGlobals.makeNamespaceObject}(${module.exportsArgument});` + : "", - const fnArgList = [arg1, arg2, fnHeader, suffix, fnBody, suffix]; - const fnSource = fnArgList.join(""); - const result = new Function(fnSource); - return result(); -}; + // this must be before import for circular dependencies + "// export exports from WebAssembly module", + copyAllExports + ? `${module.moduleArgument}.exports = wasmExports;` + : "for(var name in wasmExports) " + + `if(name) ` + + `${module.exportsArgument}[name] = wasmExports[name];`, + "// exec imports from WebAssembly module (for esm order)", + importsCode, + "", + "// exec wasm module", + `wasmExports[""](${initParams.join(", ")})` + ].join("\n") + ); + return InitFragment.addToSource(source, initFragments, generateContext); + } +} -module.exports = { - ge: compileBoundsSearch(">=", false, "GE"), - gt: compileBoundsSearch(">", false, "GT"), - lt: compileBoundsSearch("<", true, "LT"), - le: compileBoundsSearch("<=", true, "LE"), - eq: compileBoundsSearch("-", true, "EQ", true) -}; +module.exports = WebAssemblyJavascriptGenerator; /***/ }), -/***/ 60839: -/***/ (function(__unused_webpack_module, exports) { +/***/ 53639: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -130990,1040 +131900,546 @@ module.exports = { -/** @type {WeakMap>} */ -const mergeCache = new WeakMap(); -/** @type {WeakMap>>} */ -const setPropertyCache = new WeakMap(); -const DELETE = Symbol("DELETE"); -const DYNAMIC_INFO = Symbol("cleverMerge dynamic info"); - -/** - * Merges two given objects and caches the result to avoid computation if same objects passed as arguments again. - * @template T - * @template O - * @example - * // performs cleverMerge(first, second), stores the result in WeakMap and returns result - * cachedCleverMerge({a: 1}, {a: 2}) - * {a: 2} - * // when same arguments passed, gets the result from WeakMap and returns it. - * cachedCleverMerge({a: 1}, {a: 2}) - * {a: 2} - * @param {T} first first object - * @param {O} second second object - * @returns {T & O | T | O} merged object of first and second object - */ -const cachedCleverMerge = (first, second) => { - if (second === undefined) return first; - if (first === undefined) return second; - if (typeof second !== "object" || second === null) return second; - if (typeof first !== "object" || first === null) return first; +const Generator = __webpack_require__(93401); +const WebAssemblyExportImportedDependency = __webpack_require__(52204); +const WebAssemblyImportDependency = __webpack_require__(5239); +const { compareModulesByIdentifier } = __webpack_require__(29579); +const memoize = __webpack_require__(78676); +const WebAssemblyInInitialChunkError = __webpack_require__(47342); - let innerCache = mergeCache.get(first); - if (innerCache === undefined) { - innerCache = new WeakMap(); - mergeCache.set(first, innerCache); - } - const prevMerge = innerCache.get(second); - if (prevMerge !== undefined) return prevMerge; - const newMerge = _cleverMerge(first, second, true); - innerCache.set(second, newMerge); - return newMerge; -}; +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleTemplate")} ModuleTemplate */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ -/** - * @template T - * @param {Partial} obj object - * @param {string} property property - * @param {string|number|boolean} value assignment value - * @returns {T} new object - */ -const cachedSetProperty = (obj, property, value) => { - let mapByProperty = setPropertyCache.get(obj); +const getWebAssemblyGenerator = memoize(() => + __webpack_require__(47012) +); +const getWebAssemblyJavascriptGenerator = memoize(() => + __webpack_require__(46545) +); +const getWebAssemblyParser = memoize(() => __webpack_require__(57059)); - if (mapByProperty === undefined) { - mapByProperty = new Map(); - setPropertyCache.set(obj, mapByProperty); +class WebAssemblyModulesPlugin { + constructor(options) { + this.options = options; } - let mapByValue = mapByProperty.get(property); + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.compilation.tap( + "WebAssemblyModulesPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + WebAssemblyImportDependency, + normalModuleFactory + ); - if (mapByValue === undefined) { - mapByValue = new Map(); - mapByProperty.set(property, mapByValue); - } + compilation.dependencyFactories.set( + WebAssemblyExportImportedDependency, + normalModuleFactory + ); - let result = mapByValue.get(value); + normalModuleFactory.hooks.createParser + .for("webassembly/sync") + .tap("WebAssemblyModulesPlugin", () => { + const WebAssemblyParser = getWebAssemblyParser(); - if (result) return result; + return new WebAssemblyParser(); + }); - result = { - ...obj, - [property]: value - }; - mapByValue.set(value, result); + normalModuleFactory.hooks.createGenerator + .for("webassembly/sync") + .tap("WebAssemblyModulesPlugin", () => { + const WebAssemblyJavascriptGenerator = + getWebAssemblyJavascriptGenerator(); + const WebAssemblyGenerator = getWebAssemblyGenerator(); - return result; -}; + return Generator.byType({ + javascript: new WebAssemblyJavascriptGenerator(), + webassembly: new WebAssemblyGenerator(this.options) + }); + }); -/** - * @typedef {Object} ObjectParsedPropertyEntry - * @property {any | undefined} base base value - * @property {string | undefined} byProperty the name of the selector property - * @property {Map} byValues value depending on selector property, merged with base - */ + compilation.hooks.renderManifest.tap( + "WebAssemblyModulesPlugin", + (result, options) => { + const { chunkGraph } = compilation; + const { chunk, outputOptions, codeGenerationResults } = options; -/** - * @typedef {Object} ParsedObject - * @property {Map} static static properties (key is property name) - * @property {{ byProperty: string, fn: Function } | undefined} dynamic dynamic part - */ + for (const module of chunkGraph.getOrderedChunkModulesIterable( + chunk, + compareModulesByIdentifier + )) { + if (module.type === "webassembly/sync") { + const filenameTemplate = + outputOptions.webassemblyModuleFilename; -/** @type {WeakMap} */ -const parseCache = new WeakMap(); + result.push({ + render: () => + codeGenerationResults.getSource( + module, + chunk.runtime, + "webassembly" + ), + filenameTemplate, + pathOptions: { + module, + runtime: chunk.runtime, + chunkGraph + }, + auxiliary: true, + identifier: `webassemblyModule${chunkGraph.getModuleId( + module + )}`, + hash: chunkGraph.getModuleHash(module, chunk.runtime) + }); + } + } -/** - * @param {object} obj the object - * @returns {ParsedObject} parsed object - */ -const cachedParseObject = obj => { - const entry = parseCache.get(obj); - if (entry !== undefined) return entry; - const result = parseObject(obj); - parseCache.set(obj, result); - return result; -}; + return result; + } + ); -/** - * @param {object} obj the object - * @returns {ParsedObject} parsed object - */ -const parseObject = obj => { - const info = new Map(); - let dynamicInfo; - const getInfo = p => { - const entry = info.get(p); - if (entry !== undefined) return entry; - const newEntry = { - base: undefined, - byProperty: undefined, - byValues: undefined - }; - info.set(p, newEntry); - return newEntry; - }; - for (const key of Object.keys(obj)) { - if (key.startsWith("by")) { - const byProperty = key; - const byObj = obj[byProperty]; - if (typeof byObj === "object") { - for (const byValue of Object.keys(byObj)) { - const obj = byObj[byValue]; - for (const key of Object.keys(obj)) { - const entry = getInfo(key); - if (entry.byProperty === undefined) { - entry.byProperty = byProperty; - entry.byValues = new Map(); - } else if (entry.byProperty !== byProperty) { - throw new Error( - `${byProperty} and ${entry.byProperty} for a single property is not supported` - ); - } - entry.byValues.set(byValue, obj[key]); - if (byValue === "default") { - for (const otherByValue of Object.keys(byObj)) { - if (!entry.byValues.has(otherByValue)) - entry.byValues.set(otherByValue, undefined); + compilation.hooks.afterChunks.tap("WebAssemblyModulesPlugin", () => { + const chunkGraph = compilation.chunkGraph; + const initialWasmModules = new Set(); + for (const chunk of compilation.chunks) { + if (chunk.canBeInitial()) { + for (const module of chunkGraph.getChunkModulesIterable(chunk)) { + if (module.type === "webassembly/sync") { + initialWasmModules.add(module); + } } } } - } - } else if (typeof byObj === "function") { - if (dynamicInfo === undefined) { - dynamicInfo = { - byProperty: key, - fn: byObj - }; - } else { - throw new Error( - `${key} and ${dynamicInfo.byProperty} when both are functions is not supported` - ); - } - } else { - const entry = getInfo(key); - entry.base = obj[key]; - } - } else { - const entry = getInfo(key); - entry.base = obj[key]; - } - } - return { - static: info, - dynamic: dynamicInfo - }; -}; - -/** - * @param {Map} info static properties (key is property name) - * @param {{ byProperty: string, fn: Function } | undefined} dynamicInfo dynamic part - * @returns {object} the object - */ -const serializeObject = (info, dynamicInfo) => { - const obj = {}; - // Setup byProperty structure - for (const entry of info.values()) { - if (entry.byProperty !== undefined) { - const byObj = (obj[entry.byProperty] = obj[entry.byProperty] || {}); - for (const byValue of entry.byValues.keys()) { - byObj[byValue] = byObj[byValue] || {}; - } - } - } - for (const [key, entry] of info) { - if (entry.base !== undefined) { - obj[key] = entry.base; - } - // Fill byProperty structure - if (entry.byProperty !== undefined) { - const byObj = (obj[entry.byProperty] = obj[entry.byProperty] || {}); - for (const byValue of Object.keys(byObj)) { - const value = getFromByValues(entry.byValues, byValue); - if (value !== undefined) byObj[byValue][key] = value; + for (const module of initialWasmModules) { + compilation.errors.push( + new WebAssemblyInInitialChunkError( + module, + compilation.moduleGraph, + compilation.chunkGraph, + compilation.requestShortener + ) + ); + } + }); } - } - } - if (dynamicInfo !== undefined) { - obj[dynamicInfo.byProperty] = dynamicInfo.fn; + ); } - return obj; -}; +} -const VALUE_TYPE_UNDEFINED = 0; -const VALUE_TYPE_ATOM = 1; -const VALUE_TYPE_ARRAY_EXTEND = 2; -const VALUE_TYPE_OBJECT = 3; -const VALUE_TYPE_DELETE = 4; +module.exports = WebAssemblyModulesPlugin; -/** - * @param {any} value a single value - * @returns {VALUE_TYPE_UNDEFINED | VALUE_TYPE_ATOM | VALUE_TYPE_ARRAY_EXTEND | VALUE_TYPE_OBJECT | VALUE_TYPE_DELETE} value type - */ -const getValueType = value => { - if (value === undefined) { - return VALUE_TYPE_UNDEFINED; - } else if (value === DELETE) { - return VALUE_TYPE_DELETE; - } else if (Array.isArray(value)) { - if (value.lastIndexOf("...") !== -1) return VALUE_TYPE_ARRAY_EXTEND; - return VALUE_TYPE_ATOM; - } else if ( - typeof value === "object" && - value !== null && - (!value.constructor || value.constructor === Object) - ) { - return VALUE_TYPE_OBJECT; - } - return VALUE_TYPE_ATOM; -}; -/** - * Merges two objects. Objects are deeply clever merged. - * Arrays might reference the old value with "...". - * Non-object values take preference over object values. - * @template T - * @template O - * @param {T} first first object - * @param {O} second second object - * @returns {T & O | T | O} merged object of first and second object - */ -const cleverMerge = (first, second) => { - if (second === undefined) return first; - if (first === undefined) return second; - if (typeof second !== "object" || second === null) return second; - if (typeof first !== "object" || first === null) return first; +/***/ }), - return _cleverMerge(first, second, false); -}; +/***/ 57059: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const t = __webpack_require__(51826); +const { moduleContextFromModuleAST } = __webpack_require__(51826); +const { decode } = __webpack_require__(73726); +const Parser = __webpack_require__(11715); +const StaticExportsDependency = __webpack_require__(91418); +const WebAssemblyExportImportedDependency = __webpack_require__(52204); +const WebAssemblyImportDependency = __webpack_require__(5239); + +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../Parser").ParserState} ParserState */ +/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ + +const JS_COMPAT_TYPES = new Set(["i32", "f32", "f64"]); /** - * Merges two objects. Objects are deeply clever merged. - * @param {object} first first object - * @param {object} second second object - * @param {boolean} internalCaching should parsing of objects and nested merges be cached - * @returns {object} merged object of first and second object + * @param {t.Signature} signature the func signature + * @returns {null | string} the type incompatible with js types */ -const _cleverMerge = (first, second, internalCaching = false) => { - const firstObject = internalCaching - ? cachedParseObject(first) - : parseObject(first); - const { static: firstInfo, dynamic: firstDynamicInfo } = firstObject; - - // If the first argument has a dynamic part we modify the dynamic part to merge the second argument - if (firstDynamicInfo !== undefined) { - let { byProperty, fn } = firstDynamicInfo; - const fnInfo = fn[DYNAMIC_INFO]; - if (fnInfo) { - second = internalCaching - ? cachedCleverMerge(fnInfo[1], second) - : cleverMerge(fnInfo[1], second); - fn = fnInfo[0]; +const getJsIncompatibleType = signature => { + for (const param of signature.params) { + if (!JS_COMPAT_TYPES.has(param.valtype)) { + return `${param.valtype} as parameter`; } - const newFn = (...args) => { - const fnResult = fn(...args); - return internalCaching - ? cachedCleverMerge(fnResult, second) - : cleverMerge(fnResult, second); - }; - newFn[DYNAMIC_INFO] = [fn, second]; - return serializeObject(firstObject.static, { byProperty, fn: newFn }); - } - - // If the first part is static only, we merge the static parts and keep the dynamic part of the second argument - const secondObject = internalCaching - ? cachedParseObject(second) - : parseObject(second); - const { static: secondInfo, dynamic: secondDynamicInfo } = secondObject; - /** @type {Map} */ - const resultInfo = new Map(); - for (const [key, firstEntry] of firstInfo) { - const secondEntry = secondInfo.get(key); - const entry = - secondEntry !== undefined - ? mergeEntries(firstEntry, secondEntry, internalCaching) - : firstEntry; - resultInfo.set(key, entry); } - for (const [key, secondEntry] of secondInfo) { - if (!firstInfo.has(key)) { - resultInfo.set(key, secondEntry); - } + for (const type of signature.results) { + if (!JS_COMPAT_TYPES.has(type)) return `${type} as result`; } - return serializeObject(resultInfo, secondDynamicInfo); + return null; }; /** - * @param {ObjectParsedPropertyEntry} firstEntry a - * @param {ObjectParsedPropertyEntry} secondEntry b - * @param {boolean} internalCaching should parsing of objects and nested merges be cached - * @returns {ObjectParsedPropertyEntry} new entry + * TODO why are there two different Signature types? + * @param {t.FuncSignature} signature the func signature + * @returns {null | string} the type incompatible with js types */ -const mergeEntries = (firstEntry, secondEntry, internalCaching) => { - switch (getValueType(secondEntry.base)) { - case VALUE_TYPE_ATOM: - case VALUE_TYPE_DELETE: - // No need to consider firstEntry at all - // second value override everything - // = second.base + second.byProperty - return secondEntry; - case VALUE_TYPE_UNDEFINED: - if (!firstEntry.byProperty) { - // = first.base + second.byProperty - return { - base: firstEntry.base, - byProperty: secondEntry.byProperty, - byValues: secondEntry.byValues - }; - } else if (firstEntry.byProperty !== secondEntry.byProperty) { - throw new Error( - `${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported` - ); - } else { - // = first.base + (first.byProperty + second.byProperty) - // need to merge first and second byValues - const newByValues = new Map(firstEntry.byValues); - for (const [key, value] of secondEntry.byValues) { - const firstValue = getFromByValues(firstEntry.byValues, key); - newByValues.set( - key, - mergeSingleValue(firstValue, value, internalCaching) - ); - } - return { - base: firstEntry.base, - byProperty: firstEntry.byProperty, - byValues: newByValues - }; - } - default: { - if (!firstEntry.byProperty) { - // The simple case - // = (first.base + second.base) + second.byProperty - return { - base: mergeSingleValue( - firstEntry.base, - secondEntry.base, - internalCaching - ), - byProperty: secondEntry.byProperty, - byValues: secondEntry.byValues - }; - } - let newBase; - const intermediateByValues = new Map(firstEntry.byValues); - for (const [key, value] of intermediateByValues) { - intermediateByValues.set( - key, - mergeSingleValue(value, secondEntry.base, internalCaching) - ); - } - if ( - Array.from(firstEntry.byValues.values()).every(value => { - const type = getValueType(value); - return type === VALUE_TYPE_ATOM || type === VALUE_TYPE_DELETE; - }) - ) { - // = (first.base + second.base) + ((first.byProperty + second.base) + second.byProperty) - newBase = mergeSingleValue( - firstEntry.base, - secondEntry.base, - internalCaching - ); - } else { - // = first.base + ((first.byProperty (+default) + second.base) + second.byProperty) - newBase = firstEntry.base; - if (!intermediateByValues.has("default")) - intermediateByValues.set("default", secondEntry.base); - } - if (!secondEntry.byProperty) { - // = first.base + (first.byProperty + second.base) - return { - base: newBase, - byProperty: firstEntry.byProperty, - byValues: intermediateByValues - }; - } else if (firstEntry.byProperty !== secondEntry.byProperty) { - throw new Error( - `${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported` - ); - } - const newByValues = new Map(intermediateByValues); - for (const [key, value] of secondEntry.byValues) { - const firstValue = getFromByValues(intermediateByValues, key); - newByValues.set( - key, - mergeSingleValue(firstValue, value, internalCaching) - ); - } - return { - base: newBase, - byProperty: firstEntry.byProperty, - byValues: newByValues - }; +const getJsIncompatibleTypeOfFuncSignature = signature => { + for (const param of signature.args) { + if (!JS_COMPAT_TYPES.has(param)) { + return `${param} as parameter`; } } + for (const type of signature.result) { + if (!JS_COMPAT_TYPES.has(type)) return `${type} as result`; + } + return null; }; -/** - * @param {Map} byValues all values - * @param {string} key value of the selector - * @returns {any | undefined} value - */ -const getFromByValues = (byValues, key) => { - if (key !== "default" && byValues.has(key)) { - return byValues.get(key); - } - return byValues.get("default"); +const decoderOpts = { + ignoreCodeSection: true, + ignoreDataSection: true, + + // this will avoid having to lookup with identifiers in the ModuleContext + ignoreCustomNameSection: true }; -/** - * @param {any} a value - * @param {any} b value - * @param {boolean} internalCaching should parsing of objects and nested merges be cached - * @returns {any} value - */ -const mergeSingleValue = (a, b, internalCaching) => { - const bType = getValueType(b); - const aType = getValueType(a); - switch (bType) { - case VALUE_TYPE_DELETE: - case VALUE_TYPE_ATOM: - return b; - case VALUE_TYPE_OBJECT: { - return aType !== VALUE_TYPE_OBJECT - ? b - : internalCaching - ? cachedCleverMerge(a, b) - : cleverMerge(a, b); +class WebAssemblyParser extends Parser { + constructor(options) { + super(); + this.hooks = Object.freeze({}); + this.options = options; + } + + /** + * @param {string | Buffer | PreparsedAst} source the source to parse + * @param {ParserState} state the parser state + * @returns {ParserState} the parser state + */ + parse(source, state) { + if (!Buffer.isBuffer(source)) { + throw new Error("WebAssemblyParser input must be a Buffer"); } - case VALUE_TYPE_UNDEFINED: - return a; - case VALUE_TYPE_ARRAY_EXTEND: - switch ( - aType !== VALUE_TYPE_ATOM - ? aType - : Array.isArray(a) - ? VALUE_TYPE_ARRAY_EXTEND - : VALUE_TYPE_OBJECT - ) { - case VALUE_TYPE_UNDEFINED: - return b; - case VALUE_TYPE_DELETE: - return b.filter(item => item !== "..."); - case VALUE_TYPE_ARRAY_EXTEND: { - const newArray = []; - for (const item of b) { - if (item === "...") { - for (const item of a) { - newArray.push(item); - } - } else { - newArray.push(item); + + // flag it as ESM + state.module.buildInfo.strict = true; + state.module.buildMeta.exportsType = "namespace"; + + // parse it + const program = decode(source, decoderOpts); + const module = program.body[0]; + + const moduleContext = moduleContextFromModuleAST(module); + + // extract imports and exports + const exports = []; + let jsIncompatibleExports = (state.module.buildMeta.jsIncompatibleExports = + undefined); + + const importedGlobals = []; + t.traverse(module, { + ModuleExport({ node }) { + const descriptor = node.descr; + + if (descriptor.exportType === "Func") { + const funcIdx = descriptor.id.value; + + /** @type {t.FuncSignature} */ + const funcSignature = moduleContext.getFunction(funcIdx); + + const incompatibleType = + getJsIncompatibleTypeOfFuncSignature(funcSignature); + + if (incompatibleType) { + if (jsIncompatibleExports === undefined) { + jsIncompatibleExports = + state.module.buildMeta.jsIncompatibleExports = {}; } + jsIncompatibleExports[node.name] = incompatibleType; } - return newArray; } - case VALUE_TYPE_OBJECT: - return b.map(item => (item === "..." ? a : item)); - default: - throw new Error("Not implemented"); + + exports.push(node.name); + + if (node.descr && node.descr.exportType === "Global") { + const refNode = importedGlobals[node.descr.id.value]; + if (refNode) { + const dep = new WebAssemblyExportImportedDependency( + node.name, + refNode.module, + refNode.name, + refNode.descr.valtype + ); + + state.module.addDependency(dep); + } + } + }, + + Global({ node }) { + const init = node.init[0]; + + let importNode = null; + + if (init.id === "get_global") { + const globalIdx = init.args[0].value; + + if (globalIdx < importedGlobals.length) { + importNode = importedGlobals[globalIdx]; + } + } + + importedGlobals.push(importNode); + }, + + ModuleImport({ node }) { + /** @type {false | string} */ + let onlyDirectImport = false; + + if (t.isMemory(node.descr) === true) { + onlyDirectImport = "Memory"; + } else if (t.isTable(node.descr) === true) { + onlyDirectImport = "Table"; + } else if (t.isFuncImportDescr(node.descr) === true) { + const incompatibleType = getJsIncompatibleType(node.descr.signature); + if (incompatibleType) { + onlyDirectImport = `Non-JS-compatible Func Signature (${incompatibleType})`; + } + } else if (t.isGlobalType(node.descr) === true) { + const type = node.descr.valtype; + if (!JS_COMPAT_TYPES.has(type)) { + onlyDirectImport = `Non-JS-compatible Global Type (${type})`; + } + } + + const dep = new WebAssemblyImportDependency( + node.module, + node.name, + node.descr, + onlyDirectImport + ); + + state.module.addDependency(dep); + + if (t.isGlobalType(node.descr)) { + importedGlobals.push(node); + } } - default: - throw new Error("Not implemented"); - } -}; + }); -/** - * @template T - * @param {T} obj the object - * @returns {T} the object without operations like "..." or DELETE - */ -const removeOperations = obj => { - const newObj = /** @type {T} */ ({}); - for (const key of Object.keys(obj)) { - const value = obj[key]; - const type = getValueType(value); - switch (type) { - case VALUE_TYPE_UNDEFINED: - case VALUE_TYPE_DELETE: - break; - case VALUE_TYPE_OBJECT: - newObj[key] = removeOperations(value); - break; - case VALUE_TYPE_ARRAY_EXTEND: - newObj[key] = value.filter(i => i !== "..."); - break; - default: - newObj[key] = value; - break; - } - } - return newObj; -}; + state.module.addDependency(new StaticExportsDependency(exports, false)); -/** - * @template T - * @template {string} P - * @param {T} obj the object - * @param {P} byProperty the by description - * @param {...any} values values - * @returns {Omit} object with merged byProperty - */ -const resolveByProperty = (obj, byProperty, ...values) => { - if (typeof obj !== "object" || obj === null || !(byProperty in obj)) { - return obj; - } - const { [byProperty]: _byValue, ..._remaining } = /** @type {object} */ (obj); - const remaining = /** @type {T} */ (_remaining); - const byValue = /** @type {Record | function(...any[]): T} */ ( - _byValue - ); - if (typeof byValue === "object") { - const key = values[0]; - if (key in byValue) { - return cachedCleverMerge(remaining, byValue[key]); - } else if ("default" in byValue) { - return cachedCleverMerge(remaining, byValue.default); - } else { - return /** @type {T} */ (remaining); - } - } else if (typeof byValue === "function") { - const result = byValue.apply(null, values); - return cachedCleverMerge( - remaining, - resolveByProperty(result, byProperty, ...values) - ); + return state; } -}; +} -exports.cachedSetProperty = cachedSetProperty; -exports.cachedCleverMerge = cachedCleverMerge; -exports.cleverMerge = cleverMerge; -exports.resolveByProperty = resolveByProperty; -exports.removeOperations = removeOperations; -exports.DELETE = DELETE; +module.exports = WebAssemblyParser; /***/ }), -/***/ 29579: +/***/ 18650: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const { compareRuntime } = __webpack_require__(17156); - -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../ChunkGroup")} ChunkGroup */ -/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ - -/** @template T @typedef {function(T, T): -1|0|1} Comparator */ -/** @template TArg @template T @typedef {function(TArg, T, T): -1|0|1} RawParameterizedComparator */ -/** @template TArg @template T @typedef {function(TArg): Comparator} ParameterizedComparator */ - -/** - * @template T - * @param {RawParameterizedComparator} fn comparator with argument - * @returns {ParameterizedComparator} comparator - */ -const createCachedParameterizedComparator = fn => { - /** @type {WeakMap>} */ - const map = new WeakMap(); - return arg => { - const cachedResult = map.get(arg); - if (cachedResult !== undefined) return cachedResult; - /** - * @param {T} a first item - * @param {T} b second item - * @returns {-1|0|1} compare result - */ - const result = fn.bind(null, arg); - map.set(arg, result); - return result; - }; -}; + Author Tobias Koppers @sokra +*/ -/** - * @param {Chunk} a chunk - * @param {Chunk} b chunk - * @returns {-1|0|1} compare result - */ -exports.compareChunksById = (a, b) => { - return compareIds(a.id, b.id); -}; -/** - * @param {Module} a module - * @param {Module} b module - * @returns {-1|0|1} compare result - */ -exports.compareModulesByIdentifier = (a, b) => { - return compareIds(a.identifier(), b.identifier()); -}; -/** - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {Module} a module - * @param {Module} b module - * @returns {-1|0|1} compare result - */ -const compareModulesById = (chunkGraph, a, b) => { - return compareIds(chunkGraph.getModuleId(a), chunkGraph.getModuleId(b)); -}; -/** @type {ParameterizedComparator} */ -exports.compareModulesById = - createCachedParameterizedComparator(compareModulesById); +const Template = __webpack_require__(1626); +const WebAssemblyImportDependency = __webpack_require__(5239); -/** - * @param {number} a number - * @param {number} b number - * @returns {-1|0|1} compare result +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../ModuleGraph")} ModuleGraph */ + +/** @typedef {Object} UsedWasmDependency + * @property {WebAssemblyImportDependency} dependency the dependency + * @property {string} name the export name + * @property {string} module the module name */ -const compareNumbers = (a, b) => { - if (typeof a !== typeof b) { - return typeof a < typeof b ? -1 : 1; - } - if (a < b) return -1; - if (a > b) return 1; - return 0; -}; -exports.compareNumbers = compareNumbers; + +const MANGLED_MODULE = "a"; /** - * @param {string} a string - * @param {string} b string - * @returns {-1|0|1} compare result + * @param {ModuleGraph} moduleGraph the module graph + * @param {Module} module the module + * @param {boolean} mangle mangle module and export names + * @returns {UsedWasmDependency[]} used dependencies and (mangled) name */ -const compareStringsNumeric = (a, b) => { - const partsA = a.split(/(\d+)/); - const partsB = b.split(/(\d+)/); - const len = Math.min(partsA.length, partsB.length); - for (let i = 0; i < len; i++) { - const pA = partsA[i]; - const pB = partsB[i]; - if (i % 2 === 0) { - if (pA.length > pB.length) { - if (pA.slice(0, pB.length) > pB) return 1; - return -1; - } else if (pB.length > pA.length) { - if (pB.slice(0, pA.length) > pA) return -1; - return 1; +const getUsedDependencies = (moduleGraph, module, mangle) => { + /** @type {UsedWasmDependency[]} */ + const array = []; + let importIndex = 0; + for (const dep of module.dependencies) { + if (dep instanceof WebAssemblyImportDependency) { + if ( + dep.description.type === "GlobalType" || + moduleGraph.getModule(dep) === null + ) { + continue; + } + + const exportName = dep.name; + // TODO add the following 3 lines when removing of ModuleExport is possible + // const importedModule = moduleGraph.getModule(dep); + // const usedName = importedModule && moduleGraph.getExportsInfo(importedModule).getUsedName(exportName, runtime); + // if (usedName !== false) { + if (mangle) { + array.push({ + dependency: dep, + name: Template.numberToIdentifier(importIndex++), + module: MANGLED_MODULE + }); } else { - if (pA < pB) return -1; - if (pA > pB) return 1; + array.push({ + dependency: dep, + name: exportName, + module: dep.request + }); } - } else { - const nA = +pA; - const nB = +pB; - if (nA < nB) return -1; - if (nA > nB) return 1; } } - if (partsB.length < partsA.length) return 1; - if (partsB.length > partsA.length) return -1; - return 0; -}; -exports.compareStringsNumeric = compareStringsNumeric; - -/** - * @param {ModuleGraph} moduleGraph the module graph - * @param {Module} a module - * @param {Module} b module - * @returns {-1|0|1} compare result - */ -const compareModulesByPostOrderIndexOrIdentifier = (moduleGraph, a, b) => { - const cmp = compareNumbers( - moduleGraph.getPostOrderIndex(a), - moduleGraph.getPostOrderIndex(b) - ); - if (cmp !== 0) return cmp; - return compareIds(a.identifier(), b.identifier()); + return array; }; -/** @type {ParameterizedComparator} */ -exports.compareModulesByPostOrderIndexOrIdentifier = - createCachedParameterizedComparator( - compareModulesByPostOrderIndexOrIdentifier - ); -/** - * @param {ModuleGraph} moduleGraph the module graph - * @param {Module} a module - * @param {Module} b module - * @returns {-1|0|1} compare result - */ -const compareModulesByPreOrderIndexOrIdentifier = (moduleGraph, a, b) => { - const cmp = compareNumbers( - moduleGraph.getPreOrderIndex(a), - moduleGraph.getPreOrderIndex(b) - ); - if (cmp !== 0) return cmp; - return compareIds(a.identifier(), b.identifier()); -}; -/** @type {ParameterizedComparator} */ -exports.compareModulesByPreOrderIndexOrIdentifier = - createCachedParameterizedComparator( - compareModulesByPreOrderIndexOrIdentifier - ); +exports.getUsedDependencies = getUsedDependencies; +exports.MANGLED_MODULE = MANGLED_MODULE; -/** - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {Module} a module - * @param {Module} b module - * @returns {-1|0|1} compare result - */ -const compareModulesByIdOrIdentifier = (chunkGraph, a, b) => { - const cmp = compareIds(chunkGraph.getModuleId(a), chunkGraph.getModuleId(b)); - if (cmp !== 0) return cmp; - return compareIds(a.identifier(), b.identifier()); -}; -/** @type {ParameterizedComparator} */ -exports.compareModulesByIdOrIdentifier = createCachedParameterizedComparator( - compareModulesByIdOrIdentifier -); -/** - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {Chunk} a chunk - * @param {Chunk} b chunk - * @returns {-1|0|1} compare result - */ -const compareChunks = (chunkGraph, a, b) => { - return chunkGraph.compareChunks(a, b); -}; -/** @type {ParameterizedComparator} */ -exports.compareChunks = createCachedParameterizedComparator(compareChunks); +/***/ }), -/** - * @param {string|number} a first id - * @param {string|number} b second id - * @returns {-1|0|1} compare result - */ -const compareIds = (a, b) => { - if (typeof a !== typeof b) { - return typeof a < typeof b ? -1 : 1; - } - if (a < b) return -1; - if (a > b) return 1; - return 0; -}; +/***/ 78613: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -exports.compareIds = compareIds; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/** - * @param {string} a first string - * @param {string} b second string - * @returns {-1|0|1} compare result - */ -const compareStrings = (a, b) => { - if (a < b) return -1; - if (a > b) return 1; - return 0; -}; -exports.compareStrings = compareStrings; -/** - * @param {ChunkGroup} a first chunk group - * @param {ChunkGroup} b second chunk group - * @returns {-1|0|1} compare result - */ -const compareChunkGroupsByIndex = (a, b) => { - return a.index < b.index ? -1 : 1; -}; +/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ +/** @typedef {import("../../declarations/WebpackOptions").WasmLoadingType} WasmLoadingType */ +/** @typedef {import("../Compiler")} Compiler */ -exports.compareChunkGroupsByIndex = compareChunkGroupsByIndex; +/** @type {WeakMap>} */ +const enabledTypes = new WeakMap(); -/** - * @template K1 {Object} - * @template K2 - * @template T - */ -class TwoKeyWeakMap { - constructor() { - /** @private @type {WeakMap>} */ - this._map = new WeakMap(); +const getEnabledTypes = compiler => { + let set = enabledTypes.get(compiler); + if (set === undefined) { + set = new Set(); + enabledTypes.set(compiler, set); } + return set; +}; +class EnableWasmLoadingPlugin { /** - * @param {K1} key1 first key - * @param {K2} key2 second key - * @returns {T | undefined} value + * @param {WasmLoadingType} type library type that should be available */ - get(key1, key2) { - const childMap = this._map.get(key1); - if (childMap === undefined) { - return undefined; - } - return childMap.get(key2); + constructor(type) { + this.type = type; } /** - * @param {K1} key1 first key - * @param {K2} key2 second key - * @param {T | undefined} value new value + * @param {Compiler} compiler the compiler instance + * @param {WasmLoadingType} type type of library * @returns {void} */ - set(key1, key2, value) { - let childMap = this._map.get(key1); - if (childMap === undefined) { - childMap = new WeakMap(); - this._map.set(key1, childMap); - } - childMap.set(key2, value); - } -} - -/** @type {TwoKeyWeakMap, Comparator, Comparator>}} */ -const concatComparatorsCache = new TwoKeyWeakMap(); - -/** - * @template T - * @param {Comparator} c1 comparator - * @param {Comparator} c2 comparator - * @param {Comparator[]} cRest comparators - * @returns {Comparator} comparator - */ -const concatComparators = (c1, c2, ...cRest) => { - if (cRest.length > 0) { - const [c3, ...cRest2] = cRest; - return concatComparators(c1, concatComparators(c2, c3, ...cRest2)); + static setEnabled(compiler, type) { + getEnabledTypes(compiler).add(type); } - const cacheEntry = /** @type {Comparator} */ ( - concatComparatorsCache.get(c1, c2) - ); - if (cacheEntry !== undefined) return cacheEntry; - /** - * @param {T} a first value - * @param {T} b second value - * @returns {-1|0|1} compare result - */ - const result = (a, b) => { - const res = c1(a, b); - if (res !== 0) return res; - return c2(a, b); - }; - concatComparatorsCache.set(c1, c2, result); - return result; -}; -exports.concatComparators = concatComparators; - -/** @template A, B @typedef {(input: A) => B} Selector */ - -/** @type {TwoKeyWeakMap, Comparator, Comparator>}} */ -const compareSelectCache = new TwoKeyWeakMap(); -/** - * @template T - * @template R - * @param {Selector} getter getter for value - * @param {Comparator} comparator comparator - * @returns {Comparator} comparator - */ -const compareSelect = (getter, comparator) => { - const cacheEntry = compareSelectCache.get(getter, comparator); - if (cacheEntry !== undefined) return cacheEntry; /** - * @param {T} a first value - * @param {T} b second value - * @returns {-1|0|1} compare result + * @param {Compiler} compiler the compiler instance + * @param {WasmLoadingType} type type of library + * @returns {void} */ - const result = (a, b) => { - const aValue = getter(a); - const bValue = getter(b); - if (aValue !== undefined && aValue !== null) { - if (bValue !== undefined && bValue !== null) { - return comparator(aValue, bValue); - } - return -1; - } else { - if (bValue !== undefined && bValue !== null) { - return 1; - } - return 0; + static checkEnabled(compiler, type) { + if (!getEnabledTypes(compiler).has(type)) { + throw new Error( + `Library type "${type}" is not enabled. ` + + "EnableWasmLoadingPlugin need to be used to enable this type of wasm loading. " + + 'This usually happens through the "output.enabledWasmLoadingTypes" option. ' + + 'If you are using a function as entry which sets "wasmLoading", you need to add all potential library types to "output.enabledWasmLoadingTypes". ' + + "These types are enabled: " + + Array.from(getEnabledTypes(compiler)).join(", ") + ); } - }; - compareSelectCache.set(getter, comparator, result); - return result; -}; -exports.compareSelect = compareSelect; - -/** @type {WeakMap, Comparator>>} */ -const compareIteratorsCache = new WeakMap(); + } -/** - * @template T - * @param {Comparator} elementComparator comparator for elements - * @returns {Comparator>} comparator for iterables of elements - */ -const compareIterables = elementComparator => { - const cacheEntry = compareIteratorsCache.get(elementComparator); - if (cacheEntry !== undefined) return cacheEntry; /** - * @param {Iterable} a first value - * @param {Iterable} b second value - * @returns {-1|0|1} compare result + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} */ - const result = (a, b) => { - const aI = a[Symbol.iterator](); - const bI = b[Symbol.iterator](); - // eslint-disable-next-line no-constant-condition - while (true) { - const aItem = aI.next(); - const bItem = bI.next(); - if (aItem.done) { - return bItem.done ? 0 : -1; - } else if (bItem.done) { - return 1; - } - const res = elementComparator(aItem.value, bItem.value); - if (res !== 0) return res; - } - }; - compareIteratorsCache.set(elementComparator, result); - return result; -}; -exports.compareIterables = compareIterables; - -// TODO this is no longer needed when minimum node.js version is >= 12 -// since these versions ship with a stable sort function -/** - * @template T - * @param {Iterable} iterable original ordered list - * @returns {Comparator} comparator - */ -exports.keepOriginalOrder = iterable => { - /** @type {Map} */ - const map = new Map(); - let i = 0; - for (const item of iterable) { - map.set(item, i++); - } - return (a, b) => compareNumbers(map.get(a), map.get(b)); -}; + apply(compiler) { + const { type } = this; -/** - * @param {ChunkGraph} chunkGraph the chunk graph - * @returns {Comparator} comparator - */ -exports.compareChunksNatural = chunkGraph => { - const cmpFn = exports.compareModulesById(chunkGraph); - const cmpIterableFn = compareIterables(cmpFn); - return concatComparators( - compareSelect(chunk => chunk.name, compareIds), - compareSelect(chunk => chunk.runtime, compareRuntime), - compareSelect( - /** - * @param {Chunk} chunk a chunk - * @returns {Iterable} modules - */ - chunk => chunkGraph.getOrderedChunkModulesIterable(chunk, cmpFn), - cmpIterableFn - ) - ); -}; + // Only enable once + const enabled = getEnabledTypes(compiler); + if (enabled.has(type)) return; + enabled.add(type); -/** - * Compare two locations - * @param {DependencyLocation} a A location node - * @param {DependencyLocation} b A location node - * @returns {-1|0|1} sorting comparator value - */ -exports.compareLocations = (a, b) => { - let isObjectA = typeof a === "object" && a !== null; - let isObjectB = typeof b === "object" && b !== null; - if (!isObjectA || !isObjectB) { - if (isObjectA) return 1; - if (isObjectB) return -1; - return 0; - } - if ("start" in a) { - if ("start" in b) { - const ap = a.start; - const bp = b.start; - if (ap.line < bp.line) return -1; - if (ap.line > bp.line) return 1; - if (ap.column < bp.column) return -1; - if (ap.column > bp.column) return 1; - } else return -1; - } else if ("start" in b) return 1; - if ("name" in a) { - if ("name" in b) { - if (a.name < b.name) return -1; - if (a.name > b.name) return 1; - } else return -1; - } else if ("name" in b) return 1; - if ("index" in a) { - if ("index" in b) { - if (a.index < b.index) return -1; - if (a.index > b.index) return 1; - } else return -1; - } else if ("index" in b) return 1; - return 0; -}; + if (typeof type === "string") { + switch (type) { + case "fetch": { + // TODO webpack 6 remove FetchCompileWasmPlugin + const FetchCompileWasmPlugin = __webpack_require__(35537); + const FetchCompileAsyncWasmPlugin = __webpack_require__(8437); + new FetchCompileWasmPlugin({ + mangleImports: compiler.options.optimization.mangleWasmImports + }).apply(compiler); + new FetchCompileAsyncWasmPlugin().apply(compiler); + break; + } + case "async-node": { + // TODO webpack 6 remove ReadFileCompileWasmPlugin + const ReadFileCompileWasmPlugin = __webpack_require__(98939); + // @ts-expect-error typescript bug for duplicate require + const ReadFileCompileAsyncWasmPlugin = __webpack_require__(73163); + new ReadFileCompileWasmPlugin({ + mangleImports: compiler.options.optimization.mangleWasmImports + }).apply(compiler); + new ReadFileCompileAsyncWasmPlugin({ type }).apply(compiler); + break; + } + case "async-node-module": { + // @ts-expect-error typescript bug for duplicate require + const ReadFileCompileAsyncWasmPlugin = __webpack_require__(73163); + new ReadFileCompileAsyncWasmPlugin({ type, import: true }).apply( + compiler + ); + break; + } + case "universal": + throw new Error( + "Universal WebAssembly Loading is not implemented yet" + ); + default: + throw new Error(`Unsupported wasm loading type ${type}. +Plugins which provide custom wasm loading types must call EnableWasmLoadingPlugin.setEnabled(compiler, type) to disable this error.`); + } + } else { + // TODO support plugin instances here + // apply them to the compiler + } + } +} + +module.exports = EnableWasmLoadingPlugin; /***/ }), -/***/ 29404: -/***/ (function(module) { +/***/ 8437: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -132033,210 +132449,145 @@ exports.compareLocations = (a, b) => { -const quoteMeta = str => { - return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); -}; - -const toSimpleString = str => { - if (`${+str}` === str) { - return str; - } - return JSON.stringify(str); -}; +const RuntimeGlobals = __webpack_require__(16475); +const AsyncWasmLoadingRuntimeModule = __webpack_require__(5434); -/** - * @param {Record} map value map - * @returns {boolean|(function(string): string)} true/false, when unconditionally true/false, or a template function to determine the value at runtime - */ -const compileBooleanMatcher = map => { - const positiveItems = Object.keys(map).filter(i => map[i]); - const negativeItems = Object.keys(map).filter(i => !map[i]); - if (positiveItems.length === 0) return false; - if (negativeItems.length === 0) return true; - return compileBooleanMatcherFromLists(positiveItems, negativeItems); -}; +/** @typedef {import("../Compiler")} Compiler */ -/** - * @param {string[]} positiveItems positive items - * @param {string[]} negativeItems negative items - * @returns {function(string): string} a template function to determine the value at runtime - */ -const compileBooleanMatcherFromLists = (positiveItems, negativeItems) => { - if (positiveItems.length === 0) return () => "false"; - if (negativeItems.length === 0) return () => "true"; - if (positiveItems.length === 1) - return value => `${toSimpleString(positiveItems[0])} == ${value}`; - if (negativeItems.length === 1) - return value => `${toSimpleString(negativeItems[0])} != ${value}`; - const positiveRegexp = itemsToRegexp(positiveItems); - const negativeRegexp = itemsToRegexp(negativeItems); - if (positiveRegexp.length <= negativeRegexp.length) { - return value => `/^${positiveRegexp}$/.test(${value})`; - } else { - return value => `!/^${negativeRegexp}$/.test(${value})`; - } -}; +class FetchCompileAsyncWasmPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "FetchCompileAsyncWasmPlugin", + compilation => { + const globalWasmLoading = compilation.outputOptions.wasmLoading; + const isEnabledForChunk = chunk => { + const options = chunk.getEntryOptions(); + const wasmLoading = + options && options.wasmLoading !== undefined + ? options.wasmLoading + : globalWasmLoading; + return wasmLoading === "fetch"; + }; + const generateLoadBinaryCode = path => + `fetch(${RuntimeGlobals.publicPath} + ${path})`; -const popCommonItems = (itemsSet, getKey, condition) => { - const map = new Map(); - for (const item of itemsSet) { - const key = getKey(item); - if (key) { - let list = map.get(key); - if (list === undefined) { - list = []; - map.set(key, list); - } - list.push(item); - } - } - const result = []; - for (const list of map.values()) { - if (condition(list)) { - for (const item of list) { - itemsSet.delete(item); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.instantiateWasm) + .tap("FetchCompileAsyncWasmPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + const chunkGraph = compilation.chunkGraph; + if ( + !chunkGraph.hasModuleInGraph( + chunk, + m => m.type === "webassembly/async" + ) + ) { + return; + } + set.add(RuntimeGlobals.publicPath); + compilation.addRuntimeModule( + chunk, + new AsyncWasmLoadingRuntimeModule({ + generateLoadBinaryCode, + supportsStreaming: true + }) + ); + }); } - result.push(list); - } + ); } - return result; -}; +} -const getCommonPrefix = items => { - let prefix = items[0]; - for (let i = 1; i < items.length; i++) { - const item = items[i]; - for (let p = 0; p < prefix.length; p++) { - if (item[p] !== prefix[p]) { - prefix = prefix.slice(0, p); - break; - } - } - } - return prefix; -}; +module.exports = FetchCompileAsyncWasmPlugin; -const getCommonSuffix = items => { - let suffix = items[0]; - for (let i = 1; i < items.length; i++) { - const item = items[i]; - for (let p = item.length - 1, s = suffix.length - 1; s >= 0; p--, s--) { - if (item[p] !== suffix[s]) { - suffix = suffix.slice(s + 1); - break; - } - } - } - return suffix; -}; -const itemsToRegexp = itemsArr => { - if (itemsArr.length === 1) { - return quoteMeta(itemsArr[0]); - } - const finishedItems = []; +/***/ }), - // merge single char items: (a|b|c|d|ef) => ([abcd]|ef) - let countOfSingleCharItems = 0; - for (const item of itemsArr) { - if (item.length === 1) { - countOfSingleCharItems++; - } - } - // special case for only single char items - if (countOfSingleCharItems === itemsArr.length) { - return `[${quoteMeta(itemsArr.sort().join(""))}]`; - } - const items = new Set(itemsArr.sort()); - if (countOfSingleCharItems > 2) { - let singleCharItems = ""; - for (const item of items) { - if (item.length === 1) { - singleCharItems += item; - items.delete(item); - } - } - finishedItems.push(`[${quoteMeta(singleCharItems)}]`); - } +/***/ 35537: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // special case for 2 items with common prefix/suffix - if (finishedItems.length === 0 && items.size === 2) { - const prefix = getCommonPrefix(itemsArr); - const suffix = getCommonSuffix( - itemsArr.map(item => item.slice(prefix.length)) - ); - if (prefix.length > 0 || suffix.length > 0) { - return `${quoteMeta(prefix)}${itemsToRegexp( - itemsArr.map(i => i.slice(prefix.length, -suffix.length || undefined)) - )}${quoteMeta(suffix)}`; - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // special case for 2 items with common suffix - if (finishedItems.length === 0 && items.size === 2) { - const it = items[Symbol.iterator](); - const a = it.next().value; - const b = it.next().value; - if (a.length > 0 && b.length > 0 && a.slice(-1) === b.slice(-1)) { - return `${itemsToRegexp([a.slice(0, -1), b.slice(0, -1)])}${quoteMeta( - a.slice(-1) - )}`; - } - } - // find common prefix: (a1|a2|a3|a4|b5) => (a(1|2|3|4)|b5) - const prefixed = popCommonItems( - items, - item => (item.length >= 1 ? item[0] : false), - list => { - if (list.length >= 3) return true; - if (list.length <= 1) return false; - return list[0][1] === list[1][1]; - } - ); - for (const prefixedItems of prefixed) { - const prefix = getCommonPrefix(prefixedItems); - finishedItems.push( - `${quoteMeta(prefix)}${itemsToRegexp( - prefixedItems.map(i => i.slice(prefix.length)) - )}` - ); + +const RuntimeGlobals = __webpack_require__(16475); +const WasmChunkLoadingRuntimeModule = __webpack_require__(87394); + +/** @typedef {import("../Compiler")} Compiler */ + +// TODO webpack 6 remove + +class FetchCompileWasmPlugin { + constructor(options) { + this.options = options || {}; } - // find common suffix: (a1|b1|c1|d1|e2) => ((a|b|c|d)1|e2) - const suffixed = popCommonItems( - items, - item => (item.length >= 1 ? item.slice(-1) : false), - list => { - if (list.length >= 3) return true; - if (list.length <= 1) return false; - return list[0].slice(-2) === list[1].slice(-2); - } - ); - for (const suffixedItems of suffixed) { - const suffix = getCommonSuffix(suffixedItems); - finishedItems.push( - `${itemsToRegexp( - suffixedItems.map(i => i.slice(0, -suffix.length)) - )}${quoteMeta(suffix)}` + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "FetchCompileWasmPlugin", + compilation => { + const globalWasmLoading = compilation.outputOptions.wasmLoading; + const isEnabledForChunk = chunk => { + const options = chunk.getEntryOptions(); + const wasmLoading = + options && options.wasmLoading !== undefined + ? options.wasmLoading + : globalWasmLoading; + return wasmLoading === "fetch"; + }; + const generateLoadBinaryCode = path => + `fetch(${RuntimeGlobals.publicPath} + ${path})`; + + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("FetchCompileWasmPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + const chunkGraph = compilation.chunkGraph; + if ( + !chunkGraph.hasModuleInGraph( + chunk, + m => m.type === "webassembly/sync" + ) + ) { + return; + } + set.add(RuntimeGlobals.moduleCache); + set.add(RuntimeGlobals.publicPath); + compilation.addRuntimeModule( + chunk, + new WasmChunkLoadingRuntimeModule({ + generateLoadBinaryCode, + supportsStreaming: true, + mangleImports: this.options.mangleImports, + runtimeRequirements: set + }) + ); + }); + } ); } +} - // TODO further optimize regexp, i. e. - // use ranges: (1|2|3|4|a) => [1-4a] - const conditional = finishedItems.concat(Array.from(items, quoteMeta)); - if (conditional.length === 1) return conditional[0]; - return `(${conditional.join("|")})`; -}; - -compileBooleanMatcher.fromLists = compileBooleanMatcherFromLists; -compileBooleanMatcher.itemsToRegexp = itemsToRegexp; -module.exports = compileBooleanMatcher; +module.exports = FetchCompileWasmPlugin; /***/ }), -/***/ 32540: +/***/ 83121: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -132247,212 +132598,544 @@ module.exports = compileBooleanMatcher; -const memoize = __webpack_require__(78676); +const RuntimeGlobals = __webpack_require__(16475); +const JsonpChunkLoadingRuntimeModule = __webpack_require__(84154); -const getValidate = memoize(() => (__webpack_require__(38476).validate)); +/** @typedef {import("../Compiler")} Compiler */ -const createSchemaValidation = (check, getSchema, options) => { - getSchema = memoize(getSchema); - return value => { - if (check && !check(value)) { - getValidate()(getSchema(), value, options); - if (check) { - (__webpack_require__(73837).deprecate)( - () => {}, - "webpack bug: Pre-compiled schema reports error while real schema is happy. This has performance drawbacks.", - "DEP_WEBPACK_PRE_COMPILED_SCHEMA_INVALID" - )(); +class JsonpChunkLoadingPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "JsonpChunkLoadingPlugin", + compilation => { + const globalChunkLoading = compilation.outputOptions.chunkLoading; + const isEnabledForChunk = chunk => { + const options = chunk.getEntryOptions(); + const chunkLoading = + options && options.chunkLoading !== undefined + ? options.chunkLoading + : globalChunkLoading; + return chunkLoading === "jsonp"; + }; + const onceForChunkSet = new WeakSet(); + const handler = (chunk, set) => { + if (onceForChunkSet.has(chunk)) return; + onceForChunkSet.add(chunk); + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + set.add(RuntimeGlobals.hasOwnProperty); + compilation.addRuntimeModule( + chunk, + new JsonpChunkLoadingRuntimeModule(set) + ); + }; + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("JsonpChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadUpdateHandlers) + .tap("JsonpChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadManifest) + .tap("JsonpChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.baseURI) + .tap("JsonpChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.onChunksLoaded) + .tap("JsonpChunkLoadingPlugin", handler); + + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("JsonpChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.publicPath); + set.add(RuntimeGlobals.loadScript); + set.add(RuntimeGlobals.getChunkScriptFilename); + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadUpdateHandlers) + .tap("JsonpChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.publicPath); + set.add(RuntimeGlobals.loadScript); + set.add(RuntimeGlobals.getChunkUpdateScriptFilename); + set.add(RuntimeGlobals.moduleCache); + set.add(RuntimeGlobals.hmrModuleData); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadManifest) + .tap("JsonpChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.publicPath); + set.add(RuntimeGlobals.getUpdateManifestFilename); + }); } - } - }; -}; + ); + } +} -module.exports = createSchemaValidation; +module.exports = JsonpChunkLoadingPlugin; /***/ }), -/***/ 49835: +/***/ 84154: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra */ -const Hash = __webpack_require__(36692); - -const BULK_SIZE = 2000; +const { SyncWaterfallHook } = __webpack_require__(6967); +const Compilation = __webpack_require__(85720); +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); +const chunkHasJs = (__webpack_require__(89464).chunkHasJs); +const { getInitialChunkIds } = __webpack_require__(98124); +const compileBooleanMatcher = __webpack_require__(29404); -// We are using an object instead of a Map as this will stay static during the runtime -// so access to it can be optimized by v8 -const digestCaches = {}; +/** @typedef {import("../Chunk")} Chunk */ -class BulkUpdateDecorator extends Hash { - /** - * @param {Hash | function(): Hash} hashOrFactory function to create a hash - * @param {string=} hashKey key for caching - */ - constructor(hashOrFactory, hashKey) { - super(); - this.hashKey = hashKey; - if (typeof hashOrFactory === "function") { - this.hashFactory = hashOrFactory; - this.hash = undefined; - } else { - this.hashFactory = undefined; - this.hash = hashOrFactory; - } - this.buffer = ""; - } +/** + * @typedef {Object} JsonpCompilationPluginHooks + * @property {SyncWaterfallHook<[string, Chunk]>} linkPreload + * @property {SyncWaterfallHook<[string, Chunk]>} linkPrefetch + */ - /** - * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} - * @param {string|Buffer} data data - * @param {string=} inputEncoding data encoding - * @returns {this} updated hash - */ - update(data, inputEncoding) { - if ( - inputEncoding !== undefined || - typeof data !== "string" || - data.length > BULK_SIZE - ) { - if (this.hash === undefined) this.hash = this.hashFactory(); - if (this.buffer.length > 0) { - this.hash.update(this.buffer); - this.buffer = ""; - } - this.hash.update(data, inputEncoding); - } else { - this.buffer += data; - if (this.buffer.length > BULK_SIZE) { - if (this.hash === undefined) this.hash = this.hashFactory(); - this.hash.update(this.buffer); - this.buffer = ""; - } - } - return this; - } +/** @type {WeakMap} */ +const compilationHooksMap = new WeakMap(); +class JsonpChunkLoadingRuntimeModule extends RuntimeModule { /** - * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} - * @param {string=} encoding encoding of the return value - * @returns {string|Buffer} digest + * @param {Compilation} compilation the compilation + * @returns {JsonpCompilationPluginHooks} hooks */ - digest(encoding) { - let digestCache; - const buffer = this.buffer; - if (this.hash === undefined) { - // short data for hash, we can use caching - const cacheKey = `${this.hashKey}-${encoding}`; - digestCache = digestCaches[cacheKey]; - if (digestCache === undefined) { - digestCache = digestCaches[cacheKey] = new Map(); - } - const cacheEntry = digestCache.get(buffer); - if (cacheEntry !== undefined) return cacheEntry; - this.hash = this.hashFactory(); - } - if (buffer.length > 0) { - this.hash.update(buffer); + static getCompilationHooks(compilation) { + if (!(compilation instanceof Compilation)) { + throw new TypeError( + "The 'compilation' argument must be an instance of Compilation" + ); } - const digestResult = this.hash.digest(encoding); - const result = - typeof digestResult === "string" ? digestResult : digestResult.toString(); - if (digestCache !== undefined) { - digestCache.set(buffer, result); + let hooks = compilationHooksMap.get(compilation); + if (hooks === undefined) { + hooks = { + linkPreload: new SyncWaterfallHook(["source", "chunk"]), + linkPrefetch: new SyncWaterfallHook(["source", "chunk"]) + }; + compilationHooksMap.set(compilation, hooks); } - return result; + return hooks; } -} -/* istanbul ignore next */ -class DebugHash extends Hash { - constructor() { - super(); - this.string = ""; + constructor(runtimeRequirements) { + super("jsonp chunk loading", RuntimeModule.STAGE_ATTACH); + this._runtimeRequirements = runtimeRequirements; } /** - * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} - * @param {string|Buffer} data data - * @param {string=} inputEncoding data encoding - * @returns {this} updated hash + * @returns {string} runtime code */ - update(data, inputEncoding) { - if (typeof data !== "string") data = data.toString("utf-8"); - if (data.startsWith("debug-digest-")) { - data = Buffer.from(data.slice("debug-digest-".length), "hex").toString(); - } - this.string += `[${data}](${new Error().stack.split("\n", 3)[2]})\n`; - return this; - } + generate() { + const { chunkGraph, compilation, chunk } = this; + const { + runtimeTemplate, + outputOptions: { + chunkLoadingGlobal, + hotUpdateGlobal, + crossOriginLoading, + scriptType + } + } = compilation; + const globalObject = runtimeTemplate.globalObject; + const { linkPreload, linkPrefetch } = + JsonpChunkLoadingRuntimeModule.getCompilationHooks(compilation); + const fn = RuntimeGlobals.ensureChunkHandlers; + const withBaseURI = this._runtimeRequirements.has(RuntimeGlobals.baseURI); + const withLoading = this._runtimeRequirements.has( + RuntimeGlobals.ensureChunkHandlers + ); + const withCallback = this._runtimeRequirements.has( + RuntimeGlobals.chunkCallback + ); + const withOnChunkLoad = this._runtimeRequirements.has( + RuntimeGlobals.onChunksLoaded + ); + const withHmr = this._runtimeRequirements.has( + RuntimeGlobals.hmrDownloadUpdateHandlers + ); + const withHmrManifest = this._runtimeRequirements.has( + RuntimeGlobals.hmrDownloadManifest + ); + const withPrefetch = this._runtimeRequirements.has( + RuntimeGlobals.prefetchChunkHandlers + ); + const withPreload = this._runtimeRequirements.has( + RuntimeGlobals.preloadChunkHandlers + ); + const chunkLoadingGlobalExpr = `${globalObject}[${JSON.stringify( + chunkLoadingGlobal + )}]`; + const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs); + const hasJsMatcher = compileBooleanMatcher(conditionMap); + const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); - /** - * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} - * @param {string=} encoding encoding of the return value - * @returns {string|Buffer} digest - */ - digest(encoding) { - return "debug-digest-" + Buffer.from(this.string).toString("hex"); + const stateExpression = withHmr + ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_jsonp` + : undefined; + + return Template.asString([ + withBaseURI + ? Template.asString([ + `${RuntimeGlobals.baseURI} = document.baseURI || self.location.href;` + ]) + : "// no baseURI", + "", + "// object to store loaded and loading chunks", + "// undefined = chunk not loaded, null = chunk preloaded/prefetched", + "// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded", + `var installedChunks = ${ + stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" + }{`, + Template.indent( + Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join( + ",\n" + ) + ), + "};", + "", + withLoading + ? Template.asString([ + `${fn}.j = ${runtimeTemplate.basicFunction( + "chunkId, promises", + hasJsMatcher !== false + ? Template.indent([ + "// JSONP chunk loading for javascript", + `var installedChunkData = ${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;`, + 'if(installedChunkData !== 0) { // 0 means "already installed".', + Template.indent([ + "", + '// a Promise means "currently loading".', + "if(installedChunkData) {", + Template.indent([ + "promises.push(installedChunkData[2]);" + ]), + "} else {", + Template.indent([ + hasJsMatcher === true + ? "if(true) { // all chunks have JS" + : `if(${hasJsMatcher("chunkId")}) {`, + Template.indent([ + "// setup Promise in chunk cache", + `var promise = new Promise(${runtimeTemplate.expressionFunction( + `installedChunkData = installedChunks[chunkId] = [resolve, reject]`, + "resolve, reject" + )});`, + "promises.push(installedChunkData[2] = promise);", + "", + "// start chunk loading", + `var url = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId);`, + "// create error before stack unwound to get useful stacktrace later", + "var error = new Error();", + `var loadingEnded = ${runtimeTemplate.basicFunction( + "event", + [ + `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId)) {`, + Template.indent([ + "installedChunkData = installedChunks[chunkId];", + "if(installedChunkData !== 0) installedChunks[chunkId] = undefined;", + "if(installedChunkData) {", + Template.indent([ + "var errorType = event && (event.type === 'load' ? 'missing' : event.type);", + "var realSrc = event && event.target && event.target.src;", + "error.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", + "error.name = 'ChunkLoadError';", + "error.type = errorType;", + "error.request = realSrc;", + "installedChunkData[1](error);" + ]), + "}" + ]), + "}" + ] + )};`, + `${RuntimeGlobals.loadScript}(url, loadingEnded, "chunk-" + chunkId, chunkId);` + ]), + "} else installedChunks[chunkId] = 0;" + ]), + "}" + ]), + "}" + ]) + : Template.indent(["installedChunks[chunkId] = 0;"]) + )};` + ]) + : "// no chunk on demand loading", + "", + withPrefetch && hasJsMatcher !== false + ? `${ + RuntimeGlobals.prefetchChunkHandlers + }.j = ${runtimeTemplate.basicFunction("chunkId", [ + `if((!${ + RuntimeGlobals.hasOwnProperty + }(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && ${ + hasJsMatcher === true ? "true" : hasJsMatcher("chunkId") + }) {`, + Template.indent([ + "installedChunks[chunkId] = null;", + linkPrefetch.call( + Template.asString([ + "var link = document.createElement('link');", + crossOriginLoading + ? `link.crossOrigin = ${JSON.stringify( + crossOriginLoading + )};` + : "", + `if (${RuntimeGlobals.scriptNonce}) {`, + Template.indent( + `link.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});` + ), + "}", + 'link.rel = "prefetch";', + 'link.as = "script";', + `link.href = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId);` + ]), + chunk + ), + "document.head.appendChild(link);" + ]), + "}" + ])};` + : "// no prefetching", + "", + withPreload && hasJsMatcher !== false + ? `${ + RuntimeGlobals.preloadChunkHandlers + }.j = ${runtimeTemplate.basicFunction("chunkId", [ + `if((!${ + RuntimeGlobals.hasOwnProperty + }(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && ${ + hasJsMatcher === true ? "true" : hasJsMatcher("chunkId") + }) {`, + Template.indent([ + "installedChunks[chunkId] = null;", + linkPreload.call( + Template.asString([ + "var link = document.createElement('link');", + scriptType + ? `link.type = ${JSON.stringify(scriptType)};` + : "", + "link.charset = 'utf-8';", + `if (${RuntimeGlobals.scriptNonce}) {`, + Template.indent( + `link.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});` + ), + "}", + 'link.rel = "preload";', + 'link.as = "script";', + `link.href = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId);`, + crossOriginLoading + ? Template.asString([ + "if (link.href.indexOf(window.location.origin + '/') !== 0) {", + Template.indent( + `link.crossOrigin = ${JSON.stringify( + crossOriginLoading + )};` + ), + "}" + ]) + : "" + ]), + chunk + ), + "document.head.appendChild(link);" + ]), + "}" + ])};` + : "// no preloaded", + "", + withHmr + ? Template.asString([ + "var currentUpdatedModulesList;", + "var waitingUpdateResolves = {};", + "function loadUpdateChunk(chunkId) {", + Template.indent([ + `return new Promise(${runtimeTemplate.basicFunction( + "resolve, reject", + [ + "waitingUpdateResolves[chunkId] = resolve;", + "// start update chunk loading", + `var url = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId);`, + "// create error before stack unwound to get useful stacktrace later", + "var error = new Error();", + `var loadingEnded = ${runtimeTemplate.basicFunction("event", [ + "if(waitingUpdateResolves[chunkId]) {", + Template.indent([ + "waitingUpdateResolves[chunkId] = undefined", + "var errorType = event && (event.type === 'load' ? 'missing' : event.type);", + "var realSrc = event && event.target && event.target.src;", + "error.message = 'Loading hot update chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", + "error.name = 'ChunkLoadError';", + "error.type = errorType;", + "error.request = realSrc;", + "reject(error);" + ]), + "}" + ])};`, + `${RuntimeGlobals.loadScript}(url, loadingEnded);` + ] + )});` + ]), + "}", + "", + `${globalObject}[${JSON.stringify( + hotUpdateGlobal + )}] = ${runtimeTemplate.basicFunction( + "chunkId, moreModules, runtime", + [ + "for(var moduleId in moreModules) {", + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, + Template.indent([ + "currentUpdate[moduleId] = moreModules[moduleId];", + "if(currentUpdatedModulesList) currentUpdatedModulesList.push(moduleId);" + ]), + "}" + ]), + "}", + "if(runtime) currentUpdateRuntime.push(runtime);", + "if(waitingUpdateResolves[chunkId]) {", + Template.indent([ + "waitingUpdateResolves[chunkId]();", + "waitingUpdateResolves[chunkId] = undefined;" + ]), + "}" + ] + )};`, + "", + Template.getFunctionContent( + require('./JavascriptHotModuleReplacement.runtime.js') + ) + .replace(/\$key\$/g, "jsonp") + .replace(/\$installedChunks\$/g, "installedChunks") + .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") + .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) + .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) + .replace( + /\$ensureChunkHandlers\$/g, + RuntimeGlobals.ensureChunkHandlers + ) + .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) + .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) + .replace( + /\$hmrDownloadUpdateHandlers\$/g, + RuntimeGlobals.hmrDownloadUpdateHandlers + ) + .replace( + /\$hmrInvalidateModuleHandlers\$/g, + RuntimeGlobals.hmrInvalidateModuleHandlers + ) + ]) + : "// no HMR", + "", + withHmrManifest + ? Template.asString([ + `${ + RuntimeGlobals.hmrDownloadManifest + } = ${runtimeTemplate.basicFunction("", [ + 'if (typeof fetch === "undefined") throw new Error("No browser support: need fetch API");', + `return fetch(${RuntimeGlobals.publicPath} + ${ + RuntimeGlobals.getUpdateManifestFilename + }()).then(${runtimeTemplate.basicFunction("response", [ + "if(response.status === 404) return; // no update available", + 'if(!response.ok) throw new Error("Failed to fetch update manifest " + response.statusText);', + "return response.json();" + ])});` + ])};` + ]) + : "// no HMR manifest", + "", + withOnChunkLoad + ? `${ + RuntimeGlobals.onChunksLoaded + }.j = ${runtimeTemplate.returningFunction( + "installedChunks[chunkId] === 0", + "chunkId" + )};` + : "// no on chunks loaded", + "", + withCallback || withLoading + ? Template.asString([ + "// install a JSONP callback for chunk loading", + `var webpackJsonpCallback = ${runtimeTemplate.basicFunction( + "parentChunkLoadingFunction, data", + [ + runtimeTemplate.destructureArray( + ["chunkIds", "moreModules", "runtime"], + "data" + ), + '// add "moreModules" to the modules object,', + '// then flag all "chunkIds" as loaded and fire callback', + "var moduleId, chunkId, i = 0;", + `if(chunkIds.some(${runtimeTemplate.returningFunction( + "installedChunks[id] !== 0", + "id" + )})) {`, + Template.indent([ + "for(moduleId in moreModules) {", + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, + Template.indent( + `${RuntimeGlobals.moduleFactories}[moduleId] = moreModules[moduleId];` + ), + "}" + ]), + "}", + "if(runtime) var result = runtime(__webpack_require__);" + ]), + "}", + "if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);", + "for(;i < chunkIds.length; i++) {", + Template.indent([ + "chunkId = chunkIds[i];", + `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) && installedChunks[chunkId]) {`, + Template.indent("installedChunks[chunkId][0]();"), + "}", + "installedChunks[chunkId] = 0;" + ]), + "}", + withOnChunkLoad + ? `return ${RuntimeGlobals.onChunksLoaded}(result);` + : "" + ] + )}`, + "", + `var chunkLoadingGlobal = ${chunkLoadingGlobalExpr} = ${chunkLoadingGlobalExpr} || [];`, + "chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));", + "chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));" + ]) + : "// no jsonp function" + ]); } } -let crypto = undefined; -let createXXHash64 = undefined; -let createMd4 = undefined; -let BatchedHash = undefined; - -/** - * Creates a hash by name or function - * @param {string | typeof Hash} algorithm the algorithm name or a constructor creating a hash - * @returns {Hash} the hash - */ -module.exports = algorithm => { - if (typeof algorithm === "function") { - return new BulkUpdateDecorator(() => new algorithm()); - } - switch (algorithm) { - // TODO add non-cryptographic algorithm here - case "debug": - return new DebugHash(); - case "xxhash64": - if (createXXHash64 === undefined) { - createXXHash64 = __webpack_require__(35028); - if (BatchedHash === undefined) { - BatchedHash = __webpack_require__(59461); - } - } - return new BatchedHash(createXXHash64()); - case "md4": - if (createMd4 === undefined) { - createMd4 = __webpack_require__(86884); - if (BatchedHash === undefined) { - BatchedHash = __webpack_require__(59461); - } - } - return new BatchedHash(createMd4()); - case "native-md4": - if (crypto === undefined) crypto = __webpack_require__(6113); - return new BulkUpdateDecorator(() => crypto.createHash("md4"), "md4"); - default: - if (crypto === undefined) crypto = __webpack_require__(6113); - return new BulkUpdateDecorator( - () => crypto.createHash(algorithm), - algorithm - ); - } -}; +module.exports = JsonpChunkLoadingRuntimeModule; /***/ }), -/***/ 64518: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 4607: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -132462,269 +133145,43 @@ module.exports = algorithm => { -const util = __webpack_require__(73837); - -/** @type {Map} */ -const deprecationCache = new Map(); - -/** - * @typedef {Object} FakeHookMarker - * @property {true} _fakeHook it's a fake hook - */ - -/** @template T @typedef {T & FakeHookMarker} FakeHook */ - -/** - * @param {string} message deprecation message - * @param {string} code deprecation code - * @returns {Function} function to trigger deprecation - */ -const createDeprecation = (message, code) => { - const cached = deprecationCache.get(message); - if (cached !== undefined) return cached; - const fn = util.deprecate( - () => {}, - message, - "DEP_WEBPACK_DEPRECATION_" + code - ); - deprecationCache.set(message, fn); - return fn; -}; - -const COPY_METHODS = [ - "concat", - "entry", - "filter", - "find", - "findIndex", - "includes", - "indexOf", - "join", - "lastIndexOf", - "map", - "reduce", - "reduceRight", - "slice", - "some" -]; +const ArrayPushCallbackChunkFormatPlugin = __webpack_require__(18535); +const EnableChunkLoadingPlugin = __webpack_require__(61291); +const JsonpChunkLoadingRuntimeModule = __webpack_require__(84154); -const DISABLED_METHODS = [ - "copyWithin", - "entries", - "fill", - "keys", - "pop", - "reverse", - "shift", - "splice", - "sort", - "unshift" -]; +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../Compiler")} Compiler */ -/** - * @param {any} set new set - * @param {string} name property name - * @returns {void} - */ -exports.arrayToSetDeprecation = (set, name) => { - for (const method of COPY_METHODS) { - if (set[method]) continue; - const d = createDeprecation( - `${name} was changed from Array to Set (using Array method '${method}' is deprecated)`, - "ARRAY_TO_SET" - ); - /** - * @deprecated - * @this {Set} - * @returns {number} count - */ - set[method] = function () { - d(); - const array = Array.from(this); - return Array.prototype[method].apply(array, arguments); - }; - } - const dPush = createDeprecation( - `${name} was changed from Array to Set (using Array method 'push' is deprecated)`, - "ARRAY_TO_SET_PUSH" - ); - const dLength = createDeprecation( - `${name} was changed from Array to Set (using Array property 'length' is deprecated)`, - "ARRAY_TO_SET_LENGTH" - ); - const dIndexer = createDeprecation( - `${name} was changed from Array to Set (indexing Array is deprecated)`, - "ARRAY_TO_SET_INDEXER" - ); +class JsonpTemplatePlugin { /** - * @deprecated - * @this {Set} - * @returns {number} count + * @deprecated use JsonpChunkLoadingRuntimeModule.getCompilationHooks instead + * @param {Compilation} compilation the compilation + * @returns {JsonpChunkLoadingRuntimeModule.JsonpCompilationPluginHooks} hooks */ - set.push = function () { - dPush(); - for (const item of Array.from(arguments)) { - this.add(item); - } - return this.size; - }; - for (const method of DISABLED_METHODS) { - if (set[method]) continue; - set[method] = () => { - throw new Error( - `${name} was changed from Array to Set (using Array method '${method}' is not possible)` - ); - }; - } - const createIndexGetter = index => { - /** - * @this {Set} a Set - * @returns {any} the value at this location - */ - const fn = function () { - dIndexer(); - let i = 0; - for (const item of this) { - if (i++ === index) return item; - } - return undefined; - }; - return fn; - }; - const defineIndexGetter = index => { - Object.defineProperty(set, index, { - get: createIndexGetter(index), - set(value) { - throw new Error( - `${name} was changed from Array to Set (indexing Array with write is not possible)` - ); - } - }); - }; - defineIndexGetter(0); - let indexerDefined = 1; - Object.defineProperty(set, "length", { - get() { - dLength(); - const length = this.size; - for (indexerDefined; indexerDefined < length + 1; indexerDefined++) { - defineIndexGetter(indexerDefined); - } - return length; - }, - set(value) { - throw new Error( - `${name} was changed from Array to Set (writing to Array property 'length' is not possible)` - ); - } - }); - set[Symbol.isConcatSpreadable] = true; -}; - -exports.createArrayToSetDeprecationSet = name => { - let initialized = false; - class SetDeprecatedArray extends Set { - constructor(items) { - super(items); - if (!initialized) { - initialized = true; - exports.arrayToSetDeprecation(SetDeprecatedArray.prototype, name); - } - } + static getCompilationHooks(compilation) { + return JsonpChunkLoadingRuntimeModule.getCompilationHooks(compilation); } - return SetDeprecatedArray; -}; - -exports.soonFrozenObjectDeprecation = (obj, name, code, note = "") => { - const message = `${name} will be frozen in future, all modifications are deprecated.${ - note && `\n${note}` - }`; - return new Proxy(obj, { - set: util.deprecate( - (target, property, value, receiver) => - Reflect.set(target, property, value, receiver), - message, - code - ), - defineProperty: util.deprecate( - (target, property, descriptor) => - Reflect.defineProperty(target, property, descriptor), - message, - code - ), - deleteProperty: util.deprecate( - (target, property) => Reflect.deleteProperty(target, property), - message, - code - ), - setPrototypeOf: util.deprecate( - (target, proto) => Reflect.setPrototypeOf(target, proto), - message, - code - ) - }); -}; -/** - * @template T - * @param {T} obj object - * @param {string} message deprecation message - * @param {string} code deprecation code - * @returns {T} object with property access deprecated - */ -const deprecateAllProperties = (obj, message, code) => { - const newObj = {}; - const descriptors = Object.getOwnPropertyDescriptors(obj); - for (const name of Object.keys(descriptors)) { - const descriptor = descriptors[name]; - if (typeof descriptor.value === "function") { - Object.defineProperty(newObj, name, { - ...descriptor, - value: util.deprecate(descriptor.value, message, code) - }); - } else if (descriptor.get || descriptor.set) { - Object.defineProperty(newObj, name, { - ...descriptor, - get: descriptor.get && util.deprecate(descriptor.get, message, code), - set: descriptor.set && util.deprecate(descriptor.set, message, code) - }); - } else { - let value = descriptor.value; - Object.defineProperty(newObj, name, { - configurable: descriptor.configurable, - enumerable: descriptor.enumerable, - get: util.deprecate(() => value, message, code), - set: descriptor.writable - ? util.deprecate(v => (value = v), message, code) - : undefined - }); - } + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.options.output.chunkLoading = "jsonp"; + new ArrayPushCallbackChunkFormatPlugin().apply(compiler); + new EnableChunkLoadingPlugin("jsonp").apply(compiler); } - return /** @type {T} */ (newObj); -}; -exports.deprecateAllProperties = deprecateAllProperties; +} -/** - * @template T - * @param {T} fakeHook fake hook implementation - * @param {string=} message deprecation message (not deprecated when unset) - * @param {string=} code deprecation code (not deprecated when unset) - * @returns {FakeHook} fake hook which redirects - */ -exports.createFakeHook = (fakeHook, message, code) => { - if (message && code) { - fakeHook = deprecateAllProperties(fakeHook, message, code); - } - return Object.freeze( - Object.assign(fakeHook, { _fakeHook: /** @type {true} */ (true) }) - ); -}; +module.exports = JsonpTemplatePlugin; /***/ }), -/***/ 59836: -/***/ (function(module) { +/***/ 36243: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -132734,539 +133191,547 @@ exports.createFakeHook = (fakeHook, message, code) => { -// Simulations show these probabilities for a single change -// 93.1% that one group is invalidated -// 4.8% that two groups are invalidated -// 1.1% that 3 groups are invalidated -// 0.1% that 4 or more groups are invalidated -// -// And these for removing/adding 10 lexically adjacent files -// 64.5% that one group is invalidated -// 24.8% that two groups are invalidated -// 7.8% that 3 groups are invalidated -// 2.7% that 4 or more groups are invalidated -// -// And these for removing/adding 3 random files -// 0% that one group is invalidated -// 3.7% that two groups are invalidated -// 80.8% that 3 groups are invalidated -// 12.3% that 4 groups are invalidated -// 3.2% that 5 or more groups are invalidated +const util = __webpack_require__(73837); +const webpackOptionsSchemaCheck = __webpack_require__(10382); +const webpackOptionsSchema = __webpack_require__(73342); +const Compiler = __webpack_require__(70845); +const MultiCompiler = __webpack_require__(33370); +const WebpackOptionsApply = __webpack_require__(88422); +const { + applyWebpackOptionsDefaults, + applyWebpackOptionsBaseDefaults +} = __webpack_require__(92988); +const { getNormalizedWebpackOptions } = __webpack_require__(26693); +const NodeEnvironmentPlugin = __webpack_require__(7553); +const memoize = __webpack_require__(78676); -/** - * - * @param {string} a key - * @param {string} b key - * @returns {number} the similarity as number - */ -const similarity = (a, b) => { - const l = Math.min(a.length, b.length); - let dist = 0; - for (let i = 0; i < l; i++) { - const ca = a.charCodeAt(i); - const cb = b.charCodeAt(i); - dist += Math.max(0, 10 - Math.abs(ca - cb)); - } - return dist; -}; +/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} WebpackOptions */ +/** @typedef {import("./Compiler").WatchOptions} WatchOptions */ +/** @typedef {import("./MultiCompiler").MultiCompilerOptions} MultiCompilerOptions */ +/** @typedef {import("./MultiStats")} MultiStats */ +/** @typedef {import("./Stats")} Stats */ -/** - * @param {string} a key - * @param {string} b key - * @param {Set} usedNames set of already used names - * @returns {string} the common part and a single char for the difference - */ -const getName = (a, b, usedNames) => { - const l = Math.min(a.length, b.length); - let i = 0; - while (i < l) { - if (a.charCodeAt(i) !== b.charCodeAt(i)) { - i++; - break; - } - i++; - } - while (i < l) { - const name = a.slice(0, i); - const lowerName = name.toLowerCase(); - if (!usedNames.has(lowerName)) { - usedNames.add(lowerName); - return name; - } - i++; - } - // names always contain a hash, so this is always unique - // we don't need to check usedNames nor add it - return a; -}; +const getValidateSchema = memoize(() => __webpack_require__(12047)); /** - * @param {Record} total total size - * @param {Record} size single size + * @template T + * @callback Callback + * @param {Error=} err + * @param {T=} stats * @returns {void} */ -const addSizeTo = (total, size) => { - for (const key of Object.keys(size)) { - total[key] = (total[key] || 0) + size[key]; - } -}; /** - * @param {Record} total total size - * @param {Record} size single size - * @returns {void} + * @param {ReadonlyArray} childOptions options array + * @param {MultiCompilerOptions} options options + * @returns {MultiCompiler} a multi-compiler */ -const subtractSizeFrom = (total, size) => { - for (const key of Object.keys(size)) { - total[key] -= size[key]; +const createMultiCompiler = (childOptions, options) => { + const compilers = childOptions.map(options => createCompiler(options)); + const compiler = new MultiCompiler(compilers, options); + for (const childCompiler of compilers) { + if (childCompiler.options.dependencies) { + compiler.setDependencies( + childCompiler, + childCompiler.options.dependencies + ); + } } + return compiler; }; /** - * @param {Iterable} nodes some nodes - * @returns {Record} total size + * @param {WebpackOptions} rawOptions options object + * @returns {Compiler} a compiler */ -const sumSize = nodes => { - const sum = Object.create(null); - for (const node of nodes) { - addSizeTo(sum, node.size); - } - return sum; -}; - -const isTooBig = (size, maxSize) => { - for (const key of Object.keys(size)) { - const s = size[key]; - if (s === 0) continue; - const maxSizeValue = maxSize[key]; - if (typeof maxSizeValue === "number") { - if (s > maxSizeValue) return true; - } - } - return false; -}; - -const isTooSmall = (size, minSize) => { - for (const key of Object.keys(size)) { - const s = size[key]; - if (s === 0) continue; - const minSizeValue = minSize[key]; - if (typeof minSizeValue === "number") { - if (s < minSizeValue) return true; - } - } - return false; -}; - -const getTooSmallTypes = (size, minSize) => { - const types = new Set(); - for (const key of Object.keys(size)) { - const s = size[key]; - if (s === 0) continue; - const minSizeValue = minSize[key]; - if (typeof minSizeValue === "number") { - if (s < minSizeValue) types.add(key); +const createCompiler = rawOptions => { + const options = getNormalizedWebpackOptions(rawOptions); + applyWebpackOptionsBaseDefaults(options); + const compiler = new Compiler(options.context, options); + new NodeEnvironmentPlugin({ + infrastructureLogging: options.infrastructureLogging + }).apply(compiler); + if (Array.isArray(options.plugins)) { + for (const plugin of options.plugins) { + if (typeof plugin === "function") { + plugin.call(compiler, compiler); + } else { + plugin.apply(compiler); + } } } - return types; -}; - -const getNumberOfMatchingSizeTypes = (size, types) => { - let i = 0; - for (const key of Object.keys(size)) { - if (size[key] !== 0 && types.has(key)) i++; - } - return i; -}; - -const selectiveSizeSum = (size, types) => { - let sum = 0; - for (const key of Object.keys(size)) { - if (size[key] !== 0 && types.has(key)) sum += size[key]; - } - return sum; + applyWebpackOptionsDefaults(options); + compiler.hooks.environment.call(); + compiler.hooks.afterEnvironment.call(); + new WebpackOptionsApply().process(options, compiler); + compiler.hooks.initialize.call(); + return compiler; }; /** - * @template T + * @callback WebpackFunctionSingle + * @param {WebpackOptions} options options object + * @param {Callback=} callback callback + * @returns {Compiler} the compiler object */ -class Node { - /** - * @param {T} item item - * @param {string} key key - * @param {Record} size size - */ - constructor(item, key, size) { - this.item = item; - this.key = key; - this.size = size; - } -} /** - * @template T + * @callback WebpackFunctionMulti + * @param {ReadonlyArray & MultiCompilerOptions} options options objects + * @param {Callback=} callback callback + * @returns {MultiCompiler} the multi compiler object */ -class Group { - /** - * @param {Node[]} nodes nodes - * @param {number[]} similarities similarities between the nodes (length = nodes.length - 1) - * @param {Record=} size size of the group - */ - constructor(nodes, similarities, size) { - this.nodes = nodes; - this.similarities = similarities; - this.size = size || sumSize(nodes); - /** @type {string} */ - this.key = undefined; - } +const asArray = options => + Array.isArray(options) ? Array.from(options) : [options]; + +const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ ( /** - * @param {function(Node): boolean} filter filter function - * @returns {Node[]} removed nodes + * @param {WebpackOptions | (ReadonlyArray & MultiCompilerOptions)} options options + * @param {Callback & Callback=} callback callback + * @returns {Compiler | MultiCompiler} */ - popNodes(filter) { - const newNodes = []; - const newSimilarities = []; - const resultNodes = []; - let lastNode; - for (let i = 0; i < this.nodes.length; i++) { - const node = this.nodes[i]; - if (filter(node)) { - resultNodes.push(node); + (options, callback) => { + const create = () => { + if (!asArray(options).every(webpackOptionsSchemaCheck)) { + getValidateSchema()(webpackOptionsSchema, options); + util.deprecate( + () => {}, + "webpack bug: Pre-compiled schema reports error while real schema is happy. This has performance drawbacks.", + "DEP_WEBPACK_PRE_COMPILED_SCHEMA_INVALID" + )(); + } + /** @type {MultiCompiler|Compiler} */ + let compiler; + let watch = false; + /** @type {WatchOptions|WatchOptions[]} */ + let watchOptions; + if (Array.isArray(options)) { + /** @type {MultiCompiler} */ + compiler = createMultiCompiler( + options, + /** @type {MultiCompilerOptions} */ (options) + ); + watch = options.some(options => options.watch); + watchOptions = options.map(options => options.watchOptions || {}); } else { - if (newNodes.length > 0) { - newSimilarities.push( - lastNode === this.nodes[i - 1] - ? this.similarities[i - 1] - : similarity(lastNode.key, node.key) - ); + const webpackOptions = /** @type {WebpackOptions} */ (options); + /** @type {Compiler} */ + compiler = createCompiler(webpackOptions); + watch = webpackOptions.watch; + watchOptions = webpackOptions.watchOptions || {}; + } + return { compiler, watch, watchOptions }; + }; + if (callback) { + try { + const { compiler, watch, watchOptions } = create(); + if (watch) { + compiler.watch(watchOptions, callback); + } else { + compiler.run((err, stats) => { + compiler.close(err2 => { + callback(err || err2, stats); + }); + }); } - newNodes.push(node); - lastNode = node; + return compiler; + } catch (err) { + process.nextTick(() => callback(err)); + return null; + } + } else { + const { compiler, watch } = create(); + if (watch) { + util.deprecate( + () => {}, + "A 'callback' argument needs to be provided to the 'webpack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.", + "DEP_WEBPACK_WATCH_WITHOUT_CALLBACK" + )(); } + return compiler; } - if (resultNodes.length === this.nodes.length) return undefined; - this.nodes = newNodes; - this.similarities = newSimilarities; - this.size = sumSize(newNodes); - return resultNodes; } -} +); -/** - * @param {Iterable} nodes nodes - * @returns {number[]} similarities - */ -const getSimilarities = nodes => { - // calculate similarities between lexically adjacent nodes - /** @type {number[]} */ - const similarities = []; - let last = undefined; - for (const node of nodes) { - if (last !== undefined) { - similarities.push(similarity(last.key, node.key)); - } - last = node; - } - return similarities; -}; +module.exports = webpack; -/** - * @template T - * @typedef {Object} GroupedItems - * @property {string} key - * @property {T[]} items - * @property {Record} size - */ -/** - * @template T - * @typedef {Object} Options - * @property {Record} maxSize maximum size of a group - * @property {Record} minSize minimum size of a group (preferred over maximum size) - * @property {Iterable} items a list of items - * @property {function(T): Record} getSize function to get size of an item - * @property {function(T): string} getKey function to get the key of an item - */ +/***/ }), -/** - * @template T - * @param {Options} options options object - * @returns {GroupedItems[]} grouped items - */ -module.exports = ({ maxSize, minSize, items, getSize, getKey }) => { - /** @type {Group[]} */ - const result = []; +/***/ 54182: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const nodes = Array.from( - items, - item => new Node(item, getKey(item), getSize(item)) - ); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** @type {Node[]} */ - const initialNodes = []; - // lexically ordering of keys - nodes.sort((a, b) => { - if (a.key < b.key) return -1; - if (a.key > b.key) return 1; - return 0; - }); - // return nodes bigger than maxSize directly as group - // But make sure that minSize is not violated - for (const node of nodes) { - if (isTooBig(node.size, maxSize) && !isTooSmall(node.size, minSize)) { - result.push(new Group([node], [])); - } else { - initialNodes.push(node); - } - } +const RuntimeGlobals = __webpack_require__(16475); +const StartupChunkDependenciesPlugin = __webpack_require__(22339); +const ImportScriptsChunkLoadingRuntimeModule = __webpack_require__(96952); - if (initialNodes.length > 0) { - const initialGroup = new Group(initialNodes, getSimilarities(initialNodes)); +/** @typedef {import("../Compiler")} Compiler */ - const removeProblematicNodes = (group, consideredSize = group.size) => { - const problemTypes = getTooSmallTypes(consideredSize, minSize); - if (problemTypes.size > 0) { - // We hit an edge case where the working set is already smaller than minSize - // We merge problematic nodes with the smallest result node to keep minSize intact - const problemNodes = group.popNodes( - n => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0 - ); - if (problemNodes === undefined) return false; - // Only merge it with result nodes that have the problematic size type - const possibleResultGroups = result.filter( - n => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0 - ); - if (possibleResultGroups.length > 0) { - const bestGroup = possibleResultGroups.reduce((min, group) => { - const minMatches = getNumberOfMatchingSizeTypes(min, problemTypes); - const groupMatches = getNumberOfMatchingSizeTypes( - group, - problemTypes - ); - if (minMatches !== groupMatches) - return minMatches < groupMatches ? group : min; - if ( - selectiveSizeSum(min.size, problemTypes) > - selectiveSizeSum(group.size, problemTypes) - ) - return group; - return min; +class ImportScriptsChunkLoadingPlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + new StartupChunkDependenciesPlugin({ + chunkLoading: "import-scripts", + asyncChunkLoading: true + }).apply(compiler); + compiler.hooks.thisCompilation.tap( + "ImportScriptsChunkLoadingPlugin", + compilation => { + const globalChunkLoading = compilation.outputOptions.chunkLoading; + const isEnabledForChunk = chunk => { + const options = chunk.getEntryOptions(); + const chunkLoading = + options && options.chunkLoading !== undefined + ? options.chunkLoading + : globalChunkLoading; + return chunkLoading === "import-scripts"; + }; + const onceForChunkSet = new WeakSet(); + const handler = (chunk, set) => { + if (onceForChunkSet.has(chunk)) return; + onceForChunkSet.add(chunk); + if (!isEnabledForChunk(chunk)) return; + const withCreateScriptUrl = !!compilation.outputOptions.trustedTypes; + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + set.add(RuntimeGlobals.hasOwnProperty); + if (withCreateScriptUrl) { + set.add(RuntimeGlobals.createScriptUrl); + } + compilation.addRuntimeModule( + chunk, + new ImportScriptsChunkLoadingRuntimeModule(set, withCreateScriptUrl) + ); + }; + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("ImportScriptsChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadUpdateHandlers) + .tap("ImportScriptsChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadManifest) + .tap("ImportScriptsChunkLoadingPlugin", handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.baseURI) + .tap("ImportScriptsChunkLoadingPlugin", handler); + + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.ensureChunkHandlers) + .tap("ImportScriptsChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.publicPath); + set.add(RuntimeGlobals.getChunkScriptFilename); }); - for (const node of problemNodes) bestGroup.nodes.push(node); - bestGroup.nodes.sort((a, b) => { - if (a.key < b.key) return -1; - if (a.key > b.key) return 1; - return 0; + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadUpdateHandlers) + .tap("ImportScriptsChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.publicPath); + set.add(RuntimeGlobals.getChunkUpdateScriptFilename); + set.add(RuntimeGlobals.moduleCache); + set.add(RuntimeGlobals.hmrModuleData); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadManifest) + .tap("ImportScriptsChunkLoadingPlugin", (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.publicPath); + set.add(RuntimeGlobals.getUpdateManifestFilename); }); - } else { - // There are no other nodes with the same size types - // We create a new group and have to accept that it's smaller than minSize - result.push(new Group(problemNodes, null)); - } - return true; - } else { - return false; } - }; + ); + } +} +module.exports = ImportScriptsChunkLoadingPlugin; - if (initialGroup.nodes.length > 0) { - const queue = [initialGroup]; - while (queue.length) { - const group = queue.pop(); - // only groups bigger than maxSize need to be splitted - if (!isTooBig(group.size, maxSize)) { - result.push(group); - continue; - } - // If the group is already too small - // we try to work only with the unproblematic nodes - if (removeProblematicNodes(group)) { - // This changed something, so we try this group again - queue.push(group); - continue; - } +/***/ }), - // find unsplittable area from left and right - // going minSize from left and right - // at least one node need to be included otherwise we get stuck - let left = 1; - let leftSize = Object.create(null); - addSizeTo(leftSize, group.nodes[0].size); - while (left < group.nodes.length && isTooSmall(leftSize, minSize)) { - addSizeTo(leftSize, group.nodes[left].size); - left++; - } - let right = group.nodes.length - 2; - let rightSize = Object.create(null); - addSizeTo(rightSize, group.nodes[group.nodes.length - 1].size); - while (right >= 0 && isTooSmall(rightSize, minSize)) { - addSizeTo(rightSize, group.nodes[right].size); - right--; - } +/***/ 96952: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // left v v right - // [ O O O ] O O O [ O O O ] - // ^^^^^^^^^ leftSize - // rightSize ^^^^^^^^^ - // leftSize > minSize - // rightSize > minSize +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ - // Perfect split: [ O O O ] [ O O O ] - // right === left - 1 - if (left - 1 > right) { - // We try to remove some problematic nodes to "fix" that - let prevSize; - if (right < group.nodes.length - left) { - subtractSizeFrom(rightSize, group.nodes[right + 1].size); - prevSize = rightSize; - } else { - subtractSizeFrom(leftSize, group.nodes[left - 1].size); - prevSize = leftSize; - } - if (removeProblematicNodes(group, prevSize)) { - // This changed something, so we try this group again - queue.push(group); - continue; - } - // can't split group while holding minSize - // because minSize is preferred of maxSize we return - // the problematic nodes as result here even while it's too big - // To avoid this make sure maxSize > minSize * 3 - result.push(group); - continue; - } - if (left <= right) { - // when there is a area between left and right - // we look for best split point - // we split at the minimum similarity - // here key space is separated the most - // But we also need to make sure to not create too small groups - let best = -1; - let bestSimilarity = Infinity; - let pos = left; - let rightSize = sumSize(group.nodes.slice(pos)); - // pos v v right - // [ O O O ] O O O [ O O O ] - // ^^^^^^^^^ leftSize - // rightSize ^^^^^^^^^^^^^^^ +const RuntimeGlobals = __webpack_require__(16475); +const RuntimeModule = __webpack_require__(16963); +const Template = __webpack_require__(1626); +const { + getChunkFilenameTemplate, + chunkHasJs +} = __webpack_require__(89464); +const { getInitialChunkIds } = __webpack_require__(98124); +const compileBooleanMatcher = __webpack_require__(29404); +const { getUndoPath } = __webpack_require__(82186); - while (pos <= right + 1) { - const similarity = group.similarities[pos - 1]; - if ( - similarity < bestSimilarity && - !isTooSmall(leftSize, minSize) && - !isTooSmall(rightSize, minSize) - ) { - best = pos; - bestSimilarity = similarity; - } - addSizeTo(leftSize, group.nodes[pos].size); - subtractSizeFrom(rightSize, group.nodes[pos].size); - pos++; - } - if (best < 0) { - // This can't happen - // but if that assumption is wrong - // fallback to a big group - result.push(group); - continue; - } - left = best; - right = best - 1; - } +class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule { + constructor(runtimeRequirements, withCreateScriptUrl) { + super("importScripts chunk loading", RuntimeModule.STAGE_ATTACH); + this.runtimeRequirements = runtimeRequirements; + this._withCreateScriptUrl = withCreateScriptUrl; + } - // create two new groups for left and right area - // and queue them up - const rightNodes = [group.nodes[right + 1]]; - /** @type {number[]} */ - const rightSimilarities = []; - for (let i = right + 2; i < group.nodes.length; i++) { - rightSimilarities.push(group.similarities[i - 1]); - rightNodes.push(group.nodes[i]); - } - queue.push(new Group(rightNodes, rightSimilarities)); + /** + * @returns {string} runtime code + */ + generate() { + const { + chunk, + chunkGraph, + compilation: { + runtimeTemplate, + outputOptions: { chunkLoadingGlobal, hotUpdateGlobal } + }, + _withCreateScriptUrl: withCreateScriptUrl + } = this; + const globalObject = runtimeTemplate.globalObject; + const fn = RuntimeGlobals.ensureChunkHandlers; + const withBaseURI = this.runtimeRequirements.has(RuntimeGlobals.baseURI); + const withLoading = this.runtimeRequirements.has( + RuntimeGlobals.ensureChunkHandlers + ); + const withHmr = this.runtimeRequirements.has( + RuntimeGlobals.hmrDownloadUpdateHandlers + ); + const withHmrManifest = this.runtimeRequirements.has( + RuntimeGlobals.hmrDownloadManifest + ); + const chunkLoadingGlobalExpr = `${globalObject}[${JSON.stringify( + chunkLoadingGlobal + )}]`; + const hasJsMatcher = compileBooleanMatcher( + chunkGraph.getChunkConditionMap(chunk, chunkHasJs) + ); + const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); - const leftNodes = [group.nodes[0]]; - /** @type {number[]} */ - const leftSimilarities = []; - for (let i = 1; i < left; i++) { - leftSimilarities.push(group.similarities[i - 1]); - leftNodes.push(group.nodes[i]); - } - queue.push(new Group(leftNodes, leftSimilarities)); + const outputName = this.compilation.getPath( + getChunkFilenameTemplate(chunk, this.compilation.outputOptions), + { + chunk, + contentHashType: "javascript" } - } - } + ); + const rootOutputDir = getUndoPath( + outputName, + this.compilation.outputOptions.path, + false + ); - // lexically ordering - result.sort((a, b) => { - if (a.nodes[0].key < b.nodes[0].key) return -1; - if (a.nodes[0].key > b.nodes[0].key) return 1; - return 0; - }); + const stateExpression = withHmr + ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_importScripts` + : undefined; - // give every group a name - const usedNames = new Set(); - for (let i = 0; i < result.length; i++) { - const group = result[i]; - if (group.nodes.length === 1) { - group.key = group.nodes[0].key; - } else { - const first = group.nodes[0]; - const last = group.nodes[group.nodes.length - 1]; - const name = getName(first.key, last.key, usedNames); - group.key = name; - } + return Template.asString([ + withBaseURI + ? Template.asString([ + `${RuntimeGlobals.baseURI} = self.location + ${JSON.stringify( + rootOutputDir ? "/../" + rootOutputDir : "" + )};` + ]) + : "// no baseURI", + "", + "// object to store loaded chunks", + '// "1" means "already loaded"', + `var installedChunks = ${ + stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" + }{`, + Template.indent( + Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 1`).join( + ",\n" + ) + ), + "};", + "", + withLoading + ? Template.asString([ + "// importScripts chunk loading", + `var installChunk = ${runtimeTemplate.basicFunction("data", [ + runtimeTemplate.destructureArray( + ["chunkIds", "moreModules", "runtime"], + "data" + ), + "for(var moduleId in moreModules) {", + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, + Template.indent( + `${RuntimeGlobals.moduleFactories}[moduleId] = moreModules[moduleId];` + ), + "}" + ]), + "}", + "if(runtime) runtime(__webpack_require__);", + "while(chunkIds.length)", + Template.indent("installedChunks[chunkIds.pop()] = 1;"), + "parentChunkLoadingFunction(data);" + ])};` + ]) + : "// no chunk install function needed", + withLoading + ? Template.asString([ + `${fn}.i = ${runtimeTemplate.basicFunction( + "chunkId, promises", + hasJsMatcher !== false + ? [ + '// "1" is the signal for "already loaded"', + "if(!installedChunks[chunkId]) {", + Template.indent([ + hasJsMatcher === true + ? "if(true) { // all chunks have JS" + : `if(${hasJsMatcher("chunkId")}) {`, + Template.indent( + `importScripts(${ + withCreateScriptUrl + ? `${RuntimeGlobals.createScriptUrl}(${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId))` + : `${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId)` + });` + ), + "}" + ]), + "}" + ] + : "installedChunks[chunkId] = 1;" + )};`, + "", + `var chunkLoadingGlobal = ${chunkLoadingGlobalExpr} = ${chunkLoadingGlobalExpr} || [];`, + "var parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);", + "chunkLoadingGlobal.push = installChunk;" + ]) + : "// no chunk loading", + "", + withHmr + ? Template.asString([ + "function loadUpdateChunk(chunkId, updatedModulesList) {", + Template.indent([ + "var success = false;", + `${globalObject}[${JSON.stringify( + hotUpdateGlobal + )}] = ${runtimeTemplate.basicFunction("_, moreModules, runtime", [ + "for(var moduleId in moreModules) {", + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, + Template.indent([ + "currentUpdate[moduleId] = moreModules[moduleId];", + "if(updatedModulesList) updatedModulesList.push(moduleId);" + ]), + "}" + ]), + "}", + "if(runtime) currentUpdateRuntime.push(runtime);", + "success = true;" + ])};`, + "// start update chunk loading", + `importScripts(${ + withCreateScriptUrl + ? `${RuntimeGlobals.createScriptUrl}(${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId))` + : `${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId)` + });`, + 'if(!success) throw new Error("Loading update chunk failed for unknown reason");' + ]), + "}", + "", + Template.getFunctionContent( + require('./JavascriptHotModuleReplacement.runtime.js') + ) + .replace(/\$key\$/g, "importScrips") + .replace(/\$installedChunks\$/g, "installedChunks") + .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") + .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) + .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) + .replace( + /\$ensureChunkHandlers\$/g, + RuntimeGlobals.ensureChunkHandlers + ) + .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) + .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) + .replace( + /\$hmrDownloadUpdateHandlers\$/g, + RuntimeGlobals.hmrDownloadUpdateHandlers + ) + .replace( + /\$hmrInvalidateModuleHandlers\$/g, + RuntimeGlobals.hmrInvalidateModuleHandlers + ) + ]) + : "// no HMR", + "", + withHmrManifest + ? Template.asString([ + `${ + RuntimeGlobals.hmrDownloadManifest + } = ${runtimeTemplate.basicFunction("", [ + 'if (typeof fetch === "undefined") throw new Error("No browser support: need fetch API");', + `return fetch(${RuntimeGlobals.publicPath} + ${ + RuntimeGlobals.getUpdateManifestFilename + }()).then(${runtimeTemplate.basicFunction("response", [ + "if(response.status === 404) return; // no update available", + 'if(!response.ok) throw new Error("Failed to fetch update manifest " + response.statusText);', + "return response.json();" + ])});` + ])};` + ]) + : "// no HMR manifest" + ]); } +} - // return the results - return result.map(group => { - /** @type {GroupedItems} */ - return { - key: group.key, - items: group.nodes.map(node => node.item), - size: group.size - }; - }); -}; +module.exports = ImportScriptsChunkLoadingRuntimeModule; /***/ }), -/***/ 11850: -/***/ (function(module) { +/***/ 68693: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Sam Chen @chenxsan + Author Tobias Koppers @sokra */ -/** - * @param {string} urlAndGlobal the script request - * @returns {string[]} script url and its global variable - */ -module.exports = function extractUrlAndGlobal(urlAndGlobal) { - const index = urlAndGlobal.indexOf("@"); - if (index <= 0 || index === urlAndGlobal.length - 1) { - throw new Error(`Invalid request "${urlAndGlobal}"`); +const ArrayPushCallbackChunkFormatPlugin = __webpack_require__(18535); +const EnableChunkLoadingPlugin = __webpack_require__(61291); + +/** @typedef {import("../Compiler")} Compiler */ + +class WebWorkerTemplatePlugin { + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + compiler.options.output.chunkLoading = "import-scripts"; + new ArrayPushCallbackChunkFormatPlugin().apply(compiler); + new EnableChunkLoadingPlugin("import-scripts").apply(compiler); } - return [urlAndGlobal.substring(index + 1), urlAndGlobal.substring(0, index)]; -}; +} +module.exports = WebWorkerTemplatePlugin; /***/ }), -/***/ 6261: -/***/ (function(module) { +/***/ 14819: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -133276,234 +133741,269 @@ module.exports = function extractUrlAndGlobal(urlAndGlobal) { -const NO_MARKER = 0; -const IN_PROGRESS_MARKER = 1; -const DONE_MARKER = 2; -const DONE_MAYBE_ROOT_CYCLE_MARKER = 3; -const DONE_AND_ROOT_MARKER = 4; +const DescriptionFileUtils = __webpack_require__(25424); +const getInnerRequest = __webpack_require__(47956); -/** - * @template T - */ -class Node { +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + +module.exports = class AliasFieldPlugin { /** - * @param {T} item the value of the node + * @param {string | ResolveStepHook} source source + * @param {string | Array} field field + * @param {string | ResolveStepHook} target target */ - constructor(item) { - this.item = item; - /** @type {Set>} */ - this.dependencies = new Set(); - this.marker = NO_MARKER; - /** @type {Cycle | undefined} */ - this.cycle = undefined; - this.incoming = 0; - } -} - -/** - * @template T - */ -class Cycle { - constructor() { - /** @type {Set>} */ - this.nodes = new Set(); + constructor(source, field, target) { + this.source = source; + this.field = field; + this.target = target; } -} -/** - * @template T - * @typedef {Object} StackEntry - * @property {Node} node - * @property {Node[]} openEdges - */ + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("AliasFieldPlugin", (request, resolveContext, callback) => { + if (!request.descriptionFileData) return callback(); + const innerRequest = getInnerRequest(resolver, request); + if (!innerRequest) return callback(); + const fieldData = DescriptionFileUtils.getField( + request.descriptionFileData, + this.field + ); + if (fieldData === null || typeof fieldData !== "object") { + if (resolveContext.log) + resolveContext.log( + "Field '" + + this.field + + "' doesn't contain a valid alias configuration" + ); + return callback(); + } + const data1 = fieldData[innerRequest]; + const data2 = fieldData[innerRequest.replace(/^\.\//, "")]; + const data = typeof data1 !== "undefined" ? data1 : data2; + if (data === innerRequest) return callback(); + if (data === undefined) return callback(); + if (data === false) { + /** @type {ResolveRequest} */ + const ignoreObj = { + ...request, + path: false + }; + return callback(null, ignoreObj); + } + const obj = { + ...request, + path: request.descriptionFileRoot, + request: data, + fullySpecified: false + }; + resolver.doResolve( + target, + obj, + "aliased from description file " + + request.descriptionFilePath + + " with mapping '" + + innerRequest + + "' to '" + + data + + "'", + resolveContext, + (err, result) => { + if (err) return callback(err); -/** - * @template T - * @param {Iterable} items list of items - * @param {function(T): Iterable} getDependencies function to get dependencies of an item (items that are not in list are ignored) - * @returns {Iterable} graph roots of the items - */ -module.exports = (items, getDependencies) => { - /** @type {Map>} */ - const itemToNode = new Map(); - for (const item of items) { - const node = new Node(item); - itemToNode.set(item, node); + // Don't allow other aliasing or raw request + if (result === undefined) return callback(null, null); + callback(null, result); + } + ); + }); } +}; - // early exit when there is only a single item - if (itemToNode.size <= 1) return items; - // grab all the dependencies - for (const node of itemToNode.values()) { - for (const dep of getDependencies(node.item)) { - const depNode = itemToNode.get(dep); - if (depNode !== undefined) { - node.dependencies.add(depNode); - } - } - } +/***/ }), - // Set of current root modules - // items will be removed if a new reference to it has been found - /** @type {Set>} */ - const roots = new Set(); +/***/ 63676: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // Set of current cycles without references to it - // cycles will be removed if a new reference to it has been found - // that is not part of the cycle - /** @type {Set>} */ - const rootCycles = new Set(); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // For all non-marked nodes - for (const selectedNode of itemToNode.values()) { - if (selectedNode.marker === NO_MARKER) { - // deep-walk all referenced modules - // in a non-recursive way - // start by entering the selected node - selectedNode.marker = IN_PROGRESS_MARKER; - // keep a stack to avoid recursive walk - /** @type {StackEntry[]} */ - const stack = [ - { - node: selectedNode, - openEdges: Array.from(selectedNode.dependencies) - } - ]; +const forEachBail = __webpack_require__(78565); - // process the top item until stack is empty - while (stack.length > 0) { - const topOfStack = stack[stack.length - 1]; +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +/** @typedef {{alias: string|Array|false, name: string, onlyModule?: boolean}} AliasOption */ - // Are there still edges unprocessed in the current node? - if (topOfStack.openEdges.length > 0) { - // Process one dependency - const dependency = topOfStack.openEdges.pop(); - switch (dependency.marker) { - case NO_MARKER: - // dependency has not be visited yet - // mark it as in-progress and recurse - stack.push({ - node: dependency, - openEdges: Array.from(dependency.dependencies) - }); - dependency.marker = IN_PROGRESS_MARKER; - break; - case IN_PROGRESS_MARKER: { - // It's a in-progress cycle - let cycle = dependency.cycle; - if (!cycle) { - cycle = new Cycle(); - cycle.nodes.add(dependency); - dependency.cycle = cycle; - } - // set cycle property for each node in the cycle - // if nodes are already part of a cycle - // we merge the cycles to a shared cycle - for ( - let i = stack.length - 1; - stack[i].node !== dependency; - i-- - ) { - const node = stack[i].node; - if (node.cycle) { - if (node.cycle !== cycle) { - // merge cycles - for (const cycleNode of node.cycle.nodes) { - cycleNode.cycle = cycle; - cycle.nodes.add(cycleNode); +module.exports = class AliasPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {AliasOption | Array} options options + * @param {string | ResolveStepHook} target target + */ + constructor(source, options, target) { + this.source = source; + this.options = Array.isArray(options) ? options : [options]; + this.target = target; + } + + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("AliasPlugin", (request, resolveContext, callback) => { + const innerRequest = request.request || request.path; + if (!innerRequest) return callback(); + forEachBail( + this.options, + (item, callback) => { + let shouldStop = false; + if ( + innerRequest === item.name || + (!item.onlyModule && innerRequest.startsWith(item.name + "/")) + ) { + const remainingRequest = innerRequest.substr(item.name.length); + const resolveWithAlias = (alias, callback) => { + if (alias === false) { + const ignoreObj = { + ...request, + path: false + }; + return callback(null, ignoreObj); + } + if ( + innerRequest !== alias && + !innerRequest.startsWith(alias + "/") + ) { + shouldStop = true; + const newRequestStr = alias + remainingRequest; + const obj = { + ...request, + request: newRequestStr, + fullySpecified: false + }; + return resolver.doResolve( + target, + obj, + "aliased with mapping '" + + item.name + + "': '" + + alias + + "' to '" + + newRequestStr + + "'", + resolveContext, + (err, result) => { + if (err) return callback(err); + if (result) return callback(null, result); + return callback(); } - } - } else { - node.cycle = cycle; - cycle.nodes.add(node); + ); } + return callback(); + }; + const stoppingCallback = (err, result) => { + if (err) return callback(err); + + if (result) return callback(null, result); + // Don't allow other aliasing or raw request + if (shouldStop) return callback(null, null); + return callback(); + }; + if (Array.isArray(item.alias)) { + return forEachBail( + item.alias, + resolveWithAlias, + stoppingCallback + ); + } else { + return resolveWithAlias(item.alias, stoppingCallback); } - // don't recurse into dependencies - // these are already on the stack - break; } - case DONE_AND_ROOT_MARKER: - // This node has be visited yet and is currently a root node - // But as this is a new reference to the node - // it's not really a root - // so we have to convert it to a normal node - dependency.marker = DONE_MARKER; - roots.delete(dependency); - break; - case DONE_MAYBE_ROOT_CYCLE_MARKER: - // This node has be visited yet and - // is maybe currently part of a completed root cycle - // we found a new reference to the cycle - // so it's not really a root cycle - // remove the cycle from the root cycles - // and convert it to a normal node - rootCycles.delete(dependency.cycle); - dependency.marker = DONE_MARKER; - break; - // DONE_MARKER: nothing to do, don't recurse into dependencies - } - } else { - // All dependencies of the current node has been visited - // we leave the node - stack.pop(); - topOfStack.node.marker = DONE_MARKER; - } - } - const cycle = selectedNode.cycle; - if (cycle) { - for (const node of cycle.nodes) { - node.marker = DONE_MAYBE_ROOT_CYCLE_MARKER; - } - rootCycles.add(cycle); - } else { - selectedNode.marker = DONE_AND_ROOT_MARKER; - roots.add(selectedNode); - } - } + return callback(); + }, + callback + ); + }); } +}; - // Extract roots from root cycles - // We take the nodes with most incoming edges - // inside of the cycle - for (const cycle of rootCycles) { - let max = 0; - /** @type {Set>} */ - const cycleRoots = new Set(); - const nodes = cycle.nodes; - for (const node of nodes) { - for (const dep of node.dependencies) { - if (nodes.has(dep)) { - dep.incoming++; - if (dep.incoming < max) continue; - if (dep.incoming > max) { - cycleRoots.clear(); - max = dep.incoming; - } - cycleRoots.add(dep); - } - } - } - for (const cycleRoot of cycleRoots) { - roots.add(cycleRoot); - } + +/***/ }), + +/***/ 92088: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + +module.exports = class AppendPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string} appending appending + * @param {string | ResolveStepHook} target target + */ + constructor(source, appending, target) { + this.source = source; + this.appending = appending; + this.target = target; } - // When roots were found, return them - if (roots.size > 0) { - return Array.from(roots, r => r.item); - } else { - throw new Error("Implementation of findGraphRoots is broken"); + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("AppendPlugin", (request, resolveContext, callback) => { + const obj = { + ...request, + path: request.path + this.appending, + relativePath: + request.relativePath && request.relativePath + this.appending + }; + resolver.doResolve( + target, + obj, + this.appending, + resolveContext, + callback + ); + }); } }; /***/ }), -/***/ 17139: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 52788: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -133513,417 +134013,481 @@ module.exports = (items, getDependencies) => { -const path = __webpack_require__(71017); +const nextTick = (__webpack_require__(77282).nextTick); -/** @typedef {import("../../declarations/WebpackOptions").WatchOptions} WatchOptions */ -/** @typedef {import("../FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */ +/** @typedef {import("./Resolver").FileSystem} FileSystem */ +/** @typedef {import("./Resolver").SyncFileSystem} SyncFileSystem */ -/** - * @typedef {Object} IStats - * @property {() => boolean} isFile - * @property {() => boolean} isDirectory - * @property {() => boolean} isBlockDevice - * @property {() => boolean} isCharacterDevice - * @property {() => boolean} isSymbolicLink - * @property {() => boolean} isFIFO - * @property {() => boolean} isSocket - * @property {number | bigint} dev - * @property {number | bigint} ino - * @property {number | bigint} mode - * @property {number | bigint} nlink - * @property {number | bigint} uid - * @property {number | bigint} gid - * @property {number | bigint} rdev - * @property {number | bigint} size - * @property {number | bigint} blksize - * @property {number | bigint} blocks - * @property {number | bigint} atimeMs - * @property {number | bigint} mtimeMs - * @property {number | bigint} ctimeMs - * @property {number | bigint} birthtimeMs - * @property {Date} atime - * @property {Date} mtime - * @property {Date} ctime - * @property {Date} birthtime - */ +const dirname = path => { + let idx = path.length - 1; + while (idx >= 0) { + const c = path.charCodeAt(idx); + // slash or backslash + if (c === 47 || c === 92) break; + idx--; + } + if (idx < 0) return ""; + return path.slice(0, idx); +}; -/** - * @typedef {Object} IDirent - * @property {() => boolean} isFile - * @property {() => boolean} isDirectory - * @property {() => boolean} isBlockDevice - * @property {() => boolean} isCharacterDevice - * @property {() => boolean} isSymbolicLink - * @property {() => boolean} isFIFO - * @property {() => boolean} isSocket - * @property {string | Buffer} name - */ +const runCallbacks = (callbacks, err, result) => { + if (callbacks.length === 1) { + callbacks[0](err, result); + callbacks.length = 0; + return; + } + let error; + for (const callback of callbacks) { + try { + callback(err, result); + } catch (e) { + if (!error) error = e; + } + } + callbacks.length = 0; + if (error) throw error; +}; -/** @typedef {function((NodeJS.ErrnoException | null)=): void} Callback */ -/** @typedef {function((NodeJS.ErrnoException | null)=, Buffer=): void} BufferCallback */ -/** @typedef {function((NodeJS.ErrnoException | null)=, Buffer|string=): void} BufferOrStringCallback */ -/** @typedef {function((NodeJS.ErrnoException | null)=, (string | Buffer)[] | IDirent[]=): void} DirentArrayCallback */ -/** @typedef {function((NodeJS.ErrnoException | null)=, string=): void} StringCallback */ -/** @typedef {function((NodeJS.ErrnoException | null)=, number=): void} NumberCallback */ -/** @typedef {function((NodeJS.ErrnoException | null)=, IStats=): void} StatsCallback */ -/** @typedef {function((NodeJS.ErrnoException | Error | null)=, any=): void} ReadJsonCallback */ -/** @typedef {function((NodeJS.ErrnoException | Error | null)=, IStats|string=): void} LstatReadlinkAbsoluteCallback */ +class OperationMergerBackend { + /** + * @param {any} provider async method + * @param {any} syncProvider sync method + * @param {any} providerContext call context for the provider methods + */ + constructor(provider, syncProvider, providerContext) { + this._provider = provider; + this._syncProvider = syncProvider; + this._providerContext = providerContext; + this._activeAsyncOperations = new Map(); -/** - * @typedef {Object} WatcherInfo - * @property {Set} changes get current aggregated changes that have not yet send to callback - * @property {Set} removals get current aggregated removals that have not yet send to callback - * @property {Map} fileTimeInfoEntries get info about files - * @property {Map} contextTimeInfoEntries get info about directories - */ + this.provide = this._provider + ? (path, options, callback) => { + if (typeof options === "function") { + callback = options; + options = undefined; + } + if (options) { + return this._provider.call( + this._providerContext, + path, + options, + callback + ); + } + if (typeof path !== "string") { + callback(new TypeError("path must be a string")); + return; + } + let callbacks = this._activeAsyncOperations.get(path); + if (callbacks) { + callbacks.push(callback); + return; + } + this._activeAsyncOperations.set(path, (callbacks = [callback])); + provider(path, (err, result) => { + this._activeAsyncOperations.delete(path); + runCallbacks(callbacks, err, result); + }); + } + : null; + this.provideSync = this._syncProvider + ? (path, options) => { + return this._syncProvider.call(this._providerContext, path, options); + } + : null; + } -// TODO webpack 6 deprecate missing getInfo -/** - * @typedef {Object} Watcher - * @property {function(): void} close closes the watcher and all underlying file watchers - * @property {function(): void} pause closes the watcher, but keeps underlying file watchers alive until the next watch call - * @property {function(): Set=} getAggregatedChanges get current aggregated changes that have not yet send to callback - * @property {function(): Set=} getAggregatedRemovals get current aggregated removals that have not yet send to callback - * @property {function(): Map} getFileTimeInfoEntries get info about files - * @property {function(): Map} getContextTimeInfoEntries get info about directories - * @property {function(): WatcherInfo=} getInfo get info about timestamps and changes - */ + purge() {} + purgeParent() {} +} -/** - * @callback WatchMethod - * @param {Iterable} files watched files - * @param {Iterable} directories watched directories - * @param {Iterable} missing watched exitance entries - * @param {number} startTime timestamp of start time - * @param {WatchOptions} options options object - * @param {function(Error=, Map, Map, Set, Set): void} callback aggregated callback - * @param {function(string, number): void} callbackUndelayed callback when the first change was detected - * @returns {Watcher} a watcher - */ +/* -// TODO webpack 6 make optional methods required +IDLE: + insert data: goto SYNC -/** - * @typedef {Object} OutputFileSystem - * @property {function(string, Buffer|string, Callback): void} writeFile - * @property {function(string, Callback): void} mkdir - * @property {function(string, DirentArrayCallback): void=} readdir - * @property {function(string, Callback): void=} rmdir - * @property {function(string, Callback): void=} unlink - * @property {function(string, StatsCallback): void} stat - * @property {function(string, StatsCallback): void=} lstat - * @property {function(string, BufferOrStringCallback): void} readFile - * @property {(function(string, string): string)=} join - * @property {(function(string, string): string)=} relative - * @property {(function(string): string)=} dirname - */ +SYNC: + before provide: run ticks + event loop tick: goto ASYNC_ACTIVE -/** - * @typedef {Object} InputFileSystem - * @property {function(string, BufferOrStringCallback): void} readFile - * @property {(function(string, ReadJsonCallback): void)=} readJson - * @property {function(string, BufferOrStringCallback): void} readlink - * @property {function(string, DirentArrayCallback): void} readdir - * @property {function(string, StatsCallback): void} stat - * @property {function(string, StatsCallback): void=} lstat - * @property {(function(string, BufferOrStringCallback): void)=} realpath - * @property {(function(string=): void)=} purge - * @property {(function(string, string): string)=} join - * @property {(function(string, string): string)=} relative - * @property {(function(string): string)=} dirname - */ +ASYNC: + timeout: run tick, goto ASYNC_PASSIVE -/** - * @typedef {Object} WatchFileSystem - * @property {WatchMethod} watch - */ +ASYNC_PASSIVE: + before provide: run ticks -/** - * @typedef {Object} IntermediateFileSystemExtras - * @property {function(string): void} mkdirSync - * @property {function(string): NodeJS.WritableStream} createWriteStream - * @property {function(string, string, NumberCallback): void} open - * @property {function(number, Buffer, number, number, number, NumberCallback): void} read - * @property {function(number, Callback): void} close - * @property {function(string, string, Callback): void} rename - */ +IDLE --[insert data]--> SYNC --[event loop tick]--> ASYNC_ACTIVE --[interval tick]-> ASYNC_PASSIVE + ^ | + +---------[insert data]-------+ +*/ -/** @typedef {InputFileSystem & OutputFileSystem & IntermediateFileSystemExtras} IntermediateFileSystem */ +const STORAGE_MODE_IDLE = 0; +const STORAGE_MODE_SYNC = 1; +const STORAGE_MODE_ASYNC = 2; -/** - * - * @param {InputFileSystem|OutputFileSystem|undefined} fs a file system - * @param {string} rootPath the root path - * @param {string} targetPath the target path - * @returns {string} location of targetPath relative to rootPath - */ -const relative = (fs, rootPath, targetPath) => { - if (fs && fs.relative) { - return fs.relative(rootPath, targetPath); - } else if (path.posix.isAbsolute(rootPath)) { - return path.posix.relative(rootPath, targetPath); - } else if (path.win32.isAbsolute(rootPath)) { - return path.win32.relative(rootPath, targetPath); - } else { - throw new Error( - `${rootPath} is neither a posix nor a windows path, and there is no 'relative' method defined in the file system` - ); +class CacheBackend { + /** + * @param {number} duration max cache duration of items + * @param {any} provider async method + * @param {any} syncProvider sync method + * @param {any} providerContext call context for the provider methods + */ + constructor(duration, provider, syncProvider, providerContext) { + this._duration = duration; + this._provider = provider; + this._syncProvider = syncProvider; + this._providerContext = providerContext; + /** @type {Map} */ + this._activeAsyncOperations = new Map(); + /** @type {Map }>} */ + this._data = new Map(); + /** @type {Set[]} */ + this._levels = []; + for (let i = 0; i < 10; i++) this._levels.push(new Set()); + for (let i = 5000; i < duration; i += 500) this._levels.push(new Set()); + this._currentLevel = 0; + this._tickInterval = Math.floor(duration / this._levels.length); + /** @type {STORAGE_MODE_IDLE | STORAGE_MODE_SYNC | STORAGE_MODE_ASYNC} */ + this._mode = STORAGE_MODE_IDLE; + + /** @type {NodeJS.Timeout | undefined} */ + this._timeout = undefined; + /** @type {number | undefined} */ + this._nextDecay = undefined; + + this.provide = provider ? this.provide.bind(this) : null; + this.provideSync = syncProvider ? this.provideSync.bind(this) : null; } -}; -exports.relative = relative; -/** - * @param {InputFileSystem|OutputFileSystem|undefined} fs a file system - * @param {string} rootPath a path - * @param {string} filename a filename - * @returns {string} the joined path - */ -const join = (fs, rootPath, filename) => { - if (fs && fs.join) { - return fs.join(rootPath, filename); - } else if (path.posix.isAbsolute(rootPath)) { - return path.posix.join(rootPath, filename); - } else if (path.win32.isAbsolute(rootPath)) { - return path.win32.join(rootPath, filename); - } else { - throw new Error( - `${rootPath} is neither a posix nor a windows path, and there is no 'join' method defined in the file system` - ); + provide(path, options, callback) { + if (typeof options === "function") { + callback = options; + options = undefined; + } + if (typeof path !== "string") { + callback(new TypeError("path must be a string")); + return; + } + if (options) { + return this._provider.call( + this._providerContext, + path, + options, + callback + ); + } + + // When in sync mode we can move to async mode + if (this._mode === STORAGE_MODE_SYNC) { + this._enterAsyncMode(); + } + + // Check in cache + let cacheEntry = this._data.get(path); + if (cacheEntry !== undefined) { + if (cacheEntry.err) return nextTick(callback, cacheEntry.err); + return nextTick(callback, null, cacheEntry.result); + } + + // Check if there is already the same operation running + let callbacks = this._activeAsyncOperations.get(path); + if (callbacks !== undefined) { + callbacks.push(callback); + return; + } + this._activeAsyncOperations.set(path, (callbacks = [callback])); + + // Run the operation + this._provider.call(this._providerContext, path, (err, result) => { + this._activeAsyncOperations.delete(path); + this._storeResult(path, err, result); + + // Enter async mode if not yet done + this._enterAsyncMode(); + + runCallbacks(callbacks, err, result); + }); } -}; -exports.join = join; -/** - * @param {InputFileSystem|OutputFileSystem|undefined} fs a file system - * @param {string} absPath an absolute path - * @returns {string} the parent directory of the absolute path - */ -const dirname = (fs, absPath) => { - if (fs && fs.dirname) { - return fs.dirname(absPath); - } else if (path.posix.isAbsolute(absPath)) { - return path.posix.dirname(absPath); - } else if (path.win32.isAbsolute(absPath)) { - return path.win32.dirname(absPath); - } else { - throw new Error( - `${absPath} is neither a posix nor a windows path, and there is no 'dirname' method defined in the file system` - ); + provideSync(path, options) { + if (typeof path !== "string") { + throw new TypeError("path must be a string"); + } + if (options) { + return this._syncProvider.call(this._providerContext, path, options); + } + + // In sync mode we may have to decay some cache items + if (this._mode === STORAGE_MODE_SYNC) { + this._runDecays(); + } + + // Check in cache + let cacheEntry = this._data.get(path); + if (cacheEntry !== undefined) { + if (cacheEntry.err) throw cacheEntry.err; + return cacheEntry.result; + } + + // Get all active async operations + // This sync operation will also complete them + const callbacks = this._activeAsyncOperations.get(path); + this._activeAsyncOperations.delete(path); + + // Run the operation + // When in idle mode, we will enter sync mode + let result; + try { + result = this._syncProvider.call(this._providerContext, path); + } catch (err) { + this._storeResult(path, err, undefined); + this._enterSyncModeWhenIdle(); + if (callbacks) runCallbacks(callbacks, err, undefined); + throw err; + } + this._storeResult(path, undefined, result); + this._enterSyncModeWhenIdle(); + if (callbacks) runCallbacks(callbacks, undefined, result); + return result; } -}; -exports.dirname = dirname; -/** - * @param {OutputFileSystem} fs a file system - * @param {string} p an absolute path - * @param {function(Error=): void} callback callback function for the error - * @returns {void} - */ -const mkdirp = (fs, p, callback) => { - fs.mkdir(p, err => { - if (err) { - if (err.code === "ENOENT") { - const dir = dirname(fs, p); - if (dir === p) { - callback(err); - return; + purge(what) { + if (!what) { + if (this._mode !== STORAGE_MODE_IDLE) { + this._data.clear(); + for (const level of this._levels) { + level.clear(); } - mkdirp(fs, dir, err => { - if (err) { - callback(err); - return; - } - fs.mkdir(p, err => { - if (err) { - if (err.code === "EEXIST") { - callback(); - return; - } - callback(err); - return; - } - callback(); - }); - }); - return; - } else if (err.code === "EEXIST") { - callback(); - return; + this._enterIdleMode(); } - callback(err); - return; - } - callback(); - }); -}; -exports.mkdirp = mkdirp; - -/** - * @param {IntermediateFileSystem} fs a file system - * @param {string} p an absolute path - * @returns {void} - */ -const mkdirpSync = (fs, p) => { - try { - fs.mkdirSync(p); - } catch (err) { - if (err) { - if (err.code === "ENOENT") { - const dir = dirname(fs, p); - if (dir === p) { - throw err; + } else if (typeof what === "string") { + for (let [key, data] of this._data) { + if (key.startsWith(what)) { + this._data.delete(key); + data.level.delete(key); + } + } + if (this._data.size === 0) { + this._enterIdleMode(); + } + } else { + for (let [key, data] of this._data) { + for (const item of what) { + if (key.startsWith(item)) { + this._data.delete(key); + data.level.delete(key); + break; + } } - mkdirpSync(fs, dir); - fs.mkdirSync(p); - return; - } else if (err.code === "EEXIST") { - return; } - throw err; + if (this._data.size === 0) { + this._enterIdleMode(); + } } } -}; -exports.mkdirpSync = mkdirpSync; -/** - * @param {InputFileSystem} fs a file system - * @param {string} p an absolute path - * @param {ReadJsonCallback} callback callback - * @returns {void} - */ -const readJson = (fs, p, callback) => { - if ("readJson" in fs) return fs.readJson(p, callback); - fs.readFile(p, (err, buf) => { - if (err) return callback(err); - let data; - try { - data = JSON.parse(buf.toString("utf-8")); - } catch (e) { - return callback(e); + purgeParent(what) { + if (!what) { + this.purge(); + } else if (typeof what === "string") { + this.purge(dirname(what)); + } else { + const set = new Set(); + for (const item of what) { + set.add(dirname(item)); + } + this.purge(set); } - return callback(null, data); - }); -}; -exports.readJson = readJson; + } -/** - * @param {InputFileSystem} fs a file system - * @param {string} p an absolute path - * @param {ReadJsonCallback} callback callback - * @returns {void} - */ -const lstatReadlinkAbsolute = (fs, p, callback) => { - let i = 3; - const doReadLink = () => { - fs.readlink(p, (err, target) => { - if (err && --i > 0) { - // It might was just changed from symlink to file - // we retry 2 times to catch this case before throwing the error - return doStat(); - } - if (err || !target) return doStat(); - const value = target.toString(); - callback(null, join(fs, dirname(fs, p), value)); - }); - }; - const doStat = () => { - if ("lstat" in fs) { - return fs.lstat(p, (err, stats) => { - if (err) return callback(err); - if (stats.isSymbolicLink()) { - return doReadLink(); - } - callback(null, stats); - }); + _storeResult(path, err, result) { + if (this._data.has(path)) return; + const level = this._levels[this._currentLevel]; + this._data.set(path, { err, result, level }); + level.add(path); + } + + _decayLevel() { + const nextLevel = (this._currentLevel + 1) % this._levels.length; + const decay = this._levels[nextLevel]; + this._currentLevel = nextLevel; + for (let item of decay) { + this._data.delete(item); + } + decay.clear(); + if (this._data.size === 0) { + this._enterIdleMode(); } else { - return fs.stat(p, callback); + // @ts-ignore _nextDecay is always a number in sync mode + this._nextDecay += this._tickInterval; } - }; - if ("lstat" in fs) return doStat(); - doReadLink(); -}; -exports.lstatReadlinkAbsolute = lstatReadlinkAbsolute; + } + _runDecays() { + while ( + /** @type {number} */ (this._nextDecay) <= Date.now() && + this._mode !== STORAGE_MODE_IDLE + ) { + this._decayLevel(); + } + } -/***/ }), + _enterAsyncMode() { + let timeout = 0; + switch (this._mode) { + case STORAGE_MODE_ASYNC: + return; + case STORAGE_MODE_IDLE: + this._nextDecay = Date.now() + this._tickInterval; + timeout = this._tickInterval; + break; + case STORAGE_MODE_SYNC: + this._runDecays(); + // @ts-ignore _runDecays may change the mode + if (this._mode === STORAGE_MODE_IDLE) return; + timeout = Math.max( + 0, + /** @type {number} */ (this._nextDecay) - Date.now() + ); + break; + } + this._mode = STORAGE_MODE_ASYNC; + const ref = setTimeout(() => { + this._mode = STORAGE_MODE_SYNC; + this._runDecays(); + }, timeout); + if (ref.unref) ref.unref(); + this._timeout = ref; + } -/***/ 59461: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + _enterSyncModeWhenIdle() { + if (this._mode === STORAGE_MODE_IDLE) { + this._mode = STORAGE_MODE_SYNC; + this._nextDecay = Date.now() + this._tickInterval; + } + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + _enterIdleMode() { + this._mode = STORAGE_MODE_IDLE; + this._nextDecay = undefined; + if (this._timeout) clearTimeout(this._timeout); + } +} +const createBackend = (duration, provider, syncProvider, providerContext) => { + if (duration > 0) { + return new CacheBackend(duration, provider, syncProvider, providerContext); + } + return new OperationMergerBackend(provider, syncProvider, providerContext); +}; +module.exports = class CachedInputFileSystem { + constructor(fileSystem, duration) { + this.fileSystem = fileSystem; -const Hash = __webpack_require__(36692); -const MAX_SHORT_STRING = (__webpack_require__(1842).MAX_SHORT_STRING); + this._lstatBackend = createBackend( + duration, + this.fileSystem.lstat, + this.fileSystem.lstatSync, + this.fileSystem + ); + const lstat = this._lstatBackend.provide; + this.lstat = /** @type {FileSystem["lstat"]} */ (lstat); + const lstatSync = this._lstatBackend.provideSync; + this.lstatSync = /** @type {SyncFileSystem["lstatSync"]} */ (lstatSync); -class BatchedHash extends Hash { - constructor(hash) { - super(); - this.string = undefined; - this.encoding = undefined; - this.hash = hash; - } + this._statBackend = createBackend( + duration, + this.fileSystem.stat, + this.fileSystem.statSync, + this.fileSystem + ); + const stat = this._statBackend.provide; + this.stat = /** @type {FileSystem["stat"]} */ (stat); + const statSync = this._statBackend.provideSync; + this.statSync = /** @type {SyncFileSystem["statSync"]} */ (statSync); - /** - * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} - * @param {string|Buffer} data data - * @param {string=} inputEncoding data encoding - * @returns {this} updated hash - */ - update(data, inputEncoding) { - if (this.string !== undefined) { - if ( - typeof data === "string" && - inputEncoding === this.encoding && - this.string.length + data.length < MAX_SHORT_STRING - ) { - this.string += data; - return this; - } - this.hash.update(this.string, this.encoding); - this.string = undefined; - } - if (typeof data === "string") { - if ( - data.length < MAX_SHORT_STRING && - // base64 encoding is not valid since it may contain padding chars - (!inputEncoding || !inputEncoding.startsWith("ba")) - ) { - this.string = data; - this.encoding = inputEncoding; - } else { - this.hash.update(data, inputEncoding); - } - } else { - this.hash.update(data); - } - return this; - } + this._readdirBackend = createBackend( + duration, + this.fileSystem.readdir, + this.fileSystem.readdirSync, + this.fileSystem + ); + const readdir = this._readdirBackend.provide; + this.readdir = /** @type {FileSystem["readdir"]} */ (readdir); + const readdirSync = this._readdirBackend.provideSync; + this.readdirSync = /** @type {SyncFileSystem["readdirSync"]} */ (readdirSync); - /** - * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} - * @param {string=} encoding encoding of the return value - * @returns {string|Buffer} digest - */ - digest(encoding) { - if (this.string !== undefined) { - this.hash.update(this.string, this.encoding); - } - return this.hash.digest(encoding); + this._readFileBackend = createBackend( + duration, + this.fileSystem.readFile, + this.fileSystem.readFileSync, + this.fileSystem + ); + const readFile = this._readFileBackend.provide; + this.readFile = /** @type {FileSystem["readFile"]} */ (readFile); + const readFileSync = this._readFileBackend.provideSync; + this.readFileSync = /** @type {SyncFileSystem["readFileSync"]} */ (readFileSync); + + this._readJsonBackend = createBackend( + duration, + this.fileSystem.readJson || + (this.readFile && + ((path, callback) => { + // @ts-ignore + this.readFile(path, (err, buffer) => { + if (err) return callback(err); + if (!buffer || buffer.length === 0) + return callback(new Error("No file content")); + let data; + try { + data = JSON.parse(buffer.toString("utf-8")); + } catch (e) { + return callback(e); + } + callback(null, data); + }); + })), + this.fileSystem.readJsonSync || + (this.readFileSync && + (path => { + const buffer = this.readFileSync(path); + const data = JSON.parse(buffer.toString("utf-8")); + return data; + })), + this.fileSystem + ); + const readJson = this._readJsonBackend.provide; + this.readJson = /** @type {FileSystem["readJson"]} */ (readJson); + const readJsonSync = this._readJsonBackend.provideSync; + this.readJsonSync = /** @type {SyncFileSystem["readJsonSync"]} */ (readJsonSync); + + this._readlinkBackend = createBackend( + duration, + this.fileSystem.readlink, + this.fileSystem.readlinkSync, + this.fileSystem + ); + const readlink = this._readlinkBackend.provide; + this.readlink = /** @type {FileSystem["readlink"]} */ (readlink); + const readlinkSync = this._readlinkBackend.provideSync; + this.readlinkSync = /** @type {SyncFileSystem["readlinkSync"]} */ (readlinkSync); } -} -module.exports = BatchedHash; + purge(what) { + this._statBackend.purge(what); + this._lstatBackend.purge(what); + this._readdirBackend.purgeParent(what); + this._readFileBackend.purge(what); + this._readlinkBackend.purge(what); + this._readJsonBackend.purge(what); + } +}; /***/ }), -/***/ 86884: +/***/ 22254: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -133934,24 +134498,49 @@ module.exports = BatchedHash; -const create = __webpack_require__(1842); +const basename = (__webpack_require__(82918).basename); -//#region wasm code: md4 (../../../assembly/hash/md4.asm.ts) --initialMemory 1 -const md4 = new WebAssembly.Module( - Buffer.from( - // 2156 bytes - "AGFzbQEAAAABCAJgAX8AYAAAAwUEAQAAAAUDAQABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwciBARpbml0AAAGdXBkYXRlAAIFZmluYWwAAwZtZW1vcnkCAAqLEAQmAEGBxpS6BiQBQYnXtv5+JAJB/rnrxXkkA0H2qMmBASQEQQAkAAvSCgEZfyMBIQUjAiECIwMhAyMEIQQDQCAAIAFLBEAgASgCJCISIAEoAiAiEyABKAIcIgkgASgCGCIIIAEoAhQiByABKAIQIg4gASgCDCIGIAEoAggiDyABKAIEIhAgASgCACIRIAMgBHMgAnEgBHMgBWpqQQN3IgogAiADc3EgA3MgBGpqQQd3IgsgAiAKc3EgAnMgA2pqQQt3IgwgCiALc3EgCnMgAmpqQRN3Ig0gCyAMc3EgC3MgCmpqQQN3IgogDCANc3EgDHMgC2pqQQd3IgsgCiANc3EgDXMgDGpqQQt3IgwgCiALc3EgCnMgDWpqQRN3Ig0gCyAMc3EgC3MgCmpqQQN3IhQgDCANc3EgDHMgC2pqQQd3IRUgASgCLCILIAEoAigiCiAMIA0gDSAUcyAVcXNqakELdyIWIBQgFXNxIBRzIA1qakETdyEXIAEoAjQiGCABKAIwIhkgFSAWcyAXcSAVcyAUampBA3ciFCAWIBdzcSAWcyAVampBB3chFSABKAI8Ig0gASgCOCIMIBQgF3MgFXEgF3MgFmpqQQt3IhYgFCAVc3EgFHMgF2pqQRN3IRcgEyAOIBEgFCAVIBZyIBdxIBUgFnFyampBmfOJ1AVqQQN3IhQgFiAXcnEgFiAXcXIgFWpqQZnzidQFakEFdyIVIBQgF3JxIBQgF3FyIBZqakGZ84nUBWpBCXchFiAPIBggEiAWIAcgFSAQIBQgGSAUIBVyIBZxIBQgFXFyIBdqakGZ84nUBWpBDXciFCAVIBZycSAVIBZxcmpqQZnzidQFakEDdyIVIBQgFnJxIBQgFnFyampBmfOJ1AVqQQV3IhcgFCAVcnEgFCAVcXJqakGZ84nUBWpBCXciFiAVIBdycSAVIBdxciAUampBmfOJ1AVqQQ13IhQgFiAXcnEgFiAXcXIgFWpqQZnzidQFakEDdyEVIBEgBiAVIAwgFCAKIBYgCCAUIBZyIBVxIBQgFnFyIBdqakGZ84nUBWpBBXciFyAUIBVycSAUIBVxcmpqQZnzidQFakEJdyIWIBUgF3JxIBUgF3FyampBmfOJ1AVqQQ13IhQgFiAXcnEgFiAXcXJqakGZ84nUBWpBA3ciFSALIBYgCSAUIBZyIBVxIBQgFnFyIBdqakGZ84nUBWpBBXciFiAUIBVycSAUIBVxcmpqQZnzidQFakEJdyIXIA0gFSAWciAXcSAVIBZxciAUampBmfOJ1AVqQQ13IhRzIBZzampBodfn9gZqQQN3IREgByAIIA4gFCARIBcgESAUc3MgFmogE2pBodfn9gZqQQl3IhNzcyAXampBodfn9gZqQQt3Ig4gDyARIBMgDiARIA4gE3NzIBRqIBlqQaHX5/YGakEPdyIRc3NqakGh1+f2BmpBA3ciDyAOIA8gEXNzIBNqIApqQaHX5/YGakEJdyIKcyARc2pqQaHX5/YGakELdyIIIBAgDyAKIAggDCAPIAggCnNzIBFqakGh1+f2BmpBD3ciDHNzampBodfn9gZqQQN3Ig4gEiAIIAwgDnNzIApqakGh1+f2BmpBCXciCHMgDHNqakGh1+f2BmpBC3chByAFIAYgCCAHIBggDiAHIAhzcyAMampBodfn9gZqQQ93IgpzcyAOampBodfn9gZqQQN3IgZqIQUgDSAGIAkgByAGIAsgByAGIApzcyAIampBodfn9gZqQQl3IgdzIApzampBodfn9gZqQQt3IgYgB3NzIApqakGh1+f2BmpBD3cgAmohAiADIAZqIQMgBCAHaiEEIAFBQGshAQwBCwsgBSQBIAIkAiADJAMgBCQECw0AIAAQASAAIwBqJAAL/wQCA38BfiAAIwBqrUIDhiEEIABByABqQUBxIgJBCGshAyAAIgFBAWohACABQYABOgAAA0AgACACSUEAIABBB3EbBEAgAEEAOgAAIABBAWohAAwBCwsDQCAAIAJJBEAgAEIANwMAIABBCGohAAwBCwsgAyAENwMAIAIQAUEAIwGtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEIIwKtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEQIwOtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEYIwStIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAAs=", - "base64" - ) -); -//#endregion +/** @typedef {import("./Resolver")} Resolver */ -module.exports = create.bind(null, md4, [], 64, 32); +module.exports = class CloneBasenamePlugin { + constructor(source, target) { + this.source = source; + this.target = target; + } + + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("CloneBasenamePlugin", (request, resolveContext, callback) => { + const filename = basename(request.path); + const filePath = resolver.join(request.path, filename); + const obj = { + ...request, + path: filePath, + relativePath: + request.relativePath && + resolver.join(request.relativePath, filename) + }; + resolver.doResolve( + target, + obj, + "using path: " + filePath, + resolveContext, + callback + ); + }); + } +}; /***/ }), -/***/ 1842: +/***/ 6953: /***/ (function(module) { "use strict"; @@ -133962,167 +134551,63 @@ module.exports = create.bind(null, md4, [], 64, 32); -// 65536 is the size of a wasm memory page -// 64 is the maximum chunk size for every possible wasm hash implementation -// 4 is the maximum number of bytes per char for string encoding (max is utf-8) -// ~3 makes sure that it's always a block of 4 chars, so avoid partially encoded bytes for base64 -const MAX_SHORT_STRING = Math.floor((65536 - 64) / 4) & ~3; - -class WasmHash { - /** - * @param {WebAssembly.Instance} instance wasm instance - * @param {WebAssembly.Instance[]} instancesPool pool of instances - * @param {number} chunkSize size of data chunks passed to wasm - * @param {number} digestSize size of digest returned by wasm - */ - constructor(instance, instancesPool, chunkSize, digestSize) { - const exports = /** @type {any} */ (instance.exports); - exports.init(); - this.exports = exports; - this.mem = Buffer.from(exports.memory.buffer, 0, 65536); - this.buffered = 0; - this.instancesPool = instancesPool; - this.chunkSize = chunkSize; - this.digestSize = digestSize; - } - - reset() { - this.buffered = 0; - this.exports.init(); - } - - /** - * @param {Buffer | string} data data - * @param {BufferEncoding=} encoding encoding - * @returns {this} itself - */ - update(data, encoding) { - if (typeof data === "string") { - while (data.length > MAX_SHORT_STRING) { - this._updateWithShortString(data.slice(0, MAX_SHORT_STRING), encoding); - data = data.slice(MAX_SHORT_STRING); - } - this._updateWithShortString(data, encoding); - return this; - } - this._updateWithBuffer(data); - return this; - } +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +module.exports = class ConditionalPlugin { /** - * @param {string} data data - * @param {BufferEncoding=} encoding encoding - * @returns {void} + * @param {string | ResolveStepHook} source source + * @param {Partial} test compare object + * @param {string | null} message log message + * @param {boolean} allowAlternatives when false, do not continue with the current step when "test" matches + * @param {string | ResolveStepHook} target target */ - _updateWithShortString(data, encoding) { - const { exports, buffered, mem, chunkSize } = this; - let endPos; - if (data.length < 70) { - if (!encoding || encoding === "utf-8" || encoding === "utf8") { - endPos = buffered; - for (let i = 0; i < data.length; i++) { - const cc = data.charCodeAt(i); - if (cc < 0x80) mem[endPos++] = cc; - else if (cc < 0x800) { - mem[endPos] = (cc >> 6) | 0xc0; - mem[endPos + 1] = (cc & 0x3f) | 0x80; - endPos += 2; - } else { - // bail-out for weird chars - endPos += mem.write(data.slice(i), endPos, encoding); - break; - } - } - } else if (encoding === "latin1") { - endPos = buffered; - for (let i = 0; i < data.length; i++) { - const cc = data.charCodeAt(i); - mem[endPos++] = cc; - } - } else { - endPos = buffered + mem.write(data, buffered, encoding); - } - } else { - endPos = buffered + mem.write(data, buffered, encoding); - } - if (endPos < chunkSize) { - this.buffered = endPos; - } else { - const l = endPos & ~(this.chunkSize - 1); - exports.update(l); - const newBuffered = endPos - l; - this.buffered = newBuffered; - if (newBuffered > 0) mem.copyWithin(0, l, endPos); - } + constructor(source, test, message, allowAlternatives, target) { + this.source = source; + this.test = test; + this.message = message; + this.allowAlternatives = allowAlternatives; + this.target = target; } /** - * @param {Buffer} data data + * @param {Resolver} resolver the resolver * @returns {void} */ - _updateWithBuffer(data) { - const { exports, buffered, mem } = this; - const length = data.length; - if (buffered + length < this.chunkSize) { - data.copy(mem, buffered, 0, length); - this.buffered += length; - } else { - const l = (buffered + length) & ~(this.chunkSize - 1); - if (l > 65536) { - let i = 65536 - buffered; - data.copy(mem, buffered, 0, i); - exports.update(65536); - const stop = l - buffered - 65536; - while (i < stop) { - data.copy(mem, 0, i, i + 65536); - exports.update(65536); - i += 65536; - } - data.copy(mem, 0, i, l - buffered); - exports.update(l - buffered - i); - } else { - data.copy(mem, buffered, 0, l - buffered); - exports.update(l); - } - const newBuffered = length + buffered - l; - this.buffered = newBuffered; - if (newBuffered > 0) data.copy(mem, 0, length - newBuffered, length); - } - } - - digest(type) { - const { exports, buffered, mem, digestSize } = this; - exports.final(buffered); - this.instancesPool.push(this); - const hex = mem.toString("latin1", 0, digestSize); - if (type === "hex") return hex; - if (type === "binary" || !type) return Buffer.from(hex, "hex"); - return Buffer.from(hex, "hex").toString(type); - } -} + apply(resolver) { + const target = resolver.ensureHook(this.target); + const { test, message, allowAlternatives } = this; + const keys = Object.keys(test); + resolver + .getHook(this.source) + .tapAsync("ConditionalPlugin", (request, resolveContext, callback) => { + for (const prop of keys) { + if (request[prop] !== test[prop]) return callback(); + } + resolver.doResolve( + target, + request, + message, + resolveContext, + allowAlternatives + ? callback + : (err, result) => { + if (err) return callback(err); -const create = (wasmModule, instancesPool, chunkSize, digestSize) => { - if (instancesPool.length > 0) { - const old = instancesPool.pop(); - old.reset(); - return old; - } else { - return new WasmHash( - new WebAssembly.Instance(wasmModule), - instancesPool, - chunkSize, - digestSize - ); + // Don't allow other alternatives + if (result === undefined) return callback(null, null); + callback(null, result); + } + ); + }); } }; -module.exports = create; -module.exports.MAX_SHORT_STRING = MAX_SHORT_STRING; - /***/ }), -/***/ 35028: +/***/ 44112: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -134133,410 +134618,507 @@ module.exports.MAX_SHORT_STRING = MAX_SHORT_STRING; -const create = __webpack_require__(1842); +const DescriptionFileUtils = __webpack_require__(25424); -//#region wasm code: xxhash64 (../../../assembly/hash/xxhash64.asm.ts) --initialMemory 1 -const xxhash64 = new WebAssembly.Module( - Buffer.from( - // 1170 bytes - "AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrIIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEEIAUgASkDGELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEFIAAgAUEgaiIBSw0ACyACJAAgAyQBIAQkAiAFJAMLqAYCAX8EfiMEQgBSBH4jACICQgGJIwEiA0IHiXwjAiIEQgyJfCMDIgVCEol8IAJCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0gA0LP1tO+0ser2UJ+Qh+JQoeVr6+Ytt6bnn9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSAEQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IAVCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0FQsXP2bLx5brqJwsjBCAArXx8IQIDQCABQQhqIABNBEAgAiABKQMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQIgAUEIaiEBDAELCyABQQRqIABNBEAgAiABNQIAQoeVr6+Ytt6bnn9+hUIXiULP1tO+0ser2UJ+Qvnz3fGZ9pmrFnwhAiABQQRqIQELA0AgACABRwRAIAIgATEAAELFz9my8eW66id+hUILiUKHla+vmLbem55/fiECIAFBAWohAQwBCwtBACACIAJCIYiFQs/W077Sx6vZQn4iAkIdiCAChUL5893xmfaZqxZ+IgJCIIggAoUiAkIgiCIDQv//A4NCIIYgA0KAgPz/D4NCEIiEIgNC/4GAgPAfg0IQhiADQoD+g4CA4D+DQgiIhCIDQo+AvIDwgcAHg0IIhiADQvCBwIeAnoD4AINCBIiEIgNChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IANCsODAgYOGjJgwhHw3AwBBCCACQv////8PgyICQv//A4NCIIYgAkKAgPz/D4NCEIiEIgJC/4GAgPAfg0IQhiACQoD+g4CA4D+DQgiIhCICQo+AvIDwgcAHg0IIhiACQvCBwIeAnoD4AINCBIiEIgJChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IAJCsODAgYOGjJgwhHw3AwAL", - "base64" - ) -); -//#endregion +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -module.exports = create.bind(null, xxhash64, [], 32, 16); +module.exports = class DescriptionFilePlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string[]} filenames filenames + * @param {boolean} pathIsFile pathIsFile + * @param {string | ResolveStepHook} target target + */ + constructor(source, filenames, pathIsFile, target) { + this.source = source; + this.filenames = filenames; + this.pathIsFile = pathIsFile; + this.target = target; + } + + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync( + "DescriptionFilePlugin", + (request, resolveContext, callback) => { + const path = request.path; + if (!path) return callback(); + const directory = this.pathIsFile + ? DescriptionFileUtils.cdUp(path) + : path; + if (!directory) return callback(); + DescriptionFileUtils.loadDescriptionFile( + resolver, + directory, + this.filenames, + request.descriptionFilePath + ? { + path: request.descriptionFilePath, + content: request.descriptionFileData, + directory: /** @type {string} */ (request.descriptionFileRoot) + } + : undefined, + resolveContext, + (err, result) => { + if (err) return callback(err); + if (!result) { + if (resolveContext.log) + resolveContext.log( + `No description file found in ${directory} or above` + ); + return callback(); + } + const relativePath = + "." + path.substr(result.directory.length).replace(/\\/g, "/"); + const obj = { + ...request, + descriptionFilePath: result.path, + descriptionFileData: result.content, + descriptionFileRoot: result.directory, + relativePath: relativePath + }; + resolver.doResolve( + target, + obj, + "using description file: " + + result.path + + " (relative path: " + + relativePath + + ")", + resolveContext, + (err, result) => { + if (err) return callback(err); + + // Don't allow other processing + if (result === undefined) return callback(null, null); + callback(null, result); + } + ); + } + ); + } + ); + } +}; /***/ }), -/***/ 82186: +/***/ 25424: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const path = __webpack_require__(71017); +const forEachBail = __webpack_require__(78565); -const WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/; -const SEGMENTS_SPLIT_REGEXP = /([|!])/; -const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g; +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveContext} ResolveContext */ /** - * @typedef {Object} MakeRelativePathsCache - * @property {Map>=} relativePaths + * @typedef {Object} DescriptionFileInfo + * @property {any=} content + * @property {string} path + * @property {string} directory */ -const relativePathToRequest = relativePath => { - if (relativePath === "") return "./."; - if (relativePath === "..") return "../."; - if (relativePath.startsWith("../")) return relativePath; - return `./${relativePath}`; -}; +/** + * @callback ErrorFirstCallback + * @param {Error|null=} error + * @param {DescriptionFileInfo=} result + */ /** - * @param {string} context context for relative path - * @param {string} maybeAbsolutePath path to make relative - * @returns {string} relative path in request style + * @param {Resolver} resolver resolver + * @param {string} directory directory + * @param {string[]} filenames filenames + * @param {DescriptionFileInfo|undefined} oldInfo oldInfo + * @param {ResolveContext} resolveContext resolveContext + * @param {ErrorFirstCallback} callback callback */ -const absoluteToRequest = (context, maybeAbsolutePath) => { - if (maybeAbsolutePath[0] === "/") { - if ( - maybeAbsolutePath.length > 1 && - maybeAbsolutePath[maybeAbsolutePath.length - 1] === "/" - ) { - // this 'path' is actually a regexp generated by dynamic requires. - // Don't treat it as an absolute path. - return maybeAbsolutePath; +function loadDescriptionFile( + resolver, + directory, + filenames, + oldInfo, + resolveContext, + callback +) { + (function findDescriptionFile() { + if (oldInfo && oldInfo.directory === directory) { + // We already have info for this directory and can reuse it + return callback(null, oldInfo); } + forEachBail( + filenames, + (filename, callback) => { + const descriptionFilePath = resolver.join(directory, filename); + if (resolver.fileSystem.readJson) { + resolver.fileSystem.readJson(descriptionFilePath, (err, content) => { + if (err) { + if (typeof err.code !== "undefined") { + if (resolveContext.missingDependencies) { + resolveContext.missingDependencies.add(descriptionFilePath); + } + return callback(); + } + if (resolveContext.fileDependencies) { + resolveContext.fileDependencies.add(descriptionFilePath); + } + return onJson(err); + } + if (resolveContext.fileDependencies) { + resolveContext.fileDependencies.add(descriptionFilePath); + } + onJson(null, content); + }); + } else { + resolver.fileSystem.readFile(descriptionFilePath, (err, content) => { + if (err) { + if (resolveContext.missingDependencies) { + resolveContext.missingDependencies.add(descriptionFilePath); + } + return callback(); + } + if (resolveContext.fileDependencies) { + resolveContext.fileDependencies.add(descriptionFilePath); + } + let json; - const querySplitPos = maybeAbsolutePath.indexOf("?"); - let resource = - querySplitPos === -1 - ? maybeAbsolutePath - : maybeAbsolutePath.slice(0, querySplitPos); - resource = relativePathToRequest(path.posix.relative(context, resource)); - return querySplitPos === -1 - ? resource - : resource + maybeAbsolutePath.slice(querySplitPos); - } + if (content) { + try { + json = JSON.parse(content.toString()); + } catch (e) { + return onJson(e); + } + } else { + return onJson(new Error("No content in file")); + } - if (WINDOWS_ABS_PATH_REGEXP.test(maybeAbsolutePath)) { - const querySplitPos = maybeAbsolutePath.indexOf("?"); - let resource = - querySplitPos === -1 - ? maybeAbsolutePath - : maybeAbsolutePath.slice(0, querySplitPos); - resource = path.win32.relative(context, resource); - if (!WINDOWS_ABS_PATH_REGEXP.test(resource)) { - resource = relativePathToRequest( - resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, "/") - ); - } - return querySplitPos === -1 - ? resource - : resource + maybeAbsolutePath.slice(querySplitPos); - } + onJson(null, json); + }); + } - // not an absolute path - return maybeAbsolutePath; -}; + function onJson(err, content) { + if (err) { + if (resolveContext.log) + resolveContext.log( + descriptionFilePath + " (directory description file): " + err + ); + else + err.message = + descriptionFilePath + " (directory description file): " + err; + return callback(err); + } + callback(null, { + content, + directory, + path: descriptionFilePath + }); + } + }, + (err, result) => { + if (err) return callback(err); + if (result) { + return callback(null, result); + } else { + const dir = cdUp(directory); + if (!dir) { + return callback(); + } else { + directory = dir; + return findDescriptionFile(); + } + } + } + ); + })(); +} /** - * @param {string} context context for relative path - * @param {string} relativePath path - * @returns {string} absolute path + * @param {any} content content + * @param {string|string[]} field field + * @returns {object|string|number|boolean|undefined} field data */ -const requestToAbsolute = (context, relativePath) => { - if (relativePath.startsWith("./") || relativePath.startsWith("../")) - return path.join(context, relativePath); - return relativePath; -}; +function getField(content, field) { + if (!content) return undefined; + if (Array.isArray(field)) { + let current = content; + for (let j = 0; j < field.length; j++) { + if (current === null || typeof current !== "object") { + current = null; + break; + } + current = current[field[j]]; + } + return current; + } else { + return content[field]; + } +} -const makeCacheable = realFn => { - /** @type {WeakMap>} */ - const cache = new WeakMap(); +/** + * @param {string} directory directory + * @returns {string|null} parent directory or null + */ +function cdUp(directory) { + if (directory === "/") return null; + const i = directory.lastIndexOf("/"), + j = directory.lastIndexOf("\\"); + const p = i < 0 ? j : j < 0 ? i : i < j ? j : i; + if (p < 0) return null; + return directory.substr(0, p || 1); +} - const getCache = associatedObjectForCache => { - const entry = cache.get(associatedObjectForCache); - if (entry !== undefined) return entry; - /** @type {Map} */ - const map = new Map(); - cache.set(associatedObjectForCache, map); - return map; - }; +exports.loadDescriptionFile = loadDescriptionFile; +exports.getField = getField; +exports.cdUp = cdUp; - /** - * @param {string} str the path with query and fragment - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {ParsedResource} parsed parts - */ - const fn = (str, associatedObjectForCache) => { - if (!associatedObjectForCache) return realFn(str); - const cache = getCache(associatedObjectForCache); - const entry = cache.get(str); - if (entry !== undefined) return entry; - const result = realFn(str); - cache.set(str, result); - return result; - }; - fn.bindCache = associatedObjectForCache => { - const cache = getCache(associatedObjectForCache); - return str => { - const entry = cache.get(str); - if (entry !== undefined) return entry; - const result = realFn(str); - cache.set(str, result); - return result; - }; - }; +/***/ }), - return fn; -}; +/***/ 60895: +/***/ (function(module) { -const makeCacheableWithContext = fn => { - /** @type {WeakMap>>} */ - const cache = new WeakMap(); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - /** - * @param {string} context context used to create relative path - * @param {string} identifier identifier used to create relative path - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {string} the returned relative path - */ - const cachedFn = (context, identifier, associatedObjectForCache) => { - if (!associatedObjectForCache) return fn(context, identifier); - let innerCache = cache.get(associatedObjectForCache); - if (innerCache === undefined) { - innerCache = new Map(); - cache.set(associatedObjectForCache, innerCache); - } - let cachedResult; - let innerSubCache = innerCache.get(context); - if (innerSubCache === undefined) { - innerCache.set(context, (innerSubCache = new Map())); - } else { - cachedResult = innerSubCache.get(identifier); - } +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - if (cachedResult !== undefined) { - return cachedResult; - } else { - const result = fn(context, identifier); - innerSubCache.set(identifier, result); - return result; - } - }; +module.exports = class DirectoryExistsPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string | ResolveStepHook} target target + */ + constructor(source, target) { + this.source = source; + this.target = target; + } /** - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {function(string, string): string} cached function + * @param {Resolver} resolver the resolver + * @returns {void} */ - cachedFn.bindCache = associatedObjectForCache => { - let innerCache; - if (associatedObjectForCache) { - innerCache = cache.get(associatedObjectForCache); - if (innerCache === undefined) { - innerCache = new Map(); - cache.set(associatedObjectForCache, innerCache); - } - } else { - innerCache = new Map(); - } + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync( + "DirectoryExistsPlugin", + (request, resolveContext, callback) => { + const fs = resolver.fileSystem; + const directory = request.path; + if (!directory) return callback(); + fs.stat(directory, (err, stat) => { + if (err || !stat) { + if (resolveContext.missingDependencies) + resolveContext.missingDependencies.add(directory); + if (resolveContext.log) + resolveContext.log(directory + " doesn't exist"); + return callback(); + } + if (!stat.isDirectory()) { + if (resolveContext.missingDependencies) + resolveContext.missingDependencies.add(directory); + if (resolveContext.log) + resolveContext.log(directory + " is not a directory"); + return callback(); + } + if (resolveContext.fileDependencies) + resolveContext.fileDependencies.add(directory); + resolver.doResolve( + target, + request, + `existing directory ${directory}`, + resolveContext, + callback + ); + }); + } + ); + } +}; - /** - * @param {string} context context used to create relative path - * @param {string} identifier identifier used to create relative path - * @returns {string} the returned relative path - */ - const boundFn = (context, identifier) => { - let cachedResult; - let innerSubCache = innerCache.get(context); - if (innerSubCache === undefined) { - innerCache.set(context, (innerSubCache = new Map())); - } else { - cachedResult = innerSubCache.get(identifier); - } - if (cachedResult !== undefined) { - return cachedResult; - } else { - const result = fn(context, identifier); - innerSubCache.set(identifier, result); - return result; - } - }; +/***/ }), - return boundFn; - }; +/***/ 83849: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ - /** - * @param {string} context context used to create relative path - * @param {Object=} associatedObjectForCache an object to which the cache will be attached - * @returns {function(string): string} cached function - */ - cachedFn.bindContextCache = (context, associatedObjectForCache) => { - let innerSubCache; - if (associatedObjectForCache) { - let innerCache = cache.get(associatedObjectForCache); - if (innerCache === undefined) { - innerCache = new Map(); - cache.set(associatedObjectForCache, innerCache); - } - innerSubCache = innerCache.get(context); - if (innerSubCache === undefined) { - innerCache.set(context, (innerSubCache = new Map())); - } - } else { - innerSubCache = new Map(); - } - /** - * @param {string} identifier identifier used to create relative path - * @returns {string} the returned relative path - */ - const boundFn = identifier => { - const cachedResult = innerSubCache.get(identifier); - if (cachedResult !== undefined) { - return cachedResult; - } else { - const result = fn(context, identifier); - innerSubCache.set(identifier, result); - return result; - } - }; +const path = __webpack_require__(71017); +const DescriptionFileUtils = __webpack_require__(25424); +const forEachBail = __webpack_require__(78565); +const { processExportsField } = __webpack_require__(55863); +const { parseIdentifier } = __webpack_require__(71053); +const { checkExportsFieldTarget } = __webpack_require__(67079); - return boundFn; - }; +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +/** @typedef {import("./util/entrypoints").ExportsField} ExportsField */ +/** @typedef {import("./util/entrypoints").FieldProcessor} FieldProcessor */ - return cachedFn; -}; +module.exports = class ExportsFieldPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {Set} conditionNames condition names + * @param {string | string[]} fieldNamePath name path + * @param {string | ResolveStepHook} target target + */ + constructor(source, conditionNames, fieldNamePath, target) { + this.source = source; + this.target = target; + this.conditionNames = conditionNames; + this.fieldName = fieldNamePath; + /** @type {WeakMap} */ + this.fieldProcessorCache = new WeakMap(); + } -/** - * - * @param {string} context context for relative path - * @param {string} identifier identifier for path - * @returns {string} a converted relative path - */ -const _makePathsRelative = (context, identifier) => { - return identifier - .split(SEGMENTS_SPLIT_REGEXP) - .map(str => absoluteToRequest(context, str)) - .join(""); -}; + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("ExportsFieldPlugin", (request, resolveContext, callback) => { + // When there is no description file, abort + if (!request.descriptionFilePath) return callback(); + if ( + // When the description file is inherited from parent, abort + // (There is no description file inside of this package) + request.relativePath !== "." || + request.request === undefined + ) + return callback(); -exports.makePathsRelative = makeCacheableWithContext(_makePathsRelative); + const remainingRequest = + request.query || request.fragment + ? (request.request === "." ? "./" : request.request) + + request.query + + request.fragment + : request.request; + /** @type {ExportsField|null} */ + const exportsField = DescriptionFileUtils.getField( + request.descriptionFileData, + this.fieldName + ); + if (!exportsField) return callback(); -/** - * - * @param {string} context context for relative path - * @param {string} identifier identifier for path - * @returns {string} a converted relative path - */ -const _makePathsAbsolute = (context, identifier) => { - return identifier - .split(SEGMENTS_SPLIT_REGEXP) - .map(str => requestToAbsolute(context, str)) - .join(""); -}; + if (request.directory) { + return callback( + new Error( + `Resolving to directories is not possible with the exports field (request was ${remainingRequest}/)` + ) + ); + } -exports.makePathsAbsolute = makeCacheableWithContext(_makePathsAbsolute); + let paths; -/** - * @param {string} context absolute context path - * @param {string} request any request string may containing absolute paths, query string, etc. - * @returns {string} a new request string avoiding absolute paths when possible - */ -const _contextify = (context, request) => { - return request - .split("!") - .map(r => absoluteToRequest(context, r)) - .join("!"); -}; + try { + // We attach the cache to the description file instead of the exportsField value + // because we use a WeakMap and the exportsField could be a string too. + // Description file is always an object when exports field can be accessed. + let fieldProcessor = this.fieldProcessorCache.get( + request.descriptionFileData + ); + if (fieldProcessor === undefined) { + fieldProcessor = processExportsField(exportsField); + this.fieldProcessorCache.set( + request.descriptionFileData, + fieldProcessor + ); + } + paths = fieldProcessor(remainingRequest, this.conditionNames); + } catch (err) { + if (resolveContext.log) { + resolveContext.log( + `Exports field in ${request.descriptionFilePath} can't be processed: ${err}` + ); + } + return callback(err); + } -const contextify = makeCacheableWithContext(_contextify); -exports.contextify = contextify; + if (paths.length === 0) { + return callback( + new Error( + `Package path ${remainingRequest} is not exported from package ${request.descriptionFileRoot} (see exports field in ${request.descriptionFilePath})` + ) + ); + } -/** - * @param {string} context absolute context path - * @param {string} request any request string - * @returns {string} a new request string using absolute paths when possible - */ -const _absolutify = (context, request) => { - return request - .split("!") - .map(r => requestToAbsolute(context, r)) - .join("!"); -}; + forEachBail( + paths, + (p, callback) => { + const parsedIdentifier = parseIdentifier(p); -const absolutify = makeCacheableWithContext(_absolutify); -exports.absolutify = absolutify; + if (!parsedIdentifier) return callback(); -const PATH_QUERY_FRAGMENT_REGEXP = - /^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/; -const PATH_QUERY_REGEXP = /^((?:\0.|[^?\0])*)(\?.*)?$/; + const [relativePath, query, fragment] = parsedIdentifier; -/** @typedef {{ resource: string, path: string, query: string, fragment: string }} ParsedResource */ -/** @typedef {{ resource: string, path: string, query: string }} ParsedResourceWithoutFragment */ + const error = checkExportsFieldTarget(relativePath); -/** - * @param {string} str the path with query and fragment - * @returns {ParsedResource} parsed parts - */ -const _parseResource = str => { - const match = PATH_QUERY_FRAGMENT_REGEXP.exec(str); - return { - resource: str, - path: match[1].replace(/\0(.)/g, "$1"), - query: match[2] ? match[2].replace(/\0(.)/g, "$1") : "", - fragment: match[3] || "" - }; -}; -exports.parseResource = makeCacheable(_parseResource); + if (error) { + return callback(error); + } -/** - * Parse resource, skips fragment part - * @param {string} str the path with query and fragment - * @returns {ParsedResourceWithoutFragment} parsed parts - */ -const _parseResourceWithoutFragment = str => { - const match = PATH_QUERY_REGEXP.exec(str); - return { - resource: str, - path: match[1].replace(/\0(.)/g, "$1"), - query: match[2] ? match[2].replace(/\0(.)/g, "$1") : "" - }; -}; -exports.parseResourceWithoutFragment = makeCacheable( - _parseResourceWithoutFragment -); + const obj = { + ...request, + request: undefined, + path: path.join( + /** @type {string} */ (request.descriptionFileRoot), + relativePath + ), + relativePath, + query, + fragment + }; -/** - * @param {string} filename the filename which should be undone - * @param {string} outputPath the output path that is restored (only relevant when filename contains "..") - * @param {boolean} enforceRelative true returns ./ for empty paths - * @returns {string} repeated ../ to leave the directory of the provided filename to be back on output dir - */ -exports.getUndoPath = (filename, outputPath, enforceRelative) => { - let depth = -1; - let append = ""; - outputPath = outputPath.replace(/[\\/]$/, ""); - for (const part of filename.split(/[/\\]+/)) { - if (part === "..") { - if (depth > -1) { - depth--; - } else { - const i = outputPath.lastIndexOf("/"); - const j = outputPath.lastIndexOf("\\"); - const pos = i < 0 ? j : j < 0 ? i : Math.max(i, j); - if (pos < 0) return outputPath + "/"; - append = outputPath.slice(pos + 1) + "/" + append; - outputPath = outputPath.slice(0, pos); - } - } else if (part !== ".") { - depth++; - } + resolver.doResolve( + target, + obj, + "using exports field: " + p, + resolveContext, + callback + ); + }, + (err, result) => callback(err, result || null) + ); + }); } - return depth > 0 - ? `${"../".repeat(depth)}${append}` - : enforceRelative - ? `./${append}` - : append; }; /***/ }), -/***/ 53023: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 50295: +/***/ (function(module) { "use strict"; /* @@ -134546,321 +135128,362 @@ exports.getUndoPath = (filename, outputPath, enforceRelative) => { -// We need to include a list of requires here -// to allow webpack to be bundled with only static requires -// We could use a dynamic require(`../${request}`) but this -// would include too many modules and not every tool is able -// to process this -module.exports = { - AsyncDependenciesBlock: () => __webpack_require__(47736), - CommentCompilationWarning: () => __webpack_require__(98427), - ContextModule: () => __webpack_require__(76729), - "cache/PackFileCacheStrategy": () => - __webpack_require__(86180), - "cache/ResolverCachePlugin": () => __webpack_require__(97347), - "container/ContainerEntryDependency": () => - __webpack_require__(64813), - "container/ContainerEntryModule": () => - __webpack_require__(80580), - "container/ContainerExposedDependency": () => - __webpack_require__(72374), - "container/FallbackDependency": () => - __webpack_require__(57764), - "container/FallbackItemDependency": () => - __webpack_require__(29593), - "container/FallbackModule": () => __webpack_require__(82886), - "container/RemoteModule": () => __webpack_require__(62916), - "container/RemoteToExternalDependency": () => - __webpack_require__(14389), - "dependencies/AMDDefineDependency": () => - __webpack_require__(96816), - "dependencies/AMDRequireArrayDependency": () => - __webpack_require__(33516), - "dependencies/AMDRequireContextDependency": () => - __webpack_require__(96123), - "dependencies/AMDRequireDependenciesBlock": () => - __webpack_require__(76932), - "dependencies/AMDRequireDependency": () => - __webpack_require__(43911), - "dependencies/AMDRequireItemDependency": () => - __webpack_require__(71806), - "dependencies/CachedConstDependency": () => - __webpack_require__(57403), - "dependencies/CreateScriptUrlDependency": () => - __webpack_require__(79062), - "dependencies/CommonJsRequireContextDependency": () => - __webpack_require__(23962), - "dependencies/CommonJsExportRequireDependency": () => - __webpack_require__(62892), - "dependencies/CommonJsExportsDependency": () => - __webpack_require__(45598), - "dependencies/CommonJsFullRequireDependency": () => - __webpack_require__(59440), - "dependencies/CommonJsRequireDependency": () => - __webpack_require__(21264), - "dependencies/CommonJsSelfReferenceDependency": () => - __webpack_require__(52225), - "dependencies/ConstDependency": () => - __webpack_require__(76911), - "dependencies/ContextDependency": () => - __webpack_require__(88101), - "dependencies/ContextElementDependency": () => - __webpack_require__(58477), - "dependencies/CriticalDependencyWarning": () => - __webpack_require__(15427), - "dependencies/CssImportDependency": () => - __webpack_require__(90542), - "dependencies/CssLocalIdentifierDependency": () => - __webpack_require__(92328), - "dependencies/CssSelfLocalIdentifierDependency": () => - __webpack_require__(29094), - "dependencies/CssExportDependency": () => - __webpack_require__(76760), - "dependencies/CssUrlDependency": () => - __webpack_require__(70749), - "dependencies/DelegatedSourceDependency": () => - __webpack_require__(22914), - "dependencies/DllEntryDependency": () => - __webpack_require__(95666), - "dependencies/EntryDependency": () => - __webpack_require__(3979), - "dependencies/ExportsInfoDependency": () => - __webpack_require__(78988), - "dependencies/HarmonyAcceptDependency": () => - __webpack_require__(23624), - "dependencies/HarmonyAcceptImportDependency": () => - __webpack_require__(99843), - "dependencies/HarmonyCompatibilityDependency": () => - __webpack_require__(72906), - "dependencies/HarmonyExportExpressionDependency": () => - __webpack_require__(51340), - "dependencies/HarmonyExportHeaderDependency": () => - __webpack_require__(38873), - "dependencies/HarmonyExportImportedSpecifierDependency": () => - __webpack_require__(67157), - "dependencies/HarmonyExportSpecifierDependency": () => - __webpack_require__(48567), - "dependencies/HarmonyImportSideEffectDependency": () => - __webpack_require__(73132), - "dependencies/HarmonyImportSpecifierDependency": () => - __webpack_require__(14077), - "dependencies/ImportContextDependency": () => - __webpack_require__(1902), - "dependencies/ImportDependency": () => - __webpack_require__(89376), - "dependencies/ImportEagerDependency": () => - __webpack_require__(50718), - "dependencies/ImportWeakDependency": () => - __webpack_require__(82483), - "dependencies/JsonExportsDependency": () => - __webpack_require__(750), - "dependencies/LocalModule": () => __webpack_require__(5826), - "dependencies/LocalModuleDependency": () => - __webpack_require__(52805), - "dependencies/ModuleDecoratorDependency": () => - __webpack_require__(88488), - "dependencies/ModuleHotAcceptDependency": () => - __webpack_require__(47511), - "dependencies/ModuleHotDeclineDependency": () => - __webpack_require__(86301), - "dependencies/ImportMetaHotAcceptDependency": () => - __webpack_require__(51274), - "dependencies/ImportMetaHotDeclineDependency": () => - __webpack_require__(53141), - "dependencies/ProvidedDependency": () => - __webpack_require__(95770), - "dependencies/PureExpressionDependency": () => - __webpack_require__(55799), - "dependencies/RequireContextDependency": () => - __webpack_require__(46917), - "dependencies/RequireEnsureDependenciesBlock": () => - __webpack_require__(27153), - "dependencies/RequireEnsureDependency": () => - __webpack_require__(27223), - "dependencies/RequireEnsureItemDependency": () => - __webpack_require__(50329), - "dependencies/RequireHeaderDependency": () => - __webpack_require__(89183), - "dependencies/RequireIncludeDependency": () => - __webpack_require__(71284), - "dependencies/RequireIncludeDependencyParserPlugin": () => - __webpack_require__(35768), - "dependencies/RequireResolveContextDependency": () => - __webpack_require__(55627), - "dependencies/RequireResolveDependency": () => - __webpack_require__(68582), - "dependencies/RequireResolveHeaderDependency": () => - __webpack_require__(9880), - "dependencies/RuntimeRequirementsDependency": () => - __webpack_require__(24187), - "dependencies/StaticExportsDependency": () => - __webpack_require__(91418), - "dependencies/SystemPlugin": () => __webpack_require__(97981), - "dependencies/UnsupportedDependency": () => - __webpack_require__(51669), - "dependencies/URLDependency": () => __webpack_require__(58612), - "dependencies/WebAssemblyExportImportedDependency": () => - __webpack_require__(52204), - "dependencies/WebAssemblyImportDependency": () => - __webpack_require__(5239), - "dependencies/WebpackIsIncludedDependency": () => - __webpack_require__(26505), - "dependencies/WorkerDependency": () => - __webpack_require__(1466), - "json/JsonData": () => __webpack_require__(90490), - "optimize/ConcatenatedModule": () => - __webpack_require__(97198), - DelegatedModule: () => __webpack_require__(28623), - DependenciesBlock: () => __webpack_require__(71040), - DllModule: () => __webpack_require__(28280), - ExternalModule: () => __webpack_require__(73071), - FileSystemInfo: () => __webpack_require__(79453), - InitFragment: () => __webpack_require__(55870), - InvalidDependenciesModuleWarning: () => - __webpack_require__(68257), - Module: () => __webpack_require__(73208), - ModuleBuildError: () => __webpack_require__(21305), - ModuleDependencyWarning: () => __webpack_require__(29656), - ModuleError: () => __webpack_require__(23744), - ModuleGraph: () => __webpack_require__(99988), - ModuleParseError: () => __webpack_require__(58443), - ModuleWarning: () => __webpack_require__(11234), - NormalModule: () => __webpack_require__(39), - RawDataUrlModule: () => __webpack_require__(19684), - RawModule: () => __webpack_require__(84929), - "sharing/ConsumeSharedModule": () => - __webpack_require__(62286), - "sharing/ConsumeSharedFallbackDependency": () => - __webpack_require__(58831), - "sharing/ProvideSharedModule": () => - __webpack_require__(50821), - "sharing/ProvideSharedDependency": () => - __webpack_require__(1798), - "sharing/ProvideForSharedDependency": () => - __webpack_require__(40017), - UnsupportedFeatureWarning: () => __webpack_require__(42495), - "util/LazySet": () => __webpack_require__(38938), - UnhandledSchemeError: () => __webpack_require__(68099), - NodeStuffInWebError: () => __webpack_require__(6325), - WebpackError: () => __webpack_require__(53799), +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - "util/registerExternalSerializer": () => { - // already registered +module.exports = class FileExistsPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string | ResolveStepHook} target target + */ + constructor(source, target) { + this.source = source; + this.target = target; + } + + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + const fs = resolver.fileSystem; + resolver + .getHook(this.source) + .tapAsync("FileExistsPlugin", (request, resolveContext, callback) => { + const file = request.path; + if (!file) return callback(); + fs.stat(file, (err, stat) => { + if (err || !stat) { + if (resolveContext.missingDependencies) + resolveContext.missingDependencies.add(file); + if (resolveContext.log) resolveContext.log(file + " doesn't exist"); + return callback(); + } + if (!stat.isFile()) { + if (resolveContext.missingDependencies) + resolveContext.missingDependencies.add(file); + if (resolveContext.log) resolveContext.log(file + " is not a file"); + return callback(); + } + if (resolveContext.fileDependencies) + resolveContext.fileDependencies.add(file); + resolver.doResolve( + target, + request, + "existing file: " + file, + resolveContext, + callback + ); + }); + }); } }; /***/ }), -/***/ 33032: +/***/ 7317: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop */ -const { register } = __webpack_require__(8282); +const path = __webpack_require__(71017); +const DescriptionFileUtils = __webpack_require__(25424); +const forEachBail = __webpack_require__(78565); +const { processImportsField } = __webpack_require__(55863); +const { parseIdentifier } = __webpack_require__(71053); -class ClassSerializer { - constructor(Constructor) { - this.Constructor = Constructor; - } +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +/** @typedef {import("./util/entrypoints").FieldProcessor} FieldProcessor */ +/** @typedef {import("./util/entrypoints").ImportsField} ImportsField */ - serialize(obj, context) { - obj.serialize(context); - } +const dotCode = ".".charCodeAt(0); - deserialize(context) { - if (typeof this.Constructor.deserialize === "function") { - return this.Constructor.deserialize(context); - } - const obj = new this.Constructor(); - obj.deserialize(context); - return obj; +module.exports = class ImportsFieldPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {Set} conditionNames condition names + * @param {string | string[]} fieldNamePath name path + * @param {string | ResolveStepHook} targetFile target file + * @param {string | ResolveStepHook} targetPackage target package + */ + constructor( + source, + conditionNames, + fieldNamePath, + targetFile, + targetPackage + ) { + this.source = source; + this.targetFile = targetFile; + this.targetPackage = targetPackage; + this.conditionNames = conditionNames; + this.fieldName = fieldNamePath; + /** @type {WeakMap} */ + this.fieldProcessorCache = new WeakMap(); } -} -module.exports = (Constructor, request, name = null) => { - register(Constructor, request, name, new ClassSerializer(Constructor)); + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const targetFile = resolver.ensureHook(this.targetFile); + const targetPackage = resolver.ensureHook(this.targetPackage); + + resolver + .getHook(this.source) + .tapAsync("ImportsFieldPlugin", (request, resolveContext, callback) => { + // When there is no description file, abort + if (!request.descriptionFilePath || request.request === undefined) { + return callback(); + } + + const remainingRequest = + request.request + request.query + request.fragment; + /** @type {ImportsField|null} */ + const importsField = DescriptionFileUtils.getField( + request.descriptionFileData, + this.fieldName + ); + if (!importsField) return callback(); + + if (request.directory) { + return callback( + new Error( + `Resolving to directories is not possible with the imports field (request was ${remainingRequest}/)` + ) + ); + } + + let paths; + + try { + // We attach the cache to the description file instead of the importsField value + // because we use a WeakMap and the importsField could be a string too. + // Description file is always an object when exports field can be accessed. + let fieldProcessor = this.fieldProcessorCache.get( + request.descriptionFileData + ); + if (fieldProcessor === undefined) { + fieldProcessor = processImportsField(importsField); + this.fieldProcessorCache.set( + request.descriptionFileData, + fieldProcessor + ); + } + paths = fieldProcessor(remainingRequest, this.conditionNames); + } catch (err) { + if (resolveContext.log) { + resolveContext.log( + `Imports field in ${request.descriptionFilePath} can't be processed: ${err}` + ); + } + return callback(err); + } + + if (paths.length === 0) { + return callback( + new Error( + `Package import ${remainingRequest} is not imported from package ${request.descriptionFileRoot} (see imports field in ${request.descriptionFilePath})` + ) + ); + } + + forEachBail( + paths, + (p, callback) => { + const parsedIdentifier = parseIdentifier(p); + + if (!parsedIdentifier) return callback(); + + const [path_, query, fragment] = parsedIdentifier; + + switch (path_.charCodeAt(0)) { + // should be relative + case dotCode: { + const obj = { + ...request, + request: undefined, + path: path.join( + /** @type {string} */ (request.descriptionFileRoot), + path_ + ), + relativePath: path_, + query, + fragment + }; + + resolver.doResolve( + targetFile, + obj, + "using imports field: " + p, + resolveContext, + callback + ); + break; + } + + // package resolving + default: { + const obj = { + ...request, + request: path_, + relativePath: path_, + fullySpecified: true, + query, + fragment + }; + + resolver.doResolve( + targetPackage, + obj, + "using imports field: " + p, + resolveContext, + callback + ); + } + } + }, + (err, result) => callback(err, result || null) + ); + }); + } }; /***/ }), -/***/ 78676: +/***/ 35949: /***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -/** @template T @typedef {function(): T} FunctionReturning */ +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -/** - * @template T - * @param {FunctionReturning} fn memorized function - * @returns {FunctionReturning} new function - */ -const memoize = fn => { - let cache = false; - /** @type {T} */ - let result = undefined; - return () => { - if (cache) { - return result; - } else { - result = fn(); - cache = true; - // Allow to clean up memory for fn - // and all dependent resources - fn = undefined; - return result; - } - }; -}; +const namespaceStartCharCode = "@".charCodeAt(0); -module.exports = memoize; +module.exports = class JoinRequestPartPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string | ResolveStepHook} target target + */ + constructor(source, target) { + this.source = source; + this.target = target; + } + + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync( + "JoinRequestPartPlugin", + (request, resolveContext, callback) => { + const req = request.request || ""; + let i = req.indexOf("/", 3); + + if (i >= 0 && req.charCodeAt(2) === namespaceStartCharCode) { + i = req.indexOf("/", i + 1); + } + + let moduleName, remainingRequest, fullySpecified; + if (i < 0) { + moduleName = req; + remainingRequest = "."; + fullySpecified = false; + } else { + moduleName = req.slice(0, i); + remainingRequest = "." + req.slice(i); + fullySpecified = request.fullySpecified; + } + const obj = { + ...request, + path: resolver.join(request.path, moduleName), + relativePath: + request.relativePath && + resolver.join(request.relativePath, moduleName), + request: remainingRequest, + fullySpecified + }; + resolver.doResolve(target, obj, null, resolveContext, callback); + } + ); + } +}; /***/ }), -/***/ 55668: +/***/ 5190: /***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop + Author Tobias Koppers @sokra */ -const A_CODE = "a".charCodeAt(0); +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -/** - * @param {string} hash hash - * @param {number} hashLength hash length - * @returns {string} returns hash that has at least one non numeric char - */ -module.exports = (hash, hashLength) => { - if (hashLength < 1) return ""; - const slice = hash.slice(0, hashLength); - if (slice.match(/[^\d]/)) return slice; - return `${String.fromCharCode( - A_CODE + (parseInt(hash[0], 10) % 6) - )}${slice.slice(1)}`; +module.exports = class JoinRequestPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string | ResolveStepHook} target target + */ + constructor(source, target) { + this.source = source; + this.target = target; + } + + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("JoinRequestPlugin", (request, resolveContext, callback) => { + const obj = { + ...request, + path: resolver.join(request.path, request.request), + relativePath: + request.relativePath && + resolver.join(request.relativePath, request.request), + request: undefined + }; + resolver.doResolve(target, obj, null, resolveContext, callback); + }); + } }; /***/ }), -/***/ 70002: +/***/ 5049: /***/ (function(module) { "use strict"; @@ -134871,50 +135494,55 @@ module.exports = (hash, hashLength) => { -const SAFE_LIMIT = 0x80000000; -const SAFE_PART = SAFE_LIMIT - 1; -const COUNT = 4; -const arr = [0, 0, 0, 0, 0]; -const primes = [3, 7, 17, 19]; +/** @typedef {import("./Resolver")} Resolver */ -module.exports = (str, range) => { - arr.fill(0); - for (let i = 0; i < str.length; i++) { - const c = str.charCodeAt(i); - for (let j = 0; j < COUNT; j++) { - const p = (j + COUNT - 1) % COUNT; - arr[j] = (arr[j] + c * primes[j] + arr[p]) & SAFE_PART; - } - for (let j = 0; j < COUNT; j++) { - const q = arr[j] % COUNT; - arr[j] = arr[j] ^ (arr[q] >> 1); - } +module.exports = class LogInfoPlugin { + constructor(source) { + this.source = source; } - if (range <= SAFE_PART) { - let sum = 0; - for (let j = 0; j < COUNT; j++) { - sum = (sum + arr[j]) % range; - } - return sum; - } else { - let sum1 = 0; - let sum2 = 0; - const rangeExt = Math.floor(range / SAFE_LIMIT); - for (let j = 0; j < COUNT; j += 2) { - sum1 = (sum1 + arr[j]) & SAFE_PART; - } - for (let j = 1; j < COUNT; j += 2) { - sum2 = (sum2 + arr[j]) % rangeExt; - } - return (sum2 * SAFE_LIMIT + sum1) % range; + + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const source = this.source; + resolver + .getHook(this.source) + .tapAsync("LogInfoPlugin", (request, resolveContext, callback) => { + if (!resolveContext.log) return callback(); + const log = resolveContext.log; + const prefix = "[" + source + "] "; + if (request.path) + log(prefix + "Resolving in directory: " + request.path); + if (request.request) + log(prefix + "Resolving request: " + request.request); + if (request.module) log(prefix + "Request is an module request."); + if (request.directory) log(prefix + "Request is a directory request."); + if (request.query) + log(prefix + "Resolving request query: " + request.query); + if (request.fragment) + log(prefix + "Resolving request fragment: " + request.fragment); + if (request.descriptionFilePath) + log( + prefix + "Has description data from " + request.descriptionFilePath + ); + if (request.relativePath) + log( + prefix + + "Relative path from description file is: " + + request.relativePath + ); + callback(); + }); } }; /***/ }), -/***/ 42791: -/***/ (function(module) { +/***/ 47450: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -134924,67 +135552,86 @@ module.exports = (str, range) => { -/** - * @template T - * @template {Error} E - * @param {Iterable} items initial items - * @param {number} concurrency number of items running in parallel - * @param {function(T, function(T): void, function(E=): void): void} processor worker which pushes more items - * @param {function(E=): void} callback all items processed - * @returns {void} - */ -const processAsyncTree = (items, concurrency, processor, callback) => { - const queue = Array.from(items); - if (queue.length === 0) return callback(); - let processing = 0; - let finished = false; - let processScheduled = true; +const path = __webpack_require__(71017); +const DescriptionFileUtils = __webpack_require__(25424); - const push = item => { - queue.push(item); - if (!processScheduled && processing < concurrency) { - processScheduled = true; - process.nextTick(processQueue); - } - }; +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +/** @typedef {{name: string|Array, forceRelative: boolean}} MainFieldOptions */ - const processorCallback = err => { - processing--; - if (err && !finished) { - finished = true; - callback(err); - return; - } - if (!processScheduled) { - processScheduled = true; - process.nextTick(processQueue); - } - }; +const alreadyTriedMainField = Symbol("alreadyTriedMainField"); - const processQueue = () => { - if (finished) return; - while (processing < concurrency && queue.length > 0) { - processing++; - const item = queue.pop(); - processor(item, push, processorCallback); - } - processScheduled = false; - if (queue.length === 0 && processing === 0 && !finished) { - finished = true; - callback(); - } - }; +module.exports = class MainFieldPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {MainFieldOptions} options options + * @param {string | ResolveStepHook} target target + */ + constructor(source, options, target) { + this.source = source; + this.options = options; + this.target = target; + } - processQueue(); + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("MainFieldPlugin", (request, resolveContext, callback) => { + if ( + request.path !== request.descriptionFileRoot || + request[alreadyTriedMainField] === request.descriptionFilePath || + !request.descriptionFilePath + ) + return callback(); + const filename = path.basename(request.descriptionFilePath); + let mainModule = DescriptionFileUtils.getField( + request.descriptionFileData, + this.options.name + ); + + if ( + !mainModule || + typeof mainModule !== "string" || + mainModule === "." || + mainModule === "./" + ) { + return callback(); + } + if (this.options.forceRelative && !/^\.\.?\//.test(mainModule)) + mainModule = "./" + mainModule; + const obj = { + ...request, + request: mainModule, + module: false, + directory: mainModule.endsWith("/"), + [alreadyTriedMainField]: request.descriptionFilePath + }; + return resolver.doResolve( + target, + obj, + "use " + + mainModule + + " from " + + this.options.name + + " in " + + filename, + resolveContext, + callback + ); + }); + } }; -module.exports = processAsyncTree; - /***/ }), -/***/ 54190: -/***/ (function(module) { +/***/ 79024: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -134994,83 +135641,85 @@ module.exports = processAsyncTree; -const SAFE_IDENTIFIER = /^[_a-zA-Z$][_a-zA-Z$0-9]*$/; -const RESERVED_IDENTIFIER = new Set([ - "break", - "case", - "catch", - "class", - "const", - "continue", - "debugger", - "default", - "delete", - "do", - "else", - "export", - "extends", - "finally", - "for", - "function", - "if", - "import", - "in", - "instanceof", - "new", - "return", - "super", - "switch", - "this", - "throw", - "try", - "typeof", - "var", - "void", - "while", - "with", - "enum", - // strict mode - "implements", - "interface", - "let", - "package", - "private", - "protected", - "public", - "static", - "yield", - "yield", - // module code - "await", - // skip future reserved keywords defined under ES1 till ES3 - // additional - "null", - "true", - "false" -]); +const forEachBail = __webpack_require__(78565); +const getPaths = __webpack_require__(82918); -const propertyAccess = (properties, start = 0) => { - let str = ""; - for (let i = start; i < properties.length; i++) { - const p = properties[i]; - if (`${+p}` === p) { - str += `[${p}]`; - } else if (SAFE_IDENTIFIER.test(p) && !RESERVED_IDENTIFIER.has(p)) { - str += `.${p}`; - } else { - str += `[${JSON.stringify(p)}]`; - } +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + +module.exports = class ModulesInHierarchicalDirectoriesPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string | Array} directories directories + * @param {string | ResolveStepHook} target target + */ + constructor(source, directories, target) { + this.source = source; + this.directories = /** @type {Array} */ ([]).concat(directories); + this.target = target; } - return str; -}; -module.exports = propertyAccess; + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync( + "ModulesInHierarchicalDirectoriesPlugin", + (request, resolveContext, callback) => { + const fs = resolver.fileSystem; + const addrs = getPaths(request.path) + .paths.map(p => { + return this.directories.map(d => resolver.join(p, d)); + }) + .reduce((array, p) => { + array.push.apply(array, p); + return array; + }, []); + forEachBail( + addrs, + (addr, callback) => { + fs.stat(addr, (err, stat) => { + if (!err && stat && stat.isDirectory()) { + const obj = { + ...request, + path: addr, + request: "./" + request.request, + module: false + }; + const message = "looking for modules in " + addr; + return resolver.doResolve( + target, + obj, + message, + resolveContext, + callback + ); + } + if (resolveContext.log) + resolveContext.log( + addr + " doesn't exist or is not a directory" + ); + if (resolveContext.missingDependencies) + resolveContext.missingDependencies.add(addr); + return callback(); + }); + }, + callback + ); + } + ); + } +}; /***/ }), -/***/ 26611: -/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { +/***/ 88138: +/***/ (function(module) { "use strict"; /* @@ -135080,342 +135729,93 @@ module.exports = propertyAccess; -const { register } = __webpack_require__(8282); - -const Position = /** @type {TODO} */ (__webpack_require__(31988).Position); -const SourceLocation = (__webpack_require__(31988).SourceLocation); -const ValidationError = (__webpack_require__(54983)/* ["default"] */ .Z); -const { - CachedSource, - ConcatSource, - OriginalSource, - PrefixSource, - RawSource, - ReplaceSource, - SourceMapSource -} = __webpack_require__(51255); - -/** @typedef {import("acorn").Position} Position */ -/** @typedef {import("../Dependency").RealDependencyLocation} RealDependencyLocation */ -/** @typedef {import("../Dependency").SourcePosition} SourcePosition */ -/** @typedef {import("./serialization").ObjectDeserializerContext} ObjectDeserializerContext */ -/** @typedef {import("./serialization").ObjectSerializerContext} ObjectSerializerContext */ - -/** @typedef {ObjectSerializerContext & { writeLazy?: (any) => void }} WebpackObjectSerializerContext */ - -const CURRENT_MODULE = "webpack/lib/util/registerExternalSerializer"; - -register( - CachedSource, - CURRENT_MODULE, - "webpack-sources/CachedSource", - new (class CachedSourceSerializer { - /** - * @param {CachedSource} source the cached source to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(source, { write, writeLazy }) { - if (writeLazy) { - writeLazy(source.originalLazy()); - } else { - write(source.original()); - } - write(source.getCachedData()); - } - - /** - * @param {ObjectDeserializerContext} context context - * @returns {CachedSource} cached source - */ - deserialize({ read }) { - const source = read(); - const cachedData = read(); - return new CachedSource(source, cachedData); - } - })() -); - -register( - RawSource, - CURRENT_MODULE, - "webpack-sources/RawSource", - new (class RawSourceSerializer { - /** - * @param {RawSource} source the raw source to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(source, { write }) { - write(source.buffer()); - write(!source.isBuffer()); - } - - /** - * @param {ObjectDeserializerContext} context context - * @returns {RawSource} raw source - */ - deserialize({ read }) { - const source = read(); - const convertToString = read(); - return new RawSource(source, convertToString); - } - })() -); - -register( - ConcatSource, - CURRENT_MODULE, - "webpack-sources/ConcatSource", - new (class ConcatSourceSerializer { - /** - * @param {ConcatSource} source the concat source to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(source, { write }) { - write(source.getChildren()); - } - - /** - * @param {ObjectDeserializerContext} context context - * @returns {ConcatSource} concat source - */ - deserialize({ read }) { - const source = new ConcatSource(); - source.addAllSkipOptimizing(read()); - return source; - } - })() -); - -register( - PrefixSource, - CURRENT_MODULE, - "webpack-sources/PrefixSource", - new (class PrefixSourceSerializer { - /** - * @param {PrefixSource} source the prefix source to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(source, { write }) { - write(source.getPrefix()); - write(source.original()); - } - - /** - * @param {ObjectDeserializerContext} context context - * @returns {PrefixSource} prefix source - */ - deserialize({ read }) { - return new PrefixSource(read(), read()); - } - })() -); +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -register( - ReplaceSource, - CURRENT_MODULE, - "webpack-sources/ReplaceSource", - new (class ReplaceSourceSerializer { - /** - * @param {ReplaceSource} source the replace source to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(source, { write }) { - write(source.original()); - write(source.getName()); - const replacements = source.getReplacements(); - write(replacements.length); - for (const repl of replacements) { - write(repl.start); - write(repl.end); - } - for (const repl of replacements) { - write(repl.content); - write(repl.name); - } - } +module.exports = class ModulesInRootPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string} path path + * @param {string | ResolveStepHook} target target + */ + constructor(source, path, target) { + this.source = source; + this.path = path; + this.target = target; + } - /** - * @param {ObjectDeserializerContext} context context - * @returns {ReplaceSource} replace source - */ - deserialize({ read }) { - const source = new ReplaceSource(read(), read()); - const len = read(); - const startEndBuffer = []; - for (let i = 0; i < len; i++) { - startEndBuffer.push(read(), read()); - } - let j = 0; - for (let i = 0; i < len; i++) { - source.replace( - startEndBuffer[j++], - startEndBuffer[j++], - read(), - read() + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("ModulesInRootPlugin", (request, resolveContext, callback) => { + const obj = { + ...request, + path: this.path, + request: "./" + request.request, + module: false + }; + resolver.doResolve( + target, + obj, + "looking for modules in " + this.path, + resolveContext, + callback ); - } - return source; - } - })() -); + }); + } +}; -register( - OriginalSource, - CURRENT_MODULE, - "webpack-sources/OriginalSource", - new (class OriginalSourceSerializer { - /** - * @param {OriginalSource} source the original source to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(source, { write }) { - write(source.buffer()); - write(source.getName()); - } - /** - * @param {ObjectDeserializerContext} context context - * @returns {OriginalSource} original source - */ - deserialize({ read }) { - const buffer = read(); - const name = read(); - return new OriginalSource(buffer, name); - } - })() -); +/***/ }), -register( - SourceLocation, - CURRENT_MODULE, - "acorn/SourceLocation", - new (class SourceLocationSerializer { - /** - * @param {SourceLocation} loc the location to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(loc, { write }) { - write(loc.start.line); - write(loc.start.column); - write(loc.end.line); - write(loc.end.column); - } +/***/ 40777: +/***/ (function(module) { - /** - * @param {ObjectDeserializerContext} context context - * @returns {RealDependencyLocation} location - */ - deserialize({ read }) { - return { - start: { - line: read(), - column: read() - }, - end: { - line: read(), - column: read() - } - }; - } - })() -); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -register( - Position, - CURRENT_MODULE, - "acorn/Position", - new (class PositionSerializer { - /** - * @param {Position} pos the position to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(pos, { write }) { - write(pos.line); - write(pos.column); - } - /** - * @param {ObjectDeserializerContext} context context - * @returns {SourcePosition} position - */ - deserialize({ read }) { - return { - line: read(), - column: read() - }; - } - })() -); -register( - SourceMapSource, - CURRENT_MODULE, - "webpack-sources/SourceMapSource", - new (class SourceMapSourceSerializer { - /** - * @param {SourceMapSource} source the source map source to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(source, { write }) { - write(source.getArgsAsBuffers()); - } +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - /** - * @param {ObjectDeserializerContext} context context - * @returns {SourceMapSource} source source map source - */ - deserialize({ read }) { - // @ts-expect-error - return new SourceMapSource(...read()); - } - })() -); +module.exports = class NextPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string | ResolveStepHook} target target + */ + constructor(source, target) { + this.source = source; + this.target = target; + } -register( - ValidationError, - CURRENT_MODULE, - "schema-utils/ValidationError", - new (class ValidationErrorSerializer { - // TODO error should be ValidationError, but this fails the type checks - /** - * @param {TODO} error the source map source to be serialized - * @param {WebpackObjectSerializerContext} context context - * @returns {void} - */ - serialize(error, { write }) { - write(error.errors); - write(error.schema); - write({ - name: error.headerName, - baseDataPath: error.baseDataPath, - postFormatter: error.postFormatter + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("NextPlugin", (request, resolveContext, callback) => { + resolver.doResolve(target, request, null, resolveContext, callback); }); - } - - /** - * @param {ObjectDeserializerContext} context context - * @returns {TODO} error - */ - deserialize({ read }) { - return new ValidationError(read(), read(), read()); - } - })() -); + } +}; /***/ }), -/***/ 17156: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 97849: +/***/ (function(module) { "use strict"; /* @@ -135425,628 +135825,693 @@ register( -const SortableSet = __webpack_require__(13098); - -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Entrypoint").EntryOptions} EntryOptions */ - -/** @typedef {string | SortableSet | undefined} RuntimeSpec */ -/** @typedef {RuntimeSpec | boolean} RuntimeCondition */ +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -/** - * @param {Compilation} compilation the compilation - * @param {string} name name of the entry - * @param {EntryOptions=} options optionally already received entry options - * @returns {RuntimeSpec} runtime - */ -exports.getEntryRuntime = (compilation, name, options) => { - let dependOn; - let runtime; - if (options) { - ({ dependOn, runtime } = options); - } else { - const entry = compilation.entries.get(name); - if (!entry) return name; - ({ dependOn, runtime } = entry.options); +module.exports = class ParsePlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {Partial} requestOptions request options + * @param {string | ResolveStepHook} target target + */ + constructor(source, requestOptions, target) { + this.source = source; + this.requestOptions = requestOptions; + this.target = target; } - if (dependOn) { - /** @type {RuntimeSpec} */ - let result = undefined; - const queue = new Set(dependOn); - for (const name of queue) { - const dep = compilation.entries.get(name); - if (!dep) continue; - const { dependOn, runtime } = dep.options; - if (dependOn) { - for (const name of dependOn) { - queue.add(name); + + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("ParsePlugin", (request, resolveContext, callback) => { + const parsed = resolver.parse(/** @type {string} */ (request.request)); + const obj = { ...request, ...parsed, ...this.requestOptions }; + if (request.query && !parsed.query) { + obj.query = request.query; } - } else { - result = mergeRuntimeOwned(result, runtime || name); - } - } - return result || name; - } else { - return runtime || name; + if (request.fragment && !parsed.fragment) { + obj.fragment = request.fragment; + } + if (parsed && resolveContext.log) { + if (parsed.module) resolveContext.log("Parsed request is a module"); + if (parsed.directory) + resolveContext.log("Parsed request is a directory"); + } + // There is an edge-case where a request with # can be a path or a fragment -> try both + if (obj.request && !obj.query && obj.fragment) { + const directory = obj.fragment.endsWith("/"); + const alternative = { + ...obj, + directory, + request: + obj.request + + (obj.directory ? "/" : "") + + (directory ? obj.fragment.slice(0, -1) : obj.fragment), + fragment: "" + }; + resolver.doResolve( + target, + alternative, + null, + resolveContext, + (err, result) => { + if (err) return callback(err); + if (result) return callback(null, result); + resolver.doResolve(target, obj, null, resolveContext, callback); + } + ); + return; + } + resolver.doResolve(target, obj, null, resolveContext, callback); + }); } }; -/** - * @param {RuntimeSpec} runtime runtime - * @param {function(string): void} fn functor - * @param {boolean} deterministicOrder enforce a deterministic order - * @returns {void} - */ -exports.forEachRuntime = (runtime, fn, deterministicOrder = false) => { - if (runtime === undefined) { - fn(undefined); - } else if (typeof runtime === "string") { - fn(runtime); - } else { - if (deterministicOrder) runtime.sort(); - for (const r of runtime) { - fn(r); - } - } -}; -const getRuntimesKey = set => { - set.sort(); - return Array.from(set).join("\n"); -}; +/***/ }), -/** - * @param {RuntimeSpec} runtime runtime(s) - * @returns {string} key of runtimes - */ -const getRuntimeKey = runtime => { - if (runtime === undefined) return "*"; - if (typeof runtime === "string") return runtime; - return runtime.getFromUnorderedCache(getRuntimesKey); -}; -exports.getRuntimeKey = getRuntimeKey; +/***/ 44222: +/***/ (function(module) { -/** - * @param {string} key key of runtimes - * @returns {RuntimeSpec} runtime(s) - */ -const keyToRuntime = key => { - if (key === "*") return undefined; - const items = key.split("\n"); - if (items.length === 1) return items[0]; - return new SortableSet(items); -}; -exports.keyToRuntime = keyToRuntime; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Maël Nison @arcanis +*/ -const getRuntimesString = set => { - set.sort(); - return Array.from(set).join("+"); -}; -/** - * @param {RuntimeSpec} runtime runtime(s) - * @returns {string} readable version - */ -const runtimeToString = runtime => { - if (runtime === undefined) return "*"; - if (typeof runtime === "string") return runtime; - return runtime.getFromUnorderedCache(getRuntimesString); -}; -exports.runtimeToString = runtimeToString; +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ /** - * @param {RuntimeCondition} runtimeCondition runtime condition - * @returns {string} readable version + * @typedef {Object} PnpApiImpl + * @property {function(string, string, object): string} resolveToUnqualified */ -exports.runtimeConditionToString = runtimeCondition => { - if (runtimeCondition === true) return "true"; - if (runtimeCondition === false) return "false"; - return runtimeToString(runtimeCondition); -}; -/** - * @param {RuntimeSpec} a first - * @param {RuntimeSpec} b second - * @returns {boolean} true, when they are equal - */ -const runtimeEqual = (a, b) => { - if (a === b) { - return true; - } else if ( - a === undefined || - b === undefined || - typeof a === "string" || - typeof b === "string" - ) { - return false; - } else if (a.size !== b.size) { - return false; - } else { - a.sort(); - b.sort(); - const aIt = a[Symbol.iterator](); - const bIt = b[Symbol.iterator](); - for (;;) { - const aV = aIt.next(); - if (aV.done) return true; - const bV = bIt.next(); - if (aV.value !== bV.value) return false; - } +module.exports = class PnpPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {PnpApiImpl} pnpApi pnpApi + * @param {string | ResolveStepHook} target target + */ + constructor(source, pnpApi, target) { + this.source = source; + this.pnpApi = pnpApi; + this.target = target; } -}; -exports.runtimeEqual = runtimeEqual; -/** - * @param {RuntimeSpec} a first - * @param {RuntimeSpec} b second - * @returns {-1|0|1} compare - */ -exports.compareRuntime = (a, b) => { - if (a === b) { - return 0; - } else if (a === undefined) { - return -1; - } else if (b === undefined) { - return 1; - } else { - const aKey = getRuntimeKey(a); - const bKey = getRuntimeKey(b); - if (aKey < bKey) return -1; - if (aKey > bKey) return 1; - return 0; + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("PnpPlugin", (request, resolveContext, callback) => { + const req = request.request; + if (!req) return callback(); + + // The trailing slash indicates to PnP that this value is a folder rather than a file + const issuer = `${request.path}/`; + + const packageMatch = /^(@[^/]+\/)?[^/]+/.exec(req); + if (!packageMatch) return callback(); + + const packageName = packageMatch[0]; + const innerRequest = `.${req.slice(packageName.length)}`; + + let resolution; + let apiResolution; + try { + resolution = this.pnpApi.resolveToUnqualified(packageName, issuer, { + considerBuiltins: false + }); + if (resolveContext.fileDependencies) { + apiResolution = this.pnpApi.resolveToUnqualified("pnpapi", issuer, { + considerBuiltins: false + }); + } + } catch (error) { + if ( + error.code === "MODULE_NOT_FOUND" && + error.pnpCode === "UNDECLARED_DEPENDENCY" + ) { + // This is not a PnP managed dependency. + // Try to continue resolving with our alternatives + if (resolveContext.log) { + resolveContext.log(`request is not managed by the pnpapi`); + for (const line of error.message.split("\n").filter(Boolean)) + resolveContext.log(` ${line}`); + } + return callback(); + } + return callback(error); + } + + if (resolution === packageName) return callback(); + + if (apiResolution && resolveContext.fileDependencies) { + resolveContext.fileDependencies.add(apiResolution); + } + + const obj = { + ...request, + path: resolution, + request: innerRequest, + ignoreSymlinks: true, + fullySpecified: request.fullySpecified && innerRequest !== "." + }; + resolver.doResolve( + target, + obj, + `resolved by pnp to ${resolution}`, + resolveContext, + (err, result) => { + if (err) return callback(err); + if (result) return callback(null, result); + // Skip alternatives + return callback(null, null); + } + ); + }); } }; + +/***/ }), + +/***/ 55516: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +const { AsyncSeriesBailHook, AsyncSeriesHook, SyncHook } = __webpack_require__(6967); +const createInnerContext = __webpack_require__(81218); +const { parseIdentifier } = __webpack_require__(71053); +const { + normalize, + cachedJoin: join, + getType, + PathType +} = __webpack_require__(67079); + +/** @typedef {import("./ResolverFactory").ResolveOptions} ResolveOptions */ + /** - * @param {RuntimeSpec} a first - * @param {RuntimeSpec} b second - * @returns {RuntimeSpec} merged + * @typedef {Object} FileSystemStats + * @property {function(): boolean} isDirectory + * @property {function(): boolean} isFile */ -const mergeRuntime = (a, b) => { - if (a === undefined) { - return b; - } else if (b === undefined) { - return a; - } else if (a === b) { - return a; - } else if (typeof a === "string") { - if (typeof b === "string") { - const set = new SortableSet(); - set.add(a); - set.add(b); - return set; - } else if (b.has(a)) { - return b; - } else { - const set = new SortableSet(b); - set.add(a); - return set; - } - } else { - if (typeof b === "string") { - if (a.has(b)) return a; - const set = new SortableSet(a); - set.add(b); - return set; - } else { - const set = new SortableSet(a); - for (const item of b) set.add(item); - if (set.size === a.size) return a; - return set; - } - } -}; -exports.mergeRuntime = mergeRuntime; /** - * @param {RuntimeCondition} a first - * @param {RuntimeCondition} b second - * @param {RuntimeSpec} runtime full runtime - * @returns {RuntimeCondition} result + * @typedef {Object} FileSystemDirent + * @property {Buffer | string} name + * @property {function(): boolean} isDirectory + * @property {function(): boolean} isFile */ -exports.mergeRuntimeCondition = (a, b, runtime) => { - if (a === false) return b; - if (b === false) return a; - if (a === true || b === true) return true; - const merged = mergeRuntime(a, b); - if (merged === undefined) return undefined; - if (typeof merged === "string") { - if (typeof runtime === "string" && merged === runtime) return true; - return merged; - } - if (typeof runtime === "string" || runtime === undefined) return merged; - if (merged.size === runtime.size) return true; - return merged; -}; /** - * @param {RuntimeSpec | true} a first - * @param {RuntimeSpec | true} b second - * @param {RuntimeSpec} runtime full runtime - * @returns {RuntimeSpec | true} result + * @typedef {Object} PossibleFileSystemError + * @property {string=} code + * @property {number=} errno + * @property {string=} path + * @property {string=} syscall */ -exports.mergeRuntimeConditionNonFalse = (a, b, runtime) => { - if (a === true || b === true) return true; - const merged = mergeRuntime(a, b); - if (merged === undefined) return undefined; - if (typeof merged === "string") { - if (typeof runtime === "string" && merged === runtime) return true; - return merged; - } - if (typeof runtime === "string" || runtime === undefined) return merged; - if (merged.size === runtime.size) return true; - return merged; -}; /** - * @param {RuntimeSpec} a first (may be modified) - * @param {RuntimeSpec} b second - * @returns {RuntimeSpec} merged + * @template T + * @callback FileSystemCallback + * @param {PossibleFileSystemError & Error | null | undefined} err + * @param {T=} result */ -const mergeRuntimeOwned = (a, b) => { - if (b === undefined) { - return a; - } else if (a === b) { - return a; - } else if (a === undefined) { - if (typeof b === "string") { - return b; - } else { - return new SortableSet(b); - } - } else if (typeof a === "string") { - if (typeof b === "string") { - const set = new SortableSet(); - set.add(a); - set.add(b); - return set; - } else { - const set = new SortableSet(b); - set.add(a); - return set; - } - } else { - if (typeof b === "string") { - a.add(b); - return a; - } else { - for (const item of b) a.add(item); - return a; - } - } -}; -exports.mergeRuntimeOwned = mergeRuntimeOwned; /** - * @param {RuntimeSpec} a first - * @param {RuntimeSpec} b second - * @returns {RuntimeSpec} merged - */ -exports.intersectRuntime = (a, b) => { - if (a === undefined) { - return b; - } else if (b === undefined) { - return a; - } else if (a === b) { - return a; - } else if (typeof a === "string") { - if (typeof b === "string") { - return undefined; - } else if (b.has(a)) { - return a; - } else { - return undefined; - } - } else { - if (typeof b === "string") { - if (a.has(b)) return b; - return undefined; - } else { - const set = new SortableSet(); - for (const item of b) { - if (a.has(item)) set.add(item); - } - if (set.size === 0) return undefined; - if (set.size === 1) for (const item of set) return item; - return set; - } - } -}; + * @typedef {Object} FileSystem + * @property {(function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void} readFile + * @property {(function(string, FileSystemCallback<(Buffer | string)[] | FileSystemDirent[]>): void) & function(string, object, FileSystemCallback<(Buffer | string)[] | FileSystemDirent[]>): void} readdir + * @property {((function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void)=} readJson + * @property {(function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void} readlink + * @property {(function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void=} lstat + * @property {(function(string, FileSystemCallback): void) & function(string, object, FileSystemCallback): void} stat + */ /** - * @param {RuntimeSpec} a first - * @param {RuntimeSpec} b second - * @returns {RuntimeSpec} result + * @typedef {Object} SyncFileSystem + * @property {function(string, object=): Buffer | string} readFileSync + * @property {function(string, object=): (Buffer | string)[] | FileSystemDirent[]} readdirSync + * @property {(function(string, object=): object)=} readJsonSync + * @property {function(string, object=): Buffer | string} readlinkSync + * @property {function(string, object=): FileSystemStats=} lstatSync + * @property {function(string, object=): FileSystemStats} statSync */ -const subtractRuntime = (a, b) => { - if (a === undefined) { - return undefined; - } else if (b === undefined) { - return a; - } else if (a === b) { - return undefined; - } else if (typeof a === "string") { - if (typeof b === "string") { - return a; - } else if (b.has(a)) { - return undefined; - } else { - return a; - } - } else { - if (typeof b === "string") { - if (!a.has(b)) return a; - if (a.size === 2) { - for (const item of a) { - if (item !== b) return item; - } - } - const set = new SortableSet(a); - set.delete(b); - } else { - const set = new SortableSet(); - for (const item of a) { - if (!b.has(item)) set.add(item); - } - if (set.size === 0) return undefined; - if (set.size === 1) for (const item of set) return item; - return set; - } - } -}; -exports.subtractRuntime = subtractRuntime; /** - * @param {RuntimeCondition} a first - * @param {RuntimeCondition} b second - * @param {RuntimeSpec} runtime runtime - * @returns {RuntimeCondition} result + * @typedef {Object} ParsedIdentifier + * @property {string} request + * @property {string} query + * @property {string} fragment + * @property {boolean} directory + * @property {boolean} module + * @property {boolean} file + * @property {boolean} internal */ -exports.subtractRuntimeCondition = (a, b, runtime) => { - if (b === true) return false; - if (b === false) return a; - if (a === false) return false; - const result = subtractRuntime(a === true ? runtime : a, b); - return result === undefined ? false : result; -}; /** - * @param {RuntimeSpec} runtime runtime - * @param {function(RuntimeSpec): boolean} filter filter function - * @returns {boolean | RuntimeSpec} true/false if filter is constant for all runtimes, otherwise runtimes that are active + * @typedef {Object} BaseResolveRequest + * @property {string | false} path + * @property {string=} descriptionFilePath + * @property {string=} descriptionFileRoot + * @property {object=} descriptionFileData + * @property {string=} relativePath + * @property {boolean=} ignoreSymlinks + * @property {boolean=} fullySpecified */ -exports.filterRuntime = (runtime, filter) => { - if (runtime === undefined) return filter(undefined); - if (typeof runtime === "string") return filter(runtime); - let some = false; - let every = true; - let result = undefined; - for (const r of runtime) { - const v = filter(r); - if (v) { - some = true; - result = mergeRuntimeOwned(result, r); - } else { - every = false; - } - } - if (!some) return false; - if (every) return true; - return result; -}; + +/** @typedef {BaseResolveRequest & Partial} ResolveRequest */ /** - * @template T + * String with special formatting + * @typedef {string} StackEntry */ -class RuntimeSpecMap { + +/** @template T @typedef {{ add: (T) => void }} WriteOnlySet */ + +/** + * Resolve context + * @typedef {Object} ResolveContext + * @property {WriteOnlySet=} contextDependencies + * @property {WriteOnlySet=} fileDependencies files that was found on file system + * @property {WriteOnlySet=} missingDependencies dependencies that was not found on file system + * @property {Set=} stack set of hooks' calls. For instance, `resolve → parsedResolve → describedResolve`, + * @property {(function(string): void)=} log log function + * @property {(function (ResolveRequest): void)=} yield yield result, if provided plugins can return several results + */ + +/** @typedef {AsyncSeriesBailHook<[ResolveRequest, ResolveContext], ResolveRequest | null>} ResolveStepHook */ + +/** + * @param {string} str input string + * @returns {string} in camel case + */ +function toCamelCase(str) { + return str.replace(/-([a-z])/g, str => str.substr(1).toUpperCase()); +} + +class Resolver { /** - * @param {RuntimeSpecMap=} clone copy form this + * @param {ResolveStepHook} hook hook + * @param {ResolveRequest} request request + * @returns {StackEntry} stack entry */ - constructor(clone) { - this._mode = clone ? clone._mode : 0; // 0 = empty, 1 = single entry, 2 = map - /** @type {RuntimeSpec} */ - this._singleRuntime = clone ? clone._singleRuntime : undefined; - /** @type {T} */ - this._singleValue = clone ? clone._singleValue : undefined; - /** @type {Map | undefined} */ - this._map = clone && clone._map ? new Map(clone._map) : undefined; + static createStackEntry(hook, request) { + return ( + hook.name + + ": (" + + request.path + + ") " + + (request.request || "") + + (request.query || "") + + (request.fragment || "") + + (request.directory ? " directory" : "") + + (request.module ? " module" : "") + ); } /** - * @param {RuntimeSpec} runtime the runtimes - * @returns {T} value + * @param {FileSystem} fileSystem a filesystem + * @param {ResolveOptions} options options */ - get(runtime) { - switch (this._mode) { - case 0: - return undefined; - case 1: - return runtimeEqual(this._singleRuntime, runtime) - ? this._singleValue - : undefined; - default: - return this._map.get(getRuntimeKey(runtime)); - } + constructor(fileSystem, options) { + this.fileSystem = fileSystem; + this.options = options; + this.hooks = { + /** @type {SyncHook<[ResolveStepHook, ResolveRequest], void>} */ + resolveStep: new SyncHook(["hook", "request"], "resolveStep"), + /** @type {SyncHook<[ResolveRequest, Error]>} */ + noResolve: new SyncHook(["request", "error"], "noResolve"), + /** @type {ResolveStepHook} */ + resolve: new AsyncSeriesBailHook( + ["request", "resolveContext"], + "resolve" + ), + /** @type {AsyncSeriesHook<[ResolveRequest, ResolveContext]>} */ + result: new AsyncSeriesHook(["result", "resolveContext"], "result") + }; } /** - * @param {RuntimeSpec} runtime the runtimes - * @returns {boolean} true, when the runtime is stored + * @param {string | ResolveStepHook} name hook name or hook itself + * @returns {ResolveStepHook} the hook */ - has(runtime) { - switch (this._mode) { - case 0: - return false; - case 1: - return runtimeEqual(this._singleRuntime, runtime); - default: - return this._map.has(getRuntimeKey(runtime)); + ensureHook(name) { + if (typeof name !== "string") { + return name; + } + name = toCamelCase(name); + if (/^before/.test(name)) { + return /** @type {ResolveStepHook} */ (this.ensureHook( + name[6].toLowerCase() + name.substr(7) + ).withOptions({ + stage: -10 + })); + } + if (/^after/.test(name)) { + return /** @type {ResolveStepHook} */ (this.ensureHook( + name[5].toLowerCase() + name.substr(6) + ).withOptions({ + stage: 10 + })); + } + const hook = this.hooks[name]; + if (!hook) { + return (this.hooks[name] = new AsyncSeriesBailHook( + ["request", "resolveContext"], + name + )); } + return hook; } - set(runtime, value) { - switch (this._mode) { - case 0: - this._mode = 1; - this._singleRuntime = runtime; - this._singleValue = value; - break; - case 1: - if (runtimeEqual(this._singleRuntime, runtime)) { - this._singleValue = value; - break; - } - this._mode = 2; - this._map = new Map(); - this._map.set(getRuntimeKey(this._singleRuntime), this._singleValue); - this._singleRuntime = undefined; - this._singleValue = undefined; - /* falls through */ - default: - this._map.set(getRuntimeKey(runtime), value); + /** + * @param {string | ResolveStepHook} name hook name or hook itself + * @returns {ResolveStepHook} the hook + */ + getHook(name) { + if (typeof name !== "string") { + return name; + } + name = toCamelCase(name); + if (/^before/.test(name)) { + return /** @type {ResolveStepHook} */ (this.getHook( + name[6].toLowerCase() + name.substr(7) + ).withOptions({ + stage: -10 + })); + } + if (/^after/.test(name)) { + return /** @type {ResolveStepHook} */ (this.getHook( + name[5].toLowerCase() + name.substr(6) + ).withOptions({ + stage: 10 + })); + } + const hook = this.hooks[name]; + if (!hook) { + throw new Error(`Hook ${name} doesn't exist`); } + return hook; } - provide(runtime, computer) { - switch (this._mode) { - case 0: - this._mode = 1; - this._singleRuntime = runtime; - return (this._singleValue = computer()); - case 1: { - if (runtimeEqual(this._singleRuntime, runtime)) { - return this._singleValue; - } - this._mode = 2; - this._map = new Map(); - this._map.set(getRuntimeKey(this._singleRuntime), this._singleValue); - this._singleRuntime = undefined; - this._singleValue = undefined; - const newValue = computer(); - this._map.set(getRuntimeKey(runtime), newValue); - return newValue; - } - default: { - const key = getRuntimeKey(runtime); - const value = this._map.get(key); - if (value !== undefined) return value; - const newValue = computer(); - this._map.set(key, newValue); - return newValue; - } + /** + * @param {object} context context information object + * @param {string} path context path + * @param {string} request request string + * @returns {string | false} result + */ + resolveSync(context, path, request) { + /** @type {Error | null | undefined} */ + let err = undefined; + /** @type {string | false | undefined} */ + let result = undefined; + let sync = false; + this.resolve(context, path, request, {}, (e, r) => { + err = e; + result = r; + sync = true; + }); + if (!sync) { + throw new Error( + "Cannot 'resolveSync' because the fileSystem is not sync. Use 'resolve'!" + ); } + if (err) throw err; + if (result === undefined) throw new Error("No result"); + return result; } - delete(runtime) { - switch (this._mode) { - case 0: - return; - case 1: - if (runtimeEqual(this._singleRuntime, runtime)) { - this._mode = 0; - this._singleRuntime = undefined; - this._singleValue = undefined; - } - return; - default: - this._map.delete(getRuntimeKey(runtime)); + /** + * @param {object} context context information object + * @param {string} path context path + * @param {string} request request string + * @param {ResolveContext} resolveContext resolve context + * @param {function(Error | null, (string|false)=, ResolveRequest=): void} callback callback function + * @returns {void} + */ + resolve(context, path, request, resolveContext, callback) { + if (!context || typeof context !== "object") + return callback(new Error("context argument is not an object")); + if (typeof path !== "string") + return callback(new Error("path argument is not a string")); + if (typeof request !== "string") + return callback(new Error("path argument is not a string")); + if (!resolveContext) + return callback(new Error("resolveContext argument is not set")); + + const obj = { + context: context, + path: path, + request: request + }; + + let yield_; + let yieldCalled = false; + if (typeof resolveContext.yield === "function") { + const old = resolveContext.yield; + yield_ = obj => { + yieldCalled = true; + old(obj); + }; } - } - update(runtime, fn) { - switch (this._mode) { - case 0: - throw new Error("runtime passed to update must exist"); - case 1: { - if (runtimeEqual(this._singleRuntime, runtime)) { - this._singleValue = fn(this._singleValue); - break; + const message = `resolve '${request}' in '${path}'`; + + const finishResolved = result => { + return callback( + null, + result.path === false + ? false + : `${result.path.replace(/#/g, "\0#")}${ + result.query ? result.query.replace(/#/g, "\0#") : "" + }${result.fragment || ""}`, + result + ); + }; + + const finishWithoutResolve = log => { + /** + * @type {Error & {details?: string}} + */ + const error = new Error("Can't " + message); + error.details = log.join("\n"); + this.hooks.noResolve.call(obj, error); + return callback(error); + }; + + if (resolveContext.log) { + // We need log anyway to capture it in case of an error + const parentLog = resolveContext.log; + const log = []; + return this.doResolve( + this.hooks.resolve, + obj, + message, + { + log: msg => { + parentLog(msg); + log.push(msg); + }, + yield: yield_, + fileDependencies: resolveContext.fileDependencies, + contextDependencies: resolveContext.contextDependencies, + missingDependencies: resolveContext.missingDependencies, + stack: resolveContext.stack + }, + (err, result) => { + if (err) return callback(err); + + if (result) return finishResolved(result); + if (yieldCalled) return callback(null); + + return finishWithoutResolve(log); } - const newValue = fn(undefined); - if (newValue !== undefined) { - this._mode = 2; - this._map = new Map(); - this._map.set(getRuntimeKey(this._singleRuntime), this._singleValue); - this._singleRuntime = undefined; - this._singleValue = undefined; - this._map.set(getRuntimeKey(runtime), newValue); + ); + } else { + // Try to resolve assuming there is no error + // We don't log stuff in this case + return this.doResolve( + this.hooks.resolve, + obj, + message, + { + log: undefined, + yield: yield_, + fileDependencies: resolveContext.fileDependencies, + contextDependencies: resolveContext.contextDependencies, + missingDependencies: resolveContext.missingDependencies, + stack: resolveContext.stack + }, + (err, result) => { + if (err) return callback(err); + + if (result) return finishResolved(result); + if (yieldCalled) return callback(null); + + // log is missing for the error details + // so we redo the resolving for the log info + // this is more expensive to the success case + // is assumed by default + + const log = []; + + return this.doResolve( + this.hooks.resolve, + obj, + message, + { + log: msg => log.push(msg), + yield: yield_, + stack: resolveContext.stack + }, + err => { + if (err) return callback(err); + + // In a case that there is a race condition and yield will be called + if (yieldCalled) return callback(null); + + return finishWithoutResolve(log); + } + ); } - break; - } - default: { - const key = getRuntimeKey(runtime); - const oldValue = this._map.get(key); - const newValue = fn(oldValue); - if (newValue !== oldValue) this._map.set(key, newValue); + ); + } + } + + doResolve(hook, request, message, resolveContext, callback) { + const stackEntry = Resolver.createStackEntry(hook, request); + + let newStack; + if (resolveContext.stack) { + newStack = new Set(resolveContext.stack); + if (resolveContext.stack.has(stackEntry)) { + /** + * Prevent recursion + * @type {Error & {recursion?: boolean}} + */ + const recursionError = new Error( + "Recursion in resolving\nStack:\n " + + Array.from(newStack).join("\n ") + ); + recursionError.recursion = true; + if (resolveContext.log) + resolveContext.log("abort resolving because of recursion"); + return callback(recursionError); } + newStack.add(stackEntry); + } else { + newStack = new Set([stackEntry]); } - } + this.hooks.resolveStep.call(hook, request); - keys() { - switch (this._mode) { - case 0: - return []; - case 1: - return [this._singleRuntime]; - default: - return Array.from(this._map.keys(), keyToRuntime); + if (hook.isUsed()) { + const innerContext = createInnerContext( + { + log: resolveContext.log, + yield: resolveContext.yield, + fileDependencies: resolveContext.fileDependencies, + contextDependencies: resolveContext.contextDependencies, + missingDependencies: resolveContext.missingDependencies, + stack: newStack + }, + message + ); + return hook.callAsync(request, innerContext, (err, result) => { + if (err) return callback(err); + if (result) return callback(null, result); + callback(); + }); + } else { + callback(); } } - values() { - switch (this._mode) { - case 0: - return [][Symbol.iterator](); - case 1: - return [this._singleValue][Symbol.iterator](); - default: - return this._map.values(); - } - } + /** + * @param {string} identifier identifier + * @returns {ParsedIdentifier} parsed identifier + */ + parse(identifier) { + const part = { + request: "", + query: "", + fragment: "", + module: false, + directory: false, + file: false, + internal: false + }; - get size() { - if (this._mode <= 1) return this._mode; - return this._map.size; - } -} + const parsedIdentifier = parseIdentifier(identifier); -exports.RuntimeSpecMap = RuntimeSpecMap; + if (!parsedIdentifier) return part; -class RuntimeSpecSet { - constructor(iterable) { - /** @type {Map} */ - this._map = new Map(); - if (iterable) { - for (const item of iterable) { - this.add(item); + [part.request, part.query, part.fragment] = parsedIdentifier; + + if (part.request.length > 0) { + part.internal = this.isPrivate(identifier); + part.module = this.isModule(part.request); + part.directory = this.isDirectory(part.request); + if (part.directory) { + part.request = part.request.substr(0, part.request.length - 1); } } + + return part; } - add(runtime) { - this._map.set(getRuntimeKey(runtime), runtime); + isModule(path) { + return getType(path) === PathType.Normal; } - has(runtime) { - return this._map.has(getRuntimeKey(runtime)); + isPrivate(path) { + return getType(path) === PathType.Internal; } - [Symbol.iterator]() { - return this._map.values(); + /** + * @param {string} path a path + * @returns {boolean} true, if the path is a directory path + */ + isDirectory(path) { + return path.endsWith("/"); } - get size() { - return this._map.size; + join(path, request) { + return join(path, request); + } + + normalize(path) { + return normalize(path); } } -exports.RuntimeSpecSet = RuntimeSpecSet; +module.exports = Resolver; /***/ }), -/***/ 19702: -/***/ (function(__unused_webpack_module, exports) { +/***/ 47716: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -136056,624 +136521,738 @@ exports.RuntimeSpecSet = RuntimeSpecSet; -/** @typedef {(string|number|undefined|[])[]} SemVerRange */ +const versions = (__webpack_require__(77282).versions); +const Resolver = __webpack_require__(55516); +const { getType, PathType } = __webpack_require__(67079); + +const SyncAsyncFileSystemDecorator = __webpack_require__(87474); + +const AliasFieldPlugin = __webpack_require__(14819); +const AliasPlugin = __webpack_require__(63676); +const AppendPlugin = __webpack_require__(92088); +const ConditionalPlugin = __webpack_require__(6953); +const DescriptionFilePlugin = __webpack_require__(44112); +const DirectoryExistsPlugin = __webpack_require__(60895); +const ExportsFieldPlugin = __webpack_require__(83849); +const FileExistsPlugin = __webpack_require__(50295); +const ImportsFieldPlugin = __webpack_require__(7317); +const JoinRequestPartPlugin = __webpack_require__(35949); +const JoinRequestPlugin = __webpack_require__(5190); +const MainFieldPlugin = __webpack_require__(47450); +const ModulesInHierarchicalDirectoriesPlugin = __webpack_require__(79024); +const ModulesInRootPlugin = __webpack_require__(88138); +const NextPlugin = __webpack_require__(40777); +const ParsePlugin = __webpack_require__(97849); +const PnpPlugin = __webpack_require__(44222); +const RestrictionsPlugin = __webpack_require__(36400); +const ResultPlugin = __webpack_require__(13965); +const RootsPlugin = __webpack_require__(66737); +const SelfReferencePlugin = __webpack_require__(52232); +const SymlinkPlugin = __webpack_require__(58885); +const TryNextPlugin = __webpack_require__(99324); +const UnsafeCachePlugin = __webpack_require__(41606); +const UseFilePlugin = __webpack_require__(96972); + +/** @typedef {import("./AliasPlugin").AliasOption} AliasOptionEntry */ +/** @typedef {import("./PnpPlugin").PnpApiImpl} PnpApi */ +/** @typedef {import("./Resolver").FileSystem} FileSystem */ +/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ +/** @typedef {import("./Resolver").SyncFileSystem} SyncFileSystem */ + +/** @typedef {string|string[]|false} AliasOptionNewRequest */ +/** @typedef {{[k: string]: AliasOptionNewRequest}} AliasOptions */ +/** @typedef {{apply: function(Resolver): void} | function(this: Resolver, Resolver): void} Plugin */ /** - * @param {string} str version string - * @returns {(string|number|undefined|[])[]} parsed version + * @typedef {Object} UserResolveOptions + * @property {(AliasOptions | AliasOptionEntry[])=} alias A list of module alias configurations or an object which maps key to value + * @property {(AliasOptions | AliasOptionEntry[])=} fallback A list of module alias configurations or an object which maps key to value, applied only after modules option + * @property {(string | string[])[]=} aliasFields A list of alias fields in description files + * @property {(function(ResolveRequest): boolean)=} cachePredicate A function which decides whether a request should be cached or not. An object is passed with at least `path` and `request` properties. + * @property {boolean=} cacheWithContext Whether or not the unsafeCache should include request context as part of the cache key. + * @property {string[]=} descriptionFiles A list of description files to read from + * @property {string[]=} conditionNames A list of exports field condition names. + * @property {boolean=} enforceExtension Enforce that a extension from extensions must be used + * @property {(string | string[])[]=} exportsFields A list of exports fields in description files + * @property {(string | string[])[]=} importsFields A list of imports fields in description files + * @property {string[]=} extensions A list of extensions which should be tried for files + * @property {FileSystem} fileSystem The file system which should be used + * @property {(object | boolean)=} unsafeCache Use this cache object to unsafely cache the successful requests + * @property {boolean=} symlinks Resolve symlinks to their symlinked location + * @property {Resolver=} resolver A prepared Resolver to which the plugins are attached + * @property {string[] | string=} modules A list of directories to resolve modules from, can be absolute path or folder name + * @property {(string | string[] | {name: string | string[], forceRelative: boolean})[]=} mainFields A list of main fields in description files + * @property {string[]=} mainFiles A list of main files in directories + * @property {Plugin[]=} plugins A list of additional resolve plugins which should be applied + * @property {PnpApi | null=} pnpApi A PnP API that should be used - null is "never", undefined is "auto" + * @property {string[]=} roots A list of root paths + * @property {boolean=} fullySpecified The request is already fully specified and no extensions or directories are resolved for it + * @property {boolean=} resolveToContext Resolve to a context instead of a file + * @property {(string|RegExp)[]=} restrictions A list of resolve restrictions + * @property {boolean=} useSyncFileSystemCalls Use only the sync constraints of the file system calls + * @property {boolean=} preferRelative Prefer to resolve module requests as relative requests before falling back to modules + * @property {boolean=} preferAbsolute Prefer to resolve server-relative urls as absolute paths before falling back to resolve in roots */ -const parseVersion = str => { - var splitAndConvert = function (str) { - return str.split(".").map(function (item) { - // eslint-disable-next-line eqeqeq - return +item == item ? +item : item; - }); - }; - var match = /^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(str); - /** @type {(string|number|undefined|[])[]} */ - var ver = match[1] ? splitAndConvert(match[1]) : []; - if (match[2]) { - ver.length++; - ver.push.apply(ver, splitAndConvert(match[2])); + +/** + * @typedef {Object} ResolveOptions + * @property {AliasOptionEntry[]} alias + * @property {AliasOptionEntry[]} fallback + * @property {Set} aliasFields + * @property {(function(ResolveRequest): boolean)} cachePredicate + * @property {boolean} cacheWithContext + * @property {Set} conditionNames A list of exports field condition names. + * @property {string[]} descriptionFiles + * @property {boolean} enforceExtension + * @property {Set} exportsFields + * @property {Set} importsFields + * @property {Set} extensions + * @property {FileSystem} fileSystem + * @property {object | false} unsafeCache + * @property {boolean} symlinks + * @property {Resolver=} resolver + * @property {Array} modules + * @property {{name: string[], forceRelative: boolean}[]} mainFields + * @property {Set} mainFiles + * @property {Plugin[]} plugins + * @property {PnpApi | null} pnpApi + * @property {Set} roots + * @property {boolean} fullySpecified + * @property {boolean} resolveToContext + * @property {Set} restrictions + * @property {boolean} preferRelative + * @property {boolean} preferAbsolute + */ + +/** + * @param {PnpApi | null=} option option + * @returns {PnpApi | null} processed option + */ +function processPnpApiOption(option) { + if ( + option === undefined && + /** @type {NodeJS.ProcessVersions & {pnp: string}} */ versions.pnp + ) { + // @ts-ignore + return __webpack_require__(35125); // eslint-disable-line node/no-missing-require } - if (match[3]) { - ver.push([]); - ver.push.apply(ver, splitAndConvert(match[3])); + + return option || null; +} + +/** + * @param {AliasOptions | AliasOptionEntry[] | undefined} alias alias + * @returns {AliasOptionEntry[]} normalized aliases + */ +function normalizeAlias(alias) { + return typeof alias === "object" && !Array.isArray(alias) && alias !== null + ? Object.keys(alias).map(key => { + /** @type {AliasOptionEntry} */ + const obj = { name: key, onlyModule: false, alias: alias[key] }; + + if (/\$$/.test(key)) { + obj.onlyModule = true; + obj.name = key.substr(0, key.length - 1); + } + + return obj; + }) + : /** @type {Array} */ (alias) || []; +} + +/** + * @param {UserResolveOptions} options input options + * @returns {ResolveOptions} output options + */ +function createOptions(options) { + const mainFieldsSet = new Set(options.mainFields || ["main"]); + const mainFields = []; + + for (const item of mainFieldsSet) { + if (typeof item === "string") { + mainFields.push({ + name: [item], + forceRelative: true + }); + } else if (Array.isArray(item)) { + mainFields.push({ + name: item, + forceRelative: true + }); + } else { + mainFields.push({ + name: Array.isArray(item.name) ? item.name : [item.name], + forceRelative: item.forceRelative + }); + } } - return ver; -}; -exports.parseVersion = parseVersion; -/* eslint-disable eqeqeq */ + return { + alias: normalizeAlias(options.alias), + fallback: normalizeAlias(options.fallback), + aliasFields: new Set(options.aliasFields), + cachePredicate: + options.cachePredicate || + function () { + return true; + }, + cacheWithContext: + typeof options.cacheWithContext !== "undefined" + ? options.cacheWithContext + : true, + exportsFields: new Set(options.exportsFields || ["exports"]), + importsFields: new Set(options.importsFields || ["imports"]), + conditionNames: new Set(options.conditionNames), + descriptionFiles: Array.from( + new Set(options.descriptionFiles || ["package.json"]) + ), + enforceExtension: + options.enforceExtension === undefined + ? options.extensions && options.extensions.includes("") + ? true + : false + : options.enforceExtension, + extensions: new Set(options.extensions || [".js", ".json", ".node"]), + fileSystem: options.useSyncFileSystemCalls + ? new SyncAsyncFileSystemDecorator( + /** @type {SyncFileSystem} */ ( + /** @type {unknown} */ (options.fileSystem) + ) + ) + : options.fileSystem, + unsafeCache: + options.unsafeCache && typeof options.unsafeCache !== "object" + ? {} + : options.unsafeCache || false, + symlinks: typeof options.symlinks !== "undefined" ? options.symlinks : true, + resolver: options.resolver, + modules: mergeFilteredToArray( + Array.isArray(options.modules) + ? options.modules + : options.modules + ? [options.modules] + : ["node_modules"], + item => { + const type = getType(item); + return type === PathType.Normal || type === PathType.Relative; + } + ), + mainFields, + mainFiles: new Set(options.mainFiles || ["index"]), + plugins: options.plugins || [], + pnpApi: processPnpApiOption(options.pnpApi), + roots: new Set(options.roots || undefined), + fullySpecified: options.fullySpecified || false, + resolveToContext: options.resolveToContext || false, + preferRelative: options.preferRelative || false, + preferAbsolute: options.preferAbsolute || false, + restrictions: new Set(options.restrictions) + }; +} + /** - * @param {string} a version - * @param {string} b version - * @returns {boolean} true, iff a < b + * @param {UserResolveOptions} options resolve options + * @returns {Resolver} created resolver */ -const versionLt = (a, b) => { - // @ts-expect-error - a = parseVersion(a); - // @ts-expect-error - b = parseVersion(b); - var i = 0; - for (;;) { - // a b EOA object undefined number string - // EOA a == b a < b b < a a < b a < b - // object b < a (0) b < a a < b a < b - // undefined a < b a < b (0) a < b a < b - // number b < a b < a b < a (1) a < b - // string b < a b < a b < a b < a (1) - // EOA end of array - // (0) continue on - // (1) compare them via "<" +exports.createResolver = function (options) { + const normalizedOptions = createOptions(options); - // Handles first row in table - if (i >= a.length) return i < b.length && (typeof b[i])[0] != "u"; + const { + alias, + fallback, + aliasFields, + cachePredicate, + cacheWithContext, + conditionNames, + descriptionFiles, + enforceExtension, + exportsFields, + importsFields, + extensions, + fileSystem, + fullySpecified, + mainFields, + mainFiles, + modules, + plugins: userPlugins, + pnpApi, + resolveToContext, + preferRelative, + preferAbsolute, + symlinks, + unsafeCache, + resolver: customResolver, + restrictions, + roots + } = normalizedOptions; - var aValue = a[i]; - var aType = (typeof aValue)[0]; + const plugins = userPlugins.slice(); - // Handles first column in table - if (i >= b.length) return aType == "u"; + const resolver = customResolver + ? customResolver + : new Resolver(fileSystem, normalizedOptions); - var bValue = b[i]; - var bType = (typeof bValue)[0]; + //// pipeline //// + + resolver.ensureHook("resolve"); + resolver.ensureHook("internalResolve"); + resolver.ensureHook("newInternalResolve"); + resolver.ensureHook("parsedResolve"); + resolver.ensureHook("describedResolve"); + resolver.ensureHook("internal"); + resolver.ensureHook("rawModule"); + resolver.ensureHook("module"); + resolver.ensureHook("resolveAsModule"); + resolver.ensureHook("undescribedResolveInPackage"); + resolver.ensureHook("resolveInPackage"); + resolver.ensureHook("resolveInExistingDirectory"); + resolver.ensureHook("relative"); + resolver.ensureHook("describedRelative"); + resolver.ensureHook("directory"); + resolver.ensureHook("undescribedExistingDirectory"); + resolver.ensureHook("existingDirectory"); + resolver.ensureHook("undescribedRawFile"); + resolver.ensureHook("rawFile"); + resolver.ensureHook("file"); + resolver.ensureHook("finalFile"); + resolver.ensureHook("existingFile"); + resolver.ensureHook("resolved"); + + // TODO remove in next major + // cspell:word Interal + // Backward-compat + resolver.hooks.newInteralResolve = resolver.hooks.newInternalResolve; + + // resolve + for (const { source, resolveOptions } of [ + { source: "resolve", resolveOptions: { fullySpecified } }, + { source: "internal-resolve", resolveOptions: { fullySpecified: false } } + ]) { + if (unsafeCache) { + plugins.push( + new UnsafeCachePlugin( + source, + cachePredicate, + unsafeCache, + cacheWithContext, + `new-${source}` + ) + ); + plugins.push( + new ParsePlugin(`new-${source}`, resolveOptions, "parsed-resolve") + ); + } else { + plugins.push(new ParsePlugin(source, resolveOptions, "parsed-resolve")); + } + } + + // parsed-resolve + plugins.push( + new DescriptionFilePlugin( + "parsed-resolve", + descriptionFiles, + false, + "described-resolve" + ) + ); + plugins.push(new NextPlugin("after-parsed-resolve", "described-resolve")); + + // described-resolve + plugins.push(new NextPlugin("described-resolve", "normal-resolve")); + if (fallback.length > 0) { + plugins.push( + new AliasPlugin("described-resolve", fallback, "internal-resolve") + ); + } + + // normal-resolve + if (alias.length > 0) + plugins.push(new AliasPlugin("normal-resolve", alias, "internal-resolve")); + aliasFields.forEach(item => { + plugins.push( + new AliasFieldPlugin("normal-resolve", item, "internal-resolve") + ); + }); + if (preferRelative) { + plugins.push(new JoinRequestPlugin("after-normal-resolve", "relative")); + } + plugins.push( + new ConditionalPlugin( + "after-normal-resolve", + { module: true }, + "resolve as module", + false, + "raw-module" + ) + ); + plugins.push( + new ConditionalPlugin( + "after-normal-resolve", + { internal: true }, + "resolve as internal import", + false, + "internal" + ) + ); + if (preferAbsolute) { + plugins.push(new JoinRequestPlugin("after-normal-resolve", "relative")); + } + if (roots.size > 0) { + plugins.push(new RootsPlugin("after-normal-resolve", roots, "relative")); + } + if (!preferRelative && !preferAbsolute) { + plugins.push(new JoinRequestPlugin("after-normal-resolve", "relative")); + } + + // internal + importsFields.forEach(importsField => { + plugins.push( + new ImportsFieldPlugin( + "internal", + conditionNames, + importsField, + "relative", + "internal-resolve" + ) + ); + }); - if (aType == bType) { - if (aType != "o" && aType != "u" && aValue != bValue) { - return aValue < bValue; + // raw-module + exportsFields.forEach(exportsField => { + plugins.push( + new SelfReferencePlugin("raw-module", exportsField, "resolve-as-module") + ); + }); + modules.forEach(item => { + if (Array.isArray(item)) { + if (item.includes("node_modules") && pnpApi) { + plugins.push( + new ModulesInHierarchicalDirectoriesPlugin( + "raw-module", + item.filter(i => i !== "node_modules"), + "module" + ) + ); + plugins.push( + new PnpPlugin("raw-module", pnpApi, "undescribed-resolve-in-package") + ); + } else { + plugins.push( + new ModulesInHierarchicalDirectoriesPlugin( + "raw-module", + item, + "module" + ) + ); } - i++; } else { - // Handles remaining cases - if (aType == "o" && bType == "n") return true; - return bType == "s" || aType == "u"; + plugins.push(new ModulesInRootPlugin("raw-module", item, "module")); } - } -}; -/* eslint-enable eqeqeq */ -exports.versionLt = versionLt; + }); -/** - * @param {string} str range string - * @returns {SemVerRange} parsed range - */ -exports.parseRange = str => { - const splitAndConvert = str => { - return str - .split(".") - .map(item => (item !== "NaN" && `${+item}` === item ? +item : item)); - }; - // see https://docs.npmjs.com/misc/semver#range-grammar for grammar - const parsePartial = str => { - const match = /^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(str); - /** @type {(string|number|undefined|[])[]} */ - const ver = match[1] ? [0, ...splitAndConvert(match[1])] : [0]; - if (match[2]) { - ver.length++; - ver.push.apply(ver, splitAndConvert(match[2])); - } + // module + plugins.push(new JoinRequestPartPlugin("module", "resolve-as-module")); - // remove trailing any matchers - let last = ver[ver.length - 1]; - while ( - ver.length && - (last === undefined || /^[*xX]$/.test(/** @type {string} */ (last))) - ) { - ver.pop(); - last = ver[ver.length - 1]; - } + // resolve-as-module + if (!resolveToContext) { + plugins.push( + new ConditionalPlugin( + "resolve-as-module", + { directory: false, request: "." }, + "single file module", + true, + "undescribed-raw-file" + ) + ); + } + plugins.push( + new DirectoryExistsPlugin( + "resolve-as-module", + "undescribed-resolve-in-package" + ) + ); - return ver; - }; - const toFixed = range => { - if (range.length === 1) { - // Special case for "*" is "x.x.x" instead of "=" - return [0]; - } else if (range.length === 2) { - // Special case for "1" is "1.x.x" instead of "=1" - return [1, ...range.slice(1)]; - } else if (range.length === 3) { - // Special case for "1.2" is "1.2.x" instead of "=1.2" - return [2, ...range.slice(1)]; - } else { - return [range.length, ...range.slice(1)]; - } - }; - const negate = range => { - return [-range[0] - 1, ...range.slice(1)]; - }; - const parseSimple = str => { - // simple ::= primitive | partial | tilde | caret - // primitive ::= ( '<' | '>' | '>=' | '<=' | '=' | '!' ) ( ' ' ) * partial - // tilde ::= '~' ( ' ' ) * partial - // caret ::= '^' ( ' ' ) * partial - const match = /^(\^|~|<=|<|>=|>|=|v|!)/.exec(str); - const start = match ? match[0] : ""; - const remainder = parsePartial( - start.length ? str.slice(start.length).trim() : str.trim() + // undescribed-resolve-in-package + plugins.push( + new DescriptionFilePlugin( + "undescribed-resolve-in-package", + descriptionFiles, + false, + "resolve-in-package" + ) + ); + plugins.push( + new NextPlugin("after-undescribed-resolve-in-package", "resolve-in-package") + ); + + // resolve-in-package + exportsFields.forEach(exportsField => { + plugins.push( + new ExportsFieldPlugin( + "resolve-in-package", + conditionNames, + exportsField, + "relative" + ) ); - switch (start) { - case "^": - if (remainder.length > 1 && remainder[1] === 0) { - if (remainder.length > 2 && remainder[2] === 0) { - return [3, ...remainder.slice(1)]; - } - return [2, ...remainder.slice(1)]; - } - return [1, ...remainder.slice(1)]; - case "~": - return [2, ...remainder.slice(1)]; - case ">=": - return remainder; - case "=": - case "v": - case "": - return toFixed(remainder); - case "<": - return negate(remainder); - case ">": { - // and( >=, not( = ) ) => >=, =, not, and - const fixed = toFixed(remainder); - // eslint-disable-next-line no-sparse-arrays - return [, fixed, 0, remainder, 2]; - } - case "<=": - // or( <, = ) => <, =, or - // eslint-disable-next-line no-sparse-arrays - return [, toFixed(remainder), negate(remainder), 1]; - case "!": { - // not = - const fixed = toFixed(remainder); - // eslint-disable-next-line no-sparse-arrays - return [, fixed, 0]; - } - default: - throw new Error("Unexpected start value"); - } - }; - const combine = (items, fn) => { - if (items.length === 1) return items[0]; - const arr = []; - for (const item of items.slice().reverse()) { - if (0 in item) { - arr.push(item); - } else { - arr.push(...item.slice(1)); - } - } - // eslint-disable-next-line no-sparse-arrays - return [, ...arr, ...items.slice(1).map(() => fn)]; - }; - const parseRange = str => { - // range ::= hyphen | simple ( ' ' ( ' ' ) * simple ) * | '' - // hyphen ::= partial ( ' ' ) * ' - ' ( ' ' ) * partial - const items = str.split(/\s+-\s+/); - if (items.length === 1) { - const items = str - .trim() - .split(/(?<=[-0-9A-Za-z])\s+/g) - .map(parseSimple); - return combine(items, 2); - } - const a = parsePartial(items[0]); - const b = parsePartial(items[1]); - // >=a <=b => and( >=a, or( >=a, { - // range-set ::= range ( logical-or range ) * - // logical-or ::= ( ' ' ) * '||' ( ' ' ) * - const items = str.split(/\s*\|\|\s*/).map(parseRange); - return combine(items, 1); - }; - return parseLogicalOr(str); -}; + }); + plugins.push( + new NextPlugin("resolve-in-package", "resolve-in-existing-directory") + ); -/* eslint-disable eqeqeq */ -const rangeToString = range => { - var fixCount = range[0]; - var str = ""; - if (range.length === 1) { - return "*"; - } else if (fixCount + 0.5) { - str += - fixCount == 0 - ? ">=" - : fixCount == -1 - ? "<" - : fixCount == 1 - ? "^" - : fixCount == 2 - ? "~" - : fixCount > 0 - ? "=" - : "!="; - var needDot = 1; - // eslint-disable-next-line no-redeclare - for (var i = 1; i < range.length; i++) { - var item = range[i]; - var t = (typeof item)[0]; - needDot--; - str += - t == "u" - ? // undefined: prerelease marker, add an "-" - "-" - : // number or string: add the item, set flag to add an "." between two of them - (needDot > 0 ? "." : "") + ((needDot = 2), item); - } - return str; - } else { - var stack = []; - // eslint-disable-next-line no-redeclare - for (var i = 1; i < range.length; i++) { - // eslint-disable-next-line no-redeclare - var item = range[i]; - stack.push( - item === 0 - ? "not(" + pop() + ")" - : item === 1 - ? "(" + pop() + " || " + pop() + ")" - : item === 2 - ? stack.pop() + " " + stack.pop() - : rangeToString(item) - ); - } - return pop(); - } - function pop() { - return stack.pop().replace(/^\((.+)\)$/, "$1"); - } -}; -/* eslint-enable eqeqeq */ -exports.rangeToString = rangeToString; + // resolve-in-existing-directory + plugins.push( + new JoinRequestPlugin("resolve-in-existing-directory", "relative") + ); -/* eslint-disable eqeqeq */ -/** - * @param {SemVerRange} range version range - * @param {string} version the version - * @returns {boolean} if version satisfy the range - */ -const satisfy = (range, version) => { - if (0 in range) { - // @ts-expect-error - version = parseVersion(version); - var fixCount = range[0]; - // when negated is set it swill set for < instead of >= - var negated = fixCount < 0; - if (negated) fixCount = -fixCount - 1; - for (var i = 0, j = 1, isEqual = true; ; j++, i++) { - // cspell:word nequal nequ + // relative + plugins.push( + new DescriptionFilePlugin( + "relative", + descriptionFiles, + true, + "described-relative" + ) + ); + plugins.push(new NextPlugin("after-relative", "described-relative")); - // when isEqual = true: - // range version: EOA/object undefined number string - // EOA equal block big-ver big-ver - // undefined bigger next big-ver big-ver - // number smaller block cmp big-cmp - // fixed number smaller block cmp-fix differ - // string smaller block differ cmp - // fixed string smaller block small-cmp cmp-fix + // described-relative + if (resolveToContext) { + plugins.push(new NextPlugin("described-relative", "directory")); + } else { + plugins.push( + new ConditionalPlugin( + "described-relative", + { directory: false }, + null, + true, + "raw-file" + ) + ); + plugins.push( + new ConditionalPlugin( + "described-relative", + { fullySpecified: false }, + "as directory", + true, + "directory" + ) + ); + } - // when isEqual = false: - // range version: EOA/object undefined number string - // EOA nequal block next-ver next-ver - // undefined nequal block next-ver next-ver - // number nequal block next next - // fixed number nequal block next next (this never happens) - // string nequal block next next - // fixed string nequal block next next (this never happens) + // directory + plugins.push( + new DirectoryExistsPlugin("directory", "undescribed-existing-directory") + ); - // EOA end of array - // equal (version is equal range): - // when !negated: return true, - // when negated: return false - // bigger (version is bigger as range): - // when fixed: return false, - // when !negated: return true, - // when negated: return false, - // smaller (version is smaller as range): - // when !negated: return false, - // when negated: return true - // nequal (version is not equal range (> resp <)): return true - // block (version is in different prerelease area): return false - // differ (version is different from fixed range (string vs. number)): return false - // next: continues to the next items - // next-ver: when fixed: return false, continues to the next item only for the version, sets isEqual=false - // big-ver: when fixed || negated: return false, continues to the next item only for the version, sets isEqual=false - // next-nequ: continues to the next items, sets isEqual=false - // cmp (negated === false): version < range => return false, version > range => next-nequ, else => next - // cmp (negated === true): version > range => return false, version < range => next-nequ, else => next - // cmp-fix: version == range => next, else => return false - // big-cmp: when negated => return false, else => next-nequ - // small-cmp: when negated => next-nequ, else => return false + if (resolveToContext) { + // undescribed-existing-directory + plugins.push(new NextPlugin("undescribed-existing-directory", "resolved")); + } else { + // undescribed-existing-directory + plugins.push( + new DescriptionFilePlugin( + "undescribed-existing-directory", + descriptionFiles, + false, + "existing-directory" + ) + ); + mainFiles.forEach(item => { + plugins.push( + new UseFilePlugin( + "undescribed-existing-directory", + item, + "undescribed-raw-file" + ) + ); + }); - var rangeType = j < range.length ? (typeof range[j])[0] : ""; + // described-existing-directory + mainFields.forEach(item => { + plugins.push( + new MainFieldPlugin( + "existing-directory", + item, + "resolve-in-existing-directory" + ) + ); + }); + mainFiles.forEach(item => { + plugins.push( + new UseFilePlugin("existing-directory", item, "undescribed-raw-file") + ); + }); - var versionValue; - var versionType; + // undescribed-raw-file + plugins.push( + new DescriptionFilePlugin( + "undescribed-raw-file", + descriptionFiles, + true, + "raw-file" + ) + ); + plugins.push(new NextPlugin("after-undescribed-raw-file", "raw-file")); - // Handles first column in both tables (end of version or object) - if ( - i >= version.length || - ((versionValue = version[i]), - (versionType = (typeof versionValue)[0]) == "o") - ) { - // Handles nequal - if (!isEqual) return true; - // Handles bigger - if (rangeType == "u") return j > fixCount && !negated; - // Handles equal and smaller: (range === EOA) XOR negated - return (rangeType == "") != negated; // equal + smaller - } + // raw-file + plugins.push( + new ConditionalPlugin( + "raw-file", + { fullySpecified: true }, + null, + false, + "file" + ) + ); + if (!enforceExtension) { + plugins.push(new TryNextPlugin("raw-file", "no extension", "file")); + } + extensions.forEach(item => { + plugins.push(new AppendPlugin("raw-file", item, "file")); + }); - // Handles second column in both tables (version = undefined) - if (versionType == "u") { - if (!isEqual || rangeType != "u") { - return false; - } - } + // file + if (alias.length > 0) + plugins.push(new AliasPlugin("file", alias, "internal-resolve")); + aliasFields.forEach(item => { + plugins.push(new AliasFieldPlugin("file", item, "internal-resolve")); + }); + plugins.push(new NextPlugin("file", "final-file")); - // switch between first and second table - else if (isEqual) { - // Handle diagonal - if (rangeType == versionType) { - if (j <= fixCount) { - // Handles "cmp-fix" cases - if (versionValue != range[j]) { - return false; - } - } else { - // Handles "cmp" cases - if (negated ? versionValue > range[j] : versionValue < range[j]) { - return false; - } - if (versionValue != range[j]) isEqual = false; - } - } + // final-file + plugins.push(new FileExistsPlugin("final-file", "existing-file")); - // Handle big-ver - else if (rangeType != "s" && rangeType != "n") { - if (negated || j <= fixCount) return false; - isEqual = false; - j--; - } + // existing-file + if (symlinks) + plugins.push(new SymlinkPlugin("existing-file", "existing-file")); + plugins.push(new NextPlugin("existing-file", "resolved")); + } - // Handle differ, big-cmp and small-cmp - else if (j <= fixCount || versionType < rangeType != negated) { - return false; - } else { - isEqual = false; - } - } else { - // Handles all "next-ver" cases in the second table - if (rangeType != "s" && rangeType != "n") { - isEqual = false; - j--; - } + // resolved + if (restrictions.size > 0) { + plugins.push(new RestrictionsPlugin(resolver.hooks.resolved, restrictions)); + } + plugins.push(new ResultPlugin(resolver.hooks.resolved)); - // next is applied by default - } + //// RESOLVER //// + + for (const plugin of plugins) { + if (typeof plugin === "function") { + plugin.call(resolver, resolver); + } else { + plugin.apply(resolver); } } - /** @type {(boolean | number)[]} */ - var stack = []; - var p = stack.pop.bind(stack); - // eslint-disable-next-line no-redeclare - for (var i = 1; i < range.length; i++) { - var item = /** @type {SemVerRange | 0 | 1 | 2} */ (range[i]); - stack.push( - item == 1 - ? p() | p() - : item == 2 - ? p() & p() - : item - ? satisfy(item, version) - : !p() - ); - } - return !!p(); + + return resolver; }; -/* eslint-enable eqeqeq */ -exports.satisfy = satisfy; -exports.stringifyHoley = json => { - switch (typeof json) { - case "undefined": - return ""; - case "object": - if (Array.isArray(json)) { - let str = "["; - for (let i = 0; i < json.length; i++) { - if (i !== 0) str += ","; - str += this.stringifyHoley(json[i]); - } - str += "]"; - return str; +/** + * Merging filtered elements + * @param {string[]} array source array + * @param {function(string): boolean} filter predicate + * @returns {Array} merge result + */ +function mergeFilteredToArray(array, filter) { + /** @type {Array} */ + const result = []; + const set = new Set(array); + + for (const item of set) { + if (filter(item)) { + const lastElement = + result.length > 0 ? result[result.length - 1] : undefined; + if (Array.isArray(lastElement)) { + lastElement.push(item); } else { - return JSON.stringify(json); + result.push([item]); } - default: - return JSON.stringify(json); + } else { + result.push(item); + } } -}; - -//#region runtime code: parseVersion -exports.parseVersionRuntimeCode = runtimeTemplate => - `var parseVersion = ${runtimeTemplate.basicFunction("str", [ - "// see webpack/lib/util/semver.js for original code", - `var p=${ - runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)" - }{return p.split(".").map((${ - runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)" - }{return+p==p?+p:p}))},n=/^([^-+]+)?(?:-([^+]+))?(?:\\+(.+))?$/.exec(str),r=n[1]?p(n[1]):[];return n[2]&&(r.length++,r.push.apply(r,p(n[2]))),n[3]&&(r.push([]),r.push.apply(r,p(n[3]))),r;` - ])}`; -//#endregion - -//#region runtime code: versionLt -exports.versionLtRuntimeCode = runtimeTemplate => - `var versionLt = ${runtimeTemplate.basicFunction("a, b", [ - "// see webpack/lib/util/semver.js for original code", - 'a=parseVersion(a),b=parseVersion(b);for(var r=0;;){if(r>=a.length)return r=b.length)return"u"==n;var t=b[r],f=(typeof t)[0];if(n!=f)return"o"==n&&"n"==f||("s"==f||"u"==n);if("o"!=n&&"u"!=n&&e!=t)return e - `var rangeToString = ${runtimeTemplate.basicFunction("range", [ - "// see webpack/lib/util/semver.js for original code", - 'var r=range[0],n="";if(1===range.length)return"*";if(r+.5){n+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var e=1,a=1;a0?".":"")+(e=2,t)}return n}var g=[];for(a=1;a - `var satisfy = ${runtimeTemplate.basicFunction("range, version", [ - "// see webpack/lib/util/semver.js for original code", - 'if(0 in range){version=parseVersion(version);var e=range[0],r=e<0;r&&(e=-e-1);for(var n=0,i=1,a=!0;;i++,n++){var f,s,g=i=version.length||"o"==(s=(typeof(f=version[n]))[0]))return!a||("u"==g?i>e&&!r:""==g!=r);if("u"==s){if(!a||"u"!=g)return!1}else if(a)if(g==s)if(i<=e){if(f!=range[i])return!1}else{if(r?f>range[i]:f - __webpack_require__(97059) -); -const getObjectMiddleware = memoize(() => - __webpack_require__(34795) -); -const getSingleItemMiddleware = memoize(() => - __webpack_require__(65112) -); -const getSerializer = memoize(() => __webpack_require__(53080)); -const getSerializerMiddleware = memoize(() => - __webpack_require__(83137) -); - -const getBinaryMiddlewareInstance = memoize( - () => new (getBinaryMiddleware())() -); +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -const registerSerializers = memoize(() => { - __webpack_require__(26611); +const slashCode = "/".charCodeAt(0); +const backslashCode = "\\".charCodeAt(0); - // Load internal paths with a relative require - // This allows bundling all internal serializers - const internalSerializables = __webpack_require__(53023); - getObjectMiddleware().registerLoader(/^webpack\/lib\//, req => { - const loader = internalSerializables[req.slice("webpack/lib/".length)]; - if (loader) { - loader(); - } else { - console.warn(`${req} not found in internalSerializables`); - } - return true; - }); -}); +const isInside = (path, parent) => { + if (!path.startsWith(parent)) return false; + if (path.length === parent.length) return true; + const charCode = path.charCodeAt(parent.length); + return charCode === slashCode || charCode === backslashCode; +}; -/** @type {Serializer} */ -let buffersSerializer; +module.exports = class RestrictionsPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {Set} restrictions restrictions + */ + constructor(source, restrictions) { + this.source = source; + this.restrictions = restrictions; + } -// Expose serialization API -module.exports = { - get register() { - return getObjectMiddleware().register; - }, - get registerLoader() { - return getObjectMiddleware().registerLoader; - }, - get registerNotSerializable() { - return getObjectMiddleware().registerNotSerializable; - }, - get NOT_SERIALIZABLE() { - return getObjectMiddleware().NOT_SERIALIZABLE; - }, - /** @type {MEASURE_START_OPERATION} */ - get MEASURE_START_OPERATION() { - return getBinaryMiddleware().MEASURE_START_OPERATION; - }, - /** @type {MEASURE_END_OPERATION} */ - get MEASURE_END_OPERATION() { - return getBinaryMiddleware().MEASURE_END_OPERATION; - }, - get buffersSerializer() { - if (buffersSerializer !== undefined) return buffersSerializer; - registerSerializers(); - const Serializer = getSerializer(); - const binaryMiddleware = getBinaryMiddlewareInstance(); - const SerializerMiddleware = getSerializerMiddleware(); - const SingleItemMiddleware = getSingleItemMiddleware(); - return (buffersSerializer = new Serializer([ - new SingleItemMiddleware(), - new (getObjectMiddleware())(context => { - if (context.write) { - context.writeLazy = value => { - context.write( - SerializerMiddleware.createLazy(value, binaryMiddleware) - ); - }; - } - }, "md4"), - binaryMiddleware - ])); - }, - createFileSerializer: (fs, hashFunction) => { - registerSerializers(); - const Serializer = getSerializer(); - const FileMiddleware = __webpack_require__(65321); - const fileMiddleware = new FileMiddleware(fs, hashFunction); - const binaryMiddleware = getBinaryMiddlewareInstance(); - const SerializerMiddleware = getSerializerMiddleware(); - const SingleItemMiddleware = getSingleItemMiddleware(); - return new Serializer([ - new SingleItemMiddleware(), - new (getObjectMiddleware())(context => { - if (context.write) { - context.writeLazy = value => { - context.write( - SerializerMiddleware.createLazy(value, binaryMiddleware) - ); - }; - context.writeSeparate = (value, options) => { - const lazy = SerializerMiddleware.createLazy( - value, - fileMiddleware, - options - ); - context.write(lazy); - return lazy; - }; + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + resolver + .getHook(this.source) + .tapAsync("RestrictionsPlugin", (request, resolveContext, callback) => { + if (typeof request.path === "string") { + const path = request.path; + for (const rule of this.restrictions) { + if (typeof rule === "string") { + if (!isInside(path, rule)) { + if (resolveContext.log) { + resolveContext.log( + `${path} is not inside of the restriction ${rule}` + ); + } + return callback(null, null); + } + } else if (!rule.test(path)) { + if (resolveContext.log) { + resolveContext.log( + `${path} doesn't match the restriction ${rule}` + ); + } + return callback(null, null); + } + } } - }, hashFunction), - binaryMiddleware, - fileMiddleware - ]); + + callback(); + }); } }; /***/ }), -/***/ 15652: +/***/ 13965: /***/ (function(module) { "use strict"; @@ -136684,211 +137263,117 @@ module.exports = { -/** - * @typedef {Object} GroupOptions - * @property {boolean=} groupChildren - * @property {boolean=} force - * @property {number=} targetGroupCount - */ - -/** - * @template T - * @template R - * @typedef {Object} GroupConfig - * @property {function(T): string[]} getKeys - * @property {function(string, (R | T)[], T[]): R} createGroup - * @property {function(string, T[]): GroupOptions=} getOptions - */ - -/** - * @template T - * @template R - * @typedef {Object} ItemWithGroups - * @property {T} item - * @property {Set>} groups - */ - -/** - * @template T - * @template R - * @typedef {{ config: GroupConfig, name: string, alreadyGrouped: boolean, items: Set> | undefined }} Group - */ +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -/** - * @template T - * @template R - * @param {T[]} items the list of items - * @param {GroupConfig[]} groupConfigs configuration - * @returns {(R | T)[]} grouped items - */ -const smartGrouping = (items, groupConfigs) => { - /** @type {Set>} */ - const itemsWithGroups = new Set(); - /** @type {Map>} */ - const allGroups = new Map(); - for (const item of items) { - /** @type {Set>} */ - const groups = new Set(); - for (let i = 0; i < groupConfigs.length; i++) { - const groupConfig = groupConfigs[i]; - const keys = groupConfig.getKeys(item); - if (keys) { - for (const name of keys) { - const key = `${i}:${name}`; - let group = allGroups.get(key); - if (group === undefined) { - allGroups.set( - key, - (group = { - config: groupConfig, - name, - alreadyGrouped: false, - items: undefined - }) - ); - } - groups.add(group); - } - } - } - itemsWithGroups.add({ - item, - groups - }); +module.exports = class ResultPlugin { + /** + * @param {ResolveStepHook} source source + */ + constructor(source) { + this.source = source; } + /** - * @param {Set>} itemsWithGroups input items with groups - * @returns {(T | R)[]} groups items + * @param {Resolver} resolver the resolver + * @returns {void} */ - const runGrouping = itemsWithGroups => { - const totalSize = itemsWithGroups.size; - for (const entry of itemsWithGroups) { - for (const group of entry.groups) { - if (group.alreadyGrouped) continue; - const items = group.items; - if (items === undefined) { - group.items = new Set([entry]); - } else { - items.add(entry); - } - } - } - /** @type {Map, { items: Set>, options: GroupOptions | false | undefined, used: boolean }>} */ - const groupMap = new Map(); - for (const group of allGroups.values()) { - if (group.items) { - const items = group.items; - group.items = undefined; - groupMap.set(group, { - items, - options: undefined, - used: false + apply(resolver) { + this.source.tapAsync( + "ResultPlugin", + (request, resolverContext, callback) => { + const obj = { ...request }; + if (resolverContext.log) + resolverContext.log("reporting result " + obj.path); + resolver.hooks.result.callAsync(obj, resolverContext, err => { + if (err) return callback(err); + if (typeof resolverContext.yield === "function") { + resolverContext.yield(obj); + callback(null, null); + } else { + callback(null, obj); + } }); } - } - /** @type {(T | R)[]} */ - const results = []; - for (;;) { - /** @type {Group} */ - let bestGroup = undefined; - let bestGroupSize = -1; - let bestGroupItems = undefined; - let bestGroupOptions = undefined; - for (const [group, state] of groupMap) { - const { items, used } = state; - let options = state.options; - if (options === undefined) { - const groupConfig = group.config; - state.options = options = - (groupConfig.getOptions && - groupConfig.getOptions( - group.name, - Array.from(items, ({ item }) => item) - )) || - false; - } + ); + } +}; - const force = options && options.force; - if (!force) { - if (bestGroupOptions && bestGroupOptions.force) continue; - if (used) continue; - if (items.size <= 1 || totalSize - items.size <= 1) { - continue; - } - } - const targetGroupCount = (options && options.targetGroupCount) || 4; - let sizeValue = force - ? items.size - : Math.min( - items.size, - (totalSize * 2) / targetGroupCount + - itemsWithGroups.size - - items.size - ); - if ( - sizeValue > bestGroupSize || - (force && (!bestGroupOptions || !bestGroupOptions.force)) - ) { - bestGroup = group; - bestGroupSize = sizeValue; - bestGroupItems = items; - bestGroupOptions = options; - } - } - if (bestGroup === undefined) { - break; - } - const items = new Set(bestGroupItems); - const options = bestGroupOptions; - const groupChildren = !options || options.groupChildren !== false; +/***/ }), - for (const item of items) { - itemsWithGroups.delete(item); - // Remove all groups that items have from the map to not select them again - for (const group of item.groups) { - const state = groupMap.get(group); - if (state !== undefined) { - state.items.delete(item); - if (state.items.size === 0) { - groupMap.delete(group); - } else { - state.options = undefined; - if (groupChildren) { - state.used = true; - } - } - } - } - } - groupMap.delete(bestGroup); +/***/ 66737: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const key = bestGroup.name; - const groupConfig = bestGroup.config; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ - const allItems = Array.from(items, ({ item }) => item); - bestGroup.alreadyGrouped = true; - const children = groupChildren ? runGrouping(items) : allItems; - bestGroup.alreadyGrouped = false; - results.push(groupConfig.createGroup(key, children, allItems)); - } - for (const { item } of itemsWithGroups) { - results.push(item); - } - return results; - }; - return runGrouping(itemsWithGroups); -}; +const forEachBail = __webpack_require__(78565); + +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ + +class RootsPlugin { + /** + * @param {string | ResolveStepHook} source source hook + * @param {Set} roots roots + * @param {string | ResolveStepHook} target target hook + */ + constructor(source, roots, target) { + this.roots = Array.from(roots); + this.source = source; + this.target = target; + } + + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + + resolver + .getHook(this.source) + .tapAsync("RootsPlugin", (request, resolveContext, callback) => { + const req = request.request; + if (!req) return callback(); + if (!req.startsWith("/")) return callback(); + + forEachBail( + this.roots, + (root, callback) => { + const path = resolver.join(root, req.slice(1)); + const obj = { + ...request, + path, + relativePath: request.relativePath && path + }; + resolver.doResolve( + target, + obj, + `root path ${root}`, + resolveContext, + callback + ); + }, + callback + ); + }); + } +} -module.exports = smartGrouping; +module.exports = RootsPlugin; /***/ }), -/***/ 41245: -/***/ (function(__unused_webpack_module, exports) { +/***/ 52232: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -136898,65 +137383,84 @@ module.exports = smartGrouping; -/** @typedef {import("webpack-sources").Source} Source */ +const DescriptionFileUtils = __webpack_require__(25424); -/** @type {WeakMap>} */ -const equalityCache = new WeakMap(); +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -/** - * @param {Source} a a source - * @param {Source} b another source - * @returns {boolean} true, when both sources are equal - */ -const _isSourceEqual = (a, b) => { - // prefer .buffer(), it's called anyway during emit - /** @type {Buffer|string} */ - let aSource = typeof a.buffer === "function" ? a.buffer() : a.source(); - /** @type {Buffer|string} */ - let bSource = typeof b.buffer === "function" ? b.buffer() : b.source(); - if (aSource === bSource) return true; - if (typeof aSource === "string" && typeof bSource === "string") return false; - if (!Buffer.isBuffer(aSource)) aSource = Buffer.from(aSource, "utf-8"); - if (!Buffer.isBuffer(bSource)) bSource = Buffer.from(bSource, "utf-8"); - return aSource.equals(bSource); -}; +const slashCode = "/".charCodeAt(0); -/** - * @param {Source} a a source - * @param {Source} b another source - * @returns {boolean} true, when both sources are equal - */ -const isSourceEqual = (a, b) => { - if (a === b) return true; - const cache1 = equalityCache.get(a); - if (cache1 !== undefined) { - const result = cache1.get(b); - if (result !== undefined) return result; - } - const result = _isSourceEqual(a, b); - if (cache1 !== undefined) { - cache1.set(b, result); - } else { - const map = new WeakMap(); - map.set(b, result); - equalityCache.set(a, map); +module.exports = class SelfReferencePlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string | string[]} fieldNamePath name path + * @param {string | ResolveStepHook} target target + */ + constructor(source, fieldNamePath, target) { + this.source = source; + this.target = target; + this.fieldName = fieldNamePath; } - const cache2 = equalityCache.get(b); - if (cache2 !== undefined) { - cache2.set(a, result); - } else { - const map = new WeakMap(); - map.set(a, result); - equalityCache.set(b, map); + + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("SelfReferencePlugin", (request, resolveContext, callback) => { + if (!request.descriptionFilePath) return callback(); + + const req = request.request; + if (!req) return callback(); + + // Feature is only enabled when an exports field is present + const exportsField = DescriptionFileUtils.getField( + request.descriptionFileData, + this.fieldName + ); + if (!exportsField) return callback(); + + const name = DescriptionFileUtils.getField( + request.descriptionFileData, + "name" + ); + if (typeof name !== "string") return callback(); + + if ( + req.startsWith(name) && + (req.length === name.length || + req.charCodeAt(name.length) === slashCode) + ) { + const remainingRequest = `.${req.slice(name.length)}`; + + const obj = { + ...request, + request: remainingRequest, + path: /** @type {string} */ (request.descriptionFileRoot), + relativePath: "." + }; + + resolver.doResolve( + target, + obj, + "self reference", + resolveContext, + callback + ); + } else { + return callback(); + } + }); } - return result; }; -exports.isSourceEqual = isSourceEqual; /***/ }), -/***/ 12047: +/***/ 58885: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -136967,180 +137471,93 @@ exports.isSourceEqual = isSourceEqual; -const { validate } = __webpack_require__(38476); - -/* cSpell:disable */ -const DID_YOU_MEAN = { - rules: "module.rules", - loaders: "module.rules or module.rules.*.use", - query: "module.rules.*.options (BREAKING CHANGE since webpack 5)", - noParse: "module.noParse", - filename: "output.filename or module.rules.*.generator.filename", - file: "output.filename", - chunkFilename: "output.chunkFilename", - chunkfilename: "output.chunkFilename", - ecmaVersion: - "output.environment (output.ecmaVersion was a temporary configuration option during webpack 5 beta)", - ecmaversion: - "output.environment (output.ecmaVersion was a temporary configuration option during webpack 5 beta)", - ecma: "output.environment (output.ecmaVersion was a temporary configuration option during webpack 5 beta)", - path: "output.path", - pathinfo: "output.pathinfo", - pathInfo: "output.pathinfo", - jsonpFunction: "output.chunkLoadingGlobal (BREAKING CHANGE since webpack 5)", - chunkCallbackName: - "output.chunkLoadingGlobal (BREAKING CHANGE since webpack 5)", - jsonpScriptType: "output.scriptType (BREAKING CHANGE since webpack 5)", - hotUpdateFunction: "output.hotUpdateGlobal (BREAKING CHANGE since webpack 5)", - splitChunks: "optimization.splitChunks", - immutablePaths: "snapshot.immutablePaths", - managedPaths: "snapshot.managedPaths", - maxModules: "stats.modulesSpace (BREAKING CHANGE since webpack 5)", - hashedModuleIds: - 'optimization.moduleIds: "hashed" (BREAKING CHANGE since webpack 5)', - namedChunks: - 'optimization.chunkIds: "named" (BREAKING CHANGE since webpack 5)', - namedModules: - 'optimization.moduleIds: "named" (BREAKING CHANGE since webpack 5)', - occurrenceOrder: - 'optimization.chunkIds: "size" and optimization.moduleIds: "size" (BREAKING CHANGE since webpack 5)', - automaticNamePrefix: - "optimization.splitChunks.[cacheGroups.*].idHint (BREAKING CHANGE since webpack 5)", - noEmitOnErrors: - "optimization.emitOnErrors (BREAKING CHANGE since webpack 5: logic is inverted to avoid negative flags)", - Buffer: - "to use the ProvidePlugin to process the Buffer variable to modules as polyfill\n" + - "BREAKING CHANGE: webpack 5 no longer provided Node.js polyfills by default.\n" + - "Note: if you are using 'node.Buffer: false', you can just remove that as this is the default behavior now.\n" + - "To provide a polyfill to modules use:\n" + - 'new ProvidePlugin({ Buffer: ["buffer", "Buffer"] }) and npm install buffer.', - process: - "to use the ProvidePlugin to process the process variable to modules as polyfill\n" + - "BREAKING CHANGE: webpack 5 no longer provided Node.js polyfills by default.\n" + - "Note: if you are using 'node.process: false', you can just remove that as this is the default behavior now.\n" + - "To provide a polyfill to modules use:\n" + - 'new ProvidePlugin({ process: "process" }) and npm install buffer.' -}; +const forEachBail = __webpack_require__(78565); +const getPaths = __webpack_require__(82918); +const { getType, PathType } = __webpack_require__(67079); -const REMOVED = { - concord: - "BREAKING CHANGE: resolve.concord has been removed and is no longer available.", - devtoolLineToLine: - "BREAKING CHANGE: output.devtoolLineToLine has been removed and is no longer available." -}; -/* cSpell:enable */ +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -/** - * @param {Parameters[0]} schema a json schema - * @param {Parameters[1]} options the options that should be validated - * @param {Parameters[2]=} validationConfiguration configuration for generating errors - * @returns {void} - */ -const validateSchema = (schema, options, validationConfiguration) => { - validate( - schema, - options, - validationConfiguration || { - name: "Webpack", - postFormatter: (formattedError, error) => { - const children = error.children; - if ( - children && - children.some( - child => - child.keyword === "absolutePath" && - child.dataPath === ".output.filename" - ) - ) { - return `${formattedError}\nPlease use output.path to specify absolute path and output.filename for the file name.`; - } +module.exports = class SymlinkPlugin { + /** + * @param {string | ResolveStepHook} source source + * @param {string | ResolveStepHook} target target + */ + constructor(source, target) { + this.source = source; + this.target = target; + } - if ( - children && - children.some( - child => - child.keyword === "pattern" && child.dataPath === ".devtool" - ) - ) { - return ( - `${formattedError}\n` + - "BREAKING CHANGE since webpack 5: The devtool option is more strict.\n" + - "Please strictly follow the order of the keywords in the pattern." - ); - } + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + const fs = resolver.fileSystem; + resolver + .getHook(this.source) + .tapAsync("SymlinkPlugin", (request, resolveContext, callback) => { + if (request.ignoreSymlinks) return callback(); + const pathsResult = getPaths(request.path); + const pathSegments = pathsResult.segments; + const paths = pathsResult.paths; - if (error.keyword === "additionalProperties") { - const params = - /** @type {import("ajv").AdditionalPropertiesParams} */ ( - error.params + let containsSymlink = false; + let idx = -1; + forEachBail( + paths, + (path, callback) => { + idx++; + if (resolveContext.fileDependencies) + resolveContext.fileDependencies.add(path); + fs.readlink(path, (err, result) => { + if (!err && result) { + pathSegments[idx] = result; + containsSymlink = true; + // Shortcut when absolute symlink found + const resultType = getType(result.toString()); + if ( + resultType === PathType.AbsoluteWin || + resultType === PathType.AbsolutePosix + ) { + return callback(null, idx); + } + } + callback(); + }); + }, + (err, idx) => { + if (!containsSymlink) return callback(); + const resultSegments = + typeof idx === "number" + ? pathSegments.slice(0, idx + 1) + : pathSegments.slice(); + const result = resultSegments.reduceRight((a, b) => { + return resolver.join(a, b); + }); + const obj = { + ...request, + path: result + }; + resolver.doResolve( + target, + obj, + "resolved symlink to " + result, + resolveContext, + callback ); - if ( - Object.prototype.hasOwnProperty.call( - DID_YOU_MEAN, - params.additionalProperty - ) - ) { - return `${formattedError}\nDid you mean ${ - DID_YOU_MEAN[params.additionalProperty] - }?`; - } - - if ( - Object.prototype.hasOwnProperty.call( - REMOVED, - params.additionalProperty - ) - ) { - return `${formattedError}\n${REMOVED[params.additionalProperty]}?`; - } - - if (!error.dataPath) { - if (params.additionalProperty === "debug") { - return ( - `${formattedError}\n` + - "The 'debug' property was removed in webpack 2.0.0.\n" + - "Loaders should be updated to allow passing this option via loader options in module.rules.\n" + - "Until loaders are updated one can use the LoaderOptionsPlugin to switch loaders into debug mode:\n" + - "plugins: [\n" + - " new webpack.LoaderOptionsPlugin({\n" + - " debug: true\n" + - " })\n" + - "]" - ); - } - - if (params.additionalProperty) { - return ( - `${formattedError}\n` + - "For typos: please correct them.\n" + - "For loader options: webpack >= v2.0.0 no longer allows custom properties in configuration.\n" + - " Loaders should be updated to allow passing options via loader options in module.rules.\n" + - " Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:\n" + - " plugins: [\n" + - " new webpack.LoaderOptionsPlugin({\n" + - " // test: /\\.xxx$/, // may apply this only for some modules\n" + - " options: {\n" + - ` ${params.additionalProperty}: …\n` + - " }\n" + - " })\n" + - " ]" - ); - } } - } - - return formattedError; - } - } - ); + ); + }); + } }; -module.exports = validateSchema; /***/ }), -/***/ 5434: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 87474: +/***/ (function(module) { "use strict"; /* @@ -137150,83 +137567,100 @@ module.exports = validateSchema; -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); +/** @typedef {import("./Resolver").FileSystem} FileSystem */ +/** @typedef {import("./Resolver").SyncFileSystem} SyncFileSystem */ -class AsyncWasmLoadingRuntimeModule extends RuntimeModule { - constructor({ generateLoadBinaryCode, supportsStreaming }) { - super("wasm loading", RuntimeModule.STAGE_NORMAL); - this.generateLoadBinaryCode = generateLoadBinaryCode; - this.supportsStreaming = supportsStreaming; - } +/** + * @param {SyncFileSystem} fs file system implementation + * @constructor + */ +function SyncAsyncFileSystemDecorator(fs) { + this.fs = fs; - /** - * @returns {string} runtime code - */ - generate() { - const { compilation, chunk } = this; - const { outputOptions, runtimeTemplate } = compilation; - const fn = RuntimeGlobals.instantiateWasm; - const wasmModuleSrcPath = compilation.getPath( - JSON.stringify(outputOptions.webassemblyModuleFilename), - { - hash: `" + ${RuntimeGlobals.getFullHash}() + "`, - hashWithLength: length => - `" + ${RuntimeGlobals.getFullHash}}().slice(0, ${length}) + "`, - module: { - id: '" + wasmModuleId + "', - hash: `" + wasmModuleHash + "`, - hashWithLength(length) { - return `" + wasmModuleHash.slice(0, ${length}) + "`; - } - }, - runtime: chunk.runtime + this.lstat = undefined; + this.lstatSync = undefined; + const lstatSync = fs.lstatSync; + if (lstatSync) { + this.lstat = (arg, options, callback) => { + let result; + try { + result = lstatSync.call(fs, arg); + } catch (e) { + return (callback || options)(e); } - ); - return `${fn} = ${runtimeTemplate.basicFunction( - "exports, wasmModuleId, wasmModuleHash, importsObj", - [ - `var req = ${this.generateLoadBinaryCode(wasmModuleSrcPath)};`, - this.supportsStreaming - ? Template.asString([ - "if (typeof WebAssembly.instantiateStreaming === 'function') {", - Template.indent([ - "return WebAssembly.instantiateStreaming(req, importsObj)", - Template.indent([ - `.then(${runtimeTemplate.returningFunction( - "Object.assign(exports, res.instance.exports)", - "res" - )});` - ]) - ]), - "}" - ]) - : "// no support for streaming compilation", - "return req", - Template.indent([ - `.then(${runtimeTemplate.returningFunction("x.arrayBuffer()", "x")})`, - `.then(${runtimeTemplate.returningFunction( - "WebAssembly.instantiate(bytes, importsObj)", - "bytes" - )})`, - `.then(${runtimeTemplate.returningFunction( - "Object.assign(exports, res.instance.exports)", - "res" - )});` - ]) - ] - )};`; + (callback || options)(null, result); + }; + this.lstatSync = (arg, options) => lstatSync.call(fs, arg, options); + } + + this.stat = (arg, options, callback) => { + let result; + try { + result = callback ? fs.statSync(arg, options) : fs.statSync(arg); + } catch (e) { + return (callback || options)(e); + } + (callback || options)(null, result); + }; + this.statSync = (arg, options) => fs.statSync(arg, options); + + this.readdir = (arg, options, callback) => { + let result; + try { + result = fs.readdirSync(arg); + } catch (e) { + return (callback || options)(e); + } + (callback || options)(null, result); + }; + this.readdirSync = (arg, options) => fs.readdirSync(arg, options); + + this.readFile = (arg, options, callback) => { + let result; + try { + result = fs.readFileSync(arg); + } catch (e) { + return (callback || options)(e); + } + (callback || options)(null, result); + }; + this.readFileSync = (arg, options) => fs.readFileSync(arg, options); + + this.readlink = (arg, options, callback) => { + let result; + try { + result = fs.readlinkSync(arg); + } catch (e) { + return (callback || options)(e); + } + (callback || options)(null, result); + }; + this.readlinkSync = (arg, options) => fs.readlinkSync(arg, options); + + this.readJson = undefined; + this.readJsonSync = undefined; + const readJsonSync = fs.readJsonSync; + if (readJsonSync) { + this.readJson = (arg, options, callback) => { + let result; + try { + result = readJsonSync.call(fs, arg); + } catch (e) { + return (callback || options)(e); + } + (callback || options)(null, result); + }; + + this.readJsonSync = (arg, options) => readJsonSync.call(fs, arg, options); } } - -module.exports = AsyncWasmLoadingRuntimeModule; +module.exports = SyncAsyncFileSystemDecorator; /***/ }), -/***/ 58461: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 99324: +/***/ (function(module) { "use strict"; /* @@ -137236,58 +137670,46 @@ module.exports = AsyncWasmLoadingRuntimeModule; -const Generator = __webpack_require__(93401); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../NormalModule")} NormalModule */ - -const TYPES = new Set(["webassembly"]); - -class AsyncWebAssemblyGenerator extends Generator { - constructor(options) { - super(); - this.options = options; - } - - /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) - */ - getTypes(module) { - return TYPES; - } +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +module.exports = class TryNextPlugin { /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module + * @param {string | ResolveStepHook} source source + * @param {string} message message + * @param {string | ResolveStepHook} target target */ - getSize(module, type) { - const originalSource = module.originalSource(); - if (!originalSource) { - return 0; - } - return originalSource.size(); + constructor(source, message, target) { + this.source = source; + this.message = message; + this.target = target; } /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code + * @param {Resolver} resolver the resolver + * @returns {void} */ - generate(module, generateContext) { - return module.originalSource(); + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("TryNextPlugin", (request, resolveContext, callback) => { + resolver.doResolve( + target, + request, + this.message, + resolveContext, + callback + ); + }); } -} - -module.exports = AsyncWebAssemblyGenerator; +}; /***/ }), -/***/ 95614: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 41606: +/***/ (function(module) { "use strict"; /* @@ -137297,199 +137719,72 @@ module.exports = AsyncWebAssemblyGenerator; -const { RawSource } = __webpack_require__(51255); -const Generator = __webpack_require__(93401); -const InitFragment = __webpack_require__(55870); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const WebAssemblyImportDependency = __webpack_require__(5239); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../NormalModule")} NormalModule */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ - -const TYPES = new Set(["webassembly"]); - -class AsyncWebAssemblyJavascriptGenerator extends Generator { - constructor(filenameTemplate) { - super(); - this.filenameTemplate = filenameTemplate; - } +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ +/** @typedef {{[k: string]: any}} Cache */ - /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) - */ - getTypes(module) { - return TYPES; - } +function getCacheId(request, withContext) { + return JSON.stringify({ + context: withContext ? request.context : "", + path: request.path, + query: request.query, + fragment: request.fragment, + request: request.request + }); +} +module.exports = class UnsafeCachePlugin { /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module + * @param {string | ResolveStepHook} source source + * @param {function(ResolveRequest): boolean} filterPredicate filterPredicate + * @param {Cache} cache cache + * @param {boolean} withContext withContext + * @param {string | ResolveStepHook} target target */ - getSize(module, type) { - return 40 + module.dependencies.length * 10; + constructor(source, filterPredicate, cache, withContext, target) { + this.source = source; + this.filterPredicate = filterPredicate; + this.withContext = withContext; + this.cache = cache; + this.target = target; } /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code + * @param {Resolver} resolver the resolver + * @returns {void} */ - generate(module, generateContext) { - const { - runtimeTemplate, - chunkGraph, - moduleGraph, - runtimeRequirements, - runtime - } = generateContext; - runtimeRequirements.add(RuntimeGlobals.module); - runtimeRequirements.add(RuntimeGlobals.moduleId); - runtimeRequirements.add(RuntimeGlobals.exports); - runtimeRequirements.add(RuntimeGlobals.instantiateWasm); - /** @type {InitFragment[]} */ - const initFragments = []; - /** @type {Map} */ - const depModules = new Map(); - /** @type {Map} */ - const wasmDepsByRequest = new Map(); - for (const dep of module.dependencies) { - if (dep instanceof WebAssemblyImportDependency) { - const module = moduleGraph.getModule(dep); - if (!depModules.has(module)) { - depModules.set(module, { - request: dep.request, - importVar: `WEBPACK_IMPORTED_MODULE_${depModules.size}` - }); - } - let list = wasmDepsByRequest.get(dep.request); - if (list === undefined) { - list = []; - wasmDepsByRequest.set(dep.request, list); - } - list.push(dep); - } - } - - const promises = []; - - const importStatements = Array.from( - depModules, - ([importedModule, { request, importVar }]) => { - if (moduleGraph.isAsync(importedModule)) { - promises.push(importVar); + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("UnsafeCachePlugin", (request, resolveContext, callback) => { + if (!this.filterPredicate(request)) return callback(); + const cacheId = getCacheId(request, this.withContext); + const cacheEntry = this.cache[cacheId]; + if (cacheEntry) { + return callback(null, cacheEntry); } - return runtimeTemplate.importStatement({ - update: false, - module: importedModule, - chunkGraph, + resolver.doResolve( + target, request, - originModule: module, - importVar, - runtimeRequirements - }); - } - ); - const importsCode = importStatements.map(([x]) => x).join(""); - const importsCompatCode = importStatements.map(([_, x]) => x).join(""); - - const importObjRequestItems = Array.from( - wasmDepsByRequest, - ([request, deps]) => { - const exportItems = deps.map(dep => { - const importedModule = moduleGraph.getModule(dep); - const importVar = depModules.get(importedModule).importVar; - return `${JSON.stringify( - dep.name - )}: ${runtimeTemplate.exportFromImport({ - moduleGraph, - module: importedModule, - request, - exportName: dep.name, - originModule: module, - asiSafe: true, - isCall: false, - callContext: false, - defaultInterop: true, - importVar, - initFragments, - runtime, - runtimeRequirements - })}`; - }); - return Template.asString([ - `${JSON.stringify(request)}: {`, - Template.indent(exportItems.join(",\n")), - "}" - ]); - } - ); - - const importsObj = - importObjRequestItems.length > 0 - ? Template.asString([ - "{", - Template.indent(importObjRequestItems.join(",\n")), - "}" - ]) - : undefined; - - const instantiateCall = - `${RuntimeGlobals.instantiateWasm}(${module.exportsArgument}, ${ - module.moduleArgument - }.id, ${JSON.stringify( - chunkGraph.getRenderedModuleHash(module, runtime) - )}` + (importsObj ? `, ${importsObj})` : `)`); - - if (promises.length > 0) - runtimeRequirements.add(RuntimeGlobals.asyncModule); - - const source = new RawSource( - promises.length > 0 - ? Template.asString([ - `var __webpack_instantiate__ = ${runtimeTemplate.basicFunction( - `[${promises.join(", ")}]`, - `${importsCompatCode}return ${instantiateCall};` - )}`, - `${RuntimeGlobals.asyncModule}(${ - module.moduleArgument - }, async ${runtimeTemplate.basicFunction( - "__webpack_handle_async_dependencies__, __webpack_async_result__", - [ - "try {", - importsCode, - `var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${promises.join( - ", " - )}]);`, - `var [${promises.join( - ", " - )}] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__;`, - `${importsCompatCode}await ${instantiateCall};`, - "__webpack_async_result__();", - "} catch(e) { __webpack_async_result__(e); }" - ] - )}, 1);` - ]) - : `${importsCode}${importsCompatCode}module.exports = ${instantiateCall};` - ); - - return InitFragment.addToSource(source, initFragments, generateContext); + null, + resolveContext, + (err, result) => { + if (err) return callback(err); + if (result) return callback(null, (this.cache[cacheId] = result)); + callback(); + } + ); + }); } -} - -module.exports = AsyncWebAssemblyJavascriptGenerator; +}; /***/ }), -/***/ 7538: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 96972: +/***/ (function(module) { "use strict"; /* @@ -137499,203 +137794,99 @@ module.exports = AsyncWebAssemblyJavascriptGenerator; -const { SyncWaterfallHook } = __webpack_require__(41242); -const Compilation = __webpack_require__(85720); -const Generator = __webpack_require__(93401); -const { tryRunOrWebpackError } = __webpack_require__(11351); -const WebAssemblyImportDependency = __webpack_require__(5239); -const { compareModulesByIdentifier } = __webpack_require__(29579); -const memoize = __webpack_require__(78676); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../CodeGenerationResults")} CodeGenerationResults */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("../Template").RenderManifestEntry} RenderManifestEntry */ -/** @typedef {import("../Template").RenderManifestOptions} RenderManifestOptions */ - -const getAsyncWebAssemblyGenerator = memoize(() => - __webpack_require__(58461) -); -const getAsyncWebAssemblyJavascriptGenerator = memoize(() => - __webpack_require__(95614) -); -const getAsyncWebAssemblyParser = memoize(() => - __webpack_require__(96305) -); - -/** - * @typedef {Object} WebAssemblyRenderContext - * @property {Chunk} chunk the chunk - * @property {DependencyTemplates} dependencyTemplates the dependency templates - * @property {RuntimeTemplate} runtimeTemplate the runtime template - * @property {ModuleGraph} moduleGraph the module graph - * @property {ChunkGraph} chunkGraph the chunk graph - * @property {CodeGenerationResults} codeGenerationResults results of code generation - */ - -/** - * @typedef {Object} CompilationHooks - * @property {SyncWaterfallHook<[Source, Module, WebAssemblyRenderContext]>} renderModuleContent - */ - -/** @type {WeakMap} */ -const compilationHooksMap = new WeakMap(); +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -class AsyncWebAssemblyModulesPlugin { +module.exports = class UseFilePlugin { /** - * @param {Compilation} compilation the compilation - * @returns {CompilationHooks} the attached hooks + * @param {string | ResolveStepHook} source source + * @param {string} filename filename + * @param {string | ResolveStepHook} target target */ - static getCompilationHooks(compilation) { - if (!(compilation instanceof Compilation)) { - throw new TypeError( - "The 'compilation' argument must be an instance of Compilation" - ); - } - let hooks = compilationHooksMap.get(compilation); - if (hooks === undefined) { - hooks = { - renderModuleContent: new SyncWaterfallHook([ - "source", - "module", - "renderContext" - ]) - }; - compilationHooksMap.set(compilation, hooks); - } - return hooks; - } - - constructor(options) { - this.options = options; + constructor(source, filename, target) { + this.source = source; + this.filename = filename; + this.target = target; } /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance + * @param {Resolver} resolver the resolver * @returns {void} */ - apply(compiler) { - compiler.hooks.compilation.tap( - "AsyncWebAssemblyModulesPlugin", - (compilation, { normalModuleFactory }) => { - const hooks = - AsyncWebAssemblyModulesPlugin.getCompilationHooks(compilation); - compilation.dependencyFactories.set( - WebAssemblyImportDependency, - normalModuleFactory + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("UseFilePlugin", (request, resolveContext, callback) => { + const filePath = resolver.join(request.path, this.filename); + const obj = { + ...request, + path: filePath, + relativePath: + request.relativePath && + resolver.join(request.relativePath, this.filename) + }; + resolver.doResolve( + target, + obj, + "using path: " + filePath, + resolveContext, + callback ); + }); + } +}; - normalModuleFactory.hooks.createParser - .for("webassembly/async") - .tap("AsyncWebAssemblyModulesPlugin", () => { - const AsyncWebAssemblyParser = getAsyncWebAssemblyParser(); - - return new AsyncWebAssemblyParser(); - }); - normalModuleFactory.hooks.createGenerator - .for("webassembly/async") - .tap("AsyncWebAssemblyModulesPlugin", () => { - const AsyncWebAssemblyJavascriptGenerator = - getAsyncWebAssemblyJavascriptGenerator(); - const AsyncWebAssemblyGenerator = getAsyncWebAssemblyGenerator(); - - return Generator.byType({ - javascript: new AsyncWebAssemblyJavascriptGenerator( - compilation.outputOptions.webassemblyModuleFilename - ), - webassembly: new AsyncWebAssemblyGenerator(this.options) - }); - }); - compilation.hooks.renderManifest.tap( - "WebAssemblyModulesPlugin", - (result, options) => { - const { moduleGraph, chunkGraph, runtimeTemplate } = compilation; - const { - chunk, - outputOptions, - dependencyTemplates, - codeGenerationResults - } = options; +/***/ }), - for (const module of chunkGraph.getOrderedChunkModulesIterable( - chunk, - compareModulesByIdentifier - )) { - if (module.type === "webassembly/async") { - const filenameTemplate = - outputOptions.webassemblyModuleFilename; +/***/ 81218: +/***/ (function(module) { - result.push({ - render: () => - this.renderModule( - module, - { - chunk, - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - codeGenerationResults - }, - hooks - ), - filenameTemplate, - pathOptions: { - module, - runtime: chunk.runtime, - chunkGraph - }, - auxiliary: true, - identifier: `webassemblyAsyncModule${chunkGraph.getModuleId( - module - )}`, - hash: chunkGraph.getModuleHash(module, chunk.runtime) - }); - } - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - return result; - } - ); - } - ); - } - renderModule(module, renderContext, hooks) { - const { codeGenerationResults, chunk } = renderContext; - try { - const moduleSource = codeGenerationResults.getSource( - module, - chunk.runtime, - "webassembly" - ); - return tryRunOrWebpackError( - () => - hooks.renderModuleContent.call(moduleSource, module, renderContext), - "AsyncWebAssemblyModulesPlugin.getCompilationHooks().renderModuleContent" - ); - } catch (e) { - e.module = module; - throw e; + +module.exports = function createInnerContext( + options, + message, + messageOptional +) { + let messageReported = false; + let innerLog = undefined; + if (options.log) { + if (message) { + innerLog = msg => { + if (!messageReported) { + options.log(message); + messageReported = true; + } + options.log(" " + msg); + }; + } else { + innerLog = options.log; } } -} - -module.exports = AsyncWebAssemblyModulesPlugin; + const childContext = { + log: innerLog, + yield: options.yield, + fileDependencies: options.fileDependencies, + contextDependencies: options.contextDependencies, + missingDependencies: options.missingDependencies, + stack: options.stack + }; + return childContext; +}; /***/ }), -/***/ 96305: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 78565: +/***/ (function(module) { "use strict"; /* @@ -137705,1843 +137896,1902 @@ module.exports = AsyncWebAssemblyModulesPlugin; -const t = __webpack_require__(51826); -const { decode } = __webpack_require__(73726); -const Parser = __webpack_require__(11715); -const StaticExportsDependency = __webpack_require__(91418); -const WebAssemblyImportDependency = __webpack_require__(5239); +module.exports = function forEachBail(array, iterator, callback) { + if (array.length === 0) return callback(); -/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ + let i = 0; + const next = () => { + let loop = undefined; + iterator(array[i++], (err, result) => { + if (err || result !== undefined || i >= array.length) { + return callback(err, result); + } + if (loop === false) while (next()); + loop = true; + }); + if (!loop) loop = false; + return loop; + }; + while (next()); +}; -const decoderOpts = { - ignoreCodeSection: true, - ignoreDataSection: true, - // this will avoid having to lookup with identifiers in the ModuleContext - ignoreCustomNameSection: true -}; +/***/ }), -class WebAssemblyParser extends Parser { - constructor(options) { - super(); - this.hooks = Object.freeze({}); - this.options = options; - } +/***/ 47956: +/***/ (function(module) { - /** - * @param {string | Buffer | PreparsedAst} source the source to parse - * @param {ParserState} state the parser state - * @returns {ParserState} the parser state - */ - parse(source, state) { - if (!Buffer.isBuffer(source)) { - throw new Error("WebAssemblyParser input must be a Buffer"); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +module.exports = function getInnerRequest(resolver, request) { + if ( + typeof request.__innerRequest === "string" && + request.__innerRequest_request === request.request && + request.__innerRequest_relativePath === request.relativePath + ) + return request.__innerRequest; + let innerRequest; + if (request.request) { + innerRequest = request.request; + if (/^\.\.?(?:\/|$)/.test(innerRequest) && request.relativePath) { + innerRequest = resolver.join(request.relativePath, innerRequest); } + } else { + innerRequest = request.relativePath; + } + request.__innerRequest_request = request.request; + request.__innerRequest_relativePath = request.relativePath; + return (request.__innerRequest = innerRequest); +}; - // flag it as async module - state.module.buildInfo.strict = true; - state.module.buildMeta.exportsType = "namespace"; - state.module.buildMeta.async = true; - // parse it - const program = decode(source, decoderOpts); - const module = program.body[0]; +/***/ }), - const exports = []; - t.traverse(module, { - ModuleExport({ node }) { - exports.push(node.name); - }, +/***/ 82918: +/***/ (function(module) { - ModuleImport({ node }) { - const dep = new WebAssemblyImportDependency( - node.module, - node.name, - node.descr, - false - ); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - state.module.addDependency(dep); - } - }); - state.module.addDependency(new StaticExportsDependency(exports, false)); - return state; +module.exports = function getPaths(path) { + if (path === "/") return { paths: ["/"], segments: [""] }; + const parts = path.split(/(.*?[\\/]+)/); + const paths = [path]; + const segments = [parts[parts.length - 1]]; + let part = parts[parts.length - 1]; + path = path.substr(0, path.length - part.length - 1); + for (let i = parts.length - 2; i > 2; i -= 2) { + paths.push(path); + part = parts[i]; + path = path.substr(0, path.length - part.length) || "/"; + segments.push(part.substr(0, part.length - 1)); } -} + part = parts[1]; + segments.push(part); + paths.push(part); + return { + paths: paths, + segments: segments + }; +}; -module.exports = WebAssemblyParser; +module.exports.basename = function basename(path) { + const i = path.lastIndexOf("/"), + j = path.lastIndexOf("\\"); + const p = i < 0 ? j : j < 0 ? i : i < j ? j : i; + if (p < 0) return null; + const s = path.substr(p + 1); + return s; +}; /***/ }), -/***/ 78455: +/***/ 9256: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ -const WebpackError = __webpack_require__(53799); +const fs = __webpack_require__(90552); +const CachedInputFileSystem = __webpack_require__(52788); +const ResolverFactory = __webpack_require__(47716); -module.exports = class UnsupportedWebAssemblyFeatureError extends WebpackError { - /** @param {string} message Error message */ - constructor(message) { - super(message); - this.name = "UnsupportedWebAssemblyFeatureError"; - this.hideStack = true; +/** @typedef {import("./PnpPlugin").PnpApiImpl} PnpApi */ +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").FileSystem} FileSystem */ +/** @typedef {import("./Resolver").ResolveContext} ResolveContext */ +/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */ +/** @typedef {import("./ResolverFactory").Plugin} Plugin */ +/** @typedef {import("./ResolverFactory").UserResolveOptions} ResolveOptions */ + +const nodeFileSystem = new CachedInputFileSystem(fs, 4000); + +const nodeContext = { + environments: ["node+es3+es5+process+native"] +}; + +const asyncResolver = ResolverFactory.createResolver({ + conditionNames: ["node"], + extensions: [".js", ".json", ".node"], + fileSystem: nodeFileSystem +}); +function resolve(context, path, request, resolveContext, callback) { + if (typeof context === "string") { + callback = resolveContext; + resolveContext = request; + request = path; + path = context; + context = nodeContext; + } + if (typeof callback !== "function") { + callback = resolveContext; + } + asyncResolver.resolve(context, path, request, resolveContext, callback); +} + +const syncResolver = ResolverFactory.createResolver({ + conditionNames: ["node"], + extensions: [".js", ".json", ".node"], + useSyncFileSystemCalls: true, + fileSystem: nodeFileSystem +}); +function resolveSync(context, path, request) { + if (typeof context === "string") { + request = path; + path = context; + context = nodeContext; } + return syncResolver.resolveSync(context, path, request); +} + +function create(options) { + options = { + fileSystem: nodeFileSystem, + ...options + }; + const resolver = ResolverFactory.createResolver(options); + return function (context, path, request, resolveContext, callback) { + if (typeof context === "string") { + callback = resolveContext; + resolveContext = request; + request = path; + path = context; + context = nodeContext; + } + if (typeof callback !== "function") { + callback = resolveContext; + } + resolver.resolve(context, path, request, resolveContext, callback); + }; +} + +function createSync(options) { + options = { + useSyncFileSystemCalls: true, + fileSystem: nodeFileSystem, + ...options + }; + const resolver = ResolverFactory.createResolver(options); + return function (context, path, request) { + if (typeof context === "string") { + request = path; + path = context; + context = nodeContext; + } + return resolver.resolveSync(context, path, request); + }; +} + +/** + * @template A + * @template B + * @param {A} obj input a + * @param {B} exports input b + * @returns {A & B} merged + */ +const mergeExports = (obj, exports) => { + const descriptors = Object.getOwnPropertyDescriptors(exports); + Object.defineProperties(obj, descriptors); + return /** @type {A & B} */ (Object.freeze(obj)); }; +module.exports = mergeExports(resolve, { + get sync() { + return resolveSync; + }, + create: mergeExports(create, { + get sync() { + return createSync; + } + }), + ResolverFactory, + CachedInputFileSystem, + get CloneBasenamePlugin() { + return __webpack_require__(22254); + }, + get LogInfoPlugin() { + return __webpack_require__(5049); + }, + get forEachBail() { + return __webpack_require__(78565); + } +}); + /***/ }), -/***/ 87394: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 55863: +/***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop */ -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); -const { compareModulesByIdentifier } = __webpack_require__(29579); -const WebAssemblyUtils = __webpack_require__(18650); +/** @typedef {string|(string|ConditionalMapping)[]} DirectMapping */ +/** @typedef {{[k: string]: MappingValue}} ConditionalMapping */ +/** @typedef {ConditionalMapping|DirectMapping|null} MappingValue */ +/** @typedef {Record|ConditionalMapping|DirectMapping} ExportsField */ +/** @typedef {Record} ImportsField */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +/** + * @typedef {Object} PathTreeNode + * @property {Map|null} children + * @property {MappingValue} folder + * @property {Map|null} wildcards + * @property {Map} files + */ -// TODO webpack 6 remove the whole folder +/** + * Processing exports/imports field + * @callback FieldProcessor + * @param {string} request request + * @param {Set} conditionNames condition names + * @returns {string[]} resolved paths + */ -// Get all wasm modules -const getAllWasmModules = (moduleGraph, chunkGraph, chunk) => { - const wasmModules = chunk.getAllAsyncChunks(); - const array = []; - for (const chunk of wasmModules) { - for (const m of chunkGraph.getOrderedChunkModulesIterable( - chunk, - compareModulesByIdentifier - )) { - if (m.type.startsWith("webassembly")) { - array.push(m); - } - } - } +/* +Example exports field: +{ + ".": "./main.js", + "./feature": { + "browser": "./feature-browser.js", + "default": "./feature.js" + } +} +Terminology: - return array; +Enhanced-resolve name keys ("." and "./feature") as exports field keys. + +If value is string or string[], mapping is called as a direct mapping +and value called as a direct export. + +If value is key-value object, mapping is called as a conditional mapping +and value called as a conditional export. + +Key in conditional mapping is called condition name. + +Conditional mapping nested in another conditional mapping is called nested mapping. + +---------- + +Example imports field: +{ + "#a": "./main.js", + "#moment": { + "browser": "./moment/index.js", + "default": "moment" + }, + "#moment/": { + "browser": "./moment/", + "default": "moment/" + } +} +Terminology: + +Enhanced-resolve name keys ("#a" and "#moment/", "#moment") as imports field keys. + +If value is string or string[], mapping is called as a direct mapping +and value called as a direct export. + +If value is key-value object, mapping is called as a conditional mapping +and value called as a conditional export. + +Key in conditional mapping is called condition name. + +Conditional mapping nested in another conditional mapping is called nested mapping. + +*/ + +const slashCode = "/".charCodeAt(0); +const dotCode = ".".charCodeAt(0); +const hashCode = "#".charCodeAt(0); + +/** + * @param {ExportsField} exportsField the exports field + * @returns {FieldProcessor} process callback + */ +module.exports.processExportsField = function processExportsField( + exportsField +) { + return createFieldProcessor( + buildExportsFieldPathTree(exportsField), + assertExportsFieldRequest, + assertExportTarget + ); }; /** - * generates the import object function for a module - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {Module} module the module - * @param {boolean} mangle mangle imports - * @param {string[]} declarations array where declarations are pushed to - * @param {RuntimeSpec} runtime the runtime - * @returns {string} source code + * @param {ImportsField} importsField the exports field + * @returns {FieldProcessor} process callback */ -const generateImportObject = ( - chunkGraph, - module, - mangle, - declarations, - runtime -) => { - const moduleGraph = chunkGraph.moduleGraph; - const waitForInstances = new Map(); - const properties = []; - const usedWasmDependencies = WebAssemblyUtils.getUsedDependencies( - moduleGraph, - module, - mangle +module.exports.processImportsField = function processImportsField( + importsField +) { + return createFieldProcessor( + buildImportsFieldPathTree(importsField), + assertImportsFieldRequest, + assertImportTarget ); - for (const usedDep of usedWasmDependencies) { - const dep = usedDep.dependency; - const importedModule = moduleGraph.getModule(dep); - const exportName = dep.name; - const usedName = - importedModule && - moduleGraph - .getExportsInfo(importedModule) - .getUsedName(exportName, runtime); - const description = dep.description; - const direct = dep.onlyDirectImport; +}; - const module = usedDep.module; - const name = usedDep.name; +/** + * @param {PathTreeNode} treeRoot root + * @param {(s: string) => string} assertRequest assertRequest + * @param {(s: string, f: boolean) => void} assertTarget assertTarget + * @returns {FieldProcessor} field processor + */ +function createFieldProcessor(treeRoot, assertRequest, assertTarget) { + return function fieldProcessor(request, conditionNames) { + request = assertRequest(request); - if (direct) { - const instanceVar = `m${waitForInstances.size}`; - waitForInstances.set(instanceVar, chunkGraph.getModuleId(importedModule)); - properties.push({ - module, - name, - value: `${instanceVar}[${JSON.stringify(usedName)}]` - }); - } else { - const params = description.signature.params.map( - (param, k) => "p" + k + param.valtype + const match = findMatch(request, treeRoot); + + if (match === null) return []; + + const [mapping, remainRequestIndex] = match; + + /** @type {DirectMapping|null} */ + let direct = null; + + if (isConditionalMapping(mapping)) { + direct = conditionalMapping( + /** @type {ConditionalMapping} */ (mapping), + conditionNames ); - const mod = `${RuntimeGlobals.moduleCache}[${JSON.stringify( - chunkGraph.getModuleId(importedModule) - )}]`; - const modExports = `${mod}.exports`; + // matching not found + if (direct === null) return []; + } else { + direct = /** @type {DirectMapping} */ (mapping); + } + + const remainingRequest = + remainRequestIndex === request.length + 1 + ? undefined + : remainRequestIndex < 0 + ? request.slice(-remainRequestIndex - 1) + : request.slice(remainRequestIndex); - const cache = `wasmImportedFuncCache${declarations.length}`; - declarations.push(`var ${cache};`); + return directMapping( + remainingRequest, + remainRequestIndex < 0, + direct, + conditionNames, + assertTarget + ); + }; +} - properties.push({ - module, - name, - value: Template.asString([ - (importedModule.type.startsWith("webassembly") - ? `${mod} ? ${modExports}[${JSON.stringify(usedName)}] : ` - : "") + `function(${params}) {`, - Template.indent([ - `if(${cache} === undefined) ${cache} = ${modExports};`, - `return ${cache}[${JSON.stringify(usedName)}](${params});` - ]), - "}" - ]) - }); - } +/** + * @param {string} request request + * @returns {string} updated request + */ +function assertExportsFieldRequest(request) { + if (request.charCodeAt(0) !== dotCode) { + throw new Error('Request should be relative path and start with "."'); } - - let importObject; - if (mangle) { - importObject = [ - "return {", - Template.indent([ - properties.map(p => `${JSON.stringify(p.name)}: ${p.value}`).join(",\n") - ]), - "};" - ]; - } else { - const propertiesByModule = new Map(); - for (const p of properties) { - let list = propertiesByModule.get(p.module); - if (list === undefined) { - propertiesByModule.set(p.module, (list = [])); - } - list.push(p); - } - importObject = [ - "return {", - Template.indent([ - Array.from(propertiesByModule, ([module, list]) => { - return Template.asString([ - `${JSON.stringify(module)}: {`, - Template.indent([ - list.map(p => `${JSON.stringify(p.name)}: ${p.value}`).join(",\n") - ]), - "}" - ]); - }).join(",\n") - ]), - "};" - ]; + if (request.length === 1) return ""; + if (request.charCodeAt(1) !== slashCode) { + throw new Error('Request should be relative path and start with "./"'); } - - const moduleIdStringified = JSON.stringify(chunkGraph.getModuleId(module)); - if (waitForInstances.size === 1) { - const moduleId = Array.from(waitForInstances.values())[0]; - const promise = `installedWasmModules[${JSON.stringify(moduleId)}]`; - const variable = Array.from(waitForInstances.keys())[0]; - return Template.asString([ - `${moduleIdStringified}: function() {`, - Template.indent([ - `return promiseResolve().then(function() { return ${promise}; }).then(function(${variable}) {`, - Template.indent(importObject), - "});" - ]), - "}," - ]); - } else if (waitForInstances.size > 0) { - const promises = Array.from( - waitForInstances.values(), - id => `installedWasmModules[${JSON.stringify(id)}]` - ).join(", "); - const variables = Array.from( - waitForInstances.keys(), - (name, i) => `${name} = array[${i}]` - ).join(", "); - return Template.asString([ - `${moduleIdStringified}: function() {`, - Template.indent([ - `return promiseResolve().then(function() { return Promise.all([${promises}]); }).then(function(array) {`, - Template.indent([`var ${variables};`, ...importObject]), - "});" - ]), - "}," - ]); - } else { - return Template.asString([ - `${moduleIdStringified}: function() {`, - Template.indent(importObject), - "}," - ]); + if (request.charCodeAt(request.length - 1) === slashCode) { + throw new Error("Only requesting file allowed"); } -}; -class WasmChunkLoadingRuntimeModule extends RuntimeModule { - constructor({ - generateLoadBinaryCode, - supportsStreaming, - mangleImports, - runtimeRequirements - }) { - super("wasm chunk loading", RuntimeModule.STAGE_ATTACH); - this.generateLoadBinaryCode = generateLoadBinaryCode; - this.supportsStreaming = supportsStreaming; - this.mangleImports = mangleImports; - this._runtimeRequirements = runtimeRequirements; + return request.slice(2); +} + +/** + * @param {string} request request + * @returns {string} updated request + */ +function assertImportsFieldRequest(request) { + if (request.charCodeAt(0) !== hashCode) { + throw new Error('Request should start with "#"'); + } + if (request.length === 1) { + throw new Error("Request should have at least 2 characters"); + } + if (request.charCodeAt(1) === slashCode) { + throw new Error('Request should not start with "#/"'); + } + if (request.charCodeAt(request.length - 1) === slashCode) { + throw new Error("Only requesting file allowed"); } - /** - * @returns {string} runtime code - */ - generate() { - const { chunkGraph, compilation, chunk, mangleImports } = this; - const { moduleGraph, outputOptions } = compilation; - const fn = RuntimeGlobals.ensureChunkHandlers; - const withHmr = this._runtimeRequirements.has( - RuntimeGlobals.hmrDownloadUpdateHandlers - ); - const wasmModules = getAllWasmModules(moduleGraph, chunkGraph, chunk); - const declarations = []; - const importObjects = wasmModules.map(module => { - return generateImportObject( - chunkGraph, - module, - this.mangleImports, - declarations, - chunk.runtime - ); - }); - const chunkModuleIdMap = chunkGraph.getChunkModuleIdMap(chunk, m => - m.type.startsWith("webassembly") - ); - const createImportObject = content => - mangleImports - ? `{ ${JSON.stringify(WebAssemblyUtils.MANGLED_MODULE)}: ${content} }` - : content; - const wasmModuleSrcPath = compilation.getPath( - JSON.stringify(outputOptions.webassemblyModuleFilename), - { - hash: `" + ${RuntimeGlobals.getFullHash}() + "`, - hashWithLength: length => - `" + ${RuntimeGlobals.getFullHash}}().slice(0, ${length}) + "`, - module: { - id: '" + wasmModuleId + "', - hash: `" + ${JSON.stringify( - chunkGraph.getChunkModuleRenderedHashMap(chunk, m => - m.type.startsWith("webassembly") - ) - )}[chunkId][wasmModuleId] + "`, - hashWithLength(length) { - return `" + ${JSON.stringify( - chunkGraph.getChunkModuleRenderedHashMap( - chunk, - m => m.type.startsWith("webassembly"), - length - ) - )}[chunkId][wasmModuleId] + "`; - } - }, - runtime: chunk.runtime - } + return request.slice(1); +} + +/** + * @param {string} exp export target + * @param {boolean} expectFolder is folder expected + */ +function assertExportTarget(exp, expectFolder) { + if ( + exp.charCodeAt(0) === slashCode || + (exp.charCodeAt(0) === dotCode && exp.charCodeAt(1) !== slashCode) + ) { + throw new Error( + `Export should be relative path and start with "./", got ${JSON.stringify( + exp + )}.` ); + } - const stateExpression = withHmr - ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_wasm` - : undefined; + const isFolder = exp.charCodeAt(exp.length - 1) === slashCode; - return Template.asString([ - "// object to store loaded and loading wasm modules", - `var installedWasmModules = ${ - stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" - }{};`, - "", - // This function is used to delay reading the installed wasm module promises - // by a microtask. Sorting them doesn't help because there are edge cases where - // sorting is not possible (modules splitted into different chunks). - // So we not even trying and solve this by a microtask delay. - "function promiseResolve() { return Promise.resolve(); }", - "", - Template.asString(declarations), - "var wasmImportObjects = {", - Template.indent(importObjects), - "};", - "", - `var wasmModuleMap = ${JSON.stringify( - chunkModuleIdMap, - undefined, - "\t" - )};`, - "", - "// object with all WebAssembly.instance exports", - `${RuntimeGlobals.wasmInstances} = {};`, - "", - "// Fetch + compile chunk loading for webassembly", - `${fn}.wasm = function(chunkId, promises) {`, - Template.indent([ - "", - `var wasmModules = wasmModuleMap[chunkId] || [];`, - "", - "wasmModules.forEach(function(wasmModuleId, idx) {", - Template.indent([ - "var installedWasmModuleData = installedWasmModules[wasmModuleId];", - "", - '// a Promise means "currently loading" or "already loaded".', - "if(installedWasmModuleData)", - Template.indent(["promises.push(installedWasmModuleData);"]), - "else {", - Template.indent([ - `var importObject = wasmImportObjects[wasmModuleId]();`, - `var req = ${this.generateLoadBinaryCode(wasmModuleSrcPath)};`, - "var promise;", - this.supportsStreaming - ? Template.asString([ - "if(importObject && typeof importObject.then === 'function' && typeof WebAssembly.compileStreaming === 'function') {", - Template.indent([ - "promise = Promise.all([WebAssembly.compileStreaming(req), importObject]).then(function(items) {", - Template.indent([ - `return WebAssembly.instantiate(items[0], ${createImportObject( - "items[1]" - )});` - ]), - "});" - ]), - "} else if(typeof WebAssembly.instantiateStreaming === 'function') {", - Template.indent([ - `promise = WebAssembly.instantiateStreaming(req, ${createImportObject( - "importObject" - )});` - ]) - ]) - : Template.asString([ - "if(importObject && typeof importObject.then === 'function') {", - Template.indent([ - "var bytesPromise = req.then(function(x) { return x.arrayBuffer(); });", - "promise = Promise.all([", - Template.indent([ - "bytesPromise.then(function(bytes) { return WebAssembly.compile(bytes); }),", - "importObject" - ]), - "]).then(function(items) {", - Template.indent([ - `return WebAssembly.instantiate(items[0], ${createImportObject( - "items[1]" - )});` - ]), - "});" - ]) - ]), - "} else {", - Template.indent([ - "var bytesPromise = req.then(function(x) { return x.arrayBuffer(); });", - "promise = bytesPromise.then(function(bytes) {", - Template.indent([ - `return WebAssembly.instantiate(bytes, ${createImportObject( - "importObject" - )});` - ]), - "});" - ]), - "}", - "promises.push(installedWasmModules[wasmModuleId] = promise.then(function(res) {", - Template.indent([ - `return ${RuntimeGlobals.wasmInstances}[wasmModuleId] = (res.instance || res).exports;` - ]), - "}));" - ]), - "}" - ]), - "});" - ]), - "};" - ]); + if (isFolder !== expectFolder) { + throw new Error( + expectFolder + ? `Expecting folder to folder mapping. ${JSON.stringify( + exp + )} should end with "/"` + : `Expecting file to file mapping. ${JSON.stringify( + exp + )} should not end with "/"` + ); } } -module.exports = WasmChunkLoadingRuntimeModule; +/** + * @param {string} imp import target + * @param {boolean} expectFolder is folder expected + */ +function assertImportTarget(imp, expectFolder) { + const isFolder = imp.charCodeAt(imp.length - 1) === slashCode; + if (isFolder !== expectFolder) { + throw new Error( + expectFolder + ? `Expecting folder to folder mapping. ${JSON.stringify( + imp + )} should end with "/"` + : `Expecting file to file mapping. ${JSON.stringify( + imp + )} should not end with "/"` + ); + } +} -/***/ }), +/** + * Trying to match request to field + * @param {string} request request + * @param {PathTreeNode} treeRoot path tree root + * @returns {[MappingValue, number]|null} match or null, number is negative and one less when it's a folder mapping, number is request.length + 1 for direct mappings + */ +function findMatch(request, treeRoot) { + if (request.length === 0) { + const value = treeRoot.files.get(""); -/***/ 19810: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + return value ? [value, 1] : null; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if ( + treeRoot.children === null && + treeRoot.folder === null && + treeRoot.wildcards === null + ) { + const value = treeRoot.files.get(request); + return value ? [value, request.length + 1] : null; + } + let node = treeRoot; + let lastNonSlashIndex = 0; + let slashIndex = request.indexOf("/", 0); -const formatLocation = __webpack_require__(16734); -const UnsupportedWebAssemblyFeatureError = __webpack_require__(78455); + /** @type {[MappingValue, number]|null} */ + let lastFolderMatch = null; -/** @typedef {import("../Compiler")} Compiler */ + const applyFolderMapping = () => { + const folderMapping = node.folder; + if (folderMapping) { + if (lastFolderMatch) { + lastFolderMatch[0] = folderMapping; + lastFolderMatch[1] = -lastNonSlashIndex - 1; + } else { + lastFolderMatch = [folderMapping, -lastNonSlashIndex - 1]; + } + } + }; -class WasmFinalizeExportsPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap("WasmFinalizeExportsPlugin", compilation => { - compilation.hooks.finishModules.tap( - "WasmFinalizeExportsPlugin", - modules => { - for (const module of modules) { - // 1. if a WebAssembly module - if (module.type.startsWith("webassembly") === true) { - const jsIncompatibleExports = - module.buildMeta.jsIncompatibleExports; + const applyWildcardMappings = (wildcardMappings, remainingRequest) => { + if (wildcardMappings) { + for (const [key, target] of wildcardMappings) { + if (remainingRequest.startsWith(key)) { + if (!lastFolderMatch) { + lastFolderMatch = [target, lastNonSlashIndex + key.length]; + } else if (lastFolderMatch[1] < lastNonSlashIndex + key.length) { + lastFolderMatch[0] = target; + lastFolderMatch[1] = lastNonSlashIndex + key.length; + } + } + } + } + }; - if (jsIncompatibleExports === undefined) { - continue; - } + while (slashIndex !== -1) { + applyFolderMapping(); - for (const connection of compilation.moduleGraph.getIncomingConnections( - module - )) { - // 2. is active and referenced by a non-WebAssembly module - if ( - connection.isTargetActive(undefined) && - connection.originModule.type.startsWith("webassembly") === - false - ) { - const referencedExports = - compilation.getDependencyReferencedExports( - connection.dependency, - undefined - ); + const wildcardMappings = node.wildcards; - for (const info of referencedExports) { - const names = Array.isArray(info) ? info : info.name; - if (names.length === 0) continue; - const name = names[0]; - if (typeof name === "object") continue; - // 3. and uses a func with an incompatible JS signature - if ( - Object.prototype.hasOwnProperty.call( - jsIncompatibleExports, - name - ) - ) { - // 4. error - const error = new UnsupportedWebAssemblyFeatureError( - `Export "${name}" with ${jsIncompatibleExports[name]} can only be used for direct wasm to wasm dependencies\n` + - `It's used from ${connection.originModule.readableIdentifier( - compilation.requestShortener - )} at ${formatLocation(connection.dependency.loc)}.` - ); - error.module = module; - compilation.errors.push(error); - } - } - } - } - } - } - } - ); - }); - } -} + if (!wildcardMappings && node.children === null) return lastFolderMatch; -module.exports = WasmFinalizeExportsPlugin; + const folder = request.slice(lastNonSlashIndex, slashIndex); + applyWildcardMappings(wildcardMappings, folder); -/***/ }), + if (node.children === null) return lastFolderMatch; -/***/ 47012: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + const newNode = node.children.get(folder); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (!newNode) { + return lastFolderMatch; + } + + node = newNode; + lastNonSlashIndex = slashIndex + 1; + slashIndex = request.indexOf("/", lastNonSlashIndex); + } + const remainingRequest = + lastNonSlashIndex > 0 ? request.slice(lastNonSlashIndex) : request; + const value = node.files.get(remainingRequest); -const { RawSource } = __webpack_require__(51255); -const Generator = __webpack_require__(93401); -const WebAssemblyUtils = __webpack_require__(18650); + if (value) { + return [value, request.length + 1]; + } -const t = __webpack_require__(51826); -const { moduleContextFromModuleAST } = __webpack_require__(51826); -const { editWithAST, addWithAST } = __webpack_require__(87362); -const { decode } = __webpack_require__(73726); + applyFolderMapping(); -const WebAssemblyExportImportedDependency = __webpack_require__(52204); + applyWildcardMappings(node.wildcards, remainingRequest); -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../NormalModule")} NormalModule */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ -/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -/** @typedef {import("./WebAssemblyUtils").UsedWasmDependency} UsedWasmDependency */ + return lastFolderMatch; +} /** - * @typedef {(ArrayBuffer) => ArrayBuffer} ArrayBufferTransform + * @param {ConditionalMapping|DirectMapping|null} mapping mapping + * @returns {boolean} is conditional mapping */ +function isConditionalMapping(mapping) { + return ( + mapping !== null && typeof mapping === "object" && !Array.isArray(mapping) + ); +} /** - * @template T - * @param {Function[]} fns transforms - * @returns {Function} composed transform + * @param {string|undefined} remainingRequest remaining request when folder mapping, undefined for file mappings + * @param {boolean} subpathMapping true, for subpath mappings + * @param {DirectMapping|null} mappingTarget direct export + * @param {Set} conditionNames condition names + * @param {(d: string, f: boolean) => void} assert asserting direct value + * @returns {string[]} mapping result */ -const compose = (...fns) => { - return fns.reduce( - (prevFn, nextFn) => { - return value => nextFn(prevFn(value)); - }, - value => value - ); -}; +function directMapping( + remainingRequest, + subpathMapping, + mappingTarget, + conditionNames, + assert +) { + if (mappingTarget === null) return []; + + if (typeof mappingTarget === "string") { + return [ + targetMapping(remainingRequest, subpathMapping, mappingTarget, assert) + ]; + } + + const targets = []; + + for (const exp of mappingTarget) { + if (typeof exp === "string") { + targets.push( + targetMapping(remainingRequest, subpathMapping, exp, assert) + ); + continue; + } + + const mapping = conditionalMapping(exp, conditionNames); + if (!mapping) continue; + const innerExports = directMapping( + remainingRequest, + subpathMapping, + mapping, + conditionNames, + assert + ); + for (const innerExport of innerExports) { + targets.push(innerExport); + } + } + + return targets; +} /** - * Removes the start instruction - * - * @param {Object} state unused state - * @returns {ArrayBufferTransform} transform + * @param {string|undefined} remainingRequest remaining request when folder mapping, undefined for file mappings + * @param {boolean} subpathMapping true, for subpath mappings + * @param {string} mappingTarget direct export + * @param {(d: string, f: boolean) => void} assert asserting direct value + * @returns {string} mapping result */ -const removeStartFunc = state => bin => { - return editWithAST(state.ast, bin, { - Start(path) { - path.remove(); - } - }); -}; +function targetMapping( + remainingRequest, + subpathMapping, + mappingTarget, + assert +) { + if (remainingRequest === undefined) { + assert(mappingTarget, false); + return mappingTarget; + } + if (subpathMapping) { + assert(mappingTarget, true); + return mappingTarget + remainingRequest; + } + assert(mappingTarget, false); + return mappingTarget.replace(/\*/g, remainingRequest.replace(/\$/g, "$$")); +} /** - * Get imported globals - * - * @param {Object} ast Module's AST - * @returns {Array} - nodes + * @param {ConditionalMapping} conditionalMapping_ conditional mapping + * @param {Set} conditionNames condition names + * @returns {DirectMapping|null} direct mapping if found */ -const getImportedGlobals = ast => { - const importedGlobals = []; +function conditionalMapping(conditionalMapping_, conditionNames) { + /** @type {[ConditionalMapping, string[], number][]} */ + let lookup = [[conditionalMapping_, Object.keys(conditionalMapping_), 0]]; - t.traverse(ast, { - ModuleImport({ node }) { - if (t.isGlobalType(node.descr)) { - importedGlobals.push(node); - } - } - }); + loop: while (lookup.length > 0) { + const [mapping, conditions, j] = lookup[lookup.length - 1]; + const last = conditions.length - 1; - return importedGlobals; -}; + for (let i = j; i < conditions.length; i++) { + const condition = conditions[i]; -/** - * Get the count for imported func - * - * @param {Object} ast Module's AST - * @returns {Number} - count - */ -const getCountImportedFunc = ast => { - let count = 0; + // assert default. Could be last only + if (i !== last) { + if (condition === "default") { + throw new Error("Default condition should be last one"); + } + } else if (condition === "default") { + const innerMapping = mapping[condition]; + // is nested + if (isConditionalMapping(innerMapping)) { + const conditionalMapping = /** @type {ConditionalMapping} */ (innerMapping); + lookup[lookup.length - 1][2] = i + 1; + lookup.push([conditionalMapping, Object.keys(conditionalMapping), 0]); + continue loop; + } - t.traverse(ast, { - ModuleImport({ node }) { - if (t.isFuncImportDescr(node.descr)) { - count++; + return /** @type {DirectMapping} */ (innerMapping); } - } - }); - return count; -}; + if (conditionNames.has(condition)) { + const innerMapping = mapping[condition]; + // is nested + if (isConditionalMapping(innerMapping)) { + const conditionalMapping = /** @type {ConditionalMapping} */ (innerMapping); + lookup[lookup.length - 1][2] = i + 1; + lookup.push([conditionalMapping, Object.keys(conditionalMapping), 0]); + continue loop; + } -/** - * Get next type index - * - * @param {Object} ast Module's AST - * @returns {t.Index} - index - */ -const getNextTypeIndex = ast => { - const typeSectionMetadata = t.getSectionMetadata(ast, "type"); + return /** @type {DirectMapping} */ (innerMapping); + } + } - if (typeSectionMetadata === undefined) { - return t.indexLiteral(0); + lookup.pop(); } - return t.indexLiteral(typeSectionMetadata.vectorOfSize.value); -}; + return null; +} /** - * Get next func index - * - * The Func section metadata provide informations for implemented funcs - * in order to have the correct index we shift the index by number of external - * functions. - * - * @param {Object} ast Module's AST - * @param {Number} countImportedFunc number of imported funcs - * @returns {t.Index} - index + * Internal helper to create path tree node + * to ensure that each node gets the same hidden class + * @returns {PathTreeNode} node */ -const getNextFuncIndex = (ast, countImportedFunc) => { - const funcSectionMetadata = t.getSectionMetadata(ast, "func"); +function createNode() { + return { + children: null, + folder: null, + wildcards: null, + files: new Map() + }; +} - if (funcSectionMetadata === undefined) { - return t.indexLiteral(0 + countImportedFunc); +/** + * Internal helper for building path tree + * @param {PathTreeNode} root root + * @param {string} path path + * @param {MappingValue} target target + */ +function walkPath(root, path, target) { + if (path.length === 0) { + root.folder = target; + return; } - const vectorOfSize = funcSectionMetadata.vectorOfSize.value; + let node = root; + // Typical path tree can looks like + // root + // - files: ["a.js", "b.js"] + // - children: + // node1: + // - files: ["a.js", "b.js"] + let lastNonSlashIndex = 0; + let slashIndex = path.indexOf("/", 0); - return t.indexLiteral(vectorOfSize + countImportedFunc); -}; + while (slashIndex !== -1) { + const folder = path.slice(lastNonSlashIndex, slashIndex); + let newNode; -/** - * Creates an init instruction for a global type - * @param {t.GlobalType} globalType the global type - * @returns {t.Instruction} init expression - */ -const createDefaultInitForGlobal = globalType => { - if (globalType.valtype[0] === "i") { - // create NumberLiteral global initializer - return t.objectInstruction("const", globalType.valtype, [ - t.numberLiteralFromRaw(66) - ]); - } else if (globalType.valtype[0] === "f") { - // create FloatLiteral global initializer - return t.objectInstruction("const", globalType.valtype, [ - t.floatLiteral(66, false, false, "66") - ]); + if (node.children === null) { + newNode = createNode(); + node.children = new Map(); + node.children.set(folder, newNode); + } else { + newNode = node.children.get(folder); + + if (!newNode) { + newNode = createNode(); + node.children.set(folder, newNode); + } + } + + node = newNode; + lastNonSlashIndex = slashIndex + 1; + slashIndex = path.indexOf("/", lastNonSlashIndex); + } + + if (lastNonSlashIndex >= path.length) { + node.folder = target; } else { - throw new Error("unknown type: " + globalType.valtype); + const file = lastNonSlashIndex > 0 ? path.slice(lastNonSlashIndex) : path; + if (file.endsWith("*")) { + if (node.wildcards === null) node.wildcards = new Map(); + node.wildcards.set(file.slice(0, -1), target); + } else { + node.files.set(file, target); + } } -}; +} /** - * Rewrite the import globals: - * - removes the ModuleImport instruction - * - injects at the same offset a mutable global of the same type - * - * Since the imported globals are before the other global declarations, our - * indices will be preserved. - * - * Note that globals will become mutable. - * - * @param {Object} state unused state - * @returns {ArrayBufferTransform} transform + * @param {ExportsField} field exports field + * @returns {PathTreeNode} tree root */ -const rewriteImportedGlobals = state => bin => { - const additionalInitCode = state.additionalInitCode; - const newGlobals = []; +function buildExportsFieldPathTree(field) { + const root = createNode(); - bin = editWithAST(state.ast, bin, { - ModuleImport(path) { - if (t.isGlobalType(path.node.descr)) { - const globalType = path.node.descr; + // handle syntax sugar, if exports field is direct mapping for "." + if (typeof field === "string") { + root.files.set("", field); - globalType.mutability = "var"; + return root; + } else if (Array.isArray(field)) { + root.files.set("", field.slice()); - const init = [ - createDefaultInitForGlobal(globalType), - t.instruction("end") - ]; + return root; + } - newGlobals.push(t.global(globalType, init)); + const keys = Object.keys(field); - path.remove(); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + + if (key.charCodeAt(0) !== dotCode) { + // handle syntax sugar, if exports field is conditional mapping for "." + if (i === 0) { + while (i < keys.length) { + const charCode = keys[i].charCodeAt(0); + if (charCode === dotCode || charCode === slashCode) { + throw new Error( + `Exports field key should be relative path and start with "." (key: ${JSON.stringify( + key + )})` + ); + } + i++; + } + + root.files.set("", field); + return root; } - }, - // in order to preserve non-imported global's order we need to re-inject - // those as well - Global(path) { - const { node } = path; - const [init] = node.init; + throw new Error( + `Exports field key should be relative path and start with "." (key: ${JSON.stringify( + key + )})` + ); + } - if (init.id === "get_global") { - node.globalType.mutability = "var"; + if (key.length === 1) { + root.files.set("", field[key]); + continue; + } - const initialGlobalIdx = init.args[0]; + if (key.charCodeAt(1) !== slashCode) { + throw new Error( + `Exports field key should be relative path and start with "./" (key: ${JSON.stringify( + key + )})` + ); + } - node.init = [ - createDefaultInitForGlobal(node.globalType), - t.instruction("end") - ]; + walkPath(root, key.slice(2), field[key]); + } - additionalInitCode.push( - /** - * get_global in global initializer only works for imported globals. - * They have the same indices as the init params, so use the - * same index. - */ - t.instruction("get_local", [initialGlobalIdx]), - t.instruction("set_global", [t.indexLiteral(newGlobals.length)]) - ); - } + return root; +} - newGlobals.push(node); +/** + * @param {ImportsField} field imports field + * @returns {PathTreeNode} root + */ +function buildImportsFieldPathTree(field) { + const root = createNode(); - path.remove(); + const keys = Object.keys(field); + + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + + if (key.charCodeAt(0) !== hashCode) { + throw new Error( + `Imports field key should start with "#" (key: ${JSON.stringify(key)})` + ); } - }); - // Add global declaration instructions - return addWithAST(state.ast, bin, newGlobals); -}; + if (key.length === 1) { + throw new Error( + `Imports field key should have at least 2 characters (key: ${JSON.stringify( + key + )})` + ); + } -/** - * Rewrite the export names - * @param {Object} state state - * @param {Object} state.ast Module's ast - * @param {Module} state.module Module - * @param {ModuleGraph} state.moduleGraph module graph - * @param {Set} state.externalExports Module - * @param {RuntimeSpec} state.runtime runtime - * @returns {ArrayBufferTransform} transform - */ -const rewriteExportNames = - ({ ast, moduleGraph, module, externalExports, runtime }) => - bin => { - return editWithAST(ast, bin, { - ModuleExport(path) { - const isExternal = externalExports.has(path.node.name); - if (isExternal) { - path.remove(); - return; - } - const usedName = moduleGraph - .getExportsInfo(module) - .getUsedName(path.node.name, runtime); - if (!usedName) { - path.remove(); - return; - } - path.node.name = usedName; - } - }); - }; + if (key.charCodeAt(1) === slashCode) { + throw new Error( + `Imports field key should not start with "#/" (key: ${JSON.stringify( + key + )})` + ); + } -/** - * Mangle import names and modules - * @param {Object} state state - * @param {Object} state.ast Module's ast - * @param {Map} state.usedDependencyMap mappings to mangle names - * @returns {ArrayBufferTransform} transform - */ -const rewriteImports = - ({ ast, usedDependencyMap }) => - bin => { - return editWithAST(ast, bin, { - ModuleImport(path) { - const result = usedDependencyMap.get( - path.node.module + ":" + path.node.name - ); + walkPath(root, key.slice(1), field[key]); + } - if (result !== undefined) { - path.node.module = result.module; - path.node.name = result.name; - } - } - }); - }; + return root; +} + + +/***/ }), + +/***/ 71053: +/***/ (function(module) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ + + + +const PATH_QUERY_FRAGMENT_REGEXP = /^(#?(?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/; /** - * Add an init function. - * - * The init function fills the globals given input arguments. - * - * @param {Object} state transformation state - * @param {Object} state.ast Module's ast - * @param {t.Identifier} state.initFuncId identifier of the init function - * @param {t.Index} state.startAtFuncOffset index of the start function - * @param {t.ModuleImport[]} state.importedGlobals list of imported globals - * @param {t.Instruction[]} state.additionalInitCode list of addition instructions for the init function - * @param {t.Index} state.nextFuncIndex index of the next function - * @param {t.Index} state.nextTypeIndex index of the next type - * @returns {ArrayBufferTransform} transform + * @param {string} identifier identifier + * @returns {[string, string, string]|null} parsed identifier */ -const addInitFunction = - ({ - ast, - initFuncId, - startAtFuncOffset, - importedGlobals, - additionalInitCode, - nextFuncIndex, - nextTypeIndex - }) => - bin => { - const funcParams = importedGlobals.map(importedGlobal => { - // used for debugging - const id = t.identifier( - `${importedGlobal.module}.${importedGlobal.name}` - ); +function parseIdentifier(identifier) { + const match = PATH_QUERY_FRAGMENT_REGEXP.exec(identifier); - return t.funcParam(importedGlobal.descr.valtype, id); - }); + if (!match) return null; - const funcBody = []; - importedGlobals.forEach((importedGlobal, index) => { - const args = [t.indexLiteral(index)]; - const body = [ - t.instruction("get_local", args), - t.instruction("set_global", args) - ]; + return [ + match[1].replace(/\0(.)/g, "$1"), + match[2] ? match[2].replace(/\0(.)/g, "$1") : "", + match[3] || "" + ]; +} - funcBody.push(...body); - }); +module.exports.parseIdentifier = parseIdentifier; - if (typeof startAtFuncOffset === "number") { - funcBody.push( - t.callInstruction(t.numberLiteralFromRaw(startAtFuncOffset)) - ); - } - for (const instr of additionalInitCode) { - funcBody.push(instr); - } +/***/ }), - funcBody.push(t.instruction("end")); +/***/ 67079: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - const funcResults = []; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // Code section - const funcSignature = t.signature(funcParams, funcResults); - const func = t.func(initFuncId, funcSignature, funcBody); - // Type section - const functype = t.typeInstruction(undefined, funcSignature); - // Func section - const funcindex = t.indexInFuncSection(nextTypeIndex); +const path = __webpack_require__(71017); - // Export section - const moduleExport = t.moduleExport( - initFuncId.value, - t.moduleExportDescr("Func", nextFuncIndex) - ); +const CHAR_HASH = "#".charCodeAt(0); +const CHAR_SLASH = "/".charCodeAt(0); +const CHAR_BACKSLASH = "\\".charCodeAt(0); +const CHAR_A = "A".charCodeAt(0); +const CHAR_Z = "Z".charCodeAt(0); +const CHAR_LOWER_A = "a".charCodeAt(0); +const CHAR_LOWER_Z = "z".charCodeAt(0); +const CHAR_DOT = ".".charCodeAt(0); +const CHAR_COLON = ":".charCodeAt(0); - return addWithAST(ast, bin, [func, moduleExport, funcindex, functype]); - }; +const posixNormalize = path.posix.normalize; +const winNormalize = path.win32.normalize; /** - * Extract mangle mappings from module - * @param {ModuleGraph} moduleGraph module graph - * @param {Module} module current module - * @param {boolean} mangle mangle imports - * @returns {Map} mappings to mangled names + * @enum {number} */ -const getUsedDependencyMap = (moduleGraph, module, mangle) => { - /** @type {Map} */ - const map = new Map(); - for (const usedDep of WebAssemblyUtils.getUsedDependencies( - moduleGraph, - module, - mangle - )) { - const dep = usedDep.dependency; - const request = dep.request; - const exportName = dep.name; - map.set(request + ":" + exportName, usedDep); +const PathType = Object.freeze({ + Empty: 0, + Normal: 1, + Relative: 2, + AbsoluteWin: 3, + AbsolutePosix: 4, + Internal: 5 +}); +exports.PathType = PathType; + +/** + * @param {string} p a path + * @returns {PathType} type of path + */ +const getType = p => { + switch (p.length) { + case 0: + return PathType.Empty; + case 1: { + const c0 = p.charCodeAt(0); + switch (c0) { + case CHAR_DOT: + return PathType.Relative; + case CHAR_SLASH: + return PathType.AbsolutePosix; + case CHAR_HASH: + return PathType.Internal; + } + return PathType.Normal; + } + case 2: { + const c0 = p.charCodeAt(0); + switch (c0) { + case CHAR_DOT: { + const c1 = p.charCodeAt(1); + switch (c1) { + case CHAR_DOT: + case CHAR_SLASH: + return PathType.Relative; + } + return PathType.Normal; + } + case CHAR_SLASH: + return PathType.AbsolutePosix; + case CHAR_HASH: + return PathType.Internal; + } + const c1 = p.charCodeAt(1); + if (c1 === CHAR_COLON) { + if ( + (c0 >= CHAR_A && c0 <= CHAR_Z) || + (c0 >= CHAR_LOWER_A && c0 <= CHAR_LOWER_Z) + ) { + return PathType.AbsoluteWin; + } + } + return PathType.Normal; + } } - return map; + const c0 = p.charCodeAt(0); + switch (c0) { + case CHAR_DOT: { + const c1 = p.charCodeAt(1); + switch (c1) { + case CHAR_SLASH: + return PathType.Relative; + case CHAR_DOT: { + const c2 = p.charCodeAt(2); + if (c2 === CHAR_SLASH) return PathType.Relative; + return PathType.Normal; + } + } + return PathType.Normal; + } + case CHAR_SLASH: + return PathType.AbsolutePosix; + case CHAR_HASH: + return PathType.Internal; + } + const c1 = p.charCodeAt(1); + if (c1 === CHAR_COLON) { + const c2 = p.charCodeAt(2); + if ( + (c2 === CHAR_BACKSLASH || c2 === CHAR_SLASH) && + ((c0 >= CHAR_A && c0 <= CHAR_Z) || + (c0 >= CHAR_LOWER_A && c0 <= CHAR_LOWER_Z)) + ) { + return PathType.AbsoluteWin; + } + } + return PathType.Normal; }; +exports.getType = getType; -const TYPES = new Set(["webassembly"]); - -class WebAssemblyGenerator extends Generator { - constructor(options) { - super(); - this.options = options; +/** + * @param {string} p a path + * @returns {string} the normalized path + */ +const normalize = p => { + switch (getType(p)) { + case PathType.Empty: + return p; + case PathType.AbsoluteWin: + return winNormalize(p); + case PathType.Relative: { + const r = posixNormalize(p); + return getType(r) === PathType.Relative ? r : `./${r}`; + } } + return posixNormalize(p); +}; +exports.normalize = normalize; - /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) - */ - getTypes(module) { - return TYPES; +/** + * @param {string} rootPath the root path + * @param {string | undefined} request the request path + * @returns {string} the joined path + */ +const join = (rootPath, request) => { + if (!request) return normalize(rootPath); + const requestType = getType(request); + switch (requestType) { + case PathType.AbsolutePosix: + return posixNormalize(request); + case PathType.AbsoluteWin: + return winNormalize(request); } - - /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module - */ - getSize(module, type) { - const originalSource = module.originalSource(); - if (!originalSource) { - return 0; + switch (getType(rootPath)) { + case PathType.Normal: + case PathType.Relative: + case PathType.AbsolutePosix: + return posixNormalize(`${rootPath}/${request}`); + case PathType.AbsoluteWin: + return winNormalize(`${rootPath}\\${request}`); + } + switch (requestType) { + case PathType.Empty: + return rootPath; + case PathType.Relative: { + const r = posixNormalize(rootPath); + return getType(r) === PathType.Relative ? r : `./${r}`; } - return originalSource.size(); } + return posixNormalize(rootPath); +}; +exports.join = join; - /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code - */ - generate(module, { moduleGraph, runtime }) { - const bin = module.originalSource().source(); - - const initFuncId = t.identifier(""); +const joinCache = new Map(); - // parse it - const ast = decode(bin, { - ignoreDataSection: true, - ignoreCodeSection: true, - ignoreCustomNameSection: true - }); +/** + * @param {string} rootPath the root path + * @param {string | undefined} request the request path + * @returns {string} the joined path + */ +const cachedJoin = (rootPath, request) => { + let cacheEntry; + let cache = joinCache.get(rootPath); + if (cache === undefined) { + joinCache.set(rootPath, (cache = new Map())); + } else { + cacheEntry = cache.get(request); + if (cacheEntry !== undefined) return cacheEntry; + } + cacheEntry = join(rootPath, request); + cache.set(request, cacheEntry); + return cacheEntry; +}; +exports.cachedJoin = cachedJoin; - const moduleContext = moduleContextFromModuleAST(ast.body[0]); +const checkExportsFieldTarget = relativePath => { + let lastNonSlashIndex = 2; + let slashIndex = relativePath.indexOf("/", 2); + let cd = 0; - const importedGlobals = getImportedGlobals(ast); - const countImportedFunc = getCountImportedFunc(ast); - const startAtFuncOffset = moduleContext.getStart(); - const nextFuncIndex = getNextFuncIndex(ast, countImportedFunc); - const nextTypeIndex = getNextTypeIndex(ast); + while (slashIndex !== -1) { + const folder = relativePath.slice(lastNonSlashIndex, slashIndex); - const usedDependencyMap = getUsedDependencyMap( - moduleGraph, - module, - this.options.mangleImports - ); - const externalExports = new Set( - module.dependencies - .filter(d => d instanceof WebAssemblyExportImportedDependency) - .map(d => { - const wasmDep = /** @type {WebAssemblyExportImportedDependency} */ ( - d + switch (folder) { + case "..": { + cd--; + if (cd < 0) + return new Error( + `Trying to access out of package scope. Requesting ${relativePath}` ); - return wasmDep.exportName; - }) - ); - - /** @type {t.Instruction[]} */ - const additionalInitCode = []; - - const transform = compose( - rewriteExportNames({ - ast, - moduleGraph, - module, - externalExports, - runtime - }), + break; + } + default: + cd++; + break; + } - removeStartFunc({ ast }), + lastNonSlashIndex = slashIndex + 1; + slashIndex = relativePath.indexOf("/", lastNonSlashIndex); + } +}; +exports.checkExportsFieldTarget = checkExportsFieldTarget; - rewriteImportedGlobals({ ast, additionalInitCode }), - rewriteImports({ - ast, - usedDependencyMap - }), +/***/ }), - addInitFunction({ - ast, - initFuncId, - importedGlobals, - additionalInitCode, - startAtFuncOffset, - nextFuncIndex, - nextTypeIndex - }) - ); +/***/ 39102: +/***/ (function(module) { - const newBin = transform(bin); +"use strict"; - const newBuf = Buffer.from(newBin); - return new RawSource(newBuf); +class LoadingLoaderError extends Error { + constructor(message) { + super(message); + this.name = "LoaderRunnerError"; + Error.captureStackTrace(this, this.constructor); } } -module.exports = WebAssemblyGenerator; +module.exports = LoadingLoaderError; /***/ }), -/***/ 47342: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 8255: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -"use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ +var fs = __webpack_require__(57147); +var readFile = fs.readFile.bind(fs); +var loadLoader = __webpack_require__(44690); +function utf8BufferToString(buf) { + var str = buf.toString("utf-8"); + if(str.charCodeAt(0) === 0xFEFF) { + return str.substr(1); + } else { + return str; + } +} - -const WebpackError = __webpack_require__(53799); - -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../RequestShortener")} RequestShortener */ +const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/; /** - * @param {Module} module module to get chains from - * @param {ModuleGraph} moduleGraph the module graph - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {RequestShortener} requestShortener to make readable identifiers - * @returns {string[]} all chains to the module + * @param {string} str the path with query and fragment + * @returns {{ path: string, query: string, fragment: string }} parsed parts */ -const getInitialModuleChains = ( - module, - moduleGraph, - chunkGraph, - requestShortener -) => { - const queue = [ - { head: module, message: module.readableIdentifier(requestShortener) } - ]; - /** @type {Set} */ - const results = new Set(); - /** @type {Set} */ - const incompleteResults = new Set(); - /** @type {Set} */ - const visitedModules = new Set(); +function parsePathQueryFragment(str) { + var match = PATH_QUERY_FRAGMENT_REGEXP.exec(str); + return { + path: match[1].replace(/\0(.)/g, "$1"), + query: match[2] ? match[2].replace(/\0(.)/g, "$1") : "", + fragment: match[3] || "" + }; +} - for (const chain of queue) { - const { head, message } = chain; - let final = true; - /** @type {Set} */ - const alreadyReferencedModules = new Set(); - for (const connection of moduleGraph.getIncomingConnections(head)) { - const newHead = connection.originModule; - if (newHead) { - if (!chunkGraph.getModuleChunks(newHead).some(c => c.canBeInitial())) - continue; - final = false; - if (alreadyReferencedModules.has(newHead)) continue; - alreadyReferencedModules.add(newHead); - const moduleName = newHead.readableIdentifier(requestShortener); - const detail = connection.explanation - ? ` (${connection.explanation})` - : ""; - const newMessage = `${moduleName}${detail} --> ${message}`; - if (visitedModules.has(newHead)) { - incompleteResults.add(`... --> ${newMessage}`); - continue; - } - visitedModules.add(newHead); - queue.push({ - head: newHead, - message: newMessage - }); +function dirname(path) { + if(path === "/") return "/"; + var i = path.lastIndexOf("/"); + var j = path.lastIndexOf("\\"); + var i2 = path.indexOf("/"); + var j2 = path.indexOf("\\"); + var idx = i > j ? i : j; + var idx2 = i > j ? i2 : j2; + if(idx < 0) return path; + if(idx === idx2) return path.substr(0, idx + 1); + return path.substr(0, idx); +} + +function createLoaderObject(loader) { + var obj = { + path: null, + query: null, + fragment: null, + options: null, + ident: null, + normal: null, + pitch: null, + raw: null, + data: null, + pitchExecuted: false, + normalExecuted: false + }; + Object.defineProperty(obj, "request", { + enumerable: true, + get: function() { + return obj.path.replace(/#/g, "\0#") + obj.query.replace(/#/g, "\0#") + obj.fragment; + }, + set: function(value) { + if(typeof value === "string") { + var splittedRequest = parsePathQueryFragment(value); + obj.path = splittedRequest.path; + obj.query = splittedRequest.query; + obj.fragment = splittedRequest.fragment; + obj.options = undefined; + obj.ident = undefined; } else { - final = false; - const newMessage = connection.explanation - ? `(${connection.explanation}) --> ${message}` - : message; - results.add(newMessage); + if(!value.loader) + throw new Error("request should be a string or object with loader and options (" + JSON.stringify(value) + ")"); + obj.path = value.loader; + obj.fragment = value.fragment || ""; + obj.type = value.type; + obj.options = value.options; + obj.ident = value.ident; + if(obj.options === null) + obj.query = ""; + else if(obj.options === undefined) + obj.query = ""; + else if(typeof obj.options === "string") + obj.query = "?" + obj.options; + else if(obj.ident) + obj.query = "??" + obj.ident; + else if(typeof obj.options === "object" && obj.options.ident) + obj.query = "??" + obj.options.ident; + else + obj.query = "?" + JSON.stringify(obj.options); } } - if (final) { - results.add(message); - } + }); + obj.request = loader; + if(Object.preventExtensions) { + Object.preventExtensions(obj); } - for (const result of incompleteResults) { - results.add(result); + return obj; +} + +function runSyncOrAsync(fn, context, args, callback) { + var isSync = true; + var isDone = false; + var isError = false; // internal error + var reportedError = false; + context.async = function async() { + if(isDone) { + if(reportedError) return; // ignore + throw new Error("async(): The callback was already called."); + } + isSync = false; + return innerCallback; + }; + var innerCallback = context.callback = function() { + if(isDone) { + if(reportedError) return; // ignore + throw new Error("callback(): The callback was already called."); + } + isDone = true; + isSync = false; + try { + callback.apply(null, arguments); + } catch(e) { + isError = true; + throw e; + } + }; + try { + var result = (function LOADER_EXECUTION() { + return fn.apply(context, args); + }()); + if(isSync) { + isDone = true; + if(result === undefined) + return callback(); + if(result && typeof result === "object" && typeof result.then === "function") { + return result.then(function(r) { + callback(null, r); + }, callback); + } + return callback(null, result); + } + } catch(e) { + if(isError) throw e; + if(isDone) { + // loader is already "done", so we cannot use the callback function + // for better debugging we print the error on the console + if(typeof e === "object" && e.stack) console.error(e.stack); + else console.error(e); + return; + } + isDone = true; + reportedError = true; + callback(e); } - return Array.from(results); -}; -module.exports = class WebAssemblyInInitialChunkError extends WebpackError { - /** - * @param {Module} module WASM module - * @param {ModuleGraph} moduleGraph the module graph - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {RequestShortener} requestShortener request shortener - */ - constructor(module, moduleGraph, chunkGraph, requestShortener) { - const moduleChains = getInitialModuleChains( - module, - moduleGraph, - chunkGraph, - requestShortener - ); - const message = `WebAssembly module is included in initial chunk. -This is not allowed, because WebAssembly download and compilation must happen asynchronous. -Add an async split point (i. e. import()) somewhere between your entrypoint and the WebAssembly module: -${moduleChains.map(s => `* ${s}`).join("\n")}`; +} - super(message); - this.name = "WebAssemblyInInitialChunkError"; - this.hideStack = true; - this.module = module; - } -}; +function convertArgs(args, raw) { + if(!raw && Buffer.isBuffer(args[0])) + args[0] = utf8BufferToString(args[0]); + else if(raw && typeof args[0] === "string") + args[0] = Buffer.from(args[0], "utf-8"); +} +function iteratePitchingLoaders(options, loaderContext, callback) { + // abort after last loader + if(loaderContext.loaderIndex >= loaderContext.loaders.length) + return processResource(options, loaderContext, callback); -/***/ }), + var currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex]; -/***/ 46545: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // iterate + if(currentLoaderObject.pitchExecuted) { + loaderContext.loaderIndex++; + return iteratePitchingLoaders(options, loaderContext, callback); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // load loader module + loadLoader(currentLoaderObject, function(err) { + if(err) { + loaderContext.cacheable(false); + return callback(err); + } + var fn = currentLoaderObject.pitch; + currentLoaderObject.pitchExecuted = true; + if(!fn) return iteratePitchingLoaders(options, loaderContext, callback); + runSyncOrAsync( + fn, + loaderContext, [loaderContext.remainingRequest, loaderContext.previousRequest, currentLoaderObject.data = {}], + function(err) { + if(err) return callback(err); + var args = Array.prototype.slice.call(arguments, 1); + // Determine whether to continue the pitching process based on + // argument values (as opposed to argument presence) in order + // to support synchronous and asynchronous usages. + var hasArg = args.some(function(value) { + return value !== undefined; + }); + if(hasArg) { + loaderContext.loaderIndex--; + iterateNormalLoaders(options, loaderContext, args, callback); + } else { + iteratePitchingLoaders(options, loaderContext, callback); + } + } + ); + }); +} +function processResource(options, loaderContext, callback) { + // set loader index to last loader + loaderContext.loaderIndex = loaderContext.loaders.length - 1; -const { RawSource } = __webpack_require__(51255); -const { UsageState } = __webpack_require__(63686); -const Generator = __webpack_require__(93401); -const InitFragment = __webpack_require__(55870); -const RuntimeGlobals = __webpack_require__(16475); -const Template = __webpack_require__(39722); -const ModuleDependency = __webpack_require__(80321); -const WebAssemblyExportImportedDependency = __webpack_require__(52204); -const WebAssemblyImportDependency = __webpack_require__(5239); + var resourcePath = loaderContext.resourcePath; + if(resourcePath) { + options.processResource(loaderContext, resourcePath, function(err, buffer) { + if(err) return callback(err); + options.resourceBuffer = buffer; + iterateNormalLoaders(options, loaderContext, [buffer], callback); + }); + } else { + iterateNormalLoaders(options, loaderContext, [null], callback); + } +} -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Dependency")} Dependency */ -/** @typedef {import("../DependencyTemplates")} DependencyTemplates */ -/** @typedef {import("../Generator").GenerateContext} GenerateContext */ -/** @typedef {import("../NormalModule")} NormalModule */ -/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +function iterateNormalLoaders(options, loaderContext, args, callback) { + if(loaderContext.loaderIndex < 0) + return callback(null, args); -const TYPES = new Set(["webassembly"]); + var currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex]; -class WebAssemblyJavascriptGenerator extends Generator { - /** - * @param {NormalModule} module fresh module - * @returns {Set} available types (do not mutate) - */ - getTypes(module) { - return TYPES; + // iterate + if(currentLoaderObject.normalExecuted) { + loaderContext.loaderIndex--; + return iterateNormalLoaders(options, loaderContext, args, callback); } - /** - * @param {NormalModule} module the module - * @param {string=} type source type - * @returns {number} estimate size of the module - */ - getSize(module, type) { - return 95 + module.dependencies.length * 5; + var fn = currentLoaderObject.normal; + currentLoaderObject.normalExecuted = true; + if(!fn) { + return iterateNormalLoaders(options, loaderContext, args, callback); } - /** - * @param {NormalModule} module module for which the code should be generated - * @param {GenerateContext} generateContext context for generate - * @returns {Source} generated code - */ - generate(module, generateContext) { - const { - runtimeTemplate, - moduleGraph, - chunkGraph, - runtimeRequirements, - runtime - } = generateContext; - /** @type {InitFragment[]} */ - const initFragments = []; + convertArgs(args, currentLoaderObject.raw); - const exportsInfo = moduleGraph.getExportsInfo(module); + runSyncOrAsync(fn, loaderContext, args, function(err) { + if(err) return callback(err); - let needExportsCopy = false; - const importedModules = new Map(); - const initParams = []; - let index = 0; - for (const dep of module.dependencies) { - const moduleDep = - dep && dep instanceof ModuleDependency ? dep : undefined; - if (moduleGraph.getModule(dep)) { - let importData = importedModules.get(moduleGraph.getModule(dep)); - if (importData === undefined) { - importedModules.set( - moduleGraph.getModule(dep), - (importData = { - importVar: `m${index}`, - index, - request: (moduleDep && moduleDep.userRequest) || undefined, - names: new Set(), - reexports: [] - }) - ); - index++; - } - if (dep instanceof WebAssemblyImportDependency) { - importData.names.add(dep.name); - if (dep.description.type === "GlobalType") { - const exportName = dep.name; - const importedModule = moduleGraph.getModule(dep); + var args = Array.prototype.slice.call(arguments, 1); + iterateNormalLoaders(options, loaderContext, args, callback); + }); +} - if (importedModule) { - const usedName = moduleGraph - .getExportsInfo(importedModule) - .getUsedName(exportName, runtime); - if (usedName) { - initParams.push( - runtimeTemplate.exportFromImport({ - moduleGraph, - module: importedModule, - request: dep.request, - importVar: importData.importVar, - originModule: module, - exportName: dep.name, - asiSafe: true, - isCall: false, - callContext: null, - defaultInterop: true, - initFragments, - runtime, - runtimeRequirements - }) - ); - } - } - } - } - if (dep instanceof WebAssemblyExportImportedDependency) { - importData.names.add(dep.name); - const usedName = moduleGraph - .getExportsInfo(module) - .getUsedName(dep.exportName, runtime); - if (usedName) { - runtimeRequirements.add(RuntimeGlobals.exports); - const exportProp = `${module.exportsArgument}[${JSON.stringify( - usedName - )}]`; - const defineStatement = Template.asString([ - `${exportProp} = ${runtimeTemplate.exportFromImport({ - moduleGraph, - module: moduleGraph.getModule(dep), - request: dep.request, - importVar: importData.importVar, - originModule: module, - exportName: dep.name, - asiSafe: true, - isCall: false, - callContext: null, - defaultInterop: true, - initFragments, - runtime, - runtimeRequirements - })};`, - `if(WebAssembly.Global) ${exportProp} = ` + - `new WebAssembly.Global({ value: ${JSON.stringify( - dep.valueType - )} }, ${exportProp});` - ]); - importData.reexports.push(defineStatement); - needExportsCopy = true; - } - } - } - } - const importsCode = Template.asString( - Array.from( - importedModules, - ([module, { importVar, request, reexports }]) => { - const importStatement = runtimeTemplate.importStatement({ - module, - chunkGraph, - request, - importVar, - originModule: module, - runtimeRequirements - }); - return importStatement[0] + importStatement[1] + reexports.join("\n"); - } - ) - ); +exports.getContext = function getContext(resource) { + var path = parsePathQueryFragment(resource).path; + return dirname(path); +}; - const copyAllExports = - exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused && - !needExportsCopy; +exports.runLoaders = function runLoaders(options, callback) { + // read options + var resource = options.resource || ""; + var loaders = options.loaders || []; + var loaderContext = options.context || {}; + var processResource = options.processResource || ((readResource, context, resource, callback) => { + context.addDependency(resource); + readResource(resource, callback); + }).bind(null, options.readResource || readFile); - // need these globals - runtimeRequirements.add(RuntimeGlobals.module); - runtimeRequirements.add(RuntimeGlobals.moduleId); - runtimeRequirements.add(RuntimeGlobals.wasmInstances); - if (exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused) { - runtimeRequirements.add(RuntimeGlobals.makeNamespaceObject); - runtimeRequirements.add(RuntimeGlobals.exports); - } - if (!copyAllExports) { - runtimeRequirements.add(RuntimeGlobals.exports); - } + // + var splittedResource = resource && parsePathQueryFragment(resource); + var resourcePath = splittedResource ? splittedResource.path : undefined; + var resourceQuery = splittedResource ? splittedResource.query : undefined; + var resourceFragment = splittedResource ? splittedResource.fragment : undefined; + var contextDirectory = resourcePath ? dirname(resourcePath) : null; - // create source - const source = new RawSource( - [ - '"use strict";', - "// Instantiate WebAssembly module", - `var wasmExports = ${RuntimeGlobals.wasmInstances}[${module.moduleArgument}.id];`, + // execution state + var requestCacheable = true; + var fileDependencies = []; + var contextDependencies = []; + var missingDependencies = []; - exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused - ? `${RuntimeGlobals.makeNamespaceObject}(${module.exportsArgument});` - : "", + // prepare loader objects + loaders = loaders.map(createLoaderObject); - // this must be before import for circular dependencies - "// export exports from WebAssembly module", - copyAllExports - ? `${module.moduleArgument}.exports = wasmExports;` - : "for(var name in wasmExports) " + - `if(name) ` + - `${module.exportsArgument}[name] = wasmExports[name];`, - "// exec imports from WebAssembly module (for esm order)", - importsCode, - "", - "// exec wasm module", - `wasmExports[""](${initParams.join(", ")})` - ].join("\n") - ); - return InitFragment.addToSource(source, initFragments, generateContext); + loaderContext.context = contextDirectory; + loaderContext.loaderIndex = 0; + loaderContext.loaders = loaders; + loaderContext.resourcePath = resourcePath; + loaderContext.resourceQuery = resourceQuery; + loaderContext.resourceFragment = resourceFragment; + loaderContext.async = null; + loaderContext.callback = null; + loaderContext.cacheable = function cacheable(flag) { + if(flag === false) { + requestCacheable = false; + } + }; + loaderContext.dependency = loaderContext.addDependency = function addDependency(file) { + fileDependencies.push(file); + }; + loaderContext.addContextDependency = function addContextDependency(context) { + contextDependencies.push(context); + }; + loaderContext.addMissingDependency = function addMissingDependency(context) { + missingDependencies.push(context); + }; + loaderContext.getDependencies = function getDependencies() { + return fileDependencies.slice(); + }; + loaderContext.getContextDependencies = function getContextDependencies() { + return contextDependencies.slice(); + }; + loaderContext.getMissingDependencies = function getMissingDependencies() { + return missingDependencies.slice(); + }; + loaderContext.clearDependencies = function clearDependencies() { + fileDependencies.length = 0; + contextDependencies.length = 0; + missingDependencies.length = 0; + requestCacheable = true; + }; + Object.defineProperty(loaderContext, "resource", { + enumerable: true, + get: function() { + if(loaderContext.resourcePath === undefined) + return undefined; + return loaderContext.resourcePath.replace(/#/g, "\0#") + loaderContext.resourceQuery.replace(/#/g, "\0#") + loaderContext.resourceFragment; + }, + set: function(value) { + var splittedResource = value && parsePathQueryFragment(value); + loaderContext.resourcePath = splittedResource ? splittedResource.path : undefined; + loaderContext.resourceQuery = splittedResource ? splittedResource.query : undefined; + loaderContext.resourceFragment = splittedResource ? splittedResource.fragment : undefined; + } + }); + Object.defineProperty(loaderContext, "request", { + enumerable: true, + get: function() { + return loaderContext.loaders.map(function(o) { + return o.request; + }).concat(loaderContext.resource || "").join("!"); + } + }); + Object.defineProperty(loaderContext, "remainingRequest", { + enumerable: true, + get: function() { + if(loaderContext.loaderIndex >= loaderContext.loaders.length - 1 && !loaderContext.resource) + return ""; + return loaderContext.loaders.slice(loaderContext.loaderIndex + 1).map(function(o) { + return o.request; + }).concat(loaderContext.resource || "").join("!"); + } + }); + Object.defineProperty(loaderContext, "currentRequest", { + enumerable: true, + get: function() { + return loaderContext.loaders.slice(loaderContext.loaderIndex).map(function(o) { + return o.request; + }).concat(loaderContext.resource || "").join("!"); + } + }); + Object.defineProperty(loaderContext, "previousRequest", { + enumerable: true, + get: function() { + return loaderContext.loaders.slice(0, loaderContext.loaderIndex).map(function(o) { + return o.request; + }).join("!"); + } + }); + Object.defineProperty(loaderContext, "query", { + enumerable: true, + get: function() { + var entry = loaderContext.loaders[loaderContext.loaderIndex]; + return entry.options && typeof entry.options === "object" ? entry.options : entry.query; + } + }); + Object.defineProperty(loaderContext, "data", { + enumerable: true, + get: function() { + return loaderContext.loaders[loaderContext.loaderIndex].data; + } + }); + + // finish loader context + if(Object.preventExtensions) { + Object.preventExtensions(loaderContext); } -} -module.exports = WebAssemblyJavascriptGenerator; + var processOptions = { + resourceBuffer: null, + processResource: processResource + }; + iteratePitchingLoaders(processOptions, loaderContext, function(err, result) { + if(err) { + return callback(err, { + cacheable: requestCacheable, + fileDependencies: fileDependencies, + contextDependencies: contextDependencies, + missingDependencies: missingDependencies + }); + } + callback(null, { + result: result, + resourceBuffer: processOptions.resourceBuffer, + cacheable: requestCacheable, + fileDependencies: fileDependencies, + contextDependencies: contextDependencies, + missingDependencies: missingDependencies + }); + }); +}; /***/ }), -/***/ 53639: +/***/ 44690: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - - -const Generator = __webpack_require__(93401); -const WebAssemblyExportImportedDependency = __webpack_require__(52204); -const WebAssemblyImportDependency = __webpack_require__(5239); -const { compareModulesByIdentifier } = __webpack_require__(29579); -const memoize = __webpack_require__(78676); -const WebAssemblyInInitialChunkError = __webpack_require__(47342); - -/** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleTemplate")} ModuleTemplate */ -/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ - -const getWebAssemblyGenerator = memoize(() => - __webpack_require__(47012) -); -const getWebAssemblyJavascriptGenerator = memoize(() => - __webpack_require__(46545) -); -const getWebAssemblyParser = memoize(() => __webpack_require__(57059)); +var LoaderLoadingError = __webpack_require__(39102); +var url; -class WebAssemblyModulesPlugin { - constructor(options) { - this.options = options; +module.exports = function loadLoader(loader, callback) { + if(loader.type === "module") { + try { + if(url === undefined) url = __webpack_require__(57310); + var loaderUrl = url.pathToFileURL(loader.path); + var modulePromise = eval("import(" + JSON.stringify(loaderUrl.toString()) + ")"); + modulePromise.then(function(module) { + handleResult(loader, module, callback); + }, callback); + return; + } catch(e) { + callback(e); + } + } else { + try { + var module = require(loader.path); + } catch(e) { + // it is possible for node to choke on a require if the FD descriptor + // limit has been reached. give it a chance to recover. + if(e instanceof Error && e.code === "EMFILE") { + var retry = loadLoader.bind(null, loader, callback); + if(typeof setImmediate === "function") { + // node >= 0.9.0 + return setImmediate(retry); + } else { + // node < 0.9.0 + return process.nextTick(retry); + } + } + return callback(e); + } + return handleResult(loader, module, callback); } +}; - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.compilation.tap( - "WebAssemblyModulesPlugin", - (compilation, { normalModuleFactory }) => { - compilation.dependencyFactories.set( - WebAssemblyImportDependency, - normalModuleFactory - ); - - compilation.dependencyFactories.set( - WebAssemblyExportImportedDependency, - normalModuleFactory - ); - - normalModuleFactory.hooks.createParser - .for("webassembly/sync") - .tap("WebAssemblyModulesPlugin", () => { - const WebAssemblyParser = getWebAssemblyParser(); - - return new WebAssemblyParser(); - }); - - normalModuleFactory.hooks.createGenerator - .for("webassembly/sync") - .tap("WebAssemblyModulesPlugin", () => { - const WebAssemblyJavascriptGenerator = - getWebAssemblyJavascriptGenerator(); - const WebAssemblyGenerator = getWebAssemblyGenerator(); - - return Generator.byType({ - javascript: new WebAssemblyJavascriptGenerator(), - webassembly: new WebAssemblyGenerator(this.options) - }); - }); - - compilation.hooks.renderManifest.tap( - "WebAssemblyModulesPlugin", - (result, options) => { - const { chunkGraph } = compilation; - const { chunk, outputOptions, codeGenerationResults } = options; - - for (const module of chunkGraph.getOrderedChunkModulesIterable( - chunk, - compareModulesByIdentifier - )) { - if (module.type === "webassembly/sync") { - const filenameTemplate = - outputOptions.webassemblyModuleFilename; - - result.push({ - render: () => - codeGenerationResults.getSource( - module, - chunk.runtime, - "webassembly" - ), - filenameTemplate, - pathOptions: { - module, - runtime: chunk.runtime, - chunkGraph - }, - auxiliary: true, - identifier: `webassemblyModule${chunkGraph.getModuleId( - module - )}`, - hash: chunkGraph.getModuleHash(module, chunk.runtime) - }); - } - } - - return result; - } - ); - - compilation.hooks.afterChunks.tap("WebAssemblyModulesPlugin", () => { - const chunkGraph = compilation.chunkGraph; - const initialWasmModules = new Set(); - for (const chunk of compilation.chunks) { - if (chunk.canBeInitial()) { - for (const module of chunkGraph.getChunkModulesIterable(chunk)) { - if (module.type === "webassembly/sync") { - initialWasmModules.add(module); - } - } - } - } - for (const module of initialWasmModules) { - compilation.errors.push( - new WebAssemblyInInitialChunkError( - module, - compilation.moduleGraph, - compilation.chunkGraph, - compilation.requestShortener - ) - ); - } - }); - } - ); +function handleResult(loader, module, callback) { + if(typeof module !== "function" && typeof module !== "object") { + return callback(new LoaderLoadingError( + "Module '" + loader.path + "' is not a loader (export function or es6 module)" + )); + } + loader.normal = typeof module === "function" ? module : module.default; + loader.pitch = module.pitch; + loader.raw = module.raw; + if(typeof loader.normal !== "function" && typeof loader.pitch !== "function") { + return callback(new LoaderLoadingError( + "Module '" + loader.path + "' is not a loader (must have normal or pitch function)" + )); } + callback(); } -module.exports = WebAssemblyModulesPlugin; - /***/ }), -/***/ 57059: +/***/ 50569: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - +/*! + * mime-db + * Copyright(c) 2014 Jonathan Ong + * MIT Licensed + */ +/** + * Module exports. + */ -const t = __webpack_require__(51826); -const { moduleContextFromModuleAST } = __webpack_require__(51826); -const { decode } = __webpack_require__(73726); -const Parser = __webpack_require__(11715); -const StaticExportsDependency = __webpack_require__(91418); -const WebAssemblyExportImportedDependency = __webpack_require__(52204); -const WebAssemblyImportDependency = __webpack_require__(5239); +module.exports = __webpack_require__(58750) -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../Parser").ParserState} ParserState */ -/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ -const JS_COMPAT_TYPES = new Set(["i32", "f32", "f64"]); +/***/ }), -/** - * @param {t.Signature} signature the func signature - * @returns {null | string} the type incompatible with js types - */ -const getJsIncompatibleType = signature => { - for (const param of signature.params) { - if (!JS_COMPAT_TYPES.has(param.valtype)) { - return `${param.valtype} as parameter`; - } - } - for (const type of signature.results) { - if (!JS_COMPAT_TYPES.has(type)) return `${type} as result`; - } - return null; -}; +/***/ 78585: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -/** - * TODO why are there two different Signature types? - * @param {t.FuncSignature} signature the func signature - * @returns {null | string} the type incompatible with js types +"use strict"; +/*! + * mime-types + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed */ -const getJsIncompatibleTypeOfFuncSignature = signature => { - for (const param of signature.args) { - if (!JS_COMPAT_TYPES.has(param)) { - return `${param} as parameter`; - } - } - for (const type of signature.result) { - if (!JS_COMPAT_TYPES.has(type)) return `${type} as result`; - } - return null; -}; -const decoderOpts = { - ignoreCodeSection: true, - ignoreDataSection: true, - - // this will avoid having to lookup with identifiers in the ModuleContext - ignoreCustomNameSection: true -}; -class WebAssemblyParser extends Parser { - constructor(options) { - super(); - this.hooks = Object.freeze({}); - this.options = options; - } - /** - * @param {string | Buffer | PreparsedAst} source the source to parse - * @param {ParserState} state the parser state - * @returns {ParserState} the parser state - */ - parse(source, state) { - if (!Buffer.isBuffer(source)) { - throw new Error("WebAssemblyParser input must be a Buffer"); - } +/** + * Module dependencies. + * @private + */ - // flag it as ESM - state.module.buildInfo.strict = true; - state.module.buildMeta.exportsType = "namespace"; +var db = __webpack_require__(50569) +var extname = (__webpack_require__(71017).extname) - // parse it - const program = decode(source, decoderOpts); - const module = program.body[0]; +/** + * Module variables. + * @private + */ - const moduleContext = moduleContextFromModuleAST(module); +var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/ +var TEXT_TYPE_REGEXP = /^text\//i - // extract imports and exports - const exports = []; - let jsIncompatibleExports = (state.module.buildMeta.jsIncompatibleExports = - undefined); +/** + * Module exports. + * @public + */ - const importedGlobals = []; - t.traverse(module, { - ModuleExport({ node }) { - const descriptor = node.descr; +exports.charset = charset +exports.charsets = { lookup: charset } +exports.contentType = contentType +exports.extension = extension +exports.extensions = Object.create(null) +exports.lookup = lookup +exports.types = Object.create(null) - if (descriptor.exportType === "Func") { - const funcIdx = descriptor.id.value; +// Populate the extensions/types maps +populateMaps(exports.extensions, exports.types) - /** @type {t.FuncSignature} */ - const funcSignature = moduleContext.getFunction(funcIdx); +/** + * Get the default charset for a MIME type. + * + * @param {string} type + * @return {boolean|string} + */ - const incompatibleType = - getJsIncompatibleTypeOfFuncSignature(funcSignature); +function charset (type) { + if (!type || typeof type !== 'string') { + return false + } - if (incompatibleType) { - if (jsIncompatibleExports === undefined) { - jsIncompatibleExports = - state.module.buildMeta.jsIncompatibleExports = {}; - } - jsIncompatibleExports[node.name] = incompatibleType; - } - } + // TODO: use media-typer + var match = EXTRACT_TYPE_REGEXP.exec(type) + var mime = match && db[match[1].toLowerCase()] - exports.push(node.name); + if (mime && mime.charset) { + return mime.charset + } - if (node.descr && node.descr.exportType === "Global") { - const refNode = importedGlobals[node.descr.id.value]; - if (refNode) { - const dep = new WebAssemblyExportImportedDependency( - node.name, - refNode.module, - refNode.name, - refNode.descr.valtype - ); + // default text/* to utf-8 + if (match && TEXT_TYPE_REGEXP.test(match[1])) { + return 'UTF-8' + } - state.module.addDependency(dep); - } - } - }, + return false +} - Global({ node }) { - const init = node.init[0]; +/** + * Create a full Content-Type header given a MIME type or extension. + * + * @param {string} str + * @return {boolean|string} + */ - let importNode = null; +function contentType (str) { + // TODO: should this even be in this module? + if (!str || typeof str !== 'string') { + return false + } - if (init.id === "get_global") { - const globalIdx = init.args[0].value; + var mime = str.indexOf('/') === -1 + ? exports.lookup(str) + : str - if (globalIdx < importedGlobals.length) { - importNode = importedGlobals[globalIdx]; - } - } + if (!mime) { + return false + } - importedGlobals.push(importNode); - }, + // TODO: use content-type or other module + if (mime.indexOf('charset') === -1) { + var charset = exports.charset(mime) + if (charset) mime += '; charset=' + charset.toLowerCase() + } - ModuleImport({ node }) { - /** @type {false | string} */ - let onlyDirectImport = false; + return mime +} - if (t.isMemory(node.descr) === true) { - onlyDirectImport = "Memory"; - } else if (t.isTable(node.descr) === true) { - onlyDirectImport = "Table"; - } else if (t.isFuncImportDescr(node.descr) === true) { - const incompatibleType = getJsIncompatibleType(node.descr.signature); - if (incompatibleType) { - onlyDirectImport = `Non-JS-compatible Func Signature (${incompatibleType})`; - } - } else if (t.isGlobalType(node.descr) === true) { - const type = node.descr.valtype; - if (!JS_COMPAT_TYPES.has(type)) { - onlyDirectImport = `Non-JS-compatible Global Type (${type})`; - } - } +/** + * Get the default extension for a MIME type. + * + * @param {string} type + * @return {boolean|string} + */ - const dep = new WebAssemblyImportDependency( - node.module, - node.name, - node.descr, - onlyDirectImport - ); +function extension (type) { + if (!type || typeof type !== 'string') { + return false + } - state.module.addDependency(dep); + // TODO: use media-typer + var match = EXTRACT_TYPE_REGEXP.exec(type) - if (t.isGlobalType(node.descr)) { - importedGlobals.push(node); - } - } - }); + // get extensions + var exts = match && exports.extensions[match[1].toLowerCase()] - state.module.addDependency(new StaticExportsDependency(exports, false)); + if (!exts || !exts.length) { + return false + } - return state; - } + return exts[0] } -module.exports = WebAssemblyParser; +/** + * Lookup the MIME type for a file path/extension. + * + * @param {string} path + * @return {boolean|string} + */ +function lookup (path) { + if (!path || typeof path !== 'string') { + return false + } -/***/ }), + // get the extension ("ext" or ".ext" or full path) + var extension = extname('x.' + path) + .toLowerCase() + .substr(1) -/***/ 18650: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + if (!extension) { + return false + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + return exports.types[extension] || false +} +/** + * Populate the extensions and types maps. + * @private + */ +function populateMaps (extensions, types) { + // source preference (least -> most) + var preference = ['nginx', 'apache', undefined, 'iana'] -const Template = __webpack_require__(39722); -const WebAssemblyImportDependency = __webpack_require__(5239); + Object.keys(db).forEach(function forEachMimeType (type) { + var mime = db[type] + var exts = mime.extensions -/** @typedef {import("../Module")} Module */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ + if (!exts || !exts.length) { + return + } -/** @typedef {Object} UsedWasmDependency - * @property {WebAssemblyImportDependency} dependency the dependency - * @property {string} name the export name - * @property {string} module the module name - */ + // mime -> extensions + extensions[type] = exts -const MANGLED_MODULE = "a"; + // extension -> mime + for (var i = 0; i < exts.length; i++) { + var extension = exts[i] -/** - * @param {ModuleGraph} moduleGraph the module graph - * @param {Module} module the module - * @param {boolean} mangle mangle module and export names - * @returns {UsedWasmDependency[]} used dependencies and (mangled) name - */ -const getUsedDependencies = (moduleGraph, module, mangle) => { - /** @type {UsedWasmDependency[]} */ - const array = []; - let importIndex = 0; - for (const dep of module.dependencies) { - if (dep instanceof WebAssemblyImportDependency) { - if ( - dep.description.type === "GlobalType" || - moduleGraph.getModule(dep) === null - ) { - continue; - } + if (types[extension]) { + var from = preference.indexOf(db[types[extension]].source) + var to = preference.indexOf(mime.source) - const exportName = dep.name; - // TODO add the following 3 lines when removing of ModuleExport is possible - // const importedModule = moduleGraph.getModule(dep); - // const usedName = importedModule && moduleGraph.getExportsInfo(importedModule).getUsedName(exportName, runtime); - // if (usedName !== false) { - if (mangle) { - array.push({ - dependency: dep, - name: Template.numberToIdentifier(importIndex++), - module: MANGLED_MODULE - }); - } else { - array.push({ - dependency: dep, - name: exportName, - module: dep.request - }); - } - } - } - return array; -}; + if (types[extension] !== 'application/octet-stream' && + (from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) { + // skip the remapping + continue + } + } -exports.getUsedDependencies = getUsedDependencies; -exports.MANGLED_MODULE = MANGLED_MODULE; + // set the extension -> mime + types[extension] = type + } + }) +} /***/ }), -/***/ 78613: +/***/ 76297: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -139551,123 +139801,90 @@ exports.MANGLED_MODULE = MANGLED_MODULE; */ +const Hook = __webpack_require__(72258); +const HookCodeFactory = __webpack_require__(177); -/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */ -/** @typedef {import("../../declarations/WebpackOptions").WasmLoadingType} WasmLoadingType */ -/** @typedef {import("../Compiler")} Compiler */ - -/** @type {WeakMap>} */ -const enabledTypes = new WeakMap(); - -const getEnabledTypes = compiler => { - let set = enabledTypes.get(compiler); - if (set === undefined) { - set = new Set(); - enabledTypes.set(compiler, set); - } - return set; -}; - -class EnableWasmLoadingPlugin { - /** - * @param {WasmLoadingType} type library type that should be available - */ - constructor(type) { - this.type = type; - } - - /** - * @param {Compiler} compiler the compiler instance - * @param {WasmLoadingType} type type of library - * @returns {void} - */ - static setEnabled(compiler, type) { - getEnabledTypes(compiler).add(type); - } - - /** - * @param {Compiler} compiler the compiler instance - * @param {WasmLoadingType} type type of library - * @returns {void} - */ - static checkEnabled(compiler, type) { - if (!getEnabledTypes(compiler).has(type)) { - throw new Error( - `Library type "${type}" is not enabled. ` + - "EnableWasmLoadingPlugin need to be used to enable this type of wasm loading. " + - 'This usually happens through the "output.enabledWasmLoadingTypes" option. ' + - 'If you are using a function as entry which sets "wasmLoading", you need to add all potential library types to "output.enabledWasmLoadingTypes". ' + - "These types are enabled: " + - Array.from(getEnabledTypes(compiler)).join(", ") - ); - } +class AsyncParallelBailHookCodeFactory extends HookCodeFactory { + content({ onError, onResult, onDone }) { + let code = ""; + code += `var _results = new Array(${this.options.taps.length});\n`; + code += "var _checkDone = function() {\n"; + code += "for(var i = 0; i < _results.length; i++) {\n"; + code += "var item = _results[i];\n"; + code += "if(item === undefined) return false;\n"; + code += "if(item.result !== undefined) {\n"; + code += onResult("item.result"); + code += "return true;\n"; + code += "}\n"; + code += "if(item.error) {\n"; + code += onError("item.error"); + code += "return true;\n"; + code += "}\n"; + code += "}\n"; + code += "return false;\n"; + code += "}\n"; + code += this.callTapsParallel({ + onError: (i, err, done, doneBreak) => { + let code = ""; + code += `if(${i} < _results.length && ((_results.length = ${i + + 1}), (_results[${i}] = { error: ${err} }), _checkDone())) {\n`; + code += doneBreak(true); + code += "} else {\n"; + code += done(); + code += "}\n"; + return code; + }, + onResult: (i, result, done, doneBreak) => { + let code = ""; + code += `if(${i} < _results.length && (${result} !== undefined && (_results.length = ${i + + 1}), (_results[${i}] = { result: ${result} }), _checkDone())) {\n`; + code += doneBreak(true); + code += "} else {\n"; + code += done(); + code += "}\n"; + return code; + }, + onTap: (i, run, done, doneBreak) => { + let code = ""; + if (i > 0) { + code += `if(${i} >= _results.length) {\n`; + code += done(); + code += "} else {\n"; + } + code += run(); + if (i > 0) code += "}\n"; + return code; + }, + onDone + }); + return code; } +} - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - const { type } = this; +const factory = new AsyncParallelBailHookCodeFactory(); - // Only enable once - const enabled = getEnabledTypes(compiler); - if (enabled.has(type)) return; - enabled.add(type); +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; - if (typeof type === "string") { - switch (type) { - case "fetch": { - // TODO webpack 6 remove FetchCompileWasmPlugin - const FetchCompileWasmPlugin = __webpack_require__(35537); - const FetchCompileAsyncWasmPlugin = __webpack_require__(8437); - new FetchCompileWasmPlugin({ - mangleImports: compiler.options.optimization.mangleWasmImports - }).apply(compiler); - new FetchCompileAsyncWasmPlugin().apply(compiler); - break; - } - case "async-node": { - // TODO webpack 6 remove ReadFileCompileWasmPlugin - const ReadFileCompileWasmPlugin = __webpack_require__(98939); - // @ts-expect-error typescript bug for duplicate require - const ReadFileCompileAsyncWasmPlugin = __webpack_require__(73163); - new ReadFileCompileWasmPlugin({ - mangleImports: compiler.options.optimization.mangleWasmImports - }).apply(compiler); - new ReadFileCompileAsyncWasmPlugin({ type }).apply(compiler); - break; - } - case "async-node-module": { - // @ts-expect-error typescript bug for duplicate require - const ReadFileCompileAsyncWasmPlugin = __webpack_require__(73163); - new ReadFileCompileAsyncWasmPlugin({ type, import: true }).apply( - compiler - ); - break; - } - case "universal": - throw new Error( - "Universal WebAssembly Loading is not implemented yet" - ); - default: - throw new Error(`Unsupported wasm loading type ${type}. -Plugins which provide custom wasm loading types must call EnableWasmLoadingPlugin.setEnabled(compiler, type) to disable this error.`); - } - } else { - // TODO support plugin instances here - // apply them to the compiler - } - } +function AsyncParallelBailHook(args = [], name = undefined) { + const hook = new Hook(args, name); + hook.constructor = AsyncParallelBailHook; + hook.compile = COMPILE; + hook._call = undefined; + hook.call = undefined; + return hook; } -module.exports = EnableWasmLoadingPlugin; +AsyncParallelBailHook.prototype = null; + +module.exports = AsyncParallelBailHook; /***/ }), -/***/ 8437: +/***/ 45874: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -139677,67 +139894,42 @@ module.exports = EnableWasmLoadingPlugin; */ +const Hook = __webpack_require__(72258); +const HookCodeFactory = __webpack_require__(177); -const RuntimeGlobals = __webpack_require__(16475); -const AsyncWasmLoadingRuntimeModule = __webpack_require__(5434); +class AsyncParallelHookCodeFactory extends HookCodeFactory { + content({ onError, onDone }) { + return this.callTapsParallel({ + onError: (i, err, done, doneBreak) => onError(err) + doneBreak(true), + onDone + }); + } +} -/** @typedef {import("../Compiler")} Compiler */ +const factory = new AsyncParallelHookCodeFactory(); -class FetchCompileAsyncWasmPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - "FetchCompileAsyncWasmPlugin", - compilation => { - const globalWasmLoading = compilation.outputOptions.wasmLoading; - const isEnabledForChunk = chunk => { - const options = chunk.getEntryOptions(); - const wasmLoading = - options && options.wasmLoading !== undefined - ? options.wasmLoading - : globalWasmLoading; - return wasmLoading === "fetch"; - }; - const generateLoadBinaryCode = path => - `fetch(${RuntimeGlobals.publicPath} + ${path})`; +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.instantiateWasm) - .tap("FetchCompileAsyncWasmPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - const chunkGraph = compilation.chunkGraph; - if ( - !chunkGraph.hasModuleInGraph( - chunk, - m => m.type === "webassembly/async" - ) - ) { - return; - } - set.add(RuntimeGlobals.publicPath); - compilation.addRuntimeModule( - chunk, - new AsyncWasmLoadingRuntimeModule({ - generateLoadBinaryCode, - supportsStreaming: true - }) - ); - }); - } - ); - } +function AsyncParallelHook(args = [], name = undefined) { + const hook = new Hook(args, name); + hook.constructor = AsyncParallelHook; + hook.compile = COMPILE; + hook._call = undefined; + hook.call = undefined; + return hook; } -module.exports = FetchCompileAsyncWasmPlugin; +AsyncParallelHook.prototype = null; + +module.exports = AsyncParallelHook; /***/ }), -/***/ 35537: +/***/ 13633: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -139747,76 +139939,47 @@ module.exports = FetchCompileAsyncWasmPlugin; */ +const Hook = __webpack_require__(72258); +const HookCodeFactory = __webpack_require__(177); -const RuntimeGlobals = __webpack_require__(16475); -const WasmChunkLoadingRuntimeModule = __webpack_require__(87394); - -/** @typedef {import("../Compiler")} Compiler */ - -// TODO webpack 6 remove - -class FetchCompileWasmPlugin { - constructor(options) { - this.options = options || {}; +class AsyncSeriesBailHookCodeFactory extends HookCodeFactory { + content({ onError, onResult, resultReturns, onDone }) { + return this.callTapsSeries({ + onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), + onResult: (i, result, next) => + `if(${result} !== undefined) {\n${onResult( + result + )}\n} else {\n${next()}}\n`, + resultReturns, + onDone + }); } +} - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - "FetchCompileWasmPlugin", - compilation => { - const globalWasmLoading = compilation.outputOptions.wasmLoading; - const isEnabledForChunk = chunk => { - const options = chunk.getEntryOptions(); - const wasmLoading = - options && options.wasmLoading !== undefined - ? options.wasmLoading - : globalWasmLoading; - return wasmLoading === "fetch"; - }; - const generateLoadBinaryCode = path => - `fetch(${RuntimeGlobals.publicPath} + ${path})`; +const factory = new AsyncSeriesBailHookCodeFactory(); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("FetchCompileWasmPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - const chunkGraph = compilation.chunkGraph; - if ( - !chunkGraph.hasModuleInGraph( - chunk, - m => m.type === "webassembly/sync" - ) - ) { - return; - } - set.add(RuntimeGlobals.moduleCache); - set.add(RuntimeGlobals.publicPath); - compilation.addRuntimeModule( - chunk, - new WasmChunkLoadingRuntimeModule({ - generateLoadBinaryCode, - supportsStreaming: true, - mangleImports: this.options.mangleImports, - runtimeRequirements: set - }) - ); - }); - } - ); - } +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; + +function AsyncSeriesBailHook(args = [], name = undefined) { + const hook = new Hook(args, name); + hook.constructor = AsyncSeriesBailHook; + hook.compile = COMPILE; + hook._call = undefined; + hook.call = undefined; + return hook; } -module.exports = FetchCompileWasmPlugin; +AsyncSeriesBailHook.prototype = null; + +module.exports = AsyncSeriesBailHook; /***/ }), -/***/ 83121: +/***/ 40436: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -139826,544 +139989,142 @@ module.exports = FetchCompileWasmPlugin; */ +const Hook = __webpack_require__(72258); +const HookCodeFactory = __webpack_require__(177); -const RuntimeGlobals = __webpack_require__(16475); -const JsonpChunkLoadingRuntimeModule = __webpack_require__(84154); - -/** @typedef {import("../Compiler")} Compiler */ - -class JsonpChunkLoadingPlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.hooks.thisCompilation.tap( - "JsonpChunkLoadingPlugin", - compilation => { - const globalChunkLoading = compilation.outputOptions.chunkLoading; - const isEnabledForChunk = chunk => { - const options = chunk.getEntryOptions(); - const chunkLoading = - options && options.chunkLoading !== undefined - ? options.chunkLoading - : globalChunkLoading; - return chunkLoading === "jsonp"; - }; - const onceForChunkSet = new WeakSet(); - const handler = (chunk, set) => { - if (onceForChunkSet.has(chunk)) return; - onceForChunkSet.add(chunk); - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - set.add(RuntimeGlobals.hasOwnProperty); - compilation.addRuntimeModule( - chunk, - new JsonpChunkLoadingRuntimeModule(set) - ); - }; - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("JsonpChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadUpdateHandlers) - .tap("JsonpChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadManifest) - .tap("JsonpChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.baseURI) - .tap("JsonpChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.onChunksLoaded) - .tap("JsonpChunkLoadingPlugin", handler); - - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("JsonpChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.publicPath); - set.add(RuntimeGlobals.loadScript); - set.add(RuntimeGlobals.getChunkScriptFilename); - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadUpdateHandlers) - .tap("JsonpChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.publicPath); - set.add(RuntimeGlobals.loadScript); - set.add(RuntimeGlobals.getChunkUpdateScriptFilename); - set.add(RuntimeGlobals.moduleCache); - set.add(RuntimeGlobals.hmrModuleData); - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadManifest) - .tap("JsonpChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.publicPath); - set.add(RuntimeGlobals.getUpdateManifestFilename); - }); - } - ); +class AsyncSeriesHookCodeFactory extends HookCodeFactory { + content({ onError, onDone }) { + return this.callTapsSeries({ + onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), + onDone + }); } } -module.exports = JsonpChunkLoadingPlugin; +const factory = new AsyncSeriesHookCodeFactory(); + +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; + +function AsyncSeriesHook(args = [], name = undefined) { + const hook = new Hook(args, name); + hook.constructor = AsyncSeriesHook; + hook.compile = COMPILE; + hook._call = undefined; + hook.call = undefined; + return hook; +} + +AsyncSeriesHook.prototype = null; + +module.exports = AsyncSeriesHook; /***/ }), -/***/ 84154: +/***/ 34656: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra */ +const Hook = __webpack_require__(72258); +const HookCodeFactory = __webpack_require__(177); -const { SyncWaterfallHook } = __webpack_require__(41242); -const Compilation = __webpack_require__(85720); -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); -const chunkHasJs = (__webpack_require__(89464).chunkHasJs); -const { getInitialChunkIds } = __webpack_require__(98124); -const compileBooleanMatcher = __webpack_require__(29404); +class AsyncSeriesLoopHookCodeFactory extends HookCodeFactory { + content({ onError, onDone }) { + return this.callTapsLooping({ + onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), + onDone + }); + } +} -/** @typedef {import("../Chunk")} Chunk */ +const factory = new AsyncSeriesLoopHookCodeFactory(); -/** - * @typedef {Object} JsonpCompilationPluginHooks - * @property {SyncWaterfallHook<[string, Chunk]>} linkPreload - * @property {SyncWaterfallHook<[string, Chunk]>} linkPrefetch - */ +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; -/** @type {WeakMap} */ -const compilationHooksMap = new WeakMap(); +function AsyncSeriesLoopHook(args = [], name = undefined) { + const hook = new Hook(args, name); + hook.constructor = AsyncSeriesLoopHook; + hook.compile = COMPILE; + hook._call = undefined; + hook.call = undefined; + return hook; +} -class JsonpChunkLoadingRuntimeModule extends RuntimeModule { - /** - * @param {Compilation} compilation the compilation - * @returns {JsonpCompilationPluginHooks} hooks - */ - static getCompilationHooks(compilation) { - if (!(compilation instanceof Compilation)) { - throw new TypeError( - "The 'compilation' argument must be an instance of Compilation" - ); - } - let hooks = compilationHooksMap.get(compilation); - if (hooks === undefined) { - hooks = { - linkPreload: new SyncWaterfallHook(["source", "chunk"]), - linkPrefetch: new SyncWaterfallHook(["source", "chunk"]) - }; - compilationHooksMap.set(compilation, hooks); - } - return hooks; - } +AsyncSeriesLoopHook.prototype = null; - constructor(runtimeRequirements) { - super("jsonp chunk loading", RuntimeModule.STAGE_ATTACH); - this._runtimeRequirements = runtimeRequirements; - } +module.exports = AsyncSeriesLoopHook; - /** - * @returns {string} runtime code - */ - generate() { - const { chunkGraph, compilation, chunk } = this; - const { - runtimeTemplate, - outputOptions: { - chunkLoadingGlobal, - hotUpdateGlobal, - crossOriginLoading, - scriptType - } - } = compilation; - const globalObject = runtimeTemplate.globalObject; - const { linkPreload, linkPrefetch } = - JsonpChunkLoadingRuntimeModule.getCompilationHooks(compilation); - const fn = RuntimeGlobals.ensureChunkHandlers; - const withBaseURI = this._runtimeRequirements.has(RuntimeGlobals.baseURI); - const withLoading = this._runtimeRequirements.has( - RuntimeGlobals.ensureChunkHandlers - ); - const withCallback = this._runtimeRequirements.has( - RuntimeGlobals.chunkCallback - ); - const withOnChunkLoad = this._runtimeRequirements.has( - RuntimeGlobals.onChunksLoaded - ); - const withHmr = this._runtimeRequirements.has( - RuntimeGlobals.hmrDownloadUpdateHandlers - ); - const withHmrManifest = this._runtimeRequirements.has( - RuntimeGlobals.hmrDownloadManifest - ); - const withPrefetch = this._runtimeRequirements.has( - RuntimeGlobals.prefetchChunkHandlers - ); - const withPreload = this._runtimeRequirements.has( - RuntimeGlobals.preloadChunkHandlers - ); - const chunkLoadingGlobalExpr = `${globalObject}[${JSON.stringify( - chunkLoadingGlobal - )}]`; - const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs); - const hasJsMatcher = compileBooleanMatcher(conditionMap); - const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); - const stateExpression = withHmr - ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_jsonp` - : undefined; +/***/ }), - return Template.asString([ - withBaseURI - ? Template.asString([ - `${RuntimeGlobals.baseURI} = document.baseURI || self.location.href;` - ]) - : "// no baseURI", - "", - "// object to store loaded and loading chunks", - "// undefined = chunk not loaded, null = chunk preloaded/prefetched", - "// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded", - `var installedChunks = ${ - stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" - }{`, - Template.indent( - Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join( - ",\n" - ) - ), - "};", - "", - withLoading - ? Template.asString([ - `${fn}.j = ${runtimeTemplate.basicFunction( - "chunkId, promises", - hasJsMatcher !== false - ? Template.indent([ - "// JSONP chunk loading for javascript", - `var installedChunkData = ${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;`, - 'if(installedChunkData !== 0) { // 0 means "already installed".', - Template.indent([ - "", - '// a Promise means "currently loading".', - "if(installedChunkData) {", - Template.indent([ - "promises.push(installedChunkData[2]);" - ]), - "} else {", - Template.indent([ - hasJsMatcher === true - ? "if(true) { // all chunks have JS" - : `if(${hasJsMatcher("chunkId")}) {`, - Template.indent([ - "// setup Promise in chunk cache", - `var promise = new Promise(${runtimeTemplate.expressionFunction( - `installedChunkData = installedChunks[chunkId] = [resolve, reject]`, - "resolve, reject" - )});`, - "promises.push(installedChunkData[2] = promise);", - "", - "// start chunk loading", - `var url = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId);`, - "// create error before stack unwound to get useful stacktrace later", - "var error = new Error();", - `var loadingEnded = ${runtimeTemplate.basicFunction( - "event", - [ - `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId)) {`, - Template.indent([ - "installedChunkData = installedChunks[chunkId];", - "if(installedChunkData !== 0) installedChunks[chunkId] = undefined;", - "if(installedChunkData) {", - Template.indent([ - "var errorType = event && (event.type === 'load' ? 'missing' : event.type);", - "var realSrc = event && event.target && event.target.src;", - "error.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", - "error.name = 'ChunkLoadError';", - "error.type = errorType;", - "error.request = realSrc;", - "installedChunkData[1](error);" - ]), - "}" - ]), - "}" - ] - )};`, - `${RuntimeGlobals.loadScript}(url, loadingEnded, "chunk-" + chunkId, chunkId);` - ]), - "} else installedChunks[chunkId] = 0;" - ]), - "}" - ]), - "}" - ]) - : Template.indent(["installedChunks[chunkId] = 0;"]) - )};` - ]) - : "// no chunk on demand loading", - "", - withPrefetch && hasJsMatcher !== false - ? `${ - RuntimeGlobals.prefetchChunkHandlers - }.j = ${runtimeTemplate.basicFunction("chunkId", [ - `if((!${ - RuntimeGlobals.hasOwnProperty - }(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && ${ - hasJsMatcher === true ? "true" : hasJsMatcher("chunkId") - }) {`, - Template.indent([ - "installedChunks[chunkId] = null;", - linkPrefetch.call( - Template.asString([ - "var link = document.createElement('link');", - crossOriginLoading - ? `link.crossOrigin = ${JSON.stringify( - crossOriginLoading - )};` - : "", - `if (${RuntimeGlobals.scriptNonce}) {`, - Template.indent( - `link.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});` - ), - "}", - 'link.rel = "prefetch";', - 'link.as = "script";', - `link.href = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId);` - ]), - chunk - ), - "document.head.appendChild(link);" - ]), - "}" - ])};` - : "// no prefetching", - "", - withPreload && hasJsMatcher !== false - ? `${ - RuntimeGlobals.preloadChunkHandlers - }.j = ${runtimeTemplate.basicFunction("chunkId", [ - `if((!${ - RuntimeGlobals.hasOwnProperty - }(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && ${ - hasJsMatcher === true ? "true" : hasJsMatcher("chunkId") - }) {`, - Template.indent([ - "installedChunks[chunkId] = null;", - linkPreload.call( - Template.asString([ - "var link = document.createElement('link');", - scriptType - ? `link.type = ${JSON.stringify(scriptType)};` - : "", - "link.charset = 'utf-8';", - `if (${RuntimeGlobals.scriptNonce}) {`, - Template.indent( - `link.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});` - ), - "}", - 'link.rel = "preload";', - 'link.as = "script";', - `link.href = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId);`, - crossOriginLoading - ? Template.asString([ - "if (link.href.indexOf(window.location.origin + '/') !== 0) {", - Template.indent( - `link.crossOrigin = ${JSON.stringify( - crossOriginLoading - )};` - ), - "}" - ]) - : "" - ]), - chunk - ), - "document.head.appendChild(link);" - ]), - "}" - ])};` - : "// no preloaded", - "", - withHmr - ? Template.asString([ - "var currentUpdatedModulesList;", - "var waitingUpdateResolves = {};", - "function loadUpdateChunk(chunkId) {", - Template.indent([ - `return new Promise(${runtimeTemplate.basicFunction( - "resolve, reject", - [ - "waitingUpdateResolves[chunkId] = resolve;", - "// start update chunk loading", - `var url = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId);`, - "// create error before stack unwound to get useful stacktrace later", - "var error = new Error();", - `var loadingEnded = ${runtimeTemplate.basicFunction("event", [ - "if(waitingUpdateResolves[chunkId]) {", - Template.indent([ - "waitingUpdateResolves[chunkId] = undefined", - "var errorType = event && (event.type === 'load' ? 'missing' : event.type);", - "var realSrc = event && event.target && event.target.src;", - "error.message = 'Loading hot update chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", - "error.name = 'ChunkLoadError';", - "error.type = errorType;", - "error.request = realSrc;", - "reject(error);" - ]), - "}" - ])};`, - `${RuntimeGlobals.loadScript}(url, loadingEnded);` - ] - )});` - ]), - "}", - "", - `${globalObject}[${JSON.stringify( - hotUpdateGlobal - )}] = ${runtimeTemplate.basicFunction( - "chunkId, moreModules, runtime", - [ - "for(var moduleId in moreModules) {", - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, - Template.indent([ - "currentUpdate[moduleId] = moreModules[moduleId];", - "if(currentUpdatedModulesList) currentUpdatedModulesList.push(moduleId);" - ]), - "}" - ]), - "}", - "if(runtime) currentUpdateRuntime.push(runtime);", - "if(waitingUpdateResolves[chunkId]) {", - Template.indent([ - "waitingUpdateResolves[chunkId]();", - "waitingUpdateResolves[chunkId] = undefined;" - ]), - "}" - ] - )};`, - "", - Template.getFunctionContent( - require('./JavascriptHotModuleReplacement.runtime.js') - ) - .replace(/\$key\$/g, "jsonp") - .replace(/\$installedChunks\$/g, "installedChunks") - .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") - .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) - .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) - .replace( - /\$ensureChunkHandlers\$/g, - RuntimeGlobals.ensureChunkHandlers - ) - .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) - .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) - .replace( - /\$hmrDownloadUpdateHandlers\$/g, - RuntimeGlobals.hmrDownloadUpdateHandlers - ) - .replace( - /\$hmrInvalidateModuleHandlers\$/g, - RuntimeGlobals.hmrInvalidateModuleHandlers - ) - ]) - : "// no HMR", - "", - withHmrManifest - ? Template.asString([ - `${ - RuntimeGlobals.hmrDownloadManifest - } = ${runtimeTemplate.basicFunction("", [ - 'if (typeof fetch === "undefined") throw new Error("No browser support: need fetch API");', - `return fetch(${RuntimeGlobals.publicPath} + ${ - RuntimeGlobals.getUpdateManifestFilename - }()).then(${runtimeTemplate.basicFunction("response", [ - "if(response.status === 404) return; // no update available", - 'if(!response.ok) throw new Error("Failed to fetch update manifest " + response.statusText);', - "return response.json();" - ])});` - ])};` - ]) - : "// no HMR manifest", - "", - withOnChunkLoad - ? `${ - RuntimeGlobals.onChunksLoaded - }.j = ${runtimeTemplate.returningFunction( - "installedChunks[chunkId] === 0", - "chunkId" - )};` - : "// no on chunks loaded", - "", - withCallback || withLoading - ? Template.asString([ - "// install a JSONP callback for chunk loading", - `var webpackJsonpCallback = ${runtimeTemplate.basicFunction( - "parentChunkLoadingFunction, data", - [ - runtimeTemplate.destructureArray( - ["chunkIds", "moreModules", "runtime"], - "data" - ), - '// add "moreModules" to the modules object,', - '// then flag all "chunkIds" as loaded and fire callback', - "var moduleId, chunkId, i = 0;", - `if(chunkIds.some(${runtimeTemplate.returningFunction( - "installedChunks[id] !== 0", - "id" - )})) {`, - Template.indent([ - "for(moduleId in moreModules) {", - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, - Template.indent( - `${RuntimeGlobals.moduleFactories}[moduleId] = moreModules[moduleId];` - ), - "}" - ]), - "}", - "if(runtime) var result = runtime(__webpack_require__);" - ]), - "}", - "if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);", - "for(;i < chunkIds.length; i++) {", - Template.indent([ - "chunkId = chunkIds[i];", - `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) && installedChunks[chunkId]) {`, - Template.indent("installedChunks[chunkId][0]();"), - "}", - "installedChunks[chunkId] = 0;" - ]), - "}", - withOnChunkLoad - ? `return ${RuntimeGlobals.onChunksLoaded}(result);` - : "" - ] - )}`, - "", - `var chunkLoadingGlobal = ${chunkLoadingGlobalExpr} = ${chunkLoadingGlobalExpr} || [];`, - "chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));", - "chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));" - ]) - : "// no jsonp function" - ]); +/***/ 47794: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + +const Hook = __webpack_require__(72258); +const HookCodeFactory = __webpack_require__(177); + +class AsyncSeriesWaterfallHookCodeFactory extends HookCodeFactory { + content({ onError, onResult, onDone }) { + return this.callTapsSeries({ + onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), + onResult: (i, result, next) => { + let code = ""; + code += `if(${result} !== undefined) {\n`; + code += `${this._args[0]} = ${result};\n`; + code += `}\n`; + code += next(); + return code; + }, + onDone: () => onResult(this._args[0]) + }); } } -module.exports = JsonpChunkLoadingRuntimeModule; +const factory = new AsyncSeriesWaterfallHookCodeFactory(); + +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; + +function AsyncSeriesWaterfallHook(args = [], name = undefined) { + if (args.length < 1) + throw new Error("Waterfall hooks must have at least one argument"); + const hook = new Hook(args, name); + hook.constructor = AsyncSeriesWaterfallHook; + hook.compile = COMPILE; + hook._call = undefined; + hook.call = undefined; + return hook; +} + +AsyncSeriesWaterfallHook.prototype = null; + +module.exports = AsyncSeriesWaterfallHook; /***/ }), -/***/ 4607: +/***/ 72258: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -140373,223 +140134,181 @@ module.exports = JsonpChunkLoadingRuntimeModule; */ +const util = __webpack_require__(73837); -const ArrayPushCallbackChunkFormatPlugin = __webpack_require__(18535); -const EnableChunkLoadingPlugin = __webpack_require__(61291); -const JsonpChunkLoadingRuntimeModule = __webpack_require__(84154); +const deprecateContext = util.deprecate(() => {}, +"Hook.context is deprecated and will be removed"); -/** @typedef {import("../Chunk")} Chunk */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Compiler")} Compiler */ +const CALL_DELEGATE = function(...args) { + this.call = this._createCall("sync"); + return this.call(...args); +}; +const CALL_ASYNC_DELEGATE = function(...args) { + this.callAsync = this._createCall("async"); + return this.callAsync(...args); +}; +const PROMISE_DELEGATE = function(...args) { + this.promise = this._createCall("promise"); + return this.promise(...args); +}; -class JsonpTemplatePlugin { - /** - * @deprecated use JsonpChunkLoadingRuntimeModule.getCompilationHooks instead - * @param {Compilation} compilation the compilation - * @returns {JsonpChunkLoadingRuntimeModule.JsonpCompilationPluginHooks} hooks - */ - static getCompilationHooks(compilation) { - return JsonpChunkLoadingRuntimeModule.getCompilationHooks(compilation); - } +class Hook { + constructor(args = [], name = undefined) { + this._args = args; + this.name = name; + this.taps = []; + this.interceptors = []; + this._call = CALL_DELEGATE; + this.call = CALL_DELEGATE; + this._callAsync = CALL_ASYNC_DELEGATE; + this.callAsync = CALL_ASYNC_DELEGATE; + this._promise = PROMISE_DELEGATE; + this.promise = PROMISE_DELEGATE; + this._x = undefined; - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.options.output.chunkLoading = "jsonp"; - new ArrayPushCallbackChunkFormatPlugin().apply(compiler); - new EnableChunkLoadingPlugin("jsonp").apply(compiler); + this.compile = this.compile; + this.tap = this.tap; + this.tapAsync = this.tapAsync; + this.tapPromise = this.tapPromise; } -} -module.exports = JsonpTemplatePlugin; - - -/***/ }), + compile(options) { + throw new Error("Abstract: should be overridden"); + } -/***/ 36243: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + _createCall(type) { + return this.compile({ + taps: this.taps, + interceptors: this.interceptors, + args: this._args, + type: type + }); + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + _tap(type, options, fn) { + if (typeof options === "string") { + options = { + name: options.trim() + }; + } else if (typeof options !== "object" || options === null) { + throw new Error("Invalid tap options"); + } + if (typeof options.name !== "string" || options.name === "") { + throw new Error("Missing name for tap"); + } + if (typeof options.context !== "undefined") { + deprecateContext(); + } + options = Object.assign({ type, fn }, options); + options = this._runRegisterInterceptors(options); + this._insert(options); + } + tap(options, fn) { + this._tap("sync", options, fn); + } + tapAsync(options, fn) { + this._tap("async", options, fn); + } -const util = __webpack_require__(73837); -const webpackOptionsSchemaCheck = __webpack_require__(10382); -const webpackOptionsSchema = __webpack_require__(73342); -const Compiler = __webpack_require__(70845); -const MultiCompiler = __webpack_require__(33370); -const WebpackOptionsApply = __webpack_require__(88422); -const { - applyWebpackOptionsDefaults, - applyWebpackOptionsBaseDefaults -} = __webpack_require__(92988); -const { getNormalizedWebpackOptions } = __webpack_require__(26693); -const NodeEnvironmentPlugin = __webpack_require__(7553); -const memoize = __webpack_require__(78676); + tapPromise(options, fn) { + this._tap("promise", options, fn); + } -/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} WebpackOptions */ -/** @typedef {import("./Compiler").WatchOptions} WatchOptions */ -/** @typedef {import("./MultiCompiler").MultiCompilerOptions} MultiCompilerOptions */ -/** @typedef {import("./MultiStats")} MultiStats */ -/** @typedef {import("./Stats")} Stats */ + _runRegisterInterceptors(options) { + for (const interceptor of this.interceptors) { + if (interceptor.register) { + const newOptions = interceptor.register(options); + if (newOptions !== undefined) { + options = newOptions; + } + } + } + return options; + } -const getValidateSchema = memoize(() => __webpack_require__(12047)); + withOptions(options) { + const mergeOptions = opt => + Object.assign({}, options, typeof opt === "string" ? { name: opt } : opt); -/** - * @template T - * @callback Callback - * @param {Error=} err - * @param {T=} stats - * @returns {void} - */ + return { + name: this.name, + tap: (opt, fn) => this.tap(mergeOptions(opt), fn), + tapAsync: (opt, fn) => this.tapAsync(mergeOptions(opt), fn), + tapPromise: (opt, fn) => this.tapPromise(mergeOptions(opt), fn), + intercept: interceptor => this.intercept(interceptor), + isUsed: () => this.isUsed(), + withOptions: opt => this.withOptions(mergeOptions(opt)) + }; + } -/** - * @param {ReadonlyArray} childOptions options array - * @param {MultiCompilerOptions} options options - * @returns {MultiCompiler} a multi-compiler - */ -const createMultiCompiler = (childOptions, options) => { - const compilers = childOptions.map(options => createCompiler(options)); - const compiler = new MultiCompiler(compilers, options); - for (const childCompiler of compilers) { - if (childCompiler.options.dependencies) { - compiler.setDependencies( - childCompiler, - childCompiler.options.dependencies - ); - } + isUsed() { + return this.taps.length > 0 || this.interceptors.length > 0; } - return compiler; -}; -/** - * @param {WebpackOptions} rawOptions options object - * @returns {Compiler} a compiler - */ -const createCompiler = rawOptions => { - const options = getNormalizedWebpackOptions(rawOptions); - applyWebpackOptionsBaseDefaults(options); - const compiler = new Compiler(options.context, options); - new NodeEnvironmentPlugin({ - infrastructureLogging: options.infrastructureLogging - }).apply(compiler); - if (Array.isArray(options.plugins)) { - for (const plugin of options.plugins) { - if (typeof plugin === "function") { - plugin.call(compiler, compiler); - } else { - plugin.apply(compiler); + intercept(interceptor) { + this._resetCompilation(); + this.interceptors.push(Object.assign({}, interceptor)); + if (interceptor.register) { + for (let i = 0; i < this.taps.length; i++) { + this.taps[i] = interceptor.register(this.taps[i]); } } } - applyWebpackOptionsDefaults(options); - compiler.hooks.environment.call(); - compiler.hooks.afterEnvironment.call(); - new WebpackOptionsApply().process(options, compiler); - compiler.hooks.initialize.call(); - return compiler; -}; - -/** - * @callback WebpackFunctionSingle - * @param {WebpackOptions} options options object - * @param {Callback=} callback callback - * @returns {Compiler} the compiler object - */ - -/** - * @callback WebpackFunctionMulti - * @param {ReadonlyArray & MultiCompilerOptions} options options objects - * @param {Callback=} callback callback - * @returns {MultiCompiler} the multi compiler object - */ -const asArray = options => - Array.isArray(options) ? Array.from(options) : [options]; + _resetCompilation() { + this.call = this._call; + this.callAsync = this._callAsync; + this.promise = this._promise; + } -const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ ( - /** - * @param {WebpackOptions | (ReadonlyArray & MultiCompilerOptions)} options options - * @param {Callback & Callback=} callback callback - * @returns {Compiler | MultiCompiler} - */ - (options, callback) => { - const create = () => { - if (!asArray(options).every(webpackOptionsSchemaCheck)) { - getValidateSchema()(webpackOptionsSchema, options); - util.deprecate( - () => {}, - "webpack bug: Pre-compiled schema reports error while real schema is happy. This has performance drawbacks.", - "DEP_WEBPACK_PRE_COMPILED_SCHEMA_INVALID" - )(); - } - /** @type {MultiCompiler|Compiler} */ - let compiler; - let watch = false; - /** @type {WatchOptions|WatchOptions[]} */ - let watchOptions; - if (Array.isArray(options)) { - /** @type {MultiCompiler} */ - compiler = createMultiCompiler( - options, - /** @type {MultiCompilerOptions} */ (options) - ); - watch = options.some(options => options.watch); - watchOptions = options.map(options => options.watchOptions || {}); - } else { - const webpackOptions = /** @type {WebpackOptions} */ (options); - /** @type {Compiler} */ - compiler = createCompiler(webpackOptions); - watch = webpackOptions.watch; - watchOptions = webpackOptions.watchOptions || {}; - } - return { compiler, watch, watchOptions }; - }; - if (callback) { - try { - const { compiler, watch, watchOptions } = create(); - if (watch) { - compiler.watch(watchOptions, callback); - } else { - compiler.run((err, stats) => { - compiler.close(err2 => { - callback(err || err2, stats); - }); - }); + _insert(item) { + this._resetCompilation(); + let before; + if (typeof item.before === "string") { + before = new Set([item.before]); + } else if (Array.isArray(item.before)) { + before = new Set(item.before); + } + let stage = 0; + if (typeof item.stage === "number") { + stage = item.stage; + } + let i = this.taps.length; + while (i > 0) { + i--; + const x = this.taps[i]; + this.taps[i + 1] = x; + const xStage = x.stage || 0; + if (before) { + if (before.has(x.name)) { + before.delete(x.name); + continue; + } + if (before.size > 0) { + continue; } - return compiler; - } catch (err) { - process.nextTick(() => callback(err)); - return null; } - } else { - const { compiler, watch } = create(); - if (watch) { - util.deprecate( - () => {}, - "A 'callback' argument needs to be provided to the 'webpack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.", - "DEP_WEBPACK_WATCH_WITHOUT_CALLBACK" - )(); + if (xStage > stage) { + continue; } - return compiler; + i++; + break; } + this.taps[i] = item; } -); +} -module.exports = webpack; +Object.setPrototypeOf(Hook.prototype, null); + +module.exports = Hook; /***/ }), -/***/ 54182: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 177: +/***/ (function(module) { "use strict"; /* @@ -140598,335 +140317,473 @@ module.exports = webpack; */ +class HookCodeFactory { + constructor(config) { + this.config = config; + this.options = undefined; + this._args = undefined; + } -const RuntimeGlobals = __webpack_require__(16475); -const StartupChunkDependenciesPlugin = __webpack_require__(22339); -const ImportScriptsChunkLoadingRuntimeModule = __webpack_require__(96952); + create(options) { + this.init(options); + let fn; + switch (this.options.type) { + case "sync": + fn = new Function( + this.args(), + '"use strict";\n' + + this.header() + + this.contentWithInterceptors({ + onError: err => `throw ${err};\n`, + onResult: result => `return ${result};\n`, + resultReturns: true, + onDone: () => "", + rethrowIfPossible: true + }) + ); + break; + case "async": + fn = new Function( + this.args({ + after: "_callback" + }), + '"use strict";\n' + + this.header() + + this.contentWithInterceptors({ + onError: err => `_callback(${err});\n`, + onResult: result => `_callback(null, ${result});\n`, + onDone: () => "_callback();\n" + }) + ); + break; + case "promise": + let errorHelperUsed = false; + const content = this.contentWithInterceptors({ + onError: err => { + errorHelperUsed = true; + return `_error(${err});\n`; + }, + onResult: result => `_resolve(${result});\n`, + onDone: () => "_resolve();\n" + }); + let code = ""; + code += '"use strict";\n'; + code += this.header(); + code += "return new Promise((function(_resolve, _reject) {\n"; + if (errorHelperUsed) { + code += "var _sync = true;\n"; + code += "function _error(_err) {\n"; + code += "if(_sync)\n"; + code += + "_resolve(Promise.resolve().then((function() { throw _err; })));\n"; + code += "else\n"; + code += "_reject(_err);\n"; + code += "};\n"; + } + code += content; + if (errorHelperUsed) { + code += "_sync = false;\n"; + } + code += "}));\n"; + fn = new Function(this.args(), code); + break; + } + this.deinit(); + return fn; + } -/** @typedef {import("../Compiler")} Compiler */ + setup(instance, options) { + instance._x = options.taps.map(t => t.fn); + } -class ImportScriptsChunkLoadingPlugin { /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} + * @param {{ type: "sync" | "promise" | "async", taps: Array, interceptors: Array }} options */ - apply(compiler) { - new StartupChunkDependenciesPlugin({ - chunkLoading: "import-scripts", - asyncChunkLoading: true - }).apply(compiler); - compiler.hooks.thisCompilation.tap( - "ImportScriptsChunkLoadingPlugin", - compilation => { - const globalChunkLoading = compilation.outputOptions.chunkLoading; - const isEnabledForChunk = chunk => { - const options = chunk.getEntryOptions(); - const chunkLoading = - options && options.chunkLoading !== undefined - ? options.chunkLoading - : globalChunkLoading; - return chunkLoading === "import-scripts"; - }; - const onceForChunkSet = new WeakSet(); - const handler = (chunk, set) => { - if (onceForChunkSet.has(chunk)) return; - onceForChunkSet.add(chunk); - if (!isEnabledForChunk(chunk)) return; - const withCreateScriptUrl = !!compilation.outputOptions.trustedTypes; - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - set.add(RuntimeGlobals.hasOwnProperty); - if (withCreateScriptUrl) { - set.add(RuntimeGlobals.createScriptUrl); - } - compilation.addRuntimeModule( - chunk, - new ImportScriptsChunkLoadingRuntimeModule(set, withCreateScriptUrl) - ); - }; - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("ImportScriptsChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadUpdateHandlers) - .tap("ImportScriptsChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadManifest) - .tap("ImportScriptsChunkLoadingPlugin", handler); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.baseURI) - .tap("ImportScriptsChunkLoadingPlugin", handler); + init(options) { + this.options = options; + this._args = options.args.slice(); + } - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.ensureChunkHandlers) - .tap("ImportScriptsChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.publicPath); - set.add(RuntimeGlobals.getChunkScriptFilename); - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadUpdateHandlers) - .tap("ImportScriptsChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.publicPath); - set.add(RuntimeGlobals.getChunkUpdateScriptFilename); - set.add(RuntimeGlobals.moduleCache); - set.add(RuntimeGlobals.hmrModuleData); - set.add(RuntimeGlobals.moduleFactoriesAddOnly); - }); - compilation.hooks.runtimeRequirementInTree - .for(RuntimeGlobals.hmrDownloadManifest) - .tap("ImportScriptsChunkLoadingPlugin", (chunk, set) => { - if (!isEnabledForChunk(chunk)) return; - set.add(RuntimeGlobals.publicPath); - set.add(RuntimeGlobals.getUpdateManifestFilename); - }); + deinit() { + this.options = undefined; + this._args = undefined; + } + + contentWithInterceptors(options) { + if (this.options.interceptors.length > 0) { + const onError = options.onError; + const onResult = options.onResult; + const onDone = options.onDone; + let code = ""; + for (let i = 0; i < this.options.interceptors.length; i++) { + const interceptor = this.options.interceptors[i]; + if (interceptor.call) { + code += `${this.getInterceptor(i)}.call(${this.args({ + before: interceptor.context ? "_context" : undefined + })});\n`; + } } - ); + code += this.content( + Object.assign(options, { + onError: + onError && + (err => { + let code = ""; + for (let i = 0; i < this.options.interceptors.length; i++) { + const interceptor = this.options.interceptors[i]; + if (interceptor.error) { + code += `${this.getInterceptor(i)}.error(${err});\n`; + } + } + code += onError(err); + return code; + }), + onResult: + onResult && + (result => { + let code = ""; + for (let i = 0; i < this.options.interceptors.length; i++) { + const interceptor = this.options.interceptors[i]; + if (interceptor.result) { + code += `${this.getInterceptor(i)}.result(${result});\n`; + } + } + code += onResult(result); + return code; + }), + onDone: + onDone && + (() => { + let code = ""; + for (let i = 0; i < this.options.interceptors.length; i++) { + const interceptor = this.options.interceptors[i]; + if (interceptor.done) { + code += `${this.getInterceptor(i)}.done();\n`; + } + } + code += onDone(); + return code; + }) + }) + ); + return code; + } else { + return this.content(options); + } } -} -module.exports = ImportScriptsChunkLoadingPlugin; + header() { + let code = ""; + if (this.needContext()) { + code += "var _context = {};\n"; + } else { + code += "var _context;\n"; + } + code += "var _x = this._x;\n"; + if (this.options.interceptors.length > 0) { + code += "var _taps = this.taps;\n"; + code += "var _interceptors = this.interceptors;\n"; + } + return code; + } -/***/ }), - -/***/ 96952: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - - - -const RuntimeGlobals = __webpack_require__(16475); -const RuntimeModule = __webpack_require__(16963); -const Template = __webpack_require__(39722); -const { - getChunkFilenameTemplate, - chunkHasJs -} = __webpack_require__(89464); -const { getInitialChunkIds } = __webpack_require__(98124); -const compileBooleanMatcher = __webpack_require__(29404); -const { getUndoPath } = __webpack_require__(82186); - -class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule { - constructor(runtimeRequirements, withCreateScriptUrl) { - super("importScripts chunk loading", RuntimeModule.STAGE_ATTACH); - this.runtimeRequirements = runtimeRequirements; - this._withCreateScriptUrl = withCreateScriptUrl; + needContext() { + for (const tap of this.options.taps) if (tap.context) return true; + return false; } - /** - * @returns {string} runtime code - */ - generate() { - const { - chunk, - chunkGraph, - compilation: { - runtimeTemplate, - outputOptions: { chunkLoadingGlobal, hotUpdateGlobal } - }, - _withCreateScriptUrl: withCreateScriptUrl - } = this; - const globalObject = runtimeTemplate.globalObject; - const fn = RuntimeGlobals.ensureChunkHandlers; - const withBaseURI = this.runtimeRequirements.has(RuntimeGlobals.baseURI); - const withLoading = this.runtimeRequirements.has( - RuntimeGlobals.ensureChunkHandlers - ); - const withHmr = this.runtimeRequirements.has( - RuntimeGlobals.hmrDownloadUpdateHandlers - ); - const withHmrManifest = this.runtimeRequirements.has( - RuntimeGlobals.hmrDownloadManifest - ); - const chunkLoadingGlobalExpr = `${globalObject}[${JSON.stringify( - chunkLoadingGlobal - )}]`; - const hasJsMatcher = compileBooleanMatcher( - chunkGraph.getChunkConditionMap(chunk, chunkHasJs) - ); - const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs); + callTap(tapIndex, { onError, onResult, onDone, rethrowIfPossible }) { + let code = ""; + let hasTapCached = false; + for (let i = 0; i < this.options.interceptors.length; i++) { + const interceptor = this.options.interceptors[i]; + if (interceptor.tap) { + if (!hasTapCached) { + code += `var _tap${tapIndex} = ${this.getTap(tapIndex)};\n`; + hasTapCached = true; + } + code += `${this.getInterceptor(i)}.tap(${ + interceptor.context ? "_context, " : "" + }_tap${tapIndex});\n`; + } + } + code += `var _fn${tapIndex} = ${this.getTapFn(tapIndex)};\n`; + const tap = this.options.taps[tapIndex]; + switch (tap.type) { + case "sync": + if (!rethrowIfPossible) { + code += `var _hasError${tapIndex} = false;\n`; + code += "try {\n"; + } + if (onResult) { + code += `var _result${tapIndex} = _fn${tapIndex}(${this.args({ + before: tap.context ? "_context" : undefined + })});\n`; + } else { + code += `_fn${tapIndex}(${this.args({ + before: tap.context ? "_context" : undefined + })});\n`; + } + if (!rethrowIfPossible) { + code += "} catch(_err) {\n"; + code += `_hasError${tapIndex} = true;\n`; + code += onError("_err"); + code += "}\n"; + code += `if(!_hasError${tapIndex}) {\n`; + } + if (onResult) { + code += onResult(`_result${tapIndex}`); + } + if (onDone) { + code += onDone(); + } + if (!rethrowIfPossible) { + code += "}\n"; + } + break; + case "async": + let cbCode = ""; + if (onResult) + cbCode += `(function(_err${tapIndex}, _result${tapIndex}) {\n`; + else cbCode += `(function(_err${tapIndex}) {\n`; + cbCode += `if(_err${tapIndex}) {\n`; + cbCode += onError(`_err${tapIndex}`); + cbCode += "} else {\n"; + if (onResult) { + cbCode += onResult(`_result${tapIndex}`); + } + if (onDone) { + cbCode += onDone(); + } + cbCode += "}\n"; + cbCode += "})"; + code += `_fn${tapIndex}(${this.args({ + before: tap.context ? "_context" : undefined, + after: cbCode + })});\n`; + break; + case "promise": + code += `var _hasResult${tapIndex} = false;\n`; + code += `var _promise${tapIndex} = _fn${tapIndex}(${this.args({ + before: tap.context ? "_context" : undefined + })});\n`; + code += `if (!_promise${tapIndex} || !_promise${tapIndex}.then)\n`; + code += ` throw new Error('Tap function (tapPromise) did not return promise (returned ' + _promise${tapIndex} + ')');\n`; + code += `_promise${tapIndex}.then((function(_result${tapIndex}) {\n`; + code += `_hasResult${tapIndex} = true;\n`; + if (onResult) { + code += onResult(`_result${tapIndex}`); + } + if (onDone) { + code += onDone(); + } + code += `}), function(_err${tapIndex}) {\n`; + code += `if(_hasResult${tapIndex}) throw _err${tapIndex};\n`; + code += onError(`_err${tapIndex}`); + code += "});\n"; + break; + } + return code; + } - const outputName = this.compilation.getPath( - getChunkFilenameTemplate(chunk, this.compilation.outputOptions), - { - chunk, - contentHashType: "javascript" + callTapsSeries({ + onError, + onResult, + resultReturns, + onDone, + doneReturns, + rethrowIfPossible + }) { + if (this.options.taps.length === 0) return onDone(); + const firstAsync = this.options.taps.findIndex(t => t.type !== "sync"); + const somethingReturns = resultReturns || doneReturns; + let code = ""; + let current = onDone; + let unrollCounter = 0; + for (let j = this.options.taps.length - 1; j >= 0; j--) { + const i = j; + const unroll = + current !== onDone && + (this.options.taps[i].type !== "sync" || unrollCounter++ > 20); + if (unroll) { + unrollCounter = 0; + code += `function _next${i}() {\n`; + code += current(); + code += `}\n`; + current = () => `${somethingReturns ? "return " : ""}_next${i}();\n`; } - ); - const rootOutputDir = getUndoPath( - outputName, - this.compilation.outputOptions.path, - false - ); + const done = current; + const doneBreak = skipDone => { + if (skipDone) return ""; + return onDone(); + }; + const content = this.callTap(i, { + onError: error => onError(i, error, done, doneBreak), + onResult: + onResult && + (result => { + return onResult(i, result, done, doneBreak); + }), + onDone: !onResult && done, + rethrowIfPossible: + rethrowIfPossible && (firstAsync < 0 || i < firstAsync) + }); + current = () => content; + } + code += current(); + return code; + } - const stateExpression = withHmr - ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_importScripts` - : undefined; + callTapsLooping({ onError, onDone, rethrowIfPossible }) { + if (this.options.taps.length === 0) return onDone(); + const syncOnly = this.options.taps.every(t => t.type === "sync"); + let code = ""; + if (!syncOnly) { + code += "var _looper = (function() {\n"; + code += "var _loopAsync = false;\n"; + } + code += "var _loop;\n"; + code += "do {\n"; + code += "_loop = false;\n"; + for (let i = 0; i < this.options.interceptors.length; i++) { + const interceptor = this.options.interceptors[i]; + if (interceptor.loop) { + code += `${this.getInterceptor(i)}.loop(${this.args({ + before: interceptor.context ? "_context" : undefined + })});\n`; + } + } + code += this.callTapsSeries({ + onError, + onResult: (i, result, next, doneBreak) => { + let code = ""; + code += `if(${result} !== undefined) {\n`; + code += "_loop = true;\n"; + if (!syncOnly) code += "if(_loopAsync) _looper();\n"; + code += doneBreak(true); + code += `} else {\n`; + code += next(); + code += `}\n`; + return code; + }, + onDone: + onDone && + (() => { + let code = ""; + code += "if(!_loop) {\n"; + code += onDone(); + code += "}\n"; + return code; + }), + rethrowIfPossible: rethrowIfPossible && syncOnly + }); + code += "} while(_loop);\n"; + if (!syncOnly) { + code += "_loopAsync = true;\n"; + code += "});\n"; + code += "_looper();\n"; + } + return code; + } - return Template.asString([ - withBaseURI - ? Template.asString([ - `${RuntimeGlobals.baseURI} = self.location + ${JSON.stringify( - rootOutputDir ? "/../" + rootOutputDir : "" - )};` - ]) - : "// no baseURI", - "", - "// object to store loaded chunks", - '// "1" means "already loaded"', - `var installedChunks = ${ - stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" - }{`, - Template.indent( - Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 1`).join( - ",\n" - ) - ), - "};", - "", - withLoading - ? Template.asString([ - "// importScripts chunk loading", - `var installChunk = ${runtimeTemplate.basicFunction("data", [ - runtimeTemplate.destructureArray( - ["chunkIds", "moreModules", "runtime"], - "data" - ), - "for(var moduleId in moreModules) {", - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, - Template.indent( - `${RuntimeGlobals.moduleFactories}[moduleId] = moreModules[moduleId];` - ), - "}" - ]), - "}", - "if(runtime) runtime(__webpack_require__);", - "while(chunkIds.length)", - Template.indent("installedChunks[chunkIds.pop()] = 1;"), - "parentChunkLoadingFunction(data);" - ])};` - ]) - : "// no chunk install function needed", - withLoading - ? Template.asString([ - `${fn}.i = ${runtimeTemplate.basicFunction( - "chunkId, promises", - hasJsMatcher !== false - ? [ - '// "1" is the signal for "already loaded"', - "if(!installedChunks[chunkId]) {", - Template.indent([ - hasJsMatcher === true - ? "if(true) { // all chunks have JS" - : `if(${hasJsMatcher("chunkId")}) {`, - Template.indent( - `importScripts(${ - withCreateScriptUrl - ? `${RuntimeGlobals.createScriptUrl}(${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId))` - : `${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId)` - });` - ), - "}" - ]), - "}" - ] - : "installedChunks[chunkId] = 1;" - )};`, - "", - `var chunkLoadingGlobal = ${chunkLoadingGlobalExpr} = ${chunkLoadingGlobalExpr} || [];`, - "var parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);", - "chunkLoadingGlobal.push = installChunk;" - ]) - : "// no chunk loading", - "", - withHmr - ? Template.asString([ - "function loadUpdateChunk(chunkId, updatedModulesList) {", - Template.indent([ - "var success = false;", - `${globalObject}[${JSON.stringify( - hotUpdateGlobal - )}] = ${runtimeTemplate.basicFunction("_, moreModules, runtime", [ - "for(var moduleId in moreModules) {", - Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`, - Template.indent([ - "currentUpdate[moduleId] = moreModules[moduleId];", - "if(updatedModulesList) updatedModulesList.push(moduleId);" - ]), - "}" - ]), - "}", - "if(runtime) currentUpdateRuntime.push(runtime);", - "success = true;" - ])};`, - "// start update chunk loading", - `importScripts(${ - withCreateScriptUrl - ? `${RuntimeGlobals.createScriptUrl}(${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId))` - : `${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId)` - });`, - 'if(!success) throw new Error("Loading update chunk failed for unknown reason");' - ]), - "}", - "", - Template.getFunctionContent( - require('./JavascriptHotModuleReplacement.runtime.js') - ) - .replace(/\$key\$/g, "importScrips") - .replace(/\$installedChunks\$/g, "installedChunks") - .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") - .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) - .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) - .replace( - /\$ensureChunkHandlers\$/g, - RuntimeGlobals.ensureChunkHandlers - ) - .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) - .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) - .replace( - /\$hmrDownloadUpdateHandlers\$/g, - RuntimeGlobals.hmrDownloadUpdateHandlers - ) - .replace( - /\$hmrInvalidateModuleHandlers\$/g, - RuntimeGlobals.hmrInvalidateModuleHandlers - ) - ]) - : "// no HMR", - "", - withHmrManifest - ? Template.asString([ - `${ - RuntimeGlobals.hmrDownloadManifest - } = ${runtimeTemplate.basicFunction("", [ - 'if (typeof fetch === "undefined") throw new Error("No browser support: need fetch API");', - `return fetch(${RuntimeGlobals.publicPath} + ${ - RuntimeGlobals.getUpdateManifestFilename - }()).then(${runtimeTemplate.basicFunction("response", [ - "if(response.status === 404) return; // no update available", - 'if(!response.ok) throw new Error("Failed to fetch update manifest " + response.statusText);', - "return response.json();" - ])});` - ])};` - ]) - : "// no HMR manifest" - ]); + callTapsParallel({ + onError, + onResult, + onDone, + rethrowIfPossible, + onTap = (i, run) => run() + }) { + if (this.options.taps.length <= 1) { + return this.callTapsSeries({ + onError, + onResult, + onDone, + rethrowIfPossible + }); + } + let code = ""; + code += "do {\n"; + code += `var _counter = ${this.options.taps.length};\n`; + if (onDone) { + code += "var _done = (function() {\n"; + code += onDone(); + code += "});\n"; + } + for (let i = 0; i < this.options.taps.length; i++) { + const done = () => { + if (onDone) return "if(--_counter === 0) _done();\n"; + else return "--_counter;"; + }; + const doneBreak = skipDone => { + if (skipDone || !onDone) return "_counter = 0;\n"; + else return "_counter = 0;\n_done();\n"; + }; + code += "if(_counter <= 0) break;\n"; + code += onTap( + i, + () => + this.callTap(i, { + onError: error => { + let code = ""; + code += "if(_counter > 0) {\n"; + code += onError(i, error, done, doneBreak); + code += "}\n"; + return code; + }, + onResult: + onResult && + (result => { + let code = ""; + code += "if(_counter > 0) {\n"; + code += onResult(i, result, done, doneBreak); + code += "}\n"; + return code; + }), + onDone: + !onResult && + (() => { + return done(); + }), + rethrowIfPossible + }), + done, + doneBreak + ); + } + code += "} while(false);\n"; + return code; + } + + args({ before, after } = {}) { + let allArgs = this._args; + if (before) allArgs = [before].concat(allArgs); + if (after) allArgs = allArgs.concat(after); + if (allArgs.length === 0) { + return ""; + } else { + return allArgs.join(", "); + } + } + + getTapFn(idx) { + return `_x[${idx}]`; + } + + getTap(idx) { + return `_taps[${idx}]`; + } + + getInterceptor(idx) { + return `_interceptors[${idx}]`; } } -module.exports = ImportScriptsChunkLoadingRuntimeModule; +module.exports = HookCodeFactory; /***/ }), -/***/ 68693: +/***/ 5504: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -140936,240 +140793,383 @@ module.exports = ImportScriptsChunkLoadingRuntimeModule; */ +const util = __webpack_require__(73837); -const ArrayPushCallbackChunkFormatPlugin = __webpack_require__(18535); -const EnableChunkLoadingPlugin = __webpack_require__(61291); +const defaultFactory = (key, hook) => hook; -/** @typedef {import("../Compiler")} Compiler */ +class HookMap { + constructor(factory, name = undefined) { + this._map = new Map(); + this.name = name; + this._factory = factory; + this._interceptors = []; + } -class WebWorkerTemplatePlugin { - /** - * Apply the plugin - * @param {Compiler} compiler the compiler instance - * @returns {void} - */ - apply(compiler) { - compiler.options.output.chunkLoading = "import-scripts"; - new ArrayPushCallbackChunkFormatPlugin().apply(compiler); - new EnableChunkLoadingPlugin("import-scripts").apply(compiler); + get(key) { + return this._map.get(key); + } + + for(key) { + const hook = this.get(key); + if (hook !== undefined) { + return hook; + } + let newHook = this._factory(key); + const interceptors = this._interceptors; + for (let i = 0; i < interceptors.length; i++) { + newHook = interceptors[i].factory(key, newHook); + } + this._map.set(key, newHook); + return newHook; + } + + intercept(interceptor) { + this._interceptors.push( + Object.assign( + { + factory: defaultFactory + }, + interceptor + ) + ); } } -module.exports = WebWorkerTemplatePlugin; + +HookMap.prototype.tap = util.deprecate(function(key, options, fn) { + return this.for(key).tap(options, fn); +}, "HookMap#tap(key,…) is deprecated. Use HookMap#for(key).tap(…) instead."); + +HookMap.prototype.tapAsync = util.deprecate(function(key, options, fn) { + return this.for(key).tapAsync(options, fn); +}, "HookMap#tapAsync(key,…) is deprecated. Use HookMap#for(key).tapAsync(…) instead."); + +HookMap.prototype.tapPromise = util.deprecate(function(key, options, fn) { + return this.for(key).tapPromise(options, fn); +}, "HookMap#tapPromise(key,…) is deprecated. Use HookMap#for(key).tapPromise(…) instead."); + +module.exports = HookMap; /***/ }), -/***/ 50569: +/***/ 1081: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/*! - * mime-db - * Copyright(c) 2014 Jonathan Ong - * MIT Licensed - */ +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/** - * Module exports. - */ -module.exports = __webpack_require__(58750) +const Hook = __webpack_require__(72258); + +class MultiHook { + constructor(hooks, name = undefined) { + this.hooks = hooks; + this.name = name; + } + + tap(options, fn) { + for (const hook of this.hooks) { + hook.tap(options, fn); + } + } + + tapAsync(options, fn) { + for (const hook of this.hooks) { + hook.tapAsync(options, fn); + } + } + + tapPromise(options, fn) { + for (const hook of this.hooks) { + hook.tapPromise(options, fn); + } + } + + isUsed() { + for (const hook of this.hooks) { + if (hook.isUsed()) return true; + } + return false; + } + + intercept(interceptor) { + for (const hook of this.hooks) { + hook.intercept(interceptor); + } + } + + withOptions(options) { + return new MultiHook( + this.hooks.map(h => h.withOptions(options)), + this.name + ); + } +} + +module.exports = MultiHook; /***/ }), -/***/ 78585: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 79106: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -/*! - * mime-types - * Copyright(c) 2014 Jonathan Ong - * Copyright(c) 2015 Douglas Christopher Wilson - * MIT Licensed - */ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +const Hook = __webpack_require__(72258); +const HookCodeFactory = __webpack_require__(177); -/** - * Module dependencies. - * @private - */ +class SyncBailHookCodeFactory extends HookCodeFactory { + content({ onError, onResult, resultReturns, onDone, rethrowIfPossible }) { + return this.callTapsSeries({ + onError: (i, err) => onError(err), + onResult: (i, result, next) => + `if(${result} !== undefined) {\n${onResult( + result + )};\n} else {\n${next()}}\n`, + resultReturns, + onDone, + rethrowIfPossible + }); + } +} -var db = __webpack_require__(50569) -var extname = (__webpack_require__(71017).extname) +const factory = new SyncBailHookCodeFactory(); -/** - * Module variables. - * @private - */ +const TAP_ASYNC = () => { + throw new Error("tapAsync is not supported on a SyncBailHook"); +}; -var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/ -var TEXT_TYPE_REGEXP = /^text\//i +const TAP_PROMISE = () => { + throw new Error("tapPromise is not supported on a SyncBailHook"); +}; -/** - * Module exports. - * @public - */ +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; -exports.charset = charset -exports.charsets = { lookup: charset } -exports.contentType = contentType -exports.extension = extension -exports.extensions = Object.create(null) -exports.lookup = lookup -exports.types = Object.create(null) +function SyncBailHook(args = [], name = undefined) { + const hook = new Hook(args, name); + hook.constructor = SyncBailHook; + hook.tapAsync = TAP_ASYNC; + hook.tapPromise = TAP_PROMISE; + hook.compile = COMPILE; + return hook; +} -// Populate the extensions/types maps -populateMaps(exports.extensions, exports.types) +SyncBailHook.prototype = null; -/** - * Get the default charset for a MIME type. - * - * @param {string} type - * @return {boolean|string} - */ +module.exports = SyncBailHook; -function charset (type) { - if (!type || typeof type !== 'string') { - return false - } - // TODO: use media-typer - var match = EXTRACT_TYPE_REGEXP.exec(type) - var mime = match && db[match[1].toLowerCase()] +/***/ }), - if (mime && mime.charset) { - return mime.charset - } +/***/ 10533: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // default text/* to utf-8 - if (match && TEXT_TYPE_REGEXP.test(match[1])) { - return 'UTF-8' - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - return false -} -/** - * Create a full Content-Type header given a MIME type or extension. - * - * @param {string} str - * @return {boolean|string} - */ +const Hook = __webpack_require__(72258); +const HookCodeFactory = __webpack_require__(177); -function contentType (str) { - // TODO: should this even be in this module? - if (!str || typeof str !== 'string') { - return false - } +class SyncHookCodeFactory extends HookCodeFactory { + content({ onError, onDone, rethrowIfPossible }) { + return this.callTapsSeries({ + onError: (i, err) => onError(err), + onDone, + rethrowIfPossible + }); + } +} - var mime = str.indexOf('/') === -1 - ? exports.lookup(str) - : str +const factory = new SyncHookCodeFactory(); - if (!mime) { - return false - } +const TAP_ASYNC = () => { + throw new Error("tapAsync is not supported on a SyncHook"); +}; - // TODO: use content-type or other module - if (mime.indexOf('charset') === -1) { - var charset = exports.charset(mime) - if (charset) mime += '; charset=' + charset.toLowerCase() - } +const TAP_PROMISE = () => { + throw new Error("tapPromise is not supported on a SyncHook"); +}; - return mime +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; + +function SyncHook(args = [], name = undefined) { + const hook = new Hook(args, name); + hook.constructor = SyncHook; + hook.tapAsync = TAP_ASYNC; + hook.tapPromise = TAP_PROMISE; + hook.compile = COMPILE; + return hook; } -/** - * Get the default extension for a MIME type. - * - * @param {string} type - * @return {boolean|string} - */ +SyncHook.prototype = null; -function extension (type) { - if (!type || typeof type !== 'string') { - return false - } +module.exports = SyncHook; - // TODO: use media-typer - var match = EXTRACT_TYPE_REGEXP.exec(type) - // get extensions - var exts = match && exports.extensions[match[1].toLowerCase()] +/***/ }), - if (!exts || !exts.length) { - return false - } +/***/ 95854: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - return exts[0] +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + +const Hook = __webpack_require__(72258); +const HookCodeFactory = __webpack_require__(177); + +class SyncLoopHookCodeFactory extends HookCodeFactory { + content({ onError, onDone, rethrowIfPossible }) { + return this.callTapsLooping({ + onError: (i, err) => onError(err), + onDone, + rethrowIfPossible + }); + } } -/** - * Lookup the MIME type for a file path/extension. - * - * @param {string} path - * @return {boolean|string} - */ +const factory = new SyncLoopHookCodeFactory(); -function lookup (path) { - if (!path || typeof path !== 'string') { - return false - } +const TAP_ASYNC = () => { + throw new Error("tapAsync is not supported on a SyncLoopHook"); +}; - // get the extension ("ext" or ".ext" or full path) - var extension = extname('x.' + path) - .toLowerCase() - .substr(1) +const TAP_PROMISE = () => { + throw new Error("tapPromise is not supported on a SyncLoopHook"); +}; - if (!extension) { - return false - } +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; - return exports.types[extension] || false +function SyncLoopHook(args = [], name = undefined) { + const hook = new Hook(args, name); + hook.constructor = SyncLoopHook; + hook.tapAsync = TAP_ASYNC; + hook.tapPromise = TAP_PROMISE; + hook.compile = COMPILE; + return hook; } -/** - * Populate the extensions and types maps. - * @private - */ +SyncLoopHook.prototype = null; -function populateMaps (extensions, types) { - // source preference (least -> most) - var preference = ['nginx', 'apache', undefined, 'iana'] +module.exports = SyncLoopHook; - Object.keys(db).forEach(function forEachMimeType (type) { - var mime = db[type] - var exts = mime.extensions - if (!exts || !exts.length) { - return - } +/***/ }), - // mime -> extensions - extensions[type] = exts +/***/ 60176: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // extension -> mime - for (var i = 0; i < exts.length; i++) { - var extension = exts[i] +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (types[extension]) { - var from = preference.indexOf(db[types[extension]].source) - var to = preference.indexOf(mime.source) - if (types[extension] !== 'application/octet-stream' && - (from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) { - // skip the remapping - continue - } - } +const Hook = __webpack_require__(72258); +const HookCodeFactory = __webpack_require__(177); - // set the extension -> mime - types[extension] = type - } - }) +class SyncWaterfallHookCodeFactory extends HookCodeFactory { + content({ onError, onResult, resultReturns, rethrowIfPossible }) { + return this.callTapsSeries({ + onError: (i, err) => onError(err), + onResult: (i, result, next) => { + let code = ""; + code += `if(${result} !== undefined) {\n`; + code += `${this._args[0]} = ${result};\n`; + code += `}\n`; + code += next(); + return code; + }, + onDone: () => onResult(this._args[0]), + doneReturns: resultReturns, + rethrowIfPossible + }); + } +} + +const factory = new SyncWaterfallHookCodeFactory(); + +const TAP_ASYNC = () => { + throw new Error("tapAsync is not supported on a SyncWaterfallHook"); +}; + +const TAP_PROMISE = () => { + throw new Error("tapPromise is not supported on a SyncWaterfallHook"); +}; + +const COMPILE = function(options) { + factory.setup(this, options); + return factory.create(options); +}; + +function SyncWaterfallHook(args = [], name = undefined) { + if (args.length < 1) + throw new Error("Waterfall hooks must have at least one argument"); + const hook = new Hook(args, name); + hook.constructor = SyncWaterfallHook; + hook.tapAsync = TAP_ASYNC; + hook.tapPromise = TAP_PROMISE; + hook.compile = COMPILE; + return hook; } +SyncWaterfallHook.prototype = null; + +module.exports = SyncWaterfallHook; + + +/***/ }), + +/***/ 6967: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + +exports.__esModule = true; +exports.SyncHook = __webpack_require__(10533); +exports.SyncBailHook = __webpack_require__(79106); +exports.SyncWaterfallHook = __webpack_require__(60176); +exports.SyncLoopHook = __webpack_require__(95854); +exports.AsyncParallelHook = __webpack_require__(45874); +exports.AsyncParallelBailHook = __webpack_require__(76297); +exports.AsyncSeriesHook = __webpack_require__(40436); +exports.AsyncSeriesBailHook = __webpack_require__(13633); +exports.AsyncSeriesLoopHook = __webpack_require__(34656); +exports.AsyncSeriesWaterfallHook = __webpack_require__(47794); +exports.HookMap = __webpack_require__(5504); +exports.MultiHook = __webpack_require__(1081); + /***/ }), From c636f40778b577c42bc5077af0cd47acbfbd5033 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Wed, 30 Mar 2022 10:50:32 +0200 Subject: [PATCH 05/15] update react 18 prod tests --- test/production/react-18-streaming-ssr/index.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/production/react-18-streaming-ssr/index.test.ts b/test/production/react-18-streaming-ssr/index.test.ts index e10bf8cce45abb8..93a9a873051f51c 100644 --- a/test/production/react-18-streaming-ssr/index.test.ts +++ b/test/production/react-18-streaming-ssr/index.test.ts @@ -24,8 +24,8 @@ describe('react 18 streaming SSR in minimal mode', () => { }, }, dependencies: { - react: '18.0.0-rc.2', - 'react-dom': '18.0.0-rc.2', + react: '18.0.0', + 'react-dom': '18.0.0', }, }) }) @@ -70,8 +70,8 @@ describe('react 18 streaming SSR with custom next configs', () => { }, }, dependencies: { - react: '18.0.0-rc.2', - 'react-dom': '18.0.0-rc.2', + react: '18.0.0', + 'react-dom': '18.0.0', }, installCommand: 'npm install', }) From c916e40cb7bd5fe00f03a42880758babd7d2e989 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Wed, 30 Mar 2022 11:22:17 +0200 Subject: [PATCH 06/15] Update error test --- test/development/basic-basepath/hmr.test.ts | 2 +- test/development/basic/hmr.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/development/basic-basepath/hmr.test.ts b/test/development/basic-basepath/hmr.test.ts index 3754cb7677ed912..6b94890bc9bae03 100644 --- a/test/development/basic-basepath/hmr.test.ts +++ b/test/development/basic-basepath/hmr.test.ts @@ -540,7 +540,7 @@ describe('basic HMR', () => { 'Unknown' ) ).toMatch( - 'Objects are not valid as a React child (found: /search/). If you meant to render a collection of children, use an array instead.' + 'Objects are not valid as a React child (found: [object RegExp]). If you meant to render a collection of children, use an array instead.' ) await next.patchFile(aboutPage, aboutContent) diff --git a/test/development/basic/hmr.test.ts b/test/development/basic/hmr.test.ts index 47ef6872fa61620..dbc0c0468d98e77 100644 --- a/test/development/basic/hmr.test.ts +++ b/test/development/basic/hmr.test.ts @@ -561,7 +561,7 @@ describe('basic HMR', () => { 'Unknown' ) ).toMatch( - 'Objects are not valid as a React child (found: /search/). If you meant to render a collection of children, use an array instead.' + 'Objects are not valid as a React child (found: [object RegExp]). If you meant to render a collection of children, use an array instead.' ) await next.patchFile(aboutPage, aboutContent) From 93a061866da41d3c8d329ec74cb9e896b9f338b3 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Wed, 30 Mar 2022 11:51:32 +0200 Subject: [PATCH 07/15] lock react versions for head and script tests --- test/development/basic-basepath/hmr.test.ts | 2 +- test/development/basic/hmr.test.ts | 2 +- test/e2e/next-head/index.test.ts | 4 ++++ test/e2e/next-script-worker-strategy/index.test.ts | 8 ++++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/test/development/basic-basepath/hmr.test.ts b/test/development/basic-basepath/hmr.test.ts index 3754cb7677ed912..6b94890bc9bae03 100644 --- a/test/development/basic-basepath/hmr.test.ts +++ b/test/development/basic-basepath/hmr.test.ts @@ -540,7 +540,7 @@ describe('basic HMR', () => { 'Unknown' ) ).toMatch( - 'Objects are not valid as a React child (found: /search/). If you meant to render a collection of children, use an array instead.' + 'Objects are not valid as a React child (found: [object RegExp]). If you meant to render a collection of children, use an array instead.' ) await next.patchFile(aboutPage, aboutContent) diff --git a/test/development/basic/hmr.test.ts b/test/development/basic/hmr.test.ts index 47ef6872fa61620..dbc0c0468d98e77 100644 --- a/test/development/basic/hmr.test.ts +++ b/test/development/basic/hmr.test.ts @@ -561,7 +561,7 @@ describe('basic HMR', () => { 'Unknown' ) ).toMatch( - 'Objects are not valid as a React child (found: /search/). If you meant to render a collection of children, use an array instead.' + 'Objects are not valid as a React child (found: [object RegExp]). If you meant to render a collection of children, use an array instead.' ) await next.patchFile(aboutPage, aboutContent) diff --git a/test/e2e/next-head/index.test.ts b/test/e2e/next-head/index.test.ts index 479a67a63bc7ada..3465e316613b7e5 100644 --- a/test/e2e/next-head/index.test.ts +++ b/test/e2e/next-head/index.test.ts @@ -14,6 +14,10 @@ describe('should set-up next', () => { pages: new FileRef(join(__dirname, 'app/pages')), components: new FileRef(join(__dirname, 'app/components')), }, + dependencies: { + react: '17', + 'react-dom': '17', + }, }) }) afterAll(() => next.destroy()) diff --git a/test/e2e/next-script-worker-strategy/index.test.ts b/test/e2e/next-script-worker-strategy/index.test.ts index 078bb3e04b108bd..d9e52d3451fc06e 100644 --- a/test/e2e/next-script-worker-strategy/index.test.ts +++ b/test/e2e/next-script-worker-strategy/index.test.ts @@ -56,6 +56,10 @@ describe('experimental.nextScriptWorkers: true with required Partytown dependenc experimental: { nextScriptWorkers: true, }, + dependencies: { + react: '17', + 'react-dom': '17', + }, }, files: { 'pages/index.js': ` @@ -141,6 +145,10 @@ describe('experimental.nextScriptWorkers: true with config override', () => { nextScriptWorkers: true, }, }, + dependencies: { + react: '17', + 'react-dom': '17', + }, files: { 'pages/_document.js': ` import Document, { Html, Head, Main, NextScript } from "next/document"; From 5a2990a6b9c767ce7afa76b2a98e82ffe8fd00ee Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Wed, 30 Mar 2022 12:12:47 +0200 Subject: [PATCH 08/15] Pin to react 17 for e2e tests --- test/lib/next-modes/base.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/lib/next-modes/base.ts b/test/lib/next-modes/base.ts index 7c26af2cbac8541..4f16e264f328ad9 100644 --- a/test/lib/next-modes/base.ts +++ b/test/lib/next-modes/base.ts @@ -90,8 +90,8 @@ export class NextInstance { } else if (!skipIsolatedNext) { this.testDir = await createNextInstall( { - react: 'latest', - 'react-dom': 'latest', + react: '17.0.2', + 'react-dom': '17.0.2', ...this.dependencies, ...((this.packageJson.dependencies as object | undefined) || {}), }, From de5d8b531602821726f42063319b461d47c14f99 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Wed, 30 Mar 2022 12:14:41 +0200 Subject: [PATCH 09/15] Revert test change --- test/development/basic-basepath/hmr.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/development/basic-basepath/hmr.test.ts b/test/development/basic-basepath/hmr.test.ts index 6b94890bc9bae03..3754cb7677ed912 100644 --- a/test/development/basic-basepath/hmr.test.ts +++ b/test/development/basic-basepath/hmr.test.ts @@ -540,7 +540,7 @@ describe('basic HMR', () => { 'Unknown' ) ).toMatch( - 'Objects are not valid as a React child (found: [object RegExp]). If you meant to render a collection of children, use an array instead.' + 'Objects are not valid as a React child (found: /search/). If you meant to render a collection of children, use an array instead.' ) await next.patchFile(aboutPage, aboutContent) From cbadcc73fbb003083850f4acb70e5aabd13f47c7 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Wed, 30 Mar 2022 12:15:03 +0200 Subject: [PATCH 10/15] lock version for run-tests --- run-tests.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run-tests.js b/run-tests.js index abffb908030372c..107c1eb02ceafe8 100644 --- a/run-tests.js +++ b/run-tests.js @@ -216,8 +216,8 @@ async function main() { // to avoid having to run yarn each time console.log('Creating Next.js install for isolated tests') const testStarter = await createNextInstall({ - react: 'latest', - 'react-dom': 'latest', + react: '17.0.2', + 'react-dom': '17.0.2', }) process.env.NEXT_TEST_STARTER = testStarter } From 94ceba483ecbcd6dafcb31806e41a6a666962494 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Wed, 30 Mar 2022 12:27:21 +0200 Subject: [PATCH 11/15] Pin experimental worker strategy to React 17 --- test/e2e/next-script-worker-strategy/index.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/e2e/next-script-worker-strategy/index.test.ts b/test/e2e/next-script-worker-strategy/index.test.ts index d9e52d3451fc06e..2e7b09008b0df2f 100644 --- a/test/e2e/next-script-worker-strategy/index.test.ts +++ b/test/e2e/next-script-worker-strategy/index.test.ts @@ -25,7 +25,11 @@ describe('experimental.nextScriptWorkers: false with no Partytown dependency', ( } `, }, - dependencies: {}, + // TODO: @housseindjirdeh: verify React 18 functionality + dependencies: { + react: '17.0.2', + 'react-dom': '17.0.2', + }, }) }) afterAll(() => next.destroy()) From abe29e855a19e348ee7464d4bea77f4f964e6ab8 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Wed, 30 Mar 2022 12:28:49 +0200 Subject: [PATCH 12/15] Update matcher --- test/development/basic/hmr.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/development/basic/hmr.test.ts b/test/development/basic/hmr.test.ts index dbc0c0468d98e77..47ef6872fa61620 100644 --- a/test/development/basic/hmr.test.ts +++ b/test/development/basic/hmr.test.ts @@ -561,7 +561,7 @@ describe('basic HMR', () => { 'Unknown' ) ).toMatch( - 'Objects are not valid as a React child (found: [object RegExp]). If you meant to render a collection of children, use an array instead.' + 'Objects are not valid as a React child (found: /search/). If you meant to render a collection of children, use an array instead.' ) await next.patchFile(aboutPage, aboutContent) From a34f6a31d5da3e0f7acbccbc2886ac403e51e3d5 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Wed, 30 Mar 2022 13:06:06 +0200 Subject: [PATCH 13/15] Fix duplicate prop --- test/e2e/next-script-worker-strategy/index.test.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/e2e/next-script-worker-strategy/index.test.ts b/test/e2e/next-script-worker-strategy/index.test.ts index 2e7b09008b0df2f..c281217ed9fc254 100644 --- a/test/e2e/next-script-worker-strategy/index.test.ts +++ b/test/e2e/next-script-worker-strategy/index.test.ts @@ -149,10 +149,6 @@ describe('experimental.nextScriptWorkers: true with config override', () => { nextScriptWorkers: true, }, }, - dependencies: { - react: '17', - 'react-dom': '17', - }, files: { 'pages/_document.js': ` import Document, { Html, Head, Main, NextScript } from "next/document"; @@ -202,6 +198,8 @@ describe('experimental.nextScriptWorkers: true with config override', () => { }, dependencies: { '@builder.io/partytown': '0.4.2', + react: '17', + 'react-dom': '17', }, }) }) From 625c8335ad899f945fdd460f7e7570dc3ce99330 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Wed, 30 Mar 2022 13:31:24 +0200 Subject: [PATCH 14/15] Wait for hydration to kick in --- test/development/basic/hmr.test.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/development/basic/hmr.test.ts b/test/development/basic/hmr.test.ts index 47ef6872fa61620..44e844054bd5463 100644 --- a/test/development/basic/hmr.test.ts +++ b/test/development/basic/hmr.test.ts @@ -22,6 +22,10 @@ describe('basic HMR', () => { pages: new FileRef(join(__dirname, 'hmr/pages')), components: new FileRef(join(__dirname, 'hmr/components')), }, + dependencies: { + react: 'latest', + 'react-dom': 'latest', + }, }) }) afterAll(() => next.destroy()) @@ -714,7 +718,10 @@ describe('basic HMR', () => { await waitFor(2000) throw new Error('waiting') } - return getRedboxSource(browser) + + await waitFor(2000) + const source = await getRedboxSource(browser) + return source }, /an-expected-error-in-gip/) } catch (err) { await next.patchFile(erroredPage, errorContent) From aed89db84c62a551881e50db624236743fdec9a0 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Wed, 30 Mar 2022 13:53:51 +0200 Subject: [PATCH 15/15] Update hmr.test.ts --- test/development/basic/hmr.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/development/basic/hmr.test.ts b/test/development/basic/hmr.test.ts index 44e844054bd5463..fd97aa2ca0dd25b 100644 --- a/test/development/basic/hmr.test.ts +++ b/test/development/basic/hmr.test.ts @@ -565,7 +565,7 @@ describe('basic HMR', () => { 'Unknown' ) ).toMatch( - 'Objects are not valid as a React child (found: /search/). If you meant to render a collection of children, use an array instead.' + 'Objects are not valid as a React child (found: [object RegExp]). If you meant to render a collection of children, use an array instead.' ) await next.patchFile(aboutPage, aboutContent)